aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--COPYING.LIB4
-rw-r--r--ChangeLog807
-rw-r--r--INSTALL8
-rw-r--r--Makefile.am4
-rw-r--r--Makefile.in328
-rw-r--r--NEWS65
-rw-r--r--aclocal.m4801
-rwxr-xr-xautogen.sh84
-rw-r--r--common/Makefile.in274
-rw-r--r--common/README255
-rw-r--r--common/c-to-xml.py14
-rw-r--r--common/check.mak68
-rw-r--r--common/coverage/coverage-report-entry.pl2
-rw-r--r--common/coverage/coverage-report.pl2
-rw-r--r--common/coverage/coverage-report.xsl2
-rw-r--r--common/coverage/lcov.mak10
-rw-r--r--common/gst.supp23
-rwxr-xr-xcommon/gstdoc-scangobj14
-rw-r--r--common/gtk-doc-plugins.mak17
-rw-r--r--common/gtk-doc.mak17
-rw-r--r--common/m4/Makefile.in110
-rw-r--r--common/m4/as-docbook.m414
-rw-r--r--common/m4/gst-check.m430
-rw-r--r--common/m4/gst-doc.m462
-rw-r--r--common/m4/gst-glib2.m48
-rw-r--r--common/m4/gst-plugin-docs.m412
-rw-r--r--common/mangle-tmpl.py2
-rwxr-xr-xcommon/scangobj-merge.py20
-rw-r--r--common/win32.mak8
-rwxr-xr-xcompile10
-rwxr-xr-xconfig.guess178
-rw-r--r--config.h.in3
-rwxr-xr-xconfig.sub86
-rwxr-xr-xconfigure954
-rw-r--r--configure.ac12
-rwxr-xr-xdepcomp454
-rw-r--r--docs/Makefile.in273
-rw-r--r--ext/Makefile.am5
-rw-r--r--ext/Makefile.in279
-rw-r--r--ext/libav/Makefile.am10
-rw-r--r--ext/libav/Makefile.in253
-rw-r--r--ext/libav/gstav.c19
-rw-r--r--ext/libav/gstav.h14
-rw-r--r--ext/libav/gstavauddec.c893
-rw-r--r--ext/libav/gstavauddec.h73
-rw-r--r--ext/libav/gstavaudenc.c752
-rw-r--r--ext/libav/gstavaudenc.h77
-rw-r--r--ext/libav/gstavcfg.c54
-rw-r--r--ext/libav/gstavcfg.h4
-rw-r--r--ext/libav/gstavcodecmap.c2129
-rw-r--r--ext/libav/gstavcodecmap.h30
-rw-r--r--ext/libav/gstavdec.c1457
-rw-r--r--ext/libav/gstavdeinterlace.c6
-rw-r--r--ext/libav/gstavdemux.c32
-rw-r--r--ext/libav/gstavenc.c825
-rw-r--r--ext/libav/gstavenc.h82
-rw-r--r--ext/libav/gstavmux.c76
-rw-r--r--ext/libav/gstavpipe.h72
-rw-r--r--ext/libav/gstavprotocol.c322
-rw-r--r--ext/libav/gstavprotocol.h78
-rw-r--r--ext/libav/gstavutils.c15
-rw-r--r--ext/libav/gstavutils.h4
-rw-r--r--ext/libav/gstavviddec.c204
-rw-r--r--ext/libav/gstavviddec.h93
-rw-r--r--ext/libav/gstavvidenc.c263
-rw-r--r--ext/libav/gstavvidenc.h7
-rw-r--r--ext/libswscale/Makefile.in214
-rw-r--r--ext/libswscale/gstffmpegscale.c33
-rw-r--r--gst-libav.doap54
-rw-r--r--gst-libav.spec2
-rw-r--r--gst-libs/Makefile.in273
-rw-r--r--gst-libs/ext/Makefile.am22
-rw-r--r--gst-libs/ext/Makefile.in296
-rw-r--r--gst-libs/ext/libav/.gitignore87
-rw-r--r--gst-libs/ext/libav/COPYING.LGPLv2.12
-rw-r--r--gst-libs/ext/libav/Changelog374
-rw-r--r--gst-libs/ext/libav/Doxyfile1647
-rw-r--r--gst-libs/ext/libav/LICENSE56
-rw-r--r--gst-libs/ext/libav/Makefile69
-rw-r--r--gst-libs/ext/libav/RELEASE2
-rw-r--r--gst-libs/ext/libav/arch.mak11
-rw-r--r--gst-libs/ext/libav/avconv.c4230
-rw-r--r--gst-libs/ext/libav/avconv.h368
-rw-r--r--gst-libs/ext/libav/avconv_filter.c559
-rw-r--r--gst-libs/ext/libav/avconv_opt.c2132
-rw-r--r--gst-libs/ext/libav/avplay.c668
-rw-r--r--gst-libs/ext/libav/avprobe.c789
-rw-r--r--gst-libs/ext/libav/avserver.c200
-rw-r--r--gst-libs/ext/libav/cmdutils.c982
-rw-r--r--gst-libs/ext/libav/cmdutils.h260
-rw-r--r--gst-libs/ext/libav/cmdutils_common_opts.h30
-rw-r--r--gst-libs/ext/libav/common.mak20
-rw-r--r--gst-libs/ext/libav/compat/getopt.c85
-rw-r--r--gst-libs/ext/libav/compat/msvcrt/snprintf.c70
-rwxr-xr-xgst-libs/ext/libav/compat/plan9/head10
-rw-r--r--gst-libs/ext/libav/compat/plan9/main.c34
-rwxr-xr-xgst-libs/ext/libav/compat/plan9/printf2
-rw-r--r--gst-libs/ext/libav/compat/strtod.c94
-rw-r--r--gst-libs/ext/libav/compat/tms470/math.h7
-rwxr-xr-xgst-libs/ext/libav/configure2425
-rw-r--r--gst-libs/ext/libav/doc/APIchanges553
-rw-r--r--gst-libs/ext/libav/doc/Doxyfile1625
-rw-r--r--gst-libs/ext/libav/doc/Makefile30
-rw-r--r--gst-libs/ext/libav/doc/RELEASE_NOTES127
-rw-r--r--gst-libs/ext/libav/doc/avconv.texi423
-rw-r--r--gst-libs/ext/libav/doc/avprobe.texi33
-rw-r--r--gst-libs/ext/libav/doc/avserver.conf5
-rw-r--r--gst-libs/ext/libav/doc/avserver.texi8
-rw-r--r--gst-libs/ext/libav/doc/avtools-common-opts.texi64
-rw-r--r--gst-libs/ext/libav/doc/bitstream_filters.texi2
-rw-r--r--gst-libs/ext/libav/doc/build_system.txt1
-rw-r--r--gst-libs/ext/libav/doc/demuxers.texi13
-rw-r--r--gst-libs/ext/libav/doc/developer.texi30
-rwxr-xr-xgst-libs/ext/libav/doc/doxy-wrapper.sh14
-rw-r--r--gst-libs/ext/libav/doc/doxy/doxy_stylesheet.css1342
-rw-r--r--gst-libs/ext/libav/doc/doxy/footer.html11
-rw-r--r--gst-libs/ext/libav/doc/doxy/header.html14
-rw-r--r--gst-libs/ext/libav/doc/eval.texi2
-rw-r--r--gst-libs/ext/libav/doc/faq.texi46
-rw-r--r--gst-libs/ext/libav/doc/fate.texi27
-rw-r--r--gst-libs/ext/libav/doc/ffmpeg.texi1091
-rw-r--r--gst-libs/ext/libav/doc/filters.texi439
-rw-r--r--gst-libs/ext/libav/doc/general.texi89
-rw-r--r--gst-libs/ext/libav/doc/git-howto.texi96
-rw-r--r--gst-libs/ext/libav/doc/indevs.texi36
-rw-r--r--gst-libs/ext/libav/doc/muxers.texi135
-rw-r--r--gst-libs/ext/libav/doc/nut.texi134
-rw-r--r--gst-libs/ext/libav/doc/optimization.txt2
-rw-r--r--gst-libs/ext/libav/doc/platform.texi319
-rw-r--r--gst-libs/ext/libav/doc/print_options.c123
-rw-r--r--gst-libs/ext/libav/doc/protocols.texi191
-rw-r--r--gst-libs/ext/libav/doc/rate_distortion.txt2
-rw-r--r--gst-libs/ext/libav/doc/swscale.txt3
-rw-r--r--gst-libs/ext/libav/doc/t2h.init174
-rwxr-xr-xgst-libs/ext/libav/doc/texi2pod.pl19
-rw-r--r--gst-libs/ext/libav/doc/viterbi.txt5
-rw-r--r--gst-libs/ext/libav/ffmpeg.c4415
-rw-r--r--gst-libs/ext/libav/libavcodec/4xm.c983
-rw-r--r--gst-libs/ext/libav/libavcodec/8bps.c293
-rw-r--r--gst-libs/ext/libav/libavcodec/8svx.c69
-rw-r--r--gst-libs/ext/libav/libavcodec/Makefile407
-rw-r--r--gst-libs/ext/libav/libavcodec/a64enc.h5
-rw-r--r--gst-libs/ext/libav/libavcodec/a64multienc.c55
-rw-r--r--gst-libs/ext/libav/libavcodec/aac.h46
-rw-r--r--gst-libs/ext/libav/libavcodec/aac_ac3_parser.c9
-rw-r--r--gst-libs/ext/libav/libavcodec/aac_ac3_parser.h2
-rw-r--r--gst-libs/ext/libav/libavcodec/aac_adtstoasc_bsf.c8
-rw-r--r--gst-libs/ext/libav/libavcodec/aac_parser.c2
-rw-r--r--gst-libs/ext/libav/libavcodec/aac_tablegen.h1
-rw-r--r--gst-libs/ext/libav/libavcodec/aac_tablegen_decl.h2
-rw-r--r--gst-libs/ext/libav/libavcodec/aacadtsdec.h2
-rw-r--r--gst-libs/ext/libav/libavcodec/aaccoder.c44
-rw-r--r--gst-libs/ext/libav/libavcodec/aacdec.c950
-rw-r--r--gst-libs/ext/libav/libavcodec/aacdectab.h20
-rw-r--r--gst-libs/ext/libav/libavcodec/aacenc.c444
-rw-r--r--gst-libs/ext/libav/libavcodec/aacenc.h14
-rw-r--r--gst-libs/ext/libav/libavcodec/aacps.c240
-rw-r--r--gst-libs/ext/libav/libavcodec/aacps.h24
-rw-r--r--gst-libs/ext/libav/libavcodec/aacps_tablegen.c20
-rw-r--r--gst-libs/ext/libav/libavcodec/aacps_tablegen.h17
-rw-r--r--gst-libs/ext/libav/libavcodec/aacpsdsp.c214
-rw-r--r--gst-libs/ext/libav/libavcodec/aacpsdsp.h53
-rw-r--r--gst-libs/ext/libav/libavcodec/aacpsy.c44
-rw-r--r--gst-libs/ext/libav/libavcodec/aacsbr.c313
-rw-r--r--gst-libs/ext/libav/libavcodec/aacsbrdata.h8
-rw-r--r--gst-libs/ext/libav/libavcodec/aactab.c4
-rw-r--r--gst-libs/ext/libav/libavcodec/aactab.h4
-rw-r--r--gst-libs/ext/libav/libavcodec/aasc.c26
-rw-r--r--gst-libs/ext/libav/libavcodec/ac3.h2
-rw-r--r--gst-libs/ext/libav/libavcodec/ac3_parser.c10
-rw-r--r--gst-libs/ext/libav/libavcodec/ac3dec.c136
-rw-r--r--gst-libs/ext/libav/libavcodec/ac3dec.h10
-rw-r--r--gst-libs/ext/libav/libavcodec/ac3dsp.c28
-rw-r--r--gst-libs/ext/libav/libavcodec/ac3dsp.h3
-rw-r--r--gst-libs/ext/libav/libavcodec/ac3enc.c55
-rw-r--r--gst-libs/ext/libav/libavcodec/ac3enc.h11
-rw-r--r--gst-libs/ext/libav/libavcodec/ac3enc_fixed.c30
-rw-r--r--gst-libs/ext/libav/libavcodec/ac3enc_float.c31
-rw-r--r--gst-libs/ext/libav/libavcodec/ac3enc_opts_template.c78
-rw-r--r--gst-libs/ext/libav/libavcodec/ac3enc_template.c51
-rw-r--r--gst-libs/ext/libav/libavcodec/ac3tab.c2
-rw-r--r--gst-libs/ext/libav/libavcodec/ac3tab.h2
-rw-r--r--gst-libs/ext/libav/libavcodec/acelp_filters.c2
-rw-r--r--gst-libs/ext/libav/libavcodec/acelp_filters.h2
-rw-r--r--gst-libs/ext/libav/libavcodec/acelp_pitch_delay.c7
-rw-r--r--gst-libs/ext/libav/libavcodec/acelp_vectors.c8
-rw-r--r--gst-libs/ext/libav/libavcodec/acelp_vectors.h2
-rw-r--r--gst-libs/ext/libav/libavcodec/adpcm.c990
-rw-r--r--gst-libs/ext/libav/libavcodec/adpcm.h8
-rw-r--r--gst-libs/ext/libav/libavcodec/adpcmenc.c303
-rw-r--r--gst-libs/ext/libav/libavcodec/adx.c1
-rw-r--r--gst-libs/ext/libav/libavcodec/adx.h4
-rw-r--r--gst-libs/ext/libav/libavcodec/adx_parser.c5
-rw-r--r--gst-libs/ext/libav/libavcodec/adxdec.c26
-rw-r--r--gst-libs/ext/libav/libavcodec/adxenc.c48
-rw-r--r--gst-libs/ext/libav/libavcodec/alac.c673
-rw-r--r--gst-libs/ext/libav/libavcodec/alac_data.c56
-rw-r--r--gst-libs/ext/libav/libavcodec/alac_data.h46
-rw-r--r--gst-libs/ext/libav/libavcodec/alacenc.c472
-rw-r--r--gst-libs/ext/libav/libavcodec/allcodecs.c788
-rw-r--r--gst-libs/ext/libav/libavcodec/alpha/Makefile13
-rw-r--r--gst-libs/ext/libav/libavcodec/alpha/dsputil_alpha.c4
-rw-r--r--gst-libs/ext/libav/libavcodec/alpha/mpegvideo_alpha.c2
-rw-r--r--gst-libs/ext/libav/libavcodec/alsdec.c46
-rw-r--r--gst-libs/ext/libav/libavcodec/amr.h4
-rw-r--r--gst-libs/ext/libav/libavcodec/amrnbdata.h7
-rw-r--r--gst-libs/ext/libav/libavcodec/amrnbdec.c53
-rw-r--r--gst-libs/ext/libav/libavcodec/amrwbdata.h6
-rw-r--r--gst-libs/ext/libav/libavcodec/amrwbdec.c88
-rw-r--r--gst-libs/ext/libav/libavcodec/anm.c80
-rw-r--r--gst-libs/ext/libav/libavcodec/ansi.c18
-rw-r--r--gst-libs/ext/libav/libavcodec/apedec.c194
-rw-r--r--gst-libs/ext/libav/libavcodec/api-example.c237
-rw-r--r--gst-libs/ext/libav/libavcodec/arm/Makefile61
-rw-r--r--gst-libs/ext/libav/libavcodec/arm/aac.h4
-rw-r--r--gst-libs/ext/libav/libavcodec/arm/aacpsdsp_init_arm.c57
-rw-r--r--gst-libs/ext/libav/libavcodec/arm/aacpsdsp_neon.S272
-rw-r--r--gst-libs/ext/libav/libavcodec/arm/ac3dsp_arm.S2
-rw-r--r--gst-libs/ext/libav/libavcodec/arm/ac3dsp_armv6.S23
-rw-r--r--gst-libs/ext/libav/libavcodec/arm/ac3dsp_init_arm.c8
-rw-r--r--gst-libs/ext/libav/libavcodec/arm/ac3dsp_neon.S2
-rw-r--r--gst-libs/ext/libav/libavcodec/arm/asm.S212
-rw-r--r--gst-libs/ext/libav/libavcodec/arm/dca.h4
-rw-r--r--gst-libs/ext/libav/libavcodec/arm/dcadsp_init_arm.c8
-rw-r--r--gst-libs/ext/libav/libavcodec/arm/dcadsp_neon.S2
-rw-r--r--gst-libs/ext/libav/libavcodec/arm/dsputil_arm.S18
-rw-r--r--gst-libs/ext/libav/libavcodec/arm/dsputil_arm.h1
-rw-r--r--gst-libs/ext/libav/libavcodec/arm/dsputil_armv6.S4
-rw-r--r--gst-libs/ext/libav/libavcodec/arm/dsputil_init_arm.c15
-rw-r--r--gst-libs/ext/libav/libavcodec/arm/dsputil_init_armv5te.c8
-rw-r--r--gst-libs/ext/libav/libavcodec/arm/dsputil_init_armv6.c4
-rw-r--r--gst-libs/ext/libav/libavcodec/arm/dsputil_init_neon.c34
-rw-r--r--gst-libs/ext/libav/libavcodec/arm/dsputil_init_vfp.c4
-rw-r--r--gst-libs/ext/libav/libavcodec/arm/dsputil_iwmmxt.c210
-rw-r--r--gst-libs/ext/libav/libavcodec/arm/dsputil_iwmmxt_rnd_template.c1114
-rw-r--r--gst-libs/ext/libav/libavcodec/arm/dsputil_neon.S479
-rw-r--r--gst-libs/ext/libav/libavcodec/arm/dsputil_vfp.S49
-rw-r--r--gst-libs/ext/libav/libavcodec/arm/fft_fixed_init_arm.c8
-rw-r--r--gst-libs/ext/libav/libavcodec/arm/fft_fixed_neon.S4
-rw-r--r--gst-libs/ext/libav/libavcodec/arm/fft_init_arm.c13
-rw-r--r--gst-libs/ext/libav/libavcodec/arm/fft_neon.S6
-rw-r--r--gst-libs/ext/libav/libavcodec/arm/flacdsp_arm.S146
-rw-r--r--gst-libs/ext/libav/libavcodec/arm/flacdsp_init_arm.c32
-rw-r--r--gst-libs/ext/libav/libavcodec/arm/fmtconvert_init_arm.c7
-rw-r--r--gst-libs/ext/libav/libavcodec/arm/fmtconvert_neon.S4
-rw-r--r--gst-libs/ext/libav/libavcodec/arm/fmtconvert_vfp.S4
-rw-r--r--gst-libs/ext/libav/libavcodec/arm/h264cmc_neon.S92
-rw-r--r--gst-libs/ext/libav/libavcodec/arm/h264dsp_init_arm.c6
-rw-r--r--gst-libs/ext/libav/libavcodec/arm/h264dsp_neon.S14
-rw-r--r--gst-libs/ext/libav/libavcodec/arm/h264idct_neon.S4
-rw-r--r--gst-libs/ext/libav/libavcodec/arm/h264pred_init_arm.c48
-rw-r--r--gst-libs/ext/libav/libavcodec/arm/h264pred_neon.S2
-rw-r--r--gst-libs/ext/libav/libavcodec/arm/int_neon.S31
-rw-r--r--gst-libs/ext/libav/libavcodec/arm/jrevdct_arm.S2
-rw-r--r--gst-libs/ext/libav/libavcodec/arm/mathops.h28
-rw-r--r--gst-libs/ext/libav/libavcodec/arm/mdct_fixed_neon.S4
-rw-r--r--gst-libs/ext/libav/libavcodec/arm/mdct_neon.S4
-rw-r--r--gst-libs/ext/libav/libavcodec/arm/mpegaudiodsp_fixed_armv6.S2
-rw-r--r--gst-libs/ext/libav/libavcodec/arm/mpegaudiodsp_init_arm.c6
-rw-r--r--gst-libs/ext/libav/libavcodec/arm/mpegvideo_arm.c19
-rw-r--r--gst-libs/ext/libav/libavcodec/arm/mpegvideo_arm.h3
-rw-r--r--gst-libs/ext/libav/libavcodec/arm/mpegvideo_armv5te.c2
-rw-r--r--gst-libs/ext/libav/libavcodec/arm/mpegvideo_armv5te_s.S8
-rw-r--r--gst-libs/ext/libav/libavcodec/arm/mpegvideo_iwmmxt.c101
-rw-r--r--gst-libs/ext/libav/libavcodec/arm/mpegvideo_neon.S2
-rw-r--r--gst-libs/ext/libav/libavcodec/arm/rdft_neon.S4
-rw-r--r--gst-libs/ext/libav/libavcodec/arm/rv34dsp_init_arm.c45
-rw-r--r--gst-libs/ext/libav/libavcodec/arm/rv34dsp_init_neon.c40
-rw-r--r--gst-libs/ext/libav/libavcodec/arm/rv34dsp_neon.S2
-rw-r--r--gst-libs/ext/libav/libavcodec/arm/rv40dsp_init_arm.c147
-rw-r--r--gst-libs/ext/libav/libavcodec/arm/rv40dsp_init_neon.c138
-rw-r--r--gst-libs/ext/libav/libavcodec/arm/rv40dsp_neon.S2
-rw-r--r--gst-libs/ext/libav/libavcodec/arm/sbrdsp_init_arm.c73
-rw-r--r--gst-libs/ext/libav/libavcodec/arm/sbrdsp_neon.S411
-rw-r--r--gst-libs/ext/libav/libavcodec/arm/simple_idct_arm.S58
-rw-r--r--gst-libs/ext/libav/libavcodec/arm/simple_idct_armv5te.S36
-rw-r--r--gst-libs/ext/libav/libavcodec/arm/simple_idct_armv6.S35
-rw-r--r--gst-libs/ext/libav/libavcodec/arm/simple_idct_neon.S10
-rw-r--r--gst-libs/ext/libav/libavcodec/arm/synth_filter_neon.S4
-rw-r--r--gst-libs/ext/libav/libavcodec/arm/videodsp_arm.h29
-rw-r--r--gst-libs/ext/libav/libavcodec/arm/videodsp_armv5te.S31
-rw-r--r--gst-libs/ext/libav/libavcodec/arm/videodsp_init_arm.c29
-rw-r--r--gst-libs/ext/libav/libavcodec/arm/videodsp_init_armv5te.c30
-rw-r--r--gst-libs/ext/libav/libavcodec/arm/vp3dsp_init_arm.c45
-rw-r--r--gst-libs/ext/libav/libavcodec/arm/vp3dsp_neon.S31
-rw-r--r--gst-libs/ext/libav/libavcodec/arm/vp56_arith.h18
-rw-r--r--gst-libs/ext/libav/libavcodec/arm/vp56dsp_init_arm.c8
-rw-r--r--gst-libs/ext/libav/libavcodec/arm/vp56dsp_neon.S2
-rw-r--r--gst-libs/ext/libav/libavcodec/arm/vp8.h6
-rw-r--r--gst-libs/ext/libav/libavcodec/arm/vp8_armv6.S14
-rw-r--r--gst-libs/ext/libav/libavcodec/arm/vp8dsp.h78
-rw-r--r--gst-libs/ext/libav/libavcodec/arm/vp8dsp_armv6.S1634
-rw-r--r--gst-libs/ext/libav/libavcodec/arm/vp8dsp_init_arm.c148
-rw-r--r--gst-libs/ext/libav/libavcodec/arm/vp8dsp_init_armv6.c118
-rw-r--r--gst-libs/ext/libav/libavcodec/arm/vp8dsp_init_neon.c114
-rw-r--r--gst-libs/ext/libav/libavcodec/arm/vp8dsp_neon.S33
-rw-r--r--gst-libs/ext/libav/libavcodec/ass.c1
-rw-r--r--gst-libs/ext/libav/libavcodec/assdec.c8
-rw-r--r--gst-libs/ext/libav/libavcodec/assenc.c14
-rw-r--r--gst-libs/ext/libav/libavcodec/asv.c95
-rw-r--r--gst-libs/ext/libav/libavcodec/asv.h67
-rw-r--r--gst-libs/ext/libav/libavcodec/asv1.c655
-rw-r--r--gst-libs/ext/libav/libavcodec/asvdec.c353
-rw-r--r--gst-libs/ext/libav/libavcodec/asvenc.c290
-rw-r--r--gst-libs/ext/libav/libavcodec/atrac.c6
-rw-r--r--gst-libs/ext/libav/libavcodec/atrac.h4
-rw-r--r--gst-libs/ext/libav/libavcodec/atrac1.c62
-rw-r--r--gst-libs/ext/libav/libavcodec/atrac3.c1146
-rw-r--r--gst-libs/ext/libav/libavcodec/atrac3data.h98
-rw-r--r--gst-libs/ext/libav/libavcodec/audio_frame_queue.c163
-rw-r--r--gst-libs/ext/libav/libavcodec/audio_frame_queue.h83
-rw-r--r--gst-libs/ext/libav/libavcodec/audioconvert.c49
-rw-r--r--gst-libs/ext/libav/libavcodec/audioconvert.h51
-rw-r--r--gst-libs/ext/libav/libavcodec/aura.c34
-rw-r--r--gst-libs/ext/libav/libavcodec/avcodec.h4545
-rw-r--r--gst-libs/ext/libav/libavcodec/avfft.h17
-rw-r--r--gst-libs/ext/libav/libavcodec/avpacket.c137
-rw-r--r--gst-libs/ext/libav/libavcodec/avpicture.c125
-rw-r--r--gst-libs/ext/libav/libavcodec/avs.c14
-rw-r--r--gst-libs/ext/libav/libavcodec/bethsoftvideo.c44
-rw-r--r--gst-libs/ext/libav/libavcodec/bfi.c55
-rw-r--r--gst-libs/ext/libav/libavcodec/bfin/Makefile15
-rw-r--r--gst-libs/ext/libav/libavcodec/bfin/dsputil_bfin.c5
-rw-r--r--gst-libs/ext/libav/libavcodec/bfin/fdct_bfin.S1
-rw-r--r--gst-libs/ext/libav/libavcodec/bfin/idct_bfin.S2
-rw-r--r--gst-libs/ext/libav/libavcodec/bfin/mpegvideo_bfin.c3
-rw-r--r--gst-libs/ext/libav/libavcodec/bfin/pixels_bfin.S2
-rw-r--r--gst-libs/ext/libav/libavcodec/bfin/vp3_bfin.c2
-rw-r--r--gst-libs/ext/libav/libavcodec/bfin/vp3_idct_bfin.S2
-rw-r--r--gst-libs/ext/libav/libavcodec/bgmc.c734
-rw-r--r--gst-libs/ext/libav/libavcodec/bink.c21
-rw-r--r--gst-libs/ext/libav/libavcodec/binkaudio.c97
-rw-r--r--gst-libs/ext/libav/libavcodec/bitstream.c14
-rw-r--r--gst-libs/ext/libav/libavcodec/bitstream_filter.c5
-rw-r--r--gst-libs/ext/libav/libavcodec/bmp.c165
-rw-r--r--gst-libs/ext/libav/libavcodec/bmpenc.c92
-rw-r--r--gst-libs/ext/libav/libavcodec/bmv.c52
-rw-r--r--gst-libs/ext/libav/libavcodec/bytestream.h34
-rw-r--r--gst-libs/ext/libav/libavcodec/c93.c63
-rw-r--r--gst-libs/ext/libav/libavcodec/cabac.c199
-rw-r--r--gst-libs/ext/libav/libavcodec/cabac.h5
-rw-r--r--gst-libs/ext/libav/libavcodec/cabac_functions.h14
-rw-r--r--gst-libs/ext/libav/libavcodec/cavs.c511
-rw-r--r--gst-libs/ext/libav/libavcodec/cavs.h88
-rw-r--r--gst-libs/ext/libav/libavcodec/cavs_parser.c6
-rw-r--r--gst-libs/ext/libav/libavcodec/cavsdata.c62
-rw-r--r--gst-libs/ext/libav/libavcodec/cavsdata.h438
-rw-r--r--gst-libs/ext/libav/libavcodec/cavsdec.c1084
-rw-r--r--gst-libs/ext/libav/libavcodec/cavsdsp.c5
-rw-r--r--gst-libs/ext/libav/libavcodec/cavsdsp.h3
-rw-r--r--gst-libs/ext/libav/libavcodec/cdgraphics.c17
-rw-r--r--gst-libs/ext/libav/libavcodec/cdxl.c311
-rw-r--r--gst-libs/ext/libav/libavcodec/celp_filters.c18
-rw-r--r--gst-libs/ext/libav/libavcodec/celp_filters.h3
-rw-r--r--gst-libs/ext/libav/libavcodec/celp_math.c39
-rw-r--r--gst-libs/ext/libav/libavcodec/celp_math.h20
-rw-r--r--gst-libs/ext/libav/libavcodec/cinepak.c15
-rw-r--r--gst-libs/ext/libav/libavcodec/cljr.c42
-rw-r--r--gst-libs/ext/libav/libavcodec/cllc.c420
-rw-r--r--gst-libs/ext/libav/libavcodec/cngdec.c177
-rw-r--r--gst-libs/ext/libav/libavcodec/cngenc.c116
-rw-r--r--gst-libs/ext/libav/libavcodec/codec_desc.c2215
-rw-r--r--gst-libs/ext/libav/libavcodec/cook.c191
-rw-r--r--gst-libs/ext/libav/libavcodec/cook_parser.c59
-rw-r--r--gst-libs/ext/libav/libavcodec/cos_tablegen.c3
-rw-r--r--gst-libs/ext/libav/libavcodec/cscd.c19
-rw-r--r--gst-libs/ext/libav/libavcodec/cyuv.c20
-rw-r--r--gst-libs/ext/libav/libavcodec/dca.c1992
-rw-r--r--gst-libs/ext/libav/libavcodec/dca.h5
-rw-r--r--gst-libs/ext/libav/libavcodec/dca_parser.c80
-rw-r--r--gst-libs/ext/libav/libavcodec/dca_parser.h36
-rw-r--r--gst-libs/ext/libav/libavcodec/dcadata.h6
-rw-r--r--gst-libs/ext/libav/libavcodec/dcadec.c1964
-rw-r--r--gst-libs/ext/libav/libavcodec/dct-test.c78
-rw-r--r--gst-libs/ext/libav/libavcodec/dct.c5
-rw-r--r--gst-libs/ext/libav/libavcodec/dct.h2
-rw-r--r--gst-libs/ext/libav/libavcodec/dfa.c21
-rw-r--r--gst-libs/ext/libav/libavcodec/dirac.c115
-rw-r--r--gst-libs/ext/libav/libavcodec/dirac.h2
-rw-r--r--gst-libs/ext/libav/libavcodec/dirac_parser.c5
-rw-r--r--gst-libs/ext/libav/libavcodec/dnxhd_parser.c2
-rw-r--r--gst-libs/ext/libav/libavcodec/dnxhddata.c1
-rw-r--r--gst-libs/ext/libav/libavcodec/dnxhddata.h2
-rw-r--r--gst-libs/ext/libav/libavcodec/dnxhddec.c29
-rw-r--r--gst-libs/ext/libav/libavcodec/dnxhdenc.c74
-rw-r--r--gst-libs/ext/libav/libavcodec/dnxhdenc.h8
-rw-r--r--gst-libs/ext/libav/libavcodec/dpcm.c105
-rw-r--r--gst-libs/ext/libav/libavcodec/dpx.c25
-rw-r--r--gst-libs/ext/libav/libavcodec/dpxenc.c62
-rw-r--r--gst-libs/ext/libav/libavcodec/dsicinav.c31
-rw-r--r--gst-libs/ext/libav/libavcodec/dsputil.c271
-rw-r--r--gst-libs/ext/libav/libavcodec/dsputil.h202
-rw-r--r--gst-libs/ext/libav/libavcodec/dsputil_template.c79
-rw-r--r--gst-libs/ext/libav/libavcodec/dump_extradata_bsf.c3
-rw-r--r--gst-libs/ext/libav/libavcodec/dv.c558
-rw-r--r--gst-libs/ext/libav/libavcodec/dv_profile.c332
-rw-r--r--gst-libs/ext/libav/libavcodec/dv_profile.h72
-rw-r--r--gst-libs/ext/libav/libavcodec/dv_tablegen.h1
-rw-r--r--gst-libs/ext/libav/libavcodec/dv_vlc_data.h8
-rw-r--r--gst-libs/ext/libav/libavcodec/dvbsub.c12
-rw-r--r--gst-libs/ext/libav/libavcodec/dvbsub_parser.c2
-rw-r--r--gst-libs/ext/libav/libavcodec/dvbsubdec.c6
-rw-r--r--gst-libs/ext/libav/libavcodec/dvdata.c343
-rw-r--r--gst-libs/ext/libav/libavcodec/dvdata.h278
-rw-r--r--gst-libs/ext/libav/libavcodec/dvdec.c386
-rw-r--r--gst-libs/ext/libav/libavcodec/dvdsub_parser.c5
-rw-r--r--gst-libs/ext/libav/libavcodec/dvdsubdec.c10
-rw-r--r--gst-libs/ext/libav/libavcodec/dvdsubenc.c10
-rw-r--r--gst-libs/ext/libav/libavcodec/dwt.c1152
-rw-r--r--gst-libs/ext/libav/libavcodec/dwt.h134
-rw-r--r--gst-libs/ext/libav/libavcodec/dxa.c17
-rw-r--r--gst-libs/ext/libav/libavcodec/dxtory.c16
-rw-r--r--gst-libs/ext/libav/libavcodec/dxva2.c4
-rw-r--r--gst-libs/ext/libav/libavcodec/dxva2.h17
-rw-r--r--gst-libs/ext/libav/libavcodec/dxva2_h264.c8
-rw-r--r--gst-libs/ext/libav/libavcodec/dxva2_mpeg2.c5
-rw-r--r--gst-libs/ext/libav/libavcodec/dxva2_vc1.c24
-rw-r--r--gst-libs/ext/libav/libavcodec/eac3dec.c8
-rw-r--r--gst-libs/ext/libav/libavcodec/eac3enc.c10
-rw-r--r--gst-libs/ext/libav/libavcodec/eacmv.c14
-rw-r--r--gst-libs/ext/libav/libavcodec/eaidct.c2
-rw-r--r--gst-libs/ext/libav/libavcodec/eaidct.h27
-rw-r--r--gst-libs/ext/libav/libavcodec/eamad.c138
-rw-r--r--gst-libs/ext/libav/libavcodec/eatgq.c39
-rw-r--r--gst-libs/ext/libav/libavcodec/eatgv.c37
-rw-r--r--gst-libs/ext/libav/libavcodec/eatqi.c46
-rw-r--r--gst-libs/ext/libav/libavcodec/elbg.c3
-rw-r--r--gst-libs/ext/libav/libavcodec/error_resilience.c28
-rw-r--r--gst-libs/ext/libav/libavcodec/escape124.c16
-rw-r--r--gst-libs/ext/libav/libavcodec/faandct.c39
-rw-r--r--gst-libs/ext/libav/libavcodec/faandct.h2
-rw-r--r--gst-libs/ext/libav/libavcodec/faanidct.c1
-rw-r--r--gst-libs/ext/libav/libavcodec/faxcompr.c15
-rw-r--r--gst-libs/ext/libav/libavcodec/fft-test.c29
-rw-r--r--gst-libs/ext/libav/libavcodec/fft.c3
-rw-r--r--gst-libs/ext/libav/libavcodec/fft.h2
-rw-r--r--gst-libs/ext/libav/libavcodec/ffv1.c1817
-rw-r--r--gst-libs/ext/libav/libavcodec/ffv1.h203
-rw-r--r--gst-libs/ext/libav/libavcodec/ffv1dec.c922
-rw-r--r--gst-libs/ext/libav/libavcodec/ffv1enc.c1102
-rw-r--r--gst-libs/ext/libav/libavcodec/flac.c96
-rw-r--r--gst-libs/ext/libav/libavcodec/flac.h11
-rw-r--r--gst-libs/ext/libav/libavcodec/flac_parser.c21
-rw-r--r--gst-libs/ext/libav/libavcodec/flacdec.c338
-rw-r--r--gst-libs/ext/libav/libavcodec/flacdsp.c131
-rw-r--r--gst-libs/ext/libav/libavcodec/flacdsp.h37
-rw-r--r--gst-libs/ext/libav/libavcodec/flacdsp_lpc_template.c141
-rw-r--r--gst-libs/ext/libav/libavcodec/flacdsp_template.c103
-rw-r--r--gst-libs/ext/libav/libavcodec/flacenc.c549
-rw-r--r--gst-libs/ext/libav/libavcodec/flashsv.c39
-rw-r--r--gst-libs/ext/libav/libavcodec/flashsvenc.c31
-rw-r--r--gst-libs/ext/libav/libavcodec/flicvideo.c49
-rw-r--r--gst-libs/ext/libav/libavcodec/flvdec.c14
-rw-r--r--gst-libs/ext/libav/libavcodec/flvenc.c15
-rw-r--r--gst-libs/ext/libav/libavcodec/fmtconvert.c3
-rw-r--r--gst-libs/ext/libav/libavcodec/fmtconvert.h2
-rw-r--r--gst-libs/ext/libav/libavcodec/fraps.c33
-rw-r--r--gst-libs/ext/libav/libavcodec/frwu.c40
-rw-r--r--gst-libs/ext/libav/libavcodec/g722.h2
-rw-r--r--gst-libs/ext/libav/libavcodec/g722dec.c18
-rw-r--r--gst-libs/ext/libav/libavcodec/g722enc.c82
-rw-r--r--gst-libs/ext/libav/libavcodec/g723_1.c1382
-rw-r--r--gst-libs/ext/libav/libavcodec/g723_1_data.h1200
-rw-r--r--gst-libs/ext/libav/libavcodec/g726.c64
-rw-r--r--gst-libs/ext/libav/libavcodec/get_bits.h42
-rw-r--r--gst-libs/ext/libav/libavcodec/gif.c36
-rw-r--r--gst-libs/ext/libav/libavcodec/gifdec.c14
-rw-r--r--gst-libs/ext/libav/libavcodec/golomb-test.c97
-rw-r--r--gst-libs/ext/libav/libavcodec/golomb.h15
-rw-r--r--gst-libs/ext/libav/libavcodec/gsm_parser.c16
-rw-r--r--gst-libs/ext/libav/libavcodec/gsmdec.c28
-rw-r--r--gst-libs/ext/libav/libavcodec/gsmdec_data.h8
-rw-r--r--gst-libs/ext/libav/libavcodec/h261.c1
-rw-r--r--gst-libs/ext/libav/libavcodec/h261_parser.c2
-rw-r--r--gst-libs/ext/libav/libavcodec/h261dec.c30
-rw-r--r--gst-libs/ext/libav/libavcodec/h261enc.c16
-rw-r--r--gst-libs/ext/libav/libavcodec/h263.h4
-rw-r--r--gst-libs/ext/libav/libavcodec/h263_parser.c2
-rw-r--r--gst-libs/ext/libav/libavcodec/h263dec.c147
-rw-r--r--gst-libs/ext/libav/libavcodec/h264.c5021
-rw-r--r--gst-libs/ext/libav/libavcodec/h264.h520
-rw-r--r--gst-libs/ext/libav/libavcodec/h264_cabac.c77
-rw-r--r--gst-libs/ext/libav/libavcodec/h264_cavlc.c59
-rw-r--r--gst-libs/ext/libav/libavcodec/h264_direct.c27
-rw-r--r--gst-libs/ext/libav/libavcodec/h264_loopfilter.c4
-rw-r--r--gst-libs/ext/libav/libavcodec/h264_mb_template.c380
-rw-r--r--gst-libs/ext/libav/libavcodec/h264_mc_template.c160
-rw-r--r--gst-libs/ext/libav/libavcodec/h264_mp4toannexb_bsf.c4
-rw-r--r--gst-libs/ext/libav/libavcodec/h264_mvpred.h1007
-rw-r--r--gst-libs/ext/libav/libavcodec/h264_parser.c3
-rw-r--r--gst-libs/ext/libav/libavcodec/h264_ps.c14
-rw-r--r--gst-libs/ext/libav/libavcodec/h264_refs.c153
-rw-r--r--gst-libs/ext/libav/libavcodec/h264data.h369
-rw-r--r--gst-libs/ext/libav/libavcodec/h264dsp.c3
-rw-r--r--gst-libs/ext/libav/libavcodec/h264dsp.h97
-rw-r--r--gst-libs/ext/libav/libavcodec/h264idct_template.c1
-rw-r--r--gst-libs/ext/libav/libavcodec/h264pred.c103
-rw-r--r--gst-libs/ext/libav/libavcodec/h264pred.h83
-rw-r--r--gst-libs/ext/libav/libavcodec/h264pred_template.c233
-rw-r--r--gst-libs/ext/libav/libavcodec/huffman.c105
-rw-r--r--gst-libs/ext/libav/libavcodec/huffman.h4
-rw-r--r--gst-libs/ext/libav/libavcodec/huffyuv.c1458
-rw-r--r--gst-libs/ext/libav/libavcodec/huffyuv.h92
-rw-r--r--gst-libs/ext/libav/libavcodec/huffyuvdec.c782
-rw-r--r--gst-libs/ext/libav/libavcodec/huffyuvenc.c633
-rw-r--r--gst-libs/ext/libav/libavcodec/idcinvideo.c15
-rw-r--r--gst-libs/ext/libav/libavcodec/iff.c41
-rw-r--r--gst-libs/ext/libav/libavcodec/iirfilter.c2
-rw-r--r--gst-libs/ext/libav/libavcodec/imc.c799
-rw-r--r--gst-libs/ext/libav/libavcodec/imgconvert.c768
-rw-r--r--gst-libs/ext/libav/libavcodec/imgconvert.h44
-rw-r--r--gst-libs/ext/libav/libavcodec/imx_dump_header_bsf.c2
-rw-r--r--gst-libs/ext/libav/libavcodec/indeo2.c20
-rw-r--r--gst-libs/ext/libav/libavcodec/indeo3.c81
-rw-r--r--gst-libs/ext/libav/libavcodec/indeo3data.h10
-rw-r--r--gst-libs/ext/libav/libavcodec/indeo4.c15
-rw-r--r--gst-libs/ext/libav/libavcodec/indeo5.c5
-rw-r--r--gst-libs/ext/libav/libavcodec/intelh263dec.c7
-rw-r--r--gst-libs/ext/libav/libavcodec/internal.h45
-rw-r--r--gst-libs/ext/libav/libavcodec/interplayvideo.c343
-rw-r--r--gst-libs/ext/libav/libavcodec/intrax8.c24
-rw-r--r--gst-libs/ext/libav/libavcodec/intrax8.h4
-rw-r--r--gst-libs/ext/libav/libavcodec/intrax8dsp.c41
-rw-r--r--gst-libs/ext/libav/libavcodec/intrax8dsp.h35
-rw-r--r--gst-libs/ext/libav/libavcodec/inverse.c1
-rw-r--r--gst-libs/ext/libav/libavcodec/ituh263dec.c32
-rw-r--r--gst-libs/ext/libav/libavcodec/ituh263enc.c8
-rw-r--r--gst-libs/ext/libav/libavcodec/ivi_common.c606
-rw-r--r--gst-libs/ext/libav/libavcodec/ivi_common.h102
-rw-r--r--gst-libs/ext/libav/libavcodec/ivi_dsp.c5
-rw-r--r--gst-libs/ext/libav/libavcodec/ivi_dsp.h6
-rw-r--r--gst-libs/ext/libav/libavcodec/jfdctfst.c4
-rw-r--r--gst-libs/ext/libav/libavcodec/jfdctint.c2
-rw-r--r--gst-libs/ext/libav/libavcodec/jpegls.c2
-rw-r--r--gst-libs/ext/libav/libavcodec/jpegls.h1
-rw-r--r--gst-libs/ext/libav/libavcodec/jpeglsdec.c19
-rw-r--r--gst-libs/ext/libav/libavcodec/jpeglsenc.c59
-rw-r--r--gst-libs/ext/libav/libavcodec/jrevdct.c215
-rw-r--r--gst-libs/ext/libav/libavcodec/jvdec.c10
-rw-r--r--gst-libs/ext/libav/libavcodec/kbdwin.c1
-rw-r--r--gst-libs/ext/libav/libavcodec/kgv1dec.c16
-rw-r--r--gst-libs/ext/libav/libavcodec/kmvc.c16
-rw-r--r--gst-libs/ext/libav/libavcodec/lagarith.c120
-rw-r--r--gst-libs/ext/libav/libavcodec/lagarithrac.c2
-rw-r--r--gst-libs/ext/libav/libavcodec/lagarithrac.h5
-rw-r--r--gst-libs/ext/libav/libavcodec/latm_parser.c2
-rw-r--r--gst-libs/ext/libav/libavcodec/lcldec.c63
-rw-r--r--gst-libs/ext/libav/libavcodec/lclenc.c36
-rw-r--r--gst-libs/ext/libav/libavcodec/libavcodec.v2
-rw-r--r--gst-libs/ext/libav/libavcodec/libdirac.h44
-rw-r--r--gst-libs/ext/libav/libavcodec/libdirac_libschro.c113
-rw-r--r--gst-libs/ext/libav/libavcodec/libdirac_libschro.h105
-rw-r--r--gst-libs/ext/libav/libavcodec/libdiracdec.c208
-rw-r--r--gst-libs/ext/libav/libavcodec/libdiracenc.c405
-rw-r--r--gst-libs/ext/libav/libavcodec/libfaac.c146
-rw-r--r--gst-libs/ext/libav/libavcodec/libfdk-aacenc.c423
-rw-r--r--gst-libs/ext/libav/libavcodec/libgsm.c96
-rw-r--r--gst-libs/ext/libav/libavcodec/libilbc.c212
-rw-r--r--gst-libs/ext/libav/libavcodec/libmp3lame.c346
-rw-r--r--gst-libs/ext/libav/libavcodec/libopencore-amr.c232
-rw-r--r--gst-libs/ext/libav/libavcodec/libopenjpeg.c225
-rw-r--r--gst-libs/ext/libav/libavcodec/libopenjpegdec.c461
-rw-r--r--gst-libs/ext/libav/libavcodec/libopenjpegenc.c436
-rw-r--r--gst-libs/ext/libav/libavcodec/libopus.c48
-rw-r--r--gst-libs/ext/libav/libavcodec/libopus.h27
-rw-r--r--gst-libs/ext/libav/libavcodec/libopusdec.c168
-rw-r--r--gst-libs/ext/libav/libavcodec/libopusenc.c421
-rw-r--r--gst-libs/ext/libav/libavcodec/libschroedinger.c96
-rw-r--r--gst-libs/ext/libav/libavcodec/libschroedinger.h78
-rw-r--r--gst-libs/ext/libav/libavcodec/libschroedingerdec.c159
-rw-r--r--gst-libs/ext/libav/libavcodec/libschroedingerenc.c82
-rw-r--r--gst-libs/ext/libav/libavcodec/libspeexdec.c92
-rw-r--r--gst-libs/ext/libav/libavcodec/libspeexenc.c114
-rw-r--r--gst-libs/ext/libav/libavcodec/libtheoraenc.c56
-rw-r--r--gst-libs/ext/libav/libavcodec/libvo-aacenc.c131
-rw-r--r--gst-libs/ext/libav/libavcodec/libvo-amrwbenc.c57
-rw-r--r--gst-libs/ext/libav/libavcodec/libvorbis.c353
-rw-r--r--gst-libs/ext/libav/libavcodec/libvpxdec.c9
-rw-r--r--gst-libs/ext/libav/libavcodec/libvpxenc.c120
-rw-r--r--gst-libs/ext/libav/libavcodec/libx264.c306
-rw-r--r--gst-libs/ext/libav/libavcodec/libxavs.c185
-rw-r--r--gst-libs/ext/libav/libavcodec/libxvid.c761
-rw-r--r--gst-libs/ext/libav/libavcodec/libxvid.h32
-rw-r--r--gst-libs/ext/libav/libavcodec/libxvid_internal.h32
-rw-r--r--gst-libs/ext/libav/libavcodec/libxvid_rc.c62
-rw-r--r--gst-libs/ext/libav/libavcodec/libxvidff.c823
-rw-r--r--gst-libs/ext/libav/libavcodec/ljpegenc.c43
-rw-r--r--gst-libs/ext/libav/libavcodec/loco.c51
-rw-r--r--gst-libs/ext/libav/libavcodec/log2_tab.c1
-rw-r--r--gst-libs/ext/libav/libavcodec/lpc.c32
-rw-r--r--gst-libs/ext/libav/libavcodec/lpc.h37
-rw-r--r--gst-libs/ext/libav/libavcodec/lsp.c25
-rw-r--r--gst-libs/ext/libav/libavcodec/lzw.c3
-rw-r--r--gst-libs/ext/libav/libavcodec/mace.c47
-rw-r--r--gst-libs/ext/libav/libavcodec/mathops.h38
-rw-r--r--gst-libs/ext/libav/libavcodec/mathtables.c87
-rw-r--r--gst-libs/ext/libav/libavcodec/mdec.c31
-rw-r--r--gst-libs/ext/libav/libavcodec/mimic.c53
-rw-r--r--gst-libs/ext/libav/libavcodec/mips/Makefile3
-rw-r--r--gst-libs/ext/libav/libavcodec/mips/mathops.h6
-rw-r--r--gst-libs/ext/libav/libavcodec/mjpeg.c14
-rw-r--r--gst-libs/ext/libav/libavcodec/mjpeg.h14
-rw-r--r--gst-libs/ext/libav/libavcodec/mjpeg2jpeg_bsf.c12
-rw-r--r--gst-libs/ext/libav/libavcodec/mjpeg_parser.c2
-rw-r--r--gst-libs/ext/libav/libavcodec/mjpega_dump_header_bsf.c2
-rw-r--r--gst-libs/ext/libav/libavcodec/mjpegbdec.c9
-rw-r--r--gst-libs/ext/libav/libavcodec/mjpegdec.c319
-rw-r--r--gst-libs/ext/libav/libavcodec/mjpegdec.h2
-rw-r--r--gst-libs/ext/libav/libavcodec/mjpegenc.c73
-rw-r--r--gst-libs/ext/libav/libavcodec/mlib/dsputil_mlib.c469
-rw-r--r--gst-libs/ext/libav/libavcodec/mlp.h4
-rw-r--r--gst-libs/ext/libav/libavcodec/mlp_parser.c47
-rw-r--r--gst-libs/ext/libav/libavcodec/mlp_parser.h10
-rw-r--r--gst-libs/ext/libav/libavcodec/mlpdec.c129
-rw-r--r--gst-libs/ext/libav/libavcodec/mlpdsp.c7
-rw-r--r--gst-libs/ext/libav/libavcodec/mlpdsp.h37
-rw-r--r--gst-libs/ext/libav/libavcodec/mmvideo.c13
-rw-r--r--gst-libs/ext/libav/libavcodec/motion-test.c165
-rw-r--r--gst-libs/ext/libav/libavcodec/motion_est.c102
-rw-r--r--gst-libs/ext/libav/libavcodec/motion_est_template.c32
-rw-r--r--gst-libs/ext/libav/libavcodec/motionpixels.c12
-rw-r--r--gst-libs/ext/libav/libavcodec/movsub_bsf.c1
-rw-r--r--gst-libs/ext/libav/libavcodec/mp3_header_compress_bsf.c1
-rw-r--r--gst-libs/ext/libav/libavcodec/mp3_header_decompress_bsf.c1
-rw-r--r--gst-libs/ext/libav/libavcodec/mpc.c14
-rw-r--r--gst-libs/ext/libav/libavcodec/mpc.h6
-rw-r--r--gst-libs/ext/libav/libavcodec/mpc7.c77
-rw-r--r--gst-libs/ext/libav/libavcodec/mpc8.c32
-rw-r--r--gst-libs/ext/libav/libavcodec/mpeg12.c259
-rw-r--r--gst-libs/ext/libav/libavcodec/mpeg12data.c2
-rw-r--r--gst-libs/ext/libav/libavcodec/mpeg12data.h2
-rw-r--r--gst-libs/ext/libav/libavcodec/mpeg12enc.c102
-rw-r--r--gst-libs/ext/libav/libavcodec/mpeg4audio.h4
-rw-r--r--gst-libs/ext/libav/libavcodec/mpeg4data.h10
-rw-r--r--gst-libs/ext/libav/libavcodec/mpeg4video.c1
-rw-r--r--gst-libs/ext/libav/libavcodec/mpeg4video.h24
-rw-r--r--gst-libs/ext/libav/libavcodec/mpeg4video_parser.c22
-rw-r--r--gst-libs/ext/libav/libavcodec/mpeg4videodec.c87
-rw-r--r--gst-libs/ext/libav/libavcodec/mpeg4videoenc.c35
-rw-r--r--gst-libs/ext/libav/libavcodec/mpegaudio_parser.c16
-rw-r--r--gst-libs/ext/libav/libavcodec/mpegaudiodata.c38
-rw-r--r--gst-libs/ext/libav/libavcodec/mpegaudiodata.h7
-rw-r--r--gst-libs/ext/libav/libavcodec/mpegaudiodec.c202
-rw-r--r--gst-libs/ext/libav/libavcodec/mpegaudiodec_float.c40
-rw-r--r--gst-libs/ext/libav/libavcodec/mpegaudiodecheader.c7
-rw-r--r--gst-libs/ext/libav/libavcodec/mpegaudiodsp.c2
-rw-r--r--gst-libs/ext/libav/libavcodec/mpegaudiodsp.h4
-rw-r--r--gst-libs/ext/libav/libavcodec/mpegaudiodsp_data.c56
-rw-r--r--gst-libs/ext/libav/libavcodec/mpegaudiodsp_template.c3
-rw-r--r--gst-libs/ext/libav/libavcodec/mpegaudioenc.c67
-rw-r--r--gst-libs/ext/libav/libavcodec/mpegvideo.c1223
-rw-r--r--gst-libs/ext/libav/libavcodec/mpegvideo.h161
-rw-r--r--gst-libs/ext/libav/libavcodec/mpegvideo_common.h900
-rw-r--r--gst-libs/ext/libav/libavcodec/mpegvideo_enc.c716
-rw-r--r--gst-libs/ext/libav/libavcodec/mpegvideo_motion.c891
-rw-r--r--gst-libs/ext/libav/libavcodec/mpegvideo_parser.c28
-rw-r--r--gst-libs/ext/libav/libavcodec/msmpeg4.c838
-rw-r--r--gst-libs/ext/libav/libavcodec/msmpeg4.h12
-rw-r--r--gst-libs/ext/libav/libavcodec/msmpeg4data.c32
-rw-r--r--gst-libs/ext/libav/libavcodec/msmpeg4data.h30
-rw-r--r--gst-libs/ext/libav/libavcodec/msmpeg4enc.c690
-rw-r--r--gst-libs/ext/libav/libavcodec/msrle.c12
-rw-r--r--gst-libs/ext/libav/libavcodec/msrledec.c5
-rw-r--r--gst-libs/ext/libav/libavcodec/msrledec.h1
-rw-r--r--gst-libs/ext/libav/libavcodec/mss1.c226
-rw-r--r--gst-libs/ext/libav/libavcodec/mss12.c674
-rw-r--r--gst-libs/ext/libav/libavcodec/mss12.h133
-rw-r--r--gst-libs/ext/libav/libavcodec/mss2.c871
-rw-r--r--gst-libs/ext/libav/libavcodec/mss2dsp.c153
-rw-r--r--gst-libs/ext/libav/libavcodec/mss2dsp.h50
-rw-r--r--gst-libs/ext/libav/libavcodec/mss3.c869
-rw-r--r--gst-libs/ext/libav/libavcodec/mss34dsp.c114
-rw-r--r--gst-libs/ext/libav/libavcodec/mss34dsp.h45
-rw-r--r--gst-libs/ext/libav/libavcodec/mss4.c682
-rw-r--r--gst-libs/ext/libav/libavcodec/msvideo1.c15
-rw-r--r--gst-libs/ext/libav/libavcodec/mxpegdec.c14
-rw-r--r--gst-libs/ext/libav/libavcodec/nellymoser.c1
-rw-r--r--gst-libs/ext/libav/libavcodec/nellymoserdec.c64
-rw-r--r--gst-libs/ext/libav/libavcodec/nellymoserenc.c145
-rw-r--r--gst-libs/ext/libav/libavcodec/noise_bsf.c4
-rw-r--r--gst-libs/ext/libav/libavcodec/nuv.c184
-rw-r--r--gst-libs/ext/libav/libavcodec/old_codec_ids.h366
-rw-r--r--gst-libs/ext/libav/libavcodec/opt.h34
-rw-r--r--gst-libs/ext/libav/libavcodec/options.c514
-rw-r--r--gst-libs/ext/libav/libavcodec/options_table.h416
-rw-r--r--gst-libs/ext/libav/libavcodec/pamenc.c49
-rw-r--r--gst-libs/ext/libav/libavcodec/parser.c33
-rw-r--r--gst-libs/ext/libav/libavcodec/parser.h21
-rw-r--r--gst-libs/ext/libav/libavcodec/pcm-mpeg.c141
-rw-r--r--gst-libs/ext/libav/libavcodec/pcm.c457
-rw-r--r--gst-libs/ext/libav/libavcodec/pcm_tablegen.c1
-rw-r--r--gst-libs/ext/libav/libavcodec/pcx.c15
-rw-r--r--gst-libs/ext/libav/libavcodec/pcxenc.c63
-rw-r--r--gst-libs/ext/libav/libavcodec/pgssubdec.c29
-rw-r--r--gst-libs/ext/libav/libavcodec/pictordec.c15
-rw-r--r--gst-libs/ext/libav/libavcodec/png.c4
-rw-r--r--gst-libs/ext/libav/libavcodec/pngdec.c37
-rw-r--r--gst-libs/ext/libav/libavcodec/pngdsp.c48
-rw-r--r--gst-libs/ext/libav/libavcodec/pngdsp.h40
-rw-r--r--gst-libs/ext/libav/libavcodec/pngenc.c60
-rw-r--r--gst-libs/ext/libav/libavcodec/pnm.c47
-rw-r--r--gst-libs/ext/libav/libavcodec/pnm_parser.c4
-rw-r--r--gst-libs/ext/libav/libavcodec/pnmdec.c54
-rw-r--r--gst-libs/ext/libav/libavcodec/pnmenc.c81
-rw-r--r--gst-libs/ext/libav/libavcodec/ppc/Makefile22
-rw-r--r--gst-libs/ext/libav/libavcodec/ppc/dsputil_altivec.c190
-rw-r--r--gst-libs/ext/libav/libavcodec/ppc/dsputil_altivec.h26
-rw-r--r--gst-libs/ext/libav/libavcodec/ppc/dsputil_ppc.c39
-rw-r--r--gst-libs/ext/libav/libavcodec/ppc/fdct_altivec.c2
-rw-r--r--gst-libs/ext/libav/libavcodec/ppc/fft_altivec.c5
-rw-r--r--gst-libs/ext/libav/libavcodec/ppc/float_altivec.c20
-rw-r--r--gst-libs/ext/libav/libavcodec/ppc/fmtconvert_altivec.c147
-rw-r--r--gst-libs/ext/libav/libavcodec/ppc/gmc_altivec.c9
-rw-r--r--gst-libs/ext/libav/libavcodec/ppc/h264_altivec.c15
-rw-r--r--gst-libs/ext/libav/libavcodec/ppc/h264_altivec_template.c775
-rw-r--r--gst-libs/ext/libav/libavcodec/ppc/h264_template_altivec.c776
-rw-r--r--gst-libs/ext/libav/libavcodec/ppc/idct_altivec.c7
-rw-r--r--gst-libs/ext/libav/libavcodec/ppc/int_altivec.c46
-rw-r--r--gst-libs/ext/libav/libavcodec/ppc/mpegaudiodec_altivec.c2
-rw-r--r--gst-libs/ext/libav/libavcodec/ppc/mpegvideo_altivec.c465
-rw-r--r--gst-libs/ext/libav/libavcodec/ppc/regs.h37
-rw-r--r--gst-libs/ext/libav/libavcodec/ppc/types_altivec.h47
-rw-r--r--gst-libs/ext/libav/libavcodec/ppc/util_altivec.h118
-rw-r--r--gst-libs/ext/libav/libavcodec/ppc/vc1dsp_altivec.c9
-rw-r--r--gst-libs/ext/libav/libavcodec/ppc/videodsp_ppc.c35
-rw-r--r--gst-libs/ext/libav/libavcodec/ppc/vp3dsp_altivec.c46
-rw-r--r--gst-libs/ext/libav/libavcodec/ppc/vp8dsp_altivec.c25
-rw-r--r--gst-libs/ext/libav/libavcodec/proresdata.c72
-rw-r--r--gst-libs/ext/libav/libavcodec/proresdata.h39
-rw-r--r--gst-libs/ext/libav/libavcodec/proresdec.c150
-rw-r--r--gst-libs/ext/libav/libavcodec/proresdsp.c28
-rw-r--r--gst-libs/ext/libav/libavcodec/proresdsp.h5
-rw-r--r--gst-libs/ext/libav/libavcodec/proresenc.c1078
-rw-r--r--gst-libs/ext/libav/libavcodec/ps2/dsputil_mmi.c167
-rw-r--r--gst-libs/ext/libav/libavcodec/ps2/idct_mmi.c362
-rw-r--r--gst-libs/ext/libav/libavcodec/ps2/mmi.h171
-rw-r--r--gst-libs/ext/libav/libavcodec/ps2/mpegvideo_mmi.c89
-rw-r--r--gst-libs/ext/libav/libavcodec/psymodel.c23
-rw-r--r--gst-libs/ext/libav/libavcodec/psymodel.h12
-rw-r--r--gst-libs/ext/libav/libavcodec/pthread.c49
-rw-r--r--gst-libs/ext/libav/libavcodec/ptx.c16
-rw-r--r--gst-libs/ext/libav/libavcodec/put_bits.h7
-rw-r--r--gst-libs/ext/libav/libavcodec/qcelpdata.h4
-rw-r--r--gst-libs/ext/libav/libavcodec/qcelpdec.c22
-rw-r--r--gst-libs/ext/libav/libavcodec/qdm2.c192
-rw-r--r--gst-libs/ext/libav/libavcodec/qdrw.c16
-rw-r--r--gst-libs/ext/libav/libavcodec/qpeg.c101
-rw-r--r--gst-libs/ext/libav/libavcodec/qtrle.c216
-rw-r--r--gst-libs/ext/libav/libavcodec/qtrleenc.c46
-rw-r--r--gst-libs/ext/libav/libavcodec/r210dec.c20
-rw-r--r--gst-libs/ext/libav/libavcodec/ra144.c3
-rw-r--r--gst-libs/ext/libav/libavcodec/ra144.h5
-rw-r--r--gst-libs/ext/libav/libavcodec/ra144dec.c10
-rw-r--r--gst-libs/ext/libav/libavcodec/ra144enc.c104
-rw-r--r--gst-libs/ext/libav/libavcodec/ra288.c36
-rw-r--r--gst-libs/ext/libav/libavcodec/ra288.h9
-rw-r--r--gst-libs/ext/libav/libavcodec/ralf.c542
-rw-r--r--gst-libs/ext/libav/libavcodec/ralfdata.h9920
-rw-r--r--gst-libs/ext/libav/libavcodec/rangecoder.c125
-rw-r--r--gst-libs/ext/libav/libavcodec/rangecoder.h92
-rw-r--r--gst-libs/ext/libav/libavcodec/ratecontrol.c56
-rw-r--r--gst-libs/ext/libav/libavcodec/ratecontrol.h1
-rw-r--r--gst-libs/ext/libav/libavcodec/raw.c236
-rw-r--r--gst-libs/ext/libav/libavcodec/raw.h2
-rw-r--r--gst-libs/ext/libav/libavcodec/rawdec.c74
-rw-r--r--gst-libs/ext/libav/libavcodec/rawenc.c38
-rw-r--r--gst-libs/ext/libav/libavcodec/resample.c15
-rw-r--r--gst-libs/ext/libav/libavcodec/resample2.c5
-rw-r--r--gst-libs/ext/libav/libavcodec/rl2.c18
-rw-r--r--gst-libs/ext/libav/libavcodec/rle.c1
-rw-r--r--gst-libs/ext/libav/libavcodec/roqaudioenc.c125
-rw-r--r--gst-libs/ext/libav/libavcodec/roqvideo.h9
-rw-r--r--gst-libs/ext/libav/libavcodec/roqvideodec.c49
-rw-r--r--gst-libs/ext/libav/libavcodec/roqvideoenc.c50
-rw-r--r--gst-libs/ext/libav/libavcodec/rpza.c11
-rw-r--r--gst-libs/ext/libav/libavcodec/rtjpeg.c12
-rw-r--r--gst-libs/ext/libav/libavcodec/rtjpeg.h7
-rw-r--r--gst-libs/ext/libav/libavcodec/rv10.c109
-rw-r--r--gst-libs/ext/libav/libavcodec/rv10enc.c17
-rw-r--r--gst-libs/ext/libav/libavcodec/rv20enc.c17
-rw-r--r--gst-libs/ext/libav/libavcodec/rv30.c33
-rw-r--r--gst-libs/ext/libav/libavcodec/rv34.c165
-rw-r--r--gst-libs/ext/libav/libavcodec/rv34.h6
-rw-r--r--gst-libs/ext/libav/libavcodec/rv34_parser.c6
-rw-r--r--gst-libs/ext/libav/libavcodec/rv34dsp.c29
-rw-r--r--gst-libs/ext/libav/libavcodec/rv34dsp.h23
-rw-r--r--gst-libs/ext/libav/libavcodec/rv40.c69
-rw-r--r--gst-libs/ext/libav/libavcodec/rv40dsp.c45
-rw-r--r--gst-libs/ext/libav/libavcodec/s302m.c43
-rw-r--r--gst-libs/ext/libav/libavcodec/s3tc.c22
-rw-r--r--gst-libs/ext/libav/libavcodec/s3tc.h10
-rw-r--r--gst-libs/ext/libav/libavcodec/sbr.h28
-rw-r--r--gst-libs/ext/libav/libavcodec/sbrdsp.c248
-rw-r--r--gst-libs/ext/libav/libavcodec/sbrdsp.h51
-rw-r--r--gst-libs/ext/libav/libavcodec/sgidec.c19
-rw-r--r--gst-libs/ext/libav/libavcodec/sgienc.c53
-rw-r--r--gst-libs/ext/libav/libavcodec/sh4/Makefile6
-rw-r--r--gst-libs/ext/libav/libavcodec/sh4/dsputil_align.c5
-rw-r--r--gst-libs/ext/libav/libavcodec/sh4/dsputil_sh4.c10
-rw-r--r--gst-libs/ext/libav/libavcodec/sh4/dsputil_sh4.h4
-rw-r--r--gst-libs/ext/libav/libavcodec/sh4/idct_sh4.c2
-rw-r--r--gst-libs/ext/libav/libavcodec/sh4/qpel.c59
-rw-r--r--gst-libs/ext/libav/libavcodec/shorten.c33
-rw-r--r--gst-libs/ext/libav/libavcodec/sinewin.h5
-rw-r--r--gst-libs/ext/libav/libavcodec/sinewin_tablegen.c5
-rw-r--r--gst-libs/ext/libav/libavcodec/sinewin_tablegen.h4
-rw-r--r--gst-libs/ext/libav/libavcodec/sipr.c21
-rw-r--r--gst-libs/ext/libav/libavcodec/sipr.h1
-rw-r--r--gst-libs/ext/libav/libavcodec/sipr16k.c8
-rw-r--r--gst-libs/ext/libav/libavcodec/smacker.c62
-rw-r--r--gst-libs/ext/libav/libavcodec/smc.c10
-rw-r--r--gst-libs/ext/libav/libavcodec/snow.c66
-rw-r--r--gst-libs/ext/libav/libavcodec/snow.h23
-rw-r--r--gst-libs/ext/libav/libavcodec/snowdata.h8
-rw-r--r--gst-libs/ext/libav/libavcodec/snowdec.c28
-rw-r--r--gst-libs/ext/libav/libavcodec/snowenc.c179
-rw-r--r--gst-libs/ext/libav/libavcodec/sp5xdec.c15
-rw-r--r--gst-libs/ext/libav/libavcodec/sparc/Makefile4
-rw-r--r--gst-libs/ext/libav/libavcodec/sparc/dsputil_vis.c3
-rw-r--r--gst-libs/ext/libav/libavcodec/sparc/simple_idct_vis.c3
-rw-r--r--gst-libs/ext/libav/libavcodec/srtdec.c3
-rw-r--r--gst-libs/ext/libav/libavcodec/sunrast.c100
-rw-r--r--gst-libs/ext/libav/libavcodec/sunrast.h56
-rw-r--r--gst-libs/ext/libav/libavcodec/sunrastenc.c229
-rw-r--r--gst-libs/ext/libav/libavcodec/svq1.c4
-rw-r--r--gst-libs/ext/libav/libavcodec/svq1.h8
-rw-r--r--gst-libs/ext/libav/libavcodec/svq13.c69
-rw-r--r--gst-libs/ext/libav/libavcodec/svq1_vlc.h231
-rw-r--r--gst-libs/ext/libav/libavcodec/svq1dec.c1257
-rw-r--r--gst-libs/ext/libav/libavcodec/svq1enc.c640
-rw-r--r--gst-libs/ext/libav/libavcodec/svq1enc_cb.h106
-rw-r--r--gst-libs/ext/libav/libavcodec/svq3.c899
-rw-r--r--gst-libs/ext/libav/libavcodec/tak.c150
-rw-r--r--gst-libs/ext/libav/libavcodec/tak.h166
-rw-r--r--gst-libs/ext/libav/libavcodec/tak_parser.c128
-rw-r--r--gst-libs/ext/libav/libavcodec/takdec.c933
-rw-r--r--gst-libs/ext/libav/libavcodec/targa.c222
-rw-r--r--gst-libs/ext/libav/libavcodec/targaenc.c84
-rw-r--r--gst-libs/ext/libav/libavcodec/thread.h4
-rw-r--r--gst-libs/ext/libav/libavcodec/tiertexseqv.c10
-rw-r--r--gst-libs/ext/libav/libavcodec/tiff.c304
-rw-r--r--gst-libs/ext/libav/libavcodec/tiffenc.c166
-rw-r--r--gst-libs/ext/libav/libavcodec/tmv.c16
-rw-r--r--gst-libs/ext/libav/libavcodec/truemotion1.c32
-rw-r--r--gst-libs/ext/libav/libavcodec/truemotion2.c60
-rw-r--r--gst-libs/ext/libav/libavcodec/truespeech.c23
-rw-r--r--gst-libs/ext/libav/libavcodec/tscc.c21
-rw-r--r--gst-libs/ext/libav/libavcodec/tscc2.c382
-rw-r--r--gst-libs/ext/libav/libavcodec/tscc2data.h935
-rw-r--r--gst-libs/ext/libav/libavcodec/tta.c123
-rw-r--r--gst-libs/ext/libav/libavcodec/twinvq.c64
-rw-r--r--gst-libs/ext/libav/libavcodec/twinvq_data.h2
-rw-r--r--gst-libs/ext/libav/libavcodec/txd.c67
-rw-r--r--gst-libs/ext/libav/libavcodec/ulti.c13
-rw-r--r--gst-libs/ext/libav/libavcodec/utils.c1439
-rw-r--r--gst-libs/ext/libav/libavcodec/utvideo.c552
-rw-r--r--gst-libs/ext/libav/libavcodec/utvideo.h92
-rw-r--r--gst-libs/ext/libav/libavcodec/utvideodec.c555
-rw-r--r--gst-libs/ext/libav/libavcodec/utvideoenc.c627
-rw-r--r--gst-libs/ext/libav/libavcodec/v210dec.c17
-rw-r--r--gst-libs/ext/libav/libavcodec/v210enc.c55
-rw-r--r--gst-libs/ext/libav/libavcodec/v210x.c16
-rw-r--r--gst-libs/ext/libav/libavcodec/v410dec.c20
-rw-r--r--gst-libs/ext/libav/libavcodec/v410enc.c30
-rw-r--r--gst-libs/ext/libav/libavcodec/vaapi.h10
-rw-r--r--gst-libs/ext/libav/libavcodec/vaapi_h264.c4
-rw-r--r--gst-libs/ext/libav/libavcodec/vaapi_mpeg2.c6
-rw-r--r--gst-libs/ext/libav/libavcodec/vaapi_mpeg4.c14
-rw-r--r--gst-libs/ext/libav/libavcodec/vaapi_vc1.c10
-rw-r--r--gst-libs/ext/libav/libavcodec/vb.c16
-rw-r--r--gst-libs/ext/libav/libavcodec/vble.c22
-rw-r--r--gst-libs/ext/libav/libavcodec/vc1.c73
-rw-r--r--gst-libs/ext/libav/libavcodec/vc1.h15
-rw-r--r--gst-libs/ext/libav/libavcodec/vc1_parser.c12
-rw-r--r--gst-libs/ext/libav/libavcodec/vc1data.c6
-rw-r--r--gst-libs/ext/libav/libavcodec/vc1data.h6
-rw-r--r--gst-libs/ext/libav/libavcodec/vc1dec.c358
-rw-r--r--gst-libs/ext/libav/libavcodec/vc1dsp.c7
-rw-r--r--gst-libs/ext/libav/libavcodec/vc1dsp.h2
-rw-r--r--gst-libs/ext/libav/libavcodec/vcr1.c237
-rw-r--r--gst-libs/ext/libav/libavcodec/vda.c259
-rw-r--r--gst-libs/ext/libav/libavcodec/vda.h179
-rw-r--r--gst-libs/ext/libav/libavcodec/vda_h264.c323
-rw-r--r--gst-libs/ext/libav/libavcodec/vda_internal.h42
-rw-r--r--gst-libs/ext/libav/libavcodec/vdpau.c2
-rw-r--r--gst-libs/ext/libav/libavcodec/vdpau.h12
-rw-r--r--gst-libs/ext/libav/libavcodec/version.h111
-rw-r--r--gst-libs/ext/libav/libavcodec/videodsp.c51
-rw-r--r--gst-libs/ext/libav/libavcodec/videodsp.h71
-rw-r--r--gst-libs/ext/libav/libavcodec/videodsp_template.c93
-rw-r--r--gst-libs/ext/libav/libavcodec/vmdav.c217
-rw-r--r--gst-libs/ext/libav/libavcodec/vmnc.c17
-rw-r--r--gst-libs/ext/libav/libavcodec/vorbis.c4
-rw-r--r--gst-libs/ext/libav/libavcodec/vorbis.h4
-rw-r--r--gst-libs/ext/libav/libavcodec/vorbis_data.c3
-rw-r--r--gst-libs/ext/libav/libavcodec/vorbis_parser.c270
-rw-r--r--gst-libs/ext/libav/libavcodec/vorbis_parser.h68
-rw-r--r--gst-libs/ext/libav/libavcodec/vorbisdec.c194
-rw-r--r--gst-libs/ext/libav/libavcodec/vorbisenc.c198
-rw-r--r--gst-libs/ext/libav/libavcodec/vp3.c113
-rw-r--r--gst-libs/ext/libav/libavcodec/vp3_parser.c6
-rw-r--r--gst-libs/ext/libav/libavcodec/vp3dsp.c38
-rw-r--r--gst-libs/ext/libav/libavcodec/vp3dsp.h40
-rw-r--r--gst-libs/ext/libav/libavcodec/vp5.c38
-rw-r--r--gst-libs/ext/libav/libavcodec/vp56.c40
-rw-r--r--gst-libs/ext/libav/libavcodec/vp56.h20
-rw-r--r--gst-libs/ext/libav/libavcodec/vp56data.c16
-rw-r--r--gst-libs/ext/libav/libavcodec/vp56data.h18
-rw-r--r--gst-libs/ext/libav/libavcodec/vp56dsp.c7
-rw-r--r--gst-libs/ext/libav/libavcodec/vp56dsp.h6
-rw-r--r--gst-libs/ext/libav/libavcodec/vp6.c34
-rw-r--r--gst-libs/ext/libav/libavcodec/vp8.c781
-rw-r--r--gst-libs/ext/libav/libavcodec/vp8.h87
-rw-r--r--gst-libs/ext/libav/libavcodec/vp8_parser.c2
-rw-r--r--gst-libs/ext/libav/libavcodec/vp8dsp.c47
-rw-r--r--gst-libs/ext/libav/libavcodec/vp8dsp.h47
-rw-r--r--gst-libs/ext/libav/libavcodec/vqavideo.c60
-rw-r--r--gst-libs/ext/libav/libavcodec/w32pthreads.h13
-rw-r--r--gst-libs/ext/libav/libavcodec/wavpack.c243
-rw-r--r--gst-libs/ext/libav/libavcodec/wma.c85
-rw-r--r--gst-libs/ext/libav/libavcodec/wma.h8
-rw-r--r--gst-libs/ext/libav/libavcodec/wma_common.c62
-rw-r--r--gst-libs/ext/libav/libavcodec/wma_common.h29
-rw-r--r--gst-libs/ext/libav/libavcodec/wmadec.c113
-rw-r--r--gst-libs/ext/libav/libavcodec/wmaenc.c127
-rw-r--r--gst-libs/ext/libav/libavcodec/wmalosslessdec.c1300
-rw-r--r--gst-libs/ext/libav/libavcodec/wmaprodec.c131
-rw-r--r--gst-libs/ext/libav/libavcodec/wmavoice.c39
-rw-r--r--gst-libs/ext/libav/libavcodec/wmv2.c10
-rw-r--r--gst-libs/ext/libav/libavcodec/wmv2dec.c22
-rw-r--r--gst-libs/ext/libav/libavcodec/wmv2enc.c22
-rw-r--r--gst-libs/ext/libav/libavcodec/wnv1.c57
-rw-r--r--gst-libs/ext/libav/libavcodec/ws-snd1.c23
-rw-r--r--gst-libs/ext/libav/libavcodec/x86/Makefile106
-rw-r--r--gst-libs/ext/libav/libavcodec/x86/ac3dsp.asm165
-rw-r--r--gst-libs/ext/libav/libavcodec/x86/ac3dsp_init.c227
-rw-r--r--gst-libs/ext/libav/libavcodec/x86/ac3dsp_mmx.c93
-rw-r--r--gst-libs/ext/libav/libavcodec/x86/cabac.h183
-rw-r--r--gst-libs/ext/libav/libavcodec/x86/cavsdsp.c505
-rw-r--r--gst-libs/ext/libav/libavcodec/x86/cavsdsp_mmx.c480
-rw-r--r--gst-libs/ext/libav/libavcodec/x86/dct32.asm488
-rw-r--r--gst-libs/ext/libav/libavcodec/x86/dct32_sse.asm515
-rw-r--r--gst-libs/ext/libav/libavcodec/x86/deinterlace.asm5
-rw-r--r--gst-libs/ext/libav/libavcodec/x86/dnxhd_mmx.c59
-rw-r--r--gst-libs/ext/libav/libavcodec/x86/dnxhdenc.c65
-rw-r--r--gst-libs/ext/libav/libavcodec/x86/dsputil.asm1016
-rw-r--r--gst-libs/ext/libav/libavcodec/x86/dsputil_avg_template.c855
-rw-r--r--gst-libs/ext/libav/libavcodec/x86/dsputil_mmx.c4730
-rw-r--r--gst-libs/ext/libav/libavcodec/x86/dsputil_mmx.h127
-rw-r--r--gst-libs/ext/libav/libavcodec/x86/dsputil_mmx_avg_template.c977
-rw-r--r--gst-libs/ext/libav/libavcodec/x86/dsputil_qns_template.c (renamed from gst-libs/ext/libav/libavcodec/x86/dsputil_mmx_qns_template.c)0
-rw-r--r--gst-libs/ext/libav/libavcodec/x86/dsputil_rnd_template.c (renamed from gst-libs/ext/libav/libavcodec/x86/dsputil_mmx_rnd_template.c)0
-rw-r--r--gst-libs/ext/libav/libavcodec/x86/dsputil_yasm.asm1180
-rw-r--r--gst-libs/ext/libav/libavcodec/x86/dsputilenc.asm339
-rw-r--r--gst-libs/ext/libav/libavcodec/x86/dsputilenc_mmx.c140
-rw-r--r--gst-libs/ext/libav/libavcodec/x86/dsputilenc_yasm.asm342
-rw-r--r--gst-libs/ext/libav/libavcodec/x86/fdct.c586
-rw-r--r--gst-libs/ext/libav/libavcodec/x86/fdct_mmx.c582
-rw-r--r--gst-libs/ext/libav/libavcodec/x86/fft.asm1083
-rw-r--r--gst-libs/ext/libav/libavcodec/x86/fft.c70
-rw-r--r--gst-libs/ext/libav/libavcodec/x86/fft.h12
-rw-r--r--gst-libs/ext/libav/libavcodec/x86/fft_3dn.c23
-rw-r--r--gst-libs/ext/libav/libavcodec/x86/fft_3dn2.c174
-rw-r--r--gst-libs/ext/libav/libavcodec/x86/fft_init.c69
-rw-r--r--gst-libs/ext/libav/libavcodec/x86/fft_mmx.asm861
-rw-r--r--gst-libs/ext/libav/libavcodec/x86/fft_sse.c111
-rw-r--r--gst-libs/ext/libav/libavcodec/x86/fmtconvert.asm278
-rw-r--r--gst-libs/ext/libav/libavcodec/x86/fmtconvert_init.c148
-rw-r--r--gst-libs/ext/libav/libavcodec/x86/fmtconvert_mmx.c143
-rw-r--r--gst-libs/ext/libav/libavcodec/x86/h264_chromamc.asm178
-rw-r--r--gst-libs/ext/libav/libavcodec/x86/h264_chromamc_10bit.asm66
-rw-r--r--gst-libs/ext/libav/libavcodec/x86/h264_deblock.asm375
-rw-r--r--gst-libs/ext/libav/libavcodec/x86/h264_deblock_10bit.asm108
-rw-r--r--gst-libs/ext/libav/libavcodec/x86/h264_i386.h113
-rw-r--r--gst-libs/ext/libav/libavcodec/x86/h264_idct.asm457
-rw-r--r--gst-libs/ext/libav/libavcodec/x86/h264_idct_10bit.asm307
-rw-r--r--gst-libs/ext/libav/libavcodec/x86/h264_intrapred.asm670
-rw-r--r--gst-libs/ext/libav/libavcodec/x86/h264_intrapred_10bit.asm351
-rw-r--r--gst-libs/ext/libav/libavcodec/x86/h264_intrapred_init.c367
-rw-r--r--gst-libs/ext/libav/libavcodec/x86/h264_qpel.c492
-rw-r--r--gst-libs/ext/libav/libavcodec/x86/h264_qpel_10bit.asm347
-rw-r--r--gst-libs/ext/libav/libavcodec/x86/h264_qpel_8bit.asm862
-rw-r--r--gst-libs/ext/libav/libavcodec/x86/h264_qpel_mmx.c1299
-rw-r--r--gst-libs/ext/libav/libavcodec/x86/h264_weight.asm127
-rw-r--r--gst-libs/ext/libav/libavcodec/x86/h264_weight_10bit.asm157
-rw-r--r--gst-libs/ext/libav/libavcodec/x86/h264dsp_init.c372
-rw-r--r--gst-libs/ext/libav/libavcodec/x86/h264dsp_mmx.c514
-rw-r--r--gst-libs/ext/libav/libavcodec/x86/idct_mmx.c629
-rw-r--r--gst-libs/ext/libav/libavcodec/x86/idct_mmx_xvid.c34
-rw-r--r--gst-libs/ext/libav/libavcodec/x86/idct_sse2_xvid.c8
-rw-r--r--gst-libs/ext/libav/libavcodec/x86/idct_xvid.h10
-rw-r--r--gst-libs/ext/libav/libavcodec/x86/imdct36.asm720
-rw-r--r--gst-libs/ext/libav/libavcodec/x86/imdct36_sse.asm721
-rw-r--r--gst-libs/ext/libav/libavcodec/x86/lpc.c154
-rw-r--r--gst-libs/ext/libav/libavcodec/x86/lpc_mmx.c147
-rw-r--r--gst-libs/ext/libav/libavcodec/x86/mathops.h9
-rw-r--r--gst-libs/ext/libav/libavcodec/x86/mlpdsp.c41
-rw-r--r--gst-libs/ext/libav/libavcodec/x86/motion_est.c473
-rw-r--r--gst-libs/ext/libav/libavcodec/x86/motion_est_mmx.c461
-rw-r--r--gst-libs/ext/libav/libavcodec/x86/mpegaudiodec.c263
-rw-r--r--gst-libs/ext/libav/libavcodec/x86/mpegaudiodec_mmx.c237
-rw-r--r--gst-libs/ext/libav/libavcodec/x86/mpegvideo.c608
-rw-r--r--gst-libs/ext/libav/libavcodec/x86/mpegvideo_mmx.c665
-rw-r--r--gst-libs/ext/libav/libavcodec/x86/mpegvideo_mmx_template.c369
-rw-r--r--gst-libs/ext/libav/libavcodec/x86/mpegvideoenc.c106
-rw-r--r--gst-libs/ext/libav/libavcodec/x86/mpegvideoenc_template.c361
-rw-r--r--gst-libs/ext/libav/libavcodec/x86/pngdsp.asm173
-rw-r--r--gst-libs/ext/libav/libavcodec/x86/pngdsp_init.c49
-rw-r--r--gst-libs/ext/libav/libavcodec/x86/proresdsp-init.c54
-rw-r--r--gst-libs/ext/libav/libavcodec/x86/proresdsp.asm44
-rw-r--r--gst-libs/ext/libav/libavcodec/x86/proresdsp_init.c53
-rw-r--r--gst-libs/ext/libav/libavcodec/x86/rv34dsp.asm98
-rw-r--r--gst-libs/ext/libav/libavcodec/x86/rv34dsp_init.c23
-rw-r--r--gst-libs/ext/libav/libavcodec/x86/rv40dsp.asm505
-rw-r--r--gst-libs/ext/libav/libavcodec/x86/rv40dsp.c60
-rw-r--r--gst-libs/ext/libav/libavcodec/x86/rv40dsp_init.c242
-rw-r--r--gst-libs/ext/libav/libavcodec/x86/sbrdsp.asm183
-rw-r--r--gst-libs/ext/libav/libavcodec/x86/sbrdsp_init.c43
-rw-r--r--gst-libs/ext/libav/libavcodec/x86/simple_idct.c1169
-rw-r--r--gst-libs/ext/libav/libavcodec/x86/simple_idct_mmx.c1163
-rw-r--r--gst-libs/ext/libav/libavcodec/x86/snowdsp.c902
-rw-r--r--gst-libs/ext/libav/libavcodec/x86/snowdsp_mmx.c898
-rw-r--r--gst-libs/ext/libav/libavcodec/x86/vc1dsp.asm317
-rw-r--r--gst-libs/ext/libav/libavcodec/x86/vc1dsp.h29
-rw-r--r--gst-libs/ext/libav/libavcodec/x86/vc1dsp_init.c123
-rw-r--r--gst-libs/ext/libav/libavcodec/x86/vc1dsp_mmx.c170
-rw-r--r--gst-libs/ext/libav/libavcodec/x86/vc1dsp_yasm.asm330
-rw-r--r--gst-libs/ext/libav/libavcodec/x86/videodsp.asm612
-rw-r--r--gst-libs/ext/libav/libavcodec/x86/videodsp_init.c119
-rw-r--r--gst-libs/ext/libav/libavcodec/x86/vp3dsp.asm218
-rw-r--r--gst-libs/ext/libav/libavcodec/x86/vp3dsp_init.c68
-rw-r--r--gst-libs/ext/libav/libavcodec/x86/vp56_arith.h2
-rw-r--r--gst-libs/ext/libav/libavcodec/x86/vp56dsp.asm45
-rw-r--r--gst-libs/ext/libav/libavcodec/x86/vp56dsp_init.c15
-rw-r--r--gst-libs/ext/libav/libavcodec/x86/vp8dsp-init.c402
-rw-r--r--gst-libs/ext/libav/libavcodec/x86/vp8dsp.asm1991
-rw-r--r--gst-libs/ext/libav/libavcodec/x86/vp8dsp_init.c442
-rw-r--r--gst-libs/ext/libav/libavcodec/x86/w64xmmtest.c80
-rw-r--r--gst-libs/ext/libav/libavcodec/xan.c113
-rw-r--r--gst-libs/ext/libav/libavcodec/xbmenc.c87
-rw-r--r--gst-libs/ext/libav/libavcodec/xl.c16
-rw-r--r--gst-libs/ext/libav/libavcodec/xsubdec.c15
-rw-r--r--gst-libs/ext/libav/libavcodec/xsubenc.c15
-rw-r--r--gst-libs/ext/libav/libavcodec/xvmc.h19
-rw-r--r--gst-libs/ext/libav/libavcodec/xwd.h41
-rw-r--r--gst-libs/ext/libav/libavcodec/xwddec.c270
-rw-r--r--gst-libs/ext/libav/libavcodec/xwdenc.c252
-rw-r--r--gst-libs/ext/libav/libavcodec/xxan.c106
-rw-r--r--gst-libs/ext/libav/libavcodec/yop.c88
-rw-r--r--gst-libs/ext/libav/libavcodec/zerocodec.c168
-rw-r--r--gst-libs/ext/libav/libavcodec/zmbv.c110
-rw-r--r--gst-libs/ext/libav/libavcodec/zmbvenc.c68
-rw-r--r--gst-libs/ext/libav/libavdevice/Makefile9
-rw-r--r--gst-libs/ext/libav/libavdevice/alldevices.c51
-rw-r--r--gst-libs/ext/libav/libavdevice/alsa-audio-common.c74
-rw-r--r--gst-libs/ext/libav/libavdevice/alsa-audio-dec.c9
-rw-r--r--gst-libs/ext/libav/libavdevice/alsa-audio-enc.c4
-rw-r--r--gst-libs/ext/libav/libavdevice/alsa-audio.h12
-rw-r--r--gst-libs/ext/libav/libavdevice/avdevice.c1
-rw-r--r--gst-libs/ext/libav/libavdevice/avdevice.h23
-rw-r--r--gst-libs/ext/libav/libavdevice/bktr.c23
-rw-r--r--gst-libs/ext/libav/libavdevice/dv1394.c12
-rw-r--r--gst-libs/ext/libav/libavdevice/dv1394.h5
-rw-r--r--gst-libs/ext/libav/libavdevice/fbdev.c33
-rw-r--r--gst-libs/ext/libav/libavdevice/jack_audio.c15
-rw-r--r--gst-libs/ext/libav/libavdevice/libcdio.c27
-rw-r--r--gst-libs/ext/libav/libavdevice/libdc1394.c28
-rw-r--r--gst-libs/ext/libav/libavdevice/oss_audio.c23
-rw-r--r--gst-libs/ext/libav/libavdevice/pulse.c39
-rw-r--r--gst-libs/ext/libav/libavdevice/sndio_common.c2
-rw-r--r--gst-libs/ext/libav/libavdevice/sndio_common.h4
-rw-r--r--gst-libs/ext/libav/libavdevice/sndio_dec.c7
-rw-r--r--gst-libs/ext/libav/libavdevice/sndio_enc.c4
-rw-r--r--gst-libs/ext/libav/libavdevice/timefilter.c103
-rw-r--r--gst-libs/ext/libav/libavdevice/v4l.c366
-rw-r--r--gst-libs/ext/libav/libavdevice/v4l2.c87
-rw-r--r--gst-libs/ext/libav/libavdevice/version.h48
-rw-r--r--gst-libs/ext/libav/libavdevice/vfwcap.c38
-rw-r--r--gst-libs/ext/libav/libavdevice/x11grab.c57
-rw-r--r--gst-libs/ext/libav/libavfilter/Makefile40
-rw-r--r--gst-libs/ext/libav/libavfilter/af_aformat.c160
-rw-r--r--gst-libs/ext/libav/libavfilter/af_amix.c573
-rw-r--r--gst-libs/ext/libav/libavfilter/af_anull.c30
-rw-r--r--gst-libs/ext/libav/libavfilter/af_ashowinfo.c137
-rw-r--r--gst-libs/ext/libav/libavfilter/af_asyncts.c319
-rw-r--r--gst-libs/ext/libav/libavfilter/af_channelmap.c424
-rw-r--r--gst-libs/ext/libav/libavfilter/af_channelsplit.c158
-rw-r--r--gst-libs/ext/libav/libavfilter/af_join.c510
-rw-r--r--gst-libs/ext/libav/libavfilter/af_resample.c272
-rw-r--r--gst-libs/ext/libav/libavfilter/af_volume.c317
-rw-r--r--gst-libs/ext/libav/libavfilter/af_volume.h55
-rw-r--r--gst-libs/ext/libav/libavfilter/allfilters.c136
-rw-r--r--gst-libs/ext/libav/libavfilter/asink_anullsink.c28
-rw-r--r--gst-libs/ext/libav/libavfilter/asrc_anullsrc.c29
-rw-r--r--gst-libs/ext/libav/libavfilter/audio.c148
-rw-r--r--gst-libs/ext/libav/libavfilter/audio.h45
-rw-r--r--gst-libs/ext/libav/libavfilter/avfilter.c525
-rw-r--r--gst-libs/ext/libav/libavfilter/avfilter.h565
-rw-r--r--gst-libs/ext/libav/libavfilter/avfiltergraph.c552
-rw-r--r--gst-libs/ext/libav/libavfilter/avfiltergraph.h59
-rw-r--r--gst-libs/ext/libav/libavfilter/buffer.c175
-rw-r--r--gst-libs/ext/libav/libavfilter/buffersink.c182
-rw-r--r--gst-libs/ext/libav/libavfilter/buffersink.h62
-rw-r--r--gst-libs/ext/libav/libavfilter/buffersrc.c390
-rw-r--r--gst-libs/ext/libav/libavfilter/buffersrc.h12
-rw-r--r--gst-libs/ext/libav/libavfilter/defaults.c300
-rw-r--r--gst-libs/ext/libav/libavfilter/drawutils.c19
-rw-r--r--gst-libs/ext/libav/libavfilter/drawutils.h2
-rw-r--r--gst-libs/ext/libav/libavfilter/fifo.c309
-rw-r--r--gst-libs/ext/libav/libavfilter/filtfmts.c104
-rw-r--r--gst-libs/ext/libav/libavfilter/formats.c383
-rw-r--r--gst-libs/ext/libav/libavfilter/formats.h221
-rw-r--r--gst-libs/ext/libav/libavfilter/gradfun.h9
-rw-r--r--gst-libs/ext/libav/libavfilter/graphparser.c232
-rw-r--r--gst-libs/ext/libav/libavfilter/internal.h196
-rw-r--r--gst-libs/ext/libav/libavfilter/split.c130
-rw-r--r--gst-libs/ext/libav/libavfilter/version.h19
-rw-r--r--gst-libs/ext/libav/libavfilter/vf_aspect.c82
-rw-r--r--gst-libs/ext/libav/libavfilter/vf_blackframe.c79
-rw-r--r--gst-libs/ext/libav/libavfilter/vf_boxblur.c88
-rw-r--r--gst-libs/ext/libav/libavfilter/vf_copy.c33
-rw-r--r--gst-libs/ext/libav/libavfilter/vf_crop.c160
-rw-r--r--gst-libs/ext/libav/libavfilter/vf_cropdetect.c86
-rw-r--r--gst-libs/ext/libav/libavfilter/vf_delogo.c132
-rw-r--r--gst-libs/ext/libav/libavfilter/vf_drawbox.c78
-rw-r--r--gst-libs/ext/libav/libavfilter/vf_drawtext.c173
-rw-r--r--gst-libs/ext/libav/libavfilter/vf_fade.c86
-rw-r--r--gst-libs/ext/libav/libavfilter/vf_fieldorder.c207
-rw-r--r--gst-libs/ext/libav/libavfilter/vf_fifo.c119
-rw-r--r--gst-libs/ext/libav/libavfilter/vf_format.c90
-rw-r--r--gst-libs/ext/libav/libavfilter/vf_fps.c295
-rw-r--r--gst-libs/ext/libav/libavfilter/vf_frei0r.c136
-rw-r--r--gst-libs/ext/libav/libavfilter/vf_gradfun.c127
-rw-r--r--gst-libs/ext/libav/libavfilter/vf_hflip.c125
-rw-r--r--gst-libs/ext/libav/libavfilter/vf_hqdn3d.c476
-rw-r--r--gst-libs/ext/libav/libavfilter/vf_libopencv.c98
-rw-r--r--gst-libs/ext/libav/libavfilter/vf_lut.c148
-rw-r--r--gst-libs/ext/libav/libavfilter/vf_null.c31
-rw-r--r--gst-libs/ext/libav/libavfilter/vf_overlay.c279
-rw-r--r--gst-libs/ext/libav/libavfilter/vf_pad.c220
-rw-r--r--gst-libs/ext/libav/libavfilter/vf_pixdesctest.c93
-rw-r--r--gst-libs/ext/libav/libavfilter/vf_scale.c164
-rw-r--r--gst-libs/ext/libav/libavfilter/vf_select.c95
-rw-r--r--gst-libs/ext/libav/libavfilter/vf_setpts.c65
-rw-r--r--gst-libs/ext/libav/libavfilter/vf_settb.c58
-rw-r--r--gst-libs/ext/libav/libavfilter/vf_showinfo.c68
-rw-r--r--gst-libs/ext/libav/libavfilter/vf_slicify.c117
-rw-r--r--gst-libs/ext/libav/libavfilter/vf_split.c66
-rw-r--r--gst-libs/ext/libav/libavfilter/vf_transpose.c174
-rw-r--r--gst-libs/ext/libav/libavfilter/vf_unsharp.c80
-rw-r--r--gst-libs/ext/libav/libavfilter/vf_vflip.c59
-rw-r--r--gst-libs/ext/libav/libavfilter/vf_yadif.c316
-rw-r--r--gst-libs/ext/libav/libavfilter/video.c165
-rw-r--r--gst-libs/ext/libav/libavfilter/video.h42
-rw-r--r--gst-libs/ext/libav/libavfilter/vsink_nullsink.c29
-rw-r--r--gst-libs/ext/libav/libavfilter/vsrc_buffer.c187
-rw-r--r--gst-libs/ext/libav/libavfilter/vsrc_buffer.h35
-rw-r--r--gst-libs/ext/libav/libavfilter/vsrc_color.c73
-rw-r--r--gst-libs/ext/libav/libavfilter/vsrc_movie.c50
-rw-r--r--gst-libs/ext/libav/libavfilter/vsrc_nullsrc.c33
-rw-r--r--gst-libs/ext/libav/libavfilter/vsrc_testsrc.c135
-rw-r--r--gst-libs/ext/libav/libavfilter/x86/Makefile8
-rw-r--r--gst-libs/ext/libav/libavfilter/x86/af_volume.asm138
-rw-r--r--gst-libs/ext/libav/libavfilter/x86/af_volume_init.c59
-rw-r--r--gst-libs/ext/libav/libavfilter/x86/gradfun.c46
-rw-r--r--gst-libs/ext/libav/libavfilter/x86/hqdn3d.asm106
-rw-r--r--gst-libs/ext/libav/libavfilter/x86/yadif.c39
-rw-r--r--gst-libs/ext/libav/libavfilter/x86/yadif_template.c41
-rw-r--r--gst-libs/ext/libav/libavfilter/yadif.h45
-rw-r--r--gst-libs/ext/libav/libavformat/4xm.c256
-rw-r--r--gst-libs/ext/libav/libavformat/Makefile202
-rw-r--r--gst-libs/ext/libav/libavformat/a64.c130
-rw-r--r--gst-libs/ext/libav/libavformat/aacdec.c13
-rw-r--r--gst-libs/ext/libav/libavformat/ac3dec.c48
-rw-r--r--gst-libs/ext/libav/libavformat/adts.h45
-rw-r--r--gst-libs/ext/libav/libavformat/adtsenc.c28
-rw-r--r--gst-libs/ext/libav/libavformat/adxdec.c6
-rw-r--r--gst-libs/ext/libav/libavformat/aea.c16
-rw-r--r--gst-libs/ext/libav/libavformat/aiff.h38
-rw-r--r--gst-libs/ext/libav/libavformat/aiffdec.c80
-rw-r--r--gst-libs/ext/libav/libavformat/aiffenc.c6
-rw-r--r--gst-libs/ext/libav/libavformat/allformats.c463
-rw-r--r--gst-libs/ext/libav/libavformat/amr.c115
-rw-r--r--gst-libs/ext/libav/libavformat/anm.c9
-rw-r--r--gst-libs/ext/libav/libavformat/apc.c18
-rw-r--r--gst-libs/ext/libav/libavformat/ape.c53
-rw-r--r--gst-libs/ext/libav/libavformat/apetag.c90
-rw-r--r--gst-libs/ext/libav/libavformat/apetag.h6
-rw-r--r--gst-libs/ext/libav/libavformat/applehttp.c711
-rw-r--r--gst-libs/ext/libav/libavformat/applehttpproto.c313
-rw-r--r--gst-libs/ext/libav/libavformat/asf.h6
-rw-r--r--gst-libs/ext/libav/libavformat/asfcrypt.c3
-rw-r--r--gst-libs/ext/libav/libavformat/asfdec.c345
-rw-r--r--gst-libs/ext/libav/libavformat/asfenc.c47
-rw-r--r--gst-libs/ext/libav/libavformat/assdec.c13
-rw-r--r--gst-libs/ext/libav/libavformat/assenc.c8
-rw-r--r--gst-libs/ext/libav/libavformat/au.c169
-rw-r--r--gst-libs/ext/libav/libavformat/audiointerleave.c2
-rw-r--r--gst-libs/ext/libav/libavformat/audiointerleave.h2
-rw-r--r--gst-libs/ext/libav/libavformat/avc.c31
-rw-r--r--gst-libs/ext/libav/libavformat/avc.h1
-rw-r--r--gst-libs/ext/libav/libavformat/avformat.h841
-rw-r--r--gst-libs/ext/libav/libavformat/avidec.c59
-rw-r--r--gst-libs/ext/libav/libavformat/avienc.c51
-rw-r--r--gst-libs/ext/libav/libavformat/avio.c160
-rw-r--r--gst-libs/ext/libav/libavformat/avio.h297
-rw-r--r--gst-libs/ext/libav/libavformat/avio_internal.h2
-rw-r--r--gst-libs/ext/libav/libavformat/aviobuf.c441
-rw-r--r--gst-libs/ext/libav/libavformat/avisynth.c16
-rw-r--r--gst-libs/ext/libav/libavformat/avs.c14
-rw-r--r--gst-libs/ext/libav/libavformat/bethsoftvid.c171
-rw-r--r--gst-libs/ext/libav/libavformat/bfi.c10
-rw-r--r--gst-libs/ext/libav/libavformat/bink.c19
-rw-r--r--gst-libs/ext/libav/libavformat/bmv.c12
-rw-r--r--gst-libs/ext/libav/libavformat/c93.c7
-rw-r--r--gst-libs/ext/libav/libavformat/caf.c34
-rw-r--r--gst-libs/ext/libav/libavformat/cafdec.c78
-rw-r--r--gst-libs/ext/libav/libavformat/cavsvideodec.c2
-rw-r--r--gst-libs/ext/libav/libavformat/cdg.c8
-rw-r--r--gst-libs/ext/libav/libavformat/cdxl.c188
-rw-r--r--gst-libs/ext/libav/libavformat/crcenc.c8
-rw-r--r--gst-libs/ext/libav/libavformat/crypto.c4
-rw-r--r--gst-libs/ext/libav/libavformat/cutils.c2
-rw-r--r--gst-libs/ext/libav/libavformat/daud.c17
-rw-r--r--gst-libs/ext/libav/libavformat/dfa.c7
-rw-r--r--gst-libs/ext/libav/libavformat/diracdec.c2
-rw-r--r--gst-libs/ext/libav/libavformat/dnxhddec.c2
-rw-r--r--gst-libs/ext/libav/libavformat/dsicin.c10
-rw-r--r--gst-libs/ext/libav/libavformat/dtsdec.c6
-rw-r--r--gst-libs/ext/libav/libavformat/dv.c95
-rw-r--r--gst-libs/ext/libav/libavformat/dv.h2
-rw-r--r--gst-libs/ext/libav/libavformat/dvenc.c36
-rw-r--r--gst-libs/ext/libav/libavformat/dxa.c6
-rw-r--r--gst-libs/ext/libav/libavformat/eacdata.c4
-rw-r--r--gst-libs/ext/libav/libavformat/electronicarts.c113
-rw-r--r--gst-libs/ext/libav/libavformat/ffm.h4
-rw-r--r--gst-libs/ext/libav/libavformat/ffmdec.c50
-rw-r--r--gst-libs/ext/libav/libavformat/ffmenc.c17
-rw-r--r--gst-libs/ext/libav/libavformat/ffmetadec.c6
-rw-r--r--gst-libs/ext/libav/libavformat/ffmetaenc.c4
-rw-r--r--gst-libs/ext/libav/libavformat/file.c67
-rw-r--r--gst-libs/ext/libav/libavformat/filmstripdec.c14
-rw-r--r--gst-libs/ext/libav/libavformat/filmstripenc.c10
-rw-r--r--gst-libs/ext/libav/libavformat/flacdec.c147
-rw-r--r--gst-libs/ext/libav/libavformat/flacenc.c6
-rw-r--r--gst-libs/ext/libav/libavformat/flic.c11
-rw-r--r--gst-libs/ext/libav/libavformat/flv.h2
-rw-r--r--gst-libs/ext/libav/libavformat/flvdec.c439
-rw-r--r--gst-libs/ext/libav/libavformat/flvenc.c411
-rw-r--r--gst-libs/ext/libav/libavformat/framecrcenc.c13
-rw-r--r--gst-libs/ext/libav/libavformat/framehash.c33
-rw-r--r--gst-libs/ext/libav/libavformat/g722.c56
-rw-r--r--gst-libs/ext/libav/libavformat/g723_1.c85
-rw-r--r--gst-libs/ext/libav/libavformat/gif.c162
-rw-r--r--gst-libs/ext/libav/libavformat/gsmdec.c10
-rw-r--r--gst-libs/ext/libav/libavformat/gxf.c50
-rw-r--r--gst-libs/ext/libav/libavformat/gxfenc.c91
-rw-r--r--gst-libs/ext/libav/libavformat/h261dec.c2
-rw-r--r--gst-libs/ext/libav/libavformat/h263dec.c4
-rw-r--r--gst-libs/ext/libav/libavformat/h264dec.c4
-rw-r--r--gst-libs/ext/libav/libavformat/hls.c752
-rw-r--r--gst-libs/ext/libav/libavformat/hlsenc.c340
-rw-r--r--gst-libs/ext/libav/libavformat/hlsproto.c347
-rw-r--r--gst-libs/ext/libav/libavformat/http.c247
-rw-r--r--gst-libs/ext/libav/libavformat/http.h10
-rw-r--r--gst-libs/ext/libav/libavformat/httpauth.c36
-rw-r--r--gst-libs/ext/libav/libavformat/httpauth.h11
-rw-r--r--gst-libs/ext/libav/libavformat/id3v1.h1
-rw-r--r--gst-libs/ext/libav/libavformat/id3v2.c170
-rw-r--r--gst-libs/ext/libav/libavformat/id3v2.h57
-rw-r--r--gst-libs/ext/libav/libavformat/id3v2enc.c189
-rw-r--r--gst-libs/ext/libav/libavformat/idcin.c11
-rw-r--r--gst-libs/ext/libav/libavformat/idroqdec.c21
-rw-r--r--gst-libs/ext/libav/libavformat/idroqenc.c8
-rw-r--r--gst-libs/ext/libav/libavformat/iff.c27
-rw-r--r--gst-libs/ext/libav/libavformat/ilbc.c141
-rw-r--r--gst-libs/ext/libav/libavformat/img2.c521
-rw-r--r--gst-libs/ext/libav/libavformat/img2dec.c334
-rw-r--r--gst-libs/ext/libav/libavformat/img2enc.c166
-rw-r--r--gst-libs/ext/libav/libavformat/ingenientdec.c6
-rw-r--r--gst-libs/ext/libav/libavformat/internal.h88
-rw-r--r--gst-libs/ext/libav/libavformat/ipmovie.c30
-rw-r--r--gst-libs/ext/libav/libavformat/isom.c497
-rw-r--r--gst-libs/ext/libav/libavformat/isom.h53
-rw-r--r--gst-libs/ext/libav/libavformat/iss.c18
-rw-r--r--gst-libs/ext/libav/libavformat/iv8.c9
-rw-r--r--gst-libs/ext/libav/libavformat/ivfdec.c6
-rw-r--r--gst-libs/ext/libav/libavformat/ivfenc.c12
-rw-r--r--gst-libs/ext/libav/libavformat/jvdec.c13
-rw-r--r--gst-libs/ext/libav/libavformat/latmenc.c6
-rw-r--r--gst-libs/ext/libav/libavformat/libavformat.v25
-rw-r--r--gst-libs/ext/libav/libavformat/libnut.c311
-rw-r--r--gst-libs/ext/libav/libavformat/librtmp.c127
-rw-r--r--gst-libs/ext/libav/libavformat/lmlm4.c8
-rw-r--r--gst-libs/ext/libav/libavformat/log2_tab.c1
-rw-r--r--gst-libs/ext/libav/libavformat/lxfdec.c40
-rw-r--r--gst-libs/ext/libav/libavformat/m4vdec.c2
-rw-r--r--gst-libs/ext/libav/libavformat/matroska.c128
-rw-r--r--gst-libs/ext/libav/libavformat/matroska.h8
-rw-r--r--gst-libs/ext/libav/libavformat/matroskadec.c797
-rw-r--r--gst-libs/ext/libav/libavformat/matroskaenc.c119
-rw-r--r--gst-libs/ext/libav/libavformat/md5enc.c72
-rw-r--r--gst-libs/ext/libav/libavformat/md5proto.c24
-rw-r--r--gst-libs/ext/libav/libavformat/metadata.c30
-rw-r--r--gst-libs/ext/libav/libavformat/metadata.h7
-rw-r--r--gst-libs/ext/libav/libavformat/mm.c11
-rw-r--r--gst-libs/ext/libav/libavformat/mmf.c14
-rw-r--r--gst-libs/ext/libav/libavformat/mms.h4
-rw-r--r--gst-libs/ext/libav/libavformat/mmst.c10
-rw-r--r--gst-libs/ext/libav/libavformat/mov.c738
-rw-r--r--gst-libs/ext/libav/libavformat/mov_chan.c94
-rw-r--r--gst-libs/ext/libav/libavformat/mov_chan.h23
-rw-r--r--gst-libs/ext/libav/libavformat/movenc.c1581
-rw-r--r--gst-libs/ext/libav/libavformat/movenc.h62
-rw-r--r--gst-libs/ext/libav/libavformat/movenchint.c10
-rw-r--r--gst-libs/ext/libav/libavformat/mp3dec.c137
-rw-r--r--gst-libs/ext/libav/libavformat/mp3enc.c346
-rw-r--r--gst-libs/ext/libav/libavformat/mpc.c24
-rw-r--r--gst-libs/ext/libav/libavformat/mpc8.c34
-rw-r--r--gst-libs/ext/libav/libavformat/mpeg.c98
-rw-r--r--gst-libs/ext/libav/libavformat/mpegenc.c182
-rw-r--r--gst-libs/ext/libav/libavformat/mpegts.c269
-rw-r--r--gst-libs/ext/libav/libavformat/mpegts.h8
-rw-r--r--gst-libs/ext/libav/libavformat/mpegtsenc.c253
-rw-r--r--gst-libs/ext/libav/libavformat/mpegvideodec.c2
-rw-r--r--gst-libs/ext/libav/libavformat/mpjpeg.c6
-rw-r--r--gst-libs/ext/libav/libavformat/msnwc_tcp.c4
-rw-r--r--gst-libs/ext/libav/libavformat/mtv.c28
-rw-r--r--gst-libs/ext/libav/libavformat/mux.c602
-rw-r--r--gst-libs/ext/libav/libavformat/mvi.c12
-rw-r--r--gst-libs/ext/libav/libavformat/mxf.c74
-rw-r--r--gst-libs/ext/libav/libavformat/mxf.h15
-rw-r--r--gst-libs/ext/libav/libavformat/mxfdec.c1460
-rw-r--r--gst-libs/ext/libav/libavformat/mxfenc.c41
-rw-r--r--gst-libs/ext/libav/libavformat/mxg.c20
-rw-r--r--gst-libs/ext/libav/libavformat/ncdec.c8
-rw-r--r--gst-libs/ext/libav/libavformat/network.c26
-rw-r--r--gst-libs/ext/libav/libavformat/network.h49
-rw-r--r--gst-libs/ext/libav/libavformat/nsvdec.c64
-rw-r--r--gst-libs/ext/libav/libavformat/nullenc.c8
-rw-r--r--gst-libs/ext/libav/libavformat/nut.c185
-rw-r--r--gst-libs/ext/libav/libavformat/nut.h18
-rw-r--r--gst-libs/ext/libav/libavformat/nutdec.c969
-rw-r--r--gst-libs/ext/libav/libavformat/nutenc.c799
-rw-r--r--gst-libs/ext/libav/libavformat/nuv.c305
-rw-r--r--gst-libs/ext/libav/libavformat/oggdec.c252
-rw-r--r--gst-libs/ext/libav/libavformat/oggdec.h4
-rw-r--r--gst-libs/ext/libav/libavformat/oggenc.c126
-rw-r--r--gst-libs/ext/libav/libavformat/oggparsecelt.c3
-rw-r--r--gst-libs/ext/libav/libavformat/oggparsedirac.c8
-rw-r--r--gst-libs/ext/libav/libavformat/oggparseflac.c11
-rw-r--r--gst-libs/ext/libav/libavformat/oggparseogm.c13
-rw-r--r--gst-libs/ext/libav/libavformat/oggparseskeleton.c14
-rw-r--r--gst-libs/ext/libav/libavformat/oggparsespeex.c12
-rw-r--r--gst-libs/ext/libav/libavformat/oggparsetheora.c42
-rw-r--r--gst-libs/ext/libav/libavformat/oggparsevorbis.c82
-rw-r--r--gst-libs/ext/libav/libavformat/oma.c8
-rw-r--r--gst-libs/ext/libav/libavformat/omadec.c27
-rw-r--r--gst-libs/ext/libav/libavformat/omaenc.c4
-rw-r--r--gst-libs/ext/libav/libavformat/options.c53
-rw-r--r--gst-libs/ext/libav/libavformat/options_table.h68
-rw-r--r--gst-libs/ext/libav/libavformat/os_support.c140
-rw-r--r--gst-libs/ext/libav/libavformat/os_support.h40
-rw-r--r--gst-libs/ext/libav/libavformat/output-example.c313
-rw-r--r--gst-libs/ext/libav/libavformat/pcm.c4
-rw-r--r--gst-libs/ext/libav/libavformat/pcm.h4
-rw-r--r--gst-libs/ext/libav/libavformat/pcmdec.c131
-rw-r--r--gst-libs/ext/libav/libavformat/pcmenc.c82
-rw-r--r--gst-libs/ext/libav/libavformat/pmpdec.c14
-rw-r--r--gst-libs/ext/libav/libavformat/psxstr.c24
-rw-r--r--gst-libs/ext/libav/libavformat/pva.c10
-rw-r--r--gst-libs/ext/libav/libavformat/qcp.c8
-rw-r--r--gst-libs/ext/libav/libavformat/r3d.c44
-rw-r--r--gst-libs/ext/libav/libavformat/rawdec.c129
-rw-r--r--gst-libs/ext/libav/libavformat/rawdec.h14
-rw-r--r--gst-libs/ext/libav/libavformat/rawenc.c172
-rw-r--r--gst-libs/ext/libav/libavformat/rawvideodec.c78
-rw-r--r--gst-libs/ext/libav/libavformat/rdt.c15
-rw-r--r--gst-libs/ext/libav/libavformat/riff.c829
-rw-r--r--gst-libs/ext/libav/libavformat/riff.h16
-rw-r--r--gst-libs/ext/libav/libavformat/rl2.c11
-rw-r--r--gst-libs/ext/libav/libavformat/rm.c29
-rw-r--r--gst-libs/ext/libav/libavformat/rm.h8
-rw-r--r--gst-libs/ext/libav/libavformat/rmdec.c100
-rw-r--r--gst-libs/ext/libav/libavformat/rmenc.c16
-rw-r--r--gst-libs/ext/libav/libavformat/rmsipr.c61
-rw-r--r--gst-libs/ext/libav/libavformat/rmsipr.h35
-rw-r--r--gst-libs/ext/libav/libavformat/rpl.c22
-rw-r--r--gst-libs/ext/libav/libavformat/rso.c6
-rw-r--r--gst-libs/ext/libav/libavformat/rsodec.c15
-rw-r--r--gst-libs/ext/libav/libavformat/rsoenc.c10
-rw-r--r--gst-libs/ext/libav/libavformat/rtmp.h29
-rw-r--r--gst-libs/ext/libav/libavformat/rtmpcrypt.c336
-rw-r--r--gst-libs/ext/libav/libavformat/rtmpcrypt.h69
-rw-r--r--gst-libs/ext/libav/libavformat/rtmpdh.c339
-rw-r--r--gst-libs/ext/libav/libavformat/rtmpdh.h102
-rw-r--r--gst-libs/ext/libav/libavformat/rtmphttp.c276
-rw-r--r--gst-libs/ext/libav/libavformat/rtmppkt.c95
-rw-r--r--gst-libs/ext/libav/libavformat/rtmppkt.h65
-rw-r--r--gst-libs/ext/libav/libavformat/rtmpproto.c2222
-rw-r--r--gst-libs/ext/libav/libavformat/rtp.c90
-rw-r--r--gst-libs/ext/libav/libavformat/rtp.h30
-rw-r--r--gst-libs/ext/libav/libavformat/rtpdec.c363
-rw-r--r--gst-libs/ext/libav/libavformat/rtpdec.h105
-rw-r--r--gst-libs/ext/libav/libavformat/rtpdec_amr.c25
-rw-r--r--gst-libs/ext/libav/libavformat/rtpdec_asf.c14
-rw-r--r--gst-libs/ext/libav/libavformat/rtpdec_formats.h7
-rw-r--r--gst-libs/ext/libav/libavformat/rtpdec_g726.c2
-rw-r--r--gst-libs/ext/libav/libavformat/rtpdec_h263.c19
-rw-r--r--gst-libs/ext/libav/libavformat/rtpdec_h263_rfc2190.c205
-rw-r--r--gst-libs/ext/libav/libavformat/rtpdec_h264.c316
-rw-r--r--gst-libs/ext/libav/libavformat/rtpdec_ilbc.c73
-rw-r--r--gst-libs/ext/libav/libavformat/rtpdec_jpeg.c392
-rw-r--r--gst-libs/ext/libav/libavformat/rtpdec_latm.c10
-rw-r--r--gst-libs/ext/libav/libavformat/rtpdec_mpeg4.c43
-rw-r--r--gst-libs/ext/libav/libavformat/rtpdec_qcelp.c7
-rw-r--r--gst-libs/ext/libav/libavformat/rtpdec_qdm2.c13
-rw-r--r--gst-libs/ext/libav/libavformat/rtpdec_qt.c10
-rw-r--r--gst-libs/ext/libav/libavformat/rtpdec_svq3.c20
-rw-r--r--gst-libs/ext/libav/libavformat/rtpdec_vp8.c260
-rw-r--r--gst-libs/ext/libav/libavformat/rtpdec_xiph.c40
-rw-r--r--gst-libs/ext/libav/libavformat/rtpenc.c321
-rw-r--r--gst-libs/ext/libav/libavformat/rtpenc.h29
-rw-r--r--gst-libs/ext/libav/libavformat/rtpenc_aac.c4
-rw-r--r--gst-libs/ext/libav/libavformat/rtpenc_amr.c1
-rw-r--r--gst-libs/ext/libav/libavformat/rtpenc_chain.c42
-rw-r--r--gst-libs/ext/libav/libavformat/rtpenc_chain.h5
-rw-r--r--gst-libs/ext/libav/libavformat/rtpenc_h263.c7
-rw-r--r--gst-libs/ext/libav/libavformat/rtpenc_h263_rfc2190.c195
-rw-r--r--gst-libs/ext/libav/libavformat/rtpenc_h264.c6
-rw-r--r--gst-libs/ext/libav/libavformat/rtpenc_jpeg.c138
-rw-r--r--gst-libs/ext/libav/libavformat/rtpenc_mpv.c2
-rw-r--r--gst-libs/ext/libav/libavformat/rtpenc_vp8.c22
-rw-r--r--gst-libs/ext/libav/libavformat/rtpproto.c36
-rw-r--r--gst-libs/ext/libav/libavformat/rtsp.c505
-rw-r--r--gst-libs/ext/libav/libavformat/rtsp.h50
-rw-r--r--gst-libs/ext/libav/libavformat/rtspcodes.h14
-rw-r--r--gst-libs/ext/libav/libavformat/rtspdec.c613
-rw-r--r--gst-libs/ext/libav/libavformat/rtspenc.c15
-rw-r--r--gst-libs/ext/libav/libavformat/sapdec.c9
-rw-r--r--gst-libs/ext/libav/libavformat/sapenc.c26
-rw-r--r--gst-libs/ext/libav/libavformat/sctp.c330
-rw-r--r--gst-libs/ext/libav/libavformat/sdp.c119
-rw-r--r--gst-libs/ext/libav/libavformat/seek-test.c6
-rw-r--r--gst-libs/ext/libav/libavformat/seek.c18
-rw-r--r--gst-libs/ext/libav/libavformat/seek.h5
-rw-r--r--gst-libs/ext/libav/libavformat/segafilm.c52
-rw-r--r--gst-libs/ext/libav/libavformat/segment.c277
-rw-r--r--gst-libs/ext/libav/libavformat/sierravmd.c18
-rw-r--r--gst-libs/ext/libav/libavformat/siff.c20
-rw-r--r--gst-libs/ext/libav/libavformat/smacker.c27
-rw-r--r--gst-libs/ext/libav/libavformat/smjpeg.c10
-rw-r--r--gst-libs/ext/libav/libavformat/smjpegdec.c12
-rw-r--r--gst-libs/ext/libav/libavformat/smjpegenc.c8
-rw-r--r--gst-libs/ext/libav/libavformat/smoothstreamingenc.c629
-rw-r--r--gst-libs/ext/libav/libavformat/sol.c30
-rw-r--r--gst-libs/ext/libav/libavformat/soxdec.c11
-rw-r--r--gst-libs/ext/libav/libavformat/soxenc.c12
-rw-r--r--gst-libs/ext/libav/libavformat/spdifdec.c36
-rw-r--r--gst-libs/ext/libav/libavformat/spdifenc.c39
-rw-r--r--gst-libs/ext/libav/libavformat/srtdec.c6
-rw-r--r--gst-libs/ext/libav/libavformat/swf.c29
-rw-r--r--gst-libs/ext/libav/libavformat/swf.h19
-rw-r--r--gst-libs/ext/libav/libavformat/swfdec.c78
-rw-r--r--gst-libs/ext/libav/libavformat/swfenc.c54
-rw-r--r--gst-libs/ext/libav/libavformat/takdec.c185
-rw-r--r--gst-libs/ext/libav/libavformat/tcp.c72
-rw-r--r--gst-libs/ext/libav/libavformat/thp.c10
-rw-r--r--gst-libs/ext/libav/libavformat/tiertexseq.c13
-rw-r--r--gst-libs/ext/libav/libavformat/tls.c4
-rw-r--r--gst-libs/ext/libav/libavformat/tmv.c22
-rw-r--r--gst-libs/ext/libav/libavformat/tta.c27
-rw-r--r--gst-libs/ext/libav/libavformat/tty.c7
-rw-r--r--gst-libs/ext/libav/libavformat/txd.c4
-rw-r--r--gst-libs/ext/libav/libavformat/udp.c177
-rw-r--r--gst-libs/ext/libav/libavformat/url-test.c55
-rw-r--r--gst-libs/ext/libav/libavformat/url.h37
-rw-r--r--gst-libs/ext/libav/libavformat/urldecode.c87
-rw-r--r--gst-libs/ext/libav/libavformat/urldecode.h35
-rw-r--r--gst-libs/ext/libav/libavformat/utils.c1822
-rw-r--r--gst-libs/ext/libav/libavformat/vc1test.c9
-rw-r--r--gst-libs/ext/libav/libavformat/vc1testenc.c10
-rw-r--r--gst-libs/ext/libav/libavformat/version.h93
-rw-r--r--gst-libs/ext/libav/libavformat/voc.c18
-rw-r--r--gst-libs/ext/libav/libavformat/voc.h6
-rw-r--r--gst-libs/ext/libav/libavformat/vocdec.c32
-rw-r--r--gst-libs/ext/libav/libavformat/vocenc.c8
-rw-r--r--gst-libs/ext/libav/libavformat/vqf.c13
-rw-r--r--gst-libs/ext/libav/libavformat/wav.c694
-rw-r--r--gst-libs/ext/libav/libavformat/wavdec.c512
-rw-r--r--gst-libs/ext/libav/libavformat/wavenc.c220
-rw-r--r--gst-libs/ext/libav/libavformat/wc3movie.c11
-rw-r--r--gst-libs/ext/libav/libavformat/westwood.c394
-rw-r--r--gst-libs/ext/libav/libavformat/westwood_aud.c183
-rw-r--r--gst-libs/ext/libav/libavformat/westwood_vqa.c281
-rw-r--r--gst-libs/ext/libav/libavformat/wtv.c69
-rw-r--r--gst-libs/ext/libav/libavformat/wv.c237
-rw-r--r--gst-libs/ext/libav/libavformat/xa.c27
-rw-r--r--gst-libs/ext/libav/libavformat/xmv.c9
-rw-r--r--gst-libs/ext/libav/libavformat/xwma.c4
-rw-r--r--gst-libs/ext/libav/libavformat/yop.c22
-rw-r--r--gst-libs/ext/libav/libavformat/yuv4mpeg.c75
-rw-r--r--gst-libs/ext/libav/libavresample/Makefile16
-rw-r--r--gst-libs/ext/libav/libavresample/arm/Makefile2
-rw-r--r--gst-libs/ext/libav/libavresample/arm/audio_convert_init.c49
-rw-r--r--gst-libs/ext/libav/libavresample/arm/audio_convert_neon.S363
-rw-r--r--gst-libs/ext/libav/libavresample/audio_convert.c369
-rw-r--r--gst-libs/ext/libav/libavresample/audio_convert.h101
-rw-r--r--gst-libs/ext/libav/libavresample/audio_data.c346
-rw-r--r--gst-libs/ext/libav/libavresample/audio_data.h173
-rw-r--r--gst-libs/ext/libav/libavresample/audio_mix.c544
-rw-r--r--gst-libs/ext/libav/libavresample/audio_mix.h95
-rw-r--r--gst-libs/ext/libav/libavresample/audio_mix_matrix.c289
-rw-r--r--gst-libs/ext/libav/libavresample/avresample-test.c341
-rw-r--r--gst-libs/ext/libav/libavresample/avresample.h379
-rw-r--r--gst-libs/ext/libav/libavresample/dither.c423
-rw-r--r--gst-libs/ext/libav/libavresample/dither.h88
-rw-r--r--gst-libs/ext/libav/libavresample/internal.h86
-rw-r--r--gst-libs/ext/libav/libavresample/libavresample.v4
-rw-r--r--gst-libs/ext/libav/libavresample/options.c99
-rw-r--r--gst-libs/ext/libav/libavresample/resample.c468
-rw-r--r--gst-libs/ext/libav/libavresample/resample.h68
-rw-r--r--gst-libs/ext/libav/libavresample/resample_template.c102
-rw-r--r--gst-libs/ext/libav/libavresample/utils.c496
-rw-r--r--gst-libs/ext/libav/libavresample/version.h46
-rw-r--r--gst-libs/ext/libav/libavresample/x86/Makefile5
-rw-r--r--gst-libs/ext/libav/libavresample/x86/audio_convert.asm1227
-rw-r--r--gst-libs/ext/libav/libavresample/x86/audio_convert_init.c263
-rw-r--r--gst-libs/ext/libav/libavresample/x86/audio_mix.asm503
-rw-r--r--gst-libs/ext/libav/libavresample/x86/audio_mix_init.c215
-rw-r--r--gst-libs/ext/libav/libavresample/x86/util.asm41
-rw-r--r--gst-libs/ext/libav/libavutil/Makefile57
-rw-r--r--gst-libs/ext/libav/libavutil/aes.c7
-rw-r--r--gst-libs/ext/libav/libavutil/aes.h12
-rw-r--r--gst-libs/ext/libav/libavutil/arm/Makefile8
-rw-r--r--gst-libs/ext/libav/libavutil/arm/asm.S304
-rw-r--r--gst-libs/ext/libav/libavutil/arm/bswap.h13
-rw-r--r--gst-libs/ext/libav/libavutil/arm/cpu.c123
-rw-r--r--gst-libs/ext/libav/libavutil/arm/cpu.h32
-rw-r--r--gst-libs/ext/libav/libavutil/arm/float_dsp_arm.h29
-rw-r--r--gst-libs/ext/libav/libavutil/arm/float_dsp_init_arm.c33
-rw-r--r--gst-libs/ext/libav/libavutil/arm/float_dsp_init_neon.c40
-rw-r--r--gst-libs/ext/libav/libavutil/arm/float_dsp_init_vfp.c34
-rw-r--r--gst-libs/ext/libav/libavutil/arm/float_dsp_neon.S148
-rw-r--r--gst-libs/ext/libav/libavutil/arm/float_dsp_vfp.S68
-rw-r--r--gst-libs/ext/libav/libavutil/arm/intmath.h51
-rw-r--r--gst-libs/ext/libav/libavutil/arm/intreadwrite.h22
-rw-r--r--gst-libs/ext/libav/libavutil/attributes.h30
-rw-r--r--gst-libs/ext/libav/libavutil/audio_fifo.c194
-rw-r--r--gst-libs/ext/libav/libavutil/audio_fifo.h146
-rw-r--r--gst-libs/ext/libav/libavutil/audioconvert.c133
-rw-r--r--gst-libs/ext/libav/libavutil/audioconvert.h132
-rw-r--r--gst-libs/ext/libav/libavutil/avstring.c50
-rw-r--r--gst-libs/ext/libav/libavutil/avstring.h16
-rw-r--r--gst-libs/ext/libav/libavutil/avutil.h57
-rw-r--r--gst-libs/ext/libav/libavutil/base64.c6
-rw-r--r--gst-libs/ext/libav/libavutil/blowfish.c597
-rw-r--r--gst-libs/ext/libav/libavutil/blowfish.h76
-rw-r--r--gst-libs/ext/libav/libavutil/channel_layout.c231
-rw-r--r--gst-libs/ext/libav/libavutil/channel_layout.h182
-rw-r--r--gst-libs/ext/libav/libavutil/common.h88
-rw-r--r--gst-libs/ext/libav/libavutil/cpu.c88
-rw-r--r--gst-libs/ext/libav/libavutil/cpu.h30
-rw-r--r--gst-libs/ext/libav/libavutil/crc.c29
-rw-r--r--gst-libs/ext/libav/libavutil/crc.h34
-rw-r--r--gst-libs/ext/libav/libavutil/des.c9
-rw-r--r--gst-libs/ext/libav/libavutil/dict.c13
-rw-r--r--gst-libs/ext/libav/libavutil/dict.h14
-rw-r--r--gst-libs/ext/libav/libavutil/error.c2
-rw-r--r--gst-libs/ext/libav/libavutil/error.h32
-rw-r--r--gst-libs/ext/libav/libavutil/eval.c59
-rw-r--r--gst-libs/ext/libav/libavutil/fifo.c2
-rw-r--r--gst-libs/ext/libav/libavutil/fifo.h12
-rw-r--r--gst-libs/ext/libav/libavutil/file.c26
-rw-r--r--gst-libs/ext/libav/libavutil/file.h2
-rw-r--r--gst-libs/ext/libav/libavutil/float_dsp.c69
-rw-r--r--gst-libs/ext/libav/libavutil/float_dsp.h99
-rw-r--r--gst-libs/ext/libav/libavutil/imgutils.c58
-rw-r--r--gst-libs/ext/libav/libavutil/imgutils.h12
-rw-r--r--gst-libs/ext/libav/libavutil/internal.h122
-rw-r--r--gst-libs/ext/libav/libavutil/intfloat.h12
-rw-r--r--gst-libs/ext/libav/libavutil/intfloat_readwrite.c1
-rw-r--r--gst-libs/ext/libav/libavutil/intmath.c39
-rw-r--r--gst-libs/ext/libav/libavutil/intmath.h129
-rw-r--r--gst-libs/ext/libav/libavutil/intreadwrite.h27
-rw-r--r--gst-libs/ext/libav/libavutil/inverse.c60
-rw-r--r--gst-libs/ext/libav/libavutil/lfg.c6
-rw-r--r--gst-libs/ext/libav/libavutil/lfg.h2
-rw-r--r--gst-libs/ext/libav/libavutil/libavutil.v2
-rw-r--r--gst-libs/ext/libav/libavutil/libm.h75
-rw-r--r--gst-libs/ext/libav/libavutil/log.c18
-rw-r--r--gst-libs/ext/libav/libavutil/log.h11
-rw-r--r--gst-libs/ext/libav/libavutil/log2_tab.c30
-rw-r--r--gst-libs/ext/libav/libavutil/lzo.c193
-rw-r--r--gst-libs/ext/libav/libavutil/lzo.h21
-rw-r--r--gst-libs/ext/libav/libavutil/mathematics.c37
-rw-r--r--gst-libs/ext/libav/libavutil/mathematics.h29
-rw-r--r--gst-libs/ext/libav/libavutil/md5.c9
-rw-r--r--gst-libs/ext/libav/libavutil/md5.h9
-rw-r--r--gst-libs/ext/libav/libavutil/mem.c213
-rw-r--r--gst-libs/ext/libav/libavutil/mem.h53
-rw-r--r--gst-libs/ext/libav/libavutil/mips/intreadwrite.h66
-rw-r--r--gst-libs/ext/libav/libavutil/old_pix_fmts.h128
-rw-r--r--gst-libs/ext/libav/libavutil/opt.c225
-rw-r--r--gst-libs/ext/libav/libavutil/opt.h87
-rw-r--r--gst-libs/ext/libav/libavutil/parseutils.c33
-rw-r--r--gst-libs/ext/libav/libavutil/pixdesc.c552
-rw-r--r--gst-libs/ext/libav/libavutil/pixdesc.h52
-rw-r--r--gst-libs/ext/libav/libavutil/pixfmt.h334
-rw-r--r--gst-libs/ext/libav/libavutil/ppc/Makefile4
-rw-r--r--gst-libs/ext/libav/libavutil/ppc/float_dsp_altivec.c38
-rw-r--r--gst-libs/ext/libav/libavutil/ppc/float_dsp_altivec.h27
-rw-r--r--gst-libs/ext/libav/libavutil/ppc/float_dsp_init.c36
-rw-r--r--gst-libs/ext/libav/libavutil/ppc/types_altivec.h47
-rw-r--r--gst-libs/ext/libav/libavutil/ppc/util_altivec.h118
-rw-r--r--gst-libs/ext/libav/libavutil/random_seed.c23
-rw-r--r--gst-libs/ext/libav/libavutil/rational.c25
-rw-r--r--gst-libs/ext/libav/libavutil/rational.h11
-rw-r--r--gst-libs/ext/libav/libavutil/samplefmt.c108
-rw-r--r--gst-libs/ext/libav/libavutil/samplefmt.h100
-rw-r--r--gst-libs/ext/libav/libavutil/sha.c12
-rw-r--r--gst-libs/ext/libav/libavutil/sha.h12
-rw-r--r--gst-libs/ext/libav/libavutil/time.c68
-rw-r--r--gst-libs/ext/libav/libavutil/time.h39
-rw-r--r--gst-libs/ext/libav/libavutil/timer.h1
-rw-r--r--gst-libs/ext/libav/libavutil/tree.c11
-rw-r--r--gst-libs/ext/libav/libavutil/tree.h12
-rw-r--r--gst-libs/ext/libav/libavutil/version.h87
-rw-r--r--gst-libs/ext/libav/libavutil/x86/Makefile5
-rw-r--r--gst-libs/ext/libav/libavutil/x86/asm.h110
-rw-r--r--gst-libs/ext/libav/libavutil/x86/bswap.h3
-rw-r--r--gst-libs/ext/libav/libavutil/x86/cpu.c164
-rw-r--r--gst-libs/ext/libav/libavutil/x86/cpu.h61
-rw-r--r--gst-libs/ext/libav/libavutil/x86/cpuid.asm91
-rw-r--r--gst-libs/ext/libav/libavutil/x86/float_dsp.asm164
-rw-r--r--gst-libs/ext/libav/libavutil/x86/float_dsp_init.c60
-rw-r--r--gst-libs/ext/libav/libavutil/x86/intmath.h35
-rw-r--r--gst-libs/ext/libav/libavutil/x86/timer.h8
-rw-r--r--gst-libs/ext/libav/libavutil/x86/w64xmmtest.h73
-rw-r--r--gst-libs/ext/libav/libavutil/x86/x86inc.asm610
-rw-r--r--gst-libs/ext/libav/libavutil/x86/x86util.asm192
-rw-r--r--gst-libs/ext/libav/libavutil/x86_cpu.h98
-rw-r--r--gst-libs/ext/libav/libavutil/xtea.c189
-rw-r--r--gst-libs/ext/libav/libavutil/xtea.h61
-rw-r--r--gst-libs/ext/libav/libpostproc/Makefile6
-rw-r--r--gst-libs/ext/libav/libpostproc/libpostproc.v4
-rw-r--r--gst-libs/ext/libav/libpostproc/postprocess.c1071
-rw-r--r--gst-libs/ext/libav/libpostproc/postprocess.h104
-rw-r--r--gst-libs/ext/libav/libpostproc/postprocess_altivec_template.c1210
-rw-r--r--gst-libs/ext/libav/libpostproc/postprocess_internal.h179
-rw-r--r--gst-libs/ext/libav/libpostproc/postprocess_template.c3634
-rw-r--r--gst-libs/ext/libav/library.mak40
-rw-r--r--gst-libs/ext/libav/libswscale/Makefile33
-rw-r--r--gst-libs/ext/libav/libswscale/bfin/Makefile3
-rw-r--r--gst-libs/ext/libav/libswscale/bfin/internal_bfin.S12
-rw-r--r--gst-libs/ext/libav/libswscale/bfin/swscale_bfin.c61
-rw-r--r--gst-libs/ext/libav/libswscale/bfin/yuv2rgb_bfin.c108
-rw-r--r--gst-libs/ext/libav/libswscale/colorspace-test.c4
-rw-r--r--gst-libs/ext/libav/libswscale/input.c1078
-rw-r--r--gst-libs/ext/libav/libswscale/libswscale.v2
-rw-r--r--gst-libs/ext/libav/libswscale/mlib/yuv2rgb_mlib.c89
-rw-r--r--gst-libs/ext/libav/libswscale/options.c58
-rw-r--r--gst-libs/ext/libav/libswscale/output.c1498
-rw-r--r--gst-libs/ext/libav/libswscale/ppc/Makefile3
-rw-r--r--gst-libs/ext/libav/libswscale/ppc/swscale_altivec.c501
-rw-r--r--gst-libs/ext/libav/libswscale/ppc/yuv2rgb_altivec.c1297
-rw-r--r--gst-libs/ext/libav/libswscale/ppc/yuv2rgb_altivec.h4
-rw-r--r--gst-libs/ext/libav/libswscale/ppc/yuv2yuv_altivec.c183
-rw-r--r--gst-libs/ext/libav/libswscale/rgb2rgb.c311
-rw-r--r--gst-libs/ext/libav/libswscale/rgb2rgb_template.c820
-rw-r--r--gst-libs/ext/libav/libswscale/sparc/Makefile1
-rw-r--r--gst-libs/ext/libav/libswscale/sparc/yuv2rgb_vis.c254
-rw-r--r--gst-libs/ext/libav/libswscale/swscale-test.c101
-rw-r--r--gst-libs/ext/libav/libswscale/swscale.c2841
-rw-r--r--gst-libs/ext/libav/libswscale/swscale.h45
-rw-r--r--gst-libs/ext/libav/libswscale/swscale_internal.h220
-rw-r--r--gst-libs/ext/libav/libswscale/swscale_unscaled.c326
-rw-r--r--gst-libs/ext/libav/libswscale/utils.c1636
-rw-r--r--gst-libs/ext/libav/libswscale/version.h56
-rw-r--r--gst-libs/ext/libav/libswscale/x86/Makefile9
-rw-r--r--gst-libs/ext/libav/libswscale/x86/input.asm438
-rw-r--r--gst-libs/ext/libav/libswscale/x86/output.asm121
-rw-r--r--gst-libs/ext/libav/libswscale/x86/rgb2rgb.c40
-rw-r--r--gst-libs/ext/libav/libswscale/x86/rgb2rgb_template.c392
-rw-r--r--gst-libs/ext/libav/libswscale/x86/scale.asm281
-rw-r--r--gst-libs/ext/libav/libswscale/x86/swscale.c493
-rw-r--r--gst-libs/ext/libav/libswscale/x86/swscale_mmx.c458
-rw-r--r--gst-libs/ext/libav/libswscale/x86/swscale_template.c292
-rw-r--r--gst-libs/ext/libav/libswscale/x86/w64xmmtest.c31
-rw-r--r--gst-libs/ext/libav/libswscale/x86/yuv2rgb.c117
-rw-r--r--gst-libs/ext/libav/libswscale/x86/yuv2rgb_mmx.c108
-rw-r--r--gst-libs/ext/libav/libswscale/x86/yuv2rgb_template.c14
-rw-r--r--gst-libs/ext/libav/libswscale/yuv2rgb.c963
-rw-r--r--gst-libs/ext/libav/tests/Makefile118
-rw-r--r--gst-libs/ext/libav/tests/audiogen.c65
-rwxr-xr-xgst-libs/ext/libav/tests/codec-regression.sh435
-rwxr-xr-xgst-libs/ext/libav/tests/fate-run.sh118
-rwxr-xr-xgst-libs/ext/libav/tests/fate.sh1
-rw-r--r--gst-libs/ext/libav/tests/fate/aac.mak46
-rw-r--r--gst-libs/ext/libav/tests/fate/ac3.mak68
-rw-r--r--gst-libs/ext/libav/tests/fate/acodec.mak70
-rw-r--r--gst-libs/ext/libav/tests/fate/adpcm.mak78
-rw-r--r--gst-libs/ext/libav/tests/fate/alac.mak24
-rw-r--r--gst-libs/ext/libav/tests/fate/als.mak2
-rw-r--r--gst-libs/ext/libav/tests/fate/amrnb.mak20
-rw-r--r--gst-libs/ext/libav/tests/fate/amrwb.mak21
-rw-r--r--gst-libs/ext/libav/tests/fate/atrac.mak24
-rw-r--r--gst-libs/ext/libav/tests/fate/audio.mak33
-rw-r--r--gst-libs/ext/libav/tests/fate/avfilter.mak24
-rw-r--r--gst-libs/ext/libav/tests/fate/avformat.mak53
-rw-r--r--gst-libs/ext/libav/tests/fate/bmp.mak43
-rw-r--r--gst-libs/ext/libav/tests/fate/cdxl.mak19
-rw-r--r--gst-libs/ext/libav/tests/fate/cover-art.mak23
-rw-r--r--gst-libs/ext/libav/tests/fate/dct.mak5
-rw-r--r--gst-libs/ext/libav/tests/fate/demux.mak86
-rw-r--r--gst-libs/ext/libav/tests/fate/dfa.mak6
-rw-r--r--gst-libs/ext/libav/tests/fate/dpcm.mak15
-rw-r--r--gst-libs/ext/libav/tests/fate/ea.mak26
-rw-r--r--gst-libs/ext/libav/tests/fate/fft.mak28
-rw-r--r--gst-libs/ext/libav/tests/fate/filter.mak42
-rw-r--r--gst-libs/ext/libav/tests/fate/flac.mak26
-rw-r--r--gst-libs/ext/libav/tests/fate/h264.mak364
-rw-r--r--gst-libs/ext/libav/tests/fate/image.mak27
-rw-r--r--gst-libs/ext/libav/tests/fate/indeo.mak12
-rw-r--r--gst-libs/ext/libav/tests/fate/libavcodec.mak22
-rw-r--r--gst-libs/ext/libav/tests/fate/libavformat.mak6
-rw-r--r--gst-libs/ext/libav/tests/fate/libavutil.mak37
-rw-r--r--gst-libs/ext/libav/tests/fate/lossless-audio.mak17
-rw-r--r--gst-libs/ext/libav/tests/fate/lossless-video.mak37
-rw-r--r--gst-libs/ext/libav/tests/fate/microsoft.mak23
-rw-r--r--gst-libs/ext/libav/tests/fate/mp3.mak18
-rw-r--r--gst-libs/ext/libav/tests/fate/mpc.mak11
-rw-r--r--gst-libs/ext/libav/tests/fate/pcm.mak33
-rw-r--r--gst-libs/ext/libav/tests/fate/probe.mak18
-rw-r--r--gst-libs/ext/libav/tests/fate/prores.mak13
-rw-r--r--gst-libs/ext/libav/tests/fate/qt.mak32
-rw-r--r--gst-libs/ext/libav/tests/fate/qtrle.mak10
-rw-r--r--gst-libs/ext/libav/tests/fate/real.mak22
-rw-r--r--gst-libs/ext/libav/tests/fate/screen.mak15
-rw-r--r--gst-libs/ext/libav/tests/fate/seek.mak231
-rw-r--r--gst-libs/ext/libav/tests/fate/utvideo.mak48
-rw-r--r--gst-libs/ext/libav/tests/fate/vcodec.mak249
-rw-r--r--gst-libs/ext/libav/tests/fate/video.mak203
-rw-r--r--gst-libs/ext/libav/tests/fate/voice.mak63
-rw-r--r--gst-libs/ext/libav/tests/fate/vorbis.mak7
-rw-r--r--gst-libs/ext/libav/tests/fate/vpx.mak47
-rw-r--r--gst-libs/ext/libav/tests/fate/vqf.mak4
-rw-r--r--gst-libs/ext/libav/tests/fate/wavpack.mak92
-rw-r--r--gst-libs/ext/libav/tests/fate/wma.mak48
-rwxr-xr-xgst-libs/ext/libav/tests/lavf-regression.sh50
-rwxr-xr-xgst-libs/ext/libav/tests/lavfi-regression.sh14
-rw-r--r--gst-libs/ext/libav/tests/md5.sh6
-rw-r--r--gst-libs/ext/libav/tests/ref/acodec/ac3_fixed2
-rw-r--r--gst-libs/ext/libav/tests/ref/acodec/adpcm-adx4
-rw-r--r--gst-libs/ext/libav/tests/ref/acodec/adpcm-ima_qt4
-rw-r--r--gst-libs/ext/libav/tests/ref/acodec/adpcm-ima_wav4
-rw-r--r--gst-libs/ext/libav/tests/ref/acodec/adpcm-ms4
-rw-r--r--gst-libs/ext/libav/tests/ref/acodec/adpcm-swf4
-rw-r--r--gst-libs/ext/libav/tests/ref/acodec/adpcm-yamaha4
-rw-r--r--gst-libs/ext/libav/tests/ref/acodec/adpcm_adx4
-rw-r--r--gst-libs/ext/libav/tests/ref/acodec/adpcm_ima_qt4
-rw-r--r--gst-libs/ext/libav/tests/ref/acodec/adpcm_ima_wav4
-rw-r--r--gst-libs/ext/libav/tests/ref/acodec/adpcm_ms4
-rw-r--r--gst-libs/ext/libav/tests/ref/acodec/adpcm_swf4
-rw-r--r--gst-libs/ext/libav/tests/ref/acodec/adpcm_yam4
-rw-r--r--gst-libs/ext/libav/tests/ref/acodec/alac6
-rw-r--r--gst-libs/ext/libav/tests/ref/acodec/aref2
-rw-r--r--gst-libs/ext/libav/tests/ref/acodec/flac6
-rw-r--r--gst-libs/ext/libav/tests/ref/acodec/g7224
-rw-r--r--gst-libs/ext/libav/tests/ref/acodec/g7264
-rw-r--r--gst-libs/ext/libav/tests/ref/acodec/mp29
-rw-r--r--gst-libs/ext/libav/tests/ref/acodec/pcm-alaw4
-rw-r--r--gst-libs/ext/libav/tests/ref/acodec/pcm-f32be4
-rw-r--r--gst-libs/ext/libav/tests/ref/acodec/pcm-f32le4
-rw-r--r--gst-libs/ext/libav/tests/ref/acodec/pcm-f64be4
-rw-r--r--gst-libs/ext/libav/tests/ref/acodec/pcm-f64le4
-rw-r--r--gst-libs/ext/libav/tests/ref/acodec/pcm-mulaw4
-rw-r--r--gst-libs/ext/libav/tests/ref/acodec/pcm-s16be4
-rw-r--r--gst-libs/ext/libav/tests/ref/acodec/pcm-s16le4
-rw-r--r--gst-libs/ext/libav/tests/ref/acodec/pcm-s24be4
-rw-r--r--gst-libs/ext/libav/tests/ref/acodec/pcm-s24le4
-rw-r--r--gst-libs/ext/libav/tests/ref/acodec/pcm-s32be4
-rw-r--r--gst-libs/ext/libav/tests/ref/acodec/pcm-s32le4
-rw-r--r--gst-libs/ext/libav/tests/ref/acodec/pcm-s84
-rw-r--r--gst-libs/ext/libav/tests/ref/acodec/pcm-u84
-rw-r--r--gst-libs/ext/libav/tests/ref/acodec/pcm_alaw4
-rw-r--r--gst-libs/ext/libav/tests/ref/acodec/pcm_f32be4
-rw-r--r--gst-libs/ext/libav/tests/ref/acodec/pcm_f32le4
-rw-r--r--gst-libs/ext/libav/tests/ref/acodec/pcm_f64be4
-rw-r--r--gst-libs/ext/libav/tests/ref/acodec/pcm_f64le4
-rw-r--r--gst-libs/ext/libav/tests/ref/acodec/pcm_mulaw4
-rw-r--r--gst-libs/ext/libav/tests/ref/acodec/pcm_s16be4
-rw-r--r--gst-libs/ext/libav/tests/ref/acodec/pcm_s16le4
-rw-r--r--gst-libs/ext/libav/tests/ref/acodec/pcm_s24be4
-rw-r--r--gst-libs/ext/libav/tests/ref/acodec/pcm_s24daud4
-rw-r--r--gst-libs/ext/libav/tests/ref/acodec/pcm_s24le4
-rw-r--r--gst-libs/ext/libav/tests/ref/acodec/pcm_s32be4
-rw-r--r--gst-libs/ext/libav/tests/ref/acodec/pcm_s32le4
-rw-r--r--gst-libs/ext/libav/tests/ref/acodec/pcm_s84
-rw-r--r--gst-libs/ext/libav/tests/ref/acodec/pcm_u84
-rw-r--r--gst-libs/ext/libav/tests/ref/acodec/wmav14
-rw-r--r--gst-libs/ext/libav/tests/ref/acodec/wmav24
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/4xm-131
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/4xm-2349
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/8bps72
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/aasc47
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/adpcm-ea-126
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/adpcm-ea-2134
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/adpcm-ea-mad-ea-r1191
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/adpcm-ea-maxis-xa31
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/adpcm-ea-r196
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/adpcm-ea-tqi51
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/adpcm-ima-amv161
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/adpcm-ima-apc (renamed from gst-libs/ext/libav/tests/ref/fate/cryo-apc)0
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/adpcm-ima-dk32
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/adpcm-ima-ea-eacs48
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/adpcm-ima-ea-sead50
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/adpcm-ima-iss (renamed from gst-libs/ext/libav/tests/ref/fate/funcom-iss)0
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/adpcm-ima-smjpeg351
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/adpcm-ima-ws41
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/adpcm-ms-mono46
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/adpcm-psx-str-v337
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/adpcm-thp215
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/adpcm-xa38
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/alg-mm63
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/amv481
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/ansi35
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/armovie-escape124210
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/auravision-v149
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/auravision-v25
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/avstring27
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/bethsoft-vid286
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/bfi230
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/bink-video20
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/bink-video-b31
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/bink-video-f21
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/bink-video-i32
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/blowfish1
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/bmp-15bit2
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/bmp-15bit-mask2
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/bmp-16bit-mask2
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/bmp-1bit2
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/bmp-24bit2
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/bmp-32bit2
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/bmp-32bit-mask2
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/bmp-4bit2
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/bmp-4bit-os22
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/bmp-8bit2
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/bmp-8bit-os22
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/bmp-rle42
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/bmp-rle82
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/bmv42
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/bmv-audio22
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/bmv-video22
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/caf2
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/cavs171
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/cdgraphics601
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/cdxl-bitline-ham611
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/cdxl-demux21
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/cdxl-ham617
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/cdxl-ham82
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/cdxl-pal812
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/cdxl-pal8-small47
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/cljr73
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/cllc-argb5
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/cllc-rgb15
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/corepng76
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/crc8
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/creatureshock-avs186
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/cscd417
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/cvid-grayscale305
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/cvid-palette113
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/cvid-partial157
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/cyberia-c9386
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/cyuv301
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/d-cinema-demux9
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/dcinema-encode1
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/delphine-cin183
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/delphine-cin-audio92
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/delphine-cin-video93
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/deluxepaint-anm247
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/dfa151
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/dfa1017
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/dfa1119
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/dfa235
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/dfa321
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/dfa427
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/dfa531
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/dfa625
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/dfa725
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/dfa873
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/dfa913
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/dpcm-idroq545
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/dpcm-interplay125
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/dpx3
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/dxa-feeble85
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/dxa-scummvm25
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/dxtory4
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/ea-cmv389
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/ea-dct267
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/ea-mad97
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/ea-mad-pcm-planar292
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/ea-tgq557
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/ea-tgv-148
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/ea-tgv-239
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/ea-tgv-ima-ea-eacs94
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/ea-tgv-ima-ea-sead87
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/ea-tqi27
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/ea-vp60133
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/ea-vp61120
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/eval42
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/film-cvid111
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/film-cvid-pcm-stereo-8bit139
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/filter-delogo110
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/filter-yadif-mode032
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/filter-yadif-mode163
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/flic-af11-palette-change233
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/flic-af1255
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/flic-magiccarpet85
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/fraps-v041
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/fraps-v13
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/fraps-v221
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/fraps-v319
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/fraps-v415
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/fraps-v5117
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/frwu21
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/g722-encode1
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/g722dec-1335
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/g722enc1
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/g723_1-dec-13
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/g723_1-dec-227
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/g723_1-dec-334
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/g723_1-dec-45
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/g723_1-dec-5101
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/g723_1-dec-6101
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/g723_1-dec-712
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/g723_1-dec-8121
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/g726-encode-2bit1
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/g726-encode-3bit1
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/g726-encode-4bit1
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/g726-encode-5bit1
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/gsm-ms179
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/gsm-toast1001
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-aud_mw_e201
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-ba1_ft_c599
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-ba1_sony_d35
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-ba2_sony_f601
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-ba3_sva_c67
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-ba_mw_d201
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-bamq1_jvc_c61
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-bamq2_jvc_c61
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-banm_mw_d201
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-basqp1_sony_c9
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-caba1_sony_d101
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-caba1_sva_b35
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-caba2_sony_e601
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-caba2_sva_b35
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-caba3_sony_c601
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-caba3_sva_b67
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-caba3_toshiba_e601
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-cabac_mot_fld0_full61
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-cabac_mot_frm0_full61
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-cabac_mot_mbaff0_full61
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-cabac_mot_picaff0_full61
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-cabaci3_sony_b601
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-cabast3_sony_e51
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-cabastbr3_sony_b51
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-cabref3_sand_d101
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-cacqp3_sony_d101
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-cafi1_sva_c67
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-cama1_sony_c11
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-cama1_toshiba_b181
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-cama1_vtc_c9
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-cama2_vtc_b9
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-cama3_sand_e101
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-cama3_vtc_b9
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-camaci3_sony_c35
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-camanl1_toshiba_b181
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-camanl2_toshiba_b181
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-camanl3_sand_e101
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-camasl3_sony_b35
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-camp_mot_mbaff_l3061
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-camp_mot_mbaff_l3161
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-canl1_sony_e101
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-canl1_sva_b35
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-canl1_toshiba_g601
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-canl2_sony_e601
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-canl2_sva_b35
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-canl3_sony_c601
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-canl3_sva_b35
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-canl4_sva_b67
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-canlma2_sony_c35
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-canlma3_sony_c35
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-capa1_toshiba_b181
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-capama3_sand_f101
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-capcm1_sand_e61
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-capcmnl1_sand_e61
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-capm3_sony_d601
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-caqp1_sony_b101
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-cavlc_mot_fld0_full_b61
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-cavlc_mot_frm0_full_b61
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-cavlc_mot_mbaff0_full_b61
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-cavlc_mot_picaff0_full_b61
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-cawp1_toshiba_e181
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-cawp5_toshiba_e181
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-ci1_ft_b583
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-ci_mw_d201
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvbs3_sony_c601
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvcanlma2_sony_c35
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvfi1_sony_d35
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvfi1_sva_c15
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvfi2_sony_h35
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvfi2_sva_c27
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvma1_sony_d11
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvma1_toshiba_b181
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvmanl1_toshiba_b181
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvmanl2_toshiba_b181
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvmapaqp3_sony_e17
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvmaqp2_sony_g35
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvmaqp3_sony_d35
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvmp_mot_fld_l30_b61
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvmp_mot_frm_l31_b61
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvnlfi1_sony_c35
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvnlfi2_sony_h35
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvpa1_toshiba_b181
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvpcmnl1_sva_c61
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvpcmnl2_sva_c5
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvwp1_toshiba_e181
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvwp2_toshiba_e181
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvwp3_toshiba_e181
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvwp5_toshiba_e181
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-fi1_sony_e35
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-alphaconformanceg87
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-bcrm_freh10201
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-brcm_freh11201
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-brcm_freh3201
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-brcm_freh4201
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-brcm_freh5201
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-brcm_freh8201
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-brcm_freh9201
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-freh12_b201
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-freh1_b201
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-freh2_b201
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-freh6201
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-freh7_b201
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-frext01_jvc_d33
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-frext02_jvc_c33
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-frext1_panasonic_c17
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-frext2_panasonic_b31
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-frext3_panasonic_d23
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-frext4_panasonic_a21
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-frext_mmco4_sony_b121
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-hcaff1_hhi_b21
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-hcafr1_hhi_c21
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-hcafr2_hhi_a21
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-hcafr3_hhi_a21
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-hcafr4_hhi_a21
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-hcamff1_hhi_b21
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-hpca_brcm_c601
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-hpcadq_brcm_b601
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-hpcafl_bcrm_c601
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-hpcaflnl_bcrm_c601
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-hpcalq_brcm_b601
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-hpcamapalq_bcrm_b601
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-hpcamolq_brcm_b201
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-hpcanl_brcm_c601
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-hpcaq2lq_brcm_b201
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-hpcv_brcm_a601
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-hpcvfl_bcrm_a601
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-hpcvflnl_bcrm_a601
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-hpcvmolq_brcm_b201
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-hpcvnl_brcm_a601
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-pph10i1_panasonic_a21
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-pph10i2_panasonic_a21
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-pph10i3_panasonic_a21
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-pph10i4_panasonic_a21
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-pph10i5_panasonic_a21
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-pph10i6_panasonic_a21
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-pph10i7_panasonic_a21
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-hcbp2_hhi_a501
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-hcmp1_hhi_a501
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-ls_sva_d3401
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-midr_mw_d201
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-mps_mw_a301
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-mr1_bt_a125
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-mr1_mw_a301
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-mr2_mw_a601
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-mr2_tandberg_e601
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-mr3_tandberg_b601
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-mr4_tandberg_c601
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-mr5_tandberg_c601
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-mr6_bt_b121
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-mr7_bt_b121
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-mr8_bt_b117
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-mr9_bt_b117
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-mv1_brcm_d515
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-nl1_sony_d35
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-nl2_sony_h601
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-nl3_sva_e67
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-nlmq1_jvc_c61
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-nlmq2_jvc_c61
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-nrf_mw_e201
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-sharp_mp_field_1_b31
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-sharp_mp_field_2_b31
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-sharp_mp_field_3_b31
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-sharp_mp_paff_1r231
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-sharp_mp_paff_2r31
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-sl1_sva_b67
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-sva_ba1_b35
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-sva_ba2_d35
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-sva_base_b35
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-sva_cl1_e101
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-sva_fm1_e35
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-sva_nl1_b35
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-conformance-sva_nl2_e35
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-extreme-plane-pred201
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-interlace-crop7
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/h264-lossless21
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/id-cin-video212
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/idroq-video-encode2
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/iff-byterun13
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/iff-ilbm3
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/indeo2261
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/indeo381
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/indeo4201
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/indeo5269
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/interplay-mve-16bit180
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/interplay-mve-8bit345
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/iv8-demux51
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/kgv1314
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/kmvc151
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/lagarith-rgb245
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/lagarith-rgb3226
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/lagarith-yuy22
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/lagarith-yv123
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/lmlm4-demux432
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/loco-rgb11
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/loco-yuy27
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/lossless-wavpack1
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/lossless-wma1
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/maxis-xa32
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/mdec135
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/mdec-v360
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/mimic153
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/mjpegb21
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/motionpixels223
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/mpeg2-field-enc63
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/msmpeg4v1101
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/msrle-8bit59
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/msvideo1-16bit61
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/msvideo1-8bit63
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/mszh3
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/mtv273
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/mxf-demux196
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/nc-demux183
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/nsv-demux344
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/nuv27
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/nuv-rtjpeg10
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/nuv-rtjpeg-fh51
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/parseutils45
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/pcm-planar143
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/pcm_dvd247
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/pictor3
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/prores-4225
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/prores-422_hq5
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/prores-422_lt5
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/prores-422_proxy5
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/prores-alpha5
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/psx-str200
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/psx-str-demux202
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/psx-str-v3-mdec59
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/ptx3
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/pva-demux51
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/qpeg201
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/qtrle-16bit167
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/qtrle-1bit146
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/qtrle-24bit69
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/qtrle-2bit146
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/qtrle-32bit53
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/qtrle-4bit77
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/qtrle-8bit335
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/quickdraw5
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/r2107
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/ra-144 (renamed from gst-libs/ext/libav/tests/ref/fate/real-14_4)0
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/ralf1
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/real-rv40240
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/redcode-demux12
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/rl2217
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/roqvideo211
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/rpza61
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/rv30219
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/rv40240
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/sierra-vmd332
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/sierra-vmd-audio216
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/sierra-vmd-video118
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/siff80
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/smacker186
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/smacker-audio87
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/smacker-video101
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/smc241
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/smjpeg423
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/smjpeg-demux425
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/sp5x40
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/sunraster-1bit-raw3
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/sunraster-1bit-rle3
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/sunraster-24bit-raw3
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/sunraster-24bit-rle3
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/sunraster-8bit-raw3
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/sunraster-8bit-rle3
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/sunraster-8bit_gray-raw2
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/svq1301
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/svq3361
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/targa-conformance-CBW83
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/targa-conformance-CCM83
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/targa-conformance-CTC163
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/targa-conformance-CTC243
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/targa-conformance-CTC323
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/targa-conformance-UBW83
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/targa-conformance-UCM83
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/targa-conformance-UTC163
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/targa-conformance-UTC243
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/targa-conformance-UTC323
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/targa-top-to-bottom3
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/thp73
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/tiertex-seq198
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/tiff-fax-g33
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/tiff-fax-g3s3
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/tmv442
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/truemotion1-15324
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/truemotion1-2459
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/truemotion261
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/tscc-15bit482
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/tscc-32bit313
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/txd-16bpp23
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/txd-pal83
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/ulti125
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/url13
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/utvideo_rgb_left9
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/utvideo_rgb_median11
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/utvideo_rgba_left11
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/utvideo_rgba_median11
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/utvideo_rgba_single_symbol2
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/utvideo_yuv420_left15
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/utvideo_yuv420_median9
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/utvideo_yuv422_left9
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/utvideo_yuv422_median9
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/utvideoenc_rgb_left51
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/utvideoenc_rgb_median51
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/utvideoenc_rgb_none51
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/utvideoenc_rgba_left51
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/utvideoenc_rgba_median51
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/utvideoenc_rgba_none51
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/utvideoenc_yuv420_left51
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/utvideoenc_yuv420_median51
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/utvideoenc_yuv420_none51
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/utvideoenc_yuv422_left51
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/utvideoenc_yuv422_median51
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/utvideoenc_yuv422_none51
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/v2103
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/v410dec3
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/v410enc2
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/vble9
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/vc1-ism241
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/vc1_sa0004031
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/vc1_sa0005061
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/vc1_sa1009161
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/vc1_sa1014331
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/vc1_sa20021121
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/vcr1257
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/videoxl81
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/vmnc-16bit385
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/vmnc-32bit99
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/vp3-coeff-level6417
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/vp31229
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/vp5493
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/vp60134
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/vp61121
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/vp6a187
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/vp6f349
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/vp8-sign-bias18
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/vp8-size-change31
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/vp8-test-vector-00159
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/vp8-test-vector-00299
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/vp8-test-vector-00399
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/vp8-test-vector-00459
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/vp8-test-vector-00599
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/vp8-test-vector-00697
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/vp8-test-vector-00759
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/vp8-test-vector-0085
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/vp8-test-vector-00999
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/vp8-test-vector-010115
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/vp8-test-vector-01159
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/vp8-test-vector-01259
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/vp8-test-vector-01359
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/vp8-test-vector-01499
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/vp8-test-vector-015521
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/vp8-test-vector-01659
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/vp8-test-vector-01759
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/vqa-cc117
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/vqf-demux2
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/wavpack-channels-4.01
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/wavpack-channels-5.11
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/wavpack-channels-6.11
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/wavpack-channels-7.11
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/wavpack-channels-monofloat1
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/wavpack-channels-monoint1
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/wavpack-clipping1
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/wavpack-cuesheet1
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/wavpack-falsestereo1
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/wavpack-lossless-12bit1
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/wavpack-lossless-16bit1
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/wavpack-lossless-24bit1
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/wavpack-lossless-32bit1
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/wavpack-lossless-8bit1
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/wavpack-lossless-float1
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/wavpack-lossy-16bit1
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/wavpack-lossy-24bit1
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/wavpack-lossy-32bit1
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/wavpack-lossy-8bit1
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/wavpack-lossy-float1
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/wavpack-matroskamode1
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/wavpack-speed-default1
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/wavpack-speed-fast1
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/wavpack-speed-high1
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/wavpack-speed-vhigh1
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/wavpack-zerolsbs1
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/wc3movie-xan142
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/westwood-aud13
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/wmv8-drm261
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/wmv8-drm-nodec302
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/wnv1173
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/wtv-demux280
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/xmv-demux364
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/xtea1
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/xxan-wc443
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/yop14
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/zerocodec39
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/zlib3
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/zmbv-15bit319
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/zmbv-16bit319
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/zmbv-32bit319
-rw-r--r--gst-libs/ext/libav/tests/ref/fate/zmbv-8bit551
-rw-r--r--gst-libs/ext/libav/tests/ref/lavf/asf4
-rw-r--r--gst-libs/ext/libav/tests/ref/lavf/avi6
-rw-r--r--gst-libs/ext/libav/tests/ref/lavf/dpx3
-rw-r--r--gst-libs/ext/libav/tests/ref/lavf/dv_fmt4
-rw-r--r--gst-libs/ext/libav/tests/ref/lavf/ffm4
-rw-r--r--gst-libs/ext/libav/tests/ref/lavf/gxf4
-rw-r--r--gst-libs/ext/libav/tests/ref/lavf/mkv6
-rw-r--r--gst-libs/ext/libav/tests/ref/lavf/mov4
-rw-r--r--gst-libs/ext/libav/tests/ref/lavf/mpg4
-rw-r--r--gst-libs/ext/libav/tests/ref/lavf/mxf4
-rw-r--r--gst-libs/ext/libav/tests/ref/lavf/mxf_d104
-rw-r--r--gst-libs/ext/libav/tests/ref/lavf/nut6
-rw-r--r--gst-libs/ext/libav/tests/ref/lavf/ogg6
-rw-r--r--gst-libs/ext/libav/tests/ref/lavf/pam3
-rw-r--r--gst-libs/ext/libav/tests/ref/lavf/rm4
-rw-r--r--gst-libs/ext/libav/tests/ref/lavf/rso3
-rw-r--r--gst-libs/ext/libav/tests/ref/lavf/sox3
-rw-r--r--gst-libs/ext/libav/tests/ref/lavf/sunrast3
-rw-r--r--gst-libs/ext/libav/tests/ref/lavf/ts6
-rw-r--r--gst-libs/ext/libav/tests/ref/lavf/voc6
-rw-r--r--gst-libs/ext/libav/tests/ref/lavf/voc_s166
-rw-r--r--gst-libs/ext/libav/tests/ref/lavf/xwd3
-rw-r--r--gst-libs/ext/libav/tests/ref/lavfi/crop_scale_vflip2
-rw-r--r--gst-libs/ext/libav/tests/ref/lavfi/pixdesc20
-rw-r--r--gst-libs/ext/libav/tests/ref/lavfi/pixfmts_copy20
-rw-r--r--gst-libs/ext/libav/tests/ref/lavfi/pixfmts_null20
-rw-r--r--gst-libs/ext/libav/tests/ref/lavfi/pixfmts_scale20
-rw-r--r--gst-libs/ext/libav/tests/ref/lavfi/pixfmts_vflip20
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/ac3_rm44
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/acodec-adpcm-ima_qt53
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/acodec-adpcm-ima_wav (renamed from gst-libs/ext/libav/tests/ref/seek/adpcm_ima_wav)0
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/acodec-adpcm-ms (renamed from gst-libs/ext/libav/tests/ref/seek/adpcm_ms_wav)0
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/acodec-adpcm-swf (renamed from gst-libs/ext/libav/tests/ref/seek/adpcm_swf_flv)0
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/acodec-adpcm-yamaha (renamed from gst-libs/ext/libav/tests/ref/seek/adpcm_yam_wav)0
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/acodec-alac53
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/acodec-flac (renamed from gst-libs/ext/libav/tests/ref/seek/flac_flac)0
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/acodec-mp249
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/acodec-pcm-alaw53
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/acodec-pcm-f32be (renamed from gst-libs/ext/libav/tests/ref/seek/pcm_f32be_au)0
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/acodec-pcm-f32le (renamed from gst-libs/ext/libav/tests/ref/seek/pcm_f32le_wav)0
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/acodec-pcm-f64be (renamed from gst-libs/ext/libav/tests/ref/seek/pcm_f64be_au)0
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/acodec-pcm-f64le (renamed from gst-libs/ext/libav/tests/ref/seek/pcm_f64le_wav)0
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/acodec-pcm-mulaw53
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/acodec-pcm-s16be (renamed from gst-libs/ext/libav/tests/ref/seek/pcm_s16be_mov)0
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/acodec-pcm-s16le (renamed from gst-libs/ext/libav/tests/ref/seek/pcm_s16le_wav)0
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/acodec-pcm-s24be (renamed from gst-libs/ext/libav/tests/ref/seek/pcm_s24be_mov)0
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/acodec-pcm-s24le (renamed from gst-libs/ext/libav/tests/ref/seek/pcm_s24le_wav)0
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/acodec-pcm-s32be (renamed from gst-libs/ext/libav/tests/ref/seek/pcm_s32be_mov)0
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/acodec-pcm-s32le (renamed from gst-libs/ext/libav/tests/ref/seek/pcm_s32le_wav)0
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/acodec-pcm-s8 (renamed from gst-libs/ext/libav/tests/ref/seek/pcm_s8_mov)0
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/acodec-pcm-u8 (renamed from gst-libs/ext/libav/tests/ref/seek/pcm_u8_wav)0
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/adpcm_qt_aiff53
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/alac_m4a53
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/asv1_avi46
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/asv2_avi46
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/dnxhd_720p_dnxhd40
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/dnxhd_720p_rd_dnxhd40
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/error_mpeg4_adv_avi46
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/ffv1_avi46
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/g726_wav53
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/h261_avi46
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/h263_avi46
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/h263p_avi46
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/huffyuv_avi46
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/jpegls_avi46
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/lavf-aiff (renamed from gst-libs/ext/libav/tests/ref/seek/lavf_aif)0
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/lavf-alaw (renamed from gst-libs/ext/libav/tests/ref/seek/lavf_al)0
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/lavf-asf53
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/lavf-au (renamed from gst-libs/ext/libav/tests/ref/seek/lavf_au)0
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/lavf-avi44
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/lavf-bmp (renamed from gst-libs/ext/libav/tests/ref/seek/image_bmp)0
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/lavf-dv_fmt (renamed from gst-libs/ext/libav/tests/ref/seek/lavf_dv)0
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/lavf-ffm53
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/lavf-flv_fmt (renamed from gst-libs/ext/libav/tests/ref/seek/lavf_flv)0
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/lavf-gif (renamed from gst-libs/ext/libav/tests/ref/seek/lavf_gif)0
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/lavf-gxf (renamed from gst-libs/ext/libav/tests/ref/seek/lavf_gxf)0
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/lavf-jpg (renamed from gst-libs/ext/libav/tests/ref/seek/image_jpg)0
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/lavf-mkv53
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/lavf-mmf (renamed from gst-libs/ext/libav/tests/ref/seek/lavf_mmf)0
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/lavf-mov (renamed from gst-libs/ext/libav/tests/ref/seek/lavf_mov)0
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/lavf-mpg53
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/lavf-mulaw (renamed from gst-libs/ext/libav/tests/ref/seek/lavf_ul)0
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/lavf-mxf48
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/lavf-mxf_d1053
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/lavf-nut (renamed from gst-libs/ext/libav/tests/ref/seek/lavf_nut)0
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/lavf-ogg (renamed from gst-libs/ext/libav/tests/ref/seek/lavf_ogg)0
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/lavf-pbmpipe (renamed from gst-libs/ext/libav/tests/ref/seek/pbmpipe_pbm)0
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/lavf-pcx (renamed from gst-libs/ext/libav/tests/ref/seek/image_pcx)0
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/lavf-pgm (renamed from gst-libs/ext/libav/tests/ref/seek/image_pgm)0
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/lavf-pgmpipe (renamed from gst-libs/ext/libav/tests/ref/seek/pgmpipe_pgm)0
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/lavf-ppm (renamed from gst-libs/ext/libav/tests/ref/seek/image_ppm)0
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/lavf-ppmpipe (renamed from gst-libs/ext/libav/tests/ref/seek/ppmpipe_ppm)0
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/lavf-rm53
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/lavf-sgi (renamed from gst-libs/ext/libav/tests/ref/seek/image_sgi)0
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/lavf-swf (renamed from gst-libs/ext/libav/tests/ref/seek/lavf_swf)0
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/lavf-tga (renamed from gst-libs/ext/libav/tests/ref/seek/image_tga)0
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/lavf-tiff (renamed from gst-libs/ext/libav/tests/ref/seek/image_tiff)0
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/lavf-ts53
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/lavf-voc27
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/lavf-wav (renamed from gst-libs/ext/libav/tests/ref/seek/lavf_wav)0
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/lavf-yuv4mpeg (renamed from gst-libs/ext/libav/tests/ref/seek/lavf_y4m)0
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/lavf_asf47
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/lavf_avi44
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/lavf_ffm53
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/lavf_mkv53
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/lavf_mpg53
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/lavf_mxf53
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/lavf_mxf_d1053
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/lavf_rm47
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/lavf_ts53
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/lavf_voc27
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/ljpeg_avi46
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/mjpeg_avi46
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/mp2_mp253
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/mpeg1_mpg46
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/mpeg1b_mpg46
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/mpeg2_422_mpg46
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/mpeg2_idct_int_mpg46
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/mpeg2i_mpg46
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/mpeg2ivlc_qprd_mpg46
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/mpeg2thread_mpg46
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/mpeg2threadivlc_mpg46
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/mpeg4_Q_avi46
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/mpeg4_adap_avi46
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/mpeg4_adv_avi46
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/mpeg4_nr_avi46
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/mpeg4_qprd_avi46
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/mpeg4_rc_avi46
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/mpeg4_thread_avi46
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/msmpeg4_avi46
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/msmpeg4v2_avi46
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/pcm_alaw_wav53
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/pcm_mulaw_wav53
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/pcm_s24daud_30227
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/rgb_avi46
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/snow53_avi46
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/snow_avi46
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/vsynth2-asv146
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/vsynth2-asv246
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/vsynth2-dnxhd-1080i (renamed from gst-libs/ext/libav/tests/ref/seek/dnxhd_1080i_mov)0
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/vsynth2-dnxhd-720p40
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/vsynth2-dnxhd-720p-rd40
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/vsynth2-dv (renamed from gst-libs/ext/libav/tests/ref/seek/dv411_dv)0
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/vsynth2-dv-411 (renamed from gst-libs/ext/libav/tests/ref/seek/dv_dv)0
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/vsynth2-dv-50 (renamed from gst-libs/ext/libav/tests/ref/seek/dv50_dv)0
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/vsynth2-ffv146
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/vsynth2-flashsv (renamed from gst-libs/ext/libav/tests/ref/seek/flashsv_flv)0
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/vsynth2-flv (renamed from gst-libs/ext/libav/tests/ref/seek/flv_flv)0
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/vsynth2-h26146
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/vsynth2-h26346
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/vsynth2-h263p46
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/vsynth2-huffyuv46
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/vsynth2-jpegls46
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/vsynth2-ljpeg46
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/vsynth2-mjpeg46
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/vsynth2-mpeg146
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/vsynth2-mpeg1b46
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/vsynth2-mpeg2-42246
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/vsynth2-mpeg2-idct-int46
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/vsynth2-mpeg2-ilace46
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/vsynth2-mpeg2-ivlc-qprd46
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/vsynth2-mpeg2-thread46
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/vsynth2-mpeg2-thread-ivlc46
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/vsynth2-mpeg4 (renamed from gst-libs/ext/libav/tests/ref/seek/odivx_mp4)0
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/vsynth2-mpeg4-adap46
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/vsynth2-mpeg4-adv46
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/vsynth2-mpeg4-error46
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/vsynth2-mpeg4-nr46
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/vsynth2-mpeg4-qpel46
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/vsynth2-mpeg4-qprd46
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/vsynth2-mpeg4-rc46
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/vsynth2-mpeg4-thread46
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/vsynth2-msmpeg446
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/vsynth2-msmpeg4v246
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/vsynth2-rgb46
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/vsynth2-roqvideo (renamed from gst-libs/ext/libav/tests/ref/seek/roqav_roq)0
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/vsynth2-rv10 (renamed from gst-libs/ext/libav/tests/ref/seek/rv10_rm)0
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/vsynth2-rv20 (renamed from gst-libs/ext/libav/tests/ref/seek/rv20_rm)0
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/vsynth2-snow46
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/vsynth2-snow-ll46
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/vsynth2-svq1 (renamed from gst-libs/ext/libav/tests/ref/seek/svq1_mov)0
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/vsynth2-wmv146
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/vsynth2-wmv246
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/vsynth2-yuv46
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/wmav1_asf53
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/wmav2_asf53
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/wmv1_avi46
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/wmv2_avi46
-rw-r--r--gst-libs/ext/libav/tests/ref/seek/yuv_avi46
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth/vsynth1-asv14
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth/vsynth1-asv24
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth/vsynth1-cljr4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth/vsynth1-dnxhd-1080i4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth/vsynth1-dnxhd-720p4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth/vsynth1-dnxhd-720p-10bit4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth/vsynth1-dnxhd-720p-rd4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth/vsynth1-dv4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth/vsynth1-dv-4114
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth/vsynth1-dv-504
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth/vsynth1-ffv14
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth/vsynth1-ffvhuff4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth/vsynth1-flashsv4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth/vsynth1-flv4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth/vsynth1-h2614
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth/vsynth1-h2634
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth/vsynth1-h263-obmc4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth/vsynth1-h263p4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth/vsynth1-huffyuv4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth/vsynth1-jpegls4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth/vsynth1-ljpeg4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth/vsynth1-mjpeg4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth/vsynth1-mpeg14
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth/vsynth1-mpeg1b4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth/vsynth1-mpeg24
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth/vsynth1-mpeg2-4224
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth/vsynth1-mpeg2-idct-int4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth/vsynth1-mpeg2-ilace4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth/vsynth1-mpeg2-ivlc-qprd4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth/vsynth1-mpeg2-thread4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth/vsynth1-mpeg2-thread-ivlc4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth/vsynth1-mpeg44
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth/vsynth1-mpeg4-adap4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth/vsynth1-mpeg4-adv4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth/vsynth1-mpeg4-error4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth/vsynth1-mpeg4-nr4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth/vsynth1-mpeg4-qpel4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth/vsynth1-mpeg4-qprd4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth/vsynth1-mpeg4-rc4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth/vsynth1-mpeg4-thread4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth/vsynth1-msmpeg44
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth/vsynth1-msmpeg4v24
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth/vsynth1-prores4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth/vsynth1-qtrle4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth/vsynth1-rgb4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth/vsynth1-roqvideo4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth/vsynth1-rv104
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth/vsynth1-rv204
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth/vsynth1-snow4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth/vsynth1-snow-hpel4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth/vsynth1-snow-ll4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth/vsynth1-svq14
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth/vsynth1-v2104
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth/vsynth1-wmv14
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth/vsynth1-wmv24
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth/vsynth1-yuv4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth/vsynth2-asv14
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth/vsynth2-asv24
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth/vsynth2-cljr4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth/vsynth2-dnxhd-1080i4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth/vsynth2-dnxhd-720p4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth/vsynth2-dnxhd-720p-10bit4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth/vsynth2-dnxhd-720p-rd4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth/vsynth2-dv4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth/vsynth2-dv-4114
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth/vsynth2-dv-504
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth/vsynth2-ffv14
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth/vsynth2-ffvhuff4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth/vsynth2-flashsv4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth/vsynth2-flv4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth/vsynth2-h2614
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth/vsynth2-h2634
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth/vsynth2-h263-obmc4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth/vsynth2-h263p4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth/vsynth2-huffyuv4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth/vsynth2-jpegls4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth/vsynth2-ljpeg4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth/vsynth2-mjpeg4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth/vsynth2-mpeg14
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth/vsynth2-mpeg1b4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth/vsynth2-mpeg24
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth/vsynth2-mpeg2-4224
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth/vsynth2-mpeg2-idct-int4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth/vsynth2-mpeg2-ilace4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth/vsynth2-mpeg2-ivlc-qprd4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth/vsynth2-mpeg2-thread4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth/vsynth2-mpeg2-thread-ivlc4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth/vsynth2-mpeg44
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth/vsynth2-mpeg4-adap4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth/vsynth2-mpeg4-adv4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth/vsynth2-mpeg4-error4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth/vsynth2-mpeg4-nr4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth/vsynth2-mpeg4-qpel4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth/vsynth2-mpeg4-qprd4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth/vsynth2-mpeg4-rc4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth/vsynth2-mpeg4-thread4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth/vsynth2-msmpeg44
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth/vsynth2-msmpeg4v24
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth/vsynth2-prores4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth/vsynth2-qtrle4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth/vsynth2-rgb4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth/vsynth2-roqvideo4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth/vsynth2-rv104
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth/vsynth2-rv204
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth/vsynth2-snow4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth/vsynth2-snow-hpel4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth/vsynth2-snow-ll4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth/vsynth2-svq14
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth/vsynth2-v2104
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth/vsynth2-wmv14
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth/vsynth2-wmv24
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth/vsynth2-yuv4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth1/asv14
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth1/asv24
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth1/cljr4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth1/dnxhd_1080i4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth1/dnxhd_720p4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth1/dnxhd_720p_10bit4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth1/dnxhd_720p_rd4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth1/dv4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth1/dv504
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth1/dv_4114
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth1/error4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth1/ffv14
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth1/flashsv4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth1/flv4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth1/h2614
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth1/h2634
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth1/h263p4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth1/huffyuv4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth1/jpegls4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth1/ljpeg4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth1/mjpeg4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth1/mpeg4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth1/mpeg1b4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth1/mpeg24
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth1/mpeg2_4224
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth1/mpeg2_idct_int4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth1/mpeg2_ilace4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth1/mpeg2_ivlc_qprd4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth1/mpeg2thread4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth1/mpeg2thread_ilace4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth1/mpeg44
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth1/mpeg4_adap4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth1/mpeg4_qpel4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth1/mpeg4_qprd4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth1/mpeg4adv4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth1/mpeg4nr4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth1/mpeg4thread4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth1/msmpeg44
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth1/msmpeg4v24
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth1/qtrle4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth1/rc4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth1/rgb4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth1/roq4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth1/rv104
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth1/rv204
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth1/snow4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth1/snowll4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth1/svq14
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth1/v2104
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth1/vref2
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth1/wmv14
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth1/wmv24
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth1/yuv4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth2/asv14
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth2/asv24
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth2/cljr4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth2/dnxhd_1080i4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth2/dnxhd_720p4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth2/dnxhd_720p_10bit4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth2/dnxhd_720p_rd4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth2/dv4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth2/dv504
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth2/dv_4114
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth2/error4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth2/ffv14
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth2/flashsv4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth2/flv4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth2/h2614
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth2/h2634
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth2/h263p4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth2/huffyuv4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth2/jpegls4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth2/ljpeg4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth2/mjpeg4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth2/mpeg4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth2/mpeg1b4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth2/mpeg24
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth2/mpeg2_4224
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth2/mpeg2_idct_int4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth2/mpeg2_ilace4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth2/mpeg2_ivlc_qprd4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth2/mpeg2thread4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth2/mpeg2thread_ilace4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth2/mpeg44
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth2/mpeg4_adap4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth2/mpeg4_qpel4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth2/mpeg4_qprd4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth2/mpeg4adv4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth2/mpeg4nr4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth2/mpeg4thread4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth2/msmpeg44
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth2/msmpeg4v24
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth2/qtrle4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth2/rc4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth2/rgb4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth2/roq4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth2/rv104
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth2/rv204
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth2/snow4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth2/snowll4
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth2/svq14
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth2/v2104
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth2/vref2
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth2/wmv14
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth2/wmv24
-rw-r--r--gst-libs/ext/libav/tests/ref/vsynth2/yuv4
-rwxr-xr-xgst-libs/ext/libav/tests/regression-funcs.sh54
-rw-r--r--gst-libs/ext/libav/tests/rotozoom.c152
-rw-r--r--gst-libs/ext/libav/tests/tiny_psnr.c54
-rw-r--r--gst-libs/ext/libav/tests/utils.c170
-rw-r--r--gst-libs/ext/libav/tests/videogen.c147
-rw-r--r--gst-libs/ext/libav/tools/aviocat.c8
-rw-r--r--gst-libs/ext/libav/tools/cws2fws.c62
-rw-r--r--gst-libs/ext/libav/tools/graph2dot.c49
-rw-r--r--gst-libs/ext/libav/tools/ismindex.c554
-rw-r--r--gst-libs/ext/libav/tools/lavfi-showfiltfmts.c99
-rwxr-xr-xgst-libs/ext/libav/tools/patcheck6
-rw-r--r--gst-libs/ext/libav/tools/pktdumper.c43
-rw-r--r--gst-libs/ext/libav/tools/probetest.c28
-rw-r--r--gst-libs/ext/libav/tools/qt-faststart.c4
-rw-r--r--gst-libs/ext/libav/tools/trasher.c41
-rwxr-xr-xinstall-sh14
-rw-r--r--ltmain.sh4
-rwxr-xr-xmissing414
-rw-r--r--pkgconfig/Makefile.am31
-rw-r--r--pkgconfig/Makefile.in580
-rw-r--r--pkgconfig/gstreamer-plugins-libav-uninstalled.pc.in13
-rwxr-xr-xtest-driver127
-rw-r--r--tests/Makefile.in273
-rw-r--r--tests/check/Makefile.am6
-rw-r--r--tests/check/Makefile.in750
-rw-r--r--tests/check/elements/avdec_adpcm.c4
-rw-r--r--tests/check/elements/avdemux_ape.c4
-rw-r--r--tests/check/generic/libavcodec-locking.c4
-rw-r--r--tests/check/generic/plugin-test.c4
-rw-r--r--tests/files/Makefile.in110
2779 files changed, 223653 insertions, 158383 deletions
diff --git a/COPYING.LIB b/COPYING.LIB
index eb685a5..c87cfe8 100644
--- a/COPYING.LIB
+++ b/COPYING.LIB
@@ -2,7 +2,7 @@
Version 2, June 1991
Copyright (C) 1991 Free Software Foundation, Inc.
- 675 Mass Ave, Cambridge, MA 02139, USA
+ 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
@@ -464,7 +464,7 @@ convey the exclusion of warranty; and each file should have at least the
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
- Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
Also add information on how to contact you by electronic and paper mail.
diff --git a/ChangeLog b/ChangeLog
index c99f8c1..6c2d524 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,85 +1,131 @@
-=== release 1.0.8 ===
+=== release 1.1.2 ===
-2013-07-12 Tim-Philipp Müller <tim@centricular.net>
+2013-07-11 Sebastian Dröge <sebastian.droege@collabora.co.uk>
* configure.ac:
- releasing 1.0.8
+ releasing 1.1.2
-2013-07-09 17:57:06 +0100 Tim-Philipp Müller <tim.muller@collabora.co.uk>
+2013-07-09 16:19:11 +0100 Tim-Philipp Müller <tim.muller@collabora.co.uk>
* gst-libs/ext/libav:
- libav: update from libav v0.8.6 to v0.8.8
- version 0.8.8:
+ libav: update libav from v9.6 to v9.8
+ version 9.8:
- kmvc: Clip pixel position to valid range
- - kmvc: use fixed sized arrays in the context
- - indeo: use a typedef for the mc function pointer
- - lavc: check for overflow in init_get_bits
- - mjpegdec: properly report unsupported disabled features
- - jpegls: return meaningful errors
- - jpegls: factorize return paths
- - jpegls: check the scan offset
- - wavpack: validate samples size parsed in wavpack_decode_block
- - ljpeg: use the correct number of components in yuv
+ - kmvc: Use fixed sized arrays in the context
+ - indeo: Reject negative array indexes
+ - indeo: Check for reference when inheriting motion vectors
+ - indeo: Properly forward the error codes
+ - mjpeg: Check the unescaped size for overflows
+ - wmapro: Error out on impossible scale factor offsets
+ - wmapro: Check the min_samples_per_subframe
+ - wmapro: Return early on unsupported condition
+ - wmapro: Check num_vec_coeffs against the actual available buffer
+ - wmapro: Make sure there is room to store the current packet
+ - lavc: Move put_bits_left in put_bits.h
+ - 4xm: Do not overread the source buffer in decode_p_block
+ - 4xm: Check bitstream_size boundary before using it
+ version 9.7:
+ Most of the following fixes resulted from test samples that the Google
+ Security Team has kindly made available to us:
+ - 4xm: fix several programming errors to avoid crashes, etc.
+ - apetag: use int64_t for filesize
+ - jpegls: Fix invalid writes to memory
+ - ljpeg: use the correct number of components in YUV
- mjpeg: Validate sampling factors
+ - mjpegdec: properly report unsupported disabled features
- mjpegdec: validate parameters in mjpeg_decode_scan_progressive_ac
- - wavpack: check packet size early
- - wavpack: return meaningful errors
- - apetag: use int64_t for filesize
+ - mpegvideo: allocate sufficiently large scratch buffer for interlaced vid
+ - pixdesc: mark gray8 as pseudopal
+ - smacker: fix several programming errors to avoid crashes, etc.
- tiff: do not overread the source buffer
- - Prepare for 0.8.8 Release
- - smacker: fix an off by one in huff.length computation
- - smacker: check the return value of smacker_decode_tree
- - smacker: pad the extradata allocation
- - smacker: check frame size validity
- - vmdav: convert to bytestream2
- - 4xm: don't rely on get_buffer() initializing the frame.
- - 4xm: check the return value of read_huffman_tables().
- - 4xm: use the correct logging context
- - 4xm: reject frames not compatible with the declared version
- - 4xm: check bitstream_size boundary before using it
- - 4xm: do not overread the source buffer in decode_p_block
- version 0.8.7:
- - avfiltergraph: check for sws opts being non-NULL before using them
- - bmv: check for len being valid in bmv_decode_frame()
- - dfa: check for invalid access in decode_wdlt()
- - indeo3: check motion vectors
- - indeo3: fix data size check
- - indeo3: switch parsing the header to bytestream2
- - lavf: make sure stream probe data gets freed.
- - oggdec: fix faulty cleanup prototype
- - oma: Validate sample rates
- - qdm2: check that the FFT size is a power of 2
- - rv10: check that extradata is large enough
- - xmv: check audio track parameters validity
- - xmv: do not leak memory in the error paths in xmv_read_header()
- - aac: check the maximum number of channels
- - indeo3: fix off by one in MV validity check, Bug #503
- - id3v2: check for end of file while unescaping tags
- - wav: Always seek to an even offset, Bug #500, LP: #1174737
- - proresdec: support mixed interlaced/non-interlaced content
-
-2013-05-20 11:08:43 +0200 Sebastian Dröge <sebastian.droege@collabora.co.uk>
+ - vmd: drop incomplete chunks and spurious samples
+ - vmdav: convert to bytestream2 to avoid invalid reads and writes
+ - wavpack: check packet size early
+ - wavpack: use bytestream2 in wavpack_decode_block
+ - wavpack: validate samples size parsed in wavpack_decode_block
- * gst-libs/ext/libav:
- libav: Update to v0.8.7
+2013-06-25 14:03:07 +0200 Wim Taymans <wim.taymans@collabora.co.uk>
-=== release 1.0.7 ===
+ * ext/libav/gstavcodecmap.c:
+ codecmap: realvideo does not have systemstream property
+ realvideo does not have the systemstream property and nobody ever sets it so
+ better remove it here to make it link to something else.
-2013-04-26 13:30:38 +0200 Sebastian Dröge <sebastian.droege@collabora.co.uk>
+2013-06-18 13:36:01 +0100 Tim-Philipp Müller <tim@centricular.net>
+
+ * autogen.sh:
+ * common:
+ autogen.sh: generate from common module, fixing srcdir != builddir build
+ https://bugzilla.gnome.org/show_bug.cgi?id=702319
+
+2013-06-11 08:24:17 -0300 Thiago Santos <thiago.sousa.santos@collabora.com>
+
+ * ext/libav/gstavviddec.c:
+ avviddec: reset coded_width/_height before trying to open codec
+ If coded_width/_height is supplied, the codec might use it as the
+ width/height and if it is wrong can lead to segfaults or video
+ corruption.
+ This is specially harmful on renegotiation scenarios where the
+ resolution changed. There seems to be no specific function for reseting
+ the AV Context in libav, so just set it directly.
+ https://bugzilla.gnome.org/show_bug.cgi?id=702003
+
+2013-06-05 18:36:40 +0200 Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+ * configure.ac:
+ Back to development
+
+=== release 1.1.1 ===
+
+2013-06-05 17:58:51 +0200 Sebastian Dröge <sebastian.droege@collabora.co.uk>
* ChangeLog:
* NEWS:
* RELEASE:
+ * common:
* configure.ac:
* gst-libav.doap:
- Release 1.0.7
+ Release 1.1.1
-2013-04-23 14:12:23 +0200 Sebastian Dröge <sebastian.droege@collabora.co.uk>
+2013-06-05 15:16:55 +0200 Sebastian Dröge <sebastian.droege@collabora.co.uk>
+ * common:
+ Automatic update of common submodule
+ From 098c0d7 to 01a7a46
+
+2013-05-20 11:07:57 +0200 Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+ * gst-libs/ext/libav:
+ libav: Update to v9.6
+
+2013-05-15 10:53:59 +0200 Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+ * common:
+ Automatic update of common submodule
+ From 5edcd85 to 098c0d7
+
+2013-05-06 23:56:22 +0100 Tim-Philipp Müller <tim@centricular.net>
+
+ * ext/libav/gstavauddec.c:
+ * ext/libav/gstavaudenc.c:
+ * ext/libav/gstavcfg.c:
+ * ext/libav/gstavcodecmap.c:
+ * ext/libav/gstavdemux.c:
+ * ext/libav/gstavmux.c:
* ext/libav/gstavviddec.c:
- avviddec: Disable SLICE based threaded decoding
- It causes artifacts in libav 0.8 and seems to be broken.
- https://bugzilla.gnome.org/show_bug.cgi?id=698649
+ * ext/libav/gstavvidenc.c:
+ CODEC_ID_* -> AV_CODEC_ID_*
+
+2013-05-06 23:53:01 +0100 Tim-Philipp Müller <tim@centricular.net>
+
+ * ext/libav/gstavcodecmap.c:
+ codecmap: add mapping for WMA Lossless
+ Only 16 bits is supported for now though.
+
+2013-04-23 14:19:48 +0200 Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+ * gst-libs/ext/libav:
+ libav: Update to v9.5
2013-04-23 14:10:54 +0200 Sebastian Dröge <sebastian.droege@collabora.co.uk>
@@ -88,6 +134,12 @@
If upstream is live we don't want FRAME based threaded decoding as
it adds latency.
+2013-04-22 23:54:48 +0100 Tim-Philipp Müller <tim@centricular.net>
+
+ * common:
+ Automatic update of common submodule
+ From 3cb3d3c to 5edcd85
+
2013-04-16 14:49:59 +0200 Sebastian Dröge <sebastian.droege@collabora.co.uk>
* configure.ac:
@@ -107,10 +159,22 @@
* ext/libswscale/Makefile.am:
gst: Add better support for static plugins
-2012-12-12 17:36:33 +0000 Sebastian Dröge <sebastian.droege@collabora.co.uk>
+2013-04-09 22:13:42 +0200 Matej Knopp <matej.knopp@gmail.com>
- * ext/libav/gstav.h:
- libav: Fix some compilation errors caused by circular includes
+ * ext/libav/gstavcodecmap.c:
+ av: Add WMV3 format for WMV 3 caps
+
+2013-04-14 17:57:18 +0100 Tim-Philipp Müller <tim@centricular.net>
+
+ * common:
+ Automatic update of common submodule
+ From aed87ae to 3cb3d3c
+
+2013-04-09 21:01:54 +0200 Stefan Sauer <ensonic@users.sf.net>
+
+ * common:
+ Automatic update of common submodule
+ From 04c7a1e to aed87ae
2013-04-09 20:40:06 +0200 Siva Chandran P <siva.chandran.p@gmail.com>
@@ -120,10 +184,15 @@
don't have them available anymore later.
https://bugzilla.gnome.org/show_bug.cgi?id=697548
-2013-03-25 09:54:00 +0100 Sebastian Dröge <sebastian.droege@collabora.co.uk>
+2013-03-25 18:06:39 -0700 David Schleef <ds@schleef.org>
+
+ * ext/libav/gstavdemux.c:
+ Use %03u instead of %u in gst_pad_create_stream_id_printf()
+
+2013-03-25 09:47:49 +0100 Sebastian Dröge <sebastian.droege@collabora.co.uk>
* gst-libs/ext/libav:
- libav: Update to v0.8.6
+ libav: Update to v9.4
2013-03-07 09:30:55 +0100 Sebastian Dröge <sebastian.droege@collabora.co.uk>
@@ -133,37 +202,101 @@
can also handle CPPFLAGS and other things.
https://bugzilla.gnome.org/show_bug.cgi?id=694416
-=== release 1.0.6 ===
+2013-03-07 09:04:16 +0100 Sebastian Dröge <sebastian.droege@collabora.co.uk>
-2013-03-22 14:36:34 +0000 Tim-Philipp Müller <tim@centricular.net>
+ * configure.ac:
+ configure: Add AG_GST_ARG_GCOV to make automake happy again
+ + running automake -a -c -Wno-portability...
+ common/check.mak:107: error: GST_GCOV_ENABLED does not appear in AM_CONDITIONAL
+ tests/check/Makefile.am:1: 'common/check.mak' included from here
- * ChangeLog:
- * NEWS:
- * RELEASE:
+2013-03-07 00:03:06 +0000 Tim-Philipp Müller <tim@centricular.net>
+
+ * common:
+ Automatic update of common submodule
+ From 2de221c to 04c7a1e
+
+2013-03-02 18:12:39 +0000 Tim-Philipp Müller <tim@centricular.net>
+
+ * gst-libs/ext/libav:
+ libav: update to v9.3
+
+2013-03-01 15:10:41 -0500 Olivier Crête <olivier.crete@collabora.com>
+
+ * ext/libswscale/gstffmpegscale.c:
+ swscale: Use 1.0-style video/x-raw caps
+
+2013-02-28 19:34:02 +0000 Tim-Philipp Müller <tim@centricular.net>
+
+ * Makefile.am:
* configure.ac:
- * gst-libav.doap:
- Release 1.0.6
+ * pkgconfig/.gitignore:
+ * pkgconfig/Makefile.am:
+ * pkgconfig/gstreamer-plugins-libav-uninstalled.pc.in:
+ Add uninstalled pkg-config file so other modules can find libav elements for unit tests
+ e.g. gst-plugins-bad has some unit tests that draw on av* elements.
-2013-02-25 10:38:09 +0000 Tim-Philipp Müller <tim@centricular.net>
+2013-02-15 13:00:02 +0000 Rico Tzschichholz <ricotz@ubuntu.com>
- * ext/libav/gstavutils.c:
- * ext/libav/gstavviddec.c:
- avviddec: fix H.264 decoding errors by disabling multi-threaded decoding
- Multi-threaded decoding does not work properly with the older libav 0.8
- version included in this gst-libav series, so just disable multi-threaded
- decoding again entirely for now. (We could also switch from FF_THREAD_SLICE
- to FF_THREAD_FRAME, but that may have other side-effects and just disabling
- it seems safest for now).
- This works properly in git master with more recent libav 0.9.x versions.
- Adventurous users may still re-enable this functionality by setting
- the GST_AVVIDDEC_MAX_THREADS environment variable to 'auto' or the
- max. number of threads desired.
- https://bugzilla.gnome.org/show_bug.cgi?id=694230
-
-2013-02-11 15:52:52 +0000 Tim-Philipp Müller <tim.muller@collabora.co.uk>
+ * gst-libs/ext/Makefile.am:
+ Fix 'make dist'
+ This time for real hopefully. Make sure to remove any
+ libav-dist directories that may still be around from
+ previous make dist attempts first.
+
+2013-02-12 10:22:11 +0000 Tim-Philipp Müller <tim.muller@collabora.co.uk>
* gst-libs/ext/libav:
- libav: Update to 0.8.5 release
+ libav: update to v9.1
+
+2013-02-04 18:10:42 -0800 David Schleef <ds@schleef.org>
+
+ * ext/libav/gstavcodecmap.c:
+ Add mapping for SMPTE 302m audio
+
+2013-01-28 20:44:16 +0100 Stefan Sauer <ensonic@users.sf.net>
+
+ * common:
+ Automatic update of common submodule
+ From a942293 to 2de221c
+
+2013-01-26 12:35:10 +0000 Tim-Philipp Müller <tim.muller@collabora.co.uk>
+
+ * ext/libav/gstavauddec.c:
+ Revert "avdec_aac: disable for autoplugging until it gets fixed"
+ This reverts commit c5980dc52ac57cf0147ed269e3b2c863d7251f84.
+ It's fixed now.
+ https://bugzilla.gnome.org/show_bug.cgi?id=690940
+
+2013-01-26 12:50:49 +0000 Tim-Philipp Müller <tim@centricular.net>
+
+ * ext/libav/gstavauddec.c:
+ avauddec: fix decoding of mono audio as well
+ https://bugzilla.gnome.org/show_bug.cgi?id=690940
+
+2013-01-25 14:40:15 -0500 Nicolas Dufresne <nicolas.dufresne@collabora.com>
+
+ * ext/libav/gstavauddec.c:
+ avauddec: fix garbled audio decoding in some cases
+ Calculate output buffer size based on the number of
+ samples, channels and bytes per sample. The buffer
+ size was calculated based on linesize, which may
+ be larger than what's required.
+ https://bugzilla.gnome.org/show_bug.cgi?id=690940
+
+2013-01-22 12:57:41 +0000 Tim-Philipp Müller <tim.muller@collabora.co.uk>
+
+ * ext/libav/gstavaudenc.c:
+ avenc_aac: downgrade to RANK_NONE until it gets fixed
+ Currently just fails to initialize.
+ https://bugzilla.gnome.org/show_bug.cgi?id=691617
+
+2013-01-22 12:53:48 +0000 Tim-Philipp Müller <tim.muller@collabora.co.uk>
+
+ * ext/libav/gstavauddec.c:
+ avdec_aac: disable for autoplugging until it gets fixed
+ Currently outputs garbled audio. Use faad in the meantime.
+ https://bugzilla.gnome.org/show_bug.cgi?id=690940
2013-01-14 17:00:17 +0100 Andoni Morales Alastruey <ylatuya@gmail.com>
@@ -171,16 +304,27 @@
libav: fix checks for internal libav configure options
https://bugzilla.gnome.org/show_bug.cgi?id=691723
-=== release 1.0.5 ===
+2013-01-17 23:56:17 +0000 Tim-Philipp Müller <tim@centricular.net>
-2013-01-08 10:56:21 +0000 Tim-Philipp Müller <tim.muller@collabora.co.uk>
+ * ext/Makefile.am:
+ Disable libswscale/avvideoscale plugin until it works at least somewhat
+ It needs some fixing.
- * ChangeLog:
- * NEWS:
- * RELEASE:
- * configure.ac:
- * gst-libav.doap:
- Release 1.0.5
+2013-01-16 12:09:39 +0000 Tim-Philipp Müller <tim.muller@collabora.co.uk>
+
+ * tests/check/Makefile.am:
+ tests: use GST_*_1_0 environment variables everywhere
+ The _1_0 suffixed environment variables override the
+ non-suffixed ones, so if we're in an environment that
+ sets the _1_0 suffixed ones, such as jhbuild, we need
+ to set those to make sure ours actually always get
+ used.
+
+2013-01-15 15:08:10 +0000 Tim-Philipp Müller <tim.muller@collabora.co.uk>
+
+ * common:
+ Automatic update of common submodule
+ From a72faea to a942293
2012-12-31 00:32:41 +0000 Tim-Philipp Müller <tim@centricular.net>
@@ -190,21 +334,102 @@
https://lists.gnu.org/archive/html/automake/2012-12/msg00038.html
https://bugzilla.gnome.org/show_bug.cgi?id=690881
+2012-12-22 10:52:47 +0100 Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+ * ext/libav/gstav.c:
+ * ext/libav/gstav.h:
+ av: Remove some unused variables and function declarations
+
+2012-12-22 10:49:52 +0100 Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+ * ext/libav/Makefile.am:
+ * ext/libav/gstav.h:
+ * ext/libav/gstavdemux.c:
+ * ext/libav/gstavmux.c:
+ * ext/libav/gstavpipe.h:
+ * ext/libav/gstavprotocol.c:
+ * ext/libav/gstavprotocol.h:
+ av: Move gst_ffmpegdata functions to gstavprotocol.h too
+ Just for consistency.
+
+2012-12-21 23:16:44 +0100 Thijs Vermeir <thijsvermeir@gmail.com>
+
+ * ext/libav/gstav.h:
+ * ext/libav/gstavpipe.h:
+ av: Fix redefinition of typedef 'GstFFMpegPipe'
+ Move declaration of pipe function to correct headers file
+
2012-12-21 14:28:57 +0100 Sebastian Dröge <sebastian.droege@collabora.co.uk>
* configure.ac:
configure: Pass CC, LD, AS, AR and NM to the libav configure if set
-=== release 1.0.4 ===
+2012-12-21 11:03:27 +0100 Sebastian Dröge <sebastian.droege@collabora.co.uk>
-2012-12-18 21:30:43 +0000 Tim-Philipp Müller <tim@centricular.net>
+ * ext/libav/gstavauddec.c:
+ * ext/libav/gstavviddec.c:
+ av: Use correct printf format strings for gsize
- * ChangeLog:
- * NEWS:
- * RELEASE:
- * configure.ac:
- * gst-libav.doap:
- Release 1.0.4
+2012-12-18 10:57:43 +0100 Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+ * gst-libs/ext/libav:
+ libav: Update to today's master
+
+2012-12-17 16:35:36 +0100 Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+ * ext/libav/gstavauddec.c:
+ * ext/libav/gstavaudenc.c:
+ * ext/libav/gstavcfg.c:
+ * ext/libav/gstavdemux.c:
+ * ext/libav/gstavmux.c:
+ * ext/libav/gstavviddec.c:
+ * ext/libav/gstavvidenc.c:
+ av: Fix some memory leaks and misuse of libav API
+
+2012-12-17 15:58:37 +0100 Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+ * ext/libav/gstavauddec.c:
+ * ext/libav/gstavauddec.h:
+ avauddec: Use a GstBuffer instead of a GstAdapter for collecting the output buffers
+ This might cause less memcpies as the GstMemories of the buffers
+ are just appended into a single buffer.
+
+2012-12-03 16:38:53 -0300 Thiago Santos <thiago.sousa.santos@collabora.com>
+
+ * ext/libav/gstavauddec.c:
+ * ext/libav/gstavauddec.h:
+ avauddec: accumulate buffers from a single input to push it all at once
+ The base audio decoder wants a 1:1 mapping for input and output
+ buffers, so this decoder must accumulate data in an adapter and push
+ it all at once after all input has been processed.
+ https://bugzilla.gnome.org/show_bug.cgi?id=689565
+
+2012-12-17 13:42:13 +0100 Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+ * ext/libav/gstavaudenc.c:
+ * ext/libav/gstavcodecmap.c:
+ avcodecmap: Only set "formats" field on raw audio/video caps
+
+2012-12-17 13:41:42 +0100 Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+ * ext/libav/gstavcodecmap.c:
+ avcodecmap: Correctly convert GStreamer channel positions to libav channel mask
+
+2012-12-17 11:11:12 +0100 Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+ * ext/libav/gstavcodecmap.c:
+ avcodecmap: Add more and correct restrictions for DV
+ https://bugzilla.gnome.org/show_bug.cgi?id=600895
+
+2012-12-12 17:36:33 +0000 Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+ * ext/libav/gstav.h:
+ libav: Fix some compilation errors caused by circular includes
+
+2012-12-12 17:20:03 +0000 Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+ * gst-libs/ext/libav:
+ libav: Update to today's master
2012-12-12 17:01:28 +0100 Wim Taymans <wim.taymans@collabora.co.uk>
@@ -213,48 +438,386 @@
Use the bitrate and the samplerate to set the bits_per_coded_sample for G726
because the decoder needs this.
+2012-12-12 15:57:19 +0000 Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+ * ext/libav/gstavauddec.c:
+ avauddec: Set frame defaults for the audio decoders too
+
+2012-12-12 15:53:34 +0000 Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+ * ext/libav/gstavcodecmap.c:
+ * ext/libav/gstavcodecmap.h:
+ avcodecmap: Remove some unused functions
+
+2012-12-12 16:45:53 +0100 Wim Taymans <wim.taymans@collabora.co.uk>
+
+ * ext/libav/gstavaudenc.c:
+ avaudenc: init frame with defaults
+ Init the AVFrame with the right method. This sets the extended_data field
+ correctly that is needed for some formats (G726 for example).
+
+2012-12-12 15:42:09 +0000 Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+ * ext/libav/gstavauddec.c:
+ * ext/libav/gstavcodecmap.c:
+ * ext/libav/gstavviddec.c:
+ avdec: Improve src template caps
+
+2012-12-12 13:04:54 +0000 Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+ * ext/libav/gstavaudenc.c:
+ avaudenc: Properly handle planar audio formats with more than AV_NUM_DATA_POINTERS channels
+
+2012-12-12 13:04:38 +0000 Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+ * ext/libav/gstavauddec.c:
+ avauddec: Properly handle planar audio formats with more than AV_NUM_DATA_POINTERS channels
+
+2012-12-12 12:09:32 +0000 Christiaan Welvaart <cjw@daneel.dyndns.org>
+
+ * ext/libav/gstav.c:
+ * ext/libav/gstav.h:
+ * ext/libav/gstavdemux.c:
+ * ext/libav/gstavmux.c:
+ * ext/libav/gstavprotocol.c:
+ avprotocol: Port from the URL protocol handler to saner public API
+
+2012-12-12 09:48:53 +0100 Wim Taymans <wim.taymans@collabora.co.uk>
+
+ * ext/libav/gstavviddec.c:
+ * ext/libav/gstavviddec.h:
+ libav: fix palette support again
+
+2012-12-11 18:56:24 +0000 Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+ * ext/libav/gstavcodecmap.c:
+ avcodecmap: Take framerate restrictions into account for encoders
+
+2012-12-11 18:48:34 +0000 Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+ * ext/libav/gstavaudenc.c:
+ * ext/libav/gstavaudenc.h:
+ * ext/libav/gstavcodecmap.c:
+ * ext/libav/gstavvidenc.c:
+ * ext/libav/gstavvidenc.h:
+ avvidenc: Simplify color formats in the raw video caps
+
+2012-12-11 18:07:34 +0000 Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+ * ext/libav/gstavaudenc.c:
+ * ext/libav/gstavaudenc.h:
+ * ext/libav/gstavcodecmap.c:
+ avaudenc: Reorder audio channels if necessary and add proper support for channel layouts
+
+2012-12-11 17:25:41 +0000 Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+ * ext/libav/gstavauddec.c:
+ * ext/libav/gstavcodecmap.c:
+ * ext/libav/gstavcodecmap.h:
+ avcodecmap: Take channel layout constraints into account if possible
+
+2012-12-11 16:54:09 +0000 Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+ * ext/libav/gstavcodecmap.c:
+ avcodecmap: Take generic samplerate limitations into account
+
+2012-12-11 16:46:43 +0000 Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+ * ext/libav/gstavcodecmap.c:
+ avcodecmap: Simplify raw audio caps
+
+2012-12-11 15:14:10 +0000 Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+ * ext/libav/gstavauddec.c:
+ avauddec: Close context when it was opened
+
+2012-12-11 10:34:42 +0000 Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+ * ext/libav/gstavviddec.c:
+ avviddec: Fix memory leak if we already allocated an output buffer for the frame
+
+2012-12-11 10:22:34 +0100 Wim Taymans <wim.taymans@collabora.co.uk>
+
+ * ext/libav/gstavviddec.c:
+ Revert "avviddec: Fix memory leaks and assertions in error cases if we can't allocate a frame"
+ This reverts commit 47647e1caca117ff8a62caf8bf0b6c94eb6dd025.
+ Breaks playback when direct rendering is disabled.
+ The reason is that we set the opaque vaue to NULL and then try to use the NULL
+ value when we decoded a frame.
+
2012-12-10 14:54:03 +0100 Rasmus Rohde <rohde@duff.dk>
* ext/libav/gstavpipe.h:
Fix incorrect use of object in log statement. We are given a pointer to the object and should not try to take the address of it.
-2012-11-21 13:05:54 +0000 Tim-Philipp Müller <tim@centricular.net>
+2012-12-06 06:29:13 +0400 РуÑлан Ижбулатов <lrn1986@gmail.com>
- * configure.ac:
- Back to development (bug fixing)
+ * ext/libav/gstavutils.c:
+ avutils: Add missing includes for Windows
+ Fixes #689751
-=== release 1.0.3 ===
+2012-12-05 19:28:33 +0100 Sebastian Dröge <sebastian.droege@collabora.co.uk>
-2012-11-21 11:13:07 +0000 Tim-Philipp Müller <tim@centricular.net>
+ * ext/libav/gstavaudenc.c:
+ * ext/libav/gstavcodecmap.c:
+ avaudenc: Add support for planar audio formats
- * ChangeLog:
- * NEWS:
- * RELEASE:
- * configure.ac:
- * gst-libav.doap:
- Release 1.0.3
+2012-12-05 19:25:37 +0100 Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+ * ext/libav/gstavauddec.c:
+ * ext/libav/gstavaudenc.c:
+ * ext/libav/gstavviddec.c:
+ * ext/libav/gstavvidenc.c:
+ av: Correctly populate the codec context with the defaults
-2012-11-21 11:10:49 +0000 Tim-Philipp Müller <tim@centricular.net>
+2012-12-05 10:52:34 +0100 Sebastian Dröge <sebastian.droege@collabora.co.uk>
- * gst-libs/ext/Makefile.am:
- Revert "Revert "ffmpeg: Fix make dist""
- This reverts commit 2aab13b9aed1ff7e9a17be07b3184ebd0869afe0.
+ * ext/libav/gstavauddec.c:
+ * ext/libav/gstavaudenc.c:
+ * ext/libav/gstavviddec.c:
+ * ext/libav/gstavvidenc.c:
+ av: Use av_codec_is_{en,de}coder() API instead of private struct fields
+
+2012-12-04 22:09:05 +0100 Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+ * ext/libav/gstavauddec.c:
+ avauddec: release_buffer is not supposed to be used for audio
+ And calling it causes crashes in some situations.
+
+2012-12-04 20:45:28 +0100 Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+ * ext/libav/gstavauddec.c:
+ * ext/libav/gstavcodecmap.c:
+ * ext/libav/gstavutils.c:
+ avauddec: Add support for planar audio formats
+
+2012-12-04 20:44:58 +0100 Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+ * ext/libav/gstavviddec.c:
+ avviddec: Fix memory leaks and assertions in error cases if we can't allocate a frame
+
+2012-12-04 18:28:11 +0100 Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+ * ext/libav/gstavauddec.c:
+ * ext/libav/gstavaudenc.c:
+ * ext/libav/gstavcfg.c:
+ * ext/libav/gstavdemux.c:
+ * ext/libav/gstavmux.c:
+ * ext/libav/gstavutils.c:
+ * ext/libav/gstavviddec.c:
+ * ext/libav/gstavvidenc.c:
+ av: Port remaining simple bits
+
+2012-12-04 18:02:56 +0100 Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+ * ext/libav/gstavauddec.c:
+ * ext/libav/gstavcodecmap.c:
+ * ext/libav/gstavviddec.c:
+ av: Remove palette support for now
+ It was never ported to the way how paletted color formats work
+ in 1.0 anyway and the API changed in libav upstream.
+
+2012-12-04 17:56:40 +0100 Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+ * ext/libav/gstavcodecmap.c:
+ av: Update for some constant changes
+
+2012-12-04 17:47:20 +0100 Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+ * ext/libav/gstav.c:
+ * ext/libav/gstav.h:
+ * ext/libav/gstavprotocol.c:
+ av: Port to new avio protocol handler
+
+2012-11-19 15:25:42 +0100 Luca Barbato <lu_zero@gentoo.org>
+
+ * ext/libav/gstav.c:
+ * ext/libav/gstavauddec.c:
+ * ext/libav/gstavaudenc.c:
+ * ext/libav/gstavcfg.c:
+ * ext/libav/gstavdeinterlace.c:
+ * ext/libav/gstavmux.c:
+ * ext/libav/gstavviddec.c:
+ * ext/libav/gstavvidenc.c:
+ av: update to use AVOption variants.
+
+2012-12-04 17:19:11 +0100 Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+ * gst-libs/ext/libav:
+ libav: Switch to master (9)
+
+2012-12-02 12:31:43 +0000 Tim-Philipp Müller <tim@centricular.net>
+
+ * ext/libav/gstavaudenc.c:
+ avaudenc: log error string as well in debug output
+
+2012-12-01 23:21:41 +0000 Tim-Philipp Müller <tim@centricular.net>
+
+ * ext/libav/gstavaudenc.c:
+ avaudenc: use sample rate as ticks per second fallback
+ The 25/1 value presumably came from the video encoder class.
+
+2012-12-01 23:05:23 +0000 Tim-Philipp Müller <tim@centricular.net>
+
+ * ext/libav/gstavaudenc.c:
+ avaudenc: fix output timestamping
+ We need to pass the number of samples encode in the output buffer
+ to gst_audio_encoder_finish_frame(), not the number of frames.
+ Fixes output timestamps being way too small, and transcoding
+ problems.
+ https://bugzilla.gnome.org/show_bug.cgi?id=689398
+
+2012-11-20 11:56:57 +0100 Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+ * ext/libav/gstavaudenc.c:
+ * ext/libav/gstavvidenc.c:
+ avvidenc: Implement reset vfunc
+
+2012-11-20 11:53:52 +0100 Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+ * ext/libav/gstavvidenc.c:
+ avvidenc: Don't send any frames downstream when draining unless requested to do so
+
+2012-11-20 11:51:13 +0100 Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+ * ext/libav/gstavaudenc.c:
+ avaudenc: Implement draining
+
+2012-11-20 11:45:34 +0100 Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+ * ext/libav/gstavaudenc.c:
+ avaudenc: Implement flush vfunc properly
+
+2012-11-20 11:39:45 +0100 Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+ * ext/libav/gstavauddec.c:
+ * ext/libav/gstavauddec.h:
+ avauddec: Port to non-deprecated avcodec_decode_audio4() API
+ Fixes bug #666435.
+
+2012-11-20 10:55:55 +0100 Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+ * ext/libav/gstavaudenc.c:
+ * ext/libav/gstavaudenc.h:
+ avaudenc: Some minor cleanup
+
+2012-11-20 10:53:01 +0100 Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+ * ext/libav/gstavaudenc.c:
+ avaudenc: Use non-deprecated avcodec_encode_audio2() API
+ This also allows us to always get an output buffer of the required size
+ instead of risking that it is too small.
+
+2012-11-20 10:36:29 +0100 Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+ * ext/libav/gstavaudenc.c:
+ * ext/libav/gstavaudenc.h:
+ * ext/libav/gstavcodecmap.c:
+ * ext/libav/gstavcodecmap.h:
+ avaudenc: Port to audio encoder base class
+
+2012-11-20 10:35:01 +0100 Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+ * ext/libav/gstavvidenc.c:
+ avvidenc: Use gst_caps_truncate()
+
+2012-11-19 17:08:23 +0100 Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+ * ext/libav/gstavaudenc.c:
+ * ext/libav/gstavmux.c:
+ * ext/libav/gstavvidenc.c:
+ av: Use PROP_ instead of ARG_
2012-11-19 14:10:23 +0100 Sebastian Dröge <sebastian.droege@collabora.co.uk>
* ext/libav/gstavcodecmap.c:
avcodecmap: Y41B is YUV411P, not YUV410P
+2012-11-19 12:57:19 +0100 Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+ * ext/libav/gstavauddec.c:
+ * ext/libav/gstavauddec.h:
+ * ext/libav/gstavcodecmap.c:
+ * ext/libav/gstavcodecmap.h:
+ avauddec: Port to audio base classes
+
+2012-11-19 11:29:22 +0000 Tim-Philipp Müller <tim@centricular.net>
+
+ * common:
+ Automatic update of common submodule
+ From 6bb6951 to a72faea
+
+2012-11-19 10:29:00 +0100 Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+ * ext/libav/Makefile.am:
+ * ext/libav/gstavauddec.c:
+ * ext/libav/gstavauddec.h:
+ * ext/libav/gstavaudenc.c:
+ * ext/libav/gstavaudenc.h:
+ * ext/libav/gstavdec.c:
+ * ext/libav/gstavenc.c:
+ * ext/libav/gstavenc.h:
+ * ext/libav/gstavviddec.c:
+ * ext/libav/gstavviddec.h:
+ * ext/libav/gstavvidenc.h:
+ av: Put declarations in header files and rename audio codec files
+
+2012-11-14 12:43:51 +0000 Tim-Philipp Müller <tim@centricular.net>
+
+ * ext/libav/gstavenc.c:
+ gst_adapter_prev_timestamp -> gst_adapter_prev_pts
+
+2012-11-10 16:57:06 +0100 Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+ * ext/libav/gstavcodecmap.c:
+ avcodecmap: Add mappings for the GBR color formats
+
+2012-11-04 00:22:16 +0000 Tim-Philipp Müller <tim@centricular.net>
+
+ * COPYING.LIB:
+ * ext/libav/gstav.c:
+ * ext/libav/gstav.h:
+ * ext/libav/gstavaudioresample.c:
+ * ext/libav/gstavcfg.c:
+ * ext/libav/gstavcfg.h:
+ * ext/libav/gstavcodecmap.c:
+ * ext/libav/gstavcodecmap.h:
+ * ext/libav/gstavdec.c:
+ * ext/libav/gstavdeinterlace.c:
+ * ext/libav/gstavdemux.c:
+ * ext/libav/gstavenc.c:
+ * ext/libav/gstavenc.h:
+ * ext/libav/gstavmux.c:
+ * ext/libav/gstavpipe.h:
+ * ext/libav/gstavprotocol.c:
+ * ext/libav/gstavscale.c:
+ * ext/libav/gstavutils.c:
+ * ext/libav/gstavutils.h:
+ * ext/libav/gstavviddec.c:
+ * ext/libav/gstavvidenc.c:
+ * ext/libav/gstavvidenc.h:
+ * ext/libswscale/gstffmpegscale.c:
+ * tests/check/elements/avdec_adpcm.c:
+ * tests/check/elements/avdemux_ape.c:
+ * tests/check/generic/libavcodec-locking.c:
+ * tests/check/generic/plugin-test.c:
+ Fix FSF address
+
2012-10-29 14:12:03 +0100 Sebastian Dröge <sebastian.droege@collabora.co.uk>
* ext/libav/gstavcodecmap.c:
avcodecmap: Remove redundant function to map PixelFormat to GstVideoFormat
And merge everything into a single one.
-2012-10-25 12:54:40 +0100 Tim-Philipp Müller <tim.muller@collabora.co.uk>
+2012-10-25 13:11:43 +0200 Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+ * ext/libav/gstavdec.c:
+ avdec: Use gst_audio_buffer_clip() instead of manual clipping
+
+2012-10-25 12:51:41 +0100 Tim-Philipp Müller <tim.muller@collabora.co.uk>
* configure.ac:
- Back to development (bug fixing)
+ Back to feature development
=== release 1.0.2 ===
diff --git a/INSTALL b/INSTALL
index a1e89e1..007e939 100644
--- a/INSTALL
+++ b/INSTALL
@@ -1,7 +1,7 @@
Installation Instructions
*************************
-Copyright (C) 1994-1996, 1999-2002, 2004-2011 Free Software Foundation,
+Copyright (C) 1994-1996, 1999-2002, 2004-2013 Free Software Foundation,
Inc.
Copying and distribution of this file, with or without modification,
@@ -309,9 +309,10 @@ causes the specified `gcc' to be used as the C compiler (unless it is
overridden in the site shell script).
Unfortunately, this technique does not work for `CONFIG_SHELL' due to
-an Autoconf bug. Until the bug is fixed you can use this workaround:
+an Autoconf limitation. Until the limitation is lifted, you can use
+this workaround:
- CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash
+ CONFIG_SHELL=/bin/bash ./configure CONFIG_SHELL=/bin/bash
`configure' Invocation
======================
@@ -367,4 +368,3 @@ operates.
`configure' also accepts some other, not widely useful, options. Run
`configure --help' for more details.
-
diff --git a/Makefile.am b/Makefile.am
index cf31a9c..b843d30 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,8 +1,8 @@
DISTCHECK_CONFIGURE_FLAGS=--enable-gtk-doc
COMMON_SUBDIRS = ext docs common tests
-SUBDIRS = $(LIBAV_SUBDIRS) $(COMMON_SUBDIRS)
-DIST_SUBDIRS = $(COMMON_SUBDIRS) gst-libs
+SUBDIRS = $(LIBAV_SUBDIRS) $(COMMON_SUBDIRS) pkgconfig
+DIST_SUBDIRS = $(COMMON_SUBDIRS) gst-libs pkgconfig
# include before EXTRA_DIST for win32 assignment
include $(top_srcdir)/common/win32.mak
diff --git a/Makefile.in b/Makefile.in
index 258e29d..0d78704 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -1,9 +1,8 @@
-# Makefile.in generated by automake 1.11.6 from Makefile.am.
+# Makefile.in generated by automake 1.13.3 from Makefile.am.
# @configure_input@
-# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-# Foundation, Inc.
+# Copyright (C) 1994-2013 Free Software Foundation, Inc.
+
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -26,23 +25,51 @@
#
# set CRUFT_FILES and/or CRUFT_DIRS in your Makefile.am when you include this
VPATH = @srcdir@
-am__make_dryrun = \
- { \
- am__dry=no; \
+am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
+am__make_running_with_option = \
+ case $${target_option-} in \
+ ?) ;; \
+ *) echo "am__make_running_with_option: internal error: invalid" \
+ "target option '$${target_option-}' specified" >&2; \
+ exit 1;; \
+ esac; \
+ has_opt=no; \
+ sane_makeflags=$$MAKEFLAGS; \
+ if $(am__is_gnu_make); then \
+ sane_makeflags=$$MFLAGS; \
+ else \
case $$MAKEFLAGS in \
*\\[\ \ ]*) \
- echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
- | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
- *) \
- for am__flg in $$MAKEFLAGS; do \
- case $$am__flg in \
- *=*|--*) ;; \
- *n*) am__dry=yes; break;; \
- esac; \
- done;; \
+ bs=\\; \
+ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
+ esac; \
+ fi; \
+ skip_next=no; \
+ strip_trailopt () \
+ { \
+ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+ }; \
+ for flg in $$sane_makeflags; do \
+ test $$skip_next = yes && { skip_next=no; continue; }; \
+ case $$flg in \
+ *=*|--*) continue;; \
+ -*I) strip_trailopt 'I'; skip_next=yes;; \
+ -*I?*) strip_trailopt 'I';; \
+ -*O) strip_trailopt 'O'; skip_next=yes;; \
+ -*O?*) strip_trailopt 'O';; \
+ -*l) strip_trailopt 'l'; skip_next=yes;; \
+ -*l?*) strip_trailopt 'l';; \
+ -[dEDm]) skip_next=yes;; \
+ -[JT]) skip_next=yes;; \
esac; \
- test $$am__dry = yes; \
- }
+ case $$flg in \
+ *$$target_option*) has_opt=yes; break;; \
+ esac; \
+ done; \
+ test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
@@ -62,13 +89,14 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
-DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
- $(srcdir)/Makefile.in $(srcdir)/config.h.in \
- $(srcdir)/gst-libav.spec.in $(top_srcdir)/common/cruft.mak \
+DIST_COMMON = $(top_srcdir)/common/win32.mak \
$(top_srcdir)/common/release.mak \
- $(top_srcdir)/common/win32.mak $(top_srcdir)/configure AUTHORS \
- COPYING COPYING.LIB ChangeLog INSTALL NEWS TODO compile \
- config.guess config.sub depcomp install-sh ltmain.sh missing
+ $(top_srcdir)/common/cruft.mak INSTALL NEWS README AUTHORS \
+ ChangeLog $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
+ $(top_srcdir)/configure $(am__configure_deps) \
+ $(srcdir)/config.h.in $(srcdir)/gst-libav.spec.in COPYING \
+ COPYING.LIB TODO compile config.guess config.sub depcomp \
+ install-sh missing ltmain.sh
subdir = .
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/common/m4/as-ac-expand.m4 \
@@ -101,21 +129,28 @@ mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = config.h
CONFIG_CLEAN_FILES = gst-libav.spec
CONFIG_CLEAN_VPATH_FILES =
+AM_V_P = $(am__v_P_@AM_V@)
+am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
+am__v_P_0 = false
+am__v_P_1 = :
AM_V_GEN = $(am__v_GEN_@AM_V@)
am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
-am__v_GEN_0 = @echo " GEN " $@;
+am__v_GEN_0 = @echo " GEN " $@;
+am__v_GEN_1 =
AM_V_at = $(am__v_at_@AM_V@)
am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
am__v_at_0 = @
+am__v_at_1 =
SOURCES =
DIST_SOURCES =
-RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
- html-recursive info-recursive install-data-recursive \
- install-dvi-recursive install-exec-recursive \
- install-html-recursive install-info-recursive \
- install-pdf-recursive install-ps-recursive install-recursive \
- installcheck-recursive installdirs-recursive pdf-recursive \
- ps-recursive uninstall-recursive
+RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \
+ ctags-recursive dvi-recursive html-recursive info-recursive \
+ install-data-recursive install-dvi-recursive \
+ install-exec-recursive install-html-recursive \
+ install-info-recursive install-pdf-recursive \
+ install-ps-recursive install-recursive installcheck-recursive \
+ installdirs-recursive pdf-recursive ps-recursive \
+ tags-recursive uninstall-recursive
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
@@ -123,11 +158,33 @@ am__can_run_installinfo = \
esac
RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
distclean-recursive maintainer-clean-recursive
-AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
- $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
- distdir dist dist-all distcheck
+am__recursive_targets = \
+ $(RECURSIVE_TARGETS) \
+ $(RECURSIVE_CLEAN_TARGETS) \
+ $(am__extra_recursive_targets)
+AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \
+ cscope distdir dist dist-all distcheck
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) \
+ $(LISP)config.h.in
+# Read a list of newline-separated strings from the standard input,
+# and print each of them once, without duplicates. Input order is
+# *not* preserved.
+am__uniquify_input = $(AWK) '\
+ BEGIN { nonempty = 0; } \
+ { items[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in items) print i; }; } \
+'
+# Make sure the list of sources is unique. This is necessary because,
+# e.g., the same source file might be shared among _SOURCES variables
+# for different programs/libraries.
+am__define_uniq_tagged_files = \
+ list='$(am__tagged_files)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | $(am__uniquify_input)`
ETAGS = etags
CTAGS = ctags
+CSCOPE = cscope
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
distdir = $(PACKAGE)-$(VERSION)
top_distdir = $(distdir)
@@ -137,6 +194,7 @@ am__remove_distdir = \
&& rm -rf "$(distdir)" \
|| { sleep 5 && rm -rf "$(distdir)"; }; \
else :; fi
+am__post_remove_distdir = $(am__remove_distdir)
am__relativize = \
dir0=`pwd`; \
sed_first='s,^\([^/]*\)/.*$$,\1,'; \
@@ -164,6 +222,7 @@ am__relativize = \
reldir="$$dir2"
GZIP_ENV = --best
DIST_ARCHIVES = $(distdir).tar.xz
+DIST_TARGETS = dist-xz
distuninstallcheck_listfiles = find . -type f -print
am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \
| sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$'
@@ -181,10 +240,12 @@ AWK = @AWK@
CAT_ENTRY_END = @CAT_ENTRY_END@
CAT_ENTRY_START = @CAT_ENTRY_START@
CC = @CC@
+CCASFLAGS = @CCASFLAGS@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
+CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DARWIN_LDFLAGS = @DARWIN_LDFLAGS@
DEFS = @DEFS@
@@ -200,7 +261,11 @@ ECHO_T = @ECHO_T@
EGREP = @EGREP@
ERROR_CFLAGS = @ERROR_CFLAGS@
EXEEXT = @EXEEXT@
+FFLAGS = @FFLAGS@
FGREP = @FGREP@
+GCOV = @GCOV@
+GCOV_CFLAGS = @GCOV_CFLAGS@
+GCOV_LIBS = @GCOV_LIBS@
GREP = @GREP@
GSTPB_PLUGINS_DIR = @GSTPB_PLUGINS_DIR@
GST_AGE = @GST_AGE@
@@ -233,16 +298,15 @@ GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@
GTKDOC_MKPDF = @GTKDOC_MKPDF@
GTKDOC_REBASE = @GTKDOC_REBASE@
HAVE_BZ2 = @HAVE_BZ2@
-HAVE_DOCBOOK2HTML = @HAVE_DOCBOOK2HTML@
HAVE_DOCBOOK2PS = @HAVE_DOCBOOK2PS@
HAVE_DVIPS = @HAVE_DVIPS@
HAVE_EPSTOPDF = @HAVE_EPSTOPDF@
-HAVE_FIG2DEV = @HAVE_FIG2DEV@
HAVE_JADETEX = @HAVE_JADETEX@
HAVE_PNGTOPNM = @HAVE_PNGTOPNM@
HAVE_PNMTOPS = @HAVE_PNMTOPS@
HAVE_PS2PDF = @HAVE_PS2PDF@
HAVE_XMLLINT = @HAVE_XMLLINT@
+HAVE_XSLTPROC = @HAVE_XSLTPROC@
HTML_DIR = @HTML_DIR@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
@@ -381,8 +445,8 @@ top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
DISTCHECK_CONFIGURE_FLAGS = --enable-gtk-doc
COMMON_SUBDIRS = ext docs common tests
-SUBDIRS = $(LIBAV_SUBDIRS) $(COMMON_SUBDIRS)
-DIST_SUBDIRS = $(COMMON_SUBDIRS) gst-libs
+SUBDIRS = $(LIBAV_SUBDIRS) $(COMMON_SUBDIRS) pkgconfig
+DIST_SUBDIRS = $(COMMON_SUBDIRS) gst-libs pkgconfig
# the MANIFEST contains all win32 related files that should be disted
win32 = $(shell cat $(top_srcdir)/win32/MANIFEST)
@@ -477,22 +541,25 @@ distclean-libtool:
-rm -f libtool config.lt
# This directory's subdirectories are mostly independent; you can cd
-# into them and run `make' without going through this Makefile.
-# To change the values of `make' variables: instead of editing Makefiles,
-# (1) if the variable is set in `config.status', edit `config.status'
-# (which will cause the Makefiles to be regenerated when you run `make');
-# (2) otherwise, pass the desired values on the `make' command line.
-$(RECURSIVE_TARGETS):
- @fail= failcom='exit 1'; \
- for f in x $$MAKEFLAGS; do \
- case $$f in \
- *=* | --[!k]*);; \
- *k*) failcom='fail=yes';; \
- esac; \
- done; \
+# into them and run 'make' without going through this Makefile.
+# To change the values of 'make' variables: instead of editing Makefiles,
+# (1) if the variable is set in 'config.status', edit 'config.status'
+# (which will cause the Makefiles to be regenerated when you run 'make');
+# (2) otherwise, pass the desired values on the 'make' command line.
+$(am__recursive_targets):
+ @fail=; \
+ if $(am__make_keepgoing); then \
+ failcom='fail=yes'; \
+ else \
+ failcom='exit 1'; \
+ fi; \
dot_seen=no; \
target=`echo $@ | sed s/-recursive//`; \
- list='$(SUBDIRS)'; for subdir in $$list; do \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ for subdir in $$list; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
dot_seen=yes; \
@@ -507,57 +574,12 @@ $(RECURSIVE_TARGETS):
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
fi; test -z "$$fail"
-$(RECURSIVE_CLEAN_TARGETS):
- @fail= failcom='exit 1'; \
- for f in x $$MAKEFLAGS; do \
- case $$f in \
- *=* | --[!k]*);; \
- *k*) failcom='fail=yes';; \
- esac; \
- done; \
- dot_seen=no; \
- case "$@" in \
- distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
- *) list='$(SUBDIRS)' ;; \
- esac; \
- rev=''; for subdir in $$list; do \
- if test "$$subdir" = "."; then :; else \
- rev="$$subdir $$rev"; \
- fi; \
- done; \
- rev="$$rev ."; \
- target=`echo $@ | sed s/-recursive//`; \
- for subdir in $$rev; do \
- echo "Making $$target in $$subdir"; \
- if test "$$subdir" = "."; then \
- local_target="$$target-am"; \
- else \
- local_target="$$target"; \
- fi; \
- ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
- || eval $$failcom; \
- done && test -z "$$fail"
-tags-recursive:
- list='$(SUBDIRS)'; for subdir in $$list; do \
- test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
- done
-ctags-recursive:
- list='$(SUBDIRS)'; for subdir in $$list; do \
- test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
- done
+ID: $(am__tagged_files)
+ $(am__define_uniq_tagged_files); mkid -fID $$unique
+tags: tags-recursive
+TAGS: tags
-ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
- list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
- unique=`for i in $$list; do \
- if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
- done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
- mkid -fID $$unique
-tags: TAGS
-
-TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
- $(TAGS_FILES) $(LISP)
+tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
set x; \
here=`pwd`; \
if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
@@ -573,12 +595,7 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
fi; \
done; \
- list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
- unique=`for i in $$list; do \
- if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
- done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
+ $(am__define_uniq_tagged_files); \
shift; \
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
@@ -590,15 +607,11 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
$$unique; \
fi; \
fi
-ctags: CTAGS
-CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
- $(TAGS_FILES) $(LISP)
- list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
- unique=`for i in $$list; do \
- if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
- done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
+ctags: ctags-recursive
+
+CTAGS: ctags
+ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+ $(am__define_uniq_tagged_files); \
test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$unique
@@ -607,9 +620,31 @@ GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& $(am__cd) $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here"
+cscope: cscope.files
+ test ! -s cscope.files \
+ || $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files $(CSCOPE_ARGS)
+clean-cscope:
+ -rm -f cscope.files
+cscope.files: clean-cscope cscopelist
+cscopelist: cscopelist-recursive
+
+cscopelist-am: $(am__tagged_files)
+ list='$(am__tagged_files)'; \
+ case "$(srcdir)" in \
+ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+ *) sdir=$(subdir)/$(srcdir) ;; \
+ esac; \
+ for i in $$list; do \
+ if test -f "$$i"; then \
+ echo "$(subdir)/$$i"; \
+ else \
+ echo "$$sdir/$$i"; \
+ fi; \
+ done >> $(top_builddir)/cscope.files
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+ -rm -f cscope.out cscope.in.out cscope.po.out cscope.files
distdir: $(DISTFILES)
$(am__remove_distdir)
@@ -680,39 +715,35 @@ distdir: $(DISTFILES)
|| chmod -R a+r "$(distdir)"
dist-gzip: distdir
tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
- $(am__remove_distdir)
+ $(am__post_remove_distdir)
dist-bzip2: distdir
tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2
- $(am__remove_distdir)
+ $(am__post_remove_distdir)
dist-lzip: distdir
tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz
- $(am__remove_distdir)
-
-dist-lzma: distdir
- tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma
- $(am__remove_distdir)
+ $(am__post_remove_distdir)
dist-xz: distdir
tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz
- $(am__remove_distdir)
+ $(am__post_remove_distdir)
dist-tarZ: distdir
tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
- $(am__remove_distdir)
+ $(am__post_remove_distdir)
dist-shar: distdir
shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
- $(am__remove_distdir)
+ $(am__post_remove_distdir)
dist-zip: distdir
-rm -f $(distdir).zip
zip -rq $(distdir).zip $(distdir)
- $(am__remove_distdir)
+ $(am__post_remove_distdir)
-dist dist-all: distdir
- tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz
- $(am__remove_distdir)
+dist dist-all:
+ $(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) am__post_remove_distdir='@:'
+ $(am__post_remove_distdir)
# This target untars the dist file and tries a VPATH configuration. Then
# it guarantees that the distribution is self-contained by making another
@@ -723,8 +754,6 @@ distcheck: dist
GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\
*.tar.bz2*) \
bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
- *.tar.lzma*) \
- lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\
*.tar.lz*) \
lzip -dc $(distdir).tar.lz | $(am__untar) ;;\
*.tar.xz*) \
@@ -736,9 +765,9 @@ distcheck: dist
*.zip*) \
unzip $(distdir).zip ;;\
esac
- chmod -R a-w $(distdir); chmod u+w $(distdir)
- mkdir $(distdir)/_build
- mkdir $(distdir)/_inst
+ chmod -R a-w $(distdir)
+ chmod u+w $(distdir)
+ mkdir $(distdir)/_build $(distdir)/_inst
chmod a-w $(distdir)
test -d $(distdir)/_build || exit 0; \
dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
@@ -771,7 +800,7 @@ distcheck: dist
&& $(MAKE) $(AM_MAKEFLAGS) distcleancheck \
&& cd "$$am__cwd" \
|| exit 1
- $(am__remove_distdir)
+ $(am__post_remove_distdir)
@(echo "$(distdir) archives ready for distribution: "; \
list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x'
@@ -906,14 +935,13 @@ ps-am:
uninstall-am:
-.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) all \
- ctags-recursive install-am install-strip tags-recursive
+.MAKE: $(am__recursive_targets) all install-am install-strip
-.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
- all all-am all-local am--refresh check check-am clean \
- clean-generic clean-libtool ctags ctags-recursive dist \
- dist-all dist-bzip2 dist-gzip dist-hook dist-lzip dist-lzma \
- dist-shar dist-tarZ dist-xz dist-zip distcheck distclean \
+.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am all-local \
+ am--refresh check check-am clean clean-cscope clean-generic \
+ clean-libtool cscope cscopelist-am ctags ctags-am dist \
+ dist-all dist-bzip2 dist-gzip dist-hook dist-lzip dist-shar \
+ dist-tarZ dist-xz dist-zip distcheck distclean \
distclean-generic distclean-hdr distclean-libtool \
distclean-tags distcleancheck distdir distuninstallcheck dvi \
dvi-am html html-am info info-am install install-am \
@@ -924,7 +952,7 @@ uninstall-am:
installcheck installcheck-am installdirs installdirs-am \
maintainer-clean maintainer-clean-generic mostlyclean \
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
- tags tags-recursive uninstall uninstall-am
+ tags tags-am uninstall uninstall-am
win32-debug:
@@ -967,11 +995,17 @@ check-exports:
if test $$fail != 0; then \
echo '-----------------------------------------------------------'; \
echo 'Run this to update the .def files:'; \
- echo 'make check-exports 2>&1 | patch -p1'; \
+ echo 'make update-exports'; \
echo '-----------------------------------------------------------'; \
fi; \
exit $$fail
+update-exports:
+ make check-exports 2>&1 | patch -p1
+ git add win32/common/libgst*.def
+ git diff --cached -- win32/common/
+ echo '^^^--- updated and staged changes above'
+
# complain about nonportable printf format strings (%lld, %llu, %zu etc.)
check-nonportable-print-format:
@fail=0 ; \
diff --git a/NEWS b/NEWS
index 852564b..511ab5d 100644
--- a/NEWS
+++ b/NEWS
@@ -1,65 +1,2 @@
-This is GStreamer Libav Plugins 1.0.8
+This is GStreamer Libav Plugins 1.1.2
-Changes since 1.0.7:
-
- * gst-libav: internal libav snapshot version bumped to v0.8.8
-
-Changes since 1.0.6:
-
- * Update to libav 0.8.6
- * Now uses frame based threading if possible and disables slice
- based threading until libav 9 is used. This provides potentially better
- performance and fixes some display corruptions caused by bugs in the
- slice based threading
-
-Bugs fixed since 1.0.6:
-
- * 697548 : avviddec: Setting same caps resets decoder
- * 697617 : gst-libav renders incorrectly in multithread mode
-
-Changes since 1.0.5:
-
- * avviddec: fix H.264 decoding errors in some files by disabling multi-threaded decoding
- * libav: fix checks for internal libav configure options
- * libav: Update to 0.8.5 release
-
-Bugs fixed since 1.0.5:
-
- * 691723 : libav: fix checks for internal libav configure options
- * 694230 : quicktime videos have decoding issues in gst-1.x
-
-Changes since 1.0.4:
-
- * Pass CC, LD, AS, AR and NM to the libav configure if set
-
-Changes since 1.0.3:
-
- * G.726 decoder fixes
-
-Bugs fixed since 1.0.3:
-
- * 689975 : Incorrect use of object in log statement
-
-Changes since 1.0.2:
-
- * avcodecmap: Y41B is YUV411P, not YUV410P
-
-Changes since 1.0.1:
-
- * Update internal libav snapshot to 0.8.4 release which includes many crasher and CVE fixes
-
-Changes since 1.0.0:
-
- * avviddec: handle 0-sized buffers without crashing
- * avviddec: don't set invalid latency
-
-Bugs fixed since 1.0.0:
-
- * 680464 : avdemux_*: not-negotiated error
- * 680499 : avdemux_ape: will not play some ape files, not-negotiated error
- * 685113 : avviddec: ignored audio decoders end up registered as video decoders
-
-New features in 1.0.0:
-
- * Parallel installability with 0.10.x series
- * See release notes for more details
diff --git a/aclocal.m4 b/aclocal.m4
index 69457cb..e0d0d09 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -1,8 +1,7 @@
-# generated automatically by aclocal 1.11.6 -*- Autoconf -*-
+# generated automatically by aclocal 1.13.3 -*- Autoconf -*-
+
+# Copyright (C) 1996-2013 Free Software Foundation, Inc.
-# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
-# 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation,
-# Inc.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -12,33 +11,31 @@
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
+m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
m4_ifndef([AC_AUTOCONF_VERSION],
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],,
[m4_warning([this file was generated for autoconf 2.69.
You have another version of autoconf. It may work, but is not guaranteed to.
If you have problems, you may need to regenerate the build system entirely.
-To do so, use the procedure documented by the package, typically `autoreconf'.])])
+To do so, use the procedure documented by the package, typically 'autoreconf'.])])
-# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008, 2011 Free Software
-# Foundation, Inc.
+# Copyright (C) 2002-2013 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
-# serial 1
-
# AM_AUTOMAKE_VERSION(VERSION)
# ----------------------------
# Automake X.Y traces this macro to ensure aclocal.m4 has been
# generated from the m4 files accompanying Automake X.Y.
# (This private macro should not be called outside this file.)
AC_DEFUN([AM_AUTOMAKE_VERSION],
-[am__api_version='1.11'
+[am__api_version='1.13'
dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
dnl require some minimum version. Point them to the right macro.
-m4_if([$1], [1.11.6], [],
+m4_if([$1], [1.13.3], [],
[AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
])
@@ -54,24 +51,22 @@ m4_define([_AM_AUTOCONF_VERSION], [])
# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
-[AM_AUTOMAKE_VERSION([1.11.6])dnl
+[AM_AUTOMAKE_VERSION([1.13.3])dnl
m4_ifndef([AC_AUTOCONF_VERSION],
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
# AM_AUX_DIR_EXPAND -*- Autoconf -*-
-# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc.
+# Copyright (C) 2001-2013 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
-# serial 1
-
# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
-# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to
-# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
+# $ac_aux_dir to '$srcdir/foo'. In other projects, it is set to
+# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
#
# Of course, Automake must honor this variable whenever it calls a
# tool from the auxiliary directory. The problem is that $srcdir (and
@@ -90,7 +85,7 @@ _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
#
# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
# are both prefixed by $srcdir. In an in-source build this is usually
-# harmless because $srcdir is `.', but things will broke when you
+# harmless because $srcdir is '.', but things will broke when you
# start a VPATH build or use an absolute $srcdir.
#
# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
@@ -116,22 +111,19 @@ am_aux_dir=`cd $ac_aux_dir && pwd`
# AM_CONDITIONAL -*- Autoconf -*-
-# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008
-# Free Software Foundation, Inc.
+# Copyright (C) 1997-2013 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
-# serial 9
-
# AM_CONDITIONAL(NAME, SHELL-CONDITION)
# -------------------------------------
# Define a conditional.
AC_DEFUN([AM_CONDITIONAL],
-[AC_PREREQ(2.52)dnl
- ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])],
- [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
+[AC_PREREQ([2.52])dnl
+ m4_if([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])],
+ [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
AC_SUBST([$1_TRUE])dnl
AC_SUBST([$1_FALSE])dnl
_AM_SUBST_NOTMAKE([$1_TRUE])dnl
@@ -150,16 +142,14 @@ AC_CONFIG_COMMANDS_PRE(
Usually this means the macro was only invoked conditionally.]])
fi])])
-# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009,
-# 2010, 2011 Free Software Foundation, Inc.
+# Copyright (C) 1999-2013 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
-# serial 12
-# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
+# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
# written in clear, in which case automake, when reading aclocal.m4,
# will think it sees a *use*, and therefore will trigger all it's
# C support machinery. Also note that it means that autoscan, seeing
@@ -169,7 +159,7 @@ fi])])
# _AM_DEPENDENCIES(NAME)
# ----------------------
# See how the compiler implements dependency checking.
-# NAME is "CC", "CXX", "GCJ", or "OBJC".
+# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
# We try a few techniques and use that to set a single cache variable.
#
# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
@@ -182,12 +172,13 @@ AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
AC_REQUIRE([AM_MAKE_INCLUDE])dnl
AC_REQUIRE([AM_DEP_TRACK])dnl
-ifelse([$1], CC, [depcc="$CC" am_compiler_list=],
- [$1], CXX, [depcc="$CXX" am_compiler_list=],
- [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
- [$1], UPC, [depcc="$UPC" am_compiler_list=],
- [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'],
- [depcc="$$1" am_compiler_list=])
+m4_if([$1], [CC], [depcc="$CC" am_compiler_list=],
+ [$1], [CXX], [depcc="$CXX" am_compiler_list=],
+ [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
+ [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
+ [$1], [UPC], [depcc="$UPC" am_compiler_list=],
+ [$1], [GCJ], [depcc="$GCJ" am_compiler_list='gcc3 gcc'],
+ [depcc="$$1" am_compiler_list=])
AC_CACHE_CHECK([dependency style of $depcc],
[am_cv_$1_dependencies_compiler_type],
@@ -195,8 +186,8 @@ AC_CACHE_CHECK([dependency style of $depcc],
# We make a subdir and do the tests there. Otherwise we can end up
# making bogus files that we don't know about and never remove. For
# instance it was reported that on HP-UX the gcc test will end up
- # making a dummy file named `D' -- because `-MD' means `put the output
- # in D'.
+ # making a dummy file named 'D' -- because '-MD' means "put the output
+ # in D".
rm -rf conftest.dir
mkdir conftest.dir
# Copy depcomp to subdir because otherwise we won't find it if we're
@@ -236,16 +227,16 @@ AC_CACHE_CHECK([dependency style of $depcc],
: > sub/conftest.c
for i in 1 2 3 4 5 6; do
echo '#include "conftst'$i'.h"' >> sub/conftest.c
- # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
- # Solaris 8's {/usr,}/bin/sh.
- touch sub/conftst$i.h
+ # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
+ # Solaris 10 /bin/sh.
+ echo '/* dummy */' > sub/conftst$i.h
done
echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
- # We check with `-c' and `-o' for the sake of the "dashmstdout"
+ # We check with '-c' and '-o' for the sake of the "dashmstdout"
# mode. It turns out that the SunPro C++ compiler does not properly
- # handle `-M -o', and we need to detect this. Also, some Intel
- # versions had trouble with output in subdirs
+ # handle '-M -o', and we need to detect this. Also, some Intel
+ # versions had trouble with output in subdirs.
am__obj=sub/conftest.${OBJEXT-o}
am__minus_obj="-o $am__obj"
case $depmode in
@@ -254,8 +245,8 @@ AC_CACHE_CHECK([dependency style of $depcc],
test "$am__universal" = false || continue
;;
nosideeffect)
- # after this tag, mechanisms are not by side-effect, so they'll
- # only be used when explicitly requested
+ # After this tag, mechanisms are not by side-effect, so they'll
+ # only be used when explicitly requested.
if test "x$enable_dependency_tracking" = xyes; then
continue
else
@@ -263,7 +254,7 @@ AC_CACHE_CHECK([dependency style of $depcc],
fi
;;
msvc7 | msvc7msys | msvisualcpp | msvcmsys)
- # This compiler won't grok `-c -o', but also, the minuso test has
+ # This compiler won't grok '-c -o', but also, the minuso test has
# not run yet. These depmodes are late enough in the game, and
# so weak that their functioning should not be impacted.
am__obj=conftest.${OBJEXT-o}
@@ -311,7 +302,7 @@ AM_CONDITIONAL([am__fastdep$1], [
# AM_SET_DEPDIR
# -------------
# Choose a directory name for dependency files.
-# This macro is AC_REQUIREd in _AM_DEPENDENCIES
+# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
AC_DEFUN([AM_SET_DEPDIR],
[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
@@ -321,9 +312,13 @@ AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
# AM_DEP_TRACK
# ------------
AC_DEFUN([AM_DEP_TRACK],
-[AC_ARG_ENABLE(dependency-tracking,
-[ --disable-dependency-tracking speeds up one-time build
- --enable-dependency-tracking do not reject slow dependency extractors])
+[AC_ARG_ENABLE([dependency-tracking], [dnl
+AS_HELP_STRING(
+ [--enable-dependency-tracking],
+ [do not reject slow dependency extractors])
+AS_HELP_STRING(
+ [--disable-dependency-tracking],
+ [speeds up one-time build])])
if test "x$enable_dependency_tracking" != xno; then
am_depcomp="$ac_aux_dir/depcomp"
AMDEPBACKSLASH='\'
@@ -338,20 +333,18 @@ _AM_SUBST_NOTMAKE([am__nodep])dnl
# Generate code to set up dependency tracking. -*- Autoconf -*-
-# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008
-# Free Software Foundation, Inc.
+# Copyright (C) 1999-2013 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
-#serial 5
# _AM_OUTPUT_DEPENDENCY_COMMANDS
# ------------------------------
AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
[{
- # Autoconf 2.62 quotes --file arguments for eval, but not when files
+ # Older Autoconf quotes --file arguments for eval, but not when files
# are listed without --file. Let's play safe and only enable the eval
# if we detect the quoting.
case $CONFIG_FILES in
@@ -364,7 +357,7 @@ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
# Strip MF so we end up with the name of the file.
mf=`echo "$mf" | sed -e 's/:.*$//'`
# Check whether this is an Automake generated Makefile or not.
- # We used to match only the files named `Makefile.in', but
+ # We used to match only the files named 'Makefile.in', but
# some people rename them; so instead we look at the file content.
# Grep'ing the first line is not enough: some people post-process
# each Makefile.in and add a new line on top of each file to say so.
@@ -376,21 +369,19 @@ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
continue
fi
# Extract the definition of DEPDIR, am__include, and am__quote
- # from the Makefile without running `make'.
+ # from the Makefile without running 'make'.
DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
test -z "$DEPDIR" && continue
am__include=`sed -n 's/^am__include = //p' < "$mf"`
- test -z "am__include" && continue
+ test -z "$am__include" && continue
am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
- # When using ansi2knr, U may be empty or an underscore; expand it
- U=`sed -n 's/^U = //p' < "$mf"`
# Find all dependency output files, they are included files with
# $(DEPDIR) in their names. We invoke sed twice because it is the
# simplest approach to changing $(DEPDIR) to its actual value in the
# expansion.
for file in `sed -n "
s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
- sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
+ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
# Make sure the directory exists.
test -f "$dirpart/$file" && continue
fdir=`AS_DIRNAME(["$file"])`
@@ -408,7 +399,7 @@ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
# This macro should only be invoked once -- use via AC_REQUIRE.
#
# This code is only required when automatic dependency tracking
-# is enabled. FIXME. This creates each `.P' file that we will
+# is enabled. FIXME. This creates each '.P' file that we will
# need in order to bootstrap the dependency handling code.
AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
[AC_CONFIG_COMMANDS([depfiles],
@@ -418,15 +409,12 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
# Do all the work for Automake. -*- Autoconf -*-
-# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
-# 2005, 2006, 2008, 2009 Free Software Foundation, Inc.
+# Copyright (C) 1996-2013 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
-# serial 16
-
# This macro actually does too much. Some checks are only needed if
# your package does certain things. But this isn't really a big deal.
@@ -442,7 +430,7 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
# arguments mandatory, and then we can depend on a new Autoconf
# release and drop the old call support.
AC_DEFUN([AM_INIT_AUTOMAKE],
-[AC_PREREQ([2.62])dnl
+[AC_PREREQ([2.65])dnl
dnl Autoconf wants to disallow AM_ names. We explicitly allow
dnl the ones we care about.
m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
@@ -471,31 +459,40 @@ AC_SUBST([CYGPATH_W])
# Define the identity of the package.
dnl Distinguish between old-style and new-style calls.
m4_ifval([$2],
-[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
+[AC_DIAGNOSE([obsolete],
+ [$0: two- and three-arguments forms are deprecated.])
+m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
AC_SUBST([PACKAGE], [$1])dnl
AC_SUBST([VERSION], [$2])],
[_AM_SET_OPTIONS([$1])dnl
dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
-m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,,
+m4_if(
+ m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
+ [ok:ok],,
[m4_fatal([AC_INIT should be called with package and version arguments])])dnl
AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
_AM_IF_OPTION([no-define],,
-[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
- AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
+[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
+ AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
# Some tools Automake needs.
AC_REQUIRE([AM_SANITY_CHECK])dnl
AC_REQUIRE([AC_ARG_PROGRAM])dnl
-AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
-AM_MISSING_PROG(AUTOCONF, autoconf)
-AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
-AM_MISSING_PROG(AUTOHEADER, autoheader)
-AM_MISSING_PROG(MAKEINFO, makeinfo)
+AM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
+AM_MISSING_PROG([AUTOCONF], [autoconf])
+AM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
+AM_MISSING_PROG([AUTOHEADER], [autoheader])
+AM_MISSING_PROG([MAKEINFO], [makeinfo])
AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
-AC_REQUIRE([AM_PROG_MKDIR_P])dnl
+AC_REQUIRE([AC_PROG_MKDIR_P])dnl
+# For better backward compatibility. To be removed once Automake 1.9.x
+# dies out for good. For more background, see:
+# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
+# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
+AC_SUBST([mkdir_p], ['$(MKDIR_P)'])
# We need awk for the "check" target. The system "awk" is bad on
# some platforms.
AC_REQUIRE([AC_PROG_AWK])dnl
@@ -506,28 +503,32 @@ _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
[_AM_PROG_TAR([v7])])])
_AM_IF_OPTION([no-dependencies],,
[AC_PROVIDE_IFELSE([AC_PROG_CC],
- [_AM_DEPENDENCIES(CC)],
- [define([AC_PROG_CC],
- defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
+ [_AM_DEPENDENCIES([CC])],
+ [m4_define([AC_PROG_CC],
+ m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
AC_PROVIDE_IFELSE([AC_PROG_CXX],
- [_AM_DEPENDENCIES(CXX)],
- [define([AC_PROG_CXX],
- defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
+ [_AM_DEPENDENCIES([CXX])],
+ [m4_define([AC_PROG_CXX],
+ m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
AC_PROVIDE_IFELSE([AC_PROG_OBJC],
- [_AM_DEPENDENCIES(OBJC)],
- [define([AC_PROG_OBJC],
- defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl
+ [_AM_DEPENDENCIES([OBJC])],
+ [m4_define([AC_PROG_OBJC],
+ m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
+AC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
+ [_AM_DEPENDENCIES([OBJCXX])],
+ [m4_define([AC_PROG_OBJCXX],
+ m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
])
-_AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl
-dnl The `parallel-tests' driver may need to know about EXEEXT, so add the
-dnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This macro
-dnl is hooked onto _AC_COMPILER_EXEEXT early, see below.
+AC_REQUIRE([AM_SILENT_RULES])dnl
+dnl The testsuite driver may need to know about EXEEXT, so add the
+dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This
+dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
AC_CONFIG_COMMANDS_PRE(dnl
[m4_provide_if([_AM_COMPILER_EXEEXT],
[AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
])
-dnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion. Do not
+dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion. Do not
dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
dnl mangled by Autoconf and run in a shell conditional statement.
m4_define([_AC_COMPILER_EXEEXT],
@@ -555,15 +556,12 @@ for _am_header in $config_headers :; do
done
echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
-# Copyright (C) 2001, 2003, 2005, 2008, 2011 Free Software Foundation,
-# Inc.
+# Copyright (C) 2001-2013 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
-# serial 1
-
# AM_PROG_INSTALL_SH
# ------------------
# Define $install_sh.
@@ -577,16 +575,14 @@ if test x"${install_sh}" != xset; then
install_sh="\${SHELL} $am_aux_dir/install-sh"
esac
fi
-AC_SUBST(install_sh)])
+AC_SUBST([install_sh])])
-# Copyright (C) 2003, 2005 Free Software Foundation, Inc.
+# Copyright (C) 2003-2013 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
-# serial 2
-
# Check whether the underlying file-system supports filenames
# with a leading dot. For instance MS-DOS doesn't.
AC_DEFUN([AM_SET_LEADING_DOT],
@@ -603,20 +599,17 @@ AC_SUBST([am__leading_dot])])
# Add --enable-maintainer-mode option to configure. -*- Autoconf -*-
# From Jim Meyering
-# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2008,
-# 2011 Free Software Foundation, Inc.
+# Copyright (C) 1996-2013 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
-# serial 5
-
# AM_MAINTAINER_MODE([DEFAULT-MODE])
# ----------------------------------
# Control maintainer-specific portions of Makefiles.
-# Default is to disable them, unless `enable' is passed literally.
-# For symmetry, `disable' may be passed as well. Anyway, the user
+# Default is to disable them, unless 'enable' is passed literally.
+# For symmetry, 'disable' may be passed as well. Anyway, the user
# can override the default with the --enable/--disable switch.
AC_DEFUN([AM_MAINTAINER_MODE],
[m4_case(m4_default([$1], [disable]),
@@ -627,10 +620,11 @@ AC_DEFUN([AM_MAINTAINER_MODE],
AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
dnl maintainer-mode's default is 'disable' unless 'enable' is passed
AC_ARG_ENABLE([maintainer-mode],
-[ --][am_maintainer_other][-maintainer-mode am_maintainer_other make rules and dependencies not useful
- (and sometimes confusing) to the casual installer],
- [USE_MAINTAINER_MODE=$enableval],
- [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes]))
+ [AS_HELP_STRING([--]am_maintainer_other[-maintainer-mode],
+ am_maintainer_other[ make rules and dependencies not useful
+ (and sometimes confusing) to the casual installer])],
+ [USE_MAINTAINER_MODE=$enableval],
+ [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes]))
AC_MSG_RESULT([$USE_MAINTAINER_MODE])
AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes])
MAINT=$MAINTAINER_MODE_TRUE
@@ -638,18 +632,14 @@ AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
]
)
-AU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE])
-
# Check to see how 'make' treats includes. -*- Autoconf -*-
-# Copyright (C) 2001, 2002, 2003, 2005, 2009 Free Software Foundation, Inc.
+# Copyright (C) 2001-2013 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
-# serial 4
-
# AM_MAKE_INCLUDE()
# -----------------
# Check to see how make treats includes.
@@ -667,7 +657,7 @@ am__quote=
_am_result=none
# First try GNU make style include.
echo "include confinc" > confmf
-# Ignore all kinds of additional output from `make'.
+# Ignore all kinds of additional output from 'make'.
case `$am_make -s -f confmf 2> /dev/null` in #(
*the\ am__doit\ target*)
am__include=include
@@ -692,15 +682,12 @@ AC_MSG_RESULT([$_am_result])
rm -f confinc confmf
])
-# Copyright (C) 1999, 2000, 2001, 2003, 2004, 2005, 2008
-# Free Software Foundation, Inc.
+# Copyright (C) 1999-2013 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
-# serial 6
-
# AM_PROG_CC_C_O
# --------------
# Like AC_PROG_CC_C_O, but changed for automake.
@@ -729,15 +716,12 @@ m4_define([AC_PROG_CC],
# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*-
-# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008
-# Free Software Foundation, Inc.
+# Copyright (C) 1997-2013 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
-# serial 6
-
# AM_MISSING_PROG(NAME, PROGRAM)
# ------------------------------
AC_DEFUN([AM_MISSING_PROG],
@@ -745,11 +729,10 @@ AC_DEFUN([AM_MISSING_PROG],
$1=${$1-"${am_missing_run}$2"}
AC_SUBST($1)])
-
# AM_MISSING_HAS_RUN
# ------------------
-# Define MISSING if not defined so far and test if it supports --run.
-# If it does, set am_missing_run to use it, otherwise, to nothing.
+# Define MISSING if not defined so far and test if it is modern enough.
+# If it is, set am_missing_run to use it, otherwise, to nothing.
AC_DEFUN([AM_MISSING_HAS_RUN],
[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
AC_REQUIRE_AUX_FILE([missing])dnl
@@ -762,54 +745,22 @@ if test x"${MISSING+set}" != xset; then
esac
fi
# Use eval to expand $SHELL
-if eval "$MISSING --run true"; then
- am_missing_run="$MISSING --run "
+if eval "$MISSING --is-lightweight"; then
+ am_missing_run="$MISSING "
else
am_missing_run=
- AC_MSG_WARN([`missing' script is too old or missing])
+ AC_MSG_WARN(['missing' script is too old or missing])
fi
])
-# Copyright (C) 2003, 2004, 2005, 2006, 2011 Free Software Foundation,
-# Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# serial 1
-
-# AM_PROG_MKDIR_P
-# ---------------
-# Check for `mkdir -p'.
-AC_DEFUN([AM_PROG_MKDIR_P],
-[AC_PREREQ([2.60])dnl
-AC_REQUIRE([AC_PROG_MKDIR_P])dnl
-dnl Automake 1.8 to 1.9.6 used to define mkdir_p. We now use MKDIR_P,
-dnl while keeping a definition of mkdir_p for backward compatibility.
-dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile.
-dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of
-dnl Makefile.ins that do not define MKDIR_P, so we do our own
-dnl adjustment using top_builddir (which is defined more often than
-dnl MKDIR_P).
-AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl
-case $mkdir_p in
- [[\\/$]]* | ?:[[\\/]]*) ;;
- */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
-esac
-])
-
# Helper functions for option handling. -*- Autoconf -*-
-# Copyright (C) 2001, 2002, 2003, 2005, 2008, 2010 Free Software
-# Foundation, Inc.
+# Copyright (C) 2001-2013 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
-# serial 5
-
# _AM_MANGLE_OPTION(NAME)
# -----------------------
AC_DEFUN([_AM_MANGLE_OPTION],
@@ -819,7 +770,7 @@ AC_DEFUN([_AM_MANGLE_OPTION],
# --------------------
# Set option NAME. Presently that only means defining a flag for this option.
AC_DEFUN([_AM_SET_OPTION],
-[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
+[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
# _AM_SET_OPTIONS(OPTIONS)
# ------------------------
@@ -833,13 +784,246 @@ AC_DEFUN([_AM_SET_OPTIONS],
AC_DEFUN([_AM_IF_OPTION],
[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
-# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc.
+# Copyright (C) 1999-2013 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
-# serial 1
+
+# AM_PATH_PYTHON([MINIMUM-VERSION], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
+# ---------------------------------------------------------------------------
+# Adds support for distributing Python modules and packages. To
+# install modules, copy them to $(pythondir), using the python_PYTHON
+# automake variable. To install a package with the same name as the
+# automake package, install to $(pkgpythondir), or use the
+# pkgpython_PYTHON automake variable.
+#
+# The variables $(pyexecdir) and $(pkgpyexecdir) are provided as
+# locations to install python extension modules (shared libraries).
+# Another macro is required to find the appropriate flags to compile
+# extension modules.
+#
+# If your package is configured with a different prefix to python,
+# users will have to add the install directory to the PYTHONPATH
+# environment variable, or create a .pth file (see the python
+# documentation for details).
+#
+# If the MINIMUM-VERSION argument is passed, AM_PATH_PYTHON will
+# cause an error if the version of python installed on the system
+# doesn't meet the requirement. MINIMUM-VERSION should consist of
+# numbers and dots only.
+AC_DEFUN([AM_PATH_PYTHON],
+ [
+ dnl Find a Python interpreter. Python versions prior to 2.0 are not
+ dnl supported. (2.0 was released on October 16, 2000).
+ m4_define_default([_AM_PYTHON_INTERPRETER_LIST],
+[python python2 python3 python3.3 python3.2 python3.1 python3.0 python2.7 dnl
+ python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 python2.0])
+
+ AC_ARG_VAR([PYTHON], [the Python interpreter])
+
+ m4_if([$1],[],[
+ dnl No version check is needed.
+ # Find any Python interpreter.
+ if test -z "$PYTHON"; then
+ AC_PATH_PROGS([PYTHON], _AM_PYTHON_INTERPRETER_LIST, :)
+ fi
+ am_display_PYTHON=python
+ ], [
+ dnl A version check is needed.
+ if test -n "$PYTHON"; then
+ # If the user set $PYTHON, use it and don't search something else.
+ AC_MSG_CHECKING([whether $PYTHON version is >= $1])
+ AM_PYTHON_CHECK_VERSION([$PYTHON], [$1],
+ [AC_MSG_RESULT([yes])],
+ [AC_MSG_RESULT([no])
+ AC_MSG_ERROR([Python interpreter is too old])])
+ am_display_PYTHON=$PYTHON
+ else
+ # Otherwise, try each interpreter until we find one that satisfies
+ # VERSION.
+ AC_CACHE_CHECK([for a Python interpreter with version >= $1],
+ [am_cv_pathless_PYTHON],[
+ for am_cv_pathless_PYTHON in _AM_PYTHON_INTERPRETER_LIST none; do
+ test "$am_cv_pathless_PYTHON" = none && break
+ AM_PYTHON_CHECK_VERSION([$am_cv_pathless_PYTHON], [$1], [break])
+ done])
+ # Set $PYTHON to the absolute path of $am_cv_pathless_PYTHON.
+ if test "$am_cv_pathless_PYTHON" = none; then
+ PYTHON=:
+ else
+ AC_PATH_PROG([PYTHON], [$am_cv_pathless_PYTHON])
+ fi
+ am_display_PYTHON=$am_cv_pathless_PYTHON
+ fi
+ ])
+
+ if test "$PYTHON" = :; then
+ dnl Run any user-specified action, or abort.
+ m4_default([$3], [AC_MSG_ERROR([no suitable Python interpreter found])])
+ else
+
+ dnl Query Python for its version number. Getting [:3] seems to be
+ dnl the best way to do this; it's what "site.py" does in the standard
+ dnl library.
+
+ AC_CACHE_CHECK([for $am_display_PYTHON version], [am_cv_python_version],
+ [am_cv_python_version=`$PYTHON -c "import sys; sys.stdout.write(sys.version[[:3]])"`])
+ AC_SUBST([PYTHON_VERSION], [$am_cv_python_version])
+
+ dnl Use the values of $prefix and $exec_prefix for the corresponding
+ dnl values of PYTHON_PREFIX and PYTHON_EXEC_PREFIX. These are made
+ dnl distinct variables so they can be overridden if need be. However,
+ dnl general consensus is that you shouldn't need this ability.
+
+ AC_SUBST([PYTHON_PREFIX], ['${prefix}'])
+ AC_SUBST([PYTHON_EXEC_PREFIX], ['${exec_prefix}'])
+
+ dnl At times (like when building shared libraries) you may want
+ dnl to know which OS platform Python thinks this is.
+
+ AC_CACHE_CHECK([for $am_display_PYTHON platform], [am_cv_python_platform],
+ [am_cv_python_platform=`$PYTHON -c "import sys; sys.stdout.write(sys.platform)"`])
+ AC_SUBST([PYTHON_PLATFORM], [$am_cv_python_platform])
+
+ # Just factor out some code duplication.
+ am_python_setup_sysconfig="\
+import sys
+# Prefer sysconfig over distutils.sysconfig, for better compatibility
+# with python 3.x. See automake bug#10227.
+try:
+ import sysconfig
+except ImportError:
+ can_use_sysconfig = 0
+else:
+ can_use_sysconfig = 1
+# Can't use sysconfig in CPython 2.7, since it's broken in virtualenvs:
+# <https://github.com/pypa/virtualenv/issues/118>
+try:
+ from platform import python_implementation
+ if python_implementation() == 'CPython' and sys.version[[:3]] == '2.7':
+ can_use_sysconfig = 0
+except ImportError:
+ pass"
+
+ dnl Set up 4 directories:
+
+ dnl pythondir -- where to install python scripts. This is the
+ dnl site-packages directory, not the python standard library
+ dnl directory like in previous automake betas. This behavior
+ dnl is more consistent with lispdir.m4 for example.
+ dnl Query distutils for this directory.
+ AC_CACHE_CHECK([for $am_display_PYTHON script directory],
+ [am_cv_python_pythondir],
+ [if test "x$prefix" = xNONE
+ then
+ am_py_prefix=$ac_default_prefix
+ else
+ am_py_prefix=$prefix
+ fi
+ am_cv_python_pythondir=`$PYTHON -c "
+$am_python_setup_sysconfig
+if can_use_sysconfig:
+ sitedir = sysconfig.get_path('purelib', vars={'base':'$am_py_prefix'})
+else:
+ from distutils import sysconfig
+ sitedir = sysconfig.get_python_lib(0, 0, prefix='$am_py_prefix')
+sys.stdout.write(sitedir)"`
+ case $am_cv_python_pythondir in
+ $am_py_prefix*)
+ am__strip_prefix=`echo "$am_py_prefix" | sed 's|.|.|g'`
+ am_cv_python_pythondir=`echo "$am_cv_python_pythondir" | sed "s,^$am__strip_prefix,$PYTHON_PREFIX,"`
+ ;;
+ *)
+ case $am_py_prefix in
+ /usr|/System*) ;;
+ *)
+ am_cv_python_pythondir=$PYTHON_PREFIX/lib/python$PYTHON_VERSION/site-packages
+ ;;
+ esac
+ ;;
+ esac
+ ])
+ AC_SUBST([pythondir], [$am_cv_python_pythondir])
+
+ dnl pkgpythondir -- $PACKAGE directory under pythondir. Was
+ dnl PYTHON_SITE_PACKAGE in previous betas, but this naming is
+ dnl more consistent with the rest of automake.
+
+ AC_SUBST([pkgpythondir], [\${pythondir}/$PACKAGE])
+
+ dnl pyexecdir -- directory for installing python extension modules
+ dnl (shared libraries)
+ dnl Query distutils for this directory.
+ AC_CACHE_CHECK([for $am_display_PYTHON extension module directory],
+ [am_cv_python_pyexecdir],
+ [if test "x$exec_prefix" = xNONE
+ then
+ am_py_exec_prefix=$am_py_prefix
+ else
+ am_py_exec_prefix=$exec_prefix
+ fi
+ am_cv_python_pyexecdir=`$PYTHON -c "
+$am_python_setup_sysconfig
+if can_use_sysconfig:
+ sitedir = sysconfig.get_path('platlib', vars={'platbase':'$am_py_prefix'})
+else:
+ from distutils import sysconfig
+ sitedir = sysconfig.get_python_lib(1, 0, prefix='$am_py_prefix')
+sys.stdout.write(sitedir)"`
+ case $am_cv_python_pyexecdir in
+ $am_py_exec_prefix*)
+ am__strip_prefix=`echo "$am_py_exec_prefix" | sed 's|.|.|g'`
+ am_cv_python_pyexecdir=`echo "$am_cv_python_pyexecdir" | sed "s,^$am__strip_prefix,$PYTHON_EXEC_PREFIX,"`
+ ;;
+ *)
+ case $am_py_exec_prefix in
+ /usr|/System*) ;;
+ *)
+ am_cv_python_pyexecdir=$PYTHON_EXEC_PREFIX/lib/python$PYTHON_VERSION/site-packages
+ ;;
+ esac
+ ;;
+ esac
+ ])
+ AC_SUBST([pyexecdir], [$am_cv_python_pyexecdir])
+
+ dnl pkgpyexecdir -- $(pyexecdir)/$(PACKAGE)
+
+ AC_SUBST([pkgpyexecdir], [\${pyexecdir}/$PACKAGE])
+
+ dnl Run any user-specified action.
+ $2
+ fi
+
+])
+
+
+# AM_PYTHON_CHECK_VERSION(PROG, VERSION, [ACTION-IF-TRUE], [ACTION-IF-FALSE])
+# ---------------------------------------------------------------------------
+# Run ACTION-IF-TRUE if the Python interpreter PROG has version >= VERSION.
+# Run ACTION-IF-FALSE otherwise.
+# This test uses sys.hexversion instead of the string equivalent (first
+# word of sys.version), in order to cope with versions such as 2.2c1.
+# This supports Python 2.0 or higher. (2.0 was released on October 16, 2000).
+AC_DEFUN([AM_PYTHON_CHECK_VERSION],
+ [prog="import sys
+# split strings by '.' and convert to numeric. Append some zeros
+# because we need at least 4 digits for the hex conversion.
+# map returns an iterator in Python 3.0 and a list in 2.x
+minver = list(map(int, '$2'.split('.'))) + [[0, 0, 0]]
+minverhex = 0
+# xrange is not present in Python 3.0 and range returns an iterator
+for i in list(range(0, 4)): minverhex = (minverhex << 8) + minver[[i]]
+sys.exit(sys.hexversion < minverhex)"
+ AS_IF([AM_RUN_LOG([$1 -c "$prog"])], [$3], [$4])])
+
+# Copyright (C) 2001-2013 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
# AM_RUN_LOG(COMMAND)
# -------------------
@@ -854,22 +1038,16 @@ AC_DEFUN([AM_RUN_LOG],
# Check to make sure that the build environment is sane. -*- Autoconf -*-
-# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008
-# Free Software Foundation, Inc.
+# Copyright (C) 1996-2013 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
-# serial 5
-
# AM_SANITY_CHECK
# ---------------
AC_DEFUN([AM_SANITY_CHECK],
[AC_MSG_CHECKING([whether build environment is sane])
-# Just in case
-sleep 1
-echo timestamp > conftest.file
# Reject unsafe characters in $srcdir or the absolute working directory
# name. Accept space and tab only in the latter.
am_lf='
@@ -880,32 +1058,40 @@ case `pwd` in
esac
case $srcdir in
*[[\\\"\#\$\&\'\`$am_lf\ \ ]]*)
- AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);;
+ AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
esac
-# Do `set' in a subshell so we don't clobber the current shell's
+# Do 'set' in a subshell so we don't clobber the current shell's
# arguments. Must try -L first in case configure is actually a
# symlink; some systems play weird games with the mod time of symlinks
# (eg FreeBSD returns the mod time of the symlink's containing
# directory).
if (
- set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
- if test "$[*]" = "X"; then
- # -L didn't work.
- set X `ls -t "$srcdir/configure" conftest.file`
- fi
- rm -f conftest.file
- if test "$[*]" != "X $srcdir/configure conftest.file" \
- && test "$[*]" != "X conftest.file $srcdir/configure"; then
-
- # If neither matched, then we have a broken ls. This can happen
- # if, for instance, CONFIG_SHELL is bash and it inherits a
- # broken ls alias from the environment. This has actually
- # happened. Such a system could not be considered "sane".
- AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
-alias in your environment])
- fi
-
+ am_has_slept=no
+ for am_try in 1 2; do
+ echo "timestamp, slept: $am_has_slept" > conftest.file
+ set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
+ if test "$[*]" = "X"; then
+ # -L didn't work.
+ set X `ls -t "$srcdir/configure" conftest.file`
+ fi
+ if test "$[*]" != "X $srcdir/configure conftest.file" \
+ && test "$[*]" != "X conftest.file $srcdir/configure"; then
+
+ # If neither matched, then we have a broken ls. This can happen
+ # if, for instance, CONFIG_SHELL is bash and it inherits a
+ # broken ls alias from the environment. This has actually
+ # happened. Such a system could not be considered "sane".
+ AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
+ alias in your environment])
+ fi
+ if test "$[2]" = conftest.file || test $am_try -eq 2; then
+ break
+ fi
+ # Just in case.
+ sleep 1
+ am_has_slept=yes
+ done
test "$[2]" = conftest.file
)
then
@@ -915,31 +1101,50 @@ else
AC_MSG_ERROR([newly created file is older than distributed files!
Check your system clock])
fi
-AC_MSG_RESULT(yes)])
+AC_MSG_RESULT([yes])
+# If we didn't sleep, we still need to ensure time stamps of config.status and
+# generated files are strictly newer.
+am_sleep_pid=
+if grep 'slept: no' conftest.file >/dev/null 2>&1; then
+ ( sleep 1 ) &
+ am_sleep_pid=$!
+fi
+AC_CONFIG_COMMANDS_PRE(
+ [AC_MSG_CHECKING([that generated files are newer than configure])
+ if test -n "$am_sleep_pid"; then
+ # Hide warnings about reused PIDs.
+ wait $am_sleep_pid 2>/dev/null
+ fi
+ AC_MSG_RESULT([done])])
+rm -f conftest.file
+])
-# Copyright (C) 2009, 2011 Free Software Foundation, Inc.
+# Copyright (C) 2009-2013 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
-# serial 2
-
# AM_SILENT_RULES([DEFAULT])
# --------------------------
# Enable less verbose build rules; with the default set to DEFAULT
-# (`yes' being less verbose, `no' or empty being verbose).
+# ("yes" being less verbose, "no" or empty being verbose).
AC_DEFUN([AM_SILENT_RULES],
-[AC_ARG_ENABLE([silent-rules],
-[ --enable-silent-rules less verbose build output (undo: `make V=1')
- --disable-silent-rules verbose build output (undo: `make V=0')])
-case $enable_silent_rules in
-yes) AM_DEFAULT_VERBOSITY=0;;
-no) AM_DEFAULT_VERBOSITY=1;;
-*) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
+[AC_ARG_ENABLE([silent-rules], [dnl
+AS_HELP_STRING(
+ [--enable-silent-rules],
+ [less verbose build output (undo: "make V=1")])
+AS_HELP_STRING(
+ [--disable-silent-rules],
+ [verbose build output (undo: "make V=0")])dnl
+])
+case $enable_silent_rules in @%:@ (((
+ yes) AM_DEFAULT_VERBOSITY=0;;
+ no) AM_DEFAULT_VERBOSITY=1;;
+ *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
esac
dnl
-dnl A few `make' implementations (e.g., NonStop OS and NextStep)
+dnl A few 'make' implementations (e.g., NonStop OS and NextStep)
dnl do not support nested variable expansions.
dnl See automake bug#9928 and bug#10237.
am_make=${MAKE-make}
@@ -957,7 +1162,7 @@ else
am_cv_make_support_nested_variables=no
fi])
if test $am_cv_make_support_nested_variables = yes; then
- dnl Using `$V' instead of `$(V)' breaks IRIX make.
+ dnl Using '$V' instead of '$(V)' breaks IRIX make.
AM_V='$(V)'
AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
else
@@ -974,44 +1179,40 @@ AC_SUBST([AM_BACKSLASH])dnl
_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
])
-# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc.
+# Copyright (C) 2001-2013 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
-# serial 1
-
# AM_PROG_INSTALL_STRIP
# ---------------------
-# One issue with vendor `install' (even GNU) is that you can't
+# One issue with vendor 'install' (even GNU) is that you can't
# specify the program used to strip binaries. This is especially
# annoying in cross-compiling environments, where the build's strip
# is unlikely to handle the host's binaries.
# Fortunately install-sh will honor a STRIPPROG variable, so we
-# always use install-sh in `make install-strip', and initialize
+# always use install-sh in "make install-strip", and initialize
# STRIPPROG with the value of the STRIP variable (set by the user).
AC_DEFUN([AM_PROG_INSTALL_STRIP],
[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
-# Installed binaries are usually stripped using `strip' when the user
-# run `make install-strip'. However `strip' might not be the right
+# Installed binaries are usually stripped using 'strip' when the user
+# run "make install-strip". However 'strip' might not be the right
# tool to use in cross-compilation environments, therefore Automake
-# will honor the `STRIP' environment variable to overrule this program.
-dnl Don't test for $cross_compiling = yes, because it might be `maybe'.
+# will honor the 'STRIP' environment variable to overrule this program.
+dnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
if test "$cross_compiling" != no; then
AC_CHECK_TOOL([STRIP], [strip], :)
fi
INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
AC_SUBST([INSTALL_STRIP_PROGRAM])])
-# Copyright (C) 2006, 2008, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2006-2013 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
-# serial 3
-
# _AM_SUBST_NOTMAKE(VARIABLE)
# ---------------------------
# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
@@ -1025,18 +1226,16 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
# Check how to create a tarball. -*- Autoconf -*-
-# Copyright (C) 2004, 2005, 2012 Free Software Foundation, Inc.
+# Copyright (C) 2004-2013 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
-# serial 2
-
# _AM_PROG_TAR(FORMAT)
# --------------------
# Check how to create a tarball in format FORMAT.
-# FORMAT should be one of `v7', `ustar', or `pax'.
+# FORMAT should be one of 'v7', 'ustar', or 'pax'.
#
# Substitute a variable $(am__tar) that is a command
# writing to stdout a FORMAT-tarball containing the directory
@@ -1046,76 +1245,114 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
# Substitute a variable $(am__untar) that extract such
# a tarball read from stdin.
# $(am__untar) < result.tar
+#
AC_DEFUN([_AM_PROG_TAR],
[# Always define AMTAR for backward compatibility. Yes, it's still used
# in the wild :-( We should find a proper way to deprecate it ...
AC_SUBST([AMTAR], ['$${TAR-tar}'])
-m4_if([$1], [v7],
- [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
- [m4_case([$1], [ustar],, [pax],,
- [m4_fatal([Unknown tar format])])
-AC_MSG_CHECKING([how to create a $1 tar archive])
-# Loop over all known methods to create a tar archive until one works.
+
+# We'll loop over all known methods to create a tar archive until one works.
_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
-_am_tools=${am_cv_prog_tar_$1-$_am_tools}
-# Do not fold the above two line into one, because Tru64 sh and
-# Solaris sh will not grok spaces in the rhs of `-'.
-for _am_tool in $_am_tools
-do
- case $_am_tool in
- gnutar)
- for _am_tar in tar gnutar gtar;
- do
- AM_RUN_LOG([$_am_tar --version]) && break
- done
- am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
- am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
- am__untar="$_am_tar -xf -"
- ;;
- plaintar)
- # Must skip GNU tar: if it does not support --format= it doesn't create
- # ustar tarball either.
- (tar --version) >/dev/null 2>&1 && continue
- am__tar='tar chf - "$$tardir"'
- am__tar_='tar chf - "$tardir"'
- am__untar='tar xf -'
- ;;
- pax)
- am__tar='pax -L -x $1 -w "$$tardir"'
- am__tar_='pax -L -x $1 -w "$tardir"'
- am__untar='pax -r'
- ;;
- cpio)
- am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
- am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
- am__untar='cpio -i -H $1 -d'
- ;;
- none)
- am__tar=false
- am__tar_=false
- am__untar=false
- ;;
- esac
- # If the value was cached, stop now. We just wanted to have am__tar
- # and am__untar set.
- test -n "${am_cv_prog_tar_$1}" && break
+m4_if([$1], [v7],
+ [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
+
+ [m4_case([$1],
+ [ustar],
+ [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
+ # There is notably a 21 bits limit for the UID and the GID. In fact,
+ # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
+ # and bug#13588).
+ am_max_uid=2097151 # 2^21 - 1
+ am_max_gid=$am_max_uid
+ # The $UID and $GID variables are not portable, so we need to resort
+ # to the POSIX-mandated id(1) utility. Errors in the 'id' calls
+ # below are definitely unexpected, so allow the users to see them
+ # (that is, avoid stderr redirection).
+ am_uid=`id -u || echo unknown`
+ am_gid=`id -g || echo unknown`
+ AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
+ if test $am_uid -le $am_max_uid; then
+ AC_MSG_RESULT([yes])
+ else
+ AC_MSG_RESULT([no])
+ _am_tools=none
+ fi
+ AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
+ if test $am_gid -le $am_max_gid; then
+ AC_MSG_RESULT([yes])
+ else
+ AC_MSG_RESULT([no])
+ _am_tools=none
+ fi],
+
+ [pax],
+ [],
+
+ [m4_fatal([Unknown tar format])])
+
+ AC_MSG_CHECKING([how to create a $1 tar archive])
+
+ # Go ahead even if we have the value already cached. We do so because we
+ # need to set the values for the 'am__tar' and 'am__untar' variables.
+ _am_tools=${am_cv_prog_tar_$1-$_am_tools}
+
+ for _am_tool in $_am_tools; do
+ case $_am_tool in
+ gnutar)
+ for _am_tar in tar gnutar gtar; do
+ AM_RUN_LOG([$_am_tar --version]) && break
+ done
+ am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
+ am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
+ am__untar="$_am_tar -xf -"
+ ;;
+ plaintar)
+ # Must skip GNU tar: if it does not support --format= it doesn't create
+ # ustar tarball either.
+ (tar --version) >/dev/null 2>&1 && continue
+ am__tar='tar chf - "$$tardir"'
+ am__tar_='tar chf - "$tardir"'
+ am__untar='tar xf -'
+ ;;
+ pax)
+ am__tar='pax -L -x $1 -w "$$tardir"'
+ am__tar_='pax -L -x $1 -w "$tardir"'
+ am__untar='pax -r'
+ ;;
+ cpio)
+ am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
+ am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
+ am__untar='cpio -i -H $1 -d'
+ ;;
+ none)
+ am__tar=false
+ am__tar_=false
+ am__untar=false
+ ;;
+ esac
- # tar/untar a dummy directory, and stop if the command works
- rm -rf conftest.dir
- mkdir conftest.dir
- echo GrepMe > conftest.dir/file
- AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
+ # If the value was cached, stop now. We just wanted to have am__tar
+ # and am__untar set.
+ test -n "${am_cv_prog_tar_$1}" && break
+
+ # tar/untar a dummy directory, and stop if the command works.
+ rm -rf conftest.dir
+ mkdir conftest.dir
+ echo GrepMe > conftest.dir/file
+ AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
+ rm -rf conftest.dir
+ if test -s conftest.tar; then
+ AM_RUN_LOG([$am__untar <conftest.tar])
+ AM_RUN_LOG([cat conftest.dir/file])
+ grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
+ fi
+ done
rm -rf conftest.dir
- if test -s conftest.tar; then
- AM_RUN_LOG([$am__untar <conftest.tar])
- grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
- fi
-done
-rm -rf conftest.dir
-AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
-AC_MSG_RESULT([$am_cv_prog_tar_$1])])
+ AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
+ AC_MSG_RESULT([$am_cv_prog_tar_$1])])
+
AC_SUBST([am__tar])
AC_SUBST([am__untar])
]) # _AM_PROG_TAR
diff --git a/autogen.sh b/autogen.sh
index 1b560ac..f9fd3f0 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -1,13 +1,25 @@
#!/bin/sh
+#
+# gst-libav autogen.sh
+#
# Run this to generate all the initial makefiles, etc.
+#
+# This file has been generated from common/autogen.sh.in via common/update-autogen
+
+
+test -n "$srcdir" || srcdir=`dirname "$0"`
+test -n "$srcdir" || srcdir=.
+
+olddir=`pwd`
+cd "$srcdir"
DIE=0
package=gst-libav
-srcfile=configure.ac
+srcfile=gst-libav.doap
-# make sure we have common
-if test ! -f common/gst-autogen.sh -o ! -f gst-libs/ext/libav/configure ;
-then
+# Make sure we have common
+if test ! -f common/gst-autogen.sh;
+then
echo "+ Setting up common submodule"
git submodule init
fi
@@ -29,14 +41,28 @@ then
ln -s ../../common/hooks/pre-commit.hook .git/hooks/pre-commit
fi
+# GNU gettext automake support doesn't get along with git.
+# https://bugzilla.gnome.org/show_bug.cgi?id=661128
+if test -d po ; then
+ touch -t 200001010000 po/gst-libav-1.0.pot
+fi
+
+CONFIGURE_DEF_OPT='--enable-maintainer-mode --enable-gtk-doc'
+
+if test "x$package" = "xgstreamer"; then
+ CONFIGURE_DEF_OPT="$CONFIGURE_DEF_OPT --enable-docbook --enable-failing-tests --enable-poisoning"
+fi
+
autogen_options $@
printf "+ check for build tools"
-if test ! -z "$NOCHECK"; then echo " skipped"; else echo; fi
-version_check "autoconf" "$AUTOCONF autoconf autoconf270 autoconf269 autoconf268 autoconf267 autoconf266 autoconf265 autoconf264 autoconf263 autoconf262" \
- "ftp://ftp.gnu.org/pub/gnu/autoconf/" 2 62 || DIE=1
+if test ! -z "$NOCHECK"; then echo ": skipped version checks"; else echo; fi
+version_check "autoconf" "$AUTOCONF autoconf autoconf270 autoconf269 autoconf268 " \
+ "ftp://ftp.gnu.org/pub/gnu/autoconf/" 2 68 || DIE=1
version_check "automake" "$AUTOMAKE automake automake-1.11" \
"ftp://ftp.gnu.org/pub/gnu/automake/" 1 11 || DIE=1
+version_check "autopoint" "autopoint" \
+ "ftp://ftp.gnu.org/pub/gnu/gettext/" 0 17 || DIE=1
version_check "libtoolize" "$LIBTOOLIZE libtoolize glibtoolize" \
"ftp://ftp.gnu.org/pub/gnu/libtool/" 2 2 6 || DIE=1
version_check "pkg-config" "" \
@@ -50,7 +76,7 @@ autoheader_check || DIE=1
die_check $DIE
# if no arguments specified then this will be printed
-if test -z "$*"; then
+if test -z "$*" && test -z "$NOCONFIGURE"; then
echo "+ checking for autogen.sh options"
echo " This autogen script will automatically run ./configure as:"
echo " ./configure $CONFIGURE_DEF_OPT"
@@ -60,6 +86,20 @@ fi
toplevel_check $srcfile
+# autopoint
+# first remove patch if necessary, then run autopoint, then reapply
+if test -d po ; then
+ if test -f po/Makefile.in.in;
+ then
+ patch -p0 -R --forward < common/gettext.patch
+ fi
+ tool_run "$autopoint" "--force" "patch -p0 < common/gettext.patch"
+ patch -p0 < common/gettext.patch
+fi
+
+# aclocal
+if test -f acinclude.m4; then rm acinclude.m4; fi
+
tool_run "$libtoolize" "--copy --force"
tool_run "$aclocal" "-I m4 -I common/m4 $ACLOCAL_FLAGS"
tool_run "$autoheader"
@@ -68,21 +108,8 @@ tool_run "$autoheader"
echo timestamp > stamp-h.in 2> /dev/null
tool_run "$autoconf"
-tool_run "$automake" "-a -c -Wno-portability"
-
-# if enable exists, add an -enable option for each of the lines in that file
-if test -f enable; then
- for a in `cat enable`; do
- CONFIGURE_FILE_OPT="--enable-$a"
- done
-fi
-
-# if disable exists, add an -disable option for each of the lines in that file
-if test -f disable; then
- for a in `cat disable`; do
- CONFIGURE_FILE_OPT="$CONFIGURE_FILE_OPT --disable-$a"
- done
-fi
+debug "automake: $automake"
+tool_run "$automake" "--add-missing --copy"
test -n "$NOCONFIGURE" && {
echo "+ skipping configure stage for package $package, as requested."
@@ -90,16 +117,17 @@ test -n "$NOCONFIGURE" && {
exit 0
}
+cd "$olddir"
+
echo "+ running configure ... "
-test ! -z "$CONFIGURE_DEF_OPT" && echo " ./configure default flags: $CONFIGURE_DEF_OPT"
-test ! -z "$CONFIGURE_EXT_OPT" && echo " ./configure external flags: $CONFIGURE_EXT_OPT"
-test ! -z "$CONFIGURE_FILE_OPT" && echo " ./configure enable/disable flags: $CONFIGURE_FILE_OPT"
+test ! -z "$CONFIGURE_DEF_OPT" && echo " default flags: $CONFIGURE_DEF_OPT"
+test ! -z "$CONFIGURE_EXT_OPT" && echo " external flags: $CONFIGURE_EXT_OPT"
echo
-./configure $CONFIGURE_DEF_OPT $CONFIGURE_EXT_OPT $CONFIGURE_FILE_OPT || {
+echo "$srcdir/configure" $CONFIGURE_DEF_OPT $CONFIGURE_EXT_OPT
+"$srcdir/configure" $CONFIGURE_DEF_OPT $CONFIGURE_EXT_OPT || {
echo " configure failed"
exit 1
}
-echo
echo "Now type 'make' to compile $package."
diff --git a/common/Makefile.in b/common/Makefile.in
index 7a645f9..a6545f7 100644
--- a/common/Makefile.in
+++ b/common/Makefile.in
@@ -1,9 +1,8 @@
-# Makefile.in generated by automake 1.11.6 from Makefile.am.
+# Makefile.in generated by automake 1.13.3 from Makefile.am.
# @configure_input@
-# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-# Foundation, Inc.
+# Copyright (C) 1994-2013 Free Software Foundation, Inc.
+
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -15,23 +14,51 @@
@SET_MAKE@
VPATH = @srcdir@
-am__make_dryrun = \
- { \
- am__dry=no; \
+am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
+am__make_running_with_option = \
+ case $${target_option-} in \
+ ?) ;; \
+ *) echo "am__make_running_with_option: internal error: invalid" \
+ "target option '$${target_option-}' specified" >&2; \
+ exit 1;; \
+ esac; \
+ has_opt=no; \
+ sane_makeflags=$$MAKEFLAGS; \
+ if $(am__is_gnu_make); then \
+ sane_makeflags=$$MFLAGS; \
+ else \
case $$MAKEFLAGS in \
*\\[\ \ ]*) \
- echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
- | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
- *) \
- for am__flg in $$MAKEFLAGS; do \
- case $$am__flg in \
- *=*|--*) ;; \
- *n*) am__dry=yes; break;; \
- esac; \
- done;; \
+ bs=\\; \
+ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
+ esac; \
+ fi; \
+ skip_next=no; \
+ strip_trailopt () \
+ { \
+ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+ }; \
+ for flg in $$sane_makeflags; do \
+ test $$skip_next = yes && { skip_next=no; continue; }; \
+ case $$flg in \
+ *=*|--*) continue;; \
+ -*I) strip_trailopt 'I'; skip_next=yes;; \
+ -*I?*) strip_trailopt 'I';; \
+ -*O) strip_trailopt 'O'; skip_next=yes;; \
+ -*O?*) strip_trailopt 'O';; \
+ -*l) strip_trailopt 'l'; skip_next=yes;; \
+ -*l?*) strip_trailopt 'l';; \
+ -[dEDm]) skip_next=yes;; \
+ -[JT]) skip_next=yes;; \
+ esac; \
+ case $$flg in \
+ *$$target_option*) has_opt=yes; break;; \
esac; \
- test $$am__dry = yes; \
- }
+ done; \
+ test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
@@ -52,7 +79,8 @@ build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
subdir = common
-DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ChangeLog
+DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am ChangeLog \
+ README
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/common/m4/as-ac-expand.m4 \
$(top_srcdir)/common/m4/as-auto-alt.m4 \
@@ -82,21 +110,28 @@ mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
+AM_V_P = $(am__v_P_@AM_V@)
+am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
+am__v_P_0 = false
+am__v_P_1 = :
AM_V_GEN = $(am__v_GEN_@AM_V@)
am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
-am__v_GEN_0 = @echo " GEN " $@;
+am__v_GEN_0 = @echo " GEN " $@;
+am__v_GEN_1 =
AM_V_at = $(am__v_at_@AM_V@)
am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
am__v_at_0 = @
+am__v_at_1 =
SOURCES =
DIST_SOURCES =
-RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
- html-recursive info-recursive install-data-recursive \
- install-dvi-recursive install-exec-recursive \
- install-html-recursive install-info-recursive \
- install-pdf-recursive install-ps-recursive install-recursive \
- installcheck-recursive installdirs-recursive pdf-recursive \
- ps-recursive uninstall-recursive
+RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \
+ ctags-recursive dvi-recursive html-recursive info-recursive \
+ install-data-recursive install-dvi-recursive \
+ install-exec-recursive install-html-recursive \
+ install-info-recursive install-pdf-recursive \
+ install-ps-recursive install-recursive installcheck-recursive \
+ installdirs-recursive pdf-recursive ps-recursive \
+ tags-recursive uninstall-recursive
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
@@ -104,9 +139,29 @@ am__can_run_installinfo = \
esac
RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
distclean-recursive maintainer-clean-recursive
-AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
- $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
+am__recursive_targets = \
+ $(RECURSIVE_TARGETS) \
+ $(RECURSIVE_CLEAN_TARGETS) \
+ $(am__extra_recursive_targets)
+AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \
distdir
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
+# Read a list of newline-separated strings from the standard input,
+# and print each of them once, without duplicates. Input order is
+# *not* preserved.
+am__uniquify_input = $(AWK) '\
+ BEGIN { nonempty = 0; } \
+ { items[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in items) print i; }; } \
+'
+# Make sure the list of sources is unique. This is necessary because,
+# e.g., the same source file might be shared among _SOURCES variables
+# for different programs/libraries.
+am__define_uniq_tagged_files = \
+ list='$(am__tagged_files)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | $(am__uniquify_input)`
ETAGS = etags
CTAGS = ctags
DIST_SUBDIRS = $(SUBDIRS)
@@ -149,10 +204,12 @@ AWK = @AWK@
CAT_ENTRY_END = @CAT_ENTRY_END@
CAT_ENTRY_START = @CAT_ENTRY_START@
CC = @CC@
+CCASFLAGS = @CCASFLAGS@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
+CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DARWIN_LDFLAGS = @DARWIN_LDFLAGS@
DEFS = @DEFS@
@@ -168,7 +225,11 @@ ECHO_T = @ECHO_T@
EGREP = @EGREP@
ERROR_CFLAGS = @ERROR_CFLAGS@
EXEEXT = @EXEEXT@
+FFLAGS = @FFLAGS@
FGREP = @FGREP@
+GCOV = @GCOV@
+GCOV_CFLAGS = @GCOV_CFLAGS@
+GCOV_LIBS = @GCOV_LIBS@
GREP = @GREP@
GSTPB_PLUGINS_DIR = @GSTPB_PLUGINS_DIR@
GST_AGE = @GST_AGE@
@@ -201,16 +262,15 @@ GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@
GTKDOC_MKPDF = @GTKDOC_MKPDF@
GTKDOC_REBASE = @GTKDOC_REBASE@
HAVE_BZ2 = @HAVE_BZ2@
-HAVE_DOCBOOK2HTML = @HAVE_DOCBOOK2HTML@
HAVE_DOCBOOK2PS = @HAVE_DOCBOOK2PS@
HAVE_DVIPS = @HAVE_DVIPS@
HAVE_EPSTOPDF = @HAVE_EPSTOPDF@
-HAVE_FIG2DEV = @HAVE_FIG2DEV@
HAVE_JADETEX = @HAVE_JADETEX@
HAVE_PNGTOPNM = @HAVE_PNGTOPNM@
HAVE_PNMTOPS = @HAVE_PNMTOPS@
HAVE_PS2PDF = @HAVE_PS2PDF@
HAVE_XMLLINT = @HAVE_XMLLINT@
+HAVE_XSLTPROC = @HAVE_XSLTPROC@
HTML_DIR = @HTML_DIR@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
@@ -410,22 +470,25 @@ clean-libtool:
-rm -rf .libs _libs
# This directory's subdirectories are mostly independent; you can cd
-# into them and run `make' without going through this Makefile.
-# To change the values of `make' variables: instead of editing Makefiles,
-# (1) if the variable is set in `config.status', edit `config.status'
-# (which will cause the Makefiles to be regenerated when you run `make');
-# (2) otherwise, pass the desired values on the `make' command line.
-$(RECURSIVE_TARGETS):
- @fail= failcom='exit 1'; \
- for f in x $$MAKEFLAGS; do \
- case $$f in \
- *=* | --[!k]*);; \
- *k*) failcom='fail=yes';; \
- esac; \
- done; \
+# into them and run 'make' without going through this Makefile.
+# To change the values of 'make' variables: instead of editing Makefiles,
+# (1) if the variable is set in 'config.status', edit 'config.status'
+# (which will cause the Makefiles to be regenerated when you run 'make');
+# (2) otherwise, pass the desired values on the 'make' command line.
+$(am__recursive_targets):
+ @fail=; \
+ if $(am__make_keepgoing); then \
+ failcom='fail=yes'; \
+ else \
+ failcom='exit 1'; \
+ fi; \
dot_seen=no; \
target=`echo $@ | sed s/-recursive//`; \
- list='$(SUBDIRS)'; for subdir in $$list; do \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ for subdir in $$list; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
dot_seen=yes; \
@@ -440,57 +503,12 @@ $(RECURSIVE_TARGETS):
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
fi; test -z "$$fail"
-$(RECURSIVE_CLEAN_TARGETS):
- @fail= failcom='exit 1'; \
- for f in x $$MAKEFLAGS; do \
- case $$f in \
- *=* | --[!k]*);; \
- *k*) failcom='fail=yes';; \
- esac; \
- done; \
- dot_seen=no; \
- case "$@" in \
- distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
- *) list='$(SUBDIRS)' ;; \
- esac; \
- rev=''; for subdir in $$list; do \
- if test "$$subdir" = "."; then :; else \
- rev="$$subdir $$rev"; \
- fi; \
- done; \
- rev="$$rev ."; \
- target=`echo $@ | sed s/-recursive//`; \
- for subdir in $$rev; do \
- echo "Making $$target in $$subdir"; \
- if test "$$subdir" = "."; then \
- local_target="$$target-am"; \
- else \
- local_target="$$target"; \
- fi; \
- ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
- || eval $$failcom; \
- done && test -z "$$fail"
-tags-recursive:
- list='$(SUBDIRS)'; for subdir in $$list; do \
- test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
- done
-ctags-recursive:
- list='$(SUBDIRS)'; for subdir in $$list; do \
- test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
- done
+ID: $(am__tagged_files)
+ $(am__define_uniq_tagged_files); mkid -fID $$unique
+tags: tags-recursive
+TAGS: tags
-ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
- list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
- unique=`for i in $$list; do \
- if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
- done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
- mkid -fID $$unique
-tags: TAGS
-
-TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
- $(TAGS_FILES) $(LISP)
+tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
set x; \
here=`pwd`; \
if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
@@ -506,12 +524,7 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
fi; \
done; \
- list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
- unique=`for i in $$list; do \
- if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
- done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
+ $(am__define_uniq_tagged_files); \
shift; \
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
@@ -523,15 +536,11 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$$unique; \
fi; \
fi
-ctags: CTAGS
-CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
- $(TAGS_FILES) $(LISP)
- list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
- unique=`for i in $$list; do \
- if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
- done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
+ctags: ctags-recursive
+
+CTAGS: ctags
+ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+ $(am__define_uniq_tagged_files); \
test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$unique
@@ -540,6 +549,21 @@ GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& $(am__cd) $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here"
+cscopelist: cscopelist-recursive
+
+cscopelist-am: $(am__tagged_files)
+ list='$(am__tagged_files)'; \
+ case "$(srcdir)" in \
+ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+ *) sdir=$(subdir)/$(srcdir) ;; \
+ esac; \
+ for i in $$list; do \
+ if test -f "$$i"; then \
+ echo "$(subdir)/$$i"; \
+ else \
+ echo "$$sdir/$$i"; \
+ fi; \
+ done >> $(top_builddir)/cscope.files
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
@@ -700,22 +724,20 @@ ps-am:
uninstall-am:
-.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \
- install-am install-strip tags-recursive
-
-.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
- all all-am check check-am clean clean-generic clean-libtool \
- ctags ctags-recursive distclean distclean-generic \
- distclean-libtool distclean-tags distdir dvi dvi-am html \
- html-am info info-am install install-am install-data \
- install-data-am install-dvi install-dvi-am install-exec \
- install-exec-am install-html install-html-am install-info \
- install-info-am install-man install-pdf install-pdf-am \
- install-ps install-ps-am install-strip installcheck \
- installcheck-am installdirs installdirs-am maintainer-clean \
- maintainer-clean-generic mostlyclean mostlyclean-generic \
- mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \
- uninstall uninstall-am
+.MAKE: $(am__recursive_targets) install-am install-strip
+
+.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \
+ check-am clean clean-generic clean-libtool cscopelist-am ctags \
+ ctags-am distclean distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ installdirs-am maintainer-clean maintainer-clean-generic \
+ mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \
+ ps ps-am tags tags-am uninstall uninstall-am
# Tell versions [3.59,3.63) of GNU make to not export all variables.
diff --git a/common/README b/common/README
new file mode 100644
index 0000000..83a1b88
--- /dev/null
+++ b/common/README
@@ -0,0 +1,255 @@
+GStreamer @SERIES_VERSION@
+
+WHAT IT IS
+----------
+
+This is GStreamer, a framework for streaming media.
+
+WHERE TO START
+--------------
+
+We have a website at
+http://gstreamer.freedesktop.org/
+
+You should start by going through our FAQ at
+http://gstreamer.freedesktop.org/data/doc/gstreamer/head/faq/html/
+
+There is more documentation; go to
+http://gstreamer.freedesktop.org/documentation
+
+You can subscribe to our mailing lists; see the website for details.
+
+We track bugs in GNOME's bugzilla; see the website for details.
+
+You can join us on IRC - #gstreamer on irc.freenode.org
+
+GStreamer 1.0 series
+--------------------
+
+Starring
+
+ GSTREAMER
+
+The core around which all other modules revolve. Base functionality and
+libraries, some essential elements, documentation, and testing.
+
+ BASE
+
+A well-groomed and well-maintained collection of GStreamer plug-ins and
+elements, spanning the range of possible types of elements one would want
+to write for GStreamer.
+
+And introducing, for the first time ever, on the development screen ...
+
+ THE GOOD
+
+ --- "Such ingratitude. After all the times I've saved your life."
+
+A collection of plug-ins you'd want to have right next to you on the
+battlefield. Shooting sharp and making no mistakes, these plug-ins have it
+all: good looks, good code, and good licensing. Documented and dressed up
+in tests. If you're looking for a role model to base your own plug-in on,
+here it is.
+
+If you find a plot hole or a badly lip-synced line of code in them,
+let us know - it is a matter of honour for us to ensure Blondie doesn't look
+like he's been walking 100 miles through the desert without water.
+
+ THE UGLY
+
+ --- "When you have to shoot, shoot. Don't talk."
+
+There are times when the world needs a color between black and white.
+Quality code to match the good's, but two-timing, backstabbing and ready to
+sell your freedom down the river. These plug-ins might have a patent noose
+around their neck, or a lock-up license, or any other problem that makes you
+think twice about shipping them.
+
+We don't call them ugly because we like them less. Does a mother love her
+son less because he's not as pretty as the other ones ? No - she commends
+him on his great personality. These plug-ins are the life of the party.
+And we'll still step in and set them straight if you report any unacceptable
+behaviour - because there are two kinds of people in the world, my friend:
+those with a rope around their neck and the people who do the cutting.
+
+ THE BAD
+
+ --- "That an accusation?"
+
+No perfectly groomed moustache or any amount of fine clothing is going to
+cover up the truth - these plug-ins are Bad with a capital B.
+They look fine on the outside, and might even appear to get the job done, but
+at the end of the day they're a black sheep. Without a golden-haired angel
+to watch over them, they'll probably land in an unmarked grave at the final
+showdown.
+
+Don't bug us about their quality - exercise your Free Software rights,
+patch up the offender and send us the patch on the fastest steed you can
+steal from the Confederates. Because you see, in this world, there's two
+kinds of people, my friend: those with loaded guns and those who dig.
+You dig.
+
+The Lowdown
+-----------
+
+ --- "I've never seen so many plug-ins wasted so badly."
+
+GStreamer Plug-ins has grown so big that it's hard to separate the wheat from
+the chaff. Also, distributors have brought up issues about the legal status
+of some of the plug-ins we ship. To remedy this, we've divided the previous
+set of available plug-ins into four modules:
+
+- gst-plugins-base: a small and fixed set of plug-ins, covering a wide range
+ of possible types of elements; these are continuously kept up-to-date
+ with any core changes during the development series.
+
+ - We believe distributors can safely ship these plug-ins.
+ - People writing elements should base their code on these elements.
+ - These elements come with examples, documentation, and regression tests.
+
+- gst-plugins-good: a set of plug-ins that we consider to have good quality
+ code, correct functionality, our preferred license (LGPL for the plug-in
+ code, LGPL or LGPL-compatible for the supporting library).
+
+ - We believe distributors can safely ship these plug-ins.
+ - People writing elements should base their code on these elements.
+
+- gst-plugins-ugly: a set of plug-ins that have good quality and correct
+ functionality, but distributing them might pose problems. The license
+ on either the plug-ins or the supporting libraries might not be how we'd
+ like. The code might be widely known to present patent problems.
+
+ - Distributors should check if they want/can ship these plug-ins.
+ - People writing elements should base their code on these elements.
+
+- gst-plugins-bad: a set of plug-ins that aren't up to par compared to the
+ rest. They might be close to being good quality, but they're missing
+ something - be it a good code review, some documentation, a set of tests,
+ a real live maintainer, or some actual wide use.
+ If the blanks are filled in they might be upgraded to become part of
+ either gst-plugins-good or gst-plugins-ugly, depending on the other factors.
+
+ - If the plug-ins break, you can't complain - instead, you can fix the
+ problem and send us a patch, or bribe someone into fixing them for you.
+ - New contributors can start here for things to work on.
+
+PLATFORMS
+---------
+
+- Linux is of course fully supported
+- FreeBSD is reported to work; other BSDs should work too
+- Solaris is reported to work; a specific sunaudiosink plugin has been written
+- MacOSX works, binary 1.x packages can be built using the cerbero build tool
+- Windows works; binary 1.x packages can be built using the cerbero build tool
+ - MSys/MinGW builds
+ - Microsoft Visual Studio builds are not yet available or supported
+- Android works, binary 1.x packages can be built using the cerbero build tool
+- iOS works
+
+INSTALLING FROM PACKAGES
+------------------------
+
+You should always prefer installing from packages first. GStreamer is
+well-maintained for a number of distributions, including Fedora, Debian,
+Ubuntu, Mandrake, Gentoo, ...
+
+Only in cases where you:
+- want to hack on GStreamer
+- want to verify that a bug has been fixed
+- do not have a sane distribution
+should you choose to build from source tarballs or git.
+
+Find more information about the various packages at
+http://gstreamer.freedesktop.org/download/
+
+COMPILING FROM SOURCE TARBALLS
+------------------------------
+
+- again, make sure that you really need to install from source !
+ If GStreamer is one of your first projects ever that you build from source,
+ consider taking on an easier project.
+
+- check output of ./configure --help to see if any options apply to you
+- run
+ ./configure
+ make
+
+ to build GStreamer.
+- if you want to install it (not required, but what you usually want to do), run
+ make install
+
+- try out a simple test:
+ gst-launch -v fakesrc num_buffers=5 ! fakesink
+ (If you didn't install GStreamer, prefix gst-launch with tools/)
+
+ If it outputs a bunch of messages from fakesrc and fakesink, everything is
+ ok.
+
+ If it did not work, keep in mind that you might need to adjust the
+ PATH and/or LD_LIBRARY_PATH environment variables to make the system
+ find GStreamer in the prefix where you installed (by default that is /usr/local).
+
+- After this, you're ready to install gst-plugins, which will provide the
+ functionality you're probably looking for by now, so go on and read
+ that README.
+
+COMPILING FROM GIT
+------------------
+
+When building from git sources, you will need to run autogen.sh to generate
+the build system files.
+
+You will need a set of additional tools typical for building from git,
+including:
+- autoconf
+- automake
+- libtool
+
+autogen.sh will check for recent enough versions and complain if you don't have
+them. You can also specify specific versions of automake and autoconf with
+--with-automake and --with-autoconf
+
+Check autogen.sh options by running autogen.sh --help
+
+autogen.sh can pass on arguments to configure
+
+When you have done this once, you can use autoregen.sh to re-autogen with
+the last passed options as a handy shortcut. Use it.
+
+After the autogen.sh stage, you can follow the directions listed in
+"COMPILING FROM SOURCE"
+
+You can also run your whole git stack uninstalled in your home directory,
+so that you can quickly test changes without affecting your system setup or
+interfering with GStreamer installed from packages. Many GStreamer developers
+use an uninstalled setup for their work.
+
+There is a 'create-uninstalled-setup.sh' script in
+
+ http://cgit.freedesktop.org/gstreamer/gstreamer/tree/scripts/
+
+to easily create an uninstalled setup from scratch.
+
+
+PLUG-IN DEPENDENCIES AND LICENSES
+---------------------------------
+
+GStreamer is developed under the terms of the LGPL (see LICENSE file for
+details). Some of our plug-ins however rely on libraries which are available
+under other licenses. This means that if you are distributing an application
+which has a non-GPL compatible license (for instance a closed-source
+application) with GStreamer, you have to make sure not to distribute GPL-linked
+plug-ins.
+
+When using GPL-linked plug-ins, GStreamer is for all practical reasons
+under the GPL itself.
+
+HISTORY
+-------
+
+The fundamental design comes from the video pipeline at Oregon Graduate
+Institute, as well as some ideas from DirectMedia. It's based on plug-ins that
+will provide the various codec and other functionality. The interface
+hopefully is generic enough for various companies (ahem, Apple) to release
+binary codecs for Linux, until such time as they get a clue and release the
+source.
diff --git a/common/c-to-xml.py b/common/c-to-xml.py
index 397c112..7a7a35b 100644
--- a/common/c-to-xml.py
+++ b/common/c-to-xml.py
@@ -5,6 +5,8 @@
Convert a C program to valid XML to be included in docbook
"""
+from __future__ import print_function, unicode_literals
+
import sys
import os
from xml.sax import saxutils
@@ -22,13 +24,13 @@ def main():
content = open(source, "r").read()
# print header
- print '<?xml version="1.0"?>'
- print '<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">'
- print
- print '<programlisting>'
+ print ('<?xml version="1.0"?>')
+ print ('<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">')
+ print ()
+ print ('<programlisting>')
# print content
- print saxutils.escape(content).encode('UTF-8')
- print '</programlisting>'
+ print (saxutils.escape(content))
+ print ('</programlisting>')
main()
diff --git a/common/check.mak b/common/check.mak
index 0aec843..285876c 100644
--- a/common/check.mak
+++ b/common/check.mak
@@ -11,7 +11,7 @@ check-valgrind:
@true
endif
-LOOPS = 10
+LOOPS ?= 10
# run any given test by running make test.check
# if the test fails, run it again at at least debug level 2
@@ -74,6 +74,17 @@ LOOPS = 10
--gen-suppressions=all \
./$* 2>&1 | tee suppressions.log
+# valgrind torture any given test
+%.valgrind-torture: %
+ @for i in `seq 1 $(LOOPS)`; do \
+ $(MAKE) $*.valgrind || \
+ (echo "Failure after $$i runs"; exit 1) || \
+ exit 1; \
+ done
+ @banner="All $(LOOPS) loops passed"; \
+ dashes=`echo "$$banner" | sed s/./=/g`; \
+ echo $$dashes; echo $$banner; echo $$dashes
+
# valgrind any given test until failure by running make test.valgrind-forever
%.valgrind-forever: %
@while $(MAKE) $*.valgrind; do \
@@ -86,9 +97,34 @@ LOOPS = 10
$(LIBTOOL) --mode=execute \
gdb $*
+%.lcov-reset:
+ $(MAKE) $*.lcov-run
+ $(MAKE) $*.lcov-report
+
+%.lcov: %
+ $(MAKE) $*.lcov-reset
+
+if GST_GCOV_ENABLED
+%.lcov-clean:
+ $(MAKE) -C $(top_builddir) lcov-clean
+
+%.lcov-run:
+ $(MAKE) $*.lcov-clean
+ $(MAKE) $*.check
+
+%.lcov-report:
+ $(MAKE) -C $(top_builddir) lcov-report
+else
+%.lcov-run:
+ echo "Need to reconfigure with --enable-gcov"
+
+%.lcov-report:
+ echo "Need to reconfigure with --enable-gcov"
+endif
+
# torture tests
torture: $(TESTS)
- -rm test-registry.xml
+ -rm test-registry.*
@echo "Torturing tests ..."
@for i in `seq 1 $(LOOPS)`; do \
$(MAKE) check || \
@@ -101,7 +137,7 @@ torture: $(TESTS)
# forever tests
forever: $(TESTS)
- -rm test-registry.xml
+ -rm test-registry.*
@echo "Forever tests ..."
@while true; do \
$(MAKE) check || \
@@ -127,6 +163,29 @@ valgrind: $(TESTS)
false; \
fi
+# valgrind all tests until failure
+valgrind-forever: $(TESTS)
+ -rm test-registry.*
+ @echo "Forever valgrinding tests ..."
+ @while true; do \
+ $(MAKE) valgrind || \
+ (echo "Failure"; exit 1) || \
+ exit 1; \
+ done
+
+# valgrind torture all tests
+valgrind-torture: $(TESTS)
+ -rm test-registry.*
+ @echo "Torturing and valgrinding tests ..."
+ @for i in `seq 1 $(LOOPS)`; do \
+ $(MAKE) valgrind || \
+ (echo "Failure after $$i runs"; exit 1) || \
+ exit 1; \
+ done
+ @banner="All $(LOOPS) loops passed"; \
+ dashes=`echo "$$banner" | sed s/./=/g`; \
+ echo $$dashes; echo $$banner; echo $$dashes
+
# valgrind all tests and generate suppressions
valgrind.gen-suppressions: $(TESTS)
@echo "Valgrinding tests ..."
@@ -166,10 +225,13 @@ help:
@echo "make (dir)/(test).gdb -- start up gdb for the given test"
@echo
@echo "make valgrind -- valgrind all tests"
+ @echo "make valgrind-forever -- valgrind all tests forever"
+ @echo "make valgrind-torture -- valgrind all tests $(LOOPS) times"
@echo "make valgrind.gen-suppressions -- generate suppressions for all tests"
@echo " and save to suppressions.log"
@echo "make (dir)/(test).valgrind -- valgrind the given test"
@echo "make (dir)/(test).valgrind-forever -- valgrind the given test forever"
+ @echo "make (dir)/(test).valgrind-torture -- valgrind the given test $(LOOPS) times"
@echo "make (dir)/(test).valgrind.gen-suppressions -- generate suppressions"
@echo " and save to suppressions.log"
@echo "make inspect -- inspect all plugin features"
diff --git a/common/coverage/coverage-report-entry.pl b/common/coverage/coverage-report-entry.pl
index 51c506c..d0036b3 100644
--- a/common/coverage/coverage-report-entry.pl
+++ b/common/coverage/coverage-report-entry.pl
@@ -14,7 +14,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
print <<EOF;
diff --git a/common/coverage/coverage-report.pl b/common/coverage/coverage-report.pl
index ed30f8d..18bd6f1 100644
--- a/common/coverage/coverage-report.pl
+++ b/common/coverage/coverage-report.pl
@@ -14,7 +14,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
use warnings;
use strict;
diff --git a/common/coverage/coverage-report.xsl b/common/coverage/coverage-report.xsl
index b19ebb6..3fe124b 100644
--- a/common/coverage/coverage-report.xsl
+++ b/common/coverage/coverage-report.xsl
@@ -15,7 +15,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
diff --git a/common/coverage/lcov.mak b/common/coverage/lcov.mak
index fc1f6b2..b45728a 100644
--- a/common/coverage/lcov.mak
+++ b/common/coverage/lcov.mak
@@ -1,5 +1,5 @@
## .PHONY so it always rebuilds it
-.PHONY: lcov-reset lcov lcov-run lcov-report lcov-upload
+.PHONY: lcov-reset lcov lcov-run lcov-report lcov-upload lcov-clean
# run lcov from scratch, always
lcov-reset:
@@ -11,10 +11,14 @@ lcov:
$(MAKE) lcov-reset
if GST_GCOV_ENABLED
-# reset run coverage tests
-lcov-run:
+# reset lcov stats
+lcov-clean:
@-rm -rf lcov
lcov --directory . --zerocounters
+
+# reset run coverage tests
+lcov-run:
+ -$(MAKE) lcov-clean
-if test -d tests/check; then $(MAKE) -C tests/check inspect; fi
-$(MAKE) check
diff --git a/common/gst.supp b/common/gst.supp
index d7f8961..8a3617f 100644
--- a/common/gst.supp
+++ b/common/gst.supp
@@ -91,6 +91,14 @@
fun:pthread_create@@*
}
+{
+ <tls>
+ Memcheck:Leak
+ fun:calloc
+ fun:allocate_dtv
+ fun:_dl_allocate_tls
+}
+
# I get an extra stack entry on x86/dapper
{
<tls>
@@ -3961,3 +3969,18 @@
fun:gst_system_clock_init
}
+{
+ <glib types are singletons>
+ Memcheck:Leak
+ fun:calloc
+ ...
+ fun:gobject_init_ctor
+}
+
+{
+ <quark table is leaked on purpose if it grows too big>
+ Memcheck:Leak
+ fun:malloc
+ ...
+ fun:g_quark_from*_string
+}
diff --git a/common/gstdoc-scangobj b/common/gstdoc-scangobj
index 0d69a86..09039a5 100755
--- a/common/gstdoc-scangobj
+++ b/common/gstdoc-scangobj
@@ -16,7 +16,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
#
#
@@ -307,10 +307,10 @@ get_object_types (void)
/* output element data */
fputs (" <element>\\n", inspect);
fputs (xmlprint(6, "name", gst_plugin_feature_get_name (feature)),inspect);
- fputs (xmlprint(6, "longname", gst_element_factory_get_longname (factory)),inspect);
- fputs (xmlprint(6, "class", gst_element_factory_get_klass (factory)),inspect);
- fputs (xmlprint(6, "description", gst_element_factory_get_description (factory)),inspect);
- fputs (xmlprint(6, "author", gst_element_factory_get_author (factory)),inspect);
+ fputs (xmlprint(6, "longname", gst_element_factory_get_metadata (factory, GST_ELEMENT_METADATA_LONGNAME)),inspect);
+ fputs (xmlprint(6, "class", gst_element_factory_get_metadata (factory, GST_ELEMENT_METADATA_KLASS)),inspect);
+ fputs (xmlprint(6, "description", gst_element_factory_get_metadata (factory, GST_ELEMENT_METADATA_DESCRIPTION)),inspect);
+ fputs (xmlprint(6, "author", gst_element_factory_get_metadata (factory, GST_ELEMENT_METADATA_AUTHOR)),inspect);
fputs (" <pads>\\n", inspect);
/* output pad-template data */
@@ -354,11 +354,11 @@ get_object_types (void)
factory = GST_ELEMENT_FACTORY (l->data);
type = gst_element_factory_get_element_type (factory);
if (type != 0) {
- $debug_log ("adding type for factory %s", gst_element_factory_get_longname (factory));
+ $debug_log ("adding type for factory %s", gst_element_factory_get_metadata (factory, GST_ELEMENT_METADATA_LONGNAME));
object_types[i++] = type;
} else {
g_message ("type info for factory %s not found",
- gst_element_factory_get_longname (factory));
+ gst_element_factory_get_metadata (factory, GST_ELEMENT_METADATA_LONGNAME));
}
l = g_list_next (l);
}
diff --git a/common/gtk-doc-plugins.mak b/common/gtk-doc-plugins.mak
index 2468cb0..f19e7d7 100644
--- a/common/gtk-doc-plugins.mak
+++ b/common/gtk-doc-plugins.mak
@@ -94,9 +94,9 @@ all-local: html-build.stamp
INSPECT_REGISTRY=$(top_builddir)/docs/plugins/inspect-registry.xml
INSPECT_ENVIRONMENT=\
LC_ALL=C \
- GST_PLUGIN_SYSTEM_PATH= \
- GST_PLUGIN_PATH=$(top_builddir)/gst:$(top_builddir)/sys:$(top_builddir)/ext:$(top_builddir)/plugins:$(top_builddir)/src:$(top_builddir)/gnl \
- GST_REGISTRY=$(INSPECT_REGISTRY) \
+ GST_PLUGIN_SYSTEM_PATH_1_0= \
+ GST_PLUGIN_PATH_1_0=$(top_builddir)/gst:$(top_builddir)/sys:$(top_builddir)/ext:$(top_builddir)/plugins:$(top_builddir)/src:$(top_builddir)/gnl \
+ GST_REGISTRY_1_0=$(INSPECT_REGISTRY) \
PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" \
$(INSPECT_EXTRA_ENVIRONMENT)
@@ -222,10 +222,7 @@ html-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files)
mkhtml_options="$$mkhtml_options --verbose"; \
fi; \
fi; \
- cd html && gtkdoc-mkhtml $$mkhtml_options $(DOC_MODULE) $(DOC_MAIN_SGML_FILE)
- @mv html/index.sgml html/index.sgml.bak
- @$(SED) "s/ href=\"$(DOC_MODULE)\// href=\"$(DOC_MODULE)-@GST_API_VERSION@\//g" html/index.sgml.bak >html/index.sgml
- @rm -f html/index.sgml.bak
+ cd html && gtkdoc-mkhtml $$mkhtml_options $(DOC_MODULE)-@GST_API_VERSION@ $(DOC_MAIN_SGML_FILE)
@rm -f html/$(DOC_MAIN_SGML_FILE)
@rm -rf html/xml
@rm -f html/version.entities
@@ -289,9 +286,9 @@ install-data-local:
$(INSTALL_DATA) $$i $(DESTDIR)$(TARGET_DIR); \
done; \
fi; \
- echo '-- Installing $(builddir)/html/$(DOC_MODULE).devhelp2' ; \
- if test -e $(builddir)/html/$(DOC_MODULE).devhelp2; then \
- $(INSTALL_DATA) $(builddir)/html/$(DOC_MODULE).devhelp2 \
+ echo '-- Installing $(builddir)/html/$(DOC_MODULE)-@GST_API_VERSION@.devhelp2' ; \
+ if test -e $(builddir)/html/$(DOC_MODULE)-@GST_API_VERSION@.devhelp2; then \
+ $(INSTALL_DATA) $(builddir)/html/$(DOC_MODULE)-@GST_API_VERSION@.devhelp2 \
$(DESTDIR)$(TARGET_DIR)/$(DOC_MODULE)-@GST_API_VERSION@.devhelp2; \
fi; \
$(GTKDOC_REBASE) --relative --dest-dir=$(DESTDIR) --html-dir=$(DESTDIR)$(TARGET_DIR) || true ; \
diff --git a/common/gtk-doc.mak b/common/gtk-doc.mak
index a1e07dc..9d76889 100644
--- a/common/gtk-doc.mak
+++ b/common/gtk-doc.mak
@@ -81,9 +81,9 @@ scan-build.stamp: $(HFILE_GLOB) $(CFILE_GLOB)
--ignore-headers="$(IGNORE_HFILES)"
@if grep -l '^..*$$' $(DOC_MODULE).types > /dev/null; then \
echo " DOC Introspecting gobjects"; \
- GST_PLUGIN_SYSTEM_PATH=`cd $(top_builddir) && pwd` \
- GST_PLUGIN_PATH= \
- GST_REGISTRY=doc-registry.xml \
+ GST_PLUGIN_SYSTEM_PATH_1_0=`cd $(top_builddir) && pwd` \
+ GST_PLUGIN_PATH_1_0= \
+ GST_REGISTRY_1_0=doc-registry.xml \
$(GTKDOC_EXTRA_ENVIRONMENT) \
CC="$(GTKDOC_CC)" LD="$(GTKDOC_LD)" \
CFLAGS="$(GTKDOC_CFLAGS) $(CFLAGS)" \
@@ -130,10 +130,7 @@ html-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files)
if test "$(?)" = "0"; then \
mkhtml_options=--path="$(abs_srcdir)"; \
fi; \
- cd html && gtkdoc-mkhtml $$mkhtml_options $(MKHTML_OPTIONS) $(DOC_MODULE) ../$(DOC_MAIN_SGML_FILE)
- @mv html/index.sgml html/index.sgml.bak
- @$(SED) "s/ href=\"$(DOC_MODULE)\// href=\"$(DOC_MODULE)-@GST_API_VERSION@\//g" html/index.sgml.bak >html/index.sgml
- @rm -f html/index.sgml.bak
+ cd html && gtkdoc-mkhtml $$mkhtml_options $(MKHTML_OPTIONS) $(DOC_MODULE)-@GST_API_VERSION@ ../$(DOC_MAIN_SGML_FILE)
@rm -rf html/xml
@rm -f version.entities
@test "x$(HTML_IMAGES)" = "x" || ( cd $(srcdir) && cp $(HTML_IMAGES) $(abs_builddir)/html )
@@ -189,9 +186,9 @@ install-data-local:
echo '-- Installing '$$i ; \
$(INSTALL_DATA) $$i $(DESTDIR)$(TARGET_DIR); \
done; \
- echo '-- Installing $(builddir)/html/$(DOC_MODULE).devhelp2' ; \
- if test -e $(builddir)/html/$(DOC_MODULE).devhelp2; then \
- $(INSTALL_DATA) $(builddir)/html/$(DOC_MODULE).devhelp2 \
+ echo '-- Installing $(builddir)/html/$(DOC_MODULE)-@GST_API_VERSION@.devhelp2' ; \
+ if test -e $(builddir)/html/$(DOC_MODULE)-@GST_API_VERSION@.devhelp2; then \
+ $(INSTALL_DATA) $(builddir)/html/$(DOC_MODULE)-@GST_API_VERSION@.devhelp2 \
$(DESTDIR)$(TARGET_DIR)/$(DOC_MODULE)-@GST_API_VERSION@.devhelp2; \
fi; \
$(GTKDOC_REBASE) --relative --dest-dir=$(DESTDIR) --html-dir=$(DESTDIR)$(TARGET_DIR) || true ; \
diff --git a/common/m4/Makefile.in b/common/m4/Makefile.in
index aad5e9f..1a65916 100644
--- a/common/m4/Makefile.in
+++ b/common/m4/Makefile.in
@@ -1,9 +1,8 @@
-# Makefile.in generated by automake 1.11.6 from Makefile.am.
+# Makefile.in generated by automake 1.13.3 from Makefile.am.
# @configure_input@
-# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-# Foundation, Inc.
+# Copyright (C) 1994-2013 Free Software Foundation, Inc.
+
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -15,23 +14,51 @@
@SET_MAKE@
VPATH = @srcdir@
-am__make_dryrun = \
- { \
- am__dry=no; \
+am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
+am__make_running_with_option = \
+ case $${target_option-} in \
+ ?) ;; \
+ *) echo "am__make_running_with_option: internal error: invalid" \
+ "target option '$${target_option-}' specified" >&2; \
+ exit 1;; \
+ esac; \
+ has_opt=no; \
+ sane_makeflags=$$MAKEFLAGS; \
+ if $(am__is_gnu_make); then \
+ sane_makeflags=$$MFLAGS; \
+ else \
case $$MAKEFLAGS in \
*\\[\ \ ]*) \
- echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
- | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
- *) \
- for am__flg in $$MAKEFLAGS; do \
- case $$am__flg in \
- *=*|--*) ;; \
- *n*) am__dry=yes; break;; \
- esac; \
- done;; \
+ bs=\\; \
+ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
+ esac; \
+ fi; \
+ skip_next=no; \
+ strip_trailopt () \
+ { \
+ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+ }; \
+ for flg in $$sane_makeflags; do \
+ test $$skip_next = yes && { skip_next=no; continue; }; \
+ case $$flg in \
+ *=*|--*) continue;; \
+ -*I) strip_trailopt 'I'; skip_next=yes;; \
+ -*I?*) strip_trailopt 'I';; \
+ -*O) strip_trailopt 'O'; skip_next=yes;; \
+ -*O?*) strip_trailopt 'O';; \
+ -*l) strip_trailopt 'l'; skip_next=yes;; \
+ -*l?*) strip_trailopt 'l';; \
+ -[dEDm]) skip_next=yes;; \
+ -[JT]) skip_next=yes;; \
+ esac; \
+ case $$flg in \
+ *$$target_option*) has_opt=yes; break;; \
esac; \
- test $$am__dry = yes; \
- }
+ done; \
+ test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
@@ -52,7 +79,7 @@ build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
subdir = common/m4
-DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am README
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/common/m4/as-ac-expand.m4 \
$(top_srcdir)/common/m4/as-auto-alt.m4 \
@@ -82,12 +109,18 @@ mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
+AM_V_P = $(am__v_P_@AM_V@)
+am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
+am__v_P_0 = false
+am__v_P_1 = :
AM_V_GEN = $(am__v_GEN_@AM_V@)
am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
-am__v_GEN_0 = @echo " GEN " $@;
+am__v_GEN_0 = @echo " GEN " $@;
+am__v_GEN_1 =
AM_V_at = $(am__v_at_@AM_V@)
am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
am__v_at_0 = @
+am__v_at_1 =
SOURCES =
DIST_SOURCES =
am__can_run_installinfo = \
@@ -95,6 +128,7 @@ am__can_run_installinfo = \
n|no|NO) false;; \
*) (install-info --version) >/dev/null 2>&1;; \
esac
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@
@@ -109,10 +143,12 @@ AWK = @AWK@
CAT_ENTRY_END = @CAT_ENTRY_END@
CAT_ENTRY_START = @CAT_ENTRY_START@
CC = @CC@
+CCASFLAGS = @CCASFLAGS@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
+CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DARWIN_LDFLAGS = @DARWIN_LDFLAGS@
DEFS = @DEFS@
@@ -128,7 +164,11 @@ ECHO_T = @ECHO_T@
EGREP = @EGREP@
ERROR_CFLAGS = @ERROR_CFLAGS@
EXEEXT = @EXEEXT@
+FFLAGS = @FFLAGS@
FGREP = @FGREP@
+GCOV = @GCOV@
+GCOV_CFLAGS = @GCOV_CFLAGS@
+GCOV_LIBS = @GCOV_LIBS@
GREP = @GREP@
GSTPB_PLUGINS_DIR = @GSTPB_PLUGINS_DIR@
GST_AGE = @GST_AGE@
@@ -161,16 +201,15 @@ GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@
GTKDOC_MKPDF = @GTKDOC_MKPDF@
GTKDOC_REBASE = @GTKDOC_REBASE@
HAVE_BZ2 = @HAVE_BZ2@
-HAVE_DOCBOOK2HTML = @HAVE_DOCBOOK2HTML@
HAVE_DOCBOOK2PS = @HAVE_DOCBOOK2PS@
HAVE_DVIPS = @HAVE_DVIPS@
HAVE_EPSTOPDF = @HAVE_EPSTOPDF@
-HAVE_FIG2DEV = @HAVE_FIG2DEV@
HAVE_JADETEX = @HAVE_JADETEX@
HAVE_PNGTOPNM = @HAVE_PNGTOPNM@
HAVE_PNMTOPS = @HAVE_PNMTOPS@
HAVE_PS2PDF = @HAVE_PS2PDF@
HAVE_XMLLINT = @HAVE_XMLLINT@
+HAVE_XSLTPROC = @HAVE_XSLTPROC@
HTML_DIR = @HTML_DIR@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
@@ -388,11 +427,11 @@ mostlyclean-libtool:
clean-libtool:
-rm -rf .libs _libs
-tags: TAGS
-TAGS:
+tags TAGS:
+
+ctags CTAGS:
-ctags: CTAGS
-CTAGS:
+cscope cscopelist:
distdir: $(DISTFILES)
@@ -528,15 +567,16 @@ uninstall-am:
.MAKE: install-am install-strip
.PHONY: all all-am check check-am clean clean-generic clean-libtool \
- distclean distclean-generic distclean-libtool distdir dvi \
- dvi-am html html-am info info-am install install-am \
- install-data install-data-am install-dvi install-dvi-am \
- install-exec install-exec-am install-html install-html-am \
- install-info install-info-am install-man install-pdf \
- install-pdf-am install-ps install-ps-am install-strip \
- installcheck installcheck-am installdirs maintainer-clean \
- maintainer-clean-generic mostlyclean mostlyclean-generic \
- mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am
+ cscopelist-am ctags-am distclean distclean-generic \
+ distclean-libtool distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags-am uninstall uninstall-am
# Tell versions [3.59,3.63) of GNU make to not export all variables.
diff --git a/common/m4/as-docbook.m4 b/common/m4/as-docbook.m4
index 8a1b32a..2e27050 100644
--- a/common/m4/as-docbook.m4
+++ b/common/m4/as-docbook.m4
@@ -14,7 +14,19 @@ AC_DEFUN([AS_DOCBOOK],
TYPE_UC=XML
DOCBOOK_VERSION=4.1.2
- if test ! -f /etc/xml/catalog; then
+ if test -n "$XML_CATALOG_FILES"; then
+ oldIFS=$IFS
+ IFS=' '
+ for xml_catalog_file in $XML_CATALOG_FILES; do
+ if test -f $xml_catalog_file; then
+ XML_CATALOG=$xml_catalog_file
+ CAT_ENTRY_START='<!--'
+ CAT_ENTRY_END='-->'
+ break
+ fi
+ done
+ IFS=$oldIFS
+ elif test ! -f /etc/xml/catalog; then
for i in /usr/share/sgml/docbook/stylesheet/xsl/nwalsh /usr/share/sgml/docbook/xsl-stylesheets/ /usr/local/share/xsl/docbook ;
do
if test -d "$i"; then
diff --git a/common/m4/gst-check.m4 b/common/m4/gst-check.m4
index cba7e96..4277053 100644
--- a/common/m4/gst-check.m4
+++ b/common/m4/gst-check.m4
@@ -266,29 +266,29 @@ AC_DEFUN([AG_GST_CHECK_GST_PLUGINS_BAD],
])
dnl ===========================================================================
-dnl AG_GST_CHECK_GST_PLUGINS_FFMPEG([GST-API_VERSION], [MIN-VERSION])
+dnl AG_GST_CHECK_GST_PLUGINS_LIBAV([GST-API_VERSION], [MIN-VERSION])
dnl
-dnl Will set GST_PLUGINS_FFMPEG_DIR for use in Makefile.am. Note that this will
-dnl only be set in an uninstalled setup, since -ffmpeg ships no .pc file and in
+dnl Will set GST_PLUGINS_LIBAV_DIR for use in Makefile.am. Note that this will
+dnl only be set in an uninstalled setup, since -libav ships no .pc file and in
dnl an installed setup all plugins will be found in GST_PLUGINS_DIR anyway.
dnl ===========================================================================
-AC_DEFUN([AG_GST_CHECK_GST_PLUGINS_FFMPEG],
+AC_DEFUN([AG_GST_CHECK_GST_PLUGINS_LIBAV],
[
- AG_GST_CHECK_MODULES(GST_PLUGINS_FFMPEG, gstreamer-plugins-ffmpeg-[$1], [$2],
- [GStreamer FFmpeg Plugins], [no])
+ AG_GST_CHECK_MODULES(GST_PLUGINS_LIBAV, gstreamer-plugins-libav-[$1], [$2],
+ [GStreamer Libav Plugins], [no])
- if test "x$HAVE_GST_PLUGINS_FFMPEG" = "xyes"; then
- dnl check for where ffmpeg plugins got installed
+ if test "x$HAVE_GST_PLUGINS_LIBAV" = "xyes"; then
+ dnl check for where libav plugins got installed
dnl this is used for unit tests
dnl allow setting before calling this macro to override
- if test -z $GST_PLUGINS_FFMPEG_DIR; then
- GST_PLUGINS_FFMPEG_DIR=`$PKG_CONFIG --variable=pluginsdir gstreamer-plugins-ffmpeg-[$1]`
- if test -z $GST_PLUGINS_FFMPEG_DIR; then
- AC_MSG_ERROR([no pluginsdir set in GStreamer FFmpeg Plugins pkg-config file])
+ if test -z $GST_PLUGINS_LIBAV_DIR; then
+ GST_PLUGINS_LIBAV_DIR=`$PKG_CONFIG --variable=pluginsdir gstreamer-plugins-libav-[$1]`
+ if test -z $GST_PLUGINS_LIBAV_DIR; then
+ AC_MSG_ERROR([no pluginsdir set in GStreamer Libav Plugins pkg-config file])
fi
fi
- GST_PLUGINS_FFMPEG_DIR="$GST_PLUGINS_FFMPEG_DIR/ext/ffmpeg"
- AC_MSG_NOTICE([using GStreamer FFmpeg Plugins in $GST_PLUGINS_FFMPEG_DIR])
- AC_SUBST(GST_PLUGINS_FFMPEG_DIR)
+ GST_PLUGINS_LIBAV_DIR="$GST_PLUGINS_LIBAV_DIR/ext/libav"
+ AC_MSG_NOTICE([using GStreamer Libav Plugins in $GST_PLUGINS_LIBAV_DIR])
+ AC_SUBST(GST_PLUGINS_LIBAV_DIR)
fi
])
diff --git a/common/m4/gst-doc.m4 b/common/m4/gst-doc.m4
index 871c346..5d3f0fd 100644
--- a/common/m4/gst-doc.m4
+++ b/common/m4/gst-doc.m4
@@ -20,34 +20,10 @@ AC_DEFUN([AG_GST_DOCBOOK_CHECK],
dnl check for docbook tools
AC_CHECK_PROG(HAVE_DOCBOOK2PS, docbook2ps, yes, no)
- AC_CHECK_PROG(HAVE_DOCBOOK2HTML, docbook2html, yes, no)
+ AC_CHECK_PROG(HAVE_XSLTPROC, xsltproc, yes, no)
AC_CHECK_PROG(HAVE_JADETEX, jadetex, yes, no)
AC_CHECK_PROG(HAVE_PS2PDF, ps2pdf, yes, no)
- # -V option appeared in 0.6.10
- docbook2html_min_version=0.6.10
- if test "x$HAVE_DOCBOOK2HTML" != "xno"; then
- docbook2html_version=`docbook2html --version`
- AC_MSG_CHECKING([docbook2html version ($docbook2html_version) >= $docbook2html_min_version])
- if perl -w <<EOF
- (\$min_version_major, \$min_version_minor, \$min_version_micro ) = "$docbook2html_min_version" =~ /(\d+)\.(\d+)\.(\d+)/;
- (\$docbook2html_version_major, \$docbook2html_version_minor, \$docbook2html_version_micro ) = "$docbook2html_version" =~ /(\d+)\.(\d+)\.(\d+)/;
- exit (((\$docbook2html_version_major > \$min_version_major) ||
- ((\$docbook2html_version_major == \$min_version_major) &&
- (\$docbook2html_version_minor >= \$min_version_minor)) ||
- ((\$docbook2html_version_major == \$min_version_major) &&
- (\$docbook2html_version_minor >= \$min_version_minor) &&
- (\$docbook2html_version_micro >= \$min_version_micro)))
- ? 0 : 1);
-EOF
- then
- AC_MSG_RESULT(yes)
- else
- AC_MSG_RESULT(no)
- HAVE_DOCBOOK2HTML=no
- fi
- fi
-
dnl check if we can process docbook stuff
AS_DOCBOOK(have_docbook=yes, have_docbook=no)
@@ -55,45 +31,14 @@ EOF
AC_CHECK_PROG(HAVE_DVIPS, dvips, yes, no)
AC_CHECK_PROG(HAVE_XMLLINT, xmllint, yes, no)
- dnl check for image conversion tools
- AC_CHECK_PROG(HAVE_FIG2DEV, fig2dev, yes, no)
- if test "x$HAVE_FIG2DEV" = "xno" ; then
- AC_MSG_WARN([Did not find fig2dev (from xfig), images will not be generated.])
- fi
-
- dnl The following is a hack: if fig2dev doesn't display an error message
- dnl for the desired type, we assume it supports it.
- HAVE_FIG2DEV_EPS=no
- if test "x$HAVE_FIG2DEV" = "xyes" ; then
- fig2dev_quiet=`fig2dev -L eps </dev/null 2>&1 >/dev/null`
- if test "x$fig2dev_quiet" = "x" ; then
- HAVE_FIG2DEV_EPS=yes
- fi
- fi
- HAVE_FIG2DEV_PNG=no
- if test "x$HAVE_FIG2DEV" = "xyes" ; then
- fig2dev_quiet=`fig2dev -L png </dev/null 2>&1 >/dev/null`
- if test "x$fig2dev_quiet" = "x" ; then
- HAVE_FIG2DEV_PNG=yes
- fi
- fi
- HAVE_FIG2DEV_PDF=no
- if test "x$HAVE_FIG2DEV" = "xyes" ; then
- fig2dev_quiet=`fig2dev -L pdf </dev/null 2>&1 >/dev/null`
- if test "x$fig2dev_quiet" = "x" ; then
- HAVE_FIG2DEV_PDF=yes
- fi
- fi
-
AC_CHECK_PROG(HAVE_PNGTOPNM, pngtopnm, yes, no)
AC_CHECK_PROG(HAVE_PNMTOPS, pnmtops, yes, no)
AC_CHECK_PROG(HAVE_EPSTOPDF, epstopdf, yes, no)
dnl check if we can generate HTML
- if test "x$HAVE_DOCBOOK2HTML" = "xyes" && \
+ if test "x$HAVE_XSLTPROC" = "xyes" && \
test "x$enable_docbook" = "xyes" && \
- test "x$HAVE_XMLLINT" = "xyes" && \
- test "x$HAVE_FIG2DEV_PNG" = "xyes"; then
+ test "x$HAVE_XMLLINT" = "xyes"; then
DOC_HTML=yes
AC_MSG_NOTICE(Will output HTML documentation)
else
@@ -106,7 +51,6 @@ EOF
test "x$enable_docbook" = "xyes" && \
test "x$HAVE_XMLLINT" = "xyes" && \
test "x$HAVE_JADETEX" = "xyes" && \
- test "x$HAVE_FIG2DEV_EPS" = "xyes" && \
test "x$HAVE_DVIPS" = "xyes" && \
test "x$HAVE_PNGTOPNM" = "xyes" && \
test "x$HAVE_PNMTOPS" = "xyes"; then
diff --git a/common/m4/gst-glib2.m4 b/common/m4/gst-glib2.m4
index 3f3d565..9a3a923 100644
--- a/common/m4/gst-glib2.m4
+++ b/common/m4/gst-glib2.m4
@@ -16,7 +16,7 @@ AC_DEFUN([AG_GST_GLIB_CHECK],
dnl Check for glib with everything
AG_GST_PKG_CHECK_MODULES(GLIB,
- glib-2.0 >= $GLIB_REQ gobject-2.0 gthread-2.0 gmodule-no-export-2.0)
+ glib-2.0 >= $GLIB_REQ gobject-2.0 gmodule-no-export-2.0)
if test "x$HAVE_GLIB" = "xno"; then
AC_MSG_ERROR([This package requires GLib >= $GLIB_REQ to compile.])
@@ -28,7 +28,7 @@ AC_DEFUN([AG_GST_GLIB_CHECK],
GLIB_EXTRA_CFLAGS="$GLIB_EXTRA_CFLAGS -DG_THREADS_MANDATORY"
dnl Define G_DISABLE_DEPRECATED for GIT versions
- if test "x$PACKAGE_VERSION_NANO" = "x1"; then
+ if test "x$PACKAGE_VERSION_NANO" = "x1" -o "x`expr $PACKAGE_VERSION_MINOR % 2`" = "x1"; then
GLIB_EXTRA_CFLAGS="$GLIB_EXTRA_CFLAGS -DG_DISABLE_DEPRECATED"
fi
@@ -39,7 +39,7 @@ AC_DEFUN([AG_GST_GLIB_CHECK],
if test "x$enable_gobject_cast_checks" = "xauto"; then
dnl For releases, turn off the cast checks
- if test "x$PACKAGE_VERSION_NANO" = "x1"; then
+ if test "x$PACKAGE_VERSION_NANO" = "x1" -o "x`expr $PACKAGE_VERSION_MINOR % 2`" = "x1"; then
enable_gobject_cast_checks=yes
else
enable_gobject_cast_checks=no
@@ -57,7 +57,7 @@ AC_DEFUN([AG_GST_GLIB_CHECK],
if test "x$enable_glib_assertions" = "xauto"; then
dnl For releases, turn off the assertions
- if test "x$PACKAGE_VERSION_NANO" = "x1"; then
+ if test "x$PACKAGE_VERSION_NANO" = "x1" -o "x`expr $PACKAGE_VERSION_MINOR % 2`" = "x1"; then
enable_glib_assertions=yes
else
enable_glib_assertions=no
diff --git a/common/m4/gst-plugin-docs.m4 b/common/m4/gst-plugin-docs.m4
index dcfd61d..0e2ab6e 100644
--- a/common/m4/gst-plugin-docs.m4
+++ b/common/m4/gst-plugin-docs.m4
@@ -1,4 +1,4 @@
-dnl AG_GST_PLUGIN_DOCS([MINIMUM-GTK-DOC-VERSION],[MINIMUM-PYTHON-VERSION])
+dnl AG_GST_PLUGIN_DOCS([MINIMUM-GTK-DOC-VERSION])
dnl
dnl checks for prerequisites for the common/mangle-tmpl.py script
dnl used when building the plugin documentation
@@ -6,13 +6,17 @@ dnl used when building the plugin documentation
AC_DEFUN([AG_GST_PLUGIN_DOCS],
[
AC_BEFORE([GTK_DOC_CHECK],[$0])dnl check for gtk-doc first
- AC_BEFORE([AS_PATH_PYTHON],[$1])dnl find python first
+ AC_REQUIRE([AM_PATH_PYTHON])dnl find python first
build_plugin_docs=no
AC_MSG_CHECKING([whether to build plugin documentation])
if test x$enable_gtk_doc = xyes; then
- build_plugin_docs=yes
- AC_MSG_RESULT([yes])
+ if test x$PYTHON != x; then
+ build_plugin_docs=yes
+ AC_MSG_RESULT([yes])
+ else
+ AC_MSG_RESULT([no (python not found)])
+ fi
else
AC_MSG_RESULT([no (gtk-doc disabled or not available)])
fi
diff --git a/common/mangle-tmpl.py b/common/mangle-tmpl.py
index bd4f948..51ea8c2 100644
--- a/common/mangle-tmpl.py
+++ b/common/mangle-tmpl.py
@@ -15,6 +15,8 @@ insert/overwrite Short Description and Long Description
# read in inspect/*.xml
# for every tmpl/element-(name).xml: mangle with details from element
+from __future__ import print_function, unicode_literals
+
import glob
import re
import sys
diff --git a/common/scangobj-merge.py b/common/scangobj-merge.py
index 9a1cac9..4a9f1fc 100755
--- a/common/scangobj-merge.py
+++ b/common/scangobj-merge.py
@@ -6,6 +6,8 @@
parse, merge and write gstdoc-scanobj files
"""
+from __future__ import print_function, unicode_literals
+
import sys
import os
@@ -76,13 +78,13 @@ class Object:
return "<Object %s>" % self.name
def add_signal(self, signal, overwrite=True):
- if not overwrite and self._signals.has_key(signal.name):
- raise IndexError, "signal %s already in %r" % (signal.name, self)
+ if not overwrite and signal.name in self._signals:
+ raise IndexError("signal %s already in %r" % (signal.name, self))
self._signals[signal.name] = signal
def add_arg(self, arg, overwrite=True):
- if not overwrite and self._args.has_key(arg.name):
- raise IndexError, "arg %s already in %r" % (arg.name, self)
+ if not overwrite and arg.name in self._args:
+ raise IndexError("arg %s already in %r" % (arg.name, self))
self._args[arg.name] = arg
class Docable:
@@ -106,7 +108,7 @@ class GDoc:
lines = open(filename).readlines()
self.load_data("".join(lines))
except IOError:
- print "WARNING - could not read from %s" % filename
+ print ("WARNING - could not read from %s" % filename)
def save_file(self, filename, backup=False):
"""
@@ -117,7 +119,7 @@ class GDoc:
lines = open(filename).readlines()
olddata = "".join(lines)
except IOError:
- print "WARNING - could not read from %s" % filename
+ print ("WARNING - could not read from %s" % filename)
newdata = self.get_data()
if olddata and olddata == newdata:
return
@@ -161,7 +163,7 @@ class Signals(GDoc):
o = nmatch.group('object')
debug("Found object", o)
debug("Found signal", nmatch.group('signal'))
- if not self._objects.has_key(o):
+ if o not in self._objects:
object = Object(o)
self._objects[o] = object
@@ -222,7 +224,7 @@ class Args(GDoc):
o = nmatch.group('object')
debug("Found object", o)
debug("Found arg", nmatch.group('arg'))
- if not self._objects.has_key(o):
+ if o not in self._objects:
object = Object(o)
self._objects[o] = object
@@ -233,7 +235,7 @@ class Args(GDoc):
arg = Arg(**dict)
self._objects[o].add_arg(arg)
else:
- print "ERROR: could not match arg from block %s" % block
+ print ("ERROR: could not match arg from block %s" % block)
def get_data(self):
lines = []
diff --git a/common/win32.mak b/common/win32.mak
index c343a04..30e347e 100644
--- a/common/win32.mak
+++ b/common/win32.mak
@@ -51,11 +51,17 @@ check-exports:
if test $$fail != 0; then \
echo '-----------------------------------------------------------'; \
echo 'Run this to update the .def files:'; \
- echo 'make check-exports 2>&1 | patch -p1'; \
+ echo 'make update-exports'; \
echo '-----------------------------------------------------------'; \
fi; \
exit $$fail
+update-exports:
+ make check-exports 2>&1 | patch -p1
+ git add win32/common/libgst*.def
+ git diff --cached -- win32/common/
+ echo '^^^--- updated and staged changes above'
+
# complain about nonportable printf format strings (%lld, %llu, %zu etc.)
check-nonportable-print-format:
@fail=0 ; \
diff --git a/compile b/compile
index 862a14e..531136b 100755
--- a/compile
+++ b/compile
@@ -1,10 +1,9 @@
#! /bin/sh
# Wrapper for compilers which do not understand '-c -o'.
-scriptversion=2012-03-05.13; # UTC
+scriptversion=2012-10-14.11; # UTC
-# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2009, 2010, 2012 Free
-# Software Foundation, Inc.
+# Copyright (C) 1999-2013 Free Software Foundation, Inc.
# Written by Tom Tromey <tromey@cygnus.com>.
#
# This program is free software; you can redistribute it and/or modify
@@ -113,6 +112,11 @@ func_cl_dashl ()
lib=$dir/$lib.lib
break
fi
+ if test -f "$dir/lib$lib.a"; then
+ found=yes
+ lib=$dir/lib$lib.a
+ break
+ fi
done
IFS=$save_IFS
diff --git a/config.guess b/config.guess
index d622a44..120cc0d 100755
--- a/config.guess
+++ b/config.guess
@@ -1,14 +1,12 @@
#! /bin/sh
# Attempt to guess a canonical system name.
-# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
-# 2011, 2012 Free Software Foundation, Inc.
+# Copyright 1992-2013 Free Software Foundation, Inc.
-timestamp='2012-02-10'
+timestamp='2013-05-16'
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
+# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
@@ -22,19 +20,17 @@ timestamp='2012-02-10'
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
-
-
-# Originally written by Per Bothner. Please send patches (context
-# diff format) to <config-patches@gnu.org> and include a ChangeLog
-# entry.
+# the same distribution terms that you use for the rest of that
+# program. This Exception is an additional permission under section 7
+# of the GNU General Public License, version 3 ("GPLv3").
#
-# This script attempts to guess a canonical system name similar to
-# config.sub. If it succeeds, it prints the system name on stdout, and
-# exits with 0. Otherwise, it exits with 1.
+# Originally written by Per Bothner.
#
# You can get the latest version of this script from:
# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
+#
+# Please send patches with a ChangeLog entry to config-patches@gnu.org.
+
me=`echo "$0" | sed -e 's,.*/,,'`
@@ -54,9 +50,7 @@ version="\
GNU config.guess ($timestamp)
Originally written by Per Bothner.
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
-Free Software Foundation, Inc.
+Copyright 1992-2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -138,6 +132,27 @@ UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
+case "${UNAME_SYSTEM}" in
+Linux|GNU|GNU/*)
+ # If the system lacks a compiler, then just pick glibc.
+ # We could probably try harder.
+ LIBC=gnu
+
+ eval $set_cc_for_build
+ cat <<-EOF > $dummy.c
+ #include <features.h>
+ #if defined(__UCLIBC__)
+ LIBC=uclibc
+ #elif defined(__dietlibc__)
+ LIBC=dietlibc
+ #else
+ LIBC=gnu
+ #endif
+ EOF
+ eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
+ ;;
+esac
+
# Note: order is significant - the case branches are not exclusive.
case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
@@ -200,6 +215,10 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
echo "${machine}-${os}${release}"
exit ;;
+ *:Bitrig:*:*)
+ UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
+ echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE}
+ exit ;;
*:OpenBSD:*:*)
UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
@@ -302,7 +321,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
echo arm-acorn-riscix${UNAME_RELEASE}
exit ;;
- arm:riscos:*:*|arm:RISCOS:*:*)
+ arm*:riscos:*:*|arm*:RISCOS:*:*)
echo arm-unknown-riscos
exit ;;
SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
@@ -801,6 +820,9 @@ EOF
i*:CYGWIN*:*)
echo ${UNAME_MACHINE}-pc-cygwin
exit ;;
+ *:MINGW64*:*)
+ echo ${UNAME_MACHINE}-pc-mingw64
+ exit ;;
*:MINGW*:*)
echo ${UNAME_MACHINE}-pc-mingw32
exit ;;
@@ -852,21 +874,21 @@ EOF
exit ;;
*:GNU:*:*)
# the GNU system
- echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
+ echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
exit ;;
*:GNU/*:*:*)
# other systems with GNU libc and userland
- echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
+ echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC}
exit ;;
i*86:Minix:*:*)
echo ${UNAME_MACHINE}-pc-minix
exit ;;
aarch64:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
aarch64_be:Linux:*:*)
UNAME_MACHINE=aarch64_be
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
alpha:Linux:*:*)
case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
@@ -879,59 +901,54 @@ EOF
EV68*) UNAME_MACHINE=alphaev68 ;;
esac
objdump --private-headers /bin/sh | grep -q ld.so.1
- if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
- echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
+ if test "$?" = 0 ; then LIBC="gnulibc1" ; fi
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+ exit ;;
+ arc:Linux:*:* | arceb:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
arm*:Linux:*:*)
eval $set_cc_for_build
if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
| grep -q __ARM_EABI__
then
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
else
if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
| grep -q __ARM_PCS_VFP
then
- echo ${UNAME_MACHINE}-unknown-linux-gnueabi
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi
else
- echo ${UNAME_MACHINE}-unknown-linux-gnueabihf
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf
fi
fi
exit ;;
avr32*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
cris:Linux:*:*)
- echo ${UNAME_MACHINE}-axis-linux-gnu
+ echo ${UNAME_MACHINE}-axis-linux-${LIBC}
exit ;;
crisv32:Linux:*:*)
- echo ${UNAME_MACHINE}-axis-linux-gnu
+ echo ${UNAME_MACHINE}-axis-linux-${LIBC}
exit ;;
frv:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
hexagon:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
i*86:Linux:*:*)
- LIBC=gnu
- eval $set_cc_for_build
- sed 's/^ //' << EOF >$dummy.c
- #ifdef __dietlibc__
- LIBC=dietlibc
- #endif
-EOF
- eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
- echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
+ echo ${UNAME_MACHINE}-pc-linux-${LIBC}
exit ;;
ia64:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
m32r*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
m68*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
mips:Linux:*:* | mips64:Linux:*:*)
eval $set_cc_for_build
@@ -950,54 +967,57 @@ EOF
#endif
EOF
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
- test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
+ test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; }
;;
+ or1k:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+ exit ;;
or32:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
padre:Linux:*:*)
- echo sparc-unknown-linux-gnu
+ echo sparc-unknown-linux-${LIBC}
exit ;;
parisc64:Linux:*:* | hppa64:Linux:*:*)
- echo hppa64-unknown-linux-gnu
+ echo hppa64-unknown-linux-${LIBC}
exit ;;
parisc:Linux:*:* | hppa:Linux:*:*)
# Look for CPU level
case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
- PA7*) echo hppa1.1-unknown-linux-gnu ;;
- PA8*) echo hppa2.0-unknown-linux-gnu ;;
- *) echo hppa-unknown-linux-gnu ;;
+ PA7*) echo hppa1.1-unknown-linux-${LIBC} ;;
+ PA8*) echo hppa2.0-unknown-linux-${LIBC} ;;
+ *) echo hppa-unknown-linux-${LIBC} ;;
esac
exit ;;
ppc64:Linux:*:*)
- echo powerpc64-unknown-linux-gnu
+ echo powerpc64-unknown-linux-${LIBC}
exit ;;
ppc:Linux:*:*)
- echo powerpc-unknown-linux-gnu
+ echo powerpc-unknown-linux-${LIBC}
exit ;;
s390:Linux:*:* | s390x:Linux:*:*)
- echo ${UNAME_MACHINE}-ibm-linux
+ echo ${UNAME_MACHINE}-ibm-linux-${LIBC}
exit ;;
sh64*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
sh*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
sparc:Linux:*:* | sparc64:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
tile*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
vax:Linux:*:*)
- echo ${UNAME_MACHINE}-dec-linux-gnu
+ echo ${UNAME_MACHINE}-dec-linux-${LIBC}
exit ;;
x86_64:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
xtensa*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
i*86:DYNIX/ptx:4*:*)
# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
@@ -1201,6 +1221,9 @@ EOF
BePC:Haiku:*:*) # Haiku running on Intel PC compatible.
echo i586-pc-haiku
exit ;;
+ x86_64:Haiku:*:*)
+ echo x86_64-unknown-haiku
+ exit ;;
SX-4:SUPER-UX:*:*)
echo sx4-nec-superux${UNAME_RELEASE}
exit ;;
@@ -1227,19 +1250,21 @@ EOF
exit ;;
*:Darwin:*:*)
UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
- case $UNAME_PROCESSOR in
- i386)
- eval $set_cc_for_build
- if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
- if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
- (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
- grep IS_64BIT_ARCH >/dev/null
- then
- UNAME_PROCESSOR="x86_64"
- fi
- fi ;;
- unknown) UNAME_PROCESSOR=powerpc ;;
- esac
+ eval $set_cc_for_build
+ if test "$UNAME_PROCESSOR" = unknown ; then
+ UNAME_PROCESSOR=powerpc
+ fi
+ if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
+ if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
+ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
+ grep IS_64BIT_ARCH >/dev/null
+ then
+ case $UNAME_PROCESSOR in
+ i386) UNAME_PROCESSOR=x86_64 ;;
+ powerpc) UNAME_PROCESSOR=powerpc64 ;;
+ esac
+ fi
+ fi
echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
exit ;;
*:procnto*:*:* | *:QNX:[0123456789]*:*)
@@ -1256,7 +1281,7 @@ EOF
NEO-?:NONSTOP_KERNEL:*:*)
echo neo-tandem-nsk${UNAME_RELEASE}
exit ;;
- NSE-?:NONSTOP_KERNEL:*:*)
+ NSE-*:NONSTOP_KERNEL:*:*)
echo nse-tandem-nsk${UNAME_RELEASE}
exit ;;
NSR-?:NONSTOP_KERNEL:*:*)
@@ -1330,9 +1355,6 @@ EOF
exit ;;
esac
-#echo '(No uname command or uname output not recognized.)' 1>&2
-#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
-
eval $set_cc_for_build
cat >$dummy.c <<EOF
#ifdef _SEQUENT_
diff --git a/config.h.in b/config.h.in
index 041e8a3..d95aa51 100644
--- a/config.h.in
+++ b/config.h.in
@@ -6,6 +6,9 @@
/* Disable Orc */
#undef DISABLE_ORC
+/* Defined if gcov is enabled to force a rebuild due to config.h changing */
+#undef GST_GCOV_ENABLED
+
/* Default errorlevel to use */
#undef GST_LEVEL_DEFAULT
diff --git a/config.sub b/config.sub
index 6205f84..8b612ab 100755
--- a/config.sub
+++ b/config.sub
@@ -1,24 +1,18 @@
#! /bin/sh
# Configuration validation subroutine script.
-# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
-# 2011, 2012 Free Software Foundation, Inc.
+# Copyright 1992-2013 Free Software Foundation, Inc.
-timestamp='2012-04-18'
+timestamp='2013-04-24'
-# This file is (in principle) common to ALL GNU software.
-# The presence of a machine in this file suggests that SOME GNU software
-# can handle that machine. It does not imply ALL GNU software can.
-#
-# This file is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
+# This file is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
-# This program 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 General Public License for more details.
+# This program 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
+# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>.
@@ -26,11 +20,12 @@ timestamp='2012-04-18'
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
+# the same distribution terms that you use for the rest of that
+# program. This Exception is an additional permission under section 7
+# of the GNU General Public License, version 3 ("GPLv3").
-# Please send patches to <config-patches@gnu.org>. Submit a context
-# diff and a properly formatted GNU ChangeLog entry.
+# Please send patches with a ChangeLog entry to config-patches@gnu.org.
#
# Configuration subroutine to validate and canonicalize a configuration type.
# Supply the specified configuration type as an argument.
@@ -73,9 +68,7 @@ Report bugs and patches to <config-patches@gnu.org>."
version="\
GNU config.sub ($timestamp)
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
-Free Software Foundation, Inc.
+Copyright 1992-2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -123,7 +116,7 @@ esac
maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
case $maybe_os in
nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
- linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
+ linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
knetbsd*-gnu* | netbsd*-gnu* | \
kopensolaris*-gnu* | \
storm-chaos* | os2-emx* | rtmk-nova*)
@@ -156,7 +149,7 @@ case $os in
-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
- -apple | -axis | -knuth | -cray | -microblaze)
+ -apple | -axis | -knuth | -cray | -microblaze*)
os=
basic_machine=$1
;;
@@ -259,8 +252,10 @@ case $basic_machine in
| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
| am33_2.0 \
- | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \
- | be32 | be64 \
+ | arc | arceb \
+ | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \
+ | avr | avr32 \
+ | be32 | be64 \
| bfin \
| c4x | clipper \
| d10v | d30v | dlx | dsp16xx \
@@ -273,7 +268,7 @@ case $basic_machine in
| le32 | le64 \
| lm32 \
| m32c | m32r | m32rle | m68000 | m68k | m88k \
- | maxq | mb | microblaze | mcore | mep | metag \
+ | maxq | mb | microblaze | microblazeel | mcore | mep | metag \
| mips | mipsbe | mipseb | mipsel | mipsle \
| mips16 \
| mips64 | mips64el \
@@ -291,16 +286,17 @@ case $basic_machine in
| mipsisa64r2 | mipsisa64r2el \
| mipsisa64sb1 | mipsisa64sb1el \
| mipsisa64sr71k | mipsisa64sr71kel \
+ | mipsr5900 | mipsr5900el \
| mipstx39 | mipstx39el \
| mn10200 | mn10300 \
| moxie \
| mt \
| msp430 \
| nds32 | nds32le | nds32be \
- | nios | nios2 \
+ | nios | nios2 | nios2eb | nios2el \
| ns16k | ns32k \
| open8 \
- | or32 \
+ | or1k | or32 \
| pdp10 | pdp11 | pj | pjl \
| powerpc | powerpc64 | powerpc64le | powerpcle \
| pyramid \
@@ -370,7 +366,7 @@ case $basic_machine in
| aarch64-* | aarch64_be-* \
| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
- | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
+ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \
| arm-* | armbe-* | armle-* | armeb-* | armv*-* \
| avr-* | avr32-* \
| be32-* | be64-* \
@@ -389,7 +385,8 @@ case $basic_machine in
| lm32-* \
| m32c-* | m32r-* | m32rle-* \
| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
- | m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \
+ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \
+ | microblaze-* | microblazeel-* \
| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
| mips16-* \
| mips64-* | mips64el-* \
@@ -407,12 +404,13 @@ case $basic_machine in
| mipsisa64r2-* | mipsisa64r2el-* \
| mipsisa64sb1-* | mipsisa64sb1el-* \
| mipsisa64sr71k-* | mipsisa64sr71kel-* \
+ | mipsr5900-* | mipsr5900el-* \
| mipstx39-* | mipstx39el-* \
| mmix-* \
| mt-* \
| msp430-* \
| nds32-* | nds32le-* | nds32be-* \
- | nios-* | nios2-* \
+ | nios-* | nios2-* | nios2eb-* | nios2el-* \
| none-* | np1-* | ns16k-* | ns32k-* \
| open8-* \
| orion-* \
@@ -788,9 +786,13 @@ case $basic_machine in
basic_machine=ns32k-utek
os=-sysv
;;
- microblaze)
+ microblaze*)
basic_machine=microblaze-xilinx
;;
+ mingw64)
+ basic_machine=x86_64-pc
+ os=-mingw64
+ ;;
mingw32)
basic_machine=i386-pc
os=-mingw32
@@ -1019,7 +1021,11 @@ case $basic_machine in
basic_machine=i586-unknown
os=-pw32
;;
- rdos)
+ rdos | rdos64)
+ basic_machine=x86_64-pc
+ os=-rdos
+ ;;
+ rdos32)
basic_machine=i386-pc
os=-rdos
;;
@@ -1346,21 +1352,21 @@ case $os in
-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
| -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
| -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
- | -sym* | -kopensolaris* \
+ | -sym* | -kopensolaris* | -plan9* \
| -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
| -aos* | -aros* \
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
| -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
- | -openbsd* | -solidbsd* \
+ | -bitrig* | -openbsd* | -solidbsd* \
| -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
| -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
| -chorusos* | -chorusrdb* | -cegcc* \
| -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
- | -mingw32* | -linux-gnu* | -linux-android* \
- | -linux-newlib* | -linux-uclibc* \
+ | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
+ | -linux-newlib* | -linux-musl* | -linux-uclibc* \
| -uxpv* | -beos* | -mpeix* | -udk* \
| -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
| -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
@@ -1492,9 +1498,6 @@ case $os in
-aros*)
os=-aros
;;
- -kaos*)
- os=-kaos
- ;;
-zvmoe)
os=-zvmoe
;;
@@ -1586,6 +1589,9 @@ case $basic_machine in
mips*-*)
os=-elf
;;
+ or1k-*)
+ os=-elf
+ ;;
or32-*)
os=-coff
;;
diff --git a/configure b/configure
index 6d0d10a..ca2bfc0 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for GStreamer libav 1.0.8.
+# Generated by GNU Autoconf 2.69 for GStreamer libav 1.1.2.
#
# Report bugs to <http://bugzilla.gnome.org/enter_bug.cgi?product=GStreamer>.
#
@@ -591,8 +591,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='GStreamer libav'
PACKAGE_TARNAME='gst-libav'
-PACKAGE_VERSION='1.0.8'
-PACKAGE_STRING='GStreamer libav 1.0.8'
+PACKAGE_VERSION='1.1.2'
+PACKAGE_STRING='GStreamer libav 1.1.2'
PACKAGE_BUGREPORT='http://bugzilla.gnome.org/enter_bug.cgi?product=GStreamer'
PACKAGE_URL=''
@@ -721,7 +721,6 @@ ENABLE_DOCBOOK_TRUE
HAVE_EPSTOPDF
HAVE_PNMTOPS
HAVE_PNGTOPNM
-HAVE_FIG2DEV
HAVE_XMLLINT
HAVE_DVIPS
CAT_ENTRY_END
@@ -732,7 +731,7 @@ XML_CATALOG
XSLTPROC
HAVE_PS2PDF
HAVE_JADETEX
-HAVE_DOCBOOK2HTML
+HAVE_XSLTPROC
HAVE_DOCBOOK2PS
HAVE_VALGRIND_FALSE
HAVE_VALGRIND_TRUE
@@ -765,6 +764,14 @@ HAVE_CPU_PPC_FALSE
HAVE_CPU_PPC_TRUE
HAVE_CPU_I386_FALSE
HAVE_CPU_I386_TRUE
+GST_GCOV_ENABLED_FALSE
+GST_GCOV_ENABLED_TRUE
+CCASFLAGS
+FFLAGS
+CXXFLAGS
+GCOV
+GCOV_LIBS
+GCOV_CFLAGS
VALGRIND_LIBS
VALGRIND_CFLAGS
GST_PACKAGE_ORIGIN
@@ -825,10 +832,6 @@ GST_AGE
GST_REVISION
GST_CURRENT
GST_API_VERSION
-AM_BACKSLASH
-AM_DEFAULT_VERBOSITY
-AM_DEFAULT_V
-AM_V
MAINT
MAINTAINER_MODE_FALSE
MAINTAINER_MODE_TRUE
@@ -837,6 +840,10 @@ PACKAGE_VERSION_NANO
PACKAGE_VERSION_MICRO
PACKAGE_VERSION_MINOR
PACKAGE_VERSION_MAJOR
+AM_BACKSLASH
+AM_DEFAULT_VERBOSITY
+AM_DEFAULT_V
+AM_V
am__untar
am__tar
AMTAR
@@ -913,8 +920,8 @@ SHELL'
ac_subst_files=''
ac_user_opts='
enable_option_checking
-enable_maintainer_mode
enable_silent_rules
+enable_maintainer_mode
enable_static
enable_shared
with_pic
@@ -933,6 +940,7 @@ with_pkg_config_path
with_package_name
with_package_origin
enable_valgrind
+enable_gcov
enable_docbook
with_html_dir
enable_gtk_doc
@@ -959,6 +967,7 @@ VALGRIND_CFLAGS
VALGRIND_LIBS
GTKDOC_DEPS_CFLAGS
GTKDOC_DEPS_LIBS
+PYTHON
GST_CFLAGS
GST_LIBS
GST_BASE_CFLAGS
@@ -1511,7 +1520,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures GStreamer libav 1.0.8 to adapt to many kinds of systems.
+\`configure' configures GStreamer libav 1.1.2 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1582,7 +1591,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of GStreamer libav 1.0.8:";;
+ short | recursive ) echo "Configuration of GStreamer libav 1.1.2:";;
esac
cat <<\_ACEOF
@@ -1590,21 +1599,26 @@ Optional Features:
--disable-option-checking ignore unrecognized --enable/--with options
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
- --disable-maintainer-mode disable make rules and dependencies not useful
- (and sometimes confusing) to the casual installer
- --enable-silent-rules less verbose build output (undo: `make V=1')
- --disable-silent-rules verbose build output (undo: `make V=0')
+ --enable-silent-rules less verbose build output (undo: "make V=1")
+ --disable-silent-rules verbose build output (undo: "make V=0")
+ --disable-maintainer-mode
+ disable make rules and dependencies not useful (and
+ sometimes confusing) to the casual installer
--enable-static[=PKGS] build static libraries [default=no]
--enable-shared[=PKGS] build shared libraries [default=yes]
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
- --disable-dependency-tracking speeds up one-time build
- --enable-dependency-tracking do not reject slow dependency extractors
+ --enable-dependency-tracking
+ do not reject slow dependency extractors
+ --disable-dependency-tracking
+ speeds up one-time build
--disable-libtool-lock avoid locking (might break parallel builds)
--enable-orc use Orc if installed
--disable-fatal-warnings
Don't turn compiler warnings into fatal errors
--disable-valgrind disable run-time valgrind detection
+ --enable-gcov compile with coverage profiling instrumentation (gcc
+ only)
--enable-docbook use docbook to build documentation [default=no]
--enable-gtk-doc use gtk-doc to build documentation [[default=no]]
--enable-gtk-doc-html build documentation in html format [[default=yes]]
@@ -1657,6 +1671,7 @@ Some influential environment variables:
C compiler flags for GTKDOC_DEPS, overriding pkg-config
GTKDOC_DEPS_LIBS
linker flags for GTKDOC_DEPS, overriding pkg-config
+ PYTHON the Python interpreter
GST_CFLAGS C compiler flags for GST, overriding pkg-config
GST_LIBS linker flags for GST, overriding pkg-config
GST_BASE_CFLAGS
@@ -1745,7 +1760,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-GStreamer libav configure 1.0.8
+GStreamer libav configure 1.1.2
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2160,7 +2175,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by GStreamer libav $as_me 1.0.8, which was
+It was created by GStreamer libav $as_me 1.1.2, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -2652,7 +2667,7 @@ test -n "$target_alias" &&
-am__api_version='1.11'
+am__api_version='1.13'
# Find a good install program. We prefer a C program (faster),
# so one script is as good as another. But avoid the broken or
@@ -2749,9 +2764,6 @@ test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5
$as_echo_n "checking whether build environment is sane... " >&6; }
-# Just in case
-sleep 1
-echo timestamp > conftest.file
# Reject unsafe characters in $srcdir or the absolute working directory
# name. Accept space and tab only in the latter.
am_lf='
@@ -2762,32 +2774,40 @@ case `pwd` in
esac
case $srcdir in
*[\\\"\#\$\&\'\`$am_lf\ \ ]*)
- as_fn_error $? "unsafe srcdir value: \`$srcdir'" "$LINENO" 5;;
+ as_fn_error $? "unsafe srcdir value: '$srcdir'" "$LINENO" 5;;
esac
-# Do `set' in a subshell so we don't clobber the current shell's
+# Do 'set' in a subshell so we don't clobber the current shell's
# arguments. Must try -L first in case configure is actually a
# symlink; some systems play weird games with the mod time of symlinks
# (eg FreeBSD returns the mod time of the symlink's containing
# directory).
if (
- set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
- if test "$*" = "X"; then
- # -L didn't work.
- set X `ls -t "$srcdir/configure" conftest.file`
- fi
- rm -f conftest.file
- if test "$*" != "X $srcdir/configure conftest.file" \
- && test "$*" != "X conftest.file $srcdir/configure"; then
-
- # If neither matched, then we have a broken ls. This can happen
- # if, for instance, CONFIG_SHELL is bash and it inherits a
- # broken ls alias from the environment. This has actually
- # happened. Such a system could not be considered "sane".
- as_fn_error $? "ls -t appears to fail. Make sure there is not a broken
-alias in your environment" "$LINENO" 5
- fi
-
+ am_has_slept=no
+ for am_try in 1 2; do
+ echo "timestamp, slept: $am_has_slept" > conftest.file
+ set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
+ if test "$*" = "X"; then
+ # -L didn't work.
+ set X `ls -t "$srcdir/configure" conftest.file`
+ fi
+ if test "$*" != "X $srcdir/configure conftest.file" \
+ && test "$*" != "X conftest.file $srcdir/configure"; then
+
+ # If neither matched, then we have a broken ls. This can happen
+ # if, for instance, CONFIG_SHELL is bash and it inherits a
+ # broken ls alias from the environment. This has actually
+ # happened. Such a system could not be considered "sane".
+ as_fn_error $? "ls -t appears to fail. Make sure there is not a broken
+ alias in your environment" "$LINENO" 5
+ fi
+ if test "$2" = conftest.file || test $am_try -eq 2; then
+ break
+ fi
+ # Just in case.
+ sleep 1
+ am_has_slept=yes
+ done
test "$2" = conftest.file
)
then
@@ -2799,6 +2819,16 @@ Check your system clock" "$LINENO" 5
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
+# If we didn't sleep, we still need to ensure time stamps of config.status and
+# generated files are strictly newer.
+am_sleep_pid=
+if grep 'slept: no' conftest.file >/dev/null 2>&1; then
+ ( sleep 1 ) &
+ am_sleep_pid=$!
+fi
+
+rm -f conftest.file
+
test "$program_prefix" != NONE &&
program_transform_name="s&^&$program_prefix&;$program_transform_name"
# Use a double $ so make ignores it.
@@ -2821,12 +2851,12 @@ if test x"${MISSING+set}" != xset; then
esac
fi
# Use eval to expand $SHELL
-if eval "$MISSING --run true"; then
- am_missing_run="$MISSING --run "
+if eval "$MISSING --is-lightweight"; then
+ am_missing_run="$MISSING "
else
am_missing_run=
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`missing' script is too old or missing" >&5
-$as_echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5
+$as_echo "$as_me: WARNING: 'missing' script is too old or missing" >&2;}
fi
if test x"${install_sh}" != xset; then
@@ -2838,10 +2868,10 @@ if test x"${install_sh}" != xset; then
esac
fi
-# Installed binaries are usually stripped using `strip' when the user
-# run `make install-strip'. However `strip' might not be the right
+# Installed binaries are usually stripped using 'strip' when the user
+# run "make install-strip". However 'strip' might not be the right
# tool to use in cross-compilation environments, therefore Automake
-# will honor the `STRIP' environment variable to overrule this program.
+# will honor the 'STRIP' environment variable to overrule this program.
if test "$cross_compiling" != no; then
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
@@ -2980,12 +3010,6 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5
$as_echo "$MKDIR_P" >&6; }
-mkdir_p="$MKDIR_P"
-case $mkdir_p in
- [\\/$]* | ?:[\\/]*) ;;
- */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
-esac
-
for ac_prog in gawk mawk nawk awk
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
@@ -3068,6 +3092,45 @@ else
fi
rmdir .tst 2>/dev/null
+# Check whether --enable-silent-rules was given.
+if test "${enable_silent_rules+set}" = set; then :
+ enableval=$enable_silent_rules;
+fi
+
+case $enable_silent_rules in # (((
+ yes) AM_DEFAULT_VERBOSITY=0;;
+ no) AM_DEFAULT_VERBOSITY=1;;
+ *) AM_DEFAULT_VERBOSITY=1;;
+esac
+am_make=${MAKE-make}
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5
+$as_echo_n "checking whether $am_make supports nested variables... " >&6; }
+if ${am_cv_make_support_nested_variables+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if $as_echo 'TRUE=$(BAR$(V))
+BAR0=false
+BAR1=true
+V=1
+am__doit:
+ @$(TRUE)
+.PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then
+ am_cv_make_support_nested_variables=yes
+else
+ am_cv_make_support_nested_variables=no
+fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5
+$as_echo "$am_cv_make_support_nested_variables" >&6; }
+if test $am_cv_make_support_nested_variables = yes; then
+ AM_V='$(V)'
+ AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
+else
+ AM_V=$AM_DEFAULT_VERBOSITY
+ AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
+fi
+AM_BACKSLASH='\'
+
if test "`cd $srcdir && pwd`" != "`pwd`"; then
# Use -I$(srcdir) only when $(srcdir) != ., so that make's output
# is not polluted with repeated "-I."
@@ -3090,7 +3153,7 @@ fi
# Define the identity of the package.
PACKAGE='gst-libav'
- VERSION='1.0.8'
+ VERSION='1.1.2'
cat >>confdefs.h <<_ACEOF
@@ -3118,6 +3181,12 @@ AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"}
MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"}
+# For better backward compatibility. To be removed once Automake 1.9.x
+# dies out for good. For more background, see:
+# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
+# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
+mkdir_p='$(MKDIR_P)'
+
# We need awk for the "check" target. The system "awk" is bad on
# some platforms.
# Always define AMTAR for backward compatibility. Yes, it's still used
@@ -3125,86 +3194,125 @@ MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"}
AMTAR='$${TAR-tar}'
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to create a ustar tar archive" >&5
-$as_echo_n "checking how to create a ustar tar archive... " >&6; }
-# Loop over all known methods to create a tar archive until one works.
+# We'll loop over all known methods to create a tar archive until one works.
_am_tools='gnutar plaintar pax cpio none'
-_am_tools=${am_cv_prog_tar_ustar-$_am_tools}
-# Do not fold the above two line into one, because Tru64 sh and
-# Solaris sh will not grok spaces in the rhs of `-'.
-for _am_tool in $_am_tools
-do
- case $_am_tool in
- gnutar)
- for _am_tar in tar gnutar gtar;
- do
- { echo "$as_me:$LINENO: $_am_tar --version" >&5
+
+# The POSIX 1988 'ustar' format is defined with fixed-size fields.
+ # There is notably a 21 bits limit for the UID and the GID. In fact,
+ # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
+ # and bug#13588).
+ am_max_uid=2097151 # 2^21 - 1
+ am_max_gid=$am_max_uid
+ # The $UID and $GID variables are not portable, so we need to resort
+ # to the POSIX-mandated id(1) utility. Errors in the 'id' calls
+ # below are definitely unexpected, so allow the users to see them
+ # (that is, avoid stderr redirection).
+ am_uid=`id -u || echo unknown`
+ am_gid=`id -g || echo unknown`
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether UID '$am_uid' is supported by ustar format" >&5
+$as_echo_n "checking whether UID '$am_uid' is supported by ustar format... " >&6; }
+ if test $am_uid -le $am_max_uid; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ _am_tools=none
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether GID '$am_gid' is supported by ustar format" >&5
+$as_echo_n "checking whether GID '$am_gid' is supported by ustar format... " >&6; }
+ if test $am_gid -le $am_max_gid; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ _am_tools=none
+ fi
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to create a ustar tar archive" >&5
+$as_echo_n "checking how to create a ustar tar archive... " >&6; }
+
+ # Go ahead even if we have the value already cached. We do so because we
+ # need to set the values for the 'am__tar' and 'am__untar' variables.
+ _am_tools=${am_cv_prog_tar_ustar-$_am_tools}
+
+ for _am_tool in $_am_tools; do
+ case $_am_tool in
+ gnutar)
+ for _am_tar in tar gnutar gtar; do
+ { echo "$as_me:$LINENO: $_am_tar --version" >&5
($_am_tar --version) >&5 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } && break
- done
- am__tar="$_am_tar --format=ustar -chf - "'"$$tardir"'
- am__tar_="$_am_tar --format=ustar -chf - "'"$tardir"'
- am__untar="$_am_tar -xf -"
- ;;
- plaintar)
- # Must skip GNU tar: if it does not support --format= it doesn't create
- # ustar tarball either.
- (tar --version) >/dev/null 2>&1 && continue
- am__tar='tar chf - "$$tardir"'
- am__tar_='tar chf - "$tardir"'
- am__untar='tar xf -'
- ;;
- pax)
- am__tar='pax -L -x ustar -w "$$tardir"'
- am__tar_='pax -L -x ustar -w "$tardir"'
- am__untar='pax -r'
- ;;
- cpio)
- am__tar='find "$$tardir" -print | cpio -o -H ustar -L'
- am__tar_='find "$tardir" -print | cpio -o -H ustar -L'
- am__untar='cpio -i -H ustar -d'
- ;;
- none)
- am__tar=false
- am__tar_=false
- am__untar=false
- ;;
- esac
+ done
+ am__tar="$_am_tar --format=ustar -chf - "'"$$tardir"'
+ am__tar_="$_am_tar --format=ustar -chf - "'"$tardir"'
+ am__untar="$_am_tar -xf -"
+ ;;
+ plaintar)
+ # Must skip GNU tar: if it does not support --format= it doesn't create
+ # ustar tarball either.
+ (tar --version) >/dev/null 2>&1 && continue
+ am__tar='tar chf - "$$tardir"'
+ am__tar_='tar chf - "$tardir"'
+ am__untar='tar xf -'
+ ;;
+ pax)
+ am__tar='pax -L -x ustar -w "$$tardir"'
+ am__tar_='pax -L -x ustar -w "$tardir"'
+ am__untar='pax -r'
+ ;;
+ cpio)
+ am__tar='find "$$tardir" -print | cpio -o -H ustar -L'
+ am__tar_='find "$tardir" -print | cpio -o -H ustar -L'
+ am__untar='cpio -i -H ustar -d'
+ ;;
+ none)
+ am__tar=false
+ am__tar_=false
+ am__untar=false
+ ;;
+ esac
- # If the value was cached, stop now. We just wanted to have am__tar
- # and am__untar set.
- test -n "${am_cv_prog_tar_ustar}" && break
+ # If the value was cached, stop now. We just wanted to have am__tar
+ # and am__untar set.
+ test -n "${am_cv_prog_tar_ustar}" && break
- # tar/untar a dummy directory, and stop if the command works
- rm -rf conftest.dir
- mkdir conftest.dir
- echo GrepMe > conftest.dir/file
- { echo "$as_me:$LINENO: tardir=conftest.dir && eval $am__tar_ >conftest.tar" >&5
+ # tar/untar a dummy directory, and stop if the command works.
+ rm -rf conftest.dir
+ mkdir conftest.dir
+ echo GrepMe > conftest.dir/file
+ { echo "$as_me:$LINENO: tardir=conftest.dir && eval $am__tar_ >conftest.tar" >&5
(tardir=conftest.dir && eval $am__tar_ >conftest.tar) >&5 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }
- rm -rf conftest.dir
- if test -s conftest.tar; then
- { echo "$as_me:$LINENO: $am__untar <conftest.tar" >&5
+ rm -rf conftest.dir
+ if test -s conftest.tar; then
+ { echo "$as_me:$LINENO: $am__untar <conftest.tar" >&5
($am__untar <conftest.tar) >&5 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }
- grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
- fi
-done
-rm -rf conftest.dir
+ { echo "$as_me:$LINENO: cat conftest.dir/file" >&5
+ (cat conftest.dir/file) >&5 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+ grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
+ fi
+ done
+ rm -rf conftest.dir
-if ${am_cv_prog_tar_ustar+:} false; then :
+ if ${am_cv_prog_tar_ustar+:} false; then :
$as_echo_n "(cached) " >&6
else
am_cv_prog_tar_ustar=$_am_tool
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_tar_ustar" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_tar_ustar" >&5
$as_echo "$am_cv_prog_tar_ustar" >&6; }
@@ -3213,9 +3321,10 @@ $as_echo "$am_cv_prog_tar_ustar" >&6; }
- PACKAGE_VERSION_MAJOR=$(echo 1.0.8 | cut -d'.' -f1)
- PACKAGE_VERSION_MINOR=$(echo 1.0.8 | cut -d'.' -f2)
- PACKAGE_VERSION_MICRO=$(echo 1.0.8 | cut -d'.' -f3)
+
+ PACKAGE_VERSION_MAJOR=$(echo 1.1.2 | cut -d'.' -f1)
+ PACKAGE_VERSION_MINOR=$(echo 1.1.2 | cut -d'.' -f2)
+ PACKAGE_VERSION_MICRO=$(echo 1.1.2 | cut -d'.' -f3)
@@ -3226,7 +3335,7 @@ $as_echo "$am_cv_prog_tar_ustar" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking nano version" >&5
$as_echo_n "checking nano version... " >&6; }
- NANO=$(echo 1.0.8 | cut -d'.' -f4)
+ NANO=$(echo 1.1.2 | cut -d'.' -f4)
if test x"$NANO" = x || test "x$NANO" = "x0" ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: 0 (release)" >&5
@@ -3285,10 +3394,10 @@ if test "${enable_silent_rules+set}" = set; then :
enableval=$enable_silent_rules;
fi
-case $enable_silent_rules in
-yes) AM_DEFAULT_VERBOSITY=0;;
-no) AM_DEFAULT_VERBOSITY=1;;
-*) AM_DEFAULT_VERBOSITY=0;;
+case $enable_silent_rules in # (((
+ yes) AM_DEFAULT_VERBOSITY=0;;
+ no) AM_DEFAULT_VERBOSITY=1;;
+ *) AM_DEFAULT_VERBOSITY=0;;
esac
am_make=${MAKE-make}
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5
@@ -3444,7 +3553,7 @@ am__quote=
_am_result=none
# First try GNU make style include.
echo "include confinc" > confmf
-# Ignore all kinds of additional output from `make'.
+# Ignore all kinds of additional output from 'make'.
case `$am_make -s -f confmf 2> /dev/null` in #(
*the\ am__doit\ target*)
am__include=include
@@ -4288,8 +4397,8 @@ else
# We make a subdir and do the tests there. Otherwise we can end up
# making bogus files that we don't know about and never remove. For
# instance it was reported that on HP-UX the gcc test will end up
- # making a dummy file named `D' -- because `-MD' means `put the output
- # in D'.
+ # making a dummy file named 'D' -- because '-MD' means "put the output
+ # in D".
rm -rf conftest.dir
mkdir conftest.dir
# Copy depcomp to subdir because otherwise we won't find it if we're
@@ -4324,16 +4433,16 @@ else
: > sub/conftest.c
for i in 1 2 3 4 5 6; do
echo '#include "conftst'$i'.h"' >> sub/conftest.c
- # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
- # Solaris 8's {/usr,}/bin/sh.
- touch sub/conftst$i.h
+ # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
+ # Solaris 10 /bin/sh.
+ echo '/* dummy */' > sub/conftst$i.h
done
echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
- # We check with `-c' and `-o' for the sake of the "dashmstdout"
+ # We check with '-c' and '-o' for the sake of the "dashmstdout"
# mode. It turns out that the SunPro C++ compiler does not properly
- # handle `-M -o', and we need to detect this. Also, some Intel
- # versions had trouble with output in subdirs
+ # handle '-M -o', and we need to detect this. Also, some Intel
+ # versions had trouble with output in subdirs.
am__obj=sub/conftest.${OBJEXT-o}
am__minus_obj="-o $am__obj"
case $depmode in
@@ -4342,8 +4451,8 @@ else
test "$am__universal" = false || continue
;;
nosideeffect)
- # after this tag, mechanisms are not by side-effect, so they'll
- # only be used when explicitly requested
+ # After this tag, mechanisms are not by side-effect, so they'll
+ # only be used when explicitly requested.
if test "x$enable_dependency_tracking" = xyes; then
continue
else
@@ -4351,7 +4460,7 @@ else
fi
;;
msvc7 | msvc7msys | msvisualcpp | msvcmsys)
- # This compiler won't grok `-c -o', but also, the minuso test has
+ # This compiler won't grok '-c -o', but also, the minuso test has
# not run yet. These depmodes are late enough in the game, and
# so weak that their functioning should not be impacted.
am__obj=conftest.${OBJEXT-o}
@@ -7813,10 +7922,10 @@ fi
done
- GST_CURRENT=7
+ GST_CURRENT=102
GST_REVISION=0
- GST_AGE=7
- GST_LIBVERSION=7:0:7
+ GST_AGE=102
+ GST_LIBVERSION=102:0:102
@@ -12141,7 +12250,8 @@ CC="$lt_save_CC"
-GST_REQ=1.0.0
+GST_REQ=1.1.2
+GST_PBREQ=1.1.2
ORC_REQ=0.4.16
@@ -12670,6 +12780,128 @@ $as_echo "$as_me: Using extra code paths for valgrind" >&6;}
fi
+ # Check whether --enable-gcov was given.
+if test "${enable_gcov+set}" = set; then :
+ enableval=$enable_gcov; enable_gcov=$enableval
+else
+ enable_gcov=no
+fi
+
+ if test x$enable_gcov = xyes ; then
+ if test "x$GCC" != "xyes"
+ then
+ as_fn_error $? "gcov only works if gcc is used" "$LINENO" 5
+ fi
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking to see if compiler understands \"-fprofile-arcs\"" >&5
+$as_echo_n "checking to see if compiler understands \"-fprofile-arcs\"... " >&6; }
+
+ save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS "-fprofile-arcs""
+
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ flag_ok=yes
+else
+ flag_ok=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ CFLAGS="$save_CFLAGS"
+
+ if test "X$flag_ok" = Xyes ; then
+ GCOV_CFLAGS="$GCOV_CFLAGS -fprofile-arcs"
+ true
+ else
+ true
+ true
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $flag_ok" >&5
+$as_echo "$flag_ok" >&6; }
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking to see if compiler understands \"-ftest-coverage\"" >&5
+$as_echo_n "checking to see if compiler understands \"-ftest-coverage\"... " >&6; }
+
+ save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS "-ftest-coverage""
+
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ flag_ok=yes
+else
+ flag_ok=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ CFLAGS="$save_CFLAGS"
+
+ if test "X$flag_ok" = Xyes ; then
+ GCOV_CFLAGS="$GCOV_CFLAGS -ftest-coverage"
+ true
+ else
+ true
+ true
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $flag_ok" >&5
+$as_echo "$flag_ok" >&6; }
+
+ GCOV_CFLAGS=`echo "$GCOV_CFLAGS" | sed -e 's/-O[0-9]*//g'`
+ GCOV_LIBS=-lgcov
+
+
+ GCOV=`echo $CC | sed s/gcc/gcov/g`
+
+
+ GST_GCOV_ENABLED=yes
+
+cat >>confdefs.h <<_ACEOF
+#define GST_GCOV_ENABLED 1
+_ACEOF
+
+ if test "x$GST_GCOV_ENABLED" = "xyes"
+ then
+ CFLAGS="$CFLAGS -O0"
+
+ CXXFLAGS="$CXXFLAGS -O0"
+
+ FFLAGS="$FFLAGS -O0"
+
+ CCASFLAGS="$CCASFLAGS -O0"
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: gcov enabled, setting CFLAGS and friends to $CFLAGS" >&5
+$as_echo "$as_me: gcov enabled, setting CFLAGS and friends to $CFLAGS" >&6;}
+ fi
+ fi
+ if test x$enable_gcov = xyes; then
+ GST_GCOV_ENABLED_TRUE=
+ GST_GCOV_ENABLED_FALSE='#'
+else
+ GST_GCOV_ENABLED_TRUE='#'
+ GST_GCOV_ENABLED_FALSE=
+fi
+
+
+
@@ -13689,8 +13921,8 @@ else
# We make a subdir and do the tests there. Otherwise we can end up
# making bogus files that we don't know about and never remove. For
# instance it was reported that on HP-UX the gcc test will end up
- # making a dummy file named `D' -- because `-MD' means `put the output
- # in D'.
+ # making a dummy file named 'D' -- because '-MD' means "put the output
+ # in D".
rm -rf conftest.dir
mkdir conftest.dir
# Copy depcomp to subdir because otherwise we won't find it if we're
@@ -13725,16 +13957,16 @@ else
: > sub/conftest.c
for i in 1 2 3 4 5 6; do
echo '#include "conftst'$i'.h"' >> sub/conftest.c
- # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
- # Solaris 8's {/usr,}/bin/sh.
- touch sub/conftst$i.h
+ # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
+ # Solaris 10 /bin/sh.
+ echo '/* dummy */' > sub/conftst$i.h
done
echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
- # We check with `-c' and `-o' for the sake of the "dashmstdout"
+ # We check with '-c' and '-o' for the sake of the "dashmstdout"
# mode. It turns out that the SunPro C++ compiler does not properly
- # handle `-M -o', and we need to detect this. Also, some Intel
- # versions had trouble with output in subdirs
+ # handle '-M -o', and we need to detect this. Also, some Intel
+ # versions had trouble with output in subdirs.
am__obj=sub/conftest.${OBJEXT-o}
am__minus_obj="-o $am__obj"
case $depmode in
@@ -13743,8 +13975,8 @@ else
test "$am__universal" = false || continue
;;
nosideeffect)
- # after this tag, mechanisms are not by side-effect, so they'll
- # only be used when explicitly requested
+ # After this tag, mechanisms are not by side-effect, so they'll
+ # only be used when explicitly requested.
if test "x$enable_dependency_tracking" = xyes; then
continue
else
@@ -13752,7 +13984,7 @@ else
fi
;;
msvc7 | msvc7msys | msvisualcpp | msvcmsys)
- # This compiler won't grok `-c -o', but also, the minuso test has
+ # This compiler won't grok '-c -o', but also, the minuso test has
# not run yet. These depmodes are late enough in the game, and
# so weak that their functioning should not be impacted.
am__obj=conftest.${OBJEXT-o}
@@ -14333,15 +14565,15 @@ $as_echo "no" >&6; }
fi
- # Extract the first word of "docbook2html", so it can be a program name with args.
-set dummy docbook2html; ac_word=$2
+ # Extract the first word of "xsltproc", so it can be a program name with args.
+set dummy xsltproc; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_HAVE_DOCBOOK2HTML+:} false; then :
+if ${ac_cv_prog_HAVE_XSLTPROC+:} false; then :
$as_echo_n "(cached) " >&6
else
- if test -n "$HAVE_DOCBOOK2HTML"; then
- ac_cv_prog_HAVE_DOCBOOK2HTML="$HAVE_DOCBOOK2HTML" # Let the user override the test.
+ if test -n "$HAVE_XSLTPROC"; then
+ ac_cv_prog_HAVE_XSLTPROC="$HAVE_XSLTPROC" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
@@ -14350,7 +14582,7 @@ do
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_HAVE_DOCBOOK2HTML="yes"
+ ac_cv_prog_HAVE_XSLTPROC="yes"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
@@ -14358,13 +14590,13 @@ done
done
IFS=$as_save_IFS
- test -z "$ac_cv_prog_HAVE_DOCBOOK2HTML" && ac_cv_prog_HAVE_DOCBOOK2HTML="no"
+ test -z "$ac_cv_prog_HAVE_XSLTPROC" && ac_cv_prog_HAVE_XSLTPROC="no"
fi
fi
-HAVE_DOCBOOK2HTML=$ac_cv_prog_HAVE_DOCBOOK2HTML
-if test -n "$HAVE_DOCBOOK2HTML"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $HAVE_DOCBOOK2HTML" >&5
-$as_echo "$HAVE_DOCBOOK2HTML" >&6; }
+HAVE_XSLTPROC=$ac_cv_prog_HAVE_XSLTPROC
+if test -n "$HAVE_XSLTPROC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $HAVE_XSLTPROC" >&5
+$as_echo "$HAVE_XSLTPROC" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
@@ -14448,33 +14680,6 @@ fi
- # -V option appeared in 0.6.10
- docbook2html_min_version=0.6.10
- if test "x$HAVE_DOCBOOK2HTML" != "xno"; then
- docbook2html_version=`docbook2html --version`
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking docbook2html version ($docbook2html_version) >= $docbook2html_min_version" >&5
-$as_echo_n "checking docbook2html version ($docbook2html_version) >= $docbook2html_min_version... " >&6; }
- if perl -w <<EOF
- (\$min_version_major, \$min_version_minor, \$min_version_micro ) = "$docbook2html_min_version" =~ /(\d+)\.(\d+)\.(\d+)/;
- (\$docbook2html_version_major, \$docbook2html_version_minor, \$docbook2html_version_micro ) = "$docbook2html_version" =~ /(\d+)\.(\d+)\.(\d+)/;
- exit (((\$docbook2html_version_major > \$min_version_major) ||
- ((\$docbook2html_version_major == \$min_version_major) &&
- (\$docbook2html_version_minor >= \$min_version_minor)) ||
- ((\$docbook2html_version_major == \$min_version_major) &&
- (\$docbook2html_version_minor >= \$min_version_minor) &&
- (\$docbook2html_version_micro >= \$min_version_micro)))
- ? 0 : 1);
-EOF
- then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
- else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
- HAVE_DOCBOOK2HTML=no
- fi
- fi
-
XSLTPROC_FLAGS=--nonet
DOCBOOK_ROOT=
@@ -14482,7 +14687,19 @@ $as_echo "no" >&6; }
TYPE_UC=XML
DOCBOOK_VERSION=4.1.2
- if test ! -f /etc/xml/catalog; then
+ if test -n "$XML_CATALOG_FILES"; then
+ oldIFS=$IFS
+ IFS=' '
+ for xml_catalog_file in $XML_CATALOG_FILES; do
+ if test -f $xml_catalog_file; then
+ XML_CATALOG=$xml_catalog_file
+ CAT_ENTRY_START='<!--'
+ CAT_ENTRY_END='-->'
+ break
+ fi
+ done
+ IFS=$oldIFS
+ elif test ! -f /etc/xml/catalog; then
for i in /usr/share/sgml/docbook/stylesheet/xsl/nwalsh /usr/share/sgml/docbook/xsl-stylesheets/ /usr/local/share/xsl/docbook ;
do
if test -d "$i"; then
@@ -14645,71 +14862,6 @@ fi
- # Extract the first word of "fig2dev", so it can be a program name with args.
-set dummy fig2dev; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_HAVE_FIG2DEV+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- if test -n "$HAVE_FIG2DEV"; then
- ac_cv_prog_HAVE_FIG2DEV="$HAVE_FIG2DEV" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_HAVE_FIG2DEV="yes"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
- done
-IFS=$as_save_IFS
-
- test -z "$ac_cv_prog_HAVE_FIG2DEV" && ac_cv_prog_HAVE_FIG2DEV="no"
-fi
-fi
-HAVE_FIG2DEV=$ac_cv_prog_HAVE_FIG2DEV
-if test -n "$HAVE_FIG2DEV"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $HAVE_FIG2DEV" >&5
-$as_echo "$HAVE_FIG2DEV" >&6; }
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
- if test "x$HAVE_FIG2DEV" = "xno" ; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Did not find fig2dev (from xfig), images will not be generated." >&5
-$as_echo "$as_me: WARNING: Did not find fig2dev (from xfig), images will not be generated." >&2;}
- fi
-
- HAVE_FIG2DEV_EPS=no
- if test "x$HAVE_FIG2DEV" = "xyes" ; then
- fig2dev_quiet=`fig2dev -L eps </dev/null 2>&1 >/dev/null`
- if test "x$fig2dev_quiet" = "x" ; then
- HAVE_FIG2DEV_EPS=yes
- fi
- fi
- HAVE_FIG2DEV_PNG=no
- if test "x$HAVE_FIG2DEV" = "xyes" ; then
- fig2dev_quiet=`fig2dev -L png </dev/null 2>&1 >/dev/null`
- if test "x$fig2dev_quiet" = "x" ; then
- HAVE_FIG2DEV_PNG=yes
- fi
- fi
- HAVE_FIG2DEV_PDF=no
- if test "x$HAVE_FIG2DEV" = "xyes" ; then
- fig2dev_quiet=`fig2dev -L pdf </dev/null 2>&1 >/dev/null`
- if test "x$fig2dev_quiet" = "x" ; then
- HAVE_FIG2DEV_PDF=yes
- fi
- fi
-
# Extract the first word of "pngtopnm", so it can be a program name with args.
set dummy pngtopnm; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
@@ -14825,10 +14977,9 @@ fi
- if test "x$HAVE_DOCBOOK2HTML" = "xyes" && \
+ if test "x$HAVE_XSLTPROC" = "xyes" && \
test "x$enable_docbook" = "xyes" && \
- test "x$HAVE_XMLLINT" = "xyes" && \
- test "x$HAVE_FIG2DEV_PNG" = "xyes"; then
+ test "x$HAVE_XMLLINT" = "xyes"; then
DOC_HTML=yes
{ $as_echo "$as_me:${as_lineno-$LINENO}: Will output HTML documentation" >&5
$as_echo "$as_me: Will output HTML documentation" >&6;}
@@ -14842,7 +14993,6 @@ $as_echo "$as_me: Will not output HTML documentation" >&6;}
test "x$enable_docbook" = "xyes" && \
test "x$HAVE_XMLLINT" = "xyes" && \
test "x$HAVE_JADETEX" = "xyes" && \
- test "x$HAVE_FIG2DEV_EPS" = "xyes" && \
test "x$HAVE_DVIPS" = "xyes" && \
test "x$HAVE_PNGTOPNM" = "xyes" && \
test "x$HAVE_PNMTOPS" = "xyes"; then
@@ -15422,13 +15572,225 @@ $as_echo "looks good" >&6; }
+
+
+
+
+ # Find any Python interpreter.
+ if test -z "$PYTHON"; then
+ for ac_prog in python python2 python3 python3.3 python3.2 python3.1 python3.0 python2.7 python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 python2.0
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_PYTHON+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $PYTHON in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_PYTHON="$PYTHON" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_path_PYTHON="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+PYTHON=$ac_cv_path_PYTHON
+if test -n "$PYTHON"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON" >&5
+$as_echo "$PYTHON" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$PYTHON" && break
+done
+test -n "$PYTHON" || PYTHON=":"
+
+ fi
+ am_display_PYTHON=python
+
+
+ if test "$PYTHON" = :; then
+ as_fn_error $? "no suitable Python interpreter found" "$LINENO" 5
+ else
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $am_display_PYTHON version" >&5
+$as_echo_n "checking for $am_display_PYTHON version... " >&6; }
+if ${am_cv_python_version+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ am_cv_python_version=`$PYTHON -c "import sys; sys.stdout.write(sys.version[:3])"`
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_python_version" >&5
+$as_echo "$am_cv_python_version" >&6; }
+ PYTHON_VERSION=$am_cv_python_version
+
+
+
+ PYTHON_PREFIX='${prefix}'
+
+ PYTHON_EXEC_PREFIX='${exec_prefix}'
+
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $am_display_PYTHON platform" >&5
+$as_echo_n "checking for $am_display_PYTHON platform... " >&6; }
+if ${am_cv_python_platform+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ am_cv_python_platform=`$PYTHON -c "import sys; sys.stdout.write(sys.platform)"`
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_python_platform" >&5
+$as_echo "$am_cv_python_platform" >&6; }
+ PYTHON_PLATFORM=$am_cv_python_platform
+
+
+ # Just factor out some code duplication.
+ am_python_setup_sysconfig="\
+import sys
+# Prefer sysconfig over distutils.sysconfig, for better compatibility
+# with python 3.x. See automake bug#10227.
+try:
+ import sysconfig
+except ImportError:
+ can_use_sysconfig = 0
+else:
+ can_use_sysconfig = 1
+# Can't use sysconfig in CPython 2.7, since it's broken in virtualenvs:
+# <https://github.com/pypa/virtualenv/issues/118>
+try:
+ from platform import python_implementation
+ if python_implementation() == 'CPython' and sys.version[:3] == '2.7':
+ can_use_sysconfig = 0
+except ImportError:
+ pass"
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $am_display_PYTHON script directory" >&5
+$as_echo_n "checking for $am_display_PYTHON script directory... " >&6; }
+if ${am_cv_python_pythondir+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test "x$prefix" = xNONE
+ then
+ am_py_prefix=$ac_default_prefix
+ else
+ am_py_prefix=$prefix
+ fi
+ am_cv_python_pythondir=`$PYTHON -c "
+$am_python_setup_sysconfig
+if can_use_sysconfig:
+ sitedir = sysconfig.get_path('purelib', vars={'base':'$am_py_prefix'})
+else:
+ from distutils import sysconfig
+ sitedir = sysconfig.get_python_lib(0, 0, prefix='$am_py_prefix')
+sys.stdout.write(sitedir)"`
+ case $am_cv_python_pythondir in
+ $am_py_prefix*)
+ am__strip_prefix=`echo "$am_py_prefix" | sed 's|.|.|g'`
+ am_cv_python_pythondir=`echo "$am_cv_python_pythondir" | sed "s,^$am__strip_prefix,$PYTHON_PREFIX,"`
+ ;;
+ *)
+ case $am_py_prefix in
+ /usr|/System*) ;;
+ *)
+ am_cv_python_pythondir=$PYTHON_PREFIX/lib/python$PYTHON_VERSION/site-packages
+ ;;
+ esac
+ ;;
+ esac
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_python_pythondir" >&5
+$as_echo "$am_cv_python_pythondir" >&6; }
+ pythondir=$am_cv_python_pythondir
+
+
+
+ pkgpythondir=\${pythondir}/$PACKAGE
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $am_display_PYTHON extension module directory" >&5
+$as_echo_n "checking for $am_display_PYTHON extension module directory... " >&6; }
+if ${am_cv_python_pyexecdir+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test "x$exec_prefix" = xNONE
+ then
+ am_py_exec_prefix=$am_py_prefix
+ else
+ am_py_exec_prefix=$exec_prefix
+ fi
+ am_cv_python_pyexecdir=`$PYTHON -c "
+$am_python_setup_sysconfig
+if can_use_sysconfig:
+ sitedir = sysconfig.get_path('platlib', vars={'platbase':'$am_py_prefix'})
+else:
+ from distutils import sysconfig
+ sitedir = sysconfig.get_python_lib(1, 0, prefix='$am_py_prefix')
+sys.stdout.write(sitedir)"`
+ case $am_cv_python_pyexecdir in
+ $am_py_exec_prefix*)
+ am__strip_prefix=`echo "$am_py_exec_prefix" | sed 's|.|.|g'`
+ am_cv_python_pyexecdir=`echo "$am_cv_python_pyexecdir" | sed "s,^$am__strip_prefix,$PYTHON_EXEC_PREFIX,"`
+ ;;
+ *)
+ case $am_py_exec_prefix in
+ /usr|/System*) ;;
+ *)
+ am_cv_python_pyexecdir=$PYTHON_EXEC_PREFIX/lib/python$PYTHON_VERSION/site-packages
+ ;;
+ esac
+ ;;
+ esac
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_python_pyexecdir" >&5
+$as_echo "$am_cv_python_pyexecdir" >&6; }
+ pyexecdir=$am_cv_python_pyexecdir
+
+
+
+ pkgpyexecdir=\${pyexecdir}/$PACKAGE
+
+
+
+ fi
+
+
+
+
build_plugin_docs=no
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build plugin documentation" >&5
$as_echo_n "checking whether to build plugin documentation... " >&6; }
if test x$enable_gtk_doc = xyes; then
- build_plugin_docs=yes
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+ if test x$PYTHON != x; then
+ build_plugin_docs=yes
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no (python not found)" >&5
+$as_echo "no (python not found)" >&6; }
+ fi
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no (gtk-doc disabled or not available)" >&5
$as_echo "no (gtk-doc disabled or not available)" >&6; }
@@ -15924,7 +16286,7 @@ fi
module=gstreamer-plugins-base-$GST_API_VERSION
- minver=$GST_REQ
+ minver=$GST_PBREQ
name="GStreamer Base Plugins"
required="yes"
@@ -16232,42 +16594,6 @@ fi
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking to see if compiler understands " >&5
-$as_echo_n "checking to see if compiler understands ... " >&6; }
-
- save_CFLAGS="$CFLAGS"
- CFLAGS="$CFLAGS "
-
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-int
-main ()
-{
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- flag_ok=yes
-else
- flag_ok=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
- CFLAGS="$save_CFLAGS"
-
- if test "X$flag_ok" = Xyes ; then
-
- true
- else
-
- true
- fi
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $flag_ok" >&5
-$as_echo "$flag_ok" >&6; }
-
-
@@ -17240,7 +17566,7 @@ else
fi
-ac_config_files="$ac_config_files Makefile common/Makefile common/m4/Makefile gst-libav.spec ext/Makefile ext/libav/Makefile ext/libswscale/Makefile gst-libs/Makefile gst-libs/ext/Makefile docs/Makefile docs/version.entities tests/Makefile tests/check/Makefile tests/files/Makefile"
+ac_config_files="$ac_config_files Makefile common/Makefile common/m4/Makefile gst-libav.spec ext/Makefile ext/libav/Makefile ext/libswscale/Makefile gst-libs/Makefile gst-libs/ext/Makefile docs/Makefile docs/version.entities tests/Makefile tests/check/Makefile tests/files/Makefile pkgconfig/Makefile pkgconfig/gstreamer-plugins-libav-uninstalled.pc"
cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
@@ -17351,6 +17677,14 @@ LIBOBJS=$ac_libobjs
LTLIBOBJS=$ac_ltlibobjs
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5
+$as_echo_n "checking that generated files are newer than configure... " >&6; }
+ if test -n "$am_sleep_pid"; then
+ # Hide warnings about reused PIDs.
+ wait $am_sleep_pid 2>/dev/null
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: done" >&5
+$as_echo "done" >&6; }
if test -n "$EXEEXT"; then
am__EXEEXT_TRUE=
am__EXEEXT_FALSE='#'
@@ -17379,6 +17713,10 @@ if test -z "${HAVE_ORCC_TRUE}" && test -z "${HAVE_ORCC_FALSE}"; then
as_fn_error $? "conditional \"HAVE_ORCC\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${GST_GCOV_ENABLED_TRUE}" && test -z "${GST_GCOV_ENABLED_FALSE}"; then
+ as_fn_error $? "conditional \"GST_GCOV_ENABLED\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -z "${HAVE_CPU_I386_TRUE}" && test -z "${HAVE_CPU_I386_FALSE}"; then
as_fn_error $? "conditional \"HAVE_CPU_I386\" was never defined.
@@ -17897,7 +18235,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by GStreamer libav $as_me 1.0.8, which was
+This file was extended by GStreamer libav $as_me 1.1.2, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -17963,7 +18301,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-GStreamer libav config.status 1.0.8
+GStreamer libav config.status 1.1.2
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
@@ -18390,6 +18728,8 @@ do
"tests/Makefile") CONFIG_FILES="$CONFIG_FILES tests/Makefile" ;;
"tests/check/Makefile") CONFIG_FILES="$CONFIG_FILES tests/check/Makefile" ;;
"tests/files/Makefile") CONFIG_FILES="$CONFIG_FILES tests/files/Makefile" ;;
+ "pkgconfig/Makefile") CONFIG_FILES="$CONFIG_FILES pkgconfig/Makefile" ;;
+ "pkgconfig/gstreamer-plugins-libav-uninstalled.pc") CONFIG_FILES="$CONFIG_FILES pkgconfig/gstreamer-plugins-libav-uninstalled.pc" ;;
*) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
esac
@@ -18986,7 +19326,7 @@ $as_echo "$as_me: executing $ac_file commands" >&6;}
case $ac_file$ac_mode in
"depfiles":C) test x"$AMDEP_TRUE" != x"" || {
- # Autoconf 2.62 quotes --file arguments for eval, but not when files
+ # Older Autoconf quotes --file arguments for eval, but not when files
# are listed without --file. Let's play safe and only enable the eval
# if we detect the quoting.
case $CONFIG_FILES in
@@ -18999,7 +19339,7 @@ $as_echo "$as_me: executing $ac_file commands" >&6;}
# Strip MF so we end up with the name of the file.
mf=`echo "$mf" | sed -e 's/:.*$//'`
# Check whether this is an Automake generated Makefile or not.
- # We used to match only the files named `Makefile.in', but
+ # We used to match only the files named 'Makefile.in', but
# some people rename them; so instead we look at the file content.
# Grep'ing the first line is not enough: some people post-process
# each Makefile.in and add a new line on top of each file to say so.
@@ -19033,21 +19373,19 @@ $as_echo X"$mf" |
continue
fi
# Extract the definition of DEPDIR, am__include, and am__quote
- # from the Makefile without running `make'.
+ # from the Makefile without running 'make'.
DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
test -z "$DEPDIR" && continue
am__include=`sed -n 's/^am__include = //p' < "$mf"`
- test -z "am__include" && continue
+ test -z "$am__include" && continue
am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
- # When using ansi2knr, U may be empty or an underscore; expand it
- U=`sed -n 's/^U = //p' < "$mf"`
# Find all dependency output files, they are included files with
# $(DEPDIR) in their names. We invoke sed twice because it is the
# simplest approach to changing $(DEPDIR) to its actual value in the
# expansion.
for file in `sed -n "
s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
- sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
+ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
# Make sure the directory exists.
test -f "$dirpart/$file" && continue
fdir=`$as_dirname -- "$file" ||
diff --git a/configure.ac b/configure.ac
index 9d62800..daaef84 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3,7 +3,7 @@ AC_PREREQ(2.62)
dnl initialize autoconf
dnl when going to/from release please set the nano (fourth number) right !
dnl releases only do Wall, cvs and prerelease does Werror too
-AC_INIT(GStreamer libav, 1.0.8,
+AC_INIT(GStreamer libav, 1.1.2,
http://bugzilla.gnome.org/enter_bug.cgi?product=GStreamer,
gst-libav)
@@ -42,10 +42,11 @@ GST_API_VERSION=1.0
AC_SUBST(GST_API_VERSION)
AG_GST_LIBTOOL_PREPARE
-AS_LIBTOOL(GST, 7, 0, 7)
+AS_LIBTOOL(GST, 102, 0, 102)
dnl *** required versions of GStreamer stuff ***
-GST_REQ=1.0.0
+GST_REQ=1.1.2
+GST_PBREQ=1.1.2
ORC_REQ=0.4.16
ORC_CHECK([$ORC_REQ])
@@ -66,6 +67,7 @@ AG_GST_ARG_WITH_PKG_CONFIG_PATH
AG_GST_ARG_WITH_PACKAGE_NAME
AG_GST_ARG_WITH_PACKAGE_ORIGIN
AG_GST_ARG_VALGRIND
+AG_GST_ARG_GCOV
dnl *** checks for platform ***
@@ -118,7 +120,7 @@ dnl checks for gstreamer
dnl uninstalled is selected preferentially -- see pkg-config(1)
AG_GST_CHECK_GST($GST_API_VERSION, [$GST_REQ])
AG_GST_CHECK_GST_BASE($GST_API_VERSION, [$GST_REQ])
-AG_GST_CHECK_GST_PLUGINS_BASE($GST_API_VERSION, [$GST_REQ])
+AG_GST_CHECK_GST_PLUGINS_BASE($GST_API_VERSION, [$GST_PBREQ])
AG_GST_CHECK_GST_CHECK($GST_API_VERSION, [$GST_REQ], no)
AM_CONDITIONAL(HAVE_GST_CHECK, test "x$HAVE_GST_CHECK" = "xyes")
@@ -467,6 +469,8 @@ docs/version.entities
tests/Makefile
tests/check/Makefile
tests/files/Makefile
+pkgconfig/Makefile
+pkgconfig/gstreamer-plugins-libav-uninstalled.pc
)
AC_OUTPUT
diff --git a/depcomp b/depcomp
index 25a39e6..06b0882 100755
--- a/depcomp
+++ b/depcomp
@@ -1,10 +1,9 @@
#! /bin/sh
# depcomp - compile a program generating dependencies as side-effects
-scriptversion=2012-03-27.16; # UTC
+scriptversion=2012-10-18.11; # UTC
-# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009, 2010,
-# 2011, 2012 Free Software Foundation, Inc.
+# Copyright (C) 1999-2013 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -28,9 +27,9 @@ scriptversion=2012-03-27.16; # UTC
case $1 in
'')
- echo "$0: No command. Try '$0 --help' for more information." 1>&2
- exit 1;
- ;;
+ echo "$0: No command. Try '$0 --help' for more information." 1>&2
+ exit 1;
+ ;;
-h | --h*)
cat <<\EOF
Usage: depcomp [--help] [--version] PROGRAM [ARGS]
@@ -57,11 +56,65 @@ EOF
;;
esac
+# Get the directory component of the given path, and save it in the
+# global variables '$dir'. Note that this directory component will
+# be either empty or ending with a '/' character. This is deliberate.
+set_dir_from ()
+{
+ case $1 in
+ */*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;;
+ *) dir=;;
+ esac
+}
+
+# Get the suffix-stripped basename of the given path, and save it the
+# global variable '$base'.
+set_base_from ()
+{
+ base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'`
+}
+
+# If no dependency file was actually created by the compiler invocation,
+# we still have to create a dummy depfile, to avoid errors with the
+# Makefile "include basename.Plo" scheme.
+make_dummy_depfile ()
+{
+ echo "#dummy" > "$depfile"
+}
+
+# Factor out some common post-processing of the generated depfile.
+# Requires the auxiliary global variable '$tmpdepfile' to be set.
+aix_post_process_depfile ()
+{
+ # If the compiler actually managed to produce a dependency file,
+ # post-process it.
+ if test -f "$tmpdepfile"; then
+ # Each line is of the form 'foo.o: dependency.h'.
+ # Do two passes, one to just change these to
+ # $object: dependency.h
+ # and one to simply output
+ # dependency.h:
+ # which is needed to avoid the deleted-header problem.
+ { sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile"
+ sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile"
+ } > "$depfile"
+ rm -f "$tmpdepfile"
+ else
+ make_dummy_depfile
+ fi
+}
+
# A tabulation character.
tab=' '
# A newline character.
nl='
'
+# Character ranges might be problematic outside the C locale.
+# These definitions help.
+upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ
+lower=abcdefghijklmnopqrstuvwxyz
+digits=0123456789
+alpha=${upper}${lower}
if test -z "$depmode" || test -z "$source" || test -z "$object"; then
echo "depcomp: Variables source, object and depmode must be set" 1>&2
@@ -75,6 +128,9 @@ tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
rm -f "$tmpdepfile"
+# Avoid interferences from the environment.
+gccflag= dashmflag=
+
# Some modes work just like other modes, but use different flags. We
# parameterize here, but still list the modes in the big case below,
# to make depend.m4 easier to write. Note that we *cannot* use a case
@@ -86,32 +142,32 @@ if test "$depmode" = hp; then
fi
if test "$depmode" = dashXmstdout; then
- # This is just like dashmstdout with a different argument.
- dashmflag=-xM
- depmode=dashmstdout
+ # This is just like dashmstdout with a different argument.
+ dashmflag=-xM
+ depmode=dashmstdout
fi
cygpath_u="cygpath -u -f -"
if test "$depmode" = msvcmsys; then
- # This is just like msvisualcpp but w/o cygpath translation.
- # Just convert the backslash-escaped backslashes to single forward
- # slashes to satisfy depend.m4
- cygpath_u='sed s,\\\\,/,g'
- depmode=msvisualcpp
+ # This is just like msvisualcpp but w/o cygpath translation.
+ # Just convert the backslash-escaped backslashes to single forward
+ # slashes to satisfy depend.m4
+ cygpath_u='sed s,\\\\,/,g'
+ depmode=msvisualcpp
fi
if test "$depmode" = msvc7msys; then
- # This is just like msvc7 but w/o cygpath translation.
- # Just convert the backslash-escaped backslashes to single forward
- # slashes to satisfy depend.m4
- cygpath_u='sed s,\\\\,/,g'
- depmode=msvc7
+ # This is just like msvc7 but w/o cygpath translation.
+ # Just convert the backslash-escaped backslashes to single forward
+ # slashes to satisfy depend.m4
+ cygpath_u='sed s,\\\\,/,g'
+ depmode=msvc7
fi
if test "$depmode" = xlc; then
- # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency informations.
- gccflag=-qmakedep=gcc,-MF
- depmode=gcc
+ # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information.
+ gccflag=-qmakedep=gcc,-MF
+ depmode=gcc
fi
case "$depmode" in
@@ -134,8 +190,7 @@ gcc3)
done
"$@"
stat=$?
- if test $stat -eq 0; then :
- else
+ if test $stat -ne 0; then
rm -f "$tmpdepfile"
exit $stat
fi
@@ -143,13 +198,17 @@ gcc3)
;;
gcc)
+## Note that this doesn't just cater to obsosete pre-3.x GCC compilers.
+## but also to in-use compilers like IMB xlc/xlC and the HP C compiler.
+## (see the conditional assignment to $gccflag above).
## There are various ways to get dependency output from gcc. Here's
## why we pick this rather obscure method:
## - Don't want to use -MD because we'd like the dependencies to end
## up in a subdir. Having to rename by hand is ugly.
## (We might end up doing this anyway to support other compilers.)
## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
-## -MM, not -M (despite what the docs say).
+## -MM, not -M (despite what the docs say). Also, it might not be
+## supported by the other compilers which use the 'gcc' depmode.
## - Using -M directly means running the compiler twice (even worse
## than renaming).
if test -z "$gccflag"; then
@@ -157,15 +216,14 @@ gcc)
fi
"$@" -Wp,"$gccflag$tmpdepfile"
stat=$?
- if test $stat -eq 0; then :
- else
+ if test $stat -ne 0; then
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
echo "$object : \\" > "$depfile"
- alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
-## The second -e expression handles DOS-style file names with drive letters.
+ # The second -e expression handles DOS-style file names with drive
+ # letters.
sed -e 's/^[^:]*: / /' \
-e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
## This next piece of magic avoids the "deleted header file" problem.
@@ -174,15 +232,15 @@ gcc)
## typically no way to rebuild the header). We avoid this by adding
## dummy dependencies for each header file. Too bad gcc doesn't do
## this for us directly.
- tr ' ' "$nl" < "$tmpdepfile" |
## Some versions of gcc put a space before the ':'. On the theory
## that the space means something, we add a space to the output as
## well. hp depmode also adds that space, but also prefixes the VPATH
## to the object. Take care to not repeat it in the output.
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
- sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \
- | sed -e 's/$/ :/' >> "$depfile"
+ tr ' ' "$nl" < "$tmpdepfile" \
+ | sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \
+ | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
@@ -200,8 +258,7 @@ sgi)
"$@" -MDupdate "$tmpdepfile"
fi
stat=$?
- if test $stat -eq 0; then :
- else
+ if test $stat -ne 0; then
rm -f "$tmpdepfile"
exit $stat
fi
@@ -209,7 +266,6 @@ sgi)
if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
echo "$object : \\" > "$depfile"
-
# Clip off the initial element (the dependent). Don't try to be
# clever and replace this with sed code, as IRIX sed won't handle
# lines with more than a fixed number of characters (4096 in
@@ -217,19 +273,15 @@ sgi)
# the IRIX cc adds comments like '#:fec' to the end of the
# dependency line.
tr ' ' "$nl" < "$tmpdepfile" \
- | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
- tr "$nl" ' ' >> "$depfile"
+ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \
+ | tr "$nl" ' ' >> "$depfile"
echo >> "$depfile"
-
# The second pass generates a dummy entry for each header file.
tr ' ' "$nl" < "$tmpdepfile" \
- | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
- >> "$depfile"
+ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
+ >> "$depfile"
else
- # The sourcefile does not contain any dependencies, so just
- # store a dummy comment line, to avoid errors with the Makefile
- # "include basename.Plo" scheme.
- echo "#dummy" > "$depfile"
+ make_dummy_depfile
fi
rm -f "$tmpdepfile"
;;
@@ -247,9 +299,8 @@ aix)
# current directory. Also, the AIX compiler puts '$object:' at the
# start of each line; $object doesn't have directory information.
# Version 6 uses the directory in both cases.
- dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
- test "x$dir" = "x$object" && dir=
- base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
+ set_dir_from "$object"
+ set_base_from "$object"
if test "$libtool" = yes; then
tmpdepfile1=$dir$base.u
tmpdepfile2=$base.u
@@ -262,9 +313,7 @@ aix)
"$@" -M
fi
stat=$?
-
- if test $stat -eq 0; then :
- else
+ if test $stat -ne 0; then
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
exit $stat
fi
@@ -273,65 +322,113 @@ aix)
do
test -f "$tmpdepfile" && break
done
- if test -f "$tmpdepfile"; then
- # Each line is of the form 'foo.o: dependent.h'.
- # Do two passes, one to just change these to
- # '$object: dependent.h' and one to simply 'dependent.h:'.
- sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
- sed -e 's,^.*\.[a-z]*:['"$tab"' ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
- else
- # The sourcefile does not contain any dependencies, so just
- # store a dummy comment line, to avoid errors with the Makefile
- # "include basename.Plo" scheme.
- echo "#dummy" > "$depfile"
+ aix_post_process_depfile
+ ;;
+
+tcc)
+ # tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26
+ # FIXME: That version still under development at the moment of writing.
+ # Make that this statement remains true also for stable, released
+ # versions.
+ # It will wrap lines (doesn't matter whether long or short) with a
+ # trailing '\', as in:
+ #
+ # foo.o : \
+ # foo.c \
+ # foo.h \
+ #
+ # It will put a trailing '\' even on the last line, and will use leading
+ # spaces rather than leading tabs (at least since its commit 0394caf7
+ # "Emit spaces for -MD").
+ "$@" -MD -MF "$tmpdepfile"
+ stat=$?
+ if test $stat -ne 0; then
+ rm -f "$tmpdepfile"
+ exit $stat
fi
+ rm -f "$depfile"
+ # Each non-empty line is of the form 'foo.o : \' or ' dep.h \'.
+ # We have to change lines of the first kind to '$object: \'.
+ sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile"
+ # And for each line of the second kind, we have to emit a 'dep.h:'
+ # dummy dependency, to avoid the deleted-header problem.
+ sed -n -e 's|^ *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile"
rm -f "$tmpdepfile"
;;
-icc)
- # Intel's C compiler anf tcc (Tiny C Compiler) understand '-MD -MF file'.
- # However on
- # $CC -MD -MF foo.d -c -o sub/foo.o sub/foo.c
- # ICC 7.0 will fill foo.d with something like
- # foo.o: sub/foo.c
- # foo.o: sub/foo.h
- # which is wrong. We want
- # sub/foo.o: sub/foo.c
- # sub/foo.o: sub/foo.h
- # sub/foo.c:
- # sub/foo.h:
- # ICC 7.1 will output
+## The order of this option in the case statement is important, since the
+## shell code in configure will try each of these formats in the order
+## listed in this file. A plain '-MD' option would be understood by many
+## compilers, so we must ensure this comes after the gcc and icc options.
+pgcc)
+ # Portland's C compiler understands '-MD'.
+ # Will always output deps to 'file.d' where file is the root name of the
+ # source file under compilation, even if file resides in a subdirectory.
+ # The object file name does not affect the name of the '.d' file.
+ # pgcc 10.2 will output
# foo.o: sub/foo.c sub/foo.h
- # and will wrap long lines using '\':
+ # and will wrap long lines using '\' :
# foo.o: sub/foo.c ... \
# sub/foo.h ... \
# ...
- # tcc 0.9.26 (FIXME still under development at the moment of writing)
- # will emit a similar output, but also prepend the continuation lines
- # with horizontal tabulation characters.
- "$@" -MD -MF "$tmpdepfile"
- stat=$?
- if test $stat -eq 0; then :
- else
+ set_dir_from "$object"
+ # Use the source, not the object, to determine the base name, since
+ # that's sadly what pgcc will do too.
+ set_base_from "$source"
+ tmpdepfile=$base.d
+
+ # For projects that build the same source file twice into different object
+ # files, the pgcc approach of using the *source* file root name can cause
+ # problems in parallel builds. Use a locking strategy to avoid stomping on
+ # the same $tmpdepfile.
+ lockdir=$base.d-lock
+ trap "
+ echo '$0: caught signal, cleaning up...' >&2
+ rmdir '$lockdir'
+ exit 1
+ " 1 2 13 15
+ numtries=100
+ i=$numtries
+ while test $i -gt 0; do
+ # mkdir is a portable test-and-set.
+ if mkdir "$lockdir" 2>/dev/null; then
+ # This process acquired the lock.
+ "$@" -MD
+ stat=$?
+ # Release the lock.
+ rmdir "$lockdir"
+ break
+ else
+ # If the lock is being held by a different process, wait
+ # until the winning process is done or we timeout.
+ while test -d "$lockdir" && test $i -gt 0; do
+ sleep 1
+ i=`expr $i - 1`
+ done
+ fi
+ i=`expr $i - 1`
+ done
+ trap - 1 2 13 15
+ if test $i -le 0; then
+ echo "$0: failed to acquire lock after $numtries attempts" >&2
+ echo "$0: check lockdir '$lockdir'" >&2
+ exit 1
+ fi
+
+ if test $stat -ne 0; then
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
- # Each line is of the form 'foo.o: dependent.h',
- # or 'foo.o: dep1.h dep2.h \', or ' dep3.h dep4.h \'.
+ # Each line is of the form `foo.o: dependent.h',
+ # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
# Do two passes, one to just change these to
- # '$object: dependent.h' and one to simply 'dependent.h:'.
- sed -e "s/^[ $tab][ $tab]*/ /" -e "s,^[^:]*:,$object :," \
- < "$tmpdepfile" > "$depfile"
- sed '
- s/[ '"$tab"'][ '"$tab"']*/ /g
- s/^ *//
- s/ *\\*$//
- s/^[^:]*: *//
- /^$/d
- /:$/d
- s/$/ :/
- ' < "$tmpdepfile" >> "$depfile"
+ # `$object: dependent.h' and one to simply `dependent.h:'.
+ sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
+ # Some versions of the HPUX 10.20 sed can't process this invocation
+ # correctly. Breaking it into two sed invocations is a workaround.
+ sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" \
+ | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
@@ -342,9 +439,8 @@ hp2)
# 'foo.d', which lands next to the object file, wherever that
# happens to be.
# Much of this is similar to the tru64 case; see comments there.
- dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
- test "x$dir" = "x$object" && dir=
- base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
+ set_dir_from "$object"
+ set_base_from "$object"
if test "$libtool" = yes; then
tmpdepfile1=$dir$base.d
tmpdepfile2=$dir.libs/$base.d
@@ -355,8 +451,7 @@ hp2)
"$@" +Maked
fi
stat=$?
- if test $stat -eq 0; then :
- else
+ if test $stat -ne 0; then
rm -f "$tmpdepfile1" "$tmpdepfile2"
exit $stat
fi
@@ -366,76 +461,61 @@ hp2)
test -f "$tmpdepfile" && break
done
if test -f "$tmpdepfile"; then
- sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile"
+ sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile"
# Add 'dependent.h:' lines.
sed -ne '2,${
- s/^ *//
- s/ \\*$//
- s/$/:/
- p
- }' "$tmpdepfile" >> "$depfile"
+ s/^ *//
+ s/ \\*$//
+ s/$/:/
+ p
+ }' "$tmpdepfile" >> "$depfile"
else
- echo "#dummy" > "$depfile"
+ make_dummy_depfile
fi
rm -f "$tmpdepfile" "$tmpdepfile2"
;;
tru64)
- # The Tru64 compiler uses -MD to generate dependencies as a side
- # effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'.
- # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
- # dependencies in 'foo.d' instead, so we check for that too.
- # Subdirectories are respected.
- dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
- test "x$dir" = "x$object" && dir=
- base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
-
- if test "$libtool" = yes; then
- # With Tru64 cc, shared objects can also be used to make a
- # static library. This mechanism is used in libtool 1.4 series to
- # handle both shared and static libraries in a single compilation.
- # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
- #
- # With libtool 1.5 this exception was removed, and libtool now
- # generates 2 separate objects for the 2 libraries. These two
- # compilations output dependencies in $dir.libs/$base.o.d and
- # in $dir$base.o.d. We have to check for both files, because
- # one of the two compilations can be disabled. We should prefer
- # $dir$base.o.d over $dir.libs/$base.o.d because the latter is
- # automatically cleaned when .libs/ is deleted, while ignoring
- # the former would cause a distcleancheck panic.
- tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4
- tmpdepfile2=$dir$base.o.d # libtool 1.5
- tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5
- tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504
- "$@" -Wc,-MD
- else
- tmpdepfile1=$dir$base.o.d
- tmpdepfile2=$dir$base.d
- tmpdepfile3=$dir$base.d
- tmpdepfile4=$dir$base.d
- "$@" -MD
- fi
-
- stat=$?
- if test $stat -eq 0; then :
- else
- rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
- exit $stat
- fi
-
- for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
- do
- test -f "$tmpdepfile" && break
- done
- if test -f "$tmpdepfile"; then
- sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
- sed -e 's,^.*\.[a-z]*:['"$tab"' ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
- else
- echo "#dummy" > "$depfile"
- fi
- rm -f "$tmpdepfile"
- ;;
+ # The Tru64 compiler uses -MD to generate dependencies as a side
+ # effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'.
+ # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
+ # dependencies in 'foo.d' instead, so we check for that too.
+ # Subdirectories are respected.
+ set_dir_from "$object"
+ set_base_from "$object"
+
+ if test "$libtool" = yes; then
+ # Libtool generates 2 separate objects for the 2 libraries. These
+ # two compilations output dependencies in $dir.libs/$base.o.d and
+ # in $dir$base.o.d. We have to check for both files, because
+ # one of the two compilations can be disabled. We should prefer
+ # $dir$base.o.d over $dir.libs/$base.o.d because the latter is
+ # automatically cleaned when .libs/ is deleted, while ignoring
+ # the former would cause a distcleancheck panic.
+ tmpdepfile1=$dir$base.o.d # libtool 1.5
+ tmpdepfile2=$dir.libs/$base.o.d # Likewise.
+ tmpdepfile3=$dir.libs/$base.d # Compaq CCC V6.2-504
+ "$@" -Wc,-MD
+ else
+ tmpdepfile1=$dir$base.d
+ tmpdepfile2=$dir$base.d
+ tmpdepfile3=$dir$base.d
+ "$@" -MD
+ fi
+
+ stat=$?
+ if test $stat -ne 0; then
+ rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
+ exit $stat
+ fi
+
+ for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
+ do
+ test -f "$tmpdepfile" && break
+ done
+ # Same post-processing that is required for AIX mode.
+ aix_post_process_depfile
+ ;;
msvc7)
if test "$libtool" = yes; then
@@ -446,8 +526,7 @@ msvc7)
"$@" $showIncludes > "$tmpdepfile"
stat=$?
grep -v '^Note: including file: ' "$tmpdepfile"
- if test "$stat" = 0; then :
- else
+ if test $stat -ne 0; then
rm -f "$tmpdepfile"
exit $stat
fi
@@ -524,13 +603,14 @@ dashmstdout)
# in the target name. This is to cope with DOS-style filenames:
# a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise.
"$@" $dashmflag |
- sed 's:^['"$tab"' ]*[^:'"$tab"' ][^:][^:]*\:['"$tab"' ]*:'"$object"'\: :' > "$tmpdepfile"
+ sed "s|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile"
rm -f "$depfile"
cat < "$tmpdepfile" > "$depfile"
- tr ' ' "$nl" < "$tmpdepfile" | \
-## Some versions of the HPUX 10.20 sed can't process this invocation
-## correctly. Breaking it into two sed invocations is a workaround.
- sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+ # Some versions of the HPUX 10.20 sed can't process this sed invocation
+ # correctly. Breaking it into two sed invocations is a workaround.
+ tr ' ' "$nl" < "$tmpdepfile" \
+ | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \
+ | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
@@ -583,10 +663,12 @@ makedepend)
# makedepend may prepend the VPATH from the source file name to the object.
# No need to regex-escape $object, excess matching of '.' is harmless.
sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile"
- sed '1,2d' "$tmpdepfile" | tr ' ' "$nl" | \
-## Some versions of the HPUX 10.20 sed can't process this invocation
-## correctly. Breaking it into two sed invocations is a workaround.
- sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+ # Some versions of the HPUX 10.20 sed can't process the last invocation
+ # correctly. Breaking it into two sed invocations is a workaround.
+ sed '1,2d' "$tmpdepfile" \
+ | tr ' ' "$nl" \
+ | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \
+ | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile" "$tmpdepfile".bak
;;
@@ -622,10 +704,10 @@ cpp)
esac
done
- "$@" -E |
- sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
- -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
- sed '$ s: \\$::' > "$tmpdepfile"
+ "$@" -E \
+ | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
+ -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
+ | sed '$ s: \\$::' > "$tmpdepfile"
rm -f "$depfile"
echo "$object : \\" > "$depfile"
cat < "$tmpdepfile" >> "$depfile"
@@ -657,15 +739,15 @@ msvisualcpp)
shift
;;
"-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
- set fnord "$@"
- shift
- shift
- ;;
+ set fnord "$@"
+ shift
+ shift
+ ;;
*)
- set fnord "$@" "$arg"
- shift
- shift
- ;;
+ set fnord "$@" "$arg"
+ shift
+ shift
+ ;;
esac
done
"$@" -E 2>/dev/null |
diff --git a/docs/Makefile.in b/docs/Makefile.in
index 4eb5f28..cb29dfb 100644
--- a/docs/Makefile.in
+++ b/docs/Makefile.in
@@ -1,9 +1,8 @@
-# Makefile.in generated by automake 1.11.6 from Makefile.am.
+# Makefile.in generated by automake 1.13.3 from Makefile.am.
# @configure_input@
-# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-# Foundation, Inc.
+# Copyright (C) 1994-2013 Free Software Foundation, Inc.
+
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -15,23 +14,51 @@
@SET_MAKE@
VPATH = @srcdir@
-am__make_dryrun = \
- { \
- am__dry=no; \
+am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
+am__make_running_with_option = \
+ case $${target_option-} in \
+ ?) ;; \
+ *) echo "am__make_running_with_option: internal error: invalid" \
+ "target option '$${target_option-}' specified" >&2; \
+ exit 1;; \
+ esac; \
+ has_opt=no; \
+ sane_makeflags=$$MAKEFLAGS; \
+ if $(am__is_gnu_make); then \
+ sane_makeflags=$$MFLAGS; \
+ else \
case $$MAKEFLAGS in \
*\\[\ \ ]*) \
- echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
- | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
- *) \
- for am__flg in $$MAKEFLAGS; do \
- case $$am__flg in \
- *=*|--*) ;; \
- *n*) am__dry=yes; break;; \
- esac; \
- done;; \
+ bs=\\; \
+ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
+ esac; \
+ fi; \
+ skip_next=no; \
+ strip_trailopt () \
+ { \
+ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+ }; \
+ for flg in $$sane_makeflags; do \
+ test $$skip_next = yes && { skip_next=no; continue; }; \
+ case $$flg in \
+ *=*|--*) continue;; \
+ -*I) strip_trailopt 'I'; skip_next=yes;; \
+ -*I?*) strip_trailopt 'I';; \
+ -*O) strip_trailopt 'O'; skip_next=yes;; \
+ -*O?*) strip_trailopt 'O';; \
+ -*l) strip_trailopt 'l'; skip_next=yes;; \
+ -*l?*) strip_trailopt 'l';; \
+ -[dEDm]) skip_next=yes;; \
+ -[JT]) skip_next=yes;; \
+ esac; \
+ case $$flg in \
+ *$$target_option*) has_opt=yes; break;; \
esac; \
- test $$am__dry = yes; \
- }
+ done; \
+ test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
@@ -52,7 +79,7 @@ build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
subdir = docs
-DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
$(srcdir)/version.entities.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/common/m4/as-ac-expand.m4 \
@@ -83,21 +110,28 @@ mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES = version.entities
CONFIG_CLEAN_VPATH_FILES =
+AM_V_P = $(am__v_P_@AM_V@)
+am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
+am__v_P_0 = false
+am__v_P_1 = :
AM_V_GEN = $(am__v_GEN_@AM_V@)
am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
-am__v_GEN_0 = @echo " GEN " $@;
+am__v_GEN_0 = @echo " GEN " $@;
+am__v_GEN_1 =
AM_V_at = $(am__v_at_@AM_V@)
am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
am__v_at_0 = @
+am__v_at_1 =
SOURCES =
DIST_SOURCES =
-RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
- html-recursive info-recursive install-data-recursive \
- install-dvi-recursive install-exec-recursive \
- install-html-recursive install-info-recursive \
- install-pdf-recursive install-ps-recursive install-recursive \
- installcheck-recursive installdirs-recursive pdf-recursive \
- ps-recursive uninstall-recursive
+RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \
+ ctags-recursive dvi-recursive html-recursive info-recursive \
+ install-data-recursive install-dvi-recursive \
+ install-exec-recursive install-html-recursive \
+ install-info-recursive install-pdf-recursive \
+ install-ps-recursive install-recursive installcheck-recursive \
+ installdirs-recursive pdf-recursive ps-recursive \
+ tags-recursive uninstall-recursive
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
@@ -105,9 +139,29 @@ am__can_run_installinfo = \
esac
RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
distclean-recursive maintainer-clean-recursive
-AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
- $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
+am__recursive_targets = \
+ $(RECURSIVE_TARGETS) \
+ $(RECURSIVE_CLEAN_TARGETS) \
+ $(am__extra_recursive_targets)
+AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \
distdir
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
+# Read a list of newline-separated strings from the standard input,
+# and print each of them once, without duplicates. Input order is
+# *not* preserved.
+am__uniquify_input = $(AWK) '\
+ BEGIN { nonempty = 0; } \
+ { items[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in items) print i; }; } \
+'
+# Make sure the list of sources is unique. This is necessary because,
+# e.g., the same source file might be shared among _SOURCES variables
+# for different programs/libraries.
+am__define_uniq_tagged_files = \
+ list='$(am__tagged_files)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | $(am__uniquify_input)`
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
@@ -149,10 +203,12 @@ AWK = @AWK@
CAT_ENTRY_END = @CAT_ENTRY_END@
CAT_ENTRY_START = @CAT_ENTRY_START@
CC = @CC@
+CCASFLAGS = @CCASFLAGS@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
+CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DARWIN_LDFLAGS = @DARWIN_LDFLAGS@
DEFS = @DEFS@
@@ -168,7 +224,11 @@ ECHO_T = @ECHO_T@
EGREP = @EGREP@
ERROR_CFLAGS = @ERROR_CFLAGS@
EXEEXT = @EXEEXT@
+FFLAGS = @FFLAGS@
FGREP = @FGREP@
+GCOV = @GCOV@
+GCOV_CFLAGS = @GCOV_CFLAGS@
+GCOV_LIBS = @GCOV_LIBS@
GREP = @GREP@
GSTPB_PLUGINS_DIR = @GSTPB_PLUGINS_DIR@
GST_AGE = @GST_AGE@
@@ -201,16 +261,15 @@ GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@
GTKDOC_MKPDF = @GTKDOC_MKPDF@
GTKDOC_REBASE = @GTKDOC_REBASE@
HAVE_BZ2 = @HAVE_BZ2@
-HAVE_DOCBOOK2HTML = @HAVE_DOCBOOK2HTML@
HAVE_DOCBOOK2PS = @HAVE_DOCBOOK2PS@
HAVE_DVIPS = @HAVE_DVIPS@
HAVE_EPSTOPDF = @HAVE_EPSTOPDF@
-HAVE_FIG2DEV = @HAVE_FIG2DEV@
HAVE_JADETEX = @HAVE_JADETEX@
HAVE_PNGTOPNM = @HAVE_PNGTOPNM@
HAVE_PNMTOPS = @HAVE_PNMTOPS@
HAVE_PS2PDF = @HAVE_PS2PDF@
HAVE_XMLLINT = @HAVE_XMLLINT@
+HAVE_XSLTPROC = @HAVE_XSLTPROC@
HTML_DIR = @HTML_DIR@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
@@ -397,22 +456,25 @@ clean-libtool:
-rm -rf .libs _libs
# This directory's subdirectories are mostly independent; you can cd
-# into them and run `make' without going through this Makefile.
-# To change the values of `make' variables: instead of editing Makefiles,
-# (1) if the variable is set in `config.status', edit `config.status'
-# (which will cause the Makefiles to be regenerated when you run `make');
-# (2) otherwise, pass the desired values on the `make' command line.
-$(RECURSIVE_TARGETS):
- @fail= failcom='exit 1'; \
- for f in x $$MAKEFLAGS; do \
- case $$f in \
- *=* | --[!k]*);; \
- *k*) failcom='fail=yes';; \
- esac; \
- done; \
+# into them and run 'make' without going through this Makefile.
+# To change the values of 'make' variables: instead of editing Makefiles,
+# (1) if the variable is set in 'config.status', edit 'config.status'
+# (which will cause the Makefiles to be regenerated when you run 'make');
+# (2) otherwise, pass the desired values on the 'make' command line.
+$(am__recursive_targets):
+ @fail=; \
+ if $(am__make_keepgoing); then \
+ failcom='fail=yes'; \
+ else \
+ failcom='exit 1'; \
+ fi; \
dot_seen=no; \
target=`echo $@ | sed s/-recursive//`; \
- list='$(SUBDIRS)'; for subdir in $$list; do \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ for subdir in $$list; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
dot_seen=yes; \
@@ -427,57 +489,12 @@ $(RECURSIVE_TARGETS):
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
fi; test -z "$$fail"
-$(RECURSIVE_CLEAN_TARGETS):
- @fail= failcom='exit 1'; \
- for f in x $$MAKEFLAGS; do \
- case $$f in \
- *=* | --[!k]*);; \
- *k*) failcom='fail=yes';; \
- esac; \
- done; \
- dot_seen=no; \
- case "$@" in \
- distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
- *) list='$(SUBDIRS)' ;; \
- esac; \
- rev=''; for subdir in $$list; do \
- if test "$$subdir" = "."; then :; else \
- rev="$$subdir $$rev"; \
- fi; \
- done; \
- rev="$$rev ."; \
- target=`echo $@ | sed s/-recursive//`; \
- for subdir in $$rev; do \
- echo "Making $$target in $$subdir"; \
- if test "$$subdir" = "."; then \
- local_target="$$target-am"; \
- else \
- local_target="$$target"; \
- fi; \
- ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
- || eval $$failcom; \
- done && test -z "$$fail"
-tags-recursive:
- list='$(SUBDIRS)'; for subdir in $$list; do \
- test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
- done
-ctags-recursive:
- list='$(SUBDIRS)'; for subdir in $$list; do \
- test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
- done
+ID: $(am__tagged_files)
+ $(am__define_uniq_tagged_files); mkid -fID $$unique
+tags: tags-recursive
+TAGS: tags
-ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
- list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
- unique=`for i in $$list; do \
- if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
- done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
- mkid -fID $$unique
-tags: TAGS
-
-TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
- $(TAGS_FILES) $(LISP)
+tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
set x; \
here=`pwd`; \
if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
@@ -493,12 +510,7 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
fi; \
done; \
- list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
- unique=`for i in $$list; do \
- if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
- done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
+ $(am__define_uniq_tagged_files); \
shift; \
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
@@ -510,15 +522,11 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$$unique; \
fi; \
fi
-ctags: CTAGS
-CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
- $(TAGS_FILES) $(LISP)
- list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
- unique=`for i in $$list; do \
- if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
- done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
+ctags: ctags-recursive
+
+CTAGS: ctags
+ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+ $(am__define_uniq_tagged_files); \
test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$unique
@@ -527,6 +535,21 @@ GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& $(am__cd) $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here"
+cscopelist: cscopelist-recursive
+
+cscopelist-am: $(am__tagged_files)
+ list='$(am__tagged_files)'; \
+ case "$(srcdir)" in \
+ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+ *) sdir=$(subdir)/$(srcdir) ;; \
+ esac; \
+ for i in $$list; do \
+ if test -f "$$i"; then \
+ echo "$(subdir)/$$i"; \
+ else \
+ echo "$$sdir/$$i"; \
+ fi; \
+ done >> $(top_builddir)/cscope.files
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
@@ -687,22 +710,20 @@ ps-am:
uninstall-am:
-.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \
- install-am install-strip tags-recursive
-
-.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
- all all-am check check-am clean clean-generic clean-libtool \
- ctags ctags-recursive distclean distclean-generic \
- distclean-libtool distclean-tags distdir dvi dvi-am html \
- html-am info info-am install install-am install-data \
- install-data-am install-dvi install-dvi-am install-exec \
- install-exec-am install-html install-html-am install-info \
- install-info-am install-man install-pdf install-pdf-am \
- install-ps install-ps-am install-strip installcheck \
- installcheck-am installdirs installdirs-am maintainer-clean \
- maintainer-clean-generic mostlyclean mostlyclean-generic \
- mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \
- uninstall uninstall-am
+.MAKE: $(am__recursive_targets) install-am install-strip
+
+.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \
+ check-am clean clean-generic clean-libtool cscopelist-am ctags \
+ ctags-am distclean distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ installdirs-am maintainer-clean maintainer-clean-generic \
+ mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \
+ ps ps-am tags tags-am uninstall uninstall-am
upload:
diff --git a/ext/Makefile.am b/ext/Makefile.am
index bbdb9f0..16718f6 100644
--- a/ext/Makefile.am
+++ b/ext/Makefile.am
@@ -1 +1,4 @@
-SUBDIRS = libav libswscale
+# disable/skip avvideoscale until someone makes it work
+SUBDIRS = libav
+
+DIST_SUBDIRS = libav libswscale
diff --git a/ext/Makefile.in b/ext/Makefile.in
index 5e0aa9d..74c6872 100644
--- a/ext/Makefile.in
+++ b/ext/Makefile.in
@@ -1,9 +1,8 @@
-# Makefile.in generated by automake 1.11.6 from Makefile.am.
+# Makefile.in generated by automake 1.13.3 from Makefile.am.
# @configure_input@
-# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-# Foundation, Inc.
+# Copyright (C) 1994-2013 Free Software Foundation, Inc.
+
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -15,23 +14,51 @@
@SET_MAKE@
VPATH = @srcdir@
-am__make_dryrun = \
- { \
- am__dry=no; \
+am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
+am__make_running_with_option = \
+ case $${target_option-} in \
+ ?) ;; \
+ *) echo "am__make_running_with_option: internal error: invalid" \
+ "target option '$${target_option-}' specified" >&2; \
+ exit 1;; \
+ esac; \
+ has_opt=no; \
+ sane_makeflags=$$MAKEFLAGS; \
+ if $(am__is_gnu_make); then \
+ sane_makeflags=$$MFLAGS; \
+ else \
case $$MAKEFLAGS in \
*\\[\ \ ]*) \
- echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
- | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
- *) \
- for am__flg in $$MAKEFLAGS; do \
- case $$am__flg in \
- *=*|--*) ;; \
- *n*) am__dry=yes; break;; \
- esac; \
- done;; \
+ bs=\\; \
+ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
+ esac; \
+ fi; \
+ skip_next=no; \
+ strip_trailopt () \
+ { \
+ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+ }; \
+ for flg in $$sane_makeflags; do \
+ test $$skip_next = yes && { skip_next=no; continue; }; \
+ case $$flg in \
+ *=*|--*) continue;; \
+ -*I) strip_trailopt 'I'; skip_next=yes;; \
+ -*I?*) strip_trailopt 'I';; \
+ -*O) strip_trailopt 'O'; skip_next=yes;; \
+ -*O?*) strip_trailopt 'O';; \
+ -*l) strip_trailopt 'l'; skip_next=yes;; \
+ -*l?*) strip_trailopt 'l';; \
+ -[dEDm]) skip_next=yes;; \
+ -[JT]) skip_next=yes;; \
+ esac; \
+ case $$flg in \
+ *$$target_option*) has_opt=yes; break;; \
esac; \
- test $$am__dry = yes; \
- }
+ done; \
+ test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
@@ -52,7 +79,7 @@ build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
subdir = ext
-DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/common/m4/as-ac-expand.m4 \
$(top_srcdir)/common/m4/as-auto-alt.m4 \
@@ -82,21 +109,28 @@ mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
+AM_V_P = $(am__v_P_@AM_V@)
+am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
+am__v_P_0 = false
+am__v_P_1 = :
AM_V_GEN = $(am__v_GEN_@AM_V@)
am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
-am__v_GEN_0 = @echo " GEN " $@;
+am__v_GEN_0 = @echo " GEN " $@;
+am__v_GEN_1 =
AM_V_at = $(am__v_at_@AM_V@)
am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
am__v_at_0 = @
+am__v_at_1 =
SOURCES =
DIST_SOURCES =
-RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
- html-recursive info-recursive install-data-recursive \
- install-dvi-recursive install-exec-recursive \
- install-html-recursive install-info-recursive \
- install-pdf-recursive install-ps-recursive install-recursive \
- installcheck-recursive installdirs-recursive pdf-recursive \
- ps-recursive uninstall-recursive
+RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \
+ ctags-recursive dvi-recursive html-recursive info-recursive \
+ install-data-recursive install-dvi-recursive \
+ install-exec-recursive install-html-recursive \
+ install-info-recursive install-pdf-recursive \
+ install-ps-recursive install-recursive installcheck-recursive \
+ installdirs-recursive pdf-recursive ps-recursive \
+ tags-recursive uninstall-recursive
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
@@ -104,12 +138,31 @@ am__can_run_installinfo = \
esac
RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
distclean-recursive maintainer-clean-recursive
-AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
- $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
+am__recursive_targets = \
+ $(RECURSIVE_TARGETS) \
+ $(RECURSIVE_CLEAN_TARGETS) \
+ $(am__extra_recursive_targets)
+AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \
distdir
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
+# Read a list of newline-separated strings from the standard input,
+# and print each of them once, without duplicates. Input order is
+# *not* preserved.
+am__uniquify_input = $(AWK) '\
+ BEGIN { nonempty = 0; } \
+ { items[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in items) print i; }; } \
+'
+# Make sure the list of sources is unique. This is necessary because,
+# e.g., the same source file might be shared among _SOURCES variables
+# for different programs/libraries.
+am__define_uniq_tagged_files = \
+ list='$(am__tagged_files)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | $(am__uniquify_input)`
ETAGS = etags
CTAGS = ctags
-DIST_SUBDIRS = $(SUBDIRS)
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
am__relativize = \
dir0=`pwd`; \
@@ -149,10 +202,12 @@ AWK = @AWK@
CAT_ENTRY_END = @CAT_ENTRY_END@
CAT_ENTRY_START = @CAT_ENTRY_START@
CC = @CC@
+CCASFLAGS = @CCASFLAGS@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
+CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DARWIN_LDFLAGS = @DARWIN_LDFLAGS@
DEFS = @DEFS@
@@ -168,7 +223,11 @@ ECHO_T = @ECHO_T@
EGREP = @EGREP@
ERROR_CFLAGS = @ERROR_CFLAGS@
EXEEXT = @EXEEXT@
+FFLAGS = @FFLAGS@
FGREP = @FGREP@
+GCOV = @GCOV@
+GCOV_CFLAGS = @GCOV_CFLAGS@
+GCOV_LIBS = @GCOV_LIBS@
GREP = @GREP@
GSTPB_PLUGINS_DIR = @GSTPB_PLUGINS_DIR@
GST_AGE = @GST_AGE@
@@ -201,16 +260,15 @@ GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@
GTKDOC_MKPDF = @GTKDOC_MKPDF@
GTKDOC_REBASE = @GTKDOC_REBASE@
HAVE_BZ2 = @HAVE_BZ2@
-HAVE_DOCBOOK2HTML = @HAVE_DOCBOOK2HTML@
HAVE_DOCBOOK2PS = @HAVE_DOCBOOK2PS@
HAVE_DVIPS = @HAVE_DVIPS@
HAVE_EPSTOPDF = @HAVE_EPSTOPDF@
-HAVE_FIG2DEV = @HAVE_FIG2DEV@
HAVE_JADETEX = @HAVE_JADETEX@
HAVE_PNGTOPNM = @HAVE_PNGTOPNM@
HAVE_PNMTOPS = @HAVE_PNMTOPS@
HAVE_PS2PDF = @HAVE_PS2PDF@
HAVE_XMLLINT = @HAVE_XMLLINT@
+HAVE_XSLTPROC = @HAVE_XSLTPROC@
HTML_DIR = @HTML_DIR@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
@@ -347,7 +405,10 @@ target_vendor = @target_vendor@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
-SUBDIRS = libav libswscale
+
+# disable/skip avvideoscale until someone makes it work
+SUBDIRS = libav
+DIST_SUBDIRS = libav libswscale
all: all-recursive
.SUFFIXES:
@@ -389,22 +450,25 @@ clean-libtool:
-rm -rf .libs _libs
# This directory's subdirectories are mostly independent; you can cd
-# into them and run `make' without going through this Makefile.
-# To change the values of `make' variables: instead of editing Makefiles,
-# (1) if the variable is set in `config.status', edit `config.status'
-# (which will cause the Makefiles to be regenerated when you run `make');
-# (2) otherwise, pass the desired values on the `make' command line.
-$(RECURSIVE_TARGETS):
- @fail= failcom='exit 1'; \
- for f in x $$MAKEFLAGS; do \
- case $$f in \
- *=* | --[!k]*);; \
- *k*) failcom='fail=yes';; \
- esac; \
- done; \
+# into them and run 'make' without going through this Makefile.
+# To change the values of 'make' variables: instead of editing Makefiles,
+# (1) if the variable is set in 'config.status', edit 'config.status'
+# (which will cause the Makefiles to be regenerated when you run 'make');
+# (2) otherwise, pass the desired values on the 'make' command line.
+$(am__recursive_targets):
+ @fail=; \
+ if $(am__make_keepgoing); then \
+ failcom='fail=yes'; \
+ else \
+ failcom='exit 1'; \
+ fi; \
dot_seen=no; \
target=`echo $@ | sed s/-recursive//`; \
- list='$(SUBDIRS)'; for subdir in $$list; do \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ for subdir in $$list; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
dot_seen=yes; \
@@ -419,57 +483,12 @@ $(RECURSIVE_TARGETS):
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
fi; test -z "$$fail"
-$(RECURSIVE_CLEAN_TARGETS):
- @fail= failcom='exit 1'; \
- for f in x $$MAKEFLAGS; do \
- case $$f in \
- *=* | --[!k]*);; \
- *k*) failcom='fail=yes';; \
- esac; \
- done; \
- dot_seen=no; \
- case "$@" in \
- distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
- *) list='$(SUBDIRS)' ;; \
- esac; \
- rev=''; for subdir in $$list; do \
- if test "$$subdir" = "."; then :; else \
- rev="$$subdir $$rev"; \
- fi; \
- done; \
- rev="$$rev ."; \
- target=`echo $@ | sed s/-recursive//`; \
- for subdir in $$rev; do \
- echo "Making $$target in $$subdir"; \
- if test "$$subdir" = "."; then \
- local_target="$$target-am"; \
- else \
- local_target="$$target"; \
- fi; \
- ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
- || eval $$failcom; \
- done && test -z "$$fail"
-tags-recursive:
- list='$(SUBDIRS)'; for subdir in $$list; do \
- test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
- done
-ctags-recursive:
- list='$(SUBDIRS)'; for subdir in $$list; do \
- test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
- done
+ID: $(am__tagged_files)
+ $(am__define_uniq_tagged_files); mkid -fID $$unique
+tags: tags-recursive
+TAGS: tags
-ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
- list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
- unique=`for i in $$list; do \
- if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
- done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
- mkid -fID $$unique
-tags: TAGS
-
-TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
- $(TAGS_FILES) $(LISP)
+tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
set x; \
here=`pwd`; \
if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
@@ -485,12 +504,7 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
fi; \
done; \
- list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
- unique=`for i in $$list; do \
- if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
- done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
+ $(am__define_uniq_tagged_files); \
shift; \
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
@@ -502,15 +516,11 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$$unique; \
fi; \
fi
-ctags: CTAGS
-CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
- $(TAGS_FILES) $(LISP)
- list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
- unique=`for i in $$list; do \
- if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
- done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
+ctags: ctags-recursive
+
+CTAGS: ctags
+ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+ $(am__define_uniq_tagged_files); \
test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$unique
@@ -519,6 +529,21 @@ GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& $(am__cd) $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here"
+cscopelist: cscopelist-recursive
+
+cscopelist-am: $(am__tagged_files)
+ list='$(am__tagged_files)'; \
+ case "$(srcdir)" in \
+ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+ *) sdir=$(subdir)/$(srcdir) ;; \
+ esac; \
+ for i in $$list; do \
+ if test -f "$$i"; then \
+ echo "$(subdir)/$$i"; \
+ else \
+ echo "$$sdir/$$i"; \
+ fi; \
+ done >> $(top_builddir)/cscope.files
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
@@ -679,22 +704,20 @@ ps-am:
uninstall-am:
-.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \
- install-am install-strip tags-recursive
-
-.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
- all all-am check check-am clean clean-generic clean-libtool \
- ctags ctags-recursive distclean distclean-generic \
- distclean-libtool distclean-tags distdir dvi dvi-am html \
- html-am info info-am install install-am install-data \
- install-data-am install-dvi install-dvi-am install-exec \
- install-exec-am install-html install-html-am install-info \
- install-info-am install-man install-pdf install-pdf-am \
- install-ps install-ps-am install-strip installcheck \
- installcheck-am installdirs installdirs-am maintainer-clean \
- maintainer-clean-generic mostlyclean mostlyclean-generic \
- mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \
- uninstall uninstall-am
+.MAKE: $(am__recursive_targets) install-am install-strip
+
+.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \
+ check-am clean clean-generic clean-libtool cscopelist-am ctags \
+ ctags-am distclean distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ installdirs-am maintainer-clean maintainer-clean-generic \
+ mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \
+ ps ps-am tags tags-am uninstall uninstall-am
# Tell versions [3.59,3.63) of GNU make to not export all variables.
diff --git a/ext/libav/Makefile.am b/ext/libav/Makefile.am
index a1e51f4..24d0eb9 100644
--- a/ext/libav/Makefile.am
+++ b/ext/libav/Makefile.am
@@ -10,9 +10,9 @@ libgstlibav_la_SOURCES = gstav.c \
gstavprotocol.c \
gstavcodecmap.c \
gstavutils.c \
- gstavenc.c \
+ gstavaudenc.c \
gstavvidenc.c \
- gstavdec.c \
+ gstavauddec.c \
gstavviddec.c \
gstavcfg.c \
gstavdemux.c \
@@ -40,7 +40,9 @@ noinst_HEADERS = \
gstav.h \
gstavcodecmap.h \
gstavutils.h \
- gstavenc.h \
+ gstavauddec.h \
+ gstavviddec.h \
+ gstavaudenc.h \
gstavvidenc.h \
gstavcfg.h \
- gstavpipe.h
+ gstavprotocol.h
diff --git a/ext/libav/Makefile.in b/ext/libav/Makefile.in
index b1dda6f..76353f9 100644
--- a/ext/libav/Makefile.in
+++ b/ext/libav/Makefile.in
@@ -1,9 +1,8 @@
-# Makefile.in generated by automake 1.11.6 from Makefile.am.
+# Makefile.in generated by automake 1.13.3 from Makefile.am.
# @configure_input@
-# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-# Foundation, Inc.
+# Copyright (C) 1994-2013 Free Software Foundation, Inc.
+
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -17,23 +16,51 @@
VPATH = @srcdir@
-am__make_dryrun = \
- { \
- am__dry=no; \
+am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
+am__make_running_with_option = \
+ case $${target_option-} in \
+ ?) ;; \
+ *) echo "am__make_running_with_option: internal error: invalid" \
+ "target option '$${target_option-}' specified" >&2; \
+ exit 1;; \
+ esac; \
+ has_opt=no; \
+ sane_makeflags=$$MAKEFLAGS; \
+ if $(am__is_gnu_make); then \
+ sane_makeflags=$$MFLAGS; \
+ else \
case $$MAKEFLAGS in \
*\\[\ \ ]*) \
- echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
- | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
- *) \
- for am__flg in $$MAKEFLAGS; do \
- case $$am__flg in \
- *=*|--*) ;; \
- *n*) am__dry=yes; break;; \
- esac; \
- done;; \
+ bs=\\; \
+ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
esac; \
- test $$am__dry = yes; \
- }
+ fi; \
+ skip_next=no; \
+ strip_trailopt () \
+ { \
+ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+ }; \
+ for flg in $$sane_makeflags; do \
+ test $$skip_next = yes && { skip_next=no; continue; }; \
+ case $$flg in \
+ *=*|--*) continue;; \
+ -*I) strip_trailopt 'I'; skip_next=yes;; \
+ -*I?*) strip_trailopt 'I';; \
+ -*O) strip_trailopt 'O'; skip_next=yes;; \
+ -*O?*) strip_trailopt 'O';; \
+ -*l) strip_trailopt 'l'; skip_next=yes;; \
+ -*l?*) strip_trailopt 'l';; \
+ -[dEDm]) skip_next=yes;; \
+ -[JT]) skip_next=yes;; \
+ esac; \
+ case $$flg in \
+ *$$target_option*) has_opt=yes; break;; \
+ esac; \
+ done; \
+ test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
@@ -61,8 +88,8 @@ target_triplet = @target@
@HAVE_LIBAV_UNINSTALLED_FALSE@ $(am__DEPENDENCIES_1) \
@HAVE_LIBAV_UNINSTALLED_FALSE@ $(am__DEPENDENCIES_1)
subdir = ext/libav
-DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \
- $(srcdir)/Makefile.in
+DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
+ $(top_srcdir)/depcomp $(noinst_HEADERS)
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/common/m4/as-ac-expand.m4 \
$(top_srcdir)/common/m4/as-auto-alt.m4 \
@@ -125,18 +152,31 @@ am__DEPENDENCIES_1 =
am_libgstlibav_la_OBJECTS = libgstlibav_la-gstav.lo \
libgstlibav_la-gstavprotocol.lo \
libgstlibav_la-gstavcodecmap.lo libgstlibav_la-gstavutils.lo \
- libgstlibav_la-gstavenc.lo libgstlibav_la-gstavvidenc.lo \
- libgstlibav_la-gstavdec.lo libgstlibav_la-gstavviddec.lo \
+ libgstlibav_la-gstavaudenc.lo libgstlibav_la-gstavvidenc.lo \
+ libgstlibav_la-gstavauddec.lo libgstlibav_la-gstavviddec.lo \
libgstlibav_la-gstavcfg.lo libgstlibav_la-gstavdemux.lo \
libgstlibav_la-gstavmux.lo libgstlibav_la-gstavdeinterlace.lo
libgstlibav_la_OBJECTS = $(am_libgstlibav_la_OBJECTS)
AM_V_lt = $(am__v_lt_@AM_V@)
am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
am__v_lt_0 = --silent
+am__v_lt_1 =
libgstlibav_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
$(libgstlibav_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link \
$(CCLD) $(libgstlibav_la_CFLAGS) $(CFLAGS) \
$(libgstlibav_la_LDFLAGS) $(LDFLAGS) -o $@
+AM_V_P = $(am__v_P_@AM_V@)
+am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
+am__v_P_0 = false
+am__v_P_1 = :
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
+am__v_GEN_0 = @echo " GEN " $@;
+am__v_GEN_1 =
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
+am__v_at_0 = @
+am__v_at_1 =
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
@@ -149,20 +189,16 @@ LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(AM_CFLAGS) $(CFLAGS)
AM_V_CC = $(am__v_CC_@AM_V@)
am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
-am__v_CC_0 = @echo " CC " $@;
-AM_V_at = $(am__v_at_@AM_V@)
-am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
-am__v_at_0 = @
+am__v_CC_0 = @echo " CC " $@;
+am__v_CC_1 =
CCLD = $(CC)
LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
AM_V_CCLD = $(am__v_CCLD_@AM_V@)
am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
-am__v_CCLD_0 = @echo " CCLD " $@;
-AM_V_GEN = $(am__v_GEN_@AM_V@)
-am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
-am__v_GEN_0 = @echo " GEN " $@;
+am__v_CCLD_0 = @echo " CCLD " $@;
+am__v_CCLD_1 =
SOURCES = $(libgstlibav_la_SOURCES)
DIST_SOURCES = $(libgstlibav_la_SOURCES)
am__can_run_installinfo = \
@@ -171,6 +207,23 @@ am__can_run_installinfo = \
*) (install-info --version) >/dev/null 2>&1;; \
esac
HEADERS = $(noinst_HEADERS)
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
+# Read a list of newline-separated strings from the standard input,
+# and print each of them once, without duplicates. Input order is
+# *not* preserved.
+am__uniquify_input = $(AWK) '\
+ BEGIN { nonempty = 0; } \
+ { items[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in items) print i; }; } \
+'
+# Make sure the list of sources is unique. This is necessary because,
+# e.g., the same source file might be shared among _SOURCES variables
+# for different programs/libraries.
+am__define_uniq_tagged_files = \
+ list='$(am__tagged_files)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | $(am__uniquify_input)`
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
@@ -187,10 +240,12 @@ AWK = @AWK@
CAT_ENTRY_END = @CAT_ENTRY_END@
CAT_ENTRY_START = @CAT_ENTRY_START@
CC = @CC@
+CCASFLAGS = @CCASFLAGS@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
+CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DARWIN_LDFLAGS = @DARWIN_LDFLAGS@
DEFS = @DEFS@
@@ -206,7 +261,11 @@ ECHO_T = @ECHO_T@
EGREP = @EGREP@
ERROR_CFLAGS = @ERROR_CFLAGS@
EXEEXT = @EXEEXT@
+FFLAGS = @FFLAGS@
FGREP = @FGREP@
+GCOV = @GCOV@
+GCOV_CFLAGS = @GCOV_CFLAGS@
+GCOV_LIBS = @GCOV_LIBS@
GREP = @GREP@
GSTPB_PLUGINS_DIR = @GSTPB_PLUGINS_DIR@
GST_AGE = @GST_AGE@
@@ -239,16 +298,15 @@ GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@
GTKDOC_MKPDF = @GTKDOC_MKPDF@
GTKDOC_REBASE = @GTKDOC_REBASE@
HAVE_BZ2 = @HAVE_BZ2@
-HAVE_DOCBOOK2HTML = @HAVE_DOCBOOK2HTML@
HAVE_DOCBOOK2PS = @HAVE_DOCBOOK2PS@
HAVE_DVIPS = @HAVE_DVIPS@
HAVE_EPSTOPDF = @HAVE_EPSTOPDF@
-HAVE_FIG2DEV = @HAVE_FIG2DEV@
HAVE_JADETEX = @HAVE_JADETEX@
HAVE_PNGTOPNM = @HAVE_PNGTOPNM@
HAVE_PNMTOPS = @HAVE_PNMTOPS@
HAVE_PS2PDF = @HAVE_PS2PDF@
HAVE_XMLLINT = @HAVE_XMLLINT@
+HAVE_XSLTPROC = @HAVE_XSLTPROC@
HTML_DIR = @HTML_DIR@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
@@ -392,9 +450,9 @@ libgstlibav_la_SOURCES = gstav.c \
gstavprotocol.c \
gstavcodecmap.c \
gstavutils.c \
- gstavenc.c \
+ gstavaudenc.c \
gstavvidenc.c \
- gstavdec.c \
+ gstavauddec.c \
gstavviddec.c \
gstavcfg.c \
gstavdemux.c \
@@ -418,10 +476,12 @@ noinst_HEADERS = \
gstav.h \
gstavcodecmap.h \
gstavutils.h \
- gstavenc.h \
+ gstavauddec.h \
+ gstavviddec.h \
+ gstavaudenc.h \
gstavvidenc.h \
gstavcfg.h \
- gstavpipe.h
+ gstavprotocol.h
all: all-am
@@ -457,6 +517,7 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
+
install-pluginLTLIBRARIES: $(plugin_LTLIBRARIES)
@$(NORMAL_INSTALL)
@list='$(plugin_LTLIBRARIES)'; test -n "$(plugindir)" || list=; \
@@ -483,12 +544,15 @@ uninstall-pluginLTLIBRARIES:
clean-pluginLTLIBRARIES:
-test -z "$(plugin_LTLIBRARIES)" || rm -f $(plugin_LTLIBRARIES)
- @list='$(plugin_LTLIBRARIES)'; for p in $$list; do \
- dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
- test "$$dir" != "$$p" || dir=.; \
- echo "rm -f \"$${dir}/so_locations\""; \
- rm -f "$${dir}/so_locations"; \
- done
+ @list='$(plugin_LTLIBRARIES)'; \
+ locs=`for p in $$list; do echo $$p; done | \
+ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \
+ sort -u`; \
+ test -z "$$locs" || { \
+ echo rm -f $${locs}; \
+ rm -f $${locs}; \
+ }
+
libgstlibav.la: $(libgstlibav_la_OBJECTS) $(libgstlibav_la_DEPENDENCIES) $(EXTRA_libgstlibav_la_DEPENDENCIES)
$(AM_V_CCLD)$(libgstlibav_la_LINK) -rpath $(plugindir) $(libgstlibav_la_OBJECTS) $(libgstlibav_la_LIBADD) $(LIBS)
@@ -499,12 +563,12 @@ distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstlibav_la-gstav.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstlibav_la-gstavauddec.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstlibav_la-gstavaudenc.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstlibav_la-gstavcfg.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstlibav_la-gstavcodecmap.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstlibav_la-gstavdec.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstlibav_la-gstavdeinterlace.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstlibav_la-gstavdemux.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstlibav_la-gstavenc.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstlibav_la-gstavmux.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstlibav_la-gstavprotocol.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstlibav_la-gstavutils.Plo@am__quote@
@@ -560,12 +624,12 @@ libgstlibav_la-gstavutils.lo: gstavutils.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstlibav_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstlibav_la_CFLAGS) $(CFLAGS) -c -o libgstlibav_la-gstavutils.lo `test -f 'gstavutils.c' || echo '$(srcdir)/'`gstavutils.c
-libgstlibav_la-gstavenc.lo: gstavenc.c
-@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstlibav_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstlibav_la_CFLAGS) $(CFLAGS) -MT libgstlibav_la-gstavenc.lo -MD -MP -MF $(DEPDIR)/libgstlibav_la-gstavenc.Tpo -c -o libgstlibav_la-gstavenc.lo `test -f 'gstavenc.c' || echo '$(srcdir)/'`gstavenc.c
-@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libgstlibav_la-gstavenc.Tpo $(DEPDIR)/libgstlibav_la-gstavenc.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gstavenc.c' object='libgstlibav_la-gstavenc.lo' libtool=yes @AMDEPBACKSLASH@
+libgstlibav_la-gstavaudenc.lo: gstavaudenc.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstlibav_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstlibav_la_CFLAGS) $(CFLAGS) -MT libgstlibav_la-gstavaudenc.lo -MD -MP -MF $(DEPDIR)/libgstlibav_la-gstavaudenc.Tpo -c -o libgstlibav_la-gstavaudenc.lo `test -f 'gstavaudenc.c' || echo '$(srcdir)/'`gstavaudenc.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libgstlibav_la-gstavaudenc.Tpo $(DEPDIR)/libgstlibav_la-gstavaudenc.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gstavaudenc.c' object='libgstlibav_la-gstavaudenc.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstlibav_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstlibav_la_CFLAGS) $(CFLAGS) -c -o libgstlibav_la-gstavenc.lo `test -f 'gstavenc.c' || echo '$(srcdir)/'`gstavenc.c
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstlibav_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstlibav_la_CFLAGS) $(CFLAGS) -c -o libgstlibav_la-gstavaudenc.lo `test -f 'gstavaudenc.c' || echo '$(srcdir)/'`gstavaudenc.c
libgstlibav_la-gstavvidenc.lo: gstavvidenc.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstlibav_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstlibav_la_CFLAGS) $(CFLAGS) -MT libgstlibav_la-gstavvidenc.lo -MD -MP -MF $(DEPDIR)/libgstlibav_la-gstavvidenc.Tpo -c -o libgstlibav_la-gstavvidenc.lo `test -f 'gstavvidenc.c' || echo '$(srcdir)/'`gstavvidenc.c
@@ -574,12 +638,12 @@ libgstlibav_la-gstavvidenc.lo: gstavvidenc.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstlibav_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstlibav_la_CFLAGS) $(CFLAGS) -c -o libgstlibav_la-gstavvidenc.lo `test -f 'gstavvidenc.c' || echo '$(srcdir)/'`gstavvidenc.c
-libgstlibav_la-gstavdec.lo: gstavdec.c
-@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstlibav_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstlibav_la_CFLAGS) $(CFLAGS) -MT libgstlibav_la-gstavdec.lo -MD -MP -MF $(DEPDIR)/libgstlibav_la-gstavdec.Tpo -c -o libgstlibav_la-gstavdec.lo `test -f 'gstavdec.c' || echo '$(srcdir)/'`gstavdec.c
-@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libgstlibav_la-gstavdec.Tpo $(DEPDIR)/libgstlibav_la-gstavdec.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gstavdec.c' object='libgstlibav_la-gstavdec.lo' libtool=yes @AMDEPBACKSLASH@
+libgstlibav_la-gstavauddec.lo: gstavauddec.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstlibav_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstlibav_la_CFLAGS) $(CFLAGS) -MT libgstlibav_la-gstavauddec.lo -MD -MP -MF $(DEPDIR)/libgstlibav_la-gstavauddec.Tpo -c -o libgstlibav_la-gstavauddec.lo `test -f 'gstavauddec.c' || echo '$(srcdir)/'`gstavauddec.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libgstlibav_la-gstavauddec.Tpo $(DEPDIR)/libgstlibav_la-gstavauddec.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gstavauddec.c' object='libgstlibav_la-gstavauddec.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstlibav_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstlibav_la_CFLAGS) $(CFLAGS) -c -o libgstlibav_la-gstavdec.lo `test -f 'gstavdec.c' || echo '$(srcdir)/'`gstavdec.c
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstlibav_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstlibav_la_CFLAGS) $(CFLAGS) -c -o libgstlibav_la-gstavauddec.lo `test -f 'gstavauddec.c' || echo '$(srcdir)/'`gstavauddec.c
libgstlibav_la-gstavviddec.lo: gstavviddec.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstlibav_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstlibav_la_CFLAGS) $(CFLAGS) -MT libgstlibav_la-gstavviddec.lo -MD -MP -MF $(DEPDIR)/libgstlibav_la-gstavviddec.Tpo -c -o libgstlibav_la-gstavviddec.lo `test -f 'gstavviddec.c' || echo '$(srcdir)/'`gstavviddec.c
@@ -622,26 +686,15 @@ mostlyclean-libtool:
clean-libtool:
-rm -rf .libs _libs
-ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
- list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
- unique=`for i in $$list; do \
- if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
- done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
- mkid -fID $$unique
-tags: TAGS
-
-TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
- $(TAGS_FILES) $(LISP)
+ID: $(am__tagged_files)
+ $(am__define_uniq_tagged_files); mkid -fID $$unique
+tags: tags-am
+TAGS: tags
+
+tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
set x; \
here=`pwd`; \
- list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
- unique=`for i in $$list; do \
- if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
- done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
+ $(am__define_uniq_tagged_files); \
shift; \
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
@@ -653,15 +706,11 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$$unique; \
fi; \
fi
-ctags: CTAGS
-CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
- $(TAGS_FILES) $(LISP)
- list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
- unique=`for i in $$list; do \
- if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
- done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
+ctags: ctags-am
+
+CTAGS: ctags
+ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+ $(am__define_uniq_tagged_files); \
test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$unique
@@ -670,6 +719,21 @@ GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& $(am__cd) $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here"
+cscopelist: cscopelist-am
+
+cscopelist-am: $(am__tagged_files)
+ list='$(am__tagged_files)'; \
+ case "$(srcdir)" in \
+ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+ *) sdir=$(subdir)/$(srcdir) ;; \
+ esac; \
+ for i in $$list; do \
+ if test -f "$$i"; then \
+ echo "$(subdir)/$$i"; \
+ else \
+ echo "$$sdir/$$i"; \
+ fi; \
+ done >> $(top_builddir)/cscope.files
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
@@ -814,19 +878,20 @@ uninstall-am: uninstall-pluginLTLIBRARIES
.MAKE: install-am install-strip
-.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
- clean-libtool clean-pluginLTLIBRARIES ctags distclean \
- distclean-compile distclean-generic distclean-libtool \
- distclean-tags distdir dvi dvi-am html html-am info info-am \
- install install-am install-data install-data-am install-dvi \
- install-dvi-am install-exec install-exec-am install-html \
- install-html-am install-info install-info-am install-man \
- install-pdf install-pdf-am install-pluginLTLIBRARIES \
- install-ps install-ps-am install-strip installcheck \
- installcheck-am installdirs maintainer-clean \
- maintainer-clean-generic mostlyclean mostlyclean-compile \
- mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
- tags uninstall uninstall-am uninstall-pluginLTLIBRARIES
+.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \
+ clean-libtool clean-pluginLTLIBRARIES cscopelist-am ctags \
+ ctags-am distclean distclean-compile distclean-generic \
+ distclean-libtool distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-data \
+ install-data-am install-dvi install-dvi-am install-exec \
+ install-exec-am install-html install-html-am install-info \
+ install-info-am install-man install-pdf install-pdf-am \
+ install-pluginLTLIBRARIES install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+ pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am \
+ uninstall-pluginLTLIBRARIES
# Tell versions [3.59,3.63) of GNU make to not export all variables.
diff --git a/ext/libav/gstav.c b/ext/libav/gstav.c
index 8c88a13..7884a51 100644
--- a/ext/libav/gstav.c
+++ b/ext/libav/gstav.c
@@ -13,8 +13,8 @@
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
*/
/* First, include the header file for the plugin, to bring in the
@@ -45,7 +45,7 @@ gst_ffmpeg_avcodec_open (AVCodecContext * avctx, AVCodec * codec)
int ret;
g_static_mutex_lock (&gst_avcodec_mutex);
- ret = avcodec_open (avctx, codec);
+ ret = avcodec_open2 (avctx, codec, NULL);
g_static_mutex_unlock (&gst_avcodec_mutex);
return ret;
@@ -69,7 +69,7 @@ gst_ffmpeg_av_find_stream_info (AVFormatContext * ic)
int ret;
g_static_mutex_lock (&gst_avcodec_mutex);
- ret = av_find_stream_info (ic);
+ ret = avformat_find_stream_info (ic, NULL);
g_static_mutex_unlock (&gst_avcodec_mutex);
return ret;
@@ -83,9 +83,6 @@ gst_ffmpeg_log_callback (void *ptr, int level, const char *fmt, va_list vl)
gint len = strlen (fmt);
gchar *fmt2 = NULL;
- if (_shut_up_I_am_probing)
- return;
-
switch (level) {
case AV_LOG_QUIET:
gst_level = GST_LEVEL_NONE;
@@ -117,10 +114,6 @@ gst_ffmpeg_log_callback (void *ptr, int level, const char *fmt, va_list vl)
}
#endif
-#ifndef GST_DISABLE_GST_DEBUG
-gboolean _shut_up_I_am_probing = FALSE;
-#endif
-
static gboolean
plugin_init (GstPlugin * plugin)
{
@@ -145,13 +138,9 @@ plugin_init (GstPlugin * plugin)
gst_ffmpegscale_register (plugin);
#endif
#if 0
- gst_ffmpegcsp_register (plugin);
gst_ffmpegaudioresample_register (plugin);
#endif
- av_register_protocol2 (&gstreamer_protocol, sizeof (URLProtocol));
- av_register_protocol2 (&gstpipe_protocol, sizeof (URLProtocol));
-
/* Now we can return the pointer to the newly created Plugin object. */
return TRUE;
}
diff --git a/ext/libav/gstav.h b/ext/libav/gstav.h
index 5cd69a5..82e2972 100644
--- a/ext/libav/gstav.h
+++ b/ext/libav/gstav.h
@@ -13,8 +13,8 @@
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
*/
/* First, include the header file for the plugin, to bring in the
@@ -36,21 +36,16 @@ GST_DEBUG_CATEGORY_EXTERN (ffmpeg_debug);
G_BEGIN_DECLS
-#ifndef GST_DISABLE_GST_DEBUG
-extern gboolean _shut_up_I_am_probing;
-#endif
-
extern gboolean gst_ffmpegdemux_register (GstPlugin * plugin);
extern gboolean gst_ffmpegauddec_register (GstPlugin * plugin);
extern gboolean gst_ffmpegviddec_register (GstPlugin * plugin);
extern gboolean gst_ffmpegaudenc_register (GstPlugin * plugin);
extern gboolean gst_ffmpegvidenc_register (GstPlugin * plugin);
extern gboolean gst_ffmpegmux_register (GstPlugin * plugin);
-extern gboolean gst_ffmpegcsp_register (GstPlugin * plugin);
#if 0
extern gboolean gst_ffmpegscale_register (GstPlugin * plugin);
-#endif
extern gboolean gst_ffmpegaudioresample_register (GstPlugin * plugin);
+#endif
extern gboolean gst_ffmpegdeinterlace_register (GstPlugin * plugin);
int gst_ffmpeg_avcodec_open (AVCodecContext *avctx, AVCodec *codec);
@@ -59,9 +54,6 @@ int gst_ffmpeg_av_find_stream_info(AVFormatContext *ic);
G_END_DECLS
-extern URLProtocol gstreamer_protocol;
-extern URLProtocol gstpipe_protocol;
-
/* use GST_FFMPEG URL_STREAMHEADER with URL_WRONLY if the first
* buffer should be used as streamheader property on the pad's caps. */
#define GST_FFMPEG_URL_STREAMHEADER 16
diff --git a/ext/libav/gstavauddec.c b/ext/libav/gstavauddec.c
new file mode 100644
index 0000000..6714185
--- /dev/null
+++ b/ext/libav/gstavauddec.c
@@ -0,0 +1,893 @@
+/* GStreamer
+ * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
+ * Copyright (C) <2012> Collabora Ltd.
+ * Author: Sebastian Dröge <sebastian.droege@collabora.co.uk>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <assert.h>
+#include <string.h>
+
+#include <libavcodec/avcodec.h>
+
+#include <gst/gst.h>
+
+#include "gstav.h"
+#include "gstavcodecmap.h"
+#include "gstavutils.h"
+#include "gstavauddec.h"
+
+GST_DEBUG_CATEGORY_EXTERN (GST_CAT_PERFORMANCE);
+
+/* A number of function prototypes are given so we can refer to them later. */
+static void gst_ffmpegauddec_base_init (GstFFMpegAudDecClass * klass);
+static void gst_ffmpegauddec_class_init (GstFFMpegAudDecClass * klass);
+static void gst_ffmpegauddec_init (GstFFMpegAudDec * ffmpegdec);
+static void gst_ffmpegauddec_finalize (GObject * object);
+
+static gboolean gst_ffmpegauddec_stop (GstAudioDecoder * decoder);
+static void gst_ffmpegauddec_flush (GstAudioDecoder * decoder, gboolean hard);
+static gboolean gst_ffmpegauddec_set_format (GstAudioDecoder * decoder,
+ GstCaps * caps);
+static GstFlowReturn gst_ffmpegauddec_handle_frame (GstAudioDecoder * decoder,
+ GstBuffer * inbuf);
+
+static gboolean gst_ffmpegauddec_negotiate (GstFFMpegAudDec * ffmpegdec,
+ gboolean force);
+
+static void gst_ffmpegauddec_drain (GstFFMpegAudDec * ffmpegdec);
+
+#define GST_FFDEC_PARAMS_QDATA g_quark_from_static_string("avdec-params")
+
+static GstElementClass *parent_class = NULL;
+
+static void
+gst_ffmpegauddec_base_init (GstFFMpegAudDecClass * klass)
+{
+ GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
+ GstPadTemplate *sinktempl, *srctempl;
+ GstCaps *sinkcaps, *srccaps;
+ AVCodec *in_plugin;
+ gchar *longname, *description;
+
+ in_plugin =
+ (AVCodec *) g_type_get_qdata (G_OBJECT_CLASS_TYPE (klass),
+ GST_FFDEC_PARAMS_QDATA);
+ g_assert (in_plugin != NULL);
+
+ /* construct the element details struct */
+ longname = g_strdup_printf ("libav %s decoder", in_plugin->long_name);
+ description = g_strdup_printf ("libav %s decoder", in_plugin->name);
+ gst_element_class_set_metadata (element_class, longname,
+ "Codec/Decoder/Audio", description,
+ "Wim Taymans <wim.taymans@gmail.com>, "
+ "Ronald Bultje <rbultje@ronald.bitfreak.net>, "
+ "Edward Hervey <bilboed@bilboed.com>");
+ g_free (longname);
+ g_free (description);
+
+ /* get the caps */
+ sinkcaps = gst_ffmpeg_codecid_to_caps (in_plugin->id, NULL, FALSE);
+ if (!sinkcaps) {
+ GST_DEBUG ("Couldn't get sink caps for decoder '%s'", in_plugin->name);
+ sinkcaps = gst_caps_from_string ("unknown/unknown");
+ }
+ srccaps = gst_ffmpeg_codectype_to_audio_caps (NULL,
+ in_plugin->id, FALSE, in_plugin);
+ if (!srccaps) {
+ GST_DEBUG ("Couldn't get source caps for decoder '%s'", in_plugin->name);
+ srccaps = gst_caps_from_string ("audio/x-raw");
+ }
+
+ /* pad templates */
+ sinktempl = gst_pad_template_new ("sink", GST_PAD_SINK,
+ GST_PAD_ALWAYS, sinkcaps);
+ srctempl = gst_pad_template_new ("src", GST_PAD_SRC, GST_PAD_ALWAYS, srccaps);
+
+ gst_element_class_add_pad_template (element_class, srctempl);
+ gst_element_class_add_pad_template (element_class, sinktempl);
+
+ klass->in_plugin = in_plugin;
+ klass->srctempl = srctempl;
+ klass->sinktempl = sinktempl;
+}
+
+static void
+gst_ffmpegauddec_class_init (GstFFMpegAudDecClass * klass)
+{
+ GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+ GstAudioDecoderClass *gstaudiodecoder_class = GST_AUDIO_DECODER_CLASS (klass);
+
+ parent_class = g_type_class_peek_parent (klass);
+
+ gobject_class->finalize = gst_ffmpegauddec_finalize;
+
+ gstaudiodecoder_class->stop = GST_DEBUG_FUNCPTR (gst_ffmpegauddec_stop);
+ gstaudiodecoder_class->set_format =
+ GST_DEBUG_FUNCPTR (gst_ffmpegauddec_set_format);
+ gstaudiodecoder_class->handle_frame =
+ GST_DEBUG_FUNCPTR (gst_ffmpegauddec_handle_frame);
+ gstaudiodecoder_class->flush = GST_DEBUG_FUNCPTR (gst_ffmpegauddec_flush);
+}
+
+static void
+gst_ffmpegauddec_init (GstFFMpegAudDec * ffmpegdec)
+{
+ GstFFMpegAudDecClass *klass =
+ (GstFFMpegAudDecClass *) G_OBJECT_GET_CLASS (ffmpegdec);
+
+ /* some ffmpeg data */
+ ffmpegdec->context = avcodec_alloc_context3 (klass->in_plugin);
+ ffmpegdec->opened = FALSE;
+
+ gst_audio_decoder_set_drainable (GST_AUDIO_DECODER (ffmpegdec), TRUE);
+ gst_audio_decoder_set_needs_format (GST_AUDIO_DECODER (ffmpegdec), TRUE);
+}
+
+static void
+gst_ffmpegauddec_finalize (GObject * object)
+{
+ GstFFMpegAudDec *ffmpegdec = (GstFFMpegAudDec *) object;
+
+ if (ffmpegdec->context != NULL)
+ av_free (ffmpegdec->context);
+ ffmpegdec->context = NULL;
+
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+/* With LOCK */
+static void
+gst_ffmpegauddec_close (GstFFMpegAudDec * ffmpegdec)
+{
+ GST_LOG_OBJECT (ffmpegdec, "closing libav codec");
+
+ gst_caps_replace (&ffmpegdec->last_caps, NULL);
+ gst_buffer_replace (&ffmpegdec->outbuf, NULL);
+
+ gst_ffmpeg_avcodec_close (ffmpegdec->context);
+ ffmpegdec->opened = FALSE;
+
+ if (ffmpegdec->context->extradata) {
+ av_free (ffmpegdec->context->extradata);
+ ffmpegdec->context->extradata = NULL;
+ }
+}
+
+static gboolean
+gst_ffmpegauddec_stop (GstAudioDecoder * decoder)
+{
+ GstFFMpegAudDec *ffmpegdec = (GstFFMpegAudDec *) decoder;
+
+ GST_OBJECT_LOCK (ffmpegdec);
+ gst_ffmpegauddec_close (ffmpegdec);
+ GST_OBJECT_UNLOCK (ffmpegdec);
+ gst_audio_info_init (&ffmpegdec->info);
+ gst_caps_replace (&ffmpegdec->last_caps, NULL);
+
+ return TRUE;
+}
+
+/* with LOCK */
+static gboolean
+gst_ffmpegauddec_open (GstFFMpegAudDec * ffmpegdec)
+{
+ GstFFMpegAudDecClass *oclass;
+
+ oclass = (GstFFMpegAudDecClass *) (G_OBJECT_GET_CLASS (ffmpegdec));
+
+ if (gst_ffmpeg_avcodec_open (ffmpegdec->context, oclass->in_plugin) < 0)
+ goto could_not_open;
+
+ ffmpegdec->opened = TRUE;
+
+ GST_LOG_OBJECT (ffmpegdec, "Opened libav codec %s, id %d",
+ oclass->in_plugin->name, oclass->in_plugin->id);
+
+ gst_audio_info_init (&ffmpegdec->info);
+
+ return TRUE;
+
+ /* ERRORS */
+could_not_open:
+ {
+ gst_ffmpegauddec_close (ffmpegdec);
+ GST_DEBUG_OBJECT (ffmpegdec, "avdec_%s: Failed to open libav codec",
+ oclass->in_plugin->name);
+ return FALSE;
+ }
+}
+
+typedef struct
+{
+ GstBuffer *buffer;
+ GstMapInfo map;
+} BufferInfo;
+
+/* called when ffmpeg wants us to allocate a buffer to write the decoded frame
+ * into. We try to give it memory from our pool */
+static int
+gst_ffmpegauddec_get_buffer (AVCodecContext * context, AVFrame * frame)
+{
+ GstFFMpegAudDec *ffmpegdec;
+ GstAudioInfo *info;
+ BufferInfo *buffer_info;
+
+ ffmpegdec = (GstFFMpegAudDec *) context->opaque;
+ if (G_UNLIKELY (!gst_ffmpegauddec_negotiate (ffmpegdec, FALSE)))
+ goto negotiate_failed;
+
+ /* Always use the default allocator for planar audio formats because
+ * we will have to copy and deinterleave later anyway */
+ if (av_sample_fmt_is_planar (ffmpegdec->context->sample_fmt))
+ goto fallback;
+
+ info = gst_audio_decoder_get_audio_info (GST_AUDIO_DECODER (ffmpegdec));
+
+ buffer_info = g_slice_new (BufferInfo);
+ buffer_info->buffer =
+ gst_audio_decoder_allocate_output_buffer (GST_AUDIO_DECODER (ffmpegdec),
+ frame->nb_samples * info->bpf);
+ gst_buffer_map (buffer_info->buffer, &buffer_info->map, GST_MAP_WRITE);
+ frame->opaque = buffer_info;
+ frame->data[0] = buffer_info->map.data;
+ frame->extended_data = frame->data;
+ frame->linesize[0] = buffer_info->map.size;
+ frame->type = FF_BUFFER_TYPE_USER;
+
+ return 0;
+ /* fallbacks */
+negotiate_failed:
+ {
+ GST_DEBUG_OBJECT (ffmpegdec, "negotiate failed");
+ goto fallback;
+ }
+fallback:
+ {
+ return avcodec_default_get_buffer (context, frame);
+ }
+}
+
+static gboolean
+gst_ffmpegauddec_set_format (GstAudioDecoder * decoder, GstCaps * caps)
+{
+ GstFFMpegAudDec *ffmpegdec = (GstFFMpegAudDec *) decoder;
+ GstFFMpegAudDecClass *oclass;
+ gboolean ret = TRUE;
+
+ oclass = (GstFFMpegAudDecClass *) (G_OBJECT_GET_CLASS (ffmpegdec));
+
+ GST_DEBUG_OBJECT (ffmpegdec, "setcaps called");
+
+ GST_OBJECT_LOCK (ffmpegdec);
+
+ if (ffmpegdec->last_caps && gst_caps_is_equal (ffmpegdec->last_caps, caps)) {
+ GST_DEBUG_OBJECT (ffmpegdec, "same caps");
+ GST_OBJECT_UNLOCK (ffmpegdec);
+ return TRUE;
+ }
+
+ gst_caps_replace (&ffmpegdec->last_caps, caps);
+
+ /* close old session */
+ if (ffmpegdec->opened) {
+ GST_OBJECT_UNLOCK (ffmpegdec);
+ gst_ffmpegauddec_drain (ffmpegdec);
+ GST_OBJECT_LOCK (ffmpegdec);
+ gst_ffmpegauddec_close (ffmpegdec);
+ }
+
+ /* get size and so */
+ gst_ffmpeg_caps_with_codecid (oclass->in_plugin->id,
+ oclass->in_plugin->type, caps, ffmpegdec->context);
+
+ /* workaround encoder bugs */
+ ffmpegdec->context->workaround_bugs |= FF_BUG_AUTODETECT;
+ ffmpegdec->context->err_recognition = 1;
+
+ ffmpegdec->context->opaque = ffmpegdec;
+ ffmpegdec->context->get_buffer = gst_ffmpegauddec_get_buffer;
+ ffmpegdec->context->reget_buffer = NULL;
+ ffmpegdec->context->release_buffer = NULL;
+
+ /* open codec - we don't select an output pix_fmt yet,
+ * simply because we don't know! We only get it
+ * during playback... */
+ if (!gst_ffmpegauddec_open (ffmpegdec))
+ goto open_failed;
+
+done:
+ GST_OBJECT_UNLOCK (ffmpegdec);
+
+ return ret;
+
+ /* ERRORS */
+open_failed:
+ {
+ GST_DEBUG_OBJECT (ffmpegdec, "Failed to open");
+ ret = FALSE;
+ goto done;
+ }
+}
+
+static gboolean
+gst_ffmpegauddec_negotiate (GstFFMpegAudDec * ffmpegdec, gboolean force)
+{
+ GstFFMpegAudDecClass *oclass;
+ gint depth;
+ GstAudioFormat format;
+ GstAudioChannelPosition pos[64] = { 0, };
+
+ oclass = (GstFFMpegAudDecClass *) (G_OBJECT_GET_CLASS (ffmpegdec));
+
+ depth = av_smp_format_depth (ffmpegdec->context->sample_fmt) * 8;
+ format = gst_ffmpeg_smpfmt_to_audioformat (ffmpegdec->context->sample_fmt);
+ if (format == GST_AUDIO_FORMAT_UNKNOWN)
+ goto no_caps;
+
+ if (!force && ffmpegdec->info.rate ==
+ ffmpegdec->context->sample_rate &&
+ ffmpegdec->info.channels == ffmpegdec->context->channels &&
+ ffmpegdec->info.finfo->depth == depth)
+ return TRUE;
+
+ GST_DEBUG_OBJECT (ffmpegdec,
+ "Renegotiating audio from %dHz@%dchannels (%d) to %dHz@%dchannels (%d)",
+ ffmpegdec->info.rate, ffmpegdec->info.channels,
+ ffmpegdec->info.finfo->depth,
+ ffmpegdec->context->sample_rate, ffmpegdec->context->channels, depth);
+
+ gst_ffmpeg_channel_layout_to_gst (ffmpegdec->context->channel_layout,
+ ffmpegdec->context->channels, pos);
+ memcpy (ffmpegdec->ffmpeg_layout, pos,
+ sizeof (GstAudioChannelPosition) * ffmpegdec->context->channels);
+
+ /* Get GStreamer channel layout */
+ gst_audio_channel_positions_to_valid_order (pos,
+ ffmpegdec->context->channels);
+ ffmpegdec->needs_reorder =
+ memcmp (pos, ffmpegdec->ffmpeg_layout,
+ sizeof (pos[0]) * ffmpegdec->context->channels) != 0;
+ gst_audio_info_set_format (&ffmpegdec->info, format,
+ ffmpegdec->context->sample_rate, ffmpegdec->context->channels, pos);
+
+ if (!gst_audio_decoder_set_output_format (GST_AUDIO_DECODER (ffmpegdec),
+ &ffmpegdec->info))
+ goto caps_failed;
+
+ return TRUE;
+
+ /* ERRORS */
+no_caps:
+ {
+#ifdef HAVE_LIBAV_UNINSTALLED
+ /* using internal ffmpeg snapshot */
+ GST_ELEMENT_ERROR (ffmpegdec, CORE, NEGOTIATION,
+ ("Could not find GStreamer caps mapping for libav codec '%s'.",
+ oclass->in_plugin->name), (NULL));
+#else
+ /* using external ffmpeg */
+ GST_ELEMENT_ERROR (ffmpegdec, CORE, NEGOTIATION,
+ ("Could not find GStreamer caps mapping for libav codec '%s', and "
+ "you are using an external libavcodec. This is most likely due to "
+ "a packaging problem and/or libavcodec having been upgraded to a "
+ "version that is not compatible with this version of "
+ "gstreamer-libav. Make sure your gstreamer-libav and libavcodec "
+ "packages come from the same source/repository.",
+ oclass->in_plugin->name), (NULL));
+#endif
+ return FALSE;
+ }
+caps_failed:
+ {
+ GST_ELEMENT_ERROR (ffmpegdec, CORE, NEGOTIATION, (NULL),
+ ("Could not set caps for libav decoder (%s), not fixed?",
+ oclass->in_plugin->name));
+
+ return FALSE;
+ }
+}
+
+static void
+gst_avpacket_init (AVPacket * packet, guint8 * data, guint size)
+{
+ memset (packet, 0, sizeof (AVPacket));
+ packet->data = data;
+ packet->size = size;
+}
+
+static gint
+gst_ffmpegauddec_audio_frame (GstFFMpegAudDec * ffmpegdec,
+ AVCodec * in_plugin, guint8 * data, guint size,
+ GstBuffer ** outbuf, GstFlowReturn * ret)
+{
+ gint len = -1;
+ gint have_data = AVCODEC_MAX_AUDIO_FRAME_SIZE;
+ AVPacket packet;
+ AVFrame frame;
+
+ GST_DEBUG_OBJECT (ffmpegdec, "size: %d", size);
+
+ gst_avpacket_init (&packet, data, size);
+ memset (&frame, 0, sizeof (frame));
+ avcodec_get_frame_defaults (&frame);
+ len = avcodec_decode_audio4 (ffmpegdec->context, &frame, &have_data, &packet);
+
+ GST_DEBUG_OBJECT (ffmpegdec,
+ "Decode audio: len=%d, have_data=%d", len, have_data);
+
+ if (len >= 0 && have_data > 0) {
+ BufferInfo *buffer_info = frame.opaque;
+ gint nsamples, channels, byte_per_sample;
+ gsize output_size;
+
+ if (!gst_ffmpegauddec_negotiate (ffmpegdec, FALSE)) {
+ *outbuf = NULL;
+ *ret = GST_FLOW_NOT_NEGOTIATED;
+ len = -1;
+ goto beach;
+ }
+
+ channels = ffmpegdec->info.channels;
+ nsamples = frame.nb_samples;
+ byte_per_sample = ffmpegdec->info.finfo->width / 8;
+
+ /* frame.linesize[0] might contain padding, allocate only what's needed */
+ output_size = nsamples * byte_per_sample * channels;
+
+ GST_DEBUG_OBJECT (ffmpegdec, "Creating output buffer");
+ if (buffer_info) {
+ *outbuf = buffer_info->buffer;
+ gst_buffer_unmap (buffer_info->buffer, &buffer_info->map);
+ g_slice_free (BufferInfo, buffer_info);
+ frame.opaque = NULL;
+ } else if (av_sample_fmt_is_planar (ffmpegdec->context->sample_fmt)
+ && channels > 1) {
+ gint i, j;
+ GstMapInfo minfo;
+
+ /* note: linesize[0] might contain padding, allocate only what's needed */
+ *outbuf =
+ gst_audio_decoder_allocate_output_buffer (GST_AUDIO_DECODER
+ (ffmpegdec), output_size);
+
+ gst_buffer_map (*outbuf, &minfo, GST_MAP_WRITE);
+
+ switch (ffmpegdec->info.finfo->width) {
+ case 8:{
+ guint8 *odata = minfo.data;
+
+ for (i = 0; i < nsamples; i++) {
+ for (j = 0; j < channels; j++) {
+ odata[j] = ((const guint8 *) frame.extended_data[j])[i];
+ }
+ odata += channels;
+ }
+ break;
+ }
+ case 16:{
+ guint16 *odata = (guint16 *) minfo.data;
+
+ for (i = 0; i < nsamples; i++) {
+ for (j = 0; j < channels; j++) {
+ odata[j] = ((const guint16 *) frame.extended_data[j])[i];
+ }
+ odata += channels;
+ }
+ break;
+ }
+ case 32:{
+ guint32 *odata = (guint32 *) minfo.data;
+
+ for (i = 0; i < nsamples; i++) {
+ for (j = 0; j < channels; j++) {
+ odata[j] = ((const guint32 *) frame.extended_data[j])[i];
+ }
+ odata += channels;
+ }
+ break;
+ }
+ case 64:{
+ guint64 *odata = (guint64 *) minfo.data;
+
+ for (i = 0; i < nsamples; i++) {
+ for (j = 0; j < channels; j++) {
+ odata[j] = ((const guint64 *) frame.extended_data[j])[i];
+ }
+ odata += channels;
+ }
+ break;
+ }
+ default:
+ g_assert_not_reached ();
+ break;
+ }
+ gst_buffer_unmap (*outbuf, &minfo);
+ } else {
+ *outbuf =
+ gst_audio_decoder_allocate_output_buffer (GST_AUDIO_DECODER
+ (ffmpegdec), output_size);
+ gst_buffer_fill (*outbuf, 0, frame.data[0], output_size);
+ }
+
+ GST_DEBUG_OBJECT (ffmpegdec, "Buffer created. Size: %d", have_data);
+
+ /* Reorder channels to the GStreamer channel order */
+ if (ffmpegdec->needs_reorder) {
+ *outbuf = gst_buffer_make_writable (*outbuf);
+ gst_audio_buffer_reorder_channels (*outbuf, ffmpegdec->info.finfo->format,
+ ffmpegdec->info.channels, ffmpegdec->ffmpeg_layout,
+ ffmpegdec->info.position);
+ }
+ } else {
+ *outbuf = NULL;
+ }
+
+beach:
+ GST_DEBUG_OBJECT (ffmpegdec, "return flow %d, out %p, len %d",
+ *ret, *outbuf, len);
+ return len;
+}
+
+/* gst_ffmpegauddec_frame:
+ * ffmpegdec:
+ * data: pointer to the data to decode
+ * size: size of data in bytes
+ * got_data: 0 if no data was decoded, != 0 otherwise.
+ * in_time: timestamp of data
+ * in_duration: duration of data
+ * ret: GstFlowReturn to return in the chain function
+ *
+ * Decode the given frame and pushes it downstream.
+ *
+ * Returns: Number of bytes used in decoding, -1 on error/failure.
+ */
+
+static gint
+gst_ffmpegauddec_frame (GstFFMpegAudDec * ffmpegdec,
+ guint8 * data, guint size, gint * got_data, GstFlowReturn * ret)
+{
+ GstFFMpegAudDecClass *oclass;
+ GstBuffer *outbuf = NULL;
+ gint have_data = 0, len = 0;
+
+ if (G_UNLIKELY (ffmpegdec->context->codec == NULL))
+ goto no_codec;
+
+ GST_LOG_OBJECT (ffmpegdec, "data:%p, size:%d", data, size);
+
+ *ret = GST_FLOW_OK;
+ ffmpegdec->context->frame_number++;
+
+ oclass = (GstFFMpegAudDecClass *) (G_OBJECT_GET_CLASS (ffmpegdec));
+
+ len =
+ gst_ffmpegauddec_audio_frame (ffmpegdec, oclass->in_plugin, data, size,
+ &outbuf, ret);
+
+ if (outbuf)
+ have_data = 1;
+
+ if (len < 0 || have_data < 0) {
+ GST_WARNING_OBJECT (ffmpegdec,
+ "avdec_%s: decoding error (len: %d, have_data: %d)",
+ oclass->in_plugin->name, len, have_data);
+ *got_data = 0;
+ goto beach;
+ } else if (len == 0 && have_data == 0) {
+ *got_data = 0;
+ goto beach;
+ } else {
+ /* this is where I lost my last clue on ffmpeg... */
+ *got_data = 1;
+ }
+
+ if (outbuf) {
+ GST_LOG_OBJECT (ffmpegdec, "Decoded data, now storing buffer %p", outbuf);
+
+ if (ffmpegdec->outbuf)
+ ffmpegdec->outbuf = gst_buffer_append (ffmpegdec->outbuf, outbuf);
+ else
+ ffmpegdec->outbuf = outbuf;
+ } else {
+ GST_DEBUG_OBJECT (ffmpegdec, "We didn't get a decoded buffer");
+ }
+
+beach:
+ return len;
+
+ /* ERRORS */
+no_codec:
+ {
+ GST_ERROR_OBJECT (ffmpegdec, "no codec context");
+ return -1;
+ }
+}
+
+static void
+gst_ffmpegauddec_drain (GstFFMpegAudDec * ffmpegdec)
+{
+ GstFFMpegAudDecClass *oclass;
+
+ oclass = (GstFFMpegAudDecClass *) (G_OBJECT_GET_CLASS (ffmpegdec));
+
+ if (oclass->in_plugin->capabilities & CODEC_CAP_DELAY) {
+ gint have_data, len, try = 0;
+
+ GST_LOG_OBJECT (ffmpegdec,
+ "codec has delay capabilities, calling until libav has drained everything");
+
+ do {
+ GstFlowReturn ret;
+
+ len = gst_ffmpegauddec_frame (ffmpegdec, NULL, 0, &have_data, &ret);
+ if (len < 0 || have_data == 0)
+ break;
+ } while (try++ < 10);
+ }
+
+ if (ffmpegdec->outbuf)
+ gst_audio_decoder_finish_frame (GST_AUDIO_DECODER (ffmpegdec),
+ ffmpegdec->outbuf, 1);
+ ffmpegdec->outbuf = NULL;
+}
+
+static void
+gst_ffmpegauddec_flush (GstAudioDecoder * decoder, gboolean hard)
+{
+ GstFFMpegAudDec *ffmpegdec = (GstFFMpegAudDec *) decoder;
+
+ if (ffmpegdec->opened) {
+ avcodec_flush_buffers (ffmpegdec->context);
+ }
+}
+
+static GstFlowReturn
+gst_ffmpegauddec_handle_frame (GstAudioDecoder * decoder, GstBuffer * inbuf)
+{
+ GstFFMpegAudDec *ffmpegdec;
+ GstFFMpegAudDecClass *oclass;
+ guint8 *data, *bdata;
+ GstMapInfo map;
+ gint size, bsize, len, have_data;
+ GstFlowReturn ret = GST_FLOW_OK;
+
+ ffmpegdec = (GstFFMpegAudDec *) decoder;
+
+ if (G_UNLIKELY (!ffmpegdec->opened))
+ goto not_negotiated;
+
+ if (inbuf == NULL) {
+ gst_ffmpegauddec_drain (ffmpegdec);
+ return GST_FLOW_OK;
+ }
+
+ inbuf = gst_buffer_ref (inbuf);
+
+ oclass = (GstFFMpegAudDecClass *) (G_OBJECT_GET_CLASS (ffmpegdec));
+
+ GST_LOG_OBJECT (ffmpegdec,
+ "Received new data of size %" G_GSIZE_FORMAT ", offset:%" G_GUINT64_FORMAT
+ ", ts:%" GST_TIME_FORMAT ", dur:%" GST_TIME_FORMAT,
+ gst_buffer_get_size (inbuf), GST_BUFFER_OFFSET (inbuf),
+ GST_TIME_ARGS (GST_BUFFER_PTS (inbuf)),
+ GST_TIME_ARGS (GST_BUFFER_DURATION (inbuf)));
+
+ /* workarounds, functions write to buffers:
+ * libavcodec/svq1.c:svq1_decode_frame writes to the given buffer.
+ * libavcodec/svq3.c:svq3_decode_slice_header too.
+ * ffmpeg devs know about it and will fix it (they said). */
+ if (oclass->in_plugin->id == AV_CODEC_ID_SVQ1 ||
+ oclass->in_plugin->id == AV_CODEC_ID_SVQ3) {
+ inbuf = gst_buffer_make_writable (inbuf);
+ }
+
+ gst_buffer_map (inbuf, &map, GST_MAP_READ);
+
+ bdata = map.data;
+ bsize = map.size;
+
+ do {
+ data = bdata;
+ size = bsize;
+
+ /* decode a frame of audio now */
+ len = gst_ffmpegauddec_frame (ffmpegdec, data, size, &have_data, &ret);
+
+ if (ret != GST_FLOW_OK) {
+ GST_LOG_OBJECT (ffmpegdec, "breaking because of flow ret %s",
+ gst_flow_get_name (ret));
+ /* bad flow return, make sure we discard all data and exit */
+ bsize = 0;
+ break;
+ }
+
+ if (len == 0 && !have_data) {
+ /* nothing was decoded, this could be because no data was available or
+ * because we were skipping frames.
+ * If we have no context we must exit and wait for more data, we keep the
+ * data we tried. */
+ GST_LOG_OBJECT (ffmpegdec, "Decoding didn't return any data, breaking");
+ break;
+ } else if (len < 0) {
+ /* a decoding error happened, we must break and try again with next data. */
+ GST_LOG_OBJECT (ffmpegdec, "Decoding error, breaking");
+ bsize = 0;
+ break;
+ }
+ /* prepare for the next round, for codecs with a context we did this
+ * already when using the parser. */
+ bsize -= len;
+ bdata += len;
+
+ GST_LOG_OBJECT (ffmpegdec, "Before (while bsize>0). bsize:%d , bdata:%p",
+ bsize, bdata);
+ } while (bsize > 0);
+
+ gst_buffer_unmap (inbuf, &map);
+ gst_buffer_unref (inbuf);
+
+ if (ffmpegdec->outbuf)
+ ret =
+ gst_audio_decoder_finish_frame (GST_AUDIO_DECODER (ffmpegdec),
+ ffmpegdec->outbuf, 1);
+ ffmpegdec->outbuf = NULL;
+
+ if (bsize > 0) {
+ GST_DEBUG_OBJECT (ffmpegdec, "Dropping %d bytes of data", bsize);
+ }
+
+ return ret;
+
+ /* ERRORS */
+not_negotiated:
+ {
+ oclass = (GstFFMpegAudDecClass *) (G_OBJECT_GET_CLASS (ffmpegdec));
+ GST_ELEMENT_ERROR (ffmpegdec, CORE, NEGOTIATION, (NULL),
+ ("avdec_%s: input format was not set before data start",
+ oclass->in_plugin->name));
+ return GST_FLOW_NOT_NEGOTIATED;
+ }
+}
+
+gboolean
+gst_ffmpegauddec_register (GstPlugin * plugin)
+{
+ GTypeInfo typeinfo = {
+ sizeof (GstFFMpegAudDecClass),
+ (GBaseInitFunc) gst_ffmpegauddec_base_init,
+ NULL,
+ (GClassInitFunc) gst_ffmpegauddec_class_init,
+ NULL,
+ NULL,
+ sizeof (GstFFMpegAudDec),
+ 0,
+ (GInstanceInitFunc) gst_ffmpegauddec_init,
+ };
+ GType type;
+ AVCodec *in_plugin;
+ gint rank;
+
+ in_plugin = av_codec_next (NULL);
+
+ GST_LOG ("Registering decoders");
+
+ while (in_plugin) {
+ gchar *type_name;
+ gchar *plugin_name;
+
+ /* only decoders */
+ if (!av_codec_is_decoder (in_plugin)
+ || in_plugin->type != AVMEDIA_TYPE_AUDIO) {
+ goto next;
+ }
+
+ /* no quasi-codecs, please */
+ if (in_plugin->id >= AV_CODEC_ID_PCM_S16LE &&
+ in_plugin->id <= AV_CODEC_ID_PCM_BLURAY) {
+ goto next;
+ }
+
+ /* No decoders depending on external libraries (we don't build them, but
+ * people who build against an external ffmpeg might have them.
+ * We have native gstreamer plugins for all of those libraries anyway. */
+ if (!strncmp (in_plugin->name, "lib", 3)) {
+ GST_DEBUG
+ ("Not using external library decoder %s. Use the gstreamer-native ones instead.",
+ in_plugin->name);
+ goto next;
+ }
+
+ GST_DEBUG ("Trying plugin %s [%s]", in_plugin->name, in_plugin->long_name);
+
+ /* no codecs for which we're GUARANTEED to have better alternatives */
+ /* MP1 : Use MP3 for decoding */
+ /* MP2 : Use MP3 for decoding */
+ /* Theora: Use libtheora based theoradec */
+ if (!strcmp (in_plugin->name, "vorbis") ||
+ !strcmp (in_plugin->name, "wavpack") ||
+ !strcmp (in_plugin->name, "mp1") ||
+ !strcmp (in_plugin->name, "mp2") ||
+ !strcmp (in_plugin->name, "libfaad") ||
+ !strcmp (in_plugin->name, "mpeg4aac") ||
+ !strcmp (in_plugin->name, "ass") ||
+ !strcmp (in_plugin->name, "srt") ||
+ !strcmp (in_plugin->name, "pgssub") ||
+ !strcmp (in_plugin->name, "dvdsub") ||
+ !strcmp (in_plugin->name, "dvbsub")) {
+ GST_LOG ("Ignoring decoder %s", in_plugin->name);
+ goto next;
+ }
+
+ /* construct the type */
+ plugin_name = g_strdup ((gchar *) in_plugin->name);
+ g_strdelimit (plugin_name, NULL, '_');
+ type_name = g_strdup_printf ("avdec_%s", plugin_name);
+ g_free (plugin_name);
+
+ type = g_type_from_name (type_name);
+
+ if (!type) {
+ /* create the gtype now */
+ type =
+ g_type_register_static (GST_TYPE_AUDIO_DECODER, type_name, &typeinfo,
+ 0);
+ g_type_set_qdata (type, GST_FFDEC_PARAMS_QDATA, (gpointer) in_plugin);
+ }
+
+ /* (Ronald) MPEG-4 gets a higher priority because it has been well-
+ * tested and by far outperforms divxdec/xviddec - so we prefer it.
+ * msmpeg4v3 same, as it outperforms divxdec for divx3 playback.
+ * VC1/WMV3 are not working and thus unpreferred for now. */
+ switch (in_plugin->id) {
+ case AV_CODEC_ID_RA_144:
+ case AV_CODEC_ID_RA_288:
+ case AV_CODEC_ID_COOK:
+ rank = GST_RANK_PRIMARY;
+ break;
+ /* SIPR: decoder should have a higher rank than realaudiodec.
+ */
+ case AV_CODEC_ID_SIPR:
+ rank = GST_RANK_SECONDARY;
+ break;
+ case AV_CODEC_ID_MP3:
+ rank = GST_RANK_NONE;
+ break;
+ default:
+ rank = GST_RANK_MARGINAL;
+ break;
+ }
+ if (!gst_element_register (plugin, type_name, rank, type)) {
+ g_warning ("Failed to register %s", type_name);
+ g_free (type_name);
+ return FALSE;
+ }
+
+ g_free (type_name);
+
+ next:
+ in_plugin = av_codec_next (in_plugin);
+ }
+
+ GST_LOG ("Finished Registering decoders");
+
+ return TRUE;
+}
diff --git a/ext/libav/gstavauddec.h b/ext/libav/gstavauddec.h
new file mode 100644
index 0000000..23d11fd
--- /dev/null
+++ b/ext/libav/gstavauddec.h
@@ -0,0 +1,73 @@
+/* GStreamer
+ * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+#ifndef __GST_FFMPEGAUDDEC_H__
+#define __GST_FFMPEGAUDDEC_H__
+
+G_BEGIN_DECLS
+
+#include <gst/gst.h>
+#include <gst/audio/audio.h>
+#include <gst/audio/gstaudiodecoder.h>
+#include <libavcodec/avcodec.h>
+
+typedef struct _GstFFMpegAudDec GstFFMpegAudDec;
+struct _GstFFMpegAudDec
+{
+ GstAudioDecoder parent;
+
+ /* decoding */
+ AVCodecContext *context;
+ gboolean opened;
+
+ /* prevent reopening the decoder on GST_EVENT_CAPS when caps are same as last time. */
+ GstCaps *last_caps;
+
+ /* Stores current buffers to push as GstAudioDecoder wants 1:1 mapping for input/output buffers */
+ GstBuffer *outbuf;
+
+ /* current output format */
+ GstAudioInfo info;
+ GstAudioChannelPosition ffmpeg_layout[64];
+ gboolean needs_reorder;
+};
+
+typedef struct _GstFFMpegAudDecClass GstFFMpegAudDecClass;
+
+struct _GstFFMpegAudDecClass
+{
+ GstAudioDecoderClass parent_class;
+
+ AVCodec *in_plugin;
+ GstPadTemplate *srctempl, *sinktempl;
+};
+
+#define GST_TYPE_FFMPEGDEC \
+ (gst_ffmpegauddec_get_type())
+#define GST_FFMPEGDEC(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_FFMPEGDEC,GstFFMpegAudDec))
+#define GST_FFMPEGAUDDEC_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_FFMPEGDEC,GstFFMpegAudDecClass))
+#define GST_IS_FFMPEGDEC(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_FFMPEGDEC))
+#define GST_IS_FFMPEGAUDDEC_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_FFMPEGDEC))
+
+G_END_DECLS
+
+#endif
diff --git a/ext/libav/gstavaudenc.c b/ext/libav/gstavaudenc.c
new file mode 100644
index 0000000..bc07121
--- /dev/null
+++ b/ext/libav/gstavaudenc.c
@@ -0,0 +1,752 @@
+/* GStreamer
+ * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
+ * Copyright (C) <2012> Collabora Ltd.
+ * Author: Sebastian Dröge <sebastian.droege@collabora.co.uk>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <assert.h>
+#include <string.h>
+/* for stats file handling */
+#include <stdio.h>
+#include <glib/gstdio.h>
+#include <errno.h>
+
+#include <libavcodec/avcodec.h>
+
+#include <gst/gst.h>
+
+#include "gstav.h"
+#include "gstavcodecmap.h"
+#include "gstavutils.h"
+#include "gstavaudenc.h"
+
+#define DEFAULT_AUDIO_BITRATE 128000
+
+enum
+{
+ /* FILL ME */
+ LAST_SIGNAL
+};
+
+enum
+{
+ PROP_0,
+ PROP_BIT_RATE,
+ PROP_RTP_PAYLOAD_SIZE,
+};
+
+/* A number of function prototypes are given so we can refer to them later. */
+static void gst_ffmpegaudenc_class_init (GstFFMpegAudEncClass * klass);
+static void gst_ffmpegaudenc_base_init (GstFFMpegAudEncClass * klass);
+static void gst_ffmpegaudenc_init (GstFFMpegAudEnc * ffmpegaudenc);
+static void gst_ffmpegaudenc_finalize (GObject * object);
+
+static GstCaps *gst_ffmpegaudenc_getcaps (GstAudioEncoder * encoder,
+ GstCaps * filter);
+static gboolean gst_ffmpegaudenc_set_format (GstAudioEncoder * encoder,
+ GstAudioInfo * info);
+static GstFlowReturn gst_ffmpegaudenc_handle_frame (GstAudioEncoder * encoder,
+ GstBuffer * inbuf);
+static gboolean gst_ffmpegaudenc_stop (GstAudioEncoder * encoder);
+static void gst_ffmpegaudenc_flush (GstAudioEncoder * encoder);
+
+static void gst_ffmpegaudenc_set_property (GObject * object,
+ guint prop_id, const GValue * value, GParamSpec * pspec);
+static void gst_ffmpegaudenc_get_property (GObject * object,
+ guint prop_id, GValue * value, GParamSpec * pspec);
+
+#define GST_FFENC_PARAMS_QDATA g_quark_from_static_string("avenc-params")
+
+static GstElementClass *parent_class = NULL;
+
+/*static guint gst_ffmpegaudenc_signals[LAST_SIGNAL] = { 0 }; */
+
+static void
+gst_ffmpegaudenc_base_init (GstFFMpegAudEncClass * klass)
+{
+ GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
+ AVCodec *in_plugin;
+ GstPadTemplate *srctempl = NULL, *sinktempl = NULL;
+ GstCaps *srccaps = NULL, *sinkcaps = NULL;
+ gchar *longname, *description;
+
+ in_plugin =
+ (AVCodec *) g_type_get_qdata (G_OBJECT_CLASS_TYPE (klass),
+ GST_FFENC_PARAMS_QDATA);
+ g_assert (in_plugin != NULL);
+
+ /* construct the element details struct */
+ longname = g_strdup_printf ("libav %s encoder", in_plugin->long_name);
+ description = g_strdup_printf ("libav %s encoder", in_plugin->name);
+ gst_element_class_set_metadata (element_class, longname,
+ "Codec/Encoder/Audio", description,
+ "Wim Taymans <wim.taymans@gmail.com>, "
+ "Ronald Bultje <rbultje@ronald.bitfreak.net>");
+ g_free (longname);
+ g_free (description);
+
+ if (!(srccaps = gst_ffmpeg_codecid_to_caps (in_plugin->id, NULL, TRUE))) {
+ GST_DEBUG ("Couldn't get source caps for encoder '%s'", in_plugin->name);
+ srccaps = gst_caps_new_empty_simple ("unknown/unknown");
+ }
+
+ sinkcaps = gst_ffmpeg_codectype_to_audio_caps (NULL,
+ in_plugin->id, TRUE, in_plugin);
+ if (!sinkcaps) {
+ GST_DEBUG ("Couldn't get sink caps for encoder '%s'", in_plugin->name);
+ sinkcaps = gst_caps_new_empty_simple ("unknown/unknown");
+ }
+
+ /* pad templates */
+ sinktempl = gst_pad_template_new ("sink", GST_PAD_SINK,
+ GST_PAD_ALWAYS, sinkcaps);
+ srctempl = gst_pad_template_new ("src", GST_PAD_SRC, GST_PAD_ALWAYS, srccaps);
+
+ gst_element_class_add_pad_template (element_class, srctempl);
+ gst_element_class_add_pad_template (element_class, sinktempl);
+
+ klass->in_plugin = in_plugin;
+ klass->srctempl = srctempl;
+ klass->sinktempl = sinktempl;
+
+ return;
+}
+
+static void
+gst_ffmpegaudenc_class_init (GstFFMpegAudEncClass * klass)
+{
+ GObjectClass *gobject_class;
+ GstAudioEncoderClass *gstaudioencoder_class;
+
+ gobject_class = (GObjectClass *) klass;
+ gstaudioencoder_class = (GstAudioEncoderClass *) klass;
+
+ parent_class = g_type_class_peek_parent (klass);
+
+ gobject_class->set_property = gst_ffmpegaudenc_set_property;
+ gobject_class->get_property = gst_ffmpegaudenc_get_property;
+
+ /* FIXME: could use -1 for a sensible per-codec defaults */
+ g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_BIT_RATE,
+ g_param_spec_int ("bitrate", "Bit Rate",
+ "Target Audio Bitrate", 0, G_MAXINT, DEFAULT_AUDIO_BITRATE,
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+ gobject_class->finalize = gst_ffmpegaudenc_finalize;
+
+ gstaudioencoder_class->stop = GST_DEBUG_FUNCPTR (gst_ffmpegaudenc_stop);
+ gstaudioencoder_class->getcaps = GST_DEBUG_FUNCPTR (gst_ffmpegaudenc_getcaps);
+ gstaudioencoder_class->flush = GST_DEBUG_FUNCPTR (gst_ffmpegaudenc_flush);
+ gstaudioencoder_class->set_format =
+ GST_DEBUG_FUNCPTR (gst_ffmpegaudenc_set_format);
+ gstaudioencoder_class->handle_frame =
+ GST_DEBUG_FUNCPTR (gst_ffmpegaudenc_handle_frame);
+}
+
+static void
+gst_ffmpegaudenc_init (GstFFMpegAudEnc * ffmpegaudenc)
+{
+ GstFFMpegAudEncClass *klass =
+ (GstFFMpegAudEncClass *) G_OBJECT_GET_CLASS (ffmpegaudenc);
+
+ /* ffmpeg objects */
+ ffmpegaudenc->context = avcodec_alloc_context3 (klass->in_plugin);
+ ffmpegaudenc->opened = FALSE;
+
+ gst_audio_encoder_set_drainable (GST_AUDIO_ENCODER (ffmpegaudenc), TRUE);
+}
+
+static void
+gst_ffmpegaudenc_finalize (GObject * object)
+{
+ GstFFMpegAudEnc *ffmpegaudenc = (GstFFMpegAudEnc *) object;
+
+ /* clean up remaining allocated data */
+ av_free (ffmpegaudenc->context);
+
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static gboolean
+gst_ffmpegaudenc_stop (GstAudioEncoder * encoder)
+{
+ GstFFMpegAudEnc *ffmpegaudenc = (GstFFMpegAudEnc *) encoder;
+
+ /* close old session */
+ gst_ffmpeg_avcodec_close (ffmpegaudenc->context);
+ ffmpegaudenc->opened = FALSE;
+
+ return TRUE;
+}
+
+static void
+gst_ffmpegaudenc_flush (GstAudioEncoder * encoder)
+{
+ GstFFMpegAudEnc *ffmpegaudenc = (GstFFMpegAudEnc *) encoder;
+
+ if (ffmpegaudenc->opened) {
+ avcodec_flush_buffers (ffmpegaudenc->context);
+ }
+}
+
+static GstCaps *
+gst_ffmpegaudenc_getcaps (GstAudioEncoder * encoder, GstCaps * filter)
+{
+ GstFFMpegAudEnc *ffmpegaudenc = (GstFFMpegAudEnc *) encoder;
+ GstCaps *caps = NULL;
+
+ GST_DEBUG_OBJECT (ffmpegaudenc, "getting caps");
+
+ /* audio needs no special care */
+ caps = gst_audio_encoder_proxy_getcaps (encoder, NULL, filter);
+
+ GST_DEBUG_OBJECT (ffmpegaudenc, "audio caps, return %" GST_PTR_FORMAT, caps);
+
+ return caps;
+}
+
+static gboolean
+gst_ffmpegaudenc_set_format (GstAudioEncoder * encoder, GstAudioInfo * info)
+{
+ GstFFMpegAudEnc *ffmpegaudenc = (GstFFMpegAudEnc *) encoder;
+ GstCaps *other_caps;
+ GstCaps *allowed_caps;
+ GstCaps *icaps;
+ gsize frame_size;
+ GstFFMpegAudEncClass *oclass =
+ (GstFFMpegAudEncClass *) G_OBJECT_GET_CLASS (ffmpegaudenc);
+
+ /* close old session */
+ if (ffmpegaudenc->opened) {
+ gst_ffmpeg_avcodec_close (ffmpegaudenc->context);
+ ffmpegaudenc->opened = FALSE;
+ }
+
+ /* if we set it in _getcaps we should set it also in _link */
+ ffmpegaudenc->context->strict_std_compliance = -1;
+
+ /* user defined properties */
+ if (ffmpegaudenc->bitrate > 0) {
+ GST_INFO_OBJECT (ffmpegaudenc, "Setting avcontext to bitrate %d",
+ ffmpegaudenc->bitrate);
+ ffmpegaudenc->context->bit_rate = ffmpegaudenc->bitrate;
+ ffmpegaudenc->context->bit_rate_tolerance = ffmpegaudenc->bitrate;
+ } else {
+ GST_INFO_OBJECT (ffmpegaudenc, "Using avcontext default bitrate %d",
+ ffmpegaudenc->context->bit_rate);
+ }
+
+ /* RTP payload used for GOB production (for Asterisk) */
+ if (ffmpegaudenc->rtp_payload_size) {
+ ffmpegaudenc->context->rtp_payload_size = ffmpegaudenc->rtp_payload_size;
+ }
+
+ /* some other defaults */
+ ffmpegaudenc->context->rc_strategy = 2;
+ ffmpegaudenc->context->b_frame_strategy = 0;
+ ffmpegaudenc->context->coder_type = 0;
+ ffmpegaudenc->context->context_model = 0;
+ ffmpegaudenc->context->scenechange_threshold = 0;
+ ffmpegaudenc->context->inter_threshold = 0;
+
+ /* fetch pix_fmt and so on */
+ gst_ffmpeg_audioinfo_to_context (info, ffmpegaudenc->context);
+ if (!ffmpegaudenc->context->time_base.den) {
+ ffmpegaudenc->context->time_base.den = GST_AUDIO_INFO_RATE (info);
+ ffmpegaudenc->context->time_base.num = 1;
+ ffmpegaudenc->context->ticks_per_frame = 1;
+ }
+
+ if (ffmpegaudenc->context->channel_layout) {
+ gst_ffmpeg_channel_layout_to_gst (ffmpegaudenc->context->channel_layout,
+ ffmpegaudenc->context->channels, ffmpegaudenc->ffmpeg_layout);
+ ffmpegaudenc->needs_reorder =
+ (memcmp (ffmpegaudenc->ffmpeg_layout, info->position,
+ sizeof (GstAudioChannelPosition) *
+ ffmpegaudenc->context->channels) != 0);
+ }
+
+ /* open codec */
+ if (gst_ffmpeg_avcodec_open (ffmpegaudenc->context, oclass->in_plugin) < 0) {
+ if (ffmpegaudenc->context->priv_data)
+ gst_ffmpeg_avcodec_close (ffmpegaudenc->context);
+ GST_DEBUG_OBJECT (ffmpegaudenc, "avenc_%s: Failed to open FFMPEG codec",
+ oclass->in_plugin->name);
+ return FALSE;
+ }
+
+ /* some codecs support more than one format, first auto-choose one */
+ GST_DEBUG_OBJECT (ffmpegaudenc, "picking an output format ...");
+ allowed_caps = gst_pad_get_allowed_caps (GST_AUDIO_ENCODER_SRC_PAD (encoder));
+ if (!allowed_caps) {
+ GST_DEBUG_OBJECT (ffmpegaudenc, "... but no peer, using template caps");
+ /* we need to copy because get_allowed_caps returns a ref, and
+ * get_pad_template_caps doesn't */
+ allowed_caps =
+ gst_pad_get_pad_template_caps (GST_AUDIO_ENCODER_SRC_PAD (encoder));
+ }
+ GST_DEBUG_OBJECT (ffmpegaudenc, "chose caps %" GST_PTR_FORMAT, allowed_caps);
+ gst_ffmpeg_caps_with_codecid (oclass->in_plugin->id,
+ oclass->in_plugin->type, allowed_caps, ffmpegaudenc->context);
+
+ /* try to set this caps on the other side */
+ other_caps = gst_ffmpeg_codecid_to_caps (oclass->in_plugin->id,
+ ffmpegaudenc->context, TRUE);
+
+ if (!other_caps) {
+ gst_caps_unref (allowed_caps);
+ gst_ffmpeg_avcodec_close (ffmpegaudenc->context);
+ GST_DEBUG ("Unsupported codec - no caps found");
+ return FALSE;
+ }
+
+ icaps = gst_caps_intersect (allowed_caps, other_caps);
+ gst_caps_unref (allowed_caps);
+ gst_caps_unref (other_caps);
+ if (gst_caps_is_empty (icaps)) {
+ gst_caps_unref (icaps);
+ return FALSE;
+ }
+ icaps = gst_caps_truncate (icaps);
+
+ if (!gst_audio_encoder_set_output_format (GST_AUDIO_ENCODER (ffmpegaudenc),
+ icaps)) {
+ gst_ffmpeg_avcodec_close (ffmpegaudenc->context);
+ gst_caps_unref (icaps);
+ return FALSE;
+ }
+ gst_caps_unref (icaps);
+
+ frame_size = ffmpegaudenc->context->frame_size;
+ if (frame_size > 1) {
+ gst_audio_encoder_set_frame_samples_min (GST_AUDIO_ENCODER (ffmpegaudenc),
+ frame_size);
+ gst_audio_encoder_set_frame_samples_max (GST_AUDIO_ENCODER (ffmpegaudenc),
+ frame_size);
+ gst_audio_encoder_set_frame_max (GST_AUDIO_ENCODER (ffmpegaudenc), 1);
+ } else {
+ gst_audio_encoder_set_frame_samples_min (GST_AUDIO_ENCODER (ffmpegaudenc),
+ 0);
+ gst_audio_encoder_set_frame_samples_max (GST_AUDIO_ENCODER (ffmpegaudenc),
+ 0);
+ gst_audio_encoder_set_frame_max (GST_AUDIO_ENCODER (ffmpegaudenc), 0);
+ }
+
+ /* success! */
+ ffmpegaudenc->opened = TRUE;
+
+ return TRUE;
+}
+
+
+static GstFlowReturn
+gst_ffmpegaudenc_encode_audio (GstFFMpegAudEnc * ffmpegaudenc,
+ guint8 * audio_in, guint in_size, gint * have_data)
+{
+ GstAudioEncoder *enc;
+ AVCodecContext *ctx;
+ gint res;
+ GstFlowReturn ret;
+ GstAudioInfo *info;
+ AVPacket pkt;
+ AVFrame frame;
+ gboolean planar;
+
+ enc = GST_AUDIO_ENCODER (ffmpegaudenc);
+
+ ctx = ffmpegaudenc->context;
+
+ GST_LOG_OBJECT (ffmpegaudenc, "encoding buffer ");
+
+ memset (&pkt, 0, sizeof (pkt));
+ memset (&frame, 0, sizeof (frame));
+ avcodec_get_frame_defaults (&frame);
+
+ info = gst_audio_encoder_get_audio_info (enc);
+ planar = av_sample_fmt_is_planar (ffmpegaudenc->context->sample_fmt);
+
+ if (planar && info->channels > 1) {
+ gint channels, nsamples;
+ gint i, j;
+
+ nsamples = frame.nb_samples = in_size / info->bpf;
+ channels = info->channels;
+
+ if (info->channels > AV_NUM_DATA_POINTERS) {
+ frame.extended_data = g_new (uint8_t *, info->channels);
+ } else {
+ frame.extended_data = frame.data;
+ }
+
+ frame.extended_data[0] = g_malloc (in_size);
+ frame.linesize[0] = in_size / channels;
+ for (i = 1; i < channels; i++)
+ frame.extended_data[i] = frame.extended_data[i - 1] + frame.linesize[0];
+
+ switch (info->finfo->width) {
+ case 8:{
+ const guint8 *idata = (const guint8 *) audio_in;
+
+ for (i = 0; i < nsamples; i++) {
+ for (j = 0; j < channels; j++) {
+ ((guint8 *) frame.extended_data[j])[i] = idata[j];
+ }
+ idata += channels;
+ }
+ break;
+ }
+ case 16:{
+ const guint16 *idata = (const guint16 *) audio_in;
+
+ for (i = 0; i < nsamples; i++) {
+ for (j = 0; j < channels; j++) {
+ ((guint16 *) frame.extended_data[j])[i] = idata[j];
+ }
+ idata += channels;
+ }
+ break;
+ }
+ case 32:{
+ const guint32 *idata = (const guint32 *) audio_in;
+
+ for (i = 0; i < nsamples; i++) {
+ for (j = 0; j < channels; j++) {
+ ((guint32 *) frame.extended_data[j])[i] = idata[j];
+ }
+ idata += channels;
+ }
+
+ break;
+ }
+ case 64:{
+ const guint64 *idata = (const guint64 *) audio_in;
+
+ for (i = 0; i < nsamples; i++) {
+ for (j = 0; j < channels; j++) {
+ ((guint64 *) frame.extended_data[j])[i] = idata[j];
+ }
+ idata += channels;
+ }
+
+ break;
+ }
+ default:
+ g_assert_not_reached ();
+ break;
+ }
+
+ } else {
+ frame.data[0] = audio_in;
+ frame.extended_data = frame.data;
+ frame.linesize[0] = in_size;
+ frame.nb_samples = in_size / info->bpf;
+ }
+
+ res = avcodec_encode_audio2 (ctx, &pkt, &frame, have_data);
+ if (planar && info->channels > 1)
+ g_free (frame.data[0]);
+ if (frame.extended_data != frame.data)
+ g_free (frame.extended_data);
+
+ if (res < 0) {
+ char error_str[128] = { 0, };
+
+ av_strerror (res, error_str, sizeof (error_str));
+ GST_ERROR_OBJECT (enc, "Failed to encode buffer: %d - %s", res, error_str);
+ return GST_FLOW_OK;
+ }
+ GST_LOG_OBJECT (ffmpegaudenc, "got output size %d", res);
+
+ if (*have_data) {
+ GstBuffer *outbuf;
+ const AVCodec *codec;
+
+ GST_LOG_OBJECT (ffmpegaudenc, "pushing size %d", pkt.size);
+
+ outbuf =
+ gst_buffer_new_wrapped_full (0, pkt.data, pkt.size, 0, pkt.size,
+ pkt.data, av_free);
+
+ codec = ffmpegaudenc->context->codec;
+ if ((codec->capabilities & CODEC_CAP_VARIABLE_FRAME_SIZE)) {
+ ret = gst_audio_encoder_finish_frame (enc, outbuf, -1);
+ } else {
+ ret = gst_audio_encoder_finish_frame (enc, outbuf, frame.nb_samples);
+ }
+ } else {
+ GST_LOG_OBJECT (ffmpegaudenc, "no output produced");
+ ret = GST_FLOW_OK;
+ }
+
+ return ret;
+}
+
+static void
+gst_ffmpegaudenc_drain (GstFFMpegAudEnc * ffmpegaudenc)
+{
+ GstFFMpegAudEncClass *oclass;
+
+ oclass = (GstFFMpegAudEncClass *) (G_OBJECT_GET_CLASS (ffmpegaudenc));
+
+ if (oclass->in_plugin->capabilities & CODEC_CAP_DELAY) {
+ gint have_data, try = 0;
+
+ GST_LOG_OBJECT (ffmpegaudenc,
+ "codec has delay capabilities, calling until libav has drained everything");
+
+ do {
+ GstFlowReturn ret;
+
+ ret = gst_ffmpegaudenc_encode_audio (ffmpegaudenc, NULL, 0, &have_data);
+ if (ret != GST_FLOW_OK || have_data == 0)
+ break;
+ } while (try++ < 10);
+ }
+}
+
+static GstFlowReturn
+gst_ffmpegaudenc_handle_frame (GstAudioEncoder * encoder, GstBuffer * inbuf)
+{
+ GstFFMpegAudEnc *ffmpegaudenc;
+ gsize size;
+ GstFlowReturn ret;
+ guint8 *in_data;
+ GstMapInfo map;
+ gint have_data;
+
+ ffmpegaudenc = (GstFFMpegAudEnc *) encoder;
+
+ if (G_UNLIKELY (!ffmpegaudenc->opened))
+ goto not_negotiated;
+
+ if (!inbuf) {
+ gst_ffmpegaudenc_drain (ffmpegaudenc);
+ return GST_FLOW_OK;
+ }
+
+ inbuf = gst_buffer_ref (inbuf);
+
+ GST_DEBUG_OBJECT (ffmpegaudenc,
+ "Received time %" GST_TIME_FORMAT ", duration %" GST_TIME_FORMAT
+ ", size %" G_GSIZE_FORMAT, GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (inbuf)),
+ GST_TIME_ARGS (GST_BUFFER_DURATION (inbuf)), gst_buffer_get_size (inbuf));
+
+ /* Reorder channels to the GStreamer channel order */
+ if (ffmpegaudenc->needs_reorder) {
+ GstAudioInfo *info = gst_audio_encoder_get_audio_info (encoder);
+
+ inbuf = gst_buffer_make_writable (inbuf);
+ gst_audio_buffer_reorder_channels (inbuf, info->finfo->format,
+ info->channels, info->position, ffmpegaudenc->ffmpeg_layout);
+ }
+
+ gst_buffer_map (inbuf, &map, GST_MAP_READ);
+ in_data = map.data;
+ size = map.size;
+ ret = gst_ffmpegaudenc_encode_audio (ffmpegaudenc, in_data, size, &have_data);
+ gst_buffer_unmap (inbuf, &map);
+ gst_buffer_unref (inbuf);
+
+ if (ret != GST_FLOW_OK)
+ goto push_failed;
+
+ return GST_FLOW_OK;
+
+ /* ERRORS */
+not_negotiated:
+ {
+ GST_ELEMENT_ERROR (ffmpegaudenc, CORE, NEGOTIATION, (NULL),
+ ("not configured to input format before data start"));
+ gst_buffer_unref (inbuf);
+ return GST_FLOW_NOT_NEGOTIATED;
+ }
+push_failed:
+ {
+ GST_DEBUG_OBJECT (ffmpegaudenc, "Failed to push buffer %d (%s)", ret,
+ gst_flow_get_name (ret));
+ return ret;
+ }
+}
+
+static void
+gst_ffmpegaudenc_set_property (GObject * object,
+ guint prop_id, const GValue * value, GParamSpec * pspec)
+{
+ GstFFMpegAudEnc *ffmpegaudenc;
+
+ /* Get a pointer of the right type. */
+ ffmpegaudenc = (GstFFMpegAudEnc *) (object);
+
+ if (ffmpegaudenc->opened) {
+ GST_WARNING_OBJECT (ffmpegaudenc,
+ "Can't change properties once decoder is setup !");
+ return;
+ }
+
+ /* Check the argument id to see which argument we're setting. */
+ switch (prop_id) {
+ case PROP_BIT_RATE:
+ ffmpegaudenc->bitrate = g_value_get_int (value);
+ break;
+ case PROP_RTP_PAYLOAD_SIZE:
+ ffmpegaudenc->rtp_payload_size = g_value_get_int (value);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+/* The set function is simply the inverse of the get fuction. */
+static void
+gst_ffmpegaudenc_get_property (GObject * object,
+ guint prop_id, GValue * value, GParamSpec * pspec)
+{
+ GstFFMpegAudEnc *ffmpegaudenc;
+
+ /* It's not null if we got it, but it might not be ours */
+ ffmpegaudenc = (GstFFMpegAudEnc *) (object);
+
+ switch (prop_id) {
+ case PROP_BIT_RATE:
+ g_value_set_int (value, ffmpegaudenc->bitrate);
+ break;
+ break;
+ case PROP_RTP_PAYLOAD_SIZE:
+ g_value_set_int (value, ffmpegaudenc->rtp_payload_size);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+gboolean
+gst_ffmpegaudenc_register (GstPlugin * plugin)
+{
+ GTypeInfo typeinfo = {
+ sizeof (GstFFMpegAudEncClass),
+ (GBaseInitFunc) gst_ffmpegaudenc_base_init,
+ NULL,
+ (GClassInitFunc) gst_ffmpegaudenc_class_init,
+ NULL,
+ NULL,
+ sizeof (GstFFMpegAudEnc),
+ 0,
+ (GInstanceInitFunc) gst_ffmpegaudenc_init,
+ };
+ GType type;
+ AVCodec *in_plugin;
+
+
+ GST_LOG ("Registering encoders");
+
+ in_plugin = av_codec_next (NULL);
+ while (in_plugin) {
+ gchar *type_name;
+ guint rank;
+
+ /* Skip non-AV codecs */
+ if (in_plugin->type != AVMEDIA_TYPE_AUDIO)
+ goto next;
+
+ /* no quasi codecs, please */
+ if ((in_plugin->id >= AV_CODEC_ID_PCM_S16LE &&
+ in_plugin->id <= AV_CODEC_ID_PCM_BLURAY)) {
+ goto next;
+ }
+
+ /* No encoders depending on external libraries (we don't build them, but
+ * people who build against an external ffmpeg might have them.
+ * We have native gstreamer plugins for all of those libraries anyway. */
+ if (!strncmp (in_plugin->name, "lib", 3)) {
+ GST_DEBUG
+ ("Not using external library encoder %s. Use the gstreamer-native ones instead.",
+ in_plugin->name);
+ goto next;
+ }
+
+ /* only encoders */
+ if (!av_codec_is_encoder (in_plugin)) {
+ goto next;
+ }
+
+ /* FIXME : We should have a method to know cheaply whether we have a mapping
+ * for the given plugin or not */
+
+ GST_DEBUG ("Trying plugin %s [%s]", in_plugin->name, in_plugin->long_name);
+
+ /* no codecs for which we're GUARANTEED to have better alternatives */
+ if (!strcmp (in_plugin->name, "vorbis")
+ || !strcmp (in_plugin->name, "flac")) {
+ GST_LOG ("Ignoring encoder %s", in_plugin->name);
+ goto next;
+ }
+
+ /* construct the type */
+ type_name = g_strdup_printf ("avenc_%s", in_plugin->name);
+
+ type = g_type_from_name (type_name);
+
+ if (!type) {
+
+ /* create the glib type now */
+ type =
+ g_type_register_static (GST_TYPE_AUDIO_ENCODER, type_name, &typeinfo,
+ 0);
+ g_type_set_qdata (type, GST_FFENC_PARAMS_QDATA, (gpointer) in_plugin);
+
+ {
+ static const GInterfaceInfo preset_info = {
+ NULL,
+ NULL,
+ NULL
+ };
+ g_type_add_interface_static (type, GST_TYPE_PRESET, &preset_info);
+ }
+ }
+
+ switch (in_plugin->id) {
+ /* avenc_aac: see https://bugzilla.gnome.org/show_bug.cgi?id=691617 */
+ case AV_CODEC_ID_AAC:
+ rank = GST_RANK_NONE;
+ break;
+ default:
+ rank = GST_RANK_SECONDARY;
+ break;
+ }
+
+ if (!gst_element_register (plugin, type_name, rank, type)) {
+ g_free (type_name);
+ return FALSE;
+ }
+
+ g_free (type_name);
+
+ next:
+ in_plugin = av_codec_next (in_plugin);
+ }
+
+ GST_LOG ("Finished registering encoders");
+
+ return TRUE;
+}
diff --git a/ext/libav/gstavaudenc.h b/ext/libav/gstavaudenc.h
new file mode 100644
index 0000000..b01184f
--- /dev/null
+++ b/ext/libav/gstavaudenc.h
@@ -0,0 +1,77 @@
+/* GStreamer
+ * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+/* First, include the header file for the plugin, to bring in the
+ * object definition and other useful things.
+ */
+
+#ifndef __GST_FFMPEGAUDENC_H__
+#define __GST_FFMPEGAUDENC_H__
+
+G_BEGIN_DECLS
+
+#include <gst/gst.h>
+#include <gst/audio/gstaudioencoder.h>
+#include <libavcodec/avcodec.h>
+
+typedef struct _GstFFMpegAudEnc GstFFMpegAudEnc;
+
+struct _GstFFMpegAudEnc
+{
+ GstAudioEncoder parent;
+
+ AVCodecContext *context;
+ gboolean opened;
+
+ /* cache */
+ gint bitrate;
+ gint rtp_payload_size;
+
+ /* other settings are copied over straight,
+ * include a context here, rather than copy-and-past it from avcodec.h */
+ AVCodecContext config;
+
+ GstAudioChannelPosition ffmpeg_layout[64];
+ gboolean needs_reorder;
+};
+
+typedef struct _GstFFMpegAudEncClass GstFFMpegAudEncClass;
+
+struct _GstFFMpegAudEncClass
+{
+ GstAudioEncoderClass parent_class;
+
+ AVCodec *in_plugin;
+ GstPadTemplate *srctempl, *sinktempl;
+};
+
+#define GST_TYPE_FFMPEGAUDENC \
+ (gst_ffmpegaudenc_get_type())
+#define GST_FFMPEGAUDENC(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_FFMPEGAUDENC,GstFFMpegAudEnc))
+#define GST_FFMPEGAUDENC_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_FFMPEGAUDENC,GstFFMpegAudEncClass))
+#define GST_IS_FFMPEGAUDENC(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_FFMPEGAUDENC))
+#define GST_IS_FFMPEGAUDENC_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_FFMPEGAUDENC))
+
+G_END_DECLS
+
+#endif /* __GST_FFMPEGAUDENC_H__ */
diff --git a/ext/libav/gstavcfg.c b/ext/libav/gstavcfg.c
index 5ee23dd..8c368ad 100644
--- a/ext/libav/gstavcfg.c
+++ b/ext/libav/gstavcfg.c
@@ -16,8 +16,8 @@
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
*/
@@ -147,7 +147,6 @@ gst_ffmpeg_dct_algo_get_type (void)
{FF_DCT_FASTINT, "Fast Integer", "fastint"},
{FF_DCT_INT, "Accurate Integer", "int"},
{FF_DCT_MMX, "MMX", "mmx"},
- {FF_DCT_MLIB, "MLIB", "mlib"},
{FF_DCT_ALTIVEC, "ALTIVEC", "altivec"},
{FF_DCT_FAAN, "FAAN", "faan"},
{0, NULL, NULL},
@@ -173,8 +172,6 @@ gst_ffmpeg_idct_algo_get_type (void)
{FF_IDCT_SIMPLE, "Simple", "simple"},
{FF_IDCT_SIMPLEMMX, "Simple MMX", "simplemmx"},
{FF_IDCT_LIBMPEG2MMX, "LIBMPEG2MMX", "libmpeg2mmx"},
- {FF_IDCT_PS2, "PS2", "ps2"},
- {FF_IDCT_MLIB, "MLIB", "mlib"},
{FF_IDCT_ARM, "ARM", "arm"},
{FF_IDCT_ALTIVEC, "ALTIVEC", "altivec"},
{FF_IDCT_SH4, "SH4", "sh4"},
@@ -263,16 +260,11 @@ gst_ffmpeg_flags_get_type (void)
if (!ffmpeg_flags_type) {
static const GFlagsValue ffmpeg_flags[] = {
- {CODEC_FLAG_OBMC, "Use overlapped block motion compensation (h263+)",
- "obmc"},
{CODEC_FLAG_QSCALE, "Use fixed qscale", "qscale"},
{CODEC_FLAG_4MV, "Allow 4 MV per MB", "4mv"},
- {CODEC_FLAG_H263P_AIV, "H.263 alternative inter VLC", "aiv"},
{CODEC_FLAG_QPEL, "Quartel Pel Motion Compensation", "qpel"},
{CODEC_FLAG_GMC, "GMC", "gmc"},
{CODEC_FLAG_MV0, "Always try a MB with MV (0,0)", "mv0"},
- {CODEC_FLAG_PART,
- "Store MV, DC and AC coefficients in seperate partitions", "part"},
{CODEC_FLAG_LOOP_FILTER, "Loop filter", "loop-filter"},
{CODEC_FLAG_GRAY, "Only decode/encode grayscale", "gray"},
{CODEC_FLAG_NORMALIZE_AQP,
@@ -282,13 +274,9 @@ gst_ffmpeg_flags_get_type (void)
"global-headers"},
{CODEC_FLAG_AC_PRED, "H263 Advanced Intra Coding / MPEG4 AC prediction",
"aic"},
- {CODEC_FLAG_H263P_UMV, "Unlimited Motion Vector", "umv"},
{CODEC_FLAG_CBP_RD, "Rate Distoration Optimization for CBP", "cbp-rd"},
{CODEC_FLAG_QP_RD, "Rate Distoration Optimization for QP selection",
"qp-rd"},
- {CODEC_FLAG_H263P_SLICE_STRUCT, "H263 slice struct", "ss"},
- {CODEC_FLAG_SVCD_SCAN_OFFSET,
- "Reserve space for SVCD scan offset user data", "scanoffset"},
{CODEC_FLAG_CLOSED_GOP, "Closed GOP", "closedgop"},
{0, NULL, NULL},
};
@@ -314,7 +302,7 @@ struct _GParamSpecData
/* if TRUE, try to get the default from lavc and ignore the paramspec default */
gboolean lavc_default;
- /* these lists are arrays terminated by CODEC_ID_NONE entry:
+ /* these lists are arrays terminated by AV_CODEC_ID_NONE entry:
* property applies to a codec if it's not in the exclude_list
* and in exclude_list (or the latter is NULL) */
gint *include_list;
@@ -358,22 +346,22 @@ G_STMT_START { \
/* some typical include and exclude lists; modify and/or add where needed */
static gint mpeg[] = {
- CODEC_ID_MPEG4,
- CODEC_ID_MSMPEG4V1,
- CODEC_ID_MSMPEG4V2,
- CODEC_ID_MSMPEG4V3,
- CODEC_ID_MPEG1VIDEO,
- CODEC_ID_MPEG2VIDEO,
- CODEC_ID_H263P,
- CODEC_ID_FLV1,
- CODEC_ID_H263,
- CODEC_ID_NONE
+ AV_CODEC_ID_MPEG4,
+ AV_CODEC_ID_MSMPEG4V1,
+ AV_CODEC_ID_MSMPEG4V2,
+ AV_CODEC_ID_MSMPEG4V3,
+ AV_CODEC_ID_MPEG1VIDEO,
+ AV_CODEC_ID_MPEG2VIDEO,
+ AV_CODEC_ID_H263P,
+ AV_CODEC_ID_FLV1,
+ AV_CODEC_ID_H263,
+ AV_CODEC_ID_NONE
};
static gint huffyuv[] = {
- CODEC_ID_HUFFYUV,
- CODEC_ID_FFVHUFF,
- CODEC_ID_NONE
+ AV_CODEC_ID_HUFFYUV,
+ AV_CODEC_ID_FFVHUFF,
+ AV_CODEC_ID_NONE
};
/* Properties should be added here for registration into the config store.
@@ -719,7 +707,7 @@ gst_ffmpeg_cfg_codec_has_pspec (enum CodecID codec_id, GParamSpec * pspec)
/* check if excluded first */
if ((codec = qdata->exclude_list)) {
- for (; *codec != CODEC_ID_NONE; ++codec) {
+ for (; *codec != AV_CODEC_ID_NONE; ++codec) {
if (*codec == codec_id)
return FALSE;
}
@@ -727,7 +715,7 @@ gst_ffmpeg_cfg_codec_has_pspec (enum CodecID codec_id, GParamSpec * pspec)
/* no include list means it is accepted */
if ((codec = qdata->include_list)) {
- for (; *codec != CODEC_ID_NONE; ++codec) {
+ for (; *codec != AV_CODEC_ID_NONE; ++codec) {
if (*codec == codec_id)
ret = TRUE;
}
@@ -750,10 +738,8 @@ gst_ffmpeg_cfg_install_property (GstFFMpegVidEncClass * klass, guint base)
prop_id = base;
g_return_if_fail (base > 0);
- ctx = avcodec_alloc_context ();
- if (ctx)
- avcodec_get_context_defaults (ctx);
- else
+ ctx = avcodec_alloc_context3 (klass->in_plugin);
+ if (!ctx)
g_warning ("could not get context");
for (list = property_list; list; list = list->next) {
diff --git a/ext/libav/gstavcfg.h b/ext/libav/gstavcfg.h
index 5251eb2..2aef665 100644
--- a/ext/libav/gstavcfg.h
+++ b/ext/libav/gstavcfg.h
@@ -13,8 +13,8 @@
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
*/
diff --git a/ext/libav/gstavcodecmap.c b/ext/libav/gstavcodecmap.c
index 7b28800..966f544 100644
--- a/ext/libav/gstavcodecmap.c
+++ b/ext/libav/gstavcodecmap.c
@@ -15,8 +15,8 @@
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
*/
#ifdef HAVE_CONFIG_H
@@ -27,6 +27,7 @@
#include <gst/gst.h>
#include <libavcodec/avcodec.h>
+#include <libavutil/channel_layout.h>
#include "gstav.h"
#include "gstavcodecmap.h"
@@ -35,44 +36,6 @@
#include <gst/audio/audio.h>
#include <gst/pbutils/codec-utils.h>
-/*
- * Read a palette from a caps.
- */
-
-static void
-gst_ffmpeg_get_palette (const GstCaps * caps, AVCodecContext * context)
-{
- GstStructure *str = gst_caps_get_structure (caps, 0);
- const GValue *palette_v;
- GstBuffer *palette;
-
- /* do we have a palette? */
- if ((palette_v = gst_structure_get_value (str, "palette_data")) && context) {
- palette = gst_value_get_buffer (palette_v);
- GST_DEBUG ("got palette data %p", palette);
- if (gst_buffer_get_size (palette) >= AVPALETTE_SIZE) {
- if (context->palctrl)
- av_free (context->palctrl);
- context->palctrl = av_malloc (sizeof (AVPaletteControl));
- context->palctrl->palette_changed = 1;
- gst_buffer_extract (palette, 0, context->palctrl->palette,
- AVPALETTE_SIZE);
- GST_DEBUG ("extracted palette data");
- }
- }
-}
-
-static void
-gst_ffmpeg_set_palette (GstCaps * caps, AVCodecContext * context)
-{
- if (context->palctrl) {
- GstBuffer *palette = gst_buffer_new_and_alloc (AVPALETTE_SIZE);
-
- gst_buffer_fill (palette, 0, context->palctrl->palette, AVPALETTE_SIZE);
- gst_caps_set_simple (caps, "palette_data", GST_TYPE_BUFFER, palette, NULL);
- }
-}
-
/* IMPORTANT: Keep this sorted by the ffmpeg channel masks */
static const struct
{
@@ -80,34 +43,60 @@ static const struct
GstAudioChannelPosition gst;
} _ff_to_gst_layout[] = {
{
- CH_FRONT_LEFT, GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT}, {
- CH_FRONT_RIGHT, GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT}, {
- CH_FRONT_CENTER, GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER}, {
- CH_LOW_FREQUENCY, GST_AUDIO_CHANNEL_POSITION_LFE1}, {
- CH_BACK_LEFT, GST_AUDIO_CHANNEL_POSITION_REAR_LEFT}, {
- CH_BACK_RIGHT, GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT}, {
- CH_FRONT_LEFT_OF_CENTER, GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT_OF_CENTER}, {
- CH_FRONT_RIGHT_OF_CENTER, GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT_OF_CENTER}, {
- CH_BACK_CENTER, GST_AUDIO_CHANNEL_POSITION_REAR_CENTER}, {
- CH_SIDE_LEFT, GST_AUDIO_CHANNEL_POSITION_SIDE_LEFT}, {
- CH_SIDE_RIGHT, GST_AUDIO_CHANNEL_POSITION_SIDE_RIGHT}, {
- CH_TOP_CENTER, GST_AUDIO_CHANNEL_POSITION_TOP_CENTER}, {
- CH_TOP_FRONT_LEFT, GST_AUDIO_CHANNEL_POSITION_TOP_FRONT_LEFT}, {
- CH_TOP_FRONT_CENTER, GST_AUDIO_CHANNEL_POSITION_TOP_FRONT_CENTER}, {
- CH_TOP_FRONT_RIGHT, GST_AUDIO_CHANNEL_POSITION_TOP_FRONT_RIGHT}, {
- CH_TOP_BACK_LEFT, GST_AUDIO_CHANNEL_POSITION_TOP_REAR_LEFT}, {
- CH_TOP_BACK_CENTER, GST_AUDIO_CHANNEL_POSITION_TOP_REAR_CENTER}, {
- CH_TOP_BACK_RIGHT, GST_AUDIO_CHANNEL_POSITION_TOP_REAR_RIGHT}, {
- CH_STEREO_LEFT, GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT}, {
- CH_STEREO_RIGHT, GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT}
+ AV_CH_FRONT_LEFT, GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT}, {
+ AV_CH_FRONT_RIGHT, GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT}, {
+ AV_CH_FRONT_CENTER, GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER}, {
+ AV_CH_LOW_FREQUENCY, GST_AUDIO_CHANNEL_POSITION_LFE1}, {
+ AV_CH_BACK_LEFT, GST_AUDIO_CHANNEL_POSITION_REAR_LEFT}, {
+ AV_CH_BACK_RIGHT, GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT}, {
+ AV_CH_FRONT_LEFT_OF_CENTER, GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT_OF_CENTER}, {
+ AV_CH_FRONT_RIGHT_OF_CENTER,
+ GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT_OF_CENTER}, {
+ AV_CH_BACK_CENTER, GST_AUDIO_CHANNEL_POSITION_REAR_CENTER}, {
+ AV_CH_SIDE_LEFT, GST_AUDIO_CHANNEL_POSITION_SIDE_LEFT}, {
+ AV_CH_SIDE_RIGHT, GST_AUDIO_CHANNEL_POSITION_SIDE_RIGHT}, {
+ AV_CH_TOP_CENTER, GST_AUDIO_CHANNEL_POSITION_TOP_CENTER}, {
+ AV_CH_TOP_FRONT_LEFT, GST_AUDIO_CHANNEL_POSITION_TOP_FRONT_LEFT}, {
+ AV_CH_TOP_FRONT_CENTER, GST_AUDIO_CHANNEL_POSITION_TOP_FRONT_CENTER}, {
+ AV_CH_TOP_FRONT_RIGHT, GST_AUDIO_CHANNEL_POSITION_TOP_FRONT_RIGHT}, {
+ AV_CH_TOP_BACK_LEFT, GST_AUDIO_CHANNEL_POSITION_TOP_REAR_LEFT}, {
+ AV_CH_TOP_BACK_CENTER, GST_AUDIO_CHANNEL_POSITION_TOP_REAR_CENTER}, {
+ AV_CH_TOP_BACK_RIGHT, GST_AUDIO_CHANNEL_POSITION_TOP_REAR_RIGHT}, {
+ AV_CH_STEREO_LEFT, GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT}, {
+ AV_CH_STEREO_RIGHT, GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT}
};
+static guint64
+gst_ffmpeg_channel_positions_to_layout (GstAudioChannelPosition * pos,
+ gint channels)
+{
+ gint i, j;
+ guint64 ret = 0;
+ gint channels_found = 0;
+
+ if (!pos)
+ return 0;
+
+ for (i = 0; i < channels; i++) {
+ for (j = 0; j < G_N_ELEMENTS (_ff_to_gst_layout); j++) {
+ if (_ff_to_gst_layout[j].gst == pos[i]) {
+ ret |= _ff_to_gst_layout[j].ff;
+ channels_found++;
+ break;
+ }
+ }
+ }
+
+ if (channels_found != channels)
+ return 0;
+ return ret;
+}
+
gboolean
-gst_ffmpeg_channel_layout_to_gst (AVCodecContext * context,
+gst_ffmpeg_channel_layout_to_gst (guint64 channel_layout, gint channels,
GstAudioChannelPosition * pos)
{
- guint nchannels = 0, channels = context->channels;
- guint64 channel_layout = context->channel_layout;
+ guint nchannels = 0;
gboolean none_layout = FALSE;
if (channel_layout == 0) {
@@ -170,6 +159,52 @@ gst_ffmpeg_channel_layout_to_gst (AVCodecContext * context,
return TRUE;
}
+static void
+gst_ffmpeg_video_set_pix_fmts (GstCaps * caps, const enum AVPixelFormat *fmts)
+{
+ GValue va = { 0, };
+ GValue v = { 0, };
+ GstVideoFormat format;
+
+ if (!fmts || fmts[0] == -1) {
+ gint i;
+
+ g_value_init (&va, GST_TYPE_LIST);
+ g_value_init (&v, G_TYPE_STRING);
+ for (i = 0; i <= PIX_FMT_NB; i++) {
+ format = gst_ffmpeg_pixfmt_to_videoformat (i);
+ if (format == GST_VIDEO_FORMAT_UNKNOWN)
+ continue;
+ g_value_set_string (&v, gst_video_format_to_string (format));
+ gst_value_list_append_value (&va, &v);
+ }
+ gst_caps_set_value (caps, "format", &va);
+ g_value_unset (&v);
+ g_value_unset (&va);
+ return;
+ }
+
+ /* Only a single format */
+ g_value_init (&va, GST_TYPE_LIST);
+ g_value_init (&v, G_TYPE_STRING);
+ while (*fmts != -1) {
+ format = gst_ffmpeg_pixfmt_to_videoformat (*fmts);
+ if (format != GST_VIDEO_FORMAT_UNKNOWN) {
+ g_value_set_string (&v, gst_video_format_to_string (format));
+ gst_value_list_append_value (&va, &v);
+ }
+ fmts++;
+ }
+ if (gst_value_list_get_size (&va) == 1) {
+ /* The single value is still in v */
+ gst_caps_set_value (caps, "format", &v);
+ } else if (gst_value_list_get_size (&va) > 1) {
+ gst_caps_set_value (caps, "format", &va);
+ }
+ g_value_unset (&v);
+ g_value_unset (&va);
+}
+
/* this macro makes a caps width fixed or unfixed width/height
* properties depending on whether we've got a context.
*
@@ -179,10 +214,10 @@ gst_ffmpeg_channel_layout_to_gst (AVCodecContext * context,
* but I'm too lazy today. Maybe later.
*/
static GstCaps *
-gst_ff_vid_caps_new (AVCodecContext * context, enum CodecID codec_id,
- gboolean encode, const char *mimetype, const char *fieldname, ...)
+gst_ff_vid_caps_new (AVCodecContext * context, AVCodec * codec,
+ enum CodecID codec_id, gboolean encode, const char *mimetype,
+ const char *fieldname, ...)
{
- GstStructure *structure = NULL;
GstCaps *caps = NULL;
va_list var_args;
gint i;
@@ -215,7 +250,7 @@ gst_ff_vid_caps_new (AVCodecContext * context, enum CodecID codec_id,
} else if (encode) {
/* so we are after restricted caps in this case */
switch (codec_id) {
- case CODEC_ID_H261:
+ case AV_CODEC_ID_H261:
{
caps = gst_caps_new_simple (mimetype,
"width", G_TYPE_INT, 352,
@@ -227,7 +262,7 @@ gst_ff_vid_caps_new (AVCodecContext * context, enum CodecID codec_id,
"framerate", GST_TYPE_FRACTION_RANGE, 0, 1, G_MAXINT, 1, NULL));
break;
}
- case CODEC_ID_H263:
+ case AV_CODEC_ID_H263:
{
/* 128x96, 176x144, 352x288, 704x576, and 1408x1152. slightly reordered
* because we want automatic negotiation to go as close to 320x240 as
@@ -248,40 +283,66 @@ gst_ff_vid_caps_new (AVCodecContext * context, enum CodecID codec_id,
}
break;
}
- case CODEC_ID_DVVIDEO:
+ case AV_CODEC_ID_DVVIDEO:
{
static struct
{
- guint32 csp;
+ const gchar *csp;
gint width, height;
gint par_n, par_d;
gint framerate_n, framerate_d;
} profiles[] = {
{
- GST_MAKE_FOURCC ('Y', '4', '1', 'B'), 720, 480, 10, 11, 30000, 1001}, {
- GST_MAKE_FOURCC ('Y', '4', '1', 'B'), 720, 480, 40, 33, 30000, 1001}, {
- GST_MAKE_FOURCC ('I', '4', '2', '0'), 720, 576, 59, 54, 25, 1}, {
- GST_MAKE_FOURCC ('I', '4', '2', '0'), 720, 576, 118, 81, 25, 1}, {
- GST_MAKE_FOURCC ('Y', '4', '1', 'B'), 720, 576, 59, 54, 25, 1}, {
- GST_MAKE_FOURCC ('Y', '4', '1', 'B'), 720, 576, 118, 81, 25, 1}
- };
+ "Y41B", 720, 480, 8, 9, 30000, 1001}, {
+ "Y41B", 720, 480, 32, 27, 30000, 1001}, {
+ "Y42B", 720, 480, 8, 9, 30000, 1001}, {
+ "Y42B", 720, 480, 32, 27, 30000, 1001}, {
+ "I420", 720, 576, 16, 15, 25, 1}, {
+ "I420", 720, 576, 64, 45, 25, 1}, {
+ "Y41B", 720, 576, 16, 15, 25, 1}, {
+ "Y41B", 720, 576, 64, 45, 25, 1}, {
+ "Y42B", 720, 576, 16, 15, 25, 1}, {
+ "Y42B", 720, 576, 64, 45, 25, 1}, {
+ "Y42B", 1280, 1080, 1, 1, 30000, 1001}, {
+ "Y42B", 1280, 1080, 3, 2, 30000, 1001}, {
+ "Y42B", 1440, 1080, 1, 1, 25, 1}, {
+ "Y42B", 1440, 1080, 4, 3, 25, 1}, {
+ "Y42B", 960, 720, 1, 1, 60000, 1001}, {
+ "Y42B", 960, 720, 4, 3, 60000, 1001}, {
+ "Y42B", 960, 720, 1, 1, 50, 1}, {
+ "Y42B", 960, 720, 4, 3, 50, 1},};
GstCaps *temp;
gint n_sizes = G_N_ELEMENTS (profiles);
- caps = gst_caps_new_empty ();
- for (i = 0; i < n_sizes; i++) {
- temp = gst_caps_new_simple (mimetype,
- "width", G_TYPE_INT, profiles[i].width,
- "height", G_TYPE_INT, profiles[i].height,
- "framerate", GST_TYPE_FRACTION, profiles[i].framerate_n,
- profiles[i].framerate_d, "pixel-aspect-ratio", GST_TYPE_FRACTION,
- profiles[i].par_n, profiles[i].par_d, NULL);
-
- gst_caps_append (caps, temp);
+ if (strcmp (mimetype, "video/x-raw") == 0) {
+ caps = gst_caps_new_empty ();
+ for (i = 0; i < n_sizes; i++) {
+ temp = gst_caps_new_simple (mimetype,
+ "format", G_TYPE_STRING, profiles[i].csp,
+ "width", G_TYPE_INT, profiles[i].width,
+ "height", G_TYPE_INT, profiles[i].height,
+ "framerate", GST_TYPE_FRACTION, profiles[i].framerate_n,
+ profiles[i].framerate_d, "pixel-aspect-ratio",
+ GST_TYPE_FRACTION, profiles[i].par_n, profiles[i].par_d, NULL);
+
+ gst_caps_append (caps, temp);
+ }
+ } else {
+ caps = gst_caps_new_empty ();
+ for (i = 0; i < n_sizes; i++) {
+ temp = gst_caps_new_simple (mimetype,
+ "width", G_TYPE_INT, profiles[i].width,
+ "height", G_TYPE_INT, profiles[i].height,
+ "framerate", GST_TYPE_FRACTION, profiles[i].framerate_n,
+ profiles[i].framerate_d, "pixel-aspect-ratio",
+ GST_TYPE_FRACTION, profiles[i].par_n, profiles[i].par_d, NULL);
+
+ gst_caps_append (caps, temp);
+ }
}
break;
}
- case CODEC_ID_DNXHD:
+ case AV_CODEC_ID_DNXHD:
{
caps = gst_caps_new_simple (mimetype,
"width", G_TYPE_INT, 1920,
@@ -294,7 +355,40 @@ gst_ff_vid_caps_new (AVCodecContext * context, enum CodecID codec_id,
break;
}
default:
+ {
+ if (codec && codec->supported_framerates
+ && codec->supported_framerates[0].num != 0
+ && codec->supported_framerates[0].den != 0) {
+ GValue va = { 0, };
+ GValue v = { 0, };
+ const AVRational *rates = codec->supported_framerates;
+
+ if (rates[1].num == 0 && rates[1].den == 0) {
+ caps =
+ gst_caps_new_simple (mimetype, "framerate", GST_TYPE_FRACTION,
+ rates[0].num, rates[0].den, NULL);
+ } else {
+ g_value_init (&va, GST_TYPE_LIST);
+ g_value_init (&v, GST_TYPE_FRACTION);
+
+ while (rates->num != 0 && rates->den != 0) {
+ gst_value_set_fraction (&v, rates->num, rates->den);
+ gst_value_list_append_value (&va, &v);
+ rates++;
+ }
+
+ caps = gst_caps_new_simple (mimetype, NULL, NULL, NULL);
+ gst_caps_set_value (caps, "framerate", &va);
+ g_value_unset (&va);
+ g_value_unset (&v);
+ }
+
+ } else {
+ caps = gst_caps_new_empty_simple (mimetype);
+ }
+
break;
+ }
}
}
@@ -302,27 +396,84 @@ gst_ff_vid_caps_new (AVCodecContext * context, enum CodecID codec_id,
* default unfixed setting */
if (!caps) {
GST_DEBUG ("Creating default caps");
- caps = gst_caps_new_simple (mimetype, NULL, NULL, NULL);
+ caps = gst_caps_new_empty_simple (mimetype);
}
- for (i = 0; i < gst_caps_get_size (caps); i++) {
- va_start (var_args, fieldname);
- structure = gst_caps_get_structure (caps, i);
- gst_structure_set_valist (structure, fieldname, var_args);
- va_end (var_args);
- }
+ va_start (var_args, fieldname);
+ gst_caps_set_simple_valist (caps, fieldname, var_args);
+ va_end (var_args);
return caps;
}
+static gint
+get_nbits_set (guint64 n)
+{
+ gint i, x;
+
+ x = 0;
+ for (i = 0; i < 64; i++) {
+ if ((n & (G_GUINT64_CONSTANT (1) << i)))
+ x++;
+ }
+
+ return x;
+}
+
+static void
+gst_ffmpeg_audio_set_sample_fmts (GstCaps * caps,
+ const enum AVSampleFormat *fmts)
+{
+ GValue va = { 0, };
+ GValue v = { 0, };
+ GstAudioFormat format;
+
+ if (!fmts || fmts[0] == -1) {
+ gint i;
+
+ g_value_init (&va, GST_TYPE_LIST);
+ g_value_init (&v, G_TYPE_STRING);
+ for (i = 0; i <= AV_SAMPLE_FMT_DBL; i++) {
+ format = gst_ffmpeg_smpfmt_to_audioformat (i);
+ if (format == GST_AUDIO_FORMAT_UNKNOWN)
+ continue;
+ g_value_set_string (&v, gst_audio_format_to_string (format));
+ gst_value_list_append_value (&va, &v);
+ }
+ gst_caps_set_value (caps, "format", &va);
+ g_value_unset (&v);
+ g_value_unset (&va);
+ return;
+ }
+
+ g_value_init (&va, GST_TYPE_LIST);
+ g_value_init (&v, G_TYPE_STRING);
+ while (*fmts != -1) {
+ format = gst_ffmpeg_smpfmt_to_audioformat (*fmts);
+ if (format != GST_AUDIO_FORMAT_UNKNOWN) {
+ g_value_set_string (&v, gst_audio_format_to_string (format));
+ gst_value_list_append_value (&va, &v);
+ }
+ fmts++;
+ }
+ if (gst_value_list_get_size (&va) == 1) {
+ /* The single value is still in v */
+ gst_caps_set_value (caps, "format", &v);
+ } else if (gst_value_list_get_size (&va) > 1) {
+ gst_caps_set_value (caps, "format", &va);
+ }
+ g_value_unset (&v);
+ g_value_unset (&va);
+}
+
/* same for audio - now with channels/sample rate
*/
static GstCaps *
-gst_ff_aud_caps_new (AVCodecContext * context, enum CodecID codec_id,
- gboolean encode, const char *mimetype, const char *fieldname, ...)
+gst_ff_aud_caps_new (AVCodecContext * context, AVCodec * codec,
+ enum CodecID codec_id, gboolean encode, const char *mimetype,
+ const char *fieldname, ...)
{
GstCaps *caps = NULL;
- GstStructure *structure = NULL;
gint i;
va_list var_args;
@@ -334,7 +485,8 @@ gst_ff_aud_caps_new (AVCodecContext * context, enum CodecID codec_id,
"rate", G_TYPE_INT, context->sample_rate,
"channels", G_TYPE_INT, context->channels, NULL);
- if (gst_ffmpeg_channel_layout_to_gst (context, pos)) {
+ if (gst_ffmpeg_channel_layout_to_gst (context->channel_layout,
+ context->channels, pos)) {
guint64 mask;
if (gst_audio_channel_positions_to_mask (pos, context->channels, FALSE,
@@ -350,12 +502,12 @@ gst_ff_aud_caps_new (AVCodecContext * context, enum CodecID codec_id,
/* so we must be after restricted caps in this case */
switch (codec_id) {
- case CODEC_ID_AAC:
- case CODEC_ID_AAC_LATM:
- case CODEC_ID_DTS:
+ case AV_CODEC_ID_AAC:
+ case AV_CODEC_ID_AAC_LATM:
+ case AV_CODEC_ID_DTS:
maxchannels = 6;
break;
- case CODEC_ID_MP2:
+ case AV_CODEC_ID_MP2:
{
const static gint l_rates[] =
{ 48000, 44100, 32000, 24000, 22050, 16000 };
@@ -363,8 +515,8 @@ gst_ff_aud_caps_new (AVCodecContext * context, enum CodecID codec_id,
rates = l_rates;
break;
}
- case CODEC_ID_EAC3:
- case CODEC_ID_AC3:
+ case AV_CODEC_ID_EAC3:
+ case AV_CODEC_ID_AC3:
{
const static gint l_rates[] = { 48000, 44100, 32000 };
maxchannels = 6;
@@ -372,7 +524,7 @@ gst_ff_aud_caps_new (AVCodecContext * context, enum CodecID codec_id,
rates = l_rates;
break;
}
- case CODEC_ID_ADPCM_G722:
+ case AV_CODEC_ID_ADPCM_G722:
{
const static gint l_rates[] = { 16000 };
n_rates = G_N_ELEMENTS (l_rates);
@@ -380,7 +532,7 @@ gst_ff_aud_caps_new (AVCodecContext * context, enum CodecID codec_id,
maxchannels = 1;
break;
}
- case CODEC_ID_ADPCM_G726:
+ case AV_CODEC_ID_ADPCM_G726:
{
const static gint l_rates[] = { 8000 };
n_rates = G_N_ELEMENTS (l_rates);
@@ -388,21 +540,21 @@ gst_ff_aud_caps_new (AVCodecContext * context, enum CodecID codec_id,
maxchannels = 1;
break;
}
- case CODEC_ID_ADPCM_SWF:
+ case AV_CODEC_ID_ADPCM_SWF:
{
const static gint l_rates[] = { 11025, 22050, 44100 };
n_rates = G_N_ELEMENTS (l_rates);
rates = l_rates;
break;
}
- case CODEC_ID_ROQ_DPCM:
+ case AV_CODEC_ID_ROQ_DPCM:
{
const static gint l_rates[] = { 22050 };
n_rates = G_N_ELEMENTS (l_rates);
rates = l_rates;
break;
}
- case CODEC_ID_AMR_NB:
+ case AV_CODEC_ID_AMR_NB:
{
const static gint l_rates[] = { 8000 };
maxchannels = 1;
@@ -410,7 +562,7 @@ gst_ff_aud_caps_new (AVCodecContext * context, enum CodecID codec_id,
rates = l_rates;
break;
}
- case CODEC_ID_AMR_WB:
+ case AV_CODEC_ID_AMR_WB:
{
const static gint l_rates[] = { 16000 };
maxchannels = 1;
@@ -422,31 +574,52 @@ gst_ff_aud_caps_new (AVCodecContext * context, enum CodecID codec_id,
break;
}
- /* TODO: handle context->channel_layouts here to set
- * the list of channel layouts supported by the encoder.
- * Unfortunately no encoder uses this yet....
- */
/* regardless of encode/decode, open up channels if applicable */
/* Until decoders/encoders expose the maximum number of channels
* they support, we whitelist them here. */
switch (codec_id) {
- case CODEC_ID_WMAPRO:
- case CODEC_ID_TRUEHD:
+ case AV_CODEC_ID_WMAPRO:
+ case AV_CODEC_ID_TRUEHD:
maxchannels = 8;
break;
default:
break;
}
- if (maxchannels == 1)
- caps = gst_caps_new_simple (mimetype,
- "channels", G_TYPE_INT, maxchannels, NULL);
- else
- caps = gst_caps_new_simple (mimetype,
- "channels", GST_TYPE_INT_RANGE, 1, maxchannels, NULL);
+ if (codec && codec->channel_layouts) {
+ const uint64_t *layouts = codec->channel_layouts;
+ GstAudioChannelPosition pos[64];
+
+ caps = gst_caps_new_empty ();
+ while (*layouts) {
+ gint nbits_set = get_nbits_set (*layouts);
+
+ if (gst_ffmpeg_channel_layout_to_gst (*layouts, nbits_set, pos)) {
+ guint64 mask;
+
+ if (gst_audio_channel_positions_to_mask (pos, nbits_set, FALSE,
+ &mask)) {
+ GstCaps *tmp =
+ gst_caps_new_simple (mimetype, "channel-mask", GST_TYPE_BITMASK,
+ mask,
+ "channels", G_TYPE_INT, nbits_set, NULL);
+
+ gst_caps_append (caps, tmp);
+ }
+ }
+ layouts++;
+ }
+ } else {
+ if (maxchannels == 1)
+ caps = gst_caps_new_simple (mimetype,
+ "channels", G_TYPE_INT, maxchannels, NULL);
+ else
+ caps = gst_caps_new_simple (mimetype,
+ "channels", GST_TYPE_INT_RANGE, 1, maxchannels, NULL);
+ }
+
if (n_rates) {
GValue list = { 0, };
- GstStructure *structure;
g_value_init (&list, GST_TYPE_LIST);
for (i = 0; i < n_rates; i++) {
@@ -457,21 +630,41 @@ gst_ff_aud_caps_new (AVCodecContext * context, enum CodecID codec_id,
gst_value_list_append_value (&list, &v);
g_value_unset (&v);
}
- structure = gst_caps_get_structure (caps, 0);
- gst_structure_set_value (structure, "rate", &list);
+ gst_caps_set_value (caps, "rate", &list);
g_value_unset (&list);
- } else
+ } else if (codec && codec->supported_samplerates
+ && codec->supported_samplerates[0]) {
+ GValue va = { 0, };
+ GValue v = { 0, };
+
+ if (!codec->supported_samplerates[1]) {
+ gst_caps_set_simple (caps, "rate", G_TYPE_INT,
+ codec->supported_samplerates[0], NULL);
+ } else {
+ const int *rates = codec->supported_samplerates;
+
+ g_value_init (&va, GST_TYPE_LIST);
+ g_value_init (&v, G_TYPE_INT);
+
+ while (*rates) {
+ g_value_set_int (&v, *rates);
+ gst_value_list_append_value (&va, &v);
+ rates++;
+ }
+ gst_caps_set_value (caps, "rate", &va);
+ g_value_unset (&va);
+ g_value_unset (&v);
+ }
+ } else {
gst_caps_set_simple (caps, "rate", GST_TYPE_INT_RANGE, 4000, 96000, NULL);
+ }
} else {
caps = gst_caps_new_empty_simple (mimetype);
}
- for (i = 0; i < gst_caps_get_size (caps); i++) {
- va_start (var_args, fieldname);
- structure = gst_caps_get_structure (caps, i);
- gst_structure_set_valist (structure, fieldname, var_args);
- va_end (var_args);
- }
+ va_start (var_args, fieldname);
+ gst_caps_set_simple_valist (caps, fieldname, var_args);
+ va_end (var_args);
return caps;
}
@@ -502,19 +695,20 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id,
GST_LOG ("codec_id:%d, context:%p, encode:%d", codec_id, context, encode);
switch (codec_id) {
- case CODEC_ID_MPEG1VIDEO:
+ case AV_CODEC_ID_MPEG1VIDEO:
/* FIXME: bitrate */
- caps = gst_ff_vid_caps_new (context, codec_id, encode, "video/mpeg",
+ caps = gst_ff_vid_caps_new (context, NULL, codec_id, encode, "video/mpeg",
"mpegversion", G_TYPE_INT, 1,
"systemstream", G_TYPE_BOOLEAN, FALSE, NULL);
break;
- case CODEC_ID_MPEG2VIDEO:
+ case AV_CODEC_ID_MPEG2VIDEO:
if (encode) {
/* FIXME: bitrate */
- caps = gst_ff_vid_caps_new (context, codec_id, encode, "video/mpeg",
- "mpegversion", G_TYPE_INT, 2,
- "systemstream", G_TYPE_BOOLEAN, FALSE, NULL);
+ caps =
+ gst_ff_vid_caps_new (context, NULL, codec_id, encode, "video/mpeg",
+ "mpegversion", G_TYPE_INT, 2, "systemstream", G_TYPE_BOOLEAN, FALSE,
+ NULL);
} else {
/* decode both MPEG-1 and MPEG-2; width/height/fps are all in
* the MPEG video stream headers, so may be omitted from caps. */
@@ -524,29 +718,31 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id,
}
break;
- case CODEC_ID_MPEG2VIDEO_XVMC:
+ case AV_CODEC_ID_MPEG2VIDEO_XVMC:
/* this is a special ID - don't need it in GStreamer, I think */
break;
- case CODEC_ID_H263:
+ case AV_CODEC_ID_H263:
if (encode) {
- caps = gst_ff_vid_caps_new (context, codec_id, encode, "video/x-h263",
- "variant", G_TYPE_STRING, "itu",
- "h263version", G_TYPE_STRING, "h263", NULL);
+ caps =
+ gst_ff_vid_caps_new (context, NULL, codec_id, encode,
+ "video/x-h263", "variant", G_TYPE_STRING, "itu", "h263version",
+ G_TYPE_STRING, "h263", NULL);
} else {
/* don't pass codec_id, we can decode other variants with the H263
* decoder that don't have specific size requirements
*/
caps =
- gst_ff_vid_caps_new (context, CODEC_ID_NONE, encode, "video/x-h263",
- "variant", G_TYPE_STRING, "itu", NULL);
+ gst_ff_vid_caps_new (context, NULL, AV_CODEC_ID_NONE, encode,
+ "video/x-h263", "variant", G_TYPE_STRING, "itu", NULL);
}
break;
- case CODEC_ID_H263P:
- caps = gst_ff_vid_caps_new (context, codec_id, encode, "video/x-h263",
- "variant", G_TYPE_STRING, "itu",
- "h263version", G_TYPE_STRING, "h263p", NULL);
+ case AV_CODEC_ID_H263P:
+ caps =
+ gst_ff_vid_caps_new (context, NULL, codec_id, encode, "video/x-h263",
+ "variant", G_TYPE_STRING, "itu", "h263version", G_TYPE_STRING,
+ "h263p", NULL);
if (encode && context) {
gst_caps_set_simple (caps,
@@ -558,32 +754,33 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id,
}
break;
- case CODEC_ID_H263I:
+ case AV_CODEC_ID_H263I:
caps =
- gst_ff_vid_caps_new (context, codec_id, encode, "video/x-intel-h263",
- "variant", G_TYPE_STRING, "intel", NULL);
+ gst_ff_vid_caps_new (context, NULL, codec_id, encode,
+ "video/x-intel-h263", "variant", G_TYPE_STRING, "intel", NULL);
break;
- case CODEC_ID_H261:
+ case AV_CODEC_ID_H261:
caps =
- gst_ff_vid_caps_new (context, codec_id, encode, "video/x-h261", NULL);
+ gst_ff_vid_caps_new (context, NULL, codec_id, encode, "video/x-h261",
+ NULL);
break;
- case CODEC_ID_RV10:
- case CODEC_ID_RV20:
- case CODEC_ID_RV30:
- case CODEC_ID_RV40:
+ case AV_CODEC_ID_RV10:
+ case AV_CODEC_ID_RV20:
+ case AV_CODEC_ID_RV30:
+ case AV_CODEC_ID_RV40:
{
gint version;
switch (codec_id) {
- case CODEC_ID_RV40:
+ case AV_CODEC_ID_RV40:
version = 4;
break;
- case CODEC_ID_RV30:
+ case AV_CODEC_ID_RV30:
version = 3;
break;
- case CODEC_ID_RV20:
+ case AV_CODEC_ID_RV20:
version = 2;
break;
default:
@@ -593,9 +790,8 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id,
/* FIXME: context->sub_id must be filled in during decoding */
caps =
- gst_ff_vid_caps_new (context, codec_id, encode,
- "video/x-pn-realvideo", "systemstream", G_TYPE_BOOLEAN, FALSE,
- "rmversion", G_TYPE_INT, version, NULL);
+ gst_ff_vid_caps_new (context, NULL, codec_id, encode,
+ "video/x-pn-realvideo", "rmversion", G_TYPE_INT, version, NULL);
if (context) {
gst_caps_set_simple (caps, "format", G_TYPE_INT, context->sub_id, NULL);
if (context->extradata_size >= 8) {
@@ -607,22 +803,23 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id,
}
break;
- case CODEC_ID_MP1:
+ case AV_CODEC_ID_MP1:
/* FIXME: bitrate */
- caps = gst_ff_aud_caps_new (context, codec_id, encode, "audio/mpeg",
+ caps = gst_ff_aud_caps_new (context, NULL, codec_id, encode, "audio/mpeg",
"mpegversion", G_TYPE_INT, 1, "layer", G_TYPE_INT, 1, NULL);
break;
- case CODEC_ID_MP2:
+ case AV_CODEC_ID_MP2:
/* FIXME: bitrate */
- caps = gst_ff_aud_caps_new (context, codec_id, encode, "audio/mpeg",
+ caps = gst_ff_aud_caps_new (context, NULL, codec_id, encode, "audio/mpeg",
"mpegversion", G_TYPE_INT, 1, "layer", G_TYPE_INT, 2, NULL);
break;
- case CODEC_ID_MP3:
+ case AV_CODEC_ID_MP3:
if (encode) {
/* FIXME: bitrate */
- caps = gst_ff_aud_caps_new (context, codec_id, encode, "audio/mpeg",
+ caps =
+ gst_ff_aud_caps_new (context, NULL, codec_id, encode, "audio/mpeg",
"mpegversion", G_TYPE_INT, 1, "layer", G_TYPE_INT, 3, NULL);
} else {
/* Decodes MPEG-1 layer 1/2/3. Samplerate, channels et al are
@@ -633,58 +830,61 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id,
}
break;
- case CODEC_ID_MUSEPACK7:
+ case AV_CODEC_ID_MUSEPACK7:
caps =
- gst_ff_aud_caps_new (context, codec_id, encode,
+ gst_ff_aud_caps_new (context, NULL, codec_id, encode,
"audio/x-ffmpeg-parsed-musepack", "streamversion", G_TYPE_INT, 7,
NULL);
break;
- case CODEC_ID_MUSEPACK8:
+ case AV_CODEC_ID_MUSEPACK8:
caps =
- gst_ff_aud_caps_new (context, codec_id, encode,
+ gst_ff_aud_caps_new (context, NULL, codec_id, encode,
"audio/x-ffmpeg-parsed-musepack", "streamversion", G_TYPE_INT, 8,
NULL);
break;
- case CODEC_ID_AC3:
+ case AV_CODEC_ID_AC3:
/* FIXME: bitrate */
caps =
- gst_ff_aud_caps_new (context, codec_id, encode, "audio/x-ac3", NULL);
+ gst_ff_aud_caps_new (context, NULL, codec_id, encode, "audio/x-ac3",
+ NULL);
break;
- case CODEC_ID_EAC3:
+ case AV_CODEC_ID_EAC3:
/* FIXME: bitrate */
caps =
- gst_ff_aud_caps_new (context, codec_id, encode, "audio/x-eac3", NULL);
+ gst_ff_aud_caps_new (context, NULL, codec_id, encode, "audio/x-eac3",
+ NULL);
break;
- case CODEC_ID_TRUEHD:
+ case AV_CODEC_ID_TRUEHD:
caps =
- gst_ff_aud_caps_new (context, codec_id, encode, "audio/x-true-hd",
- NULL);
+ gst_ff_aud_caps_new (context, NULL, codec_id, encode,
+ "audio/x-true-hd", NULL);
break;
- case CODEC_ID_ATRAC1:
+ case AV_CODEC_ID_ATRAC1:
caps =
- gst_ff_aud_caps_new (context, codec_id, encode,
+ gst_ff_aud_caps_new (context, NULL, codec_id, encode,
"audio/x-vnd.sony.atrac1", NULL);
break;
- case CODEC_ID_ATRAC3:
+ case AV_CODEC_ID_ATRAC3:
caps =
- gst_ff_aud_caps_new (context, codec_id, encode,
+ gst_ff_aud_caps_new (context, NULL, codec_id, encode,
"audio/x-vnd.sony.atrac3", NULL);
break;
- case CODEC_ID_DTS:
+ case AV_CODEC_ID_DTS:
caps =
- gst_ff_aud_caps_new (context, codec_id, encode, "audio/x-dts", NULL);
+ gst_ff_aud_caps_new (context, NULL, codec_id, encode, "audio/x-dts",
+ NULL);
break;
- case CODEC_ID_APE:
+ case AV_CODEC_ID_APE:
caps =
- gst_ff_aud_caps_new (context, codec_id, encode,
+ gst_ff_aud_caps_new (context, NULL, codec_id, encode,
"audio/x-ffmpeg-parsed-ape", NULL);
if (context) {
gst_caps_set_simple (caps,
@@ -692,14 +892,16 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id,
}
break;
- case CODEC_ID_MLP:
+ case AV_CODEC_ID_MLP:
caps =
- gst_ff_aud_caps_new (context, codec_id, encode, "audio/x-mlp", NULL);
+ gst_ff_aud_caps_new (context, NULL, codec_id, encode, "audio/x-mlp",
+ NULL);
break;
- case CODEC_ID_IMC:
+ case AV_CODEC_ID_IMC:
caps =
- gst_ff_aud_caps_new (context, codec_id, encode, "audio/x-imc", NULL);
+ gst_ff_aud_caps_new (context, NULL, codec_id, encode, "audio/x-imc",
+ NULL);
break;
/* MJPEG is normal JPEG, Motion-JPEG and Quicktime MJPEG-A. MJPEGB
@@ -707,115 +909,123 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id,
* sp5x is, but it's apparently something JPEG... We don't separate
* between those in GStreamer. Should we (at least between MJPEG,
* MJPEG-B and sp5x decoding...)? */
- case CODEC_ID_MJPEG:
- case CODEC_ID_LJPEG:
+ case AV_CODEC_ID_MJPEG:
+ case AV_CODEC_ID_LJPEG:
caps =
- gst_ff_vid_caps_new (context, codec_id, encode, "image/jpeg", NULL);
+ gst_ff_vid_caps_new (context, NULL, codec_id, encode, "image/jpeg",
+ NULL);
break;
- case CODEC_ID_SP5X:
+ case AV_CODEC_ID_SP5X:
caps =
- gst_ff_vid_caps_new (context, codec_id, encode, "video/sp5x", NULL);
+ gst_ff_vid_caps_new (context, NULL, codec_id, encode, "video/sp5x",
+ NULL);
break;
- case CODEC_ID_MJPEGB:
+ case AV_CODEC_ID_MJPEGB:
caps =
- gst_ff_vid_caps_new (context, codec_id, encode, "video/x-mjpeg-b",
- NULL);
+ gst_ff_vid_caps_new (context, NULL, codec_id, encode,
+ "video/x-mjpeg-b", NULL);
break;
- case CODEC_ID_MPEG4:
+ case AV_CODEC_ID_MPEG4:
if (encode && context != NULL) {
/* I'm not exactly sure what ffmpeg outputs... ffmpeg itself uses
* the AVI fourcc 'DIVX', but 'mp4v' for Quicktime... */
switch (context->codec_tag) {
case GST_MAKE_FOURCC ('D', 'I', 'V', 'X'):
caps =
- gst_ff_vid_caps_new (context, codec_id, encode, "video/x-divx",
- "divxversion", G_TYPE_INT, 5, NULL);
+ gst_ff_vid_caps_new (context, NULL, codec_id, encode,
+ "video/x-divx", "divxversion", G_TYPE_INT, 5, NULL);
break;
case GST_MAKE_FOURCC ('m', 'p', '4', 'v'):
default:
/* FIXME: bitrate */
- caps = gst_ff_vid_caps_new (context, codec_id, encode, "video/mpeg",
- "systemstream", G_TYPE_BOOLEAN, FALSE,
+ caps =
+ gst_ff_vid_caps_new (context, NULL, codec_id, encode,
+ "video/mpeg", "systemstream", G_TYPE_BOOLEAN, FALSE,
"mpegversion", G_TYPE_INT, 4, NULL);
break;
}
} else {
/* The trick here is to separate xvid, divx, mpeg4, 3ivx et al */
- caps = gst_ff_vid_caps_new (context, codec_id, encode, "video/mpeg",
- "mpegversion", G_TYPE_INT, 4,
- "systemstream", G_TYPE_BOOLEAN, FALSE, NULL);
+ caps =
+ gst_ff_vid_caps_new (context, NULL, codec_id, encode, "video/mpeg",
+ "mpegversion", G_TYPE_INT, 4, "systemstream", G_TYPE_BOOLEAN, FALSE,
+ NULL);
if (encode) {
- gst_caps_append (caps, gst_ff_vid_caps_new (context, codec_id, encode,
- "video/x-divx", "divxversion", G_TYPE_INT, 5, NULL));
+ gst_caps_append (caps, gst_ff_vid_caps_new (context, NULL, codec_id,
+ encode, "video/x-divx", "divxversion", G_TYPE_INT, 5, NULL));
} else {
- gst_caps_append (caps, gst_ff_vid_caps_new (context, codec_id, encode,
- "video/x-divx", "divxversion", GST_TYPE_INT_RANGE, 4, 5,
- NULL));
- gst_caps_append (caps, gst_ff_vid_caps_new (context, codec_id, encode,
- "video/x-xvid", NULL));
- gst_caps_append (caps, gst_ff_vid_caps_new (context, codec_id, encode,
- "video/x-3ivx", NULL));
+ gst_caps_append (caps, gst_ff_vid_caps_new (context, NULL, codec_id,
+ encode, "video/x-divx", "divxversion", GST_TYPE_INT_RANGE, 4,
+ 5, NULL));
+ gst_caps_append (caps, gst_ff_vid_caps_new (context, NULL, codec_id,
+ encode, "video/x-xvid", NULL));
+ gst_caps_append (caps, gst_ff_vid_caps_new (context, NULL, codec_id,
+ encode, "video/x-3ivx", NULL));
}
}
break;
- case CODEC_ID_RAWVIDEO:
+ case AV_CODEC_ID_RAWVIDEO:
caps =
- gst_ffmpeg_codectype_to_caps (AVMEDIA_TYPE_VIDEO, context, codec_id,
- encode);
+ gst_ffmpeg_codectype_to_video_caps (context, codec_id, encode, NULL);
break;
- case CODEC_ID_MSMPEG4V1:
- case CODEC_ID_MSMPEG4V2:
- case CODEC_ID_MSMPEG4V3:
+ case AV_CODEC_ID_MSMPEG4V1:
+ case AV_CODEC_ID_MSMPEG4V2:
+ case AV_CODEC_ID_MSMPEG4V3:
{
- gint version = 41 + codec_id - CODEC_ID_MSMPEG4V1;
+ gint version = 41 + codec_id - AV_CODEC_ID_MSMPEG4V1;
/* encode-FIXME: bitrate */
- caps = gst_ff_vid_caps_new (context, codec_id, encode, "video/x-msmpeg",
- "msmpegversion", G_TYPE_INT, version, NULL);
- if (!encode && codec_id == CODEC_ID_MSMPEG4V3) {
- gst_caps_append (caps, gst_ff_vid_caps_new (context, codec_id, encode,
- "video/x-divx", "divxversion", G_TYPE_INT, 3, NULL));
+ caps =
+ gst_ff_vid_caps_new (context, NULL, codec_id, encode,
+ "video/x-msmpeg", "msmpegversion", G_TYPE_INT, version, NULL);
+ if (!encode && codec_id == AV_CODEC_ID_MSMPEG4V3) {
+ gst_caps_append (caps, gst_ff_vid_caps_new (context, NULL, codec_id,
+ encode, "video/x-divx", "divxversion", G_TYPE_INT, 3, NULL));
}
}
break;
- case CODEC_ID_WMV1:
- case CODEC_ID_WMV2:
+ case AV_CODEC_ID_WMV1:
+ case AV_CODEC_ID_WMV2:
{
- gint version = (codec_id == CODEC_ID_WMV1) ? 1 : 2;
+ gint version = (codec_id == AV_CODEC_ID_WMV1) ? 1 : 2;
- caps = gst_ff_vid_caps_new (context, codec_id, encode, "video/x-wmv",
+ caps =
+ gst_ff_vid_caps_new (context, NULL, codec_id, encode, "video/x-wmv",
"wmvversion", G_TYPE_INT, version, NULL);
}
break;
- case CODEC_ID_FLV1:
+ case AV_CODEC_ID_FLV1:
caps =
- gst_ff_vid_caps_new (context, codec_id, encode, "video/x-flash-video",
- "flvversion", G_TYPE_INT, 1, NULL);
+ gst_ff_vid_caps_new (context, NULL, codec_id, encode,
+ "video/x-flash-video", "flvversion", G_TYPE_INT, 1, NULL);
break;
- case CODEC_ID_SVQ1:
- caps = gst_ff_vid_caps_new (context, codec_id, encode, "video/x-svq",
+ case AV_CODEC_ID_SVQ1:
+ caps =
+ gst_ff_vid_caps_new (context, NULL, codec_id, encode, "video/x-svq",
"svqversion", G_TYPE_INT, 1, NULL);
break;
- case CODEC_ID_SVQ3:
- caps = gst_ff_vid_caps_new (context, codec_id, encode, "video/x-svq",
+ case AV_CODEC_ID_SVQ3:
+ caps =
+ gst_ff_vid_caps_new (context, NULL, codec_id, encode, "video/x-svq",
"svqversion", G_TYPE_INT, 3, NULL);
break;
- case CODEC_ID_DVAUDIO:
+ case AV_CODEC_ID_DVAUDIO:
caps =
- gst_ff_aud_caps_new (context, codec_id, encode, "audio/x-dv", NULL);
+ gst_ff_aud_caps_new (context, NULL, codec_id, encode, "audio/x-dv",
+ NULL);
break;
- case CODEC_ID_DVVIDEO:
+ case AV_CODEC_ID_DVVIDEO:
{
if (encode && context) {
const gchar *format;
@@ -846,148 +1056,171 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id,
format = "I420";
break;
}
- caps = gst_ff_vid_caps_new (context, codec_id, encode, "video/x-dv",
- "systemstream", G_TYPE_BOOLEAN, FALSE,
- "format", G_TYPE_STRING, format, NULL);
+ caps =
+ gst_ff_vid_caps_new (context, NULL, codec_id, encode, "video/x-dv",
+ "systemstream", G_TYPE_BOOLEAN, FALSE, "format", G_TYPE_STRING,
+ format, NULL);
} else {
- caps = gst_ff_vid_caps_new (context, codec_id, encode, "video/x-dv",
+ caps =
+ gst_ff_vid_caps_new (context, NULL, codec_id, encode, "video/x-dv",
"systemstream", G_TYPE_BOOLEAN, FALSE, NULL);
}
}
break;
- case CODEC_ID_WMAV1:
- case CODEC_ID_WMAV2:
+ case AV_CODEC_ID_WMAV1:
+ case AV_CODEC_ID_WMAV2:
{
- gint version = (codec_id == CODEC_ID_WMAV1) ? 1 : 2;
+ gint version = (codec_id == AV_CODEC_ID_WMAV1) ? 1 : 2;
if (context) {
- caps = gst_ff_aud_caps_new (context, codec_id, encode, "audio/x-wma",
- "wmaversion", G_TYPE_INT, version,
- "block_align", G_TYPE_INT, context->block_align,
- "bitrate", G_TYPE_INT, context->bit_rate, NULL);
+ caps =
+ gst_ff_aud_caps_new (context, NULL, codec_id, encode, "audio/x-wma",
+ "wmaversion", G_TYPE_INT, version, "block_align", G_TYPE_INT,
+ context->block_align, "bitrate", G_TYPE_INT, context->bit_rate,
+ NULL);
} else {
- caps = gst_ff_aud_caps_new (context, codec_id, encode, "audio/x-wma",
- "wmaversion", G_TYPE_INT, version,
- "block_align", GST_TYPE_INT_RANGE, 0, G_MAXINT,
- "bitrate", GST_TYPE_INT_RANGE, 0, G_MAXINT, NULL);
+ caps =
+ gst_ff_aud_caps_new (context, NULL, codec_id, encode, "audio/x-wma",
+ "wmaversion", G_TYPE_INT, version, "block_align",
+ GST_TYPE_INT_RANGE, 0, G_MAXINT, "bitrate", GST_TYPE_INT_RANGE, 0,
+ G_MAXINT, NULL);
}
}
break;
- case CODEC_ID_WMAPRO:
+ case AV_CODEC_ID_WMAPRO:
{
- caps = gst_ff_aud_caps_new (context, codec_id, encode, "audio/x-wma",
+ caps =
+ gst_ff_aud_caps_new (context, NULL, codec_id, encode, "audio/x-wma",
"wmaversion", G_TYPE_INT, 3, NULL);
break;
}
-
- case CODEC_ID_WMAVOICE:
+ case AV_CODEC_ID_WMALOSSLESS:
{
+ /* libav only supports a depth of 16 at the moment */
caps =
- gst_ff_aud_caps_new (context, codec_id, encode, "audio/x-wms", NULL);
+ gst_ff_aud_caps_new (context, NULL, codec_id, encode, "audio/x-wma",
+ "wmaversion", G_TYPE_INT, 4, "depth", G_TYPE_INT, 16, NULL);
+ break;
+ }
+ case AV_CODEC_ID_WMAVOICE:
+ {
+ caps =
+ gst_ff_aud_caps_new (context, NULL, codec_id, encode, "audio/x-wms",
+ NULL);
break;
}
- case CODEC_ID_MACE3:
- case CODEC_ID_MACE6:
+ case AV_CODEC_ID_MACE3:
+ case AV_CODEC_ID_MACE6:
{
- gint version = (codec_id == CODEC_ID_MACE3) ? 3 : 6;
+ gint version = (codec_id == AV_CODEC_ID_MACE3) ? 3 : 6;
- caps = gst_ff_aud_caps_new (context, codec_id, encode, "audio/x-mace",
+ caps =
+ gst_ff_aud_caps_new (context, NULL, codec_id, encode, "audio/x-mace",
"maceversion", G_TYPE_INT, version, NULL);
}
break;
- case CODEC_ID_HUFFYUV:
+ case AV_CODEC_ID_HUFFYUV:
caps =
- gst_ff_vid_caps_new (context, codec_id, encode, "video/x-huffyuv",
- NULL);
+ gst_ff_vid_caps_new (context, NULL, codec_id, encode,
+ "video/x-huffyuv", NULL);
if (context) {
gst_caps_set_simple (caps,
"bpp", G_TYPE_INT, context->bits_per_coded_sample, NULL);
}
break;
- case CODEC_ID_CYUV:
+ case AV_CODEC_ID_CYUV:
caps =
- gst_ff_vid_caps_new (context, codec_id, encode,
+ gst_ff_vid_caps_new (context, NULL, codec_id, encode,
"video/x-compressed-yuv", NULL);
break;
- case CODEC_ID_H264:
+ case AV_CODEC_ID_H264:
caps =
- gst_ff_vid_caps_new (context, codec_id, encode, "video/x-h264",
+ gst_ff_vid_caps_new (context, NULL, codec_id, encode, "video/x-h264",
"alignment", G_TYPE_STRING, "au", NULL);
break;
- case CODEC_ID_INDEO5:
- caps = gst_ff_vid_caps_new (context, codec_id, encode, "video/x-indeo",
+ case AV_CODEC_ID_INDEO5:
+ caps =
+ gst_ff_vid_caps_new (context, NULL, codec_id, encode, "video/x-indeo",
"indeoversion", G_TYPE_INT, 5, NULL);
break;
- case CODEC_ID_INDEO4:
- caps = gst_ff_vid_caps_new (context, codec_id, encode, "video/x-indeo",
+ case AV_CODEC_ID_INDEO4:
+ caps =
+ gst_ff_vid_caps_new (context, NULL, codec_id, encode, "video/x-indeo",
"indeoversion", G_TYPE_INT, 4, NULL);
break;
- case CODEC_ID_INDEO3:
- caps = gst_ff_vid_caps_new (context, codec_id, encode, "video/x-indeo",
+ case AV_CODEC_ID_INDEO3:
+ caps =
+ gst_ff_vid_caps_new (context, NULL, codec_id, encode, "video/x-indeo",
"indeoversion", G_TYPE_INT, 3, NULL);
break;
- case CODEC_ID_INDEO2:
- caps = gst_ff_vid_caps_new (context, codec_id, encode, "video/x-indeo",
+ case AV_CODEC_ID_INDEO2:
+ caps =
+ gst_ff_vid_caps_new (context, NULL, codec_id, encode, "video/x-indeo",
"indeoversion", G_TYPE_INT, 2, NULL);
break;
- case CODEC_ID_FLASHSV:
+ case AV_CODEC_ID_FLASHSV:
caps =
- gst_ff_vid_caps_new (context, codec_id, encode,
+ gst_ff_vid_caps_new (context, NULL, codec_id, encode,
"video/x-flash-screen", NULL);
break;
- case CODEC_ID_VP3:
+ case AV_CODEC_ID_VP3:
caps =
- gst_ff_vid_caps_new (context, codec_id, encode, "video/x-vp3", NULL);
+ gst_ff_vid_caps_new (context, NULL, codec_id, encode, "video/x-vp3",
+ NULL);
break;
- case CODEC_ID_VP5:
+ case AV_CODEC_ID_VP5:
caps =
- gst_ff_vid_caps_new (context, codec_id, encode, "video/x-vp5", NULL);
+ gst_ff_vid_caps_new (context, NULL, codec_id, encode, "video/x-vp5",
+ NULL);
break;
- case CODEC_ID_VP6:
+ case AV_CODEC_ID_VP6:
caps =
- gst_ff_vid_caps_new (context, codec_id, encode, "video/x-vp6", NULL);
+ gst_ff_vid_caps_new (context, NULL, codec_id, encode, "video/x-vp6",
+ NULL);
break;
- case CODEC_ID_VP6F:
+ case AV_CODEC_ID_VP6F:
caps =
- gst_ff_vid_caps_new (context, codec_id, encode, "video/x-vp6-flash",
- NULL);
+ gst_ff_vid_caps_new (context, NULL, codec_id, encode,
+ "video/x-vp6-flash", NULL);
break;
- case CODEC_ID_VP6A:
+ case AV_CODEC_ID_VP6A:
caps =
- gst_ff_vid_caps_new (context, codec_id, encode, "video/x-vp6-alpha",
- NULL);
+ gst_ff_vid_caps_new (context, NULL, codec_id, encode,
+ "video/x-vp6-alpha", NULL);
break;
- case CODEC_ID_VP8:
+ case AV_CODEC_ID_VP8:
caps =
- gst_ff_vid_caps_new (context, codec_id, encode, "video/x-vp8", NULL);
+ gst_ff_vid_caps_new (context, NULL, codec_id, encode, "video/x-vp8",
+ NULL);
break;
- case CODEC_ID_THEORA:
+ case AV_CODEC_ID_THEORA:
caps =
- gst_ff_vid_caps_new (context, codec_id, encode, "video/x-theora",
- NULL);
+ gst_ff_vid_caps_new (context, NULL, codec_id, encode,
+ "video/x-theora", NULL);
break;
- case CODEC_ID_AAC:
+ case AV_CODEC_ID_AAC:
{
caps =
- gst_ff_aud_caps_new (context, codec_id, encode, "audio/mpeg", NULL);
+ gst_ff_aud_caps_new (context, NULL, codec_id, encode, "audio/mpeg",
+ NULL);
if (!encode) {
GValue arr = { 0, };
@@ -1028,76 +1261,83 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id,
break;
}
- case CODEC_ID_AAC_LATM: /* LATM/LOAS AAC syntax */
- caps = gst_ff_aud_caps_new (context, codec_id, encode, "audio/mpeg",
+ case AV_CODEC_ID_AAC_LATM: /* LATM/LOAS AAC syntax */
+ caps = gst_ff_aud_caps_new (context, NULL, codec_id, encode, "audio/mpeg",
"mpegversion", G_TYPE_INT, 4, "stream-format", G_TYPE_STRING, "loas",
NULL);
break;
- case CODEC_ID_ASV1:
- caps = gst_ff_vid_caps_new (context, codec_id, encode, "video/x-asus",
+ case AV_CODEC_ID_ASV1:
+ caps =
+ gst_ff_vid_caps_new (context, NULL, codec_id, encode, "video/x-asus",
"asusversion", G_TYPE_INT, 1, NULL);
break;
- case CODEC_ID_ASV2:
- caps = gst_ff_vid_caps_new (context, codec_id, encode, "video/x-asus",
+ case AV_CODEC_ID_ASV2:
+ caps =
+ gst_ff_vid_caps_new (context, NULL, codec_id, encode, "video/x-asus",
"asusversion", G_TYPE_INT, 2, NULL);
break;
- case CODEC_ID_FFV1:
- caps = gst_ff_vid_caps_new (context, codec_id, encode, "video/x-ffv",
+ case AV_CODEC_ID_FFV1:
+ caps =
+ gst_ff_vid_caps_new (context, NULL, codec_id, encode, "video/x-ffv",
"ffvversion", G_TYPE_INT, 1, NULL);
break;
- case CODEC_ID_4XM:
+ case AV_CODEC_ID_4XM:
caps =
- gst_ff_vid_caps_new (context, codec_id, encode, "video/x-4xm", NULL);
+ gst_ff_vid_caps_new (context, NULL, codec_id, encode, "video/x-4xm",
+ NULL);
break;
- case CODEC_ID_XAN_WC3:
- case CODEC_ID_XAN_WC4:
- caps = gst_ff_vid_caps_new (context, codec_id, encode, "video/x-xan",
- "wcversion", G_TYPE_INT, 3 - CODEC_ID_XAN_WC3 + codec_id, NULL);
+ case AV_CODEC_ID_XAN_WC3:
+ case AV_CODEC_ID_XAN_WC4:
+ caps =
+ gst_ff_vid_caps_new (context, NULL, codec_id, encode, "video/x-xan",
+ "wcversion", G_TYPE_INT, 3 - AV_CODEC_ID_XAN_WC3 + codec_id, NULL);
break;
- case CODEC_ID_CLJR:
+ case AV_CODEC_ID_CLJR:
caps =
- gst_ff_vid_caps_new (context, codec_id, encode,
+ gst_ff_vid_caps_new (context, NULL, codec_id, encode,
"video/x-cirrus-logic-accupak", NULL);
break;
- case CODEC_ID_FRAPS:
+ case AV_CODEC_ID_FRAPS:
caps =
- gst_ff_vid_caps_new (context, codec_id, encode, "video/x-fraps",
+ gst_ff_vid_caps_new (context, NULL, codec_id, encode, "video/x-fraps",
NULL);
break;
- case CODEC_ID_MDEC:
- case CODEC_ID_ROQ:
- case CODEC_ID_INTERPLAY_VIDEO:
+ case AV_CODEC_ID_MDEC:
+ case AV_CODEC_ID_ROQ:
+ case AV_CODEC_ID_INTERPLAY_VIDEO:
buildcaps = TRUE;
break;
- case CODEC_ID_VCR1:
- caps = gst_ff_vid_caps_new (context, codec_id, encode, "video/x-ati-vcr",
- "vcrversion", G_TYPE_INT, 1, NULL);
+ case AV_CODEC_ID_VCR1:
+ caps =
+ gst_ff_vid_caps_new (context, NULL, codec_id, encode,
+ "video/x-ati-vcr", "vcrversion", G_TYPE_INT, 1, NULL);
break;
- case CODEC_ID_RPZA:
+ case AV_CODEC_ID_RPZA:
caps =
- gst_ff_vid_caps_new (context, codec_id, encode, "video/x-apple-video",
- NULL);
+ gst_ff_vid_caps_new (context, NULL, codec_id, encode,
+ "video/x-apple-video", NULL);
break;
- case CODEC_ID_CINEPAK:
+ case AV_CODEC_ID_CINEPAK:
caps =
- gst_ff_vid_caps_new (context, codec_id, encode, "video/x-cinepak",
- NULL);
+ gst_ff_vid_caps_new (context, NULL, codec_id, encode,
+ "video/x-cinepak", NULL);
break;
/* WS_VQA belogns here (order) */
- case CODEC_ID_MSRLE:
- caps = gst_ff_vid_caps_new (context, codec_id, encode, "video/x-rle",
+ case AV_CODEC_ID_MSRLE:
+ caps =
+ gst_ff_vid_caps_new (context, NULL, codec_id, encode, "video/x-rle",
"layout", G_TYPE_STRING, "microsoft", NULL);
if (context) {
gst_caps_set_simple (caps,
@@ -1107,8 +1347,9 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id,
}
break;
- case CODEC_ID_QTRLE:
- caps = gst_ff_vid_caps_new (context, codec_id, encode, "video/x-rle",
+ case AV_CODEC_ID_QTRLE:
+ caps =
+ gst_ff_vid_caps_new (context, NULL, codec_id, encode, "video/x-rle",
"layout", G_TYPE_STRING, "quicktime", NULL);
if (context) {
gst_caps_set_simple (caps,
@@ -1118,56 +1359,61 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id,
}
break;
- case CODEC_ID_MSVIDEO1:
+ case AV_CODEC_ID_MSVIDEO1:
caps =
- gst_ff_vid_caps_new (context, codec_id, encode,
+ gst_ff_vid_caps_new (context, NULL, codec_id, encode,
"video/x-msvideocodec", "msvideoversion", G_TYPE_INT, 1, NULL);
break;
- case CODEC_ID_WMV3:
- caps = gst_ff_vid_caps_new (context, codec_id, encode, "video/x-wmv",
- "wmvversion", G_TYPE_INT, 3, NULL);
+ case AV_CODEC_ID_WMV3:
+ caps =
+ gst_ff_vid_caps_new (context, NULL, codec_id, encode, "video/x-wmv",
+ "wmvversion", G_TYPE_INT, 3, "format", G_TYPE_STRING, "WMV3", NULL);
break;
- case CODEC_ID_VC1:
- caps = gst_ff_vid_caps_new (context, codec_id, encode, "video/x-wmv",
+ case AV_CODEC_ID_VC1:
+ caps =
+ gst_ff_vid_caps_new (context, NULL, codec_id, encode, "video/x-wmv",
"wmvversion", G_TYPE_INT, 3, "format", G_TYPE_STRING, "WVC1", NULL);
break;
- case CODEC_ID_QDM2:
+ case AV_CODEC_ID_QDM2:
caps =
- gst_ff_aud_caps_new (context, codec_id, encode, "audio/x-qdm2", NULL);
+ gst_ff_aud_caps_new (context, NULL, codec_id, encode, "audio/x-qdm2",
+ NULL);
break;
- case CODEC_ID_MSZH:
+ case AV_CODEC_ID_MSZH:
caps =
- gst_ff_vid_caps_new (context, codec_id, encode, "video/x-mszh", NULL);
+ gst_ff_vid_caps_new (context, NULL, codec_id, encode, "video/x-mszh",
+ NULL);
break;
- case CODEC_ID_ZLIB:
+ case AV_CODEC_ID_ZLIB:
caps =
- gst_ff_vid_caps_new (context, codec_id, encode, "video/x-zlib", NULL);
+ gst_ff_vid_caps_new (context, NULL, codec_id, encode, "video/x-zlib",
+ NULL);
break;
- case CODEC_ID_TRUEMOTION1:
+ case AV_CODEC_ID_TRUEMOTION1:
caps =
- gst_ff_vid_caps_new (context, codec_id, encode, "video/x-truemotion",
- "trueversion", G_TYPE_INT, 1, NULL);
+ gst_ff_vid_caps_new (context, NULL, codec_id, encode,
+ "video/x-truemotion", "trueversion", G_TYPE_INT, 1, NULL);
break;
- case CODEC_ID_TRUEMOTION2:
+ case AV_CODEC_ID_TRUEMOTION2:
caps =
- gst_ff_vid_caps_new (context, codec_id, encode, "video/x-truemotion",
- "trueversion", G_TYPE_INT, 2, NULL);
+ gst_ff_vid_caps_new (context, NULL, codec_id, encode,
+ "video/x-truemotion", "trueversion", G_TYPE_INT, 2, NULL);
break;
- case CODEC_ID_ULTI:
+ case AV_CODEC_ID_ULTI:
caps =
- gst_ff_vid_caps_new (context, codec_id, encode, "video/x-ultimotion",
- NULL);
+ gst_ff_vid_caps_new (context, NULL, codec_id, encode,
+ "video/x-ultimotion", NULL);
break;
- case CODEC_ID_TSCC:
+ case AV_CODEC_ID_TSCC:
caps =
- gst_ff_vid_caps_new (context, codec_id, encode, "video/x-camtasia",
- NULL);
+ gst_ff_vid_caps_new (context, NULL, codec_id, encode,
+ "video/x-camtasia", NULL);
if (context) {
gst_caps_set_simple (caps,
"depth", G_TYPE_INT, (gint) context->bits_per_coded_sample, NULL);
@@ -1176,144 +1422,166 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id,
}
break;
- case CODEC_ID_KMVC:
+ case AV_CODEC_ID_KMVC:
caps =
- gst_ff_vid_caps_new (context, codec_id, encode, "video/x-kmvc", NULL);
+ gst_ff_vid_caps_new (context, NULL, codec_id, encode, "video/x-kmvc",
+ NULL);
break;
- case CODEC_ID_NUV:
+ case AV_CODEC_ID_NUV:
caps =
- gst_ff_vid_caps_new (context, codec_id, encode, "video/x-nuv", NULL);
+ gst_ff_vid_caps_new (context, NULL, codec_id, encode, "video/x-nuv",
+ NULL);
break;
- case CODEC_ID_GIF:
- caps = gst_ff_vid_caps_new (context, codec_id, encode, "image/gif", NULL);
+ case AV_CODEC_ID_GIF:
+ caps =
+ gst_ff_vid_caps_new (context, NULL, codec_id, encode, "image/gif",
+ NULL);
break;
- case CODEC_ID_PNG:
- caps = gst_ff_vid_caps_new (context, codec_id, encode, "image/png", NULL);
+ case AV_CODEC_ID_PNG:
+ caps =
+ gst_ff_vid_caps_new (context, NULL, codec_id, encode, "image/png",
+ NULL);
break;
- case CODEC_ID_PPM:
- caps = gst_ff_vid_caps_new (context, codec_id, encode, "image/ppm", NULL);
+ case AV_CODEC_ID_PPM:
+ caps =
+ gst_ff_vid_caps_new (context, NULL, codec_id, encode, "image/ppm",
+ NULL);
break;
- case CODEC_ID_PBM:
- caps = gst_ff_vid_caps_new (context, codec_id, encode, "image/pbm", NULL);
+ case AV_CODEC_ID_PBM:
+ caps =
+ gst_ff_vid_caps_new (context, NULL, codec_id, encode, "image/pbm",
+ NULL);
break;
- case CODEC_ID_PAM:
+ case AV_CODEC_ID_PAM:
caps =
- gst_ff_vid_caps_new (context, codec_id, encode,
+ gst_ff_vid_caps_new (context, NULL, codec_id, encode,
"image/x-portable-anymap", NULL);
break;
- case CODEC_ID_PGM:
+ case AV_CODEC_ID_PGM:
caps =
- gst_ff_vid_caps_new (context, codec_id, encode,
+ gst_ff_vid_caps_new (context, NULL, codec_id, encode,
"image/x-portable-graymap", NULL);
break;
- case CODEC_ID_PCX:
+ case AV_CODEC_ID_PCX:
caps =
- gst_ff_vid_caps_new (context, codec_id, encode, "image/x-pcx", NULL);
- break;
-
- case CODEC_ID_SGI:
- caps =
- gst_ff_vid_caps_new (context, codec_id, encode, "image/x-sgi", NULL);
+ gst_ff_vid_caps_new (context, NULL, codec_id, encode, "image/x-pcx",
+ NULL);
break;
- case CODEC_ID_TARGA:
+ case AV_CODEC_ID_SGI:
caps =
- gst_ff_vid_caps_new (context, codec_id, encode, "image/x-tga", NULL);
+ gst_ff_vid_caps_new (context, NULL, codec_id, encode, "image/x-sgi",
+ NULL);
break;
- case CODEC_ID_TIFF:
+ case AV_CODEC_ID_TARGA:
caps =
- gst_ff_vid_caps_new (context, codec_id, encode, "image/tiff", NULL);
+ gst_ff_vid_caps_new (context, NULL, codec_id, encode, "image/x-tga",
+ NULL);
break;
- case CODEC_ID_SUNRAST:
+ case AV_CODEC_ID_TIFF:
caps =
- gst_ff_vid_caps_new (context, codec_id, encode, "image/x-sun-raster",
+ gst_ff_vid_caps_new (context, NULL, codec_id, encode, "image/tiff",
NULL);
break;
- case CODEC_ID_SMC:
+ case AV_CODEC_ID_SUNRAST:
caps =
- gst_ff_vid_caps_new (context, codec_id, encode, "video/x-smc", NULL);
+ gst_ff_vid_caps_new (context, NULL, codec_id, encode,
+ "image/x-sun-raster", NULL);
break;
- case CODEC_ID_QDRAW:
+ case AV_CODEC_ID_SMC:
caps =
- gst_ff_vid_caps_new (context, codec_id, encode, "video/x-qdrw", NULL);
+ gst_ff_vid_caps_new (context, NULL, codec_id, encode, "video/x-smc",
+ NULL);
break;
- case CODEC_ID_DNXHD:
+ case AV_CODEC_ID_QDRAW:
caps =
- gst_ff_vid_caps_new (context, codec_id, encode, "video/x-dnxhd",
+ gst_ff_vid_caps_new (context, NULL, codec_id, encode, "video/x-qdrw",
NULL);
break;
- case CODEC_ID_PRORES:
+ case AV_CODEC_ID_DNXHD:
caps =
- gst_ff_vid_caps_new (context, codec_id, encode, "video/x-prores",
+ gst_ff_vid_caps_new (context, NULL, codec_id, encode, "video/x-dnxhd",
NULL);
break;
- case CODEC_ID_MIMIC:
+ case AV_CODEC_ID_PRORES:
caps =
- gst_ff_vid_caps_new (context, codec_id, encode, "video/x-mimic",
- NULL);
+ gst_ff_vid_caps_new (context, NULL, codec_id, encode,
+ "video/x-prores", NULL);
break;
- case CODEC_ID_VMNC:
+ case AV_CODEC_ID_MIMIC:
caps =
- gst_ff_vid_caps_new (context, codec_id, encode, "video/x-vmnc", NULL);
+ gst_ff_vid_caps_new (context, NULL, codec_id, encode, "video/x-mimic",
+ NULL);
break;
- case CODEC_ID_TRUESPEECH:
+ case AV_CODEC_ID_VMNC:
caps =
- gst_ff_aud_caps_new (context, codec_id, encode, "audio/x-truespeech",
+ gst_ff_vid_caps_new (context, NULL, codec_id, encode, "video/x-vmnc",
NULL);
break;
- case CODEC_ID_QCELP:
+ case AV_CODEC_ID_TRUESPEECH:
caps =
- gst_ff_aud_caps_new (context, codec_id, encode, "audio/qcelp", NULL);
+ gst_ff_aud_caps_new (context, NULL, codec_id, encode,
+ "audio/x-truespeech", NULL);
break;
- case CODEC_ID_AMV:
+ case AV_CODEC_ID_QCELP:
caps =
- gst_ff_vid_caps_new (context, codec_id, encode, "video/x-amv", NULL);
+ gst_ff_aud_caps_new (context, NULL, codec_id, encode, "audio/qcelp",
+ NULL);
break;
- case CODEC_ID_AASC:
+ case AV_CODEC_ID_AMV:
caps =
- gst_ff_vid_caps_new (context, codec_id, encode, "video/x-aasc", NULL);
+ gst_ff_vid_caps_new (context, NULL, codec_id, encode, "video/x-amv",
+ NULL);
break;
- case CODEC_ID_LOCO:
+ case AV_CODEC_ID_AASC:
caps =
- gst_ff_vid_caps_new (context, codec_id, encode, "video/x-loco", NULL);
+ gst_ff_vid_caps_new (context, NULL, codec_id, encode, "video/x-aasc",
+ NULL);
break;
- case CODEC_ID_ZMBV:
+ case AV_CODEC_ID_LOCO:
caps =
- gst_ff_vid_caps_new (context, codec_id, encode, "video/x-zmbv", NULL);
+ gst_ff_vid_caps_new (context, NULL, codec_id, encode, "video/x-loco",
+ NULL);
break;
- case CODEC_ID_LAGARITH:
+ case AV_CODEC_ID_ZMBV:
caps =
- gst_ff_vid_caps_new (context, codec_id, encode, "video/x-lagarith",
+ gst_ff_vid_caps_new (context, NULL, codec_id, encode, "video/x-zmbv",
NULL);
break;
- case CODEC_ID_CSCD:
+ case AV_CODEC_ID_LAGARITH:
caps =
- gst_ff_vid_caps_new (context, codec_id, encode, "video/x-camstudio",
- NULL);
+ gst_ff_vid_caps_new (context, NULL, codec_id, encode,
+ "video/x-lagarith", NULL);
+ break;
+
+ case AV_CODEC_ID_CSCD:
+ caps =
+ gst_ff_vid_caps_new (context, NULL, codec_id, encode,
+ "video/x-camstudio", NULL);
if (context) {
gst_caps_set_simple (caps,
"depth", G_TYPE_INT, (gint) context->bits_per_coded_sample, NULL);
@@ -1322,56 +1590,54 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id,
}
break;
- case CODEC_ID_WS_VQA:
- case CODEC_ID_IDCIN:
- case CODEC_ID_8BPS:
- case CODEC_ID_FLIC:
- case CODEC_ID_VMDVIDEO:
- case CODEC_ID_VMDAUDIO:
- case CODEC_ID_SONIC:
- case CODEC_ID_SONIC_LS:
- case CODEC_ID_SNOW:
- case CODEC_ID_VIXL:
- case CODEC_ID_QPEG:
- case CODEC_ID_PGMYUV:
- case CODEC_ID_FFVHUFF:
- case CODEC_ID_WNV1:
- case CODEC_ID_MP3ADU:
- case CODEC_ID_MP3ON4:
- case CODEC_ID_WESTWOOD_SND1:
- case CODEC_ID_MMVIDEO:
- case CODEC_ID_AVS:
- case CODEC_ID_CAVS:
+ case AV_CODEC_ID_WS_VQA:
+ case AV_CODEC_ID_IDCIN:
+ case AV_CODEC_ID_8BPS:
+ case AV_CODEC_ID_FLIC:
+ case AV_CODEC_ID_VMDVIDEO:
+ case AV_CODEC_ID_VMDAUDIO:
+ case AV_CODEC_ID_SNOW:
+ case AV_CODEC_ID_VIXL:
+ case AV_CODEC_ID_QPEG:
+ case AV_CODEC_ID_PGMYUV:
+ case AV_CODEC_ID_FFVHUFF:
+ case AV_CODEC_ID_WNV1:
+ case AV_CODEC_ID_MP3ADU:
+ case AV_CODEC_ID_MP3ON4:
+ case AV_CODEC_ID_WESTWOOD_SND1:
+ case AV_CODEC_ID_MMVIDEO:
+ case AV_CODEC_ID_AVS:
+ case AV_CODEC_ID_CAVS:
buildcaps = TRUE;
break;
/* weird quasi-codecs for the demuxers only */
- case CODEC_ID_PCM_S16LE:
- case CODEC_ID_PCM_S16BE:
- case CODEC_ID_PCM_U16LE:
- case CODEC_ID_PCM_U16BE:
- case CODEC_ID_PCM_S8:
- case CODEC_ID_PCM_U8:
+ case AV_CODEC_ID_PCM_S16LE:
+ case AV_CODEC_ID_PCM_S16BE:
+ case AV_CODEC_ID_PCM_U16LE:
+ case AV_CODEC_ID_PCM_U16BE:
+ case AV_CODEC_ID_PCM_S8:
+ case AV_CODEC_ID_PCM_U8:
{
GstAudioFormat format;
switch (codec_id) {
- case CODEC_ID_PCM_S16LE:
+ case AV_CODEC_ID_PCM_S16LE:
format = GST_AUDIO_FORMAT_S16LE;
break;
- case CODEC_ID_PCM_S16BE:
+ case AV_CODEC_ID_PCM_S16BE:
format = GST_AUDIO_FORMAT_S16BE;
break;
- case CODEC_ID_PCM_U16LE:
+ case AV_CODEC_ID_PCM_U16LE:
format = GST_AUDIO_FORMAT_U16LE;
break;
- case CODEC_ID_PCM_U16BE:
+ case AV_CODEC_ID_PCM_U16BE:
format = GST_AUDIO_FORMAT_U16BE;
break;
- case CODEC_ID_PCM_S8:
+ case AV_CODEC_ID_PCM_S8:
format = GST_AUDIO_FORMAT_S8;
break;
- case CODEC_ID_PCM_U8:
+ case AV_CODEC_ID_PCM_U8:
format = GST_AUDIO_FORMAT_U8;
break;
default:
@@ -1379,36 +1645,40 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id,
break;
}
- caps = gst_ff_aud_caps_new (context, codec_id, encode, "audio/x-raw",
+ caps =
+ gst_ff_aud_caps_new (context, NULL, codec_id, encode, "audio/x-raw",
"format", G_TYPE_STRING, gst_audio_format_to_string (format),
"layout", G_TYPE_STRING, "interleaved", NULL);
}
break;
- case CODEC_ID_PCM_MULAW:
+ case AV_CODEC_ID_PCM_MULAW:
caps =
- gst_ff_aud_caps_new (context, codec_id, encode, "audio/x-mulaw",
+ gst_ff_aud_caps_new (context, NULL, codec_id, encode, "audio/x-mulaw",
NULL);
break;
- case CODEC_ID_PCM_ALAW:
+ case AV_CODEC_ID_PCM_ALAW:
caps =
- gst_ff_aud_caps_new (context, codec_id, encode, "audio/x-alaw", NULL);
+ gst_ff_aud_caps_new (context, NULL, codec_id, encode, "audio/x-alaw",
+ NULL);
break;
- case CODEC_ID_ADPCM_G722:
+ case AV_CODEC_ID_ADPCM_G722:
caps =
- gst_ff_aud_caps_new (context, codec_id, encode, "audio/G722", NULL);
+ gst_ff_aud_caps_new (context, NULL, codec_id, encode, "audio/G722",
+ NULL);
if (context)
gst_caps_set_simple (caps,
"block_align", G_TYPE_INT, context->block_align,
"bitrate", G_TYPE_INT, context->bit_rate, NULL);
break;
- case CODEC_ID_ADPCM_G726:
+ case AV_CODEC_ID_ADPCM_G726:
{
/* the G726 decoder can also handle G721 */
- caps = gst_ff_aud_caps_new (context, codec_id, encode, "audio/x-adpcm",
+ caps =
+ gst_ff_aud_caps_new (context, NULL, codec_id, encode, "audio/x-adpcm",
"layout", G_TYPE_STRING, "g726", NULL);
if (context)
gst_caps_set_simple (caps,
@@ -1422,116 +1692,116 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id,
}
break;
}
- case CODEC_ID_ADPCM_IMA_QT:
- case CODEC_ID_ADPCM_IMA_WAV:
- case CODEC_ID_ADPCM_IMA_DK3:
- case CODEC_ID_ADPCM_IMA_DK4:
- case CODEC_ID_ADPCM_IMA_WS:
- case CODEC_ID_ADPCM_IMA_SMJPEG:
- case CODEC_ID_ADPCM_IMA_AMV:
- case CODEC_ID_ADPCM_IMA_ISS:
- case CODEC_ID_ADPCM_IMA_EA_EACS:
- case CODEC_ID_ADPCM_IMA_EA_SEAD:
- case CODEC_ID_ADPCM_MS:
- case CODEC_ID_ADPCM_4XM:
- case CODEC_ID_ADPCM_XA:
- case CODEC_ID_ADPCM_ADX:
- case CODEC_ID_ADPCM_EA:
- case CODEC_ID_ADPCM_CT:
- case CODEC_ID_ADPCM_SWF:
- case CODEC_ID_ADPCM_YAMAHA:
- case CODEC_ID_ADPCM_SBPRO_2:
- case CODEC_ID_ADPCM_SBPRO_3:
- case CODEC_ID_ADPCM_SBPRO_4:
- case CODEC_ID_ADPCM_EA_R1:
- case CODEC_ID_ADPCM_EA_R2:
- case CODEC_ID_ADPCM_EA_R3:
- case CODEC_ID_ADPCM_EA_MAXIS_XA:
- case CODEC_ID_ADPCM_EA_XAS:
- case CODEC_ID_ADPCM_THP:
+ case AV_CODEC_ID_ADPCM_IMA_QT:
+ case AV_CODEC_ID_ADPCM_IMA_WAV:
+ case AV_CODEC_ID_ADPCM_IMA_DK3:
+ case AV_CODEC_ID_ADPCM_IMA_DK4:
+ case AV_CODEC_ID_ADPCM_IMA_WS:
+ case AV_CODEC_ID_ADPCM_IMA_SMJPEG:
+ case AV_CODEC_ID_ADPCM_IMA_AMV:
+ case AV_CODEC_ID_ADPCM_IMA_ISS:
+ case AV_CODEC_ID_ADPCM_IMA_EA_EACS:
+ case AV_CODEC_ID_ADPCM_IMA_EA_SEAD:
+ case AV_CODEC_ID_ADPCM_MS:
+ case AV_CODEC_ID_ADPCM_4XM:
+ case AV_CODEC_ID_ADPCM_XA:
+ case AV_CODEC_ID_ADPCM_ADX:
+ case AV_CODEC_ID_ADPCM_EA:
+ case AV_CODEC_ID_ADPCM_CT:
+ case AV_CODEC_ID_ADPCM_SWF:
+ case AV_CODEC_ID_ADPCM_YAMAHA:
+ case AV_CODEC_ID_ADPCM_SBPRO_2:
+ case AV_CODEC_ID_ADPCM_SBPRO_3:
+ case AV_CODEC_ID_ADPCM_SBPRO_4:
+ case AV_CODEC_ID_ADPCM_EA_R1:
+ case AV_CODEC_ID_ADPCM_EA_R2:
+ case AV_CODEC_ID_ADPCM_EA_R3:
+ case AV_CODEC_ID_ADPCM_EA_MAXIS_XA:
+ case AV_CODEC_ID_ADPCM_EA_XAS:
+ case AV_CODEC_ID_ADPCM_THP:
{
const gchar *layout = NULL;
switch (codec_id) {
- case CODEC_ID_ADPCM_IMA_QT:
+ case AV_CODEC_ID_ADPCM_IMA_QT:
layout = "quicktime";
break;
- case CODEC_ID_ADPCM_IMA_WAV:
+ case AV_CODEC_ID_ADPCM_IMA_WAV:
layout = "dvi";
break;
- case CODEC_ID_ADPCM_IMA_DK3:
+ case AV_CODEC_ID_ADPCM_IMA_DK3:
layout = "dk3";
break;
- case CODEC_ID_ADPCM_IMA_DK4:
+ case AV_CODEC_ID_ADPCM_IMA_DK4:
layout = "dk4";
break;
- case CODEC_ID_ADPCM_IMA_WS:
+ case AV_CODEC_ID_ADPCM_IMA_WS:
layout = "westwood";
break;
- case CODEC_ID_ADPCM_IMA_SMJPEG:
+ case AV_CODEC_ID_ADPCM_IMA_SMJPEG:
layout = "smjpeg";
break;
- case CODEC_ID_ADPCM_IMA_AMV:
+ case AV_CODEC_ID_ADPCM_IMA_AMV:
layout = "amv";
break;
- case CODEC_ID_ADPCM_IMA_ISS:
+ case AV_CODEC_ID_ADPCM_IMA_ISS:
layout = "iss";
break;
- case CODEC_ID_ADPCM_IMA_EA_EACS:
+ case AV_CODEC_ID_ADPCM_IMA_EA_EACS:
layout = "ea-eacs";
break;
- case CODEC_ID_ADPCM_IMA_EA_SEAD:
+ case AV_CODEC_ID_ADPCM_IMA_EA_SEAD:
layout = "ea-sead";
break;
- case CODEC_ID_ADPCM_MS:
+ case AV_CODEC_ID_ADPCM_MS:
layout = "microsoft";
break;
- case CODEC_ID_ADPCM_4XM:
+ case AV_CODEC_ID_ADPCM_4XM:
layout = "4xm";
break;
- case CODEC_ID_ADPCM_XA:
+ case AV_CODEC_ID_ADPCM_XA:
layout = "xa";
break;
- case CODEC_ID_ADPCM_ADX:
+ case AV_CODEC_ID_ADPCM_ADX:
layout = "adx";
break;
- case CODEC_ID_ADPCM_EA:
+ case AV_CODEC_ID_ADPCM_EA:
layout = "ea";
break;
- case CODEC_ID_ADPCM_CT:
+ case AV_CODEC_ID_ADPCM_CT:
layout = "ct";
break;
- case CODEC_ID_ADPCM_SWF:
+ case AV_CODEC_ID_ADPCM_SWF:
layout = "swf";
break;
- case CODEC_ID_ADPCM_YAMAHA:
+ case AV_CODEC_ID_ADPCM_YAMAHA:
layout = "yamaha";
break;
- case CODEC_ID_ADPCM_SBPRO_2:
+ case AV_CODEC_ID_ADPCM_SBPRO_2:
layout = "sbpro2";
break;
- case CODEC_ID_ADPCM_SBPRO_3:
+ case AV_CODEC_ID_ADPCM_SBPRO_3:
layout = "sbpro3";
break;
- case CODEC_ID_ADPCM_SBPRO_4:
+ case AV_CODEC_ID_ADPCM_SBPRO_4:
layout = "sbpro4";
break;
- case CODEC_ID_ADPCM_EA_R1:
+ case AV_CODEC_ID_ADPCM_EA_R1:
layout = "ea-r1";
break;
- case CODEC_ID_ADPCM_EA_R2:
+ case AV_CODEC_ID_ADPCM_EA_R2:
layout = "ea-r3";
break;
- case CODEC_ID_ADPCM_EA_R3:
+ case AV_CODEC_ID_ADPCM_EA_R3:
layout = "ea-r3";
break;
- case CODEC_ID_ADPCM_EA_MAXIS_XA:
+ case AV_CODEC_ID_ADPCM_EA_MAXIS_XA:
layout = "ea-maxis-xa";
break;
- case CODEC_ID_ADPCM_EA_XAS:
+ case AV_CODEC_ID_ADPCM_EA_XAS:
layout = "ea-xas";
break;
- case CODEC_ID_ADPCM_THP:
+ case AV_CODEC_ID_ADPCM_THP:
layout = "thp";
break;
default:
@@ -1541,7 +1811,8 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id,
/* FIXME: someone please check whether we need additional properties
* in this caps definition. */
- caps = gst_ff_aud_caps_new (context, codec_id, encode, "audio/x-adpcm",
+ caps =
+ gst_ff_aud_caps_new (context, NULL, codec_id, encode, "audio/x-adpcm",
"layout", G_TYPE_STRING, layout, NULL);
if (context)
gst_caps_set_simple (caps,
@@ -1550,35 +1821,40 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id,
}
break;
- case CODEC_ID_AMR_NB:
- caps = gst_ff_aud_caps_new (context, codec_id, encode, "audio/AMR", NULL);
+ case AV_CODEC_ID_AMR_NB:
+ caps =
+ gst_ff_aud_caps_new (context, NULL, codec_id, encode, "audio/AMR",
+ NULL);
break;
- case CODEC_ID_AMR_WB:
+ case AV_CODEC_ID_AMR_WB:
caps =
- gst_ff_aud_caps_new (context, codec_id, encode, "audio/AMR-WB", NULL);
+ gst_ff_aud_caps_new (context, NULL, codec_id, encode, "audio/AMR-WB",
+ NULL);
break;
- case CODEC_ID_GSM:
+ case AV_CODEC_ID_GSM:
caps =
- gst_ff_aud_caps_new (context, codec_id, encode, "audio/x-gsm", NULL);
+ gst_ff_aud_caps_new (context, NULL, codec_id, encode, "audio/x-gsm",
+ NULL);
break;
- case CODEC_ID_GSM_MS:
+ case AV_CODEC_ID_GSM_MS:
caps =
- gst_ff_aud_caps_new (context, codec_id, encode, "audio/ms-gsm", NULL);
+ gst_ff_aud_caps_new (context, NULL, codec_id, encode, "audio/ms-gsm",
+ NULL);
break;
- case CODEC_ID_NELLYMOSER:
+ case AV_CODEC_ID_NELLYMOSER:
caps =
- gst_ff_aud_caps_new (context, codec_id, encode, "audio/x-nellymoser",
- NULL);
+ gst_ff_aud_caps_new (context, NULL, codec_id, encode,
+ "audio/x-nellymoser", NULL);
break;
- case CODEC_ID_SIPR:
+ case AV_CODEC_ID_SIPR:
{
caps =
- gst_ff_aud_caps_new (context, codec_id, encode, "audio/x-sipro",
+ gst_ff_aud_caps_new (context, NULL, codec_id, encode, "audio/x-sipro",
NULL);
if (context) {
gst_caps_set_simple (caps,
@@ -1588,20 +1864,20 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id,
}
break;
- case CODEC_ID_RA_144:
- case CODEC_ID_RA_288:
- case CODEC_ID_COOK:
+ case AV_CODEC_ID_RA_144:
+ case AV_CODEC_ID_RA_288:
+ case AV_CODEC_ID_COOK:
{
gint version = 0;
switch (codec_id) {
- case CODEC_ID_RA_144:
+ case AV_CODEC_ID_RA_144:
version = 1;
break;
- case CODEC_ID_RA_288:
+ case AV_CODEC_ID_RA_288:
version = 2;
break;
- case CODEC_ID_COOK:
+ case AV_CODEC_ID_COOK:
version = 8;
break;
default:
@@ -1610,7 +1886,7 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id,
/* FIXME: properties? */
caps =
- gst_ff_aud_caps_new (context, codec_id, encode,
+ gst_ff_aud_caps_new (context, NULL, codec_id, encode,
"audio/x-pn-realaudio", "raversion", G_TYPE_INT, version, NULL);
if (context) {
gst_caps_set_simple (caps,
@@ -1620,24 +1896,24 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id,
}
break;
- case CODEC_ID_ROQ_DPCM:
- case CODEC_ID_INTERPLAY_DPCM:
- case CODEC_ID_XAN_DPCM:
- case CODEC_ID_SOL_DPCM:
+ case AV_CODEC_ID_ROQ_DPCM:
+ case AV_CODEC_ID_INTERPLAY_DPCM:
+ case AV_CODEC_ID_XAN_DPCM:
+ case AV_CODEC_ID_SOL_DPCM:
{
const gchar *layout = NULL;
switch (codec_id) {
- case CODEC_ID_ROQ_DPCM:
+ case AV_CODEC_ID_ROQ_DPCM:
layout = "roq";
break;
- case CODEC_ID_INTERPLAY_DPCM:
+ case AV_CODEC_ID_INTERPLAY_DPCM:
layout = "interplay";
break;
- case CODEC_ID_XAN_DPCM:
+ case AV_CODEC_ID_XAN_DPCM:
layout = "xan";
break;
- case CODEC_ID_SOL_DPCM:
+ case AV_CODEC_ID_SOL_DPCM:
layout = "sol";
break;
default:
@@ -1647,7 +1923,8 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id,
/* FIXME: someone please check whether we need additional properties
* in this caps definition. */
- caps = gst_ff_aud_caps_new (context, codec_id, encode, "audio/x-dpcm",
+ caps =
+ gst_ff_aud_caps_new (context, NULL, codec_id, encode, "audio/x-dpcm",
"layout", G_TYPE_STRING, layout, NULL);
if (context)
gst_caps_set_simple (caps,
@@ -1656,20 +1933,21 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id,
}
break;
- case CODEC_ID_SHORTEN:
+ case AV_CODEC_ID_SHORTEN:
caps = gst_caps_new_empty_simple ("audio/x-shorten");
break;
- case CODEC_ID_ALAC:
+ case AV_CODEC_ID_ALAC:
caps =
- gst_ff_aud_caps_new (context, codec_id, encode, "audio/x-alac", NULL);
+ gst_ff_aud_caps_new (context, NULL, codec_id, encode, "audio/x-alac",
+ NULL);
if (context) {
gst_caps_set_simple (caps,
"samplesize", G_TYPE_INT, context->bits_per_coded_sample, NULL);
}
break;
- case CODEC_ID_FLAC:
+ case AV_CODEC_ID_FLAC:
/* Note that ffmpeg has no encoder yet, but just for safety. In the
* encoder case, we want to add things like samplerate, channels... */
if (!encode) {
@@ -1677,25 +1955,30 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id,
}
break;
- case CODEC_ID_DVD_SUBTITLE:
- case CODEC_ID_DVB_SUBTITLE:
+ case AV_CODEC_ID_S302M:
+ caps = gst_caps_new_empty_simple ("audio/x-smpte-302m");
+ break;
+
+ case AV_CODEC_ID_DVD_SUBTITLE:
+ case AV_CODEC_ID_DVB_SUBTITLE:
caps = NULL;
break;
- case CODEC_ID_BMP:
+ case AV_CODEC_ID_BMP:
caps = gst_caps_new_empty_simple ("image/bmp");
break;
- case CODEC_ID_TTA:
+ case AV_CODEC_ID_TTA:
caps =
- gst_ff_aud_caps_new (context, codec_id, encode, "audio/x-tta", NULL);
+ gst_ff_aud_caps_new (context, NULL, codec_id, encode, "audio/x-tta",
+ NULL);
if (context) {
gst_caps_set_simple (caps,
"samplesize", G_TYPE_INT, context->bits_per_coded_sample, NULL);
}
break;
- case CODEC_ID_TWINVQ:
+ case AV_CODEC_ID_TWINVQ:
caps =
- gst_ff_aud_caps_new (context, codec_id, encode, "audio/x-twin-vq",
- NULL);
+ gst_ff_aud_caps_new (context, NULL, codec_id, encode,
+ "audio/x-twin-vq", NULL);
break;
default:
GST_DEBUG ("Unknown codec ID %d, please add mapping here", codec_id);
@@ -1714,12 +1997,14 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id,
switch (codec->type) {
case AVMEDIA_TYPE_VIDEO:
mime = g_strdup_printf ("video/x-gst-av-%s", codec->name);
- caps = gst_ff_vid_caps_new (context, codec_id, encode, mime, NULL);
+ caps =
+ gst_ff_vid_caps_new (context, NULL, codec_id, encode, mime, NULL);
g_free (mime);
break;
case AVMEDIA_TYPE_AUDIO:
mime = g_strdup_printf ("audio/x-gst-av-%s", codec->name);
- caps = gst_ff_aud_caps_new (context, codec_id, encode, mime, NULL);
+ caps =
+ gst_ff_aud_caps_new (context, NULL, codec_id, encode, mime, NULL);
if (context)
gst_caps_set_simple (caps,
"block_align", G_TYPE_INT, context->block_align,
@@ -1743,11 +2028,6 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id,
gst_buffer_unref (data);
}
- /* palette */
- if (context) {
- gst_ffmpeg_set_palette (caps, context);
- }
-
GST_LOG ("caps for codec_id=%d: %" GST_PTR_FORMAT, codec_id, caps);
} else {
@@ -1764,7 +2044,7 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id,
* See below for usefullness
*/
-GstCaps *
+static GstCaps *
gst_ffmpeg_pixfmt_to_caps (enum PixelFormat pix_fmt, AVCodecContext * context,
enum CodecID codec_id)
{
@@ -1774,7 +2054,7 @@ gst_ffmpeg_pixfmt_to_caps (enum PixelFormat pix_fmt, AVCodecContext * context,
format = gst_ffmpeg_pixfmt_to_videoformat (pix_fmt);
if (format != GST_VIDEO_FORMAT_UNKNOWN) {
- caps = gst_ff_vid_caps_new (context, codec_id, TRUE, "video/x-raw",
+ caps = gst_ff_vid_caps_new (context, NULL, codec_id, TRUE, "video/x-raw",
"format", G_TYPE_STRING, gst_video_format_to_string (format), NULL);
}
@@ -1787,41 +2067,55 @@ gst_ffmpeg_pixfmt_to_caps (enum PixelFormat pix_fmt, AVCodecContext * context,
return caps;
}
-/* Convert a FFMPEG Sample Format and optional AVCodecContext
- * to a GstCaps. If the context is ommitted, no fixed values
- * for video/audio size will be included in the GstCaps
- *
- * See below for usefullness
- */
-
-static GstCaps *
-gst_ffmpeg_smpfmt_to_caps (enum AVSampleFormat sample_fmt,
- AVCodecContext * context, enum CodecID codec_id)
+GstAudioFormat
+gst_ffmpeg_smpfmt_to_audioformat (enum AVSampleFormat sample_fmt)
{
- GstCaps *caps = NULL;
- GstAudioFormat format;
-
switch (sample_fmt) {
+ case AV_SAMPLE_FMT_U8:
+ case AV_SAMPLE_FMT_U8P:
+ return GST_AUDIO_FORMAT_U8;
+ break;
case AV_SAMPLE_FMT_S16:
- format = GST_AUDIO_FORMAT_S16;
+ case AV_SAMPLE_FMT_S16P:
+ return GST_AUDIO_FORMAT_S16;
break;
case AV_SAMPLE_FMT_S32:
- format = GST_AUDIO_FORMAT_S32;
+ case AV_SAMPLE_FMT_S32P:
+ return GST_AUDIO_FORMAT_S32;
break;
case AV_SAMPLE_FMT_FLT:
- format = GST_AUDIO_FORMAT_F32;
+ case AV_SAMPLE_FMT_FLTP:
+ return GST_AUDIO_FORMAT_F32;
break;
case AV_SAMPLE_FMT_DBL:
- format = GST_AUDIO_FORMAT_F64;
+ case AV_SAMPLE_FMT_DBLP:
+ return GST_AUDIO_FORMAT_F64;
break;
default:
/* .. */
- format = GST_AUDIO_FORMAT_UNKNOWN;
+ return GST_AUDIO_FORMAT_UNKNOWN;
break;
}
+}
+
+/* Convert a FFMPEG Sample Format and optional AVCodecContext
+ * to a GstCaps. If the context is ommitted, no fixed values
+ * for video/audio size will be included in the GstCaps
+ *
+ * See below for usefullness
+ */
+
+static GstCaps *
+gst_ffmpeg_smpfmt_to_caps (enum AVSampleFormat sample_fmt,
+ AVCodecContext * context, AVCodec * codec, enum CodecID codec_id)
+{
+ GstCaps *caps = NULL;
+ GstAudioFormat format;
+
+ format = gst_ffmpeg_smpfmt_to_audioformat (sample_fmt);
if (format != GST_AUDIO_FORMAT_UNKNOWN) {
- caps = gst_ff_aud_caps_new (context, codec_id, TRUE, "audio/x-raw",
+ caps = gst_ff_aud_caps_new (context, codec, codec_id, TRUE, "audio/x-raw",
"format", G_TYPE_STRING, gst_audio_format_to_string (format),
"layout", G_TYPE_STRING, "interleaved", NULL);
GST_LOG ("caps for sample_fmt=%d: %" GST_PTR_FORMAT, sample_fmt, caps);
@@ -1832,6 +2126,22 @@ gst_ffmpeg_smpfmt_to_caps (enum AVSampleFormat sample_fmt,
return caps;
}
+static gboolean
+caps_has_field (GstCaps * caps, const gchar * field)
+{
+ guint i, n;
+
+ n = gst_caps_get_size (caps);
+ for (i = 0; i < n; i++) {
+ GstStructure *s = gst_caps_get_structure (caps, i);
+
+ if (gst_structure_has_field (s, field))
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
GstCaps *
gst_ffmpeg_codectype_to_audio_caps (AVCodecContext * context,
enum CodecID codec_id, gboolean encode, AVCodec * codec)
@@ -1846,32 +2156,17 @@ gst_ffmpeg_codectype_to_audio_caps (AVCodecContext * context,
if (context) {
/* Specific codec context */
- caps = gst_ffmpeg_smpfmt_to_caps (context->sample_fmt, context, codec_id);
- } else if (codec && codec->sample_fmts) {
- GstCaps *temp;
- int i;
-
- caps = gst_caps_new_empty ();
- for (i = 0; codec->sample_fmts[i] != -1; i++) {
- temp =
- gst_ffmpeg_smpfmt_to_caps (codec->sample_fmts[i], context, codec_id);
- if (temp != NULL)
- gst_caps_append (caps, temp);
- }
+ caps =
+ gst_ffmpeg_smpfmt_to_caps (context->sample_fmt, context, codec,
+ codec_id);
} else {
- GstCaps *temp;
- enum AVSampleFormat i;
- AVCodecContext ctx = { 0, };
-
- ctx.channels = -1;
- caps = gst_caps_new_empty ();
- for (i = 0; i <= AV_SAMPLE_FMT_DBL; i++) {
- temp = gst_ffmpeg_smpfmt_to_caps (i, encode ? &ctx : NULL, codec_id);
- if (temp != NULL) {
- gst_caps_append (caps, temp);
- }
- }
+ caps = gst_ff_aud_caps_new (context, codec, codec_id, encode, "audio/x-raw",
+ "layout", G_TYPE_STRING, "interleaved", NULL);
+ if (!caps_has_field (caps, "format"))
+ gst_ffmpeg_audio_set_sample_fmts (caps,
+ codec ? codec->sample_fmts : NULL);
}
+
return caps;
}
@@ -1887,50 +2182,12 @@ gst_ffmpeg_codectype_to_video_caps (AVCodecContext * context,
if (context) {
caps = gst_ffmpeg_pixfmt_to_caps (context->pix_fmt, context, codec_id);
} else {
- GstCaps *temp;
- enum PixelFormat i;
- AVCodecContext ctx = { 0, };
-
- caps = gst_caps_new_empty ();
- for (i = 0; i < PIX_FMT_NB; i++) {
- ctx.width = -1;
- ctx.pix_fmt = i;
- temp = gst_ffmpeg_pixfmt_to_caps (i, encode ? &ctx : NULL, codec_id);
- if (temp != NULL) {
- gst_caps_append (caps, temp);
- }
- }
- }
- return caps;
-}
-
-/* Convert a FFMPEG codec Type and optional AVCodecContext
- * to a GstCaps. If the context is ommitted, no fixed values
- * for video/audio size will be included in the GstCaps
- *
- * AVMediaType is primarily meant for uncompressed data GstCaps!
- */
-
-GstCaps *
-gst_ffmpeg_codectype_to_caps (enum AVMediaType codec_type,
- AVCodecContext * context, enum CodecID codec_id, gboolean encode)
-{
- GstCaps *caps;
-
- switch (codec_type) {
- case AVMEDIA_TYPE_VIDEO:
- caps =
- gst_ffmpeg_codectype_to_video_caps (context, codec_id, encode, NULL);
- break;
- case AVMEDIA_TYPE_AUDIO:
- caps =
- gst_ffmpeg_codectype_to_audio_caps (context, codec_id, encode, NULL);
- break;
- default:
- caps = NULL;
- break;
+ caps =
+ gst_ff_vid_caps_new (context, codec, codec_id, encode, "video/x-raw",
+ NULL);
+ if (!caps_has_field (caps, "format"))
+ gst_ffmpeg_video_set_pix_fmts (caps, codec ? codec->pix_fmts : NULL);
}
-
return caps;
}
@@ -2033,8 +2290,6 @@ gst_ffmpeg_caps_to_pixfmt (const GstCaps * caps,
context->sample_aspect_ratio.num);
}
- gst_ffmpeg_get_palette (caps, context);
-
if (!raw)
return;
@@ -2182,6 +2437,11 @@ static const PixToFmt pixtofmttable[] = {
{GST_VIDEO_FORMAT_I420_10BE, PIX_FMT_YUV420P10BE},
{GST_VIDEO_FORMAT_I422_10LE, PIX_FMT_YUV422P10LE},
{GST_VIDEO_FORMAT_I422_10BE, PIX_FMT_YUV422P10BE},
+ {GST_VIDEO_FORMAT_Y444_10LE, PIX_FMT_YUV444P10LE},
+ {GST_VIDEO_FORMAT_Y444_10BE, PIX_FMT_YUV444P10BE},
+ {GST_VIDEO_FORMAT_GBR, PIX_FMT_GBRP},
+ {GST_VIDEO_FORMAT_GBR_10LE, PIX_FMT_GBRP10LE},
+ {GST_VIDEO_FORMAT_GBR_10BE, PIX_FMT_GBRP10BE},
};
GstVideoFormat
@@ -2230,6 +2490,112 @@ gst_ffmpeg_videoinfo_to_context (GstVideoInfo * info, AVCodecContext * context)
gst_ffmpeg_videoformat_to_pixfmt (GST_VIDEO_INFO_FORMAT (info));
}
+void
+gst_ffmpeg_audioinfo_to_context (GstAudioInfo * info, AVCodecContext * context)
+{
+ const AVCodec *codec;
+ const enum AVSampleFormat *smpl_fmts;
+ enum AVSampleFormat smpl_fmt = -1;
+
+ context->channels = info->channels;
+ context->sample_rate = info->rate;
+ context->channel_layout =
+ gst_ffmpeg_channel_positions_to_layout (info->position, info->channels);
+
+ codec = context->codec;
+
+ smpl_fmts = codec->sample_fmts;
+
+ switch (info->finfo->format) {
+ case GST_AUDIO_FORMAT_F32:
+ if (smpl_fmts) {
+ while (*smpl_fmts != -1) {
+ if (*smpl_fmts == AV_SAMPLE_FMT_FLT) {
+ smpl_fmt = *smpl_fmts;
+ break;
+ } else if (*smpl_fmts == AV_SAMPLE_FMT_FLTP) {
+ smpl_fmt = *smpl_fmts;
+ }
+
+ smpl_fmts++;
+ }
+ } else {
+ smpl_fmt = AV_SAMPLE_FMT_FLT;
+ }
+ break;
+ case GST_AUDIO_FORMAT_F64:
+ if (smpl_fmts) {
+ while (*smpl_fmts != -1) {
+ if (*smpl_fmts == AV_SAMPLE_FMT_DBL) {
+ smpl_fmt = *smpl_fmts;
+ break;
+ } else if (*smpl_fmts == AV_SAMPLE_FMT_DBLP) {
+ smpl_fmt = *smpl_fmts;
+ }
+
+ smpl_fmts++;
+ }
+ } else {
+ smpl_fmt = AV_SAMPLE_FMT_DBL;
+ }
+ break;
+ case GST_AUDIO_FORMAT_S32:
+ if (smpl_fmts) {
+ while (*smpl_fmts != -1) {
+ if (*smpl_fmts == AV_SAMPLE_FMT_S32) {
+ smpl_fmt = *smpl_fmts;
+ break;
+ } else if (*smpl_fmts == AV_SAMPLE_FMT_S32P) {
+ smpl_fmt = *smpl_fmts;
+ }
+
+ smpl_fmts++;
+ }
+ } else {
+ smpl_fmt = AV_SAMPLE_FMT_S32;
+ }
+ break;
+ case GST_AUDIO_FORMAT_S16:
+ if (smpl_fmts) {
+ while (*smpl_fmts != -1) {
+ if (*smpl_fmts == AV_SAMPLE_FMT_S16) {
+ smpl_fmt = *smpl_fmts;
+ break;
+ } else if (*smpl_fmts == AV_SAMPLE_FMT_S16P) {
+ smpl_fmt = *smpl_fmts;
+ }
+
+ smpl_fmts++;
+ }
+ } else {
+ smpl_fmt = AV_SAMPLE_FMT_S16;
+ }
+ break;
+ case GST_AUDIO_FORMAT_U8:
+ if (smpl_fmts) {
+ while (*smpl_fmts != -1) {
+ if (*smpl_fmts == AV_SAMPLE_FMT_U8) {
+ smpl_fmt = *smpl_fmts;
+ break;
+ } else if (*smpl_fmts == AV_SAMPLE_FMT_U8P) {
+ smpl_fmt = *smpl_fmts;
+ }
+
+ smpl_fmts++;
+ }
+ } else {
+ smpl_fmt = AV_SAMPLE_FMT_U8;
+ }
+ break;
+ default:
+ break;
+ }
+
+ g_assert (smpl_fmt != -1);
+
+ context->sample_fmt = smpl_fmt;
+}
+
/* Convert a GstCaps and a FFMPEG codec Type to a
* AVCodecContext. If the context is ommitted, no fixed values
* for video/audio size will be included in the context
@@ -2382,7 +2748,7 @@ gst_ffmpeg_caps_with_codecid (enum CodecID codec_id,
av_free (context->extradata);
#if 0
- if (codec_id == CODEC_ID_H264) {
+ if (codec_id == AV_CODEC_ID_H264) {
guint extrasize;
GST_DEBUG ("copy, escaping codec_data %d", size);
@@ -2412,15 +2778,15 @@ gst_ffmpeg_caps_with_codecid (enum CodecID codec_id,
}
/* Hack for VC1. Sometimes the first (length) byte is 0 for some files */
- if (codec_id == CODEC_ID_VC1 && map.size > 0 && map.data[0] == 0) {
+ if (codec_id == AV_CODEC_ID_VC1 && map.size > 0 && map.data[0] == 0) {
context->extradata[0] = (guint8) map.size;
}
GST_DEBUG ("have codec data of size %" G_GSIZE_FORMAT, map.size);
gst_buffer_unmap (buf, &map);
- } else if (context->extradata == NULL && codec_id != CODEC_ID_AAC_LATM &&
- codec_id != CODEC_ID_FLAC) {
+ } else if (context->extradata == NULL && codec_id != AV_CODEC_ID_AAC_LATM &&
+ codec_id != AV_CODEC_ID_FLAC) {
/* no extradata, alloc dummy with 0 sized, some codecs insist on reading
* extradata anyway which makes then segfault. */
context->extradata =
@@ -2430,7 +2796,7 @@ gst_ffmpeg_caps_with_codecid (enum CodecID codec_id,
}
switch (codec_id) {
- case CODEC_ID_MPEG4:
+ case AV_CODEC_ID_MPEG4:
{
const gchar *mime = gst_structure_get_name (str);
@@ -2445,7 +2811,7 @@ gst_ffmpeg_caps_with_codecid (enum CodecID codec_id,
}
break;
- case CODEC_ID_SVQ3:
+ case AV_CODEC_ID_SVQ3:
/* FIXME: this is a workaround for older gst-plugins releases
* (<= 0.8.9). This should be removed at some point, because
* it causes wrong decoded frame order. */
@@ -2478,11 +2844,11 @@ gst_ffmpeg_caps_with_codecid (enum CodecID codec_id,
}
break;
- case CODEC_ID_MSRLE:
- case CODEC_ID_QTRLE:
- case CODEC_ID_TSCC:
- case CODEC_ID_CSCD:
- case CODEC_ID_APE:
+ case AV_CODEC_ID_MSRLE:
+ case AV_CODEC_ID_QTRLE:
+ case AV_CODEC_ID_TSCC:
+ case AV_CODEC_ID_CSCD:
+ case AV_CODEC_ID_APE:
{
gint depth;
@@ -2495,10 +2861,10 @@ gst_ffmpeg_caps_with_codecid (enum CodecID codec_id,
}
break;
- case CODEC_ID_RV10:
- case CODEC_ID_RV20:
- case CODEC_ID_RV30:
- case CODEC_ID_RV40:
+ case AV_CODEC_ID_RV10:
+ case AV_CODEC_ID_RV20:
+ case AV_CODEC_ID_RV30:
+ case AV_CODEC_ID_RV40:
{
gint format;
@@ -2507,10 +2873,10 @@ gst_ffmpeg_caps_with_codecid (enum CodecID codec_id,
break;
}
- case CODEC_ID_COOK:
- case CODEC_ID_RA_288:
- case CODEC_ID_RA_144:
- case CODEC_ID_SIPR:
+ case AV_CODEC_ID_COOK:
+ case AV_CODEC_ID_RA_288:
+ case AV_CODEC_ID_RA_144:
+ case AV_CODEC_ID_SIPR:
{
gint leaf_size;
gint bitrate;
@@ -2520,12 +2886,12 @@ gst_ffmpeg_caps_with_codecid (enum CodecID codec_id,
if (gst_structure_get_int (str, "bitrate", &bitrate))
context->bit_rate = bitrate;
}
- case CODEC_ID_ALAC:
+ case AV_CODEC_ID_ALAC:
gst_structure_get_int (str, "samplesize",
&context->bits_per_coded_sample);
break;
- case CODEC_ID_DVVIDEO:
+ case AV_CODEC_ID_DVVIDEO:
{
const gchar *format;
@@ -2551,7 +2917,7 @@ gst_ffmpeg_caps_with_codecid (enum CodecID codec_id,
GST_WARNING ("No specified format");
break;
}
- case CODEC_ID_H263P:
+ case AV_CODEC_ID_H263P:
{
gboolean val;
@@ -2570,7 +2936,7 @@ gst_ffmpeg_caps_with_codecid (enum CodecID codec_id,
context->flags &= ~CODEC_FLAG_LOOP_FILTER;
break;
}
- case CODEC_ID_ADPCM_G726:
+ case AV_CODEC_ID_ADPCM_G726:
{
const gchar *layout;
@@ -2593,7 +2959,8 @@ gst_ffmpeg_caps_with_codecid (enum CodecID codec_id,
/* common properties (width, height, fps) */
switch (codec_type) {
case AVMEDIA_TYPE_VIDEO:
- gst_ffmpeg_caps_to_pixfmt (caps, context, codec_id == CODEC_ID_RAWVIDEO);
+ gst_ffmpeg_caps_to_pixfmt (caps, context,
+ codec_id == AV_CODEC_ID_RAWVIDEO);
break;
case AVMEDIA_TYPE_AUDIO:
gst_ffmpeg_caps_to_smpfmt (caps, context, FALSE);
@@ -2604,11 +2971,11 @@ gst_ffmpeg_caps_with_codecid (enum CodecID codec_id,
/* fixup of default settings */
switch (codec_id) {
- case CODEC_ID_QCELP:
+ case AV_CODEC_ID_QCELP:
/* QCELP is always mono, no matter what the caps say */
context->channels = 1;
break;
- case CODEC_ID_ADPCM_G726:
+ case AV_CODEC_ID_ADPCM_G726:
if (context->sample_rate && context->bit_rate)
context->bits_per_coded_sample =
context->bit_rate / context->sample_rate;
@@ -2731,153 +3098,161 @@ gst_ffmpeg_formatid_get_codecids (const gchar * format_name,
AVOutputFormat * plugin)
{
static enum CodecID tmp_vlist[] = {
- CODEC_ID_NONE,
- CODEC_ID_NONE
+ AV_CODEC_ID_NONE,
+ AV_CODEC_ID_NONE
};
static enum CodecID tmp_alist[] = {
- CODEC_ID_NONE,
- CODEC_ID_NONE
+ AV_CODEC_ID_NONE,
+ AV_CODEC_ID_NONE
};
GST_LOG ("format_name : %s", format_name);
if (!strcmp (format_name, "mp4")) {
static enum CodecID mp4_video_list[] = {
- CODEC_ID_MPEG4, CODEC_ID_H264,
- CODEC_ID_MJPEG,
- CODEC_ID_NONE
+ AV_CODEC_ID_MPEG4, AV_CODEC_ID_H264,
+ AV_CODEC_ID_MJPEG,
+ AV_CODEC_ID_NONE
};
static enum CodecID mp4_audio_list[] = {
- CODEC_ID_AAC, CODEC_ID_MP3,
- CODEC_ID_NONE
+ AV_CODEC_ID_AAC, AV_CODEC_ID_MP3,
+ AV_CODEC_ID_NONE
};
*video_codec_list = mp4_video_list;
*audio_codec_list = mp4_audio_list;
} else if (!strcmp (format_name, "mpeg")) {
- static enum CodecID mpeg_video_list[] = { CODEC_ID_MPEG1VIDEO,
- CODEC_ID_MPEG2VIDEO,
- CODEC_ID_H264,
- CODEC_ID_NONE
+ static enum CodecID mpeg_video_list[] = { AV_CODEC_ID_MPEG1VIDEO,
+ AV_CODEC_ID_MPEG2VIDEO,
+ AV_CODEC_ID_H264,
+ AV_CODEC_ID_NONE
};
- static enum CodecID mpeg_audio_list[] = { CODEC_ID_MP1,
- CODEC_ID_MP2,
- CODEC_ID_MP3,
- CODEC_ID_NONE
+ static enum CodecID mpeg_audio_list[] = { AV_CODEC_ID_MP1,
+ AV_CODEC_ID_MP2,
+ AV_CODEC_ID_MP3,
+ AV_CODEC_ID_NONE
};
*video_codec_list = mpeg_video_list;
*audio_codec_list = mpeg_audio_list;
} else if (!strcmp (format_name, "dvd")) {
- static enum CodecID mpeg_video_list[] = { CODEC_ID_MPEG2VIDEO,
- CODEC_ID_NONE
+ static enum CodecID mpeg_video_list[] = { AV_CODEC_ID_MPEG2VIDEO,
+ AV_CODEC_ID_NONE
};
- static enum CodecID mpeg_audio_list[] = { CODEC_ID_MP2,
- CODEC_ID_AC3,
- CODEC_ID_DTS,
- CODEC_ID_PCM_S16BE,
- CODEC_ID_NONE
+ static enum CodecID mpeg_audio_list[] = { AV_CODEC_ID_MP2,
+ AV_CODEC_ID_AC3,
+ AV_CODEC_ID_DTS,
+ AV_CODEC_ID_PCM_S16BE,
+ AV_CODEC_ID_NONE
};
*video_codec_list = mpeg_video_list;
*audio_codec_list = mpeg_audio_list;
} else if (!strcmp (format_name, "mpegts")) {
- static enum CodecID mpegts_video_list[] = { CODEC_ID_MPEG1VIDEO,
- CODEC_ID_MPEG2VIDEO,
- CODEC_ID_H264,
- CODEC_ID_NONE
+ static enum CodecID mpegts_video_list[] = { AV_CODEC_ID_MPEG1VIDEO,
+ AV_CODEC_ID_MPEG2VIDEO,
+ AV_CODEC_ID_H264,
+ AV_CODEC_ID_NONE
};
- static enum CodecID mpegts_audio_list[] = { CODEC_ID_MP2,
- CODEC_ID_MP3,
- CODEC_ID_AC3,
- CODEC_ID_DTS,
- CODEC_ID_AAC,
- CODEC_ID_NONE
+ static enum CodecID mpegts_audio_list[] = { AV_CODEC_ID_MP2,
+ AV_CODEC_ID_MP3,
+ AV_CODEC_ID_AC3,
+ AV_CODEC_ID_DTS,
+ AV_CODEC_ID_AAC,
+ AV_CODEC_ID_NONE
};
*video_codec_list = mpegts_video_list;
*audio_codec_list = mpegts_audio_list;
} else if (!strcmp (format_name, "vob")) {
static enum CodecID vob_video_list[] =
- { CODEC_ID_MPEG2VIDEO, CODEC_ID_NONE };
- static enum CodecID vob_audio_list[] = { CODEC_ID_MP2, CODEC_ID_AC3,
- CODEC_ID_DTS, CODEC_ID_NONE
+ { AV_CODEC_ID_MPEG2VIDEO, AV_CODEC_ID_NONE };
+ static enum CodecID vob_audio_list[] = { AV_CODEC_ID_MP2, AV_CODEC_ID_AC3,
+ AV_CODEC_ID_DTS, AV_CODEC_ID_NONE
};
*video_codec_list = vob_video_list;
*audio_codec_list = vob_audio_list;
} else if (!strcmp (format_name, "flv")) {
- static enum CodecID flv_video_list[] = { CODEC_ID_FLV1, CODEC_ID_NONE };
- static enum CodecID flv_audio_list[] = { CODEC_ID_MP3, CODEC_ID_NONE };
+ static enum CodecID flv_video_list[] =
+ { AV_CODEC_ID_FLV1, AV_CODEC_ID_NONE };
+ static enum CodecID flv_audio_list[] =
+ { AV_CODEC_ID_MP3, AV_CODEC_ID_NONE };
*video_codec_list = flv_video_list;
*audio_codec_list = flv_audio_list;
} else if (!strcmp (format_name, "asf")) {
static enum CodecID asf_video_list[] =
- { CODEC_ID_WMV1, CODEC_ID_WMV2, CODEC_ID_MSMPEG4V3, CODEC_ID_NONE };
+ { AV_CODEC_ID_WMV1, AV_CODEC_ID_WMV2, AV_CODEC_ID_MSMPEG4V3,
+ AV_CODEC_ID_NONE
+ };
static enum CodecID asf_audio_list[] =
- { CODEC_ID_WMAV1, CODEC_ID_WMAV2, CODEC_ID_MP3, CODEC_ID_NONE };
+ { AV_CODEC_ID_WMAV1, AV_CODEC_ID_WMAV2, AV_CODEC_ID_MP3,
+ AV_CODEC_ID_NONE
+ };
*video_codec_list = asf_video_list;
*audio_codec_list = asf_audio_list;
} else if (!strcmp (format_name, "dv")) {
- static enum CodecID dv_video_list[] = { CODEC_ID_DVVIDEO, CODEC_ID_NONE };
- static enum CodecID dv_audio_list[] = { CODEC_ID_PCM_S16LE, CODEC_ID_NONE };
+ static enum CodecID dv_video_list[] =
+ { AV_CODEC_ID_DVVIDEO, AV_CODEC_ID_NONE };
+ static enum CodecID dv_audio_list[] =
+ { AV_CODEC_ID_PCM_S16LE, AV_CODEC_ID_NONE };
*video_codec_list = dv_video_list;
*audio_codec_list = dv_audio_list;
} else if (!strcmp (format_name, "mov")) {
static enum CodecID mov_video_list[] = {
- CODEC_ID_SVQ1, CODEC_ID_SVQ3, CODEC_ID_MPEG4,
- CODEC_ID_H263, CODEC_ID_H263P,
- CODEC_ID_H264, CODEC_ID_DVVIDEO,
- CODEC_ID_MJPEG,
- CODEC_ID_NONE
+ AV_CODEC_ID_SVQ1, AV_CODEC_ID_SVQ3, AV_CODEC_ID_MPEG4,
+ AV_CODEC_ID_H263, AV_CODEC_ID_H263P,
+ AV_CODEC_ID_H264, AV_CODEC_ID_DVVIDEO,
+ AV_CODEC_ID_MJPEG,
+ AV_CODEC_ID_NONE
};
static enum CodecID mov_audio_list[] = {
- CODEC_ID_PCM_MULAW, CODEC_ID_PCM_ALAW, CODEC_ID_ADPCM_IMA_QT,
- CODEC_ID_MACE3, CODEC_ID_MACE6, CODEC_ID_AAC,
- CODEC_ID_AMR_NB, CODEC_ID_AMR_WB,
- CODEC_ID_PCM_S16BE, CODEC_ID_PCM_S16LE,
- CODEC_ID_MP3, CODEC_ID_NONE
+ AV_CODEC_ID_PCM_MULAW, AV_CODEC_ID_PCM_ALAW, AV_CODEC_ID_ADPCM_IMA_QT,
+ AV_CODEC_ID_MACE3, AV_CODEC_ID_MACE6, AV_CODEC_ID_AAC,
+ AV_CODEC_ID_AMR_NB, AV_CODEC_ID_AMR_WB,
+ AV_CODEC_ID_PCM_S16BE, AV_CODEC_ID_PCM_S16LE,
+ AV_CODEC_ID_MP3, AV_CODEC_ID_NONE
};
*video_codec_list = mov_video_list;
*audio_codec_list = mov_audio_list;
} else if ((!strcmp (format_name, "3gp") || !strcmp (format_name, "3g2"))) {
static enum CodecID tgp_video_list[] = {
- CODEC_ID_MPEG4, CODEC_ID_H263, CODEC_ID_H263P, CODEC_ID_H264,
- CODEC_ID_NONE
+ AV_CODEC_ID_MPEG4, AV_CODEC_ID_H263, AV_CODEC_ID_H263P, AV_CODEC_ID_H264,
+ AV_CODEC_ID_NONE
};
static enum CodecID tgp_audio_list[] = {
- CODEC_ID_AMR_NB, CODEC_ID_AMR_WB,
- CODEC_ID_AAC,
- CODEC_ID_NONE
+ AV_CODEC_ID_AMR_NB, AV_CODEC_ID_AMR_WB,
+ AV_CODEC_ID_AAC,
+ AV_CODEC_ID_NONE
};
*video_codec_list = tgp_video_list;
*audio_codec_list = tgp_audio_list;
} else if (!strcmp (format_name, "mmf")) {
static enum CodecID mmf_audio_list[] = {
- CODEC_ID_ADPCM_YAMAHA, CODEC_ID_NONE
+ AV_CODEC_ID_ADPCM_YAMAHA, AV_CODEC_ID_NONE
};
*video_codec_list = NULL;
*audio_codec_list = mmf_audio_list;
} else if (!strcmp (format_name, "amr")) {
static enum CodecID amr_audio_list[] = {
- CODEC_ID_AMR_NB, CODEC_ID_AMR_WB,
- CODEC_ID_NONE
+ AV_CODEC_ID_AMR_NB, AV_CODEC_ID_AMR_WB,
+ AV_CODEC_ID_NONE
};
*video_codec_list = NULL;
*audio_codec_list = amr_audio_list;
} else if (!strcmp (format_name, "gif")) {
static enum CodecID gif_image_list[] = {
- CODEC_ID_RAWVIDEO, CODEC_ID_NONE
+ AV_CODEC_ID_RAWVIDEO, AV_CODEC_ID_NONE
};
*video_codec_list = gif_image_list;
*audio_codec_list = NULL;
- } else if ((plugin->audio_codec != CODEC_ID_NONE) ||
- (plugin->video_codec != CODEC_ID_NONE)) {
+ } else if ((plugin->audio_codec != AV_CODEC_ID_NONE) ||
+ (plugin->video_codec != AV_CODEC_ID_NONE)) {
tmp_vlist[0] = plugin->video_codec;
tmp_alist[0] = plugin->audio_codec;
@@ -2901,19 +3276,19 @@ gst_ffmpeg_formatid_get_codecids (const gchar * format_name,
enum CodecID
gst_ffmpeg_caps_to_codecid (const GstCaps * caps, AVCodecContext * context)
{
- enum CodecID id = CODEC_ID_NONE;
+ enum CodecID id = AV_CODEC_ID_NONE;
const gchar *mimetype;
const GstStructure *structure;
gboolean video = FALSE, audio = FALSE; /* we want to be sure! */
- g_return_val_if_fail (caps != NULL, CODEC_ID_NONE);
- g_return_val_if_fail (gst_caps_get_size (caps) == 1, CODEC_ID_NONE);
+ g_return_val_if_fail (caps != NULL, AV_CODEC_ID_NONE);
+ g_return_val_if_fail (gst_caps_get_size (caps) == 1, AV_CODEC_ID_NONE);
structure = gst_caps_get_structure (caps, 0);
mimetype = gst_structure_get_name (structure);
if (!strcmp (mimetype, "video/x-raw")) {
- id = CODEC_ID_RAWVIDEO;
+ id = AV_CODEC_ID_RAWVIDEO;
video = TRUE;
} else if (!strcmp (mimetype, "audio/x-raw")) {
GstAudioInfo info;
@@ -2921,59 +3296,59 @@ gst_ffmpeg_caps_to_codecid (const GstCaps * caps, AVCodecContext * context)
if (gst_audio_info_from_caps (&info, caps)) {
switch (GST_AUDIO_INFO_FORMAT (&info)) {
case GST_AUDIO_FORMAT_S8:
- id = CODEC_ID_PCM_S8;
+ id = AV_CODEC_ID_PCM_S8;
break;
case GST_AUDIO_FORMAT_U8:
- id = CODEC_ID_PCM_U8;
+ id = AV_CODEC_ID_PCM_U8;
break;
case GST_AUDIO_FORMAT_S16LE:
- id = CODEC_ID_PCM_S16LE;
+ id = AV_CODEC_ID_PCM_S16LE;
break;
case GST_AUDIO_FORMAT_S16BE:
- id = CODEC_ID_PCM_S16BE;
+ id = AV_CODEC_ID_PCM_S16BE;
break;
case GST_AUDIO_FORMAT_U16LE:
- id = CODEC_ID_PCM_U16LE;
+ id = AV_CODEC_ID_PCM_U16LE;
break;
case GST_AUDIO_FORMAT_U16BE:
- id = CODEC_ID_PCM_U16BE;
+ id = AV_CODEC_ID_PCM_U16BE;
break;
default:
break;
}
- if (id != CODEC_ID_NONE)
+ if (id != AV_CODEC_ID_NONE)
audio = TRUE;
}
} else if (!strcmp (mimetype, "audio/x-mulaw")) {
- id = CODEC_ID_PCM_MULAW;
+ id = AV_CODEC_ID_PCM_MULAW;
audio = TRUE;
} else if (!strcmp (mimetype, "audio/x-alaw")) {
- id = CODEC_ID_PCM_ALAW;
+ id = AV_CODEC_ID_PCM_ALAW;
audio = TRUE;
} else if (!strcmp (mimetype, "video/x-dv")) {
gboolean sys_strm;
if (gst_structure_get_boolean (structure, "systemstream", &sys_strm) &&
!sys_strm) {
- id = CODEC_ID_DVVIDEO;
+ id = AV_CODEC_ID_DVVIDEO;
video = TRUE;
}
} else if (!strcmp (mimetype, "audio/x-dv")) { /* ??? */
- id = CODEC_ID_DVAUDIO;
+ id = AV_CODEC_ID_DVAUDIO;
audio = TRUE;
} else if (!strcmp (mimetype, "video/x-h263")) {
const gchar *h263version =
gst_structure_get_string (structure, "h263version");
if (h263version && !strcmp (h263version, "h263p"))
- id = CODEC_ID_H263P;
+ id = AV_CODEC_ID_H263P;
else
- id = CODEC_ID_H263;
+ id = AV_CODEC_ID_H263;
video = TRUE;
} else if (!strcmp (mimetype, "video/x-intel-h263")) {
- id = CODEC_ID_H263I;
+ id = AV_CODEC_ID_H263I;
video = TRUE;
} else if (!strcmp (mimetype, "video/x-h261")) {
- id = CODEC_ID_H261;
+ id = AV_CODEC_ID_H261;
video = TRUE;
} else if (!strcmp (mimetype, "video/mpeg")) {
gboolean sys_strm;
@@ -2984,23 +3359,23 @@ gst_ffmpeg_caps_to_codecid (const GstCaps * caps, AVCodecContext * context)
!sys_strm) {
switch (mpegversion) {
case 1:
- id = CODEC_ID_MPEG1VIDEO;
+ id = AV_CODEC_ID_MPEG1VIDEO;
break;
case 2:
- id = CODEC_ID_MPEG2VIDEO;
+ id = AV_CODEC_ID_MPEG2VIDEO;
break;
case 4:
- id = CODEC_ID_MPEG4;
+ id = AV_CODEC_ID_MPEG4;
break;
}
}
- if (id != CODEC_ID_NONE)
+ if (id != AV_CODEC_ID_NONE)
video = TRUE;
} else if (!strcmp (mimetype, "image/jpeg")) {
- id = CODEC_ID_MJPEG; /* A... B... */
+ id = AV_CODEC_ID_MJPEG; /* A... B... */
video = TRUE;
} else if (!strcmp (mimetype, "video/x-jpeg-b")) {
- id = CODEC_ID_MJPEGB;
+ id = AV_CODEC_ID_MJPEGB;
video = TRUE;
} else if (!strcmp (mimetype, "video/x-wmv")) {
gint wmvversion = 0;
@@ -3008,33 +3383,33 @@ gst_ffmpeg_caps_to_codecid (const GstCaps * caps, AVCodecContext * context)
if (gst_structure_get_int (structure, "wmvversion", &wmvversion)) {
switch (wmvversion) {
case 1:
- id = CODEC_ID_WMV1;
+ id = AV_CODEC_ID_WMV1;
break;
case 2:
- id = CODEC_ID_WMV2;
+ id = AV_CODEC_ID_WMV2;
break;
case 3:
{
const gchar *format;
/* WMV3 unless the fourcc exists and says otherwise */
- id = CODEC_ID_WMV3;
+ id = AV_CODEC_ID_WMV3;
if ((format = gst_structure_get_string (structure, "format")) &&
(g_str_equal (format, "WVC1") || g_str_equal (format, "WMVA")))
- id = CODEC_ID_VC1;
+ id = AV_CODEC_ID_VC1;
break;
}
}
}
- if (id != CODEC_ID_NONE)
+ if (id != AV_CODEC_ID_NONE)
video = TRUE;
} else if (!strcmp (mimetype, "audio/x-vorbis")) {
- id = CODEC_ID_VORBIS;
+ id = AV_CODEC_ID_VORBIS;
audio = TRUE;
} else if (!strcmp (mimetype, "audio/x-qdm2")) {
- id = CODEC_ID_QDM2;
+ id = AV_CODEC_ID_QDM2;
audio = TRUE;
} else if (!strcmp (mimetype, "audio/mpeg")) {
gint layer = 0;
@@ -3044,34 +3419,34 @@ gst_ffmpeg_caps_to_codecid (const GstCaps * caps, AVCodecContext * context)
switch (mpegversion) {
case 2: /* ffmpeg uses faad for both... */
case 4:
- id = CODEC_ID_AAC;
+ id = AV_CODEC_ID_AAC;
break;
case 1:
if (gst_structure_get_int (structure, "layer", &layer)) {
switch (layer) {
case 1:
- id = CODEC_ID_MP1;
+ id = AV_CODEC_ID_MP1;
break;
case 2:
- id = CODEC_ID_MP2;
+ id = AV_CODEC_ID_MP2;
break;
case 3:
- id = CODEC_ID_MP3;
+ id = AV_CODEC_ID_MP3;
break;
}
}
}
}
- if (id != CODEC_ID_NONE)
+ if (id != AV_CODEC_ID_NONE)
audio = TRUE;
} else if (!strcmp (mimetype, "audio/x-musepack")) {
gint streamversion = -1;
if (gst_structure_get_int (structure, "streamversion", &streamversion)) {
if (streamversion == 7)
- id = CODEC_ID_MUSEPACK7;
+ id = AV_CODEC_ID_MUSEPACK7;
} else {
- id = CODEC_ID_MUSEPACK7;
+ id = AV_CODEC_ID_MUSEPACK7;
}
} else if (!strcmp (mimetype, "audio/x-wma")) {
gint wmaversion = 0;
@@ -3079,36 +3454,36 @@ gst_ffmpeg_caps_to_codecid (const GstCaps * caps, AVCodecContext * context)
if (gst_structure_get_int (structure, "wmaversion", &wmaversion)) {
switch (wmaversion) {
case 1:
- id = CODEC_ID_WMAV1;
+ id = AV_CODEC_ID_WMAV1;
break;
case 2:
- id = CODEC_ID_WMAV2;
+ id = AV_CODEC_ID_WMAV2;
break;
case 3:
- id = CODEC_ID_WMAPRO;
+ id = AV_CODEC_ID_WMAPRO;
break;
}
}
- if (id != CODEC_ID_NONE)
+ if (id != AV_CODEC_ID_NONE)
audio = TRUE;
} else if (!strcmp (mimetype, "audio/x-wms")) {
- id = CODEC_ID_WMAVOICE;
+ id = AV_CODEC_ID_WMAVOICE;
audio = TRUE;
} else if (!strcmp (mimetype, "audio/x-ac3")) {
- id = CODEC_ID_AC3;
+ id = AV_CODEC_ID_AC3;
audio = TRUE;
} else if (!strcmp (mimetype, "audio/x-eac3")) {
- id = CODEC_ID_EAC3;
+ id = AV_CODEC_ID_EAC3;
audio = TRUE;
} else if (!strcmp (mimetype, "audio/x-vnd.sony.atrac3") ||
!strcmp (mimetype, "audio/atrac3")) {
- id = CODEC_ID_ATRAC3;
+ id = AV_CODEC_ID_ATRAC3;
audio = TRUE;
} else if (!strcmp (mimetype, "audio/x-dts")) {
- id = CODEC_ID_DTS;
+ id = AV_CODEC_ID_DTS;
audio = TRUE;
} else if (!strcmp (mimetype, "application/x-ape")) {
- id = CODEC_ID_APE;
+ id = AV_CODEC_ID_APE;
audio = TRUE;
} else if (!strcmp (mimetype, "video/x-msmpeg")) {
gint msmpegversion = 0;
@@ -3116,17 +3491,17 @@ gst_ffmpeg_caps_to_codecid (const GstCaps * caps, AVCodecContext * context)
if (gst_structure_get_int (structure, "msmpegversion", &msmpegversion)) {
switch (msmpegversion) {
case 41:
- id = CODEC_ID_MSMPEG4V1;
+ id = AV_CODEC_ID_MSMPEG4V1;
break;
case 42:
- id = CODEC_ID_MSMPEG4V2;
+ id = AV_CODEC_ID_MSMPEG4V2;
break;
case 43:
- id = CODEC_ID_MSMPEG4V3;
+ id = AV_CODEC_ID_MSMPEG4V3;
break;
}
}
- if (id != CODEC_ID_NONE)
+ if (id != AV_CODEC_ID_NONE)
video = TRUE;
} else if (!strcmp (mimetype, "video/x-svq")) {
gint svqversion = 0;
@@ -3134,17 +3509,17 @@ gst_ffmpeg_caps_to_codecid (const GstCaps * caps, AVCodecContext * context)
if (gst_structure_get_int (structure, "svqversion", &svqversion)) {
switch (svqversion) {
case 1:
- id = CODEC_ID_SVQ1;
+ id = AV_CODEC_ID_SVQ1;
break;
case 3:
- id = CODEC_ID_SVQ3;
+ id = AV_CODEC_ID_SVQ3;
break;
}
}
- if (id != CODEC_ID_NONE)
+ if (id != AV_CODEC_ID_NONE)
video = TRUE;
} else if (!strcmp (mimetype, "video/x-huffyuv")) {
- id = CODEC_ID_HUFFYUV;
+ id = AV_CODEC_ID_HUFFYUV;
video = TRUE;
} else if (!strcmp (mimetype, "audio/x-mace")) {
gint maceversion = 0;
@@ -3152,38 +3527,38 @@ gst_ffmpeg_caps_to_codecid (const GstCaps * caps, AVCodecContext * context)
if (gst_structure_get_int (structure, "maceversion", &maceversion)) {
switch (maceversion) {
case 3:
- id = CODEC_ID_MACE3;
+ id = AV_CODEC_ID_MACE3;
break;
case 6:
- id = CODEC_ID_MACE6;
+ id = AV_CODEC_ID_MACE6;
break;
}
}
- if (id != CODEC_ID_NONE)
+ if (id != AV_CODEC_ID_NONE)
audio = TRUE;
} else if (!strcmp (mimetype, "video/x-theora")) {
- id = CODEC_ID_THEORA;
+ id = AV_CODEC_ID_THEORA;
video = TRUE;
} else if (!strcmp (mimetype, "video/x-vp3")) {
- id = CODEC_ID_VP3;
+ id = AV_CODEC_ID_VP3;
video = TRUE;
} else if (!strcmp (mimetype, "video/x-vp5")) {
- id = CODEC_ID_VP5;
+ id = AV_CODEC_ID_VP5;
video = TRUE;
} else if (!strcmp (mimetype, "video/x-vp6")) {
- id = CODEC_ID_VP6;
+ id = AV_CODEC_ID_VP6;
video = TRUE;
} else if (!strcmp (mimetype, "video/x-vp6-flash")) {
- id = CODEC_ID_VP6F;
+ id = AV_CODEC_ID_VP6F;
video = TRUE;
} else if (!strcmp (mimetype, "video/x-vp6-alpha")) {
- id = CODEC_ID_VP6A;
+ id = AV_CODEC_ID_VP6A;
video = TRUE;
} else if (!strcmp (mimetype, "video/x-vp8")) {
- id = CODEC_ID_VP8;
+ id = AV_CODEC_ID_VP8;
video = TRUE;
} else if (!strcmp (mimetype, "video/x-flash-screen")) {
- id = CODEC_ID_FLASHSV;
+ id = AV_CODEC_ID_FLASHSV;
video = TRUE;
} else if (!strcmp (mimetype, "video/x-indeo")) {
gint indeoversion = 0;
@@ -3191,19 +3566,19 @@ gst_ffmpeg_caps_to_codecid (const GstCaps * caps, AVCodecContext * context)
if (gst_structure_get_int (structure, "indeoversion", &indeoversion)) {
switch (indeoversion) {
case 5:
- id = CODEC_ID_INDEO5;
+ id = AV_CODEC_ID_INDEO5;
break;
case 4:
- id = CODEC_ID_INDEO4;
+ id = AV_CODEC_ID_INDEO4;
break;
case 3:
- id = CODEC_ID_INDEO3;
+ id = AV_CODEC_ID_INDEO3;
break;
case 2:
- id = CODEC_ID_INDEO2;
+ id = AV_CODEC_ID_INDEO2;
break;
}
- if (id != CODEC_ID_NONE)
+ if (id != AV_CODEC_ID_NONE)
video = TRUE;
}
} else if (!strcmp (mimetype, "video/x-divx")) {
@@ -3212,28 +3587,28 @@ gst_ffmpeg_caps_to_codecid (const GstCaps * caps, AVCodecContext * context)
if (gst_structure_get_int (structure, "divxversion", &divxversion)) {
switch (divxversion) {
case 3:
- id = CODEC_ID_MSMPEG4V3;
+ id = AV_CODEC_ID_MSMPEG4V3;
break;
case 4:
case 5:
- id = CODEC_ID_MPEG4;
+ id = AV_CODEC_ID_MPEG4;
break;
}
}
- if (id != CODEC_ID_NONE)
+ if (id != AV_CODEC_ID_NONE)
video = TRUE;
} else if (!strcmp (mimetype, "video/x-3ivx")) {
- id = CODEC_ID_MPEG4;
+ id = AV_CODEC_ID_MPEG4;
video = TRUE;
} else if (!strcmp (mimetype, "video/x-xvid")) {
- id = CODEC_ID_MPEG4;
+ id = AV_CODEC_ID_MPEG4;
video = TRUE;
} else if (!strcmp (mimetype, "video/x-ffv")) {
gint ffvversion = 0;
if (gst_structure_get_int (structure, "ffvversion", &ffvversion) &&
ffvversion == 1) {
- id = CODEC_ID_FFV1;
+ id = AV_CODEC_ID_FFV1;
video = TRUE;
}
} else if (!strcmp (mimetype, "audio/x-adpcm")) {
@@ -3243,50 +3618,50 @@ gst_ffmpeg_caps_to_codecid (const GstCaps * caps, AVCodecContext * context)
if (layout == NULL) {
/* break */
} else if (!strcmp (layout, "quicktime")) {
- id = CODEC_ID_ADPCM_IMA_QT;
+ id = AV_CODEC_ID_ADPCM_IMA_QT;
} else if (!strcmp (layout, "microsoft")) {
- id = CODEC_ID_ADPCM_MS;
+ id = AV_CODEC_ID_ADPCM_MS;
} else if (!strcmp (layout, "dvi")) {
- id = CODEC_ID_ADPCM_IMA_WAV;
+ id = AV_CODEC_ID_ADPCM_IMA_WAV;
} else if (!strcmp (layout, "4xm")) {
- id = CODEC_ID_ADPCM_4XM;
+ id = AV_CODEC_ID_ADPCM_4XM;
} else if (!strcmp (layout, "smjpeg")) {
- id = CODEC_ID_ADPCM_IMA_SMJPEG;
+ id = AV_CODEC_ID_ADPCM_IMA_SMJPEG;
} else if (!strcmp (layout, "dk3")) {
- id = CODEC_ID_ADPCM_IMA_DK3;
+ id = AV_CODEC_ID_ADPCM_IMA_DK3;
} else if (!strcmp (layout, "dk4")) {
- id = CODEC_ID_ADPCM_IMA_DK4;
+ id = AV_CODEC_ID_ADPCM_IMA_DK4;
} else if (!strcmp (layout, "westwood")) {
- id = CODEC_ID_ADPCM_IMA_WS;
+ id = AV_CODEC_ID_ADPCM_IMA_WS;
} else if (!strcmp (layout, "iss")) {
- id = CODEC_ID_ADPCM_IMA_ISS;
+ id = AV_CODEC_ID_ADPCM_IMA_ISS;
} else if (!strcmp (layout, "xa")) {
- id = CODEC_ID_ADPCM_XA;
+ id = AV_CODEC_ID_ADPCM_XA;
} else if (!strcmp (layout, "adx")) {
- id = CODEC_ID_ADPCM_ADX;
+ id = AV_CODEC_ID_ADPCM_ADX;
} else if (!strcmp (layout, "ea")) {
- id = CODEC_ID_ADPCM_EA;
+ id = AV_CODEC_ID_ADPCM_EA;
} else if (!strcmp (layout, "g726")) {
- id = CODEC_ID_ADPCM_G726;
+ id = AV_CODEC_ID_ADPCM_G726;
} else if (!strcmp (layout, "g721")) {
- id = CODEC_ID_ADPCM_G726;
+ id = AV_CODEC_ID_ADPCM_G726;
} else if (!strcmp (layout, "ct")) {
- id = CODEC_ID_ADPCM_CT;
+ id = AV_CODEC_ID_ADPCM_CT;
} else if (!strcmp (layout, "swf")) {
- id = CODEC_ID_ADPCM_SWF;
+ id = AV_CODEC_ID_ADPCM_SWF;
} else if (!strcmp (layout, "yamaha")) {
- id = CODEC_ID_ADPCM_YAMAHA;
+ id = AV_CODEC_ID_ADPCM_YAMAHA;
} else if (!strcmp (layout, "sbpro2")) {
- id = CODEC_ID_ADPCM_SBPRO_2;
+ id = AV_CODEC_ID_ADPCM_SBPRO_2;
} else if (!strcmp (layout, "sbpro3")) {
- id = CODEC_ID_ADPCM_SBPRO_3;
+ id = AV_CODEC_ID_ADPCM_SBPRO_3;
} else if (!strcmp (layout, "sbpro4")) {
- id = CODEC_ID_ADPCM_SBPRO_4;
+ id = AV_CODEC_ID_ADPCM_SBPRO_4;
}
- if (id != CODEC_ID_NONE)
+ if (id != AV_CODEC_ID_NONE)
audio = TRUE;
} else if (!strcmp (mimetype, "video/x-4xm")) {
- id = CODEC_ID_4XM;
+ id = AV_CODEC_ID_4XM;
video = TRUE;
} else if (!strcmp (mimetype, "audio/x-dpcm")) {
const gchar *layout;
@@ -3295,27 +3670,27 @@ gst_ffmpeg_caps_to_codecid (const GstCaps * caps, AVCodecContext * context)
if (!layout) {
/* .. */
} else if (!strcmp (layout, "roq")) {
- id = CODEC_ID_ROQ_DPCM;
+ id = AV_CODEC_ID_ROQ_DPCM;
} else if (!strcmp (layout, "interplay")) {
- id = CODEC_ID_INTERPLAY_DPCM;
+ id = AV_CODEC_ID_INTERPLAY_DPCM;
} else if (!strcmp (layout, "xan")) {
- id = CODEC_ID_XAN_DPCM;
+ id = AV_CODEC_ID_XAN_DPCM;
} else if (!strcmp (layout, "sol")) {
- id = CODEC_ID_SOL_DPCM;
+ id = AV_CODEC_ID_SOL_DPCM;
}
- if (id != CODEC_ID_NONE)
+ if (id != AV_CODEC_ID_NONE)
audio = TRUE;
} else if (!strcmp (mimetype, "audio/x-flac")) {
- id = CODEC_ID_FLAC;
+ id = AV_CODEC_ID_FLAC;
audio = TRUE;
} else if (!strcmp (mimetype, "audio/x-shorten")) {
- id = CODEC_ID_SHORTEN;
+ id = AV_CODEC_ID_SHORTEN;
audio = TRUE;
} else if (!strcmp (mimetype, "audio/x-alac")) {
- id = CODEC_ID_ALAC;
+ id = AV_CODEC_ID_ALAC;
audio = TRUE;
} else if (!strcmp (mimetype, "video/x-cinepak")) {
- id = CODEC_ID_CINEPAK;
+ id = AV_CODEC_ID_CINEPAK;
video = TRUE;
} else if (!strcmp (mimetype, "video/x-pn-realvideo")) {
gint rmversion;
@@ -3323,23 +3698,23 @@ gst_ffmpeg_caps_to_codecid (const GstCaps * caps, AVCodecContext * context)
if (gst_structure_get_int (structure, "rmversion", &rmversion)) {
switch (rmversion) {
case 1:
- id = CODEC_ID_RV10;
+ id = AV_CODEC_ID_RV10;
break;
case 2:
- id = CODEC_ID_RV20;
+ id = AV_CODEC_ID_RV20;
break;
case 3:
- id = CODEC_ID_RV30;
+ id = AV_CODEC_ID_RV30;
break;
case 4:
- id = CODEC_ID_RV40;
+ id = AV_CODEC_ID_RV40;
break;
}
}
- if (id != CODEC_ID_NONE)
+ if (id != AV_CODEC_ID_NONE)
video = TRUE;
} else if (!strcmp (mimetype, "audio/x-sipro")) {
- id = CODEC_ID_SIPR;
+ id = AV_CODEC_ID_SIPR;
audio = TRUE;
} else if (!strcmp (mimetype, "audio/x-pn-realaudio")) {
gint raversion;
@@ -3347,24 +3722,24 @@ gst_ffmpeg_caps_to_codecid (const GstCaps * caps, AVCodecContext * context)
if (gst_structure_get_int (structure, "raversion", &raversion)) {
switch (raversion) {
case 1:
- id = CODEC_ID_RA_144;
+ id = AV_CODEC_ID_RA_144;
break;
case 2:
- id = CODEC_ID_RA_288;
+ id = AV_CODEC_ID_RA_288;
break;
case 8:
- id = CODEC_ID_COOK;
+ id = AV_CODEC_ID_COOK;
break;
}
}
- if (id != CODEC_ID_NONE)
+ if (id != AV_CODEC_ID_NONE)
audio = TRUE;
} else if (!strcmp (mimetype, "video/x-rle")) {
const gchar *layout;
if ((layout = gst_structure_get_string (structure, "layout"))) {
if (!strcmp (layout, "microsoft")) {
- id = CODEC_ID_MSRLE;
+ id = AV_CODEC_ID_MSRLE;
video = TRUE;
}
}
@@ -3374,11 +3749,11 @@ gst_ffmpeg_caps_to_codecid (const GstCaps * caps, AVCodecContext * context)
if ((gst_structure_get_int (structure, "wcversion", &wcversion))) {
switch (wcversion) {
case 3:
- id = CODEC_ID_XAN_WC3;
+ id = AV_CODEC_ID_XAN_WC3;
video = TRUE;
break;
case 4:
- id = CODEC_ID_XAN_WC4;
+ id = AV_CODEC_ID_XAN_WC4;
video = TRUE;
break;
default:
@@ -3387,15 +3762,15 @@ gst_ffmpeg_caps_to_codecid (const GstCaps * caps, AVCodecContext * context)
}
} else if (!strcmp (mimetype, "audio/AMR")) {
audio = TRUE;
- id = CODEC_ID_AMR_NB;
+ id = AV_CODEC_ID_AMR_NB;
} else if (!strcmp (mimetype, "audio/AMR-WB")) {
- id = CODEC_ID_AMR_WB;
+ id = AV_CODEC_ID_AMR_WB;
audio = TRUE;
} else if (!strcmp (mimetype, "audio/qcelp")) {
- id = CODEC_ID_QCELP;
+ id = AV_CODEC_ID_QCELP;
audio = TRUE;
} else if (!strcmp (mimetype, "video/x-h264")) {
- id = CODEC_ID_H264;
+ id = AV_CODEC_ID_H264;
video = TRUE;
} else if (!strcmp (mimetype, "video/x-flash-video")) {
gint flvversion = 0;
@@ -3403,7 +3778,7 @@ gst_ffmpeg_caps_to_codecid (const GstCaps * caps, AVCodecContext * context)
if ((gst_structure_get_int (structure, "flvversion", &flvversion))) {
switch (flvversion) {
case 1:
- id = CODEC_ID_FLV1;
+ id = AV_CODEC_ID_FLV1;
video = TRUE;
break;
default:
@@ -3412,7 +3787,7 @@ gst_ffmpeg_caps_to_codecid (const GstCaps * caps, AVCodecContext * context)
}
} else if (!strcmp (mimetype, "audio/x-nellymoser")) {
- id = CODEC_ID_NELLYMOSER;
+ id = AV_CODEC_ID_NELLYMOSER;
audio = TRUE;
} else if (!strncmp (mimetype, "audio/x-gst-av-", 15)) {
gchar ext[16];
@@ -3452,7 +3827,7 @@ gst_ffmpeg_caps_to_codecid (const GstCaps * caps, AVCodecContext * context)
gst_ffmpeg_caps_with_codecid (id, context->codec_type, caps, context);
}
- if (id != CODEC_ID_NONE) {
+ if (id != AV_CODEC_ID_NONE) {
GST_DEBUG ("The id=%d belongs to the caps %" GST_PTR_FORMAT, id, caps);
} else {
GST_WARNING ("Couldn't figure out the id for caps %" GST_PTR_FORMAT, caps);
diff --git a/ext/libav/gstavcodecmap.h b/ext/libav/gstavcodecmap.h
index 52e5bec..01ce9b1 100644
--- a/ext/libav/gstavcodecmap.h
+++ b/ext/libav/gstavcodecmap.h
@@ -13,8 +13,8 @@
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
*/
#ifndef __GST_FFMPEG_CODECMAP_H__
@@ -41,11 +41,6 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id,
*/
GstCaps *
-gst_ffmpeg_codectype_to_caps (enum AVMediaType codec_type,
- AVCodecContext *context,
- enum CodecID codec_id,
- gboolean encode);
-GstCaps *
gst_ffmpeg_codectype_to_audio_caps (AVCodecContext *context,
enum CodecID codec_id,
gboolean encode,
@@ -91,9 +86,15 @@ void
gst_ffmpeg_videoinfo_to_context (GstVideoInfo *info,
AVCodecContext *context);
+void
+gst_ffmpeg_audioinfo_to_context (GstAudioInfo *info,
+ AVCodecContext *context);
+
GstVideoFormat gst_ffmpeg_pixfmt_to_videoformat (enum PixelFormat pixfmt);
enum PixelFormat gst_ffmpeg_videoformat_to_pixfmt (GstVideoFormat format);
+GstAudioFormat gst_ffmpeg_smpfmt_to_audioformat (enum AVSampleFormat sample_fmt);
+
/*
* _formatid_to_caps () is meant for muxers/demuxers, it
* transforms a name (ffmpeg way of ID'ing these, why don't
@@ -104,19 +105,6 @@ enum PixelFormat gst_ffmpeg_videoformat_to_pixfmt (GstVideoFormat format);
GstCaps *
gst_ffmpeg_formatid_to_caps (const gchar *format_name);
-GstVideoFormat
-gst_ffmpeg_pixfmt_to_video_format (enum PixelFormat pix_fmt);
-
-/* Convert a FFMPEG Pixel Format and optional AVCodecContext
- * to a GstCaps. If the context is ommitted, no fixed values
- * for video/audio size will be included in the GstCaps
- *
- * See below for usefullness
- */
-
-GstCaps *
-gst_ffmpeg_pixfmt_to_caps (enum PixelFormat pix_fmt, AVCodecContext * context, enum CodecID codec_id);
-
/*
* _formatid_get_codecids () can be used to get the codecIDs
* (CODEC_ID_NONE-terminated list) that fit that specific
@@ -131,7 +119,7 @@ gst_ffmpeg_formatid_get_codecids (const gchar *format_name,
gboolean
-gst_ffmpeg_channel_layout_to_gst (AVCodecContext * context,
+gst_ffmpeg_channel_layout_to_gst (guint64 channel_layout, gint channels,
GstAudioChannelPosition * pos);
#endif /* __GST_FFMPEG_CODECMAP_H__ */
diff --git a/ext/libav/gstavdec.c b/ext/libav/gstavdec.c
deleted file mode 100644
index 8291099..0000000
--- a/ext/libav/gstavdec.c
+++ /dev/null
@@ -1,1457 +0,0 @@
-/* GStreamer
- * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <assert.h>
-#include <string.h>
-
-#include <libavcodec/avcodec.h>
-
-#include <gst/gst.h>
-
-#include "gstav.h"
-#include "gstavcodecmap.h"
-#include "gstavutils.h"
-
-GST_DEBUG_CATEGORY_EXTERN (GST_CAT_PERFORMANCE);
-
-typedef struct _GstFFMpegAudDec GstFFMpegAudDec;
-
-#define MAX_TS_MASK 0xff
-
-/* for each incomming buffer we keep all timing info in a structure like this.
- * We keep a circular array of these structures around to store the timing info.
- * The index in the array is what we pass as opaque data (to pictures) and
- * pts (to parsers) so that ffmpeg can remember them for us. */
-typedef struct
-{
- gint idx;
- GstClockTime dts;
- GstClockTime pts;
- GstClockTime duration;
- gint64 offset;
-} GstTSInfo;
-
-struct _GstFFMpegAudDec
-{
- GstElement element;
-
- /* We need to keep track of our pads, so we do so here. */
- GstPad *srcpad;
- GstPad *sinkpad;
-
- /* decoding */
- AVCodecContext *context;
- gboolean opened;
-
- /* current output format */
- gint channels, samplerate, depth;
- GstAudioChannelPosition ffmpeg_layout[64], gst_layout[64];
-
- gboolean discont;
- gboolean clear_ts;
-
- /* for tracking DTS/PTS */
- GstClockTime next_out;
-
- /* parsing */
- gboolean turnoff_parser; /* used for turning off aac raw parsing
- * See bug #566250 */
- AVCodecParserContext *pctx;
- GstBuffer *pcache;
-
- /* clipping segment */
- GstSegment segment;
-
- GstTSInfo ts_info[MAX_TS_MASK + 1];
- gint ts_idx;
-
- /* reverse playback queue */
- GList *queued;
-
- /* prevent reopening the decoder on GST_EVENT_CAPS when caps are same as last time. */
- GstCaps *last_caps;
-};
-
-typedef struct _GstFFMpegAudDecClass GstFFMpegAudDecClass;
-
-struct _GstFFMpegAudDecClass
-{
- GstElementClass parent_class;
-
- AVCodec *in_plugin;
- GstPadTemplate *srctempl, *sinktempl;
-};
-
-#define GST_TS_INFO_NONE &ts_info_none
-static const GstTSInfo ts_info_none = { -1, -1, -1, -1 };
-
-static const GstTSInfo *
-gst_ts_info_store (GstFFMpegAudDec * dec, GstClockTime dts, GstClockTime pts,
- GstClockTime duration, gint64 offset)
-{
- gint idx = dec->ts_idx;
- dec->ts_info[idx].idx = idx;
- dec->ts_info[idx].dts = dts;
- dec->ts_info[idx].pts = pts;
- dec->ts_info[idx].duration = duration;
- dec->ts_info[idx].offset = offset;
- dec->ts_idx = (idx + 1) & MAX_TS_MASK;
-
- return &dec->ts_info[idx];
-}
-
-static const GstTSInfo *
-gst_ts_info_get (GstFFMpegAudDec * dec, gint idx)
-{
- if (G_UNLIKELY (idx < 0 || idx > MAX_TS_MASK))
- return GST_TS_INFO_NONE;
-
- return &dec->ts_info[idx];
-}
-
-#define GST_TYPE_FFMPEGDEC \
- (gst_ffmpegauddec_get_type())
-#define GST_FFMPEGDEC(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_FFMPEGDEC,GstFFMpegAudDec))
-#define GST_FFMPEGAUDDEC_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_FFMPEGDEC,GstFFMpegAudDecClass))
-#define GST_IS_FFMPEGDEC(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_FFMPEGDEC))
-#define GST_IS_FFMPEGAUDDEC_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_FFMPEGDEC))
-
-/* A number of function prototypes are given so we can refer to them later. */
-static void gst_ffmpegauddec_base_init (GstFFMpegAudDecClass * klass);
-static void gst_ffmpegauddec_class_init (GstFFMpegAudDecClass * klass);
-static void gst_ffmpegauddec_init (GstFFMpegAudDec * ffmpegdec);
-static void gst_ffmpegauddec_finalize (GObject * object);
-
-static gboolean gst_ffmpegauddec_setcaps (GstFFMpegAudDec * ffmpegdec,
- GstCaps * caps);
-static gboolean gst_ffmpegauddec_sink_event (GstPad * pad, GstObject * parent,
- GstEvent * event);
-static gboolean gst_ffmpegauddec_sink_query (GstPad * pad, GstObject * parent,
- GstQuery * query);
-static GstFlowReturn gst_ffmpegauddec_chain (GstPad * pad, GstObject * parent,
- GstBuffer * buf);
-
-static GstStateChangeReturn gst_ffmpegauddec_change_state (GstElement * element,
- GstStateChange transition);
-
-static gboolean gst_ffmpegauddec_negotiate (GstFFMpegAudDec * ffmpegdec,
- gboolean force);
-
-static void gst_ffmpegauddec_drain (GstFFMpegAudDec * ffmpegdec);
-
-#define GST_FFDEC_PARAMS_QDATA g_quark_from_static_string("avdec-params")
-
-static GstElementClass *parent_class = NULL;
-
-static void
-gst_ffmpegauddec_base_init (GstFFMpegAudDecClass * klass)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
- GstPadTemplate *sinktempl, *srctempl;
- GstCaps *sinkcaps, *srccaps;
- AVCodec *in_plugin;
- gchar *longname, *description;
-
- in_plugin =
- (AVCodec *) g_type_get_qdata (G_OBJECT_CLASS_TYPE (klass),
- GST_FFDEC_PARAMS_QDATA);
- g_assert (in_plugin != NULL);
-
- /* construct the element details struct */
- longname = g_strdup_printf ("libav %s decoder", in_plugin->long_name);
- description = g_strdup_printf ("libav %s decoder", in_plugin->name);
- gst_element_class_set_metadata (element_class, longname,
- "Codec/Decoder/Audio", description,
- "Wim Taymans <wim.taymans@gmail.com>, "
- "Ronald Bultje <rbultje@ronald.bitfreak.net>, "
- "Edward Hervey <bilboed@bilboed.com>");
- g_free (longname);
- g_free (description);
-
- /* get the caps */
- sinkcaps = gst_ffmpeg_codecid_to_caps (in_plugin->id, NULL, FALSE);
- if (!sinkcaps) {
- GST_DEBUG ("Couldn't get sink caps for decoder '%s'", in_plugin->name);
- sinkcaps = gst_caps_from_string ("unknown/unknown");
- }
- srccaps = gst_ffmpeg_codectype_to_audio_caps (NULL,
- in_plugin->id, FALSE, in_plugin);
- if (!srccaps) {
- GST_DEBUG ("Couldn't get source caps for decoder '%s'", in_plugin->name);
- srccaps = gst_caps_from_string ("unknown/unknown");
- }
-
- /* pad templates */
- sinktempl = gst_pad_template_new ("sink", GST_PAD_SINK,
- GST_PAD_ALWAYS, sinkcaps);
- srctempl = gst_pad_template_new ("src", GST_PAD_SRC, GST_PAD_ALWAYS, srccaps);
-
- gst_element_class_add_pad_template (element_class, srctempl);
- gst_element_class_add_pad_template (element_class, sinktempl);
-
- klass->in_plugin = in_plugin;
- klass->srctempl = srctempl;
- klass->sinktempl = sinktempl;
-}
-
-static void
-gst_ffmpegauddec_class_init (GstFFMpegAudDecClass * klass)
-{
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
- GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass);
-
- parent_class = g_type_class_peek_parent (klass);
-
- gobject_class->finalize = gst_ffmpegauddec_finalize;
-
- gstelement_class->change_state = gst_ffmpegauddec_change_state;
-}
-
-static void
-gst_ffmpegauddec_init (GstFFMpegAudDec * ffmpegdec)
-{
- GstFFMpegAudDecClass *oclass;
-
- oclass = (GstFFMpegAudDecClass *) (G_OBJECT_GET_CLASS (ffmpegdec));
-
- /* setup pads */
- ffmpegdec->sinkpad = gst_pad_new_from_template (oclass->sinktempl, "sink");
- gst_pad_set_query_function (ffmpegdec->sinkpad,
- GST_DEBUG_FUNCPTR (gst_ffmpegauddec_sink_query));
- gst_pad_set_event_function (ffmpegdec->sinkpad,
- GST_DEBUG_FUNCPTR (gst_ffmpegauddec_sink_event));
- gst_pad_set_chain_function (ffmpegdec->sinkpad,
- GST_DEBUG_FUNCPTR (gst_ffmpegauddec_chain));
- gst_element_add_pad (GST_ELEMENT (ffmpegdec), ffmpegdec->sinkpad);
-
- ffmpegdec->srcpad = gst_pad_new_from_template (oclass->srctempl, "src");
- gst_pad_use_fixed_caps (ffmpegdec->srcpad);
- gst_element_add_pad (GST_ELEMENT (ffmpegdec), ffmpegdec->srcpad);
-
- /* some ffmpeg data */
- ffmpegdec->context = avcodec_alloc_context ();
- ffmpegdec->pctx = NULL;
- ffmpegdec->pcache = NULL;
- ffmpegdec->opened = FALSE;
-
- gst_segment_init (&ffmpegdec->segment, GST_FORMAT_TIME);
-}
-
-static void
-gst_ffmpegauddec_finalize (GObject * object)
-{
- GstFFMpegAudDec *ffmpegdec = (GstFFMpegAudDec *) object;
-
- if (ffmpegdec->context != NULL)
- av_free (ffmpegdec->context);
-
- G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-static void
-gst_ffmpegauddec_reset_ts (GstFFMpegAudDec * ffmpegdec)
-{
- ffmpegdec->next_out = GST_CLOCK_TIME_NONE;
-}
-
-/* with LOCK */
-static void
-gst_ffmpegauddec_close (GstFFMpegAudDec * ffmpegdec)
-{
- if (!ffmpegdec->opened)
- return;
-
- GST_LOG_OBJECT (ffmpegdec, "closing libav codec");
-
- gst_caps_replace (&ffmpegdec->last_caps, NULL);
-
- if (ffmpegdec->context->priv_data)
- gst_ffmpeg_avcodec_close (ffmpegdec->context);
- ffmpegdec->opened = FALSE;
-
- if (ffmpegdec->context->palctrl) {
- av_free (ffmpegdec->context->palctrl);
- ffmpegdec->context->palctrl = NULL;
- }
-
- if (ffmpegdec->context->extradata) {
- av_free (ffmpegdec->context->extradata);
- ffmpegdec->context->extradata = NULL;
- }
-
- if (ffmpegdec->pctx) {
- if (ffmpegdec->pcache) {
- gst_buffer_unref (ffmpegdec->pcache);
- ffmpegdec->pcache = NULL;
- }
- av_parser_close (ffmpegdec->pctx);
- ffmpegdec->pctx = NULL;
- }
-}
-
-/* with LOCK */
-static gboolean
-gst_ffmpegauddec_open (GstFFMpegAudDec * ffmpegdec)
-{
- GstFFMpegAudDecClass *oclass;
-
- oclass = (GstFFMpegAudDecClass *) (G_OBJECT_GET_CLASS (ffmpegdec));
-
- if (gst_ffmpeg_avcodec_open (ffmpegdec->context, oclass->in_plugin) < 0)
- goto could_not_open;
-
- ffmpegdec->opened = TRUE;
-
- GST_LOG_OBJECT (ffmpegdec, "Opened libav codec %s, id %d",
- oclass->in_plugin->name, oclass->in_plugin->id);
-
- if (!ffmpegdec->turnoff_parser) {
- ffmpegdec->pctx = av_parser_init (oclass->in_plugin->id);
- if (ffmpegdec->pctx)
- GST_LOG_OBJECT (ffmpegdec, "Using parser %p", ffmpegdec->pctx);
- else
- GST_LOG_OBJECT (ffmpegdec, "No parser for codec");
- } else {
- GST_LOG_OBJECT (ffmpegdec, "Parser deactivated for format");
- }
-
- ffmpegdec->samplerate = 0;
- ffmpegdec->channels = 0;
- ffmpegdec->depth = 0;
-
- gst_ffmpegauddec_reset_ts (ffmpegdec);
-
- return TRUE;
-
- /* ERRORS */
-could_not_open:
- {
- gst_ffmpegauddec_close (ffmpegdec);
- GST_DEBUG_OBJECT (ffmpegdec, "avdec_%s: Failed to open libav codec",
- oclass->in_plugin->name);
- return FALSE;
- }
-}
-
-static gboolean
-gst_ffmpegauddec_setcaps (GstFFMpegAudDec * ffmpegdec, GstCaps * caps)
-{
- GstFFMpegAudDecClass *oclass;
- GstStructure *structure;
- gboolean ret = TRUE;
-
- oclass = (GstFFMpegAudDecClass *) (G_OBJECT_GET_CLASS (ffmpegdec));
-
- GST_DEBUG_OBJECT (ffmpegdec, "setcaps called");
-
- GST_OBJECT_LOCK (ffmpegdec);
-
- /* close old session */
- if (ffmpegdec->opened) {
- GST_OBJECT_UNLOCK (ffmpegdec);
- gst_ffmpegauddec_drain (ffmpegdec);
- GST_OBJECT_LOCK (ffmpegdec);
- gst_ffmpegauddec_close (ffmpegdec);
-
- /* and reset the defaults that were set when a context is created */
- avcodec_get_context_defaults (ffmpegdec->context);
- }
-
- /* default is to let format decide if it needs a parser */
- ffmpegdec->turnoff_parser = FALSE;
-
- /* get size and so */
- gst_ffmpeg_caps_with_codecid (oclass->in_plugin->id,
- oclass->in_plugin->type, caps, ffmpegdec->context);
-
- /* get pixel aspect ratio if it's set */
- structure = gst_caps_get_structure (caps, 0);
-
- /* for AAC we only use av_parse if not on stream-format==raw or ==loas */
- if (oclass->in_plugin->id == CODEC_ID_AAC
- || oclass->in_plugin->id == CODEC_ID_AAC_LATM) {
- const gchar *format = gst_structure_get_string (structure, "stream-format");
-
- if (format == NULL || strcmp (format, "raw") == 0) {
- ffmpegdec->turnoff_parser = TRUE;
- }
- }
-
- /* for FLAC, don't parse if it's already parsed */
- if (oclass->in_plugin->id == CODEC_ID_FLAC) {
- if (gst_structure_has_field (structure, "streamheader"))
- ffmpegdec->turnoff_parser = TRUE;
- }
-
- /* workaround encoder bugs */
- ffmpegdec->context->workaround_bugs |= FF_BUG_AUTODETECT;
- ffmpegdec->context->error_recognition = 1;
-
- /* open codec - we don't select an output pix_fmt yet,
- * simply because we don't know! We only get it
- * during playback... */
- if (!gst_ffmpegauddec_open (ffmpegdec))
- goto open_failed;
-
-done:
- GST_OBJECT_UNLOCK (ffmpegdec);
-
- return ret;
-
- /* ERRORS */
-open_failed:
- {
- GST_DEBUG_OBJECT (ffmpegdec, "Failed to open");
- ret = FALSE;
- goto done;
- }
-}
-
-static gboolean
-gst_ffmpegauddec_negotiate (GstFFMpegAudDec * ffmpegdec, gboolean force)
-{
- GstFFMpegAudDecClass *oclass;
- GstCaps *caps;
- gint depth;
- GstAudioChannelPosition pos[64] = { 0, };
-
- oclass = (GstFFMpegAudDecClass *) (G_OBJECT_GET_CLASS (ffmpegdec));
-
- depth = av_smp_format_depth (ffmpegdec->context->sample_fmt);
- gst_ffmpeg_channel_layout_to_gst (ffmpegdec->context, pos);
-
- if (!force && ffmpegdec->samplerate ==
- ffmpegdec->context->sample_rate &&
- ffmpegdec->channels == ffmpegdec->context->channels &&
- ffmpegdec->depth == depth)
- return TRUE;
-
- GST_DEBUG_OBJECT (ffmpegdec,
- "Renegotiating audio from %dHz@%dchannels (%d) to %dHz@%dchannels (%d)",
- ffmpegdec->samplerate, ffmpegdec->channels,
- ffmpegdec->depth,
- ffmpegdec->context->sample_rate, ffmpegdec->context->channels, depth);
-
- ffmpegdec->samplerate = ffmpegdec->context->sample_rate;
- ffmpegdec->channels = ffmpegdec->context->channels;
- ffmpegdec->depth = depth;
- memcpy (ffmpegdec->ffmpeg_layout, pos,
- sizeof (GstAudioChannelPosition) * ffmpegdec->context->channels);
-
- /* Get GStreamer channel layout */
- memcpy (ffmpegdec->gst_layout,
- ffmpegdec->ffmpeg_layout,
- sizeof (GstAudioChannelPosition) * ffmpegdec->channels);
- gst_audio_channel_positions_to_valid_order (ffmpegdec->gst_layout,
- ffmpegdec->channels);
-
- caps = gst_ffmpeg_codectype_to_caps (oclass->in_plugin->type,
- ffmpegdec->context, oclass->in_plugin->id, FALSE);
-
- if (caps == NULL)
- goto no_caps;
-
- GST_LOG_OBJECT (ffmpegdec, "output caps %" GST_PTR_FORMAT, caps);
-
- if (!gst_pad_set_caps (ffmpegdec->srcpad, caps))
- goto caps_failed;
-
- gst_caps_unref (caps);
-
- return TRUE;
-
- /* ERRORS */
-no_caps:
- {
-#ifdef HAVE_LIBAV_UNINSTALLED
- /* using internal ffmpeg snapshot */
- GST_ELEMENT_ERROR (ffmpegdec, CORE, NEGOTIATION,
- ("Could not find GStreamer caps mapping for libav codec '%s'.",
- oclass->in_plugin->name), (NULL));
-#else
- /* using external ffmpeg */
- GST_ELEMENT_ERROR (ffmpegdec, CORE, NEGOTIATION,
- ("Could not find GStreamer caps mapping for libav codec '%s', and "
- "you are using an external libavcodec. This is most likely due to "
- "a packaging problem and/or libavcodec having been upgraded to a "
- "version that is not compatible with this version of "
- "gstreamer-libav. Make sure your gstreamer-libav and libavcodec "
- "packages come from the same source/repository.",
- oclass->in_plugin->name), (NULL));
-#endif
- return FALSE;
- }
-caps_failed:
- {
- GST_ELEMENT_ERROR (ffmpegdec, CORE, NEGOTIATION, (NULL),
- ("Could not set caps for libav decoder (%s), not fixed?",
- oclass->in_plugin->name));
- gst_caps_unref (caps);
-
- return FALSE;
- }
-}
-
-static void
-clear_queued (GstFFMpegAudDec * ffmpegdec)
-{
- g_list_foreach (ffmpegdec->queued, (GFunc) gst_mini_object_unref, NULL);
- g_list_free (ffmpegdec->queued);
- ffmpegdec->queued = NULL;
-}
-
-static GstFlowReturn
-flush_queued (GstFFMpegAudDec * ffmpegdec)
-{
- GstFlowReturn res = GST_FLOW_OK;
-
- while (ffmpegdec->queued) {
- GstBuffer *buf = GST_BUFFER_CAST (ffmpegdec->queued->data);
-
- GST_LOG_OBJECT (ffmpegdec, "pushing buffer %p, offset %"
- G_GUINT64_FORMAT ", timestamp %"
- GST_TIME_FORMAT ", duration %" GST_TIME_FORMAT, buf,
- GST_BUFFER_OFFSET (buf),
- GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buf)),
- GST_TIME_ARGS (GST_BUFFER_DURATION (buf)));
-
- /* iterate ouput queue an push downstream */
- res = gst_pad_push (ffmpegdec->srcpad, buf);
-
- ffmpegdec->queued =
- g_list_delete_link (ffmpegdec->queued, ffmpegdec->queued);
- }
- return res;
-}
-
-static void
-gst_avpacket_init (AVPacket * packet, guint8 * data, guint size)
-{
- memset (packet, 0, sizeof (AVPacket));
- packet->data = data;
- packet->size = size;
-}
-
-/* returns TRUE if buffer is within segment, else FALSE.
- * if Buffer is on segment border, it's timestamp and duration will be clipped */
-static gboolean
-clip_audio_buffer (GstFFMpegAudDec * dec, GstBuffer * buf, GstClockTime in_ts,
- GstClockTime in_dur)
-{
- GstClockTime stop;
- gint64 diff;
- guint64 ctime, cstop;
- gboolean res = TRUE;
- gsize size, offset;
-
- size = gst_buffer_get_size (buf);
- offset = 0;
-
- GST_LOG_OBJECT (dec,
- "timestamp:%" GST_TIME_FORMAT ", duration:%" GST_TIME_FORMAT
- ", size %" G_GSIZE_FORMAT, GST_TIME_ARGS (in_ts), GST_TIME_ARGS (in_dur),
- size);
-
- /* can't clip without TIME segment */
- if (G_UNLIKELY (dec->segment.format != GST_FORMAT_TIME))
- goto beach;
-
- /* we need a start time */
- if (G_UNLIKELY (!GST_CLOCK_TIME_IS_VALID (in_ts)))
- goto beach;
-
- /* trust duration */
- stop = in_ts + in_dur;
-
- res = gst_segment_clip (&dec->segment, GST_FORMAT_TIME, in_ts, stop, &ctime,
- &cstop);
- if (G_UNLIKELY (!res))
- goto out_of_segment;
-
- /* see if some clipping happened */
- if (G_UNLIKELY ((diff = ctime - in_ts) > 0)) {
- /* bring clipped time to bytes */
- diff =
- gst_util_uint64_scale_int (diff, dec->samplerate,
- GST_SECOND) * (dec->depth * dec->channels);
-
- GST_DEBUG_OBJECT (dec, "clipping start to %" GST_TIME_FORMAT " %"
- G_GINT64_FORMAT " bytes", GST_TIME_ARGS (ctime), diff);
-
- offset += diff;
- size -= diff;
- }
- if (G_UNLIKELY ((diff = stop - cstop) > 0)) {
- /* bring clipped time to bytes */
- diff =
- gst_util_uint64_scale_int (diff, dec->samplerate,
- GST_SECOND) * (dec->depth * dec->channels);
-
- GST_DEBUG_OBJECT (dec, "clipping stop to %" GST_TIME_FORMAT " %"
- G_GINT64_FORMAT " bytes", GST_TIME_ARGS (cstop), diff);
-
- size -= diff;
- }
- gst_buffer_resize (buf, offset, size);
- GST_BUFFER_TIMESTAMP (buf) = ctime;
- GST_BUFFER_DURATION (buf) = cstop - ctime;
-
-beach:
- GST_LOG_OBJECT (dec, "%sdropping", (res ? "not " : ""));
- return res;
-
- /* ERRORS */
-out_of_segment:
- {
- GST_LOG_OBJECT (dec, "out of segment");
- goto beach;
- }
-}
-
-static gint
-gst_ffmpegauddec_audio_frame (GstFFMpegAudDec * ffmpegdec,
- AVCodec * in_plugin, guint8 * data, guint size,
- const GstTSInfo * dec_info, GstBuffer ** outbuf, GstFlowReturn * ret)
-{
- gint len = -1;
- gint have_data = AVCODEC_MAX_AUDIO_FRAME_SIZE;
- GstClockTime out_pts, out_duration;
- GstMapInfo map;
- gint64 out_offset;
- int16_t *odata;
- AVPacket packet;
-
- GST_DEBUG_OBJECT (ffmpegdec,
- "size:%d, offset:%" G_GINT64_FORMAT ", dts:%" GST_TIME_FORMAT ", pts:%"
- GST_TIME_FORMAT ", dur:%" GST_TIME_FORMAT ", ffmpegdec->next_out:%"
- GST_TIME_FORMAT, size, dec_info->offset, GST_TIME_ARGS (dec_info->dts),
- GST_TIME_ARGS (dec_info->pts), GST_TIME_ARGS (dec_info->duration),
- GST_TIME_ARGS (ffmpegdec->next_out));
-
- *outbuf = new_aligned_buffer (AVCODEC_MAX_AUDIO_FRAME_SIZE);
-
- gst_buffer_map (*outbuf, &map, GST_MAP_WRITE);
- odata = (int16_t *) map.data;
-
- gst_avpacket_init (&packet, data, size);
- len = avcodec_decode_audio3 (ffmpegdec->context, odata, &have_data, &packet);
-
- GST_DEBUG_OBJECT (ffmpegdec,
- "Decode audio: len=%d, have_data=%d", len, have_data);
-
- if (len >= 0 && have_data > 0) {
- GstAudioFormat fmt;
-
- /* Buffer size */
- gst_buffer_unmap (*outbuf, &map);
- gst_buffer_resize (*outbuf, 0, have_data);
-
- GST_DEBUG_OBJECT (ffmpegdec, "Creating output buffer");
- if (!gst_ffmpegauddec_negotiate (ffmpegdec, FALSE)) {
- gst_buffer_unref (*outbuf);
- *outbuf = NULL;
- len = -1;
- goto beach;
- }
-
- /*
- * Timestamps:
- *
- * 1) Copy input timestamp if valid
- * 2) else interpolate from previous input timestamp
- */
- /* always take timestamps from the input buffer if any */
- if (GST_CLOCK_TIME_IS_VALID (dec_info->pts)) {
- out_pts = dec_info->pts;
- } else {
- out_pts = ffmpegdec->next_out;
- }
-
- /*
- * Duration:
- *
- * 1) calculate based on number of samples
- */
- out_duration = gst_util_uint64_scale (have_data, GST_SECOND,
- ffmpegdec->depth * ffmpegdec->channels * ffmpegdec->samplerate);
-
- /* offset:
- *
- * Just copy
- */
- out_offset = dec_info->offset;
-
- GST_DEBUG_OBJECT (ffmpegdec,
- "Buffer created. Size:%d , pts:%" GST_TIME_FORMAT " , duration:%"
- GST_TIME_FORMAT, have_data,
- GST_TIME_ARGS (out_pts), GST_TIME_ARGS (out_duration));
-
- GST_BUFFER_PTS (*outbuf) = out_pts;
- GST_BUFFER_DURATION (*outbuf) = out_duration;
- GST_BUFFER_OFFSET (*outbuf) = out_offset;
-
- /* the next timestamp we'll use when interpolating */
- if (GST_CLOCK_TIME_IS_VALID (out_pts))
- ffmpegdec->next_out = out_pts + out_duration;
-
- /* now see if we need to clip the buffer against the segment boundaries. */
- if (G_UNLIKELY (!clip_audio_buffer (ffmpegdec, *outbuf, out_pts,
- out_duration)))
- goto clipped;
-
-
- /* Reorder channels to the GStreamer channel order */
- /* Only the width really matters here... and it's stored as depth */
- fmt =
- gst_audio_format_build_integer (TRUE, G_BYTE_ORDER,
- ffmpegdec->depth * 8, ffmpegdec->depth * 8);
-
- gst_audio_buffer_reorder_channels (*outbuf, fmt,
- ffmpegdec->channels, ffmpegdec->ffmpeg_layout, ffmpegdec->gst_layout);
- } else {
- gst_buffer_unmap (*outbuf, &map);
- gst_buffer_unref (*outbuf);
- *outbuf = NULL;
- }
-
-beach:
- GST_DEBUG_OBJECT (ffmpegdec, "return flow %d, out %p, len %d",
- *ret, *outbuf, len);
- return len;
-
- /* ERRORS */
-clipped:
- {
- GST_DEBUG_OBJECT (ffmpegdec, "buffer clipped");
- gst_buffer_unref (*outbuf);
- *outbuf = NULL;
- goto beach;
- }
-}
-
-/* gst_ffmpegauddec_frame:
- * ffmpegdec:
- * data: pointer to the data to decode
- * size: size of data in bytes
- * got_data: 0 if no data was decoded, != 0 otherwise.
- * in_time: timestamp of data
- * in_duration: duration of data
- * ret: GstFlowReturn to return in the chain function
- *
- * Decode the given frame and pushes it downstream.
- *
- * Returns: Number of bytes used in decoding, -1 on error/failure.
- */
-
-static gint
-gst_ffmpegauddec_frame (GstFFMpegAudDec * ffmpegdec,
- guint8 * data, guint size, gint * got_data, const GstTSInfo * dec_info,
- GstFlowReturn * ret)
-{
- GstFFMpegAudDecClass *oclass;
- GstBuffer *outbuf = NULL;
- gint have_data = 0, len = 0;
-
- if (G_UNLIKELY (ffmpegdec->context->codec == NULL))
- goto no_codec;
-
- GST_LOG_OBJECT (ffmpegdec, "data:%p, size:%d, id:%d", data, size,
- dec_info->idx);
-
- *ret = GST_FLOW_OK;
- ffmpegdec->context->frame_number++;
-
- oclass = (GstFFMpegAudDecClass *) (G_OBJECT_GET_CLASS (ffmpegdec));
-
- len =
- gst_ffmpegauddec_audio_frame (ffmpegdec, oclass->in_plugin, data, size,
- dec_info, &outbuf, ret);
-
- /* if we did not get an output buffer and we have a pending discont, don't
- * clear the input timestamps, we will put them on the next buffer because
- * else we might create the first buffer with a very big timestamp gap. */
- if (outbuf == NULL && ffmpegdec->discont) {
- GST_DEBUG_OBJECT (ffmpegdec, "no buffer but keeping timestamp");
- ffmpegdec->clear_ts = FALSE;
- }
-
- if (outbuf)
- have_data = 1;
-
- if (len < 0 || have_data < 0) {
- GST_WARNING_OBJECT (ffmpegdec,
- "avdec_%s: decoding error (len: %d, have_data: %d)",
- oclass->in_plugin->name, len, have_data);
- *got_data = 0;
- goto beach;
- } else if (len == 0 && have_data == 0) {
- *got_data = 0;
- goto beach;
- } else {
- /* this is where I lost my last clue on ffmpeg... */
- *got_data = 1;
- }
-
- if (outbuf) {
- GST_LOG_OBJECT (ffmpegdec,
- "Decoded data, now pushing buffer %p with offset %" G_GINT64_FORMAT
- ", timestamp %" GST_TIME_FORMAT " and duration %" GST_TIME_FORMAT,
- outbuf, GST_BUFFER_OFFSET (outbuf),
- GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (outbuf)),
- GST_TIME_ARGS (GST_BUFFER_DURATION (outbuf)));
-
- /* mark pending discont */
- if (ffmpegdec->discont) {
- GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_FLAG_DISCONT);
- ffmpegdec->discont = FALSE;
- }
- if (ffmpegdec->segment.rate > 0.0) {
- /* and off we go */
- *ret = gst_pad_push (ffmpegdec->srcpad, outbuf);
- } else {
- /* reverse playback, queue frame till later when we get a discont. */
- GST_DEBUG_OBJECT (ffmpegdec, "queued frame");
- ffmpegdec->queued = g_list_prepend (ffmpegdec->queued, outbuf);
- *ret = GST_FLOW_OK;
- }
- } else {
- GST_DEBUG_OBJECT (ffmpegdec, "We didn't get a decoded buffer");
- }
-
-beach:
- return len;
-
- /* ERRORS */
-no_codec:
- {
- GST_ERROR_OBJECT (ffmpegdec, "no codec context");
- return -1;
- }
-}
-
-static void
-gst_ffmpegauddec_drain (GstFFMpegAudDec * ffmpegdec)
-{
- GstFFMpegAudDecClass *oclass;
-
- oclass = (GstFFMpegAudDecClass *) (G_OBJECT_GET_CLASS (ffmpegdec));
-
- if (oclass->in_plugin->capabilities & CODEC_CAP_DELAY) {
- gint have_data, len, try = 0;
-
- GST_LOG_OBJECT (ffmpegdec,
- "codec has delay capabilities, calling until libav has drained everything");
-
- do {
- GstFlowReturn ret;
-
- len =
- gst_ffmpegauddec_frame (ffmpegdec, NULL, 0, &have_data, &ts_info_none,
- &ret);
- if (len < 0 || have_data == 0)
- break;
- } while (try++ < 10);
- }
- if (ffmpegdec->segment.rate < 0.0) {
- /* if we have some queued frames for reverse playback, flush them now */
- flush_queued (ffmpegdec);
- }
-}
-
-static void
-gst_ffmpegauddec_flush_pcache (GstFFMpegAudDec * ffmpegdec)
-{
- if (ffmpegdec->pctx) {
- gint size, bsize;
- guint8 *data;
- guint8 bdata[FF_INPUT_BUFFER_PADDING_SIZE];
-
- bsize = FF_INPUT_BUFFER_PADDING_SIZE;
- memset (bdata, 0, bsize);
-
- /* parse some dummy data to work around some ffmpeg weirdness where it keeps
- * the previous pts around */
- av_parser_parse2 (ffmpegdec->pctx, ffmpegdec->context,
- &data, &size, bdata, bsize, -1, -1, -1);
- ffmpegdec->pctx->pts = -1;
- ffmpegdec->pctx->dts = -1;
- }
-
- if (ffmpegdec->pcache) {
- gst_buffer_unref (ffmpegdec->pcache);
- ffmpegdec->pcache = NULL;
- }
-}
-
-static gboolean
-gst_ffmpegauddec_sink_event (GstPad * pad, GstObject * parent, GstEvent * event)
-{
- GstFFMpegAudDec *ffmpegdec;
- gboolean ret = FALSE;
-
- ffmpegdec = (GstFFMpegAudDec *) parent;
-
- GST_DEBUG_OBJECT (ffmpegdec, "Handling %s event",
- GST_EVENT_TYPE_NAME (event));
-
- switch (GST_EVENT_TYPE (event)) {
- case GST_EVENT_EOS:
- {
- gst_ffmpegauddec_drain (ffmpegdec);
- break;
- }
- case GST_EVENT_FLUSH_STOP:
- {
- if (ffmpegdec->opened) {
- avcodec_flush_buffers (ffmpegdec->context);
- }
- gst_ffmpegauddec_reset_ts (ffmpegdec);
- gst_ffmpegauddec_flush_pcache (ffmpegdec);
- gst_segment_init (&ffmpegdec->segment, GST_FORMAT_TIME);
- clear_queued (ffmpegdec);
- break;
- }
- case GST_EVENT_CAPS:
- {
- GstCaps *caps;
-
- gst_event_parse_caps (event, &caps);
-
- if (!ffmpegdec->last_caps
- || !gst_caps_is_equal (ffmpegdec->last_caps, caps)) {
- ret = gst_ffmpegauddec_setcaps (ffmpegdec, caps);
- if (ret) {
- gst_caps_replace (&ffmpegdec->last_caps, caps);
- }
- } else {
- ret = TRUE;
- }
-
- gst_event_unref (event);
- goto done;
- }
- case GST_EVENT_SEGMENT:
- {
- GstSegment segment;
-
- gst_event_copy_segment (event, &segment);
-
- switch (segment.format) {
- case GST_FORMAT_TIME:
- /* fine, our native segment format */
- break;
- case GST_FORMAT_BYTES:
- {
- gint bit_rate;
-
- bit_rate = ffmpegdec->context->bit_rate;
-
- /* convert to time or fail */
- if (!bit_rate)
- goto no_bitrate;
-
- GST_DEBUG_OBJECT (ffmpegdec, "bitrate: %d", bit_rate);
-
- /* convert values to TIME */
- if (segment.start != -1)
- segment.start =
- gst_util_uint64_scale_int (segment.start, GST_SECOND, bit_rate);
- if (segment.stop != -1)
- segment.stop =
- gst_util_uint64_scale_int (segment.stop, GST_SECOND, bit_rate);
- if (segment.time != -1)
- segment.time =
- gst_util_uint64_scale_int (segment.time, GST_SECOND, bit_rate);
-
- /* unref old event */
- gst_event_unref (event);
-
- /* create new converted time segment */
- segment.format = GST_FORMAT_TIME;
- /* FIXME, bitrate is not good enough too find a good stop, let's
- * hope start and time were 0... meh. */
- segment.stop = -1;
- event = gst_event_new_segment (&segment);
- break;
- }
- default:
- /* invalid format */
- goto invalid_format;
- }
-
- GST_DEBUG_OBJECT (ffmpegdec, "SEGMENT in time %" GST_SEGMENT_FORMAT,
- &segment);
-
- /* and store the values */
- gst_segment_copy_into (&segment, &ffmpegdec->segment);
- break;
- }
- default:
- break;
- }
-
- /* and push segment downstream */
- ret = gst_pad_push_event (ffmpegdec->srcpad, event);
-
-done:
-
- return ret;
-
- /* ERRORS */
-no_bitrate:
- {
- GST_WARNING_OBJECT (ffmpegdec, "no bitrate to convert BYTES to TIME");
- gst_event_unref (event);
- goto done;
- }
-invalid_format:
- {
- GST_WARNING_OBJECT (ffmpegdec, "unknown format received in NEWSEGMENT");
- gst_event_unref (event);
- goto done;
- }
-}
-
-static gboolean
-gst_ffmpegauddec_sink_query (GstPad * pad, GstObject * parent, GstQuery * query)
-{
- GstFFMpegAudDec *ffmpegdec;
- gboolean ret = FALSE;
-
- ffmpegdec = (GstFFMpegAudDec *) parent;
-
- GST_DEBUG_OBJECT (ffmpegdec, "Handling %s query",
- GST_QUERY_TYPE_NAME (query));
-
- switch (GST_QUERY_TYPE (query)) {
- case GST_QUERY_ACCEPT_CAPS:
- {
- GstPadTemplate *templ;
-
- ret = FALSE;
- if ((templ = GST_PAD_PAD_TEMPLATE (pad))) {
- GstCaps *tcaps;
-
- if ((tcaps = GST_PAD_TEMPLATE_CAPS (templ))) {
- GstCaps *caps;
-
- gst_query_parse_accept_caps (query, &caps);
- gst_query_set_accept_caps_result (query,
- gst_caps_is_subset (caps, tcaps));
- ret = TRUE;
- }
- }
- break;
- }
- default:
- ret = gst_pad_query_default (pad, parent, query);
- break;
- }
- return ret;
-}
-
-static GstFlowReturn
-gst_ffmpegauddec_chain (GstPad * pad, GstObject * parent, GstBuffer * inbuf)
-{
- GstFFMpegAudDec *ffmpegdec;
- GstFFMpegAudDecClass *oclass;
- guint8 *data, *bdata;
- GstMapInfo map;
- gint size, bsize, len, have_data;
- GstFlowReturn ret = GST_FLOW_OK;
- GstClockTime in_pts, in_dts, in_duration;
- gboolean discont;
- gint64 in_offset;
- const GstTSInfo *in_info;
- const GstTSInfo *dec_info;
-
- ffmpegdec = (GstFFMpegAudDec *) parent;
-
- if (G_UNLIKELY (!ffmpegdec->opened))
- goto not_negotiated;
-
- discont = GST_BUFFER_IS_DISCONT (inbuf);
-
- /* The discont flags marks a buffer that is not continuous with the previous
- * buffer. This means we need to clear whatever data we currently have. We let
- * ffmpeg continue with the data that it has. We currently drain the old
- * frames that might be inside the decoder and we clear any partial data in
- * the pcache, we might be able to remove the drain and flush too. */
- if (G_UNLIKELY (discont)) {
- GST_DEBUG_OBJECT (ffmpegdec, "received DISCONT");
- /* drain what we have queued */
- gst_ffmpegauddec_drain (ffmpegdec);
- gst_ffmpegauddec_flush_pcache (ffmpegdec);
- ffmpegdec->discont = TRUE;
- gst_ffmpegauddec_reset_ts (ffmpegdec);
- }
- /* by default we clear the input timestamp after decoding each frame so that
- * interpollation can work. */
- ffmpegdec->clear_ts = TRUE;
-
- oclass = (GstFFMpegAudDecClass *) (G_OBJECT_GET_CLASS (ffmpegdec));
-
- /* parse cache joining. If there is cached data */
- if (ffmpegdec->pcache) {
- /* join with previous data */
- GST_LOG_OBJECT (ffmpegdec, "join parse cache");
- inbuf = gst_buffer_append (ffmpegdec->pcache, inbuf);
- /* no more cached data, we assume we can consume the complete cache */
- ffmpegdec->pcache = NULL;
- }
-
- in_dts = GST_BUFFER_DTS (inbuf);
- in_pts = GST_BUFFER_PTS (inbuf);
- in_duration = GST_BUFFER_DURATION (inbuf);
- in_offset = GST_BUFFER_OFFSET (inbuf);
-
- /* get handle to timestamp info, we can pass this around to ffmpeg */
- in_info =
- gst_ts_info_store (ffmpegdec, in_dts, in_pts, in_duration, in_offset);
-
- GST_LOG_OBJECT (ffmpegdec,
- "Received new data of size %u, offset:%" G_GUINT64_FORMAT ", ts:%"
- GST_TIME_FORMAT ", dur:%" GST_TIME_FORMAT ", info %d",
- gst_buffer_get_size (inbuf), GST_BUFFER_OFFSET (inbuf),
- GST_TIME_ARGS (in_pts), GST_TIME_ARGS (in_duration), in_info->idx);
-
- /* workarounds, functions write to buffers:
- * libavcodec/svq1.c:svq1_decode_frame writes to the given buffer.
- * libavcodec/svq3.c:svq3_decode_slice_header too.
- * ffmpeg devs know about it and will fix it (they said). */
- if (oclass->in_plugin->id == CODEC_ID_SVQ1 ||
- oclass->in_plugin->id == CODEC_ID_SVQ3) {
- inbuf = gst_buffer_make_writable (inbuf);
- }
-
- gst_buffer_map (inbuf, &map, GST_MAP_READ);
-
- bdata = map.data;
- bsize = map.size;
-
- GST_LOG_OBJECT (ffmpegdec,
- "Received new data of size %u, offset:%" G_GUINT64_FORMAT ", dts:%"
- GST_TIME_FORMAT ", pts:%" GST_TIME_FORMAT ", dur:%" GST_TIME_FORMAT
- ", info %d", bsize, in_offset, GST_TIME_ARGS (in_dts),
- GST_TIME_ARGS (in_pts), GST_TIME_ARGS (in_duration), in_info->idx);
-
- do {
- /* parse, if at all possible */
- if (ffmpegdec->pctx) {
- gint res;
-
- GST_LOG_OBJECT (ffmpegdec,
- "Calling av_parser_parse2 with offset %" G_GINT64_FORMAT ", ts:%"
- GST_TIME_FORMAT " size %d", in_offset, GST_TIME_ARGS (in_pts), bsize);
-
- /* feed the parser. We pass the timestamp info so that we can recover all
- * info again later */
- res = av_parser_parse2 (ffmpegdec->pctx, ffmpegdec->context,
- &data, &size, bdata, bsize, in_info->idx, in_info->idx, in_offset);
-
- GST_LOG_OBJECT (ffmpegdec,
- "parser returned res %d and size %d, id %" G_GINT64_FORMAT, res, size,
- (gint64) ffmpegdec->pctx->pts);
-
- /* store pts for decoding */
- if (ffmpegdec->pctx->pts != AV_NOPTS_VALUE && ffmpegdec->pctx->pts != -1)
- dec_info = gst_ts_info_get (ffmpegdec, ffmpegdec->pctx->pts);
- else {
- /* ffmpeg sometimes loses track after a flush, help it by feeding a
- * valid start time */
- ffmpegdec->pctx->pts = in_info->idx;
- ffmpegdec->pctx->dts = in_info->idx;
- dec_info = in_info;
- }
-
- GST_LOG_OBJECT (ffmpegdec, "consuming %d bytes. id %d", size,
- dec_info->idx);
-
- if (res) {
- /* there is output, set pointers for next round. */
- bsize -= res;
- bdata += res;
- } else {
- /* Parser did not consume any data, make sure we don't clear the
- * timestamp for the next round */
- ffmpegdec->clear_ts = FALSE;
- }
-
- /* if there is no output, we must break and wait for more data. also the
- * timestamp in the context is not updated. */
- if (size == 0) {
- if (bsize > 0)
- continue;
- else
- break;
- }
- } else {
- data = bdata;
- size = bsize;
-
- dec_info = in_info;
- }
-
- /* decode a frame of audio now */
- len =
- gst_ffmpegauddec_frame (ffmpegdec, data, size, &have_data, dec_info,
- &ret);
-
- if (ret != GST_FLOW_OK) {
- GST_LOG_OBJECT (ffmpegdec, "breaking because of flow ret %s",
- gst_flow_get_name (ret));
- /* bad flow return, make sure we discard all data and exit */
- bsize = 0;
- break;
- }
- if (!ffmpegdec->pctx) {
- if (len == 0 && !have_data) {
- /* nothing was decoded, this could be because no data was available or
- * because we were skipping frames.
- * If we have no context we must exit and wait for more data, we keep the
- * data we tried. */
- GST_LOG_OBJECT (ffmpegdec, "Decoding didn't return any data, breaking");
- break;
- } else if (len < 0) {
- /* a decoding error happened, we must break and try again with next data. */
- GST_LOG_OBJECT (ffmpegdec, "Decoding error, breaking");
- bsize = 0;
- break;
- }
- /* prepare for the next round, for codecs with a context we did this
- * already when using the parser. */
- bsize -= len;
- bdata += len;
- } else {
- if (len == 0) {
- /* nothing was decoded, this could be because no data was available or
- * because we were skipping frames. Since we have a parser we can
- * continue with the next frame */
- GST_LOG_OBJECT (ffmpegdec,
- "Decoding didn't return any data, trying next");
- } else if (len < 0) {
- /* we have a context that will bring us to the next frame */
- GST_LOG_OBJECT (ffmpegdec, "Decoding error, trying next");
- }
- }
-
- /* make sure we don't use the same old timestamp for the next frame and let
- * the interpollation take care of it. */
- if (ffmpegdec->clear_ts) {
- in_dts = GST_CLOCK_TIME_NONE;
- in_pts = GST_CLOCK_TIME_NONE;
- in_duration = GST_CLOCK_TIME_NONE;
- in_offset = GST_BUFFER_OFFSET_NONE;
- in_info = GST_TS_INFO_NONE;
- } else {
- ffmpegdec->clear_ts = TRUE;
- }
-
- GST_LOG_OBJECT (ffmpegdec, "Before (while bsize>0). bsize:%d , bdata:%p",
- bsize, bdata);
- } while (bsize > 0);
-
- gst_buffer_unmap (inbuf, &map);
-
- /* keep left-over */
- if (ffmpegdec->pctx && bsize > 0) {
- in_pts = GST_BUFFER_PTS (inbuf);
- in_dts = GST_BUFFER_DTS (inbuf);
- in_offset = GST_BUFFER_OFFSET (inbuf);
-
- GST_LOG_OBJECT (ffmpegdec,
- "Keeping %d bytes of data with offset %" G_GINT64_FORMAT ", pts %"
- GST_TIME_FORMAT, bsize, in_offset, GST_TIME_ARGS (in_pts));
-
- ffmpegdec->pcache = gst_buffer_copy_region (inbuf, GST_BUFFER_COPY_ALL,
- gst_buffer_get_size (inbuf) - bsize, bsize);
- /* we keep timestamp, even though all we really know is that the correct
- * timestamp is not below the one from inbuf */
- GST_BUFFER_PTS (ffmpegdec->pcache) = in_pts;
- GST_BUFFER_DTS (ffmpegdec->pcache) = in_dts;
- GST_BUFFER_OFFSET (ffmpegdec->pcache) = in_offset;
- } else if (bsize > 0) {
- GST_DEBUG_OBJECT (ffmpegdec, "Dropping %d bytes of data", bsize);
- }
- gst_buffer_unref (inbuf);
-
- return ret;
-
- /* ERRORS */
-not_negotiated:
- {
- oclass = (GstFFMpegAudDecClass *) (G_OBJECT_GET_CLASS (ffmpegdec));
- GST_ELEMENT_ERROR (ffmpegdec, CORE, NEGOTIATION, (NULL),
- ("avdec_%s: input format was not set before data start",
- oclass->in_plugin->name));
- gst_buffer_unref (inbuf);
- return GST_FLOW_NOT_NEGOTIATED;
- }
-}
-
-static GstStateChangeReturn
-gst_ffmpegauddec_change_state (GstElement * element, GstStateChange transition)
-{
- GstFFMpegAudDec *ffmpegdec = (GstFFMpegAudDec *) element;
- GstStateChangeReturn ret;
-
- ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
-
- switch (transition) {
- case GST_STATE_CHANGE_PAUSED_TO_READY:
- GST_OBJECT_LOCK (ffmpegdec);
- gst_ffmpegauddec_close (ffmpegdec);
- GST_OBJECT_UNLOCK (ffmpegdec);
- clear_queued (ffmpegdec);
- break;
- default:
- break;
- }
-
- return ret;
-}
-
-gboolean
-gst_ffmpegauddec_register (GstPlugin * plugin)
-{
- GTypeInfo typeinfo = {
- sizeof (GstFFMpegAudDecClass),
- (GBaseInitFunc) gst_ffmpegauddec_base_init,
- NULL,
- (GClassInitFunc) gst_ffmpegauddec_class_init,
- NULL,
- NULL,
- sizeof (GstFFMpegAudDec),
- 0,
- (GInstanceInitFunc) gst_ffmpegauddec_init,
- };
- GType type;
- AVCodec *in_plugin;
- gint rank;
-
- in_plugin = av_codec_next (NULL);
-
- GST_LOG ("Registering decoders");
-
- while (in_plugin) {
- gchar *type_name;
- gchar *plugin_name;
-
- /* only decoders */
- if (!in_plugin->decode || in_plugin->type != AVMEDIA_TYPE_AUDIO) {
- goto next;
- }
-
- /* no quasi-codecs, please */
- if (in_plugin->id >= CODEC_ID_PCM_S16LE &&
- in_plugin->id <= CODEC_ID_PCM_BLURAY) {
- goto next;
- }
-
- /* No decoders depending on external libraries (we don't build them, but
- * people who build against an external ffmpeg might have them.
- * We have native gstreamer plugins for all of those libraries anyway. */
- if (!strncmp (in_plugin->name, "lib", 3)) {
- GST_DEBUG
- ("Not using external library decoder %s. Use the gstreamer-native ones instead.",
- in_plugin->name);
- goto next;
- }
-
- GST_DEBUG ("Trying plugin %s [%s]", in_plugin->name, in_plugin->long_name);
-
- /* no codecs for which we're GUARANTEED to have better alternatives */
- /* MP1 : Use MP3 for decoding */
- /* MP2 : Use MP3 for decoding */
- /* Theora: Use libtheora based theoradec */
- if (!strcmp (in_plugin->name, "vorbis") ||
- !strcmp (in_plugin->name, "wavpack") ||
- !strcmp (in_plugin->name, "mp1") ||
- !strcmp (in_plugin->name, "mp2") ||
- !strcmp (in_plugin->name, "libfaad") ||
- !strcmp (in_plugin->name, "mpeg4aac") ||
- !strcmp (in_plugin->name, "ass") ||
- !strcmp (in_plugin->name, "srt") ||
- !strcmp (in_plugin->name, "pgssub") ||
- !strcmp (in_plugin->name, "dvdsub") ||
- !strcmp (in_plugin->name, "dvbsub")) {
- GST_LOG ("Ignoring decoder %s", in_plugin->name);
- goto next;
- }
-
- /* construct the type */
- plugin_name = g_strdup ((gchar *) in_plugin->name);
- g_strdelimit (plugin_name, NULL, '_');
- type_name = g_strdup_printf ("avdec_%s", plugin_name);
- g_free (plugin_name);
-
- type = g_type_from_name (type_name);
-
- if (!type) {
- /* create the gtype now */
- type = g_type_register_static (GST_TYPE_ELEMENT, type_name, &typeinfo, 0);
- g_type_set_qdata (type, GST_FFDEC_PARAMS_QDATA, (gpointer) in_plugin);
- }
-
- /* (Ronald) MPEG-4 gets a higher priority because it has been well-
- * tested and by far outperforms divxdec/xviddec - so we prefer it.
- * msmpeg4v3 same, as it outperforms divxdec for divx3 playback.
- * VC1/WMV3 are not working and thus unpreferred for now. */
- switch (in_plugin->id) {
- case CODEC_ID_RA_144:
- case CODEC_ID_RA_288:
- case CODEC_ID_COOK:
- rank = GST_RANK_PRIMARY;
- break;
- /* SIPR: decoder should have a higher rank than realaudiodec.
- */
- case CODEC_ID_SIPR:
- rank = GST_RANK_SECONDARY;
- break;
- case CODEC_ID_MP3:
- rank = GST_RANK_NONE;
- break;
- default:
- rank = GST_RANK_MARGINAL;
- break;
- }
- if (!gst_element_register (plugin, type_name, rank, type)) {
- g_warning ("Failed to register %s", type_name);
- g_free (type_name);
- return FALSE;
- }
-
- g_free (type_name);
-
- next:
- in_plugin = av_codec_next (in_plugin);
- }
-
- GST_LOG ("Finished Registering decoders");
-
- return TRUE;
-}
diff --git a/ext/libav/gstavdeinterlace.c b/ext/libav/gstavdeinterlace.c
index 65961f6..faa81bb 100644
--- a/ext/libav/gstavdeinterlace.c
+++ b/ext/libav/gstavdeinterlace.c
@@ -16,8 +16,8 @@
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
*/
#ifdef HAVE_CONFIG_H
@@ -203,7 +203,7 @@ gst_ffmpegdeinterlace_sink_setcaps (GstPad * pad, GstCaps * caps)
}
gst_ffmpegdeinterlace_update_passthrough (deinterlace);
- ctx = avcodec_alloc_context ();
+ ctx = avcodec_alloc_context3 (NULL);
ctx->width = deinterlace->width;
ctx->height = deinterlace->height;
ctx->pix_fmt = PIX_FMT_NB;
diff --git a/ext/libav/gstavdemux.c b/ext/libav/gstavdemux.c
index bee67a5..42c0b77 100644
--- a/ext/libav/gstavdemux.c
+++ b/ext/libav/gstavdemux.c
@@ -15,8 +15,8 @@
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
*/
#ifdef HAVE_CONFIG_H
@@ -32,7 +32,7 @@
#include "gstav.h"
#include "gstavcodecmap.h"
#include "gstavutils.h"
-#include "gstavpipe.h"
+#include "gstavprotocol.h"
#define MAX_STREAMS 20
@@ -332,7 +332,14 @@ gst_ffmpegdemux_close (GstFFMpegDemux * demux)
demux->audiopads = 0;
/* close demuxer context from ffmpeg */
- av_close_input_file (demux->context);
+ if (demux->seekable)
+ gst_ffmpegdata_close (demux->context->pb);
+ else
+ gst_ffmpeg_pipe_close (demux->context->pb);
+ demux->context->pb = NULL;
+ avformat_close_input (&demux->context);
+ if (demux->context)
+ avformat_free_context (demux->context);
demux->context = NULL;
GST_OBJECT_LOCK (demux);
@@ -995,7 +1002,7 @@ gst_ffmpegdemux_get_stream (GstFFMpegDemux * demux, AVStream * avstream)
stream_id =
- gst_pad_create_stream_id_printf (pad, GST_ELEMENT_CAST (demux), "%u",
+ gst_pad_create_stream_id_printf (pad, GST_ELEMENT_CAST (demux), "%03u",
avstream->index);
gst_pad_push_event (pad, gst_event_new_stream_start (stream_id));
g_free (stream_id);
@@ -1115,9 +1122,9 @@ gst_ffmpegdemux_read_tags (GstFFMpegDemux * demux)
static gboolean
gst_ffmpegdemux_open (GstFFMpegDemux * demux)
{
+ AVIOContext *iocontext = NULL;
GstFFMpegDemuxClass *oclass =
(GstFFMpegDemuxClass *) G_OBJECT_GET_CLASS (demux);
- gchar *location;
gint res, n_streams, i;
#if 0
/* Re-enable once converted to new AVMetaData API
@@ -1133,15 +1140,14 @@ gst_ffmpegdemux_open (GstFFMpegDemux * demux)
/* open via our input protocol hack */
if (demux->seekable)
- location = g_strdup_printf ("gstreamer://%p", demux->sinkpad);
+ res = gst_ffmpegdata_open (demux->sinkpad, AVIO_FLAG_READ, &iocontext);
else
- location = g_strdup_printf ("gstpipe://%p", &demux->ffpipe);
- GST_DEBUG_OBJECT (demux, "about to call av_open_input_file %s", location);
+ res = gst_ffmpeg_pipe_open (&demux->ffpipe, AVIO_FLAG_READ, &iocontext);
- res = av_open_input_file (&demux->context, location,
- oclass->in_plugin, 0, NULL);
+ demux->context = avformat_alloc_context ();
+ demux->context->pb = iocontext;
+ res = avformat_open_input (&demux->context, NULL, oclass->in_plugin, NULL);
- g_free (location);
GST_DEBUG_OBJECT (demux, "av_open_input returned %d", res);
if (res < 0)
goto open_failed;
@@ -1377,7 +1383,7 @@ gst_ffmpegdemux_loop (GstFFMpegDemux * demux)
srcpad = stream->pad;
rawvideo = (avstream->codec->codec_type == AVMEDIA_TYPE_VIDEO &&
- avstream->codec->codec_id == CODEC_ID_RAWVIDEO);
+ avstream->codec->codec_id == AV_CODEC_ID_RAWVIDEO);
if (rawvideo)
outsize = gst_ffmpeg_avpicture_get_size (avstream->codec->pix_fmt,
diff --git a/ext/libav/gstavenc.c b/ext/libav/gstavenc.c
deleted file mode 100644
index 312787e..0000000
--- a/ext/libav/gstavenc.c
+++ /dev/null
@@ -1,825 +0,0 @@
-/* GStreamer
- * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <assert.h>
-#include <string.h>
-/* for stats file handling */
-#include <stdio.h>
-#include <glib/gstdio.h>
-#include <errno.h>
-
-#include <libavcodec/avcodec.h>
-
-#include <gst/gst.h>
-
-#include "gstav.h"
-#include "gstavcodecmap.h"
-#include "gstavutils.h"
-#include "gstavenc.h"
-
-#define DEFAULT_AUDIO_BITRATE 128000
-
-enum
-{
- /* FILL ME */
- LAST_SIGNAL
-};
-
-enum
-{
- ARG_0,
- ARG_BIT_RATE,
- ARG_BUFSIZE,
- ARG_RTP_PAYLOAD_SIZE,
-};
-
-/* A number of function prototypes are given so we can refer to them later. */
-static void gst_ffmpegaudenc_class_init (GstFFMpegAudEncClass * klass);
-static void gst_ffmpegaudenc_base_init (GstFFMpegAudEncClass * klass);
-static void gst_ffmpegaudenc_init (GstFFMpegAudEnc * ffmpegaudenc);
-static void gst_ffmpegaudenc_finalize (GObject * object);
-
-static gboolean gst_ffmpegaudenc_setcaps (GstFFMpegAudEnc * ffmpegenc,
- GstCaps * caps);
-static GstCaps *gst_ffmpegaudenc_getcaps (GstFFMpegAudEnc * ffmpegenc,
- GstCaps * filter);
-static GstFlowReturn gst_ffmpegaudenc_chain_audio (GstPad * pad,
- GstObject * parent, GstBuffer * buffer);
-static gboolean gst_ffmpegaudenc_query_sink (GstPad * pad, GstObject * parent,
- GstQuery * query);
-static gboolean gst_ffmpegaudenc_event_sink (GstPad * pad, GstObject * parent,
- GstEvent * event);
-
-static void gst_ffmpegaudenc_set_property (GObject * object,
- guint prop_id, const GValue * value, GParamSpec * pspec);
-static void gst_ffmpegaudenc_get_property (GObject * object,
- guint prop_id, GValue * value, GParamSpec * pspec);
-
-static GstStateChangeReturn gst_ffmpegaudenc_change_state (GstElement * element,
- GstStateChange transition);
-
-#define GST_FFENC_PARAMS_QDATA g_quark_from_static_string("avenc-params")
-
-static GstElementClass *parent_class = NULL;
-
-/*static guint gst_ffmpegaudenc_signals[LAST_SIGNAL] = { 0 }; */
-
-static void
-gst_ffmpegaudenc_base_init (GstFFMpegAudEncClass * klass)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
- AVCodec *in_plugin;
- GstPadTemplate *srctempl = NULL, *sinktempl = NULL;
- GstCaps *srccaps = NULL, *sinkcaps = NULL;
- gchar *longname, *description;
-
- in_plugin =
- (AVCodec *) g_type_get_qdata (G_OBJECT_CLASS_TYPE (klass),
- GST_FFENC_PARAMS_QDATA);
- g_assert (in_plugin != NULL);
-
- /* construct the element details struct */
- longname = g_strdup_printf ("libav %s encoder", in_plugin->long_name);
- description = g_strdup_printf ("libav %s encoder", in_plugin->name);
- gst_element_class_set_metadata (element_class, longname,
- "Codec/Encoder/Audio", description,
- "Wim Taymans <wim.taymans@gmail.com>, "
- "Ronald Bultje <rbultje@ronald.bitfreak.net>");
- g_free (longname);
- g_free (description);
-
- if (!(srccaps = gst_ffmpeg_codecid_to_caps (in_plugin->id, NULL, TRUE))) {
- GST_DEBUG ("Couldn't get source caps for encoder '%s'", in_plugin->name);
- srccaps = gst_caps_new_empty_simple ("unknown/unknown");
- }
-
- sinkcaps = gst_ffmpeg_codectype_to_audio_caps (NULL,
- in_plugin->id, TRUE, in_plugin);
- if (!sinkcaps) {
- GST_DEBUG ("Couldn't get sink caps for encoder '%s'", in_plugin->name);
- sinkcaps = gst_caps_new_empty_simple ("unknown/unknown");
- }
-
- /* pad templates */
- sinktempl = gst_pad_template_new ("sink", GST_PAD_SINK,
- GST_PAD_ALWAYS, sinkcaps);
- srctempl = gst_pad_template_new ("src", GST_PAD_SRC, GST_PAD_ALWAYS, srccaps);
-
- gst_element_class_add_pad_template (element_class, srctempl);
- gst_element_class_add_pad_template (element_class, sinktempl);
-
- klass->in_plugin = in_plugin;
- klass->srctempl = srctempl;
- klass->sinktempl = sinktempl;
- klass->sinkcaps = NULL;
-
- return;
-}
-
-static void
-gst_ffmpegaudenc_class_init (GstFFMpegAudEncClass * klass)
-{
- GObjectClass *gobject_class;
- GstElementClass *gstelement_class;
-
- gobject_class = (GObjectClass *) klass;
- gstelement_class = (GstElementClass *) klass;
-
- parent_class = g_type_class_peek_parent (klass);
-
- gobject_class->set_property = gst_ffmpegaudenc_set_property;
- gobject_class->get_property = gst_ffmpegaudenc_get_property;
-
- /* FIXME: could use -1 for a sensible per-codec defaults */
- g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BIT_RATE,
- g_param_spec_int ("bitrate", "Bit Rate",
- "Target Audio Bitrate", 0, G_MAXINT, DEFAULT_AUDIO_BITRATE,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- gstelement_class->change_state = gst_ffmpegaudenc_change_state;
-
- gobject_class->finalize = gst_ffmpegaudenc_finalize;
-}
-
-static void
-gst_ffmpegaudenc_init (GstFFMpegAudEnc * ffmpegaudenc)
-{
- GstFFMpegAudEncClass *oclass =
- (GstFFMpegAudEncClass *) (G_OBJECT_GET_CLASS (ffmpegaudenc));
-
- /* setup pads */
- ffmpegaudenc->sinkpad = gst_pad_new_from_template (oclass->sinktempl, "sink");
- gst_pad_set_event_function (ffmpegaudenc->sinkpad,
- gst_ffmpegaudenc_event_sink);
- gst_pad_set_query_function (ffmpegaudenc->sinkpad,
- gst_ffmpegaudenc_query_sink);
- gst_pad_set_chain_function (ffmpegaudenc->sinkpad,
- gst_ffmpegaudenc_chain_audio);
-
- ffmpegaudenc->srcpad = gst_pad_new_from_template (oclass->srctempl, "src");
- gst_pad_use_fixed_caps (ffmpegaudenc->srcpad);
-
- /* ffmpeg objects */
- ffmpegaudenc->context = avcodec_alloc_context ();
- ffmpegaudenc->opened = FALSE;
-
- gst_element_add_pad (GST_ELEMENT (ffmpegaudenc), ffmpegaudenc->sinkpad);
- gst_element_add_pad (GST_ELEMENT (ffmpegaudenc), ffmpegaudenc->srcpad);
-
- ffmpegaudenc->adapter = gst_adapter_new ();
-}
-
-static void
-gst_ffmpegaudenc_finalize (GObject * object)
-{
- GstFFMpegAudEnc *ffmpegaudenc = (GstFFMpegAudEnc *) object;
-
-
- /* close old session */
- if (ffmpegaudenc->opened) {
- gst_ffmpeg_avcodec_close (ffmpegaudenc->context);
- ffmpegaudenc->opened = FALSE;
- }
-
- /* clean up remaining allocated data */
- av_free (ffmpegaudenc->context);
-
- g_object_unref (ffmpegaudenc->adapter);
-
- G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-static GstCaps *
-gst_ffmpegaudenc_getcaps (GstFFMpegAudEnc * ffmpegaudenc, GstCaps * filter)
-{
- GstCaps *caps = NULL;
-
- GST_DEBUG_OBJECT (ffmpegaudenc, "getting caps");
-
- /* audio needs no special care */
- caps = gst_pad_get_pad_template_caps (ffmpegaudenc->sinkpad);
-
- if (filter) {
- GstCaps *tmp;
- tmp = gst_caps_intersect_full (filter, caps, GST_CAPS_INTERSECT_FIRST);
- gst_caps_unref (caps);
- caps = tmp;
- }
-
- GST_DEBUG_OBJECT (ffmpegaudenc,
- "audio caps, return template %" GST_PTR_FORMAT, caps);
-
- return caps;
-}
-
-static gboolean
-gst_ffmpegaudenc_setcaps (GstFFMpegAudEnc * ffmpegaudenc, GstCaps * caps)
-{
- GstCaps *other_caps;
- GstCaps *allowed_caps;
- GstCaps *icaps;
- GstFFMpegAudEncClass *oclass =
- (GstFFMpegAudEncClass *) G_OBJECT_GET_CLASS (ffmpegaudenc);
-
- /* close old session */
- if (ffmpegaudenc->opened) {
- gst_ffmpeg_avcodec_close (ffmpegaudenc->context);
- ffmpegaudenc->opened = FALSE;
- }
-
- /* set defaults */
- avcodec_get_context_defaults (ffmpegaudenc->context);
-
- /* if we set it in _getcaps we should set it also in _link */
- ffmpegaudenc->context->strict_std_compliance = -1;
-
- /* user defined properties */
- if (ffmpegaudenc->bitrate > 0) {
- GST_INFO_OBJECT (ffmpegaudenc, "Setting avcontext to bitrate %d",
- ffmpegaudenc->bitrate);
- ffmpegaudenc->context->bit_rate = ffmpegaudenc->bitrate;
- ffmpegaudenc->context->bit_rate_tolerance = ffmpegaudenc->bitrate;
- } else {
- GST_INFO_OBJECT (ffmpegaudenc, "Using avcontext default bitrate %d",
- ffmpegaudenc->context->bit_rate);
- }
-
- /* RTP payload used for GOB production (for Asterisk) */
- if (ffmpegaudenc->rtp_payload_size) {
- ffmpegaudenc->context->rtp_payload_size = ffmpegaudenc->rtp_payload_size;
- }
-
- /* some other defaults */
- ffmpegaudenc->context->rc_strategy = 2;
- ffmpegaudenc->context->b_frame_strategy = 0;
- ffmpegaudenc->context->coder_type = 0;
- ffmpegaudenc->context->context_model = 0;
- ffmpegaudenc->context->scenechange_threshold = 0;
- ffmpegaudenc->context->inter_threshold = 0;
-
-
- /* fetch pix_fmt and so on */
- gst_ffmpeg_caps_with_codectype (oclass->in_plugin->type,
- caps, ffmpegaudenc->context);
- if (!ffmpegaudenc->context->time_base.den) {
- ffmpegaudenc->context->time_base.den = 25;
- ffmpegaudenc->context->time_base.num = 1;
- ffmpegaudenc->context->ticks_per_frame = 1;
- }
-
- /* open codec */
- if (gst_ffmpeg_avcodec_open (ffmpegaudenc->context, oclass->in_plugin) < 0) {
- if (ffmpegaudenc->context->priv_data)
- gst_ffmpeg_avcodec_close (ffmpegaudenc->context);
- if (ffmpegaudenc->context->stats_in)
- g_free (ffmpegaudenc->context->stats_in);
- GST_DEBUG_OBJECT (ffmpegaudenc, "avenc_%s: Failed to open FFMPEG codec",
- oclass->in_plugin->name);
- return FALSE;
- }
-
- /* second pass stats buffer no longer needed */
- if (ffmpegaudenc->context->stats_in)
- g_free (ffmpegaudenc->context->stats_in);
-
- /* some codecs support more than one format, first auto-choose one */
- GST_DEBUG_OBJECT (ffmpegaudenc, "picking an output format ...");
- allowed_caps = gst_pad_get_allowed_caps (ffmpegaudenc->srcpad);
- if (!allowed_caps) {
- GST_DEBUG_OBJECT (ffmpegaudenc, "... but no peer, using template caps");
- /* we need to copy because get_allowed_caps returns a ref, and
- * get_pad_template_caps doesn't */
- allowed_caps = gst_pad_get_pad_template_caps (ffmpegaudenc->srcpad);
- }
- GST_DEBUG_OBJECT (ffmpegaudenc, "chose caps %" GST_PTR_FORMAT, allowed_caps);
- gst_ffmpeg_caps_with_codecid (oclass->in_plugin->id,
- oclass->in_plugin->type, allowed_caps, ffmpegaudenc->context);
-
- /* try to set this caps on the other side */
- other_caps = gst_ffmpeg_codecid_to_caps (oclass->in_plugin->id,
- ffmpegaudenc->context, TRUE);
-
- if (!other_caps) {
- gst_caps_unref (allowed_caps);
- gst_ffmpeg_avcodec_close (ffmpegaudenc->context);
- GST_DEBUG ("Unsupported codec - no caps found");
- return FALSE;
- }
-
- icaps = gst_caps_intersect (allowed_caps, other_caps);
- gst_caps_unref (allowed_caps);
- gst_caps_unref (other_caps);
- if (gst_caps_is_empty (icaps)) {
- gst_caps_unref (icaps);
- return FALSE;
- }
-
- if (gst_caps_get_size (icaps) > 1) {
- GstCaps *newcaps;
-
- newcaps =
- gst_caps_new_full (gst_structure_copy (gst_caps_get_structure (icaps,
- 0)), NULL);
- gst_caps_unref (icaps);
- icaps = newcaps;
- }
-
- if (!gst_pad_set_caps (ffmpegaudenc->srcpad, icaps)) {
- gst_ffmpeg_avcodec_close (ffmpegaudenc->context);
- gst_caps_unref (icaps);
- return FALSE;
- }
- gst_caps_unref (icaps);
-
- /* success! */
- ffmpegaudenc->opened = TRUE;
-
- return TRUE;
-}
-
-
-static GstFlowReturn
-gst_ffmpegaudenc_encode_audio (GstFFMpegAudEnc * ffmpegaudenc,
- guint8 * audio_in, guint in_size, guint max_size, GstClockTime timestamp,
- GstClockTime duration, gboolean discont)
-{
- GstBuffer *outbuf;
- AVCodecContext *ctx;
- GstMapInfo map;
- gint res;
- GstFlowReturn ret;
-
- ctx = ffmpegaudenc->context;
-
- /* We need to provide at least ffmpegs minimal buffer size */
- outbuf = gst_buffer_new_and_alloc (max_size + FF_MIN_BUFFER_SIZE);
- gst_buffer_map (outbuf, &map, GST_MAP_WRITE);
-
- GST_LOG_OBJECT (ffmpegaudenc, "encoding buffer of max size %d", max_size);
- if (ffmpegaudenc->buffer_size != max_size)
- ffmpegaudenc->buffer_size = max_size;
-
- res = avcodec_encode_audio (ctx, map.data, max_size, (short *) audio_in);
-
- if (res < 0) {
- gst_buffer_unmap (outbuf, &map);
- GST_ERROR_OBJECT (ffmpegaudenc, "Failed to encode buffer: %d", res);
- gst_buffer_unref (outbuf);
- return GST_FLOW_OK;
- }
- GST_LOG_OBJECT (ffmpegaudenc, "got output size %d", res);
- gst_buffer_unmap (outbuf, &map);
- gst_buffer_resize (outbuf, 0, res);
-
- GST_BUFFER_TIMESTAMP (outbuf) = timestamp;
- GST_BUFFER_DURATION (outbuf) = duration;
- if (discont)
- GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_FLAG_DISCONT);
-
- GST_LOG_OBJECT (ffmpegaudenc, "pushing size %d, timestamp %" GST_TIME_FORMAT,
- res, GST_TIME_ARGS (timestamp));
-
- ret = gst_pad_push (ffmpegaudenc->srcpad, outbuf);
-
- return ret;
-}
-
-static GstFlowReturn
-gst_ffmpegaudenc_chain_audio (GstPad * pad, GstObject * parent,
- GstBuffer * inbuf)
-{
- GstFFMpegAudEnc *ffmpegaudenc;
- GstFFMpegAudEncClass *oclass;
- AVCodecContext *ctx;
- GstClockTime timestamp, duration;
- gsize size, frame_size;
- gint osize;
- GstFlowReturn ret;
- gint out_size;
- gboolean discont;
- guint8 *in_data;
-
- ffmpegaudenc = (GstFFMpegAudEnc *) parent;
- oclass = (GstFFMpegAudEncClass *) G_OBJECT_GET_CLASS (ffmpegaudenc);
-
- if (G_UNLIKELY (!ffmpegaudenc->opened))
- goto not_negotiated;
-
- ctx = ffmpegaudenc->context;
-
- size = gst_buffer_get_size (inbuf);
- timestamp = GST_BUFFER_TIMESTAMP (inbuf);
- duration = GST_BUFFER_DURATION (inbuf);
- discont = GST_BUFFER_IS_DISCONT (inbuf);
-
- GST_DEBUG_OBJECT (ffmpegaudenc,
- "Received time %" GST_TIME_FORMAT ", duration %" GST_TIME_FORMAT
- ", size %" G_GSIZE_FORMAT, GST_TIME_ARGS (timestamp),
- GST_TIME_ARGS (duration), size);
-
- frame_size = ctx->frame_size;
- osize = av_get_bits_per_sample_format (ctx->sample_fmt) / 8;
-
- if (frame_size > 1) {
- /* we have a frame_size, feed the encoder multiples of this frame size */
- guint avail, frame_bytes;
-
- if (discont) {
- GST_LOG_OBJECT (ffmpegaudenc, "DISCONT, clear adapter");
- gst_adapter_clear (ffmpegaudenc->adapter);
- ffmpegaudenc->discont = TRUE;
- }
-
- if (gst_adapter_available (ffmpegaudenc->adapter) == 0) {
- /* lock on to new timestamp */
- GST_LOG_OBJECT (ffmpegaudenc, "taking buffer timestamp %" GST_TIME_FORMAT,
- GST_TIME_ARGS (timestamp));
- ffmpegaudenc->adapter_ts = timestamp;
- ffmpegaudenc->adapter_consumed = 0;
- } else {
- GstClockTime upstream_time;
- GstClockTime consumed_time;
- guint64 bytes;
-
- /* use timestamp at head of the adapter */
- consumed_time =
- gst_util_uint64_scale (ffmpegaudenc->adapter_consumed, GST_SECOND,
- ctx->sample_rate);
- timestamp = ffmpegaudenc->adapter_ts + consumed_time;
- GST_LOG_OBJECT (ffmpegaudenc, "taking adapter timestamp %" GST_TIME_FORMAT
- " and adding consumed time %" GST_TIME_FORMAT,
- GST_TIME_ARGS (ffmpegaudenc->adapter_ts),
- GST_TIME_ARGS (consumed_time));
-
- /* check with upstream timestamps, if too much deviation,
- * forego some timestamp perfection in favour of upstream syncing
- * (particularly in case these do not happen to come in multiple
- * of frame size) */
- upstream_time =
- gst_adapter_prev_timestamp (ffmpegaudenc->adapter, &bytes);
- if (GST_CLOCK_TIME_IS_VALID (upstream_time)) {
- GstClockTimeDiff diff;
-
- upstream_time +=
- gst_util_uint64_scale (bytes, GST_SECOND,
- ctx->sample_rate * osize * ctx->channels);
- diff = upstream_time - timestamp;
- /* relaxed difference, rather than half a sample or so ... */
- if (diff > GST_SECOND / 10 || diff < -GST_SECOND / 10) {
- GST_DEBUG_OBJECT (ffmpegaudenc, "adapter timestamp drifting, "
- "taking upstream timestamp %" GST_TIME_FORMAT,
- GST_TIME_ARGS (upstream_time));
- timestamp = upstream_time;
- /* samples corresponding to bytes */
- ffmpegaudenc->adapter_consumed = bytes / (osize * ctx->channels);
- ffmpegaudenc->adapter_ts = upstream_time -
- gst_util_uint64_scale (ffmpegaudenc->adapter_consumed, GST_SECOND,
- ctx->sample_rate);
- ffmpegaudenc->discont = TRUE;
- }
- }
- }
-
- GST_LOG_OBJECT (ffmpegaudenc, "pushing buffer in adapter");
- gst_adapter_push (ffmpegaudenc->adapter, inbuf);
-
- /* first see how many bytes we need to feed to the decoder. */
- frame_bytes = frame_size * osize * ctx->channels;
- avail = gst_adapter_available (ffmpegaudenc->adapter);
-
- GST_LOG_OBJECT (ffmpegaudenc, "frame_bytes %u, avail %u", frame_bytes,
- avail);
-
- /* while there is more than a frame size in the adapter, consume it */
- while (avail >= frame_bytes) {
- GST_LOG_OBJECT (ffmpegaudenc, "taking %u bytes from the adapter",
- frame_bytes);
-
- /* Note that we take frame_bytes and add frame_size.
- * Makes sense when resyncing because you don't have to count channels
- * or samplesize to divide by the samplerate */
-
- /* take an audio buffer out of the adapter */
- in_data = (guint8 *) gst_adapter_map (ffmpegaudenc->adapter, frame_bytes);
- ffmpegaudenc->adapter_consumed += frame_size;
-
- /* calculate timestamp and duration relative to start of adapter and to
- * the amount of samples we consumed */
- duration =
- gst_util_uint64_scale (ffmpegaudenc->adapter_consumed, GST_SECOND,
- ctx->sample_rate);
- duration -= (timestamp - ffmpegaudenc->adapter_ts);
-
- /* 4 times the input size should be big enough... */
- out_size = frame_bytes * 4;
-
- ret =
- gst_ffmpegaudenc_encode_audio (ffmpegaudenc, in_data, frame_bytes,
- out_size, timestamp, duration, ffmpegaudenc->discont);
-
- gst_adapter_unmap (ffmpegaudenc->adapter);
- gst_adapter_flush (ffmpegaudenc->adapter, frame_bytes);
-
- if (ret != GST_FLOW_OK)
- goto push_failed;
-
- /* advance the adapter timestamp with the duration */
- timestamp += duration;
-
- ffmpegaudenc->discont = FALSE;
- avail = gst_adapter_available (ffmpegaudenc->adapter);
- }
- GST_LOG_OBJECT (ffmpegaudenc, "%u bytes left in the adapter", avail);
- } else {
- GstMapInfo map;
- /* we have no frame_size, feed the encoder all the data and expect a fixed
- * output size */
- int coded_bps = av_get_bits_per_sample (oclass->in_plugin->id);
-
- GST_LOG_OBJECT (ffmpegaudenc, "coded bps %d, osize %d", coded_bps, osize);
-
- out_size = size / osize;
- if (coded_bps)
- out_size = (out_size * coded_bps) / 8;
-
- gst_buffer_map (inbuf, &map, GST_MAP_READ);
- in_data = map.data;
- size = map.size;
- ret = gst_ffmpegaudenc_encode_audio (ffmpegaudenc, in_data, size, out_size,
- timestamp, duration, discont);
- gst_buffer_unmap (inbuf, &map);
- gst_buffer_unref (inbuf);
-
- if (ret != GST_FLOW_OK)
- goto push_failed;
- }
-
- return GST_FLOW_OK;
-
- /* ERRORS */
-not_negotiated:
- {
- GST_ELEMENT_ERROR (ffmpegaudenc, CORE, NEGOTIATION, (NULL),
- ("not configured to input format before data start"));
- gst_buffer_unref (inbuf);
- return GST_FLOW_NOT_NEGOTIATED;
- }
-push_failed:
- {
- GST_DEBUG_OBJECT (ffmpegaudenc, "Failed to push buffer %d (%s)", ret,
- gst_flow_get_name (ret));
- return ret;
- }
-}
-
-static gboolean
-gst_ffmpegaudenc_event_sink (GstPad * pad, GstObject * parent, GstEvent * event)
-{
- GstFFMpegAudEnc *ffmpegaudenc = (GstFFMpegAudEnc *) parent;
-
- switch (GST_EVENT_TYPE (event)) {
- case GST_EVENT_CAPS:
- {
- GstCaps *caps;
- gboolean ret;
-
- gst_event_parse_caps (event, &caps);
- ret = gst_ffmpegaudenc_setcaps (ffmpegaudenc, caps);
- gst_event_unref (event);
- return ret;
- }
- default:
- break;
- }
-
- return gst_pad_event_default (pad, parent, event);
-}
-
-static gboolean
-gst_ffmpegaudenc_query_sink (GstPad * pad, GstObject * parent, GstQuery * query)
-{
- GstFFMpegAudEnc *ffmpegaudenc = (GstFFMpegAudEnc *) parent;
- gboolean res = FALSE;
-
- switch (GST_QUERY_TYPE (query)) {
- case GST_QUERY_CAPS:
- {
- GstCaps *filter, *caps;
-
- gst_query_parse_caps (query, &filter);
- caps = gst_ffmpegaudenc_getcaps (ffmpegaudenc, filter);
- gst_query_set_caps_result (query, caps);
- gst_caps_unref (caps);
- res = TRUE;
- break;
- }
- default:
- res = gst_pad_query_default (pad, parent, query);
- break;
- }
-
- return res;
-}
-
-static void
-gst_ffmpegaudenc_set_property (GObject * object,
- guint prop_id, const GValue * value, GParamSpec * pspec)
-{
- GstFFMpegAudEnc *ffmpegaudenc;
-
- /* Get a pointer of the right type. */
- ffmpegaudenc = (GstFFMpegAudEnc *) (object);
-
- if (ffmpegaudenc->opened) {
- GST_WARNING_OBJECT (ffmpegaudenc,
- "Can't change properties once decoder is setup !");
- return;
- }
-
- /* Check the argument id to see which argument we're setting. */
- switch (prop_id) {
- case ARG_BIT_RATE:
- ffmpegaudenc->bitrate = g_value_get_int (value);
- break;
- case ARG_BUFSIZE:
- break;
- case ARG_RTP_PAYLOAD_SIZE:
- ffmpegaudenc->rtp_payload_size = g_value_get_int (value);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-/* The set function is simply the inverse of the get fuction. */
-static void
-gst_ffmpegaudenc_get_property (GObject * object,
- guint prop_id, GValue * value, GParamSpec * pspec)
-{
- GstFFMpegAudEnc *ffmpegaudenc;
-
- /* It's not null if we got it, but it might not be ours */
- ffmpegaudenc = (GstFFMpegAudEnc *) (object);
-
- switch (prop_id) {
- case ARG_BIT_RATE:
- g_value_set_int (value, ffmpegaudenc->bitrate);
- break;
- break;
- case ARG_BUFSIZE:
- g_value_set_int (value, ffmpegaudenc->buffer_size);
- break;
- case ARG_RTP_PAYLOAD_SIZE:
- g_value_set_int (value, ffmpegaudenc->rtp_payload_size);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static GstStateChangeReturn
-gst_ffmpegaudenc_change_state (GstElement * element, GstStateChange transition)
-{
- GstFFMpegAudEnc *ffmpegaudenc = (GstFFMpegAudEnc *) element;
- GstStateChangeReturn result;
-
- switch (transition) {
- default:
- break;
- }
-
- result = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
-
- switch (transition) {
- case GST_STATE_CHANGE_PAUSED_TO_READY:
- if (ffmpegaudenc->opened) {
- gst_ffmpeg_avcodec_close (ffmpegaudenc->context);
- ffmpegaudenc->opened = FALSE;
- }
- gst_adapter_clear (ffmpegaudenc->adapter);
- break;
- default:
- break;
- }
- return result;
-}
-
-gboolean
-gst_ffmpegaudenc_register (GstPlugin * plugin)
-{
- GTypeInfo typeinfo = {
- sizeof (GstFFMpegAudEncClass),
- (GBaseInitFunc) gst_ffmpegaudenc_base_init,
- NULL,
- (GClassInitFunc) gst_ffmpegaudenc_class_init,
- NULL,
- NULL,
- sizeof (GstFFMpegAudEnc),
- 0,
- (GInstanceInitFunc) gst_ffmpegaudenc_init,
- };
- GType type;
- AVCodec *in_plugin;
-
-
- GST_LOG ("Registering encoders");
-
- in_plugin = av_codec_next (NULL);
- while (in_plugin) {
- gchar *type_name;
-
- /* Skip non-AV codecs */
- if (in_plugin->type != AVMEDIA_TYPE_AUDIO)
- goto next;
-
- /* no quasi codecs, please */
- if ((in_plugin->id >= CODEC_ID_PCM_S16LE &&
- in_plugin->id <= CODEC_ID_PCM_BLURAY)) {
- goto next;
- }
-
- /* No encoders depending on external libraries (we don't build them, but
- * people who build against an external ffmpeg might have them.
- * We have native gstreamer plugins for all of those libraries anyway. */
- if (!strncmp (in_plugin->name, "lib", 3)) {
- GST_DEBUG
- ("Not using external library encoder %s. Use the gstreamer-native ones instead.",
- in_plugin->name);
- goto next;
- }
-
- /* only encoders */
- if (!in_plugin->encode) {
- goto next;
- }
-
- /* FIXME : We should have a method to know cheaply whether we have a mapping
- * for the given plugin or not */
-
- GST_DEBUG ("Trying plugin %s [%s]", in_plugin->name, in_plugin->long_name);
-
- /* no codecs for which we're GUARANTEED to have better alternatives */
- if (!strcmp (in_plugin->name, "vorbis")
- || !strcmp (in_plugin->name, "flac")) {
- GST_LOG ("Ignoring encoder %s", in_plugin->name);
- goto next;
- }
-
- /* construct the type */
- type_name = g_strdup_printf ("avenc_%s", in_plugin->name);
-
- type = g_type_from_name (type_name);
-
- if (!type) {
-
- /* create the glib type now */
- type = g_type_register_static (GST_TYPE_ELEMENT, type_name, &typeinfo, 0);
- g_type_set_qdata (type, GST_FFENC_PARAMS_QDATA, (gpointer) in_plugin);
-
- {
- static const GInterfaceInfo preset_info = {
- NULL,
- NULL,
- NULL
- };
- g_type_add_interface_static (type, GST_TYPE_PRESET, &preset_info);
- }
- }
-
- if (!gst_element_register (plugin, type_name, GST_RANK_SECONDARY, type)) {
- g_free (type_name);
- return FALSE;
- }
-
- g_free (type_name);
-
- next:
- in_plugin = av_codec_next (in_plugin);
- }
-
- GST_LOG ("Finished registering encoders");
-
- return TRUE;
-}
diff --git a/ext/libav/gstavenc.h b/ext/libav/gstavenc.h
deleted file mode 100644
index 019b168..0000000
--- a/ext/libav/gstavenc.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/* GStreamer
- * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/* First, include the header file for the plugin, to bring in the
- * object definition and other useful things.
- */
-
-#ifndef __GST_FFMPEGAUDENC_H__
-#define __GST_FFMPEGAUDENC_H__
-
-G_BEGIN_DECLS
-
-#include <gst/base/gstadapter.h>
-
-typedef struct _GstFFMpegAudEnc GstFFMpegAudEnc;
-
-struct _GstFFMpegAudEnc
-{
- GstElement element;
-
- /* We need to keep track of our pads, so we do so here. */
- GstPad *srcpad;
- GstPad *sinkpad;
-
- AVCodecContext *context;
- gboolean opened;
- GstClockTime adapter_ts;
- guint64 adapter_consumed;
- GstAdapter *adapter;
- gboolean discont;
-
- /* cache */
- gint bitrate;
- gint buffer_size;
- gint rtp_payload_size;
-
- /* other settings are copied over straight,
- * include a context here, rather than copy-and-past it from avcodec.h */
- AVCodecContext config;
-};
-
-typedef struct _GstFFMpegAudEncClass GstFFMpegAudEncClass;
-
-struct _GstFFMpegAudEncClass
-{
- GstElementClass parent_class;
-
- AVCodec *in_plugin;
- GstPadTemplate *srctempl, *sinktempl;
- GstCaps *sinkcaps;
-};
-
-#define GST_TYPE_FFMPEGAUDENC \
- (gst_ffmpegaudenc_get_type())
-#define GST_FFMPEGAUDENC(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_FFMPEGAUDENC,GstFFMpegAudEnc))
-#define GST_FFMPEGAUDENC_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_FFMPEGAUDENC,GstFFMpegAudEncClass))
-#define GST_IS_FFMPEGAUDENC(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_FFMPEGAUDENC))
-#define GST_IS_FFMPEGAUDENC_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_FFMPEGAUDENC))
-
-G_END_DECLS
-
-#endif /* __GST_FFMPEGAUDENC_H__ */
diff --git a/ext/libav/gstavmux.c b/ext/libav/gstavmux.c
index d9e8969..2ee95b9 100644
--- a/ext/libav/gstavmux.c
+++ b/ext/libav/gstavmux.c
@@ -13,8 +13,8 @@
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
*/
#ifdef HAVE_CONFIG_H
@@ -24,12 +24,14 @@
#include <string.h>
#include <libavformat/avformat.h>
+#include <libavutil/opt.h>
#include <gst/gst.h>
#include <gst/base/gstcollectpads.h>
#include "gstav.h"
#include "gstavcodecmap.h"
#include "gstavutils.h"
+#include "gstavprotocol.h"
typedef struct _GstFFMpegMux GstFFMpegMux;
typedef struct _GstFFMpegMuxPad GstFFMpegMuxPad;
@@ -57,8 +59,8 @@ struct _GstFFMpegMux
/*< private > */
/* event_function is the collectpads default eventfunction */
GstPadEventFunction event_function;
- int preload;
int max_delay;
+ int preload;
};
typedef struct _GstFFMpegMuxClass GstFFMpegMuxClass;
@@ -89,12 +91,6 @@ enum
enum
{
- ARG_0,
- /* FILL ME */
-};
-
-enum
-{
PROP_0,
PROP_PRELOAD,
PROP_MAXDELAY
@@ -301,8 +297,8 @@ gst_ffmpegmux_class_init (GstFFMpegMuxClass * klass)
g_object_class_install_property (gobject_class, PROP_PRELOAD,
g_param_spec_int ("preload", "preload",
- "Set the initial demux-decode delay (in microseconds)", 0, G_MAXINT,
- 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+ "Set the initial demux-decode delay (in microseconds)",
+ 0, G_MAXINT, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_MAXDELAY,
g_param_spec_int ("maxdelay", "maxdelay",
@@ -329,17 +325,13 @@ gst_ffmpegmux_init (GstFFMpegMux * ffmpegmux, GstFFMpegMuxClass * g_class)
gst_collect_pads_set_function (ffmpegmux->collect,
(GstCollectPadsFunction) gst_ffmpegmux_collected, ffmpegmux);
- ffmpegmux->context = g_new0 (AVFormatContext, 1);
+ ffmpegmux->context = avformat_alloc_context ();
ffmpegmux->context->oformat = oclass->in_plugin;
ffmpegmux->context->nb_streams = 0;
- g_snprintf (ffmpegmux->context->filename,
- sizeof (ffmpegmux->context->filename),
- "gstreamer://%p", ffmpegmux->srcpad);
ffmpegmux->opened = FALSE;
ffmpegmux->videopads = 0;
ffmpegmux->audiopads = 0;
- ffmpegmux->preload = 0;
ffmpegmux->max_delay = 0;
}
@@ -391,7 +383,9 @@ gst_ffmpegmux_finalize (GObject * object)
{
GstFFMpegMux *ffmpegmux = (GstFFMpegMux *) object;
- g_free (ffmpegmux->context);
+ avformat_free_context (ffmpegmux->context);
+ ffmpegmux->context = NULL;
+
gst_object_unref (ffmpegmux->collect);
if (G_OBJECT_CLASS (parent_class)->finalize)
@@ -445,10 +439,10 @@ gst_ffmpegmux_request_new_pad (GstElement * element,
gst_element_add_pad (element, pad);
/* AVStream needs to be created */
- st = av_new_stream (ffmpegmux->context, collect_pad->padnum);
+ st = avformat_new_stream (ffmpegmux->context, NULL);
+ st->id = collect_pad->padnum;
st->codec->codec_type = type;
- st->codec->codec_id = CODEC_ID_NONE; /* this is a check afterwards */
- st->stream_copy = 1; /* we're not the actual encoder */
+ st->codec->codec_id = AV_CODEC_ID_NONE; /* this is a check afterwards */
st->codec->bit_rate = bitrate;
st->codec->frame_size = framesize;
/* we fill in codec during capsnego */
@@ -480,12 +474,12 @@ gst_ffmpegmux_setcaps (GstPad * pad, GstCaps * caps)
collect_pad = (GstFFMpegMuxPad *) gst_pad_get_element_private (pad);
st = ffmpegmux->context->streams[collect_pad->padnum];
- ffmpegmux->context->preload = ffmpegmux->preload;
+ av_opt_set_int (&ffmpegmux->context, "preload", ffmpegmux->preload, 0);
ffmpegmux->context->max_delay = ffmpegmux->max_delay;
/* for the format-specific guesses, we'll go to
* our famous codec mapper */
- if (gst_ffmpeg_caps_to_codecid (caps, st->codec) == CODEC_ID_NONE)
+ if (gst_ffmpeg_caps_to_codecid (caps, st->codec) == AV_CODEC_ID_NONE)
goto not_accepted;
/* copy over the aspect ratios, ffmpeg expects the stream aspect to match the
@@ -554,7 +548,7 @@ gst_ffmpegmux_collected (GstCollectPads * pads, gpointer user_data)
/* open "file" (gstreamer protocol to next element) */
if (!ffmpegmux->opened) {
- int open_flags = URL_WRONLY;
+ int open_flags = AVIO_FLAG_WRITE;
/* we do need all streams to have started capsnego,
* or things will go horribly wrong */
@@ -564,7 +558,7 @@ gst_ffmpegmux_collected (GstCollectPads * pads, gpointer user_data)
AVStream *st = ffmpegmux->context->streams[collect_pad->padnum];
/* check whether the pad has successfully completed capsnego */
- if (st->codec->codec_id == CODEC_ID_NONE) {
+ if (st->codec->codec_id == AV_CODEC_ID_NONE) {
GST_ELEMENT_ERROR (ffmpegmux, CORE, NEGOTIATION, (NULL),
("no caps set on stream %d (%s)", collect_pad->padnum,
(st->codec->codec_type == AVMEDIA_TYPE_VIDEO) ?
@@ -574,12 +568,12 @@ gst_ffmpegmux_collected (GstCollectPads * pads, gpointer user_data)
/* set framerate for audio */
if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO) {
switch (st->codec->codec_id) {
- case CODEC_ID_PCM_S16LE:
- case CODEC_ID_PCM_S16BE:
- case CODEC_ID_PCM_U16LE:
- case CODEC_ID_PCM_U16BE:
- case CODEC_ID_PCM_S8:
- case CODEC_ID_PCM_U8:
+ case AV_CODEC_ID_PCM_S16LE:
+ case AV_CODEC_ID_PCM_S16BE:
+ case AV_CODEC_ID_PCM_U16LE:
+ case AV_CODEC_ID_PCM_U16BE:
+ case AV_CODEC_ID_PCM_S8:
+ case AV_CODEC_ID_PCM_U8:
st->codec->frame_size = 1;
break;
default:
@@ -648,21 +642,15 @@ gst_ffmpegmux_collected (GstCollectPads * pads, gpointer user_data)
open_flags |= GST_FFMPEG_URL_STREAMHEADER;
}
- if (url_fopen (&ffmpegmux->context->pb,
- ffmpegmux->context->filename, open_flags) < 0) {
+ if (gst_ffmpegdata_open (ffmpegmux->srcpad, open_flags,
+ &ffmpegmux->context->pb) < 0) {
GST_ELEMENT_ERROR (ffmpegmux, LIBRARY, TOO_LAZY, (NULL),
("Failed to open stream context in avmux"));
return GST_FLOW_ERROR;
}
- if (av_set_parameters (ffmpegmux->context, NULL) < 0) {
- GST_ELEMENT_ERROR (ffmpegmux, LIBRARY, INIT, (NULL),
- ("Failed to initialize muxer"));
- return GST_FLOW_ERROR;
- }
-
/* now open the mux format */
- if (av_write_header (ffmpegmux->context) < 0) {
+ if (avformat_write_header (ffmpegmux->context, NULL) < 0) {
GST_ELEMENT_ERROR (ffmpegmux, LIBRARY, SETTINGS, (NULL),
("Failed to write file header - check codec settings"));
return GST_FLOW_ERROR;
@@ -672,7 +660,7 @@ gst_ffmpegmux_collected (GstCollectPads * pads, gpointer user_data)
ffmpegmux->opened = TRUE;
/* flush the header so it will be used as streamheader */
- put_flush_packet (ffmpegmux->context->pb);
+ avio_flush (ffmpegmux->context->pb);
}
/* take the one with earliest timestamp,
@@ -779,8 +767,8 @@ gst_ffmpegmux_collected (GstCollectPads * pads, gpointer user_data)
/* close down */
av_write_trailer (ffmpegmux->context);
ffmpegmux->opened = FALSE;
- put_flush_packet (ffmpegmux->context->pb);
- url_fclose (ffmpegmux->context->pb);
+ avio_flush (ffmpegmux->context->pb);
+ gst_ffmpegdata_close (ffmpegmux->context->pb);
gst_pad_push_event (ffmpegmux->srcpad, gst_event_new_eos ());
return GST_FLOW_EOS;
}
@@ -818,7 +806,7 @@ gst_ffmpegmux_change_state (GstElement * element, GstStateChange transition)
gst_tag_setter_reset_tags (GST_TAG_SETTER (ffmpegmux));
if (ffmpegmux->opened) {
ffmpegmux->opened = FALSE;
- url_fclose (ffmpegmux->context->pb);
+ gst_ffmpegdata_close (ffmpegmux->context->pb);
}
break;
case GST_STATE_CHANGE_READY_TO_NULL:
@@ -837,7 +825,7 @@ gst_ffmpegmux_get_id_caps (enum CodecID *id_list)
gint i;
caps = gst_caps_new_empty ();
- for (i = 0; id_list[i] != CODEC_ID_NONE; i++) {
+ for (i = 0; id_list[i] != AV_CODEC_ID_NONE; i++) {
if ((t = gst_ffmpeg_codecid_to_caps (id_list[i], NULL, TRUE)))
gst_caps_append (caps, t);
}
diff --git a/ext/libav/gstavpipe.h b/ext/libav/gstavpipe.h
deleted file mode 100644
index 5ded77f..0000000
--- a/ext/libav/gstavpipe.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/* GStreamer
- * Copyright (C) <2006> Mark Nauwelaerts <manauw@skynet.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-
-#ifndef __GST_FFMPEGPIPE_H__
-#define __GST_FFMPEGPIPE_H__
-
-#include <gst/base/gstadapter.h>
-#include "gstav.h"
-
-G_BEGIN_DECLS
-
-/* pipe protocol helpers */
-#define GST_FFMPEG_PIPE_MUTEX_LOCK(m) G_STMT_START { \
- GST_LOG_OBJECT (m, "locking tlock from thread %p", g_thread_self ()); \
- g_mutex_lock (&m->tlock); \
- GST_LOG_OBJECT (m, "locked tlock from thread %p", g_thread_self ()); \
-} G_STMT_END
-
-#define GST_FFMPEG_PIPE_MUTEX_UNLOCK(m) G_STMT_START { \
- GST_LOG_OBJECT (m, "unlocking tlock from thread %p", g_thread_self ()); \
- g_mutex_unlock (&m->tlock); \
-} G_STMT_END
-
-#define GST_FFMPEG_PIPE_WAIT(m) G_STMT_START { \
- GST_LOG_OBJECT (m, "thread %p waiting", g_thread_self ()); \
- g_cond_wait (&m->cond, &m->tlock); \
-} G_STMT_END
-
-#define GST_FFMPEG_PIPE_SIGNAL(m) G_STMT_START { \
- GST_LOG_OBJECT (m, "signalling from thread %p", g_thread_self ()); \
- g_cond_signal (&m->cond); \
-} G_STMT_END
-
-typedef struct _GstFFMpegPipe GstFFMpegPipe;
-
-struct _GstFFMpegPipe
-{
- /* lock for syncing */
- GMutex tlock;
- /* with TLOCK */
- /* signals counterpart thread to have a look */
- GCond cond;
- /* seen eos */
- gboolean eos;
- /* flowreturn obtained by src task */
- GstFlowReturn srcresult;
- /* adpater collecting data */
- GstAdapter *adapter;
- /* amount needed in adapter by src task */
- guint needed;
-};
-
-G_END_DECLS
-
-#endif /* __GST_FFMPEGPIPE_H__ */
diff --git a/ext/libav/gstavprotocol.c b/ext/libav/gstavprotocol.c
index 9c4b052..5d01eaa 100644
--- a/ext/libav/gstavprotocol.c
+++ b/ext/libav/gstavprotocol.c
@@ -14,8 +14,8 @@
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
*/
#ifdef HAVE_CONFIG_H
@@ -29,7 +29,7 @@
#include <gst/gst.h>
#include "gstav.h"
-#include "gstavpipe.h"
+#include "gstavprotocol.h"
typedef struct _GstProtocolInfo GstProtocolInfo;
@@ -43,63 +43,14 @@ struct _GstProtocolInfo
};
static int
-gst_ffmpegdata_open (URLContext * h, const char *filename, int flags)
-{
- GstProtocolInfo *info;
- GstPad *pad;
-
- GST_LOG ("Opening %s", filename);
-
- info = g_new0 (GstProtocolInfo, 1);
-
- info->set_streamheader = flags & GST_FFMPEG_URL_STREAMHEADER;
- flags &= ~GST_FFMPEG_URL_STREAMHEADER;
- h->flags &= ~GST_FFMPEG_URL_STREAMHEADER;
-
- /* we don't support R/W together */
- if (flags != URL_RDONLY && flags != URL_WRONLY) {
- GST_WARNING ("Only read-only or write-only are supported");
- return -EINVAL;
- }
-
- if (sscanf (&filename[12], "%p", &pad) != 1) {
- GST_WARNING ("could not decode pad from %s", filename);
- return -EIO;
- }
-
- /* make sure we're a pad and that we're of the right type */
- g_return_val_if_fail (GST_IS_PAD (pad), -EINVAL);
-
- switch (flags) {
- case URL_RDONLY:
- g_return_val_if_fail (GST_PAD_IS_SINK (pad), -EINVAL);
- break;
- case URL_WRONLY:
- g_return_val_if_fail (GST_PAD_IS_SRC (pad), -EINVAL);
- break;
- }
-
- info->eos = FALSE;
- info->pad = pad;
- info->offset = 0;
-
- h->priv_data = (void *) info;
- h->is_streamed = FALSE;
- h->max_packet_size = 0;
-
- return 0;
-}
-
-static int
-gst_ffmpegdata_peek (URLContext * h, unsigned char *buf, int size)
+gst_ffmpegdata_peek (void *priv_data, unsigned char *buf, int size)
{
GstProtocolInfo *info;
GstBuffer *inbuf = NULL;
GstFlowReturn ret;
int total = 0;
- g_return_val_if_fail (h->flags == URL_RDONLY, AVERROR (EIO));
- info = (GstProtocolInfo *) h->priv_data;
+ info = (GstProtocolInfo *) priv_data;
GST_DEBUG ("Pulling %d bytes at position %" G_GUINT64_FORMAT, size,
info->offset);
@@ -131,17 +82,17 @@ gst_ffmpegdata_peek (URLContext * h, unsigned char *buf, int size)
}
static int
-gst_ffmpegdata_read (URLContext * h, unsigned char *buf, int size)
+gst_ffmpegdata_read (void *priv_data, unsigned char *buf, int size)
{
gint res;
GstProtocolInfo *info;
- info = (GstProtocolInfo *) h->priv_data;
+ info = (GstProtocolInfo *) priv_data;
GST_DEBUG ("Reading %d bytes of data at position %" G_GUINT64_FORMAT, size,
info->offset);
- res = gst_ffmpegdata_peek (h, buf, size);
+ res = gst_ffmpegdata_peek (priv_data, buf, size);
if (res >= 0)
info->offset += res;
@@ -151,15 +102,13 @@ gst_ffmpegdata_read (URLContext * h, unsigned char *buf, int size)
}
static int
-gst_ffmpegdata_write (URLContext * h, const unsigned char *buf, int size)
+gst_ffmpegdata_write (void *priv_data, uint8_t * buf, int size)
{
GstProtocolInfo *info;
GstBuffer *outbuf;
GST_DEBUG ("Writing %d bytes", size);
- info = (GstProtocolInfo *) h->priv_data;
-
- g_return_val_if_fail (h->flags != URL_RDONLY, -EIO);
+ info = (GstProtocolInfo *) priv_data;
/* create buffer and push data further */
outbuf = gst_buffer_new_and_alloc (size);
@@ -174,7 +123,7 @@ gst_ffmpegdata_write (URLContext * h, const unsigned char *buf, int size)
}
static int64_t
-gst_ffmpegdata_seek (URLContext * h, int64_t pos, int whence)
+gst_ffmpegdata_seek (void *priv_data, int64_t pos, int whence)
{
GstProtocolInfo *info;
guint64 newpos = 0, oldpos;
@@ -182,76 +131,68 @@ gst_ffmpegdata_seek (URLContext * h, int64_t pos, int whence)
GST_DEBUG ("Seeking to %" G_GINT64_FORMAT ", whence=%d",
(gint64) pos, whence);
- info = (GstProtocolInfo *) h->priv_data;
+ info = (GstProtocolInfo *) priv_data;
/* TODO : if we are push-based, we need to return sensible info */
- switch (h->flags) {
- case URL_RDONLY:
- {
- /* sinkpad */
- switch (whence) {
- case SEEK_SET:
- newpos = (guint64) pos;
- break;
- case SEEK_CUR:
- newpos = info->offset + pos;
- break;
- case SEEK_END:
- case AVSEEK_SIZE:
- /* ffmpeg wants to know the current end position in bytes ! */
- {
- gint64 duration;
-
- GST_DEBUG ("Seek end");
-
- if (gst_pad_is_linked (info->pad))
- if (gst_pad_query_duration (GST_PAD_PEER (info->pad),
- GST_FORMAT_BYTES, &duration))
- newpos = ((guint64) duration) + pos;
- }
- break;
- default:
- g_assert (0);
- break;
+ if (GST_PAD_IS_SINK (info->pad)) {
+ /* sinkpad */
+ switch (whence) {
+ case SEEK_SET:
+ newpos = (guint64) pos;
+ break;
+ case SEEK_CUR:
+ newpos = info->offset + pos;
+ break;
+ case SEEK_END:
+ case AVSEEK_SIZE:
+ /* ffmpeg wants to know the current end position in bytes ! */
+ {
+ gint64 duration;
+
+ GST_DEBUG ("Seek end");
+
+ if (gst_pad_is_linked (info->pad))
+ if (gst_pad_query_duration (GST_PAD_PEER (info->pad),
+ GST_FORMAT_BYTES, &duration))
+ newpos = ((guint64) duration) + pos;
}
- /* FIXME : implement case for push-based behaviour */
- if (whence != AVSEEK_SIZE)
- info->offset = newpos;
+ break;
+ default:
+ g_assert (0);
+ break;
}
- break;
- case URL_WRONLY:
- {
- GstSegment segment;
-
- oldpos = info->offset;
-
- /* srcpad */
- switch (whence) {
- case SEEK_SET:
- {
- info->offset = (guint64) pos;
- break;
- }
- case SEEK_CUR:
- info->offset += pos;
- break;
- default:
- break;
+ /* FIXME : implement case for push-based behaviour */
+ if (whence != AVSEEK_SIZE)
+ info->offset = newpos;
+ } else if (GST_PAD_IS_SRC (info->pad)) {
+ GstSegment segment;
+
+ oldpos = info->offset;
+
+ /* srcpad */
+ switch (whence) {
+ case SEEK_SET:
+ {
+ info->offset = (guint64) pos;
+ break;
}
- newpos = info->offset;
+ case SEEK_CUR:
+ info->offset += pos;
+ break;
+ default:
+ break;
+ }
+ newpos = info->offset;
- if (newpos != oldpos) {
- gst_segment_init (&segment, GST_FORMAT_BYTES);
- segment.start = newpos;
- segment.time = newpos;
- gst_pad_push_event (info->pad, gst_event_new_segment (&segment));
- }
- break;
+ if (newpos != oldpos) {
+ gst_segment_init (&segment, GST_FORMAT_BYTES);
+ segment.start = newpos;
+ segment.time = newpos;
+ gst_pad_push_event (info->pad, gst_event_new_segment (&segment));
}
- default:
- g_assert (0);
- break;
+ } else {
+ g_assert_not_reached ();
}
GST_DEBUG ("Now at offset %" G_GUINT64_FORMAT " (returning %" G_GUINT64_FORMAT
@@ -259,84 +200,90 @@ gst_ffmpegdata_seek (URLContext * h, int64_t pos, int whence)
return newpos;
}
-static int
-gst_ffmpegdata_close (URLContext * h)
+int
+gst_ffmpegdata_close (AVIOContext * h)
{
GstProtocolInfo *info;
- info = (GstProtocolInfo *) h->priv_data;
+ info = (GstProtocolInfo *) h->opaque;
if (info == NULL)
return 0;
GST_LOG ("Closing file");
- switch (h->flags) {
- case URL_WRONLY:
- {
- /* send EOS - that closes down the stream */
- gst_pad_push_event (info->pad, gst_event_new_eos ());
- break;
- }
- default:
- break;
+ if (GST_PAD_IS_SRC (info->pad)) {
+ /* send EOS - that closes down the stream */
+ gst_pad_push_event (info->pad, gst_event_new_eos ());
}
/* clean up data */
g_free (info);
- h->priv_data = NULL;
+ h->opaque = NULL;
+
+ av_freep (&h->buffer);
+ av_free (h);
return 0;
}
+int
+gst_ffmpegdata_open (GstPad * pad, int flags, AVIOContext ** context)
+{
+ GstProtocolInfo *info;
+ static const int buffer_size = 4096;
+ unsigned char *buffer = NULL;
-URLProtocol gstreamer_protocol = {
- /*.name = */ "gstreamer",
- /*.url_open = */ gst_ffmpegdata_open,
- /*.url_read = */ gst_ffmpegdata_read,
- /*.url_write = */ gst_ffmpegdata_write,
- /*.url_seek = */ gst_ffmpegdata_seek,
- /*.url_close = */ gst_ffmpegdata_close,
-};
+ info = g_new0 (GstProtocolInfo, 1);
+ info->set_streamheader = flags & GST_FFMPEG_URL_STREAMHEADER;
+ flags &= ~GST_FFMPEG_URL_STREAMHEADER;
-/* specialized protocol for cross-thread pushing,
- * based on ffmpeg's pipe protocol */
+ /* we don't support R/W together */
+ if ((flags & AVIO_FLAG_WRITE) && (flags & AVIO_FLAG_READ)) {
+ GST_WARNING ("Only read-only or write-only are supported");
+ return -EINVAL;
+ }
-static int
-gst_ffmpeg_pipe_open (URLContext * h, const char *filename, int flags)
-{
- GstFFMpegPipe *ffpipe;
+ /* make sure we're a pad and that we're of the right type */
+ g_return_val_if_fail (GST_IS_PAD (pad), -EINVAL);
- GST_LOG ("Opening %s", filename);
+ if ((flags & AVIO_FLAG_READ))
+ g_return_val_if_fail (GST_PAD_IS_SINK (pad), -EINVAL);
+ if ((flags & AVIO_FLAG_WRITE))
+ g_return_val_if_fail (GST_PAD_IS_SRC (pad), -EINVAL);
- /* we don't support W together */
- if (flags != URL_RDONLY) {
- GST_WARNING ("Only read-only is supported");
- return -EINVAL;
- }
+ info->eos = FALSE;
+ info->pad = pad;
+ info->offset = 0;
- if (sscanf (&filename[10], "%p", &ffpipe) != 1) {
- GST_WARNING ("could not decode pipe info from %s", filename);
- return -EIO;
+ buffer = av_malloc (buffer_size);
+ if (buffer == NULL) {
+ GST_WARNING ("Failed to allocate buffer");
+ return -ENOMEM;
}
- /* sanity check */
- g_return_val_if_fail (GST_IS_ADAPTER (ffpipe->adapter), -EINVAL);
-
- h->priv_data = (void *) ffpipe;
- h->is_streamed = TRUE;
- h->max_packet_size = 0;
+ *context =
+ avio_alloc_context (buffer, buffer_size, flags, (void *) info,
+ gst_ffmpegdata_read, gst_ffmpegdata_write, gst_ffmpegdata_seek);
+ (*context)->seekable = AVIO_SEEKABLE_NORMAL;
+ if (!(flags & AVIO_FLAG_WRITE)) {
+ (*context)->buf_ptr = (*context)->buf_end;
+ (*context)->write_flag = 0;
+ }
return 0;
}
+/* specialized protocol for cross-thread pushing,
+ * based on ffmpeg's pipe protocol */
+
static int
-gst_ffmpeg_pipe_read (URLContext * h, unsigned char *buf, int size)
+gst_ffmpeg_pipe_read (void *priv_data, uint8_t * buf, int size)
{
GstFFMpegPipe *ffpipe;
guint available;
- ffpipe = (GstFFMpegPipe *) h->priv_data;
+ ffpipe = (GstFFMpegPipe *) priv_data;
GST_LOG ("requested size %d", size);
@@ -366,21 +313,38 @@ gst_ffmpeg_pipe_read (URLContext * h, unsigned char *buf, int size)
return size;
}
-static int
-gst_ffmpeg_pipe_close (URLContext * h)
+int
+gst_ffmpeg_pipe_close (AVIOContext * h)
{
GST_LOG ("Closing pipe");
- h->priv_data = NULL;
+ h->opaque = NULL;
+ av_freep (&h->buffer);
+ av_free (h);
return 0;
}
-URLProtocol gstpipe_protocol = {
- "gstpipe",
- gst_ffmpeg_pipe_open,
- gst_ffmpeg_pipe_read,
- NULL,
- NULL,
- gst_ffmpeg_pipe_close,
-};
+int
+gst_ffmpeg_pipe_open (GstFFMpegPipe * ffpipe, int flags, AVIOContext ** context)
+{
+ static const int buffer_size = 4096;
+ unsigned char *buffer = NULL;
+
+ /* sanity check */
+ g_return_val_if_fail (GST_IS_ADAPTER (ffpipe->adapter), -EINVAL);
+
+ buffer = av_malloc (buffer_size);
+ if (buffer == NULL) {
+ GST_WARNING ("Failed to allocate buffer");
+ return -ENOMEM;
+ }
+
+ *context =
+ avio_alloc_context (buffer, buffer_size, 0, (void *) ffpipe,
+ gst_ffmpeg_pipe_read, NULL, NULL);
+ (*context)->seekable = 0;
+ (*context)->buf_ptr = (*context)->buf_end;
+
+ return 0;
+}
diff --git a/ext/libav/gstavprotocol.h b/ext/libav/gstavprotocol.h
new file mode 100644
index 0000000..f4b2ba8
--- /dev/null
+++ b/ext/libav/gstavprotocol.h
@@ -0,0 +1,78 @@
+/* GStreamer
+ * Copyright (C) <2006> Mark Nauwelaerts <manauw@skynet.be>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+
+#ifndef __GST_FFMPEGPROTOCOL_H__
+#define __GST_FFMPEGPROTOCOL_H__
+
+#include <gst/base/gstadapter.h>
+#include "gstav.h"
+
+G_BEGIN_DECLS
+
+/* pipe protocol helpers */
+#define GST_FFMPEG_PIPE_MUTEX_LOCK(m) G_STMT_START { \
+ GST_LOG_OBJECT (m, "locking tlock from thread %p", g_thread_self ()); \
+ g_mutex_lock (&m->tlock); \
+ GST_LOG_OBJECT (m, "locked tlock from thread %p", g_thread_self ()); \
+} G_STMT_END
+
+#define GST_FFMPEG_PIPE_MUTEX_UNLOCK(m) G_STMT_START { \
+ GST_LOG_OBJECT (m, "unlocking tlock from thread %p", g_thread_self ()); \
+ g_mutex_unlock (&m->tlock); \
+} G_STMT_END
+
+#define GST_FFMPEG_PIPE_WAIT(m) G_STMT_START { \
+ GST_LOG_OBJECT (m, "thread %p waiting", g_thread_self ()); \
+ g_cond_wait (&m->cond, &m->tlock); \
+} G_STMT_END
+
+#define GST_FFMPEG_PIPE_SIGNAL(m) G_STMT_START { \
+ GST_LOG_OBJECT (m, "signalling from thread %p", g_thread_self ()); \
+ g_cond_signal (&m->cond); \
+} G_STMT_END
+
+typedef struct _GstFFMpegPipe GstFFMpegPipe;
+
+struct _GstFFMpegPipe
+{
+ /* lock for syncing */
+ GMutex tlock;
+ /* with TLOCK */
+ /* signals counterpart thread to have a look */
+ GCond cond;
+ /* seen eos */
+ gboolean eos;
+ /* flowreturn obtained by src task */
+ GstFlowReturn srcresult;
+ /* adpater collecting data */
+ GstAdapter *adapter;
+ /* amount needed in adapter by src task */
+ guint needed;
+};
+
+int gst_ffmpeg_pipe_open (GstFFMpegPipe *ffpipe, int flags, AVIOContext ** context);
+int gst_ffmpeg_pipe_close (AVIOContext * h);
+
+int gst_ffmpegdata_open (GstPad * pad, int flags, AVIOContext ** context);
+int gst_ffmpegdata_close (AVIOContext * h);
+
+G_END_DECLS
+
+#endif /* __GST_FFMPEGPROTOCOL_H__ */
diff --git a/ext/libav/gstavutils.c b/ext/libav/gstavutils.c
index f7a80f6..403a6b6 100644
--- a/ext/libav/gstavutils.c
+++ b/ext/libav/gstavutils.c
@@ -13,8 +13,8 @@
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
*/
#ifdef HAVE_CONFIG_H
@@ -25,6 +25,11 @@
#ifdef __APPLE__
#include <sys/sysctl.h>
#endif
+#ifdef __MINGW32__
+#include <stdlib.h>
+#endif
+
+#include <libavutil/mem.h>
G_CONST_RETURN gchar *
gst_ffmpeg_get_codecid_longname (enum CodecID codec_id)
@@ -44,16 +49,21 @@ av_smp_format_depth (enum AVSampleFormat smp_fmt)
gint depth = -1;
switch (smp_fmt) {
case AV_SAMPLE_FMT_U8:
+ case AV_SAMPLE_FMT_U8P:
depth = 1;
break;
case AV_SAMPLE_FMT_S16:
+ case AV_SAMPLE_FMT_S16P:
depth = 2;
break;
case AV_SAMPLE_FMT_S32:
+ case AV_SAMPLE_FMT_S32P:
case AV_SAMPLE_FMT_FLT:
+ case AV_SAMPLE_FMT_FLTP:
depth = 4;
break;
case AV_SAMPLE_FMT_DBL:
+ case AV_SAMPLE_FMT_DBLP:
depth = 8;
break;
default:
@@ -476,7 +486,6 @@ gst_ffmpeg_auto_max_threads (void)
if (n < 1)
n = 1;
- GST_INFO ("threads: %d", n);
g_once_init_leave (&n_threads, n);
}
diff --git a/ext/libav/gstavutils.h b/ext/libav/gstavutils.h
index ebe49fb..97415eb 100644
--- a/ext/libav/gstavutils.h
+++ b/ext/libav/gstavutils.h
@@ -13,8 +13,8 @@
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
*/
#ifndef __GST_FFMPEG_UTILS_H__
diff --git a/ext/libav/gstavviddec.c b/ext/libav/gstavviddec.c
index 7675a71..dc472e4 100644
--- a/ext/libav/gstavviddec.c
+++ b/ext/libav/gstavviddec.c
@@ -13,8 +13,8 @@
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
*/
#ifdef HAVE_CONFIG_H
@@ -35,78 +35,17 @@
#include "gstav.h"
#include "gstavcodecmap.h"
#include "gstavutils.h"
+#include "gstavviddec.h"
GST_DEBUG_CATEGORY_EXTERN (GST_CAT_PERFORMANCE);
-typedef struct _GstFFMpegVidDec GstFFMpegVidDec;
-
#define MAX_TS_MASK 0xff
-struct _GstFFMpegVidDec
-{
- GstVideoDecoder parent;
-
- GstVideoCodecState *input_state;
- GstVideoCodecState *output_state;
-
- /* decoding */
- AVCodecContext *context;
- AVFrame *picture;
- gboolean opened;
-
- /* current context */
- enum PixelFormat ctx_pix_fmt;
- gint ctx_width;
- gint ctx_height;
- gint ctx_par_n;
- gint ctx_par_d;
- gint ctx_ticks;
- gint ctx_time_d;
- gint ctx_time_n;
- gint ctx_interlaced;
-
- guint8 *padded;
- guint padded_size;
-
- gboolean current_dr; /* if direct rendering is enabled */
-
- /* some properties */
- enum AVDiscard skip_frame;
- gint lowres;
- gboolean direct_rendering;
- gboolean debug_mv;
- int max_threads;
-
- gboolean is_realvideo;
-
- GstCaps *last_caps;
-};
-
-typedef struct _GstFFMpegVidDecClass GstFFMpegVidDecClass;
-
-struct _GstFFMpegVidDecClass
-{
- GstVideoDecoderClass parent_class;
-
- AVCodec *in_plugin;
-};
-
-#define GST_TYPE_FFMPEGDEC \
- (gst_ffmpegviddec_get_type())
-#define GST_FFMPEGDEC(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_FFMPEGDEC,GstFFMpegVidDec))
-#define GST_FFMPEGVIDDEC_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_FFMPEGDEC,GstFFMpegVidDecClass))
-#define GST_IS_FFMPEGDEC(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_FFMPEGDEC))
-#define GST_IS_FFMPEGVIDDEC_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_FFMPEGDEC))
-
#define DEFAULT_LOWRES 0
#define DEFAULT_SKIPFRAME 0
#define DEFAULT_DIRECT_RENDERING TRUE
#define DEFAULT_DEBUG_MV FALSE
-#define DEFAULT_MAX_THREADS 1
+#define DEFAULT_MAX_THREADS 0
enum
{
@@ -234,7 +173,12 @@ gst_ffmpegviddec_base_init (GstFFMpegVidDecClass * klass)
GST_DEBUG ("Couldn't get sink caps for decoder '%s'", in_plugin->name);
sinkcaps = gst_caps_new_empty_simple ("unknown/unknown");
}
- srccaps = gst_caps_new_empty_simple ("video/x-raw");
+ srccaps = gst_ffmpeg_codectype_to_video_caps (NULL,
+ in_plugin->id, FALSE, in_plugin);
+ if (!srccaps) {
+ GST_DEBUG ("Couldn't get source caps for decoder '%s'", in_plugin->name);
+ srccaps = gst_caps_from_string ("video/x-raw");
+ }
/* pad templates */
sinktempl = gst_pad_template_new ("sink", GST_PAD_SINK,
@@ -301,8 +245,11 @@ gst_ffmpegviddec_class_init (GstFFMpegVidDecClass * klass)
static void
gst_ffmpegviddec_init (GstFFMpegVidDec * ffmpegdec)
{
+ GstFFMpegVidDecClass *klass =
+ (GstFFMpegVidDecClass *) G_OBJECT_GET_CLASS (ffmpegdec);
+
/* some ffmpeg data */
- ffmpegdec->context = avcodec_alloc_context ();
+ ffmpegdec->context = avcodec_alloc_context3 (klass->in_plugin);
ffmpegdec->picture = avcodec_alloc_frame ();
ffmpegdec->opened = FALSE;
ffmpegdec->skip_frame = ffmpegdec->lowres = 0;
@@ -321,10 +268,7 @@ gst_ffmpegviddec_finalize (GObject * object)
ffmpegdec->context = NULL;
}
- if (ffmpegdec->picture != NULL) {
- av_free (ffmpegdec->picture);
- ffmpegdec->picture = NULL;
- }
+ avcodec_free_frame (&ffmpegdec->picture);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
@@ -334,9 +278,6 @@ gst_ffmpegviddec_finalize (GObject * object)
static void
gst_ffmpegviddec_close (GstFFMpegVidDec * ffmpegdec)
{
- if (!ffmpegdec->opened)
- return;
-
GST_LOG_OBJECT (ffmpegdec, "closing ffmpeg codec");
gst_caps_replace (&ffmpegdec->last_caps, NULL);
@@ -345,10 +286,7 @@ gst_ffmpegviddec_close (GstFFMpegVidDec * ffmpegdec)
gst_ffmpeg_avcodec_close (ffmpegdec->context);
ffmpegdec->opened = FALSE;
- if (ffmpegdec->context->palctrl) {
- av_free (ffmpegdec->context->palctrl);
- ffmpegdec->context->palctrl = NULL;
- }
+ gst_buffer_replace (&ffmpegdec->palette, NULL);
if (ffmpegdec->context->extradata) {
av_free (ffmpegdec->context->extradata);
@@ -374,10 +312,10 @@ gst_ffmpegviddec_open (GstFFMpegVidDec * ffmpegdec)
oclass->in_plugin->name, oclass->in_plugin->id);
switch (oclass->in_plugin->id) {
- case CODEC_ID_RV10:
- case CODEC_ID_RV30:
- case CODEC_ID_RV20:
- case CODEC_ID_RV40:
+ case AV_CODEC_ID_RV10:
+ case AV_CODEC_ID_RV30:
+ case AV_CODEC_ID_RV20:
+ case AV_CODEC_ID_RV40:
ffmpegdec->is_realvideo = TRUE;
break;
default:
@@ -397,6 +335,25 @@ could_not_open:
}
}
+static void
+gst_ffmpegviddec_get_palette (GstFFMpegVidDec * ffmpegdec,
+ GstVideoCodecState * state)
+{
+ GstStructure *str = gst_caps_get_structure (state->caps, 0);
+ const GValue *palette_v;
+ GstBuffer *palette;
+
+ /* do we have a palette? */
+ if ((palette_v = gst_structure_get_value (str, "palette_data"))) {
+ palette = gst_value_get_buffer (palette_v);
+ GST_DEBUG ("got palette data %p", palette);
+ if (gst_buffer_get_size (palette) >= AVPALETTE_SIZE) {
+ gst_buffer_replace (&ffmpegdec->palette, palette);
+ }
+ }
+}
+
+
static gboolean
gst_ffmpegviddec_set_format (GstVideoDecoder * decoder,
GstVideoCodecState * state)
@@ -418,8 +375,8 @@ gst_ffmpegviddec_set_format (GstVideoDecoder * decoder,
GST_OBJECT_LOCK (ffmpegdec);
/* stupid check for VC1 */
- if ((oclass->in_plugin->id == CODEC_ID_WMV3) ||
- (oclass->in_plugin->id == CODEC_ID_VC1))
+ if ((oclass->in_plugin->id == AV_CODEC_ID_WMV3) ||
+ (oclass->in_plugin->id == AV_CODEC_ID_VC1))
oclass->in_plugin->id = gst_ffmpeg_caps_to_codecid (state->caps, NULL);
/* close old session */
@@ -428,9 +385,6 @@ gst_ffmpegviddec_set_format (GstVideoDecoder * decoder,
gst_ffmpegviddec_drain (ffmpegdec);
GST_OBJECT_LOCK (ffmpegdec);
gst_ffmpegviddec_close (ffmpegdec);
-
- /* and reset the defaults that were set when a context is created */
- avcodec_get_context_defaults (ffmpegdec->context);
}
gst_caps_replace (&ffmpegdec->last_caps, state->caps);
@@ -441,6 +395,12 @@ gst_ffmpegviddec_set_format (GstVideoDecoder * decoder,
ffmpegdec->context->release_buffer = gst_ffmpegviddec_release_buffer;
ffmpegdec->context->draw_horiz_band = NULL;
+ /* reset coded_width/_height to prevent it being reused from last time when
+ * the codec is opened again, causing a mismatch and possible
+ * segfault/corruption. (Common scenario when renegotiating caps) */
+ ffmpegdec->context->coded_width = 0;
+ ffmpegdec->context->coded_height = 0;
+
GST_LOG_OBJECT (ffmpegdec, "size %dx%d", ffmpegdec->context->width,
ffmpegdec->context->height);
@@ -452,6 +412,8 @@ gst_ffmpegviddec_set_format (GstVideoDecoder * decoder,
GST_LOG_OBJECT (ffmpegdec, "size after %dx%d", ffmpegdec->context->width,
ffmpegdec->context->height);
+ gst_ffmpegviddec_get_palette (ffmpegdec, state);
+
if (!ffmpegdec->context->time_base.den || !ffmpegdec->context->time_base.num) {
GST_DEBUG_OBJECT (ffmpegdec, "forcing 25/1 framerate");
ffmpegdec->context->time_base.num = 1;
@@ -460,7 +422,7 @@ gst_ffmpegviddec_set_format (GstVideoDecoder * decoder,
/* workaround encoder bugs */
ffmpegdec->context->workaround_bugs |= FF_BUG_AUTODETECT;
- ffmpegdec->context->error_recognition = 1;
+ ffmpegdec->context->err_recognition = 1;
/* for slow cpus */
ffmpegdec->context->lowres = ffmpegdec->lowres;
@@ -471,30 +433,16 @@ gst_ffmpegviddec_set_format (GstVideoDecoder * decoder,
ffmpegdec->context->debug_mv = ffmpegdec->debug_mv;
{
- const gchar *env = g_getenv ("GST_AVVIDDEC_MAX_THREADS");
- int max_threads = ffmpegdec->max_threads;
GstQuery *query;
gboolean is_live;
- if (env != NULL) {
- if (g_str_equal (env, "auto"))
- max_threads = 0;
- else
- max_threads = MAX (atoi (env), 0);
-
- if (max_threads != 1) {
- GST_WARNING_OBJECT (ffmpegdec, "max threads forced to %d, this might "
- "lead to decoding errors or artefacts", max_threads);
- }
- }
-
- if (max_threads == 0) {
+ if (ffmpegdec->max_threads == 0) {
if (!(oclass->in_plugin->capabilities & CODEC_CAP_AUTO_THREADS))
ffmpegdec->context->thread_count = gst_ffmpeg_auto_max_threads ();
else
ffmpegdec->context->thread_count = 0;
} else
- ffmpegdec->context->thread_count = max_threads;
+ ffmpegdec->context->thread_count = ffmpegdec->max_threads;
query = gst_query_new_latency ();
is_live = FALSE;
@@ -505,11 +453,10 @@ gst_ffmpegviddec_set_format (GstVideoDecoder * decoder,
}
gst_query_unref (query);
- /* Slice based threading is broken in libav 0.8 */
if (is_live)
- ffmpegdec->context->thread_type = 0; /* FF_THREAD_SLICE */
+ ffmpegdec->context->thread_type = FF_THREAD_SLICE;
else
- ffmpegdec->context->thread_type = /* FF_THREAD_SLICE | */ FF_THREAD_FRAME;
+ ffmpegdec->context->thread_type = FF_THREAD_SLICE | FF_THREAD_FRAME;
}
/* open codec - we don't select an output pix_fmt yet,
@@ -683,6 +630,7 @@ fallback:
duplicate_frame:
{
GST_WARNING_OBJECT (ffmpegdec, "already alloc'ed output buffer for frame");
+ gst_video_codec_frame_unref (frame);
return -1;
}
no_frame:
@@ -1155,12 +1103,12 @@ gst_ffmpegviddec_video_frame (GstFFMpegVidDec * ffmpegdec,
/* now decode the frame */
gst_avpacket_init (&packet, data, size);
- if (ffmpegdec->context->palctrl) {
+ if (ffmpegdec->palette) {
guint8 *pal;
pal = av_packet_new_side_data (&packet, AV_PKT_DATA_PALETTE,
AVPALETTE_SIZE);
- memcpy (pal, ffmpegdec->context->palctrl->palette, AVPALETTE_SIZE);
+ gst_buffer_extract (ffmpegdec->palette, 0, pal, AVPALETTE_SIZE);
GST_DEBUG_OBJECT (ffmpegdec, "copy pal %p %p", &packet, pal);
}
@@ -1358,10 +1306,9 @@ gst_ffmpegviddec_handle_frame (GstVideoDecoder * decoder,
gboolean do_padding;
GST_LOG_OBJECT (ffmpegdec,
- "Received new data of size %u, dts %" GST_TIME_FORMAT ", pts:%"
- GST_TIME_FORMAT ", dur:%" GST_TIME_FORMAT,
- gst_buffer_get_size (frame->input_buffer),
- GST_TIME_ARGS (frame->dts),
+ "Received new data of size %" G_GSIZE_FORMAT ", dts %" GST_TIME_FORMAT
+ ", pts:%" GST_TIME_FORMAT ", dur:%" GST_TIME_FORMAT,
+ gst_buffer_get_size (frame->input_buffer), GST_TIME_ARGS (frame->dts),
GST_TIME_ARGS (frame->pts), GST_TIME_ARGS (frame->duration));
if (!gst_buffer_map (frame->input_buffer, &minfo, GST_MAP_READ)) {
@@ -1723,16 +1670,17 @@ gst_ffmpegviddec_register (GstPlugin * plugin)
gchar *plugin_name;
/* only video decoders */
- if (!in_plugin->decode || in_plugin->type != AVMEDIA_TYPE_VIDEO)
+ if (!av_codec_is_decoder (in_plugin)
+ || in_plugin->type != AVMEDIA_TYPE_VIDEO)
goto next;
/* no quasi-codecs, please */
- if (in_plugin->id == CODEC_ID_RAWVIDEO ||
- in_plugin->id == CODEC_ID_V210 ||
- in_plugin->id == CODEC_ID_V210X ||
- in_plugin->id == CODEC_ID_R210 ||
- (in_plugin->id >= CODEC_ID_PCM_S16LE &&
- in_plugin->id <= CODEC_ID_PCM_BLURAY)) {
+ if (in_plugin->id == AV_CODEC_ID_RAWVIDEO ||
+ in_plugin->id == AV_CODEC_ID_V210 ||
+ in_plugin->id == AV_CODEC_ID_V210X ||
+ in_plugin->id == AV_CODEC_ID_R210 ||
+ (in_plugin->id >= AV_CODEC_ID_PCM_S16LE &&
+ in_plugin->id <= AV_CODEC_ID_PCM_BLURAY)) {
goto next;
}
@@ -1803,20 +1751,20 @@ gst_ffmpegviddec_register (GstPlugin * plugin)
* msmpeg4v3 same, as it outperforms divxdec for divx3 playback.
* VC1/WMV3 are not working and thus unpreferred for now. */
switch (in_plugin->id) {
- case CODEC_ID_MPEG4:
- case CODEC_ID_MSMPEG4V3:
- case CODEC_ID_H264:
- case CODEC_ID_RV10:
- case CODEC_ID_RV20:
- case CODEC_ID_RV30:
- case CODEC_ID_RV40:
+ case AV_CODEC_ID_MPEG4:
+ case AV_CODEC_ID_MSMPEG4V3:
+ case AV_CODEC_ID_H264:
+ case AV_CODEC_ID_RV10:
+ case AV_CODEC_ID_RV20:
+ case AV_CODEC_ID_RV30:
+ case AV_CODEC_ID_RV40:
rank = GST_RANK_PRIMARY;
break;
/* DVVIDEO: we have a good dv decoder, fast on both ppc as well as x86.
* They say libdv's quality is better though. leave as secondary.
* note: if you change this, see the code in gstdv.c in good/ext/dv.
*/
- case CODEC_ID_DVVIDEO:
+ case AV_CODEC_ID_DVVIDEO:
rank = GST_RANK_SECONDARY;
break;
default:
diff --git a/ext/libav/gstavviddec.h b/ext/libav/gstavviddec.h
new file mode 100644
index 0000000..c8649c4
--- /dev/null
+++ b/ext/libav/gstavviddec.h
@@ -0,0 +1,93 @@
+/* GStreamer
+ * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+#ifndef __GST_FFMPEGVIDDEC_H__
+#define __GST_FFMPEGVIDDEC_H__
+
+G_BEGIN_DECLS
+
+#include <gst/gst.h>
+#include <gst/video/video.h>
+#include <gst/video/gstvideodecoder.h>
+#include <libavcodec/avcodec.h>
+
+typedef struct _GstFFMpegVidDec GstFFMpegVidDec;
+struct _GstFFMpegVidDec
+{
+ GstVideoDecoder parent;
+
+ GstVideoCodecState *input_state;
+ GstVideoCodecState *output_state;
+
+ /* decoding */
+ AVCodecContext *context;
+ AVFrame *picture;
+ gboolean opened;
+
+ /* current context */
+ enum PixelFormat ctx_pix_fmt;
+ gint ctx_width;
+ gint ctx_height;
+ gint ctx_par_n;
+ gint ctx_par_d;
+ gint ctx_ticks;
+ gint ctx_time_d;
+ gint ctx_time_n;
+ gint ctx_interlaced;
+ GstBuffer *palette;
+
+ guint8 *padded;
+ guint padded_size;
+
+ gboolean current_dr; /* if direct rendering is enabled */
+
+ /* some properties */
+ enum AVDiscard skip_frame;
+ gint lowres;
+ gboolean direct_rendering;
+ gboolean debug_mv;
+ int max_threads;
+
+ gboolean is_realvideo;
+
+ GstCaps *last_caps;
+};
+
+typedef struct _GstFFMpegVidDecClass GstFFMpegVidDecClass;
+
+struct _GstFFMpegVidDecClass
+{
+ GstVideoDecoderClass parent_class;
+
+ AVCodec *in_plugin;
+};
+
+#define GST_TYPE_FFMPEGDEC \
+ (gst_ffmpegviddec_get_type())
+#define GST_FFMPEGDEC(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_FFMPEGDEC,GstFFMpegVidDec))
+#define GST_FFMPEGVIDDEC_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_FFMPEGDEC,GstFFMpegVidDecClass))
+#define GST_IS_FFMPEGDEC(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_FFMPEGDEC))
+#define GST_IS_FFMPEGVIDDEC_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_FFMPEGDEC))
+
+G_END_DECLS
+
+#endif
diff --git a/ext/libav/gstavvidenc.c b/ext/libav/gstavvidenc.c
index b747613..00feafc 100644
--- a/ext/libav/gstavvidenc.c
+++ b/ext/libav/gstavvidenc.c
@@ -13,8 +13,8 @@
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
*/
#ifdef HAVE_CONFIG_H
@@ -56,13 +56,13 @@ enum
enum
{
- ARG_0,
- ARG_BIT_RATE,
- ARG_GOP_SIZE,
- ARG_ME_METHOD,
- ARG_BUFSIZE,
- ARG_RTP_PAYLOAD_SIZE,
- ARG_CFG_BASE
+ PROP_0,
+ PROP_BIT_RATE,
+ PROP_GOP_SIZE,
+ PROP_ME_METHOD,
+ PROP_BUFSIZE,
+ PROP_RTP_PAYLOAD_SIZE,
+ PROP_CFG_BASE
};
#define GST_TYPE_ME_METHOD (gst_ffmpegvidenc_me_method_get_type())
@@ -98,6 +98,8 @@ static gboolean gst_ffmpegvidenc_set_format (GstVideoEncoder * encoder,
GstVideoCodecState * state);
static gboolean gst_ffmpegvidenc_propose_allocation (GstVideoEncoder * encoder,
GstQuery * query);
+static gboolean gst_ffmpegvidenc_reset (GstVideoEncoder * encoder,
+ gboolean hard);
static GstCaps *gst_ffmpegvidenc_getcaps (GstVideoEncoder * encoder,
GstCaps * filter);
@@ -144,7 +146,12 @@ gst_ffmpegvidenc_base_init (GstFFMpegVidEncClass * klass)
srccaps = gst_caps_new_empty_simple ("unknown/unknown");
}
- sinkcaps = gst_caps_new_empty_simple ("video/x-raw");
+ sinkcaps = gst_ffmpeg_codectype_to_video_caps (NULL,
+ in_plugin->id, TRUE, in_plugin);
+ if (!sinkcaps) {
+ GST_DEBUG ("Couldn't get sink caps for encoder '%s'", in_plugin->name);
+ sinkcaps = gst_caps_new_empty_simple ("unknown/unknown");
+ }
/* pad templates */
sinktempl = gst_pad_template_new ("sink", GST_PAD_SINK,
@@ -157,7 +164,6 @@ gst_ffmpegvidenc_base_init (GstFFMpegVidEncClass * klass)
klass->in_plugin = in_plugin;
klass->srctempl = srctempl;
klass->sinktempl = sinktempl;
- klass->sinkcaps = NULL;
return;
}
@@ -178,30 +184,30 @@ gst_ffmpegvidenc_class_init (GstFFMpegVidEncClass * klass)
/* FIXME: could use -1 for a sensible per-codec default based on
* e.g. input resolution and framerate */
- g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BIT_RATE,
+ g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_BIT_RATE,
g_param_spec_int ("bitrate", "Bit Rate",
"Target Video Bitrate", 0, G_MAXINT, DEFAULT_VIDEO_BITRATE,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_GOP_SIZE,
+ g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_GOP_SIZE,
g_param_spec_int ("gop-size", "GOP Size",
"Number of frames within one GOP", 0, G_MAXINT,
DEFAULT_VIDEO_GOP_SIZE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_ME_METHOD,
+ g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_ME_METHOD,
g_param_spec_enum ("me-method", "ME Method", "Motion Estimation Method",
GST_TYPE_ME_METHOD, ME_EPZS,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BUFSIZE,
+ g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_BUFSIZE,
g_param_spec_int ("buffer-size", "Buffer Size",
"Size of the video buffers", 0, G_MAXINT, 0,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (G_OBJECT_CLASS (klass),
- ARG_RTP_PAYLOAD_SIZE, g_param_spec_int ("rtp-payload-size",
+ PROP_RTP_PAYLOAD_SIZE, g_param_spec_int ("rtp-payload-size",
"RTP Payload Size", "Target GOB length", 0, G_MAXINT, 0,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
/* register additional properties, possibly dependent on the exact CODEC */
- gst_ffmpeg_cfg_install_property (klass, ARG_CFG_BASE);
+ gst_ffmpeg_cfg_install_property (klass, PROP_CFG_BASE);
venc_class->stop = gst_ffmpegvidenc_stop;
venc_class->finish = gst_ffmpegvidenc_finish;
@@ -209,6 +215,7 @@ gst_ffmpegvidenc_class_init (GstFFMpegVidEncClass * klass)
venc_class->getcaps = gst_ffmpegvidenc_getcaps;
venc_class->set_format = gst_ffmpegvidenc_set_format;
venc_class->propose_allocation = gst_ffmpegvidenc_propose_allocation;
+ venc_class->reset = gst_ffmpegvidenc_reset;
gobject_class->finalize = gst_ffmpegvidenc_finalize;
}
@@ -216,8 +223,11 @@ gst_ffmpegvidenc_class_init (GstFFMpegVidEncClass * klass)
static void
gst_ffmpegvidenc_init (GstFFMpegVidEnc * ffmpegenc)
{
+ GstFFMpegVidEncClass *klass =
+ (GstFFMpegVidEncClass *) G_OBJECT_GET_CLASS (ffmpegenc);
+
/* ffmpeg objects */
- ffmpegenc->context = avcodec_alloc_context ();
+ ffmpegenc->context = avcodec_alloc_context3 (klass->in_plugin);
ffmpegenc->picture = avcodec_alloc_frame ();
ffmpegenc->opened = FALSE;
@@ -243,15 +253,9 @@ gst_ffmpegvidenc_finalize (GObject * object)
gst_ffmpeg_cfg_finalize (ffmpegenc);
- /* close old session */
- if (ffmpegenc->opened) {
- gst_ffmpeg_avcodec_close (ffmpegenc->context);
- ffmpegenc->opened = FALSE;
- }
-
/* clean up remaining allocated data */
av_free (ffmpegenc->context);
- av_free (ffmpegenc->picture);
+ avcodec_free_frame (&ffmpegenc->picture);
g_free (ffmpegenc->filename);
@@ -262,117 +266,13 @@ static GstCaps *
gst_ffmpegvidenc_getcaps (GstVideoEncoder * encoder, GstCaps * filter)
{
GstFFMpegVidEnc *ffmpegenc = (GstFFMpegVidEnc *) encoder;
- GstFFMpegVidEncClass *oclass =
- (GstFFMpegVidEncClass *) G_OBJECT_GET_CLASS (ffmpegenc);
- AVCodecContext *ctx = NULL;
- enum PixelFormat pixfmt;
GstCaps *caps = NULL;
- gint i;
GST_DEBUG_OBJECT (ffmpegenc, "getting caps");
- /* cached */
- if (oclass->sinkcaps) {
- caps = gst_video_encoder_proxy_getcaps (encoder, oclass->sinkcaps, filter);
- GST_DEBUG_OBJECT (ffmpegenc, "return cached caps %" GST_PTR_FORMAT, caps);
- return caps;
- }
-
- /* create cache etc. */
-
- /* shut up the logging while we autoprobe; we don't want warnings and
- * errors about unsupported formats */
- /* FIXME: if someone cares about this disabling the logging for other
- * instances/threads/..., one could investigate if there is a way to
- * set this as a struct member on the av context, and check it from the
- * log handler */
-#ifndef GST_DISABLE_GST_DEBUG
- _shut_up_I_am_probing = TRUE;
-#endif
- GST_DEBUG_OBJECT (ffmpegenc, "probing caps");
- i = pixfmt = 0;
- /* check pixfmt until deemed finished */
- for (pixfmt = 0;; pixfmt++) {
- GstCaps *tmpcaps;
-
- /* override looping all pixfmt if codec declares pixfmts;
- * these may not properly check and report supported pixfmt during _init */
- if (oclass->in_plugin->pix_fmts) {
- if ((pixfmt = oclass->in_plugin->pix_fmts[i++]) == PIX_FMT_NONE) {
- GST_DEBUG_OBJECT (ffmpegenc,
- "At the end of official pixfmt for this codec, breaking out");
- break;
- }
- GST_DEBUG_OBJECT (ffmpegenc,
- "Got an official pixfmt [%d], attempting to get caps", pixfmt);
- tmpcaps = gst_ffmpeg_pixfmt_to_caps (pixfmt, NULL, oclass->in_plugin->id);
- if (tmpcaps) {
- GST_DEBUG_OBJECT (ffmpegenc, "Got caps, breaking out");
- if (!caps)
- caps = gst_caps_new_empty ();
- gst_caps_append (caps, tmpcaps);
- continue;
- }
- GST_DEBUG_OBJECT (ffmpegenc,
- "Couldn't figure out caps without context, trying again with a context");
- }
-
- GST_DEBUG_OBJECT (ffmpegenc, "pixfmt :%d", pixfmt);
- if (pixfmt >= PIX_FMT_NB) {
- GST_WARNING ("Invalid pixfmt, breaking out");
- break;
- }
-
- /* need to start with a fresh codec_context each time around, since
- * codec_close may have released stuff causing the next pass to segfault */
- ctx = avcodec_alloc_context ();
- if (!ctx) {
- GST_DEBUG_OBJECT (ffmpegenc, "no context");
- break;
- }
-
- /* set some default properties */
- ctx->width = DEFAULT_WIDTH;
- ctx->height = DEFAULT_HEIGHT;
- ctx->time_base.num = 1;
- ctx->time_base.den = 25;
- ctx->ticks_per_frame = 1;
- ctx->bit_rate = DEFAULT_VIDEO_BITRATE;
- /* makes it silent */
- ctx->strict_std_compliance = -1;
-
- ctx->pix_fmt = pixfmt;
-
- GST_DEBUG ("Attempting to open codec");
- if (gst_ffmpeg_avcodec_open (ctx, oclass->in_plugin) >= 0 &&
- ctx->pix_fmt == pixfmt) {
- ctx->width = -1;
- if (!caps)
- caps = gst_caps_new_empty ();
- tmpcaps = gst_ffmpeg_codectype_to_caps (oclass->in_plugin->type, ctx,
- oclass->in_plugin->id, TRUE);
- if (tmpcaps)
- gst_caps_append (caps, tmpcaps);
- else
- GST_LOG_OBJECT (ffmpegenc,
- "Couldn't get caps for oclass->in_plugin->name:%s",
- oclass->in_plugin->name);
- gst_ffmpeg_avcodec_close (ctx);
- } else {
- GST_DEBUG_OBJECT (ffmpegenc, "Opening codec failed with pixfmt : %d",
- pixfmt);
- }
- if (ctx->priv_data)
- gst_ffmpeg_avcodec_close (ctx);
- av_free (ctx);
- }
-#ifndef GST_DISABLE_GST_DEBUG
- _shut_up_I_am_probing = FALSE;
-#endif
-
- oclass->sinkcaps = caps;
-
- return gst_video_encoder_proxy_getcaps (encoder, caps, filter);
+ caps = gst_video_encoder_proxy_getcaps (encoder, NULL, filter);
+ GST_DEBUG_OBJECT (ffmpegenc, "return caps %" GST_PTR_FORMAT, caps);
+ return caps;
}
static gboolean
@@ -394,9 +294,6 @@ gst_ffmpegvidenc_set_format (GstVideoEncoder * encoder,
ffmpegenc->opened = FALSE;
}
- /* set defaults */
- avcodec_get_context_defaults (ffmpegenc->context);
-
/* if we set it in _getcaps we should set it also in _link */
ffmpegenc->context->strict_std_compliance = -1;
@@ -470,7 +367,7 @@ gst_ffmpegvidenc_set_format (GstVideoEncoder * encoder,
/* fetch pix_fmt, fps, par, width, height... */
gst_ffmpeg_videoinfo_to_context (&state->info, ffmpegenc->context);
- if ((oclass->in_plugin->id == CODEC_ID_MPEG4)
+ if ((oclass->in_plugin->id == AV_CODEC_ID_MPEG4)
&& (ffmpegenc->context->time_base.den > 65535)) {
/* MPEG4 Standards do not support time_base denominator greater than
* (1<<16) - 1 . We therefore scale them down.
@@ -546,16 +443,7 @@ gst_ffmpegvidenc_set_format (GstVideoEncoder * encoder,
gst_caps_unref (icaps);
return FALSE;
}
-
- if (gst_caps_get_size (icaps) > 1) {
- GstCaps *newcaps;
-
- newcaps =
- gst_caps_new_full (gst_structure_copy (gst_caps_get_structure (icaps,
- 0)), NULL);
- gst_caps_unref (icaps);
- icaps = newcaps;
- }
+ icaps = gst_caps_truncate (icaps);
/* Store input state and set output state */
if (ffmpegenc->input_state)
@@ -796,24 +684,28 @@ gst_ffmpegvidenc_flush_buffers (GstFFMpegVidEnc * ffmpegenc, gboolean send)
(("Could not write to file \"%s\"."), ffmpegenc->filename),
GST_ERROR_SYSTEM);
- if (gst_video_encoder_allocate_output_frame (GST_VIDEO_ENCODER (ffmpegenc),
- frame, ret_size) != GST_FLOW_OK) {
+ if (send) {
+ if (gst_video_encoder_allocate_output_frame (GST_VIDEO_ENCODER
+ (ffmpegenc), frame, ret_size) != GST_FLOW_OK) {
#ifndef GST_DISABLE_GST_DEBUG
- GstFFMpegVidEncClass *oclass =
- (GstFFMpegVidEncClass *) (G_OBJECT_GET_CLASS (ffmpegenc));
- GST_WARNING_OBJECT (ffmpegenc,
- "avenc_%s: failed to allocate buffer", oclass->in_plugin->name);
+ GstFFMpegVidEncClass *oclass =
+ (GstFFMpegVidEncClass *) (G_OBJECT_GET_CLASS (ffmpegenc));
+ GST_WARNING_OBJECT (ffmpegenc,
+ "avenc_%s: failed to allocate buffer", oclass->in_plugin->name);
#endif /* GST_DISABLE_GST_DEBUG */
- gst_video_codec_frame_unref (frame);
- break;
- }
- outbuf = frame->output_buffer;
- gst_buffer_fill (outbuf, 0, ffmpegenc->working_buf, ret_size);
+ gst_video_codec_frame_unref (frame);
+ break;
+ }
+ outbuf = frame->output_buffer;
+ gst_buffer_fill (outbuf, 0, ffmpegenc->working_buf, ret_size);
- if (ffmpegenc->context->coded_frame->key_frame)
- GST_VIDEO_CODEC_FRAME_SET_SYNC_POINT (frame);
+ if (ffmpegenc->context->coded_frame->key_frame)
+ GST_VIDEO_CODEC_FRAME_SET_SYNC_POINT (frame);
- gst_video_encoder_finish_frame (GST_VIDEO_ENCODER (ffmpegenc), frame);
+ gst_video_encoder_finish_frame (GST_VIDEO_ENCODER (ffmpegenc), frame);
+ } else {
+ gst_video_codec_frame_unref (frame);
+ }
}
}
@@ -835,18 +727,18 @@ gst_ffmpegvidenc_set_property (GObject * object,
/* Check the argument id to see which argument we're setting. */
switch (prop_id) {
- case ARG_BIT_RATE:
+ case PROP_BIT_RATE:
ffmpegenc->bitrate = g_value_get_int (value);
break;
- case ARG_GOP_SIZE:
+ case PROP_GOP_SIZE:
ffmpegenc->gop_size = g_value_get_int (value);
break;
- case ARG_ME_METHOD:
+ case PROP_ME_METHOD:
ffmpegenc->me_method = g_value_get_enum (value);
break;
- case ARG_BUFSIZE:
+ case PROP_BUFSIZE:
break;
- case ARG_RTP_PAYLOAD_SIZE:
+ case PROP_RTP_PAYLOAD_SIZE:
ffmpegenc->rtp_payload_size = g_value_get_int (value);
break;
default:
@@ -867,19 +759,19 @@ gst_ffmpegvidenc_get_property (GObject * object,
ffmpegenc = (GstFFMpegVidEnc *) (object);
switch (prop_id) {
- case ARG_BIT_RATE:
+ case PROP_BIT_RATE:
g_value_set_int (value, ffmpegenc->bitrate);
break;
- case ARG_GOP_SIZE:
+ case PROP_GOP_SIZE:
g_value_set_int (value, ffmpegenc->gop_size);
break;
- case ARG_ME_METHOD:
+ case PROP_ME_METHOD:
g_value_set_enum (value, ffmpegenc->me_method);
break;
- case ARG_BUFSIZE:
+ case PROP_BUFSIZE:
g_value_set_int (value, ffmpegenc->buffer_size);
break;
- case ARG_RTP_PAYLOAD_SIZE:
+ case PROP_RTP_PAYLOAD_SIZE:
g_value_set_int (value, ffmpegenc->rtp_payload_size);
break;
default:
@@ -890,15 +782,26 @@ gst_ffmpegvidenc_get_property (GObject * object,
}
static gboolean
-gst_ffmpegvidenc_stop (GstVideoEncoder * encoder)
+gst_ffmpegvidenc_reset (GstVideoEncoder * encoder, gboolean hard)
{
GstFFMpegVidEnc *ffmpegenc = (GstFFMpegVidEnc *) encoder;
- gst_ffmpegvidenc_flush_buffers (ffmpegenc, FALSE);
if (ffmpegenc->opened) {
- gst_ffmpeg_avcodec_close (ffmpegenc->context);
- ffmpegenc->opened = FALSE;
+ avcodec_flush_buffers (ffmpegenc->context);
}
+
+ return TRUE;
+}
+
+static gboolean
+gst_ffmpegvidenc_stop (GstVideoEncoder * encoder)
+{
+ GstFFMpegVidEnc *ffmpegenc = (GstFFMpegVidEnc *) encoder;
+
+ gst_ffmpegvidenc_flush_buffers (ffmpegenc, FALSE);
+ gst_ffmpeg_avcodec_close (ffmpegenc->context);
+ ffmpegenc->opened = FALSE;
+
if (ffmpegenc->file) {
fclose (ffmpegenc->file);
ffmpegenc->file = NULL;
@@ -953,10 +856,11 @@ gst_ffmpegvidenc_register (GstPlugin * plugin)
goto next;
/* no quasi codecs, please */
- if (in_plugin->id == CODEC_ID_RAWVIDEO ||
- in_plugin->id == CODEC_ID_V210 ||
- in_plugin->id == CODEC_ID_V210X ||
- in_plugin->id == CODEC_ID_R210 || in_plugin->id == CODEC_ID_ZLIB) {
+ if (in_plugin->id == AV_CODEC_ID_RAWVIDEO ||
+ in_plugin->id == AV_CODEC_ID_V210 ||
+ in_plugin->id == AV_CODEC_ID_V210X ||
+ in_plugin->id == AV_CODEC_ID_R210
+ || in_plugin->id == AV_CODEC_ID_ZLIB) {
goto next;
}
@@ -971,7 +875,8 @@ gst_ffmpegvidenc_register (GstPlugin * plugin)
}
/* only video encoders */
- if (!in_plugin->encode || in_plugin->type != AVMEDIA_TYPE_VIDEO)
+ if (!av_codec_is_encoder (in_plugin)
+ || in_plugin->type != AVMEDIA_TYPE_VIDEO)
goto next;
/* FIXME : We should have a method to know cheaply whether we have a mapping
diff --git a/ext/libav/gstavvidenc.h b/ext/libav/gstavvidenc.h
index eb201b3..d19dc39 100644
--- a/ext/libav/gstavvidenc.h
+++ b/ext/libav/gstavvidenc.h
@@ -13,8 +13,8 @@
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
*/
/* First, include the header file for the plugin, to bring in the
@@ -26,7 +26,9 @@
G_BEGIN_DECLS
+#include <gst/gst.h>
#include <gst/video/gstvideoencoder.h>
+#include <libavcodec/avcodec.h>
typedef struct _GstFFMpegVidEnc GstFFMpegVidEnc;
@@ -76,7 +78,6 @@ struct _GstFFMpegVidEncClass
AVCodec *in_plugin;
GstPadTemplate *srctempl, *sinktempl;
- GstCaps *sinkcaps;
};
#define GST_TYPE_FFMPEGVIDENC \
diff --git a/ext/libswscale/Makefile.in b/ext/libswscale/Makefile.in
index fa81a67..085053a 100644
--- a/ext/libswscale/Makefile.in
+++ b/ext/libswscale/Makefile.in
@@ -1,9 +1,8 @@
-# Makefile.in generated by automake 1.11.6 from Makefile.am.
+# Makefile.in generated by automake 1.13.3 from Makefile.am.
# @configure_input@
-# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-# Foundation, Inc.
+# Copyright (C) 1994-2013 Free Software Foundation, Inc.
+
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -16,23 +15,51 @@
@SET_MAKE@
VPATH = @srcdir@
-am__make_dryrun = \
- { \
- am__dry=no; \
+am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
+am__make_running_with_option = \
+ case $${target_option-} in \
+ ?) ;; \
+ *) echo "am__make_running_with_option: internal error: invalid" \
+ "target option '$${target_option-}' specified" >&2; \
+ exit 1;; \
+ esac; \
+ has_opt=no; \
+ sane_makeflags=$$MAKEFLAGS; \
+ if $(am__is_gnu_make); then \
+ sane_makeflags=$$MFLAGS; \
+ else \
case $$MAKEFLAGS in \
*\\[\ \ ]*) \
- echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
- | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
- *) \
- for am__flg in $$MAKEFLAGS; do \
- case $$am__flg in \
- *=*|--*) ;; \
- *n*) am__dry=yes; break;; \
- esac; \
- done;; \
+ bs=\\; \
+ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
esac; \
- test $$am__dry = yes; \
- }
+ fi; \
+ skip_next=no; \
+ strip_trailopt () \
+ { \
+ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+ }; \
+ for flg in $$sane_makeflags; do \
+ test $$skip_next = yes && { skip_next=no; continue; }; \
+ case $$flg in \
+ *=*|--*) continue;; \
+ -*I) strip_trailopt 'I'; skip_next=yes;; \
+ -*I?*) strip_trailopt 'I';; \
+ -*O) strip_trailopt 'O'; skip_next=yes;; \
+ -*O?*) strip_trailopt 'O';; \
+ -*l) strip_trailopt 'l'; skip_next=yes;; \
+ -*l?*) strip_trailopt 'l';; \
+ -[dEDm]) skip_next=yes;; \
+ -[JT]) skip_next=yes;; \
+ esac; \
+ case $$flg in \
+ *$$target_option*) has_opt=yes; break;; \
+ esac; \
+ done; \
+ test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
@@ -59,7 +86,8 @@ target_triplet = @target@
@HAVE_LIBAV_UNINSTALLED_FALSE@ $(am__DEPENDENCIES_1) \
@HAVE_LIBAV_UNINSTALLED_FALSE@ $(am__DEPENDENCIES_1)
subdir = ext/libswscale
-DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
+ $(top_srcdir)/depcomp
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/common/m4/as-ac-expand.m4 \
$(top_srcdir)/common/m4/as-auto-alt.m4 \
@@ -124,10 +152,23 @@ libgstavscale_la_OBJECTS = $(am_libgstavscale_la_OBJECTS)
AM_V_lt = $(am__v_lt_@AM_V@)
am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
am__v_lt_0 = --silent
+am__v_lt_1 =
libgstavscale_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
$(libgstavscale_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link \
$(CCLD) $(libgstavscale_la_CFLAGS) $(CFLAGS) \
$(libgstavscale_la_LDFLAGS) $(LDFLAGS) -o $@
+AM_V_P = $(am__v_P_@AM_V@)
+am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
+am__v_P_0 = false
+am__v_P_1 = :
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
+am__v_GEN_0 = @echo " GEN " $@;
+am__v_GEN_1 =
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
+am__v_at_0 = @
+am__v_at_1 =
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
@@ -140,20 +181,16 @@ LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(AM_CFLAGS) $(CFLAGS)
AM_V_CC = $(am__v_CC_@AM_V@)
am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
-am__v_CC_0 = @echo " CC " $@;
-AM_V_at = $(am__v_at_@AM_V@)
-am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
-am__v_at_0 = @
+am__v_CC_0 = @echo " CC " $@;
+am__v_CC_1 =
CCLD = $(CC)
LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
AM_V_CCLD = $(am__v_CCLD_@AM_V@)
am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
-am__v_CCLD_0 = @echo " CCLD " $@;
-AM_V_GEN = $(am__v_GEN_@AM_V@)
-am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
-am__v_GEN_0 = @echo " GEN " $@;
+am__v_CCLD_0 = @echo " CCLD " $@;
+am__v_CCLD_1 =
SOURCES = $(libgstavscale_la_SOURCES)
DIST_SOURCES = $(libgstavscale_la_SOURCES)
am__can_run_installinfo = \
@@ -161,6 +198,23 @@ am__can_run_installinfo = \
n|no|NO) false;; \
*) (install-info --version) >/dev/null 2>&1;; \
esac
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
+# Read a list of newline-separated strings from the standard input,
+# and print each of them once, without duplicates. Input order is
+# *not* preserved.
+am__uniquify_input = $(AWK) '\
+ BEGIN { nonempty = 0; } \
+ { items[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in items) print i; }; } \
+'
+# Make sure the list of sources is unique. This is necessary because,
+# e.g., the same source file might be shared among _SOURCES variables
+# for different programs/libraries.
+am__define_uniq_tagged_files = \
+ list='$(am__tagged_files)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | $(am__uniquify_input)`
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
@@ -177,10 +231,12 @@ AWK = @AWK@
CAT_ENTRY_END = @CAT_ENTRY_END@
CAT_ENTRY_START = @CAT_ENTRY_START@
CC = @CC@
+CCASFLAGS = @CCASFLAGS@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
+CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DARWIN_LDFLAGS = @DARWIN_LDFLAGS@
DEFS = @DEFS@
@@ -196,7 +252,11 @@ ECHO_T = @ECHO_T@
EGREP = @EGREP@
ERROR_CFLAGS = @ERROR_CFLAGS@
EXEEXT = @EXEEXT@
+FFLAGS = @FFLAGS@
FGREP = @FGREP@
+GCOV = @GCOV@
+GCOV_CFLAGS = @GCOV_CFLAGS@
+GCOV_LIBS = @GCOV_LIBS@
GREP = @GREP@
GSTPB_PLUGINS_DIR = @GSTPB_PLUGINS_DIR@
GST_AGE = @GST_AGE@
@@ -229,16 +289,15 @@ GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@
GTKDOC_MKPDF = @GTKDOC_MKPDF@
GTKDOC_REBASE = @GTKDOC_REBASE@
HAVE_BZ2 = @HAVE_BZ2@
-HAVE_DOCBOOK2HTML = @HAVE_DOCBOOK2HTML@
HAVE_DOCBOOK2PS = @HAVE_DOCBOOK2PS@
HAVE_DVIPS = @HAVE_DVIPS@
HAVE_EPSTOPDF = @HAVE_EPSTOPDF@
-HAVE_FIG2DEV = @HAVE_FIG2DEV@
HAVE_JADETEX = @HAVE_JADETEX@
HAVE_PNGTOPNM = @HAVE_PNGTOPNM@
HAVE_PNMTOPS = @HAVE_PNMTOPS@
HAVE_PS2PDF = @HAVE_PS2PDF@
HAVE_XMLLINT = @HAVE_XMLLINT@
+HAVE_XSLTPROC = @HAVE_XSLTPROC@
HTML_DIR = @HTML_DIR@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
@@ -421,6 +480,7 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
+
install-pluginLTLIBRARIES: $(plugin_LTLIBRARIES)
@$(NORMAL_INSTALL)
@list='$(plugin_LTLIBRARIES)'; test -n "$(plugindir)" || list=; \
@@ -447,12 +507,15 @@ uninstall-pluginLTLIBRARIES:
clean-pluginLTLIBRARIES:
-test -z "$(plugin_LTLIBRARIES)" || rm -f $(plugin_LTLIBRARIES)
- @list='$(plugin_LTLIBRARIES)'; for p in $$list; do \
- dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
- test "$$dir" != "$$p" || dir=.; \
- echo "rm -f \"$${dir}/so_locations\""; \
- rm -f "$${dir}/so_locations"; \
- done
+ @list='$(plugin_LTLIBRARIES)'; \
+ locs=`for p in $$list; do echo $$p; done | \
+ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \
+ sort -u`; \
+ test -z "$$locs" || { \
+ echo rm -f $${locs}; \
+ rm -f $${locs}; \
+ }
+
libgstavscale.la: $(libgstavscale_la_OBJECTS) $(libgstavscale_la_DEPENDENCIES) $(EXTRA_libgstavscale_la_DEPENDENCIES)
$(AM_V_CCLD)$(libgstavscale_la_LINK) -rpath $(plugindir) $(libgstavscale_la_OBJECTS) $(libgstavscale_la_LIBADD) $(LIBS)
@@ -498,26 +561,15 @@ mostlyclean-libtool:
clean-libtool:
-rm -rf .libs _libs
-ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
- list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
- unique=`for i in $$list; do \
- if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
- done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
- mkid -fID $$unique
-tags: TAGS
-
-TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
- $(TAGS_FILES) $(LISP)
+ID: $(am__tagged_files)
+ $(am__define_uniq_tagged_files); mkid -fID $$unique
+tags: tags-am
+TAGS: tags
+
+tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
set x; \
here=`pwd`; \
- list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
- unique=`for i in $$list; do \
- if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
- done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
+ $(am__define_uniq_tagged_files); \
shift; \
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
@@ -529,15 +581,11 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$$unique; \
fi; \
fi
-ctags: CTAGS
-CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
- $(TAGS_FILES) $(LISP)
- list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
- unique=`for i in $$list; do \
- if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
- done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
+ctags: ctags-am
+
+CTAGS: ctags
+ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+ $(am__define_uniq_tagged_files); \
test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$unique
@@ -546,6 +594,21 @@ GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& $(am__cd) $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here"
+cscopelist: cscopelist-am
+
+cscopelist-am: $(am__tagged_files)
+ list='$(am__tagged_files)'; \
+ case "$(srcdir)" in \
+ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+ *) sdir=$(subdir)/$(srcdir) ;; \
+ esac; \
+ for i in $$list; do \
+ if test -f "$$i"; then \
+ echo "$(subdir)/$$i"; \
+ else \
+ echo "$$sdir/$$i"; \
+ fi; \
+ done >> $(top_builddir)/cscope.files
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
@@ -690,19 +753,20 @@ uninstall-am: uninstall-pluginLTLIBRARIES
.MAKE: install-am install-strip
-.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
- clean-libtool clean-pluginLTLIBRARIES ctags distclean \
- distclean-compile distclean-generic distclean-libtool \
- distclean-tags distdir dvi dvi-am html html-am info info-am \
- install install-am install-data install-data-am install-dvi \
- install-dvi-am install-exec install-exec-am install-html \
- install-html-am install-info install-info-am install-man \
- install-pdf install-pdf-am install-pluginLTLIBRARIES \
- install-ps install-ps-am install-strip installcheck \
- installcheck-am installdirs maintainer-clean \
- maintainer-clean-generic mostlyclean mostlyclean-compile \
- mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
- tags uninstall uninstall-am uninstall-pluginLTLIBRARIES
+.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \
+ clean-libtool clean-pluginLTLIBRARIES cscopelist-am ctags \
+ ctags-am distclean distclean-compile distclean-generic \
+ distclean-libtool distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-data \
+ install-data-am install-dvi install-dvi-am install-exec \
+ install-exec-am install-html install-html-am install-info \
+ install-info-am install-man install-pdf install-pdf-am \
+ install-pluginLTLIBRARIES install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+ pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am \
+ uninstall-pluginLTLIBRARIES
# Tell versions [3.59,3.63) of GNU make to not export all variables.
diff --git a/ext/libswscale/gstffmpegscale.c b/ext/libswscale/gstffmpegscale.c
index ce980a8..a2b0248 100644
--- a/ext/libswscale/gstffmpegscale.c
+++ b/ext/libswscale/gstffmpegscale.c
@@ -15,8 +15,8 @@
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
*/
#ifdef HAVE_CONFIG_H
@@ -246,44 +246,15 @@ gst_ffmpegscale_caps_remove_format_info (GstCaps * caps)
{
int i;
GstStructure *structure;
- GstCaps *rgbcaps;
- GstCaps *graycaps;
caps = gst_caps_copy (caps);
for (i = 0; i < gst_caps_get_size (caps); i++) {
structure = gst_caps_get_structure (caps, i);
- gst_structure_set_name (structure, "video/x-raw-yuv");
gst_structure_remove_field (structure, "format");
- gst_structure_remove_field (structure, "endianness");
- gst_structure_remove_field (structure, "depth");
- gst_structure_remove_field (structure, "bpp");
- gst_structure_remove_field (structure, "red_mask");
- gst_structure_remove_field (structure, "green_mask");
- gst_structure_remove_field (structure, "blue_mask");
- gst_structure_remove_field (structure, "alpha_mask");
- gst_structure_remove_field (structure, "palette_data");
}
- rgbcaps = gst_caps_copy (caps);
-
- for (i = 0; i < gst_caps_get_size (rgbcaps); i++) {
- structure = gst_caps_get_structure (rgbcaps, i);
-
- gst_structure_set_name (structure, "video/x-raw-rgb");
- }
- graycaps = gst_caps_copy (caps);
-
- for (i = 0; i < gst_caps_get_size (graycaps); i++) {
- structure = gst_caps_get_structure (graycaps, i);
-
- gst_structure_set_name (structure, "video/x-raw-gray");
- }
-
- gst_caps_append (caps, graycaps);
- gst_caps_append (caps, rgbcaps);
-
return caps;
}
diff --git a/gst-libav.doap b/gst-libav.doap
index 6362121..e268a36 100644
--- a/gst-libav.doap
+++ b/gst-libav.doap
@@ -34,61 +34,21 @@ colorspace conversion elements.
<release>
<Version>
- <revision>1.0.8</revision>
- <branch>1.0</branch>
+ <revision>1.1.2</revision>
+ <branch>1.1</branch>
<name></name>
<created>2013-07-11</created>
- <file-release rdf:resource="http://gstreamer.freedesktop.org/src/gst-libav/gst-libav-1.0.8.tar.xz" />
- </Version>
- </release>
-
- <release>
- <Version>
- <revision>1.0.7</revision>
- <branch>1.0</branch>
- <name></name>
- <created>2013-04-26</created>
- <file-release rdf:resource="http://gstreamer.freedesktop.org/src/gst-libav/gst-libav-1.0.7.tar.xz" />
- </Version>
- </release>
-
- <release>
- <Version>
- <revision>1.0.6</revision>
- <branch>1.0</branch>
- <name></name>
- <created>2013-03-22</created>
- <file-release rdf:resource="http://gstreamer.freedesktop.org/src/gst-libav/gst-libav-1.0.6.tar.xz" />
+ <file-release rdf:resource="http://gstreamer.freedesktop.org/src/gst-libav/gst-libav-1.1.2.tar.xz" />
</Version>
</release>
<release>
<Version>
- <revision>1.0.5</revision>
- <branch>1.0</branch>
- <name></name>
- <created>2013-01-08</created>
- <file-release rdf:resource="http://gstreamer.freedesktop.org/src/gst-libav/gst-libav-1.0.5.tar.xz" />
- </Version>
- </release>
-
- <release>
- <Version>
- <revision>1.0.4</revision>
- <branch>1.0</branch>
- <name></name>
- <created>2012-12-18</created>
- <file-release rdf:resource="http://gstreamer.freedesktop.org/src/gst-libav/gst-libav-1.0.4.tar.xz" />
- </Version>
- </release>
-
- <release>
- <Version>
- <revision>1.0.3</revision>
- <branch>1.0</branch>
+ <revision>1.1.1</revision>
+ <branch>1.1</branch>
<name></name>
- <created>2012-11-21</created>
- <file-release rdf:resource="http://gstreamer.freedesktop.org/src/gst-libav/gst-libav-1.0.3.tar.xz" />
+ <created>2013-06-05</created>
+ <file-release rdf:resource="http://gstreamer.freedesktop.org/src/gst-libav/gst-libav-1.1.1.tar.xz" />
</Version>
</release>
diff --git a/gst-libav.spec b/gst-libav.spec
index 71c8fc9..d8b84e0 100644
--- a/gst-libav.spec
+++ b/gst-libav.spec
@@ -4,7 +4,7 @@
%define gst_majorminor 1.0
Name: %{gstreamer}-libav
-Version: 1.0.8
+Version: 1.1.2
Release: 1
Summary: GStreamer Streaming-media framework plug-in using libav (FFmpeg).
Group: Libraries/Multimedia
diff --git a/gst-libs/Makefile.in b/gst-libs/Makefile.in
index 58d829a..25fcbc7 100644
--- a/gst-libs/Makefile.in
+++ b/gst-libs/Makefile.in
@@ -1,9 +1,8 @@
-# Makefile.in generated by automake 1.11.6 from Makefile.am.
+# Makefile.in generated by automake 1.13.3 from Makefile.am.
# @configure_input@
-# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-# Foundation, Inc.
+# Copyright (C) 1994-2013 Free Software Foundation, Inc.
+
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -15,23 +14,51 @@
@SET_MAKE@
VPATH = @srcdir@
-am__make_dryrun = \
- { \
- am__dry=no; \
+am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
+am__make_running_with_option = \
+ case $${target_option-} in \
+ ?) ;; \
+ *) echo "am__make_running_with_option: internal error: invalid" \
+ "target option '$${target_option-}' specified" >&2; \
+ exit 1;; \
+ esac; \
+ has_opt=no; \
+ sane_makeflags=$$MAKEFLAGS; \
+ if $(am__is_gnu_make); then \
+ sane_makeflags=$$MFLAGS; \
+ else \
case $$MAKEFLAGS in \
*\\[\ \ ]*) \
- echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
- | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
- *) \
- for am__flg in $$MAKEFLAGS; do \
- case $$am__flg in \
- *=*|--*) ;; \
- *n*) am__dry=yes; break;; \
- esac; \
- done;; \
+ bs=\\; \
+ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
+ esac; \
+ fi; \
+ skip_next=no; \
+ strip_trailopt () \
+ { \
+ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+ }; \
+ for flg in $$sane_makeflags; do \
+ test $$skip_next = yes && { skip_next=no; continue; }; \
+ case $$flg in \
+ *=*|--*) continue;; \
+ -*I) strip_trailopt 'I'; skip_next=yes;; \
+ -*I?*) strip_trailopt 'I';; \
+ -*O) strip_trailopt 'O'; skip_next=yes;; \
+ -*O?*) strip_trailopt 'O';; \
+ -*l) strip_trailopt 'l'; skip_next=yes;; \
+ -*l?*) strip_trailopt 'l';; \
+ -[dEDm]) skip_next=yes;; \
+ -[JT]) skip_next=yes;; \
+ esac; \
+ case $$flg in \
+ *$$target_option*) has_opt=yes; break;; \
esac; \
- test $$am__dry = yes; \
- }
+ done; \
+ test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
@@ -52,7 +79,7 @@ build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
subdir = gst-libs
-DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/common/m4/as-ac-expand.m4 \
$(top_srcdir)/common/m4/as-auto-alt.m4 \
@@ -82,21 +109,28 @@ mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
+AM_V_P = $(am__v_P_@AM_V@)
+am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
+am__v_P_0 = false
+am__v_P_1 = :
AM_V_GEN = $(am__v_GEN_@AM_V@)
am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
-am__v_GEN_0 = @echo " GEN " $@;
+am__v_GEN_0 = @echo " GEN " $@;
+am__v_GEN_1 =
AM_V_at = $(am__v_at_@AM_V@)
am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
am__v_at_0 = @
+am__v_at_1 =
SOURCES =
DIST_SOURCES =
-RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
- html-recursive info-recursive install-data-recursive \
- install-dvi-recursive install-exec-recursive \
- install-html-recursive install-info-recursive \
- install-pdf-recursive install-ps-recursive install-recursive \
- installcheck-recursive installdirs-recursive pdf-recursive \
- ps-recursive uninstall-recursive
+RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \
+ ctags-recursive dvi-recursive html-recursive info-recursive \
+ install-data-recursive install-dvi-recursive \
+ install-exec-recursive install-html-recursive \
+ install-info-recursive install-pdf-recursive \
+ install-ps-recursive install-recursive installcheck-recursive \
+ installdirs-recursive pdf-recursive ps-recursive \
+ tags-recursive uninstall-recursive
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
@@ -104,9 +138,29 @@ am__can_run_installinfo = \
esac
RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
distclean-recursive maintainer-clean-recursive
-AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
- $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
+am__recursive_targets = \
+ $(RECURSIVE_TARGETS) \
+ $(RECURSIVE_CLEAN_TARGETS) \
+ $(am__extra_recursive_targets)
+AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \
distdir
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
+# Read a list of newline-separated strings from the standard input,
+# and print each of them once, without duplicates. Input order is
+# *not* preserved.
+am__uniquify_input = $(AWK) '\
+ BEGIN { nonempty = 0; } \
+ { items[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in items) print i; }; } \
+'
+# Make sure the list of sources is unique. This is necessary because,
+# e.g., the same source file might be shared among _SOURCES variables
+# for different programs/libraries.
+am__define_uniq_tagged_files = \
+ list='$(am__tagged_files)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | $(am__uniquify_input)`
ETAGS = etags
CTAGS = ctags
DIST_SUBDIRS = $(SUBDIRS)
@@ -149,10 +203,12 @@ AWK = @AWK@
CAT_ENTRY_END = @CAT_ENTRY_END@
CAT_ENTRY_START = @CAT_ENTRY_START@
CC = @CC@
+CCASFLAGS = @CCASFLAGS@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
+CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DARWIN_LDFLAGS = @DARWIN_LDFLAGS@
DEFS = @DEFS@
@@ -168,7 +224,11 @@ ECHO_T = @ECHO_T@
EGREP = @EGREP@
ERROR_CFLAGS = @ERROR_CFLAGS@
EXEEXT = @EXEEXT@
+FFLAGS = @FFLAGS@
FGREP = @FGREP@
+GCOV = @GCOV@
+GCOV_CFLAGS = @GCOV_CFLAGS@
+GCOV_LIBS = @GCOV_LIBS@
GREP = @GREP@
GSTPB_PLUGINS_DIR = @GSTPB_PLUGINS_DIR@
GST_AGE = @GST_AGE@
@@ -201,16 +261,15 @@ GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@
GTKDOC_MKPDF = @GTKDOC_MKPDF@
GTKDOC_REBASE = @GTKDOC_REBASE@
HAVE_BZ2 = @HAVE_BZ2@
-HAVE_DOCBOOK2HTML = @HAVE_DOCBOOK2HTML@
HAVE_DOCBOOK2PS = @HAVE_DOCBOOK2PS@
HAVE_DVIPS = @HAVE_DVIPS@
HAVE_EPSTOPDF = @HAVE_EPSTOPDF@
-HAVE_FIG2DEV = @HAVE_FIG2DEV@
HAVE_JADETEX = @HAVE_JADETEX@
HAVE_PNGTOPNM = @HAVE_PNGTOPNM@
HAVE_PNMTOPS = @HAVE_PNMTOPS@
HAVE_PS2PDF = @HAVE_PS2PDF@
HAVE_XMLLINT = @HAVE_XMLLINT@
+HAVE_XSLTPROC = @HAVE_XSLTPROC@
HTML_DIR = @HTML_DIR@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
@@ -389,22 +448,25 @@ clean-libtool:
-rm -rf .libs _libs
# This directory's subdirectories are mostly independent; you can cd
-# into them and run `make' without going through this Makefile.
-# To change the values of `make' variables: instead of editing Makefiles,
-# (1) if the variable is set in `config.status', edit `config.status'
-# (which will cause the Makefiles to be regenerated when you run `make');
-# (2) otherwise, pass the desired values on the `make' command line.
-$(RECURSIVE_TARGETS):
- @fail= failcom='exit 1'; \
- for f in x $$MAKEFLAGS; do \
- case $$f in \
- *=* | --[!k]*);; \
- *k*) failcom='fail=yes';; \
- esac; \
- done; \
+# into them and run 'make' without going through this Makefile.
+# To change the values of 'make' variables: instead of editing Makefiles,
+# (1) if the variable is set in 'config.status', edit 'config.status'
+# (which will cause the Makefiles to be regenerated when you run 'make');
+# (2) otherwise, pass the desired values on the 'make' command line.
+$(am__recursive_targets):
+ @fail=; \
+ if $(am__make_keepgoing); then \
+ failcom='fail=yes'; \
+ else \
+ failcom='exit 1'; \
+ fi; \
dot_seen=no; \
target=`echo $@ | sed s/-recursive//`; \
- list='$(SUBDIRS)'; for subdir in $$list; do \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ for subdir in $$list; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
dot_seen=yes; \
@@ -419,57 +481,12 @@ $(RECURSIVE_TARGETS):
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
fi; test -z "$$fail"
-$(RECURSIVE_CLEAN_TARGETS):
- @fail= failcom='exit 1'; \
- for f in x $$MAKEFLAGS; do \
- case $$f in \
- *=* | --[!k]*);; \
- *k*) failcom='fail=yes';; \
- esac; \
- done; \
- dot_seen=no; \
- case "$@" in \
- distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
- *) list='$(SUBDIRS)' ;; \
- esac; \
- rev=''; for subdir in $$list; do \
- if test "$$subdir" = "."; then :; else \
- rev="$$subdir $$rev"; \
- fi; \
- done; \
- rev="$$rev ."; \
- target=`echo $@ | sed s/-recursive//`; \
- for subdir in $$rev; do \
- echo "Making $$target in $$subdir"; \
- if test "$$subdir" = "."; then \
- local_target="$$target-am"; \
- else \
- local_target="$$target"; \
- fi; \
- ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
- || eval $$failcom; \
- done && test -z "$$fail"
-tags-recursive:
- list='$(SUBDIRS)'; for subdir in $$list; do \
- test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
- done
-ctags-recursive:
- list='$(SUBDIRS)'; for subdir in $$list; do \
- test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
- done
+ID: $(am__tagged_files)
+ $(am__define_uniq_tagged_files); mkid -fID $$unique
+tags: tags-recursive
+TAGS: tags
-ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
- list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
- unique=`for i in $$list; do \
- if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
- done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
- mkid -fID $$unique
-tags: TAGS
-
-TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
- $(TAGS_FILES) $(LISP)
+tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
set x; \
here=`pwd`; \
if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
@@ -485,12 +502,7 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
fi; \
done; \
- list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
- unique=`for i in $$list; do \
- if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
- done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
+ $(am__define_uniq_tagged_files); \
shift; \
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
@@ -502,15 +514,11 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$$unique; \
fi; \
fi
-ctags: CTAGS
-CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
- $(TAGS_FILES) $(LISP)
- list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
- unique=`for i in $$list; do \
- if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
- done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
+ctags: ctags-recursive
+
+CTAGS: ctags
+ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+ $(am__define_uniq_tagged_files); \
test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$unique
@@ -519,6 +527,21 @@ GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& $(am__cd) $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here"
+cscopelist: cscopelist-recursive
+
+cscopelist-am: $(am__tagged_files)
+ list='$(am__tagged_files)'; \
+ case "$(srcdir)" in \
+ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+ *) sdir=$(subdir)/$(srcdir) ;; \
+ esac; \
+ for i in $$list; do \
+ if test -f "$$i"; then \
+ echo "$(subdir)/$$i"; \
+ else \
+ echo "$$sdir/$$i"; \
+ fi; \
+ done >> $(top_builddir)/cscope.files
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
@@ -679,22 +702,20 @@ ps-am:
uninstall-am:
-.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \
- install-am install-strip tags-recursive
-
-.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
- all all-am check check-am clean clean-generic clean-libtool \
- ctags ctags-recursive distclean distclean-generic \
- distclean-libtool distclean-tags distdir dvi dvi-am html \
- html-am info info-am install install-am install-data \
- install-data-am install-dvi install-dvi-am install-exec \
- install-exec-am install-html install-html-am install-info \
- install-info-am install-man install-pdf install-pdf-am \
- install-ps install-ps-am install-strip installcheck \
- installcheck-am installdirs installdirs-am maintainer-clean \
- maintainer-clean-generic mostlyclean mostlyclean-generic \
- mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \
- uninstall uninstall-am
+.MAKE: $(am__recursive_targets) install-am install-strip
+
+.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \
+ check-am clean clean-generic clean-libtool cscopelist-am ctags \
+ ctags-am distclean distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ installdirs-am maintainer-clean maintainer-clean-generic \
+ mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \
+ ps ps-am tags tags-am uninstall uninstall-am
# Tell versions [3.59,3.63) of GNU make to not export all variables.
diff --git a/gst-libs/ext/Makefile.am b/gst-libs/ext/Makefile.am
index b1054e1..12f35c8 100644
--- a/gst-libs/ext/Makefile.am
+++ b/gst-libs/ext/Makefile.am
@@ -23,7 +23,7 @@ clean-local:
dist-clean:
cd libav && $(MAKE) distclean
- rm -rf $(TMP_DIST_DIR)
+ rm -rf libav/$(TMP_DIST_DIR)
rm -f Makefile
rm -f libav/.version
rm -f libav/.config
@@ -36,19 +36,19 @@ maintainer-clean: distclean
maintainerclean: maintainer-clean
dist-local:
- GIT_DIR=libav/.git git checkout-index --prefix=../$(TMP_DIST_DIR)/libav/ -a
- touch $(TMP_DIST_DIR)/libav/config.mak
+ GIT_DIR=libav/.git git checkout-index --prefix=$(TMP_DIST_DIR)/libav/ -a
+ touch libav/$(TMP_DIST_DIR)/libav/config.mak
echo "Patching libav ./configure"
- sed -e '/Unknown option/ {N;N;s/exit 1//; }' $(TMP_DIST_DIR)/libav/configure > $(TMP_DIST_DIR)/libav/configure.tmp
- mv $(TMP_DIST_DIR)/libav/configure.tmp $(TMP_DIST_DIR)/libav/configure
- chmod +x $(TMP_DIST_DIR)/libav/configure
+ sed -e '/Unknown option/ {N;N;s/exit 1//; }' libav/$(TMP_DIST_DIR)/libav/configure > libav/$(TMP_DIST_DIR)/libav/configure.tmp
+ mv libav/$(TMP_DIST_DIR)/libav/configure.tmp libav/$(TMP_DIST_DIR)/libav/configure
+ chmod +x libav/$(TMP_DIST_DIR)/libav/configure
distdir: dist-local
- cp -r $(TMP_DIST_DIR)/libav ${distdir}
+ cp -r libav/$(TMP_DIST_DIR)/libav ${distdir}
cp -f $(top_srcdir)/gst-libs/ext/Makefile.am $(top_srcdir)/gst-libs/ext/Makefile.in ${distdir}
- rm -rf $(TMP_DIST_DIR)
+ rm -rf libav/$(TMP_DIST_DIR)
dist: dist-local
- cd $(TMP_DIST_DIR) && tar -czf libav.tar.gz libav
- mv $(TMP_DIST_DIR)/libav.tar.gz ./
- rm -rf $(TMP_DIST_DIR)
+ cd libav/$(TMP_DIST_DIR) && tar -czf libav.tar.gz libav
+ mv libav/$(TMP_DIST_DIR)/libav.tar.gz ./
+ rm -rf libav/$(TMP_DIST_DIR)
diff --git a/gst-libs/ext/Makefile.in b/gst-libs/ext/Makefile.in
index 8731085..1f36ab0 100644
--- a/gst-libs/ext/Makefile.in
+++ b/gst-libs/ext/Makefile.in
@@ -1,9 +1,8 @@
-# Makefile.in generated by automake 1.11.6 from Makefile.am.
+# Makefile.in generated by automake 1.13.3 from Makefile.am.
# @configure_input@
-# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-# Foundation, Inc.
+# Copyright (C) 1994-2013 Free Software Foundation, Inc.
+
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -25,23 +24,51 @@
# - add an all-local hook so it does get built
# this also satisfies make distcheck
VPATH = @srcdir@
-am__make_dryrun = \
- { \
- am__dry=no; \
+am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
+am__make_running_with_option = \
+ case $${target_option-} in \
+ ?) ;; \
+ *) echo "am__make_running_with_option: internal error: invalid" \
+ "target option '$${target_option-}' specified" >&2; \
+ exit 1;; \
+ esac; \
+ has_opt=no; \
+ sane_makeflags=$$MAKEFLAGS; \
+ if $(am__is_gnu_make); then \
+ sane_makeflags=$$MFLAGS; \
+ else \
case $$MAKEFLAGS in \
*\\[\ \ ]*) \
- echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
- | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
- *) \
- for am__flg in $$MAKEFLAGS; do \
- case $$am__flg in \
- *=*|--*) ;; \
- *n*) am__dry=yes; break;; \
- esac; \
- done;; \
+ bs=\\; \
+ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
+ esac; \
+ fi; \
+ skip_next=no; \
+ strip_trailopt () \
+ { \
+ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+ }; \
+ for flg in $$sane_makeflags; do \
+ test $$skip_next = yes && { skip_next=no; continue; }; \
+ case $$flg in \
+ *=*|--*) continue;; \
+ -*I) strip_trailopt 'I'; skip_next=yes;; \
+ -*I?*) strip_trailopt 'I';; \
+ -*O) strip_trailopt 'O'; skip_next=yes;; \
+ -*O?*) strip_trailopt 'O';; \
+ -*l) strip_trailopt 'l'; skip_next=yes;; \
+ -*l?*) strip_trailopt 'l';; \
+ -[dEDm]) skip_next=yes;; \
+ -[JT]) skip_next=yes;; \
+ esac; \
+ case $$flg in \
+ *$$target_option*) has_opt=yes; break;; \
esac; \
- test $$am__dry = yes; \
- }
+ done; \
+ test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
@@ -62,7 +89,7 @@ build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
subdir = gst-libs/ext
-DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/common/m4/as-ac-expand.m4 \
$(top_srcdir)/common/m4/as-auto-alt.m4 \
@@ -92,21 +119,28 @@ mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
+AM_V_P = $(am__v_P_@AM_V@)
+am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
+am__v_P_0 = false
+am__v_P_1 = :
AM_V_GEN = $(am__v_GEN_@AM_V@)
am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
-am__v_GEN_0 = @echo " GEN " $@;
+am__v_GEN_0 = @echo " GEN " $@;
+am__v_GEN_1 =
AM_V_at = $(am__v_at_@AM_V@)
am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
am__v_at_0 = @
+am__v_at_1 =
SOURCES =
DIST_SOURCES =
-RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
- html-recursive info-recursive install-data-recursive \
- install-dvi-recursive install-exec-recursive \
- install-html-recursive install-info-recursive \
- install-pdf-recursive install-ps-recursive install-recursive \
- installcheck-recursive installdirs-recursive pdf-recursive \
- ps-recursive uninstall-recursive
+RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \
+ ctags-recursive dvi-recursive html-recursive info-recursive \
+ install-data-recursive install-dvi-recursive \
+ install-exec-recursive install-html-recursive \
+ install-info-recursive install-pdf-recursive \
+ install-ps-recursive install-recursive installcheck-recursive \
+ installdirs-recursive pdf-recursive ps-recursive \
+ tags-recursive uninstall-recursive
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
@@ -114,9 +148,29 @@ am__can_run_installinfo = \
esac
RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
distclean-recursive maintainer-clean-recursive
-AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
- $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
+am__recursive_targets = \
+ $(RECURSIVE_TARGETS) \
+ $(RECURSIVE_CLEAN_TARGETS) \
+ $(am__extra_recursive_targets)
+AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \
distdir
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
+# Read a list of newline-separated strings from the standard input,
+# and print each of them once, without duplicates. Input order is
+# *not* preserved.
+am__uniquify_input = $(AWK) '\
+ BEGIN { nonempty = 0; } \
+ { items[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in items) print i; }; } \
+'
+# Make sure the list of sources is unique. This is necessary because,
+# e.g., the same source file might be shared among _SOURCES variables
+# for different programs/libraries.
+am__define_uniq_tagged_files = \
+ list='$(am__tagged_files)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | $(am__uniquify_input)`
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
@@ -158,10 +212,12 @@ AWK = @AWK@
CAT_ENTRY_END = @CAT_ENTRY_END@
CAT_ENTRY_START = @CAT_ENTRY_START@
CC = @CC@
+CCASFLAGS = @CCASFLAGS@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
+CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DARWIN_LDFLAGS = @DARWIN_LDFLAGS@
DEFS = @DEFS@
@@ -177,7 +233,11 @@ ECHO_T = @ECHO_T@
EGREP = @EGREP@
ERROR_CFLAGS = @ERROR_CFLAGS@
EXEEXT = @EXEEXT@
+FFLAGS = @FFLAGS@
FGREP = @FGREP@
+GCOV = @GCOV@
+GCOV_CFLAGS = @GCOV_CFLAGS@
+GCOV_LIBS = @GCOV_LIBS@
GREP = @GREP@
GSTPB_PLUGINS_DIR = @GSTPB_PLUGINS_DIR@
GST_AGE = @GST_AGE@
@@ -210,16 +270,15 @@ GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@
GTKDOC_MKPDF = @GTKDOC_MKPDF@
GTKDOC_REBASE = @GTKDOC_REBASE@
HAVE_BZ2 = @HAVE_BZ2@
-HAVE_DOCBOOK2HTML = @HAVE_DOCBOOK2HTML@
HAVE_DOCBOOK2PS = @HAVE_DOCBOOK2PS@
HAVE_DVIPS = @HAVE_DVIPS@
HAVE_EPSTOPDF = @HAVE_EPSTOPDF@
-HAVE_FIG2DEV = @HAVE_FIG2DEV@
HAVE_JADETEX = @HAVE_JADETEX@
HAVE_PNGTOPNM = @HAVE_PNGTOPNM@
HAVE_PNMTOPS = @HAVE_PNMTOPS@
HAVE_PS2PDF = @HAVE_PS2PDF@
HAVE_XMLLINT = @HAVE_XMLLINT@
+HAVE_XSLTPROC = @HAVE_XSLTPROC@
HTML_DIR = @HTML_DIR@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
@@ -403,22 +462,25 @@ clean-libtool:
-rm -rf .libs _libs
# This directory's subdirectories are mostly independent; you can cd
-# into them and run `make' without going through this Makefile.
-# To change the values of `make' variables: instead of editing Makefiles,
-# (1) if the variable is set in `config.status', edit `config.status'
-# (which will cause the Makefiles to be regenerated when you run `make');
-# (2) otherwise, pass the desired values on the `make' command line.
-$(RECURSIVE_TARGETS):
- @fail= failcom='exit 1'; \
- for f in x $$MAKEFLAGS; do \
- case $$f in \
- *=* | --[!k]*);; \
- *k*) failcom='fail=yes';; \
- esac; \
- done; \
+# into them and run 'make' without going through this Makefile.
+# To change the values of 'make' variables: instead of editing Makefiles,
+# (1) if the variable is set in 'config.status', edit 'config.status'
+# (which will cause the Makefiles to be regenerated when you run 'make');
+# (2) otherwise, pass the desired values on the 'make' command line.
+$(am__recursive_targets):
+ @fail=; \
+ if $(am__make_keepgoing); then \
+ failcom='fail=yes'; \
+ else \
+ failcom='exit 1'; \
+ fi; \
dot_seen=no; \
target=`echo $@ | sed s/-recursive//`; \
- list='$(SUBDIRS)'; for subdir in $$list; do \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ for subdir in $$list; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
dot_seen=yes; \
@@ -433,57 +495,12 @@ $(RECURSIVE_TARGETS):
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
fi; test -z "$$fail"
-$(RECURSIVE_CLEAN_TARGETS):
- @fail= failcom='exit 1'; \
- for f in x $$MAKEFLAGS; do \
- case $$f in \
- *=* | --[!k]*);; \
- *k*) failcom='fail=yes';; \
- esac; \
- done; \
- dot_seen=no; \
- case "$@" in \
- distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
- *) list='$(SUBDIRS)' ;; \
- esac; \
- rev=''; for subdir in $$list; do \
- if test "$$subdir" = "."; then :; else \
- rev="$$subdir $$rev"; \
- fi; \
- done; \
- rev="$$rev ."; \
- target=`echo $@ | sed s/-recursive//`; \
- for subdir in $$rev; do \
- echo "Making $$target in $$subdir"; \
- if test "$$subdir" = "."; then \
- local_target="$$target-am"; \
- else \
- local_target="$$target"; \
- fi; \
- ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
- || eval $$failcom; \
- done && test -z "$$fail"
-tags-recursive:
- list='$(SUBDIRS)'; for subdir in $$list; do \
- test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
- done
-ctags-recursive:
- list='$(SUBDIRS)'; for subdir in $$list; do \
- test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
- done
-
-ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
- list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
- unique=`for i in $$list; do \
- if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
- done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
- mkid -fID $$unique
-tags: TAGS
-
-TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
- $(TAGS_FILES) $(LISP)
+ID: $(am__tagged_files)
+ $(am__define_uniq_tagged_files); mkid -fID $$unique
+tags: tags-recursive
+TAGS: tags
+
+tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
set x; \
here=`pwd`; \
if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
@@ -499,12 +516,7 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
fi; \
done; \
- list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
- unique=`for i in $$list; do \
- if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
- done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
+ $(am__define_uniq_tagged_files); \
shift; \
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
@@ -516,15 +528,11 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$$unique; \
fi; \
fi
-ctags: CTAGS
-CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
- $(TAGS_FILES) $(LISP)
- list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
- unique=`for i in $$list; do \
- if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
- done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
+ctags: ctags-recursive
+
+CTAGS: ctags
+ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+ $(am__define_uniq_tagged_files); \
test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$unique
@@ -533,6 +541,21 @@ GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& $(am__cd) $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here"
+cscopelist: cscopelist-recursive
+
+cscopelist-am: $(am__tagged_files)
+ list='$(am__tagged_files)'; \
+ case "$(srcdir)" in \
+ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+ *) sdir=$(subdir)/$(srcdir) ;; \
+ esac; \
+ for i in $$list; do \
+ if test -f "$$i"; then \
+ echo "$(subdir)/$$i"; \
+ else \
+ echo "$$sdir/$$i"; \
+ fi; \
+ done >> $(top_builddir)/cscope.files
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
@@ -633,22 +656,21 @@ ps-am:
uninstall-am:
-.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \
- install-am install-strip tags-recursive
+.MAKE: $(am__recursive_targets) install-am install-strip
-.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
- all all-am all-local check check-am clean clean-generic \
- clean-libtool clean-local ctags ctags-recursive distclean \
- distclean-generic distclean-libtool distclean-tags distdir dvi \
- dvi-am html html-am info info-am install install-am \
- install-data install-data-am install-dvi install-dvi-am \
- install-exec install-exec-am install-html install-html-am \
- install-info install-info-am install-man install-pdf \
- install-pdf-am install-ps install-ps-am install-strip \
- installcheck installcheck-am installdirs installdirs-am \
- maintainer-clean maintainer-clean-generic mostlyclean \
- mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
- tags tags-recursive uninstall uninstall-am
+.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am all-local \
+ check check-am clean clean-generic clean-libtool clean-local \
+ cscopelist-am ctags ctags-am distclean distclean-generic \
+ distclean-libtool distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-data \
+ install-data-am install-dvi install-dvi-am install-exec \
+ install-exec-am install-html install-html-am install-info \
+ install-info-am install-man install-pdf install-pdf-am \
+ install-ps install-ps-am install-strip installcheck \
+ installcheck-am installdirs installdirs-am maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-generic \
+ mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \
+ uninstall-am
all-local:
@@ -659,7 +681,7 @@ clean-local:
dist-clean:
cd libav && $(MAKE) distclean
- rm -rf $(TMP_DIST_DIR)
+ rm -rf libav/$(TMP_DIST_DIR)
rm -f Makefile
rm -f libav/.version
rm -f libav/.config
@@ -672,22 +694,22 @@ maintainer-clean: distclean
maintainerclean: maintainer-clean
dist-local:
- GIT_DIR=libav/.git git checkout-index --prefix=../$(TMP_DIST_DIR)/libav/ -a
- touch $(TMP_DIST_DIR)/libav/config.mak
+ GIT_DIR=libav/.git git checkout-index --prefix=$(TMP_DIST_DIR)/libav/ -a
+ touch libav/$(TMP_DIST_DIR)/libav/config.mak
echo "Patching libav ./configure"
- sed -e '/Unknown option/ {N;N;s/exit 1//; }' $(TMP_DIST_DIR)/libav/configure > $(TMP_DIST_DIR)/libav/configure.tmp
- mv $(TMP_DIST_DIR)/libav/configure.tmp $(TMP_DIST_DIR)/libav/configure
- chmod +x $(TMP_DIST_DIR)/libav/configure
+ sed -e '/Unknown option/ {N;N;s/exit 1//; }' libav/$(TMP_DIST_DIR)/libav/configure > libav/$(TMP_DIST_DIR)/libav/configure.tmp
+ mv libav/$(TMP_DIST_DIR)/libav/configure.tmp libav/$(TMP_DIST_DIR)/libav/configure
+ chmod +x libav/$(TMP_DIST_DIR)/libav/configure
distdir: dist-local
- cp -r $(TMP_DIST_DIR)/libav ${distdir}
+ cp -r libav/$(TMP_DIST_DIR)/libav ${distdir}
cp -f $(top_srcdir)/gst-libs/ext/Makefile.am $(top_srcdir)/gst-libs/ext/Makefile.in ${distdir}
- rm -rf $(TMP_DIST_DIR)
+ rm -rf libav/$(TMP_DIST_DIR)
dist: dist-local
- cd $(TMP_DIST_DIR) && tar -czf libav.tar.gz libav
- mv $(TMP_DIST_DIR)/libav.tar.gz ./
- rm -rf $(TMP_DIST_DIR)
+ cd libav/$(TMP_DIST_DIR) && tar -czf libav.tar.gz libav
+ mv libav/$(TMP_DIST_DIR)/libav.tar.gz ./
+ rm -rf libav/$(TMP_DIST_DIR)
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
diff --git a/gst-libs/ext/libav/.gitignore b/gst-libs/ext/libav/.gitignore
index 478a1ee..3ed55b3 100644
--- a/gst-libs/ext/libav/.gitignore
+++ b/gst-libs/ext/libav/.gitignore
@@ -1,46 +1,51 @@
-.config
-.version
+*.a
*.o
*.d
+*.def
+*.dll
*.exe
-*.ho
+*.exp
+*.h.c
+*.ilk
+*.lib
+*.pc
+*.pdb
+*.so
+*.so.*
+*.ver
*-example
*-test
-config.*
-doc/*.1
-doc/*.html
-doc/*.pod
-doxy
-ffmpeg
-avconv
-avplay
-avprobe
-avserver
-libavcodec/*_tablegen
-libavcodec/*_tables.c
-libavcodec/*_tables.h
-libavcodec/libavcodec*
-libavdevice/libavdevice*
-libavfilter/libavfilter*
-libavformat/libavformat*
-libavutil/avconfig.h
-libavutil/libavutil*
-libpostproc/libpostproc*
-libswscale/libswscale*
-tests/audiogen
-tests/base64
-tests/data
-tests/rotozoom
-tests/tiny_psnr
-tests/videogen
-tests/vsynth1
-tests/vsynth2
-tools/aviocat
-tools/cws2fws
-tools/graph2dot
-tools/lavfi-showfiltfmts
-tools/pktdumper
-tools/probetest
-tools/qt-faststart
-tools/trasher
-version.h
+/.config
+/.version
+/avconv
+/avplay
+/avprobe
+/avserver
+/config.*
+/version.h
+/doc/*.1
+/doc/*.html
+/doc/*.pod
+/doc/avoptions_codec.texi
+/doc/avoptions_format.texi
+/doc/doxy/html/
+/doc/print_options
+/libavcodec/*_tablegen
+/libavcodec/*_tables.c
+/libavcodec/*_tables.h
+/libavutil/avconfig.h
+/tests/audiogen
+/tests/base64
+/tests/data/
+/tests/rotozoom
+/tests/tiny_psnr
+/tests/videogen
+/tests/vsynth1/
+/tools/aviocat
+/tools/cws2fws
+/tools/graph2dot
+/tools/ismindex
+/tools/pktdumper
+/tools/probetest
+/tools/qt-faststart
+/tools/trasher
diff --git a/gst-libs/ext/libav/COPYING.LGPLv2.1 b/gst-libs/ext/libav/COPYING.LGPLv2.1
index 00b4fed..58af0d3 100644
--- a/gst-libs/ext/libav/COPYING.LGPLv2.1
+++ b/gst-libs/ext/libav/COPYING.LGPLv2.1
@@ -500,5 +500,3 @@ necessary. Here is a sample; alter the names:
Ty Coon, President of Vice
That's all there is to it!
-
-
diff --git a/gst-libs/ext/libav/Changelog b/gst-libs/ext/libav/Changelog
index 2cbf41d..4cd63c8 100644
--- a/gst-libs/ext/libav/Changelog
+++ b/gst-libs/ext/libav/Changelog
@@ -1,190 +1,258 @@
Entries are sorted chronologically from oldest to youngest within each release,
releases are sorted from youngest to oldest.
-
-version 0.8.8:
-
+version 9.8:
- kmvc: Clip pixel position to valid range
-- kmvc: use fixed sized arrays in the context
-- indeo: use a typedef for the mc function pointer
-- lavc: check for overflow in init_get_bits
-- mjpegdec: properly report unsupported disabled features
-- jpegls: return meaningful errors
-- jpegls: factorize return paths
-- jpegls: check the scan offset
-- wavpack: validate samples size parsed in wavpack_decode_block
-- ljpeg: use the correct number of components in yuv
+- kmvc: Use fixed sized arrays in the context
+- indeo: Reject negative array indexes
+- indeo: Check for reference when inheriting motion vectors
+- indeo: Properly forward the error codes
+- mjpeg: Check the unescaped size for overflows
+- wmapro: Error out on impossible scale factor offsets
+- wmapro: Check the min_samples_per_subframe
+- wmapro: Return early on unsupported condition
+- wmapro: Check num_vec_coeffs against the actual available buffer
+- wmapro: Make sure there is room to store the current packet
+- lavc: Move put_bits_left in put_bits.h
+- 4xm: Do not overread the source buffer in decode_p_block
+- 4xm: Check bitstream_size boundary before using it
+
+version 9.7:
+
+Most of the following fixes resulted from test samples that the Google
+Security Team has kindly made available to us:
+
+- 4xm: fix several programming errors to avoid crashes, etc.
+- apetag: use int64_t for filesize
+- jpegls: Fix invalid writes to memory
+- ljpeg: use the correct number of components in YUV
- mjpeg: Validate sampling factors
+- mjpegdec: properly report unsupported disabled features
- mjpegdec: validate parameters in mjpeg_decode_scan_progressive_ac
-- wavpack: check packet size early
-- wavpack: return meaningful errors
-- apetag: use int64_t for filesize
+- mpegvideo: allocate sufficiently large scratch buffer for interlaced vid
+- pixdesc: mark gray8 as pseudopal
+- smacker: fix several programming errors to avoid crashes, etc.
- tiff: do not overread the source buffer
-- Prepare for 0.8.8 Release
-- smacker: fix an off by one in huff.length computation
-- smacker: check the return value of smacker_decode_tree
-- smacker: pad the extradata allocation
-- smacker: check frame size validity
-- vmdav: convert to bytestream2
-- 4xm: don't rely on get_buffer() initializing the frame.
-- 4xm: check the return value of read_huffman_tables().
-- 4xm: use the correct logging context
-- 4xm: reject frames not compatible with the declared version
-- 4xm: check bitstream_size boundary before using it
-- 4xm: do not overread the source buffer in decode_p_block
+- vmd: drop incomplete chunks and spurious samples
+- vmdav: convert to bytestream2 to avoid invalid reads and writes
+- wavpack: check packet size early
+- wavpack: use bytestream2 in wavpack_decode_block
+- wavpack: validate samples size parsed in wavpack_decode_block
+
+
+version 9.6:
+- aac: check the maximum number of channels to avoid invalid writes
+- indeo3: fix off by one in MV validity check
+- id3v2: check for end of file while unescaping tags to avoid invalid
+ writes, reported by Google Security Team
+- afifo: fix request_samples on the last frame in certain cases
+- hls, segment: fix splitting for audio-only streams
+- wav: Always seek to an even offset, Bug #500, LP: #1174737
+- swscale: Use alpha from the right row in yuva2rgba_c, Bug #504
+- indeo3: use unaligned reads on reference blocks, Bug #503
+- oma: properly forward errors in oma_read_packet
+- af_asyncts: fix offset calculation
+- proresdec: support mixed interlaced/non-interlaced content
+version 9.5:
-version 0.8.7:
+Most of the following fixes resulted from test samples that the Google
+Security Team has kindly made available to us:
+- af_channelmap: sanity check input channel indices in all cases
- avfiltergraph: check for sws opts being non-NULL before using them
- bmv: check for len being valid in bmv_decode_frame()
+- configure: Enable hwaccels without external dependencies by default
- dfa: check for invalid access in decode_wdlt()
+- id3v2: pad the APIC packets as required by lavc
- indeo3: check motion vectors
- indeo3: fix data size check
- indeo3: switch parsing the header to bytestream2
-- lavf: make sure stream probe data gets freed.
+- lavf: make sure stream probe data gets freed
+- matroska: Update the available size after lace parsing
+- matroska: fix a corner case in ebml-lace parsing
+- matroska: pass the lace size to the matroska_parse_rm_audio
+- mp3dec: fallback to generic seeking when a TOC is not present
- oggdec: fix faulty cleanup prototype
- oma: Validate sample rates
- qdm2: check that the FFT size is a power of 2
+- riff: check for eof if chunk size and code are 0 to prevent an infinite loop
- rv10: check that extradata is large enough
+- svq1dec: check that the reference frame has the same dimensions as the current one
+- svq1dec: clip motion vectors to the frame size
- xmv: check audio track parameters validity
- xmv: do not leak memory in the error paths in xmv_read_header()
-- aac: check the maximum number of channels
-- indeo3: fix off by one in MV validity check, Bug #503
-- id3v2: check for end of file while unescaping tags
-- wav: Always seek to an even offset, Bug #500, LP: #1174737
-- proresdec: support mixed interlaced/non-interlaced content
-version 0.8.6:
-- Build system fixes: Fix Altivec detection (Debian Bug#701710) and fix
- CAF demuxer dependencies
-- Various minor documentation fixes
+version 9.4:
- atrac3: avoid oversized shifting in decode_bytes()
-- dsputil: fix invalid array indexing
-- flacdec: simplify bounds checking in flac_probe() to avoid undefined behavior.
-- h264: check for luma and chroma bit depth being equal (CVE-2013-2277)
+- eamad: allocate a dummy reference frame when the real one is missing
+- ffv1: fix calculating slice dimensions for version 2
+- flacdec: simplify bounds checking in flac_probe()
+- h264: check for luma and chroma bit dept being equal (CVE-2013-2277)
+- hqdn3d: Fix out of array read in LOWPASS
- iff: validate CMAP palette size (CVE-2013-2495)
-- indeo3: initialise pixel planes on allocation
- ivi_common: do not call MC for intra frames when dc_transform is unset
-- lavf: fix arithmetic overflows in avformat_seek_file()
+- libmp3lame: use the correct remaining buffer size when flushing
- lzo: fix overflow checking in copy_backptr()
-- matroskadec: request a read buffer for the wav header
-- mp3: exit on parsing error in mp_decode_frame
-- msrledec: convert to bytestream2 API and add proper bounds checking (CVE-2013-2496)
-- oggdec: make sure the private parse data is cleaned up
-- parser: fix large overreads
-- png: use av_mallocz_array() for the zlib zalloc function, avoids accessing uninitialized memory
-- pthread: set the frame properties from the thread context, not user
+- mp3dec: Fix VBR bit rate parsing
+- png: use av_mallocz_array() for the zlib zalloc function
- roqvideodec: fix a potential infinite loop in roqvideo_decode_frame()
-- update year to 2013
-- various potentially security relevant fixes to the shorten decoder
+- shorten: fix various programming mistakes
+- vf_gradfun: fix uninitialized variable use
+- vf_hqdn3d: fix uninitialized variable use
- vmdaudio: fix invalid reads when packet size is not a multiple of chunk size
-- vorbisdec: Error on bark_map_size equal to 0 (CVE-2013-0894)
- wmadec: require block_align to be set
-- wmaprodec: require block_align to be set, avoids infinite loop
+- wmaprodec: require block_align to be set
- wmaprodec: return an error, not 0, when the input is too small
- xxan: fix invalid memory access in xan_decode_frame_type0()
-
-version 0.8.5:
-
-- Several bugs and crashes have been fixed in the following codecs:
- Indeo 4 (CVE-2012-2791), VP5/VP6 (CVE-2012-2783), Indeo 3 (CVE-2012-2804),
- MPEG-1/2 (CVE-2012-2803), MP3 (CVE-2012-2797), AAC (CVE-2012-5144),
- AC-3 (CVE-2012-2802), AVS (CVE-2012-2801), DFA (CVE-2012-2798)
-
-- backported hardening patches for h264 and svq3
-
-- smaller bug fixes in id3v2 (Bug 395), RTSP, option handling, ALAC,
- Flash Screen Video
-
-- unconditionally enable PIC on PowerPC
-
-- x86: Require an assembler able to cope with AVX instructions
-
-- fix a serious memory leak on broken Ogg files
-
-
-version 0.8.4:
-
-- Several bugs and crashes have been fixed in the following codecs:
- h264 (Bug 118), vc1dec (CVE-2012-2796), sipr, bmpdec (bug 367), alsdec
- (CVE-2012-2775), rv34/rv40 (CVE-2012-2772), indeo3/indeo4
- (CVE-2012-2776, CVE-2012-2779, CVE-2012-2787, CVE-2012-2794,
- CVE-2012-2800), vorbisenc, vorbisdec (Bug 277), snow, ac3dec
- (CVE-2012-2802), avsdec (CVE-2012-2801), dfa (CVE-2012-2786,
- CVE-2012-2798), lagrith (CVE-2012-2793), wmaprodec (CVE-2012-2789 &
- Bug 327), avidec (CVE-2012-2788, CVE-2012-2790), cavsdec
- (CVE-2012-2777, CVE-2012-2784), wav (Bug 379), yuff4mpeg (Bug 373),
- mpegaudio, tiffenc, smacker (Bug 265).
-
-- smaller bug fixes in avconv (Bug 352)
-
-- fix lt() and lte() in function evaluator
-
-- fix segfault in avformat_open_input()
-
-- fix segfault in golomb decoder (bug 310)
-
-- fix segfault (double free) in libavfilter
-
-- convert dfa decoder to bytestream2 API to protect from overreads
-
-- bugfix in vf_pad/scale filter (Bug 203 & 245)
-
-- lavc: remove stats_out and stats_in from the options table. (Bug 380)
-
-
-version 0.8.3:
-
-- Several bugs and crashes have been fixed in the following codecs: PNG,
- Electronic Arts TQI, H.264 (CVE-2012-0851) and H.263 (CVE-2011-3937)
-
-
-version 0.8.2:
-
-- Several bugs and crashes have been fixed in the following codecs: AAC,
- APE, H.263, H.264, Indeo 4, Mimic, MJPEG, Motion Pixels Video, RAW,
- TTA, VC1, VQA, WMA Voice, vqavideo (CVE-2012-0947).
-
-- Several bugs and crashes have been fixed in the following formats:
- ASF, ID3v2, MOV, xWMA
-
-- This release additionally updates the following codecs to the
- bytestream2 API, and therefore benefit from additional overflow
- checks: truemotion2, utvideo, vqavideo
-
-
-version 0.8.1:
-
-- Several bugs and crashes have been fixed in the following codecs: AAC,
- AC-3, ADPCM, AMR (both NB and WB), ATRAC3, CAVC, Cook, camstudio, DCA,
- DPCM, DSI CIN, DV, EA TGQ, FLAC, fraps, G.722 (both encoder and
- decoder), H.264, huvffyuv, BB JV decoder, Indeo 3, KGV1, LCL, the
- libx264 wrapper, MJPEG, mp3on4, Musepack, MPEG1/2, PNG, QDM2, Qt RLE,
- ROQ, RV10, RV30/RV34/RV40, shorten, smacker, subrip, SVQ3, TIFF,
- Truemotion2, TTA, VC1, VMware Screen codec, Vorbis, VP5, VP6, WMA,
- Westwood SNDx, XXAN.
-
-- This release additionally updates the following codecs to the
- bytestream2 API, and therefore benefit from additional overflow
- checks: XXAN, ALG MM, TQG, SMC, Qt SMC, ROQ, PNG
-
-- Several bugs and crashes have been fixed in the following formats:
- AIFF, ASF, DV, Matroska, NSV, MOV, MPEG-TS, Smacker, Sony OpenMG, RM,
- SWF.
-
-- Libswscale has an potential overflow for large image size fixed.
-
-- The following APIs have been added:
-
- avcodec_is_open()
- avformat_get_riff_video_tags()
- avformat_get_riff_audio_tags()
-
- Please see the file doc/APIchanges and the Doxygen documentation for
- further information.
+version 9.3:
+- h264: fix deadlocks with broken/fuzzed files
+- flvdec: make decoder more robust
+- vorbisdec: fix buffer overflow (CVE-2013-0894)
+- ac3dec: validate channel output mode against channel count
+- doc: minor improvements
+
+version 9.2:
+- loco: check that there is data left after decoding a plane.
+- mov: use the format context for logging.
+- lagarith: avoid infinite loop in lag_rac_refill() with corrupted files
+- flicvideo: avoid an infinite loop in byte run compression
+- av_memcpy_backptr: avoid an infinite loop for back = 0
+- mlpdec: do not try to allocate a zero-sized output buffer.
+- qtrle: add more checks against pixel_ptr being negative.
+- 4xm: check the return value of read_huffman_tables().
+- cavs: initialize various context tables, avoids crashes with corrupted files
+- x86/H.264: Don't use redzone in AVX h264_deblock on Win64
+- VQA video: check chunk sizes before reading chunks
+- RoQ video decoder: check dimensions validity
+- QDM2: check array index before use, fix out of array accesses
+- mpegvideo: Do REBASE_PICTURE with byte pointers
+- SVQ3: unbreak decoding
+- libopencore-amrwb: Make AMR-WB ifdeffery more precise
+- libopencore-amr: Conditionally compile decoder and encoder bits
+- arm: Fall back to runtime cpu feature detection via /proc/cpuinfo
+- xxan: properly handle odd heights
+- msrledec: check bounds before constructing a possibly invalid pointer (CVE-2496)
+- qtrle: fix the topmost line for 1bit
+- aasc: fix output for msrle compression
+- yop: check for input overreads
+- yop: check that extradata is large enough
+- fraps: fix off-by one bug for version 1
+- vf_delogo: fix copying the input frame
+- vf_delogo: fix an uninitialized read
+- dnxhdenc: fix invalid reads in dnxhd_mb_var_thread()
+- ATRAC3: use correct loop variable in add_tonal_components()
+- MLP: store the channel layout for each substream
+- MLP decoder: TrueHD: use Libav channel order
+- x86: ac3: Fix HAVE_MMXEXT condition to only refer to external assembly
+- arm: vp8: Fix the plain-armv6 version of vp8_luma_dc_wht
+- lavr: call mix_function_init() in ff_audio_mix_set_matrix()
+- rtpenc_chain: Use the original AVFormatContext for getting payload type
+- rtp: Make sure the output format pointer is set
+- rtp: Make sure priv_data is set before reading it
+- videodsp_armv5te: remove #if HAVE_ARMV5TE_EXTERNAL
+- get_bits: change the failure condition in init_get_bits
+- mpegvideo: fix loop condition in draw_line()
+- fate: update ref after rv30_loop_filter fix
+- RV30: fix masking in rv30_loop_filter()
+- libcdio: support recent cdio-paranoia
+- Theora: Skip zero-sized headers
+- H.264: add 3 pixels below for subpixel filter wait position
+- H.264: fix ff_generate_sliding_window_mmcos() prototype
+- H.264: don't clobber mmco opcode tables for non-first slice headers
+- libx264: use the library specific default rc_initial_buffer_occupancy
+- lavc: set the default rc_initial_buffer_occupancy
+- lavc: introduce the convenience function init_get_bits8
+- lavc: check for overflow in init_get_bits
+- configure: enable pic for shared libs on AArch64
+- zmbv: Reset the decoder on keyframe errors
+- VC1 decoder: prevent a crash due missing pred_flag parameter
+- matroska: Fix use after free
+- VP3: Fix double free in vp3_decode_end()
+
+
+version 9.1:
+- Fix a crash on windows platforms related to automatic stack alignment
+ in libavresample
+- Fix memleaks in the Ogg demuxer. Related to CVE-2012-2882
+
+
+version 9:
+- av_basename and av_dirname
+- adobe and limelight publisher authentication in RTMP
+
+
+version 9_beta3:
+- ashowinfo audio filter
+- 24-bit FLAC encoding
+- audio volume filter
+- deprecated the avconv -vol option. the volume filter is to be used instead.
+- multi-channel ALAC encoding up to 7.1
+- TAK demuxer, parser, and decoder
+- adaptive frame-level multithreading for H.264
+
+
+version 9_beta2:
+- metadata (INFO tag) support in WAV muxer
+- support for building DLLs using MSVC
+- remove avserver daemon mode
+- support building on the Plan 9 operating system
+- ffv1: support version 1.3
+
+
+version 9_beta1:
+
+- XWD encoder and decoder
+- Support for fragmentation in the mov/mp4 muxer
+- ISMV (Smooth Streaming) muxer
+- CDXL demuxer and decoder
+- Apple ProRes encoder
+- Sun Rasterfile Encoder
+- remove libpostproc
+- ID3v2 attached pictures reading and writing
+- WMA Lossless decoder
+- XBM encoder
+- RealAudio Lossless decoder
+- ZeroCodec decoder
+- drop support for avconv without libavfilter
+- add libavresample audio conversion library
+- audio filters support in libavfilter and avconv
+- add fps filter
+- audio split filter
+- audio mix filter
+- avprobe output is now standard INI or JSON. The old format can still
+ be used with -of old.
+- Indeo Audio decoder
+- channelsplit audio filter
+- RTMPT protocol support
+- iLBC encoding/decoding via libilbc
+- Microsoft Screen 1 decoder
+- join audio filter
+- audio channel mapping filter
+- Microsoft ATC Screen decoder
+- RTSP listen mode
+- TechSmith Screen Codec 2 decoder
+- AAC encoding via libfdk-aac
+- Microsoft Expression Encoder Screen decoder
+- RTMPS protocol support
+- RTMPTS protocol support
+- JPEG 2000 encoding support through OpenJPEG
+- G.723.1 demuxer and decoder
+- RTMPE protocol support
+- RTMPTE protocol support
+- Canopus Lossless Codec decoder
+- avconv -shortest option is now per-output file,
+ -pass and -passlogfile are now per-output stream
+- Ut Video encoder
+- Microsoft Screen 2 decoder
+- RTP depacketization of JPEG
+- Smooth Streaming live segmenter muxer
+- RTP packetization of JPEG
+- Opus decoder and encoder using libopus
+- remove -same_quant, it hasn't worked for years
+- support for building with MSVC
version 0.8:
diff --git a/gst-libs/ext/libav/Doxyfile b/gst-libs/ext/libav/Doxyfile
deleted file mode 100644
index 457cf51..0000000
--- a/gst-libs/ext/libav/Doxyfile
+++ /dev/null
@@ -1,1647 +0,0 @@
-# Doxyfile 1.7.1
-
-# This file describes the settings to be used by the documentation system
-# doxygen (www.doxygen.org) for a project
-#
-# All text after a hash (#) is considered a comment and will be ignored
-# The format is:
-# TAG = value [value, ...]
-# For lists items can also be appended using:
-# TAG += value [value, ...]
-# Values that contain spaces should be placed between quotes (" ")
-
-#---------------------------------------------------------------------------
-# Project related configuration options
-#---------------------------------------------------------------------------
-
-# This tag specifies the encoding used for all characters in the config file
-# that follow. The default is UTF-8 which is also the encoding used for all
-# text before the first occurrence of this tag. Doxygen uses libiconv (or the
-# iconv built into libc) for the transcoding. See
-# http://www.gnu.org/software/libiconv for the list of possible encodings.
-
-DOXYFILE_ENCODING = UTF-8
-
-# The PROJECT_NAME tag is a single word (or a sequence of words surrounded
-# by quotes) that should identify the project.
-
-PROJECT_NAME = Libav
-
-# The PROJECT_NUMBER tag can be used to enter a project or revision number.
-# This could be handy for archiving the generated documentation or
-# if some version control system is used.
-
-PROJECT_NUMBER =
-
-# With the PROJECT_LOGO tag one can specify an logo or icon that is included
-# in the documentation. The maximum height of the logo should not exceed 55
-# pixels and the maximum width should not exceed 200 pixels. Doxygen will
-# copy the logo to the output directory.
-PROJECT_LOGO =
-
-# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
-# base path where the generated documentation will be put.
-# If a relative path is entered, it will be relative to the location
-# where doxygen was started. If left blank the current directory will be used.
-
-OUTPUT_DIRECTORY = doxy
-
-# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create
-# 4096 sub-directories (in 2 levels) under the output directory of each output
-# format and will distribute the generated files over these directories.
-# Enabling this option can be useful when feeding doxygen a huge amount of
-# source files, where putting all generated files in the same directory would
-# otherwise cause performance problems for the file system.
-
-CREATE_SUBDIRS = NO
-
-# The OUTPUT_LANGUAGE tag is used to specify the language in which all
-# documentation generated by doxygen is written. Doxygen will use this
-# information to generate all constant output in the proper language.
-# The default language is English, other supported languages are:
-# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional,
-# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German,
-# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English
-# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian,
-# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrilic, Slovak,
-# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese.
-
-OUTPUT_LANGUAGE = English
-
-# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
-# include brief member descriptions after the members that are listed in
-# the file and class documentation (similar to JavaDoc).
-# Set to NO to disable this.
-
-BRIEF_MEMBER_DESC = YES
-
-# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend
-# the brief description of a member or function before the detailed description.
-# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
-# brief descriptions will be completely suppressed.
-
-REPEAT_BRIEF = YES
-
-# This tag implements a quasi-intelligent brief description abbreviator
-# that is used to form the text in various listings. Each string
-# in this list, if found as the leading text of the brief description, will be
-# stripped from the text and the result after processing the whole list, is
-# used as the annotated text. Otherwise, the brief description is used as-is.
-# If left blank, the following values are used ("$name" is automatically
-# replaced with the name of the entity): "The $name class" "The $name widget"
-# "The $name file" "is" "provides" "specifies" "contains"
-# "represents" "a" "an" "the"
-
-ABBREVIATE_BRIEF =
-
-# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
-# Doxygen will generate a detailed section even if there is only a brief
-# description.
-
-ALWAYS_DETAILED_SEC = NO
-
-# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
-# inherited members of a class in the documentation of that class as if those
-# members were ordinary class members. Constructors, destructors and assignment
-# operators of the base classes will not be shown.
-
-INLINE_INHERITED_MEMB = NO
-
-# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full
-# path before files name in the file list and in the header files. If set
-# to NO the shortest path that makes the file name unique will be used.
-
-FULL_PATH_NAMES = YES
-
-# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag
-# can be used to strip a user-defined part of the path. Stripping is
-# only done if one of the specified strings matches the left-hand part of
-# the path. The tag can be used to show relative paths in the file list.
-# If left blank the directory from which doxygen is run is used as the
-# path to strip.
-
-STRIP_FROM_PATH = .
-
-# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of
-# the path mentioned in the documentation of a class, which tells
-# the reader which header file to include in order to use a class.
-# If left blank only the name of the header file containing the class
-# definition is used. Otherwise one should specify the include paths that
-# are normally passed to the compiler using the -I flag.
-
-STRIP_FROM_INC_PATH =
-
-# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter
-# (but less readable) file names. This can be useful is your file systems
-# doesn't support long names like on DOS, Mac, or CD-ROM.
-
-SHORT_NAMES = NO
-
-# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen
-# will interpret the first line (until the first dot) of a JavaDoc-style
-# comment as the brief description. If set to NO, the JavaDoc
-# comments will behave just like regular Qt-style comments
-# (thus requiring an explicit @brief command for a brief description.)
-
-JAVADOC_AUTOBRIEF = YES
-
-# If the QT_AUTOBRIEF tag is set to YES then Doxygen will
-# interpret the first line (until the first dot) of a Qt-style
-# comment as the brief description. If set to NO, the comments
-# will behave just like regular Qt-style comments (thus requiring
-# an explicit \brief command for a brief description.)
-
-QT_AUTOBRIEF = NO
-
-# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen
-# treat a multi-line C++ special comment block (i.e. a block of //! or ///
-# comments) as a brief description. This used to be the default behaviour.
-# The new default is to treat a multi-line C++ comment block as a detailed
-# description. Set this tag to YES if you prefer the old behaviour instead.
-
-MULTILINE_CPP_IS_BRIEF = NO
-
-# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented
-# member inherits the documentation from any documented member that it
-# re-implements.
-
-INHERIT_DOCS = YES
-
-# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce
-# a new page for each member. If set to NO, the documentation of a member will
-# be part of the file/class/namespace that contains it.
-
-SEPARATE_MEMBER_PAGES = NO
-
-# The TAB_SIZE tag can be used to set the number of spaces in a tab.
-# Doxygen uses this value to replace tabs by spaces in code fragments.
-
-TAB_SIZE = 8
-
-# This tag can be used to specify a number of aliases that acts
-# as commands in the documentation. An alias has the form "name=value".
-# For example adding "sideeffect=\par Side Effects:\n" will allow you to
-# put the command \sideeffect (or @sideeffect) in the documentation, which
-# will result in a user-defined paragraph with heading "Side Effects:".
-# You can put \n's in the value part of an alias to insert newlines.
-
-ALIASES =
-
-# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C
-# sources only. Doxygen will then generate output that is more tailored for C.
-# For instance, some of the names that are used will be different. The list
-# of all members will be omitted, etc.
-
-OPTIMIZE_OUTPUT_FOR_C = YES
-
-# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java
-# sources only. Doxygen will then generate output that is more tailored for
-# Java. For instance, namespaces will be presented as packages, qualified
-# scopes will look different, etc.
-
-OPTIMIZE_OUTPUT_JAVA = NO
-
-# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran
-# sources only. Doxygen will then generate output that is more tailored for
-# Fortran.
-
-OPTIMIZE_FOR_FORTRAN = NO
-
-# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL
-# sources. Doxygen will then generate output that is tailored for
-# VHDL.
-
-OPTIMIZE_OUTPUT_VHDL = NO
-
-# Doxygen selects the parser to use depending on the extension of the files it
-# parses. With this tag you can assign which parser to use for a given extension.
-# Doxygen has a built-in mapping, but you can override or extend it using this
-# tag. The format is ext=language, where ext is a file extension, and language
-# is one of the parsers supported by doxygen: IDL, Java, Javascript, CSharp, C,
-# C++, D, PHP, Objective-C, Python, Fortran, VHDL, C, C++. For instance to make
-# doxygen treat .inc files as Fortran files (default is PHP), and .f files as C
-# (default is Fortran), use: inc=Fortran f=C. Note that for custom extensions
-# you also need to set FILE_PATTERNS otherwise the files are not read by doxygen.
-
-EXTENSION_MAPPING =
-
-# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
-# to include (a tag file for) the STL sources as input, then you should
-# set this tag to YES in order to let doxygen match functions declarations and
-# definitions whose arguments contain STL classes (e.g. func(std::string); v.s.
-# func(std::string) {}). This also make the inheritance and collaboration
-# diagrams that involve STL classes more complete and accurate.
-
-BUILTIN_STL_SUPPORT = NO
-
-# If you use Microsoft's C++/CLI language, you should set this option to YES to
-# enable parsing support.
-
-CPP_CLI_SUPPORT = NO
-
-# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only.
-# Doxygen will parse them like normal C++ but will assume all classes use public
-# instead of private inheritance when no explicit protection keyword is present.
-
-SIP_SUPPORT = NO
-
-# For Microsoft's IDL there are propget and propput attributes to indicate getter
-# and setter methods for a property. Setting this option to YES (the default)
-# will make doxygen to replace the get and set methods by a property in the
-# documentation. This will only work if the methods are indeed getting or
-# setting a simple type. If this is not the case, or you want to show the
-# methods anyway, you should set this option to NO.
-
-IDL_PROPERTY_SUPPORT = YES
-
-# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
-# tag is set to YES, then doxygen will reuse the documentation of the first
-# member in the group (if any) for the other members of the group. By default
-# all members of a group must be documented explicitly.
-
-DISTRIBUTE_GROUP_DOC = NO
-
-# Set the SUBGROUPING tag to YES (the default) to allow class member groups of
-# the same type (for instance a group of public functions) to be put as a
-# subgroup of that type (e.g. under the Public Functions section). Set it to
-# NO to prevent subgrouping. Alternatively, this can be done per class using
-# the \nosubgrouping command.
-
-SUBGROUPING = YES
-
-# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum
-# is documented as struct, union, or enum with the name of the typedef. So
-# typedef struct TypeS {} TypeT, will appear in the documentation as a struct
-# with name TypeT. When disabled the typedef will appear as a member of a file,
-# namespace, or class. And the struct will be named TypeS. This can typically
-# be useful for C code in case the coding convention dictates that all compound
-# types are typedef'ed and only the typedef is referenced, never the tag name.
-
-TYPEDEF_HIDES_STRUCT = NO
-
-# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to
-# determine which symbols to keep in memory and which to flush to disk.
-# When the cache is full, less often used symbols will be written to disk.
-# For small to medium size projects (<1000 input files) the default value is
-# probably good enough. For larger projects a too small cache size can cause
-# doxygen to be busy swapping symbols to and from disk most of the time
-# causing a significant performance penality.
-# If the system has enough physical memory increasing the cache will improve the
-# performance by keeping more symbols in memory. Note that the value works on
-# a logarithmic scale so increasing the size by one will rougly double the
-# memory usage. The cache size is given by this formula:
-# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0,
-# corresponding to a cache size of 2^16 = 65536 symbols
-
-SYMBOL_CACHE_SIZE = 0
-
-#---------------------------------------------------------------------------
-# Build related configuration options
-#---------------------------------------------------------------------------
-
-# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
-# documentation are documented, even if no documentation was available.
-# Private class members and static file members will be hidden unless
-# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
-
-EXTRACT_ALL = YES
-
-# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
-# will be included in the documentation.
-
-EXTRACT_PRIVATE = YES
-
-# If the EXTRACT_STATIC tag is set to YES all static members of a file
-# will be included in the documentation.
-
-EXTRACT_STATIC = YES
-
-# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
-# defined locally in source files will be included in the documentation.
-# If set to NO only classes defined in header files are included.
-
-EXTRACT_LOCAL_CLASSES = YES
-
-# This flag is only useful for Objective-C code. When set to YES local
-# methods, which are defined in the implementation section but not in
-# the interface are included in the documentation.
-# If set to NO (the default) only methods in the interface are included.
-
-EXTRACT_LOCAL_METHODS = NO
-
-# If this flag is set to YES, the members of anonymous namespaces will be
-# extracted and appear in the documentation as a namespace called
-# 'anonymous_namespace{file}', where file will be replaced with the base
-# name of the file that contains the anonymous namespace. By default
-# anonymous namespace are hidden.
-
-EXTRACT_ANON_NSPACES = NO
-
-# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
-# undocumented members of documented classes, files or namespaces.
-# If set to NO (the default) these members will be included in the
-# various overviews, but no documentation section is generated.
-# This option has no effect if EXTRACT_ALL is enabled.
-
-HIDE_UNDOC_MEMBERS = NO
-
-# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
-# undocumented classes that are normally visible in the class hierarchy.
-# If set to NO (the default) these classes will be included in the various
-# overviews. This option has no effect if EXTRACT_ALL is enabled.
-
-HIDE_UNDOC_CLASSES = NO
-
-# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all
-# friend (class|struct|union) declarations.
-# If set to NO (the default) these declarations will be included in the
-# documentation.
-
-HIDE_FRIEND_COMPOUNDS = NO
-
-# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any
-# documentation blocks found inside the body of a function.
-# If set to NO (the default) these blocks will be appended to the
-# function's detailed documentation block.
-
-HIDE_IN_BODY_DOCS = NO
-
-# The INTERNAL_DOCS tag determines if documentation
-# that is typed after a \internal command is included. If the tag is set
-# to NO (the default) then the documentation will be excluded.
-# Set it to YES to include the internal documentation.
-
-INTERNAL_DOCS = NO
-
-# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate
-# file names in lower-case letters. If set to YES upper-case letters are also
-# allowed. This is useful if you have classes or files whose names only differ
-# in case and if your file system supports case sensitive file names. Windows
-# and Mac users are advised to set this option to NO.
-
-CASE_SENSE_NAMES = YES
-
-# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen
-# will show members with their full class and namespace scopes in the
-# documentation. If set to YES the scope will be hidden.
-
-HIDE_SCOPE_NAMES = NO
-
-# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen
-# will put a list of the files that are included by a file in the documentation
-# of that file.
-
-SHOW_INCLUDE_FILES = YES
-
-# If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen
-# will list include files with double quotes in the documentation
-# rather than with sharp brackets.
-
-FORCE_LOCAL_INCLUDES = NO
-
-# If the INLINE_INFO tag is set to YES (the default) then a tag [inline]
-# is inserted in the documentation for inline members.
-
-INLINE_INFO = YES
-
-# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen
-# will sort the (detailed) documentation of file and class members
-# alphabetically by member name. If set to NO the members will appear in
-# declaration order.
-
-SORT_MEMBER_DOCS = YES
-
-# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the
-# brief documentation of file, namespace and class members alphabetically
-# by member name. If set to NO (the default) the members will appear in
-# declaration order.
-
-SORT_BRIEF_DOCS = NO
-
-# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen
-# will sort the (brief and detailed) documentation of class members so that
-# constructors and destructors are listed first. If set to NO (the default)
-# the constructors will appear in the respective orders defined by
-# SORT_MEMBER_DOCS and SORT_BRIEF_DOCS.
-# This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO
-# and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO.
-
-SORT_MEMBERS_CTORS_1ST = NO
-
-# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the
-# hierarchy of group names into alphabetical order. If set to NO (the default)
-# the group names will appear in their defined order.
-
-SORT_GROUP_NAMES = NO
-
-# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be
-# sorted by fully-qualified names, including namespaces. If set to
-# NO (the default), the class list will be sorted only by class name,
-# not including the namespace part.
-# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
-# Note: This option applies only to the class list, not to the
-# alphabetical list.
-
-SORT_BY_SCOPE_NAME = NO
-
-# The GENERATE_TODOLIST tag can be used to enable (YES) or
-# disable (NO) the todo list. This list is created by putting \todo
-# commands in the documentation.
-
-GENERATE_TODOLIST = YES
-
-# The GENERATE_TESTLIST tag can be used to enable (YES) or
-# disable (NO) the test list. This list is created by putting \test
-# commands in the documentation.
-
-GENERATE_TESTLIST = YES
-
-# The GENERATE_BUGLIST tag can be used to enable (YES) or
-# disable (NO) the bug list. This list is created by putting \bug
-# commands in the documentation.
-
-GENERATE_BUGLIST = YES
-
-# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or
-# disable (NO) the deprecated list. This list is created by putting
-# \deprecated commands in the documentation.
-
-GENERATE_DEPRECATEDLIST= YES
-
-# The ENABLED_SECTIONS tag can be used to enable conditional
-# documentation sections, marked by \if sectionname ... \endif.
-
-ENABLED_SECTIONS =
-
-# The MAX_INITIALIZER_LINES tag determines the maximum number of lines
-# the initial value of a variable or define consists of for it to appear in
-# the documentation. If the initializer consists of more lines than specified
-# here it will be hidden. Use a value of 0 to hide initializers completely.
-# The appearance of the initializer of individual variables and defines in the
-# documentation can be controlled using \showinitializer or \hideinitializer
-# command in the documentation regardless of this setting.
-
-MAX_INITIALIZER_LINES = 30
-
-# Set the SHOW_USED_FILES tag to NO to disable the list of files generated
-# at the bottom of the documentation of classes and structs. If set to YES the
-# list will mention the files that were used to generate the documentation.
-
-SHOW_USED_FILES = YES
-
-# If the sources in your project are distributed over multiple directories
-# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy
-# in the documentation. The default is NO.
-
-SHOW_DIRECTORIES = NO
-
-# Set the SHOW_FILES tag to NO to disable the generation of the Files page.
-# This will remove the Files entry from the Quick Index and from the
-# Folder Tree View (if specified). The default is YES.
-
-SHOW_FILES = YES
-
-# Set the SHOW_NAMESPACES tag to NO to disable the generation of the
-# Namespaces page.
-# This will remove the Namespaces entry from the Quick Index
-# and from the Folder Tree View (if specified). The default is YES.
-
-SHOW_NAMESPACES = YES
-
-# The FILE_VERSION_FILTER tag can be used to specify a program or script that
-# doxygen should invoke to get the current version for each file (typically from
-# the version control system). Doxygen will invoke the program by executing (via
-# popen()) the command <command> <input-file>, where <command> is the value of
-# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file
-# provided by doxygen. Whatever the program writes to standard output
-# is used as the file version. See the manual for examples.
-
-FILE_VERSION_FILTER =
-
-# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed
-# by doxygen. The layout file controls the global structure of the generated
-# output files in an output format independent way. The create the layout file
-# that represents doxygen's defaults, run doxygen with the -l option.
-# You can optionally specify a file name after the option, if omitted
-# DoxygenLayout.xml will be used as the name of the layout file.
-
-LAYOUT_FILE =
-
-#---------------------------------------------------------------------------
-# configuration options related to warning and progress messages
-#---------------------------------------------------------------------------
-
-# The QUIET tag can be used to turn on/off the messages that are generated
-# by doxygen. Possible values are YES and NO. If left blank NO is used.
-
-QUIET = YES
-
-# The WARNINGS tag can be used to turn on/off the warning messages that are
-# generated by doxygen. Possible values are YES and NO. If left blank
-# NO is used.
-
-WARNINGS = YES
-
-# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings
-# for undocumented members. If EXTRACT_ALL is set to YES then this flag will
-# automatically be disabled.
-
-WARN_IF_UNDOCUMENTED = YES
-
-# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for
-# potential errors in the documentation, such as not documenting some
-# parameters in a documented function, or documenting parameters that
-# don't exist or using markup commands wrongly.
-
-WARN_IF_DOC_ERROR = YES
-
-# This WARN_NO_PARAMDOC option can be abled to get warnings for
-# functions that are documented, but have no documentation for their parameters
-# or return value. If set to NO (the default) doxygen will only warn about
-# wrong or incomplete parameter documentation, but not about the absence of
-# documentation.
-
-WARN_NO_PARAMDOC = NO
-
-# The WARN_FORMAT tag determines the format of the warning messages that
-# doxygen can produce. The string should contain the $file, $line, and $text
-# tags, which will be replaced by the file and line number from which the
-# warning originated and the warning text. Optionally the format may contain
-# $version, which will be replaced by the version of the file (if it could
-# be obtained via FILE_VERSION_FILTER)
-
-WARN_FORMAT = "$file:$line: $text"
-
-# The WARN_LOGFILE tag can be used to specify a file to which warning
-# and error messages should be written. If left blank the output is written
-# to stderr.
-
-WARN_LOGFILE =
-
-#---------------------------------------------------------------------------
-# configuration options related to the input files
-#---------------------------------------------------------------------------
-
-# The INPUT tag can be used to specify the files and/or directories that contain
-# documented source files. You may enter file names like "myfile.cpp" or
-# directories like "/usr/src/myproject". Separate the files or directories
-# with spaces.
-
-INPUT =
-
-# This tag can be used to specify the character encoding of the source files
-# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
-# also the default input encoding. Doxygen uses libiconv (or the iconv built
-# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for
-# the list of possible encodings.
-
-INPUT_ENCODING = UTF-8
-
-# If the value of the INPUT tag contains directories, you can use the
-# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
-# and *.h) to filter out the source-files in the directories. If left
-# blank the following patterns are tested:
-# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx
-# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90
-
-FILE_PATTERNS =
-
-# The RECURSIVE tag can be used to turn specify whether or not subdirectories
-# should be searched for input files as well. Possible values are YES and NO.
-# If left blank NO is used.
-
-RECURSIVE = YES
-
-# The EXCLUDE tag can be used to specify files and/or directories that should
-# excluded from the INPUT source files. This way you can easily exclude a
-# subdirectory from a directory tree whose root is specified with the INPUT tag.
-
-EXCLUDE =
-
-# The EXCLUDE_SYMLINKS tag can be used select whether or not files or
-# directories that are symbolic links (a Unix filesystem feature) are excluded
-# from the input.
-
-EXCLUDE_SYMLINKS = NO
-
-# If the value of the INPUT tag contains directories, you can use the
-# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
-# certain files from those directories. Note that the wildcards are matched
-# against the file with absolute path, so to exclude all test directories
-# for example use the pattern */test/*
-
-EXCLUDE_PATTERNS = *.git \
- *.d
-
-# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
-# (namespaces, classes, functions, etc.) that should be excluded from the
-# output. The symbol name can be a fully qualified name, a word, or if the
-# wildcard * is used, a substring. Examples: ANamespace, AClass,
-# AClass::ANamespace, ANamespace::*Test
-
-EXCLUDE_SYMBOLS =
-
-# The EXAMPLE_PATH tag can be used to specify one or more files or
-# directories that contain example code fragments that are included (see
-# the \include command).
-
-EXAMPLE_PATH = libavcodec/ \
- libavformat/
-
-# If the value of the EXAMPLE_PATH tag contains directories, you can use the
-# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
-# and *.h) to filter out the source-files in the directories. If left
-# blank all files are included.
-
-EXAMPLE_PATTERNS = *-example.c
-
-# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
-# searched for input files to be used with the \include or \dontinclude
-# commands irrespective of the value of the RECURSIVE tag.
-# Possible values are YES and NO. If left blank NO is used.
-
-EXAMPLE_RECURSIVE = NO
-
-# The IMAGE_PATH tag can be used to specify one or more files or
-# directories that contain image that are included in the documentation (see
-# the \image command).
-
-IMAGE_PATH =
-
-# The INPUT_FILTER tag can be used to specify a program that doxygen should
-# invoke to filter for each input file. Doxygen will invoke the filter program
-# by executing (via popen()) the command <filter> <input-file>, where <filter>
-# is the value of the INPUT_FILTER tag, and <input-file> is the name of an
-# input file. Doxygen will then use the output that the filter program writes
-# to standard output.
-# If FILTER_PATTERNS is specified, this tag will be
-# ignored.
-
-INPUT_FILTER =
-
-# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
-# basis.
-# Doxygen will compare the file name with each pattern and apply the
-# filter if there is a match.
-# The filters are a list of the form:
-# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further
-# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER
-# is applied to all files.
-
-FILTER_PATTERNS =
-
-# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
-# INPUT_FILTER) will be used to filter the input files when producing source
-# files to browse (i.e. when SOURCE_BROWSER is set to YES).
-
-FILTER_SOURCE_FILES = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to source browsing
-#---------------------------------------------------------------------------
-
-# If the SOURCE_BROWSER tag is set to YES then a list of source files will
-# be generated. Documented entities will be cross-referenced with these sources.
-# Note: To get rid of all source code in the generated output, make sure also
-# VERBATIM_HEADERS is set to NO.
-
-SOURCE_BROWSER = YES
-
-# Setting the INLINE_SOURCES tag to YES will include the body
-# of functions and classes directly in the documentation.
-
-INLINE_SOURCES = NO
-
-# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct
-# doxygen to hide any special comment blocks from generated source code
-# fragments. Normal C and C++ comments will always remain visible.
-
-STRIP_CODE_COMMENTS = YES
-
-# If the REFERENCED_BY_RELATION tag is set to YES
-# then for each documented function all documented
-# functions referencing it will be listed.
-
-REFERENCED_BY_RELATION = YES
-
-# If the REFERENCES_RELATION tag is set to YES
-# then for each documented function all documented entities
-# called/used by that function will be listed.
-
-REFERENCES_RELATION = NO
-
-# If the REFERENCES_LINK_SOURCE tag is set to YES (the default)
-# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from
-# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will
-# link to the source code.
-# Otherwise they will link to the documentation.
-
-REFERENCES_LINK_SOURCE = YES
-
-# If the USE_HTAGS tag is set to YES then the references to source code
-# will point to the HTML generated by the htags(1) tool instead of doxygen
-# built-in source browser. The htags tool is part of GNU's global source
-# tagging system (see http://www.gnu.org/software/global/global.html). You
-# will need version 4.8.6 or higher.
-
-USE_HTAGS = NO
-
-# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen
-# will generate a verbatim copy of the header file for each class for
-# which an include is specified. Set to NO to disable this.
-
-VERBATIM_HEADERS = YES
-
-#---------------------------------------------------------------------------
-# configuration options related to the alphabetical class index
-#---------------------------------------------------------------------------
-
-# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index
-# of all compounds will be generated. Enable this if the project
-# contains a lot of classes, structs, unions or interfaces.
-
-ALPHABETICAL_INDEX = YES
-
-# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then
-# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns
-# in which this list will be split (can be a number in the range [1..20])
-
-COLS_IN_ALPHA_INDEX = 2
-
-# In case all classes in a project start with a common prefix, all
-# classes will be put under the same header in the alphabetical index.
-# The IGNORE_PREFIX tag can be used to specify one or more prefixes that
-# should be ignored while generating the index headers.
-
-IGNORE_PREFIX =
-
-#---------------------------------------------------------------------------
-# configuration options related to the HTML output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_HTML tag is set to YES (the default) Doxygen will
-# generate HTML output.
-
-GENERATE_HTML = YES
-
-# The HTML_OUTPUT tag is used to specify where the HTML docs will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `html' will be used as the default path.
-
-HTML_OUTPUT = html
-
-# The HTML_FILE_EXTENSION tag can be used to specify the file extension for
-# each generated HTML page (for example: .htm,.php,.asp). If it is left blank
-# doxygen will generate files with .html extension.
-
-HTML_FILE_EXTENSION = .html
-
-# The HTML_HEADER tag can be used to specify a personal HTML header for
-# each generated HTML page. If it is left blank doxygen will generate a
-# standard header.
-
-HTML_HEADER = doc/doxy/header.html
-
-# The HTML_FOOTER tag can be used to specify a personal HTML footer for
-# each generated HTML page. If it is left blank doxygen will generate a
-# standard footer.
-
-HTML_FOOTER = doc/doxy/footer.html
-
-# The HTML_STYLESHEET tag can be used to specify a user-defined cascading
-# style sheet that is used by each HTML page. It can be used to
-# fine-tune the look of the HTML output. If the tag is left blank doxygen
-# will generate a default style sheet. Note that doxygen will try to copy
-# the style sheet file to the HTML output directory, so don't put your own
-# stylesheet in the HTML output directory as well, or it will be erased!
-
-HTML_STYLESHEET = doc/doxy/doxy_stylesheet.css
-
-# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output.
-# Doxygen will adjust the colors in the stylesheet and background images
-# according to this color. Hue is specified as an angle on a colorwheel,
-# see http://en.wikipedia.org/wiki/Hue for more information.
-# For instance the value 0 represents red, 60 is yellow, 120 is green,
-# 180 is cyan, 240 is blue, 300 purple, and 360 is red again.
-# The allowed range is 0 to 359.
-
-HTML_COLORSTYLE_HUE = 120
-
-# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of
-# the colors in the HTML output. For a value of 0 the output will use
-# grayscales only. A value of 255 will produce the most vivid colors.
-
-HTML_COLORSTYLE_SAT = 100
-
-# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to
-# the luminance component of the colors in the HTML output. Values below
-# 100 gradually make the output lighter, whereas values above 100 make
-# the output darker. The value divided by 100 is the actual gamma applied,
-# so 80 represents a gamma of 0.8, The value 220 represents a gamma of 2.2,
-# and 100 does not change the gamma.
-
-HTML_COLORSTYLE_GAMMA = 80
-
-# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML
-# page will contain the date and time when the page was generated. Setting
-# this to NO can help when comparing the output of multiple runs.
-
-HTML_TIMESTAMP = YES
-
-# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes,
-# files or namespaces will be aligned in HTML using tables. If set to
-# NO a bullet list will be used.
-
-HTML_ALIGN_MEMBERS = YES
-
-# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
-# documentation will contain sections that can be hidden and shown after the
-# page has loaded. For this to work a browser that supports
-# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox
-# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari).
-
-HTML_DYNAMIC_SECTIONS = NO
-
-# If the GENERATE_DOCSET tag is set to YES, additional index files
-# will be generated that can be used as input for Apple's Xcode 3
-# integrated development environment, introduced with OS X 10.5 (Leopard).
-# To create a documentation set, doxygen will generate a Makefile in the
-# HTML output directory. Running make will produce the docset in that
-# directory and running "make install" will install the docset in
-# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find
-# it at startup.
-# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html
-# for more information.
-
-GENERATE_DOCSET = NO
-
-# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the
-# feed. A documentation feed provides an umbrella under which multiple
-# documentation sets from a single provider (such as a company or product suite)
-# can be grouped.
-
-DOCSET_FEEDNAME = "Doxygen generated docs"
-
-# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that
-# should uniquely identify the documentation set bundle. This should be a
-# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen
-# will append .docset to the name.
-
-DOCSET_BUNDLE_ID = org.doxygen.Project
-
-# When GENERATE_PUBLISHER_ID tag specifies a string that should uniquely identify
-# the documentation publisher. This should be a reverse domain-name style
-# string, e.g. com.mycompany.MyDocSet.documentation.
-
-DOCSET_PUBLISHER_ID = org.doxygen.Publisher
-
-# The GENERATE_PUBLISHER_NAME tag identifies the documentation publisher.
-
-DOCSET_PUBLISHER_NAME = Publisher
-
-# If the GENERATE_HTMLHELP tag is set to YES, additional index files
-# will be generated that can be used as input for tools like the
-# Microsoft HTML help workshop to generate a compiled HTML help file (.chm)
-# of the generated HTML documentation.
-
-GENERATE_HTMLHELP = NO
-
-# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can
-# be used to specify the file name of the resulting .chm file. You
-# can add a path in front of the file if the result should not be
-# written to the html output directory.
-
-CHM_FILE =
-
-# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can
-# be used to specify the location (absolute path including file name) of
-# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run
-# the HTML help compiler on the generated index.hhp.
-
-HHC_LOCATION =
-
-# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag
-# controls if a separate .chi index file is generated (YES) or that
-# it should be included in the master .chm file (NO).
-
-GENERATE_CHI = NO
-
-# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING
-# is used to encode HtmlHelp index (hhk), content (hhc) and project file
-# content.
-
-CHM_INDEX_ENCODING =
-
-# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag
-# controls whether a binary table of contents is generated (YES) or a
-# normal table of contents (NO) in the .chm file.
-
-BINARY_TOC = NO
-
-# The TOC_EXPAND flag can be set to YES to add extra items for group members
-# to the contents of the HTML help documentation and to the tree view.
-
-TOC_EXPAND = NO
-
-# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and
-# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated
-# that can be used as input for Qt's qhelpgenerator to generate a
-# Qt Compressed Help (.qch) of the generated HTML documentation.
-
-GENERATE_QHP = NO
-
-# If the QHG_LOCATION tag is specified, the QCH_FILE tag can
-# be used to specify the file name of the resulting .qch file.
-# The path specified is relative to the HTML output folder.
-
-QCH_FILE =
-
-# The QHP_NAMESPACE tag specifies the namespace to use when generating
-# Qt Help Project output. For more information please see
-# http://doc.trolltech.com/qthelpproject.html#namespace
-
-QHP_NAMESPACE = org.doxygen.Project
-
-# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating
-# Qt Help Project output. For more information please see
-# http://doc.trolltech.com/qthelpproject.html#virtual-folders
-
-QHP_VIRTUAL_FOLDER = doc
-
-# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to
-# add. For more information please see
-# http://doc.trolltech.com/qthelpproject.html#custom-filters
-
-QHP_CUST_FILTER_NAME =
-
-# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the
-# custom filter to add. For more information please see
-# <a href="http://doc.trolltech.com/qthelpproject.html#custom-filters">
-# Qt Help Project / Custom Filters</a>.
-
-QHP_CUST_FILTER_ATTRS =
-
-# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this
-# project's
-# filter section matches.
-# <a href="http://doc.trolltech.com/qthelpproject.html#filter-attributes">
-# Qt Help Project / Filter Attributes</a>.
-
-QHP_SECT_FILTER_ATTRS =
-
-# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can
-# be used to specify the location of Qt's qhelpgenerator.
-# If non-empty doxygen will try to run qhelpgenerator on the generated
-# .qhp file.
-
-QHG_LOCATION =
-
-# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files
-# will be generated, which together with the HTML files, form an Eclipse help
-# plugin. To install this plugin and make it available under the help contents
-# menu in Eclipse, the contents of the directory containing the HTML and XML
-# files needs to be copied into the plugins directory of eclipse. The name of
-# the directory within the plugins directory should be the same as
-# the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before
-# the help appears.
-
-GENERATE_ECLIPSEHELP = NO
-
-# A unique identifier for the eclipse help plugin. When installing the plugin
-# the directory name containing the HTML and XML files should also have
-# this name.
-
-ECLIPSE_DOC_ID = org.doxygen.Project
-
-# The DISABLE_INDEX tag can be used to turn on/off the condensed index at
-# top of each HTML page. The value NO (the default) enables the index and
-# the value YES disables it.
-
-DISABLE_INDEX = NO
-
-# This tag can be used to set the number of enum values (range [1..20])
-# that doxygen will group on one line in the generated HTML documentation.
-
-ENUM_VALUES_PER_LINE = 4
-
-# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
-# structure should be generated to display hierarchical information.
-# If the tag value is set to YES, a side panel will be generated
-# containing a tree-like index structure (just like the one that
-# is generated for HTML Help). For this to work a browser that supports
-# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser).
-# Windows users are probably better off using the HTML help feature.
-
-GENERATE_TREEVIEW = NO
-
-# By enabling USE_INLINE_TREES, doxygen will generate the Groups, Directories,
-# and Class Hierarchy pages using a tree view instead of an ordered list.
-
-USE_INLINE_TREES = NO
-
-# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be
-# used to set the initial width (in pixels) of the frame in which the tree
-# is shown.
-
-TREEVIEW_WIDTH = 250
-
-# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open
-# links to external symbols imported via tag files in a separate window.
-
-EXT_LINKS_IN_WINDOW = NO
-
-# Use this tag to change the font size of Latex formulas included
-# as images in the HTML documentation. The default is 10. Note that
-# when you change the font size after a successful doxygen run you need
-# to manually remove any form_*.png images from the HTML output directory
-# to force them to be regenerated.
-
-FORMULA_FONTSIZE = 10
-
-# Use the FORMULA_TRANPARENT tag to determine whether or not the images
-# generated for formulas are transparent PNGs. Transparent PNGs are
-# not supported properly for IE 6.0, but are supported on all modern browsers.
-# Note that when changing this option you need to delete any form_*.png files
-# in the HTML output before the changes have effect.
-
-FORMULA_TRANSPARENT = YES
-
-# When the SEARCHENGINE tag is enabled doxygen will generate a search box
-# for the HTML output. The underlying search engine uses javascript
-# and DHTML and should work on any modern browser. Note that when using
-# HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets
-# (GENERATE_DOCSET) there is already a search function so this one should
-# typically be disabled. For large projects the javascript based search engine
-# can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution.
-
-SEARCHENGINE = NO
-
-# When the SERVER_BASED_SEARCH tag is enabled the search engine will be
-# implemented using a PHP enabled web server instead of at the web client
-# using Javascript. Doxygen will generate the search PHP script and index
-# file to put on the web server. The advantage of the server
-# based approach is that it scales better to large projects and allows
-# full text search. The disadvances is that it is more difficult to setup
-# and does not have live searching capabilities.
-
-SERVER_BASED_SEARCH = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the LaTeX output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
-# generate Latex output.
-
-GENERATE_LATEX = NO
-
-# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `latex' will be used as the default path.
-
-LATEX_OUTPUT = latex
-
-# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
-# invoked. If left blank `latex' will be used as the default command name.
-# Note that when enabling USE_PDFLATEX this option is only used for
-# generating bitmaps for formulas in the HTML output, but not in the
-# Makefile that is written to the output directory.
-
-LATEX_CMD_NAME = latex
-
-# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to
-# generate index for LaTeX. If left blank `makeindex' will be used as the
-# default command name.
-
-MAKEINDEX_CMD_NAME = makeindex
-
-# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact
-# LaTeX documents. This may be useful for small projects and may help to
-# save some trees in general.
-
-COMPACT_LATEX = NO
-
-# The PAPER_TYPE tag can be used to set the paper type that is used
-# by the printer. Possible values are: a4, a4wide, letter, legal and
-# executive. If left blank a4wide will be used.
-
-PAPER_TYPE = a4wide
-
-# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX
-# packages that should be included in the LaTeX output.
-
-EXTRA_PACKAGES =
-
-# The LATEX_HEADER tag can be used to specify a personal LaTeX header for
-# the generated latex document. The header should contain everything until
-# the first chapter. If it is left blank doxygen will generate a
-# standard header. Notice: only use this tag if you know what you are doing!
-
-LATEX_HEADER =
-
-# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated
-# is prepared for conversion to pdf (using ps2pdf). The pdf file will
-# contain links (just like the HTML output) instead of page references
-# This makes the output suitable for online browsing using a pdf viewer.
-
-PDF_HYPERLINKS = NO
-
-# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of
-# plain latex in the generated Makefile. Set this option to YES to get a
-# higher quality PDF documentation.
-
-USE_PDFLATEX = NO
-
-# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode.
-# command to the generated LaTeX files. This will instruct LaTeX to keep
-# running if errors occur, instead of asking the user for help.
-# This option is also used when generating formulas in HTML.
-
-LATEX_BATCHMODE = NO
-
-# If LATEX_HIDE_INDICES is set to YES then doxygen will not
-# include the index chapters (such as File Index, Compound Index, etc.)
-# in the output.
-
-LATEX_HIDE_INDICES = NO
-
-# If LATEX_SOURCE_CODE is set to YES then doxygen will include
-# source code with syntax highlighting in the LaTeX output.
-# Note that which sources are shown also depends on other settings
-# such as SOURCE_BROWSER.
-
-LATEX_SOURCE_CODE = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the RTF output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output
-# The RTF output is optimized for Word 97 and may not look very pretty with
-# other RTF readers or editors.
-
-GENERATE_RTF = NO
-
-# The RTF_OUTPUT tag is used to specify where the RTF docs will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `rtf' will be used as the default path.
-
-RTF_OUTPUT = rtf
-
-# If the COMPACT_RTF tag is set to YES Doxygen generates more compact
-# RTF documents. This may be useful for small projects and may help to
-# save some trees in general.
-
-COMPACT_RTF = NO
-
-# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated
-# will contain hyperlink fields. The RTF file will
-# contain links (just like the HTML output) instead of page references.
-# This makes the output suitable for online browsing using WORD or other
-# programs which support those fields.
-# Note: wordpad (write) and others do not support links.
-
-RTF_HYPERLINKS = NO
-
-# Load stylesheet definitions from file. Syntax is similar to doxygen's
-# config file, i.e. a series of assignments. You only have to provide
-# replacements, missing definitions are set to their default value.
-
-RTF_STYLESHEET_FILE =
-
-# Set optional variables used in the generation of an rtf document.
-# Syntax is similar to doxygen's config file.
-
-RTF_EXTENSIONS_FILE =
-
-#---------------------------------------------------------------------------
-# configuration options related to the man page output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_MAN tag is set to YES (the default) Doxygen will
-# generate man pages
-
-GENERATE_MAN = NO
-
-# The MAN_OUTPUT tag is used to specify where the man pages will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `man' will be used as the default path.
-
-MAN_OUTPUT = man
-
-# The MAN_EXTENSION tag determines the extension that is added to
-# the generated man pages (default is the subroutine's section .3)
-
-MAN_EXTENSION = .3
-
-# If the MAN_LINKS tag is set to YES and Doxygen generates man output,
-# then it will generate one additional man file for each entity
-# documented in the real man page(s). These additional files
-# only source the real man page, but without them the man command
-# would be unable to find the correct page. The default is NO.
-
-MAN_LINKS = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the XML output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_XML tag is set to YES Doxygen will
-# generate an XML file that captures the structure of
-# the code including all documentation.
-
-GENERATE_XML = NO
-
-# The XML_OUTPUT tag is used to specify where the XML pages will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `xml' will be used as the default path.
-
-XML_OUTPUT = xml
-
-# The XML_SCHEMA tag can be used to specify an XML schema,
-# which can be used by a validating XML parser to check the
-# syntax of the XML files.
-
-XML_SCHEMA =
-
-# The XML_DTD tag can be used to specify an XML DTD,
-# which can be used by a validating XML parser to check the
-# syntax of the XML files.
-
-XML_DTD =
-
-# If the XML_PROGRAMLISTING tag is set to YES Doxygen will
-# dump the program listings (including syntax highlighting
-# and cross-referencing information) to the XML output. Note that
-# enabling this will significantly increase the size of the XML output.
-
-XML_PROGRAMLISTING = YES
-
-#---------------------------------------------------------------------------
-# configuration options for the AutoGen Definitions output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will
-# generate an AutoGen Definitions (see autogen.sf.net) file
-# that captures the structure of the code including all
-# documentation. Note that this feature is still experimental
-# and incomplete at the moment.
-
-GENERATE_AUTOGEN_DEF = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the Perl module output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_PERLMOD tag is set to YES Doxygen will
-# generate a Perl module file that captures the structure of
-# the code including all documentation. Note that this
-# feature is still experimental and incomplete at the
-# moment.
-
-GENERATE_PERLMOD = NO
-
-# If the PERLMOD_LATEX tag is set to YES Doxygen will generate
-# the necessary Makefile rules, Perl scripts and LaTeX code to be able
-# to generate PDF and DVI output from the Perl module output.
-
-PERLMOD_LATEX = NO
-
-# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be
-# nicely formatted so it can be parsed by a human reader.
-# This is useful
-# if you want to understand what is going on.
-# On the other hand, if this
-# tag is set to NO the size of the Perl module output will be much smaller
-# and Perl will parse it just the same.
-
-PERLMOD_PRETTY = YES
-
-# The names of the make variables in the generated doxyrules.make file
-# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX.
-# This is useful so different doxyrules.make files included by the same
-# Makefile don't overwrite each other's variables.
-
-PERLMOD_MAKEVAR_PREFIX =
-
-#---------------------------------------------------------------------------
-# Configuration options related to the preprocessor
-#---------------------------------------------------------------------------
-
-# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will
-# evaluate all C-preprocessor directives found in the sources and include
-# files.
-
-ENABLE_PREPROCESSING = YES
-
-# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro
-# names in the source code. If set to NO (the default) only conditional
-# compilation will be performed. Macro expansion can be done in a controlled
-# way by setting EXPAND_ONLY_PREDEF to YES.
-
-MACRO_EXPANSION = YES
-
-# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
-# then the macro expansion is limited to the macros specified with the
-# PREDEFINED and EXPAND_AS_DEFINED tags.
-
-EXPAND_ONLY_PREDEF = YES
-
-# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
-# in the INCLUDE_PATH (see below) will be search if a #include is found.
-
-SEARCH_INCLUDES = YES
-
-# The INCLUDE_PATH tag can be used to specify one or more directories that
-# contain include files that are not input files but should be processed by
-# the preprocessor.
-
-INCLUDE_PATH =
-
-# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
-# patterns (like *.h and *.hpp) to filter out the header-files in the
-# directories. If left blank, the patterns specified with FILE_PATTERNS will
-# be used.
-
-INCLUDE_FILE_PATTERNS =
-
-# The PREDEFINED tag can be used to specify one or more macro names that
-# are defined before the preprocessor is started (similar to the -D option of
-# gcc). The argument of the tag is a list of macros of the form: name
-# or name=definition (no spaces). If the definition and the = are
-# omitted =1 is assumed. To prevent a macro definition from being
-# undefined via #undef or recursively expanded use the := operator
-# instead of the = operator.
-
-PREDEFINED = "__attribute__(x)=" \
- "RENAME(x)=x ## _TMPL" \
- "DEF(x)=x ## _TMPL" \
- HAVE_AV_CONFIG_H \
- HAVE_MMX \
- HAVE_MMX2 \
- HAVE_AMD3DNOW \
- "DECLARE_ALIGNED(a,t,n)=t n" \
- "offsetof(x,y)=0x42"
-
-# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
-# this tag can be used to specify a list of macro names that should be expanded.
-# The macro definition that is found in the sources will be used.
-# Use the PREDEFINED tag if you want to use a different macro definition.
-
-EXPAND_AS_DEFINED = declare_idct \
- READ_PAR_DATA \
-
-# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then
-# doxygen's preprocessor will remove all function-like macros that are alone
-# on a line, have an all uppercase name, and do not end with a semicolon. Such
-# function macros are typically used for boiler-plate code, and will confuse
-# the parser if not removed.
-
-SKIP_FUNCTION_MACROS = YES
-
-#---------------------------------------------------------------------------
-# Configuration::additions related to external references
-#---------------------------------------------------------------------------
-
-# The TAGFILES option can be used to specify one or more tagfiles.
-# Optionally an initial location of the external documentation
-# can be added for each tagfile. The format of a tag file without
-# this location is as follows:
-#
-# TAGFILES = file1 file2 ...
-# Adding location for the tag files is done as follows:
-#
-# TAGFILES = file1=loc1 "file2 = loc2" ...
-# where "loc1" and "loc2" can be relative or absolute paths or
-# URLs. If a location is present for each tag, the installdox tool
-# does not have to be run to correct the links.
-# Note that each tag file must have a unique name
-# (where the name does NOT include the path)
-# If a tag file is not located in the directory in which doxygen
-# is run, you must also specify the path to the tagfile here.
-
-TAGFILES =
-
-# When a file name is specified after GENERATE_TAGFILE, doxygen will create
-# a tag file that is based on the input files it reads.
-
-GENERATE_TAGFILE =
-
-# If the ALLEXTERNALS tag is set to YES all external classes will be listed
-# in the class index. If set to NO only the inherited external classes
-# will be listed.
-
-ALLEXTERNALS = NO
-
-# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed
-# in the modules index. If set to NO, only the current project's groups will
-# be listed.
-
-EXTERNAL_GROUPS = YES
-
-# The PERL_PATH should be the absolute path and name of the perl script
-# interpreter (i.e. the result of `which perl').
-
-PERL_PATH = /usr/bin/perl
-
-#---------------------------------------------------------------------------
-# Configuration options related to the dot tool
-#---------------------------------------------------------------------------
-
-# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will
-# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base
-# or super classes. Setting the tag to NO turns the diagrams off. Note that
-# this option is superseded by the HAVE_DOT option below. This is only a
-# fallback. It is recommended to install and use dot, since it yields more
-# powerful graphs.
-
-CLASS_DIAGRAMS = YES
-
-# You can define message sequence charts within doxygen comments using the \msc
-# command. Doxygen will then run the mscgen tool (see
-# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the
-# documentation. The MSCGEN_PATH tag allows you to specify the directory where
-# the mscgen tool resides. If left empty the tool is assumed to be found in the
-# default search path.
-
-MSCGEN_PATH =
-
-# If set to YES, the inheritance and collaboration graphs will hide
-# inheritance and usage relations if the target is undocumented
-# or is not a class.
-
-HIDE_UNDOC_RELATIONS = YES
-
-# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
-# available from the path. This tool is part of Graphviz, a graph visualization
-# toolkit from AT&T and Lucent Bell Labs. The other options in this section
-# have no effect if this option is set to NO (the default)
-
-HAVE_DOT = NO
-
-# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is
-# allowed to run in parallel. When set to 0 (the default) doxygen will
-# base this on the number of processors available in the system. You can set it
-# explicitly to a value larger than 0 to get control over the balance
-# between CPU load and processing speed.
-
-DOT_NUM_THREADS = 0
-
-# By default doxygen will write a font called FreeSans.ttf to the output
-# directory and reference it in all dot files that doxygen generates. This
-# font does not include all possible unicode characters however, so when you need
-# these (or just want a differently looking font) you can specify the font name
-# using DOT_FONTNAME. You need need to make sure dot is able to find the font,
-# which can be done by putting it in a standard location or by setting the
-# DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory
-# containing the font.
-
-DOT_FONTNAME = FreeSans
-
-# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs.
-# The default size is 10pt.
-
-DOT_FONTSIZE = 10
-
-# By default doxygen will tell dot to use the output directory to look for the
-# FreeSans.ttf font (which doxygen will put there itself). If you specify a
-# different font using DOT_FONTNAME you can set the path where dot
-# can find it using this tag.
-
-DOT_FONTPATH =
-
-# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen
-# will generate a graph for each documented class showing the direct and
-# indirect inheritance relations. Setting this tag to YES will force the
-# the CLASS_DIAGRAMS tag to NO.
-
-CLASS_GRAPH = YES
-
-# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen
-# will generate a graph for each documented class showing the direct and
-# indirect implementation dependencies (inheritance, containment, and
-# class references variables) of the class with other documented classes.
-
-COLLABORATION_GRAPH = YES
-
-# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen
-# will generate a graph for groups, showing the direct groups dependencies
-
-GROUP_GRAPHS = YES
-
-# If the UML_LOOK tag is set to YES doxygen will generate inheritance and
-# collaboration diagrams in a style similar to the OMG's Unified Modeling
-# Language.
-
-UML_LOOK = NO
-
-# If set to YES, the inheritance and collaboration graphs will show the
-# relations between templates and their instances.
-
-TEMPLATE_RELATIONS = YES
-
-# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT
-# tags are set to YES then doxygen will generate a graph for each documented
-# file showing the direct and indirect include dependencies of the file with
-# other documented files.
-
-INCLUDE_GRAPH = YES
-
-# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and
-# HAVE_DOT tags are set to YES then doxygen will generate a graph for each
-# documented header file showing the documented files that directly or
-# indirectly include this file.
-
-INCLUDED_BY_GRAPH = YES
-
-# If the CALL_GRAPH and HAVE_DOT options are set to YES then
-# doxygen will generate a call dependency graph for every global function
-# or class method. Note that enabling this option will significantly increase
-# the time of a run. So in most cases it will be better to enable call graphs
-# for selected functions only using the \callgraph command.
-
-CALL_GRAPH = NO
-
-# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then
-# doxygen will generate a caller dependency graph for every global function
-# or class method. Note that enabling this option will significantly increase
-# the time of a run. So in most cases it will be better to enable caller
-# graphs for selected functions only using the \callergraph command.
-
-CALLER_GRAPH = NO
-
-# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
-# will graphical hierarchy of all classes instead of a textual one.
-
-GRAPHICAL_HIERARCHY = YES
-
-# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES
-# then doxygen will show the dependencies a directory has on other directories
-# in a graphical way. The dependency relations are determined by the #include
-# relations between the files in the directories.
-
-DIRECTORY_GRAPH = YES
-
-# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
-# generated by dot. Possible values are png, jpg, or gif
-# If left blank png will be used.
-
-DOT_IMAGE_FORMAT = png
-
-# The tag DOT_PATH can be used to specify the path where the dot tool can be
-# found. If left blank, it is assumed the dot tool can be found in the path.
-
-DOT_PATH =
-
-# The DOTFILE_DIRS tag can be used to specify one or more directories that
-# contain dot files that are included in the documentation (see the
-# \dotfile command).
-
-DOTFILE_DIRS =
-
-# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of
-# nodes that will be shown in the graph. If the number of nodes in a graph
-# becomes larger than this value, doxygen will truncate the graph, which is
-# visualized by representing a node as a red box. Note that doxygen if the
-# number of direct children of the root node in a graph is already larger than
-# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note
-# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
-
-DOT_GRAPH_MAX_NODES = 50
-
-# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the
-# graphs generated by dot. A depth value of 3 means that only nodes reachable
-# from the root by following a path via at most 3 edges will be shown. Nodes
-# that lay further from the root node will be omitted. Note that setting this
-# option to 1 or 2 may greatly reduce the computation time needed for large
-# code bases. Also note that the size of a graph can be further restricted by
-# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
-
-MAX_DOT_GRAPH_DEPTH = 0
-
-# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
-# background. This is disabled by default, because dot on Windows does not
-# seem to support this out of the box. Warning: Depending on the platform used,
-# enabling this option may lead to badly anti-aliased labels on the edges of
-# a graph (i.e. they become hard to read).
-
-DOT_TRANSPARENT = YES
-
-# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output
-# files in one run (i.e. multiple -o and -T options on the command line). This
-# makes dot run faster, but since only newer versions of dot (>1.8.10)
-# support this, this feature is disabled by default.
-
-DOT_MULTI_TARGETS = NO
-
-# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will
-# generate a legend page explaining the meaning of the various boxes and
-# arrows in the dot generated graphs.
-
-GENERATE_LEGEND = YES
-
-# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will
-# remove the intermediate dot files that are used to generate
-# the various graphs.
-
-DOT_CLEANUP = YES
diff --git a/gst-libs/ext/libav/LICENSE b/gst-libs/ext/libav/LICENSE
index 725995d..1266627 100644
--- a/gst-libs/ext/libav/LICENSE
+++ b/gst-libs/ext/libav/LICENSE
@@ -1,5 +1,5 @@
Libav:
-------
+======
Most files in Libav are under the GNU Lesser General Public License version 2.1
or later (LGPL v2.1+). Read the file COPYING.LGPLv2.1 for details. Some other
@@ -13,15 +13,24 @@ configure to activate them. In this case, Libav's license changes to GPL v2+.
Specifically, the GPL parts of Libav are
-- libpostproc
-- optional x86 optimizations in the files
- libavcodec/x86/idct_mmx.c
- the X11 grabber in libavdevice/x11grab.c
+- the texi2pod.pl tool
+- the following filters in libavfilter:
+ - vf_blackframe.c
+ - vf_boxblur.c
+ - vf_cropdetect.c
+ - vf_delogo.c
+ - vf_hqdn3d.c
+ - vf_yadif.c
There are a handful of files under other licensing terms, namely:
-* The files libavcodec/jfdctfst.c, libavcodec/jfdctint.c, libavcodec/jrevdct.c
- are taken from libjpeg, see the top of the files for licensing details.
+* The files libavcodec/jfdctfst.c, libavcodec/jfdctint_template.c and
+ libavcodec/jrevdct.c are taken from libjpeg, see the top of the files for
+ licensing details. Specifically note that you must credit the IJG in the
+ documentation accompanying your program if you only distribute executables.
+ You must also indicate any changes including additions and deletions to
+ those three files in the documentation.
Should you, for whatever reason, prefer to use version 3 of the (L)GPL, then
the configure parameter --enable-version3 will activate this licensing option
@@ -29,18 +38,29 @@ for you. Read the file COPYING.LGPLv3 or, if you have enabled GPL parts,
COPYING.GPLv3 to learn the exact legal terms that apply in this case.
-external libraries:
--------------------
+external libraries
+==================
-Some external libraries, e.g. libx264, are under GPL and can be used in
-conjunction with Libav. They require --enable-gpl to be passed to configure
-as well.
+Libav can be combined with a number of external libraries, which sometimes
+affect the licensing of binaries resulting from the combination.
-The OpenCORE external libraries are under the Apache License 2.0. That license
-is incompatible with the LGPL v2.1 and the GPL v2, but not with version 3 of
-those licenses. So to combine the OpenCORE libraries with Libav, the license
-version needs to be upgraded by passing --enable-version3 to configure.
+compatible libraries
+--------------------
-The nonfree external library libfaac can be hooked up in Libav. You need to
-pass --enable-nonfree to configure to enable it. Employ this option with care
-as Libav then becomes nonfree and unredistributable.
+The libcdio, libx264, libxavs and libxvid libraries are under GPL. When
+combining them with Libav, Libav needs to be licensed as GPL as well by
+passing --enable-gpl to configure.
+
+The OpenCORE and VisualOn libraries are under the Apache License 2.0. That
+license is incompatible with the LGPL v2.1 and the GPL v2, but not with
+version 3 of those licenses. So to combine these libraries with Libav, the
+license version needs to be upgraded by passing --enable-version3 to configure.
+
+incompatible libraries
+----------------------
+
+The Fraunhofer AAC library, FAAC and OpenSSL are under licenses incompatible
+with all (L)GPL versions. Thus, unfortunately, since both licenses cannot be
+satisfied simultaneously, binaries resulting from the combination of Libav
+with these libraries are nonfree und unredistributable. If you wish to enable
+any of these libraries nonetheless, pass --enable-nonfree to configure.
diff --git a/gst-libs/ext/libav/Makefile b/gst-libs/ext/libav/Makefile
index 96e3a87..291197b 100644
--- a/gst-libs/ext/libav/Makefile
+++ b/gst-libs/ext/libav/Makefile
@@ -10,8 +10,8 @@ vpath %.texi $(SRC_PATH)
ifndef V
Q = @
ECHO = printf "$(1)\t%s\n" $(2)
-BRIEF = CC AS YASM AR LD HOSTCC
-SILENT = DEPCC YASMDEP RM RANLIB
+BRIEF = CC HOSTCC HOSTLD AS YASM AR LD
+SILENT = DEPCC DEPHOSTCC DEPAS DEPYASM RANLIB RM
MSG = $@
M = @$(call ECHO,$(TAG),$@);
$(foreach VAR,$(BRIEF), \
@@ -20,19 +20,20 @@ $(foreach VAR,$(SILENT),$(eval override $(VAR) = @$($(VAR))))
$(eval INSTALL = @$(call ECHO,INSTALL,$$(^:$(SRC_PATH)/%=%)); $(INSTALL))
endif
-ALLFFLIBS = avcodec avdevice avfilter avformat avutil postproc swscale
+ALLFFLIBS = avcodec avdevice avfilter avformat avresample avutil swscale
IFLAGS := -I. -I$(SRC_PATH)
CPPFLAGS := $(IFLAGS) $(CPPFLAGS)
CFLAGS += $(ECFLAGS)
-CCFLAGS = $(CFLAGS)
-YASMFLAGS += $(IFLAGS) -I$(SRC_PATH)/libavutil/x86/ -Pconfig.asm
-HOSTCFLAGS += $(IFLAGS)
-LDFLAGS := $(ALLFFLIBS:%=-Llib%) $(LDFLAGS)
+CCFLAGS = $(CPPFLAGS) $(CFLAGS)
+ASFLAGS := $(CPPFLAGS) $(ASFLAGS)
+YASMFLAGS += $(IFLAGS:%=%/) -Pconfig.asm
+HOSTCCFLAGS = $(IFLAGS) $(HOSTCFLAGS)
+LDFLAGS := $(ALLFFLIBS:%=$(LD_PATH)lib%) $(LDFLAGS)
define COMPILE
- $($(1)DEP)
- $($(1)) $(CPPFLAGS) $($(1)FLAGS) $($(1)_DEPFLAGS) -c $($(1)_O) $<
+ $(call $(1)DEP,$(1))
+ $($(1)) $($(1)FLAGS) $($(1)_DEPFLAGS) $($(1)_C) $($(1)_O) $<
endef
COMPILE_C = $(call COMPILE,CC)
@@ -44,36 +45,39 @@ COMPILE_S = $(call COMPILE,AS)
%.o: %.S
$(COMPILE_S)
-%.ho: %.h
- $(CC) $(CPPFLAGS) $(CFLAGS) -Wno-unused -c -o $@ -x c $<
+%.i: %.c
+ $(CC) $(CCFLAGS) $(CC_E) $<
+
+%.h.c:
+ $(Q)echo '#include "$*.h"' >$@
%.ver: %.v
$(Q)sed 's/$$MAJOR/$($(basename $(@F))_VERSION_MAJOR)/' $^ > $@
%.c %.h: TAG = GEN
-PROGS-$(CONFIG_FFMPEG) += ffmpeg
PROGS-$(CONFIG_AVCONV) += avconv
PROGS-$(CONFIG_AVPLAY) += avplay
PROGS-$(CONFIG_AVPROBE) += avprobe
PROGS-$(CONFIG_AVSERVER) += avserver
PROGS := $(PROGS-yes:%=%$(EXESUF))
-OBJS = $(PROGS-yes:%=%.o) cmdutils.o
+OBJS = cmdutils.o $(EXEOBJS)
+OBJS-avconv = avconv_opt.o avconv_filter.o
TESTTOOLS = audiogen videogen rotozoom tiny_psnr base64
-HOSTPROGS := $(TESTTOOLS:%=tests/%)
+HOSTPROGS := $(TESTTOOLS:%=tests/%) doc/print_options
TOOLS = qt-faststart trasher
TOOLS-$(CONFIG_ZLIB) += cws2fws
-BASENAMES = ffmpeg avconv avplay avprobe avserver
+BASENAMES = avconv avplay avprobe avserver
ALLPROGS = $(BASENAMES:%=%$(EXESUF))
ALLMANPAGES = $(BASENAMES:%=%.1)
FFLIBS-$(CONFIG_AVDEVICE) += avdevice
FFLIBS-$(CONFIG_AVFILTER) += avfilter
FFLIBS-$(CONFIG_AVFORMAT) += avformat
+FFLIBS-$(CONFIG_AVRESAMPLE) += avresample
FFLIBS-$(CONFIG_AVCODEC) += avcodec
-FFLIBS-$(CONFIG_POSTPROC) += postproc
FFLIBS-$(CONFIG_SWSCALE) += swscale
FFLIBS := avutil
@@ -89,10 +93,10 @@ FF_DEP_LIBS := $(DEP_LIBS)
all: $(PROGS)
-$(TOOLS): %$(EXESUF): %.o
- $(LD) $(LDFLAGS) -o $@ $< $(ELIBS)
+$(TOOLS): %$(EXESUF): %.o $(EXEOBJS)
+ $(LD) $(LDFLAGS) $(LD_O) $^ $(ELIBS)
-tools/cws2fws$(EXESUF): ELIBS = -lz
+tools/cws2fws$(EXESUF): ELIBS = $(ZLIB)
config.h: .config
.config: $(wildcard $(FFLIBS:%=$(SRC_PATH)/lib%/all*.c))
@@ -100,9 +104,12 @@ config.h: .config
@-printf '\nWARNING: $(?F) newer than config.h, rerun configure\n\n'
@-tput sgr0 2>/dev/null
-SUBDIR_VARS := OBJS FFLIBS CLEANFILES DIRS TESTPROGS EXAMPLES SKIPHEADERS \
- ALTIVEC-OBJS MMX-OBJS NEON-OBJS X86-OBJS YASM-OBJS-FFT YASM-OBJS \
- HOSTPROGS BUILT_HEADERS TESTOBJS ARCH_HEADERS ARMV6-OBJS TOOLS
+SUBDIR_VARS := CLEANFILES EXAMPLES FFLIBS HOSTPROGS TESTPROGS TOOLS \
+ HEADERS ARCH_HEADERS BUILT_HEADERS SKIPHEADERS \
+ ARMV5TE-OBJS ARMV6-OBJS VFP-OBJS NEON-OBJS \
+ ALTIVEC-OBJS VIS-OBJS \
+ MMX-OBJS YASM-OBJS \
+ OBJS HOSTOBJS TESTOBJS
define RESET
$(1) :=
@@ -113,17 +120,25 @@ define DOSUBDIR
$(foreach V,$(SUBDIR_VARS),$(eval $(call RESET,$(V))))
SUBDIR := $(1)/
include $(SRC_PATH)/$(1)/Makefile
+-include $(SRC_PATH)/$(1)/$(ARCH)/Makefile
include $(SRC_PATH)/library.mak
endef
$(foreach D,$(FFLIBS),$(eval $(call DOSUBDIR,lib$(D))))
-avplay.o: CFLAGS += $(SDL_CFLAGS)
-avplay$(EXESUF): FF_EXTRALIBS += $(SDL_LIBS)
-avserver$(EXESUF): LDFLAGS += $(AVSERVERLDFLAGS)
+define DOPROG
+OBJS-$(1) += $(1).o cmdutils.o $(EXEOBJS)
+$(1)$(EXESUF): $$(OBJS-$(1))
+$$(OBJS-$(1)): CFLAGS += $(CFLAGS-$(1))
+$(1)$(EXESUF): LDFLAGS += $(LDFLAGS-$(1))
+$(1)$(EXESUF): FF_EXTRALIBS += $(LIBS-$(1))
+-include $$(OBJS-$(1):.o=.d)
+endef
+
+$(foreach P,$(PROGS-yes),$(eval $(call DOPROG,$(P))))
-$(PROGS): %$(EXESUF): %.o cmdutils.o $(FF_DEP_LIBS)
- $(LD) $(LDFLAGS) -o $@ $< cmdutils.o $(FF_EXTRALIBS)
+$(PROGS): %$(EXESUF): %.o $(FF_DEP_LIBS)
+ $(LD) $(LDFLAGS) $(LD_O) $(OBJS-$*) $(FF_EXTRALIBS)
OBJDIRS += tools
diff --git a/gst-libs/ext/libav/RELEASE b/gst-libs/ext/libav/RELEASE
index 6201b5f..021debd 100644
--- a/gst-libs/ext/libav/RELEASE
+++ b/gst-libs/ext/libav/RELEASE
@@ -1 +1 @@
-0.8.8
+9.8
diff --git a/gst-libs/ext/libav/arch.mak b/gst-libs/ext/libav/arch.mak
new file mode 100644
index 0000000..09d24af
--- /dev/null
+++ b/gst-libs/ext/libav/arch.mak
@@ -0,0 +1,11 @@
+OBJS-$(HAVE_ARMV5TE) += $(ARMV5TE-OBJS) $(ARMV5TE-OBJS-yes)
+OBJS-$(HAVE_ARMV6) += $(ARMV6-OBJS) $(ARMV6-OBJS-yes)
+OBJS-$(HAVE_VFP) += $(VFP-OBJS) $(VFP-OBJS-yes)
+OBJS-$(HAVE_NEON) += $(NEON-OBJS) $(NEON-OBJS-yes)
+
+OBJS-$(HAVE_ALTIVEC) += $(ALTIVEC-OBJS) $(ALTIVEC-OBJS-yes)
+
+OBJS-$(HAVE_VIS) += $(VIS-OBJS) $(VIS-OBJS-yes)
+
+OBJS-$(HAVE_MMX) += $(MMX-OBJS) $(MMX-OBJS-yes)
+OBJS-$(HAVE_YASM) += $(YASM-OBJS) $(YASM-OBJS-yes)
diff --git a/gst-libs/ext/libav/avconv.c b/gst-libs/ext/libav/avconv.c
index 90b72fd..dd998ab 100644
--- a/gst-libs/ext/libav/avconv.c
+++ b/gst-libs/ext/libav/avconv.c
@@ -27,13 +27,12 @@
#include <errno.h>
#include <signal.h>
#include <limits.h>
-#include <unistd.h>
#include "libavformat/avformat.h"
#include "libavdevice/avdevice.h"
#include "libswscale/swscale.h"
+#include "libavresample/avresample.h"
#include "libavutil/opt.h"
-#include "libavcodec/audioconvert.h"
-#include "libavutil/audioconvert.h"
+#include "libavutil/channel_layout.h"
#include "libavutil/parseutils.h"
#include "libavutil/samplefmt.h"
#include "libavutil/colorspace.h"
@@ -45,18 +44,17 @@
#include "libavutil/avstring.h"
#include "libavutil/libm.h"
#include "libavutil/imgutils.h"
+#include "libavutil/time.h"
#include "libavformat/os_support.h"
-#if CONFIG_AVFILTER
# include "libavfilter/avfilter.h"
# include "libavfilter/avfiltergraph.h"
# include "libavfilter/buffersrc.h"
-# include "libavfilter/vsrc_buffer.h"
-#endif
+# include "libavfilter/buffersink.h"
#if HAVE_SYS_RESOURCE_H
-#include <sys/types.h>
#include <sys/time.h>
+#include <sys/types.h>
#include <sys/resource.h>
#elif HAVE_GETPROCESSTIMES
#include <windows.h>
@@ -70,563 +68,49 @@
#include <sys/select.h>
#endif
+#if HAVE_PTHREADS
+#include <pthread.h>
+#endif
+
#include <time.h>
+#include "avconv.h"
#include "cmdutils.h"
#include "libavutil/avassert.h"
-#define VSYNC_AUTO -1
-#define VSYNC_PASSTHROUGH 0
-#define VSYNC_CFR 1
-#define VSYNC_VFR 2
-
const char program_name[] = "avconv";
const int program_birth_year = 2000;
-/* select an input stream for an output stream */
-typedef struct StreamMap {
- int disabled; /** 1 is this mapping is disabled by a negative map */
- int file_index;
- int stream_index;
- int sync_file_index;
- int sync_stream_index;
-} StreamMap;
-
-/**
- * select an input file for an output file
- */
-typedef struct MetadataMap {
- int file; ///< file index
- char type; ///< type of metadata to copy -- (g)lobal, (s)tream, (c)hapter or (p)rogram
- int index; ///< stream/chapter/program number
-} MetadataMap;
-
-static const OptionDef options[];
-
-static int video_discard = 0;
-static int same_quant = 0;
-static int do_deinterlace = 0;
-static int intra_dc_precision = 8;
-static int qp_hist = 0;
-
-static int file_overwrite = 0;
-static int do_benchmark = 0;
-static int do_hex_dump = 0;
-static int do_pkt_dump = 0;
-static int do_pass = 0;
-static char *pass_logfilename_prefix = NULL;
-static int video_sync_method = VSYNC_AUTO;
-static int audio_sync_method = 0;
-static float audio_drift_threshold = 0.1;
-static int copy_ts = 0;
-static int copy_tb = 1;
-static int opt_shortest = 0;
-static char *vstats_filename;
static FILE *vstats_file;
-static int audio_volume = 256;
-
-static int exit_on_error = 0;
-static int using_stdin = 0;
static int64_t video_size = 0;
static int64_t audio_size = 0;
static int64_t extra_size = 0;
static int nb_frames_dup = 0;
static int nb_frames_drop = 0;
-static int input_sync;
-
-static float dts_delta_threshold = 10;
-static int print_stats = 1;
-static uint8_t *audio_buf;
-static unsigned int allocated_audio_buf_size;
-#define DEFAULT_PASS_LOGFILENAME_PREFIX "av2pass"
-
-typedef struct FrameBuffer {
- uint8_t *base[4];
- uint8_t *data[4];
- int linesize[4];
-
- int h, w;
- enum PixelFormat pix_fmt;
-
- int refcount;
- struct InputStream *ist;
- struct FrameBuffer *next;
-} FrameBuffer;
-
-typedef struct InputStream {
- int file_index;
- AVStream *st;
- int discard; /* true if stream data should be discarded */
- int decoding_needed; /* true if the packets must be decoded in 'raw_fifo' */
- AVCodec *dec;
- AVFrame *decoded_frame;
- AVFrame *filtered_frame;
-
- int64_t start; /* time when read started */
- int64_t next_pts; /* synthetic pts for cases where pkt.pts
- is not defined */
- int64_t pts; /* current pts */
- PtsCorrectionContext pts_ctx;
- double ts_scale;
- int is_start; /* is 1 at the start and after a discontinuity */
- int showed_multi_packet_warning;
- AVDictionary *opts;
-
- /* a pool of free buffers for decoded data */
- FrameBuffer *buffer_pool;
-} InputStream;
-
-typedef struct InputFile {
- AVFormatContext *ctx;
- int eof_reached; /* true if eof reached */
- int ist_index; /* index of first stream in ist_table */
- int buffer_size; /* current total buffer size */
- int64_t ts_offset;
- int nb_streams; /* number of stream that avconv is aware of; may be different
- from ctx.nb_streams if new streams appear during av_read_frame() */
- int rate_emu;
-} InputFile;
-
-typedef struct OutputStream {
- int file_index; /* file index */
- int index; /* stream index in the output file */
- int source_index; /* InputStream index */
- AVStream *st; /* stream in the output file */
- int encoding_needed; /* true if encoding needed for this stream */
- int frame_number;
- /* input pts and corresponding output pts
- for A/V sync */
- // double sync_ipts; /* dts from the AVPacket of the demuxer in second units */
- struct InputStream *sync_ist; /* input stream to sync against */
- int64_t sync_opts; /* output frame counter, could be changed to some true timestamp */ // FIXME look at frame_number
- AVBitStreamFilterContext *bitstream_filters;
- AVCodec *enc;
- int64_t max_frames;
- AVFrame *output_frame;
-
- /* video only */
- int video_resample;
- AVFrame pict_tmp; /* temporary image for resampling */
- struct SwsContext *img_resample_ctx; /* for image resampling */
- int resample_height;
- int resample_width;
- int resample_pix_fmt;
- AVRational frame_rate;
- int force_fps;
- int top_field_first;
-
- float frame_aspect_ratio;
-
- /* forced key frames */
- int64_t *forced_kf_pts;
- int forced_kf_count;
- int forced_kf_index;
- char *forced_keyframes;
-
- /* audio only */
- int audio_resample;
- ReSampleContext *resample; /* for audio resampling */
- int resample_sample_fmt;
- int resample_channels;
- int resample_sample_rate;
- int reformat_pair;
- AVAudioConvert *reformat_ctx;
- AVFifoBuffer *fifo; /* for compression: one audio fifo per codec */
- FILE *logfile;
-
-#if CONFIG_AVFILTER
- AVFilterContext *output_video_filter;
- AVFilterContext *input_video_filter;
- AVFilterBufferRef *picref;
- char *avfilter;
- AVFilterGraph *graph;
-#endif
-
- int64_t sws_flags;
- AVDictionary *opts;
- int is_past_recording_time;
- int stream_copy;
- const char *attachment_filename;
- int copy_initial_nonkeyframes;
-} OutputStream;
-
-
-typedef struct OutputFile {
- AVFormatContext *ctx;
- AVDictionary *opts;
- int ost_index; /* index of the first stream in output_streams */
- int64_t recording_time; /* desired length of the resulting file in microseconds */
- int64_t start_time; /* start time in microseconds */
- uint64_t limit_filesize;
-} OutputFile;
-
-static InputStream *input_streams = NULL;
-static int nb_input_streams = 0;
-static InputFile *input_files = NULL;
-static int nb_input_files = 0;
-
-static OutputStream *output_streams = NULL;
-static int nb_output_streams = 0;
-static OutputFile *output_files = NULL;
-static int nb_output_files = 0;
-
-typedef struct OptionsContext {
- /* input/output options */
- int64_t start_time;
- const char *format;
-
- SpecifierOpt *codec_names;
- int nb_codec_names;
- SpecifierOpt *audio_channels;
- int nb_audio_channels;
- SpecifierOpt *audio_sample_rate;
- int nb_audio_sample_rate;
- SpecifierOpt *frame_rates;
- int nb_frame_rates;
- SpecifierOpt *frame_sizes;
- int nb_frame_sizes;
- SpecifierOpt *frame_pix_fmts;
- int nb_frame_pix_fmts;
-
- /* input options */
- int64_t input_ts_offset;
- int rate_emu;
-
- SpecifierOpt *ts_scale;
- int nb_ts_scale;
- SpecifierOpt *dump_attachment;
- int nb_dump_attachment;
-
- /* output options */
- StreamMap *stream_maps;
- int nb_stream_maps;
- /* first item specifies output metadata, second is input */
- MetadataMap (*meta_data_maps)[2];
- int nb_meta_data_maps;
- int metadata_global_manual;
- int metadata_streams_manual;
- int metadata_chapters_manual;
- const char **attachments;
- int nb_attachments;
-
- int chapters_input_file;
-
- int64_t recording_time;
- uint64_t limit_filesize;
- float mux_preload;
- float mux_max_delay;
-
- int video_disable;
- int audio_disable;
- int subtitle_disable;
- int data_disable;
-
- /* indexed by output file stream index */
- int *streamid_map;
- int nb_streamid_map;
-
- SpecifierOpt *metadata;
- int nb_metadata;
- SpecifierOpt *max_frames;
- int nb_max_frames;
- SpecifierOpt *bitstream_filters;
- int nb_bitstream_filters;
- SpecifierOpt *codec_tags;
- int nb_codec_tags;
- SpecifierOpt *sample_fmts;
- int nb_sample_fmts;
- SpecifierOpt *qscale;
- int nb_qscale;
- SpecifierOpt *forced_key_frames;
- int nb_forced_key_frames;
- SpecifierOpt *force_fps;
- int nb_force_fps;
- SpecifierOpt *frame_aspect_ratios;
- int nb_frame_aspect_ratios;
- SpecifierOpt *rc_overrides;
- int nb_rc_overrides;
- SpecifierOpt *intra_matrices;
- int nb_intra_matrices;
- SpecifierOpt *inter_matrices;
- int nb_inter_matrices;
- SpecifierOpt *top_field_first;
- int nb_top_field_first;
- SpecifierOpt *metadata_map;
- int nb_metadata_map;
- SpecifierOpt *presets;
- int nb_presets;
- SpecifierOpt *copy_initial_nonkeyframes;
- int nb_copy_initial_nonkeyframes;
-#if CONFIG_AVFILTER
- SpecifierOpt *filters;
- int nb_filters;
+#if HAVE_PTHREADS
+/* signal to input threads that they should exit; set by the main thread */
+static int transcoding_finished;
#endif
-} OptionsContext;
-
-#define MATCH_PER_STREAM_OPT(name, type, outvar, fmtctx, st)\
-{\
- int i, ret;\
- for (i = 0; i < o->nb_ ## name; i++) {\
- char *spec = o->name[i].specifier;\
- if ((ret = check_stream_specifier(fmtctx, st, spec)) > 0)\
- outvar = o->name[i].u.type;\
- else if (ret < 0)\
- exit_program(1);\
- }\
-}
-
-static void reset_options(OptionsContext *o)
-{
- const OptionDef *po = options;
-
- /* all OPT_SPEC and OPT_STRING can be freed in generic way */
- while (po->name) {
- void *dst = (uint8_t*)o + po->u.off;
-
- if (po->flags & OPT_SPEC) {
- SpecifierOpt **so = dst;
- int i, *count = (int*)(so + 1);
- for (i = 0; i < *count; i++) {
- av_freep(&(*so)[i].specifier);
- if (po->flags & OPT_STRING)
- av_freep(&(*so)[i].u.str);
- }
- av_freep(so);
- *count = 0;
- } else if (po->flags & OPT_OFFSET && po->flags & OPT_STRING)
- av_freep(dst);
- po++;
- }
-
- av_freep(&o->stream_maps);
- av_freep(&o->meta_data_maps);
- av_freep(&o->streamid_map);
-
- memset(o, 0, sizeof(*o));
-
- o->mux_max_delay = 0.7;
- o->recording_time = INT64_MAX;
- o->limit_filesize = UINT64_MAX;
- o->chapters_input_file = INT_MAX;
-
- uninit_opts();
- init_opts();
-}
-
-static int alloc_buffer(InputStream *ist, FrameBuffer **pbuf)
-{
- AVCodecContext *s = ist->st->codec;
- FrameBuffer *buf = av_mallocz(sizeof(*buf));
- int ret;
- const int pixel_size = av_pix_fmt_descriptors[s->pix_fmt].comp[0].step_minus1+1;
- int h_chroma_shift, v_chroma_shift;
- int edge = 32; // XXX should be avcodec_get_edge_width(), but that fails on svq1
- int w = s->width, h = s->height;
-
- if (!buf)
- return AVERROR(ENOMEM);
-
- if (!(s->flags & CODEC_FLAG_EMU_EDGE)) {
- w += 2*edge;
- h += 2*edge;
- }
-
- avcodec_align_dimensions(s, &w, &h);
- if ((ret = av_image_alloc(buf->base, buf->linesize, w, h,
- s->pix_fmt, 32)) < 0) {
- av_freep(&buf);
- return ret;
- }
- /* XXX this shouldn't be needed, but some tests break without this line
- * those decoders are buggy and need to be fixed.
- * the following tests fail:
- * bethsoft-vid, cdgraphics, ansi, aasc, fraps-v1, qtrle-1bit
- */
- memset(buf->base[0], 128, ret);
-
- avcodec_get_chroma_sub_sample(s->pix_fmt, &h_chroma_shift, &v_chroma_shift);
- for (int i = 0; i < FF_ARRAY_ELEMS(buf->data); i++) {
- const int h_shift = i==0 ? 0 : h_chroma_shift;
- const int v_shift = i==0 ? 0 : v_chroma_shift;
- if (s->flags & CODEC_FLAG_EMU_EDGE)
- buf->data[i] = buf->base[i];
- else if (buf->base[i])
- buf->data[i] = buf->base[i] +
- FFALIGN((buf->linesize[i]*edge >> v_shift) +
- (pixel_size*edge >> h_shift), 32);
- }
- buf->w = s->width;
- buf->h = s->height;
- buf->pix_fmt = s->pix_fmt;
- buf->ist = ist;
-
- *pbuf = buf;
- return 0;
-}
-
-static void free_buffer_pool(InputStream *ist)
-{
- FrameBuffer *buf = ist->buffer_pool;
- while (buf) {
- ist->buffer_pool = buf->next;
- av_freep(&buf->base[0]);
- av_free(buf);
- buf = ist->buffer_pool;
- }
-}
-
-static void unref_buffer(InputStream *ist, FrameBuffer *buf)
-{
- av_assert0(buf->refcount);
- buf->refcount--;
- if (!buf->refcount) {
- buf->next = ist->buffer_pool;
- ist->buffer_pool = buf;
- }
-}
-
-static int codec_get_buffer(AVCodecContext *s, AVFrame *frame)
-{
- InputStream *ist = s->opaque;
- FrameBuffer *buf;
- int ret, i;
-
- if (!ist->buffer_pool && (ret = alloc_buffer(ist, &ist->buffer_pool)) < 0)
- return ret;
-
- buf = ist->buffer_pool;
- ist->buffer_pool = buf->next;
- buf->next = NULL;
- if (buf->w != s->width || buf->h != s->height || buf->pix_fmt != s->pix_fmt) {
- av_freep(&buf->base[0]);
- av_free(buf);
- if ((ret = alloc_buffer(ist, &buf)) < 0)
- return ret;
- }
- buf->refcount++;
-
- frame->opaque = buf;
- frame->type = FF_BUFFER_TYPE_USER;
- frame->extended_data = frame->data;
- frame->pkt_pts = s->pkt ? s->pkt->pts : AV_NOPTS_VALUE;
-
- for (i = 0; i < FF_ARRAY_ELEMS(buf->data); i++) {
- frame->base[i] = buf->base[i]; // XXX h264.c uses base though it shouldn't
- frame->data[i] = buf->data[i];
- frame->linesize[i] = buf->linesize[i];
- }
-
- return 0;
-}
-
-static void codec_release_buffer(AVCodecContext *s, AVFrame *frame)
-{
- InputStream *ist = s->opaque;
- FrameBuffer *buf = frame->opaque;
- int i;
-
- for (i = 0; i < FF_ARRAY_ELEMS(frame->data); i++)
- frame->data[i] = NULL;
- unref_buffer(ist, buf);
-}
-
-static void filter_release_buffer(AVFilterBuffer *fb)
-{
- FrameBuffer *buf = fb->priv;
- av_free(fb);
- unref_buffer(buf->ist, buf);
-}
-
-#if CONFIG_AVFILTER
-
-static int configure_video_filters(InputStream *ist, OutputStream *ost)
-{
- AVFilterContext *last_filter, *filter;
- /** filter graph containing all filters including input & output */
- AVCodecContext *codec = ost->st->codec;
- AVCodecContext *icodec = ist->st->codec;
- AVSinkContext avsink_ctx = { .pix_fmt = codec->pix_fmt };
- AVRational sample_aspect_ratio;
- char args[255];
- int ret;
-
- ost->graph = avfilter_graph_alloc();
-
- if (ist->st->sample_aspect_ratio.num) {
- sample_aspect_ratio = ist->st->sample_aspect_ratio;
- } else
- sample_aspect_ratio = ist->st->codec->sample_aspect_ratio;
-
- snprintf(args, 255, "%d:%d:%d:%d:%d:%d:%d", ist->st->codec->width,
- ist->st->codec->height, ist->st->codec->pix_fmt, 1, AV_TIME_BASE,
- sample_aspect_ratio.num, sample_aspect_ratio.den);
-
- ret = avfilter_graph_create_filter(&ost->input_video_filter, avfilter_get_by_name("buffer"),
- "src", args, NULL, ost->graph);
- if (ret < 0)
- return ret;
- ret = avfilter_graph_create_filter(&ost->output_video_filter, &avsink,
- "out", NULL, &avsink_ctx, ost->graph);
- if (ret < 0)
- return ret;
- last_filter = ost->input_video_filter;
-
- if (codec->width != icodec->width || codec->height != icodec->height) {
- snprintf(args, 255, "%d:%d:flags=0x%X",
- codec->width,
- codec->height,
- (unsigned)ost->sws_flags);
- if ((ret = avfilter_graph_create_filter(&filter, avfilter_get_by_name("scale"),
- NULL, args, NULL, ost->graph)) < 0)
- return ret;
- if ((ret = avfilter_link(last_filter, 0, filter, 0)) < 0)
- return ret;
- last_filter = filter;
- }
-
- snprintf(args, sizeof(args), "flags=0x%X", (unsigned)ost->sws_flags);
- ost->graph->scale_sws_opts = av_strdup(args);
-
- if (ost->avfilter) {
- AVFilterInOut *outputs = av_malloc(sizeof(AVFilterInOut));
- AVFilterInOut *inputs = av_malloc(sizeof(AVFilterInOut));
-
- outputs->name = av_strdup("in");
- outputs->filter_ctx = last_filter;
- outputs->pad_idx = 0;
- outputs->next = NULL;
-
- inputs->name = av_strdup("out");
- inputs->filter_ctx = ost->output_video_filter;
- inputs->pad_idx = 0;
- inputs->next = NULL;
+#define DEFAULT_PASS_LOGFILENAME_PREFIX "av2pass"
- if ((ret = avfilter_graph_parse(ost->graph, ost->avfilter, inputs, outputs, NULL)) < 0)
- return ret;
- } else {
- if ((ret = avfilter_link(last_filter, 0, ost->output_video_filter, 0)) < 0)
- return ret;
- }
+InputStream **input_streams = NULL;
+int nb_input_streams = 0;
+InputFile **input_files = NULL;
+int nb_input_files = 0;
- if ((ret = avfilter_graph_config(ost->graph, NULL)) < 0)
- return ret;
+OutputStream **output_streams = NULL;
+int nb_output_streams = 0;
+OutputFile **output_files = NULL;
+int nb_output_files = 0;
- codec->width = ost->output_video_filter->inputs[0]->w;
- codec->height = ost->output_video_filter->inputs[0]->h;
- codec->sample_aspect_ratio = ost->st->sample_aspect_ratio =
- ost->frame_aspect_ratio ? // overridden by the -aspect cli option
- av_d2q(ost->frame_aspect_ratio * codec->height/codec->width, 255) :
- ost->output_video_filter->inputs[0]->sample_aspect_ratio;
-
- return 0;
-}
-#endif /* CONFIG_AVFILTER */
+FilterGraph **filtergraphs;
+int nb_filtergraphs;
static void term_exit(void)
{
@@ -658,49 +142,62 @@ static int decode_interrupt_cb(void *ctx)
return received_nb_signals > 1;
}
-static const AVIOInterruptCB int_cb = { decode_interrupt_cb, NULL };
+const AVIOInterruptCB int_cb = { decode_interrupt_cb, NULL };
-void exit_program(int ret)
+static void exit_program(void)
{
- int i;
+ int i, j;
+
+ for (i = 0; i < nb_filtergraphs; i++) {
+ avfilter_graph_free(&filtergraphs[i]->graph);
+ for (j = 0; j < filtergraphs[i]->nb_inputs; j++) {
+ av_freep(&filtergraphs[i]->inputs[j]->name);
+ av_freep(&filtergraphs[i]->inputs[j]);
+ }
+ av_freep(&filtergraphs[i]->inputs);
+ for (j = 0; j < filtergraphs[i]->nb_outputs; j++) {
+ av_freep(&filtergraphs[i]->outputs[j]->name);
+ av_freep(&filtergraphs[i]->outputs[j]);
+ }
+ av_freep(&filtergraphs[i]->outputs);
+ av_freep(&filtergraphs[i]);
+ }
+ av_freep(&filtergraphs);
/* close files */
for (i = 0; i < nb_output_files; i++) {
- AVFormatContext *s = output_files[i].ctx;
+ AVFormatContext *s = output_files[i]->ctx;
if (!(s->oformat->flags & AVFMT_NOFILE) && s->pb)
avio_close(s->pb);
avformat_free_context(s);
- av_dict_free(&output_files[i].opts);
+ av_dict_free(&output_files[i]->opts);
+ av_freep(&output_files[i]);
}
for (i = 0; i < nb_output_streams; i++) {
- AVBitStreamFilterContext *bsfc = output_streams[i].bitstream_filters;
+ AVBitStreamFilterContext *bsfc = output_streams[i]->bitstream_filters;
while (bsfc) {
AVBitStreamFilterContext *next = bsfc->next;
av_bitstream_filter_close(bsfc);
bsfc = next;
}
- output_streams[i].bitstream_filters = NULL;
-
- if (output_streams[i].output_frame) {
- AVFrame *frame = output_streams[i].output_frame;
- if (frame->extended_data != frame->data)
- av_freep(&frame->extended_data);
- av_freep(&frame);
- }
+ output_streams[i]->bitstream_filters = NULL;
+ avcodec_free_frame(&output_streams[i]->filtered_frame);
- av_freep(&output_streams[i].forced_keyframes);
-#if CONFIG_AVFILTER
- av_freep(&output_streams[i].avfilter);
-#endif
+ av_freep(&output_streams[i]->forced_keyframes);
+ av_freep(&output_streams[i]->avfilter);
+ av_freep(&output_streams[i]->logfile_prefix);
+ av_freep(&output_streams[i]);
}
for (i = 0; i < nb_input_files; i++) {
- avformat_close_input(&input_files[i].ctx);
+ avformat_close_input(&input_files[i]->ctx);
+ av_freep(&input_files[i]);
}
for (i = 0; i < nb_input_streams; i++) {
- av_freep(&input_streams[i].decoded_frame);
- av_freep(&input_streams[i].filtered_frame);
- av_dict_free(&input_streams[i].opts);
- free_buffer_pool(&input_streams[i]);
+ avcodec_free_frame(&input_streams[i]->decoded_frame);
+ av_dict_free(&input_streams[i]->opts);
+ free_buffer_pool(&input_streams[i]->buffer_pool);
+ av_freep(&input_streams[i]->filters);
+ av_freep(&input_streams[i]);
}
if (vstats_file)
@@ -713,12 +210,8 @@ void exit_program(int ret)
av_freep(&output_files);
uninit_opts();
- av_free(audio_buf);
- allocated_audio_buf_size = 0;
-#if CONFIG_AVFILTER
avfilter_uninit();
-#endif
avformat_network_deinit();
if (received_sigterm) {
@@ -726,56 +219,32 @@ void exit_program(int ret)
(int) received_sigterm);
exit (255);
}
-
- exit(ret);
}
-static void assert_avoptions(AVDictionary *m)
+void assert_avoptions(AVDictionary *m)
{
AVDictionaryEntry *t;
if ((t = av_dict_get(m, "", NULL, AV_DICT_IGNORE_SUFFIX))) {
av_log(NULL, AV_LOG_FATAL, "Option %s not found.\n", t->key);
- exit_program(1);
+ exit(1);
}
}
-static void assert_codec_experimental(AVCodecContext *c, int encoder)
+static void abort_codec_experimental(AVCodec *c, int encoder)
{
const char *codec_string = encoder ? "encoder" : "decoder";
AVCodec *codec;
- if (c->codec->capabilities & CODEC_CAP_EXPERIMENTAL &&
- c->strict_std_compliance > FF_COMPLIANCE_EXPERIMENTAL) {
- av_log(NULL, AV_LOG_FATAL, "%s '%s' is experimental and might produce bad "
- "results.\nAdd '-strict experimental' if you want to use it.\n",
- codec_string, c->codec->name);
- codec = encoder ? avcodec_find_encoder(c->codec->id) : avcodec_find_decoder(c->codec->id);
- if (!(codec->capabilities & CODEC_CAP_EXPERIMENTAL))
- av_log(NULL, AV_LOG_FATAL, "Or use the non experimental %s '%s'.\n",
- codec_string, codec->name);
- exit_program(1);
- }
-}
-
-static void choose_sample_fmt(AVStream *st, AVCodec *codec)
-{
- if (codec && codec->sample_fmts) {
- const enum AVSampleFormat *p = codec->sample_fmts;
- for (; *p != -1; p++) {
- if (*p == st->codec->sample_fmt)
- break;
- }
- if (*p == -1) {
- av_log(NULL, AV_LOG_WARNING,
- "Incompatible sample format '%s' for codec '%s', auto-selecting format '%s'\n",
- av_get_sample_fmt_name(st->codec->sample_fmt),
- codec->name,
- av_get_sample_fmt_name(codec->sample_fmts[0]));
- st->codec->sample_fmt = codec->sample_fmts[0];
- }
- }
+ av_log(NULL, AV_LOG_FATAL, "%s '%s' is experimental and might produce bad "
+ "results.\nAdd '-strict experimental' if you want to use it.\n",
+ codec_string, c->name);
+ codec = encoder ? avcodec_find_encoder(c->id) : avcodec_find_decoder(c->id);
+ if (!(codec->capabilities & CODEC_CAP_EXPERIMENTAL))
+ av_log(NULL, AV_LOG_FATAL, "Or use the non experimental %s '%s'.\n",
+ codec_string, codec->name);
+ exit(1);
}
-/**
+/*
* Update the requested input sample format based on the output sample format.
* This is currently only used to request float output from decoders which
* support multiple sample formats, one of which is AV_SAMPLE_FMT_FLT.
@@ -796,81 +265,44 @@ static void update_sample_fmt(AVCodecContext *dec, AVCodec *dec_codec,
dec_codec->sample_fmts[0] != AV_SAMPLE_FMT_NONE &&
dec_codec->sample_fmts[1] != AV_SAMPLE_FMT_NONE) {
const enum AVSampleFormat *p;
- int min_dec = -1, min_inc = -1;
+ int min_dec = INT_MAX, min_inc = INT_MAX;
+ enum AVSampleFormat dec_fmt = AV_SAMPLE_FMT_NONE;
+ enum AVSampleFormat inc_fmt = AV_SAMPLE_FMT_NONE;
/* find a matching sample format in the encoder */
for (p = dec_codec->sample_fmts; *p != AV_SAMPLE_FMT_NONE; p++) {
if (*p == enc->sample_fmt) {
dec->request_sample_fmt = *p;
return;
- } else if (*p > enc->sample_fmt) {
- min_inc = FFMIN(min_inc, *p - enc->sample_fmt);
- } else
- min_dec = FFMIN(min_dec, enc->sample_fmt - *p);
- }
-
- /* if none match, provide the one that matches quality closest */
- dec->request_sample_fmt = min_inc > 0 ? enc->sample_fmt + min_inc :
- enc->sample_fmt - min_dec;
- }
-}
-
-static void choose_sample_rate(AVStream *st, AVCodec *codec)
-{
- if (codec && codec->supported_samplerates) {
- const int *p = codec->supported_samplerates;
- int best = 0;
- int best_dist = INT_MAX;
- for (; *p; p++) {
- int dist = abs(st->codec->sample_rate - *p);
- if (dist < best_dist) {
- best_dist = dist;
- best = *p;
+ } else {
+ enum AVSampleFormat dfmt = av_get_packed_sample_fmt(*p);
+ enum AVSampleFormat efmt = av_get_packed_sample_fmt(enc->sample_fmt);
+ int fmt_diff = 32 * abs(dfmt - efmt);
+ if (av_sample_fmt_is_planar(*p) !=
+ av_sample_fmt_is_planar(enc->sample_fmt))
+ fmt_diff++;
+ if (dfmt == efmt) {
+ min_inc = fmt_diff;
+ inc_fmt = *p;
+ } else if (dfmt > efmt) {
+ if (fmt_diff < min_inc) {
+ min_inc = fmt_diff;
+ inc_fmt = *p;
+ }
+ } else {
+ if (fmt_diff < min_dec) {
+ min_dec = fmt_diff;
+ dec_fmt = *p;
+ }
+ }
}
}
- if (best_dist) {
- av_log(st->codec, AV_LOG_WARNING, "Requested sampling rate unsupported using closest supported (%d)\n", best);
- }
- st->codec->sample_rate = best;
- }
-}
-static void choose_pixel_fmt(AVStream *st, AVCodec *codec)
-{
- if (codec && codec->pix_fmts) {
- const enum PixelFormat *p = codec->pix_fmts;
- if (st->codec->strict_std_compliance <= FF_COMPLIANCE_UNOFFICIAL) {
- if (st->codec->codec_id == CODEC_ID_MJPEG) {
- p = (const enum PixelFormat[]) { PIX_FMT_YUVJ420P, PIX_FMT_YUVJ422P, PIX_FMT_YUV420P, PIX_FMT_YUV422P, PIX_FMT_NONE };
- } else if (st->codec->codec_id == CODEC_ID_LJPEG) {
- p = (const enum PixelFormat[]) { PIX_FMT_YUVJ420P, PIX_FMT_YUVJ422P, PIX_FMT_YUVJ444P, PIX_FMT_YUV420P,
- PIX_FMT_YUV422P, PIX_FMT_YUV444P, PIX_FMT_BGRA, PIX_FMT_NONE };
- }
- }
- for (; *p != PIX_FMT_NONE; p++) {
- if (*p == st->codec->pix_fmt)
- break;
- }
- if (*p == PIX_FMT_NONE) {
- if (st->codec->pix_fmt != PIX_FMT_NONE)
- av_log(NULL, AV_LOG_WARNING,
- "Incompatible pixel format '%s' for codec '%s', auto-selecting format '%s'\n",
- av_pix_fmt_descriptors[st->codec->pix_fmt].name,
- codec->name,
- av_pix_fmt_descriptors[codec->pix_fmts[0]].name);
- st->codec->pix_fmt = codec->pix_fmts[0];
- }
+ /* if none match, provide the one that matches quality closest */
+ dec->request_sample_fmt = min_inc != INT_MAX ? inc_fmt : dec_fmt;
}
}
-static double
-get_sync_ipts(const OutputStream *ost)
-{
- const InputStream *ist = ost->sync_ist;
- OutputFile *of = &output_files[ost->file_index];
- return (double)(ist->pts - of->start_time) / AV_TIME_BASE;
-}
-
static void write_frame(AVFormatContext *s, AVPacket *pkt, OutputStream *ost)
{
AVBitStreamFilterContext *bsfc = ost->bitstream_filters;
@@ -885,8 +317,10 @@ static void write_frame(AVFormatContext *s, AVPacket *pkt, OutputStream *ost)
* reordering, see do_video_out()
*/
if (!(avctx->codec_type == AVMEDIA_TYPE_VIDEO && avctx->codec)) {
- if (ost->frame_number >= ost->max_frames)
+ if (ost->frame_number >= ost->max_frames) {
+ av_free_packet(pkt);
return;
+ }
ost->frame_number++;
}
@@ -905,72 +339,62 @@ static void write_frame(AVFormatContext *s, AVPacket *pkt, OutputStream *ost)
avctx->codec ? avctx->codec->name : "copy");
print_error("", a);
if (exit_on_error)
- exit_program(1);
+ exit(1);
}
*pkt = new_pkt;
bsfc = bsfc->next;
}
+ pkt->stream_index = ost->index;
ret = av_interleaved_write_frame(s, pkt);
if (ret < 0) {
print_error("av_interleaved_write_frame()", ret);
- exit_program(1);
+ exit(1);
}
}
-static void generate_silence(uint8_t* buf, enum AVSampleFormat sample_fmt, size_t size)
+static int check_recording_time(OutputStream *ost)
{
- int fill_char = 0x00;
- if (sample_fmt == AV_SAMPLE_FMT_U8)
- fill_char = 0x80;
- memset(buf, fill_char, size);
+ OutputFile *of = output_files[ost->file_index];
+
+ if (of->recording_time != INT64_MAX &&
+ av_compare_ts(ost->sync_opts - ost->first_pts, ost->st->codec->time_base, of->recording_time,
+ AV_TIME_BASE_Q) >= 0) {
+ ost->finished = 1;
+ return 0;
+ }
+ return 1;
}
-static int encode_audio_frame(AVFormatContext *s, OutputStream *ost,
- const uint8_t *buf, int buf_size)
+static void do_audio_out(AVFormatContext *s, OutputStream *ost,
+ AVFrame *frame)
{
AVCodecContext *enc = ost->st->codec;
- AVFrame *frame = NULL;
AVPacket pkt;
- int ret, got_packet;
+ int got_packet = 0;
av_init_packet(&pkt);
pkt.data = NULL;
pkt.size = 0;
- if (buf) {
- if (!ost->output_frame) {
- ost->output_frame = avcodec_alloc_frame();
- if (!ost->output_frame) {
- av_log(NULL, AV_LOG_FATAL, "out-of-memory in encode_audio_frame()\n");
- exit_program(1);
- }
- }
- frame = ost->output_frame;
- if (frame->extended_data != frame->data)
- av_freep(&frame->extended_data);
- avcodec_get_frame_defaults(frame);
-
- frame->nb_samples = buf_size /
- (enc->channels * av_get_bytes_per_sample(enc->sample_fmt));
- if ((ret = avcodec_fill_audio_frame(frame, enc->channels, enc->sample_fmt,
- buf, buf_size, 1)) < 0) {
- av_log(NULL, AV_LOG_FATAL, "Audio encoding failed\n");
- exit_program(1);
- }
- }
+ if (!check_recording_time(ost))
+ return;
+
+ if (frame->pts == AV_NOPTS_VALUE || audio_sync_method < 0)
+ frame->pts = ost->sync_opts;
+ ost->sync_opts = frame->pts + frame->nb_samples;
- got_packet = 0;
if (avcodec_encode_audio2(enc, &pkt, frame, &got_packet) < 0) {
av_log(NULL, AV_LOG_FATAL, "Audio encoding failed\n");
- exit_program(1);
+ exit(1);
}
if (got_packet) {
- pkt.stream_index = ost->index;
if (pkt.pts != AV_NOPTS_VALUE)
pkt.pts = av_rescale_q(pkt.pts, enc->time_base, ost->st->time_base);
+ if (pkt.dts != AV_NOPTS_VALUE)
+ pkt.dts = av_rescale_q(pkt.dts, enc->time_base, ost->st->time_base);
if (pkt.duration > 0)
pkt.duration = av_rescale_q(pkt.duration, enc->time_base, ost->st->time_base);
@@ -978,196 +402,6 @@ static int encode_audio_frame(AVFormatContext *s, OutputStream *ost,
audio_size += pkt.size;
}
-
- if (frame)
- ost->sync_opts += frame->nb_samples;
-
- return pkt.size;
-}
-
-static void do_audio_out(AVFormatContext *s, OutputStream *ost,
- InputStream *ist, AVFrame *decoded_frame)
-{
- uint8_t *buftmp;
- int64_t audio_buf_size;
-
- int size_out, frame_bytes, resample_changed;
- AVCodecContext *enc = ost->st->codec;
- AVCodecContext *dec = ist->st->codec;
- int osize = av_get_bytes_per_sample(enc->sample_fmt);
- int isize = av_get_bytes_per_sample(dec->sample_fmt);
- uint8_t *buf = decoded_frame->data[0];
- int size = decoded_frame->nb_samples * dec->channels * isize;
- int64_t allocated_for_size = size;
-
-need_realloc:
- audio_buf_size = (allocated_for_size + isize * dec->channels - 1) / (isize * dec->channels);
- audio_buf_size = (audio_buf_size * enc->sample_rate + dec->sample_rate) / dec->sample_rate;
- audio_buf_size = audio_buf_size * 2 + 10000; // safety factors for the deprecated resampling API
- audio_buf_size = FFMAX(audio_buf_size, enc->frame_size);
- audio_buf_size *= osize * enc->channels;
-
- if (audio_buf_size > INT_MAX) {
- av_log(NULL, AV_LOG_FATAL, "Buffer sizes too large\n");
- exit_program(1);
- }
-
- av_fast_malloc(&audio_buf, &allocated_audio_buf_size, audio_buf_size);
- if (!audio_buf) {
- av_log(NULL, AV_LOG_FATAL, "Out of memory in do_audio_out\n");
- exit_program(1);
- }
-
- if (enc->channels != dec->channels || enc->sample_rate != dec->sample_rate)
- ost->audio_resample = 1;
-
- resample_changed = ost->resample_sample_fmt != dec->sample_fmt ||
- ost->resample_channels != dec->channels ||
- ost->resample_sample_rate != dec->sample_rate;
-
- if ((ost->audio_resample && !ost->resample) || resample_changed) {
- if (resample_changed) {
- av_log(NULL, AV_LOG_INFO, "Input stream #%d:%d frame changed from rate:%d fmt:%s ch:%d to rate:%d fmt:%s ch:%d\n",
- ist->file_index, ist->st->index,
- ost->resample_sample_rate, av_get_sample_fmt_name(ost->resample_sample_fmt), ost->resample_channels,
- dec->sample_rate, av_get_sample_fmt_name(dec->sample_fmt), dec->channels);
- ost->resample_sample_fmt = dec->sample_fmt;
- ost->resample_channels = dec->channels;
- ost->resample_sample_rate = dec->sample_rate;
- if (ost->resample)
- audio_resample_close(ost->resample);
- }
- /* if audio_sync_method is >1 the resampler is needed for audio drift compensation */
- if (audio_sync_method <= 1 &&
- ost->resample_sample_fmt == enc->sample_fmt &&
- ost->resample_channels == enc->channels &&
- ost->resample_sample_rate == enc->sample_rate) {
- ost->resample = NULL;
- ost->audio_resample = 0;
- } else if (ost->audio_resample) {
- if (dec->sample_fmt != AV_SAMPLE_FMT_S16)
- av_log(NULL, AV_LOG_WARNING, "Using s16 intermediate sample format for resampling\n");
- ost->resample = av_audio_resample_init(enc->channels, dec->channels,
- enc->sample_rate, dec->sample_rate,
- enc->sample_fmt, dec->sample_fmt,
- 16, 10, 0, 0.8);
- if (!ost->resample) {
- av_log(NULL, AV_LOG_FATAL, "Can not resample %d channels @ %d Hz to %d channels @ %d Hz\n",
- dec->channels, dec->sample_rate,
- enc->channels, enc->sample_rate);
- exit_program(1);
- }
- }
- }
-
-#define MAKE_SFMT_PAIR(a,b) ((a)+AV_SAMPLE_FMT_NB*(b))
- if (!ost->audio_resample && dec->sample_fmt != enc->sample_fmt &&
- MAKE_SFMT_PAIR(enc->sample_fmt,dec->sample_fmt) != ost->reformat_pair) {
- if (ost->reformat_ctx)
- av_audio_convert_free(ost->reformat_ctx);
- ost->reformat_ctx = av_audio_convert_alloc(enc->sample_fmt, 1,
- dec->sample_fmt, 1, NULL, 0);
- if (!ost->reformat_ctx) {
- av_log(NULL, AV_LOG_FATAL, "Cannot convert %s sample format to %s sample format\n",
- av_get_sample_fmt_name(dec->sample_fmt),
- av_get_sample_fmt_name(enc->sample_fmt));
- exit_program(1);
- }
- ost->reformat_pair = MAKE_SFMT_PAIR(enc->sample_fmt,dec->sample_fmt);
- }
-
- if (audio_sync_method) {
- double delta = get_sync_ipts(ost) * enc->sample_rate - ost->sync_opts -
- av_fifo_size(ost->fifo) / (enc->channels * osize);
- int idelta = delta * dec->sample_rate / enc->sample_rate;
- int byte_delta = idelta * isize * dec->channels;
-
- // FIXME resample delay
- if (fabs(delta) > 50) {
- if (ist->is_start || fabs(delta) > audio_drift_threshold*enc->sample_rate) {
- if (byte_delta < 0) {
- byte_delta = FFMAX(byte_delta, -size);
- size += byte_delta;
- buf -= byte_delta;
- av_log(NULL, AV_LOG_VERBOSE, "discarding %d audio samples\n",
- -byte_delta / (isize * dec->channels));
- if (!size)
- return;
- ist->is_start = 0;
- } else {
- static uint8_t *input_tmp = NULL;
- input_tmp = av_realloc(input_tmp, byte_delta + size);
-
- if (byte_delta > allocated_for_size - size) {
- allocated_for_size = byte_delta + (int64_t)size;
- goto need_realloc;
- }
- ist->is_start = 0;
-
- generate_silence(input_tmp, dec->sample_fmt, byte_delta);
- memcpy(input_tmp + byte_delta, buf, size);
- buf = input_tmp;
- size += byte_delta;
- av_log(NULL, AV_LOG_VERBOSE, "adding %d audio samples of silence\n", idelta);
- }
- } else if (audio_sync_method > 1) {
- int comp = av_clip(delta, -audio_sync_method, audio_sync_method);
- av_assert0(ost->audio_resample);
- av_log(NULL, AV_LOG_VERBOSE, "compensating audio timestamp drift:%f compensation:%d in:%d\n",
- delta, comp, enc->sample_rate);
-// fprintf(stderr, "drift:%f len:%d opts:%"PRId64" ipts:%"PRId64" fifo:%d\n", delta, -1, ost->sync_opts, (int64_t)(get_sync_ipts(ost) * enc->sample_rate), av_fifo_size(ost->fifo)/(ost->st->codec->channels * 2));
- av_resample_compensate(*(struct AVResampleContext**)ost->resample, comp, enc->sample_rate);
- }
- }
- } else
- ost->sync_opts = lrintf(get_sync_ipts(ost) * enc->sample_rate) -
- av_fifo_size(ost->fifo) / (enc->channels * osize); // FIXME wrong
-
- if (ost->audio_resample) {
- buftmp = audio_buf;
- size_out = audio_resample(ost->resample,
- (short *)buftmp, (short *)buf,
- size / (dec->channels * isize));
- size_out = size_out * enc->channels * osize;
- } else {
- buftmp = buf;
- size_out = size;
- }
-
- if (!ost->audio_resample && dec->sample_fmt != enc->sample_fmt) {
- const void *ibuf[6] = { buftmp };
- void *obuf[6] = { audio_buf };
- int istride[6] = { isize };
- int ostride[6] = { osize };
- int len = size_out / istride[0];
- if (av_audio_convert(ost->reformat_ctx, obuf, ostride, ibuf, istride, len) < 0) {
- printf("av_audio_convert() failed\n");
- if (exit_on_error)
- exit_program(1);
- return;
- }
- buftmp = audio_buf;
- size_out = len * osize;
- }
-
- /* now encode as many frames as possible */
- if (!(enc->codec->capabilities & CODEC_CAP_VARIABLE_FRAME_SIZE)) {
- /* output resampled raw samples */
- if (av_fifo_realloc2(ost->fifo, av_fifo_size(ost->fifo) + size_out) < 0) {
- av_log(NULL, AV_LOG_FATAL, "av_fifo_realloc2() failed\n");
- exit_program(1);
- }
- av_fifo_generic_write(ost->fifo, buftmp, size_out, NULL);
-
- frame_bytes = enc->frame_size * osize * enc->channels;
-
- while (av_fifo_size(ost->fifo) >= frame_bytes) {
- av_fifo_generic_read(ost->fifo, audio_buf, frame_bytes, NULL);
- encode_audio_frame(s, ost, audio_buf, frame_bytes);
- }
- } else {
- encode_audio_frame(s, ost, buftmp, size_out);
- }
}
static void pre_process_video_frame(InputStream *ist, AVPicture *picture, void **bufp)
@@ -1224,7 +458,7 @@ static void do_subtitle_out(AVFormatContext *s,
if (pts == AV_NOPTS_VALUE) {
av_log(NULL, AV_LOG_ERROR, "Subtitle packets must have a pts\n");
if (exit_on_error)
- exit_program(1);
+ exit(1);
return;
}
@@ -1237,12 +471,16 @@ static void do_subtitle_out(AVFormatContext *s,
/* Note: DVB subtitle need one packet to draw them and one other
packet to clear them */
/* XXX: signal it in the codec context ? */
- if (enc->codec_id == CODEC_ID_DVB_SUBTITLE)
+ if (enc->codec_id == AV_CODEC_ID_DVB_SUBTITLE)
nb = 2;
else
nb = 1;
for (i = 0; i < nb; i++) {
+ ost->sync_opts = av_rescale_q(pts, ist->st->time_base, enc->time_base);
+ if (!check_recording_time(ost))
+ return;
+
sub->pts = av_rescale_q(pts, ist->st->time_base, AV_TIME_BASE_Q);
// start_display_time is required to be 0
sub->pts += av_rescale_q(sub->start_display_time, (AVRational){ 1, 1000 }, AV_TIME_BASE_Q);
@@ -1252,15 +490,14 @@ static void do_subtitle_out(AVFormatContext *s,
subtitle_out_max_size, sub);
if (subtitle_out_size < 0) {
av_log(NULL, AV_LOG_FATAL, "Subtitle encoding failed\n");
- exit_program(1);
+ exit(1);
}
av_init_packet(&pkt);
- pkt.stream_index = ost->index;
pkt.data = subtitle_out;
pkt.size = subtitle_out_size;
pkt.pts = av_rescale_q(sub->pts, AV_TIME_BASE_Q, ost->st->time_base);
- if (enc->codec_id == CODEC_ID_DVB_SUBTITLE) {
+ if (enc->codec_id == AV_CODEC_ID_DVB_SUBTITLE) {
/* XXX: the pts correction is handled here. Maybe handling
it in the codec would be better */
if (i == 0)
@@ -1272,79 +509,14 @@ static void do_subtitle_out(AVFormatContext *s,
}
}
-static int bit_buffer_size = 1024 * 256;
-static uint8_t *bit_buffer = NULL;
-
-#if !CONFIG_AVFILTER
-static void do_video_resample(OutputStream *ost,
- InputStream *ist,
- AVFrame *in_picture,
- AVFrame **out_picture)
-{
- int resample_changed = 0;
- *out_picture = in_picture;
-
- resample_changed = ost->resample_width != in_picture->width ||
- ost->resample_height != in_picture->height ||
- ost->resample_pix_fmt != in_picture->format;
-
- if (resample_changed) {
- av_log(NULL, AV_LOG_INFO,
- "Input stream #%d:%d frame changed from size:%dx%d fmt:%s to size:%dx%d fmt:%s\n",
- ist->file_index, ist->st->index,
- ost->resample_width, ost->resample_height, av_get_pix_fmt_name(ost->resample_pix_fmt),
- in_picture->width, in_picture->height, av_get_pix_fmt_name(in_picture->format));
- if (!ost->video_resample)
- ost->video_resample = 1;
- }
-
- if (ost->video_resample) {
- *out_picture = &ost->pict_tmp;
- if (resample_changed) {
- /* initialize a new scaler context */
- sws_freeContext(ost->img_resample_ctx);
- ost->img_resample_ctx = sws_getContext(
- ist->st->codec->width,
- ist->st->codec->height,
- ist->st->codec->pix_fmt,
- ost->st->codec->width,
- ost->st->codec->height,
- ost->st->codec->pix_fmt,
- ost->sws_flags, NULL, NULL, NULL);
- if (ost->img_resample_ctx == NULL) {
- av_log(NULL, AV_LOG_FATAL, "Cannot get resampling context\n");
- exit_program(1);
- }
- }
- sws_scale(ost->img_resample_ctx, in_picture->data, in_picture->linesize,
- 0, ost->resample_height, (*out_picture)->data, (*out_picture)->linesize);
- }
- if (resample_changed) {
- ost->resample_width = in_picture->width;
- ost->resample_height = in_picture->height;
- ost->resample_pix_fmt = in_picture->format;
- }
-}
-#endif
-
-
static void do_video_out(AVFormatContext *s,
OutputStream *ost,
- InputStream *ist,
AVFrame *in_picture,
- int *frame_size, float quality)
+ int *frame_size)
{
- int nb_frames, i, ret, format_video_sync;
- AVFrame *final_picture;
- AVCodecContext *enc;
- double sync_ipts;
-
- enc = ost->st->codec;
-
- sync_ipts = get_sync_ipts(ost) / av_q2d(enc->time_base);
-
- /* by default, we output a single frame */
- nb_frames = 1;
+ int ret, format_video_sync;
+ AVPacket pkt;
+ AVCodecContext *enc = ost->st->codec;
*frame_size = 0;
@@ -1352,125 +524,96 @@ static void do_video_out(AVFormatContext *s,
if (format_video_sync == VSYNC_AUTO)
format_video_sync = (s->oformat->flags & AVFMT_NOTIMESTAMPS) ? VSYNC_PASSTHROUGH :
(s->oformat->flags & AVFMT_VARIABLE_FPS) ? VSYNC_VFR : VSYNC_CFR;
+ if (format_video_sync != VSYNC_PASSTHROUGH &&
+ ost->frame_number &&
+ in_picture->pts != AV_NOPTS_VALUE &&
+ in_picture->pts < ost->sync_opts) {
+ nb_frames_drop++;
+ av_log(NULL, AV_LOG_VERBOSE, "*** drop!\n");
+ return;
+ }
+
+ if (in_picture->pts == AV_NOPTS_VALUE)
+ in_picture->pts = ost->sync_opts;
+ ost->sync_opts = in_picture->pts;
- if (format_video_sync != VSYNC_PASSTHROUGH) {
- double vdelta = sync_ipts - ost->sync_opts;
- // FIXME set to 0.5 after we fix some dts/pts bugs like in avidec.c
- if (vdelta < -1.1)
- nb_frames = 0;
- else if (format_video_sync == VSYNC_VFR) {
- if (vdelta <= -0.6) {
- nb_frames = 0;
- } else if (vdelta > 0.6)
- ost->sync_opts = lrintf(sync_ipts);
- } else if (vdelta > 1.1)
- nb_frames = lrintf(vdelta);
-//fprintf(stderr, "vdelta:%f, ost->sync_opts:%"PRId64", ost->sync_ipts:%f nb_frames:%d\n", vdelta, ost->sync_opts, get_sync_ipts(ost), nb_frames);
- if (nb_frames == 0) {
- ++nb_frames_drop;
- av_log(NULL, AV_LOG_VERBOSE, "*** drop!\n");
- } else if (nb_frames > 1) {
- nb_frames_dup += nb_frames - 1;
- av_log(NULL, AV_LOG_VERBOSE, "*** %d dup!\n", nb_frames - 1);
- }
- } else
- ost->sync_opts = lrintf(sync_ipts);
- nb_frames = FFMIN(nb_frames, ost->max_frames - ost->frame_number);
- if (nb_frames <= 0)
+ if (!ost->frame_number)
+ ost->first_pts = in_picture->pts;
+
+ av_init_packet(&pkt);
+ pkt.data = NULL;
+ pkt.size = 0;
+
+ if (!check_recording_time(ost) ||
+ ost->frame_number >= ost->max_frames)
return;
-#if !CONFIG_AVFILTER
- do_video_resample(ost, ist, in_picture, &final_picture);
-#else
- final_picture = in_picture;
-#endif
+ if (s->oformat->flags & AVFMT_RAWPICTURE &&
+ enc->codec->id == AV_CODEC_ID_RAWVIDEO) {
+ /* raw pictures are written as AVPicture structure to
+ avoid any copies. We support temporarily the older
+ method. */
+ enc->coded_frame->interlaced_frame = in_picture->interlaced_frame;
+ enc->coded_frame->top_field_first = in_picture->top_field_first;
+ pkt.data = (uint8_t *)in_picture;
+ pkt.size = sizeof(AVPicture);
+ pkt.pts = av_rescale_q(in_picture->pts, enc->time_base, ost->st->time_base);
+ pkt.flags |= AV_PKT_FLAG_KEY;
- /* duplicates frame if needed */
- for (i = 0; i < nb_frames; i++) {
- AVPacket pkt;
- av_init_packet(&pkt);
- pkt.stream_index = ost->index;
-
- if (s->oformat->flags & AVFMT_RAWPICTURE &&
- enc->codec->id == CODEC_ID_RAWVIDEO) {
- /* raw pictures are written as AVPicture structure to
- avoid any copies. We support temporarily the older
- method. */
- enc->coded_frame->interlaced_frame = in_picture->interlaced_frame;
- enc->coded_frame->top_field_first = in_picture->top_field_first;
- pkt.data = (uint8_t *)final_picture;
- pkt.size = sizeof(AVPicture);
- pkt.pts = av_rescale_q(ost->sync_opts, enc->time_base, ost->st->time_base);
- pkt.flags |= AV_PKT_FLAG_KEY;
+ write_frame(s, &pkt, ost);
+ } else {
+ int got_packet;
+ AVFrame big_picture;
+
+ big_picture = *in_picture;
+ /* better than nothing: use input picture interlaced
+ settings */
+ big_picture.interlaced_frame = in_picture->interlaced_frame;
+ if (ost->st->codec->flags & (CODEC_FLAG_INTERLACED_DCT|CODEC_FLAG_INTERLACED_ME)) {
+ if (ost->top_field_first == -1)
+ big_picture.top_field_first = in_picture->top_field_first;
+ else
+ big_picture.top_field_first = !!ost->top_field_first;
+ }
- write_frame(s, &pkt, ost);
- } else {
- AVFrame big_picture;
-
- big_picture = *final_picture;
- /* better than nothing: use input picture interlaced
- settings */
- big_picture.interlaced_frame = in_picture->interlaced_frame;
- if (ost->st->codec->flags & (CODEC_FLAG_INTERLACED_DCT|CODEC_FLAG_INTERLACED_ME)) {
- if (ost->top_field_first == -1)
- big_picture.top_field_first = in_picture->top_field_first;
- else
- big_picture.top_field_first = !!ost->top_field_first;
- }
+ big_picture.quality = ost->st->codec->global_quality;
+ if (!enc->me_threshold)
+ big_picture.pict_type = 0;
+ if (ost->forced_kf_index < ost->forced_kf_count &&
+ big_picture.pts >= ost->forced_kf_pts[ost->forced_kf_index]) {
+ big_picture.pict_type = AV_PICTURE_TYPE_I;
+ ost->forced_kf_index++;
+ }
+ ret = avcodec_encode_video2(enc, &pkt, &big_picture, &got_packet);
+ if (ret < 0) {
+ av_log(NULL, AV_LOG_FATAL, "Video encoding failed\n");
+ exit(1);
+ }
- /* handles same_quant here. This is not correct because it may
- not be a global option */
- big_picture.quality = quality;
- if (!enc->me_threshold)
- big_picture.pict_type = 0;
-// big_picture.pts = AV_NOPTS_VALUE;
- big_picture.pts = ost->sync_opts;
-// big_picture.pts= av_rescale(ost->sync_opts, AV_TIME_BASE*(int64_t)enc->time_base.num, enc->time_base.den);
-// av_log(NULL, AV_LOG_DEBUG, "%"PRId64" -> encoder\n", ost->sync_opts);
- if (ost->forced_kf_index < ost->forced_kf_count &&
- big_picture.pts >= ost->forced_kf_pts[ost->forced_kf_index]) {
- big_picture.pict_type = AV_PICTURE_TYPE_I;
- ost->forced_kf_index++;
- }
- ret = avcodec_encode_video(enc,
- bit_buffer, bit_buffer_size,
- &big_picture);
- if (ret < 0) {
- av_log(NULL, AV_LOG_FATAL, "Video encoding failed\n");
- exit_program(1);
- }
+ if (got_packet) {
+ if (pkt.pts != AV_NOPTS_VALUE)
+ pkt.pts = av_rescale_q(pkt.pts, enc->time_base, ost->st->time_base);
+ if (pkt.dts != AV_NOPTS_VALUE)
+ pkt.dts = av_rescale_q(pkt.dts, enc->time_base, ost->st->time_base);
- if (ret > 0) {
- pkt.data = bit_buffer;
- pkt.size = ret;
- if (enc->coded_frame->pts != AV_NOPTS_VALUE)
- pkt.pts = av_rescale_q(enc->coded_frame->pts, enc->time_base, ost->st->time_base);
-/*av_log(NULL, AV_LOG_DEBUG, "encoder -> %"PRId64"/%"PRId64"\n",
- pkt.pts != AV_NOPTS_VALUE ? av_rescale(pkt.pts, enc->time_base.den, AV_TIME_BASE*(int64_t)enc->time_base.num) : -1,
- pkt.dts != AV_NOPTS_VALUE ? av_rescale(pkt.dts, enc->time_base.den, AV_TIME_BASE*(int64_t)enc->time_base.num) : -1);*/
-
- if (enc->coded_frame->key_frame)
- pkt.flags |= AV_PKT_FLAG_KEY;
- write_frame(s, &pkt, ost);
- *frame_size = ret;
- video_size += ret;
- // fprintf(stderr,"\nFrame: %3d size: %5d type: %d",
- // enc->frame_number-1, ret, enc->pict_type);
- /* if two pass, output log */
- if (ost->logfile && enc->stats_out) {
- fprintf(ost->logfile, "%s", enc->stats_out);
- }
+ write_frame(s, &pkt, ost);
+ *frame_size = pkt.size;
+ video_size += pkt.size;
+
+ /* if two pass, output log */
+ if (ost->logfile && enc->stats_out) {
+ fprintf(ost->logfile, "%s", enc->stats_out);
}
}
- ost->sync_opts++;
- /*
- * For video, number of frames in == number of packets out.
- * But there may be reordering, so we can't throw away frames on encoder
- * flush, we need to limit them here, before they go into encoder.
- */
- ost->frame_number++;
}
+ ost->sync_opts++;
+ /*
+ * For video, number of frames in == number of packets out.
+ * But there may be reordering, so we can't throw away frames on encoder
+ * flush, we need to limit them here, before they go into encoder.
+ */
+ ost->frame_number++;
}
static double psnr(double d)
@@ -1478,8 +621,7 @@ static double psnr(double d)
return -10.0 * log(d) / log(10.0);
}
-static void do_video_stats(AVFormatContext *os, OutputStream *ost,
- int frame_size)
+static void do_video_stats(OutputStream *ost, int frame_size)
{
AVCodecContext *enc;
int frame_number;
@@ -1490,7 +632,7 @@ static void do_video_stats(AVFormatContext *os, OutputStream *ost,
vstats_file = fopen(vstats_filename, "w");
if (!vstats_file) {
perror("fopen");
- exit_program(1);
+ exit(1);
}
}
@@ -1515,9 +657,124 @@ static void do_video_stats(AVFormatContext *os, OutputStream *ost,
}
}
-static void print_report(OutputFile *output_files,
- OutputStream *ost_table, int nb_ostreams,
- int is_last_report, int64_t timer_start)
+/*
+ * Read one frame for lavfi output for ost and encode it.
+ */
+static int poll_filter(OutputStream *ost)
+{
+ OutputFile *of = output_files[ost->file_index];
+ AVFilterBufferRef *picref;
+ AVFrame *filtered_frame = NULL;
+ int frame_size, ret;
+
+ if (!ost->filtered_frame && !(ost->filtered_frame = avcodec_alloc_frame())) {
+ return AVERROR(ENOMEM);
+ } else
+ avcodec_get_frame_defaults(ost->filtered_frame);
+ filtered_frame = ost->filtered_frame;
+
+ if (ost->enc->type == AVMEDIA_TYPE_AUDIO &&
+ !(ost->enc->capabilities & CODEC_CAP_VARIABLE_FRAME_SIZE))
+ ret = av_buffersink_read_samples(ost->filter->filter, &picref,
+ ost->st->codec->frame_size);
+ else
+ ret = av_buffersink_read(ost->filter->filter, &picref);
+
+ if (ret < 0)
+ return ret;
+
+ avfilter_copy_buf_props(filtered_frame, picref);
+ if (picref->pts != AV_NOPTS_VALUE) {
+ filtered_frame->pts = av_rescale_q(picref->pts,
+ ost->filter->filter->inputs[0]->time_base,
+ ost->st->codec->time_base) -
+ av_rescale_q(of->start_time,
+ AV_TIME_BASE_Q,
+ ost->st->codec->time_base);
+
+ if (of->start_time && filtered_frame->pts < 0) {
+ avfilter_unref_buffer(picref);
+ return 0;
+ }
+ }
+
+ switch (ost->filter->filter->inputs[0]->type) {
+ case AVMEDIA_TYPE_VIDEO:
+ if (!ost->frame_aspect_ratio)
+ ost->st->codec->sample_aspect_ratio = picref->video->pixel_aspect;
+
+ do_video_out(of->ctx, ost, filtered_frame, &frame_size);
+ if (vstats_filename && frame_size)
+ do_video_stats(ost, frame_size);
+ break;
+ case AVMEDIA_TYPE_AUDIO:
+ do_audio_out(of->ctx, ost, filtered_frame);
+ break;
+ default:
+ // TODO support subtitle filters
+ av_assert0(0);
+ }
+
+ avfilter_unref_buffer(picref);
+
+ return 0;
+}
+
+/*
+ * Read as many frames from possible from lavfi and encode them.
+ *
+ * Always read from the active stream with the lowest timestamp. If no frames
+ * are available for it then return EAGAIN and wait for more input. This way we
+ * can use lavfi sources that generate unlimited amount of frames without memory
+ * usage exploding.
+ */
+static int poll_filters(void)
+{
+ int i, j, ret = 0;
+
+ while (ret >= 0 && !received_sigterm) {
+ OutputStream *ost = NULL;
+ int64_t min_pts = INT64_MAX;
+
+ /* choose output stream with the lowest timestamp */
+ for (i = 0; i < nb_output_streams; i++) {
+ int64_t pts = output_streams[i]->sync_opts;
+
+ if (!output_streams[i]->filter || output_streams[i]->finished)
+ continue;
+
+ pts = av_rescale_q(pts, output_streams[i]->st->codec->time_base,
+ AV_TIME_BASE_Q);
+ if (pts < min_pts) {
+ min_pts = pts;
+ ost = output_streams[i];
+ }
+ }
+
+ if (!ost)
+ break;
+
+ ret = poll_filter(ost);
+
+ if (ret == AVERROR_EOF) {
+ OutputFile *of = output_files[ost->file_index];
+
+ ost->finished = 1;
+
+ if (of->shortest) {
+ for (j = 0; j < of->ctx->nb_streams; j++)
+ output_streams[of->ost_index + j]->finished = 1;
+ }
+
+ ret = 0;
+ } else if (ret == AVERROR(EAGAIN))
+ return 0;
+ }
+
+ return ret;
+}
+
+static void print_report(int is_last_report, int64_t timer_start)
{
char buf[1024];
OutputStream *ost;
@@ -1546,18 +803,25 @@ static void print_report(OutputFile *output_files,
}
- oc = output_files[0].ctx;
+ oc = output_files[0]->ctx;
total_size = avio_size(oc->pb);
- if (total_size < 0) // FIXME improve avio_size() so it works with non seekable output too
+ if (total_size <= 0) // FIXME improve avio_size() so it works with non seekable output too
total_size = avio_tell(oc->pb);
+ if (total_size < 0) {
+ char errbuf[128];
+ av_strerror(total_size, errbuf, sizeof(errbuf));
+ av_log(NULL, AV_LOG_VERBOSE, "Bitrate not available, "
+ "avio_tell() failed: %s\n", errbuf);
+ total_size = 0;
+ }
buf[0] = '\0';
ti1 = 1e10;
vid = 0;
- for (i = 0; i < nb_ostreams; i++) {
+ for (i = 0; i < nb_output_streams; i++) {
float q = -1;
- ost = &ost_table[i];
+ ost = output_streams[i];
enc = ost->st->codec;
if (!ost->stream_copy && enc->coded_frame)
q = enc->coded_frame->quality / (float)FF_QP2LAMBDA;
@@ -1578,7 +842,7 @@ static void print_report(OutputFile *output_files,
if (qp >= 0 && qp < FF_ARRAY_ELEMS(qp_histogram))
qp_histogram[qp]++;
for (j = 0; j < 32; j++)
- snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "%X", (int)lrintf(log(qp_histogram[j] + 1) / log(2)));
+ snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "%X", (int)lrintf(log2(qp_histogram[j] + 1)));
}
if (enc->flags&CODEC_FLAG_PSNR) {
int j;
@@ -1638,14 +902,14 @@ static void print_report(OutputFile *output_files,
}
}
-static void flush_encoders(OutputStream *ost_table, int nb_ostreams)
+static void flush_encoders(void)
{
int i, ret;
- for (i = 0; i < nb_ostreams; i++) {
- OutputStream *ost = &ost_table[i];
+ for (i = 0; i < nb_output_streams; i++) {
+ OutputStream *ost = output_streams[i];
AVCodecContext *enc = ost->st->codec;
- AVFormatContext *os = output_files[ost->file_index].ctx;
+ AVFormatContext *os = output_files[ost->file_index]->ctx;
int stop_encoding = 0;
if (!ost->encoding_needed)
@@ -1653,69 +917,58 @@ static void flush_encoders(OutputStream *ost_table, int nb_ostreams)
if (ost->st->codec->codec_type == AVMEDIA_TYPE_AUDIO && enc->frame_size <= 1)
continue;
- if (ost->st->codec->codec_type == AVMEDIA_TYPE_VIDEO && (os->oformat->flags & AVFMT_RAWPICTURE) && enc->codec->id == CODEC_ID_RAWVIDEO)
+ if (ost->st->codec->codec_type == AVMEDIA_TYPE_VIDEO && (os->oformat->flags & AVFMT_RAWPICTURE) && enc->codec->id == AV_CODEC_ID_RAWVIDEO)
continue;
for (;;) {
- AVPacket pkt;
- int fifo_bytes;
- av_init_packet(&pkt);
- pkt.data = NULL;
- pkt.size = 0;
+ int (*encode)(AVCodecContext*, AVPacket*, const AVFrame*, int*) = NULL;
+ const char *desc;
+ int64_t *size;
switch (ost->st->codec->codec_type) {
case AVMEDIA_TYPE_AUDIO:
- fifo_bytes = av_fifo_size(ost->fifo);
- if (fifo_bytes > 0) {
- /* encode any samples remaining in fifo */
- int frame_bytes = fifo_bytes;
-
- av_fifo_generic_read(ost->fifo, audio_buf, fifo_bytes, NULL);
-
- /* pad last frame with silence if needed */
- if (!(enc->codec->capabilities & CODEC_CAP_SMALL_LAST_FRAME)) {
- frame_bytes = enc->frame_size * enc->channels *
- av_get_bytes_per_sample(enc->sample_fmt);
- if (allocated_audio_buf_size < frame_bytes)
- exit_program(1);
- generate_silence(audio_buf+fifo_bytes, enc->sample_fmt, frame_bytes - fifo_bytes);
- }
- encode_audio_frame(os, ost, audio_buf, frame_bytes);
- } else {
- /* flush encoder with NULL frames until it is done
- returning packets */
- if (encode_audio_frame(os, ost, NULL, 0) == 0) {
- stop_encoding = 1;
- break;
- }
- }
+ encode = avcodec_encode_audio2;
+ desc = "Audio";
+ size = &audio_size;
break;
case AVMEDIA_TYPE_VIDEO:
- ret = avcodec_encode_video(enc, bit_buffer, bit_buffer_size, NULL);
+ encode = avcodec_encode_video2;
+ desc = "Video";
+ size = &video_size;
+ break;
+ default:
+ stop_encoding = 1;
+ }
+
+ if (encode) {
+ AVPacket pkt;
+ int got_packet;
+ av_init_packet(&pkt);
+ pkt.data = NULL;
+ pkt.size = 0;
+
+ ret = encode(enc, &pkt, NULL, &got_packet);
if (ret < 0) {
- av_log(NULL, AV_LOG_FATAL, "Video encoding failed\n");
- exit_program(1);
+ av_log(NULL, AV_LOG_FATAL, "%s encoding failed\n", desc);
+ exit(1);
}
- video_size += ret;
- if (enc->coded_frame && enc->coded_frame->key_frame)
- pkt.flags |= AV_PKT_FLAG_KEY;
+ *size += ret;
if (ost->logfile && enc->stats_out) {
fprintf(ost->logfile, "%s", enc->stats_out);
}
- if (ret <= 0) {
+ if (!got_packet) {
stop_encoding = 1;
break;
}
- pkt.stream_index = ost->index;
- pkt.data = bit_buffer;
- pkt.size = ret;
- if (enc->coded_frame && enc->coded_frame->pts != AV_NOPTS_VALUE)
- pkt.pts = av_rescale_q(enc->coded_frame->pts, enc->time_base, ost->st->time_base);
+ if (pkt.pts != AV_NOPTS_VALUE)
+ pkt.pts = av_rescale_q(pkt.pts, enc->time_base, ost->st->time_base);
+ if (pkt.dts != AV_NOPTS_VALUE)
+ pkt.dts = av_rescale_q(pkt.dts, enc->time_base, ost->st->time_base);
+ if (pkt.duration > 0)
+ pkt.duration = av_rescale_q(pkt.duration, enc->time_base, ost->st->time_base);
write_frame(os, &pkt, ost);
- break;
- default:
- stop_encoding = 1;
}
+
if (stop_encoding)
break;
}
@@ -1727,28 +980,21 @@ static void flush_encoders(OutputStream *ost_table, int nb_ostreams)
*/
static int check_output_constraints(InputStream *ist, OutputStream *ost)
{
- OutputFile *of = &output_files[ost->file_index];
- int ist_index = ist - input_streams;
+ OutputFile *of = output_files[ost->file_index];
+ int ist_index = input_files[ist->file_index]->ist_index + ist->st->index;
if (ost->source_index != ist_index)
return 0;
- if (of->start_time && ist->pts < of->start_time)
- return 0;
-
- if (of->recording_time != INT64_MAX &&
- av_compare_ts(ist->pts, AV_TIME_BASE_Q, of->recording_time + of->start_time,
- (AVRational){ 1, 1000000 }) >= 0) {
- ost->is_past_recording_time = 1;
+ if (of->start_time && ist->last_dts < of->start_time)
return 0;
- }
return 1;
}
static void do_streamcopy(InputStream *ist, OutputStream *ost, const AVPacket *pkt)
{
- OutputFile *of = &output_files[ost->file_index];
+ OutputFile *of = output_files[ost->file_index];
int64_t ost_tb_start_time = av_rescale_q(of->start_time, AV_TIME_BASE_Q, ost->st->time_base);
AVPacket opkt;
@@ -1758,6 +1004,12 @@ static void do_streamcopy(InputStream *ist, OutputStream *ost, const AVPacket *p
!ost->copy_initial_nonkeyframes)
return;
+ if (of->recording_time != INT64_MAX &&
+ ist->last_dts >= of->recording_time + of->start_time) {
+ ost->finished = 1;
+ return;
+ }
+
/* force the input stream PTS */
if (ost->st->codec->codec_type == AVMEDIA_TYPE_AUDIO)
audio_size += pkt->size;
@@ -1766,14 +1018,13 @@ static void do_streamcopy(InputStream *ist, OutputStream *ost, const AVPacket *p
ost->sync_opts++;
}
- opkt.stream_index = ost->index;
if (pkt->pts != AV_NOPTS_VALUE)
opkt.pts = av_rescale_q(pkt->pts, ist->st->time_base, ost->st->time_base) - ost_tb_start_time;
else
opkt.pts = AV_NOPTS_VALUE;
if (pkt->dts == AV_NOPTS_VALUE)
- opkt.dts = av_rescale_q(ist->pts, AV_TIME_BASE_Q, ost->st->time_base);
+ opkt.dts = av_rescale_q(ist->last_dts, AV_TIME_BASE_Q, ost->st->time_base);
else
opkt.dts = av_rescale_q(pkt->dts, ist->st->time_base, ost->st->time_base);
opkt.dts -= ost_tb_start_time;
@@ -1782,9 +1033,10 @@ static void do_streamcopy(InputStream *ist, OutputStream *ost, const AVPacket *p
opkt.flags = pkt->flags;
// FIXME remove the following 2 lines they shall be replaced by the bitstream filters
- if ( ost->st->codec->codec_id != CODEC_ID_H264
- && ost->st->codec->codec_id != CODEC_ID_MPEG1VIDEO
- && ost->st->codec->codec_id != CODEC_ID_MPEG2VIDEO
+ if ( ost->st->codec->codec_id != AV_CODEC_ID_H264
+ && ost->st->codec->codec_id != AV_CODEC_ID_MPEG1VIDEO
+ && ost->st->codec->codec_id != AV_CODEC_ID_MPEG2VIDEO
+ && ost->st->codec->codec_id != AV_CODEC_ID_VC1
) {
if (av_parser_change(ist->st->parser, ost->st->codec, &opkt.data, &opkt.size, pkt->data, pkt->size, pkt->flags & AV_PKT_FLAG_KEY))
opkt.destruct = av_destruct_packet;
@@ -1795,199 +1047,174 @@ static void do_streamcopy(InputStream *ist, OutputStream *ost, const AVPacket *p
write_frame(of->ctx, &opkt, ost);
ost->st->codec->frame_number++;
- av_free_packet(&opkt);
}
static void rate_emu_sleep(InputStream *ist)
{
- if (input_files[ist->file_index].rate_emu) {
- int64_t pts = av_rescale(ist->pts, 1000000, AV_TIME_BASE);
+ if (input_files[ist->file_index]->rate_emu) {
+ int64_t pts = av_rescale(ist->last_dts, 1000000, AV_TIME_BASE);
int64_t now = av_gettime() - ist->start;
if (pts > now)
- usleep(pts - now);
+ av_usleep(pts - now);
+ }
+}
+
+int guess_input_channel_layout(InputStream *ist)
+{
+ AVCodecContext *dec = ist->st->codec;
+
+ if (!dec->channel_layout) {
+ char layout_name[256];
+
+ dec->channel_layout = av_get_default_channel_layout(dec->channels);
+ if (!dec->channel_layout)
+ return 0;
+ av_get_channel_layout_string(layout_name, sizeof(layout_name),
+ dec->channels, dec->channel_layout);
+ av_log(NULL, AV_LOG_WARNING, "Guessed Channel Layout for Input Stream "
+ "#%d.%d : %s\n", ist->file_index, ist->st->index, layout_name);
}
+ return 1;
}
-static int transcode_audio(InputStream *ist, AVPacket *pkt, int *got_output)
+static int decode_audio(InputStream *ist, AVPacket *pkt, int *got_output)
{
AVFrame *decoded_frame;
AVCodecContext *avctx = ist->st->codec;
- int bps = av_get_bytes_per_sample(ist->st->codec->sample_fmt);
- int i, ret;
+ int i, ret, resample_changed;
if (!ist->decoded_frame && !(ist->decoded_frame = avcodec_alloc_frame()))
return AVERROR(ENOMEM);
- else
- avcodec_get_frame_defaults(ist->decoded_frame);
decoded_frame = ist->decoded_frame;
ret = avcodec_decode_audio4(avctx, decoded_frame, got_output, pkt);
- if (ret < 0) {
- return ret;
- }
-
- if (!*got_output) {
- /* no audio frame */
+ if (!*got_output || ret < 0) {
+ if (!pkt->size) {
+ for (i = 0; i < ist->nb_filters; i++)
+ av_buffersrc_buffer(ist->filters[i]->filter, NULL);
+ }
return ret;
}
/* if the decoder provides a pts, use it instead of the last packet pts.
the decoder could be delaying output by a packet or more. */
if (decoded_frame->pts != AV_NOPTS_VALUE)
- ist->next_pts = decoded_frame->pts;
-
- /* increment next_pts to use for the case where the input stream does not
- have timestamps or there are multiple frames in the packet */
- ist->next_pts += ((int64_t)AV_TIME_BASE * decoded_frame->nb_samples) /
- avctx->sample_rate;
-
- // preprocess audio (volume)
- if (audio_volume != 256) {
- int decoded_data_size = decoded_frame->nb_samples * avctx->channels * bps;
- void *samples = decoded_frame->data[0];
- switch (avctx->sample_fmt) {
- case AV_SAMPLE_FMT_U8:
- {
- uint8_t *volp = samples;
- for (i = 0; i < (decoded_data_size / sizeof(*volp)); i++) {
- int v = (((*volp - 128) * audio_volume + 128) >> 8) + 128;
- *volp++ = av_clip_uint8(v);
- }
- break;
- }
- case AV_SAMPLE_FMT_S16:
- {
- int16_t *volp = samples;
- for (i = 0; i < (decoded_data_size / sizeof(*volp)); i++) {
- int v = ((*volp) * audio_volume + 128) >> 8;
- *volp++ = av_clip_int16(v);
- }
- break;
- }
- case AV_SAMPLE_FMT_S32:
- {
- int32_t *volp = samples;
- for (i = 0; i < (decoded_data_size / sizeof(*volp)); i++) {
- int64_t v = (((int64_t)*volp * audio_volume + 128) >> 8);
- *volp++ = av_clipl_int32(v);
- }
- break;
- }
- case AV_SAMPLE_FMT_FLT:
- {
- float *volp = samples;
- float scale = audio_volume / 256.f;
- for (i = 0; i < (decoded_data_size / sizeof(*volp)); i++) {
- *volp++ *= scale;
- }
- break;
- }
- case AV_SAMPLE_FMT_DBL:
- {
- double *volp = samples;
- double scale = audio_volume / 256.;
- for (i = 0; i < (decoded_data_size / sizeof(*volp)); i++) {
- *volp++ *= scale;
- }
- break;
- }
- default:
- av_log(NULL, AV_LOG_FATAL,
- "Audio volume adjustment on sample format %s is not supported.\n",
- av_get_sample_fmt_name(ist->st->codec->sample_fmt));
- exit_program(1);
- }
+ ist->next_dts = decoded_frame->pts;
+ else if (pkt->pts != AV_NOPTS_VALUE) {
+ decoded_frame->pts = pkt->pts;
+ pkt->pts = AV_NOPTS_VALUE;
}
rate_emu_sleep(ist);
- for (i = 0; i < nb_output_streams; i++) {
- OutputStream *ost = &output_streams[i];
+ resample_changed = ist->resample_sample_fmt != decoded_frame->format ||
+ ist->resample_channels != avctx->channels ||
+ ist->resample_channel_layout != decoded_frame->channel_layout ||
+ ist->resample_sample_rate != decoded_frame->sample_rate;
+ if (resample_changed) {
+ char layout1[64], layout2[64];
- if (!check_output_constraints(ist, ost) || !ost->encoding_needed)
- continue;
- do_audio_out(output_files[ost->file_index].ctx, ost, ist, decoded_frame);
+ if (!guess_input_channel_layout(ist)) {
+ av_log(NULL, AV_LOG_FATAL, "Unable to find default channel "
+ "layout for Input Stream #%d.%d\n", ist->file_index,
+ ist->st->index);
+ exit(1);
+ }
+ decoded_frame->channel_layout = avctx->channel_layout;
+
+ av_get_channel_layout_string(layout1, sizeof(layout1), ist->resample_channels,
+ ist->resample_channel_layout);
+ av_get_channel_layout_string(layout2, sizeof(layout2), avctx->channels,
+ decoded_frame->channel_layout);
+
+ av_log(NULL, AV_LOG_INFO,
+ "Input stream #%d:%d frame changed from rate:%d fmt:%s ch:%d chl:%s to rate:%d fmt:%s ch:%d chl:%s\n",
+ ist->file_index, ist->st->index,
+ ist->resample_sample_rate, av_get_sample_fmt_name(ist->resample_sample_fmt),
+ ist->resample_channels, layout1,
+ decoded_frame->sample_rate, av_get_sample_fmt_name(decoded_frame->format),
+ avctx->channels, layout2);
+
+ ist->resample_sample_fmt = decoded_frame->format;
+ ist->resample_sample_rate = decoded_frame->sample_rate;
+ ist->resample_channel_layout = decoded_frame->channel_layout;
+ ist->resample_channels = avctx->channels;
+
+ for (i = 0; i < nb_filtergraphs; i++)
+ if (ist_in_filtergraph(filtergraphs[i], ist) &&
+ configure_filtergraph(filtergraphs[i]) < 0) {
+ av_log(NULL, AV_LOG_FATAL, "Error reinitializing filters!\n");
+ exit(1);
+ }
}
+ if (decoded_frame->pts != AV_NOPTS_VALUE)
+ decoded_frame->pts = av_rescale_q(decoded_frame->pts,
+ ist->st->time_base,
+ (AVRational){1, ist->st->codec->sample_rate});
+ for (i = 0; i < ist->nb_filters; i++)
+ av_buffersrc_write_frame(ist->filters[i]->filter, decoded_frame);
+
return ret;
}
-static int transcode_video(InputStream *ist, AVPacket *pkt, int *got_output, int64_t *pkt_pts)
+static int decode_video(InputStream *ist, AVPacket *pkt, int *got_output)
{
- AVFrame *decoded_frame, *filtered_frame = NULL;
+ AVFrame *decoded_frame;
void *buffer_to_free = NULL;
- int i, ret = 0;
- float quality;
-#if CONFIG_AVFILTER
- int frame_available = 1;
-#endif
+ int i, ret = 0, resample_changed;
if (!ist->decoded_frame && !(ist->decoded_frame = avcodec_alloc_frame()))
return AVERROR(ENOMEM);
- else
- avcodec_get_frame_defaults(ist->decoded_frame);
decoded_frame = ist->decoded_frame;
- pkt->pts = *pkt_pts;
- pkt->dts = ist->pts;
- *pkt_pts = AV_NOPTS_VALUE;
ret = avcodec_decode_video2(ist->st->codec,
decoded_frame, got_output, pkt);
- if (ret < 0)
- return ret;
-
- quality = same_quant ? decoded_frame->quality : 0;
- if (!*got_output) {
- /* no picture yet */
+ if (!*got_output || ret < 0) {
+ if (!pkt->size) {
+ for (i = 0; i < ist->nb_filters; i++)
+ av_buffersrc_buffer(ist->filters[i]->filter, NULL);
+ }
return ret;
}
- ist->next_pts = ist->pts = guess_correct_pts(&ist->pts_ctx, decoded_frame->pkt_pts,
- decoded_frame->pkt_dts);
- if (pkt->duration)
- ist->next_pts += av_rescale_q(pkt->duration, ist->st->time_base, AV_TIME_BASE_Q);
- else if (ist->st->codec->time_base.num != 0) {
- int ticks = ist->st->parser ? ist->st->parser->repeat_pict + 1 :
- ist->st->codec->ticks_per_frame;
- ist->next_pts += ((int64_t)AV_TIME_BASE *
- ist->st->codec->time_base.num * ticks) /
- ist->st->codec->time_base.den;
- }
+
+ decoded_frame->pts = guess_correct_pts(&ist->pts_ctx, decoded_frame->pkt_pts,
+ decoded_frame->pkt_dts);
pkt->size = 0;
pre_process_video_frame(ist, (AVPicture *)decoded_frame, &buffer_to_free);
rate_emu_sleep(ist);
- for (i = 0; i < nb_output_streams; i++) {
- OutputStream *ost = &output_streams[i];
- int frame_size, resample_changed;
+ if (ist->st->sample_aspect_ratio.num)
+ decoded_frame->sample_aspect_ratio = ist->st->sample_aspect_ratio;
- if (!check_output_constraints(ist, ost) || !ost->encoding_needed)
- continue;
+ resample_changed = ist->resample_width != decoded_frame->width ||
+ ist->resample_height != decoded_frame->height ||
+ ist->resample_pix_fmt != decoded_frame->format;
+ if (resample_changed) {
+ av_log(NULL, AV_LOG_INFO,
+ "Input stream #%d:%d frame changed from size:%dx%d fmt:%s to size:%dx%d fmt:%s\n",
+ ist->file_index, ist->st->index,
+ ist->resample_width, ist->resample_height, av_get_pix_fmt_name(ist->resample_pix_fmt),
+ decoded_frame->width, decoded_frame->height, av_get_pix_fmt_name(decoded_frame->format));
+
+ ret = poll_filters();
+ if (ret < 0 && (ret != AVERROR_EOF && ret != AVERROR(EAGAIN)))
+ av_log(NULL, AV_LOG_ERROR, "Error while filtering.\n");
-#if CONFIG_AVFILTER
- resample_changed = ost->resample_width != decoded_frame->width ||
- ost->resample_height != decoded_frame->height ||
- ost->resample_pix_fmt != decoded_frame->format;
- if (resample_changed) {
- av_log(NULL, AV_LOG_INFO,
- "Input stream #%d:%d frame changed from size:%dx%d fmt:%s to size:%dx%d fmt:%s\n",
- ist->file_index, ist->st->index,
- ost->resample_width, ost->resample_height, av_get_pix_fmt_name(ost->resample_pix_fmt),
- decoded_frame->width, decoded_frame->height, av_get_pix_fmt_name(decoded_frame->format));
-
- avfilter_graph_free(&ost->graph);
- if (configure_video_filters(ist, ost)) {
+ ist->resample_width = decoded_frame->width;
+ ist->resample_height = decoded_frame->height;
+ ist->resample_pix_fmt = decoded_frame->format;
+
+ for (i = 0; i < nb_filtergraphs; i++)
+ if (ist_in_filtergraph(filtergraphs[i], ist) &&
+ configure_filtergraph(filtergraphs[i]) < 0) {
av_log(NULL, AV_LOG_FATAL, "Error reinitializing filters!\n");
- exit_program(1);
+ exit(1);
}
+ }
- ost->resample_width = decoded_frame->width;
- ost->resample_height = decoded_frame->height;
- ost->resample_pix_fmt = decoded_frame->format;
- }
-
- if (ist->st->sample_aspect_ratio.num)
- decoded_frame->sample_aspect_ratio = ist->st->sample_aspect_ratio;
+ for (i = 0; i < ist->nb_filters; i++) {
if (ist->st->codec->codec->capabilities & CODEC_CAP_DR1) {
FrameBuffer *buf = decoded_frame->opaque;
AVFilterBufferRef *fb = avfilter_get_video_buffer_ref_from_arrays(
@@ -1997,46 +1224,13 @@ static int transcode_video(InputStream *ist, AVPacket *pkt, int *got_output, int
ist->st->codec->pix_fmt);
avfilter_copy_frame_props(fb, decoded_frame);
- fb->pts = ist->pts;
fb->buf->priv = buf;
fb->buf->free = filter_release_buffer;
buf->refcount++;
- av_buffersrc_buffer(ost->input_video_filter, fb);
- } else
- av_vsrc_buffer_add_frame(ost->input_video_filter, decoded_frame,
- ist->pts, decoded_frame->sample_aspect_ratio);
-
- if (!ist->filtered_frame && !(ist->filtered_frame = avcodec_alloc_frame())) {
- av_free(buffer_to_free);
- return AVERROR(ENOMEM);
+ av_buffersrc_buffer(ist->filters[i]->filter, fb);
} else
- avcodec_get_frame_defaults(ist->filtered_frame);
- filtered_frame = ist->filtered_frame;
-
- frame_available = avfilter_poll_frame(ost->output_video_filter->inputs[0]);
- while (frame_available) {
- AVRational ist_pts_tb;
- if (ost->output_video_filter)
- get_filtered_video_frame(ost->output_video_filter, filtered_frame, &ost->picref, &ist_pts_tb);
- if (ost->picref)
- ist->pts = av_rescale_q(ost->picref->pts, ist_pts_tb, AV_TIME_BASE_Q);
- if (ost->picref->video && !ost->frame_aspect_ratio)
- ost->st->codec->sample_aspect_ratio = ost->picref->video->pixel_aspect;
-#else
- filtered_frame = decoded_frame;
-#endif
-
- do_video_out(output_files[ost->file_index].ctx, ost, ist, filtered_frame, &frame_size,
- same_quant ? quality : ost->st->codec->global_quality);
- if (vstats_filename && frame_size)
- do_video_stats(output_files[ost->file_index].ctx, ost, frame_size);
-#if CONFIG_AVFILTER
- frame_available = ost->output_video_filter && avfilter_poll_frame(ost->output_video_filter->inputs[0]);
- if (ost->picref)
- avfilter_unref_buffer(ost->picref);
- }
-#endif
+ av_buffersrc_write_frame(ist->filters[i]->filter, decoded_frame);
}
av_free(buffer_to_free);
@@ -2056,12 +1250,12 @@ static int transcode_subtitles(InputStream *ist, AVPacket *pkt, int *got_output)
rate_emu_sleep(ist);
for (i = 0; i < nb_output_streams; i++) {
- OutputStream *ost = &output_streams[i];
+ OutputStream *ost = output_streams[i];
if (!check_output_constraints(ist, ost) || !ost->encoding_needed)
continue;
- do_subtitle_out(output_files[ost->file_index].ctx, ost, ist, &subtitle, pkt->pts);
+ do_subtitle_out(output_files[ost->file_index]->ctx, ost, ist, &subtitle, pkt->pts);
}
avsubtitle_free(&subtitle);
@@ -2069,17 +1263,14 @@ static int transcode_subtitles(InputStream *ist, AVPacket *pkt, int *got_output)
}
/* pkt = NULL means EOF (needed to flush decoder buffers) */
-static int output_packet(InputStream *ist,
- OutputStream *ost_table, int nb_ostreams,
- const AVPacket *pkt)
+static int output_packet(InputStream *ist, const AVPacket *pkt)
{
int i;
int got_output;
- int64_t pkt_pts = AV_NOPTS_VALUE;
AVPacket avpkt;
- if (ist->next_pts == AV_NOPTS_VALUE)
- ist->next_pts = ist->pts;
+ if (ist->next_dts == AV_NOPTS_VALUE)
+ ist->next_dts = ist->last_dts;
if (pkt == NULL) {
/* EOF handling */
@@ -2092,16 +1283,14 @@ static int output_packet(InputStream *ist,
}
if (pkt->dts != AV_NOPTS_VALUE)
- ist->next_pts = ist->pts = av_rescale_q(pkt->dts, ist->st->time_base, AV_TIME_BASE_Q);
- if (pkt->pts != AV_NOPTS_VALUE)
- pkt_pts = av_rescale_q(pkt->pts, ist->st->time_base, AV_TIME_BASE_Q);
+ ist->next_dts = ist->last_dts = av_rescale_q(pkt->dts, ist->st->time_base, AV_TIME_BASE_Q);
// while we have more to decode or while the decoder did output something on EOF
while (ist->decoding_needed && (avpkt.size > 0 || (!pkt && got_output))) {
int ret = 0;
handle_eof:
- ist->pts = ist->next_pts;
+ ist->last_dts = ist->next_dts;
if (avpkt.size && avpkt.size != pkt->size) {
av_log(NULL, ist->showed_multi_packet_warning ? AV_LOG_VERBOSE : AV_LOG_WARNING,
@@ -2111,10 +1300,20 @@ static int output_packet(InputStream *ist,
switch (ist->st->codec->codec_type) {
case AVMEDIA_TYPE_AUDIO:
- ret = transcode_audio (ist, &avpkt, &got_output);
+ ret = decode_audio (ist, &avpkt, &got_output);
break;
case AVMEDIA_TYPE_VIDEO:
- ret = transcode_video (ist, &avpkt, &got_output, &pkt_pts);
+ ret = decode_video (ist, &avpkt, &got_output);
+ if (avpkt.duration)
+ ist->next_dts += av_rescale_q(avpkt.duration, ist->st->time_base, AV_TIME_BASE_Q);
+ else if (ist->st->avg_frame_rate.num)
+ ist->next_dts += av_rescale_q(1, av_inv_q(ist->st->avg_frame_rate),
+ AV_TIME_BASE_Q);
+ else if (ist->st->codec->time_base.num != 0) {
+ int ticks = ist->st->parser ? ist->st->parser->repeat_pict + 1 :
+ ist->st->codec->ticks_per_frame;
+ ist->next_dts += av_rescale_q(ticks, ist->st->codec->time_base, AV_TIME_BASE_Q);
+ }
break;
case AVMEDIA_TYPE_SUBTITLE:
ret = transcode_subtitles(ist, &avpkt, &got_output);
@@ -2138,24 +1337,24 @@ static int output_packet(InputStream *ist,
/* handle stream copy */
if (!ist->decoding_needed) {
rate_emu_sleep(ist);
- ist->pts = ist->next_pts;
+ ist->last_dts = ist->next_dts;
switch (ist->st->codec->codec_type) {
case AVMEDIA_TYPE_AUDIO:
- ist->next_pts += ((int64_t)AV_TIME_BASE * ist->st->codec->frame_size) /
+ ist->next_dts += ((int64_t)AV_TIME_BASE * ist->st->codec->frame_size) /
ist->st->codec->sample_rate;
break;
case AVMEDIA_TYPE_VIDEO:
if (ist->st->codec->time_base.num != 0) {
int ticks = ist->st->parser ? ist->st->parser->repeat_pict + 1 : ist->st->codec->ticks_per_frame;
- ist->next_pts += ((int64_t)AV_TIME_BASE *
+ ist->next_dts += ((int64_t)AV_TIME_BASE *
ist->st->codec->time_base.num * ticks) /
ist->st->codec->time_base.den;
}
break;
}
}
- for (i = 0; pkt && i < nb_ostreams; i++) {
- OutputStream *ost = &ost_table[i];
+ for (i = 0; pkt && i < nb_output_streams; i++) {
+ OutputStream *ost = output_streams[i];
if (!check_output_constraints(ist, ost) || ost->encoding_needed)
continue;
@@ -2166,28 +1365,27 @@ static int output_packet(InputStream *ist,
return 0;
}
-static void print_sdp(OutputFile *output_files, int n)
+static void print_sdp(void)
{
char sdp[2048];
int i;
- AVFormatContext **avc = av_malloc(sizeof(*avc) * n);
+ AVFormatContext **avc = av_malloc(sizeof(*avc) * nb_output_files);
if (!avc)
- exit_program(1);
- for (i = 0; i < n; i++)
- avc[i] = output_files[i].ctx;
+ exit(1);
+ for (i = 0; i < nb_output_files; i++)
+ avc[i] = output_files[i]->ctx;
- av_sdp_create(avc, n, sdp, sizeof(sdp));
+ av_sdp_create(avc, nb_output_files, sdp, sizeof(sdp));
printf("SDP:\n%s\n", sdp);
fflush(stdout);
av_freep(&avc);
}
-static int init_input_stream(int ist_index, OutputStream *output_streams, int nb_output_streams,
- char *error, int error_len)
+static int init_input_stream(int ist_index, char *error, int error_len)
{
- int i;
- InputStream *ist = &input_streams[ist_index];
+ int i, ret;
+ InputStream *ist = input_streams[ist_index];
if (ist->decoding_needed) {
AVCodec *codec = ist->dec;
if (!codec) {
@@ -2199,7 +1397,7 @@ static int init_input_stream(int ist_index, OutputStream *output_streams, int nb
/* update requested sample format for the decoder based on the
corresponding encoder sample format */
for (i = 0; i < nb_output_streams; i++) {
- OutputStream *ost = &output_streams[i];
+ OutputStream *ost = output_streams[i];
if (ost->source_index == ist_index) {
update_sample_fmt(ist->st->codec, codec, ost->st->codec);
break;
@@ -2209,28 +1407,46 @@ static int init_input_stream(int ist_index, OutputStream *output_streams, int nb
if (codec->type == AVMEDIA_TYPE_VIDEO && codec->capabilities & CODEC_CAP_DR1) {
ist->st->codec->get_buffer = codec_get_buffer;
ist->st->codec->release_buffer = codec_release_buffer;
- ist->st->codec->opaque = ist;
+ ist->st->codec->opaque = &ist->buffer_pool;
}
if (!av_dict_get(ist->opts, "threads", NULL, 0))
av_dict_set(&ist->opts, "threads", "auto", 0);
- if (avcodec_open2(ist->st->codec, codec, &ist->opts) < 0) {
+ if ((ret = avcodec_open2(ist->st->codec, codec, &ist->opts)) < 0) {
+ if (ret == AVERROR_EXPERIMENTAL)
+ abort_codec_experimental(codec, 0);
snprintf(error, error_len, "Error while opening decoder for input stream #%d:%d",
ist->file_index, ist->st->index);
- return AVERROR(EINVAL);
+ return ret;
}
- assert_codec_experimental(ist->st->codec, 0);
assert_avoptions(ist->opts);
}
- ist->pts = ist->st->avg_frame_rate.num ? - ist->st->codec->has_b_frames * AV_TIME_BASE / av_q2d(ist->st->avg_frame_rate) : 0;
- ist->next_pts = AV_NOPTS_VALUE;
+ ist->last_dts = ist->st->avg_frame_rate.num ? - ist->st->codec->has_b_frames * AV_TIME_BASE / av_q2d(ist->st->avg_frame_rate) : 0;
+ ist->next_dts = AV_NOPTS_VALUE;
init_pts_correction(&ist->pts_ctx);
ist->is_start = 1;
return 0;
}
+static InputStream *get_input_stream(OutputStream *ost)
+{
+ if (ost->source_index >= 0)
+ return input_streams[ost->source_index];
+
+ if (ost->filter) {
+ FilterGraph *fg = ost->filter->graph;
+ int i;
+
+ for (i = 0; i < fg->nb_inputs; i++)
+ if (fg->inputs[i]->ist->st->codec->codec_type == ost->st->codec->codec_type)
+ return fg->inputs[i]->ist;
+ }
+
+ return NULL;
+}
+
static void parse_forced_key_frames(char *kf, OutputStream *ost,
AVCodecContext *avctx)
{
@@ -2245,7 +1461,7 @@ static void parse_forced_key_frames(char *kf, OutputStream *ost,
ost->forced_kf_pts = av_malloc(sizeof(*ost->forced_kf_pts) * n);
if (!ost->forced_kf_pts) {
av_log(NULL, AV_LOG_FATAL, "Could not allocate forced key frames array.\n");
- exit_program(1);
+ exit(1);
}
p = kf;
@@ -2262,14 +1478,11 @@ static void parse_forced_key_frames(char *kf, OutputStream *ost,
}
}
-static int transcode_init(OutputFile *output_files,
- int nb_output_files,
- InputFile *input_files,
- int nb_input_files)
+static int transcode_init(void)
{
int ret = 0, i, j, k;
AVFormatContext *oc;
- AVCodecContext *codec, *icodec;
+ AVCodecContext *codec;
OutputStream *ost;
InputStream *ist;
char error[1024];
@@ -2277,15 +1490,15 @@ static int transcode_init(OutputFile *output_files,
/* init framerate emulation */
for (i = 0; i < nb_input_files; i++) {
- InputFile *ifile = &input_files[i];
+ InputFile *ifile = input_files[i];
if (ifile->rate_emu)
for (j = 0; j < ifile->nb_streams; j++)
- input_streams[j + ifile->ist_index].start = av_gettime();
+ input_streams[j + ifile->ist_index]->start = av_gettime();
}
/* output stream init */
for (i = 0; i < nb_output_files; i++) {
- oc = output_files[i].ctx;
+ oc = output_files[i]->ctx;
if (!oc->nb_streams && !(oc->oformat->flags & AVFMT_NOSTREAMS)) {
av_dump_format(oc, i, oc->filename, 1);
av_log(NULL, AV_LOG_ERROR, "Output file #%d does not contain any stream\n", i);
@@ -2293,24 +1506,37 @@ static int transcode_init(OutputFile *output_files,
}
}
+ /* init complex filtergraphs */
+ for (i = 0; i < nb_filtergraphs; i++)
+ if ((ret = avfilter_graph_config(filtergraphs[i]->graph, NULL)) < 0)
+ return ret;
+
/* for each output stream, we compute the right encoding parameters */
for (i = 0; i < nb_output_streams; i++) {
- ost = &output_streams[i];
- oc = output_files[ost->file_index].ctx;
- ist = &input_streams[ost->source_index];
+ AVCodecContext *icodec = NULL;
+ ost = output_streams[i];
+ oc = output_files[ost->file_index]->ctx;
+ ist = get_input_stream(ost);
if (ost->attachment_filename)
continue;
codec = ost->st->codec;
- icodec = ist->st->codec;
- ost->st->disposition = ist->st->disposition;
- codec->bits_per_raw_sample = icodec->bits_per_raw_sample;
- codec->chroma_sample_location = icodec->chroma_sample_location;
+ if (ist) {
+ icodec = ist->st->codec;
+
+ ost->st->disposition = ist->st->disposition;
+ codec->bits_per_raw_sample = icodec->bits_per_raw_sample;
+ codec->chroma_sample_location = icodec->chroma_sample_location;
+ }
if (ost->stream_copy) {
- uint64_t extra_size = (uint64_t)icodec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE;
+ uint64_t extra_size;
+
+ av_assert0(ist && !ost->filter);
+
+ extra_size = (uint64_t)icodec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE;
if (extra_size > INT_MAX) {
return AVERROR(EINVAL);
@@ -2349,7 +1575,7 @@ static int transcode_init(OutputFile *output_files,
case AVMEDIA_TYPE_AUDIO:
if (audio_volume != 256) {
av_log(NULL, AV_LOG_FATAL, "-acodec copy and -vol are incompatible (frames are not decoded)\n");
- exit_program(1);
+ exit(1);
}
codec->channel_layout = icodec->channel_layout;
codec->sample_rate = icodec->sample_rate;
@@ -2382,106 +1608,89 @@ static int transcode_init(OutputFile *output_files,
abort();
}
} else {
- if (!ost->enc)
- ost->enc = avcodec_find_encoder(ost->st->codec->codec_id);
+ if (!ost->enc) {
+ /* should only happen when a default codec is not present. */
+ snprintf(error, sizeof(error), "Automatic encoder selection "
+ "failed for output stream #%d:%d. Default encoder for "
+ "format %s is probably disabled. Please choose an "
+ "encoder manually.\n", ost->file_index, ost->index,
+ oc->oformat->name);
+ ret = AVERROR(EINVAL);
+ goto dump_format;
+ }
- ist->decoding_needed = 1;
+ if (ist)
+ ist->decoding_needed = 1;
ost->encoding_needed = 1;
- switch (codec->codec_type) {
- case AVMEDIA_TYPE_AUDIO:
- ost->fifo = av_fifo_alloc(1024);
- if (!ost->fifo) {
- return AVERROR(ENOMEM);
- }
- ost->reformat_pair = MAKE_SFMT_PAIR(AV_SAMPLE_FMT_NONE,AV_SAMPLE_FMT_NONE);
-
- if (!codec->sample_rate)
- codec->sample_rate = icodec->sample_rate;
- choose_sample_rate(ost->st, ost->enc);
- codec->time_base = (AVRational){ 1, codec->sample_rate };
-
- if (codec->sample_fmt == AV_SAMPLE_FMT_NONE)
- codec->sample_fmt = icodec->sample_fmt;
- choose_sample_fmt(ost->st, ost->enc);
-
- if (!codec->channels)
- codec->channels = icodec->channels;
- codec->channel_layout = icodec->channel_layout;
- if (av_get_channel_layout_nb_channels(codec->channel_layout) != codec->channels)
- codec->channel_layout = 0;
-
- ost->audio_resample = codec-> sample_rate != icodec->sample_rate || audio_sync_method > 1;
- icodec->request_channels = codec-> channels;
- ost->resample_sample_fmt = icodec->sample_fmt;
- ost->resample_sample_rate = icodec->sample_rate;
- ost->resample_channels = icodec->channels;
- break;
- case AVMEDIA_TYPE_VIDEO:
- if (codec->pix_fmt == PIX_FMT_NONE)
- codec->pix_fmt = icodec->pix_fmt;
- choose_pixel_fmt(ost->st, ost->enc);
-
- if (ost->st->codec->pix_fmt == PIX_FMT_NONE) {
- av_log(NULL, AV_LOG_FATAL, "Video pixel format is unknown, stream cannot be encoded\n");
- exit_program(1);
- }
-
- if (!codec->width || !codec->height) {
- codec->width = icodec->width;
- codec->height = icodec->height;
- }
+ /*
+ * We want CFR output if and only if one of those is true:
+ * 1) user specified output framerate with -r
+ * 2) user specified -vsync cfr
+ * 3) output format is CFR and the user didn't force vsync to
+ * something else than CFR
+ *
+ * in such a case, set ost->frame_rate
+ */
+ if (codec->codec_type == AVMEDIA_TYPE_VIDEO &&
+ !ost->frame_rate.num && ist &&
+ (video_sync_method == VSYNC_CFR ||
+ (video_sync_method == VSYNC_AUTO &&
+ !(oc->oformat->flags & (AVFMT_NOTIMESTAMPS | AVFMT_VARIABLE_FPS))))) {
+ ost->frame_rate = ist->framerate.num ? ist->framerate :
+ ist->st->avg_frame_rate.num ?
+ ist->st->avg_frame_rate :
+ (AVRational){25, 1};
- ost->video_resample = codec->width != icodec->width ||
- codec->height != icodec->height ||
- codec->pix_fmt != icodec->pix_fmt;
- if (ost->video_resample) {
-#if !CONFIG_AVFILTER
- avcodec_get_frame_defaults(&ost->pict_tmp);
- if (avpicture_alloc((AVPicture*)&ost->pict_tmp, codec->pix_fmt,
- codec->width, codec->height)) {
- av_log(NULL, AV_LOG_FATAL, "Cannot allocate temp picture, check pix fmt\n");
- exit_program(1);
- }
- ost->img_resample_ctx = sws_getContext(
- icodec->width,
- icodec->height,
- icodec->pix_fmt,
- codec->width,
- codec->height,
- codec->pix_fmt,
- ost->sws_flags, NULL, NULL, NULL);
- if (ost->img_resample_ctx == NULL) {
- av_log(NULL, AV_LOG_FATAL, "Cannot get resampling context\n");
- exit_program(1);
- }
-#endif
- codec->bits_per_raw_sample = 0;
- }
-
- ost->resample_height = icodec->height;
- ost->resample_width = icodec->width;
- ost->resample_pix_fmt = icodec->pix_fmt;
-
- if (!ost->frame_rate.num)
- ost->frame_rate = ist->st->r_frame_rate.num ? ist->st->r_frame_rate : (AVRational) { 25, 1 };
if (ost->enc && ost->enc->supported_framerates && !ost->force_fps) {
int idx = av_find_nearest_q_idx(ost->frame_rate, ost->enc->supported_framerates);
ost->frame_rate = ost->enc->supported_framerates[idx];
}
- codec->time_base = (AVRational){ost->frame_rate.den, ost->frame_rate.num};
+ }
-#if CONFIG_AVFILTER
- if (configure_video_filters(ist, ost)) {
- av_log(NULL, AV_LOG_FATAL, "Error opening filters!\n");
- exit(1);
+ if (!ost->filter &&
+ (codec->codec_type == AVMEDIA_TYPE_VIDEO ||
+ codec->codec_type == AVMEDIA_TYPE_AUDIO)) {
+ FilterGraph *fg;
+ fg = init_simple_filtergraph(ist, ost);
+ if (configure_filtergraph(fg)) {
+ av_log(NULL, AV_LOG_FATAL, "Error opening filters!\n");
+ exit(1);
+ }
+ }
+
+ switch (codec->codec_type) {
+ case AVMEDIA_TYPE_AUDIO:
+ codec->sample_fmt = ost->filter->filter->inputs[0]->format;
+ codec->sample_rate = ost->filter->filter->inputs[0]->sample_rate;
+ codec->channel_layout = ost->filter->filter->inputs[0]->channel_layout;
+ codec->channels = av_get_channel_layout_nb_channels(codec->channel_layout);
+ codec->time_base = (AVRational){ 1, codec->sample_rate };
+ break;
+ case AVMEDIA_TYPE_VIDEO:
+ codec->time_base = ost->filter->filter->inputs[0]->time_base;
+
+ codec->width = ost->filter->filter->inputs[0]->w;
+ codec->height = ost->filter->filter->inputs[0]->h;
+ codec->sample_aspect_ratio = ost->st->sample_aspect_ratio =
+ ost->frame_aspect_ratio ? // overridden by the -aspect cli option
+ av_d2q(ost->frame_aspect_ratio * codec->height/codec->width, 255) :
+ ost->filter->filter->inputs[0]->sample_aspect_ratio;
+ codec->pix_fmt = ost->filter->filter->inputs[0]->format;
+
+ if (icodec &&
+ (codec->width != icodec->width ||
+ codec->height != icodec->height ||
+ codec->pix_fmt != icodec->pix_fmt)) {
+ codec->bits_per_raw_sample = 0;
}
-#endif
+
if (ost->forced_keyframes)
parse_forced_key_frames(ost->forced_keyframes, ost,
ost->st->codec);
break;
case AVMEDIA_TYPE_SUBTITLE:
+ codec->time_base = (AVRational){1, 1000};
break;
default:
abort();
@@ -2493,7 +1702,8 @@ static int transcode_init(OutputFile *output_files,
FILE *f;
snprintf(logfilename, sizeof(logfilename), "%s-%d.log",
- pass_logfilename_prefix ? pass_logfilename_prefix : DEFAULT_PASS_LOGFILENAME_PREFIX,
+ ost->logfile_prefix ? ost->logfile_prefix :
+ DEFAULT_PASS_LOGFILENAME_PREFIX,
i);
if (!strcmp(ost->enc->name, "libx264")) {
av_dict_set(&ost->opts, "stats", logfilename, AV_DICT_DONT_OVERWRITE);
@@ -2503,7 +1713,7 @@ static int transcode_init(OutputFile *output_files,
if (!f) {
av_log(NULL, AV_LOG_FATAL, "Cannot write log file '%s' for pass-1 encoding: %s\n",
logfilename, strerror(errno));
- exit_program(1);
+ exit(1);
}
ost->logfile = f;
} else {
@@ -2512,40 +1722,25 @@ static int transcode_init(OutputFile *output_files,
if (cmdutils_read_file(logfilename, &logbuffer, &logbuffer_size) < 0) {
av_log(NULL, AV_LOG_FATAL, "Error reading log file '%s' for pass-2 encoding\n",
logfilename);
- exit_program(1);
+ exit(1);
}
codec->stats_in = logbuffer;
}
}
}
}
- if (codec->codec_type == AVMEDIA_TYPE_VIDEO) {
- int size = codec->width * codec->height;
- bit_buffer_size = FFMAX(bit_buffer_size, 6 * size + 200);
- }
- }
-
- if (!bit_buffer)
- bit_buffer = av_malloc(bit_buffer_size);
- if (!bit_buffer) {
- av_log(NULL, AV_LOG_ERROR, "Cannot allocate %d bytes output buffer\n",
- bit_buffer_size);
- return AVERROR(ENOMEM);
}
/* open each encoder */
for (i = 0; i < nb_output_streams; i++) {
- ost = &output_streams[i];
+ ost = output_streams[i];
if (ost->encoding_needed) {
AVCodec *codec = ost->enc;
- AVCodecContext *dec = input_streams[ost->source_index].st->codec;
- if (!codec) {
- snprintf(error, sizeof(error), "Encoder (codec id %d) not found for output stream #%d:%d",
- ost->st->codec->codec_id, ost->file_index, ost->index);
- ret = AVERROR(EINVAL);
- goto dump_format;
- }
- if (dec->subtitle_header) {
+ AVCodecContext *dec = NULL;
+
+ if ((ist = get_input_stream(ost)))
+ dec = ist->st->codec;
+ if (dec && dec->subtitle_header) {
ost->st->codec->subtitle_header = av_malloc(dec->subtitle_header_size);
if (!ost->st->codec->subtitle_header) {
ret = AVERROR(ENOMEM);
@@ -2556,13 +1751,13 @@ static int transcode_init(OutputFile *output_files,
}
if (!av_dict_get(ost->opts, "threads", NULL, 0))
av_dict_set(&ost->opts, "threads", "auto", 0);
- if (avcodec_open2(ost->st->codec, codec, &ost->opts) < 0) {
+ if ((ret = avcodec_open2(ost->st->codec, codec, &ost->opts)) < 0) {
+ if (ret == AVERROR_EXPERIMENTAL)
+ abort_codec_experimental(codec, 1);
snprintf(error, sizeof(error), "Error while opening encoder for output stream #%d:%d - maybe incorrect parameters such as bit_rate, rate, width or height",
ost->file_index, ost->index);
- ret = AVERROR(EINVAL);
goto dump_format;
}
- assert_codec_experimental(ost->st->codec, 1);
assert_avoptions(ost->opts);
if (ost->st->codec->bit_rate && ost->st->codec->bit_rate < 1000)
av_log(NULL, AV_LOG_WARNING, "The bitrate parameter is set too low."
@@ -2570,24 +1765,24 @@ static int transcode_init(OutputFile *output_files,
extra_size += ost->st->codec->extradata_size;
if (ost->st->codec->me_threshold)
- input_streams[ost->source_index].st->codec->debug |= FF_DEBUG_MV;
+ input_streams[ost->source_index]->st->codec->debug |= FF_DEBUG_MV;
}
}
/* init input streams */
for (i = 0; i < nb_input_streams; i++)
- if ((ret = init_input_stream(i, output_streams, nb_output_streams, error, sizeof(error))) < 0)
+ if ((ret = init_input_stream(i, error, sizeof(error))) < 0)
goto dump_format;
/* discard unused programs */
for (i = 0; i < nb_input_files; i++) {
- InputFile *ifile = &input_files[i];
+ InputFile *ifile = input_files[i];
for (j = 0; j < ifile->ctx->nb_programs; j++) {
AVProgram *p = ifile->ctx->programs[j];
int discard = AVDISCARD_ALL;
for (k = 0; k < p->nb_stream_indexes; k++)
- if (!input_streams[ifile->ist_index + p->stream_index[k]].discard) {
+ if (!input_streams[ifile->ist_index + p->stream_index[k]]->discard) {
discard = AVDISCARD_DEFAULT;
break;
}
@@ -2597,14 +1792,18 @@ static int transcode_init(OutputFile *output_files,
/* open files and write file headers */
for (i = 0; i < nb_output_files; i++) {
- oc = output_files[i].ctx;
+ oc = output_files[i]->ctx;
oc->interrupt_callback = int_cb;
- if (avformat_write_header(oc, &output_files[i].opts) < 0) {
- snprintf(error, sizeof(error), "Could not write header for output file #%d (incorrect codec parameters ?)", i);
+ if ((ret = avformat_write_header(oc, &output_files[i]->opts)) < 0) {
+ char errbuf[128];
+ const char *errbuf_ptr = errbuf;
+ if (av_strerror(ret, errbuf, sizeof(errbuf)) < 0)
+ errbuf_ptr = strerror(AVUNERROR(ret));
+ snprintf(error, sizeof(error), "Could not write header for output file #%d (incorrect codec parameters ?): %s", i, errbuf_ptr);
ret = AVERROR(EINVAL);
goto dump_format;
}
- assert_avoptions(output_files[i].opts);
+ assert_avoptions(output_files[i]->opts);
if (strcmp(oc->oformat->name, "rtp")) {
want_sdp = 0;
}
@@ -2614,13 +1813,28 @@ static int transcode_init(OutputFile *output_files,
/* dump the file output parameters - cannot be done before in case
of stream copy */
for (i = 0; i < nb_output_files; i++) {
- av_dump_format(output_files[i].ctx, i, output_files[i].ctx->filename, 1);
+ av_dump_format(output_files[i]->ctx, i, output_files[i]->ctx->filename, 1);
}
/* dump the stream mapping */
av_log(NULL, AV_LOG_INFO, "Stream mapping:\n");
+ for (i = 0; i < nb_input_streams; i++) {
+ ist = input_streams[i];
+
+ for (j = 0; j < ist->nb_filters; j++) {
+ if (ist->filters[j]->graph->graph_desc) {
+ av_log(NULL, AV_LOG_INFO, " Stream #%d:%d (%s) -> %s",
+ ist->file_index, ist->st->index, ist->dec ? ist->dec->name : "?",
+ ist->filters[j]->name);
+ if (nb_filtergraphs > 1)
+ av_log(NULL, AV_LOG_INFO, " (graph %d)", ist->filters[j]->graph->index);
+ av_log(NULL, AV_LOG_INFO, "\n");
+ }
+ }
+ }
+
for (i = 0; i < nb_output_streams; i++) {
- ost = &output_streams[i];
+ ost = output_streams[i];
if (ost->attachment_filename) {
/* an attached file */
@@ -2628,20 +1842,32 @@ static int transcode_init(OutputFile *output_files,
ost->attachment_filename, ost->file_index, ost->index);
continue;
}
+
+ if (ost->filter && ost->filter->graph->graph_desc) {
+ /* output from a complex graph */
+ av_log(NULL, AV_LOG_INFO, " %s", ost->filter->name);
+ if (nb_filtergraphs > 1)
+ av_log(NULL, AV_LOG_INFO, " (graph %d)", ost->filter->graph->index);
+
+ av_log(NULL, AV_LOG_INFO, " -> Stream #%d:%d (%s)\n", ost->file_index,
+ ost->index, ost->enc ? ost->enc->name : "?");
+ continue;
+ }
+
av_log(NULL, AV_LOG_INFO, " Stream #%d:%d -> #%d:%d",
- input_streams[ost->source_index].file_index,
- input_streams[ost->source_index].st->index,
+ input_streams[ost->source_index]->file_index,
+ input_streams[ost->source_index]->st->index,
ost->file_index,
ost->index);
- if (ost->sync_ist != &input_streams[ost->source_index])
+ if (ost->sync_ist != input_streams[ost->source_index])
av_log(NULL, AV_LOG_INFO, " [sync #%d:%d]",
ost->sync_ist->file_index,
ost->sync_ist->st->index);
if (ost->stream_copy)
av_log(NULL, AV_LOG_INFO, " (copy)");
else
- av_log(NULL, AV_LOG_INFO, " (%s -> %s)", input_streams[ost->source_index].dec ?
- input_streams[ost->source_index].dec->name : "?",
+ av_log(NULL, AV_LOG_INFO, " (%s -> %s)", input_streams[ost->source_index]->dec ?
+ input_streams[ost->source_index]->dec->name : "?",
ost->enc ? ost->enc->name : "?");
av_log(NULL, AV_LOG_INFO, "\n");
}
@@ -2652,1463 +1878,435 @@ static int transcode_init(OutputFile *output_files,
}
if (want_sdp) {
- print_sdp(output_files, nb_output_files);
+ print_sdp();
}
return 0;
}
-/*
- * The following code is the main loop of the file converter
- */
-static int transcode(OutputFile *output_files,
- int nb_output_files,
- InputFile *input_files,
- int nb_input_files)
+/* Return 1 if there remain streams where more output is wanted, 0 otherwise. */
+static int need_output(void)
{
- int ret, i;
- AVFormatContext *is, *os;
- OutputStream *ost;
- InputStream *ist;
- uint8_t *no_packet;
- int no_packet_count = 0;
- int64_t timer_start;
-
- if (!(no_packet = av_mallocz(nb_input_files)))
- exit_program(1);
-
- ret = transcode_init(output_files, nb_output_files, input_files, nb_input_files);
- if (ret < 0)
- goto fail;
-
- av_log(NULL, AV_LOG_INFO, "Press ctrl-c to stop encoding\n");
- term_init();
-
- timer_start = av_gettime();
-
- for (; received_sigterm == 0;) {
- int file_index, ist_index;
- AVPacket pkt;
- int64_t ipts_min;
- double opts_min;
-
- ipts_min = INT64_MAX;
- opts_min = 1e100;
+ int i;
- /* select the stream that we must read now by looking at the
- smallest output pts */
- file_index = -1;
- for (i = 0; i < nb_output_streams; i++) {
- OutputFile *of;
- int64_t ipts;
- double opts;
- ost = &output_streams[i];
- of = &output_files[ost->file_index];
- if (ost->source_index < 0)
- continue;
- os = output_files[ost->file_index].ctx;
- ist = &input_streams[ost->source_index];
- if (ost->is_past_recording_time || no_packet[ist->file_index] ||
- (os->pb && avio_tell(os->pb) >= of->limit_filesize))
- continue;
- opts = ost->st->pts.val * av_q2d(ost->st->time_base);
- ipts = ist->pts;
- if (!input_files[ist->file_index].eof_reached) {
- if (ipts < ipts_min) {
- ipts_min = ipts;
- if (input_sync)
- file_index = ist->file_index;
- }
- if (opts < opts_min) {
- opts_min = opts;
- if (!input_sync) file_index = ist->file_index;
- }
- }
- if (ost->frame_number >= ost->max_frames) {
- int j;
- for (j = 0; j < of->ctx->nb_streams; j++)
- output_streams[of->ost_index + j].is_past_recording_time = 1;
- continue;
- }
- }
- /* if none, if is finished */
- if (file_index < 0) {
- if (no_packet_count) {
- no_packet_count = 0;
- memset(no_packet, 0, nb_input_files);
- usleep(10000);
- continue;
- }
- break;
- }
+ for (i = 0; i < nb_output_streams; i++) {
+ OutputStream *ost = output_streams[i];
+ OutputFile *of = output_files[ost->file_index];
+ AVFormatContext *os = output_files[ost->file_index]->ctx;
- /* read a frame from it and output it in the fifo */
- is = input_files[file_index].ctx;
- ret = av_read_frame(is, &pkt);
- if (ret == AVERROR(EAGAIN)) {
- no_packet[file_index] = 1;
- no_packet_count++;
+ if (ost->finished ||
+ (os->pb && avio_tell(os->pb) >= of->limit_filesize))
continue;
- }
- if (ret < 0) {
- input_files[file_index].eof_reached = 1;
- if (opt_shortest)
- break;
- else
- continue;
- }
-
- no_packet_count = 0;
- memset(no_packet, 0, nb_input_files);
-
- if (do_pkt_dump) {
- av_pkt_dump_log2(NULL, AV_LOG_DEBUG, &pkt, do_hex_dump,
- is->streams[pkt.stream_index]);
- }
- /* the following test is needed in case new streams appear
- dynamically in stream : we ignore them */
- if (pkt.stream_index >= input_files[file_index].nb_streams)
- goto discard_packet;
- ist_index = input_files[file_index].ist_index + pkt.stream_index;
- ist = &input_streams[ist_index];
- if (ist->discard)
- goto discard_packet;
-
- if (pkt.dts != AV_NOPTS_VALUE)
- pkt.dts += av_rescale_q(input_files[ist->file_index].ts_offset, AV_TIME_BASE_Q, ist->st->time_base);
- if (pkt.pts != AV_NOPTS_VALUE)
- pkt.pts += av_rescale_q(input_files[ist->file_index].ts_offset, AV_TIME_BASE_Q, ist->st->time_base);
-
- if (pkt.pts != AV_NOPTS_VALUE)
- pkt.pts *= ist->ts_scale;
- if (pkt.dts != AV_NOPTS_VALUE)
- pkt.dts *= ist->ts_scale;
-
- //fprintf(stderr, "next:%"PRId64" dts:%"PRId64" off:%"PRId64" %d\n",
- // ist->next_pts,
- // pkt.dts, input_files[ist->file_index].ts_offset,
- // ist->st->codec->codec_type);
- if (pkt.dts != AV_NOPTS_VALUE && ist->next_pts != AV_NOPTS_VALUE
- && (is->iformat->flags & AVFMT_TS_DISCONT)) {
- int64_t pkt_dts = av_rescale_q(pkt.dts, ist->st->time_base, AV_TIME_BASE_Q);
- int64_t delta = pkt_dts - ist->next_pts;
- if ((FFABS(delta) > 1LL * dts_delta_threshold * AV_TIME_BASE || pkt_dts + 1 < ist->pts) && !copy_ts) {
- input_files[ist->file_index].ts_offset -= delta;
- av_log(NULL, AV_LOG_DEBUG,
- "timestamp discontinuity %"PRId64", new offset= %"PRId64"\n",
- delta, input_files[ist->file_index].ts_offset);
- pkt.dts-= av_rescale_q(delta, AV_TIME_BASE_Q, ist->st->time_base);
- if (pkt.pts != AV_NOPTS_VALUE)
- pkt.pts-= av_rescale_q(delta, AV_TIME_BASE_Q, ist->st->time_base);
- }
- }
-
- // fprintf(stderr,"read #%d.%d size=%d\n", ist->file_index, ist->st->index, pkt.size);
- if (output_packet(ist, output_streams, nb_output_streams, &pkt) < 0) {
-
- av_log(NULL, AV_LOG_ERROR, "Error while decoding stream #%d:%d\n",
- ist->file_index, ist->st->index);
- if (exit_on_error)
- exit_program(1);
- av_free_packet(&pkt);
+ if (ost->frame_number >= ost->max_frames) {
+ int j;
+ for (j = 0; j < of->ctx->nb_streams; j++)
+ output_streams[of->ost_index + j]->finished = 1;
continue;
}
- discard_packet:
- av_free_packet(&pkt);
-
- /* dump report by using the output first video and audio streams */
- print_report(output_files, output_streams, nb_output_streams, 0, timer_start);
- }
-
- /* at the end of stream, we must flush the decoder buffers */
- for (i = 0; i < nb_input_streams; i++) {
- ist = &input_streams[i];
- if (ist->decoding_needed) {
- output_packet(ist, output_streams, nb_output_streams, NULL);
- }
- }
- flush_encoders(output_streams, nb_output_streams);
-
- term_exit();
-
- /* write the trailer if needed and close file */
- for (i = 0; i < nb_output_files; i++) {
- os = output_files[i].ctx;
- av_write_trailer(os);
- }
-
- /* dump report by using the first video and audio streams */
- print_report(output_files, output_streams, nb_output_streams, 1, timer_start);
-
- /* close each encoder */
- for (i = 0; i < nb_output_streams; i++) {
- ost = &output_streams[i];
- if (ost->encoding_needed) {
- av_freep(&ost->st->codec->stats_in);
- avcodec_close(ost->st->codec);
- }
-#if CONFIG_AVFILTER
- avfilter_graph_free(&ost->graph);
-#endif
- }
-
- /* close each decoder */
- for (i = 0; i < nb_input_streams; i++) {
- ist = &input_streams[i];
- if (ist->decoding_needed) {
- avcodec_close(ist->st->codec);
- }
- }
-
- /* finished ! */
- ret = 0;
-
- fail:
- av_freep(&bit_buffer);
- av_freep(&no_packet);
-
- if (output_streams) {
- for (i = 0; i < nb_output_streams; i++) {
- ost = &output_streams[i];
- if (ost) {
- if (ost->stream_copy)
- av_freep(&ost->st->codec->extradata);
- if (ost->logfile) {
- fclose(ost->logfile);
- ost->logfile = NULL;
- }
- av_fifo_free(ost->fifo); /* works even if fifo is not
- initialized but set to zero */
- av_freep(&ost->st->codec->subtitle_header);
- av_free(ost->pict_tmp.data[0]);
- av_free(ost->forced_kf_pts);
- if (ost->video_resample)
- sws_freeContext(ost->img_resample_ctx);
- if (ost->resample)
- audio_resample_close(ost->resample);
- if (ost->reformat_ctx)
- av_audio_convert_free(ost->reformat_ctx);
- av_dict_free(&ost->opts);
- }
- }
- }
- return ret;
-}
-
-static double parse_frame_aspect_ratio(const char *arg)
-{
- int x = 0, y = 0;
- double ar = 0;
- const char *p;
- char *end;
-
- p = strchr(arg, ':');
- if (p) {
- x = strtol(arg, &end, 10);
- if (end == p)
- y = strtol(end + 1, &end, 10);
- if (x > 0 && y > 0)
- ar = (double)x / (double)y;
- } else
- ar = strtod(arg, NULL);
-
- if (!ar) {
- av_log(NULL, AV_LOG_FATAL, "Incorrect aspect ratio specification.\n");
- exit_program(1);
+ return 1;
}
- return ar;
-}
-
-static int opt_audio_codec(OptionsContext *o, const char *opt, const char *arg)
-{
- return parse_option(o, "codec:a", arg, options);
-}
-
-static int opt_video_codec(OptionsContext *o, const char *opt, const char *arg)
-{
- return parse_option(o, "codec:v", arg, options);
-}
-
-static int opt_subtitle_codec(OptionsContext *o, const char *opt, const char *arg)
-{
- return parse_option(o, "codec:s", arg, options);
-}
-static int opt_data_codec(OptionsContext *o, const char *opt, const char *arg)
-{
- return parse_option(o, "codec:d", arg, options);
+ return 0;
}
-static int opt_map(OptionsContext *o, const char *opt, const char *arg)
+static InputFile *select_input_file(void)
{
- StreamMap *m = NULL;
- int i, negative = 0, file_idx;
- int sync_file_idx = -1, sync_stream_idx;
- char *p, *sync;
- char *map;
-
- if (*arg == '-') {
- negative = 1;
- arg++;
- }
- map = av_strdup(arg);
-
- /* parse sync stream first, just pick first matching stream */
- if (sync = strchr(map, ',')) {
- *sync = 0;
- sync_file_idx = strtol(sync + 1, &sync, 0);
- if (sync_file_idx >= nb_input_files || sync_file_idx < 0) {
- av_log(NULL, AV_LOG_FATAL, "Invalid sync file index: %d.\n", sync_file_idx);
- exit_program(1);
- }
- if (*sync)
- sync++;
- for (i = 0; i < input_files[sync_file_idx].nb_streams; i++)
- if (check_stream_specifier(input_files[sync_file_idx].ctx,
- input_files[sync_file_idx].ctx->streams[i], sync) == 1) {
- sync_stream_idx = i;
- break;
- }
- if (i == input_files[sync_file_idx].nb_streams) {
- av_log(NULL, AV_LOG_FATAL, "Sync stream specification in map %s does not "
- "match any streams.\n", arg);
- exit_program(1);
- }
- }
-
-
- file_idx = strtol(map, &p, 0);
- if (file_idx >= nb_input_files || file_idx < 0) {
- av_log(NULL, AV_LOG_FATAL, "Invalid input file index: %d.\n", file_idx);
- exit_program(1);
- }
- if (negative)
- /* disable some already defined maps */
- for (i = 0; i < o->nb_stream_maps; i++) {
- m = &o->stream_maps[i];
- if (file_idx == m->file_index &&
- check_stream_specifier(input_files[m->file_index].ctx,
- input_files[m->file_index].ctx->streams[m->stream_index],
- *p == ':' ? p + 1 : p) > 0)
- m->disabled = 1;
- }
- else
- for (i = 0; i < input_files[file_idx].nb_streams; i++) {
- if (check_stream_specifier(input_files[file_idx].ctx, input_files[file_idx].ctx->streams[i],
- *p == ':' ? p + 1 : p) <= 0)
- continue;
- o->stream_maps = grow_array(o->stream_maps, sizeof(*o->stream_maps),
- &o->nb_stream_maps, o->nb_stream_maps + 1);
- m = &o->stream_maps[o->nb_stream_maps - 1];
+ InputFile *ifile = NULL;
+ int64_t ipts_min = INT64_MAX;
+ int i;
- m->file_index = file_idx;
- m->stream_index = i;
+ for (i = 0; i < nb_input_streams; i++) {
+ InputStream *ist = input_streams[i];
+ int64_t ipts = ist->last_dts;
- if (sync_file_idx >= 0) {
- m->sync_file_index = sync_file_idx;
- m->sync_stream_index = sync_stream_idx;
- } else {
- m->sync_file_index = file_idx;
- m->sync_stream_index = i;
+ if (ist->discard || input_files[ist->file_index]->eagain)
+ continue;
+ if (!input_files[ist->file_index]->eof_reached) {
+ if (ipts < ipts_min) {
+ ipts_min = ipts;
+ ifile = input_files[ist->file_index];
}
}
-
- if (!m) {
- av_log(NULL, AV_LOG_FATAL, "Stream map '%s' matches no streams.\n", arg);
- exit_program(1);
}
- av_freep(&map);
- return 0;
-}
-
-static int opt_attach(OptionsContext *o, const char *opt, const char *arg)
-{
- o->attachments = grow_array(o->attachments, sizeof(*o->attachments),
- &o->nb_attachments, o->nb_attachments + 1);
- o->attachments[o->nb_attachments - 1] = arg;
- return 0;
-}
-
-/**
- * Parse a metadata specifier in arg.
- * @param type metadata type is written here -- g(lobal)/s(tream)/c(hapter)/p(rogram)
- * @param index for type c/p, chapter/program index is written here
- * @param stream_spec for type s, the stream specifier is written here
- */
-static void parse_meta_type(char *arg, char *type, int *index, const char **stream_spec)
-{
- if (*arg) {
- *type = *arg;
- switch (*arg) {
- case 'g':
- break;
- case 's':
- if (*(++arg) && *arg != ':') {
- av_log(NULL, AV_LOG_FATAL, "Invalid metadata specifier %s.\n", arg);
- exit_program(1);
- }
- *stream_spec = *arg == ':' ? arg + 1 : "";
- break;
- case 'c':
- case 'p':
- if (*(++arg) == ':')
- *index = strtol(++arg, NULL, 0);
- break;
- default:
- av_log(NULL, AV_LOG_FATAL, "Invalid metadata type %c.\n", *arg);
- exit_program(1);
- }
- } else
- *type = 'g';
+ return ifile;
}
-static int copy_metadata(char *outspec, char *inspec, AVFormatContext *oc, AVFormatContext *ic, OptionsContext *o)
+#if HAVE_PTHREADS
+static void *input_thread(void *arg)
{
- AVDictionary **meta_in = NULL;
- AVDictionary **meta_out;
- int i, ret = 0;
- char type_in, type_out;
- const char *istream_spec = NULL, *ostream_spec = NULL;
- int idx_in = 0, idx_out = 0;
-
- parse_meta_type(inspec, &type_in, &idx_in, &istream_spec);
- parse_meta_type(outspec, &type_out, &idx_out, &ostream_spec);
-
- if (type_in == 'g' || type_out == 'g')
- o->metadata_global_manual = 1;
- if (type_in == 's' || type_out == 's')
- o->metadata_streams_manual = 1;
- if (type_in == 'c' || type_out == 'c')
- o->metadata_chapters_manual = 1;
-
-#define METADATA_CHECK_INDEX(index, nb_elems, desc)\
- if ((index) < 0 || (index) >= (nb_elems)) {\
- av_log(NULL, AV_LOG_FATAL, "Invalid %s index %d while processing metadata maps.\n",\
- (desc), (index));\
- exit_program(1);\
- }
+ InputFile *f = arg;
+ int ret = 0;
-#define SET_DICT(type, meta, context, index)\
- switch (type) {\
- case 'g':\
- meta = &context->metadata;\
- break;\
- case 'c':\
- METADATA_CHECK_INDEX(index, context->nb_chapters, "chapter")\
- meta = &context->chapters[index]->metadata;\
- break;\
- case 'p':\
- METADATA_CHECK_INDEX(index, context->nb_programs, "program")\
- meta = &context->programs[index]->metadata;\
- break;\
- case 's':\
- break; /* handled separately below */ \
- }\
-
- SET_DICT(type_in, meta_in, ic, idx_in);
- SET_DICT(type_out, meta_out, oc, idx_out);
-
- /* for input streams choose first matching stream */
- if (type_in == 's') {
- for (i = 0; i < ic->nb_streams; i++) {
- if ((ret = check_stream_specifier(ic, ic->streams[i], istream_spec)) > 0) {
- meta_in = &ic->streams[i]->metadata;
- break;
- } else if (ret < 0)
- exit_program(1);
- }
- if (!meta_in) {
- av_log(NULL, AV_LOG_FATAL, "Stream specifier %s does not match any streams.\n", istream_spec);
- exit_program(1);
- }
- }
+ while (!transcoding_finished && ret >= 0) {
+ AVPacket pkt;
+ ret = av_read_frame(f->ctx, &pkt);
- if (type_out == 's') {
- for (i = 0; i < oc->nb_streams; i++) {
- if ((ret = check_stream_specifier(oc, oc->streams[i], ostream_spec)) > 0) {
- meta_out = &oc->streams[i]->metadata;
- av_dict_copy(meta_out, *meta_in, AV_DICT_DONT_OVERWRITE);
- } else if (ret < 0)
- exit_program(1);
- }
- } else
- av_dict_copy(meta_out, *meta_in, AV_DICT_DONT_OVERWRITE);
+ if (ret == AVERROR(EAGAIN)) {
+ av_usleep(10000);
+ ret = 0;
+ continue;
+ } else if (ret < 0)
+ break;
- return 0;
-}
+ pthread_mutex_lock(&f->fifo_lock);
+ while (!av_fifo_space(f->fifo))
+ pthread_cond_wait(&f->fifo_cond, &f->fifo_lock);
-static AVCodec *find_codec_or_die(const char *name, enum AVMediaType type, int encoder)
-{
- const char *codec_string = encoder ? "encoder" : "decoder";
- AVCodec *codec;
+ av_dup_packet(&pkt);
+ av_fifo_generic_write(f->fifo, &pkt, sizeof(pkt), NULL);
- codec = encoder ?
- avcodec_find_encoder_by_name(name) :
- avcodec_find_decoder_by_name(name);
- if (!codec) {
- av_log(NULL, AV_LOG_FATAL, "Unknown %s '%s'\n", codec_string, name);
- exit_program(1);
+ pthread_mutex_unlock(&f->fifo_lock);
}
- if (codec->type != type) {
- av_log(NULL, AV_LOG_FATAL, "Invalid %s type '%s'\n", codec_string, name);
- exit_program(1);
- }
- return codec;
-}
-static AVCodec *choose_decoder(OptionsContext *o, AVFormatContext *s, AVStream *st)
-{
- char *codec_name = NULL;
-
- MATCH_PER_STREAM_OPT(codec_names, str, codec_name, s, st);
- if (codec_name) {
- AVCodec *codec = find_codec_or_die(codec_name, st->codec->codec_type, 0);
- st->codec->codec_id = codec->id;
- return codec;
- } else
- return avcodec_find_decoder(st->codec->codec_id);
+ f->finished = 1;
+ return NULL;
}
-/**
- * Add all the streams from the given input file to the global
- * list of input streams.
- */
-static void add_input_streams(OptionsContext *o, AVFormatContext *ic)
+static void free_input_threads(void)
{
int i;
- for (i = 0; i < ic->nb_streams; i++) {
- AVStream *st = ic->streams[i];
- AVCodecContext *dec = st->codec;
- InputStream *ist;
-
- input_streams = grow_array(input_streams, sizeof(*input_streams), &nb_input_streams, nb_input_streams + 1);
- ist = &input_streams[nb_input_streams - 1];
- ist->st = st;
- ist->file_index = nb_input_files;
- ist->discard = 1;
- ist->opts = filter_codec_opts(codec_opts, ist->st->codec->codec_id, ic, st);
-
- ist->ts_scale = 1.0;
- MATCH_PER_STREAM_OPT(ts_scale, dbl, ist->ts_scale, ic, st);
-
- ist->dec = choose_decoder(o, ic, st);
-
- switch (dec->codec_type) {
- case AVMEDIA_TYPE_AUDIO:
- if (o->audio_disable)
- st->discard = AVDISCARD_ALL;
- break;
- case AVMEDIA_TYPE_VIDEO:
- if (dec->lowres) {
- dec->flags |= CODEC_FLAG_EMU_EDGE;
- dec->height >>= dec->lowres;
- dec->width >>= dec->lowres;
- }
-
- if (o->video_disable)
- st->discard = AVDISCARD_ALL;
- else if (video_discard)
- st->discard = video_discard;
- break;
- case AVMEDIA_TYPE_DATA:
- break;
- case AVMEDIA_TYPE_SUBTITLE:
- if (o->subtitle_disable)
- st->discard = AVDISCARD_ALL;
- break;
- case AVMEDIA_TYPE_ATTACHMENT:
- case AVMEDIA_TYPE_UNKNOWN:
- break;
- default:
- abort();
- }
- }
-}
-
-static void assert_file_overwrite(const char *filename)
-{
- if (!file_overwrite &&
- (strchr(filename, ':') == NULL || filename[1] == ':' ||
- av_strstart(filename, "file:", NULL))) {
- if (avio_check(filename, 0) == 0) {
- if (!using_stdin) {
- fprintf(stderr,"File '%s' already exists. Overwrite ? [y/N] ", filename);
- fflush(stderr);
- if (!read_yesno()) {
- fprintf(stderr, "Not overwriting - exiting\n");
- exit_program(1);
- }
- }
- else {
- fprintf(stderr,"File '%s' already exists. Exiting.\n", filename);
- exit_program(1);
- }
- }
- }
-}
-
-static void dump_attachment(AVStream *st, const char *filename)
-{
- int ret;
- AVIOContext *out = NULL;
- AVDictionaryEntry *e;
-
- if (!st->codec->extradata_size) {
- av_log(NULL, AV_LOG_WARNING, "No extradata to dump in stream #%d:%d.\n",
- nb_input_files - 1, st->index);
+ if (nb_input_files == 1)
return;
- }
- if (!*filename && (e = av_dict_get(st->metadata, "filename", NULL, 0)))
- filename = e->value;
- if (!*filename) {
- av_log(NULL, AV_LOG_FATAL, "No filename specified and no 'filename' tag"
- "in stream #%d:%d.\n", nb_input_files - 1, st->index);
- exit_program(1);
- }
- assert_file_overwrite(filename);
+ transcoding_finished = 1;
- if ((ret = avio_open2(&out, filename, AVIO_FLAG_WRITE, &int_cb, NULL)) < 0) {
- av_log(NULL, AV_LOG_FATAL, "Could not open file %s for writing.\n",
- filename);
- exit_program(1);
- }
+ for (i = 0; i < nb_input_files; i++) {
+ InputFile *f = input_files[i];
+ AVPacket pkt;
- avio_write(out, st->codec->extradata, st->codec->extradata_size);
- avio_flush(out);
- avio_close(out);
-}
+ if (!f->fifo || f->joined)
+ continue;
-static int opt_input_file(OptionsContext *o, const char *opt, const char *filename)
-{
- AVFormatContext *ic;
- AVInputFormat *file_iformat = NULL;
- int err, i, ret;
- int64_t timestamp;
- uint8_t buf[128];
- AVDictionary **opts;
- int orig_nb_streams; // number of streams before avformat_find_stream_info
-
- if (o->format) {
- if (!(file_iformat = av_find_input_format(o->format))) {
- av_log(NULL, AV_LOG_FATAL, "Unknown input format: '%s'\n", o->format);
- exit_program(1);
+ pthread_mutex_lock(&f->fifo_lock);
+ while (av_fifo_size(f->fifo)) {
+ av_fifo_generic_read(f->fifo, &pkt, sizeof(pkt), NULL);
+ av_free_packet(&pkt);
}
- }
+ pthread_cond_signal(&f->fifo_cond);
+ pthread_mutex_unlock(&f->fifo_lock);
- if (!strcmp(filename, "-"))
- filename = "pipe:";
+ pthread_join(f->thread, NULL);
+ f->joined = 1;
- using_stdin |= !strncmp(filename, "pipe:", 5) ||
- !strcmp(filename, "/dev/stdin");
-
- /* get default parameters from command line */
- ic = avformat_alloc_context();
- if (!ic) {
- print_error(filename, AVERROR(ENOMEM));
- exit_program(1);
- }
- if (o->nb_audio_sample_rate) {
- snprintf(buf, sizeof(buf), "%d", o->audio_sample_rate[o->nb_audio_sample_rate - 1].u.i);
- av_dict_set(&format_opts, "sample_rate", buf, 0);
- }
- if (o->nb_audio_channels) {
- snprintf(buf, sizeof(buf), "%d", o->audio_channels[o->nb_audio_channels - 1].u.i);
- av_dict_set(&format_opts, "channels", buf, 0);
- }
- if (o->nb_frame_rates) {
- av_dict_set(&format_opts, "framerate", o->frame_rates[o->nb_frame_rates - 1].u.str, 0);
- }
- if (o->nb_frame_sizes) {
- av_dict_set(&format_opts, "video_size", o->frame_sizes[o->nb_frame_sizes - 1].u.str, 0);
- }
- if (o->nb_frame_pix_fmts)
- av_dict_set(&format_opts, "pixel_format", o->frame_pix_fmts[o->nb_frame_pix_fmts - 1].u.str, 0);
-
- ic->flags |= AVFMT_FLAG_NONBLOCK;
- ic->interrupt_callback = int_cb;
-
- /* open the input file with generic libav function */
- err = avformat_open_input(&ic, filename, file_iformat, &format_opts);
- if (err < 0) {
- print_error(filename, err);
- exit_program(1);
- }
- assert_avoptions(format_opts);
-
- /* apply forced codec ids */
- for (i = 0; i < ic->nb_streams; i++)
- choose_decoder(o, ic, ic->streams[i]);
-
- /* Set AVCodecContext options for avformat_find_stream_info */
- opts = setup_find_stream_info_opts(ic, codec_opts);
- orig_nb_streams = ic->nb_streams;
-
- /* If not enough info to get the stream parameters, we decode the
- first frames to get it. (used in mpeg case for example) */
- ret = avformat_find_stream_info(ic, opts);
- if (ret < 0) {
- av_log(NULL, AV_LOG_FATAL, "%s: could not find codec parameters\n", filename);
- avformat_close_input(&ic);
- exit_program(1);
- }
-
- timestamp = o->start_time;
- /* add the stream start time */
- if (ic->start_time != AV_NOPTS_VALUE)
- timestamp += ic->start_time;
-
- /* if seeking requested, we execute it */
- if (o->start_time != 0) {
- ret = av_seek_frame(ic, -1, timestamp, AVSEEK_FLAG_BACKWARD);
- if (ret < 0) {
- av_log(NULL, AV_LOG_WARNING, "%s: could not seek to position %0.3f\n",
- filename, (double)timestamp / AV_TIME_BASE);
+ while (av_fifo_size(f->fifo)) {
+ av_fifo_generic_read(f->fifo, &pkt, sizeof(pkt), NULL);
+ av_free_packet(&pkt);
}
+ av_fifo_free(f->fifo);
}
+}
- /* update the current parameters so that they match the one of the input stream */
- add_input_streams(o, ic);
+static int init_input_threads(void)
+{
+ int i, ret;
- /* dump the file content */
- av_dump_format(ic, nb_input_files, filename, 0);
+ if (nb_input_files == 1)
+ return 0;
- input_files = grow_array(input_files, sizeof(*input_files), &nb_input_files, nb_input_files + 1);
- input_files[nb_input_files - 1].ctx = ic;
- input_files[nb_input_files - 1].ist_index = nb_input_streams - ic->nb_streams;
- input_files[nb_input_files - 1].ts_offset = o->input_ts_offset - (copy_ts ? 0 : timestamp);
- input_files[nb_input_files - 1].nb_streams = ic->nb_streams;
- input_files[nb_input_files - 1].rate_emu = o->rate_emu;
+ for (i = 0; i < nb_input_files; i++) {
+ InputFile *f = input_files[i];
- for (i = 0; i < o->nb_dump_attachment; i++) {
- int j;
+ if (!(f->fifo = av_fifo_alloc(8*sizeof(AVPacket))))
+ return AVERROR(ENOMEM);
- for (j = 0; j < ic->nb_streams; j++) {
- AVStream *st = ic->streams[j];
+ pthread_mutex_init(&f->fifo_lock, NULL);
+ pthread_cond_init (&f->fifo_cond, NULL);
- if (check_stream_specifier(ic, st, o->dump_attachment[i].specifier) == 1)
- dump_attachment(st, o->dump_attachment[i].u.str);
- }
+ if ((ret = pthread_create(&f->thread, NULL, input_thread, f)))
+ return AVERROR(ret);
}
-
- for (i = 0; i < orig_nb_streams; i++)
- av_dict_free(&opts[i]);
- av_freep(&opts);
-
- reset_options(o);
return 0;
}
-static uint8_t *get_line(AVIOContext *s)
+static int get_input_packet_mt(InputFile *f, AVPacket *pkt)
{
- AVIOContext *line;
- uint8_t *buf;
- char c;
+ int ret = 0;
- if (avio_open_dyn_buf(&line) < 0) {
- av_log(NULL, AV_LOG_FATAL, "Could not alloc buffer for reading preset.\n");
- exit_program(1);
- }
+ pthread_mutex_lock(&f->fifo_lock);
- while ((c = avio_r8(s)) && c != '\n')
- avio_w8(line, c);
- avio_w8(line, 0);
- avio_close_dyn_buf(line, &buf);
+ if (av_fifo_size(f->fifo)) {
+ av_fifo_generic_read(f->fifo, pkt, sizeof(*pkt), NULL);
+ pthread_cond_signal(&f->fifo_cond);
+ } else {
+ if (f->finished)
+ ret = AVERROR_EOF;
+ else
+ ret = AVERROR(EAGAIN);
+ }
- return buf;
-}
+ pthread_mutex_unlock(&f->fifo_lock);
-static int get_preset_file_2(const char *preset_name, const char *codec_name, AVIOContext **s)
-{
- int i, ret = 1;
- char filename[1000];
- const char *base[3] = { getenv("AVCONV_DATADIR"),
- getenv("HOME"),
- AVCONV_DATADIR,
- };
-
- for (i = 0; i < FF_ARRAY_ELEMS(base) && ret; i++) {
- if (!base[i])
- continue;
- if (codec_name) {
- snprintf(filename, sizeof(filename), "%s%s/%s-%s.avpreset", base[i],
- i != 1 ? "" : "/.avconv", codec_name, preset_name);
- ret = avio_open2(s, filename, AVIO_FLAG_READ, &int_cb, NULL);
- }
- if (ret) {
- snprintf(filename, sizeof(filename), "%s%s/%s.avpreset", base[i],
- i != 1 ? "" : "/.avconv", preset_name);
- ret = avio_open2(s, filename, AVIO_FLAG_READ, &int_cb, NULL);
- }
- }
return ret;
}
+#endif
-static void choose_encoder(OptionsContext *o, AVFormatContext *s, OutputStream *ost)
+static int get_input_packet(InputFile *f, AVPacket *pkt)
{
- char *codec_name = NULL;
-
- MATCH_PER_STREAM_OPT(codec_names, str, codec_name, s, ost->st);
- if (!codec_name) {
- ost->st->codec->codec_id = av_guess_codec(s->oformat, NULL, s->filename,
- NULL, ost->st->codec->codec_type);
- ost->enc = avcodec_find_encoder(ost->st->codec->codec_id);
- } else if (!strcmp(codec_name, "copy"))
- ost->stream_copy = 1;
- else {
- ost->enc = find_codec_or_die(codec_name, ost->st->codec->codec_type, 1);
- ost->st->codec->codec_id = ost->enc->id;
- }
+#if HAVE_PTHREADS
+ if (nb_input_files > 1)
+ return get_input_packet_mt(f, pkt);
+#endif
+ return av_read_frame(f->ctx, pkt);
}
-static OutputStream *new_output_stream(OptionsContext *o, AVFormatContext *oc, enum AVMediaType type)
+static int got_eagain(void)
{
- OutputStream *ost;
- AVStream *st = avformat_new_stream(oc, NULL);
- int idx = oc->nb_streams - 1, ret = 0;
- char *bsf = NULL, *next, *codec_tag = NULL;
- AVBitStreamFilterContext *bsfc, *bsfc_prev = NULL;
- double qscale = -1;
-
- if (!st) {
- av_log(NULL, AV_LOG_FATAL, "Could not alloc stream.\n");
- exit_program(1);
- }
-
- if (oc->nb_streams - 1 < o->nb_streamid_map)
- st->id = o->streamid_map[oc->nb_streams - 1];
-
- output_streams = grow_array(output_streams, sizeof(*output_streams), &nb_output_streams,
- nb_output_streams + 1);
- ost = &output_streams[nb_output_streams - 1];
- ost->file_index = nb_output_files;
- ost->index = idx;
- ost->st = st;
- st->codec->codec_type = type;
- choose_encoder(o, oc, ost);
- if (ost->enc) {
- AVIOContext *s = NULL;
- char *buf = NULL, *arg = NULL, *preset = NULL;
-
- ost->opts = filter_codec_opts(codec_opts, ost->enc->id, oc, st);
-
- MATCH_PER_STREAM_OPT(presets, str, preset, oc, st);
- if (preset && (!(ret = get_preset_file_2(preset, ost->enc->name, &s)))) {
- do {
- buf = get_line(s);
- if (!buf[0] || buf[0] == '#') {
- av_free(buf);
- continue;
- }
- if (!(arg = strchr(buf, '='))) {
- av_log(NULL, AV_LOG_FATAL, "Invalid line found in the preset file.\n");
- exit_program(1);
- }
- *arg++ = 0;
- av_dict_set(&ost->opts, buf, arg, AV_DICT_DONT_OVERWRITE);
- av_free(buf);
- } while (!s->eof_reached);
- avio_close(s);
- }
- if (ret) {
- av_log(NULL, AV_LOG_FATAL,
- "Preset %s specified for stream %d:%d, but could not be opened.\n",
- preset, ost->file_index, ost->index);
- exit_program(1);
- }
- }
-
- avcodec_get_context_defaults3(st->codec, ost->enc);
- st->codec->codec_type = type; // XXX hack, avcodec_get_context_defaults2() sets type to unknown for stream copy
-
- ost->max_frames = INT64_MAX;
- MATCH_PER_STREAM_OPT(max_frames, i64, ost->max_frames, oc, st);
-
- MATCH_PER_STREAM_OPT(bitstream_filters, str, bsf, oc, st);
- while (bsf) {
- if (next = strchr(bsf, ','))
- *next++ = 0;
- if (!(bsfc = av_bitstream_filter_init(bsf))) {
- av_log(NULL, AV_LOG_FATAL, "Unknown bitstream filter %s\n", bsf);
- exit_program(1);
- }
- if (bsfc_prev)
- bsfc_prev->next = bsfc;
- else
- ost->bitstream_filters = bsfc;
-
- bsfc_prev = bsfc;
- bsf = next;
- }
-
- MATCH_PER_STREAM_OPT(codec_tags, str, codec_tag, oc, st);
- if (codec_tag) {
- uint32_t tag = strtol(codec_tag, &next, 0);
- if (*next)
- tag = AV_RL32(codec_tag);
- st->codec->codec_tag = tag;
- }
-
- MATCH_PER_STREAM_OPT(qscale, dbl, qscale, oc, st);
- if (qscale >= 0 || same_quant) {
- st->codec->flags |= CODEC_FLAG_QSCALE;
- st->codec->global_quality = FF_QP2LAMBDA * qscale;
- }
-
- if (oc->oformat->flags & AVFMT_GLOBALHEADER)
- st->codec->flags |= CODEC_FLAG_GLOBAL_HEADER;
-
- av_opt_get_int(sws_opts, "sws_flags", 0, &ost->sws_flags);
- return ost;
+ int i;
+ for (i = 0; i < nb_input_files; i++)
+ if (input_files[i]->eagain)
+ return 1;
+ return 0;
}
-static void parse_matrix_coeffs(uint16_t *dest, const char *str)
+static void reset_eagain(void)
{
int i;
- const char *p = str;
- for (i = 0;; i++) {
- dest[i] = atoi(p);
- if (i == 63)
- break;
- p = strchr(p, ',');
- if (!p) {
- av_log(NULL, AV_LOG_FATAL, "Syntax error in matrix \"%s\" at coeff %d\n", str, i);
- exit_program(1);
- }
- p++;
- }
+ for (i = 0; i < nb_input_files; i++)
+ input_files[i]->eagain = 0;
}
-static OutputStream *new_video_stream(OptionsContext *o, AVFormatContext *oc)
+/*
+ * Read one packet from an input file and send it for
+ * - decoding -> lavfi (audio/video)
+ * - decoding -> encoding -> muxing (subtitles)
+ * - muxing (streamcopy)
+ *
+ * Return
+ * - 0 -- one packet was read and processed
+ * - AVERROR(EAGAIN) -- no packets were available for selected file,
+ * this function should be called again
+ * - AVERROR_EOF -- this function should not be called again
+ */
+static int process_input(void)
{
- AVStream *st;
- OutputStream *ost;
- AVCodecContext *video_enc;
-
- ost = new_output_stream(o, oc, AVMEDIA_TYPE_VIDEO);
- st = ost->st;
- video_enc = st->codec;
-
- if (!ost->stream_copy) {
- const char *p = NULL;
- char *frame_rate = NULL, *frame_size = NULL;
- char *frame_aspect_ratio = NULL, *frame_pix_fmt = NULL;
- char *intra_matrix = NULL, *inter_matrix = NULL, *filters = NULL;
- int i;
-
- MATCH_PER_STREAM_OPT(frame_rates, str, frame_rate, oc, st);
- if (frame_rate && av_parse_video_rate(&ost->frame_rate, frame_rate) < 0) {
- av_log(NULL, AV_LOG_FATAL, "Invalid framerate value: %s\n", frame_rate);
- exit_program(1);
- }
+ InputFile *ifile;
+ AVFormatContext *is;
+ InputStream *ist;
+ AVPacket pkt;
+ int ret, i, j;
- MATCH_PER_STREAM_OPT(frame_sizes, str, frame_size, oc, st);
- if (frame_size && av_parse_video_size(&video_enc->width, &video_enc->height, frame_size) < 0) {
- av_log(NULL, AV_LOG_FATAL, "Invalid frame size: %s.\n", frame_size);
- exit_program(1);
+ /* select the stream that we must read now */
+ ifile = select_input_file();
+ /* if none, if is finished */
+ if (!ifile) {
+ if (got_eagain()) {
+ reset_eagain();
+ av_usleep(10000);
+ return AVERROR(EAGAIN);
}
+ av_log(NULL, AV_LOG_VERBOSE, "No more inputs to read from.\n");
+ return AVERROR_EOF;
+ }
- MATCH_PER_STREAM_OPT(frame_aspect_ratios, str, frame_aspect_ratio, oc, st);
- if (frame_aspect_ratio)
- ost->frame_aspect_ratio = parse_frame_aspect_ratio(frame_aspect_ratio);
+ is = ifile->ctx;
+ ret = get_input_packet(ifile, &pkt);
- MATCH_PER_STREAM_OPT(frame_pix_fmts, str, frame_pix_fmt, oc, st);
- if (frame_pix_fmt && (video_enc->pix_fmt = av_get_pix_fmt(frame_pix_fmt)) == PIX_FMT_NONE) {
- av_log(NULL, AV_LOG_FATAL, "Unknown pixel format requested: %s.\n", frame_pix_fmt);
- exit_program(1);
+ if (ret == AVERROR(EAGAIN)) {
+ ifile->eagain = 1;
+ return ret;
+ }
+ if (ret < 0) {
+ if (ret != AVERROR_EOF) {
+ print_error(is->filename, ret);
+ if (exit_on_error)
+ exit(1);
}
- st->sample_aspect_ratio = video_enc->sample_aspect_ratio;
+ ifile->eof_reached = 1;
- MATCH_PER_STREAM_OPT(intra_matrices, str, intra_matrix, oc, st);
- if (intra_matrix) {
- if (!(video_enc->intra_matrix = av_mallocz(sizeof(*video_enc->intra_matrix) * 64))) {
- av_log(NULL, AV_LOG_FATAL, "Could not allocate memory for intra matrix.\n");
- exit_program(1);
- }
- parse_matrix_coeffs(video_enc->intra_matrix, intra_matrix);
- }
- MATCH_PER_STREAM_OPT(inter_matrices, str, inter_matrix, oc, st);
- if (inter_matrix) {
- if (!(video_enc->inter_matrix = av_mallocz(sizeof(*video_enc->inter_matrix) * 64))) {
- av_log(NULL, AV_LOG_FATAL, "Could not allocate memory for inter matrix.\n");
- exit_program(1);
- }
- parse_matrix_coeffs(video_enc->inter_matrix, inter_matrix);
- }
+ for (i = 0; i < ifile->nb_streams; i++) {
+ ist = input_streams[ifile->ist_index + i];
+ if (ist->decoding_needed)
+ output_packet(ist, NULL);
- MATCH_PER_STREAM_OPT(rc_overrides, str, p, oc, st);
- for (i = 0; p; i++) {
- int start, end, q;
- int e = sscanf(p, "%d,%d,%d", &start, &end, &q);
- if (e != 3) {
- av_log(NULL, AV_LOG_FATAL, "error parsing rc_override\n");
- exit_program(1);
- }
- video_enc->rc_override =
- av_realloc(video_enc->rc_override,
- sizeof(RcOverride) * (i + 1));
- video_enc->rc_override[i].start_frame = start;
- video_enc->rc_override[i].end_frame = end;
- if (q > 0) {
- video_enc->rc_override[i].qscale = q;
- video_enc->rc_override[i].quality_factor = 1.0;
- }
- else {
- video_enc->rc_override[i].qscale = 0;
- video_enc->rc_override[i].quality_factor = -q/100.0;
- }
- p = strchr(p, '/');
- if (p) p++;
- }
- video_enc->rc_override_count = i;
- if (!video_enc->rc_initial_buffer_occupancy)
- video_enc->rc_initial_buffer_occupancy = video_enc->rc_buffer_size * 3 / 4;
- video_enc->intra_dc_precision = intra_dc_precision - 8;
-
- /* two pass mode */
- if (do_pass) {
- if (do_pass == 1) {
- video_enc->flags |= CODEC_FLAG_PASS1;
- } else {
- video_enc->flags |= CODEC_FLAG_PASS2;
+ /* mark all outputs that don't go through lavfi as finished */
+ for (j = 0; j < nb_output_streams; j++) {
+ OutputStream *ost = output_streams[j];
+
+ if (ost->source_index == ifile->ist_index + i &&
+ (ost->stream_copy || ost->enc->type == AVMEDIA_TYPE_SUBTITLE))
+ ost->finished= 1;
}
}
- MATCH_PER_STREAM_OPT(forced_key_frames, str, ost->forced_keyframes, oc, st);
- if (ost->forced_keyframes)
- ost->forced_keyframes = av_strdup(ost->forced_keyframes);
-
- MATCH_PER_STREAM_OPT(force_fps, i, ost->force_fps, oc, st);
-
- ost->top_field_first = -1;
- MATCH_PER_STREAM_OPT(top_field_first, i, ost->top_field_first, oc, st);
-
-#if CONFIG_AVFILTER
- MATCH_PER_STREAM_OPT(filters, str, filters, oc, st);
- if (filters)
- ost->avfilter = av_strdup(filters);
-#endif
- } else {
- MATCH_PER_STREAM_OPT(copy_initial_nonkeyframes, i, ost->copy_initial_nonkeyframes, oc ,st);
+ return AVERROR(EAGAIN);
}
- return ost;
-}
+ reset_eagain();
-static OutputStream *new_audio_stream(OptionsContext *o, AVFormatContext *oc)
-{
- AVStream *st;
- OutputStream *ost;
- AVCodecContext *audio_enc;
+ if (do_pkt_dump) {
+ av_pkt_dump_log2(NULL, AV_LOG_DEBUG, &pkt, do_hex_dump,
+ is->streams[pkt.stream_index]);
+ }
+ /* the following test is needed in case new streams appear
+ dynamically in stream : we ignore them */
+ if (pkt.stream_index >= ifile->nb_streams)
+ goto discard_packet;
- ost = new_output_stream(o, oc, AVMEDIA_TYPE_AUDIO);
- st = ost->st;
+ ist = input_streams[ifile->ist_index + pkt.stream_index];
+ if (ist->discard)
+ goto discard_packet;
- audio_enc = st->codec;
- audio_enc->codec_type = AVMEDIA_TYPE_AUDIO;
+ if (pkt.dts != AV_NOPTS_VALUE)
+ pkt.dts += av_rescale_q(ifile->ts_offset, AV_TIME_BASE_Q, ist->st->time_base);
+ if (pkt.pts != AV_NOPTS_VALUE)
+ pkt.pts += av_rescale_q(ifile->ts_offset, AV_TIME_BASE_Q, ist->st->time_base);
- if (!ost->stream_copy) {
- char *sample_fmt = NULL;
+ if (pkt.pts != AV_NOPTS_VALUE)
+ pkt.pts *= ist->ts_scale;
+ if (pkt.dts != AV_NOPTS_VALUE)
+ pkt.dts *= ist->ts_scale;
- MATCH_PER_STREAM_OPT(audio_channels, i, audio_enc->channels, oc, st);
+ if (pkt.dts != AV_NOPTS_VALUE && ist->next_dts != AV_NOPTS_VALUE &&
+ (is->iformat->flags & AVFMT_TS_DISCONT)) {
+ int64_t pkt_dts = av_rescale_q(pkt.dts, ist->st->time_base, AV_TIME_BASE_Q);
+ int64_t delta = pkt_dts - ist->next_dts;
- MATCH_PER_STREAM_OPT(sample_fmts, str, sample_fmt, oc, st);
- if (sample_fmt &&
- (audio_enc->sample_fmt = av_get_sample_fmt(sample_fmt)) == AV_SAMPLE_FMT_NONE) {
- av_log(NULL, AV_LOG_FATAL, "Invalid sample format '%s'\n", sample_fmt);
- exit_program(1);
+ if ((FFABS(delta) > 1LL * dts_delta_threshold * AV_TIME_BASE || pkt_dts + 1 < ist->last_dts) && !copy_ts) {
+ ifile->ts_offset -= delta;
+ av_log(NULL, AV_LOG_DEBUG,
+ "timestamp discontinuity %"PRId64", new offset= %"PRId64"\n",
+ delta, ifile->ts_offset);
+ pkt.dts -= av_rescale_q(delta, AV_TIME_BASE_Q, ist->st->time_base);
+ if (pkt.pts != AV_NOPTS_VALUE)
+ pkt.pts -= av_rescale_q(delta, AV_TIME_BASE_Q, ist->st->time_base);
}
-
- MATCH_PER_STREAM_OPT(audio_sample_rate, i, audio_enc->sample_rate, oc, st);
- }
-
- return ost;
-}
-
-static OutputStream *new_data_stream(OptionsContext *o, AVFormatContext *oc)
-{
- OutputStream *ost;
-
- ost = new_output_stream(o, oc, AVMEDIA_TYPE_DATA);
- if (!ost->stream_copy) {
- av_log(NULL, AV_LOG_FATAL, "Data stream encoding not supported yet (only streamcopy)\n");
- exit_program(1);
}
- return ost;
-}
-
-static OutputStream *new_attachment_stream(OptionsContext *o, AVFormatContext *oc)
-{
- OutputStream *ost = new_output_stream(o, oc, AVMEDIA_TYPE_ATTACHMENT);
- ost->stream_copy = 1;
- return ost;
-}
-
-static OutputStream *new_subtitle_stream(OptionsContext *o, AVFormatContext *oc)
-{
- AVStream *st;
- OutputStream *ost;
- AVCodecContext *subtitle_enc;
-
- ost = new_output_stream(o, oc, AVMEDIA_TYPE_SUBTITLE);
- st = ost->st;
- subtitle_enc = st->codec;
-
- subtitle_enc->codec_type = AVMEDIA_TYPE_SUBTITLE;
-
- return ost;
-}
-
-/* arg format is "output-stream-index:streamid-value". */
-static int opt_streamid(OptionsContext *o, const char *opt, const char *arg)
-{
- int idx;
- char *p;
- char idx_str[16];
-
- av_strlcpy(idx_str, arg, sizeof(idx_str));
- p = strchr(idx_str, ':');
- if (!p) {
- av_log(NULL, AV_LOG_FATAL,
- "Invalid value '%s' for option '%s', required syntax is 'index:value'\n",
- arg, opt);
- exit_program(1);
+ ret = output_packet(ist, &pkt);
+ if (ret < 0) {
+ av_log(NULL, AV_LOG_ERROR, "Error while decoding stream #%d:%d\n",
+ ist->file_index, ist->st->index);
+ if (exit_on_error)
+ exit(1);
}
- *p++ = '\0';
- idx = parse_number_or_die(opt, idx_str, OPT_INT, 0, INT_MAX);
- o->streamid_map = grow_array(o->streamid_map, sizeof(*o->streamid_map), &o->nb_streamid_map, idx+1);
- o->streamid_map[idx] = parse_number_or_die(opt, p, OPT_INT, 0, INT_MAX);
- return 0;
-}
-
-static int copy_chapters(InputFile *ifile, OutputFile *ofile, int copy_metadata)
-{
- AVFormatContext *is = ifile->ctx;
- AVFormatContext *os = ofile->ctx;
- int i;
-
- for (i = 0; i < is->nb_chapters; i++) {
- AVChapter *in_ch = is->chapters[i], *out_ch;
- int64_t ts_off = av_rescale_q(ofile->start_time - ifile->ts_offset,
- AV_TIME_BASE_Q, in_ch->time_base);
- int64_t rt = (ofile->recording_time == INT64_MAX) ? INT64_MAX :
- av_rescale_q(ofile->recording_time, AV_TIME_BASE_Q, in_ch->time_base);
-
-
- if (in_ch->end < ts_off)
- continue;
- if (rt != INT64_MAX && in_ch->start > rt + ts_off)
- break;
-
- out_ch = av_mallocz(sizeof(AVChapter));
- if (!out_ch)
- return AVERROR(ENOMEM);
-
- out_ch->id = in_ch->id;
- out_ch->time_base = in_ch->time_base;
- out_ch->start = FFMAX(0, in_ch->start - ts_off);
- out_ch->end = FFMIN(rt, in_ch->end - ts_off);
- if (copy_metadata)
- av_dict_copy(&out_ch->metadata, in_ch->metadata, 0);
+discard_packet:
+ av_free_packet(&pkt);
- os->nb_chapters++;
- os->chapters = av_realloc(os->chapters, sizeof(AVChapter) * os->nb_chapters);
- if (!os->chapters)
- return AVERROR(ENOMEM);
- os->chapters[os->nb_chapters - 1] = out_ch;
- }
return 0;
}
-static void opt_output_file(void *optctx, const char *filename)
+/*
+ * The following code is the main loop of the file converter
+ */
+static int transcode(void)
{
- OptionsContext *o = optctx;
- AVFormatContext *oc;
- int i, err;
- AVOutputFormat *file_oformat;
+ int ret, i, need_input = 1;
+ AVFormatContext *os;
OutputStream *ost;
- InputStream *ist;
-
- if (!strcmp(filename, "-"))
- filename = "pipe:";
+ InputStream *ist;
+ int64_t timer_start;
- oc = avformat_alloc_context();
- if (!oc) {
- print_error(filename, AVERROR(ENOMEM));
- exit_program(1);
- }
+ ret = transcode_init();
+ if (ret < 0)
+ goto fail;
- if (o->format) {
- file_oformat = av_guess_format(o->format, NULL, NULL);
- if (!file_oformat) {
- av_log(NULL, AV_LOG_FATAL, "Requested output format '%s' is not a suitable output format\n", o->format);
- exit_program(1);
- }
- } else {
- file_oformat = av_guess_format(NULL, filename, NULL);
- if (!file_oformat) {
- av_log(NULL, AV_LOG_FATAL, "Unable to find a suitable output format for '%s'\n",
- filename);
- exit_program(1);
- }
- }
+ av_log(NULL, AV_LOG_INFO, "Press ctrl-c to stop encoding\n");
+ term_init();
- oc->oformat = file_oformat;
- oc->interrupt_callback = int_cb;
- av_strlcpy(oc->filename, filename, sizeof(oc->filename));
-
- if (!o->nb_stream_maps) {
- /* pick the "best" stream of each type */
-#define NEW_STREAM(type, index)\
- if (index >= 0) {\
- ost = new_ ## type ## _stream(o, oc);\
- ost->source_index = index;\
- ost->sync_ist = &input_streams[index];\
- input_streams[index].discard = 0;\
- }
+ timer_start = av_gettime();
- /* video: highest resolution */
- if (!o->video_disable && oc->oformat->video_codec != CODEC_ID_NONE) {
- int area = 0, idx = -1;
- for (i = 0; i < nb_input_streams; i++) {
- ist = &input_streams[i];
- if (ist->st->codec->codec_type == AVMEDIA_TYPE_VIDEO &&
- ist->st->codec->width * ist->st->codec->height > area) {
- area = ist->st->codec->width * ist->st->codec->height;
- idx = i;
- }
- }
- NEW_STREAM(video, idx);
- }
+#if HAVE_PTHREADS
+ if ((ret = init_input_threads()) < 0)
+ goto fail;
+#endif
- /* audio: most channels */
- if (!o->audio_disable && oc->oformat->audio_codec != CODEC_ID_NONE) {
- int channels = 0, idx = -1;
- for (i = 0; i < nb_input_streams; i++) {
- ist = &input_streams[i];
- if (ist->st->codec->codec_type == AVMEDIA_TYPE_AUDIO &&
- ist->st->codec->channels > channels) {
- channels = ist->st->codec->channels;
- idx = i;
- }
- }
- NEW_STREAM(audio, idx);
+ while (!received_sigterm) {
+ /* check if there's any stream where output is still needed */
+ if (!need_output()) {
+ av_log(NULL, AV_LOG_VERBOSE, "No more output streams to write to, finishing.\n");
+ break;
}
- /* subtitles: pick first */
- if (!o->subtitle_disable && oc->oformat->subtitle_codec != CODEC_ID_NONE) {
- for (i = 0; i < nb_input_streams; i++)
- if (input_streams[i].st->codec->codec_type == AVMEDIA_TYPE_SUBTITLE) {
- NEW_STREAM(subtitle, i);
- break;
- }
+ /* read and process one input packet if needed */
+ if (need_input) {
+ ret = process_input();
+ if (ret == AVERROR_EOF)
+ need_input = 0;
}
- /* do something with data? */
- } else {
- for (i = 0; i < o->nb_stream_maps; i++) {
- StreamMap *map = &o->stream_maps[i];
- if (map->disabled)
+ ret = poll_filters();
+ if (ret < 0) {
+ if (ret == AVERROR_EOF || ret == AVERROR(EAGAIN))
continue;
- ist = &input_streams[input_files[map->file_index].ist_index + map->stream_index];
- switch (ist->st->codec->codec_type) {
- case AVMEDIA_TYPE_VIDEO: ost = new_video_stream(o, oc); break;
- case AVMEDIA_TYPE_AUDIO: ost = new_audio_stream(o, oc); break;
- case AVMEDIA_TYPE_SUBTITLE: ost = new_subtitle_stream(o, oc); break;
- case AVMEDIA_TYPE_DATA: ost = new_data_stream(o, oc); break;
- case AVMEDIA_TYPE_ATTACHMENT: ost = new_attachment_stream(o, oc); break;
- default:
- av_log(NULL, AV_LOG_FATAL, "Cannot map stream #%d:%d - unsupported type.\n",
- map->file_index, map->stream_index);
- exit_program(1);
- }
-
- ost->source_index = input_files[map->file_index].ist_index + map->stream_index;
- ost->sync_ist = &input_streams[input_files[map->sync_file_index].ist_index +
- map->sync_stream_index];
- ist->discard = 0;
+ av_log(NULL, AV_LOG_ERROR, "Error while filtering.\n");
+ break;
}
- }
- /* handle attached files */
- for (i = 0; i < o->nb_attachments; i++) {
- AVIOContext *pb;
- uint8_t *attachment;
- const char *p;
- int64_t len;
-
- if ((err = avio_open2(&pb, o->attachments[i], AVIO_FLAG_READ, &int_cb, NULL)) < 0) {
- av_log(NULL, AV_LOG_FATAL, "Could not open attachment file %s.\n",
- o->attachments[i]);
- exit_program(1);
- }
- if ((len = avio_size(pb)) <= 0) {
- av_log(NULL, AV_LOG_FATAL, "Could not get size of the attachment %s.\n",
- o->attachments[i]);
- exit_program(1);
- }
- if (!(attachment = av_malloc(len))) {
- av_log(NULL, AV_LOG_FATAL, "Attachment %s too large to fit into memory.\n",
- o->attachments[i]);
- exit_program(1);
- }
- avio_read(pb, attachment, len);
-
- ost = new_attachment_stream(o, oc);
- ost->stream_copy = 0;
- ost->source_index = -1;
- ost->attachment_filename = o->attachments[i];
- ost->st->codec->extradata = attachment;
- ost->st->codec->extradata_size = len;
-
- p = strrchr(o->attachments[i], '/');
- av_dict_set(&ost->st->metadata, "filename", (p && *p) ? p + 1 : o->attachments[i], AV_DICT_DONT_OVERWRITE);
- avio_close(pb);
+ /* dump report by using the output first video and audio streams */
+ print_report(0, timer_start);
}
+#if HAVE_PTHREADS
+ free_input_threads();
+#endif
- output_files = grow_array(output_files, sizeof(*output_files), &nb_output_files, nb_output_files + 1);
- output_files[nb_output_files - 1].ctx = oc;
- output_files[nb_output_files - 1].ost_index = nb_output_streams - oc->nb_streams;
- output_files[nb_output_files - 1].recording_time = o->recording_time;
- output_files[nb_output_files - 1].start_time = o->start_time;
- output_files[nb_output_files - 1].limit_filesize = o->limit_filesize;
- av_dict_copy(&output_files[nb_output_files - 1].opts, format_opts, 0);
-
- /* check filename in case of an image number is expected */
- if (oc->oformat->flags & AVFMT_NEEDNUMBER) {
- if (!av_filename_number_test(oc->filename)) {
- print_error(oc->filename, AVERROR(EINVAL));
- exit_program(1);
+ /* at the end of stream, we must flush the decoder buffers */
+ for (i = 0; i < nb_input_streams; i++) {
+ ist = input_streams[i];
+ if (!input_files[ist->file_index]->eof_reached && ist->decoding_needed) {
+ output_packet(ist, NULL);
}
}
+ poll_filters();
+ flush_encoders();
- if (!(oc->oformat->flags & AVFMT_NOFILE)) {
- /* test if it already exists to avoid losing precious files */
- assert_file_overwrite(filename);
-
- /* open the file */
- if ((err = avio_open2(&oc->pb, filename, AVIO_FLAG_WRITE,
- &oc->interrupt_callback,
- &output_files[nb_output_files - 1].opts)) < 0) {
- print_error(filename, err);
- exit_program(1);
- }
- }
+ term_exit();
- if (o->mux_preload) {
- uint8_t buf[64];
- snprintf(buf, sizeof(buf), "%d", (int)(o->mux_preload*AV_TIME_BASE));
- av_dict_set(&output_files[nb_output_files - 1].opts, "preload", buf, 0);
+ /* write the trailer if needed and close file */
+ for (i = 0; i < nb_output_files; i++) {
+ os = output_files[i]->ctx;
+ av_write_trailer(os);
}
- oc->max_delay = (int)(o->mux_max_delay * AV_TIME_BASE);
- oc->flags |= AVFMT_FLAG_NONBLOCK;
- /* copy metadata */
- for (i = 0; i < o->nb_metadata_map; i++) {
- char *p;
- int in_file_index = strtol(o->metadata_map[i].u.str, &p, 0);
+ /* dump report by using the first video and audio streams */
+ print_report(1, timer_start);
- if (in_file_index < 0)
- continue;
- if (in_file_index >= nb_input_files) {
- av_log(NULL, AV_LOG_FATAL, "Invalid input file index %d while processing metadata maps\n", in_file_index);
- exit_program(1);
+ /* close each encoder */
+ for (i = 0; i < nb_output_streams; i++) {
+ ost = output_streams[i];
+ if (ost->encoding_needed) {
+ av_freep(&ost->st->codec->stats_in);
+ avcodec_close(ost->st->codec);
}
- copy_metadata(o->metadata_map[i].specifier, *p ? p + 1 : p, oc, input_files[in_file_index].ctx, o);
}
- /* copy chapters */
- if (o->chapters_input_file >= nb_input_files) {
- if (o->chapters_input_file == INT_MAX) {
- /* copy chapters from the first input file that has them*/
- o->chapters_input_file = -1;
- for (i = 0; i < nb_input_files; i++)
- if (input_files[i].ctx->nb_chapters) {
- o->chapters_input_file = i;
- break;
- }
- } else {
- av_log(NULL, AV_LOG_FATAL, "Invalid input file index %d in chapter mapping.\n",
- o->chapters_input_file);
- exit_program(1);
+ /* close each decoder */
+ for (i = 0; i < nb_input_streams; i++) {
+ ist = input_streams[i];
+ if (ist->decoding_needed) {
+ avcodec_close(ist->st->codec);
}
}
- if (o->chapters_input_file >= 0)
- copy_chapters(&input_files[o->chapters_input_file], &output_files[nb_output_files - 1],
- !o->metadata_chapters_manual);
-
- /* copy global metadata by default */
- if (!o->metadata_global_manual && nb_input_files)
- av_dict_copy(&oc->metadata, input_files[0].ctx->metadata,
- AV_DICT_DONT_OVERWRITE);
- if (!o->metadata_streams_manual)
- for (i = output_files[nb_output_files - 1].ost_index; i < nb_output_streams; i++) {
- InputStream *ist;
- if (output_streams[i].source_index < 0) /* this is true e.g. for attached files */
- continue;
- ist = &input_streams[output_streams[i].source_index];
- av_dict_copy(&output_streams[i].st->metadata, ist->st->metadata, AV_DICT_DONT_OVERWRITE);
- }
- /* process manually set metadata */
- for (i = 0; i < o->nb_metadata; i++) {
- AVDictionary **m;
- char type, *val;
- const char *stream_spec;
- int index = 0, j, ret;
-
- val = strchr(o->metadata[i].u.str, '=');
- if (!val) {
- av_log(NULL, AV_LOG_FATAL, "No '=' character in metadata string %s.\n",
- o->metadata[i].u.str);
- exit_program(1);
- }
- *val++ = 0;
-
- parse_meta_type(o->metadata[i].specifier, &type, &index, &stream_spec);
- if (type == 's') {
- for (j = 0; j < oc->nb_streams; j++) {
- if ((ret = check_stream_specifier(oc, oc->streams[j], stream_spec)) > 0) {
- av_dict_set(&oc->streams[j]->metadata, o->metadata[i].u.str, *val ? val : NULL, 0);
- } else if (ret < 0)
- exit_program(1);
- }
- printf("ret %d, stream_spec %s\n", ret, stream_spec);
- }
- else {
- switch (type) {
- case 'g':
- m = &oc->metadata;
- break;
- case 'c':
- if (index < 0 || index >= oc->nb_chapters) {
- av_log(NULL, AV_LOG_FATAL, "Invalid chapter index %d in metadata specifier.\n", index);
- exit_program(1);
+ /* finished ! */
+ ret = 0;
+
+ fail:
+#if HAVE_PTHREADS
+ free_input_threads();
+#endif
+
+ if (output_streams) {
+ for (i = 0; i < nb_output_streams; i++) {
+ ost = output_streams[i];
+ if (ost) {
+ if (ost->stream_copy)
+ av_freep(&ost->st->codec->extradata);
+ if (ost->logfile) {
+ fclose(ost->logfile);
+ ost->logfile = NULL;
}
- m = &oc->chapters[index]->metadata;
- break;
- default:
- av_log(NULL, AV_LOG_FATAL, "Invalid metadata specifier %s.\n", o->metadata[i].specifier);
- exit_program(1);
+ av_freep(&ost->st->codec->subtitle_header);
+ av_free(ost->forced_kf_pts);
+ av_dict_free(&ost->opts);
}
- av_dict_set(m, o->metadata[i].u.str, *val ? val : NULL, 0);
}
}
-
- reset_options(o);
-}
-
-/* same option as mencoder */
-static int opt_pass(const char *opt, const char *arg)
-{
- do_pass = parse_number_or_die(opt, arg, OPT_INT, 1, 2);
- return 0;
+ return ret;
}
static int64_t getutime(void)
@@ -4147,371 +2345,12 @@ static int64_t getmaxrss(void)
#endif
}
-static int opt_audio_qscale(OptionsContext *o, const char *opt, const char *arg)
-{
- return parse_option(o, "q:a", arg, options);
-}
-
-static void show_usage(void)
-{
- printf("Hyper fast Audio and Video encoder\n");
- printf("usage: %s [options] [[infile options] -i infile]... {[outfile options] outfile}...\n", program_name);
- printf("\n");
-}
-
-static void show_help(void)
-{
- 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",
- OPT_EXPERT | OPT_AUDIO | OPT_VIDEO | OPT_SUBTITLE | OPT_GRAB, 0);
- show_help_options(options, "\nAdvanced options:\n",
- OPT_EXPERT | OPT_AUDIO | OPT_VIDEO | OPT_SUBTITLE | OPT_GRAB,
- OPT_EXPERT);
- show_help_options(options, "\nVideo options:\n",
- OPT_EXPERT | OPT_AUDIO | OPT_VIDEO | OPT_GRAB,
- OPT_VIDEO);
- show_help_options(options, "\nAdvanced Video options:\n",
- OPT_EXPERT | OPT_AUDIO | OPT_VIDEO | OPT_GRAB,
- OPT_VIDEO | OPT_EXPERT);
- show_help_options(options, "\nAudio options:\n",
- OPT_EXPERT | OPT_AUDIO | OPT_VIDEO | OPT_GRAB,
- OPT_AUDIO);
- show_help_options(options, "\nAdvanced Audio options:\n",
- OPT_EXPERT | OPT_AUDIO | OPT_VIDEO | OPT_GRAB,
- OPT_AUDIO | OPT_EXPERT);
- show_help_options(options, "\nSubtitle options:\n",
- OPT_SUBTITLE | OPT_GRAB,
- OPT_SUBTITLE);
- show_help_options(options, "\nAudio/Video grab options:\n",
- OPT_GRAB,
- OPT_GRAB);
- printf("\n");
- show_help_children(avcodec_get_class(), flags);
- show_help_children(avformat_get_class(), flags);
- show_help_children(sws_get_class(), flags);
-}
-
-static int opt_target(OptionsContext *o, const char *opt, const char *arg)
-{
- enum { PAL, NTSC, FILM, UNKNOWN } norm = UNKNOWN;
- static const char *const frame_rates[] = { "25", "30000/1001", "24000/1001" };
-
- if (!strncmp(arg, "pal-", 4)) {
- norm = PAL;
- arg += 4;
- } else if (!strncmp(arg, "ntsc-", 5)) {
- norm = NTSC;
- arg += 5;
- } else if (!strncmp(arg, "film-", 5)) {
- norm = FILM;
- arg += 5;
- } else {
- /* Try to determine PAL/NTSC by peeking in the input files */
- if (nb_input_files) {
- int i, j, fr;
- for (j = 0; j < nb_input_files; j++) {
- for (i = 0; i < input_files[j].nb_streams; i++) {
- AVCodecContext *c = input_files[j].ctx->streams[i]->codec;
- if (c->codec_type != AVMEDIA_TYPE_VIDEO)
- continue;
- fr = c->time_base.den * 1000 / c->time_base.num;
- if (fr == 25000) {
- norm = PAL;
- break;
- } else if ((fr == 29970) || (fr == 23976)) {
- norm = NTSC;
- break;
- }
- }
- if (norm != UNKNOWN)
- break;
- }
- }
- if (norm != UNKNOWN)
- av_log(NULL, AV_LOG_INFO, "Assuming %s for target.\n", norm == PAL ? "PAL" : "NTSC");
- }
-
- if (norm == UNKNOWN) {
- av_log(NULL, AV_LOG_FATAL, "Could not determine norm (PAL/NTSC/NTSC-Film) for target.\n");
- av_log(NULL, AV_LOG_FATAL, "Please prefix target with \"pal-\", \"ntsc-\" or \"film-\",\n");
- av_log(NULL, AV_LOG_FATAL, "or set a framerate with \"-r xxx\".\n");
- exit_program(1);
- }
-
- if (!strcmp(arg, "vcd")) {
- opt_video_codec(o, "c:v", "mpeg1video");
- opt_audio_codec(o, "c:a", "mp2");
- parse_option(o, "f", "vcd", options);
-
- parse_option(o, "s", norm == PAL ? "352x288" : "352x240", options);
- parse_option(o, "r", frame_rates[norm], options);
- opt_default("g", norm == PAL ? "15" : "18");
-
- opt_default("b", "1150000");
- opt_default("maxrate", "1150000");
- opt_default("minrate", "1150000");
- opt_default("bufsize", "327680"); // 40*1024*8;
-
- opt_default("b:a", "224000");
- parse_option(o, "ar", "44100", options);
- parse_option(o, "ac", "2", options);
-
- opt_default("packetsize", "2324");
- opt_default("muxrate", "1411200"); // 2352 * 75 * 8;
-
- /* We have to offset the PTS, so that it is consistent with the SCR.
- SCR starts at 36000, but the first two packs contain only padding
- and the first pack from the other stream, respectively, may also have
- been written before.
- So the real data starts at SCR 36000+3*1200. */
- o->mux_preload = (36000 + 3 * 1200) / 90000.0; // 0.44
- } else if (!strcmp(arg, "svcd")) {
-
- opt_video_codec(o, "c:v", "mpeg2video");
- opt_audio_codec(o, "c:a", "mp2");
- parse_option(o, "f", "svcd", options);
-
- parse_option(o, "s", norm == PAL ? "480x576" : "480x480", options);
- parse_option(o, "r", frame_rates[norm], options);
- opt_default("g", norm == PAL ? "15" : "18");
-
- opt_default("b", "2040000");
- opt_default("maxrate", "2516000");
- opt_default("minrate", "0"); // 1145000;
- opt_default("bufsize", "1835008"); // 224*1024*8;
- opt_default("flags", "+scan_offset");
-
-
- opt_default("b:a", "224000");
- parse_option(o, "ar", "44100", options);
-
- opt_default("packetsize", "2324");
-
- } else if (!strcmp(arg, "dvd")) {
-
- opt_video_codec(o, "c:v", "mpeg2video");
- opt_audio_codec(o, "c:a", "ac3");
- parse_option(o, "f", "dvd", options);
-
- parse_option(o, "s", norm == PAL ? "720x576" : "720x480", options);
- parse_option(o, "r", frame_rates[norm], options);
- opt_default("g", norm == PAL ? "15" : "18");
-
- opt_default("b", "6000000");
- opt_default("maxrate", "9000000");
- opt_default("minrate", "0"); // 1500000;
- opt_default("bufsize", "1835008"); // 224*1024*8;
-
- opt_default("packetsize", "2048"); // from www.mpucoder.com: DVD sectors contain 2048 bytes of data, this is also the size of one pack.
- opt_default("muxrate", "10080000"); // from mplex project: data_rate = 1260000. mux_rate = data_rate * 8
-
- opt_default("b:a", "448000");
- parse_option(o, "ar", "48000", options);
-
- } else if (!strncmp(arg, "dv", 2)) {
-
- parse_option(o, "f", "dv", options);
-
- parse_option(o, "s", norm == PAL ? "720x576" : "720x480", options);
- parse_option(o, "pix_fmt", !strncmp(arg, "dv50", 4) ? "yuv422p" :
- norm == PAL ? "yuv420p" : "yuv411p", options);
- parse_option(o, "r", frame_rates[norm], options);
-
- parse_option(o, "ar", "48000", options);
- parse_option(o, "ac", "2", options);
-
- } else {
- av_log(NULL, AV_LOG_ERROR, "Unknown target: %s\n", arg);
- return AVERROR(EINVAL);
- }
- return 0;
-}
-
-static int opt_vstats_file(const char *opt, const char *arg)
-{
- av_free (vstats_filename);
- vstats_filename = av_strdup (arg);
- return 0;
-}
-
-static int opt_vstats(const char *opt, const char *arg)
-{
- char filename[40];
- time_t today2 = time(NULL);
- struct tm *today = localtime(&today2);
-
- snprintf(filename, sizeof(filename), "vstats_%02d%02d%02d.log", today->tm_hour, today->tm_min,
- today->tm_sec);
- return opt_vstats_file(opt, filename);
-}
-
-static int opt_video_frames(OptionsContext *o, const char *opt, const char *arg)
-{
- return parse_option(o, "frames:v", arg, options);
-}
-
-static int opt_audio_frames(OptionsContext *o, const char *opt, const char *arg)
-{
- return parse_option(o, "frames:a", arg, options);
-}
-
-static int opt_data_frames(OptionsContext *o, const char *opt, const char *arg)
-{
- return parse_option(o, "frames:d", arg, options);
-}
-
-static int opt_video_tag(OptionsContext *o, const char *opt, const char *arg)
-{
- return parse_option(o, "tag:v", arg, options);
-}
-
-static int opt_audio_tag(OptionsContext *o, const char *opt, const char *arg)
-{
- return parse_option(o, "tag:a", arg, options);
-}
-
-static int opt_subtitle_tag(OptionsContext *o, const char *opt, const char *arg)
-{
- return parse_option(o, "tag:s", arg, options);
-}
-
-static int opt_video_filters(OptionsContext *o, const char *opt, const char *arg)
-{
- return parse_option(o, "filter:v", arg, options);
-}
-
-static int opt_vsync(const char *opt, const char *arg)
-{
- if (!av_strcasecmp(arg, "cfr")) video_sync_method = VSYNC_CFR;
- else if (!av_strcasecmp(arg, "vfr")) video_sync_method = VSYNC_VFR;
- else if (!av_strcasecmp(arg, "passthrough")) video_sync_method = VSYNC_PASSTHROUGH;
-
- if (video_sync_method == VSYNC_AUTO)
- video_sync_method = parse_number_or_die("vsync", arg, OPT_INT, VSYNC_AUTO, VSYNC_VFR);
- return 0;
-}
-
-#define OFFSET(x) offsetof(OptionsContext, x)
-static const OptionDef options[] = {
- /* main options */
-#include "cmdutils_common_opts.h"
- { "f", HAS_ARG | OPT_STRING | OPT_OFFSET, {.off = OFFSET(format)}, "force format", "fmt" },
- { "i", HAS_ARG | OPT_FUNC2, {(void*)opt_input_file}, "input file name", "filename" },
- { "y", OPT_BOOL, {(void*)&file_overwrite}, "overwrite output files" },
- { "c", HAS_ARG | OPT_STRING | OPT_SPEC, {.off = OFFSET(codec_names)}, "codec name", "codec" },
- { "codec", HAS_ARG | OPT_STRING | OPT_SPEC, {.off = OFFSET(codec_names)}, "codec name", "codec" },
- { "pre", HAS_ARG | OPT_STRING | OPT_SPEC, {.off = OFFSET(presets)}, "preset name", "preset" },
- { "map", HAS_ARG | OPT_EXPERT | OPT_FUNC2, {(void*)opt_map}, "set input stream mapping", "[-]input_file_id[:stream_specifier][,sync_file_id[:stream_specifier]]" },
- { "map_metadata", HAS_ARG | OPT_STRING | OPT_SPEC, {.off = OFFSET(metadata_map)}, "set metadata information of outfile from infile",
- "outfile[,metadata]:infile[,metadata]" },
- { "map_chapters", OPT_INT | HAS_ARG | OPT_EXPERT | OPT_OFFSET, {.off = OFFSET(chapters_input_file)}, "set chapters mapping", "input_file_index" },
- { "t", HAS_ARG | OPT_TIME | OPT_OFFSET, {.off = OFFSET(recording_time)}, "record or transcode \"duration\" seconds of audio/video", "duration" },
- { "fs", HAS_ARG | OPT_INT64 | OPT_OFFSET, {.off = OFFSET(limit_filesize)}, "set the limit file size in bytes", "limit_size" }, //
- { "ss", HAS_ARG | OPT_TIME | OPT_OFFSET, {.off = OFFSET(start_time)}, "set the start time offset", "time_off" },
- { "itsoffset", HAS_ARG | OPT_TIME | OPT_OFFSET, {.off = OFFSET(input_ts_offset)}, "set the input ts offset", "time_off" },
- { "itsscale", HAS_ARG | OPT_DOUBLE | OPT_SPEC, {.off = OFFSET(ts_scale)}, "set the input ts scale", "scale" },
- { "metadata", HAS_ARG | OPT_STRING | OPT_SPEC, {.off = OFFSET(metadata)}, "add metadata", "string=string" },
- { "dframes", HAS_ARG | OPT_FUNC2, {(void*)opt_data_frames}, "set the number of data frames to record", "number" },
- { "benchmark", OPT_BOOL | OPT_EXPERT, {(void*)&do_benchmark},
- "add timings for benchmarking" },
- { "timelimit", HAS_ARG, {(void*)opt_timelimit}, "set max runtime in seconds", "limit" },
- { "dump", OPT_BOOL | OPT_EXPERT, {(void*)&do_pkt_dump},
- "dump each input packet" },
- { "hex", OPT_BOOL | OPT_EXPERT, {(void*)&do_hex_dump},
- "when dumping packets, also dump the payload" },
- { "re", OPT_BOOL | OPT_EXPERT | OPT_OFFSET, {.off = OFFSET(rate_emu)}, "read input at native frame rate", "" },
- { "target", HAS_ARG | OPT_FUNC2, {(void*)opt_target}, "specify target file type (\"vcd\", \"svcd\", \"dvd\", \"dv\", \"dv50\", \"pal-vcd\", \"ntsc-svcd\", ...)", "type" },
- { "vsync", HAS_ARG | OPT_EXPERT, {(void*)opt_vsync}, "video sync method", "" },
- { "async", HAS_ARG | OPT_INT | OPT_EXPERT, {(void*)&audio_sync_method}, "audio sync method", "" },
- { "adrift_threshold", HAS_ARG | OPT_FLOAT | OPT_EXPERT, {(void*)&audio_drift_threshold}, "audio drift threshold", "threshold" },
- { "copyts", OPT_BOOL | OPT_EXPERT, {(void*)&copy_ts}, "copy timestamps" },
- { "copytb", OPT_BOOL | OPT_EXPERT, {(void*)&copy_tb}, "copy input stream time base when stream copying" },
- { "shortest", OPT_BOOL | OPT_EXPERT, {(void*)&opt_shortest}, "finish encoding within shortest input" }, //
- { "dts_delta_threshold", HAS_ARG | OPT_FLOAT | OPT_EXPERT, {(void*)&dts_delta_threshold}, "timestamp discontinuity delta threshold", "threshold" },
- { "xerror", OPT_BOOL, {(void*)&exit_on_error}, "exit on error", "error" },
- { "copyinkf", OPT_BOOL | OPT_EXPERT | OPT_SPEC, {.off = OFFSET(copy_initial_nonkeyframes)}, "copy initial non-keyframes" },
- { "frames", OPT_INT64 | HAS_ARG | OPT_SPEC, {.off = OFFSET(max_frames)}, "set the number of frames to record", "number" },
- { "tag", OPT_STRING | HAS_ARG | OPT_SPEC, {.off = OFFSET(codec_tags)}, "force codec tag/fourcc", "fourcc/tag" },
- { "q", HAS_ARG | OPT_EXPERT | OPT_DOUBLE | OPT_SPEC, {.off = OFFSET(qscale)}, "use fixed quality scale (VBR)", "q" },
- { "qscale", HAS_ARG | OPT_EXPERT | OPT_DOUBLE | OPT_SPEC, {.off = OFFSET(qscale)}, "use fixed quality scale (VBR)", "q" },
-#if CONFIG_AVFILTER
- { "filter", HAS_ARG | OPT_STRING | OPT_SPEC, {.off = OFFSET(filters)}, "set stream filterchain", "filter_list" },
-#endif
- { "stats", OPT_BOOL, {&print_stats}, "print progress report during encoding", },
- { "attach", HAS_ARG | OPT_FUNC2, {(void*)opt_attach}, "add an attachment to the output file", "filename" },
- { "dump_attachment", HAS_ARG | OPT_STRING | OPT_SPEC, {.off = OFFSET(dump_attachment)}, "extract an attachment into a file", "filename" },
-
- /* video options */
- { "vframes", HAS_ARG | OPT_VIDEO | OPT_FUNC2, {(void*)opt_video_frames}, "set the number of video frames to record", "number" },
- { "r", HAS_ARG | OPT_VIDEO | OPT_STRING | OPT_SPEC, {.off = OFFSET(frame_rates)}, "set frame rate (Hz value, fraction or abbreviation)", "rate" },
- { "s", HAS_ARG | OPT_VIDEO | OPT_STRING | OPT_SPEC, {.off = OFFSET(frame_sizes)}, "set frame size (WxH or abbreviation)", "size" },
- { "aspect", HAS_ARG | OPT_VIDEO | OPT_STRING | OPT_SPEC, {.off = OFFSET(frame_aspect_ratios)}, "set aspect ratio (4:3, 16:9 or 1.3333, 1.7777)", "aspect" },
- { "pix_fmt", HAS_ARG | OPT_EXPERT | OPT_VIDEO | OPT_STRING | OPT_SPEC, {.off = OFFSET(frame_pix_fmts)}, "set pixel format", "format" },
- { "vn", OPT_BOOL | OPT_VIDEO | OPT_OFFSET, {.off = OFFSET(video_disable)}, "disable video" },
- { "vdt", OPT_INT | HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)&video_discard}, "discard threshold", "n" },
- { "rc_override", HAS_ARG | OPT_EXPERT | OPT_VIDEO | OPT_STRING | OPT_SPEC, {.off = OFFSET(rc_overrides)}, "rate control override for specific intervals", "override" },
- { "vcodec", HAS_ARG | OPT_VIDEO | OPT_FUNC2, {(void*)opt_video_codec}, "force video codec ('copy' to copy stream)", "codec" },
- { "same_quant", OPT_BOOL | OPT_VIDEO, {(void*)&same_quant},
- "use same quantizer as source (implies VBR)" },
- { "pass", HAS_ARG | OPT_VIDEO, {(void*)opt_pass}, "select the pass number (1 or 2)", "n" },
- { "passlogfile", HAS_ARG | OPT_STRING | OPT_VIDEO, {(void*)&pass_logfilename_prefix}, "select two pass log file name prefix", "prefix" },
- { "deinterlace", OPT_BOOL | OPT_EXPERT | OPT_VIDEO, {(void*)&do_deinterlace},
- "deinterlace pictures" },
- { "vstats", OPT_EXPERT | OPT_VIDEO, {(void*)&opt_vstats}, "dump video coding statistics to file" },
- { "vstats_file", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_vstats_file}, "dump video coding statistics to file", "file" },
-#if CONFIG_AVFILTER
- { "vf", HAS_ARG | OPT_VIDEO | OPT_FUNC2, {(void*)opt_video_filters}, "video filters", "filter list" },
-#endif
- { "intra_matrix", HAS_ARG | OPT_EXPERT | OPT_VIDEO | OPT_STRING | OPT_SPEC, {.off = OFFSET(intra_matrices)}, "specify intra matrix coeffs", "matrix" },
- { "inter_matrix", HAS_ARG | OPT_EXPERT | OPT_VIDEO | OPT_STRING | OPT_SPEC, {.off = OFFSET(inter_matrices)}, "specify inter matrix coeffs", "matrix" },
- { "top", HAS_ARG | OPT_EXPERT | OPT_VIDEO | OPT_INT| OPT_SPEC, {.off = OFFSET(top_field_first)}, "top=1/bottom=0/auto=-1 field first", "" },
- { "dc", OPT_INT | HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)&intra_dc_precision}, "intra_dc_precision", "precision" },
- { "vtag", HAS_ARG | OPT_EXPERT | OPT_VIDEO | OPT_FUNC2, {(void*)opt_video_tag}, "force video tag/fourcc", "fourcc/tag" },
- { "qphist", OPT_BOOL | OPT_EXPERT | OPT_VIDEO, { (void *)&qp_hist }, "show QP histogram" },
- { "force_fps", OPT_BOOL | OPT_EXPERT | OPT_VIDEO | OPT_SPEC, {.off = OFFSET(force_fps)}, "force the selected framerate, disable the best supported framerate selection" },
- { "streamid", HAS_ARG | OPT_EXPERT | OPT_FUNC2, {(void*)opt_streamid}, "set the value of an outfile streamid", "streamIndex:value" },
- { "force_key_frames", OPT_STRING | HAS_ARG | OPT_EXPERT | OPT_VIDEO | OPT_SPEC, {.off = OFFSET(forced_key_frames)}, "force key frames at specified timestamps", "timestamps" },
-
- /* audio options */
- { "aframes", HAS_ARG | OPT_AUDIO | OPT_FUNC2, {(void*)opt_audio_frames}, "set the number of audio frames to record", "number" },
- { "aq", HAS_ARG | OPT_AUDIO | OPT_FUNC2, {(void*)opt_audio_qscale}, "set audio quality (codec-specific)", "quality", },
- { "ar", HAS_ARG | OPT_AUDIO | OPT_INT | OPT_SPEC, {.off = OFFSET(audio_sample_rate)}, "set audio sampling rate (in Hz)", "rate" },
- { "ac", HAS_ARG | OPT_AUDIO | OPT_INT | OPT_SPEC, {.off = OFFSET(audio_channels)}, "set number of audio channels", "channels" },
- { "an", OPT_BOOL | OPT_AUDIO | OPT_OFFSET, {.off = OFFSET(audio_disable)}, "disable audio" },
- { "acodec", HAS_ARG | OPT_AUDIO | OPT_FUNC2, {(void*)opt_audio_codec}, "force audio codec ('copy' to copy stream)", "codec" },
- { "atag", HAS_ARG | OPT_EXPERT | OPT_AUDIO | OPT_FUNC2, {(void*)opt_audio_tag}, "force audio tag/fourcc", "fourcc/tag" },
- { "vol", OPT_INT | HAS_ARG | OPT_AUDIO, {(void*)&audio_volume}, "change audio volume (256=normal)" , "volume" }, //
- { "sample_fmt", HAS_ARG | OPT_EXPERT | OPT_AUDIO | OPT_SPEC | OPT_STRING, {.off = OFFSET(sample_fmts)}, "set sample format", "format" },
-
- /* subtitle options */
- { "sn", OPT_BOOL | OPT_SUBTITLE | OPT_OFFSET, {.off = OFFSET(subtitle_disable)}, "disable subtitle" },
- { "scodec", HAS_ARG | OPT_SUBTITLE | OPT_FUNC2, {(void*)opt_subtitle_codec}, "force subtitle codec ('copy' to copy stream)", "codec" },
- { "stag", HAS_ARG | OPT_EXPERT | OPT_SUBTITLE | OPT_FUNC2, {(void*)opt_subtitle_tag}, "force subtitle tag/fourcc", "fourcc/tag" },
-
- /* grab options */
- { "isync", OPT_BOOL | OPT_EXPERT | OPT_GRAB, {(void*)&input_sync}, "sync read on input", "" },
-
- /* muxer options */
- { "muxdelay", OPT_FLOAT | HAS_ARG | OPT_EXPERT | OPT_OFFSET, {.off = OFFSET(mux_max_delay)}, "set the maximum demux-decode delay", "seconds" },
- { "muxpreload", OPT_FLOAT | HAS_ARG | OPT_EXPERT | OPT_OFFSET, {.off = OFFSET(mux_preload)}, "set the initial demux-decode delay", "seconds" },
-
- { "bsf", HAS_ARG | OPT_STRING | OPT_SPEC, {.off = OFFSET(bitstream_filters)}, "A comma-separated list of bitstream filters", "bitstream_filters" },
-
- /* data codec support */
- { "dcodec", HAS_ARG | OPT_DATA | OPT_FUNC2, {(void*)opt_data_codec}, "force data codec ('copy' to copy stream)", "codec" },
-
- { "default", HAS_ARG | OPT_AUDIO | OPT_VIDEO | OPT_EXPERT, {(void*)opt_default}, "generic catch all option", "" },
- { NULL, },
-};
-
int main(int argc, char **argv)
{
- OptionsContext o = { 0 };
+ int ret;
int64_t ti;
- reset_options(&o);
+ atexit(exit_program);
av_log_set_flags(AV_LOG_SKIP_REPEATED);
parse_loglevel(argc, argv, options);
@@ -4520,43 +2359,38 @@ int main(int argc, char **argv)
#if CONFIG_AVDEVICE
avdevice_register_all();
#endif
-#if CONFIG_AVFILTER
avfilter_register_all();
-#endif
av_register_all();
avformat_network_init();
show_banner();
- /* parse options */
- parse_options(&o, argc, argv, options, opt_output_file);
+ /* parse options and open all input/output files */
+ ret = avconv_parse_options(argc, argv);
+ if (ret < 0)
+ exit(1);
if (nb_output_files <= 0 && nb_input_files == 0) {
show_usage();
av_log(NULL, AV_LOG_WARNING, "Use -h to get full help or, even better, run 'man %s'\n", program_name);
- exit_program(1);
+ exit(1);
}
/* file converter / grab */
if (nb_output_files <= 0) {
fprintf(stderr, "At least one output file must be specified\n");
- exit_program(1);
- }
-
- if (nb_input_files == 0) {
- av_log(NULL, AV_LOG_FATAL, "At least one input file must be specified\n");
- exit_program(1);
+ exit(1);
}
ti = getutime();
- if (transcode(output_files, nb_output_files, input_files, nb_input_files) < 0)
- exit_program(1);
+ if (transcode() < 0)
+ exit(1);
ti = getutime() - ti;
if (do_benchmark) {
int maxrss = getmaxrss() / 1024;
printf("bench: utime=%0.3fs maxrss=%ikB\n", ti / 1000000.0, maxrss);
}
- exit_program(0);
+ exit(0);
return 0;
}
diff --git a/gst-libs/ext/libav/avconv.h b/gst-libs/ext/libav/avconv.h
new file mode 100644
index 0000000..defdf59
--- /dev/null
+++ b/gst-libs/ext/libav/avconv.h
@@ -0,0 +1,368 @@
+/*
+ * 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
+ */
+
+#ifndef AVCONV_H
+#define AVCONV_H
+
+#include "config.h"
+
+#include <stdint.h>
+#include <stdio.h>
+
+#if HAVE_PTHREADS
+#include <pthread.h>
+#endif
+
+#include "cmdutils.h"
+
+#include "libavformat/avformat.h"
+#include "libavformat/avio.h"
+
+#include "libavcodec/avcodec.h"
+
+#include "libavfilter/avfilter.h"
+#include "libavfilter/avfiltergraph.h"
+
+#include "libavutil/avutil.h"
+#include "libavutil/dict.h"
+#include "libavutil/fifo.h"
+#include "libavutil/pixfmt.h"
+#include "libavutil/rational.h"
+
+#define VSYNC_AUTO -1
+#define VSYNC_PASSTHROUGH 0
+#define VSYNC_CFR 1
+#define VSYNC_VFR 2
+
+/* select an input stream for an output stream */
+typedef struct StreamMap {
+ int disabled; /* 1 is this mapping is disabled by a negative map */
+ int file_index;
+ int stream_index;
+ int sync_file_index;
+ int sync_stream_index;
+ char *linklabel; /* name of an output link, for mapping lavfi outputs */
+} StreamMap;
+
+/* select an input file for an output file */
+typedef struct MetadataMap {
+ int file; // file index
+ char type; // type of metadata to copy -- (g)lobal, (s)tream, (c)hapter or (p)rogram
+ int index; // stream/chapter/program number
+} MetadataMap;
+
+typedef struct OptionsContext {
+ OptionGroup *g;
+
+ /* input/output options */
+ int64_t start_time;
+ const char *format;
+
+ SpecifierOpt *codec_names;
+ int nb_codec_names;
+ SpecifierOpt *audio_channels;
+ int nb_audio_channels;
+ SpecifierOpt *audio_sample_rate;
+ int nb_audio_sample_rate;
+ SpecifierOpt *frame_rates;
+ int nb_frame_rates;
+ SpecifierOpt *frame_sizes;
+ int nb_frame_sizes;
+ SpecifierOpt *frame_pix_fmts;
+ int nb_frame_pix_fmts;
+
+ /* input options */
+ int64_t input_ts_offset;
+ int rate_emu;
+
+ SpecifierOpt *ts_scale;
+ int nb_ts_scale;
+ SpecifierOpt *dump_attachment;
+ int nb_dump_attachment;
+
+ /* output options */
+ StreamMap *stream_maps;
+ int nb_stream_maps;
+ /* first item specifies output metadata, second is input */
+ MetadataMap (*meta_data_maps)[2];
+ int nb_meta_data_maps;
+ int metadata_global_manual;
+ int metadata_streams_manual;
+ int metadata_chapters_manual;
+ const char **attachments;
+ int nb_attachments;
+
+ int chapters_input_file;
+
+ int64_t recording_time;
+ uint64_t limit_filesize;
+ float mux_preload;
+ float mux_max_delay;
+ int shortest;
+
+ int video_disable;
+ int audio_disable;
+ int subtitle_disable;
+ int data_disable;
+
+ /* indexed by output file stream index */
+ int *streamid_map;
+ int nb_streamid_map;
+
+ SpecifierOpt *metadata;
+ int nb_metadata;
+ SpecifierOpt *max_frames;
+ int nb_max_frames;
+ SpecifierOpt *bitstream_filters;
+ int nb_bitstream_filters;
+ SpecifierOpt *codec_tags;
+ int nb_codec_tags;
+ SpecifierOpt *sample_fmts;
+ int nb_sample_fmts;
+ SpecifierOpt *qscale;
+ int nb_qscale;
+ SpecifierOpt *forced_key_frames;
+ int nb_forced_key_frames;
+ SpecifierOpt *force_fps;
+ int nb_force_fps;
+ SpecifierOpt *frame_aspect_ratios;
+ int nb_frame_aspect_ratios;
+ SpecifierOpt *rc_overrides;
+ int nb_rc_overrides;
+ SpecifierOpt *intra_matrices;
+ int nb_intra_matrices;
+ SpecifierOpt *inter_matrices;
+ int nb_inter_matrices;
+ SpecifierOpt *top_field_first;
+ int nb_top_field_first;
+ SpecifierOpt *metadata_map;
+ int nb_metadata_map;
+ SpecifierOpt *presets;
+ int nb_presets;
+ SpecifierOpt *copy_initial_nonkeyframes;
+ int nb_copy_initial_nonkeyframes;
+ SpecifierOpt *filters;
+ int nb_filters;
+ SpecifierOpt *pass;
+ int nb_pass;
+ SpecifierOpt *passlogfiles;
+ int nb_passlogfiles;
+} OptionsContext;
+
+typedef struct InputFilter {
+ AVFilterContext *filter;
+ struct InputStream *ist;
+ struct FilterGraph *graph;
+ uint8_t *name;
+} InputFilter;
+
+typedef struct OutputFilter {
+ AVFilterContext *filter;
+ struct OutputStream *ost;
+ struct FilterGraph *graph;
+ uint8_t *name;
+
+ /* temporary storage until stream maps are processed */
+ AVFilterInOut *out_tmp;
+} OutputFilter;
+
+typedef struct FilterGraph {
+ int index;
+ const char *graph_desc;
+
+ AVFilterGraph *graph;
+
+ InputFilter **inputs;
+ int nb_inputs;
+ OutputFilter **outputs;
+ int nb_outputs;
+} FilterGraph;
+
+typedef struct InputStream {
+ int file_index;
+ AVStream *st;
+ int discard; /* true if stream data should be discarded */
+ int decoding_needed; /* true if the packets must be decoded in 'raw_fifo' */
+ AVCodec *dec;
+ AVFrame *decoded_frame;
+
+ int64_t start; /* time when read started */
+ /* predicted dts of the next packet read for this stream or (when there are
+ * several frames in a packet) of the next frame in current packet */
+ int64_t next_dts;
+ /* dts of the last packet read for this stream */
+ int64_t last_dts;
+ PtsCorrectionContext pts_ctx;
+ double ts_scale;
+ int is_start; /* is 1 at the start and after a discontinuity */
+ int showed_multi_packet_warning;
+ AVDictionary *opts;
+ AVRational framerate; /* framerate forced with -r */
+
+ int resample_height;
+ int resample_width;
+ int resample_pix_fmt;
+
+ int resample_sample_fmt;
+ int resample_sample_rate;
+ int resample_channels;
+ uint64_t resample_channel_layout;
+
+ /* a pool of free buffers for decoded data */
+ FrameBuffer *buffer_pool;
+
+ /* decoded data from this stream goes into all those filters
+ * currently video and audio only */
+ InputFilter **filters;
+ int nb_filters;
+} InputStream;
+
+typedef struct InputFile {
+ AVFormatContext *ctx;
+ int eof_reached; /* true if eof reached */
+ int eagain; /* true if last read attempt returned EAGAIN */
+ int ist_index; /* index of first stream in ist_table */
+ int64_t ts_offset;
+ int nb_streams; /* number of stream that avconv is aware of; may be different
+ from ctx.nb_streams if new streams appear during av_read_frame() */
+ int rate_emu;
+
+#if HAVE_PTHREADS
+ pthread_t thread; /* thread reading from this file */
+ int finished; /* the thread has exited */
+ int joined; /* the thread has been joined */
+ pthread_mutex_t fifo_lock; /* lock for access to fifo */
+ pthread_cond_t fifo_cond; /* the main thread will signal on this cond after reading from fifo */
+ AVFifoBuffer *fifo; /* demuxed packets are stored here; freed by the main thread */
+#endif
+} InputFile;
+
+typedef struct OutputStream {
+ int file_index; /* file index */
+ int index; /* stream index in the output file */
+ int source_index; /* InputStream index */
+ AVStream *st; /* stream in the output file */
+ int encoding_needed; /* true if encoding needed for this stream */
+ int frame_number;
+ /* input pts and corresponding output pts
+ for A/V sync */
+ // double sync_ipts; /* dts from the AVPacket of the demuxer in second units */
+ struct InputStream *sync_ist; /* input stream to sync against */
+ int64_t sync_opts; /* output frame counter, could be changed to some true timestamp */ // FIXME look at frame_number
+ /* pts of the first frame encoded for this stream, used for limiting
+ * recording time */
+ int64_t first_pts;
+ AVBitStreamFilterContext *bitstream_filters;
+ AVCodec *enc;
+ int64_t max_frames;
+ AVFrame *filtered_frame;
+
+ /* video only */
+ AVRational frame_rate;
+ int force_fps;
+ int top_field_first;
+
+ float frame_aspect_ratio;
+
+ /* forced key frames */
+ int64_t *forced_kf_pts;
+ int forced_kf_count;
+ int forced_kf_index;
+ char *forced_keyframes;
+
+ char *logfile_prefix;
+ FILE *logfile;
+
+ OutputFilter *filter;
+ char *avfilter;
+
+ int64_t sws_flags;
+ AVDictionary *opts;
+ int finished; /* no more packets should be written for this stream */
+ int stream_copy;
+ const char *attachment_filename;
+ int copy_initial_nonkeyframes;
+
+ enum AVPixelFormat pix_fmts[2];
+} OutputStream;
+
+typedef struct OutputFile {
+ AVFormatContext *ctx;
+ AVDictionary *opts;
+ int ost_index; /* index of the first stream in output_streams */
+ int64_t recording_time; /* desired length of the resulting file in microseconds */
+ int64_t start_time; /* start time in microseconds */
+ uint64_t limit_filesize;
+
+ int shortest;
+} OutputFile;
+
+extern InputStream **input_streams;
+extern int nb_input_streams;
+extern InputFile **input_files;
+extern int nb_input_files;
+
+extern OutputStream **output_streams;
+extern int nb_output_streams;
+extern OutputFile **output_files;
+extern int nb_output_files;
+
+extern FilterGraph **filtergraphs;
+extern int nb_filtergraphs;
+
+extern char *vstats_filename;
+
+extern float audio_drift_threshold;
+extern float dts_delta_threshold;
+
+extern int audio_volume;
+extern int audio_sync_method;
+extern int video_sync_method;
+extern int do_benchmark;
+extern int do_deinterlace;
+extern int do_hex_dump;
+extern int do_pkt_dump;
+extern int copy_ts;
+extern int copy_tb;
+extern int exit_on_error;
+extern int print_stats;
+extern int qp_hist;
+
+extern const AVIOInterruptCB int_cb;
+
+extern const OptionDef options[];
+
+void reset_options(OptionsContext *o);
+void show_usage(void);
+
+int opt_cpuflags(void *optctx, const char *opt, const char *arg);
+
+void opt_output_file(void *optctx, const char *filename);
+
+void assert_avoptions(AVDictionary *m);
+
+int guess_input_channel_layout(InputStream *ist);
+
+int configure_filtergraph(FilterGraph *fg);
+int configure_output_filter(FilterGraph *fg, OutputFilter *ofilter, AVFilterInOut *out);
+int ist_in_filtergraph(FilterGraph *fg, InputStream *ist);
+FilterGraph *init_simple_filtergraph(InputStream *ist, OutputStream *ost);
+
+int avconv_parse_options(int argc, char **argv);
+
+#endif /* AVCONV_H */
diff --git a/gst-libs/ext/libav/avconv_filter.c b/gst-libs/ext/libav/avconv_filter.c
new file mode 100644
index 0000000..50e1e73
--- /dev/null
+++ b/gst-libs/ext/libav/avconv_filter.c
@@ -0,0 +1,559 @@
+/*
+ * avconv filter configuration
+ *
+ * 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
+ */
+
+#include "avconv.h"
+
+#include "libavfilter/avfilter.h"
+#include "libavfilter/avfiltergraph.h"
+
+#include "libavutil/avassert.h"
+#include "libavutil/channel_layout.h"
+#include "libavutil/pixdesc.h"
+#include "libavutil/pixfmt.h"
+#include "libavutil/samplefmt.h"
+
+/* Define a function for building a string containing a list of
+ * allowed formats. */
+#define DEF_CHOOSE_FORMAT(type, var, supported_list, none, get_name, separator)\
+static char *choose_ ## var ## s(OutputStream *ost) \
+{ \
+ if (ost->st->codec->var != none) { \
+ get_name(ost->st->codec->var); \
+ return av_strdup(name); \
+ } else if (ost->enc->supported_list) { \
+ const type *p; \
+ AVIOContext *s = NULL; \
+ uint8_t *ret; \
+ int len; \
+ \
+ if (avio_open_dyn_buf(&s) < 0) \
+ exit(1); \
+ \
+ for (p = ost->enc->supported_list; *p != none; p++) { \
+ get_name(*p); \
+ avio_printf(s, "%s" separator, name); \
+ } \
+ len = avio_close_dyn_buf(s, &ret); \
+ ret[len - 1] = 0; \
+ return ret; \
+ } else \
+ return NULL; \
+}
+
+DEF_CHOOSE_FORMAT(enum AVPixelFormat, pix_fmt, pix_fmts, AV_PIX_FMT_NONE,
+ GET_PIX_FMT_NAME, ":")
+
+DEF_CHOOSE_FORMAT(enum AVSampleFormat, sample_fmt, sample_fmts,
+ AV_SAMPLE_FMT_NONE, GET_SAMPLE_FMT_NAME, ",")
+
+DEF_CHOOSE_FORMAT(int, sample_rate, supported_samplerates, 0,
+ GET_SAMPLE_RATE_NAME, ",")
+
+DEF_CHOOSE_FORMAT(uint64_t, channel_layout, channel_layouts, 0,
+ GET_CH_LAYOUT_NAME, ",")
+
+FilterGraph *init_simple_filtergraph(InputStream *ist, OutputStream *ost)
+{
+ FilterGraph *fg = av_mallocz(sizeof(*fg));
+
+ if (!fg)
+ exit(1);
+ fg->index = nb_filtergraphs;
+
+ GROW_ARRAY(fg->outputs, fg->nb_outputs);
+ if (!(fg->outputs[0] = av_mallocz(sizeof(*fg->outputs[0]))))
+ exit(1);
+ fg->outputs[0]->ost = ost;
+ fg->outputs[0]->graph = fg;
+
+ ost->filter = fg->outputs[0];
+
+ GROW_ARRAY(fg->inputs, fg->nb_inputs);
+ if (!(fg->inputs[0] = av_mallocz(sizeof(*fg->inputs[0]))))
+ exit(1);
+ fg->inputs[0]->ist = ist;
+ fg->inputs[0]->graph = fg;
+
+ GROW_ARRAY(ist->filters, ist->nb_filters);
+ ist->filters[ist->nb_filters - 1] = fg->inputs[0];
+
+ GROW_ARRAY(filtergraphs, nb_filtergraphs);
+ filtergraphs[nb_filtergraphs - 1] = fg;
+
+ return fg;
+}
+
+static void init_input_filter(FilterGraph *fg, AVFilterInOut *in)
+{
+ InputStream *ist = NULL;
+ enum AVMediaType type = avfilter_pad_get_type(in->filter_ctx->input_pads, in->pad_idx);
+ int i;
+
+ // TODO: support other filter types
+ if (type != AVMEDIA_TYPE_VIDEO && type != AVMEDIA_TYPE_AUDIO) {
+ av_log(NULL, AV_LOG_FATAL, "Only video and audio filters supported "
+ "currently.\n");
+ exit(1);
+ }
+
+ if (in->name) {
+ AVFormatContext *s;
+ AVStream *st = NULL;
+ char *p;
+ int file_idx = strtol(in->name, &p, 0);
+
+ if (file_idx < 0 || file_idx >= nb_input_files) {
+ av_log(NULL, AV_LOG_FATAL, "Invalid file index %d in filtegraph description %s.\n",
+ file_idx, fg->graph_desc);
+ exit(1);
+ }
+ s = input_files[file_idx]->ctx;
+
+ for (i = 0; i < s->nb_streams; i++) {
+ if (s->streams[i]->codec->codec_type != type)
+ continue;
+ if (check_stream_specifier(s, s->streams[i], *p == ':' ? p + 1 : p) == 1) {
+ st = s->streams[i];
+ break;
+ }
+ }
+ if (!st) {
+ av_log(NULL, AV_LOG_FATAL, "Stream specifier '%s' in filtergraph description %s "
+ "matches no streams.\n", p, fg->graph_desc);
+ exit(1);
+ }
+ ist = input_streams[input_files[file_idx]->ist_index + st->index];
+ } else {
+ /* find the first unused stream of corresponding type */
+ for (i = 0; i < nb_input_streams; i++) {
+ ist = input_streams[i];
+ if (ist->st->codec->codec_type == type && ist->discard)
+ break;
+ }
+ if (i == nb_input_streams) {
+ av_log(NULL, AV_LOG_FATAL, "Cannot find a matching stream for "
+ "unlabeled input pad %d on filter %s", in->pad_idx,
+ in->filter_ctx->name);
+ exit(1);
+ }
+ }
+ av_assert0(ist);
+
+ ist->discard = 0;
+ ist->decoding_needed = 1;
+ ist->st->discard = AVDISCARD_NONE;
+
+ GROW_ARRAY(fg->inputs, fg->nb_inputs);
+ if (!(fg->inputs[fg->nb_inputs - 1] = av_mallocz(sizeof(*fg->inputs[0]))))
+ exit(1);
+ fg->inputs[fg->nb_inputs - 1]->ist = ist;
+ fg->inputs[fg->nb_inputs - 1]->graph = fg;
+
+ GROW_ARRAY(ist->filters, ist->nb_filters);
+ ist->filters[ist->nb_filters - 1] = fg->inputs[fg->nb_inputs - 1];
+}
+
+static int configure_output_video_filter(FilterGraph *fg, OutputFilter *ofilter, AVFilterInOut *out)
+{
+ char *pix_fmts;
+ OutputStream *ost = ofilter->ost;
+ AVCodecContext *codec = ost->st->codec;
+ AVFilterContext *last_filter = out->filter_ctx;
+ int pad_idx = out->pad_idx;
+ int ret;
+ char name[255];
+
+ snprintf(name, sizeof(name), "output stream %d:%d", ost->file_index, ost->index);
+ ret = avfilter_graph_create_filter(&ofilter->filter,
+ avfilter_get_by_name("buffersink"),
+ name, NULL, NULL, fg->graph);
+ if (ret < 0)
+ return ret;
+
+ if (codec->width || codec->height) {
+ char args[255];
+ AVFilterContext *filter;
+
+ snprintf(args, sizeof(args), "%d:%d:flags=0x%X",
+ codec->width,
+ codec->height,
+ (unsigned)ost->sws_flags);
+ snprintf(name, sizeof(name), "scaler for output stream %d:%d",
+ ost->file_index, ost->index);
+ if ((ret = avfilter_graph_create_filter(&filter, avfilter_get_by_name("scale"),
+ name, args, NULL, fg->graph)) < 0)
+ return ret;
+ if ((ret = avfilter_link(last_filter, pad_idx, filter, 0)) < 0)
+ return ret;
+
+ last_filter = filter;
+ pad_idx = 0;
+ }
+
+ if ((pix_fmts = choose_pix_fmts(ost))) {
+ AVFilterContext *filter;
+ snprintf(name, sizeof(name), "pixel format for output stream %d:%d",
+ ost->file_index, ost->index);
+ if ((ret = avfilter_graph_create_filter(&filter,
+ avfilter_get_by_name("format"),
+ "format", pix_fmts, NULL,
+ fg->graph)) < 0)
+ return ret;
+ if ((ret = avfilter_link(last_filter, pad_idx, filter, 0)) < 0)
+ return ret;
+
+ last_filter = filter;
+ pad_idx = 0;
+ av_freep(&pix_fmts);
+ }
+
+ if (ost->frame_rate.num) {
+ AVFilterContext *fps;
+ char args[255];
+
+ snprintf(args, sizeof(args), "fps=%d/%d", ost->frame_rate.num,
+ ost->frame_rate.den);
+ snprintf(name, sizeof(name), "fps for output stream %d:%d",
+ ost->file_index, ost->index);
+ ret = avfilter_graph_create_filter(&fps, avfilter_get_by_name("fps"),
+ name, args, NULL, fg->graph);
+ if (ret < 0)
+ return ret;
+
+ ret = avfilter_link(last_filter, pad_idx, fps, 0);
+ if (ret < 0)
+ return ret;
+ last_filter = fps;
+ pad_idx = 0;
+ }
+
+ if ((ret = avfilter_link(last_filter, pad_idx, ofilter->filter, 0)) < 0)
+ return ret;
+
+ return 0;
+}
+
+static int configure_output_audio_filter(FilterGraph *fg, OutputFilter *ofilter, AVFilterInOut *out)
+{
+ OutputStream *ost = ofilter->ost;
+ AVCodecContext *codec = ost->st->codec;
+ AVFilterContext *last_filter = out->filter_ctx;
+ int pad_idx = out->pad_idx;
+ char *sample_fmts, *sample_rates, *channel_layouts;
+ char name[255];
+ int ret;
+
+
+ snprintf(name, sizeof(name), "output stream %d:%d", ost->file_index, ost->index);
+ ret = avfilter_graph_create_filter(&ofilter->filter,
+ avfilter_get_by_name("abuffersink"),
+ name, NULL, NULL, fg->graph);
+ if (ret < 0)
+ return ret;
+
+ if (codec->channels && !codec->channel_layout)
+ codec->channel_layout = av_get_default_channel_layout(codec->channels);
+
+ sample_fmts = choose_sample_fmts(ost);
+ sample_rates = choose_sample_rates(ost);
+ channel_layouts = choose_channel_layouts(ost);
+ if (sample_fmts || sample_rates || channel_layouts) {
+ AVFilterContext *format;
+ char args[256];
+ int len = 0;
+
+ if (sample_fmts)
+ len += snprintf(args + len, sizeof(args) - len, "sample_fmts=%s:",
+ sample_fmts);
+ if (sample_rates)
+ len += snprintf(args + len, sizeof(args) - len, "sample_rates=%s:",
+ sample_rates);
+ if (channel_layouts)
+ len += snprintf(args + len, sizeof(args) - len, "channel_layouts=%s:",
+ channel_layouts);
+ args[len - 1] = 0;
+
+ av_freep(&sample_fmts);
+ av_freep(&sample_rates);
+ av_freep(&channel_layouts);
+
+ snprintf(name, sizeof(name), "audio format for output stream %d:%d",
+ ost->file_index, ost->index);
+ ret = avfilter_graph_create_filter(&format,
+ avfilter_get_by_name("aformat"),
+ name, args, NULL, fg->graph);
+ if (ret < 0)
+ return ret;
+
+ ret = avfilter_link(last_filter, pad_idx, format, 0);
+ if (ret < 0)
+ return ret;
+
+ last_filter = format;
+ pad_idx = 0;
+ }
+
+ if ((ret = avfilter_link(last_filter, pad_idx, ofilter->filter, 0)) < 0)
+ return ret;
+
+ return 0;
+}
+
+#define DESCRIBE_FILTER_LINK(f, inout, in) \
+{ \
+ AVFilterContext *ctx = inout->filter_ctx; \
+ AVFilterPad *pads = in ? ctx->input_pads : ctx->output_pads; \
+ int nb_pads = in ? ctx->input_count : ctx->output_count; \
+ AVIOContext *pb; \
+ \
+ if (avio_open_dyn_buf(&pb) < 0) \
+ exit(1); \
+ \
+ avio_printf(pb, "%s", ctx->filter->name); \
+ if (nb_pads > 1) \
+ avio_printf(pb, ":%s", avfilter_pad_get_name(pads, inout->pad_idx));\
+ avio_w8(pb, 0); \
+ avio_close_dyn_buf(pb, &f->name); \
+}
+
+int configure_output_filter(FilterGraph *fg, OutputFilter *ofilter, AVFilterInOut *out)
+{
+ av_freep(&ofilter->name);
+ DESCRIBE_FILTER_LINK(ofilter, out, 0);
+
+ switch (avfilter_pad_get_type(out->filter_ctx->output_pads, out->pad_idx)) {
+ case AVMEDIA_TYPE_VIDEO: return configure_output_video_filter(fg, ofilter, out);
+ case AVMEDIA_TYPE_AUDIO: return configure_output_audio_filter(fg, ofilter, out);
+ default: av_assert0(0);
+ }
+}
+
+static int configure_input_video_filter(FilterGraph *fg, InputFilter *ifilter,
+ AVFilterInOut *in)
+{
+ AVFilterContext *first_filter = in->filter_ctx;
+ AVFilter *filter = avfilter_get_by_name("buffer");
+ InputStream *ist = ifilter->ist;
+ AVRational tb = ist->framerate.num ? av_inv_q(ist->framerate) :
+ ist->st->time_base;
+ AVRational sar;
+ char args[255], name[255];
+ int pad_idx = in->pad_idx;
+ int ret;
+
+ sar = ist->st->sample_aspect_ratio.num ?
+ ist->st->sample_aspect_ratio :
+ ist->st->codec->sample_aspect_ratio;
+ snprintf(args, sizeof(args), "%d:%d:%d:%d:%d:%d:%d", ist->st->codec->width,
+ ist->st->codec->height, ist->st->codec->pix_fmt,
+ tb.num, tb.den, sar.num, sar.den);
+ snprintf(name, sizeof(name), "graph %d input from stream %d:%d", fg->index,
+ ist->file_index, ist->st->index);
+
+ if ((ret = avfilter_graph_create_filter(&ifilter->filter, filter, name,
+ args, NULL, fg->graph)) < 0)
+ return ret;
+
+ if (ist->framerate.num) {
+ AVFilterContext *setpts;
+
+ snprintf(name, sizeof(name), "force CFR for input from stream %d:%d",
+ ist->file_index, ist->st->index);
+ if ((ret = avfilter_graph_create_filter(&setpts,
+ avfilter_get_by_name("setpts"),
+ name, "N", NULL,
+ fg->graph)) < 0)
+ return ret;
+
+ if ((ret = avfilter_link(setpts, 0, first_filter, pad_idx)) < 0)
+ return ret;
+
+ first_filter = setpts;
+ pad_idx = 0;
+ }
+
+ if ((ret = avfilter_link(ifilter->filter, 0, first_filter, pad_idx)) < 0)
+ return ret;
+ return 0;
+}
+
+static int configure_input_audio_filter(FilterGraph *fg, InputFilter *ifilter,
+ AVFilterInOut *in)
+{
+ AVFilterContext *first_filter = in->filter_ctx;
+ AVFilter *filter = avfilter_get_by_name("abuffer");
+ InputStream *ist = ifilter->ist;
+ int pad_idx = in->pad_idx;
+ char args[255], name[255];
+ int ret;
+
+ snprintf(args, sizeof(args), "time_base=%d/%d:sample_rate=%d:sample_fmt=%s"
+ ":channel_layout=0x%"PRIx64,
+ 1, ist->st->codec->sample_rate,
+ ist->st->codec->sample_rate,
+ av_get_sample_fmt_name(ist->st->codec->sample_fmt),
+ ist->st->codec->channel_layout);
+ snprintf(name, sizeof(name), "graph %d input from stream %d:%d", fg->index,
+ ist->file_index, ist->st->index);
+
+ if ((ret = avfilter_graph_create_filter(&ifilter->filter, filter,
+ name, args, NULL,
+ fg->graph)) < 0)
+ return ret;
+
+ if (audio_sync_method > 0) {
+ AVFilterContext *async;
+ int len = 0;
+
+ av_log(NULL, AV_LOG_WARNING, "-async has been deprecated. Used the "
+ "asyncts audio filter instead.\n");
+
+ if (audio_sync_method > 1)
+ len += snprintf(args + len, sizeof(args) - len, "compensate=1:"
+ "max_comp=%d:", audio_sync_method);
+ snprintf(args + len, sizeof(args) - len, "min_delta=%f",
+ audio_drift_threshold);
+
+ snprintf(name, sizeof(name), "graph %d audio sync for input stream %d:%d",
+ fg->index, ist->file_index, ist->st->index);
+ ret = avfilter_graph_create_filter(&async,
+ avfilter_get_by_name("asyncts"),
+ name, args, NULL, fg->graph);
+ if (ret < 0)
+ return ret;
+
+ ret = avfilter_link(async, 0, first_filter, pad_idx);
+ if (ret < 0)
+ return ret;
+
+ first_filter = async;
+ pad_idx = 0;
+ }
+ if (audio_volume != 256) {
+ AVFilterContext *volume;
+
+ av_log(NULL, AV_LOG_WARNING, "-vol has been deprecated. Use the volume "
+ "audio filter instead.\n");
+
+ snprintf(args, sizeof(args), "volume=%f", audio_volume / 256.0);
+
+ snprintf(name, sizeof(name), "graph %d volume for input stream %d:%d",
+ fg->index, ist->file_index, ist->st->index);
+ ret = avfilter_graph_create_filter(&volume,
+ avfilter_get_by_name("volume"),
+ name, args, NULL, fg->graph);
+ if (ret < 0)
+ return ret;
+
+ ret = avfilter_link(volume, 0, first_filter, pad_idx);
+ if (ret < 0)
+ return ret;
+
+ first_filter = volume;
+ pad_idx = 0;
+ }
+ if ((ret = avfilter_link(ifilter->filter, 0, first_filter, pad_idx)) < 0)
+ return ret;
+
+ return 0;
+}
+
+static int configure_input_filter(FilterGraph *fg, InputFilter *ifilter,
+ AVFilterInOut *in)
+{
+ av_freep(&ifilter->name);
+ DESCRIBE_FILTER_LINK(ifilter, in, 1);
+
+ switch (avfilter_pad_get_type(in->filter_ctx->input_pads, in->pad_idx)) {
+ case AVMEDIA_TYPE_VIDEO: return configure_input_video_filter(fg, ifilter, in);
+ case AVMEDIA_TYPE_AUDIO: return configure_input_audio_filter(fg, ifilter, in);
+ default: av_assert0(0);
+ }
+}
+
+int configure_filtergraph(FilterGraph *fg)
+{
+ AVFilterInOut *inputs, *outputs, *cur;
+ int ret, i, init = !fg->graph, simple = !fg->graph_desc;
+ const char *graph_desc = simple ? fg->outputs[0]->ost->avfilter :
+ fg->graph_desc;
+
+ avfilter_graph_free(&fg->graph);
+ if (!(fg->graph = avfilter_graph_alloc()))
+ return AVERROR(ENOMEM);
+
+ if (simple) {
+ OutputStream *ost = fg->outputs[0]->ost;
+ char args[255];
+ snprintf(args, sizeof(args), "flags=0x%X", (unsigned)ost->sws_flags);
+ fg->graph->scale_sws_opts = av_strdup(args);
+ }
+
+ if ((ret = avfilter_graph_parse2(fg->graph, graph_desc, &inputs, &outputs)) < 0)
+ return ret;
+
+ if (simple && (!inputs || inputs->next || !outputs || outputs->next)) {
+ av_log(NULL, AV_LOG_ERROR, "Simple filtergraph '%s' does not have "
+ "exactly one input and output.\n", graph_desc);
+ return AVERROR(EINVAL);
+ }
+
+ for (cur = inputs; !simple && init && cur; cur = cur->next)
+ init_input_filter(fg, cur);
+
+ for (cur = inputs, i = 0; cur; cur = cur->next, i++)
+ if ((ret = configure_input_filter(fg, fg->inputs[i], cur)) < 0)
+ return ret;
+ avfilter_inout_free(&inputs);
+
+ if (!init || simple) {
+ /* we already know the mappings between lavfi outputs and output streams,
+ * so we can finish the setup */
+ for (cur = outputs, i = 0; cur; cur = cur->next, i++)
+ configure_output_filter(fg, fg->outputs[i], cur);
+ avfilter_inout_free(&outputs);
+
+ if ((ret = avfilter_graph_config(fg->graph, NULL)) < 0)
+ return ret;
+ } else {
+ /* wait until output mappings are processed */
+ for (cur = outputs; cur;) {
+ GROW_ARRAY(fg->outputs, fg->nb_outputs);
+ if (!(fg->outputs[fg->nb_outputs - 1] = av_mallocz(sizeof(*fg->outputs[0]))))
+ exit(1);
+ fg->outputs[fg->nb_outputs - 1]->graph = fg;
+ fg->outputs[fg->nb_outputs - 1]->out_tmp = cur;
+ cur = cur->next;
+ fg->outputs[fg->nb_outputs - 1]->out_tmp->next = NULL;
+ }
+ }
+
+ return 0;
+}
+
+int ist_in_filtergraph(FilterGraph *fg, InputStream *ist)
+{
+ int i;
+ for (i = 0; i < fg->nb_inputs; i++)
+ if (fg->inputs[i]->ist == ist)
+ return 1;
+ return 0;
+}
+
diff --git a/gst-libs/ext/libav/avconv_opt.c b/gst-libs/ext/libav/avconv_opt.c
new file mode 100644
index 0000000..e67abef
--- /dev/null
+++ b/gst-libs/ext/libav/avconv_opt.c
@@ -0,0 +1,2132 @@
+/*
+ * avconv option parsing
+ *
+ * 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
+ */
+
+#include <stdint.h>
+
+#include "avconv.h"
+#include "cmdutils.h"
+
+#include "libavformat/avformat.h"
+
+#include "libavcodec/avcodec.h"
+
+#include "libavfilter/avfilter.h"
+#include "libavfilter/avfiltergraph.h"
+
+#include "libavutil/avassert.h"
+#include "libavutil/avstring.h"
+#include "libavutil/avutil.h"
+#include "libavutil/channel_layout.h"
+#include "libavutil/intreadwrite.h"
+#include "libavutil/fifo.h"
+#include "libavutil/mathematics.h"
+#include "libavutil/opt.h"
+#include "libavutil/parseutils.h"
+#include "libavutil/pixdesc.h"
+#include "libavutil/pixfmt.h"
+
+#define MATCH_PER_STREAM_OPT(name, type, outvar, fmtctx, st)\
+{\
+ int i, ret;\
+ for (i = 0; i < o->nb_ ## name; i++) {\
+ char *spec = o->name[i].specifier;\
+ if ((ret = check_stream_specifier(fmtctx, st, spec)) > 0)\
+ outvar = o->name[i].u.type;\
+ else if (ret < 0)\
+ exit(1);\
+ }\
+}
+
+char *vstats_filename;
+
+float audio_drift_threshold = 0.1;
+float dts_delta_threshold = 10;
+
+int audio_volume = 256;
+int audio_sync_method = 0;
+int video_sync_method = VSYNC_AUTO;
+int do_deinterlace = 0;
+int do_benchmark = 0;
+int do_hex_dump = 0;
+int do_pkt_dump = 0;
+int copy_ts = 0;
+int copy_tb = 1;
+int exit_on_error = 0;
+int print_stats = 1;
+int qp_hist = 0;
+
+static int file_overwrite = 0;
+static int video_discard = 0;
+static int intra_dc_precision = 8;
+static int using_stdin = 0;
+static int input_sync;
+
+static void uninit_options(OptionsContext *o)
+{
+ const OptionDef *po = options;
+ int i;
+
+ /* all OPT_SPEC and OPT_STRING can be freed in generic way */
+ while (po->name) {
+ void *dst = (uint8_t*)o + po->u.off;
+
+ if (po->flags & OPT_SPEC) {
+ SpecifierOpt **so = dst;
+ int i, *count = (int*)(so + 1);
+ for (i = 0; i < *count; i++) {
+ av_freep(&(*so)[i].specifier);
+ if (po->flags & OPT_STRING)
+ av_freep(&(*so)[i].u.str);
+ }
+ av_freep(so);
+ *count = 0;
+ } else if (po->flags & OPT_OFFSET && po->flags & OPT_STRING)
+ av_freep(dst);
+ po++;
+ }
+
+ for (i = 0; i < o->nb_stream_maps; i++)
+ av_freep(&o->stream_maps[i].linklabel);
+ av_freep(&o->stream_maps);
+ av_freep(&o->meta_data_maps);
+ av_freep(&o->streamid_map);
+}
+
+static void init_options(OptionsContext *o)
+{
+ memset(o, 0, sizeof(*o));
+
+ o->mux_max_delay = 0.7;
+ o->recording_time = INT64_MAX;
+ o->limit_filesize = UINT64_MAX;
+ o->chapters_input_file = INT_MAX;
+}
+
+static double parse_frame_aspect_ratio(const char *arg)
+{
+ int x = 0, y = 0;
+ double ar = 0;
+ const char *p;
+ char *end;
+
+ p = strchr(arg, ':');
+ if (p) {
+ x = strtol(arg, &end, 10);
+ if (end == p)
+ y = strtol(end + 1, &end, 10);
+ if (x > 0 && y > 0)
+ ar = (double)x / (double)y;
+ } else
+ ar = strtod(arg, NULL);
+
+ if (!ar) {
+ av_log(NULL, AV_LOG_FATAL, "Incorrect aspect ratio specification.\n");
+ exit(1);
+ }
+ return ar;
+}
+
+static int opt_audio_codec(void *optctx, const char *opt, const char *arg)
+{
+ OptionsContext *o = optctx;
+ return parse_option(o, "codec:a", arg, options);
+}
+
+static int opt_video_codec(void *optctx, const char *opt, const char *arg)
+{
+ OptionsContext *o = optctx;
+ return parse_option(o, "codec:v", arg, options);
+}
+
+static int opt_subtitle_codec(void *optctx, const char *opt, const char *arg)
+{
+ OptionsContext *o = optctx;
+ return parse_option(o, "codec:s", arg, options);
+}
+
+static int opt_data_codec(void *optctx, const char *opt, const char *arg)
+{
+ OptionsContext *o = optctx;
+ return parse_option(o, "codec:d", arg, options);
+}
+
+static int opt_map(void *optctx, const char *opt, const char *arg)
+{
+ OptionsContext *o = optctx;
+ StreamMap *m = NULL;
+ int i, negative = 0, file_idx;
+ int sync_file_idx = -1, sync_stream_idx;
+ char *p, *sync;
+ char *map;
+
+ if (*arg == '-') {
+ negative = 1;
+ arg++;
+ }
+ map = av_strdup(arg);
+
+ /* parse sync stream first, just pick first matching stream */
+ if (sync = strchr(map, ',')) {
+ *sync = 0;
+ sync_file_idx = strtol(sync + 1, &sync, 0);
+ if (sync_file_idx >= nb_input_files || sync_file_idx < 0) {
+ av_log(NULL, AV_LOG_FATAL, "Invalid sync file index: %d.\n", sync_file_idx);
+ exit(1);
+ }
+ if (*sync)
+ sync++;
+ for (i = 0; i < input_files[sync_file_idx]->nb_streams; i++)
+ if (check_stream_specifier(input_files[sync_file_idx]->ctx,
+ input_files[sync_file_idx]->ctx->streams[i], sync) == 1) {
+ sync_stream_idx = i;
+ break;
+ }
+ if (i == input_files[sync_file_idx]->nb_streams) {
+ av_log(NULL, AV_LOG_FATAL, "Sync stream specification in map %s does not "
+ "match any streams.\n", arg);
+ exit(1);
+ }
+ }
+
+
+ if (map[0] == '[') {
+ /* this mapping refers to lavfi output */
+ const char *c = map + 1;
+ GROW_ARRAY(o->stream_maps, o->nb_stream_maps);
+ m = &o->stream_maps[o->nb_stream_maps - 1];
+ m->linklabel = av_get_token(&c, "]");
+ if (!m->linklabel) {
+ av_log(NULL, AV_LOG_ERROR, "Invalid output link label: %s.\n", map);
+ exit(1);
+ }
+ } else {
+ file_idx = strtol(map, &p, 0);
+ if (file_idx >= nb_input_files || file_idx < 0) {
+ av_log(NULL, AV_LOG_FATAL, "Invalid input file index: %d.\n", file_idx);
+ exit(1);
+ }
+ if (negative)
+ /* disable some already defined maps */
+ for (i = 0; i < o->nb_stream_maps; i++) {
+ m = &o->stream_maps[i];
+ if (file_idx == m->file_index &&
+ check_stream_specifier(input_files[m->file_index]->ctx,
+ input_files[m->file_index]->ctx->streams[m->stream_index],
+ *p == ':' ? p + 1 : p) > 0)
+ m->disabled = 1;
+ }
+ else
+ for (i = 0; i < input_files[file_idx]->nb_streams; i++) {
+ if (check_stream_specifier(input_files[file_idx]->ctx, input_files[file_idx]->ctx->streams[i],
+ *p == ':' ? p + 1 : p) <= 0)
+ continue;
+ GROW_ARRAY(o->stream_maps, o->nb_stream_maps);
+ m = &o->stream_maps[o->nb_stream_maps - 1];
+
+ m->file_index = file_idx;
+ m->stream_index = i;
+
+ if (sync_file_idx >= 0) {
+ m->sync_file_index = sync_file_idx;
+ m->sync_stream_index = sync_stream_idx;
+ } else {
+ m->sync_file_index = file_idx;
+ m->sync_stream_index = i;
+ }
+ }
+ }
+
+ if (!m) {
+ av_log(NULL, AV_LOG_FATAL, "Stream map '%s' matches no streams.\n", arg);
+ exit(1);
+ }
+
+ av_freep(&map);
+ return 0;
+}
+
+static int opt_attach(void *optctx, const char *opt, const char *arg)
+{
+ OptionsContext *o = optctx;
+ GROW_ARRAY(o->attachments, o->nb_attachments);
+ o->attachments[o->nb_attachments - 1] = arg;
+ return 0;
+}
+
+/**
+ * Parse a metadata specifier passed as 'arg' parameter.
+ * @param arg metadata string to parse
+ * @param type metadata type is written here -- g(lobal)/s(tream)/c(hapter)/p(rogram)
+ * @param index for type c/p, chapter/program index is written here
+ * @param stream_spec for type s, the stream specifier is written here
+ */
+static void parse_meta_type(char *arg, char *type, int *index, const char **stream_spec)
+{
+ if (*arg) {
+ *type = *arg;
+ switch (*arg) {
+ case 'g':
+ break;
+ case 's':
+ if (*(++arg) && *arg != ':') {
+ av_log(NULL, AV_LOG_FATAL, "Invalid metadata specifier %s.\n", arg);
+ exit(1);
+ }
+ *stream_spec = *arg == ':' ? arg + 1 : "";
+ break;
+ case 'c':
+ case 'p':
+ if (*(++arg) == ':')
+ *index = strtol(++arg, NULL, 0);
+ break;
+ default:
+ av_log(NULL, AV_LOG_FATAL, "Invalid metadata type %c.\n", *arg);
+ exit(1);
+ }
+ } else
+ *type = 'g';
+}
+
+static int copy_metadata(char *outspec, char *inspec, AVFormatContext *oc, AVFormatContext *ic, OptionsContext *o)
+{
+ AVDictionary **meta_in = NULL;
+ AVDictionary **meta_out;
+ int i, ret = 0;
+ char type_in, type_out;
+ const char *istream_spec = NULL, *ostream_spec = NULL;
+ int idx_in = 0, idx_out = 0;
+
+ parse_meta_type(inspec, &type_in, &idx_in, &istream_spec);
+ parse_meta_type(outspec, &type_out, &idx_out, &ostream_spec);
+
+ if (type_in == 'g' || type_out == 'g')
+ o->metadata_global_manual = 1;
+ if (type_in == 's' || type_out == 's')
+ o->metadata_streams_manual = 1;
+ if (type_in == 'c' || type_out == 'c')
+ o->metadata_chapters_manual = 1;
+
+ /* ic is NULL when just disabling automatic mappings */
+ if (!ic)
+ return 0;
+
+#define METADATA_CHECK_INDEX(index, nb_elems, desc)\
+ if ((index) < 0 || (index) >= (nb_elems)) {\
+ av_log(NULL, AV_LOG_FATAL, "Invalid %s index %d while processing metadata maps.\n",\
+ (desc), (index));\
+ exit(1);\
+ }
+
+#define SET_DICT(type, meta, context, index)\
+ switch (type) {\
+ case 'g':\
+ meta = &context->metadata;\
+ break;\
+ case 'c':\
+ METADATA_CHECK_INDEX(index, context->nb_chapters, "chapter")\
+ meta = &context->chapters[index]->metadata;\
+ break;\
+ case 'p':\
+ METADATA_CHECK_INDEX(index, context->nb_programs, "program")\
+ meta = &context->programs[index]->metadata;\
+ break;\
+ case 's':\
+ break; /* handled separately below */ \
+ default: av_assert0(0);\
+ }\
+
+ SET_DICT(type_in, meta_in, ic, idx_in);
+ SET_DICT(type_out, meta_out, oc, idx_out);
+
+ /* for input streams choose first matching stream */
+ if (type_in == 's') {
+ for (i = 0; i < ic->nb_streams; i++) {
+ if ((ret = check_stream_specifier(ic, ic->streams[i], istream_spec)) > 0) {
+ meta_in = &ic->streams[i]->metadata;
+ break;
+ } else if (ret < 0)
+ exit(1);
+ }
+ if (!meta_in) {
+ av_log(NULL, AV_LOG_FATAL, "Stream specifier %s does not match any streams.\n", istream_spec);
+ exit(1);
+ }
+ }
+
+ if (type_out == 's') {
+ for (i = 0; i < oc->nb_streams; i++) {
+ if ((ret = check_stream_specifier(oc, oc->streams[i], ostream_spec)) > 0) {
+ meta_out = &oc->streams[i]->metadata;
+ av_dict_copy(meta_out, *meta_in, AV_DICT_DONT_OVERWRITE);
+ } else if (ret < 0)
+ exit(1);
+ }
+ } else
+ av_dict_copy(meta_out, *meta_in, AV_DICT_DONT_OVERWRITE);
+
+ return 0;
+}
+
+static AVCodec *find_codec_or_die(const char *name, enum AVMediaType type, int encoder)
+{
+ const AVCodecDescriptor *desc;
+ const char *codec_string = encoder ? "encoder" : "decoder";
+ AVCodec *codec;
+
+ codec = encoder ?
+ avcodec_find_encoder_by_name(name) :
+ avcodec_find_decoder_by_name(name);
+
+ if (!codec && (desc = avcodec_descriptor_get_by_name(name))) {
+ codec = encoder ? avcodec_find_encoder(desc->id) :
+ avcodec_find_decoder(desc->id);
+ if (codec)
+ av_log(NULL, AV_LOG_VERBOSE, "Matched %s '%s' for codec '%s'.\n",
+ codec_string, codec->name, desc->name);
+ }
+
+ if (!codec) {
+ av_log(NULL, AV_LOG_FATAL, "Unknown %s '%s'\n", codec_string, name);
+ exit(1);
+ }
+ if (codec->type != type) {
+ av_log(NULL, AV_LOG_FATAL, "Invalid %s type '%s'\n", codec_string, name);
+ exit(1);
+ }
+ return codec;
+}
+
+static AVCodec *choose_decoder(OptionsContext *o, AVFormatContext *s, AVStream *st)
+{
+ char *codec_name = NULL;
+
+ MATCH_PER_STREAM_OPT(codec_names, str, codec_name, s, st);
+ if (codec_name) {
+ AVCodec *codec = find_codec_or_die(codec_name, st->codec->codec_type, 0);
+ st->codec->codec_id = codec->id;
+ return codec;
+ } else
+ return avcodec_find_decoder(st->codec->codec_id);
+}
+
+/* Add all the streams from the given input file to the global
+ * list of input streams. */
+static void add_input_streams(OptionsContext *o, AVFormatContext *ic)
+{
+ int i;
+
+ for (i = 0; i < ic->nb_streams; i++) {
+ AVStream *st = ic->streams[i];
+ AVCodecContext *dec = st->codec;
+ InputStream *ist = av_mallocz(sizeof(*ist));
+ char *framerate = NULL;
+
+ if (!ist)
+ exit(1);
+
+ GROW_ARRAY(input_streams, nb_input_streams);
+ input_streams[nb_input_streams - 1] = ist;
+
+ ist->st = st;
+ ist->file_index = nb_input_files;
+ ist->discard = 1;
+ st->discard = AVDISCARD_ALL;
+
+ ist->ts_scale = 1.0;
+ MATCH_PER_STREAM_OPT(ts_scale, dbl, ist->ts_scale, ic, st);
+
+ ist->dec = choose_decoder(o, ic, st);
+ ist->opts = filter_codec_opts(o->g->codec_opts, ist->st->codec->codec_id, ic, st, ist->dec);
+
+ switch (dec->codec_type) {
+ case AVMEDIA_TYPE_VIDEO:
+ ist->resample_height = dec->height;
+ ist->resample_width = dec->width;
+ ist->resample_pix_fmt = dec->pix_fmt;
+
+ MATCH_PER_STREAM_OPT(frame_rates, str, framerate, ic, st);
+ if (framerate && av_parse_video_rate(&ist->framerate,
+ framerate) < 0) {
+ av_log(NULL, AV_LOG_ERROR, "Error parsing framerate %s.\n",
+ framerate);
+ exit(1);
+ }
+
+ break;
+ case AVMEDIA_TYPE_AUDIO:
+ guess_input_channel_layout(ist);
+
+ ist->resample_sample_fmt = dec->sample_fmt;
+ ist->resample_sample_rate = dec->sample_rate;
+ ist->resample_channels = dec->channels;
+ ist->resample_channel_layout = dec->channel_layout;
+
+ break;
+ case AVMEDIA_TYPE_DATA:
+ case AVMEDIA_TYPE_SUBTITLE:
+ case AVMEDIA_TYPE_ATTACHMENT:
+ case AVMEDIA_TYPE_UNKNOWN:
+ break;
+ default:
+ abort();
+ }
+ }
+}
+
+static void assert_file_overwrite(const char *filename)
+{
+ if (!file_overwrite &&
+ (strchr(filename, ':') == NULL || filename[1] == ':' ||
+ av_strstart(filename, "file:", NULL))) {
+ if (avio_check(filename, 0) == 0) {
+ if (!using_stdin) {
+ fprintf(stderr,"File '%s' already exists. Overwrite ? [y/N] ", filename);
+ fflush(stderr);
+ if (!read_yesno()) {
+ fprintf(stderr, "Not overwriting - exiting\n");
+ exit(1);
+ }
+ }
+ else {
+ fprintf(stderr,"File '%s' already exists. Exiting.\n", filename);
+ exit(1);
+ }
+ }
+ }
+}
+
+static void dump_attachment(AVStream *st, const char *filename)
+{
+ int ret;
+ AVIOContext *out = NULL;
+ AVDictionaryEntry *e;
+
+ if (!st->codec->extradata_size) {
+ av_log(NULL, AV_LOG_WARNING, "No extradata to dump in stream #%d:%d.\n",
+ nb_input_files - 1, st->index);
+ return;
+ }
+ if (!*filename && (e = av_dict_get(st->metadata, "filename", NULL, 0)))
+ filename = e->value;
+ if (!*filename) {
+ av_log(NULL, AV_LOG_FATAL, "No filename specified and no 'filename' tag"
+ "in stream #%d:%d.\n", nb_input_files - 1, st->index);
+ exit(1);
+ }
+
+ assert_file_overwrite(filename);
+
+ if ((ret = avio_open2(&out, filename, AVIO_FLAG_WRITE, &int_cb, NULL)) < 0) {
+ av_log(NULL, AV_LOG_FATAL, "Could not open file %s for writing.\n",
+ filename);
+ exit(1);
+ }
+
+ avio_write(out, st->codec->extradata, st->codec->extradata_size);
+ avio_flush(out);
+ avio_close(out);
+}
+
+static int open_input_file(OptionsContext *o, const char *filename)
+{
+ AVFormatContext *ic;
+ AVInputFormat *file_iformat = NULL;
+ int err, i, ret;
+ int64_t timestamp;
+ uint8_t buf[128];
+ AVDictionary **opts;
+ int orig_nb_streams; // number of streams before avformat_find_stream_info
+
+ if (o->format) {
+ if (!(file_iformat = av_find_input_format(o->format))) {
+ av_log(NULL, AV_LOG_FATAL, "Unknown input format: '%s'\n", o->format);
+ exit(1);
+ }
+ }
+
+ if (!strcmp(filename, "-"))
+ filename = "pipe:";
+
+ using_stdin |= !strncmp(filename, "pipe:", 5) ||
+ !strcmp(filename, "/dev/stdin");
+
+ /* get default parameters from command line */
+ ic = avformat_alloc_context();
+ if (!ic) {
+ print_error(filename, AVERROR(ENOMEM));
+ exit(1);
+ }
+ if (o->nb_audio_sample_rate) {
+ snprintf(buf, sizeof(buf), "%d", o->audio_sample_rate[o->nb_audio_sample_rate - 1].u.i);
+ av_dict_set(&o->g->format_opts, "sample_rate", buf, 0);
+ }
+ if (o->nb_audio_channels) {
+ /* because we set audio_channels based on both the "ac" and
+ * "channel_layout" options, we need to check that the specified
+ * demuxer actually has the "channels" option before setting it */
+ if (file_iformat && file_iformat->priv_class &&
+ av_opt_find(&file_iformat->priv_class, "channels", NULL, 0,
+ AV_OPT_SEARCH_FAKE_OBJ)) {
+ snprintf(buf, sizeof(buf), "%d",
+ o->audio_channels[o->nb_audio_channels - 1].u.i);
+ av_dict_set(&o->g->format_opts, "channels", buf, 0);
+ }
+ }
+ if (o->nb_frame_rates) {
+ /* set the format-level framerate option;
+ * this is important for video grabbers, e.g. x11 */
+ if (file_iformat && file_iformat->priv_class &&
+ av_opt_find(&file_iformat->priv_class, "framerate", NULL, 0,
+ AV_OPT_SEARCH_FAKE_OBJ)) {
+ av_dict_set(&o->g->format_opts, "framerate",
+ o->frame_rates[o->nb_frame_rates - 1].u.str, 0);
+ }
+ }
+ if (o->nb_frame_sizes) {
+ av_dict_set(&o->g->format_opts, "video_size", o->frame_sizes[o->nb_frame_sizes - 1].u.str, 0);
+ }
+ if (o->nb_frame_pix_fmts)
+ av_dict_set(&o->g->format_opts, "pixel_format", o->frame_pix_fmts[o->nb_frame_pix_fmts - 1].u.str, 0);
+
+ ic->flags |= AVFMT_FLAG_NONBLOCK;
+ ic->interrupt_callback = int_cb;
+
+ /* open the input file with generic libav function */
+ err = avformat_open_input(&ic, filename, file_iformat, &o->g->format_opts);
+ if (err < 0) {
+ print_error(filename, err);
+ exit(1);
+ }
+ assert_avoptions(o->g->format_opts);
+
+ /* apply forced codec ids */
+ for (i = 0; i < ic->nb_streams; i++)
+ choose_decoder(o, ic, ic->streams[i]);
+
+ /* Set AVCodecContext options for avformat_find_stream_info */
+ opts = setup_find_stream_info_opts(ic, o->g->codec_opts);
+ orig_nb_streams = ic->nb_streams;
+
+ /* If not enough info to get the stream parameters, we decode the
+ first frames to get it. (used in mpeg case for example) */
+ ret = avformat_find_stream_info(ic, opts);
+ if (ret < 0) {
+ av_log(NULL, AV_LOG_FATAL, "%s: could not find codec parameters\n", filename);
+ avformat_close_input(&ic);
+ exit(1);
+ }
+
+ timestamp = o->start_time;
+ /* add the stream start time */
+ if (ic->start_time != AV_NOPTS_VALUE)
+ timestamp += ic->start_time;
+
+ /* if seeking requested, we execute it */
+ if (o->start_time != 0) {
+ ret = av_seek_frame(ic, -1, timestamp, AVSEEK_FLAG_BACKWARD);
+ if (ret < 0) {
+ av_log(NULL, AV_LOG_WARNING, "%s: could not seek to position %0.3f\n",
+ filename, (double)timestamp / AV_TIME_BASE);
+ }
+ }
+
+ /* update the current parameters so that they match the one of the input stream */
+ add_input_streams(o, ic);
+
+ /* dump the file content */
+ av_dump_format(ic, nb_input_files, filename, 0);
+
+ GROW_ARRAY(input_files, nb_input_files);
+ if (!(input_files[nb_input_files - 1] = av_mallocz(sizeof(*input_files[0]))))
+ exit(1);
+
+ input_files[nb_input_files - 1]->ctx = ic;
+ input_files[nb_input_files - 1]->ist_index = nb_input_streams - ic->nb_streams;
+ input_files[nb_input_files - 1]->ts_offset = o->input_ts_offset - (copy_ts ? 0 : timestamp);
+ input_files[nb_input_files - 1]->nb_streams = ic->nb_streams;
+ input_files[nb_input_files - 1]->rate_emu = o->rate_emu;
+
+ for (i = 0; i < o->nb_dump_attachment; i++) {
+ int j;
+
+ for (j = 0; j < ic->nb_streams; j++) {
+ AVStream *st = ic->streams[j];
+
+ if (check_stream_specifier(ic, st, o->dump_attachment[i].specifier) == 1)
+ dump_attachment(st, o->dump_attachment[i].u.str);
+ }
+ }
+
+ for (i = 0; i < orig_nb_streams; i++)
+ av_dict_free(&opts[i]);
+ av_freep(&opts);
+
+ return 0;
+}
+
+static uint8_t *get_line(AVIOContext *s)
+{
+ AVIOContext *line;
+ uint8_t *buf;
+ char c;
+
+ if (avio_open_dyn_buf(&line) < 0) {
+ av_log(NULL, AV_LOG_FATAL, "Could not alloc buffer for reading preset.\n");
+ exit(1);
+ }
+
+ while ((c = avio_r8(s)) && c != '\n')
+ avio_w8(line, c);
+ avio_w8(line, 0);
+ avio_close_dyn_buf(line, &buf);
+
+ return buf;
+}
+
+static int get_preset_file_2(const char *preset_name, const char *codec_name, AVIOContext **s)
+{
+ int i, ret = 1;
+ char filename[1000];
+ const char *base[3] = { getenv("AVCONV_DATADIR"),
+ getenv("HOME"),
+ AVCONV_DATADIR,
+ };
+
+ for (i = 0; i < FF_ARRAY_ELEMS(base) && ret; i++) {
+ if (!base[i])
+ continue;
+ if (codec_name) {
+ snprintf(filename, sizeof(filename), "%s%s/%s-%s.avpreset", base[i],
+ i != 1 ? "" : "/.avconv", codec_name, preset_name);
+ ret = avio_open2(s, filename, AVIO_FLAG_READ, &int_cb, NULL);
+ }
+ if (ret) {
+ snprintf(filename, sizeof(filename), "%s%s/%s.avpreset", base[i],
+ i != 1 ? "" : "/.avconv", preset_name);
+ ret = avio_open2(s, filename, AVIO_FLAG_READ, &int_cb, NULL);
+ }
+ }
+ return ret;
+}
+
+static void choose_encoder(OptionsContext *o, AVFormatContext *s, OutputStream *ost)
+{
+ char *codec_name = NULL;
+
+ MATCH_PER_STREAM_OPT(codec_names, str, codec_name, s, ost->st);
+ if (!codec_name) {
+ ost->st->codec->codec_id = av_guess_codec(s->oformat, NULL, s->filename,
+ NULL, ost->st->codec->codec_type);
+ ost->enc = avcodec_find_encoder(ost->st->codec->codec_id);
+ } else if (!strcmp(codec_name, "copy"))
+ ost->stream_copy = 1;
+ else {
+ ost->enc = find_codec_or_die(codec_name, ost->st->codec->codec_type, 1);
+ ost->st->codec->codec_id = ost->enc->id;
+ }
+}
+
+static OutputStream *new_output_stream(OptionsContext *o, AVFormatContext *oc, enum AVMediaType type)
+{
+ OutputStream *ost;
+ AVStream *st = avformat_new_stream(oc, NULL);
+ int idx = oc->nb_streams - 1, ret = 0;
+ char *bsf = NULL, *next, *codec_tag = NULL;
+ AVBitStreamFilterContext *bsfc, *bsfc_prev = NULL;
+ double qscale = -1;
+
+ if (!st) {
+ av_log(NULL, AV_LOG_FATAL, "Could not alloc stream.\n");
+ exit(1);
+ }
+
+ if (oc->nb_streams - 1 < o->nb_streamid_map)
+ st->id = o->streamid_map[oc->nb_streams - 1];
+
+ GROW_ARRAY(output_streams, nb_output_streams);
+ if (!(ost = av_mallocz(sizeof(*ost))))
+ exit(1);
+ output_streams[nb_output_streams - 1] = ost;
+
+ ost->file_index = nb_output_files;
+ ost->index = idx;
+ ost->st = st;
+ st->codec->codec_type = type;
+ choose_encoder(o, oc, ost);
+ if (ost->enc) {
+ AVIOContext *s = NULL;
+ char *buf = NULL, *arg = NULL, *preset = NULL;
+
+ ost->opts = filter_codec_opts(o->g->codec_opts, ost->enc->id, oc, st, ost->enc);
+
+ MATCH_PER_STREAM_OPT(presets, str, preset, oc, st);
+ if (preset && (!(ret = get_preset_file_2(preset, ost->enc->name, &s)))) {
+ do {
+ buf = get_line(s);
+ if (!buf[0] || buf[0] == '#') {
+ av_free(buf);
+ continue;
+ }
+ if (!(arg = strchr(buf, '='))) {
+ av_log(NULL, AV_LOG_FATAL, "Invalid line found in the preset file.\n");
+ exit(1);
+ }
+ *arg++ = 0;
+ av_dict_set(&ost->opts, buf, arg, AV_DICT_DONT_OVERWRITE);
+ av_free(buf);
+ } while (!s->eof_reached);
+ avio_close(s);
+ }
+ if (ret) {
+ av_log(NULL, AV_LOG_FATAL,
+ "Preset %s specified for stream %d:%d, but could not be opened.\n",
+ preset, ost->file_index, ost->index);
+ exit(1);
+ }
+ }
+
+ avcodec_get_context_defaults3(st->codec, ost->enc);
+ st->codec->codec_type = type; // XXX hack, avcodec_get_context_defaults2() sets type to unknown for stream copy
+
+ ost->max_frames = INT64_MAX;
+ MATCH_PER_STREAM_OPT(max_frames, i64, ost->max_frames, oc, st);
+
+ MATCH_PER_STREAM_OPT(bitstream_filters, str, bsf, oc, st);
+ while (bsf) {
+ if (next = strchr(bsf, ','))
+ *next++ = 0;
+ if (!(bsfc = av_bitstream_filter_init(bsf))) {
+ av_log(NULL, AV_LOG_FATAL, "Unknown bitstream filter %s\n", bsf);
+ exit(1);
+ }
+ if (bsfc_prev)
+ bsfc_prev->next = bsfc;
+ else
+ ost->bitstream_filters = bsfc;
+
+ bsfc_prev = bsfc;
+ bsf = next;
+ }
+
+ MATCH_PER_STREAM_OPT(codec_tags, str, codec_tag, oc, st);
+ if (codec_tag) {
+ uint32_t tag = strtol(codec_tag, &next, 0);
+ if (*next)
+ tag = AV_RL32(codec_tag);
+ st->codec->codec_tag = tag;
+ }
+
+ MATCH_PER_STREAM_OPT(qscale, dbl, qscale, oc, st);
+ if (qscale >= 0) {
+ st->codec->flags |= CODEC_FLAG_QSCALE;
+ st->codec->global_quality = FF_QP2LAMBDA * qscale;
+ }
+
+ if (oc->oformat->flags & AVFMT_GLOBALHEADER)
+ st->codec->flags |= CODEC_FLAG_GLOBAL_HEADER;
+
+ av_opt_get_int(o->g->sws_opts, "sws_flags", 0, &ost->sws_flags);
+
+ ost->pix_fmts[0] = ost->pix_fmts[1] = AV_PIX_FMT_NONE;
+
+ return ost;
+}
+
+static void parse_matrix_coeffs(uint16_t *dest, const char *str)
+{
+ int i;
+ const char *p = str;
+ for (i = 0;; i++) {
+ dest[i] = atoi(p);
+ if (i == 63)
+ break;
+ p = strchr(p, ',');
+ if (!p) {
+ av_log(NULL, AV_LOG_FATAL, "Syntax error in matrix \"%s\" at coeff %d\n", str, i);
+ exit(1);
+ }
+ p++;
+ }
+}
+
+static OutputStream *new_video_stream(OptionsContext *o, AVFormatContext *oc)
+{
+ AVStream *st;
+ OutputStream *ost;
+ AVCodecContext *video_enc;
+
+ ost = new_output_stream(o, oc, AVMEDIA_TYPE_VIDEO);
+ st = ost->st;
+ video_enc = st->codec;
+
+ if (!ost->stream_copy) {
+ const char *p = NULL;
+ char *frame_rate = NULL, *frame_size = NULL;
+ char *frame_aspect_ratio = NULL, *frame_pix_fmt = NULL;
+ char *intra_matrix = NULL, *inter_matrix = NULL;
+ const char *filters = "null";
+ int do_pass = 0;
+ int i;
+
+ MATCH_PER_STREAM_OPT(frame_rates, str, frame_rate, oc, st);
+ if (frame_rate && av_parse_video_rate(&ost->frame_rate, frame_rate) < 0) {
+ av_log(NULL, AV_LOG_FATAL, "Invalid framerate value: %s\n", frame_rate);
+ exit(1);
+ }
+
+ MATCH_PER_STREAM_OPT(frame_sizes, str, frame_size, oc, st);
+ if (frame_size && av_parse_video_size(&video_enc->width, &video_enc->height, frame_size) < 0) {
+ av_log(NULL, AV_LOG_FATAL, "Invalid frame size: %s.\n", frame_size);
+ exit(1);
+ }
+
+ MATCH_PER_STREAM_OPT(frame_aspect_ratios, str, frame_aspect_ratio, oc, st);
+ if (frame_aspect_ratio)
+ ost->frame_aspect_ratio = parse_frame_aspect_ratio(frame_aspect_ratio);
+
+ MATCH_PER_STREAM_OPT(frame_pix_fmts, str, frame_pix_fmt, oc, st);
+ if (frame_pix_fmt && (video_enc->pix_fmt = av_get_pix_fmt(frame_pix_fmt)) == AV_PIX_FMT_NONE) {
+ av_log(NULL, AV_LOG_FATAL, "Unknown pixel format requested: %s.\n", frame_pix_fmt);
+ exit(1);
+ }
+ st->sample_aspect_ratio = video_enc->sample_aspect_ratio;
+
+ MATCH_PER_STREAM_OPT(intra_matrices, str, intra_matrix, oc, st);
+ if (intra_matrix) {
+ if (!(video_enc->intra_matrix = av_mallocz(sizeof(*video_enc->intra_matrix) * 64))) {
+ av_log(NULL, AV_LOG_FATAL, "Could not allocate memory for intra matrix.\n");
+ exit(1);
+ }
+ parse_matrix_coeffs(video_enc->intra_matrix, intra_matrix);
+ }
+ MATCH_PER_STREAM_OPT(inter_matrices, str, inter_matrix, oc, st);
+ if (inter_matrix) {
+ if (!(video_enc->inter_matrix = av_mallocz(sizeof(*video_enc->inter_matrix) * 64))) {
+ av_log(NULL, AV_LOG_FATAL, "Could not allocate memory for inter matrix.\n");
+ exit(1);
+ }
+ parse_matrix_coeffs(video_enc->inter_matrix, inter_matrix);
+ }
+
+ MATCH_PER_STREAM_OPT(rc_overrides, str, p, oc, st);
+ for (i = 0; p; i++) {
+ int start, end, q;
+ int e = sscanf(p, "%d,%d,%d", &start, &end, &q);
+ if (e != 3) {
+ av_log(NULL, AV_LOG_FATAL, "error parsing rc_override\n");
+ exit(1);
+ }
+ video_enc->rc_override =
+ av_realloc(video_enc->rc_override,
+ sizeof(RcOverride) * (i + 1));
+ video_enc->rc_override[i].start_frame = start;
+ video_enc->rc_override[i].end_frame = end;
+ if (q > 0) {
+ video_enc->rc_override[i].qscale = q;
+ video_enc->rc_override[i].quality_factor = 1.0;
+ }
+ else {
+ video_enc->rc_override[i].qscale = 0;
+ video_enc->rc_override[i].quality_factor = -q/100.0;
+ }
+ p = strchr(p, '/');
+ if (p) p++;
+ }
+ video_enc->rc_override_count = i;
+ video_enc->intra_dc_precision = intra_dc_precision - 8;
+
+ /* two pass mode */
+ MATCH_PER_STREAM_OPT(pass, i, do_pass, oc, st);
+ if (do_pass) {
+ if (do_pass == 1) {
+ video_enc->flags |= CODEC_FLAG_PASS1;
+ } else {
+ video_enc->flags |= CODEC_FLAG_PASS2;
+ }
+ }
+
+ MATCH_PER_STREAM_OPT(passlogfiles, str, ost->logfile_prefix, oc, st);
+ if (ost->logfile_prefix &&
+ !(ost->logfile_prefix = av_strdup(ost->logfile_prefix)))
+ exit(1);
+
+ MATCH_PER_STREAM_OPT(forced_key_frames, str, ost->forced_keyframes, oc, st);
+ if (ost->forced_keyframes)
+ ost->forced_keyframes = av_strdup(ost->forced_keyframes);
+
+ MATCH_PER_STREAM_OPT(force_fps, i, ost->force_fps, oc, st);
+
+ ost->top_field_first = -1;
+ MATCH_PER_STREAM_OPT(top_field_first, i, ost->top_field_first, oc, st);
+
+ MATCH_PER_STREAM_OPT(filters, str, filters, oc, st);
+ ost->avfilter = av_strdup(filters);
+ } else {
+ MATCH_PER_STREAM_OPT(copy_initial_nonkeyframes, i, ost->copy_initial_nonkeyframes, oc ,st);
+ }
+
+ return ost;
+}
+
+static OutputStream *new_audio_stream(OptionsContext *o, AVFormatContext *oc)
+{
+ AVStream *st;
+ OutputStream *ost;
+ AVCodecContext *audio_enc;
+
+ ost = new_output_stream(o, oc, AVMEDIA_TYPE_AUDIO);
+ st = ost->st;
+
+ audio_enc = st->codec;
+ audio_enc->codec_type = AVMEDIA_TYPE_AUDIO;
+
+ if (!ost->stream_copy) {
+ char *sample_fmt = NULL;
+ const char *filters = "anull";
+
+ MATCH_PER_STREAM_OPT(audio_channels, i, audio_enc->channels, oc, st);
+
+ MATCH_PER_STREAM_OPT(sample_fmts, str, sample_fmt, oc, st);
+ if (sample_fmt &&
+ (audio_enc->sample_fmt = av_get_sample_fmt(sample_fmt)) == AV_SAMPLE_FMT_NONE) {
+ av_log(NULL, AV_LOG_FATAL, "Invalid sample format '%s'\n", sample_fmt);
+ exit(1);
+ }
+
+ MATCH_PER_STREAM_OPT(audio_sample_rate, i, audio_enc->sample_rate, oc, st);
+
+ MATCH_PER_STREAM_OPT(filters, str, filters, oc, st);
+ ost->avfilter = av_strdup(filters);
+ }
+
+ return ost;
+}
+
+static OutputStream *new_data_stream(OptionsContext *o, AVFormatContext *oc)
+{
+ OutputStream *ost;
+
+ ost = new_output_stream(o, oc, AVMEDIA_TYPE_DATA);
+ if (!ost->stream_copy) {
+ av_log(NULL, AV_LOG_FATAL, "Data stream encoding not supported yet (only streamcopy)\n");
+ exit(1);
+ }
+
+ return ost;
+}
+
+static OutputStream *new_attachment_stream(OptionsContext *o, AVFormatContext *oc)
+{
+ OutputStream *ost = new_output_stream(o, oc, AVMEDIA_TYPE_ATTACHMENT);
+ ost->stream_copy = 1;
+ return ost;
+}
+
+static OutputStream *new_subtitle_stream(OptionsContext *o, AVFormatContext *oc)
+{
+ AVStream *st;
+ OutputStream *ost;
+ AVCodecContext *subtitle_enc;
+
+ ost = new_output_stream(o, oc, AVMEDIA_TYPE_SUBTITLE);
+ st = ost->st;
+ subtitle_enc = st->codec;
+
+ subtitle_enc->codec_type = AVMEDIA_TYPE_SUBTITLE;
+
+ return ost;
+}
+
+/* arg format is "output-stream-index:streamid-value". */
+static int opt_streamid(void *optctx, const char *opt, const char *arg)
+{
+ OptionsContext *o = optctx;
+ int idx;
+ char *p;
+ char idx_str[16];
+
+ av_strlcpy(idx_str, arg, sizeof(idx_str));
+ p = strchr(idx_str, ':');
+ if (!p) {
+ av_log(NULL, AV_LOG_FATAL,
+ "Invalid value '%s' for option '%s', required syntax is 'index:value'\n",
+ arg, opt);
+ exit(1);
+ }
+ *p++ = '\0';
+ idx = parse_number_or_die(opt, idx_str, OPT_INT, 0, INT_MAX);
+ o->streamid_map = grow_array(o->streamid_map, sizeof(*o->streamid_map), &o->nb_streamid_map, idx+1);
+ o->streamid_map[idx] = parse_number_or_die(opt, p, OPT_INT, 0, INT_MAX);
+ return 0;
+}
+
+static int copy_chapters(InputFile *ifile, OutputFile *ofile, int copy_metadata)
+{
+ AVFormatContext *is = ifile->ctx;
+ AVFormatContext *os = ofile->ctx;
+ AVChapter **tmp;
+ int i;
+
+ tmp = av_realloc(os->chapters, sizeof(*os->chapters) * (is->nb_chapters + os->nb_chapters));
+ if (!tmp)
+ return AVERROR(ENOMEM);
+ os->chapters = tmp;
+
+ for (i = 0; i < is->nb_chapters; i++) {
+ AVChapter *in_ch = is->chapters[i], *out_ch;
+ int64_t ts_off = av_rescale_q(ofile->start_time - ifile->ts_offset,
+ AV_TIME_BASE_Q, in_ch->time_base);
+ int64_t rt = (ofile->recording_time == INT64_MAX) ? INT64_MAX :
+ av_rescale_q(ofile->recording_time, AV_TIME_BASE_Q, in_ch->time_base);
+
+
+ if (in_ch->end < ts_off)
+ continue;
+ if (rt != INT64_MAX && in_ch->start > rt + ts_off)
+ break;
+
+ out_ch = av_mallocz(sizeof(AVChapter));
+ if (!out_ch)
+ return AVERROR(ENOMEM);
+
+ out_ch->id = in_ch->id;
+ out_ch->time_base = in_ch->time_base;
+ out_ch->start = FFMAX(0, in_ch->start - ts_off);
+ out_ch->end = FFMIN(rt, in_ch->end - ts_off);
+
+ if (copy_metadata)
+ av_dict_copy(&out_ch->metadata, in_ch->metadata, 0);
+
+ os->chapters[os->nb_chapters++] = out_ch;
+ }
+ return 0;
+}
+
+static void init_output_filter(OutputFilter *ofilter, OptionsContext *o,
+ AVFormatContext *oc)
+{
+ OutputStream *ost;
+
+ switch (avfilter_pad_get_type(ofilter->out_tmp->filter_ctx->output_pads,
+ ofilter->out_tmp->pad_idx)) {
+ case AVMEDIA_TYPE_VIDEO: ost = new_video_stream(o, oc); break;
+ case AVMEDIA_TYPE_AUDIO: ost = new_audio_stream(o, oc); break;
+ default:
+ av_log(NULL, AV_LOG_FATAL, "Only video and audio filters are supported "
+ "currently.\n");
+ exit(1);
+ }
+
+ ost->source_index = -1;
+ ost->filter = ofilter;
+
+ ofilter->ost = ost;
+
+ if (ost->stream_copy) {
+ av_log(NULL, AV_LOG_ERROR, "Streamcopy requested for output stream %d:%d, "
+ "which is fed from a complex filtergraph. Filtering and streamcopy "
+ "cannot be used together.\n", ost->file_index, ost->index);
+ exit(1);
+ }
+
+ if (configure_output_filter(ofilter->graph, ofilter, ofilter->out_tmp) < 0) {
+ av_log(NULL, AV_LOG_FATAL, "Error configuring filter.\n");
+ exit(1);
+ }
+ avfilter_inout_free(&ofilter->out_tmp);
+}
+
+static int configure_complex_filters(void)
+{
+ int i, ret = 0;
+
+ for (i = 0; i < nb_filtergraphs; i++)
+ if (!filtergraphs[i]->graph &&
+ (ret = configure_filtergraph(filtergraphs[i])) < 0)
+ return ret;
+ return 0;
+}
+
+static int open_output_file(OptionsContext *o, const char *filename)
+{
+ AVFormatContext *oc;
+ int i, j, err;
+ AVOutputFormat *file_oformat;
+ OutputStream *ost;
+ InputStream *ist;
+
+ if (configure_complex_filters() < 0) {
+ av_log(NULL, AV_LOG_FATAL, "Error configuring filters.\n");
+ exit(1);
+ }
+
+ if (!strcmp(filename, "-"))
+ filename = "pipe:";
+
+ oc = avformat_alloc_context();
+ if (!oc) {
+ print_error(filename, AVERROR(ENOMEM));
+ exit(1);
+ }
+
+ if (o->format) {
+ file_oformat = av_guess_format(o->format, NULL, NULL);
+ if (!file_oformat) {
+ av_log(NULL, AV_LOG_FATAL, "Requested output format '%s' is not a suitable output format\n", o->format);
+ exit(1);
+ }
+ } else {
+ file_oformat = av_guess_format(NULL, filename, NULL);
+ if (!file_oformat) {
+ av_log(NULL, AV_LOG_FATAL, "Unable to find a suitable output format for '%s'\n",
+ filename);
+ exit(1);
+ }
+ }
+
+ oc->oformat = file_oformat;
+ oc->interrupt_callback = int_cb;
+ av_strlcpy(oc->filename, filename, sizeof(oc->filename));
+
+ /* create streams for all unlabeled output pads */
+ for (i = 0; i < nb_filtergraphs; i++) {
+ FilterGraph *fg = filtergraphs[i];
+ for (j = 0; j < fg->nb_outputs; j++) {
+ OutputFilter *ofilter = fg->outputs[j];
+
+ if (!ofilter->out_tmp || ofilter->out_tmp->name)
+ continue;
+
+ switch (avfilter_pad_get_type(ofilter->out_tmp->filter_ctx->output_pads,
+ ofilter->out_tmp->pad_idx)) {
+ case AVMEDIA_TYPE_VIDEO: o->video_disable = 1; break;
+ case AVMEDIA_TYPE_AUDIO: o->audio_disable = 1; break;
+ case AVMEDIA_TYPE_SUBTITLE: o->subtitle_disable = 1; break;
+ }
+ init_output_filter(ofilter, o, oc);
+ }
+ }
+
+ if (!o->nb_stream_maps) {
+ /* pick the "best" stream of each type */
+#define NEW_STREAM(type, index)\
+ if (index >= 0) {\
+ ost = new_ ## type ## _stream(o, oc);\
+ ost->source_index = index;\
+ ost->sync_ist = input_streams[index];\
+ input_streams[index]->discard = 0;\
+ input_streams[index]->st->discard = AVDISCARD_NONE;\
+ }
+
+ /* video: highest resolution */
+ if (!o->video_disable && oc->oformat->video_codec != AV_CODEC_ID_NONE) {
+ int area = 0, idx = -1;
+ for (i = 0; i < nb_input_streams; i++) {
+ ist = input_streams[i];
+ if (ist->st->codec->codec_type == AVMEDIA_TYPE_VIDEO &&
+ ist->st->codec->width * ist->st->codec->height > area) {
+ area = ist->st->codec->width * ist->st->codec->height;
+ idx = i;
+ }
+ }
+ NEW_STREAM(video, idx);
+ }
+
+ /* audio: most channels */
+ if (!o->audio_disable && oc->oformat->audio_codec != AV_CODEC_ID_NONE) {
+ int channels = 0, idx = -1;
+ for (i = 0; i < nb_input_streams; i++) {
+ ist = input_streams[i];
+ if (ist->st->codec->codec_type == AVMEDIA_TYPE_AUDIO &&
+ ist->st->codec->channels > channels) {
+ channels = ist->st->codec->channels;
+ idx = i;
+ }
+ }
+ NEW_STREAM(audio, idx);
+ }
+
+ /* subtitles: pick first */
+ if (!o->subtitle_disable && oc->oformat->subtitle_codec != AV_CODEC_ID_NONE) {
+ for (i = 0; i < nb_input_streams; i++)
+ if (input_streams[i]->st->codec->codec_type == AVMEDIA_TYPE_SUBTITLE) {
+ NEW_STREAM(subtitle, i);
+ break;
+ }
+ }
+ /* do something with data? */
+ } else {
+ for (i = 0; i < o->nb_stream_maps; i++) {
+ StreamMap *map = &o->stream_maps[i];
+
+ if (map->disabled)
+ continue;
+
+ if (map->linklabel) {
+ FilterGraph *fg;
+ OutputFilter *ofilter = NULL;
+ int j, k;
+
+ for (j = 0; j < nb_filtergraphs; j++) {
+ fg = filtergraphs[j];
+ for (k = 0; k < fg->nb_outputs; k++) {
+ AVFilterInOut *out = fg->outputs[k]->out_tmp;
+ if (out && !strcmp(out->name, map->linklabel)) {
+ ofilter = fg->outputs[k];
+ goto loop_end;
+ }
+ }
+ }
+loop_end:
+ if (!ofilter) {
+ av_log(NULL, AV_LOG_FATAL, "Output with label '%s' does not exist "
+ "in any defined filter graph.\n", map->linklabel);
+ exit(1);
+ }
+ init_output_filter(ofilter, o, oc);
+ } else {
+ ist = input_streams[input_files[map->file_index]->ist_index + map->stream_index];
+ switch (ist->st->codec->codec_type) {
+ case AVMEDIA_TYPE_VIDEO: ost = new_video_stream(o, oc); break;
+ case AVMEDIA_TYPE_AUDIO: ost = new_audio_stream(o, oc); break;
+ case AVMEDIA_TYPE_SUBTITLE: ost = new_subtitle_stream(o, oc); break;
+ case AVMEDIA_TYPE_DATA: ost = new_data_stream(o, oc); break;
+ case AVMEDIA_TYPE_ATTACHMENT: ost = new_attachment_stream(o, oc); break;
+ default:
+ av_log(NULL, AV_LOG_FATAL, "Cannot map stream #%d:%d - unsupported type.\n",
+ map->file_index, map->stream_index);
+ exit(1);
+ }
+
+ ost->source_index = input_files[map->file_index]->ist_index + map->stream_index;
+ ost->sync_ist = input_streams[input_files[map->sync_file_index]->ist_index +
+ map->sync_stream_index];
+ ist->discard = 0;
+ ist->st->discard = AVDISCARD_NONE;
+ }
+ }
+ }
+
+ /* handle attached files */
+ for (i = 0; i < o->nb_attachments; i++) {
+ AVIOContext *pb;
+ uint8_t *attachment;
+ const char *p;
+ int64_t len;
+
+ if ((err = avio_open2(&pb, o->attachments[i], AVIO_FLAG_READ, &int_cb, NULL)) < 0) {
+ av_log(NULL, AV_LOG_FATAL, "Could not open attachment file %s.\n",
+ o->attachments[i]);
+ exit(1);
+ }
+ if ((len = avio_size(pb)) <= 0) {
+ av_log(NULL, AV_LOG_FATAL, "Could not get size of the attachment %s.\n",
+ o->attachments[i]);
+ exit(1);
+ }
+ if (!(attachment = av_malloc(len))) {
+ av_log(NULL, AV_LOG_FATAL, "Attachment %s too large to fit into memory.\n",
+ o->attachments[i]);
+ exit(1);
+ }
+ avio_read(pb, attachment, len);
+
+ ost = new_attachment_stream(o, oc);
+ ost->stream_copy = 0;
+ ost->source_index = -1;
+ ost->attachment_filename = o->attachments[i];
+ ost->st->codec->extradata = attachment;
+ ost->st->codec->extradata_size = len;
+
+ p = strrchr(o->attachments[i], '/');
+ av_dict_set(&ost->st->metadata, "filename", (p && *p) ? p + 1 : o->attachments[i], AV_DICT_DONT_OVERWRITE);
+ avio_close(pb);
+ }
+
+ GROW_ARRAY(output_files, nb_output_files);
+ if (!(output_files[nb_output_files - 1] = av_mallocz(sizeof(*output_files[0]))))
+ exit(1);
+
+ output_files[nb_output_files - 1]->ctx = oc;
+ output_files[nb_output_files - 1]->ost_index = nb_output_streams - oc->nb_streams;
+ output_files[nb_output_files - 1]->recording_time = o->recording_time;
+ if (o->recording_time != INT64_MAX)
+ oc->duration = o->recording_time;
+ output_files[nb_output_files - 1]->start_time = o->start_time;
+ output_files[nb_output_files - 1]->limit_filesize = o->limit_filesize;
+ output_files[nb_output_files - 1]->shortest = o->shortest;
+ av_dict_copy(&output_files[nb_output_files - 1]->opts, o->g->format_opts, 0);
+
+ /* check filename in case of an image number is expected */
+ if (oc->oformat->flags & AVFMT_NEEDNUMBER) {
+ if (!av_filename_number_test(oc->filename)) {
+ print_error(oc->filename, AVERROR(EINVAL));
+ exit(1);
+ }
+ }
+
+ if (!(oc->oformat->flags & AVFMT_NOFILE)) {
+ /* test if it already exists to avoid losing precious files */
+ assert_file_overwrite(filename);
+
+ /* open the file */
+ if ((err = avio_open2(&oc->pb, filename, AVIO_FLAG_WRITE,
+ &oc->interrupt_callback,
+ &output_files[nb_output_files - 1]->opts)) < 0) {
+ print_error(filename, err);
+ exit(1);
+ }
+ }
+
+ if (o->mux_preload) {
+ uint8_t buf[64];
+ snprintf(buf, sizeof(buf), "%d", (int)(o->mux_preload*AV_TIME_BASE));
+ av_dict_set(&output_files[nb_output_files - 1]->opts, "preload", buf, 0);
+ }
+ oc->max_delay = (int)(o->mux_max_delay * AV_TIME_BASE);
+ oc->flags |= AVFMT_FLAG_NONBLOCK;
+
+ /* copy metadata */
+ for (i = 0; i < o->nb_metadata_map; i++) {
+ char *p;
+ int in_file_index = strtol(o->metadata_map[i].u.str, &p, 0);
+
+ if (in_file_index >= nb_input_files) {
+ av_log(NULL, AV_LOG_FATAL, "Invalid input file index %d while processing metadata maps\n", in_file_index);
+ exit(1);
+ }
+ copy_metadata(o->metadata_map[i].specifier, *p ? p + 1 : p, oc,
+ in_file_index >= 0 ?
+ input_files[in_file_index]->ctx : NULL, o);
+ }
+
+ /* copy chapters */
+ if (o->chapters_input_file >= nb_input_files) {
+ if (o->chapters_input_file == INT_MAX) {
+ /* copy chapters from the first input file that has them*/
+ o->chapters_input_file = -1;
+ for (i = 0; i < nb_input_files; i++)
+ if (input_files[i]->ctx->nb_chapters) {
+ o->chapters_input_file = i;
+ break;
+ }
+ } else {
+ av_log(NULL, AV_LOG_FATAL, "Invalid input file index %d in chapter mapping.\n",
+ o->chapters_input_file);
+ exit(1);
+ }
+ }
+ if (o->chapters_input_file >= 0)
+ copy_chapters(input_files[o->chapters_input_file], output_files[nb_output_files - 1],
+ !o->metadata_chapters_manual);
+
+ /* copy global metadata by default */
+ if (!o->metadata_global_manual && nb_input_files)
+ av_dict_copy(&oc->metadata, input_files[0]->ctx->metadata,
+ AV_DICT_DONT_OVERWRITE);
+ if (!o->metadata_streams_manual)
+ for (i = output_files[nb_output_files - 1]->ost_index; i < nb_output_streams; i++) {
+ InputStream *ist;
+ if (output_streams[i]->source_index < 0) /* this is true e.g. for attached files */
+ continue;
+ ist = input_streams[output_streams[i]->source_index];
+ av_dict_copy(&output_streams[i]->st->metadata, ist->st->metadata, AV_DICT_DONT_OVERWRITE);
+ }
+
+ /* process manually set metadata */
+ for (i = 0; i < o->nb_metadata; i++) {
+ AVDictionary **m;
+ char type, *val;
+ const char *stream_spec;
+ int index = 0, j, ret;
+
+ val = strchr(o->metadata[i].u.str, '=');
+ if (!val) {
+ av_log(NULL, AV_LOG_FATAL, "No '=' character in metadata string %s.\n",
+ o->metadata[i].u.str);
+ exit(1);
+ }
+ *val++ = 0;
+
+ parse_meta_type(o->metadata[i].specifier, &type, &index, &stream_spec);
+ if (type == 's') {
+ for (j = 0; j < oc->nb_streams; j++) {
+ if ((ret = check_stream_specifier(oc, oc->streams[j], stream_spec)) > 0) {
+ av_dict_set(&oc->streams[j]->metadata, o->metadata[i].u.str, *val ? val : NULL, 0);
+ } else if (ret < 0)
+ exit(1);
+ }
+ }
+ else {
+ switch (type) {
+ case 'g':
+ m = &oc->metadata;
+ break;
+ case 'c':
+ if (index < 0 || index >= oc->nb_chapters) {
+ av_log(NULL, AV_LOG_FATAL, "Invalid chapter index %d in metadata specifier.\n", index);
+ exit(1);
+ }
+ m = &oc->chapters[index]->metadata;
+ break;
+ default:
+ av_log(NULL, AV_LOG_FATAL, "Invalid metadata specifier %s.\n", o->metadata[i].specifier);
+ exit(1);
+ }
+ av_dict_set(m, o->metadata[i].u.str, *val ? val : NULL, 0);
+ }
+ }
+
+ return 0;
+}
+
+static int opt_target(void *optctx, const char *opt, const char *arg)
+{
+ OptionsContext *o = optctx;
+ enum { PAL, NTSC, FILM, UNKNOWN } norm = UNKNOWN;
+ static const char *const frame_rates[] = { "25", "30000/1001", "24000/1001" };
+
+ if (!strncmp(arg, "pal-", 4)) {
+ norm = PAL;
+ arg += 4;
+ } else if (!strncmp(arg, "ntsc-", 5)) {
+ norm = NTSC;
+ arg += 5;
+ } else if (!strncmp(arg, "film-", 5)) {
+ norm = FILM;
+ arg += 5;
+ } else {
+ /* Try to determine PAL/NTSC by peeking in the input files */
+ if (nb_input_files) {
+ int i, j, fr;
+ for (j = 0; j < nb_input_files; j++) {
+ for (i = 0; i < input_files[j]->nb_streams; i++) {
+ AVCodecContext *c = input_files[j]->ctx->streams[i]->codec;
+ if (c->codec_type != AVMEDIA_TYPE_VIDEO)
+ continue;
+ fr = c->time_base.den * 1000 / c->time_base.num;
+ if (fr == 25000) {
+ norm = PAL;
+ break;
+ } else if ((fr == 29970) || (fr == 23976)) {
+ norm = NTSC;
+ break;
+ }
+ }
+ if (norm != UNKNOWN)
+ break;
+ }
+ }
+ if (norm != UNKNOWN)
+ av_log(NULL, AV_LOG_INFO, "Assuming %s for target.\n", norm == PAL ? "PAL" : "NTSC");
+ }
+
+ if (norm == UNKNOWN) {
+ av_log(NULL, AV_LOG_FATAL, "Could not determine norm (PAL/NTSC/NTSC-Film) for target.\n");
+ av_log(NULL, AV_LOG_FATAL, "Please prefix target with \"pal-\", \"ntsc-\" or \"film-\",\n");
+ av_log(NULL, AV_LOG_FATAL, "or set a framerate with \"-r xxx\".\n");
+ exit(1);
+ }
+
+ if (!strcmp(arg, "vcd")) {
+ opt_video_codec(o, "c:v", "mpeg1video");
+ opt_audio_codec(o, "c:a", "mp2");
+ parse_option(o, "f", "vcd", options);
+
+ parse_option(o, "s", norm == PAL ? "352x288" : "352x240", options);
+ parse_option(o, "r", frame_rates[norm], options);
+ opt_default(NULL, "g", norm == PAL ? "15" : "18");
+
+ opt_default(NULL, "b", "1150000");
+ opt_default(NULL, "maxrate", "1150000");
+ opt_default(NULL, "minrate", "1150000");
+ opt_default(NULL, "bufsize", "327680"); // 40*1024*8;
+
+ opt_default(NULL, "b:a", "224000");
+ parse_option(o, "ar", "44100", options);
+ parse_option(o, "ac", "2", options);
+
+ opt_default(NULL, "packetsize", "2324");
+ opt_default(NULL, "muxrate", "1411200"); // 2352 * 75 * 8;
+
+ /* We have to offset the PTS, so that it is consistent with the SCR.
+ SCR starts at 36000, but the first two packs contain only padding
+ and the first pack from the other stream, respectively, may also have
+ been written before.
+ So the real data starts at SCR 36000+3*1200. */
+ o->mux_preload = (36000 + 3 * 1200) / 90000.0; // 0.44
+ } else if (!strcmp(arg, "svcd")) {
+
+ opt_video_codec(o, "c:v", "mpeg2video");
+ opt_audio_codec(o, "c:a", "mp2");
+ parse_option(o, "f", "svcd", options);
+
+ parse_option(o, "s", norm == PAL ? "480x576" : "480x480", options);
+ parse_option(o, "r", frame_rates[norm], options);
+ opt_default(NULL, "g", norm == PAL ? "15" : "18");
+
+ opt_default(NULL, "b", "2040000");
+ opt_default(NULL, "maxrate", "2516000");
+ opt_default(NULL, "minrate", "0"); // 1145000;
+ opt_default(NULL, "bufsize", "1835008"); // 224*1024*8;
+ opt_default(NULL, "flags", "+scan_offset");
+
+
+ opt_default(NULL, "b:a", "224000");
+ parse_option(o, "ar", "44100", options);
+
+ opt_default(NULL, "packetsize", "2324");
+
+ } else if (!strcmp(arg, "dvd")) {
+
+ opt_video_codec(o, "c:v", "mpeg2video");
+ opt_audio_codec(o, "c:a", "ac3");
+ parse_option(o, "f", "dvd", options);
+
+ parse_option(o, "s", norm == PAL ? "720x576" : "720x480", options);
+ parse_option(o, "r", frame_rates[norm], options);
+ opt_default(NULL, "g", norm == PAL ? "15" : "18");
+
+ opt_default(NULL, "b", "6000000");
+ opt_default(NULL, "maxrate", "9000000");
+ opt_default(NULL, "minrate", "0"); // 1500000;
+ opt_default(NULL, "bufsize", "1835008"); // 224*1024*8;
+
+ opt_default(NULL, "packetsize", "2048"); // from www.mpucoder.com: DVD sectors contain 2048 bytes of data, this is also the size of one pack.
+ opt_default(NULL, "muxrate", "10080000"); // from mplex project: data_rate = 1260000. mux_rate = data_rate * 8
+
+ opt_default(NULL, "b:a", "448000");
+ parse_option(o, "ar", "48000", options);
+
+ } else if (!strncmp(arg, "dv", 2)) {
+
+ parse_option(o, "f", "dv", options);
+
+ parse_option(o, "s", norm == PAL ? "720x576" : "720x480", options);
+ parse_option(o, "pix_fmt", !strncmp(arg, "dv50", 4) ? "yuv422p" :
+ norm == PAL ? "yuv420p" : "yuv411p", options);
+ parse_option(o, "r", frame_rates[norm], options);
+
+ parse_option(o, "ar", "48000", options);
+ parse_option(o, "ac", "2", options);
+
+ } else {
+ av_log(NULL, AV_LOG_ERROR, "Unknown target: %s\n", arg);
+ return AVERROR(EINVAL);
+ }
+ return 0;
+}
+
+static int opt_vstats_file(void *optctx, const char *opt, const char *arg)
+{
+ av_free (vstats_filename);
+ vstats_filename = av_strdup (arg);
+ return 0;
+}
+
+static int opt_vstats(void *optctx, const char *opt, const char *arg)
+{
+ char filename[40];
+ time_t today2 = time(NULL);
+ struct tm *today = localtime(&today2);
+
+ snprintf(filename, sizeof(filename), "vstats_%02d%02d%02d.log", today->tm_hour, today->tm_min,
+ today->tm_sec);
+ return opt_vstats_file(NULL, opt, filename);
+}
+
+static int opt_video_frames(void *optctx, const char *opt, const char *arg)
+{
+ OptionsContext *o = optctx;
+ return parse_option(o, "frames:v", arg, options);
+}
+
+static int opt_audio_frames(void *optctx, const char *opt, const char *arg)
+{
+ OptionsContext *o = optctx;
+ return parse_option(o, "frames:a", arg, options);
+}
+
+static int opt_data_frames(void *optctx, const char *opt, const char *arg)
+{
+ OptionsContext *o = optctx;
+ return parse_option(o, "frames:d", arg, options);
+}
+
+static int opt_video_tag(void *optctx, const char *opt, const char *arg)
+{
+ OptionsContext *o = optctx;
+ return parse_option(o, "tag:v", arg, options);
+}
+
+static int opt_audio_tag(void *optctx, const char *opt, const char *arg)
+{
+ OptionsContext *o = optctx;
+ return parse_option(o, "tag:a", arg, options);
+}
+
+static int opt_subtitle_tag(void *optctx, const char *opt, const char *arg)
+{
+ OptionsContext *o = optctx;
+ return parse_option(o, "tag:s", arg, options);
+}
+
+static int opt_video_filters(void *optctx, const char *opt, const char *arg)
+{
+ OptionsContext *o = optctx;
+ return parse_option(o, "filter:v", arg, options);
+}
+
+static int opt_audio_filters(void *optctx, const char *opt, const char *arg)
+{
+ OptionsContext *o = optctx;
+ return parse_option(o, "filter:a", arg, options);
+}
+
+static int opt_vsync(void *optctx, const char *opt, const char *arg)
+{
+ if (!av_strcasecmp(arg, "cfr")) video_sync_method = VSYNC_CFR;
+ else if (!av_strcasecmp(arg, "vfr")) video_sync_method = VSYNC_VFR;
+ else if (!av_strcasecmp(arg, "passthrough")) video_sync_method = VSYNC_PASSTHROUGH;
+
+ if (video_sync_method == VSYNC_AUTO)
+ video_sync_method = parse_number_or_die("vsync", arg, OPT_INT, VSYNC_AUTO, VSYNC_VFR);
+ return 0;
+}
+
+static int opt_deinterlace(void *optctx, const char *opt, const char *arg)
+{
+ av_log(NULL, AV_LOG_WARNING, "-%s is deprecated, use -filter:v yadif instead\n", opt);
+ do_deinterlace = 1;
+ return 0;
+}
+
+int opt_cpuflags(void *optctx, const char *opt, const char *arg)
+{
+ int flags = av_parse_cpu_flags(arg);
+
+ if (flags < 0)
+ return flags;
+
+ av_set_cpu_flags_mask(flags);
+ return 0;
+}
+
+static int opt_channel_layout(void *optctx, const char *opt, const char *arg)
+{
+ OptionsContext *o = optctx;
+ char layout_str[32];
+ char *stream_str;
+ char *ac_str;
+ int ret, channels, ac_str_size;
+ uint64_t layout;
+
+ layout = av_get_channel_layout(arg);
+ if (!layout) {
+ av_log(NULL, AV_LOG_ERROR, "Unknown channel layout: %s\n", arg);
+ return AVERROR(EINVAL);
+ }
+ snprintf(layout_str, sizeof(layout_str), "%"PRIu64, layout);
+ ret = opt_default(NULL, opt, layout_str);
+ if (ret < 0)
+ return ret;
+
+ /* set 'ac' option based on channel layout */
+ channels = av_get_channel_layout_nb_channels(layout);
+ snprintf(layout_str, sizeof(layout_str), "%d", channels);
+ stream_str = strchr(opt, ':');
+ ac_str_size = 3 + (stream_str ? strlen(stream_str) : 0);
+ ac_str = av_mallocz(ac_str_size);
+ if (!ac_str)
+ return AVERROR(ENOMEM);
+ av_strlcpy(ac_str, "ac", 3);
+ if (stream_str)
+ av_strlcat(ac_str, stream_str, ac_str_size);
+ ret = parse_option(o, ac_str, layout_str, options);
+ av_free(ac_str);
+
+ return ret;
+}
+
+static int opt_audio_qscale(void *optctx, const char *opt, const char *arg)
+{
+ OptionsContext *o = optctx;
+ return parse_option(o, "q:a", arg, options);
+}
+
+static int opt_filter_complex(void *optctx, const char *opt, const char *arg)
+{
+ GROW_ARRAY(filtergraphs, nb_filtergraphs);
+ if (!(filtergraphs[nb_filtergraphs - 1] = av_mallocz(sizeof(*filtergraphs[0]))))
+ return AVERROR(ENOMEM);
+ filtergraphs[nb_filtergraphs - 1]->index = nb_filtergraphs - 1;
+ filtergraphs[nb_filtergraphs - 1]->graph_desc = arg;
+ return 0;
+}
+
+void show_help_default(const char *opt, const char *arg)
+{
+ /* per-file options have at least one of those set */
+ const int per_file = OPT_SPEC | OPT_OFFSET | OPT_PERFILE;
+ int show_advanced = 0, show_avoptions = 0;
+
+ if (opt && *opt) {
+ if (!strcmp(opt, "long"))
+ show_advanced = 1;
+ else if (!strcmp(opt, "full"))
+ show_advanced = show_avoptions = 1;
+ else
+ av_log(NULL, AV_LOG_ERROR, "Unknown help option '%s'.\n", opt);
+ }
+
+ show_usage();
+
+ printf("Getting help:\n"
+ " -h -- print basic options\n"
+ " -h long -- print more options\n"
+ " -h full -- print all options (including all format and codec specific options, very long)\n"
+ " See man %s for detailed description of the options.\n"
+ "\n", program_name);
+
+ show_help_options(options, "Print help / information / capabilities:",
+ OPT_EXIT, 0, 0);
+
+ show_help_options(options, "Global options (affect whole program "
+ "instead of just one file:",
+ 0, per_file | OPT_EXIT | OPT_EXPERT, 0);
+ if (show_advanced)
+ show_help_options(options, "Advanced global options:", OPT_EXPERT,
+ per_file | OPT_EXIT, 0);
+
+ show_help_options(options, "Per-file main options:", 0,
+ OPT_EXPERT | OPT_AUDIO | OPT_VIDEO | OPT_SUBTITLE |
+ OPT_EXIT, per_file);
+ if (show_advanced)
+ show_help_options(options, "Advanced per-file options:",
+ OPT_EXPERT, OPT_AUDIO | OPT_VIDEO | OPT_SUBTITLE, per_file);
+
+ show_help_options(options, "Video options:",
+ OPT_VIDEO, OPT_EXPERT | OPT_AUDIO, 0);
+ if (show_advanced)
+ show_help_options(options, "Advanced Video options:",
+ OPT_EXPERT | OPT_VIDEO, OPT_AUDIO, 0);
+
+ show_help_options(options, "Audio options:",
+ OPT_AUDIO, OPT_EXPERT | OPT_VIDEO, 0);
+ if (show_advanced)
+ show_help_options(options, "Advanced Audio options:",
+ OPT_EXPERT | OPT_AUDIO, OPT_VIDEO, 0);
+ show_help_options(options, "Subtitle options:",
+ OPT_SUBTITLE, 0, 0);
+ printf("\n");
+
+ if (show_avoptions) {
+ int flags = AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_ENCODING_PARAM;
+ show_help_children(avcodec_get_class(), flags);
+ show_help_children(avformat_get_class(), flags);
+ show_help_children(sws_get_class(), flags);
+ }
+}
+
+void show_usage(void)
+{
+ printf("Hyper fast Audio and Video encoder\n");
+ printf("usage: %s [options] [[infile options] -i infile]... {[outfile options] outfile}...\n", program_name);
+ printf("\n");
+}
+
+enum OptGroup {
+ GROUP_OUTFILE,
+ GROUP_INFILE,
+};
+
+static const OptionGroupDef groups[] = {
+ [GROUP_OUTFILE] = { "output file", NULL },
+ [GROUP_INFILE] = { "input file", "i" },
+};
+
+static int open_files(OptionGroupList *l, const char *inout,
+ int (*open_file)(OptionsContext*, const char*))
+{
+ int i, ret;
+
+ for (i = 0; i < l->nb_groups; i++) {
+ OptionGroup *g = &l->groups[i];
+ OptionsContext o;
+
+ init_options(&o);
+ o.g = g;
+
+ ret = parse_optgroup(&o, g);
+ if (ret < 0) {
+ av_log(NULL, AV_LOG_ERROR, "Error parsing options for %s file "
+ "%s.\n", inout, g->arg);
+ return ret;
+ }
+
+ av_log(NULL, AV_LOG_DEBUG, "Opening an %s file: %s.\n", inout, g->arg);
+ ret = open_file(&o, g->arg);
+ uninit_options(&o);
+ if (ret < 0) {
+ av_log(NULL, AV_LOG_ERROR, "Error opening %s file %s.\n",
+ inout, g->arg);
+ return ret;
+ }
+ av_log(NULL, AV_LOG_DEBUG, "Successfully openened the file.\n");
+ }
+
+ return 0;
+}
+
+int avconv_parse_options(int argc, char **argv)
+{
+ OptionParseContext octx;
+ uint8_t error[128];
+ int ret;
+
+ memset(&octx, 0, sizeof(octx));
+
+ /* split the commandline into an internal representation */
+ ret = split_commandline(&octx, argc, argv, options, groups,
+ FF_ARRAY_ELEMS(groups));
+ if (ret < 0) {
+ av_log(NULL, AV_LOG_FATAL, "Error splitting the argument list: ");
+ goto fail;
+ }
+
+ /* apply global options */
+ ret = parse_optgroup(NULL, &octx.global_opts);
+ if (ret < 0) {
+ av_log(NULL, AV_LOG_FATAL, "Error parsing global options: ");
+ goto fail;
+ }
+
+ /* open input files */
+ ret = open_files(&octx.groups[GROUP_INFILE], "input", open_input_file);
+ if (ret < 0) {
+ av_log(NULL, AV_LOG_FATAL, "Error opening input files: ");
+ goto fail;
+ }
+
+ /* open output files */
+ ret = open_files(&octx.groups[GROUP_OUTFILE], "output", open_output_file);
+ if (ret < 0) {
+ av_log(NULL, AV_LOG_FATAL, "Error opening output files: ");
+ goto fail;
+ }
+
+fail:
+ uninit_parse_context(&octx);
+ if (ret < 0) {
+ av_strerror(ret, error, sizeof(error));
+ av_log(NULL, AV_LOG_FATAL, "%s\n", error);
+ }
+ return ret;
+}
+
+#define OFFSET(x) offsetof(OptionsContext, x)
+const OptionDef options[] = {
+ /* main options */
+#include "cmdutils_common_opts.h"
+ { "f", HAS_ARG | OPT_STRING | OPT_OFFSET, { .off = OFFSET(format) },
+ "force format", "fmt" },
+ { "y", OPT_BOOL, { &file_overwrite },
+ "overwrite output files" },
+ { "c", HAS_ARG | OPT_STRING | OPT_SPEC, { .off = OFFSET(codec_names) },
+ "codec name", "codec" },
+ { "codec", HAS_ARG | OPT_STRING | OPT_SPEC, { .off = OFFSET(codec_names) },
+ "codec name", "codec" },
+ { "pre", HAS_ARG | OPT_STRING | OPT_SPEC, { .off = OFFSET(presets) },
+ "preset name", "preset" },
+ { "map", HAS_ARG | OPT_EXPERT | OPT_PERFILE, { .func_arg = opt_map },
+ "set input stream mapping",
+ "[-]input_file_id[:stream_specifier][,sync_file_id[:stream_specifier]]" },
+ { "map_metadata", HAS_ARG | OPT_STRING | OPT_SPEC, { .off = OFFSET(metadata_map) },
+ "set metadata information of outfile from infile",
+ "outfile[,metadata]:infile[,metadata]" },
+ { "map_chapters", HAS_ARG | OPT_INT | OPT_EXPERT | OPT_OFFSET, { .off = OFFSET(chapters_input_file) },
+ "set chapters mapping", "input_file_index" },
+ { "t", HAS_ARG | OPT_TIME | OPT_OFFSET, { .off = OFFSET(recording_time) },
+ "record or transcode \"duration\" seconds of audio/video",
+ "duration" },
+ { "fs", HAS_ARG | OPT_INT64 | OPT_OFFSET, { .off = OFFSET(limit_filesize) },
+ "set the limit file size in bytes", "limit_size" },
+ { "ss", HAS_ARG | OPT_TIME | OPT_OFFSET, { .off = OFFSET(start_time) },
+ "set the start time offset", "time_off" },
+ { "itsoffset", HAS_ARG | OPT_TIME | OPT_OFFSET | OPT_EXPERT,{ .off = OFFSET(input_ts_offset) },
+ "set the input ts offset", "time_off" },
+ { "itsscale", HAS_ARG | OPT_DOUBLE | OPT_SPEC | OPT_EXPERT,{ .off = OFFSET(ts_scale) },
+ "set the input ts scale", "scale" },
+ { "metadata", HAS_ARG | OPT_STRING | OPT_SPEC, { .off = OFFSET(metadata) },
+ "add metadata", "string=string" },
+ { "dframes", HAS_ARG | OPT_PERFILE | OPT_EXPERT, { .func_arg = opt_data_frames },
+ "set the number of data frames to record", "number" },
+ { "benchmark", OPT_BOOL | OPT_EXPERT, { &do_benchmark },
+ "add timings for benchmarking" },
+ { "timelimit", HAS_ARG | OPT_EXPERT, { .func_arg = opt_timelimit },
+ "set max runtime in seconds", "limit" },
+ { "dump", OPT_BOOL | OPT_EXPERT, { &do_pkt_dump },
+ "dump each input packet" },
+ { "hex", OPT_BOOL | OPT_EXPERT, { &do_hex_dump },
+ "when dumping packets, also dump the payload" },
+ { "re", OPT_BOOL | OPT_EXPERT | OPT_OFFSET, { .off = OFFSET(rate_emu) },
+ "read input at native frame rate", "" },
+ { "target", HAS_ARG | OPT_PERFILE, { .func_arg = opt_target },
+ "specify target file type (\"vcd\", \"svcd\", \"dvd\","
+ " \"dv\", \"dv50\", \"pal-vcd\", \"ntsc-svcd\", ...)", "type" },
+ { "vsync", HAS_ARG | OPT_EXPERT, { opt_vsync },
+ "video sync method", "" },
+ { "async", HAS_ARG | OPT_INT | OPT_EXPERT, { &audio_sync_method },
+ "audio sync method", "" },
+ { "adrift_threshold", HAS_ARG | OPT_FLOAT | OPT_EXPERT, { &audio_drift_threshold },
+ "audio drift threshold", "threshold" },
+ { "copyts", OPT_BOOL | OPT_EXPERT, { &copy_ts },
+ "copy timestamps" },
+ { "copytb", OPT_BOOL | OPT_EXPERT, { &copy_tb },
+ "copy input stream time base when stream copying" },
+ { "shortest", OPT_BOOL | OPT_EXPERT | OPT_OFFSET, { .off = OFFSET(shortest) },
+ "finish encoding within shortest input" },
+ { "dts_delta_threshold", HAS_ARG | OPT_FLOAT | OPT_EXPERT, { &dts_delta_threshold },
+ "timestamp discontinuity delta threshold", "threshold" },
+ { "xerror", OPT_BOOL | OPT_EXPERT, { &exit_on_error },
+ "exit on error", "error" },
+ { "copyinkf", OPT_BOOL | OPT_EXPERT | OPT_SPEC, { .off = OFFSET(copy_initial_nonkeyframes) },
+ "copy initial non-keyframes" },
+ { "frames", OPT_INT64 | HAS_ARG | OPT_SPEC, { .off = OFFSET(max_frames) },
+ "set the number of frames to record", "number" },
+ { "tag", OPT_STRING | HAS_ARG | OPT_SPEC | OPT_EXPERT,{ .off = OFFSET(codec_tags) },
+ "force codec tag/fourcc", "fourcc/tag" },
+ { "q", HAS_ARG | OPT_EXPERT | OPT_DOUBLE | OPT_SPEC,{ .off = OFFSET(qscale) },
+ "use fixed quality scale (VBR)", "q" },
+ { "qscale", HAS_ARG | OPT_EXPERT | OPT_DOUBLE | OPT_SPEC,{ .off = OFFSET(qscale) },
+ "use fixed quality scale (VBR)", "q" },
+ { "filter", HAS_ARG | OPT_STRING | OPT_SPEC, { .off = OFFSET(filters) },
+ "set stream filterchain", "filter_list" },
+ { "filter_complex", HAS_ARG | OPT_EXPERT, { .func_arg = opt_filter_complex },
+ "create a complex filtergraph", "graph_description" },
+ { "stats", OPT_BOOL, { &print_stats },
+ "print progress report during encoding", },
+ { "attach", HAS_ARG | OPT_PERFILE | OPT_EXPERT, { .func_arg = opt_attach },
+ "add an attachment to the output file", "filename" },
+ { "dump_attachment", HAS_ARG | OPT_STRING | OPT_SPEC |OPT_EXPERT,{ .off = OFFSET(dump_attachment) },
+ "extract an attachment into a file", "filename" },
+ { "cpuflags", HAS_ARG | OPT_EXPERT, { .func_arg = opt_cpuflags },
+ "set CPU flags mask", "mask" },
+
+ /* video options */
+ { "vframes", OPT_VIDEO | HAS_ARG | OPT_PERFILE, { .func_arg = opt_video_frames },
+ "set the number of video frames to record", "number" },
+ { "r", OPT_VIDEO | HAS_ARG | OPT_STRING | OPT_SPEC, { .off = OFFSET(frame_rates) },
+ "set frame rate (Hz value, fraction or abbreviation)", "rate" },
+ { "s", OPT_VIDEO | HAS_ARG | OPT_STRING | OPT_SPEC, { .off = OFFSET(frame_sizes) },
+ "set frame size (WxH or abbreviation)", "size" },
+ { "aspect", OPT_VIDEO | HAS_ARG | OPT_STRING | OPT_SPEC, { .off = OFFSET(frame_aspect_ratios) },
+ "set aspect ratio (4:3, 16:9 or 1.3333, 1.7777)", "aspect" },
+ { "pix_fmt", OPT_VIDEO | HAS_ARG | OPT_EXPERT | OPT_STRING | OPT_SPEC, { .off = OFFSET(frame_pix_fmts) },
+ "set pixel format", "format" },
+ { "vn", OPT_VIDEO | OPT_BOOL | OPT_OFFSET, { .off = OFFSET(video_disable) },
+ "disable video" },
+ { "vdt", OPT_VIDEO | OPT_INT | HAS_ARG | OPT_EXPERT , { &video_discard },
+ "discard threshold", "n" },
+ { "rc_override", OPT_VIDEO | HAS_ARG | OPT_EXPERT | OPT_STRING | OPT_SPEC, { .off = OFFSET(rc_overrides) },
+ "rate control override for specific intervals", "override" },
+ { "vcodec", OPT_VIDEO | HAS_ARG | OPT_PERFILE, { .func_arg = opt_video_codec },
+ "force video codec ('copy' to copy stream)", "codec" },
+ { "pass", OPT_VIDEO | HAS_ARG | OPT_SPEC | OPT_INT, { .off = OFFSET(pass) },
+ "select the pass number (1 or 2)", "n" },
+ { "passlogfile", OPT_VIDEO | HAS_ARG | OPT_STRING | OPT_EXPERT | OPT_SPEC, { .off = OFFSET(passlogfiles) },
+ "select two pass log file name prefix", "prefix" },
+ { "deinterlace", OPT_VIDEO | OPT_EXPERT , { .func_arg = opt_deinterlace },
+ "this option is deprecated, use the yadif filter instead" },
+ { "vstats", OPT_VIDEO | OPT_EXPERT , { &opt_vstats },
+ "dump video coding statistics to file" },
+ { "vstats_file", OPT_VIDEO | HAS_ARG | OPT_EXPERT , { opt_vstats_file },
+ "dump video coding statistics to file", "file" },
+ { "vf", OPT_VIDEO | HAS_ARG | OPT_PERFILE, { .func_arg = opt_video_filters },
+ "video filters", "filter list" },
+ { "intra_matrix", OPT_VIDEO | HAS_ARG | OPT_EXPERT | OPT_STRING | OPT_SPEC, { .off = OFFSET(intra_matrices) },
+ "specify intra matrix coeffs", "matrix" },
+ { "inter_matrix", OPT_VIDEO | HAS_ARG | OPT_EXPERT | OPT_STRING | OPT_SPEC, { .off = OFFSET(inter_matrices) },
+ "specify inter matrix coeffs", "matrix" },
+ { "top", OPT_VIDEO | HAS_ARG | OPT_EXPERT | OPT_INT| OPT_SPEC, { .off = OFFSET(top_field_first) },
+ "top=1/bottom=0/auto=-1 field first", "" },
+ { "dc", OPT_VIDEO | OPT_INT | HAS_ARG | OPT_EXPERT , { &intra_dc_precision },
+ "intra_dc_precision", "precision" },
+ { "vtag", OPT_VIDEO | HAS_ARG | OPT_EXPERT | OPT_PERFILE, { .func_arg = opt_video_tag },
+ "force video tag/fourcc", "fourcc/tag" },
+ { "qphist", OPT_VIDEO | OPT_BOOL | OPT_EXPERT , { &qp_hist },
+ "show QP histogram" },
+ { "force_fps", OPT_VIDEO | OPT_BOOL | OPT_EXPERT | OPT_SPEC, { .off = OFFSET(force_fps) },
+ "force the selected framerate, disable the best supported framerate selection" },
+ { "streamid", OPT_VIDEO | HAS_ARG | OPT_EXPERT | OPT_PERFILE, { .func_arg = opt_streamid },
+ "set the value of an outfile streamid", "streamIndex:value" },
+ { "force_key_frames", OPT_VIDEO | OPT_STRING | HAS_ARG | OPT_EXPERT | OPT_SPEC,
+ { .off = OFFSET(forced_key_frames) }, "force key frames at specified timestamps", "timestamps" },
+
+ /* audio options */
+ { "aframes", OPT_AUDIO | HAS_ARG | OPT_PERFILE, { .func_arg = opt_audio_frames },
+ "set the number of audio frames to record", "number" },
+ { "aq", OPT_AUDIO | HAS_ARG | OPT_PERFILE, { .func_arg = opt_audio_qscale },
+ "set audio quality (codec-specific)", "quality", },
+ { "ar", OPT_AUDIO | HAS_ARG | OPT_INT | OPT_SPEC, { .off = OFFSET(audio_sample_rate) },
+ "set audio sampling rate (in Hz)", "rate" },
+ { "ac", OPT_AUDIO | HAS_ARG | OPT_INT | OPT_SPEC, { .off = OFFSET(audio_channels) },
+ "set number of audio channels", "channels" },
+ { "an", OPT_AUDIO | OPT_BOOL | OPT_OFFSET, { .off = OFFSET(audio_disable) },
+ "disable audio" },
+ { "acodec", OPT_AUDIO | HAS_ARG | OPT_PERFILE, { .func_arg = opt_audio_codec },
+ "force audio codec ('copy' to copy stream)", "codec" },
+ { "atag", OPT_AUDIO | HAS_ARG | OPT_EXPERT | OPT_PERFILE, { .func_arg = opt_audio_tag },
+ "force audio tag/fourcc", "fourcc/tag" },
+ { "vol", OPT_AUDIO | HAS_ARG | OPT_INT, { &audio_volume },
+ "change audio volume (256=normal)" , "volume" },
+ { "sample_fmt", OPT_AUDIO | HAS_ARG | OPT_EXPERT | OPT_SPEC | OPT_STRING, { .off = OFFSET(sample_fmts) },
+ "set sample format", "format" },
+ { "channel_layout", OPT_AUDIO | HAS_ARG | OPT_EXPERT | OPT_PERFILE, { .func_arg = opt_channel_layout },
+ "set channel layout", "layout" },
+ { "af", OPT_AUDIO | HAS_ARG | OPT_PERFILE, { .func_arg = opt_audio_filters },
+ "audio filters", "filter list" },
+
+ /* subtitle options */
+ { "sn", OPT_SUBTITLE | OPT_BOOL | OPT_OFFSET, { .off = OFFSET(subtitle_disable) },
+ "disable subtitle" },
+ { "scodec", OPT_SUBTITLE | HAS_ARG | OPT_PERFILE, { .func_arg = opt_subtitle_codec },
+ "force subtitle codec ('copy' to copy stream)", "codec" },
+ { "stag", OPT_SUBTITLE | HAS_ARG | OPT_EXPERT | OPT_PERFILE, { .func_arg = opt_subtitle_tag }
+ , "force subtitle tag/fourcc", "fourcc/tag" },
+
+ /* grab options */
+ { "isync", OPT_BOOL | OPT_EXPERT, { &input_sync }, "this option is deprecated and does nothing", "" },
+
+ /* muxer options */
+ { "muxdelay", OPT_FLOAT | HAS_ARG | OPT_EXPERT | OPT_OFFSET, { .off = OFFSET(mux_max_delay) },
+ "set the maximum demux-decode delay", "seconds" },
+ { "muxpreload", OPT_FLOAT | HAS_ARG | OPT_EXPERT | OPT_OFFSET, { .off = OFFSET(mux_preload) },
+ "set the initial demux-decode delay", "seconds" },
+
+ { "bsf", HAS_ARG | OPT_STRING | OPT_SPEC | OPT_EXPERT, { .off = OFFSET(bitstream_filters) },
+ "A comma-separated list of bitstream filters", "bitstream_filters" },
+
+ /* data codec support */
+ { "dcodec", HAS_ARG | OPT_DATA | OPT_PERFILE | OPT_EXPERT, { .func_arg = opt_data_codec },
+ "force data codec ('copy' to copy stream)", "codec" },
+
+ { NULL, },
+};
diff --git a/gst-libs/ext/libav/avplay.c b/gst-libs/ext/libav/avplay.c
index 57fb864..3e2110f 100644
--- a/gst-libs/ext/libav/avplay.c
+++ b/gst-libs/ext/libav/avplay.c
@@ -31,16 +31,19 @@
#include "libavutil/dict.h"
#include "libavutil/parseutils.h"
#include "libavutil/samplefmt.h"
+#include "libavutil/time.h"
#include "libavformat/avformat.h"
#include "libavdevice/avdevice.h"
#include "libswscale/swscale.h"
-#include "libavcodec/audioconvert.h"
+#include "libavresample/avresample.h"
#include "libavutil/opt.h"
#include "libavcodec/avfft.h"
#if CONFIG_AVFILTER
# include "libavfilter/avfilter.h"
# include "libavfilter/avfiltergraph.h"
+# include "libavfilter/buffersink.h"
+# include "libavfilter/buffersrc.h"
#endif
#include "cmdutils.h"
@@ -52,7 +55,6 @@
#undef main /* We don't want SDL to override our main() */
#endif
-#include <unistd.h>
#include <assert.h>
const char program_name[] = "avplay";
@@ -82,7 +84,7 @@ const int program_birth_year = 2003;
/* NOTE: the size must be big enough to compensate the hardware audio buffersize size */
#define SAMPLE_ARRAY_SIZE (2 * 65536)
-static int sws_flags = SWS_BICUBIC;
+static int64_t sws_flags = SWS_BICUBIC;
typedef struct PacketQueue {
AVPacketList *first_pkt, *last_pkt;
@@ -97,14 +99,14 @@ typedef struct PacketQueue {
#define SUBPICTURE_QUEUE_SIZE 4
typedef struct VideoPicture {
- double pts; ///< presentation time stamp for this picture
- double target_clock; ///< av_gettime() time at which this should be displayed ideally
- int64_t pos; ///< byte position in file
+ double pts; // presentation timestamp for this picture
+ double target_clock; // av_gettime() time at which this should be displayed ideally
+ int64_t pos; // byte position in file
SDL_Overlay *bmp;
int width, height; /* source height & width */
int allocated;
int reallocate;
- enum PixelFormat pix_fmt;
+ enum AVPixelFormat pix_fmt;
#if CONFIG_AVFILTER
AVFilterBufferRef *picref;
@@ -137,7 +139,6 @@ typedef struct VideoState {
int64_t seek_rel;
int read_pause_return;
AVFormatContext *ic;
- int dtg_active_format;
int audio_stream;
@@ -160,8 +161,14 @@ typedef struct VideoState {
int audio_buf_index; /* in bytes */
AVPacket audio_pkt_temp;
AVPacket audio_pkt;
- enum AVSampleFormat audio_src_fmt;
- AVAudioConvert *reformat_ctx;
+ enum AVSampleFormat sdl_sample_fmt;
+ uint64_t sdl_channel_layout;
+ int sdl_channels;
+ int sdl_sample_rate;
+ enum AVSampleFormat resample_sample_fmt;
+ uint64_t resample_channel_layout;
+ int resample_sample_rate;
+ AVAudioResampleContext *avr;
AVFrame *frame;
int show_audio; /* if true, display audio samples */
@@ -186,13 +193,13 @@ typedef struct VideoState {
double frame_timer;
double frame_last_pts;
double frame_last_delay;
- double video_clock; ///< pts of last decoded frame / predicted pts of next decoded frame
+ double video_clock; // pts of last decoded frame / predicted pts of next decoded frame
int video_stream;
AVStream *video_st;
PacketQueue videoq;
- double video_current_pts; ///< current displayed pts (different from video_clock if frame fifos are used)
- double video_current_pts_drift; ///< video_current_pts - time (av_gettime) at which we updated video_current_pts - used to have running video pts
- int64_t video_current_pos; ///< current displayed file pos
+ double video_current_pts; // current displayed pts (different from video_clock if frame fifos are used)
+ double video_current_pts_drift; // video_current_pts - time (av_gettime) at which we updated video_current_pts - used to have running video pts
+ int64_t video_current_pos; // current displayed file pos
VideoPicture pictq[VIDEO_PICTURE_QUEUE_SIZE];
int pictq_size, pictq_rindex, pictq_windex;
SDL_mutex *pictq_mutex;
@@ -208,7 +215,10 @@ typedef struct VideoState {
PtsCorrectionContext pts_ctx;
#if CONFIG_AVFILTER
- AVFilterContext *out_video_filter; ///< the last filter in the video chain
+ AVFilterContext *in_video_filter; // the first filter in the video chain
+ AVFilterContext *out_video_filter; // the last filter in the video chain
+ int use_dr1;
+ FrameBuffer *buffer_pool;
#endif
float skip_frames;
@@ -216,8 +226,6 @@ typedef struct VideoState {
int refresh;
} VideoState;
-static void show_help(void);
-
/* options specified by the user */
static AVInputFormat *file_iformat;
static const char *input_filename;
@@ -245,12 +253,10 @@ static int step = 0;
static int workaround_bugs = 1;
static int fast = 0;
static int genpts = 0;
-static int lowres = 0;
static int idct = FF_IDCT_AUTO;
static enum AVDiscard skip_frame = AVDISCARD_DEFAULT;
static enum AVDiscard skip_idct = AVDISCARD_DEFAULT;
static enum AVDiscard skip_loop_filter = AVDISCARD_DEFAULT;
-static int error_recognition = FF_ER_CAREFUL;
static int error_concealment = 3;
static int decoder_reorder_pts = -1;
static int autoexit;
@@ -258,6 +264,7 @@ static int exit_on_keydown;
static int exit_on_mousedown;
static int loop = 1;
static int framedrop = 1;
+static int infinite_buffer = 0;
static int rdftspeed = 20;
#if CONFIG_AVFILTER
@@ -277,11 +284,6 @@ static AVPacket flush_pkt;
static SDL_Surface *screen;
-void exit_program(int ret)
-{
- exit(ret);
-}
-
static int packet_queue_put(PacketQueue *q, AVPacket *pkt);
/* packet queue handling */
@@ -746,7 +748,7 @@ static void video_audio_display(VideoState *s)
nb_freq = 1 << (rdft_bits - 1);
/* compute display index : center on currently output samples */
- channels = s->audio_st->codec->channels;
+ channels = s->sdl_channels;
nb_display_channels = channels;
if (!s->paused) {
int data_used = s->show_audio == 1 ? s->width : (2 * nb_freq);
@@ -758,7 +760,7 @@ static void video_audio_display(VideoState *s)
the last buffer computation */
if (audio_callback_time) {
time_diff = av_gettime() - audio_callback_time;
- delay -= (time_diff * s->audio_st->codec->sample_rate) / 1000000;
+ delay -= (time_diff * s->sdl_sample_rate) / 1000000;
}
delay += 2 * data_used;
@@ -946,7 +948,7 @@ static int refresh_thread(void *opaque)
is->refresh = 1;
SDL_PushEvent(&event);
}
- usleep(is->audio_st && is->show_audio ? rdftspeed * 1000 : 5000); // FIXME ideally we should wait the correct time but SDLs event passing is so slow it would be silly
+ av_usleep(is->audio_st && is->show_audio ? rdftspeed * 1000 : 5000); // FIXME ideally we should wait the correct time but SDLs event passing is so slow it would be silly
}
return 0;
}
@@ -960,8 +962,8 @@ static double get_audio_clock(VideoState *is)
hw_buf_size = audio_write_get_buf_size(is);
bytes_per_sec = 0;
if (is->audio_st) {
- bytes_per_sec = is->audio_st->codec->sample_rate *
- 2 * is->audio_st->codec->channels;
+ bytes_per_sec = is->sdl_sample_rate * is->sdl_channels *
+ av_get_bytes_per_sample(is->sdl_sample_fmt);
}
if (bytes_per_sec)
pts -= (double)hw_buf_size / bytes_per_sec;
@@ -1228,10 +1230,7 @@ static void stream_close(VideoState *is)
for (i = 0; i < VIDEO_PICTURE_QUEUE_SIZE; i++) {
vp = &is->pictq[i];
#if CONFIG_AVFILTER
- if (vp->picref) {
- avfilter_unref_buffer(vp->picref);
- vp->picref = NULL;
- }
+ avfilter_unref_bufferp(&vp->picref);
#endif
if (vp->bmp) {
SDL_FreeYUVOverlay(vp->bmp);
@@ -1280,9 +1279,7 @@ static void alloc_picture(void *opaque)
SDL_FreeYUVOverlay(vp->bmp);
#if CONFIG_AVFILTER
- if (vp->picref)
- avfilter_unref_buffer(vp->picref);
- vp->picref = NULL;
+ avfilter_unref_bufferp(&vp->picref);
vp->width = is->out_video_filter->inputs[0]->w;
vp->height = is->out_video_filter->inputs[0]->h;
@@ -1300,7 +1297,7 @@ static void alloc_picture(void *opaque)
/* SDL allocates a buffer smaller than requested if the video
* overlay hardware is unable to support the requested size. */
fprintf(stderr, "Error: the video system does not support an image\n"
- "size of %dx%d pixels. Try using -lowres or -vf \"scale=w:h\"\n"
+ "size of %dx%d pixels. Try using -vf \"scale=w:h\"\n"
"to reduce the image size.\n", vp->width, vp->height );
do_exit();
}
@@ -1311,17 +1308,15 @@ static void alloc_picture(void *opaque)
SDL_UnlockMutex(is->pictq_mutex);
}
-/**
- *
- * @param pts the dts of the pkt / pts of the frame and guessed if not known
- */
+/* The 'pts' parameter is the dts of the packet / pts of the frame and
+ * guessed if not known. */
static int queue_picture(VideoState *is, AVFrame *src_frame, double pts, int64_t pos)
{
VideoPicture *vp;
#if CONFIG_AVFILTER
AVPicture pict_src;
#else
- int dst_pix_fmt = PIX_FMT_YUV420P;
+ int dst_pix_fmt = AV_PIX_FMT_YUV420P;
#endif
/* wait until we have space to put a new picture */
SDL_LockMutex(is->pictq_mutex);
@@ -1373,17 +1368,15 @@ static int queue_picture(VideoState *is, AVFrame *src_frame, double pts, int64_t
/* if the frame is not skipped, then display it */
if (vp->bmp) {
- AVPicture pict;
+ AVPicture pict = { { 0 } };
#if CONFIG_AVFILTER
- if (vp->picref)
- avfilter_unref_buffer(vp->picref);
+ avfilter_unref_bufferp(&vp->picref);
vp->picref = src_frame->opaque;
#endif
/* get a pointer on the bitmap */
SDL_LockYUVOverlay (vp->bmp);
- memset(&pict, 0, sizeof(AVPicture));
pict.data[0] = vp->bmp->pixels[0];
pict.data[1] = vp->bmp->pixels[2];
pict.data[2] = vp->bmp->pixels[1];
@@ -1405,7 +1398,7 @@ static int queue_picture(VideoState *is, AVFrame *src_frame, double pts, int64_t
av_picture_copy(&pict, &pict_src,
vp->pix_fmt, vp->width, vp->height);
#else
- sws_flags = av_get_int(sws_opts, "sws_flags", NULL);
+ av_opt_get_int(sws_opts, "sws_flags", 0, &sws_flags);
is->img_convert_ctx = sws_getCachedContext(is->img_convert_ctx,
vp->width, vp->height, vp->pix_fmt, vp->width, vp->height,
dst_pix_fmt, sws_flags, NULL, NULL, NULL);
@@ -1434,10 +1427,8 @@ static int queue_picture(VideoState *is, AVFrame *src_frame, double pts, int64_t
return 0;
}
-/**
- * compute the exact PTS for the picture if it is omitted in the stream
- * @param pts1 the dts of the pkt / pts of the frame
- */
+/* Compute the exact PTS for the picture if it is omitted in the stream.
+ * The 'pts1' parameter is the dts of the packet / pts of the frame. */
static int output_picture2(VideoState *is, AVFrame *src_frame, double pts1, int64_t pos)
{
double frame_delay, pts;
@@ -1516,211 +1507,44 @@ static int get_video_frame(VideoState *is, AVFrame *frame, int64_t *pts, AVPacke
}
#if CONFIG_AVFILTER
-typedef struct {
- VideoState *is;
- AVFrame *frame;
- int use_dr1;
-} FilterPriv;
-
-static int input_get_buffer(AVCodecContext *codec, AVFrame *pic)
-{
- AVFilterContext *ctx = codec->opaque;
- AVFilterBufferRef *ref;
- int perms = AV_PERM_WRITE;
- int i, w, h, stride[4];
- unsigned edge;
- int pixel_size;
-
- if (codec->codec->capabilities & CODEC_CAP_NEG_LINESIZES)
- perms |= AV_PERM_NEG_LINESIZES;
-
- if (pic->buffer_hints & FF_BUFFER_HINTS_VALID) {
- if (pic->buffer_hints & FF_BUFFER_HINTS_READABLE) perms |= AV_PERM_READ;
- if (pic->buffer_hints & FF_BUFFER_HINTS_PRESERVE) perms |= AV_PERM_PRESERVE;
- if (pic->buffer_hints & FF_BUFFER_HINTS_REUSABLE) perms |= AV_PERM_REUSE2;
- }
- if (pic->reference) perms |= AV_PERM_READ | AV_PERM_PRESERVE;
-
- w = codec->width;
- h = codec->height;
- avcodec_align_dimensions2(codec, &w, &h, stride);
- edge = codec->flags & CODEC_FLAG_EMU_EDGE ? 0 : avcodec_get_edge_width();
- w += edge << 1;
- h += edge << 1;
-
- if (!(ref = avfilter_get_video_buffer(ctx->outputs[0], perms, w, h)))
- return -1;
-
- pixel_size = av_pix_fmt_descriptors[ref->format].comp[0].step_minus1 + 1;
- ref->video->w = codec->width;
- ref->video->h = codec->height;
- for (i = 0; i < 4; i ++) {
- unsigned hshift = (i == 1 || i == 2) ? av_pix_fmt_descriptors[ref->format].log2_chroma_w : 0;
- unsigned vshift = (i == 1 || i == 2) ? av_pix_fmt_descriptors[ref->format].log2_chroma_h : 0;
-
- if (ref->data[i]) {
- ref->data[i] += ((edge * pixel_size) >> hshift) + ((edge * ref->linesize[i]) >> vshift);
- }
- pic->data[i] = ref->data[i];
- pic->linesize[i] = ref->linesize[i];
- }
- pic->opaque = ref;
- pic->type = FF_BUFFER_TYPE_USER;
- pic->reordered_opaque = codec->reordered_opaque;
- if (codec->pkt) pic->pkt_pts = codec->pkt->pts;
- else pic->pkt_pts = AV_NOPTS_VALUE;
- return 0;
-}
-
-static void input_release_buffer(AVCodecContext *codec, AVFrame *pic)
-{
- memset(pic->data, 0, sizeof(pic->data));
- avfilter_unref_buffer(pic->opaque);
-}
-
-static int input_reget_buffer(AVCodecContext *codec, AVFrame *pic)
-{
- AVFilterBufferRef *ref = pic->opaque;
-
- if (pic->data[0] == NULL) {
- pic->buffer_hints |= FF_BUFFER_HINTS_READABLE;
- return codec->get_buffer(codec, pic);
- }
-
- if ((codec->width != ref->video->w) || (codec->height != ref->video->h) ||
- (codec->pix_fmt != ref->format)) {
- av_log(codec, AV_LOG_ERROR, "Picture properties changed.\n");
- return -1;
- }
-
- pic->reordered_opaque = codec->reordered_opaque;
- if (codec->pkt) pic->pkt_pts = codec->pkt->pts;
- else pic->pkt_pts = AV_NOPTS_VALUE;
- return 0;
-}
-
-static int input_init(AVFilterContext *ctx, const char *args, void *opaque)
-{
- FilterPriv *priv = ctx->priv;
- AVCodecContext *codec;
- if (!opaque) return -1;
-
- priv->is = opaque;
- codec = priv->is->video_st->codec;
- codec->opaque = ctx;
- if (codec->codec->capabilities & CODEC_CAP_DR1) {
- priv->use_dr1 = 1;
- codec->get_buffer = input_get_buffer;
- codec->release_buffer = input_release_buffer;
- codec->reget_buffer = input_reget_buffer;
- codec->thread_safe_callbacks = 1;
- }
-
- priv->frame = avcodec_alloc_frame();
-
- return 0;
-}
-
-static void input_uninit(AVFilterContext *ctx)
-{
- FilterPriv *priv = ctx->priv;
- av_free(priv->frame);
-}
-
-static int input_request_frame(AVFilterLink *link)
+static int configure_video_filters(AVFilterGraph *graph, VideoState *is, const char *vfilters)
{
- FilterPriv *priv = link->src->priv;
- AVFilterBufferRef *picref;
- int64_t pts = 0;
- AVPacket pkt;
+ char sws_flags_str[128];
+ char buffersrc_args[256];
int ret;
+ AVFilterContext *filt_src = NULL, *filt_out = NULL, *filt_format;
+ AVCodecContext *codec = is->video_st->codec;
- while (!(ret = get_video_frame(priv->is, priv->frame, &pts, &pkt)))
- av_free_packet(&pkt);
- if (ret < 0)
- return -1;
-
- if (priv->use_dr1) {
- picref = avfilter_ref_buffer(priv->frame->opaque, ~0);
- } else {
- picref = avfilter_get_video_buffer(link, AV_PERM_WRITE, link->w, link->h);
- av_image_copy(picref->data, picref->linesize,
- priv->frame->data, priv->frame->linesize,
- picref->format, link->w, link->h);
- }
- av_free_packet(&pkt);
-
- avfilter_copy_frame_props(picref, priv->frame);
- picref->pts = pts;
-
- avfilter_start_frame(link, picref);
- avfilter_draw_slice(link, 0, link->h, 1);
- avfilter_end_frame(link);
-
- return 0;
-}
-
-static int input_query_formats(AVFilterContext *ctx)
-{
- FilterPriv *priv = ctx->priv;
- enum PixelFormat pix_fmts[] = {
- priv->is->video_st->codec->pix_fmt, PIX_FMT_NONE
- };
-
- avfilter_set_common_formats(ctx, avfilter_make_format_list(pix_fmts));
- return 0;
-}
-
-static int input_config_props(AVFilterLink *link)
-{
- FilterPriv *priv = link->src->priv;
- AVCodecContext *c = priv->is->video_st->codec;
-
- link->w = c->width;
- link->h = c->height;
- link->time_base = priv->is->video_st->time_base;
-
- return 0;
-}
-
-static AVFilter input_filter =
-{
- .name = "avplay_input",
-
- .priv_size = sizeof(FilterPriv),
-
- .init = input_init,
- .uninit = input_uninit,
+ snprintf(sws_flags_str, sizeof(sws_flags_str), "flags=%"PRId64, sws_flags);
+ graph->scale_sws_opts = av_strdup(sws_flags_str);
- .query_formats = input_query_formats,
+ snprintf(buffersrc_args, sizeof(buffersrc_args), "%d:%d:%d:%d:%d:%d:%d",
+ codec->width, codec->height, codec->pix_fmt,
+ is->video_st->time_base.num, is->video_st->time_base.den,
+ codec->sample_aspect_ratio.num, codec->sample_aspect_ratio.den);
- .inputs = (AVFilterPad[]) {{ .name = NULL }},
- .outputs = (AVFilterPad[]) {{ .name = "default",
- .type = AVMEDIA_TYPE_VIDEO,
- .request_frame = input_request_frame,
- .config_props = input_config_props, },
- { .name = NULL }},
-};
-static int configure_video_filters(AVFilterGraph *graph, VideoState *is, const char *vfilters)
-{
- char sws_flags_str[128];
- int ret;
- AVSinkContext avsink_ctx = { .pix_fmt = PIX_FMT_YUV420P };
- AVFilterContext *filt_src = NULL, *filt_out = NULL;
- snprintf(sws_flags_str, sizeof(sws_flags_str), "flags=%d", sws_flags);
- graph->scale_sws_opts = av_strdup(sws_flags_str);
+ if ((ret = avfilter_graph_create_filter(&filt_src,
+ avfilter_get_by_name("buffer"),
+ "src", buffersrc_args, NULL,
+ graph)) < 0)
+ return ret;
+ if ((ret = avfilter_graph_create_filter(&filt_out,
+ avfilter_get_by_name("buffersink"),
+ "out", NULL, NULL, graph)) < 0)
+ return ret;
- if ((ret = avfilter_graph_create_filter(&filt_src, &input_filter, "src",
- NULL, is, graph)) < 0)
+ if ((ret = avfilter_graph_create_filter(&filt_format,
+ avfilter_get_by_name("format"),
+ "format", "yuv420p", NULL, graph)) < 0)
return ret;
- if ((ret = avfilter_graph_create_filter(&filt_out, &avsink, "out",
- NULL, &avsink_ctx, graph)) < 0)
+ if ((ret = avfilter_link(filt_format, 0, filt_out, 0)) < 0)
return ret;
+
if (vfilters) {
- AVFilterInOut *outputs = av_malloc(sizeof(AVFilterInOut));
- AVFilterInOut *inputs = av_malloc(sizeof(AVFilterInOut));
+ AVFilterInOut *outputs = avfilter_inout_alloc();
+ AVFilterInOut *inputs = avfilter_inout_alloc();
outputs->name = av_strdup("in");
outputs->filter_ctx = filt_src;
@@ -1728,23 +1552,30 @@ static int configure_video_filters(AVFilterGraph *graph, VideoState *is, const c
outputs->next = NULL;
inputs->name = av_strdup("out");
- inputs->filter_ctx = filt_out;
+ inputs->filter_ctx = filt_format;
inputs->pad_idx = 0;
inputs->next = NULL;
if ((ret = avfilter_graph_parse(graph, vfilters, inputs, outputs, NULL)) < 0)
return ret;
- av_freep(&vfilters);
} else {
- if ((ret = avfilter_link(filt_src, 0, filt_out, 0)) < 0)
+ if ((ret = avfilter_link(filt_src, 0, filt_format, 0)) < 0)
return ret;
}
if ((ret = avfilter_graph_config(graph, NULL)) < 0)
return ret;
+ is->in_video_filter = filt_src;
is->out_video_filter = filt_out;
+ if (codec->codec->capabilities & CODEC_CAP_DR1) {
+ is->use_dr1 = 1;
+ codec->get_buffer = codec_get_buffer;
+ codec->release_buffer = codec_release_buffer;
+ codec->opaque = &is->buffer_pool;
+ }
+
return ret;
}
@@ -1752,6 +1583,7 @@ static int configure_video_filters(AVFilterGraph *graph, VideoState *is, const c
static int video_thread(void *arg)
{
+ AVPacket pkt = { 0 };
VideoState *is = arg;
AVFrame *frame = avcodec_alloc_frame();
int64_t pts_int;
@@ -1760,25 +1592,34 @@ static int video_thread(void *arg)
#if CONFIG_AVFILTER
AVFilterGraph *graph = avfilter_graph_alloc();
- AVFilterContext *filt_out = NULL;
+ AVFilterContext *filt_out = NULL, *filt_in = NULL;
int64_t pos;
int last_w = is->video_st->codec->width;
int last_h = is->video_st->codec->height;
if ((ret = configure_video_filters(graph, is, vfilters)) < 0)
goto the_end;
+ filt_in = is->in_video_filter;
filt_out = is->out_video_filter;
#endif
for (;;) {
-#if !CONFIG_AVFILTER
- AVPacket pkt;
-#else
+#if CONFIG_AVFILTER
AVFilterBufferRef *picref;
AVRational tb;
#endif
while (is->paused && !is->videoq.abort_request)
SDL_Delay(10);
+
+ av_free_packet(&pkt);
+
+ ret = get_video_frame(is, frame, &pts_int, &pkt);
+ if (ret < 0)
+ goto the_end;
+
+ if (!ret)
+ continue;
+
#if CONFIG_AVFILTER
if ( last_w != is->video_st->codec->width
|| last_h != is->video_st->codec->height) {
@@ -1788,43 +1629,61 @@ static int video_thread(void *arg)
graph = avfilter_graph_alloc();
if ((ret = configure_video_filters(graph, is, vfilters)) < 0)
goto the_end;
+ filt_in = is->in_video_filter;
filt_out = is->out_video_filter;
last_w = is->video_st->codec->width;
last_h = is->video_st->codec->height;
}
- ret = get_filtered_video_frame(filt_out, frame, &picref, &tb);
- if (picref) {
+
+ frame->pts = pts_int;
+ if (is->use_dr1) {
+ FrameBuffer *buf = frame->opaque;
+ AVFilterBufferRef *fb = avfilter_get_video_buffer_ref_from_arrays(
+ frame->data, frame->linesize,
+ AV_PERM_READ | AV_PERM_PRESERVE,
+ frame->width, frame->height,
+ frame->format);
+
+ avfilter_copy_frame_props(fb, frame);
+ fb->buf->priv = buf;
+ fb->buf->free = filter_release_buffer;
+
+ buf->refcount++;
+ av_buffersrc_buffer(filt_in, fb);
+
+ } else
+ av_buffersrc_write_frame(filt_in, frame);
+
+ while (ret >= 0) {
+ ret = av_buffersink_read(filt_out, &picref);
+ if (ret < 0) {
+ ret = 0;
+ break;
+ }
+
+ avfilter_copy_buf_props(frame, picref);
+
pts_int = picref->pts;
+ tb = filt_out->inputs[0]->time_base;
pos = picref->pos;
frame->opaque = picref;
- }
- if (av_cmp_q(tb, is->video_st->time_base)) {
- av_unused int64_t pts1 = pts_int;
- pts_int = av_rescale_q(pts_int, tb, is->video_st->time_base);
- av_dlog(NULL, "video_thread(): "
- "tb:%d/%d pts:%"PRId64" -> tb:%d/%d pts:%"PRId64"\n",
- tb.num, tb.den, pts1,
- is->video_st->time_base.num, is->video_st->time_base.den, pts_int);
+ if (av_cmp_q(tb, is->video_st->time_base)) {
+ av_unused int64_t pts1 = pts_int;
+ pts_int = av_rescale_q(pts_int, tb, is->video_st->time_base);
+ av_dlog(NULL, "video_thread(): "
+ "tb:%d/%d pts:%"PRId64" -> tb:%d/%d pts:%"PRId64"\n",
+ tb.num, tb.den, pts1,
+ is->video_st->time_base.num, is->video_st->time_base.den, pts_int);
+ }
+ pts = pts_int * av_q2d(is->video_st->time_base);
+ ret = output_picture2(is, frame, pts, pos);
}
#else
- ret = get_video_frame(is, frame, &pts_int, &pkt);
-#endif
-
- if (ret < 0)
- goto the_end;
-
- if (!ret)
- continue;
-
pts = pts_int * av_q2d(is->video_st->time_base);
-
-#if CONFIG_AVFILTER
- ret = output_picture2(is, frame, pts, pos);
-#else
ret = output_picture2(is, frame, pts, pkt.pos);
- av_free_packet(&pkt);
#endif
+
if (ret < 0)
goto the_end;
@@ -1834,9 +1693,11 @@ static int video_thread(void *arg)
}
the_end:
#if CONFIG_AVFILTER
+ av_freep(&vfilters);
avfilter_graph_free(&graph);
#endif
- av_free(frame);
+ av_free_packet(&pkt);
+ avcodec_free_frame(&frame);
return 0;
}
@@ -1936,7 +1797,7 @@ static int synchronize_audio(VideoState *is, short *samples,
int n, samples_size;
double ref_clock;
- n = 2 * is->audio_st->codec->channels;
+ n = is->sdl_channels * av_get_bytes_per_sample(is->sdl_sample_fmt);
samples_size = samples_size1;
/* if not master, then we try to remove or add samples to correct the clock */
@@ -1958,7 +1819,7 @@ static int synchronize_audio(VideoState *is, short *samples,
avg_diff = is->audio_diff_cum * (1.0 - is->audio_diff_avg_coef);
if (fabs(avg_diff) >= is->audio_diff_threshold) {
- wanted_size = samples_size + ((int)(diff * is->audio_st->codec->sample_rate) * n);
+ wanted_size = samples_size + ((int)(diff * is->sdl_sample_rate) * n);
nb_samples = samples_size / n;
min_size = ((nb_samples * (100 - SAMPLE_CORRECTION_PERCENT_MAX)) / 100) * n;
@@ -2017,6 +1878,8 @@ static int audio_decode_frame(VideoState *is, double *pts_ptr)
for (;;) {
/* NOTE: the audio packet can contain several frames */
while (pkt_temp->size > 0 || (!pkt_temp->data && new_packet)) {
+ int resample_changed, audio_resample;
+
if (!is->frame) {
if (!(is->frame = avcodec_alloc_frame()))
return AVERROR(ENOMEM);
@@ -2044,41 +1907,72 @@ static int audio_decode_frame(VideoState *is, double *pts_ptr)
}
data_size = av_samples_get_buffer_size(NULL, dec->channels,
is->frame->nb_samples,
- dec->sample_fmt, 1);
-
- if (dec->sample_fmt != is->audio_src_fmt) {
- if (is->reformat_ctx)
- av_audio_convert_free(is->reformat_ctx);
- is->reformat_ctx= av_audio_convert_alloc(AV_SAMPLE_FMT_S16, 1,
- dec->sample_fmt, 1, NULL, 0);
- if (!is->reformat_ctx) {
- fprintf(stderr, "Cannot convert %s sample format to %s sample format\n",
- av_get_sample_fmt_name(dec->sample_fmt),
- av_get_sample_fmt_name(AV_SAMPLE_FMT_S16));
+ is->frame->format, 1);
+
+ audio_resample = is->frame->format != is->sdl_sample_fmt ||
+ is->frame->channel_layout != is->sdl_channel_layout ||
+ is->frame->sample_rate != is->sdl_sample_rate;
+
+ resample_changed = is->frame->format != is->resample_sample_fmt ||
+ is->frame->channel_layout != is->resample_channel_layout ||
+ is->frame->sample_rate != is->resample_sample_rate;
+
+ if ((!is->avr && audio_resample) || resample_changed) {
+ int ret;
+ if (is->avr)
+ avresample_close(is->avr);
+ else if (audio_resample) {
+ is->avr = avresample_alloc_context();
+ if (!is->avr) {
+ fprintf(stderr, "error allocating AVAudioResampleContext\n");
break;
+ }
}
- is->audio_src_fmt= dec->sample_fmt;
+ if (audio_resample) {
+ av_opt_set_int(is->avr, "in_channel_layout", is->frame->channel_layout, 0);
+ av_opt_set_int(is->avr, "in_sample_fmt", is->frame->format, 0);
+ av_opt_set_int(is->avr, "in_sample_rate", is->frame->sample_rate, 0);
+ av_opt_set_int(is->avr, "out_channel_layout", is->sdl_channel_layout, 0);
+ av_opt_set_int(is->avr, "out_sample_fmt", is->sdl_sample_fmt, 0);
+ av_opt_set_int(is->avr, "out_sample_rate", is->sdl_sample_rate, 0);
+
+ if ((ret = avresample_open(is->avr)) < 0) {
+ fprintf(stderr, "error initializing libavresample\n");
+ break;
+ }
+ }
+ is->resample_sample_fmt = is->frame->format;
+ is->resample_channel_layout = is->frame->channel_layout;
+ is->resample_sample_rate = is->frame->sample_rate;
}
- if (is->reformat_ctx) {
- const void *ibuf[6] = { is->frame->data[0] };
- void *obuf[6];
- int istride[6] = { av_get_bytes_per_sample(dec->sample_fmt) };
- int ostride[6] = { 2 };
- int len= data_size/istride[0];
- obuf[0] = av_realloc(is->audio_buf1, FFALIGN(len * ostride[0], 32));
- if (!obuf[0]) {
+ if (audio_resample) {
+ void *tmp_out;
+ int out_samples, out_size, out_linesize;
+ int osize = av_get_bytes_per_sample(is->sdl_sample_fmt);
+ int nb_samples = is->frame->nb_samples;
+
+ out_size = av_samples_get_buffer_size(&out_linesize,
+ is->sdl_channels,
+ nb_samples,
+ is->sdl_sample_fmt, 0);
+ tmp_out = av_realloc(is->audio_buf1, out_size);
+ if (!tmp_out)
return AVERROR(ENOMEM);
- }
- is->audio_buf1 = obuf[0];
- if (av_audio_convert(is->reformat_ctx, obuf, ostride, ibuf, istride, len) < 0) {
- printf("av_audio_convert() failed\n");
+ is->audio_buf1 = tmp_out;
+
+ out_samples = avresample_convert(is->avr,
+ &is->audio_buf1,
+ out_linesize, nb_samples,
+ is->frame->data,
+ is->frame->linesize[0],
+ is->frame->nb_samples);
+ if (out_samples < 0) {
+ fprintf(stderr, "avresample_convert() failed\n");
break;
}
is->audio_buf = is->audio_buf1;
- /* FIXME: existing code assume that data_size equals framesize*channels*2
- remove this legacy cruft */
- data_size = len * 2;
+ data_size = out_samples * osize * is->sdl_channels;
} else {
is->audio_buf = is->frame->data[0];
}
@@ -2086,9 +1980,9 @@ static int audio_decode_frame(VideoState *is, double *pts_ptr)
/* if no pts, then compute it */
pts = is->audio_clock;
*pts_ptr = pts;
- n = 2 * dec->channels;
+ n = is->sdl_channels * av_get_bytes_per_sample(is->sdl_sample_fmt);
is->audio_clock += (double)data_size /
- (double)(n * dec->sample_rate);
+ (double)(n * is->sdl_sample_rate);
#ifdef DEBUG
{
static double last_clock;
@@ -2114,8 +2008,10 @@ static int audio_decode_frame(VideoState *is, double *pts_ptr)
if ((new_packet = packet_queue_get(&is->audioq, pkt, 1)) < 0)
return -1;
- if (pkt->data == flush_pkt.data)
+ if (pkt->data == flush_pkt.data) {
avcodec_flush_buffers(dec);
+ flush_complete = 0;
+ }
*pkt_temp = *pkt;
@@ -2175,21 +2071,18 @@ static int stream_component_open(VideoState *is, int stream_index)
return -1;
avctx = ic->streams[stream_index]->codec;
- opts = filter_codec_opts(codec_opts, avctx->codec_id, ic, ic->streams[stream_index]);
+ opts = filter_codec_opts(codec_opts, avctx->codec_id, ic, ic->streams[stream_index], NULL);
codec = avcodec_find_decoder(avctx->codec_id);
avctx->debug_mv = debug_mv;
avctx->debug = debug;
avctx->workaround_bugs = workaround_bugs;
- avctx->lowres = lowres;
avctx->idct_algo = idct;
avctx->skip_frame = skip_frame;
avctx->skip_idct = skip_idct;
avctx->skip_loop_filter = skip_loop_filter;
- avctx->error_recognition = error_recognition;
avctx->error_concealment = error_concealment;
- if (lowres) avctx->flags |= CODEC_FLAG_EMU_EDGE;
if (fast) avctx->flags2 |= CODEC_FLAG2_FAST;
if (!av_dict_get(opts, "threads", NULL, 0))
@@ -2204,9 +2097,23 @@ static int stream_component_open(VideoState *is, int stream_index)
/* prepare audio output */
if (avctx->codec_type == AVMEDIA_TYPE_AUDIO) {
- wanted_spec.freq = avctx->sample_rate;
+ is->sdl_sample_rate = avctx->sample_rate;
+
+ if (!avctx->channel_layout)
+ avctx->channel_layout = av_get_default_channel_layout(avctx->channels);
+ if (!avctx->channel_layout) {
+ fprintf(stderr, "unable to guess channel layout\n");
+ return -1;
+ }
+ if (avctx->channels == 1)
+ is->sdl_channel_layout = AV_CH_LAYOUT_MONO;
+ else
+ is->sdl_channel_layout = AV_CH_LAYOUT_STEREO;
+ is->sdl_channels = av_get_channel_layout_nb_channels(is->sdl_channel_layout);
+
wanted_spec.format = AUDIO_S16SYS;
- wanted_spec.channels = avctx->channels;
+ wanted_spec.freq = is->sdl_sample_rate;
+ wanted_spec.channels = is->sdl_channels;
wanted_spec.silence = 0;
wanted_spec.samples = SDL_AUDIO_BUFFER_SIZE;
wanted_spec.callback = sdl_audio_callback;
@@ -2216,7 +2123,10 @@ static int stream_component_open(VideoState *is, int stream_index)
return -1;
}
is->audio_hw_buf_size = spec.size;
- is->audio_src_fmt = AV_SAMPLE_FMT_S16;
+ is->sdl_sample_fmt = AV_SAMPLE_FMT_S16;
+ is->resample_sample_fmt = is->sdl_sample_fmt;
+ is->resample_channel_layout = avctx->channel_layout;
+ is->resample_sample_rate = avctx->sample_rate;
}
ic->streams[stream_index]->discard = AVDISCARD_DEFAULT;
@@ -2275,12 +2185,11 @@ static void stream_component_close(VideoState *is, int stream_index)
packet_queue_end(&is->audioq);
av_free_packet(&is->audio_pkt);
- if (is->reformat_ctx)
- av_audio_convert_free(is->reformat_ctx);
- is->reformat_ctx = NULL;
+ if (is->avr)
+ avresample_free(&is->avr);
av_freep(&is->audio_buf1);
is->audio_buf = NULL;
- av_freep(&is->frame);
+ avcodec_free_frame(&is->frame);
if (is->rdft) {
av_rdft_end(is->rdft);
@@ -2323,6 +2232,9 @@ static void stream_component_close(VideoState *is, int stream_index)
ic->streams[stream_index]->discard = AVDISCARD_ALL;
avcodec_close(avctx);
+#if CONFIG_AVFILTER
+ free_buffer_pool(&is->buffer_pool);
+#endif
switch (avctx->codec_type) {
case AVMEDIA_TYPE_AUDIO:
is->audio_st = NULL;
@@ -2519,10 +2431,11 @@ static int decode_thread(void *arg)
}
/* if the queue are full, no need to read more */
- if ( is->audioq.size + is->videoq.size + is->subtitleq.size > MAX_QUEUE_SIZE
+ if (!infinite_buffer &&
+ (is->audioq.size + is->videoq.size + is->subtitleq.size > MAX_QUEUE_SIZE
|| ( (is->audioq .size > MIN_AUDIOQ_SIZE || is->audio_stream < 0)
&& (is->videoq .nb_packets > MIN_FRAMES || is->video_stream < 0)
- && (is->subtitleq.nb_packets > MIN_FRAMES || is->subtitle_stream < 0))) {
+ && (is->subtitleq.nb_packets > MIN_FRAMES || is->subtitle_stream < 0)))) {
/* wait 10 ms */
SDL_Delay(10);
continue;
@@ -2690,13 +2603,13 @@ static void stream_cycle_channel(VideoState *is, int codec_type)
static void toggle_full_screen(void)
{
- is_full_screen = !is_full_screen;
#if defined(__APPLE__) && SDL_VERSION_ATLEAST(1, 2, 14)
/* OS X needs to empty the picture_queue */
- for (int i = 0; i < VIDEO_PICTURE_QUEUE_SIZE; i++) {
+ int i;
+ for (i = 0; i < VIDEO_PICTURE_QUEUE_SIZE; i++)
cur_stream->pictq[i].reallocate = 1;
- }
#endif
+ is_full_screen = !is_full_screen;
video_open(cur_stream);
}
@@ -2876,26 +2789,26 @@ static void event_loop(void)
}
}
-static int opt_frame_size(const char *opt, const char *arg)
+static int opt_frame_size(void *optctx, const char *opt, const char *arg)
{
av_log(NULL, AV_LOG_ERROR,
"Option '%s' has been removed, use private format options instead\n", opt);
return AVERROR(EINVAL);
}
-static int opt_width(const char *opt, const char *arg)
+static int opt_width(void *optctx, const char *opt, const char *arg)
{
screen_width = parse_number_or_die(opt, arg, OPT_INT64, 1, INT_MAX);
return 0;
}
-static int opt_height(const char *opt, const char *arg)
+static int opt_height(void *optctx, const char *opt, const char *arg)
{
screen_height = parse_number_or_die(opt, arg, OPT_INT64, 1, INT_MAX);
return 0;
}
-static int opt_format(const char *opt, const char *arg)
+static int opt_format(void *optctx, const char *opt, const char *arg)
{
file_iformat = av_find_input_format(arg);
if (!file_iformat) {
@@ -2905,14 +2818,14 @@ static int opt_format(const char *opt, const char *arg)
return 0;
}
-static int opt_frame_pix_fmt(const char *opt, const char *arg)
+static int opt_frame_pix_fmt(void *optctx, const char *opt, const char *arg)
{
av_log(NULL, AV_LOG_ERROR,
"Option '%s' has been removed, use private format options instead\n", opt);
return AVERROR(EINVAL);
}
-static int opt_sync(const char *opt, const char *arg)
+static int opt_sync(void *optctx, const char *opt, const char *arg)
{
if (!strcmp(arg, "audio"))
av_sync_type = AV_SYNC_AUDIO_MASTER;
@@ -2927,26 +2840,26 @@ static int opt_sync(const char *opt, const char *arg)
return 0;
}
-static int opt_seek(const char *opt, const char *arg)
+static int opt_seek(void *optctx, const char *opt, const char *arg)
{
start_time = parse_time_or_die(opt, arg, 1);
return 0;
}
-static int opt_duration(const char *opt, const char *arg)
+static int opt_duration(void *optctx, const char *opt, const char *arg)
{
duration = parse_time_or_die(opt, arg, 1);
return 0;
}
-static int opt_debug(const char *opt, const char *arg)
+static int opt_debug(void *optctx, const char *opt, const char *arg)
{
av_log_set_level(99);
debug = parse_number_or_die(opt, arg, OPT_INT64, 0, INT_MAX);
return 0;
}
-static int opt_vismv(const char *opt, const char *arg)
+static int opt_vismv(void *optctx, const char *opt, const char *arg)
{
debug_mv = parse_number_or_die(opt, arg, OPT_INT64, INT_MIN, INT_MAX);
return 0;
@@ -2954,47 +2867,46 @@ static int opt_vismv(const char *opt, const char *arg)
static const OptionDef options[] = {
#include "cmdutils_common_opts.h"
- { "x", HAS_ARG, { (void*)opt_width }, "force displayed width", "width" },
- { "y", HAS_ARG, { (void*)opt_height }, "force displayed height", "height" },
- { "s", HAS_ARG | OPT_VIDEO, { (void*)opt_frame_size }, "set frame size (WxH or abbreviation)", "size" },
- { "fs", OPT_BOOL, { (void*)&is_full_screen }, "force full screen" },
- { "an", OPT_BOOL, { (void*)&audio_disable }, "disable audio" },
- { "vn", OPT_BOOL, { (void*)&video_disable }, "disable video" },
- { "ast", OPT_INT | HAS_ARG | OPT_EXPERT, { (void*)&wanted_stream[AVMEDIA_TYPE_AUDIO] }, "select desired audio stream", "stream_number" },
- { "vst", OPT_INT | HAS_ARG | OPT_EXPERT, { (void*)&wanted_stream[AVMEDIA_TYPE_VIDEO] }, "select desired video stream", "stream_number" },
- { "sst", OPT_INT | HAS_ARG | OPT_EXPERT, { (void*)&wanted_stream[AVMEDIA_TYPE_SUBTITLE] }, "select desired subtitle stream", "stream_number" },
- { "ss", HAS_ARG, { (void*)&opt_seek }, "seek to a given position in seconds", "pos" },
- { "t", HAS_ARG, { (void*)&opt_duration }, "play \"duration\" seconds of audio/video", "duration" },
- { "bytes", OPT_INT | HAS_ARG, { (void*)&seek_by_bytes }, "seek by bytes 0=off 1=on -1=auto", "val" },
- { "nodisp", OPT_BOOL, { (void*)&display_disable }, "disable graphical display" },
- { "f", HAS_ARG, { (void*)opt_format }, "force format", "fmt" },
- { "pix_fmt", HAS_ARG | OPT_EXPERT | OPT_VIDEO, { (void*)opt_frame_pix_fmt }, "set pixel format", "format" },
- { "stats", OPT_BOOL | OPT_EXPERT, { (void*)&show_status }, "show status", "" },
- { "debug", HAS_ARG | OPT_EXPERT, { (void*)opt_debug }, "print specific debug info", "" },
- { "bug", OPT_INT | HAS_ARG | OPT_EXPERT, { (void*)&workaround_bugs }, "workaround bugs", "" },
- { "vismv", HAS_ARG | OPT_EXPERT, { (void*)opt_vismv }, "visualize motion vectors", "" },
- { "fast", OPT_BOOL | OPT_EXPERT, { (void*)&fast }, "non spec compliant optimizations", "" },
- { "genpts", OPT_BOOL | OPT_EXPERT, { (void*)&genpts }, "generate pts", "" },
- { "drp", OPT_INT | HAS_ARG | OPT_EXPERT, { (void*)&decoder_reorder_pts }, "let decoder reorder pts 0=off 1=on -1=auto", ""},
- { "lowres", OPT_INT | HAS_ARG | OPT_EXPERT, { (void*)&lowres }, "", "" },
- { "skiploop", OPT_INT | HAS_ARG | OPT_EXPERT, { (void*)&skip_loop_filter }, "", "" },
- { "skipframe", OPT_INT | HAS_ARG | OPT_EXPERT, { (void*)&skip_frame }, "", "" },
- { "skipidct", OPT_INT | HAS_ARG | OPT_EXPERT, { (void*)&skip_idct }, "", "" },
- { "idct", OPT_INT | HAS_ARG | OPT_EXPERT, { (void*)&idct }, "set idct algo", "algo" },
- { "er", OPT_INT | HAS_ARG | OPT_EXPERT, { (void*)&error_recognition }, "set error detection threshold (0-4)", "threshold" },
- { "ec", OPT_INT | HAS_ARG | OPT_EXPERT, { (void*)&error_concealment }, "set error concealment options", "bit_mask" },
- { "sync", HAS_ARG | OPT_EXPERT, { (void*)opt_sync }, "set audio-video sync. type (type=audio/video/ext)", "type" },
- { "autoexit", OPT_BOOL | OPT_EXPERT, { (void*)&autoexit }, "exit at the end", "" },
- { "exitonkeydown", OPT_BOOL | OPT_EXPERT, { (void*)&exit_on_keydown }, "exit on key down", "" },
- { "exitonmousedown", OPT_BOOL | OPT_EXPERT, { (void*)&exit_on_mousedown }, "exit on mouse down", "" },
- { "loop", OPT_INT | HAS_ARG | OPT_EXPERT, { (void*)&loop }, "set number of times the playback shall be looped", "loop count" },
- { "framedrop", OPT_BOOL | OPT_EXPERT, { (void*)&framedrop }, "drop frames when cpu is too slow", "" },
- { "window_title", OPT_STRING | HAS_ARG, { (void*)&window_title }, "set window title", "window title" },
+ { "x", HAS_ARG, { .func_arg = opt_width }, "force displayed width", "width" },
+ { "y", HAS_ARG, { .func_arg = opt_height }, "force displayed height", "height" },
+ { "s", HAS_ARG | OPT_VIDEO, { .func_arg = opt_frame_size }, "set frame size (WxH or abbreviation)", "size" },
+ { "fs", OPT_BOOL, { &is_full_screen }, "force full screen" },
+ { "an", OPT_BOOL, { &audio_disable }, "disable audio" },
+ { "vn", OPT_BOOL, { &video_disable }, "disable video" },
+ { "ast", OPT_INT | HAS_ARG | OPT_EXPERT, { &wanted_stream[AVMEDIA_TYPE_AUDIO] }, "select desired audio stream", "stream_number" },
+ { "vst", OPT_INT | HAS_ARG | OPT_EXPERT, { &wanted_stream[AVMEDIA_TYPE_VIDEO] }, "select desired video stream", "stream_number" },
+ { "sst", OPT_INT | HAS_ARG | OPT_EXPERT, { &wanted_stream[AVMEDIA_TYPE_SUBTITLE] }, "select desired subtitle stream", "stream_number" },
+ { "ss", HAS_ARG, { .func_arg = opt_seek }, "seek to a given position in seconds", "pos" },
+ { "t", HAS_ARG, { .func_arg = opt_duration }, "play \"duration\" seconds of audio/video", "duration" },
+ { "bytes", OPT_INT | HAS_ARG, { &seek_by_bytes }, "seek by bytes 0=off 1=on -1=auto", "val" },
+ { "nodisp", OPT_BOOL, { &display_disable }, "disable graphical display" },
+ { "f", HAS_ARG, { .func_arg = opt_format }, "force format", "fmt" },
+ { "pix_fmt", HAS_ARG | OPT_EXPERT | OPT_VIDEO, { .func_arg = opt_frame_pix_fmt }, "set pixel format", "format" },
+ { "stats", OPT_BOOL | OPT_EXPERT, { &show_status }, "show status", "" },
+ { "debug", HAS_ARG | OPT_EXPERT, { .func_arg = opt_debug }, "print specific debug info", "" },
+ { "bug", OPT_INT | HAS_ARG | OPT_EXPERT, { &workaround_bugs }, "workaround bugs", "" },
+ { "vismv", HAS_ARG | OPT_EXPERT, { .func_arg = opt_vismv }, "visualize motion vectors", "" },
+ { "fast", OPT_BOOL | OPT_EXPERT, { &fast }, "non spec compliant optimizations", "" },
+ { "genpts", OPT_BOOL | OPT_EXPERT, { &genpts }, "generate pts", "" },
+ { "drp", OPT_INT | HAS_ARG | OPT_EXPERT, { &decoder_reorder_pts }, "let decoder reorder pts 0=off 1=on -1=auto", ""},
+ { "skiploop", OPT_INT | HAS_ARG | OPT_EXPERT, { &skip_loop_filter }, "", "" },
+ { "skipframe", OPT_INT | HAS_ARG | OPT_EXPERT, { &skip_frame }, "", "" },
+ { "skipidct", OPT_INT | HAS_ARG | OPT_EXPERT, { &skip_idct }, "", "" },
+ { "idct", OPT_INT | HAS_ARG | OPT_EXPERT, { &idct }, "set idct algo", "algo" },
+ { "ec", OPT_INT | HAS_ARG | OPT_EXPERT, { &error_concealment }, "set error concealment options", "bit_mask" },
+ { "sync", HAS_ARG | OPT_EXPERT, { .func_arg = opt_sync }, "set audio-video sync. type (type=audio/video/ext)", "type" },
+ { "autoexit", OPT_BOOL | OPT_EXPERT, { &autoexit }, "exit at the end", "" },
+ { "exitonkeydown", OPT_BOOL | OPT_EXPERT, { &exit_on_keydown }, "exit on key down", "" },
+ { "exitonmousedown", OPT_BOOL | OPT_EXPERT, { &exit_on_mousedown }, "exit on mouse down", "" },
+ { "loop", OPT_INT | HAS_ARG | OPT_EXPERT, { &loop }, "set number of times the playback shall be looped", "loop count" },
+ { "framedrop", OPT_BOOL | OPT_EXPERT, { &framedrop }, "drop frames when cpu is too slow", "" },
+ { "infbuf", OPT_BOOL | OPT_EXPERT, { &infinite_buffer }, "don't limit the input buffer size (useful with realtime streams)", "" },
+ { "window_title", OPT_STRING | HAS_ARG, { &window_title }, "set window title", "window title" },
#if CONFIG_AVFILTER
- { "vf", OPT_STRING | HAS_ARG, { (void*)&vfilters }, "video filters", "filter list" },
+ { "vf", OPT_STRING | HAS_ARG, { &vfilters }, "video filters", "filter list" },
#endif
- { "rdftspeed", OPT_INT | HAS_ARG| OPT_AUDIO | OPT_EXPERT, { (void*)&rdftspeed }, "rdft speed", "msecs" },
- { "default", HAS_ARG | OPT_AUDIO | OPT_VIDEO | OPT_EXPERT, { (void*)opt_default }, "generic catch all option", "" },
+ { "rdftspeed", OPT_INT | HAS_ARG| OPT_AUDIO | OPT_EXPERT, { &rdftspeed }, "rdft speed", "msecs" },
+ { "default", HAS_ARG | OPT_AUDIO | OPT_VIDEO | OPT_EXPERT, { opt_default }, "generic catch all option", "" },
{ "i", 0, { NULL }, "avconv compatibility dummy option", ""},
{ NULL, },
};
@@ -3006,14 +2918,12 @@ static void show_usage(void)
printf("\n");
}
-static void show_help(void)
+void show_help_default(const char *opt, const char *arg)
{
av_log_set_callback(log_callback_help);
show_usage();
- show_help_options(options, "Main options:\n",
- OPT_EXPERT, 0);
- show_help_options(options, "\nAdvanced options:\n",
- OPT_EXPERT, OPT_EXPERT);
+ show_help_options(options, "Main options:", 0, OPT_EXPERT, 0);
+ show_help_options(options, "Advanced options:", OPT_EXPERT, 0, 0);
printf("\n");
show_help_children(avcodec_get_class(), AV_OPT_FLAG_DECODING_PARAM);
show_help_children(avformat_get_class(), AV_OPT_FLAG_DECODING_PARAM);
diff --git a/gst-libs/ext/libav/avprobe.c b/gst-libs/ext/libav/avprobe.c
index 799b325..38b74a3 100644
--- a/gst-libs/ext/libav/avprobe.c
+++ b/gst-libs/ext/libav/avprobe.c
@@ -26,6 +26,7 @@
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
#include "libavutil/dict.h"
+#include "libavutil/libm.h"
#include "libavdevice/avdevice.h"
#include "cmdutils.h"
@@ -33,6 +34,8 @@ const char program_name[] = "avprobe";
const int program_birth_year = 2007;
static int do_show_format = 0;
+static AVDictionary *fmt_entries_to_show = NULL;
+static int nb_fmt_entries_to_show;
static int do_show_packets = 0;
static int do_show_streams = 0;
@@ -42,23 +45,411 @@ static int use_byte_value_binary_prefix = 0;
static int use_value_sexagesimal_format = 0;
/* globals */
-static const OptionDef options[];
+static const OptionDef *options;
/* AVprobe context */
static const char *input_filename;
static AVInputFormat *iformat = NULL;
-static const char *binary_unit_prefixes [] = { "", "Ki", "Mi", "Gi", "Ti", "Pi" };
-static const char *decimal_unit_prefixes[] = { "", "K" , "M" , "G" , "T" , "P" };
+static const char *const binary_unit_prefixes [] = { "", "Ki", "Mi", "Gi", "Ti", "Pi" };
+static const char *const decimal_unit_prefixes[] = { "", "K" , "M" , "G" , "T" , "P" };
-static const char *unit_second_str = "s" ;
-static const char *unit_hertz_str = "Hz" ;
-static const char *unit_byte_str = "byte" ;
-static const char *unit_bit_per_second_str = "bit/s";
+static const char unit_second_str[] = "s" ;
+static const char unit_hertz_str[] = "Hz" ;
+static const char unit_byte_str[] = "byte" ;
+static const char unit_bit_per_second_str[] = "bit/s";
-void exit_program(int ret)
+static void exit_program(void)
{
- exit(ret);
+ av_dict_free(&fmt_entries_to_show);
+}
+
+/*
+ * The output is structured in array and objects that might contain items
+ * Array could require the objects within to not be named.
+ * Object could require the items within to be named.
+ *
+ * For flat representation the name of each section is saved on prefix so it
+ * can be rendered in order to represent nested structures (e.g. array of
+ * objects for the packets list).
+ *
+ * Within an array each element can need an unique identifier or an index.
+ *
+ * Nesting level is accounted separately.
+ */
+
+typedef enum {
+ ARRAY,
+ OBJECT
+} ProbeElementType;
+
+typedef struct {
+ const char *name;
+ ProbeElementType type;
+ int64_t index;
+ int64_t nb_elems;
+} ProbeElement;
+
+typedef struct {
+ ProbeElement *prefix;
+ int level;
+ void (*print_header)(void);
+ void (*print_footer)(void);
+
+ void (*print_array_header) (const char *name);
+ void (*print_array_footer) (const char *name);
+ void (*print_object_header)(const char *name);
+ void (*print_object_footer)(const char *name);
+
+ void (*print_integer) (const char *key, int64_t value);
+ void (*print_string) (const char *key, const char *value);
+} OutputContext;
+
+static AVIOContext *probe_out = NULL;
+static OutputContext octx;
+#define AVP_INDENT() avio_printf(probe_out, "%*c", octx.level * 2, ' ')
+
+/*
+ * Default format, INI
+ *
+ * - all key and values are utf8
+ * - '.' is the subgroup separator
+ * - newlines and the following characters are escaped
+ * - '\' is the escape character
+ * - '#' is the comment
+ * - '=' is the key/value separators
+ * - ':' is not used but usually parsed as key/value separator
+ */
+
+static void ini_print_header(void)
+{
+ avio_printf(probe_out, "# avprobe output\n\n");
+}
+static void ini_print_footer(void)
+{
+ avio_w8(probe_out, '\n');
+}
+
+static void ini_escape_print(const char *s)
+{
+ int i = 0;
+ char c = 0;
+
+ while (c = s[i++]) {
+ switch (c) {
+ case '\r': avio_printf(probe_out, "%s", "\\r"); break;
+ case '\n': avio_printf(probe_out, "%s", "\\n"); break;
+ case '\f': avio_printf(probe_out, "%s", "\\f"); break;
+ case '\b': avio_printf(probe_out, "%s", "\\b"); break;
+ case '\t': avio_printf(probe_out, "%s", "\\t"); break;
+ case '\\':
+ case '#' :
+ case '=' :
+ case ':' : avio_w8(probe_out, '\\');
+ default:
+ if ((unsigned char)c < 32)
+ avio_printf(probe_out, "\\x00%02x", c & 0xff);
+ else
+ avio_w8(probe_out, c);
+ break;
+ }
+ }
+}
+
+static void ini_print_array_header(const char *name)
+{
+ if (octx.prefix[octx.level -1].nb_elems)
+ avio_printf(probe_out, "\n");
+}
+
+static void ini_print_object_header(const char *name)
+{
+ int i;
+ ProbeElement *el = octx.prefix + octx.level -1;
+
+ if (el->nb_elems)
+ avio_printf(probe_out, "\n");
+
+ avio_printf(probe_out, "[");
+
+ for (i = 1; i < octx.level; i++) {
+ el = octx.prefix + i;
+ avio_printf(probe_out, "%s.", el->name);
+ if (el->index >= 0)
+ avio_printf(probe_out, "%"PRId64".", el->index);
+ }
+
+ avio_printf(probe_out, "%s", name);
+ if (el && el->type == ARRAY)
+ avio_printf(probe_out, ".%"PRId64"", el->nb_elems);
+ avio_printf(probe_out, "]\n");
+}
+
+static void ini_print_integer(const char *key, int64_t value)
+{
+ ini_escape_print(key);
+ avio_printf(probe_out, "=%"PRId64"\n", value);
+}
+
+
+static void ini_print_string(const char *key, const char *value)
+{
+ ini_escape_print(key);
+ avio_printf(probe_out, "=");
+ ini_escape_print(value);
+ avio_w8(probe_out, '\n');
+}
+
+/*
+ * Alternate format, JSON
+ */
+
+static void json_print_header(void)
+{
+ avio_printf(probe_out, "{");
+}
+static void json_print_footer(void)
+{
+ avio_printf(probe_out, "}\n");
+}
+
+static void json_print_array_header(const char *name)
+{
+ if (octx.prefix[octx.level -1].nb_elems)
+ avio_printf(probe_out, ",\n");
+ AVP_INDENT();
+ avio_printf(probe_out, "\"%s\" : ", name);
+ avio_printf(probe_out, "[\n");
+}
+
+static void json_print_array_footer(const char *name)
+{
+ avio_printf(probe_out, "\n");
+ AVP_INDENT();
+ avio_printf(probe_out, "]");
+}
+
+static void json_print_object_header(const char *name)
+{
+ if (octx.prefix[octx.level -1].nb_elems)
+ avio_printf(probe_out, ",\n");
+ AVP_INDENT();
+ if (octx.prefix[octx.level -1].type == OBJECT)
+ avio_printf(probe_out, "\"%s\" : ", name);
+ avio_printf(probe_out, "{\n");
+}
+
+static void json_print_object_footer(const char *name)
+{
+ avio_printf(probe_out, "\n");
+ AVP_INDENT();
+ avio_printf(probe_out, "}");
+}
+
+static void json_print_integer(const char *key, int64_t value)
+{
+ if (octx.prefix[octx.level -1].nb_elems)
+ avio_printf(probe_out, ",\n");
+ AVP_INDENT();
+ avio_printf(probe_out, "\"%s\" : %"PRId64"", key, value);
+}
+
+static void json_escape_print(const char *s)
+{
+ int i = 0;
+ char c = 0;
+
+ while (c = s[i++]) {
+ switch (c) {
+ case '\r': avio_printf(probe_out, "%s", "\\r"); break;
+ case '\n': avio_printf(probe_out, "%s", "\\n"); break;
+ case '\f': avio_printf(probe_out, "%s", "\\f"); break;
+ case '\b': avio_printf(probe_out, "%s", "\\b"); break;
+ case '\t': avio_printf(probe_out, "%s", "\\t"); break;
+ case '\\':
+ case '"' : avio_w8(probe_out, '\\');
+ default:
+ if ((unsigned char)c < 32)
+ avio_printf(probe_out, "\\u00%02x", c & 0xff);
+ else
+ avio_w8(probe_out, c);
+ break;
+ }
+ }
+}
+
+static void json_print_string(const char *key, const char *value)
+{
+ if (octx.prefix[octx.level -1].nb_elems)
+ avio_printf(probe_out, ",\n");
+ AVP_INDENT();
+ avio_w8(probe_out, '\"');
+ json_escape_print(key);
+ avio_printf(probe_out, "\" : \"");
+ json_escape_print(value);
+ avio_w8(probe_out, '\"');
+}
+
+/*
+ * old-style pseudo-INI
+ */
+static void old_print_object_header(const char *name)
+{
+ char *str, *p;
+
+ if (!strcmp(name, "tags"))
+ return;
+
+ str = p = av_strdup(name);
+ while (*p) {
+ *p = toupper(*p);
+ p++;
+ }
+
+ avio_printf(probe_out, "[%s]\n", str);
+ av_freep(&str);
+}
+
+static void old_print_object_footer(const char *name)
+{
+ char *str, *p;
+
+ if (!strcmp(name, "tags"))
+ return;
+
+ str = p = av_strdup(name);
+ while (*p) {
+ *p = toupper(*p);
+ p++;
+ }
+
+ avio_printf(probe_out, "[/%s]\n", str);
+ av_freep(&str);
+}
+
+static void old_print_string(const char *key, const char *value)
+{
+ if (!strcmp(octx.prefix[octx.level - 1].name, "tags"))
+ avio_printf(probe_out, "TAG:");
+ ini_print_string(key, value);
+}
+
+/*
+ * Simple Formatter for single entries.
+ */
+
+static void show_format_entry_integer(const char *key, int64_t value)
+{
+ if (key && av_dict_get(fmt_entries_to_show, key, NULL, 0)) {
+ if (nb_fmt_entries_to_show > 1)
+ avio_printf(probe_out, "%s=", key);
+ avio_printf(probe_out, "%"PRId64"\n", value);
+ }
+}
+
+static void show_format_entry_string(const char *key, const char *value)
+{
+ if (key && av_dict_get(fmt_entries_to_show, key, NULL, 0)) {
+ if (nb_fmt_entries_to_show > 1)
+ avio_printf(probe_out, "%s=", key);
+ avio_printf(probe_out, "%s\n", value);
+ }
+}
+
+static void probe_group_enter(const char *name, int type)
+{
+ int64_t count = -1;
+
+ octx.prefix =
+ av_realloc(octx.prefix, sizeof(ProbeElement) * (octx.level + 1));
+
+ if (!octx.prefix || !name) {
+ fprintf(stderr, "Out of memory\n");
+ exit(1);
+ }
+
+ if (octx.level) {
+ ProbeElement *parent = octx.prefix + octx.level -1;
+ if (parent->type == ARRAY)
+ count = parent->nb_elems;
+ parent->nb_elems++;
+ }
+
+ octx.prefix[octx.level++] = (ProbeElement){name, type, count, 0};
+}
+
+static void probe_group_leave(void)
+{
+ --octx.level;
+}
+
+static void probe_header(void)
+{
+ if (octx.print_header)
+ octx.print_header();
+ probe_group_enter("root", OBJECT);
+}
+
+static void probe_footer(void)
+{
+ if (octx.print_footer)
+ octx.print_footer();
+ probe_group_leave();
+}
+
+
+static void probe_array_header(const char *name)
+{
+ if (octx.print_array_header)
+ octx.print_array_header(name);
+
+ probe_group_enter(name, ARRAY);
+}
+
+static void probe_array_footer(const char *name)
+{
+ probe_group_leave();
+ if (octx.print_array_footer)
+ octx.print_array_footer(name);
+}
+
+static void probe_object_header(const char *name)
+{
+ if (octx.print_object_header)
+ octx.print_object_header(name);
+
+ probe_group_enter(name, OBJECT);
+}
+
+static void probe_object_footer(const char *name)
+{
+ probe_group_leave();
+ if (octx.print_object_footer)
+ octx.print_object_footer(name);
+}
+
+static void probe_int(const char *key, int64_t value)
+{
+ octx.print_integer(key, value);
+ octx.prefix[octx.level -1].nb_elems++;
+}
+
+static void probe_str(const char *key, const char *value)
+{
+ octx.print_string(key, value);
+ octx.prefix[octx.level -1].nb_elems++;
+}
+
+static void probe_dict(AVDictionary *dict, const char *name)
+{
+ AVDictionaryEntry *entry = NULL;
+ if (!dict)
+ return;
+ probe_object_header(name);
+ while ((entry = av_dict_get(dict, "", entry, AV_DICT_IGNORE_SUFFIX))) {
+ probe_str(entry->key, entry->value);
+ }
+ probe_object_footer(name);
}
static char *value_string(char *buf, int buf_size, double val, const char *unit)
@@ -77,7 +468,7 @@ static char *value_string(char *buf, int buf_size, double val, const char *unit)
int index;
if (unit == unit_byte_str && use_byte_value_binary_prefix) {
- index = (int) (log(val)/log(2)) / 10;
+ index = (int) log2(val) / 10;
index = av_clip(index, 0, FF_ARRAY_ELEMS(binary_unit_prefixes) - 1);
val /= pow(2, index * 10);
prefix_string = binary_unit_prefixes[index];
@@ -87,11 +478,12 @@ static char *value_string(char *buf, int buf_size, double val, const char *unit)
val /= pow(10, index * 3);
prefix_string = decimal_unit_prefixes[index];
}
-
- snprintf(buf, buf_size, "%.3f %s%s", val, prefix_string,
+ snprintf(buf, buf_size, "%.*f%s%s",
+ index ? 3 : 0, val,
+ prefix_string,
show_value_unit ? unit : "");
} else {
- snprintf(buf, buf_size, "%f %s", val, show_value_unit ? unit : "");
+ snprintf(buf, buf_size, "%f%s", val, show_value_unit ? unit : "");
}
return buf;
@@ -109,7 +501,7 @@ static char *time_value_string(char *buf, int buf_size, int64_t val,
return buf;
}
-static char *ts_value_string (char *buf, int buf_size, int64_t ts)
+static char *ts_value_string(char *buf, int buf_size, int64_t ts)
{
if (ts == AV_NOPTS_VALUE) {
snprintf(buf, buf_size, "N/A");
@@ -120,6 +512,21 @@ static char *ts_value_string (char *buf, int buf_size, int64_t ts)
return buf;
}
+static char *rational_string(char *buf, int buf_size, const char *sep,
+ const AVRational *rat)
+{
+ snprintf(buf, buf_size, "%d%s%d", rat->num, sep, rat->den);
+ return buf;
+}
+
+static char *tag_string(char *buf, int buf_size, int tag)
+{
+ snprintf(buf, buf_size, "0x%04x", tag);
+ return buf;
+}
+
+
+
static const char *media_type_string(enum AVMediaType media_type)
{
switch (media_type) {
@@ -137,25 +544,25 @@ static void show_packet(AVFormatContext *fmt_ctx, AVPacket *pkt)
char val_str[128];
AVStream *st = fmt_ctx->streams[pkt->stream_index];
- printf("[PACKET]\n");
- printf("codec_type=%s\n", media_type_string(st->codec->codec_type));
- printf("stream_index=%d\n", pkt->stream_index);
- printf("pts=%s\n", ts_value_string(val_str, sizeof(val_str), pkt->pts));
- printf("pts_time=%s\n", time_value_string(val_str, sizeof(val_str),
- pkt->pts, &st->time_base));
- printf("dts=%s\n", ts_value_string(val_str, sizeof(val_str), pkt->dts));
- printf("dts_time=%s\n", time_value_string(val_str, sizeof(val_str),
- pkt->dts, &st->time_base));
- printf("duration=%s\n", ts_value_string(val_str, sizeof(val_str),
- pkt->duration));
- printf("duration_time=%s\n", time_value_string(val_str, sizeof(val_str),
- pkt->duration,
- &st->time_base));
- printf("size=%s\n", value_string(val_str, sizeof(val_str),
- pkt->size, unit_byte_str));
- printf("pos=%"PRId64"\n", pkt->pos);
- printf("flags=%c\n", pkt->flags & AV_PKT_FLAG_KEY ? 'K' : '_');
- printf("[/PACKET]\n");
+ probe_object_header("packet");
+ probe_str("codec_type", media_type_string(st->codec->codec_type));
+ probe_int("stream_index", pkt->stream_index);
+ probe_str("pts", ts_value_string(val_str, sizeof(val_str), pkt->pts));
+ probe_str("pts_time", time_value_string(val_str, sizeof(val_str),
+ pkt->pts, &st->time_base));
+ probe_str("dts", ts_value_string(val_str, sizeof(val_str), pkt->dts));
+ probe_str("dts_time", time_value_string(val_str, sizeof(val_str),
+ pkt->dts, &st->time_base));
+ probe_str("duration", ts_value_string(val_str, sizeof(val_str),
+ pkt->duration));
+ probe_str("duration_time", time_value_string(val_str, sizeof(val_str),
+ pkt->duration,
+ &st->time_base));
+ probe_str("size", value_string(val_str, sizeof(val_str),
+ pkt->size, unit_byte_str));
+ probe_int("pos", pkt->pos);
+ probe_str("flags", pkt->flags & AV_PKT_FLAG_KEY ? "K" : "_");
+ probe_object_footer("packet");
}
static void show_packets(AVFormatContext *fmt_ctx)
@@ -163,130 +570,141 @@ static void show_packets(AVFormatContext *fmt_ctx)
AVPacket pkt;
av_init_packet(&pkt);
-
+ probe_array_header("packets");
while (!av_read_frame(fmt_ctx, &pkt))
show_packet(fmt_ctx, &pkt);
+ probe_array_footer("packets");
}
static void show_stream(AVFormatContext *fmt_ctx, int stream_idx)
{
AVStream *stream = fmt_ctx->streams[stream_idx];
AVCodecContext *dec_ctx;
- AVCodec *dec;
+ const AVCodec *dec;
+ const char *profile;
char val_str[128];
- AVDictionaryEntry *tag = NULL;
- AVRational display_aspect_ratio;
+ AVRational display_aspect_ratio, *sar = NULL;
+ const AVPixFmtDescriptor *desc;
- printf("[STREAM]\n");
+ probe_object_header("stream");
- printf("index=%d\n", stream->index);
+ probe_int("index", stream->index);
if ((dec_ctx = stream->codec)) {
if ((dec = dec_ctx->codec)) {
- printf("codec_name=%s\n", dec->name);
- printf("codec_long_name=%s\n", dec->long_name);
+ probe_str("codec_name", dec->name);
+ probe_str("codec_long_name", dec->long_name);
} else {
- printf("codec_name=unknown\n");
+ probe_str("codec_name", "unknown");
}
- printf("codec_type=%s\n", media_type_string(dec_ctx->codec_type));
- printf("codec_time_base=%d/%d\n",
- dec_ctx->time_base.num, dec_ctx->time_base.den);
+ probe_str("codec_type", media_type_string(dec_ctx->codec_type));
+ probe_str("codec_time_base",
+ rational_string(val_str, sizeof(val_str),
+ "/", &dec_ctx->time_base));
/* print AVI/FourCC tag */
av_get_codec_tag_string(val_str, sizeof(val_str), dec_ctx->codec_tag);
- printf("codec_tag_string=%s\n", val_str);
- printf("codec_tag=0x%04x\n", dec_ctx->codec_tag);
+ probe_str("codec_tag_string", val_str);
+ probe_str("codec_tag", tag_string(val_str, sizeof(val_str),
+ dec_ctx->codec_tag));
+
+ /* print profile, if there is one */
+ if (dec && (profile = av_get_profile_name(dec, dec_ctx->profile)))
+ probe_str("profile", profile);
switch (dec_ctx->codec_type) {
case AVMEDIA_TYPE_VIDEO:
- printf("width=%d\n", dec_ctx->width);
- printf("height=%d\n", dec_ctx->height);
- printf("has_b_frames=%d\n", dec_ctx->has_b_frames);
- if (dec_ctx->sample_aspect_ratio.num) {
- printf("sample_aspect_ratio=%d:%d\n",
- dec_ctx->sample_aspect_ratio.num,
- dec_ctx->sample_aspect_ratio.den);
+ probe_int("width", dec_ctx->width);
+ probe_int("height", dec_ctx->height);
+ probe_int("has_b_frames", dec_ctx->has_b_frames);
+ if (dec_ctx->sample_aspect_ratio.num)
+ sar = &dec_ctx->sample_aspect_ratio;
+ else if (stream->sample_aspect_ratio.num)
+ sar = &stream->sample_aspect_ratio;
+
+ if (sar) {
+ probe_str("sample_aspect_ratio",
+ rational_string(val_str, sizeof(val_str), ":", sar));
av_reduce(&display_aspect_ratio.num, &display_aspect_ratio.den,
- dec_ctx->width * dec_ctx->sample_aspect_ratio.num,
- dec_ctx->height * dec_ctx->sample_aspect_ratio.den,
+ dec_ctx->width * sar->num, dec_ctx->height * sar->den,
1024*1024);
- printf("display_aspect_ratio=%d:%d\n",
- display_aspect_ratio.num, display_aspect_ratio.den);
+ probe_str("display_aspect_ratio",
+ rational_string(val_str, sizeof(val_str), ":",
+ &display_aspect_ratio));
}
- printf("pix_fmt=%s\n",
- dec_ctx->pix_fmt != PIX_FMT_NONE ? av_pix_fmt_descriptors[dec_ctx->pix_fmt].name
- : "unknown");
- printf("level=%d\n", dec_ctx->level);
+ desc = av_pix_fmt_desc_get(dec_ctx->pix_fmt);
+ probe_str("pix_fmt", desc ? desc->name : "unknown");
+ probe_int("level", dec_ctx->level);
break;
case AVMEDIA_TYPE_AUDIO:
- printf("sample_rate=%s\n", value_string(val_str, sizeof(val_str),
- dec_ctx->sample_rate,
- unit_hertz_str));
- printf("channels=%d\n", dec_ctx->channels);
- printf("bits_per_sample=%d\n",
- av_get_bits_per_sample(dec_ctx->codec_id));
+ probe_str("sample_rate",
+ value_string(val_str, sizeof(val_str),
+ dec_ctx->sample_rate,
+ unit_hertz_str));
+ probe_int("channels", dec_ctx->channels);
+ probe_int("bits_per_sample",
+ av_get_bits_per_sample(dec_ctx->codec_id));
break;
}
} else {
- printf("codec_type=unknown\n");
+ probe_str("codec_type", "unknown");
}
if (fmt_ctx->iformat->flags & AVFMT_SHOW_IDS)
- printf("id=0x%x\n", stream->id);
- printf("r_frame_rate=%d/%d\n",
- stream->r_frame_rate.num, stream->r_frame_rate.den);
- printf("avg_frame_rate=%d/%d\n",
- stream->avg_frame_rate.num, stream->avg_frame_rate.den);
- printf("time_base=%d/%d\n",
- stream->time_base.num, stream->time_base.den);
- printf("start_time=%s\n",
- time_value_string(val_str, sizeof(val_str),
- stream->start_time, &stream->time_base));
- printf("duration=%s\n",
- time_value_string(val_str, sizeof(val_str),
- stream->duration, &stream->time_base));
+ probe_int("id", stream->id);
+ probe_str("avg_frame_rate",
+ rational_string(val_str, sizeof(val_str), "/",
+ &stream->avg_frame_rate));
+ if (dec_ctx->bit_rate)
+ probe_str("bit_rate",
+ value_string(val_str, sizeof(val_str),
+ dec_ctx->bit_rate, unit_bit_per_second_str));
+ probe_str("time_base",
+ rational_string(val_str, sizeof(val_str), "/",
+ &stream->time_base));
+ probe_str("start_time",
+ time_value_string(val_str, sizeof(val_str),
+ stream->start_time, &stream->time_base));
+ probe_str("duration",
+ time_value_string(val_str, sizeof(val_str),
+ stream->duration, &stream->time_base));
if (stream->nb_frames)
- printf("nb_frames=%"PRId64"\n", stream->nb_frames);
+ probe_int("nb_frames", stream->nb_frames);
- while ((tag = av_dict_get(stream->metadata, "", tag,
- AV_DICT_IGNORE_SUFFIX)))
- printf("TAG:%s=%s\n", tag->key, tag->value);
+ probe_dict(stream->metadata, "tags");
- printf("[/STREAM]\n");
+ probe_object_footer("stream");
}
static void show_format(AVFormatContext *fmt_ctx)
{
- AVDictionaryEntry *tag = NULL;
char val_str[128];
int64_t size = fmt_ctx->pb ? avio_size(fmt_ctx->pb) : -1;
- printf("[FORMAT]\n");
-
- printf("filename=%s\n", fmt_ctx->filename);
- printf("nb_streams=%d\n", fmt_ctx->nb_streams);
- printf("format_name=%s\n", fmt_ctx->iformat->name);
- printf("format_long_name=%s\n", fmt_ctx->iformat->long_name);
- printf("start_time=%s\n",
- time_value_string(val_str, sizeof(val_str),
- fmt_ctx->start_time, &AV_TIME_BASE_Q));
- printf("duration=%s\n",
- time_value_string(val_str, sizeof(val_str),
- fmt_ctx->duration, &AV_TIME_BASE_Q));
- printf("size=%s\n", size >= 0 ? value_string(val_str, sizeof(val_str),
- size, unit_byte_str)
+ probe_object_header("format");
+ probe_str("filename", fmt_ctx->filename);
+ probe_int("nb_streams", fmt_ctx->nb_streams);
+ probe_str("format_name", fmt_ctx->iformat->name);
+ probe_str("format_long_name", fmt_ctx->iformat->long_name);
+ probe_str("start_time",
+ time_value_string(val_str, sizeof(val_str),
+ fmt_ctx->start_time, &AV_TIME_BASE_Q));
+ probe_str("duration",
+ time_value_string(val_str, sizeof(val_str),
+ fmt_ctx->duration, &AV_TIME_BASE_Q));
+ probe_str("size",
+ size >= 0 ? value_string(val_str, sizeof(val_str),
+ size, unit_byte_str)
: "unknown");
- printf("bit_rate=%s\n",
- value_string(val_str, sizeof(val_str),
- fmt_ctx->bit_rate, unit_bit_per_second_str));
+ probe_str("bit_rate",
+ value_string(val_str, sizeof(val_str),
+ fmt_ctx->bit_rate, unit_bit_per_second_str));
- while ((tag = av_dict_get(fmt_ctx->metadata, "", tag,
- AV_DICT_IGNORE_SUFFIX)))
- printf("TAG:%s=%s\n", tag->key, tag->value);
+ probe_dict(fmt_ctx->metadata, "tags");
- printf("[/FORMAT]\n");
+ probe_object_footer("format");
}
static int open_input_file(AVFormatContext **fmt_ctx_ptr, const char *filename)
@@ -319,7 +737,10 @@ static int open_input_file(AVFormatContext **fmt_ctx_ptr, const char *filename)
AVStream *stream = fmt_ctx->streams[i];
AVCodec *codec;
- if (!(codec = avcodec_find_decoder(stream->codec->codec_id))) {
+ if (stream->codec->codec_id == AV_CODEC_ID_PROBE) {
+ fprintf(stderr, "Failed to probe codec for input stream %d\n",
+ stream->index);
+ } else if (!(codec = avcodec_find_decoder(stream->codec->codec_id))) {
fprintf(stderr,
"Unsupported codec with id %d for input stream %d\n",
stream->codec->codec_id, stream->index);
@@ -333,6 +754,20 @@ static int open_input_file(AVFormatContext **fmt_ctx_ptr, const char *filename)
return 0;
}
+static void close_input_file(AVFormatContext **ctx_ptr)
+{
+ int i;
+ AVFormatContext *fmt_ctx = *ctx_ptr;
+
+ /* close decoder for each stream */
+ for (i = 0; i < fmt_ctx->nb_streams; i++) {
+ AVStream *stream = fmt_ctx->streams[i];
+
+ avcodec_close(stream->codec);
+ }
+ avformat_close_input(ctx_ptr);
+}
+
static int probe_file(const char *filename)
{
AVFormatContext *fmt_ctx;
@@ -341,17 +776,20 @@ static int probe_file(const char *filename)
if ((ret = open_input_file(&fmt_ctx, filename)))
return ret;
- if (do_show_packets)
- show_packets(fmt_ctx);
+ if (do_show_format)
+ show_format(fmt_ctx);
- if (do_show_streams)
+ if (do_show_streams) {
+ probe_array_header("streams");
for (i = 0; i < fmt_ctx->nb_streams; i++)
show_stream(fmt_ctx, i);
+ probe_array_footer("streams");
+ }
- if (do_show_format)
- show_format(fmt_ctx);
+ if (do_show_packets)
+ show_packets(fmt_ctx);
- avformat_close_input(&fmt_ctx);
+ close_input_file(&fmt_ctx);
return 0;
}
@@ -362,7 +800,7 @@ static void show_usage(void)
printf("\n");
}
-static int opt_format(const char *opt, const char *arg)
+static int opt_format(void *optctx, const char *opt, const char *arg)
{
iformat = av_find_input_format(arg);
if (!iformat) {
@@ -372,6 +810,57 @@ static int opt_format(const char *opt, const char *arg)
return 0;
}
+static int opt_output_format(void *optctx, const char *opt, const char *arg)
+{
+
+ if (!strcmp(arg, "json")) {
+ octx.print_header = json_print_header;
+ octx.print_footer = json_print_footer;
+ octx.print_array_header = json_print_array_header;
+ octx.print_array_footer = json_print_array_footer;
+ octx.print_object_header = json_print_object_header;
+ octx.print_object_footer = json_print_object_footer;
+
+ octx.print_integer = json_print_integer;
+ octx.print_string = json_print_string;
+ } else if (!strcmp(arg, "ini")) {
+ octx.print_header = ini_print_header;
+ octx.print_footer = ini_print_footer;
+ octx.print_array_header = ini_print_array_header;
+ octx.print_object_header = ini_print_object_header;
+
+ octx.print_integer = ini_print_integer;
+ octx.print_string = ini_print_string;
+ } else if (!strcmp(arg, "old")) {
+ octx.print_header = NULL;
+ octx.print_object_header = old_print_object_header;
+ octx.print_object_footer = old_print_object_footer;
+
+ octx.print_string = old_print_string;
+ } else {
+ av_log(NULL, AV_LOG_ERROR, "Unsupported formatter %s\n", arg);
+ return AVERROR(EINVAL);
+ }
+ return 0;
+}
+
+static int opt_show_format_entry(void *optctx, const char *opt, const char *arg)
+{
+ do_show_format = 1;
+ nb_fmt_entries_to_show++;
+ octx.print_header = NULL;
+ octx.print_footer = NULL;
+ octx.print_array_header = NULL;
+ octx.print_array_footer = NULL;
+ octx.print_object_header = NULL;
+ octx.print_object_footer = NULL;
+
+ octx.print_integer = show_format_entry_integer;
+ octx.print_string = show_format_entry_string;
+ av_dict_set(&fmt_entries_to_show, arg, "", 0);
+ return 0;
+}
+
static void opt_input_file(void *optctx, const char *arg)
{
if (input_filename) {
@@ -385,48 +874,67 @@ static void opt_input_file(void *optctx, const char *arg)
input_filename = arg;
}
-static void show_help(void)
+void show_help_default(const char *opt, const char *arg)
{
av_log_set_callback(log_callback_help);
show_usage();
- show_help_options(options, "Main options:\n", 0, 0);
+ show_help_options(options, "Main options:", 0, 0, 0);
printf("\n");
show_help_children(avformat_get_class(), AV_OPT_FLAG_DECODING_PARAM);
}
-static void opt_pretty(void)
+static int opt_pretty(void *optctx, const char *opt, const char *arg)
{
show_value_unit = 1;
use_value_prefix = 1;
use_byte_value_binary_prefix = 1;
use_value_sexagesimal_format = 1;
+ return 0;
}
-static const OptionDef options[] = {
+static const OptionDef real_options[] = {
#include "cmdutils_common_opts.h"
- { "f", HAS_ARG, {(void*)opt_format}, "force format", "format" },
- { "unit", OPT_BOOL, {(void*)&show_value_unit},
+ { "f", HAS_ARG, {.func_arg = opt_format}, "force format", "format" },
+ { "of", HAS_ARG, {.func_arg = opt_output_format}, "output the document either as ini or json", "output_format" },
+ { "unit", OPT_BOOL, {&show_value_unit},
"show unit of the displayed values" },
- { "prefix", OPT_BOOL, {(void*)&use_value_prefix},
+ { "prefix", OPT_BOOL, {&use_value_prefix},
"use SI prefixes for the displayed values" },
- { "byte_binary_prefix", OPT_BOOL, {(void*)&use_byte_value_binary_prefix},
+ { "byte_binary_prefix", OPT_BOOL, {&use_byte_value_binary_prefix},
"use binary prefixes for byte units" },
- { "sexagesimal", OPT_BOOL, {(void*)&use_value_sexagesimal_format},
+ { "sexagesimal", OPT_BOOL, {&use_value_sexagesimal_format},
"use sexagesimal format HOURS:MM:SS.MICROSECONDS for time units" },
- { "pretty", 0, {(void*)&opt_pretty},
+ { "pretty", 0, {.func_arg = opt_pretty},
"prettify the format of displayed values, make it more human readable" },
- { "show_format", OPT_BOOL, {(void*)&do_show_format} , "show format/container info" },
- { "show_packets", OPT_BOOL, {(void*)&do_show_packets}, "show packets info" },
- { "show_streams", OPT_BOOL, {(void*)&do_show_streams}, "show streams info" },
- { "default", HAS_ARG | OPT_AUDIO | OPT_VIDEO | OPT_EXPERT, {(void*)opt_default},
+ { "show_format", OPT_BOOL, {&do_show_format} , "show format/container info" },
+ { "show_format_entry", HAS_ARG, {.func_arg = opt_show_format_entry},
+ "show a particular entry from the format/container info", "entry" },
+ { "show_packets", OPT_BOOL, {&do_show_packets}, "show packets info" },
+ { "show_streams", OPT_BOOL, {&do_show_streams}, "show streams info" },
+ { "default", HAS_ARG | OPT_AUDIO | OPT_VIDEO | OPT_EXPERT, {.func_arg = opt_default},
"generic catch all option", "" },
{ NULL, },
};
+static int probe_buf_write(void *opaque, uint8_t *buf, int buf_size)
+{
+ printf("%.*s", buf_size, buf);
+ return 0;
+}
+
+#define AVP_BUFFSIZE 4096
+
int main(int argc, char **argv)
{
int ret;
+ uint8_t *buffer = av_malloc(AVP_BUFFSIZE);
+
+ if (!buffer)
+ exit(1);
+
+ atexit(exit_program);
+ options = real_options;
parse_loglevel(argc, argv, options);
av_register_all();
avformat_network_init();
@@ -436,6 +944,16 @@ int main(int argc, char **argv)
#endif
show_banner();
+
+ octx.print_header = ini_print_header;
+ octx.print_footer = ini_print_footer;
+
+ octx.print_array_header = ini_print_array_header;
+ octx.print_object_header = ini_print_object_header;
+
+ octx.print_integer = ini_print_integer;
+ octx.print_string = ini_print_string;
+
parse_options(NULL, argc, argv, options, opt_input_file);
if (!input_filename) {
@@ -447,7 +965,16 @@ int main(int argc, char **argv)
exit(1);
}
+ probe_out = avio_alloc_context(buffer, AVP_BUFFSIZE, 1, NULL, NULL,
+ probe_buf_write, NULL);
+ if (!probe_out)
+ exit(1);
+
+ probe_header();
ret = probe_file(input_filename);
+ probe_footer();
+ avio_flush(probe_out);
+ avio_close(probe_out);
avformat_network_deinit();
diff --git a/gst-libs/ext/libav/avserver.c b/gst-libs/ext/libav/avserver.c
index 15fa64c..ad7bc78 100644
--- a/gst-libs/ext/libav/avserver.c
+++ b/gst-libs/ext/libav/avserver.c
@@ -25,21 +25,28 @@
#endif
#include <string.h>
#include <stdlib.h>
+#include <stdio.h>
#include "libavformat/avformat.h"
+// FIXME those are internal headers, avserver _really_ shouldn't use them
#include "libavformat/ffm.h"
#include "libavformat/network.h"
#include "libavformat/os_support.h"
#include "libavformat/rtpdec.h"
#include "libavformat/rtsp.h"
-// XXX for ffio_open_dyn_packet_buffer, to be removed
#include "libavformat/avio_internal.h"
+#include "libavformat/internal.h"
+#include "libavformat/url.h"
+
#include "libavutil/avstring.h"
#include "libavutil/lfg.h"
#include "libavutil/dict.h"
+#include "libavutil/intreadwrite.h"
#include "libavutil/mathematics.h"
#include "libavutil/random_seed.h"
#include "libavutil/parseutils.h"
#include "libavutil/opt.h"
+#include "libavutil/time.h"
+
#include <stdarg.h>
#include <unistd.h>
#include <fcntl.h>
@@ -48,7 +55,6 @@
#include <poll.h>
#endif
#include <errno.h>
-#include <sys/time.h>
#include <time.h>
#include <sys/wait.h>
#include <signal.h>
@@ -296,12 +302,10 @@ static int rtp_new_av_stream(HTTPContext *c,
HTTPContext *rtsp_c);
static const char *my_program_name;
-static const char *my_program_dir;
static const char *config_filename = "/etc/avserver.conf";
static int avserver_debug;
-static int avserver_daemon;
static int no_launch;
static int need_to_start_children;
@@ -319,9 +323,35 @@ static AVLFG random_state;
static FILE *logfile = NULL;
-void exit_program(int ret)
+static int64_t ffm_read_write_index(int fd)
+{
+ uint8_t buf[8];
+
+ lseek(fd, 8, SEEK_SET);
+ if (read(fd, buf, 8) != 8)
+ return AVERROR(EIO);
+ return AV_RB64(buf);
+}
+
+static int ffm_write_write_index(int fd, int64_t pos)
+{
+ uint8_t buf[8];
+ int i;
+
+ for(i=0;i<8;i++)
+ buf[i] = (pos >> (56 - i * 8)) & 0xff;
+ lseek(fd, 8, SEEK_SET);
+ if (write(fd, buf, 8) != 8)
+ return AVERROR(EIO);
+ return 8;
+}
+
+static void ffm_set_write_index(AVFormatContext *s, int64_t pos,
+ int64_t file_size)
{
- exit(ret);
+ FFMContext *ffm = s->priv_data;
+ ffm->write_index = pos;
+ ffm->file_size = file_size;
}
/* FIXME: make avserver work with IPv6 */
@@ -332,8 +362,7 @@ static int resolve_host(struct in_addr *sin_addr, const char *hostname)
if (!ff_inet_aton(hostname, sin_addr)) {
#if HAVE_GETADDRINFO
struct addrinfo *ai, *cur;
- struct addrinfo hints;
- memset(&hints, 0, sizeof(hints));
+ struct addrinfo hints = { 0 };
hints.ai_family = AF_INET;
if (getaddrinfo(hostname, NULL, &hints, &ai))
return -1;
@@ -485,18 +514,14 @@ static void start_children(FFStream *feed)
close(i);
if (!avserver_debug) {
- i = open("/dev/null", O_RDWR);
- if (i != -1) {
- dup2(i, 0);
- dup2(i, 1);
- dup2(i, 2);
- close(i);
- }
+ if (!freopen("/dev/null", "r", stdin))
+ http_log("failed to redirect STDIN to /dev/null\n;");
+ if (!freopen("/dev/null", "w", stdout))
+ http_log("failed to redirect STDOUT to /dev/null\n;");
+ if (!freopen("/dev/null", "w", stderr))
+ http_log("failed to redirect STDERR to /dev/null\n;");
}
- /* This is needed to make relative pathnames work */
- chdir(my_program_dir);
-
signal(SIGPIPE, SIG_DFL);
execvp(pathname, feed->child_argv);
@@ -769,7 +794,8 @@ static void http_send_too_busy_reply(int fd)
static void new_connection(int server_fd, int is_rtsp)
{
struct sockaddr_in from_addr;
- int fd, len;
+ socklen_t len;
+ int fd;
HTTPContext *c = NULL;
len = sizeof(from_addr);
@@ -867,7 +893,7 @@ static void close_connection(HTTPContext *c)
}
h = c->rtp_handles[i];
if (h)
- url_close(h);
+ ffurl_close(h);
}
ctx = &c->fmt_ctx;
@@ -1452,7 +1478,8 @@ enum RedirType {
/* parse http request and prepare header */
static int http_parse_request(HTTPContext *c)
{
- char *p;
+ const char *p;
+ char *p1;
enum RedirType redir_type;
char cmd[32];
char info[1024], filename[1024];
@@ -1463,10 +1490,10 @@ static int http_parse_request(HTTPContext *c)
FFStream *stream;
int i;
char ratebuf[32];
- char *useragent = 0;
+ const char *useragent = 0;
p = c->buffer;
- get_word(cmd, sizeof(cmd), (const char **)&p);
+ get_word(cmd, sizeof(cmd), &p);
av_strlcpy(c->method, cmd, sizeof(c->method));
if (!strcmp(cmd, "GET"))
@@ -1476,7 +1503,7 @@ static int http_parse_request(HTTPContext *c)
else
return -1;
- get_word(url, sizeof(url), (const char **)&p);
+ get_word(url, sizeof(url), &p);
av_strlcpy(c->url, url, sizeof(c->url));
get_word(protocol, sizeof(protocol), (const char **)&p);
@@ -1489,10 +1516,10 @@ static int http_parse_request(HTTPContext *c)
http_log("%s - - New connection: %s %s\n", inet_ntoa(c->from_addr.sin_addr), cmd, url);
/* find the filename and the optional info string in the request */
- p = strchr(url, '?');
- if (p) {
- av_strlcpy(info, p, sizeof(info));
- *p = '\0';
+ p1 = strchr(url, '?');
+ if (p1) {
+ av_strlcpy(info, p1, sizeof(info));
+ *p1 = '\0';
} else
info[0] = '\0';
@@ -1609,7 +1636,7 @@ static int http_parse_request(HTTPContext *c)
}
if (redir_type != REDIR_NONE) {
- char *hostinfo = 0;
+ const char *hostinfo = 0;
for (p = c->buffer; *p && *p != '\r' && *p != '\n'; ) {
if (av_strncasecmp(p, "Host:", 5) == 0) {
@@ -1687,7 +1714,8 @@ static int http_parse_request(HTTPContext *c)
case REDIR_SDP:
{
uint8_t *sdp_data;
- int sdp_data_size, len;
+ int sdp_data_size;
+ socklen_t len;
struct sockaddr_in my_addr;
q += snprintf(q, c->buffer_size,
@@ -1737,7 +1765,7 @@ static int http_parse_request(HTTPContext *c)
if (!stream->is_feed) {
/* However it might be a status report from WMP! Let us log the
* data as it might come in handy one day. */
- char *logline = 0;
+ const char *logline = 0;
int client_id = 0;
for (p = c->buffer; *p && *p != '\r' && *p != '\n'; ) {
@@ -1862,7 +1890,7 @@ static int http_parse_request(HTTPContext *c)
static void fmt_bytecount(AVIOContext *pb, int64_t count)
{
- static const char *suffix = " kMGTP";
+ static const char suffix[] = " kMGTP";
const char *s;
for (s = suffix; count >= 100000 && s[1]; count /= 1000, s++);
@@ -2248,7 +2276,6 @@ static int http_prepare_data(HTTPContext *c)
* Default value from Libav
* Try to set it use configuration option
*/
- c->fmt_ctx.preload = (int)(0.5*AV_TIME_BASE);
c->fmt_ctx.max_delay = (int)(0.7*AV_TIME_BASE);
if (avformat_write_header(&c->fmt_ctx, NULL) < 0) {
@@ -2367,7 +2394,7 @@ static int http_prepare_data(HTTPContext *c)
if (c->rtp_protocol == RTSP_LOWER_TRANSPORT_TCP)
max_packet_size = RTSP_TCP_MAX_PACKET_SIZE;
else
- max_packet_size = url_get_max_packet_size(c->rtp_handles[c->packet_stream_index]);
+ max_packet_size = c->rtp_handles[c->packet_stream_index]->max_packet_size;
ret = ffio_open_dyn_packet_buf(&ctx->pb, max_packet_size);
} else {
ret = avio_open_dyn_buf(&ctx->pb);
@@ -2520,8 +2547,8 @@ static int http_send_data(HTTPContext *c)
} else {
/* send RTP packet directly in UDP */
c->buffer_ptr += 4;
- url_write(c->rtp_handles[c->packet_stream_index],
- c->buffer_ptr, len);
+ ffurl_write(c->rtp_handles[c->packet_stream_index],
+ c->buffer_ptr, len);
c->buffer_ptr += len;
/* here we continue as we can send several packets per 10 ms slot */
}
@@ -2571,8 +2598,11 @@ static int http_start_receive_data(HTTPContext *c)
if (c->stream->truncate) {
/* truncate feed file */
ffm_write_write_index(c->feed_fd, FFM_PACKET_SIZE);
- ftruncate(c->feed_fd, FFM_PACKET_SIZE);
http_log("Truncating feed file '%s'\n", c->stream->feed_filename);
+ if (ftruncate(c->feed_fd, FFM_PACKET_SIZE) < 0) {
+ http_log("Error truncating feed file: %s\n", strerror(errno));
+ return -1;
+ }
} else {
if ((c->stream->feed_write_index = ffm_read_write_index(fd)) < 0) {
http_log("Error reading write index from feed file: %s\n", strerror(errno));
@@ -2658,8 +2688,6 @@ static int http_receive_data(HTTPContext *c)
/* a packet has been received : write it in the store, except
if header */
if (c->data_count > FFM_PACKET_SIZE) {
-
- // printf("writing pos=0x%"PRIx64" size=0x%"PRIx64"\n", feed->feed_write_index, feed->feed_size);
/* XXX: use llseek or url_seek */
lseek(c->feed_fd, feed->feed_write_index, SEEK_SET);
if (write(c->feed_fd, c->buffer, FFM_PACKET_SIZE) < 0) {
@@ -2820,7 +2848,7 @@ static int rtsp_parse_request(HTTPContext *c)
char protocol[32];
char line[1024];
int len;
- RTSPMessageHeader header1, *header = &header1;
+ RTSPMessageHeader header1 = { 0 }, *header = &header1;
c->buffer_ptr[0] = '\0';
p = c->buffer;
@@ -2846,7 +2874,6 @@ static int rtsp_parse_request(HTTPContext *c)
}
/* parse each header line */
- memset(header, 0, sizeof(*header));
/* skip to next line */
while (*p != '\n' && *p != '\0')
p++;
@@ -2962,7 +2989,8 @@ static void rtsp_cmd_describe(HTTPContext *c, const char *url)
char path1[1024];
const char *path;
uint8_t *content;
- int content_length, len;
+ int content_length;
+ socklen_t len;
struct sockaddr_in my_addr;
/* find which url is asked */
@@ -3404,10 +3432,10 @@ static int rtp_new_av_stream(HTTPContext *c,
"rtp://%s:%d", ipaddr, ntohs(dest_addr->sin_port));
}
- if (url_open(&h, ctx->filename, AVIO_FLAG_WRITE) < 0)
+ if (ffurl_open(&h, ctx->filename, AVIO_FLAG_WRITE, NULL, NULL) < 0)
goto fail;
c->rtp_handles[stream_index] = h;
- max_packet_size = url_get_max_packet_size(h);
+ max_packet_size = h->max_packet_size;
break;
case RTSP_LOWER_TRANSPORT_TCP:
/* RTP/TCP case */
@@ -3430,7 +3458,7 @@ static int rtp_new_av_stream(HTTPContext *c,
if (avformat_write_header(ctx, NULL) < 0) {
fail:
if (h)
- url_close(h);
+ ffurl_close(h);
av_free(ctx);
return -1;
}
@@ -3467,7 +3495,7 @@ static AVStream *add_av_stream1(FFStream *stream, AVCodecContext *codec, int cop
}
fst->priv_data = av_mallocz(sizeof(FeedData));
fst->index = stream->nb_streams;
- av_set_pts_info(fst, 33, 1, 90000);
+ avpriv_set_pts_info(fst, 33, 1, 90000);
fst->sample_aspect_ratio = codec->sample_aspect_ratio;
stream->streams[stream->nb_streams++] = fst;
return fst;
@@ -3534,10 +3562,12 @@ static void extract_mpeg4_header(AVFormatContext *infile)
AVStream *st;
const uint8_t *p;
+ infile->flags |= AVFMT_FLAG_NOFILLIN | AVFMT_FLAG_NOPARSE;
+
mpeg4_count = 0;
for(i=0;i<infile->nb_streams;i++) {
st = infile->streams[i];
- if (st->codec->codec_id == CODEC_ID_MPEG4 &&
+ if (st->codec->codec_id == AV_CODEC_ID_MPEG4 &&
st->codec->extradata_size == 0) {
mpeg4_count++;
}
@@ -3547,10 +3577,10 @@ static void extract_mpeg4_header(AVFormatContext *infile)
printf("MPEG4 without extra data: trying to find header in %s\n", infile->filename);
while (mpeg4_count > 0) {
- if (av_read_packet(infile, &pkt) < 0)
+ if (av_read_frame(infile, &pkt) < 0)
break;
st = infile->streams[pkt.stream_index];
- if (st->codec->codec_id == CODEC_ID_MPEG4 &&
+ if (st->codec->codec_id == AV_CODEC_ID_MPEG4 &&
st->codec->extradata_size == 0) {
av_freep(&st->codec->extradata);
/* fill extradata with the header */
@@ -3864,22 +3894,22 @@ static void add_codec(FFStream *stream, AVCodecContext *av)
memcpy(st->codec, av, sizeof(AVCodecContext));
}
-static enum CodecID opt_audio_codec(const char *arg)
+static enum AVCodecID opt_audio_codec(const char *arg)
{
AVCodec *p= avcodec_find_encoder_by_name(arg);
if (p == NULL || p->type != AVMEDIA_TYPE_AUDIO)
- return CODEC_ID_NONE;
+ return AV_CODEC_ID_NONE;
return p->id;
}
-static enum CodecID opt_video_codec(const char *arg)
+static enum AVCodecID opt_video_codec(const char *arg)
{
AVCodec *p= avcodec_find_encoder_by_name(arg);
if (p == NULL || p->type != AVMEDIA_TYPE_VIDEO)
- return CODEC_ID_NONE;
+ return AV_CODEC_ID_NONE;
return p->id;
}
@@ -3922,7 +3952,7 @@ static int avserver_opt_default(const char *opt, const char *arg,
static int avserver_opt_preset(const char *arg,
AVCodecContext *avctx, int type,
- enum CodecID *audio_id, enum CodecID *video_id)
+ enum AVCodecID *audio_id, enum AVCodecID *video_id)
{
FILE *f=NULL;
char filename[1000], tmp[1000], tmp2[1000], line[1000];
@@ -4004,7 +4034,7 @@ static int parse_ffconfig(const char *filename)
FFStream **last_stream, *stream, *redirect;
FFStream **last_feed, *feed, *s;
AVCodecContext audio_enc, video_enc;
- enum CodecID audio_id, video_id;
+ enum AVCodecID audio_id, video_id;
f = fopen(filename, "r");
if (!f) {
@@ -4021,8 +4051,8 @@ static int parse_ffconfig(const char *filename)
stream = NULL;
feed = NULL;
redirect = NULL;
- audio_id = CODEC_ID_NONE;
- video_id = CODEC_ID_NONE;
+ audio_id = AV_CODEC_ID_NONE;
+ video_id = AV_CODEC_ID_NONE;
#define ERROR(...) report_config_error(filename, line_num, &errors, __VA_ARGS__)
for(;;) {
@@ -4049,8 +4079,6 @@ static int parse_ffconfig(const char *filename)
if (resolve_host(&my_http_addr.sin_addr, arg) != 0) {
ERROR("%s:%d: Invalid host/IP address: %s\n", arg);
}
- } else if (!av_strcasecmp(cmd, "NoDaemon")) {
- avserver_daemon = 0;
} else if (!av_strcasecmp(cmd, "RTSPPort")) {
get_arg(arg, sizeof(arg), &p);
val = atoi(arg);
@@ -4214,8 +4242,8 @@ static int parse_ffconfig(const char *filename)
stream->fmt = avserver_guess_format(NULL, stream->filename, NULL);
avcodec_get_context_defaults3(&video_enc, NULL);
avcodec_get_context_defaults3(&audio_enc, NULL);
- audio_id = CODEC_ID_NONE;
- video_id = CODEC_ID_NONE;
+ audio_id = AV_CODEC_ID_NONE;
+ video_id = AV_CODEC_ID_NONE;
if (stream->fmt) {
audio_id = stream->fmt->audio_codec;
video_id = stream->fmt->video_codec;
@@ -4297,13 +4325,13 @@ static int parse_ffconfig(const char *filename)
} else if (!av_strcasecmp(cmd, "AudioCodec")) {
get_arg(arg, sizeof(arg), &p);
audio_id = opt_audio_codec(arg);
- if (audio_id == CODEC_ID_NONE) {
+ if (audio_id == AV_CODEC_ID_NONE) {
ERROR("Unknown AudioCodec: %s\n", arg);
}
} else if (!av_strcasecmp(cmd, "VideoCodec")) {
get_arg(arg, sizeof(arg), &p);
video_id = opt_video_codec(arg);
- if (video_id == CODEC_ID_NONE) {
+ if (video_id == AV_CODEC_ID_NONE) {
ERROR("Unknown VideoCodec: %s\n", arg);
}
} else if (!av_strcasecmp(cmd, "MaxTime")) {
@@ -4494,9 +4522,9 @@ static int parse_ffconfig(const char *filename)
if (stream)
video_enc.dark_masking = atof(arg);
} else if (!av_strcasecmp(cmd, "NoVideo")) {
- video_id = CODEC_ID_NONE;
+ video_id = AV_CODEC_ID_NONE;
} else if (!av_strcasecmp(cmd, "NoAudio")) {
- audio_id = CODEC_ID_NONE;
+ audio_id = AV_CODEC_ID_NONE;
} else if (!av_strcasecmp(cmd, "ACL")) {
parse_acl_row(stream, feed, NULL, p, filename, line_num);
} else if (!av_strcasecmp(cmd, "DynamicACL")) {
@@ -4534,12 +4562,12 @@ static int parse_ffconfig(const char *filename)
ERROR("No corresponding <Stream> for </Stream>\n");
} else {
if (stream->feed && stream->fmt && strcmp(stream->fmt->name, "ffm") != 0) {
- if (audio_id != CODEC_ID_NONE) {
+ if (audio_id != AV_CODEC_ID_NONE) {
audio_enc.codec_type = AVMEDIA_TYPE_AUDIO;
audio_enc.codec_id = audio_id;
add_codec(stream, &audio_enc);
}
- if (video_id != CODEC_ID_NONE) {
+ if (video_id != AV_CODEC_ID_NONE) {
video_enc.codec_type = AVMEDIA_TYPE_VIDEO;
video_enc.codec_id = video_id;
add_codec(stream, &video_enc);
@@ -4623,16 +4651,15 @@ static void handle_child_exit(int sig)
static void opt_debug(void)
{
avserver_debug = 1;
- avserver_daemon = 0;
logfilename[0] = '-';
}
-static void show_help(void)
+void show_help_default(const char *opt, const char *arg)
{
printf("usage: avserver [options]\n"
"Hyper fast multi format Audio/Video streaming server\n");
printf("\n");
- show_help_options(options, "Main options:\n", 0, 0);
+ show_help_options(options, "Main options:", 0, 0, 0);
}
static const OptionDef options[] = {
@@ -4645,7 +4672,7 @@ static const OptionDef options[] = {
int main(int argc, char **argv)
{
- struct sigaction sigact;
+ struct sigaction sigact = { { 0 } };
parse_loglevel(argc, argv, options);
av_register_all();
@@ -4654,8 +4681,6 @@ int main(int argc, char **argv)
show_banner();
my_program_name = argv[0];
- my_program_dir = getcwd(0, 0);
- avserver_daemon = 1;
parse_options(NULL, argc, argv, options, NULL);
@@ -4663,7 +4688,6 @@ int main(int argc, char **argv)
av_lfg_init(&random_state, av_get_random_seed());
- memset(&sigact, 0, sizeof(sigact));
sigact.sa_handler = handle_child_exit;
sigact.sa_flags = SA_NOCLDSTOP | SA_RESTART;
sigaction(SIGCHLD, &sigact, 0);
@@ -4688,37 +4712,9 @@ int main(int argc, char **argv)
compute_bandwidth();
- /* put the process in background and detach it from its TTY */
- if (avserver_daemon) {
- int pid;
-
- pid = fork();
- if (pid < 0) {
- perror("fork");
- exit(1);
- } else if (pid > 0) {
- /* parent : exit */
- exit(0);
- } else {
- /* child */
- setsid();
- close(0);
- open("/dev/null", O_RDWR);
- if (strcmp(logfilename, "-") != 0) {
- close(1);
- dup(0);
- }
- close(2);
- dup(0);
- }
- }
-
/* signal init */
signal(SIGPIPE, SIG_IGN);
- if (avserver_daemon)
- chdir("/");
-
if (http_server() < 0) {
http_log("Could not start server\n");
exit(1);
diff --git a/gst-libs/ext/libav/cmdutils.c b/gst-libs/ext/libav/cmdutils.c
index 3ba5d0c..8fa6082 100644
--- a/gst-libs/ext/libav/cmdutils.c
+++ b/gst-libs/ext/libav/cmdutils.c
@@ -32,12 +32,12 @@
#include "libavformat/avformat.h"
#include "libavfilter/avfilter.h"
#include "libavdevice/avdevice.h"
+#include "libavresample/avresample.h"
#include "libswscale/swscale.h"
-#if CONFIG_POSTPROC
-#include "libpostproc/postprocess.h"
-#endif
+#include "libavutil/avassert.h"
#include "libavutil/avstring.h"
#include "libavutil/mathematics.h"
+#include "libavutil/imgutils.h"
#include "libavutil/parseutils.h"
#include "libavutil/pixdesc.h"
#include "libavutil/eval.h"
@@ -49,6 +49,7 @@
#include "libavformat/network.h"
#endif
#if HAVE_SYS_RESOURCE_H
+#include <sys/time.h>
#include <sys/resource.h>
#endif
@@ -97,7 +98,7 @@ double parse_number_or_die(const char *context, const char *numstr, int type,
else
return d;
av_log(NULL, AV_LOG_FATAL, error, context, numstr, min, max);
- exit_program(1);
+ exit(1);
return 0;
}
@@ -108,13 +109,13 @@ int64_t parse_time_or_die(const char *context, const char *timestr,
if (av_parse_time(&us, timestr, is_duration) < 0) {
av_log(NULL, AV_LOG_FATAL, "Invalid %s specification for %s: %s\n",
is_duration ? "duration" : "date", context, timestr);
- exit_program(1);
+ exit(1);
}
return us;
}
-void show_help_options(const OptionDef *options, const char *msg, int mask,
- int value)
+void show_help_options(const OptionDef *options, const char *msg, int req_flags,
+ int rej_flags, int alt_flags)
{
const OptionDef *po;
int first;
@@ -122,19 +123,24 @@ void show_help_options(const OptionDef *options, const char *msg, int mask,
first = 1;
for (po = options; po->name != NULL; po++) {
char buf[64];
- if ((po->flags & mask) == value) {
- if (first) {
- printf("%s", msg);
- first = 0;
- }
- av_strlcpy(buf, po->name, sizeof(buf));
- if (po->flags & HAS_ARG) {
- av_strlcat(buf, " ", sizeof(buf));
- av_strlcat(buf, po->argname, sizeof(buf));
- }
- printf("-%-17s %s\n", buf, po->help);
+
+ if (((po->flags & req_flags) != req_flags) ||
+ (alt_flags && !(po->flags & alt_flags)) ||
+ (po->flags & rej_flags))
+ continue;
+
+ if (first) {
+ printf("%s\n", msg);
+ first = 0;
}
+ av_strlcpy(buf, po->name, sizeof(buf));
+ if (po->argname) {
+ av_strlcat(buf, " ", sizeof(buf));
+ av_strlcat(buf, po->argname, sizeof(buf));
+ }
+ printf("-%-17s %s\n", buf, po->help);
}
+ printf("\n");
}
void show_help_children(const AVClass *class, int flags)
@@ -160,8 +166,9 @@ static const OptionDef *find_option(const OptionDef *po, const char *name)
return po;
}
-#if defined(_WIN32) && !defined(__MINGW32CE__)
+#if HAVE_COMMANDLINETOARGVW
#include <windows.h>
+#include <shellapi.h>
/* Will be leaked on exit */
static char** win32_argv_utf8 = NULL;
static int win32_argc = 0;
@@ -219,40 +226,16 @@ static inline void prepare_app_arguments(int *argc_ptr, char ***argv_ptr)
{
/* nothing to do */
}
-#endif /* WIN32 && !__MINGW32CE__ */
+#endif /* HAVE_COMMANDLINETOARGVW */
-int parse_option(void *optctx, const char *opt, const char *arg,
- const OptionDef *options)
+static int write_option(void *optctx, const OptionDef *po, const char *opt,
+ const char *arg)
{
- const OptionDef *po;
- int bool_val = 1;
- int *dstcount;
- void *dst;
-
- po = find_option(options, opt);
- if (!po->name && opt[0] == 'n' && opt[1] == 'o') {
- /* handle 'no' bool option */
- po = find_option(options, opt + 2);
- if (!(po->name && (po->flags & OPT_BOOL)))
- goto unknown_opt;
- bool_val = 0;
- }
- if (!po->name)
- po = find_option(options, "default");
- if (!po->name) {
-unknown_opt:
- av_log(NULL, AV_LOG_ERROR, "Unrecognized option '%s'\n", opt);
- return AVERROR(EINVAL);
- }
- if (po->flags & HAS_ARG && !arg) {
- av_log(NULL, AV_LOG_ERROR, "Missing argument for option '%s'\n", opt);
- return AVERROR(EINVAL);
- }
-
/* new-style options contain an offset into optctx, old-style address of
* a global var*/
- dst = po->flags & (OPT_OFFSET | OPT_SPEC) ? (uint8_t *)optctx + po->u.off
- : po->u.dst_ptr;
+ void *dst = po->flags & (OPT_OFFSET | OPT_SPEC) ?
+ (uint8_t *)optctx + po->u.off : po->u.dst_ptr;
+ int *dstcount;
if (po->flags & OPT_SPEC) {
SpecifierOpt **so = dst;
@@ -267,10 +250,9 @@ unknown_opt:
if (po->flags & OPT_STRING) {
char *str;
str = av_strdup(arg);
+ av_freep(dst);
*(char **)dst = str;
- } else if (po->flags & OPT_BOOL) {
- *(int *)dst = bool_val;
- } else if (po->flags & OPT_INT) {
+ } else if (po->flags & OPT_BOOL || po->flags & OPT_INT) {
*(int *)dst = parse_number_or_die(opt, arg, OPT_INT64, INT_MIN, INT_MAX);
} else if (po->flags & OPT_INT64) {
*(int64_t *)dst = parse_number_or_die(opt, arg, OPT_INT64, INT64_MIN, INT64_MAX);
@@ -281,8 +263,7 @@ unknown_opt:
} else if (po->flags & OPT_DOUBLE) {
*(double *)dst = parse_number_or_die(opt, arg, OPT_DOUBLE, -INFINITY, INFINITY);
} else if (po->u.func_arg) {
- int ret = po->flags & OPT_FUNC2 ? po->u.func2_arg(optctx, opt, arg)
- : po->u.func_arg(opt, arg);
+ int ret = po->u.func_arg(optctx, opt, arg);
if (ret < 0) {
av_log(NULL, AV_LOG_ERROR,
"Failed to set value '%s' for option '%s'\n", arg, opt);
@@ -290,7 +271,41 @@ unknown_opt:
}
}
if (po->flags & OPT_EXIT)
- exit_program(0);
+ exit(0);
+
+ return 0;
+}
+
+int parse_option(void *optctx, const char *opt, const char *arg,
+ const OptionDef *options)
+{
+ const OptionDef *po;
+ int ret;
+
+ po = find_option(options, opt);
+ if (!po->name && opt[0] == 'n' && opt[1] == 'o') {
+ /* handle 'no' bool option */
+ po = find_option(options, opt + 2);
+ if ((po->name && (po->flags & OPT_BOOL)))
+ arg = "0";
+ } else if (po->flags & OPT_BOOL)
+ arg = "1";
+
+ if (!po->name)
+ po = find_option(options, "default");
+ if (!po->name) {
+ av_log(NULL, AV_LOG_ERROR, "Unrecognized option '%s'\n", opt);
+ return AVERROR(EINVAL);
+ }
+ if (po->flags & HAS_ARG && !arg) {
+ av_log(NULL, AV_LOG_ERROR, "Missing argument for option '%s'\n", opt);
+ return AVERROR(EINVAL);
+ }
+
+ ret = write_option(optctx, po, opt, arg);
+ if (ret < 0)
+ return ret;
+
return !!(po->flags & HAS_ARG);
}
@@ -316,7 +331,7 @@ void parse_options(void *optctx, int argc, char **argv, const OptionDef *options
opt++;
if ((ret = parse_option(optctx, opt, argv[optindex], options)) < 0)
- exit_program(1);
+ exit(1);
optindex += ret;
} else {
if (parse_arg_function)
@@ -325,11 +340,31 @@ void parse_options(void *optctx, int argc, char **argv, const OptionDef *options
}
}
-/*
- * Return index of option opt in argv or 0 if not found.
- */
-static int locate_option(int argc, char **argv, const OptionDef *options,
- const char *optname)
+int parse_optgroup(void *optctx, OptionGroup *g)
+{
+ int i, ret;
+
+ av_log(NULL, AV_LOG_DEBUG, "Parsing a group of options: %s %s.\n",
+ g->group_def->name, g->arg);
+
+ for (i = 0; i < g->nb_opts; i++) {
+ Option *o = &g->opts[i];
+
+ av_log(NULL, AV_LOG_DEBUG, "Applying option %s (%s) with argument %s.\n",
+ o->key, o->opt->help, o->val);
+
+ ret = write_option(optctx, o->opt, o->key, o->val);
+ if (ret < 0)
+ return ret;
+ }
+
+ av_log(NULL, AV_LOG_DEBUG, "Successfully parsed a group of options.\n");
+
+ return 0;
+}
+
+int locate_option(int argc, char **argv, const OptionDef *options,
+ const char *optname)
{
const OptionDef *po;
int i;
@@ -360,16 +395,19 @@ void parse_loglevel(int argc, char **argv, const OptionDef *options)
if (!idx)
idx = locate_option(argc, argv, options, "v");
if (idx && argv[idx + 1])
- opt_loglevel("loglevel", argv[idx + 1]);
+ opt_loglevel(NULL, "loglevel", argv[idx + 1]);
}
#define FLAGS (o->type == AV_OPT_TYPE_FLAGS) ? AV_DICT_APPEND : 0
-int opt_default(const char *opt, const char *arg)
+int opt_default(void *optctx, const char *opt, const char *arg)
{
const AVOption *o;
char opt_stripped[128];
const char *p;
- const AVClass *cc = avcodec_get_class(), *fc = avformat_get_class(), *sc = sws_get_class();
+ const AVClass *cc = avcodec_get_class(), *fc = avformat_get_class();
+#if CONFIG_SWSCALE
+ const AVClass *sc = sws_get_class();
+#endif
if (!(p = strchr(opt, ':')))
p = opt + strlen(opt);
@@ -383,6 +421,7 @@ int opt_default(const char *opt, const char *arg)
else if ((o = av_opt_find(&fc, opt, NULL, 0,
AV_OPT_SEARCH_CHILDREN | AV_OPT_SEARCH_FAKE_OBJ)))
av_dict_set(&format_opts, opt, arg, FLAGS);
+#if CONFIG_SWSCALE
else if ((o = 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
@@ -392,14 +431,230 @@ int opt_default(const char *opt, const char *arg)
return ret;
}
}
+#endif
if (o)
return 0;
- av_log(NULL, AV_LOG_ERROR, "Unrecognized option '%s'\n", opt);
return AVERROR_OPTION_NOT_FOUND;
}
-int opt_loglevel(const char *opt, const char *arg)
+/*
+ * Check whether given option is a group separator.
+ *
+ * @return index of the group definition that matched or -1 if none
+ */
+static int match_group_separator(const OptionGroupDef *groups, int nb_groups,
+ const char *opt)
+{
+ int i;
+
+ for (i = 0; i < nb_groups; i++) {
+ const OptionGroupDef *p = &groups[i];
+ if (p->sep && !strcmp(p->sep, opt))
+ return i;
+ }
+
+ return -1;
+}
+
+/*
+ * Finish parsing an option group.
+ *
+ * @param group_idx which group definition should this group belong to
+ * @param arg argument of the group delimiting option
+ */
+static void finish_group(OptionParseContext *octx, int group_idx,
+ const char *arg)
+{
+ OptionGroupList *l = &octx->groups[group_idx];
+ OptionGroup *g;
+
+ GROW_ARRAY(l->groups, l->nb_groups);
+ g = &l->groups[l->nb_groups - 1];
+
+ *g = octx->cur_group;
+ g->arg = arg;
+ g->group_def = l->group_def;
+#if CONFIG_SWSCALE
+ g->sws_opts = sws_opts;
+#endif
+ g->codec_opts = codec_opts;
+ g->format_opts = format_opts;
+
+ codec_opts = NULL;
+ format_opts = NULL;
+#if CONFIG_SWSCALE
+ sws_opts = NULL;
+#endif
+ init_opts();
+
+ memset(&octx->cur_group, 0, sizeof(octx->cur_group));
+}
+
+/*
+ * Add an option instance to currently parsed group.
+ */
+static void add_opt(OptionParseContext *octx, const OptionDef *opt,
+ const char *key, const char *val)
+{
+ int global = !(opt->flags & (OPT_PERFILE | OPT_SPEC | OPT_OFFSET));
+ OptionGroup *g = global ? &octx->global_opts : &octx->cur_group;
+
+ GROW_ARRAY(g->opts, g->nb_opts);
+ g->opts[g->nb_opts - 1].opt = opt;
+ g->opts[g->nb_opts - 1].key = key;
+ g->opts[g->nb_opts - 1].val = val;
+}
+
+static void init_parse_context(OptionParseContext *octx,
+ const OptionGroupDef *groups, int nb_groups)
+{
+ static const OptionGroupDef global_group = { "global" };
+ int i;
+
+ memset(octx, 0, sizeof(*octx));
+
+ octx->nb_groups = nb_groups;
+ octx->groups = av_mallocz(sizeof(*octx->groups) * octx->nb_groups);
+ if (!octx->groups)
+ exit(1);
+
+ for (i = 0; i < octx->nb_groups; i++)
+ octx->groups[i].group_def = &groups[i];
+
+ octx->global_opts.group_def = &global_group;
+ octx->global_opts.arg = "";
+
+ init_opts();
+}
+
+void uninit_parse_context(OptionParseContext *octx)
+{
+ int i, j;
+
+ for (i = 0; i < octx->nb_groups; i++) {
+ OptionGroupList *l = &octx->groups[i];
+
+ for (j = 0; j < l->nb_groups; j++) {
+ av_freep(&l->groups[j].opts);
+ av_dict_free(&l->groups[j].codec_opts);
+ av_dict_free(&l->groups[j].format_opts);
+#if CONFIG_SWSCALE
+ sws_freeContext(l->groups[j].sws_opts);
+#endif
+ }
+ av_freep(&l->groups);
+ }
+ av_freep(&octx->groups);
+
+ av_freep(&octx->cur_group.opts);
+ av_freep(&octx->global_opts.opts);
+
+ uninit_opts();
+}
+
+int split_commandline(OptionParseContext *octx, int argc, char *argv[],
+ const OptionDef *options,
+ const OptionGroupDef *groups, int nb_groups)
+{
+ int optindex = 1;
+
+ /* perform system-dependent conversions for arguments list */
+ prepare_app_arguments(&argc, &argv);
+
+ init_parse_context(octx, groups, nb_groups);
+ av_log(NULL, AV_LOG_DEBUG, "Splitting the commandline.\n");
+
+ while (optindex < argc) {
+ const char *opt = argv[optindex++], *arg;
+ const OptionDef *po;
+ int ret;
+
+ av_log(NULL, AV_LOG_DEBUG, "Reading option '%s' ...", opt);
+
+ /* unnamed group separators, e.g. output filename */
+ if (opt[0] != '-' || !opt[1]) {
+ finish_group(octx, 0, opt);
+ av_log(NULL, AV_LOG_DEBUG, " matched as %s.\n", groups[0].name);
+ continue;
+ }
+ opt++;
+
+#define GET_ARG(arg) \
+do { \
+ arg = argv[optindex++]; \
+ if (!arg) { \
+ av_log(NULL, AV_LOG_ERROR, "Missing argument for option '%s'.\n", opt);\
+ return AVERROR(EINVAL); \
+ } \
+} while (0)
+
+ /* named group separators, e.g. -i */
+ if ((ret = match_group_separator(groups, nb_groups, opt)) >= 0) {
+ GET_ARG(arg);
+ finish_group(octx, ret, arg);
+ av_log(NULL, AV_LOG_DEBUG, " matched as %s with argument '%s'.\n",
+ groups[ret].name, arg);
+ continue;
+ }
+
+ /* normal options */
+ po = find_option(options, opt);
+ if (po->name) {
+ if (po->flags & OPT_EXIT) {
+ /* optional argument, e.g. -h */
+ arg = argv[optindex++];
+ } else if (po->flags & HAS_ARG) {
+ GET_ARG(arg);
+ } else {
+ arg = "1";
+ }
+
+ add_opt(octx, po, opt, arg);
+ av_log(NULL, AV_LOG_DEBUG, " matched as option '%s' (%s) with "
+ "argument '%s'.\n", po->name, po->help, arg);
+ continue;
+ }
+
+ /* AVOptions */
+ if (argv[optindex]) {
+ ret = opt_default(NULL, opt, argv[optindex]);
+ if (ret >= 0) {
+ av_log(NULL, AV_LOG_DEBUG, " matched as AVOption '%s' with "
+ "argument '%s'.\n", opt, argv[optindex]);
+ optindex++;
+ continue;
+ } else if (ret != AVERROR_OPTION_NOT_FOUND) {
+ av_log(NULL, AV_LOG_ERROR, "Error parsing option '%s' "
+ "with argument '%s'.\n", opt, argv[optindex]);
+ return ret;
+ }
+ }
+
+ /* boolean -nofoo options */
+ if (opt[0] == 'n' && opt[1] == 'o' &&
+ (po = find_option(options, opt + 2)) &&
+ po->name && po->flags & OPT_BOOL) {
+ add_opt(octx, po, opt, "0");
+ av_log(NULL, AV_LOG_DEBUG, " matched as option '%s' (%s) with "
+ "argument 0.\n", po->name, po->help);
+ continue;
+ }
+
+ av_log(NULL, AV_LOG_ERROR, "Unrecognized option '%s'.\n", opt);
+ return AVERROR_OPTION_NOT_FOUND;
+ }
+
+ if (octx->cur_group.nb_opts || codec_opts || format_opts)
+ av_log(NULL, AV_LOG_WARNING, "Trailing options were found on the "
+ "commandline.\n");
+
+ av_log(NULL, AV_LOG_DEBUG, "Finished splitting the commandline.\n");
+
+ return 0;
+}
+
+int opt_loglevel(void *optctx, const char *opt, const char *arg)
{
const struct { const char *name; int level; } log_levels[] = {
{ "quiet" , AV_LOG_QUIET },
@@ -428,13 +683,13 @@ int opt_loglevel(const char *opt, const char *arg)
"Possible levels are numbers or:\n", arg);
for (i = 0; i < FF_ARRAY_ELEMS(log_levels); i++)
av_log(NULL, AV_LOG_FATAL, "\"%s\"\n", log_levels[i].name);
- exit_program(1);
+ exit(1);
}
av_log_set_level(level);
return 0;
}
-int opt_timelimit(const char *opt, const char *arg)
+int opt_timelimit(void *optctx, const char *opt, const char *arg)
{
#if HAVE_SETRLIMIT
int lim = parse_number_or_die(opt, arg, OPT_INT64, 0, INT_MAX);
@@ -468,7 +723,8 @@ static int warned_cfg = 0;
const char *indent = flags & INDENT? " " : ""; \
if (flags & SHOW_VERSION) { \
unsigned int version = libname##_version(); \
- av_log(NULL, level, "%slib%-9s %2d.%3d.%2d / %2d.%3d.%2d\n",\
+ av_log(NULL, level, \
+ "%slib%-10s %2d.%3d.%2d / %2d.%3d.%2d\n", \
indent, #libname, \
LIB##LIBNAME##_VERSION_MAJOR, \
LIB##LIBNAME##_VERSION_MINOR, \
@@ -497,10 +753,8 @@ static void print_all_libs_info(int flags, int level)
PRINT_LIB_INFO(avformat, AVFORMAT, flags, level);
PRINT_LIB_INFO(avdevice, AVDEVICE, flags, level);
PRINT_LIB_INFO(avfilter, AVFILTER, flags, level);
+ PRINT_LIB_INFO(avresample, AVRESAMPLE, flags, level);
PRINT_LIB_INFO(swscale, SWSCALE, flags, level);
-#if CONFIG_POSTPROC
- PRINT_LIB_INFO(postproc, POSTPROC, flags, level);
-#endif
}
void show_banner(void)
@@ -508,20 +762,23 @@ void show_banner(void)
av_log(NULL, AV_LOG_INFO,
"%s version " LIBAV_VERSION ", Copyright (c) %d-%d the Libav developers\n",
program_name, program_birth_year, this_year);
- av_log(NULL, AV_LOG_INFO, " built on %s %s with %s %s\n",
- __DATE__, __TIME__, CC_TYPE, CC_VERSION);
+ av_log(NULL, AV_LOG_INFO, " built on %s %s with %s\n",
+ __DATE__, __TIME__, CC_IDENT);
av_log(NULL, AV_LOG_VERBOSE, " configuration: " LIBAV_CONFIGURATION "\n");
print_all_libs_info(INDENT|SHOW_CONFIG, AV_LOG_VERBOSE);
print_all_libs_info(INDENT|SHOW_VERSION, AV_LOG_VERBOSE);
}
-void show_version(void) {
+int show_version(void *optctx, const char *opt, const char *arg)
+{
av_log_set_callback(log_callback_help);
printf("%s " LIBAV_VERSION "\n", program_name);
print_all_libs_info(SHOW_VERSION, AV_LOG_INFO);
+
+ return 0;
}
-void show_license(void)
+int show_license(void *optctx, const char *opt, const char *arg)
{
printf(
#if CONFIG_NONFREE
@@ -588,9 +845,11 @@ void show_license(void)
program_name, program_name, program_name
#endif
);
+
+ return 0;
}
-void show_formats(void)
+int show_formats(void *optctx, const char *opt, const char *arg)
{
AVInputFormat *ifmt = NULL;
AVOutputFormat *ofmt = NULL;
@@ -635,86 +894,193 @@ void show_formats(void)
name,
long_name ? long_name:" ");
}
+ return 0;
}
-void show_codecs(void)
+#define PRINT_CODEC_SUPPORTED(codec, field, type, list_name, term, get_name) \
+ if (codec->field) { \
+ const type *p = c->field; \
+ \
+ printf(" Supported " list_name ":"); \
+ while (*p != term) { \
+ get_name(*p); \
+ printf(" %s", name); \
+ p++; \
+ } \
+ printf("\n"); \
+ } \
+
+static void print_codec(const AVCodec *c)
{
- AVCodec *p = NULL, *p2;
- const char *last_name;
+ int encoder = av_codec_is_encoder(c);
+
+ printf("%s %s [%s]:\n", encoder ? "Encoder" : "Decoder", c->name,
+ c->long_name ? c->long_name : "");
+
+ if (c->type == AVMEDIA_TYPE_VIDEO) {
+ printf(" Threading capabilities: ");
+ switch (c->capabilities & (CODEC_CAP_FRAME_THREADS |
+ CODEC_CAP_SLICE_THREADS)) {
+ case CODEC_CAP_FRAME_THREADS |
+ CODEC_CAP_SLICE_THREADS: printf("frame and slice"); break;
+ case CODEC_CAP_FRAME_THREADS: printf("frame"); break;
+ case CODEC_CAP_SLICE_THREADS: printf("slice"); break;
+ default: printf("no"); break;
+ }
+ printf("\n");
+ }
+
+ if (c->supported_framerates) {
+ const AVRational *fps = c->supported_framerates;
+
+ printf(" Supported framerates:");
+ while (fps->num) {
+ printf(" %d/%d", fps->num, fps->den);
+ fps++;
+ }
+ printf("\n");
+ }
+ PRINT_CODEC_SUPPORTED(c, pix_fmts, enum AVPixelFormat, "pixel formats",
+ AV_PIX_FMT_NONE, GET_PIX_FMT_NAME);
+ PRINT_CODEC_SUPPORTED(c, supported_samplerates, int, "sample rates", 0,
+ GET_SAMPLE_RATE_NAME);
+ PRINT_CODEC_SUPPORTED(c, sample_fmts, enum AVSampleFormat, "sample formats",
+ AV_SAMPLE_FMT_NONE, GET_SAMPLE_FMT_NAME);
+ PRINT_CODEC_SUPPORTED(c, channel_layouts, uint64_t, "channel layouts",
+ 0, GET_CH_LAYOUT_DESC);
+
+ if (c->priv_class) {
+ show_help_children(c->priv_class,
+ AV_OPT_FLAG_ENCODING_PARAM |
+ AV_OPT_FLAG_DECODING_PARAM);
+ }
+}
+
+static char get_media_type_char(enum AVMediaType type)
+{
+ switch (type) {
+ case AVMEDIA_TYPE_VIDEO: return 'V';
+ case AVMEDIA_TYPE_AUDIO: return 'A';
+ case AVMEDIA_TYPE_SUBTITLE: return 'S';
+ default: return '?';
+ }
+}
+
+static const AVCodec *next_codec_for_id(enum AVCodecID id, const AVCodec *prev,
+ int encoder)
+{
+ while ((prev = av_codec_next(prev))) {
+ if (prev->id == id &&
+ (encoder ? av_codec_is_encoder(prev) : av_codec_is_decoder(prev)))
+ return prev;
+ }
+ return NULL;
+}
+
+static void print_codecs_for_id(enum AVCodecID id, int encoder)
+{
+ const AVCodec *codec = NULL;
+
+ printf(" (%s: ", encoder ? "encoders" : "decoders");
+
+ while ((codec = next_codec_for_id(id, codec, encoder)))
+ printf("%s ", codec->name);
+
+ printf(")");
+}
+
+int show_codecs(void *optctx, const char *opt, const char *arg)
+{
+ const AVCodecDescriptor *desc = NULL;
+
printf("Codecs:\n"
" D..... = Decoding supported\n"
" .E.... = Encoding supported\n"
" ..V... = Video codec\n"
" ..A... = Audio codec\n"
" ..S... = Subtitle codec\n"
- " ...S.. = Supports draw_horiz_band\n"
- " ....D. = Supports direct rendering method 1\n"
- " .....T = Supports weird frame truncation\n"
- " ------\n");
- last_name= "000";
- for (;;) {
- int decode = 0;
- int encode = 0;
- int cap = 0;
- const char *type_str;
-
- p2 = NULL;
- while ((p = av_codec_next(p))) {
- if ((p2 == NULL || strcmp(p->name, p2->name) < 0) &&
- strcmp(p->name, last_name) > 0) {
- p2 = p;
- decode = encode = cap = 0;
+ " ...I.. = Intra frame-only codec\n"
+ " ....L. = Lossy compression\n"
+ " .....S = Lossless compression\n"
+ " -------\n");
+ while ((desc = avcodec_descriptor_next(desc))) {
+ const AVCodec *codec = NULL;
+
+ printf(avcodec_find_decoder(desc->id) ? "D" : ".");
+ printf(avcodec_find_encoder(desc->id) ? "E" : ".");
+
+ printf("%c", get_media_type_char(desc->type));
+ printf((desc->props & AV_CODEC_PROP_INTRA_ONLY) ? "I" : ".");
+ printf((desc->props & AV_CODEC_PROP_LOSSY) ? "L" : ".");
+ printf((desc->props & AV_CODEC_PROP_LOSSLESS) ? "S" : ".");
+
+ printf(" %-20s %s", desc->name, desc->long_name ? desc->long_name : "");
+
+ /* print decoders/encoders when there's more than one or their
+ * names are different from codec name */
+ while ((codec = next_codec_for_id(desc->id, codec, 0))) {
+ if (strcmp(codec->name, desc->name)) {
+ print_codecs_for_id(desc->id, 0);
+ break;
}
- if (p2 && strcmp(p->name, p2->name) == 0) {
- if (p->decode)
- decode = 1;
- if (p->encode)
- encode = 1;
- cap |= p->capabilities;
+ }
+ codec = NULL;
+ while ((codec = next_codec_for_id(desc->id, codec, 1))) {
+ if (strcmp(codec->name, desc->name)) {
+ print_codecs_for_id(desc->id, 1);
+ break;
}
}
- if (p2 == NULL)
- break;
- last_name = p2->name;
- switch (p2->type) {
- case AVMEDIA_TYPE_VIDEO:
- type_str = "V";
- break;
- case AVMEDIA_TYPE_AUDIO:
- type_str = "A";
- break;
- case AVMEDIA_TYPE_SUBTITLE:
- type_str = "S";
- break;
- default:
- type_str = "?";
- break;
- }
- printf(" %s%s%s%s%s%s %-15s %s",
- decode ? "D" : (/* p2->decoder ? "d" : */ " "),
- encode ? "E" : " ",
- type_str,
- cap & CODEC_CAP_DRAW_HORIZ_BAND ? "S" : " ",
- cap & CODEC_CAP_DR1 ? "D" : " ",
- cap & CODEC_CAP_TRUNCATED ? "T" : " ",
- p2->name,
- p2->long_name ? p2->long_name : "");
-#if 0
- if (p2->decoder && decode == 0)
- printf(" use %s for decoding", p2->decoder->name);
-#endif
printf("\n");
}
- printf("\n");
- printf("Note, the names of encoders and decoders do not always match, so there are\n"
- "several cases where the above table shows encoder only or decoder only entries\n"
- "even though both encoding and decoding are supported. For example, the h263\n"
- "decoder corresponds to the h263 and h263p encoders, for file formats it is even\n"
- "worse.\n");
+ return 0;
+}
+
+static void print_codecs(int encoder)
+{
+ const AVCodecDescriptor *desc = NULL;
+
+ printf("%s:\n"
+ " V... = Video\n"
+ " A... = Audio\n"
+ " S... = Subtitle\n"
+ " .F.. = Frame-level multithreading\n"
+ " ..S. = Slice-level multithreading\n"
+ " ...X = Codec is experimental\n"
+ " ---\n",
+ encoder ? "Encoders" : "Decoders");
+ while ((desc = avcodec_descriptor_next(desc))) {
+ const AVCodec *codec = NULL;
+
+ while ((codec = next_codec_for_id(desc->id, codec, encoder))) {
+ printf("%c", get_media_type_char(desc->type));
+ printf((codec->capabilities & CODEC_CAP_FRAME_THREADS) ? "F" : ".");
+ printf((codec->capabilities & CODEC_CAP_SLICE_THREADS) ? "S" : ".");
+ printf((codec->capabilities & CODEC_CAP_EXPERIMENTAL) ? "X" : ".");
+
+ printf(" %-20s %s", codec->name, codec->long_name ? codec->long_name : "");
+ if (strcmp(codec->name, desc->name))
+ printf(" (codec %s)", desc->name);
+
+ printf("\n");
+ }
+ }
}
-void show_bsfs(void)
+int show_decoders(void *optctx, const char *opt, const char *arg)
+{
+ print_codecs(0);
+ return 0;
+}
+
+int show_encoders(void *optctx, const char *opt, const char *arg)
+{
+ print_codecs(1);
+ return 0;
+}
+
+int show_bsfs(void *optctx, const char *opt, const char *arg)
{
AVBitStreamFilter *bsf = NULL;
@@ -722,9 +1088,10 @@ void show_bsfs(void)
while ((bsf = av_bitstream_filter_next(bsf)))
printf("%s\n", bsf->name);
printf("\n");
+ return 0;
}
-void show_protocols(void)
+int show_protocols(void *optctx, const char *opt, const char *arg)
{
void *opaque = NULL;
const char *name;
@@ -736,9 +1103,10 @@ void show_protocols(void)
printf("Output:\n");
while ((name = avio_enum_protocols(&opaque, 1)))
printf("%s\n", name);
+ return 0;
}
-void show_filters(void)
+int show_filters(void *optctx, const char *opt, const char *arg)
{
AVFilter av_unused(**filter) = NULL;
@@ -747,11 +1115,12 @@ void show_filters(void)
while ((filter = av_filter_next(filter)) && *filter)
printf("%-16s %s\n", (*filter)->name, (*filter)->description);
#endif
+ return 0;
}
-void show_pix_fmts(void)
+int show_pix_fmts(void *optctx, const char *opt, const char *arg)
{
- enum PixelFormat pix_fmt;
+ const AVPixFmtDescriptor *pix_desc = NULL;
printf("Pixel formats:\n"
"I.... = Supported Input format for conversion\n"
@@ -767,8 +1136,8 @@ void show_pix_fmts(void)
# define sws_isSupportedOutput(x) 0
#endif
- for (pix_fmt = 0; pix_fmt < PIX_FMT_NB; pix_fmt++) {
- const AVPixFmtDescriptor *pix_desc = &av_pix_fmt_descriptors[pix_fmt];
+ while ((pix_desc = av_pix_fmt_desc_next(pix_desc))) {
+ enum AVPixelFormat pix_fmt = av_pix_fmt_desc_get_id(pix_desc);
printf("%c%c%c%c%c %-16s %d %2d\n",
sws_isSupportedInput (pix_fmt) ? 'I' : '.',
sws_isSupportedOutput(pix_fmt) ? 'O' : '.',
@@ -779,9 +1148,10 @@ void show_pix_fmts(void)
pix_desc->nb_components,
av_get_bits_per_pixel(pix_desc));
}
+ return 0;
}
-int show_sample_fmts(const char *opt, const char *arg)
+int show_sample_fmts(void *optctx, const char *opt, const char *arg)
{
int i;
char fmt_str[128];
@@ -790,6 +1160,120 @@ int show_sample_fmts(const char *opt, const char *arg)
return 0;
}
+static void show_help_codec(const char *name, int encoder)
+{
+ const AVCodecDescriptor *desc;
+ const AVCodec *codec;
+
+ if (!name) {
+ av_log(NULL, AV_LOG_ERROR, "No codec name specified.\n");
+ return;
+ }
+
+ codec = encoder ? avcodec_find_encoder_by_name(name) :
+ avcodec_find_decoder_by_name(name);
+
+ if (codec)
+ print_codec(codec);
+ else if ((desc = avcodec_descriptor_get_by_name(name))) {
+ int printed = 0;
+
+ while ((codec = next_codec_for_id(desc->id, codec, encoder))) {
+ printed = 1;
+ print_codec(codec);
+ }
+
+ if (!printed) {
+ av_log(NULL, AV_LOG_ERROR, "Codec '%s' is known to Libav, "
+ "but no %s for it are available. Libav might need to be "
+ "recompiled with additional external libraries.\n",
+ name, encoder ? "encoders" : "decoders");
+ }
+ } else {
+ av_log(NULL, AV_LOG_ERROR, "Codec '%s' is not recognized by Libav.\n",
+ name);
+ }
+}
+
+static void show_help_demuxer(const char *name)
+{
+ const AVInputFormat *fmt = av_find_input_format(name);
+
+ if (!fmt) {
+ av_log(NULL, AV_LOG_ERROR, "Unknown format '%s'.\n", name);
+ return;
+ }
+
+ printf("Demuxer %s [%s]:\n", fmt->name, fmt->long_name);
+
+ if (fmt->extensions)
+ printf(" Common extensions: %s.\n", fmt->extensions);
+
+ if (fmt->priv_class)
+ show_help_children(fmt->priv_class, AV_OPT_FLAG_DECODING_PARAM);
+}
+
+static void show_help_muxer(const char *name)
+{
+ const AVCodecDescriptor *desc;
+ const AVOutputFormat *fmt = av_guess_format(name, NULL, NULL);
+
+ if (!fmt) {
+ av_log(NULL, AV_LOG_ERROR, "Unknown format '%s'.\n", name);
+ return;
+ }
+
+ printf("Muxer %s [%s]:\n", fmt->name, fmt->long_name);
+
+ if (fmt->extensions)
+ printf(" Common extensions: %s.\n", fmt->extensions);
+ if (fmt->mime_type)
+ printf(" Mime type: %s.\n", fmt->mime_type);
+ if (fmt->video_codec != AV_CODEC_ID_NONE &&
+ (desc = avcodec_descriptor_get(fmt->video_codec))) {
+ printf(" Default video codec: %s.\n", desc->name);
+ }
+ if (fmt->audio_codec != AV_CODEC_ID_NONE &&
+ (desc = avcodec_descriptor_get(fmt->audio_codec))) {
+ printf(" Default audio codec: %s.\n", desc->name);
+ }
+ if (fmt->subtitle_codec != AV_CODEC_ID_NONE &&
+ (desc = avcodec_descriptor_get(fmt->subtitle_codec))) {
+ printf(" Default subtitle codec: %s.\n", desc->name);
+ }
+
+ if (fmt->priv_class)
+ show_help_children(fmt->priv_class, AV_OPT_FLAG_ENCODING_PARAM);
+}
+
+int show_help(void *optctx, const char *opt, const char *arg)
+{
+ char *topic, *par;
+ av_log_set_callback(log_callback_help);
+
+ topic = av_strdup(arg ? arg : "");
+ par = strchr(topic, '=');
+ if (par)
+ *par++ = 0;
+
+ if (!*topic) {
+ show_help_default(topic, par);
+ } else if (!strcmp(topic, "decoder")) {
+ show_help_codec(par, 0);
+ } else if (!strcmp(topic, "encoder")) {
+ show_help_codec(par, 1);
+ } else if (!strcmp(topic, "demuxer")) {
+ show_help_demuxer(par);
+ } else if (!strcmp(topic, "muxer")) {
+ show_help_muxer(par);
+ } else {
+ show_help_default(topic, par);
+ }
+
+ av_freep(&topic);
+ return 0;
+}
+
int read_yesno(void)
{
int c = getchar();
@@ -831,7 +1315,7 @@ int cmdutils_read_file(const char *filename, char **bufptr, size_t *size)
ret = AVERROR_EOF;
} else {
ret = 0;
- (*bufptr)[*size++] = '\0';
+ (*bufptr)[(*size)++] = '\0';
}
fclose(f);
@@ -913,6 +1397,7 @@ int check_stream_specifier(AVFormatContext *s, AVStream *st, const char *spec)
case 's': type = AVMEDIA_TYPE_SUBTITLE; break;
case 'd': type = AVMEDIA_TYPE_DATA; break;
case 't': type = AVMEDIA_TYPE_ATTACHMENT; break;
+ default: av_assert0(0);
}
if (type != st->codec->codec_type)
return 0;
@@ -952,19 +1437,20 @@ int check_stream_specifier(AVFormatContext *s, AVStream *st, const char *spec)
return AVERROR(EINVAL);
}
-AVDictionary *filter_codec_opts(AVDictionary *opts, enum CodecID codec_id,
- AVFormatContext *s, AVStream *st)
+AVDictionary *filter_codec_opts(AVDictionary *opts, enum AVCodecID codec_id,
+ AVFormatContext *s, AVStream *st, AVCodec *codec)
{
AVDictionary *ret = NULL;
AVDictionaryEntry *t = NULL;
- AVCodec *codec = s->oformat ? avcodec_find_encoder(codec_id)
- : avcodec_find_decoder(codec_id);
int flags = s->oformat ? AV_OPT_FLAG_ENCODING_PARAM
: AV_OPT_FLAG_DECODING_PARAM;
char prefix = 0;
const AVClass *cc = avcodec_get_class();
if (!codec)
+ codec = s->oformat ? avcodec_find_encoder(codec_id)
+ : avcodec_find_decoder(codec_id);
+ if (!codec)
return NULL;
switch (codec->type) {
@@ -1025,91 +1511,157 @@ AVDictionary **setup_find_stream_info_opts(AVFormatContext *s,
}
for (i = 0; i < s->nb_streams; i++)
opts[i] = filter_codec_opts(codec_opts, s->streams[i]->codec->codec_id,
- s, s->streams[i]);
+ s, s->streams[i], NULL);
return opts;
}
-#if CONFIG_AVFILTER
-
-static int avsink_init(AVFilterContext *ctx, const char *args, void *opaque)
+void *grow_array(void *array, int elem_size, int *size, int new_size)
{
- AVSinkContext *priv = ctx->priv;
+ if (new_size >= INT_MAX / elem_size) {
+ av_log(NULL, AV_LOG_ERROR, "Array too big.\n");
+ exit(1);
+ }
+ if (*size < new_size) {
+ uint8_t *tmp = av_realloc(array, new_size*elem_size);
+ if (!tmp) {
+ av_log(NULL, AV_LOG_ERROR, "Could not alloc buffer.\n");
+ exit(1);
+ }
+ memset(tmp + *size*elem_size, 0, (new_size-*size) * elem_size);
+ *size = new_size;
+ return tmp;
+ }
+ return array;
+}
- if (!opaque)
+static int alloc_buffer(FrameBuffer **pool, AVCodecContext *s, FrameBuffer **pbuf)
+{
+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(s->pix_fmt);
+ FrameBuffer *buf;
+ int i, ret;
+ int pixel_size;
+ int h_chroma_shift, v_chroma_shift;
+ int edge = 32; // XXX should be avcodec_get_edge_width(), but that fails on svq1
+ int w = s->width, h = s->height;
+
+ if (!desc)
return AVERROR(EINVAL);
- *priv = *(AVSinkContext *)opaque;
+ pixel_size = desc->comp[0].step_minus1 + 1;
+
+ buf = av_mallocz(sizeof(*buf));
+ if (!buf)
+ return AVERROR(ENOMEM);
+ if (!(s->flags & CODEC_FLAG_EMU_EDGE)) {
+ w += 2*edge;
+ h += 2*edge;
+ }
+
+ avcodec_align_dimensions(s, &w, &h);
+ if ((ret = av_image_alloc(buf->base, buf->linesize, w, h,
+ s->pix_fmt, 32)) < 0) {
+ av_freep(&buf);
+ return ret;
+ }
+ /* XXX this shouldn't be needed, but some tests break without this line
+ * those decoders are buggy and need to be fixed.
+ * the following tests fail:
+ * cdgraphics, ansi
+ */
+ memset(buf->base[0], 128, ret);
+
+ av_pix_fmt_get_chroma_sub_sample(s->pix_fmt,
+ &h_chroma_shift, &v_chroma_shift);
+
+ for (i = 0; i < FF_ARRAY_ELEMS(buf->data); i++) {
+ const int h_shift = i==0 ? 0 : h_chroma_shift;
+ const int v_shift = i==0 ? 0 : v_chroma_shift;
+ if (s->flags & CODEC_FLAG_EMU_EDGE)
+ buf->data[i] = buf->base[i];
+ else if (buf->base[i])
+ buf->data[i] = buf->base[i] +
+ FFALIGN((buf->linesize[i]*edge >> v_shift) +
+ (pixel_size*edge >> h_shift), 32);
+ }
+ buf->w = s->width;
+ buf->h = s->height;
+ buf->pix_fmt = s->pix_fmt;
+ buf->pool = pool;
+
+ *pbuf = buf;
return 0;
}
-static void null_end_frame(AVFilterLink *inlink) { }
-
-static int avsink_query_formats(AVFilterContext *ctx)
+int codec_get_buffer(AVCodecContext *s, AVFrame *frame)
{
- AVSinkContext *priv = ctx->priv;
- enum PixelFormat pix_fmts[] = { priv->pix_fmt, PIX_FMT_NONE };
+ FrameBuffer **pool = s->opaque;
+ FrameBuffer *buf;
+ int ret, i;
+
+ if (!*pool && (ret = alloc_buffer(pool, s, pool)) < 0)
+ return ret;
+
+ buf = *pool;
+ *pool = buf->next;
+ buf->next = NULL;
+ if (buf->w != s->width || buf->h != s->height || buf->pix_fmt != s->pix_fmt) {
+ av_freep(&buf->base[0]);
+ av_free(buf);
+ if ((ret = alloc_buffer(pool, s, &buf)) < 0)
+ return ret;
+ }
+ buf->refcount++;
+
+ frame->opaque = buf;
+ frame->type = FF_BUFFER_TYPE_USER;
+ frame->extended_data = frame->data;
+
+ for (i = 0; i < FF_ARRAY_ELEMS(buf->data); i++) {
+ frame->base[i] = buf->base[i]; // XXX h264.c uses base though it shouldn't
+ frame->data[i] = buf->data[i];
+ frame->linesize[i] = buf->linesize[i];
+ }
- avfilter_set_common_formats(ctx, avfilter_make_format_list(pix_fmts));
return 0;
}
-AVFilter avsink = {
- .name = "avsink",
- .priv_size = sizeof(AVSinkContext),
- .init = avsink_init,
-
- .query_formats = avsink_query_formats,
+static void unref_buffer(FrameBuffer *buf)
+{
+ FrameBuffer **pool = buf->pool;
- .inputs = (AVFilterPad[]) {{ .name = "default",
- .type = AVMEDIA_TYPE_VIDEO,
- .end_frame = null_end_frame,
- .min_perms = AV_PERM_READ, },
- { .name = NULL }},
- .outputs = (AVFilterPad[]) {{ .name = NULL }},
-};
+ av_assert0(buf->refcount);
+ buf->refcount--;
+ if (!buf->refcount) {
+ buf->next = *pool;
+ *pool = buf;
+ }
+}
-int get_filtered_video_frame(AVFilterContext *ctx, AVFrame *frame,
- AVFilterBufferRef **picref_ptr, AVRational *tb)
+void codec_release_buffer(AVCodecContext *s, AVFrame *frame)
{
- int ret;
- AVFilterBufferRef *picref;
+ FrameBuffer *buf = frame->opaque;
+ int i;
- if ((ret = avfilter_request_frame(ctx->inputs[0])) < 0)
- return ret;
- if (!(picref = ctx->inputs[0]->cur_buf))
- return AVERROR(ENOENT);
- *picref_ptr = picref;
- ctx->inputs[0]->cur_buf = NULL;
- *tb = ctx->inputs[0]->time_base;
-
- memcpy(frame->data, picref->data, sizeof(frame->data));
- memcpy(frame->linesize, picref->linesize, sizeof(frame->linesize));
- frame->interlaced_frame = picref->video->interlaced;
- frame->top_field_first = picref->video->top_field_first;
- frame->key_frame = picref->video->key_frame;
- frame->pict_type = picref->video->pict_type;
- frame->sample_aspect_ratio = picref->video->pixel_aspect;
-
- return 1;
+ for (i = 0; i < FF_ARRAY_ELEMS(frame->data); i++)
+ frame->data[i] = NULL;
+
+ unref_buffer(buf);
}
-#endif /* CONFIG_AVFILTER */
+void filter_release_buffer(AVFilterBuffer *fb)
+{
+ FrameBuffer *buf = fb->priv;
+ av_free(fb);
+ unref_buffer(buf);
+}
-void *grow_array(void *array, int elem_size, int *size, int new_size)
+void free_buffer_pool(FrameBuffer **pool)
{
- if (new_size >= INT_MAX / elem_size) {
- av_log(NULL, AV_LOG_ERROR, "Array too big.\n");
- exit_program(1);
+ FrameBuffer *buf = *pool;
+ while (buf) {
+ *pool = buf->next;
+ av_freep(&buf->base[0]);
+ av_free(buf);
+ buf = *pool;
}
- if (*size < new_size) {
- uint8_t *tmp = av_realloc(array, new_size*elem_size);
- if (!tmp) {
- av_log(NULL, AV_LOG_ERROR, "Could not alloc buffer.\n");
- exit_program(1);
- }
- memset(tmp + *size*elem_size, 0, (new_size-*size) * elem_size);
- *size = new_size;
- return tmp;
- }
- return array;
}
diff --git a/gst-libs/ext/libav/cmdutils.h b/gst-libs/ext/libav/cmdutils.h
index c69bb02..ed9c68e 100644
--- a/gst-libs/ext/libav/cmdutils.h
+++ b/gst-libs/ext/libav/cmdutils.h
@@ -65,17 +65,17 @@ void log_callback_help(void* ptr, int level, const char* fmt, va_list vl);
* Fallback for options that are not explicitly handled, these will be
* parsed through AVOptions.
*/
-int opt_default(const char *opt, const char *arg);
+int opt_default(void *optctx, const char *opt, const char *arg);
/**
* Set the libav* libraries log level.
*/
-int opt_loglevel(const char *opt, const char *arg);
+int opt_loglevel(void *optctx, const char *opt, const char *arg);
/**
* Limit the execution time.
*/
-int opt_timelimit(const char *opt, const char *arg);
+int opt_timelimit(void *optctx, const char *opt, const char *arg);
/**
* Parse a string and return its corresponding value as a double.
@@ -121,7 +121,7 @@ typedef struct SpecifierOpt {
} u;
} SpecifierOpt;
-typedef struct {
+typedef struct OptionDef {
const char *name;
int flags;
#define HAS_ARG 0x0001
@@ -130,14 +130,14 @@ typedef struct {
#define OPT_STRING 0x0008
#define OPT_VIDEO 0x0010
#define OPT_AUDIO 0x0020
-#define OPT_GRAB 0x0040
#define OPT_INT 0x0080
#define OPT_FLOAT 0x0100
#define OPT_SUBTITLE 0x0200
#define OPT_INT64 0x0400
#define OPT_EXIT 0x0800
#define OPT_DATA 0x1000
-#define OPT_FUNC2 0x2000
+#define OPT_PERFILE 0x2000 /* the option is per-file (currently avconv-only).
+ implied by OPT_OFFSET or OPT_SPEC */
#define OPT_OFFSET 0x4000 /* option is specified as an offset in a passed optctx */
#define OPT_SPEC 0x8000 /* option is to be stored in an array of SpecifierOpt.
Implies OPT_OFFSET. Next element after the offset is
@@ -146,16 +146,24 @@ typedef struct {
#define OPT_DOUBLE 0x20000
union {
void *dst_ptr;
- int (*func_arg)(const char *, const char *);
- int (*func2_arg)(void *, const char *, const char *);
+ int (*func_arg)(void *, const char *, const char *);
size_t off;
} u;
const char *help;
const char *argname;
} OptionDef;
-void show_help_options(const OptionDef *options, const char *msg, int mask,
- int value);
+/**
+ * Print help for all options matching specified flags.
+ *
+ * @param options a list of options
+ * @param msg title of this group. Only printed if at least one option matches.
+ * @param req_flags print only options which have all those flags set.
+ * @param rej_flags don't print options which have any of those flags set.
+ * @param alt_flags print only options that have at least one of those flags set
+ */
+void show_help_options(const OptionDef *options, const char *msg, int req_flags,
+ int rej_flags, int alt_flags);
/**
* Show help for all options with given flags in class and all its
@@ -164,9 +172,22 @@ void show_help_options(const OptionDef *options, const char *msg, int mask,
void show_help_children(const AVClass *class, int flags);
/**
+ * Per-avtool specific help handler. Implemented in each
+ * avtool, called by show_help().
+ */
+void show_help_default(const char *opt, const char *arg);
+
+/**
+ * Generic -h handler common to all avtools.
+ */
+int show_help(void *optctx, const char *opt, const char *arg);
+
+/**
* Parse the command line arguments.
*
* @param optctx an opaque options context
+ * @param argc number of command line arguments
+ * @param argv values of command line arguments
* @param options Array with the definitions required to interpret every
* option of the form: -option_name [argument]
* @param parse_arg_function Name of the function called to process every
@@ -185,11 +206,105 @@ int parse_option(void *optctx, const char *opt, const char *arg,
const OptionDef *options);
/**
+ * An option extracted from the commandline.
+ * Cannot use AVDictionary because of options like -map which can be
+ * used multiple times.
+ */
+typedef struct Option {
+ const OptionDef *opt;
+ const char *key;
+ const char *val;
+} Option;
+
+typedef struct OptionGroupDef {
+ /**< group name */
+ const char *name;
+ /**
+ * Option to be used as group separator. Can be NULL for groups which
+ * are terminated by a non-option argument (e.g. avconv output files)
+ */
+ const char *sep;
+} OptionGroupDef;
+
+typedef struct OptionGroup {
+ const OptionGroupDef *group_def;
+ const char *arg;
+
+ Option *opts;
+ int nb_opts;
+
+ AVDictionary *codec_opts;
+ AVDictionary *format_opts;
+ struct SwsContext *sws_opts;
+} OptionGroup;
+
+/**
+ * A list of option groups that all have the same group type
+ * (e.g. input files or output files)
+ */
+typedef struct OptionGroupList {
+ const OptionGroupDef *group_def;
+
+ OptionGroup *groups;
+ int nb_groups;
+} OptionGroupList;
+
+typedef struct OptionParseContext {
+ OptionGroup global_opts;
+
+ OptionGroupList *groups;
+ int nb_groups;
+
+ /* parsing state */
+ OptionGroup cur_group;
+} OptionParseContext;
+
+/**
+ * Parse an options group and write results into optctx.
+ *
+ * @param optctx an app-specific options context. NULL for global options group
+ */
+int parse_optgroup(void *optctx, OptionGroup *g);
+
+/**
+ * Split the commandline into an intermediate form convenient for further
+ * processing.
+ *
+ * The commandline is assumed to be composed of options which either belong to a
+ * group (those with OPT_SPEC, OPT_OFFSET or OPT_PERFILE) or are global
+ * (everything else).
+ *
+ * A group (defined by an OptionGroupDef struct) is a sequence of options
+ * terminated by either a group separator option (e.g. -i) or a parameter that
+ * is not an option (doesn't start with -). A group without a separator option
+ * must always be first in the supplied groups list.
+ *
+ * All options within the same group are stored in one OptionGroup struct in an
+ * OptionGroupList, all groups with the same group definition are stored in one
+ * OptionGroupList in OptionParseContext.groups. The order of group lists is the
+ * same as the order of group definitions.
+ */
+int split_commandline(OptionParseContext *octx, int argc, char *argv[],
+ const OptionDef *options,
+ const OptionGroupDef *groups, int nb_groups);
+
+/**
+ * Free all allocated memory in an OptionParseContext.
+ */
+void uninit_parse_context(OptionParseContext *octx);
+
+/**
* Find the '-loglevel' option in the command line args and apply it.
*/
void parse_loglevel(int argc, char **argv, const OptionDef *options);
/**
+ * Return index of option opt in argv or 0 if not found.
+ */
+int locate_option(int argc, char **argv, const OptionDef *options,
+ const char *optname);
+
+/**
* Check if the given stream matches a stream specifier.
*
* @param s Corresponding format context.
@@ -206,12 +321,16 @@ int check_stream_specifier(AVFormatContext *s, AVStream *st, const char *spec);
* Create a new options dictionary containing only the options from
* opts which apply to the codec with ID codec_id.
*
+ * @param opts dictionary to place options in
+ * @param codec_id ID of the codec that should be filtered for
* @param s Corresponding format context.
* @param st A stream from s for which the options should be filtered.
+ * @param codec The particular codec for which the options should be filtered.
+ * If null, the default one is looked up according to the codec id.
* @return a pointer to the created dictionary
*/
-AVDictionary *filter_codec_opts(AVDictionary *opts, enum CodecID codec_id,
- AVFormatContext *s, AVStream *st);
+AVDictionary *filter_codec_opts(AVDictionary *opts, enum AVCodecID codec_id,
+ AVFormatContext *s, AVStream *st, AVCodec *codec);
/**
* Setup AVCodecContext options for avformat_find_stream_info().
@@ -250,55 +369,67 @@ void show_banner(void);
* depends on the current versions of the repository and of the libav*
* libraries.
*/
-void show_version(void);
+int show_version(void *optctx, const char *opt, const char *arg);
/**
* Print the license of the program to stdout. The license depends on
* the license of the libraries compiled into the program.
*/
-void show_license(void);
+int show_license(void *optctx, const char *opt, const char *arg);
/**
* Print a listing containing all the formats supported by the
* program.
*/
-void show_formats(void);
+int show_formats(void *optctx, const char *opt, const char *arg);
/**
* Print a listing containing all the codecs supported by the
* program.
*/
-void show_codecs(void);
+int show_codecs(void *optctx, const char *opt, const char *arg);
+
+/**
+ * Print a listing containing all the decoders supported by the
+ * program.
+ */
+int show_decoders(void *optctx, const char *opt, const char *arg);
+
+/**
+ * Print a listing containing all the encoders supported by the
+ * program.
+ */
+int show_encoders(void *optctx, const char *opt, const char *arg);
/**
* Print a listing containing all the filters supported by the
* program.
*/
-void show_filters(void);
+int show_filters(void *optctx, const char *opt, const char *arg);
/**
* Print a listing containing all the bit stream filters supported by the
* program.
*/
-void show_bsfs(void);
+int show_bsfs(void *optctx, const char *opt, const char *arg);
/**
* Print a listing containing all the protocols supported by the
* program.
*/
-void show_protocols(void);
+int show_protocols(void *optctx, const char *opt, const char *arg);
/**
* Print a listing containing all the pixel formats supported by the
* program.
*/
-void show_pix_fmts(void);
+int show_pix_fmts(void *optctx, const char *opt, const char *arg);
/**
* Print a listing containing all the sample formats supported by the
* program.
*/
-int show_sample_fmts(const char *opt, const char *arg);
+int show_sample_fmts(void *optctx, const char *opt, const char *arg);
/**
* Return a positive value if a line read from standard input
@@ -310,6 +441,7 @@ int read_yesno(void);
* Read the file with name filename, and put its content in a newly
* allocated 0-terminated buffer.
*
+ * @param filename file to read from
* @param bufptr location where pointer to buffer is returned
* @param size location where size of buffer is returned
* @return 0 in case of success, a negative value corresponding to an
@@ -317,7 +449,7 @@ int read_yesno(void);
*/
int cmdutils_read_file(const char *filename, char **bufptr, size_t *size);
-typedef struct {
+typedef struct PtsCorrectionContext {
int64_t num_faulty_pts; /// Number of incorrect PTS values so far
int64_t num_faulty_dts; /// Number of incorrect DTS values so far
int64_t last_pts; /// PTS of the last frame
@@ -334,6 +466,7 @@ void init_pts_correction(PtsCorrectionContext *ctx);
* which might have incorrect times. Input timestamps may wrap around, in
* which case the output will as well.
*
+ * @param ctx the PtsCorrectionContext carrying stream pts information
* @param pts the pts field of the decoded AVPacket, as passed through
* AVCodecContext.reordered_opaque
* @param dts the dts field of the decoded AVPacket
@@ -361,35 +494,80 @@ int64_t guess_correct_pts(PtsCorrectionContext *ctx, int64_t pts, int64_t dts);
FILE *get_preset_file(char *filename, size_t filename_size,
const char *preset_name, int is_path, const char *codec_name);
-typedef struct {
- enum PixelFormat pix_fmt;
-} AVSinkContext;
+/**
+ * Realloc array to hold new_size elements of elem_size.
+ * Calls exit() on failure.
+ *
+ * @param array array to reallocate
+ * @param elem_size size in bytes of each element
+ * @param size new element count will be written here
+ * @param new_size number of elements to place in reallocated array
+ * @return reallocated array
+ */
+void *grow_array(void *array, int elem_size, int *size, int new_size);
+
+#define GROW_ARRAY(array, nb_elems)\
+ array = grow_array(array, sizeof(*array), &nb_elems, nb_elems + 1)
+
+typedef struct FrameBuffer {
+ uint8_t *base[4];
+ uint8_t *data[4];
+ int linesize[4];
-extern AVFilter avsink;
+ int h, w;
+ enum AVPixelFormat pix_fmt;
+
+ int refcount;
+ struct FrameBuffer **pool; ///< head of the buffer pool
+ struct FrameBuffer *next;
+} FrameBuffer;
/**
- * Extract a frame from sink.
+ * Get a frame from the pool. This is intended to be used as a callback for
+ * AVCodecContext.get_buffer.
*
- * @return a negative error in case of failure, 1 if one frame has
- * been extracted successfully.
+ * @param s codec context. s->opaque must be a pointer to the head of the
+ * buffer pool.
+ * @param frame frame->opaque will be set to point to the FrameBuffer
+ * containing the frame data.
*/
-int get_filtered_video_frame(AVFilterContext *sink, AVFrame *frame,
- AVFilterBufferRef **picref, AVRational *pts_tb);
+int codec_get_buffer(AVCodecContext *s, AVFrame *frame);
/**
- * Do all the necessary cleanup and abort.
- * This function is implemented in the avtools, not cmdutils.
+ * A callback to be used for AVCodecContext.release_buffer along with
+ * codec_get_buffer().
*/
-void exit_program(int ret);
+void codec_release_buffer(AVCodecContext *s, AVFrame *frame);
/**
- * Realloc array to hold new_size elements of elem_size.
- * Calls exit_program() on failure.
- *
- * @param elem_size size in bytes of each element
- * @param size new element count will be written here
- * @return reallocated array
+ * A callback to be used for AVFilterBuffer.free.
+ * @param fb buffer to free. fb->priv must be a pointer to the FrameBuffer
+ * containing the buffer data.
*/
-void *grow_array(void *array, int elem_size, int *size, int new_size);
+void filter_release_buffer(AVFilterBuffer *fb);
+
+/**
+ * Free all the buffers in the pool. This must be called after all the
+ * buffers have been released.
+ */
+void free_buffer_pool(FrameBuffer **pool);
+
+#define GET_PIX_FMT_NAME(pix_fmt)\
+ const char *name = av_get_pix_fmt_name(pix_fmt);
+
+#define GET_SAMPLE_FMT_NAME(sample_fmt)\
+ const char *name = av_get_sample_fmt_name(sample_fmt)
+
+#define GET_SAMPLE_RATE_NAME(rate)\
+ char name[16];\
+ snprintf(name, sizeof(name), "%d", rate);
+
+#define GET_CH_LAYOUT_NAME(ch_layout)\
+ char name[16];\
+ snprintf(name, sizeof(name), "0x%"PRIx64, ch_layout);
+
+#define GET_CH_LAYOUT_DESC(ch_layout)\
+ char name[128];\
+ av_get_channel_layout_string(name, sizeof(name), 0, ch_layout);
#endif /* LIBAV_CMDUTILS_H */
diff --git a/gst-libs/ext/libav/cmdutils_common_opts.h b/gst-libs/ext/libav/cmdutils_common_opts.h
index 1158afa..619cd89 100644
--- a/gst-libs/ext/libav/cmdutils_common_opts.h
+++ b/gst-libs/ext/libav/cmdutils_common_opts.h
@@ -1,15 +1,17 @@
- { "L", OPT_EXIT, {(void*)show_license}, "show license" },
- { "h", OPT_EXIT, {(void*)show_help}, "show help" },
- { "?", OPT_EXIT, {(void*)show_help}, "show help" },
- { "help", OPT_EXIT, {(void*)show_help}, "show help" },
- { "-help", OPT_EXIT, {(void*)show_help}, "show help" },
- { "version", OPT_EXIT, {(void*)show_version}, "show version" },
- { "formats" , OPT_EXIT, {(void*)show_formats }, "show available formats" },
- { "codecs" , OPT_EXIT, {(void*)show_codecs }, "show available codecs" },
- { "bsfs" , OPT_EXIT, {(void*)show_bsfs }, "show available bit stream filters" },
- { "protocols", OPT_EXIT, {(void*)show_protocols}, "show available protocols" },
- { "filters", OPT_EXIT, {(void*)show_filters }, "show available filters" },
- { "pix_fmts" , OPT_EXIT, {(void*)show_pix_fmts }, "show available pixel formats" },
+ { "L" , OPT_EXIT, {.func_arg = show_license}, "show license" },
+ { "h" , OPT_EXIT, {.func_arg = show_help}, "show help", "topic" },
+ { "?" , OPT_EXIT, {.func_arg = show_help}, "show help", "topic" },
+ { "help" , OPT_EXIT, {.func_arg = show_help}, "show help", "topic" },
+ { "-help" , OPT_EXIT, {.func_arg = show_help}, "show help", "topic" },
+ { "version" , OPT_EXIT, {.func_arg = show_version}, "show version" },
+ { "formats" , OPT_EXIT, {.func_arg = show_formats }, "show available formats" },
+ { "codecs" , OPT_EXIT, {.func_arg = show_codecs }, "show available codecs" },
+ { "decoders" , OPT_EXIT, {.func_arg = show_decoders }, "show available decoders" },
+ { "encoders" , OPT_EXIT, {.func_arg = show_encoders }, "show available encoders" },
+ { "bsfs" , OPT_EXIT, {.func_arg = show_bsfs }, "show available bit stream filters" },
+ { "protocols" , OPT_EXIT, {.func_arg = show_protocols}, "show available protocols" },
+ { "filters" , OPT_EXIT, {.func_arg = show_filters }, "show available filters" },
+ { "pix_fmts" , OPT_EXIT, {.func_arg = show_pix_fmts }, "show available pixel formats" },
{ "sample_fmts", OPT_EXIT, {.func_arg = show_sample_fmts }, "show available audio sample formats" },
- { "loglevel", HAS_ARG, {(void*)opt_loglevel}, "set libav* logging level", "loglevel" },
- { "v", HAS_ARG, {(void*)opt_loglevel}, "set libav* logging level", "loglevel" },
+ { "loglevel" , HAS_ARG, {.func_arg = opt_loglevel}, "set libav* logging level", "loglevel" },
+ { "v", HAS_ARG, {.func_arg = opt_loglevel}, "set libav* logging level", "loglevel" },
diff --git a/gst-libs/ext/libav/common.mak b/gst-libs/ext/libav/common.mak
index 9193455..5d80986 100644
--- a/gst-libs/ext/libav/common.mak
+++ b/gst-libs/ext/libav/common.mak
@@ -5,13 +5,14 @@
# first so "all" becomes default target
all: all-yes
-OBJS-$(HAVE_MMX) += $(MMX-OBJS-yes)
+include $(SRC_PATH)/arch.mak
OBJS += $(OBJS-yes)
FFLIBS := $(FFLIBS-yes) $(FFLIBS)
TESTPROGS += $(TESTPROGS-yes)
-FFEXTRALIBS := $(FFLIBS:%=-l%$(BUILDSUF)) $(EXTRALIBS)
+LDLIBS = $(FFLIBS:%=%$(BUILDSUF))
+FFEXTRALIBS := $(LDLIBS:%=$(LD_LIB)) $(EXTRALIBS)
EXAMPLES := $(EXAMPLES:%=$(SUBDIR)%-example$(EXESUF))
OBJS := $(sort $(OBJS:%=$(SUBDIR)%))
@@ -22,21 +23,24 @@ HOSTPROGS := $(HOSTPROGS:%=$(SUBDIR)%$(HOSTEXESUF))
TOOLS += $(TOOLS-yes)
TOOLOBJS := $(TOOLS:%=tools/%.o)
TOOLS := $(TOOLS:%=tools/%$(EXESUF))
+HEADERS += $(HEADERS-yes)
DEP_LIBS := $(foreach NAME,$(FFLIBS),lib$(NAME)/$($(CONFIG_SHARED:yes=S)LIBNAME))
ALLHEADERS := $(subst $(SRC_DIR)/,$(SUBDIR),$(wildcard $(SRC_DIR)/*.h $(SRC_DIR)/$(ARCH)/*.h))
SKIPHEADERS += $(ARCH_HEADERS:%=$(ARCH)/%) $(SKIPHEADERS-)
SKIPHEADERS := $(SKIPHEADERS:%=$(SUBDIR)%)
-checkheaders: $(filter-out $(SKIPHEADERS:.h=.ho),$(ALLHEADERS:.h=.ho))
+HOBJS = $(filter-out $(SKIPHEADERS:.h=.h.o),$(ALLHEADERS:.h=.h.o))
+checkheaders: $(HOBJS)
+.SECONDARY: $(HOBJS:.o=.c)
alltools: $(TOOLS)
$(HOSTOBJS): %.o: %.c
- $(HOSTCC) $(HOSTCFLAGS) -c -o $@ $<
+ $(call COMPILE,HOSTCC)
$(HOSTPROGS): %$(HOSTEXESUF): %.o
- $(HOSTCC) $(HOSTLDFLAGS) -o $@ $< $(HOSTLIBS)
+ $(HOSTLD) $(HOSTLDFLAGS) $(HOSTLD_O) $< $(HOSTLIBS)
$(OBJS): | $(sort $(dir $(OBJS)))
$(HOSTOBJS): | $(sort $(dir $(HOSTOBJS)))
@@ -45,9 +49,9 @@ $(TOOLOBJS): | tools
OBJDIRS := $(OBJDIRS) $(dir $(OBJS) $(HOSTOBJS) $(TESTOBJS))
-CLEANSUFFIXES = *.d *.o *~ *.ho *.map *.ver
+CLEANSUFFIXES = *.d *.o *~ *.h.c *.map *.ver
DISTCLEANSUFFIXES = *.pc
-LIBSUFFIXES = *.a *.lib *.so *.so.* *.dylib *.dll *.def *.dll.a *.exp
+LIBSUFFIXES = *.a *.lib *.so *.so.* *.dylib *.dll *.def *.dll.a
define RULES
clean::
@@ -58,4 +62,4 @@ endef
$(eval $(RULES))
--include $(wildcard $(OBJS:.o=.d) $(TESTOBJS:.o=.d))
+-include $(wildcard $(OBJS:.o=.d) $(HOSTOBJS:.o=.d) $(TESTOBJS:.o=.d) $(HOBJS:.o=.d))
diff --git a/gst-libs/ext/libav/compat/getopt.c b/gst-libs/ext/libav/compat/getopt.c
new file mode 100644
index 0000000..3e7d3e2
--- /dev/null
+++ b/gst-libs/ext/libav/compat/getopt.c
@@ -0,0 +1,85 @@
+/*
+ * 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
+ */
+
+/*
+ * This file was copied from the following newsgroup posting:
+ *
+ * Newsgroups: mod.std.unix
+ * Subject: public domain AT&T getopt source
+ * Date: 3 Nov 85 19:34:15 GMT
+ *
+ * Here's something you've all been waiting for: the AT&T public domain
+ * source for getopt(3). It is the code which was given out at the 1985
+ * UNIFORUM conference in Dallas. I obtained it by electronic mail
+ * directly from AT&T. The people there assure me that it is indeed
+ * in the public domain.
+ */
+
+#include <stdio.h>
+#include <string.h>
+
+static int opterr = 1;
+static int optind = 1;
+static int optopt;
+static char *optarg;
+
+#undef fprintf
+
+static int getopt(int argc, char *argv[], char *opts)
+{
+ static int sp = 1;
+ int c;
+ char *cp;
+
+ if (sp == 1)
+ if (optind >= argc ||
+ argv[optind][0] != '-' || argv[optind][1] == '\0')
+ return EOF;
+ else if (!strcmp(argv[optind], "--")) {
+ optind++;
+ return EOF;
+ }
+ optopt = c = argv[optind][sp];
+ if (c == ':' || (cp = strchr(opts, c)) == NULL) {
+ fprintf(stderr, ": illegal option -- %c\n", c);
+ if (argv[optind][++sp] == '\0') {
+ optind++;
+ sp = 1;
+ }
+ return '?';
+ }
+ if (*++cp == ':') {
+ if (argv[optind][sp+1] != '\0')
+ optarg = &argv[optind++][sp+1];
+ else if(++optind >= argc) {
+ fprintf(stderr, ": option requires an argument -- %c\n", c);
+ sp = 1;
+ return '?';
+ } else
+ optarg = argv[optind++];
+ sp = 1;
+ } else {
+ if (argv[optind][++sp] == '\0') {
+ sp = 1;
+ optind++;
+ }
+ optarg = NULL;
+ }
+
+ return c;
+}
diff --git a/gst-libs/ext/libav/compat/msvcrt/snprintf.c b/gst-libs/ext/libav/compat/msvcrt/snprintf.c
new file mode 100644
index 0000000..0af7b54
--- /dev/null
+++ b/gst-libs/ext/libav/compat/msvcrt/snprintf.c
@@ -0,0 +1,70 @@
+/*
+ * C99-compatible snprintf() and vsnprintf() implementations
+ * Copyright (c) 2012 Ronald S. Bultje <rsbultje@gmail.com>
+ *
+ * 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
+ */
+
+#include <stdio.h>
+#include <stdarg.h>
+#include <limits.h>
+#include <string.h>
+
+#include "libavutil/error.h"
+
+#if !defined(va_copy) && defined(_MSC_VER)
+#define va_copy(dst, src) ((dst) = (src))
+#endif
+
+int avpriv_snprintf(char *s, size_t n, const char *fmt, ...)
+{
+ va_list ap;
+ int ret;
+
+ va_start(ap, fmt);
+ ret = avpriv_vsnprintf(s, n, fmt, ap);
+ va_end(ap);
+
+ return ret;
+}
+
+int avpriv_vsnprintf(char *s, size_t n, const char *fmt,
+ va_list ap)
+{
+ int ret;
+ va_list ap_copy;
+
+ if (n == 0)
+ return _vscprintf(fmt, ap);
+ else if (n > INT_MAX)
+ return AVERROR(EOVERFLOW);
+
+ /* we use n - 1 here because if the buffer is not big enough, the MS
+ * runtime libraries don't add a terminating zero at the end. MSDN
+ * recommends to provide _snprintf/_vsnprintf() a buffer size that
+ * is one less than the actual buffer, and zero it before calling
+ * _snprintf/_vsnprintf() to workaround this problem.
+ * See http://msdn.microsoft.com/en-us/library/1kt27hek(v=vs.80).aspx */
+ memset(s, 0, n);
+ va_copy(ap_copy, ap);
+ ret = _vsnprintf(s, n - 1, fmt, ap_copy);
+ va_end(ap_copy);
+ if (ret == -1)
+ ret = _vscprintf(fmt, ap);
+
+ return ret;
+}
diff --git a/gst-libs/ext/libav/compat/plan9/head b/gst-libs/ext/libav/compat/plan9/head
new file mode 100755
index 0000000..2840b2d
--- /dev/null
+++ b/gst-libs/ext/libav/compat/plan9/head
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+n=10
+
+case "$1" in
+ -n) n=$2; shift 2 ;;
+ -n*) n=${1#-n}; shift ;;
+esac
+
+exec sed ${n}q "$@"
diff --git a/gst-libs/ext/libav/compat/plan9/main.c b/gst-libs/ext/libav/compat/plan9/main.c
new file mode 100644
index 0000000..97d7067
--- /dev/null
+++ b/gst-libs/ext/libav/compat/plan9/main.c
@@ -0,0 +1,34 @@
+/*
+ * 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
+ */
+
+int plan9_main(int argc, char **argv);
+
+#undef main
+int main(int argc, char **argv)
+{
+ /* The setfcr() function in lib9 is broken, must use asm. */
+#ifdef __i386
+ short fcr;
+ __asm__ volatile ("fstcw %0 \n"
+ "or $63, %0 \n"
+ "fldcw %0 \n"
+ : "=m"(fcr));
+#endif
+
+ return plan9_main(argc, argv);
+}
diff --git a/gst-libs/ext/libav/compat/plan9/printf b/gst-libs/ext/libav/compat/plan9/printf
new file mode 100755
index 0000000..1a70a9e
--- /dev/null
+++ b/gst-libs/ext/libav/compat/plan9/printf
@@ -0,0 +1,2 @@
+#!/bin/sh
+exec awk "BEGIN { for (i = 2; i < ARGC; i++) printf \"$1\", ARGV[i] }" "$@"
diff --git a/gst-libs/ext/libav/compat/strtod.c b/gst-libs/ext/libav/compat/strtod.c
new file mode 100644
index 0000000..7e979e8
--- /dev/null
+++ b/gst-libs/ext/libav/compat/strtod.c
@@ -0,0 +1,94 @@
+/*
+ * C99-compatible strtod() implementation
+ * Copyright (c) 2012 Ronald S. Bultje <rsbultje@gmail.com>
+ *
+ * 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
+ */
+
+#include <ctype.h>
+#include <limits.h>
+#include <stdlib.h>
+
+#include "libavutil/avstring.h"
+#include "libavutil/mathematics.h"
+
+static char *check_nan_suffix(char *s)
+{
+ char *start = s;
+
+ if (*s++ != '(')
+ return start;
+
+ while ((*s >= 'a' && *s <= 'z') || (*s >= 'A' && *s <= 'Z') ||
+ (*s >= '0' && *s <= '9') || *s == '_')
+ s++;
+
+ return *s == ')' ? s + 1 : start;
+}
+
+#undef strtod
+double strtod(const char *, char **);
+
+double avpriv_strtod(const char *nptr, char **endptr)
+{
+ char *end;
+ double res;
+
+ /* Skip leading spaces */
+ while (isspace(*nptr))
+ nptr++;
+
+ if (!av_strncasecmp(nptr, "infinity", 8)) {
+ end = nptr + 8;
+ res = INFINITY;
+ } else if (!av_strncasecmp(nptr, "inf", 3)) {
+ end = nptr + 3;
+ res = INFINITY;
+ } else if (!av_strncasecmp(nptr, "+infinity", 9)) {
+ end = nptr + 9;
+ res = INFINITY;
+ } else if (!av_strncasecmp(nptr, "+inf", 4)) {
+ end = nptr + 4;
+ res = INFINITY;
+ } else if (!av_strncasecmp(nptr, "-infinity", 9)) {
+ end = nptr + 9;
+ res = -INFINITY;
+ } else if (!av_strncasecmp(nptr, "-inf", 4)) {
+ end = nptr + 4;
+ res = -INFINITY;
+ } else if (!av_strncasecmp(nptr, "nan", 3)) {
+ end = check_nan_suffix(nptr + 3);
+ res = NAN;
+ } else if (!av_strncasecmp(nptr, "+nan", 4) ||
+ !av_strncasecmp(nptr, "-nan", 4)) {
+ end = check_nan_suffix(nptr + 4);
+ res = NAN;
+ } else if (!av_strncasecmp(nptr, "0x", 2) ||
+ !av_strncasecmp(nptr, "-0x", 3) ||
+ !av_strncasecmp(nptr, "+0x", 3)) {
+ /* FIXME this doesn't handle exponents, non-integers (float/double)
+ * and numbers too large for long long */
+ res = strtoll(nptr, &end, 16);
+ } else {
+ res = strtod(nptr, &end);
+ }
+
+ if (endptr)
+ *endptr = end;
+
+ return res;
+}
diff --git a/gst-libs/ext/libav/compat/tms470/math.h b/gst-libs/ext/libav/compat/tms470/math.h
new file mode 100644
index 0000000..1104d74
--- /dev/null
+++ b/gst-libs/ext/libav/compat/tms470/math.h
@@ -0,0 +1,7 @@
+#include_next <math.h>
+
+#undef INFINITY
+#undef NAN
+
+#define INFINITY (*(const float*)((const unsigned []){ 0x7f800000 }))
+#define NAN (*(const float*)((const unsigned []){ 0x7fc00000 }))
diff --git a/gst-libs/ext/libav/configure b/gst-libs/ext/libav/configure
index 35cd91a..dea4bde 100755
--- a/gst-libs/ext/libav/configure
+++ b/gst-libs/ext/libav/configure
@@ -54,13 +54,28 @@ if test "$E1" != 0 || test "$E2" = 0; then
exit 1
fi
+test -d /usr/xpg4/bin && PATH=/usr/xpg4/bin:$PATH
+
show_help(){
-cat <<EOF
+ cat <<EOF
Usage: configure [options]
Options: [defaults in brackets after descriptions]
-Standard options:
+Help options:
--help print this message
+ --list-decoders show all available decoders
+ --list-encoders show all available encoders
+ --list-hwaccels show all available hardware accelerators
+ --list-demuxers show all available demuxers
+ --list-muxers show all available muxers
+ --list-parsers show all available parsers
+ --list-protocols show all available protocols
+ --list-bsfs show all available bitstream filters
+ --list-indevs show all available input devices
+ --list-outdevs show all available output devices
+ --list-filters show all available filters
+
+Standard options:
--logfile=FILE log tests and output to FILE [config.log]
--disable-logging do not log configure debug information
--prefix=PREFIX install in PREFIX [$prefix]
@@ -71,52 +86,55 @@ Standard options:
--incdir=DIR install includes in DIR [PREFIX/include]
--mandir=DIR install man page in DIR [PREFIX/share/man]
-Configuration options:
- --disable-static do not build static libraries [no]
- --enable-shared build shared libraries [no]
+Licensing options:
--enable-gpl allow use of GPL code, the resulting libs
and binaries will be under GPL [no]
--enable-version3 upgrade (L)GPL to version 3 [no]
--enable-nonfree allow use of nonfree code, the resulting libs
and binaries will be unredistributable [no]
- --disable-doc do not build documentation
- --disable-ffmpeg disable ffmpeg build
+
+Configuration options:
+ --disable-static do not build static libraries [no]
+ --enable-shared build shared libraries [no]
+ --enable-small optimize for size instead of speed
+ --enable-runtime-cpudetect detect cpu capabilities at runtime (bigger binary)
+ --enable-gray enable full grayscale support (slower color)
+ --disable-swscale-alpha disable alpha channel support in swscale
+ --disable-all disable building components, libraries and programs
+
+Program options:
+ --disable-programs do not build command line programs
--disable-avconv disable avconv build
--disable-avplay disable avplay build
--disable-avprobe disable avprobe build
--disable-avserver disable avserver build
+
+Component options:
+ --disable-doc do not build documentation
--disable-avdevice disable libavdevice build
--disable-avcodec disable libavcodec build
--disable-avformat disable libavformat build
+ --disable-avutil disable libavutil build
--disable-swscale disable libswscale build
- --enable-postproc enable libpostproc build (deprecated) [no]
--disable-avfilter disable video filter support [no]
+ --disable-avresample disable libavresample build [no]
--disable-pthreads disable pthreads [auto]
--disable-w32threads disable Win32 threads [auto]
--enable-x11grab enable X11 grabbing [no]
--disable-network disable network support [no]
- --enable-gray enable full grayscale support (slower color)
- --disable-swscale-alpha disable alpha channel support in swscale
- --disable-fastdiv disable table-based division
- --enable-small optimize for size instead of speed
- --disable-aandct disable AAN DCT code
--disable-dct disable DCT code
- --disable-fft disable FFT code
- --disable-golomb disable Golomb code
- --disable-huffman disable Huffman code
- --disable-lpc disable LPC code
+ --disable-dwt disable DWT code
+ --disable-lsp disable LSP code
+ --disable-lzo disable LZO decoder code
--disable-mdct disable MDCT code
--disable-rdft disable RDFT code
+ --disable-fft disable FFT code
+ --enable-dxva2 enable DXVA2 code
--enable-vaapi enable VAAPI code
--enable-vda enable VDA code
--enable-vdpau enable VDPAU code
- --disable-dxva2 disable DXVA2 code
- --enable-runtime-cpudetect detect cpu capabilities at runtime (bigger binary)
- --enable-hardcoded-tables use hardcoded tables instead of runtime generation
- --disable-safe-bitstream-reader
- disable buffer boundary checking in bitreaders
- (faster, but may crash)
- --enable-memalign-hack emulate memalign, interferes with memory debuggers
+
+Individual component options:
--disable-everything disable all components listed below
--disable-encoder=NAME disable encoder NAME
--enable-encoder=NAME enable encoder NAME
@@ -142,60 +160,49 @@ Configuration options:
--enable-protocol=NAME enable protocol NAME
--disable-protocol=NAME disable protocol NAME
--disable-protocols disable all protocols
+ --enable-indev=NAME enable input device NAME
--disable-indev=NAME disable input device NAME
- --disable-outdev=NAME disable output device NAME
--disable-indevs disable input devices
+ --enable-outdev=NAME enable output device NAME
+ --disable-outdev=NAME disable output device NAME
--disable-outdevs disable output devices
--disable-devices disable all devices
--enable-filter=NAME enable filter NAME
--disable-filter=NAME disable filter NAME
--disable-filters disable all filters
- --list-decoders show all available decoders
- --list-encoders show all available encoders
- --list-hwaccels show all available hardware accelerators
- --list-muxers show all available muxers
- --list-demuxers show all available demuxers
- --list-parsers show all available parsers
- --list-protocols show all available protocols
- --list-bsfs show all available bitstream filters
- --list-indevs show all available input devices
- --list-outdevs show all available output devices
- --list-filters show all available filters
External library support:
--enable-avisynth enable reading of AVISynth script files [no]
--enable-bzlib enable bzlib [autodetect]
--enable-frei0r enable frei0r video filtering
--enable-gnutls enable gnutls [no]
- --enable-libopencore-amrnb enable AMR-NB de/encoding via libopencore-amrnb [no]
- --enable-libopencore-amrwb enable AMR-WB decoding via libopencore-amrwb [no]
- --enable-libopencv enable video filtering via libopencv [no]
--enable-libcdio enable audio CD grabbing with libcdio
--enable-libdc1394 enable IIDC-1394 grabbing using libdc1394
and libraw1394 [no]
- --enable-libdirac enable Dirac support via libdirac [no]
- --enable-libfaac enable FAAC support via libfaac [no]
+ --enable-libfaac enable AAC encoding via libfaac [no]
+ --enable-libfdk-aac enable AAC encoding via libfdk-aac [no]
--enable-libfreetype enable libfreetype [no]
- --enable-libgsm enable GSM support via libgsm [no]
+ --enable-libgsm enable GSM de/encoding via libgsm [no]
+ --enable-libilbc enable iLBC de/encoding via libilbc [no]
--enable-libmp3lame enable MP3 encoding via libmp3lame [no]
- --enable-libnut enable NUT (de)muxing via libnut,
- native (de)muxer exists [no]
- --enable-libopenjpeg enable JPEG 2000 decoding via OpenJPEG [no]
+ --enable-libopencore-amrnb enable AMR-NB de/encoding via libopencore-amrnb [no]
+ --enable-libopencore-amrwb enable AMR-WB decoding via libopencore-amrwb [no]
+ --enable-libopencv enable video filtering via libopencv [no]
+ --enable-libopenjpeg enable JPEG 2000 de/encoding via OpenJPEG [no]
+ --enable-libopus enable Opus decoding via libopus [no]
--enable-libpulse enable Pulseaudio input via libpulse [no]
--enable-librtmp enable RTMP[E] support via librtmp [no]
- --enable-libschroedinger enable Dirac support via libschroedinger [no]
- --enable-libspeex enable Speex support via libspeex [no]
+ --enable-libschroedinger enable Dirac de/encoding via libschroedinger [no]
+ --enable-libspeex enable Speex de/encoding via libspeex [no]
--enable-libtheora enable Theora encoding via libtheora [no]
--enable-libvo-aacenc enable AAC encoding via libvo-aacenc [no]
--enable-libvo-amrwbenc enable AMR-WB encoding via libvo-amrwbenc [no]
- --enable-libvorbis enable Vorbis encoding via libvorbis,
- native implementation exists [no]
- --enable-libvpx enable VP8 support via libvpx [no]
+ --enable-libvorbis enable Vorbis encoding via libvorbis [no]
+ --enable-libvpx enable VP8 de/encoding via libvpx [no]
--enable-libx264 enable H.264 encoding via x264 [no]
--enable-libxavs enable AVS encoding via xavs [no]
--enable-libxvid enable Xvid encoding via xvidcore,
native MPEG-4/Xvid encoder exists [no]
- --enable-mlib enable Sun medialib [no]
--enable-openssl enable openssl [no]
--enable-zlib enable zlib [autodetect]
@@ -207,46 +214,63 @@ Advanced options (experts only):
--target-os=OS compiler targets OS [$target_os]
--target-exec=CMD command to run executables on target
--target-path=DIR path to view of build directory on target
+ --toolchain=NAME set tool defaults according to NAME
--nm=NM use nm tool
--ar=AR use archive tool AR [$ar_default]
--as=AS use assembler AS [$as_default]
--cc=CC use C compiler CC [$cc_default]
+ --dep-cc=DEPCC use dependency generator DEPCC [$cc_default]
--ld=LD use linker LD
--host-cc=HOSTCC use host C compiler HOSTCC
--host-cflags=HCFLAGS use HCFLAGS when compiling for host
+ --host-ld=HOSTLD use host linker HOSTLD
--host-ldflags=HLDFLAGS use HLDFLAGS when linking for host
--host-libs=HLIBS use libs HLIBS when linking for host
+ --host-os=OS compiler host OS [$target_os]
--extra-cflags=ECFLAGS add ECFLAGS to CFLAGS [$CFLAGS]
--extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS [$LDFLAGS]
--extra-libs=ELIBS add ELIBS [$ELIBS]
--extra-version=STRING version string suffix []
+ --optflags=OPTFLAGS override optimization-related compiler flags
--build-suffix=SUFFIX library name suffix []
+ --malloc-prefix=PREFIX prefix malloc and related names with PREFIX
--arch=ARCH select architecture [$arch]
--cpu=CPU select the minimum required CPU (affects
instruction selection, may crash on older CPUs)
+ --enable-pic build position-independent code
+ --enable-sram allow use of on-chip SRAM
+ --enable-thumb compile for Thumb instruction set
+ --disable-symver disable symbol versioning
+ --enable-hardcoded-tables use hardcoded tables instead of runtime generation
+ --disable-safe-bitstream-reader
+ disable buffer boundary checking in bitreaders
+ (faster, but may crash)
+ --enable-memalign-hack emulate memalign, interferes with memory debuggers
+ --enable-lto use link-time optimization
+
+Optimization options (experts only):
--disable-asm disable all assembler optimizations
--disable-altivec disable AltiVec optimizations
--disable-amd3dnow disable 3DNow! optimizations
--disable-amd3dnowext disable 3DNow! extended optimizations
--disable-mmx disable MMX optimizations
- --disable-mmx2 disable MMX2 optimizations
+ --disable-mmxext disable MMXEXT optimizations
--disable-sse disable SSE optimizations
+ --disable-sse2 disable SSE2 optimizations
+ --disable-sse3 disable SSE3 optimizations
--disable-ssse3 disable SSSE3 optimizations
+ --disable-sse4 disable SSE4 optimizations
+ --disable-sse42 disable SSE4.2 optimizations
--disable-avx disable AVX optimizations
+ --disable-fma4 disable FMA4 optimizations
--disable-armv5te disable armv5te optimizations
--disable-armv6 disable armv6 optimizations
--disable-armv6t2 disable armv6t2 optimizations
- --disable-armvfp disable ARM VFP optimizations
- --disable-iwmmxt disable iwmmxt optimizations
- --disable-mmi disable MMI optimizations
+ --disable-vfp disable VFP optimizations
--disable-neon disable NEON optimizations
--disable-vis disable VIS optimizations
+ --disable-inline-asm disable use of inline assembler
--disable-yasm disable use of yasm assembler
- --enable-pic build position-independent code
- --malloc-prefix=PFX prefix malloc and related names with PFX
- --enable-sram allow use of on-chip SRAM
- --disable-symver disable symbol versioning
- --optflags override optimization-related compiler flags
Developer options (useful when working on Libav itself):
--disable-debug disable debugging symbols
@@ -254,7 +278,17 @@ Developer options (useful when working on Libav itself):
--disable-optimizations disable compiler optimizations
--enable-extra-warnings enable more compiler warnings
--samples=PATH location of test samples for FATE, if not set use
- \$FATE_SAMPLES at make invocation time.
+ \$LIBAV_SAMPLES at make invocation time.
+ --enable-xmm-clobber-test check XMM registers for clobbering (Win64-only;
+ should be used only for debugging purposes)
+ --enable-random randomly enable/disable components
+ --disable-random
+ --enable-random=LIST randomly enable/disable specific components or
+ --disable-random=LIST component groups. LIST is a comma-separated list
+ of NAME[:PROB] entries where NAME is a component
+ (group) and PROB the probability associated with
+ NAME (default 0.5).
+ --random-seed=VALUE seed value for --enable/disable-random
NOTE: Object files are built at the place where configure is launched.
EOF
@@ -297,7 +331,7 @@ Rerun configure with logging enabled (do not use --disable-logging), and
include the log this produces with your report.
EOF
else
-cat <<EOF
+ cat <<EOF
Include the log file "$logfile" produced by configure as this will help
solving the problem.
EOF
@@ -350,6 +384,12 @@ map(){
for v; do eval $m; done
}
+add_suffix(){
+ suffix=$1
+ shift
+ for v; do echo ${v}${suffix}; done
+}
+
set_all(){
value=$1
shift
@@ -496,12 +536,13 @@ is_in(){
return 1
}
-check_deps(){
+do_check_deps(){
for cfg; do
cfg="${cfg#!}"
enabled ${cfg}_checking && die "Circular dependency for $cfg."
disabled ${cfg}_checking && continue
enable ${cfg}_checking
+ append allopts $cfg
eval dep_all="\$${cfg}_deps"
eval dep_any="\$${cfg}_deps_any"
@@ -511,7 +552,7 @@ check_deps(){
eval dep_ifn="\$${cfg}_if_any"
pushvar cfg dep_all dep_any dep_sel dep_sgs dep_ifa dep_ifn
- check_deps $dep_all $dep_any $dep_sel $dep_sgs $dep_ifa $dep_ifn
+ do_check_deps $dep_all $dep_any $dep_sel $dep_sgs $dep_ifa $dep_ifn
popvar cfg dep_all dep_any dep_sel dep_sgs dep_ifa dep_ifn
[ -n "$dep_ifa" ] && { enabled_all $dep_ifa && enable_weak $cfg; }
@@ -521,8 +562,6 @@ check_deps(){
disabled_any $dep_sel && disable $cfg
if enabled $cfg; then
- eval dep_extralibs="\$${cfg}_extralibs"
- test -n "$dep_extralibs" && add_extralibs $dep_extralibs
enable_deep $dep_sel
enable_deep_weak $dep_sgs
fi
@@ -531,38 +570,48 @@ check_deps(){
done
}
-print_config_h(){
- enabled $1 && v=1 || v=0
- echo "#define $2 $v"
-}
+check_deps(){
+ unset allopts
-print_config_mak(){
- enabled $1 && v= || v=!
- echo "$v$2=yes"
-}
+ do_check_deps "$@"
-print_config_asm(){
- enabled $1 && echo "%define $2"
+ for cfg in $allopts; do
+ enabled $cfg || continue
+ eval dep_extralibs="\$${cfg}_extralibs"
+ test -n "$dep_extralibs" && add_extralibs $dep_extralibs
+ done
}
print_config(){
pfx=$1
files=$2
shift 2
- for cfg; do
- ucname="$(toupper $cfg)"
- for f in $files; do
- "print_config_${f##*.}" $cfg ${pfx}${ucname} >>$f
- done
- done
+ map 'eval echo "$v \${$v:-no}"' "$@" |
+ awk "BEGIN { split(\"$files\", files) }
+ {
+ c = \"$pfx\" toupper(\$1);
+ v = \$2;
+ sub(/yes/, 1, v);
+ sub(/no/, 0, v);
+ for (f in files) {
+ file = files[f];
+ if (file ~ /\\.h\$/) {
+ printf(\"#define %s %d\\n\", c, v) >>file;
+ } else if (file ~ /\\.asm\$/) {
+ printf(\"%%define %s %d\\n\", c, v) >>file;
+ } else if (file ~ /\\.mak\$/) {
+ n = -v ? \"\" : \"!\";
+ printf(\"%s%s=yes\\n\", n, c) >>file;
+ }
+ }
+ }"
}
print_enabled(){
- test "$1" = -n && end=" " && shift || end="\n"
suf=$1
shift
for v; do
- enabled $v && printf "%s$end" ${v%$suf};
+ enabled $v && printf "%s\n" ${v%$suf};
done
}
@@ -579,23 +628,37 @@ prepend(){
}
add_cppflags(){
- append CPPFLAGS $($filter_cppflags "$@")
+ append CPPFLAGS "$@"
}
add_cflags(){
- append CFLAGS $($filter_cflags "$@")
+ append CFLAGS $($cflags_filter "$@")
}
add_asflags(){
- append ASFLAGS $($filter_asflags "$@")
+ append ASFLAGS $($asflags_filter "$@")
}
add_ldflags(){
- append LDFLAGS "$@"
+ append LDFLAGS $($ldflags_filter "$@")
}
add_extralibs(){
- prepend extralibs "$@"
+ prepend extralibs $($ldflags_filter "$@")
+}
+
+add_host_cflags(){
+ append host_cflags $($host_cflags_filter "$@")
+}
+
+add_host_ldflags(){
+ append host_ldflags $($host_ldflags_filter "$@")
+}
+
+add_compat(){
+ append compat_objs $1
+ shift
+ map 'add_cppflags -D$v' "$@"
}
check_cmd(){
@@ -603,38 +666,56 @@ check_cmd(){
"$@" >> $logfile 2>&1
}
+cc_o(){
+ eval printf '%s\\n' $CC_O
+}
+
+cc_e(){
+ eval printf '%s\\n' $CC_E
+}
+
check_cc(){
log check_cc "$@"
cat > $TMPC
log_file $TMPC
- check_cmd $cc $CPPFLAGS $CFLAGS "$@" -c -o $TMPO $TMPC
+ check_cmd $cc $CPPFLAGS $CFLAGS "$@" $CC_C $(cc_o $TMPO) $TMPC
}
check_cpp(){
log check_cpp "$@"
cat > $TMPC
log_file $TMPC
- check_cmd $cc $CPPFLAGS $CFLAGS "$@" -E -o $TMPO $TMPC
+ check_cmd $cc $CPPFLAGS $CFLAGS "$@" $(cc_e $TMPO) $TMPC
+}
+
+as_o(){
+ eval printf '%s\\n' $AS_O
}
check_as(){
log check_as "$@"
- cat > $TMPC
- log_file $TMPC
- check_cmd $as $CPPFLAGS $ASFLAGS "$@" -c -o $TMPO $TMPC
+ cat > $TMPS
+ log_file $TMPS
+ check_cmd $as $CPPFLAGS $ASFLAGS "$@" $AS_C $(as_o $TMPO) $TMPS
}
-check_asm(){
- log check_asm "$@"
+check_inline_asm(){
+ log check_inline_asm "$@"
name="$1"
code="$2"
shift 2
disable $name
- check_as "$@" <<EOF && enable $name
+ check_cc "$@" <<EOF && enable $name
void foo(void){ __asm__ volatile($code); }
EOF
}
+check_insn(){
+ log check_insn "$@"
+ check_inline_asm ${1}_inline "\"$2\""
+ echo "$2" | check_as && enable ${1}_external || disable ${1}_external
+}
+
check_yasm(){
log check_yasm "$@"
echo "$1" > $TMPS
@@ -643,20 +724,36 @@ check_yasm(){
check_cmd $yasmexe $YASMFLAGS "$@" -o $TMPO $TMPS
}
+ld_o(){
+ eval printf '%s\\n' $LD_O
+}
+
check_ld(){
log check_ld "$@"
- flags=''
- libs=''
- for f; do
- test "${f}" = "${f#-l}" && flags="$flags $f" || libs="$libs $f"
- done
- check_cc $($filter_cflags $flags) || return
- check_cmd $ld $LDFLAGS $flags -o $TMPE $TMPO $libs $extralibs
+ flags=$(filter_out '-l*' "$@")
+ libs=$(filter '-l*' "$@")
+ check_cc $($cflags_filter $flags) || return
+ flags=$($ldflags_filter $flags)
+ libs=$($ldflags_filter $libs)
+ check_cmd $ld $LDFLAGS $flags $(ld_o $TMPE) $TMPO $libs $extralibs
+}
+
+check_code(){
+ log check_code "$@"
+ check=$1
+ headers=$2
+ code=$3
+ shift 3
+ {
+ for hdr in $headers; do
+ echo "#include <$hdr>"
+ done
+ echo "int main(void) { $code; return 0; }"
+ } | check_$check "$@"
}
check_cppflags(){
log check_cppflags "$@"
- set -- $($filter_cppflags "$@")
check_cc "$@" <<EOF && append CPPFLAGS "$@"
int x;
EOF
@@ -664,7 +761,7 @@ EOF
check_cflags(){
log check_cflags "$@"
- set -- $($filter_cflags "$@")
+ set -- $($cflags_filter "$@")
check_cc "$@" <<EOF && append CFLAGS "$@"
int x;
EOF
@@ -707,11 +804,13 @@ EOF
check_mathfunc(){
log check_mathfunc "$@"
func=$1
- shift
+ narg=$2
+ shift 2
+ test $narg = 2 && args="f, g" || args="f"
disable $func
check_ld "$@" <<EOF && enable $func
#include <math.h>
-float foo(float f) { return $func(f); }
+float foo(float f, float g) { return $func($args); }
int main(void){ return 0; }
EOF
}
@@ -737,7 +836,7 @@ check_cpp_condition(){
header=$1
condition=$2
shift 2
- check_cpp $($filter_cppflags "$@") <<EOF
+ check_cpp "$@" <<EOF
#include <$header>
#if !($condition)
#error "unsatisfied condition: $condition"
@@ -793,6 +892,9 @@ check_exec_crash(){
static void sighandler(int sig){
raise(SIGTERM);
}
+int foo(void){
+ $code
+}
int main(void){
signal(SIGILL, sighandler);
signal(SIGFPE, sighandler);
@@ -800,7 +902,7 @@ int main(void){
#ifdef SIGBUS
signal(SIGBUS, sighandler);
#endif
- { $code }
+ foo();
}
EOF
}
@@ -811,15 +913,7 @@ check_type(){
type=$2
shift 2
disable_safe "$type"
- incs=""
- for hdr in $headers; do
- incs="$incs
-#include <$hdr>"
- done
- check_cc "$@" <<EOF && enable_safe "$type"
-$incs
-$type v;
-EOF
+ check_code cc "$headers" "$type v" "$@" && enable_safe "$type"
}
check_struct(){
@@ -829,15 +923,8 @@ check_struct(){
member=$3
shift 3
disable_safe "${struct}_${member}"
- incs=""
- for hdr in $headers; do
- incs="$incs
-#include <$hdr>"
- done
- check_cc "$@" <<EOF && enable_safe "${struct}_${member}"
-$incs
-const void *p = &(($struct *)0)->$member;
-EOF
+ check_code cc "$headers" "const void *p = &(($struct *)0)->$member" "$@" &&
+ enable_safe "${struct}_${member}"
}
require(){
@@ -863,15 +950,20 @@ require_pkg_config(){
add_extralibs $(get_safe ${pkg}_libs)
}
+hostcc_o(){
+ eval printf '%s\\n' $HOSTCC_O
+}
+
check_host_cc(){
log check_host_cc "$@"
cat > $TMPC
log_file $TMPC
- check_cmd $host_cc $host_cflags "$@" -c -o $TMPO $TMPC
+ check_cmd $host_cc $host_cflags "$@" $HOSTCC_C $(hostcc_o $TMPO) $TMPC
}
check_host_cflags(){
log check_host_cflags "$@"
+ set -- $($host_cflags_filter "$@")
check_host_cc "$@" <<EOF && append host_cflags "$@"
int x;
EOF
@@ -886,7 +978,7 @@ apply(){
cp_if_changed(){
cmp -s "$1" "$2" && echo "$2 is unchanged" && return
mkdir -p "$(dirname $2)"
- cp -f "$1" "$2"
+ $cp_f "$1" "$2"
}
# CONFIG_LIST contains configurable options, while HAVE_LIST is for
@@ -906,53 +998,52 @@ COMPONENT_LIST="
protocols
"
+LIBRARY_LIST="
+ avcodec
+ avdevice
+ avfilter
+ avformat
+ avresample
+ avutil
+ swscale
+"
+
PROGRAM_LIST="
avconv
avplay
avprobe
avserver
- ffmpeg
"
CONFIG_LIST="
$COMPONENT_LIST
+ $LIBRARY_LIST
$PROGRAM_LIST
- aandct
- ac3dsp
- avcodec
- avdevice
- avfilter
- avformat
avisynth
bzlib
dct
doc
dwt
dxva2
- fastdiv
fft
frei0r
gnutls
- golomb
gpl
gray
- h264chroma
- h264dsp
- h264pred
hardcoded_tables
- huffman
libcdio
libdc1394
- libdirac
libfaac
+ libfdk_aac
libfreetype
libgsm
+ libilbc
libmp3lame
- libnut
libopencore_amrnb
libopencore_amrwb
libopencv
libopenjpeg
+ libopus
libpulse
librtmp
libschroedinger
@@ -965,33 +1056,28 @@ CONFIG_LIST="
libx264
libxavs
libxvid
- lpc
lsp
+ lzo
mdct
memalign_hack
- mlib
- mpegaudiodsp
network
nonfree
openssl
pic
- postproc
rdft
- rtpdec
runtime_cpudetect
safe_bitstream_reader
shared
- sinewin
small
sram
static
- swscale
swscale_alpha
thumb
vaapi
vda
vdpau
version3
+ xmm_clobber_test
x11grab
zlib
"
@@ -1002,6 +1088,7 @@ THREADS_LIST='
'
ARCH_LIST='
+ aarch64
alpha
arm
avr32
@@ -1019,31 +1106,50 @@ ARCH_LIST='
sh4
sparc
sparc64
+ tilegx
+ tilepro
tomi
x86
x86_32
x86_64
'
-ARCH_EXT_LIST='
- altivec
- amd3dnow
- amd3dnowext
+ARCH_EXT_LIST_ARM='
armv5te
armv6
armv6t2
- armvfp
+ neon
+ vfp
+ vfpv3
+'
+
+ARCH_EXT_LIST_X86='
+ amd3dnow
+ amd3dnowext
avx
- iwmmxt
- mmi
+ fma4
mmx
- mmx2
- neon
- ppc4xx
+ mmxext
sse
+ sse2
+ sse3
+ sse4
+ sse42
ssse3
- vfpv3
+'
+
+ARCH_EXT_LIST="
+ $ARCH_EXT_LIST_ARM
+ $ARCH_EXT_LIST_X86
+ altivec
+ ppc4xx
vis
+"
+
+HAVE_LIST_CMDLINE='
+ inline_asm
+ symver
+ yasm
'
HAVE_LIST_PUB='
@@ -1051,33 +1157,70 @@ HAVE_LIST_PUB='
fast_unaligned
'
+MATH_FUNCS="
+ atanf
+ atan2f
+ cbrtf
+ cosf
+ exp2
+ exp2f
+ expf
+ isinf
+ isnan
+ ldexpf
+ llrint
+ llrintf
+ log2
+ log2f
+ log10f
+ lrint
+ lrintf
+ powf
+ rint
+ round
+ roundf
+ sinf
+ trunc
+ truncf
+"
+
HAVE_LIST="
$ARCH_EXT_LIST
+ $(add_suffix _external $ARCH_EXT_LIST)
+ $(add_suffix _inline $ARCH_EXT_LIST)
+ $HAVE_LIST_CMDLINE
$HAVE_LIST_PUB
$THREADS_LIST
+ $MATH_FUNCS
+ aligned_malloc
aligned_stack
alsa_asoundlib_h
altivec_h
arpa_inet_h
+ asm_mod_q
asm_mod_y
attribute_may_alias
attribute_packed
+ cdio_paranoia_h
+ cdio_paranoia_paranoia_h
closesocket
cmov
+ CommandLineToArgvW
+ cpunop
+ CryptGenRandom
dcbzl
dev_bktr_ioctl_bt848_h
dev_bktr_ioctl_meteor_h
dev_ic_bt8xx_h
dev_video_bktr_ioctl_bt848_h
dev_video_meteor_ioctl_meteor_h
+ direct_h
dlfcn_h
dlopen
dos_paths
dxva_h
ebp_available
ebx_available
- exp2
- exp2f
fast_64bit
fast_clz
fast_cmov
@@ -1085,45 +1228,48 @@ HAVE_LIST="
fork
getaddrinfo
gethrtime
+ getopt
GetProcessAffinityMask
GetProcessMemoryInfo
GetProcessTimes
+ GetSystemTimeAsFileTime
getrusage
+ getservbyport
+ gettimeofday
gnu_as
ibm_asm
inet_aton
- inline_asm
+ io_h
isatty
+ jack_port_get_latency_range
ldbrx
libdc1394_1
libdc1394_2
- llrint
- llrintf
local_aligned_16
local_aligned_8
localtime_r
- log2
- log2f
loongson
- lrint
- lrintf
- lzo1x_999_compress
machine_ioctl_bt848_h
machine_ioctl_meteor_h
malloc_h
MapViewOfFile
memalign
mkstemp
+ mm_empty
mmap
+ mprotect
+ msvcrt
+ nanosleep
poll_h
posix_memalign
- round
- roundf
+ rdtsc
sched_getaffinity
sdl
sdl_video_size
+ SetConsoleTextAttribute
setmode
setrlimit
+ Sleep
sndio_h
socklen_t
soundcard_h
@@ -1131,13 +1277,15 @@ HAVE_LIST="
strptime
strtok_r
struct_addrinfo
+ struct_group_source_req
+ struct_ip_mreq_source
struct_ipv6_mreq
+ struct_pollfd
struct_rusage_ru_maxrss
struct_sockaddr_in6
struct_sockaddr_sa_len
struct_sockaddr_storage
struct_v4l2_frmivalenum_discrete
- symver
symver_asm_label
symver_gnu_asm
sysconf
@@ -1147,37 +1295,60 @@ HAVE_LIST="
sys_resource_h
sys_select_h
sys_soundcard_h
+ sys_time_h
sys_videoio_h
threads
- trunc
- truncf
+ unistd_h
+ usleep
vfp_args
VirtualAlloc
+ windows_h
winsock2_h
xform_asm
xmm_clobbers
- yasm
"
-# options emitted with CONFIG_ prefix but not available on command line
+# options emitted with CONFIG_ prefix but not available on the command line
CONFIG_EXTRA="
- avutil
+ aandcttables
+ ac3dsp
+ audio_frame_queue
+ error_resilience
+ gcrypt
+ golomb
gplv3
+ h264chroma
+ h264dsp
+ h264pred
+ h264qpel
+ huffman
lgplv3
+ lpc
+ mpegaudio
+ mpegaudiodsp
+ mpegvideo
+ mpegvideoenc
+ nettle
+ rangecoder
+ rtpdec
+ rtpenc_chain
+ sinewin
+ videodsp
+ vp3dsp
"
CMDLINE_SELECT="
$ARCH_EXT_LIST
$CONFIG_LIST
+ $HAVE_LIST_CMDLINE
$THREADS_LIST
asm
cross_compile
debug
extra_warnings
logging
+ lto
optimizations
- symver
- yasm
"
PATHS_LIST='
@@ -1203,6 +1374,7 @@ CMDLINE_SET="
extra_version
host_cc
host_cflags
+ host_ld
host_ldflags
host_libs
host_os
@@ -1212,12 +1384,14 @@ CMDLINE_SET="
nm
optflags
pkg_config
+ random_seed
samples
sysinclude
sysroot
target_exec
target_os
target_path
+ toolchain
"
CMDLINE_APPEND="
@@ -1231,12 +1405,11 @@ CMDLINE_APPEND="
armv5te_deps="arm"
armv6_deps="arm"
armv6t2_deps="arm"
-armvfp_deps="arm"
-iwmmxt_deps="arm"
neon_deps="arm"
-vfpv3_deps="armvfp"
+vfp_deps="arm"
+vfpv3_deps="vfp"
-mmi_deps="mips"
+map 'eval ${v}_inline_deps=inline_asm' $ARCH_EXT_LIST_ARM
altivec_deps="ppc"
ppc4xx_deps="ppc"
@@ -1244,33 +1417,55 @@ ppc4xx_deps="ppc"
vis_deps="sparc"
x86_64_suggest="cmov fast_cmov"
+
amd3dnow_deps="mmx"
amd3dnowext_deps="amd3dnow"
mmx_deps="x86"
-mmx2_deps="mmx"
-sse_deps="mmx"
-ssse3_deps="sse"
-avx_deps="ssse3"
+mmxext_deps="mmx"
+sse_deps="mmxext"
+sse2_deps="sse"
+sse3_deps="sse2"
+ssse3_deps="sse3"
+sse4_deps="ssse3"
+sse42_deps="sse4"
+avx_deps="sse42"
+fma4_deps="avx"
+
+mmx_external_deps="yasm"
+mmx_inline_deps="inline_asm"
+mmx_suggest="mmx_external mmx_inline"
+
+for ext in $(filter_out mmx $ARCH_EXT_LIST_X86); do
+ eval dep=\$${ext}_deps
+ eval ${ext}_external_deps='"${dep}_external"'
+ eval ${ext}_inline_deps='"${dep}_inline"'
+ eval ${ext}_suggest='"${ext}_external ${ext}_inline"'
+done
aligned_stack_if_any="ppc x86"
fast_64bit_if_any="alpha ia64 mips64 parisc64 ppc64 sparc64 x86_64"
-fast_clz_if_any="alpha armv5te avr32 mips ppc x86"
-fast_unaligned_if_any="armv6 ppc x86"
+fast_clz_if_any="alpha avr32 mips ppc x86"
+fast_unaligned_if_any="ppc x86"
inline_asm_deps="!tms470"
need_memalign="altivec neon sse"
symver_if_any="symver_asm_label symver_gnu_asm"
+log2_deps="!msvcrt"
+
# subsystems
dct_select="rdft"
mdct_select="fft"
rdft_select="fft"
+mpegaudio_select="mpegaudiodsp"
mpegaudiodsp_select="dct"
+mpegvideo_select="videodsp"
+mpegvideoenc_select="mpegvideo"
-# decoders / encoders / hardware accelerators
+# decoders / encoders
aac_decoder_select="mdct sinewin"
-aac_encoder_select="mdct sinewin"
+aac_encoder_select="audio_frame_queue mdct sinewin"
aac_latm_decoder_select="aac_decoder aac_latm_parser"
ac3_decoder_select="mdct ac3dsp ac3_parser"
ac3_encoder_select="mdct ac3dsp"
@@ -1282,18 +1477,22 @@ atrac1_decoder_select="mdct sinewin"
atrac3_decoder_select="mdct"
binkaudio_dct_decoder_select="mdct rdft dct sinewin"
binkaudio_rdft_decoder_select="mdct rdft sinewin"
-cavs_decoder_select="golomb"
+cavs_decoder_select="golomb mpegvideo"
+comfortnoise_encoder_select="lpc"
cook_decoder_select="mdct sinewin"
+cscd_decoder_select="lzo"
cscd_decoder_suggest="zlib"
dca_decoder_select="mdct"
-dnxhd_encoder_select="aandct"
+dnxhd_encoder_select="aandcttables mpegvideoenc"
dxa_decoder_select="zlib"
eac3_decoder_select="ac3_decoder"
-eac3_encoder_select="mdct ac3dsp"
-eamad_decoder_select="aandct"
-eatgq_decoder_select="aandct"
-eatqi_decoder_select="aandct"
-ffv1_decoder_select="golomb"
+eac3_encoder_select="ac3_encoder"
+eamad_decoder_select="aandcttables error_resilience mpegvideo"
+eatgq_decoder_select="aandcttables"
+eatqi_decoder_select="aandcttables error_resilience mpegvideo"
+ffv1_decoder_select="golomb rangecoder"
+ffv1_encoder_select="rangecoder"
+ffvhuff_encoder_select="huffman"
flac_decoder_select="golomb"
flac_encoder_select="golomb lpc"
flashsv_decoder_select="zlib"
@@ -1302,75 +1501,72 @@ flashsv2_decoder_select="zlib"
flv_decoder_select="h263_decoder"
flv_encoder_select="h263_encoder"
fraps_decoder_select="huffman"
-h261_encoder_select="aandct"
-h263_decoder_select="h263_parser"
-h263_encoder_select="aandct"
-h263_vaapi_hwaccel_select="vaapi h263_decoder"
+h261_decoder_select="error_resilience mpegvideo"
+h261_encoder_select="aandcttables mpegvideoenc"
+h263_decoder_select="error_resilience h263_parser mpegvideo"
+h263_encoder_select="aandcttables error_resilience mpegvideoenc"
h263i_decoder_select="h263_decoder"
h263p_encoder_select="h263_encoder"
-h264_decoder_select="golomb h264chroma h264dsp h264pred"
-h264_dxva2_hwaccel_deps="dxva2api_h"
-h264_dxva2_hwaccel_select="dxva2 h264_decoder"
-h264_vaapi_hwaccel_select="vaapi h264_decoder"
-h264_vda_hwaccel_select="vda h264_decoder"
-h264_vdpau_decoder_select="vdpau h264_decoder"
+h264_decoder_select="error_resilience golomb h264chroma h264dsp h264pred h264qpel mpegvideo"
+huffyuv_encoder_select="huffman"
+iac_decoder_select="fft mdct sinewin"
imc_decoder_select="fft mdct sinewin"
jpegls_decoder_select="golomb"
jpegls_encoder_select="golomb"
-ljpeg_encoder_select="aandct"
+ljpeg_encoder_select="aandcttables mpegvideoenc"
loco_decoder_select="golomb"
-mjpeg_encoder_select="aandct"
+mdec_decoder_select="error_resilience mpegvideo"
+mjpeg_encoder_select="aandcttables mpegvideoenc"
mlp_decoder_select="mlp_parser"
-mp1_decoder_select="mpegaudiodsp"
-mp1float_decoder_select="mpegaudiodsp"
-mp2_decoder_select="mpegaudiodsp"
-mp2float_decoder_select="mpegaudiodsp"
-mp3_decoder_select="mpegaudiodsp"
-mp3adu_decoder_select="mpegaudiodsp"
-mp3adufloat_decoder_select="mpegaudiodsp"
-mp3float_decoder_select="mpegaudiodsp"
-mp3on4_decoder_select="mpegaudiodsp"
-mp3on4float_decoder_select="mpegaudiodsp"
+mp1_decoder_select="mpegaudio"
+mp1float_decoder_select="mpegaudio"
+mp2_decoder_select="mpegaudio"
+mp2float_decoder_select="mpegaudio"
+mp3_decoder_select="mpegaudio"
+mp3adu_decoder_select="mpegaudio"
+mp3adufloat_decoder_select="mpegaudio"
+mp3float_decoder_select="mpegaudio"
+mp3on4_decoder_select="mpegaudio"
+mp3on4float_decoder_select="mpegaudio"
mpc7_decoder_select="mpegaudiodsp"
mpc8_decoder_select="mpegaudiodsp"
-mpeg_vdpau_decoder_select="vdpau mpegvideo_decoder"
mpeg_xvmc_decoder_deps="X11_extensions_XvMClib_h"
mpeg_xvmc_decoder_select="mpegvideo_decoder"
-mpeg1_vdpau_decoder_select="vdpau mpeg1video_decoder"
-mpeg1video_encoder_select="aandct"
-mpeg2_dxva2_hwaccel_deps="dxva2api_h"
-mpeg2_dxva2_hwaccel_select="dxva2 mpeg2video_decoder"
-mpeg2_vaapi_hwaccel_select="vaapi mpeg2video_decoder"
-mpeg2video_encoder_select="aandct"
+mpeg1video_decoder_select="error_resilience mpegvideo"
+mpeg1video_encoder_select="aandcttables error_resilience mpegvideoenc"
+mpeg2video_decoder_select="error_resilience mpegvideo"
+mpeg2video_encoder_select="aandcttables error_resilience mpegvideoenc"
mpeg4_decoder_select="h263_decoder mpeg4video_parser"
mpeg4_encoder_select="h263_encoder"
-mpeg4_vaapi_hwaccel_select="vaapi mpeg4_decoder"
-mpeg4_vdpau_decoder_select="vdpau mpeg4_decoder"
msmpeg4v1_decoder_select="h263_decoder"
msmpeg4v1_encoder_select="h263_encoder"
msmpeg4v2_decoder_select="h263_decoder"
msmpeg4v2_encoder_select="h263_encoder"
msmpeg4v3_decoder_select="h263_decoder"
msmpeg4v3_encoder_select="h263_encoder"
+mss2_decoder_select="vc1_decoder"
nellymoser_decoder_select="mdct sinewin"
-nellymoser_encoder_select="mdct sinewin"
+nellymoser_encoder_select="audio_frame_queue mdct sinewin"
+nuv_decoder_select="lzo"
png_decoder_select="zlib"
png_encoder_select="zlib"
qcelp_decoder_select="lsp"
qdm2_decoder_select="mdct rdft mpegaudiodsp"
-ra_144_encoder_select="lpc"
+ra_144_encoder_select="audio_frame_queue lpc"
+ralf_decoder_select="golomb"
rv10_decoder_select="h263_decoder"
rv10_encoder_select="h263_encoder"
rv20_decoder_select="h263_decoder"
rv20_encoder_select="h263_encoder"
-rv30_decoder_select="golomb h264chroma h264pred"
-rv40_decoder_select="golomb h264chroma h264pred"
+rv30_decoder_select="error_resilience golomb h264chroma h264pred h264qpel mpegvideo"
+rv40_decoder_select="error_resilience golomb h264chroma h264pred h264qpel mpegvideo"
shorten_decoder_select="golomb"
sipr_decoder_select="lsp"
-snow_decoder_select="dwt"
-snow_encoder_select="aandct dwt"
-svq1_encoder_select="aandct"
-svq3_decoder_select="golomb h264chroma h264dsp h264pred"
+snow_decoder_select="dwt rangecoder"
+snow_encoder_select="aandcttables dwt error_resilience mpegvideoenc rangecoder"
+svq1_decoder_select="error_resilience mpegvideo"
+svq1_encoder_select="aandcttables error_resilience mpegvideoenc"
+svq3_decoder_select="error_resilience golomb h264chroma h264dsp h264pred h264qpel mpegvideo"
svq3_decoder_suggest="zlib"
theora_decoder_select="vp3_decoder"
tiff_decoder_suggest="zlib"
@@ -1378,18 +1574,17 @@ tiff_encoder_suggest="zlib"
truehd_decoder_select="mlp_decoder"
tscc_decoder_select="zlib"
twinvq_decoder_select="mdct lsp sinewin"
-vc1_decoder_select="h263_decoder h264chroma"
-vc1_dxva2_hwaccel_deps="dxva2api_h DXVA_PictureParameters_wDecodedPictureIndex"
-vc1_dxva2_hwaccel_select="dxva2 vc1_decoder"
-vc1_vaapi_hwaccel_select="vaapi vc1_decoder"
-vc1_vdpau_decoder_select="vdpau vc1_decoder"
+utvideo_encoder_select="huffman"
+vc1_decoder_select="h263_decoder h264chroma h264qpel"
vc1image_decoder_select="vc1_decoder"
vorbis_decoder_select="mdct"
vorbis_encoder_select="mdct"
-vp6_decoder_select="huffman"
+vp3_decoder_select="vp3dsp videodsp"
+vp5_decoder_select="vp3dsp videodsp"
+vp6_decoder_select="huffman vp3dsp videodsp"
vp6a_decoder_select="vp6_decoder"
vp6f_decoder_select="vp6_decoder"
-vp8_decoder_select="h264pred"
+vp8_decoder_select="h264pred videodsp"
wmapro_decoder_select="mdct sinewin"
wmav1_decoder_select="mdct sinewin"
wmav1_encoder_select="mdct sinewin"
@@ -1401,43 +1596,79 @@ wmv1_encoder_select="h263_encoder"
wmv2_decoder_select="h263_decoder"
wmv2_encoder_select="h263_encoder"
wmv3_decoder_select="vc1_decoder"
-wmv3_dxva2_hwaccel_select="vc1_dxva2_hwaccel"
-wmv3_vaapi_hwaccel_select="vc1_vaapi_hwaccel"
-wmv3_vdpau_decoder_select="vc1_vdpau_decoder"
wmv3image_decoder_select="wmv3_decoder"
+zerocodec_decoder_select="zlib"
zlib_decoder_select="zlib"
zlib_encoder_select="zlib"
zmbv_decoder_select="zlib"
zmbv_encoder_select="zlib"
+# hardware accelerators
+dxva2_deps="dxva2api_h"
vaapi_deps="va_va_h"
vda_deps="VideoDecodeAcceleration_VDADecoder_h pthreads"
vdpau_deps="vdpau_vdpau_h vdpau_vdpau_x11_h"
+h263_vaapi_hwaccel_select="vaapi h263_decoder"
+h264_dxva2_hwaccel_deps="dxva2"
+h264_dxva2_hwaccel_select="h264_decoder"
+h264_vaapi_hwaccel_select="vaapi h264_decoder"
+h264_vda_hwaccel_select="vda h264_decoder"
+h264_vdpau_decoder_select="vdpau h264_decoder"
+mpeg_vdpau_decoder_select="vdpau mpegvideo_decoder"
+mpeg1_vdpau_decoder_select="vdpau mpeg1video_decoder"
+mpeg2_dxva2_hwaccel_deps="dxva2"
+mpeg2_dxva2_hwaccel_select="mpeg2video_decoder"
+mpeg2_vaapi_hwaccel_select="vaapi mpeg2video_decoder"
+mpeg4_vaapi_hwaccel_select="vaapi mpeg4_decoder"
+mpeg4_vdpau_decoder_select="vdpau mpeg4_decoder"
+vc1_dxva2_hwaccel_deps="dxva2"
+vc1_dxva2_hwaccel_select="vc1_decoder"
+vc1_vaapi_hwaccel_select="vaapi vc1_decoder"
+vc1_vdpau_decoder_select="vdpau vc1_decoder"
+wmv3_dxva2_hwaccel_select="vc1_dxva2_hwaccel"
+wmv3_vaapi_hwaccel_select="vc1_vaapi_hwaccel"
+wmv3_vdpau_decoder_select="vc1_vdpau_decoder"
+
# parsers
-h264_parser_select="golomb h264chroma h264dsp h264pred"
+h264_parser_select="error_resilience golomb h264dsp h264pred mpegvideo"
+mpeg4video_parser_select="error_resilience mpegvideo"
+mpegvideo_parser_select="error_resilience mpegvideo"
+vc1_parser_select="error_resilience mpegvideo"
# external libraries
-libdirac_decoder_deps="libdirac !libschroedinger"
-libdirac_encoder_deps="libdirac"
libfaac_encoder_deps="libfaac"
+libfaac_encoder_select="audio_frame_queue"
+libfdk_aac_encoder_deps="libfdk_aac"
+libfdk_aac_encoder_select="audio_frame_queue"
libgsm_decoder_deps="libgsm"
libgsm_encoder_deps="libgsm"
libgsm_ms_decoder_deps="libgsm"
libgsm_ms_encoder_deps="libgsm"
+libilbc_decoder_deps="libilbc"
+libilbc_encoder_deps="libilbc"
libmp3lame_encoder_deps="libmp3lame"
+libmp3lame_encoder_select="audio_frame_queue"
libopencore_amrnb_decoder_deps="libopencore_amrnb"
libopencore_amrnb_encoder_deps="libopencore_amrnb"
+libopencore_amrnb_encoder_select="audio_frame_queue"
libopencore_amrwb_decoder_deps="libopencore_amrwb"
libopenjpeg_decoder_deps="libopenjpeg"
+libopenjpeg_encoder_deps="libopenjpeg"
+libopus_decoder_deps="libopus"
+libopus_encoder_deps="libopus"
+libopus_encoder_select="audio_frame_queue"
libschroedinger_decoder_deps="libschroedinger"
libschroedinger_encoder_deps="libschroedinger"
libspeex_decoder_deps="libspeex"
libspeex_encoder_deps="libspeex"
+libspeex_encoder_select="audio_frame_queue"
libtheora_encoder_deps="libtheora"
libvo_aacenc_encoder_deps="libvo_aacenc"
+libvo_aacenc_encoder_select="audio_frame_queue"
libvo_amrwbenc_encoder_deps="libvo_amrwbenc"
libvorbis_encoder_deps="libvorbis"
+libvorbis_encoder_select="audio_frame_queue"
libvpx_decoder_deps="libvpx"
libvpx_encoder_deps="libvpx"
libx264_encoder_deps="libx264"
@@ -1452,25 +1683,29 @@ dirac_demuxer_select="dirac_parser"
eac3_demuxer_select="ac3_parser"
flac_demuxer_select="flac_parser"
ipod_muxer_select="mov_muxer"
-libnut_demuxer_deps="libnut"
-libnut_muxer_deps="libnut"
+ismv_muxer_select="mov_muxer"
matroska_audio_muxer_select="matroska_muxer"
-matroska_demuxer_suggest="zlib bzlib"
+matroska_demuxer_suggest="bzlib lzo zlib"
mov_demuxer_suggest="zlib"
+mov_muxer_select="rtpenc_chain"
mp3_demuxer_select="mpegaudio_parser"
mp4_muxer_select="mov_muxer"
+mpegts_muxer_select="adts_muxer latm_muxer mpegvideo"
mpegtsraw_demuxer_select="mpegts_demuxer"
mxf_d10_muxer_select="mxf_muxer"
ogg_demuxer_select="golomb"
psp_muxer_select="mov_muxer"
rtp_demuxer_select="sdp_demuxer"
+rtp_muxer_select="mpegvideo"
rtpdec_select="asf_demuxer rm_demuxer rtp_protocol mpegts_demuxer mov_demuxer"
rtsp_demuxer_select="http_protocol rtpdec"
-rtsp_muxer_select="rtp_muxer http_protocol rtp_protocol"
+rtsp_muxer_select="rtp_muxer http_protocol rtp_protocol rtpenc_chain"
sap_demuxer_select="sdp_demuxer"
-sap_muxer_select="rtp_muxer rtp_protocol"
+sap_muxer_select="rtp_muxer rtp_protocol rtpenc_chain"
sdp_demuxer_select="rtpdec"
+smoothstreaming_muxer_select="ismv_muxer"
spdif_muxer_select="aac_parser"
+tak_demuxer_select="tak_parser"
tg2_muxer_select="mov_muxer"
tgp_muxer_select="mov_muxer"
w64_demuxer_deps="wav_demuxer"
@@ -1489,28 +1724,43 @@ oss_outdev_deps_any="soundcard_h sys_soundcard_h"
pulse_indev_deps="libpulse"
sndio_indev_deps="sndio_h"
sndio_outdev_deps="sndio_h"
-v4l_indev_deps="linux_videodev_h"
v4l2_indev_deps_any="linux_videodev2_h sys_videoio_h"
vfwcap_indev_deps="capCreateCaptureWindow vfwcap_defines"
vfwcap_indev_extralibs="-lavicap32"
-x11_grab_device_indev_deps="x11grab XShmCreateImage"
-x11_grab_device_indev_extralibs="-lX11 -lXext -lXfixes"
+x11grab_indev_deps="x11grab XShmCreateImage"
# protocols
-gopher_protocol_deps="network"
-httpproxy_protocol_deps="network"
+ffrtmpcrypt_protocol_deps="!librtmp_protocol"
+ffrtmpcrypt_protocol_deps_any="gcrypt nettle openssl"
+ffrtmpcrypt_protocol_select="tcp_protocol"
+ffrtmphttp_protocol_deps="!librtmp_protocol"
+ffrtmphttp_protocol_select="http_protocol"
+gopher_protocol_select="network"
httpproxy_protocol_select="tcp_protocol"
-http_protocol_deps="network"
http_protocol_select="tcp_protocol"
https_protocol_select="tls_protocol"
+librtmp_protocol_deps="librtmp"
+librtmpe_protocol_deps="librtmp"
+librtmps_protocol_deps="librtmp"
+librtmpt_protocol_deps="librtmp"
+librtmpte_protocol_deps="librtmp"
mmsh_protocol_select="http_protocol"
-mmst_protocol_deps="network"
+mmst_protocol_select="network"
+rtmp_protocol_deps="!librtmp_protocol"
rtmp_protocol_select="tcp_protocol"
+rtmpe_protocol_select="ffrtmpcrypt_protocol"
+rtmps_protocol_deps="!librtmp_protocol"
+rtmps_protocol_select="tls_protocol"
+rtmpt_protocol_select="ffrtmphttp_protocol"
+rtmpte_protocol_select="ffrtmpcrypt_protocol ffrtmphttp_protocol"
+rtmpts_protocol_select="ffrtmphttp_protocol https_protocol"
rtp_protocol_select="udp_protocol"
-tcp_protocol_deps="network"
+sctp_protocol_deps="struct_sctp_event_subscribe"
+sctp_protocol_select="network"
+tcp_protocol_select="network"
tls_protocol_deps_any="openssl gnutls"
tls_protocol_select="tcp_protocol"
-udp_protocol_deps="network"
+udp_protocol_select="network"
# filters
blackframe_filter_deps="gpl"
@@ -1519,124 +1769,36 @@ cropdetect_filter_deps="gpl"
delogo_filter_deps="gpl"
drawtext_filter_deps="libfreetype"
frei0r_filter_deps="frei0r dlopen strtok_r"
+frei0r_filter_extralibs='$ldl'
frei0r_src_filter_deps="frei0r dlopen strtok_r"
+frei0r_src_filter_extralibs='$ldl'
hqdn3d_filter_deps="gpl"
+resample_filter_deps="avresample"
ocv_filter_deps="libopencv"
scale_filter_deps="swscale"
yadif_filter_deps="gpl"
# libraries
-avdevice_deps="avcodec avformat"
-avformat_deps="avcodec"
-postproc_deps="gpl"
+avcodec_deps="avutil"
+avdevice_deps="avutil avcodec avformat"
+avfilter_deps="avutil"
+avformat_deps="avutil avcodec"
+avresample_deps="avutil"
+swscale_deps="avutil"
# programs
-avconv_deps="avcodec avformat swscale"
-avplay_deps="avcodec avformat swscale sdl"
+avconv_deps="avcodec avfilter avformat avresample swscale"
+avconv_select="aformat_filter anull_filter asyncts_filter format_filter
+ fps_filter null_filter resample_filter scale_filter
+ setpts_filter"
+avplay_deps="avcodec avformat avresample swscale sdl"
avplay_select="rdft"
avprobe_deps="avcodec avformat"
-avserver_deps="avformat ffm_muxer fork rtp_protocol rtsp_demuxer"
+avserver_deps="avformat ffm_muxer fork rtp_protocol rtsp_demuxer !shared"
avserver_extralibs='$ldl'
-ffmpeg_deps="avcodec avformat swscale"
doc_deps="texi2html"
-# tests
-
-test_deps(){
- suf1=$1
- suf2=$2
- shift 2
- for v; do
- dep=${v%=*}
- tests=${v#*=}
- for name in ${tests}; do
- append ${name}_test_deps ${dep}$suf1 ${dep}$suf2
- done
- done
-}
-
-mxf_d10_test_deps="avfilter"
-seek_lavf_mxf_d10_test_deps="mxf_d10_test"
-
-test_deps _encoder _decoder \
- adpcm_ima_qt \
- adpcm_ima_wav \
- adpcm_ms \
- adpcm_swf \
- adpcm_yamaha=adpcm_yam \
- alac \
- asv1 \
- asv2 \
- bmp \
- dnxhd="dnxhd_1080i dnxhd_720p dnxhd_720p_rd" \
- dvvideo="dv dv_411 dv50" \
- ffv1 \
- flac \
- flashsv \
- flv \
- adpcm_g726=g726 \
- gif \
- h261 \
- h263="h263 h263p" \
- huffyuv \
- jpegls \
- mjpeg="jpg mjpeg ljpeg" \
- mp2 \
- mpeg1video="mpeg mpeg1b" \
- mpeg2video="mpeg2 mpeg2_422 mpeg2_idct_int mpeg2_ilace mpeg2_ivlc_qprd" \
- mpeg2video="mpeg2thread mpeg2thread_ilace" \
- mpeg4="mpeg4 mpeg4_adap mpeg4_qpel mpeg4_qprd mpeg4adv mpeg4nr" \
- mpeg4="mpeg4thread error rc" \
- msmpeg4v3=msmpeg4 \
- msmpeg4v2 \
- pbm=pbmpipe \
- pcx \
- pgm="pgm pgmpipe" \
- png \
- ppm="ppm ppmpipe" \
- rawvideo="rgb yuv" \
- roq \
- rv10 \
- rv20 \
- sgi \
- snow="snow snowll" \
- svq1 \
- targa=tga \
- tiff \
- wmav1 \
- wmav2 \
- wmv1 \
- wmv2 \
-
-test_deps _muxer _demuxer \
- aiff \
- pcm_alaw=alaw \
- asf \
- au \
- avi \
- dv=dv_fmt \
- ffm \
- flv=flv_fmt \
- gxf \
- matroska=mkv \
- mmf \
- mov \
- pcm_mulaw=mulaw \
- mxf="mxf mxf_d10" \
- nut \
- ogg \
- rawvideo=pixfmt \
- rm \
- swf \
- mpegts=ts \
- voc \
- wav \
- yuv4mpegpipe=yuv4mpeg \
-
-ac3_fixed_test_deps="ac3_fixed_encoder ac3_decoder rm_muxer rm_demuxer"
-mpg_test_deps="mpeg1system_muxer mpegps_demuxer"
-
# default parameters
logfile="config.log"
@@ -1653,16 +1815,15 @@ shlibdir_default="$libdir_default"
# toolchain
ar_default="ar"
cc_default="gcc"
-cc_version=\"unknown\"
host_cc_default="gcc"
+cp_f="cp -f"
ln_s="ln -sf"
-nm_default="nm"
+nm_default="nm -g"
objformat="elf"
pkg_config_default=pkg-config
ranlib="ranlib"
yasmexe="yasm"
-nm_opts='-g'
nogas=":"
# machine
@@ -1674,25 +1835,19 @@ target_os_default=$(tolower $(uname -s))
host_os=$target_os_default
# configurable options
-enable $PROGRAM_LIST
-
-enable avcodec
-enable avdevice
-enable avfilter
-enable avformat
-enable avutil
-enable swscale
+enable $LIBRARY_LIST $PROGRAM_LIST
enable asm
enable debug
enable doc
-enable fastdiv
-enable network
enable optimizations
enable safe_bitstream_reader
enable static
enable swscale_alpha
+# By default, enable only those hwaccels that have no external dependencies.
+enable dxva2 vdpau
+
# build settings
SHFLAGS='-shared -Wl,-soname,$$(@F)'
AVSERVERLDFLAGS=-Wl,-E
@@ -1709,18 +1864,33 @@ LIB_INSTALL_EXTRA_CMD='$$(RANLIB) "$(LIBDIR)/$(LIBNAME)"'
SLIB_INSTALL_NAME='$(SLIBNAME_WITH_VERSION)'
SLIB_INSTALL_LINKS='$(SLIBNAME_WITH_MAJOR) $(SLIBNAME)'
+asflags_filter=echo
+cflags_filter=echo
+ldflags_filter=echo
+
+AS_C='-c'
AS_O='-o $@'
+CC_C='-c'
+CC_E='-E -o $@'
CC_O='-o $@'
-
-host_cflags='-D_ISOC99_SOURCE -O3 -g'
+LD_O='-o $@'
+LD_LIB='-l%'
+LD_PATH='-L'
+HOSTCC_C='-c'
+HOSTCC_O='-o $@'
+HOSTLD_O='-o $@'
+
+host_cflags='-D_ISOC99_SOURCE -D_XOPEN_SOURCE=600 -O3 -g'
host_libs='-lm'
+host_cflags_filter=echo
+host_ldflags_filter=echo
target_path='$(CURDIR)'
# since the object filename is not given with the -MM flag, the compiler
# is only able to print the basename, and we must add the path ourselves
-DEPEND_CMD='$(DEPCC) $(DEPFLAGS) $< | sed -e "/^\#.*/d" -e "s,^[[:space:]]*$(*F)\\.o,$(@D)/$(*F).o," > $(@:.o=.d)'
-DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -MM'
+DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< | sed -e "/^\#.*/d" -e "s,^[[:space:]]*$(*F)\\.o,$(@D)/$(*F).o," > $(@:.o=.d)'
+DEPFLAGS='-MM'
# find source path
if test -f configure; then
@@ -1773,27 +1943,15 @@ ALL_COMPONENTS="
$PROTOCOL_LIST
"
-find_tests(){
- map "echo ${2}\${v}_test" $(ls "$source_path"/tests/ref/$1 | grep -v '[^-a-z0-9_]')
-}
-
-ACODEC_TESTS=$(find_tests acodec)
-VCODEC_TESTS=$(find_tests vsynth1)
-LAVF_TESTS=$(find_tests lavf)
-LAVFI_TESTS=$(find_tests lavfi)
-SEEK_TESTS=$(find_tests seek seek_)
-
-ALL_TESTS="$ACODEC_TESTS $VCODEC_TESTS $LAVF_TESTS $LAVFI_TESTS $SEEK_TESTS"
-
-pcm_test_deps=$(map 'echo ${v%_*}_decoder $v' $(filter pcm_* $ENCODER_LIST))
-
for n in $COMPONENT_LIST; do
v=$(toupper ${n%s})_LIST
eval enable \$$v
eval ${n}_if_any="\$$v"
done
-enable $ARCH_EXT_LIST $ALL_TESTS
+disable snow_decoder snow_encoder
+
+enable $ARCH_EXT_LIST
die_unknown(){
echo "Unknown option \"$1\"."
@@ -1808,58 +1966,98 @@ show_list() {
exit 0
}
+rand_list(){
+ IFS=', '
+ set -- $*
+ unset IFS
+ for thing; do
+ comp=${thing%:*}
+ prob=${thing#$comp}
+ prob=${prob#:}
+ is_in ${comp} $COMPONENT_LIST && eval comp=\$$(toupper ${comp%s})_LIST
+ echo "prob ${prob:-0.5}"
+ printf '%s\n' $comp
+ done
+}
+
+do_random(){
+ action=$1
+ shift
+ random_seed=$(awk "BEGIN { srand($random_seed); print srand() }")
+ $action $(rand_list "$@" | awk "BEGIN { srand($random_seed) } \$1 == \"prob\" { prob = \$2; next } rand() < prob { print }")
+}
+
for opt do
optval="${opt#*=}"
case "$opt" in
- --extra-ldflags=*) add_ldflags $optval
- ;;
- --extra-libs=*) add_extralibs $optval
- ;;
- --disable-devices) disable $INDEV_LIST $OUTDEV_LIST
- ;;
- --enable-debug=*) debuglevel="$optval"
- ;;
- --disable-everything)
- map 'eval unset \${$(toupper ${v%s})_LIST}' $COMPONENT_LIST
- ;;
- --enable-*=*|--disable-*=*)
- eval $(echo "${opt%%=*}" | sed 's/--/action=/;s/-/ thing=/')
- is_in "${thing}s" $COMPONENT_LIST || die_unknown "$opt"
- eval list=\$$(toupper $thing)_LIST
- name=$(echo "${optval}" | sed "s/,/_${thing}|/g")_${thing}
- $action $(filter "$name" $list)
- ;;
- --enable-?*|--disable-?*)
- eval $(echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g')
- if is_in $option $COMPONENT_LIST; then
- test $action = disable && action=unset
- eval $action \$$(toupper ${option%s})_LIST
- elif is_in $option $CMDLINE_SELECT; then
- $action $option
- else
- die_unknown $opt
- fi
- ;;
- --list-*)
- NAME="${opt#--list-}"
- is_in $NAME $COMPONENT_LIST || die_unknown $opt
- NAME=${NAME%s}
- eval show_list $NAME \$$(toupper $NAME)_LIST
- ;;
- --help|-h) show_help
- ;;
- *)
- optname="${opt%%=*}"
- optname="${optname#--}"
- optname=$(echo "$optname" | sed 's/-/_/g')
- if is_in $optname $CMDLINE_SET; then
- eval $optname='$optval'
- elif is_in $optname $CMDLINE_APPEND; then
- append $optname "$optval"
- else
- die_unknown $opt
- fi
- ;;
+ --extra-ldflags=*)
+ add_ldflags $optval
+ ;;
+ --extra-libs=*)
+ add_extralibs $optval
+ ;;
+ --disable-devices)
+ disable $INDEV_LIST $OUTDEV_LIST
+ ;;
+ --enable-debug=*)
+ debuglevel="$optval"
+ ;;
+ --disable-programs)
+ disable $PROGRAM_LIST
+ ;;
+ --disable-everything)
+ map 'eval unset \${$(toupper ${v%s})_LIST}' $COMPONENT_LIST
+ ;;
+ --disable-all)
+ map 'eval unset \${$(toupper ${v%s})_LIST}' $COMPONENT_LIST
+ disable $LIBRARY_LIST $PROGRAM_LIST doc
+ ;;
+ --enable-random|--disable-random)
+ action=${opt%%-random}
+ do_random ${action#--} $COMPONENT_LIST
+ ;;
+ --enable-random=*|--disable-random=*)
+ action=${opt%%-random=*}
+ do_random ${action#--} $optval
+ ;;
+ --enable-*=*|--disable-*=*)
+ eval $(echo "${opt%%=*}" | sed 's/--/action=/;s/-/ thing=/')
+ is_in "${thing}s" $COMPONENT_LIST || die_unknown "$opt"
+ eval list=\$$(toupper $thing)_LIST
+ name=$(echo "${optval}" | sed "s/,/_${thing}|/g")_${thing}
+ $action $(filter "$name" $list)
+ ;;
+ --enable-?*|--disable-?*)
+ eval $(echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g')
+ if is_in $option $COMPONENT_LIST; then
+ test $action = disable && action=unset
+ eval $action \$$(toupper ${option%s})_LIST
+ elif is_in $option $CMDLINE_SELECT; then
+ $action $option
+ else
+ die_unknown $opt
+ fi
+ ;;
+ --list-*)
+ NAME="${opt#--list-}"
+ is_in $NAME $COMPONENT_LIST || die_unknown $opt
+ NAME=${NAME%s}
+ eval show_list $NAME \$$(toupper $NAME)_LIST
+ ;;
+ --help|-h) show_help
+ ;;
+ *)
+ optname="${opt%%=*}"
+ optname="${optname#--}"
+ optname=$(echo "$optname" | sed 's/-/_/g')
+ if is_in $optname $CMDLINE_SET; then
+ eval $optname='$optval'
+ elif is_in $optname $CMDLINE_APPEND; then
+ append $optname "$optval"
+ else
+ die_unknown $opt
+ fi
+ ;;
esac
done
@@ -1875,8 +2073,6 @@ if enabled cross_compile; then
die "Must specify target arch and OS when cross-compiling"
fi
-set_default arch target_os
-
ar_default="${cross_prefix}${ar_default}"
cc_default="${cross_prefix}${cc_default}"
nm_default="${cross_prefix}${nm_default}"
@@ -1885,7 +2081,30 @@ ranlib="${cross_prefix}${ranlib}"
sysinclude_default="${sysroot}/usr/include"
-set_default cc nm pkg_config sysinclude
+case "$toolchain" in
+ clang-asan)
+ cc_default="clang"
+ add_cflags -faddress-sanitizer
+ add_ldflags -faddress-sanitizer
+ ;;
+ clang-tsan)
+ cc_default="clang"
+ add_cflags -fthread-sanitizer
+ add_ldflags -fthread-sanitizer
+ ;;
+ msvc)
+ cc_default="c99wrap cl"
+ ld_default="c99wrap link"
+ nm_default="dumpbin -symbols"
+ ar_default="lib"
+ target_os_default="win32"
+ ;;
+ ?*)
+ die "Unknown toolchain $toolchain"
+ ;;
+esac
+
+set_default arch cc pkg_config sysinclude target_os
enabled cross_compile || host_cc_default=$cc
set_default host_cc
@@ -1896,7 +2115,7 @@ fi
exesuf() {
case $1 in
- mingw32*|cygwin*|*-dos|freedos|opendos|os/2*|symbian) echo .exe ;;
+ mingw32*|win32|win64|cygwin*|*-dos|freedos|opendos|os/2*|symbian) echo .exe ;;
esac
}
@@ -1952,188 +2171,289 @@ EOF
die "Sanity test failed."
fi
-filter_asflags=echo
-filter_cflags=echo
-filter_cppflags=echo
-
-if $cc -v 2>&1 | grep -q '^gcc.*LLVM'; then
- cc_type=llvm_gcc
- cc_version=__VERSION__
- gcc_extra_ver=$(expr "$($cc --version | head -n1)" : '.*\((.*)\)')
- cc_ident="llvm-gcc $($cc -dumpversion) $gcc_extra_ver"
- CC_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
- AS_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
- speed_cflags='-O3'
- size_cflags='-Os'
-elif $cc -v 2>&1 | grep -qi ^gcc; then
- cc_type=gcc
- cc_version=__VERSION__
- gcc_version=$($cc --version | head -n1)
- gcc_basever=$($cc -dumpversion)
- gcc_pkg_ver=$(expr "$gcc_version" : '[^ ]* \(([^)]*)\)')
- gcc_ext_ver=$(expr "$gcc_version" : ".*$gcc_pkg_ver $gcc_basever \\(.*\\)")
- cc_ident=$(cleanws "gcc $gcc_basever $gcc_pkg_ver $gcc_ext_ver")
- if ! $cc -dumpversion | grep -q '^2\.'; then
- CC_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
- AS_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
+ccc_flags(){
+ for flag; do
+ case $flag in
+ -std=c99) echo -c99 ;;
+ -mcpu=*) echo -arch ${flag#*=} ;;
+ -mieee) echo -ieee ;;
+ -O*|-fast) echo $flag ;;
+ -fno-math-errno) echo -assume nomath_errno ;;
+ -g) echo -g3 ;;
+ -Wall) echo -msg_enable level2 ;;
+ -Wno-pointer-sign) echo -msg_disable ptrmismatch1 ;;
+ -Wl,*) echo $flag ;;
+ -f*|-W*) ;;
+ *) echo $flag ;;
+ esac
+ done
+}
+
+msvc_flags(){
+ for flag; do
+ case $flag in
+ -fomit-frame-pointer) echo -Oy ;;
+ -g) echo -Z7 ;;
+ -Wall) echo -W4 -wd4244 -wd4127 -wd4018 -wd4389 \
+ -wd4146 -wd4057 -wd4204 -wd4706 -wd4305 \
+ -wd4152 -wd4324 -we4013 -wd4100 -wd4214 \
+ -wd4996 -wd4273 ;;
+ -std=c99) ;;
+ -fno-math-errno) ;;
+ -fno-common) ;;
+ -fno-signed-zeros) ;;
+ -fPIC) ;;
+ -lz) echo zlib.lib ;;
+ -lavifil32) echo vfw32.lib ;;
+ -lavicap32) echo vfw32.lib user32.lib ;;
+ -l*) echo ${flag#-l}.lib ;;
+ *) echo $flag ;;
+ esac
+ done
+}
+
+pgi_flags(){
+ for flag; do
+ case $flag in
+ -flto) echo -Mipa=fast,libopt,libinline,vestigial ;;
+ -fomit-frame-pointer) echo -Mnoframe ;;
+ -g) echo -gopt ;;
+ *) echo $flag ;;
+ esac
+ done
+}
+
+suncc_flags(){
+ for flag; do
+ case $flag in
+ -march=*|-mcpu=*)
+ case "${flag#*=}" in
+ native) echo -xtarget=native ;;
+ v9|niagara) echo -xarch=sparc ;;
+ ultrasparc) echo -xarch=sparcvis ;;
+ ultrasparc3|niagara2) echo -xarch=sparcvis2 ;;
+ i586|pentium) echo -xchip=pentium ;;
+ i686|pentiumpro|pentium2) echo -xtarget=pentium_pro ;;
+ pentium3*|c3-2) echo -xtarget=pentium3 ;;
+ pentium-m) echo -xarch=sse2 -xchip=pentium3 ;;
+ pentium4*) echo -xtarget=pentium4 ;;
+ prescott|nocona) echo -xarch=sse3 -xchip=pentium4 ;;
+ *-sse3) echo -xarch=sse3 ;;
+ core2) echo -xarch=ssse3 -xchip=core2 ;;
+ corei7) echo -xarch=sse4_2 -xchip=nehalem ;;
+ corei7-avx) echo -xarch=avx -xchip=sandybridge ;;
+ amdfam10|barcelona|bdver*) echo -xarch=sse4_1 ;;
+ athlon-4|athlon-[mx]p) echo -xarch=ssea ;;
+ k8|opteron|athlon64|athlon-fx)
+ echo -xarch=sse2a ;;
+ athlon*) echo -xarch=pentium_proa ;;
+ esac
+ ;;
+ -std=c99) echo -xc99 ;;
+ -fomit-frame-pointer) echo -xregs=frameptr ;;
+ -fPIC) echo -KPIC -xcode=pic32 ;;
+ -W*,*) echo $flag ;;
+ -f*-*|-W*) ;;
+ *) echo $flag ;;
+ esac
+ done
+}
+
+tms470_flags(){
+ for flag; do
+ case $flag in
+ -march=*|-mcpu=*)
+ case "${flag#*=}" in
+ armv7-a|cortex-a*) echo -mv=7a8 ;;
+ armv7-r|cortex-r*) echo -mv=7r4 ;;
+ armv7-m|cortex-m*) echo -mv=7m3 ;;
+ armv6*|arm11*) echo -mv=6 ;;
+ armv5*e|arm[79]*e*|arm9[24]6*|arm96*|arm102[26])
+ echo -mv=5e ;;
+ armv4*|arm7*|arm9[24]*) echo -mv=4 ;;
+ esac
+ ;;
+ -mfpu=neon) echo --float_support=vfpv3 --neon ;;
+ -mfpu=vfp) echo --float_support=vfpv2 ;;
+ -mfpu=vfpv3) echo --float_support=vfpv3 ;;
+ -mfpu=vfpv3-d16) echo --float_support=vfpv3d16 ;;
+ -msoft-float) echo --float_support=vfplib ;;
+ -O[0-3]|-mf=*) echo $flag ;;
+ -g) echo -g -mn ;;
+ -pds=*) echo $flag ;;
+ -D*|-I*) echo $flag ;;
+ --gcc|--abi=*) echo $flag ;;
+ -me) echo $flag ;;
+ esac
+ done
+}
+
+probe_cc(){
+ pfx=$1
+ _cc=$2
+
+ unset _type _ident _cc_c _cc_e _cc_o _flags _cflags
+ unset _ld_o _ldflags _ld_lib _ld_path
+ unset _depflags _DEPCMD _DEPFLAGS
+ _flags_filter=echo
+
+ if $_cc -v 2>&1 | grep -q '^gcc.*LLVM'; then
+ _type=llvm_gcc
+ gcc_extra_ver=$(expr "$($_cc --version | head -n1)" : '.*\((.*)\)')
+ _ident="llvm-gcc $($_cc -dumpversion) $gcc_extra_ver"
+ _depflags='-MMD -MF $(@:.o=.d) -MT $@'
+ _cflags_speed='-O3'
+ _cflags_size='-Os'
+ elif $_cc -v 2>&1 | grep -qi ^gcc; then
+ _type=gcc
+ gcc_version=$($_cc --version | head -n1)
+ gcc_basever=$($_cc -dumpversion)
+ gcc_pkg_ver=$(expr "$gcc_version" : '[^ ]* \(([^)]*)\)')
+ gcc_ext_ver=$(expr "$gcc_version" : ".*$gcc_pkg_ver $gcc_basever \\(.*\\)")
+ _ident=$(cleanws "gcc $gcc_basever $gcc_pkg_ver $gcc_ext_ver")
+ if ! $_cc -dumpversion | grep -q '^2\.'; then
+ _depflags='-MMD -MF $(@:.o=.d) -MT $@'
+ fi
+ _cflags_speed='-O3'
+ _cflags_size='-Os'
+ elif $_cc --version 2>/dev/null | grep -q Intel; then
+ _type=icc
+ _ident=$($_cc --version | head -n1)
+ _depflags='-MMD'
+ _cflags_speed='-O3'
+ _cflags_size='-Os'
+ _cflags_noopt='-O1'
+ elif $_cc -v 2>&1 | grep -q xlc; then
+ _type=xlc
+ _ident=$($_cc -qversion 2>/dev/null | head -n1)
+ _cflags_speed='-O5'
+ _cflags_size='-O5 -qcompact'
+ elif $_cc -V 2>/dev/null | grep -q Compaq; then
+ _type=ccc
+ _ident=$($_cc -V | head -n1 | cut -d' ' -f1-3)
+ _DEPFLAGS='-M'
+ _cflags_speed='-fast'
+ _cflags_size='-O1'
+ _flags_filter=ccc_flags
+ elif $_cc --vsn 2>/dev/null | grep -q "ARM C/C++ Compiler"; then
+ test -d "$sysroot" || die "No valid sysroot specified."
+ _type=armcc
+ _ident=$($_cc --vsn | head -n1)
+ armcc_conf="$PWD/armcc.conf"
+ $_cc --arm_linux_configure \
+ --arm_linux_config_file="$armcc_conf" \
+ --configure_sysroot="$sysroot" \
+ --configure_cpp_headers="$sysinclude" >>$logfile 2>&1 ||
+ die "Error creating armcc configuration file."
+ $_cc --vsn | grep -q RVCT && armcc_opt=rvct || armcc_opt=armcc
+ _flags="--arm_linux_config_file=$armcc_conf --translate_gcc"
+ as_default="${cross_prefix}gcc"
+ _depflags='-MMD'
+ _cflags_speed='-O3'
+ _cflags_size='-Os'
+ elif $_cc -version 2>/dev/null | grep -Eq 'TMS470|TI ARM'; then
+ _type=tms470
+ _ident=$($_cc -version | head -n1 | tr -s ' ')
+ _flags='--gcc --abi=eabi -me'
+ _cc_e='-ppl -fe=$@'
+ _cc_o='-fe=$@'
+ _depflags='-ppa -ppd=$(@:.o=.d)'
+ _cflags_speed='-O3 -mf=5'
+ _cflags_size='-O3 -mf=2'
+ _flags_filter=tms470_flags
+ elif $_cc -v 2>&1 | grep -q clang; then
+ _type=clang
+ _ident=$($_cc --version | head -n1)
+ _depflags='-MMD'
+ _cflags_speed='-O3'
+ _cflags_size='-Os'
+ elif $_cc -V 2>&1 | grep -q Sun; then
+ _type=suncc
+ _ident=$($_cc -V 2>&1 | head -n1 | cut -d' ' -f 2-)
+ _DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< | sed -e "1s,^.*: ,$@: ," -e "\$$!s,\$$, \\\," -e "1!s,^.*: , ," > $(@:.o=.d)'
+ _DEPFLAGS='-xM1 -xc99'
+ _ldflags='-std=c99'
+ _cflags_speed='-O5'
+ _cflags_size='-O5 -xspace'
+ _flags_filter=suncc_flags
+ elif $_cc -v 2>&1 | grep -q 'PathScale\|Path64'; then
+ _type=pathscale
+ _ident=$($_cc -v 2>&1 | head -n1 | tr -d :)
+ _depflags='-MMD -MF $(@:.o=.d) -MT $@'
+ _cflags_speed='-O2'
+ _cflags_size='-Os'
+ _flags_filter='filter_out -Wdisabled-optimization'
+ elif $_cc -v 2>&1 | grep -q Open64; then
+ _type=open64
+ _ident=$($_cc -v 2>&1 | head -n1 | tr -d :)
+ _depflags='-MMD -MF $(@:.o=.d) -MT $@'
+ _cflags_speed='-O2'
+ _cflags_size='-Os'
+ _flags_filter='filter_out -Wdisabled-optimization|-Wtype-limits|-fno-signed-zeros'
+ elif $_cc -V 2>&1 | grep -q Portland; then
+ _type=pgi
+ _ident="PGI $($_cc -V 2>&1 | awk '/^pgcc/ { print $2; exit }')"
+ opt_common='-alias=ansi -Mdse -Mlre -Mpre'
+ _cflags_speed="-O3 -Mautoinline -Munroll=c:4 $opt_common"
+ _cflags_size="-O2 -Munroll=c:1 $opt_common"
+ _cflags_noopt="-O1"
+ _flags_filter=pgi_flags
+ elif $_cc 2>&1 | grep -q Microsoft; then
+ _type=msvc
+ _ident=$($cc 2>&1 | head -n1)
+ _DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< 2>&1 | awk '\''/including/ { sub(/^.*file: */, ""); gsub(/\\/, "/"); if (!match($$0, / /)) print "$@:", $$0 }'\'' > $(@:.o=.d)'
+ _DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -showIncludes -Zs'
+ _cflags_speed="-O2"
+ _cflags_size="-O1"
+ # Nonstandard output options, to avoid msys path conversion issues, relies on wrapper to remap it
+ if $_cc 2>&1 | grep -q Linker; then
+ _ld_o='-out $@'
+ else
+ _ld_o='-Fe$@'
+ fi
+ _cc_o='-Fo $@'
+ _cc_e='-P -Fi $@'
+ _flags_filter=msvc_flags
+ _ld_lib='lib%.a'
+ _ld_path='-libpath:'
+ _flags='-nologo'
+ _cflags='-D_USE_MATH_DEFINES -Dinline=__inline -FIstdlib.h -Dstrtoll=_strtoi64'
+ if [ $pfx = hostcc ]; then
+ append _cflags -Dsnprintf=_snprintf
+ fi
fi
- speed_cflags='-O3'
- size_cflags='-Os'
-elif $cc --version 2>/dev/null | grep -q Intel; then
- cc_type=icc
- cc_version="AV_STRINGIFY(__INTEL_COMPILER)"
- cc_ident=$($cc --version | head -n1)
- icc_version=$($cc -dumpversion)
- CC_DEPFLAGS='-MMD'
- AS_DEPFLAGS='-MMD'
- speed_cflags='-O3'
- size_cflags='-Os'
- noopt_cflags='-O1'
-elif $cc -v 2>&1 | grep -q xlc; then
- cc_type=xlc
- cc_version="AV_STRINGIFY(__IBMC__)"
- cc_ident=$($cc -qversion 2>/dev/null | head -n1)
- speed_cflags='-O5'
- size_cflags='-O5 -qcompact'
-elif $cc -V 2>/dev/null | grep -q Compaq; then
- cc_type=ccc
- cc_version="AV_STRINGIFY(__DECC_VER)"
- cc_ident=$($cc -V | head -n1 | cut -d' ' -f1-3)
- DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -M'
- debuglevel=3
- add_ldflags -Wl,-z,now # calls to libots crash without this
- speed_cflags='-fast'
- size_cflags='-O1'
-elif $cc --vsn 2>/dev/null | grep -q "ARM C/C++ Compiler"; then
- test -d "$sysroot" || die "No valid sysroot specified."
- cc_type=armcc
- cc_version="AV_STRINGIFY(__ARMCC_VERSION)"
- cc_ident=$($cc --vsn | head -n1)
- armcc_conf="$PWD/armcc.conf"
- $cc --arm_linux_configure \
- --arm_linux_config_file="$armcc_conf" \
- --configure_sysroot="$sysroot" \
- --configure_cpp_headers="$sysinclude" >>$logfile 2>&1 ||
- die "Error creating armcc configuration file."
- $cc --vsn | grep -q RVCT && armcc_opt=rvct || armcc_opt=armcc
- cc="$cc --arm_linux_config_file=$armcc_conf --translate_gcc"
- as_default="${cross_prefix}gcc"
- CC_DEPFLAGS='-MMD'
- AS_DEPFLAGS='-MMD'
- speed_cflags='-O3'
- size_cflags='-Os'
- filter_asflags="filter_out -W${armcc_opt}*"
-elif $cc -version 2>/dev/null | grep -q TMS470; then
- cc_type=tms470
- cc_version="AV_STRINGIFY(__TI_COMPILER_VERSION__)"
- cc_ident=$($cc -version | head -n1 | tr -s ' ')
- cc="$cc --gcc --abi=eabi -eo=.o -mc -me"
- CC_O='-fr=$(@D)'
- as_default="${cross_prefix}gcc"
- ld_default="${cross_prefix}gcc"
- TMPO=$(basename $TMPC .c).o
- append TMPFILES $TMPO
- add_cflags -D__gnuc_va_list=va_list -D__USER_LABEL_PREFIX__=
- CC_DEPFLAGS='-ppa -ppd=$(@:.o=.d)'
- AS_DEPFLAGS='-MMD'
- speed_cflags='-O3 -mf=5'
- size_cflags='-O3 -mf=2'
- filter_cflags=tms470_flags
- tms470_flags(){
- for flag; do
- case $flag in
- -march=*|-mcpu=*)
- case "${flag#*=}" in
- armv7-a|cortex-a*) echo -mv=7a8 ;;
- armv7-r|cortex-r*) echo -mv=7r4 ;;
- armv7-m|cortex-m*) echo -mv=7m3 ;;
- armv6*|arm11*) echo -mv=6 ;;
- armv5*e|arm[79]*e*|arm9[24]6*|arm96*|arm102[26])
- echo -mv=5e ;;
- armv4*|arm7*|arm9[24]*) echo -mv=4 ;;
- esac
- ;;
- -mfpu=neon) echo --float_support=vfpv3 --neon ;;
- -mfpu=vfp) echo --float_support=vfpv2 ;;
- -mfpu=vfpv3) echo --float_support=vfpv3 ;;
- -msoft-float) echo --float_support=vfplib ;;
- -O[0-3]|-mf=*) echo $flag ;;
- -g) echo -g -mn ;;
- -pds=*) echo $flag ;;
- esac
- done
- }
-elif $cc -v 2>&1 | grep -q clang; then
- cc_type=clang
- $cc -dM -E $TMPC | grep -q __clang_version__ &&
- cc_version=__clang_version__ || cc_version=__VERSION__
- cc_ident=$($cc --version | head -n1)
- CC_DEPFLAGS='-MMD'
- AS_DEPFLAGS='-MMD'
- speed_cflags='-O3'
- size_cflags='-Os'
-elif $cc -V 2>&1 | grep -q Sun; then
- cc_type=suncc
- cc_version="AV_STRINGIFY(__SUNPRO_C)"
- cc_ident=$($cc -V 2>&1 | head -n1 | cut -d' ' -f 2-)
- DEPEND_CMD='$(DEPCC) $(DEPFLAGS) $< | sed -e "1s,^.*: ,$@: ," -e "\$$!s,\$$, \\\," -e "1!s,^.*: , ," > $(@:.o=.d)'
- DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -xM1'
- add_ldflags -xc99
- speed_cflags='-O5'
- size_cflags='-O5 -xspace'
- filter_cflags=suncc_flags
- suncc_flags(){
- for flag; do
- case $flag in
- -march=*|-mcpu=*)
- case "${flag#*=}" in
- native) echo -xtarget=native ;;
- v9|niagara) echo -xarch=sparc ;;
- ultrasparc) echo -xarch=sparcvis ;;
- ultrasparc3|niagara2) echo -xarch=sparcvis2 ;;
- i586|pentium) echo -xchip=pentium ;;
- i686|pentiumpro|pentium2) echo -xtarget=pentium_pro ;;
- pentium3*|c3-2) echo -xtarget=pentium3 ;;
- pentium-m) echo -xarch=sse2 -xchip=pentium3 ;;
- pentium4*) echo -xtarget=pentium4 ;;
- prescott|nocona) echo -xarch=sse3 -xchip=pentium4 ;;
- *-sse3) echo -xarch=sse3 ;;
- core2) echo -xarch=ssse3 -xchip=core2 ;;
- amdfam10|barcelona) echo -xarch=sse4_1 ;;
- athlon-4|athlon-[mx]p) echo -xarch=ssea ;;
- k8|opteron|athlon64|athlon-fx)
- echo -xarch=sse2a ;;
- athlon*) echo -xarch=pentium_proa ;;
- esac
- ;;
- -std=c99) echo -xc99 ;;
- -fomit-frame-pointer) echo -xregs=frameptr ;;
- -fPIC) echo -KPIC -xcode=pic32 ;;
- -W*,*) echo $flag ;;
- -f*-*|-W*) ;;
- *) echo $flag ;;
- esac
- done
- }
-elif $cc -v 2>&1 | grep -q 'PathScale\|Path64'; then
- cc_type=pathscale
- cc_version=__PATHSCALE__
- cc_ident=$($cc -v 2>&1 | head -n1 | tr -d :)
- CC_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
- AS_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
- speed_cflags='-O2'
- size_cflags='-Os'
- filter_cflags='filter_out -Wdisabled-optimization'
-elif $cc -v 2>&1 | grep -q Open64; then
- cc_type=open64
- cc_version=__OPEN64__
- cc_ident=$($cc -v 2>&1 | head -n1 | tr -d :)
- CC_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
- AS_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
- speed_cflags='-O2'
- size_cflags='-Os'
- filter_cflags='filter_out -Wdisabled-optimization|-Wtype-limits|-fno-signed-zeros'
-fi
+
+ eval ${pfx}_type=\$_type
+ eval ${pfx}_ident=\$_ident
+}
+
+set_ccvars(){
+ eval ${1}_C=\${_cc_c-\${${1}_C}}
+ eval ${1}_E=\${_cc_e-\${${1}_E}}
+ eval ${1}_O=\${_cc_o-\${${1}_O}}
+
+ if [ -n "$_depflags" ]; then
+ eval ${1}_DEPFLAGS=\$_depflags
+ else
+ eval ${1}DEP=\${_DEPCMD:-\$DEPCMD}
+ eval ${1}DEP_FLAGS=\${_DEPFLAGS:-\$DEPFLAGS}
+ eval DEP${1}FLAGS=\$_flags
+ fi
+}
+
+probe_cc cc "$cc"
+cflags_filter=$_flags_filter
+cflags_speed=$_cflags_speed
+cflags_size=$_cflags_size
+cflags_noopt=$_cflags_noopt
+add_cflags $_flags $_cflags
+cc_ldflags=$_ldflags
+set_ccvars CC
+
+probe_cc hostcc "$host_cc"
+host_cflags_filter=$_flags_filter
+add_host_cflags $_flags $_cflags
+set_ccvars HOSTCC
test -n "$cc_type" && enable $cc_type ||
warn "Unknown C compiler $cc, unable to select optimal CFLAGS"
@@ -2141,10 +2461,44 @@ test -n "$cc_type" && enable $cc_type ||
: ${as_default:=$cc}
: ${dep_cc_default:=$cc}
: ${ld_default:=$cc}
-set_default ar as dep_cc ld
+: ${host_ld_default:=$host_cc}
+set_default ar as dep_cc ld host_ld
+
+probe_cc as "$as"
+asflags_filter=$_flags_filter
+add_asflags $_flags $_cflags
+set_ccvars AS
+
+probe_cc ld "$ld"
+ldflags_filter=$_flags_filter
+add_ldflags $_flags $_ldflags
+test "$cc_type" != "$ld_type" && add_ldflags $cc_ldflags
+LD_O=${_ld_o-$LD_O}
+LD_LIB=${_ld_lib-$LD_LIB}
+LD_PATH=${_ld_path-$LD_PATH}
+
+probe_cc hostld "$host_ld"
+host_ldflags_filter=$_flags_filter
+add_host_ldflags $_flags $_ldflags
+HOSTLD_O=${_ld_o-$HOSTLD_O}
+
+if [ -z "$CC_DEPFLAGS" ] && [ "$dep_cc" != "$cc" ]; then
+ probe_cc depcc "$dep_cc"
+ CCDEP=${_DEPCMD:-$DEPCMD}
+ CCDEP_FLAGS=${_DEPFLAGS:=$DEPFLAGS}
+ DEPCCFLAGS=$_flags
+fi
-test -n "$CC_DEPFLAGS" || CCDEP=$DEPEND_CMD
-test -n "$AS_DEPFLAGS" || ASDEP=$DEPEND_CMD
+if $ar 2>&1 | grep -q Microsoft; then
+ arflags="-nologo"
+ ar_o='-out:$@'
+elif $ar 2>&1 | grep -q 'Texas Instruments'; then
+ arflags="rq"
+ ar_o='$@'
+else
+ arflags="rc"
+ ar_o='$@'
+fi
add_cflags $extra_cflags
add_asflags $extra_cflags
@@ -2184,39 +2538,32 @@ fi
# Deal with common $arch aliases
case "$arch" in
+ aarch64|arm64)
+ arch="aarch64"
+ ;;
arm*)
arch="arm"
;;
- mips|mipsel|IP*)
+ mips*|IP*)
arch="mips"
;;
- mips64*)
- arch="mips"
- subarch="mips64"
- ;;
- parisc|hppa)
- arch="parisc"
- ;;
- parisc64|hppa64)
+ parisc*|hppa*)
arch="parisc"
- subarch="parisc64"
;;
- "Power Macintosh"|ppc|powerpc)
+ "Power Macintosh"|ppc*|powerpc*)
arch="ppc"
;;
- ppc64|powerpc64)
- arch="ppc"
- subarch="ppc64"
- ;;
s390|s390x)
arch="s390"
;;
sh4|sh)
arch="sh4"
;;
- sun4u|sparc64)
+ sun4u|sparc*)
arch="sparc"
- subarch="sparc64"
+ ;;
+ tilegx|tile-gx)
+ arch="tilegx"
;;
i[3-6]86|i86pc|BePC|x86pc|x86_64|amd64)
arch="x86"
@@ -2227,8 +2574,107 @@ is_in $arch $ARCH_LIST || warn "unknown architecture $arch"
enable $arch
# Add processor-specific flags
-if test "$cpu" = generic; then
- : do nothing
+if enabled aarch64; then
+
+ case $cpu in
+ armv*)
+ cpuflags="-march=$cpu"
+ ;;
+ *)
+ cpuflags="-mcpu=$cpu"
+ ;;
+ esac
+
+elif enabled alpha; then
+
+ cpuflags="-mcpu=$cpu"
+
+elif enabled arm; then
+
+ check_arm_arch() {
+ check_cpp_condition stddef.h \
+ "defined __ARM_ARCH_${1}__ || defined __TARGET_ARCH_${2:-$1}" \
+ $cpuflags
+ }
+
+ probe_arm_arch() {
+ if check_arm_arch 4; then echo armv4;
+ elif check_arm_arch 4T; then echo armv4t;
+ elif check_arm_arch 5; then echo armv5;
+ elif check_arm_arch 5E; then echo armv5e;
+ elif check_arm_arch 5T; then echo armv5t;
+ elif check_arm_arch 5TE; then echo armv5te;
+ elif check_arm_arch 5TEJ; then echo armv5te;
+ elif check_arm_arch 6; then echo armv6;
+ elif check_arm_arch 6J; then echo armv6j;
+ elif check_arm_arch 6K; then echo armv6k;
+ elif check_arm_arch 6Z; then echo armv6z;
+ elif check_arm_arch 6ZK; then echo armv6zk;
+ elif check_arm_arch 6T2; then echo armv6t2;
+ elif check_arm_arch 7; then echo armv7;
+ elif check_arm_arch 7A 7_A; then echo armv7-a;
+ elif check_arm_arch 7R 7_R; then echo armv7-r;
+ elif check_arm_arch 7M 7_M; then echo armv7-m;
+ elif check_arm_arch 7EM 7E_M; then echo armv7-m;
+ elif check_arm_arch 8A 8_A; then echo armv8-a;
+ fi
+ }
+
+ [ "$cpu" = generic ] && cpu=$(probe_arm_arch)
+
+ case $cpu in
+ armv*)
+ cpuflags="-march=$cpu"
+ subarch=$(echo $cpu | sed 's/[^a-z0-9]//g')
+ ;;
+ *)
+ cpuflags="-mcpu=$cpu"
+ case $cpu in
+ cortex-a*) subarch=armv7a ;;
+ cortex-r*) subarch=armv7r ;;
+ cortex-m*) enable thumb; subarch=armv7m ;;
+ arm11*) subarch=armv6 ;;
+ arm[79]*e*|arm9[24]6*|arm96*|arm102[26]) subarch=armv5te ;;
+ armv4*|arm7*|arm9[24]*) subarch=armv4 ;;
+ *) subarch=$(probe_arm_arch) ;;
+ esac
+ ;;
+ esac
+
+ case "$subarch" in
+ armv5t*) enable fast_clz ;;
+ armv[6-8]*) enable fast_clz fast_unaligned ;;
+ esac
+
+elif enabled avr32; then
+
+ case $cpu in
+ ap7[02]0[0-2])
+ subarch="avr32_ap"
+ cpuflags="-mpart=$cpu"
+ ;;
+ ap)
+ subarch="avr32_ap"
+ cpuflags="-march=$cpu"
+ ;;
+ uc3[ab]*)
+ subarch="avr32_uc"
+ cpuflags="-mcpu=$cpu"
+ ;;
+ uc)
+ subarch="avr32_uc"
+ cpuflags="-march=$cpu"
+ ;;
+ esac
+
+elif enabled bfin; then
+
+ cpuflags="-mcpu=$cpu"
+
+elif enabled mips; then
+
+ cpuflags="-march=$cpu"
+
elif enabled ppc; then
case $(tolower $cpu) in
@@ -2245,22 +2691,29 @@ elif enabled ppc; then
disable altivec
;;
g3|75*|ppc75*|powerpc75*)
- cpuflags="-mcpu=750 -mpowerpc-gfxopt"
+ cpuflags="-mcpu=750"
disable altivec
;;
g4|745*|ppc745*|powerpc745*)
- cpuflags="-mcpu=7450 -mpowerpc-gfxopt"
+ cpuflags="-mcpu=7450"
;;
74*|ppc74*|powerpc74*)
- cpuflags="-mcpu=7400 -mpowerpc-gfxopt"
+ cpuflags="-mcpu=7400"
+ ;;
+ g5|970|ppc970|powerpc970)
+ cpuflags="-mcpu=970"
;;
- g5|970|ppc970|powerpc970|power4*)
- cpuflags="-mcpu=970 -mpowerpc-gfxopt -mpowerpc64"
+ power[3-7]*)
+ cpuflags="-mcpu=$cpu"
;;
cell)
cpuflags="-mcpu=cell"
enable ldbrx
;;
+ e500mc)
+ cpuflags="-mcpu=e500mc"
+ disable altivec
+ ;;
e500v2)
cpuflags="-mcpu=8548 -mhard-float -mfloat-gprs=double"
disable altivec
@@ -2271,6 +2724,18 @@ elif enabled ppc; then
;;
esac
+elif enabled sparc; then
+
+ case $cpu in
+ cypress|f93[04]|tsc701|sparcl*|supersparc|hypersparc|niagara|v[789])
+ cpuflags="-mcpu=$cpu"
+ disable vis
+ ;;
+ ultrasparc*|niagara[234])
+ cpuflags="-mcpu=$cpu"
+ ;;
+ esac
+
elif enabled x86; then
case $cpu in
@@ -2284,7 +2749,7 @@ elif enabled x86; then
disable cmov
;;
# targets that do support conditional mov (cmov)
- i686|pentiumpro|pentium[23]|pentium-m|athlon|athlon-tbird|athlon-4|athlon-[mx]p|athlon64*|k8*|opteron*|athlon-fx|core2|amdfam10|barcelona|atom)
+ i686|pentiumpro|pentium[23]|pentium-m|athlon|athlon-tbird|athlon-4|athlon-[mx]p|athlon64*|k8*|opteron*|athlon-fx|core2|corei7*|amdfam10|barcelona|atom|bdver*)
cpuflags="-march=$cpu"
enable cmov
enable fast_cmov
@@ -2297,75 +2762,12 @@ elif enabled x86; then
;;
esac
-elif enabled sparc; then
-
- case $cpu in
- niagara)
- cpuflags="-mcpu=$cpu"
- disable vis
- ;;
- sparc64)
- cpuflags="-mcpu=v9"
- ;;
- esac
-
-elif enabled arm; then
-
- case $cpu in
- armv*)
- cpuflags="-march=$cpu"
- subarch=$(echo $cpu | sed 's/[^a-z0-9]//g')
- ;;
- *)
- cpuflags="-mcpu=$cpu"
- case $cpu in
- cortex-a*) subarch=armv7a ;;
- cortex-r*) subarch=armv7r ;;
- cortex-m*) enable thumb; subarch=armv7m ;;
- arm11*) subarch=armv6 ;;
- arm[79]*e*|arm9[24]6*|arm96*|arm102[26]) subarch=armv5te ;;
- armv4*|arm7*|arm9[24]*) subarch=armv4 ;;
- esac
- ;;
- esac
-
-elif enabled alpha; then
-
- enabled ccc && cpuflags="-arch $cpu" || cpuflags="-mcpu=$cpu"
-
-elif enabled bfin; then
-
- cpuflags="-mcpu=$cpu"
-
-elif enabled mips; then
-
- cpuflags="-march=$cpu"
-
-elif enabled avr32; then
-
- case $cpu in
- ap7[02]0[0-2])
- subarch="avr32_ap"
- cpuflags="-mpart=$cpu"
- ;;
- ap)
- subarch="avr32_ap"
- cpuflags="-march=$cpu"
- ;;
- uc3[ab]*)
- subarch="avr32_uc"
- cpuflags="-mcpu=$cpu"
- ;;
- uc)
- subarch="avr32_uc"
- cpuflags="-march=$cpu"
- ;;
- esac
-
fi
-add_cflags $cpuflags
-add_asflags $cpuflags
+if [ "$cpu" != generic ]; then
+ add_cflags $cpuflags
+ add_asflags $cpuflags
+fi
# compiler sanity check
check_exec <<EOF
@@ -2392,15 +2794,36 @@ EOF
check_host_cflags -std=c99
check_host_cflags -Wall
+check_64bit(){
+ arch32=$1
+ arch64=$2
+ expr=$3
+ check_code cc "" "int test[2*($expr) - 1]" &&
+ subarch=$arch64 || subarch=$arch32
+}
+
case "$arch" in
- alpha|ia64|mips|parisc|ppc|sparc)
+ aarch64|alpha|ia64)
+ spic=$shared
+ ;;
+ mips)
+ check_64bit mips mips64 '_MIPS_SIM > 1'
+ spic=$shared
+ ;;
+ parisc)
+ check_64bit parisc parisc64 'sizeof(void *) > 4'
+ spic=$shared
+ ;;
+ ppc)
+ check_64bit ppc ppc64 'sizeof(void *) > 4'
+ spic=$shared
+ ;;
+ sparc)
+ check_64bit sparc sparc64 'sizeof(void *) > 4'
spic=$shared
;;
x86)
- subarch="x86_32"
- check_cc <<EOF && subarch="x86_64"
- int test[(int)sizeof(char*) - 7];
-EOF
+ check_64bit x86_32 x86_64 'sizeof(void *) > 4'
if test "$subarch" = "x86_64"; then
spic=$shared
fi
@@ -2422,22 +2845,21 @@ case $target_os in
SHFLAGS='-shared -Wl,-h,$$(@F)'
enabled x86 && SHFLAGS="-mimpure-text $SHFLAGS"
network_extralibs="-lsocket -lnsl"
- add_cppflags -D__EXTENSIONS__
+ add_cppflags -D__EXTENSIONS__ -D_XOPEN_SOURCE=600
# When using suncc to build, the Solaris linker will mark
# an executable with each instruction set encountered by
# the Solaris assembler. As our libraries contain their own
# guards for processor-specific code, instead suppress
# generation of the HWCAPS ELF section on Solaris x86 only.
enabled_all suncc x86 && echo "hwcap_1 = OVERRIDE;" > mapfile && add_ldflags -Wl,-M,mapfile
- nm_opts='-P -g'
+ nm_default='nm -P -g'
;;
netbsd)
disable symver
oss_indev_extralibs="-lossaudio"
oss_outdev_extralibs="-lossaudio"
;;
- openbsd)
- enable malloc_aligned
+ openbsd|bitrig)
# On OpenBSD 4.5. the compiler does not use PIC unless
# explicitly using -fPIC. Libav builds fine without PIC,
# however the generated executable will not do anything
@@ -2446,24 +2868,23 @@ case $target_os in
enable pic
disable symver
SHFLAGS='-shared'
+ SLIBNAME_WITH_MAJOR='$(SLIBNAME).$(LIBVERSION)'
+ SLIB_INSTALL_LINKS=
oss_indev_extralibs="-lossaudio"
oss_outdev_extralibs="-lossaudio"
;;
dragonfly)
- enable malloc_aligned
disable symver
;;
freebsd)
- enable malloc_aligned
;;
bsd/os)
add_extralibs -lpoll -lgnugetopt
;;
darwin)
- enable malloc_aligned
gas="gas-preprocessor.pl $cc"
enabled ppc && add_asflags -force_cpusubtype_ALL
- SHFLAGS='-dynamiclib -Wl,-single_module -Wl,-install_name,$(SHLIBDIR)/$(SLIBNAME),-current_version,$(LIBVERSION),-compatibility_version,$(LIBMAJOR)'
+ SHFLAGS='-dynamiclib -Wl,-single_module -Wl,-install_name,$(SHLIBDIR)/$(SLIBNAME_WITH_MAJOR),-current_version,$(LIBVERSION),-compatibility_version,$(LIBMAJOR)'
enabled x86_32 && append SHFLAGS -Wl,-read_only_relocs,suppress
add_ldflags -Wl,-dynamic,-search_paths_first
SLIBSUF=".dylib"
@@ -2483,7 +2904,6 @@ case $target_os in
fi
LIBTARGET=i386
if enabled x86_64; then
- enable malloc_aligned
LIBTARGET="i386:x86-64"
elif enabled arm; then
LIBTARGET=arm-wince
@@ -2493,21 +2913,42 @@ case $target_os in
SLIBSUF=".dll"
SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
- SLIB_EXTRA_CMD=-'$(DLLTOOL) -m $(LIBTARGET) -d $$(@:$(SLIBSUF)=.def) -l $(SUBDIR)$(SLIBNAME:$(SLIBSUF)=.lib) -D $(SLIBNAME_WITH_MAJOR)'
+ SLIB_EXTRA_CMD=-'sed -e "s/ @[^ ]*//" $$(@:$(SLIBSUF)=.orig.def) > $$(@:$(SLIBSUF)=.def); $(DLLTOOL) -m $(LIBTARGET) -d $$(@:$(SLIBSUF)=.def) -l $(SUBDIR)$(SLIBNAME:$(SLIBSUF)=.lib) -D $(SLIBNAME_WITH_MAJOR)'
SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
SLIB_INSTALL_LINKS=
SLIB_INSTALL_EXTRA_SHLIB='$(SLIBNAME:$(SLIBSUF)=.lib)'
SLIB_INSTALL_EXTRA_LIB='lib$(SLIBNAME:$(SLIBSUF)=.dll.a) $(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.def)'
- SHFLAGS='-shared -Wl,--output-def,$$(@:$(SLIBSUF)=.def) -Wl,--out-implib,$(SUBDIR)lib$(SLIBNAME:$(SLIBSUF)=.dll.a) -Wl,--enable-runtime-pseudo-reloc -Wl,--enable-auto-image-base'
+ SHFLAGS='-shared -Wl,--output-def,$$(@:$(SLIBSUF)=.orig.def) -Wl,--out-implib,$(SUBDIR)lib$(SLIBNAME:$(SLIBSUF)=.dll.a) -Wl,--enable-runtime-pseudo-reloc -Wl,--enable-auto-image-base'
objformat="win32"
dlltool="${cross_prefix}dlltool"
+ ranlib=:
enable dos_paths
- check_cflags -fno-common
- check_cpp_condition _mingw.h "defined (__MINGW64_VERSION_MAJOR) || (__MINGW32_MAJOR_VERSION > 3) \
- || (__MINGW32_MAJOR_VERSION == 3 && __MINGW32_MINOR_VERSION >= 15)" ||
- die "ERROR: MinGW runtime version must be >= 3.15."
add_cppflags -U__STRICT_ANSI__
;;
+ win32|win64)
+ if enabled shared; then
+ # Link to the import library instead of the normal static library
+ # for shared libs.
+ LD_LIB='%.lib'
+ # Cannot build shared and static libraries at the same time with
+ # MSVC.
+ disable static
+ fi
+ shlibdir_default="$bindir_default"
+ SLIBPREF=""
+ SLIBSUF=".dll"
+ SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
+ SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
+ SLIB_CREATE_DEF_CMD='makedef $(SUBDIR)lib$(NAME).ver $(OBJS) > $$(@:$(SLIBSUF)=.def)'
+ SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
+ SLIB_INSTALL_LINKS=
+ SLIB_INSTALL_EXTRA_SHLIB='$(SLIBNAME:$(SLIBSUF)=.lib)'
+ SLIB_INSTALL_EXTRA_LIB='$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.def)'
+ SHFLAGS='-dll -def:$$(@:$(SLIBSUF)=.def) -implib:$(SUBDIR)$(SLIBNAME:$(SLIBSUF)=.lib)'
+ objformat="win32"
+ ranlib=:
+ enable dos_paths
+ ;;
cygwin*)
target_os=cygwin
shlibdir_default="$bindir_default"
@@ -2515,11 +2956,12 @@ case $target_os in
SLIBSUF=".dll"
SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
- SHFLAGS='-shared -Wl,--enable-auto-image-base'
+ SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
+ SLIB_INSTALL_LINKS=
+ SLIB_INSTALL_EXTRA_LIB='lib$(FULLNAME).dll.a'
+ SHFLAGS='-shared -Wl,--out-implib,$(SUBDIR)lib$(FULLNAME).dll.a'
objformat="win32"
enable dos_paths
- check_cflags -fno-common
- add_cppflags -U__STRICT_ANSI__
;;
*-dos|freedos|opendos)
network_extralibs="-lsocket"
@@ -2528,7 +2970,6 @@ case $target_os in
add_cppflags -U__STRICT_ANSI__
;;
linux)
- add_cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
enable dv1394
;;
irix*)
@@ -2548,21 +2989,20 @@ case $target_os in
SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME)-$(LIBVERSION)$(SLIBSUF)'
SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(shell echo $(NAME) | cut -c1-6)$(LIBMAJOR)$(SLIBSUF)'
SLIB_CREATE_DEF_CMD='echo LIBRARY $(SLIBNAME_WITH_MAJOR) INITINSTANCE TERMINSTANCE > $(SUBDIR)$(NAME).def; \
- echo PROTMODE >> $(SUBDIR)$(NAME).def; \
- echo CODE PRELOAD MOVEABLE DISCARDABLE >> $(SUBDIR)$(NAME).def; \
- echo DATA PRELOAD MOVEABLE MULTIPLE NONSHARED >> $(SUBDIR)$(NAME).def; \
- echo EXPORTS >> $(SUBDIR)$(NAME).def; \
- emxexp -o $(OBJS) >> $(SUBDIR)$(NAME).def'
+ echo PROTMODE >> $(SUBDIR)$(NAME).def; \
+ echo CODE PRELOAD MOVEABLE DISCARDABLE >> $(SUBDIR)$(NAME).def; \
+ echo DATA PRELOAD MOVEABLE MULTIPLE NONSHARED >> $(SUBDIR)$(NAME).def; \
+ echo EXPORTS >> $(SUBDIR)$(NAME).def; \
+ emxexp -o $(OBJS) >> $(SUBDIR)$(NAME).def'
SLIB_EXTRA_CMD='emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.a $(SUBDIR)$(NAME).def; \
- emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.lib $(SUBDIR)$(NAME).def;'
+ emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.lib $(SUBDIR)$(NAME).def;'
SLIB_INSTALL_EXTRA_LIB='$(LIBPREF)$(NAME)_dll.a $(LIBPREF)$(NAME)_dll.lib'
enable dos_paths
;;
gnu/kfreebsd)
- add_cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_BSD_SOURCE
+ add_cppflags -D_BSD_SOURCE
;;
gnu)
- add_cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
;;
qnx)
add_cppflags -D_QNX_SOURCE
@@ -2580,6 +3020,25 @@ case $target_os in
-l:drtaeabi.dso -l:scppnwdl.dso -lsupc++ -lgcc \
-l:libc.dso -l:libm.dso -l:euser.dso -l:libcrt0.lib
;;
+ osf1)
+ add_cppflags -D_OSF_SOURCE -D_POSIX_PII -D_REENTRANT
+ AVSERVERLDFLAGS=
+ ;;
+ minix)
+ ;;
+ plan9)
+ add_cppflags -D_C99_SNPRINTF_EXTENSION \
+ -D_REENTRANT_SOURCE \
+ -D_RESEARCH_SOURCE \
+ -DFD_SETSIZE=96 \
+ -DHAVE_SOCK_OPTS
+ add_compat strtod.o strtod=avpriv_strtod
+ network_extralibs='-lbsd'
+ exeobjs=compat/plan9/main.o
+ disable avserver
+ ln_s='ln -s -f'
+ cp_f='cp'
+ ;;
none)
;;
*)
@@ -2587,11 +3046,59 @@ case $target_os in
;;
esac
-echo "config:$arch:$subarch:$cpu:$target_os:$cc_ident:$LIBAV_CONFIGURATION" >config.fate
+# determine libc flavour
+
+if check_cpp_condition features.h "defined __UCLIBC__"; then
+ libc_type=uclibc
+ add_cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
+elif check_cpp_condition features.h "defined __GLIBC__"; then
+ libc_type=glibc
+ add_cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
+elif check_header _mingw.h; then
+ libc_type=mingw
+ check_cpp_condition _mingw.h \
+ "defined (__MINGW64_VERSION_MAJOR) || (__MINGW32_MAJOR_VERSION > 3) || \
+ (__MINGW32_MAJOR_VERSION == 3 && __MINGW32_MINOR_VERSION >= 15)" ||
+ die "ERROR: MinGW runtime version must be >= 3.15."
+elif check_cpp_condition newlib.h "defined _NEWLIB_VERSION"; then
+ libc_type=newlib
+ add_cppflags -U__STRICT_ANSI__
+elif check_func_headers stdlib.h _get_doserrno; then
+ libc_type=msvcrt
+ add_compat strtod.o strtod=avpriv_strtod
+ add_compat msvcrt/snprintf.o snprintf=avpriv_snprintf \
+ _snprintf=avpriv_snprintf \
+ vsnprintf=avpriv_vsnprintf
+elif check_cpp_condition stddef.h "defined __KLIBC__"; then
+ libc_type=klibc
+fi
+
+test -n "$libc_type" && enable $libc_type
+
+# hacks for compiler/libc/os combinations
+
+if enabled_all tms470 glibc; then
+ CPPFLAGS="-I${source_path}/compat/tms470 ${CPPFLAGS}"
+ add_cppflags -D__USER_LABEL_PREFIX__=
+ add_cppflags -D__builtin_memset=memset
+ add_cppflags -D__gnuc_va_list=va_list -D_VA_LIST_DEFINED
+ add_cflags -pds=48 # incompatible redefinition of macro
+fi
+
+if enabled_all ccc glibc; then
+ add_ldflags -Wl,-z,now # calls to libots crash without this
+fi
+
+esc(){
+ echo "$*" | sed 's/%/%25/g;s/:/%3a/g'
+}
+
+echo "config:$arch:$subarch:$cpu:$target_os:$(esc $cc_ident):$(esc $LIBAV_CONFIGURATION)" >config.fate
check_cpp_condition stdlib.h "defined(__PIC__) || defined(__pic__) || defined(PIC)" && enable pic
set_default $PATHS_LIST
+set_default nm
# we need to build at least one lib type
if ! enabled_any static shared; then
@@ -2615,6 +3122,7 @@ die_license_disabled gpl libxvid
die_license_disabled gpl x11grab
die_license_disabled nonfree libfaac
+die_license_disabled nonfree libfdk_aac
die_license_disabled nonfree openssl
die_license_disabled version3 libopencore_amrnb
@@ -2638,10 +3146,10 @@ enabled pic && enable_pic
check_cc <<EOF || die "Symbol mangling check failed."
int ff_extern;
EOF
-sym=$($nm $nm_opts $TMPO | awk '/ff_extern/{ print substr($0, match($0, /[^ \t]*ff_extern/)) }')
+sym=$($nm $TMPO | awk '/ff_extern/{ print substr($0, match($0, /[^ \t]*ff_extern/)) }')
extern_prefix=${sym%%ff_extern*}
-check_cc <<EOF && enable inline_asm
+check_cc <<EOF && enable_weak inline_asm
void foo(void) { __asm__ volatile ("" ::); }
EOF
@@ -2671,6 +3179,7 @@ if enabled alpha; then
elif enabled arm; then
+ check_cpp_condition stddef.h "defined __thumb__" && enable_weak thumb
enabled thumb && check_cflags -mthumb || check_cflags -marm
nogas=die
@@ -2687,31 +3196,42 @@ EOF
warn "Compiler does not indicate floating-point ABI, guessing $fpabi."
fi
- enabled armv5te && check_asm armv5te '"qadd r0, r0, r0"'
- enabled armv6 && check_asm armv6 '"sadd16 r0, r0, r0"'
- enabled armv6t2 && check_asm armv6t2 '"movt r0, #0"'
- enabled armvfp && check_asm armvfp '"fadds s0, s0, s0"'
- enabled iwmmxt && check_asm iwmmxt '"wunpckelub wr6, wr4"'
- enabled neon && check_asm neon '"vadd.i16 q0, q0, q0"'
- enabled vfpv3 && check_asm vfpv3 '"vmov.f32 s0, #1.0"'
+ enabled armv5te && check_insn armv5te 'qadd r0, r0, r0'
+ enabled armv6 && check_insn armv6 'sadd16 r0, r0, r0'
+ enabled armv6t2 && check_insn armv6t2 'movt r0, #0'
+ enabled neon && check_insn neon 'vadd.i16 q0, q0, q0'
+ enabled vfp && check_insn vfp 'fadds s0, s0, s0'
+ enabled vfpv3 && check_insn vfpv3 'vmov.f32 s0, #1.0'
+
+ [ $target_os = linux ] ||
+ map 'enabled_any ${v}_external ${v}_inline || disable $v' \
+ $ARCH_EXT_LIST_ARM
- check_asm asm_mod_y '"vmul.i32 d0, d0, %y0" :: "x"(0)'
+ check_inline_asm asm_mod_q '"add r0, %Q0, %R0" :: "r"((long long)0)'
+ check_inline_asm asm_mod_y '"vmul.i32 d0, d0, %y0" :: "x"(0)'
enabled_all armv6t2 shared !pic && enable_pic
elif enabled mips; then
- check_asm loongson '"dmult.g $1, $2, $3"'
- enabled mmi && check_asm mmi '"lq $2, 0($2)"'
+ check_inline_asm loongson '"dmult.g $1, $2, $3"'
+
+elif enabled parisc; then
+
+ if enabled gcc; then
+ case $($cc -dumpversion) in
+ 4.[3-8].*) check_cflags -fno-optimize-sibling-calls ;;
+ esac
+ fi
elif enabled ppc; then
enable local_aligned_8 local_aligned_16
- check_asm dcbzl '"dcbzl 0, %0" :: "r"(0)'
- check_asm ibm_asm '"add 0, 0, 0"'
- check_asm ppc4xx '"maclhw r10, r11, r12"'
- check_asm xform_asm '"lwzx %1, %y0" :: "Z"(*(int*)0), "r"(0)'
+ check_inline_asm dcbzl '"dcbzl 0, %0" :: "r"(0)'
+ check_inline_asm ibm_asm '"add 0, 0, 0"'
+ check_inline_asm ppc4xx '"maclhw r10, r11, r12"'
+ check_inline_asm xform_asm '"lwzx %1, %y0" :: "Z"(*(int*)0), "r"(0)'
# AltiVec flags: The FSF version of GCC differs from the Apple version
if enabled altivec; then
@@ -2736,11 +3256,14 @@ EOF
elif enabled sparc; then
- enabled vis && check_asm vis '"pdist %f0, %f0, %f0"' -mcpu=ultrasparc &&
- add_cflags -mcpu=ultrasparc -mtune=ultrasparc
+ enabled vis && check_inline_asm vis '"pdist %f0, %f0, %f0"'
elif enabled x86; then
+ check_code ld intrin.h "__rdtsc()" && enable rdtsc
+
+ check_code ld mmintrin.h "_mm_empty()" && enable mm_empty
+
enable local_aligned_8 local_aligned_16
# check whether EBP is available on x86
@@ -2748,23 +3271,21 @@ elif enabled x86; then
# if the base pointer is used to access it because the
# base pointer is cleared in the inline assembly code.
check_exec_crash <<EOF && enable ebp_available
- volatile int i=0;
- __asm__ volatile (
- "xorl %%ebp, %%ebp"
- ::: "%ebp");
- return i;
+volatile int i=0;
+__asm__ volatile ("xorl %%ebp, %%ebp" ::: "%ebp");
+return i;
EOF
# check whether EBX is available on x86
- check_asm ebx_available '""::"b"(0)' &&
- check_asm ebx_available '"":::"%ebx"'
+ check_inline_asm ebx_available '""::"b"(0)' &&
+ check_inline_asm ebx_available '"":::"%ebx"'
# check whether xmm clobbers are supported
- check_asm xmm_clobbers '"":::"%xmm0"'
+ check_inline_asm xmm_clobbers '"":::"%xmm0"'
- # check whether binutils is new enough to compile SSSE3/MMX2
- enabled ssse3 && check_asm ssse3 '"pabsw %xmm0, %xmm0"'
- enabled mmx2 && check_asm mmx2 '"pmaxub %mm0, %mm1"'
+ # check whether binutils is new enough to compile SSSE3/MMXEXT
+ enabled ssse3 && check_inline_asm ssse3_inline '"pabsw %xmm0, %xmm0"'
+ enabled mmxext && check_inline_asm mmxext_inline '"pmaxub %mm0, %mm1"'
if ! disabled_any asm mmx yasm; then
if check_cmd $yasmexe --version; then
@@ -2785,6 +3306,8 @@ EOF
check_yasm "vextractf128 xmm0, ymm0, 0" && enable yasm ||
die "yasm not found, use --disable-yasm for a crippled build"
+ check_yasm "vfmaddps ymm0, ymm1, ymm2, ymm3" || disable fma4_external
+ check_yasm "CPU amdnop" && enable cpunop
fi
case "$cpu" in
@@ -2797,8 +3320,13 @@ fi
if enabled asm; then
as=${gas:=$as}
- check_asm gnu_as '".macro m n\n\\n:.int 0\n.endm\nm x"' ||
+ check_as <<EOF && enable gnu_as || \
$nogas "GNU assembler not found, install gas-preprocessor"
+.macro m n
+\n: .int 0
+.endm
+m x
+EOF
fi
check_ldflags -Wl,--as-needed
@@ -2809,24 +3337,34 @@ elif check_func dlopen -ldl; then
ldl=-ldl
fi
-if enabled network; then
+if ! disabled network; then
check_type "sys/types.h sys/socket.h" socklen_t
check_type netdb.h "struct addrinfo"
+ check_type netinet/in.h "struct group_source_req" -D_BSD_SOURCE
+ check_type netinet/in.h "struct ip_mreq_source" -D_BSD_SOURCE
check_type netinet/in.h "struct ipv6_mreq" -D_DARWIN_C_SOURCE
check_type netinet/in.h "struct sockaddr_in6"
+ check_type poll.h "struct pollfd"
check_type "sys/types.h sys/socket.h" "struct sockaddr_storage"
check_struct "sys/types.h sys/socket.h" "struct sockaddr" sa_len
+ check_type netinet/sctp.h "struct sctp_event_subscribe"
+ check_func getaddrinfo $network_extralibs
+ check_func getservbyport $network_extralibs
# Prefer arpa/inet.h over winsock2
if check_header arpa/inet.h ; then
check_func closesocket
elif check_header winsock2.h ; then
- check_func_headers winsock2.h closesocket -lws2 && \
- network_extralibs="-lws2" || \
- { check_func_headers winsock2.h closesocket -lws2_32 && \
+ check_func_headers winsock2.h closesocket -lws2 &&
+ network_extralibs="-lws2" ||
+ { check_func_headers winsock2.h closesocket -lws2_32 &&
network_extralibs="-lws2_32"; }
+ check_func_headers ws2tcpip.h getaddrinfo $network_extralibs
check_type ws2tcpip.h socklen_t
check_type ws2tcpip.h "struct addrinfo"
+ check_type ws2tcpip.h "struct group_source_req"
+ check_type ws2tcpip.h "struct ip_mreq_source"
check_type ws2tcpip.h "struct ipv6_mreq"
+ check_type winsock2.h "struct pollfd"
check_type ws2tcpip.h "struct sockaddr_in6"
check_type ws2tcpip.h "struct sockaddr_storage"
check_struct winsock2.h "struct sockaddr" sa_len
@@ -2840,17 +3378,20 @@ check_func nanosleep || { check_func nanosleep -lrt && add_extralibs -lrt; }
check_func fcntl
check_func fork
-check_func getaddrinfo $network_extralibs
check_func gethrtime
+check_func getopt
check_func getrusage
check_struct "sys/time.h sys/resource.h" "struct rusage" ru_maxrss
+check_func gettimeofday
check_func inet_aton $network_extralibs
check_func isatty
check_func localtime_r
check_func ${malloc_prefix}memalign && enable memalign
check_func mkstemp
check_func mmap
+check_func mprotect
check_func ${malloc_prefix}posix_memalign && enable posix_memalign
+check_func_headers malloc.h _aligned_malloc && enable aligned_malloc
check_func setrlimit
check_func strerror_r
check_func strptime
@@ -2858,34 +3399,42 @@ check_func strtok_r
check_func sched_getaffinity
check_func sysconf
check_func sysctl
+check_func usleep
check_func_headers io.h setmode
-check_func_headers lzo/lzo1x.h lzo1x_999_compress
+check_lib2 "windows.h shellapi.h" CommandLineToArgvW -lshell32
+check_lib2 "windows.h wincrypt.h" CryptGenRandom -ladvapi32
check_lib2 "windows.h psapi.h" GetProcessMemoryInfo -lpsapi
check_func_headers windows.h GetProcessAffinityMask
check_func_headers windows.h GetProcessTimes
+check_func_headers windows.h GetSystemTimeAsFileTime
check_func_headers windows.h MapViewOfFile
+check_func_headers windows.h SetConsoleTextAttribute
+check_func_headers windows.h Sleep
check_func_headers windows.h VirtualAlloc
+check_header direct.h
check_header dlfcn.h
check_header dxva.h
check_header dxva2api.h
+check_header io.h
check_header malloc.h
check_header poll.h
check_header sys/mman.h
check_header sys/param.h
check_header sys/resource.h
check_header sys/select.h
+check_header sys/time.h
+check_header unistd.h
check_header vdpau/vdpau.h
check_header vdpau/vdpau_x11.h
+check_header windows.h
check_header X11/extensions/XvMClib.h
-check_struct dxva2api.h DXVA_PictureParameters wDecodedPictureIndex
-
disabled zlib || check_lib zlib.h zlibVersion -lz || disable zlib
disabled bzlib || check_lib2 bzlib.h BZ2_bzlibVersion -lbz2 || disable bzlib
if ! disabled w32threads && ! enabled pthreads; then
- check_func _beginthreadex && enable w32threads
+ check_func_headers "windows.h process.h" _beginthreadex && enable w32threads
fi
# check for some common methods of building with pthread support
@@ -2918,35 +3467,29 @@ done
check_lib math.h sin -lm && LIBM="-lm"
enabled vaapi && require vaapi va/va.h vaInitialize -lva
-check_mathfunc exp2
-check_mathfunc exp2f
-check_mathfunc llrint
-check_mathfunc llrintf
-check_mathfunc log2
-check_mathfunc log2f
-check_mathfunc lrint
-check_mathfunc lrintf
-check_mathfunc round
-check_mathfunc roundf
-check_mathfunc trunc
-check_mathfunc truncf
+atan2f_args=2
+ldexpf_args=2
+powf_args=2
+
+for func in $MATH_FUNCS; do
+ eval check_mathfunc $func \${${func}_args:-1}
+done
# these are off by default, so fail if requested and not available
enabled avisynth && require2 vfw32 "windows.h vfw.h" AVIFileInit -lavifil32
enabled frei0r && { check_header frei0r.h || die "ERROR: frei0r.h header not found"; }
enabled gnutls && require_pkg_config gnutls gnutls/gnutls.h gnutls_global_init
-enabled libdirac && require_pkg_config dirac \
- "libdirac_decoder/dirac_parser.h libdirac_encoder/dirac_encoder.h" \
- "dirac_decoder_init dirac_encoder_init"
enabled libfaac && require2 libfaac "stdint.h faac.h" faacEncGetVersion -lfaac
+enabled libfdk_aac && require libfdk_aac fdk-aac/aacenc_lib.h aacEncOpen -lfdk-aac
enabled libfreetype && require_pkg_config freetype2 "ft2build.h freetype/freetype.h" FT_Init_FreeType
enabled libgsm && require libgsm gsm/gsm.h gsm_create -lgsm
+enabled libilbc && require libilbc ilbc.h WebRtcIlbcfix_InitDecode -lilbc
enabled libmp3lame && require "libmp3lame >= 3.98.3" lame/lame.h lame_set_VBR_quality -lmp3lame
-enabled libnut && require libnut libnut.h nut_demuxer_init -lnut
enabled libopencore_amrnb && require libopencore_amrnb opencore-amrnb/interf_dec.h Decoder_Interface_init -lopencore-amrnb
enabled libopencore_amrwb && require libopencore_amrwb opencore-amrwb/dec_if.h D_IF_init -lopencore-amrwb
enabled libopencv && require_pkg_config opencv opencv/cv.h cvCreateImageHeader
enabled libopenjpeg && require libopenjpeg openjpeg.h opj_version -lopenjpeg
+enabled libopus && require_pkg_config opus opus_multistream.h opus_multistream_decoder_create
enabled libpulse && require_pkg_config libpulse-simple pulse/simple.h pa_simple_new
enabled librtmp && require_pkg_config librtmp librtmp/rtmp.h RTMP_Socket
enabled libschroedinger && require_pkg_config schroedinger-1.0 schroedinger/schro.h schro_init
@@ -2958,19 +3501,23 @@ enabled libvorbis && require libvorbis vorbis/vorbisenc.h vorbis_info_init -lv
enabled libvpx && {
enabled libvpx_decoder && { check_lib2 "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_dec_init_ver -lvpx ||
die "ERROR: libvpx decoder version must be >=0.9.1"; }
- enabled libvpx_encoder && { check_lib2 "vpx/vpx_encoder.h vpx/vp8cx.h" vpx_codec_enc_init_ver -lvpx ||
- die "ERROR: libvpx encoder version must be >=0.9.1"; } }
+ 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 >= 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 mlib && require mediaLib mlib_types.h mlib_VectorSub_S16_U8_Mod -lmlib
enabled openssl && { check_lib openssl/ssl.h SSL_library_init -lssl -lcrypto ||
check_lib openssl/ssl.h SSL_library_init -lssl32 -leay32 ||
check_lib openssl/ssl.h SSL_library_init -lssl -lcrypto -lws2_32 -lgdi32 ||
die "ERROR: openssl not found"; }
+if enabled gnutls; then
+ { check_lib nettle/bignum.h nettle_mpz_get_str_256 -lnettle -lhogweed -lgmp && enable nettle; } ||
+ { check_lib gcrypt.h gcry_mpi_new -lgcrypt && enable gcrypt; }
+fi
+
# libdc1394 check
if enabled libdc1394; then
{ check_lib dc1394/dc1394.h dc1394_new -ldc1394 -lraw1394 &&
@@ -2980,7 +3527,7 @@ if enabled libdc1394; then
die "ERROR: No version of libdc1394 found "
fi
-if check_pkg_config sdl SDL_version.h SDL_Linked_Version; then
+if check_pkg_config sdl SDL_events.h SDL_PollEvent; then
check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) >= 0x010201" $sdl_cflags &&
enable sdl &&
check_struct SDL.h SDL_VideoInfo current_w $sdl_cflags && enable sdl_video_size
@@ -2989,7 +3536,6 @@ fi
texi2html -version > /dev/null 2>&1 && enable texi2html || disable texi2html
check_header linux/fb.h
-check_header linux/videodev.h
check_header linux/videodev2.h
check_struct linux/videodev2.h "struct v4l2_frmivalenum" discrete
@@ -3015,20 +3561,19 @@ check_header soundcard.h
enabled_any alsa_indev alsa_outdev && check_lib2 alsa/asoundlib.h snd_pcm_htimestamp -lasound
-enabled jack_indev && check_lib2 jack/jack.h jack_client_open -ljack
+enabled jack_indev && check_lib2 jack/jack.h jack_client_open -ljack &&
+ check_func jack_port_get_latency_range -ljack
enabled_any sndio_indev sndio_outdev && check_lib2 sndio.h sio_open -lsndio
-enabled libcdio &&
- check_lib2 "cdio/cdda.h cdio/paranoia.h" cdio_cddap_open "-lcdio_paranoia -lcdio_cdda -lcdio"
+if enabled libcdio; then
+ check_lib2 "cdio/cdda.h cdio/paranoia.h" cdio_cddap_open -lcdio_paranoia -lcdio_cdda -lcdio || check_lib2 "cdio/paranoia/cdda.h cdio/paranoia/paranoia.h" cdio_cddap_open -lcdio_paranoia -lcdio_cdda -lcdio
+fi
-enabled x11grab &&
-check_header X11/Xlib.h &&
-check_header X11/extensions/XShm.h &&
-check_header X11/extensions/Xfixes.h &&
-check_func XOpenDisplay -lX11 &&
-check_func XShmCreateImage -lX11 -lXext &&
-check_func XFixesGetCursorImage -lX11 -lXext -lXfixes
+enabled x11grab &&
+require X11 X11/Xlib.h XOpenDisplay -lX11 &&
+require Xext X11/extensions/XShm.h XShmCreateImage -lXext &&
+require Xfixes X11/extensions/Xfixes.h XFixesGetCursorImage -lXfixes
# check for VDA header
if ! disabled vda && check_header VideoDecodeAcceleration/VDADecoder.h; then
@@ -3036,10 +3581,8 @@ if ! disabled vda && check_header VideoDecodeAcceleration/VDADecoder.h; then
fi
if ! disabled vdpau && enabled vdpau_vdpau_h; then
-check_cpp_condition \
- vdpau/vdpau.h "defined VDP_DECODER_PROFILE_MPEG4_PART2_ASP" ||
- { echolog "Please upgrade to libvdpau >= 0.2 if you would like vdpau support." &&
- disable vdpau; }
+ check_cpp_condition vdpau/vdpau.h "defined VDP_DECODER_PROFILE_MPEG4_PART2_ASP" ||
+ { echolog "Please upgrade to libvdpau >= 0.2 if you would like vdpau support." && disable vdpau; }
fi
enabled debug && add_cflags -g"$debuglevel" && add_asflags -g"$debuglevel"
@@ -3064,9 +3607,20 @@ enabled extra_warnings && check_cflags -Winline
# add some linker flags
check_ldflags -Wl,--warn-common
-check_ldflags -Wl,-rpath-link=libpostproc:libswscale:libavfilter:libavdevice:libavformat:libavcodec:libavutil
+check_ldflags -Wl,-rpath-link=libswscale:libavfilter:libavdevice:libavformat:libavcodec:libavutil:libavresample
test_ldflags -Wl,-Bsymbolic && append SHFLAGS -Wl,-Bsymbolic
+enabled xmm_clobber_test &&
+ check_ldflags -Wl,--wrap,avcodec_open2 \
+ -Wl,--wrap,avcodec_decode_audio4 \
+ -Wl,--wrap,avcodec_decode_video2 \
+ -Wl,--wrap,avcodec_decode_subtitle2 \
+ -Wl,--wrap,avcodec_encode_audio2 \
+ -Wl,--wrap,avcodec_encode_video \
+ -Wl,--wrap,avcodec_encode_subtitle \
+ -Wl,--wrap,sws_scale ||
+ disable xmm_clobber_test
+
echo "X{};" > $TMPV
if test_ldflags -Wl,--version-script,$TMPV; then
append SHFLAGS '-Wl,--version-script,\$(SUBDIR)lib\$(NAME).ver'
@@ -3080,17 +3634,31 @@ void ff_foo(void) {}
EOF
fi
-if [ -n "$optflags" ]; then
- add_cflags $optflags
-elif enabled small; then
- add_cflags $size_cflags
-elif enabled optimizations; then
- add_cflags $speed_cflags
-else
- add_cflags $noopt_cflags
+if [ -z "$optflags" ]; then
+ if enabled small; then
+ optflags=$cflags_size
+ elif enabled optimizations; then
+ optflags=$cflags_speed
+ else
+ optflags=$cflags_noopt
+ fi
fi
-check_cflags -fno-math-errno
-check_cflags -fno-signed-zeros
+
+check_optflags(){
+ check_cflags "$@"
+ enabled lto && check_ldflags "$@"
+}
+
+
+if enabled lto; then
+ test "$cc_type" != "$ld_type" && die "LTO requires same compiler and linker"
+ check_cflags -flto
+ check_ldflags -flto $cpuflags
+fi
+
+check_optflags $optflags
+check_optflags -fno-math-errno
+check_optflags -fno-signed-zeros
if enabled icc; then
# Just warnings, no remarks
@@ -3098,10 +3666,11 @@ if enabled icc; then
# -wd: Disable following warnings
# 144, 167, 556: -Wno-pointer-sign
# 1292: attribute "foo" ignored
+ # 1419: external declaration in primary source file
# 10006: ignoring unknown option -fno-signed-zeros
# 10148: ignoring unknown option -Wno-parentheses
# 10156: ignoring option '-W'; no argument required
- check_cflags -wd144,167,556,1292,10006,10148,10156
+ check_cflags -wd144,167,556,1292,1419,10006,10148,10156
# 11030: Warning unknown option --as-needed
# 10156: ignoring option '-export'; no argument required
check_ldflags -wd10156,11030
@@ -3110,28 +3679,30 @@ if enabled icc; then
# icc 11.0 and 11.1 work with ebp_available, but don't pass the test
enable ebp_available
if enabled x86_32; then
- test ${icc_version%%.*} -ge 11 && \
- check_cflags -falign-stack=maintain-16-byte || \
+ icc_version=$($cc -dumpversion)
+ test ${icc_version%%.*} -ge 11 &&
+ check_cflags -falign-stack=maintain-16-byte ||
disable aligned_stack
fi
elif enabled ccc; then
# disable some annoying warnings
- add_cflags -msg_disable cvtu32to64
- add_cflags -msg_disable embedcomment
- add_cflags -msg_disable needconstext
- add_cflags -msg_disable nomainieee
- add_cflags -msg_disable ptrmismatch1
- add_cflags -msg_disable unreachcode
+ add_cflags -msg_disable bitnotint
+ add_cflags -msg_disable mixfuncvoid
+ add_cflags -msg_disable nonstandcast
+ add_cflags -msg_disable unsupieee
elif enabled gcc; then
- check_cflags -fno-tree-vectorize
+ check_optflags -fno-tree-vectorize
check_cflags -Werror=implicit-function-declaration
check_cflags -Werror=missing-prototypes
check_cflags -Werror=declaration-after-statement
+ check_cflags -Werror=vla
elif enabled llvm_gcc; then
check_cflags -mllvm -stack-alignment=16
elif enabled clang; then
check_cflags -mllvm -stack-alignment=16
check_cflags -Qunused-arguments
+ check_cflags -Werror=implicit-function-declaration
+ check_cflags -Werror=missing-prototypes
elif enabled armcc; then
# 2523: use of inline assembler is deprecated
add_cflags -W${armcc_opt},--diag_suppress=2523
@@ -3144,19 +3715,29 @@ elif enabled tms470; then
add_cflags -pds=824 -pds=837
elif enabled pathscale; then
add_cflags -fstrict-overflow -OPT:wrap_around_unsafe_opt=OFF
+elif enabled msvc; then
+ enabled x86_32 && disable aligned_stack
fi
+case $target_os in
+ osf1)
+ enabled ccc && add_ldflags '-Wl,-expect_unresolved,*'
+ ;;
+ plan9)
+ add_cppflags -Dmain=plan9_main
+ ;;
+esac
+
enabled_any $THREADS_LIST && enable threads
+enabled asm || { arch=c; disable $ARCH_LIST $ARCH_EXT_LIST; }
+
check_deps $CONFIG_LIST \
$CONFIG_EXTRA \
$HAVE_LIST \
$ALL_COMPONENTS \
- $ALL_TESTS \
-
-enabled asm || { arch=c; disable $ARCH_LIST $ARCH_EXT_LIST; }
-! enabled_any memalign posix_memalign malloc_aligned &&
+! enabled_any memalign posix_memalign aligned_malloc &&
enabled_any $need_memalign && enable memalign_hack
echo "install prefix $prefix"
@@ -3174,12 +3755,13 @@ echo "runtime cpu detection ${runtime_cpudetect-no}"
if enabled x86; then
echo "${yasmexe} ${yasm-no}"
echo "MMX enabled ${mmx-no}"
- echo "MMX2 enabled ${mmx2-no}"
+ echo "MMXEXT enabled ${mmxext-no}"
echo "3DNow! enabled ${amd3dnow-no}"
echo "3DNow! extended enabled ${amd3dnowext-no}"
echo "SSE enabled ${sse-no}"
echo "SSSE3 enabled ${ssse3-no}"
echo "AVX enabled ${avx-no}"
+ echo "FMA4 enabled ${fma4-no}"
echo "CMOV enabled ${cmov-no}"
echo "CMOV is fast ${fast_cmov-no}"
echo "EBX available ${ebx_available-no}"
@@ -3189,13 +3771,9 @@ if enabled arm; then
echo "ARMv5TE enabled ${armv5te-no}"
echo "ARMv6 enabled ${armv6-no}"
echo "ARMv6T2 enabled ${armv6t2-no}"
- echo "ARM VFP enabled ${armvfp-no}"
- echo "IWMMXT enabled ${iwmmxt-no}"
+ echo "VFP enabled ${vfp-no}"
echo "NEON enabled ${neon-no}"
fi
-if enabled mips; then
- echo "MMI enabled ${mmi-no}"
-fi
if enabled ppc; then
echo "AltiVec enabled ${altivec-no}"
echo "PPC 4xx optimizations ${ppc4xx-no}"
@@ -3209,13 +3787,11 @@ echo "optimize for size ${small-no}"
echo "optimizations ${optimizations-no}"
echo "static ${static-no}"
echo "shared ${shared-no}"
-echo "postprocessing support ${postproc-no}"
echo "new filter support ${avfilter-no}"
echo "network support ${network-no}"
echo "threading support ${thread_type-no}"
echo "safe bitstream reader ${safe_bitstream_reader-no}"
echo "SDL support ${sdl-no}"
-echo "Sun medialib support ${mlib-no}"
echo "libdxva2 enabled ${dxva2-no}"
echo "libva enabled ${vaapi-no}"
echo "libvdpau enabled ${vdpau-no}"
@@ -3224,15 +3800,16 @@ echo "frei0r enabled ${frei0r-no}"
echo "gnutls enabled ${gnutls-no}"
echo "libcdio support ${libcdio-no}"
echo "libdc1394 support ${libdc1394-no}"
-echo "libdirac enabled ${libdirac-no}"
echo "libfaac enabled ${libfaac-no}"
+echo "libfdk-aac enabled ${libfdk_aac-no}"
echo "libgsm enabled ${libgsm-no}"
+echo "libilbc enabled ${libilbc-no}"
echo "libmp3lame enabled ${libmp3lame-no}"
-echo "libnut enabled ${libnut-no}"
echo "libopencore-amrnb support ${libopencore_amrnb-no}"
echo "libopencore-amrwb support ${libopencore_amrwb-no}"
echo "libopencv support ${libopencv-no}"
echo "libopenjpeg enabled ${libopenjpeg-no}"
+echo "libopus enabled ${libopus-no}"
echo "libpulse enabled ${libpulse-no}"
echo "librtmp enabled ${librtmp-no}"
echo "libschroedinger enabled ${libschroedinger-no}"
@@ -3248,6 +3825,8 @@ echo "libxvid enabled ${libxvid-no}"
echo "openssl enabled ${openssl-no}"
echo "zlib enabled ${zlib-no}"
echo "bzlib enabled ${bzlib-no}"
+test -n "$random_seed" &&
+ echo "random seed ${random_seed}"
echo
for type in decoder encoder hwaccel parser demuxer muxer protocol filter bsf indev outdev; do
@@ -3293,19 +3872,30 @@ CC=$cc
AS=$as
LD=$ld
DEPCC=$dep_cc
+DEPCCFLAGS=$DEPCCFLAGS \$(CPPFLAGS)
+DEPAS=$as
+DEPASFLAGS=$DEPASFLAGS \$(CPPFLAGS)
YASM=$yasmexe
-YASMDEP=$yasmexe
+DEPYASM=$yasmexe
AR=$ar
+ARFLAGS=$arflags
+AR_O=$ar_o
RANLIB=$ranlib
LN_S=$ln_s
CPPFLAGS=$CPPFLAGS
CFLAGS=$CFLAGS
ASFLAGS=$ASFLAGS
-AS_O=$CC_O
+AS_C=$AS_C
+AS_O=$AS_O
+CC_C=$CC_C
+CC_E=$CC_E
CC_O=$CC_O
+LD_O=$LD_O
+LD_LIB=$LD_LIB
+LD_PATH=$LD_PATH
DLLTOOL=$dlltool
LDFLAGS=$LDFLAGS
-AVSERVERLDFLAGS=$AVSERVERLDFLAGS
+LDFLAGS-avserver=$AVSERVERLDFLAGS
SHFLAGS=$SHFLAGS
YASMFLAGS=$YASMFLAGS
BUILDSUF=$build_suffix
@@ -3317,22 +3907,35 @@ SLIBPREF=$SLIBPREF
SLIBSUF=$SLIBSUF
EXESUF=$EXESUF
EXTRA_VERSION=$extra_version
-DEPFLAGS=$DEPFLAGS
CCDEP=$CCDEP
+CCDEP_FLAGS=$CCDEP_FLAGS
ASDEP=$ASDEP
+ASDEP_FLAGS=$ASDEP_FLAGS
CC_DEPFLAGS=$CC_DEPFLAGS
AS_DEPFLAGS=$AS_DEPFLAGS
HOSTCC=$host_cc
+HOSTLD=$host_ld
HOSTCFLAGS=$host_cflags
HOSTEXESUF=$HOSTEXESUF
HOSTLDFLAGS=$host_ldflags
HOSTLIBS=$host_libs
+DEPHOSTCC=$host_cc
+DEPHOSTCCFLAGS=$DEPHOSTCCFLAGS \$(HOSTCCFLAGS)
+HOSTCCDEP=$HOSTCCDEP
+HOSTCCDEP_FLAGS=$HOSTCCDEP_FLAGS
+HOSTCC_DEPFLAGS=$HOSTCC_DEPFLAGS
+HOSTCC_C=$HOSTCC_C
+HOSTCC_O=$HOSTCC_O
+HOSTLD_O=$HOSTLD_O
TARGET_EXEC=$target_exec
TARGET_PATH=$target_path
-SDL_LIBS=$sdl_libs
-SDL_CFLAGS=$sdl_cflags
+LIBS-avplay=$sdl_libs
+CFLAGS-avplay=$sdl_cflags
+ZLIB=$($ldflags_filter -lz)
LIB_INSTALL_EXTRA_CMD=$LIB_INSTALL_EXTRA_CMD
EXTRALIBS=$extralibs
+COMPAT_OBJS=$compat_objs
+EXEOBJS=$exeobjs
INSTALL=install
LIBTARGET=${LIBTARGET}
SLIBNAME=${SLIBNAME}
@@ -3344,26 +3947,20 @@ SLIB_INSTALL_NAME=${SLIB_INSTALL_NAME}
SLIB_INSTALL_LINKS=${SLIB_INSTALL_LINKS}
SLIB_INSTALL_EXTRA_LIB=${SLIB_INSTALL_EXTRA_LIB}
SLIB_INSTALL_EXTRA_SHLIB=${SLIB_INSTALL_EXTRA_SHLIB}
-SAMPLES:=${samples:-\$(FATE_SAMPLES)}
+SAMPLES:=${samples:-\$(LIBAV_SAMPLES)}
EOF
get_version(){
- name=$1
- file=$source_path/$2
- eval $(grep "#define ${name}_VERSION_M" "$file" | awk '{ print $2"="$3 }')
+ lcname=lib${1}
+ name=$(toupper $lcname)
+ file=$source_path/$lcname/version.h
+ eval $(awk "/#define ${name}_VERSION_M/ { print \$2 \"=\" \$3 }" "$file")
eval ${name}_VERSION=\$${name}_VERSION_MAJOR.\$${name}_VERSION_MINOR.\$${name}_VERSION_MICRO
- lcname=$(tolower $name)
eval echo "${lcname}_VERSION=\$${name}_VERSION" >> config.mak
eval echo "${lcname}_VERSION_MAJOR=\$${name}_VERSION_MAJOR" >> config.mak
}
-get_version LIBAVCODEC libavcodec/version.h
-get_version LIBAVDEVICE libavdevice/avdevice.h
-get_version LIBAVFILTER libavfilter/version.h
-get_version LIBAVFORMAT libavformat/version.h
-get_version LIBAVUTIL libavutil/avutil.h
-get_version LIBPOSTPROC libpostproc/postprocess.h
-get_version LIBSWSCALE libswscale/swscale.h
+map 'get_version $v' $LIBRARY_LIST
cat > $TMPH <<EOF
/* Automatically generated by configure - do not modify! */
@@ -3372,8 +3969,7 @@ cat > $TMPH <<EOF
#define LIBAV_CONFIGURATION "$(c_escape $LIBAV_CONFIGURATION)"
#define LIBAV_LICENSE "$(c_escape $license)"
#define AVCONV_DATADIR "$(eval c_escape $datadir)"
-#define CC_TYPE "$cc_type"
-#define CC_VERSION $cc_version
+#define CC_IDENT "$(c_escape ${cc_ident:-Unknown compiler})"
#define restrict $_restrict
#define EXTERN_PREFIX "${extern_prefix}"
#define EXTERN_ASM ${extern_prefix}
@@ -3383,15 +3979,6 @@ EOF
test -n "$malloc_prefix" &&
echo "#define MALLOC_PREFIX $malloc_prefix" >>$TMPH
-if enabled small || disabled optimizations; then
- echo "#undef av_always_inline" >> $TMPH
- if enabled small; then
- echo "#define av_always_inline inline" >> $TMPH
- else
- echo "#define av_always_inline av_unused" >> $TMPH
- fi
-fi
-
if enabled yasm; then
append config_files $TMPASM
printf '' >$TMPASM
@@ -3403,14 +3990,6 @@ print_config CONFIG_ "$config_files" $CONFIG_LIST \
$CONFIG_EXTRA \
$ALL_COMPONENTS \
-cat >>config.mak <<EOF
-ACODEC_TESTS=$(print_enabled -n _test $ACODEC_TESTS)
-VCODEC_TESTS=$(print_enabled -n _test $VCODEC_TESTS)
-LAVF_TESTS=$(print_enabled -n _test $LAVF_TESTS)
-LAVFI_TESTS=$(print_enabled -n _test $LAVFI_TESTS)
-SEEK_TESTS=$(print_enabled -n _test $SEEK_TESTS)
-EOF
-
echo "#endif /* LIBAV_CONFIG_H */" >> $TMPH
# Do not overwrite an unchanged config.h to avoid superfluous rebuilds.
@@ -3436,15 +4015,15 @@ test -n "$WARNINGS" && printf "\n$WARNINGS"
# build pkg-config files
pkgconfig_generate(){
-name=$1
-shortname=${name#lib}${build_suffix}
-comment=$2
-version=$3
-libs=$4
-requires=$5
-enabled ${name#lib} || return 0
-mkdir -p $name
-cat <<EOF > $name/$name.pc
+ name=$1
+ shortname=${name#lib}${build_suffix}
+ comment=$2
+ version=$3
+ libs=$4
+ requires=$5
+ enabled ${name#lib} || return 0
+ mkdir -p $name
+ cat <<EOF > $name/$name.pc
prefix=$prefix
exec_prefix=\${prefix}
libdir=$libdir
@@ -3460,7 +4039,7 @@ Libs: -L\${libdir} -l${shortname} $(enabled shared || echo $libs)
Libs.private: $(enabled shared && echo $libs)
Cflags: -I\${includedir}
EOF
-cat <<EOF > $name/$name-uninstalled.pc
+ cat <<EOF > $name/$name-uninstalled.pc
prefix=
exec_prefix=
libdir=\${pcfiledir}
@@ -3480,6 +4059,6 @@ pkgconfig_generate libavutil "Libav utility library" "$LIBAVUTIL_VERSION" "$LIBM
pkgconfig_generate libavcodec "Libav codec library" "$LIBAVCODEC_VERSION" "$extralibs" "libavutil = $LIBAVUTIL_VERSION"
pkgconfig_generate libavformat "Libav container format library" "$LIBAVFORMAT_VERSION" "$extralibs" "libavcodec = $LIBAVCODEC_VERSION"
pkgconfig_generate libavdevice "Libav device handling library" "$LIBAVDEVICE_VERSION" "$extralibs" "libavformat = $LIBAVFORMAT_VERSION"
-pkgconfig_generate libavfilter "Libav video filtering library" "$LIBAVFILTER_VERSION" "$extralibs"
-pkgconfig_generate libpostproc "Libav postprocessing library" "$LIBPOSTPROC_VERSION" "" "libavutil = $LIBAVUTIL_VERSION"
+pkgconfig_generate libavfilter "Libav video filtering library" "$LIBAVFILTER_VERSION" "$extralibs" "libavutil = $LIBAVUTIL_VERSION"
+pkgconfig_generate libavresample "Libav audio resampling library" "$LIBAVRESAMPLE_VERSION" "$extralibs" "libavutil = $LIBAVUTIL_VERSION"
pkgconfig_generate libswscale "Libav image rescaling library" "$LIBSWSCALE_VERSION" "$LIBM" "libavutil = $LIBAVUTIL_VERSION"
diff --git a/gst-libs/ext/libav/doc/APIchanges b/gst-libs/ext/libav/doc/APIchanges
index 0b9cdac..6e18ef6 100644
--- a/gst-libs/ext/libav/doc/APIchanges
+++ b/gst-libs/ext/libav/doc/APIchanges
@@ -2,29 +2,253 @@ Never assume the API of libav* to be stable unless at least 1 month has passed
since the last major version increase.
The last version increases were:
-libavcodec: 2011-04-18
-libavdevice: 2011-04-18
-libavfilter: 2011-04-18
-libavformat: 2011-04-18
-libpostproc: 2011-04-18 (deprecated, to be removed later)
-libswscale: 2011-06-20
-libavutil: 2011-04-18
+libavcodec: 2012-01-27
+libavdevice: 2011-04-18
+libavfilter: 2012-06-22
+libavformat: 2012-01-27
+libavresample: 2012-10-05
+libswscale: 2011-06-20
+libavutil: 2012-10-22
API changes, most recent first:
-2012-03-04 - 7f3f855 - lavu 51.22.1 - error.h
+2012-12-29 - d8fd06c - lavu 52.3.0 - avstring.h
+ Add av_basename() and av_dirname().
+
+2012-11-11 - 5980f5d - lavu 52.2.0 - audioconvert.h
+ Rename audioconvert.h to channel_layout.h. audioconvert.h is now deprecated.
+
+2012-11-05 - dfde8a3 - lavu 52.1.0 - intmath.h
+ Add av_ctz() for trailing zero bit count
+
+2012-10-21 - a893655 - lavu 51.45.0 - error.h
+ Add AVERROR_EXPERIMENTAL
+
+2012-10-12 - d2fcb35 - lavu 51.44.0 - pixdesc.h
+ Add functions for accessing pixel format descriptors.
+ Accessing the av_pix_fmt_descriptors array directly is now
+ deprecated.
+
+2012-10-11 - 9a92aea - lavu 51.43.0 - aes.h, md5.h, sha.h, tree.h
+ Add functions for allocating the opaque contexts for the algorithms,
+ deprecate the context size variables.
+
+2012-10-10 - b522000 - lavf 54.18.0 - avio.h
+ Add avio_closep to complement avio_close.
+
+2012-10-08 - 78071a1 - lavu 51.42.0 - pixfmt.h
+ Rename PixelFormat to AVPixelFormat and all PIX_FMT_* to AV_PIX_FMT_*.
+ To provide backwards compatibility, PixelFormat is now #defined as
+ AVPixelFormat.
+ Note that this can break user code that includes pixfmt.h and uses the
+ 'PixelFormat' identifier. Such code should either #undef PixelFormat
+ or stop using the PixelFormat name.
+
+2012-10-05 - e7ba5b1 - lavr 1.0.0 - avresample.h
+ Data planes parameters to avresample_convert() and
+ avresample_read() are now uint8_t** instead of void**.
+ Libavresample is now stable.
+
+2012-09-24 - a42aada - lavc 54.28.0 - avcodec.h
+ Add avcodec_free_frame(). This function must now
+ be used for freeing an AVFrame.
+
+2012-09-12 - 8919fee - lavu 51.41.0 - audioconvert.h
+ Added AV_CH_LOW_FREQUENCY_2 channel mask value.
+
+2012-09-04 - 686a329 - lavu 51.40.0 - opt.h
+ Reordered the fields in default_val in AVOption, changed which
+ default_val field is used for which AVOptionType.
+
+2012-08-30 - a231832 - lavc 54.26.1 - avcodec.h
+ Add codec descriptor properties AV_CODEC_PROP_LOSSY and
+ AV_CODEC_PROP_LOSSLESS.
+
+2012-08-18 - lavc 54.26 - avcodec.h
+ Add codec descriptors for accessing codec properties without having
+ to refer to a specific decoder or encoder.
+
+ c223d79 - Add an AVCodecDescriptor struct and functions
+ avcodec_descriptor_get() and avcodec_descriptor_next().
+ 51efed1 - Add AVCodecDescriptor.props and AV_CODEC_PROP_INTRA_ONLY.
+ 91e59fe - Add avcodec_descriptor_get_by_name().
+
+
+2012-08-08 - 1d9c2dc - lavu 51.39 - avutil.h
+ Don't implicitly include libavutil/common.h in avutil.h
+
+2012-08-08 - 987170c - lavu 51.38 - dict.h
+ Add av_dict_count().
+
+2012-08-07 - 104e10f - lavc 54.25 - avcodec.h
+ Rename CodecID to AVCodecID and all CODEC_ID_* to AV_CODEC_ID_*.
+ To provide backwards compatibility, CodecID is now #defined as AVCodecID.
+ Note that this can break user code that includes avcodec.h and uses the
+ 'CodecID' identifier. Such code should either #undef CodecID or stop using the
+ CodecID name.
+
+2012-08-03 - 239fdf1 - lavu 51.37.1 - cpu.h
+ lsws 2.1.1 - swscale.h
+ Rename AV_CPU_FLAG_MMX2 ---> AV_CPU_FLAG_MMXEXT.
+ Rename SWS_CPU_CAPS_MMX2 ---> SWS_CPU_CAPS_MMXEXT.
+
+2012-07-29 - 681ed00 - lavf 54.13.0 - avformat.h
+ Add AVFMT_FLAG_NOBUFFER for low latency use cases.
+
+2012-07-20 - b70d89a - lavfi 3.0.0 - avfilter.h
+ Add avfilter_unref_bufferp().
+
+2012-07-10 - 5fade8a - lavu 51.37.0
+ Add av_malloc_array() and av_mallocz_array()
+
+2012-06-22 - d3d3a32 - lavu 51.34.0
+ Add av_usleep()
+
+2012-06-20 - ae0a301 - lavu 51.33.0
+ Move av_gettime() to libavutil, add libavutil/time.h
+
+2012-06-09 - 3971be0 - lavr 0.0.3
+ Add a parameter to avresample_build_matrix() for Dolby/DPLII downmixing.
+
+2012-06-12 - 9baeff9 - lavfi 2.23.0 - avfilter.h
+ Add AVFilterContext.nb_inputs/outputs. Deprecate
+ AVFilterContext.input/output_count.
+
+2012-06-12 - 84b9fbe - lavfi 2.22.0 - avfilter.h
+ Add avfilter_pad_get_type() and avfilter_pad_get_name(). Those
+ should now be used instead of accessing AVFilterPad members
+ directly.
+
+2012-06-12 - b0f0dfc - lavu 51.32.0 - audioconvert.h
+ Add av_get_channel_layout_channel_index(), av_get_channel_name()
+ and av_channel_layout_extract_channel().
+
+2012-05-25 - 154486f - lavu 51.31.0 - opt.h
+ Add av_opt_set_bin()
+
+2012-05-26 - e9cef89 - lavf 54.3.0
+ Add AVFMT_TS_NONSTRICT format flag to indicate that a muxer supports
+ non-increasing monotone timestamps.
+
+2012-05-15 - lavfi 2.17.0
+ Add support for audio filters
+ ac71230/a2cd9be - add video/audio buffer sink in a new installed
+ header buffersink.h
+ 720c6b7 - add av_buffersrc_write_frame(), deprecate
+ av_vsrc_buffer_add_frame()
+ ab16504 - add avfilter_copy_buf_props()
+ 9453c9e - add extended_data to AVFilterBuffer
+ 1b8c927 - add avfilter_get_audio_buffer_ref_from_arrays()
+
+2012-05-09 - lavu 51.30.0 - samplefmt.h
+ 142e740 - add av_samples_copy()
+ 6d7f617 - add av_samples_set_silence()
+
+2012-05-09 - a5117a2 - lavc 54.13.1
+ For audio formats with fixed frame size, the last frame
+ no longer needs to be padded with silence, libavcodec
+ will handle this internally (effectively all encoders
+ behave as if they had CODEC_CAP_SMALL_LAST_FRAME set).
+
+2012-05-07 - 828bd08 - lavc 54.13.0 - avcodec.h
+ Add sample_rate and channel_layout fields to AVFrame.
+
+2012-05-01 - 4010d72 - lavr 0.0.1
+ Change AV_MIX_COEFF_TYPE_Q6 to AV_MIX_COEFF_TYPE_Q8.
+
+2012-04-25 - 3527a73 - lavu 51.29.0 - cpu.h
+ Add av_parse_cpu_flags()
+
+2012-04-24 - c8af852 - lavr 0.0.0
+ Add libavresample audio conversion library
+
+2012-04-20 - 0c0d1bc - lavu 51.28.0 - audio_fifo.h
+ Add audio FIFO functions:
+ av_audio_fifo_free()
+ av_audio_fifo_alloc()
+ av_audio_fifo_realloc()
+ av_audio_fifo_write()
+ av_audio_fifo_read()
+ av_audio_fifo_drain()
+ av_audio_fifo_reset()
+ av_audio_fifo_size()
+ av_audio_fifo_space()
+
+2012-04-14 - lavfi 2.16.0 - avfiltergraph.h
+ d7bcc71 Add avfilter_graph_parse2().
+ 91d3cbe Add avfilter_inout_alloc() and avfilter_inout_free().
+
+2012-04-08 - 4d693b0 - lavu 51.27.0 - samplefmt.h
+ Add av_get_packed_sample_fmt() and av_get_planar_sample_fmt()
+
+2012-04-05 - 5cc51a5 - lavu 51.26.0 - audioconvert.h
+ Add av_get_default_channel_layout()
+
+2012-03-20 - 3c90cc2 - lavfo 54.2.0
+ Deprecate av_read_packet(), use av_read_frame() with
+ AVFMT_FLAG_NOPARSE | AVFMT_FLAG_NOFILLIN in AVFormatContext.flags
+
+2012-03-06 - 4d851f8 - lavu 51.25.0 - cpu.h
+ Add av_set_cpu_flags_mask().
+
+2012-03-05 - lavc 54.8.0
+ 6699d07 Add av_get_exact_bits_per_sample()
+ 9524cf7 Add av_get_audio_frame_duration()
+
+2012-03-04 - 44fe77b - lavc 54.7.0 - avcodec.h
+ Add av_codec_is_encoder/decoder().
+
+2012-03-01 - 442c132 - lavc 54.3.0 - avcodec.h
+ Add av_packet_shrink_side_data.
+
+2012-02-29 - dd2a4bc - lavf 54.2.0 - avformat.h
+ Add AVStream.attached_pic and AV_DISPOSITION_ATTACHED_PIC,
+ used for dealing with attached pictures/cover art.
+
+2012-02-25 - c9bca80 - lavu 51.24.0 - error.h
Add AVERROR_UNKNOWN
+ NOTE: this was backported to 0.8
+
+2012-02-20 - e9cda85 - lavc 54.2.0
+ Add duration field to AVCodecParserContext
+
+2012-02-20 - 0b42a93 - lavu 51.23.1 - mathematics.h
+ Add av_rescale_q_rnd()
-2012-02-29 - 2ad77c6 - lavf 53.21.1
+2012-02-08 - 38d5533 - lavu 51.22.1 - pixdesc.h
+ Add PIX_FMT_PSEUDOPAL flag.
+
+2012-02-08 - 52f82a1 - lavc 54.01.0
+ Add avcodec_encode_video2() and deprecate avcodec_encode_video().
+
+2012-02-01 - 316fc74 - lavc 54.01.0
+ Add av_fast_padded_malloc() as alternative for av_realloc() when aligned
+ memory is required. The buffer will always have FF_INPUT_BUFFER_PADDING_SIZE
+ zero-padded bytes at the end.
+
+2012-01-31 - dd6d3b0 - lavf 54.01.0
Add avformat_get_riff_video_tags() and avformat_get_riff_audio_tags().
+ NOTE: this was backported to 0.8
-2012-02-29 - a1556d3 - lavu 51.22.0 - intfloat.h
+2012-01-31 - af08d9a - lavc 54.01.0
+ Add avcodec_is_open() function.
+ NOTE: this was backported to 0.8
+
+2012-01-30 - 8b93312 - lavu 51.22.0 - intfloat.h
Add a new installed header libavutil/intfloat.h with int/float punning
functions.
+ NOTE: this was backported to 0.8
-2012-02-17 - 350d06d - lavc 53.35.0
- Add avcodec_is_open() function.
+2012-01-25 - lavf 53.22.0
+ f1caf01 Allow doing av_write_frame(ctx, NULL) for flushing possible
+ buffered data within a muxer. Added AVFMT_ALLOW_FLUSH for
+ muxers supporting it (av_write_frame makes sure it is called
+ only for muxers with this flag).
+
+------------------------------8<-------------------------------------
+ 0.8 branch was cut here
+----------------------------->8--------------------------------------
2012-01-15 - lavc 53.34.0
New audio encoding API:
@@ -109,7 +333,7 @@ API changes, most recent first:
Add av_toupper()/av_tolower()
2011-11-05 - b6d08f4 - lavf 53.13.0
- Add avformat_network_init()/avformat_network_uninit()
+ Add avformat_network_init()/avformat_network_deinit()
2011-10-27 - 512557b - lavc 53.15.0
Remove avcodec_parse_frame.
@@ -167,13 +391,22 @@ API changes, most recent first:
2011-07-10 - a67c061 - lavf 53.3.0
Add avformat_find_stream_info(), deprecate av_find_stream_info().
+ NOTE: this was backported to 0.7
2011-07-10 - 0b950fe - lavc 53.6.0
Add avcodec_open2(), deprecate avcodec_open().
+ NOTE: this was backported to 0.7
+
+ Add avcodec_alloc_context3. Deprecate avcodec_alloc_context() and
+ avcodec_alloc_context2().
2011-06-23 - 67e9ae1 - lavu 51.8.0 - attributes.h
Add av_printf_format().
+------------------------------8<-------------------------------------
+ 0.7 branch was cut here
+----------------------------->8--------------------------------------
+
2011-06-16 - 05e84c9, 25de595 - lavf 53.2.0 - avformat.h
Add avformat_open_input and avformat_write_header().
Deprecate av_open_input_stream, av_open_input_file,
@@ -383,39 +616,39 @@ API changes, most recent first:
2011-02-02 - dfd2a00 - lavu 50.37.0 - log.h
Make av_dlog public.
-2011-01-15 - r26374 - lavfi 1.74.0 - AVFilterBufferRefAudioProps
+2011-01-15 - a242ac3 - lavfi 1.74.0 - AVFilterBufferRefAudioProps
Rename AVFilterBufferRefAudioProps.samples_nb to nb_samples.
-2011-01-14 - r26330 - lavf 52.93.0 - av_metadata_copy()
+2011-01-14 - 7f88a5b - lavf 52.93.0 - av_metadata_copy()
Add av_metadata_copy() in avformat.h.
-2011-01-07 - r26262 - lavc 52.107.0 - deprecate reordered_opaque
+2011-01-07 - 81c623f - lavc 52.107.0 - deprecate reordered_opaque
Deprecate reordered_opaque in favor of pkt_pts/dts.
-2011-01-07 - r26261 - lavc 52.106.0 - pkt_dts
+2011-01-07 - 1919fea - lavc 52.106.0 - pkt_dts
Add pkt_dts to AVFrame, this will in the future allow multithreading decoders
to not mess up dts.
-2011-01-07 - r26260 - lavc 52.105.0 - pkt_pts
+2011-01-07 - 393cbb9 - lavc 52.105.0 - pkt_pts
Add pkt_pts to AVFrame.
-2011-01-07 - r26259 - lavc 52.104.0 - av_get_profile_name()
+2011-01-07 - 060ec0a - lavc 52.104.0 - av_get_profile_name()
Add av_get_profile_name to libavcodec/avcodec.h.
-2010-12-27 - r26108 - lavfi 1.71.0 - AV_PERM_NEG_LINESIZES
+2010-12-27 - 0ccabee - lavfi 1.71.0 - AV_PERM_NEG_LINESIZES
Add AV_PERM_NEG_LINESIZES in avfilter.h.
-2010-12-27 - r26104 - lavf 52.91.0 - av_find_best_stream()
+2010-12-27 - 9128ae0 - lavf 52.91.0 - av_find_best_stream()
Add av_find_best_stream to libavformat/avformat.h.
-2010-12-27 - r26103 - lavf 52.90.0
+2010-12-27 - 107a7e3 - lavf 52.90.0
Add AVFMT_NOSTREAMS flag for formats with no streams,
like e.g. text metadata.
-2010-12-22 - r26073 - lavu 50.36.0 - file.h
+2010-12-22 - 0328b9e - lavu 50.36.0 - file.h
Add functions av_file_map() and av_file_unmap() in file.h.
-2010-12-19 - r26056 - lavu 50.35.0 - error.h
+2010-12-19 - 0bc55f5 - lavu 50.35.0 - error.h
Add "not found" error codes:
AVERROR_DEMUXER_NOT_FOUND
AVERROR_MUXER_NOT_FOUND
@@ -426,28 +659,28 @@ API changes, most recent first:
AVERROR_BSF_NOT_FOUND
AVERROR_STREAM_NOT_FOUND
-2010-12-09 - r25923 - lavcore 0.16.0 - avcore.h
+2010-12-09 - c61cdd0 - lavcore 0.16.0 - avcore.h
Move AV_NOPTS_VALUE, AV_TIME_BASE, AV_TIME_BASE_Q symbols from
avcodec.h to avcore.h.
-2010-12-04 - r25886 - lavc 52.98.0 - CODEC_CAP_NEG_LINESIZES
+2010-12-04 - 16cfc96 - lavc 52.98.0 - CODEC_CAP_NEG_LINESIZES
Add CODEC_CAP_NEG_LINESIZES codec capability flag in avcodec.h.
-2010-12-04 - r25879 - lavu 50.34.0 - av_get_pix_fmt_string()
+2010-12-04 - bb4afa1 - lavu 50.34.0 - av_get_pix_fmt_string()
Deprecate avcodec_pix_fmt_string() in favor of
pixdesc.h/av_get_pix_fmt_string().
-2010-12-04 - r25878 - lavcore 0.15.0 - av_image_alloc()
+2010-12-04 - 4da12e3 - lavcore 0.15.0 - av_image_alloc()
Add av_image_alloc() to libavcore/imgutils.h.
-2010-12-02 - r25862 - lavfi 1.67.0 - avfilter_graph_create_filter()
+2010-12-02 - 037be76 - lavfi 1.67.0 - avfilter_graph_create_filter()
Add function avfilter_graph_create_filter() in avfiltergraph.h.
-2010-11-25 - r25826 - lavfi 1.65.0 - avfilter_get_video_buffer_ref_from_arrays()
+2010-11-25 - 4723bc2 - lavfi 1.65.0 - avfilter_get_video_buffer_ref_from_arrays()
Add function avfilter_get_video_buffer_ref_from_arrays() in
avfilter.h.
-2010-11-21 - r25787 - lavcore 0.14.0 - audioconvert.h
+2010-11-21 - 176a615 - lavcore 0.14.0 - audioconvert.h
Add a public audio channel API in audioconvert.h, and deprecate the
corresponding functions in libavcodec:
avcodec_get_channel_name()
@@ -456,23 +689,23 @@ API changes, most recent first:
avcodec_channel_layout_num_channels()
and the CH_* macros defined in libavcodec/avcodec.h.
-2010-11-21 - r25777 - lavf 52.85.0 - avformat.h
+2010-11-21 - 6bfc268 - lavf 52.85.0 - avformat.h
Add av_append_packet().
-2010-11-21 - r25776 - lavc 52.97.0 - avcodec.h
+2010-11-21 - a08d918 - lavc 52.97.0 - avcodec.h
Add av_grow_packet().
-2010-11-17 - r25761 - lavcore 0.13.0 - parseutils.h
+2010-11-17 - 0985e1a - lavcore 0.13.0 - parseutils.h
Add av_parse_color() declared in libavcore/parseutils.h.
-2010-11-13 - r25745 - lavc 52.95.0 - AVCodecContext
+2010-11-13 - cb2c971 - lavc 52.95.0 - AVCodecContext
Add AVCodecContext.subtitle_header and AVCodecContext.subtitle_header_size
fields.
-2010-11-13 - r25740 - lavfi 1.62.0 - avfiltergraph.h
+2010-11-13 - 5aaea02 - lavfi 1.62.0 - avfiltergraph.h
Make avfiltergraph.h public.
-2010-11-13 - r25737 - lavfi 1.61.0 - avfiltergraph.h
+2010-11-13 - 4fcbb2a - lavfi 1.61.0 - avfiltergraph.h
Remove declarations from avfiltergraph.h for the functions:
avfilter_graph_check_validity()
avfilter_graph_config_links()
@@ -480,7 +713,7 @@ API changes, most recent first:
which are now internal.
Use avfilter_graph_config() instead.
-2010-11-08 - r25708 - lavu 50.33.0 - eval.h
+2010-11-08 - d2af720 - lavu 50.33.0 - eval.h
Deprecate functions:
av_parse_and_eval_expr(),
av_parse_expr(),
@@ -492,30 +725,30 @@ API changes, most recent first:
av_expr_eval(),
av_expr_free().
-2010-11-08 - r25707 - lavfi 1.59.0 - avfilter_free()
+2010-11-08 - 24de0ed - lavfi 1.59.0 - avfilter_free()
Rename avfilter_destroy() to avfilter_free().
This change breaks libavfilter API/ABI.
-2010-11-07 - r25705 - lavfi 1.58.0 - avfiltergraph.h
+2010-11-07 - 1e80a0e - lavfi 1.58.0 - avfiltergraph.h
Remove graphparser.h header, move AVFilterInOut and
avfilter_graph_parse() declarations to libavfilter/avfiltergraph.h.
-2010-11-07 - r25700 - lavfi 1.57.0 - AVFilterInOut
+2010-11-07 - 7313132 - lavfi 1.57.0 - AVFilterInOut
Rename field AVFilterInOut.filter to AVFilterInOut.filter_ctx.
This change breaks libavfilter API.
-2010-11-04 - r25674 - lavfi 1.56.0 - avfilter_graph_free()
+2010-11-04 - 97dd1e4 - lavfi 1.56.0 - avfilter_graph_free()
Rename avfilter_graph_destroy() to avfilter_graph_free().
This change breaks libavfilter API/ABI.
-2010-11-04 - r25673 - lavfi 1.55.0 - avfilter_graph_alloc()
+2010-11-04 - e15aeea - lavfi 1.55.0 - avfilter_graph_alloc()
Add avfilter_graph_alloc() to libavfilter/avfiltergraph.h.
-2010-11-02 - r25654 - lavcore 0.12.0 - av_get_bits_per_sample_fmt()
+2010-11-02 - 6f84cd1 - lavcore 0.12.0 - av_get_bits_per_sample_fmt()
Add av_get_bits_per_sample_fmt() to libavcore/samplefmt.h and
deprecate av_get_bits_per_sample_format().
-2010-11-02 - r25653 - lavcore 0.11.0 - samplefmt.h
+2010-11-02 - d63e456 - lavcore 0.11.0 - samplefmt.h
Add sample format functions in libavcore/samplefmt.h:
av_get_sample_fmt_name(),
av_get_sample_fmt(),
@@ -525,149 +758,149 @@ API changes, most recent first:
avcodec_get_sample_fmt(),
avcodec_sample_fmt_string().
-2010-11-02 - r25652 - lavcore 0.10.0 - samplefmt.h
+2010-11-02 - 262d1c5 - lavcore 0.10.0 - samplefmt.h
Define enum AVSampleFormat in libavcore/samplefmt.h, deprecate enum
SampleFormat.
-2010-10-16 - r25502 - lavfi 1.52.0 - avfilter_graph_config()
+2010-10-16 - 2a24df9 - lavfi 1.52.0 - avfilter_graph_config()
Add the function avfilter_graph_config() in avfiltergraph.h.
-2010-10-15 - r25493 - lavf 52.83.0 - metadata API
+2010-10-15 - 03700d3 - lavf 52.83.0 - metadata API
Change demuxers to export metadata in generic format and
muxers to accept generic format. Deprecate the public
conversion API.
-2010-10-10 - r25441 - lavfi 1.49.0 - AVFilterLink.time_base
+2010-10-10 - 867ae7a - lavfi 1.49.0 - AVFilterLink.time_base
Add time_base field to AVFilterLink.
-2010-09-27 - r25236 - lavu 50.31.0 - av_set_options_string()
+2010-09-27 - c85eef4 - lavu 50.31.0 - av_set_options_string()
Move av_set_options_string() from libavfilter/parseutils.h to
libavutil/opt.h.
-2010-09-27 - r25227 - lavfi 1.47.0 - AVFilterLink
+2010-09-27 - acc0490 - lavfi 1.47.0 - AVFilterLink
Make the AVFilterLink fields srcpad and dstpad store the pointers to
the source and destination pads, rather than their indexes.
-2010-09-27 - r25225 - lavu 50.30.0 - av_get_token()
+2010-09-27 - 372e288 - lavu 50.30.0 - av_get_token()
Move av_get_token() from libavfilter/parseutils.h to
libavutil/avstring.h.
-2010-09-26 - r32368 - lsws 0.12.0 - swscale.h
+2010-09-26 - 635d4ae - lsws 0.12.0 - swscale.h
Add the functions sws_alloc_context() and sws_init_context().
-2010-09-26 - r25210 - lavu 50.29.0 - opt.h
+2010-09-26 - 6ed0404 - lavu 50.29.0 - opt.h
Move libavcodec/opt.h to libavutil/opt.h.
-2010-09-24 - r25174 - lavu 50.28.0 - av_log_set_flags()
+2010-09-24 - 1c1c80f - lavu 50.28.0 - av_log_set_flags()
Default of av_log() changed due to many problems to the old no repeat
detection. Read the docs of AV_LOG_SKIP_REPEATED in log.h before
enabling it for your app!.
-2010-09-24 - r25167 - lavc 52.90.0 - av_opt_show2()
+2010-09-24 - f66eb58 - lavc 52.90.0 - av_opt_show2()
Deprecate av_opt_show() in favor or av_opt_show2().
-2010-09-14 - r25120 - lavu 50.27.0 - av_popcount()
+2010-09-14 - bc6f0af - lavu 50.27.0 - av_popcount()
Add av_popcount() to libavutil/common.h.
-2010-09-08 - r25076 - lavu 50.26.0 - av_get_cpu_flags()
+2010-09-08 - c6c98d0 - lavu 50.26.0 - av_get_cpu_flags()
Add av_get_cpu_flags().
-2010-09-07 - r25067 - lavcore 0.9.0 - av_image_copy()
+2010-09-07 - 34017fd - lavcore 0.9.0 - av_image_copy()
Add av_image_copy().
-2010-09-07 - r25064 - lavcore 0.8.0 - av_image_copy_plane()
+2010-09-07 - 9686abb - lavcore 0.8.0 - av_image_copy_plane()
Add av_image_copy_plane().
-2010-09-07 - r25057 - lavcore 0.7.0 - imgutils.h
+2010-09-07 - 9b7269e - lavcore 0.7.0 - imgutils.h
Adopt hierarchical scheme for the imgutils.h function names,
deprecate the old names.
-2010-09-04 - r25040 - lavu 50.25.0 - AV_CPU_FLAG_*
+2010-09-04 - 7160bb7 - lavu 50.25.0 - AV_CPU_FLAG_*
Deprecate the FF_MM_* flags defined in libavcodec/avcodec.h in favor
of the AV_CPU_FLAG_* flags defined in libavutil/cpu.h.
-2010-08-26 - r24936 - lavc 52.87.0 - avcodec_get_channel_layout()
+2010-08-26 - 5da19b5 - lavc 52.87.0 - avcodec_get_channel_layout()
Add avcodec_get_channel_layout() in audioconvert.h.
-2010-08-20 - r24851 - lavcore 0.6.0 - av_fill_image_max_pixsteps()
+2010-08-20 - e344336 - lavcore 0.6.0 - av_fill_image_max_pixsteps()
Rename av_fill_image_max_pixstep() to av_fill_image_max_pixsteps().
-2010-08-18 - r24827 - lavcore 0.5.0 - av_fill_image_max_pixstep()
+2010-08-18 - a6ddf8b - lavcore 0.5.0 - av_fill_image_max_pixstep()
Add av_fill_image_max_pixstep() in imgutils.h.
-2010-08-17 - r24814 - lavu 50.24.0 - AV_NE()
+2010-08-17 - 4f2d2e4 - lavu 50.24.0 - AV_NE()
Add the AV_NE macro.
-2010-08-17 - r24811 - lavfi 1.36.0 - audio framework
+2010-08-17 - ad2c950 - lavfi 1.36.0 - audio framework
Implement AVFilterBufferRefAudioProps struct for audio properties,
get_audio_buffer(), filter_samples() functions and related changes.
-2010-08-12 - r24787 - lavcore 0.4.0 - av_get_image_linesize()
+2010-08-12 - 81c1eca - lavcore 0.4.0 - av_get_image_linesize()
Add av_get_image_linesize() in imgutils.h.
-2010-08-11 - r24773 - lavfi 1.34.0 - AVFilterBufferRef
+2010-08-11 - c1db7bf - lavfi 1.34.0 - AVFilterBufferRef
Resize data and linesize arrays in AVFilterBufferRef to 8.
This change breaks libavfilter API/ABI.
-2010-08-11 - r24768 - lavc 52.85.0 - av_picture_data_copy()
+2010-08-11 - 9f08d80 - lavc 52.85.0 - av_picture_data_copy()
Add av_picture_data_copy in avcodec.h.
-2010-08-11 - r24765 - lavfi 1.33.0 - avfilter_open()
+2010-08-11 - 84c0386 - lavfi 1.33.0 - avfilter_open()
Change avfilter_open() signature:
AVFilterContext *avfilter_open(AVFilter *filter, const char *inst_name) ->
int avfilter_open(AVFilterContext **filter_ctx, AVFilter *filter, const char *inst_name);
This change breaks libavfilter API/ABI.
-2010-08-11 - r24763 - lavfi 1.32.0 - AVFilterBufferRef
+2010-08-11 - cc80caf - lavfi 1.32.0 - AVFilterBufferRef
Add a type field to AVFilterBufferRef, and move video specific
properties to AVFilterBufferRefVideoProps.
This change breaks libavfilter API/ABI.
-2010-08-07 - r24732 - lavfi 1.31.0 - AVFilterLink
+2010-08-07 - 5d4890d - lavfi 1.31.0 - AVFilterLink
Rename AVFilterLink fields:
AVFilterLink.srcpic -> AVFilterLink.src_buf
AVFilterLink.cur_pic -> AVFilterLink.cur_buf
AVFilterLink.outpic -> AVFilterLink.out_buf
-2010-08-07 - r24731 - lavfi 1.30.0
+2010-08-07 - 7fce481 - lavfi 1.30.0
Rename functions and fields:
avfilter_(un)ref_pic -> avfilter_(un)ref_buffer
avfilter_copy_picref_props -> avfilter_copy_buffer_ref_props
AVFilterBufferRef.pic -> AVFilterBufferRef.buffer
-2010-08-07 - r24730 - lavfi 1.29.0 - AVFilterBufferRef
+2010-08-07 - ecc8dad - lavfi 1.29.0 - AVFilterBufferRef
Rename AVFilterPicRef to AVFilterBufferRef.
-2010-08-07 - r24728 - lavfi 1.28.0 - AVFilterBuffer
+2010-08-07 - d54e094 - lavfi 1.28.0 - AVFilterBuffer
Move format field from AVFilterBuffer to AVFilterPicRef.
-2010-08-06 - r24709 - lavcore 0.3.0 - av_check_image_size()
+2010-08-06 - bf176f5 - lavcore 0.3.0 - av_check_image_size()
Deprecate avcodec_check_dimensions() in favor of the function
av_check_image_size() defined in libavcore/imgutils.h.
-2010-07-30 - r24592 - lavfi 1.27.0 - AVFilterBuffer
+2010-07-30 - 56b5e9d - lavfi 1.27.0 - AVFilterBuffer
Increase size of the arrays AVFilterBuffer.data and
AVFilterBuffer.linesize from 4 to 8.
This change breaks libavfilter ABI.
-2010-07-29 - r24583 - lavcore 0.2.0 - imgutils.h
+2010-07-29 - e7bd48a - lavcore 0.2.0 - imgutils.h
Add functions av_fill_image_linesizes() and
av_fill_image_pointers(), declared in libavcore/imgutils.h.
-2010-07-27 - r24518 - lavcore 0.1.0 - parseutils.h
+2010-07-27 - 126b638 - lavcore 0.1.0 - parseutils.h
Deprecate av_parse_video_frame_size() and av_parse_video_frame_rate()
defined in libavcodec in favor of the newly added functions
av_parse_video_size() and av_parse_video_rate() declared in
libavcore/parseutils.h.
-2010-07-23 - r24439 - lavu 50.23.0 - mathematics.h
+2010-07-23 - 4485247 - lavu 50.23.0 - mathematics.h
Add the M_PHI constant definition.
-2010-07-22 - r24424 - lavfi 1.26.0 - media format generalization
+2010-07-22 - bdab614 - lavfi 1.26.0 - media format generalization
Add a type field to AVFilterLink.
Change the field types:
@@ -687,235 +920,235 @@ API changes, most recent first:
This change breaks libavfilter API/ABI.
-2010-07-21 - r24393 - lavcore 0.0.0
+2010-07-21 - aac6ca6 - lavcore 0.0.0
Add libavcore.
-2010-07-17 - r24291 - lavfi 1.25.0 - AVFilterBuffer
+2010-07-17 - b5c582f - lavfi 1.25.0 - AVFilterBuffer
Remove w and h fields from AVFilterBuffer.
-2010-07-17 - r24284 - lavfi 1.24.0 - AVFilterBuffer
+2010-07-17 - f0d77b2 - lavfi 1.24.0 - AVFilterBuffer
Rename AVFilterPic to AVFilterBuffer.
-2010-07-17 - r24278 - lavf 52.74.0 - url_fskip()
+2010-07-17 - 57fe80f - lavf 52.74.0 - url_fskip()
Make url_fskip() return an int error code instead of void.
-2010-07-11 - r24199 - lavc 52.83.0
+2010-07-11 - 23940f1 - lavc 52.83.0
Add AVCodecContext.lpc_type and AVCodecContext.lpc_passes fields.
Add AVLPCType enum.
Deprecate AVCodecContext.use_lpc.
-2010-07-11 - r24185 - lavc 52.82.0 - avsubtitle_free()
+2010-07-11 - e1d7c88 - lavc 52.82.0 - avsubtitle_free()
Add a function for free the contents of a AVSubtitle generated by
avcodec_decode_subtitle.
-2010-07-11 - r24174 - lavu 50.22.0 - bswap.h and intreadwrite.h
+2010-07-11 - b91d08f - lavu 50.22.0 - bswap.h and intreadwrite.h
Make the bswap.h and intreadwrite.h API public.
-2010-07-08 - r24101 - lavu 50.21.0 - pixdesc.h
+2010-07-08 - ce1cd1c - lavu 50.21.0 - pixdesc.h
Rename read/write_line() to av_read/write_image_line().
-2010-07-07 - r24091 - lavfi 1.21.0 - avfilter_copy_picref_props()
+2010-07-07 - 4d508e4 - lavfi 1.21.0 - avfilter_copy_picref_props()
Add avfilter_copy_picref_props().
-2010-07-03 - r24021 - lavc 52.79.0
+2010-07-03 - 2d525ef - lavc 52.79.0
Add FF_COMPLIANCE_UNOFFICIAL and change all instances of
FF_COMPLIANCE_INOFFICIAL to use FF_COMPLIANCE_UNOFFICIAL.
-2010-07-02 - r23985 - lavu 50.20.0 - lfg.h
+2010-07-02 - 89eec74 - lavu 50.20.0 - lfg.h
Export av_lfg_init(), av_lfg_get(), av_mlfg_get(), and av_bmg_get() through
lfg.h.
-2010-06-28 - r23835 - lavfi 1.20.1 - av_parse_color()
+2010-06-28 - a52e2c3 - lavfi 1.20.1 - av_parse_color()
Extend av_parse_color() syntax, make it accept an alpha value specifier and
set the alpha value to 255 by default.
-2010-06-22 - r23706 - lavf 52.71.0 - URLProtocol.priv_data_size, priv_data_class
+2010-06-22 - 735cf6b - lavf 52.71.0 - URLProtocol.priv_data_size, priv_data_class
Add priv_data_size and priv_data_class to URLProtocol.
-2010-06-22 - r23704 - lavf 52.70.0 - url_alloc(), url_connect()
+2010-06-22 - ffbb289 - lavf 52.70.0 - url_alloc(), url_connect()
Add url_alloc() and url_connect().
-2010-06-22 - r23702 - lavf 52.69.0 - av_register_protocol2()
+2010-06-22 - 9b07a2d - lavf 52.69.0 - av_register_protocol2()
Add av_register_protocol2(), deprecating av_register_protocol().
-2010-06-09 - r23551 - lavu 50.19.0 - av_compare_mod()
+2010-06-09 - 65db058 - lavu 50.19.0 - av_compare_mod()
Add av_compare_mod() to libavutil/mathematics.h.
-2010-06-05 - r23485 - lavu 50.18.0 - eval API
+2010-06-05 - 0b99215 - lavu 50.18.0 - eval API
Make the eval API public.
-2010-06-04 - r23461 - lavu 50.17.0 - AV_BASE64_SIZE
+2010-06-04 - 31878fc - lavu 50.17.0 - AV_BASE64_SIZE
Add AV_BASE64_SIZE() macro.
-2010-06-02 - r23421 - lavc 52.73.0 - av_get_codec_tag_string()
+2010-06-02 - 7e566bb - lavc 52.73.0 - av_get_codec_tag_string()
Add av_get_codec_tag_string().
-2010-06-01 - r31301 - lsws 0.11.0 - convertPalette API
+2010-06-01 - 2b99142 - lsws 0.11.0 - convertPalette API
Add sws_convertPalette8ToPacked32() and sws_convertPalette8ToPacked24().
-2010-05-26 - r23334 - lavc 52.72.0 - CODEC_CAP_EXPERIMENTAL
+2010-05-26 - 93ebfee - lavc 52.72.0 - CODEC_CAP_EXPERIMENTAL
Add CODEC_CAP_EXPERIMENTAL flag.
NOTE: this was backported to 0.6
-2010-05-23 - r23255 - lavu 50.16.0 - av_get_random_seed()
+2010-05-23 - 9977863 - lavu 50.16.0 - av_get_random_seed()
Add av_get_random_seed().
-2010-05-18 - r23161 - lavf 52.63.0 - AVFMT_FLAG_RTP_HINT
+2010-05-18 - 796ac23 - lavf 52.63.0 - AVFMT_FLAG_RTP_HINT
Add AVFMT_FLAG_RTP_HINT as possible value for AVFormatContext.flags.
NOTE: this was backported to 0.6
-2010-05-09 - r23066 - lavfi 1.20.0 - AVFilterPicRef
+2010-05-09 - b6bc205 - lavfi 1.20.0 - AVFilterPicRef
Add interlaced and top_field_first fields to AVFilterPicRef.
------------------------------8<-------------------------------------
0.6 branch was cut here
----------------------------->8--------------------------------------
-2010-05-01 - r23002 - lavf 52.62.0 - probe function
+2010-05-01 - 8e2ee18 - lavf 52.62.0 - probe function
Add av_probe_input_format2 to API, it allows ignoring probe
results below given score and returns the actual probe score.
-2010-04-01 - r22806 - lavf 52.61.0 - metadata API
+2010-04-01 - 3dd6180 - lavf 52.61.0 - metadata API
Add a flag for av_metadata_set2() to disable overwriting of
existing tags.
-2010-04-01 - r22753 - lavc 52.66.0
+2010-04-01 - 0fb49b5 - lavc 52.66.0
Add avcodec_get_edge_width().
-2010-03-31 - r22750 - lavc 52.65.0
+2010-03-31 - d103218 - lavc 52.65.0
Add avcodec_copy_context().
-2010-03-31 - r22748 - lavf 52.60.0 - av_match_ext()
+2010-03-31 - 1a70d12 - lavf 52.60.0 - av_match_ext()
Make av_match_ext() public.
-2010-03-31 - r22736 - lavu 50.14.0 - AVMediaType
+2010-03-31 - 1149150 - lavu 50.14.0 - AVMediaType
Move AVMediaType enum from libavcodec to libavutil.
-2010-03-31 - r22735 - lavc 52.64.0 - AVMediaType
+2010-03-31 - 72415b2 - lavc 52.64.0 - AVMediaType
Define AVMediaType enum, and use it instead of enum CodecType, which
is deprecated and will be dropped at the next major bump.
-2010-03-25 - r22684 - lavu 50.13.0 - av_strerror()
+2010-03-25 - 8795823 - lavu 50.13.0 - av_strerror()
Implement av_strerror().
-2010-03-23 - r22649 - lavc 52.60.0 - av_dct_init()
+2010-03-23 - e1484eb - lavc 52.60.0 - av_dct_init()
Support DCT-I and DST-I.
-2010-03-15 - r22540 - lavf 52.56.0 - AVFormatContext.start_time_realtime
+2010-03-15 - b8819c8 - lavf 52.56.0 - AVFormatContext.start_time_realtime
Add AVFormatContext.start_time_realtime field.
-2010-03-13 - r22506 - lavfi 1.18.0 - AVFilterPicRef.pos
+2010-03-13 - 5bb5c1d - lavfi 1.18.0 - AVFilterPicRef.pos
Add AVFilterPicRef.pos field.
-2010-03-13 - r22501 - lavu 50.12.0 - error.h
+2010-03-13 - 60c144f - lavu 50.12.0 - error.h
Move error code definitions from libavcodec/avcodec.h to
the new public header libavutil/error.h.
-2010-03-07 - r22291 - lavc 52.56.0 - avfft.h
+2010-03-07 - c709483 - lavc 52.56.0 - avfft.h
Add public FFT interface.
-2010-03-06 - r22251 - lavu 50.11.0 - av_stristr()
+2010-03-06 - ac6ef86 - lavu 50.11.0 - av_stristr()
Add av_stristr().
-2010-03-03 - r22174 - lavu 50.10.0 - av_tree_enumerate()
+2010-03-03 - 4b83fc0 - lavu 50.10.0 - av_tree_enumerate()
Add av_tree_enumerate().
-2010-02-07 - r21673 - lavu 50.9.0 - av_compare_ts()
+2010-02-07 - b687c1a - lavu 50.9.0 - av_compare_ts()
Add av_compare_ts().
-2010-02-05 - r30513 - lsws 0.10.0 - sws_getCoefficients()
+2010-02-05 - 3f3dc76 - lsws 0.10.0 - sws_getCoefficients()
Add sws_getCoefficients().
-2010-02-01 - r21587 - lavf 52.50.0 - metadata API
+2010-02-01 - ca76a11 - lavf 52.50.0 - metadata API
Add a list of generic tag names, change 'author' -> 'artist',
'year' -> 'date'.
-2010-01-30 - r21545 - lavu 50.8.0 - av_get_pix_fmt()
+2010-01-30 - 80a07f6 - lavu 50.8.0 - av_get_pix_fmt()
Add av_get_pix_fmt().
-2010-01-21 - r30381 - lsws 0.9.0 - sws_scale()
+2010-01-21 - 01cc47d - lsws 0.9.0 - sws_scale()
Change constness attributes of sws_scale() parameters.
-2010-01-10 - r21121 - lavfi 1.15.0 - avfilter_graph_config_links()
+2010-01-10 - 3fb8e77 - lavfi 1.15.0 - avfilter_graph_config_links()
Add a log_ctx parameter to avfilter_graph_config_links().
-2010-01-07 - r30236 - lsws 0.8.0 - sws_isSupported{In,Out}put()
+2010-01-07 - 8e9767f - lsws 0.8.0 - sws_isSupported{In,Out}put()
Add sws_isSupportedInput() and sws_isSupportedOutput() functions.
-2010-01-06 - r21035 - lavfi 1.14.0 - avfilter_add_colorspace()
+2010-01-06 - c1d662f - lavfi 1.14.0 - avfilter_add_colorspace()
Change the avfilter_add_colorspace() signature, make it accept an
(AVFilterFormats **) rather than an (AVFilterFormats *) as before.
-2010-01-03 - r21007 - lavfi 1.13.0 - avfilter_add_colorspace()
+2010-01-03 - 4fd1f18 - lavfi 1.13.0 - avfilter_add_colorspace()
Add avfilter_add_colorspace().
-2010-01-02 - r20998 - lavf 52.46.0 - av_match_ext()
+2010-01-02 - 8eb631f - lavf 52.46.0 - av_match_ext()
Add av_match_ext(), it should be used in place of match_ext().
-2010-01-01 - r20991 - lavf 52.45.0 - av_guess_format()
+2010-01-01 - a1f547b - lavf 52.45.0 - av_guess_format()
Add av_guess_format(), it should be used in place of guess_format().
-2009-12-13 - r20834 - lavf 52.43.0 - metadata API
+2009-12-13 - a181981 - lavf 52.43.0 - metadata API
Add av_metadata_set2(), AV_METADATA_DONT_STRDUP_KEY and
AV_METADATA_DONT_STRDUP_VAL.
-2009-12-13 - r20829 - lavu 50.7.0 - avstring.h API
+2009-12-13 - 277c733 - lavu 50.7.0 - avstring.h API
Add av_d2str().
-2009-12-13 - r20826 - lavc 52.42.0 - AVStream
+2009-12-13 - 02b398e - lavc 52.42.0 - AVStream
Add avg_frame_rate.
-2009-12-12 - r20808 - lavu 50.6.0 - av_bmg_next()
+2009-12-12 - 3ba69a1 - lavu 50.6.0 - av_bmg_next()
Introduce the av_bmg_next() function.
-2009-12-05 - r20734 - lavfi 1.12.0 - avfilter_draw_slice()
+2009-12-05 - a13a543 - lavfi 1.12.0 - avfilter_draw_slice()
Add a slice_dir parameter to avfilter_draw_slice().
-2009-11-26 - r20611 - lavfi 1.11.0 - AVFilter
+2009-11-26 - 4cc3f6a - lavfi 1.11.0 - AVFilter
Remove the next field from AVFilter, this is not anymore required.
-2009-11-25 - r20607 - lavfi 1.10.0 - avfilter_next()
+2009-11-25 - 1433c4a - lavfi 1.10.0 - avfilter_next()
Introduce the avfilter_next() function.
-2009-11-25 - r20605 - lavfi 1.9.0 - avfilter_register()
+2009-11-25 - 86a60fa - lavfi 1.9.0 - avfilter_register()
Change the signature of avfilter_register() to make it return an
int. This is required since now the registration operation may fail.
-2009-11-25 - r20603 - lavu 50.5.0 - pixdesc.h API
+2009-11-25 - 74a0059 - lavu 50.5.0 - pixdesc.h API
Make the pixdesc.h API public.
-2009-10-27 - r20385 - lavfi 1.5.0 - AVFilter.next
+2009-10-27 - 243110f - lavfi 1.5.0 - AVFilter.next
Add a next field to AVFilter, this is used for simplifying the
registration and management of the registered filters.
-2009-10-23 - r20356 - lavfi 1.4.1 - AVFilter.description
+2009-10-23 - cccd292 - lavfi 1.4.1 - AVFilter.description
Add a description field to AVFilter.
-2009-10-19 - r20302 - lavfi 1.3.0 - avfilter_make_format_list()
+2009-10-19 - 6b5dc05 - lavfi 1.3.0 - avfilter_make_format_list()
Change the interface of avfilter_make_format_list() from
avfilter_make_format_list(int n, ...) to
avfilter_make_format_list(enum PixelFormat *pix_fmts).
-2009-10-18 - r20272 - lavfi 1.0.0 - avfilter_get_video_buffer()
+2009-10-18 - 0eb4ff9 - lavfi 1.0.0 - avfilter_get_video_buffer()
Make avfilter_get_video_buffer() recursive and add the w and h
parameters to it.
-2009-10-07 - r20189 - lavfi 0.5.1 - AVFilterPic
+2009-10-07 - 46c40e4 - lavfi 0.5.1 - AVFilterPic
Add w and h fields to AVFilterPic.
-2009-06-22 - r19250 - lavf 52.34.1 - AVFormatContext.packet_size
+2009-06-22 - 92400be - lavf 52.34.1 - AVFormatContext.packet_size
This is now an unsigned int instead of a signed int.
-2009-06-19 - r19222 - lavc 52.32.0 - AVSubtitle.pts
+2009-06-19 - a4276ba - lavc 52.32.0 - AVSubtitle.pts
Add a pts field to AVSubtitle which gives the subtitle packet pts
in AV_TIME_BASE. Some subtitle de-/encoders (e.g. XSUB) will
not work right without this.
-2009-06-03 - r19078 - lavc 52.30.2 - AV_PKT_FLAG_KEY
+2009-06-03 - 8f3f2e0 - lavc 52.30.2 - AV_PKT_FLAG_KEY
PKT_FLAG_KEY has been deprecated and will be dropped at the next
major version. Use AV_PKT_FLAG_KEY instead.
-2009-06-01 - r19025 - lavc 52.30.0 - av_lockmgr_register()
+2009-06-01 - f988ce6 - lavc 52.30.0 - av_lockmgr_register()
av_lockmgr_register() can be used to register a callback function
that lavc (and in the future, libraries that depend on lavc) can use
to implement mutexes. The application should provide a callback function
@@ -923,27 +1156,27 @@ API changes, most recent first:
When the lock manager is registered, FFmpeg is guaranteed to behave
correctly in a multi-threaded application.
-2009-04-30 - r18719 - lavc 52.28.0 - av_free_packet()
+2009-04-30 - ce1d9c8 - lavc 52.28.0 - av_free_packet()
av_free_packet() is no longer an inline function. It is now exported.
-2009-04-11 - r18431 - lavc 52.25.0 - deprecate av_destruct_packet_nofree()
+2009-04-11 - 80d403f - lavc 52.25.0 - deprecate av_destruct_packet_nofree()
Please use NULL instead. This has been supported since r16506
(lavf > 52.23.1, lavc > 52.10.0).
-2009-04-07 - r18351 - lavc 52.23.0 - avcodec_decode_video/audio/subtitle
+2009-04-07 - 7a00bba - lavc 52.23.0 - avcodec_decode_video/audio/subtitle
The old decoding functions are deprecated, all new code should use the
new functions avcodec_decode_video2(), avcodec_decode_audio3() and
avcodec_decode_subtitle2(). These new functions take an AVPacket *pkt
argument instead of a const uint8_t *buf / int buf_size pair.
-2009-04-03 - r18321 - lavu 50.3.0 - av_fifo_space()
+2009-04-03 - 7b09db3 - lavu 50.3.0 - av_fifo_space()
Introduce the av_fifo_space() function.
-2009-04-02 - r18317 - lavc 52.23.0 - AVPacket
+2009-04-02 - fabd246 - lavc 52.23.0 - AVPacket
Move AVPacket declaration from libavformat/avformat.h to
libavcodec/avcodec.h.
-2009-03-22 - r18163 - lavu 50.2.0 - RGB32 pixel formats
+2009-03-22 - 6e08ca9 - lavu 50.2.0 - RGB32 pixel formats
Convert the pixel formats PIX_FMT_ARGB, PIX_FMT_RGBA, PIX_FMT_ABGR,
PIX_FMT_BGRA, which were defined as macros, into enum PixelFormat values.
Conversely PIX_FMT_RGB32, PIX_FMT_RGB32_1, PIX_FMT_BGR32 and
@@ -952,17 +1185,17 @@ API changes, most recent first:
Re-sort the enum PixelFormat list accordingly.
This change breaks API/ABI backward compatibility.
-2009-03-22 - r18133 - lavu 50.1.0 - PIX_FMT_RGB5X5 endian variants
+2009-03-22 - f82674e - lavu 50.1.0 - PIX_FMT_RGB5X5 endian variants
Add the enum PixelFormat values:
PIX_FMT_RGB565BE, PIX_FMT_RGB565LE, PIX_FMT_RGB555BE, PIX_FMT_RGB555LE,
PIX_FMT_BGR565BE, PIX_FMT_BGR565LE, PIX_FMT_BGR555BE, PIX_FMT_BGR555LE.
-2009-03-21 - r18116 - lavu 50.0.0 - av_random*
+2009-03-21 - ee6624e - lavu 50.0.0 - av_random*
The Mersenne Twister PRNG implemented through the av_random* functions
was removed. Use the lagged Fibonacci PRNG through the av_lfg* functions
instead.
-2009-03-08 - r17869 - lavu 50.0.0 - AVFifoBuffer
+2009-03-08 - 41dd680 - lavu 50.0.0 - AVFifoBuffer
av_fifo_init, av_fifo_read, av_fifo_write and av_fifo_realloc were dropped
and replaced by av_fifo_alloc, av_fifo_generic_read, av_fifo_generic_write
and av_fifo_realloc2.
@@ -971,7 +1204,7 @@ API changes, most recent first:
The AVFifoBuffer/struct AVFifoBuffer may only be used in an opaque way by
applications, they may not use sizeof() or directly access members.
-2009-03-01 - r17682 - lavf 52.31.0 - Generic metadata API
+2009-03-01 - ec26457 - lavf 52.31.0 - Generic metadata API
Introduce a new metadata API (see av_metadata_get() and friends).
The old API is now deprecated and should not be used anymore. This especially
includes the following structure fields:
diff --git a/gst-libs/ext/libav/doc/Doxyfile b/gst-libs/ext/libav/doc/Doxyfile
new file mode 100644
index 0000000..3b2236c
--- /dev/null
+++ b/gst-libs/ext/libav/doc/Doxyfile
@@ -0,0 +1,1625 @@
+# Doxyfile 1.7.1
+
+# This file describes the settings to be used by the documentation system
+# doxygen (www.doxygen.org) for a project
+#
+# All text after a hash (#) is considered a comment and will be ignored
+# The format is:
+# TAG = value [value, ...]
+# For lists items can also be appended using:
+# TAG += value [value, ...]
+# Values that contain spaces should be placed between quotes (" ")
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+
+# This tag specifies the encoding used for all characters in the config file
+# that follow. The default is UTF-8 which is also the encoding used for all
+# text before the first occurrence of this tag. Doxygen uses libiconv (or the
+# iconv built into libc) for the transcoding. See
+# http://www.gnu.org/software/libiconv for the list of possible encodings.
+
+DOXYFILE_ENCODING = UTF-8
+
+# The PROJECT_NAME tag is a single word (or a sequence of words surrounded
+# by quotes) that should identify the project.
+
+PROJECT_NAME = Libav
+
+# The PROJECT_NUMBER tag can be used to enter a project or revision number.
+# This could be handy for archiving the generated documentation or
+# if some version control system is used.
+
+PROJECT_NUMBER =
+
+# With the PROJECT_LOGO tag one can specify an logo or icon that is included
+# in the documentation. The maximum height of the logo should not exceed 55
+# pixels and the maximum width should not exceed 200 pixels. Doxygen will
+# copy the logo to the output directory.
+PROJECT_LOGO =
+
+# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
+# base path where the generated documentation will be put.
+# If a relative path is entered, it will be relative to the location
+# where doxygen was started. If left blank the current directory will be used.
+
+OUTPUT_DIRECTORY = doc/doxy
+
+# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create
+# 4096 sub-directories (in 2 levels) under the output directory of each output
+# format and will distribute the generated files over these directories.
+# Enabling this option can be useful when feeding doxygen a huge amount of
+# source files, where putting all generated files in the same directory would
+# otherwise cause performance problems for the file system.
+
+CREATE_SUBDIRS = NO
+
+# The OUTPUT_LANGUAGE tag is used to specify the language in which all
+# documentation generated by doxygen is written. Doxygen will use this
+# information to generate all constant output in the proper language.
+# The default language is English, other supported languages are:
+# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional,
+# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German,
+# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English
+# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian,
+# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrilic, Slovak,
+# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese.
+
+OUTPUT_LANGUAGE = English
+
+# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
+# include brief member descriptions after the members that are listed in
+# the file and class documentation (similar to JavaDoc).
+# Set to NO to disable this.
+
+BRIEF_MEMBER_DESC = YES
+
+# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend
+# the brief description of a member or function before the detailed description.
+# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
+# brief descriptions will be completely suppressed.
+
+REPEAT_BRIEF = YES
+
+# This tag implements a quasi-intelligent brief description abbreviator
+# that is used to form the text in various listings. Each string
+# in this list, if found as the leading text of the brief description, will be
+# stripped from the text and the result after processing the whole list, is
+# used as the annotated text. Otherwise, the brief description is used as-is.
+# If left blank, the following values are used ("$name" is automatically
+# replaced with the name of the entity): "The $name class" "The $name widget"
+# "The $name file" "is" "provides" "specifies" "contains"
+# "represents" "a" "an" "the"
+
+ABBREVIATE_BRIEF =
+
+# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
+# Doxygen will generate a detailed section even if there is only a brief
+# description.
+
+ALWAYS_DETAILED_SEC = NO
+
+# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
+# inherited members of a class in the documentation of that class as if those
+# members were ordinary class members. Constructors, destructors and assignment
+# operators of the base classes will not be shown.
+
+INLINE_INHERITED_MEMB = NO
+
+# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full
+# path before files name in the file list and in the header files. If set
+# to NO the shortest path that makes the file name unique will be used.
+
+FULL_PATH_NAMES = YES
+
+# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag
+# can be used to strip a user-defined part of the path. Stripping is
+# only done if one of the specified strings matches the left-hand part of
+# the path. The tag can be used to show relative paths in the file list.
+# If left blank the directory from which doxygen is run is used as the
+# path to strip.
+
+STRIP_FROM_PATH = .
+
+# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of
+# the path mentioned in the documentation of a class, which tells
+# the reader which header file to include in order to use a class.
+# If left blank only the name of the header file containing the class
+# definition is used. Otherwise one should specify the include paths that
+# are normally passed to the compiler using the -I flag.
+
+STRIP_FROM_INC_PATH =
+
+# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter
+# (but less readable) file names. This can be useful is your file systems
+# doesn't support long names like on DOS, Mac, or CD-ROM.
+
+SHORT_NAMES = NO
+
+# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen
+# will interpret the first line (until the first dot) of a JavaDoc-style
+# comment as the brief description. If set to NO, the JavaDoc
+# comments will behave just like regular Qt-style comments
+# (thus requiring an explicit @brief command for a brief description.)
+
+JAVADOC_AUTOBRIEF = YES
+
+# If the QT_AUTOBRIEF tag is set to YES then Doxygen will
+# interpret the first line (until the first dot) of a Qt-style
+# comment as the brief description. If set to NO, the comments
+# will behave just like regular Qt-style comments (thus requiring
+# an explicit \brief command for a brief description.)
+
+QT_AUTOBRIEF = NO
+
+# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen
+# treat a multi-line C++ special comment block (i.e. a block of //! or ///
+# comments) as a brief description. This used to be the default behaviour.
+# The new default is to treat a multi-line C++ comment block as a detailed
+# description. Set this tag to YES if you prefer the old behaviour instead.
+
+MULTILINE_CPP_IS_BRIEF = NO
+
+# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented
+# member inherits the documentation from any documented member that it
+# re-implements.
+
+INHERIT_DOCS = YES
+
+# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce
+# a new page for each member. If set to NO, the documentation of a member will
+# be part of the file/class/namespace that contains it.
+
+SEPARATE_MEMBER_PAGES = NO
+
+# The TAB_SIZE tag can be used to set the number of spaces in a tab.
+# Doxygen uses this value to replace tabs by spaces in code fragments.
+
+TAB_SIZE = 8
+
+# This tag can be used to specify a number of aliases that acts
+# as commands in the documentation. An alias has the form "name=value".
+# For example adding "sideeffect=\par Side Effects:\n" will allow you to
+# put the command \sideeffect (or @sideeffect) in the documentation, which
+# will result in a user-defined paragraph with heading "Side Effects:".
+# You can put \n's in the value part of an alias to insert newlines.
+
+ALIASES =
+
+# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C
+# sources only. Doxygen will then generate output that is more tailored for C.
+# For instance, some of the names that are used will be different. The list
+# of all members will be omitted, etc.
+
+OPTIMIZE_OUTPUT_FOR_C = YES
+
+# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java
+# sources only. Doxygen will then generate output that is more tailored for
+# Java. For instance, namespaces will be presented as packages, qualified
+# scopes will look different, etc.
+
+OPTIMIZE_OUTPUT_JAVA = NO
+
+# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran
+# sources only. Doxygen will then generate output that is more tailored for
+# Fortran.
+
+OPTIMIZE_FOR_FORTRAN = NO
+
+# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL
+# sources. Doxygen will then generate output that is tailored for
+# VHDL.
+
+OPTIMIZE_OUTPUT_VHDL = NO
+
+# Doxygen selects the parser to use depending on the extension of the files it
+# parses. With this tag you can assign which parser to use for a given extension.
+# Doxygen has a built-in mapping, but you can override or extend it using this
+# tag. The format is ext=language, where ext is a file extension, and language
+# is one of the parsers supported by doxygen: IDL, Java, Javascript, CSharp, C,
+# C++, D, PHP, Objective-C, Python, Fortran, VHDL, C, C++. For instance to make
+# doxygen treat .inc files as Fortran files (default is PHP), and .f files as C
+# (default is Fortran), use: inc=Fortran f=C. Note that for custom extensions
+# you also need to set FILE_PATTERNS otherwise the files are not read by doxygen.
+
+EXTENSION_MAPPING =
+
+# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
+# to include (a tag file for) the STL sources as input, then you should
+# set this tag to YES in order to let doxygen match functions declarations and
+# definitions whose arguments contain STL classes (e.g. func(std::string); v.s.
+# func(std::string) {}). This also make the inheritance and collaboration
+# diagrams that involve STL classes more complete and accurate.
+
+BUILTIN_STL_SUPPORT = NO
+
+# If you use Microsoft's C++/CLI language, you should set this option to YES to
+# enable parsing support.
+
+CPP_CLI_SUPPORT = NO
+
+# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only.
+# Doxygen will parse them like normal C++ but will assume all classes use public
+# instead of private inheritance when no explicit protection keyword is present.
+
+SIP_SUPPORT = NO
+
+# For Microsoft's IDL there are propget and propput attributes to indicate getter
+# and setter methods for a property. Setting this option to YES (the default)
+# will make doxygen to replace the get and set methods by a property in the
+# documentation. This will only work if the methods are indeed getting or
+# setting a simple type. If this is not the case, or you want to show the
+# methods anyway, you should set this option to NO.
+
+IDL_PROPERTY_SUPPORT = YES
+
+# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
+# tag is set to YES, then doxygen will reuse the documentation of the first
+# member in the group (if any) for the other members of the group. By default
+# all members of a group must be documented explicitly.
+
+DISTRIBUTE_GROUP_DOC = NO
+
+# Set the SUBGROUPING tag to YES (the default) to allow class member groups of
+# the same type (for instance a group of public functions) to be put as a
+# subgroup of that type (e.g. under the Public Functions section). Set it to
+# NO to prevent subgrouping. Alternatively, this can be done per class using
+# the \nosubgrouping command.
+
+SUBGROUPING = YES
+
+# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum
+# is documented as struct, union, or enum with the name of the typedef. So
+# typedef struct TypeS {} TypeT, will appear in the documentation as a struct
+# with name TypeT. When disabled the typedef will appear as a member of a file,
+# namespace, or class. And the struct will be named TypeS. This can typically
+# be useful for C code in case the coding convention dictates that all compound
+# types are typedef'ed and only the typedef is referenced, never the tag name.
+
+TYPEDEF_HIDES_STRUCT = NO
+
+# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to
+# determine which symbols to keep in memory and which to flush to disk.
+# When the cache is full, less often used symbols will be written to disk.
+# For small to medium size projects (<1000 input files) the default value is
+# probably good enough. For larger projects a too small cache size can cause
+# doxygen to be busy swapping symbols to and from disk most of the time
+# causing a significant performance penality.
+# If the system has enough physical memory increasing the cache will improve the
+# performance by keeping more symbols in memory. Note that the value works on
+# a logarithmic scale so increasing the size by one will roughly double the
+# memory usage. The cache size is given by this formula:
+# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0,
+# corresponding to a cache size of 2^16 = 65536 symbols
+
+SYMBOL_CACHE_SIZE = 0
+
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+
+# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
+# documentation are documented, even if no documentation was available.
+# Private class members and static file members will be hidden unless
+# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
+
+EXTRACT_ALL = YES
+
+# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
+# will be included in the documentation.
+
+EXTRACT_PRIVATE = YES
+
+# If the EXTRACT_STATIC tag is set to YES all static members of a file
+# will be included in the documentation.
+
+EXTRACT_STATIC = YES
+
+# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
+# defined locally in source files will be included in the documentation.
+# If set to NO only classes defined in header files are included.
+
+EXTRACT_LOCAL_CLASSES = YES
+
+# This flag is only useful for Objective-C code. When set to YES local
+# methods, which are defined in the implementation section but not in
+# the interface are included in the documentation.
+# If set to NO (the default) only methods in the interface are included.
+
+EXTRACT_LOCAL_METHODS = NO
+
+# If this flag is set to YES, the members of anonymous namespaces will be
+# extracted and appear in the documentation as a namespace called
+# 'anonymous_namespace{file}', where file will be replaced with the base
+# name of the file that contains the anonymous namespace. By default
+# anonymous namespace are hidden.
+
+EXTRACT_ANON_NSPACES = NO
+
+# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
+# undocumented members of documented classes, files or namespaces.
+# If set to NO (the default) these members will be included in the
+# various overviews, but no documentation section is generated.
+# This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_MEMBERS = NO
+
+# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
+# undocumented classes that are normally visible in the class hierarchy.
+# If set to NO (the default) these classes will be included in the various
+# overviews. This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_CLASSES = NO
+
+# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all
+# friend (class|struct|union) declarations.
+# If set to NO (the default) these declarations will be included in the
+# documentation.
+
+HIDE_FRIEND_COMPOUNDS = NO
+
+# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any
+# documentation blocks found inside the body of a function.
+# If set to NO (the default) these blocks will be appended to the
+# function's detailed documentation block.
+
+HIDE_IN_BODY_DOCS = NO
+
+# The INTERNAL_DOCS tag determines if documentation
+# that is typed after a \internal command is included. If the tag is set
+# to NO (the default) then the documentation will be excluded.
+# Set it to YES to include the internal documentation.
+
+INTERNAL_DOCS = NO
+
+# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate
+# file names in lower-case letters. If set to YES upper-case letters are also
+# allowed. This is useful if you have classes or files whose names only differ
+# in case and if your file system supports case sensitive file names. Windows
+# and Mac users are advised to set this option to NO.
+
+CASE_SENSE_NAMES = YES
+
+# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen
+# will show members with their full class and namespace scopes in the
+# documentation. If set to YES the scope will be hidden.
+
+HIDE_SCOPE_NAMES = NO
+
+# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen
+# will put a list of the files that are included by a file in the documentation
+# of that file.
+
+SHOW_INCLUDE_FILES = YES
+
+# If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen
+# will list include files with double quotes in the documentation
+# rather than with sharp brackets.
+
+FORCE_LOCAL_INCLUDES = NO
+
+# If the INLINE_INFO tag is set to YES (the default) then a tag [inline]
+# is inserted in the documentation for inline members.
+
+INLINE_INFO = YES
+
+# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen
+# will sort the (detailed) documentation of file and class members
+# alphabetically by member name. If set to NO the members will appear in
+# declaration order.
+
+SORT_MEMBER_DOCS = YES
+
+# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the
+# brief documentation of file, namespace and class members alphabetically
+# by member name. If set to NO (the default) the members will appear in
+# declaration order.
+
+SORT_BRIEF_DOCS = NO
+
+# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen
+# will sort the (brief and detailed) documentation of class members so that
+# constructors and destructors are listed first. If set to NO (the default)
+# the constructors will appear in the respective orders defined by
+# SORT_MEMBER_DOCS and SORT_BRIEF_DOCS.
+# This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO
+# and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO.
+
+SORT_MEMBERS_CTORS_1ST = NO
+
+# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the
+# hierarchy of group names into alphabetical order. If set to NO (the default)
+# the group names will appear in their defined order.
+
+SORT_GROUP_NAMES = NO
+
+# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be
+# sorted by fully-qualified names, including namespaces. If set to
+# NO (the default), the class list will be sorted only by class name,
+# not including the namespace part.
+# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
+# Note: This option applies only to the class list, not to the
+# alphabetical list.
+
+SORT_BY_SCOPE_NAME = NO
+
+# The GENERATE_TODOLIST tag can be used to enable (YES) or
+# disable (NO) the todo list. This list is created by putting \todo
+# commands in the documentation.
+
+GENERATE_TODOLIST = YES
+
+# The GENERATE_TESTLIST tag can be used to enable (YES) or
+# disable (NO) the test list. This list is created by putting \test
+# commands in the documentation.
+
+GENERATE_TESTLIST = YES
+
+# The GENERATE_BUGLIST tag can be used to enable (YES) or
+# disable (NO) the bug list. This list is created by putting \bug
+# commands in the documentation.
+
+GENERATE_BUGLIST = YES
+
+# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or
+# disable (NO) the deprecated list. This list is created by putting
+# \deprecated commands in the documentation.
+
+GENERATE_DEPRECATEDLIST= YES
+
+# The ENABLED_SECTIONS tag can be used to enable conditional
+# documentation sections, marked by \if sectionname ... \endif.
+
+ENABLED_SECTIONS =
+
+# The MAX_INITIALIZER_LINES tag determines the maximum number of lines
+# the initial value of a variable or define consists of for it to appear in
+# the documentation. If the initializer consists of more lines than specified
+# here it will be hidden. Use a value of 0 to hide initializers completely.
+# The appearance of the initializer of individual variables and defines in the
+# documentation can be controlled using \showinitializer or \hideinitializer
+# command in the documentation regardless of this setting.
+
+MAX_INITIALIZER_LINES = 30
+
+# Set the SHOW_USED_FILES tag to NO to disable the list of files generated
+# at the bottom of the documentation of classes and structs. If set to YES the
+# list will mention the files that were used to generate the documentation.
+
+SHOW_USED_FILES = YES
+
+# Set the SHOW_FILES tag to NO to disable the generation of the Files page.
+# This will remove the Files entry from the Quick Index and from the
+# Folder Tree View (if specified). The default is YES.
+
+SHOW_FILES = YES
+
+# Set the SHOW_NAMESPACES tag to NO to disable the generation of the
+# Namespaces page.
+# This will remove the Namespaces entry from the Quick Index
+# and from the Folder Tree View (if specified). The default is YES.
+
+SHOW_NAMESPACES = YES
+
+# The FILE_VERSION_FILTER tag can be used to specify a program or script that
+# doxygen should invoke to get the current version for each file (typically from
+# the version control system). Doxygen will invoke the program by executing (via
+# popen()) the command <command> <input-file>, where <command> is the value of
+# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file
+# provided by doxygen. Whatever the program writes to standard output
+# is used as the file version. See the manual for examples.
+
+FILE_VERSION_FILTER =
+
+# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed
+# by doxygen. The layout file controls the global structure of the generated
+# output files in an output format independent way. The create the layout file
+# that represents doxygen's defaults, run doxygen with the -l option.
+# You can optionally specify a file name after the option, if omitted
+# DoxygenLayout.xml will be used as the name of the layout file.
+
+LAYOUT_FILE =
+
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+
+# The QUIET tag can be used to turn on/off the messages that are generated
+# by doxygen. Possible values are YES and NO. If left blank NO is used.
+
+QUIET = YES
+
+# The WARNINGS tag can be used to turn on/off the warning messages that are
+# generated by doxygen. Possible values are YES and NO. If left blank
+# NO is used.
+
+WARNINGS = YES
+
+# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings
+# for undocumented members. If EXTRACT_ALL is set to YES then this flag will
+# automatically be disabled.
+
+WARN_IF_UNDOCUMENTED = YES
+
+# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for
+# potential errors in the documentation, such as not documenting some
+# parameters in a documented function, or documenting parameters that
+# don't exist or using markup commands wrongly.
+
+WARN_IF_DOC_ERROR = YES
+
+# This WARN_NO_PARAMDOC option can be abled to get warnings for
+# functions that are documented, but have no documentation for their parameters
+# or return value. If set to NO (the default) doxygen will only warn about
+# wrong or incomplete parameter documentation, but not about the absence of
+# documentation.
+
+WARN_NO_PARAMDOC = NO
+
+# The WARN_FORMAT tag determines the format of the warning messages that
+# doxygen can produce. The string should contain the $file, $line, and $text
+# tags, which will be replaced by the file and line number from which the
+# warning originated and the warning text. Optionally the format may contain
+# $version, which will be replaced by the version of the file (if it could
+# be obtained via FILE_VERSION_FILTER)
+
+WARN_FORMAT = "$file:$line: $text"
+
+# The WARN_LOGFILE tag can be used to specify a file to which warning
+# and error messages should be written. If left blank the output is written
+# to stderr.
+
+WARN_LOGFILE =
+
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+
+# The INPUT tag can be used to specify the files and/or directories that contain
+# documented source files. You may enter file names like "myfile.cpp" or
+# directories like "/usr/src/myproject". Separate the files or directories
+# with spaces.
+
+INPUT =
+
+# This tag can be used to specify the character encoding of the source files
+# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
+# also the default input encoding. Doxygen uses libiconv (or the iconv built
+# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for
+# the list of possible encodings.
+
+INPUT_ENCODING = UTF-8
+
+# If the value of the INPUT tag contains directories, you can use the
+# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
+# and *.h) to filter out the source-files in the directories. If left
+# blank the following patterns are tested:
+# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx
+# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90
+
+FILE_PATTERNS =
+
+# The RECURSIVE tag can be used to turn specify whether or not subdirectories
+# should be searched for input files as well. Possible values are YES and NO.
+# If left blank NO is used.
+
+RECURSIVE = YES
+
+# The EXCLUDE tag can be used to specify files and/or directories that should
+# excluded from the INPUT source files. This way you can easily exclude a
+# subdirectory from a directory tree whose root is specified with the INPUT tag.
+
+EXCLUDE =
+
+# The EXCLUDE_SYMLINKS tag can be used select whether or not files or
+# directories that are symbolic links (a Unix filesystem feature) are excluded
+# from the input.
+
+EXCLUDE_SYMLINKS = NO
+
+# If the value of the INPUT tag contains directories, you can use the
+# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
+# certain files from those directories. Note that the wildcards are matched
+# against the file with absolute path, so to exclude all test directories
+# for example use the pattern */test/*
+
+EXCLUDE_PATTERNS = *.git \
+ *.d
+
+# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
+# (namespaces, classes, functions, etc.) that should be excluded from the
+# output. The symbol name can be a fully qualified name, a word, or if the
+# wildcard * is used, a substring. Examples: ANamespace, AClass,
+# AClass::ANamespace, ANamespace::*Test
+
+EXCLUDE_SYMBOLS =
+
+# The EXAMPLE_PATH tag can be used to specify one or more files or
+# directories that contain example code fragments that are included (see
+# the \include command).
+
+EXAMPLE_PATH = libavcodec/ \
+ libavformat/
+
+# If the value of the EXAMPLE_PATH tag contains directories, you can use the
+# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
+# and *.h) to filter out the source-files in the directories. If left
+# blank all files are included.
+
+EXAMPLE_PATTERNS = *-example.c
+
+# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
+# searched for input files to be used with the \include or \dontinclude
+# commands irrespective of the value of the RECURSIVE tag.
+# Possible values are YES and NO. If left blank NO is used.
+
+EXAMPLE_RECURSIVE = NO
+
+# The IMAGE_PATH tag can be used to specify one or more files or
+# directories that contain image that are included in the documentation (see
+# the \image command).
+
+IMAGE_PATH =
+
+# The INPUT_FILTER tag can be used to specify a program that doxygen should
+# invoke to filter for each input file. Doxygen will invoke the filter program
+# by executing (via popen()) the command <filter> <input-file>, where <filter>
+# is the value of the INPUT_FILTER tag, and <input-file> is the name of an
+# input file. Doxygen will then use the output that the filter program writes
+# to standard output.
+# If FILTER_PATTERNS is specified, this tag will be
+# ignored.
+
+INPUT_FILTER =
+
+# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
+# basis.
+# Doxygen will compare the file name with each pattern and apply the
+# filter if there is a match.
+# The filters are a list of the form:
+# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further
+# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER
+# is applied to all files.
+
+FILTER_PATTERNS =
+
+# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
+# INPUT_FILTER) will be used to filter the input files when producing source
+# files to browse (i.e. when SOURCE_BROWSER is set to YES).
+
+FILTER_SOURCE_FILES = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+
+# If the SOURCE_BROWSER tag is set to YES then a list of source files will
+# be generated. Documented entities will be cross-referenced with these sources.
+# Note: To get rid of all source code in the generated output, make sure also
+# VERBATIM_HEADERS is set to NO.
+
+SOURCE_BROWSER = YES
+
+# Setting the INLINE_SOURCES tag to YES will include the body
+# of functions and classes directly in the documentation.
+
+INLINE_SOURCES = NO
+
+# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct
+# doxygen to hide any special comment blocks from generated source code
+# fragments. Normal C and C++ comments will always remain visible.
+
+STRIP_CODE_COMMENTS = YES
+
+# If the REFERENCED_BY_RELATION tag is set to YES
+# then for each documented function all documented
+# functions referencing it will be listed.
+
+REFERENCED_BY_RELATION = YES
+
+# If the REFERENCES_RELATION tag is set to YES
+# then for each documented function all documented entities
+# called/used by that function will be listed.
+
+REFERENCES_RELATION = NO
+
+# If the REFERENCES_LINK_SOURCE tag is set to YES (the default)
+# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from
+# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will
+# link to the source code.
+# Otherwise they will link to the documentation.
+
+REFERENCES_LINK_SOURCE = YES
+
+# If the USE_HTAGS tag is set to YES then the references to source code
+# will point to the HTML generated by the htags(1) tool instead of doxygen
+# built-in source browser. The htags tool is part of GNU's global source
+# tagging system (see http://www.gnu.org/software/global/global.html). You
+# will need version 4.8.6 or higher.
+
+USE_HTAGS = NO
+
+# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen
+# will generate a verbatim copy of the header file for each class for
+# which an include is specified. Set to NO to disable this.
+
+VERBATIM_HEADERS = YES
+
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+
+# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index
+# of all compounds will be generated. Enable this if the project
+# contains a lot of classes, structs, unions or interfaces.
+
+ALPHABETICAL_INDEX = YES
+
+# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then
+# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns
+# in which this list will be split (can be a number in the range [1..20])
+
+COLS_IN_ALPHA_INDEX = 2
+
+# In case all classes in a project start with a common prefix, all
+# classes will be put under the same header in the alphabetical index.
+# The IGNORE_PREFIX tag can be used to specify one or more prefixes that
+# should be ignored while generating the index headers.
+
+IGNORE_PREFIX =
+
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_HTML tag is set to YES (the default) Doxygen will
+# generate HTML output.
+
+GENERATE_HTML = YES
+
+# The HTML_OUTPUT tag is used to specify where the HTML docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `html' will be used as the default path.
+
+HTML_OUTPUT = html
+
+# The HTML_FILE_EXTENSION tag can be used to specify the file extension for
+# each generated HTML page (for example: .htm,.php,.asp). If it is left blank
+# doxygen will generate files with .html extension.
+
+HTML_FILE_EXTENSION = .html
+
+# The HTML_HEADER tag can be used to specify a personal HTML header for
+# each generated HTML page. If it is left blank doxygen will generate a
+# standard header.
+
+HTML_HEADER = doc/doxy/header.html
+
+# The HTML_FOOTER tag can be used to specify a personal HTML footer for
+# each generated HTML page. If it is left blank doxygen will generate a
+# standard footer.
+
+HTML_FOOTER = doc/doxy/footer.html
+
+# The HTML_STYLESHEET tag can be used to specify a user-defined cascading
+# style sheet that is used by each HTML page. It can be used to
+# fine-tune the look of the HTML output. If the tag is left blank doxygen
+# will generate a default style sheet. Note that doxygen will try to copy
+# the style sheet file to the HTML output directory, so don't put your own
+# stylesheet in the HTML output directory as well, or it will be erased!
+
+HTML_STYLESHEET = doc/doxy/doxy_stylesheet.css
+
+# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output.
+# Doxygen will adjust the colors in the stylesheet and background images
+# according to this color. Hue is specified as an angle on a colorwheel,
+# see http://en.wikipedia.org/wiki/Hue for more information.
+# For instance the value 0 represents red, 60 is yellow, 120 is green,
+# 180 is cyan, 240 is blue, 300 purple, and 360 is red again.
+# The allowed range is 0 to 359.
+
+HTML_COLORSTYLE_HUE = 120
+
+# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of
+# the colors in the HTML output. For a value of 0 the output will use
+# grayscales only. A value of 255 will produce the most vivid colors.
+
+HTML_COLORSTYLE_SAT = 100
+
+# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to
+# the luminance component of the colors in the HTML output. Values below
+# 100 gradually make the output lighter, whereas values above 100 make
+# the output darker. The value divided by 100 is the actual gamma applied,
+# so 80 represents a gamma of 0.8, The value 220 represents a gamma of 2.2,
+# and 100 does not change the gamma.
+
+HTML_COLORSTYLE_GAMMA = 80
+
+# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML
+# page will contain the date and time when the page was generated. Setting
+# this to NO can help when comparing the output of multiple runs.
+
+HTML_TIMESTAMP = YES
+
+# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
+# documentation will contain sections that can be hidden and shown after the
+# page has loaded. For this to work a browser that supports
+# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox
+# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari).
+
+HTML_DYNAMIC_SECTIONS = NO
+
+# If the GENERATE_DOCSET tag is set to YES, additional index files
+# will be generated that can be used as input for Apple's Xcode 3
+# integrated development environment, introduced with OS X 10.5 (Leopard).
+# To create a documentation set, doxygen will generate a Makefile in the
+# HTML output directory. Running make will produce the docset in that
+# directory and running "make install" will install the docset in
+# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find
+# it at startup.
+# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html
+# for more information.
+
+GENERATE_DOCSET = NO
+
+# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the
+# feed. A documentation feed provides an umbrella under which multiple
+# documentation sets from a single provider (such as a company or product suite)
+# can be grouped.
+
+DOCSET_FEEDNAME = "Doxygen generated docs"
+
+# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that
+# should uniquely identify the documentation set bundle. This should be a
+# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen
+# will append .docset to the name.
+
+DOCSET_BUNDLE_ID = org.doxygen.Project
+
+# When GENERATE_PUBLISHER_ID tag specifies a string that should uniquely identify
+# the documentation publisher. This should be a reverse domain-name style
+# string, e.g. com.mycompany.MyDocSet.documentation.
+
+DOCSET_PUBLISHER_ID = org.doxygen.Publisher
+
+# The GENERATE_PUBLISHER_NAME tag identifies the documentation publisher.
+
+DOCSET_PUBLISHER_NAME = Publisher
+
+# If the GENERATE_HTMLHELP tag is set to YES, additional index files
+# will be generated that can be used as input for tools like the
+# Microsoft HTML help workshop to generate a compiled HTML help file (.chm)
+# of the generated HTML documentation.
+
+GENERATE_HTMLHELP = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can
+# be used to specify the file name of the resulting .chm file. You
+# can add a path in front of the file if the result should not be
+# written to the html output directory.
+
+CHM_FILE =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can
+# be used to specify the location (absolute path including file name) of
+# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run
+# the HTML help compiler on the generated index.hhp.
+
+HHC_LOCATION =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag
+# controls if a separate .chi index file is generated (YES) or that
+# it should be included in the master .chm file (NO).
+
+GENERATE_CHI = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING
+# is used to encode HtmlHelp index (hhk), content (hhc) and project file
+# content.
+
+CHM_INDEX_ENCODING =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag
+# controls whether a binary table of contents is generated (YES) or a
+# normal table of contents (NO) in the .chm file.
+
+BINARY_TOC = NO
+
+# The TOC_EXPAND flag can be set to YES to add extra items for group members
+# to the contents of the HTML help documentation and to the tree view.
+
+TOC_EXPAND = NO
+
+# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and
+# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated
+# that can be used as input for Qt's qhelpgenerator to generate a
+# Qt Compressed Help (.qch) of the generated HTML documentation.
+
+GENERATE_QHP = NO
+
+# If the QHG_LOCATION tag is specified, the QCH_FILE tag can
+# be used to specify the file name of the resulting .qch file.
+# The path specified is relative to the HTML output folder.
+
+QCH_FILE =
+
+# The QHP_NAMESPACE tag specifies the namespace to use when generating
+# Qt Help Project output. For more information please see
+# http://doc.trolltech.com/qthelpproject.html#namespace
+
+QHP_NAMESPACE = org.doxygen.Project
+
+# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating
+# Qt Help Project output. For more information please see
+# http://doc.trolltech.com/qthelpproject.html#virtual-folders
+
+QHP_VIRTUAL_FOLDER = doc
+
+# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to
+# add. For more information please see
+# http://doc.trolltech.com/qthelpproject.html#custom-filters
+
+QHP_CUST_FILTER_NAME =
+
+# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the
+# custom filter to add. For more information please see
+# <a href="http://doc.trolltech.com/qthelpproject.html#custom-filters">
+# Qt Help Project / Custom Filters</a>.
+
+QHP_CUST_FILTER_ATTRS =
+
+# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this
+# project's
+# filter section matches.
+# <a href="http://doc.trolltech.com/qthelpproject.html#filter-attributes">
+# Qt Help Project / Filter Attributes</a>.
+
+QHP_SECT_FILTER_ATTRS =
+
+# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can
+# be used to specify the location of Qt's qhelpgenerator.
+# If non-empty doxygen will try to run qhelpgenerator on the generated
+# .qhp file.
+
+QHG_LOCATION =
+
+# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files
+# will be generated, which together with the HTML files, form an Eclipse help
+# plugin. To install this plugin and make it available under the help contents
+# menu in Eclipse, the contents of the directory containing the HTML and XML
+# files needs to be copied into the plugins directory of eclipse. The name of
+# the directory within the plugins directory should be the same as
+# the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before
+# the help appears.
+
+GENERATE_ECLIPSEHELP = NO
+
+# A unique identifier for the eclipse help plugin. When installing the plugin
+# the directory name containing the HTML and XML files should also have
+# this name.
+
+ECLIPSE_DOC_ID = org.doxygen.Project
+
+# The DISABLE_INDEX tag can be used to turn on/off the condensed index at
+# top of each HTML page. The value NO (the default) enables the index and
+# the value YES disables it.
+
+DISABLE_INDEX = NO
+
+# This tag can be used to set the number of enum values (range [1..20])
+# that doxygen will group on one line in the generated HTML documentation.
+
+ENUM_VALUES_PER_LINE = 4
+
+# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
+# structure should be generated to display hierarchical information.
+# If the tag value is set to YES, a side panel will be generated
+# containing a tree-like index structure (just like the one that
+# is generated for HTML Help). For this to work a browser that supports
+# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser).
+# Windows users are probably better off using the HTML help feature.
+
+GENERATE_TREEVIEW = NO
+
+# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be
+# used to set the initial width (in pixels) of the frame in which the tree
+# is shown.
+
+TREEVIEW_WIDTH = 250
+
+# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open
+# links to external symbols imported via tag files in a separate window.
+
+EXT_LINKS_IN_WINDOW = NO
+
+# Use this tag to change the font size of Latex formulas included
+# as images in the HTML documentation. The default is 10. Note that
+# when you change the font size after a successful doxygen run you need
+# to manually remove any form_*.png images from the HTML output directory
+# to force them to be regenerated.
+
+FORMULA_FONTSIZE = 10
+
+# Use the FORMULA_TRANPARENT tag to determine whether or not the images
+# generated for formulas are transparent PNGs. Transparent PNGs are
+# not supported properly for IE 6.0, but are supported on all modern browsers.
+# Note that when changing this option you need to delete any form_*.png files
+# in the HTML output before the changes have effect.
+
+FORMULA_TRANSPARENT = YES
+
+# When the SEARCHENGINE tag is enabled doxygen will generate a search box
+# for the HTML output. The underlying search engine uses javascript
+# and DHTML and should work on any modern browser. Note that when using
+# HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets
+# (GENERATE_DOCSET) there is already a search function so this one should
+# typically be disabled. For large projects the javascript based search engine
+# can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution.
+
+SEARCHENGINE = NO
+
+# When the SERVER_BASED_SEARCH tag is enabled the search engine will be
+# implemented using a PHP enabled web server instead of at the web client
+# using Javascript. Doxygen will generate the search PHP script and index
+# file to put on the web server. The advantage of the server
+# based approach is that it scales better to large projects and allows
+# full text search. The disadvances is that it is more difficult to setup
+# and does not have live searching capabilities.
+
+SERVER_BASED_SEARCH = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
+# generate Latex output.
+
+GENERATE_LATEX = NO
+
+# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `latex' will be used as the default path.
+
+LATEX_OUTPUT = latex
+
+# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
+# invoked. If left blank `latex' will be used as the default command name.
+# Note that when enabling USE_PDFLATEX this option is only used for
+# generating bitmaps for formulas in the HTML output, but not in the
+# Makefile that is written to the output directory.
+
+LATEX_CMD_NAME = latex
+
+# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to
+# generate index for LaTeX. If left blank `makeindex' will be used as the
+# default command name.
+
+MAKEINDEX_CMD_NAME = makeindex
+
+# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact
+# LaTeX documents. This may be useful for small projects and may help to
+# save some trees in general.
+
+COMPACT_LATEX = NO
+
+# The PAPER_TYPE tag can be used to set the paper type that is used
+# by the printer. Possible values are: a4, a4wide, letter, legal and
+# executive. If left blank a4wide will be used.
+
+PAPER_TYPE = a4wide
+
+# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX
+# packages that should be included in the LaTeX output.
+
+EXTRA_PACKAGES =
+
+# The LATEX_HEADER tag can be used to specify a personal LaTeX header for
+# the generated latex document. The header should contain everything until
+# the first chapter. If it is left blank doxygen will generate a
+# standard header. Notice: only use this tag if you know what you are doing!
+
+LATEX_HEADER =
+
+# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated
+# is prepared for conversion to pdf (using ps2pdf). The pdf file will
+# contain links (just like the HTML output) instead of page references
+# This makes the output suitable for online browsing using a pdf viewer.
+
+PDF_HYPERLINKS = NO
+
+# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of
+# plain latex in the generated Makefile. Set this option to YES to get a
+# higher quality PDF documentation.
+
+USE_PDFLATEX = NO
+
+# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode.
+# command to the generated LaTeX files. This will instruct LaTeX to keep
+# running if errors occur, instead of asking the user for help.
+# This option is also used when generating formulas in HTML.
+
+LATEX_BATCHMODE = NO
+
+# If LATEX_HIDE_INDICES is set to YES then doxygen will not
+# include the index chapters (such as File Index, Compound Index, etc.)
+# in the output.
+
+LATEX_HIDE_INDICES = NO
+
+# If LATEX_SOURCE_CODE is set to YES then doxygen will include
+# source code with syntax highlighting in the LaTeX output.
+# Note that which sources are shown also depends on other settings
+# such as SOURCE_BROWSER.
+
+LATEX_SOURCE_CODE = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output
+# The RTF output is optimized for Word 97 and may not look very pretty with
+# other RTF readers or editors.
+
+GENERATE_RTF = NO
+
+# The RTF_OUTPUT tag is used to specify where the RTF docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `rtf' will be used as the default path.
+
+RTF_OUTPUT = rtf
+
+# If the COMPACT_RTF tag is set to YES Doxygen generates more compact
+# RTF documents. This may be useful for small projects and may help to
+# save some trees in general.
+
+COMPACT_RTF = NO
+
+# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated
+# will contain hyperlink fields. The RTF file will
+# contain links (just like the HTML output) instead of page references.
+# This makes the output suitable for online browsing using WORD or other
+# programs which support those fields.
+# Note: wordpad (write) and others do not support links.
+
+RTF_HYPERLINKS = NO
+
+# Load stylesheet definitions from file. Syntax is similar to doxygen's
+# config file, i.e. a series of assignments. You only have to provide
+# replacements, missing definitions are set to their default value.
+
+RTF_STYLESHEET_FILE =
+
+# Set optional variables used in the generation of an rtf document.
+# Syntax is similar to doxygen's config file.
+
+RTF_EXTENSIONS_FILE =
+
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_MAN tag is set to YES (the default) Doxygen will
+# generate man pages
+
+GENERATE_MAN = NO
+
+# The MAN_OUTPUT tag is used to specify where the man pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `man' will be used as the default path.
+
+MAN_OUTPUT = man
+
+# The MAN_EXTENSION tag determines the extension that is added to
+# the generated man pages (default is the subroutine's section .3)
+
+MAN_EXTENSION = .3
+
+# If the MAN_LINKS tag is set to YES and Doxygen generates man output,
+# then it will generate one additional man file for each entity
+# documented in the real man page(s). These additional files
+# only source the real man page, but without them the man command
+# would be unable to find the correct page. The default is NO.
+
+MAN_LINKS = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_XML tag is set to YES Doxygen will
+# generate an XML file that captures the structure of
+# the code including all documentation.
+
+GENERATE_XML = NO
+
+# The XML_OUTPUT tag is used to specify where the XML pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `xml' will be used as the default path.
+
+XML_OUTPUT = xml
+
+# The XML_SCHEMA tag can be used to specify an XML schema,
+# which can be used by a validating XML parser to check the
+# syntax of the XML files.
+
+XML_SCHEMA =
+
+# The XML_DTD tag can be used to specify an XML DTD,
+# which can be used by a validating XML parser to check the
+# syntax of the XML files.
+
+XML_DTD =
+
+# If the XML_PROGRAMLISTING tag is set to YES Doxygen will
+# dump the program listings (including syntax highlighting
+# and cross-referencing information) to the XML output. Note that
+# enabling this will significantly increase the size of the XML output.
+
+XML_PROGRAMLISTING = YES
+
+#---------------------------------------------------------------------------
+# configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will
+# generate an AutoGen Definitions (see autogen.sf.net) file
+# that captures the structure of the code including all
+# documentation. Note that this feature is still experimental
+# and incomplete at the moment.
+
+GENERATE_AUTOGEN_DEF = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_PERLMOD tag is set to YES Doxygen will
+# generate a Perl module file that captures the structure of
+# the code including all documentation. Note that this
+# feature is still experimental and incomplete at the
+# moment.
+
+GENERATE_PERLMOD = NO
+
+# If the PERLMOD_LATEX tag is set to YES Doxygen will generate
+# the necessary Makefile rules, Perl scripts and LaTeX code to be able
+# to generate PDF and DVI output from the Perl module output.
+
+PERLMOD_LATEX = NO
+
+# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be
+# nicely formatted so it can be parsed by a human reader.
+# This is useful
+# if you want to understand what is going on.
+# On the other hand, if this
+# tag is set to NO the size of the Perl module output will be much smaller
+# and Perl will parse it just the same.
+
+PERLMOD_PRETTY = YES
+
+# The names of the make variables in the generated doxyrules.make file
+# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX.
+# This is useful so different doxyrules.make files included by the same
+# Makefile don't overwrite each other's variables.
+
+PERLMOD_MAKEVAR_PREFIX =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor
+#---------------------------------------------------------------------------
+
+# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will
+# evaluate all C-preprocessor directives found in the sources and include
+# files.
+
+ENABLE_PREPROCESSING = YES
+
+# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro
+# names in the source code. If set to NO (the default) only conditional
+# compilation will be performed. Macro expansion can be done in a controlled
+# way by setting EXPAND_ONLY_PREDEF to YES.
+
+MACRO_EXPANSION = YES
+
+# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
+# then the macro expansion is limited to the macros specified with the
+# PREDEFINED and EXPAND_AS_DEFINED tags.
+
+EXPAND_ONLY_PREDEF = YES
+
+# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
+# in the INCLUDE_PATH (see below) will be search if a #include is found.
+
+SEARCH_INCLUDES = YES
+
+# The INCLUDE_PATH tag can be used to specify one or more directories that
+# contain include files that are not input files but should be processed by
+# the preprocessor.
+
+INCLUDE_PATH =
+
+# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
+# patterns (like *.h and *.hpp) to filter out the header-files in the
+# directories. If left blank, the patterns specified with FILE_PATTERNS will
+# be used.
+
+INCLUDE_FILE_PATTERNS =
+
+# The PREDEFINED tag can be used to specify one or more macro names that
+# are defined before the preprocessor is started (similar to the -D option of
+# gcc). The argument of the tag is a list of macros of the form: name
+# or name=definition (no spaces). If the definition and the = are
+# omitted =1 is assumed. To prevent a macro definition from being
+# undefined via #undef or recursively expanded use the := operator
+# instead of the = operator.
+
+PREDEFINED = "__attribute__(x)=" \
+ "DECLARE_ALIGNED(a,t,n)=t n" \
+ "offsetof(x,y)=0x42" \
+ av_alloc_size \
+
+# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
+# this tag can be used to specify a list of macro names that should be expanded.
+# The macro definition that is found in the sources will be used.
+# Use the PREDEFINED tag if you want to use a different macro definition.
+
+EXPAND_AS_DEFINED = declare_idct \
+ READ_PAR_DATA \
+
+# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then
+# doxygen's preprocessor will remove all function-like macros that are alone
+# on a line, have an all uppercase name, and do not end with a semicolon. Such
+# function macros are typically used for boiler-plate code, and will confuse
+# the parser if not removed.
+
+SKIP_FUNCTION_MACROS = YES
+
+#---------------------------------------------------------------------------
+# Configuration::additions related to external references
+#---------------------------------------------------------------------------
+
+# The TAGFILES option can be used to specify one or more tagfiles.
+# Optionally an initial location of the external documentation
+# can be added for each tagfile. The format of a tag file without
+# this location is as follows:
+#
+# TAGFILES = file1 file2 ...
+# Adding location for the tag files is done as follows:
+#
+# TAGFILES = file1=loc1 "file2 = loc2" ...
+# where "loc1" and "loc2" can be relative or absolute paths or
+# URLs. If a location is present for each tag, the installdox tool
+# does not have to be run to correct the links.
+# Note that each tag file must have a unique name
+# (where the name does NOT include the path)
+# If a tag file is not located in the directory in which doxygen
+# is run, you must also specify the path to the tagfile here.
+
+TAGFILES =
+
+# When a file name is specified after GENERATE_TAGFILE, doxygen will create
+# a tag file that is based on the input files it reads.
+
+GENERATE_TAGFILE =
+
+# If the ALLEXTERNALS tag is set to YES all external classes will be listed
+# in the class index. If set to NO only the inherited external classes
+# will be listed.
+
+ALLEXTERNALS = NO
+
+# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed
+# in the modules index. If set to NO, only the current project's groups will
+# be listed.
+
+EXTERNAL_GROUPS = YES
+
+# The PERL_PATH should be the absolute path and name of the perl script
+# interpreter (i.e. the result of `which perl').
+
+PERL_PATH = /usr/bin/perl
+
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool
+#---------------------------------------------------------------------------
+
+# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will
+# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base
+# or super classes. Setting the tag to NO turns the diagrams off. Note that
+# this option is superseded by the HAVE_DOT option below. This is only a
+# fallback. It is recommended to install and use dot, since it yields more
+# powerful graphs.
+
+CLASS_DIAGRAMS = YES
+
+# You can define message sequence charts within doxygen comments using the \msc
+# command. Doxygen will then run the mscgen tool (see
+# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the
+# documentation. The MSCGEN_PATH tag allows you to specify the directory where
+# the mscgen tool resides. If left empty the tool is assumed to be found in the
+# default search path.
+
+MSCGEN_PATH =
+
+# If set to YES, the inheritance and collaboration graphs will hide
+# inheritance and usage relations if the target is undocumented
+# or is not a class.
+
+HIDE_UNDOC_RELATIONS = YES
+
+# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
+# available from the path. This tool is part of Graphviz, a graph visualization
+# toolkit from AT&T and Lucent Bell Labs. The other options in this section
+# have no effect if this option is set to NO (the default)
+
+HAVE_DOT = NO
+
+# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is
+# allowed to run in parallel. When set to 0 (the default) doxygen will
+# base this on the number of processors available in the system. You can set it
+# explicitly to a value larger than 0 to get control over the balance
+# between CPU load and processing speed.
+
+DOT_NUM_THREADS = 0
+
+# By default doxygen will write a font called FreeSans.ttf to the output
+# directory and reference it in all dot files that doxygen generates. This
+# font does not include all possible unicode characters however, so when you need
+# these (or just want a differently looking font) you can specify the font name
+# using DOT_FONTNAME. You need need to make sure dot is able to find the font,
+# which can be done by putting it in a standard location or by setting the
+# DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory
+# containing the font.
+
+DOT_FONTNAME = FreeSans
+
+# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs.
+# The default size is 10pt.
+
+DOT_FONTSIZE = 10
+
+# By default doxygen will tell dot to use the output directory to look for the
+# FreeSans.ttf font (which doxygen will put there itself). If you specify a
+# different font using DOT_FONTNAME you can set the path where dot
+# can find it using this tag.
+
+DOT_FONTPATH =
+
+# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for each documented class showing the direct and
+# indirect inheritance relations. Setting this tag to YES will force the
+# the CLASS_DIAGRAMS tag to NO.
+
+CLASS_GRAPH = YES
+
+# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for each documented class showing the direct and
+# indirect implementation dependencies (inheritance, containment, and
+# class references variables) of the class with other documented classes.
+
+COLLABORATION_GRAPH = YES
+
+# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for groups, showing the direct groups dependencies
+
+GROUP_GRAPHS = YES
+
+# If the UML_LOOK tag is set to YES doxygen will generate inheritance and
+# collaboration diagrams in a style similar to the OMG's Unified Modeling
+# Language.
+
+UML_LOOK = NO
+
+# If set to YES, the inheritance and collaboration graphs will show the
+# relations between templates and their instances.
+
+TEMPLATE_RELATIONS = YES
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT
+# tags are set to YES then doxygen will generate a graph for each documented
+# file showing the direct and indirect include dependencies of the file with
+# other documented files.
+
+INCLUDE_GRAPH = YES
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and
+# HAVE_DOT tags are set to YES then doxygen will generate a graph for each
+# documented header file showing the documented files that directly or
+# indirectly include this file.
+
+INCLUDED_BY_GRAPH = YES
+
+# If the CALL_GRAPH and HAVE_DOT options are set to YES then
+# doxygen will generate a call dependency graph for every global function
+# or class method. Note that enabling this option will significantly increase
+# the time of a run. So in most cases it will be better to enable call graphs
+# for selected functions only using the \callgraph command.
+
+CALL_GRAPH = NO
+
+# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then
+# doxygen will generate a caller dependency graph for every global function
+# or class method. Note that enabling this option will significantly increase
+# the time of a run. So in most cases it will be better to enable caller
+# graphs for selected functions only using the \callergraph command.
+
+CALLER_GRAPH = NO
+
+# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
+# will graphical hierarchy of all classes instead of a textual one.
+
+GRAPHICAL_HIERARCHY = YES
+
+# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES
+# then doxygen will show the dependencies a directory has on other directories
+# in a graphical way. The dependency relations are determined by the #include
+# relations between the files in the directories.
+
+DIRECTORY_GRAPH = YES
+
+# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
+# generated by dot. Possible values are png, jpg, or gif
+# If left blank png will be used.
+
+DOT_IMAGE_FORMAT = png
+
+# The tag DOT_PATH can be used to specify the path where the dot tool can be
+# found. If left blank, it is assumed the dot tool can be found in the path.
+
+DOT_PATH =
+
+# The DOTFILE_DIRS tag can be used to specify one or more directories that
+# contain dot files that are included in the documentation (see the
+# \dotfile command).
+
+DOTFILE_DIRS =
+
+# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of
+# nodes that will be shown in the graph. If the number of nodes in a graph
+# becomes larger than this value, doxygen will truncate the graph, which is
+# visualized by representing a node as a red box. Note that doxygen if the
+# number of direct children of the root node in a graph is already larger than
+# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note
+# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
+
+DOT_GRAPH_MAX_NODES = 50
+
+# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the
+# graphs generated by dot. A depth value of 3 means that only nodes reachable
+# from the root by following a path via at most 3 edges will be shown. Nodes
+# that lay further from the root node will be omitted. Note that setting this
+# option to 1 or 2 may greatly reduce the computation time needed for large
+# code bases. Also note that the size of a graph can be further restricted by
+# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
+
+MAX_DOT_GRAPH_DEPTH = 0
+
+# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
+# background. This is disabled by default, because dot on Windows does not
+# seem to support this out of the box. Warning: Depending on the platform used,
+# enabling this option may lead to badly anti-aliased labels on the edges of
+# a graph (i.e. they become hard to read).
+
+DOT_TRANSPARENT = YES
+
+# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output
+# files in one run (i.e. multiple -o and -T options on the command line). This
+# makes dot run faster, but since only newer versions of dot (>1.8.10)
+# support this, this feature is disabled by default.
+
+DOT_MULTI_TARGETS = NO
+
+# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will
+# generate a legend page explaining the meaning of the various boxes and
+# arrows in the dot generated graphs.
+
+GENERATE_LEGEND = YES
+
+# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will
+# remove the intermediate dot files that are used to generate
+# the various graphs.
+
+DOT_CLEANUP = YES
diff --git a/gst-libs/ext/libav/doc/Makefile b/gst-libs/ext/libav/doc/Makefile
index 0acd984..d22de79 100644
--- a/gst-libs/ext/libav/doc/Makefile
+++ b/gst-libs/ext/libav/doc/Makefile
@@ -7,32 +7,43 @@ HTMLPAGES = $(PROGS-yes:%=doc/%.html) \
doc/general.html \
doc/git-howto.html \
doc/libavfilter.html \
+ doc/nut.html \
doc/platform.html \
DOCS = $(HTMLPAGES) $(MANPAGES) $(PODPAGES)
all-$(CONFIG_DOC): documentation
+apidoc: doc/doxy/html
documentation: $(DOCS)
TEXIDEP = awk '/^@include/ { printf "$@: $(@D)/%s\n", $$2 }' <$< >$(@:%=%.d)
+GENTEXI = format codec
+GENTEXI := $(GENTEXI:%=doc/avoptions_%.texi)
+
+$(GENTEXI): TAG = GENTEXI
+$(GENTEXI): doc/avoptions_%.texi: doc/print_options
+ $(M)doc/print_options $* > $@
+
doc/%.html: TAG = HTML
-doc/%.html: doc/%.texi $(SRC_PATH)/doc/t2h.init
+doc/%.html: doc/%.texi $(SRC_PATH)/doc/t2h.init $(GENTEXI)
$(Q)$(TEXIDEP)
- $(M)texi2html -monolithic --init-file $(SRC_PATH)/doc/t2h.init --output $@ $<
+ $(M)texi2html -I doc -monolithic --init-file $(SRC_PATH)/doc/t2h.init --output $@ $<
doc/%.pod: TAG = POD
-doc/%.pod: doc/%.texi
+doc/%.pod: doc/%.texi $(GENTEXI)
$(Q)$(TEXIDEP)
- $(M)$(SRC_PATH)/doc/texi2pod.pl $< $@
+ $(M)$(SRC_PATH)/doc/texi2pod.pl -Idoc $< $@
doc/%.1: TAG = MAN
-doc/%.1: doc/%.pod
+doc/%.1: doc/%.pod $(GENTEXI)
$(M)pod2man --section=1 --center=" " --release=" " $< > $@
-$(DOCS): | doc
-OBJDIRS += doc
+$(DOCS) doc/doxy/html: | doc/
+
+doc/doxy/html: $(SRC_PATH)/doc/Doxyfile $(INSTHEADERS)
+ $(M)$(SRC_PATH)/doc/doxy-wrapper.sh $(SRC_PATH) $^
install-progs-$(CONFIG_DOC): install-man
@@ -46,8 +57,9 @@ uninstall-man:
$(RM) $(addprefix "$(MANDIR)/man1/",$(ALLMANPAGES))
clean::
- $(RM) doc/*.html doc/*.pod doc/*.1 $(CLEANSUFFIXES:%=doc/%)
+ $(RM) doc/*.html doc/*.pod doc/*.1 $(CLEANSUFFIXES:%=doc/%) doc/avoptions_*.texi
+ $(RM) -r doc/doxy/html
-include $(wildcard $(DOCS:%=%.d))
-.PHONY: documentation
+.PHONY: apidoc documentation
diff --git a/gst-libs/ext/libav/doc/RELEASE_NOTES b/gst-libs/ext/libav/doc/RELEASE_NOTES
index 8c642b9..62207c6 100644
--- a/gst-libs/ext/libav/doc/RELEASE_NOTES
+++ b/gst-libs/ext/libav/doc/RELEASE_NOTES
@@ -1,82 +1,101 @@
Release Notes
=============
-* 0.8 "Forbidden Fruit"
+* 9 "Plain Nine"
General notes
-------------
-This release continues the API cleanups that have begun with the
-previous release. While it is binary compatible with 0.7, many parts of
-the public API were deprecated and will be removed in the git master and
-later releases. Please consult the doc/APIchanges file to see
-intended replacements for the deprecated APIs.
-
-Furthermore, our work on the 'ffmpeg' command-line tool has resulted in
-major revisions to its interface. In order to not break existing scripts
-and applications, we have chosen to introduce a new tool called
-'avconv', and keep the traditional 'ffmpeg' frontend for end-user's
-convenience. Please see the Changelog file for details how 'avconv'
-differs from 'ffmpeg'.
-
-Additionally, this release introduces a number of new interesting codecs
-such as the Apple Prores, Flash Screen Video 2 and Windows Media Image,
-and muxers such as LATM or CELT in Ogg, among many others. Moreover, our
-H.264 decoder has been improved to decode 4:2:2 material and our libx264
-wrapper now allows to produce 4:2:2 and 4:4:4 video.
+From this release onwards, we have decided to drop the leading zero from our
+release numbers. There were no plans of ever changing it, so it carried no
+information. Thus this release is just a plain 9, the next will be 10 etc.
+
+A new library arrived in Libav during this development cycle -- its name is
+libavresample and it handles audio conversion and mixing. All users are
+encouraged to use it instead of the old, now deprecated, audio conversion
+API in libavcodec.
+
+The libpostproc library now resides in a separate tree. It was fully independent
+of the other Libav libraries, not used by any of the tools and saw very little
+development. For these reasons we decided that it has no place in Libav. A
+standalone Git tree is available at http://git.videolan.org/?p=libpostproc.git
+for people wishing to use libpostproc.
+
+The major versions of the libavcodec, libavformat and libavfilter libraries have
+been bumped, so they are not API or ABI compatible with the 0.8 release. The
+ffmpeg transcoding tool, kept for compatibility in 0.8, has also been dropped.
+
+This release brings a number of significant changes in the libavfilter library.
+Firstly, all the API dealing with filter internals is no longer public. The
+result is that creating user-side filters will not be supported until
+libavfilter is more mature.
+Secondly, full audio filtering support is now available along with a set of
+basic audio filters. We hope that their number will soon grow significantly.
+The avconv transcoding tool has of course been extended to handle audio
+filtering as well.
+There were a number of other API changes, most importantly the addition of
+the buffer sink public API.
+
+In the libavcodec library, one of the most notable changes is added support for
+planar audio (i.e. not interleaved). Many decoders and encoders, that previously
+did inefficient (de)interleaving internally, now only work with planar audio
+formats. Libavresample can be used for optimized conversion between interleaved
+and planar formats.
+
+Of big interest to our Windows users, Libav now supports building with the MSVC
+compiler. Since MSVC does not support C99 features used extensively by Libav,
+this has been accomplished using a converter that turns C99 code to C89. See the
+platform-specific documentation for more detailed documentation on building
+Libav with MSVC.
+
+As usual, this release also contains support for some new formats, many smaller
+new features and countless bug fixes. We can highlight Opus decoding / encoding
+through libopus, encoders for Apple ProRes and Ut Video, WMA Lossless and
+RealAudio Lossless decoders, fragmented MOV/MP4 and ISMV (Smooth Streaming)
+muxers, 24-bit FLAC encoding, a large number of RTMP improvements and support
+for cover art in ID3v2, WMA, MP4 and FLAC.
See the Changelog file for a list of significant changes.
Please note that our policy on bug reports has not changed. We still only accept
bug reports against HEAD of the Libav trunk repository. If you are experiencing
issues with any formally released version of Libav, please try a current version
-of the development code to check if the issue still exists. If it does, make your
-report against the development code following the usual bug reporting guidelines.
+of the development code to check if the issue still exists. If it does, make
+your report against the development code following the usual bug reporting
+guidelines.
API changes
-----------
-A number of additional APIs have been introduced and some existing
-functions have been deprecated and are scheduled for removal in the next
-release. Significant API changes include:
+A number of additional APIs have been introduced and some existing functions
+have been deprecated and are scheduled for removal in the next release.
+Significant API changes include:
-* new audio decoding API which decodes from an AVPacket to an AVFrame and
-is able to use AVCodecContext.get_buffer() in the similar way as video decoding.
+[libavcodec]:
+* New video encoding API, similar to the previously introduced audio encoding
+ API, which encodes from an AVFrame to an AVPacket, thus allowing it to
+ properly output timing information and side data.
-* new audio encoding API which encodes from an AVFrame to an AVPacket, thus
-allowing it to properly output timing information and side data.
+* All CODEC_ID_* symbols now carry AV_ prefixes. Non-prefixed codec IDs are
+ deprecated.
-* rewritten AVOptions API with better built-in support for private options.
+* New codec descriptor API, which allows getting the properties of a given codec
+ (identified by its ID), without referring to a specific decoder or encoder.
-* private options support for demuxers [avformat_open_input()], muxers
-[avformat_write_header()], encoders and decoders [avcodec_open2()].
-As a result, many format- or codec-specific fields and flags in AVFormatContext
-and AVCodecContext were deprecated -- notably most of CODEC_FLAG2_* and many
-CODEC_FLAG_*.
+* An AVFrame must now be freed with a dedicated function, avcodec_free_frame().
-* new API for custom IO interrupt callbacks.
+[libavutil]:
+* New audio FIFO API, which simplifies managing/merging/splitting audio buffers.
-* #include cleanup in libavutil -- libavutil/avutil.h no longer includes all
-the other headers in libavutil, they must be included manually. One specific
-result is that libavutil/mathematics.h is no longer included from
-libavcodec/avcodec.h, which is a common source of errors.
+* new int/float type punning API
-Please see the file doc/APIchanges for details along with
-similar programmer-centric information.
+[libavfilter]:
+* All filter internals were hidden.
+* audio filtering.
+* new buffer sink API for getting frames out of libavfilter.
-Other notable changes
----------------------
-
-Libavcodec and libavformat built as shared libraries now hide non-public
-symbols. This will break applications using those symbols. Possible solutions
-are, in order of preference:
-1) Try finding a way of accomplishing the same with public API.
-2) If there is no corresponding public API, but you think there should be,
-post a request on the user mailing list or IRC channel.
-3) Finally if your program needs access to Libav internals for some special
-reason then the best solution is to link statically.
-
-Please see the Changelog file for a more detailed list of changes.
+Please see the file doc/APIchanges for details along with similar
+programmer-centric information.
diff --git a/gst-libs/ext/libav/doc/avconv.texi b/gst-libs/ext/libav/doc/avconv.texi
index 0a83326..7341d2f 100644
--- a/gst-libs/ext/libav/doc/avconv.texi
+++ b/gst-libs/ext/libav/doc/avconv.texi
@@ -79,6 +79,126 @@ The format option may be needed for raw input files.
@c man end DESCRIPTION
+@chapter Detailed description
+@c man begin DETAILED DESCRIPTION
+
+The transcoding process in @command{avconv} for each output can be described by
+the following diagram:
+
+@example
+ _______ ______________ _________ ______________ ________
+| | | | | | | | | |
+| input | demuxer | encoded data | decoder | decoded | encoder | encoded data | muxer | output |
+| file | ---------> | packets | ---------> | frames | ---------> | packets | -------> | file |
+|_______| |______________| |_________| |______________| |________|
+
+@end example
+
+@command{avconv} calls the libavformat library (containing demuxers) to read
+input files and get packets containing encoded data from them. When there are
+multiple input files, @command{avconv} tries to keep them synchronized by
+tracking lowest timestamp on any active input stream.
+
+Encoded packets are then passed to the decoder (unless streamcopy is selected
+for the stream, see further for a description). The decoder produces
+uncompressed frames (raw video/PCM audio/...) which can be processed further by
+filtering (see next section). After filtering the frames are passed to the
+encoder, which encodes them and outputs encoded packets again. Finally those are
+passed to the muxer, which writes the encoded packets to the output file.
+
+@section Filtering
+Before encoding, @command{avconv} can process raw audio and video frames using
+filters from the libavfilter library. Several chained filters form a filter
+graph. @command{avconv} distinguishes between two types of filtergraphs -
+simple and complex.
+
+@subsection Simple filtergraphs
+Simple filtergraphs are those that have exactly one input and output, both of
+the same type. In the above diagram they can be represented by simply inserting
+an additional step between decoding and encoding:
+
+@example
+ _________ __________ ______________
+| | | | | |
+| decoded | simple filtergraph | filtered | encoder | encoded data |
+| frames | -------------------> | frames | ---------> | packets |
+|_________| |__________| |______________|
+
+@end example
+
+Simple filtergraphs are configured with the per-stream @option{-filter} option
+(with @option{-vf} and @option{-af} aliases for video and audio respectively).
+A simple filtergraph for video can look for example like this:
+
+@example
+ _______ _____________ _______ _____ ________
+| | | | | | | | | |
+| input | ---> | deinterlace | ---> | scale | ---> | fps | ---> | output |
+|_______| |_____________| |_______| |_____| |________|
+
+@end example
+
+Note that some filters change frame properties but not frame contents. E.g. the
+@code{fps} filter in the example above changes number of frames, but does not
+touch the frame contents. Another example is the @code{setpts} filter, which
+only sets timestamps and otherwise passes the frames unchanged.
+
+@subsection Complex filtergraphs
+Complex filtergraphs are those which cannot be described as simply a linear
+processing chain applied to one stream. This is the case e.g. when the graph has
+more than one input and/or output, or when output stream type is different from
+input. They can be represented with the following diagram:
+
+@example
+ _________
+| |
+| input 0 |\ __________
+|_________| \ | |
+ \ _________ /| output 0 |
+ \ | | / |__________|
+ _________ \| complex | /
+| | | |/
+| input 1 |---->| filter |\
+|_________| | | \ __________
+ /| graph | \ | |
+ / | | \| output 1 |
+ _________ / |_________| |__________|
+| | /
+| input 2 |/
+|_________|
+
+@end example
+
+Complex filtergraphs are configured with the @option{-filter_complex} option.
+Note that this option is global, since a complex filtergraph by its nature
+cannot be unambiguously associated with a single stream or file.
+
+A trivial example of a complex filtergraph is the @code{overlay} filter, which
+has two video inputs and one video output, containing one video overlaid on top
+of the other. Its audio counterpart is the @code{amix} filter.
+
+@section Stream copy
+Stream copy is a mode selected by supplying the @code{copy} parameter to the
+@option{-codec} option. It makes @command{avconv} omit the decoding and encoding
+step for the specified stream, so it does only demuxing and muxing. It is useful
+for changing the container format or modifying container-level metadata. The
+diagram above will in this case simplify to this:
+
+@example
+ _______ ______________ ________
+| | | | | |
+| input | demuxer | encoded data | muxer | output |
+| file | ---------> | packets | -------> | file |
+|_______| |______________| |________|
+
+@end example
+
+Since there is no decoding or encoding, it is very fast and there is no quality
+loss. However it might not work in some cases because of many factors. Applying
+filters is obviously also impossible, since filters work on uncompressed data.
+
+@c man end DETAILED DESCRIPTION
+
@chapter Stream selection
@c man begin STREAM SELECTION
@@ -207,6 +327,9 @@ codec-dependent.
@var{filter_graph} is a description of the filter graph to apply to
the stream. Use @code{-filters} to show all the available filters
(including also sources and sinks).
+
+See also the @option{-filter_complex} option if you want to create filter graphs
+with multiple inputs and/or outputs.
@item -pre[:@var{stream_specifier}] @var{preset_name} (@emph{output,per-stream})
Specify the preset for matching stream(s).
@@ -254,10 +377,28 @@ attachments.
@item -vframes @var{number} (@emph{output})
Set the number of video frames to record. This is an alias for @code{-frames:v}.
@item -r[:@var{stream_specifier}] @var{fps} (@emph{input/output,per-stream})
-Set frame rate (Hz value, fraction or abbreviation), (default = 25).
+Set frame rate (Hz value, fraction or abbreviation).
+
+As an input option, ignore any timestamps stored in the file and instead
+generate timestamps assuming constant frame rate @var{fps}.
+
+As an output option, duplicate or drop input frames to achieve constant output
+frame rate @var{fps} (note that this actually causes the @code{fps} filter to be
+inserted to the end of the corresponding filtergraph).
+
@item -s[:@var{stream_specifier}] @var{size} (@emph{input/output,per-stream})
-Set frame size. The format is @samp{wxh} (default - same as source).
-The following abbreviations are recognized:
+Set frame size.
+
+As an input option, this is a shortcut for the @option{video_size} private
+option, recognized by some demuxers for which the frame size is either not
+stored in the file or is configurable -- e.g. raw video or video grabbers.
+
+As an output option, this inserts the @code{scale} video filter to the
+@emph{end} of the corresponding filtergraph. Please use the @code{scale} filter
+directly to insert it at the beginning or some other place.
+
+The format is @samp{wxh} (default - same as source). The following
+abbreviations are recognized:
@table @samp
@item sqcif
128x96
@@ -329,34 +470,11 @@ numerator and denominator of the aspect ratio. For example "4:3",
@item -vn (@emph{output})
Disable video recording.
-@item -bt @var{tolerance}
-Set video bitrate tolerance (in bits, default 4000k).
-Has a minimum value of: (target_bitrate/target_framerate).
-In 1-pass mode, bitrate tolerance specifies how far ratecontrol is
-willing to deviate from the target average bitrate value. This is
-not related to min/max bitrate. Lowering tolerance too much has
-an adverse effect on quality.
-@item -maxrate @var{bitrate}
-Set max video bitrate (in bit/s).
-Requires -bufsize to be set.
-@item -minrate @var{bitrate}
-Set min video bitrate (in bit/s).
-Most useful in setting up a CBR encode:
-@example
-avconv -i myfile.avi -b 4000k -minrate 4000k -maxrate 4000k -bufsize 1835k out.m2v
-@end example
-It is of little use elsewise.
-@item -bufsize @var{size}
-Set video buffer verifier buffer size (in bits).
+
@item -vcodec @var{codec} (@emph{output})
Set the video codec. This is an alias for @code{-codec:v}.
-@item -same_quant
-Use same quantizer as source (implies VBR).
-
-Note that this is NOT SAME QUALITY. Do not use this option unless you know you
-need it.
-@item -pass @var{n}
+@item -pass[:@var{stream_specifier}] @var{n} (@emph{output,per-stream})
Select the pass number (1 or 2). It is used to do two-pass
video encoding. The statistics of the video are recorded in the first
pass into a log file (see also the option -passlogfile),
@@ -369,7 +487,7 @@ avconv -i foo.mov -c:v libxvid -pass 1 -an -f rawvideo -y NUL
avconv -i foo.mov -c:v libxvid -pass 1 -an -f rawvideo -y /dev/null
@end example
-@item -passlogfile @var{prefix} (@emph{global})
+@item -passlogfile[:@var{stream_specifier}] @var{prefix} (@emph{output,per-stream})
Set two-pass log file name prefix to @var{prefix}, the default file name
prefix is ``av2pass''. The complete file name will be
@file{PREFIX-N.log}, where N is a number specific to the output
@@ -391,143 +509,16 @@ Set pixel format. Use @code{-pix_fmts} to show all the supported
pixel formats.
@item -sws_flags @var{flags} (@emph{input/output})
Set SwScaler flags.
-@item -g @var{gop_size}
-Set the group of pictures size.
@item -vdt @var{n}
Discard threshold.
-@item -qmin @var{q}
-minimum video quantizer scale (VBR)
-@item -qmax @var{q}
-maximum video quantizer scale (VBR)
-@item -qdiff @var{q}
-maximum difference between the quantizer scales (VBR)
-@item -qblur @var{blur}
-video quantizer scale blur (VBR) (range 0.0 - 1.0)
-@item -qcomp @var{compression}
-video quantizer scale compression (VBR) (default 0.5).
-Constant of ratecontrol equation. Recommended range for default rc_eq: 0.0-1.0
-
-@item -lmin @var{lambda}
-minimum video lagrange factor (VBR)
-@item -lmax @var{lambda}
-max video lagrange factor (VBR)
-@item -mblmin @var{lambda}
-minimum macroblock quantizer scale (VBR)
-@item -mblmax @var{lambda}
-maximum macroblock quantizer scale (VBR)
-
-These four options (lmin, lmax, mblmin, mblmax) use 'lambda' units,
-but you may use the QP2LAMBDA constant to easily convert from 'q' units:
-@example
-avconv -i src.ext -lmax 21*QP2LAMBDA dst.ext
-@end example
-
-@item -rc_init_cplx @var{complexity}
-initial complexity for single pass encoding
-@item -b_qfactor @var{factor}
-qp factor between P- and B-frames
-@item -i_qfactor @var{factor}
-qp factor between P- and I-frames
-@item -b_qoffset @var{offset}
-qp offset between P- and B-frames
-@item -i_qoffset @var{offset}
-qp offset between P- and I-frames
-@item -rc_eq @var{equation}
-Set rate control equation (see section "Expression Evaluation")
-(default = @code{tex^qComp}).
-
-When computing the rate control equation expression, besides the
-standard functions defined in the section "Expression Evaluation", the
-following functions are available:
-@table @var
-@item bits2qp(bits)
-@item qp2bits(qp)
-@end table
-
-and the following constants are available:
-@table @var
-@item iTex
-@item pTex
-@item tex
-@item mv
-@item fCode
-@item iCount
-@item mcVar
-@item var
-@item isI
-@item isP
-@item isB
-@item avgQP
-@item qComp
-@item avgIITex
-@item avgPITex
-@item avgPPTex
-@item avgBPTex
-@item avgTex
-@end table
@item -rc_override[:@var{stream_specifier}] @var{override} (@emph{output,per-stream})
rate control override for specific intervals
-@item -me_method @var{method}
-Set motion estimation method to @var{method}.
-Available methods are (from lowest to best quality):
-@table @samp
-@item zero
-Try just the (0, 0) vector.
-@item phods
-@item log
-@item x1
-@item hex
-@item umh
-@item epzs
-(default method)
-@item full
-exhaustive search (slow and marginally better than epzs)
-@end table
-
-@item -er @var{n}
-Set error resilience to @var{n}.
-@table @samp
-@item 1
-FF_ER_CAREFUL (default)
-@item 2
-FF_ER_COMPLIANT
-@item 3
-FF_ER_AGGRESSIVE
-@item 4
-FF_ER_VERY_AGGRESSIVE
-@end table
-
-@item -ec @var{bit_mask}
-Set error concealment to @var{bit_mask}. @var{bit_mask} is a bit mask of
-the following values:
-@table @samp
-@item 1
-FF_EC_GUESS_MVS (default = enabled)
-@item 2
-FF_EC_DEBLOCK (default = enabled)
-@end table
-
-@item -bf @var{frames}
-Use 'frames' B-frames (supported for MPEG-1, MPEG-2 and MPEG-4).
-@item -mbd @var{mode}
-macroblock decision
-@table @samp
-@item 0
-FF_MB_DECISION_SIMPLE: Use mb_cmp (cannot change it yet in avconv).
-@item 1
-FF_MB_DECISION_BITS: Choose the one which needs the fewest bits.
-@item 2
-FF_MB_DECISION_RD: rate distortion
-@end table
-
-@item -bug @var{param}
-Work around encoder bugs that are not auto-detected.
-@item -strict @var{strictness}
-How strictly to follow the standards.
@item -deinterlace
Deinterlace pictures.
+This option is deprecated since the deinterlacing is very low quality.
+Use the yadif filter with @code{-filter:v yadif}.
@item -vstats
Dump video coding statistics to @file{vstats_HHMMSS.log}.
@item -vstats_file @var{file}
@@ -576,6 +567,11 @@ Set the audio codec. This is an alias for @code{-codec:a}.
@item -sample_fmt[:@var{stream_specifier}] @var{sample_fmt} (@emph{output,per-stream})
Set the audio sample format. Use @code{-sample_fmts} to get a list
of supported sample formats.
+@item -af @var{filter_graph} (@emph{output})
+@var{filter_graph} is a description of the filter graph to apply to
+the input audio.
+Use the option "-filters" to show all the available filters (including
+also sources and sinks). This is an alias for @code{-filter:a}.
@end table
@section Advanced Audio options:
@@ -583,28 +579,6 @@ of supported sample formats.
@table @option
@item -atag @var{fourcc/tag} (@emph{output})
Force audio tag/fourcc. This is an alias for @code{-tag:a}.
-@item -audio_service_type @var{type}
-Set the type of service that the audio stream contains.
-@table @option
-@item ma
-Main Audio Service (default)
-@item ef
-Effects
-@item vi
-Visually Impaired
-@item hi
-Hearing Impaired
-@item di
-Dialogue
-@item co
-Commentary
-@item em
-Emergency
-@item vo
-Voice Over
-@item ka
-Karaoke
-@end table
@end table
@section Subtitle options:
@@ -616,17 +590,10 @@ Set the subtitle codec. This is an alias for @code{-codec:s}.
Disable subtitle recording.
@end table
-@section Audio/Video grab options
-
-@table @option
-@item -isync (@emph{global})
-Synchronize read on input.
-@end table
-
@section Advanced options
@table @option
-@item -map [-]@var{input_file_id}[:@var{stream_specifier}][,@var{sync_file_id}[:@var{stream_specifier}]] (@emph{output})
+@item -map [-]@var{input_file_id}[:@var{stream_specifier}][,@var{sync_file_id}[:@var{stream_specifier}]] | @var{[linklabel]} (@emph{output})
Designate one or more input streams as a source for the output file. Each input
stream is identified by the input file index @var{input_file_id} and
@@ -642,6 +609,10 @@ the source for output stream 1, etc.
A @code{-} character before the stream identifier creates a "negative" mapping.
It disables matching streams from already created mappings.
+An alternative @var{[linklabel]} form will map outputs from complex filter
+graphs (see the @option{-filter_complex} option) to the output file.
+@var{linklabel} must correspond to a defined output link label in the graph.
+
For example, to map ALL streams from the first input file to output
@example
avconv -i INPUT -map 0 output
@@ -736,12 +707,8 @@ Exit after avconv has been running for @var{duration} seconds.
Dump each input packet to stderr.
@item -hex (@emph{global})
When dumping packets, also dump the payload.
-@item -ps @var{size}
-Set RTP payload size in bytes.
@item -re (@emph{input})
Read input at native frame rate. Mainly used to simulate a grab device.
-@item -threads @var{count}
-Thread count.
@item -vsync @var{parameter}
Video sync method.
@@ -768,11 +735,12 @@ Audio sync method. "Stretches/squeezes" the audio stream to match the timestamps
the parameter is the maximum samples per second by which the audio is changed.
-async 1 is a special case where only the start of the audio stream is corrected
without any later correction.
+This option has been deprecated. Use the @code{asyncts} audio filter instead.
@item -copyts
Copy timestamps from input to output.
@item -copytb
Copy input stream time base from input to output when stream copying.
-@item -shortest
+@item -shortest (@emph{output})
Finish encoding when the shortest input stream ends.
@item -dts_delta_threshold
Timestamp discontinuity delta threshold.
@@ -797,14 +765,64 @@ Set bitstream filters for matching streams. @var{bistream_filters} is
a comma-separated list of bitstream filters. Use the @code{-bsfs} option
to get the list of bitstream filters.
@example
-avconv -i h264.mp4 -c:v copy -vbsf h264_mp4toannexb -an out.h264
+avconv -i h264.mp4 -c:v copy -bsf:v h264_mp4toannexb -an out.h264
@end example
@example
-avconv -i file.mov -an -vn -sbsf mov2textsub -c:s copy -f rawvideo sub.txt
+avconv -i file.mov -an -vn -bsf:s mov2textsub -c:s copy -f rawvideo sub.txt
@end example
@item -tag[:@var{stream_specifier}] @var{codec_tag} (@emph{output,per-stream})
Force a tag/fourcc for matching streams.
+
+@item -cpuflags mask (@emph{global})
+Set a mask that's applied to autodetected CPU flags. This option is intended
+for testing. Do not use it unless you know what you're doing.
+
+@item -filter_complex @var{filtergraph} (@emph{global})
+Define a complex filter graph, i.e. one with arbitrary number of inputs and/or
+outputs. For simple graphs -- those with one input and one output of the same
+type -- see the @option{-filter} options. @var{filtergraph} is a description of
+the filter graph, as described in @ref{Filtergraph syntax}.
+
+Input link labels must refer to input streams using the
+@code{[file_index:stream_specifier]} syntax (i.e. the same as @option{-map}
+uses). If @var{stream_specifier} matches multiple streams, the first one will be
+used. An unlabeled input will be connected to the first unused input stream of
+the matching type.
+
+Output link labels are referred to with @option{-map}. Unlabeled outputs are
+added to the first output file.
+
+Note that with this option it is possible to use only lavfi sources without
+normal input files.
+
+For example, to overlay an image over video
+@example
+avconv -i video.mkv -i image.png -filter_complex '[0:v][1:v]overlay[out]' -map
+'[out]' out.mkv
+@end example
+Here @code{[0:v]} refers to the first video stream in the first input file,
+which is linked to the first (main) input of the overlay filter. Similarly the
+first video stream in the second input is linked to the second (overlay) input
+of overlay.
+
+Assuming there is only one video stream in each input file, we can omit input
+labels, so the above is equivalent to
+@example
+avconv -i video.mkv -i image.png -filter_complex 'overlay[out]' -map
+'[out]' out.mkv
+@end example
+
+Furthermore we can omit the output label and the single output from the filter
+graph will be added to the output file automatically, so we can simply write
+@example
+avconv -i video.mkv -i image.png -filter_complex 'overlay' out.mkv
+@end example
+
+To generate 5 seconds of pure red video using lavfi @code{color} source:
+@example
+avconv -filter_complex 'color=red' -t 5 out.mkv
+@end example
@end table
@c man end OPTIONS
@@ -833,7 +851,7 @@ frame rate or decrease the frame size.
@item
If your computer is not fast enough, you can speed up the
compression at the expense of the compression ratio. You can use
-'-me zero' to speed up motion estimation, and '-intra' to disable
+'-me zero' to speed up motion estimation, and '-g 0' to disable
motion estimation completely (you have only I-frames, which means it
is about as good as JPEG compression).
@@ -1027,6 +1045,19 @@ avconv -i test1.avi -i test2.avi -map 0.3 -map 0.2 -map 0.1 -map 0.0 -c copy tes
The resulting output file @file{test12.avi} will contain first four streams from
the input file in reverse order.
+@item
+To force CBR video output:
+@example
+avconv -i myfile.avi -b 4000k -minrate 4000k -maxrate 4000k -bufsize 1835k out.m2v
+@end example
+
+@item
+The four options lmin, lmax, mblmin and mblmax use 'lambda' units,
+but you may use the QP2LAMBDA constant to easily convert from 'q' units:
+@example
+avconv -i src.ext -lmax 21*QP2LAMBDA dst.ext
+@end example
+
@end itemize
@c man end EXAMPLES
diff --git a/gst-libs/ext/libav/doc/avprobe.texi b/gst-libs/ext/libav/doc/avprobe.texi
index 6b2c800..7e6fedf 100644
--- a/gst-libs/ext/libav/doc/avprobe.texi
+++ b/gst-libs/ext/libav/doc/avprobe.texi
@@ -41,19 +41,8 @@ Options are used to list some of the formats supported by avprobe or
for specifying which information to display, and for setting how
avprobe will show it.
-avprobe output is designed to be easily parsable by a textual filter,
-and consists of one or more sections of the form:
-@example
-[SECTION]
-key1=val1
-...
-keyN=valN
-[/SECTION]
-@end example
-
-Metadata tags stored in the container or in the streams are recognized
-and printed in the corresponding "FORMAT" or "STREAM" section, and
-are prefixed by the string "TAG:".
+avprobe output is designed to be easily parsable by any INI or JSON
+parsers.
@c man end
@@ -69,6 +58,19 @@ are prefixed by the string "TAG:".
@item -f @var{format}
Force format to use.
+@item -of @var{formatter}
+Use a specific formatter to output the document. The following
+formatters are available
+@table @option
+@item ini
+
+@item json
+
+@item old
+Pseudo-INI format that used to be the only one available in old
+avprobe versions.
+@end table
+
@item -unit
Show the unit of the displayed values.
@@ -94,6 +96,11 @@ stream.
All the container format information is printed within a section with
name "FORMAT".
+@item -show_format_entry @var{name}
+Like @option{-show_format}, but only prints the specified entry of the
+container format information, rather than all. This option may be given more
+than once, then all specified entries will be shown.
+
@item -show_packets
Show information about each packet contained in the input multimedia
stream.
diff --git a/gst-libs/ext/libav/doc/avserver.conf b/gst-libs/ext/libav/doc/avserver.conf
index 1f21f4d..e1cd9fb 100644
--- a/gst-libs/ext/libav/doc/avserver.conf
+++ b/gst-libs/ext/libav/doc/avserver.conf
@@ -25,9 +25,6 @@ MaxBandwidth 1000
# '-' is the standard output.
CustomLog -
-# Suppress that if you want to launch avserver as a daemon.
-NoDaemon
-
##################################################################
# Definition of the live feeds. Each live feed contains one video
@@ -373,5 +370,3 @@ ACL allow 192.168.0.0 192.168.255.255
<Redirect index.html>
URL http://www.libav.org/
</Redirect>
-
-
diff --git a/gst-libs/ext/libav/doc/avserver.texi b/gst-libs/ext/libav/doc/avserver.texi
index c023814..88e6221 100644
--- a/gst-libs/ext/libav/doc/avserver.texi
+++ b/gst-libs/ext/libav/doc/avserver.texi
@@ -31,11 +31,6 @@ several live feeds, streaming from files and time shifting on live feeds
(you can seek to positions in the past on each live feed, provided you
specify a big enough feed storage in avserver.conf).
-avserver runs in daemon mode by default; that is, it puts itself in
-the background and detaches from its TTY, unless it is launched in
-debug mode or a NoDaemon option is specified in the configuration
-file.
-
This documentation covers only the streaming aspects of avserver /
avconv. All questions about parameters for avconv, codec questions,
etc. are not covered here. Read @file{avconv.html} for more
@@ -257,8 +252,7 @@ within the various <Stream> sections. Since avserver will not launch
any avconv instances, you will have to launch them manually.
@item -d
Enable debug mode. This option increases log verbosity, directs log
-messages to stdout and causes avserver to run in the foreground
-rather than as a daemon.
+messages to stdout.
@end table
@c man end
diff --git a/gst-libs/ext/libav/doc/avtools-common-opts.texi b/gst-libs/ext/libav/doc/avtools-common-opts.texi
index badd358..afd2cc3 100644
--- a/gst-libs/ext/libav/doc/avtools-common-opts.texi
+++ b/gst-libs/ext/libav/doc/avtools-common-opts.texi
@@ -1,10 +1,11 @@
All the numerical options, if not specified otherwise, accept in input
a string representing a number, which may contain one of the
-International System number postfixes, for example 'K', 'M', 'G'.
-If 'i' is appended after the postfix, powers of 2 are used instead of
-powers of 10. The 'B' postfix multiplies the value for 8, and can be
-appended after another postfix or used alone. This allows using for
-example 'KB', 'MiB', 'G' and 'B' as postfix.
+SI unit prefixes, for example 'K', 'M', 'G'.
+If 'i' is appended after the prefix, binary prefixes are used,
+which are based on powers of 1024 instead of powers of 1000.
+The 'B' postfix multiplies the value by 8, and can be
+appended after a unit prefix or used alone. This allows using for
+example 'KB', 'MiB', 'G' and 'B' as number postfix.
Options which do not take arguments are boolean options, and set the
corresponding value to true. They can be set to false by prefixing
@@ -51,8 +52,29 @@ These options are shared amongst the av* tools.
@item -L
Show license.
-@item -h, -?, -help, --help
-Show help.
+@item -h, -?, -help, --help [@var{arg}]
+Show help. An optional parameter may be specified to print help about a specific
+item.
+
+Possible values of @var{arg} are:
+@table @option
+@item decoder=@var{decoder_name}
+Print detailed information about the decoder named @var{decoder_name}. Use the
+@option{-decoders} option to get a list of all decoders.
+
+@item encoder=@var{encoder_name}
+Print detailed information about the encoder named @var{encoder_name}. Use the
+@option{-encoders} option to get a list of all encoders.
+
+@item demuxer=@var{demuxer_name}
+Print detailed information about the demuxer named @var{demuxer_name}. Use the
+@option{-formats} option to get a list of all demuxers and muxers.
+
+@item muxer=@var{muxer_name}
+Print detailed information about the muxer named @var{muxer_name}. Use the
+@option{-formats} option to get a list of all muxers and demuxers.
+
+@end table
@item -version
Show version.
@@ -69,23 +91,16 @@ Encoding available
@end table
@item -codecs
-Show available codecs.
+Show all codecs known to libavcodec.
-The fields preceding the codec names have the following meanings:
-@table @samp
-@item D
-Decoding available
-@item E
-Encoding available
-@item V/A/S
-Video/audio/subtitle codec
-@item S
-Codec supports slices
-@item D
-Codec supports direct rendering
-@item T
-Codec can handle input truncated at random locations instead of only at frame boundaries
-@end table
+Note that the term 'codec' is used throughout this documentation as a shortcut
+for what is more correctly called a media bitstream format.
+
+@item -decoders
+Show available decoders.
+
+@item -encoders
+Show all available encoders.
@item -bsfs
Show available bitstream filters.
@@ -156,3 +171,6 @@ use @option{-option 0}/@option{-option 1}.
Note2 old undocumented way of specifying per-stream AVOptions by prepending
v/a/s to the options name is now obsolete and will be removed soon.
+
+@include avoptions_codec.texi
+@include avoptions_format.texi
diff --git a/gst-libs/ext/libav/doc/bitstream_filters.texi b/gst-libs/ext/libav/doc/bitstream_filters.texi
index ba66bc8..6e7f878 100644
--- a/gst-libs/ext/libav/doc/bitstream_filters.texi
+++ b/gst-libs/ext/libav/doc/bitstream_filters.texi
@@ -57,7 +57,7 @@ stream (carrying the AVI1 header ID and lacking a DHT segment) to
produce fully qualified JPEG images.
@example
-avconv -i mjpeg-movie.avi -c:v copy -vbsf mjpeg2jpeg frame_%d.jpg
+avconv -i mjpeg-movie.avi -c:v copy -bsf:v mjpeg2jpeg frame_%d.jpg
exiftran -i -9 frame*.jpg
avconv -i frame_%d.jpg -c:v copy rotated.avi
@end example
diff --git a/gst-libs/ext/libav/doc/build_system.txt b/gst-libs/ext/libav/doc/build_system.txt
index 1011f57..c3dede7 100644
--- a/gst-libs/ext/libav/doc/build_system.txt
+++ b/gst-libs/ext/libav/doc/build_system.txt
@@ -27,4 +27,3 @@ libavcodec/api-example
libswscale/swscale-test
Build the swscale self-test (useful also as example).
-
diff --git a/gst-libs/ext/libav/doc/demuxers.texi b/gst-libs/ext/libav/doc/demuxers.texi
index af4e3f1..b78cf68 100644
--- a/gst-libs/ext/libav/doc/demuxers.texi
+++ b/gst-libs/ext/libav/doc/demuxers.texi
@@ -64,6 +64,19 @@ Note that the pattern must not necessarily contain "%d" or
avconv -i img.jpeg img.png
@end example
+@table @option
+@item -pixel_format @var{format}
+Set the pixel format (for raw image)
+@item -video_size @var{size}
+Set the frame size (for raw image)
+@item -framerate @var{rate}
+Set the frame rate
+@item -loop @var{bool}
+Loop over the images
+@item -start_number @var{start}
+Specify the first number in the sequence
+@end table
+
@section applehttp
Apple HTTP Live Streaming demuxer.
diff --git a/gst-libs/ext/libav/doc/developer.texi b/gst-libs/ext/libav/doc/developer.texi
index 4b5d6af..7d39f2d 100644
--- a/gst-libs/ext/libav/doc/developer.texi
+++ b/gst-libs/ext/libav/doc/developer.texi
@@ -73,6 +73,10 @@ const char *avfilter_configuration(void)
@}
@end example
@item
+Do not check for NULL values by comparison, @samp{if (p)} and
+@samp{if (!p)} are correct; @samp{if (p == NULL)} and @samp{if (p != NULL)}
+are not.
+@item
In case of a single-statement if, no curly braces are required:
@example
if (!pic || !picref)
@@ -197,7 +201,7 @@ For exported names, each library has its own prefixes. Just check the existing
code and name accordingly.
@end itemize
-@subsection Miscellanous conventions
+@subsection Miscellaneous conventions
@itemize @bullet
@item
fprintf and printf are forbidden in libavformat and libavcodec,
@@ -215,6 +219,8 @@ the following snippet into your @file{.vimrc}:
set expandtab
set shiftwidth=4
set softtabstop=4
+set cindent
+set cinoptions=(0
" Allow tabs in Makefiles.
autocmd FileType make,automake set noexpandtab shiftwidth=8 softtabstop=8
" Trailing whitespace and tabs are forbidden, so highlight them.
@@ -226,10 +232,16 @@ autocmd InsertEnter * match ForbiddenWhitespace /\t\|\s\+\%#\@@<!$/
For Emacs, add these roughly equivalent lines to your @file{.emacs.d/init.el}:
@example
-(setq c-default-style "k&r")
-(setq-default c-basic-offset 4)
-(setq-default indent-tabs-mode nil)
-(setq-default show-trailing-whitespace t)
+(c-add-style "libav"
+ '("k&r"
+ (c-basic-offset . 4)
+ (indent-tabs-mode . nil)
+ (show-trailing-whitespace . t)
+ (c-offsets-alist
+ (statement-cont . (c-lineup-assignments +)))
+ )
+ )
+(setq c-default-style "libav")
@end example
@section Development Policy
@@ -391,7 +403,9 @@ send a reminder by email. Your patch should eventually be dealt with.
@item
Did you register it in @file{allcodecs.c} or @file{allformats.c}?
@item
- Did you add the CodecID to @file{avcodec.h}?
+ Did you add the AVCodecID to @file{avcodec.h}?
+ When adding new codec IDs, also add an entry to the codec descriptor
+ list in @file{libavcodec/codec_desc.c}.
@item
If it has a fourcc, did you add it to @file{libavformat/riff.c},
even if it is only a decoder?
@@ -476,6 +490,10 @@ send a reminder by email. Your patch should eventually be dealt with.
@item
Lines with similar content should be aligned vertically when doing so
improves readability.
+@item
+ Make sure you check the return values of function and return appropriate
+ error codes. Especially memory allocation functions like @code{malloc()}
+ are notoriously left unchecked, which is a serious problem.
@end enumerate
@section Patch review process
diff --git a/gst-libs/ext/libav/doc/doxy-wrapper.sh b/gst-libs/ext/libav/doc/doxy-wrapper.sh
new file mode 100755
index 0000000..6650e38
--- /dev/null
+++ b/gst-libs/ext/libav/doc/doxy-wrapper.sh
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+SRC_PATH="${1}"
+DOXYFILE="${2}"
+
+shift 2
+
+doxygen - <<EOF
+@INCLUDE = ${DOXYFILE}
+INPUT = $@
+HTML_HEADER = ${SRC_PATH}/doc/doxy/header.html
+HTML_FOOTER = ${SRC_PATH}/doc/doxy/footer.html
+HTML_STYLESHEET = ${SRC_PATH}/doc/doxy/doxy_stylesheet.css
+EOF
diff --git a/gst-libs/ext/libav/doc/doxy/doxy_stylesheet.css b/gst-libs/ext/libav/doc/doxy/doxy_stylesheet.css
index ff1e214..63238a2 100644
--- a/gst-libs/ext/libav/doc/doxy/doxy_stylesheet.css
+++ b/gst-libs/ext/libav/doc/doxy/doxy_stylesheet.css
@@ -1,31 +1,1137 @@
-/* The standard CSS for doxygen */
+/*!
+ * Bootstrap v2.1.1
+ *
+ * Copyright 2012 Twitter, Inc
+ * Licensed under the Apache License v2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Designed and built with all the love in the world @twitter by @mdo and @fat.
+ */
+
+html {
+ font-size: 100%;
+ -webkit-text-size-adjust: 100%;
+ -ms-text-size-adjust: 100%;
+}
+a:focus {
+ outline: thin dotted #333;
+ outline: 5px auto -webkit-focus-ring-color;
+ outline-offset: -2px;
+}
+a:hover,
+a:current {
+ outline: 0;
+}
+img {
+ /* Responsive images (ensure images don't scale beyond their parents) */
-/* @group Heading Levels */
+ max-width: 100%;
+ /* Part 1: Set a maxium relative to the parent */
+
+ width: auto\9;
+ /* IE7-8 need help adjusting responsive images */
+
+ height: auto;
+ /* Part 2: Scale the height according to the width, otherwise you get stretching */
+
+ vertical-align: middle;
+ border: 0;
+ -ms-interpolation-mode: bicubic;
+}
+body {
+ margin: 0;
+ font-family: sans-serif;
+ font-size: 14px;
+ line-height: 20px;
+ color: #333333;
+ background-color: #ffffff;
+}
+a {
+ color: #0088cc;
+ text-decoration: none;
+}
+a:hover {
+ color: #005580;
+ text-decoration: underline;
+}
+.container {
+ width: 940px;
+}
+.container {
+ margin-right: auto;
+ margin-left: auto;
+ *zoom: 1;
+}
+.container:before,
+.container:after {
+ display: table;
+ content: "";
+ line-height: 0;
+}
+.container:after {
+ clear: both;
+}
+.container-fluid {
+ padding-right: 20px;
+ padding-left: 20px;
+ *zoom: 1;
+}
+small {
+ font-size: 85%;
+}
+strong {
+ font-weight: bold;
+}
+em {
+ font-style: italic;
+}
+cite {
+ font-style: normal;
+}
+.text-warning {
+ color: #c09853;
+}
+.text-error {
+ color: #b94a48;
+}
+.text-info {
+ color: #3a87ad;
+}
+.text-success {
+ color: #468847;
+}
+h1,
+h2,
+h3,
+h4,
+h5,
+h6 {
+ margin: 10px 0;
+ font-family: inherit;
+ font-weight: bold;
+ line-height: 1;
+ color: inherit;
+ text-rendering: optimizelegibility;
+}
+h1 small,
+h2 small,
+h3 small,
+h4 small,
+h5 small,
+h6 small {
+ font-weight: normal;
+ line-height: 1;
+ color: #999999;
+}
h1 {
- font-size: 150%;
+ font-size: 30px;
+ line-height: 40px;
+}
+h2 {
+ font-size: 20px;
+ line-height: 40px;
+}
+h3 {
+ font-size: 18px;
+ line-height: 40px;
+}
+h4 {
+ font-size: 18px;
+ line-height: 20px;
+}
+h5 {
+ font-size: 14px;
+ line-height: 20px;
+}
+h6 {
+ font-size: 12px;
+ line-height: 20px;
+}
+ul,
+ol {
+ padding: 0;
+ margin: 0 0 10px 25px;
+}
+ul ul,
+ul ol,
+ol ol,
+ol ul {
+ margin-bottom: 0;
+}
+li {
+ line-height: 20px;
+}
+ul.unstyled,
+ol.unstyled {
+ margin-left: 0;
+ list-style: none;
+}
+dl {
+ margin-bottom: 20px;
+}
+dt,
+dd {
+ line-height: 20px;
+}
+dt {
+ font-weight: bold;
+}
+dd {
+ margin-left: 10px;
+}
+blockquote {
+ padding: 0 0 0 15px;
+ margin: 0 0 20px;
+ border-left: 5px solid #eeeeee;
+}
+blockquote p {
+ margin-bottom: 0;
+ font-size: 16px;
+ font-weight: 300;
+ line-height: 25px;
+}
+blockquote:before,
+blockquote:after {
+ content: "";
+}
+.fragment,
+code,
+pre {
+ padding: 0 3px 2px;
+ font-family: monospace;
+ font-size: 12px;
+ color: #333333;
+ -webkit-border-radius: 3px;
+ -moz-border-radius: 3px;
+ border-radius: 3px;
+}
+.fragment,
+code {
+ padding: 2px 4px;
+ color: #d14;
+ background-color: #f7f7f9;
+ border: 1px solid #e1e1e8;
+}
+pre {
+ display: block;
+ padding: 9.5px;
+ margin: 0 0 10px;
+ font-size: 13px;
+ line-height: 20px;
+ word-break: break-all;
+ word-wrap: break-word;
+ white-space: pre;
+ white-space: pre-wrap;
+ background-color: #f5f5f5;
+ border: 1px solid #ccc;
+ border: 1px solid rgba(0, 0, 0, 0.15);
+ -webkit-border-radius: 4px;
+ -moz-border-radius: 4px;
+ border-radius: 4px;
+}
+pre code {
+ padding: 0;
+ color: inherit;
+ background-color: transparent;
+ border: 0;
+}
+.label,
+.badge {
+ font-size: 11.844px;
+ font-weight: bold;
+ line-height: 14px;
+ color: #ffffff;
+ vertical-align: baseline;
+ white-space: nowrap;
+ text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
+ background-color: #999999;
+}
+.label {
+ padding: 1px 4px 2px;
+ -webkit-border-radius: 3px;
+ -moz-border-radius: 3px;
+ border-radius: 3px;
+}
+.badge {
+ padding: 1px 9px 2px;
+ -webkit-border-radius: 9px;
+ -moz-border-radius: 9px;
+ border-radius: 9px;
+}
+a.label:hover,
+a.badge:hover {
+ color: #ffffff;
+ text-decoration: none;
+ cursor: pointer;
+}
+.label-important,
+.badge-important {
+ background-color: #b94a48;
+}
+.label-important[href],
+.badge-important[href] {
+ background-color: #953b39;
+}
+.label-warning,
+.badge-warning {
+ background-color: #f89406;
+}
+.label-warning[href],
+.badge-warning[href] {
+ background-color: #c67605;
+}
+.label-success,
+.badge-success {
+ background-color: #468847;
+}
+.label-success[href],
+.badge-success[href] {
+ background-color: #356635;
+}
+.label-info,
+.badge-info {
+ background-color: #3a87ad;
+}
+.label-info[href],
+.badge-info[href] {
+ background-color: #2d6987;
+}
+.label-inverse,
+.badge-inverse {
+ background-color: #333333;
+}
+.label-inverse[href],
+.badge-inverse[href] {
+ background-color: #1a1a1a;
+}
+table {
+ max-width: 100%;
+ background-color: transparent;
+ border-collapse: collapse;
+ border-spacing: 0;
+}
+
+table [class*=span],
+.row-fluid table [class*=span] {
+ display: table-cell;
+ float: none;
+ margin-left: 0;
+}
+fieldset {
+ padding: 0;
+ margin: 0;
+ border: 0;
+}
+legend {
+ display: block;
+ width: 100%;
+ padding: 0;
+ margin-bottom: 20px;
+ font-size: 21px;
+ line-height: 40px;
+ color: #333333;
+ border: 0;
+ border-bottom: 1px solid #e5e5e5;
+}
+legend small {
+ font-size: 15px;
+ color: #999999;
+}
+label,
+input,
+button,
+select,
+textarea {
+ font-size: 14px;
+ font-weight: normal;
+ line-height: 20px;
+}
+input,
+button,
+select,
+textarea {
+ font-family: sans-serif;
+}
+label {
+ display: block;
+ margin-bottom: 5px;
+}
+
+.tablist {
+ margin-left: 0;
+ margin-bottom: 20px;
+ list-style: none;
+}
+.tablist > li > a {
+ display: block;
+}
+.tablist > li > a:hover {
+ text-decoration: none;
+ background-color: #eeeeee;
+}
+.tablist > .pull-right {
+ float: right;
+}
+.tablist-header {
+ display: block;
+ padding: 3px 15px;
+ font-size: 11px;
+ font-weight: bold;
+ line-height: 20px;
+ color: #999999;
+ text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
+ text-transform: uppercase;
+}
+.tablist li + .tablist-header {
+ margin-top: 9px;
+}
+.tablist-list {
+ padding-left: 15px;
+ padding-right: 15px;
+ margin-bottom: 0;
+}
+.tablist-list > li > a,
+.tablist-list .tablist-header {
+ margin-left: -15px;
+ margin-right: -15px;
+ text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
+}
+.tablist-list > li > a {
+ padding: 3px 15px;
+}
+.tablist-list > .current > a,
+.tablist-list > .current > a:hover {
+ color: #ffffff;
+ text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.2);
+ background-color: #0088cc;
+}
+.tablist-list [class^="icon-"] {
+ margin-right: 2px;
+}
+.tablist-list .divider {
+ *width: 100%;
+ height: 1px;
+ margin: 9px 1px;
+ *margin: -5px 0 5px;
+ overflow: hidden;
+ background-color: #e5e5e5;
+ border-bottom: 1px solid #ffffff;
+}
+.tablist-tabs,
+.tablist {
+ *zoom: 1;
+}
+.tablist-tabs:before,
+.tablist:before,
+.tablist-tabs:after,
+.tablist:after {
+ display: table;
+ content: "";
+ line-height: 0;
+}
+.tablist-tabs:after,
+.tablist:after {
+ clear: both;
+}
+.tablist-tabs > li,
+.tablist > li {
+ float: left;
+}
+.tablist-tabs > li > a,
+.tablist > li > a {
+ padding-right: 12px;
+ padding-left: 12px;
+ margin-right: 2px;
+ line-height: 14px;
+}
+.tablist-tabs {
+ border-bottom: 1px solid #ddd;
+}
+.tablist-tabs > li {
+ margin-bottom: -1px;
+}
+.tablist-tabs > li > a {
+ padding-top: 8px;
+ padding-bottom: 8px;
+ line-height: 20px;
+ border: 1px solid transparent;
+ -webkit-border-radius: 4px 4px 0 0;
+ -moz-border-radius: 4px 4px 0 0;
+ border-radius: 4px 4px 0 0;
+}
+.tablist-tabs > li > a:hover {
+ border-color: #eeeeee #eeeeee #dddddd;
+}
+.tablist-tabs > .current > a,
+.tablist-tabs > .current > a:hover {
+ color: #555555;
+ background-color: #ffffff;
+ border: 1px solid #ddd;
+ border-bottom-color: transparent;
+ cursor: default;
+}
+.tablist > li > a {
+ padding-top: 8px;
+ padding-bottom: 8px;
+ margin-top: 2px;
+ margin-bottom: 2px;
+ -webkit-border-radius: 5px;
+ -moz-border-radius: 5px;
+ border-radius: 5px;
+}
+.tablist > .current > a,
+.tablist > .current > a:hover {
+ color: #ffffff;
+ background-color: #0088cc;
+}
+.tablist-stacked > li {
+ float: none;
+}
+.tablist-stacked > li > a {
+ margin-right: 0;
+}
+.tablist-tabs.tablist-stacked {
+ border-bottom: 0;
+}
+.tablist-tabs.tablist-stacked > li > a {
+ border: 1px solid #ddd;
+ -webkit-border-radius: 0;
+ -moz-border-radius: 0;
+ border-radius: 0;
+}
+.tablist-tabs.tablist-stacked > li:first-child > a {
+ -webkit-border-top-right-radius: 4px;
+ -moz-border-radius-topright: 4px;
+ border-top-right-radius: 4px;
+ -webkit-border-top-left-radius: 4px;
+ -moz-border-radius-topleft: 4px;
+ border-top-left-radius: 4px;
+}
+.tablist-tabs.tablist-stacked > li:last-child > a {
+ -webkit-border-bottom-right-radius: 4px;
+ -moz-border-radius-bottomright: 4px;
+ border-bottom-right-radius: 4px;
+ -webkit-border-bottom-left-radius: 4px;
+ -moz-border-radius-bottomleft: 4px;
+ border-bottom-left-radius: 4px;
+}
+.tablist-tabs.tablist-stacked > li > a:hover {
+ border-color: #ddd;
+ z-index: 2;
+}
+.tablist.tablist-stacked > li > a {
+ margin-bottom: 3px;
+}
+.tablist.tablist-stacked > li:last-child > a {
+ margin-bottom: 1px;
+}
+.tablist-tabs .dropdown-menu {
+ -webkit-border-radius: 0 0 6px 6px;
+ -moz-border-radius: 0 0 6px 6px;
+ border-radius: 0 0 6px 6px;
+}
+.tablist .dropdown-menu {
+ -webkit-border-radius: 6px;
+ -moz-border-radius: 6px;
+ border-radius: 6px;
+}
+.tablist .dropdown-toggle .caret {
+ border-top-color: #0088cc;
+ border-bottom-color: #0088cc;
+ margin-top: 6px;
+}
+.tablist .dropdown-toggle:hover .caret {
+ border-top-color: #005580;
+ border-bottom-color: #005580;
+}
+/* move down carets for tabs */
+.tablist-tabs .dropdown-toggle .caret {
+ margin-top: 8px;
+}
+.tablist .current .dropdown-toggle .caret {
+ border-top-color: #fff;
+ border-bottom-color: #fff;
+}
+.tablist-tabs .current .dropdown-toggle .caret {
+ border-top-color: #555555;
+ border-bottom-color: #555555;
+}
+.tablist > .dropdown.current > a:hover {
+ cursor: pointer;
+}
+.tablist-tabs .open .dropdown-toggle,
+.tablist .open .dropdown-toggle,
+.tablist > li.dropdown.open.current > a:hover {
+ color: #ffffff;
+ background-color: #999999;
+ border-color: #999999;
+}
+.tablist li.dropdown.open .caret,
+.tablist li.dropdown.open.current .caret,
+.tablist li.dropdown.open a:hover .caret {
+ border-top-color: #ffffff;
+ border-bottom-color: #ffffff;
+ opacity: 1;
+ filter: alpha(opacity=100);
+}
+.tabs-stacked .open > a:hover {
+ border-color: #999999;
+}
+.tab-content > .tab-pane,
+.pill-content > .pill-pane {
+ display: none;
+}
+.tab-content > .current,
+.pill-content > .current {
+ display: block;
+}
+.tabs-below > .tablist-tabs {
+ border-top: 1px solid #ddd;
+}
+.tabs-below > .tablist-tabs > li {
+ margin-top: -1px;
+ margin-bottom: 0;
+}
+.tabs-below > .tablist-tabs > li > a {
+ -webkit-border-radius: 0 0 4px 4px;
+ -moz-border-radius: 0 0 4px 4px;
+ border-radius: 0 0 4px 4px;
+}
+.tabs-below > .tablist-tabs > li > a:hover {
+ border-bottom-color: transparent;
+ border-top-color: #ddd;
+}
+.tabs-below > .tablist-tabs > .current > a,
+.tabs-below > .tablist-tabs > .current > a:hover {
+ border-color: transparent #ddd #ddd #ddd;
+}
+.tabs-left > .tablist-tabs > li,
+.tabs-right > .tablist-tabs > li {
+ float: none;
+}
+.tabs-left > .tablist-tabs > li > a,
+.tabs-right > .tablist-tabs > li > a {
+ min-width: 74px;
+ margin-right: 0;
+ margin-bottom: 3px;
+}
+.tabs-left > .tablist-tabs {
+ float: left;
+ margin-right: 19px;
+ border-right: 1px solid #ddd;
+}
+.tabs-left > .tablist-tabs > li > a {
+ margin-right: -1px;
+ -webkit-border-radius: 4px 0 0 4px;
+ -moz-border-radius: 4px 0 0 4px;
+ border-radius: 4px 0 0 4px;
+}
+.tabs-left > .tablist-tabs > li > a:hover {
+ border-color: #eeeeee #dddddd #eeeeee #eeeeee;
+}
+.tabs-left > .tablist-tabs .current > a,
+.tabs-left > .tablist-tabs .current > a:hover {
+ border-color: #ddd transparent #ddd #ddd;
+ *border-right-color: #ffffff;
+}
+.tabs-right > .tablist-tabs {
+ float: right;
+ margin-left: 19px;
+ border-left: 1px solid #ddd;
+}
+.tabs-right > .tablist-tabs > li > a {
+ margin-left: -1px;
+ -webkit-border-radius: 0 4px 4px 0;
+ -moz-border-radius: 0 4px 4px 0;
+ border-radius: 0 4px 4px 0;
+}
+.tabs-right > .tablist-tabs > li > a:hover {
+ border-color: #eeeeee #eeeeee #eeeeee #dddddd;
+}
+.tabs-right > .tablist-tabs .current > a,
+.tabs-right > .tablist-tabs .current > a:hover {
+ border-color: #ddd #ddd #ddd transparent;
+ *border-left-color: #ffffff;
+}
+.tablist > .disabled > a {
+ color: #999999;
+}
+.tablist > .disabled > a:hover {
+ text-decoration: none;
+ background-color: transparent;
+ cursor: default;
+}
+.tablistbar {
+ overflow: visible;
+ margin-bottom: 20px;
+ color: #ffffff;
+ *position: relative;
+ *z-index: 2;
+}
+.tablistbar-inner {
+ min-height: 40px;
+ padding-left: 20px;
+ padding-right: 20px;
+ background-color: #034c03;
+ background-image: -moz-linear-gradient(top, #024002, #045f04);
+ background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#024002), to(#045f04));
+ background-image: -webkit-linear-gradient(top, #024002, #045f04);
+ background-image: -o-linear-gradient(top, #024002, #045f04);
+ background-image: linear-gradient(to bottom, #024002, #045f04);
+ background-repeat: repeat-x;
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff024002', endColorstr='#ff045f04', GradientType=0);
+ border: 1px solid #022402;
+ -webkit-border-radius: 4px;
+ -moz-border-radius: 4px;
+ border-radius: 4px;
+ -webkit-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.065);
+ -moz-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.065);
+ box-shadow: 0 1px 4px rgba(0, 0, 0, 0.065);
+ *zoom: 1;
+}
+.tablistbar-inner:before,
+.tablistbar-inner:after {
+ display: table;
+ content: "";
+ line-height: 0;
+}
+.tablistbar-inner:after {
+ clear: both;
+}
+.tablistbar .container {
+ width: auto;
+}
+.tablist-collapse.collapse {
+ height: auto;
+}
+.tablistbar .brand {
+ float: left;
+ display: block;
+ padding: 10px 20px 10px;
+ margin-left: -20px;
+ font-size: 20px;
+ font-weight: 200;
+ color: #ffffff;
+ text-shadow: 0 1px 0 #024002;
+}
+.tablistbar .brand:hover {
+ text-decoration: none;
+}
+.tablistbar-text {
+ margin-bottom: 0;
+ line-height: 40px;
+}
+.tablistbar-link {
+ color: #ffffff;
+}
+.tablistbar-link:hover {
+ color: #333333;
+}
+.tablistbar .tablist {
+ position: relative;
+ left: 0;
+ display: block;
+ float: left;
+ margin: 0 10px 0 0;
+}
+.tablistbar .tablist.pull-right {
+ float: right;
+ margin-right: 0;
+}
+.tablistbar .tablist > li {
+ float: left;
+}
+.tablistbar .tablist > li > a {
+ float: none;
+ padding: 10px 15px 10px;
+ color: #ffffff;
+ text-decoration: none;
+ text-shadow: 0 1px 0 #024002;
+}
+.tablistbar .tablist .dropdown-toggle .caret {
+ margin-top: 8px;
+}
+.tablistbar .tablist > li > a:focus,
+.tablistbar .tablist > li > a:hover {
+ background-color: transparent;
+ color: white;
+ text-decoration: none;
+}
+.tablistbar .tablist > .current > a,
+.tablistbar .tablist > .current > a:hover,
+.tablistbar .tablist > .current > a:focus {
+ color: #555555;
+ text-decoration: none;
+ background-color: #034703;
+ -webkit-box-shadow: inset 0 3px 8px rgba(0, 0, 0, 0.125);
+ -moz-box-shadow: inset 0 3px 8px rgba(0, 0, 0, 0.125);
+ box-shadow: inset 0 3px 8px rgba(0, 0, 0, 0.125);
+}
+.tablistbar .btn-navbar {
+ display: none;
+ float: right;
+ padding: 7px 10px;
+ margin-left: 5px;
+ margin-right: 5px;
+ color: #ffffff;
+ text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
+ background-color: #023402;
+ background-image: -moz-linear-gradient(top, #012701, #034703);
+ background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#012701), to(#034703));
+ background-image: -webkit-linear-gradient(top, #012701, #034703);
+ background-image: -o-linear-gradient(top, #012701, #034703);
+ background-image: linear-gradient(to bottom, #012701, #034703);
+ background-repeat: repeat-x;
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff012701', endColorstr='#ff034703', GradientType=0);
+ border-color: #034703 #034703 #000000;
+ border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
+ *background-color: #034703;
+ /* Darken IE7 buttons by default so they stand out more given they won't have borders */
+
+ filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
+ -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 0 rgba(255, 255, 255, 0.075);
+ -moz-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 0 rgba(255, 255, 255, 0.075);
+ box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 0 rgba(255, 255, 255, 0.075);
+}
+.tablistbar .tablist > li > .dropdown-menu:before {
+ content: '';
+ display: inline-block;
+ border-left: 7px solid transparent;
+ border-right: 7px solid transparent;
+ border-bottom: 7px solid #ccc;
+ border-bottom-color: rgba(0, 0, 0, 0.2);
+ position: absolute;
+ top: -7px;
+ left: 9px;
+}
+.tablistbar .tablist > li > .dropdown-menu:after {
+ content: '';
+ display: inline-block;
+ border-left: 6px solid transparent;
+ border-right: 6px solid transparent;
+ border-bottom: 6px solid #ffffff;
+ position: absolute;
+ top: -6px;
+ left: 10px;
+}
+.tablistbar .tablist li.dropdown.open > .dropdown-toggle,
+.tablistbar .tablist li.dropdown.current > .dropdown-toggle,
+.tablistbar .tablist li.dropdown.open.current > .dropdown-toggle {
+ background-color: #034703;
+ color: #555555;
+}
+.tablistbar .tablist li.dropdown > .dropdown-toggle .caret {
+ border-top-color: #ffffff;
+ border-bottom-color: #ffffff;
+}
+.tablistbar .tablist li.dropdown.open > .dropdown-toggle .caret,
+.tablistbar .tablist li.dropdown.current > .dropdown-toggle .caret,
+.tablistbar .tablist li.dropdown.open.current > .dropdown-toggle .caret {
+ border-top-color: #555555;
+ border-bottom-color: #555555;
+}
+.tablistbar .pull-right > li > .dropdown-menu,
+.tablistbar .tablist > li > .dropdown-menu.pull-right {
+ left: auto;
+ right: 0;
+}
+.tablistbar .pull-right > li > .dropdown-menu:before,
+.tablistbar .tablist > li > .dropdown-menu.pull-right:before {
+ left: auto;
+ right: 12px;
+}
+.tablistbar .pull-right > li > .dropdown-menu:after,
+.tablistbar .tablist > li > .dropdown-menu.pull-right:after {
+ left: auto;
+ right: 13px;
+}
+.tablistbar .pull-right > li > .dropdown-menu .dropdown-menu,
+.tablistbar .tablist > li > .dropdown-menu.pull-right .dropdown-menu {
+ left: auto;
+ right: 100%;
+ margin-left: 0;
+ margin-right: -1px;
+ -webkit-border-radius: 6px 0 6px 6px;
+ -moz-border-radius: 6px 0 6px 6px;
+ border-radius: 6px 0 6px 6px;
+}
+.breadcrumb {
+ padding: 8px 15px;
+ margin: 0 0 20px;
+ list-style: none;
+ background-color: #f5f5f5;
+ -webkit-border-radius: 4px;
+ -moz-border-radius: 4px;
+ border-radius: 4px;
+}
+.breadcrumb li {
+ display: inline-block;
+ *display: inline;
+ /* IE7 inline-block hack */
+
+ *zoom: 1;
+ text-shadow: 0 1px 0 #ffffff;
+}
+.breadcrumb .divider {
+ padding: 0 5px;
+ color: #ccc;
+}
+.breadcrumb .current {
+ color: #999999;
+}
+.pagination-right {
+ text-align: right;
+}
+.fade {
+ opacity: 0;
+ -webkit-transition: opacity 0.15s linear;
+ -moz-transition: opacity 0.15s linear;
+ -o-transition: opacity 0.15s linear;
+ transition: opacity 0.15s linear;
+}
+.fade.in {
+ opacity: 1;
+}
+.collapse {
+ position: relative;
+ height: 0;
+ overflow: hidden;
+ -webkit-transition: height 0.35s ease;
+ -moz-transition: height 0.35s ease;
+ -o-transition: height 0.35s ease;
+ transition: height 0.35s ease;
+}
+.collapse.in {
+ height: auto;
+}
+.hidden {
+ display: none;
+ visibility: hidden;
+}
+.visible-phone {
+ display: none !important;
+}
+.visible-tablet {
+ display: none !important;
+}
+.hidden-desktop {
+ display: none !important;
+}
+.visible-desktop {
+ display: inherit !important;
+}
+@media (min-width: 768px) and (max-width: 979px) {
+ .hidden-desktop {
+ display: inherit !important;
+ }
+ .visible-desktop {
+ display: none !important ;
+ }
+ .visible-tablet {
+ display: inherit !important;
+ }
+ .hidden-tablet {
+ display: none !important;
+ }
+}
+@media (max-width: 767px) {
+ .hidden-desktop {
+ display: inherit !important;
+ }
+ .visible-desktop {
+ display: none !important;
+ }
+ .visible-phone {
+ display: inherit !important;
+ }
+ .hidden-phone {
+ display: none !important;
+ }
+}
+@media (max-width: 767px) {
+ body {
+ padding-left: 20px;
+ padding-right: 20px;
+ }
+ .container {
+ width: auto;
+ }
+ .row,
+ .thumbnails {
+ margin-left: 0;
+ }
+}
+@media (max-width: 480px) {
+ .tablist-collapse {
+ -webkit-transform: translate3d(0, 0, 0);
+ }
+ .page-header h1 small {
+ display: block;
+ line-height: 20px;
+ }
+}
+@media (min-width: 768px) and (max-width: 979px) {
+ .row {
+ margin-left: -20px;
+ *zoom: 1;
+ }
+ .row:before,
+ .row:after {
+ display: table;
+ content: "";
+ line-height: 0;
+ }
+ .row:after {
+ clear: both;
+ }
+ [class*="span"] {
+ float: left;
+ min-height: 1px;
+ margin-left: 20px;
+ }
+ .container {
+ width: 724px;
+ }
+}
+@media (min-width: 1200px) {
+ .row {
+ margin-left: -30px;
+ *zoom: 1;
+ }
+ .row:before,
+ .row:after {
+ display: table;
+ content: "";
+ line-height: 0;
+ }
+ .row:after {
+ clear: both;
+ }
+ [class*="span"] {
+ float: left;
+ min-height: 1px;
+ margin-left: 30px;
+ }
+ .container {
+ width: 1070px;
+ }
+}
+@media (max-width: 979px) {
+ body {
+ padding-top: 0;
+ }
+}
+@media (min-width: 980px) {
+ .tablist-collapse.collapse {
+ height: auto !important;
+ overflow: visible !important;
+ }
+}
+.tablistbar .brand {
+ padding: 5px;
+ margin-left: 0;
+}
+.tablistbar .brand img {
+ width: 30px;
+ vertical-align: middle;
}
+h1 small {
+ font-size: 18px;
+}
+
+h1 small,
+h2 small,
+h3 small,
+h4 small,
+h5 small,
+h6 small,
+.page-header small {
+ line-height: 0.8;
+ font-weight: normal;
+ color: #999999;
+ display:block;
+ vertical-align: middle;
+}
+
+.page-header h1, h1:first-child {
+ font-size: 40px;
+ padding-bottom: 5px;
+}
+
+.page-header h1 {
+ border-bottom: 1px solid #999999;
+ padding-bottom: 9px;
+}
+
+.page-header img {
+ height: 80px;
+ padding-bottom: 5px;
+}
+
+.page-header small {
+ line-height: 1.1;
+ font-size: 18px;
+}
+
+h2,
+h3,
+h4,
+div.ah,
.title {
- font-weight: bold;
- margin: 10px 2px;
- background-color: #7BB37B;
- border: 1px solid #6A996A;
- color: #151515;
- font-size: 1.2em;
- padding-bottom: 0.2em;
- padding-left: 0.4em;
- padding-top: 0.2em;
+ border-color: #D6E9C6;
+ color: #468847;
+ border-style: solid;
+ border-width: 0 0 1px;
+ padding-left: 0.5em;
}
-h2 {
- font-size: 120%;
+
+.google {
+ color: white;
}
-h3 {
- font-size: 100%;
+.breadcrumb {
+ font-size: 11px;
+ padding-top: 2px;
+ padding-bottom: 2px;
+}
+
+h1 a,
+h2 a,
+h3 a,
+h4 a {
+ color: inherit;
+}
+
+.tablistbar-inner a {
+ font-weight: bold;
+}
+
+.list-2panes:before,
+.list-2panes:after {
+ display: table;
+ content: "";
+ line-height: 0;
+}
+
+.list-2panes:after {
+ clear:both;
+}
+
+.list-2panes li {
+ width: 470px;
+ width: 470px;
+ float: left;
+ margin-left: 30px;
+ min-height: 1px;
}
+/* The standard CSS for doxygen */
+
+/* @group Heading Levels */
+
dt {
font-weight: bold;
@@ -70,18 +1176,18 @@ h3.version {
text-align: center;
}
-div.qindex, div.navtab{
+div.qindex, div.tablisttab{
background-color: #EBF6EB;
border: 1px solid #A3D7A3;
text-align: center;
}
-div.qindex, div.navpath {
+div.qindex, div.tablistpath {
width: 100%;
line-height: 140%;
}
-div.navtab {
+div.tablisttab {
margin-right: 15px;
}
@@ -153,24 +1259,6 @@ pre.fragment {
line-height: 125%;
}
-div.ah {
- background-color: black;
- font-weight: bold;
- color: #ffffff;
- margin-bottom: 3px;
- margin-top: 3px;
- padding: 0.2em;
- border: solid thin #333;
- border-radius: 0.5em;
- -webkit-border-radius: .5em;
- -moz-border-radius: .5em;
- box-shadow: 2px 2px 3px #999;
- -webkit-box-shadow: 2px 2px 3px #999;
- -moz-box-shadow: rgba(0, 0, 0, 0.15) 2px 2px 2px;
- background-image: -webkit-gradient(linear, left top, left bottom, from(#eee), to(#000),color-stop(0.3, #444));
- background-image: -moz-linear-gradient(center top, #eee 0%, #444 40%, #000);
-}
-
div.groupHeader {
margin-left: 16px;
margin-top: 12px;
@@ -189,21 +1277,10 @@ div.contents {
}
td.indexkey {
- background-color: #EBF6EB;
- font-weight: bold;
- border: 1px solid #C4E5C4;
- margin: 2px 0px 2px 0;
- padding: 2px 10px;
- white-space: nowrap;
- vertical-align: top;
+ white-space: nowrap;
+ vertical-align: top;
}
-td.indexvalue {
- background-color: #EBF6EB;
- border: 1px solid #C4E5C4;
- padding: 2px 10px;
- margin: 2px 0px;
-}
tr.memlist {
background-color: #EEF7EE;
@@ -696,7 +1773,7 @@ table.fieldtable {
font-size: 13px;
}
-.navpath ul
+.tablistpath ul
{
font-size: 11px;
background-image:url('tab_b.png');
@@ -710,7 +1787,7 @@ table.fieldtable {
padding:0px;
}
-.navpath li
+.tablistpath li
{
list-style-type:none;
float:left;
@@ -722,7 +1799,7 @@ table.fieldtable {
color:#367C36;
}
-.navpath li.navelem a
+.tablistpath li.tablistelem a
{
height:32px;
display:block;
@@ -730,12 +1807,12 @@ table.fieldtable {
outline: none;
}
-.navpath li.navelem a:hover
+.tablistpath li.tablistelem a:hover
{
color:#68BD68;
}
-.navpath li.footer
+.tablistpath li.footer
{
list-style-type:none;
float:right;
@@ -937,161 +2014,6 @@ dl.citelist dd {
}
}
-/* tabs */
-
-.tabs, .tabs2, .tabs3 {
- z-index: 101;
-}
-
-.tablist {
- margin: auto;
- display: table;
-}
-
-.tablist li {
- float: left;
- display: table-cell;
- list-style: none;
- margin:0 4px;
-}
-
-.tablist a {
- display: block;
- padding: 0 0.3em;
- color: #285D28;
- text-decoration: none;
- outline: none;
-}
-
-.tabs3 .tablist a {
- padding-left: 10px;
-}
-
-
-/* libav.org stylesheet */
-
-a {
- color: #2D6198;
-}
-
-a:visited {
- color: #884488;
-}
-
-h1 a, h2 a, h3 a {
- text-decoration: inherit;
- color: inherit;
-}
-
-#body {
- margin: 0 1em;
-}
-
-body {
- background-color: #313131;
- margin: 0;
-}
-
-.center {
- margin-left: auto;
- margin-right: auto;
- text-align: center;
-}
-
-#container {
- background-color: white;
- color: #202020;
- margin-left: 1em;
- margin-right: 1em;
-}
-
-h1 {
- background-color: #7BB37B;
- border: 1px solid #6A996A;
- color: #151515;
- font-size: 1.2em;
- padding-bottom: 0.2em;
- padding-left: 0.4em;
- padding-top: 0.2em;
-}
-
-h2 {
- color: #313131;
- font-size: 1.2em;
-}
-
-h3 {
- color: #313131;
- font-size: 0.8em;
- margin-bottom: -8px;
-}
-
-img {
- border: 0;
-}
-
-.tabs {
- margin-top: 12px;
- border-top: 1px solid #5C665C;
-}
-
-.tabs, .tabs2, .tabs3, .tabs4 {
- background-color: #738073;
- border-bottom: 1px solid #5C665C;
- border-left: 1px solid #5C665C;
- border-right: 1px solid #5C665C;
- position: relative;
- text-align: center;
-}
-
-.tabs a,
-.tabs2 a,
-.tabs3 a,
-.tabs4 a {
- color: white;
- padding: 0.3em;
- text-decoration: none;
-}
-
-
-.tabs ul,
-.tabs2 ul,
-.tabs3 ul,
-.tabs4 ul {
- padding: 0;
-}
-
-.tabs li.current a,
-.tabs2 li.current a,
-.tabs3 li.current a,
-.tabs4 li.current a {
- background-color: #414141;
- color: white;
- text-decoration: none;
-}
-
-.tabs a:hover,
-.tabs2 a:hover,
-.tabs3 a:hover,
-.tabs4 a:hover {
- background-color: #313131 !important;
- color: white;
- text-decoration: none;
-}
-
-p {
- margin-left: 1em;
- margin-right: 1em;
-}
-
-table {
- margin-left: 2em;
-}
-
-pre {
- margin-left: 2em;
-}
-
#proj_desc {
font-size: 1.2em;
}
diff --git a/gst-libs/ext/libav/doc/doxy/footer.html b/gst-libs/ext/libav/doc/doxy/footer.html
index 7217351..101e6fe 100644
--- a/gst-libs/ext/libav/doc/doxy/footer.html
+++ b/gst-libs/ext/libav/doc/doxy/footer.html
@@ -1,10 +1,9 @@
- </div>
-
- <div id="footer">
- Generated on $datetime for $projectname by&#160;<a href="http://www.doxygen.org/index.html">doxygen</a> $doxygenversion
- </div>
+ <footer class="footer pagination-right">
+ <span class="label label-info">
+ Generated on $datetime for $projectname by&#160;<a href="http://www.doxygen.org/index.html">doxygen</a> $doxygenversion
+ </span>
+ </footer>
</div>
-
</body>
</html>
diff --git a/gst-libs/ext/libav/doc/doxy/header.html b/gst-libs/ext/libav/doc/doxy/header.html
index 9e57c98..312990c 100644
--- a/gst-libs/ext/libav/doc/doxy/header.html
+++ b/gst-libs/ext/libav/doc/doxy/header.html
@@ -1,14 +1,16 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
+<!DOCTYPE html>
+<html>
<head>
-<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<!--BEGIN PROJECT_NAME--><title>$projectname: $title</title><!--END PROJECT_NAME-->
<!--BEGIN !PROJECT_NAME--><title>$title</title><!--END !PROJECT_NAME-->
<link href="$relpath$doxy_stylesheet.css" rel="stylesheet" type="text/css" />
+<!--Header replace -->
+
</head>
-<div id="container">
+<div class="container">
-<div id="body">
- <div>
+<!--Header replace -->
+<div class="menu">
diff --git a/gst-libs/ext/libav/doc/eval.texi b/gst-libs/ext/libav/doc/eval.texi
index 7f8f365..e1fd7ee 100644
--- a/gst-libs/ext/libav/doc/eval.texi
+++ b/gst-libs/ext/libav/doc/eval.texi
@@ -34,6 +34,8 @@ The following functions are available:
@item abs(x)
@item squish(x)
@item gauss(x)
+@item isinf(x)
+Return 1.0 if @var{x} is +/-INFINITY, 0.0 otherwise.
@item isnan(x)
Return 1.0 if @var{x} is NAN, 0.0 otherwise.
diff --git a/gst-libs/ext/libav/doc/faq.texi b/gst-libs/ext/libav/doc/faq.texi
index 7c5373c..088ca03 100644
--- a/gst-libs/ext/libav/doc/faq.texi
+++ b/gst-libs/ext/libav/doc/faq.texi
@@ -216,15 +216,14 @@ equally humble @code{copy} under Windows), and finally transcoding back to your
format of choice.
@example
-avconv -i input1.avi -same_quant intermediate1.mpg
-avconv -i input2.avi -same_quant intermediate2.mpg
+avconv -i input1.avi intermediate1.mpg
+avconv -i input2.avi intermediate2.mpg
cat intermediate1.mpg intermediate2.mpg > intermediate_all.mpg
-avconv -i intermediate_all.mpg -same_quant output.avi
+avconv -i intermediate_all.mpg output.avi
@end example
-Notice that you should either use @code{-same_quant} or set a reasonably high
-bitrate for your intermediate and output files, if you want to preserve
-video quality.
+Notice that you should set a reasonably high bitrate for your intermediate and
+output files, if you want to preserve video quality.
Also notice that you may avoid the huge intermediate files by taking advantage
of named pipes, should your platform support it:
@@ -232,10 +231,10 @@ of named pipes, should your platform support it:
@example
mkfifo intermediate1.mpg
mkfifo intermediate2.mpg
-avconv -i input1.avi -same_quant -y intermediate1.mpg < /dev/null &
-avconv -i input2.avi -same_quant -y intermediate2.mpg < /dev/null &
+avconv -i input1.avi -y intermediate1.mpg < /dev/null &
+avconv -i input2.avi -y intermediate2.mpg < /dev/null &
cat intermediate1.mpg intermediate2.mpg |\
-avconv -f mpeg -i - -same_quant -c:v mpeg4 -acodec libmp3lame output.avi
+avconv -f mpeg -i - -c:v mpeg4 -acodec libmp3lame output.avi
@end example
Similarly, the yuv4mpegpipe format, and the raw video, raw audio codecs also
@@ -262,7 +261,7 @@ cat temp1.a temp2.a > all.a &
cat temp1.v temp2.v > all.v &
avconv -f u16le -acodec pcm_s16le -ac 2 -ar 44100 -i all.a \
-f yuv4mpegpipe -i all.v \
- -same_quant -y output.flv
+ -y output.flv
rm temp[12].[av] all.[av]
@end example
@@ -302,27 +301,8 @@ with @code{#ifdef}s related to the compiler.
@section Is Microsoft Visual C++ supported?
-No. Microsoft Visual C++ is not compliant to the C99 standard and does
-not - among other things - support the inline assembly used in Libav.
-If you wish to use MSVC++ for your
-project then you can link the MSVC++ code with libav* as long as
-you compile the latter with a working C compiler. For more information, see
-the @emph{Microsoft Visual C++ compatibility} section in the Libav
-documentation.
-
-There have been efforts to make Libav compatible with MSVC++ in the
-past. However, they have all been rejected as too intrusive, especially
-since MinGW does the job adequately. None of the core developers
-work with MSVC++ and thus this item is low priority. Should you find
-the silver bullet that solves this problem, feel free to shoot it at us.
-
-We strongly recommend you to move over from MSVC++ to MinGW tools.
-
-@section Can I use Libav under Windows?
-
-Yes, but the Cygwin or MinGW tools @emph{must} be used to compile Libav.
-Read the @emph{Windows} section in the Libav documentation to find more
-information.
+Yes. Please see the @uref{platform.html, Microsoft Visual C++}
+section in the Libav documentation.
@section Can you add automake, libtool or autoconf support?
@@ -356,8 +336,8 @@ to use them you have to append -D__STDC_CONSTANT_MACROS to your CXXFLAGS
@section I have a file in memory / a API different from *open/*read/ libc how do I use it with libavformat?
-You have to implement a URLProtocol, see @file{libavformat/file.c} in
-Libav and @file{libmpdemux/demux_lavf.c} in MPlayer sources.
+You have to create a custom AVIOContext using @code{avio_alloc_context},
+see @file{libavformat/aviobuf.c} in Libav and @file{libmpdemux/demux_lavf.c} in MPlayer2 sources.
@section Why is @code{make fate} not running all tests?
diff --git a/gst-libs/ext/libav/doc/fate.texi b/gst-libs/ext/libav/doc/fate.texi
index 9141eeb..975f40a 100644
--- a/gst-libs/ext/libav/doc/fate.texi
+++ b/gst-libs/ext/libav/doc/fate.texi
@@ -26,9 +26,12 @@ that is provided separately from the actual source distribution.
To inform the build system about the testsuite location, pass
@option{--samples=<path to the samples>} to @command{configure} or set the
-@var{SAMPLES} Make variable or the @var{FATE_SAMPLES} environment variable
+@var{SAMPLES} Make variable or the @var{LIBAV_SAMPLES} environment variable
to a suitable value.
+To use a custom wrapper to run the test, pass @option{--target-exec} to
+@command{configure} or set the @var{TARGET_EXEC} Make variable.
+
The dataset is available through @command{rsync}, is possible to fetch
the current sample using the straight rsync command or through a specific
@ref{Makefile target}.
@@ -57,7 +60,7 @@ Shortcut to download the fate test samples to the specified testsuite location.
Run the FATE test suite (requires the fate-suite dataset).
@end table
-@section Fate Makefile variables
+@section FATE Makefile variables
@table @option
@item V
Verbosity level, can be set to 0, 1 or 2.
@@ -75,18 +78,26 @@ meaning only while running the regression tests.
@item THREADS
Specify how many threads to use while running regression tests, it is
quite useful to detect thread-related regressions.
+@item THREAD_TYPE
+Specify which threading strategy test, either @var{slice} or @var{frame},
+by default @var{slice+frame}
+@item CPUFLAGS
+Specify a mask to be applied to autodetected CPU flags.
+@item TARGET_EXEC
+Specify or override the wrapper used to run the tests.
@end table
@example
- make V=1 SAMPLES=/var/fate/samples THREADS=2 fate
+ make V=1 SAMPLES=/var/fate/samples THREADS=2 CPUFLAGS=mmx fate
@end example
@chapter Automated Tests
In order to automatically testing specific configurations, e.g. multiple
compilers, @command{tests/fate.sh} is provided.
-This shell script builds Libav, runs the regression tests and prepares a
-report that can be sent to @url{fate.libav.org} or directly examined locally.
+This shell script builds Libav, runs the regression tests and prepares
+a report that can be sent to @url{http://fate.libav.org/} or directly
+examined locally.
@section Testing Profiles
The configuration file passed to @command{fate.sh} is shell scripts as well.
@@ -128,8 +139,12 @@ makeopts= # extra options passed to 'make'
# stdout, defaults to 'tar c'
@end example
+@section Special Instances
+The @var{TARGET_EXEC} option provides a way to run FATE wrapped in
+@command{valgrind}, @command{qemu-user} or @command{wine} or on remote targets
+through @command{ssh}.
+
@section Submitting Reports
In order to send reports you need to create an @command{ssh} key and send it
to @email{root@@libav.org}.
The current server fingerprint is @var{a4:99:d7:d3:1c:92:0d:56:d6:d5:61:be:01:ae:7d:e6}
-
diff --git a/gst-libs/ext/libav/doc/ffmpeg.texi b/gst-libs/ext/libav/doc/ffmpeg.texi
deleted file mode 100644
index 968d4f6..0000000
--- a/gst-libs/ext/libav/doc/ffmpeg.texi
+++ /dev/null
@@ -1,1091 +0,0 @@
-\input texinfo @c -*- texinfo -*-
-
-@settitle ffmpeg Documentation
-@titlepage
-@center @titlefont{ffmpeg Documentation}
-@end titlepage
-
-@top
-
-@contents
-
-@chapter Synopsis
-
-The generic syntax is:
-
-@example
-@c man begin SYNOPSIS
-ffmpeg [[infile options][@option{-i} @var{infile}]]... @{[outfile options] @var{outfile}@}...
-@c man end
-@end example
-
-@chapter Description
-@c man begin DESCRIPTION
-
-ffmpeg is a very fast video and audio converter that can also grab from
-a live audio/video source. It can also convert between arbitrary sample
-rates and resize video on the fly with a high quality polyphase filter.
-
-The command line interface is designed to be intuitive, in the sense
-that ffmpeg tries to figure out all parameters that can possibly be
-derived automatically. You usually only have to specify the target
-bitrate you want.
-
-As a general rule, options are applied to the next specified
-file. Therefore, order is important, and you can have the same
-option on the command line multiple times. Each occurrence is
-then applied to the next input or output file.
-
-@itemize
-@item
-To set the video bitrate of the output file to 64kbit/s:
-@example
-ffmpeg -i input.avi -b 64k output.avi
-@end example
-
-@item
-To force the frame rate of the output file to 24 fps:
-@example
-ffmpeg -i input.avi -r 24 output.avi
-@end example
-
-@item
-To force the frame rate of the input file (valid for raw formats only)
-to 1 fps and the frame rate of the output file to 24 fps:
-@example
-ffmpeg -r 1 -i input.m2v -r 24 output.avi
-@end example
-@end itemize
-
-The format option may be needed for raw input files.
-
-By default ffmpeg tries to convert as losslessly as possible: It
-uses the same audio and video parameters for the outputs as the one
-specified for the inputs.
-
-@c man end DESCRIPTION
-
-@chapter Options
-@c man begin OPTIONS
-
-@include avtools-common-opts.texi
-
-@section Main options
-
-@table @option
-
-@item -f @var{fmt}
-Force format.
-
-@item -i @var{filename}
-input file name
-
-@item -y
-Overwrite output files.
-
-@item -t @var{duration}
-Restrict the transcoded/captured video sequence
-to the duration specified in seconds.
-@code{hh:mm:ss[.xxx]} syntax is also supported.
-
-@item -fs @var{limit_size}
-Set the file size limit.
-
-@item -ss @var{position}
-Seek to given time position in seconds.
-@code{hh:mm:ss[.xxx]} syntax is also supported.
-
-@item -itsoffset @var{offset}
-Set the input time offset in seconds.
-@code{[-]hh:mm:ss[.xxx]} syntax is also supported.
-This option affects all the input files that follow it.
-The offset is added to the timestamps of the input files.
-Specifying a positive offset means that the corresponding
-streams are delayed by 'offset' seconds.
-
-@item -timestamp @var{time}
-Set the recording timestamp in the container.
-The syntax for @var{time} is:
-@example
-now|([(YYYY-MM-DD|YYYYMMDD)[T|t| ]]((HH[:MM[:SS[.m...]]])|(HH[MM[SS[.m...]]]))[Z|z])
-@end example
-If the value is "now" it takes the current time.
-Time is local time unless 'Z' or 'z' is appended, in which case it is
-interpreted as UTC.
-If the year-month-day part is not specified it takes the current
-year-month-day.
-
-@item -metadata @var{key}=@var{value}
-Set a metadata key/value pair.
-
-For example, for setting the title in the output file:
-@example
-ffmpeg -i in.avi -metadata title="my title" out.flv
-@end example
-
-@item -v @var{number}
-Set the logging verbosity level.
-
-@item -target @var{type}
-Specify target file type ("vcd", "svcd", "dvd", "dv", "dv50", "pal-vcd",
-"ntsc-svcd", ... ). All the format options (bitrate, codecs,
-buffer sizes) are then set automatically. You can just type:
-
-@example
-ffmpeg -i myfile.avi -target vcd /tmp/vcd.mpg
-@end example
-
-Nevertheless you can specify additional options as long as you know
-they do not conflict with the standard, as in:
-
-@example
-ffmpeg -i myfile.avi -target vcd -bf 2 /tmp/vcd.mpg
-@end example
-
-@item -dframes @var{number}
-Set the number of data frames to record.
-
-@item -scodec @var{codec}
-Force subtitle codec ('copy' to copy stream).
-
-@item -newsubtitle
-Add a new subtitle stream to the current output stream.
-
-@item -slang @var{code}
-Set the ISO 639 language code (3 letters) of the current subtitle stream.
-
-@end table
-
-@section Video Options
-
-@table @option
-@item -vframes @var{number}
-Set the number of video frames to record.
-@item -r @var{fps}
-Set frame rate (Hz value, fraction or abbreviation), (default = 25).
-@item -s @var{size}
-Set frame size. The format is @samp{wxh} (avserver default = 160x128, ffmpeg default = same as source).
-The following abbreviations are recognized:
-@table @samp
-@item sqcif
-128x96
-@item qcif
-176x144
-@item cif
-352x288
-@item 4cif
-704x576
-@item 16cif
-1408x1152
-@item qqvga
-160x120
-@item qvga
-320x240
-@item vga
-640x480
-@item svga
-800x600
-@item xga
-1024x768
-@item uxga
-1600x1200
-@item qxga
-2048x1536
-@item sxga
-1280x1024
-@item qsxga
-2560x2048
-@item hsxga
-5120x4096
-@item wvga
-852x480
-@item wxga
-1366x768
-@item wsxga
-1600x1024
-@item wuxga
-1920x1200
-@item woxga
-2560x1600
-@item wqsxga
-3200x2048
-@item wquxga
-3840x2400
-@item whsxga
-6400x4096
-@item whuxga
-7680x4800
-@item cga
-320x200
-@item ega
-640x350
-@item hd480
-852x480
-@item hd720
-1280x720
-@item hd1080
-1920x1080
-@end table
-
-@item -aspect @var{aspect}
-Set the video display aspect ratio specified by @var{aspect}.
-
-@var{aspect} can be a floating point number string, or a string of the
-form @var{num}:@var{den}, where @var{num} and @var{den} are the
-numerator and denominator of the aspect ratio. For example "4:3",
-"16:9", "1.3333", and "1.7777" are valid argument values.
-
-@item -croptop @var{size}
-@item -cropbottom @var{size}
-@item -cropleft @var{size}
-@item -cropright @var{size}
-All the crop options have been removed. Use -vf
-crop=width:height:x:y instead.
-
-@item -padtop @var{size}
-@item -padbottom @var{size}
-@item -padleft @var{size}
-@item -padright @var{size}
-@item -padcolor @var{hex_color}
-All the pad options have been removed. Use -vf
-pad=width:height:x:y:color instead.
-@item -vn
-Disable video recording.
-@item -bt @var{tolerance}
-Set video bitrate tolerance (in bits, default 4000k).
-Has a minimum value of: (target_bitrate/target_framerate).
-In 1-pass mode, bitrate tolerance specifies how far ratecontrol is
-willing to deviate from the target average bitrate value. This is
-not related to min/max bitrate. Lowering tolerance too much has
-an adverse effect on quality.
-@item -maxrate @var{bitrate}
-Set max video bitrate (in bit/s).
-Requires -bufsize to be set.
-@item -minrate @var{bitrate}
-Set min video bitrate (in bit/s).
-Most useful in setting up a CBR encode:
-@example
-ffmpeg -i myfile.avi -b 4000k -minrate 4000k -maxrate 4000k -bufsize 1835k out.m2v
-@end example
-It is of little use elsewise.
-@item -bufsize @var{size}
-Set video buffer verifier buffer size (in bits).
-@item -vcodec @var{codec}
-Force video codec to @var{codec}. Use the @code{copy} special value to
-tell that the raw codec data must be copied as is.
-@item -sameq
-Use same quantizer as source (implies VBR).
-
-@item -pass @var{n}
-Select the pass number (1 or 2). It is used to do two-pass
-video encoding. The statistics of the video are recorded in the first
-pass into a log file (see also the option -passlogfile),
-and in the second pass that log file is used to generate the video
-at the exact requested bitrate.
-On pass 1, you may just deactivate audio and set output to null,
-examples for Windows and Unix:
-@example
-ffmpeg -i foo.mov -vcodec libxvid -pass 1 -an -f rawvideo -y NUL
-ffmpeg -i foo.mov -vcodec libxvid -pass 1 -an -f rawvideo -y /dev/null
-@end example
-
-@item -passlogfile @var{prefix}
-Set two-pass log file name prefix to @var{prefix}, the default file name
-prefix is ``ffmpeg2pass''. The complete file name will be
-@file{PREFIX-N.log}, where N is a number specific to the output
-stream.
-
-@item -newvideo
-Add a new video stream to the current output stream.
-
-@item -vlang @var{code}
-Set the ISO 639 language code (3 letters) of the current video stream.
-
-@item -vf @var{filter_graph}
-@var{filter_graph} is a description of the filter graph to apply to
-the input video.
-Use the option "-filters" to show all the available filters (including
-also sources and sinks).
-
-@end table
-
-@section Advanced Video Options
-
-@table @option
-@item -pix_fmt @var{format}
-Set pixel format. Use 'list' as parameter to show all the supported
-pixel formats.
-@item -sws_flags @var{flags}
-Set SwScaler flags.
-@item -g @var{gop_size}
-Set the group of pictures size.
-@item -intra
-Use only intra frames.
-@item -vdt @var{n}
-Discard threshold.
-@item -qscale @var{q}
-Use fixed video quantizer scale (VBR).
-@item -qmin @var{q}
-minimum video quantizer scale (VBR)
-@item -qmax @var{q}
-maximum video quantizer scale (VBR)
-@item -qdiff @var{q}
-maximum difference between the quantizer scales (VBR)
-@item -qblur @var{blur}
-video quantizer scale blur (VBR) (range 0.0 - 1.0)
-@item -qcomp @var{compression}
-video quantizer scale compression (VBR) (default 0.5).
-Constant of ratecontrol equation. Recommended range for default rc_eq: 0.0-1.0
-
-@item -lmin @var{lambda}
-minimum video lagrange factor (VBR)
-@item -lmax @var{lambda}
-max video lagrange factor (VBR)
-@item -mblmin @var{lambda}
-minimum macroblock quantizer scale (VBR)
-@item -mblmax @var{lambda}
-maximum macroblock quantizer scale (VBR)
-
-These four options (lmin, lmax, mblmin, mblmax) use 'lambda' units,
-but you may use the QP2LAMBDA constant to easily convert from 'q' units:
-@example
-ffmpeg -i src.ext -lmax 21*QP2LAMBDA dst.ext
-@end example
-
-@item -rc_init_cplx @var{complexity}
-initial complexity for single pass encoding
-@item -b_qfactor @var{factor}
-qp factor between P- and B-frames
-@item -i_qfactor @var{factor}
-qp factor between P- and I-frames
-@item -b_qoffset @var{offset}
-qp offset between P- and B-frames
-@item -i_qoffset @var{offset}
-qp offset between P- and I-frames
-@item -rc_eq @var{equation}
-Set rate control equation (see section "Expression Evaluation")
-(default = @code{tex^qComp}).
-
-When computing the rate control equation expression, besides the
-standard functions defined in the section "Expression Evaluation", the
-following functions are available:
-@table @var
-@item bits2qp(bits)
-@item qp2bits(qp)
-@end table
-
-and the following constants are available:
-@table @var
-@item iTex
-@item pTex
-@item tex
-@item mv
-@item fCode
-@item iCount
-@item mcVar
-@item var
-@item isI
-@item isP
-@item isB
-@item avgQP
-@item qComp
-@item avgIITex
-@item avgPITex
-@item avgPPTex
-@item avgBPTex
-@item avgTex
-@end table
-
-@item -rc_override @var{override}
-rate control override for specific intervals
-@item -me_method @var{method}
-Set motion estimation method to @var{method}.
-Available methods are (from lowest to best quality):
-@table @samp
-@item zero
-Try just the (0, 0) vector.
-@item phods
-@item log
-@item x1
-@item hex
-@item umh
-@item epzs
-(default method)
-@item full
-exhaustive search (slow and marginally better than epzs)
-@end table
-
-@item -dct_algo @var{algo}
-Set DCT algorithm to @var{algo}. Available values are:
-@table @samp
-@item 0
-FF_DCT_AUTO (default)
-@item 1
-FF_DCT_FASTINT
-@item 2
-FF_DCT_INT
-@item 3
-FF_DCT_MMX
-@item 4
-FF_DCT_MLIB
-@item 5
-FF_DCT_ALTIVEC
-@end table
-
-@item -idct_algo @var{algo}
-Set IDCT algorithm to @var{algo}. Available values are:
-@table @samp
-@item 0
-FF_IDCT_AUTO (default)
-@item 1
-FF_IDCT_INT
-@item 2
-FF_IDCT_SIMPLE
-@item 3
-FF_IDCT_SIMPLEMMX
-@item 4
-FF_IDCT_LIBMPEG2MMX
-@item 5
-FF_IDCT_PS2
-@item 6
-FF_IDCT_MLIB
-@item 7
-FF_IDCT_ARM
-@item 8
-FF_IDCT_ALTIVEC
-@item 9
-FF_IDCT_SH4
-@item 10
-FF_IDCT_SIMPLEARM
-@end table
-
-@item -er @var{n}
-Set error resilience to @var{n}.
-@table @samp
-@item 1
-FF_ER_CAREFUL (default)
-@item 2
-FF_ER_COMPLIANT
-@item 3
-FF_ER_AGGRESSIVE
-@item 4
-FF_ER_EXPLODE
-@end table
-
-@item -ec @var{bit_mask}
-Set error concealment to @var{bit_mask}. @var{bit_mask} is a bit mask of
-the following values:
-@table @samp
-@item 1
-FF_EC_GUESS_MVS (default = enabled)
-@item 2
-FF_EC_DEBLOCK (default = enabled)
-@end table
-
-@item -bf @var{frames}
-Use 'frames' B-frames (supported for MPEG-1, MPEG-2 and MPEG-4).
-@item -mbd @var{mode}
-macroblock decision
-@table @samp
-@item 0
-FF_MB_DECISION_SIMPLE: Use mb_cmp (cannot change it yet in ffmpeg).
-@item 1
-FF_MB_DECISION_BITS: Choose the one which needs the fewest bits.
-@item 2
-FF_MB_DECISION_RD: rate distortion
-@end table
-
-@item -4mv
-Use four motion vector by macroblock (MPEG-4 only).
-@item -part
-Use data partitioning (MPEG-4 only).
-@item -bug @var{param}
-Work around encoder bugs that are not auto-detected.
-@item -strict @var{strictness}
-How strictly to follow the standards.
-@item -aic
-Enable Advanced intra coding (h263+).
-@item -umv
-Enable Unlimited Motion Vector (h263+)
-
-@item -deinterlace
-Deinterlace pictures.
-@item -ilme
-Force interlacing support in encoder (MPEG-2 and MPEG-4 only).
-Use this option if your input file is interlaced and you want
-to keep the interlaced format for minimum losses.
-The alternative is to deinterlace the input stream with
-@option{-deinterlace}, but deinterlacing introduces losses.
-@item -psnr
-Calculate PSNR of compressed frames.
-@item -vstats
-Dump video coding statistics to @file{vstats_HHMMSS.log}.
-@item -vstats_file @var{file}
-Dump video coding statistics to @var{file}.
-@item -top @var{n}
-top=1/bottom=0/auto=-1 field first
-@item -dc @var{precision}
-Intra_dc_precision.
-@item -vtag @var{fourcc/tag}
-Force video tag/fourcc.
-@item -qphist
-Show QP histogram.
-@item -vbsf @var{bitstream_filter}
-Bitstream filters available are "dump_extra", "remove_extra", "noise", "h264_mp4toannexb", "imxdump", "mjpegadump", "mjpeg2jpeg".
-@example
-ffmpeg -i h264.mp4 -vcodec copy -vbsf h264_mp4toannexb -an out.h264
-@end example
-@item -force_key_frames @var{time}[,@var{time}...]
-Force key frames at the specified timestamps, more precisely at the first
-frames after each specified time.
-This option can be useful to ensure that a seek point is present at a
-chapter mark or any other designated place in the output file.
-The timestamps must be specified in ascending order.
-@end table
-
-@section Audio Options
-
-@table @option
-@item -aframes @var{number}
-Set the number of audio frames to record.
-@item -ar @var{freq}
-Set the audio sampling frequency. For output streams it is set by
-default to the frequency of the corresponding input stream. For input
-streams this option only makes sense for audio grabbing devices and raw
-demuxers and is mapped to the corresponding demuxer options.
-@item -aq @var{q}
-Set the audio quality (codec-specific, VBR).
-@item -ac @var{channels}
-Set the number of audio channels. For output streams it is set by
-default to the number of input audio channels. For input streams
-this option only makes sense for audio grabbing devices and raw demuxers
-and is mapped to the corresponding demuxer options.
-@item -an
-Disable audio recording.
-@item -acodec @var{codec}
-Force audio codec to @var{codec}. Use the @code{copy} special value to
-specify that the raw codec data must be copied as is.
-@item -newaudio
-Add a new audio track to the output file. If you want to specify parameters,
-do so before @code{-newaudio} (@code{-acodec}, @code{-ab}, etc..).
-
-Mapping will be done automatically, if the number of output streams is equal to
-the number of input streams, else it will pick the first one that matches. You
-can override the mapping using @code{-map} as usual.
-
-Example:
-@example
-ffmpeg -i file.mpg -vcodec copy -acodec ac3 -ab 384k test.mpg -acodec mp2 -ab 192k -newaudio
-@end example
-@item -alang @var{code}
-Set the ISO 639 language code (3 letters) of the current audio stream.
-@end table
-
-@section Advanced Audio options:
-
-@table @option
-@item -atag @var{fourcc/tag}
-Force audio tag/fourcc.
-@item -audio_service_type @var{type}
-Set the type of service that the audio stream contains.
-@table @option
-@item ma
-Main Audio Service (default)
-@item ef
-Effects
-@item vi
-Visually Impaired
-@item hi
-Hearing Impaired
-@item di
-Dialogue
-@item co
-Commentary
-@item em
-Emergency
-@item vo
-Voice Over
-@item ka
-Karaoke
-@end table
-@item -absf @var{bitstream_filter}
-Bitstream filters available are "dump_extra", "remove_extra", "noise", "mp3comp", "mp3decomp".
-@end table
-
-@section Subtitle options:
-
-@table @option
-@item -scodec @var{codec}
-Force subtitle codec ('copy' to copy stream).
-@item -newsubtitle
-Add a new subtitle stream to the current output stream.
-@item -slang @var{code}
-Set the ISO 639 language code (3 letters) of the current subtitle stream.
-@item -sn
-Disable subtitle recording.
-@item -sbsf @var{bitstream_filter}
-Bitstream filters available are "mov2textsub", "text2movsub".
-@example
-ffmpeg -i file.mov -an -vn -sbsf mov2textsub -scodec copy -f rawvideo sub.txt
-@end example
-@end table
-
-@section Audio/Video grab options
-
-@table @option
-@item -vc @var{channel}
-Set video grab channel (DV1394 only).
-@item -tvstd @var{standard}
-Set television standard (NTSC, PAL (SECAM)).
-@item -isync
-Synchronize read on input.
-@end table
-
-@section Advanced options
-
-@table @option
-@item -map @var{input_file_id}.@var{input_stream_id}[:@var{sync_file_id}.@var{sync_stream_id}]
-
-Designate an input stream as a source for the output file. Each input
-stream is identified by the input file index @var{input_file_id} and
-the input stream index @var{input_stream_id} within the input
-file. Both indexes start at 0. If specified,
-@var{sync_file_id}.@var{sync_stream_id} sets which input stream
-is used as a presentation sync reference.
-
-The @code{-map} options must be specified just after the output file.
-If any @code{-map} options are used, the number of @code{-map} options
-on the command line must match the number of streams in the output
-file. The first @code{-map} option on the command line specifies the
-source for output stream 0, the second @code{-map} option specifies
-the source for output stream 1, etc.
-
-For example, if you have two audio streams in the first input file,
-these streams are identified by "0.0" and "0.1". You can use
-@code{-map} to select which stream to place in an output file. For
-example:
-@example
-ffmpeg -i INPUT out.wav -map 0.1
-@end example
-will map the input stream in @file{INPUT} identified by "0.1" to
-the (single) output stream in @file{out.wav}.
-
-For example, to select the stream with index 2 from input file
-@file{a.mov} (specified by the identifier "0.2"), and stream with
-index 6 from input @file{b.mov} (specified by the identifier "1.6"),
-and copy them to the output file @file{out.mov}:
-@example
-ffmpeg -i a.mov -i b.mov -vcodec copy -acodec copy out.mov -map 0.2 -map 1.6
-@end example
-
-To add more streams to the output file, you can use the
-@code{-newaudio}, @code{-newvideo}, @code{-newsubtitle} options.
-
-@item -map_meta_data @var{outfile}[,@var{metadata}]:@var{infile}[,@var{metadata}]
-Deprecated, use @var{-map_metadata} instead.
-
-@item -map_metadata @var{outfile}[,@var{metadata}]:@var{infile}[,@var{metadata}]
-Set metadata information of @var{outfile} from @var{infile}. Note that those
-are file indices (zero-based), not filenames.
-Optional @var{metadata} parameters specify, which metadata to copy - (g)lobal
-(i.e. metadata that applies to the whole file), per-(s)tream, per-(c)hapter or
-per-(p)rogram. All metadata specifiers other than global must be followed by the
-stream/chapter/program number. If metadata specifier is omitted, it defaults to
-global.
-
-By default, global metadata is copied from the first input file to all output files,
-per-stream and per-chapter metadata is copied along with streams/chapters. These
-default mappings are disabled by creating any mapping of the relevant type. A negative
-file index can be used to create a dummy mapping that just disables automatic copying.
-
-For example to copy metadata from the first stream of the input file to global metadata
-of the output file:
-@example
-ffmpeg -i in.ogg -map_metadata 0:0,s0 out.mp3
-@end example
-@item -map_chapters @var{outfile}:@var{infile}
-Copy chapters from @var{infile} to @var{outfile}. If no chapter mapping is specified,
-then chapters are copied from the first input file with at least one chapter to all
-output files. Use a negative file index to disable any chapter copying.
-@item -debug
-Print specific debug info.
-@item -benchmark
-Show benchmarking information at the end of an encode.
-Shows CPU time used and maximum memory consumption.
-Maximum memory consumption is not supported on all systems,
-it will usually display as 0 if not supported.
-@item -dump
-Dump each input packet.
-@item -hex
-When dumping packets, also dump the payload.
-@item -bitexact
-Only use bit exact algorithms (for codec testing).
-@item -ps @var{size}
-Set RTP payload size in bytes.
-@item -re
-Read input at native frame rate. Mainly used to simulate a grab device.
-@item -loop_input
-Loop over the input stream. Currently it works only for image
-streams. This option is used for automatic AVserver testing.
-This option is deprecated, use -loop.
-@item -loop_output @var{number_of_times}
-Repeatedly loop output for formats that support looping such as animated GIF
-(0 will loop the output infinitely).
-This option is deprecated, use -loop.
-@item -threads @var{count}
-Thread count.
-@item -vsync @var{parameter}
-Video sync method.
-
-@table @option
-@item 0
-Each frame is passed with its timestamp from the demuxer to the muxer.
-@item 1
-Frames will be duplicated and dropped to achieve exactly the requested
-constant framerate.
-@item 2
-Frames are passed through with their timestamp or dropped so as to
-prevent 2 frames from having the same timestamp.
-@item -1
-Chooses between 1 and 2 depending on muxer capabilities. This is the
-default method.
-@end table
-
-With -map you can select from which stream the timestamps should be
-taken. You can leave either video or audio unchanged and sync the
-remaining stream(s) to the unchanged one.
-
-@item -async @var{samples_per_second}
-Audio sync method. "Stretches/squeezes" the audio stream to match the timestamps,
-the parameter is the maximum samples per second by which the audio is changed.
--async 1 is a special case where only the start of the audio stream is corrected
-without any later correction.
-@item -copyts
-Copy timestamps from input to output.
-@item -copytb
-Copy input stream time base from input to output when stream copying.
-@item -shortest
-Finish encoding when the shortest input stream ends.
-@item -dts_delta_threshold
-Timestamp discontinuity delta threshold.
-@item -muxdelay @var{seconds}
-Set the maximum demux-decode delay.
-@item -muxpreload @var{seconds}
-Set the initial demux-decode delay.
-@item -streamid @var{output-stream-index}:@var{new-value}
-Assign a new stream-id value to an output stream. This option should be
-specified prior to the output filename to which it applies.
-For the situation where multiple output files exist, a streamid
-may be reassigned to a different value.
-
-For example, to set the stream 0 PID to 33 and the stream 1 PID to 36 for
-an output mpegts file:
-@example
-ffmpeg -i infile -streamid 0:33 -streamid 1:36 out.ts
-@end example
-@end table
-
-@section Preset files
-
-A preset file contains a sequence of @var{option}=@var{value} pairs,
-one for each line, specifying a sequence of options which would be
-awkward to specify on the command line. Lines starting with the hash
-('#') character are ignored and are used to provide comments. Check
-the @file{presets} directory in the Libav source tree for examples.
-
-Preset files are specified with the @code{vpre}, @code{apre},
-@code{spre}, and @code{fpre} options. The @code{fpre} option takes the
-filename of the preset instead of a preset name as input and can be
-used for any kind of codec. For the @code{vpre}, @code{apre}, and
-@code{spre} options, the options specified in a preset file are
-applied to the currently selected codec of the same type as the preset
-option.
-
-The argument passed to the @code{vpre}, @code{apre}, and @code{spre}
-preset options identifies the preset file to use according to the
-following rules:
-
-First ffmpeg searches for a file named @var{arg}.ffpreset in the
-directories @file{$AVCONV_DATADIR} (if set), and @file{$HOME/.avconv}, and in
-the datadir defined at configuration time (usually @file{PREFIX/share/avconv})
-in that order. For example, if the argument is @code{libx264-max}, it will
-search for the file @file{libx264-max.ffpreset}.
-
-If no such file is found, then ffmpeg will search for a file named
-@var{codec_name}-@var{arg}.ffpreset in the above-mentioned
-directories, where @var{codec_name} is the name of the codec to which
-the preset file options will be applied. For example, if you select
-the video codec with @code{-vcodec libx264} and use @code{-vpre max},
-then it will search for the file @file{libx264-max.ffpreset}.
-@c man end
-
-@chapter Tips
-@c man begin TIPS
-
-@itemize
-@item
-For streaming at very low bitrate application, use a low frame rate
-and a small GOP size. This is especially true for RealVideo where
-the Linux player does not seem to be very fast, so it can miss
-frames. An example is:
-
-@example
-ffmpeg -g 3 -r 3 -t 10 -b 50k -s qcif -f rv10 /tmp/b.rm
-@end example
-
-@item
-The parameter 'q' which is displayed while encoding is the current
-quantizer. The value 1 indicates that a very good quality could
-be achieved. The value 31 indicates the worst quality. If q=31 appears
-too often, it means that the encoder cannot compress enough to meet
-your bitrate. You must either increase the bitrate, decrease the
-frame rate or decrease the frame size.
-
-@item
-If your computer is not fast enough, you can speed up the
-compression at the expense of the compression ratio. You can use
-'-me zero' to speed up motion estimation, and '-intra' to disable
-motion estimation completely (you have only I-frames, which means it
-is about as good as JPEG compression).
-
-@item
-To have very low audio bitrates, reduce the sampling frequency
-(down to 22050 Hz for MPEG audio, 22050 or 11025 for AC-3).
-
-@item
-To have a constant quality (but a variable bitrate), use the option
-'-qscale n' when 'n' is between 1 (excellent quality) and 31 (worst
-quality).
-
-@item
-When converting video files, you can use the '-sameq' option which
-uses the same quality factor in the encoder as in the decoder.
-It allows almost lossless encoding.
-
-@end itemize
-@c man end TIPS
-
-@chapter Examples
-@c man begin EXAMPLES
-
-@section Video and Audio grabbing
-
-If you specify the input format and device then ffmpeg can grab video
-and audio directly.
-
-@example
-ffmpeg -f oss -i /dev/dsp -f video4linux2 -i /dev/video0 /tmp/out.mpg
-@end example
-
-Note that you must activate the right video source and channel before
-launching ffmpeg with any TV viewer such as
-@uref{http://linux.bytesex.org/xawtv/, xawtv} by Gerd Knorr. You also
-have to set the audio recording levels correctly with a
-standard mixer.
-
-@section X11 grabbing
-
-Grab the X11 display with ffmpeg via
-
-@example
-ffmpeg -f x11grab -s cif -r 25 -i :0.0 /tmp/out.mpg
-@end example
-
-0.0 is display.screen number of your X11 server, same as
-the DISPLAY environment variable.
-
-@example
-ffmpeg -f x11grab -s cif -r 25 -i :0.0+10,20 /tmp/out.mpg
-@end example
-
-10 is the x-offset and 20 the y-offset for the grabbing.
-
-@example
-ffmpeg -f x11grab -follow_mouse centered -s cif -r 25 -i :0.0 /tmp/out.mpg
-@end example
-
-The grabbing region follows the mouse pointer, which stays at the center of
-region.
-
-@example
-ffmpeg -f x11grab -follow_mouse 100 -s cif -r 25 -i :0.0 /tmp/out.mpg
-@end example
-
-Only follows when mouse pointer reaches within 100 pixels to the edge of
-region.
-
-@example
-ffmpeg -f x11grab -show_region 1 -s cif -r 25 -i :0.0+10,20 /tmp/out.mpg
-@end example
-
-The grabbing region will be indicated on screen.
-
-@example
-ffmpeg -f x11grab -follow_mouse centered -show_region 1 -s cif -r 25 -i :0.0 /tmp/out.mpg
-@end example
-
-The grabbing region indication will follow the mouse pointer.
-
-
-@section Video and Audio file format conversion
-
-Any supported file format and protocol can serve as input to ffmpeg:
-
-Examples:
-@itemize
-@item
-You can use YUV files as input:
-
-@example
-ffmpeg -i /tmp/test%d.Y /tmp/out.mpg
-@end example
-
-It will use the files:
-@example
-/tmp/test0.Y, /tmp/test0.U, /tmp/test0.V,
-/tmp/test1.Y, /tmp/test1.U, /tmp/test1.V, etc...
-@end example
-
-The Y files use twice the resolution of the U and V files. They are
-raw files, without header. They can be generated by all decent video
-decoders. You must specify the size of the image with the @option{-s} option
-if ffmpeg cannot guess it.
-
-@item
-You can input from a raw YUV420P file:
-
-@example
-ffmpeg -i /tmp/test.yuv /tmp/out.avi
-@end example
-
-test.yuv is a file containing raw YUV planar data. Each frame is composed
-of the Y plane followed by the U and V planes at half vertical and
-horizontal resolution.
-
-@item
-You can output to a raw YUV420P file:
-
-@example
-ffmpeg -i mydivx.avi hugefile.yuv
-@end example
-
-@item
-You can set several input files and output files:
-
-@example
-ffmpeg -i /tmp/a.wav -s 640x480 -i /tmp/a.yuv /tmp/a.mpg
-@end example
-
-Converts the audio file a.wav and the raw YUV video file a.yuv
-to MPEG file a.mpg.
-
-@item
-You can also do audio and video conversions at the same time:
-
-@example
-ffmpeg -i /tmp/a.wav -ar 22050 /tmp/a.mp2
-@end example
-
-Converts a.wav to MPEG audio at 22050 Hz sample rate.
-
-@item
-You can encode to several formats at the same time and define a
-mapping from input stream to output streams:
-
-@example
-ffmpeg -i /tmp/a.wav -ab 64k /tmp/a.mp2 -ab 128k /tmp/b.mp2 -map 0:0 -map 0:0
-@end example
-
-Converts a.wav to a.mp2 at 64 kbits and to b.mp2 at 128 kbits. '-map
-file:index' specifies which input stream is used for each output
-stream, in the order of the definition of output streams.
-
-@item
-You can transcode decrypted VOBs:
-
-@example
-ffmpeg -i snatch_1.vob -f avi -vcodec mpeg4 -b 800k -g 300 -bf 2 -acodec libmp3lame -ab 128k snatch.avi
-@end example
-
-This is a typical DVD ripping example; the input is a VOB file, the
-output an AVI file with MPEG-4 video and MP3 audio. Note that in this
-command we use B-frames so the MPEG-4 stream is DivX5 compatible, and
-GOP size is 300 which means one intra frame every 10 seconds for 29.97fps
-input video. Furthermore, the audio stream is MP3-encoded so you need
-to enable LAME support by passing @code{--enable-libmp3lame} to configure.
-The mapping is particularly useful for DVD transcoding
-to get the desired audio language.
-
-NOTE: To see the supported input formats, use @code{ffmpeg -formats}.
-
-@item
-You can extract images from a video, or create a video from many images:
-
-For extracting images from a video:
-@example
-ffmpeg -i foo.avi -r 1 -s WxH -f image2 foo-%03d.jpeg
-@end example
-
-This will extract one video frame per second from the video and will
-output them in files named @file{foo-001.jpeg}, @file{foo-002.jpeg},
-etc. Images will be rescaled to fit the new WxH values.
-
-If you want to extract just a limited number of frames, you can use the
-above command in combination with the -vframes or -t option, or in
-combination with -ss to start extracting from a certain point in time.
-
-For creating a video from many images:
-@example
-ffmpeg -f image2 -i foo-%03d.jpeg -r 12 -s WxH foo.avi
-@end example
-
-The syntax @code{foo-%03d.jpeg} specifies to use a decimal number
-composed of three digits padded with zeroes to express the sequence
-number. It is the same syntax supported by the C printf function, but
-only formats accepting a normal integer are suitable.
-
-@item
-You can put many streams of the same type in the output:
-
-@example
-ffmpeg -i test1.avi -i test2.avi -vcodec copy -acodec copy -vcodec copy -acodec copy test12.avi -newvideo -newaudio
-@end example
-
-In addition to the first video and audio streams, the resulting
-output file @file{test12.avi} will contain the second video
-and the second audio stream found in the input streams list.
-
-The @code{-newvideo}, @code{-newaudio} and @code{-newsubtitle}
-options have to be specified immediately after the name of the output
-file to which you want to add them.
-
-@end itemize
-@c man end EXAMPLES
-
-@include eval.texi
-@include encoders.texi
-@include demuxers.texi
-@include muxers.texi
-@include indevs.texi
-@include outdevs.texi
-@include protocols.texi
-@include bitstream_filters.texi
-@include filters.texi
-@include metadata.texi
-
-@ignore
-
-@setfilename ffmpeg
-@settitle ffmpeg video converter
-
-@c man begin SEEALSO
-avplay(1), avprobe(1), avserver(1) and the Libav HTML documentation
-@c man end
-
-@c man begin AUTHORS
-The Libav developers
-@c man end
-
-@end ignore
-
-@bye
diff --git a/gst-libs/ext/libav/doc/filters.texi b/gst-libs/ext/libav/doc/filters.texi
index 8c70768..1933b17 100644
--- a/gst-libs/ext/libav/doc/filters.texi
+++ b/gst-libs/ext/libav/doc/filters.texi
@@ -14,12 +14,14 @@ number of input and output pads of the filter.
A filter with no input pads is called a "source", a filter with no
output pads is called a "sink".
+@anchor{Filtergraph syntax}
@section Filtergraph syntax
-A filtergraph can be represented using a textual representation, which
-is recognized by the @code{-vf} and @code{-af} options in @command{avconv}
-and @command{avplay}, and by the @code{av_parse_graph()} function defined in
-@file{libavfilter/avfiltergraph}.
+A filtergraph can be represented using a textual representation, which is
+recognized by the @option{-filter}/@option{-vf} and @option{-filter_complex}
+options in @command{avconv} and @option{-vf} in @command{avplay}, and by the
+@code{avfilter_graph_parse()}/@code{avfilter_graph_parse2()} function defined in
+@file{libavfilter/avfiltergraph.h}.
A filterchain consists of a sequence of connected filters, each one
connected to the previous one in the sequence. A filterchain is
@@ -76,6 +78,12 @@ In a complete filterchain all the unlabelled filter input and output
pads must be connected. A filtergraph is considered valid if all the
filter input and output pads of all the filterchains are connected.
+Libavfilter will automatically insert scale filters where format
+conversion is required. It is possible to specify swscale flags
+for those automatically inserted scalers by prepending
+@code{sws_flags=@var{flags};}
+to the filtergraph description.
+
Follows a BNF description for the filtergraph syntax:
@example
@var{NAME} ::= sequence of alphanumeric characters and '_'
@@ -84,7 +92,7 @@ Follows a BNF description for the filtergraph syntax:
@var{FILTER_ARGUMENTS} ::= sequence of chars (eventually quoted)
@var{FILTER} ::= [@var{LINKLABELS}] @var{NAME} ["=" @var{FILTER_ARGUMENTS}] [@var{LINKLABELS}]
@var{FILTERCHAIN} ::= @var{FILTER} [,@var{FILTERCHAIN}]
-@var{FILTERGRAPH} ::= @var{FILTERCHAIN} [;@var{FILTERGRAPH}]
+@var{FILTERGRAPH} ::= [sws_flags=@var{flags};] @var{FILTERCHAIN} [;@var{FILTERGRAPH}]
@end example
@c man end FILTERGRAPH DESCRIPTION
@@ -99,10 +107,312 @@ build.
Below is a description of the currently available audio filters.
+@section aformat
+
+Convert the input audio to one of the specified formats. The framework will
+negotiate the most appropriate format to minimize conversions.
+
+The filter accepts the following named parameters:
+@table @option
+
+@item sample_fmts
+A comma-separated list of requested sample formats.
+
+@item sample_rates
+A comma-separated list of requested sample rates.
+
+@item channel_layouts
+A comma-separated list of requested channel layouts.
+
+@end table
+
+If a parameter is omitted, all values are allowed.
+
+For example to force the output to either unsigned 8-bit or signed 16-bit stereo:
+@example
+aformat=sample_fmts\=u8\,s16:channel_layouts\=stereo
+@end example
+
+@section amix
+
+Mixes multiple audio inputs into a single output.
+
+For example
+@example
+avconv -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
+@end example
+will mix 3 input audio streams to a single output with the same duration as the
+first input and a dropout transition time of 3 seconds.
+
+The filter accepts the following named parameters:
+@table @option
+
+@item inputs
+Number of inputs. If unspecified, it defaults to 2.
+
+@item duration
+How to determine the end-of-stream.
+@table @option
+
+@item longest
+Duration of longest input. (default)
+
+@item shortest
+Duration of shortest input.
+
+@item first
+Duration of first input.
+
+@end table
+
+@item dropout_transition
+Transition time, in seconds, for volume renormalization when an input
+stream ends. The default value is 2 seconds.
+
+@end table
+
@section anull
Pass the audio source unchanged to the output.
+@section ashowinfo
+
+Show a line containing various information for each input audio frame.
+The input audio is not modified.
+
+The shown line contains a sequence of key/value pairs of the form
+@var{key}:@var{value}.
+
+A description of each shown parameter follows:
+
+@table @option
+@item n
+sequential number of the input frame, starting from 0
+
+@item pts
+Presentation timestamp of the input frame, in time base units; the time base
+depends on the filter input pad, and is usually 1/@var{sample_rate}.
+
+@item pts_time
+presentation timestamp of the input frame in seconds
+
+@item fmt
+sample format
+
+@item chlayout
+channel layout
+
+@item rate
+sample rate for the audio frame
+
+@item nb_samples
+number of samples (per channel) in the frame
+
+@item checksum
+Adler-32 checksum (printed in hexadecimal) of the audio data. For planar audio
+the data is treated as if all the planes were concatenated.
+
+@item plane_checksums
+A list of Adler-32 checksums for each data plane.
+@end table
+
+@section asplit
+
+Split input audio into several identical outputs.
+
+The filter accepts a single parameter which specifies the number of outputs. If
+unspecified, it defaults to 2.
+
+For example
+@example
+avconv -i INPUT -filter_complex asplit=5 OUTPUT
+@end example
+will create 5 copies of the input audio.
+
+@section asyncts
+Synchronize audio data with timestamps by squeezing/stretching it and/or
+dropping samples/adding silence when needed.
+
+The filter accepts the following named parameters:
+@table @option
+
+@item compensate
+Enable stretching/squeezing the data to make it match the timestamps. Disabled
+by default. When disabled, time gaps are covered with silence.
+
+@item min_delta
+Minimum difference between timestamps and audio data (in seconds) to trigger
+adding/dropping samples. Default value is 0.1. If you get non-perfect sync with
+this filter, try setting this parameter to 0.
+
+@item max_comp
+Maximum compensation in samples per second. Relevant only with compensate=1.
+Default value 500.
+
+@item first_pts
+Assume the first pts should be this value. The time base is 1 / sample rate.
+This allows for padding/trimming at the start of stream. By default, no
+assumption is made about the first frame's expected pts, so no padding or
+trimming is done. For example, this could be set to 0 to pad the beginning with
+silence if an audio stream starts after the video stream or to trim any samples
+with a negative pts due to encoder delay.
+
+@end table
+
+@section channelsplit
+Split each channel in input audio stream into a separate output stream.
+
+This filter accepts the following named parameters:
+@table @option
+@item channel_layout
+Channel layout of the input stream. Default is "stereo".
+@end table
+
+For example, assuming a stereo input MP3 file
+@example
+avconv -i in.mp3 -filter_complex channelsplit out.mkv
+@end example
+will create an output Matroska file with two audio streams, one containing only
+the left channel and the other the right channel.
+
+To split a 5.1 WAV file into per-channel files
+@example
+avconv -i in.wav -filter_complex
+'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
+-map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
+front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
+side_right.wav
+@end example
+
+@section channelmap
+Remap input channels to new locations.
+
+This filter accepts the following named parameters:
+@table @option
+@item channel_layout
+Channel layout of the output stream.
+
+@item map
+Map channels from input to output. The argument is a comma-separated list of
+mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
+@var{in_channel} form. @var{in_channel} can be either the name of the input
+channel (e.g. FL for front left) or its index in the input channel layout.
+@var{out_channel} is the name of the output channel or its index in the output
+channel layout. If @var{out_channel} is not given then it is implicitly an
+index, starting with zero and increasing by one for each mapping.
+@end table
+
+If no mapping is present, the filter will implicitly map input channels to
+output channels preserving index.
+
+For example, assuming a 5.1+downmix input MOV file
+@example
+avconv -i in.mov -filter 'channelmap=map=DL-FL\,DR-FR' out.wav
+@end example
+will create an output WAV file tagged as stereo from the downmix channels of
+the input.
+
+To fix a 5.1 WAV improperly encoded in AAC's native channel order
+@example
+avconv -i in.wav -filter 'channelmap=1\,2\,0\,5\,3\,4:channel_layout=5.1' out.wav
+@end example
+
+@section join
+Join multiple input streams into one multi-channel stream.
+
+The filter accepts the following named parameters:
+@table @option
+
+@item inputs
+Number of input streams. Defaults to 2.
+
+@item channel_layout
+Desired output channel layout. Defaults to stereo.
+
+@item map
+Map channels from inputs to output. The argument is a comma-separated list of
+mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
+form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
+can be either the name of the input channel (e.g. FL for front left) or its
+index in the specified input stream. @var{out_channel} is the name of the output
+channel.
+@end table
+
+The filter will attempt to guess the mappings when those are not specified
+explicitly. It does so by first trying to find an unused matching input channel
+and if that fails it picks the first unused input channel.
+
+E.g. to join 3 inputs (with properly set channel layouts)
+@example
+avconv -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
+@end example
+
+To build a 5.1 output from 6 single-channel streams:
+@example
+avconv -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
+'join=inputs=6:channel_layout=5.1:map=0.0-FL\,1.0-FR\,2.0-FC\,3.0-SL\,4.0-SR\,5.0-LFE'
+out
+@end example
+
+@section resample
+Convert the audio sample format, sample rate and channel layout. This filter is
+not meant to be used directly, it is inserted automatically by libavfilter
+whenever conversion is needed. Use the @var{aformat} filter to force a specific
+conversion.
+
+@section volume
+
+Adjust the input audio volume.
+
+The filter accepts the following named parameters:
+@table @option
+
+@item volume
+Expresses how the audio volume will be increased or decreased.
+
+Output values are clipped to the maximum value.
+
+The output audio volume is given by the relation:
+@example
+@var{output_volume} = @var{volume} * @var{input_volume}
+@end example
+
+Default value for @var{volume} is 1.0.
+
+@item precision
+Mathematical precision.
+
+This determines which input sample formats will be allowed, which affects the
+precision of the volume scaling.
+
+@table @option
+@item fixed
+8-bit fixed-point; limits input sample format to U8, S16, and S32.
+@item float
+32-bit floating-point; limits input sample format to FLT. (default)
+@item double
+64-bit floating-point; limits input sample format to DBL.
+@end table
+@end table
+
+@subsection Examples
+
+@itemize
+@item
+Halve the input audio volume:
+@example
+volume=volume=0.5
+volume=volume=1/2
+volume=volume=-6.0206dB
+@end example
+
+@item
+Increase input audio power by 6 decibels using fixed-point precision:
+@example
+volume=volume=6dB:precision=fixed
+@end example
+@end itemize
+
@c man end AUDIO FILTERS
@chapter Audio Sources
@@ -125,7 +435,7 @@ integer or a string representing a channel layout. The default value
of @var{channel_layout} is 3, which corresponds to CH_LAYOUT_STEREO.
Check the channel_layout_map definition in
-@file{libavcodec/audioconvert.c} for the mapping between strings and
+@file{libavutil/channel_layout.c} for the mapping between strings and
channel layout values.
Follow some examples:
@@ -137,6 +447,33 @@ anullsrc=48000:4
anullsrc=48000:mono
@end example
+@section abuffer
+Buffer audio frames, and make them available to the filter chain.
+
+This source is not intended to be part of user-supplied graph descriptions but
+for insertion by calling programs through the interface defined in
+@file{libavfilter/buffersrc.h}.
+
+It accepts the following named parameters:
+@table @option
+
+@item time_base
+Timebase which will be used for timestamps of submitted frames. It must be
+either a floating-point number or in @var{numerator}/@var{denominator} form.
+
+@item sample_rate
+Audio sample rate.
+
+@item sample_fmt
+Name of the sample format, as returned by @code{av_get_sample_fmt_name()}.
+
+@item channel_layout
+Channel layout of the audio data, in the form that can be accepted by
+@code{av_get_channel_layout()}.
+@end table
+
+All the parameters need to be explicitly defined.
+
@c man end AUDIO SOURCES
@chapter Audio Sinks
@@ -150,6 +487,13 @@ Null audio sink, do absolutely nothing with the input audio. It is
mainly useful as a template and to be employed in analysis / debugging
tools.
+@section abuffersink
+This sink is intended for programmatic use. Frames that arrive on this sink can
+be retrieved by the calling program using the interface defined in
+@file{libavfilter/buffersink.h}.
+
+This filter accepts no parameters.
+
@c man end AUDIO SINKS
@chapter Video Filters
@@ -598,6 +942,9 @@ libfreetype flags.
@item tabsize
The size in number of spaces to use for rendering the tab.
Default value is 4.
+
+@item fix_bounds
+If true, check and fix text coords to avoid clipping.
@end table
For example the command:
@@ -718,6 +1065,19 @@ format=yuv420p
format=yuv420p:yuv444p:yuv410p
@end example
+@section fps
+
+Convert the video to specified constant framerate by duplicating or dropping
+frames as necessary.
+
+This filter accepts the following named parameters:
+@table @option
+
+@item fps
+Desired output framerate.
+
+@end table
+
@anchor{frei0r}
@section frei0r
@@ -853,10 +1213,10 @@ corresponding pixel component values.
The @var{lut} filter requires either YUV or RGB pixel formats in
input, and accepts the options:
@table @option
-@var{c0} (first pixel component)
-@var{c1} (second pixel component)
-@var{c2} (third pixel component)
-@var{c3} (fourth pixel component, corresponds to the alpha component)
+@item @var{c0} (first pixel component)
+@item @var{c1} (second pixel component)
+@item @var{c2} (third pixel component)
+@item @var{c3} (fourth pixel component, corresponds to the alpha component)
@end table
The exact component associated to each option depends on the format in
@@ -865,19 +1225,19 @@ input.
The @var{lutrgb} filter requires RGB pixel formats in input, and
accepts the options:
@table @option
-@var{r} (red component)
-@var{g} (green component)
-@var{b} (blue component)
-@var{a} (alpha component)
+@item @var{r} (red component)
+@item @var{g} (green component)
+@item @var{b} (blue component)
+@item @var{a} (alpha component)
@end table
The @var{lutyuv} filter requires YUV pixel formats in input, and
accepts the options:
@table @option
-@var{y} (Y/luminance component)
-@var{u} (U/Cb component)
-@var{v} (V/Cr component)
-@var{a} (alpha component)
+@item @var{y} (Y/luminance component)
+@item @var{u} (U/Cb component)
+@item @var{v} (V/Cr component)
+@item @var{a} (alpha component)
@end table
The expressions can contain the following constants and functions:
@@ -1115,15 +1475,12 @@ Follow some examples:
overlay=main_w-overlay_w-10:main_h-overlay_h-10
# insert a transparent PNG logo in the bottom left corner of the input
-movie=logo.png [logo];
-[in][logo] overlay=10:main_h-overlay_h-10 [out]
+avconv -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
# insert 2 different transparent PNG logos (second logo on bottom
# right corner):
-movie=logo1.png [logo1];
-movie=logo2.png [logo2];
-[in][logo1] overlay=10:H-h-10 [in+logo1];
-[in+logo1][logo2] overlay=W-w-10:H-h-10 [out]
+avconv -i input -i logo1 -i logo2 -filter_complex
+'overlay=10:H-h-10,overlay=W-w-10:H-h-10' output
# add a transparent color layer on top of the main video,
# WxH specifies the size of the main input to the overlay filter
@@ -1643,20 +2000,18 @@ Adler-32 checksum of each plane of the input frame, expressed in the form
"[@var{c0} @var{c1} @var{c2} @var{c3}]"
@end table
-@section slicify
+@section split
+
+Split input video into several identical outputs.
-Pass the images of input video on to next video filter as multiple
-slices.
+The filter accepts a single parameter which specifies the number of outputs. If
+unspecified, it defaults to 2.
+For example
@example
-./avconv -i in.avi -vf "slicify=32" out.avi
+avconv -i INPUT -filter_complex split=5 OUTPUT
@end example
-
-The filter accepts the slice height as parameter. If the parameter is
-not specified it will use the default value of 16.
-
-Adding this in the beginning of filter chains should make filtering
-faster due to better use of the memory cache.
+will create 5 copies of the input video.
@section transpose
@@ -1857,7 +2212,7 @@ will instruct the source to accept video frames with size 320x240 and
with format "yuv410p", assuming 1/24 as the timestamps timebase and
square pixels (1:1 sample aspect ratio).
Since the pixel format with name "yuv410p" corresponds to the number 6
-(check the enum PixelFormat definition in @file{libavutil/pixfmt.h}),
+(check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
this example corresponds to:
@example
buffer=320:240:6:1:24
@@ -1906,6 +2261,11 @@ to the pad with identifier "in".
Read a video stream from a movie container.
+Note that this source is a hack that bypasses the standard input path. It can be
+useful in applications that do not support arbitrary filter graphs, but its use
+is discouraged in those that do. Specifically in @command{avconv} this filter
+should never be used, the @option{-filter_complex} option fully replaces it.
+
It accepts the syntax: @var{movie_name}[:@var{options}] where
@var{movie_name} is the name of the resource to read (not necessarily
a file but also a device or a stream accessed through some protocol),
@@ -2057,6 +2417,14 @@ will generate a video with a duration of 5.3 seconds, with size
Below is a description of the currently available video sinks.
+@section buffersink
+
+Buffer video frames, and make them available to the end of the filter
+graph.
+
+This sink is intended for a programmatic use through the interface defined in
+@file{libavfilter/buffersink.h}.
+
@section nullsink
Null video sink, do absolutely nothing with the input video. It is
@@ -2064,4 +2432,3 @@ mainly useful as a template and to be employed in analysis / debugging
tools.
@c man end VIDEO SINKS
-
diff --git a/gst-libs/ext/libav/doc/general.texi b/gst-libs/ext/libav/doc/general.texi
index 79af887..d973902 100644
--- a/gst-libs/ext/libav/doc/general.texi
+++ b/gst-libs/ext/libav/doc/general.texi
@@ -13,12 +13,13 @@
Libav can be hooked up with a number of external libraries to add support
for more formats. None of them are used by default, their use has to be
-explicitly requested by passing the appropriate flags to @file{./configure}.
+explicitly requested by passing the appropriate flags to
+@command{./configure}.
@section OpenCORE and VisualOn libraries
-Spun off Google Android sources, OpenCore and VisualOn libraries provide
-encoders for a number of audio codecs.
+Spun off Google Android sources, OpenCore, VisualOn and Fraunhofer
+libraries provide encoders for a number of audio codecs.
@float NOTE
OpenCORE and VisualOn libraries are under the Apache License 2.0
@@ -54,6 +55,14 @@ Go to @url{http://sourceforge.net/projects/opencore-amr/} and follow the
instructions for installing the library.
Then pass @code{--enable-libvo-amrwbenc} to configure to enable it.
+@subsection Fraunhofer AAC library
+
+Libav can make use of the Fraunhofer AAC library for AAC encoding.
+
+Go to @url{http://sourceforge.net/projects/opencore-amr/} and follow the
+instructions for installing the library.
+Then pass @code{--enable-libfdk-aac} to configure to enable it.
+
@section LAME
Libav can make use of the LAME library for MP3 encoding.
@@ -84,6 +93,17 @@ x264 is under the GNU Public License Version 2 or later
details), you must upgrade Libav's license to GPL in order to use it.
@end float
+@section libilbc
+
+iLBC is a narrowband speech codec that has been made freely available
+by Google as part of the WebRTC project. libilbc is a packaging friendly
+copy of the iLBC codec. Libav can make use of the libilbc library for
+iLBC encoding and decoding.
+
+Go to @url{https://github.com/dekkers/libilbc} and follow the instructions for
+installing the library. Then pass @code{--enable-libilbc} to configure to
+enable it.
+
@chapter Supported File Formats and Codecs
@@ -131,6 +151,8 @@ library:
@tab Multimedia format used by Delphine Software games.
@item CD+G @tab @tab X
@tab Video format used by CD+G karaoke disks
+@item Commodore CDXL @tab @tab X
+ @tab Amiga CD video format
@item Core Audio Format @tab @tab X
@tab Apple Core Audio Format
@item CRC testing format @tab X @tab
@@ -170,6 +192,7 @@ library:
@item IEC61937 encapsulation @tab X @tab X
@item IFF @tab @tab X
@tab Interchange File Format
+@item iLBC @tab X @tab X
@item Interplay MVE @tab @tab X
@tab Format used in various Interplay computer games.
@item IV8 @tab @tab X
@@ -250,6 +273,7 @@ library:
@item raw video @tab X @tab X
@item raw id RoQ @tab X @tab
@item raw Shorten @tab @tab X
+@item raw TAK @tab @tab X
@item raw TrueHD @tab X @tab X
@item raw VC-1 @tab @tab X
@item raw PCM A-law @tab X @tab X
@@ -327,6 +351,7 @@ library:
@tab Microsoft audio container used by XAudio 2.
@item YUV4MPEG pipe @tab X @tab X
@item Psygnosis YOP @tab @tab X
+@item ZeroCodec Lossless Video @tab @tab X
@end multitable
@code{X} means that encoding (resp. decoding) is supported.
@@ -348,7 +373,7 @@ following image formats are supported:
@tab Digital Picture Exchange
@item JPEG @tab X @tab X
@tab Progressive JPEG is not supported.
-@item JPEG 2000 @tab @tab E
+@item JPEG 2000 @tab E @tab E
@tab decoding supported through external library libopenjpeg
@item JPEG-LS @tab X @tab X
@item LJPEG @tab X @tab
@@ -373,12 +398,16 @@ following image formats are supported:
@tab V.Flash PTX format
@item SGI @tab X @tab X
@tab SGI RGB image format
-@item Sun Rasterfile @tab @tab X
+@item Sun Rasterfile @tab X @tab X
@tab Sun RAS image format
@item TIFF @tab X @tab X
@tab YUV, JPEG and some extension is not supported yet.
@item Truevision Targa @tab X @tab X
@tab Targa (.TGA) image format
+@item XBM @tab X @tab
+ @tab X BitMap image format
+@item XWD @tab X @tab X
+ @tab X Window Dump image format
@end multitable
@code{X} means that encoding (resp. decoding) is supported.
@@ -402,7 +431,7 @@ following image formats are supported:
@tab Used in Chinese MP3 players.
@item ANSI/ASCII art @tab @tab X
@item Apple MJPEG-B @tab @tab X
-@item Apple ProRes @tab @tab X
+@item Apple ProRes @tab X @tab X
@item Apple QuickDraw @tab @tab X
@tab fourcc: qdrw
@item Asus v1 @tab X @tab X
@@ -433,11 +462,14 @@ following image formats are supported:
@tab fourcc: CSCD
@item CD+G @tab @tab X
@tab Video codec for CD+G karaoke disks
+@item CDXL @tab @tab X
+ @tab Amiga CD video codec
@item Chinese AVS video @tab E @tab X
@tab AVS1-P2, JiZhun profile, encoding through external library libxavs
@item Delphine Software International CIN video @tab @tab X
@tab Codec used in Delphine Software International games.
@item Discworld II BMV Video @tab @tab X
+@item Canopus Lossless Codec @tab @tab X
@item Cinepak @tab @tab X
@item Cirrus Logic AccuPak @tab X @tab X
@tab fourcc: CLJR
@@ -445,7 +477,7 @@ following image formats are supported:
@item DFA @tab @tab X
@tab Codec used in Chronomaster game.
@item Dirac @tab E @tab E
- @tab supported through external libdirac/libschroedinger libraries
+ @tab supported through external library libschroedinger
@item Deluxe Paint Animation @tab @tab X
@item DNxHD @tab X @tab X
@tab aka SMPTE VC3
@@ -471,6 +503,7 @@ following image formats are supported:
@item Flash Screen Video v2 @tab @tab X
@item Flash Video (FLV) @tab X @tab X
@tab Sorenson H.263 used in Flash
+@item Forward Uncompressed @tab @tab X
@item Fraps @tab @tab X
@item H.261 @tab X @tab X
@item H.263 / H.263-1996 @tab X @tab X
@@ -508,7 +541,15 @@ following image formats are supported:
@item LCL (LossLess Codec Library) ZLIB @tab E @tab E
@item LOCO @tab @tab X
@item lossless MJPEG @tab X @tab X
+@item Microsoft ATC Screen @tab @tab X
+ @tab Also known as Microsoft Screen 3.
+@item Microsoft Expression Encoder Screen @tab @tab X
+ @tab Also known as Microsoft Titanium Screen 2.
@item Microsoft RLE @tab @tab X
+@item Microsoft Screen 1 @tab @tab X
+ @tab Also known as Windows Media Video V7 Screen.
+@item Microsoft Screen 2 @tab @tab X
+ @tab Also known as Windows Media Video V9 Screen.
@item Microsoft Video 1 @tab @tab X
@item Mimic @tab @tab X
@tab Used in MSN Messenger Webcam streams.
@@ -522,7 +563,7 @@ following image formats are supported:
@item MPEG-1/2 video (VDPAU acceleration) @tab @tab X
@item MPEG-2 video @tab X @tab X
@item MPEG-4 part 2 @tab X @tab X
- @ libxvidcore can be used alternatively for encoding.
+ @tab libxvidcore can be used alternatively for encoding.
@item MPEG-4 part 2 Microsoft variant version 1 @tab @tab X
@item MPEG-4 part 2 Microsoft variant version 2 @tab X @tab X
@item MPEG-4 part 2 Microsoft variant version 3 @tab X @tab X
@@ -576,11 +617,13 @@ following image formats are supported:
@tab fourcc: SP5X
@item TechSmith Screen Capture Codec @tab @tab X
@tab fourcc: TSCC
+@item TechSmith Screen Capture Codec 2 @tab @tab X
+ @tab fourcc: TSC2
@item Theora @tab E @tab X
@tab encoding supported through external library libtheora
@item Tiertex Limited SEQ video @tab @tab X
@tab Codec used in DOS CD-ROM FlashBack game.
-@item Ut Video @tab @tab X
+@item Ut Video @tab X @tab X
@item v210 QuickTime uncompressed 4:2:2 10-bit @tab X @tab X
@item v410 QuickTime uncompressed 4:4:4 10-bit @tab X @tab X
@item VBLE Lossless Codec @tab @tab X
@@ -691,10 +734,14 @@ following image formats are supported:
@item DV audio @tab @tab X
@item Enhanced AC-3 @tab X @tab X
@item FLAC (Free Lossless Audio Codec) @tab X @tab IX
+@item G.723.1 @tab @tab X
@item GSM @tab E @tab X
@tab encoding supported through external library libgsm
@item GSM Microsoft variant @tab E @tab X
@tab encoding supported through external library libgsm
+@item IAC (Indeo Audio Coder) @tab @tab X
+@item iLBC (Internet Low Bitrate Codec) @tab E @tab E
+ @tab encoding and decoding supported through external library libilbc
@item IMC (Intel Music Coder) @tab @tab X
@item MACE (Macintosh Audio Compression/Expansion) 3:1 @tab @tab X
@item MACE (Macintosh Audio Compression/Expansion) 6:1 @tab @tab X
@@ -710,6 +757,8 @@ following image formats are supported:
@item Musepack SV7 @tab @tab X
@item Musepack SV8 @tab @tab X
@item Nellymoser Asao @tab X @tab X
+@item Opus @tab E @tab E
+ @tab supported through external library libopus
@item PCM A-law @tab X @tab X
@item PCM mu-law @tab X @tab X
@item PCM 16-bit little-endian planar @tab @tab X
@@ -743,6 +792,7 @@ following image formats are supported:
@tab Real 28800 bit/s codec
@item RealAudio 3.0 (dnet) @tab IX @tab X
@tab Real low bitrate AC-3 codec
+@item RealAudio Lossless @tab @tab X
@item RealAudio SIPR / ACELP.NET @tab @tab X
@item Shorten @tab @tab X
@item Sierra VMD audio @tab @tab X
@@ -751,6 +801,7 @@ following image formats are supported:
@item SMPTE 302M AES3 audio @tab @tab X
@item Speex @tab E @tab E
@tab supported through external library libspeex
+@item TAK (Tom's lossless Audio Kompressor) @tab @tab X
@item True Audio (TTA) @tab @tab X
@item TrueHD @tab @tab X
@tab Used in HD-DVD and Blu-Ray discs.
@@ -761,6 +812,7 @@ following image formats are supported:
@item Westwood Audio (SND1) @tab @tab X
@item Windows Media Audio 1 @tab X @tab X
@item Windows Media Audio 2 @tab X @tab X
+@item Windows Media Audio Lossless @tab @tab X
@item Windows Media Audio Pro @tab @tab X
@item Windows Media Audio Voice @tab @tab X
@end multitable
@@ -790,19 +842,31 @@ performance on systems without hardware floating point support).
@multitable @columnfractions .4 .1
@item Name @tab Support
-@item Apple HTTP Live Streaming @tab X
@item file @tab X
@item Gopher @tab X
+@item HLS @tab X
@item HTTP @tab X
-@item MMS @tab X
+@item HTTPS @tab X
+@item MMSH @tab X
+@item MMST @tab X
@item pipe @tab X
+@item RTMP @tab X
+@item RTMPE @tab X
+@item RTMPS @tab X
+@item RTMPT @tab X
+@item RTMPTE @tab X
+@item RTMPTS @tab X
@item RTP @tab X
+@item SCTP @tab X
@item TCP @tab X
+@item TLS @tab X
@item UDP @tab X
@end multitable
@code{X} means that the protocol is supported.
+@code{E} means that support is provided through an external library.
+
@section Input/Output Devices
@@ -811,11 +875,12 @@ performance on systems without hardware floating point support).
@item ALSA @tab X @tab X
@item BKTR @tab X @tab
@item DV1394 @tab X @tab
+@item Linux framebuffer @tab X @tab
@item JACK @tab X @tab
+@item LIBCDIO @tab X
@item LIBDC1394 @tab X @tab
@item OSS @tab X @tab X
@item Pulseaudio @tab X @tab
-@item Video4Linux @tab X @tab
@item Video4Linux2 @tab X @tab
@item VfW capture @tab X @tab
@item X11 grabbing @tab X @tab
diff --git a/gst-libs/ext/libav/doc/git-howto.texi b/gst-libs/ext/libav/doc/git-howto.texi
index b01981e..5a8e2a3 100644
--- a/gst-libs/ext/libav/doc/git-howto.texi
+++ b/gst-libs/ext/libav/doc/git-howto.texi
@@ -65,6 +65,14 @@ git clone git@@git.libav.org:libav.git <target>
This will put the Libav sources into the directory @var{<target>} and let
you push back your changes to the remote repository.
+Make sure that you do not have Windows line endings in your checkouts,
+otherwise you may experience spurious compilation failures. One way to
+achieve this is to run
+
+@example
+git config --global core.autocrlf false
+@end example
+
@section Updating the source tree to the latest revision
@@ -250,6 +258,32 @@ git commit
@end example
+@chapter Git configuration
+
+In order to simplify a few workflows, it is advisable to configure both
+your personal Git installation and your local Libav repository.
+
+@section Personal Git installation
+
+Add the following to your @file{~/.gitconfig} to help @command{git send-email}
+and @command{git format-patch} detect renames:
+
+@example
+[diff]
+ renames = copy
+@end example
+
+@section Repository configuration
+
+In order to have @command{git send-email} automatically send patches
+to the libav-devel mailing list, add the following stanza
+to @file{/path/to/libav/repository/.git/config}:
+
+@example
+[sendemail]
+ to = libav-devel@@libav.org
+@end example
+
@chapter Libav specific
@section Reverting broken commits
@@ -338,6 +372,68 @@ git checkout -b svn_23456 $SHA1
where @var{$SHA1} is the commit hash from the @command{git log} output.
+
+@chapter pre-push checklist
+
+Once you have a set of commits that you feel are ready for pushing,
+work through the following checklist to doublecheck everything is in
+proper order. This list tries to be exhaustive. In case you are just
+pushing a typo in a comment, some of the steps may be unnecessary.
+Apply your common sense, but if in doubt, err on the side of caution.
+
+First make sure your Git repository is on a branch that is a direct
+descendant of the Libav master branch, which is the only one from which
+pushing to Libav is possible. Then run the following command:
+
+@itemize
+@item @command{git log --patch --stat origin/master..}
+
+to make sure that only the commits you want to push are pending, that
+the log messages of the commits are correct and descriptive and contain
+no cruft from @command{git am} and to doublecheck that the commits you
+want to push really only contain the changes they are supposed to contain.
+
+@item @command{git status}
+
+to ensure no local changes still need to be committed and that no local
+changes may have thrown off the results of your testing.
+@end itemize
+
+Next let the code pass through a full run of our testsuite. Before you do,
+the command @command{make fate-rsync} will update the test samples. Changes
+to the samples set are not very common and commits depending on samples
+changes are delayed for at least 24 hours to allow the new samples to
+propagate, so updating it once per day is sufficient. Now execute
+
+@itemize
+@item @command{make distclean}
+@item @command{/path/to/libav/configure}
+@item @command{make check}
+@end itemize
+
+While the test suite covers a wide range of possible problems, it is not
+a panacea. Do not hesitate to perform any other tests necessary to convince
+yourself that the changes you are about to push actually work as expected.
+
+Also note that every single commit should pass the test suite, not just
+the result of a series of patches. So if you have a series of commits
+to push, run the test suite on every single commit.
+
+Give other developers a reasonable amount of time to look at and review
+patches before you push them. Not everybody is online 24/7, but may wish
+to look at and comment on a patch nonetheless. The time you leave depends
+on the urgency and complexity of the patch. Use your common sense to pick
+a timeframe that allows everybody that you think may wish to comment
+and/or should comment on the change an opportunity to see it.
+
+Finally, after pushing, mark all patches as committed on
+@url{http://patches.libav.org/,patchwork}.
+Sometimes this is not automatically done when a patch has been
+slightly modified from the version on the mailing list.
+Also update previous incarnations of the patches you push so that
+patchwork is not cluttered with cruft.
+
+
@chapter Server Issues
Contact the project admins @email{git@@libav.org} if you have technical
diff --git a/gst-libs/ext/libav/doc/indevs.texi b/gst-libs/ext/libav/doc/indevs.texi
index b750395..8ff64a7 100644
--- a/gst-libs/ext/libav/doc/indevs.texi
+++ b/gst-libs/ext/libav/doc/indevs.texi
@@ -254,9 +254,9 @@ command:
avconv -f sndio -i /dev/audio0 /tmp/oss.wav
@end example
-@section video4linux and video4linux2
+@section video4linux2
-Video4Linux and Video4Linux2 input video devices.
+Video4Linux2 input video device.
The name of the device to grab is a file device node, usually Linux
systems tend to automatically create such nodes when the device
@@ -264,33 +264,19 @@ systems tend to automatically create such nodes when the device
kind @file{/dev/video@var{N}}, where @var{N} is a number associated to
the device.
-Video4Linux and Video4Linux2 devices only support a limited set of
+Video4Linux2 devices usually support a limited set of
@var{width}x@var{height} sizes and framerates. You can check which are
-supported for example with the command @file{dov4l} for Video4Linux
-devices and using @command{-list_formats all} for Video4Linux2 devices.
+supported using @command{-list_formats all} for Video4Linux2 devices.
-If the size for the device is set to 0x0, the input device will
-try to autodetect the size to use.
-Only for the video4linux2 device, if the frame rate is set to 0/0 the
-input device will use the frame rate value already set in the driver.
+Some usage examples of the video4linux2 devices with avconv and avplay:
-Video4Linux support is deprecated since Linux 2.6.30, and will be
-dropped in later versions.
-
-Follow some usage examples of the video4linux devices with the av*
-tools.
@example
-# Grab and show the input of a video4linux device, frame rate is set
-# to the default of 25/1.
-avplay -s 320x240 -f video4linux /dev/video0
-
-# Grab and show the input of a video4linux2 device, autoadjust size.
-avplay -f video4linux2 /dev/video0
+# Grab and show the input of a video4linux2 device.
+avplay -f video4linux2 -framerate 30 -video_size hd720 /dev/video0
-# Grab and record the input of a video4linux2 device, autoadjust size,
-# frame rate value defaults to 0/0 so it is read from the video4linux2
-# driver.
-avconv -f video4linux2 -i /dev/video0 out.mpeg
+# Grab and record the input of a video4linux2 device, leave the
+framerate and size as previously set.
+avconv -f video4linux2 -input_format mjpeg -i /dev/video0 out.mpeg
@end example
@section vfwcap
@@ -314,7 +300,7 @@ The filename passed as input has the syntax:
@var{hostname}:@var{display_number}.@var{screen_number} specifies the
X11 display name of the screen to grab from. @var{hostname} can be
-ommitted, and defaults to "localhost". The environment variable
+omitted, and defaults to "localhost". The environment variable
@env{DISPLAY} contains the default display name.
@var{x_offset} and @var{y_offset} specify the offsets of the grabbed
diff --git a/gst-libs/ext/libav/doc/muxers.texi b/gst-libs/ext/libav/doc/muxers.texi
index 185d19e..d183eaf 100644
--- a/gst-libs/ext/libav/doc/muxers.texi
+++ b/gst-libs/ext/libav/doc/muxers.texi
@@ -90,6 +90,32 @@ avconv -i INPUT -c:a pcm_u8 -c:v mpeg2video -f framecrc -
See also the @ref{crc} muxer.
+@anchor{hls}
+@section hls
+
+Apple HTTP Live Streaming muxer that segments MPEG-TS according to
+the HTTP Live Streaming specification.
+
+It creates a playlist file and numbered segment files. The output
+filename specifies the playlist filename; the segment filenames
+receive the same basename as the playlist, a sequential number and
+a .ts extension.
+
+@example
+avconv -i in.nut out.m3u8
+@end example
+
+@table @option
+@item -hls_time @var{seconds}
+Set the segment length in seconds.
+@item -hls_list_size @var{size}
+Set the maximum number of playlist entries.
+@item -hls_wrap @var{wrap}
+Set the number after which index wraps.
+@item -start_number @var{number}
+Start the sequence from @var{number}.
+@end table
+
@anchor{image2}
@section image2
@@ -142,6 +168,79 @@ Note also that the pattern must not necessarily contain "%d" or
avconv -i in.avi -f image2 -frames:v 1 img.jpeg
@end example
+@table @option
+@item -start_number @var{number}
+Start the sequence from @var{number}.
+@end table
+
+@section MOV/MP4/ISMV
+
+The mov/mp4/ismv muxer supports fragmentation. Normally, a MOV/MP4
+file has all the metadata about all packets stored in one location
+(written at the end of the file, it can be moved to the start for
+better playback using the @command{qt-faststart} tool). A fragmented
+file consists of a number of fragments, where packets and metadata
+about these packets are stored together. Writing a fragmented
+file has the advantage that the file is decodable even if the
+writing is interrupted (while a normal MOV/MP4 is undecodable if
+it is not properly finished), and it requires less memory when writing
+very long files (since writing normal MOV/MP4 files stores info about
+every single packet in memory until the file is closed). The downside
+is that it is less compatible with other applications.
+
+Fragmentation is enabled by setting one of the AVOptions that define
+how to cut the file into fragments:
+
+@table @option
+@item -movflags frag_keyframe
+Start a new fragment at each video keyframe.
+@item -frag_duration @var{duration}
+Create fragments that are @var{duration} microseconds long.
+@item -frag_size @var{size}
+Create fragments that contain up to @var{size} bytes of payload data.
+@item -movflags frag_custom
+Allow the caller to manually choose when to cut fragments, by
+calling @code{av_write_frame(ctx, NULL)} to write a fragment with
+the packets written so far. (This is only useful with other
+applications integrating libavformat, not from @command{avconv}.)
+@item -min_frag_duration @var{duration}
+Don't create fragments that are shorter than @var{duration} microseconds long.
+@end table
+
+If more than one condition is specified, fragments are cut when
+one of the specified conditions is fulfilled. The exception to this is
+@code{-min_frag_duration}, which has to be fulfilled for any of the other
+conditions to apply.
+
+Additionally, the way the output file is written can be adjusted
+through a few other options:
+
+@table @option
+@item -movflags empty_moov
+Write an initial moov atom directly at the start of the file, without
+describing any samples in it. Generally, an mdat/moov pair is written
+at the start of the file, as a normal MOV/MP4 file, containing only
+a short portion of the file. With this option set, there is no initial
+mdat atom, and the moov atom only describes the tracks but has
+a zero duration.
+
+Files written with this option set do not work in QuickTime.
+This option is implicitly set when writing ismv (Smooth Streaming) files.
+@item -movflags separate_moof
+Write a separate moof (movie fragment) atom for each track. Normally,
+packets for all tracks are written in a moof atom (which is slightly
+more efficient), but with this option set, the muxer writes one moof/mdat
+pair for each track, making it easier to separate tracks.
+
+This option is implicitly set when writing ismv (Smooth Streaming) files.
+@end table
+
+Smooth Streaming content can be pushed in real time to a publishing
+point on IIS with this muxer. Example:
+@example
+avconv -re @var{<normal input/transcoding options>} -movflags isml+frag_keyframe -f ismv http://server/publishingpoint.isml/Streams(Encoder1)
+@end example
+
@section mpegts
MPEG transport stream muxer.
@@ -292,11 +391,47 @@ Set segment duration to @var{t} seconds.
Generate also a listfile named @var{name}.
@item segment_list_size @var{size}
Overwrite the listfile once it reaches @var{size} entries.
+@item segment_wrap @var{limit}
+Wrap around segment index once it reaches @var{limit}.
@end table
@example
avconv -i in.mkv -c copy -map 0 -f segment -list out.list out%03d.nut
@end example
+@section mp3
+
+The MP3 muxer writes a raw MP3 stream with an ID3v2 header at the beginning and
+optionally an ID3v1 tag at the end. ID3v2.3 and ID3v2.4 are supported, the
+@code{id3v2_version} option controls which one is used. The legacy ID3v1 tag is
+not written by default, but may be enabled with the @code{write_id3v1} option.
+
+For seekable output the muxer also writes a Xing frame at the beginning, which
+contains the number of frames in the file. It is useful for computing duration
+of VBR files.
+
+The muxer supports writing ID3v2 attached pictures (APIC frames). The pictures
+are supplied to the muxer in form of a video stream with a single packet. There
+can be any number of those streams, each will correspond to a single APIC frame.
+The stream metadata tags @var{title} and @var{comment} map to APIC
+@var{description} and @var{picture type} respectively. See
+@url{http://id3.org/id3v2.4.0-frames} for allowed picture types.
+
+Note that the APIC frames must be written at the beginning, so the muxer will
+buffer the audio frames until it gets all the pictures. It is therefore advised
+to provide the pictures as soon as possible to avoid excessive buffering.
+
+Examples:
+
+Write an mp3 with an ID3v2.3 header and an ID3v1 footer:
+@example
+avconv -i INPUT -id3v2_version 3 -write_id3v1 1 out.mp3
+@end example
+
+Attach a picture to an mp3:
+@example
+avconv -i input.mp3 -i cover.png -c copy -metadata:s:v title="Album cover"
+-metadata:s:v comment="Cover (Front)" out.mp3
+@end example
@c man end MUXERS
diff --git a/gst-libs/ext/libav/doc/nut.texi b/gst-libs/ext/libav/doc/nut.texi
new file mode 100644
index 0000000..9b84241
--- /dev/null
+++ b/gst-libs/ext/libav/doc/nut.texi
@@ -0,0 +1,134 @@
+\input texinfo @c -*- texinfo -*-
+
+@settitle NUT
+
+@titlepage
+@center @titlefont{NUT}
+@end titlepage
+
+@top
+
+@contents
+
+@chapter Description
+NUT is a low overhead generic container format. It stores audio, video,
+subtitle and user-defined streams in a simple, yet efficient, way.
+
+It was created by a group of FFmpeg and MPlayer developers in 2003
+and was finalized in 2008.
+
+@chapter Container-specific codec tags
+
+@section Generic raw YUVA formats
+
+Since many exotic planar YUVA pixel formats are not considered by
+the AVI/QuickTime FourCC lists, the following scheme is adopted for
+representing them.
+
+The first two bytes can contain the values:
+Y1 = only Y
+Y2 = Y+A
+Y3 = YUV
+Y4 = YUVA
+
+The third byte represents the width and height chroma subsampling
+values for the UV planes, that is the amount to shift the luma
+width/height right to find the chroma width/height.
+
+The fourth byte is the number of bits used (8, 16, ...).
+
+If the order of bytes is inverted, that means that each component has
+to be read big-endian.
+
+@section Raw Audio
+
+@multitable @columnfractions .4 .4
+@item ALAW @tab A-LAW
+@item ULAW @tab MU-LAW
+@item P<type><interleaving><bits> @tab little-endian PCM
+@item <bits><interleaving><type>P @tab big-endian PCM
+@end multitable
+
+<type> is S for signed integer, U for unsigned integer, F for IEEE float
+<interleaving> is D for default, P is for planar.
+<bits> is 8/16/24/32
+
+@example
+PFD[32] would for example be signed 32 bit little-endian IEEE float
+@end example
+
+@section Subtitles
+
+@multitable @columnfractions .4 .4
+@item UTF8 @tab Raw UTF-8
+@item SSA[0] @tab SubStation Alpha
+@item DVDS @tab DVD subtitles
+@item DVBS @tab DVB subtitles
+@end multitable
+
+@section Raw Data
+
+@multitable @columnfractions .4 .4
+@item UTF8 @tab Raw UTF-8
+@end multitable
+
+@section Codecs
+
+@multitable @columnfractions .4 .4
+@item 3IV1 @tab non-compliant MPEG-4 generated by old 3ivx
+@item ASV1 @tab Asus Video
+@item ASV2 @tab Asus Video 2
+@item CVID @tab Cinepak
+@item CYUV @tab Creative YUV
+@item DIVX @tab non-compliant MPEG-4 generated by old DivX
+@item DUCK @tab Truemotion 1
+@item FFV1 @tab FFmpeg video 1
+@item FFVH @tab FFmpeg Huffyuv
+@item H261 @tab ITU H.261
+@item H262 @tab ITU H.262
+@item H263 @tab ITU H.263
+@item H264 @tab ITU H.264
+@item HFYU @tab Huffyuv
+@item I263 @tab Intel H.263
+@item IV31 @tab Indeo 3.1
+@item IV32 @tab Indeo 3.2
+@item IV50 @tab Indeo 5.0
+@item LJPG @tab ITU JPEG (lossless)
+@item MJLS @tab ITU JPEG-LS
+@item MJPG @tab ITU JPEG
+@item MPG4 @tab MS MPEG-4v1 (not ISO MPEG-4)
+@item MP42 @tab MS MPEG-4v2
+@item MP43 @tab MS MPEG-4v3
+@item MP4V @tab ISO MPEG-4 Part 2 Video (from old encoders)
+@item mpg1 @tab ISO MPEG-1 Video
+@item mpg2 @tab ISO MPEG-2 Video
+@item MRLE @tab MS RLE
+@item MSVC @tab MS Video 1
+@item RT21 @tab Indeo 2.1
+@item RV10 @tab RealVideo 1.0
+@item RV20 @tab RealVideo 2.0
+@item RV30 @tab RealVideo 3.0
+@item RV40 @tab RealVideo 4.0
+@item SNOW @tab FFmpeg Snow
+@item SVQ1 @tab Sorenson Video 1
+@item SVQ3 @tab Sorenson Video 3
+@item theo @tab Xiph Theora
+@item TM20 @tab Truemotion 2.0
+@item UMP4 @tab non-compliant MPEG-4 generated by UB Video MPEG-4
+@item VCR1 @tab ATI VCR1
+@item VP30 @tab VP 3.0
+@item VP31 @tab VP 3.1
+@item VP50 @tab VP 5.0
+@item VP60 @tab VP 6.0
+@item VP61 @tab VP 6.1
+@item VP62 @tab VP 6.2
+@item VP70 @tab VP 7.0
+@item WMV1 @tab MS WMV7
+@item WMV2 @tab MS WMV8
+@item WMV3 @tab MS WMV9
+@item WV1F @tab non-compliant MPEG-4 generated by ?
+@item WVC1 @tab VC-1
+@item XVID @tab non-compliant MPEG-4 generated by old Xvid
+@item XVIX @tab non-compliant MPEG-4 generated by old Xvid with interlacing bug
+@end multitable
+
diff --git a/gst-libs/ext/libav/doc/optimization.txt b/gst-libs/ext/libav/doc/optimization.txt
index 78e0077..c3e640c 100644
--- a/gst-libs/ext/libav/doc/optimization.txt
+++ b/gst-libs/ext/libav/doc/optimization.txt
@@ -253,7 +253,7 @@ Optimization guide for ARM11 (used in Nokia N800 Internet Tablet):
http://infocenter.arm.com/help/topic/com.arm.doc.ddi0211j/DDI0211J_arm1136_r1p5_trm.pdf
Optimization guide for Intel XScale (used in Sharp Zaurus PDA):
http://download.intel.com/design/intelxscale/27347302.pdf
-Intel Wireless MMX2 Coprocessor: Programmers Reference Manual
+Intel Wireless MMX 2 Coprocessor: Programmers Reference Manual
http://download.intel.com/design/intelxscale/31451001.pdf
PowerPC-specific:
diff --git a/gst-libs/ext/libav/doc/platform.texi b/gst-libs/ext/libav/doc/platform.texi
index 7ec7cb3..da08962 100644
--- a/gst-libs/ext/libav/doc/platform.texi
+++ b/gst-libs/ext/libav/doc/platform.texi
@@ -27,11 +27,11 @@ to configure.
@section BSD
BSD make will not build Libav, you need to install and use GNU Make
-(@file{gmake}).
+(@command{gmake}).
@section (Open)Solaris
-GNU Make is required to build Libav, so you have to invoke (@file{gmake}),
+GNU Make is required to build Libav, so you have to invoke (@command{gmake}),
standard Solaris Make will not work. When building with a non-c99 front-end
(gcc, generic suncc) add either @code{--extra-libs=/usr/lib/values-xpg6.o}
or @code{--extra-libs=/usr/lib/64/values-xpg6.o} to the configure options
@@ -75,27 +75,13 @@ For information about compiling Libav on OS/2 see
@chapter Windows
-@section Native Windows compilation
+@section Native Windows compilation using MinGW or MinGW-w64
-Libav can be built to run natively on Windows using the MinGW tools. Install
-the latest versions of MSYS and MinGW from @url{http://www.mingw.org/}.
-You can find detailed installation
-instructions in the download section and the FAQ.
-
-Libav does not build out-of-the-box with the packages the automated MinGW
-installer provides. It also requires coreutils to be installed and many other
-packages updated to the latest version. The minimum version for some packages
-are listed below:
-
-@itemize
-@item bash 3.1
-@item msys-make 3.81-2 (note: not mingw32-make)
-@item w32api 3.13
-@item mingw-runtime 3.15
-@end itemize
-
-Libav automatically passes @code{-fno-common} to the compiler to work around
-a GCC bug (see @url{http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37216}).
+Libav can be built to run natively on Windows using the MinGW or MinGW-w64
+toolchains. Install the latest versions of MSYS and MinGW or MinGW-w64 from
+@url{http://www.mingw.org/} or @url{http://mingw-w64.sourceforge.net/}.
+You can find detailed installation instructions in the download section and
+the FAQ.
Notes:
@@ -104,138 +90,116 @@ Notes:
@item Building natively using MSYS can be sped up by disabling implicit rules
in the Makefile by calling @code{make -r} instead of plain @code{make}. This
speed up is close to non-existent for normal one-off builds and is only
-noticeable when running make for a second time (for example in
+noticeable when running make for a second time (for example during
@code{make install}).
@item In order to compile AVplay, you must have the MinGW development library
-of @uref{http://www.libsdl.org/, SDL}.
-Edit the @file{bin/sdl-config} script so that it points to the correct prefix
-where SDL was installed. Verify that @file{sdl-config} can be launched from
-the MSYS command line.
+of @uref{http://www.libsdl.org/, SDL} and @code{pkg-config} installed.
@item By using @code{./configure --enable-shared} when configuring Libav,
-you can build libavutil, libavcodec and libavformat as DLLs.
+you can build all libraries as DLLs.
@end itemize
-@section Microsoft Visual C++ compatibility
+@section Microsoft Visual C++
-As stated in the FAQ, Libav will not compile under MSVC++. However, if you
-want to use the libav* libraries in your own applications, you can still
-compile those applications using MSVC++. But the libav* libraries you link
-to @emph{must} be built with MinGW. However, you will not be able to debug
-inside the libav* libraries, since MSVC++ does not recognize the debug
-symbols generated by GCC.
-We strongly recommend you to move over from MSVC++ to MinGW tools.
+Libav can be built with MSVC using a C99-to-C89 conversion utility and
+wrapper.
-This description of how to use the Libav libraries with MSVC++ is based on
-Microsoft Visual C++ 2005 Express Edition. If you have a different version,
-you might have to modify the procedures slightly.
+You will need the following prerequisites:
-@subsection Using static libraries
+@itemize
+@item @uref{https://github.com/libav/c99-to-c89/, C99-to-C89 Converter & Wrapper}
+@item @uref{http://code.google.com/p/msinttypes/, msinttypes}
+@item @uref{http://www.mingw.org/, MSYS}
+@item @uref{http://yasm.tortall.net/, YASM}
+@item @uref{http://gnuwin32.sourceforge.net/packages/bc.htm, bc for Windows} if
+you want to run @uref{fate.html, FATE}.
+@end itemize
-Assuming you have just built and installed Libav in @file{/usr/local}.
+To set up a proper MSVC environment in MSYS, you simply need to run
+@code{msys.bat} from the Visual Studio command prompt.
-@enumerate
+Place @code{makedef}, @code{c99wrap.exe}, @code{c99conv.exe}, and @code{yasm.exe}
+somewhere in your @code{PATH}.
+
+Next, make sure @code{inttypes.h} and any other headers and libs you want to use
+are located in a spot that MSVC can see. Do so by modifying the @code{LIB} and
+@code{INCLUDE} environment variables to include the @strong{Windows} paths to
+these directories. Alternatively, you can try and use the
+@code{--extra-cflags}/@code{--extra-ldflags} configure options.
+
+Finally, run:
-@item Create a new console application ("File / New / Project") and then
-select "Win32 Console Application". On the appropriate page of the
-Application Wizard, uncheck the "Precompiled headers" option.
-
-@item Write the source code for your application, or, for testing, just
-copy the code from an existing sample application into the source file
-that MSVC++ has already created for you. For example, you can copy
-@file{libavformat/output-example.c} from the Libav distribution.
-
-@item Open the "Project / Properties" dialog box. In the "Configuration"
-combo box, select "All Configurations" so that the changes you make will
-affect both debug and release builds. In the tree view on the left hand
-side, select "C/C++ / General", then edit the "Additional Include
-Directories" setting to contain the path where the Libav includes were
-installed (i.e. @file{c:\msys\1.0\local\include}).
-Do not add MinGW's include directory here, or the include files will
-conflict with MSVC's.
-
-@item Still in the "Project / Properties" dialog box, select
-"Linker / General" from the tree view and edit the
-"Additional Library Directories" setting to contain the @file{lib}
-directory where Libav was installed (i.e. @file{c:\msys\1.0\local\lib}),
-the directory where MinGW libs are installed (i.e. @file{c:\mingw\lib}),
-and the directory where MinGW's GCC libs are installed
-(i.e. @file{C:\mingw\lib\gcc\mingw32\4.2.1-sjlj}). Then select
-"Linker / Input" from the tree view, and add the files @file{libavformat.a},
-@file{libavcodec.a}, @file{libavutil.a}, @file{libmingwex.a},
-@file{libgcc.a}, and any other libraries you used (i.e. @file{libz.a})
-to the end of "Additional Dependencies".
-
-@item Now, select "C/C++ / Code Generation" from the tree view. Select
-"Debug" in the "Configuration" combo box. Make sure that "Runtime
-Library" is set to "Multi-threaded Debug DLL". Then, select "Release" in
-the "Configuration" combo box and make sure that "Runtime Library" is
-set to "Multi-threaded DLL".
-
-@item Click "OK" to close the "Project / Properties" dialog box.
-
-@item MSVC++ lacks some C99 header files that are fundamental for Libav.
-Get msinttypes from @url{http://code.google.com/p/msinttypes/downloads/list}
-and install it in MSVC++'s include directory
-(i.e. @file{C:\Program Files\Microsoft Visual Studio 8\VC\include}).
-
-@item MSVC++ also does not understand the @code{inline} keyword used by
-Libav, so you must add this line before @code{#include}ing libav*:
@example
-#define inline _inline
+./configure --toolchain=msvc
+make
+make install
@end example
-@item Build your application, everything should work.
+If you wish to compile shared libraries, add @code{--enable-shared} to your
+configure options. Note that due to the way MSVC handles DLL imports and
+exports, you cannot compile static and shared libraries at the same time, and
+enabling shared libraries will automatically disable the static ones.
-@end enumerate
+Notes:
-@subsection Using shared libraries
+@itemize
-This is how to create DLL and LIB files that are compatible with MSVC++:
+@item It is possible that coreutils' @code{link.exe} conflicts with MSVC's linker.
+You can find out by running @code{which link} to see which @code{link.exe} you
+are using. If it is located at @code{/bin/link.exe}, then you have the wrong one
+in your @code{PATH}. Either move or remove that copy, or make sure MSVC's
+@code{link.exe} takes precedence in your @code{PATH} over coreutils'.
+
+@item If you wish to build with zlib support, you will have to grab a compatible
+zlib binary from somewhere, with an MSVC import lib, or if you wish to link
+statically, you can follow the instructions below to build a compatible
+@code{zlib.lib} with MSVC. Regardless of which method you use, you must still
+follow step 3, or compilation will fail.
+@enumerate
+@item Grab the @uref{http://zlib.net/, zlib sources}.
+@item Edit @code{win32/Makefile.msc} so that it uses -MT instead of -MD, since
+this is how Libav is built as well.
+@item Edit @code{zconf.h} and remove its inclusion of @code{unistd.h}. This gets
+erroneously included when building Libav.
+@item Run @code{nmake -f win32/Makefile.msc}.
+@item Move @code{zlib.lib}, @code{zconf.h}, and @code{zlib.h} to somewhere MSVC
+can see.
+@end enumerate
-Within the MSYS shell, build Libav with
+@item Libav has been tested with Visual Studio 2010 and 2012, Pro and Express.
+Anything else is not officially supported.
-@example
-./configure --enable-shared
-make
-make install
-@end example
+@end itemize
-Your install path (@file{/usr/local/} by default) should now have the
-necessary DLL and LIB files under the @file{bin} directory.
-
-Alternatively, build the libraries with a cross compiler, according to
-the instructions below in @ref{Cross compilation for Windows with Linux}.
-
-To use those files with MSVC++, do the same as you would do with
-the static libraries, as described above. But in Step 4,
-you should only need to add the directory where the LIB files are installed
-(i.e. @file{c:\msys\usr\local\bin}). This is not a typo, the LIB files are
-installed in the @file{bin} directory. And instead of adding the static
-libraries (@file{libxxx.a} files) you should add the MSVC import libraries
-(@file{avcodec.lib}, @file{avformat.lib}, and
-@file{avutil.lib}). Note that you should not use the GCC import
-libraries (@file{libxxx.dll.a} files), as these will give you undefined
-reference errors. There should be no need for @file{libmingwex.a},
-@file{libgcc.a}, and @file{wsock32.lib}, nor any other external library
-statically linked into the DLLs.
+@subsection Linking to Libav with Microsoft Visual C++
+
+If you plan to link with MSVC-built static libraries, you will need
+to make sure you have @code{Runtime Library} set to
+@code{Multi-threaded (/MT)} in your project's settings.
Libav headers do not declare global data for Windows DLLs through the usual
dllexport/dllimport interface. Such data will be exported properly while
-building, but to use them in your MSVC++ code you will have to edit the
+building, but to use them in your MSVC code you will have to edit the
appropriate headers and mark the data as dllimport. For example, in
libavutil/pixdesc.h you should have:
@example
extern __declspec(dllimport) const AVPixFmtDescriptor av_pix_fmt_descriptors[];
@end example
-Note that using import libraries created by dlltool requires
-the linker optimization option to be set to
-"References: Keep Unreferenced Data (@code{/OPT:NOREF})", otherwise
-the resulting binaries will fail during runtime. This isn't
-required when using import libraries generated by lib.exe.
+You will also need to define @code{inline} to something MSVC understands:
+@example
+#define inline __inline
+@end example
+
+Also note, that as stated in @strong{Microsoft Visual C++}, you will need
+an MSVC-compatible @uref{http://code.google.com/p/msinttypes/, inttypes.h}.
+
+If you plan on using import libraries created by dlltool, you must
+set @code{References} to @code{No (/OPT:NOREF)} under the linker optimization
+settings, otherwise the resulting binaries will fail during runtime.
+This is not required when using import libraries generated by @code{lib.exe}.
This issue is reported upstream at
@url{http://sourceware.org/bugzilla/show_bug.cgi?id=12633}.
@@ -244,27 +208,24 @@ To create import libraries that work with the @code{/OPT:REF} option
@enumerate
-@item Open @file{Visual Studio 2005 Command Prompt}.
+@item Open the @emph{Visual Studio Command Prompt}.
Alternatively, in a normal command line prompt, call @file{vcvars32.bat}
which sets up the environment variables for the Visual C++ tools
-(the standard location for this file is
-@file{C:\Program Files\Microsoft Visual Studio 8\VC\bin\vcvars32.bat}).
+(the standard location for this file is something like
+@file{C:\Program Files (x86_\Microsoft Visual Studio 10.0\VC\bin\vcvars32.bat}).
@item Enter the @file{bin} directory where the created LIB and DLL files
are stored.
-@item Generate new import libraries with @file{lib.exe}:
+@item Generate new import libraries with @command{lib.exe}:
@example
-lib /machine:i386 /def:..\lib\avcodec-53.def /out:avcodec.lib
-lib /machine:i386 /def:..\lib\avdevice-53.def /out:avdevice.lib
-lib /machine:i386 /def:..\lib\avfilter-2.def /out:avfilter.lib
-lib /machine:i386 /def:..\lib\avformat-53.def /out:avformat.lib
-lib /machine:i386 /def:..\lib\avutil-51.def /out:avutil.lib
-lib /machine:i386 /def:..\lib\swscale-2.def /out:swscale.lib
+lib /machine:i386 /def:..\lib\foo-version.def /out:foo.lib
@end example
+Replace @code{foo-version} and @code{foo} with the respective library names.
+
@end enumerate
@anchor{Cross compilation for Windows with Linux}
@@ -293,24 +254,9 @@ following "Devel" ones:
binutils, gcc4-core, make, git, mingw-runtime, texi2html
@end example
-And the following "Utils" one:
-@example
-diffutils
-@end example
-
-Then run
-
-@example
-./configure
-@end example
-
-to make a static build.
-
-The current @code{gcc4-core} package is buggy and needs this flag to build
-shared libraries:
-
+In order to run FATE you will also need the following "Utils" packages:
@example
-./configure --enable-shared --disable-static --extra-cflags=-fno-reorder-functions
+bc, diffutils
@end example
If you want to build Libav with additional libraries, download Cygwin
@@ -323,16 +269,12 @@ These library packages are only available from
@uref{http://sourceware.org/cygwinports/, Cygwin Ports}:
@example
-yasm, libSDL-devel, libdirac-devel, libfaac-devel, libgsm-devel,
-libmp3lame-devel, libschroedinger1.0-devel, speex-devel, libtheora-devel,
-libxvidcore-devel
+yasm, libSDL-devel, libfaac-devel, libgsm-devel, libmp3lame-devel,
+libschroedinger1.0-devel, speex-devel, libtheora-devel, libxvidcore-devel
@end example
-The recommendation for libnut and x264 is to build them from source by
-yourself, as they evolve too quickly for Cygwin Ports to be up to date.
-
-Cygwin 1.7.x has IPv6 support. You can add IPv6 to Cygwin 1.5.x by means
-of the @code{libgetaddrinfo-devel} package, available at Cygwin Ports.
+The recommendation for x264 is to build it from source, as it evolves too
+quickly for Cygwin Ports to be up to date.
@section Crosscompilation for Windows under Cygwin
@@ -356,4 +298,67 @@ and for a build with shared libraries
./configure --target-os=mingw32 --enable-shared --disable-static --extra-cflags=-mno-cygwin --extra-libs=-mno-cygwin
@end example
+@chapter Plan 9
+
+The native @uref{http://plan9.bell-labs.com/plan9/, Plan 9} compiler
+does not implement all the C99 features needed by Libav so the gcc
+port must be used. Furthermore, a few items missing from the C
+library and shell environment need to be fixed.
+
+@itemize
+
+@item GNU awk, grep, make, and sed
+
+Working packages of these tools can be found at
+@uref{http://code.google.com/p/ports2plan9/downloads/list, ports2plan9}.
+They can be installed with @uref{http://9front.org/, 9front's} @code{pkg}
+utility by setting @code{pkgpath} to
+@code{http://ports2plan9.googlecode.com/files/}.
+
+@item Missing/broken @code{head} and @code{printf} commands
+
+Replacements adequate for building Libav can be found in the
+@code{compat/plan9} directory. Place these somewhere they will be
+found by the shell. These are not full implementations of the
+commands and are @emph{not} suitable for general use.
+
+@item Missing C99 @code{stdint.h} and @code{inttypes.h}
+
+Replacement headers are available from
+@url{http://code.google.com/p/plan9front/issues/detail?id=152}.
+
+@item Missing or non-standard library functions
+
+Some functions in the C library are missing or incomplete. The
+@code{@uref{http://ports2plan9.googlecode.com/files/gcc-apelibs-1207.tbz,
+gcc-apelibs-1207}} package from
+@uref{http://code.google.com/p/ports2plan9/downloads/list, ports2plan9}
+includes an updated C library, but installing the full package gives
+unusable executables. Instead, keep the files from @code{gccbin.tgz}
+under @code{/386/lib/gnu}. From the @code{libc.a} archive in the
+@code{gcc-apelibs-1207} package, extract the following object files and
+turn them into a library:
+
+@itemize
+@item @code{strerror.o}
+@item @code{strtoll.o}
+@item @code{snprintf.o}
+@item @code{vsnprintf.o}
+@item @code{vfprintf.o}
+@item @code{_IO_getc.o}
+@item @code{_IO_putc.o}
+@end itemize
+
+Use the @code{--extra-libs} option of @code{configure} to inform the
+build system of this library.
+
+@item FPU exceptions enabled by default
+
+Unlike most other systems, Plan 9 enables FPU exceptions by default.
+These must be disabled before calling any Libav functions. While the
+included tools will do this automatically, other users of the
+libraries must do it themselves.
+
+@end itemize
+
@bye
diff --git a/gst-libs/ext/libav/doc/print_options.c b/gst-libs/ext/libav/doc/print_options.c
new file mode 100644
index 0000000..4283e6a
--- /dev/null
+++ b/gst-libs/ext/libav/doc/print_options.c
@@ -0,0 +1,123 @@
+/*
+ * Copyright (c) 2012 Anton Khirnov
+ *
+ * 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
+ */
+
+/*
+ * generate texinfo manpages for avoptions
+ */
+
+#include <stddef.h>
+#include <string.h>
+#include <float.h>
+
+#include "libavformat/avformat.h"
+#include "libavcodec/avcodec.h"
+#include "libavutil/opt.h"
+
+static void print_usage(void)
+{
+ fprintf(stderr, "Usage: enum_options type\n"
+ "type: format codec\n");
+ exit(1);
+}
+
+static void print_option(const AVOption *opts, const AVOption *o, int per_stream)
+{
+ printf("@item -%s%s @var{", o->name, per_stream ? "[:stream_specifier]" : "");
+ switch (o->type) {
+ case AV_OPT_TYPE_BINARY: printf("hexadecimal string"); break;
+ case AV_OPT_TYPE_STRING: printf("string"); break;
+ case AV_OPT_TYPE_INT:
+ case AV_OPT_TYPE_INT64: printf("integer"); break;
+ case AV_OPT_TYPE_FLOAT:
+ case AV_OPT_TYPE_DOUBLE: printf("float"); break;
+ case AV_OPT_TYPE_RATIONAL: printf("rational number"); break;
+ case AV_OPT_TYPE_FLAGS: printf("flags"); break;
+ default: printf("value"); break;
+ }
+ printf("} (@emph{");
+
+ if (o->flags & AV_OPT_FLAG_DECODING_PARAM) {
+ printf("input");
+ if (o->flags & AV_OPT_FLAG_ENCODING_PARAM)
+ printf("/");
+ }
+ if (o->flags & AV_OPT_FLAG_ENCODING_PARAM) printf("output");
+ if (o->flags & AV_OPT_FLAG_AUDIO_PARAM) printf(",audio");
+ if (o->flags & AV_OPT_FLAG_VIDEO_PARAM) printf(",video");
+ if (o->flags & AV_OPT_FLAG_SUBTITLE_PARAM) printf(",subtitles");
+
+ printf("})\n");
+ if (o->help)
+ printf("%s\n", o->help);
+
+ if (o->unit) {
+ const AVOption *u;
+ printf("\nPossible values:\n@table @samp\n");
+
+ for (u = opts; u->name; u++) {
+ if (u->type == AV_OPT_TYPE_CONST && u->unit && !strcmp(u->unit, o->unit))
+ printf("@item %s\n%s\n", u->name, u->help ? u->help : "");
+ }
+ printf("@end table\n");
+ }
+}
+
+static void show_opts(const AVOption *opts, int per_stream)
+{
+ const AVOption *o;
+
+ printf("@table @option\n");
+ for (o = opts; o->name; o++) {
+ if (o->type != AV_OPT_TYPE_CONST)
+ print_option(opts, o, per_stream);
+ }
+ printf("@end table\n");
+}
+
+static void show_format_opts(void)
+{
+#include "libavformat/options_table.h"
+
+ printf("@section Format AVOptions\n");
+ show_opts(options, 0);
+}
+
+static void show_codec_opts(void)
+{
+#include "libavcodec/options_table.h"
+
+ printf("@section Codec AVOptions\n");
+ show_opts(options, 1);
+}
+
+int main(int argc, char **argv)
+{
+ if (argc < 2)
+ print_usage();
+
+ if (!strcmp(argv[1], "format"))
+ show_format_opts();
+ else if (!strcmp(argv[1], "codec"))
+ show_codec_opts();
+ else
+ print_usage();
+
+ return 0;
+}
diff --git a/gst-libs/ext/libav/doc/protocols.texi b/gst-libs/ext/libav/doc/protocols.texi
index 1fe2dda..0d40e5e 100644
--- a/gst-libs/ext/libav/doc/protocols.texi
+++ b/gst-libs/ext/libav/doc/protocols.texi
@@ -19,22 +19,6 @@ supported protocols.
A description of the currently available protocols follows.
-@section applehttp
-
-Read Apple HTTP Live Streaming compliant segmented stream as
-a uniform one. The M3U8 playlists describing the segments can be
-remote HTTP resources or local files, accessed using the standard
-file protocol.
-HTTP is default, specific protocol can be declared by specifying
-"+@var{proto}" after the applehttp URI scheme name, where @var{proto}
-is either "file" or "http".
-
-@example
-applehttp://host/path/to/remote/resource.m3u8
-applehttp+http://host/path/to/remote/resource.m3u8
-applehttp+file://path/to/local/resource.m3u8
-@end example
-
@section concat
Physical concatenation protocol.
@@ -52,7 +36,7 @@ resource to be concatenated, each one possibly specifying a distinct
protocol.
For example to read a sequence of files @file{split1.mpeg},
-@file{split2.mpeg}, @file{split3.mpeg} with @file{avplay} use the
+@file{split2.mpeg}, @file{split3.mpeg} with @command{avplay} use the
command:
@example
avplay concat:split1.mpeg\|split2.mpeg\|split3.mpeg
@@ -81,6 +65,26 @@ specified with the name "FILE.mpeg" is interpreted as the URL
Gopher protocol.
+@section hls
+
+Read Apple HTTP Live Streaming compliant segmented stream as
+a uniform one. The M3U8 playlists describing the segments can be
+remote HTTP resources or local files, accessed using the standard
+file protocol.
+The nested protocol is declared by specifying
+"+@var{proto}" after the hls URI scheme name, where @var{proto}
+is either "file" or "http".
+
+@example
+hls+http://host/path/to/remote/resource.m3u8
+hls+file://path/to/local/resource.m3u8
+@end example
+
+Using this protocol is discouraged - the hls demuxer should work
+just as well (if not, please report the issues) and is more complete.
+To use the hls demuxer instead, simply use the direct URLs to the
+m3u8 files.
+
@section http
HTTP (Hyper Text Transfer Protocol).
@@ -160,7 +164,7 @@ content across a TCP/IP network.
The required syntax is:
@example
-rtmp://@var{server}[:@var{port}][/@var{app}][/@var{playpath}]
+rtmp://@var{server}[:@var{port}][/@var{app}][/@var{instance}][/@var{playpath}]
@end example
The accepted parameters are:
@@ -175,20 +179,137 @@ The number of the TCP port to use (by default is 1935).
@item app
It is the name of the application to access. It usually corresponds to
the path where the application is installed on the RTMP server
-(e.g. @file{/ondemand/}, @file{/flash/live/}, etc.).
+(e.g. @file{/ondemand/}, @file{/flash/live/}, etc.). You can override
+the value parsed from the URI through the @code{rtmp_app} option, too.
@item playpath
It is the path or name of the resource to play with reference to the
-application specified in @var{app}, may be prefixed by "mp4:".
+application specified in @var{app}, may be prefixed by "mp4:". You
+can override the value parsed from the URI through the @code{rtmp_playpath}
+option, too.
+
+@item listen
+Act as a server, listening for an incoming connection.
+
+@item timeout
+Maximum time to wait for the incoming connection. Implies listen.
+@end table
+
+Additionally, the following parameters can be set via command line options
+(or in code via @code{AVOption}s):
+@table @option
+
+@item rtmp_app
+Name of application to connect on the RTMP server. This option
+overrides the parameter specified in the URI.
+
+@item rtmp_buffer
+Set the client buffer time in milliseconds. The default is 3000.
+
+@item rtmp_conn
+Extra arbitrary AMF connection parameters, parsed from a string,
+e.g. like @code{B:1 S:authMe O:1 NN:code:1.23 NS:flag:ok O:0}.
+Each value is prefixed by a single character denoting the type,
+B for Boolean, N for number, S for string, O for object, or Z for null,
+followed by a colon. For Booleans the data must be either 0 or 1 for
+FALSE or TRUE, respectively. Likewise for Objects the data must be 0 or
+1 to end or begin an object, respectively. Data items in subobjects may
+be named, by prefixing the type with 'N' and specifying the name before
+the value (i.e. @code{NB:myFlag:1}). This option may be used multiple
+times to construct arbitrary AMF sequences.
+
+@item rtmp_flashver
+Version of the Flash plugin used to run the SWF player. The default
+is LNX 9,0,124,2.
+
+@item rtmp_flush_interval
+Number of packets flushed in the same request (RTMPT only). The default
+is 10.
+
+@item rtmp_live
+Specify that the media is a live stream. No resuming or seeking in
+live streams is possible. The default value is @code{any}, which means the
+subscriber first tries to play the live stream specified in the
+playpath. If a live stream of that name is not found, it plays the
+recorded stream. The other possible values are @code{live} and
+@code{recorded}.
+
+@item rtmp_pageurl
+URL of the web page in which the media was embedded. By default no
+value will be sent.
+
+@item rtmp_playpath
+Stream identifier to play or to publish. This option overrides the
+parameter specified in the URI.
+
+@item rtmp_subscribe
+Name of live stream to subscribe to. By default no value will be sent.
+It is only sent if the option is specified or if rtmp_live
+is set to live.
+
+@item rtmp_swfhash
+SHA256 hash of the decompressed SWF file (32 bytes).
+
+@item rtmp_swfsize
+Size of the decompressed SWF file, required for SWFVerification.
+
+@item rtmp_swfurl
+URL of the SWF player for the media. By default no value will be sent.
+
+@item rtmp_swfverify
+URL to player swf file, compute hash/size automatically.
+
+@item rtmp_tcurl
+URL of the target stream. Defaults to proto://host[:port]/app.
@end table
-For example to read with @file{avplay} a multimedia resource named
+For example to read with @command{avplay} a multimedia resource named
"sample" from the application "vod" from an RTMP server "myserver":
@example
avplay rtmp://myserver/vod/sample
@end example
+@section rtmpe
+
+Encrypted Real-Time Messaging Protocol.
+
+The Encrypted Real-Time Messaging Protocol (RTMPE) is used for
+streaming multimedia content within standard cryptographic primitives,
+consisting of Diffie-Hellman key exchange and HMACSHA256, generating
+a pair of RC4 keys.
+
+@section rtmps
+
+Real-Time Messaging Protocol over a secure SSL connection.
+
+The Real-Time Messaging Protocol (RTMPS) is used for streaming
+multimedia content across an encrypted connection.
+
+@section rtmpt
+
+Real-Time Messaging Protocol tunneled through HTTP.
+
+The Real-Time Messaging Protocol tunneled through HTTP (RTMPT) is used
+for streaming multimedia content within HTTP requests to traverse
+firewalls.
+
+@section rtmpte
+
+Encrypted Real-Time Messaging Protocol tunneled through HTTP.
+
+The Encrypted Real-Time Messaging Protocol tunneled through HTTP (RTMPTE)
+is used for streaming multimedia content within HTTP requests to traverse
+firewalls.
+
+@section rtmpts
+
+Real-Time Messaging Protocol tunneled through HTTPS.
+
+The Real-Time Messaging Protocol tunneled through HTTPS (RTMPTS) is used
+for streaming multimedia content within HTTPS requests to traverse
+firewalls.
+
@section rtmp, rtmpe, rtmps, rtmpt, rtmpte
Real-Time Messaging Protocol and its variants supported through
@@ -224,7 +345,7 @@ For example, to stream a file in real-time to an RTMP server using
avconv -re -i myfile -f flv rtmp://myserver/live/mystream
@end example
-To play the same stream using @file{avplay}:
+To play the same stream using @command{avplay}:
@example
avplay "rtmp://myserver/live/mystream live=1"
@end example
@@ -249,7 +370,7 @@ The required syntax for a RTSP url is:
rtsp://@var{hostname}[:@var{port}]/@var{path}
@end example
-The following options (set on the @command{avconv}/@file{avplay} command
+The following options (set on the @command{avconv}/@command{avplay} command
line, or set in code via @code{AVOption}s or in @code{avformat_open_input}),
are supported:
@@ -281,14 +402,16 @@ Flags for @code{rtsp_flags}:
@table @option
@item filter_src
Accept packets only from negotiated peer address and port.
+@item listen
+Act as a server, listening for an incoming connection.
@end table
When receiving data over UDP, the demuxer tries to reorder received packets
-(since they may arrive out of order, or packets may get lost totally). In
-order for this to be enabled, a maximum delay must be specified in the
-@code{max_delay} field of AVFormatContext.
+(since they may arrive out of order, or packets may get lost totally). This
+can be disabled by setting the maximum demuxing delay to zero (via
+the @code{max_delay} field of AVFormatContext).
-When watching multi-bitrate Real-RTSP streams with @file{avplay}, the
+When watching multi-bitrate Real-RTSP streams with @command{avplay}, the
streams to display can be chosen with @code{-vst} @var{n} and
@code{-ast} @var{n} for video and audio respectively, and can be switched
on the fly by pressing @code{v} and @code{a}.
@@ -313,6 +436,12 @@ To send a stream in realtime to a RTSP server, for others to watch:
avconv -re -i @var{input} -f rtsp -muxdelay 0.1 rtsp://server/live.sdp
@end example
+To receive a stream in realtime:
+
+@example
+avconv -rtsp_flags listen -i rtsp://ownaddress/live.sdp @var{output}
+@end example
+
@section sap
Session Announcement Protocol (RFC 2974). This is not technically a
@@ -470,6 +599,14 @@ and makes writes return with AVERROR(ECONNREFUSED) if "destination
unreachable" is received.
For receiving, this gives the benefit of only receiving packets from
the specified peer address/port.
+
+@item sources=@var{address}[,@var{address}]
+Only receive packets sent to the multicast group from one of the
+specified sender IP addresses.
+
+@item block=@var{address}[,@var{address}]
+Ignore packets sent to the multicast group from the specified
+sender IP addresses.
@end table
Some usage examples of the udp protocol with @command{avconv} follow.
diff --git a/gst-libs/ext/libav/doc/rate_distortion.txt b/gst-libs/ext/libav/doc/rate_distortion.txt
index a7d2c87..e9711c2 100644
--- a/gst-libs/ext/libav/doc/rate_distortion.txt
+++ b/gst-libs/ext/libav/doc/rate_distortion.txt
@@ -23,7 +23,7 @@ Let's consider the problem of minimizing:
rate is the filesize
distortion is the quality
-lambda is a fixed value choosen as a tradeoff between quality and filesize
+lambda is a fixed value chosen as a tradeoff between quality and filesize
Is this equivalent to finding the best quality for a given max
filesize? The answer is yes. For each filesize limit there is some lambda
factor for which minimizing above will get you the best quality (using your
diff --git a/gst-libs/ext/libav/doc/swscale.txt b/gst-libs/ext/libav/doc/swscale.txt
index 4c62e67..2066009 100644
--- a/gst-libs/ext/libav/doc/swscale.txt
+++ b/gst-libs/ext/libav/doc/swscale.txt
@@ -58,7 +58,7 @@ Input to YUV Converter
Horizontal scaler
There are several horizontal scalers. A special case worth mentioning is
- the fast bilinear scaler that is made of runtime-generated MMX2 code
+ the fast bilinear scaler that is made of runtime-generated MMXEXT code
using specially tuned pshufw instructions.
The remaining scalers are specially-tuned for various filter lengths.
They scale 8-bit unsigned planar data to 16-bit signed planar data.
@@ -96,4 +96,3 @@ would benefit from it.
Also, as already hinted at, initFilter() accepts an optional convolutional
filter as input that can be used for contrast, saturation, blur, sharpening
shift, chroma vs. luma shift, ...
-
diff --git a/gst-libs/ext/libav/doc/t2h.init b/gst-libs/ext/libav/doc/t2h.init
index d91d7b6..78c5177 100644
--- a/gst-libs/ext/libav/doc/t2h.init
+++ b/gst-libs/ext/libav/doc/t2h.init
@@ -6,73 +6,135 @@ sub Libav_end_section($$)
$EXTRA_HEAD =
'<link rel="icon" href="favicon.png" type="image/png" />
-<link rel="stylesheet" type="text/css" href="default.css" />
';
-$CSS_LINES = <<EOT;
+$CSS_LINES = $ENV{"LIBAV_CSS"} || <<EOT;
<style type="text/css">
<!--
-a.summary-letter { text-decoration: none }
-a { color: #2D6198; }
-a:visited { color: #884488; }
-h1 a, h2 a, h3 a { text-decoration: inherit; color: inherit; }
-p { margin-left: 1em; margin-right: 1em; }
-table { margin-left: 2em; }
-pre { margin-left: 2em; }
-#footer { text-align: center; }
-#body { margin-left: 1em; margin-right: 1em; }
-body { background-color: #313131; margin: 0; }
-
-#container {
- background-color: white;
- color: #202020;
- margin-left: 1em;
- margin-right: 1em;
+.container {
+ margin-right: auto;
+ margin-left: auto;
+ width: 1070px;
+}
+body {
+ font-size: 14px;
+ line-height: 20px;
+ color: #333333;
+ background-color: #ffffff;
+}
+a {
+ color: #0088cc;
+ text-decoration: none;
+}
+a:hover {
+ color: #005580;
+ text-decoration: underline;
+}
+p {
+ margin: 0 0 10px;
+}
+h2,
+h3,
+h4 {
+ margin: 10px 0;
+ font-family: inherit;
+ font-weight: bold;
+ line-height: 1;
+ border-color: #D6E9C6;
+ color: #468847;
+ border-style: solid;
+ border-width: 0 0 1px;
+ padding-left: 0.5em;
}
+h1 a,
+h2 a,
+h3 a,
+h4 a {
+ color: inherit;
+}
h1 {
- background-color: #7BB37B;
- border: 1px solid #6A996A;
- color: #151515;
- font-size: 1.2em;
- padding-bottom: 0.2em;
- padding-left: 0.4em;
- padding-top: 0.2em;
+ font-size: 30px;
+ line-height: 40px;
}
-
h2 {
- color: #313131;
- font-size: 1.2em;
+ font-size: 20px;
+ line-height: 40px;
}
-
h3 {
- color: #313131;
- font-size: 0.8em;
- margin-bottom: -8px;
+ font-size: 18px;
+ line-height: 40px;
+}
+code,
+pre {
+ padding: 0 3px 2px;
+ font-family: monospace;
+ font-size: 12px;
+ color: #333333;
+ border-radius: 3px;
+}
+pre {
+ display: block;
+ padding: 9.5px;
+ margin: 0 0 10px;
+ font-size: 13px;
+ line-height: 20px;
+ word-break: break-all;
+ word-wrap: break-word;
+ white-space: pre;
+ white-space: pre-wrap;
+ background-color: #f5f5f5;
+ border: 1px solid #ccc;
+ border-radius: 4px;
}
-.note {
- margin: 1em;
- border: 1px solid #bbc9d8;
- background-color: #dde1e1;
+code {
+ padding: 2px 4px;
+ color: #d14;
+ background-color: #f7f7f9;
+ border: 1px solid #e1e1e8;
+}
+pre code {
+ padding: 0;
+ color: inherit;
+ background-color: transparent;
+ border: 0;
+}
+.alert {
+ padding: 8px 35px 8px 14px;
+ margin-bottom: 20px;
+ text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
+ background-color: #fcf8e3;
+ border: 1px solid #fbeed5;
+ border-radius: 4px;
+ color: #c09853;
}
-.important {
- margin: 1em;
- border: 1px solid #d26767;
- background-color: #f8e1e1;
+.alert-danger,
+.alert-error {
+ background-color: #f2dede;
+ border-color: #eed3d7;
+ color: #b94a48;
+}
+.alert-info {
+ background-color: #d9edf7;
+ border-color: #bce8f1;
+ color: #3a87ad;
}
+ul.toc {
+ list-style-type: none;
+}
-->
</style>
EOT
-my $LIBAV_NAVBAR = $ENV{"LIBAV_NAVBAR"} || '';
-
-$AFTER_BODY_OPEN =
-'<div id="container">' .
-"\n$LIBAV_NAVBAR\n" .
-'<div id="body">';
+my $TEMPLATE_HEADER = $ENV{"LIBAV_HEADER"} || <<EOT;
+<link rel="icon" href="favicon.png" type="image/png" />
+</head>
+<body>
+<div class="container">
+EOT
$PRE_BODY_CLOSE = '</div></div>';
@@ -83,9 +145,11 @@ $print_page_foot = \&Libav_print_page_foot;
sub Libav_print_page_foot($$)
{
my $fh = shift;
- print $fh '<div id="footer">' . "\n";
- T2H_DEFAULT_print_page_foot($fh);
- print $fh "</div>\n";
+ my $program_string = defined &T2H_DEFAULT_program_string ?
+ T2H_DEFAULT_program_string() : program_string();
+ print $fh '<footer class="footer pagination-right">' . "\n";
+ print $fh '<span class="label label-info">' . $program_string;
+ print $fh "</span></footer></div>\n";
}
$float = \&Libav_float;
@@ -107,11 +171,11 @@ sub Libav_float($$$$)
if ($caption =~ /NOTE/)
{
- $class = "note";
+ $class = "alert alert-info";
}
elsif ($caption =~ /IMPORTANT/)
{
- $class = "important";
+ $class = "alert alert-warning";
}
return '<div class="float ' . $class . '">' . "$label\n" . $text . '</div>';
@@ -134,7 +198,7 @@ sub Libav_print_page_head($$)
$longtitle = "Libav documentation : " . $longtitle;
print $fh <<EOT;
-$DOCTYPE
+<!DOCTYPE html>
<html>
$Texi2HTML::THISDOC{'copying'}<!-- Created on $Texi2HTML::THISDOC{today} by $Texi2HTML::THISDOC{program} -->
<!--
@@ -150,11 +214,7 @@ $description
<meta name="Generator" content="$Texi2HTML::THISDOC{program}">
$encoding
$CSS_LINES
-$EXTRA_HEAD
-</head>
-
-<body $BODYTEXT>
-$AFTER_BODY_OPEN
+$TEMPLATE_HEADER
EOT
}
diff --git a/gst-libs/ext/libav/doc/texi2pod.pl b/gst-libs/ext/libav/doc/texi2pod.pl
index 0eb5e8d..94323be 100755
--- a/gst-libs/ext/libav/doc/texi2pod.pl
+++ b/gst-libs/ext/libav/doc/texi2pod.pl
@@ -36,7 +36,7 @@ $shift = "";
%defs = ();
$fnno = 1;
$inf = "";
-$ibase = "";
+@ibase = ();
while ($_ = shift) {
if (/^-D(.*)$/) {
@@ -52,6 +52,8 @@ while ($_ = shift) {
die "flags may only contain letters, digits, hyphens, dashes and underscores\n"
unless $flag =~ /^[a-zA-Z0-9_-]+$/;
$defs{$flag} = $value;
+ } elsif (/^-I(.*)$/) {
+ push @ibase, $1 ne "" ? $1 : shift;
} elsif (/^-/) {
usage();
} else {
@@ -61,10 +63,12 @@ while ($_ = shift) {
}
}
+push @ibase, ".";
+
if (defined $in) {
$inf = gensym();
open($inf, "<$in") or die "opening \"$in\": $!\n";
- $ibase = $1 if $in =~ m|^(.+)/[^/]+$|;
+ push @ibase, $1 if $in =~ m|^(.+)/[^/]+$|;
} else {
$inf = \*STDIN;
}
@@ -74,7 +78,7 @@ if (defined $out) {
}
while(defined $inf) {
-while(<$inf>) {
+INF: while(<$inf>) {
# Certain commands are discarded without further processing.
/^\@(?:
[a-z]+index # @*index: useful only in complete manual
@@ -104,11 +108,10 @@ while(<$inf>) {
push @instack, $inf;
$inf = gensym();
- # Try cwd and $ibase.
- open($inf, "<" . $1)
- or open($inf, "<" . $ibase . "/" . $1)
- or die "cannot open $1 or $ibase/$1: $!\n";
- next;
+ for (@ibase) {
+ open($inf, "<" . $_ . "/" . $1) and next INF;
+ }
+ die "cannot open $1: $!\n";
};
# Look for blocks surrounded by @c man begin SECTION ... @c man end.
diff --git a/gst-libs/ext/libav/doc/viterbi.txt b/gst-libs/ext/libav/doc/viterbi.txt
index d9d924f..9782546 100644
--- a/gst-libs/ext/libav/doc/viterbi.txt
+++ b/gst-libs/ext/libav/doc/viterbi.txt
@@ -85,8 +85,8 @@ here are some edges we could choose from:
/ \
O-----2--4--O
-Finding the new best pathes and scores for each point of our new column is
-trivial given we know the previous column best pathes and scores:
+Finding the new best paths and scores for each point of our new column is
+trivial given we know the previous column best paths and scores:
O-----0-----8
\
@@ -107,4 +107,3 @@ one with score 3)
Author: Michael niedermayer
Copyright LGPL
-
diff --git a/gst-libs/ext/libav/ffmpeg.c b/gst-libs/ext/libav/ffmpeg.c
deleted file mode 100644
index f61de33..0000000
--- a/gst-libs/ext/libav/ffmpeg.c
+++ /dev/null
@@ -1,4415 +0,0 @@
-/*
- * ffmpeg main
- * Copyright (c) 2000-2003 Fabrice Bellard
- *
- * 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
- */
-
-#include "config.h"
-#include <ctype.h>
-#include <string.h>
-#include <math.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <signal.h>
-#include <limits.h>
-#include <unistd.h>
-#include "libavformat/avformat.h"
-#include "libavdevice/avdevice.h"
-#include "libswscale/swscale.h"
-#include "libavutil/opt.h"
-#include "libavcodec/audioconvert.h"
-#include "libavutil/audioconvert.h"
-#include "libavutil/parseutils.h"
-#include "libavutil/samplefmt.h"
-#include "libavutil/colorspace.h"
-#include "libavutil/fifo.h"
-#include "libavutil/intreadwrite.h"
-#include "libavutil/dict.h"
-#include "libavutil/mathematics.h"
-#include "libavutil/pixdesc.h"
-#include "libavutil/avstring.h"
-#include "libavutil/libm.h"
-#include "libavformat/os_support.h"
-
-#if CONFIG_AVFILTER
-# include "libavfilter/avfilter.h"
-# include "libavfilter/avfiltergraph.h"
-# include "libavfilter/vsrc_buffer.h"
-#endif
-
-#if HAVE_SYS_RESOURCE_H
-#include <sys/types.h>
-#include <sys/time.h>
-#include <sys/resource.h>
-#elif HAVE_GETPROCESSTIMES
-#include <windows.h>
-#endif
-#if HAVE_GETPROCESSMEMORYINFO
-#include <windows.h>
-#include <psapi.h>
-#endif
-
-#if HAVE_SYS_SELECT_H
-#include <sys/select.h>
-#endif
-
-#include <time.h>
-
-#include "cmdutils.h"
-
-#include "libavutil/avassert.h"
-
-const char program_name[] = "ffmpeg";
-const int program_birth_year = 2000;
-
-/* select an input stream for an output stream */
-typedef struct StreamMap {
- int file_index;
- int stream_index;
- int sync_file_index;
- int sync_stream_index;
-} StreamMap;
-
-/**
- * select an input file for an output file
- */
-typedef struct MetadataMap {
- int file; ///< file index
- char type; ///< type of metadata to copy -- (g)lobal, (s)tream, (c)hapter or (p)rogram
- int index; ///< stream/chapter/program number
-} MetadataMap;
-
-typedef struct ChapterMap {
- int in_file;
- int out_file;
-} ChapterMap;
-
-static const OptionDef options[];
-
-#define MAX_FILES 100
-
-static const char *last_asked_format = NULL;
-static double *ts_scale;
-static int nb_ts_scale;
-
-static AVFormatContext *output_files[MAX_FILES];
-static AVDictionary *output_opts[MAX_FILES];
-static int nb_output_files = 0;
-
-static StreamMap *stream_maps = NULL;
-static int nb_stream_maps;
-
-/* first item specifies output metadata, second is input */
-static MetadataMap (*meta_data_maps)[2] = NULL;
-static int nb_meta_data_maps;
-static int metadata_global_autocopy = 1;
-static int metadata_streams_autocopy = 1;
-static int metadata_chapters_autocopy = 1;
-
-static ChapterMap *chapter_maps = NULL;
-static int nb_chapter_maps;
-
-/* indexed by output file stream index */
-static int *streamid_map = NULL;
-static int nb_streamid_map = 0;
-
-static int frame_width = 0;
-static int frame_height = 0;
-static float frame_aspect_ratio = 0;
-static enum PixelFormat frame_pix_fmt = PIX_FMT_NONE;
-static enum AVSampleFormat audio_sample_fmt = AV_SAMPLE_FMT_NONE;
-static int max_frames[4] = {INT_MAX, INT_MAX, INT_MAX, INT_MAX};
-static AVRational frame_rate;
-static float video_qscale = 0;
-static uint16_t *intra_matrix = NULL;
-static uint16_t *inter_matrix = NULL;
-static const char *video_rc_override_string=NULL;
-static int video_disable = 0;
-static int video_discard = 0;
-static char *video_codec_name = NULL;
-static unsigned int video_codec_tag = 0;
-static char *video_language = NULL;
-static int same_quality = 0;
-static int do_deinterlace = 0;
-static int top_field_first = -1;
-static int me_threshold = 0;
-static int intra_dc_precision = 8;
-static int loop_input = 0;
-static int loop_output = AVFMT_NOOUTPUTLOOP;
-static int qp_hist = 0;
-#if CONFIG_AVFILTER
-static char *vfilters = NULL;
-#endif
-
-static int intra_only = 0;
-static int audio_sample_rate = 0;
-#define QSCALE_NONE -99999
-static float audio_qscale = QSCALE_NONE;
-static int audio_disable = 0;
-static int audio_channels = 0;
-static char *audio_codec_name = NULL;
-static unsigned int audio_codec_tag = 0;
-static char *audio_language = NULL;
-
-static int subtitle_disable = 0;
-static char *subtitle_codec_name = NULL;
-static char *subtitle_language = NULL;
-static unsigned int subtitle_codec_tag = 0;
-
-static int data_disable = 0;
-static char *data_codec_name = NULL;
-static unsigned int data_codec_tag = 0;
-
-static float mux_preload= 0.5;
-static float mux_max_delay= 0.7;
-
-static int64_t recording_time = INT64_MAX;
-static int64_t start_time = 0;
-static int64_t input_ts_offset = 0;
-static int file_overwrite = 0;
-static AVDictionary *metadata;
-static int do_benchmark = 0;
-static int do_hex_dump = 0;
-static int do_pkt_dump = 0;
-static int do_psnr = 0;
-static int do_pass = 0;
-static char *pass_logfilename_prefix = NULL;
-static int audio_stream_copy = 0;
-static int video_stream_copy = 0;
-static int subtitle_stream_copy = 0;
-static int data_stream_copy = 0;
-static int video_sync_method= -1;
-static int audio_sync_method= 0;
-static float audio_drift_threshold= 0.1;
-static int copy_ts= 0;
-static int copy_tb;
-static int opt_shortest = 0;
-static char *vstats_filename;
-static FILE *vstats_file;
-static int opt_programid = 0;
-static int copy_initial_nonkeyframes = 0;
-
-static int rate_emu = 0;
-
-static int audio_volume = 256;
-
-static int exit_on_error = 0;
-static int using_stdin = 0;
-static int verbose = 1;
-static int thread_count= 1;
-static int64_t video_size = 0;
-static int64_t audio_size = 0;
-static int64_t extra_size = 0;
-static int nb_frames_dup = 0;
-static int nb_frames_drop = 0;
-static int input_sync;
-static uint64_t limit_filesize = 0;
-static int force_fps = 0;
-static char *forced_key_frames = NULL;
-
-static float dts_delta_threshold = 10;
-
-static int64_t timer_start;
-
-static uint8_t *audio_buf;
-static uint8_t *audio_out;
-static unsigned int allocated_audio_out_size, allocated_audio_buf_size;
-
-static short *samples;
-
-static AVBitStreamFilterContext *video_bitstream_filters=NULL;
-static AVBitStreamFilterContext *audio_bitstream_filters=NULL;
-static AVBitStreamFilterContext *subtitle_bitstream_filters=NULL;
-
-#define DEFAULT_PASS_LOGFILENAME_PREFIX "ffmpeg2pass"
-
-struct InputStream;
-
-typedef struct OutputStream {
- int file_index; /* file index */
- int index; /* stream index in the output file */
- int source_index; /* InputStream index */
- AVStream *st; /* stream in the output file */
- int encoding_needed; /* true if encoding needed for this stream */
- int frame_number;
- /* input pts and corresponding output pts
- for A/V sync */
- //double sync_ipts; /* dts from the AVPacket of the demuxer in second units */
- struct InputStream *sync_ist; /* input stream to sync against */
- int64_t sync_opts; /* output frame counter, could be changed to some true timestamp */ //FIXME look at frame_number
- AVBitStreamFilterContext *bitstream_filters;
- AVCodec *enc;
-
- /* video only */
- int video_resample;
- AVFrame pict_tmp; /* temporary image for resampling */
- struct SwsContext *img_resample_ctx; /* for image resampling */
- int resample_height;
- int resample_width;
- int resample_pix_fmt;
- AVRational frame_rate;
-
- float frame_aspect_ratio;
-
- /* forced key frames */
- int64_t *forced_kf_pts;
- int forced_kf_count;
- int forced_kf_index;
-
- /* audio only */
- int audio_resample;
- ReSampleContext *resample; /* for audio resampling */
- int resample_sample_fmt;
- int resample_channels;
- int resample_sample_rate;
- int reformat_pair;
- AVAudioConvert *reformat_ctx;
- AVFifoBuffer *fifo; /* for compression: one audio fifo per codec */
- FILE *logfile;
-
-#if CONFIG_AVFILTER
- AVFilterContext *output_video_filter;
- AVFilterContext *input_video_filter;
- AVFilterBufferRef *picref;
- char *avfilter;
- AVFilterGraph *graph;
-#endif
-
- int sws_flags;
- AVDictionary *opts;
-} OutputStream;
-
-static OutputStream **output_streams_for_file[MAX_FILES] = { NULL };
-static int nb_output_streams_for_file[MAX_FILES] = { 0 };
-
-typedef struct InputStream {
- int file_index;
- AVStream *st;
- int discard; /* true if stream data should be discarded */
- int decoding_needed; /* true if the packets must be decoded in 'raw_fifo' */
- AVCodec *dec;
-
- int64_t start; /* time when read started */
- int64_t next_pts; /* synthetic pts for cases where pkt.pts
- is not defined */
- int64_t pts; /* current pts */
- PtsCorrectionContext pts_ctx;
- double ts_scale;
- int is_start; /* is 1 at the start and after a discontinuity */
- int showed_multi_packet_warning;
- int is_past_recording_time;
- AVDictionary *opts;
-} InputStream;
-
-typedef struct InputFile {
- AVFormatContext *ctx;
- int eof_reached; /* true if eof reached */
- int ist_index; /* index of first stream in ist_table */
- int buffer_size; /* current total buffer size */
- int64_t ts_offset;
- int nb_streams; /* nb streams we are aware of */
-} InputFile;
-
-static InputStream *input_streams = NULL;
-static int nb_input_streams = 0;
-static InputFile *input_files = NULL;
-static int nb_input_files = 0;
-
-#if CONFIG_AVFILTER
-
-static int configure_video_filters(InputStream *ist, OutputStream *ost)
-{
- AVFilterContext *last_filter, *filter;
- /** filter graph containing all filters including input & output */
- AVCodecContext *codec = ost->st->codec;
- AVCodecContext *icodec = ist->st->codec;
- AVSinkContext avsink_ctx = { .pix_fmt = codec->pix_fmt };
- AVRational sample_aspect_ratio;
- char args[255];
- int ret;
-
- ost->graph = avfilter_graph_alloc();
-
- if (ist->st->sample_aspect_ratio.num){
- sample_aspect_ratio = ist->st->sample_aspect_ratio;
- }else
- sample_aspect_ratio = ist->st->codec->sample_aspect_ratio;
-
- snprintf(args, 255, "%d:%d:%d:%d:%d:%d:%d", ist->st->codec->width,
- ist->st->codec->height, ist->st->codec->pix_fmt, 1, AV_TIME_BASE,
- sample_aspect_ratio.num, sample_aspect_ratio.den);
-
- ret = avfilter_graph_create_filter(&ost->input_video_filter, avfilter_get_by_name("buffer"),
- "src", args, NULL, ost->graph);
- if (ret < 0)
- return ret;
- ret = avfilter_graph_create_filter(&ost->output_video_filter, &avsink,
- "out", NULL, &avsink_ctx, ost->graph);
- if (ret < 0)
- return ret;
- last_filter = ost->input_video_filter;
-
- if (codec->width != icodec->width || codec->height != icodec->height) {
- snprintf(args, 255, "%d:%d:flags=0x%X",
- codec->width,
- codec->height,
- ost->sws_flags);
- if ((ret = avfilter_graph_create_filter(&filter, avfilter_get_by_name("scale"),
- NULL, args, NULL, ost->graph)) < 0)
- return ret;
- if ((ret = avfilter_link(last_filter, 0, filter, 0)) < 0)
- return ret;
- last_filter = filter;
- }
-
- snprintf(args, sizeof(args), "flags=0x%X", ost->sws_flags);
- ost->graph->scale_sws_opts = av_strdup(args);
-
- if (ost->avfilter) {
- AVFilterInOut *outputs = av_malloc(sizeof(AVFilterInOut));
- AVFilterInOut *inputs = av_malloc(sizeof(AVFilterInOut));
-
- outputs->name = av_strdup("in");
- outputs->filter_ctx = last_filter;
- outputs->pad_idx = 0;
- outputs->next = NULL;
-
- inputs->name = av_strdup("out");
- inputs->filter_ctx = ost->output_video_filter;
- inputs->pad_idx = 0;
- inputs->next = NULL;
-
- if ((ret = avfilter_graph_parse(ost->graph, ost->avfilter, inputs, outputs, NULL)) < 0)
- return ret;
- av_freep(&ost->avfilter);
- } else {
- if ((ret = avfilter_link(last_filter, 0, ost->output_video_filter, 0)) < 0)
- return ret;
- }
-
- if ((ret = avfilter_graph_config(ost->graph, NULL)) < 0)
- return ret;
-
- codec->width = ost->output_video_filter->inputs[0]->w;
- codec->height = ost->output_video_filter->inputs[0]->h;
- codec->sample_aspect_ratio = ost->st->sample_aspect_ratio =
- ost->frame_aspect_ratio ? // overriden by the -aspect cli option
- av_d2q(ost->frame_aspect_ratio*codec->height/codec->width, 255) :
- ost->output_video_filter->inputs[0]->sample_aspect_ratio;
-
- return 0;
-}
-#endif /* CONFIG_AVFILTER */
-
-static void term_exit(void)
-{
- av_log(NULL, AV_LOG_QUIET, "");
-}
-
-static volatile int received_sigterm = 0;
-static volatile int received_nb_signals = 0;
-
-static void
-sigterm_handler(int sig)
-{
- received_sigterm = sig;
- received_nb_signals++;
- term_exit();
-}
-
-static void term_init(void)
-{
- signal(SIGINT , sigterm_handler); /* Interrupt (ANSI). */
- signal(SIGTERM, sigterm_handler); /* Termination (ANSI). */
-#ifdef SIGXCPU
- signal(SIGXCPU, sigterm_handler);
-#endif
-}
-
-static int decode_interrupt_cb(void)
-{
- return received_nb_signals > 1;
-}
-
-void exit_program(int ret)
-{
- int i;
-
- /* close files */
- for(i=0;i<nb_output_files;i++) {
- AVFormatContext *s = output_files[i];
- if (!(s->oformat->flags & AVFMT_NOFILE) && s->pb)
- avio_close(s->pb);
- avformat_free_context(s);
- av_free(output_streams_for_file[i]);
- av_dict_free(&output_opts[i]);
- }
- for(i=0;i<nb_input_files;i++) {
- av_close_input_file(input_files[i].ctx);
- }
- for (i = 0; i < nb_input_streams; i++)
- av_dict_free(&input_streams[i].opts);
-
- av_free(intra_matrix);
- av_free(inter_matrix);
-
- if (vstats_file)
- fclose(vstats_file);
- av_free(vstats_filename);
-
- av_free(streamid_map);
- av_free(stream_maps);
- av_free(meta_data_maps);
-
- av_freep(&input_streams);
- av_freep(&input_files);
-
- av_free(video_codec_name);
- av_free(audio_codec_name);
- av_free(subtitle_codec_name);
- av_free(data_codec_name);
-
- uninit_opts();
- av_free(audio_buf);
- av_free(audio_out);
- allocated_audio_buf_size= allocated_audio_out_size= 0;
- av_free(samples);
-
-#if CONFIG_AVFILTER
- avfilter_uninit();
-#endif
- avformat_network_deinit();
-
- if (received_sigterm) {
- fprintf(stderr,
- "Received signal %d: terminating.\n",
- (int) received_sigterm);
- exit (255);
- }
-
- exit(ret); /* not all OS-es handle main() return value */
-}
-
-static void assert_avoptions(AVDictionary *m)
-{
- AVDictionaryEntry *t;
- if ((t = av_dict_get(m, "", NULL, AV_DICT_IGNORE_SUFFIX))) {
- av_log(NULL, AV_LOG_ERROR, "Option %s not found.\n", t->key);
- exit_program(1);
- }
-}
-
-static void assert_codec_experimental(AVCodecContext *c, int encoder)
-{
- const char *codec_string = encoder ? "encoder" : "decoder";
- AVCodec *codec;
- if (c->codec->capabilities & CODEC_CAP_EXPERIMENTAL &&
- c->strict_std_compliance > FF_COMPLIANCE_EXPERIMENTAL) {
- av_log(NULL, AV_LOG_ERROR, "%s '%s' is experimental and might produce bad "
- "results.\nAdd '-strict experimental' if you want to use it.\n",
- codec_string, c->codec->name);
- codec = encoder ? avcodec_find_encoder(c->codec->id) : avcodec_find_decoder(c->codec->id);
- if (!(codec->capabilities & CODEC_CAP_EXPERIMENTAL))
- av_log(NULL, AV_LOG_ERROR, "Or use the non experimental %s '%s'.\n",
- codec_string, codec->name);
- exit_program(1);
- }
-}
-
-static void choose_sample_fmt(AVStream *st, AVCodec *codec)
-{
- if(codec && codec->sample_fmts){
- const enum AVSampleFormat *p= codec->sample_fmts;
- for(; *p!=-1; p++){
- if(*p == st->codec->sample_fmt)
- break;
- }
- if (*p == -1) {
- av_log(NULL, AV_LOG_WARNING,
- "Incompatible sample format '%s' for codec '%s', auto-selecting format '%s'\n",
- av_get_sample_fmt_name(st->codec->sample_fmt),
- codec->name,
- av_get_sample_fmt_name(codec->sample_fmts[0]));
- st->codec->sample_fmt = codec->sample_fmts[0];
- }
- }
-}
-
-/**
- * Update the requested input sample format based on the output sample format.
- * This is currently only used to request float output from decoders which
- * support multiple sample formats, one of which is AV_SAMPLE_FMT_FLT.
- * Ideally this will be removed in the future when decoders do not do format
- * conversion and only output in their native format.
- */
-static void update_sample_fmt(AVCodecContext *dec, AVCodec *dec_codec,
- AVCodecContext *enc)
-{
- /* if sample formats match or a decoder sample format has already been
- requested, just return */
- if (enc->sample_fmt == dec->sample_fmt ||
- dec->request_sample_fmt > AV_SAMPLE_FMT_NONE)
- return;
-
- /* if decoder supports more than one output format */
- if (dec_codec && dec_codec->sample_fmts &&
- dec_codec->sample_fmts[0] != AV_SAMPLE_FMT_NONE &&
- dec_codec->sample_fmts[1] != AV_SAMPLE_FMT_NONE) {
- const enum AVSampleFormat *p;
- int min_dec = -1, min_inc = -1;
-
- /* find a matching sample format in the encoder */
- for (p = dec_codec->sample_fmts; *p != AV_SAMPLE_FMT_NONE; p++) {
- if (*p == enc->sample_fmt) {
- dec->request_sample_fmt = *p;
- return;
- } else if (*p > enc->sample_fmt) {
- min_inc = FFMIN(min_inc, *p - enc->sample_fmt);
- } else
- min_dec = FFMIN(min_dec, enc->sample_fmt - *p);
- }
-
- /* if none match, provide the one that matches quality closest */
- dec->request_sample_fmt = min_inc > 0 ? enc->sample_fmt + min_inc :
- enc->sample_fmt - min_dec;
- }
-}
-
-static void choose_sample_rate(AVStream *st, AVCodec *codec)
-{
- if(codec && codec->supported_samplerates){
- const int *p= codec->supported_samplerates;
- int best=0;
- int best_dist=INT_MAX;
- for(; *p; p++){
- int dist= abs(st->codec->sample_rate - *p);
- if(dist < best_dist){
- best_dist= dist;
- best= *p;
- }
- }
- if(best_dist){
- av_log(st->codec, AV_LOG_WARNING, "Requested sampling rate unsupported using closest supported (%d)\n", best);
- }
- st->codec->sample_rate= best;
- }
-}
-
-static void choose_pixel_fmt(AVStream *st, AVCodec *codec)
-{
- if(codec && codec->pix_fmts){
- const enum PixelFormat *p= codec->pix_fmts;
- if(st->codec->strict_std_compliance <= FF_COMPLIANCE_UNOFFICIAL){
- if(st->codec->codec_id==CODEC_ID_MJPEG){
- p= (const enum PixelFormat[]){PIX_FMT_YUVJ420P, PIX_FMT_YUVJ422P, PIX_FMT_YUV420P, PIX_FMT_YUV422P, PIX_FMT_NONE};
- }else if(st->codec->codec_id==CODEC_ID_LJPEG){
- p= (const enum PixelFormat[]){PIX_FMT_YUVJ420P, PIX_FMT_YUVJ422P, PIX_FMT_YUVJ444P, PIX_FMT_YUV420P, PIX_FMT_YUV422P, PIX_FMT_YUV444P, PIX_FMT_BGRA, PIX_FMT_NONE};
- }
- }
- for(; *p!=-1; p++){
- if(*p == st->codec->pix_fmt)
- break;
- }
- if (*p == -1) {
- if(st->codec->pix_fmt != PIX_FMT_NONE)
- av_log(NULL, AV_LOG_WARNING,
- "Incompatible pixel format '%s' for codec '%s', auto-selecting format '%s'\n",
- av_pix_fmt_descriptors[st->codec->pix_fmt].name,
- codec->name,
- av_pix_fmt_descriptors[codec->pix_fmts[0]].name);
- st->codec->pix_fmt = codec->pix_fmts[0];
- }
- }
-}
-
-static OutputStream *new_output_stream(AVFormatContext *oc, int file_idx, AVCodec *codec)
-{
- OutputStream *ost;
- AVStream *st = av_new_stream(oc, oc->nb_streams < nb_streamid_map ? streamid_map[oc->nb_streams] : 0);
- int idx = oc->nb_streams - 1;
-
- if (!st) {
- av_log(NULL, AV_LOG_ERROR, "Could not alloc stream.\n");
- exit_program(1);
- }
-
- output_streams_for_file[file_idx] =
- grow_array(output_streams_for_file[file_idx],
- sizeof(*output_streams_for_file[file_idx]),
- &nb_output_streams_for_file[file_idx],
- oc->nb_streams);
- ost = output_streams_for_file[file_idx][idx] =
- av_mallocz(sizeof(OutputStream));
- if (!ost) {
- fprintf(stderr, "Could not alloc output stream\n");
- exit_program(1);
- }
- ost->file_index = file_idx;
- ost->index = idx;
- ost->st = st;
- ost->enc = codec;
- if (codec)
- ost->opts = filter_codec_opts(codec_opts, codec->id, oc, st);
-
- avcodec_get_context_defaults3(st->codec, codec);
-
- ost->sws_flags = av_get_int(sws_opts, "sws_flags", NULL);
- return ost;
-}
-
-static int read_avserver_streams(AVFormatContext *s, const char *filename)
-{
- int i, err;
- AVFormatContext *ic = NULL;
-
- err = avformat_open_input(&ic, filename, NULL, NULL);
- if (err < 0)
- return err;
- /* copy stream format */
- for(i=0;i<ic->nb_streams;i++) {
- AVStream *st;
- OutputStream *ost;
- AVCodec *codec;
-
- codec = avcodec_find_encoder(ic->streams[i]->codec->codec_id);
- ost = new_output_stream(s, nb_output_files, codec);
- st = ost->st;
-
- // FIXME: a more elegant solution is needed
- memcpy(st, ic->streams[i], sizeof(AVStream));
- st->info = NULL;
- avcodec_copy_context(st->codec, ic->streams[i]->codec);
-
- if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO) {
- if (audio_stream_copy) {
- st->stream_copy = 1;
- } else
- choose_sample_fmt(st, codec);
- } else if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
- if (video_stream_copy) {
- st->stream_copy = 1;
- } else
- choose_pixel_fmt(st, codec);
- }
- }
-
- av_close_input_file(ic);
- return 0;
-}
-
-static double
-get_sync_ipts(const OutputStream *ost)
-{
- const InputStream *ist = ost->sync_ist;
- return (double)(ist->pts - start_time)/AV_TIME_BASE;
-}
-
-static void write_frame(AVFormatContext *s, AVPacket *pkt, AVCodecContext *avctx, AVBitStreamFilterContext *bsfc){
- int ret;
-
- while(bsfc){
- AVPacket new_pkt= *pkt;
- int a= av_bitstream_filter_filter(bsfc, avctx, NULL,
- &new_pkt.data, &new_pkt.size,
- pkt->data, pkt->size,
- pkt->flags & AV_PKT_FLAG_KEY);
- if(a>0){
- av_free_packet(pkt);
- new_pkt.destruct= av_destruct_packet;
- } else if(a<0){
- fprintf(stderr, "%s failed for stream %d, codec %s",
- bsfc->filter->name, pkt->stream_index,
- avctx->codec ? avctx->codec->name : "copy");
- print_error("", a);
- if (exit_on_error)
- exit_program(1);
- }
- *pkt= new_pkt;
-
- bsfc= bsfc->next;
- }
-
- ret= av_interleaved_write_frame(s, pkt);
- if(ret < 0){
- print_error("av_interleaved_write_frame()", ret);
- exit_program(1);
- }
-}
-
-#define MAX_AUDIO_PACKET_SIZE (128 * 1024)
-
-static void do_audio_out(AVFormatContext *s,
- OutputStream *ost,
- InputStream *ist,
- unsigned char *buf, int size)
-{
- uint8_t *buftmp;
- int64_t audio_out_size, audio_buf_size;
- int64_t allocated_for_size= size;
-
- int size_out, frame_bytes, ret, resample_changed;
- AVCodecContext *enc= ost->st->codec;
- AVCodecContext *dec= ist->st->codec;
- int osize = av_get_bytes_per_sample(enc->sample_fmt);
- int isize = av_get_bytes_per_sample(dec->sample_fmt);
- const int coded_bps = av_get_bits_per_sample(enc->codec->id);
-
-need_realloc:
- audio_buf_size= (allocated_for_size + isize*dec->channels - 1) / (isize*dec->channels);
- audio_buf_size= (audio_buf_size*enc->sample_rate + dec->sample_rate) / dec->sample_rate;
- audio_buf_size= audio_buf_size*2 + 10000; //safety factors for the deprecated resampling API
- audio_buf_size= FFMAX(audio_buf_size, enc->frame_size);
- audio_buf_size*= osize*enc->channels;
-
- audio_out_size= FFMAX(audio_buf_size, enc->frame_size * osize * enc->channels);
- if(coded_bps > 8*osize)
- audio_out_size= audio_out_size * coded_bps / (8*osize);
- audio_out_size += FF_MIN_BUFFER_SIZE;
-
- if(audio_out_size > INT_MAX || audio_buf_size > INT_MAX){
- fprintf(stderr, "Buffer sizes too large\n");
- exit_program(1);
- }
-
- av_fast_malloc(&audio_buf, &allocated_audio_buf_size, audio_buf_size);
- av_fast_malloc(&audio_out, &allocated_audio_out_size, audio_out_size);
- if (!audio_buf || !audio_out){
- fprintf(stderr, "Out of memory in do_audio_out\n");
- exit_program(1);
- }
-
- if (enc->channels != dec->channels || enc->sample_rate != dec->sample_rate)
- ost->audio_resample = 1;
-
- resample_changed = ost->resample_sample_fmt != dec->sample_fmt ||
- ost->resample_channels != dec->channels ||
- ost->resample_sample_rate != dec->sample_rate;
-
- if ((ost->audio_resample && !ost->resample) || resample_changed) {
- if (resample_changed) {
- av_log(NULL, AV_LOG_INFO, "Input stream #%d.%d frame changed from rate:%d fmt:%s ch:%d to rate:%d fmt:%s ch:%d\n",
- ist->file_index, ist->st->index,
- ost->resample_sample_rate, av_get_sample_fmt_name(ost->resample_sample_fmt), ost->resample_channels,
- dec->sample_rate, av_get_sample_fmt_name(dec->sample_fmt), dec->channels);
- ost->resample_sample_fmt = dec->sample_fmt;
- ost->resample_channels = dec->channels;
- ost->resample_sample_rate = dec->sample_rate;
- if (ost->resample)
- audio_resample_close(ost->resample);
- }
- /* if audio_sync_method is >1 the resampler is needed for audio drift compensation */
- if (audio_sync_method <= 1 &&
- ost->resample_sample_fmt == enc->sample_fmt &&
- ost->resample_channels == enc->channels &&
- ost->resample_sample_rate == enc->sample_rate) {
- ost->resample = NULL;
- ost->audio_resample = 0;
- } else if (ost->audio_resample) {
- if (dec->sample_fmt != AV_SAMPLE_FMT_S16)
- fprintf(stderr, "Warning, using s16 intermediate sample format for resampling\n");
- ost->resample = av_audio_resample_init(enc->channels, dec->channels,
- enc->sample_rate, dec->sample_rate,
- enc->sample_fmt, dec->sample_fmt,
- 16, 10, 0, 0.8);
- if (!ost->resample) {
- fprintf(stderr, "Can not resample %d channels @ %d Hz to %d channels @ %d Hz\n",
- dec->channels, dec->sample_rate,
- enc->channels, enc->sample_rate);
- exit_program(1);
- }
- }
- }
-
-#define MAKE_SFMT_PAIR(a,b) ((a)+AV_SAMPLE_FMT_NB*(b))
- if (!ost->audio_resample && dec->sample_fmt!=enc->sample_fmt &&
- MAKE_SFMT_PAIR(enc->sample_fmt,dec->sample_fmt)!=ost->reformat_pair) {
- if (ost->reformat_ctx)
- av_audio_convert_free(ost->reformat_ctx);
- ost->reformat_ctx = av_audio_convert_alloc(enc->sample_fmt, 1,
- dec->sample_fmt, 1, NULL, 0);
- if (!ost->reformat_ctx) {
- fprintf(stderr, "Cannot convert %s sample format to %s sample format\n",
- av_get_sample_fmt_name(dec->sample_fmt),
- av_get_sample_fmt_name(enc->sample_fmt));
- exit_program(1);
- }
- ost->reformat_pair=MAKE_SFMT_PAIR(enc->sample_fmt,dec->sample_fmt);
- }
-
- if(audio_sync_method){
- double delta = get_sync_ipts(ost) * enc->sample_rate - ost->sync_opts
- - av_fifo_size(ost->fifo)/(enc->channels * 2);
- double idelta= delta*dec->sample_rate / enc->sample_rate;
- int byte_delta= ((int)idelta)*2*dec->channels;
-
- //FIXME resample delay
- if(fabs(delta) > 50){
- if(ist->is_start || fabs(delta) > audio_drift_threshold*enc->sample_rate){
- if(byte_delta < 0){
- byte_delta= FFMAX(byte_delta, -size);
- size += byte_delta;
- buf -= byte_delta;
- if(verbose > 2)
- fprintf(stderr, "discarding %d audio samples\n", (int)-delta);
- if(!size)
- return;
- ist->is_start=0;
- }else{
- static uint8_t *input_tmp= NULL;
- input_tmp= av_realloc(input_tmp, byte_delta + size);
-
- if(byte_delta > allocated_for_size - size){
- allocated_for_size= byte_delta + (int64_t)size;
- goto need_realloc;
- }
- ist->is_start=0;
-
- memset(input_tmp, 0, byte_delta);
- memcpy(input_tmp + byte_delta, buf, size);
- buf= input_tmp;
- size += byte_delta;
- if(verbose > 2)
- fprintf(stderr, "adding %d audio samples of silence\n", (int)delta);
- }
- }else if(audio_sync_method>1){
- int comp= av_clip(delta, -audio_sync_method, audio_sync_method);
- av_assert0(ost->audio_resample);
- if(verbose > 2)
- fprintf(stderr, "compensating audio timestamp drift:%f compensation:%d in:%d\n", delta, comp, enc->sample_rate);
-// fprintf(stderr, "drift:%f len:%d opts:%"PRId64" ipts:%"PRId64" fifo:%d\n", delta, -1, ost->sync_opts, (int64_t)(get_sync_ipts(ost) * enc->sample_rate), av_fifo_size(ost->fifo)/(ost->st->codec->channels * 2));
- av_resample_compensate(*(struct AVResampleContext**)ost->resample, comp, enc->sample_rate);
- }
- }
- }else
- ost->sync_opts= lrintf(get_sync_ipts(ost) * enc->sample_rate)
- - av_fifo_size(ost->fifo)/(enc->channels * 2); //FIXME wrong
-
- if (ost->audio_resample) {
- buftmp = audio_buf;
- size_out = audio_resample(ost->resample,
- (short *)buftmp, (short *)buf,
- size / (dec->channels * isize));
- size_out = size_out * enc->channels * osize;
- } else {
- buftmp = buf;
- size_out = size;
- }
-
- if (!ost->audio_resample && dec->sample_fmt!=enc->sample_fmt) {
- const void *ibuf[6]= {buftmp};
- void *obuf[6]= {audio_buf};
- int istride[6]= {isize};
- int ostride[6]= {osize};
- int len= size_out/istride[0];
- if (av_audio_convert(ost->reformat_ctx, obuf, ostride, ibuf, istride, len)<0) {
- printf("av_audio_convert() failed\n");
- if (exit_on_error)
- exit_program(1);
- return;
- }
- buftmp = audio_buf;
- size_out = len*osize;
- }
-
- /* now encode as many frames as possible */
- if (enc->frame_size > 1) {
- /* output resampled raw samples */
- if (av_fifo_realloc2(ost->fifo, av_fifo_size(ost->fifo) + size_out) < 0) {
- fprintf(stderr, "av_fifo_realloc2() failed\n");
- exit_program(1);
- }
- av_fifo_generic_write(ost->fifo, buftmp, size_out, NULL);
-
- frame_bytes = enc->frame_size * osize * enc->channels;
-
- while (av_fifo_size(ost->fifo) >= frame_bytes) {
- AVPacket pkt;
- av_init_packet(&pkt);
-
- av_fifo_generic_read(ost->fifo, audio_buf, frame_bytes, NULL);
-
- //FIXME pass ost->sync_opts as AVFrame.pts in avcodec_encode_audio()
-
- ret = avcodec_encode_audio(enc, audio_out, audio_out_size,
- (short *)audio_buf);
- if (ret < 0) {
- fprintf(stderr, "Audio encoding failed\n");
- exit_program(1);
- }
- audio_size += ret;
- pkt.stream_index= ost->index;
- pkt.data= audio_out;
- pkt.size= ret;
- if(enc->coded_frame && enc->coded_frame->pts != AV_NOPTS_VALUE)
- pkt.pts= av_rescale_q(enc->coded_frame->pts, enc->time_base, ost->st->time_base);
- pkt.flags |= AV_PKT_FLAG_KEY;
- write_frame(s, &pkt, enc, ost->bitstream_filters);
-
- ost->sync_opts += enc->frame_size;
- }
- } else {
- AVPacket pkt;
- av_init_packet(&pkt);
-
- ost->sync_opts += size_out / (osize * enc->channels);
-
- /* output a pcm frame */
- /* determine the size of the coded buffer */
- size_out /= osize;
- if (coded_bps)
- size_out = size_out*coded_bps/8;
-
- if(size_out > audio_out_size){
- fprintf(stderr, "Internal error, buffer size too small\n");
- exit_program(1);
- }
-
- //FIXME pass ost->sync_opts as AVFrame.pts in avcodec_encode_audio()
- ret = avcodec_encode_audio(enc, audio_out, size_out,
- (short *)buftmp);
- if (ret < 0) {
- fprintf(stderr, "Audio encoding failed\n");
- exit_program(1);
- }
- audio_size += ret;
- pkt.stream_index= ost->index;
- pkt.data= audio_out;
- pkt.size= ret;
- if(enc->coded_frame && enc->coded_frame->pts != AV_NOPTS_VALUE)
- pkt.pts= av_rescale_q(enc->coded_frame->pts, enc->time_base, ost->st->time_base);
- pkt.flags |= AV_PKT_FLAG_KEY;
- write_frame(s, &pkt, enc, ost->bitstream_filters);
- }
-}
-
-static void pre_process_video_frame(InputStream *ist, AVPicture *picture, void **bufp)
-{
- AVCodecContext *dec;
- AVPicture *picture2;
- AVPicture picture_tmp;
- uint8_t *buf = 0;
-
- dec = ist->st->codec;
-
- /* deinterlace : must be done before any resize */
- if (do_deinterlace) {
- int size;
-
- /* create temporary picture */
- size = avpicture_get_size(dec->pix_fmt, dec->width, dec->height);
- buf = av_malloc(size);
- if (!buf)
- return;
-
- picture2 = &picture_tmp;
- avpicture_fill(picture2, buf, dec->pix_fmt, dec->width, dec->height);
-
- if(avpicture_deinterlace(picture2, picture,
- dec->pix_fmt, dec->width, dec->height) < 0) {
- /* if error, do not deinterlace */
- fprintf(stderr, "Deinterlacing failed\n");
- av_free(buf);
- buf = NULL;
- picture2 = picture;
- }
- } else {
- picture2 = picture;
- }
-
- if (picture != picture2)
- *picture = *picture2;
- *bufp = buf;
-}
-
-/* we begin to correct av delay at this threshold */
-#define AV_DELAY_MAX 0.100
-
-static void do_subtitle_out(AVFormatContext *s,
- OutputStream *ost,
- InputStream *ist,
- AVSubtitle *sub,
- int64_t pts)
-{
- static uint8_t *subtitle_out = NULL;
- int subtitle_out_max_size = 1024 * 1024;
- int subtitle_out_size, nb, i;
- AVCodecContext *enc;
- AVPacket pkt;
-
- if (pts == AV_NOPTS_VALUE) {
- fprintf(stderr, "Subtitle packets must have a pts\n");
- if (exit_on_error)
- exit_program(1);
- return;
- }
-
- enc = ost->st->codec;
-
- if (!subtitle_out) {
- subtitle_out = av_malloc(subtitle_out_max_size);
- }
-
- /* Note: DVB subtitle need one packet to draw them and one other
- packet to clear them */
- /* XXX: signal it in the codec context ? */
- if (enc->codec_id == CODEC_ID_DVB_SUBTITLE)
- nb = 2;
- else
- nb = 1;
-
- for(i = 0; i < nb; i++) {
- sub->pts = av_rescale_q(pts, ist->st->time_base, AV_TIME_BASE_Q);
- // start_display_time is required to be 0
- sub->pts += av_rescale_q(sub->start_display_time, (AVRational){1, 1000}, AV_TIME_BASE_Q);
- sub->end_display_time -= sub->start_display_time;
- sub->start_display_time = 0;
- subtitle_out_size = avcodec_encode_subtitle(enc, subtitle_out,
- subtitle_out_max_size, sub);
- if (subtitle_out_size < 0) {
- fprintf(stderr, "Subtitle encoding failed\n");
- exit_program(1);
- }
-
- av_init_packet(&pkt);
- pkt.stream_index = ost->index;
- pkt.data = subtitle_out;
- pkt.size = subtitle_out_size;
- pkt.pts = av_rescale_q(sub->pts, AV_TIME_BASE_Q, ost->st->time_base);
- if (enc->codec_id == CODEC_ID_DVB_SUBTITLE) {
- /* XXX: the pts correction is handled here. Maybe handling
- it in the codec would be better */
- if (i == 0)
- pkt.pts += 90 * sub->start_display_time;
- else
- pkt.pts += 90 * sub->end_display_time;
- }
- write_frame(s, &pkt, ost->st->codec, ost->bitstream_filters);
- }
-}
-
-static int bit_buffer_size= 1024*256;
-static uint8_t *bit_buffer= NULL;
-
-static void do_video_out(AVFormatContext *s,
- OutputStream *ost,
- InputStream *ist,
- AVFrame *in_picture,
- int *frame_size, float quality)
-{
- int nb_frames, i, ret, resample_changed;
- AVFrame *final_picture, *formatted_picture;
- AVCodecContext *enc, *dec;
- double sync_ipts;
-
- enc = ost->st->codec;
- dec = ist->st->codec;
-
- sync_ipts = get_sync_ipts(ost) / av_q2d(enc->time_base);
-
- /* by default, we output a single frame */
- nb_frames = 1;
-
- *frame_size = 0;
-
- if(video_sync_method){
- double vdelta = sync_ipts - ost->sync_opts;
- //FIXME set to 0.5 after we fix some dts/pts bugs like in avidec.c
- if (vdelta < -1.1)
- nb_frames = 0;
- else if (video_sync_method == 2 || (video_sync_method<0 && (s->oformat->flags & AVFMT_VARIABLE_FPS))){
- if(vdelta<=-0.6){
- nb_frames=0;
- }else if(vdelta>0.6)
- ost->sync_opts= lrintf(sync_ipts);
- }else if (vdelta > 1.1)
- nb_frames = lrintf(vdelta);
-//fprintf(stderr, "vdelta:%f, ost->sync_opts:%"PRId64", ost->sync_ipts:%f nb_frames:%d\n", vdelta, ost->sync_opts, get_sync_ipts(ost), nb_frames);
- if (nb_frames == 0){
- ++nb_frames_drop;
- if (verbose>2)
- fprintf(stderr, "*** drop!\n");
- }else if (nb_frames > 1) {
- nb_frames_dup += nb_frames - 1;
- if (verbose>2)
- fprintf(stderr, "*** %d dup!\n", nb_frames-1);
- }
- }else
- ost->sync_opts= lrintf(sync_ipts);
-
- nb_frames= FFMIN(nb_frames, max_frames[AVMEDIA_TYPE_VIDEO] - ost->frame_number);
- if (nb_frames <= 0)
- return;
-
- formatted_picture = in_picture;
- final_picture = formatted_picture;
-
- resample_changed = ost->resample_width != dec->width ||
- ost->resample_height != dec->height ||
- ost->resample_pix_fmt != dec->pix_fmt;
-
- if (resample_changed) {
- av_log(NULL, AV_LOG_INFO,
- "Input stream #%d.%d frame changed from size:%dx%d fmt:%s to size:%dx%d fmt:%s\n",
- ist->file_index, ist->st->index,
- ost->resample_width, ost->resample_height, av_get_pix_fmt_name(ost->resample_pix_fmt),
- dec->width , dec->height , av_get_pix_fmt_name(dec->pix_fmt));
- if(!ost->video_resample)
- exit_program(1);
- }
-
-#if !CONFIG_AVFILTER
- if (ost->video_resample) {
- final_picture = &ost->pict_tmp;
- if (resample_changed) {
- /* initialize a new scaler context */
- sws_freeContext(ost->img_resample_ctx);
- ost->img_resample_ctx = sws_getContext(
- ist->st->codec->width,
- ist->st->codec->height,
- ist->st->codec->pix_fmt,
- ost->st->codec->width,
- ost->st->codec->height,
- ost->st->codec->pix_fmt,
- ost->sws_flags, NULL, NULL, NULL);
- if (ost->img_resample_ctx == NULL) {
- fprintf(stderr, "Cannot get resampling context\n");
- exit_program(1);
- }
- }
- sws_scale(ost->img_resample_ctx, formatted_picture->data, formatted_picture->linesize,
- 0, ost->resample_height, final_picture->data, final_picture->linesize);
- }
-#endif
-
- /* duplicates frame if needed */
- for(i=0;i<nb_frames;i++) {
- AVPacket pkt;
- av_init_packet(&pkt);
- pkt.stream_index= ost->index;
-
- if (s->oformat->flags & AVFMT_RAWPICTURE) {
- /* raw pictures are written as AVPicture structure to
- avoid any copies. We support temorarily the older
- method. */
- AVFrame* old_frame = enc->coded_frame;
- enc->coded_frame = dec->coded_frame; //FIXME/XXX remove this hack
- pkt.data= (uint8_t *)final_picture;
- pkt.size= sizeof(AVPicture);
- pkt.pts= av_rescale_q(ost->sync_opts, enc->time_base, ost->st->time_base);
- pkt.flags |= AV_PKT_FLAG_KEY;
-
- write_frame(s, &pkt, ost->st->codec, ost->bitstream_filters);
- enc->coded_frame = old_frame;
- } else {
- AVFrame big_picture;
-
- big_picture= *final_picture;
- /* better than nothing: use input picture interlaced
- settings */
- big_picture.interlaced_frame = in_picture->interlaced_frame;
- if (ost->st->codec->flags & (CODEC_FLAG_INTERLACED_DCT|CODEC_FLAG_INTERLACED_ME)) {
- if(top_field_first == -1)
- big_picture.top_field_first = in_picture->top_field_first;
- else
- big_picture.top_field_first = top_field_first;
- }
-
- /* handles sameq here. This is not correct because it may
- not be a global option */
- big_picture.quality = quality;
- if(!me_threshold)
- big_picture.pict_type = 0;
-// big_picture.pts = AV_NOPTS_VALUE;
- big_picture.pts= ost->sync_opts;
-// big_picture.pts= av_rescale(ost->sync_opts, AV_TIME_BASE*(int64_t)enc->time_base.num, enc->time_base.den);
-//av_log(NULL, AV_LOG_DEBUG, "%"PRId64" -> encoder\n", ost->sync_opts);
- if (ost->forced_kf_index < ost->forced_kf_count &&
- big_picture.pts >= ost->forced_kf_pts[ost->forced_kf_index]) {
- big_picture.pict_type = AV_PICTURE_TYPE_I;
- ost->forced_kf_index++;
- }
- ret = avcodec_encode_video(enc,
- bit_buffer, bit_buffer_size,
- &big_picture);
- if (ret < 0) {
- fprintf(stderr, "Video encoding failed\n");
- exit_program(1);
- }
-
- if(ret>0){
- pkt.data= bit_buffer;
- pkt.size= ret;
- if(enc->coded_frame->pts != AV_NOPTS_VALUE)
- pkt.pts= av_rescale_q(enc->coded_frame->pts, enc->time_base, ost->st->time_base);
-/*av_log(NULL, AV_LOG_DEBUG, "encoder -> %"PRId64"/%"PRId64"\n",
- pkt.pts != AV_NOPTS_VALUE ? av_rescale(pkt.pts, enc->time_base.den, AV_TIME_BASE*(int64_t)enc->time_base.num) : -1,
- pkt.dts != AV_NOPTS_VALUE ? av_rescale(pkt.dts, enc->time_base.den, AV_TIME_BASE*(int64_t)enc->time_base.num) : -1);*/
-
- if(enc->coded_frame->key_frame)
- pkt.flags |= AV_PKT_FLAG_KEY;
- write_frame(s, &pkt, ost->st->codec, ost->bitstream_filters);
- *frame_size = ret;
- video_size += ret;
- //fprintf(stderr,"\nFrame: %3d size: %5d type: %d",
- // enc->frame_number-1, ret, enc->pict_type);
- /* if two pass, output log */
- if (ost->logfile && enc->stats_out) {
- fprintf(ost->logfile, "%s", enc->stats_out);
- }
- }
- }
- ost->sync_opts++;
- ost->frame_number++;
- }
-}
-
-static double psnr(double d){
- return -10.0*log(d)/log(10.0);
-}
-
-static void do_video_stats(AVFormatContext *os, OutputStream *ost,
- int frame_size)
-{
- AVCodecContext *enc;
- int frame_number;
- double ti1, bitrate, avg_bitrate;
-
- /* this is executed just the first time do_video_stats is called */
- if (!vstats_file) {
- vstats_file = fopen(vstats_filename, "w");
- if (!vstats_file) {
- perror("fopen");
- exit_program(1);
- }
- }
-
- enc = ost->st->codec;
- if (enc->codec_type == AVMEDIA_TYPE_VIDEO) {
- frame_number = ost->frame_number;
- fprintf(vstats_file, "frame= %5d q= %2.1f ", frame_number, enc->coded_frame->quality/(float)FF_QP2LAMBDA);
- if (enc->flags&CODEC_FLAG_PSNR)
- fprintf(vstats_file, "PSNR= %6.2f ", psnr(enc->coded_frame->error[0]/(enc->width*enc->height*255.0*255.0)));
-
- fprintf(vstats_file,"f_size= %6d ", frame_size);
- /* compute pts value */
- ti1 = ost->sync_opts * av_q2d(enc->time_base);
- if (ti1 < 0.01)
- ti1 = 0.01;
-
- bitrate = (frame_size * 8) / av_q2d(enc->time_base) / 1000.0;
- avg_bitrate = (double)(video_size * 8) / ti1 / 1000.0;
- fprintf(vstats_file, "s_size= %8.0fkB time= %0.3f br= %7.1fkbits/s avg_br= %7.1fkbits/s ",
- (double)video_size / 1024, ti1, bitrate, avg_bitrate);
- fprintf(vstats_file, "type= %c\n", av_get_picture_type_char(enc->coded_frame->pict_type));
- }
-}
-
-static void print_report(AVFormatContext **output_files,
- OutputStream **ost_table, int nb_ostreams,
- int is_last_report)
-{
- char buf[1024];
- OutputStream *ost;
- AVFormatContext *oc;
- int64_t total_size;
- AVCodecContext *enc;
- int frame_number, vid, i;
- double bitrate, ti1, pts;
- static int64_t last_time = -1;
- static int qp_histogram[52];
-
- if (!is_last_report) {
- int64_t cur_time;
- /* display the report every 0.5 seconds */
- cur_time = av_gettime();
- if (last_time == -1) {
- last_time = cur_time;
- return;
- }
- if ((cur_time - last_time) < 500000)
- return;
- last_time = cur_time;
- }
-
-
- oc = output_files[0];
-
- total_size = avio_size(oc->pb);
- if(total_size<0) // FIXME improve avio_size() so it works with non seekable output too
- total_size= avio_tell(oc->pb);
-
- buf[0] = '\0';
- ti1 = 1e10;
- vid = 0;
- for(i=0;i<nb_ostreams;i++) {
- float q = -1;
- ost = ost_table[i];
- enc = ost->st->codec;
- if (!ost->st->stream_copy && enc->coded_frame)
- q = enc->coded_frame->quality/(float)FF_QP2LAMBDA;
- if (vid && enc->codec_type == AVMEDIA_TYPE_VIDEO) {
- snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "q=%2.1f ", q);
- }
- if (!vid && enc->codec_type == AVMEDIA_TYPE_VIDEO) {
- float t = (av_gettime()-timer_start) / 1000000.0;
-
- frame_number = ost->frame_number;
- snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "frame=%5d fps=%3d q=%3.1f ",
- frame_number, (t>1)?(int)(frame_number/t+0.5) : 0, q);
- if(is_last_report)
- snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "L");
- if(qp_hist){
- int j;
- int qp = lrintf(q);
- if(qp>=0 && qp<FF_ARRAY_ELEMS(qp_histogram))
- qp_histogram[qp]++;
- for(j=0; j<32; j++)
- snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "%X", (int)lrintf(log(qp_histogram[j]+1)/log(2)));
- }
- if (enc->flags&CODEC_FLAG_PSNR){
- int j;
- double error, error_sum=0;
- double scale, scale_sum=0;
- char type[3]= {'Y','U','V'};
- snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "PSNR=");
- for(j=0; j<3; j++){
- if(is_last_report){
- error= enc->error[j];
- scale= enc->width*enc->height*255.0*255.0*frame_number;
- }else{
- error= enc->coded_frame->error[j];
- scale= enc->width*enc->height*255.0*255.0;
- }
- if(j) scale/=4;
- error_sum += error;
- scale_sum += scale;
- snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "%c:%2.2f ", type[j], psnr(error/scale));
- }
- snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "*:%2.2f ", psnr(error_sum/scale_sum));
- }
- vid = 1;
- }
- /* compute min output value */
- pts = (double)ost->st->pts.val * av_q2d(ost->st->time_base);
- if ((pts < ti1) && (pts > 0))
- ti1 = pts;
- }
- if (ti1 < 0.01)
- ti1 = 0.01;
-
- if (verbose > 0 || is_last_report) {
- bitrate = (double)(total_size * 8) / ti1 / 1000.0;
-
- snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf),
- "size=%8.0fkB time=%0.2f bitrate=%6.1fkbits/s",
- (double)total_size / 1024, ti1, bitrate);
-
- if (nb_frames_dup || nb_frames_drop)
- snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " dup=%d drop=%d",
- nb_frames_dup, nb_frames_drop);
-
- if (verbose >= 0)
- fprintf(stderr, "%s \r", buf);
-
- fflush(stderr);
- }
-
- if (is_last_report && verbose >= 0){
- int64_t raw= audio_size + video_size + extra_size;
- fprintf(stderr, "\n");
- fprintf(stderr, "video:%1.0fkB audio:%1.0fkB global headers:%1.0fkB muxing overhead %f%%\n",
- video_size/1024.0,
- audio_size/1024.0,
- extra_size/1024.0,
- 100.0*(total_size - raw)/raw
- );
- }
-}
-
-static void generate_silence(uint8_t* buf, enum AVSampleFormat sample_fmt, size_t size)
-{
- int fill_char = 0x00;
- if (sample_fmt == AV_SAMPLE_FMT_U8)
- fill_char = 0x80;
- memset(buf, fill_char, size);
-}
-
-/* pkt = NULL means EOF (needed to flush decoder buffers) */
-static int output_packet(InputStream *ist, int ist_index,
- OutputStream **ost_table, int nb_ostreams,
- const AVPacket *pkt)
-{
- AVFormatContext *os;
- OutputStream *ost;
- int ret, i;
- int got_output;
- AVFrame picture;
- void *buffer_to_free = NULL;
- static unsigned int samples_size= 0;
- AVSubtitle subtitle, *subtitle_to_free;
- int64_t pkt_pts = AV_NOPTS_VALUE;
-#if CONFIG_AVFILTER
- int frame_available;
-#endif
- float quality;
-
- AVPacket avpkt;
- int bps = av_get_bytes_per_sample(ist->st->codec->sample_fmt);
-
- if(ist->next_pts == AV_NOPTS_VALUE)
- ist->next_pts= ist->pts;
-
- if (pkt == NULL) {
- /* EOF handling */
- av_init_packet(&avpkt);
- avpkt.data = NULL;
- avpkt.size = 0;
- goto handle_eof;
- } else {
- avpkt = *pkt;
- }
-
- if(pkt->dts != AV_NOPTS_VALUE)
- ist->next_pts = ist->pts = av_rescale_q(pkt->dts, ist->st->time_base, AV_TIME_BASE_Q);
- if(pkt->pts != AV_NOPTS_VALUE)
- pkt_pts = av_rescale_q(pkt->pts, ist->st->time_base, AV_TIME_BASE_Q);
-
- //while we have more to decode or while the decoder did output something on EOF
- while (avpkt.size > 0 || (!pkt && got_output)) {
- uint8_t *data_buf, *decoded_data_buf;
- int data_size, decoded_data_size;
- handle_eof:
- ist->pts= ist->next_pts;
-
- if(avpkt.size && avpkt.size != pkt->size &&
- ((!ist->showed_multi_packet_warning && verbose>0) || verbose>1)){
- fprintf(stderr, "Multiple frames in a packet from stream %d\n", pkt->stream_index);
- ist->showed_multi_packet_warning=1;
- }
-
- /* decode the packet if needed */
- decoded_data_buf = NULL; /* fail safe */
- decoded_data_size= 0;
- data_buf = avpkt.data;
- data_size = avpkt.size;
- subtitle_to_free = NULL;
- if (ist->decoding_needed) {
- switch(ist->st->codec->codec_type) {
- case AVMEDIA_TYPE_AUDIO:{
- if(pkt && samples_size < FFMAX(pkt->size*sizeof(*samples), AVCODEC_MAX_AUDIO_FRAME_SIZE)) {
- samples_size = FFMAX(pkt->size*sizeof(*samples), AVCODEC_MAX_AUDIO_FRAME_SIZE);
- av_free(samples);
- samples= av_malloc(samples_size);
- }
- decoded_data_size= samples_size;
- /* XXX: could avoid copy if PCM 16 bits with same
- endianness as CPU */
- ret = avcodec_decode_audio3(ist->st->codec, samples, &decoded_data_size,
- &avpkt);
- if (ret < 0)
- return ret;
- avpkt.data += ret;
- avpkt.size -= ret;
- data_size = ret;
- got_output = decoded_data_size > 0;
- /* Some bug in mpeg audio decoder gives */
- /* decoded_data_size < 0, it seems they are overflows */
- if (!got_output) {
- /* no audio frame */
- continue;
- }
- decoded_data_buf = (uint8_t *)samples;
- ist->next_pts += ((int64_t)AV_TIME_BASE/bps * decoded_data_size) /
- (ist->st->codec->sample_rate * ist->st->codec->channels);
- break;}
- case AVMEDIA_TYPE_VIDEO:
- decoded_data_size = (ist->st->codec->width * ist->st->codec->height * 3) / 2;
- /* XXX: allocate picture correctly */
- avcodec_get_frame_defaults(&picture);
- avpkt.pts = pkt_pts;
- avpkt.dts = ist->pts;
- pkt_pts = AV_NOPTS_VALUE;
-
- ret = avcodec_decode_video2(ist->st->codec,
- &picture, &got_output, &avpkt);
- quality = same_quality ? picture.quality : 0;
- if (ret < 0)
- return ret;
- if (!got_output) {
- /* no picture yet */
- goto discard_packet;
- }
- ist->next_pts = ist->pts = guess_correct_pts(&ist->pts_ctx, picture.pkt_pts, picture.pkt_dts);
- if (ist->st->codec->time_base.num != 0) {
- int ticks= ist->st->parser ? ist->st->parser->repeat_pict+1 : ist->st->codec->ticks_per_frame;
- ist->next_pts += ((int64_t)AV_TIME_BASE *
- ist->st->codec->time_base.num * ticks) /
- ist->st->codec->time_base.den;
- }
- avpkt.size = 0;
- buffer_to_free = NULL;
- pre_process_video_frame(ist, (AVPicture *)&picture, &buffer_to_free);
- break;
- case AVMEDIA_TYPE_SUBTITLE:
- ret = avcodec_decode_subtitle2(ist->st->codec,
- &subtitle, &got_output, &avpkt);
- if (ret < 0)
- return ret;
- if (!got_output) {
- goto discard_packet;
- }
- subtitle_to_free = &subtitle;
- avpkt.size = 0;
- break;
- default:
- return -1;
- }
- } else {
- switch(ist->st->codec->codec_type) {
- case AVMEDIA_TYPE_AUDIO:
- ist->next_pts += ((int64_t)AV_TIME_BASE * ist->st->codec->frame_size) /
- ist->st->codec->sample_rate;
- break;
- case AVMEDIA_TYPE_VIDEO:
- if (ist->st->codec->time_base.num != 0) {
- int ticks= ist->st->parser ? ist->st->parser->repeat_pict+1 : ist->st->codec->ticks_per_frame;
- ist->next_pts += ((int64_t)AV_TIME_BASE *
- ist->st->codec->time_base.num * ticks) /
- ist->st->codec->time_base.den;
- }
- break;
- }
- ret = avpkt.size;
- avpkt.size = 0;
- }
-
-#if CONFIG_AVFILTER
- if (ist->st->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
- for (i = 0; i < nb_ostreams; i++) {
- ost = ost_table[i];
- if (ost->input_video_filter && ost->source_index == ist_index) {
- AVRational sar;
- if (ist->st->sample_aspect_ratio.num)
- sar = ist->st->sample_aspect_ratio;
- else
- sar = ist->st->codec->sample_aspect_ratio;
- // add it to be filtered
- av_vsrc_buffer_add_frame(ost->input_video_filter, &picture,
- ist->pts,
- sar);
- }
- }
- }
-#endif
-
- // preprocess audio (volume)
- if (ist->st->codec->codec_type == AVMEDIA_TYPE_AUDIO) {
- if (audio_volume != 256) {
- short *volp;
- volp = samples;
- for(i=0;i<(decoded_data_size / sizeof(short));i++) {
- int v = ((*volp) * audio_volume + 128) >> 8;
- if (v < -32768) v = -32768;
- if (v > 32767) v = 32767;
- *volp++ = v;
- }
- }
- }
-
- /* frame rate emulation */
- if (rate_emu) {
- int64_t pts = av_rescale(ist->pts, 1000000, AV_TIME_BASE);
- int64_t now = av_gettime() - ist->start;
- if (pts > now)
- usleep(pts - now);
- }
- /* if output time reached then transcode raw format,
- encode packets and output them */
- if (start_time == 0 || ist->pts >= start_time)
- for(i=0;i<nb_ostreams;i++) {
- int frame_size;
-
- ost = ost_table[i];
- if (ost->source_index == ist_index) {
-#if CONFIG_AVFILTER
- frame_available = ist->st->codec->codec_type != AVMEDIA_TYPE_VIDEO ||
- !ost->output_video_filter || avfilter_poll_frame(ost->output_video_filter->inputs[0]);
- while (frame_available) {
- AVRational ist_pts_tb;
- if (ist->st->codec->codec_type == AVMEDIA_TYPE_VIDEO && ost->output_video_filter)
- get_filtered_video_frame(ost->output_video_filter, &picture, &ost->picref, &ist_pts_tb);
- if (ost->picref)
- ist->pts = av_rescale_q(ost->picref->pts, ist_pts_tb, AV_TIME_BASE_Q);
-#endif
- os = output_files[ost->file_index];
-
- /* set the input output pts pairs */
- //ost->sync_ipts = (double)(ist->pts + input_files[ist->file_index].ts_offset - start_time)/ AV_TIME_BASE;
-
- if (ost->encoding_needed) {
- av_assert0(ist->decoding_needed);
- switch(ost->st->codec->codec_type) {
- case AVMEDIA_TYPE_AUDIO:
- do_audio_out(os, ost, ist, decoded_data_buf, decoded_data_size);
- break;
- case AVMEDIA_TYPE_VIDEO:
-#if CONFIG_AVFILTER
- if (ost->picref->video && !ost->frame_aspect_ratio)
- ost->st->codec->sample_aspect_ratio = ost->picref->video->pixel_aspect;
-#endif
- do_video_out(os, ost, ist, &picture, &frame_size,
- same_quality ? quality : ost->st->codec->global_quality);
- if (vstats_filename && frame_size)
- do_video_stats(os, ost, frame_size);
- break;
- case AVMEDIA_TYPE_SUBTITLE:
- do_subtitle_out(os, ost, ist, &subtitle,
- pkt->pts);
- break;
- default:
- abort();
- }
- } else {
- AVFrame avframe; //FIXME/XXX remove this
- AVPacket opkt;
- int64_t ost_tb_start_time= av_rescale_q(start_time, AV_TIME_BASE_Q, ost->st->time_base);
-
- av_init_packet(&opkt);
-
- if ((!ost->frame_number && !(pkt->flags & AV_PKT_FLAG_KEY)) && !copy_initial_nonkeyframes)
-#if !CONFIG_AVFILTER
- continue;
-#else
- goto cont;
-#endif
-
- /* no reencoding needed : output the packet directly */
- /* force the input stream PTS */
-
- avcodec_get_frame_defaults(&avframe);
- ost->st->codec->coded_frame= &avframe;
- avframe.key_frame = pkt->flags & AV_PKT_FLAG_KEY;
-
- if(ost->st->codec->codec_type == AVMEDIA_TYPE_AUDIO)
- audio_size += data_size;
- else if (ost->st->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
- video_size += data_size;
- ost->sync_opts++;
- }
-
- opkt.stream_index= ost->index;
- if(pkt->pts != AV_NOPTS_VALUE)
- opkt.pts= av_rescale_q(pkt->pts, ist->st->time_base, ost->st->time_base) - ost_tb_start_time;
- else
- opkt.pts= AV_NOPTS_VALUE;
-
- if (pkt->dts == AV_NOPTS_VALUE)
- opkt.dts = av_rescale_q(ist->pts, AV_TIME_BASE_Q, ost->st->time_base);
- else
- opkt.dts = av_rescale_q(pkt->dts, ist->st->time_base, ost->st->time_base);
- opkt.dts -= ost_tb_start_time;
-
- opkt.duration = av_rescale_q(pkt->duration, ist->st->time_base, ost->st->time_base);
- opkt.flags= pkt->flags;
-
- //FIXME remove the following 2 lines they shall be replaced by the bitstream filters
- if( ost->st->codec->codec_id != CODEC_ID_H264
- && ost->st->codec->codec_id != CODEC_ID_MPEG1VIDEO
- && ost->st->codec->codec_id != CODEC_ID_MPEG2VIDEO
- ) {
- if(av_parser_change(ist->st->parser, ost->st->codec, &opkt.data, &opkt.size, data_buf, data_size, pkt->flags & AV_PKT_FLAG_KEY))
- opkt.destruct= av_destruct_packet;
- } else {
- opkt.data = data_buf;
- opkt.size = data_size;
- }
-
- write_frame(os, &opkt, ost->st->codec, ost->bitstream_filters);
- ost->st->codec->frame_number++;
- ost->frame_number++;
- av_free_packet(&opkt);
- }
-#if CONFIG_AVFILTER
- cont:
- frame_available = (ist->st->codec->codec_type == AVMEDIA_TYPE_VIDEO) &&
- ost->output_video_filter && avfilter_poll_frame(ost->output_video_filter->inputs[0]);
- if (ost->picref)
- avfilter_unref_buffer(ost->picref);
- }
-#endif
- }
- }
-
- av_free(buffer_to_free);
- /* XXX: allocate the subtitles in the codec ? */
- if (subtitle_to_free) {
- avsubtitle_free(subtitle_to_free);
- subtitle_to_free = NULL;
- }
- }
- discard_packet:
- if (pkt == NULL) {
- /* EOF handling */
-
- for(i=0;i<nb_ostreams;i++) {
- ost = ost_table[i];
- if (ost->source_index == ist_index) {
- AVCodecContext *enc= ost->st->codec;
- os = output_files[ost->file_index];
-
- if(ost->st->codec->codec_type == AVMEDIA_TYPE_AUDIO && enc->frame_size <=1)
- continue;
- if(ost->st->codec->codec_type == AVMEDIA_TYPE_VIDEO && (os->oformat->flags & AVFMT_RAWPICTURE))
- continue;
-
- if (ost->encoding_needed) {
- for(;;) {
- AVPacket pkt;
- int fifo_bytes;
- av_init_packet(&pkt);
- pkt.stream_index= ost->index;
-
- switch(ost->st->codec->codec_type) {
- case AVMEDIA_TYPE_AUDIO:
- fifo_bytes = av_fifo_size(ost->fifo);
- ret = 0;
- /* encode any samples remaining in fifo */
- if (fifo_bytes > 0) {
- int osize = av_get_bytes_per_sample(enc->sample_fmt);
- int fs_tmp = enc->frame_size;
-
- av_fifo_generic_read(ost->fifo, audio_buf, fifo_bytes, NULL);
- if (enc->codec->capabilities & CODEC_CAP_SMALL_LAST_FRAME) {
- enc->frame_size = fifo_bytes / (osize * enc->channels);
- } else { /* pad */
- int frame_bytes = enc->frame_size*osize*enc->channels;
- if (allocated_audio_buf_size < frame_bytes)
- exit_program(1);
- generate_silence(audio_buf+fifo_bytes, enc->sample_fmt, frame_bytes - fifo_bytes);
- }
-
- ret = avcodec_encode_audio(enc, bit_buffer, bit_buffer_size, (short *)audio_buf);
- pkt.duration = av_rescale((int64_t)enc->frame_size*ost->st->time_base.den,
- ost->st->time_base.num, enc->sample_rate);
- enc->frame_size = fs_tmp;
- }
- if(ret <= 0) {
- ret = avcodec_encode_audio(enc, bit_buffer, bit_buffer_size, NULL);
- }
- if (ret < 0) {
- fprintf(stderr, "Audio encoding failed\n");
- exit_program(1);
- }
- audio_size += ret;
- pkt.flags |= AV_PKT_FLAG_KEY;
- break;
- case AVMEDIA_TYPE_VIDEO:
- ret = avcodec_encode_video(enc, bit_buffer, bit_buffer_size, NULL);
- if (ret < 0) {
- fprintf(stderr, "Video encoding failed\n");
- exit_program(1);
- }
- video_size += ret;
- if(enc->coded_frame && enc->coded_frame->key_frame)
- pkt.flags |= AV_PKT_FLAG_KEY;
- if (ost->logfile && enc->stats_out) {
- fprintf(ost->logfile, "%s", enc->stats_out);
- }
- break;
- default:
- ret=-1;
- }
-
- if(ret<=0)
- break;
- pkt.data= bit_buffer;
- pkt.size= ret;
- if(enc->coded_frame && enc->coded_frame->pts != AV_NOPTS_VALUE)
- pkt.pts= av_rescale_q(enc->coded_frame->pts, enc->time_base, ost->st->time_base);
- write_frame(os, &pkt, ost->st->codec, ost->bitstream_filters);
- }
- }
- }
- }
- }
-
- return 0;
-}
-
-static void print_sdp(AVFormatContext **avc, int n)
-{
- char sdp[2048];
-
- av_sdp_create(avc, n, sdp, sizeof(sdp));
- printf("SDP:\n%s\n", sdp);
- fflush(stdout);
-}
-
-static int copy_chapters(int infile, int outfile)
-{
- AVFormatContext *is = input_files[infile].ctx;
- AVFormatContext *os = output_files[outfile];
- int i;
-
- for (i = 0; i < is->nb_chapters; i++) {
- AVChapter *in_ch = is->chapters[i], *out_ch;
- int64_t ts_off = av_rescale_q(start_time - input_files[infile].ts_offset,
- AV_TIME_BASE_Q, in_ch->time_base);
- int64_t rt = (recording_time == INT64_MAX) ? INT64_MAX :
- av_rescale_q(recording_time, AV_TIME_BASE_Q, in_ch->time_base);
-
-
- if (in_ch->end < ts_off)
- continue;
- if (rt != INT64_MAX && in_ch->start > rt + ts_off)
- break;
-
- out_ch = av_mallocz(sizeof(AVChapter));
- if (!out_ch)
- return AVERROR(ENOMEM);
-
- out_ch->id = in_ch->id;
- out_ch->time_base = in_ch->time_base;
- out_ch->start = FFMAX(0, in_ch->start - ts_off);
- out_ch->end = FFMIN(rt, in_ch->end - ts_off);
-
- if (metadata_chapters_autocopy)
- av_dict_copy(&out_ch->metadata, in_ch->metadata, 0);
-
- os->nb_chapters++;
- os->chapters = av_realloc(os->chapters, sizeof(AVChapter)*os->nb_chapters);
- if (!os->chapters)
- return AVERROR(ENOMEM);
- os->chapters[os->nb_chapters - 1] = out_ch;
- }
- return 0;
-}
-
-static void parse_forced_key_frames(char *kf, OutputStream *ost,
- AVCodecContext *avctx)
-{
- char *p;
- int n = 1, i;
- int64_t t;
-
- for (p = kf; *p; p++)
- if (*p == ',')
- n++;
- ost->forced_kf_count = n;
- ost->forced_kf_pts = av_malloc(sizeof(*ost->forced_kf_pts) * n);
- if (!ost->forced_kf_pts) {
- av_log(NULL, AV_LOG_FATAL, "Could not allocate forced key frames array.\n");
- exit_program(1);
- }
- for (i = 0; i < n; i++) {
- p = i ? strchr(p, ',') + 1 : kf;
- t = parse_time_or_die("force_key_frames", p, 1);
- ost->forced_kf_pts[i] = av_rescale_q(t, AV_TIME_BASE_Q, avctx->time_base);
- }
-}
-
-/*
- * The following code is the main loop of the file converter
- */
-static int transcode(AVFormatContext **output_files,
- int nb_output_files,
- InputFile *input_files,
- int nb_input_files,
- StreamMap *stream_maps, int nb_stream_maps)
-{
- int ret = 0, i, j, k, n, nb_ostreams = 0;
- AVFormatContext *is, *os;
- AVCodecContext *codec, *icodec;
- OutputStream *ost, **ost_table = NULL;
- InputStream *ist;
- char error[1024];
- int want_sdp = 1;
- uint8_t no_packet[MAX_FILES]={0};
- int no_packet_count=0;
-
- if (rate_emu)
- for (i = 0; i < nb_input_streams; i++)
- input_streams[i].start = av_gettime();
-
- /* output stream init */
- nb_ostreams = 0;
- for(i=0;i<nb_output_files;i++) {
- os = output_files[i];
- if (!os->nb_streams && !(os->oformat->flags & AVFMT_NOSTREAMS)) {
- av_dump_format(output_files[i], i, output_files[i]->filename, 1);
- fprintf(stderr, "Output file #%d does not contain any stream\n", i);
- ret = AVERROR(EINVAL);
- goto fail;
- }
- nb_ostreams += os->nb_streams;
- }
- if (nb_stream_maps > 0 && nb_stream_maps != nb_ostreams) {
- fprintf(stderr, "Number of stream maps must match number of output streams\n");
- ret = AVERROR(EINVAL);
- goto fail;
- }
-
- /* Sanity check the mapping args -- do the input files & streams exist? */
- for(i=0;i<nb_stream_maps;i++) {
- int fi = stream_maps[i].file_index;
- int si = stream_maps[i].stream_index;
-
- if (fi < 0 || fi > nb_input_files - 1 ||
- si < 0 || si > input_files[fi].nb_streams - 1) {
- fprintf(stderr,"Could not find input stream #%d.%d\n", fi, si);
- ret = AVERROR(EINVAL);
- goto fail;
- }
- fi = stream_maps[i].sync_file_index;
- si = stream_maps[i].sync_stream_index;
- if (fi < 0 || fi > nb_input_files - 1 ||
- si < 0 || si > input_files[fi].nb_streams - 1) {
- fprintf(stderr,"Could not find sync stream #%d.%d\n", fi, si);
- ret = AVERROR(EINVAL);
- goto fail;
- }
- }
-
- ost_table = av_mallocz(sizeof(OutputStream *) * nb_ostreams);
- if (!ost_table)
- goto fail;
- n = 0;
- for(k=0;k<nb_output_files;k++) {
- os = output_files[k];
- for(i=0;i<os->nb_streams;i++,n++) {
- int found;
- ost = ost_table[n] = output_streams_for_file[k][i];
- if (nb_stream_maps > 0) {
- ost->source_index = input_files[stream_maps[n].file_index].ist_index +
- stream_maps[n].stream_index;
-
- /* Sanity check that the stream types match */
- if (input_streams[ost->source_index].st->codec->codec_type != ost->st->codec->codec_type) {
- int i= ost->file_index;
- av_dump_format(output_files[i], i, output_files[i]->filename, 1);
- fprintf(stderr, "Codec type mismatch for mapping #%d.%d -> #%d.%d\n",
- stream_maps[n].file_index, stream_maps[n].stream_index,
- ost->file_index, ost->index);
- exit_program(1);
- }
-
- } else {
- int best_nb_frames=-1;
- /* get corresponding input stream index : we select the first one with the right type */
- found = 0;
- for (j = 0; j < nb_input_streams; j++) {
- int skip=0;
- ist = &input_streams[j];
- if(opt_programid){
- int pi,si;
- AVFormatContext *f = input_files[ist->file_index].ctx;
- skip=1;
- for(pi=0; pi<f->nb_programs; pi++){
- AVProgram *p= f->programs[pi];
- if(p->id == opt_programid)
- for(si=0; si<p->nb_stream_indexes; si++){
- if(f->streams[ p->stream_index[si] ] == ist->st)
- skip=0;
- }
- }
- }
- if (ist->discard && ist->st->discard != AVDISCARD_ALL && !skip &&
- ist->st->codec->codec_type == ost->st->codec->codec_type) {
- if(best_nb_frames < ist->st->codec_info_nb_frames){
- best_nb_frames= ist->st->codec_info_nb_frames;
- ost->source_index = j;
- found = 1;
- }
- }
- }
-
- if (!found) {
- if(! opt_programid) {
- /* try again and reuse existing stream */
- for (j = 0; j < nb_input_streams; j++) {
- ist = &input_streams[j];
- if ( ist->st->codec->codec_type == ost->st->codec->codec_type
- && ist->st->discard != AVDISCARD_ALL) {
- ost->source_index = j;
- found = 1;
- }
- }
- }
- if (!found) {
- int i= ost->file_index;
- av_dump_format(output_files[i], i, output_files[i]->filename, 1);
- fprintf(stderr, "Could not find input stream matching output stream #%d.%d\n",
- ost->file_index, ost->index);
- exit_program(1);
- }
- }
- }
- ist = &input_streams[ost->source_index];
- ist->discard = 0;
- ost->sync_ist = (nb_stream_maps > 0) ?
- &input_streams[input_files[stream_maps[n].sync_file_index].ist_index +
- stream_maps[n].sync_stream_index] : ist;
- }
- }
-
- /* for each output stream, we compute the right encoding parameters */
- for(i=0;i<nb_ostreams;i++) {
- ost = ost_table[i];
- os = output_files[ost->file_index];
- ist = &input_streams[ost->source_index];
-
- codec = ost->st->codec;
- icodec = ist->st->codec;
-
- if (metadata_streams_autocopy)
- av_dict_copy(&ost->st->metadata, ist->st->metadata,
- AV_DICT_DONT_OVERWRITE);
-
- ost->st->disposition = ist->st->disposition;
- codec->bits_per_raw_sample= icodec->bits_per_raw_sample;
- codec->chroma_sample_location = icodec->chroma_sample_location;
-
- if (ost->st->stream_copy) {
- uint64_t extra_size = (uint64_t)icodec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE;
-
- if (extra_size > INT_MAX)
- goto fail;
-
- /* if stream_copy is selected, no need to decode or encode */
- codec->codec_id = icodec->codec_id;
- codec->codec_type = icodec->codec_type;
-
- if(!codec->codec_tag){
- if( !os->oformat->codec_tag
- || av_codec_get_id (os->oformat->codec_tag, icodec->codec_tag) == codec->codec_id
- || av_codec_get_tag(os->oformat->codec_tag, icodec->codec_id) <= 0)
- codec->codec_tag = icodec->codec_tag;
- }
-
- codec->bit_rate = icodec->bit_rate;
- codec->rc_max_rate = icodec->rc_max_rate;
- codec->rc_buffer_size = icodec->rc_buffer_size;
- codec->extradata= av_mallocz(extra_size);
- if (!codec->extradata)
- goto fail;
- memcpy(codec->extradata, icodec->extradata, icodec->extradata_size);
- codec->extradata_size= icodec->extradata_size;
- if(!copy_tb && av_q2d(icodec->time_base)*icodec->ticks_per_frame > av_q2d(ist->st->time_base) && av_q2d(ist->st->time_base) < 1.0/500){
- codec->time_base = icodec->time_base;
- codec->time_base.num *= icodec->ticks_per_frame;
- av_reduce(&codec->time_base.num, &codec->time_base.den,
- codec->time_base.num, codec->time_base.den, INT_MAX);
- }else
- codec->time_base = ist->st->time_base;
- switch(codec->codec_type) {
- case AVMEDIA_TYPE_AUDIO:
- if(audio_volume != 256) {
- fprintf(stderr,"-acodec copy and -vol are incompatible (frames are not decoded)\n");
- exit_program(1);
- }
- codec->channel_layout = icodec->channel_layout;
- codec->sample_rate = icodec->sample_rate;
- codec->channels = icodec->channels;
- codec->frame_size = icodec->frame_size;
- codec->audio_service_type = icodec->audio_service_type;
- codec->block_align= icodec->block_align;
- if(codec->block_align == 1 && codec->codec_id == CODEC_ID_MP3)
- codec->block_align= 0;
- if(codec->codec_id == CODEC_ID_AC3)
- codec->block_align= 0;
- break;
- case AVMEDIA_TYPE_VIDEO:
- codec->pix_fmt = icodec->pix_fmt;
- codec->width = icodec->width;
- codec->height = icodec->height;
- codec->has_b_frames = icodec->has_b_frames;
- if (!codec->sample_aspect_ratio.num) {
- codec->sample_aspect_ratio =
- ost->st->sample_aspect_ratio =
- ist->st->sample_aspect_ratio.num ? ist->st->sample_aspect_ratio :
- ist->st->codec->sample_aspect_ratio.num ?
- ist->st->codec->sample_aspect_ratio : (AVRational){0, 1};
- }
- break;
- case AVMEDIA_TYPE_SUBTITLE:
- codec->width = icodec->width;
- codec->height = icodec->height;
- break;
- case AVMEDIA_TYPE_DATA:
- break;
- default:
- abort();
- }
- } else {
- if (!ost->enc)
- ost->enc = avcodec_find_encoder(ost->st->codec->codec_id);
- switch(codec->codec_type) {
- case AVMEDIA_TYPE_AUDIO:
- ost->fifo= av_fifo_alloc(1024);
- if(!ost->fifo)
- goto fail;
- ost->reformat_pair = MAKE_SFMT_PAIR(AV_SAMPLE_FMT_NONE,AV_SAMPLE_FMT_NONE);
- if (!codec->sample_rate) {
- codec->sample_rate = icodec->sample_rate;
- if (icodec->lowres)
- codec->sample_rate >>= icodec->lowres;
- }
- choose_sample_rate(ost->st, ost->enc);
- codec->time_base = (AVRational){1, codec->sample_rate};
- if (codec->sample_fmt == AV_SAMPLE_FMT_NONE)
- codec->sample_fmt = icodec->sample_fmt;
- choose_sample_fmt(ost->st, ost->enc);
- if (!codec->channels)
- codec->channels = icodec->channels;
- codec->channel_layout = icodec->channel_layout;
- if (av_get_channel_layout_nb_channels(codec->channel_layout) != codec->channels)
- codec->channel_layout = 0;
- ost->audio_resample = codec->sample_rate != icodec->sample_rate || audio_sync_method > 1;
- icodec->request_channels = codec->channels;
- ist->decoding_needed = 1;
- ost->encoding_needed = 1;
- ost->resample_sample_fmt = icodec->sample_fmt;
- ost->resample_sample_rate = icodec->sample_rate;
- ost->resample_channels = icodec->channels;
- break;
- case AVMEDIA_TYPE_VIDEO:
- if (codec->pix_fmt == PIX_FMT_NONE)
- codec->pix_fmt = icodec->pix_fmt;
- choose_pixel_fmt(ost->st, ost->enc);
-
- if (ost->st->codec->pix_fmt == PIX_FMT_NONE) {
- fprintf(stderr, "Video pixel format is unknown, stream cannot be encoded\n");
- exit_program(1);
- }
-
- if (!codec->width || !codec->height) {
- codec->width = icodec->width;
- codec->height = icodec->height;
- }
-
- ost->video_resample = codec->width != icodec->width ||
- codec->height != icodec->height ||
- codec->pix_fmt != icodec->pix_fmt;
- if (ost->video_resample) {
-#if !CONFIG_AVFILTER
- avcodec_get_frame_defaults(&ost->pict_tmp);
- if(avpicture_alloc((AVPicture*)&ost->pict_tmp, codec->pix_fmt,
- codec->width, codec->height)) {
- fprintf(stderr, "Cannot allocate temp picture, check pix fmt\n");
- exit_program(1);
- }
- ost->img_resample_ctx = sws_getContext(
- icodec->width,
- icodec->height,
- icodec->pix_fmt,
- codec->width,
- codec->height,
- codec->pix_fmt,
- ost->sws_flags, NULL, NULL, NULL);
- if (ost->img_resample_ctx == NULL) {
- fprintf(stderr, "Cannot get resampling context\n");
- exit_program(1);
- }
-#endif
- codec->bits_per_raw_sample= 0;
- }
-
- ost->resample_height = icodec->height;
- ost->resample_width = icodec->width;
- ost->resample_pix_fmt= icodec->pix_fmt;
- ost->encoding_needed = 1;
- ist->decoding_needed = 1;
-
- if (!ost->frame_rate.num)
- ost->frame_rate = ist->st->r_frame_rate.num ? ist->st->r_frame_rate : (AVRational){25,1};
- if (ost->enc && ost->enc->supported_framerates && !force_fps) {
- int idx = av_find_nearest_q_idx(ost->frame_rate, ost->enc->supported_framerates);
- ost->frame_rate = ost->enc->supported_framerates[idx];
- }
- codec->time_base = (AVRational){ost->frame_rate.den, ost->frame_rate.num};
-
-#if CONFIG_AVFILTER
- if (configure_video_filters(ist, ost)) {
- fprintf(stderr, "Error opening filters!\n");
- exit(1);
- }
-#endif
- break;
- case AVMEDIA_TYPE_SUBTITLE:
- ost->encoding_needed = 1;
- ist->decoding_needed = 1;
- break;
- default:
- abort();
- break;
- }
- /* two pass mode */
- if (ost->encoding_needed &&
- (codec->flags & (CODEC_FLAG_PASS1 | CODEC_FLAG_PASS2))) {
- char logfilename[1024];
- FILE *f;
-
- snprintf(logfilename, sizeof(logfilename), "%s-%d.log",
- pass_logfilename_prefix ? pass_logfilename_prefix : DEFAULT_PASS_LOGFILENAME_PREFIX,
- i);
- if (codec->flags & CODEC_FLAG_PASS1) {
- f = fopen(logfilename, "wb");
- if (!f) {
- fprintf(stderr, "Cannot write log file '%s' for pass-1 encoding: %s\n", logfilename, strerror(errno));
- exit_program(1);
- }
- ost->logfile = f;
- } else {
- char *logbuffer;
- size_t logbuffer_size;
- if (cmdutils_read_file(logfilename, &logbuffer, &logbuffer_size) < 0) {
- fprintf(stderr, "Error reading log file '%s' for pass-2 encoding\n", logfilename);
- exit_program(1);
- }
- codec->stats_in = logbuffer;
- }
- }
- }
- if(codec->codec_type == AVMEDIA_TYPE_VIDEO){
- int size= codec->width * codec->height;
- bit_buffer_size= FFMAX(bit_buffer_size, 6*size + 200);
- }
- }
-
- if (!bit_buffer)
- bit_buffer = av_malloc(bit_buffer_size);
- if (!bit_buffer) {
- fprintf(stderr, "Cannot allocate %d bytes output buffer\n",
- bit_buffer_size);
- ret = AVERROR(ENOMEM);
- goto fail;
- }
-
- /* open each encoder */
- for(i=0;i<nb_ostreams;i++) {
- ost = ost_table[i];
- if (ost->encoding_needed) {
- AVCodec *codec = ost->enc;
- AVCodecContext *dec = input_streams[ost->source_index].st->codec;
- if (!codec) {
- snprintf(error, sizeof(error), "Encoder (codec id %d) not found for output stream #%d.%d",
- ost->st->codec->codec_id, ost->file_index, ost->index);
- ret = AVERROR(EINVAL);
- goto dump_format;
- }
- if (dec->subtitle_header) {
- ost->st->codec->subtitle_header = av_malloc(dec->subtitle_header_size);
- if (!ost->st->codec->subtitle_header) {
- ret = AVERROR(ENOMEM);
- goto dump_format;
- }
- memcpy(ost->st->codec->subtitle_header, dec->subtitle_header, dec->subtitle_header_size);
- ost->st->codec->subtitle_header_size = dec->subtitle_header_size;
- }
- if (avcodec_open2(ost->st->codec, codec, &ost->opts) < 0) {
- snprintf(error, sizeof(error), "Error while opening encoder for output stream #%d.%d - maybe incorrect parameters such as bit_rate, rate, width or height",
- ost->file_index, ost->index);
- ret = AVERROR(EINVAL);
- goto dump_format;
- }
- assert_codec_experimental(ost->st->codec, 1);
- assert_avoptions(ost->opts);
- if (ost->st->codec->bit_rate && ost->st->codec->bit_rate < 1000)
- av_log(NULL, AV_LOG_WARNING, "The bitrate parameter is set too low."
- "It takes bits/s as argument, not kbits/s\n");
- extra_size += ost->st->codec->extradata_size;
- }
- }
-
- /* open each decoder */
- for (i = 0; i < nb_input_streams; i++) {
- ist = &input_streams[i];
- if (ist->decoding_needed) {
- AVCodec *codec = ist->dec;
- if (!codec)
- codec = avcodec_find_decoder(ist->st->codec->codec_id);
- if (!codec) {
- snprintf(error, sizeof(error), "Decoder (codec id %d) not found for input stream #%d.%d",
- ist->st->codec->codec_id, ist->file_index, ist->st->index);
- ret = AVERROR(EINVAL);
- goto dump_format;
- }
-
- /* update requested sample format for the decoder based on the
- corresponding encoder sample format */
- for (j = 0; j < nb_ostreams; j++) {
- ost = ost_table[j];
- if (ost->source_index == i) {
- update_sample_fmt(ist->st->codec, codec, ost->st->codec);
- break;
- }
- }
-
- if (avcodec_open2(ist->st->codec, codec, &ist->opts) < 0) {
- snprintf(error, sizeof(error), "Error while opening decoder for input stream #%d.%d",
- ist->file_index, ist->st->index);
- ret = AVERROR(EINVAL);
- goto dump_format;
- }
- assert_codec_experimental(ist->st->codec, 0);
- assert_avoptions(ost->opts);
- }
- }
-
- /* init pts */
- for (i = 0; i < nb_input_streams; i++) {
- AVStream *st;
- ist = &input_streams[i];
- st= ist->st;
- ist->pts = st->avg_frame_rate.num ? - st->codec->has_b_frames*AV_TIME_BASE / av_q2d(st->avg_frame_rate) : 0;
- ist->next_pts = AV_NOPTS_VALUE;
- init_pts_correction(&ist->pts_ctx);
- ist->is_start = 1;
- }
-
- /* set meta data information from input file if required */
- for (i=0;i<nb_meta_data_maps;i++) {
- AVFormatContext *files[2];
- AVDictionary **meta[2];
- int j;
-
-#define METADATA_CHECK_INDEX(index, nb_elems, desc)\
- if ((index) < 0 || (index) >= (nb_elems)) {\
- snprintf(error, sizeof(error), "Invalid %s index %d while processing metadata maps\n",\
- (desc), (index));\
- ret = AVERROR(EINVAL);\
- goto dump_format;\
- }
-
- int out_file_index = meta_data_maps[i][0].file;
- int in_file_index = meta_data_maps[i][1].file;
- if (in_file_index < 0 || out_file_index < 0)
- continue;
- METADATA_CHECK_INDEX(out_file_index, nb_output_files, "output file")
- METADATA_CHECK_INDEX(in_file_index, nb_input_files, "input file")
-
- files[0] = output_files[out_file_index];
- files[1] = input_files[in_file_index].ctx;
-
- for (j = 0; j < 2; j++) {
- MetadataMap *map = &meta_data_maps[i][j];
-
- switch (map->type) {
- case 'g':
- meta[j] = &files[j]->metadata;
- break;
- case 's':
- METADATA_CHECK_INDEX(map->index, files[j]->nb_streams, "stream")
- meta[j] = &files[j]->streams[map->index]->metadata;
- break;
- case 'c':
- METADATA_CHECK_INDEX(map->index, files[j]->nb_chapters, "chapter")
- meta[j] = &files[j]->chapters[map->index]->metadata;
- break;
- case 'p':
- METADATA_CHECK_INDEX(map->index, files[j]->nb_programs, "program")
- meta[j] = &files[j]->programs[map->index]->metadata;
- break;
- }
- }
-
- av_dict_copy(meta[0], *meta[1], AV_DICT_DONT_OVERWRITE);
- }
-
- /* copy global metadata by default */
- if (metadata_global_autocopy) {
-
- for (i = 0; i < nb_output_files; i++)
- av_dict_copy(&output_files[i]->metadata, input_files[0].ctx->metadata,
- AV_DICT_DONT_OVERWRITE);
- }
-
- /* copy chapters according to chapter maps */
- for (i = 0; i < nb_chapter_maps; i++) {
- int infile = chapter_maps[i].in_file;
- int outfile = chapter_maps[i].out_file;
-
- if (infile < 0 || outfile < 0)
- continue;
- if (infile >= nb_input_files) {
- snprintf(error, sizeof(error), "Invalid input file index %d in chapter mapping.\n", infile);
- ret = AVERROR(EINVAL);
- goto dump_format;
- }
- if (outfile >= nb_output_files) {
- snprintf(error, sizeof(error), "Invalid output file index %d in chapter mapping.\n",outfile);
- ret = AVERROR(EINVAL);
- goto dump_format;
- }
- copy_chapters(infile, outfile);
- }
-
- /* copy chapters from the first input file that has them*/
- if (!nb_chapter_maps)
- for (i = 0; i < nb_input_files; i++) {
- if (!input_files[i].ctx->nb_chapters)
- continue;
-
- for (j = 0; j < nb_output_files; j++)
- if ((ret = copy_chapters(i, j)) < 0)
- goto dump_format;
- break;
- }
-
- /* open files and write file headers */
- for(i=0;i<nb_output_files;i++) {
- os = output_files[i];
- if (avformat_write_header(os, &output_opts[i]) < 0) {
- snprintf(error, sizeof(error), "Could not write header for output file #%d (incorrect codec parameters ?)", i);
- ret = AVERROR(EINVAL);
- goto dump_format;
- }
- assert_avoptions(output_opts[i]);
- if (strcmp(output_files[i]->oformat->name, "rtp")) {
- want_sdp = 0;
- }
- }
-
- dump_format:
- /* dump the file output parameters - cannot be done before in case
- of stream copy */
- for(i=0;i<nb_output_files;i++) {
- av_dump_format(output_files[i], i, output_files[i]->filename, 1);
- }
-
- /* dump the stream mapping */
- if (verbose >= 0) {
- fprintf(stderr, "Stream mapping:\n");
- for(i=0;i<nb_ostreams;i++) {
- ost = ost_table[i];
- fprintf(stderr, " Stream #%d.%d -> #%d.%d",
- input_streams[ost->source_index].file_index,
- input_streams[ost->source_index].st->index,
- ost->file_index,
- ost->index);
- if (ost->sync_ist != &input_streams[ost->source_index])
- fprintf(stderr, " [sync #%d.%d]",
- ost->sync_ist->file_index,
- ost->sync_ist->st->index);
- fprintf(stderr, "\n");
- }
- }
-
- if (ret) {
- fprintf(stderr, "%s\n", error);
- goto fail;
- }
-
- if (want_sdp) {
- print_sdp(output_files, nb_output_files);
- }
-
- if (verbose >= 0)
- fprintf(stderr, "Press ctrl-c to stop encoding\n");
- term_init();
-
- timer_start = av_gettime();
-
- for(; received_sigterm == 0;) {
- int file_index, ist_index;
- AVPacket pkt;
- double ipts_min;
- double opts_min;
-
- redo:
- ipts_min= 1e100;
- opts_min= 1e100;
-
- /* select the stream that we must read now by looking at the
- smallest output pts */
- file_index = -1;
- for(i=0;i<nb_ostreams;i++) {
- double ipts, opts;
- ost = ost_table[i];
- os = output_files[ost->file_index];
- ist = &input_streams[ost->source_index];
- if(ist->is_past_recording_time || no_packet[ist->file_index])
- continue;
- opts = ost->st->pts.val * av_q2d(ost->st->time_base);
- ipts = (double)ist->pts;
- if (!input_files[ist->file_index].eof_reached){
- if(ipts < ipts_min) {
- ipts_min = ipts;
- if(input_sync ) file_index = ist->file_index;
- }
- if(opts < opts_min) {
- opts_min = opts;
- if(!input_sync) file_index = ist->file_index;
- }
- }
- if(ost->frame_number >= max_frames[ost->st->codec->codec_type]){
- file_index= -1;
- break;
- }
- }
- /* if none, if is finished */
- if (file_index < 0) {
- if(no_packet_count){
- no_packet_count=0;
- memset(no_packet, 0, sizeof(no_packet));
- usleep(10000);
- continue;
- }
- break;
- }
-
- /* finish if limit size exhausted */
- if (limit_filesize != 0 && limit_filesize <= avio_tell(output_files[0]->pb))
- break;
-
- /* read a frame from it and output it in the fifo */
- is = input_files[file_index].ctx;
- ret= av_read_frame(is, &pkt);
- if(ret == AVERROR(EAGAIN)){
- no_packet[file_index]=1;
- no_packet_count++;
- continue;
- }
- if (ret < 0) {
- input_files[file_index].eof_reached = 1;
- if (opt_shortest)
- break;
- else
- continue;
- }
-
- no_packet_count=0;
- memset(no_packet, 0, sizeof(no_packet));
-
- if (do_pkt_dump) {
- av_pkt_dump_log2(NULL, AV_LOG_DEBUG, &pkt, do_hex_dump,
- is->streams[pkt.stream_index]);
- }
- /* the following test is needed in case new streams appear
- dynamically in stream : we ignore them */
- if (pkt.stream_index >= input_files[file_index].nb_streams)
- goto discard_packet;
- ist_index = input_files[file_index].ist_index + pkt.stream_index;
- ist = &input_streams[ist_index];
- if (ist->discard)
- goto discard_packet;
-
- if (pkt.dts != AV_NOPTS_VALUE)
- pkt.dts += av_rescale_q(input_files[ist->file_index].ts_offset, AV_TIME_BASE_Q, ist->st->time_base);
- if (pkt.pts != AV_NOPTS_VALUE)
- pkt.pts += av_rescale_q(input_files[ist->file_index].ts_offset, AV_TIME_BASE_Q, ist->st->time_base);
-
- if (ist->ts_scale) {
- if(pkt.pts != AV_NOPTS_VALUE)
- pkt.pts *= ist->ts_scale;
- if(pkt.dts != AV_NOPTS_VALUE)
- pkt.dts *= ist->ts_scale;
- }
-
-// fprintf(stderr, "next:%"PRId64" dts:%"PRId64" off:%"PRId64" %d\n", ist->next_pts, pkt.dts, input_files[ist->file_index].ts_offset, ist->st->codec->codec_type);
- if (pkt.dts != AV_NOPTS_VALUE && ist->next_pts != AV_NOPTS_VALUE
- && (is->iformat->flags & AVFMT_TS_DISCONT)) {
- int64_t pkt_dts= av_rescale_q(pkt.dts, ist->st->time_base, AV_TIME_BASE_Q);
- int64_t delta= pkt_dts - ist->next_pts;
- if((FFABS(delta) > 1LL*dts_delta_threshold*AV_TIME_BASE || pkt_dts+1<ist->pts)&& !copy_ts){
- input_files[ist->file_index].ts_offset -= delta;
- if (verbose > 2)
- fprintf(stderr, "timestamp discontinuity %"PRId64", new offset= %"PRId64"\n",
- delta, input_files[ist->file_index].ts_offset);
- pkt.dts-= av_rescale_q(delta, AV_TIME_BASE_Q, ist->st->time_base);
- if(pkt.pts != AV_NOPTS_VALUE)
- pkt.pts-= av_rescale_q(delta, AV_TIME_BASE_Q, ist->st->time_base);
- }
- }
-
- /* finish if recording time exhausted */
- if (recording_time != INT64_MAX &&
- av_compare_ts(pkt.pts, ist->st->time_base, recording_time + start_time, (AVRational){1, 1000000}) >= 0) {
- ist->is_past_recording_time = 1;
- goto discard_packet;
- }
-
- //fprintf(stderr,"read #%d.%d size=%d\n", ist->file_index, ist->st->index, pkt.size);
- if (output_packet(ist, ist_index, ost_table, nb_ostreams, &pkt) < 0) {
-
- if (verbose >= 0)
- fprintf(stderr, "Error while decoding stream #%d.%d\n",
- ist->file_index, ist->st->index);
- if (exit_on_error)
- exit_program(1);
- av_free_packet(&pkt);
- goto redo;
- }
-
- discard_packet:
- av_free_packet(&pkt);
-
- /* dump report by using the output first video and audio streams */
- print_report(output_files, ost_table, nb_ostreams, 0);
- }
-
- /* at the end of stream, we must flush the decoder buffers */
- for (i = 0; i < nb_input_streams; i++) {
- ist = &input_streams[i];
- if (ist->decoding_needed) {
- output_packet(ist, i, ost_table, nb_ostreams, NULL);
- }
- }
-
- term_exit();
-
- /* write the trailer if needed and close file */
- for(i=0;i<nb_output_files;i++) {
- os = output_files[i];
- av_write_trailer(os);
- }
-
- /* dump report by using the first video and audio streams */
- print_report(output_files, ost_table, nb_ostreams, 1);
-
- /* close each encoder */
- for(i=0;i<nb_ostreams;i++) {
- ost = ost_table[i];
- if (ost->encoding_needed) {
- av_freep(&ost->st->codec->stats_in);
- avcodec_close(ost->st->codec);
- }
-#if CONFIG_AVFILTER
- avfilter_graph_free(&ost->graph);
-#endif
- }
-
- /* close each decoder */
- for (i = 0; i < nb_input_streams; i++) {
- ist = &input_streams[i];
- if (ist->decoding_needed) {
- avcodec_close(ist->st->codec);
- }
- }
-
- /* finished ! */
- ret = 0;
-
- fail:
- av_freep(&bit_buffer);
-
- if (ost_table) {
- for(i=0;i<nb_ostreams;i++) {
- ost = ost_table[i];
- if (ost) {
- if (ost->st->stream_copy)
- av_freep(&ost->st->codec->extradata);
- if (ost->logfile) {
- fclose(ost->logfile);
- ost->logfile = NULL;
- }
- av_fifo_free(ost->fifo); /* works even if fifo is not
- initialized but set to zero */
- av_freep(&ost->st->codec->subtitle_header);
- av_free(ost->pict_tmp.data[0]);
- av_free(ost->forced_kf_pts);
- if (ost->video_resample)
- sws_freeContext(ost->img_resample_ctx);
- if (ost->resample)
- audio_resample_close(ost->resample);
- if (ost->reformat_ctx)
- av_audio_convert_free(ost->reformat_ctx);
- av_dict_free(&ost->opts);
- av_free(ost);
- }
- }
- av_free(ost_table);
- }
- return ret;
-}
-
-static int opt_format(const char *opt, const char *arg)
-{
- last_asked_format = arg;
- return 0;
-}
-
-static int opt_video_rc_override_string(const char *opt, const char *arg)
-{
- video_rc_override_string = arg;
- return 0;
-}
-
-static int opt_me_threshold(const char *opt, const char *arg)
-{
- me_threshold = parse_number_or_die(opt, arg, OPT_INT64, INT_MIN, INT_MAX);
- return 0;
-}
-
-static int opt_verbose(const char *opt, const char *arg)
-{
- verbose = parse_number_or_die(opt, arg, OPT_INT64, -10, 10);
- return 0;
-}
-
-static int opt_frame_rate(const char *opt, const char *arg)
-{
- if (av_parse_video_rate(&frame_rate, arg) < 0) {
- fprintf(stderr, "Incorrect value for %s: %s\n", opt, arg);
- exit_program(1);
- }
- return 0;
-}
-
-static int opt_frame_crop(const char *opt, const char *arg)
-{
- fprintf(stderr, "Option '%s' has been removed, use the crop filter instead\n", opt);
- return AVERROR(EINVAL);
-}
-
-static int opt_frame_size(const char *opt, const char *arg)
-{
- if (av_parse_video_size(&frame_width, &frame_height, arg) < 0) {
- fprintf(stderr, "Incorrect frame size\n");
- return AVERROR(EINVAL);
- }
- return 0;
-}
-
-static int opt_pad(const char *opt, const char *arg) {
- fprintf(stderr, "Option '%s' has been removed, use the pad filter instead\n", opt);
- return -1;
-}
-
-static int opt_frame_pix_fmt(const char *opt, const char *arg)
-{
- if (strcmp(arg, "list")) {
- frame_pix_fmt = av_get_pix_fmt(arg);
- if (frame_pix_fmt == PIX_FMT_NONE) {
- fprintf(stderr, "Unknown pixel format requested: %s\n", arg);
- return AVERROR(EINVAL);
- }
- } else {
- show_pix_fmts();
- exit_program(0);
- }
- return 0;
-}
-
-static int opt_frame_aspect_ratio(const char *opt, const char *arg)
-{
- int x = 0, y = 0;
- double ar = 0;
- const char *p;
- char *end;
-
- p = strchr(arg, ':');
- if (p) {
- x = strtol(arg, &end, 10);
- if (end == p)
- y = strtol(end+1, &end, 10);
- if (x > 0 && y > 0)
- ar = (double)x / (double)y;
- } else
- ar = strtod(arg, NULL);
-
- if (!ar) {
- fprintf(stderr, "Incorrect aspect ratio specification.\n");
- return AVERROR(EINVAL);
- }
- frame_aspect_ratio = ar;
- return 0;
-}
-
-static int opt_metadata(const char *opt, const char *arg)
-{
- char *mid= strchr(arg, '=');
-
- if(!mid){
- fprintf(stderr, "Missing =\n");
- exit_program(1);
- }
- *mid++= 0;
-
- av_dict_set(&metadata, arg, mid, 0);
-
- return 0;
-}
-
-static int opt_qscale(const char *opt, const char *arg)
-{
- video_qscale = parse_number_or_die(opt, arg, OPT_FLOAT, 0, 255);
- if (video_qscale == 0) {
- fprintf(stderr, "qscale must be > 0.0 and <= 255\n");
- return AVERROR(EINVAL);
- }
- return 0;
-}
-
-static int opt_top_field_first(const char *opt, const char *arg)
-{
- top_field_first = parse_number_or_die(opt, arg, OPT_INT, 0, 1);
- return 0;
-}
-
-static int opt_thread_count(const char *opt, const char *arg)
-{
- thread_count= parse_number_or_die(opt, arg, OPT_INT64, 0, INT_MAX);
-#if !HAVE_THREADS
- if (verbose >= 0)
- fprintf(stderr, "Warning: not compiled with thread support, using thread emulation\n");
-#endif
- return 0;
-}
-
-static int opt_audio_sample_fmt(const char *opt, const char *arg)
-{
- if (strcmp(arg, "list")) {
- audio_sample_fmt = av_get_sample_fmt(arg);
- if (audio_sample_fmt == AV_SAMPLE_FMT_NONE) {
- av_log(NULL, AV_LOG_ERROR, "Invalid sample format '%s'\n", arg);
- return AVERROR(EINVAL);
- }
- } else {
- int i;
- char fmt_str[128];
- for (i = -1; i < AV_SAMPLE_FMT_NB; i++)
- printf("%s\n", av_get_sample_fmt_string(fmt_str, sizeof(fmt_str), i));
- exit_program(0);
- }
- return 0;
-}
-
-static int opt_audio_rate(const char *opt, const char *arg)
-{
- audio_sample_rate = parse_number_or_die(opt, arg, OPT_INT64, 0, INT_MAX);
- return 0;
-}
-
-static int opt_audio_channels(const char *opt, const char *arg)
-{
- audio_channels = parse_number_or_die(opt, arg, OPT_INT64, 0, INT_MAX);
- return 0;
-}
-
-static int opt_video_channel(const char *opt, const char *arg)
-{
- av_log(NULL, AV_LOG_WARNING, "This option is deprecated, use -channel.\n");
- opt_default("channel", arg);
- return 0;
-}
-
-static int opt_video_standard(const char *opt, const char *arg)
-{
- av_log(NULL, AV_LOG_WARNING, "This option is deprecated, use -standard.\n");
- opt_default("standard", arg);
- return 0;
-}
-
-static int opt_codec(int *pstream_copy, char **pcodec_name,
- int codec_type, const char *arg)
-{
- av_freep(pcodec_name);
- if (!strcmp(arg, "copy")) {
- *pstream_copy = 1;
- } else {
- *pcodec_name = av_strdup(arg);
- }
- return 0;
-}
-
-static int opt_audio_codec(const char *opt, const char *arg)
-{
- return opt_codec(&audio_stream_copy, &audio_codec_name, AVMEDIA_TYPE_AUDIO, arg);
-}
-
-static int opt_video_codec(const char *opt, const char *arg)
-{
- return opt_codec(&video_stream_copy, &video_codec_name, AVMEDIA_TYPE_VIDEO, arg);
-}
-
-static int opt_subtitle_codec(const char *opt, const char *arg)
-{
- return opt_codec(&subtitle_stream_copy, &subtitle_codec_name, AVMEDIA_TYPE_SUBTITLE, arg);
-}
-
-static int opt_data_codec(const char *opt, const char *arg)
-{
- return opt_codec(&data_stream_copy, &data_codec_name, AVMEDIA_TYPE_DATA, arg);
-}
-
-static int opt_codec_tag(const char *opt, const char *arg)
-{
- char *tail;
- uint32_t *codec_tag;
-
- codec_tag = !strcmp(opt, "atag") ? &audio_codec_tag :
- !strcmp(opt, "vtag") ? &video_codec_tag :
- !strcmp(opt, "stag") ? &subtitle_codec_tag : NULL;
- if (!codec_tag)
- return -1;
-
- *codec_tag = strtol(arg, &tail, 0);
- if (!tail || *tail)
- *codec_tag = AV_RL32(arg);
-
- return 0;
-}
-
-static int opt_map(const char *opt, const char *arg)
-{
- StreamMap *m;
- char *p;
-
- stream_maps = grow_array(stream_maps, sizeof(*stream_maps), &nb_stream_maps, nb_stream_maps + 1);
- m = &stream_maps[nb_stream_maps-1];
-
- m->file_index = strtol(arg, &p, 0);
- if (*p)
- p++;
-
- m->stream_index = strtol(p, &p, 0);
- if (*p) {
- p++;
- m->sync_file_index = strtol(p, &p, 0);
- if (*p)
- p++;
- m->sync_stream_index = strtol(p, &p, 0);
- } else {
- m->sync_file_index = m->file_index;
- m->sync_stream_index = m->stream_index;
- }
- return 0;
-}
-
-static void parse_meta_type(char *arg, char *type, int *index, char **endptr)
-{
- *endptr = arg;
- if (*arg == ',') {
- *type = *(++arg);
- switch (*arg) {
- case 'g':
- break;
- case 's':
- case 'c':
- case 'p':
- *index = strtol(++arg, endptr, 0);
- break;
- default:
- fprintf(stderr, "Invalid metadata type %c.\n", *arg);
- exit_program(1);
- }
- } else
- *type = 'g';
-}
-
-static int opt_map_metadata(const char *opt, const char *arg)
-{
- MetadataMap *m, *m1;
- char *p;
-
- meta_data_maps = grow_array(meta_data_maps, sizeof(*meta_data_maps),
- &nb_meta_data_maps, nb_meta_data_maps + 1);
-
- m = &meta_data_maps[nb_meta_data_maps - 1][0];
- m->file = strtol(arg, &p, 0);
- parse_meta_type(p, &m->type, &m->index, &p);
- if (*p)
- p++;
-
- m1 = &meta_data_maps[nb_meta_data_maps - 1][1];
- m1->file = strtol(p, &p, 0);
- parse_meta_type(p, &m1->type, &m1->index, &p);
-
- if (m->type == 'g' || m1->type == 'g')
- metadata_global_autocopy = 0;
- if (m->type == 's' || m1->type == 's')
- metadata_streams_autocopy = 0;
- if (m->type == 'c' || m1->type == 'c')
- metadata_chapters_autocopy = 0;
-
- return 0;
-}
-
-static int opt_map_meta_data(const char *opt, const char *arg)
-{
- fprintf(stderr, "-map_meta_data is deprecated and will be removed soon. "
- "Use -map_metadata instead.\n");
- return opt_map_metadata(opt, arg);
-}
-
-static int opt_map_chapters(const char *opt, const char *arg)
-{
- ChapterMap *c;
- char *p;
-
- chapter_maps = grow_array(chapter_maps, sizeof(*chapter_maps), &nb_chapter_maps,
- nb_chapter_maps + 1);
- c = &chapter_maps[nb_chapter_maps - 1];
- c->out_file = strtol(arg, &p, 0);
- if (*p)
- p++;
-
- c->in_file = strtol(p, &p, 0);
- return 0;
-}
-
-static int opt_input_ts_scale(const char *opt, const char *arg)
-{
- unsigned int stream;
- double scale;
- char *p;
-
- stream = strtol(arg, &p, 0);
- if (*p)
- p++;
- scale= strtod(p, &p);
-
- ts_scale = grow_array(ts_scale, sizeof(*ts_scale), &nb_ts_scale, stream + 1);
- ts_scale[stream] = scale;
- return 0;
-}
-
-static int opt_recording_time(const char *opt, const char *arg)
-{
- recording_time = parse_time_or_die(opt, arg, 1);
- return 0;
-}
-
-static int opt_start_time(const char *opt, const char *arg)
-{
- start_time = parse_time_or_die(opt, arg, 1);
- return 0;
-}
-
-static int opt_recording_timestamp(const char *opt, const char *arg)
-{
- char buf[128];
- int64_t recording_timestamp = parse_time_or_die(opt, arg, 0) / 1E6;
- struct tm time = *gmtime((time_t*)&recording_timestamp);
- strftime(buf, sizeof(buf), "creation_time=%FT%T%z", &time);
- opt_metadata("metadata", buf);
-
- av_log(NULL, AV_LOG_WARNING, "%s is deprecated, set the 'creation_time' metadata "
- "tag instead.\n", opt);
- return 0;
-}
-
-static int opt_input_ts_offset(const char *opt, const char *arg)
-{
- input_ts_offset = parse_time_or_die(opt, arg, 1);
- return 0;
-}
-
-static enum CodecID find_codec_or_die(const char *name, int type, int encoder)
-{
- const char *codec_string = encoder ? "encoder" : "decoder";
- AVCodec *codec;
-
- if(!name)
- return CODEC_ID_NONE;
- codec = encoder ?
- avcodec_find_encoder_by_name(name) :
- avcodec_find_decoder_by_name(name);
- if(!codec) {
- fprintf(stderr, "Unknown %s '%s'\n", codec_string, name);
- exit_program(1);
- }
- if(codec->type != type) {
- fprintf(stderr, "Invalid %s type '%s'\n", codec_string, name);
- exit_program(1);
- }
- return codec->id;
-}
-
-static int opt_input_file(const char *opt, const char *filename)
-{
- AVFormatContext *ic;
- AVInputFormat *file_iformat = NULL;
- int err, i, ret, rfps, rfps_base;
- int64_t timestamp;
- uint8_t buf[128];
- AVDictionary **opts;
- int orig_nb_streams; // number of streams before avformat_find_stream_info
-
- if (last_asked_format) {
- if (!(file_iformat = av_find_input_format(last_asked_format))) {
- fprintf(stderr, "Unknown input format: '%s'\n", last_asked_format);
- exit_program(1);
- }
- last_asked_format = NULL;
- }
-
- if (!strcmp(filename, "-"))
- filename = "pipe:";
-
- using_stdin |= !strncmp(filename, "pipe:", 5) ||
- !strcmp(filename, "/dev/stdin");
-
- /* get default parameters from command line */
- ic = avformat_alloc_context();
- if (!ic) {
- print_error(filename, AVERROR(ENOMEM));
- exit_program(1);
- }
- if (audio_sample_rate) {
- snprintf(buf, sizeof(buf), "%d", audio_sample_rate);
- av_dict_set(&format_opts, "sample_rate", buf, 0);
- }
- if (audio_channels) {
- snprintf(buf, sizeof(buf), "%d", audio_channels);
- av_dict_set(&format_opts, "channels", buf, 0);
- }
- if (frame_rate.num) {
- snprintf(buf, sizeof(buf), "%d/%d", frame_rate.num, frame_rate.den);
- av_dict_set(&format_opts, "framerate", buf, 0);
- }
- if (frame_width && frame_height) {
- snprintf(buf, sizeof(buf), "%dx%d", frame_width, frame_height);
- av_dict_set(&format_opts, "video_size", buf, 0);
- }
- if (frame_pix_fmt != PIX_FMT_NONE)
- av_dict_set(&format_opts, "pixel_format", av_get_pix_fmt_name(frame_pix_fmt), 0);
-
- ic->video_codec_id =
- find_codec_or_die(video_codec_name , AVMEDIA_TYPE_VIDEO , 0);
- ic->audio_codec_id =
- find_codec_or_die(audio_codec_name , AVMEDIA_TYPE_AUDIO , 0);
- ic->subtitle_codec_id=
- find_codec_or_die(subtitle_codec_name, AVMEDIA_TYPE_SUBTITLE, 0);
- ic->flags |= AVFMT_FLAG_NONBLOCK;
-
- /* open the input file with generic libav function */
- err = avformat_open_input(&ic, filename, file_iformat, &format_opts);
- if (err < 0) {
- print_error(filename, err);
- exit_program(1);
- }
- assert_avoptions(format_opts);
-
- if(opt_programid) {
- int i, j;
- int found=0;
- for(i=0; i<ic->nb_streams; i++){
- ic->streams[i]->discard= AVDISCARD_ALL;
- }
- for(i=0; i<ic->nb_programs; i++){
- AVProgram *p= ic->programs[i];
- if(p->id != opt_programid){
- p->discard = AVDISCARD_ALL;
- }else{
- found=1;
- for(j=0; j<p->nb_stream_indexes; j++){
- ic->streams[p->stream_index[j]]->discard= AVDISCARD_DEFAULT;
- }
- }
- }
- if(!found){
- fprintf(stderr, "Specified program id not found\n");
- exit_program(1);
- }
- opt_programid=0;
- }
-
- if (loop_input) {
- av_log(NULL, AV_LOG_WARNING, "-loop_input is deprecated, use -loop 1\n");
- ic->loop_input = loop_input;
- }
-
- /* Set AVCodecContext options for avformat_find_stream_info */
- opts = setup_find_stream_info_opts(ic, codec_opts);
- orig_nb_streams = ic->nb_streams;
-
- /* If not enough info to get the stream parameters, we decode the
- first frames to get it. (used in mpeg case for example) */
- ret = avformat_find_stream_info(ic, opts);
- if (ret < 0 && verbose >= 0) {
- fprintf(stderr, "%s: could not find codec parameters\n", filename);
- av_close_input_file(ic);
- exit_program(1);
- }
-
- timestamp = start_time;
- /* add the stream start time */
- if (ic->start_time != AV_NOPTS_VALUE)
- timestamp += ic->start_time;
-
- /* if seeking requested, we execute it */
- if (start_time != 0) {
- ret = av_seek_frame(ic, -1, timestamp, AVSEEK_FLAG_BACKWARD);
- if (ret < 0) {
- fprintf(stderr, "%s: could not seek to position %0.3f\n",
- filename, (double)timestamp / AV_TIME_BASE);
- }
- /* reset seek info */
- start_time = 0;
- }
-
- /* update the current parameters so that they match the one of the input stream */
- for(i=0;i<ic->nb_streams;i++) {
- AVStream *st = ic->streams[i];
- AVCodecContext *dec = st->codec;
- InputStream *ist;
-
- dec->thread_count = thread_count;
-
- input_streams = grow_array(input_streams, sizeof(*input_streams), &nb_input_streams, nb_input_streams + 1);
- ist = &input_streams[nb_input_streams - 1];
- ist->st = st;
- ist->file_index = nb_input_files;
- ist->discard = 1;
- ist->opts = filter_codec_opts(codec_opts, ist->st->codec->codec_id, ic, st);
-
- if (i < nb_ts_scale)
- ist->ts_scale = ts_scale[i];
-
- switch (dec->codec_type) {
- case AVMEDIA_TYPE_AUDIO:
- ist->dec = avcodec_find_decoder_by_name(audio_codec_name);
- if(audio_disable)
- st->discard= AVDISCARD_ALL;
- break;
- case AVMEDIA_TYPE_VIDEO:
- ist->dec = avcodec_find_decoder_by_name(video_codec_name);
- rfps = ic->streams[i]->r_frame_rate.num;
- rfps_base = ic->streams[i]->r_frame_rate.den;
- if (dec->lowres) {
- dec->flags |= CODEC_FLAG_EMU_EDGE;
- dec->height >>= dec->lowres;
- dec->width >>= dec->lowres;
- }
- if(me_threshold)
- dec->debug |= FF_DEBUG_MV;
-
- if (dec->time_base.den != rfps*dec->ticks_per_frame || dec->time_base.num != rfps_base) {
-
- if (verbose >= 0)
- fprintf(stderr,"\nSeems stream %d codec frame rate differs from container frame rate: %2.2f (%d/%d) -> %2.2f (%d/%d)\n",
- i, (float)dec->time_base.den / dec->time_base.num, dec->time_base.den, dec->time_base.num,
-
- (float)rfps / rfps_base, rfps, rfps_base);
- }
-
- if(video_disable)
- st->discard= AVDISCARD_ALL;
- else if(video_discard)
- st->discard= video_discard;
- break;
- case AVMEDIA_TYPE_DATA:
- break;
- case AVMEDIA_TYPE_SUBTITLE:
- ist->dec = avcodec_find_decoder_by_name(subtitle_codec_name);
- if(subtitle_disable)
- st->discard = AVDISCARD_ALL;
- break;
- case AVMEDIA_TYPE_ATTACHMENT:
- case AVMEDIA_TYPE_UNKNOWN:
- break;
- default:
- abort();
- }
- }
-
- /* dump the file content */
- if (verbose >= 0)
- av_dump_format(ic, nb_input_files, filename, 0);
-
- input_files = grow_array(input_files, sizeof(*input_files), &nb_input_files, nb_input_files + 1);
- input_files[nb_input_files - 1].ctx = ic;
- input_files[nb_input_files - 1].ist_index = nb_input_streams - ic->nb_streams;
- input_files[nb_input_files - 1].ts_offset = input_ts_offset - (copy_ts ? 0 : timestamp);
- input_files[nb_input_files - 1].nb_streams = ic->nb_streams;
-
- frame_rate = (AVRational){0, 0};
- frame_pix_fmt = PIX_FMT_NONE;
- frame_height = 0;
- frame_width = 0;
- audio_sample_rate = 0;
- audio_channels = 0;
- audio_sample_fmt = AV_SAMPLE_FMT_NONE;
- av_freep(&ts_scale);
- nb_ts_scale = 0;
-
- for (i = 0; i < orig_nb_streams; i++)
- av_dict_free(&opts[i]);
- av_freep(&opts);
- av_freep(&video_codec_name);
- av_freep(&audio_codec_name);
- av_freep(&subtitle_codec_name);
- uninit_opts();
- init_opts();
- return 0;
-}
-
-static void check_inputs(int *has_video_ptr,
- int *has_audio_ptr,
- int *has_subtitle_ptr,
- int *has_data_ptr)
-{
- int has_video, has_audio, has_subtitle, has_data, i, j;
- AVFormatContext *ic;
-
- has_video = 0;
- has_audio = 0;
- has_subtitle = 0;
- has_data = 0;
-
- for(j=0;j<nb_input_files;j++) {
- ic = input_files[j].ctx;
- for(i=0;i<ic->nb_streams;i++) {
- AVCodecContext *enc = ic->streams[i]->codec;
- switch(enc->codec_type) {
- case AVMEDIA_TYPE_AUDIO:
- has_audio = 1;
- break;
- case AVMEDIA_TYPE_VIDEO:
- has_video = 1;
- break;
- case AVMEDIA_TYPE_SUBTITLE:
- has_subtitle = 1;
- break;
- case AVMEDIA_TYPE_DATA:
- case AVMEDIA_TYPE_ATTACHMENT:
- case AVMEDIA_TYPE_UNKNOWN:
- has_data = 1;
- break;
- default:
- abort();
- }
- }
- }
- *has_video_ptr = has_video;
- *has_audio_ptr = has_audio;
- *has_subtitle_ptr = has_subtitle;
- *has_data_ptr = has_data;
-}
-
-static void new_video_stream(AVFormatContext *oc, int file_idx)
-{
- AVStream *st;
- OutputStream *ost;
- AVCodecContext *video_enc;
- enum CodecID codec_id = CODEC_ID_NONE;
- AVCodec *codec= NULL;
-
- if(!video_stream_copy){
- if (video_codec_name) {
- codec_id = find_codec_or_die(video_codec_name, AVMEDIA_TYPE_VIDEO, 1);
- codec = avcodec_find_encoder_by_name(video_codec_name);
- } else {
- codec_id = av_guess_codec(oc->oformat, NULL, oc->filename, NULL, AVMEDIA_TYPE_VIDEO);
- codec = avcodec_find_encoder(codec_id);
- }
- }
-
- ost = new_output_stream(oc, file_idx, codec);
- st = ost->st;
- if (!video_stream_copy) {
- ost->frame_aspect_ratio = frame_aspect_ratio;
- frame_aspect_ratio = 0;
-#if CONFIG_AVFILTER
- ost->avfilter= vfilters;
- vfilters = NULL;
-#endif
- }
-
- ost->bitstream_filters = video_bitstream_filters;
- video_bitstream_filters= NULL;
-
- st->codec->thread_count= thread_count;
-
- video_enc = st->codec;
-
- if(video_codec_tag)
- video_enc->codec_tag= video_codec_tag;
-
- if(oc->oformat->flags & AVFMT_GLOBALHEADER) {
- video_enc->flags |= CODEC_FLAG_GLOBAL_HEADER;
- }
-
- video_enc->codec_type = AVMEDIA_TYPE_VIDEO;
- if (video_stream_copy) {
- st->stream_copy = 1;
- video_enc->sample_aspect_ratio =
- st->sample_aspect_ratio = av_d2q(frame_aspect_ratio*frame_height/frame_width, 255);
- } else {
- const char *p;
- int i;
-
- if (frame_rate.num)
- ost->frame_rate = frame_rate;
- video_enc->codec_id = codec_id;
-
- video_enc->width = frame_width;
- video_enc->height = frame_height;
- video_enc->pix_fmt = frame_pix_fmt;
- st->sample_aspect_ratio = video_enc->sample_aspect_ratio;
-
- if (intra_only)
- video_enc->gop_size = 0;
- if (video_qscale || same_quality) {
- video_enc->flags |= CODEC_FLAG_QSCALE;
- video_enc->global_quality = FF_QP2LAMBDA * video_qscale;
- }
-
- if(intra_matrix)
- video_enc->intra_matrix = intra_matrix;
- if(inter_matrix)
- video_enc->inter_matrix = inter_matrix;
-
- p= video_rc_override_string;
- for(i=0; p; i++){
- int start, end, q;
- int e=sscanf(p, "%d,%d,%d", &start, &end, &q);
- if(e!=3){
- fprintf(stderr, "error parsing rc_override\n");
- exit_program(1);
- }
- video_enc->rc_override=
- av_realloc(video_enc->rc_override,
- sizeof(RcOverride)*(i+1));
- video_enc->rc_override[i].start_frame= start;
- video_enc->rc_override[i].end_frame = end;
- if(q>0){
- video_enc->rc_override[i].qscale= q;
- video_enc->rc_override[i].quality_factor= 1.0;
- }
- else{
- video_enc->rc_override[i].qscale= 0;
- video_enc->rc_override[i].quality_factor= -q/100.0;
- }
- p= strchr(p, '/');
- if(p) p++;
- }
- video_enc->rc_override_count=i;
- if (!video_enc->rc_initial_buffer_occupancy)
- video_enc->rc_initial_buffer_occupancy = video_enc->rc_buffer_size*3/4;
- video_enc->me_threshold= me_threshold;
- video_enc->intra_dc_precision= intra_dc_precision - 8;
-
- if (do_psnr)
- video_enc->flags|= CODEC_FLAG_PSNR;
-
- /* two pass mode */
- if (do_pass) {
- if (do_pass == 1) {
- video_enc->flags |= CODEC_FLAG_PASS1;
- } else {
- video_enc->flags |= CODEC_FLAG_PASS2;
- }
- }
-
- if (forced_key_frames)
- parse_forced_key_frames(forced_key_frames, ost, video_enc);
- }
- if (video_language) {
- av_dict_set(&st->metadata, "language", video_language, 0);
- av_freep(&video_language);
- }
-
- /* reset some key parameters */
- video_disable = 0;
- av_freep(&video_codec_name);
- av_freep(&forced_key_frames);
- video_stream_copy = 0;
- frame_pix_fmt = PIX_FMT_NONE;
-}
-
-static void new_audio_stream(AVFormatContext *oc, int file_idx)
-{
- AVStream *st;
- OutputStream *ost;
- AVCodec *codec= NULL;
- AVCodecContext *audio_enc;
- enum CodecID codec_id = CODEC_ID_NONE;
-
- if(!audio_stream_copy){
- if (audio_codec_name) {
- codec_id = find_codec_or_die(audio_codec_name, AVMEDIA_TYPE_AUDIO, 1);
- codec = avcodec_find_encoder_by_name(audio_codec_name);
- } else {
- codec_id = av_guess_codec(oc->oformat, NULL, oc->filename, NULL, AVMEDIA_TYPE_AUDIO);
- codec = avcodec_find_encoder(codec_id);
- }
- }
- ost = new_output_stream(oc, file_idx, codec);
- st = ost->st;
-
- ost->bitstream_filters = audio_bitstream_filters;
- audio_bitstream_filters= NULL;
-
- st->codec->thread_count= thread_count;
-
- audio_enc = st->codec;
- audio_enc->codec_type = AVMEDIA_TYPE_AUDIO;
-
- if(audio_codec_tag)
- audio_enc->codec_tag= audio_codec_tag;
-
- if (oc->oformat->flags & AVFMT_GLOBALHEADER) {
- audio_enc->flags |= CODEC_FLAG_GLOBAL_HEADER;
- }
- if (audio_stream_copy) {
- st->stream_copy = 1;
- } else {
- audio_enc->codec_id = codec_id;
-
- if (audio_qscale > QSCALE_NONE) {
- audio_enc->flags |= CODEC_FLAG_QSCALE;
- audio_enc->global_quality = FF_QP2LAMBDA * audio_qscale;
- }
- if (audio_channels)
- audio_enc->channels = audio_channels;
- if (audio_sample_fmt != AV_SAMPLE_FMT_NONE)
- audio_enc->sample_fmt = audio_sample_fmt;
- if (audio_sample_rate)
- audio_enc->sample_rate = audio_sample_rate;
- }
- if (audio_language) {
- av_dict_set(&st->metadata, "language", audio_language, 0);
- av_freep(&audio_language);
- }
-
- /* reset some key parameters */
- audio_disable = 0;
- av_freep(&audio_codec_name);
- audio_stream_copy = 0;
-}
-
-static void new_data_stream(AVFormatContext *oc, int file_idx)
-{
- AVStream *st;
- OutputStream *ost;
- AVCodecContext *data_enc;
-
- ost = new_output_stream(oc, file_idx, NULL);
- st = ost->st;
- data_enc = st->codec;
- if (!data_stream_copy) {
- fprintf(stderr, "Data stream encoding not supported yet (only streamcopy)\n");
- exit_program(1);
- }
-
- data_enc->codec_type = AVMEDIA_TYPE_DATA;
-
- if (data_codec_tag)
- data_enc->codec_tag= data_codec_tag;
-
- if (oc->oformat->flags & AVFMT_GLOBALHEADER) {
- data_enc->flags |= CODEC_FLAG_GLOBAL_HEADER;
- }
- if (data_stream_copy) {
- st->stream_copy = 1;
- }
-
- data_disable = 0;
- av_freep(&data_codec_name);
- data_stream_copy = 0;
-}
-
-static void new_subtitle_stream(AVFormatContext *oc, int file_idx)
-{
- AVStream *st;
- OutputStream *ost;
- AVCodec *codec=NULL;
- AVCodecContext *subtitle_enc;
- enum CodecID codec_id = CODEC_ID_NONE;
-
- if(!subtitle_stream_copy){
- if (subtitle_codec_name) {
- codec_id = find_codec_or_die(subtitle_codec_name, AVMEDIA_TYPE_SUBTITLE, 1);
- codec = avcodec_find_encoder_by_name(subtitle_codec_name);
- } else {
- codec_id = av_guess_codec(oc->oformat, NULL, oc->filename, NULL, AVMEDIA_TYPE_SUBTITLE);
- codec = avcodec_find_encoder(codec_id);
- }
- }
- ost = new_output_stream(oc, file_idx, codec);
- st = ost->st;
- subtitle_enc = st->codec;
-
- ost->bitstream_filters = subtitle_bitstream_filters;
- subtitle_bitstream_filters= NULL;
-
- subtitle_enc->codec_type = AVMEDIA_TYPE_SUBTITLE;
-
- if(subtitle_codec_tag)
- subtitle_enc->codec_tag= subtitle_codec_tag;
-
- if (oc->oformat->flags & AVFMT_GLOBALHEADER) {
- subtitle_enc->flags |= CODEC_FLAG_GLOBAL_HEADER;
- }
- if (subtitle_stream_copy) {
- st->stream_copy = 1;
- } else {
- subtitle_enc->codec_id = codec_id;
- }
-
- if (subtitle_language) {
- av_dict_set(&st->metadata, "language", subtitle_language, 0);
- av_freep(&subtitle_language);
- }
-
- subtitle_disable = 0;
- av_freep(&subtitle_codec_name);
- subtitle_stream_copy = 0;
-}
-
-static int opt_new_stream(const char *opt, const char *arg)
-{
- AVFormatContext *oc;
- int file_idx = nb_output_files - 1;
- if (nb_output_files <= 0) {
- fprintf(stderr, "At least one output file must be specified\n");
- exit_program(1);
- }
- oc = output_files[file_idx];
-
- if (!strcmp(opt, "newvideo" )) new_video_stream (oc, file_idx);
- else if (!strcmp(opt, "newaudio" )) new_audio_stream (oc, file_idx);
- else if (!strcmp(opt, "newsubtitle")) new_subtitle_stream(oc, file_idx);
- else if (!strcmp(opt, "newdata" )) new_data_stream (oc, file_idx);
- else av_assert0(0);
- return 0;
-}
-
-/* arg format is "output-stream-index:streamid-value". */
-static int opt_streamid(const char *opt, const char *arg)
-{
- int idx;
- char *p;
- char idx_str[16];
-
- av_strlcpy(idx_str, arg, sizeof(idx_str));
- p = strchr(idx_str, ':');
- if (!p) {
- fprintf(stderr,
- "Invalid value '%s' for option '%s', required syntax is 'index:value'\n",
- arg, opt);
- exit_program(1);
- }
- *p++ = '\0';
- idx = parse_number_or_die(opt, idx_str, OPT_INT, 0, INT_MAX);
- streamid_map = grow_array(streamid_map, sizeof(*streamid_map), &nb_streamid_map, idx+1);
- streamid_map[idx] = parse_number_or_die(opt, p, OPT_INT, 0, INT_MAX);
- return 0;
-}
-
-static void opt_output_file(void *optctx, const char *filename)
-{
- AVFormatContext *oc;
- int err, use_video, use_audio, use_subtitle, use_data;
- int input_has_video, input_has_audio, input_has_subtitle, input_has_data;
- AVOutputFormat *file_oformat;
-
- if (!strcmp(filename, "-"))
- filename = "pipe:";
-
- oc = avformat_alloc_context();
- if (!oc) {
- print_error(filename, AVERROR(ENOMEM));
- exit_program(1);
- }
-
- if (last_asked_format) {
- file_oformat = av_guess_format(last_asked_format, NULL, NULL);
- if (!file_oformat) {
- fprintf(stderr, "Requested output format '%s' is not a suitable output format\n", last_asked_format);
- exit_program(1);
- }
- last_asked_format = NULL;
- } else {
- file_oformat = av_guess_format(NULL, filename, NULL);
- if (!file_oformat) {
- fprintf(stderr, "Unable to find a suitable output format for '%s'\n",
- filename);
- exit_program(1);
- }
- }
-
- oc->oformat = file_oformat;
- av_strlcpy(oc->filename, filename, sizeof(oc->filename));
-
- if (!strcmp(file_oformat->name, "ffm") &&
- av_strstart(filename, "http:", NULL)) {
- /* special case for files sent to avserver: we get the stream
- parameters from avserver */
- int err = read_avserver_streams(oc, filename);
- if (err < 0) {
- print_error(filename, err);
- exit_program(1);
- }
- } else {
- use_video = file_oformat->video_codec != CODEC_ID_NONE || video_stream_copy || video_codec_name;
- use_audio = file_oformat->audio_codec != CODEC_ID_NONE || audio_stream_copy || audio_codec_name;
- use_subtitle = file_oformat->subtitle_codec != CODEC_ID_NONE || subtitle_stream_copy || subtitle_codec_name;
- use_data = data_stream_copy || data_codec_name; /* XXX once generic data codec will be available add a ->data_codec reference and use it here */
-
- /* disable if no corresponding type found */
- check_inputs(&input_has_video,
- &input_has_audio,
- &input_has_subtitle,
- &input_has_data);
-
- if (!input_has_video)
- use_video = 0;
- if (!input_has_audio)
- use_audio = 0;
- if (!input_has_subtitle)
- use_subtitle = 0;
- if (!input_has_data)
- use_data = 0;
-
- /* manual disable */
- if (audio_disable) use_audio = 0;
- if (video_disable) use_video = 0;
- if (subtitle_disable) use_subtitle = 0;
- if (data_disable) use_data = 0;
-
- if (use_video) new_video_stream(oc, nb_output_files);
- if (use_audio) new_audio_stream(oc, nb_output_files);
- if (use_subtitle) new_subtitle_stream(oc, nb_output_files);
- if (use_data) new_data_stream(oc, nb_output_files);
-
- av_dict_copy(&oc->metadata, metadata, 0);
- av_dict_free(&metadata);
- }
-
- av_dict_copy(&output_opts[nb_output_files], format_opts, 0);
- output_files[nb_output_files++] = oc;
-
- /* check filename in case of an image number is expected */
- if (oc->oformat->flags & AVFMT_NEEDNUMBER) {
- if (!av_filename_number_test(oc->filename)) {
- print_error(oc->filename, AVERROR(EINVAL));
- exit_program(1);
- }
- }
-
- if (!(oc->oformat->flags & AVFMT_NOFILE)) {
- /* test if it already exists to avoid losing precious files */
- if (!file_overwrite &&
- (strchr(filename, ':') == NULL ||
- filename[1] == ':' ||
- av_strstart(filename, "file:", NULL))) {
- if (avio_check(filename, 0) == 0) {
- if (!using_stdin) {
- fprintf(stderr,"File '%s' already exists. Overwrite ? [y/N] ", filename);
- fflush(stderr);
- if (!read_yesno()) {
- fprintf(stderr, "Not overwriting - exiting\n");
- exit_program(1);
- }
- }
- else {
- fprintf(stderr,"File '%s' already exists. Exiting.\n", filename);
- exit_program(1);
- }
- }
- }
-
- /* open the file */
- if ((err = avio_open(&oc->pb, filename, AVIO_FLAG_WRITE)) < 0) {
- print_error(filename, err);
- exit_program(1);
- }
- }
-
- oc->preload= (int)(mux_preload*AV_TIME_BASE);
- oc->max_delay= (int)(mux_max_delay*AV_TIME_BASE);
- if (loop_output >= 0) {
- av_log(NULL, AV_LOG_WARNING, "-loop_output is deprecated, use -loop\n");
- oc->loop_output = loop_output;
- }
- oc->flags |= AVFMT_FLAG_NONBLOCK;
-
- frame_rate = (AVRational){0, 0};
- frame_width = 0;
- frame_height = 0;
- audio_sample_rate = 0;
- audio_channels = 0;
- audio_sample_fmt = AV_SAMPLE_FMT_NONE;
-
- av_freep(&forced_key_frames);
- uninit_opts();
- init_opts();
-}
-
-/* same option as mencoder */
-static int opt_pass(const char *opt, const char *arg)
-{
- do_pass = parse_number_or_die(opt, arg, OPT_INT, 1, 2);
- return 0;
-}
-
-static int64_t getutime(void)
-{
-#if HAVE_GETRUSAGE
- struct rusage rusage;
-
- getrusage(RUSAGE_SELF, &rusage);
- return (rusage.ru_utime.tv_sec * 1000000LL) + rusage.ru_utime.tv_usec;
-#elif HAVE_GETPROCESSTIMES
- HANDLE proc;
- FILETIME c, e, k, u;
- proc = GetCurrentProcess();
- GetProcessTimes(proc, &c, &e, &k, &u);
- return ((int64_t) u.dwHighDateTime << 32 | u.dwLowDateTime) / 10;
-#else
- return av_gettime();
-#endif
-}
-
-static int64_t getmaxrss(void)
-{
-#if HAVE_GETRUSAGE && HAVE_STRUCT_RUSAGE_RU_MAXRSS
- struct rusage rusage;
- getrusage(RUSAGE_SELF, &rusage);
- return (int64_t)rusage.ru_maxrss * 1024;
-#elif HAVE_GETPROCESSMEMORYINFO
- HANDLE proc;
- PROCESS_MEMORY_COUNTERS memcounters;
- proc = GetCurrentProcess();
- memcounters.cb = sizeof(memcounters);
- GetProcessMemoryInfo(proc, &memcounters, sizeof(memcounters));
- return memcounters.PeakPagefileUsage;
-#else
- return 0;
-#endif
-}
-
-static void parse_matrix_coeffs(uint16_t *dest, const char *str)
-{
- int i;
- const char *p = str;
- for(i = 0;; i++) {
- dest[i] = atoi(p);
- if(i == 63)
- break;
- p = strchr(p, ',');
- if(!p) {
- fprintf(stderr, "Syntax error in matrix \"%s\" at coeff %d\n", str, i);
- exit_program(1);
- }
- p++;
- }
-}
-
-static void opt_inter_matrix(const char *arg)
-{
- inter_matrix = av_mallocz(sizeof(uint16_t) * 64);
- parse_matrix_coeffs(inter_matrix, arg);
-}
-
-static void opt_intra_matrix(const char *arg)
-{
- intra_matrix = av_mallocz(sizeof(uint16_t) * 64);
- parse_matrix_coeffs(intra_matrix, arg);
-}
-
-static void show_usage(void)
-{
- printf("Hyper fast Audio and Video encoder\n");
- printf("usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...\n");
- printf("\n");
-}
-
-static void show_help(void)
-{
- AVCodec *c;
- AVOutputFormat *oformat = NULL;
- AVInputFormat *iformat = NULL;
- const AVClass *class;
-
- av_log_set_callback(log_callback_help);
- show_usage();
- show_help_options(options, "Main options:\n",
- OPT_EXPERT | OPT_AUDIO | OPT_VIDEO | OPT_SUBTITLE | OPT_GRAB, 0);
- show_help_options(options, "\nAdvanced options:\n",
- OPT_EXPERT | OPT_AUDIO | OPT_VIDEO | OPT_SUBTITLE | OPT_GRAB,
- OPT_EXPERT);
- show_help_options(options, "\nVideo options:\n",
- OPT_EXPERT | OPT_AUDIO | OPT_VIDEO | OPT_GRAB,
- OPT_VIDEO);
- show_help_options(options, "\nAdvanced Video options:\n",
- OPT_EXPERT | OPT_AUDIO | OPT_VIDEO | OPT_GRAB,
- OPT_VIDEO | OPT_EXPERT);
- show_help_options(options, "\nAudio options:\n",
- OPT_EXPERT | OPT_AUDIO | OPT_VIDEO | OPT_GRAB,
- OPT_AUDIO);
- show_help_options(options, "\nAdvanced Audio options:\n",
- OPT_EXPERT | OPT_AUDIO | OPT_VIDEO | OPT_GRAB,
- OPT_AUDIO | OPT_EXPERT);
- show_help_options(options, "\nSubtitle options:\n",
- OPT_SUBTITLE | OPT_GRAB,
- OPT_SUBTITLE);
- show_help_options(options, "\nAudio/Video grab options:\n",
- 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");
- }
- }
-
- class = sws_get_class();
- av_opt_show2(&class, NULL, AV_OPT_FLAG_ENCODING_PARAM|AV_OPT_FLAG_DECODING_PARAM, 0);
-}
-
-static int opt_target(const char *opt, const char *arg)
-{
- enum { PAL, NTSC, FILM, UNKNOWN } norm = UNKNOWN;
- static const char *const frame_rates[] = {"25", "30000/1001", "24000/1001"};
-
- if(!strncmp(arg, "pal-", 4)) {
- norm = PAL;
- arg += 4;
- } else if(!strncmp(arg, "ntsc-", 5)) {
- norm = NTSC;
- arg += 5;
- } else if(!strncmp(arg, "film-", 5)) {
- norm = FILM;
- arg += 5;
- } else {
- int fr;
- /* Calculate FR via float to avoid int overflow */
- fr = (int)(frame_rate.num * 1000.0 / frame_rate.den);
- if(fr == 25000) {
- norm = PAL;
- } else if((fr == 29970) || (fr == 23976)) {
- norm = NTSC;
- } else {
- /* Try to determine PAL/NTSC by peeking in the input files */
- if(nb_input_files) {
- int i, j;
- for (j = 0; j < nb_input_files; j++) {
- for (i = 0; i < input_files[j].ctx->nb_streams; i++) {
- AVCodecContext *c = input_files[j].ctx->streams[i]->codec;
- if(c->codec_type != AVMEDIA_TYPE_VIDEO)
- continue;
- fr = c->time_base.den * 1000 / c->time_base.num;
- if(fr == 25000) {
- norm = PAL;
- break;
- } else if((fr == 29970) || (fr == 23976)) {
- norm = NTSC;
- break;
- }
- }
- if(norm != UNKNOWN)
- break;
- }
- }
- }
- if(verbose > 0 && norm != UNKNOWN)
- fprintf(stderr, "Assuming %s for target.\n", norm == PAL ? "PAL" : "NTSC");
- }
-
- if(norm == UNKNOWN) {
- fprintf(stderr, "Could not determine norm (PAL/NTSC/NTSC-Film) for target.\n");
- fprintf(stderr, "Please prefix target with \"pal-\", \"ntsc-\" or \"film-\",\n");
- fprintf(stderr, "or set a framerate with \"-r xxx\".\n");
- exit_program(1);
- }
-
- if(!strcmp(arg, "vcd")) {
- opt_video_codec("vcodec", "mpeg1video");
- opt_audio_codec("vcodec", "mp2");
- opt_format("f", "vcd");
-
- opt_frame_size("s", norm == PAL ? "352x288" : "352x240");
- opt_frame_rate("r", frame_rates[norm]);
- opt_default("g", norm == PAL ? "15" : "18");
-
- opt_default("b", "1150000");
- opt_default("maxrate", "1150000");
- opt_default("minrate", "1150000");
- opt_default("bufsize", "327680"); // 40*1024*8;
-
- opt_default("ab", "224000");
- audio_sample_rate = 44100;
- audio_channels = 2;
-
- opt_default("packetsize", "2324");
- opt_default("muxrate", "1411200"); // 2352 * 75 * 8;
-
- /* We have to offset the PTS, so that it is consistent with the SCR.
- SCR starts at 36000, but the first two packs contain only padding
- and the first pack from the other stream, respectively, may also have
- been written before.
- So the real data starts at SCR 36000+3*1200. */
- mux_preload= (36000+3*1200) / 90000.0; //0.44
- } else if(!strcmp(arg, "svcd")) {
-
- opt_video_codec("vcodec", "mpeg2video");
- opt_audio_codec("acodec", "mp2");
- opt_format("f", "svcd");
-
- opt_frame_size("s", norm == PAL ? "480x576" : "480x480");
- opt_frame_rate("r", frame_rates[norm]);
- opt_default("g", norm == PAL ? "15" : "18");
-
- opt_default("b", "2040000");
- opt_default("maxrate", "2516000");
- opt_default("minrate", "0"); //1145000;
- opt_default("bufsize", "1835008"); //224*1024*8;
- opt_default("flags", "+scan_offset");
-
-
- opt_default("ab", "224000");
- audio_sample_rate = 44100;
-
- opt_default("packetsize", "2324");
-
- } else if(!strcmp(arg, "dvd")) {
-
- opt_video_codec("vcodec", "mpeg2video");
- opt_audio_codec("vcodec", "ac3");
- opt_format("f", "dvd");
-
- opt_frame_size("vcodec", norm == PAL ? "720x576" : "720x480");
- opt_frame_rate("r", frame_rates[norm]);
- opt_default("g", norm == PAL ? "15" : "18");
-
- opt_default("b", "6000000");
- opt_default("maxrate", "9000000");
- opt_default("minrate", "0"); //1500000;
- opt_default("bufsize", "1835008"); //224*1024*8;
-
- opt_default("packetsize", "2048"); // from www.mpucoder.com: DVD sectors contain 2048 bytes of data, this is also the size of one pack.
- opt_default("muxrate", "10080000"); // from mplex project: data_rate = 1260000. mux_rate = data_rate * 8
-
- opt_default("ab", "448000");
- audio_sample_rate = 48000;
-
- } else if(!strncmp(arg, "dv", 2)) {
-
- opt_format("f", "dv");
-
- opt_frame_size("s", norm == PAL ? "720x576" : "720x480");
- opt_frame_pix_fmt("pix_fmt", !strncmp(arg, "dv50", 4) ? "yuv422p" :
- norm == PAL ? "yuv420p" : "yuv411p");
- opt_frame_rate("r", frame_rates[norm]);
-
- audio_sample_rate = 48000;
- audio_channels = 2;
-
- } else {
- fprintf(stderr, "Unknown target: %s\n", arg);
- return AVERROR(EINVAL);
- }
- return 0;
-}
-
-static int opt_vstats_file(const char *opt, const char *arg)
-{
- av_free (vstats_filename);
- vstats_filename=av_strdup (arg);
- return 0;
-}
-
-static int opt_vstats(const char *opt, const char *arg)
-{
- char filename[40];
- time_t today2 = time(NULL);
- struct tm *today = localtime(&today2);
-
- snprintf(filename, sizeof(filename), "vstats_%02d%02d%02d.log", today->tm_hour, today->tm_min,
- today->tm_sec);
- return opt_vstats_file(opt, filename);
-}
-
-static int opt_bsf(const char *opt, const char *arg)
-{
- AVBitStreamFilterContext *bsfc= av_bitstream_filter_init(arg); //FIXME split name and args for filter at '='
- AVBitStreamFilterContext **bsfp;
-
- if(!bsfc){
- fprintf(stderr, "Unknown bitstream filter %s\n", arg);
- exit_program(1);
- }
-
- bsfp= *opt == 'v' ? &video_bitstream_filters :
- *opt == 'a' ? &audio_bitstream_filters :
- &subtitle_bitstream_filters;
- while(*bsfp)
- bsfp= &(*bsfp)->next;
-
- *bsfp= bsfc;
-
- return 0;
-}
-
-static int opt_preset(const char *opt, const char *arg)
-{
- FILE *f=NULL;
- char filename[1000], tmp[1000], tmp2[1000], line[1000];
- char *codec_name = *opt == 'v' ? video_codec_name :
- *opt == 'a' ? audio_codec_name :
- subtitle_codec_name;
-
- if (!(f = get_preset_file(filename, sizeof(filename), arg, *opt == 'f', codec_name))) {
- fprintf(stderr, "File for preset '%s' not found\n", arg);
- exit_program(1);
- }
-
- while(!feof(f)){
- int e= fscanf(f, "%999[^\n]\n", line) - 1;
- if(line[0] == '#' && !e)
- continue;
- e|= sscanf(line, "%999[^=]=%999[^\n]\n", tmp, tmp2) - 2;
- if(e){
- fprintf(stderr, "%s: Invalid syntax: '%s'\n", filename, line);
- exit_program(1);
- }
- if(!strcmp(tmp, "acodec")){
- opt_audio_codec(tmp, tmp2);
- }else if(!strcmp(tmp, "vcodec")){
- opt_video_codec(tmp, tmp2);
- }else if(!strcmp(tmp, "scodec")){
- opt_subtitle_codec(tmp, tmp2);
- }else if(!strcmp(tmp, "dcodec")){
- opt_data_codec(tmp, tmp2);
- }else if(opt_default(tmp, tmp2) < 0){
- fprintf(stderr, "%s: Invalid option or argument: '%s', parsed as '%s' = '%s'\n", filename, line, tmp, tmp2);
- exit_program(1);
- }
- }
-
- fclose(f);
-
- return 0;
-}
-
-static const OptionDef options[] = {
- /* main options */
-#include "cmdutils_common_opts.h"
- { "f", HAS_ARG, {(void*)opt_format}, "force format", "fmt" },
- { "i", HAS_ARG, {(void*)opt_input_file}, "input file name", "filename" },
- { "y", OPT_BOOL, {(void*)&file_overwrite}, "overwrite output files" },
- { "map", HAS_ARG | OPT_EXPERT, {(void*)opt_map}, "set input stream mapping", "file.stream[:syncfile.syncstream]" },
- { "map_meta_data", HAS_ARG | OPT_EXPERT, {(void*)opt_map_meta_data}, "DEPRECATED set meta data information of outfile from infile",
- "outfile[,metadata]:infile[,metadata]" },
- { "map_metadata", HAS_ARG | OPT_EXPERT, {(void*)opt_map_metadata}, "set metadata information of outfile from infile",
- "outfile[,metadata]:infile[,metadata]" },
- { "map_chapters", HAS_ARG | OPT_EXPERT, {(void*)opt_map_chapters}, "set chapters mapping", "outfile:infile" },
- { "t", HAS_ARG, {(void*)opt_recording_time}, "record or transcode \"duration\" seconds of audio/video", "duration" },
- { "fs", HAS_ARG | OPT_INT64, {(void*)&limit_filesize}, "set the limit file size in bytes", "limit_size" }, //
- { "ss", HAS_ARG, {(void*)opt_start_time}, "set the start time offset", "time_off" },
- { "itsoffset", HAS_ARG, {(void*)opt_input_ts_offset}, "set the input ts offset", "time_off" },
- { "itsscale", HAS_ARG, {(void*)opt_input_ts_scale}, "set the input ts scale", "stream:scale" },
- { "timestamp", HAS_ARG, {(void*)opt_recording_timestamp}, "set the recording timestamp ('now' to set the current time)", "time" },
- { "metadata", HAS_ARG, {(void*)opt_metadata}, "add metadata", "string=string" },
- { "dframes", OPT_INT | HAS_ARG, {(void*)&max_frames[AVMEDIA_TYPE_DATA]}, "set the number of data frames to record", "number" },
- { "benchmark", OPT_BOOL | OPT_EXPERT, {(void*)&do_benchmark},
- "add timings for benchmarking" },
- { "timelimit", HAS_ARG, {(void*)opt_timelimit}, "set max runtime in seconds", "limit" },
- { "dump", OPT_BOOL | OPT_EXPERT, {(void*)&do_pkt_dump},
- "dump each input packet" },
- { "hex", OPT_BOOL | OPT_EXPERT, {(void*)&do_hex_dump},
- "when dumping packets, also dump the payload" },
- { "re", OPT_BOOL | OPT_EXPERT, {(void*)&rate_emu}, "read input at native frame rate", "" },
- { "loop_input", OPT_BOOL | OPT_EXPERT, {(void*)&loop_input}, "deprecated, use -loop" },
- { "loop_output", HAS_ARG | OPT_INT | OPT_EXPERT, {(void*)&loop_output}, "deprecated, use -loop", "" },
- { "v", HAS_ARG, {(void*)opt_verbose}, "set ffmpeg verbosity level", "number" },
- { "target", HAS_ARG, {(void*)opt_target}, "specify target file type (\"vcd\", \"svcd\", \"dvd\", \"dv\", \"dv50\", \"pal-vcd\", \"ntsc-svcd\", ...)", "type" },
- { "threads", HAS_ARG | OPT_EXPERT, {(void*)opt_thread_count}, "thread count", "count" },
- { "vsync", HAS_ARG | OPT_INT | OPT_EXPERT, {(void*)&video_sync_method}, "video sync method", "" },
- { "async", HAS_ARG | OPT_INT | OPT_EXPERT, {(void*)&audio_sync_method}, "audio sync method", "" },
- { "adrift_threshold", HAS_ARG | OPT_FLOAT | OPT_EXPERT, {(void*)&audio_drift_threshold}, "audio drift threshold", "threshold" },
- { "copyts", OPT_BOOL | OPT_EXPERT, {(void*)&copy_ts}, "copy timestamps" },
- { "copytb", OPT_BOOL | OPT_EXPERT, {(void*)&copy_tb}, "copy input stream time base when stream copying" },
- { "shortest", OPT_BOOL | OPT_EXPERT, {(void*)&opt_shortest}, "finish encoding within shortest input" }, //
- { "dts_delta_threshold", HAS_ARG | OPT_FLOAT | OPT_EXPERT, {(void*)&dts_delta_threshold}, "timestamp discontinuity delta threshold", "threshold" },
- { "programid", HAS_ARG | OPT_INT | OPT_EXPERT, {(void*)&opt_programid}, "desired program number", "" },
- { "xerror", OPT_BOOL, {(void*)&exit_on_error}, "exit on error", "error" },
- { "copyinkf", OPT_BOOL | OPT_EXPERT, {(void*)&copy_initial_nonkeyframes}, "copy initial non-keyframes" },
-
- /* video options */
- { "vframes", OPT_INT | HAS_ARG | OPT_VIDEO, {(void*)&max_frames[AVMEDIA_TYPE_VIDEO]}, "set the number of video frames to record", "number" },
- { "r", HAS_ARG | OPT_VIDEO, {(void*)opt_frame_rate}, "set frame rate (Hz value, fraction or abbreviation)", "rate" },
- { "s", HAS_ARG | OPT_VIDEO, {(void*)opt_frame_size}, "set frame size (WxH or abbreviation)", "size" },
- { "aspect", HAS_ARG | OPT_VIDEO, {(void*)opt_frame_aspect_ratio}, "set aspect ratio (4:3, 16:9 or 1.3333, 1.7777)", "aspect" },
- { "pix_fmt", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_frame_pix_fmt}, "set pixel format, 'list' as argument shows all the pixel formats supported", "format" },
- { "croptop", HAS_ARG | OPT_VIDEO, {(void*)opt_frame_crop}, "Removed, use the crop filter instead", "size" },
- { "cropbottom", HAS_ARG | OPT_VIDEO, {(void*)opt_frame_crop}, "Removed, use the crop filter instead", "size" },
- { "cropleft", HAS_ARG | OPT_VIDEO, {(void*)opt_frame_crop}, "Removed, use the crop filter instead", "size" },
- { "cropright", HAS_ARG | OPT_VIDEO, {(void*)opt_frame_crop}, "Removed, use the crop filter instead", "size" },
- { "padtop", HAS_ARG | OPT_VIDEO, {(void*)opt_pad}, "Removed, use the pad filter instead", "size" },
- { "padbottom", HAS_ARG | OPT_VIDEO, {(void*)opt_pad}, "Removed, use the pad filter instead", "size" },
- { "padleft", HAS_ARG | OPT_VIDEO, {(void*)opt_pad}, "Removed, use the pad filter instead", "size" },
- { "padright", HAS_ARG | OPT_VIDEO, {(void*)opt_pad}, "Removed, use the pad filter instead", "size" },
- { "padcolor", HAS_ARG | OPT_VIDEO, {(void*)opt_pad}, "Removed, use the pad filter instead", "color" },
- { "intra", OPT_BOOL | OPT_EXPERT | OPT_VIDEO, {(void*)&intra_only}, "use only intra frames"},
- { "vn", OPT_BOOL | OPT_VIDEO, {(void*)&video_disable}, "disable video" },
- { "vdt", OPT_INT | HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)&video_discard}, "discard threshold", "n" },
- { "qscale", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_qscale}, "use fixed video quantizer scale (VBR)", "q" },
- { "rc_override", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_video_rc_override_string}, "rate control override for specific intervals", "override" },
- { "vcodec", HAS_ARG | OPT_VIDEO, {(void*)opt_video_codec}, "force video codec ('copy' to copy stream)", "codec" },
- { "me_threshold", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_me_threshold}, "motion estimaton threshold", "threshold" },
- { "sameq", OPT_BOOL | OPT_VIDEO, {(void*)&same_quality},
- "use same quantizer as source (implies VBR)" },
- { "pass", HAS_ARG | OPT_VIDEO, {(void*)opt_pass}, "select the pass number (1 or 2)", "n" },
- { "passlogfile", HAS_ARG | OPT_STRING | OPT_VIDEO, {(void*)&pass_logfilename_prefix}, "select two pass log file name prefix", "prefix" },
- { "deinterlace", OPT_BOOL | OPT_EXPERT | OPT_VIDEO, {(void*)&do_deinterlace},
- "deinterlace pictures" },
- { "psnr", OPT_BOOL | OPT_EXPERT | OPT_VIDEO, {(void*)&do_psnr}, "calculate PSNR of compressed frames" },
- { "vstats", OPT_EXPERT | OPT_VIDEO, {(void*)&opt_vstats}, "dump video coding statistics to file" },
- { "vstats_file", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_vstats_file}, "dump video coding statistics to file", "file" },
-#if CONFIG_AVFILTER
- { "vf", OPT_STRING | HAS_ARG, {(void*)&vfilters}, "video filters", "filter list" },
-#endif
- { "intra_matrix", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_intra_matrix}, "specify intra matrix coeffs", "matrix" },
- { "inter_matrix", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_inter_matrix}, "specify inter matrix coeffs", "matrix" },
- { "top", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_top_field_first}, "top=1/bottom=0/auto=-1 field first", "" },
- { "dc", OPT_INT | HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)&intra_dc_precision}, "intra_dc_precision", "precision" },
- { "vtag", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_codec_tag}, "force video tag/fourcc", "fourcc/tag" },
- { "newvideo", OPT_VIDEO, {(void*)opt_new_stream}, "add a new video stream to the current output stream" },
- { "vlang", HAS_ARG | OPT_STRING | OPT_VIDEO, {(void *)&video_language}, "set the ISO 639 language code (3 letters) of the current video stream" , "code" },
- { "qphist", OPT_BOOL | OPT_EXPERT | OPT_VIDEO, { (void *)&qp_hist }, "show QP histogram" },
- { "force_fps", OPT_BOOL | OPT_EXPERT | OPT_VIDEO, {(void*)&force_fps}, "force the selected framerate, disable the best supported framerate selection" },
- { "streamid", HAS_ARG | OPT_EXPERT, {(void*)opt_streamid}, "set the value of an outfile streamid", "streamIndex:value" },
- { "force_key_frames", OPT_STRING | HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void *)&forced_key_frames}, "force key frames at specified timestamps", "timestamps" },
-
- /* audio options */
- { "aframes", OPT_INT | HAS_ARG | OPT_AUDIO, {(void*)&max_frames[AVMEDIA_TYPE_AUDIO]}, "set the number of audio frames to record", "number" },
- { "aq", OPT_FLOAT | HAS_ARG | OPT_AUDIO, {(void*)&audio_qscale}, "set audio quality (codec-specific)", "quality", },
- { "ar", HAS_ARG | OPT_AUDIO, {(void*)opt_audio_rate}, "set audio sampling rate (in Hz)", "rate" },
- { "ac", HAS_ARG | OPT_AUDIO, {(void*)opt_audio_channels}, "set number of audio channels", "channels" },
- { "an", OPT_BOOL | OPT_AUDIO, {(void*)&audio_disable}, "disable audio" },
- { "acodec", HAS_ARG | OPT_AUDIO, {(void*)opt_audio_codec}, "force audio codec ('copy' to copy stream)", "codec" },
- { "atag", HAS_ARG | OPT_EXPERT | OPT_AUDIO, {(void*)opt_codec_tag}, "force audio tag/fourcc", "fourcc/tag" },
- { "vol", OPT_INT | HAS_ARG | OPT_AUDIO, {(void*)&audio_volume}, "change audio volume (256=normal)" , "volume" }, //
- { "newaudio", OPT_AUDIO, {(void*)opt_new_stream}, "add a new audio stream to the current output stream" },
- { "alang", HAS_ARG | OPT_STRING | OPT_AUDIO, {(void *)&audio_language}, "set the ISO 639 language code (3 letters) of the current audio stream" , "code" },
- { "sample_fmt", HAS_ARG | OPT_EXPERT | OPT_AUDIO, {(void*)opt_audio_sample_fmt}, "set sample format, 'list' as argument shows all the sample formats supported", "format" },
-
- /* subtitle options */
- { "sn", OPT_BOOL | OPT_SUBTITLE, {(void*)&subtitle_disable}, "disable subtitle" },
- { "scodec", HAS_ARG | OPT_SUBTITLE, {(void*)opt_subtitle_codec}, "force subtitle codec ('copy' to copy stream)", "codec" },
- { "newsubtitle", OPT_SUBTITLE, {(void*)opt_new_stream}, "add a new subtitle stream to the current output stream" },
- { "slang", HAS_ARG | OPT_STRING | OPT_SUBTITLE, {(void *)&subtitle_language}, "set the ISO 639 language code (3 letters) of the current subtitle stream" , "code" },
- { "stag", HAS_ARG | OPT_EXPERT | OPT_SUBTITLE, {(void*)opt_codec_tag}, "force subtitle tag/fourcc", "fourcc/tag" },
-
- /* grab options */
- { "vc", HAS_ARG | OPT_EXPERT | OPT_VIDEO | OPT_GRAB, {(void*)opt_video_channel}, "deprecated, use -channel", "channel" },
- { "tvstd", HAS_ARG | OPT_EXPERT | OPT_VIDEO | OPT_GRAB, {(void*)opt_video_standard}, "deprecated, use -standard", "standard" },
- { "isync", OPT_BOOL | OPT_EXPERT | OPT_GRAB, {(void*)&input_sync}, "sync read on input", "" },
-
- /* muxer options */
- { "muxdelay", OPT_FLOAT | HAS_ARG | OPT_EXPERT, {(void*)&mux_max_delay}, "set the maximum demux-decode delay", "seconds" },
- { "muxpreload", OPT_FLOAT | HAS_ARG | OPT_EXPERT, {(void*)&mux_preload}, "set the initial demux-decode delay", "seconds" },
-
- { "absf", HAS_ARG | OPT_AUDIO | OPT_EXPERT, {(void*)opt_bsf}, "", "bitstream_filter" },
- { "vbsf", HAS_ARG | OPT_VIDEO | OPT_EXPERT, {(void*)opt_bsf}, "", "bitstream_filter" },
- { "sbsf", HAS_ARG | OPT_SUBTITLE | OPT_EXPERT, {(void*)opt_bsf}, "", "bitstream_filter" },
-
- { "apre", HAS_ARG | OPT_AUDIO | OPT_EXPERT, {(void*)opt_preset}, "set the audio options to the indicated preset", "preset" },
- { "vpre", HAS_ARG | OPT_VIDEO | OPT_EXPERT, {(void*)opt_preset}, "set the video options to the indicated preset", "preset" },
- { "spre", HAS_ARG | OPT_SUBTITLE | OPT_EXPERT, {(void*)opt_preset}, "set the subtitle options to the indicated preset", "preset" },
- { "fpre", HAS_ARG | OPT_EXPERT, {(void*)opt_preset}, "set options from indicated preset file", "filename" },
- /* data codec support */
- { "dcodec", HAS_ARG | OPT_DATA, {(void*)opt_data_codec}, "force data codec ('copy' to copy stream)", "codec" },
-
- { "default", HAS_ARG | OPT_AUDIO | OPT_VIDEO | OPT_EXPERT, {(void*)opt_default}, "generic catch all option", "" },
- { NULL, },
-};
-
-int main(int argc, char **argv)
-{
- int64_t ti;
-
- av_log_set_flags(AV_LOG_SKIP_REPEATED);
- parse_loglevel(argc, argv, options);
-
- avcodec_register_all();
-#if CONFIG_AVDEVICE
- avdevice_register_all();
-#endif
-#if CONFIG_AVFILTER
- avfilter_register_all();
-#endif
- av_register_all();
- avformat_network_init();
-
- avio_set_interrupt_cb(decode_interrupt_cb);
-
- init_opts();
-
- show_banner();
-
- av_log(NULL, AV_LOG_WARNING, "This program is not developed anymore and is only "
- "provided for compatibility. Use avconv instead "
- "(see Changelog for the list of incompatible changes).\n");
-
- /* parse options */
- parse_options(NULL, argc, argv, options, opt_output_file);
-
- if(nb_output_files <= 0 && nb_input_files == 0) {
- show_usage();
- fprintf(stderr, "Use -h to get full help or, even better, run 'man ffmpeg'\n");
- exit_program(1);
- }
-
- /* file converter / grab */
- if (nb_output_files <= 0) {
- fprintf(stderr, "At least one output file must be specified\n");
- exit_program(1);
- }
-
- if (nb_input_files == 0) {
- fprintf(stderr, "At least one input file must be specified\n");
- exit_program(1);
- }
-
- ti = getutime();
- if (transcode(output_files, nb_output_files, input_files, nb_input_files,
- stream_maps, nb_stream_maps) < 0)
- exit_program(1);
- ti = getutime() - ti;
- if (do_benchmark) {
- int maxrss = getmaxrss() / 1024;
- printf("bench: utime=%0.3fs maxrss=%ikB\n", ti / 1000000.0, maxrss);
- }
-
- exit_program(0);
- return 0;
-}
diff --git a/gst-libs/ext/libav/libavcodec/4xm.c b/gst-libs/ext/libav/libavcodec/4xm.c
index 77d15d5..99e0e2e 100644
--- a/gst-libs/ext/libav/libavcodec/4xm.c
+++ b/gst-libs/ext/libav/libavcodec/4xm.c
@@ -26,9 +26,10 @@
#include "libavutil/intreadwrite.h"
#include "avcodec.h"
+#include "bytestream.h"
#include "dsputil.h"
#include "get_bits.h"
-#include "bytestream.h"
+#include "internal.h"
//#undef NDEBUG
//#include <assert.h>
@@ -38,95 +39,96 @@
#define CFRAME_BUFFER_COUNT 100
-static const uint8_t block_type_tab[2][4][8][2]={
- {
- { //{8,4,2}x{8,4,2}
- { 0,1}, { 2,2}, { 6,3}, {14,4}, {30,5}, {31,5}, { 0,0}
- },{ //{8,4}x1
- { 0,1}, { 0,0}, { 2,2}, { 6,3}, {14,4}, {15,4}, { 0,0}
- },{ //1x{8,4}
- { 0,1}, { 2,2}, { 0,0}, { 6,3}, {14,4}, {15,4}, { 0,0}
- },{ //1x2, 2x1
- { 0,1}, { 0,0}, { 0,0}, { 2,2}, { 6,3}, {14,4}, {15,4}
- }
- },{
- { //{8,4,2}x{8,4,2}
- { 1,2}, { 4,3}, { 5,3}, {0,2}, {6,3}, {7,3}, {0,0}
- },{//{8,4}x1
- { 1,2}, { 0,0}, { 2,2}, {0,2}, {6,3}, {7,3}, {0,0}
- },{//1x{8,4}
- { 1,2}, { 2,2}, { 0,0}, {0,2}, {6,3}, {7,3}, {0,0}
- },{//1x2, 2x1
- { 1,2}, { 0,0}, { 0,0}, {0,2}, {2,2}, {6,3}, {7,3}
- }
- }
+static const uint8_t block_type_tab[2][4][8][2] = {
+ {
+ { // { 8, 4, 2 } x { 8, 4, 2}
+ { 0, 1 }, { 2, 2 }, { 6, 3 }, { 14, 4 }, { 30, 5 }, { 31, 5 }, { 0, 0 }
+ }, { // { 8, 4 } x 1
+ { 0, 1 }, { 0, 0 }, { 2, 2 }, { 6, 3 }, { 14, 4 }, { 15, 4 }, { 0, 0 }
+ }, { // 1 x { 8, 4 }
+ { 0, 1 }, { 2, 2 }, { 0, 0 }, { 6, 3 }, { 14, 4 }, { 15, 4 }, { 0, 0 }
+ }, { // 1 x 2, 2 x 1
+ { 0, 1 }, { 0, 0 }, { 0, 0 }, { 2, 2 }, { 6, 3 }, { 14, 4 }, { 15, 4 }
+ }
+ }, {
+ { // { 8, 4, 2 } x { 8, 4, 2}
+ { 1, 2 }, { 4, 3 }, { 5, 3 }, { 0, 2 }, { 6, 3 }, { 7, 3 }, { 0, 0 }
+ }, {// { 8, 4 } x 1
+ { 1, 2 }, { 0, 0 }, { 2, 2 }, { 0, 2 }, { 6, 3 }, { 7, 3 }, { 0, 0 }
+ }, {// 1 x { 8, 4 }
+ { 1, 2 }, { 2, 2 }, { 0, 0 }, { 0, 2 }, { 6, 3 }, { 7, 3 }, { 0, 0 }
+ }, {// 1 x 2, 2 x 1
+ { 1, 2 }, { 0, 0 }, { 0, 0 }, { 0, 2 }, { 2, 2 }, { 6, 3 }, { 7, 3 }
+ }
+ }
};
-static const uint8_t size2index[4][4]={
- {-1, 3, 1, 1},
- { 3, 0, 0, 0},
- { 2, 0, 0, 0},
- { 2, 0, 0, 0},
+static const uint8_t size2index[4][4] = {
+ { -1, 3, 1, 1 },
+ { 3, 0, 0, 0 },
+ { 2, 0, 0, 0 },
+ { 2, 0, 0, 0 },
};
-static const int8_t mv[256][2]={
-{ 0, 0},{ 0, -1},{ -1, 0},{ 1, 0},{ 0, 1},{ -1, -1},{ 1, -1},{ -1, 1},
-{ 1, 1},{ 0, -2},{ -2, 0},{ 2, 0},{ 0, 2},{ -1, -2},{ 1, -2},{ -2, -1},
-{ 2, -1},{ -2, 1},{ 2, 1},{ -1, 2},{ 1, 2},{ -2, -2},{ 2, -2},{ -2, 2},
-{ 2, 2},{ 0, -3},{ -3, 0},{ 3, 0},{ 0, 3},{ -1, -3},{ 1, -3},{ -3, -1},
-{ 3, -1},{ -3, 1},{ 3, 1},{ -1, 3},{ 1, 3},{ -2, -3},{ 2, -3},{ -3, -2},
-{ 3, -2},{ -3, 2},{ 3, 2},{ -2, 3},{ 2, 3},{ 0, -4},{ -4, 0},{ 4, 0},
-{ 0, 4},{ -1, -4},{ 1, -4},{ -4, -1},{ 4, -1},{ 4, 1},{ -1, 4},{ 1, 4},
-{ -3, -3},{ -3, 3},{ 3, 3},{ -2, -4},{ -4, -2},{ 4, -2},{ -4, 2},{ -2, 4},
-{ 2, 4},{ -3, -4},{ 3, -4},{ 4, -3},{ -5, 0},{ -4, 3},{ -3, 4},{ 3, 4},
-{ -1, -5},{ -5, -1},{ -5, 1},{ -1, 5},{ -2, -5},{ 2, -5},{ 5, -2},{ 5, 2},
-{ -4, -4},{ -4, 4},{ -3, -5},{ -5, -3},{ -5, 3},{ 3, 5},{ -6, 0},{ 0, 6},
-{ -6, -1},{ -6, 1},{ 1, 6},{ 2, -6},{ -6, 2},{ 2, 6},{ -5, -4},{ 5, 4},
-{ 4, 5},{ -6, -3},{ 6, 3},{ -7, 0},{ -1, -7},{ 5, -5},{ -7, 1},{ -1, 7},
-{ 4, -6},{ 6, 4},{ -2, -7},{ -7, 2},{ -3, -7},{ 7, -3},{ 3, 7},{ 6, -5},
-{ 0, -8},{ -1, -8},{ -7, -4},{ -8, 1},{ 4, 7},{ 2, -8},{ -2, 8},{ 6, 6},
-{ -8, 3},{ 5, -7},{ -5, 7},{ 8, -4},{ 0, -9},{ -9, -1},{ 1, 9},{ 7, -6},
-{ -7, 6},{ -5, -8},{ -5, 8},{ -9, 3},{ 9, -4},{ 7, -7},{ 8, -6},{ 6, 8},
-{ 10, 1},{-10, 2},{ 9, -5},{ 10, -3},{ -8, -7},{-10, -4},{ 6, -9},{-11, 0},
-{ 11, 1},{-11, -2},{ -2, 11},{ 7, -9},{ -7, 9},{ 10, 6},{ -4, 11},{ 8, -9},
-{ 8, 9},{ 5, 11},{ 7,-10},{ 12, -3},{ 11, 6},{ -9, -9},{ 8, 10},{ 5, 12},
-{-11, 7},{ 13, 2},{ 6,-12},{ 10, 9},{-11, 8},{ -7, 12},{ 0, 14},{ 14, -2},
-{ -9, 11},{ -6, 13},{-14, -4},{ -5,-14},{ 5, 14},{-15, -1},{-14, -6},{ 3,-15},
-{ 11,-11},{ -7, 14},{ -5, 15},{ 8,-14},{ 15, 6},{ 3, 16},{ 7,-15},{-16, 5},
-{ 0, 17},{-16, -6},{-10, 14},{-16, 7},{ 12, 13},{-16, 8},{-17, 6},{-18, 3},
-{ -7, 17},{ 15, 11},{ 16, 10},{ 2,-19},{ 3,-19},{-11,-16},{-18, 8},{-19, -6},
-{ 2,-20},{-17,-11},{-10,-18},{ 8, 19},{-21, -1},{-20, 7},{ -4, 21},{ 21, 5},
-{ 15, 16},{ 2,-22},{-10,-20},{-22, 5},{ 20,-11},{ -7,-22},{-12, 20},{ 23, -5},
-{ 13,-20},{ 24, -2},{-15, 19},{-11, 22},{ 16, 19},{ 23,-10},{-18,-18},{ -9,-24},
-{ 24,-10},{ -3, 26},{-23, 13},{-18,-20},{ 17, 21},{ -4, 27},{ 27, 6},{ 1,-28},
-{-11, 26},{-17,-23},{ 7, 28},{ 11,-27},{ 29, 5},{-23,-19},{-28,-11},{-21, 22},
-{-30, 7},{-17, 26},{-27, 16},{ 13, 29},{ 19,-26},{ 10,-31},{-14,-30},{ 20,-27},
-{-29, 18},{-16,-31},{-28,-22},{ 21,-30},{-25, 28},{ 26,-29},{ 25,-32},{-32,-32}
+static const int8_t mv[256][2] = {
+ { 0, 0 }, { 0, -1 }, { -1, 0 }, { 1, 0 }, { 0, 1 }, { -1, -1 }, { 1, -1 }, { -1, 1 },
+ { 1, 1 }, { 0, -2 }, { -2, 0 }, { 2, 0 }, { 0, 2 }, { -1, -2 }, { 1, -2 }, { -2, -1 },
+ { 2, -1 }, { -2, 1 }, { 2, 1 }, { -1, 2 }, { 1, 2 }, { -2, -2 }, { 2, -2 }, { -2, 2 },
+ { 2, 2 }, { 0, -3 }, { -3, 0 }, { 3, 0 }, { 0, 3 }, { -1, -3 }, { 1, -3 }, { -3, -1 },
+ { 3, -1 }, { -3, 1 }, { 3, 1 }, { -1, 3 }, { 1, 3 }, { -2, -3 }, { 2, -3 }, { -3, -2 },
+ { 3, -2 }, { -3, 2 }, { 3, 2 }, { -2, 3 }, { 2, 3 }, { 0, -4 }, { -4, 0 }, { 4, 0 },
+ { 0, 4 }, { -1, -4 }, { 1, -4 }, { -4, -1 }, { 4, -1 }, { 4, 1 }, { -1, 4 }, { 1, 4 },
+ { -3, -3 }, { -3, 3 }, { 3, 3 }, { -2, -4 }, { -4, -2 }, { 4, -2 }, { -4, 2 }, { -2, 4 },
+ { 2, 4 }, { -3, -4 }, { 3, -4 }, { 4, -3 }, { -5, 0 }, { -4, 3 }, { -3, 4 }, { 3, 4 },
+ { -1, -5 }, { -5, -1 }, { -5, 1 }, { -1, 5 }, { -2, -5 }, { 2, -5 }, { 5, -2 }, { 5, 2 },
+ { -4, -4 }, { -4, 4 }, { -3, -5 }, { -5, -3 }, { -5, 3 }, { 3, 5 }, { -6, 0 }, { 0, 6 },
+ { -6, -1 }, { -6, 1 }, { 1, 6 }, { 2, -6 }, { -6, 2 }, { 2, 6 }, { -5, -4 }, { 5, 4 },
+ { 4, 5 }, { -6, -3 }, { 6, 3 }, { -7, 0 }, { -1, -7 }, { 5, -5 }, { -7, 1 }, { -1, 7 },
+ { 4, -6 }, { 6, 4 }, { -2, -7 }, { -7, 2 }, { -3, -7 }, { 7, -3 }, { 3, 7 }, { 6, -5 },
+ { 0, -8 }, { -1, -8 }, { -7, -4 }, { -8, 1 }, { 4, 7 }, { 2, -8 }, { -2, 8 }, { 6, 6 },
+ { -8, 3 }, { 5, -7 }, { -5, 7 }, { 8, -4 }, { 0, -9 }, { -9, -1 }, { 1, 9 }, { 7, -6 },
+ { -7, 6 }, { -5, -8 }, { -5, 8 }, { -9, 3 }, { 9, -4 }, { 7, -7 }, { 8, -6 }, { 6, 8 },
+ { 10, 1 }, { -10, 2 }, { 9, -5 }, { 10, -3 }, { -8, -7 }, { -10, -4 }, { 6, -9 }, { -11, 0 },
+ { 11, 1 }, { -11, -2 }, { -2, 11 }, { 7, -9 }, { -7, 9 }, { 10, 6 }, { -4, 11 }, { 8, -9 },
+ { 8, 9 }, { 5, 11 }, { 7, -10 }, { 12, -3 }, { 11, 6 }, { -9, -9 }, { 8, 10 }, { 5, 12 },
+ { -11, 7 }, { 13, 2 }, { 6, -12 }, { 10, 9 }, { -11, 8 }, { -7, 12 }, { 0, 14 }, { 14, -2 },
+ { -9, 11 }, { -6, 13 }, { -14, -4 }, { -5, -14 }, { 5, 14 }, { -15, -1 }, { -14, -6 }, { 3, -15 },
+ { 11, -11 }, { -7, 14 }, { -5, 15 }, { 8, -14 }, { 15, 6 }, { 3, 16 }, { 7, -15 }, { -16, 5 },
+ { 0, 17 }, { -16, -6 }, { -10, 14 }, { -16, 7 }, { 12, 13 }, { -16, 8 }, { -17, 6 }, { -18, 3 },
+ { -7, 17 }, { 15, 11 }, { 16, 10 }, { 2, -19 }, { 3, -19 }, { -11, -16 }, { -18, 8 }, { -19, -6 },
+ { 2, -20 }, { -17, -11 }, { -10, -18 }, { 8, 19 }, { -21, -1 }, { -20, 7 }, { -4, 21 }, { 21, 5 },
+ { 15, 16 }, { 2, -22 }, { -10, -20 }, { -22, 5 }, { 20, -11 }, { -7, -22 }, { -12, 20 }, { 23, -5 },
+ { 13, -20 }, { 24, -2 }, { -15, 19 }, { -11, 22 }, { 16, 19 }, { 23, -10 }, { -18, -18 }, { -9, -24 },
+ { 24, -10 }, { -3, 26 }, { -23, 13 }, { -18, -20 }, { 17, 21 }, { -4, 27 }, { 27, 6 }, { 1, -28 },
+ { -11, 26 }, { -17, -23 }, { 7, 28 }, { 11, -27 }, { 29, 5 }, { -23, -19 }, { -28, -11 }, { -21, 22 },
+ { -30, 7 }, { -17, 26 }, { -27, 16 }, { 13, 29 }, { 19, -26 }, { 10, -31 }, { -14, -30 }, { 20, -27 },
+ { -29, 18 }, { -16, -31 }, { -28, -22 }, { 21, -30 }, { -25, 28 }, { 26, -29 }, { 25, -32 }, { -32, -32 }
};
-// this is simply the scaled down elementwise product of the standard jpeg quantizer table and the AAN premul table
-static const uint8_t dequant_table[64]={
- 16, 15, 13, 19, 24, 31, 28, 17,
- 17, 23, 25, 31, 36, 63, 45, 21,
- 18, 24, 27, 37, 52, 59, 49, 20,
- 16, 28, 34, 40, 60, 80, 51, 20,
- 18, 31, 48, 66, 68, 86, 56, 21,
- 19, 38, 56, 59, 64, 64, 48, 20,
- 27, 48, 55, 55, 56, 51, 35, 15,
- 20, 35, 34, 32, 31, 22, 15, 8,
+/* This is simply the scaled down elementwise product of the standard JPEG
+ * quantizer table and the AAN premul table. */
+static const uint8_t dequant_table[64] = {
+ 16, 15, 13, 19, 24, 31, 28, 17,
+ 17, 23, 25, 31, 36, 63, 45, 21,
+ 18, 24, 27, 37, 52, 59, 49, 20,
+ 16, 28, 34, 40, 60, 80, 51, 20,
+ 18, 31, 48, 66, 68, 86, 56, 21,
+ 19, 38, 56, 59, 64, 64, 48, 20,
+ 27, 48, 55, 55, 56, 51, 35, 15,
+ 20, 35, 34, 32, 31, 22, 15, 8,
};
static VLC block_type_vlc[2][4];
-typedef struct CFrameBuffer{
+typedef struct CFrameBuffer {
unsigned int allocated_size;
unsigned int size;
int id;
uint8_t *data;
-}CFrameBuffer;
+} CFrameBuffer;
-typedef struct FourXContext{
+typedef struct FourXContext {
AVCodecContext *avctx;
DSPContext dsp;
AVFrame current_picture, last_picture;
@@ -150,54 +152,55 @@ typedef struct FourXContext{
#define FIX_1_847759065 121095
#define FIX_2_613125930 171254
-#define MULTIPLY(var,const) (((var)*(const)) >> 16)
+#define MULTIPLY(var, const) (((var) * (const)) >> 16)
-static void idct(DCTELEM block[64]){
+static void idct(DCTELEM block[64])
+{
int tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
int tmp10, tmp11, tmp12, tmp13;
int z5, z10, z11, z12, z13;
int i;
int temp[64];
- for(i=0; i<8; i++){
- tmp10 = block[8*0 + i] + block[8*4 + i];
- tmp11 = block[8*0 + i] - block[8*4 + i];
+ for (i = 0; i < 8; i++) {
+ tmp10 = block[8 * 0 + i] + block[8 * 4 + i];
+ tmp11 = block[8 * 0 + i] - block[8 * 4 + i];
- tmp13 = block[8*2 + i] + block[8*6 + i];
- tmp12 = MULTIPLY(block[8*2 + i] - block[8*6 + i], FIX_1_414213562) - tmp13;
+ tmp13 = block[8 * 2 + i] + block[8 * 6 + i];
+ tmp12 = MULTIPLY(block[8 * 2 + i] - block[8 * 6 + i], FIX_1_414213562) - tmp13;
tmp0 = tmp10 + tmp13;
tmp3 = tmp10 - tmp13;
tmp1 = tmp11 + tmp12;
tmp2 = tmp11 - tmp12;
- z13 = block[8*5 + i] + block[8*3 + i];
- z10 = block[8*5 + i] - block[8*3 + i];
- z11 = block[8*1 + i] + block[8*7 + i];
- z12 = block[8*1 + i] - block[8*7 + i];
+ z13 = block[8 * 5 + i] + block[8 * 3 + i];
+ z10 = block[8 * 5 + i] - block[8 * 3 + i];
+ z11 = block[8 * 1 + i] + block[8 * 7 + i];
+ z12 = block[8 * 1 + i] - block[8 * 7 + i];
tmp7 = z11 + z13;
tmp11 = MULTIPLY(z11 - z13, FIX_1_414213562);
z5 = MULTIPLY(z10 + z12, FIX_1_847759065);
- tmp10 = MULTIPLY(z12, FIX_1_082392200) - z5;
- tmp12 = MULTIPLY(z10, - FIX_2_613125930) + z5;
+ tmp10 = MULTIPLY(z12, FIX_1_082392200) - z5;
+ tmp12 = MULTIPLY(z10, -FIX_2_613125930) + z5;
tmp6 = tmp12 - tmp7;
tmp5 = tmp11 - tmp6;
tmp4 = tmp10 + tmp5;
- temp[8*0 + i] = tmp0 + tmp7;
- temp[8*7 + i] = tmp0 - tmp7;
- temp[8*1 + i] = tmp1 + tmp6;
- temp[8*6 + i] = tmp1 - tmp6;
- temp[8*2 + i] = tmp2 + tmp5;
- temp[8*5 + i] = tmp2 - tmp5;
- temp[8*4 + i] = tmp3 + tmp4;
- temp[8*3 + i] = tmp3 - tmp4;
+ temp[8 * 0 + i] = tmp0 + tmp7;
+ temp[8 * 7 + i] = tmp0 - tmp7;
+ temp[8 * 1 + i] = tmp1 + tmp6;
+ temp[8 * 6 + i] = tmp1 - tmp6;
+ temp[8 * 2 + i] = tmp2 + tmp5;
+ temp[8 * 5 + i] = tmp2 - tmp5;
+ temp[8 * 4 + i] = tmp3 + tmp4;
+ temp[8 * 3 + i] = tmp3 - tmp4;
}
- for(i=0; i<8*8; i+=8){
+ for (i = 0; i < 8 * 8; i += 8) {
tmp10 = temp[0 + i] + temp[4 + i];
tmp11 = temp[0 + i] - temp[4 + i];
@@ -214,215 +217,261 @@ static void idct(DCTELEM block[64]){
z11 = temp[1 + i] + temp[7 + i];
z12 = temp[1 + i] - temp[7 + i];
- tmp7 = z11 + z13;
+ tmp7 = z11 + z13;
tmp11 = MULTIPLY(z11 - z13, FIX_1_414213562);
- z5 = MULTIPLY(z10 + z12, FIX_1_847759065);
- tmp10 = MULTIPLY(z12, FIX_1_082392200) - z5;
- tmp12 = MULTIPLY(z10, - FIX_2_613125930) + z5;
+ z5 = MULTIPLY(z10 + z12, FIX_1_847759065);
+ tmp10 = MULTIPLY(z12, FIX_1_082392200) - z5;
+ tmp12 = MULTIPLY(z10, -FIX_2_613125930) + z5;
tmp6 = tmp12 - tmp7;
tmp5 = tmp11 - tmp6;
tmp4 = tmp10 + tmp5;
- block[0 + i] = (tmp0 + tmp7)>>6;
- block[7 + i] = (tmp0 - tmp7)>>6;
- block[1 + i] = (tmp1 + tmp6)>>6;
- block[6 + i] = (tmp1 - tmp6)>>6;
- block[2 + i] = (tmp2 + tmp5)>>6;
- block[5 + i] = (tmp2 - tmp5)>>6;
- block[4 + i] = (tmp3 + tmp4)>>6;
- block[3 + i] = (tmp3 - tmp4)>>6;
+ block[0 + i] = (tmp0 + tmp7) >> 6;
+ block[7 + i] = (tmp0 - tmp7) >> 6;
+ block[1 + i] = (tmp1 + tmp6) >> 6;
+ block[6 + i] = (tmp1 - tmp6) >> 6;
+ block[2 + i] = (tmp2 + tmp5) >> 6;
+ block[5 + i] = (tmp2 - tmp5) >> 6;
+ block[4 + i] = (tmp3 + tmp4) >> 6;
+ block[3 + i] = (tmp3 - tmp4) >> 6;
}
}
-static av_cold void init_vlcs(FourXContext *f){
- static VLC_TYPE table[8][32][2];
- int i;
-
- for(i=0; i<8; i++){
- block_type_vlc[0][i].table= table[i];
- block_type_vlc[0][i].table_allocated= 32;
- init_vlc(&block_type_vlc[0][i], BLOCK_TYPE_VLC_BITS, 7,
- &block_type_tab[0][i][0][1], 2, 1,
- &block_type_tab[0][i][0][0], 2, 1, INIT_VLC_USE_NEW_STATIC);
+static av_cold void init_vlcs(FourXContext *f)
+{
+ static VLC_TYPE table[2][4][32][2];
+ int i, j;
+
+ for (i = 0; i < 2; i++) {
+ for (j = 0; j < 4; j++) {
+ block_type_vlc[i][j].table = table[i][j];
+ block_type_vlc[i][j].table_allocated = 32;
+ init_vlc(&block_type_vlc[i][j], BLOCK_TYPE_VLC_BITS, 7,
+ &block_type_tab[i][j][0][1], 2, 1,
+ &block_type_tab[i][j][0][0], 2, 1,
+ INIT_VLC_USE_NEW_STATIC);
+ }
}
}
-static void init_mv(FourXContext *f){
+static void init_mv(FourXContext *f)
+{
int i;
- for(i=0; i<256; i++){
- if(f->version>1)
- f->mv[i] = mv[i][0] + mv[i][1] *f->current_picture.linesize[0]/2;
+ for (i = 0; i < 256; i++) {
+ if (f->version > 1)
+ f->mv[i] = mv[i][0] + mv[i][1] * f->current_picture.linesize[0] / 2;
else
- f->mv[i] = (i&15) - 8 + ((i>>4)-8)*f->current_picture.linesize[0]/2;
+ f->mv[i] = (i & 15) - 8 + ((i >> 4) - 8) * f->current_picture.linesize[0] / 2;
}
}
#if HAVE_BIGENDIAN
-#define LE_CENTRIC_MUL(dst, src, scale, dc) \
- { \
+#define LE_CENTRIC_MUL(dst, src, scale, dc) \
+ { \
unsigned tmpval = AV_RN32(src); \
- tmpval = (tmpval << 16) | (tmpval >> 16); \
+ tmpval = (tmpval << 16) | (tmpval >> 16); \
tmpval = tmpval * (scale) + (dc); \
- tmpval = (tmpval << 16) | (tmpval >> 16); \
+ tmpval = (tmpval << 16) | (tmpval >> 16); \
AV_WN32A(dst, tmpval); \
}
#else
-#define LE_CENTRIC_MUL(dst, src, scale, dc) \
- { \
+#define LE_CENTRIC_MUL(dst, src, scale, dc) \
+ { \
unsigned tmpval = AV_RN32(src) * (scale) + (dc); \
AV_WN32A(dst, tmpval); \
}
#endif
-static inline void mcdc(uint16_t *dst, uint16_t *src, int log2w, int h, int stride, int scale, unsigned dc){
- int i;
- dc*= 0x10001;
-
- switch(log2w){
- case 0:
- for(i=0; i<h; i++){
- dst[0] = scale*src[0] + dc;
- if(scale) src += stride;
+static inline void mcdc(uint16_t *dst, uint16_t *src, int log2w,
+ int h, int stride, int scale, unsigned dc)
+{
+ int i;
+ dc *= 0x10001;
+
+ switch (log2w) {
+ case 0:
+ for (i = 0; i < h; i++) {
+ dst[0] = scale * src[0] + dc;
+ if (scale)
+ src += stride;
dst += stride;
}
break;
case 1:
- for(i=0; i<h; i++){
+ for (i = 0; i < h; i++) {
LE_CENTRIC_MUL(dst, src, scale, dc);
- if(scale) src += stride;
+ if (scale)
+ src += stride;
dst += stride;
}
break;
case 2:
- for(i=0; i<h; i++){
- LE_CENTRIC_MUL(dst, src, scale, dc);
+ for (i = 0; i < h; i++) {
+ LE_CENTRIC_MUL(dst, src, scale, dc);
LE_CENTRIC_MUL(dst + 2, src + 2, scale, dc);
- if(scale) src += stride;
+ if (scale)
+ src += stride;
dst += stride;
}
break;
case 3:
- for(i=0; i<h; i++){
+ for (i = 0; i < h; i++) {
LE_CENTRIC_MUL(dst, src, scale, dc);
LE_CENTRIC_MUL(dst + 2, src + 2, scale, dc);
LE_CENTRIC_MUL(dst + 4, src + 4, scale, dc);
LE_CENTRIC_MUL(dst + 6, src + 6, scale, dc);
- if(scale) src += stride;
+ if (scale)
+ src += stride;
dst += stride;
}
break;
- default: assert(0);
+ default:
+ break;
}
}
-static void decode_p_block(FourXContext *f, uint16_t *dst, uint16_t *src, int log2w, int log2h, int stride){
- const int index= size2index[log2h][log2w];
- const int h= 1<<log2h;
- int code= get_vlc2(&f->gb, block_type_vlc[1-(f->version>1)][index].table, BLOCK_TYPE_VLC_BITS, 1);
- uint16_t *start= (uint16_t*)f->last_picture.data[0];
- uint16_t *end= start + stride*(f->avctx->height-h+1) - (1<<log2w);
-
- assert(code>=0 && code<=6);
+static int decode_p_block(FourXContext *f, uint16_t *dst, uint16_t *src,
+ int log2w, int log2h, int stride)
+{
+ const int index = size2index[log2h][log2w];
+ const int h = 1 << log2h;
+ int code = get_vlc2(&f->gb,
+ block_type_vlc[1 - (f->version > 1)][index].table,
+ BLOCK_TYPE_VLC_BITS, 1);
+ uint16_t *start = (uint16_t *)f->last_picture.data[0];
+ uint16_t *end = start + stride * (f->avctx->height - h + 1) - (1 << log2w);
+ int ret;
+
+ if (code < 0 || code > 6 || log2w < 0)
+ return AVERROR_INVALIDDATA;
- if(code == 0){
+ if (code == 0) {
src += f->mv[bytestream2_get_byte(&f->g)];
- if(start > src || src > end){
+ if (start > src || src > end) {
av_log(f->avctx, AV_LOG_ERROR, "mv out of pic\n");
- return;
+ return AVERROR_INVALIDDATA;
}
mcdc(dst, src, log2w, h, stride, 1, 0);
- }else if(code == 1){
+ } else if (code == 1) {
log2h--;
- decode_p_block(f, dst , src , log2w, log2h, stride);
- decode_p_block(f, dst + (stride<<log2h), src + (stride<<log2h), log2w, log2h, stride);
- }else if(code == 2){
+ if ((ret = decode_p_block(f, dst, src, log2w, log2h, stride)) < 0)
+ return ret;
+ if ((ret = decode_p_block(f, dst + (stride << log2h),
+ src + (stride << log2h),
+ log2w, log2h, stride)) < 0)
+ return ret;
+ } else if (code == 2) {
log2w--;
- decode_p_block(f, dst , src , log2w, log2h, stride);
- decode_p_block(f, dst + (1<<log2w), src + (1<<log2w), log2w, log2h, stride);
- }else if(code == 3 && f->version<2){
+ if ((ret = decode_p_block(f, dst , src, log2w, log2h, stride)) < 0)
+ return ret;
+ if ((ret = decode_p_block(f, dst + (1 << log2w),
+ src + (1 << log2w),
+ log2w, log2h, stride)) < 0)
+ return ret;
+ } else if (code == 3 && f->version < 2) {
if (start > src || src > end) {
av_log(f->avctx, AV_LOG_ERROR, "mv out of pic\n");
- return;
+ return AVERROR_INVALIDDATA;
}
mcdc(dst, src, log2w, h, stride, 1, 0);
- }else if(code == 4){
+ } else if (code == 4) {
src += f->mv[bytestream2_get_byte(&f->g)];
- if(start > src || src > end){
+ if (start > src || src > end) {
av_log(f->avctx, AV_LOG_ERROR, "mv out of pic\n");
- return;
+ return AVERROR_INVALIDDATA;
}
mcdc(dst, src, log2w, h, stride, 1, bytestream2_get_le16(&f->g2));
- }else if(code == 5){
+ } else if (code == 5) {
if (start > src || src > end) {
av_log(f->avctx, AV_LOG_ERROR, "mv out of pic\n");
- return;
+ return AVERROR_INVALIDDATA;
}
mcdc(dst, src, log2w, h, stride, 0, bytestream2_get_le16(&f->g2));
- }else if(code == 6){
- if(log2w){
- dst[0] = bytestream2_get_le16(&f->g2);
- dst[1] = bytestream2_get_le16(&f->g2);
- }else{
- dst[0 ] = bytestream2_get_le16(&f->g2);
+ } else if (code == 6) {
+ if (log2w) {
+ dst[0] = bytestream2_get_le16(&f->g2);
+ dst[1] = bytestream2_get_le16(&f->g2);
+ } else {
+ dst[0] = bytestream2_get_le16(&f->g2);
dst[stride] = bytestream2_get_le16(&f->g2);
}
}
+ return 0;
}
-static int decode_p_frame(FourXContext *f, const uint8_t *buf, int length){
+static int decode_p_frame(FourXContext *f, const uint8_t *buf, int length)
+{
int x, y;
- const int width= f->avctx->width;
- const int height= f->avctx->height;
- uint16_t *src= (uint16_t*)f->last_picture.data[0];
- uint16_t *dst= (uint16_t*)f->current_picture.data[0];
- const int stride= f->current_picture.linesize[0]>>1;
- unsigned int bitstream_size, bytestream_size, wordstream_size, extra, bytestream_offset, wordstream_offset;
-
- if(f->version>1){
- extra=20;
- bitstream_size= AV_RL32(buf+8);
- wordstream_size= AV_RL32(buf+12);
- bytestream_size= AV_RL32(buf+16);
- }else{
- extra=0;
- bitstream_size = AV_RL16(buf-4);
- wordstream_size= AV_RL16(buf-2);
- bytestream_size= FFMAX(length - bitstream_size - wordstream_size, 0);
- }
-
- if(bitstream_size+ bytestream_size+ wordstream_size + extra != length
- || bitstream_size > (1<<26)
- || bytestream_size > (1<<26)
- || wordstream_size > (1<<26)
- ){
- av_log(f->avctx, AV_LOG_ERROR, "lengths %d %d %d %d\n", bitstream_size, bytestream_size, wordstream_size,
- bitstream_size+ bytestream_size+ wordstream_size - length);
+ const int width = f->avctx->width;
+ const int height = f->avctx->height;
+ uint16_t *src = (uint16_t *)f->last_picture.data[0];
+ uint16_t *dst = (uint16_t *)f->current_picture.data[0];
+ const int stride = f->current_picture.linesize[0] >> 1;
+ unsigned int bitstream_size, bytestream_size, wordstream_size, extra,
+ bytestream_offset, wordstream_offset;
+ int ret;
+
+ if (!f->last_picture.data[0]) {
+ if ((ret = ff_get_buffer(f->avctx, &f->last_picture)) < 0) {
+ av_log(f->avctx, AV_LOG_ERROR, "get_buffer() failed\n");
+ return ret;
+ }
+ memset(f->last_picture.data[0], 0,
+ f->avctx->height * FFABS(f->last_picture.linesize[0]));
+ }
+
+ if (f->version > 1) {
+ if (length < 20)
+ return AVERROR_INVALIDDATA;
+ extra = 20;
+ bitstream_size = AV_RL32(buf + 8);
+ wordstream_size = AV_RL32(buf + 12);
+ bytestream_size = AV_RL32(buf + 16);
+ } else {
+ extra = 0;
+ bitstream_size = AV_RL16(buf - 4);
+ wordstream_size = AV_RL16(buf - 2);
+ bytestream_size = FFMAX(length - bitstream_size - wordstream_size, 0);
+ }
+
+ if (bitstream_size + bytestream_size + wordstream_size + extra != length
+ || bitstream_size > (1 << 26)
+ || bytestream_size > (1 << 26)
+ || wordstream_size > (1 << 26)) {
+ av_log(f->avctx, AV_LOG_ERROR, "lengths %d %d %d %d\n",
+ bitstream_size, bytestream_size, wordstream_size,
+ bitstream_size + bytestream_size + wordstream_size - length);
return -1;
}
- av_fast_malloc(&f->bitstream_buffer, &f->bitstream_buffer_size, bitstream_size + FF_INPUT_BUFFER_PADDING_SIZE);
+ av_fast_malloc(&f->bitstream_buffer, &f->bitstream_buffer_size,
+ bitstream_size + FF_INPUT_BUFFER_PADDING_SIZE);
if (!f->bitstream_buffer)
return AVERROR(ENOMEM);
- f->dsp.bswap_buf(f->bitstream_buffer, (const uint32_t*)(buf + extra), bitstream_size/4);
- memset((uint8_t*)f->bitstream_buffer + bitstream_size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
- init_get_bits(&f->gb, f->bitstream_buffer, 8*bitstream_size);
+ f->dsp.bswap_buf(f->bitstream_buffer, (const uint32_t*)(buf + extra),
+ bitstream_size / 4);
+ memset((uint8_t*)f->bitstream_buffer + bitstream_size,
+ 0, FF_INPUT_BUFFER_PADDING_SIZE);
+ init_get_bits(&f->gb, f->bitstream_buffer, 8 * bitstream_size);
wordstream_offset = extra + bitstream_size;
bytestream_offset = extra + bitstream_size + wordstream_size;
- bytestream2_init(&f->g2, buf + wordstream_offset, length - wordstream_offset);
- bytestream2_init(&f->g, buf + bytestream_offset, length - bytestream_offset);
+ bytestream2_init(&f->g2, buf + wordstream_offset,
+ length - wordstream_offset);
+ bytestream2_init(&f->g, buf + bytestream_offset,
+ length - bytestream_offset);
init_mv(f);
- for(y=0; y<height; y+=8){
- for(x=0; x<width; x+=8){
- decode_p_block(f, dst + x, src + x, 3, 3, stride);
- }
- src += 8*stride;
- dst += 8*stride;
+ for (y = 0; y < height; y += 8) {
+ for (x = 0; x < width; x += 8)
+ if ((ret = decode_p_block(f, dst + x, src + x, 3, 3, stride)) < 0)
+ return ret;
+ src += 8 * stride;
+ dst += 8 * stride;
}
return 0;
@@ -432,24 +481,23 @@ static int decode_p_frame(FourXContext *f, const uint8_t *buf, int length){
* decode block and dequantize.
* Note this is almost identical to MJPEG.
*/
-static int decode_i_block(FourXContext *f, DCTELEM *block){
+static int decode_i_block(FourXContext *f, DCTELEM *block)
+{
int code, i, j, level, val;
/* DC coef */
val = get_vlc2(&f->pre_gb, f->pre_vlc.table, ACDC_VLC_BITS, 3);
- if (val>>4){
+ if (val >> 4)
av_log(f->avctx, AV_LOG_ERROR, "error dc run != 0\n");
- }
- if(val)
+ if (val)
val = get_xbits(&f->gb, val);
- val = val * dequant_table[0] + f->last_dc;
- f->last_dc =
- block[0] = val;
+ val = val * dequant_table[0] + f->last_dc;
+ f->last_dc = block[0] = val;
/* AC coefs */
i = 1;
- for(;;) {
+ for (;;) {
code = get_vlc2(&f->pre_gb, f->pre_vlc.table, ACDC_VLC_BITS, 3);
/* EOB */
@@ -459,13 +507,13 @@ static int decode_i_block(FourXContext *f, DCTELEM *block){
i += 16;
} else {
level = get_xbits(&f->gb, code & 0xf);
- i += code >> 4;
+ i += code >> 4;
if (i >= 64) {
av_log(f->avctx, AV_LOG_ERROR, "run %d oveflow\n", i);
return 0;
}
- j= ff_zigzag_direct[i];
+ j = ff_zigzag_direct[i];
block[j] = level * dequant_table[j];
i++;
if (i >= 64)
@@ -476,185 +524,206 @@ static int decode_i_block(FourXContext *f, DCTELEM *block){
return 0;
}
-static inline void idct_put(FourXContext *f, int x, int y){
- DCTELEM (*block)[64]= f->block;
- int stride= f->current_picture.linesize[0]>>1;
+static inline void idct_put(FourXContext *f, int x, int y)
+{
+ DCTELEM (*block)[64] = f->block;
+ int stride = f->current_picture.linesize[0] >> 1;
int i;
uint16_t *dst = ((uint16_t*)f->current_picture.data[0]) + y * stride + x;
- for(i=0; i<4; i++){
- block[i][0] += 0x80*8*8;
+ for (i = 0; i < 4; i++) {
+ block[i][0] += 0x80 * 8 * 8;
idct(block[i]);
}
- if(!(f->avctx->flags&CODEC_FLAG_GRAY)){
- for(i=4; i<6; i++) idct(block[i]);
+ if (!(f->avctx->flags & CODEC_FLAG_GRAY)) {
+ for (i = 4; i < 6; i++)
+ idct(block[i]);
}
-/* Note transform is:
-y= ( 1b + 4g + 2r)/14
-cb=( 3b - 2g - 1r)/14
-cr=(-1b - 4g + 5r)/14
-*/
- for(y=0; y<8; y++){
- for(x=0; x<8; x++){
- DCTELEM *temp= block[(x>>2) + 2*(y>>2)] + 2*(x&3) + 2*8*(y&3); //FIXME optimize
- int cb= block[4][x + 8*y];
- int cr= block[5][x + 8*y];
- int cg= (cb + cr)>>1;
+ /* Note transform is:
+ * y = ( 1b + 4g + 2r) / 14
+ * cb = ( 3b - 2g - 1r) / 14
+ * cr = (-1b - 4g + 5r) / 14 */
+ for (y = 0; y < 8; y++) {
+ for (x = 0; x < 8; x++) {
+ DCTELEM *temp = block[(x >> 2) + 2 * (y >> 2)] +
+ 2 * (x & 3) + 2 * 8 * (y & 3); // FIXME optimize
+ int cb = block[4][x + 8 * y];
+ int cr = block[5][x + 8 * y];
+ int cg = (cb + cr) >> 1;
int y;
- cb+=cb;
-
- y = temp[0];
- dst[0 ]= ((y+cb)>>3) + (((y-cg)&0xFC)<<3) + (((y+cr)&0xF8)<<8);
- y = temp[1];
- dst[1 ]= ((y+cb)>>3) + (((y-cg)&0xFC)<<3) + (((y+cr)&0xF8)<<8);
- y = temp[8];
- dst[ stride]= ((y+cb)>>3) + (((y-cg)&0xFC)<<3) + (((y+cr)&0xF8)<<8);
- y = temp[9];
- dst[1+stride]= ((y+cb)>>3) + (((y-cg)&0xFC)<<3) + (((y+cr)&0xF8)<<8);
- dst += 2;
+ cb += cb;
+
+ y = temp[0];
+ dst[0] = ((y + cb) >> 3) + (((y - cg) & 0xFC) << 3) + (((y + cr) & 0xF8) << 8);
+ y = temp[1];
+ dst[1] = ((y + cb) >> 3) + (((y - cg) & 0xFC) << 3) + (((y + cr) & 0xF8) << 8);
+ y = temp[8];
+ dst[stride] = ((y + cb) >> 3) + (((y - cg) & 0xFC) << 3) + (((y + cr) & 0xF8) << 8);
+ y = temp[9];
+ dst[1 + stride] = ((y + cb) >> 3) + (((y - cg) & 0xFC) << 3) + (((y + cr) & 0xF8) << 8);
+ dst += 2;
}
- dst += 2*stride - 2*8;
+ dst += 2 * stride - 2 * 8;
}
}
-static int decode_i_mb(FourXContext *f){
+static int decode_i_mb(FourXContext *f)
+{
int i;
f->dsp.clear_blocks(f->block[0]);
- for(i=0; i<6; i++){
- if(decode_i_block(f, f->block[i]) < 0)
+ for (i = 0; i < 6; i++)
+ if (decode_i_block(f, f->block[i]) < 0)
return -1;
- }
return 0;
}
-static const uint8_t *read_huffman_tables(FourXContext *f, const uint8_t * const buf){
- int frequency[512];
+static const uint8_t *read_huffman_tables(FourXContext *f,
+ const uint8_t * const buf,
+ int len)
+{
+ int frequency[512] = { 0 };
uint8_t flag[512];
int up[512];
uint8_t len_tab[257];
int bits_tab[257];
int start, end;
- const uint8_t *ptr= buf;
+ const uint8_t *ptr = buf;
int j;
- memset(frequency, 0, sizeof(frequency));
memset(up, -1, sizeof(up));
- start= *ptr++;
- end= *ptr++;
- for(;;){
+ start = *ptr++;
+ end = *ptr++;
+ for (;;) {
int i;
- for(i=start; i<=end; i++){
- frequency[i]= *ptr++;
- }
- start= *ptr++;
- if(start==0) break;
+ len -= end - start + 1;
+
+ if (end < start || len < 0)
+ return NULL;
+
+ for (i = start; i <= end; i++)
+ frequency[i] = *ptr++;
+ start = *ptr++;
+ if (start == 0)
+ break;
+
+ if (--len < 0)
+ return NULL;
- end= *ptr++;
+ end = *ptr++;
}
- frequency[256]=1;
+ frequency[256] = 1;
- while((ptr - buf)&3) ptr++; // 4byte align
+ while ((ptr - buf) & 3)
+ ptr++; // 4byte align
- for(j=257; j<512; j++){
- int min_freq[2]= {256*256, 256*256};
- int smallest[2]= {0, 0};
+ for (j = 257; j < 512; j++) {
+ int min_freq[2] = { 256 * 256, 256 * 256 };
+ int smallest[2] = { 0, 0 };
int i;
- for(i=0; i<j; i++){
- if(frequency[i] == 0) continue;
- if(frequency[i] < min_freq[1]){
- if(frequency[i] < min_freq[0]){
- min_freq[1]= min_freq[0]; smallest[1]= smallest[0];
- min_freq[0]= frequency[i];smallest[0]= i;
- }else{
- min_freq[1]= frequency[i];smallest[1]= i;
+ for (i = 0; i < j; i++) {
+ if (frequency[i] == 0)
+ continue;
+ if (frequency[i] < min_freq[1]) {
+ if (frequency[i] < min_freq[0]) {
+ min_freq[1] = min_freq[0];
+ smallest[1] = smallest[0];
+ min_freq[0] = frequency[i];
+ smallest[0] = i;
+ } else {
+ min_freq[1] = frequency[i];
+ smallest[1] = i;
}
}
}
- if(min_freq[1] == 256*256) break;
+ if (min_freq[1] == 256 * 256)
+ break;
- frequency[j]= min_freq[0] + min_freq[1];
- flag[ smallest[0] ]= 0;
- flag[ smallest[1] ]= 1;
- up[ smallest[0] ]=
- up[ smallest[1] ]= j;
- frequency[ smallest[0] ]= frequency[ smallest[1] ]= 0;
+ frequency[j] = min_freq[0] + min_freq[1];
+ flag[smallest[0]] = 0;
+ flag[smallest[1]] = 1;
+ up[smallest[0]] =
+ up[smallest[1]] = j;
+ frequency[smallest[0]] = frequency[smallest[1]] = 0;
}
- for(j=0; j<257; j++){
- int node;
- int len=0;
- int bits=0;
+ for (j = 0; j < 257; j++) {
+ int node, len = 0, bits = 0;
- for(node= j; up[node] != -1; node= up[node]){
- bits += flag[node]<<len;
+ for (node = j; up[node] != -1; node = up[node]) {
+ bits += flag[node] << len;
len++;
- if(len > 31) av_log(f->avctx, AV_LOG_ERROR, "vlc length overflow\n"); //can this happen at all ?
+ if (len > 31)
+ // can this happen at all ?
+ av_log(f->avctx, AV_LOG_ERROR,
+ "vlc length overflow\n");
}
- bits_tab[j]= bits;
- len_tab[j]= len;
+ bits_tab[j] = bits;
+ len_tab[j] = len;
}
- if (init_vlc(&f->pre_vlc, ACDC_VLC_BITS, 257,
- len_tab , 1, 1,
+ if (init_vlc(&f->pre_vlc, ACDC_VLC_BITS, 257, len_tab, 1, 1,
bits_tab, 4, 4, 0))
return NULL;
return ptr;
}
-static int mix(int c0, int c1){
- int blue = 2*(c0&0x001F) + (c1&0x001F);
- int green= (2*(c0&0x03E0) + (c1&0x03E0))>>5;
- int red = 2*(c0>>10) + (c1>>10);
- return red/3*1024 + green/3*32 + blue/3;
+static int mix(int c0, int c1)
+{
+ int blue = 2 * (c0 & 0x001F) + (c1 & 0x001F);
+ int green = (2 * (c0 & 0x03E0) + (c1 & 0x03E0)) >> 5;
+ int red = 2 * (c0 >> 10) + (c1 >> 10);
+ return red / 3 * 1024 + green / 3 * 32 + blue / 3;
}
-static int decode_i2_frame(FourXContext *f, const uint8_t *buf, int length){
+static int decode_i2_frame(FourXContext *f, const uint8_t *buf, int length)
+{
int x, y, x2, y2;
- const int width= f->avctx->width;
- const int height= f->avctx->height;
- const int mbs = (FFALIGN(width, 16) >> 4) * (FFALIGN(height, 16) >> 4);
- uint16_t *dst= (uint16_t*)f->current_picture.data[0];
- const int stride= f->current_picture.linesize[0]>>1;
+ const int width = f->avctx->width;
+ const int height = f->avctx->height;
+ const int mbs = (FFALIGN(width, 16) >> 4) * (FFALIGN(height, 16) >> 4);
+ uint16_t *dst = (uint16_t*)f->current_picture.data[0];
+ const int stride = f->current_picture.linesize[0]>>1;
GetByteContext g3;
- if(length < mbs * 8) {
+ if (length < mbs * 8) {
av_log(f->avctx, AV_LOG_ERROR, "packet size too small\n");
return AVERROR_INVALIDDATA;
}
bytestream2_init(&g3, buf, length);
- for(y=0; y<height; y+=16){
- for(x=0; x<width; x+=16){
- unsigned int color[4], bits;
- memset(color, 0, sizeof(color));
-//warning following is purely guessed ...
- color[0]= bytestream2_get_le16u(&g3);
- color[1]= bytestream2_get_le16u(&g3);
-
- if(color[0]&0x8000) av_log(f->avctx, AV_LOG_ERROR, "unk bit 1\n");
- if(color[1]&0x8000) av_log(f->avctx, AV_LOG_ERROR, "unk bit 2\n");
-
- color[2]= mix(color[0], color[1]);
- color[3]= mix(color[1], color[0]);
-
- bits= bytestream2_get_le32u(&g3);
- for(y2=0; y2<16; y2++){
- for(x2=0; x2<16; x2++){
- int index= 2*(x2>>2) + 8*(y2>>2);
- dst[y2*stride+x2]= color[(bits>>index)&3];
+ for (y = 0; y < height; y += 16) {
+ for (x = 0; x < width; x += 16) {
+ unsigned int color[4] = { 0 }, bits;
+ // warning following is purely guessed ...
+ color[0] = bytestream2_get_le16u(&g3);
+ color[1] = bytestream2_get_le16u(&g3);
+
+ if (color[0] & 0x8000)
+ av_log(f->avctx, AV_LOG_ERROR, "unk bit 1\n");
+ if (color[1] & 0x8000)
+ av_log(f->avctx, AV_LOG_ERROR, "unk bit 2\n");
+
+ color[2] = mix(color[0], color[1]);
+ color[3] = mix(color[1], color[0]);
+
+ bits = bytestream2_get_le32u(&g3);
+ for (y2 = 0; y2 < 16; y2++) {
+ for (x2 = 0; x2 < 16; x2++) {
+ int index = 2 * (x2 >> 2) + 8 * (y2 >> 2);
+ dst[y2 * stride + x2] = color[(bits >> index) & 3];
}
}
- dst+=16;
+ dst += 16;
}
dst += 16 * stride - x;
}
@@ -662,11 +731,12 @@ static int decode_i2_frame(FourXContext *f, const uint8_t *buf, int length){
return 0;
}
-static int decode_i_frame(FourXContext *f, const uint8_t *buf, int length){
+static int decode_i_frame(FourXContext *f, const uint8_t *buf, int length)
+{
int x, y;
- const int width= f->avctx->width;
- const int height= f->avctx->height;
- const unsigned int bitstream_size= AV_RL32(buf);
+ const int width = f->avctx->width;
+ const int height = f->avctx->height;
+ const unsigned int bitstream_size = AV_RL32(buf);
int token_count av_unused;
unsigned int prestream_size;
const uint8_t *prestream;
@@ -679,167 +749,180 @@ static int decode_i_frame(FourXContext *f, const uint8_t *buf, int length){
return AVERROR_INVALIDDATA;
}
- token_count = AV_RL32(buf + bitstream_size + 8);
+ token_count = AV_RL32(buf + bitstream_size + 8);
prestream_size = 4 * AV_RL32(buf + bitstream_size + 4);
- prestream = buf + bitstream_size + 12;
+ prestream = buf + bitstream_size + 12;
- if(prestream_size + bitstream_size + 12 != length
- || prestream_size > (1<<26)){
- av_log(f->avctx, AV_LOG_ERROR, "size mismatch %d %d %d\n", prestream_size, bitstream_size, length);
+ if (prestream_size + bitstream_size + 12 != length
+ || prestream_size > (1 << 26)) {
+ av_log(f->avctx, AV_LOG_ERROR, "size mismatch %d %d %d\n",
+ prestream_size, bitstream_size, length);
return -1;
}
- prestream = read_huffman_tables(f, prestream);
+ prestream = read_huffman_tables(f, prestream, prestream_size);
if (!prestream) {
av_log(f->avctx, AV_LOG_ERROR, "Error reading Huffman tables.\n");
return AVERROR_INVALIDDATA;
}
- init_get_bits(&f->gb, buf + 4, 8*bitstream_size);
+ init_get_bits(&f->gb, buf + 4, 8 * bitstream_size);
- prestream_size= length + buf - prestream;
+ prestream_size = length + buf - prestream;
- av_fast_malloc(&f->bitstream_buffer, &f->bitstream_buffer_size, prestream_size + FF_INPUT_BUFFER_PADDING_SIZE);
+ av_fast_malloc(&f->bitstream_buffer, &f->bitstream_buffer_size,
+ prestream_size + FF_INPUT_BUFFER_PADDING_SIZE);
if (!f->bitstream_buffer)
return AVERROR(ENOMEM);
- f->dsp.bswap_buf(f->bitstream_buffer, (const uint32_t*)prestream, prestream_size/4);
- memset((uint8_t*)f->bitstream_buffer + prestream_size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
- init_get_bits(&f->pre_gb, f->bitstream_buffer, 8*prestream_size);
+ f->dsp.bswap_buf(f->bitstream_buffer, (const uint32_t*)prestream,
+ prestream_size / 4);
+ memset((uint8_t*)f->bitstream_buffer + prestream_size,
+ 0, FF_INPUT_BUFFER_PADDING_SIZE);
+ init_get_bits(&f->pre_gb, f->bitstream_buffer, 8 * prestream_size);
- f->last_dc= 0*128*8*8;
+ f->last_dc = 0 * 128 * 8 * 8;
- for(y=0; y<height; y+=16){
- for(x=0; x<width; x+=16){
- if(decode_i_mb(f) < 0)
+ for (y = 0; y < height; y += 16) {
+ for (x = 0; x < width; x += 16) {
+ if (decode_i_mb(f) < 0)
return -1;
idct_put(f, x, y);
}
}
- if(get_vlc2(&f->pre_gb, f->pre_vlc.table, ACDC_VLC_BITS, 3) != 256)
+ if (get_vlc2(&f->pre_gb, f->pre_vlc.table, ACDC_VLC_BITS, 3) != 256)
av_log(f->avctx, AV_LOG_ERROR, "end mismatch\n");
return 0;
}
-static int decode_frame(AVCodecContext *avctx,
- void *data, int *data_size,
- AVPacket *avpkt)
+static int decode_frame(AVCodecContext *avctx, void *data,
+ int *got_frame, AVPacket *avpkt)
{
- const uint8_t *buf = avpkt->data;
- int buf_size = avpkt->size;
- FourXContext * const f = avctx->priv_data;
- AVFrame *picture = data;
+ const uint8_t *buf = avpkt->data;
+ int buf_size = avpkt->size;
+ FourXContext *const f = avctx->priv_data;
+ AVFrame *picture = data;
AVFrame *p, temp;
int i, frame_4cc, frame_size;
- frame_4cc= AV_RL32(buf);
- if(buf_size != AV_RL32(buf+4)+8 || buf_size < 20){
- av_log(f->avctx, AV_LOG_ERROR, "size mismatch %d %d\n", buf_size, AV_RL32(buf+4));
+ if (buf_size < 20)
+ return AVERROR_INVALIDDATA;
+
+ if (buf_size < AV_RL32(buf + 4) + 8) {
+ av_log(f->avctx, AV_LOG_ERROR, "size mismatch %d %d\n",
+ buf_size, AV_RL32(buf + 4));
+ return AVERROR_INVALIDDATA;
}
- if(frame_4cc == AV_RL32("cfrm")){
- int free_index=-1;
- const int data_size= buf_size - 20;
- const int id= AV_RL32(buf+12);
- const int whole_size= AV_RL32(buf+16);
+ frame_4cc = AV_RL32(buf);
+
+ if (frame_4cc == AV_RL32("cfrm")) {
+ int free_index = -1;
+ int id, whole_size;
+ const int data_size = buf_size - 20;
CFrameBuffer *cfrm;
- for(i=0; i<CFRAME_BUFFER_COUNT; i++){
- if(f->cfrm[i].id && f->cfrm[i].id < avctx->frame_number)
- av_log(f->avctx, AV_LOG_ERROR, "lost c frame %d\n", f->cfrm[i].id);
- }
+ if (data_size < 0)
+ return AVERROR_INVALIDDATA;
+
+ id = AV_RL32(buf + 12);
+ whole_size = AV_RL32(buf + 16);
- for(i=0; i<CFRAME_BUFFER_COUNT; i++){
- if(f->cfrm[i].id == id) break;
- if(f->cfrm[i].size == 0 ) free_index= i;
+ for (i = 0; i < CFRAME_BUFFER_COUNT; i++)
+ if (f->cfrm[i].id && f->cfrm[i].id < avctx->frame_number)
+ av_log(f->avctx, AV_LOG_ERROR, "lost c frame %d\n",
+ f->cfrm[i].id);
+
+ for (i = 0; i < CFRAME_BUFFER_COUNT; i++) {
+ if (f->cfrm[i].id == id)
+ break;
+ if (f->cfrm[i].size == 0)
+ free_index = i;
}
- if(i>=CFRAME_BUFFER_COUNT){
- i= free_index;
- f->cfrm[i].id= id;
+ if (i >= CFRAME_BUFFER_COUNT) {
+ i = free_index;
+ f->cfrm[i].id = id;
}
- cfrm= &f->cfrm[i];
+ cfrm = &f->cfrm[i];
- cfrm->data= av_fast_realloc(cfrm->data, &cfrm->allocated_size, cfrm->size + data_size + FF_INPUT_BUFFER_PADDING_SIZE);
- if(!cfrm->data){ //explicit check needed as memcpy below might not catch a NULL
- av_log(f->avctx, AV_LOG_ERROR, "realloc falure");
+ cfrm->data = av_fast_realloc(cfrm->data, &cfrm->allocated_size,
+ cfrm->size + data_size + FF_INPUT_BUFFER_PADDING_SIZE);
+ // explicit check needed as memcpy below might not catch a NULL
+ if (!cfrm->data) {
+ av_log(f->avctx, AV_LOG_ERROR, "realloc failure");
return -1;
}
- memcpy(cfrm->data + cfrm->size, buf+20, data_size);
+ memcpy(cfrm->data + cfrm->size, buf + 20, data_size);
cfrm->size += data_size;
- if(cfrm->size >= whole_size){
- buf= cfrm->data;
- frame_size= cfrm->size;
+ if (cfrm->size >= whole_size) {
+ buf = cfrm->data;
+ frame_size = cfrm->size;
- if(id != avctx->frame_number){
- av_log(f->avctx, AV_LOG_ERROR, "cframe id mismatch %d %d\n", id, avctx->frame_number);
- }
+ if (id != avctx->frame_number)
+ av_log(f->avctx, AV_LOG_ERROR, "cframe id mismatch %d %d\n",
+ id, avctx->frame_number);
if (f->version <= 1)
return AVERROR_INVALIDDATA;
- cfrm->size= cfrm->id= 0;
- frame_4cc= AV_RL32("pfrm");
- }else
+ cfrm->size = cfrm->id = 0;
+ frame_4cc = AV_RL32("pfrm");
+ } else
return buf_size;
- }else{
- buf= buf + 12;
- frame_size= buf_size - 12;
+ } else {
+ buf = buf + 12;
+ frame_size = buf_size - 12;
}
- temp= f->current_picture;
- f->current_picture= f->last_picture;
- f->last_picture= temp;
+ temp = f->current_picture;
+ f->current_picture = f->last_picture;
+ f->last_picture = temp;
- p= &f->current_picture;
- avctx->coded_frame= p;
+ p = &f->current_picture;
+ avctx->coded_frame = p;
- avctx->flags |= CODEC_FLAG_EMU_EDGE; // alternatively we would have to use our own buffer management
+ // alternatively we would have to use our own buffer management
+ avctx->flags |= CODEC_FLAG_EMU_EDGE;
- if(p->data[0])
+ if (p->data[0])
avctx->release_buffer(avctx, p);
- p->reference= 1;
- if(avctx->get_buffer(avctx, p) < 0){
+ p->reference = 1;
+ if (ff_get_buffer(avctx, p) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return -1;
}
- if(frame_4cc == AV_RL32("ifr2")){
- p->pict_type= AV_PICTURE_TYPE_I;
- if(decode_i2_frame(f, buf-4, frame_size + 4) < 0)
+ if (frame_4cc == AV_RL32("ifr2")) {
+ p->pict_type = AV_PICTURE_TYPE_I;
+ if (decode_i2_frame(f, buf - 4, frame_size + 4) < 0)
return -1;
- }else if(frame_4cc == AV_RL32("ifrm")){
- p->pict_type= AV_PICTURE_TYPE_I;
- if(decode_i_frame(f, buf, frame_size) < 0)
+ } else if (frame_4cc == AV_RL32("ifrm")) {
+ p->pict_type = AV_PICTURE_TYPE_I;
+ if (decode_i_frame(f, buf, frame_size) < 0)
return -1;
- }else if(frame_4cc == AV_RL32("pfrm") || frame_4cc == AV_RL32("pfr2")){
- if(!f->last_picture.data[0]){
- f->last_picture.reference= 1;
- if(avctx->get_buffer(avctx, &f->last_picture) < 0){
- av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
- return -1;
- }
- memset(f->last_picture.data[0], 0, avctx->height * FFABS(f->last_picture.linesize[0]));
- }
+ } else if (frame_4cc == AV_RL32("pfrm") || frame_4cc == AV_RL32("pfr2")) {
- p->pict_type= AV_PICTURE_TYPE_P;
- if(decode_p_frame(f, buf, frame_size) < 0)
+ p->pict_type = AV_PICTURE_TYPE_P;
+ if (decode_p_frame(f, buf, frame_size) < 0)
return -1;
- }else if(frame_4cc == AV_RL32("snd_")){
- av_log(avctx, AV_LOG_ERROR, "ignoring snd_ chunk length:%d\n", buf_size);
- }else{
- av_log(avctx, AV_LOG_ERROR, "ignoring unknown chunk length:%d\n", buf_size);
+ } else if (frame_4cc == AV_RL32("snd_")) {
+ av_log(avctx, AV_LOG_ERROR, "ignoring snd_ chunk length:%d\n",
+ buf_size);
+ } else {
+ av_log(avctx, AV_LOG_ERROR, "ignoring unknown chunk length:%d\n",
+ buf_size);
}
- p->key_frame= p->pict_type == AV_PICTURE_TYPE_I;
+ p->key_frame = p->pict_type == AV_PICTURE_TYPE_I;
- *picture= *p;
- *data_size = sizeof(AVPicture);
+ *picture = *p;
+ *got_frame = 1;
emms_c();
@@ -847,47 +930,52 @@ static int decode_frame(AVCodecContext *avctx,
}
-static av_cold void common_init(AVCodecContext *avctx){
+static av_cold void common_init(AVCodecContext *avctx)
+{
FourXContext * const f = avctx->priv_data;
- dsputil_init(&f->dsp, avctx);
+ ff_dsputil_init(&f->dsp, avctx);
- f->avctx= avctx;
+ f->avctx = avctx;
}
-static av_cold int decode_init(AVCodecContext *avctx){
+static av_cold int decode_init(AVCodecContext *avctx)
+{
FourXContext * const f = avctx->priv_data;
- if(avctx->extradata_size != 4 || !avctx->extradata) {
+ if (avctx->extradata_size != 4 || !avctx->extradata) {
av_log(avctx, AV_LOG_ERROR, "extradata wrong or missing\n");
return 1;
}
- f->version= AV_RL32(avctx->extradata)>>16;
+ f->version = AV_RL32(avctx->extradata) >> 16;
common_init(avctx);
init_vlcs(f);
- if(f->version>2) avctx->pix_fmt= PIX_FMT_RGB565;
- else avctx->pix_fmt= PIX_FMT_BGR555;
+ if (f->version > 2)
+ avctx->pix_fmt = AV_PIX_FMT_RGB565;
+ else
+ avctx->pix_fmt = AV_PIX_FMT_BGR555;
return 0;
}
-static av_cold int decode_end(AVCodecContext *avctx){
+static av_cold int decode_end(AVCodecContext *avctx)
+{
FourXContext * const f = avctx->priv_data;
int i;
av_freep(&f->bitstream_buffer);
- f->bitstream_buffer_size=0;
- for(i=0; i<CFRAME_BUFFER_COUNT; i++){
+ f->bitstream_buffer_size = 0;
+ for (i = 0; i < CFRAME_BUFFER_COUNT; i++) {
av_freep(&f->cfrm[i].data);
- f->cfrm[i].allocated_size= 0;
+ f->cfrm[i].allocated_size = 0;
}
ff_free_vlc(&f->pre_vlc);
- if(f->current_picture.data[0])
+ if (f->current_picture.data[0])
avctx->release_buffer(avctx, &f->current_picture);
- if(f->last_picture.data[0])
+ if (f->last_picture.data[0])
avctx->release_buffer(avctx, &f->last_picture);
return 0;
@@ -896,12 +984,11 @@ static av_cold int decode_end(AVCodecContext *avctx){
AVCodec ff_fourxm_decoder = {
.name = "4xm",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_4XM,
+ .id = AV_CODEC_ID_4XM,
.priv_data_size = sizeof(FourXContext),
.init = decode_init,
.close = decode_end,
.decode = decode_frame,
.capabilities = CODEC_CAP_DR1,
- .long_name = NULL_IF_CONFIG_SMALL("4X Movie"),
+ .long_name = NULL_IF_CONFIG_SMALL("4X Movie"),
};
-
diff --git a/gst-libs/ext/libav/libavcodec/8bps.c b/gst-libs/ext/libav/libavcodec/8bps.c
index de8dd8e..8f0692c 100644
--- a/gst-libs/ext/libav/libavcodec/8bps.c
+++ b/gst-libs/ext/libav/libavcodec/8bps.c
@@ -33,197 +33,178 @@
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
+#include "libavutil/internal.h"
#include "libavutil/intreadwrite.h"
#include "avcodec.h"
+#include "internal.h"
-static const enum PixelFormat pixfmt_rgb24[] = {PIX_FMT_BGR24, PIX_FMT_RGB32, PIX_FMT_NONE};
+static const enum AVPixelFormat pixfmt_rgb24[] = {
+ AV_PIX_FMT_BGR24, AV_PIX_FMT_RGB32, AV_PIX_FMT_NONE };
-/*
- * Decoder context
- */
typedef struct EightBpsContext {
+ AVCodecContext *avctx;
+ AVFrame pic;
- AVCodecContext *avctx;
- AVFrame pic;
-
- unsigned char planes;
- unsigned char planemap[4];
+ unsigned char planes;
+ unsigned char planemap[4];
- uint32_t pal[256];
+ uint32_t pal[256];
} EightBpsContext;
-
-/*
- *
- * Decode a frame
- *
- */
-static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt)
+static int decode_frame(AVCodecContext *avctx, void *data,
+ int *got_frame, AVPacket *avpkt)
{
- const uint8_t *buf = avpkt->data;
- int buf_size = avpkt->size;
- EightBpsContext * const c = avctx->priv_data;
- const unsigned char *encoded = buf;
- unsigned char *pixptr, *pixptr_end;
- unsigned int height = avctx->height; // Real image height
- unsigned int dlen, p, row;
- const unsigned char *lp, *dp;
- unsigned char count;
- unsigned int px_inc;
- unsigned int planes = c->planes;
- unsigned char *planemap = c->planemap;
-
- if(c->pic.data[0])
- avctx->release_buffer(avctx, &c->pic);
-
- c->pic.reference = 0;
- c->pic.buffer_hints = FF_BUFFER_HINTS_VALID;
- if(avctx->get_buffer(avctx, &c->pic) < 0){
- av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
- return -1;
- }
-
- /* Set data pointer after line lengths */
- dp = encoded + planes * (height << 1);
-
- /* Ignore alpha plane, don't know what to do with it */
- if (planes == 4)
- planes--;
-
- px_inc = planes + (avctx->pix_fmt == PIX_FMT_RGB32);
-
- for (p = 0; p < planes; p++) {
- /* Lines length pointer for this plane */
- lp = encoded + p * (height << 1);
-
- /* Decode a plane */
- for(row = 0; row < height; row++) {
- pixptr = c->pic.data[0] + row * c->pic.linesize[0] + planemap[p];
- pixptr_end = pixptr + c->pic.linesize[0];
- dlen = av_be2ne16(*(const unsigned short *)(lp+row*2));
- /* Decode a row of this plane */
- while(dlen > 0) {
- if(dp + 1 >= buf+buf_size) return -1;
- if ((count = *dp++) <= 127) {
- count++;
- dlen -= count + 1;
- if (pixptr + count * px_inc > pixptr_end)
- break;
- if(dp + count > buf+buf_size) return -1;
- while(count--) {
- *pixptr = *dp++;
- pixptr += px_inc;
- }
- } else {
- count = 257 - count;
- if (pixptr + count * px_inc > pixptr_end)
- break;
- while(count--) {
- *pixptr = *dp;
- pixptr += px_inc;
- }
- dp++;
- dlen -= 2;
- }
- }
+ const uint8_t *buf = avpkt->data;
+ int buf_size = avpkt->size;
+ EightBpsContext * const c = avctx->priv_data;
+ const unsigned char *encoded = buf;
+ unsigned char *pixptr, *pixptr_end;
+ unsigned int height = avctx->height; // Real image height
+ unsigned int dlen, p, row;
+ const unsigned char *lp, *dp;
+ unsigned char count;
+ unsigned int px_inc;
+ unsigned int planes = c->planes;
+ unsigned char *planemap = c->planemap;
+
+ if (c->pic.data[0])
+ avctx->release_buffer(avctx, &c->pic);
+
+ c->pic.reference = 0;
+ c->pic.buffer_hints = FF_BUFFER_HINTS_VALID;
+ if (ff_get_buffer(avctx, &c->pic) < 0){
+ av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
+ return -1;
+ }
+
+ /* Set data pointer after line lengths */
+ dp = encoded + planes * (height << 1);
+
+ /* Ignore alpha plane, don't know what to do with it */
+ if (planes == 4)
+ planes--;
+
+ px_inc = planes + (avctx->pix_fmt == AV_PIX_FMT_RGB32);
+
+ for (p = 0; p < planes; p++) {
+ /* Lines length pointer for this plane */
+ lp = encoded + p * (height << 1);
+
+ /* Decode a plane */
+ for (row = 0; row < height; row++) {
+ pixptr = c->pic.data[0] + row * c->pic.linesize[0] + planemap[p];
+ pixptr_end = pixptr + c->pic.linesize[0];
+ dlen = av_be2ne16(*(const unsigned short *)(lp + row * 2));
+ /* Decode a row of this plane */
+ while (dlen > 0) {
+ if (dp + 1 >= buf + buf_size)
+ return -1;
+ if ((count = *dp++) <= 127) {
+ count++;
+ dlen -= count + 1;
+ if (pixptr + count * px_inc > pixptr_end)
+ break;
+ if (dp + count > buf + buf_size)
+ return -1;
+ while (count--) {
+ *pixptr = *dp++;
+ pixptr += px_inc;
+ }
+ } else {
+ count = 257 - count;
+ if (pixptr + count * px_inc > pixptr_end)
+ break;
+ while (count--) {
+ *pixptr = *dp;
+ pixptr += px_inc;
+ }
+ dp++;
+ dlen -= 2;
}
+ }
}
-
- if (avctx->bits_per_coded_sample <= 8) {
- const uint8_t *pal = av_packet_get_side_data(avpkt,
- AV_PKT_DATA_PALETTE,
- NULL);
- if (pal) {
- c->pic.palette_has_changed = 1;
- memcpy(c->pal, pal, AVPALETTE_SIZE);
- }
-
- memcpy (c->pic.data[1], c->pal, AVPALETTE_SIZE);
+ }
+
+ if (avctx->bits_per_coded_sample <= 8) {
+ const uint8_t *pal = av_packet_get_side_data(avpkt,
+ AV_PKT_DATA_PALETTE,
+ NULL);
+ if (pal) {
+ c->pic.palette_has_changed = 1;
+ memcpy(c->pal, pal, AVPALETTE_SIZE);
}
- *data_size = sizeof(AVFrame);
- *(AVFrame*)data = c->pic;
+ memcpy (c->pic.data[1], c->pal, AVPALETTE_SIZE);
+ }
- /* always report that the buffer was completely consumed */
- return buf_size;
-}
+ *got_frame = 1;
+ *(AVFrame*)data = c->pic;
+ /* always report that the buffer was completely consumed */
+ return buf_size;
+}
-/*
- *
- * Init 8BPS decoder
- *
- */
static av_cold int decode_init(AVCodecContext *avctx)
{
- EightBpsContext * const c = avctx->priv_data;
-
- c->avctx = avctx;
-
- c->pic.data[0] = NULL;
-
- switch (avctx->bits_per_coded_sample) {
- case 8:
- avctx->pix_fmt = PIX_FMT_PAL8;
- c->planes = 1;
- c->planemap[0] = 0; // 1st plane is palette indexes
- break;
- case 24:
- avctx->pix_fmt = avctx->get_format(avctx, pixfmt_rgb24);
- c->planes = 3;
- c->planemap[0] = 2; // 1st plane is red
- c->planemap[1] = 1; // 2nd plane is green
- c->planemap[2] = 0; // 3rd plane is blue
- break;
- case 32:
- avctx->pix_fmt = PIX_FMT_RGB32;
- c->planes = 4;
+ EightBpsContext * const c = avctx->priv_data;
+
+ c->avctx = avctx;
+ c->pic.data[0] = NULL;
+
+ switch (avctx->bits_per_coded_sample) {
+ case 8:
+ avctx->pix_fmt = AV_PIX_FMT_PAL8;
+ c->planes = 1;
+ c->planemap[0] = 0; // 1st plane is palette indexes
+ break;
+ case 24:
+ avctx->pix_fmt = avctx->get_format(avctx, pixfmt_rgb24);
+ c->planes = 3;
+ c->planemap[0] = 2; // 1st plane is red
+ c->planemap[1] = 1; // 2nd plane is green
+ c->planemap[2] = 0; // 3rd plane is blue
+ break;
+ case 32:
+ avctx->pix_fmt = AV_PIX_FMT_RGB32;
+ c->planes = 4;
#if HAVE_BIGENDIAN
- c->planemap[0] = 1; // 1st plane is red
- c->planemap[1] = 2; // 2nd plane is green
- c->planemap[2] = 3; // 3rd plane is blue
- c->planemap[3] = 0; // 4th plane is alpha???
+ c->planemap[0] = 1; // 1st plane is red
+ c->planemap[1] = 2; // 2nd plane is green
+ c->planemap[2] = 3; // 3rd plane is blue
+ c->planemap[3] = 0; // 4th plane is alpha???
#else
- c->planemap[0] = 2; // 1st plane is red
- c->planemap[1] = 1; // 2nd plane is green
- c->planemap[2] = 0; // 3rd plane is blue
- c->planemap[3] = 3; // 4th plane is alpha???
+ c->planemap[0] = 2; // 1st plane is red
+ c->planemap[1] = 1; // 2nd plane is green
+ c->planemap[2] = 0; // 3rd plane is blue
+ c->planemap[3] = 3; // 4th plane is alpha???
#endif
- break;
- default:
- av_log(avctx, AV_LOG_ERROR, "Error: Unsupported color depth: %u.\n", avctx->bits_per_coded_sample);
- return -1;
- }
-
- return 0;
+ break;
+ default:
+ av_log(avctx, AV_LOG_ERROR, "Error: Unsupported color depth: %u.\n",
+ avctx->bits_per_coded_sample);
+ return -1;
+ }
+
+ return 0;
}
-
-
-
-/*
- *
- * Uninit 8BPS decoder
- *
- */
static av_cold int decode_end(AVCodecContext *avctx)
{
- EightBpsContext * const c = avctx->priv_data;
+ EightBpsContext * const c = avctx->priv_data;
- if (c->pic.data[0])
- avctx->release_buffer(avctx, &c->pic);
+ if (c->pic.data[0])
+ avctx->release_buffer(avctx, &c->pic);
- return 0;
+ return 0;
}
-
-
AVCodec ff_eightbps_decoder = {
.name = "8bps",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_8BPS,
+ .id = AV_CODEC_ID_8BPS,
.priv_data_size = sizeof(EightBpsContext),
.init = decode_init,
.close = decode_end,
diff --git a/gst-libs/ext/libav/libavcodec/8svx.c b/gst-libs/ext/libav/libavcodec/8svx.c
index 4f11b8b..dda181b 100644
--- a/gst-libs/ext/libav/libavcodec/8svx.c
+++ b/gst-libs/ext/libav/libavcodec/8svx.c
@@ -29,6 +29,8 @@
*/
#include "avcodec.h"
+#include "internal.h"
+#include "libavutil/common.h"
/** decoder context */
typedef struct EightSvxContext {
@@ -57,30 +59,25 @@ static const int8_t exponential[16] = { -128, -64, -32, -16, -8, -4, -2, -1,
* @param[in,out] state starting value. it is saved for use in the next call.
*/
static void delta_decode(uint8_t *dst, const uint8_t *src, int src_size,
- uint8_t *state, const int8_t *table, int channels)
+ uint8_t *state, const int8_t *table)
{
uint8_t val = *state;
while (src_size--) {
uint8_t d = *src++;
val = av_clip_uint8(val + table[d & 0xF]);
- *dst = val;
- dst += channels;
+ *dst++ = val;
val = av_clip_uint8(val + table[d >> 4]);
- *dst = val;
- dst += channels;
+ *dst++ = val;
}
*state = val;
}
-static void raw_decode(uint8_t *dst, const int8_t *src, int src_size,
- int channels)
+static void raw_decode(uint8_t *dst, const int8_t *src, int src_size)
{
- while (src_size--) {
- *dst = *src++ + 128;
- dst += channels;
- }
+ while (src_size--)
+ *dst++ = *src++ + 128;
}
/** decode a frame */
@@ -89,9 +86,8 @@ static int eightsvx_decode_frame(AVCodecContext *avctx, void *data,
{
EightSvxContext *esc = avctx->priv_data;
int buf_size;
- uint8_t *out_data;
- int ret;
- int is_compr = (avctx->codec_id != CODEC_ID_PCM_S8_PLANAR);
+ int ch, ret;
+ int is_compr = (avctx->codec_id != AV_CODEC_ID_PCM_S8_PLANAR);
/* for the first packet, copy data to buffer */
if (avpkt->data) {
@@ -141,26 +137,21 @@ static int eightsvx_decode_frame(AVCodecContext *avctx, void *data,
/* get output buffer */
esc->frame.nb_samples = buf_size * (is_compr + 1);
- if ((ret = avctx->get_buffer(avctx, &esc->frame)) < 0) {
+ if ((ret = ff_get_buffer(avctx, &esc->frame)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return ret;
}
- out_data = esc->frame.data[0];
-
- if (is_compr) {
- delta_decode(out_data, &esc->data[0][esc->data_idx], buf_size,
- &esc->fib_acc[0], esc->table, avctx->channels);
- if (avctx->channels == 2) {
- delta_decode(&out_data[1], &esc->data[1][esc->data_idx], buf_size,
- &esc->fib_acc[1], esc->table, avctx->channels);
- }
- } else {
- int ch;
- for (ch = 0; ch < avctx->channels; ch++) {
- raw_decode((int8_t *)&out_data[ch], &esc->data[ch][esc->data_idx],
- buf_size, avctx->channels);
+
+ for (ch = 0; ch < avctx->channels; ch++) {
+ if (is_compr) {
+ delta_decode(esc->frame.data[ch], &esc->data[ch][esc->data_idx],
+ buf_size, &esc->fib_acc[ch], esc->table);
+ } else {
+ raw_decode(esc->frame.data[ch], &esc->data[ch][esc->data_idx],
+ buf_size);
}
}
+
esc->data_idx += buf_size;
*got_frame_ptr = 1;
@@ -180,18 +171,18 @@ static av_cold int eightsvx_decode_init(AVCodecContext *avctx)
}
switch(avctx->codec->id) {
- case CODEC_ID_8SVX_FIB:
+ case AV_CODEC_ID_8SVX_FIB:
esc->table = fibonacci;
break;
- case CODEC_ID_8SVX_EXP:
+ case AV_CODEC_ID_8SVX_EXP:
esc->table = exponential;
break;
- case CODEC_ID_PCM_S8_PLANAR:
+ case AV_CODEC_ID_PCM_S8_PLANAR:
break;
default:
return -1;
}
- avctx->sample_fmt = AV_SAMPLE_FMT_U8;
+ avctx->sample_fmt = AV_SAMPLE_FMT_U8P;
avcodec_get_frame_defaults(&esc->frame);
avctx->coded_frame = &esc->frame;
@@ -212,35 +203,41 @@ static av_cold int eightsvx_decode_close(AVCodecContext *avctx)
AVCodec ff_eightsvx_fib_decoder = {
.name = "8svx_fib",
.type = AVMEDIA_TYPE_AUDIO,
- .id = CODEC_ID_8SVX_FIB,
+ .id = AV_CODEC_ID_8SVX_FIB,
.priv_data_size = sizeof (EightSvxContext),
.init = eightsvx_decode_init,
.close = eightsvx_decode_close,
.decode = eightsvx_decode_frame,
.capabilities = CODEC_CAP_DELAY | CODEC_CAP_DR1,
.long_name = NULL_IF_CONFIG_SMALL("8SVX fibonacci"),
+ .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_U8P,
+ AV_SAMPLE_FMT_NONE },
};
AVCodec ff_eightsvx_exp_decoder = {
.name = "8svx_exp",
.type = AVMEDIA_TYPE_AUDIO,
- .id = CODEC_ID_8SVX_EXP,
+ .id = AV_CODEC_ID_8SVX_EXP,
.priv_data_size = sizeof (EightSvxContext),
.init = eightsvx_decode_init,
.close = eightsvx_decode_close,
.decode = eightsvx_decode_frame,
.capabilities = CODEC_CAP_DELAY | CODEC_CAP_DR1,
.long_name = NULL_IF_CONFIG_SMALL("8SVX exponential"),
+ .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_U8P,
+ AV_SAMPLE_FMT_NONE },
};
AVCodec ff_pcm_s8_planar_decoder = {
.name = "pcm_s8_planar",
.type = AVMEDIA_TYPE_AUDIO,
- .id = CODEC_ID_PCM_S8_PLANAR,
+ .id = AV_CODEC_ID_PCM_S8_PLANAR,
.priv_data_size = sizeof(EightSvxContext),
.init = eightsvx_decode_init,
.close = eightsvx_decode_close,
.decode = eightsvx_decode_frame,
.capabilities = CODEC_CAP_DELAY | CODEC_CAP_DR1,
.long_name = NULL_IF_CONFIG_SMALL("PCM signed 8-bit planar"),
+ .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_U8P,
+ AV_SAMPLE_FMT_NONE },
};
diff --git a/gst-libs/ext/libav/libavcodec/Makefile b/gst-libs/ext/libav/libavcodec/Makefile
index da8fd54..a32ff96 100644
--- a/gst-libs/ext/libav/libavcodec/Makefile
+++ b/gst-libs/ext/libav/libavcodec/Makefile
@@ -1,18 +1,30 @@
NAME = avcodec
FFLIBS = avutil
-HEADERS = avcodec.h avfft.h dxva2.h opt.h vaapi.h vda.h vdpau.h version.h xvmc.h
+HEADERS = avcodec.h \
+ avfft.h \
+ dxva2.h \
+ old_codec_ids.h \
+ vaapi.h \
+ vda.h \
+ vdpau.h \
+ version.h \
+ xvmc.h \
OBJS = allcodecs.o \
audioconvert.o \
avpacket.o \
+ avpicture.o \
bitstream.o \
bitstream_filter.o \
+ codec_desc.o \
dsputil.o \
faanidct.o \
fmtconvert.o \
imgconvert.o \
jrevdct.o \
+ log2_tab.o \
+ mathtables.o \
options.o \
parser.o \
raw.o \
@@ -22,12 +34,14 @@ OBJS = allcodecs.o \
utils.o \
# parts needed for many different codecs
-OBJS-$(CONFIG_AANDCT) += aandcttab.o
+OBJS-$(CONFIG_AANDCTTABLES) += aandcttab.o
OBJS-$(CONFIG_AC3DSP) += ac3dsp.o
-OBJS-$(CONFIG_ENCODERS) += faandct.o jfdctfst.o jfdctint.o
+OBJS-$(CONFIG_AUDIO_FRAME_QUEUE) += audio_frame_queue.o
OBJS-$(CONFIG_DCT) += dct.o dct32_fixed.o dct32_float.o
OBJS-$(CONFIG_DWT) += dwt.o
OBJS-$(CONFIG_DXVA2) += dxva2.o
+OBJS-$(CONFIG_ENCODERS) += faandct.o jfdctfst.o jfdctint.o
+OBJS-$(CONFIG_ERROR_RESILIENCE) += error_resilience.o
FFT-OBJS-$(CONFIG_HARDCODED_TABLES) += cos_tables.o cos_fixed_tables.o
OBJS-$(CONFIG_FFT) += avfft.o fft_fixed.o fft_float.o \
$(FFT-OBJS-yes)
@@ -35,24 +49,34 @@ OBJS-$(CONFIG_GOLOMB) += golomb.o
OBJS-$(CONFIG_H264DSP) += h264dsp.o h264idct.o
OBJS-$(CONFIG_H264PRED) += h264pred.o
OBJS-$(CONFIG_HUFFMAN) += huffman.o
+OBJS-$(CONFIG_LIBXVID) += libxvid_rc.o
OBJS-$(CONFIG_LPC) += lpc.o
OBJS-$(CONFIG_LSP) += lsp.o
OBJS-$(CONFIG_MDCT) += mdct_fixed.o mdct_float.o
+OBJS-$(CONFIG_MPEGAUDIO) += mpegaudio.o mpegaudiodata.o \
+ mpegaudiodecheader.o
OBJS-$(CONFIG_MPEGAUDIODSP) += mpegaudiodsp.o \
+ mpegaudiodsp_data.o \
mpegaudiodsp_fixed.o \
mpegaudiodsp_float.o
+OBJS-$(CONFIG_MPEGVIDEO) += mpegvideo.o mpegvideo_motion.o
+OBJS-$(CONFIG_MPEGVIDEOENC) += mpegvideo_enc.o mpeg12data.o \
+ motion_est.o ratecontrol.o
+OBJS-$(CONFIG_RANGECODER) += rangecoder.o
RDFT-OBJS-$(CONFIG_HARDCODED_TABLES) += sin_tables.o
OBJS-$(CONFIG_RDFT) += rdft.o $(RDFT-OBJS-yes)
OBJS-$(CONFIG_SINEWIN) += sinewin.o
OBJS-$(CONFIG_VAAPI) += vaapi.o
-OBJS-$(CONFIG_VDA) += vda.o
OBJS-$(CONFIG_VDPAU) += vdpau.o
+OBJS-$(CONFIG_VIDEODSP) += videodsp.o
+OBJS-$(CONFIG_VP3DSP) += vp3dsp.o
# decoders/encoders/hardware accelerators
OBJS-$(CONFIG_A64MULTI_ENCODER) += a64multienc.o elbg.o
OBJS-$(CONFIG_A64MULTI5_ENCODER) += a64multienc.o elbg.o
OBJS-$(CONFIG_AAC_DECODER) += aacdec.o aactab.o aacsbr.o aacps.o \
- aacadtsdec.o mpeg4audio.o kbdwin.o
+ aacadtsdec.o mpeg4audio.o kbdwin.o \
+ sbrdsp.o aacpsdsp.o
OBJS-$(CONFIG_AAC_ENCODER) += aacenc.o aaccoder.o \
aacpsy.o aactab.o \
psymodel.o iirfilter.o \
@@ -62,8 +86,8 @@ OBJS-$(CONFIG_AC3_DECODER) += ac3dec.o ac3dec_data.o ac3.o kbdwin.o
OBJS-$(CONFIG_AC3_ENCODER) += ac3enc_float.o ac3enc.o ac3tab.o \
ac3.o kbdwin.o
OBJS-$(CONFIG_AC3_FIXED_ENCODER) += ac3enc_fixed.o ac3enc.o ac3tab.o ac3.o
-OBJS-$(CONFIG_ALAC_DECODER) += alac.o
-OBJS-$(CONFIG_ALAC_ENCODER) += alacenc.o
+OBJS-$(CONFIG_ALAC_DECODER) += alac.o alac_data.o
+OBJS-$(CONFIG_ALAC_ENCODER) += alacenc.o alac_data.o
OBJS-$(CONFIG_ALS_DECODER) += alsdec.o bgmc.o mpeg4audio.o
OBJS-$(CONFIG_AMRNB_DECODER) += amrnbdec.o celp_filters.o \
celp_math.o acelp_filters.o \
@@ -72,17 +96,17 @@ OBJS-$(CONFIG_AMRNB_DECODER) += amrnbdec.o celp_filters.o \
OBJS-$(CONFIG_AMRWB_DECODER) += amrwbdec.o celp_filters.o \
celp_math.o acelp_filters.o \
acelp_vectors.o \
- acelp_pitch_delay.o lsp.o
+ acelp_pitch_delay.o
OBJS-$(CONFIG_AMV_DECODER) += sp5xdec.o mjpegdec.o mjpeg.o
OBJS-$(CONFIG_ANM_DECODER) += anm.o
OBJS-$(CONFIG_ANSI_DECODER) += ansi.o cga_data.o
OBJS-$(CONFIG_APE_DECODER) += apedec.o
OBJS-$(CONFIG_ASS_DECODER) += assdec.o ass.o
OBJS-$(CONFIG_ASS_ENCODER) += assenc.o ass.o
-OBJS-$(CONFIG_ASV1_DECODER) += asv1.o mpeg12data.o
-OBJS-$(CONFIG_ASV1_ENCODER) += asv1.o mpeg12data.o
-OBJS-$(CONFIG_ASV2_DECODER) += asv1.o mpeg12data.o
-OBJS-$(CONFIG_ASV2_ENCODER) += asv1.o mpeg12data.o
+OBJS-$(CONFIG_ASV1_DECODER) += asvdec.o asv.o mpeg12data.o
+OBJS-$(CONFIG_ASV1_ENCODER) += asvenc.o asv.o mpeg12data.o
+OBJS-$(CONFIG_ASV2_DECODER) += asvdec.o asv.o mpeg12data.o
+OBJS-$(CONFIG_ASV2_ENCODER) += asvenc.o asv.o mpeg12data.o
OBJS-$(CONFIG_ATRAC1_DECODER) += atrac1.o atrac.o
OBJS-$(CONFIG_ATRAC3_DECODER) += atrac3.o atrac.o
OBJS-$(CONFIG_AURA_DECODER) += cyuv.o
@@ -91,29 +115,31 @@ OBJS-$(CONFIG_AVS_DECODER) += avs.o
OBJS-$(CONFIG_BETHSOFTVID_DECODER) += bethsoftvideo.o
OBJS-$(CONFIG_BFI_DECODER) += bfi.o
OBJS-$(CONFIG_BINK_DECODER) += bink.o binkdsp.o
-OBJS-$(CONFIG_BINKAUDIO_DCT_DECODER) += binkaudio.o wma.o
-OBJS-$(CONFIG_BINKAUDIO_RDFT_DECODER) += binkaudio.o wma.o
+OBJS-$(CONFIG_BINKAUDIO_DCT_DECODER) += binkaudio.o wma.o wma_common.o
+OBJS-$(CONFIG_BINKAUDIO_RDFT_DECODER) += binkaudio.o wma.o wma_common.o
OBJS-$(CONFIG_BMP_DECODER) += bmp.o msrledec.o
OBJS-$(CONFIG_BMP_ENCODER) += bmpenc.o
OBJS-$(CONFIG_BMV_VIDEO_DECODER) += bmv.o
OBJS-$(CONFIG_BMV_AUDIO_DECODER) += bmv.o
OBJS-$(CONFIG_C93_DECODER) += c93.o
OBJS-$(CONFIG_CAVS_DECODER) += cavs.o cavsdec.o cavsdsp.o \
- mpeg12data.o mpegvideo.o
+ cavsdata.o mpeg12data.o
OBJS-$(CONFIG_CDGRAPHICS_DECODER) += cdgraphics.o
+OBJS-$(CONFIG_CDXL_DECODER) += cdxl.o
OBJS-$(CONFIG_CINEPAK_DECODER) += cinepak.o
OBJS-$(CONFIG_CLJR_DECODER) += cljr.o
OBJS-$(CONFIG_CLJR_ENCODER) += cljr.o
+OBJS-$(CONFIG_CLLC_DECODER) += cllc.o
OBJS-$(CONFIG_COOK_DECODER) += cook.o
+OBJS-$(CONFIG_COMFORTNOISE_DECODER) += cngdec.o celp_filters.o
+OBJS-$(CONFIG_COMFORTNOISE_ENCODER) += cngenc.o
OBJS-$(CONFIG_CSCD_DECODER) += cscd.o
OBJS-$(CONFIG_CYUV_DECODER) += cyuv.o
-OBJS-$(CONFIG_DCA_DECODER) += dca.o synth_filter.o dcadsp.o
+OBJS-$(CONFIG_DCA_DECODER) += dcadec.o dca.o dcadsp.o \
+ dca_parser.o synth_filter.o
OBJS-$(CONFIG_DFA_DECODER) += dfa.o
OBJS-$(CONFIG_DNXHD_DECODER) += dnxhddec.o dnxhddata.o
-OBJS-$(CONFIG_DNXHD_ENCODER) += dnxhdenc.o dnxhddata.o \
- mpegvideo_enc.o motion_est.o \
- ratecontrol.o mpeg12data.o \
- mpegvideo.o
+OBJS-$(CONFIG_DNXHD_ENCODER) += dnxhdenc.o dnxhddata.o
OBJS-$(CONFIG_DPX_DECODER) += dpx.o
OBJS-$(CONFIG_DPX_ENCODER) += dpxenc.o
OBJS-$(CONFIG_DSICINAUDIO_DECODER) += dsicinav.o
@@ -122,32 +148,29 @@ OBJS-$(CONFIG_DVBSUB_DECODER) += dvbsubdec.o
OBJS-$(CONFIG_DVBSUB_ENCODER) += dvbsub.o
OBJS-$(CONFIG_DVDSUB_DECODER) += dvdsubdec.o
OBJS-$(CONFIG_DVDSUB_ENCODER) += dvdsubenc.o
-OBJS-$(CONFIG_DVVIDEO_DECODER) += dv.o dvdata.o
-OBJS-$(CONFIG_DVVIDEO_ENCODER) += dv.o dvdata.o
+OBJS-$(CONFIG_DVVIDEO_DECODER) += dvdec.o dv.o dvdata.o dv_profile.o
+OBJS-$(CONFIG_DVVIDEO_ENCODER) += dv.o dvdata.o dv_profile.o
OBJS-$(CONFIG_DXA_DECODER) += dxa.o
OBJS-$(CONFIG_DXTORY_DECODER) += dxtory.o
OBJS-$(CONFIG_EAC3_DECODER) += eac3dec.o eac3_data.o
-OBJS-$(CONFIG_EAC3_ENCODER) += eac3enc.o ac3enc.o ac3enc_float.o \
- ac3tab.o ac3.o kbdwin.o eac3_data.o
+OBJS-$(CONFIG_EAC3_ENCODER) += eac3enc.o eac3_data.o
OBJS-$(CONFIG_EACMV_DECODER) += eacmv.o
OBJS-$(CONFIG_EAMAD_DECODER) += eamad.o eaidct.o mpeg12.o \
- mpeg12data.o mpegvideo.o \
- error_resilience.o
+ mpeg12data.o
OBJS-$(CONFIG_EATGQ_DECODER) += eatgq.o eaidct.o
OBJS-$(CONFIG_EATGV_DECODER) += eatgv.o
OBJS-$(CONFIG_EATQI_DECODER) += eatqi.o eaidct.o mpeg12.o \
- mpeg12data.o mpegvideo.o \
- error_resilience.o
+ mpeg12data.o
OBJS-$(CONFIG_EIGHTBPS_DECODER) += 8bps.o
OBJS-$(CONFIG_EIGHTSVX_EXP_DECODER) += 8svx.o
OBJS-$(CONFIG_EIGHTSVX_FIB_DECODER) += 8svx.o
OBJS-$(CONFIG_ESCAPE124_DECODER) += escape124.o
-OBJS-$(CONFIG_FFV1_DECODER) += ffv1.o rangecoder.o
-OBJS-$(CONFIG_FFV1_ENCODER) += ffv1.o rangecoder.o
-OBJS-$(CONFIG_FFVHUFF_DECODER) += huffyuv.o
-OBJS-$(CONFIG_FFVHUFF_ENCODER) += huffyuv.o
-OBJS-$(CONFIG_FLAC_DECODER) += flacdec.o flacdata.o flac.o
-OBJS-$(CONFIG_FLAC_ENCODER) += flacenc.o flacdata.o flac.o
+OBJS-$(CONFIG_FFV1_DECODER) += ffv1dec.o ffv1.o
+OBJS-$(CONFIG_FFV1_ENCODER) += ffv1enc.o ffv1.o
+OBJS-$(CONFIG_FFVHUFF_DECODER) += huffyuv.o huffyuvdec.o
+OBJS-$(CONFIG_FFVHUFF_ENCODER) += huffyuv.o huffyuvenc.o
+OBJS-$(CONFIG_FLAC_DECODER) += flacdec.o flacdata.o flac.o flacdsp.o
+OBJS-$(CONFIG_FLAC_ENCODER) += flacenc.o flacdata.o flac.o flacdsp.o
OBJS-$(CONFIG_FLASHSV_DECODER) += flashsv.o
OBJS-$(CONFIG_FLASHSV_ENCODER) += flashsvenc.o
OBJS-$(CONFIG_FLASHSV2_DECODER) += flashsv.o
@@ -155,36 +178,30 @@ OBJS-$(CONFIG_FLIC_DECODER) += flicvideo.o
OBJS-$(CONFIG_FOURXM_DECODER) += 4xm.o
OBJS-$(CONFIG_FRAPS_DECODER) += fraps.o
OBJS-$(CONFIG_FRWU_DECODER) += frwu.o
+OBJS-$(CONFIG_G723_1_DECODER) += g723_1.o acelp_vectors.o \
+ celp_filters.o
OBJS-$(CONFIG_GIF_DECODER) += gifdec.o lzw.o
OBJS-$(CONFIG_GIF_ENCODER) += gif.o lzwenc.o
OBJS-$(CONFIG_GSM_DECODER) += gsmdec.o gsmdec_data.o msgsmdec.o
OBJS-$(CONFIG_GSM_MS_DECODER) += gsmdec.o gsmdec_data.o msgsmdec.o
-OBJS-$(CONFIG_H261_DECODER) += h261dec.o h261.o \
- mpegvideo.o error_resilience.o
-OBJS-$(CONFIG_H261_ENCODER) += h261enc.o h261.o \
- mpegvideo_enc.o motion_est.o \
- ratecontrol.o mpeg12data.o \
- mpegvideo.o
+OBJS-$(CONFIG_H261_DECODER) += h261dec.o h261.o
+OBJS-$(CONFIG_H261_ENCODER) += h261enc.o h261.o
OBJS-$(CONFIG_H263_DECODER) += h263dec.o h263.o ituh263dec.o \
mpeg4video.o mpeg4videodec.o flvdec.o\
- intelh263dec.o mpegvideo.o \
- error_resilience.o
+ intelh263dec.o
OBJS-$(CONFIG_H263_VAAPI_HWACCEL) += vaapi_mpeg4.o
-OBJS-$(CONFIG_H263_ENCODER) += mpegvideo_enc.o mpeg4video.o \
- mpeg4videoenc.o motion_est.o \
- ratecontrol.o h263.o ituh263enc.o \
- flvenc.o mpeg12data.o \
- mpegvideo.o error_resilience.o
+OBJS-$(CONFIG_H263_ENCODER) += mpeg4videoenc.o mpeg4video.o \
+ h263.o ituh263enc.o flvenc.o
OBJS-$(CONFIG_H264_DECODER) += h264.o \
h264_loopfilter.o h264_direct.o \
cabac.o h264_sei.o h264_ps.o \
- h264_refs.o h264_cavlc.o h264_cabac.o\
- mpegvideo.o error_resilience.o
+ h264_refs.o h264_cavlc.o h264_cabac.o
OBJS-$(CONFIG_H264_DXVA2_HWACCEL) += dxva2_h264.o
OBJS-$(CONFIG_H264_VAAPI_HWACCEL) += vaapi_h264.o
OBJS-$(CONFIG_H264_VDA_HWACCEL) += vda_h264.o
-OBJS-$(CONFIG_HUFFYUV_DECODER) += huffyuv.o
-OBJS-$(CONFIG_HUFFYUV_ENCODER) += huffyuv.o
+OBJS-$(CONFIG_HUFFYUV_DECODER) += huffyuv.o huffyuvdec.o
+OBJS-$(CONFIG_HUFFYUV_ENCODER) += huffyuv.o huffyuvenc.o
+OBJS-$(CONFIG_IAC_DECODER) += imc.o
OBJS-$(CONFIG_IDCIN_DECODER) += idcinvideo.o
OBJS-$(CONFIG_IFF_BYTERUN1_DECODER) += iff.o
OBJS-$(CONFIG_IFF_ILBM_DECODER) += iff.o
@@ -202,83 +219,58 @@ OBJS-$(CONFIG_JV_DECODER) += jvdec.o
OBJS-$(CONFIG_KGV1_DECODER) += kgv1dec.o
OBJS-$(CONFIG_KMVC_DECODER) += kmvc.o
OBJS-$(CONFIG_LAGARITH_DECODER) += lagarith.o lagarithrac.o
-OBJS-$(CONFIG_LJPEG_ENCODER) += ljpegenc.o mjpegenc.o mjpeg.o \
- mpegvideo_enc.o motion_est.o \
- ratecontrol.o mpeg12data.o \
- mpegvideo.o
+OBJS-$(CONFIG_LJPEG_ENCODER) += ljpegenc.o mjpegenc.o mjpeg.o
OBJS-$(CONFIG_LOCO_DECODER) += loco.o
OBJS-$(CONFIG_MACE3_DECODER) += mace.o
OBJS-$(CONFIG_MACE6_DECODER) += mace.o
-OBJS-$(CONFIG_MDEC_DECODER) += mdec.o mpeg12.o mpeg12data.o \
- mpegvideo.o error_resilience.o
+OBJS-$(CONFIG_MDEC_DECODER) += mdec.o mpeg12.o mpeg12data.o
OBJS-$(CONFIG_MIMIC_DECODER) += mimic.o
OBJS-$(CONFIG_MJPEG_DECODER) += mjpegdec.o mjpeg.o
-OBJS-$(CONFIG_MJPEG_ENCODER) += mjpegenc.o mjpeg.o \
- mpegvideo_enc.o motion_est.o \
- ratecontrol.o mpeg12data.o \
- mpegvideo.o
+OBJS-$(CONFIG_MJPEG_ENCODER) += mjpegenc.o mjpeg.o
OBJS-$(CONFIG_MJPEGB_DECODER) += mjpegbdec.o mjpegdec.o mjpeg.o
OBJS-$(CONFIG_MLP_DECODER) += mlpdec.o mlpdsp.o
OBJS-$(CONFIG_MMVIDEO_DECODER) += mmvideo.o
OBJS-$(CONFIG_MOTIONPIXELS_DECODER) += motionpixels.o
-OBJS-$(CONFIG_MP1_DECODER) += mpegaudiodec.o mpegaudiodecheader.o \
- mpegaudio.o mpegaudiodata.o
-OBJS-$(CONFIG_MP1FLOAT_DECODER) += mpegaudiodec_float.o mpegaudiodecheader.o \
- mpegaudio.o mpegaudiodata.o
-OBJS-$(CONFIG_MP2_DECODER) += mpegaudiodec.o mpegaudiodecheader.o \
- mpegaudio.o mpegaudiodata.o
+OBJS-$(CONFIG_MP1_DECODER) += mpegaudiodec.o
+OBJS-$(CONFIG_MP1FLOAT_DECODER) += mpegaudiodec_float.o
+OBJS-$(CONFIG_MP2_DECODER) += mpegaudiodec.o
OBJS-$(CONFIG_MP2_ENCODER) += mpegaudioenc.o mpegaudio.o \
- mpegaudiodata.o
-OBJS-$(CONFIG_MP2FLOAT_DECODER) += mpegaudiodec_float.o mpegaudiodecheader.o \
- mpegaudio.o mpegaudiodata.o
-OBJS-$(CONFIG_MP3ADU_DECODER) += mpegaudiodec.o mpegaudiodecheader.o \
- mpegaudio.o mpegaudiodata.o
-OBJS-$(CONFIG_MP3ADUFLOAT_DECODER) += mpegaudiodec_float.o mpegaudiodecheader.o \
- mpegaudio.o mpegaudiodata.o
-OBJS-$(CONFIG_MP3ON4_DECODER) += mpegaudiodec.o mpegaudiodecheader.o \
- mpegaudio.o mpegaudiodata.o \
- mpeg4audio.o
-OBJS-$(CONFIG_MP3ON4FLOAT_DECODER) += mpegaudiodec_float.o mpegaudiodecheader.o \
- mpegaudio.o mpegaudiodata.o \
- mpeg4audio.o
-OBJS-$(CONFIG_MP3_DECODER) += mpegaudiodec.o mpegaudiodecheader.o \
- mpegaudio.o mpegaudiodata.o
-OBJS-$(CONFIG_MP3FLOAT_DECODER) += mpegaudiodec_float.o mpegaudiodecheader.o \
- mpegaudio.o mpegaudiodata.o
-OBJS-$(CONFIG_MPC7_DECODER) += mpc7.o mpc.o mpegaudiodec.o \
- mpegaudiodecheader.o mpegaudio.o \
- mpegaudiodata.o
-OBJS-$(CONFIG_MPC8_DECODER) += mpc8.o mpc.o mpegaudiodec.o \
- mpegaudiodecheader.o mpegaudio.o \
- mpegaudiodata.o
+ mpegaudiodata.o mpegaudiodsp_data.o
+OBJS-$(CONFIG_MP2FLOAT_DECODER) += mpegaudiodec_float.o
+OBJS-$(CONFIG_MP3_DECODER) += mpegaudiodec.o
+OBJS-$(CONFIG_MP3ADU_DECODER) += mpegaudiodec.o
+OBJS-$(CONFIG_MP3ADUFLOAT_DECODER) += mpegaudiodec_float.o
+OBJS-$(CONFIG_MP3FLOAT_DECODER) += mpegaudiodec_float.o
+OBJS-$(CONFIG_MP3ON4_DECODER) += mpegaudiodec.o mpeg4audio.o
+OBJS-$(CONFIG_MP3ON4FLOAT_DECODER) += mpegaudiodec_float.o mpeg4audio.o
+OBJS-$(CONFIG_MPC7_DECODER) += mpc7.o mpc.o
+OBJS-$(CONFIG_MPC8_DECODER) += mpc8.o mpc.o
OBJS-$(CONFIG_MPEG_XVMC_DECODER) += mpegvideo_xvmc.o
-OBJS-$(CONFIG_MPEG1VIDEO_DECODER) += mpeg12.o mpeg12data.o \
- mpegvideo.o error_resilience.o
-OBJS-$(CONFIG_MPEG1VIDEO_ENCODER) += mpeg12enc.o mpegvideo_enc.o \
- motion_est.o ratecontrol.o \
- mpeg12.o mpeg12data.o \
- mpegvideo.o error_resilience.o
+OBJS-$(CONFIG_MPEG1VIDEO_DECODER) += mpeg12.o mpeg12data.o
+OBJS-$(CONFIG_MPEG1VIDEO_ENCODER) += mpeg12enc.o mpeg12.o
OBJS-$(CONFIG_MPEG2_DXVA2_HWACCEL) += dxva2_mpeg2.o
OBJS-$(CONFIG_MPEG2_VAAPI_HWACCEL) += vaapi_mpeg2.o
-OBJS-$(CONFIG_MPEG2VIDEO_DECODER) += mpeg12.o mpeg12data.o \
- mpegvideo.o error_resilience.o
-OBJS-$(CONFIG_MPEG2VIDEO_ENCODER) += mpeg12enc.o mpegvideo_enc.o \
- motion_est.o ratecontrol.o \
- mpeg12.o mpeg12data.o \
- mpegvideo.o error_resilience.o
+OBJS-$(CONFIG_MPEG2VIDEO_DECODER) += mpeg12.o mpeg12data.o
+OBJS-$(CONFIG_MPEG2VIDEO_ENCODER) += mpeg12enc.o mpeg12.o
OBJS-$(CONFIG_MPEG4_VAAPI_HWACCEL) += vaapi_mpeg4.o
OBJS-$(CONFIG_MSMPEG4V1_DECODER) += msmpeg4.o msmpeg4data.o
OBJS-$(CONFIG_MSMPEG4V2_DECODER) += msmpeg4.o msmpeg4data.o h263dec.o \
h263.o ituh263dec.o mpeg4videodec.o
-OBJS-$(CONFIG_MSMPEG4V2_ENCODER) += msmpeg4.o msmpeg4data.o h263dec.o \
- h263.o ituh263dec.o mpeg4videodec.o
+OBJS-$(CONFIG_MSMPEG4V2_ENCODER) += msmpeg4.o msmpeg4enc.o msmpeg4data.o \
+ h263dec.o h263.o ituh263dec.o \
+ mpeg4videodec.o
OBJS-$(CONFIG_MSMPEG4V3_DECODER) += msmpeg4.o msmpeg4data.o h263dec.o \
h263.o ituh263dec.o mpeg4videodec.o
-OBJS-$(CONFIG_MSMPEG4V3_ENCODER) += msmpeg4.o msmpeg4data.o h263dec.o \
- h263.o ituh263dec.o mpeg4videodec.o
+OBJS-$(CONFIG_MSMPEG4V3_ENCODER) += msmpeg4.o msmpeg4enc.o msmpeg4data.o \
+ h263dec.o h263.o ituh263dec.o \
+ mpeg4videodec.o
OBJS-$(CONFIG_MSRLE_DECODER) += msrle.o msrledec.o
+OBJS-$(CONFIG_MSA1_DECODER) += mss3.o mss34dsp.o
+OBJS-$(CONFIG_MSS1_DECODER) += mss1.o mss12.o
+OBJS-$(CONFIG_MSS2_DECODER) += mss2.o mss12.o mss2dsp.o
OBJS-$(CONFIG_MSVIDEO1_DECODER) += msvideo1.o
OBJS-$(CONFIG_MSZH_DECODER) += lcldec.o
+OBJS-$(CONFIG_MTS2_DECODER) += mss4.o mss34dsp.o
OBJS-$(CONFIG_MXPEG_DECODER) += mxpegdec.o mjpegdec.o mjpeg.o
OBJS-$(CONFIG_NELLYMOSER_DECODER) += nellymoserdec.o nellymoser.o
OBJS-$(CONFIG_NELLYMOSER_ENCODER) += nellymoserenc.o nellymoser.o
@@ -295,18 +287,17 @@ OBJS-$(CONFIG_PGMYUV_DECODER) += pnmdec.o pnm.o
OBJS-$(CONFIG_PGMYUV_ENCODER) += pnmenc.o pnm.o
OBJS-$(CONFIG_PGSSUB_DECODER) += pgssubdec.o
OBJS-$(CONFIG_PICTOR_DECODER) += pictordec.o cga_data.o
-OBJS-$(CONFIG_PNG_DECODER) += png.o pngdec.o
+OBJS-$(CONFIG_PNG_DECODER) += png.o pngdec.o pngdsp.o
OBJS-$(CONFIG_PNG_ENCODER) += png.o pngenc.o
OBJS-$(CONFIG_PPM_DECODER) += pnmdec.o pnm.o
OBJS-$(CONFIG_PPM_ENCODER) += pnmenc.o pnm.o
-OBJS-$(CONFIG_PRORES_DECODER) += proresdec.o proresdsp.o
+OBJS-$(CONFIG_PRORES_DECODER) += proresdec.o proresdata.o proresdsp.o
+OBJS-$(CONFIG_PRORES_ENCODER) += proresenc.o proresdata.o proresdsp.o
OBJS-$(CONFIG_PTX_DECODER) += ptx.o
-OBJS-$(CONFIG_QCELP_DECODER) += qcelpdec.o celp_math.o \
+OBJS-$(CONFIG_QCELP_DECODER) += qcelpdec.o \
celp_filters.o acelp_vectors.o \
acelp_filters.o
-OBJS-$(CONFIG_QDM2_DECODER) += qdm2.o mpegaudiodec.o \
- mpegaudiodecheader.o mpegaudio.o \
- mpegaudiodata.o
+OBJS-$(CONFIG_QDM2_DECODER) += qdm2.o
OBJS-$(CONFIG_QDRAW_DECODER) += qdrw.o
OBJS-$(CONFIG_QPEG_DECODER) += qpeg.o
OBJS-$(CONFIG_QTRLE_DECODER) += qtrle.o
@@ -315,7 +306,8 @@ OBJS-$(CONFIG_R10K_DECODER) += r210dec.o
OBJS-$(CONFIG_R210_DECODER) += r210dec.o
OBJS-$(CONFIG_RA_144_DECODER) += ra144dec.o ra144.o celp_filters.o
OBJS-$(CONFIG_RA_144_ENCODER) += ra144enc.o ra144.o celp_filters.o
-OBJS-$(CONFIG_RA_288_DECODER) += ra288.o celp_math.o celp_filters.o
+OBJS-$(CONFIG_RA_288_DECODER) += ra288.o celp_filters.o
+OBJS-$(CONFIG_RALF_DECODER) += ralf.o
OBJS-$(CONFIG_RAWVIDEO_DECODER) += rawdec.o
OBJS-$(CONFIG_RAWVIDEO_ENCODER) += rawenc.o
OBJS-$(CONFIG_RL2_DECODER) += rl2.o
@@ -328,10 +320,8 @@ 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 rv34dsp.o \
- mpegvideo.o error_resilience.o
-OBJS-$(CONFIG_RV40_DECODER) += rv40.o rv34.o rv34dsp.o rv40dsp.o \
- mpegvideo.o error_resilience.o
+OBJS-$(CONFIG_RV30_DECODER) += rv30.o rv34.o rv30dsp.o rv34dsp.o
+OBJS-$(CONFIG_RV40_DECODER) += rv40.o rv34.o rv34dsp.o rv40dsp.o
OBJS-$(CONFIG_S302M_DECODER) += s302m.o
OBJS-$(CONFIG_SGI_DECODER) += sgidec.o
OBJS-$(CONFIG_SGI_ENCODER) += sgienc.o rle.o
@@ -343,29 +333,22 @@ OBJS-$(CONFIG_SIPR_DECODER) += sipr.o acelp_pitch_delay.o \
OBJS-$(CONFIG_SMACKAUD_DECODER) += smacker.o
OBJS-$(CONFIG_SMACKER_DECODER) += smacker.o
OBJS-$(CONFIG_SMC_DECODER) += smc.o
-OBJS-$(CONFIG_SNOW_DECODER) += snowdec.o snow.o rangecoder.o
-OBJS-$(CONFIG_SNOW_ENCODER) += snowenc.o snow.o rangecoder.o \
- motion_est.o ratecontrol.o \
- h263.o mpegvideo.o \
- error_resilience.o ituh263enc.o \
- mpegvideo_enc.o mpeg12data.o
+OBJS-$(CONFIG_SNOW_DECODER) += snowdec.o snow.o
+OBJS-$(CONFIG_SNOW_ENCODER) += snowenc.o snow.o \
+ h263.o ituh263enc.o
OBJS-$(CONFIG_SOL_DPCM_DECODER) += dpcm.o
OBJS-$(CONFIG_SP5X_DECODER) += sp5xdec.o mjpegdec.o mjpeg.o
OBJS-$(CONFIG_SRT_DECODER) += srtdec.o ass.o
OBJS-$(CONFIG_SUNRAST_DECODER) += sunrast.o
-OBJS-$(CONFIG_SVQ1_DECODER) += svq1dec.o svq1.o h263.o \
- mpegvideo.o error_resilience.o
+OBJS-$(CONFIG_SUNRAST_ENCODER) += sunrastenc.o
+OBJS-$(CONFIG_SVQ1_DECODER) += svq1dec.o svq1.o svq13.o h263.o
OBJS-$(CONFIG_SVQ1_ENCODER) += svq1enc.o svq1.o \
- motion_est.o h263.o \
- mpegvideo.o error_resilience.o \
- ituh263enc.o mpegvideo_enc.o \
- ratecontrol.o mpeg12data.o
-OBJS-$(CONFIG_SVQ3_DECODER) += h264.o svq3.o \
+ h263.o ituh263enc.o
+OBJS-$(CONFIG_SVQ3_DECODER) += svq3.o svq13.o h263.o h264.o \
h264_loopfilter.o h264_direct.o \
h264_sei.o h264_ps.o h264_refs.o \
- h264_cavlc.o h264_cabac.o cabac.o \
- mpegvideo.o error_resilience.o \
- svq1dec.o svq1.o h263.o
+ h264_cavlc.o h264_cabac.o cabac.o
+OBJS-$(CONFIG_TAK_DECODER) += takdec.o tak.o
OBJS-$(CONFIG_TARGA_DECODER) += targa.o
OBJS-$(CONFIG_TARGA_ENCODER) += targaenc.o rle.o
OBJS-$(CONFIG_THEORA_DECODER) += xiph.o
@@ -378,11 +361,13 @@ OBJS-$(CONFIG_TRUEMOTION1_DECODER) += truemotion1.o
OBJS-$(CONFIG_TRUEMOTION2_DECODER) += truemotion2.o
OBJS-$(CONFIG_TRUESPEECH_DECODER) += truespeech.o
OBJS-$(CONFIG_TSCC_DECODER) += tscc.o msrledec.o
+OBJS-$(CONFIG_TSCC2_DECODER) += tscc2.o
OBJS-$(CONFIG_TTA_DECODER) += tta.o
-OBJS-$(CONFIG_TWINVQ_DECODER) += twinvq.o celp_math.o
+OBJS-$(CONFIG_TWINVQ_DECODER) += twinvq.o
OBJS-$(CONFIG_TXD_DECODER) += txd.o s3tc.o
OBJS-$(CONFIG_ULTI_DECODER) += ulti.o
-OBJS-$(CONFIG_UTVIDEO_DECODER) += utvideo.o
+OBJS-$(CONFIG_UTVIDEO_DECODER) += utvideodec.o utvideo.o
+OBJS-$(CONFIG_UTVIDEO_ENCODER) += utvideoenc.o utvideo.o
OBJS-$(CONFIG_V210_DECODER) += v210dec.o
OBJS-$(CONFIG_V210_ENCODER) += v210enc.o
OBJS-$(CONFIG_V410_DECODER) += v410dec.o
@@ -404,38 +389,43 @@ OBJS-$(CONFIG_VORBIS_DECODER) += vorbisdec.o vorbis.o \
vorbis_data.o xiph.o
OBJS-$(CONFIG_VORBIS_ENCODER) += vorbisenc.o vorbis.o \
vorbis_data.o
-OBJS-$(CONFIG_VP3_DECODER) += vp3.o vp3dsp.o
+OBJS-$(CONFIG_VP3_DECODER) += vp3.o
OBJS-$(CONFIG_VP5_DECODER) += vp5.o vp56.o vp56data.o vp56dsp.o \
- vp3dsp.o vp56rac.o
+ vp56rac.o
OBJS-$(CONFIG_VP6_DECODER) += vp6.o vp56.o vp56data.o vp56dsp.o \
- vp3dsp.o vp6dsp.o vp56rac.o
+ vp6dsp.o vp56rac.o
OBJS-$(CONFIG_VP8_DECODER) += vp8.o vp8dsp.o vp56rac.o
OBJS-$(CONFIG_VQA_DECODER) += vqavideo.o
OBJS-$(CONFIG_WAVPACK_DECODER) += wavpack.o
-OBJS-$(CONFIG_WMAPRO_DECODER) += wmaprodec.o wma.o
-OBJS-$(CONFIG_WMAV1_DECODER) += wmadec.o wma.o aactab.o
-OBJS-$(CONFIG_WMAV1_ENCODER) += wmaenc.o wma.o aactab.o
-OBJS-$(CONFIG_WMAV2_DECODER) += wmadec.o wma.o aactab.o
-OBJS-$(CONFIG_WMAV2_ENCODER) += wmaenc.o wma.o aactab.o
+OBJS-$(CONFIG_WMALOSSLESS_DECODER) += wmalosslessdec.o wma_common.o
+OBJS-$(CONFIG_WMAPRO_DECODER) += wmaprodec.o wma.o wma_common.o
+OBJS-$(CONFIG_WMAV1_DECODER) += wmadec.o wma.o wma_common.o aactab.o
+OBJS-$(CONFIG_WMAV1_ENCODER) += wmaenc.o wma.o wma_common.o aactab.o
+OBJS-$(CONFIG_WMAV2_DECODER) += wmadec.o wma.o wma_common.o aactab.o
+OBJS-$(CONFIG_WMAV2_ENCODER) += wmaenc.o wma.o wma_common.o aactab.o
OBJS-$(CONFIG_WMAVOICE_DECODER) += wmavoice.o \
- celp_math.o celp_filters.o \
+ celp_filters.o \
acelp_vectors.o acelp_filters.o
OBJS-$(CONFIG_WMV1_DECODER) += msmpeg4.o msmpeg4data.o
OBJS-$(CONFIG_WMV2_DECODER) += wmv2dec.o wmv2.o \
msmpeg4.o msmpeg4data.o \
intrax8.o intrax8dsp.o
OBJS-$(CONFIG_WMV2_ENCODER) += wmv2enc.o wmv2.o \
- msmpeg4.o msmpeg4data.o \
+ msmpeg4.o msmpeg4enc.o msmpeg4data.o \
mpeg4videodec.o ituh263dec.o h263dec.o
OBJS-$(CONFIG_WNV1_DECODER) += wnv1.o
OBJS-$(CONFIG_WS_SND1_DECODER) += ws-snd1.o
OBJS-$(CONFIG_XAN_DPCM_DECODER) += dpcm.o
OBJS-$(CONFIG_XAN_WC3_DECODER) += xan.o
OBJS-$(CONFIG_XAN_WC4_DECODER) += xxan.o
+OBJS-$(CONFIG_XBM_ENCODER) += xbmenc.o
OBJS-$(CONFIG_XL_DECODER) += xl.o
OBJS-$(CONFIG_XSUB_DECODER) += xsubdec.o
OBJS-$(CONFIG_XSUB_ENCODER) += xsubenc.o
+OBJS-$(CONFIG_XWD_DECODER) += xwddec.o
+OBJS-$(CONFIG_XWD_ENCODER) += xwdenc.o
OBJS-$(CONFIG_YOP_DECODER) += yop.o
+OBJS-$(CONFIG_ZEROCODEC_DECODER) += zerocodec.o
OBJS-$(CONFIG_ZLIB_DECODER) += lcldec.o
OBJS-$(CONFIG_ZLIB_ENCODER) += lclenc.o
OBJS-$(CONFIG_ZMBV_DECODER) += zmbv.o
@@ -446,7 +436,6 @@ OBJS-$(CONFIG_PCM_ALAW_DECODER) += pcm.o
OBJS-$(CONFIG_PCM_ALAW_ENCODER) += pcm.o
OBJS-$(CONFIG_PCM_BLURAY_DECODER) += pcm-mpeg.o
OBJS-$(CONFIG_PCM_DVD_DECODER) += pcm.o
-OBJS-$(CONFIG_PCM_DVD_ENCODER) += pcm.o
OBJS-$(CONFIG_PCM_F32BE_DECODER) += pcm.o
OBJS-$(CONFIG_PCM_F32BE_ENCODER) += pcm.o
OBJS-$(CONFIG_PCM_F32LE_DECODER) += pcm.o
@@ -507,6 +496,7 @@ OBJS-$(CONFIG_ADPCM_G722_ENCODER) += g722.o g722enc.o
OBJS-$(CONFIG_ADPCM_G726_DECODER) += g726.o
OBJS-$(CONFIG_ADPCM_G726_ENCODER) += g726.o
OBJS-$(CONFIG_ADPCM_IMA_AMV_DECODER) += adpcm.o adpcm_data.o
+OBJS-$(CONFIG_ADPCM_IMA_APC_DECODER) += adpcm.o adpcm_data.o
OBJS-$(CONFIG_ADPCM_IMA_DK3_DECODER) += adpcm.o adpcm_data.o
OBJS-$(CONFIG_ADPCM_IMA_DK4_DECODER) += adpcm.o adpcm_data.o
OBJS-$(CONFIG_ADPCM_IMA_EA_EACS_DECODER) += adpcm.o adpcm_data.o
@@ -535,75 +525,87 @@ OBJS-$(CONFIG_ADTS_MUXER) += mpeg4audio.o
OBJS-$(CONFIG_ADX_DEMUXER) += adx.o
OBJS-$(CONFIG_CAF_DEMUXER) += mpeg4audio.o mpegaudiodata.o \
ac3tab.o
-OBJS-$(CONFIG_DV_DEMUXER) += dvdata.o
-OBJS-$(CONFIG_DV_MUXER) += dvdata.o
-OBJS-$(CONFIG_FLAC_DEMUXER) += flacdec.o flacdata.o flac.o
-OBJS-$(CONFIG_FLAC_MUXER) += flacdec.o flacdata.o flac.o
+OBJS-$(CONFIG_DV_DEMUXER) += dv_profile.o
+OBJS-$(CONFIG_DV_MUXER) += dv_profile.o
+OBJS-$(CONFIG_FLAC_DEMUXER) += flac.o flacdata.o \
+ vorbis_parser.o xiph.o
+OBJS-$(CONFIG_FLAC_MUXER) += flac.o flacdata.o
OBJS-$(CONFIG_FLV_DEMUXER) += mpeg4audio.o
OBJS-$(CONFIG_GXF_DEMUXER) += mpeg12data.o
OBJS-$(CONFIG_IFF_DEMUXER) += iff.o
+OBJS-$(CONFIG_ISMV_MUXER) += mpeg4audio.o mpegaudiodata.o
OBJS-$(CONFIG_LATM_MUXER) += mpeg4audio.o
-OBJS-$(CONFIG_MATROSKA_AUDIO_MUXER) += xiph.o mpeg4audio.o \
- flacdec.o flacdata.o flac.o
+OBJS-$(CONFIG_MATROSKA_AUDIO_MUXER) += xiph.o mpeg4audio.o \
+ flac.o flacdata.o
OBJS-$(CONFIG_MATROSKA_DEMUXER) += mpeg4audio.o mpegaudiodata.o
-OBJS-$(CONFIG_MATROSKA_MUXER) += xiph.o mpeg4audio.o \
- flacdec.o flacdata.o flac.o \
- mpegaudiodata.o
+OBJS-$(CONFIG_MATROSKA_MUXER) += mpeg4audio.o mpegaudiodata.o \
+ flac.o flacdata.o xiph.o
+OBJS-$(CONFIG_MP2_MUXER) += mpegaudiodata.o mpegaudiodecheader.o
OBJS-$(CONFIG_MP3_MUXER) += mpegaudiodata.o mpegaudiodecheader.o
OBJS-$(CONFIG_MOV_DEMUXER) += mpeg4audio.o mpegaudiodata.o ac3tab.o
OBJS-$(CONFIG_MOV_MUXER) += mpeg4audio.o mpegaudiodata.o
-OBJS-$(CONFIG_MPEGTS_MUXER) += mpegvideo.o mpeg4audio.o
+OBJS-$(CONFIG_MPEGTS_MUXER) += mpeg4audio.o
OBJS-$(CONFIG_MPEGTS_DEMUXER) += mpeg4audio.o mpegaudiodata.o
OBJS-$(CONFIG_NUT_MUXER) += mpegaudiodata.o
-OBJS-$(CONFIG_OGG_DEMUXER) += flacdec.o flacdata.o flac.o \
- dirac.o mpeg12data.o
-OBJS-$(CONFIG_OGG_MUXER) += xiph.o flacdec.o flacdata.o flac.o
-OBJS-$(CONFIG_RTP_MUXER) += mpeg4audio.o mpegvideo.o xiph.o
+OBJS-$(CONFIG_OGG_DEMUXER) += xiph.o flac.o flacdata.o \
+ mpeg12data.o vorbis_parser.o \
+ dirac.o
+OBJS-$(CONFIG_OGG_MUXER) += xiph.o flac.o flacdata.o
+OBJS-$(CONFIG_RTP_MUXER) += mpeg4audio.o xiph.o
+OBJS-$(CONFIG_RTPDEC) += mjpeg.o
OBJS-$(CONFIG_SPDIF_DEMUXER) += aacadtsdec.o mpeg4audio.o
-OBJS-$(CONFIG_WEBM_MUXER) += xiph.o mpeg4audio.o \
- flacdec.o flacdata.o flac.o \
- mpegaudiodata.o
+OBJS-$(CONFIG_SPDIF_MUXER) += dca.o
+OBJS-$(CONFIG_TAK_DEMUXER) += tak.o
+OBJS-$(CONFIG_WEBM_MUXER) += mpeg4audio.o mpegaudiodata.o \
+ xiph.o flac.o flacdata.o
OBJS-$(CONFIG_WTV_DEMUXER) += mpeg4audio.o mpegaudiodata.o
# external codec libraries
-OBJS-$(CONFIG_LIBDIRAC_DECODER) += libdiracdec.o
-OBJS-$(CONFIG_LIBDIRAC_ENCODER) += libdiracenc.o libdirac_libschro.o
OBJS-$(CONFIG_LIBFAAC_ENCODER) += libfaac.o
+OBJS-$(CONFIG_LIBFDK_AAC_ENCODER) += libfdk-aacenc.o
OBJS-$(CONFIG_LIBGSM_DECODER) += libgsm.o
OBJS-$(CONFIG_LIBGSM_ENCODER) += libgsm.o
OBJS-$(CONFIG_LIBGSM_MS_DECODER) += libgsm.o
OBJS-$(CONFIG_LIBGSM_MS_ENCODER) += libgsm.o
-OBJS-$(CONFIG_LIBMP3LAME_ENCODER) += libmp3lame.o
+OBJS-$(CONFIG_LIBILBC_DECODER) += libilbc.o
+OBJS-$(CONFIG_LIBILBC_ENCODER) += libilbc.o
+OBJS-$(CONFIG_LIBMP3LAME_ENCODER) += libmp3lame.o mpegaudiodecheader.o
OBJS-$(CONFIG_LIBOPENCORE_AMRNB_DECODER) += libopencore-amr.o
OBJS-$(CONFIG_LIBOPENCORE_AMRNB_ENCODER) += libopencore-amr.o
OBJS-$(CONFIG_LIBOPENCORE_AMRWB_DECODER) += libopencore-amr.o
-OBJS-$(CONFIG_LIBOPENJPEG_DECODER) += libopenjpeg.o
+OBJS-$(CONFIG_LIBOPENJPEG_DECODER) += libopenjpegdec.o
+OBJS-$(CONFIG_LIBOPENJPEG_ENCODER) += libopenjpegenc.o
+OBJS-$(CONFIG_LIBOPUS_DECODER) += libopusdec.o libopus.o \
+ vorbis_data.o
+OBJS-$(CONFIG_LIBOPUS_ENCODER) += libopusenc.o libopus.o \
+ vorbis_data.o
OBJS-$(CONFIG_LIBSCHROEDINGER_DECODER) += libschroedingerdec.o \
- libschroedinger.o \
- libdirac_libschro.o
+ libschroedinger.o
OBJS-$(CONFIG_LIBSCHROEDINGER_ENCODER) += libschroedingerenc.o \
- libschroedinger.o \
- libdirac_libschro.o
+ libschroedinger.o
OBJS-$(CONFIG_LIBSPEEX_DECODER) += libspeexdec.o
OBJS-$(CONFIG_LIBSPEEX_ENCODER) += libspeexenc.o
OBJS-$(CONFIG_LIBTHEORA_ENCODER) += libtheoraenc.o
OBJS-$(CONFIG_LIBVO_AACENC_ENCODER) += libvo-aacenc.o mpeg4audio.o
OBJS-$(CONFIG_LIBVO_AMRWBENC_ENCODER) += libvo-amrwbenc.o
-OBJS-$(CONFIG_LIBVORBIS_ENCODER) += libvorbis.o vorbis_data.o
+OBJS-$(CONFIG_LIBVORBIS_ENCODER) += libvorbis.o \
+ vorbis_data.o vorbis_parser.o
OBJS-$(CONFIG_LIBVPX_DECODER) += libvpxdec.o
OBJS-$(CONFIG_LIBVPX_ENCODER) += libvpxenc.o
OBJS-$(CONFIG_LIBX264_ENCODER) += libx264.o
OBJS-$(CONFIG_LIBXAVS_ENCODER) += libxavs.o
-OBJS-$(CONFIG_LIBXVID) += libxvidff.o libxvid_rc.o
+OBJS-$(CONFIG_LIBXVID_ENCODER) += libxvid.o
# parsers
OBJS-$(CONFIG_AAC_PARSER) += aac_parser.o aac_ac3_parser.o \
aacadtsdec.o mpeg4audio.o
+OBJS-$(CONFIG_AAC_LATM_PARSER) += latm_parser.o
OBJS-$(CONFIG_AC3_PARSER) += ac3_parser.o ac3tab.o \
aac_ac3_parser.o
OBJS-$(CONFIG_ADX_PARSER) += adx_parser.o adx.o
OBJS-$(CONFIG_CAVSVIDEO_PARSER) += cavs_parser.o
-OBJS-$(CONFIG_DCA_PARSER) += dca_parser.o
+OBJS-$(CONFIG_COOK_PARSER) += cook_parser.o
+OBJS-$(CONFIG_DCA_PARSER) += dca_parser.o dca.o
OBJS-$(CONFIG_DIRAC_PARSER) += dirac_parser.o
OBJS-$(CONFIG_DNXHD_PARSER) += dnxhd_parser.o
OBJS-$(CONFIG_DVBSUB_PARSER) += dvbsub_parser.o
@@ -616,26 +618,24 @@ OBJS-$(CONFIG_H264_PARSER) += h264_parser.o h264.o \
cabac.o \
h264_refs.o h264_sei.o h264_direct.o \
h264_loopfilter.o h264_cabac.o \
- h264_cavlc.o h264_ps.o \
- mpegvideo.o error_resilience.o
-OBJS-$(CONFIG_AAC_LATM_PARSER) += latm_parser.o
+ h264_cavlc.o h264_ps.o
OBJS-$(CONFIG_MJPEG_PARSER) += mjpeg_parser.o
OBJS-$(CONFIG_MLP_PARSER) += mlp_parser.o mlp.o
OBJS-$(CONFIG_MPEG4VIDEO_PARSER) += mpeg4video_parser.o h263.o \
- mpegvideo.o error_resilience.o \
mpeg4videodec.o mpeg4video.o \
ituh263dec.o h263dec.o
OBJS-$(CONFIG_MPEGAUDIO_PARSER) += mpegaudio_parser.o \
mpegaudiodecheader.o mpegaudiodata.o
OBJS-$(CONFIG_MPEGVIDEO_PARSER) += mpegvideo_parser.o \
- mpeg12.o mpeg12data.o \
- mpegvideo.o error_resilience.o
+ mpeg12.o mpeg12data.o
OBJS-$(CONFIG_PNM_PARSER) += pnm_parser.o pnm.o
OBJS-$(CONFIG_RV30_PARSER) += rv34_parser.o
OBJS-$(CONFIG_RV40_PARSER) += rv34_parser.o
+OBJS-$(CONFIG_TAK_PARSER) += tak_parser.o tak.o
OBJS-$(CONFIG_VC1_PARSER) += vc1_parser.o vc1.o vc1data.o \
msmpeg4.o msmpeg4data.o mpeg4video.o \
- h263.o mpegvideo.o error_resilience.o
+ h263.o
+OBJS-$(CONFIG_VORBIS_PARSER) += vorbis_parser.o xiph.o
OBJS-$(CONFIG_VP3_PARSER) += vp3_parser.o
OBJS-$(CONFIG_VP8_PARSER) += vp8_parser.o
@@ -660,46 +660,47 @@ OBJS-$(CONFIG_TEXT2MOVSUB_BSF) += movsub_bsf.o
OBJS-$(HAVE_PTHREADS) += pthread.o
OBJS-$(HAVE_W32THREADS) += pthread.o
-OBJS-$(CONFIG_MLIB) += mlib/dsputil_mlib.o \
-
-# inverse.o contains the ff_inverse table definition, which is used by
-# the FASTDIV macro (from libavutil); since referencing the external
-# table has a negative effect on performance, copy it in libavcodec as
-# well.
-OBJS-$(!CONFIG_SMALL) += inverse.o
-
--include $(SRC_PATH)/$(SUBDIR)$(ARCH)/Makefile
-
SKIPHEADERS += %_tablegen.h \
%_tables.h \
aac_tablegen_decl.h \
fft-internal.h \
+ old_codec_ids.h \
tableprint.h \
- $(ARCH)/vp56_arith.h
+ $(ARCH)/vp56_arith.h \
+
SKIPHEADERS-$(CONFIG_DXVA2) += dxva2.h dxva2_internal.h
-SKIPHEADERS-$(CONFIG_LIBDIRAC) += libdirac.h
SKIPHEADERS-$(CONFIG_LIBSCHROEDINGER) += libschroedinger.h
+SKIPHEADERS-$(CONFIG_MPEG_XVMC_DECODER) += xvmc.h
SKIPHEADERS-$(CONFIG_VAAPI) += vaapi_internal.h
-SKIPHEADERS-$(CONFIG_VDA) += vda.h vda_internal.h
+SKIPHEADERS-$(CONFIG_VDA) += vda.h
SKIPHEADERS-$(CONFIG_VDPAU) += vdpau.h
-SKIPHEADERS-$(CONFIG_XVMC) += xvmc.h
SKIPHEADERS-$(HAVE_W32THREADS) += w32pthreads.h
EXAMPLES = api
-TESTPROGS = cabac dct fft fft-fixed h264 iirfilter rangecoder
-TESTPROGS-$(HAVE_MMX) += motion
-TESTOBJS = dctref.o
+TESTPROGS = dct \
+ fft \
+ fft-fixed \
+ golomb \
+ iirfilter \
+ rangecoder \
-HOSTPROGS = aac_tablegen aacps_tablegen cbrt_tablegen cos_tablegen \
- dv_tablegen motionpixels_tablegen mpegaudio_tablegen \
- pcm_tablegen qdm2_tablegen sinewin_tablegen
+TESTOBJS = dctref.o
-DIRS = alpha arm bfin mlib ppc ps2 sh4 sparc x86
+HOSTPROGS = aac_tablegen \
+ aacps_tablegen \
+ cbrt_tablegen \
+ cos_tablegen \
+ dv_tablegen \
+ motionpixels_tablegen \
+ mpegaudio_tablegen \
+ pcm_tablegen \
+ qdm2_tablegen \
+ sinewin_tablegen \
CLEANFILES = *_tables.c *_tables.h *_tablegen$(HOSTEXESUF)
-$(SUBDIR)dct-test$(EXESUF): $(SUBDIR)dctref.o
+$(SUBDIR)dct-test$(EXESUF): $(SUBDIR)dctref.o $(SUBDIR)aandcttab.o
TRIG_TABLES = cos cos_fixed sin
TRIG_TABLES := $(TRIG_TABLES:%=$(SUBDIR)%_tables.c)
diff --git a/gst-libs/ext/libav/libavcodec/a64enc.h b/gst-libs/ext/libav/libavcodec/a64enc.h
index b64b952..d5f8e9a 100644
--- a/gst-libs/ext/libav/libavcodec/a64enc.h
+++ b/gst-libs/ext/libav/libavcodec/a64enc.h
@@ -41,7 +41,7 @@ typedef struct A64Context {
AVLFG randctx;
int mc_lifetime;
int mc_use_5col;
- int mc_frame_counter;
+ unsigned mc_frame_counter;
int *mc_meta_charset;
int *mc_charmap;
int *mc_best_cb;
@@ -50,6 +50,9 @@ typedef struct A64Context {
uint8_t *mc_colram;
uint8_t *mc_palette;
int mc_pal_size;
+
+ /* pts of the next packet that will be output */
+ int64_t next_pts;
} A64Context;
#endif /* AVCODEC_A64ENC_H */
diff --git a/gst-libs/ext/libav/libavcodec/a64multienc.c b/gst-libs/ext/libav/libavcodec/a64multienc.c
index 532f2a2..beddf9f 100644
--- a/gst-libs/ext/libav/libavcodec/a64multienc.c
+++ b/gst-libs/ext/libav/libavcodec/a64multienc.c
@@ -28,6 +28,8 @@
#include "a64colors.h"
#include "a64tables.h"
#include "elbg.h"
+#include "internal.h"
+#include "libavutil/common.h"
#include "libavutil/intreadwrite.h"
#define DITHERSTEPS 8
@@ -186,7 +188,7 @@ static av_cold int a64multi_init_encoder(AVCodecContext *avctx)
av_log(avctx, AV_LOG_INFO, "charset lifetime set to %d frame(s)\n", c->mc_lifetime);
c->mc_frame_counter = 0;
- c->mc_use_5col = avctx->codec->id == CODEC_ID_A64_MULTI5;
+ c->mc_use_5col = avctx->codec->id == AV_CODEC_ID_A64_MULTI5;
c->mc_pal_size = 4 + c->mc_use_5col;
/* precalc luma values for later use */
@@ -221,6 +223,8 @@ static av_cold int a64multi_init_encoder(AVCodecContext *avctx)
if (!avctx->codec_tag)
avctx->codec_tag = AV_RL32("a64m");
+ c->next_pts = AV_NOPTS_VALUE;
+
return 0;
}
@@ -239,19 +243,19 @@ static void a64_compress_colram(unsigned char *buf, int *charmap, uint8_t *colra
}
}
-static int a64multi_encode_frame(AVCodecContext *avctx, unsigned char *buf,
- int buf_size, void *data)
+static int a64multi_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
+ const AVFrame *pict, int *got_packet)
{
A64Context *c = avctx->priv_data;
- AVFrame *pict = data;
- AVFrame *const p = (AVFrame *) & c->picture;
+ AVFrame *const p = &c->picture;
int frame;
int x, y;
int b_height;
int b_width;
- int req_size;
+ int req_size, ret;
+ uint8_t *buf;
int *charmap = c->mc_charmap;
uint8_t *colram = c->mc_colram;
@@ -274,7 +278,7 @@ static int a64multi_encode_frame(AVCodecContext *avctx, unsigned char *buf,
}
/* no data, means end encoding asap */
- if (!data) {
+ if (!pict) {
/* all done, end encoding */
if (!c->mc_lifetime) return 0;
/* no more frames in queue, prepare to flush remaining frames */
@@ -292,6 +296,8 @@ static int a64multi_encode_frame(AVCodecContext *avctx, unsigned char *buf,
p->key_frame = 1;
to_meta_with_crop(avctx, p, meta + 32000 * c->mc_frame_counter);
c->mc_frame_counter++;
+ if (c->next_pts == AV_NOPTS_VALUE)
+ c->next_pts = pict->pts;
/* lifetime is not reached so wait for next frame first */
return 0;
}
@@ -302,6 +308,13 @@ static int a64multi_encode_frame(AVCodecContext *avctx, unsigned char *buf,
req_size = 0;
/* any frames to encode? */
if (c->mc_lifetime) {
+ req_size = charset_size + c->mc_lifetime*(screen_size + colram_size);
+ if ((ret = ff_alloc_packet(pkt, req_size)) < 0) {
+ av_log(avctx, AV_LOG_ERROR, "Error getting output packet of size %d.\n", req_size);
+ return ret;
+ }
+ buf = pkt->data;
+
/* calc optimal new charset + charmaps */
ff_init_elbg(meta, 32, 1000 * c->mc_lifetime, best_cb, CHARSET_CHARS, 50, charmap, &c->randctx);
ff_do_elbg (meta, 32, 1000 * c->mc_lifetime, best_cb, CHARSET_CHARS, 50, charmap, &c->randctx);
@@ -310,15 +323,12 @@ static int a64multi_encode_frame(AVCodecContext *avctx, unsigned char *buf,
render_charset(avctx, charset, colram);
/* copy charset to buf */
- memcpy(buf,charset, charset_size);
+ memcpy(buf, charset, charset_size);
/* advance pointers */
buf += charset_size;
charset += charset_size;
- req_size += charset_size;
}
- /* no charset so clean buf */
- else memset(buf, 0, charset_size);
/* write x frames to buf */
for (frame = 0; frame < c->mc_lifetime; frame++) {
@@ -351,11 +361,12 @@ static int a64multi_encode_frame(AVCodecContext *avctx, unsigned char *buf,
/* reset counter */
c->mc_frame_counter = 0;
- if (req_size > buf_size) {
- av_log(avctx, AV_LOG_ERROR, "buf size too small (need %d, got %d)\n", req_size, buf_size);
- return -1;
- }
- return req_size;
+ pkt->pts = pkt->dts = c->next_pts;
+ c->next_pts = AV_NOPTS_VALUE;
+
+ pkt->size = req_size;
+ pkt->flags |= AV_PKT_FLAG_KEY;
+ *got_packet = !!req_size;
}
return 0;
}
@@ -363,12 +374,12 @@ static int a64multi_encode_frame(AVCodecContext *avctx, unsigned char *buf,
AVCodec ff_a64multi_encoder = {
.name = "a64multi",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_A64_MULTI,
+ .id = AV_CODEC_ID_A64_MULTI,
.priv_data_size = sizeof(A64Context),
.init = a64multi_init_encoder,
- .encode = a64multi_encode_frame,
+ .encode2 = a64multi_encode_frame,
.close = a64multi_close_encoder,
- .pix_fmts = (const enum PixelFormat[]) {PIX_FMT_GRAY8, PIX_FMT_NONE},
+ .pix_fmts = (const enum AVPixelFormat[]) {AV_PIX_FMT_GRAY8, AV_PIX_FMT_NONE},
.long_name = NULL_IF_CONFIG_SMALL("Multicolor charset for Commodore 64"),
.capabilities = CODEC_CAP_DELAY,
};
@@ -376,12 +387,12 @@ AVCodec ff_a64multi_encoder = {
AVCodec ff_a64multi5_encoder = {
.name = "a64multi5",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_A64_MULTI5,
+ .id = AV_CODEC_ID_A64_MULTI5,
.priv_data_size = sizeof(A64Context),
.init = a64multi_init_encoder,
- .encode = a64multi_encode_frame,
+ .encode2 = a64multi_encode_frame,
.close = a64multi_close_encoder,
- .pix_fmts = (const enum PixelFormat[]) {PIX_FMT_GRAY8, PIX_FMT_NONE},
+ .pix_fmts = (const enum AVPixelFormat[]) {AV_PIX_FMT_GRAY8, AV_PIX_FMT_NONE},
.long_name = NULL_IF_CONFIG_SMALL("Multicolor charset for Commodore 64, extended with 5th color (colram)"),
.capabilities = CODEC_CAP_DELAY,
};
diff --git a/gst-libs/ext/libav/libavcodec/aac.h b/gst-libs/ext/libav/libavcodec/aac.h
index a36080c..6c5d962 100644
--- a/gst-libs/ext/libav/libavcodec/aac.h
+++ b/gst-libs/ext/libav/libavcodec/aac.h
@@ -30,6 +30,7 @@
#ifndef AVCODEC_AAC_H
#define AVCODEC_AAC_H
+#include "libavutil/float_dsp.h"
#include "avcodec.h"
#include "dsputil.h"
#include "fft.h"
@@ -112,10 +113,19 @@ enum OCStatus {
OC_LOCKED, ///< Output configuration locked in place
};
+typedef struct OutputConfiguration {
+ MPEG4AudioConfig m4ac;
+ uint8_t layout_map[MAX_ELEM_ID*4][3];
+ int layout_map_tags;
+ int channels;
+ uint64_t channel_layout;
+ enum OCStatus status;
+} OutputConfiguration;
+
/**
* Predictor State
*/
-typedef struct {
+typedef struct PredictorState {
float cor0;
float cor1;
float var0;
@@ -131,12 +141,11 @@ typedef struct {
#define SCALE_MAX_POS 255 ///< scalefactor index maximum value
#define SCALE_MAX_DIFF 60 ///< maximum scalefactor difference allowed by standard
#define SCALE_DIFF_ZERO 60 ///< codebook index corresponding to zero scalefactor indices difference
-#define POW_SF2_ZERO 200 ///< ff_aac_pow2sf_tab index corresponding to pow(2, 0);
/**
* Long Term Prediction
*/
-typedef struct {
+typedef struct LongTermPrediction {
int8_t present;
int16_t lag;
float coef;
@@ -146,7 +155,7 @@ typedef struct {
/**
* Individual Channel Stream
*/
-typedef struct {
+typedef struct IndividualChannelStream {
uint8_t max_sfb; ///< number of scalefactor bands per group
enum WindowSequence window_sequence[2];
uint8_t use_kb_window[2]; ///< If set, use Kaiser-Bessel window, otherwise use a sinus window.
@@ -167,7 +176,7 @@ typedef struct {
/**
* Temporal Noise Shaping
*/
-typedef struct {
+typedef struct TemporalNoiseShaping {
int present;
int n_filt[8];
int length[8][4];
@@ -179,7 +188,7 @@ typedef struct {
/**
* Dynamic Range Control - decoded from the bitstream but not processed further.
*/
-typedef struct {
+typedef struct DynamicRangeControl {
int pce_instance_tag; ///< Indicates with which program the DRC info is associated.
int dyn_rng_sgn[17]; ///< DRC sign information; 0 - positive, 1 - negative
int dyn_rng_ctl[17]; ///< DRC magnitude information
@@ -192,7 +201,7 @@ typedef struct {
*/
} DynamicRangeControl;
-typedef struct {
+typedef struct Pulse {
int num_pulse;
int start;
int pos[4];
@@ -202,7 +211,7 @@ typedef struct {
/**
* coupling parameters
*/
-typedef struct {
+typedef struct ChannelCoupling {
enum CouplingPoint coupling_point; ///< The point during decoding at which coupling is applied.
int num_coupled; ///< number of target elements
enum RawDataBlockType type[8]; ///< Type of channel element to be coupled - SCE or CPE.
@@ -216,7 +225,7 @@ typedef struct {
/**
* Single Channel Element - used for both SCE and LFE elements.
*/
-typedef struct {
+typedef struct SingleChannelElement {
IndividualChannelStream ics;
TemporalNoiseShaping tns;
Pulse pulse;
@@ -227,15 +236,16 @@ typedef struct {
uint8_t zeroes[128]; ///< band is not coded (used by encoder)
DECLARE_ALIGNED(32, float, coeffs)[1024]; ///< coefficients for IMDCT
DECLARE_ALIGNED(32, float, saved)[1024]; ///< overlap
- DECLARE_ALIGNED(32, float, ret)[2048]; ///< PCM output
+ DECLARE_ALIGNED(32, float, ret_buf)[2048]; ///< PCM output buffer
DECLARE_ALIGNED(16, float, ltp_state)[3072]; ///< time signal for LTP
PredictorState predictor_state[MAX_PREDICTORS];
+ float *ret; ///< PCM output
} SingleChannelElement;
/**
* channel element - generic struct for SCE/CPE/CCE/LFE
*/
-typedef struct {
+typedef struct ChannelElement {
// CPE specific
int common_window; ///< Set if channels share a common 'IndividualChannelStream' in bitstream.
int ms_mode; ///< Signals mid/side stereo flags coding mode (used by encoder)
@@ -250,12 +260,10 @@ typedef struct {
/**
* main AAC context
*/
-typedef struct {
+typedef struct AACContext {
AVCodecContext *avctx;
AVFrame frame;
- MPEG4AudioConfig m4ac;
-
int is_saved; ///< Set if elements have stored overlap from previous frame.
DynamicRangeControl che_drc;
@@ -263,9 +271,6 @@ typedef struct {
* @name Channel element related data
* @{
*/
- enum ChannelPosition che_pos[4][MAX_ELEM_ID]; /**< channel element channel mapping with the
- * first index as the first 4 raw data block types
- */
ChannelElement *che[4][MAX_ELEM_ID];
ChannelElement *tag_che_map[4][MAX_ELEM_ID];
int tags_mapped;
@@ -288,19 +293,20 @@ typedef struct {
FFTContext mdct_ltp;
DSPContext dsp;
FmtConvertContext fmt_conv;
+ AVFloatDSPContext fdsp;
int random_state;
/** @} */
/**
- * @name Members used for output interleaving
+ * @name Members used for output
* @{
*/
- float *output_data[MAX_CHANNELS]; ///< Points to each element's 'ret' buffer (PCM output).
+ SingleChannelElement *output_element[MAX_CHANNELS]; ///< Points to each SingleChannelElement
/** @} */
DECLARE_ALIGNED(32, float, temp)[128];
- enum OCStatus output_configured;
+ OutputConfiguration oc[2];
} AACContext;
#endif /* AVCODEC_AAC_H */
diff --git a/gst-libs/ext/libav/libavcodec/aac_ac3_parser.c b/gst-libs/ext/libav/libavcodec/aac_ac3_parser.c
index 58f30a4..b17cd4d 100644
--- a/gst-libs/ext/libav/libavcodec/aac_ac3_parser.c
+++ b/gst-libs/ext/libav/libavcodec/aac_ac3_parser.c
@@ -20,6 +20,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "libavutil/common.h"
#include "parser.h"
#include "aac_ac3_parser.h"
@@ -78,7 +79,7 @@ get_next:
and total number of samples found in an AAC ADTS header are not
reliable. Bit rate is still accurate because the total frame duration in
seconds is still correct (as is the number of bits in the frame). */
- if (avctx->codec_id != CODEC_ID_AAC) {
+ if (avctx->codec_id != AV_CODEC_ID_AAC) {
avctx->sample_rate = s->sample_rate;
/* allow downmixing to stereo (or mono for AC-3) */
@@ -86,14 +87,14 @@ get_next:
avctx->request_channels < s->channels &&
(avctx->request_channels <= 2 ||
(avctx->request_channels == 1 &&
- (avctx->codec_id == CODEC_ID_AC3 ||
- avctx->codec_id == CODEC_ID_EAC3)))) {
+ (avctx->codec_id == AV_CODEC_ID_AC3 ||
+ avctx->codec_id == AV_CODEC_ID_EAC3)))) {
avctx->channels = avctx->request_channels;
} else {
avctx->channels = s->channels;
avctx->channel_layout = s->channel_layout;
}
- avctx->frame_size = s->samples;
+ s1->duration = s->samples;
avctx->audio_service_type = s->service_type;
}
diff --git a/gst-libs/ext/libav/libavcodec/aac_ac3_parser.h b/gst-libs/ext/libav/libavcodec/aac_ac3_parser.h
index a14fce5..90b49c5 100644
--- a/gst-libs/ext/libav/libavcodec/aac_ac3_parser.h
+++ b/gst-libs/ext/libav/libavcodec/aac_ac3_parser.h
@@ -55,7 +55,7 @@ typedef struct AACAC3ParseContext {
uint64_t state;
int need_next_header;
- enum CodecID codec_id;
+ enum AVCodecID codec_id;
} AACAC3ParseContext;
int ff_aac_ac3_parse(AVCodecParserContext *s1,
diff --git a/gst-libs/ext/libav/libavcodec/aac_adtstoasc_bsf.c b/gst-libs/ext/libav/libavcodec/aac_adtstoasc_bsf.c
index 55181bb..df9a395 100644
--- a/gst-libs/ext/libav/libavcodec/aac_adtstoasc_bsf.c
+++ b/gst-libs/ext/libav/libavcodec/aac_adtstoasc_bsf.c
@@ -61,8 +61,8 @@ static int aac_adtstoasc_filter(AVBitStreamFilterContext *bsfc,
}
if (!hdr.crc_absent && hdr.num_aac_frames > 1) {
- av_log_missing_feature(avctx, "Multiple RDBs per frame with CRC is", 0);
- return -1;
+ av_log_missing_feature(avctx, "Multiple RDBs per frame with CRC", 0);
+ return AVERROR_PATCHWELCOME;
}
buf += AAC_ADTS_HEADER_SIZE + 2*!hdr.crc_absent;
@@ -74,8 +74,8 @@ static int aac_adtstoasc_filter(AVBitStreamFilterContext *bsfc,
if (!hdr.chan_config) {
init_get_bits(&gb, buf, buf_size * 8);
if (get_bits(&gb, 3) != 5) {
- av_log_missing_feature(avctx, "PCE based channel configuration, where the PCE is not the first syntax element is", 0);
- return -1;
+ av_log_missing_feature(avctx, "PCE based channel configuration, where the PCE is not the first syntax element", 0);
+ return AVERROR_PATCHWELCOME;
}
init_put_bits(&pb, pce_data, MAX_PCE_SIZE);
pce_size = avpriv_copy_pce_data(&pb, &gb)/8;
diff --git a/gst-libs/ext/libav/libavcodec/aac_parser.c b/gst-libs/ext/libav/libavcodec/aac_parser.c
index f0914e6..fdaa5f8 100644
--- a/gst-libs/ext/libav/libavcodec/aac_parser.c
+++ b/gst-libs/ext/libav/libavcodec/aac_parser.c
@@ -61,7 +61,7 @@ static av_cold int aac_parse_init(AVCodecParserContext *s1)
AVCodecParser ff_aac_parser = {
- .codec_ids = { CODEC_ID_AAC },
+ .codec_ids = { AV_CODEC_ID_AAC },
.priv_data_size = sizeof(AACAC3ParseContext),
.parser_init = aac_parse_init,
.parser_parse = ff_aac_ac3_parse,
diff --git a/gst-libs/ext/libav/libavcodec/aac_tablegen.h b/gst-libs/ext/libav/libavcodec/aac_tablegen.h
index 8773d9b..a45de9a 100644
--- a/gst-libs/ext/libav/libavcodec/aac_tablegen.h
+++ b/gst-libs/ext/libav/libavcodec/aac_tablegen.h
@@ -29,7 +29,6 @@
#include "libavcodec/aac_tables.h"
#else
#include "libavutil/mathematics.h"
-#include "aac.h"
float ff_aac_pow2sf_tab[428];
void ff_aac_tableinit(void)
diff --git a/gst-libs/ext/libav/libavcodec/aac_tablegen_decl.h b/gst-libs/ext/libav/libavcodec/aac_tablegen_decl.h
index 496ca0c..a5fd1cf 100644
--- a/gst-libs/ext/libav/libavcodec/aac_tablegen_decl.h
+++ b/gst-libs/ext/libav/libavcodec/aac_tablegen_decl.h
@@ -23,6 +23,8 @@
#ifndef AVCODEC_AAC_TABLEGEN_DECL_H
#define AVCODEC_AAC_TABLEGEN_DECL_H
+#define POW_SF2_ZERO 200 ///< ff_aac_pow2sf_tab index corresponding to pow(2, 0);
+
#if CONFIG_HARDCODED_TABLES
#define ff_aac_tableinit()
extern const float ff_aac_pow2sf_tab[428];
diff --git a/gst-libs/ext/libav/libavcodec/aacadtsdec.h b/gst-libs/ext/libav/libavcodec/aacadtsdec.h
index 60fdd22..6319efc 100644
--- a/gst-libs/ext/libav/libavcodec/aacadtsdec.h
+++ b/gst-libs/ext/libav/libavcodec/aacadtsdec.h
@@ -28,7 +28,7 @@
#define AAC_ADTS_HEADER_SIZE 7
-typedef struct {
+typedef struct AACADTSHeaderInfo {
uint32_t sample_rate;
uint32_t samples;
uint32_t bit_rate;
diff --git a/gst-libs/ext/libav/libavcodec/aaccoder.c b/gst-libs/ext/libav/libavcodec/aaccoder.c
index f8a8f3d..d65d8d9 100644
--- a/gst-libs/ext/libav/libavcodec/aaccoder.c
+++ b/gst-libs/ext/libav/libavcodec/aaccoder.c
@@ -110,14 +110,15 @@ static av_always_inline float quantize_and_encode_band_cost_template(
int *bits, int BT_ZERO, int BT_UNSIGNED,
int BT_PAIR, int BT_ESC)
{
- const float IQ = ff_aac_pow2sf_tab[POW_SF2_ZERO + scale_idx - SCALE_ONE_POS + SCALE_DIV_512];
- const float Q = ff_aac_pow2sf_tab[POW_SF2_ZERO - scale_idx + SCALE_ONE_POS - SCALE_DIV_512];
+ const int q_idx = POW_SF2_ZERO - scale_idx + SCALE_ONE_POS - SCALE_DIV_512;
+ const float Q = ff_aac_pow2sf_tab [q_idx];
+ const float Q34 = ff_aac_pow34sf_tab[q_idx];
+ const float IQ = ff_aac_pow2sf_tab [POW_SF2_ZERO + scale_idx - SCALE_ONE_POS + SCALE_DIV_512];
const float CLIPPED_ESCAPE = 165140.0f*IQ;
int i, j;
float cost = 0;
const int dim = BT_PAIR ? 2 : 4;
int resbits = 0;
- const float Q34 = sqrtf(Q * sqrtf(Q));
const int range = aac_cb_range[cb];
const int maxval = aac_cb_maxval[cb];
int off;
@@ -420,7 +421,7 @@ static void codebook_trellis_rate(AACEncContext *s, SingleChannelElement *sce,
const int run_esc = (1 << run_bits) - 1;
int idx, ppos, count;
int stackrun[120], stackcb[120], stack_len;
- float next_minrd = INFINITY;
+ float next_minbits = INFINITY;
int next_mincb = 0;
abs_pow34_v(s->scoefs, sce->coeffs, 1024);
@@ -434,7 +435,7 @@ static void codebook_trellis_rate(AACEncContext *s, SingleChannelElement *sce,
size = sce->ics.swb_sizes[swb];
if (sce->zeroes[win*16 + swb]) {
float cost_stay_here = path[swb][0].cost;
- float cost_get_here = next_minrd + run_bits + 4;
+ float cost_get_here = next_minbits + run_bits + 4;
if ( run_value_bits[sce->ics.num_windows == 8][path[swb][0].run]
!= run_value_bits[sce->ics.num_windows == 8][path[swb][0].run+1])
cost_stay_here += run_bits;
@@ -447,7 +448,7 @@ static void codebook_trellis_rate(AACEncContext *s, SingleChannelElement *sce,
path[swb+1][0].cost = cost_stay_here;
path[swb+1][0].run = path[swb][0].run + 1;
}
- next_minrd = path[swb+1][0].cost;
+ next_minbits = path[swb+1][0].cost;
next_mincb = 0;
for (cb = 1; cb < 12; cb++) {
path[swb+1][cb].cost = 61450;
@@ -455,10 +456,10 @@ static void codebook_trellis_rate(AACEncContext *s, SingleChannelElement *sce,
path[swb+1][cb].run = 0;
}
} else {
- float minrd = next_minrd;
+ float minbits = next_minbits;
int mincb = next_mincb;
int startcb = sce->band_type[win*16+swb];
- next_minrd = INFINITY;
+ next_minbits = INFINITY;
next_mincb = 0;
for (cb = 0; cb < startcb; cb++) {
path[swb+1][cb].cost = 61450;
@@ -467,15 +468,15 @@ static void codebook_trellis_rate(AACEncContext *s, SingleChannelElement *sce,
}
for (cb = startcb; cb < 12; cb++) {
float cost_stay_here, cost_get_here;
- float rd = 0.0f;
+ float bits = 0.0f;
for (w = 0; w < group_len; w++) {
- rd += quantize_band_cost(s, sce->coeffs + start + w*128,
- s->scoefs + start + w*128, size,
- sce->sf_idx[(win+w)*16+swb], cb,
- 0, INFINITY, NULL);
+ bits += quantize_band_cost(s, sce->coeffs + start + w*128,
+ s->scoefs + start + w*128, size,
+ sce->sf_idx[(win+w)*16+swb], cb,
+ 0, INFINITY, NULL);
}
- cost_stay_here = path[swb][cb].cost + rd;
- cost_get_here = minrd + rd + run_bits + 4;
+ cost_stay_here = path[swb][cb].cost + bits;
+ cost_get_here = minbits + bits + run_bits + 4;
if ( run_value_bits[sce->ics.num_windows == 8][path[swb][cb].run]
!= run_value_bits[sce->ics.num_windows == 8][path[swb][cb].run+1])
cost_stay_here += run_bits;
@@ -488,8 +489,8 @@ static void codebook_trellis_rate(AACEncContext *s, SingleChannelElement *sce,
path[swb+1][cb].cost = cost_stay_here;
path[swb+1][cb].run = path[swb][cb].run + 1;
}
- if (path[swb+1][cb].cost < next_minrd) {
- next_minrd = path[swb+1][cb].cost;
+ if (path[swb+1][cb].cost < next_minbits) {
+ next_minbits = path[swb+1][cb].cost;
next_mincb = cb;
}
}
@@ -584,7 +585,6 @@ static void search_for_quantizers_anmr(AVCodecContext *avctx, AACEncContext *s,
q0 = coef2minsf(q0f);
//maximum scalefactor index is when maximum coefficient after quantizing is still not zero
q1 = coef2maxsf(q1f);
- //av_log(NULL, AV_LOG_ERROR, "q0 %d, q1 %d\n", q0, q1);
if (q1 - q0 > 60) {
int q0low = q0;
int q1high = q1;
@@ -592,7 +592,6 @@ static void search_for_quantizers_anmr(AVCodecContext *avctx, AACEncContext *s,
int qnrg = av_clip_uint8(log2f(sqrtf(qnrgf/qcnt))*4 - 31 + SCALE_ONE_POS - SCALE_DIV_512);
q1 = qnrg + 30;
q0 = qnrg - 30;
- //av_log(NULL, AV_LOG_ERROR, "q0 %d, q1 %d\n", q0, q1);
if (q0 < q0low) {
q1 += q0low - q0;
q0 = q0low;
@@ -601,7 +600,6 @@ static void search_for_quantizers_anmr(AVCodecContext *avctx, AACEncContext *s,
q1 = q1high;
}
}
- //av_log(NULL, AV_LOG_ERROR, "q0 %d, q1 %d\n", q0, q1);
for (i = 0; i < TRELLIS_STATES; i++) {
paths[0][i].cost = 0.0f;
@@ -713,15 +711,17 @@ static void search_for_quantizers_twoloop(AVCodecContext *avctx,
{
int start = 0, i, w, w2, g;
int destbits = avctx->bit_rate * 1024.0 / avctx->sample_rate / avctx->channels;
- float dists[128], uplims[128];
+ float dists[128] = { 0 }, uplims[128];
float maxvals[128];
int fflag, minscaler;
int its = 0;
int allz = 0;
float minthr = INFINITY;
+ // for values above this the decoder might end up in an endless loop
+ // due to always having more bits than what can be encoded.
+ destbits = FFMIN(destbits, 5800);
//XXX: some heuristic to determine initial quantizers will reduce search time
- memset(dists, 0, sizeof(dists));
//determine zero bands and upper limits
for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) {
for (g = 0; g < sce->ics.num_swb; g++) {
diff --git a/gst-libs/ext/libav/libavcodec/aacdec.c b/gst-libs/ext/libav/libavcodec/aacdec.c
index 24e6ca6..dec6d01 100644
--- a/gst-libs/ext/libav/libavcodec/aacdec.c
+++ b/gst-libs/ext/libav/libavcodec/aacdec.c
@@ -5,7 +5,7 @@
*
* AAC LATM decoder
* Copyright (c) 2008-2010 Paul Kendall <paul@kcbbs.gen.nz>
- * Copyright (c) 2010 Janne Grunau <janne-ffmpeg@jannau.net>
+ * Copyright (c) 2010 Janne Grunau <janne-libav@jannau.net>
*
* This file is part of Libav.
*
@@ -79,7 +79,7 @@
Parametric Stereo.
*/
-
+#include "libavutil/float_dsp.h"
#include "avcodec.h"
#include "internal.h"
#include "get_bits.h"
@@ -114,64 +114,14 @@ static VLC vlc_spectral[11];
static const char overread_err[] = "Input buffer exhausted before END element found\n";
-static ChannelElement *get_che(AACContext *ac, int type, int elem_id)
-{
- // For PCE based channel configurations map the channels solely based on tags.
- if (!ac->m4ac.chan_config) {
- return ac->tag_che_map[type][elem_id];
- }
- // For indexed channel configurations map the channels solely based on position.
- switch (ac->m4ac.chan_config) {
- case 7:
- if (ac->tags_mapped == 3 && type == TYPE_CPE) {
- ac->tags_mapped++;
- return ac->tag_che_map[TYPE_CPE][elem_id] = ac->che[TYPE_CPE][2];
- }
- case 6:
- /* Some streams incorrectly code 5.1 audio as SCE[0] CPE[0] CPE[1] SCE[1]
- instead of SCE[0] CPE[0] CPE[1] LFE[0]. If we seem to have
- encountered such a stream, transfer the LFE[0] element to the SCE[1]'s mapping */
- if (ac->tags_mapped == tags_per_config[ac->m4ac.chan_config] - 1 && (type == TYPE_LFE || type == TYPE_SCE)) {
- ac->tags_mapped++;
- return ac->tag_che_map[type][elem_id] = ac->che[TYPE_LFE][0];
- }
- case 5:
- if (ac->tags_mapped == 2 && type == TYPE_CPE) {
- ac->tags_mapped++;
- return ac->tag_che_map[TYPE_CPE][elem_id] = ac->che[TYPE_CPE][1];
- }
- case 4:
- if (ac->tags_mapped == 2 && ac->m4ac.chan_config == 4 && type == TYPE_SCE) {
- ac->tags_mapped++;
- return ac->tag_che_map[TYPE_SCE][elem_id] = ac->che[TYPE_SCE][1];
- }
- case 3:
- case 2:
- if (ac->tags_mapped == (ac->m4ac.chan_config != 2) && type == TYPE_CPE) {
- ac->tags_mapped++;
- return ac->tag_che_map[TYPE_CPE][elem_id] = ac->che[TYPE_CPE][0];
- } else if (ac->m4ac.chan_config == 2) {
- return NULL;
- }
- case 1:
- if (!ac->tags_mapped && type == TYPE_SCE) {
- ac->tags_mapped++;
- return ac->tag_che_map[TYPE_SCE][elem_id] = ac->che[TYPE_SCE][0];
- }
- default:
- return NULL;
- }
-}
-
-static int count_channels(enum ChannelPosition che_pos[4][MAX_ELEM_ID])
+static int count_channels(uint8_t (*layout)[3], int tags)
{
- int i, type, sum = 0;
- for (i = 0; i < MAX_ELEM_ID; i++) {
- for (type = 0; type < 4; type++) {
- sum += (1 + (type == TYPE_CPE)) *
- (che_pos[type][i] != AAC_CHANNEL_OFF &&
- che_pos[type][i] != AAC_CHANNEL_CC);
- }
+ int i, sum = 0;
+ for (i = 0; i < tags; i++) {
+ int syn_ele = layout[i][0];
+ int pos = layout[i][2];
+ sum += (1 + (syn_ele == TYPE_CPE)) *
+ (pos != AAC_CHANNEL_OFF && pos != AAC_CHANNEL_CC);
}
return sum;
}
@@ -189,22 +139,22 @@ static int count_channels(enum ChannelPosition che_pos[4][MAX_ELEM_ID])
* @return Returns error status. 0 - OK, !0 - error
*/
static av_cold int che_configure(AACContext *ac,
- enum ChannelPosition che_pos[4][MAX_ELEM_ID],
+ enum ChannelPosition che_pos,
int type, int id, int *channels)
{
if (*channels >= MAX_CHANNELS)
return AVERROR_INVALIDDATA;
- if (che_pos[type][id]) {
+ if (che_pos) {
if (!ac->che[type][id]) {
if (!(ac->che[type][id] = av_mallocz(sizeof(ChannelElement))))
return AVERROR(ENOMEM);
ff_aac_sbr_ctx_init(ac, &ac->che[type][id]->sbr);
}
if (type != TYPE_CCE) {
- ac->output_data[(*channels)++] = ac->che[type][id]->ch[0].ret;
+ ac->output_element[(*channels)++] = &ac->che[type][id]->ch[0];
if (type == TYPE_CPE ||
- (type == TYPE_SCE && ac->m4ac.ps == 1)) {
- ac->output_data[(*channels)++] = ac->che[type][id]->ch[1].ret;
+ (type == TYPE_SCE && ac->oc[1].m4ac.ps == 1)) {
+ ac->output_element[(*channels)++] = &ac->che[type][id]->ch[1];
}
}
} else {
@@ -215,97 +165,447 @@ static av_cold int che_configure(AACContext *ac,
return 0;
}
+static int frame_configure_elements(AVCodecContext *avctx)
+{
+ AACContext *ac = avctx->priv_data;
+ int type, id, ch, ret;
+
+ /* set channel pointers to internal buffers by default */
+ for (type = 0; type < 4; type++) {
+ for (id = 0; id < MAX_ELEM_ID; id++) {
+ ChannelElement *che = ac->che[type][id];
+ if (che) {
+ che->ch[0].ret = che->ch[0].ret_buf;
+ che->ch[1].ret = che->ch[1].ret_buf;
+ }
+ }
+ }
+
+ /* get output buffer */
+ ac->frame.nb_samples = 2048;
+ if ((ret = ff_get_buffer(avctx, &ac->frame)) < 0) {
+ av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
+ return ret;
+ }
+
+ /* map output channel pointers to AVFrame data */
+ for (ch = 0; ch < avctx->channels; ch++) {
+ if (ac->output_element[ch])
+ ac->output_element[ch]->ret = (float *)ac->frame.extended_data[ch];
+ }
+
+ return 0;
+}
+
+struct elem_to_channel {
+ uint64_t av_position;
+ uint8_t syn_ele;
+ uint8_t elem_id;
+ uint8_t aac_position;
+};
+
+static int assign_pair(struct elem_to_channel e2c_vec[MAX_ELEM_ID],
+ uint8_t (*layout_map)[3], int offset, uint64_t left,
+ uint64_t right, int pos)
+{
+ if (layout_map[offset][0] == TYPE_CPE) {
+ e2c_vec[offset] = (struct elem_to_channel) {
+ .av_position = left | right, .syn_ele = TYPE_CPE,
+ .elem_id = layout_map[offset ][1], .aac_position = pos };
+ return 1;
+ } else {
+ e2c_vec[offset] = (struct elem_to_channel) {
+ .av_position = left, .syn_ele = TYPE_SCE,
+ .elem_id = layout_map[offset ][1], .aac_position = pos };
+ e2c_vec[offset + 1] = (struct elem_to_channel) {
+ .av_position = right, .syn_ele = TYPE_SCE,
+ .elem_id = layout_map[offset + 1][1], .aac_position = pos };
+ return 2;
+ }
+}
+
+static int count_paired_channels(uint8_t (*layout_map)[3], int tags, int pos, int *current) {
+ int num_pos_channels = 0;
+ int first_cpe = 0;
+ int sce_parity = 0;
+ int i;
+ for (i = *current; i < tags; i++) {
+ if (layout_map[i][2] != pos)
+ break;
+ if (layout_map[i][0] == TYPE_CPE) {
+ if (sce_parity) {
+ if (pos == AAC_CHANNEL_FRONT && !first_cpe) {
+ sce_parity = 0;
+ } else {
+ return -1;
+ }
+ }
+ num_pos_channels += 2;
+ first_cpe = 1;
+ } else {
+ num_pos_channels++;
+ sce_parity ^= 1;
+ }
+ }
+ if (sce_parity &&
+ ((pos == AAC_CHANNEL_FRONT && first_cpe) || pos == AAC_CHANNEL_SIDE))
+ return -1;
+ *current = i;
+ return num_pos_channels;
+}
+
+static uint64_t sniff_channel_order(uint8_t (*layout_map)[3], int tags)
+{
+ int i, n, total_non_cc_elements;
+ struct elem_to_channel e2c_vec[4*MAX_ELEM_ID] = {{ 0 }};
+ int num_front_channels, num_side_channels, num_back_channels;
+ uint64_t layout;
+
+ if (FF_ARRAY_ELEMS(e2c_vec) < tags)
+ return 0;
+
+ i = 0;
+ num_front_channels =
+ count_paired_channels(layout_map, tags, AAC_CHANNEL_FRONT, &i);
+ if (num_front_channels < 0)
+ return 0;
+ num_side_channels =
+ count_paired_channels(layout_map, tags, AAC_CHANNEL_SIDE, &i);
+ if (num_side_channels < 0)
+ return 0;
+ num_back_channels =
+ count_paired_channels(layout_map, tags, AAC_CHANNEL_BACK, &i);
+ if (num_back_channels < 0)
+ return 0;
+
+ i = 0;
+ if (num_front_channels & 1) {
+ e2c_vec[i] = (struct elem_to_channel) {
+ .av_position = AV_CH_FRONT_CENTER, .syn_ele = TYPE_SCE,
+ .elem_id = layout_map[i][1], .aac_position = AAC_CHANNEL_FRONT };
+ i++;
+ num_front_channels--;
+ }
+ if (num_front_channels >= 4) {
+ i += assign_pair(e2c_vec, layout_map, i,
+ AV_CH_FRONT_LEFT_OF_CENTER,
+ AV_CH_FRONT_RIGHT_OF_CENTER,
+ AAC_CHANNEL_FRONT);
+ num_front_channels -= 2;
+ }
+ if (num_front_channels >= 2) {
+ i += assign_pair(e2c_vec, layout_map, i,
+ AV_CH_FRONT_LEFT,
+ AV_CH_FRONT_RIGHT,
+ AAC_CHANNEL_FRONT);
+ num_front_channels -= 2;
+ }
+ while (num_front_channels >= 2) {
+ i += assign_pair(e2c_vec, layout_map, i,
+ UINT64_MAX,
+ UINT64_MAX,
+ AAC_CHANNEL_FRONT);
+ num_front_channels -= 2;
+ }
+
+ if (num_side_channels >= 2) {
+ i += assign_pair(e2c_vec, layout_map, i,
+ AV_CH_SIDE_LEFT,
+ AV_CH_SIDE_RIGHT,
+ AAC_CHANNEL_FRONT);
+ num_side_channels -= 2;
+ }
+ while (num_side_channels >= 2) {
+ i += assign_pair(e2c_vec, layout_map, i,
+ UINT64_MAX,
+ UINT64_MAX,
+ AAC_CHANNEL_SIDE);
+ num_side_channels -= 2;
+ }
+
+ while (num_back_channels >= 4) {
+ i += assign_pair(e2c_vec, layout_map, i,
+ UINT64_MAX,
+ UINT64_MAX,
+ AAC_CHANNEL_BACK);
+ num_back_channels -= 2;
+ }
+ if (num_back_channels >= 2) {
+ i += assign_pair(e2c_vec, layout_map, i,
+ AV_CH_BACK_LEFT,
+ AV_CH_BACK_RIGHT,
+ AAC_CHANNEL_BACK);
+ num_back_channels -= 2;
+ }
+ if (num_back_channels) {
+ e2c_vec[i] = (struct elem_to_channel) {
+ .av_position = AV_CH_BACK_CENTER, .syn_ele = TYPE_SCE,
+ .elem_id = layout_map[i][1], .aac_position = AAC_CHANNEL_BACK };
+ i++;
+ num_back_channels--;
+ }
+
+ if (i < tags && layout_map[i][2] == AAC_CHANNEL_LFE) {
+ e2c_vec[i] = (struct elem_to_channel) {
+ .av_position = AV_CH_LOW_FREQUENCY, .syn_ele = TYPE_LFE,
+ .elem_id = layout_map[i][1], .aac_position = AAC_CHANNEL_LFE };
+ i++;
+ }
+ while (i < tags && layout_map[i][2] == AAC_CHANNEL_LFE) {
+ e2c_vec[i] = (struct elem_to_channel) {
+ .av_position = UINT64_MAX, .syn_ele = TYPE_LFE,
+ .elem_id = layout_map[i][1], .aac_position = AAC_CHANNEL_LFE };
+ i++;
+ }
+
+ // Must choose a stable sort
+ total_non_cc_elements = n = i;
+ do {
+ int next_n = 0;
+ for (i = 1; i < n; i++) {
+ if (e2c_vec[i-1].av_position > e2c_vec[i].av_position) {
+ FFSWAP(struct elem_to_channel, e2c_vec[i-1], e2c_vec[i]);
+ next_n = i;
+ }
+ }
+ n = next_n;
+ } while (n > 0);
+
+ layout = 0;
+ for (i = 0; i < total_non_cc_elements; i++) {
+ layout_map[i][0] = e2c_vec[i].syn_ele;
+ layout_map[i][1] = e2c_vec[i].elem_id;
+ layout_map[i][2] = e2c_vec[i].aac_position;
+ if (e2c_vec[i].av_position != UINT64_MAX) {
+ layout |= e2c_vec[i].av_position;
+ }
+ }
+
+ return layout;
+}
+
+/**
+ * Save current output configuration if and only if it has been locked.
+ */
+static void push_output_configuration(AACContext *ac) {
+ if (ac->oc[1].status == OC_LOCKED) {
+ ac->oc[0] = ac->oc[1];
+ }
+ ac->oc[1].status = OC_NONE;
+}
+
+/**
+ * Restore the previous output configuration if and only if the current
+ * configuration is unlocked.
+ */
+static void pop_output_configuration(AACContext *ac) {
+ if (ac->oc[1].status != OC_LOCKED && ac->oc[0].status != OC_NONE) {
+ ac->oc[1] = ac->oc[0];
+ ac->avctx->channels = ac->oc[1].channels;
+ ac->avctx->channel_layout = ac->oc[1].channel_layout;
+ }
+}
+
/**
* Configure output channel order based on the current program configuration element.
*
- * @param che_pos current channel position configuration
- * @param new_che_pos New channel position configuration - we only do something if it differs from the current one.
- *
* @return Returns error status. 0 - OK, !0 - error
*/
-static av_cold int output_configure(AACContext *ac,
- enum ChannelPosition che_pos[4][MAX_ELEM_ID],
- enum ChannelPosition new_che_pos[4][MAX_ELEM_ID],
- int channel_config, enum OCStatus oc_type)
+static int output_configure(AACContext *ac,
+ uint8_t layout_map[MAX_ELEM_ID*4][3], int tags,
+ enum OCStatus oc_type, int get_new_frame)
{
AVCodecContext *avctx = ac->avctx;
- int i, type, channels = 0, ret;
-
- if (new_che_pos != che_pos)
- memcpy(che_pos, new_che_pos, 4 * MAX_ELEM_ID * sizeof(new_che_pos[0][0]));
-
- if (channel_config) {
- for (i = 0; i < tags_per_config[channel_config]; i++) {
- if ((ret = che_configure(ac, che_pos,
- aac_channel_layout_map[channel_config - 1][i][0],
- aac_channel_layout_map[channel_config - 1][i][1],
- &channels)))
- return ret;
+ int i, channels = 0, ret;
+ uint64_t layout = 0;
+
+ if (ac->oc[1].layout_map != layout_map) {
+ memcpy(ac->oc[1].layout_map, layout_map, tags * sizeof(layout_map[0]));
+ ac->oc[1].layout_map_tags = tags;
+ }
+
+ // Try to sniff a reasonable channel order, otherwise output the
+ // channels in the order the PCE declared them.
+ if (avctx->request_channel_layout != AV_CH_LAYOUT_NATIVE)
+ layout = sniff_channel_order(layout_map, tags);
+ for (i = 0; i < tags; i++) {
+ int type = layout_map[i][0];
+ int id = layout_map[i][1];
+ int position = layout_map[i][2];
+ // Allocate or free elements depending on if they are in the
+ // current program configuration.
+ ret = che_configure(ac, position, type, id, &channels);
+ if (ret < 0)
+ return ret;
+ }
+ if (ac->oc[1].m4ac.ps == 1 && channels == 2) {
+ if (layout == AV_CH_FRONT_CENTER) {
+ layout = AV_CH_FRONT_LEFT|AV_CH_FRONT_RIGHT;
+ } else {
+ layout = 0;
}
+ }
- memset(ac->tag_che_map, 0, 4 * MAX_ELEM_ID * sizeof(ac->che[0][0]));
+ memcpy(ac->tag_che_map, ac->che, 4 * MAX_ELEM_ID * sizeof(ac->che[0][0]));
+ avctx->channel_layout = ac->oc[1].channel_layout = layout;
+ avctx->channels = ac->oc[1].channels = channels;
+ ac->oc[1].status = oc_type;
- avctx->channel_layout = aac_channel_layout[channel_config - 1];
- } else {
- /* Allocate or free elements depending on if they are in the
- * current program configuration.
- *
- * Set up default 1:1 output mapping.
- *
- * For a 5.1 stream the output order will be:
- * [ Center ] [ Front Left ] [ Front Right ] [ LFE ] [ Surround Left ] [ Surround Right ]
- */
+ if (get_new_frame) {
+ if ((ret = frame_configure_elements(ac->avctx)) < 0)
+ return ret;
+ }
- for (i = 0; i < MAX_ELEM_ID; i++) {
- for (type = 0; type < 4; type++) {
- if ((ret = che_configure(ac, che_pos, type, i, &channels)))
- return ret;
- }
- }
+ return 0;
+}
- memcpy(ac->tag_che_map, ac->che, 4 * MAX_ELEM_ID * sizeof(ac->che[0][0]));
+/**
+ * Set up channel positions based on a default channel configuration
+ * as specified in table 1.17.
+ *
+ * @return Returns error status. 0 - OK, !0 - error
+ */
+static int set_default_channel_config(AVCodecContext *avctx,
+ uint8_t (*layout_map)[3],
+ int *tags,
+ int channel_config)
+{
+ if (channel_config < 1 || channel_config > 7) {
+ av_log(avctx, AV_LOG_ERROR, "invalid default channel configuration (%d)\n",
+ channel_config);
+ return -1;
+ }
+ *tags = tags_per_config[channel_config];
+ memcpy(layout_map, aac_channel_layout_map[channel_config-1], *tags * sizeof(*layout_map));
+ return 0;
+}
- avctx->channel_layout = 0;
+static ChannelElement *get_che(AACContext *ac, int type, int elem_id)
+{
+ // For PCE based channel configurations map the channels solely based on tags.
+ if (!ac->oc[1].m4ac.chan_config) {
+ return ac->tag_che_map[type][elem_id];
}
+ // Allow single CPE stereo files to be signalled with mono configuration.
+ if (!ac->tags_mapped && type == TYPE_CPE && ac->oc[1].m4ac.chan_config == 1) {
+ uint8_t layout_map[MAX_ELEM_ID*4][3];
+ int layout_map_tags;
+ push_output_configuration(ac);
- avctx->channels = channels;
+ if (set_default_channel_config(ac->avctx, layout_map, &layout_map_tags,
+ 2) < 0)
+ return NULL;
+ if (output_configure(ac, layout_map, layout_map_tags,
+ OC_TRIAL_FRAME, 1) < 0)
+ return NULL;
- ac->output_configured = oc_type;
+ ac->oc[1].m4ac.chan_config = 2;
+ ac->oc[1].m4ac.ps = 0;
+ }
+ // And vice-versa
+ if (!ac->tags_mapped && type == TYPE_SCE && ac->oc[1].m4ac.chan_config == 2) {
+ uint8_t layout_map[MAX_ELEM_ID*4][3];
+ int layout_map_tags;
+ push_output_configuration(ac);
- return 0;
+ if (set_default_channel_config(ac->avctx, layout_map, &layout_map_tags,
+ 1) < 0)
+ return NULL;
+ if (output_configure(ac, layout_map, layout_map_tags,
+ OC_TRIAL_FRAME, 1) < 0)
+ return NULL;
+
+ ac->oc[1].m4ac.chan_config = 1;
+ if (ac->oc[1].m4ac.sbr)
+ ac->oc[1].m4ac.ps = -1;
+ }
+ // For indexed channel configurations map the channels solely based on position.
+ switch (ac->oc[1].m4ac.chan_config) {
+ case 7:
+ if (ac->tags_mapped == 3 && type == TYPE_CPE) {
+ ac->tags_mapped++;
+ return ac->tag_che_map[TYPE_CPE][elem_id] = ac->che[TYPE_CPE][2];
+ }
+ case 6:
+ /* Some streams incorrectly code 5.1 audio as SCE[0] CPE[0] CPE[1] SCE[1]
+ instead of SCE[0] CPE[0] CPE[1] LFE[0]. If we seem to have
+ encountered such a stream, transfer the LFE[0] element to the SCE[1]'s mapping */
+ if (ac->tags_mapped == tags_per_config[ac->oc[1].m4ac.chan_config] - 1 && (type == TYPE_LFE || type == TYPE_SCE)) {
+ ac->tags_mapped++;
+ return ac->tag_che_map[type][elem_id] = ac->che[TYPE_LFE][0];
+ }
+ case 5:
+ if (ac->tags_mapped == 2 && type == TYPE_CPE) {
+ ac->tags_mapped++;
+ return ac->tag_che_map[TYPE_CPE][elem_id] = ac->che[TYPE_CPE][1];
+ }
+ case 4:
+ if (ac->tags_mapped == 2 && ac->oc[1].m4ac.chan_config == 4 && type == TYPE_SCE) {
+ ac->tags_mapped++;
+ return ac->tag_che_map[TYPE_SCE][elem_id] = ac->che[TYPE_SCE][1];
+ }
+ case 3:
+ case 2:
+ if (ac->tags_mapped == (ac->oc[1].m4ac.chan_config != 2) && type == TYPE_CPE) {
+ ac->tags_mapped++;
+ return ac->tag_che_map[TYPE_CPE][elem_id] = ac->che[TYPE_CPE][0];
+ } else if (ac->oc[1].m4ac.chan_config == 2) {
+ return NULL;
+ }
+ case 1:
+ if (!ac->tags_mapped && type == TYPE_SCE) {
+ ac->tags_mapped++;
+ return ac->tag_che_map[TYPE_SCE][elem_id] = ac->che[TYPE_SCE][0];
+ }
+ default:
+ return NULL;
+ }
}
/**
* Decode an array of 4 bit element IDs, optionally interleaved with a stereo/mono switching bit.
*
- * @param cpe_map Stereo (Channel Pair Element) map, NULL if stereo bit is not present.
- * @param sce_map mono (Single Channel Element) map
* @param type speaker type/position for these channels
*/
-static void decode_channel_map(enum ChannelPosition *cpe_map,
- enum ChannelPosition *sce_map,
+static void decode_channel_map(uint8_t layout_map[][3],
enum ChannelPosition type,
GetBitContext *gb, int n)
{
while (n--) {
- enum ChannelPosition *map = cpe_map && get_bits1(gb) ? cpe_map : sce_map; // stereo or mono map
- map[get_bits(gb, 4)] = type;
+ enum RawDataBlockType syn_ele;
+ switch (type) {
+ case AAC_CHANNEL_FRONT:
+ case AAC_CHANNEL_BACK:
+ case AAC_CHANNEL_SIDE:
+ syn_ele = get_bits1(gb);
+ break;
+ case AAC_CHANNEL_CC:
+ skip_bits1(gb);
+ syn_ele = TYPE_CCE;
+ break;
+ case AAC_CHANNEL_LFE:
+ syn_ele = TYPE_LFE;
+ break;
+ }
+ layout_map[0][0] = syn_ele;
+ layout_map[0][1] = get_bits(gb, 4);
+ layout_map[0][2] = type;
+ layout_map++;
}
}
/**
* Decode program configuration element; reference: table 4.2.
*
- * @param new_che_pos New channel position configuration - we only do something if it differs from the current one.
- *
* @return Returns error status. 0 - OK, !0 - error
*/
static int decode_pce(AVCodecContext *avctx, MPEG4AudioConfig *m4ac,
- enum ChannelPosition new_che_pos[4][MAX_ELEM_ID],
+ uint8_t (*layout_map)[3],
GetBitContext *gb)
{
int num_front, num_side, num_back, num_lfe, num_assoc_data, num_cc, sampling_index;
int comment_len;
+ int tags;
skip_bits(gb, 2); // object_type
@@ -328,14 +628,19 @@ static int decode_pce(AVCodecContext *avctx, MPEG4AudioConfig *m4ac,
if (get_bits1(gb))
skip_bits(gb, 3); // mixdown_coeff_index and pseudo_surround
- decode_channel_map(new_che_pos[TYPE_CPE], new_che_pos[TYPE_SCE], AAC_CHANNEL_FRONT, gb, num_front);
- decode_channel_map(new_che_pos[TYPE_CPE], new_che_pos[TYPE_SCE], AAC_CHANNEL_SIDE, gb, num_side );
- decode_channel_map(new_che_pos[TYPE_CPE], new_che_pos[TYPE_SCE], AAC_CHANNEL_BACK, gb, num_back );
- decode_channel_map(NULL, new_che_pos[TYPE_LFE], AAC_CHANNEL_LFE, gb, num_lfe );
+ decode_channel_map(layout_map , AAC_CHANNEL_FRONT, gb, num_front);
+ tags = num_front;
+ decode_channel_map(layout_map + tags, AAC_CHANNEL_SIDE, gb, num_side);
+ tags += num_side;
+ decode_channel_map(layout_map + tags, AAC_CHANNEL_BACK, gb, num_back);
+ tags += num_back;
+ decode_channel_map(layout_map + tags, AAC_CHANNEL_LFE, gb, num_lfe);
+ tags += num_lfe;
skip_bits_long(gb, 4 * num_assoc_data);
- decode_channel_map(new_che_pos[TYPE_CCE], new_che_pos[TYPE_CCE], AAC_CHANNEL_CC, gb, num_cc );
+ decode_channel_map(layout_map + tags, AAC_CHANNEL_CC, gb, num_cc);
+ tags += num_cc;
align_get_bits(gb);
@@ -346,53 +651,7 @@ static int decode_pce(AVCodecContext *avctx, MPEG4AudioConfig *m4ac,
return -1;
}
skip_bits_long(gb, comment_len);
- return 0;
-}
-
-/**
- * Set up channel positions based on a default channel configuration
- * as specified in table 1.17.
- *
- * @param new_che_pos New channel position configuration - we only do something if it differs from the current one.
- *
- * @return Returns error status. 0 - OK, !0 - error
- */
-static av_cold int set_default_channel_config(AVCodecContext *avctx,
- enum ChannelPosition new_che_pos[4][MAX_ELEM_ID],
- int channel_config)
-{
- if (channel_config < 1 || channel_config > 7) {
- av_log(avctx, AV_LOG_ERROR, "invalid default channel configuration (%d)\n",
- channel_config);
- return -1;
- }
-
- /* default channel configurations:
- *
- * 1ch : front center (mono)
- * 2ch : L + R (stereo)
- * 3ch : front center + L + R
- * 4ch : front center + L + R + back center
- * 5ch : front center + L + R + back stereo
- * 6ch : front center + L + R + back stereo + LFE
- * 7ch : front center + L + R + outer front left + outer front right + back stereo + LFE
- */
-
- if (channel_config != 2)
- new_che_pos[TYPE_SCE][0] = AAC_CHANNEL_FRONT; // front center (or mono)
- if (channel_config > 1)
- new_che_pos[TYPE_CPE][0] = AAC_CHANNEL_FRONT; // L + R (or stereo)
- if (channel_config == 4)
- new_che_pos[TYPE_SCE][1] = AAC_CHANNEL_BACK; // back center
- if (channel_config > 4)
- new_che_pos[TYPE_CPE][(channel_config == 7) + 1]
- = AAC_CHANNEL_BACK; // back stereo
- if (channel_config > 5)
- new_che_pos[TYPE_LFE][0] = AAC_CHANNEL_LFE; // LFE
- if (channel_config == 7)
- new_che_pos[TYPE_CPE][1] = AAC_CHANNEL_FRONT; // outer front left + outer front right
-
- return 0;
+ return tags;
}
/**
@@ -408,12 +667,13 @@ static int decode_ga_specific_config(AACContext *ac, AVCodecContext *avctx,
MPEG4AudioConfig *m4ac,
int channel_config)
{
- enum ChannelPosition new_che_pos[4][MAX_ELEM_ID];
int extension_flag, ret;
+ uint8_t layout_map[MAX_ELEM_ID*4][3];
+ int tags = 0;
if (get_bits1(gb)) { // frameLengthFlag
- av_log_missing_feature(avctx, "960/120 MDCT window is", 1);
- return -1;
+ av_log_missing_feature(avctx, "960/120 MDCT window", 1);
+ return AVERROR_PATCHWELCOME;
}
if (get_bits1(gb)) // dependsOnCoreCoder
@@ -424,22 +684,22 @@ static int decode_ga_specific_config(AACContext *ac, AVCodecContext *avctx,
m4ac->object_type == AOT_ER_AAC_SCALABLE)
skip_bits(gb, 3); // layerNr
- memset(new_che_pos, 0, 4 * MAX_ELEM_ID * sizeof(new_che_pos[0][0]));
if (channel_config == 0) {
skip_bits(gb, 4); // element_instance_tag
- if ((ret = decode_pce(avctx, m4ac, new_che_pos, gb)))
- return ret;
+ tags = decode_pce(avctx, m4ac, layout_map, gb);
+ if (tags < 0)
+ return tags;
} else {
- if ((ret = set_default_channel_config(avctx, new_che_pos, channel_config)))
+ if ((ret = set_default_channel_config(avctx, layout_map, &tags, channel_config)))
return ret;
}
- if (count_channels(new_che_pos) > 1) {
+ if (count_channels(layout_map, tags) > 1) {
m4ac->ps = 0;
} else if (m4ac->sbr == 1 && m4ac->ps == -1)
m4ac->ps = 1;
- if (ac && (ret = output_configure(ac, ac->che_pos, new_che_pos, channel_config, OC_GLOBAL_HDR)))
+ if (ac && (ret = output_configure(ac, layout_map, tags, OC_GLOBAL_HDR, 0)))
return ret;
if (extension_flag) {
@@ -529,7 +789,8 @@ static int decode_audio_specific_config(AACContext *ac,
*/
static av_always_inline int lcg_random(int previous_val)
{
- return previous_val * 1664525 + 1013904223;
+ union { unsigned u; int s; } v = { previous_val * 1664525u + 1013904223 };
+ return v.s;
}
static av_always_inline void reset_predict_state(PredictorState *ps)
@@ -581,25 +842,27 @@ static void reset_predictor_group(PredictorState *ps, int group_num)
static av_cold int aac_decode_init(AVCodecContext *avctx)
{
AACContext *ac = avctx->priv_data;
- float output_scale_factor;
ac->avctx = avctx;
- ac->m4ac.sample_rate = avctx->sample_rate;
+ ac->oc[1].m4ac.sample_rate = avctx->sample_rate;
+
+ avctx->sample_fmt = AV_SAMPLE_FMT_FLTP;
if (avctx->extradata_size > 0) {
- if (decode_audio_specific_config(ac, ac->avctx, &ac->m4ac,
+ if (decode_audio_specific_config(ac, ac->avctx, &ac->oc[1].m4ac,
avctx->extradata,
avctx->extradata_size*8, 1) < 0)
return -1;
} else {
int sr, i;
- enum ChannelPosition new_che_pos[4][MAX_ELEM_ID];
+ uint8_t layout_map[MAX_ELEM_ID*4][3];
+ int layout_map_tags;
sr = sample_rate_idx(avctx->sample_rate);
- ac->m4ac.sampling_index = sr;
- ac->m4ac.channels = avctx->channels;
- ac->m4ac.sbr = -1;
- ac->m4ac.ps = -1;
+ ac->oc[1].m4ac.sampling_index = sr;
+ ac->oc[1].m4ac.channels = avctx->channels;
+ ac->oc[1].m4ac.sbr = -1;
+ ac->oc[1].m4ac.ps = -1;
for (i = 0; i < FF_ARRAY_ELEMS(ff_mpeg4audio_channels); i++)
if (ff_mpeg4audio_channels[i] == avctx->channels)
@@ -607,25 +870,19 @@ static av_cold int aac_decode_init(AVCodecContext *avctx)
if (i == FF_ARRAY_ELEMS(ff_mpeg4audio_channels)) {
i = 0;
}
- ac->m4ac.chan_config = i;
+ ac->oc[1].m4ac.chan_config = i;
- if (ac->m4ac.chan_config) {
- int ret = set_default_channel_config(avctx, new_che_pos, ac->m4ac.chan_config);
+ if (ac->oc[1].m4ac.chan_config) {
+ int ret = set_default_channel_config(avctx, layout_map,
+ &layout_map_tags, ac->oc[1].m4ac.chan_config);
if (!ret)
- output_configure(ac, ac->che_pos, new_che_pos, ac->m4ac.chan_config, OC_GLOBAL_HDR);
+ output_configure(ac, layout_map, layout_map_tags,
+ OC_GLOBAL_HDR, 0);
else if (avctx->err_recognition & AV_EF_EXPLODE)
return AVERROR_INVALIDDATA;
}
}
- if (avctx->request_sample_fmt == AV_SAMPLE_FMT_FLT) {
- avctx->sample_fmt = AV_SAMPLE_FMT_FLT;
- output_scale_factor = 1.0 / 32768.0;
- } else {
- avctx->sample_fmt = AV_SAMPLE_FMT_S16;
- output_scale_factor = 1.0;
- }
-
AAC_INIT_VLC_STATIC( 0, 304);
AAC_INIT_VLC_STATIC( 1, 270);
AAC_INIT_VLC_STATIC( 2, 550);
@@ -640,8 +897,9 @@ static av_cold int aac_decode_init(AVCodecContext *avctx)
ff_aac_sbr_init();
- dsputil_init(&ac->dsp, avctx);
+ ff_dsputil_init(&ac->dsp, avctx);
ff_fmt_convert_init(&ac->fmt_conv, avctx);
+ avpriv_float_dsp_init(&ac->fdsp, avctx->flags & CODEC_FLAG_BITEXACT);
ac->random_state = 0x1f2e3d4c;
@@ -652,9 +910,9 @@ static av_cold int aac_decode_init(AVCodecContext *avctx)
ff_aac_scalefactor_code, sizeof(ff_aac_scalefactor_code[0]), sizeof(ff_aac_scalefactor_code[0]),
352);
- ff_mdct_init(&ac->mdct, 11, 1, output_scale_factor/1024.0);
- ff_mdct_init(&ac->mdct_small, 8, 1, output_scale_factor/128.0);
- ff_mdct_init(&ac->mdct_ltp, 11, 0, -2.0/output_scale_factor);
+ ff_mdct_init(&ac->mdct, 11, 1, 1.0 / (32768.0 * 1024.0));
+ ff_mdct_init(&ac->mdct_small, 8, 1, 1.0 / (32768.0 * 128.0));
+ ff_mdct_init(&ac->mdct_ltp, 11, 0, -2.0 * 32768.0);
// window initialization
ff_kbd_window_init(ff_aac_kbd_long_1024, 4.0, 1024);
ff_kbd_window_init(ff_aac_kbd_short_128, 6.0, 128);
@@ -700,7 +958,7 @@ static int decode_prediction(AACContext *ac, IndividualChannelStream *ics,
return -1;
}
}
- for (sfb = 0; sfb < FFMIN(ics->max_sfb, ff_aac_pred_sfb_max[ac->m4ac.sampling_index]); sfb++) {
+ for (sfb = 0; sfb < FFMIN(ics->max_sfb, ff_aac_pred_sfb_max[ac->oc[1].m4ac.sampling_index]); sfb++) {
ics->prediction_used[sfb] = get_bits1(gb);
}
return 0;
@@ -709,7 +967,7 @@ static int decode_prediction(AACContext *ac, IndividualChannelStream *ics,
/**
* Decode Long Term Prediction data; reference: table 4.xx.
*/
-static void decode_ltp(AACContext *ac, LongTermPrediction *ltp,
+static void decode_ltp(LongTermPrediction *ltp,
GetBitContext *gb, uint8_t max_sfb)
{
int sfb;
@@ -748,29 +1006,29 @@ static int decode_ics_info(AACContext *ac, IndividualChannelStream *ics,
}
}
ics->num_windows = 8;
- ics->swb_offset = ff_swb_offset_128[ac->m4ac.sampling_index];
- ics->num_swb = ff_aac_num_swb_128[ac->m4ac.sampling_index];
- ics->tns_max_bands = ff_tns_max_bands_128[ac->m4ac.sampling_index];
+ ics->swb_offset = ff_swb_offset_128[ac->oc[1].m4ac.sampling_index];
+ ics->num_swb = ff_aac_num_swb_128[ac->oc[1].m4ac.sampling_index];
+ ics->tns_max_bands = ff_tns_max_bands_128[ac->oc[1].m4ac.sampling_index];
ics->predictor_present = 0;
} else {
ics->max_sfb = get_bits(gb, 6);
ics->num_windows = 1;
- ics->swb_offset = ff_swb_offset_1024[ac->m4ac.sampling_index];
- ics->num_swb = ff_aac_num_swb_1024[ac->m4ac.sampling_index];
- ics->tns_max_bands = ff_tns_max_bands_1024[ac->m4ac.sampling_index];
+ ics->swb_offset = ff_swb_offset_1024[ac->oc[1].m4ac.sampling_index];
+ ics->num_swb = ff_aac_num_swb_1024[ac->oc[1].m4ac.sampling_index];
+ ics->tns_max_bands = ff_tns_max_bands_1024[ac->oc[1].m4ac.sampling_index];
ics->predictor_present = get_bits1(gb);
ics->predictor_reset_group = 0;
if (ics->predictor_present) {
- if (ac->m4ac.object_type == AOT_AAC_MAIN) {
+ if (ac->oc[1].m4ac.object_type == AOT_AAC_MAIN) {
if (decode_prediction(ac, ics, gb)) {
return AVERROR_INVALIDDATA;
}
- } else if (ac->m4ac.object_type == AOT_AAC_LC) {
+ } else if (ac->oc[1].m4ac.object_type == AOT_AAC_LC) {
av_log(ac->avctx, AV_LOG_ERROR, "Prediction is not allowed in AAC-LC.\n");
return AVERROR_INVALIDDATA;
} else {
if ((ics->ltp.present = get_bits(gb, 1)))
- decode_ltp(ac, &ics->ltp, gb, ics->max_sfb);
+ decode_ltp(&ics->ltp, gb, ics->max_sfb);
}
}
}
@@ -852,7 +1110,6 @@ static int decode_scalefactors(AACContext *ac, float sf[120], GetBitContext *gb,
int offset[3] = { global_gain, global_gain - 90, 0 };
int clipped_offset;
int noise_flag = 1;
- static const char *sf_str[3] = { "Global gain", "Noise gain", "Intensity stereo position" };
for (g = 0; g < ics->num_window_groups; g++) {
for (i = 0; i < ics->max_sfb;) {
int run_end = band_type_run_end[idx];
@@ -891,7 +1148,7 @@ static int decode_scalefactors(AACContext *ac, float sf[120], GetBitContext *gb,
offset[0] += get_vlc2(gb, vlc_scalefactors.table, 7, 3) - 60;
if (offset[0] > 255U) {
av_log(ac->avctx, AV_LOG_ERROR,
- "%s (%d) out of range.\n", sf_str[0], offset[0]);
+ "Scalefactor (%d) out of range.\n", offset[0]);
return -1;
}
sf[idx] = -ff_aac_pow2sf_tab[offset[0] - 100 + POW_SF2_ZERO];
@@ -937,7 +1194,7 @@ static int decode_tns(AACContext *ac, TemporalNoiseShaping *tns,
{
int w, filt, i, coef_len, coef_res, coef_compress;
const int is8 = ics->window_sequence[0] == EIGHT_SHORT_SEQUENCE;
- const int tns_max_order = is8 ? 7 : ac->m4ac.object_type == AOT_AAC_MAIN ? 20 : 12;
+ const int tns_max_order = is8 ? 7 : ac->oc[1].m4ac.object_type == AOT_AAC_MAIN ? 20 : 12;
for (w = 0; w < ics->num_windows; w++) {
if ((tns->n_filt[w] = get_bits(gb, 2 - is8))) {
coef_res = get_bits1(gb);
@@ -1046,7 +1303,7 @@ static inline float *VMUL4S(float *dst, const float *v, unsigned idx,
t.i = s.i ^ (sign & 1U<<31);
*dst++ = v[idx>>4 & 3] * t.f;
- sign <<= nz & 1; nz >>= 1;
+ sign <<= nz & 1;
t.i = s.i ^ (sign & 1U<<31);
*dst++ = v[idx>>6 & 3] * t.f;
@@ -1105,7 +1362,7 @@ static int decode_spectrum_and_dequant(AACContext *ac, float coef[1024],
band_energy = ac->dsp.scalarproduct_float(cfo, cfo, off_len);
scale = sf[idx] / sqrtf(band_energy);
- ac->dsp.vector_fmul_scalar(cfo, cfo, scale, off_len);
+ ac->fdsp.vector_fmul_scalar(cfo, cfo, scale, off_len);
}
} else {
const float *vq = ff_aac_codebook_vector_vals[cbt_m1];
@@ -1251,7 +1508,7 @@ static int decode_spectrum_and_dequant(AACContext *ac, float coef[1024],
}
} while (len -= 2);
- ac->dsp.vector_fmul_scalar(cfo, cfo, sf[idx], off_len);
+ ac->fdsp.vector_fmul_scalar(cfo, cfo, sf[idx], off_len);
}
}
@@ -1348,7 +1605,7 @@ static void apply_prediction(AACContext *ac, SingleChannelElement *sce)
}
if (sce->ics.window_sequence[0] != EIGHT_SHORT_SEQUENCE) {
- for (sfb = 0; sfb < ff_aac_pred_sfb_max[ac->m4ac.sampling_index]; sfb++) {
+ for (sfb = 0; sfb < ff_aac_pred_sfb_max[ac->oc[1].m4ac.sampling_index]; sfb++) {
for (k = sce->ics.swb_offset[sfb]; k < sce->ics.swb_offset[sfb + 1]; k++) {
predict(&sce->predictor_state[k], &sce->coeffs[k],
sce->ics.predictor_present && sce->ics.prediction_used[sfb]);
@@ -1410,14 +1667,14 @@ static int decode_ics(AACContext *ac, SingleChannelElement *sce,
return -1;
if (get_bits1(gb)) {
av_log_missing_feature(ac->avctx, "SSR", 1);
- return -1;
+ return AVERROR_PATCHWELCOME;
}
}
if (decode_spectrum_and_dequant(ac, out, gb, sce->sf, pulse_present, &pulse, ics, sce->band_type) < 0)
return -1;
- if (ac->m4ac.object_type == AOT_AAC_MAIN && !common_window)
+ if (ac->oc[1].m4ac.object_type == AOT_AAC_MAIN && !common_window)
apply_prediction(ac, sce);
return 0;
@@ -1475,10 +1732,10 @@ static void apply_intensity_stereo(AACContext *ac, ChannelElement *cpe, int ms_p
c *= 1 - 2 * cpe->ms_mask[idx];
scale = c * sce1->sf[idx];
for (group = 0; group < ics->group_len[g]; group++)
- ac->dsp.vector_fmul_scalar(coef1 + group * 128 + offsets[i],
- coef0 + group * 128 + offsets[i],
- scale,
- offsets[i + 1] - offsets[i]);
+ ac->fdsp.vector_fmul_scalar(coef1 + group * 128 + offsets[i],
+ coef0 + group * 128 + offsets[i],
+ scale,
+ offsets[i + 1] - offsets[i]);
}
} else {
int bt_run_end = sce1->band_type_run_end[idx];
@@ -1507,9 +1764,9 @@ static int decode_cpe(AACContext *ac, GetBitContext *gb, ChannelElement *cpe)
i = cpe->ch[1].ics.use_kb_window[0];
cpe->ch[1].ics = cpe->ch[0].ics;
cpe->ch[1].ics.use_kb_window[1] = i;
- if (cpe->ch[1].ics.predictor_present && (ac->m4ac.object_type != AOT_AAC_MAIN))
+ if (cpe->ch[1].ics.predictor_present && (ac->oc[1].m4ac.object_type != AOT_AAC_MAIN))
if ((cpe->ch[1].ics.ltp.present = get_bits(gb, 1)))
- decode_ltp(ac, &cpe->ch[1].ics.ltp, gb, cpe->ch[1].ics.max_sfb);
+ decode_ltp(&cpe->ch[1].ics.ltp, gb, cpe->ch[1].ics.max_sfb);
ms_present = get_bits(gb, 2);
if (ms_present == 3) {
av_log(ac->avctx, AV_LOG_ERROR, "ms_present = 3 is reserved.\n");
@@ -1525,7 +1782,7 @@ static int decode_cpe(AACContext *ac, GetBitContext *gb, ChannelElement *cpe)
if (common_window) {
if (ms_present)
apply_mid_side_stereo(ac, cpe);
- if (ac->m4ac.object_type == AOT_AAC_MAIN) {
+ if (ac->oc[1].m4ac.object_type == AOT_AAC_MAIN) {
apply_prediction(ac, &cpe->ch[0]);
apply_prediction(ac, &cpe->ch[1]);
}
@@ -1636,12 +1893,10 @@ static int decode_drc_channel_exclusions(DynamicRangeControl *che_drc,
/**
* Decode dynamic range information; reference: table 4.52.
*
- * @param cnt length of TYPE_FIL syntactic element in bytes
- *
* @return Returns number of bytes consumed.
*/
static int decode_dynamic_range(DynamicRangeControl *che_drc,
- GetBitContext *gb, int cnt)
+ GetBitContext *gb)
{
int n = 1;
int drc_num_bands = 1;
@@ -1706,25 +1961,26 @@ static int decode_extension_payload(AACContext *ac, GetBitContext *gb, int cnt,
if (!che) {
av_log(ac->avctx, AV_LOG_ERROR, "SBR was found before the first channel element.\n");
return res;
- } else if (!ac->m4ac.sbr) {
+ } else if (!ac->oc[1].m4ac.sbr) {
av_log(ac->avctx, AV_LOG_ERROR, "SBR signaled to be not-present but was found in the bitstream.\n");
skip_bits_long(gb, 8 * cnt - 4);
return res;
- } else if (ac->m4ac.sbr == -1 && ac->output_configured == OC_LOCKED) {
+ } else if (ac->oc[1].m4ac.sbr == -1 && ac->oc[1].status == OC_LOCKED) {
av_log(ac->avctx, AV_LOG_ERROR, "Implicit SBR was found with a first occurrence after the first frame.\n");
skip_bits_long(gb, 8 * cnt - 4);
return res;
- } else if (ac->m4ac.ps == -1 && ac->output_configured < OC_LOCKED && ac->avctx->channels == 1) {
- ac->m4ac.sbr = 1;
- ac->m4ac.ps = 1;
- output_configure(ac, ac->che_pos, ac->che_pos, ac->m4ac.chan_config, ac->output_configured);
+ } else if (ac->oc[1].m4ac.ps == -1 && ac->oc[1].status < OC_LOCKED && ac->avctx->channels == 1) {
+ ac->oc[1].m4ac.sbr = 1;
+ ac->oc[1].m4ac.ps = 1;
+ output_configure(ac, ac->oc[1].layout_map, ac->oc[1].layout_map_tags,
+ ac->oc[1].status, 1);
} else {
- ac->m4ac.sbr = 1;
+ ac->oc[1].m4ac.sbr = 1;
}
res = ff_decode_sbr_extension(ac, &che->sbr, gb, crc_flag, cnt, elem_type);
break;
case EXT_DYNAMIC_RANGE:
- res = decode_dynamic_range(&ac->che_drc, gb, cnt);
+ res = decode_dynamic_range(&ac->che_drc, gb);
break;
case EXT_FILL:
case EXT_FILL_DATA:
@@ -1807,10 +2063,10 @@ static void windowing_and_mdct_ltp(AACContext *ac, float *out,
const float *swindow_prev = ics->use_kb_window[1] ? ff_aac_kbd_short_128 : ff_sine_128;
if (ics->window_sequence[0] != LONG_STOP_SEQUENCE) {
- ac->dsp.vector_fmul(in, in, lwindow_prev, 1024);
+ ac->fdsp.vector_fmul(in, in, lwindow_prev, 1024);
} else {
memset(in, 0, 448 * sizeof(float));
- ac->dsp.vector_fmul(in + 448, in + 448, swindow_prev, 128);
+ ac->fdsp.vector_fmul(in + 448, in + 448, swindow_prev, 128);
}
if (ics->window_sequence[0] != LONG_START_SEQUENCE) {
ac->dsp.vector_fmul_reverse(in + 1024, in + 1024, lwindow, 1024);
@@ -1965,7 +2221,7 @@ static void apply_dependent_coupling(AACContext *ac,
float *dest = target->coeffs;
const float *src = cce->ch[0].coeffs;
int g, i, group, k, idx = 0;
- if (ac->m4ac.object_type == AOT_AAC_LTP) {
+ if (ac->oc[1].m4ac.object_type == AOT_AAC_LTP) {
av_log(ac->avctx, AV_LOG_ERROR,
"Dependent coupling is not supported together with LTP\n");
return;
@@ -2000,7 +2256,7 @@ static void apply_independent_coupling(AACContext *ac,
const float gain = cce->coup.gain[index][0];
const float *src = cce->ch[0].ret;
float *dest = target->ret;
- const int len = 1024 << (ac->m4ac.sbr == 1);
+ const int len = 1024 << (ac->oc[1].m4ac.sbr == 1);
for (i = 0; i < len; i++)
dest[i] += gain * src[i];
@@ -2053,7 +2309,7 @@ static void spectral_to_sample(AACContext *ac)
if (che) {
if (type <= TYPE_CPE)
apply_channel_coupling(ac, che, type, i, BEFORE_TNS, apply_dependent_coupling);
- if (ac->m4ac.object_type == AOT_AAC_LTP) {
+ if (ac->oc[1].m4ac.object_type == AOT_AAC_LTP) {
if (che->ch[0].ics.predictor_present) {
if (che->ch[0].ics.ltp.present)
apply_ltp(ac, &che->ch[0]);
@@ -2069,14 +2325,14 @@ static void spectral_to_sample(AACContext *ac)
apply_channel_coupling(ac, che, type, i, BETWEEN_TNS_AND_IMDCT, apply_dependent_coupling);
if (type != TYPE_CCE || che->coup.coupling_point == AFTER_IMDCT) {
imdct_and_windowing(ac, &che->ch[0]);
- if (ac->m4ac.object_type == AOT_AAC_LTP)
+ if (ac->oc[1].m4ac.object_type == AOT_AAC_LTP)
update_ltp(ac, &che->ch[0]);
if (type == TYPE_CPE) {
imdct_and_windowing(ac, &che->ch[1]);
- if (ac->m4ac.object_type == AOT_AAC_LTP)
+ if (ac->oc[1].m4ac.object_type == AOT_AAC_LTP)
update_ltp(ac, &che->ch[1]);
}
- if (ac->m4ac.sbr > 0) {
+ if (ac->oc[1].m4ac.sbr > 0) {
ff_sbr_apply(ac, &che->sbr, type, che->ch[0].ret, che->ch[1].ret);
}
}
@@ -2091,38 +2347,38 @@ static int parse_adts_frame_header(AACContext *ac, GetBitContext *gb)
{
int size;
AACADTSHeaderInfo hdr_info;
+ uint8_t layout_map[MAX_ELEM_ID*4][3];
+ int layout_map_tags;
size = avpriv_aac_parse_header(gb, &hdr_info);
if (size > 0) {
+ if (hdr_info.num_aac_frames != 1) {
+ av_log_missing_feature(ac->avctx, "More than one AAC RDB per ADTS frame", 0);
+ return AVERROR_PATCHWELCOME;
+ }
+ push_output_configuration(ac);
if (hdr_info.chan_config) {
- enum ChannelPosition new_che_pos[4][MAX_ELEM_ID];
- memset(new_che_pos, 0, 4 * MAX_ELEM_ID * sizeof(new_che_pos[0][0]));
- ac->m4ac.chan_config = hdr_info.chan_config;
- if (set_default_channel_config(ac->avctx, new_che_pos, hdr_info.chan_config))
+ ac->oc[1].m4ac.chan_config = hdr_info.chan_config;
+ if (set_default_channel_config(ac->avctx, layout_map,
+ &layout_map_tags, hdr_info.chan_config))
return -7;
- if (output_configure(ac, ac->che_pos, new_che_pos, hdr_info.chan_config,
- FFMAX(ac->output_configured, OC_TRIAL_FRAME)))
+ if (output_configure(ac, layout_map, layout_map_tags,
+ FFMAX(ac->oc[1].status, OC_TRIAL_FRAME), 0))
return -7;
- } else if (ac->output_configured != OC_LOCKED) {
- ac->m4ac.chan_config = 0;
- ac->output_configured = OC_NONE;
- }
- if (ac->output_configured != OC_LOCKED) {
- ac->m4ac.sbr = -1;
- ac->m4ac.ps = -1;
- ac->m4ac.sample_rate = hdr_info.sample_rate;
- ac->m4ac.sampling_index = hdr_info.sampling_index;
- ac->m4ac.object_type = hdr_info.object_type;
- }
- if (!ac->avctx->sample_rate)
- ac->avctx->sample_rate = hdr_info.sample_rate;
- if (hdr_info.num_aac_frames == 1) {
- if (!hdr_info.crc_absent)
- skip_bits(gb, 16);
} else {
- av_log_missing_feature(ac->avctx, "More than one AAC RDB per ADTS frame is", 0);
- return -1;
+ ac->oc[1].m4ac.chan_config = 0;
}
+ ac->oc[1].m4ac.sample_rate = hdr_info.sample_rate;
+ ac->oc[1].m4ac.sampling_index = hdr_info.sampling_index;
+ ac->oc[1].m4ac.object_type = hdr_info.object_type;
+ if (ac->oc[0].status != OC_LOCKED ||
+ ac->oc[0].m4ac.chan_config != hdr_info.chan_config ||
+ ac->oc[0].m4ac.sample_rate != hdr_info.sample_rate) {
+ ac->oc[1].m4ac.sbr = -1;
+ ac->oc[1].m4ac.ps = -1;
+ }
+ if (!hdr_info.crc_absent)
+ skip_bits(gb, 16);
}
return size;
}
@@ -2134,19 +2390,26 @@ static int aac_decode_frame_int(AVCodecContext *avctx, void *data,
ChannelElement *che = NULL, *che_prev = NULL;
enum RawDataBlockType elem_type, elem_type_prev = TYPE_END;
int err, elem_id;
- int samples = 0, multiplier, audio_found = 0;
+ int samples = 0, multiplier, audio_found = 0, pce_found = 0;
if (show_bits(gb, 12) == 0xfff) {
if (parse_adts_frame_header(ac, gb) < 0) {
av_log(avctx, AV_LOG_ERROR, "Error decoding AAC frame header.\n");
- return -1;
+ err = -1;
+ goto fail;
}
- if (ac->m4ac.sampling_index > 12) {
- av_log(ac->avctx, AV_LOG_ERROR, "invalid sampling rate index %d\n", ac->m4ac.sampling_index);
- return -1;
+ if (ac->oc[1].m4ac.sampling_index > 12) {
+ av_log(ac->avctx, AV_LOG_ERROR, "invalid sampling rate index %d\n", ac->oc[1].m4ac.sampling_index);
+ err = -1;
+ goto fail;
}
}
+ if (frame_configure_elements(avctx) < 0) {
+ err = -1;
+ goto fail;
+ }
+
ac->tags_mapped = 0;
// parse
while ((elem_type = get_bits(gb, 3)) != TYPE_END) {
@@ -2156,7 +2419,8 @@ static int aac_decode_frame_int(AVCodecContext *avctx, void *data,
if (!(che=get_che(ac, elem_type, elem_id))) {
av_log(ac->avctx, AV_LOG_ERROR, "channel element %d.%d is not allocated\n",
elem_type, elem_id);
- return -1;
+ err = -1;
+ goto fail;
}
samples = 1024;
}
@@ -2187,15 +2451,22 @@ static int aac_decode_frame_int(AVCodecContext *avctx, void *data,
break;
case TYPE_PCE: {
- enum ChannelPosition new_che_pos[4][MAX_ELEM_ID];
- memset(new_che_pos, 0, 4 * MAX_ELEM_ID * sizeof(new_che_pos[0][0]));
- if ((err = decode_pce(avctx, &ac->m4ac, new_che_pos, gb)))
+ uint8_t layout_map[MAX_ELEM_ID*4][3];
+ int tags;
+ push_output_configuration(ac);
+ tags = decode_pce(avctx, &ac->oc[1].m4ac, layout_map, gb);
+ if (tags < 0) {
+ err = tags;
break;
- if (ac->output_configured > OC_TRIAL_PCE)
+ }
+ if (pce_found) {
av_log(avctx, AV_LOG_ERROR,
"Not evaluating a further program_config_element as this construct is dubious at best.\n");
- else
- err = output_configure(ac, ac->che_pos, new_che_pos, 0, OC_TRIAL_PCE);
+ pop_output_configuration(ac);
+ } else {
+ err = output_configure(ac, layout_map, tags, OC_TRIAL_PCE, 1);
+ pce_found = 1;
+ }
break;
}
@@ -2204,7 +2475,8 @@ static int aac_decode_frame_int(AVCodecContext *avctx, void *data,
elem_id += get_bits(gb, 8) - 1;
if (get_bits_left(gb) < 8 * elem_id) {
av_log(avctx, AV_LOG_ERROR, overread_err);
- return -1;
+ err = -1;
+ goto fail;
}
while (elem_id > 0)
elem_id -= decode_extension_payload(ac, gb, elem_id, che_prev, elem_type_prev);
@@ -2220,48 +2492,36 @@ static int aac_decode_frame_int(AVCodecContext *avctx, void *data,
elem_type_prev = elem_type;
if (err)
- return err;
+ goto fail;
if (get_bits_left(gb) < 3) {
av_log(avctx, AV_LOG_ERROR, overread_err);
- return -1;
+ err = -1;
+ goto fail;
}
}
spectral_to_sample(ac);
- multiplier = (ac->m4ac.sbr == 1) ? ac->m4ac.ext_sample_rate > ac->m4ac.sample_rate : 0;
+ multiplier = (ac->oc[1].m4ac.sbr == 1) ? ac->oc[1].m4ac.ext_sample_rate > ac->oc[1].m4ac.sample_rate : 0;
samples <<= multiplier;
- if (ac->output_configured < OC_LOCKED) {
- avctx->sample_rate = ac->m4ac.sample_rate << multiplier;
- avctx->frame_size = samples;
- }
if (samples) {
- /* get output buffer */
ac->frame.nb_samples = samples;
- if ((err = avctx->get_buffer(avctx, &ac->frame)) < 0) {
- av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
- return err;
- }
-
- if (avctx->sample_fmt == AV_SAMPLE_FMT_FLT)
- ac->fmt_conv.float_interleave((float *)ac->frame.data[0],
- (const float **)ac->output_data,
- samples, avctx->channels);
- else
- ac->fmt_conv.float_to_int16_interleave((int16_t *)ac->frame.data[0],
- (const float **)ac->output_data,
- samples, avctx->channels);
-
*(AVFrame *)data = ac->frame;
}
*got_frame_ptr = !!samples;
- if (ac->output_configured && audio_found)
- ac->output_configured = OC_LOCKED;
+ if (ac->oc[1].status && audio_found) {
+ avctx->sample_rate = ac->oc[1].m4ac.sample_rate << multiplier;
+ avctx->frame_size = samples;
+ ac->oc[1].status = OC_LOCKED;
+ }
return 0;
+fail:
+ pop_output_configuration(ac);
+ return err;
}
static int aac_decode_frame(AVCodecContext *avctx, void *data,
@@ -2287,10 +2547,13 @@ static int aac_decode_frame(AVCodecContext *avctx, void *data,
return AVERROR(ENOMEM);
avctx->extradata_size = new_extradata_size;
memcpy(avctx->extradata, new_extradata, new_extradata_size);
- if (decode_audio_specific_config(ac, ac->avctx, &ac->m4ac,
+ push_output_configuration(ac);
+ if (decode_audio_specific_config(ac, ac->avctx, &ac->oc[1].m4ac,
avctx->extradata,
- avctx->extradata_size*8, 1) < 0)
+ avctx->extradata_size*8, 1) < 0) {
+ pop_output_configuration(ac);
return AVERROR_INVALIDDATA;
+ }
}
init_get_bits(&gb, buf, buf_size * 8);
@@ -2350,7 +2613,7 @@ static int latm_decode_audio_specific_config(struct LATMContext *latmctx,
{
AACContext *ac = &latmctx->aac_ctx;
AVCodecContext *avctx = ac->avctx;
- MPEG4AudioConfig m4ac = {0};
+ MPEG4AudioConfig m4ac = { 0 };
int config_start_bit = get_bits_count(gb);
int sync_extension = 0;
int bits_consumed, esize;
@@ -2362,9 +2625,9 @@ static int latm_decode_audio_specific_config(struct LATMContext *latmctx,
asclen = get_bits_left(gb);
if (config_start_bit % 8) {
- av_log_missing_feature(latmctx->aac_ctx.avctx, "audio specific "
- "config not byte aligned.\n", 1);
- return AVERROR_INVALIDDATA;
+ av_log_missing_feature(latmctx->aac_ctx.avctx,
+ "Non-byte-aligned audio-specific config", 1);
+ return AVERROR_PATCHWELCOME;
}
if (asclen <= 0)
return AVERROR_INVALIDDATA;
@@ -2375,8 +2638,8 @@ static int latm_decode_audio_specific_config(struct LATMContext *latmctx,
if (bits_consumed < 0)
return AVERROR_INVALIDDATA;
- if (ac->m4ac.sample_rate != m4ac.sample_rate ||
- ac->m4ac.chan_config != m4ac.chan_config) {
+ if (ac->oc[1].m4ac.sample_rate != m4ac.sample_rate ||
+ ac->oc[1].m4ac.chan_config != m4ac.chan_config) {
av_log(avctx, AV_LOG_INFO, "audio config changed\n");
latmctx->initialized = 0;
@@ -2418,7 +2681,7 @@ static int read_stream_mux_config(struct LATMContext *latmctx,
// numPrograms
if (get_bits(gb, 4)) { // numPrograms
av_log_missing_feature(latmctx->aac_ctx.avctx,
- "multiple programs are not supported\n", 1);
+ "Multiple programs", 1);
return AVERROR_PATCHWELCOME;
}
@@ -2427,7 +2690,7 @@ static int read_stream_mux_config(struct LATMContext *latmctx,
// for each layer (which there is only on in DVB)
if (get_bits(gb, 3)) { // numLayer
av_log_missing_feature(latmctx->aac_ctx.avctx,
- "multiple layers are not supported\n", 1);
+ "Multiple layers", 1);
return AVERROR_PATCHWELCOME;
}
@@ -2557,10 +2820,13 @@ static int latm_decode_frame(AVCodecContext *avctx, void *out,
*got_frame_ptr = 0;
return avpkt->size;
} else {
+ push_output_configuration(&latmctx->aac_ctx);
if ((err = decode_audio_specific_config(
- &latmctx->aac_ctx, avctx, &latmctx->aac_ctx.m4ac,
- avctx->extradata, avctx->extradata_size*8, 1)) < 0)
+ &latmctx->aac_ctx, avctx, &latmctx->aac_ctx.oc[1].m4ac,
+ avctx->extradata, avctx->extradata_size*8, 1)) < 0) {
+ pop_output_configuration(&latmctx->aac_ctx);
return err;
+ }
latmctx->initialized = 1;
}
}
@@ -2578,7 +2844,7 @@ static int latm_decode_frame(AVCodecContext *avctx, void *out,
return muxlength;
}
-av_cold static int latm_decode_init(AVCodecContext *avctx)
+static av_cold int latm_decode_init(AVCodecContext *avctx)
{
struct LATMContext *latmctx = avctx->priv_data;
int ret = aac_decode_init(avctx);
@@ -2591,18 +2857,18 @@ av_cold static int latm_decode_init(AVCodecContext *avctx)
AVCodec ff_aac_decoder = {
- .name = "aac",
- .type = AVMEDIA_TYPE_AUDIO,
- .id = CODEC_ID_AAC,
- .priv_data_size = sizeof(AACContext),
- .init = aac_decode_init,
- .close = aac_decode_close,
- .decode = aac_decode_frame,
- .long_name = NULL_IF_CONFIG_SMALL("Advanced Audio Coding"),
- .sample_fmts = (const enum AVSampleFormat[]) {
- AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_NONE
+ .name = "aac",
+ .type = AVMEDIA_TYPE_AUDIO,
+ .id = AV_CODEC_ID_AAC,
+ .priv_data_size = sizeof(AACContext),
+ .init = aac_decode_init,
+ .close = aac_decode_close,
+ .decode = aac_decode_frame,
+ .long_name = NULL_IF_CONFIG_SMALL("AAC (Advanced Audio Coding)"),
+ .sample_fmts = (const enum AVSampleFormat[]) {
+ AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_NONE
},
- .capabilities = CODEC_CAP_CHANNEL_CONF | CODEC_CAP_DR1,
+ .capabilities = CODEC_CAP_CHANNEL_CONF | CODEC_CAP_DR1,
.channel_layouts = aac_channel_layout,
};
@@ -2612,17 +2878,17 @@ AVCodec ff_aac_decoder = {
To do a more complex LATM demuxing a separate LATM demuxer should be used.
*/
AVCodec ff_aac_latm_decoder = {
- .name = "aac_latm",
- .type = AVMEDIA_TYPE_AUDIO,
- .id = CODEC_ID_AAC_LATM,
- .priv_data_size = sizeof(struct LATMContext),
- .init = latm_decode_init,
- .close = aac_decode_close,
- .decode = latm_decode_frame,
- .long_name = NULL_IF_CONFIG_SMALL("AAC LATM (Advanced Audio Codec LATM syntax)"),
- .sample_fmts = (const enum AVSampleFormat[]) {
- AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_NONE
+ .name = "aac_latm",
+ .type = AVMEDIA_TYPE_AUDIO,
+ .id = AV_CODEC_ID_AAC_LATM,
+ .priv_data_size = sizeof(struct LATMContext),
+ .init = latm_decode_init,
+ .close = aac_decode_close,
+ .decode = latm_decode_frame,
+ .long_name = NULL_IF_CONFIG_SMALL("AAC LATM (Advanced Audio Coding LATM syntax)"),
+ .sample_fmts = (const enum AVSampleFormat[]) {
+ AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_NONE
},
- .capabilities = CODEC_CAP_CHANNEL_CONF | CODEC_CAP_DR1,
+ .capabilities = CODEC_CAP_CHANNEL_CONF | CODEC_CAP_DR1,
.channel_layouts = aac_channel_layout,
};
diff --git a/gst-libs/ext/libav/libavcodec/aacdectab.h b/gst-libs/ext/libav/libavcodec/aacdectab.h
index 4f8d84b..4c23f2d 100644
--- a/gst-libs/ext/libav/libavcodec/aacdectab.h
+++ b/gst-libs/ext/libav/libavcodec/aacdectab.h
@@ -30,7 +30,7 @@
#ifndef AVCODEC_AACDECTAB_H
#define AVCODEC_AACDECTAB_H
-#include "libavutil/audioconvert.h"
+#include "libavutil/channel_layout.h"
#include "aac.h"
#include <stdint.h>
@@ -80,14 +80,14 @@ static const float * const tns_tmp2_map[4] = {
static const int8_t tags_per_config[16] = { 0, 1, 1, 2, 3, 3, 4, 5, 0, 0, 0, 0, 0, 0, 0, 0 };
-static const uint8_t aac_channel_layout_map[7][5][2] = {
- { { TYPE_SCE, 0 }, },
- { { TYPE_CPE, 0 }, },
- { { TYPE_CPE, 0 }, { TYPE_SCE, 0 }, },
- { { TYPE_CPE, 0 }, { TYPE_SCE, 0 }, { TYPE_SCE, 1 }, },
- { { TYPE_CPE, 0 }, { TYPE_SCE, 0 }, { TYPE_CPE, 1 }, },
- { { TYPE_CPE, 0 }, { TYPE_SCE, 0 }, { TYPE_LFE, 0 }, { TYPE_CPE, 1 }, },
- { { TYPE_CPE, 0 }, { TYPE_SCE, 0 }, { TYPE_LFE, 0 }, { TYPE_CPE, 2 }, { TYPE_CPE, 1 }, },
+static const uint8_t aac_channel_layout_map[7][5][3] = {
+ { { TYPE_SCE, 0, AAC_CHANNEL_FRONT }, },
+ { { TYPE_CPE, 0, AAC_CHANNEL_FRONT }, },
+ { { TYPE_SCE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 0, AAC_CHANNEL_FRONT }, },
+ { { TYPE_SCE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 0, AAC_CHANNEL_FRONT }, { TYPE_SCE, 1, AAC_CHANNEL_BACK }, },
+ { { TYPE_SCE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 1, AAC_CHANNEL_BACK }, },
+ { { TYPE_SCE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 1, AAC_CHANNEL_BACK }, { TYPE_LFE, 0, AAC_CHANNEL_LFE }, },
+ { { TYPE_SCE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 1, AAC_CHANNEL_FRONT }, { TYPE_CPE, 2, AAC_CHANNEL_BACK }, { TYPE_LFE, 0, AAC_CHANNEL_LFE }, },
};
static const uint64_t aac_channel_layout[8] = {
@@ -97,7 +97,7 @@ static const uint64_t aac_channel_layout[8] = {
AV_CH_LAYOUT_4POINT0,
AV_CH_LAYOUT_5POINT0_BACK,
AV_CH_LAYOUT_5POINT1_BACK,
- AV_CH_LAYOUT_7POINT1_WIDE,
+ AV_CH_LAYOUT_7POINT1_WIDE_BACK,
0,
};
diff --git a/gst-libs/ext/libav/libavcodec/aacenc.c b/gst-libs/ext/libav/libavcodec/aacenc.c
index b112fa8..6f582ca 100644
--- a/gst-libs/ext/libav/libavcodec/aacenc.c
+++ b/gst-libs/ext/libav/libavcodec/aacenc.c
@@ -30,10 +30,12 @@
* add temporal noise shaping
***********************************/
+#include "libavutil/float_dsp.h"
#include "libavutil/opt.h"
#include "avcodec.h"
#include "put_bits.h"
#include "dsputil.h"
+#include "internal.h"
#include "mpeg4audio.h"
#include "kbdwin.h"
#include "sinewin.h"
@@ -46,6 +48,14 @@
#define AAC_MAX_CHANNELS 6
+#define ERROR_IF(cond, ...) \
+ if (cond) { \
+ av_log(avctx, AV_LOG_ERROR, __VA_ARGS__); \
+ return AVERROR(EINVAL); \
+ }
+
+float ff_aac_pow34sf_tab[428];
+
static const uint8_t swb_size_1024_96[] = {
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 8, 8, 8, 8, 8,
12, 12, 12, 12, 12, 16, 16, 24, 28, 36, 44,
@@ -136,6 +146,18 @@ static const uint8_t aac_chan_configs[6][5] = {
};
/**
+ * Table to remap channels from Libav's default order to AAC order.
+ */
+static const uint8_t aac_chan_maps[AAC_MAX_CHANNELS][AAC_MAX_CHANNELS] = {
+ { 0 },
+ { 0, 1 },
+ { 2, 0, 1 },
+ { 2, 0, 1, 3 },
+ { 2, 0, 1, 3, 4 },
+ { 2, 0, 1, 4, 5, 3 },
+};
+
+/**
* Make AAC audio config object.
* @see 1.6.2.1 "Syntax - AudioSpecificConfig"
*/
@@ -147,7 +169,7 @@ static void put_audio_specific_config(AVCodecContext *avctx)
init_put_bits(&pb, avctx->extradata, avctx->extradata_size*8);
put_bits(&pb, 5, 2); //object type - AAC-LC
put_bits(&pb, 4, s->samplerate_index); //sample rate index
- put_bits(&pb, 4, avctx->channels);
+ put_bits(&pb, 4, s->channels);
//GASpecificConfig
put_bits(&pb, 1, 0); //frame length - 1024 samples
put_bits(&pb, 1, 0); //does not depend on core coder
@@ -160,117 +182,85 @@ static void put_audio_specific_config(AVCodecContext *avctx)
flush_put_bits(&pb);
}
-static av_cold int aac_encode_init(AVCodecContext *avctx)
+#define WINDOW_FUNC(type) \
+static void apply_ ##type ##_window(DSPContext *dsp, AVFloatDSPContext *fdsp, \
+ SingleChannelElement *sce, \
+ const float *audio)
+
+WINDOW_FUNC(only_long)
{
- AACEncContext *s = avctx->priv_data;
- int i;
- const uint8_t *sizes[2];
- uint8_t grouping[AAC_MAX_CHANNELS];
- int lengths[2];
+ const float *lwindow = sce->ics.use_kb_window[0] ? ff_aac_kbd_long_1024 : ff_sine_1024;
+ const float *pwindow = sce->ics.use_kb_window[1] ? ff_aac_kbd_long_1024 : ff_sine_1024;
+ float *out = sce->ret_buf;
- avctx->frame_size = 1024;
+ fdsp->vector_fmul (out, audio, lwindow, 1024);
+ dsp->vector_fmul_reverse(out + 1024, audio + 1024, pwindow, 1024);
+}
- for (i = 0; i < 16; i++)
- if (avctx->sample_rate == avpriv_mpeg4audio_sample_rates[i])
- break;
- if (i == 16) {
- av_log(avctx, AV_LOG_ERROR, "Unsupported sample rate %d\n", avctx->sample_rate);
- return -1;
- }
- if (avctx->channels > AAC_MAX_CHANNELS) {
- av_log(avctx, AV_LOG_ERROR, "Unsupported number of channels: %d\n", avctx->channels);
- return -1;
- }
- if (avctx->profile != FF_PROFILE_UNKNOWN && avctx->profile != FF_PROFILE_AAC_LOW) {
- av_log(avctx, AV_LOG_ERROR, "Unsupported profile %d\n", avctx->profile);
- return -1;
- }
- if (1024.0 * avctx->bit_rate / avctx->sample_rate > 6144 * avctx->channels) {
- av_log(avctx, AV_LOG_ERROR, "Too many bits per frame requested\n");
- return -1;
- }
- s->samplerate_index = i;
+WINDOW_FUNC(long_start)
+{
+ const float *lwindow = sce->ics.use_kb_window[1] ? ff_aac_kbd_long_1024 : ff_sine_1024;
+ const float *swindow = sce->ics.use_kb_window[0] ? ff_aac_kbd_short_128 : ff_sine_128;
+ float *out = sce->ret_buf;
+
+ fdsp->vector_fmul(out, audio, lwindow, 1024);
+ memcpy(out + 1024, audio + 1024, sizeof(out[0]) * 448);
+ dsp->vector_fmul_reverse(out + 1024 + 448, audio + 1024 + 448, swindow, 128);
+ memset(out + 1024 + 576, 0, sizeof(out[0]) * 448);
+}
- dsputil_init(&s->dsp, avctx);
- ff_mdct_init(&s->mdct1024, 11, 0, 1.0);
- ff_mdct_init(&s->mdct128, 8, 0, 1.0);
- // window init
- ff_kbd_window_init(ff_aac_kbd_long_1024, 4.0, 1024);
- ff_kbd_window_init(ff_aac_kbd_short_128, 6.0, 128);
- ff_init_ff_sine_windows(10);
- ff_init_ff_sine_windows(7);
+WINDOW_FUNC(long_stop)
+{
+ const float *lwindow = sce->ics.use_kb_window[0] ? ff_aac_kbd_long_1024 : ff_sine_1024;
+ const float *swindow = sce->ics.use_kb_window[1] ? ff_aac_kbd_short_128 : ff_sine_128;
+ float *out = sce->ret_buf;
+
+ memset(out, 0, sizeof(out[0]) * 448);
+ fdsp->vector_fmul(out + 448, audio + 448, swindow, 128);
+ memcpy(out + 576, audio + 576, sizeof(out[0]) * 448);
+ dsp->vector_fmul_reverse(out + 1024, audio + 1024, lwindow, 1024);
+}
- s->chan_map = aac_chan_configs[avctx->channels-1];
- s->samples = av_malloc(2 * 1024 * avctx->channels * sizeof(s->samples[0]));
- s->cpe = av_mallocz(sizeof(ChannelElement) * s->chan_map[0]);
- avctx->extradata = av_mallocz(5 + FF_INPUT_BUFFER_PADDING_SIZE);
- avctx->extradata_size = 5;
- put_audio_specific_config(avctx);
+WINDOW_FUNC(eight_short)
+{
+ const float *swindow = sce->ics.use_kb_window[0] ? ff_aac_kbd_short_128 : ff_sine_128;
+ const float *pwindow = sce->ics.use_kb_window[1] ? ff_aac_kbd_short_128 : ff_sine_128;
+ const float *in = audio + 448;
+ float *out = sce->ret_buf;
+ int w;
- sizes[0] = swb_size_1024[i];
- sizes[1] = swb_size_128[i];
- lengths[0] = ff_aac_num_swb_1024[i];
- lengths[1] = ff_aac_num_swb_128[i];
- for (i = 0; i < s->chan_map[0]; i++)
- grouping[i] = s->chan_map[i + 1] == TYPE_CPE;
- ff_psy_init(&s->psy, avctx, 2, sizes, lengths, s->chan_map[0], grouping);
- s->psypp = ff_psy_preprocess_init(avctx);
- s->coder = &ff_aac_coders[2];
+ for (w = 0; w < 8; w++) {
+ fdsp->vector_fmul (out, in, w ? pwindow : swindow, 128);
+ out += 128;
+ in += 128;
+ dsp->vector_fmul_reverse(out, in, swindow, 128);
+ out += 128;
+ }
+}
- s->lambda = avctx->global_quality ? avctx->global_quality : 120;
+static void (*const apply_window[4])(DSPContext *dsp, AVFloatDSPContext *fdsp,
+ SingleChannelElement *sce,
+ const float *audio) = {
+ [ONLY_LONG_SEQUENCE] = apply_only_long_window,
+ [LONG_START_SEQUENCE] = apply_long_start_window,
+ [EIGHT_SHORT_SEQUENCE] = apply_eight_short_window,
+ [LONG_STOP_SEQUENCE] = apply_long_stop_window
+};
- ff_aac_tableinit();
+static void apply_window_and_mdct(AACEncContext *s, SingleChannelElement *sce,
+ float *audio)
+{
+ int i;
+ float *output = sce->ret_buf;
- return 0;
-}
+ apply_window[sce->ics.window_sequence[0]](&s->dsp, &s->fdsp, sce, audio);
-static void apply_window_and_mdct(AVCodecContext *avctx, AACEncContext *s,
- SingleChannelElement *sce, short *audio)
-{
- int i, k;
- const int chans = avctx->channels;
- const float * lwindow = sce->ics.use_kb_window[0] ? ff_aac_kbd_long_1024 : ff_sine_1024;
- const float * swindow = sce->ics.use_kb_window[0] ? ff_aac_kbd_short_128 : ff_sine_128;
- const float * pwindow = sce->ics.use_kb_window[1] ? ff_aac_kbd_short_128 : ff_sine_128;
- float *output = sce->ret;
-
- if (sce->ics.window_sequence[0] != EIGHT_SHORT_SEQUENCE) {
- memcpy(output, sce->saved, sizeof(float)*1024);
- if (sce->ics.window_sequence[0] == LONG_STOP_SEQUENCE) {
- memset(output, 0, sizeof(output[0]) * 448);
- for (i = 448; i < 576; i++)
- output[i] = sce->saved[i] * pwindow[i - 448];
- for (i = 576; i < 704; i++)
- output[i] = sce->saved[i];
- }
- if (sce->ics.window_sequence[0] != LONG_START_SEQUENCE) {
- for (i = 0; i < 1024; i++) {
- output[i+1024] = audio[i * chans] * lwindow[1024 - i - 1];
- sce->saved[i] = audio[i * chans] * lwindow[i];
- }
- } else {
- for (i = 0; i < 448; i++)
- output[i+1024] = audio[i * chans];
- for (; i < 576; i++)
- output[i+1024] = audio[i * chans] * swindow[576 - i - 1];
- memset(output+1024+576, 0, sizeof(output[0]) * 448);
- for (i = 0; i < 1024; i++)
- sce->saved[i] = audio[i * chans];
- }
+ if (sce->ics.window_sequence[0] != EIGHT_SHORT_SEQUENCE)
s->mdct1024.mdct_calc(&s->mdct1024, sce->coeffs, output);
- } else {
- for (k = 0; k < 1024; k += 128) {
- for (i = 448 + k; i < 448 + k + 256; i++)
- output[i - 448 - k] = (i < 1024)
- ? sce->saved[i]
- : audio[(i-1024)*chans];
- s->dsp.vector_fmul (output, output, k ? swindow : pwindow, 128);
- s->dsp.vector_fmul_reverse(output+128, output+128, swindow, 128);
- s->mdct128.mdct_calc(&s->mdct128, sce->coeffs + k, output);
- }
- for (i = 0; i < 1024; i++)
- sce->saved[i] = audio[i * chans];
- }
+ else
+ for (i = 0; i < 1024; i += 128)
+ s->mdct128.mdct_calc(&s->mdct128, sce->coeffs + i, output + i*2);
+ memcpy(audio, audio + 1024, sizeof(audio[0]) * 1024);
}
/**
@@ -312,7 +302,7 @@ static void encode_ms_info(PutBitContext *pb, ChannelElement *cpe)
/**
* Produce integer coefficients from scalefactors provided by the model.
*/
-static void adjust_frame_information(AACEncContext *apc, ChannelElement *cpe, int chans)
+static void adjust_frame_information(ChannelElement *cpe, int chans)
{
int i, w, w2, g, ch;
int start, maxsfb, cmaxsfb;
@@ -470,8 +460,7 @@ static int encode_individual_channel(AVCodecContext *avctx, AACEncContext *s,
/**
* Write some auxiliary information about the created AAC file.
*/
-static void put_bitstream_info(AVCodecContext *avctx, AACEncContext *s,
- const char *name)
+static void put_bitstream_info(AACEncContext *s, const char *name)
{
int i, namelen, padbits;
@@ -479,48 +468,66 @@ static void put_bitstream_info(AVCodecContext *avctx, AACEncContext *s,
put_bits(&s->pb, 3, TYPE_FIL);
put_bits(&s->pb, 4, FFMIN(namelen, 15));
if (namelen >= 15)
- put_bits(&s->pb, 8, namelen - 16);
+ put_bits(&s->pb, 8, namelen - 14);
put_bits(&s->pb, 4, 0); //extension type - filler
- padbits = 8 - (put_bits_count(&s->pb) & 7);
+ padbits = -put_bits_count(&s->pb) & 7;
avpriv_align_put_bits(&s->pb);
for (i = 0; i < namelen - 2; i++)
put_bits(&s->pb, 8, name[i]);
put_bits(&s->pb, 12 - padbits, 0);
}
-static int aac_encode_frame(AVCodecContext *avctx,
- uint8_t *frame, int buf_size, void *data)
+/*
+ * Copy input samples.
+ * Channels are reordered from Libav's default order to AAC order.
+ */
+static void copy_input_samples(AACEncContext *s, const AVFrame *frame)
+{
+ int ch;
+ int end = 2048 + (frame ? frame->nb_samples : 0);
+ const uint8_t *channel_map = aac_chan_maps[s->channels - 1];
+
+ /* copy and remap input samples */
+ for (ch = 0; ch < s->channels; ch++) {
+ /* copy last 1024 samples of previous frame to the start of the current frame */
+ memcpy(&s->planar_samples[ch][1024], &s->planar_samples[ch][2048], 1024 * sizeof(s->planar_samples[0][0]));
+
+ /* copy new samples and zero any remaining samples */
+ if (frame) {
+ memcpy(&s->planar_samples[ch][2048],
+ frame->extended_data[channel_map[ch]],
+ frame->nb_samples * sizeof(s->planar_samples[0][0]));
+ }
+ memset(&s->planar_samples[ch][end], 0,
+ (3072 - end) * sizeof(s->planar_samples[0][0]));
+ }
+}
+
+static int aac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
+ const AVFrame *frame, int *got_packet_ptr)
{
AACEncContext *s = avctx->priv_data;
- int16_t *samples = s->samples, *samples2, *la;
+ float **samples = s->planar_samples, *samples2, *la, *overlap;
ChannelElement *cpe;
- int i, ch, w, g, chans, tag, start_ch;
+ int i, ch, w, g, chans, tag, start_ch, ret;
int chan_el_counter[4];
FFPsyWindowInfo windows[AAC_MAX_CHANNELS];
- if (s->last_frame)
+ if (s->last_frame == 2)
return 0;
- if (data) {
- if (!s->psypp) {
- memcpy(s->samples + 1024 * avctx->channels, data,
- 1024 * avctx->channels * sizeof(s->samples[0]));
- } else {
- start_ch = 0;
- samples2 = s->samples + 1024 * avctx->channels;
- for (i = 0; i < s->chan_map[0]; i++) {
- tag = s->chan_map[i+1];
- chans = tag == TYPE_CPE ? 2 : 1;
- ff_psy_preprocess(s->psypp, (uint16_t*)data + start_ch,
- samples2 + start_ch, start_ch, chans);
- start_ch += chans;
- }
- }
+
+ /* add current frame to queue */
+ if (frame) {
+ if ((ret = ff_af_queue_add(&s->afq, frame)) < 0)
+ return ret;
}
- if (!avctx->frame_number) {
- memcpy(s->samples, s->samples + 1024 * avctx->channels,
- 1024 * avctx->channels * sizeof(s->samples[0]));
+
+ copy_input_samples(s, frame);
+ if (s->psypp)
+ ff_psy_preprocess(s->psypp, s->planar_samples, s->channels);
+
+ if (!avctx->frame_number)
return 0;
- }
start_ch = 0;
for (i = 0; i < s->chan_map[0]; i++) {
@@ -531,9 +538,10 @@ static int aac_encode_frame(AVCodecContext *avctx,
for (ch = 0; ch < chans; ch++) {
IndividualChannelStream *ics = &cpe->ch[ch].ics;
int cur_channel = start_ch + ch;
- samples2 = samples + cur_channel;
- la = samples2 + (448+64) * avctx->channels;
- if (!data)
+ overlap = &samples[cur_channel][0];
+ samples2 = overlap + 1024;
+ la = samples2 + (448+64);
+ if (!frame)
la = NULL;
if (tag == TYPE_LFE) {
wi[ch].window_type[0] = ONLY_LONG_SEQUENCE;
@@ -560,15 +568,22 @@ static int aac_encode_frame(AVCodecContext *avctx,
for (w = 0; w < ics->num_windows; w++)
ics->group_len[w] = wi[ch].grouping[w];
- apply_window_and_mdct(avctx, s, &cpe->ch[ch], samples2);
+ apply_window_and_mdct(s, &cpe->ch[ch], overlap);
}
start_ch += chans;
}
+ if ((ret = ff_alloc_packet(avpkt, 768 * s->channels))) {
+ av_log(avctx, AV_LOG_ERROR, "Error getting output packet\n");
+ return ret;
+ }
+
do {
int frame_bits;
- init_put_bits(&s->pb, frame, buf_size*8);
+
+ init_put_bits(&s->pb, avpkt->data, avpkt->size);
+
if ((avctx->frame_number & 0xFF)==1 && !(avctx->flags & CODEC_FLAG_BITEXACT))
- put_bitstream_info(avctx, s, LIBAVCODEC_IDENT);
+ put_bitstream_info(s, LIBAVCODEC_IDENT);
start_ch = 0;
memset(chan_el_counter, 0, sizeof(chan_el_counter));
for (i = 0; i < s->chan_map[0]; i++) {
@@ -610,7 +625,7 @@ static int aac_encode_frame(AVCodecContext *avctx,
s->coder->search_for_ms(s, cpe, s->lambda);
}
}
- adjust_frame_information(s, cpe, chans);
+ adjust_frame_information(cpe, chans);
if (chans == 2) {
put_bits(&s->pb, 1, cpe->common_window);
if (cpe->common_window) {
@@ -626,8 +641,8 @@ static int aac_encode_frame(AVCodecContext *avctx,
}
frame_bits = put_bits_count(&s->pb);
- if (frame_bits <= 6144 * avctx->channels - 3) {
- s->psy.bitres.bits = frame_bits / avctx->channels;
+ if (frame_bits <= 6144 * s->channels - 3) {
+ s->psy.bitres.bits = frame_bits / s->channels;
break;
}
@@ -646,11 +661,15 @@ static int aac_encode_frame(AVCodecContext *avctx,
s->lambda = FFMIN(s->lambda, 65536.f);
}
- if (!data)
- s->last_frame = 1;
- memcpy(s->samples, s->samples + 1024 * avctx->channels,
- 1024 * avctx->channels * sizeof(s->samples[0]));
- return put_bits_count(&s->pb)>>3;
+ if (!frame)
+ s->last_frame++;
+
+ ff_af_queue_remove(&s->afq, avctx->frame_size, &avpkt->pts,
+ &avpkt->duration);
+
+ avpkt->size = put_bits_count(&s->pb) >> 3;
+ *got_packet_ptr = 1;
+ return 0;
}
static av_cold int aac_encode_end(AVCodecContext *avctx)
@@ -660,18 +679,129 @@ static av_cold int aac_encode_end(AVCodecContext *avctx)
ff_mdct_end(&s->mdct1024);
ff_mdct_end(&s->mdct128);
ff_psy_end(&s->psy);
- ff_psy_preprocess_end(s->psypp);
- av_freep(&s->samples);
+ if (s->psypp)
+ ff_psy_preprocess_end(s->psypp);
+ av_freep(&s->buffer.samples);
av_freep(&s->cpe);
+ ff_af_queue_close(&s->afq);
+#if FF_API_OLD_ENCODE_AUDIO
+ av_freep(&avctx->coded_frame);
+#endif
+ return 0;
+}
+
+static av_cold int dsp_init(AVCodecContext *avctx, AACEncContext *s)
+{
+ int ret = 0;
+
+ ff_dsputil_init(&s->dsp, avctx);
+ avpriv_float_dsp_init(&s->fdsp, avctx->flags & CODEC_FLAG_BITEXACT);
+
+ // window init
+ ff_kbd_window_init(ff_aac_kbd_long_1024, 4.0, 1024);
+ ff_kbd_window_init(ff_aac_kbd_short_128, 6.0, 128);
+ ff_init_ff_sine_windows(10);
+ ff_init_ff_sine_windows(7);
+
+ if (ret = ff_mdct_init(&s->mdct1024, 11, 0, 32768.0))
+ return ret;
+ if (ret = ff_mdct_init(&s->mdct128, 8, 0, 32768.0))
+ return ret;
+
+ return 0;
+}
+
+static av_cold int alloc_buffers(AVCodecContext *avctx, AACEncContext *s)
+{
+ int ch;
+ FF_ALLOCZ_OR_GOTO(avctx, s->buffer.samples, 3 * 1024 * s->channels * sizeof(s->buffer.samples[0]), alloc_fail);
+ FF_ALLOCZ_OR_GOTO(avctx, s->cpe, sizeof(ChannelElement) * s->chan_map[0], alloc_fail);
+ FF_ALLOCZ_OR_GOTO(avctx, avctx->extradata, 5 + FF_INPUT_BUFFER_PADDING_SIZE, alloc_fail);
+
+ for(ch = 0; ch < s->channels; ch++)
+ s->planar_samples[ch] = s->buffer.samples + 3 * 1024 * ch;
+
+#if FF_API_OLD_ENCODE_AUDIO
+ if (!(avctx->coded_frame = avcodec_alloc_frame()))
+ goto alloc_fail;
+#endif
+
+ return 0;
+alloc_fail:
+ return AVERROR(ENOMEM);
+}
+
+static av_cold int aac_encode_init(AVCodecContext *avctx)
+{
+ AACEncContext *s = avctx->priv_data;
+ int i, ret = 0;
+ const uint8_t *sizes[2];
+ uint8_t grouping[AAC_MAX_CHANNELS];
+ int lengths[2];
+
+ avctx->frame_size = 1024;
+
+ for (i = 0; i < 16; i++)
+ if (avctx->sample_rate == avpriv_mpeg4audio_sample_rates[i])
+ break;
+
+ s->channels = avctx->channels;
+
+ ERROR_IF(i == 16,
+ "Unsupported sample rate %d\n", avctx->sample_rate);
+ ERROR_IF(s->channels > AAC_MAX_CHANNELS,
+ "Unsupported number of channels: %d\n", s->channels);
+ ERROR_IF(avctx->profile != FF_PROFILE_UNKNOWN && avctx->profile != FF_PROFILE_AAC_LOW,
+ "Unsupported profile %d\n", avctx->profile);
+ ERROR_IF(1024.0 * avctx->bit_rate / avctx->sample_rate > 6144 * s->channels,
+ "Too many bits per frame requested\n");
+
+ s->samplerate_index = i;
+
+ s->chan_map = aac_chan_configs[s->channels-1];
+
+ if (ret = dsp_init(avctx, s))
+ goto fail;
+
+ if (ret = alloc_buffers(avctx, s))
+ goto fail;
+
+ avctx->extradata_size = 5;
+ put_audio_specific_config(avctx);
+
+ sizes[0] = swb_size_1024[i];
+ sizes[1] = swb_size_128[i];
+ lengths[0] = ff_aac_num_swb_1024[i];
+ lengths[1] = ff_aac_num_swb_128[i];
+ for (i = 0; i < s->chan_map[0]; i++)
+ grouping[i] = s->chan_map[i + 1] == TYPE_CPE;
+ if (ret = ff_psy_init(&s->psy, avctx, 2, sizes, lengths, s->chan_map[0], grouping))
+ goto fail;
+ s->psypp = ff_psy_preprocess_init(avctx);
+ s->coder = &ff_aac_coders[2];
+
+ s->lambda = avctx->global_quality ? avctx->global_quality : 120;
+
+ ff_aac_tableinit();
+
+ for (i = 0; i < 428; i++)
+ ff_aac_pow34sf_tab[i] = sqrt(ff_aac_pow2sf_tab[i] * sqrt(ff_aac_pow2sf_tab[i]));
+
+ avctx->delay = 1024;
+ ff_af_queue_init(avctx, &s->afq);
+
return 0;
+fail:
+ aac_encode_end(avctx);
+ return ret;
}
#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), 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"},
+ {"stereo_mode", "Stereo coding method", offsetof(AACEncContext, options.stereo_mode), AV_OPT_TYPE_INT, {.i64 = 0}, -1, 1, AACENC_FLAGS, "stereo_mode"},
+ {"auto", "Selected by the Encoder", 0, AV_OPT_TYPE_CONST, {.i64 = -1 }, INT_MIN, INT_MAX, AACENC_FLAGS, "stereo_mode"},
+ {"ms_off", "Disable Mid/Side coding", 0, AV_OPT_TYPE_CONST, {.i64 = 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, {.i64 = 1 }, INT_MIN, INT_MAX, AACENC_FLAGS, "stereo_mode"},
{NULL}
};
@@ -685,13 +815,15 @@ static const AVClass aacenc_class = {
AVCodec ff_aac_encoder = {
.name = "aac",
.type = AVMEDIA_TYPE_AUDIO,
- .id = CODEC_ID_AAC,
+ .id = AV_CODEC_ID_AAC,
.priv_data_size = sizeof(AACEncContext),
.init = aac_encode_init,
- .encode = aac_encode_frame,
+ .encode2 = aac_encode_frame,
.close = aac_encode_end,
- .capabilities = CODEC_CAP_SMALL_LAST_FRAME | CODEC_CAP_DELAY | CODEC_CAP_EXPERIMENTAL,
- .sample_fmts = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_NONE},
- .long_name = NULL_IF_CONFIG_SMALL("Advanced Audio Coding"),
- .priv_class = &aacenc_class,
+ .capabilities = CODEC_CAP_SMALL_LAST_FRAME | CODEC_CAP_DELAY |
+ CODEC_CAP_EXPERIMENTAL,
+ .sample_fmts = (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_FLTP,
+ AV_SAMPLE_FMT_NONE },
+ .long_name = NULL_IF_CONFIG_SMALL("AAC (Advanced Audio Coding)"),
+ .priv_class = &aacenc_class,
};
diff --git a/gst-libs/ext/libav/libavcodec/aacenc.h b/gst-libs/ext/libav/libavcodec/aacenc.h
index acd185a..81ffb97 100644
--- a/gst-libs/ext/libav/libavcodec/aacenc.h
+++ b/gst-libs/ext/libav/libavcodec/aacenc.h
@@ -22,12 +22,13 @@
#ifndef AVCODEC_AACENC_H
#define AVCODEC_AACENC_H
+#include "libavutil/float_dsp.h"
#include "avcodec.h"
#include "put_bits.h"
#include "dsputil.h"
#include "aac.h"
-
+#include "audio_frame_queue.h"
#include "psymodel.h"
typedef struct AACEncOptions {
@@ -58,9 +59,11 @@ typedef struct AACEncContext {
FFTContext mdct1024; ///< long (1024 samples) frame transform context
FFTContext mdct128; ///< short (128 samples) frame transform context
DSPContext dsp;
- int16_t *samples; ///< saved preprocessed input
+ AVFloatDSPContext fdsp;
+ float *planar_samples[6]; ///< saved preprocessed input
int samplerate_index; ///< MPEG-4 samplerate index
+ int channels; ///< channel count
const uint8_t *chan_map; ///< channel configuration map
ChannelElement *cpe; ///< channel elements
@@ -70,8 +73,15 @@ typedef struct AACEncContext {
int cur_channel;
int last_frame;
float lambda;
+ AudioFrameQueue afq;
DECLARE_ALIGNED(16, int, qcoefs)[96]; ///< quantized coefficients
DECLARE_ALIGNED(32, float, scoefs)[1024]; ///< scaled coefficients
+
+ struct {
+ float *samples;
+ } buffer;
} AACEncContext;
+extern float ff_aac_pow34sf_tab[428];
+
#endif /* AVCODEC_AACENC_H */
diff --git a/gst-libs/ext/libav/libavcodec/aacps.c b/gst-libs/ext/libav/libavcodec/aacps.c
index 6c9dcf2..fa7e9ac 100644
--- a/gst-libs/ext/libav/libavcodec/aacps.c
+++ b/gst-libs/ext/libav/libavcodec/aacps.c
@@ -27,6 +27,7 @@
#include "aacps.h"
#include "aacps_tablegen.h"
#include "aacpsdata.c"
+#include "dsputil.h"
#define PS_BASELINE 0 ///< Operate in Baseline PS mode
///< Baseline implies 10 or 20 stereo bands,
@@ -284,7 +285,7 @@ err:
/** Split one subband into 2 subsubbands with a symmetric real filter.
* The filter must have its non-center even coefficients equal to zero. */
-static void hybrid2_re(float (*in)[2], float (*out)[32][2], const float filter[7], int len, int reverse)
+static void hybrid2_re(float (*in)[2], float (*out)[32][2], const float filter[8], int len, int reverse)
{
int i, j;
for (i = 0; i < len; i++, in++) {
@@ -304,26 +305,14 @@ static void hybrid2_re(float (*in)[2], float (*out)[32][2], const float filter[7
}
/** Split one subband into 6 subsubbands with a complex filter */
-static void hybrid6_cx(float (*in)[2], float (*out)[32][2], const float (*filter)[7][2], int len)
+static void hybrid6_cx(PSDSPContext *dsp, float (*in)[2], float (*out)[32][2], const float (*filter)[8][2], int len)
{
- int i, j, ssb;
+ int i;
int N = 8;
- float temp[8][2];
+ LOCAL_ALIGNED_16(float, temp, [8], [2]);
for (i = 0; i < len; i++, in++) {
- for (ssb = 0; ssb < N; ssb++) {
- float sum_re = filter[ssb][6][0] * in[6][0], sum_im = filter[ssb][6][0] * in[6][1];
- for (j = 0; j < 6; j++) {
- float in0_re = in[j][0];
- float in0_im = in[j][1];
- float in1_re = in[12-j][0];
- float in1_im = in[12-j][1];
- sum_re += filter[ssb][j][0] * (in0_re + in1_re) - filter[ssb][j][1] * (in0_im - in1_im);
- sum_im += filter[ssb][j][0] * (in0_im + in1_im) + filter[ssb][j][1] * (in0_re - in1_re);
- }
- temp[ssb][0] = sum_re;
- temp[ssb][1] = sum_im;
- }
+ dsp->hybrid_analysis(temp, in, filter, 1, N);
out[0][i][0] = temp[6][0];
out[0][i][1] = temp[6][1];
out[1][i][0] = temp[7][0];
@@ -339,28 +328,18 @@ static void hybrid6_cx(float (*in)[2], float (*out)[32][2], const float (*filter
}
}
-static void hybrid4_8_12_cx(float (*in)[2], float (*out)[32][2], const float (*filter)[7][2], int N, int len)
+static void hybrid4_8_12_cx(PSDSPContext *dsp, float (*in)[2], float (*out)[32][2], const float (*filter)[8][2], int N, int len)
{
- int i, j, ssb;
+ int i;
for (i = 0; i < len; i++, in++) {
- for (ssb = 0; ssb < N; ssb++) {
- float sum_re = filter[ssb][6][0] * in[6][0], sum_im = filter[ssb][6][0] * in[6][1];
- for (j = 0; j < 6; j++) {
- float in0_re = in[j][0];
- float in0_im = in[j][1];
- float in1_re = in[12-j][0];
- float in1_im = in[12-j][1];
- sum_re += filter[ssb][j][0] * (in0_re + in1_re) - filter[ssb][j][1] * (in0_im - in1_im);
- sum_im += filter[ssb][j][0] * (in0_im + in1_im) + filter[ssb][j][1] * (in0_re - in1_re);
- }
- out[ssb][i][0] = sum_re;
- out[ssb][i][1] = sum_im;
- }
+ dsp->hybrid_analysis(out[0] + i, in, filter, 32, N);
}
}
-static void hybrid_analysis(float out[91][32][2], float in[5][44][2], float L[2][38][64], int is34, int len)
+static void hybrid_analysis(PSDSPContext *dsp, float out[91][32][2],
+ float in[5][44][2], float L[2][38][64],
+ int is34, int len)
{
int i, j;
for (i = 0; i < 5; i++) {
@@ -370,27 +349,17 @@ static void hybrid_analysis(float out[91][32][2], float in[5][44][2], float L[2]
}
}
if (is34) {
- hybrid4_8_12_cx(in[0], out, f34_0_12, 12, len);
- hybrid4_8_12_cx(in[1], out+12, f34_1_8, 8, len);
- hybrid4_8_12_cx(in[2], out+20, f34_2_4, 4, len);
- hybrid4_8_12_cx(in[3], out+24, f34_2_4, 4, len);
- hybrid4_8_12_cx(in[4], out+28, f34_2_4, 4, len);
- for (i = 0; i < 59; i++) {
- for (j = 0; j < len; j++) {
- out[i+32][j][0] = L[0][j][i+5];
- out[i+32][j][1] = L[1][j][i+5];
- }
- }
+ hybrid4_8_12_cx(dsp, in[0], out, f34_0_12, 12, len);
+ hybrid4_8_12_cx(dsp, in[1], out+12, f34_1_8, 8, len);
+ hybrid4_8_12_cx(dsp, in[2], out+20, f34_2_4, 4, len);
+ hybrid4_8_12_cx(dsp, in[3], out+24, f34_2_4, 4, len);
+ hybrid4_8_12_cx(dsp, in[4], out+28, f34_2_4, 4, len);
+ dsp->hybrid_analysis_ileave(out + 27, L, 5, len);
} else {
- hybrid6_cx(in[0], out, f20_0_8, len);
+ hybrid6_cx(dsp, in[0], out, f20_0_8, len);
hybrid2_re(in[1], out+6, g1_Q2, len, 1);
hybrid2_re(in[2], out+8, g1_Q2, len, 0);
- for (i = 0; i < 61; i++) {
- for (j = 0; j < len; j++) {
- out[i+10][j][0] = L[0][j][i+3];
- out[i+10][j][1] = L[1][j][i+3];
- }
- }
+ dsp->hybrid_analysis_ileave(out + 7, L, 3, len);
}
//update in_buf
for (i = 0; i < 5; i++) {
@@ -398,7 +367,8 @@ static void hybrid_analysis(float out[91][32][2], float in[5][44][2], float L[2]
}
}
-static void hybrid_synthesis(float out[2][38][64], float in[91][32][2], int is34, int len)
+static void hybrid_synthesis(PSDSPContext *dsp, float out[2][38][64],
+ float in[91][32][2], int is34, int len)
{
int i, n;
if (is34) {
@@ -422,12 +392,7 @@ static void hybrid_synthesis(float out[2][38][64], float in[91][32][2], int is34
out[1][n][4] += in[28+i][n][1];
}
}
- for (i = 0; i < 59; i++) {
- for (n = 0; n < len; n++) {
- out[0][n][i+5] = in[i+32][n][0];
- out[1][n][i+5] = in[i+32][n][1];
- }
- }
+ dsp->hybrid_synthesis_deint(out, in + 27, 5, len);
} else {
for (n = 0; n < len; n++) {
out[0][n][0] = in[0][n][0] + in[1][n][0] + in[2][n][0] +
@@ -439,12 +404,7 @@ static void hybrid_synthesis(float out[2][38][64], float in[91][32][2], int is34
out[0][n][2] = in[8][n][0] + in[9][n][0];
out[1][n][2] = in[8][n][1] + in[9][n][1];
}
- for (i = 0; i < 61; i++) {
- for (n = 0; n < len; n++) {
- out[0][n][i+3] = in[i+10][n][0];
- out[1][n][i+3] = in[i+10][n][1];
- }
- }
+ dsp->hybrid_synthesis_deint(out, in + 7, 3, len);
}
}
@@ -648,8 +608,8 @@ static void map_val_20_to_34(float par[PS_MAX_NR_IIDICC])
static void decorrelation(PSContext *ps, float (*out)[32][2], const float (*s)[32][2], int is34)
{
- float power[34][PS_QMF_TIME_SLOTS] = {{0}};
- float transient_gain[34][PS_QMF_TIME_SLOTS];
+ LOCAL_ALIGNED_16(float, power, [34], [PS_QMF_TIME_SLOTS]);
+ LOCAL_ALIGNED_16(float, transient_gain, [34], [PS_QMF_TIME_SLOTS]);
float *peak_decay_nrg = ps->peak_decay_nrg;
float *power_smooth = ps->power_smooth;
float *peak_decay_diff_smooth = ps->peak_decay_diff_smooth;
@@ -661,10 +621,8 @@ static void decorrelation(PSContext *ps, float (*out)[32][2], const float (*s)[3
const float a_smooth = 0.25f; ///< Smoothing coefficient
int i, k, m, n;
int n0 = 0, nL = 32;
- static const int link_delay[] = { 3, 4, 5 };
- static const float a[] = { 0.65143905753106f,
- 0.56471812200776f,
- 0.48954165955695f };
+
+ memset(power, 0, 34 * sizeof(*power));
if (is34 != ps->is34bands_old) {
memset(ps->peak_decay_nrg, 0, sizeof(ps->peak_decay_nrg));
@@ -674,11 +632,9 @@ static void decorrelation(PSContext *ps, float (*out)[32][2], const float (*s)[3
memset(ps->ap_delay, 0, sizeof(ps->ap_delay));
}
- for (n = n0; n < nL; n++) {
- for (k = 0; k < NR_BANDS[is34]; k++) {
- int i = k_to_i[k];
- power[i][n] += s[k][n][0] * s[k][n][0] + s[k][n][1] * s[k][n][1];
- }
+ for (k = 0; k < NR_BANDS[is34]; k++) {
+ int i = k_to_i[k];
+ ps->dsp.add_squares(power[i], s[k], nL - n0);
}
//Transient detection
@@ -706,54 +662,31 @@ static void decorrelation(PSContext *ps, float (*out)[32][2], const float (*s)[3
for (k = 0; k < NR_ALLPASS_BANDS[is34]; k++) {
int b = k_to_i[k];
float g_decay_slope = 1.f - DECAY_SLOPE * (k - DECAY_CUTOFF[is34]);
- float ag[PS_AP_LINKS];
g_decay_slope = av_clipf(g_decay_slope, 0.f, 1.f);
memcpy(delay[k], delay[k]+nL, PS_MAX_DELAY*sizeof(delay[k][0]));
memcpy(delay[k]+PS_MAX_DELAY, s[k], numQMFSlots*sizeof(delay[k][0]));
for (m = 0; m < PS_AP_LINKS; m++) {
memcpy(ap_delay[k][m], ap_delay[k][m]+numQMFSlots, 5*sizeof(ap_delay[k][m][0]));
- ag[m] = a[m] * g_decay_slope;
- }
- for (n = n0; n < nL; n++) {
- float in_re = delay[k][n+PS_MAX_DELAY-2][0] * phi_fract[is34][k][0] -
- delay[k][n+PS_MAX_DELAY-2][1] * phi_fract[is34][k][1];
- float in_im = delay[k][n+PS_MAX_DELAY-2][0] * phi_fract[is34][k][1] +
- delay[k][n+PS_MAX_DELAY-2][1] * phi_fract[is34][k][0];
- for (m = 0; m < PS_AP_LINKS; m++) {
- float a_re = ag[m] * in_re;
- float a_im = ag[m] * in_im;
- float link_delay_re = ap_delay[k][m][n+5-link_delay[m]][0];
- float link_delay_im = ap_delay[k][m][n+5-link_delay[m]][1];
- float fractional_delay_re = Q_fract_allpass[is34][k][m][0];
- float fractional_delay_im = Q_fract_allpass[is34][k][m][1];
- ap_delay[k][m][n+5][0] = in_re;
- ap_delay[k][m][n+5][1] = in_im;
- in_re = link_delay_re * fractional_delay_re - link_delay_im * fractional_delay_im - a_re;
- in_im = link_delay_re * fractional_delay_im + link_delay_im * fractional_delay_re - a_im;
- ap_delay[k][m][n+5][0] += ag[m] * in_re;
- ap_delay[k][m][n+5][1] += ag[m] * in_im;
- }
- out[k][n][0] = transient_gain[b][n] * in_re;
- out[k][n][1] = transient_gain[b][n] * in_im;
}
+ ps->dsp.decorrelate(out[k], delay[k] + PS_MAX_DELAY - 2, ap_delay[k],
+ phi_fract[is34][k], Q_fract_allpass[is34][k],
+ transient_gain[b], g_decay_slope, nL - n0);
}
for (; k < SHORT_DELAY_BAND[is34]; k++) {
+ int i = k_to_i[k];
memcpy(delay[k], delay[k]+nL, PS_MAX_DELAY*sizeof(delay[k][0]));
memcpy(delay[k]+PS_MAX_DELAY, s[k], numQMFSlots*sizeof(delay[k][0]));
- for (n = n0; n < nL; n++) {
- //H = delay 14
- out[k][n][0] = transient_gain[k_to_i[k]][n] * delay[k][n+PS_MAX_DELAY-14][0];
- out[k][n][1] = transient_gain[k_to_i[k]][n] * delay[k][n+PS_MAX_DELAY-14][1];
- }
+ //H = delay 14
+ ps->dsp.mul_pair_single(out[k], delay[k] + PS_MAX_DELAY - 14,
+ transient_gain[i], nL - n0);
}
for (; k < NR_BANDS[is34]; k++) {
+ int i = k_to_i[k];
memcpy(delay[k], delay[k]+nL, PS_MAX_DELAY*sizeof(delay[k][0]));
memcpy(delay[k]+PS_MAX_DELAY, s[k], numQMFSlots*sizeof(delay[k][0]));
- for (n = n0; n < nL; n++) {
- //H = delay 1
- out[k][n][0] = transient_gain[k_to_i[k]][n] * delay[k][n+PS_MAX_DELAY-1][0];
- out[k][n][1] = transient_gain[k_to_i[k]][n] * delay[k][n+PS_MAX_DELAY-1][1];
- }
+ //H = delay 1
+ ps->dsp.mul_pair_single(out[k], delay[k] + PS_MAX_DELAY - 1,
+ transient_gain[i], nL - n0);
}
}
@@ -797,7 +730,7 @@ static void remap20(int8_t (**p_par_mapped)[PS_MAX_NR_IIDICC],
static void stereo_processing(PSContext *ps, float (*l)[32][2], float (*r)[32][2], int is34)
{
- int e, b, k, n;
+ int e, b, k;
float (*H11)[PS_MAX_NUM_ENV+1][PS_MAX_NR_IIDICC] = ps->H11;
float (*H12)[PS_MAX_NUM_ENV+1][PS_MAX_NR_IIDICC] = ps->H12;
@@ -909,78 +842,52 @@ static void stereo_processing(PSContext *ps, float (*l)[32][2], float (*r)[32][2
H22[0][e+1][b] = h22;
}
for (k = 0; k < NR_BANDS[is34]; k++) {
- float h11r, h12r, h21r, h22r;
- float h11i, h12i, h21i, h22i;
- float h11r_step, h12r_step, h21r_step, h22r_step;
- float h11i_step, h12i_step, h21i_step, h22i_step;
+ float h[2][4];
+ float h_step[2][4];
int start = ps->border_position[e];
int stop = ps->border_position[e+1];
float width = 1.f / (stop - start);
b = k_to_i[k];
- h11r = H11[0][e][b];
- h12r = H12[0][e][b];
- h21r = H21[0][e][b];
- h22r = H22[0][e][b];
+ h[0][0] = H11[0][e][b];
+ h[0][1] = H12[0][e][b];
+ h[0][2] = H21[0][e][b];
+ h[0][3] = H22[0][e][b];
if (!PS_BASELINE && ps->enable_ipdopd) {
//Is this necessary? ps_04_new seems unchanged
if ((is34 && k <= 13 && k >= 9) || (!is34 && k <= 1)) {
- h11i = -H11[1][e][b];
- h12i = -H12[1][e][b];
- h21i = -H21[1][e][b];
- h22i = -H22[1][e][b];
+ h[1][0] = -H11[1][e][b];
+ h[1][1] = -H12[1][e][b];
+ h[1][2] = -H21[1][e][b];
+ h[1][3] = -H22[1][e][b];
} else {
- h11i = H11[1][e][b];
- h12i = H12[1][e][b];
- h21i = H21[1][e][b];
- h22i = H22[1][e][b];
+ h[1][0] = H11[1][e][b];
+ h[1][1] = H12[1][e][b];
+ h[1][2] = H21[1][e][b];
+ h[1][3] = H22[1][e][b];
}
}
//Interpolation
- h11r_step = (H11[0][e+1][b] - h11r) * width;
- h12r_step = (H12[0][e+1][b] - h12r) * width;
- h21r_step = (H21[0][e+1][b] - h21r) * width;
- h22r_step = (H22[0][e+1][b] - h22r) * width;
+ h_step[0][0] = (H11[0][e+1][b] - h[0][0]) * width;
+ h_step[0][1] = (H12[0][e+1][b] - h[0][1]) * width;
+ h_step[0][2] = (H21[0][e+1][b] - h[0][2]) * width;
+ h_step[0][3] = (H22[0][e+1][b] - h[0][3]) * width;
if (!PS_BASELINE && ps->enable_ipdopd) {
- h11i_step = (H11[1][e+1][b] - h11i) * width;
- h12i_step = (H12[1][e+1][b] - h12i) * width;
- h21i_step = (H21[1][e+1][b] - h21i) * width;
- h22i_step = (H22[1][e+1][b] - h22i) * width;
- }
- for (n = start + 1; n <= stop; n++) {
- //l is s, r is d
- float l_re = l[k][n][0];
- float l_im = l[k][n][1];
- float r_re = r[k][n][0];
- float r_im = r[k][n][1];
- h11r += h11r_step;
- h12r += h12r_step;
- h21r += h21r_step;
- h22r += h22r_step;
- if (!PS_BASELINE && ps->enable_ipdopd) {
- h11i += h11i_step;
- h12i += h12i_step;
- h21i += h21i_step;
- h22i += h22i_step;
-
- l[k][n][0] = h11r*l_re + h21r*r_re - h11i*l_im - h21i*r_im;
- l[k][n][1] = h11r*l_im + h21r*r_im + h11i*l_re + h21i*r_re;
- r[k][n][0] = h12r*l_re + h22r*r_re - h12i*l_im - h22i*r_im;
- r[k][n][1] = h12r*l_im + h22r*r_im + h12i*l_re + h22i*r_re;
- } else {
- l[k][n][0] = h11r*l_re + h21r*r_re;
- l[k][n][1] = h11r*l_im + h21r*r_im;
- r[k][n][0] = h12r*l_re + h22r*r_re;
- r[k][n][1] = h12r*l_im + h22r*r_im;
- }
+ h_step[1][0] = (H11[1][e+1][b] - h[1][0]) * width;
+ h_step[1][1] = (H12[1][e+1][b] - h[1][1]) * width;
+ h_step[1][2] = (H21[1][e+1][b] - h[1][2]) * width;
+ h_step[1][3] = (H22[1][e+1][b] - h[1][3]) * width;
}
+ ps->dsp.stereo_interpolate[!PS_BASELINE && ps->enable_ipdopd](
+ l[k] + start + 1, r[k] + start + 1,
+ h, h_step, stop - start);
}
}
}
int ff_ps_apply(AVCodecContext *avctx, PSContext *ps, float L[2][38][64], float R[2][38][64], int top)
{
- float Lbuf[91][32][2];
- float Rbuf[91][32][2];
+ LOCAL_ALIGNED_16(float, Lbuf, [91], [32][2]);
+ LOCAL_ALIGNED_16(float, Rbuf, [91], [32][2]);
const int len = 32;
int is34 = ps->is34bands;
@@ -989,11 +896,11 @@ int ff_ps_apply(AVCodecContext *avctx, PSContext *ps, float L[2][38][64], float
if (top < NR_ALLPASS_BANDS[is34])
memset(ps->ap_delay + top, 0, (NR_ALLPASS_BANDS[is34] - top)*sizeof(ps->ap_delay[0]));
- hybrid_analysis(Lbuf, ps->in_buf, L, is34, len);
+ hybrid_analysis(&ps->dsp, Lbuf, ps->in_buf, L, is34, len);
decorrelation(ps, Rbuf, Lbuf, is34);
stereo_processing(ps, Lbuf, Rbuf, is34);
- hybrid_synthesis(L, Lbuf, is34, len);
- hybrid_synthesis(R, Rbuf, is34, len);
+ hybrid_synthesis(&ps->dsp, L, Lbuf, is34, len);
+ hybrid_synthesis(&ps->dsp, R, Rbuf, is34, len);
return 0;
}
@@ -1041,4 +948,5 @@ av_cold void ff_ps_init(void) {
av_cold void ff_ps_ctx_init(PSContext *ps)
{
+ ff_psdsp_init(&ps->dsp);
}
diff --git a/gst-libs/ext/libav/libavcodec/aacps.h b/gst-libs/ext/libav/libavcodec/aacps.h
index 124fbee..e8a195a 100644
--- a/gst-libs/ext/libav/libavcodec/aacps.h
+++ b/gst-libs/ext/libav/libavcodec/aacps.h
@@ -24,6 +24,7 @@
#include <stdint.h>
+#include "aacpsdsp.h"
#include "avcodec.h"
#include "get_bits.h"
@@ -37,7 +38,7 @@
#define PS_AP_LINKS 3
#define PS_MAX_AP_DELAY 5
-typedef struct {
+typedef struct PSContext {
int start;
int enable_iid;
int iid_quant;
@@ -60,18 +61,19 @@ typedef struct {
int is34bands;
int is34bands_old;
- float in_buf[5][44][2];
- float delay[PS_MAX_SSB][PS_QMF_TIME_SLOTS + PS_MAX_DELAY][2];
- float ap_delay[PS_MAX_AP_BANDS][PS_AP_LINKS][PS_QMF_TIME_SLOTS + PS_MAX_AP_DELAY][2];
- float peak_decay_nrg[34];
- float power_smooth[34];
- float peak_decay_diff_smooth[34];
- float H11[2][PS_MAX_NUM_ENV+1][PS_MAX_NR_IIDICC];
- float H12[2][PS_MAX_NUM_ENV+1][PS_MAX_NR_IIDICC];
- float H21[2][PS_MAX_NUM_ENV+1][PS_MAX_NR_IIDICC];
- float H22[2][PS_MAX_NUM_ENV+1][PS_MAX_NR_IIDICC];
+ DECLARE_ALIGNED(16, float, in_buf)[5][44][2];
+ DECLARE_ALIGNED(16, float, delay)[PS_MAX_SSB][PS_QMF_TIME_SLOTS + PS_MAX_DELAY][2];
+ DECLARE_ALIGNED(16, float, ap_delay)[PS_MAX_AP_BANDS][PS_AP_LINKS][PS_QMF_TIME_SLOTS + PS_MAX_AP_DELAY][2];
+ DECLARE_ALIGNED(16, float, peak_decay_nrg)[34];
+ DECLARE_ALIGNED(16, float, power_smooth)[34];
+ DECLARE_ALIGNED(16, float, peak_decay_diff_smooth)[34];
+ DECLARE_ALIGNED(16, float, H11)[2][PS_MAX_NUM_ENV+1][PS_MAX_NR_IIDICC];
+ DECLARE_ALIGNED(16, float, H12)[2][PS_MAX_NUM_ENV+1][PS_MAX_NR_IIDICC];
+ DECLARE_ALIGNED(16, float, H21)[2][PS_MAX_NUM_ENV+1][PS_MAX_NR_IIDICC];
+ DECLARE_ALIGNED(16, float, H22)[2][PS_MAX_NUM_ENV+1][PS_MAX_NR_IIDICC];
int8_t opd_hist[PS_MAX_NR_IIDICC];
int8_t ipd_hist[PS_MAX_NR_IIDICC];
+ PSDSPContext dsp;
} PSContext;
void ff_ps_init(void);
diff --git a/gst-libs/ext/libav/libavcodec/aacps_tablegen.c b/gst-libs/ext/libav/libavcodec/aacps_tablegen.c
index 8650226..635737d 100644
--- a/gst-libs/ext/libav/libavcodec/aacps_tablegen.c
+++ b/gst-libs/ext/libav/libavcodec/aacps_tablegen.c
@@ -69,23 +69,23 @@ int main(void)
write_float_3d_array(HB, 46, 8, 4);
printf("};\n");
- printf("static const float f20_0_8[8][7][2] = {\n");
- write_float_3d_array(f20_0_8, 8, 7, 2);
+ printf("static const DECLARE_ALIGNED(16, float, f20_0_8)[8][8][2] = {\n");
+ write_float_3d_array(f20_0_8, 8, 8, 2);
printf("};\n");
- printf("static const float f34_0_12[12][7][2] = {\n");
- write_float_3d_array(f34_0_12, 12, 7, 2);
+ printf("static const DECLARE_ALIGNED(16, float, f34_0_12)[12][8][2] = {\n");
+ write_float_3d_array(f34_0_12, 12, 8, 2);
printf("};\n");
- printf("static const float f34_1_8[8][7][2] = {\n");
- write_float_3d_array(f34_1_8, 8, 7, 2);
+ printf("static const DECLARE_ALIGNED(16, float, f34_1_8)[8][8][2] = {\n");
+ write_float_3d_array(f34_1_8, 8, 8, 2);
printf("};\n");
- printf("static const float f34_2_4[4][7][2] = {\n");
- write_float_3d_array(f34_2_4, 4, 7, 2);
+ printf("static const DECLARE_ALIGNED(16, float, f34_2_4)[4][8][2] = {\n");
+ write_float_3d_array(f34_2_4, 4, 8, 2);
printf("};\n");
- printf("static const float Q_fract_allpass[2][50][3][2] = {\n");
+ printf("static const DECLARE_ALIGNED(16, float, Q_fract_allpass)[2][50][3][2] = {\n");
write_float_4d_array(Q_fract_allpass, 2, 50, 3, 2);
printf("};\n");
- printf("static const float phi_fract[2][50][2] = {\n");
+ printf("static const DECLARE_ALIGNED(16, float, phi_fract)[2][50][2] = {\n");
write_float_3d_array(phi_fract, 2, 50, 2);
printf("};\n");
diff --git a/gst-libs/ext/libav/libavcodec/aacps_tablegen.h b/gst-libs/ext/libav/libavcodec/aacps_tablegen.h
index 5041f44..0c610ed 100644
--- a/gst-libs/ext/libav/libavcodec/aacps_tablegen.h
+++ b/gst-libs/ext/libav/libavcodec/aacps_tablegen.h
@@ -23,6 +23,7 @@
#ifndef AACPS_TABLEGEN_H
#define AACPS_TABLEGEN_H
+#include <math.h>
#include <stdint.h>
#if CONFIG_HARDCODED_TABLES
@@ -30,7 +31,9 @@
#include "libavcodec/aacps_tables.h"
#else
#include "libavutil/common.h"
+#include "libavutil/libm.h"
#include "libavutil/mathematics.h"
+#include "libavutil/mem.h"
#define NR_ALLPASS_BANDS20 30
#define NR_ALLPASS_BANDS34 50
#define PS_AP_LINKS 3
@@ -38,12 +41,12 @@ static float pd_re_smooth[8*8*8];
static float pd_im_smooth[8*8*8];
static float HA[46][8][4];
static float HB[46][8][4];
-static float f20_0_8 [ 8][7][2];
-static float f34_0_12[12][7][2];
-static float f34_1_8 [ 8][7][2];
-static float f34_2_4 [ 4][7][2];
-static float Q_fract_allpass[2][50][3][2];
-static float phi_fract[2][50][2];
+static DECLARE_ALIGNED(16, float, f20_0_8) [ 8][8][2];
+static DECLARE_ALIGNED(16, float, f34_0_12)[12][8][2];
+static DECLARE_ALIGNED(16, float, f34_1_8) [ 8][8][2];
+static DECLARE_ALIGNED(16, float, f34_2_4) [ 4][8][2];
+static DECLARE_ALIGNED(16, float, Q_fract_allpass)[2][50][3][2];
+static DECLARE_ALIGNED(16, float, phi_fract)[2][50][2];
static const float g0_Q8[] = {
0.00746082949812f, 0.02270420949825f, 0.04546865930473f, 0.07266113929591f,
@@ -65,7 +68,7 @@ static const float g2_Q4[] = {
0.16486303567403f, 0.23279856662996f, 0.25f
};
-static void make_filters_from_proto(float (*filter)[7][2], const float *proto, int bands)
+static void make_filters_from_proto(float (*filter)[8][2], const float *proto, int bands)
{
int q, n;
for (q = 0; q < bands; q++) {
diff --git a/gst-libs/ext/libav/libavcodec/aacpsdsp.c b/gst-libs/ext/libav/libavcodec/aacpsdsp.c
new file mode 100644
index 0000000..e90c50b
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/aacpsdsp.c
@@ -0,0 +1,214 @@
+/*
+ * Copyright (c) 2010 Alex Converse <alex.converse@gmail.com>
+ *
+ * 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
+ */
+
+#include "config.h"
+#include "libavutil/attributes.h"
+#include "aacpsdsp.h"
+
+static void ps_add_squares_c(float *dst, const float (*src)[2], int n)
+{
+ int i;
+ for (i = 0; i < n; i++)
+ dst[i] += src[i][0] * src[i][0] + src[i][1] * src[i][1];
+}
+
+static void ps_mul_pair_single_c(float (*dst)[2], float (*src0)[2], float *src1,
+ int n)
+{
+ int i;
+ for (i = 0; i < n; i++) {
+ dst[i][0] = src0[i][0] * src1[i];
+ dst[i][1] = src0[i][1] * src1[i];
+ }
+}
+
+static void ps_hybrid_analysis_c(float (*out)[2], float (*in)[2],
+ const float (*filter)[8][2],
+ int stride, int n)
+{
+ int i, j;
+
+ for (i = 0; i < n; i++) {
+ float sum_re = filter[i][6][0] * in[6][0];
+ float sum_im = filter[i][6][0] * in[6][1];
+
+ for (j = 0; j < 6; j++) {
+ float in0_re = in[j][0];
+ float in0_im = in[j][1];
+ float in1_re = in[12-j][0];
+ float in1_im = in[12-j][1];
+ sum_re += filter[i][j][0] * (in0_re + in1_re) -
+ filter[i][j][1] * (in0_im - in1_im);
+ sum_im += filter[i][j][0] * (in0_im + in1_im) +
+ filter[i][j][1] * (in0_re - in1_re);
+ }
+ out[i * stride][0] = sum_re;
+ out[i * stride][1] = sum_im;
+ }
+}
+
+static void ps_hybrid_analysis_ileave_c(float (*out)[32][2], float L[2][38][64],
+ int i, int len)
+{
+ int j;
+
+ for (; i < 64; i++) {
+ for (j = 0; j < len; j++) {
+ out[i][j][0] = L[0][j][i];
+ out[i][j][1] = L[1][j][i];
+ }
+ }
+}
+
+static void ps_hybrid_synthesis_deint_c(float out[2][38][64],
+ float (*in)[32][2],
+ int i, int len)
+{
+ int n;
+
+ for (; i < 64; i++) {
+ for (n = 0; n < len; n++) {
+ out[0][n][i] = in[i][n][0];
+ out[1][n][i] = in[i][n][1];
+ }
+ }
+}
+
+static void ps_decorrelate_c(float (*out)[2], float (*delay)[2],
+ float (*ap_delay)[PS_QMF_TIME_SLOTS + PS_MAX_AP_DELAY][2],
+ const float phi_fract[2], float (*Q_fract)[2],
+ const float *transient_gain,
+ float g_decay_slope,
+ int len)
+{
+ static const float a[] = { 0.65143905753106f,
+ 0.56471812200776f,
+ 0.48954165955695f };
+ float ag[PS_AP_LINKS];
+ int m, n;
+
+ for (m = 0; m < PS_AP_LINKS; m++)
+ ag[m] = a[m] * g_decay_slope;
+
+ for (n = 0; n < len; n++) {
+ float in_re = delay[n][0] * phi_fract[0] - delay[n][1] * phi_fract[1];
+ float in_im = delay[n][0] * phi_fract[1] + delay[n][1] * phi_fract[0];
+ for (m = 0; m < PS_AP_LINKS; m++) {
+ float a_re = ag[m] * in_re;
+ float a_im = ag[m] * in_im;
+ float link_delay_re = ap_delay[m][n+2-m][0];
+ float link_delay_im = ap_delay[m][n+2-m][1];
+ float fractional_delay_re = Q_fract[m][0];
+ float fractional_delay_im = Q_fract[m][1];
+ float apd_re = in_re;
+ float apd_im = in_im;
+ in_re = link_delay_re * fractional_delay_re -
+ link_delay_im * fractional_delay_im - a_re;
+ in_im = link_delay_re * fractional_delay_im +
+ link_delay_im * fractional_delay_re - a_im;
+ ap_delay[m][n+5][0] = apd_re + ag[m] * in_re;
+ ap_delay[m][n+5][1] = apd_im + ag[m] * in_im;
+ }
+ out[n][0] = transient_gain[n] * in_re;
+ out[n][1] = transient_gain[n] * in_im;
+ }
+}
+
+static void ps_stereo_interpolate_c(float (*l)[2], float (*r)[2],
+ float h[2][4], float h_step[2][4],
+ int len)
+{
+ float h0 = h[0][0];
+ float h1 = h[0][1];
+ float h2 = h[0][2];
+ float h3 = h[0][3];
+ float hs0 = h_step[0][0];
+ float hs1 = h_step[0][1];
+ float hs2 = h_step[0][2];
+ float hs3 = h_step[0][3];
+ int n;
+
+ for (n = 0; n < len; n++) {
+ //l is s, r is d
+ float l_re = l[n][0];
+ float l_im = l[n][1];
+ float r_re = r[n][0];
+ float r_im = r[n][1];
+ h0 += hs0;
+ h1 += hs1;
+ h2 += hs2;
+ h3 += hs3;
+ l[n][0] = h0 * l_re + h2 * r_re;
+ l[n][1] = h0 * l_im + h2 * r_im;
+ r[n][0] = h1 * l_re + h3 * r_re;
+ r[n][1] = h1 * l_im + h3 * r_im;
+ }
+}
+
+static void ps_stereo_interpolate_ipdopd_c(float (*l)[2], float (*r)[2],
+ float h[2][4], float h_step[2][4],
+ int len)
+{
+ float h00 = h[0][0], h10 = h[1][0];
+ float h01 = h[0][1], h11 = h[1][1];
+ float h02 = h[0][2], h12 = h[1][2];
+ float h03 = h[0][3], h13 = h[1][3];
+ float hs00 = h_step[0][0], hs10 = h_step[1][0];
+ float hs01 = h_step[0][1], hs11 = h_step[1][1];
+ float hs02 = h_step[0][2], hs12 = h_step[1][2];
+ float hs03 = h_step[0][3], hs13 = h_step[1][3];
+ int n;
+
+ for (n = 0; n < len; n++) {
+ //l is s, r is d
+ float l_re = l[n][0];
+ float l_im = l[n][1];
+ float r_re = r[n][0];
+ float r_im = r[n][1];
+ h00 += hs00;
+ h01 += hs01;
+ h02 += hs02;
+ h03 += hs03;
+ h10 += hs10;
+ h11 += hs11;
+ h12 += hs12;
+ h13 += hs13;
+
+ l[n][0] = h00 * l_re + h02 * r_re - h10 * l_im - h12 * r_im;
+ l[n][1] = h00 * l_im + h02 * r_im + h10 * l_re + h12 * r_re;
+ r[n][0] = h01 * l_re + h03 * r_re - h11 * l_im - h13 * r_im;
+ r[n][1] = h01 * l_im + h03 * r_im + h11 * l_re + h13 * r_re;
+ }
+}
+
+av_cold void ff_psdsp_init(PSDSPContext *s)
+{
+ s->add_squares = ps_add_squares_c;
+ s->mul_pair_single = ps_mul_pair_single_c;
+ s->hybrid_analysis = ps_hybrid_analysis_c;
+ s->hybrid_analysis_ileave = ps_hybrid_analysis_ileave_c;
+ s->hybrid_synthesis_deint = ps_hybrid_synthesis_deint_c;
+ s->decorrelate = ps_decorrelate_c;
+ s->stereo_interpolate[0] = ps_stereo_interpolate_c;
+ s->stereo_interpolate[1] = ps_stereo_interpolate_ipdopd_c;
+
+ if (ARCH_ARM)
+ ff_psdsp_init_arm(s);
+}
diff --git a/gst-libs/ext/libav/libavcodec/aacpsdsp.h b/gst-libs/ext/libav/libavcodec/aacpsdsp.h
new file mode 100644
index 0000000..93737d2
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/aacpsdsp.h
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2012 Mans Rullgard
+ *
+ * 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
+ */
+
+#ifndef LIBAVCODEC_AACPSDSP_H
+#define LIBAVCODEC_AACPSDSP_H
+
+#define PS_QMF_TIME_SLOTS 32
+#define PS_AP_LINKS 3
+#define PS_MAX_AP_DELAY 5
+
+typedef struct PSDSPContext {
+ void (*add_squares)(float *dst, const float (*src)[2], int n);
+ void (*mul_pair_single)(float (*dst)[2], float (*src0)[2], float *src1,
+ int n);
+ void (*hybrid_analysis)(float (*out)[2], float (*in)[2],
+ const float (*filter)[8][2],
+ int stride, int n);
+ void (*hybrid_analysis_ileave)(float (*out)[32][2], float L[2][38][64],
+ int i, int len);
+ void (*hybrid_synthesis_deint)(float out[2][38][64], float (*in)[32][2],
+ int i, int len);
+ void (*decorrelate)(float (*out)[2], float (*delay)[2],
+ float (*ap_delay)[PS_QMF_TIME_SLOTS+PS_MAX_AP_DELAY][2],
+ const float phi_fract[2], float (*Q_fract)[2],
+ const float *transient_gain,
+ float g_decay_slope,
+ int len);
+ void (*stereo_interpolate[2])(float (*l)[2], float (*r)[2],
+ float h[2][4], float h_step[2][4],
+ int len);
+} PSDSPContext;
+
+void ff_psdsp_init(PSDSPContext *s);
+void ff_psdsp_init_arm(PSDSPContext *s);
+
+#endif /* LIBAVCODEC_AACPSDSP_H */
diff --git a/gst-libs/ext/libav/libavcodec/aacpsy.c b/gst-libs/ext/libav/libavcodec/aacpsy.c
index 38d9d9f..e4b4405 100644
--- a/gst-libs/ext/libav/libavcodec/aacpsy.c
+++ b/gst-libs/ext/libav/libavcodec/aacpsy.c
@@ -389,9 +389,8 @@ static av_unused FFPsyWindowInfo psy_3gpp_window(FFPsyContext *ctx,
AacPsyChannel *pch = &pctx->ch[channel];
uint8_t grouping = 0;
int next_type = pch->next_window_seq;
- FFPsyWindowInfo wi;
+ FFPsyWindowInfo wi = { { 0 } };
- memset(&wi, 0, sizeof(wi));
if (la) {
float s[8], v;
int switch_to_eight = 0;
@@ -400,7 +399,7 @@ static av_unused FFPsyWindowInfo psy_3gpp_window(FFPsyContext *ctx,
int stay_short = 0;
for (i = 0; i < 8; i++) {
for (j = 0; j < 128; j++) {
- v = iir_filter(la[(i*128+j)*ctx->avctx->channels], pch->iir_state);
+ v = iir_filter(la[i*128+j], pch->iir_state);
sum += v*v;
}
s[i] = sum;
@@ -593,7 +592,7 @@ static void psy_3gpp_analyze_channel(FFPsyContext *ctx, int channel,
for (w = 0; w < wi->num_windows*16; w += 16) {
AacPsyBand *bands = &pch->band[w];
- //5.4.2.3 "Spreading" & 5.4.3 "Spreaded Energy Calculation"
+ /* 5.4.2.3 "Spreading" & 5.4.3 "Spread Energy Calculation" */
spread_en[0] = bands[0].energy;
for (g = 1; g < num_bands; g++) {
bands[g].thr = FFMAX(bands[g].thr, bands[g-1].thr * coeffs[g].spread_hi[0]);
@@ -613,7 +612,7 @@ static void psy_3gpp_analyze_channel(FFPsyContext *ctx, int channel,
band->thr = FFMAX(PSY_3GPP_RPEMIN*band->thr, FFMIN(band->thr,
PSY_3GPP_RPELEV*pch->prev_band[w+g].thr_quiet));
- /* 5.6.1.3.1 "Prepatory steps of the perceptual entropy calculation" */
+ /* 5.6.1.3.1 "Preparatory steps of the perceptual entropy calculation" */
pe += calc_pe_3gpp(band);
a += band->pe_const;
active_lines += band->active_lines;
@@ -776,9 +775,8 @@ static void lame_apply_block_type(AacPsyChannel *ctx, FFPsyWindowInfo *wi, int u
ctx->next_window_seq = blocktype;
}
-static FFPsyWindowInfo psy_lame_window(FFPsyContext *ctx,
- const int16_t *audio, const int16_t *la,
- int channel, int prev_type)
+static FFPsyWindowInfo psy_lame_window(FFPsyContext *ctx, const float *audio,
+ const float *la, int channel, int prev_type)
{
AacPsyContext *pctx = (AacPsyContext*) ctx->model_priv_data;
AacPsyChannel *pch = &pctx->ch[channel];
@@ -786,29 +784,28 @@ static FFPsyWindowInfo psy_lame_window(FFPsyContext *ctx,
int uselongblock = 1;
int attacks[AAC_NUM_BLOCKS_SHORT + 1] = { 0 };
int i;
- FFPsyWindowInfo wi;
+ FFPsyWindowInfo wi = { { 0 } };
- memset(&wi, 0, sizeof(wi));
if (la) {
float hpfsmpl[AAC_BLOCK_SIZE_LONG];
float const *pf = hpfsmpl;
float attack_intensity[(AAC_NUM_BLOCKS_SHORT + 1) * PSY_LAME_NUM_SUBBLOCKS];
float energy_subshort[(AAC_NUM_BLOCKS_SHORT + 1) * PSY_LAME_NUM_SUBBLOCKS];
float energy_short[AAC_NUM_BLOCKS_SHORT + 1] = { 0 };
- int chans = ctx->avctx->channels;
- const int16_t *firbuf = la + (AAC_BLOCK_SIZE_SHORT/4 - PSY_LAME_FIR_LEN) * chans;
+ const float *firbuf = la + (AAC_BLOCK_SIZE_SHORT/4 - PSY_LAME_FIR_LEN);
int j, att_sum = 0;
/* LAME comment: apply high pass filter of fs/4 */
for (i = 0; i < AAC_BLOCK_SIZE_LONG; i++) {
float sum1, sum2;
- sum1 = firbuf[(i + ((PSY_LAME_FIR_LEN - 1) / 2)) * chans];
+ sum1 = firbuf[i + (PSY_LAME_FIR_LEN - 1) / 2];
sum2 = 0.0;
for (j = 0; j < ((PSY_LAME_FIR_LEN - 1) / 2) - 1; j += 2) {
- sum1 += psy_fir_coeffs[j] * (firbuf[(i + j) * chans] + firbuf[(i + PSY_LAME_FIR_LEN - j) * chans]);
- sum2 += psy_fir_coeffs[j + 1] * (firbuf[(i + j + 1) * chans] + firbuf[(i + PSY_LAME_FIR_LEN - j - 1) * chans]);
+ sum1 += psy_fir_coeffs[j] * (firbuf[i + j] + firbuf[i + PSY_LAME_FIR_LEN - j]);
+ sum2 += psy_fir_coeffs[j + 1] * (firbuf[i + j + 1] + firbuf[i + PSY_LAME_FIR_LEN - j - 1]);
}
- hpfsmpl[i] = sum1 + sum2;
+ /* NOTE: The LAME psymodel expects it's input in the range -32768 to 32768. Tuning this for normalized floats would be difficult. */
+ hpfsmpl[i] = (sum1 + sum2) * 32768.0f;
}
/* Calculate the energies of each sub-shortblock */
@@ -823,16 +820,15 @@ static FFPsyWindowInfo psy_lame_window(FFPsyContext *ctx,
float const *const pfe = pf + AAC_BLOCK_SIZE_LONG / (AAC_NUM_BLOCKS_SHORT * PSY_LAME_NUM_SUBBLOCKS);
float p = 1.0f;
for (; pf < pfe; pf++)
- if (p < fabsf(*pf))
- p = fabsf(*pf);
+ p = FFMAX(p, fabsf(*pf));
pch->prev_energy_subshort[i] = energy_subshort[i + PSY_LAME_NUM_SUBBLOCKS] = p;
energy_short[1 + i / PSY_LAME_NUM_SUBBLOCKS] += p;
- /* FIXME: The indexes below are [i + 3 - 2] in the LAME source.
- * Obviously the 3 and 2 have some significance, or this would be just [i + 1]
- * (which is what we use here). What the 3 stands for is ambigious, as it is both
- * number of short blocks, and the number of sub-short blocks.
- * It seems that LAME is comparing each sub-block to sub-block + 1 in the
- * previous block.
+ /* NOTE: The indexes below are [i + 3 - 2] in the LAME source.
+ * Obviously the 3 and 2 have some significance, or this would be just [i + 1]
+ * (which is what we use here). What the 3 stands for is ambiguous, as it is both
+ * number of short blocks, and the number of sub-short blocks.
+ * It seems that LAME is comparing each sub-block to sub-block + 1 in the
+ * previous block.
*/
if (p > energy_subshort[i + 1])
p = p / energy_subshort[i + 1];
diff --git a/gst-libs/ext/libav/libavcodec/aacsbr.c b/gst-libs/ext/libav/libavcodec/aacsbr.c
index 0bfcabb..add9f18 100644
--- a/gst-libs/ext/libav/libavcodec/aacsbr.c
+++ b/gst-libs/ext/libav/libavcodec/aacsbr.c
@@ -32,6 +32,7 @@
#include "aacsbrdata.h"
#include "fft.h"
#include "aacps.h"
+#include "sbrdsp.h"
#include "libavutil/libm.h"
#include <stdint.h>
@@ -73,7 +74,6 @@ enum {
static VLC vlc_sbr[10];
static const int8_t vlc_sbr_lav[10] =
{ 60, 60, 24, 24, 31, 31, 12, 12, 31, 12 };
-static const DECLARE_ALIGNED(16, float, zero64)[64];
#define SBR_INIT_VLC_STATIC(num, size) \
INIT_VLC_STATIC(&vlc_sbr[num], 9, sbr_tmp[num].table_size / sbr_tmp[num].elem_size, \
@@ -126,20 +126,30 @@ av_cold void ff_aac_sbr_init(void)
ff_ps_init();
}
+/** Places SBR in pure upsampling mode. */
+static void sbr_turnoff(SpectralBandReplication *sbr) {
+ sbr->start = 0;
+ // Init defults used in pure upsampling mode
+ sbr->kx[1] = 32; //Typo in spec, kx' inits to 32
+ sbr->m[1] = 0;
+ // Reset values for first SBR header
+ sbr->data[0].e_a[1] = sbr->data[1].e_a[1] = -1;
+ memset(&sbr->spectrum_params, -1, sizeof(SpectrumParameters));
+}
+
av_cold void ff_aac_sbr_ctx_init(AACContext *ac, SpectralBandReplication *sbr)
{
- float mdct_scale;
- sbr->kx[0] = sbr->kx[1] = 32; //Typo in spec, kx' inits to 32
- sbr->data[0].e_a[1] = sbr->data[1].e_a[1] = -1;
+ sbr->kx[0] = sbr->kx[1];
+ sbr_turnoff(sbr);
sbr->data[0].synthesis_filterbank_samples_offset = SBR_SYNTHESIS_BUF_SIZE - (1280 - 128);
sbr->data[1].synthesis_filterbank_samples_offset = SBR_SYNTHESIS_BUF_SIZE - (1280 - 128);
/* SBR requires samples to be scaled to +/-32768.0 to work correctly.
* mdct scale factors are adjusted to scale up from +/-1.0 at analysis
* and scale back down at synthesis. */
- mdct_scale = ac->avctx->sample_fmt == AV_SAMPLE_FMT_FLT ? 32768.0f : 1.0f;
- ff_mdct_init(&sbr->mdct, 7, 1, 1.0 / (64 * mdct_scale));
- ff_mdct_init(&sbr->mdct_ana, 7, 1, -2.0 * mdct_scale);
+ ff_mdct_init(&sbr->mdct, 7, 1, 1.0 / (64 * 32768.0));
+ ff_mdct_init(&sbr->mdct_ana, 7, 1, -2.0 * 32768.0);
ff_ps_ctx_init(&sbr->ps);
+ ff_sbrdsp_init(&sbr->dsp);
}
av_cold void ff_aac_sbr_ctx_close(SpectralBandReplication *sbr)
@@ -901,7 +911,7 @@ static void read_sbr_extension(AACContext *ac, SpectralBandReplication *sbr,
{
switch (bs_extension_id) {
case EXTENSION_ID_PS:
- if (!ac->m4ac.ps) {
+ if (!ac->oc[1].m4ac.ps) {
av_log(ac->avctx, AV_LOG_ERROR, "Parametric Stereo signaled to be not-present but was found in the bitstream.\n");
skip_bits_long(gb, *num_bits_left); // bs_fill_bits
*num_bits_left = 0;
@@ -909,14 +919,14 @@ static void read_sbr_extension(AACContext *ac, SpectralBandReplication *sbr,
#if 1
*num_bits_left -= ff_ps_read_data(ac->avctx, gb, &sbr->ps, *num_bits_left);
#else
- av_log_missing_feature(ac->avctx, "Parametric Stereo is", 0);
+ av_log_missing_feature(ac->avctx, "Parametric Stereo", 0);
skip_bits_long(gb, *num_bits_left); // bs_fill_bits
*num_bits_left = 0;
#endif
}
break;
default:
- av_log_missing_feature(ac->avctx, "Reserved SBR extensions are", 1);
+ av_log_missing_feature(ac->avctx, "Reserved SBR extensions", 1);
skip_bits_long(gb, *num_bits_left); // bs_fill_bits
*num_bits_left = 0;
break;
@@ -992,18 +1002,18 @@ static unsigned int read_sbr_data(AACContext *ac, SpectralBandReplication *sbr,
if (id_aac == TYPE_SCE || id_aac == TYPE_CCE) {
if (read_sbr_single_channel_element(ac, sbr, gb)) {
- sbr->start = 0;
+ sbr_turnoff(sbr);
return get_bits_count(gb) - cnt;
}
} else if (id_aac == TYPE_CPE) {
if (read_sbr_channel_pair_element(ac, sbr, gb)) {
- sbr->start = 0;
+ sbr_turnoff(sbr);
return get_bits_count(gb) - cnt;
}
} else {
av_log(ac->avctx, AV_LOG_ERROR,
"Invalid bitstream - cannot apply SBR to element type %d\n", id_aac);
- sbr->start = 0;
+ sbr_turnoff(sbr);
return get_bits_count(gb) - cnt;
}
if (get_bits1(gb)) { // bs_extended_data
@@ -1035,7 +1045,7 @@ static void sbr_reset(AACContext *ac, SpectralBandReplication *sbr)
if (err < 0) {
av_log(ac->avctx, AV_LOG_ERROR,
"SBR reset failed. Switching SBR to pure upsampling mode.\n");
- sbr->start = 0;
+ sbr_turnoff(sbr);
}
}
@@ -1058,9 +1068,9 @@ int ff_decode_sbr_extension(AACContext *ac, SpectralBandReplication *sbr,
sbr->reset = 0;
if (!sbr->sample_rate)
- sbr->sample_rate = 2 * ac->m4ac.sample_rate; //TODO use the nominal sample rate for arbitrary sample rate support
- if (!ac->m4ac.ext_sample_rate)
- ac->m4ac.ext_sample_rate = 2 * ac->m4ac.sample_rate;
+ sbr->sample_rate = 2 * ac->oc[1].m4ac.sample_rate; //TODO use the nominal sample rate for arbitrary sample rate support
+ if (!ac->oc[1].m4ac.ext_sample_rate)
+ ac->oc[1].m4ac.ext_sample_rate = 2 * ac->oc[1].m4ac.sample_rate;
if (crc) {
skip_bits(gb, 10); // bs_sbr_crc_bits; TODO - implement CRC check
@@ -1070,6 +1080,7 @@ int ff_decode_sbr_extension(AACContext *ac, SpectralBandReplication *sbr,
//Save some state from the previous frame.
sbr->kx[0] = sbr->kx[1];
sbr->m[0] = sbr->m[1];
+ sbr->kx_and_m_pushed = 1;
num_sbr_bits++;
if (get_bits1(gb)) // bs_header_flag
@@ -1139,33 +1150,20 @@ static void sbr_dequant(SpectralBandReplication *sbr, int id_aac)
* @param x pointer to the beginning of the first sample window
* @param W array of complex-valued samples split into subbands
*/
-static void sbr_qmf_analysis(DSPContext *dsp, FFTContext *mdct, const float *in, float *x,
- float z[320], float W[2][32][32][2])
+static void sbr_qmf_analysis(DSPContext *dsp, FFTContext *mdct,
+ SBRDSPContext *sbrdsp, const float *in, float *x,
+ float z[320], float W[2][32][32][2], int buf_idx)
{
- int i, k;
- memcpy(W[0], W[1], sizeof(W[0]));
+ int i;
memcpy(x , x+1024, (320-32)*sizeof(x[0]));
memcpy(x+288, in, 1024*sizeof(x[0]));
for (i = 0; i < 32; i++) { // numTimeSlots*RATE = 16*2 as 960 sample frames
// are not supported
dsp->vector_fmul_reverse(z, sbr_qmf_window_ds, x, 320);
- for (k = 0; k < 64; k++) {
- float f = z[k] + z[k + 64] + z[k + 128] + z[k + 192] + z[k + 256];
- z[k] = f;
- }
- //Shuffle to IMDCT
- z[64] = z[0];
- for (k = 1; k < 32; k++) {
- z[64+2*k-1] = z[ k];
- z[64+2*k ] = -z[64-k];
- }
- z[64+63] = z[32];
-
+ sbrdsp->sum64x5(z);
+ sbrdsp->qmf_pre_shuffle(z);
mdct->imdct_half(mdct, z, z+64);
- for (k = 0; k < 32; k++) {
- W[1][i][k][0] = -z[63-k];
- W[1][i][k][1] = z[k];
- }
+ sbrdsp->qmf_post_shuffle(W[buf_idx][i], z);
x += 32;
}
}
@@ -1175,6 +1173,7 @@ static void sbr_qmf_analysis(DSPContext *dsp, FFTContext *mdct, const float *in,
* (14496-3 sp04 p206)
*/
static void sbr_qmf_synthesis(DSPContext *dsp, FFTContext *mdct,
+ SBRDSPContext *sbrdsp, AVFloatDSPContext *fdsp,
float *out, float X[2][38][64],
float mdct_buf[2][64],
float *v0, int *v_off, const unsigned int div)
@@ -1198,22 +1197,14 @@ static void sbr_qmf_synthesis(DSPContext *dsp, FFTContext *mdct,
X[0][i][32+n] = X[1][i][31-n];
}
mdct->imdct_half(mdct, mdct_buf[0], X[0][i]);
- for (n = 0; n < 32; n++) {
- v[ n] = mdct_buf[0][63 - 2*n];
- v[63 - n] = -mdct_buf[0][62 - 2*n];
- }
+ sbrdsp->qmf_deint_neg(v, mdct_buf[0]);
} else {
- for (n = 1; n < 64; n+=2) {
- X[1][i][n] = -X[1][i][n];
- }
+ sbrdsp->neg_odd_64(X[1][i]);
mdct->imdct_half(mdct, mdct_buf[0], X[0][i]);
mdct->imdct_half(mdct, mdct_buf[1], X[1][i]);
- for (n = 0; n < 64; n++) {
- v[ n] = -mdct_buf[0][63 - n] + mdct_buf[1][ n ];
- v[127 - n] = mdct_buf[0][63 - n] + mdct_buf[1][ n ];
- }
+ sbrdsp->qmf_deint_bfly(v, mdct_buf[1], mdct_buf[0]);
}
- dsp->vector_fmul_add(out, v , sbr_qmf_window , zero64, 64 >> div);
+ fdsp->vector_fmul (out, v , sbr_qmf_window , 64 >> div);
dsp->vector_fmul_add(out, v + ( 192 >> div), sbr_qmf_window + ( 64 >> div), out , 64 >> div);
dsp->vector_fmul_add(out, v + ( 256 >> div), sbr_qmf_window + (128 >> div), out , 64 >> div);
dsp->vector_fmul_add(out, v + ( 448 >> div), sbr_qmf_window + (192 >> div), out , 64 >> div);
@@ -1227,45 +1218,20 @@ static void sbr_qmf_synthesis(DSPContext *dsp, FFTContext *mdct,
}
}
-static void autocorrelate(const float x[40][2], float phi[3][2][2], int lag)
-{
- int i;
- float real_sum = 0.0f;
- float imag_sum = 0.0f;
- if (lag) {
- for (i = 1; i < 38; i++) {
- real_sum += x[i][0] * x[i+lag][0] + x[i][1] * x[i+lag][1];
- imag_sum += x[i][0] * x[i+lag][1] - x[i][1] * x[i+lag][0];
- }
- phi[2-lag][1][0] = real_sum + x[ 0][0] * x[lag][0] + x[ 0][1] * x[lag][1];
- phi[2-lag][1][1] = imag_sum + x[ 0][0] * x[lag][1] - x[ 0][1] * x[lag][0];
- if (lag == 1) {
- phi[0][0][0] = real_sum + x[38][0] * x[39][0] + x[38][1] * x[39][1];
- phi[0][0][1] = imag_sum + x[38][0] * x[39][1] - x[38][1] * x[39][0];
- }
- } else {
- for (i = 1; i < 38; i++) {
- real_sum += x[i][0] * x[i][0] + x[i][1] * x[i][1];
- }
- phi[2][1][0] = real_sum + x[ 0][0] * x[ 0][0] + x[ 0][1] * x[ 0][1];
- phi[1][0][0] = real_sum + x[38][0] * x[38][0] + x[38][1] * x[38][1];
- }
-}
-
/** High Frequency Generation (14496-3 sp04 p214+) and Inverse Filtering
* (14496-3 sp04 p214)
* Warning: This routine does not seem numerically stable.
*/
-static void sbr_hf_inverse_filter(float (*alpha0)[2], float (*alpha1)[2],
+static void sbr_hf_inverse_filter(SBRDSPContext *dsp,
+ float (*alpha0)[2], float (*alpha1)[2],
const float X_low[32][40][2], int k0)
{
int k;
for (k = 0; k < k0; k++) {
- float phi[3][2][2], dk;
+ LOCAL_ALIGNED_16(float, phi, [3], [2][2]);
+ float dk;
- autocorrelate(X_low[k], phi, 0);
- autocorrelate(X_low[k], phi, 1);
- autocorrelate(X_low[k], phi, 2);
+ dsp->autocorrelate(X_low[k], phi);
dk = phi[2][1][0] * phi[1][0][0] -
(phi[1][1][0] * phi[1][1][0] + phi[1][1][1] * phi[1][1][1]) / 1.000001f;
@@ -1333,7 +1299,8 @@ static void sbr_chirp(SpectralBandReplication *sbr, SBRData *ch_data)
/// Generate the subband filtered lowband
static int sbr_lf_gen(AACContext *ac, SpectralBandReplication *sbr,
- float X_low[32][40][2], const float W[2][32][32][2])
+ float X_low[32][40][2], const float W[2][32][32][2],
+ int buf_idx)
{
int i, k;
const int t_HFGen = 8;
@@ -1341,14 +1308,15 @@ static int sbr_lf_gen(AACContext *ac, SpectralBandReplication *sbr,
memset(X_low, 0, 32*sizeof(*X_low));
for (k = 0; k < sbr->kx[1]; k++) {
for (i = t_HFGen; i < i_f + t_HFGen; i++) {
- X_low[k][i][0] = W[1][i - t_HFGen][k][0];
- X_low[k][i][1] = W[1][i - t_HFGen][k][1];
+ X_low[k][i][0] = W[buf_idx][i - t_HFGen][k][0];
+ X_low[k][i][1] = W[buf_idx][i - t_HFGen][k][1];
}
}
+ buf_idx = 1-buf_idx;
for (k = 0; k < sbr->kx[0]; k++) {
for (i = 0; i < t_HFGen; i++) {
- X_low[k][i][0] = W[0][i + i_f - t_HFGen][k][0];
- X_low[k][i][1] = W[0][i + i_f - t_HFGen][k][1];
+ X_low[k][i][0] = W[buf_idx][i + i_f - t_HFGen][k][0];
+ X_low[k][i][1] = W[buf_idx][i + i_f - t_HFGen][k][1];
}
}
return 0;
@@ -1361,12 +1329,11 @@ static int sbr_hf_gen(AACContext *ac, SpectralBandReplication *sbr,
const float bw_array[5], const uint8_t *t_env,
int bs_num_env)
{
- int i, j, x;
+ int j, x;
int g = 0;
int k = sbr->kx[1];
for (j = 0; j < sbr->num_patches; j++) {
for (x = 0; x < sbr->patch_num_subbands[j]; x++, k++) {
- float alpha[4];
const int p = sbr->patch_start_subband[j] + x;
while (g <= sbr->n_q && k >= sbr->f_tablenoise[g])
g++;
@@ -1378,26 +1345,10 @@ static int sbr_hf_gen(AACContext *ac, SpectralBandReplication *sbr,
return -1;
}
- alpha[0] = alpha1[p][0] * bw_array[g] * bw_array[g];
- alpha[1] = alpha1[p][1] * bw_array[g] * bw_array[g];
- alpha[2] = alpha0[p][0] * bw_array[g];
- alpha[3] = alpha0[p][1] * bw_array[g];
-
- for (i = 2 * t_env[0]; i < 2 * t_env[bs_num_env]; i++) {
- const int idx = i + ENVELOPE_ADJUSTMENT_OFFSET;
- X_high[k][idx][0] =
- X_low[p][idx - 2][0] * alpha[0] -
- X_low[p][idx - 2][1] * alpha[1] +
- X_low[p][idx - 1][0] * alpha[2] -
- X_low[p][idx - 1][1] * alpha[3] +
- X_low[p][idx][0];
- X_high[k][idx][1] =
- X_low[p][idx - 2][1] * alpha[0] +
- X_low[p][idx - 2][0] * alpha[1] +
- X_low[p][idx - 1][1] * alpha[2] +
- X_low[p][idx - 1][0] * alpha[3] +
- X_low[p][idx][1];
- }
+ sbr->dsp.hf_gen(X_high[k] + ENVELOPE_ADJUSTMENT_OFFSET,
+ X_low[p] + ENVELOPE_ADJUSTMENT_OFFSET,
+ alpha0[p], alpha1[p], bw_array[g],
+ 2 * t_env[0], 2 * t_env[bs_num_env]);
}
}
if (k < sbr->m[1] + sbr->kx[1])
@@ -1408,8 +1359,8 @@ static int sbr_hf_gen(AACContext *ac, SpectralBandReplication *sbr,
/// Generate the subband filtered lowband
static int sbr_x_gen(SpectralBandReplication *sbr, float X[2][38][64],
- const float X_low[32][40][2], const float Y[2][38][64][2],
- int ch)
+ const float Y0[38][64][2], const float Y1[38][64][2],
+ const float X_low[32][40][2], int ch)
{
int k, i;
const int i_f = 32;
@@ -1423,8 +1374,8 @@ static int sbr_x_gen(SpectralBandReplication *sbr, float X[2][38][64],
}
for (; k < sbr->kx[0] + sbr->m[0]; k++) {
for (i = 0; i < i_Temp; i++) {
- X[0][i][k] = Y[0][i + i_f][k][0];
- X[1][i][k] = Y[0][i + i_f][k][1];
+ X[0][i][k] = Y0[i + i_f][k][0];
+ X[1][i][k] = Y0[i + i_f][k][1];
}
}
@@ -1436,8 +1387,8 @@ static int sbr_x_gen(SpectralBandReplication *sbr, float X[2][38][64],
}
for (; k < sbr->kx[1] + sbr->m[1]; k++) {
for (i = i_Temp; i < i_f; i++) {
- X[0][i][k] = Y[1][i][k][0];
- X[1][i][k] = Y[1][i][k][1];
+ X[0][i][k] = Y1[i][k][0];
+ X[1][i][k] = Y1[i][k][1];
}
}
return 0;
@@ -1446,7 +1397,7 @@ static int sbr_x_gen(SpectralBandReplication *sbr, float X[2][38][64],
/** High Frequency Adjustment (14496-3 sp04 p217) and Mapping
* (14496-3 sp04 p217)
*/
-static void sbr_mapping(AACContext *ac, SpectralBandReplication *sbr,
+static int sbr_mapping(AACContext *ac, SpectralBandReplication *sbr,
SBRData *ch_data, int e_a[2])
{
int e, i, m;
@@ -1457,6 +1408,12 @@ static void sbr_mapping(AACContext *ac, SpectralBandReplication *sbr,
uint16_t *table = ch_data->bs_freq_res[e + 1] ? sbr->f_tablehigh : sbr->f_tablelow;
int k;
+ if (sbr->kx[1] != table[0]) {
+ av_log(ac->avctx, AV_LOG_ERROR, "kx != f_table{high,low}[0]. "
+ "Derived frequency tables were not regenerated.\n");
+ sbr_turnoff(sbr);
+ return AVERROR_BUG;
+ }
for (i = 0; i < ilim; i++)
for (m = table[i]; m < table[i + 1]; m++)
sbr->e_origmapped[e][m - sbr->kx[1]] = ch_data->env_facs[e+1][i];
@@ -1491,13 +1448,15 @@ static void sbr_mapping(AACContext *ac, SpectralBandReplication *sbr,
}
memcpy(ch_data->s_indexmapped[0], ch_data->s_indexmapped[ch_data->bs_num_env], sizeof(ch_data->s_indexmapped[0]));
+ return 0;
}
/// Estimation of current envelope (14496-3 sp04 p218)
static void sbr_env_estimate(float (*e_curr)[48], float X_high[64][40][2],
SpectralBandReplication *sbr, SBRData *ch_data)
{
- int e, i, m;
+ int e, m;
+ int kx1 = sbr->kx[1];
if (sbr->bs_interpol_freq) {
for (e = 0; e < ch_data->bs_num_env; e++) {
@@ -1506,12 +1465,7 @@ static void sbr_env_estimate(float (*e_curr)[48], float X_high[64][40][2],
int iub = ch_data->t_env[e + 1] * 2 + ENVELOPE_ADJUSTMENT_OFFSET;
for (m = 0; m < sbr->m[1]; m++) {
- float sum = 0.0f;
-
- for (i = ilb; i < iub; i++) {
- sum += X_high[m + sbr->kx[1]][i][0] * X_high[m + sbr->kx[1]][i][0] +
- X_high[m + sbr->kx[1]][i][1] * X_high[m + sbr->kx[1]][i][1];
- }
+ float sum = sbr->dsp.sum_square(X_high[m+kx1] + ilb, iub - ilb);
e_curr[e][m] = sum * recip_env_size;
}
}
@@ -1529,14 +1483,11 @@ static void sbr_env_estimate(float (*e_curr)[48], float X_high[64][40][2],
const int den = env_size * (table[p + 1] - table[p]);
for (k = table[p]; k < table[p + 1]; k++) {
- for (i = ilb; i < iub; i++) {
- sum += X_high[k][i][0] * X_high[k][i][0] +
- X_high[k][i][1] * X_high[k][i][1];
- }
+ sum += sbr->dsp.sum_square(X_high[k] + ilb, iub - ilb);
}
sum /= den;
for (k = table[p]; k < table[p + 1]; k++) {
- e_curr[e][k - sbr->kx[1]] = sum;
+ e_curr[e][k - kx1] = sum;
}
}
}
@@ -1603,7 +1554,8 @@ static void sbr_gain_calc(AACContext *ac, SpectralBandReplication *sbr,
}
/// Assembling HF Signals (14496-3 sp04 p220)
-static void sbr_hf_assemble(float Y[2][38][64][2], const float X_high[64][40][2],
+static void sbr_hf_assemble(float Y1[38][64][2],
+ const float X_high[64][40][2],
SpectralBandReplication *sbr, SBRData *ch_data,
const int e_a[2])
{
@@ -1625,7 +1577,6 @@ static void sbr_hf_assemble(float Y[2][38][64][2], const float X_high[64][40][2]
float (*g_temp)[48] = ch_data->g_temp, (*q_temp)[48] = ch_data->q_temp;
int indexnoise = ch_data->f_indexnoise;
int indexsine = ch_data->f_indexsine;
- memcpy(Y[0], Y[1], sizeof(Y[0]));
if (sbr->reset) {
for (i = 0; i < h_SL; i++) {
@@ -1647,63 +1598,44 @@ static void sbr_hf_assemble(float Y[2][38][64][2], const float X_high[64][40][2]
for (e = 0; e < ch_data->bs_num_env; e++) {
for (i = 2 * ch_data->t_env[e]; i < 2 * ch_data->t_env[e + 1]; i++) {
int phi_sign = (1 - 2*(kx & 1));
+ LOCAL_ALIGNED_16(float, g_filt_tab, [48]);
+ LOCAL_ALIGNED_16(float, q_filt_tab, [48]);
+ float *g_filt, *q_filt;
if (h_SL && e != e_a[0] && e != e_a[1]) {
+ g_filt = g_filt_tab;
+ q_filt = q_filt_tab;
for (m = 0; m < m_max; m++) {
const int idx1 = i + h_SL;
- float g_filt = 0.0f;
- for (j = 0; j <= h_SL; j++)
- g_filt += g_temp[idx1 - j][m] * h_smooth[j];
- Y[1][i][m + kx][0] =
- X_high[m + kx][i + ENVELOPE_ADJUSTMENT_OFFSET][0] * g_filt;
- Y[1][i][m + kx][1] =
- X_high[m + kx][i + ENVELOPE_ADJUSTMENT_OFFSET][1] * g_filt;
+ g_filt[m] = 0.0f;
+ q_filt[m] = 0.0f;
+ for (j = 0; j <= h_SL; j++) {
+ g_filt[m] += g_temp[idx1 - j][m] * h_smooth[j];
+ q_filt[m] += q_temp[idx1 - j][m] * h_smooth[j];
+ }
}
} else {
- for (m = 0; m < m_max; m++) {
- const float g_filt = g_temp[i + h_SL][m];
- Y[1][i][m + kx][0] =
- X_high[m + kx][i + ENVELOPE_ADJUSTMENT_OFFSET][0] * g_filt;
- Y[1][i][m + kx][1] =
- X_high[m + kx][i + ENVELOPE_ADJUSTMENT_OFFSET][1] * g_filt;
- }
+ g_filt = g_temp[i + h_SL];
+ q_filt = q_temp[i];
}
+ sbr->dsp.hf_g_filt(Y1[i] + kx, X_high + kx, g_filt, m_max,
+ i + ENVELOPE_ADJUSTMENT_OFFSET);
+
if (e != e_a[0] && e != e_a[1]) {
- for (m = 0; m < m_max; m++) {
- indexnoise = (indexnoise + 1) & 0x1ff;
- if (sbr->s_m[e][m]) {
- Y[1][i][m + kx][0] +=
- sbr->s_m[e][m] * phi[0][indexsine];
- Y[1][i][m + kx][1] +=
- sbr->s_m[e][m] * (phi[1][indexsine] * phi_sign);
- } else {
- float q_filt;
- if (h_SL) {
- const int idx1 = i + h_SL;
- q_filt = 0.0f;
- for (j = 0; j <= h_SL; j++)
- q_filt += q_temp[idx1 - j][m] * h_smooth[j];
- } else {
- q_filt = q_temp[i][m];
- }
- Y[1][i][m + kx][0] +=
- q_filt * sbr_noise_table[indexnoise][0];
- Y[1][i][m + kx][1] +=
- q_filt * sbr_noise_table[indexnoise][1];
- }
- phi_sign = -phi_sign;
- }
+ sbr->dsp.hf_apply_noise[indexsine](Y1[i] + kx, sbr->s_m[e],
+ q_filt, indexnoise,
+ kx, m_max);
} else {
- indexnoise = (indexnoise + m_max) & 0x1ff;
for (m = 0; m < m_max; m++) {
- Y[1][i][m + kx][0] +=
+ Y1[i][m + kx][0] +=
sbr->s_m[e][m] * phi[0][indexsine];
- Y[1][i][m + kx][1] +=
+ Y1[i][m + kx][1] +=
sbr->s_m[e][m] * (phi[1][indexsine] * phi_sign);
phi_sign = -phi_sign;
}
}
+ indexnoise = (indexnoise + m_max) & 0x1ff;
indexsine = (indexsine + 1) & 3;
}
}
@@ -1714,39 +1646,54 @@ static void sbr_hf_assemble(float Y[2][38][64][2], const float X_high[64][40][2]
void ff_sbr_apply(AACContext *ac, SpectralBandReplication *sbr, int id_aac,
float* L, float* R)
{
- int downsampled = ac->m4ac.ext_sample_rate < sbr->sample_rate;
+ int downsampled = ac->oc[1].m4ac.ext_sample_rate < sbr->sample_rate;
int ch;
int nch = (id_aac == TYPE_CPE) ? 2 : 1;
+ int err;
+
+ if (!sbr->kx_and_m_pushed) {
+ sbr->kx[0] = sbr->kx[1];
+ sbr->m[0] = sbr->m[1];
+ } else {
+ sbr->kx_and_m_pushed = 0;
+ }
if (sbr->start) {
sbr_dequant(sbr, id_aac);
}
for (ch = 0; ch < nch; ch++) {
/* decode channel */
- sbr_qmf_analysis(&ac->dsp, &sbr->mdct_ana, ch ? R : L, sbr->data[ch].analysis_filterbank_samples,
+ sbr_qmf_analysis(&ac->dsp, &sbr->mdct_ana, &sbr->dsp, ch ? R : L, sbr->data[ch].analysis_filterbank_samples,
(float*)sbr->qmf_filter_scratch,
- sbr->data[ch].W);
- sbr_lf_gen(ac, sbr, sbr->X_low, sbr->data[ch].W);
+ sbr->data[ch].W, sbr->data[ch].Ypos);
+ sbr_lf_gen(ac, sbr, sbr->X_low, sbr->data[ch].W, sbr->data[ch].Ypos);
+ sbr->data[ch].Ypos ^= 1;
if (sbr->start) {
- sbr_hf_inverse_filter(sbr->alpha0, sbr->alpha1, sbr->X_low, sbr->k[0]);
+ sbr_hf_inverse_filter(&sbr->dsp, sbr->alpha0, sbr->alpha1, sbr->X_low, sbr->k[0]);
sbr_chirp(sbr, &sbr->data[ch]);
sbr_hf_gen(ac, sbr, sbr->X_high, sbr->X_low, sbr->alpha0, sbr->alpha1,
sbr->data[ch].bw_array, sbr->data[ch].t_env,
sbr->data[ch].bs_num_env);
// hf_adj
- sbr_mapping(ac, sbr, &sbr->data[ch], sbr->data[ch].e_a);
- sbr_env_estimate(sbr->e_curr, sbr->X_high, sbr, &sbr->data[ch]);
- sbr_gain_calc(ac, sbr, &sbr->data[ch], sbr->data[ch].e_a);
- sbr_hf_assemble(sbr->data[ch].Y, sbr->X_high, sbr, &sbr->data[ch],
- sbr->data[ch].e_a);
+ err = sbr_mapping(ac, sbr, &sbr->data[ch], sbr->data[ch].e_a);
+ if (!err) {
+ sbr_env_estimate(sbr->e_curr, sbr->X_high, sbr, &sbr->data[ch]);
+ sbr_gain_calc(ac, sbr, &sbr->data[ch], sbr->data[ch].e_a);
+ sbr_hf_assemble(sbr->data[ch].Y[sbr->data[ch].Ypos],
+ sbr->X_high, sbr, &sbr->data[ch],
+ sbr->data[ch].e_a);
+ }
}
/* synthesis */
- sbr_x_gen(sbr, sbr->X[ch], sbr->X_low, sbr->data[ch].Y, ch);
+ sbr_x_gen(sbr, sbr->X[ch],
+ sbr->data[ch].Y[1-sbr->data[ch].Ypos],
+ sbr->data[ch].Y[ sbr->data[ch].Ypos],
+ sbr->X_low, ch);
}
- if (ac->m4ac.ps == 1) {
+ if (ac->oc[1].m4ac.ps == 1) {
if (sbr->ps.start) {
ff_ps_apply(ac->avctx, &sbr->ps, sbr->X[0], sbr->X[1], sbr->kx[1] + sbr->m[1]);
} else {
@@ -1755,12 +1702,14 @@ void ff_sbr_apply(AACContext *ac, SpectralBandReplication *sbr, int id_aac,
nch = 2;
}
- sbr_qmf_synthesis(&ac->dsp, &sbr->mdct, L, sbr->X[0], sbr->qmf_filter_scratch,
+ sbr_qmf_synthesis(&ac->dsp, &sbr->mdct, &sbr->dsp, &ac->fdsp,
+ L, sbr->X[0], sbr->qmf_filter_scratch,
sbr->data[0].synthesis_filterbank_samples,
&sbr->data[0].synthesis_filterbank_samples_offset,
downsampled);
if (nch == 2)
- sbr_qmf_synthesis(&ac->dsp, &sbr->mdct, R, sbr->X[1], sbr->qmf_filter_scratch,
+ sbr_qmf_synthesis(&ac->dsp, &sbr->mdct, &sbr->dsp, &ac->fdsp,
+ R, sbr->X[1], sbr->qmf_filter_scratch,
sbr->data[1].synthesis_filterbank_samples,
&sbr->data[1].synthesis_filterbank_samples_offset,
downsampled);
diff --git a/gst-libs/ext/libav/libavcodec/aacsbrdata.h b/gst-libs/ext/libav/libavcodec/aacsbrdata.h
index 44d578f..f309059 100644
--- a/gst-libs/ext/libav/libavcodec/aacsbrdata.h
+++ b/gst-libs/ext/libav/libavcodec/aacsbrdata.h
@@ -267,8 +267,8 @@ static const int8_t sbr_offset[6][16] = {
};
///< window coefficients for analysis/synthesis QMF banks
-static DECLARE_ALIGNED(16, float, sbr_qmf_window_ds)[320];
-static DECLARE_ALIGNED(16, float, sbr_qmf_window_us)[640] = {
+static DECLARE_ALIGNED(32, float, sbr_qmf_window_ds)[320];
+static DECLARE_ALIGNED(32, float, sbr_qmf_window_us)[640] = {
0.0000000000, -0.0005525286, -0.0005617692, -0.0004947518,
-0.0004875227, -0.0004893791, -0.0005040714, -0.0005226564,
-0.0005466565, -0.0005677802, -0.0005870930, -0.0006132747,
@@ -352,7 +352,8 @@ static DECLARE_ALIGNED(16, float, sbr_qmf_window_us)[640] = {
0.8537385600,
};
-static const float sbr_noise_table[512][2] = {
+/* First two entries repeated at end to simplify SIMD implementations. */
+const DECLARE_ALIGNED(16, float, ff_sbr_noise_table)[][2] = {
{-0.99948153278296, -0.59483417516607}, { 0.97113454393991, -0.67528515225647},
{ 0.14130051758487, -0.95090983575689}, {-0.47005496701697, -0.37340549728647},
{ 0.80705063769351, 0.29653668284408}, {-0.38981478896926, 0.89572605717087},
@@ -609,6 +610,7 @@ static const float sbr_noise_table[512][2] = {
{-0.93412041758744, 0.41374052024363}, { 0.96063943315511, 0.93116709541280},
{ 0.97534253457837, 0.86150930812689}, { 0.99642466504163, 0.70190043427512},
{-0.94705089665984, -0.29580042814306}, { 0.91599807087376, -0.98147830385781},
+{-0.99948153278296, -0.59483417516607}, { 0.97113454393991, -0.67528515225647},
};
#endif /* AVCODEC_AACSBRDATA_H */
diff --git a/gst-libs/ext/libav/libavcodec/aactab.c b/gst-libs/ext/libav/libavcodec/aactab.c
index 46886b1..9176e37 100644
--- a/gst-libs/ext/libav/libavcodec/aactab.c
+++ b/gst-libs/ext/libav/libavcodec/aactab.c
@@ -33,8 +33,8 @@
#include <stdint.h>
-DECLARE_ALIGNED(16, float, ff_aac_kbd_long_1024)[1024];
-DECLARE_ALIGNED(16, float, ff_aac_kbd_short_128)[128];
+DECLARE_ALIGNED(32, float, ff_aac_kbd_long_1024)[1024];
+DECLARE_ALIGNED(32, float, ff_aac_kbd_short_128)[128];
const uint8_t ff_aac_num_swb_1024[] = {
41, 41, 47, 49, 49, 51, 47, 47, 43, 43, 43, 40, 40
diff --git a/gst-libs/ext/libav/libavcodec/aactab.h b/gst-libs/ext/libav/libavcodec/aactab.h
index c76d65d..56e5796 100644
--- a/gst-libs/ext/libav/libavcodec/aactab.h
+++ b/gst-libs/ext/libav/libavcodec/aactab.h
@@ -44,8 +44,8 @@
/* @name window coefficients
* @{
*/
-DECLARE_ALIGNED(16, extern float, ff_aac_kbd_long_1024)[1024];
-DECLARE_ALIGNED(16, extern float, ff_aac_kbd_short_128)[128];
+DECLARE_ALIGNED(32, extern float, ff_aac_kbd_long_1024)[1024];
+DECLARE_ALIGNED(32, extern float, ff_aac_kbd_short_128)[128];
// @}
/* @name number of scalefactor window bands for long and short transform windows respectively
diff --git a/gst-libs/ext/libav/libavcodec/aasc.c b/gst-libs/ext/libav/libavcodec/aasc.c
index f9c60f9..7063cbe 100644
--- a/gst-libs/ext/libav/libavcodec/aasc.c
+++ b/gst-libs/ext/libav/libavcodec/aasc.c
@@ -44,18 +44,18 @@ static av_cold int aasc_decode_init(AVCodecContext *avctx)
s->avctx = avctx;
- avctx->pix_fmt = PIX_FMT_BGR24;
+ avctx->pix_fmt = AV_PIX_FMT_BGR24;
return 0;
}
static int aasc_decode_frame(AVCodecContext *avctx,
- void *data, int *data_size,
+ void *data, int *got_frame,
AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
- int buf_size = avpkt->size;
- AascContext *s = avctx->priv_data;
+ int buf_size = avpkt->size;
+ AascContext *s = avctx->priv_data;
int compr, i, stride;
s->frame.reference = 1;
@@ -65,19 +65,19 @@ static int aasc_decode_frame(AVCodecContext *avctx,
return -1;
}
- compr = AV_RL32(buf);
- buf += 4;
+ compr = AV_RL32(buf);
+ buf += 4;
buf_size -= 4;
- switch(compr){
+ switch (compr) {
case 0:
stride = (avctx->width * 3 + 3) & ~3;
- for(i = avctx->height - 1; i >= 0; i--){
- memcpy(s->frame.data[0] + i*s->frame.linesize[0], buf, avctx->width*3);
+ for (i = avctx->height - 1; i >= 0; i--) {
+ memcpy(s->frame.data[0] + i * s->frame.linesize[0], buf, avctx->width * 3);
buf += stride;
}
break;
case 1:
- bytestream2_init(&s->gb, buf - 4, buf_size + 4);
+ bytestream2_init(&s->gb, buf, buf_size);
ff_msrle_decode(avctx, (AVPicture*)&s->frame, 8, &s->gb);
break;
default:
@@ -85,7 +85,7 @@ static int aasc_decode_frame(AVCodecContext *avctx,
return -1;
}
- *data_size = sizeof(AVFrame);
+ *got_frame = 1;
*(AVFrame*)data = s->frame;
/* report that the buffer was completely consumed */
@@ -106,11 +106,11 @@ static av_cold int aasc_decode_end(AVCodecContext *avctx)
AVCodec ff_aasc_decoder = {
.name = "aasc",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_AASC,
+ .id = AV_CODEC_ID_AASC,
.priv_data_size = sizeof(AascContext),
.init = aasc_decode_init,
.close = aasc_decode_end,
.decode = aasc_decode_frame,
.capabilities = CODEC_CAP_DR1,
- .long_name = NULL_IF_CONFIG_SMALL("Autodesk RLE"),
+ .long_name = NULL_IF_CONFIG_SMALL("Autodesk RLE"),
};
diff --git a/gst-libs/ext/libav/libavcodec/ac3.h b/gst-libs/ext/libav/libavcodec/ac3.h
index 304c86c..647432f 100644
--- a/gst-libs/ext/libav/libavcodec/ac3.h
+++ b/gst-libs/ext/libav/libavcodec/ac3.h
@@ -91,7 +91,7 @@ typedef struct AC3BitAllocParameters {
* @struct AC3HeaderInfo
* Coded AC-3 header values up to the lfeon element, plus derived values.
*/
-typedef struct {
+typedef struct AC3HeaderInfo {
/** @name Coded elements
* @{
*/
diff --git a/gst-libs/ext/libav/libavcodec/ac3_parser.c b/gst-libs/ext/libav/libavcodec/ac3_parser.c
index d9ba1fd..4abcf16 100644
--- a/gst-libs/ext/libav/libavcodec/ac3_parser.c
+++ b/gst-libs/ext/libav/libavcodec/ac3_parser.c
@@ -20,11 +20,11 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "libavutil/channel_layout.h"
#include "parser.h"
#include "ac3_parser.h"
#include "aac_ac3_parser.h"
#include "get_bits.h"
-#include "libavutil/audioconvert.h"
#define AC3_HEADER_SIZE 7
@@ -167,9 +167,9 @@ static int ac3_sync(uint64_t state, AACAC3ParseContext *hdr_info,
if (hdr.bitstream_mode == 0x7 && hdr.channels > 1)
hdr_info->service_type = AV_AUDIO_SERVICE_TYPE_KARAOKE;
if(hdr.bitstream_id>10)
- hdr_info->codec_id = CODEC_ID_EAC3;
- else if (hdr_info->codec_id == CODEC_ID_NONE)
- hdr_info->codec_id = CODEC_ID_AC3;
+ hdr_info->codec_id = AV_CODEC_ID_EAC3;
+ else if (hdr_info->codec_id == AV_CODEC_ID_NONE)
+ hdr_info->codec_id = AV_CODEC_ID_AC3;
*need_next_header = (hdr.frame_type != EAC3_FRAME_TYPE_AC3_CONVERT);
*new_frame_start = (hdr.frame_type != EAC3_FRAME_TYPE_DEPENDENT);
@@ -186,7 +186,7 @@ static av_cold int ac3_parse_init(AVCodecParserContext *s1)
AVCodecParser ff_ac3_parser = {
- .codec_ids = { CODEC_ID_AC3, CODEC_ID_EAC3 },
+ .codec_ids = { AV_CODEC_ID_AC3, AV_CODEC_ID_EAC3 },
.priv_data_size = sizeof(AACAC3ParseContext),
.parser_init = ac3_parse_init,
.parser_parse = ff_aac_ac3_parse,
diff --git a/gst-libs/ext/libav/libavcodec/ac3dec.c b/gst-libs/ext/libav/libavcodec/ac3dec.c
index 28a783a..0d1ba89 100644
--- a/gst-libs/ext/libav/libavcodec/ac3dec.c
+++ b/gst-libs/ext/libav/libavcodec/ac3dec.c
@@ -160,31 +160,21 @@ static av_cold void ac3_tables_init(void)
static av_cold int ac3_decode_init(AVCodecContext *avctx)
{
AC3DecodeContext *s = avctx->priv_data;
- s->avctx = avctx;
+ int i;
-#if FF_API_DRC_SCALE
- if (avctx->drc_scale)
- s->drc_scale = avctx->drc_scale;
-#endif
+ s->avctx = avctx;
ff_ac3_common_init();
ac3_tables_init();
ff_mdct_init(&s->imdct_256, 8, 1, 1.0);
ff_mdct_init(&s->imdct_512, 9, 1, 1.0);
ff_kbd_window_init(s->window, 5.0, 256);
- dsputil_init(&s->dsp, avctx);
+ ff_dsputil_init(&s->dsp, avctx);
ff_ac3dsp_init(&s->ac3dsp, avctx->flags & CODEC_FLAG_BITEXACT);
ff_fmt_convert_init(&s->fmt_conv, avctx);
av_lfg_init(&s->dith_state, 0);
- /* set scale value for float to int16 conversion */
- if (avctx->request_sample_fmt == AV_SAMPLE_FMT_FLT) {
- s->mul_bias = 1.0f;
- avctx->sample_fmt = AV_SAMPLE_FMT_FLT;
- } else {
- s->mul_bias = 32767.0f;
- avctx->sample_fmt = AV_SAMPLE_FMT_S16;
- }
+ avctx->sample_fmt = AV_SAMPLE_FMT_FLTP;
/* allow downmixing to stereo or mono */
if (avctx->channels > 0 && avctx->request_channels > 0 &&
@@ -197,6 +187,11 @@ static av_cold int ac3_decode_init(AVCodecContext *avctx)
avcodec_get_frame_defaults(&s->frame);
avctx->coded_frame = &s->frame;
+ for (i = 0; i < AC3_MAX_CHANNELS; i++) {
+ s->xcfptr[i] = s->transform_coeffs[i];
+ s->dlyptr[i] = s->delay[i];
+ }
+
return 0;
}
@@ -551,7 +546,7 @@ static void decode_transform_coeffs(AC3DecodeContext *s, int blk)
for (ch = 1; ch <= s->channels; ch++) {
/* transform coefficients for full-bandwidth channel */
decode_transform_coeffs_ch(s, blk, ch, &m);
- /* tranform coefficients for coupling channel come right after the
+ /* transform coefficients for coupling channel come right after the
coefficients for the first coupled channel*/
if (s->channel_in_cpl[ch]) {
if (!got_cplchan) {
@@ -611,14 +606,14 @@ static inline void do_imdct(AC3DecodeContext *s, int channels)
for (i = 0; i < 128; i++)
x[i] = s->transform_coeffs[ch][2 * i];
s->imdct_256.imdct_half(&s->imdct_256, s->tmp_output, x);
- s->dsp.vector_fmul_window(s->output[ch - 1], s->delay[ch - 1],
+ s->dsp.vector_fmul_window(s->outptr[ch - 1], s->delay[ch - 1],
s->tmp_output, s->window, 128);
for (i = 0; i < 128; i++)
x[i] = s->transform_coeffs[ch][2 * i + 1];
s->imdct_256.imdct_half(&s->imdct_256, s->delay[ch - 1], x);
} else {
s->imdct_512.imdct_half(&s->imdct_512, s->tmp_output, s->transform_coeffs[ch]);
- s->dsp.vector_fmul_window(s->output[ch - 1], s->delay[ch - 1],
+ s->dsp.vector_fmul_window(s->outptr[ch - 1], s->delay[ch - 1],
s->tmp_output, s->window, 128);
memcpy(s->delay[ch - 1], s->tmp_output + 128, 128 * sizeof(float));
}
@@ -626,34 +621,6 @@ static inline void do_imdct(AC3DecodeContext *s, int channels)
}
/**
- * Downmix the output to mono or stereo.
- */
-void ff_ac3_downmix_c(float (*samples)[256], float (*matrix)[2],
- int out_ch, int in_ch, int len)
-{
- int i, j;
- float v0, v1;
- if (out_ch == 2) {
- for (i = 0; i < len; i++) {
- v0 = v1 = 0.0f;
- for (j = 0; j < in_ch; j++) {
- v0 += samples[j][i] * matrix[j][0];
- v1 += samples[j][i] * matrix[j][1];
- }
- samples[0][i] = v0;
- samples[1][i] = v1;
- }
- } else if (out_ch == 1) {
- for (i = 0; i < len; i++) {
- v0 = 0.0f;
- for (j = 0; j < in_ch; j++)
- v0 += samples[j][i] * matrix[j][0];
- samples[0][i] = v0;
- }
- }
-}
-
-/**
* Upmix delay samples from stereo to original channel layout.
*/
static void ac3_upmix_delay(AC3DecodeContext *s)
@@ -758,9 +725,7 @@ static int decode_audio_block(AC3DecodeContext *s, int blk)
int downmix_output;
int cpl_in_use;
GetBitContext *gbc = &s->gbc;
- uint8_t bit_alloc_stages[AC3_MAX_CHANNELS];
-
- memset(bit_alloc_stages, 0, AC3_MAX_CHANNELS);
+ uint8_t bit_alloc_stages[AC3_MAX_CHANNELS] = { 0 };
/* block switch flags */
different_transforms = 0;
@@ -911,7 +876,7 @@ static int decode_audio_block(AC3DecodeContext *s, int blk)
if (s->eac3 && get_bits1(gbc)) {
/* TODO: parse enhanced coupling strategy info */
av_log_missing_feature(s->avctx, "Enhanced coupling", 1);
- return -1;
+ return AVERROR_PATCHWELCOME;
}
/* determine which channels are coupled */
@@ -1241,7 +1206,7 @@ static int decode_audio_block(AC3DecodeContext *s, int blk)
/* apply scaling to coefficients (headroom, dynrng) */
for (ch = 1; ch <= s->channels; ch++) {
- float gain = s->mul_bias / 4194304.0f;
+ float gain = 1.0 / 4194304.0f;
if (s->channel_mode == AC3_CHMODE_DUALMONO) {
gain *= s->dynamic_range[2 - ch];
} else {
@@ -1273,19 +1238,19 @@ static int decode_audio_block(AC3DecodeContext *s, int blk)
do_imdct(s, s->channels);
if (downmix_output) {
- s->dsp.ac3_downmix(s->output, s->downmix_coeffs,
- s->out_channels, s->fbw_channels, 256);
+ s->ac3dsp.downmix(s->outptr, s->downmix_coeffs,
+ s->out_channels, s->fbw_channels, 256);
}
} else {
if (downmix_output) {
- s->dsp.ac3_downmix(s->transform_coeffs + 1, s->downmix_coeffs,
- s->out_channels, s->fbw_channels, 256);
+ s->ac3dsp.downmix(s->xcfptr + 1, s->downmix_coeffs,
+ s->out_channels, s->fbw_channels, 256);
}
if (downmix_output && !s->downmixed) {
s->downmixed = 1;
- s->dsp.ac3_downmix(s->delay, s->downmix_coeffs, s->out_channels,
- s->fbw_channels, 128);
+ s->ac3dsp.downmix(s->dlyptr, s->downmix_coeffs, s->out_channels,
+ s->fbw_channels, 128);
}
do_imdct(s, s->out_channels);
@@ -1303,8 +1268,6 @@ static int ac3_decode_frame(AVCodecContext * avctx, void *data,
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
AC3DecodeContext *s = avctx->priv_data;
- float *out_samples_flt;
- int16_t *out_samples_s16;
int blk, ch, err, ret;
const uint8_t *channel_map;
const float *output[AC3_MAX_CHANNELS];
@@ -1373,8 +1336,10 @@ static int ac3_decode_frame(AVCodecContext * avctx, void *data,
if (!err) {
avctx->sample_rate = s->sample_rate;
avctx->bit_rate = s->bit_rate;
+ }
- /* channel config */
+ /* channel config */
+ if (!err || (s->channels && s->out_channels != s->channels)) {
s->out_channels = s->channels;
s->output_mode = s->channel_mode;
if (s->lfe_on)
@@ -1393,46 +1358,51 @@ static int ac3_decode_frame(AVCodecContext * avctx, void *data,
s->fbw_channels == s->out_channels)) {
set_downmix_coeffs(s);
}
- } else if (!s->out_channels) {
- s->out_channels = avctx->channels;
- if (s->out_channels < s->channels)
- s->output_mode = s->out_channels == 1 ? AC3_CHMODE_MONO : AC3_CHMODE_STEREO;
+ } else if (!s->channels) {
+ av_log(avctx, AV_LOG_ERROR, "unable to determine channel mode\n");
+ return AVERROR_INVALIDDATA;
}
+ avctx->channels = s->out_channels;
+
/* set audio service type based on bitstream mode for AC-3 */
avctx->audio_service_type = s->bitstream_mode;
if (s->bitstream_mode == 0x7 && s->channels > 1)
avctx->audio_service_type = AV_AUDIO_SERVICE_TYPE_KARAOKE;
/* get output buffer */
- avctx->channels = s->out_channels;
s->frame.nb_samples = s->num_blocks * 256;
- if ((ret = avctx->get_buffer(avctx, &s->frame)) < 0) {
+ if ((ret = ff_get_buffer(avctx, &s->frame)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return ret;
}
- out_samples_flt = (float *)s->frame.data[0];
- out_samples_s16 = (int16_t *)s->frame.data[0];
/* decode the audio blocks */
channel_map = ff_ac3_dec_channel_map[s->output_mode & ~AC3_OUTPUT_LFEON][s->lfe_on];
- for (ch = 0; ch < s->out_channels; ch++)
- output[ch] = s->output[channel_map[ch]];
+ for (ch = 0; ch < s->channels; ch++) {
+ if (ch < s->out_channels)
+ s->outptr[channel_map[ch]] = (float *)s->frame.data[ch];
+ else
+ s->outptr[ch] = s->output[ch];
+ output[ch] = s->output[ch];
+ }
for (blk = 0; blk < s->num_blocks; blk++) {
if (!err && decode_audio_block(s, blk)) {
av_log(avctx, AV_LOG_ERROR, "error decoding the audio block\n");
err = 1;
}
- if (avctx->sample_fmt == AV_SAMPLE_FMT_FLT) {
- s->fmt_conv.float_interleave(out_samples_flt, output, 256,
- s->out_channels);
- out_samples_flt += 256 * s->out_channels;
- } else {
- s->fmt_conv.float_to_int16_interleave(out_samples_s16, output, 256,
- s->out_channels);
- out_samples_s16 += 256 * s->out_channels;
+ if (err)
+ for (ch = 0; ch < s->out_channels; ch++)
+ memcpy(s->outptr[channel_map[ch]], output[ch], 1024);
+ for (ch = 0; ch < s->out_channels; ch++) {
+ output[ch] = s->outptr[channel_map[ch]];
+ s->outptr[channel_map[ch]] += AC3_BLOCK_SIZE;
}
}
+ /* keep last block for error concealment in next frame */
+ for (ch = 0; ch < s->out_channels; ch++)
+ memcpy(s->output[ch], output[ch], 1024);
+
*got_frame_ptr = 1;
*(AVFrame *)data = s->frame;
@@ -1454,7 +1424,7 @@ 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), AV_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, {.dbl = 1.0}, 0.0, 1.0, PAR },
{ NULL},
};
@@ -1468,15 +1438,14 @@ static const AVClass ac3_decoder_class = {
AVCodec ff_ac3_decoder = {
.name = "ac3",
.type = AVMEDIA_TYPE_AUDIO,
- .id = CODEC_ID_AC3,
+ .id = AV_CODEC_ID_AC3,
.priv_data_size = sizeof (AC3DecodeContext),
.init = ac3_decode_init,
.close = ac3_decode_end,
.decode = ac3_decode_frame,
.capabilities = CODEC_CAP_DR1,
.long_name = NULL_IF_CONFIG_SMALL("ATSC A/52A (AC-3)"),
- .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLT,
- AV_SAMPLE_FMT_S16,
+ .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP,
AV_SAMPLE_FMT_NONE },
.priv_class = &ac3_decoder_class,
};
@@ -1492,15 +1461,14 @@ static const AVClass eac3_decoder_class = {
AVCodec ff_eac3_decoder = {
.name = "eac3",
.type = AVMEDIA_TYPE_AUDIO,
- .id = CODEC_ID_EAC3,
+ .id = AV_CODEC_ID_EAC3,
.priv_data_size = sizeof (AC3DecodeContext),
.init = ac3_decode_init,
.close = ac3_decode_end,
.decode = ac3_decode_frame,
.capabilities = CODEC_CAP_DR1,
.long_name = NULL_IF_CONFIG_SMALL("ATSC A/52B (AC-3, E-AC-3)"),
- .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLT,
- AV_SAMPLE_FMT_S16,
+ .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP,
AV_SAMPLE_FMT_NONE },
.priv_class = &eac3_decoder_class,
};
diff --git a/gst-libs/ext/libav/libavcodec/ac3dec.h b/gst-libs/ext/libav/libavcodec/ac3dec.h
index 56c6553..1e8ee68 100644
--- a/gst-libs/ext/libav/libavcodec/ac3dec.h
+++ b/gst-libs/ext/libav/libavcodec/ac3dec.h
@@ -65,7 +65,7 @@
/** Large enough for maximum possible frame size when the specification limit is ignored */
#define AC3_FRAME_BUFFER_SIZE 32768
-typedef struct {
+typedef struct AC3DecodeContext {
AVClass *class; ///< class for AVOptions
AVCodecContext *avctx; ///< parent context
AVFrame frame; ///< AVFrame for decoded output
@@ -195,9 +195,12 @@ typedef struct {
DSPContext dsp; ///< for optimization
AC3DSPContext ac3dsp;
FmtConvertContext fmt_conv; ///< optimized conversion functions
- float mul_bias; ///< scaling for float_to_int16 conversion
///@}
+ float *outptr[AC3_MAX_CHANNELS];
+ float *xcfptr[AC3_MAX_CHANNELS];
+ float *dlyptr[AC3_MAX_CHANNELS];
+
///@name Aligned arrays
DECLARE_ALIGNED(16, int, fixed_coeffs)[AC3_MAX_CHANNELS][AC3_MAX_COEFS]; ///< fixed-point transform coefficients
DECLARE_ALIGNED(32, float, transform_coeffs)[AC3_MAX_CHANNELS][AC3_MAX_COEFS]; ///< transform coefficients
@@ -221,9 +224,6 @@ int ff_eac3_parse_header(AC3DecodeContext *s);
*/
void ff_eac3_decode_transform_coeffs_aht_ch(AC3DecodeContext *s, int ch);
-void ff_ac3_downmix_c(float (*samples)[256], float (*matrix)[2],
- int out_ch, int in_ch, int len);
-
/**
* Apply spectral extension to each channel by copying lower frequency
* coefficients to higher frequency bins and applying side information to
diff --git a/gst-libs/ext/libav/libavcodec/ac3dsp.c b/gst-libs/ext/libav/libavcodec/ac3dsp.c
index b751aec..ef19f6a 100644
--- a/gst-libs/ext/libav/libavcodec/ac3dsp.c
+++ b/gst-libs/ext/libav/libavcodec/ac3dsp.c
@@ -171,6 +171,31 @@ static void ac3_extract_exponents_c(uint8_t *exp, int32_t *coef, int nb_coefs)
}
}
+static void ac3_downmix_c(float **samples, float (*matrix)[2],
+ int out_ch, int in_ch, int len)
+{
+ int i, j;
+ float v0, v1;
+ if (out_ch == 2) {
+ for (i = 0; i < len; i++) {
+ v0 = v1 = 0.0f;
+ for (j = 0; j < in_ch; j++) {
+ v0 += samples[j][i] * matrix[j][0];
+ v1 += samples[j][i] * matrix[j][1];
+ }
+ samples[0][i] = v0;
+ samples[1][i] = v1;
+ }
+ } else if (out_ch == 1) {
+ for (i = 0; i < len; i++) {
+ v0 = 0.0f;
+ for (j = 0; j < in_ch; j++)
+ v0 += samples[j][i] * matrix[j][0];
+ samples[0][i] = v0;
+ }
+ }
+}
+
av_cold void ff_ac3dsp_init(AC3DSPContext *c, int bit_exact)
{
c->ac3_exponent_min = ac3_exponent_min_c;
@@ -182,9 +207,10 @@ av_cold void ff_ac3dsp_init(AC3DSPContext *c, int bit_exact)
c->update_bap_counts = ac3_update_bap_counts_c;
c->compute_mantissa_size = ac3_compute_mantissa_size_c;
c->extract_exponents = ac3_extract_exponents_c;
+ c->downmix = ac3_downmix_c;
if (ARCH_ARM)
ff_ac3dsp_init_arm(c, bit_exact);
- if (HAVE_MMX)
+ if (ARCH_X86)
ff_ac3dsp_init_x86(c, bit_exact);
}
diff --git a/gst-libs/ext/libav/libavcodec/ac3dsp.h b/gst-libs/ext/libav/libavcodec/ac3dsp.h
index 8eeafd6..882eb76 100644
--- a/gst-libs/ext/libav/libavcodec/ac3dsp.h
+++ b/gst-libs/ext/libav/libavcodec/ac3dsp.h
@@ -125,6 +125,9 @@ typedef struct AC3DSPContext {
int (*compute_mantissa_size)(uint16_t mant_cnt[6][16]);
void (*extract_exponents)(uint8_t *exp, int32_t *coef, int nb_coefs);
+
+ void (*downmix)(float **samples, float (*matrix)[2], int out_ch,
+ int in_ch, int len);
} AC3DSPContext;
void ff_ac3dsp_init (AC3DSPContext *c, int bit_exact);
diff --git a/gst-libs/ext/libav/libavcodec/ac3enc.c b/gst-libs/ext/libav/libavcodec/ac3enc.c
index b8e23e4..c0acc64 100644
--- a/gst-libs/ext/libav/libavcodec/ac3enc.c
+++ b/gst-libs/ext/libav/libavcodec/ac3enc.c
@@ -30,9 +30,9 @@
#include <stdint.h>
-#include "libavutil/audioconvert.h"
#include "libavutil/avassert.h"
#include "libavutil/avstring.h"
+#include "libavutil/channel_layout.h"
#include "libavutil/crc.h"
#include "libavutil/opt.h"
#include "avcodec.h"
@@ -40,7 +40,6 @@
#include "dsputil.h"
#include "ac3dsp.h"
#include "ac3.h"
-#include "audioconvert.h"
#include "fft.h"
#include "ac3enc.h"
#include "eac3enc.h"
@@ -660,7 +659,7 @@ static void count_frame_bits_fixed(AC3EncodeContext *s)
* bit allocation parameters do not change between blocks
* no delta bit allocation
* no skipped data
- * no auxilliary data
+ * no auxiliary data
* no E-AC-3 metadata
*/
@@ -1386,8 +1385,7 @@ static void ac3_output_frame_header(AC3EncodeContext *s)
*/
static void output_audio_block(AC3EncodeContext *s, int blk)
{
- int ch, i, baie, bnd, got_cpl;
- int av_uninit(ch0);
+ int ch, i, baie, bnd, got_cpl, ch0;
AC3Block *block = &s->blocks[blk];
/* block switching */
@@ -2054,7 +2052,9 @@ av_cold int ff_ac3_encode_close(AVCodecContext *avctx)
s->mdct_end(s);
+#if FF_API_OLD_ENCODE_AUDIO
av_freep(&avctx->coded_frame);
+#endif
return 0;
}
@@ -2073,7 +2073,7 @@ static av_cold int set_channel_info(AC3EncodeContext *s, int channels,
return AVERROR(EINVAL);
ch_layout = *channel_layout;
if (!ch_layout)
- ch_layout = avcodec_guess_channel_layout(channels, CODEC_ID_AC3, NULL);
+ ch_layout = av_get_default_channel_layout(channels);
s->lfe_on = !!(ch_layout & AV_CH_LOW_FREQUENCY);
s->channels = channels;
@@ -2142,6 +2142,17 @@ static av_cold int validate_options(AC3EncodeContext *s)
s->bit_alloc.sr_code = i % 3;
s->bitstream_id = s->eac3 ? 16 : 8 + s->bit_alloc.sr_shift;
+ /* select a default bit rate if not set by the user */
+ if (!avctx->bit_rate) {
+ switch (s->fbw_channels) {
+ case 1: avctx->bit_rate = 96000; break;
+ case 2: avctx->bit_rate = 192000; break;
+ case 3: avctx->bit_rate = 320000; break;
+ case 4: avctx->bit_rate = 384000; break;
+ case 5: avctx->bit_rate = 448000; break;
+ }
+ }
+
/* validate bit rate */
if (s->eac3) {
int max_br, min_br, wpf, min_br_dist, min_br_code;
@@ -2190,15 +2201,20 @@ static av_cold int validate_options(AC3EncodeContext *s)
wpf--;
s->frame_size_min = 2 * wpf;
} else {
+ int best_br = 0, best_code = 0, best_diff = INT_MAX;
for (i = 0; i < 19; i++) {
- if ((ff_ac3_bitrate_tab[i] >> s->bit_alloc.sr_shift)*1000 == avctx->bit_rate)
+ int br = (ff_ac3_bitrate_tab[i] >> s->bit_alloc.sr_shift) * 1000;
+ int diff = abs(br - avctx->bit_rate);
+ if (diff < best_diff) {
+ best_br = br;
+ best_code = i;
+ best_diff = diff;
+ }
+ if (!best_diff)
break;
}
- if (i == 19) {
- av_log(avctx, AV_LOG_ERROR, "invalid bit rate\n");
- return AVERROR(EINVAL);
- }
- s->frame_size_code = i << 1;
+ avctx->bit_rate = best_br;
+ s->frame_size_code = best_code << 1;
s->frame_size_min = 2 * ff_ac3_frame_size_tab[s->frame_size_code][s->bit_alloc.sr_code];
s->num_blks_code = 0x3;
s->num_blocks = 6;
@@ -2236,8 +2252,7 @@ static av_cold int validate_options(AC3EncodeContext *s)
*/
static av_cold void set_bandwidth(AC3EncodeContext *s)
{
- int blk, ch;
- int av_uninit(cpl_start);
+ int blk, ch, cpl_start;
if (s->cutoff) {
/* calculate bandwidth based on user-specified cutoff frequency */
@@ -2414,7 +2429,7 @@ av_cold int ff_ac3_encode_init(AVCodecContext *avctx)
s->avctx = avctx;
- s->eac3 = avctx->codec_id == CODEC_ID_EAC3;
+ s->eac3 = avctx->codec_id == AV_CODEC_ID_EAC3;
ff_ac3_common_init();
@@ -2423,6 +2438,7 @@ av_cold int ff_ac3_encode_init(AVCodecContext *avctx)
return ret;
avctx->frame_size = AC3_BLOCK_SIZE * s->num_blocks;
+ avctx->delay = AC3_BLOCK_SIZE;
s->bitstream_mode = avctx->audio_service_type;
if (s->bitstream_mode == AV_AUDIO_SERVICE_TYPE_KARAOKE)
@@ -2468,9 +2484,16 @@ av_cold int ff_ac3_encode_init(AVCodecContext *avctx)
if (ret)
goto init_fail;
+#if FF_API_OLD_ENCODE_AUDIO
avctx->coded_frame= avcodec_alloc_frame();
+ if (!avctx->coded_frame) {
+ ret = AVERROR(ENOMEM);
+ goto init_fail;
+ }
+#endif
- dsputil_init(&s->dsp, avctx);
+ ff_dsputil_init(&s->dsp, avctx);
+ avpriv_float_dsp_init(&s->fdsp, avctx->flags & CODEC_FLAG_BITEXACT);
ff_ac3dsp_init(&s->ac3dsp, avctx->flags & CODEC_FLAG_BITEXACT);
dprint_options(s);
diff --git a/gst-libs/ext/libav/libavcodec/ac3enc.h b/gst-libs/ext/libav/libavcodec/ac3enc.h
index 6ef1a53..be9dcf2 100644
--- a/gst-libs/ext/libav/libavcodec/ac3enc.h
+++ b/gst-libs/ext/libav/libavcodec/ac3enc.h
@@ -29,6 +29,8 @@
#define AVCODEC_AC3ENC_H
#include <stdint.h>
+
+#include "libavutil/float_dsp.h"
#include "ac3.h"
#include "ac3dsp.h"
#include "avcodec.h"
@@ -158,6 +160,7 @@ typedef struct AC3EncodeContext {
AVCodecContext *avctx; ///< parent AVCodecContext
PutBitContext pb; ///< bitstream writer context
DSPContext dsp;
+ AVFloatDSPContext fdsp;
AC3DSPContext ac3dsp; ///< AC-3 optimized functions
FFTContext mdct; ///< FFT context for MDCT calculation
const SampleType *mdct_window; ///< MDCT window function array
@@ -297,9 +300,9 @@ int ff_ac3_float_mdct_init(AC3EncodeContext *s);
int ff_ac3_fixed_allocate_sample_buffers(AC3EncodeContext *s);
int ff_ac3_float_allocate_sample_buffers(AC3EncodeContext *s);
-int ff_ac3_fixed_encode_frame(AVCodecContext *avctx, unsigned char *frame,
- int buf_size, void *data);
-int ff_ac3_float_encode_frame(AVCodecContext *avctx, unsigned char *frame,
- int buf_size, void *data);
+int ff_ac3_fixed_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
+ const AVFrame *frame, int *got_packet_ptr);
+int ff_ac3_float_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
+ const AVFrame *frame, int *got_packet_ptr);
#endif /* AVCODEC_AC3ENC_H */
diff --git a/gst-libs/ext/libav/libavcodec/ac3enc_fixed.c b/gst-libs/ext/libav/libavcodec/ac3enc_fixed.c
index 202dfb8..e471edf 100644
--- a/gst-libs/ext/libav/libavcodec/ac3enc_fixed.c
+++ b/gst-libs/ext/libav/libavcodec/ac3enc_fixed.c
@@ -28,13 +28,14 @@
#define CONFIG_FFT_FLOAT 0
#undef CONFIG_AC3ENC_FLOAT
+#include "internal.h"
#include "ac3enc.h"
#include "eac3enc.h"
#define AC3ENC_TYPE AC3ENC_TYPE_AC3_FIXED
#include "ac3enc_opts_template.c"
static const AVClass ac3enc_class = { "Fixed-Point AC-3 Encoder", av_default_item_name,
- ac3fixed_options, LIBAVUTIL_VERSION_INT };
+ ac3_options, LIBAVUTIL_VERSION_INT };
#include "ac3enc_template.c"
@@ -67,10 +68,11 @@ av_cold int AC3_NAME(mdct_init)(AC3EncodeContext *s)
/*
* Apply KBD window to input samples prior to MDCT.
*/
-static void apply_window(DSPContext *dsp, int16_t *output, const int16_t *input,
+static void apply_window(void *dsp, int16_t *output, const int16_t *input,
const int16_t *window, unsigned int len)
{
- dsp->apply_window_int16(output, input, window, len);
+ DSPContext *dsp0 = dsp;
+ dsp0->apply_window_int16(output, input, window, len);
}
@@ -140,15 +142,17 @@ static av_cold int ac3_fixed_encode_init(AVCodecContext *avctx)
AVCodec ff_ac3_fixed_encoder = {
- .name = "ac3_fixed",
- .type = AVMEDIA_TYPE_AUDIO,
- .id = CODEC_ID_AC3,
- .priv_data_size = sizeof(AC3EncodeContext),
- .init = ac3_fixed_encode_init,
- .encode = ff_ac3_fixed_encode_frame,
- .close = ff_ac3_encode_close,
- .sample_fmts = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_NONE},
- .long_name = NULL_IF_CONFIG_SMALL("ATSC A/52A (AC-3)"),
- .priv_class = &ac3enc_class,
+ .name = "ac3_fixed",
+ .type = AVMEDIA_TYPE_AUDIO,
+ .id = AV_CODEC_ID_AC3,
+ .priv_data_size = sizeof(AC3EncodeContext),
+ .init = ac3_fixed_encode_init,
+ .encode2 = ff_ac3_fixed_encode_frame,
+ .close = ff_ac3_encode_close,
+ .sample_fmts = (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_S16P,
+ AV_SAMPLE_FMT_NONE },
+ .long_name = NULL_IF_CONFIG_SMALL("ATSC A/52A (AC-3)"),
+ .priv_class = &ac3enc_class,
.channel_layouts = ff_ac3_channel_layouts,
+ .defaults = ac3_defaults,
};
diff --git a/gst-libs/ext/libav/libavcodec/ac3enc_float.c b/gst-libs/ext/libav/libavcodec/ac3enc_float.c
index a4abd89..a225d9b 100644
--- a/gst-libs/ext/libav/libavcodec/ac3enc_float.c
+++ b/gst-libs/ext/libav/libavcodec/ac3enc_float.c
@@ -27,6 +27,7 @@
*/
#define CONFIG_AC3ENC_FLOAT 1
+#include "internal.h"
#include "ac3enc.h"
#include "eac3enc.h"
#include "kbdwin.h"
@@ -85,10 +86,12 @@ av_cold int ff_ac3_float_mdct_init(AC3EncodeContext *s)
/*
* Apply KBD window to input samples prior to MDCT.
*/
-static void apply_window(DSPContext *dsp, float *output, const float *input,
- const float *window, unsigned int len)
+static void apply_window(void *dsp, float *output,
+ const float *input, const float *window,
+ unsigned int len)
{
- dsp->vector_fmul(output, input, window, len);
+ AVFloatDSPContext *fdsp = dsp;
+ fdsp->vector_fmul(output, input, window, len);
}
@@ -138,16 +141,18 @@ static CoefType calc_cpl_coord(CoefSumType energy_ch, CoefSumType energy_cpl)
#if CONFIG_AC3_ENCODER
AVCodec ff_ac3_encoder = {
- .name = "ac3",
- .type = AVMEDIA_TYPE_AUDIO,
- .id = CODEC_ID_AC3,
- .priv_data_size = sizeof(AC3EncodeContext),
- .init = ff_ac3_encode_init,
- .encode = ff_ac3_float_encode_frame,
- .close = ff_ac3_encode_close,
- .sample_fmts = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_FLT,AV_SAMPLE_FMT_NONE},
- .long_name = NULL_IF_CONFIG_SMALL("ATSC A/52A (AC-3)"),
- .priv_class = &ac3enc_class,
+ .name = "ac3",
+ .type = AVMEDIA_TYPE_AUDIO,
+ .id = AV_CODEC_ID_AC3,
+ .priv_data_size = sizeof(AC3EncodeContext),
+ .init = ff_ac3_encode_init,
+ .encode2 = ff_ac3_float_encode_frame,
+ .close = ff_ac3_encode_close,
+ .sample_fmts = (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_FLTP,
+ AV_SAMPLE_FMT_NONE },
+ .long_name = NULL_IF_CONFIG_SMALL("ATSC A/52A (AC-3)"),
+ .priv_class = &ac3enc_class,
.channel_layouts = ff_ac3_channel_layouts,
+ .defaults = ac3_defaults,
};
#endif
diff --git a/gst-libs/ext/libav/libavcodec/ac3enc_opts_template.c b/gst-libs/ext/libav/libavcodec/ac3enc_opts_template.c
index a5f848e..339a08f 100644
--- a/gst-libs/ext/libav/libavcodec/ac3enc_opts_template.c
+++ b/gst-libs/ext/libav/libavcodec/ac3enc_opts_template.c
@@ -20,61 +20,61 @@
*/
#include "libavutil/opt.h"
+#include "internal.h"
#include "ac3.h"
-#if AC3ENC_TYPE == AC3ENC_TYPE_AC3_FIXED
-static const AVOption ac3fixed_options[] = {
-#elif AC3ENC_TYPE == AC3ENC_TYPE_AC3
static const AVOption ac3_options[] = {
-#else /* AC3ENC_TYPE_EAC3 */
-static const AVOption eac3_options[] = {
-#endif
/* Metadata Options */
-{"per_frame_metadata", "Allow Changing Metadata Per-Frame", OFFSET(allow_per_frame_metadata), AV_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, {.i64 = 0 }, 0, 1, AC3ENC_PARAM},
#if AC3ENC_TYPE != AC3ENC_TYPE_EAC3
/* AC-3 downmix levels */
{"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), 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"},
+{"mixing_level", "Mixing Level", OFFSET(mixing_level), AV_OPT_TYPE_INT, {.i64 = AC3ENC_OPT_NONE }, AC3ENC_OPT_NONE, 111, AC3ENC_PARAM},
+{"room_type", "Room Type", OFFSET(room_type), AV_OPT_TYPE_INT, {.i64 = AC3ENC_OPT_NONE }, AC3ENC_OPT_NONE, AC3ENC_OPT_SMALL_ROOM, AC3ENC_PARAM, "room_type"},
+ {"notindicated", "Not Indicated (default)", 0, AV_OPT_TYPE_CONST, {.i64 = AC3ENC_OPT_NOT_INDICATED }, INT_MIN, INT_MAX, AC3ENC_PARAM, "room_type"},
+ {"large", "Large Room", 0, AV_OPT_TYPE_CONST, {.i64 = AC3ENC_OPT_LARGE_ROOM }, INT_MIN, INT_MAX, AC3ENC_PARAM, "room_type"},
+ {"small", "Small Room", 0, AV_OPT_TYPE_CONST, {.i64 = AC3ENC_OPT_SMALL_ROOM }, INT_MIN, INT_MAX, AC3ENC_PARAM, "room_type"},
/* other metadata options */
-{"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_ON, 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},
+{"copyright", "Copyright Bit", OFFSET(copyright), AV_OPT_TYPE_INT, {.i64 = AC3ENC_OPT_NONE }, AC3ENC_OPT_NONE, 1, AC3ENC_PARAM},
+{"dialnorm", "Dialogue Level (dB)", OFFSET(dialogue_level), AV_OPT_TYPE_INT, {.i64 = -31 }, -31, -1, AC3ENC_PARAM},
+{"dsur_mode", "Dolby Surround Mode", OFFSET(dolby_surround_mode), AV_OPT_TYPE_INT, {.i64 = AC3ENC_OPT_NONE }, AC3ENC_OPT_NONE, AC3ENC_OPT_MODE_ON, AC3ENC_PARAM, "dsur_mode"},
+ {"notindicated", "Not Indicated (default)", 0, AV_OPT_TYPE_CONST, {.i64 = AC3ENC_OPT_NOT_INDICATED }, INT_MIN, INT_MAX, AC3ENC_PARAM, "dsur_mode"},
+ {"on", "Dolby Surround Encoded", 0, AV_OPT_TYPE_CONST, {.i64 = AC3ENC_OPT_MODE_ON }, INT_MIN, INT_MAX, AC3ENC_PARAM, "dsur_mode"},
+ {"off", "Not Dolby Surround Encoded", 0, AV_OPT_TYPE_CONST, {.i64 = AC3ENC_OPT_MODE_OFF }, INT_MIN, INT_MAX, AC3ENC_PARAM, "dsur_mode"},
+{"original", "Original Bit Stream", OFFSET(original), AV_OPT_TYPE_INT, {.i64 = AC3ENC_OPT_NONE }, AC3ENC_OPT_NONE, 1, AC3ENC_PARAM},
/* extended bitstream information */
-{"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"},
+{"dmix_mode", "Preferred Stereo Downmix Mode", OFFSET(preferred_stereo_downmix), AV_OPT_TYPE_INT, {.i64 = AC3ENC_OPT_NONE }, AC3ENC_OPT_NONE, AC3ENC_OPT_DOWNMIX_LORO, AC3ENC_PARAM, "dmix_mode"},
+ {"notindicated", "Not Indicated (default)", 0, AV_OPT_TYPE_CONST, {.i64 = AC3ENC_OPT_NOT_INDICATED }, INT_MIN, INT_MAX, AC3ENC_PARAM, "dmix_mode"},
+ {"ltrt", "Lt/Rt Downmix Preferred", 0, AV_OPT_TYPE_CONST, {.i64 = AC3ENC_OPT_DOWNMIX_LTRT }, INT_MIN, INT_MAX, AC3ENC_PARAM, "dmix_mode"},
+ {"loro", "Lo/Ro Downmix Preferred", 0, AV_OPT_TYPE_CONST, {.i64 = 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_ON, 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_ON, 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"},
+{"dsurex_mode", "Dolby Surround EX Mode", OFFSET(dolby_surround_ex_mode), AV_OPT_TYPE_INT, {.i64 = AC3ENC_OPT_NONE }, AC3ENC_OPT_NONE, AC3ENC_OPT_MODE_ON, AC3ENC_PARAM, "dsurex_mode"},
+ {"notindicated", "Not Indicated (default)", 0, AV_OPT_TYPE_CONST, {.i64 = AC3ENC_OPT_NOT_INDICATED }, INT_MIN, INT_MAX, AC3ENC_PARAM, "dsurex_mode"},
+ {"on", "Dolby Surround EX Encoded", 0, AV_OPT_TYPE_CONST, {.i64 = AC3ENC_OPT_MODE_ON }, INT_MIN, INT_MAX, AC3ENC_PARAM, "dsurex_mode"},
+ {"off", "Not Dolby Surround EX Encoded", 0, AV_OPT_TYPE_CONST, {.i64 = 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, {.i64 = AC3ENC_OPT_NONE }, AC3ENC_OPT_NONE, AC3ENC_OPT_MODE_ON, AC3ENC_PARAM, "dheadphone_mode"},
+ {"notindicated", "Not Indicated (default)", 0, AV_OPT_TYPE_CONST, {.i64 = AC3ENC_OPT_NOT_INDICATED }, INT_MIN, INT_MAX, AC3ENC_PARAM, "dheadphone_mode"},
+ {"on", "Dolby Headphone Encoded", 0, AV_OPT_TYPE_CONST, {.i64 = AC3ENC_OPT_MODE_ON }, INT_MIN, INT_MAX, AC3ENC_PARAM, "dheadphone_mode"},
+ {"off", "Not Dolby Headphone Encoded", 0, AV_OPT_TYPE_CONST, {.i64 = 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, {.i64 = AC3ENC_OPT_NONE }, AC3ENC_OPT_NONE, AC3ENC_OPT_ADCONV_HDCD, AC3ENC_PARAM, "ad_conv_type"},
+ {"standard", "Standard (default)", 0, AV_OPT_TYPE_CONST, {.i64 = AC3ENC_OPT_ADCONV_STANDARD }, INT_MIN, INT_MAX, AC3ENC_PARAM, "ad_conv_type"},
+ {"hdcd", "HDCD", 0, AV_OPT_TYPE_CONST, {.i64 = AC3ENC_OPT_ADCONV_HDCD }, INT_MIN, INT_MAX, AC3ENC_PARAM, "ad_conv_type"},
/* Other Encoding Options */
-{"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"},
+{"stereo_rematrixing", "Stereo Rematrixing", OFFSET(stereo_rematrixing), AV_OPT_TYPE_INT, {.i64 = AC3ENC_OPT_ON }, AC3ENC_OPT_OFF, AC3ENC_OPT_ON, AC3ENC_PARAM},
+{"channel_coupling", "Channel Coupling", OFFSET(channel_coupling), AV_OPT_TYPE_INT, {.i64 = AC3ENC_OPT_AUTO }, AC3ENC_OPT_AUTO, AC3ENC_OPT_ON, AC3ENC_PARAM, "channel_coupling"},
+ {"auto", "Selected by the Encoder", 0, AV_OPT_TYPE_CONST, {.i64 = AC3ENC_OPT_AUTO }, INT_MIN, INT_MAX, AC3ENC_PARAM, "channel_coupling"},
+{"cpl_start_band", "Coupling Start Band", OFFSET(cpl_start), AV_OPT_TYPE_INT, {.i64 = AC3ENC_OPT_AUTO }, AC3ENC_OPT_AUTO, 15, AC3ENC_PARAM, "cpl_start_band"},
+ {"auto", "Selected by the Encoder", 0, AV_OPT_TYPE_CONST, {.i64 = AC3ENC_OPT_AUTO }, INT_MIN, INT_MAX, AC3ENC_PARAM, "cpl_start_band"},
{NULL}
};
+
+static const AVCodecDefault ac3_defaults[] = {
+ { "b", "0" },
+ { NULL }
+};
diff --git a/gst-libs/ext/libav/libavcodec/ac3enc_template.c b/gst-libs/ext/libav/libavcodec/ac3enc_template.c
index 3396ed1..388d753 100644
--- a/gst-libs/ext/libav/libavcodec/ac3enc_template.c
+++ b/gst-libs/ext/libav/libavcodec/ac3enc_template.c
@@ -33,7 +33,7 @@
static void scale_coefficients(AC3EncodeContext *s);
-static void apply_window(DSPContext *dsp, SampleType *output,
+static void apply_window(void *dsp, SampleType *output,
const SampleType *input, const SampleType *window,
unsigned int len);
@@ -65,30 +65,23 @@ alloc_fail:
/*
- * Deinterleave input samples.
+ * Copy input samples.
* Channels are reordered from Libav's default order to AC-3 order.
*/
-static void deinterleave_input_samples(AC3EncodeContext *s,
- const SampleType *samples)
+static void copy_input_samples(AC3EncodeContext *s, SampleType **samples)
{
- int ch, i;
+ int ch;
- /* deinterleave and remap input samples */
+ /* copy and remap input samples */
for (ch = 0; ch < s->channels; ch++) {
- const SampleType *sptr;
- int sinc;
-
/* copy last 256 samples of previous frame to the start of the current frame */
memcpy(&s->planar_samples[ch][0], &s->planar_samples[ch][AC3_BLOCK_SIZE * s->num_blocks],
AC3_BLOCK_SIZE * sizeof(s->planar_samples[0][0]));
- /* deinterleave */
- sinc = s->channels;
- sptr = samples + s->channel_map[ch];
- for (i = AC3_BLOCK_SIZE; i < AC3_BLOCK_SIZE * (s->num_blocks + 1); i++) {
- s->planar_samples[ch][i] = *sptr;
- sptr += sinc;
- }
+ /* copy new samples for current frame */
+ memcpy(&s->planar_samples[ch][AC3_BLOCK_SIZE],
+ samples[s->channel_map[ch]],
+ AC3_BLOCK_SIZE * s->num_blocks * sizeof(s->planar_samples[0][0]));
}
}
@@ -107,8 +100,13 @@ static void apply_mdct(AC3EncodeContext *s)
AC3Block *block = &s->blocks[blk];
const SampleType *input_samples = &s->planar_samples[ch][blk * AC3_BLOCK_SIZE];
+#if CONFIG_AC3ENC_FLOAT
+ apply_window(&s->fdsp, s->windowed_samples, input_samples,
+ s->mdct_window, AC3_WINDOW_SIZE);
+#else
apply_window(&s->dsp, s->windowed_samples, input_samples,
s->mdct_window, AC3_WINDOW_SIZE);
+#endif
if (s->fixed_point)
block->coeff_shift[ch+1] = normalize_samples(s);
@@ -335,7 +333,7 @@ static void compute_rematrixing_strategy(AC3EncodeContext *s)
{
int nb_coefs;
int blk, bnd, i;
- AC3Block *block, *av_uninit(block0);
+ AC3Block *block, *block0;
if (s->channel_mode != AC3_CHMODE_STEREO)
return;
@@ -391,11 +389,10 @@ static void compute_rematrixing_strategy(AC3EncodeContext *s)
}
-int AC3_NAME(encode_frame)(AVCodecContext *avctx, unsigned char *frame,
- int buf_size, void *data)
+int AC3_NAME(encode_frame)(AVCodecContext *avctx, AVPacket *avpkt,
+ const AVFrame *frame, int *got_packet_ptr)
{
AC3EncodeContext *s = avctx->priv_data;
- const SampleType *samples = data;
int ret;
if (s->options.allow_per_frame_metadata) {
@@ -407,7 +404,7 @@ int AC3_NAME(encode_frame)(AVCodecContext *avctx, unsigned char *frame,
if (s->bit_alloc.sr_code == 1 || s->eac3)
ff_ac3_adjust_frame_size(s);
- deinterleave_input_samples(s, samples);
+ copy_input_samples(s, (SampleType **)frame->extended_data);
apply_mdct(s);
@@ -442,7 +439,15 @@ int AC3_NAME(encode_frame)(AVCodecContext *avctx, unsigned char *frame,
ff_ac3_quantize_mantissas(s);
- ff_ac3_output_frame(s, frame);
+ if ((ret = ff_alloc_packet(avpkt, s->frame_size))) {
+ av_log(avctx, AV_LOG_ERROR, "Error getting output packet\n");
+ return ret;
+ }
+ ff_ac3_output_frame(s, avpkt->data);
- return s->frame_size;
+ if (frame->pts != AV_NOPTS_VALUE)
+ avpkt->pts = frame->pts - ff_samples_to_time_base(avctx, avctx->delay);
+
+ *got_packet_ptr = 1;
+ return 0;
}
diff --git a/gst-libs/ext/libav/libavcodec/ac3tab.c b/gst-libs/ext/libav/libavcodec/ac3tab.c
index 951a101..ebcfb0b 100644
--- a/gst-libs/ext/libav/libavcodec/ac3tab.c
+++ b/gst-libs/ext/libav/libavcodec/ac3tab.c
@@ -24,7 +24,7 @@
* tables taken directly from the AC-3 spec.
*/
-#include "libavutil/audioconvert.h"
+#include "libavutil/channel_layout.h"
#include "avcodec.h"
#include "ac3tab.h"
diff --git a/gst-libs/ext/libav/libavcodec/ac3tab.h b/gst-libs/ext/libav/libavcodec/ac3tab.h
index 8ed5052..c2b3feb 100644
--- a/gst-libs/ext/libav/libavcodec/ac3tab.h
+++ b/gst-libs/ext/libav/libavcodec/ac3tab.h
@@ -33,7 +33,7 @@
extern const uint16_t ff_ac3_frame_size_tab[38][3];
extern const uint8_t ff_ac3_channels_tab[8];
-extern const uint16_t avpriv_ac3_channel_layout_tab[8];
+extern av_export const uint16_t avpriv_ac3_channel_layout_tab[8];
extern const uint8_t ff_ac3_enc_channel_map[8][2][6];
extern const uint8_t ff_ac3_dec_channel_map[8][2][6];
extern const uint16_t ff_ac3_sample_rate_tab[3];
diff --git a/gst-libs/ext/libav/libavcodec/acelp_filters.c b/gst-libs/ext/libav/libavcodec/acelp_filters.c
index 04f6d4a..93bec65 100644
--- a/gst-libs/ext/libav/libavcodec/acelp_filters.c
+++ b/gst-libs/ext/libav/libavcodec/acelp_filters.c
@@ -22,6 +22,7 @@
#include <inttypes.h>
+#include "libavutil/common.h"
#include "avcodec.h"
#include "acelp_filters.h"
@@ -142,4 +143,3 @@ void ff_tilt_compensation(float *mem, float tilt, float *samples, int size)
samples[0] -= tilt * *mem;
*mem = new_tilt_mem;
}
-
diff --git a/gst-libs/ext/libav/libavcodec/acelp_filters.h b/gst-libs/ext/libav/libavcodec/acelp_filters.h
index b8715d2..6a9ebd9 100644
--- a/gst-libs/ext/libav/libavcodec/acelp_filters.h
+++ b/gst-libs/ext/libav/libavcodec/acelp_filters.h
@@ -32,7 +32,7 @@
* the coefficients are scaled by 2^15.
* This array only contains the right half of the filter.
* This filter is likely identical to the one used in G.729, though this
- * could not be determined from the original comments with certainity.
+ * could not be determined from the original comments with certainty.
*/
extern const int16_t ff_acelp_interp_filter[61];
diff --git a/gst-libs/ext/libav/libavcodec/acelp_pitch_delay.c b/gst-libs/ext/libav/libavcodec/acelp_pitch_delay.c
index 395247d..a9668fa 100644
--- a/gst-libs/ext/libav/libavcodec/acelp_pitch_delay.c
+++ b/gst-libs/ext/libav/libavcodec/acelp_pitch_delay.c
@@ -20,6 +20,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "libavutil/common.h"
#include "libavutil/mathematics.h"
#include "avcodec.h"
#include "dsputil.h"
@@ -85,7 +86,7 @@ void ff_acelp_update_past_gain(
if(erasure)
quant_energy[0] = FFMAX(avg_gain >> log2_ma_pred_order, -10240) - 4096; // -10 and -4 in (5.10)
else
- quant_energy[0] = (6165 * ((ff_log2(gain_corr_factor) >> 2) - (13 << 13))) >> 13;
+ quant_energy[0] = (6165 * ((ff_log2_q15(gain_corr_factor) >> 2) - (13 << 13))) >> 13;
}
int16_t ff_acelp_decode_gain_code(
@@ -106,7 +107,7 @@ int16_t ff_acelp_decode_gain_code(
mr_energy += quant_energy[i] * ma_prediction_coeff[i];
mr_energy = gain_corr_factor * exp(M_LN10 / (20 << 23) * mr_energy) /
- sqrt(dsp->scalarproduct_int16(fc_v, fc_v, subframe_size, 0));
+ sqrt(dsp->scalarproduct_int16(fc_v, fc_v, subframe_size));
return mr_energy >> 12;
}
@@ -119,7 +120,7 @@ float ff_amr_set_fixed_gain(float fixed_gain_factor, float fixed_mean_energy,
// Note 10^(0.05 * -10log(average x2)) = 1/sqrt((average x2)).
float val = fixed_gain_factor *
exp2f(M_LOG2_10 * 0.05 *
- (ff_dot_productf(pred_table, prediction_error, 4) +
+ (ff_scalarproduct_float_c(pred_table, prediction_error, 4) +
energy_mean)) /
sqrtf(fixed_mean_energy);
diff --git a/gst-libs/ext/libav/libavcodec/acelp_vectors.c b/gst-libs/ext/libav/libavcodec/acelp_vectors.c
index b7c05e7..b50c5f3 100644
--- a/gst-libs/ext/libav/libavcodec/acelp_vectors.c
+++ b/gst-libs/ext/libav/libavcodec/acelp_vectors.c
@@ -21,9 +21,11 @@
*/
#include <inttypes.h>
+
+#include "libavutil/common.h"
#include "avcodec.h"
+#include "dsputil.h"
#include "acelp_vectors.h"
-#include "celp_math.h"
const uint8_t ff_fc_2pulses_9bits_track1[16] =
{
@@ -181,7 +183,7 @@ void ff_adaptive_gain_control(float *out, const float *in, float speech_energ,
int size, float alpha, float *gain_mem)
{
int i;
- float postfilter_energ = ff_dot_productf(in, in, size);
+ float postfilter_energ = ff_scalarproduct_float_c(in, in, size);
float gain_scale_factor = 1.0;
float mem = *gain_mem;
@@ -202,7 +204,7 @@ void ff_scale_vector_to_given_sum_of_squares(float *out, const float *in,
float sum_of_squares, const int n)
{
int i;
- float scalefactor = ff_dot_productf(in, in, n);
+ float scalefactor = ff_scalarproduct_float_c(in, in, n);
if (scalefactor)
scalefactor = sqrt(sum_of_squares / scalefactor);
for (i = 0; i < n; i++)
diff --git a/gst-libs/ext/libav/libavcodec/acelp_vectors.h b/gst-libs/ext/libav/libavcodec/acelp_vectors.h
index 2c5d319..d6226bf 100644
--- a/gst-libs/ext/libav/libavcodec/acelp_vectors.h
+++ b/gst-libs/ext/libav/libavcodec/acelp_vectors.h
@@ -26,7 +26,7 @@
#include <stdint.h>
/** Sparse representation for the algebraic codebook (fixed) vector */
-typedef struct {
+typedef struct AMRFixed {
int n;
int x[10];
float y[10];
diff --git a/gst-libs/ext/libav/libavcodec/adpcm.c b/gst-libs/ext/libav/libavcodec/adpcm.c
index a294732..3b0eb8b 100644
--- a/gst-libs/ext/libav/libavcodec/adpcm.c
+++ b/gst-libs/ext/libav/libavcodec/adpcm.c
@@ -23,6 +23,7 @@
#include "bytestream.h"
#include "adpcm.h"
#include "adpcm_data.h"
+#include "internal.h"
/**
* @file
@@ -86,6 +87,7 @@ static const int swf_index_tables[4][16] = {
typedef struct ADPCMDecodeContext {
AVFrame frame;
ADPCMChannelStatus status[6];
+ int vqa_version; /**< VQA version. Used for ADPCM_IMA_WS */
} ADPCMDecodeContext;
static av_cold int adpcm_decode_init(AVCodecContext * avctx)
@@ -95,13 +97,13 @@ static av_cold int adpcm_decode_init(AVCodecContext * avctx)
unsigned int max_channels = 2;
switch(avctx->codec->id) {
- case CODEC_ID_ADPCM_EA:
+ case AV_CODEC_ID_ADPCM_EA:
min_channels = 2;
break;
- case CODEC_ID_ADPCM_EA_R1:
- case CODEC_ID_ADPCM_EA_R2:
- case CODEC_ID_ADPCM_EA_R3:
- case CODEC_ID_ADPCM_EA_XAS:
+ case AV_CODEC_ID_ADPCM_EA_R1:
+ case AV_CODEC_ID_ADPCM_EA_R2:
+ case AV_CODEC_ID_ADPCM_EA_R3:
+ case AV_CODEC_ID_ADPCM_EA_XAS:
max_channels = 6;
break;
}
@@ -111,25 +113,48 @@ static av_cold int adpcm_decode_init(AVCodecContext * avctx)
}
switch(avctx->codec->id) {
- case CODEC_ID_ADPCM_CT:
+ case AV_CODEC_ID_ADPCM_CT:
c->status[0].step = c->status[1].step = 511;
break;
- case CODEC_ID_ADPCM_IMA_WAV:
+ case AV_CODEC_ID_ADPCM_IMA_WAV:
if (avctx->bits_per_coded_sample != 4) {
av_log(avctx, AV_LOG_ERROR, "Only 4-bit ADPCM IMA WAV files are supported\n");
return -1;
}
break;
- case CODEC_ID_ADPCM_IMA_WS:
- if (avctx->extradata && avctx->extradata_size == 2 * 4) {
+ case AV_CODEC_ID_ADPCM_IMA_APC:
+ if (avctx->extradata && avctx->extradata_size >= 8) {
c->status[0].predictor = AV_RL32(avctx->extradata);
c->status[1].predictor = AV_RL32(avctx->extradata + 4);
}
break;
+ case AV_CODEC_ID_ADPCM_IMA_WS:
+ if (avctx->extradata && avctx->extradata_size >= 2)
+ c->vqa_version = AV_RL16(avctx->extradata);
+ break;
default:
break;
}
- avctx->sample_fmt = AV_SAMPLE_FMT_S16;
+
+ switch(avctx->codec->id) {
+ case AV_CODEC_ID_ADPCM_IMA_QT:
+ case AV_CODEC_ID_ADPCM_IMA_WAV:
+ case AV_CODEC_ID_ADPCM_4XM:
+ case AV_CODEC_ID_ADPCM_XA:
+ case AV_CODEC_ID_ADPCM_EA_R1:
+ case AV_CODEC_ID_ADPCM_EA_R2:
+ case AV_CODEC_ID_ADPCM_EA_R3:
+ case AV_CODEC_ID_ADPCM_EA_XAS:
+ case AV_CODEC_ID_ADPCM_THP:
+ avctx->sample_fmt = AV_SAMPLE_FMT_S16P;
+ break;
+ case AV_CODEC_ID_ADPCM_IMA_WS:
+ avctx->sample_fmt = c->vqa_version == 3 ? AV_SAMPLE_FMT_S16P :
+ AV_SAMPLE_FMT_S16;
+ break;
+ default:
+ avctx->sample_fmt = AV_SAMPLE_FMT_S16;
+ }
avcodec_get_frame_defaults(&c->frame);
avctx->coded_frame = &c->frame;
@@ -145,8 +170,7 @@ static inline short adpcm_ima_expand_nibble(ADPCMChannelStatus *c, char nibble,
step = ff_adpcm_step_table[c->step_index];
step_index = c->step_index + ff_adpcm_index_table[(unsigned)nibble];
- if (step_index < 0) step_index = 0;
- else if (step_index > 88) step_index = 88;
+ step_index = av_clip(step_index, 0, 88);
sign = nibble & 8;
delta = nibble & 7;
@@ -190,12 +214,12 @@ static inline int adpcm_ima_qt_expand_nibble(ADPCMChannelStatus *c, int nibble,
return c->predictor;
}
-static inline short adpcm_ms_expand_nibble(ADPCMChannelStatus *c, char nibble)
+static inline short adpcm_ms_expand_nibble(ADPCMChannelStatus *c, int nibble)
{
int predictor;
predictor = (((c->sample1) * (c->coeff1)) + ((c->sample2) * (c->coeff2))) / 64;
- predictor += (signed)((nibble & 0x08)?(nibble - 0x10):(nibble)) * c->idelta;
+ predictor += ((nibble & 0x08)?(nibble - 0x10):(nibble)) * c->idelta;
c->sample2 = c->sample1;
c->sample1 = av_clip_int16(predictor);
@@ -260,17 +284,22 @@ static inline short adpcm_yamaha_expand_nibble(ADPCMChannelStatus *c, unsigned c
return c->predictor;
}
-static int xa_decode(AVCodecContext *avctx,
- short *out, const unsigned char *in,
- ADPCMChannelStatus *left, ADPCMChannelStatus *right, int inc)
+static int xa_decode(AVCodecContext *avctx, int16_t *out0, int16_t *out1,
+ const uint8_t *in, ADPCMChannelStatus *left,
+ ADPCMChannelStatus *right, int channels, int sample_offset)
{
int i, j;
int shift,filter,f0,f1;
int s_1,s_2;
int d,s,t;
- for(i=0;i<4;i++) {
+ out0 += sample_offset;
+ if (channels == 1)
+ out1 = out0 + 28;
+ else
+ out1 += sample_offset;
+ for(i=0;i<4;i++) {
shift = 12 - (in[4+i*2] & 15);
filter = in[4+i*2] >> 4;
if (filter > 4) {
@@ -288,20 +317,18 @@ static int xa_decode(AVCodecContext *avctx,
for(j=0;j<28;j++) {
d = in[16+i+j*4];
- t = (signed char)(d<<4)>>4;
+ t = sign_extend(d, 4);
s = ( t<<shift ) + ((s_1*f0 + s_2*f1+32)>>6);
s_2 = s_1;
s_1 = av_clip_int16(s);
- *out = s_1;
- out += inc;
+ out0[j] = s_1;
}
- if (inc==2) { /* stereo */
+ if (channels == 2) {
left->sample1 = s_1;
left->sample2 = s_2;
s_1 = right->sample1;
s_2 = right->sample2;
- out = out + 1 - 28*2;
}
shift = 12 - (in[5+i*2] & 15);
@@ -318,27 +345,85 @@ static int xa_decode(AVCodecContext *avctx,
for(j=0;j<28;j++) {
d = in[16+i+j*4];
- t = (signed char)d >> 4;
+ t = sign_extend(d >> 4, 4);
s = ( t<<shift ) + ((s_1*f0 + s_2*f1+32)>>6);
s_2 = s_1;
s_1 = av_clip_int16(s);
- *out = s_1;
- out += inc;
+ out1[j] = s_1;
}
- if (inc==2) { /* stereo */
+ if (channels == 2) {
right->sample1 = s_1;
right->sample2 = s_2;
- out -= 1;
} else {
left->sample1 = s_1;
left->sample2 = s_2;
}
+
+ out0 += 28 * (3 - channels);
+ out1 += 28 * (3 - channels);
}
return 0;
}
+static void adpcm_swf_decode(AVCodecContext *avctx, const uint8_t *buf, int buf_size, int16_t *samples)
+{
+ ADPCMDecodeContext *c = avctx->priv_data;
+ GetBitContext gb;
+ const int *table;
+ int k0, signmask, nb_bits, count;
+ int size = buf_size*8;
+ int i;
+
+ init_get_bits(&gb, buf, size);
+
+ //read bits & initial values
+ nb_bits = get_bits(&gb, 2)+2;
+ table = swf_index_tables[nb_bits-2];
+ k0 = 1 << (nb_bits-2);
+ signmask = 1 << (nb_bits-1);
+
+ while (get_bits_count(&gb) <= size - 22*avctx->channels) {
+ for (i = 0; i < avctx->channels; i++) {
+ *samples++ = c->status[i].predictor = get_sbits(&gb, 16);
+ c->status[i].step_index = get_bits(&gb, 6);
+ }
+
+ for (count = 0; get_bits_count(&gb) <= size - nb_bits*avctx->channels && count < 4095; count++) {
+ int i;
+
+ for (i = 0; i < avctx->channels; i++) {
+ // similar to IMA adpcm
+ int delta = get_bits(&gb, nb_bits);
+ int step = ff_adpcm_step_table[c->status[i].step_index];
+ long vpdiff = 0; // vpdiff = (delta+0.5)*step/4
+ int k = k0;
+
+ do {
+ if (delta & k)
+ vpdiff += step;
+ step >>= 1;
+ k >>= 1;
+ } while(k);
+ vpdiff += step;
+
+ if (delta & signmask)
+ c->status[i].predictor -= vpdiff;
+ else
+ c->status[i].predictor += vpdiff;
+
+ c->status[i].step_index += table[delta & (~signmask)];
+
+ c->status[i].step_index = av_clip(c->status[i].step_index, 0, 88);
+ c->status[i].predictor = av_clip_int16(c->status[i].predictor);
+
+ *samples++ = c->status[i].predictor;
+ }
+ }
+ }
+}
+
/**
* Get the number of samples that will be decoded from the packet.
* In one case, this is actually the maximum number of samples possible to
@@ -348,7 +433,7 @@ static int xa_decode(AVCodecContext *avctx,
* packet, or 0 if the codec does not encode the
* number of samples in each frame.
*/
-static int get_nb_samples(AVCodecContext *avctx, const uint8_t *buf,
+static int get_nb_samples(AVCodecContext *avctx, GetByteContext *gb,
int buf_size, int *coded_samples)
{
ADPCMDecodeContext *s = avctx->priv_data;
@@ -361,21 +446,22 @@ static int get_nb_samples(AVCodecContext *avctx, const uint8_t *buf,
switch (avctx->codec->id) {
/* constant, only check buf_size */
- case CODEC_ID_ADPCM_EA_XAS:
+ case AV_CODEC_ID_ADPCM_EA_XAS:
if (buf_size < 76 * ch)
return 0;
nb_samples = 128;
break;
- case CODEC_ID_ADPCM_IMA_QT:
+ case AV_CODEC_ID_ADPCM_IMA_QT:
if (buf_size < 34 * ch)
return 0;
nb_samples = 64;
break;
/* simple 4-bit adpcm */
- case CODEC_ID_ADPCM_CT:
- case CODEC_ID_ADPCM_IMA_EA_SEAD:
- case CODEC_ID_ADPCM_IMA_WS:
- case CODEC_ID_ADPCM_YAMAHA:
+ case AV_CODEC_ID_ADPCM_CT:
+ case AV_CODEC_ID_ADPCM_IMA_APC:
+ case AV_CODEC_ID_ADPCM_IMA_EA_SEAD:
+ case AV_CODEC_ID_ADPCM_IMA_WS:
+ case AV_CODEC_ID_ADPCM_YAMAHA:
nb_samples = buf_size * 2 / ch;
break;
}
@@ -385,87 +471,83 @@ static int get_nb_samples(AVCodecContext *avctx, const uint8_t *buf,
/* simple 4-bit adpcm, with header */
header_size = 0;
switch (avctx->codec->id) {
- case CODEC_ID_ADPCM_4XM:
- case CODEC_ID_ADPCM_IMA_ISS: header_size = 4 * ch; break;
- case CODEC_ID_ADPCM_IMA_AMV: header_size = 8; break;
- case CODEC_ID_ADPCM_IMA_SMJPEG: header_size = 4; break;
+ case AV_CODEC_ID_ADPCM_4XM:
+ case AV_CODEC_ID_ADPCM_IMA_ISS: header_size = 4 * ch; break;
+ case AV_CODEC_ID_ADPCM_IMA_AMV: header_size = 8; break;
+ case AV_CODEC_ID_ADPCM_IMA_SMJPEG: header_size = 4; break;
}
if (header_size > 0)
return (buf_size - header_size) * 2 / ch;
/* more complex formats */
switch (avctx->codec->id) {
- case CODEC_ID_ADPCM_EA:
+ case AV_CODEC_ID_ADPCM_EA:
has_coded_samples = 1;
- if (buf_size < 4)
- return 0;
- *coded_samples = AV_RL32(buf);
+ *coded_samples = bytestream2_get_le32(gb);
*coded_samples -= *coded_samples % 28;
nb_samples = (buf_size - 12) / 30 * 28;
break;
- case CODEC_ID_ADPCM_IMA_EA_EACS:
+ case AV_CODEC_ID_ADPCM_IMA_EA_EACS:
has_coded_samples = 1;
- if (buf_size < 4)
- return 0;
- *coded_samples = AV_RL32(buf);
+ *coded_samples = bytestream2_get_le32(gb);
nb_samples = (buf_size - (4 + 8 * ch)) * 2 / ch;
break;
- case CODEC_ID_ADPCM_EA_MAXIS_XA:
- nb_samples = ((buf_size - ch) / (2 * ch)) * 2 * ch;
+ case AV_CODEC_ID_ADPCM_EA_MAXIS_XA:
+ nb_samples = (buf_size - ch) / ch * 2;
break;
- case CODEC_ID_ADPCM_EA_R1:
- case CODEC_ID_ADPCM_EA_R2:
- case CODEC_ID_ADPCM_EA_R3:
+ case AV_CODEC_ID_ADPCM_EA_R1:
+ case AV_CODEC_ID_ADPCM_EA_R2:
+ case AV_CODEC_ID_ADPCM_EA_R3:
/* maximum number of samples */
/* has internal offsets and a per-frame switch to signal raw 16-bit */
has_coded_samples = 1;
- if (buf_size < 4)
- return 0;
switch (avctx->codec->id) {
- case CODEC_ID_ADPCM_EA_R1:
+ case AV_CODEC_ID_ADPCM_EA_R1:
header_size = 4 + 9 * ch;
- *coded_samples = AV_RL32(buf);
+ *coded_samples = bytestream2_get_le32(gb);
break;
- case CODEC_ID_ADPCM_EA_R2:
+ case AV_CODEC_ID_ADPCM_EA_R2:
header_size = 4 + 5 * ch;
- *coded_samples = AV_RL32(buf);
+ *coded_samples = bytestream2_get_le32(gb);
break;
- case CODEC_ID_ADPCM_EA_R3:
+ case AV_CODEC_ID_ADPCM_EA_R3:
header_size = 4 + 5 * ch;
- *coded_samples = AV_RB32(buf);
+ *coded_samples = bytestream2_get_be32(gb);
break;
}
*coded_samples -= *coded_samples % 28;
nb_samples = (buf_size - header_size) * 2 / ch;
nb_samples -= nb_samples % 28;
break;
- case CODEC_ID_ADPCM_IMA_DK3:
+ case AV_CODEC_ID_ADPCM_IMA_DK3:
if (avctx->block_align > 0)
buf_size = FFMIN(buf_size, avctx->block_align);
- nb_samples = ((buf_size - 16) * 8 / 3) / ch;
+ nb_samples = ((buf_size - 16) * 2 / 3 * 4) / ch;
break;
- case CODEC_ID_ADPCM_IMA_DK4:
+ case AV_CODEC_ID_ADPCM_IMA_DK4:
+ if (avctx->block_align > 0)
+ buf_size = FFMIN(buf_size, avctx->block_align);
nb_samples = 1 + (buf_size - 4 * ch) * 2 / ch;
break;
- case CODEC_ID_ADPCM_IMA_WAV:
+ case AV_CODEC_ID_ADPCM_IMA_WAV:
if (avctx->block_align > 0)
buf_size = FFMIN(buf_size, avctx->block_align);
nb_samples = 1 + (buf_size - 4 * ch) / (4 * ch) * 8;
break;
- case CODEC_ID_ADPCM_MS:
+ case AV_CODEC_ID_ADPCM_MS:
if (avctx->block_align > 0)
buf_size = FFMIN(buf_size, avctx->block_align);
nb_samples = 2 + (buf_size - 7 * ch) * 2 / ch;
break;
- case CODEC_ID_ADPCM_SBPRO_2:
- case CODEC_ID_ADPCM_SBPRO_3:
- case CODEC_ID_ADPCM_SBPRO_4:
+ case AV_CODEC_ID_ADPCM_SBPRO_2:
+ case AV_CODEC_ID_ADPCM_SBPRO_3:
+ case AV_CODEC_ID_ADPCM_SBPRO_4:
{
int samples_per_byte;
switch (avctx->codec->id) {
- case CODEC_ID_ADPCM_SBPRO_2: samples_per_byte = 4; break;
- case CODEC_ID_ADPCM_SBPRO_3: samples_per_byte = 3; break;
- case CODEC_ID_ADPCM_SBPRO_4: samples_per_byte = 2; break;
+ case AV_CODEC_ID_ADPCM_SBPRO_2: samples_per_byte = 4; break;
+ case AV_CODEC_ID_ADPCM_SBPRO_3: samples_per_byte = 3; break;
+ case AV_CODEC_ID_ADPCM_SBPRO_4: samples_per_byte = 2; break;
}
if (!s->status[0].step_index) {
nb_samples++;
@@ -474,10 +556,10 @@ static int get_nb_samples(AVCodecContext *avctx, const uint8_t *buf,
nb_samples += buf_size * samples_per_byte / ch;
break;
}
- case CODEC_ID_ADPCM_SWF:
+ case AV_CODEC_ID_ADPCM_SWF:
{
int buf_bits = buf_size * 8 - 2;
- int nbits = (buf[0] >> 6) + 2;
+ int nbits = (bytestream2_get_byte(gb) >> 6) + 2;
int block_hdr_size = 22 * ch;
int block_size = block_hdr_size + nbits * ch * 4095;
int nblocks = buf_bits / block_size;
@@ -487,15 +569,14 @@ static int get_nb_samples(AVCodecContext *avctx, const uint8_t *buf,
nb_samples += 1 + (bits_left - block_hdr_size) / (nbits * ch);
break;
}
- case CODEC_ID_ADPCM_THP:
+ case AV_CODEC_ID_ADPCM_THP:
has_coded_samples = 1;
- if (buf_size < 8)
- return 0;
- *coded_samples = AV_RB32(&buf[4]);
+ bytestream2_skip(gb, 4); // channel size
+ *coded_samples = bytestream2_get_be32(gb);
*coded_samples -= *coded_samples % 14;
nb_samples = (buf_size - 80) / (8 * ch) * 14;
break;
- case CODEC_ID_ADPCM_XA:
+ case AV_CODEC_ID_ADPCM_XA:
nb_samples = (buf_size / 128) * 224 / ch;
break;
}
@@ -507,24 +588,6 @@ static int get_nb_samples(AVCodecContext *avctx, const uint8_t *buf,
return nb_samples;
}
-/* DK3 ADPCM support macro */
-#define DK3_GET_NEXT_NIBBLE() \
- if (decode_top_nibble_next) \
- { \
- nibble = last_byte >> 4; \
- decode_top_nibble_next = 0; \
- } \
- else \
- { \
- if (end_of_packet) \
- break; \
- last_byte = *src++; \
- if (src >= buf + buf_size) \
- end_of_packet = 1; \
- nibble = last_byte & 0x0F; \
- decode_top_nibble_next = 1; \
- }
-
static int adpcm_decode_frame(AVCodecContext *avctx, void *data,
int *got_frame_ptr, AVPacket *avpkt)
{
@@ -534,12 +597,14 @@ static int adpcm_decode_frame(AVCodecContext *avctx, void *data,
ADPCMChannelStatus *cs;
int n, m, channel, i;
short *samples;
- const uint8_t *src;
+ int16_t **samples_p;
int st; /* stereo */
int count1, count2;
int nb_samples, coded_samples, ret;
+ GetByteContext gb;
- nb_samples = get_nb_samples(avctx, buf, buf_size, &coded_samples);
+ bytestream2_init(&gb, buf, buf_size);
+ nb_samples = get_nb_samples(avctx, &gb, buf_size, &coded_samples);
if (nb_samples <= 0) {
av_log(avctx, AV_LOG_ERROR, "invalid number of samples in packet\n");
return AVERROR_INVALIDDATA;
@@ -547,11 +612,12 @@ static int adpcm_decode_frame(AVCodecContext *avctx, void *data,
/* get output buffer */
c->frame.nb_samples = nb_samples;
- if ((ret = avctx->get_buffer(avctx, &c->frame)) < 0) {
+ if ((ret = ff_get_buffer(avctx, &c->frame)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return ret;
}
samples = (short *)c->frame.data[0];
+ samples_p = (int16_t **)c->frame.extended_data;
/* use coded_samples when applicable */
/* it is always <= nb_samples, so the output buffer will be large enough */
@@ -561,29 +627,25 @@ static int adpcm_decode_frame(AVCodecContext *avctx, void *data,
c->frame.nb_samples = nb_samples = coded_samples;
}
- src = buf;
-
st = avctx->channels == 2 ? 1 : 0;
switch(avctx->codec->id) {
- case CODEC_ID_ADPCM_IMA_QT:
+ case AV_CODEC_ID_ADPCM_IMA_QT:
/* In QuickTime, IMA is encoded by chunks of 34 bytes (=64 samples).
Channel data is interleaved per-chunk. */
for (channel = 0; channel < avctx->channels; channel++) {
- int16_t predictor;
+ int predictor;
int step_index;
cs = &(c->status[channel]);
/* (pppppp) (piiiiiii) */
/* Bits 15-7 are the _top_ 9 bits of the 16-bit initial predictor value */
- predictor = AV_RB16(src);
+ predictor = sign_extend(bytestream2_get_be16u(&gb), 16);
step_index = predictor & 0x7F;
- predictor &= 0xFF80;
-
- src += 2;
+ predictor &= ~0x7F;
if (cs->step_index == step_index) {
- int diff = (int)predictor - cs->predictor;
+ int diff = predictor - cs->predictor;
if (diff < 0)
diff = - diff;
if (diff > 0x7f)
@@ -594,148 +656,162 @@ static int adpcm_decode_frame(AVCodecContext *avctx, void *data,
cs->predictor = predictor;
}
- if (cs->step_index > 88){
- av_log(avctx, AV_LOG_ERROR, "ERROR: step_index = %i\n", cs->step_index);
- cs->step_index = 88;
+ if (cs->step_index > 88u){
+ av_log(avctx, AV_LOG_ERROR, "ERROR: step_index[%d] = %i\n",
+ channel, cs->step_index);
+ return AVERROR_INVALIDDATA;
}
- samples = (short *)c->frame.data[0] + channel;
+ samples = samples_p[channel];
- for (m = 0; m < 32; m++) {
- *samples = adpcm_ima_qt_expand_nibble(cs, src[0] & 0x0F, 3);
- samples += avctx->channels;
- *samples = adpcm_ima_qt_expand_nibble(cs, src[0] >> 4 , 3);
- samples += avctx->channels;
- src ++;
+ for (m = 0; m < 64; m += 2) {
+ int byte = bytestream2_get_byteu(&gb);
+ samples[m ] = adpcm_ima_qt_expand_nibble(cs, byte & 0x0F, 3);
+ samples[m + 1] = adpcm_ima_qt_expand_nibble(cs, byte >> 4 , 3);
}
}
break;
- case CODEC_ID_ADPCM_IMA_WAV:
- if (avctx->block_align != 0 && buf_size > avctx->block_align)
- buf_size = avctx->block_align;
-
+ case AV_CODEC_ID_ADPCM_IMA_WAV:
for(i=0; i<avctx->channels; i++){
cs = &(c->status[i]);
- cs->predictor = *samples++ = (int16_t)bytestream_get_le16(&src);
+ cs->predictor = samples_p[i][0] = sign_extend(bytestream2_get_le16u(&gb), 16);
- cs->step_index = *src++;
- if (cs->step_index > 88){
- av_log(avctx, AV_LOG_ERROR, "ERROR: step_index = %i\n", cs->step_index);
- cs->step_index = 88;
+ cs->step_index = sign_extend(bytestream2_get_le16u(&gb), 16);
+ if (cs->step_index > 88u){
+ av_log(avctx, AV_LOG_ERROR, "ERROR: step_index[%d] = %i\n",
+ i, cs->step_index);
+ return AVERROR_INVALIDDATA;
}
- if (*src++) av_log(avctx, AV_LOG_ERROR, "unused byte should be null but is %d!!\n", src[-1]); /* unused */
}
- for (n = (nb_samples - 1) / 8; n > 0; n--) {
+ for (n = 0; n < (nb_samples - 1) / 8; n++) {
for (i = 0; i < avctx->channels; i++) {
cs = &c->status[i];
- for (m = 0; m < 4; m++) {
- uint8_t v = *src++;
- *samples = adpcm_ima_expand_nibble(cs, v & 0x0F, 3);
- samples += avctx->channels;
- *samples = adpcm_ima_expand_nibble(cs, v >> 4 , 3);
- samples += avctx->channels;
+ samples = &samples_p[i][1 + n * 8];
+ for (m = 0; m < 8; m += 2) {
+ int v = bytestream2_get_byteu(&gb);
+ samples[m ] = adpcm_ima_expand_nibble(cs, v & 0x0F, 3);
+ samples[m + 1] = adpcm_ima_expand_nibble(cs, v >> 4 , 3);
}
- samples -= 8 * avctx->channels - 1;
}
- samples += 7 * avctx->channels;
}
break;
- case CODEC_ID_ADPCM_4XM:
+ case AV_CODEC_ID_ADPCM_4XM:
for (i = 0; i < avctx->channels; i++)
- c->status[i].predictor= (int16_t)bytestream_get_le16(&src);
+ c->status[i].predictor = sign_extend(bytestream2_get_le16u(&gb), 16);
for (i = 0; i < avctx->channels; i++) {
- c->status[i].step_index= (int16_t)bytestream_get_le16(&src);
- c->status[i].step_index = av_clip(c->status[i].step_index, 0, 88);
+ c->status[i].step_index = sign_extend(bytestream2_get_le16u(&gb), 16);
+ if (c->status[i].step_index > 88u) {
+ av_log(avctx, AV_LOG_ERROR, "ERROR: step_index[%d] = %i\n",
+ i, c->status[i].step_index);
+ return AVERROR_INVALIDDATA;
+ }
}
for (i = 0; i < avctx->channels; i++) {
- samples = (short *)c->frame.data[0] + i;
+ samples = (int16_t *)c->frame.data[i];
cs = &c->status[i];
- for (n = nb_samples >> 1; n > 0; n--, src++) {
- uint8_t v = *src;
- *samples = adpcm_ima_expand_nibble(cs, v & 0x0F, 4);
- samples += avctx->channels;
- *samples = adpcm_ima_expand_nibble(cs, v >> 4 , 4);
- samples += avctx->channels;
+ for (n = nb_samples >> 1; n > 0; n--) {
+ int v = bytestream2_get_byteu(&gb);
+ *samples++ = adpcm_ima_expand_nibble(cs, v & 0x0F, 4);
+ *samples++ = adpcm_ima_expand_nibble(cs, v >> 4 , 4);
}
}
break;
- case CODEC_ID_ADPCM_MS:
+ case AV_CODEC_ID_ADPCM_MS:
{
int block_predictor;
- if (avctx->block_align != 0 && buf_size > avctx->block_align)
- buf_size = avctx->block_align;
-
- block_predictor = av_clip(*src++, 0, 6);
+ block_predictor = bytestream2_get_byteu(&gb);
+ if (block_predictor > 6) {
+ av_log(avctx, AV_LOG_ERROR, "ERROR: block_predictor[0] = %d\n",
+ block_predictor);
+ return AVERROR_INVALIDDATA;
+ }
c->status[0].coeff1 = ff_adpcm_AdaptCoeff1[block_predictor];
c->status[0].coeff2 = ff_adpcm_AdaptCoeff2[block_predictor];
if (st) {
- block_predictor = av_clip(*src++, 0, 6);
+ block_predictor = bytestream2_get_byteu(&gb);
+ if (block_predictor > 6) {
+ av_log(avctx, AV_LOG_ERROR, "ERROR: block_predictor[1] = %d\n",
+ block_predictor);
+ return AVERROR_INVALIDDATA;
+ }
c->status[1].coeff1 = ff_adpcm_AdaptCoeff1[block_predictor];
c->status[1].coeff2 = ff_adpcm_AdaptCoeff2[block_predictor];
}
- c->status[0].idelta = (int16_t)bytestream_get_le16(&src);
+ c->status[0].idelta = sign_extend(bytestream2_get_le16u(&gb), 16);
if (st){
- c->status[1].idelta = (int16_t)bytestream_get_le16(&src);
+ c->status[1].idelta = sign_extend(bytestream2_get_le16u(&gb), 16);
}
- c->status[0].sample1 = bytestream_get_le16(&src);
- if (st) c->status[1].sample1 = bytestream_get_le16(&src);
- c->status[0].sample2 = bytestream_get_le16(&src);
- if (st) c->status[1].sample2 = bytestream_get_le16(&src);
+ c->status[0].sample1 = sign_extend(bytestream2_get_le16u(&gb), 16);
+ if (st) c->status[1].sample1 = sign_extend(bytestream2_get_le16u(&gb), 16);
+ c->status[0].sample2 = sign_extend(bytestream2_get_le16u(&gb), 16);
+ if (st) c->status[1].sample2 = sign_extend(bytestream2_get_le16u(&gb), 16);
*samples++ = c->status[0].sample2;
if (st) *samples++ = c->status[1].sample2;
*samples++ = c->status[0].sample1;
if (st) *samples++ = c->status[1].sample1;
- for(n = (nb_samples - 2) >> (1 - st); n > 0; n--, src++) {
- *samples++ = adpcm_ms_expand_nibble(&c->status[0 ], src[0] >> 4 );
- *samples++ = adpcm_ms_expand_nibble(&c->status[st], src[0] & 0x0F);
+ for(n = (nb_samples - 2) >> (1 - st); n > 0; n--) {
+ int byte = bytestream2_get_byteu(&gb);
+ *samples++ = adpcm_ms_expand_nibble(&c->status[0 ], byte >> 4 );
+ *samples++ = adpcm_ms_expand_nibble(&c->status[st], byte & 0x0F);
}
break;
}
- case CODEC_ID_ADPCM_IMA_DK4:
- if (avctx->block_align != 0 && buf_size > avctx->block_align)
- buf_size = avctx->block_align;
-
+ case AV_CODEC_ID_ADPCM_IMA_DK4:
for (channel = 0; channel < avctx->channels; channel++) {
cs = &c->status[channel];
- cs->predictor = (int16_t)bytestream_get_le16(&src);
- cs->step_index = av_clip(*src++, 0, 88);
- src++;
- *samples++ = cs->predictor;
+ cs->predictor = *samples++ = sign_extend(bytestream2_get_le16u(&gb), 16);
+ cs->step_index = sign_extend(bytestream2_get_le16u(&gb), 16);
+ if (cs->step_index > 88u){
+ av_log(avctx, AV_LOG_ERROR, "ERROR: step_index[%d] = %i\n",
+ channel, cs->step_index);
+ return AVERROR_INVALIDDATA;
+ }
}
- for (n = nb_samples >> (1 - st); n > 0; n--, src++) {
- uint8_t v = *src;
+ for (n = nb_samples >> (1 - st); n > 0; n--) {
+ int v = bytestream2_get_byteu(&gb);
*samples++ = adpcm_ima_expand_nibble(&c->status[0 ], v >> 4 , 3);
*samples++ = adpcm_ima_expand_nibble(&c->status[st], v & 0x0F, 3);
}
break;
- case CODEC_ID_ADPCM_IMA_DK3:
+ case AV_CODEC_ID_ADPCM_IMA_DK3:
{
- unsigned char last_byte = 0;
- unsigned char nibble;
+ int last_byte = 0;
+ int nibble;
int decode_top_nibble_next = 0;
- int end_of_packet = 0;
int diff_channel;
-
- if (avctx->block_align != 0 && buf_size > avctx->block_align)
- buf_size = avctx->block_align;
-
- c->status[0].predictor = (int16_t)AV_RL16(src + 10);
- c->status[1].predictor = (int16_t)AV_RL16(src + 12);
- c->status[0].step_index = av_clip(src[14], 0, 88);
- c->status[1].step_index = av_clip(src[15], 0, 88);
+ const int16_t *samples_end = samples + avctx->channels * nb_samples;
+
+ bytestream2_skipu(&gb, 10);
+ c->status[0].predictor = sign_extend(bytestream2_get_le16u(&gb), 16);
+ c->status[1].predictor = sign_extend(bytestream2_get_le16u(&gb), 16);
+ c->status[0].step_index = bytestream2_get_byteu(&gb);
+ c->status[1].step_index = bytestream2_get_byteu(&gb);
+ if (c->status[0].step_index > 88u || c->status[1].step_index > 88u){
+ av_log(avctx, AV_LOG_ERROR, "ERROR: step_index = %i/%i\n",
+ c->status[0].step_index, c->status[1].step_index);
+ return AVERROR_INVALIDDATA;
+ }
/* sign extend the predictors */
- src += 16;
diff_channel = c->status[1].predictor;
- /* the DK3_GET_NEXT_NIBBLE macro issues the break statement when
- * the buffer is consumed */
- while (1) {
+ /* DK3 ADPCM support macro */
+#define DK3_GET_NEXT_NIBBLE() \
+ if (decode_top_nibble_next) { \
+ nibble = last_byte >> 4; \
+ decode_top_nibble_next = 0; \
+ } else { \
+ last_byte = bytestream2_get_byteu(&gb); \
+ nibble = last_byte & 0x0F; \
+ decode_top_nibble_next = 1; \
+ }
+
+ while (samples < samples_end) {
/* for this algorithm, c->status[0] is the sum channel and
* c->status[1] is the diff channel */
@@ -764,17 +840,21 @@ static int adpcm_decode_frame(AVCodecContext *avctx, void *data,
}
break;
}
- case CODEC_ID_ADPCM_IMA_ISS:
+ case AV_CODEC_ID_ADPCM_IMA_ISS:
for (channel = 0; channel < avctx->channels; channel++) {
cs = &c->status[channel];
- cs->predictor = (int16_t)bytestream_get_le16(&src);
- cs->step_index = av_clip(*src++, 0, 88);
- src++;
+ cs->predictor = sign_extend(bytestream2_get_le16u(&gb), 16);
+ cs->step_index = sign_extend(bytestream2_get_le16u(&gb), 16);
+ if (cs->step_index > 88u){
+ av_log(avctx, AV_LOG_ERROR, "ERROR: step_index[%d] = %i\n",
+ channel, cs->step_index);
+ return AVERROR_INVALIDDATA;
+ }
}
- for (n = nb_samples >> (1 - st); n > 0; n--, src++) {
- uint8_t v1, v2;
- uint8_t v = *src;
+ for (n = nb_samples >> (1 - st); n > 0; n--) {
+ int v1, v2;
+ int v = bytestream2_get_byteu(&gb);
/* nibbles are swapped for mono */
if (st) {
v1 = v >> 4;
@@ -787,75 +867,108 @@ static int adpcm_decode_frame(AVCodecContext *avctx, void *data,
*samples++ = adpcm_ima_expand_nibble(&c->status[st], v2, 3);
}
break;
- case CODEC_ID_ADPCM_IMA_WS:
- while (src < buf + buf_size) {
- uint8_t v = *src++;
+ case AV_CODEC_ID_ADPCM_IMA_APC:
+ while (bytestream2_get_bytes_left(&gb) > 0) {
+ int v = bytestream2_get_byteu(&gb);
*samples++ = adpcm_ima_expand_nibble(&c->status[0], v >> 4 , 3);
*samples++ = adpcm_ima_expand_nibble(&c->status[st], v & 0x0F, 3);
}
break;
- case CODEC_ID_ADPCM_XA:
- while (buf_size >= 128) {
- if ((ret = xa_decode(avctx, samples, src, &c->status[0],
- &c->status[1], avctx->channels)) < 0)
+ case AV_CODEC_ID_ADPCM_IMA_WS:
+ if (c->vqa_version == 3) {
+ for (channel = 0; channel < avctx->channels; channel++) {
+ int16_t *smp = samples_p[channel];
+
+ for (n = nb_samples / 2; n > 0; n--) {
+ int v = bytestream2_get_byteu(&gb);
+ *smp++ = adpcm_ima_expand_nibble(&c->status[channel], v >> 4 , 3);
+ *smp++ = adpcm_ima_expand_nibble(&c->status[channel], v & 0x0F, 3);
+ }
+ }
+ } else {
+ for (n = nb_samples / 2; n > 0; n--) {
+ for (channel = 0; channel < avctx->channels; channel++) {
+ int v = bytestream2_get_byteu(&gb);
+ *samples++ = adpcm_ima_expand_nibble(&c->status[channel], v >> 4 , 3);
+ samples[st] = adpcm_ima_expand_nibble(&c->status[channel], v & 0x0F, 3);
+ }
+ samples += avctx->channels;
+ }
+ }
+ bytestream2_seek(&gb, 0, SEEK_END);
+ break;
+ case AV_CODEC_ID_ADPCM_XA:
+ {
+ int16_t *out0 = samples_p[0];
+ int16_t *out1 = samples_p[1];
+ int samples_per_block = 28 * (3 - avctx->channels) * 4;
+ int sample_offset = 0;
+ while (bytestream2_get_bytes_left(&gb) >= 128) {
+ if ((ret = xa_decode(avctx, out0, out1, buf + bytestream2_tell(&gb),
+ &c->status[0], &c->status[1],
+ avctx->channels, sample_offset)) < 0)
return ret;
- src += 128;
- samples += 28 * 8;
- buf_size -= 128;
+ bytestream2_skipu(&gb, 128);
+ sample_offset += samples_per_block;
}
break;
- case CODEC_ID_ADPCM_IMA_EA_EACS:
- src += 4; // skip sample count (already read)
-
- for (i=0; i<=st; i++)
- c->status[i].step_index = av_clip(bytestream_get_le32(&src), 0, 88);
+ }
+ case AV_CODEC_ID_ADPCM_IMA_EA_EACS:
+ for (i=0; i<=st; i++) {
+ c->status[i].step_index = bytestream2_get_le32u(&gb);
+ if (c->status[i].step_index > 88u) {
+ av_log(avctx, AV_LOG_ERROR, "ERROR: step_index[%d] = %i\n",
+ i, c->status[i].step_index);
+ return AVERROR_INVALIDDATA;
+ }
+ }
for (i=0; i<=st; i++)
- c->status[i].predictor = bytestream_get_le32(&src);
+ c->status[i].predictor = bytestream2_get_le32u(&gb);
- for (n = nb_samples >> (1 - st); n > 0; n--, src++) {
- *samples++ = adpcm_ima_expand_nibble(&c->status[0], *src>>4, 3);
- *samples++ = adpcm_ima_expand_nibble(&c->status[st], *src&0x0F, 3);
+ for (n = nb_samples >> (1 - st); n > 0; n--) {
+ int byte = bytestream2_get_byteu(&gb);
+ *samples++ = adpcm_ima_expand_nibble(&c->status[0], byte >> 4, 3);
+ *samples++ = adpcm_ima_expand_nibble(&c->status[st], byte & 0x0F, 3);
}
break;
- case CODEC_ID_ADPCM_IMA_EA_SEAD:
- for (n = nb_samples >> (1 - st); n > 0; n--, src++) {
- *samples++ = adpcm_ima_expand_nibble(&c->status[0], src[0] >> 4, 6);
- *samples++ = adpcm_ima_expand_nibble(&c->status[st],src[0]&0x0F, 6);
+ case AV_CODEC_ID_ADPCM_IMA_EA_SEAD:
+ for (n = nb_samples >> (1 - st); n > 0; n--) {
+ int byte = bytestream2_get_byteu(&gb);
+ *samples++ = adpcm_ima_expand_nibble(&c->status[0], byte >> 4, 6);
+ *samples++ = adpcm_ima_expand_nibble(&c->status[st], byte & 0x0F, 6);
}
break;
- case CODEC_ID_ADPCM_EA:
+ case AV_CODEC_ID_ADPCM_EA:
{
- int32_t previous_left_sample, previous_right_sample;
- int32_t current_left_sample, current_right_sample;
- int32_t next_left_sample, next_right_sample;
- int32_t coeff1l, coeff2l, coeff1r, coeff2r;
- uint8_t shift_left, shift_right;
+ int previous_left_sample, previous_right_sample;
+ int current_left_sample, current_right_sample;
+ int next_left_sample, next_right_sample;
+ int coeff1l, coeff2l, coeff1r, coeff2r;
+ int shift_left, shift_right;
/* Each EA ADPCM frame has a 12-byte header followed by 30-byte pieces,
each coding 28 stereo samples. */
- src += 4; // skip sample count (already read)
-
- current_left_sample = (int16_t)bytestream_get_le16(&src);
- previous_left_sample = (int16_t)bytestream_get_le16(&src);
- current_right_sample = (int16_t)bytestream_get_le16(&src);
- previous_right_sample = (int16_t)bytestream_get_le16(&src);
+ current_left_sample = sign_extend(bytestream2_get_le16u(&gb), 16);
+ previous_left_sample = sign_extend(bytestream2_get_le16u(&gb), 16);
+ current_right_sample = sign_extend(bytestream2_get_le16u(&gb), 16);
+ previous_right_sample = sign_extend(bytestream2_get_le16u(&gb), 16);
for (count1 = 0; count1 < nb_samples / 28; count1++) {
- coeff1l = ea_adpcm_table[ *src >> 4 ];
- coeff2l = ea_adpcm_table[(*src >> 4 ) + 4];
- coeff1r = ea_adpcm_table[*src & 0x0F];
- coeff2r = ea_adpcm_table[(*src & 0x0F) + 4];
- src++;
+ int byte = bytestream2_get_byteu(&gb);
+ coeff1l = ea_adpcm_table[ byte >> 4 ];
+ coeff2l = ea_adpcm_table[(byte >> 4 ) + 4];
+ coeff1r = ea_adpcm_table[ byte & 0x0F];
+ coeff2r = ea_adpcm_table[(byte & 0x0F) + 4];
- shift_left = 20 - (*src >> 4);
- shift_right = 20 - (*src & 0x0F);
- src++;
+ byte = bytestream2_get_byteu(&gb);
+ shift_left = 20 - (byte >> 4);
+ shift_right = 20 - (byte & 0x0F);
for (count2 = 0; count2 < 28; count2++) {
- next_left_sample = sign_extend(*src >> 4, 4) << shift_left;
- next_right_sample = sign_extend(*src, 4) << shift_right;
- src++;
+ byte = bytestream2_get_byteu(&gb);
+ next_left_sample = sign_extend(byte >> 4, 4) << shift_left;
+ next_right_sample = sign_extend(byte, 4) << shift_right;
next_left_sample = (next_left_sample +
(current_left_sample * coeff1l) +
@@ -868,30 +981,33 @@ static int adpcm_decode_frame(AVCodecContext *avctx, void *data,
current_left_sample = av_clip_int16(next_left_sample);
previous_right_sample = current_right_sample;
current_right_sample = av_clip_int16(next_right_sample);
- *samples++ = (unsigned short)current_left_sample;
- *samples++ = (unsigned short)current_right_sample;
+ *samples++ = current_left_sample;
+ *samples++ = current_right_sample;
}
}
- if (src - buf == buf_size - 2)
- src += 2; // Skip terminating 0x0000
+ bytestream2_skip(&gb, 2); // Skip terminating 0x0000
break;
}
- case CODEC_ID_ADPCM_EA_MAXIS_XA:
+ case AV_CODEC_ID_ADPCM_EA_MAXIS_XA:
{
int coeff[2][2], shift[2];
for(channel = 0; channel < avctx->channels; channel++) {
+ int byte = bytestream2_get_byteu(&gb);
for (i=0; i<2; i++)
- coeff[channel][i] = ea_adpcm_table[(*src >> 4) + 4*i];
- shift[channel] = 20 - (*src & 0x0F);
- src++;
+ coeff[channel][i] = ea_adpcm_table[(byte >> 4) + 4*i];
+ shift[channel] = 20 - (byte & 0x0F);
}
for (count1 = 0; count1 < nb_samples / 2; count1++) {
+ int byte[2];
+
+ byte[0] = bytestream2_get_byteu(&gb);
+ if (st) byte[1] = bytestream2_get_byteu(&gb);
for(i = 4; i >= 0; i-=4) { /* Pairwise samples LL RR (st) or LL LL (mono) */
for(channel = 0; channel < avctx->channels; channel++) {
- int32_t sample = sign_extend(src[channel] >> i, 4) << shift[channel];
+ int sample = sign_extend(byte[channel] >> i, 4) << shift[channel];
sample = (sample +
c->status[channel].sample1 * coeff[channel][0] +
c->status[channel].sample2 * coeff[channel][1] + 0x80) >> 8;
@@ -900,70 +1016,63 @@ static int adpcm_decode_frame(AVCodecContext *avctx, void *data,
*samples++ = c->status[channel].sample1;
}
}
- src+=avctx->channels;
}
- /* consume whole packet */
- src = buf + buf_size;
+ bytestream2_seek(&gb, 0, SEEK_END);
break;
}
- case CODEC_ID_ADPCM_EA_R1:
- case CODEC_ID_ADPCM_EA_R2:
- case CODEC_ID_ADPCM_EA_R3: {
+ case AV_CODEC_ID_ADPCM_EA_R1:
+ case AV_CODEC_ID_ADPCM_EA_R2:
+ case AV_CODEC_ID_ADPCM_EA_R3: {
/* channel numbering
2chan: 0=fl, 1=fr
4chan: 0=fl, 1=rl, 2=fr, 3=rr
6chan: 0=fl, 1=c, 2=fr, 3=rl, 4=rr, 5=sub */
- const int big_endian = avctx->codec->id == CODEC_ID_ADPCM_EA_R3;
- int32_t previous_sample, current_sample, next_sample;
- int32_t coeff1, coeff2;
- uint8_t shift;
+ const int big_endian = avctx->codec->id == AV_CODEC_ID_ADPCM_EA_R3;
+ int previous_sample, current_sample, next_sample;
+ int coeff1, coeff2;
+ int shift;
unsigned int channel;
uint16_t *samplesC;
- const uint8_t *srcC;
- const uint8_t *src_end = buf + buf_size;
int count = 0;
+ int offsets[6];
- src += 4; // skip sample count (already read)
+ for (channel=0; channel<avctx->channels; channel++)
+ offsets[channel] = (big_endian ? bytestream2_get_be32(&gb) :
+ bytestream2_get_le32(&gb)) +
+ (avctx->channels + 1) * 4;
for (channel=0; channel<avctx->channels; channel++) {
- int32_t offset = (big_endian ? bytestream_get_be32(&src)
- : bytestream_get_le32(&src))
- + (avctx->channels-channel-1) * 4;
+ bytestream2_seek(&gb, offsets[channel], SEEK_SET);
+ samplesC = samples_p[channel];
- if ((offset < 0) || (offset >= src_end - src - 4)) break;
- srcC = src + offset;
- samplesC = samples + channel;
-
- if (avctx->codec->id == CODEC_ID_ADPCM_EA_R1) {
- current_sample = (int16_t)bytestream_get_le16(&srcC);
- previous_sample = (int16_t)bytestream_get_le16(&srcC);
+ if (avctx->codec->id == AV_CODEC_ID_ADPCM_EA_R1) {
+ current_sample = sign_extend(bytestream2_get_le16(&gb), 16);
+ previous_sample = sign_extend(bytestream2_get_le16(&gb), 16);
} else {
current_sample = c->status[channel].predictor;
previous_sample = c->status[channel].prev_sample;
}
for (count1 = 0; count1 < nb_samples / 28; count1++) {
- if (*srcC == 0xEE) { /* only seen in R2 and R3 */
- srcC++;
- if (srcC > src_end - 30*2) break;
- current_sample = (int16_t)bytestream_get_be16(&srcC);
- previous_sample = (int16_t)bytestream_get_be16(&srcC);
+ int byte = bytestream2_get_byte(&gb);
+ if (byte == 0xEE) { /* only seen in R2 and R3 */
+ current_sample = sign_extend(bytestream2_get_be16(&gb), 16);
+ previous_sample = sign_extend(bytestream2_get_be16(&gb), 16);
- for (count2=0; count2<28; count2++) {
- *samplesC = (int16_t)bytestream_get_be16(&srcC);
- samplesC += avctx->channels;
- }
+ for (count2=0; count2<28; count2++)
+ *samplesC++ = sign_extend(bytestream2_get_be16(&gb), 16);
} else {
- coeff1 = ea_adpcm_table[ *srcC>>4 ];
- coeff2 = ea_adpcm_table[(*srcC>>4) + 4];
- shift = 20 - (*srcC++ & 0x0F);
+ coeff1 = ea_adpcm_table[ byte >> 4 ];
+ coeff2 = ea_adpcm_table[(byte >> 4) + 4];
+ shift = 20 - (byte & 0x0F);
- if (srcC > src_end - 14) break;
for (count2=0; count2<28; count2++) {
if (count2 & 1)
- next_sample = sign_extend(*srcC++, 4) << shift;
- else
- next_sample = sign_extend(*srcC >> 4, 4) << shift;
+ next_sample = sign_extend(byte, 4) << shift;
+ else {
+ byte = bytestream2_get_byte(&gb);
+ next_sample = sign_extend(byte >> 4, 4) << shift;
+ }
next_sample += (current_sample * coeff1) +
(previous_sample * coeff2);
@@ -971,8 +1080,7 @@ static int adpcm_decode_frame(AVCodecContext *avctx, void *data,
previous_sample = current_sample;
current_sample = next_sample;
- *samplesC = current_sample;
- samplesC += avctx->channels;
+ *samplesC++ = current_sample;
}
}
}
@@ -983,219 +1091,183 @@ static int adpcm_decode_frame(AVCodecContext *avctx, void *data,
count = FFMAX(count, count1);
}
- if (avctx->codec->id != CODEC_ID_ADPCM_EA_R1) {
+ if (avctx->codec->id != AV_CODEC_ID_ADPCM_EA_R1) {
c->status[channel].predictor = current_sample;
c->status[channel].prev_sample = previous_sample;
}
}
c->frame.nb_samples = count * 28;
- src = src_end;
+ bytestream2_seek(&gb, 0, SEEK_END);
break;
}
- case CODEC_ID_ADPCM_EA_XAS:
+ case AV_CODEC_ID_ADPCM_EA_XAS:
for (channel=0; channel<avctx->channels; channel++) {
int coeff[2][4], shift[4];
- short *s2, *s = &samples[channel];
- for (n=0; n<4; n++, s+=32*avctx->channels) {
+ int16_t *s = samples_p[channel];
+ for (n = 0; n < 4; n++, s += 32) {
+ int val = sign_extend(bytestream2_get_le16u(&gb), 16);
for (i=0; i<2; i++)
- coeff[i][n] = ea_adpcm_table[(src[0]&0x0F)+4*i];
- shift[n] = 20 - (src[2] & 0x0F);
- for (s2=s, i=0; i<2; i++, src+=2, s2+=avctx->channels)
- s2[0] = (src[0]&0xF0) + (src[1]<<8);
+ coeff[i][n] = ea_adpcm_table[(val&0x0F)+4*i];
+ s[0] = val & ~0x0F;
+
+ val = sign_extend(bytestream2_get_le16u(&gb), 16);
+ shift[n] = 20 - (val & 0x0F);
+ s[1] = val & ~0x0F;
}
for (m=2; m<32; m+=2) {
- s = &samples[m*avctx->channels + channel];
- for (n=0; n<4; n++, src++, s+=32*avctx->channels) {
- for (s2=s, i=0; i<8; i+=4, s2+=avctx->channels) {
- int level = sign_extend(*src >> (4 - i), 4) << shift[n];
- int pred = s2[-1*avctx->channels] * coeff[0][n]
- + s2[-2*avctx->channels] * coeff[1][n];
- s2[0] = av_clip_int16((level + pred + 0x80) >> 8);
- }
+ s = &samples_p[channel][m];
+ for (n = 0; n < 4; n++, s += 32) {
+ int level, pred;
+ int byte = bytestream2_get_byteu(&gb);
+
+ level = sign_extend(byte >> 4, 4) << shift[n];
+ pred = s[-1] * coeff[0][n] + s[-2] * coeff[1][n];
+ s[0] = av_clip_int16((level + pred + 0x80) >> 8);
+
+ level = sign_extend(byte, 4) << shift[n];
+ pred = s[0] * coeff[0][n] + s[-1] * coeff[1][n];
+ s[1] = av_clip_int16((level + pred + 0x80) >> 8);
}
}
}
break;
- case CODEC_ID_ADPCM_IMA_AMV:
- case CODEC_ID_ADPCM_IMA_SMJPEG:
- if (avctx->codec->id == CODEC_ID_ADPCM_IMA_AMV) {
- c->status[0].predictor = sign_extend(bytestream_get_le16(&src), 16);
- c->status[0].step_index = av_clip(bytestream_get_le16(&src), 0, 88);
- src += 4;
+ case AV_CODEC_ID_ADPCM_IMA_AMV:
+ case AV_CODEC_ID_ADPCM_IMA_SMJPEG:
+ if (avctx->codec->id == AV_CODEC_ID_ADPCM_IMA_AMV) {
+ c->status[0].predictor = sign_extend(bytestream2_get_le16u(&gb), 16);
+ c->status[0].step_index = bytestream2_get_le16u(&gb);
+ bytestream2_skipu(&gb, 4);
} else {
- c->status[0].predictor = sign_extend(bytestream_get_be16(&src), 16);
- c->status[0].step_index = av_clip(bytestream_get_byte(&src), 0, 88);
- src += 1;
+ c->status[0].predictor = sign_extend(bytestream2_get_be16u(&gb), 16);
+ c->status[0].step_index = bytestream2_get_byteu(&gb);
+ bytestream2_skipu(&gb, 1);
+ }
+ if (c->status[0].step_index > 88u) {
+ av_log(avctx, AV_LOG_ERROR, "ERROR: step_index = %i\n",
+ c->status[0].step_index);
+ return AVERROR_INVALIDDATA;
}
- for (n = nb_samples >> (1 - st); n > 0; n--, src++) {
- char hi, lo;
- lo = *src & 0x0F;
- hi = *src >> 4;
+ for (n = nb_samples >> (1 - st); n > 0; n--) {
+ int hi, lo, v = bytestream2_get_byteu(&gb);
- if (avctx->codec->id == CODEC_ID_ADPCM_IMA_AMV)
- FFSWAP(char, hi, lo);
+ if (avctx->codec->id == AV_CODEC_ID_ADPCM_IMA_AMV) {
+ hi = v & 0x0F;
+ lo = v >> 4;
+ } else {
+ lo = v & 0x0F;
+ hi = v >> 4;
+ }
- *samples++ = adpcm_ima_expand_nibble(&c->status[0],
- lo, 3);
- *samples++ = adpcm_ima_expand_nibble(&c->status[0],
- hi, 3);
+ *samples++ = adpcm_ima_expand_nibble(&c->status[0], lo, 3);
+ *samples++ = adpcm_ima_expand_nibble(&c->status[0], hi, 3);
}
break;
- case CODEC_ID_ADPCM_CT:
- for (n = nb_samples >> (1 - st); n > 0; n--, src++) {
- uint8_t v = *src;
+ case AV_CODEC_ID_ADPCM_CT:
+ for (n = nb_samples >> (1 - st); n > 0; n--) {
+ int v = bytestream2_get_byteu(&gb);
*samples++ = adpcm_ct_expand_nibble(&c->status[0 ], v >> 4 );
*samples++ = adpcm_ct_expand_nibble(&c->status[st], v & 0x0F);
}
break;
- case CODEC_ID_ADPCM_SBPRO_4:
- case CODEC_ID_ADPCM_SBPRO_3:
- case CODEC_ID_ADPCM_SBPRO_2:
+ case AV_CODEC_ID_ADPCM_SBPRO_4:
+ case AV_CODEC_ID_ADPCM_SBPRO_3:
+ case AV_CODEC_ID_ADPCM_SBPRO_2:
if (!c->status[0].step_index) {
/* the first byte is a raw sample */
- *samples++ = 128 * (*src++ - 0x80);
+ *samples++ = 128 * (bytestream2_get_byteu(&gb) - 0x80);
if (st)
- *samples++ = 128 * (*src++ - 0x80);
+ *samples++ = 128 * (bytestream2_get_byteu(&gb) - 0x80);
c->status[0].step_index = 1;
nb_samples--;
}
- if (avctx->codec->id == CODEC_ID_ADPCM_SBPRO_4) {
- for (n = nb_samples >> (1 - st); n > 0; n--, src++) {
+ if (avctx->codec->id == AV_CODEC_ID_ADPCM_SBPRO_4) {
+ for (n = nb_samples >> (1 - st); n > 0; n--) {
+ int byte = bytestream2_get_byteu(&gb);
*samples++ = adpcm_sbpro_expand_nibble(&c->status[0],
- src[0] >> 4, 4, 0);
+ byte >> 4, 4, 0);
*samples++ = adpcm_sbpro_expand_nibble(&c->status[st],
- src[0] & 0x0F, 4, 0);
+ byte & 0x0F, 4, 0);
}
- } else if (avctx->codec->id == CODEC_ID_ADPCM_SBPRO_3) {
- for (n = nb_samples / 3; n > 0; n--, src++) {
+ } else if (avctx->codec->id == AV_CODEC_ID_ADPCM_SBPRO_3) {
+ for (n = nb_samples / 3; n > 0; n--) {
+ int byte = bytestream2_get_byteu(&gb);
*samples++ = adpcm_sbpro_expand_nibble(&c->status[0],
- src[0] >> 5 , 3, 0);
+ byte >> 5 , 3, 0);
*samples++ = adpcm_sbpro_expand_nibble(&c->status[0],
- (src[0] >> 2) & 0x07, 3, 0);
+ (byte >> 2) & 0x07, 3, 0);
*samples++ = adpcm_sbpro_expand_nibble(&c->status[0],
- src[0] & 0x03, 2, 0);
+ byte & 0x03, 2, 0);
}
} else {
- for (n = nb_samples >> (2 - st); n > 0; n--, src++) {
+ for (n = nb_samples >> (2 - st); n > 0; n--) {
+ int byte = bytestream2_get_byteu(&gb);
*samples++ = adpcm_sbpro_expand_nibble(&c->status[0],
- src[0] >> 6 , 2, 2);
+ byte >> 6 , 2, 2);
*samples++ = adpcm_sbpro_expand_nibble(&c->status[st],
- (src[0] >> 4) & 0x03, 2, 2);
+ (byte >> 4) & 0x03, 2, 2);
*samples++ = adpcm_sbpro_expand_nibble(&c->status[0],
- (src[0] >> 2) & 0x03, 2, 2);
+ (byte >> 2) & 0x03, 2, 2);
*samples++ = adpcm_sbpro_expand_nibble(&c->status[st],
- src[0] & 0x03, 2, 2);
+ byte & 0x03, 2, 2);
}
}
break;
- case CODEC_ID_ADPCM_SWF:
- {
- GetBitContext gb;
- const int *table;
- int k0, signmask, nb_bits, count;
- int size = buf_size*8;
-
- init_get_bits(&gb, buf, size);
-
- //read bits & initial values
- nb_bits = get_bits(&gb, 2)+2;
- //av_log(NULL,AV_LOG_INFO,"nb_bits: %d\n", nb_bits);
- table = swf_index_tables[nb_bits-2];
- k0 = 1 << (nb_bits-2);
- signmask = 1 << (nb_bits-1);
-
- while (get_bits_count(&gb) <= size - 22*avctx->channels) {
- for (i = 0; i < avctx->channels; i++) {
- *samples++ = c->status[i].predictor = get_sbits(&gb, 16);
- c->status[i].step_index = get_bits(&gb, 6);
- }
-
- for (count = 0; get_bits_count(&gb) <= size - nb_bits*avctx->channels && count < 4095; count++) {
- int i;
-
- for (i = 0; i < avctx->channels; i++) {
- // similar to IMA adpcm
- int delta = get_bits(&gb, nb_bits);
- int step = ff_adpcm_step_table[c->status[i].step_index];
- long vpdiff = 0; // vpdiff = (delta+0.5)*step/4
- int k = k0;
-
- do {
- if (delta & k)
- vpdiff += step;
- step >>= 1;
- k >>= 1;
- } while(k);
- vpdiff += step;
-
- if (delta & signmask)
- c->status[i].predictor -= vpdiff;
- else
- c->status[i].predictor += vpdiff;
-
- c->status[i].step_index += table[delta & (~signmask)];
-
- c->status[i].step_index = av_clip(c->status[i].step_index, 0, 88);
- c->status[i].predictor = av_clip_int16(c->status[i].predictor);
-
- *samples++ = c->status[i].predictor;
- }
- }
- }
- src += buf_size;
+ case AV_CODEC_ID_ADPCM_SWF:
+ adpcm_swf_decode(avctx, buf, buf_size, samples);
+ bytestream2_seek(&gb, 0, SEEK_END);
break;
- }
- case CODEC_ID_ADPCM_YAMAHA:
- for (n = nb_samples >> (1 - st); n > 0; n--, src++) {
- uint8_t v = *src;
+ case AV_CODEC_ID_ADPCM_YAMAHA:
+ for (n = nb_samples >> (1 - st); n > 0; n--) {
+ int v = bytestream2_get_byteu(&gb);
*samples++ = adpcm_yamaha_expand_nibble(&c->status[0 ], v & 0x0F);
*samples++ = adpcm_yamaha_expand_nibble(&c->status[st], v >> 4 );
}
break;
- case CODEC_ID_ADPCM_THP:
+ case AV_CODEC_ID_ADPCM_THP:
{
int table[2][16];
int prev[2][2];
int ch;
- src += 4; // skip channel size
- src += 4; // skip number of samples (already read)
-
- for (i = 0; i < 32; i++)
- table[0][i] = (int16_t)bytestream_get_be16(&src);
+ for (i = 0; i < 2; i++)
+ for (n = 0; n < 16; n++)
+ table[i][n] = sign_extend(bytestream2_get_be16u(&gb), 16);
/* Initialize the previous sample. */
- for (i = 0; i < 4; i++)
- prev[0][i] = (int16_t)bytestream_get_be16(&src);
+ for (i = 0; i < 2; i++)
+ for (n = 0; n < 2; n++)
+ prev[i][n] = sign_extend(bytestream2_get_be16u(&gb), 16);
for (ch = 0; ch <= st; ch++) {
- samples = (short *)c->frame.data[0] + ch;
+ samples = samples_p[ch];
/* Read in every sample for this channel. */
for (i = 0; i < nb_samples / 14; i++) {
- int index = (*src >> 4) & 7;
- unsigned int exp = *src++ & 15;
+ int byte = bytestream2_get_byteu(&gb);
+ int index = (byte >> 4) & 7;
+ unsigned int exp = byte & 0x0F;
int factor1 = table[ch][index * 2];
int factor2 = table[ch][index * 2 + 1];
/* Decode 14 samples. */
for (n = 0; n < 14; n++) {
int32_t sampledat;
- if(n&1) sampledat = sign_extend(*src++, 4);
- else sampledat = sign_extend(*src >> 4, 4);
+
+ if (n & 1) {
+ sampledat = sign_extend(byte, 4);
+ } else {
+ byte = bytestream2_get_byteu(&gb);
+ sampledat = sign_extend(byte >> 4, 4);
+ }
sampledat = ((prev[ch][0]*factor1
+ prev[ch][1]*factor2) >> 11) + (sampledat << exp);
*samples = av_clip_int16(sampledat);
prev[ch][1] = prev[ch][0];
prev[ch][0] = *samples++;
-
- /* In case of stereo, skip one sample, this sample
- is for the other channel. */
- samples += st;
}
}
}
@@ -1209,11 +1281,19 @@ static int adpcm_decode_frame(AVCodecContext *avctx, void *data,
*got_frame_ptr = 1;
*(AVFrame *)data = c->frame;
- return src - buf;
+ return bytestream2_tell(&gb);
}
-#define ADPCM_DECODER(id_, name_, long_name_) \
+static const enum AVSampleFormat sample_fmts_s16[] = { AV_SAMPLE_FMT_S16,
+ AV_SAMPLE_FMT_NONE };
+static const enum AVSampleFormat sample_fmts_s16p[] = { AV_SAMPLE_FMT_S16,
+ AV_SAMPLE_FMT_NONE };
+static const enum AVSampleFormat sample_fmts_both[] = { AV_SAMPLE_FMT_S16,
+ AV_SAMPLE_FMT_S16P,
+ AV_SAMPLE_FMT_NONE };
+
+#define ADPCM_DECODER(id_, sample_fmts_, name_, long_name_) \
AVCodec ff_ ## name_ ## _decoder = { \
.name = #name_, \
.type = AVMEDIA_TYPE_AUDIO, \
@@ -1223,32 +1303,34 @@ AVCodec ff_ ## name_ ## _decoder = { \
.decode = adpcm_decode_frame, \
.capabilities = CODEC_CAP_DR1, \
.long_name = NULL_IF_CONFIG_SMALL(long_name_), \
+ .sample_fmts = sample_fmts_, \
}
/* Note: Do not forget to add new entries to the Makefile as well. */
-ADPCM_DECODER(CODEC_ID_ADPCM_4XM, adpcm_4xm, "ADPCM 4X Movie");
-ADPCM_DECODER(CODEC_ID_ADPCM_CT, adpcm_ct, "ADPCM Creative Technology");
-ADPCM_DECODER(CODEC_ID_ADPCM_EA, adpcm_ea, "ADPCM Electronic Arts");
-ADPCM_DECODER(CODEC_ID_ADPCM_EA_MAXIS_XA, adpcm_ea_maxis_xa, "ADPCM Electronic Arts Maxis CDROM XA");
-ADPCM_DECODER(CODEC_ID_ADPCM_EA_R1, adpcm_ea_r1, "ADPCM Electronic Arts R1");
-ADPCM_DECODER(CODEC_ID_ADPCM_EA_R2, adpcm_ea_r2, "ADPCM Electronic Arts R2");
-ADPCM_DECODER(CODEC_ID_ADPCM_EA_R3, adpcm_ea_r3, "ADPCM Electronic Arts R3");
-ADPCM_DECODER(CODEC_ID_ADPCM_EA_XAS, adpcm_ea_xas, "ADPCM Electronic Arts XAS");
-ADPCM_DECODER(CODEC_ID_ADPCM_IMA_AMV, adpcm_ima_amv, "ADPCM IMA AMV");
-ADPCM_DECODER(CODEC_ID_ADPCM_IMA_DK3, adpcm_ima_dk3, "ADPCM IMA Duck DK3");
-ADPCM_DECODER(CODEC_ID_ADPCM_IMA_DK4, adpcm_ima_dk4, "ADPCM IMA Duck DK4");
-ADPCM_DECODER(CODEC_ID_ADPCM_IMA_EA_EACS, adpcm_ima_ea_eacs, "ADPCM IMA Electronic Arts EACS");
-ADPCM_DECODER(CODEC_ID_ADPCM_IMA_EA_SEAD, adpcm_ima_ea_sead, "ADPCM IMA Electronic Arts SEAD");
-ADPCM_DECODER(CODEC_ID_ADPCM_IMA_ISS, adpcm_ima_iss, "ADPCM IMA Funcom ISS");
-ADPCM_DECODER(CODEC_ID_ADPCM_IMA_QT, adpcm_ima_qt, "ADPCM IMA QuickTime");
-ADPCM_DECODER(CODEC_ID_ADPCM_IMA_SMJPEG, adpcm_ima_smjpeg, "ADPCM IMA Loki SDL MJPEG");
-ADPCM_DECODER(CODEC_ID_ADPCM_IMA_WAV, adpcm_ima_wav, "ADPCM IMA WAV");
-ADPCM_DECODER(CODEC_ID_ADPCM_IMA_WS, adpcm_ima_ws, "ADPCM IMA Westwood");
-ADPCM_DECODER(CODEC_ID_ADPCM_MS, adpcm_ms, "ADPCM Microsoft");
-ADPCM_DECODER(CODEC_ID_ADPCM_SBPRO_2, adpcm_sbpro_2, "ADPCM Sound Blaster Pro 2-bit");
-ADPCM_DECODER(CODEC_ID_ADPCM_SBPRO_3, adpcm_sbpro_3, "ADPCM Sound Blaster Pro 2.6-bit");
-ADPCM_DECODER(CODEC_ID_ADPCM_SBPRO_4, adpcm_sbpro_4, "ADPCM Sound Blaster Pro 4-bit");
-ADPCM_DECODER(CODEC_ID_ADPCM_SWF, adpcm_swf, "ADPCM Shockwave Flash");
-ADPCM_DECODER(CODEC_ID_ADPCM_THP, adpcm_thp, "ADPCM Nintendo Gamecube THP");
-ADPCM_DECODER(CODEC_ID_ADPCM_XA, adpcm_xa, "ADPCM CDROM XA");
-ADPCM_DECODER(CODEC_ID_ADPCM_YAMAHA, adpcm_yamaha, "ADPCM Yamaha");
+ADPCM_DECODER(AV_CODEC_ID_ADPCM_4XM, sample_fmts_s16p, adpcm_4xm, "ADPCM 4X Movie");
+ADPCM_DECODER(AV_CODEC_ID_ADPCM_CT, sample_fmts_s16, adpcm_ct, "ADPCM Creative Technology");
+ADPCM_DECODER(AV_CODEC_ID_ADPCM_EA, sample_fmts_s16, adpcm_ea, "ADPCM Electronic Arts");
+ADPCM_DECODER(AV_CODEC_ID_ADPCM_EA_MAXIS_XA, sample_fmts_s16, adpcm_ea_maxis_xa, "ADPCM Electronic Arts Maxis CDROM XA");
+ADPCM_DECODER(AV_CODEC_ID_ADPCM_EA_R1, sample_fmts_s16p, adpcm_ea_r1, "ADPCM Electronic Arts R1");
+ADPCM_DECODER(AV_CODEC_ID_ADPCM_EA_R2, sample_fmts_s16p, adpcm_ea_r2, "ADPCM Electronic Arts R2");
+ADPCM_DECODER(AV_CODEC_ID_ADPCM_EA_R3, sample_fmts_s16p, adpcm_ea_r3, "ADPCM Electronic Arts R3");
+ADPCM_DECODER(AV_CODEC_ID_ADPCM_EA_XAS, sample_fmts_s16p, adpcm_ea_xas, "ADPCM Electronic Arts XAS");
+ADPCM_DECODER(AV_CODEC_ID_ADPCM_IMA_AMV, sample_fmts_s16, adpcm_ima_amv, "ADPCM IMA AMV");
+ADPCM_DECODER(AV_CODEC_ID_ADPCM_IMA_APC, sample_fmts_s16, adpcm_ima_apc, "ADPCM IMA CRYO APC");
+ADPCM_DECODER(AV_CODEC_ID_ADPCM_IMA_DK3, sample_fmts_s16, adpcm_ima_dk3, "ADPCM IMA Duck DK3");
+ADPCM_DECODER(AV_CODEC_ID_ADPCM_IMA_DK4, sample_fmts_s16, adpcm_ima_dk4, "ADPCM IMA Duck DK4");
+ADPCM_DECODER(AV_CODEC_ID_ADPCM_IMA_EA_EACS, sample_fmts_s16, adpcm_ima_ea_eacs, "ADPCM IMA Electronic Arts EACS");
+ADPCM_DECODER(AV_CODEC_ID_ADPCM_IMA_EA_SEAD, sample_fmts_s16, adpcm_ima_ea_sead, "ADPCM IMA Electronic Arts SEAD");
+ADPCM_DECODER(AV_CODEC_ID_ADPCM_IMA_ISS, sample_fmts_s16, adpcm_ima_iss, "ADPCM IMA Funcom ISS");
+ADPCM_DECODER(AV_CODEC_ID_ADPCM_IMA_QT, sample_fmts_s16p, adpcm_ima_qt, "ADPCM IMA QuickTime");
+ADPCM_DECODER(AV_CODEC_ID_ADPCM_IMA_SMJPEG, sample_fmts_s16, adpcm_ima_smjpeg, "ADPCM IMA Loki SDL MJPEG");
+ADPCM_DECODER(AV_CODEC_ID_ADPCM_IMA_WAV, sample_fmts_s16p, adpcm_ima_wav, "ADPCM IMA WAV");
+ADPCM_DECODER(AV_CODEC_ID_ADPCM_IMA_WS, sample_fmts_both, adpcm_ima_ws, "ADPCM IMA Westwood");
+ADPCM_DECODER(AV_CODEC_ID_ADPCM_MS, sample_fmts_s16, adpcm_ms, "ADPCM Microsoft");
+ADPCM_DECODER(AV_CODEC_ID_ADPCM_SBPRO_2, sample_fmts_s16, adpcm_sbpro_2, "ADPCM Sound Blaster Pro 2-bit");
+ADPCM_DECODER(AV_CODEC_ID_ADPCM_SBPRO_3, sample_fmts_s16, adpcm_sbpro_3, "ADPCM Sound Blaster Pro 2.6-bit");
+ADPCM_DECODER(AV_CODEC_ID_ADPCM_SBPRO_4, sample_fmts_s16, adpcm_sbpro_4, "ADPCM Sound Blaster Pro 4-bit");
+ADPCM_DECODER(AV_CODEC_ID_ADPCM_SWF, sample_fmts_s16, adpcm_swf, "ADPCM Shockwave Flash");
+ADPCM_DECODER(AV_CODEC_ID_ADPCM_THP, sample_fmts_s16p, adpcm_thp, "ADPCM Nintendo Gamecube THP");
+ADPCM_DECODER(AV_CODEC_ID_ADPCM_XA, sample_fmts_s16p, adpcm_xa, "ADPCM CDROM XA");
+ADPCM_DECODER(AV_CODEC_ID_ADPCM_YAMAHA, sample_fmts_s16, adpcm_yamaha, "ADPCM Yamaha");
diff --git a/gst-libs/ext/libav/libavcodec/adpcm.h b/gst-libs/ext/libav/libavcodec/adpcm.h
index aed5048..16facb6 100644
--- a/gst-libs/ext/libav/libavcodec/adpcm.h
+++ b/gst-libs/ext/libav/libavcodec/adpcm.h
@@ -26,18 +26,20 @@
#ifndef AVCODEC_ADPCM_H
#define AVCODEC_ADPCM_H
+#include <stdint.h>
+
#define BLKSIZE 1024
typedef struct ADPCMChannelStatus {
int predictor;
- short int step_index;
+ int16_t step_index;
int step;
/* for encoding */
int prev_sample;
/* MS version */
- short sample1;
- short sample2;
+ int16_t sample1;
+ int16_t sample2;
int coeff1;
int coeff2;
int idelta;
diff --git a/gst-libs/ext/libav/libavcodec/adpcmenc.c b/gst-libs/ext/libav/libavcodec/adpcmenc.c
index 9697f82..f81d7fd 100644
--- a/gst-libs/ext/libav/libavcodec/adpcmenc.c
+++ b/gst-libs/ext/libav/libavcodec/adpcmenc.c
@@ -24,6 +24,7 @@
#include "bytestream.h"
#include "adpcm.h"
#include "adpcm_data.h"
+#include "internal.h"
/**
* @file
@@ -63,12 +64,16 @@ static av_cold int adpcm_encode_init(AVCodecContext *avctx)
ADPCMEncodeContext *s = avctx->priv_data;
uint8_t *extradata;
int i;
- if (avctx->channels > 2)
- return -1; /* only stereo or mono =) */
+ int ret = AVERROR(ENOMEM);
+
+ if (avctx->channels > 2) {
+ av_log(avctx, AV_LOG_ERROR, "only stereo or mono is supported\n");
+ return AVERROR(EINVAL);
+ }
if (avctx->trellis && (unsigned)avctx->trellis > 16U) {
av_log(avctx, AV_LOG_ERROR, "invalid trellis size\n");
- return -1;
+ return AVERROR(EINVAL);
}
if (avctx->trellis) {
@@ -87,7 +92,7 @@ static av_cold int adpcm_encode_init(AVCodecContext *avctx)
avctx->bits_per_coded_sample = av_get_bits_per_sample(avctx->codec->id);
switch (avctx->codec->id) {
- case CODEC_ID_ADPCM_IMA_WAV:
+ case AV_CODEC_ID_ADPCM_IMA_WAV:
/* each 16 bits sample gives one nibble
and we have 4 bytes per channel overhead */
avctx->frame_size = (BLKSIZE - 4 * avctx->channels) * 8 /
@@ -96,20 +101,20 @@ static av_cold int adpcm_encode_init(AVCodecContext *avctx)
have to buffer the samples :-( */
avctx->block_align = BLKSIZE;
break;
- case CODEC_ID_ADPCM_IMA_QT:
+ case AV_CODEC_ID_ADPCM_IMA_QT:
avctx->frame_size = 64;
avctx->block_align = 34 * avctx->channels;
break;
- case CODEC_ID_ADPCM_MS:
+ case AV_CODEC_ID_ADPCM_MS:
/* each 16 bits sample gives one nibble
and we have 7 bytes per channel overhead */
avctx->frame_size = (BLKSIZE - 7 * avctx->channels) * 2 /
avctx->channels + 2;
avctx->block_align = BLKSIZE;
+ if (!(avctx->extradata = av_malloc(32 + FF_INPUT_BUFFER_PADDING_SIZE)))
+ goto error;
avctx->extradata_size = 32;
- extradata = avctx->extradata = av_malloc(avctx->extradata_size);
- if (!extradata)
- return AVERROR(ENOMEM);
+ extradata = avctx->extradata;
bytestream_put_le16(&extradata, avctx->frame_size);
bytestream_put_le16(&extradata, 7); /* wNumCoef */
for (i = 0; i < 7; i++) {
@@ -117,26 +122,30 @@ static av_cold int adpcm_encode_init(AVCodecContext *avctx)
bytestream_put_le16(&extradata, ff_adpcm_AdaptCoeff2[i] * 4);
}
break;
- case CODEC_ID_ADPCM_YAMAHA:
- avctx->frame_size = BLKSIZE * avctx->channels;
+ case AV_CODEC_ID_ADPCM_YAMAHA:
+ avctx->frame_size = BLKSIZE * 2 / avctx->channels;
avctx->block_align = BLKSIZE;
break;
- case CODEC_ID_ADPCM_SWF:
+ case AV_CODEC_ID_ADPCM_SWF:
if (avctx->sample_rate != 11025 &&
avctx->sample_rate != 22050 &&
avctx->sample_rate != 44100) {
av_log(avctx, AV_LOG_ERROR, "Sample rate must be 11025, "
"22050 or 44100\n");
+ ret = AVERROR(EINVAL);
goto error;
}
avctx->frame_size = 512 * (avctx->sample_rate / 11025);
break;
default:
+ ret = AVERROR(EINVAL);
goto error;
}
- avctx->coded_frame = avcodec_alloc_frame();
- avctx->coded_frame->key_frame= 1;
+#if FF_API_OLD_ENCODE_AUDIO
+ if (!(avctx->coded_frame = avcodec_alloc_frame()))
+ goto error;
+#endif
return 0;
error:
@@ -144,13 +153,15 @@ error:
av_freep(&s->node_buf);
av_freep(&s->nodep_buf);
av_freep(&s->trellis_hash);
- return -1;
+ return ret;
}
static av_cold int adpcm_encode_close(AVCodecContext *avctx)
{
ADPCMEncodeContext *s = avctx->priv_data;
+#if FF_API_OLD_ENCODE_AUDIO
av_freep(&avctx->coded_frame);
+#endif
av_freep(&s->paths);
av_freep(&s->node_buf);
av_freep(&s->nodep_buf);
@@ -160,8 +171,8 @@ static av_cold int adpcm_encode_close(AVCodecContext *avctx)
}
-static inline unsigned char adpcm_ima_compress_sample(ADPCMChannelStatus *c,
- short sample)
+static inline uint8_t adpcm_ima_compress_sample(ADPCMChannelStatus *c,
+ int16_t sample)
{
int delta = sample - c->prev_sample;
int nibble = FFMIN(7, abs(delta) * 4 /
@@ -173,8 +184,8 @@ static inline unsigned char adpcm_ima_compress_sample(ADPCMChannelStatus *c,
return nibble;
}
-static inline unsigned char adpcm_ima_qt_compress_sample(ADPCMChannelStatus *c,
- short sample)
+static inline uint8_t adpcm_ima_qt_compress_sample(ADPCMChannelStatus *c,
+ int16_t sample)
{
int delta = sample - c->prev_sample;
int mask, step = ff_adpcm_step_table[c->step_index];
@@ -207,8 +218,8 @@ static inline unsigned char adpcm_ima_qt_compress_sample(ADPCMChannelStatus *c,
return nibble;
}
-static inline unsigned char adpcm_ms_compress_sample(ADPCMChannelStatus *c,
- short sample)
+static inline uint8_t adpcm_ms_compress_sample(ADPCMChannelStatus *c,
+ int16_t sample)
{
int predictor, nibble, bias;
@@ -224,20 +235,20 @@ static inline unsigned char adpcm_ms_compress_sample(ADPCMChannelStatus *c,
nibble = (nibble + bias) / c->idelta;
nibble = av_clip(nibble, -8, 7) & 0x0F;
- predictor += (signed)((nibble & 0x08) ? (nibble - 0x10) : nibble) * c->idelta;
+ predictor += ((nibble & 0x08) ? (nibble - 0x10) : nibble) * c->idelta;
c->sample2 = c->sample1;
c->sample1 = av_clip_int16(predictor);
- c->idelta = (ff_adpcm_AdaptationTable[(int)nibble] * c->idelta) >> 8;
+ c->idelta = (ff_adpcm_AdaptationTable[nibble] * c->idelta) >> 8;
if (c->idelta < 16)
c->idelta = 16;
return nibble;
}
-static inline unsigned char adpcm_yamaha_compress_sample(ADPCMChannelStatus *c,
- short sample)
+static inline uint8_t adpcm_yamaha_compress_sample(ADPCMChannelStatus *c,
+ int16_t sample)
{
int nibble, delta;
@@ -258,13 +269,13 @@ static inline unsigned char adpcm_yamaha_compress_sample(ADPCMChannelStatus *c,
return nibble;
}
-static void adpcm_compress_trellis(AVCodecContext *avctx, const short *samples,
- uint8_t *dst, ADPCMChannelStatus *c, int n)
+static void adpcm_compress_trellis(AVCodecContext *avctx,
+ const int16_t *samples, uint8_t *dst,
+ ADPCMChannelStatus *c, int n, int stride)
{
//FIXME 6% faster if frontier is a compile-time constant
ADPCMEncodeContext *s = avctx->priv_data;
const int frontier = 1 << avctx->trellis;
- const int stride = avctx->channels;
const int version = avctx->codec->id;
TrellisPath *paths = s->paths, *p;
TrellisNode *node_buf = s->node_buf;
@@ -282,13 +293,13 @@ static void adpcm_compress_trellis(AVCodecContext *avctx, const short *samples,
nodes[0]->step = c->step_index;
nodes[0]->sample1 = c->sample1;
nodes[0]->sample2 = c->sample2;
- if (version == CODEC_ID_ADPCM_IMA_WAV ||
- version == CODEC_ID_ADPCM_IMA_QT ||
- version == CODEC_ID_ADPCM_SWF)
+ if (version == AV_CODEC_ID_ADPCM_IMA_WAV ||
+ version == AV_CODEC_ID_ADPCM_IMA_QT ||
+ version == AV_CODEC_ID_ADPCM_SWF)
nodes[0]->sample1 = c->prev_sample;
- if (version == CODEC_ID_ADPCM_MS)
+ if (version == AV_CODEC_ID_ADPCM_MS)
nodes[0]->step = c->idelta;
- if (version == CODEC_ID_ADPCM_YAMAHA) {
+ if (version == AV_CODEC_ID_ADPCM_YAMAHA) {
if (c->step == 0) {
nodes[0]->step = 127;
nodes[0]->sample1 = 0;
@@ -310,7 +321,7 @@ static void adpcm_compress_trellis(AVCodecContext *avctx, const short *samples,
const int range = (j < frontier / 2) ? 1 : 0;
const int step = nodes[j]->step;
int nidx;
- if (version == CODEC_ID_ADPCM_MS) {
+ if (version == AV_CODEC_ID_ADPCM_MS) {
const int predictor = ((nodes[j]->sample1 * c->coeff1) +
(nodes[j]->sample2 * c->coeff2)) / 64;
const int div = (sample - predictor) / step;
@@ -386,9 +397,9 @@ static void adpcm_compress_trellis(AVCodecContext *avctx, const short *samples,
STORE_NODE(ms, FFMAX(16,
(ff_adpcm_AdaptationTable[nibble] * step) >> 8));
}
- } else if (version == CODEC_ID_ADPCM_IMA_WAV ||
- version == CODEC_ID_ADPCM_IMA_QT ||
- version == CODEC_ID_ADPCM_SWF) {
+ } else if (version == AV_CODEC_ID_ADPCM_IMA_WAV ||
+ version == AV_CODEC_ID_ADPCM_IMA_QT ||
+ version == AV_CODEC_ID_ADPCM_SWF) {
#define LOOP_NODES(NAME, STEP_TABLE, STEP_INDEX)\
const int predictor = nodes[j]->sample1;\
const int div = (sample - predictor) * 4 / STEP_TABLE;\
@@ -407,7 +418,7 @@ static void adpcm_compress_trellis(AVCodecContext *avctx, const short *samples,
}
LOOP_NODES(ima, ff_adpcm_step_table[step],
av_clip(step + ff_adpcm_index_table[nibble], 0, 88));
- } else { //CODEC_ID_ADPCM_YAMAHA
+ } else { //AV_CODEC_ID_ADPCM_YAMAHA
LOOP_NODES(yamaha, step,
av_clip((step * ff_adpcm_yamaha_indexscale[nibble]) >> 8,
127, 24567));
@@ -463,107 +474,98 @@ static void adpcm_compress_trellis(AVCodecContext *avctx, const short *samples,
c->idelta = nodes[0]->step;
}
-static int adpcm_encode_frame(AVCodecContext *avctx,
- unsigned char *frame, int buf_size, void *data)
+static int adpcm_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
+ const AVFrame *frame, int *got_packet_ptr)
{
- int n, i, st;
- short *samples;
- unsigned char *dst;
+ int n, i, ch, st, pkt_size, ret;
+ const int16_t *samples;
+ int16_t **samples_p;
+ uint8_t *dst;
ADPCMEncodeContext *c = avctx->priv_data;
uint8_t *buf;
- dst = frame;
- samples = (short *)data;
+ samples = (const int16_t *)frame->data[0];
+ samples_p = (int16_t **)frame->extended_data;
st = avctx->channels == 2;
- /* n = (BLKSIZE - 4 * avctx->channels) / (2 * 8 * avctx->channels); */
+
+ if (avctx->codec_id == AV_CODEC_ID_ADPCM_SWF)
+ pkt_size = (2 + avctx->channels * (22 + 4 * (frame->nb_samples - 1)) + 7) / 8;
+ else
+ pkt_size = avctx->block_align;
+ if ((ret = ff_alloc_packet(avpkt, pkt_size))) {
+ av_log(avctx, AV_LOG_ERROR, "Error getting output packet\n");
+ return ret;
+ }
+ dst = avpkt->data;
switch(avctx->codec->id) {
- case CODEC_ID_ADPCM_IMA_WAV:
- n = avctx->frame_size / 8;
- c->status[0].prev_sample = (signed short)samples[0]; /* XXX */
- /* c->status[0].step_index = 0;
- XXX: not sure how to init the state machine */
- bytestream_put_le16(&dst, c->status[0].prev_sample);
- *dst++ = (unsigned char)c->status[0].step_index;
- *dst++ = 0; /* unknown */
- samples++;
- if (avctx->channels == 2) {
- c->status[1].prev_sample = (signed short)samples[0];
- /* c->status[1].step_index = 0; */
- bytestream_put_le16(&dst, c->status[1].prev_sample);
- *dst++ = (unsigned char)c->status[1].step_index;
- *dst++ = 0;
- samples++;
+ case AV_CODEC_ID_ADPCM_IMA_WAV:
+ {
+ int blocks, j;
+
+ blocks = (frame->nb_samples - 1) / 8;
+
+ for (ch = 0; ch < avctx->channels; ch++) {
+ ADPCMChannelStatus *status = &c->status[ch];
+ status->prev_sample = samples_p[ch][0];
+ /* status->step_index = 0;
+ XXX: not sure how to init the state machine */
+ bytestream_put_le16(&dst, status->prev_sample);
+ *dst++ = status->step_index;
+ *dst++ = 0; /* unknown */
}
- /* stereo: 4 bytes (8 samples) for left,
- 4 bytes for right, 4 bytes left, ... */
+ /* stereo: 4 bytes (8 samples) for left, 4 bytes for right */
if (avctx->trellis > 0) {
- FF_ALLOC_OR_GOTO(avctx, buf, 2 * n * 8, error);
- adpcm_compress_trellis(avctx, samples, buf, &c->status[0], n * 8);
- if (avctx->channels == 2)
- adpcm_compress_trellis(avctx, samples + 1, buf + n * 8,
- &c->status[1], n * 8);
- for (i = 0; i < n; i++) {
- *dst++ = buf[8 * i + 0] | (buf[8 * i + 1] << 4);
- *dst++ = buf[8 * i + 2] | (buf[8 * i + 3] << 4);
- *dst++ = buf[8 * i + 4] | (buf[8 * i + 5] << 4);
- *dst++ = buf[8 * i + 6] | (buf[8 * i + 7] << 4);
- if (avctx->channels == 2) {
- uint8_t *buf1 = buf + n * 8;
- *dst++ = buf1[8 * i + 0] | (buf1[8 * i + 1] << 4);
- *dst++ = buf1[8 * i + 2] | (buf1[8 * i + 3] << 4);
- *dst++ = buf1[8 * i + 4] | (buf1[8 * i + 5] << 4);
- *dst++ = buf1[8 * i + 6] | (buf1[8 * i + 7] << 4);
+ FF_ALLOC_OR_GOTO(avctx, buf, avctx->channels * blocks * 8, error);
+ for (ch = 0; ch < avctx->channels; ch++) {
+ adpcm_compress_trellis(avctx, &samples_p[ch][1],
+ buf + ch * blocks * 8, &c->status[ch],
+ blocks * 8, 1);
+ }
+ for (i = 0; i < blocks; i++) {
+ for (ch = 0; ch < avctx->channels; ch++) {
+ uint8_t *buf1 = buf + ch * blocks * 8 + i * 8;
+ for (j = 0; j < 8; j += 2)
+ *dst++ = buf1[j] | (buf1[j + 1] << 4);
}
}
av_free(buf);
} else {
- for (; n > 0; n--) {
- *dst = adpcm_ima_compress_sample(&c->status[0], samples[0]);
- *dst++ |= adpcm_ima_compress_sample(&c->status[0], samples[avctx->channels ]) << 4;
- *dst = adpcm_ima_compress_sample(&c->status[0], samples[avctx->channels * 2]);
- *dst++ |= adpcm_ima_compress_sample(&c->status[0], samples[avctx->channels * 3]) << 4;
- *dst = adpcm_ima_compress_sample(&c->status[0], samples[avctx->channels * 4]);
- *dst++ |= adpcm_ima_compress_sample(&c->status[0], samples[avctx->channels * 5]) << 4;
- *dst = adpcm_ima_compress_sample(&c->status[0], samples[avctx->channels * 6]);
- *dst++ |= adpcm_ima_compress_sample(&c->status[0], samples[avctx->channels * 7]) << 4;
- /* right channel */
- if (avctx->channels == 2) {
- *dst = adpcm_ima_compress_sample(&c->status[1], samples[1 ]);
- *dst++ |= adpcm_ima_compress_sample(&c->status[1], samples[3 ]) << 4;
- *dst = adpcm_ima_compress_sample(&c->status[1], samples[5 ]);
- *dst++ |= adpcm_ima_compress_sample(&c->status[1], samples[7 ]) << 4;
- *dst = adpcm_ima_compress_sample(&c->status[1], samples[9 ]);
- *dst++ |= adpcm_ima_compress_sample(&c->status[1], samples[11]) << 4;
- *dst = adpcm_ima_compress_sample(&c->status[1], samples[13]);
- *dst++ |= adpcm_ima_compress_sample(&c->status[1], samples[15]) << 4;
+ for (i = 0; i < blocks; i++) {
+ for (ch = 0; ch < avctx->channels; ch++) {
+ ADPCMChannelStatus *status = &c->status[ch];
+ const int16_t *smp = &samples_p[ch][1 + i * 8];
+ for (j = 0; j < 8; j += 2) {
+ uint8_t v = adpcm_ima_compress_sample(status, smp[j ]);
+ v |= adpcm_ima_compress_sample(status, smp[j + 1]) << 4;
+ *dst++ = v;
+ }
}
- samples += 8 * avctx->channels;
}
}
break;
- case CODEC_ID_ADPCM_IMA_QT:
+ }
+ case AV_CODEC_ID_ADPCM_IMA_QT:
{
- int ch, i;
PutBitContext pb;
- init_put_bits(&pb, dst, buf_size * 8);
+ init_put_bits(&pb, dst, pkt_size * 8);
for (ch = 0; ch < avctx->channels; ch++) {
- put_bits(&pb, 9, (c->status[ch].prev_sample + 0x10000) >> 7);
- put_bits(&pb, 7, c->status[ch].step_index);
+ ADPCMChannelStatus *status = &c->status[ch];
+ put_bits(&pb, 9, (status->prev_sample & 0xFFFF) >> 7);
+ put_bits(&pb, 7, status->step_index);
if (avctx->trellis > 0) {
uint8_t buf[64];
- adpcm_compress_trellis(avctx, samples+ch, buf, &c->status[ch], 64);
+ adpcm_compress_trellis(avctx, &samples_p[ch][1], buf, status,
+ 64, 1);
for (i = 0; i < 64; i++)
put_bits(&pb, 4, buf[i ^ 1]);
} else {
for (i = 0; i < 64; i += 2) {
int t1, t2;
- t1 = adpcm_ima_qt_compress_sample(&c->status[ch],
- samples[avctx->channels * (i + 0) + ch]);
- t2 = adpcm_ima_qt_compress_sample(&c->status[ch],
- samples[avctx->channels * (i + 1) + ch]);
+ t1 = adpcm_ima_qt_compress_sample(status, samples_p[ch][i ]);
+ t2 = adpcm_ima_qt_compress_sample(status, samples_p[ch][i + 1]);
put_bits(&pb, 4, t2);
put_bits(&pb, 4, t1);
}
@@ -571,16 +573,14 @@ static int adpcm_encode_frame(AVCodecContext *avctx,
}
flush_put_bits(&pb);
- dst += put_bits_count(&pb) >> 3;
break;
}
- case CODEC_ID_ADPCM_SWF:
+ case AV_CODEC_ID_ADPCM_SWF:
{
- int i;
PutBitContext pb;
- init_put_bits(&pb, dst, buf_size * 8);
+ init_put_bits(&pb, dst, pkt_size * 8);
- n = avctx->frame_size - 1;
+ n = frame->nb_samples - 1;
// store AdpcmCodeSize
put_bits(&pb, 2, 2); // set 4-bit flash adpcm format
@@ -591,15 +591,17 @@ static int adpcm_encode_frame(AVCodecContext *avctx,
c->status[i].step_index = av_clip(c->status[i].step_index, 0, 63);
put_sbits(&pb, 16, samples[i]);
put_bits(&pb, 6, c->status[i].step_index);
- c->status[i].prev_sample = (signed short)samples[i];
+ c->status[i].prev_sample = samples[i];
}
if (avctx->trellis > 0) {
FF_ALLOC_OR_GOTO(avctx, buf, 2 * n, error);
- adpcm_compress_trellis(avctx, samples + 2, buf, &c->status[0], n);
+ adpcm_compress_trellis(avctx, samples + avctx->channels, buf,
+ &c->status[0], n, avctx->channels);
if (avctx->channels == 2)
- adpcm_compress_trellis(avctx, samples + 3, buf + n,
- &c->status[1], n);
+ adpcm_compress_trellis(avctx, samples + avctx->channels + 1,
+ buf + n, &c->status[1], n,
+ avctx->channels);
for (i = 0; i < n; i++) {
put_bits(&pb, 4, buf[i]);
if (avctx->channels == 2)
@@ -607,7 +609,7 @@ static int adpcm_encode_frame(AVCodecContext *avctx,
}
av_free(buf);
} else {
- for (i = 1; i < avctx->frame_size; i++) {
+ for (i = 1; i < frame->nb_samples; i++) {
put_bits(&pb, 4, adpcm_ima_compress_sample(&c->status[0],
samples[avctx->channels * i]));
if (avctx->channels == 2)
@@ -616,10 +618,9 @@ static int adpcm_encode_frame(AVCodecContext *avctx,
}
}
flush_put_bits(&pb);
- dst += put_bits_count(&pb) >> 3;
break;
}
- case CODEC_ID_ADPCM_MS:
+ case AV_CODEC_ID_ADPCM_MS:
for (i = 0; i < avctx->channels; i++) {
int predictor = 0;
*dst++ = predictor;
@@ -641,15 +642,18 @@ static int adpcm_encode_frame(AVCodecContext *avctx,
bytestream_put_le16(&dst, c->status[i].sample2);
if (avctx->trellis > 0) {
- int n = avctx->block_align - 7 * avctx->channels;
+ n = avctx->block_align - 7 * avctx->channels;
FF_ALLOC_OR_GOTO(avctx, buf, 2 * n, error);
if (avctx->channels == 1) {
- adpcm_compress_trellis(avctx, samples, buf, &c->status[0], n);
+ adpcm_compress_trellis(avctx, samples, buf, &c->status[0], n,
+ avctx->channels);
for (i = 0; i < n; i += 2)
*dst++ = (buf[i] << 4) | buf[i + 1];
} else {
- adpcm_compress_trellis(avctx, samples, buf, &c->status[0], n);
- adpcm_compress_trellis(avctx, samples + 1, buf + n, &c->status[1], n);
+ adpcm_compress_trellis(avctx, samples, buf,
+ &c->status[0], n, avctx->channels);
+ adpcm_compress_trellis(avctx, samples + 1, buf + n,
+ &c->status[1], n, avctx->channels);
for (i = 0; i < n; i++)
*dst++ = (buf[i] << 4) | buf[n + i];
}
@@ -663,18 +667,21 @@ static int adpcm_encode_frame(AVCodecContext *avctx,
}
}
break;
- case CODEC_ID_ADPCM_YAMAHA:
- n = avctx->frame_size / 2;
+ case AV_CODEC_ID_ADPCM_YAMAHA:
+ n = frame->nb_samples / 2;
if (avctx->trellis > 0) {
FF_ALLOC_OR_GOTO(avctx, buf, 2 * n * 2, error);
n *= 2;
if (avctx->channels == 1) {
- adpcm_compress_trellis(avctx, samples, buf, &c->status[0], n);
+ adpcm_compress_trellis(avctx, samples, buf, &c->status[0], n,
+ avctx->channels);
for (i = 0; i < n; i += 2)
*dst++ = buf[i] | (buf[i + 1] << 4);
} else {
- adpcm_compress_trellis(avctx, samples, buf, &c->status[0], n);
- adpcm_compress_trellis(avctx, samples + 1, buf + n, &c->status[1], n);
+ adpcm_compress_trellis(avctx, samples, buf,
+ &c->status[0], n, avctx->channels);
+ adpcm_compress_trellis(avctx, samples + 1, buf + n,
+ &c->status[1], n, avctx->channels);
for (i = 0; i < n; i++)
*dst++ = buf[i] | (buf[n + i] << 4);
}
@@ -688,29 +695,39 @@ static int adpcm_encode_frame(AVCodecContext *avctx,
}
break;
default:
- error:
- return -1;
+ return AVERROR(EINVAL);
}
- return dst - frame;
+
+ avpkt->size = pkt_size;
+ *got_packet_ptr = 1;
+ return 0;
+error:
+ return AVERROR(ENOMEM);
}
+static const enum AVSampleFormat sample_fmts[] = {
+ AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_NONE
+};
+
+static const enum AVSampleFormat sample_fmts_p[] = {
+ AV_SAMPLE_FMT_S16P, AV_SAMPLE_FMT_NONE
+};
-#define ADPCM_ENCODER(id_, name_, long_name_) \
+#define ADPCM_ENCODER(id_, name_, sample_fmts_, long_name_) \
AVCodec ff_ ## name_ ## _encoder = { \
.name = #name_, \
.type = AVMEDIA_TYPE_AUDIO, \
.id = id_, \
.priv_data_size = sizeof(ADPCMEncodeContext), \
.init = adpcm_encode_init, \
- .encode = adpcm_encode_frame, \
+ .encode2 = adpcm_encode_frame, \
.close = adpcm_encode_close, \
- .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_S16, \
- AV_SAMPLE_FMT_NONE}, \
+ .sample_fmts = sample_fmts_, \
.long_name = NULL_IF_CONFIG_SMALL(long_name_), \
}
-ADPCM_ENCODER(CODEC_ID_ADPCM_IMA_QT, adpcm_ima_qt, "ADPCM IMA QuickTime");
-ADPCM_ENCODER(CODEC_ID_ADPCM_IMA_WAV, adpcm_ima_wav, "ADPCM IMA WAV");
-ADPCM_ENCODER(CODEC_ID_ADPCM_MS, adpcm_ms, "ADPCM Microsoft");
-ADPCM_ENCODER(CODEC_ID_ADPCM_SWF, adpcm_swf, "ADPCM Shockwave Flash");
-ADPCM_ENCODER(CODEC_ID_ADPCM_YAMAHA, adpcm_yamaha, "ADPCM Yamaha");
+ADPCM_ENCODER(AV_CODEC_ID_ADPCM_IMA_QT, adpcm_ima_qt, sample_fmts_p, "ADPCM IMA QuickTime");
+ADPCM_ENCODER(AV_CODEC_ID_ADPCM_IMA_WAV, adpcm_ima_wav, sample_fmts_p, "ADPCM IMA WAV");
+ADPCM_ENCODER(AV_CODEC_ID_ADPCM_MS, adpcm_ms, sample_fmts, "ADPCM Microsoft");
+ADPCM_ENCODER(AV_CODEC_ID_ADPCM_SWF, adpcm_swf, sample_fmts, "ADPCM Shockwave Flash");
+ADPCM_ENCODER(AV_CODEC_ID_ADPCM_YAMAHA, adpcm_yamaha, sample_fmts, "ADPCM Yamaha");
diff --git a/gst-libs/ext/libav/libavcodec/adx.c b/gst-libs/ext/libav/libavcodec/adx.c
index 1e5d89c..870216c 100644
--- a/gst-libs/ext/libav/libavcodec/adx.c
+++ b/gst-libs/ext/libav/libavcodec/adx.c
@@ -18,6 +18,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "libavutil/common.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/mathematics.h"
#include "adx.h"
diff --git a/gst-libs/ext/libav/libavcodec/adx.h b/gst-libs/ext/libav/libavcodec/adx.h
index 92abe5f..47d9f24 100644
--- a/gst-libs/ext/libav/libavcodec/adx.h
+++ b/gst-libs/ext/libav/libavcodec/adx.h
@@ -35,11 +35,11 @@
#include "avcodec.h"
-typedef struct {
+typedef struct ADXChannelState {
int s1,s2;
} ADXChannelState;
-typedef struct {
+typedef struct ADXContext {
AVFrame frame;
int channels;
ADXChannelState prev[2];
diff --git a/gst-libs/ext/libav/libavcodec/adx_parser.c b/gst-libs/ext/libav/libavcodec/adx_parser.c
index de3b1b0..706e242 100644
--- a/gst-libs/ext/libav/libavcodec/adx_parser.c
+++ b/gst-libs/ext/libav/libavcodec/adx_parser.c
@@ -80,13 +80,16 @@ static int adx_parse(AVCodecParserContext *s1,
*poutbuf_size = 0;
return buf_size;
}
+
+ s1->duration = BLOCK_SAMPLES;
+
*poutbuf = buf;
*poutbuf_size = buf_size;
return next;
}
AVCodecParser ff_adx_parser = {
- .codec_ids = { CODEC_ID_ADPCM_ADX },
+ .codec_ids = { AV_CODEC_ID_ADPCM_ADX },
.priv_data_size = sizeof(ADXParseContext),
.parser_parse = adx_parse,
.parser_close = ff_parse_close,
diff --git a/gst-libs/ext/libav/libavcodec/adxdec.c b/gst-libs/ext/libav/libavcodec/adxdec.c
index 3f7f5f4..d8ea351 100644
--- a/gst-libs/ext/libav/libavcodec/adxdec.c
+++ b/gst-libs/ext/libav/libavcodec/adxdec.c
@@ -23,6 +23,7 @@
#include "avcodec.h"
#include "adx.h"
#include "get_bits.h"
+#include "internal.h"
/**
* @file
@@ -49,7 +50,7 @@ static av_cold int adx_decode_init(AVCodecContext *avctx)
c->header_parsed = 1;
}
- avctx->sample_fmt = AV_SAMPLE_FMT_S16;
+ avctx->sample_fmt = AV_SAMPLE_FMT_S16P;
avcodec_get_frame_defaults(&c->frame);
avctx->coded_frame = &c->frame;
@@ -64,7 +65,8 @@ static av_cold int adx_decode_init(AVCodecContext *avctx)
* 2nd-order LPC filter applied to it to form the output signal for a single
* channel.
*/
-static int adx_decode(ADXContext *c, int16_t *out, const uint8_t *in, int ch)
+static int adx_decode(ADXContext *c, int16_t *out, int offset,
+ const uint8_t *in, int ch)
{
ADXChannelState *prev = &c->prev[ch];
GetBitContext gb;
@@ -77,6 +79,7 @@ static int adx_decode(ADXContext *c, int16_t *out, const uint8_t *in, int ch)
return -1;
init_get_bits(&gb, in + 2, (BLOCK_SIZE - 2) * 8);
+ out += offset;
s1 = prev->s1;
s2 = prev->s2;
for (i = 0; i < BLOCK_SAMPLES; i++) {
@@ -84,8 +87,7 @@ static int adx_decode(ADXContext *c, int16_t *out, const uint8_t *in, int ch)
s0 = ((d << COEFF_BITS) * scale + c->coeff[0] * s1 + c->coeff[1] * s2) >> COEFF_BITS;
s2 = s1;
s1 = av_clip_int16(s0);
- *out = s1;
- out += c->channels;
+ *out++ = s1;
}
prev->s1 = s1;
prev->s2 = s2;
@@ -98,7 +100,8 @@ static int adx_decode_frame(AVCodecContext *avctx, void *data,
{
int buf_size = avpkt->size;
ADXContext *c = avctx->priv_data;
- int16_t *samples;
+ int16_t **samples;
+ int samples_offset;
const uint8_t *buf = avpkt->data;
int num_blocks, ch, ret;
@@ -140,15 +143,16 @@ static int adx_decode_frame(AVCodecContext *avctx, void *data,
/* get output buffer */
c->frame.nb_samples = num_blocks * BLOCK_SAMPLES;
- if ((ret = avctx->get_buffer(avctx, &c->frame)) < 0) {
+ if ((ret = ff_get_buffer(avctx, &c->frame)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return ret;
}
- samples = (int16_t *)c->frame.data[0];
+ samples = (int16_t **)c->frame.extended_data;
+ samples_offset = 0;
while (num_blocks--) {
for (ch = 0; ch < c->channels; ch++) {
- if (adx_decode(c, samples + ch, buf, ch)) {
+ if (adx_decode(c, samples[ch], samples_offset, buf, ch)) {
c->eof = 1;
buf = avpkt->data + avpkt->size;
break;
@@ -156,7 +160,7 @@ static int adx_decode_frame(AVCodecContext *avctx, void *data,
buf_size -= BLOCK_SIZE;
buf += BLOCK_SIZE;
}
- samples += BLOCK_SAMPLES * c->channels;
+ samples_offset += BLOCK_SAMPLES;
}
*got_frame_ptr = 1;
@@ -175,11 +179,13 @@ static void adx_decode_flush(AVCodecContext *avctx)
AVCodec ff_adpcm_adx_decoder = {
.name = "adpcm_adx",
.type = AVMEDIA_TYPE_AUDIO,
- .id = CODEC_ID_ADPCM_ADX,
+ .id = AV_CODEC_ID_ADPCM_ADX,
.priv_data_size = sizeof(ADXContext),
.init = adx_decode_init,
.decode = adx_decode_frame,
.flush = adx_decode_flush,
.capabilities = CODEC_CAP_DR1,
.long_name = NULL_IF_CONFIG_SMALL("SEGA CRI ADX ADPCM"),
+ .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_S16P,
+ AV_SAMPLE_FMT_NONE },
};
diff --git a/gst-libs/ext/libav/libavcodec/adxenc.c b/gst-libs/ext/libav/libavcodec/adxenc.c
index 20f2798..8a50539 100644
--- a/gst-libs/ext/libav/libavcodec/adxenc.c
+++ b/gst-libs/ext/libav/libavcodec/adxenc.c
@@ -22,6 +22,7 @@
#include "avcodec.h"
#include "adx.h"
#include "bytestream.h"
+#include "internal.h"
#include "put_bits.h"
/**
@@ -87,9 +88,6 @@ static int adx_encode_header(AVCodecContext *avctx, uint8_t *buf, int bufsize)
{
ADXContext *c = avctx->priv_data;
- if (bufsize < HEADER_SIZE)
- return AVERROR(EINVAL);
-
bytestream_put_be16(&buf, 0x8000); /* header signature */
bytestream_put_be16(&buf, HEADER_SIZE - 4); /* copyright offset */
bytestream_put_byte(&buf, 3); /* encoding */
@@ -119,7 +117,10 @@ static av_cold int adx_encode_init(AVCodecContext *avctx)
}
avctx->frame_size = BLOCK_SAMPLES;
- avctx->coded_frame = avcodec_alloc_frame();
+#if FF_API_OLD_ENCODE_AUDIO
+ avcodec_get_frame_defaults(&c->frame);
+ avctx->coded_frame = &c->frame;
+#endif
/* the cutoff can be adjusted, but this seems to work pretty well */
c->cutoff = 500;
@@ -128,50 +129,47 @@ static av_cold int adx_encode_init(AVCodecContext *avctx)
return 0;
}
-static av_cold int adx_encode_close(AVCodecContext *avctx)
-{
- av_freep(&avctx->coded_frame);
- return 0;
-}
-
-static int adx_encode_frame(AVCodecContext *avctx, uint8_t *frame,
- int buf_size, void *data)
+static int adx_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
+ const AVFrame *frame, int *got_packet_ptr)
{
ADXContext *c = avctx->priv_data;
- const int16_t *samples = data;
- uint8_t *dst = frame;
- int ch;
+ const int16_t *samples = (const int16_t *)frame->data[0];
+ uint8_t *dst;
+ int ch, out_size, ret;
+
+ out_size = BLOCK_SIZE * avctx->channels + !c->header_parsed * HEADER_SIZE;
+ if ((ret = ff_alloc_packet(avpkt, out_size)) < 0) {
+ av_log(avctx, AV_LOG_ERROR, "Error getting output packet\n");
+ return ret;
+ }
+ dst = avpkt->data;
if (!c->header_parsed) {
int hdrsize;
- if ((hdrsize = adx_encode_header(avctx, dst, buf_size)) < 0) {
+ if ((hdrsize = adx_encode_header(avctx, dst, avpkt->size)) < 0) {
av_log(avctx, AV_LOG_ERROR, "output buffer is too small\n");
return AVERROR(EINVAL);
}
dst += hdrsize;
- buf_size -= hdrsize;
c->header_parsed = 1;
}
- if (buf_size < BLOCK_SIZE * avctx->channels) {
- av_log(avctx, AV_LOG_ERROR, "output buffer is too small\n");
- return AVERROR(EINVAL);
- }
for (ch = 0; ch < avctx->channels; ch++) {
adx_encode(c, dst, samples + ch, &c->prev[ch], avctx->channels);
dst += BLOCK_SIZE;
}
- return dst - frame;
+
+ *got_packet_ptr = 1;
+ return 0;
}
AVCodec ff_adpcm_adx_encoder = {
.name = "adpcm_adx",
.type = AVMEDIA_TYPE_AUDIO,
- .id = CODEC_ID_ADPCM_ADX,
+ .id = AV_CODEC_ID_ADPCM_ADX,
.priv_data_size = sizeof(ADXContext),
.init = adx_encode_init,
- .encode = adx_encode_frame,
- .close = adx_encode_close,
+ .encode2 = adx_encode_frame,
.sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_S16,
AV_SAMPLE_FMT_NONE },
.long_name = NULL_IF_CONFIG_SMALL("SEGA CRI ADX ADPCM"),
diff --git a/gst-libs/ext/libav/libavcodec/alac.c b/gst-libs/ext/libav/libavcodec/alac.c
index da78908..1a3f769 100644
--- a/gst-libs/ext/libav/libavcodec/alac.c
+++ b/gst-libs/ext/libav/libavcodec/alac.c
@@ -37,7 +37,7 @@
* 8bit sample size
* 8bit history mult (40)
* 8bit initial history (14)
- * 8bit kmodifier (10)
+ * 8bit rice param limit (10)
* 8bit channels
* 16bit maxRun (255)
* 32bit max coded frame size (0 means unknown)
@@ -45,133 +45,107 @@
* 32bit samplerate
*/
-
+#include "libavutil/channel_layout.h"
#include "avcodec.h"
#include "get_bits.h"
#include "bytestream.h"
+#include "internal.h"
#include "unary.h"
#include "mathops.h"
+#include "alac_data.h"
#define ALAC_EXTRADATA_SIZE 36
-#define MAX_CHANNELS 2
typedef struct {
-
AVCodecContext *avctx;
AVFrame frame;
GetBitContext gb;
+ int channels;
- int numchannels;
-
- /* buffers */
- int32_t *predicterror_buffer[MAX_CHANNELS];
-
- int32_t *outputsamples_buffer[MAX_CHANNELS];
-
- int32_t *extra_bits_buffer[MAX_CHANNELS];
+ int32_t *predict_error_buffer[2];
+ int32_t *output_samples_buffer[2];
+ int32_t *extra_bits_buffer[2];
- /* stuff from setinfo */
- uint32_t setinfo_max_samples_per_frame; /* 0x1000 = 4096 */ /* max samples per frame? */
- uint8_t setinfo_sample_size; /* 0x10 */
- uint8_t setinfo_rice_historymult; /* 0x28 */
- uint8_t setinfo_rice_initialhistory; /* 0x0a */
- uint8_t setinfo_rice_kmodifier; /* 0x0e */
- /* end setinfo stuff */
+ uint32_t max_samples_per_frame;
+ uint8_t sample_size;
+ uint8_t rice_history_mult;
+ uint8_t rice_initial_history;
+ uint8_t rice_limit;
- int extra_bits; /**< number of extra bits beyond 16-bit */
+ int extra_bits; /**< number of extra bits beyond 16-bit */
+ int nb_samples; /**< number of samples in the current frame */
} ALACContext;
-static inline int decode_scalar(GetBitContext *gb, int k, int limit, int readsamplesize){
- /* read x - number of 1s before 0 represent the rice */
- int x = get_unary_0_9(gb);
+static inline unsigned int decode_scalar(GetBitContext *gb, int k, int bps)
+{
+ unsigned int x = get_unary_0_9(gb);
if (x > 8) { /* RICE THRESHOLD */
/* use alternative encoding */
- x = get_bits(gb, readsamplesize);
- } else {
- if (k >= limit)
- k = limit;
-
- if (k != 1) {
- int extrabits = show_bits(gb, k);
-
- /* multiply x by 2^k - 1, as part of their strange algorithm */
- x = (x << k) - x;
-
- if (extrabits > 1) {
- x += extrabits - 1;
- skip_bits(gb, k);
- } else
- skip_bits(gb, k - 1);
- }
+ x = get_bits_long(gb, bps);
+ } else if (k != 1) {
+ int extrabits = show_bits(gb, k);
+
+ /* multiply x by 2^k - 1, as part of their strange algorithm */
+ x = (x << k) - x;
+
+ if (extrabits > 1) {
+ x += extrabits - 1;
+ skip_bits(gb, k);
+ } else
+ skip_bits(gb, k - 1);
}
return x;
}
-static void bastardized_rice_decompress(ALACContext *alac,
- int32_t *output_buffer,
- int output_size,
- int readsamplesize, /* arg_10 */
- int rice_initialhistory, /* arg424->b */
- int rice_kmodifier, /* arg424->d */
- int rice_historymult, /* arg424->c */
- int rice_kmodifier_mask /* arg424->e */
- )
+static void rice_decompress(ALACContext *alac, int32_t *output_buffer,
+ int nb_samples, int bps, int rice_history_mult)
{
- int output_count;
- unsigned int history = rice_initialhistory;
+ int i;
+ unsigned int history = alac->rice_initial_history;
int sign_modifier = 0;
- for (output_count = 0; output_count < output_size; output_count++) {
- int32_t x;
- int32_t x_modified;
- int32_t final_val;
-
- /* standard rice encoding */
- int k; /* size of extra bits */
+ for (i = 0; i < nb_samples; i++) {
+ int k;
+ unsigned int x;
- /* read k, that is bits as is */
+ /* calculate rice param and decode next value */
k = av_log2((history >> 9) + 3);
- x= decode_scalar(&alac->gb, k, rice_kmodifier, readsamplesize);
-
- x_modified = sign_modifier + x;
- final_val = (x_modified + 1) / 2;
- if (x_modified & 1) final_val *= -1;
-
- output_buffer[output_count] = final_val;
-
+ k = FFMIN(k, alac->rice_limit);
+ x = decode_scalar(&alac->gb, k, bps);
+ x += sign_modifier;
sign_modifier = 0;
+ output_buffer[i] = (x >> 1) ^ -(x & 1);
- /* now update the history */
- history += x_modified * rice_historymult
- - ((history * rice_historymult) >> 9);
-
- if (x_modified > 0xffff)
+ /* update the history */
+ if (x > 0xffff)
history = 0xffff;
+ else
+ history += x * rice_history_mult -
+ ((history * rice_history_mult) >> 9);
/* special case: there may be compressed blocks of 0 */
- if ((history < 128) && (output_count+1 < output_size)) {
- int k;
- unsigned int block_size;
-
- sign_modifier = 1;
-
- k = 7 - av_log2(history) + ((history + 16) >> 6 /* / 64 */);
+ if ((history < 128) && (i + 1 < nb_samples)) {
+ int block_size;
- block_size= decode_scalar(&alac->gb, k, rice_kmodifier, 16);
+ /* calculate rice param and decode block size */
+ k = 7 - av_log2(history) + ((history + 16) >> 6);
+ k = FFMIN(k, alac->rice_limit);
+ block_size = decode_scalar(&alac->gb, k, 16);
if (block_size > 0) {
- if(block_size >= output_size - output_count){
- av_log(alac->avctx, AV_LOG_ERROR, "invalid zero block size of %d %d %d\n", block_size, output_size, output_count);
- block_size= output_size - output_count - 1;
+ if (block_size >= nb_samples - i) {
+ av_log(alac->avctx, AV_LOG_ERROR,
+ "invalid zero block size of %d %d %d\n", block_size,
+ nb_samples, i);
+ block_size = nb_samples - i - 1;
}
- memset(&output_buffer[output_count+1], 0, block_size * 4);
- output_count += block_size;
+ memset(&output_buffer[i + 1], 0,
+ block_size * sizeof(*output_buffer));
+ i += block_size;
}
-
- if (block_size > 0xffff)
- sign_modifier = 0;
-
+ if (block_size <= 0xffff)
+ sign_modifier = 1;
history = 0;
}
}
@@ -182,131 +156,81 @@ static inline int sign_only(int v)
return v ? FFSIGN(v) : 0;
}
-static void predictor_decompress_fir_adapt(int32_t *error_buffer,
- int32_t *buffer_out,
- int output_size,
- int readsamplesize,
- int16_t *predictor_coef_table,
- int predictor_coef_num,
- int predictor_quantitization)
+static void lpc_prediction(int32_t *error_buffer, int32_t *buffer_out,
+ int nb_samples, int bps, int16_t *lpc_coefs,
+ int lpc_order, int lpc_quant)
{
int i;
+ int32_t *pred = buffer_out;
/* first sample always copies */
*buffer_out = *error_buffer;
- if (!predictor_coef_num) {
- if (output_size <= 1)
- return;
+ if (nb_samples <= 1)
+ return;
- memcpy(buffer_out+1, error_buffer+1, (output_size-1) * 4);
+ if (!lpc_order) {
+ memcpy(&buffer_out[1], &error_buffer[1],
+ (nb_samples - 1) * sizeof(*buffer_out));
return;
}
- if (predictor_coef_num == 0x1f) { /* 11111 - max value of predictor_coef_num */
- /* second-best case scenario for fir decompression,
- * error describes a small difference from the previous sample only
- */
- if (output_size <= 1)
- return;
- for (i = 0; i < output_size - 1; i++) {
- int32_t prev_value;
- int32_t error_value;
-
- prev_value = buffer_out[i];
- error_value = error_buffer[i+1];
- buffer_out[i+1] =
- sign_extend((prev_value + error_value), readsamplesize);
+ if (lpc_order == 31) {
+ /* simple 1st-order prediction */
+ for (i = 1; i < nb_samples; i++) {
+ buffer_out[i] = sign_extend(buffer_out[i - 1] + error_buffer[i],
+ bps);
}
return;
}
/* read warm-up samples */
- if (predictor_coef_num > 0)
- for (i = 0; i < predictor_coef_num; i++) {
- int32_t val;
-
- val = buffer_out[i] + error_buffer[i+1];
- val = sign_extend(val, readsamplesize);
- buffer_out[i+1] = val;
- }
-
- /* 4 and 8 are very common cases (the only ones i've seen). these
- * should be unrolled and optimized
- */
-
- /* general case */
- if (predictor_coef_num > 0) {
- for (i = predictor_coef_num + 1; i < output_size; i++) {
- int j;
- int sum = 0;
- int outval;
- int error_val = error_buffer[i];
-
- for (j = 0; j < predictor_coef_num; j++) {
- sum += (buffer_out[predictor_coef_num-j] - buffer_out[0]) *
- predictor_coef_table[j];
+ for (i = 1; i <= lpc_order; i++)
+ buffer_out[i] = sign_extend(buffer_out[i - 1] + error_buffer[i], bps);
+
+ /* NOTE: 4 and 8 are very common cases that could be optimized. */
+
+ for (; i < nb_samples; i++) {
+ int j;
+ int val = 0;
+ int error_val = error_buffer[i];
+ int error_sign;
+ int d = *pred++;
+
+ /* LPC prediction */
+ for (j = 0; j < lpc_order; j++)
+ val += (pred[j] - d) * lpc_coefs[j];
+ val = (val + (1 << (lpc_quant - 1))) >> lpc_quant;
+ val += d + error_val;
+ buffer_out[i] = sign_extend(val, bps);
+
+ /* adapt LPC coefficients */
+ error_sign = sign_only(error_val);
+ if (error_sign) {
+ for (j = 0; j < lpc_order && error_val * error_sign > 0; j++) {
+ int sign;
+ val = d - pred[j];
+ sign = sign_only(val) * error_sign;
+ lpc_coefs[j] -= sign;
+ val *= sign;
+ error_val -= (val >> lpc_quant) * (j + 1);
}
-
- outval = (1 << (predictor_quantitization-1)) + sum;
- outval = outval >> predictor_quantitization;
- outval = outval + buffer_out[0] + error_val;
- outval = sign_extend(outval, readsamplesize);
-
- buffer_out[predictor_coef_num+1] = outval;
-
- if (error_val > 0) {
- int predictor_num = predictor_coef_num - 1;
-
- while (predictor_num >= 0 && error_val > 0) {
- int val = buffer_out[0] - buffer_out[predictor_coef_num - predictor_num];
- int sign = sign_only(val);
-
- predictor_coef_table[predictor_num] -= sign;
-
- val *= sign; /* absolute value */
-
- error_val -= ((val >> predictor_quantitization) *
- (predictor_coef_num - predictor_num));
-
- predictor_num--;
- }
- } else if (error_val < 0) {
- int predictor_num = predictor_coef_num - 1;
-
- while (predictor_num >= 0 && error_val < 0) {
- int val = buffer_out[0] - buffer_out[predictor_coef_num - predictor_num];
- int sign = - sign_only(val);
-
- predictor_coef_table[predictor_num] -= sign;
-
- val *= sign; /* neg value */
-
- error_val -= ((val >> predictor_quantitization) *
- (predictor_coef_num - predictor_num));
-
- predictor_num--;
- }
- }
-
- buffer_out++;
}
}
}
-static void decorrelate_stereo(int32_t *buffer[MAX_CHANNELS],
- int numsamples, uint8_t interlacing_shift,
- uint8_t interlacing_leftweight)
+static void decorrelate_stereo(int32_t *buffer[2], int nb_samples,
+ int decorr_shift, int decorr_left_weight)
{
int i;
- for (i = 0; i < numsamples; i++) {
+ for (i = 0; i < nb_samples; i++) {
int32_t a, b;
a = buffer[0][i];
b = buffer[1][i];
- a -= (b * interlacing_leftweight) >> interlacing_shift;
+ a -= (b * decorr_left_weight) >> decorr_shift;
b += a;
buffer[0][i] = b;
@@ -314,143 +238,98 @@ static void decorrelate_stereo(int32_t *buffer[MAX_CHANNELS],
}
}
-static void append_extra_bits(int32_t *buffer[MAX_CHANNELS],
- int32_t *extra_bits_buffer[MAX_CHANNELS],
- int extra_bits, int numchannels, int numsamples)
+static void append_extra_bits(int32_t *buffer[2], int32_t *extra_bits_buffer[2],
+ int extra_bits, int channels, int nb_samples)
{
int i, ch;
- for (ch = 0; ch < numchannels; ch++)
- for (i = 0; i < numsamples; i++)
+ for (ch = 0; ch < channels; ch++)
+ for (i = 0; i < nb_samples; i++)
buffer[ch][i] = (buffer[ch][i] << extra_bits) | extra_bits_buffer[ch][i];
}
-static void interleave_stereo_16(int32_t *buffer[MAX_CHANNELS],
- int16_t *buffer_out, int numsamples)
-{
- int i;
-
- for (i = 0; i < numsamples; i++) {
- *buffer_out++ = buffer[0][i];
- *buffer_out++ = buffer[1][i];
- }
-}
-
-static void interleave_stereo_24(int32_t *buffer[MAX_CHANNELS],
- int32_t *buffer_out, int numsamples)
-{
- int i;
-
- for (i = 0; i < numsamples; i++) {
- *buffer_out++ = buffer[0][i] << 8;
- *buffer_out++ = buffer[1][i] << 8;
- }
-}
-
-static int alac_decode_frame(AVCodecContext *avctx, void *data,
- int *got_frame_ptr, AVPacket *avpkt)
+static int decode_element(AVCodecContext *avctx, void *data, int ch_index,
+ int channels)
{
- const uint8_t *inbuffer = avpkt->data;
- int input_buffer_size = avpkt->size;
ALACContext *alac = avctx->priv_data;
+ int has_size, bps, is_compressed, decorr_shift, decorr_left_weight, ret;
+ uint32_t output_samples;
+ int i, ch;
- int channels;
- unsigned int outputsamples;
- int hassize;
- unsigned int readsamplesize;
- int isnotcompressed;
- uint8_t interlacing_shift;
- uint8_t interlacing_leftweight;
- int i, ch, ret;
-
- init_get_bits(&alac->gb, inbuffer, input_buffer_size * 8);
-
- channels = get_bits(&alac->gb, 3) + 1;
- if (channels != avctx->channels) {
- av_log(avctx, AV_LOG_ERROR, "frame header channel count mismatch\n");
- return AVERROR_INVALIDDATA;
- }
-
- /* 2^result = something to do with output waiting.
- * perhaps matters if we read > 1 frame in a pass?
- */
- skip_bits(&alac->gb, 4);
-
- skip_bits(&alac->gb, 12); /* unknown, skip 12 bits */
+ skip_bits(&alac->gb, 4); /* element instance tag */
+ skip_bits(&alac->gb, 12); /* unused header bits */
- /* the output sample size is stored soon */
- hassize = get_bits1(&alac->gb);
+ /* the number of output samples is stored in the frame */
+ has_size = get_bits1(&alac->gb);
alac->extra_bits = get_bits(&alac->gb, 2) << 3;
+ bps = alac->sample_size - alac->extra_bits + channels - 1;
+ if (bps > 32) {
+ av_log(avctx, AV_LOG_ERROR, "bps is unsupported: %d\n", bps);
+ return AVERROR_PATCHWELCOME;
+ }
/* whether the frame is compressed */
- isnotcompressed = get_bits1(&alac->gb);
-
- if (hassize) {
- /* now read the number of samples as a 32bit integer */
- outputsamples = get_bits_long(&alac->gb, 32);
- if(outputsamples > alac->setinfo_max_samples_per_frame){
- av_log(avctx, AV_LOG_ERROR, "outputsamples %d > %d\n", outputsamples, alac->setinfo_max_samples_per_frame);
- return -1;
- }
- } else
- outputsamples = alac->setinfo_max_samples_per_frame;
-
- /* get output buffer */
- if (outputsamples > INT32_MAX) {
- av_log(avctx, AV_LOG_ERROR, "unsupported block size: %u\n", outputsamples);
+ is_compressed = !get_bits1(&alac->gb);
+
+ if (has_size)
+ output_samples = get_bits_long(&alac->gb, 32);
+ else
+ output_samples = alac->max_samples_per_frame;
+ if (!output_samples || output_samples > alac->max_samples_per_frame) {
+ av_log(avctx, AV_LOG_ERROR, "invalid samples per frame: %d\n",
+ output_samples);
return AVERROR_INVALIDDATA;
}
- alac->frame.nb_samples = outputsamples;
- if ((ret = avctx->get_buffer(avctx, &alac->frame)) < 0) {
- av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
- return ret;
+ if (!alac->nb_samples) {
+ /* get output buffer */
+ alac->frame.nb_samples = output_samples;
+ if ((ret = ff_get_buffer(avctx, &alac->frame)) < 0) {
+ av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
+ return ret;
+ }
+ } else if (output_samples != alac->nb_samples) {
+ av_log(avctx, AV_LOG_ERROR, "sample count mismatch: %u != %d\n",
+ output_samples, alac->nb_samples);
+ return AVERROR_INVALIDDATA;
}
-
- readsamplesize = alac->setinfo_sample_size - alac->extra_bits + channels - 1;
- if (readsamplesize > MIN_CACHE_BITS) {
- av_log(avctx, AV_LOG_ERROR, "readsamplesize too big (%d)\n", readsamplesize);
- return -1;
+ alac->nb_samples = output_samples;
+ if (alac->sample_size > 16) {
+ for (ch = 0; ch < channels; ch++)
+ alac->output_samples_buffer[ch] = (int32_t *)alac->frame.extended_data[ch_index + ch];
}
- if (!isnotcompressed) {
- /* so it is compressed */
- int16_t predictor_coef_table[MAX_CHANNELS][32];
- int predictor_coef_num[MAX_CHANNELS];
- int prediction_type[MAX_CHANNELS];
- int prediction_quantitization[MAX_CHANNELS];
- int ricemodifier[MAX_CHANNELS];
+ if (is_compressed) {
+ int16_t lpc_coefs[2][32];
+ int lpc_order[2];
+ int prediction_type[2];
+ int lpc_quant[2];
+ int rice_history_mult[2];
- interlacing_shift = get_bits(&alac->gb, 8);
- interlacing_leftweight = get_bits(&alac->gb, 8);
+ decorr_shift = get_bits(&alac->gb, 8);
+ decorr_left_weight = get_bits(&alac->gb, 8);
for (ch = 0; ch < channels; ch++) {
- prediction_type[ch] = get_bits(&alac->gb, 4);
- prediction_quantitization[ch] = get_bits(&alac->gb, 4);
-
- ricemodifier[ch] = get_bits(&alac->gb, 3);
- predictor_coef_num[ch] = get_bits(&alac->gb, 5);
+ prediction_type[ch] = get_bits(&alac->gb, 4);
+ lpc_quant[ch] = get_bits(&alac->gb, 4);
+ rice_history_mult[ch] = get_bits(&alac->gb, 3);
+ lpc_order[ch] = get_bits(&alac->gb, 5);
/* read the predictor table */
- for (i = 0; i < predictor_coef_num[ch]; i++)
- predictor_coef_table[ch][i] = (int16_t)get_bits(&alac->gb, 16);
+ for (i = lpc_order[ch] - 1; i >= 0; i--)
+ lpc_coefs[ch][i] = get_sbits(&alac->gb, 16);
}
if (alac->extra_bits) {
- for (i = 0; i < outputsamples; i++) {
+ for (i = 0; i < alac->nb_samples; i++) {
for (ch = 0; ch < channels; ch++)
alac->extra_bits_buffer[ch][i] = get_bits(&alac->gb, alac->extra_bits);
}
}
for (ch = 0; ch < channels; ch++) {
- bastardized_rice_decompress(alac,
- alac->predicterror_buffer[ch],
- outputsamples,
- readsamplesize,
- alac->setinfo_rice_initialhistory,
- alac->setinfo_rice_kmodifier,
- ricemodifier[ch] * alac->setinfo_rice_historymult / 4,
- (1 << alac->setinfo_rice_kmodifier) - 1);
+ rice_decompress(alac, alac->predict_error_buffer[ch],
+ alac->nb_samples, bps,
+ rice_history_mult[ch] * alac->rice_history_mult / 4);
/* adaptive FIR filter */
if (prediction_type[ch] == 15) {
@@ -461,77 +340,111 @@ static int alac_decode_frame(AVCodecContext *avctx, void *data,
* However, this prediction type is not currently used by the
* reference encoder.
*/
- predictor_decompress_fir_adapt(alac->predicterror_buffer[ch],
- alac->predicterror_buffer[ch],
- outputsamples, readsamplesize,
- NULL, 31, 0);
+ lpc_prediction(alac->predict_error_buffer[ch],
+ alac->predict_error_buffer[ch],
+ alac->nb_samples, bps, NULL, 31, 0);
} else if (prediction_type[ch] > 0) {
av_log(avctx, AV_LOG_WARNING, "unknown prediction type: %i\n",
prediction_type[ch]);
}
- predictor_decompress_fir_adapt(alac->predicterror_buffer[ch],
- alac->outputsamples_buffer[ch],
- outputsamples, readsamplesize,
- predictor_coef_table[ch],
- predictor_coef_num[ch],
- prediction_quantitization[ch]);
+ lpc_prediction(alac->predict_error_buffer[ch],
+ alac->output_samples_buffer[ch], alac->nb_samples,
+ bps, lpc_coefs[ch], lpc_order[ch], lpc_quant[ch]);
}
} else {
/* not compressed, easy case */
- for (i = 0; i < outputsamples; i++) {
+ for (i = 0; i < alac->nb_samples; i++) {
for (ch = 0; ch < channels; ch++) {
- alac->outputsamples_buffer[ch][i] = get_sbits_long(&alac->gb,
- alac->setinfo_sample_size);
+ alac->output_samples_buffer[ch][i] =
+ get_sbits_long(&alac->gb, alac->sample_size);
}
}
- alac->extra_bits = 0;
- interlacing_shift = 0;
- interlacing_leftweight = 0;
+ alac->extra_bits = 0;
+ decorr_shift = 0;
+ decorr_left_weight = 0;
}
- if (get_bits(&alac->gb, 3) != 7)
- av_log(avctx, AV_LOG_ERROR, "Error : Wrong End Of Frame\n");
- if (channels == 2 && interlacing_leftweight) {
- decorrelate_stereo(alac->outputsamples_buffer, outputsamples,
- interlacing_shift, interlacing_leftweight);
+ if (channels == 2 && decorr_left_weight) {
+ decorrelate_stereo(alac->output_samples_buffer, alac->nb_samples,
+ decorr_shift, decorr_left_weight);
}
if (alac->extra_bits) {
- append_extra_bits(alac->outputsamples_buffer, alac->extra_bits_buffer,
- alac->extra_bits, alac->numchannels, outputsamples);
+ append_extra_bits(alac->output_samples_buffer, alac->extra_bits_buffer,
+ alac->extra_bits, channels, alac->nb_samples);
}
- switch(alac->setinfo_sample_size) {
- case 16:
- if (channels == 2) {
- interleave_stereo_16(alac->outputsamples_buffer,
- (int16_t *)alac->frame.data[0], outputsamples);
- } else {
- int16_t *outbuffer = (int16_t *)alac->frame.data[0];
- for (i = 0; i < outputsamples; i++) {
- outbuffer[i] = alac->outputsamples_buffer[0][i];
- }
- }
+ switch(alac->sample_size) {
+ case 16: {
+ for (ch = 0; ch < channels; ch++) {
+ int16_t *outbuffer = (int16_t *)alac->frame.extended_data[ch_index + ch];
+ for (i = 0; i < alac->nb_samples; i++)
+ *outbuffer++ = alac->output_samples_buffer[ch][i];
+ }}
break;
- case 24:
- if (channels == 2) {
- interleave_stereo_24(alac->outputsamples_buffer,
- (int32_t *)alac->frame.data[0], outputsamples);
- } else {
- int32_t *outbuffer = (int32_t *)alac->frame.data[0];
- for (i = 0; i < outputsamples; i++)
- outbuffer[i] = alac->outputsamples_buffer[0][i] << 8;
- }
+ case 24: {
+ for (ch = 0; ch < channels; ch++) {
+ for (i = 0; i < alac->nb_samples; i++)
+ alac->output_samples_buffer[ch][i] <<= 8;
+ }}
break;
}
- if (input_buffer_size * 8 - get_bits_count(&alac->gb) > 8)
- av_log(avctx, AV_LOG_ERROR, "Error : %d bits left\n", input_buffer_size * 8 - get_bits_count(&alac->gb));
+ return 0;
+}
+
+static int alac_decode_frame(AVCodecContext *avctx, void *data,
+ int *got_frame_ptr, AVPacket *avpkt)
+{
+ ALACContext *alac = avctx->priv_data;
+ enum AlacRawDataBlockType element;
+ int channels;
+ int ch, ret, got_end;
+
+ init_get_bits(&alac->gb, avpkt->data, avpkt->size * 8);
+
+ got_end = 0;
+ alac->nb_samples = 0;
+ ch = 0;
+ while (get_bits_left(&alac->gb) >= 3) {
+ element = get_bits(&alac->gb, 3);
+ if (element == TYPE_END) {
+ got_end = 1;
+ break;
+ }
+ if (element > TYPE_CPE && element != TYPE_LFE) {
+ av_log(avctx, AV_LOG_ERROR, "syntax element unsupported: %d", element);
+ return AVERROR_PATCHWELCOME;
+ }
+
+ channels = (element == TYPE_CPE) ? 2 : 1;
+ if (ch + channels > alac->channels) {
+ av_log(avctx, AV_LOG_ERROR, "invalid element channel count\n");
+ return AVERROR_INVALIDDATA;
+ }
+
+ ret = decode_element(avctx, data,
+ ff_alac_channel_layout_offsets[alac->channels - 1][ch],
+ channels);
+ if (ret < 0 && get_bits_left(&alac->gb))
+ return ret;
+
+ ch += channels;
+ }
+ if (!got_end) {
+ av_log(avctx, AV_LOG_ERROR, "no end tag found. incomplete packet.\n");
+ return AVERROR_INVALIDDATA;
+ }
+
+ if (avpkt->size * 8 - get_bits_count(&alac->gb) > 8) {
+ av_log(avctx, AV_LOG_ERROR, "Error : %d bits left\n",
+ avpkt->size * 8 - get_bits_count(&alac->gb));
+ }
*got_frame_ptr = 1;
*(AVFrame *)data = alac->frame;
- return input_buffer_size;
+ return avpkt->size;
}
static av_cold int alac_decode_close(AVCodecContext *avctx)
@@ -539,9 +452,10 @@ static av_cold int alac_decode_close(AVCodecContext *avctx)
ALACContext *alac = avctx->priv_data;
int ch;
- for (ch = 0; ch < alac->numchannels; ch++) {
- av_freep(&alac->predicterror_buffer[ch]);
- av_freep(&alac->outputsamples_buffer[ch]);
+ for (ch = 0; ch < FFMIN(alac->channels, 2); ch++) {
+ av_freep(&alac->predict_error_buffer[ch]);
+ if (alac->sample_size == 16)
+ av_freep(&alac->output_samples_buffer[ch]);
av_freep(&alac->extra_bits_buffer[ch]);
}
@@ -551,14 +465,16 @@ static av_cold int alac_decode_close(AVCodecContext *avctx)
static int allocate_buffers(ALACContext *alac)
{
int ch;
- for (ch = 0; ch < alac->numchannels; ch++) {
- int buf_size = alac->setinfo_max_samples_per_frame * sizeof(int32_t);
+ int buf_size = alac->max_samples_per_frame * sizeof(int32_t);
- FF_ALLOC_OR_GOTO(alac->avctx, alac->predicterror_buffer[ch],
+ for (ch = 0; ch < FFMIN(alac->channels, 2); ch++) {
+ FF_ALLOC_OR_GOTO(alac->avctx, alac->predict_error_buffer[ch],
buf_size, buf_alloc_fail);
- FF_ALLOC_OR_GOTO(alac->avctx, alac->outputsamples_buffer[ch],
- buf_size, buf_alloc_fail);
+ if (alac->sample_size == 16) {
+ FF_ALLOC_OR_GOTO(alac->avctx, alac->output_samples_buffer[ch],
+ buf_size, buf_alloc_fail);
+ }
FF_ALLOC_OR_GOTO(alac->avctx, alac->extra_bits_buffer[ch],
buf_size, buf_alloc_fail);
@@ -571,29 +487,29 @@ buf_alloc_fail:
static int alac_set_info(ALACContext *alac)
{
- const unsigned char *ptr = alac->avctx->extradata;
+ GetByteContext gb;
- ptr += 4; /* size */
- ptr += 4; /* alac */
- ptr += 4; /* version */
+ bytestream2_init(&gb, alac->avctx->extradata,
+ alac->avctx->extradata_size);
- if(AV_RB32(ptr) >= UINT_MAX/4){
- av_log(alac->avctx, AV_LOG_ERROR, "setinfo_max_samples_per_frame too large\n");
- return -1;
- }
+ bytestream2_skipu(&gb, 12); // size:4, alac:4, version:4
- /* buffer size / 2 ? */
- alac->setinfo_max_samples_per_frame = bytestream_get_be32(&ptr);
- ptr++; /* compatible version */
- alac->setinfo_sample_size = *ptr++;
- alac->setinfo_rice_historymult = *ptr++;
- alac->setinfo_rice_initialhistory = *ptr++;
- alac->setinfo_rice_kmodifier = *ptr++;
- alac->numchannels = *ptr++;
- bytestream_get_be16(&ptr); /* maxRun */
- bytestream_get_be32(&ptr); /* max coded frame size */
- bytestream_get_be32(&ptr); /* average bitrate */
- bytestream_get_be32(&ptr); /* samplerate */
+ alac->max_samples_per_frame = bytestream2_get_be32u(&gb);
+ if (!alac->max_samples_per_frame || alac->max_samples_per_frame > INT_MAX) {
+ av_log(alac->avctx, AV_LOG_ERROR, "max samples per frame invalid: %u\n",
+ alac->max_samples_per_frame);
+ return AVERROR_INVALIDDATA;
+ }
+ bytestream2_skipu(&gb, 1); // compatible version
+ alac->sample_size = bytestream2_get_byteu(&gb);
+ alac->rice_history_mult = bytestream2_get_byteu(&gb);
+ alac->rice_initial_history = bytestream2_get_byteu(&gb);
+ alac->rice_limit = bytestream2_get_byteu(&gb);
+ alac->channels = bytestream2_get_byteu(&gb);
+ bytestream2_get_be16u(&gb); // maxRun
+ bytestream2_get_be32u(&gb); // max coded frame size
+ bytestream2_get_be32u(&gb); // average bitrate
+ bytestream2_get_be32u(&gb); // samplerate
return 0;
}
@@ -614,30 +530,33 @@ static av_cold int alac_decode_init(AVCodecContext * avctx)
return -1;
}
- switch (alac->setinfo_sample_size) {
- case 16: avctx->sample_fmt = AV_SAMPLE_FMT_S16;
+ switch (alac->sample_size) {
+ case 16: avctx->sample_fmt = AV_SAMPLE_FMT_S16P;
break;
- case 24: avctx->sample_fmt = AV_SAMPLE_FMT_S32;
+ case 24:
+ case 32: avctx->sample_fmt = AV_SAMPLE_FMT_S32P;
break;
default: av_log_ask_for_sample(avctx, "Sample depth %d is not supported.\n",
- alac->setinfo_sample_size);
+ alac->sample_size);
return AVERROR_PATCHWELCOME;
}
+ avctx->bits_per_raw_sample = alac->sample_size;
- if (alac->numchannels < 1) {
+ if (alac->channels < 1) {
av_log(avctx, AV_LOG_WARNING, "Invalid channel count\n");
- alac->numchannels = avctx->channels;
+ alac->channels = avctx->channels;
} else {
- if (alac->numchannels > MAX_CHANNELS)
- alac->numchannels = avctx->channels;
+ if (alac->channels > ALAC_MAX_CHANNELS)
+ alac->channels = avctx->channels;
else
- avctx->channels = alac->numchannels;
+ avctx->channels = alac->channels;
}
- if (avctx->channels > MAX_CHANNELS) {
+ if (avctx->channels > ALAC_MAX_CHANNELS) {
av_log(avctx, AV_LOG_ERROR, "Unsupported channel count: %d\n",
avctx->channels);
return AVERROR_PATCHWELCOME;
}
+ avctx->channel_layout = ff_alac_channel_layouts[alac->channels - 1];
if ((ret = allocate_buffers(alac)) < 0) {
av_log(avctx, AV_LOG_ERROR, "Error allocating buffers\n");
@@ -653,11 +572,11 @@ static av_cold int alac_decode_init(AVCodecContext * avctx)
AVCodec ff_alac_decoder = {
.name = "alac",
.type = AVMEDIA_TYPE_AUDIO,
- .id = CODEC_ID_ALAC,
+ .id = AV_CODEC_ID_ALAC,
.priv_data_size = sizeof(ALACContext),
.init = alac_decode_init,
.close = alac_decode_close,
.decode = alac_decode_frame,
.capabilities = CODEC_CAP_DR1,
- .long_name = NULL_IF_CONFIG_SMALL("ALAC (Apple Lossless Audio Codec)"),
+ .long_name = NULL_IF_CONFIG_SMALL("ALAC (Apple Lossless Audio Codec)"),
};
diff --git a/gst-libs/ext/libav/libavcodec/alac_data.c b/gst-libs/ext/libav/libavcodec/alac_data.c
new file mode 100644
index 0000000..9e13119
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/alac_data.c
@@ -0,0 +1,56 @@
+/*
+ * ALAC encoder and decoder common data
+ *
+ * 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
+ */
+
+#include "libavutil/channel_layout.h"
+#include "alac_data.h"
+
+const uint8_t ff_alac_channel_layout_offsets[ALAC_MAX_CHANNELS][ALAC_MAX_CHANNELS] = {
+ { 0 },
+ { 0, 1 },
+ { 2, 0, 1 },
+ { 2, 0, 1, 3 },
+ { 2, 0, 1, 3, 4 },
+ { 2, 0, 1, 4, 5, 3 },
+ { 2, 0, 1, 4, 5, 6, 3 },
+ { 2, 6, 7, 0, 1, 4, 5, 3 }
+};
+
+const uint64_t ff_alac_channel_layouts[ALAC_MAX_CHANNELS + 1] = {
+ AV_CH_LAYOUT_MONO,
+ AV_CH_LAYOUT_STEREO,
+ AV_CH_LAYOUT_SURROUND,
+ AV_CH_LAYOUT_4POINT0,
+ AV_CH_LAYOUT_5POINT0_BACK,
+ AV_CH_LAYOUT_5POINT1_BACK,
+ AV_CH_LAYOUT_6POINT1_BACK,
+ AV_CH_LAYOUT_7POINT1_WIDE_BACK,
+ 0
+};
+
+const enum AlacRawDataBlockType ff_alac_channel_elements[ALAC_MAX_CHANNELS][5] = {
+ { TYPE_SCE, },
+ { TYPE_CPE, },
+ { TYPE_SCE, TYPE_CPE, },
+ { TYPE_SCE, TYPE_CPE, TYPE_SCE },
+ { TYPE_SCE, TYPE_CPE, TYPE_CPE, },
+ { TYPE_SCE, TYPE_CPE, TYPE_CPE, TYPE_SCE, },
+ { TYPE_SCE, TYPE_CPE, TYPE_CPE, TYPE_SCE, TYPE_SCE, },
+ { TYPE_SCE, TYPE_CPE, TYPE_CPE, TYPE_CPE, TYPE_SCE, },
+};
diff --git a/gst-libs/ext/libav/libavcodec/alac_data.h b/gst-libs/ext/libav/libavcodec/alac_data.h
new file mode 100644
index 0000000..ebb1f33
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/alac_data.h
@@ -0,0 +1,46 @@
+/*
+ * ALAC encoder and decoder common data
+ *
+ * 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
+ */
+
+#ifndef AVCODEC_ALAC_DATA_H
+#define AVCODEC_ALAC_DATA_H
+
+#include <stdint.h>
+
+enum AlacRawDataBlockType {
+ /* At the moment, only SCE, CPE, LFE, and END are recognized. */
+ TYPE_SCE,
+ TYPE_CPE,
+ TYPE_CCE,
+ TYPE_LFE,
+ TYPE_DSE,
+ TYPE_PCE,
+ TYPE_FIL,
+ TYPE_END
+};
+
+#define ALAC_MAX_CHANNELS 8
+
+extern const uint8_t ff_alac_channel_layout_offsets[ALAC_MAX_CHANNELS][ALAC_MAX_CHANNELS];
+
+extern const uint64_t ff_alac_channel_layouts[ALAC_MAX_CHANNELS + 1];
+
+extern const enum AlacRawDataBlockType ff_alac_channel_elements[ALAC_MAX_CHANNELS][5];
+
+#endif /* AVCODEC_ALAC_DATA_H */
diff --git a/gst-libs/ext/libav/libavcodec/alacenc.c b/gst-libs/ext/libav/libavcodec/alacenc.c
index 89d8e09..3bc920a 100644
--- a/gst-libs/ext/libav/libavcodec/alacenc.c
+++ b/gst-libs/ext/libav/libavcodec/alacenc.c
@@ -1,4 +1,4 @@
-/**
+/*
* ALAC audio encoder
* Copyright (c) 2008 Jaikrishnan Menon <realityman@gmx.net>
*
@@ -22,12 +22,12 @@
#include "avcodec.h"
#include "put_bits.h"
#include "dsputil.h"
+#include "internal.h"
#include "lpc.h"
#include "mathops.h"
+#include "alac_data.h"
#define DEFAULT_FRAME_SIZE 4096
-#define DEFAULT_SAMPLE_SIZE 16
-#define MAX_CHANNELS 8
#define ALAC_EXTRADATA_SIZE 36
#define ALAC_FRAME_HEADER_SIZE 55
#define ALAC_FRAME_FOOTER_SIZE 3
@@ -58,35 +58,46 @@ typedef struct AlacLPCContext {
} AlacLPCContext;
typedef struct AlacEncodeContext {
+ int frame_size; /**< current frame size */
+ int verbatim; /**< current frame verbatim mode flag */
int compression_level;
int min_prediction_order;
int max_prediction_order;
int max_coded_frame_size;
int write_sample_size;
- int32_t sample_buf[MAX_CHANNELS][DEFAULT_FRAME_SIZE];
+ int extra_bits;
+ int32_t sample_buf[2][DEFAULT_FRAME_SIZE];
int32_t predictor_buf[DEFAULT_FRAME_SIZE];
int interlacing_shift;
int interlacing_leftweight;
PutBitContext pbctx;
RiceContext rc;
- AlacLPCContext lpc[MAX_CHANNELS];
+ AlacLPCContext lpc[2];
LPCContext lpc_ctx;
AVCodecContext *avctx;
} AlacEncodeContext;
-static void init_sample_buffers(AlacEncodeContext *s,
- const int16_t *input_samples)
+static void init_sample_buffers(AlacEncodeContext *s, int channels,
+ uint8_t const *samples[2])
{
int ch, i;
-
- for (ch = 0; ch < s->avctx->channels; ch++) {
- const int16_t *sptr = input_samples + ch;
- for (i = 0; i < s->avctx->frame_size; i++) {
- s->sample_buf[ch][i] = *sptr;
- sptr += s->avctx->channels;
- }
- }
+ int shift = av_get_bytes_per_sample(s->avctx->sample_fmt) * 8 -
+ s->avctx->bits_per_raw_sample;
+
+#define COPY_SAMPLES(type) do { \
+ for (ch = 0; ch < channels; ch++) { \
+ int32_t *bptr = s->sample_buf[ch]; \
+ const type *sptr = (const type *)samples[ch]; \
+ for (i = 0; i < s->frame_size; i++) \
+ bptr[i] = sptr[i] >> shift; \
+ } \
+ } while (0)
+
+ if (s->avctx->sample_fmt == AV_SAMPLE_FMT_S32P)
+ COPY_SAMPLES(int32_t);
+ else
+ COPY_SAMPLES(int16_t);
}
static void encode_scalar(AlacEncodeContext *s, int x,
@@ -117,14 +128,23 @@ static void encode_scalar(AlacEncodeContext *s, int x,
}
}
-static void write_frame_header(AlacEncodeContext *s, int is_verbatim)
+static void write_element_header(AlacEncodeContext *s,
+ enum AlacRawDataBlockType element,
+ int instance)
{
- put_bits(&s->pbctx, 3, s->avctx->channels-1); // No. of channels -1
- put_bits(&s->pbctx, 16, 0); // Seems to be zero
- put_bits(&s->pbctx, 1, 1); // Sample count is in the header
- put_bits(&s->pbctx, 2, 0); // FIXME: Wasted bytes field
- put_bits(&s->pbctx, 1, is_verbatim); // Audio block is verbatim
- put_bits32(&s->pbctx, s->avctx->frame_size); // No. of samples in the frame
+ int encode_fs = 0;
+
+ if (s->frame_size < DEFAULT_FRAME_SIZE)
+ encode_fs = 1;
+
+ put_bits(&s->pbctx, 3, element); // element type
+ put_bits(&s->pbctx, 4, instance); // element instance
+ put_bits(&s->pbctx, 12, 0); // unused header bits
+ put_bits(&s->pbctx, 1, encode_fs); // Sample count is in the header
+ put_bits(&s->pbctx, 2, s->extra_bits >> 3); // Extra bytes (for 24-bit)
+ put_bits(&s->pbctx, 1, s->verbatim); // Audio block is verbatim
+ if (encode_fs)
+ put_bits32(&s->pbctx, s->frame_size); // No. of samples in the frame
}
static void calc_predictor_params(AlacEncodeContext *s, int ch)
@@ -144,7 +164,7 @@ static void calc_predictor_params(AlacEncodeContext *s, int ch)
s->lpc[ch].lpc_coeff[5] = -25;
} else {
opt_order = ff_lpc_calc_coefs(&s->lpc_ctx, s->sample_buf[ch],
- s->avctx->frame_size,
+ s->frame_size,
s->min_prediction_order,
s->max_prediction_order,
ALAC_MAX_LPC_PRECISION, coefs, shift,
@@ -167,8 +187,8 @@ static int estimate_stereo_mode(int32_t *left_ch, int32_t *right_ch, int n)
/* calculate sum of 2nd order residual for each channel */
sum[0] = sum[1] = sum[2] = sum[3] = 0;
for (i = 2; i < n; i++) {
- lt = left_ch[i] - 2*left_ch[i-1] + left_ch[i-2];
- rt = right_ch[i] - 2*right_ch[i-1] + right_ch[i-2];
+ lt = left_ch[i] - 2 * left_ch[i - 1] + left_ch[i - 2];
+ rt = right_ch[i] - 2 * right_ch[i - 1] + right_ch[i - 2];
sum[2] += FFABS((lt + rt) >> 1);
sum[3] += FFABS(lt - rt);
sum[0] += FFABS(lt);
@@ -184,9 +204,8 @@ static int estimate_stereo_mode(int32_t *left_ch, int32_t *right_ch, int n)
/* return mode with lowest score */
best = 0;
for (i = 1; i < 4; i++) {
- if (score[i] < score[best]) {
+ if (score[i] < score[best])
best = i;
- }
}
return best;
}
@@ -194,45 +213,40 @@ static int estimate_stereo_mode(int32_t *left_ch, int32_t *right_ch, int n)
static void alac_stereo_decorrelation(AlacEncodeContext *s)
{
int32_t *left = s->sample_buf[0], *right = s->sample_buf[1];
- int i, mode, n = s->avctx->frame_size;
+ int i, mode, n = s->frame_size;
int32_t tmp;
mode = estimate_stereo_mode(left, right, n);
- switch(mode)
- {
- case ALAC_CHMODE_LEFT_RIGHT:
- s->interlacing_leftweight = 0;
- s->interlacing_shift = 0;
- break;
-
- case ALAC_CHMODE_LEFT_SIDE:
- for (i = 0; i < n; i++) {
- right[i] = left[i] - right[i];
- }
- s->interlacing_leftweight = 1;
- s->interlacing_shift = 0;
- break;
-
- case ALAC_CHMODE_RIGHT_SIDE:
- for (i = 0; i < n; i++) {
- tmp = right[i];
- right[i] = left[i] - right[i];
- left[i] = tmp + (right[i] >> 31);
- }
- s->interlacing_leftweight = 1;
- s->interlacing_shift = 31;
- break;
-
- default:
- for (i = 0; i < n; i++) {
- tmp = left[i];
- left[i] = (tmp + right[i]) >> 1;
- right[i] = tmp - right[i];
- }
- s->interlacing_leftweight = 1;
- s->interlacing_shift = 1;
- break;
+ switch (mode) {
+ case ALAC_CHMODE_LEFT_RIGHT:
+ s->interlacing_leftweight = 0;
+ s->interlacing_shift = 0;
+ break;
+ case ALAC_CHMODE_LEFT_SIDE:
+ for (i = 0; i < n; i++)
+ right[i] = left[i] - right[i];
+ s->interlacing_leftweight = 1;
+ s->interlacing_shift = 0;
+ break;
+ case ALAC_CHMODE_RIGHT_SIDE:
+ for (i = 0; i < n; i++) {
+ tmp = right[i];
+ right[i] = left[i] - right[i];
+ left[i] = tmp + (right[i] >> 31);
+ }
+ s->interlacing_leftweight = 1;
+ s->interlacing_shift = 31;
+ break;
+ default:
+ for (i = 0; i < n; i++) {
+ tmp = left[i];
+ left[i] = (tmp + right[i]) >> 1;
+ right[i] = tmp - right[i];
+ }
+ s->interlacing_leftweight = 1;
+ s->interlacing_shift = 1;
+ break;
}
}
@@ -244,8 +258,10 @@ static void alac_linear_predictor(AlacEncodeContext *s, int ch)
if (lpc.lpc_order == 31) {
s->predictor_buf[0] = s->sample_buf[ch][0];
- for (i = 1; i < s->avctx->frame_size; i++)
- s->predictor_buf[i] = s->sample_buf[ch][i] - s->sample_buf[ch][i-1];
+ for (i = 1; i < s->frame_size; i++) {
+ s->predictor_buf[i] = s->sample_buf[ch][i ] -
+ s->sample_buf[ch][i - 1];
+ }
return;
}
@@ -262,12 +278,12 @@ static void alac_linear_predictor(AlacEncodeContext *s, int ch)
residual[i] = samples[i] - samples[i-1];
// perform lpc on remaining samples
- for (i = lpc.lpc_order + 1; i < s->avctx->frame_size; i++) {
+ for (i = lpc.lpc_order + 1; i < s->frame_size; i++) {
int sum = 1 << (lpc.lpc_quant - 1), res_val, j;
for (j = 0; j < lpc.lpc_order; j++) {
sum += (samples[lpc.lpc_order-j] - samples[0]) *
- lpc.lpc_coeff[j];
+ lpc.lpc_coeff[j];
}
sum >>= lpc.lpc_quant;
@@ -276,21 +292,20 @@ static void alac_linear_predictor(AlacEncodeContext *s, int ch)
s->write_sample_size);
res_val = residual[i];
- if(res_val) {
+ if (res_val) {
int index = lpc.lpc_order - 1;
int neg = (res_val < 0);
- while(index >= 0 && (neg ? (res_val < 0):(res_val > 0))) {
- int val = samples[0] - samples[lpc.lpc_order - index];
+ while (index >= 0 && (neg ? (res_val < 0) : (res_val > 0))) {
+ int val = samples[0] - samples[lpc.lpc_order - index];
int sign = (val ? FFSIGN(val) : 0);
- if(neg)
- sign*=-1;
+ if (neg)
+ sign *= -1;
lpc.lpc_coeff[index] -= sign;
val *= sign;
- res_val -= ((val >> lpc.lpc_quant) *
- (lpc.lpc_order - index));
+ res_val -= (val >> lpc.lpc_quant) * (lpc.lpc_order - index);
index--;
}
}
@@ -305,107 +320,189 @@ static void alac_entropy_coder(AlacEncodeContext *s)
int sign_modifier = 0, i, k;
int32_t *samples = s->predictor_buf;
- for (i = 0; i < s->avctx->frame_size;) {
+ for (i = 0; i < s->frame_size;) {
int x;
k = av_log2((history >> 9) + 3);
- x = -2*(*samples)-1;
- x ^= (x>>31);
+ x = -2 * (*samples) -1;
+ x ^= x >> 31;
samples++;
i++;
encode_scalar(s, x - sign_modifier, k, s->write_sample_size);
- history += x * s->rc.history_mult
- - ((history * s->rc.history_mult) >> 9);
+ history += x * s->rc.history_mult -
+ ((history * s->rc.history_mult) >> 9);
sign_modifier = 0;
if (x > 0xFFFF)
history = 0xFFFF;
- if (history < 128 && i < s->avctx->frame_size) {
+ if (history < 128 && i < s->frame_size) {
unsigned int block_size = 0;
k = 7 - av_log2(history) + ((history + 16) >> 6);
- while (*samples == 0 && i < s->avctx->frame_size) {
+ while (*samples == 0 && i < s->frame_size) {
samples++;
i++;
block_size++;
}
encode_scalar(s, block_size, k, 16);
-
sign_modifier = (block_size <= 0xFFFF);
-
history = 0;
}
}
}
-static void write_compressed_frame(AlacEncodeContext *s)
+static void write_element(AlacEncodeContext *s,
+ enum AlacRawDataBlockType element, int instance,
+ const uint8_t *samples0, const uint8_t *samples1)
{
- int i, j;
+ uint8_t const *samples[2] = { samples0, samples1 };
+ int i, j, channels;
int prediction_type = 0;
+ PutBitContext *pb = &s->pbctx;
- if (s->avctx->channels == 2)
- alac_stereo_decorrelation(s);
- put_bits(&s->pbctx, 8, s->interlacing_shift);
- put_bits(&s->pbctx, 8, s->interlacing_leftweight);
+ channels = element == TYPE_CPE ? 2 : 1;
+
+ if (s->verbatim) {
+ write_element_header(s, element, instance);
+ /* samples are channel-interleaved in verbatim mode */
+ if (s->avctx->sample_fmt == AV_SAMPLE_FMT_S32P) {
+ int shift = 32 - s->avctx->bits_per_raw_sample;
+ int32_t const *samples_s32[2] = { (const int32_t *)samples0,
+ (const int32_t *)samples1 };
+ for (i = 0; i < s->frame_size; i++)
+ for (j = 0; j < channels; j++)
+ put_sbits(pb, s->avctx->bits_per_raw_sample,
+ samples_s32[j][i] >> shift);
+ } else {
+ int16_t const *samples_s16[2] = { (const int16_t *)samples0,
+ (const int16_t *)samples1 };
+ for (i = 0; i < s->frame_size; i++)
+ for (j = 0; j < channels; j++)
+ put_sbits(pb, s->avctx->bits_per_raw_sample,
+ samples_s16[j][i]);
+ }
+ } else {
+ s->write_sample_size = s->avctx->bits_per_raw_sample - s->extra_bits +
+ channels - 1;
+
+ init_sample_buffers(s, channels, samples);
+ write_element_header(s, element, instance);
+
+ if (channels == 2)
+ alac_stereo_decorrelation(s);
+ else
+ s->interlacing_shift = s->interlacing_leftweight = 0;
+ put_bits(pb, 8, s->interlacing_shift);
+ put_bits(pb, 8, s->interlacing_leftweight);
+
+ for (i = 0; i < channels; i++) {
+ calc_predictor_params(s, i);
+
+ put_bits(pb, 4, prediction_type);
+ put_bits(pb, 4, s->lpc[i].lpc_quant);
+
+ put_bits(pb, 3, s->rc.rice_modifier);
+ put_bits(pb, 5, s->lpc[i].lpc_order);
+ // predictor coeff. table
+ for (j = 0; j < s->lpc[i].lpc_order; j++)
+ put_sbits(pb, 16, s->lpc[i].lpc_coeff[j]);
+ }
- for (i = 0; i < s->avctx->channels; i++) {
+ // write extra bits if needed
+ if (s->extra_bits) {
+ uint32_t mask = (1 << s->extra_bits) - 1;
+ for (i = 0; i < s->frame_size; i++) {
+ for (j = 0; j < channels; j++) {
+ put_bits(pb, s->extra_bits, s->sample_buf[j][i] & mask);
+ s->sample_buf[j][i] >>= s->extra_bits;
+ }
+ }
+ }
- calc_predictor_params(s, i);
+ // apply lpc and entropy coding to audio samples
+ for (i = 0; i < channels; i++) {
+ alac_linear_predictor(s, i);
- put_bits(&s->pbctx, 4, prediction_type);
- put_bits(&s->pbctx, 4, s->lpc[i].lpc_quant);
+ // TODO: determine when this will actually help. for now it's not used.
+ if (prediction_type == 15) {
+ // 2nd pass 1st order filter
+ for (j = s->frame_size - 1; j > 0; j--)
+ s->predictor_buf[j] -= s->predictor_buf[j - 1];
+ }
+ alac_entropy_coder(s);
+ }
+ }
+}
- put_bits(&s->pbctx, 3, s->rc.rice_modifier);
- put_bits(&s->pbctx, 5, s->lpc[i].lpc_order);
- // predictor coeff. table
- for (j = 0; j < s->lpc[i].lpc_order; j++) {
- put_sbits(&s->pbctx, 16, s->lpc[i].lpc_coeff[j]);
+static int write_frame(AlacEncodeContext *s, AVPacket *avpkt,
+ uint8_t * const *samples)
+{
+ PutBitContext *pb = &s->pbctx;
+ const enum AlacRawDataBlockType *ch_elements = ff_alac_channel_elements[s->avctx->channels - 1];
+ const uint8_t *ch_map = ff_alac_channel_layout_offsets[s->avctx->channels - 1];
+ int ch, element, sce, cpe;
+
+ init_put_bits(pb, avpkt->data, avpkt->size);
+
+ ch = element = sce = cpe = 0;
+ while (ch < s->avctx->channels) {
+ if (ch_elements[element] == TYPE_CPE) {
+ write_element(s, TYPE_CPE, cpe, samples[ch_map[ch]],
+ samples[ch_map[ch + 1]]);
+ cpe++;
+ ch += 2;
+ } else {
+ write_element(s, TYPE_SCE, sce, samples[ch_map[ch]], NULL);
+ sce++;
+ ch++;
}
+ element++;
}
- // apply lpc and entropy coding to audio samples
+ put_bits(pb, 3, TYPE_END);
+ flush_put_bits(pb);
- for (i = 0; i < s->avctx->channels; i++) {
- alac_linear_predictor(s, i);
+ return put_bits_count(pb) >> 3;
+}
- // TODO: determine when this will actually help. for now it's not used.
- if (prediction_type == 15) {
- // 2nd pass 1st order filter
- for (j = s->avctx->frame_size - 1; j > 0; j--)
- s->predictor_buf[j] -= s->predictor_buf[j - 1];
- }
+static av_always_inline int get_max_frame_size(int frame_size, int ch, int bps)
+{
+ int header_bits = 23 + 32 * (frame_size < DEFAULT_FRAME_SIZE);
+ return FFALIGN(header_bits + bps * ch * frame_size + 3, 8) / 8;
+}
- alac_entropy_coder(s);
- }
+static av_cold int alac_encode_close(AVCodecContext *avctx)
+{
+ AlacEncodeContext *s = avctx->priv_data;
+ ff_lpc_end(&s->lpc_ctx);
+ av_freep(&avctx->extradata);
+ avctx->extradata_size = 0;
+ av_freep(&avctx->coded_frame);
+ return 0;
}
static av_cold int alac_encode_init(AVCodecContext *avctx)
{
- AlacEncodeContext *s = avctx->priv_data;
+ AlacEncodeContext *s = avctx->priv_data;
int ret;
- uint8_t *alac_extradata = av_mallocz(ALAC_EXTRADATA_SIZE+1);
+ uint8_t *alac_extradata;
- avctx->frame_size = DEFAULT_FRAME_SIZE;
- avctx->bits_per_coded_sample = DEFAULT_SAMPLE_SIZE;
-
- if (avctx->sample_fmt != AV_SAMPLE_FMT_S16) {
- av_log(avctx, AV_LOG_ERROR, "only pcm_s16 input samples are supported\n");
- return -1;
- }
+ avctx->frame_size = s->frame_size = DEFAULT_FRAME_SIZE;
- /* TODO: Correctly implement multi-channel ALAC.
- It is similar to multi-channel AAC, in that it has a series of
- single-channel (SCE), channel-pair (CPE), and LFE elements. */
- if (avctx->channels > 2) {
- av_log(avctx, AV_LOG_ERROR, "only mono or stereo input is currently supported\n");
- return AVERROR_PATCHWELCOME;
+ if (avctx->sample_fmt == AV_SAMPLE_FMT_S32P) {
+ if (avctx->bits_per_raw_sample != 24)
+ av_log(avctx, AV_LOG_WARNING, "encoding as 24 bits-per-sample\n");
+ avctx->bits_per_raw_sample = 24;
+ } else {
+ avctx->bits_per_raw_sample = 16;
+ s->extra_bits = 0;
}
// Set default compression level
@@ -420,18 +517,26 @@ static av_cold int alac_encode_init(AVCodecContext *avctx)
s->rc.k_modifier = 14;
s->rc.rice_modifier = 4;
- s->max_coded_frame_size = 8 + (avctx->frame_size*avctx->channels*avctx->bits_per_coded_sample>>3);
+ s->max_coded_frame_size = get_max_frame_size(avctx->frame_size,
+ avctx->channels,
+ avctx->bits_per_raw_sample);
- s->write_sample_size = avctx->bits_per_coded_sample + avctx->channels - 1; // FIXME: consider wasted_bytes
+ avctx->extradata = av_mallocz(ALAC_EXTRADATA_SIZE + FF_INPUT_BUFFER_PADDING_SIZE);
+ if (!avctx->extradata) {
+ ret = AVERROR(ENOMEM);
+ goto error;
+ }
+ avctx->extradata_size = ALAC_EXTRADATA_SIZE;
+ alac_extradata = avctx->extradata;
AV_WB32(alac_extradata, ALAC_EXTRADATA_SIZE);
AV_WB32(alac_extradata+4, MKBETAG('a','l','a','c'));
AV_WB32(alac_extradata+12, avctx->frame_size);
- AV_WB8 (alac_extradata+17, avctx->bits_per_coded_sample);
+ AV_WB8 (alac_extradata+17, avctx->bits_per_raw_sample);
AV_WB8 (alac_extradata+21, avctx->channels);
AV_WB32(alac_extradata+24, s->max_coded_frame_size);
AV_WB32(alac_extradata+28,
- avctx->sample_rate * avctx->channels * avctx->bits_per_coded_sample); // average bitrate
+ avctx->sample_rate * avctx->channels * avctx->bits_per_raw_sample); // average bitrate
AV_WB32(alac_extradata+32, avctx->sample_rate);
// Set relevant extradata fields
@@ -447,7 +552,8 @@ static av_cold int alac_encode_init(AVCodecContext *avctx)
avctx->min_prediction_order > ALAC_MAX_LPC_ORDER) {
av_log(avctx, AV_LOG_ERROR, "invalid min prediction order: %d\n",
avctx->min_prediction_order);
- return -1;
+ ret = AVERROR(EINVAL);
+ goto error;
}
s->min_prediction_order = avctx->min_prediction_order;
@@ -459,7 +565,8 @@ static av_cold int alac_encode_init(AVCodecContext *avctx)
avctx->max_prediction_order > ALAC_MAX_LPC_ORDER) {
av_log(avctx, AV_LOG_ERROR, "invalid max prediction order: %d\n",
avctx->max_prediction_order);
- return -1;
+ ret = AVERROR(EINVAL);
+ goto error;
}
s->max_prediction_order = avctx->max_prediction_order;
@@ -469,93 +576,84 @@ static av_cold int alac_encode_init(AVCodecContext *avctx)
av_log(avctx, AV_LOG_ERROR,
"invalid prediction orders: min=%d max=%d\n",
s->min_prediction_order, s->max_prediction_order);
- return -1;
+ ret = AVERROR(EINVAL);
+ goto error;
}
- avctx->extradata = alac_extradata;
- avctx->extradata_size = ALAC_EXTRADATA_SIZE;
-
avctx->coded_frame = avcodec_alloc_frame();
- avctx->coded_frame->key_frame = 1;
+ if (!avctx->coded_frame) {
+ ret = AVERROR(ENOMEM);
+ goto error;
+ }
s->avctx = avctx;
- ret = ff_lpc_init(&s->lpc_ctx, avctx->frame_size, s->max_prediction_order,
- FF_LPC_TYPE_LEVINSON);
+ if ((ret = ff_lpc_init(&s->lpc_ctx, avctx->frame_size,
+ s->max_prediction_order,
+ FF_LPC_TYPE_LEVINSON)) < 0) {
+ goto error;
+ }
+
+ return 0;
+error:
+ alac_encode_close(avctx);
return ret;
}
-static int alac_encode_frame(AVCodecContext *avctx, uint8_t *frame,
- int buf_size, void *data)
+static int alac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
+ const AVFrame *frame, int *got_packet_ptr)
{
AlacEncodeContext *s = avctx->priv_data;
- PutBitContext *pb = &s->pbctx;
- int i, out_bytes, verbatim_flag = 0;
+ int out_bytes, max_frame_size, ret;
- if (avctx->frame_size > DEFAULT_FRAME_SIZE) {
- av_log(avctx, AV_LOG_ERROR, "input frame size exceeded\n");
- return -1;
- }
+ s->frame_size = frame->nb_samples;
- if (buf_size < 2 * s->max_coded_frame_size) {
- av_log(avctx, AV_LOG_ERROR, "buffer size is too small\n");
- return -1;
- }
+ if (frame->nb_samples < DEFAULT_FRAME_SIZE)
+ max_frame_size = get_max_frame_size(s->frame_size, avctx->channels,
+ avctx->bits_per_raw_sample);
+ else
+ max_frame_size = s->max_coded_frame_size;
-verbatim:
- init_put_bits(pb, frame, buf_size);
+ if ((ret = ff_alloc_packet(avpkt, 2 * max_frame_size))) {
+ av_log(avctx, AV_LOG_ERROR, "Error getting output packet\n");
+ return ret;
+ }
- if (s->compression_level == 0 || verbatim_flag) {
- // Verbatim mode
- const int16_t *samples = data;
- write_frame_header(s, 1);
- for (i = 0; i < avctx->frame_size * avctx->channels; i++) {
- put_sbits(pb, 16, *samples++);
- }
+ /* use verbatim mode for compression_level 0 */
+ if (s->compression_level) {
+ s->verbatim = 0;
+ s->extra_bits = avctx->bits_per_raw_sample - 16;
} else {
- init_sample_buffers(s, data);
- write_frame_header(s, 0);
- write_compressed_frame(s);
+ s->verbatim = 1;
+ s->extra_bits = 0;
}
- put_bits(pb, 3, 7);
- flush_put_bits(pb);
- out_bytes = put_bits_count(pb) >> 3;
+ out_bytes = write_frame(s, avpkt, frame->extended_data);
- if (out_bytes > s->max_coded_frame_size) {
+ if (out_bytes > max_frame_size) {
/* frame too large. use verbatim mode */
- if (verbatim_flag || s->compression_level == 0) {
- /* still too large. must be an error. */
- av_log(avctx, AV_LOG_ERROR, "error encoding frame\n");
- return -1;
- }
- verbatim_flag = 1;
- goto verbatim;
+ s->verbatim = 1;
+ s->extra_bits = 0;
+ out_bytes = write_frame(s, avpkt, frame->extended_data);
}
- return out_bytes;
-}
-
-static av_cold int alac_encode_close(AVCodecContext *avctx)
-{
- AlacEncodeContext *s = avctx->priv_data;
- ff_lpc_end(&s->lpc_ctx);
- av_freep(&avctx->extradata);
- avctx->extradata_size = 0;
- av_freep(&avctx->coded_frame);
+ avpkt->size = out_bytes;
+ *got_packet_ptr = 1;
return 0;
}
AVCodec ff_alac_encoder = {
.name = "alac",
.type = AVMEDIA_TYPE_AUDIO,
- .id = CODEC_ID_ALAC,
+ .id = AV_CODEC_ID_ALAC,
.priv_data_size = sizeof(AlacEncodeContext),
.init = alac_encode_init,
- .encode = alac_encode_frame,
+ .encode2 = alac_encode_frame,
.close = alac_encode_close,
- .capabilities = CODEC_CAP_SMALL_LAST_FRAME,
- .sample_fmts = (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_S16,
- AV_SAMPLE_FMT_NONE },
- .long_name = NULL_IF_CONFIG_SMALL("ALAC (Apple Lossless Audio Codec)"),
+ .capabilities = CODEC_CAP_SMALL_LAST_FRAME,
+ .channel_layouts = ff_alac_channel_layouts,
+ .sample_fmts = (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_S32P,
+ AV_SAMPLE_FMT_S16P,
+ AV_SAMPLE_FMT_NONE },
+ .long_name = NULL_IF_CONFIG_SMALL("ALAC (Apple Lossless Audio Codec)"),
};
diff --git a/gst-libs/ext/libav/libavcodec/allcodecs.c b/gst-libs/ext/libav/libavcodec/allcodecs.c
index 5289692..5786719 100644
--- a/gst-libs/ext/libav/libavcodec/allcodecs.c
+++ b/gst-libs/ext/libav/libavcodec/allcodecs.c
@@ -25,25 +25,44 @@
*/
#include "avcodec.h"
+#include "config.h"
-#define REGISTER_HWACCEL(X,x) { \
- extern AVHWAccel ff_##x##_hwaccel; \
- if(CONFIG_##X##_HWACCEL) av_register_hwaccel(&ff_##x##_hwaccel); }
+#define REGISTER_HWACCEL(X, x) \
+ { \
+ extern AVHWAccel ff_##x##_hwaccel; \
+ if (CONFIG_##X##_HWACCEL) \
+ av_register_hwaccel(&ff_##x##_hwaccel); \
+ }
-#define REGISTER_ENCODER(X,x) { \
- extern AVCodec ff_##x##_encoder; \
- if(CONFIG_##X##_ENCODER) avcodec_register(&ff_##x##_encoder); }
-#define REGISTER_DECODER(X,x) { \
- extern AVCodec ff_##x##_decoder; \
- if(CONFIG_##X##_DECODER) avcodec_register(&ff_##x##_decoder); }
-#define REGISTER_ENCDEC(X,x) REGISTER_ENCODER(X,x); REGISTER_DECODER(X,x)
+#define REGISTER_ENCODER(X, x) \
+ { \
+ extern AVCodec ff_##x##_encoder; \
+ if (CONFIG_##X##_ENCODER) \
+ avcodec_register(&ff_##x##_encoder); \
+ }
-#define REGISTER_PARSER(X,x) { \
- extern AVCodecParser ff_##x##_parser; \
- if(CONFIG_##X##_PARSER) av_register_codec_parser(&ff_##x##_parser); }
-#define REGISTER_BSF(X,x) { \
- extern AVBitStreamFilter ff_##x##_bsf; \
- if(CONFIG_##X##_BSF) av_register_bitstream_filter(&ff_##x##_bsf); }
+#define REGISTER_DECODER(X, x) \
+ { \
+ extern AVCodec ff_##x##_decoder; \
+ if (CONFIG_##X##_DECODER) \
+ avcodec_register(&ff_##x##_decoder); \
+ }
+
+#define REGISTER_ENCDEC(X, x) REGISTER_ENCODER(X, x); REGISTER_DECODER(X, x)
+
+#define REGISTER_PARSER(X, x) \
+ { \
+ extern AVCodecParser ff_##x##_parser; \
+ if (CONFIG_##X##_PARSER) \
+ av_register_codec_parser(&ff_##x##_parser); \
+ }
+
+#define REGISTER_BSF(X, x) \
+ { \
+ extern AVBitStreamFilter ff_##x##_bsf; \
+ if (CONFIG_##X##_BSF) \
+ av_register_bitstream_filter(&ff_##x##_bsf); \
+ }
void avcodec_register_all(void)
{
@@ -54,380 +73,401 @@ void avcodec_register_all(void)
initialized = 1;
/* hardware accelerators */
- REGISTER_HWACCEL (H263_VAAPI, h263_vaapi);
- REGISTER_HWACCEL (H264_DXVA2, h264_dxva2);
- REGISTER_HWACCEL (H264_VAAPI, h264_vaapi);
- REGISTER_HWACCEL (H264_VDA, h264_vda);
- REGISTER_HWACCEL (MPEG2_DXVA2, mpeg2_dxva2);
- REGISTER_HWACCEL (MPEG2_VAAPI, mpeg2_vaapi);
- REGISTER_HWACCEL (MPEG4_VAAPI, mpeg4_vaapi);
- REGISTER_HWACCEL (VC1_DXVA2, vc1_dxva2);
- REGISTER_HWACCEL (VC1_VAAPI, vc1_vaapi);
- REGISTER_HWACCEL (WMV3_DXVA2, wmv3_dxva2);
- REGISTER_HWACCEL (WMV3_VAAPI, wmv3_vaapi);
+ REGISTER_HWACCEL(H263_VAAPI, h263_vaapi);
+ REGISTER_HWACCEL(H264_DXVA2, h264_dxva2);
+ REGISTER_HWACCEL(H264_VAAPI, h264_vaapi);
+ REGISTER_HWACCEL(H264_VDA, h264_vda);
+ REGISTER_HWACCEL(MPEG2_DXVA2, mpeg2_dxva2);
+ REGISTER_HWACCEL(MPEG2_VAAPI, mpeg2_vaapi);
+ REGISTER_HWACCEL(MPEG4_VAAPI, mpeg4_vaapi);
+ REGISTER_HWACCEL(VC1_DXVA2, vc1_dxva2);
+ REGISTER_HWACCEL(VC1_VAAPI, vc1_vaapi);
+ REGISTER_HWACCEL(WMV3_DXVA2, wmv3_dxva2);
+ REGISTER_HWACCEL(WMV3_VAAPI, wmv3_vaapi);
/* video codecs */
- REGISTER_ENCODER (A64MULTI, a64multi);
- REGISTER_ENCODER (A64MULTI5, a64multi5);
- REGISTER_DECODER (AASC, aasc);
- REGISTER_DECODER (AMV, amv);
- REGISTER_DECODER (ANM, anm);
- REGISTER_DECODER (ANSI, ansi);
- REGISTER_ENCDEC (ASV1, asv1);
- REGISTER_ENCDEC (ASV2, asv2);
- REGISTER_DECODER (AURA, aura);
- REGISTER_DECODER (AURA2, aura2);
- REGISTER_DECODER (AVS, avs);
- REGISTER_DECODER (BETHSOFTVID, bethsoftvid);
- REGISTER_DECODER (BFI, bfi);
- REGISTER_DECODER (BINK, bink);
- REGISTER_ENCDEC (BMP, bmp);
- REGISTER_DECODER (BMV_VIDEO, bmv_video);
- REGISTER_DECODER (C93, c93);
- REGISTER_DECODER (CAVS, cavs);
- REGISTER_DECODER (CDGRAPHICS, cdgraphics);
- REGISTER_DECODER (CINEPAK, cinepak);
- REGISTER_ENCDEC (CLJR, cljr);
- REGISTER_DECODER (CSCD, cscd);
- REGISTER_DECODER (CYUV, cyuv);
- REGISTER_DECODER (DFA, dfa);
- REGISTER_ENCDEC (DNXHD, dnxhd);
- REGISTER_ENCDEC (DPX, dpx);
- REGISTER_DECODER (DSICINVIDEO, dsicinvideo);
- REGISTER_ENCDEC (DVVIDEO, dvvideo);
- REGISTER_DECODER (DXA, dxa);
- REGISTER_DECODER (DXTORY, dxtory);
- REGISTER_DECODER (EACMV, eacmv);
- REGISTER_DECODER (EAMAD, eamad);
- REGISTER_DECODER (EATGQ, eatgq);
- REGISTER_DECODER (EATGV, eatgv);
- REGISTER_DECODER (EATQI, eatqi);
- REGISTER_DECODER (EIGHTBPS, eightbps);
- REGISTER_DECODER (EIGHTSVX_EXP, eightsvx_exp);
- REGISTER_DECODER (EIGHTSVX_FIB, eightsvx_fib);
- REGISTER_DECODER (ESCAPE124, escape124);
- REGISTER_ENCDEC (FFV1, ffv1);
- REGISTER_ENCDEC (FFVHUFF, ffvhuff);
- REGISTER_ENCDEC (FLASHSV, flashsv);
- REGISTER_DECODER (FLASHSV2, flashsv2);
- REGISTER_DECODER (FLIC, flic);
- REGISTER_ENCDEC (FLV, flv);
- REGISTER_DECODER (FOURXM, fourxm);
- REGISTER_DECODER (FRAPS, fraps);
- REGISTER_DECODER (FRWU, frwu);
- REGISTER_ENCDEC (GIF, gif);
- REGISTER_ENCDEC (H261, h261);
- REGISTER_ENCDEC (H263, h263);
- REGISTER_DECODER (H263I, h263i);
- REGISTER_ENCODER (H263P, h263p);
- REGISTER_DECODER (H264, h264);
- REGISTER_DECODER (H264_VDPAU, h264_vdpau);
- REGISTER_ENCDEC (HUFFYUV, huffyuv);
- REGISTER_DECODER (IDCIN, idcin);
- REGISTER_DECODER (IFF_BYTERUN1, iff_byterun1);
- REGISTER_DECODER (IFF_ILBM, iff_ilbm);
- REGISTER_DECODER (INDEO2, indeo2);
- REGISTER_DECODER (INDEO3, indeo3);
- REGISTER_DECODER (INDEO4, indeo4);
- REGISTER_DECODER (INDEO5, indeo5);
- REGISTER_DECODER (INTERPLAY_VIDEO, interplay_video);
- REGISTER_ENCDEC (JPEGLS, jpegls);
- REGISTER_DECODER (JV, jv);
- REGISTER_DECODER (KGV1, kgv1);
- REGISTER_DECODER (KMVC, kmvc);
- REGISTER_DECODER (LAGARITH, lagarith);
- REGISTER_ENCODER (LJPEG, ljpeg);
- REGISTER_DECODER (LOCO, loco);
- REGISTER_DECODER (MDEC, mdec);
- REGISTER_DECODER (MIMIC, mimic);
- REGISTER_ENCDEC (MJPEG, mjpeg);
- REGISTER_DECODER (MJPEGB, mjpegb);
- REGISTER_DECODER (MMVIDEO, mmvideo);
- REGISTER_DECODER (MOTIONPIXELS, motionpixels);
- REGISTER_DECODER (MPEG_XVMC, mpeg_xvmc);
- REGISTER_ENCDEC (MPEG1VIDEO, mpeg1video);
- REGISTER_ENCDEC (MPEG2VIDEO, mpeg2video);
- REGISTER_ENCDEC (MPEG4, mpeg4);
- REGISTER_DECODER (MPEG4_VDPAU, mpeg4_vdpau);
- REGISTER_DECODER (MPEG_VDPAU, mpeg_vdpau);
- REGISTER_DECODER (MPEG1_VDPAU, mpeg1_vdpau);
- REGISTER_DECODER (MSMPEG4V1, msmpeg4v1);
- REGISTER_ENCDEC (MSMPEG4V2, msmpeg4v2);
- REGISTER_ENCDEC (MSMPEG4V3, msmpeg4v3);
- REGISTER_DECODER (MSRLE, msrle);
- REGISTER_DECODER (MSVIDEO1, msvideo1);
- REGISTER_DECODER (MSZH, mszh);
- REGISTER_DECODER (MXPEG, mxpeg);
- REGISTER_DECODER (NUV, nuv);
- REGISTER_ENCDEC (PAM, pam);
- REGISTER_ENCDEC (PBM, pbm);
- REGISTER_ENCDEC (PCX, pcx);
- REGISTER_ENCDEC (PGM, pgm);
- REGISTER_ENCDEC (PGMYUV, pgmyuv);
- REGISTER_DECODER (PICTOR, pictor);
- REGISTER_ENCDEC (PNG, png);
- REGISTER_ENCDEC (PPM, ppm);
- REGISTER_DECODER (PRORES, prores);
- REGISTER_DECODER (PTX, ptx);
- REGISTER_DECODER (QDRAW, qdraw);
- REGISTER_DECODER (QPEG, qpeg);
- REGISTER_ENCDEC (QTRLE, qtrle);
- REGISTER_DECODER (R10K, r10k);
- REGISTER_DECODER (R210, r210);
- REGISTER_ENCDEC (RAWVIDEO, rawvideo);
- REGISTER_DECODER (RL2, rl2);
- REGISTER_ENCDEC (ROQ, roq);
- REGISTER_DECODER (RPZA, rpza);
- REGISTER_ENCDEC (RV10, rv10);
- REGISTER_ENCDEC (RV20, rv20);
- REGISTER_DECODER (RV30, rv30);
- REGISTER_DECODER (RV40, rv40);
- REGISTER_DECODER (S302M, s302m);
- REGISTER_ENCDEC (SGI, sgi);
- REGISTER_DECODER (SMACKER, smacker);
- REGISTER_DECODER (SMC, smc);
- REGISTER_ENCDEC (SNOW, snow);
- REGISTER_DECODER (SP5X, sp5x);
- REGISTER_DECODER (SUNRAST, sunrast);
- REGISTER_ENCDEC (SVQ1, svq1);
- REGISTER_DECODER (SVQ3, svq3);
- REGISTER_ENCDEC (TARGA, targa);
- REGISTER_DECODER (THEORA, theora);
- REGISTER_DECODER (THP, thp);
- REGISTER_DECODER (TIERTEXSEQVIDEO, tiertexseqvideo);
- REGISTER_ENCDEC (TIFF, tiff);
- REGISTER_DECODER (TMV, tmv);
- REGISTER_DECODER (TRUEMOTION1, truemotion1);
- REGISTER_DECODER (TRUEMOTION2, truemotion2);
- REGISTER_DECODER (TSCC, tscc);
- REGISTER_DECODER (TXD, txd);
- REGISTER_DECODER (ULTI, ulti);
- REGISTER_DECODER (UTVIDEO, utvideo);
- REGISTER_ENCDEC (V210, v210);
- REGISTER_DECODER (V210X, v210x);
- REGISTER_ENCDEC (V410, v410);
- REGISTER_DECODER (VB, vb);
- REGISTER_DECODER (VBLE, vble);
- REGISTER_DECODER (VC1, vc1);
- REGISTER_DECODER (VC1_VDPAU, vc1_vdpau);
- REGISTER_DECODER (VC1IMAGE, vc1image);
- REGISTER_DECODER (VCR1, vcr1);
- REGISTER_DECODER (VMDVIDEO, vmdvideo);
- REGISTER_DECODER (VMNC, vmnc);
- REGISTER_DECODER (VP3, vp3);
- REGISTER_DECODER (VP5, vp5);
- REGISTER_DECODER (VP6, vp6);
- REGISTER_DECODER (VP6A, vp6a);
- REGISTER_DECODER (VP6F, vp6f);
- REGISTER_DECODER (VP8, vp8);
- REGISTER_DECODER (VQA, vqa);
- REGISTER_ENCDEC (WMV1, wmv1);
- REGISTER_ENCDEC (WMV2, wmv2);
- REGISTER_DECODER (WMV3, wmv3);
- REGISTER_DECODER (WMV3_VDPAU, wmv3_vdpau);
- REGISTER_DECODER (WMV3IMAGE, wmv3image);
- REGISTER_DECODER (WNV1, wnv1);
- REGISTER_DECODER (XAN_WC3, xan_wc3);
- REGISTER_DECODER (XAN_WC4, xan_wc4);
- REGISTER_DECODER (XL, xl);
- REGISTER_DECODER (YOP, yop);
- REGISTER_ENCDEC (ZLIB, zlib);
- REGISTER_ENCDEC (ZMBV, zmbv);
+ REGISTER_ENCODER(A64MULTI, a64multi);
+ REGISTER_ENCODER(A64MULTI5, a64multi5);
+ REGISTER_DECODER(AASC, aasc);
+ REGISTER_DECODER(AMV, amv);
+ REGISTER_DECODER(ANM, anm);
+ REGISTER_DECODER(ANSI, ansi);
+ REGISTER_ENCDEC (ASV1, asv1);
+ REGISTER_ENCDEC (ASV2, asv2);
+ REGISTER_DECODER(AURA, aura);
+ REGISTER_DECODER(AURA2, aura2);
+ REGISTER_DECODER(AVS, avs);
+ REGISTER_DECODER(BETHSOFTVID, bethsoftvid);
+ REGISTER_DECODER(BFI, bfi);
+ REGISTER_DECODER(BINK, bink);
+ REGISTER_ENCDEC (BMP, bmp);
+ REGISTER_DECODER(BMV_VIDEO, bmv_video);
+ REGISTER_DECODER(C93, c93);
+ REGISTER_DECODER(CAVS, cavs);
+ REGISTER_DECODER(CDGRAPHICS, cdgraphics);
+ REGISTER_DECODER(CDXL, cdxl);
+ REGISTER_DECODER(CINEPAK, cinepak);
+ REGISTER_ENCDEC (CLJR, cljr);
+ REGISTER_DECODER(CLLC, cllc);
+ REGISTER_ENCDEC (COMFORTNOISE, comfortnoise);
+ REGISTER_DECODER(CSCD, cscd);
+ REGISTER_DECODER(CYUV, cyuv);
+ REGISTER_DECODER(DFA, dfa);
+ REGISTER_ENCDEC (DNXHD, dnxhd);
+ REGISTER_ENCDEC (DPX, dpx);
+ REGISTER_DECODER(DSICINVIDEO, dsicinvideo);
+ REGISTER_ENCDEC (DVVIDEO, dvvideo);
+ REGISTER_DECODER(DXA, dxa);
+ REGISTER_DECODER(DXTORY, dxtory);
+ REGISTER_DECODER(EACMV, eacmv);
+ REGISTER_DECODER(EAMAD, eamad);
+ REGISTER_DECODER(EATGQ, eatgq);
+ REGISTER_DECODER(EATGV, eatgv);
+ REGISTER_DECODER(EATQI, eatqi);
+ REGISTER_DECODER(EIGHTBPS, eightbps);
+ REGISTER_DECODER(EIGHTSVX_EXP, eightsvx_exp);
+ REGISTER_DECODER(EIGHTSVX_FIB, eightsvx_fib);
+ REGISTER_DECODER(ESCAPE124, escape124);
+ REGISTER_ENCDEC (FFV1, ffv1);
+ REGISTER_ENCDEC (FFVHUFF, ffvhuff);
+ REGISTER_ENCDEC (FLASHSV, flashsv);
+ REGISTER_DECODER(FLASHSV2, flashsv2);
+ REGISTER_DECODER(FLIC, flic);
+ REGISTER_ENCDEC (FLV, flv);
+ REGISTER_DECODER(FOURXM, fourxm);
+ REGISTER_DECODER(FRAPS, fraps);
+ REGISTER_DECODER(FRWU, frwu);
+ REGISTER_ENCDEC (GIF, gif);
+ REGISTER_ENCDEC (H261, h261);
+ REGISTER_ENCDEC (H263, h263);
+ REGISTER_DECODER(H263I, h263i);
+ REGISTER_ENCODER(H263P, h263p);
+ REGISTER_DECODER(H264, h264);
+ REGISTER_DECODER(H264_VDPAU, h264_vdpau);
+ REGISTER_ENCDEC (HUFFYUV, huffyuv);
+ REGISTER_DECODER(IDCIN, idcin);
+ REGISTER_DECODER(IFF_BYTERUN1, iff_byterun1);
+ REGISTER_DECODER(IFF_ILBM, iff_ilbm);
+ REGISTER_DECODER(INDEO2, indeo2);
+ REGISTER_DECODER(INDEO3, indeo3);
+ REGISTER_DECODER(INDEO4, indeo4);
+ REGISTER_DECODER(INDEO5, indeo5);
+ REGISTER_DECODER(INTERPLAY_VIDEO, interplay_video);
+ REGISTER_ENCDEC (JPEGLS, jpegls);
+ REGISTER_DECODER(JV, jv);
+ REGISTER_DECODER(KGV1, kgv1);
+ REGISTER_DECODER(KMVC, kmvc);
+ REGISTER_DECODER(LAGARITH, lagarith);
+ REGISTER_ENCODER(LJPEG, ljpeg);
+ REGISTER_DECODER(LOCO, loco);
+ REGISTER_DECODER(MDEC, mdec);
+ REGISTER_DECODER(MIMIC, mimic);
+ REGISTER_ENCDEC (MJPEG, mjpeg);
+ REGISTER_DECODER(MJPEGB, mjpegb);
+ REGISTER_DECODER(MMVIDEO, mmvideo);
+ REGISTER_DECODER(MOTIONPIXELS, motionpixels);
+ REGISTER_DECODER(MPEG_XVMC, mpeg_xvmc);
+ REGISTER_ENCDEC (MPEG1VIDEO, mpeg1video);
+ REGISTER_ENCDEC (MPEG2VIDEO, mpeg2video);
+ REGISTER_ENCDEC (MPEG4, mpeg4);
+ REGISTER_DECODER(MPEG4_VDPAU, mpeg4_vdpau);
+ REGISTER_DECODER(MPEG_VDPAU, mpeg_vdpau);
+ REGISTER_DECODER(MPEG1_VDPAU, mpeg1_vdpau);
+ REGISTER_DECODER(MSA1, msa1);
+ REGISTER_DECODER(MSMPEG4V1, msmpeg4v1);
+ REGISTER_ENCDEC (MSMPEG4V2, msmpeg4v2);
+ REGISTER_ENCDEC (MSMPEG4V3, msmpeg4v3);
+ REGISTER_DECODER(MSRLE, msrle);
+ REGISTER_DECODER(MSS1, mss1);
+ REGISTER_DECODER(MSS2, mss2);
+ REGISTER_DECODER(MSVIDEO1, msvideo1);
+ REGISTER_DECODER(MSZH, mszh);
+ REGISTER_DECODER(MTS2, mts2);
+ REGISTER_DECODER(MXPEG, mxpeg);
+ REGISTER_DECODER(NUV, nuv);
+ REGISTER_ENCDEC (PAM, pam);
+ REGISTER_ENCDEC (PBM, pbm);
+ REGISTER_ENCDEC (PCX, pcx);
+ REGISTER_ENCDEC (PGM, pgm);
+ REGISTER_ENCDEC (PGMYUV, pgmyuv);
+ REGISTER_DECODER(PICTOR, pictor);
+ REGISTER_ENCDEC (PNG, png);
+ REGISTER_ENCDEC (PPM, ppm);
+ REGISTER_ENCDEC (PRORES, prores);
+ REGISTER_DECODER(PTX, ptx);
+ REGISTER_DECODER(QDRAW, qdraw);
+ REGISTER_DECODER(QPEG, qpeg);
+ REGISTER_ENCDEC (QTRLE, qtrle);
+ REGISTER_DECODER(R10K, r10k);
+ REGISTER_DECODER(R210, r210);
+ REGISTER_ENCDEC (RAWVIDEO, rawvideo);
+ REGISTER_DECODER(RL2, rl2);
+ REGISTER_ENCDEC (ROQ, roq);
+ REGISTER_DECODER(RPZA, rpza);
+ REGISTER_ENCDEC (RV10, rv10);
+ REGISTER_ENCDEC (RV20, rv20);
+ REGISTER_DECODER(RV30, rv30);
+ REGISTER_DECODER(RV40, rv40);
+ REGISTER_DECODER(S302M, s302m);
+ REGISTER_ENCDEC (SGI, sgi);
+ REGISTER_DECODER(SMACKER, smacker);
+ REGISTER_DECODER(SMC, smc);
+ REGISTER_ENCDEC (SNOW, snow);
+ REGISTER_DECODER(SP5X, sp5x);
+ REGISTER_ENCDEC (SUNRAST, sunrast);
+ REGISTER_ENCDEC (SVQ1, svq1);
+ REGISTER_DECODER(SVQ3, svq3);
+ REGISTER_ENCDEC (TARGA, targa);
+ REGISTER_DECODER(THEORA, theora);
+ REGISTER_DECODER(THP, thp);
+ REGISTER_DECODER(TIERTEXSEQVIDEO, tiertexseqvideo);
+ REGISTER_ENCDEC (TIFF, tiff);
+ REGISTER_DECODER(TMV, tmv);
+ REGISTER_DECODER(TRUEMOTION1, truemotion1);
+ REGISTER_DECODER(TRUEMOTION2, truemotion2);
+ REGISTER_DECODER(TSCC, tscc);
+ REGISTER_DECODER(TSCC2, tscc2);
+ REGISTER_DECODER(TXD, txd);
+ REGISTER_DECODER(ULTI, ulti);
+ REGISTER_ENCDEC (UTVIDEO, utvideo);
+ REGISTER_ENCDEC (V210, v210);
+ REGISTER_DECODER(V210X, v210x);
+ REGISTER_ENCDEC (V410, v410);
+ REGISTER_DECODER(VB, vb);
+ REGISTER_DECODER(VBLE, vble);
+ REGISTER_DECODER(VC1, vc1);
+ REGISTER_DECODER(VC1_VDPAU, vc1_vdpau);
+ REGISTER_DECODER(VC1IMAGE, vc1image);
+ REGISTER_DECODER(VCR1, vcr1);
+ REGISTER_DECODER(VMDVIDEO, vmdvideo);
+ REGISTER_DECODER(VMNC, vmnc);
+ REGISTER_DECODER(VP3, vp3);
+ REGISTER_DECODER(VP5, vp5);
+ REGISTER_DECODER(VP6, vp6);
+ REGISTER_DECODER(VP6A, vp6a);
+ REGISTER_DECODER(VP6F, vp6f);
+ REGISTER_DECODER(VP8, vp8);
+ REGISTER_DECODER(VQA, vqa);
+ REGISTER_ENCDEC (WMV1, wmv1);
+ REGISTER_ENCDEC (WMV2, wmv2);
+ REGISTER_DECODER(WMV3, wmv3);
+ REGISTER_DECODER(WMV3_VDPAU, wmv3_vdpau);
+ REGISTER_DECODER(WMV3IMAGE, wmv3image);
+ REGISTER_DECODER(WNV1, wnv1);
+ REGISTER_DECODER(XAN_WC3, xan_wc3);
+ REGISTER_DECODER(XAN_WC4, xan_wc4);
+ REGISTER_ENCODER(XBM, xbm);
+ REGISTER_DECODER(XL, xl);
+ REGISTER_ENCDEC (XWD, xwd);
+ REGISTER_DECODER(YOP, yop);
+ REGISTER_DECODER(ZEROCODEC, zerocodec);
+ REGISTER_ENCDEC (ZLIB, zlib);
+ REGISTER_ENCDEC (ZMBV, zmbv);
/* audio codecs */
- REGISTER_ENCDEC (AAC, aac);
- REGISTER_DECODER (AAC_LATM, aac_latm);
- REGISTER_ENCDEC (AC3, ac3);
- REGISTER_ENCODER (AC3_FIXED, ac3_fixed);
- REGISTER_ENCDEC (ALAC, alac);
- REGISTER_DECODER (ALS, als);
- REGISTER_DECODER (AMRNB, amrnb);
- REGISTER_DECODER (AMRWB, amrwb);
- REGISTER_DECODER (APE, ape);
- REGISTER_DECODER (ATRAC1, atrac1);
- REGISTER_DECODER (ATRAC3, atrac3);
- REGISTER_DECODER (BINKAUDIO_DCT, binkaudio_dct);
- REGISTER_DECODER (BINKAUDIO_RDFT, binkaudio_rdft);
- REGISTER_DECODER (BMV_AUDIO, bmv_audio);
- REGISTER_DECODER (COOK, cook);
- REGISTER_DECODER (DCA, dca);
- REGISTER_DECODER (DSICINAUDIO, dsicinaudio);
- REGISTER_ENCDEC (EAC3, eac3);
- REGISTER_ENCDEC (FLAC, flac);
- REGISTER_DECODER (GSM, gsm);
- REGISTER_DECODER (GSM_MS, gsm_ms);
- REGISTER_DECODER (IMC, imc);
- REGISTER_DECODER (MACE3, mace3);
- REGISTER_DECODER (MACE6, mace6);
- REGISTER_DECODER (MLP, mlp);
- REGISTER_DECODER (MP1, mp1);
- REGISTER_DECODER (MP1FLOAT, mp1float);
- REGISTER_ENCDEC (MP2, mp2);
- REGISTER_DECODER (MP2FLOAT, mp2float);
- REGISTER_DECODER (MP3, mp3);
- REGISTER_DECODER (MP3FLOAT, mp3float);
- REGISTER_DECODER (MP3ADU, mp3adu);
- REGISTER_DECODER (MP3ADUFLOAT, mp3adufloat);
- REGISTER_DECODER (MP3ON4, mp3on4);
- REGISTER_DECODER (MP3ON4FLOAT, mp3on4float);
- REGISTER_DECODER (MPC7, mpc7);
- REGISTER_DECODER (MPC8, mpc8);
- REGISTER_ENCDEC (NELLYMOSER, nellymoser);
- REGISTER_DECODER (QCELP, qcelp);
- REGISTER_DECODER (QDM2, qdm2);
- REGISTER_ENCDEC (RA_144, ra_144);
- REGISTER_DECODER (RA_288, ra_288);
- REGISTER_DECODER (SHORTEN, shorten);
- REGISTER_DECODER (SIPR, sipr);
- REGISTER_DECODER (SMACKAUD, smackaud);
- REGISTER_DECODER (TRUEHD, truehd);
- REGISTER_DECODER (TRUESPEECH, truespeech);
- REGISTER_DECODER (TTA, tta);
- REGISTER_DECODER (TWINVQ, twinvq);
- REGISTER_DECODER (VMDAUDIO, vmdaudio);
- REGISTER_ENCDEC (VORBIS, vorbis);
- REGISTER_DECODER (WAVPACK, wavpack);
- REGISTER_DECODER (WMAPRO, wmapro);
- REGISTER_ENCDEC (WMAV1, wmav1);
- REGISTER_ENCDEC (WMAV2, wmav2);
- REGISTER_DECODER (WMAVOICE, wmavoice);
- REGISTER_DECODER (WS_SND1, ws_snd1);
+ REGISTER_ENCDEC (AAC, aac);
+ REGISTER_DECODER(AAC_LATM, aac_latm);
+ REGISTER_ENCDEC (AC3, ac3);
+ REGISTER_ENCODER(AC3_FIXED, ac3_fixed);
+ REGISTER_ENCDEC (ALAC, alac);
+ REGISTER_DECODER(ALS, als);
+ REGISTER_DECODER(AMRNB, amrnb);
+ REGISTER_DECODER(AMRWB, amrwb);
+ REGISTER_DECODER(APE, ape);
+ REGISTER_DECODER(ATRAC1, atrac1);
+ REGISTER_DECODER(ATRAC3, atrac3);
+ REGISTER_DECODER(BINKAUDIO_DCT, binkaudio_dct);
+ REGISTER_DECODER(BINKAUDIO_RDFT, binkaudio_rdft);
+ REGISTER_DECODER(BMV_AUDIO, bmv_audio);
+ REGISTER_DECODER(COOK, cook);
+ REGISTER_DECODER(DCA, dca);
+ REGISTER_DECODER(DSICINAUDIO, dsicinaudio);
+ REGISTER_ENCDEC (EAC3, eac3);
+ REGISTER_ENCDEC (FLAC, flac);
+ REGISTER_DECODER(G723_1, g723_1);
+ REGISTER_DECODER(GSM, gsm);
+ REGISTER_DECODER(GSM_MS, gsm_ms);
+ REGISTER_DECODER(IAC, iac);
+ REGISTER_DECODER(IMC, imc);
+ REGISTER_DECODER(MACE3, mace3);
+ REGISTER_DECODER(MACE6, mace6);
+ REGISTER_DECODER(MLP, mlp);
+ REGISTER_DECODER(MP1, mp1);
+ REGISTER_DECODER(MP1FLOAT, mp1float);
+ REGISTER_ENCDEC (MP2, mp2);
+ REGISTER_DECODER(MP2FLOAT, mp2float);
+ REGISTER_DECODER(MP3, mp3);
+ REGISTER_DECODER(MP3FLOAT, mp3float);
+ REGISTER_DECODER(MP3ADU, mp3adu);
+ REGISTER_DECODER(MP3ADUFLOAT, mp3adufloat);
+ REGISTER_DECODER(MP3ON4, mp3on4);
+ REGISTER_DECODER(MP3ON4FLOAT, mp3on4float);
+ REGISTER_DECODER(MPC7, mpc7);
+ REGISTER_DECODER(MPC8, mpc8);
+ REGISTER_ENCDEC (NELLYMOSER, nellymoser);
+ REGISTER_DECODER(QCELP, qcelp);
+ REGISTER_DECODER(QDM2, qdm2);
+ REGISTER_ENCDEC (RA_144, ra_144);
+ REGISTER_DECODER(RA_288, ra_288);
+ REGISTER_DECODER(RALF, ralf);
+ REGISTER_DECODER(SHORTEN, shorten);
+ REGISTER_DECODER(SIPR, sipr);
+ REGISTER_DECODER(SMACKAUD, smackaud);
+ REGISTER_DECODER(TAK, tak);
+ REGISTER_DECODER(TRUEHD, truehd);
+ REGISTER_DECODER(TRUESPEECH, truespeech);
+ REGISTER_DECODER(TTA, tta);
+ REGISTER_DECODER(TWINVQ, twinvq);
+ REGISTER_DECODER(VMDAUDIO, vmdaudio);
+ REGISTER_ENCDEC (VORBIS, vorbis);
+ REGISTER_DECODER(WAVPACK, wavpack);
+ REGISTER_DECODER(WMALOSSLESS, wmalossless);
+ REGISTER_DECODER(WMAPRO, wmapro);
+ REGISTER_ENCDEC (WMAV1, wmav1);
+ REGISTER_ENCDEC (WMAV2, wmav2);
+ REGISTER_DECODER(WMAVOICE, wmavoice);
+ REGISTER_DECODER(WS_SND1, ws_snd1);
/* PCM codecs */
- REGISTER_ENCDEC (PCM_ALAW, pcm_alaw);
- REGISTER_DECODER (PCM_BLURAY, pcm_bluray);
- REGISTER_DECODER (PCM_DVD, pcm_dvd);
- REGISTER_ENCDEC (PCM_F32BE, pcm_f32be);
- REGISTER_ENCDEC (PCM_F32LE, pcm_f32le);
- REGISTER_ENCDEC (PCM_F64BE, pcm_f64be);
- REGISTER_ENCDEC (PCM_F64LE, pcm_f64le);
- REGISTER_DECODER (PCM_LXF, pcm_lxf);
- REGISTER_ENCDEC (PCM_MULAW, pcm_mulaw);
- REGISTER_ENCDEC (PCM_S8, pcm_s8);
- REGISTER_DECODER (PCM_S8_PLANAR, pcm_s8_planar);
- REGISTER_ENCDEC (PCM_S16BE, pcm_s16be);
- REGISTER_ENCDEC (PCM_S16LE, pcm_s16le);
- REGISTER_DECODER (PCM_S16LE_PLANAR, pcm_s16le_planar);
- REGISTER_ENCDEC (PCM_S24BE, pcm_s24be);
- REGISTER_ENCDEC (PCM_S24DAUD, pcm_s24daud);
- REGISTER_ENCDEC (PCM_S24LE, pcm_s24le);
- REGISTER_ENCDEC (PCM_S32BE, pcm_s32be);
- REGISTER_ENCDEC (PCM_S32LE, pcm_s32le);
- REGISTER_ENCDEC (PCM_U8, pcm_u8);
- REGISTER_ENCDEC (PCM_U16BE, pcm_u16be);
- REGISTER_ENCDEC (PCM_U16LE, pcm_u16le);
- REGISTER_ENCDEC (PCM_U24BE, pcm_u24be);
- REGISTER_ENCDEC (PCM_U24LE, pcm_u24le);
- REGISTER_ENCDEC (PCM_U32BE, pcm_u32be);
- REGISTER_ENCDEC (PCM_U32LE, pcm_u32le);
- REGISTER_DECODER (PCM_ZORK , pcm_zork);
+ REGISTER_ENCDEC (PCM_ALAW, pcm_alaw);
+ REGISTER_DECODER(PCM_BLURAY, pcm_bluray);
+ REGISTER_DECODER(PCM_DVD, pcm_dvd);
+ REGISTER_ENCDEC (PCM_F32BE, pcm_f32be);
+ REGISTER_ENCDEC (PCM_F32LE, pcm_f32le);
+ REGISTER_ENCDEC (PCM_F64BE, pcm_f64be);
+ REGISTER_ENCDEC (PCM_F64LE, pcm_f64le);
+ REGISTER_DECODER(PCM_LXF, pcm_lxf);
+ REGISTER_ENCDEC (PCM_MULAW, pcm_mulaw);
+ REGISTER_ENCDEC (PCM_S8, pcm_s8);
+ REGISTER_DECODER(PCM_S8_PLANAR, pcm_s8_planar);
+ REGISTER_ENCDEC (PCM_S16BE, pcm_s16be);
+ REGISTER_ENCDEC (PCM_S16LE, pcm_s16le);
+ REGISTER_DECODER(PCM_S16LE_PLANAR, pcm_s16le_planar);
+ REGISTER_ENCDEC (PCM_S24BE, pcm_s24be);
+ REGISTER_ENCDEC (PCM_S24DAUD, pcm_s24daud);
+ REGISTER_ENCDEC (PCM_S24LE, pcm_s24le);
+ REGISTER_ENCDEC (PCM_S32BE, pcm_s32be);
+ REGISTER_ENCDEC (PCM_S32LE, pcm_s32le);
+ REGISTER_ENCDEC (PCM_U8, pcm_u8);
+ REGISTER_ENCDEC (PCM_U16BE, pcm_u16be);
+ REGISTER_ENCDEC (PCM_U16LE, pcm_u16le);
+ REGISTER_ENCDEC (PCM_U24BE, pcm_u24be);
+ REGISTER_ENCDEC (PCM_U24LE, pcm_u24le);
+ REGISTER_ENCDEC (PCM_U32BE, pcm_u32be);
+ REGISTER_ENCDEC (PCM_U32LE, pcm_u32le);
+ REGISTER_DECODER(PCM_ZORK , pcm_zork);
/* DPCM codecs */
- REGISTER_DECODER (INTERPLAY_DPCM, interplay_dpcm);
- REGISTER_ENCDEC (ROQ_DPCM, roq_dpcm);
- REGISTER_DECODER (SOL_DPCM, sol_dpcm);
- REGISTER_DECODER (XAN_DPCM, xan_dpcm);
+ REGISTER_DECODER(INTERPLAY_DPCM, interplay_dpcm);
+ REGISTER_ENCDEC (ROQ_DPCM, roq_dpcm);
+ REGISTER_DECODER(SOL_DPCM, sol_dpcm);
+ REGISTER_DECODER(XAN_DPCM, xan_dpcm);
/* ADPCM codecs */
- REGISTER_DECODER (ADPCM_4XM, adpcm_4xm);
- REGISTER_ENCDEC (ADPCM_ADX, adpcm_adx);
- REGISTER_DECODER (ADPCM_CT, adpcm_ct);
- REGISTER_DECODER (ADPCM_EA, adpcm_ea);
- REGISTER_DECODER (ADPCM_EA_MAXIS_XA, adpcm_ea_maxis_xa);
- REGISTER_DECODER (ADPCM_EA_R1, adpcm_ea_r1);
- REGISTER_DECODER (ADPCM_EA_R2, adpcm_ea_r2);
- REGISTER_DECODER (ADPCM_EA_R3, adpcm_ea_r3);
- REGISTER_DECODER (ADPCM_EA_XAS, adpcm_ea_xas);
- REGISTER_ENCDEC (ADPCM_G722, adpcm_g722);
- REGISTER_ENCDEC (ADPCM_G726, adpcm_g726);
- REGISTER_DECODER (ADPCM_IMA_AMV, adpcm_ima_amv);
- REGISTER_DECODER (ADPCM_IMA_DK3, adpcm_ima_dk3);
- REGISTER_DECODER (ADPCM_IMA_DK4, adpcm_ima_dk4);
- REGISTER_DECODER (ADPCM_IMA_EA_EACS, adpcm_ima_ea_eacs);
- REGISTER_DECODER (ADPCM_IMA_EA_SEAD, adpcm_ima_ea_sead);
- REGISTER_DECODER (ADPCM_IMA_ISS, adpcm_ima_iss);
- REGISTER_ENCDEC (ADPCM_IMA_QT, adpcm_ima_qt);
- REGISTER_DECODER (ADPCM_IMA_SMJPEG, adpcm_ima_smjpeg);
- REGISTER_ENCDEC (ADPCM_IMA_WAV, adpcm_ima_wav);
- REGISTER_DECODER (ADPCM_IMA_WS, adpcm_ima_ws);
- REGISTER_ENCDEC (ADPCM_MS, adpcm_ms);
- REGISTER_DECODER (ADPCM_SBPRO_2, adpcm_sbpro_2);
- REGISTER_DECODER (ADPCM_SBPRO_3, adpcm_sbpro_3);
- REGISTER_DECODER (ADPCM_SBPRO_4, adpcm_sbpro_4);
- REGISTER_ENCDEC (ADPCM_SWF, adpcm_swf);
- REGISTER_DECODER (ADPCM_THP, adpcm_thp);
- REGISTER_DECODER (ADPCM_XA, adpcm_xa);
- REGISTER_ENCDEC (ADPCM_YAMAHA, adpcm_yamaha);
+ REGISTER_DECODER(ADPCM_4XM, adpcm_4xm);
+ REGISTER_ENCDEC (ADPCM_ADX, adpcm_adx);
+ REGISTER_DECODER(ADPCM_CT, adpcm_ct);
+ REGISTER_DECODER(ADPCM_EA, adpcm_ea);
+ REGISTER_DECODER(ADPCM_EA_MAXIS_XA, adpcm_ea_maxis_xa);
+ REGISTER_DECODER(ADPCM_EA_R1, adpcm_ea_r1);
+ REGISTER_DECODER(ADPCM_EA_R2, adpcm_ea_r2);
+ REGISTER_DECODER(ADPCM_EA_R3, adpcm_ea_r3);
+ REGISTER_DECODER(ADPCM_EA_XAS, adpcm_ea_xas);
+ REGISTER_ENCDEC (ADPCM_G722, adpcm_g722);
+ REGISTER_ENCDEC (ADPCM_G726, adpcm_g726);
+ REGISTER_DECODER(ADPCM_IMA_AMV, adpcm_ima_amv);
+ REGISTER_DECODER(ADPCM_IMA_APC, adpcm_ima_apc);
+ REGISTER_DECODER(ADPCM_IMA_DK3, adpcm_ima_dk3);
+ REGISTER_DECODER(ADPCM_IMA_DK4, adpcm_ima_dk4);
+ REGISTER_DECODER(ADPCM_IMA_EA_EACS, adpcm_ima_ea_eacs);
+ REGISTER_DECODER(ADPCM_IMA_EA_SEAD, adpcm_ima_ea_sead);
+ REGISTER_DECODER(ADPCM_IMA_ISS, adpcm_ima_iss);
+ REGISTER_ENCDEC (ADPCM_IMA_QT, adpcm_ima_qt);
+ REGISTER_DECODER(ADPCM_IMA_SMJPEG, adpcm_ima_smjpeg);
+ REGISTER_ENCDEC (ADPCM_IMA_WAV, adpcm_ima_wav);
+ REGISTER_DECODER(ADPCM_IMA_WS, adpcm_ima_ws);
+ REGISTER_ENCDEC (ADPCM_MS, adpcm_ms);
+ REGISTER_DECODER(ADPCM_SBPRO_2, adpcm_sbpro_2);
+ REGISTER_DECODER(ADPCM_SBPRO_3, adpcm_sbpro_3);
+ REGISTER_DECODER(ADPCM_SBPRO_4, adpcm_sbpro_4);
+ REGISTER_ENCDEC (ADPCM_SWF, adpcm_swf);
+ REGISTER_DECODER(ADPCM_THP, adpcm_thp);
+ REGISTER_DECODER(ADPCM_XA, adpcm_xa);
+ REGISTER_ENCDEC (ADPCM_YAMAHA, adpcm_yamaha);
/* subtitles */
- REGISTER_ENCDEC (ASS, ass);
- REGISTER_ENCDEC (DVBSUB, dvbsub);
- REGISTER_ENCDEC (DVDSUB, dvdsub);
- REGISTER_DECODER (PGSSUB, pgssub);
- REGISTER_DECODER (SRT, srt);
- REGISTER_ENCDEC (XSUB, xsub);
+ REGISTER_ENCDEC (ASS, ass);
+ REGISTER_ENCDEC (DVBSUB, dvbsub);
+ REGISTER_ENCDEC (DVDSUB, dvdsub);
+ REGISTER_DECODER(PGSSUB, pgssub);
+ REGISTER_DECODER(SRT, srt);
+ REGISTER_ENCDEC (XSUB, xsub);
/* external libraries */
- REGISTER_ENCDEC (LIBDIRAC, libdirac);
- REGISTER_ENCODER (LIBFAAC, libfaac);
- REGISTER_ENCDEC (LIBGSM, libgsm);
- REGISTER_ENCDEC (LIBGSM_MS, libgsm_ms);
- REGISTER_ENCODER (LIBMP3LAME, libmp3lame);
- REGISTER_ENCDEC (LIBOPENCORE_AMRNB, libopencore_amrnb);
- REGISTER_DECODER (LIBOPENCORE_AMRWB, libopencore_amrwb);
- REGISTER_DECODER (LIBOPENJPEG, libopenjpeg);
- REGISTER_ENCDEC (LIBSCHROEDINGER, libschroedinger);
- REGISTER_ENCDEC (LIBSPEEX, libspeex);
- REGISTER_ENCODER (LIBTHEORA, libtheora);
- REGISTER_ENCODER (LIBVO_AACENC, libvo_aacenc);
- REGISTER_ENCODER (LIBVO_AMRWBENC, libvo_amrwbenc);
- REGISTER_ENCODER (LIBVORBIS, libvorbis);
- REGISTER_ENCDEC (LIBVPX, libvpx);
- REGISTER_ENCODER (LIBX264, libx264);
- REGISTER_ENCODER (LIBXAVS, libxavs);
- REGISTER_ENCODER (LIBXVID, libxvid);
+ REGISTER_ENCODER(LIBFAAC, libfaac);
+ REGISTER_ENCODER(LIBFDK_AAC, libfdk_aac);
+ REGISTER_ENCDEC (LIBGSM, libgsm);
+ REGISTER_ENCDEC (LIBGSM_MS, libgsm_ms);
+ REGISTER_ENCDEC (LIBILBC, libilbc);
+ REGISTER_ENCODER(LIBMP3LAME, libmp3lame);
+ REGISTER_ENCDEC (LIBOPENCORE_AMRNB, libopencore_amrnb);
+ REGISTER_DECODER(LIBOPENCORE_AMRWB, libopencore_amrwb);
+ REGISTER_ENCDEC (LIBOPENJPEG, libopenjpeg);
+ REGISTER_ENCDEC (LIBOPUS, libopus);
+ REGISTER_ENCDEC (LIBSCHROEDINGER, libschroedinger);
+ REGISTER_ENCDEC (LIBSPEEX, libspeex);
+ REGISTER_ENCODER(LIBTHEORA, libtheora);
+ REGISTER_ENCODER(LIBVO_AACENC, libvo_aacenc);
+ REGISTER_ENCODER(LIBVO_AMRWBENC, libvo_amrwbenc);
+ REGISTER_ENCODER(LIBVORBIS, libvorbis);
+ REGISTER_ENCDEC (LIBVPX, libvpx);
+ REGISTER_ENCODER(LIBX264, libx264);
+ REGISTER_ENCODER(LIBXAVS, libxavs);
+ REGISTER_ENCODER(LIBXVID, libxvid);
/* parsers */
- REGISTER_PARSER (AAC, aac);
- REGISTER_PARSER (AAC_LATM, aac_latm);
- REGISTER_PARSER (AC3, ac3);
- REGISTER_PARSER (ADX, adx);
- REGISTER_PARSER (CAVSVIDEO, cavsvideo);
- REGISTER_PARSER (DCA, dca);
- REGISTER_PARSER (DIRAC, dirac);
- REGISTER_PARSER (DNXHD, dnxhd);
- REGISTER_PARSER (DVBSUB, dvbsub);
- REGISTER_PARSER (DVDSUB, dvdsub);
- REGISTER_PARSER (FLAC, flac);
- REGISTER_PARSER (GSM, gsm);
- REGISTER_PARSER (H261, h261);
- REGISTER_PARSER (H263, h263);
- REGISTER_PARSER (H264, h264);
- REGISTER_PARSER (MJPEG, mjpeg);
- REGISTER_PARSER (MLP, mlp);
- REGISTER_PARSER (MPEG4VIDEO, mpeg4video);
- REGISTER_PARSER (MPEGAUDIO, mpegaudio);
- REGISTER_PARSER (MPEGVIDEO, mpegvideo);
- REGISTER_PARSER (PNM, pnm);
- REGISTER_PARSER (RV30, rv30);
- REGISTER_PARSER (RV40, rv40);
- REGISTER_PARSER (VC1, vc1);
- REGISTER_PARSER (VP3, vp3);
- REGISTER_PARSER (VP8, vp8);
+ REGISTER_PARSER(AAC, aac);
+ REGISTER_PARSER(AAC_LATM, aac_latm);
+ REGISTER_PARSER(AC3, ac3);
+ REGISTER_PARSER(ADX, adx);
+ REGISTER_PARSER(CAVSVIDEO, cavsvideo);
+ REGISTER_PARSER(COOK, cook);
+ REGISTER_PARSER(DCA, dca);
+ REGISTER_PARSER(DIRAC, dirac);
+ REGISTER_PARSER(DNXHD, dnxhd);
+ REGISTER_PARSER(DVBSUB, dvbsub);
+ REGISTER_PARSER(DVDSUB, dvdsub);
+ REGISTER_PARSER(FLAC, flac);
+ REGISTER_PARSER(GSM, gsm);
+ REGISTER_PARSER(H261, h261);
+ REGISTER_PARSER(H263, h263);
+ REGISTER_PARSER(H264, h264);
+ REGISTER_PARSER(MJPEG, mjpeg);
+ REGISTER_PARSER(MLP, mlp);
+ REGISTER_PARSER(MPEG4VIDEO, mpeg4video);
+ REGISTER_PARSER(MPEGAUDIO, mpegaudio);
+ REGISTER_PARSER(MPEGVIDEO, mpegvideo);
+ REGISTER_PARSER(PNM, pnm);
+ REGISTER_PARSER(RV30, rv30);
+ REGISTER_PARSER(RV40, rv40);
+ REGISTER_PARSER(TAK, tak);
+ REGISTER_PARSER(VC1, vc1);
+ REGISTER_PARSER(VORBIS, vorbis);
+ REGISTER_PARSER(VP3, vp3);
+ REGISTER_PARSER(VP8, vp8);
/* bitstream filters */
- REGISTER_BSF (AAC_ADTSTOASC, aac_adtstoasc);
- REGISTER_BSF (CHOMP, chomp);
- REGISTER_BSF (DUMP_EXTRADATA, dump_extradata);
- REGISTER_BSF (H264_MP4TOANNEXB, h264_mp4toannexb);
- REGISTER_BSF (IMX_DUMP_HEADER, imx_dump_header);
- REGISTER_BSF (MJPEG2JPEG, mjpeg2jpeg);
- REGISTER_BSF (MJPEGA_DUMP_HEADER, mjpega_dump_header);
- REGISTER_BSF (MP3_HEADER_COMPRESS, mp3_header_compress);
- REGISTER_BSF (MP3_HEADER_DECOMPRESS, mp3_header_decompress);
- REGISTER_BSF (MOV2TEXTSUB, mov2textsub);
- REGISTER_BSF (NOISE, noise);
- REGISTER_BSF (REMOVE_EXTRADATA, remove_extradata);
- REGISTER_BSF (TEXT2MOVSUB, text2movsub);
+ REGISTER_BSF(AAC_ADTSTOASC, aac_adtstoasc);
+ REGISTER_BSF(CHOMP, chomp);
+ REGISTER_BSF(DUMP_EXTRADATA, dump_extradata);
+ REGISTER_BSF(H264_MP4TOANNEXB, h264_mp4toannexb);
+ REGISTER_BSF(IMX_DUMP_HEADER, imx_dump_header);
+ REGISTER_BSF(MJPEG2JPEG, mjpeg2jpeg);
+ REGISTER_BSF(MJPEGA_DUMP_HEADER, mjpega_dump_header);
+ REGISTER_BSF(MP3_HEADER_COMPRESS, mp3_header_compress);
+ REGISTER_BSF(MP3_HEADER_DECOMPRESS, mp3_header_decompress);
+ REGISTER_BSF(MOV2TEXTSUB, mov2textsub);
+ REGISTER_BSF(NOISE, noise);
+ REGISTER_BSF(REMOVE_EXTRADATA, remove_extradata);
+ REGISTER_BSF(TEXT2MOVSUB, text2movsub);
}
-
diff --git a/gst-libs/ext/libav/libavcodec/alpha/Makefile b/gst-libs/ext/libav/libavcodec/alpha/Makefile
index 2779a23..e28200d 100644
--- a/gst-libs/ext/libav/libavcodec/alpha/Makefile
+++ b/gst-libs/ext/libav/libavcodec/alpha/Makefile
@@ -1,6 +1,7 @@
-OBJS += alpha/dsputil_alpha.o \
- alpha/dsputil_alpha_asm.o \
- alpha/motion_est_alpha.o \
- alpha/motion_est_mvi_asm.o \
- alpha/mpegvideo_alpha.o \
- alpha/simple_idct_alpha.o \
+OBJS += alpha/dsputil_alpha.o \
+ alpha/dsputil_alpha_asm.o \
+ alpha/motion_est_alpha.o \
+ alpha/motion_est_mvi_asm.o \
+ alpha/simple_idct_alpha.o \
+
+OBJS-$(CONFIG_MPEGVIDEO) += alpha/mpegvideo_alpha.o
diff --git a/gst-libs/ext/libav/libavcodec/alpha/dsputil_alpha.c b/gst-libs/ext/libav/libavcodec/alpha/dsputil_alpha.c
index acd8e03..ce7cecb 100644
--- a/gst-libs/ext/libav/libavcodec/alpha/dsputil_alpha.c
+++ b/gst-libs/ext/libav/libavcodec/alpha/dsputil_alpha.c
@@ -268,7 +268,7 @@ static void put_pixels16_axp_asm(uint8_t *block, const uint8_t *pixels,
put_pixels_axp_asm(block + 8, pixels + 8, line_size, h);
}
-void dsputil_init_alpha(DSPContext* c, AVCodecContext *avctx)
+void ff_dsputil_init_alpha(DSPContext* c, AVCodecContext *avctx)
{
const int high_bit_depth = avctx->bits_per_raw_sample > 8;
@@ -336,7 +336,7 @@ void dsputil_init_alpha(DSPContext* c, AVCodecContext *avctx)
put_pixels_clamped_axp_p = c->put_pixels_clamped;
add_pixels_clamped_axp_p = c->add_pixels_clamped;
- if (!avctx->lowres && avctx->bits_per_raw_sample <= 8 &&
+ if (avctx->bits_per_raw_sample <= 8 &&
(avctx->idct_algo == FF_IDCT_AUTO ||
avctx->idct_algo == FF_IDCT_SIMPLEALPHA)) {
c->idct_put = ff_simple_idct_put_axp;
diff --git a/gst-libs/ext/libav/libavcodec/alpha/mpegvideo_alpha.c b/gst-libs/ext/libav/libavcodec/alpha/mpegvideo_alpha.c
index add5736..a1a8a27 100644
--- a/gst-libs/ext/libav/libavcodec/alpha/mpegvideo_alpha.c
+++ b/gst-libs/ext/libav/libavcodec/alpha/mpegvideo_alpha.c
@@ -103,7 +103,7 @@ static void dct_unquantize_h263_inter_axp(MpegEncContext *s, DCTELEM *block,
dct_unquantize_h263_axp(block, n_coeffs, qscale, (qscale - 1) | 1);
}
-void MPV_common_init_axp(MpegEncContext *s)
+void ff_MPV_common_init_axp(MpegEncContext *s)
{
s->dct_unquantize_h263_intra = dct_unquantize_h263_intra_axp;
s->dct_unquantize_h263_inter = dct_unquantize_h263_inter_axp;
diff --git a/gst-libs/ext/libav/libavcodec/alsdec.c b/gst-libs/ext/libav/libavcodec/alsdec.c
index 459e2af..ff2a735 100644
--- a/gst-libs/ext/libav/libavcodec/alsdec.c
+++ b/gst-libs/ext/libav/libavcodec/alsdec.c
@@ -36,6 +36,7 @@
#include "bytestream.h"
#include "bgmc.h"
#include "dsputil.h"
+#include "internal.h"
#include "libavutil/samplefmt.h"
#include "libavutil/crc.h"
@@ -427,9 +428,9 @@ static int check_specific_config(ALSDecContext *ctx)
} \
}
- MISSING_ERR(sconf->floating, "Floating point decoding", -1);
- MISSING_ERR(sconf->rlslms, "Adaptive RLS-LMS prediction", -1);
- MISSING_ERR(sconf->chan_sort, "Channel sorting", 0);
+ MISSING_ERR(sconf->floating, "Floating point decoding", AVERROR_PATCHWELCOME);
+ MISSING_ERR(sconf->rlslms, "Adaptive RLS-LMS prediction", AVERROR_PATCHWELCOME);
+ MISSING_ERR(sconf->chan_sort, "Channel sorting", 0);
return error;
}
@@ -1040,9 +1041,7 @@ static int decode_blocks_ind(ALSDecContext *ctx, unsigned int ra_frame,
unsigned int *js_blocks)
{
unsigned int b;
- ALSBlockData bd;
-
- memset(&bd, 0, sizeof(ALSBlockData));
+ ALSBlockData bd = { 0 };
bd.ra_block = ra_frame;
bd.const_block = ctx->const_block;
@@ -1083,9 +1082,7 @@ static int decode_blocks(ALSDecContext *ctx, unsigned int ra_frame,
ALSSpecificConfig *sconf = &ctx->sconf;
unsigned int offset = 0;
unsigned int b;
- ALSBlockData bd[2];
-
- memset(bd, 0, 2 * sizeof(ALSBlockData));
+ ALSBlockData bd[2] = { { 0 } };
bd[0].ra_block = ra_frame;
bd[0].const_block = ctx->const_block;
@@ -1351,8 +1348,8 @@ static int read_frame_data(ALSDecContext *ctx, unsigned int ra_frame)
sizeof(*ctx->raw_samples[c]) * sconf->max_order);
}
} else { // multi-channel coding
- ALSBlockData bd;
- int b;
+ ALSBlockData bd = { 0 };
+ int b, ret;
int *reverted_channels = ctx->reverted_channels;
unsigned int offset = 0;
@@ -1362,7 +1359,6 @@ static int read_frame_data(ALSDecContext *ctx, unsigned int ra_frame)
return -1;
}
- memset(&bd, 0, sizeof(ALSBlockData));
memset(reverted_channels, 0, sizeof(*reverted_channels) * avctx->channels);
bd.ra_block = ra_frame;
@@ -1386,9 +1382,10 @@ static int read_frame_data(ALSDecContext *ctx, unsigned int ra_frame)
bd.raw_samples = ctx->raw_samples[c] + offset;
bd.raw_other = NULL;
- read_block(ctx, &bd);
- if (read_channel_data(ctx, ctx->chan_data[c], c))
- return -1;
+ if ((ret = read_block(ctx, &bd)) < 0)
+ return ret;
+ if ((ret = read_channel_data(ctx, ctx->chan_data[c], c)) < 0)
+ return ret;
}
for (c = 0; c < avctx->channels; c++)
@@ -1407,7 +1404,8 @@ static int read_frame_data(ALSDecContext *ctx, unsigned int ra_frame)
bd.lpc_cof = ctx->lpc_cof[c];
bd.quant_cof = ctx->quant_cof[c];
bd.raw_samples = ctx->raw_samples[c] + offset;
- decode_block(ctx, &bd);
+ if ((ret = decode_block(ctx, &bd)) < 0)
+ return ret;
}
memset(reverted_channels, 0, avctx->channels * sizeof(*reverted_channels));
@@ -1456,7 +1454,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr,
ctx->cur_frame_length = sconf->frame_length;
// decode the frame data
- if ((invalid_frame = read_frame_data(ctx, ra_frame) < 0))
+ if ((invalid_frame = read_frame_data(ctx, ra_frame)) < 0)
av_log(ctx->avctx, AV_LOG_WARNING,
"Reading frame data failed. Skipping RA unit.\n");
@@ -1464,7 +1462,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr,
/* get output buffer */
ctx->frame.nb_samples = ctx->cur_frame_length;
- if ((ret = avctx->get_buffer(avctx, &ctx->frame)) < 0) {
+ if ((ret = ff_get_buffer(avctx, &ctx->frame)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return ret;
}
@@ -1705,7 +1703,6 @@ static av_cold int decode_init(AVCodecContext *avctx)
ctx->reverted_channels = NULL;
}
- avctx->frame_size = sconf->frame_length;
channel_size = sconf->frame_length + sconf->max_order;
ctx->prev_raw_samples = av_malloc (sizeof(*ctx->prev_raw_samples) * sconf->max_order);
@@ -1738,7 +1735,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
}
}
- dsputil_init(&ctx->dsp, avctx);
+ ff_dsputil_init(&ctx->dsp, avctx);
avcodec_get_frame_defaults(&ctx->frame);
avctx->coded_frame = &ctx->frame;
@@ -1760,13 +1757,12 @@ static av_cold void flush(AVCodecContext *avctx)
AVCodec ff_als_decoder = {
.name = "als",
.type = AVMEDIA_TYPE_AUDIO,
- .id = CODEC_ID_MP4ALS,
+ .id = AV_CODEC_ID_MP4ALS,
.priv_data_size = sizeof(ALSDecContext),
.init = decode_init,
.close = decode_end,
.decode = decode_frame,
- .flush = flush,
- .capabilities = CODEC_CAP_SUBFRAMES | CODEC_CAP_DR1,
- .long_name = NULL_IF_CONFIG_SMALL("MPEG-4 Audio Lossless Coding (ALS)"),
+ .flush = flush,
+ .capabilities = CODEC_CAP_SUBFRAMES | CODEC_CAP_DR1,
+ .long_name = NULL_IF_CONFIG_SMALL("MPEG-4 Audio Lossless Coding (ALS)"),
};
-
diff --git a/gst-libs/ext/libav/libavcodec/amr.h b/gst-libs/ext/libav/libavcodec/amr.h
index ae6e4d1..676c963 100644
--- a/gst-libs/ext/libav/libavcodec/amr.h
+++ b/gst-libs/ext/libav/libavcodec/amr.h
@@ -23,6 +23,8 @@
#ifndef AVCODEC_AMR_H
#define AVCODEC_AMR_H
+#include <string.h>
+
#include "avcodec.h"
#ifdef AMR_USE_16BIT_TABLES
@@ -61,7 +63,7 @@ static inline void ff_amr_bit_reorder(uint16_t *out, int size,
field <<= 1;
field |= data[bit >> 3] >> (bit & 7) & 1;
}
- out[field_offset] = field;
+ out[field_offset >> 1] = field;
}
}
diff --git a/gst-libs/ext/libav/libavcodec/amrnbdata.h b/gst-libs/ext/libav/libavcodec/amrnbdata.h
index d6d1f34..b7d1b89 100644
--- a/gst-libs/ext/libav/libavcodec/amrnbdata.h
+++ b/gst-libs/ext/libav/libavcodec/amrnbdata.h
@@ -55,7 +55,7 @@ enum Mode {
/**
* AMRNB unpacked data subframe
*/
-typedef struct {
+typedef struct AMRNBSubframe {
uint16_t p_lag; ///< index to decode the pitch lag
uint16_t p_gain; ///< index to decode the pitch gain
uint16_t fixed_gain; ///< index to decode the fixed gain factor, for MODE_12k2 and MODE_7k95
@@ -65,13 +65,13 @@ typedef struct {
/**
* AMRNB unpacked data frame
*/
-typedef struct {
+typedef struct AMRNBFrame {
uint16_t lsf[5]; ///< lsf parameters: 5 parameters for MODE_12k2, only 3 for other modes
AMRNBSubframe subframe[4]; ///< unpacked data for each subframe
} AMRNBFrame;
/** The index of a frame parameter */
-#define AMR_BIT(field) (offsetof(AMRNBFrame, field) >> 1)
+#define AMR_BIT(field) (offsetof(AMRNBFrame, field))
/** The index of a subframe-specific parameter */
#define AMR_OF(frame_num, variable) AMR_BIT(subframe[frame_num].variable)
@@ -1669,4 +1669,3 @@ static const float highpass_poles[2] = { -1.933105469, 0.935913085 };
static const float highpass_gain = 0.939819335;
#endif /* AVCODEC_AMRNBDATA_H */
-
diff --git a/gst-libs/ext/libav/libavcodec/amrnbdec.c b/gst-libs/ext/libav/libavcodec/amrnbdec.c
index a7d0b4e..5c359a8 100644
--- a/gst-libs/ext/libav/libavcodec/amrnbdec.c
+++ b/gst-libs/ext/libav/libavcodec/amrnbdec.c
@@ -43,16 +43,17 @@
#include <string.h>
#include <math.h>
+#include "libavutil/channel_layout.h"
#include "avcodec.h"
-#include "get_bits.h"
+#include "dsputil.h"
#include "libavutil/common.h"
-#include "celp_math.h"
#include "celp_filters.h"
#include "acelp_filters.h"
#include "acelp_vectors.h"
#include "acelp_pitch_delay.h"
#include "lsp.h"
#include "amr.h"
+#include "internal.h"
#include "amrnbdata.h"
@@ -155,7 +156,15 @@ static av_cold int amrnb_decode_init(AVCodecContext *avctx)
AMRContext *p = avctx->priv_data;
int i;
- avctx->sample_fmt = AV_SAMPLE_FMT_FLT;
+ if (avctx->channels > 1) {
+ av_log_missing_feature(avctx, "multi-channel AMR", 0);
+ return AVERROR_PATCHWELCOME;
+ }
+
+ avctx->channels = 1;
+ avctx->channel_layout = AV_CH_LAYOUT_MONO;
+ avctx->sample_rate = 8000;
+ avctx->sample_fmt = AV_SAMPLE_FMT_FLT;
// p->excitation always points to the same position in p->excitation_buf
p->excitation = &p->excitation_buf[PITCH_DELAY_MAX + LP_FILTER_ORDER + 1];
@@ -189,16 +198,11 @@ static av_cold int amrnb_decode_init(AVCodecContext *avctx)
static enum Mode unpack_bitstream(AMRContext *p, const uint8_t *buf,
int buf_size)
{
- GetBitContext gb;
enum Mode mode;
- init_get_bits(&gb, buf, buf_size * 8);
-
// Decode the first octet.
- skip_bits(&gb, 1); // padding bit
- mode = get_bits(&gb, 4); // frame type
- p->bad_frame_indicator = !get_bits1(&gb); // quality bit
- skip_bits(&gb, 2); // two padding bits
+ mode = buf[0] >> 3 & 0x0F; // frame type
+ p->bad_frame_indicator = (buf[0] & 0x4) != 0x4; // quality bit
if (mode >= N_MODES || buf_size < frame_sizes_nb[mode] + 1) {
return NO_DATA;
@@ -790,8 +794,8 @@ static int synthesis(AMRContext *p, float *lpc,
// emphasize pitch vector contribution
if (p->pitch_gain[4] > 0.5 && !overflow) {
- float energy = ff_dot_productf(excitation, excitation,
- AMR_SUBFRAME_SIZE);
+ float energy = ff_scalarproduct_float_c(excitation, excitation,
+ AMR_SUBFRAME_SIZE);
float pitch_factor =
p->pitch_gain[4] *
(p->cur_frame_mode == MODE_12k2 ?
@@ -867,8 +871,8 @@ static float tilt_factor(float *lpc_n, float *lpc_d)
ff_celp_lp_synthesis_filterf(hf, lpc_d, hf, AMR_TILT_RESPONSE,
LP_FILTER_ORDER);
- rh0 = ff_dot_productf(hf, hf, AMR_TILT_RESPONSE);
- rh1 = ff_dot_productf(hf, hf + 1, AMR_TILT_RESPONSE - 1);
+ rh0 = ff_scalarproduct_float_c(hf, hf, AMR_TILT_RESPONSE);
+ rh1 = ff_scalarproduct_float_c(hf, hf + 1, AMR_TILT_RESPONSE - 1);
// The spec only specifies this check for 12.2 and 10.2 kbit/s
// modes. But in the ref source the tilt is always non-negative.
@@ -888,8 +892,8 @@ static void postfilter(AMRContext *p, float *lpc, float *buf_out)
int i;
float *samples = p->samples_in + LP_FILTER_ORDER; // Start of input
- float speech_gain = ff_dot_productf(samples, samples,
- AMR_SUBFRAME_SIZE);
+ float speech_gain = ff_scalarproduct_float_c(samples, samples,
+ AMR_SUBFRAME_SIZE);
float pole_out[AMR_SUBFRAME_SIZE + LP_FILTER_ORDER]; // Output of pole filter
const float *gamma_n, *gamma_d; // Formant filter factor table
@@ -944,7 +948,7 @@ static int amrnb_decode_frame(AVCodecContext *avctx, void *data,
/* get output buffer */
p->avframe.nb_samples = AMR_BLOCK_SIZE;
- if ((ret = avctx->get_buffer(avctx, &p->avframe)) < 0) {
+ if ((ret = ff_get_buffer(avctx, &p->avframe)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return ret;
}
@@ -957,7 +961,7 @@ static int amrnb_decode_frame(AVCodecContext *avctx, void *data,
}
if (p->cur_frame_mode == MODE_DTX) {
av_log_missing_feature(avctx, "dtx mode", 1);
- return -1;
+ return AVERROR_PATCHWELCOME;
}
if (p->cur_frame_mode == MODE_12k2) {
@@ -994,8 +998,10 @@ static int amrnb_decode_frame(AVCodecContext *avctx, void *data,
p->fixed_gain[4] =
ff_amr_set_fixed_gain(fixed_gain_factor,
- ff_dot_productf(p->fixed_vector, p->fixed_vector,
- AMR_SUBFRAME_SIZE)/AMR_SUBFRAME_SIZE,
+ ff_scalarproduct_float_c(p->fixed_vector,
+ p->fixed_vector,
+ AMR_SUBFRAME_SIZE) /
+ AMR_SUBFRAME_SIZE,
p->prediction_error,
energy_mean[p->cur_frame_mode], energy_pred_fac);
@@ -1063,11 +1069,12 @@ static int amrnb_decode_frame(AVCodecContext *avctx, void *data,
AVCodec ff_amrnb_decoder = {
.name = "amrnb",
.type = AVMEDIA_TYPE_AUDIO,
- .id = CODEC_ID_AMR_NB,
+ .id = AV_CODEC_ID_AMR_NB,
.priv_data_size = sizeof(AMRContext),
.init = amrnb_decode_init,
.decode = amrnb_decode_frame,
.capabilities = CODEC_CAP_DR1,
- .long_name = NULL_IF_CONFIG_SMALL("Adaptive Multi-Rate NarrowBand"),
- .sample_fmts = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_FLT,AV_SAMPLE_FMT_NONE},
+ .long_name = NULL_IF_CONFIG_SMALL("AMR-NB (Adaptive Multi-Rate NarrowBand)"),
+ .sample_fmts = (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_FLT,
+ AV_SAMPLE_FMT_NONE },
};
diff --git a/gst-libs/ext/libav/libavcodec/amrwbdata.h b/gst-libs/ext/libav/libavcodec/amrwbdata.h
index 5421c23..81f8b47 100644
--- a/gst-libs/ext/libav/libavcodec/amrwbdata.h
+++ b/gst-libs/ext/libav/libavcodec/amrwbdata.h
@@ -66,7 +66,7 @@ enum Mode {
/* All decoded parameters in these structs must be 2 bytes long
* because of the direct indexing at the frame parsing */
-typedef struct {
+typedef struct AMRWBSubFrame {
uint16_t adap; ///< adaptive codebook index
uint16_t ltp; ///< ltp-filtering flag
uint16_t vq_gain; ///< VQ adaptive and innovative gains
@@ -75,14 +75,14 @@ typedef struct {
uint16_t pul_il[4]; ///< LSBs part of codebook index
} AMRWBSubFrame;
-typedef struct {
+typedef struct AMRWBFrame {
uint16_t vad; ///< voice activity detection flag
uint16_t isp_id[7]; ///< index of ISP subvectors
AMRWBSubFrame subframe[4]; ///< data for subframes
} AMRWBFrame;
/** The index of a frame parameter */
-#define AMR_BIT(field) (offsetof(AMRWBFrame, field) >> 1)
+#define AMR_BIT(field) (offsetof(AMRWBFrame, field))
/** The index of a subframe-specific parameter */
#define AMR_OF(frame_num, variable) AMR_BIT(subframe[frame_num].variable)
diff --git a/gst-libs/ext/libav/libavcodec/amrwbdec.c b/gst-libs/ext/libav/libavcodec/amrwbdec.c
index b9ae9ec..01d95f6 100644
--- a/gst-libs/ext/libav/libavcodec/amrwbdec.c
+++ b/gst-libs/ext/libav/libavcodec/amrwbdec.c
@@ -24,16 +24,18 @@
* AMR wideband decoder
*/
+#include "libavutil/channel_layout.h"
+#include "libavutil/common.h"
#include "libavutil/lfg.h"
#include "avcodec.h"
-#include "get_bits.h"
+#include "dsputil.h"
#include "lsp.h"
-#include "celp_math.h"
#include "celp_filters.h"
#include "acelp_filters.h"
#include "acelp_vectors.h"
#include "acelp_pitch_delay.h"
+#include "internal.h"
#define AMR_USE_16BIT_TABLES
#include "amr.h"
@@ -90,7 +92,15 @@ static av_cold int amrwb_decode_init(AVCodecContext *avctx)
AMRWBContext *ctx = avctx->priv_data;
int i;
- avctx->sample_fmt = AV_SAMPLE_FMT_FLT;
+ if (avctx->channels > 1) {
+ av_log_missing_feature(avctx, "multi-channel AMR", 0);
+ return AVERROR_PATCHWELCOME;
+ }
+
+ avctx->channels = 1;
+ avctx->channel_layout = AV_CH_LAYOUT_MONO;
+ avctx->sample_rate = 16000;
+ avctx->sample_fmt = AV_SAMPLE_FMT_FLT;
av_lfg_init(&ctx->prng, 1);
@@ -120,14 +130,9 @@ static av_cold int amrwb_decode_init(AVCodecContext *avctx)
*/
static int decode_mime_header(AMRWBContext *ctx, const uint8_t *buf)
{
- GetBitContext gb;
- init_get_bits(&gb, buf, 8);
-
/* Decode frame header (1st octet) */
- skip_bits(&gb, 1); // padding bit
- ctx->fr_cur_mode = get_bits(&gb, 4);
- ctx->fr_quality = get_bits1(&gb);
- skip_bits(&gb, 2); // padding bits
+ ctx->fr_cur_mode = buf[0] >> 3 & 0x0F;
+ ctx->fr_quality = (buf[0] & 0x4) == 0x4;
return 1;
}
@@ -590,10 +595,12 @@ static void pitch_sharpening(AMRWBContext *ctx, float *fixed_vector)
static float voice_factor(float *p_vector, float p_gain,
float *f_vector, float f_gain)
{
- double p_ener = (double) ff_dot_productf(p_vector, p_vector,
- AMRWB_SFR_SIZE) * p_gain * p_gain;
- double f_ener = (double) ff_dot_productf(f_vector, f_vector,
- AMRWB_SFR_SIZE) * f_gain * f_gain;
+ double p_ener = (double) ff_scalarproduct_float_c(p_vector, p_vector,
+ AMRWB_SFR_SIZE) *
+ p_gain * p_gain;
+ double f_ener = (double) ff_scalarproduct_float_c(f_vector, f_vector,
+ AMRWB_SFR_SIZE) *
+ f_gain * f_gain;
return (p_ener - f_ener) / (p_ener + f_ener);
}
@@ -761,8 +768,8 @@ static void synthesis(AMRWBContext *ctx, float *lpc, float *excitation,
/* emphasize pitch vector contribution in low bitrate modes */
if (ctx->pitch_gain[0] > 0.5 && ctx->fr_cur_mode <= MODE_8k85) {
int i;
- float energy = ff_dot_productf(excitation, excitation,
- AMRWB_SFR_SIZE);
+ float energy = ff_scalarproduct_float_c(excitation, excitation,
+ AMRWB_SFR_SIZE);
// XXX: Weird part in both ref code and spec. A unknown parameter
// {beta} seems to be identical to the current pitch gain
@@ -821,8 +828,9 @@ static void upsample_5_4(float *out, const float *in, int o_size)
i++;
for (k = 1; k < 5; k++) {
- out[i] = ff_dot_productf(in0 + int_part, upsample_fir[4 - frac_part],
- UPS_MEM_SIZE);
+ out[i] = ff_scalarproduct_float_c(in0 + int_part,
+ upsample_fir[4 - frac_part],
+ UPS_MEM_SIZE);
int_part++;
frac_part--;
i++;
@@ -848,8 +856,8 @@ static float find_hb_gain(AMRWBContext *ctx, const float *synth,
if (ctx->fr_cur_mode == MODE_23k85)
return qua_hb_gain[hb_idx] * (1.0f / (1 << 14));
- tilt = ff_dot_productf(synth, synth + 1, AMRWB_SFR_SIZE - 1) /
- ff_dot_productf(synth, synth, AMRWB_SFR_SIZE);
+ tilt = ff_scalarproduct_float_c(synth, synth + 1, AMRWB_SFR_SIZE - 1) /
+ ff_scalarproduct_float_c(synth, synth, AMRWB_SFR_SIZE);
/* return gain bounded by [0.1, 1.0] */
return av_clipf((1.0 - FFMAX(0.0, tilt)) * (1.25 - 0.25 * wsp), 0.1, 1.0);
@@ -868,7 +876,7 @@ static void scaled_hb_excitation(AMRWBContext *ctx, float *hb_exc,
const float *synth_exc, float hb_gain)
{
int i;
- float energy = ff_dot_productf(synth_exc, synth_exc, AMRWB_SFR_SIZE);
+ float energy = ff_scalarproduct_float_c(synth_exc, synth_exc, AMRWB_SFR_SIZE);
/* Generate a white-noise excitation */
for (i = 0; i < AMRWB_SFR_SIZE_16k; i++)
@@ -904,10 +912,9 @@ static float auto_correlation(float *diff_isf, float mean, int lag)
static void extrapolate_isf(float isf[LP_ORDER_16k])
{
float diff_isf[LP_ORDER - 2], diff_mean;
- float *diff_hi = diff_isf - LP_ORDER + 1; // diff array for extrapolated indexes
float corr_lag[3];
float est, scale;
- int i, i_max_corr;
+ int i, j, i_max_corr;
isf[LP_ORDER_16k - 1] = isf[LP_ORDER - 1];
@@ -938,20 +945,20 @@ static void extrapolate_isf(float isf[LP_ORDER_16k])
scale = 0.5 * (FFMIN(est, 7600) - isf[LP_ORDER - 2]) /
(isf[LP_ORDER_16k - 2] - isf[LP_ORDER - 2]);
- for (i = LP_ORDER - 1; i < LP_ORDER_16k - 1; i++)
- diff_hi[i] = scale * (isf[i] - isf[i - 1]);
+ for (i = LP_ORDER - 1, j = 0; i < LP_ORDER_16k - 1; i++, j++)
+ diff_isf[j] = scale * (isf[i] - isf[i - 1]);
/* Stability insurance */
- for (i = LP_ORDER; i < LP_ORDER_16k - 1; i++)
- if (diff_hi[i] + diff_hi[i - 1] < 5.0) {
- if (diff_hi[i] > diff_hi[i - 1]) {
- diff_hi[i - 1] = 5.0 - diff_hi[i];
+ for (i = 1; i < LP_ORDER_16k - LP_ORDER; i++)
+ if (diff_isf[i] + diff_isf[i - 1] < 5.0) {
+ if (diff_isf[i] > diff_isf[i - 1]) {
+ diff_isf[i - 1] = 5.0 - diff_isf[i];
} else
- diff_hi[i] = 5.0 - diff_hi[i - 1];
+ diff_isf[i] = 5.0 - diff_isf[i - 1];
}
- for (i = LP_ORDER - 1; i < LP_ORDER_16k - 1; i++)
- isf[i] = isf[i - 1] + diff_hi[i] * (1.0f / (1 << 15));
+ for (i = LP_ORDER - 1, j = 0; i < LP_ORDER_16k - 1; i++, j++)
+ isf[i] = isf[i - 1] + diff_isf[j] * (1.0f / (1 << 15));
/* Scale the ISF vector for 16000 Hz */
for (i = 0; i < LP_ORDER_16k - 1; i++)
@@ -1087,7 +1094,7 @@ static int amrwb_decode_frame(AVCodecContext *avctx, void *data,
/* get output buffer */
ctx->avframe.nb_samples = 4 * AMRWB_SFR_SIZE_16k;
- if ((ret = avctx->get_buffer(avctx, &ctx->avframe)) < 0) {
+ if ((ret = ff_get_buffer(avctx, &ctx->avframe)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return ret;
}
@@ -1113,7 +1120,7 @@ static int amrwb_decode_frame(AVCodecContext *avctx, void *data,
if (ctx->fr_cur_mode == MODE_SID) { /* Comfort noise frame */
av_log_missing_feature(avctx, "SID mode", 1);
- return -1;
+ return AVERROR_PATCHWELCOME;
}
ff_amr_bit_reorder((uint16_t *) &ctx->frame, sizeof(AMRWBFrame),
@@ -1161,8 +1168,10 @@ static int amrwb_decode_frame(AVCodecContext *avctx, void *data,
ctx->fixed_gain[0] =
ff_amr_set_fixed_gain(fixed_gain_factor,
- ff_dot_productf(ctx->fixed_vector, ctx->fixed_vector,
- AMRWB_SFR_SIZE) / AMRWB_SFR_SIZE,
+ ff_scalarproduct_float_c(ctx->fixed_vector,
+ ctx->fixed_vector,
+ AMRWB_SFR_SIZE) /
+ AMRWB_SFR_SIZE,
ctx->prediction_error,
ENERGY_MEAN, energy_pred_fac);
@@ -1243,11 +1252,12 @@ static int amrwb_decode_frame(AVCodecContext *avctx, void *data,
AVCodec ff_amrwb_decoder = {
.name = "amrwb",
.type = AVMEDIA_TYPE_AUDIO,
- .id = CODEC_ID_AMR_WB,
+ .id = AV_CODEC_ID_AMR_WB,
.priv_data_size = sizeof(AMRWBContext),
.init = amrwb_decode_init,
.decode = amrwb_decode_frame,
.capabilities = CODEC_CAP_DR1,
- .long_name = NULL_IF_CONFIG_SMALL("Adaptive Multi-Rate WideBand"),
- .sample_fmts = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_FLT,AV_SAMPLE_FMT_NONE},
+ .long_name = NULL_IF_CONFIG_SMALL("AMR-WB (Adaptive Multi-Rate WideBand)"),
+ .sample_fmts = (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_FLT,
+ AV_SAMPLE_FMT_NONE },
};
diff --git a/gst-libs/ext/libav/libavcodec/anm.c b/gst-libs/ext/libav/libavcodec/anm.c
index 59de984..d08ed8d 100644
--- a/gst-libs/ext/libav/libavcodec/anm.c
+++ b/gst-libs/ext/libav/libavcodec/anm.c
@@ -29,37 +29,35 @@
typedef struct AnmContext {
AVFrame frame;
+ int palette[AVPALETTE_COUNT];
+ GetByteContext gb;
int x; ///< x coordinate position
} AnmContext;
static av_cold int decode_init(AVCodecContext *avctx)
{
AnmContext *s = avctx->priv_data;
- const uint8_t *buf;
int i;
- avctx->pix_fmt = PIX_FMT_PAL8;
-
- if (avctx->extradata_size != 16*8 + 4*256)
- return -1;
+ avctx->pix_fmt = AV_PIX_FMT_PAL8;
s->frame.reference = 1;
- if (avctx->get_buffer(avctx, &s->frame) < 0) {
- av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
+ bytestream2_init(&s->gb, avctx->extradata, avctx->extradata_size);
+ if (bytestream2_get_bytes_left(&s->gb) < 16 * 8 + 4 * 256)
return -1;
- }
- buf = avctx->extradata + 16*8;
+ bytestream2_skipu(&s->gb, 16 * 8);
for (i = 0; i < 256; i++)
- ((uint32_t*)s->frame.data[1])[i] = bytestream_get_le32(&buf);
+ s->palette[i] = bytestream2_get_le32u(&s->gb);
return 0;
}
/**
* Perform decode operation
- * @param dst, dst_end Destination image buffer
- * @param buf, buf_end Source buffer (optional, see below)
+ * @param dst pointer to destination image buffer
+ * @param dst_end pointer to end of destination image buffer
+ * @param gb GetByteContext (optional, see below)
* @param pixel Fill color (optional, see below)
* @param count Pixel count
* @param x Pointer to x-axis counter
@@ -67,24 +65,22 @@ static av_cold int decode_init(AVCodecContext *avctx)
* @param linesize Destination image buffer linesize
* @return non-zero if destination buffer is exhausted
*
- * a copy operation is achieved when 'buf' is set
- * a fill operation is acheived when 'buf' is null and pixel is >= 0
- * a skip operation is acheived when 'buf' is null and pixel is < 0
+ * a copy operation is achieved when 'gb' is set
+ * a fill operation is achieved when 'gb' is null and pixel is >= 0
+ * a skip operation is achieved when 'gb' is null and pixel is < 0
*/
static inline int op(uint8_t **dst, const uint8_t *dst_end,
- const uint8_t **buf, const uint8_t *buf_end,
+ GetByteContext *gb,
int pixel, int count,
int *x, int width, int linesize)
{
int remaining = width - *x;
while(count > 0) {
int striplen = FFMIN(count, remaining);
- if (buf) {
- striplen = FFMIN(striplen, buf_end - *buf);
- if (*buf >= buf_end)
+ if (gb) {
+ if (bytestream2_get_bytes_left(gb) < striplen)
goto exhausted;
- memcpy(*dst, *buf, striplen);
- *buf += striplen;
+ bytestream2_get_bufferu(gb, *dst, striplen);
} else if (pixel >= 0)
memset(*dst, pixel, striplen);
*dst += striplen;
@@ -109,13 +105,11 @@ exhausted:
}
static int decode_frame(AVCodecContext *avctx,
- void *data, int *data_size,
+ void *data, int *got_frame,
AVPacket *avpkt)
{
AnmContext *s = avctx->priv_data;
- const uint8_t *buf = avpkt->data;
const int buf_size = avpkt->size;
- const uint8_t *buf_end = buf + buf_size;
uint8_t *dst, *dst_end;
int count;
@@ -126,35 +120,37 @@ static int decode_frame(AVCodecContext *avctx,
dst = s->frame.data[0];
dst_end = s->frame.data[0] + s->frame.linesize[0]*avctx->height;
- if (buf[0] != 0x42) {
+ bytestream2_init(&s->gb, avpkt->data, buf_size);
+
+ if (bytestream2_get_byte(&s->gb) != 0x42) {
av_log_ask_for_sample(avctx, "unknown record type\n");
return buf_size;
}
- if (buf[1]) {
+ if (bytestream2_get_byte(&s->gb)) {
av_log_ask_for_sample(avctx, "padding bytes not supported\n");
return buf_size;
}
- buf += 4;
+ bytestream2_skip(&s->gb, 2);
s->x = 0;
do {
/* if statements are ordered by probability */
-#define OP(buf, pixel, count) \
- op(&dst, dst_end, (buf), buf_end, (pixel), (count), &s->x, avctx->width, s->frame.linesize[0])
+#define OP(gb, pixel, count) \
+ op(&dst, dst_end, (gb), (pixel), (count), &s->x, avctx->width, s->frame.linesize[0])
- int type = bytestream_get_byte(&buf);
+ int type = bytestream2_get_byte(&s->gb);
count = type & 0x7F;
type >>= 7;
if (count) {
- if (OP(type ? NULL : &buf, -1, count)) break;
+ if (OP(type ? NULL : &s->gb, -1, count)) break;
} else if (!type) {
int pixel;
- count = bytestream_get_byte(&buf); /* count==0 gives nop */
- pixel = bytestream_get_byte(&buf);
+ count = bytestream2_get_byte(&s->gb); /* count==0 gives nop */
+ pixel = bytestream2_get_byte(&s->gb);
if (OP(NULL, pixel, count)) break;
} else {
int pixel;
- type = bytestream_get_le16(&buf);
+ type = bytestream2_get_le16(&s->gb);
count = type & 0x3FFF;
type >>= 14;
if (!count) {
@@ -162,17 +158,19 @@ static int decode_frame(AVCodecContext *avctx,
break; // stop
if (type == 2) {
av_log_ask_for_sample(avctx, "unknown opcode");
- return AVERROR_INVALIDDATA;
+ return AVERROR_PATCHWELCOME;
}
continue;
}
- pixel = type == 3 ? bytestream_get_byte(&buf) : -1;
+ pixel = type == 3 ? bytestream2_get_byte(&s->gb) : -1;
if (type == 1) count += 0x4000;
- if (OP(type == 2 ? &buf : NULL, pixel, count)) break;
+ if (OP(type == 2 ? &s->gb : NULL, pixel, count)) break;
}
- } while (buf + 1 < buf_end);
+ } while (bytestream2_get_bytes_left(&s->gb) > 0);
+
+ memcpy(s->frame.data[1], s->palette, AVPALETTE_SIZE);
- *data_size = sizeof(AVFrame);
+ *got_frame = 1;
*(AVFrame*)data = s->frame;
return buf_size;
}
@@ -188,11 +186,11 @@ static av_cold int decode_end(AVCodecContext *avctx)
AVCodec ff_anm_decoder = {
.name = "anm",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_ANM,
+ .id = AV_CODEC_ID_ANM,
.priv_data_size = sizeof(AnmContext),
.init = decode_init,
.close = decode_end,
.decode = decode_frame,
.capabilities = CODEC_CAP_DR1,
- .long_name = NULL_IF_CONFIG_SMALL("Deluxe Paint Animation"),
+ .long_name = NULL_IF_CONFIG_SMALL("Deluxe Paint Animation"),
};
diff --git a/gst-libs/ext/libav/libavcodec/ansi.c b/gst-libs/ext/libav/libavcodec/ansi.c
index 32c7ce4..861d4e5 100644
--- a/gst-libs/ext/libav/libavcodec/ansi.c
+++ b/gst-libs/ext/libav/libavcodec/ansi.c
@@ -24,9 +24,11 @@
* ASCII/ANSI art decoder
*/
+#include "libavutil/common.h"
#include "libavutil/lfg.h"
#include "avcodec.h"
#include "cga_data.h"
+#include "internal.h"
#define ATTR_BOLD 0x01 /**< Bold/Bright-foreground (mode 1) */
#define ATTR_FAINT 0x02 /**< Faint (mode 2) */
@@ -73,7 +75,7 @@ typedef struct {
static av_cold int decode_init(AVCodecContext *avctx)
{
AnsiContext *s = avctx->priv_data;
- avctx->pix_fmt = PIX_FMT_PAL8;
+ avctx->pix_fmt = AV_PIX_FMT_PAL8;
/* defaults */
s->font = ff_vga16_font;
@@ -221,7 +223,7 @@ static int execute_code(AVCodecContext * avctx, int c)
if (s->frame.data[0])
avctx->release_buffer(avctx, &s->frame);
avcodec_set_dimensions(avctx, width, height);
- ret = avctx->get_buffer(avctx, &s->frame);
+ ret = ff_get_buffer(avctx, &s->frame);
if (ret < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return ret;
@@ -309,7 +311,7 @@ static int execute_code(AVCodecContext * avctx, int c)
}
static int decode_frame(AVCodecContext *avctx,
- void *data, int *data_size,
+ void *data, int *got_frame,
AVPacket *avpkt)
{
AnsiContext *s = avctx->priv_data;
@@ -323,6 +325,11 @@ static int decode_frame(AVCodecContext *avctx,
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return ret;
}
+ if (!avctx->frame_number) {
+ memset(s->frame.data[0], 0, avctx->height * FFABS(s->frame.linesize[0]));
+ memset(s->frame.data[1], 0, AVPALETTE_SIZE);
+ }
+
s->frame.pict_type = AV_PICTURE_TYPE_I;
s->frame.palette_has_changed = 1;
memcpy(s->frame.data[1], ff_cga_palette, 16 * 4);
@@ -368,7 +375,6 @@ static int decode_frame(AVCodecContext *avctx,
} else {
s->state = STATE_NORMAL;
draw_char(avctx, 0x1B);
- return -1;
continue;
}
break;
@@ -409,7 +415,7 @@ static int decode_frame(AVCodecContext *avctx,
buf++;
}
- *data_size = sizeof(AVFrame);
+ *got_frame = 1;
*(AVFrame*)data = s->frame;
return buf_size;
}
@@ -425,7 +431,7 @@ static av_cold int decode_close(AVCodecContext *avctx)
AVCodec ff_ansi_decoder = {
.name = "ansi",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_ANSI,
+ .id = AV_CODEC_ID_ANSI,
.priv_data_size = sizeof(AnsiContext),
.init = decode_init,
.close = decode_close,
diff --git a/gst-libs/ext/libav/libavcodec/apedec.c b/gst-libs/ext/libav/libavcodec/apedec.c
index 0abf05b..61eecfe 100644
--- a/gst-libs/ext/libav/libavcodec/apedec.c
+++ b/gst-libs/ext/libav/libavcodec/apedec.c
@@ -20,20 +20,19 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#define BITSTREAM_READER_LE
+#include "libavutil/avassert.h"
+#include "libavutil/channel_layout.h"
+#include "libavutil/opt.h"
#include "avcodec.h"
#include "dsputil.h"
-#include "get_bits.h"
#include "bytestream.h"
-#include "libavutil/audioconvert.h"
-#include "libavutil/avassert.h"
+#include "internal.h"
/**
* @file
* Monkey's Audio lossless audio decoder
*/
-#define BLOCKS_PER_LOOP 4608
#define MAX_CHANNELS 2
#define MAX_BYTESPERSAMPLE 3
@@ -128,11 +127,13 @@ typedef struct APEPredictor {
/** Decoder context */
typedef struct APEContext {
+ AVClass *class; ///< class for AVOptions
AVCodecContext *avctx;
AVFrame frame;
DSPContext dsp;
int channels;
int samples; ///< samples left to decode in current frame
+ int bps;
int fileversion; ///< codec version, very important in decoding process
int compression_level; ///< compression levels
@@ -143,8 +144,10 @@ typedef struct APEContext {
int frameflags; ///< frame flags
APEPredictor predictor; ///< predictor used for final reconstruction
- int32_t decoded0[BLOCKS_PER_LOOP]; ///< decoded data for the first channel
- int32_t decoded1[BLOCKS_PER_LOOP]; ///< decoded data for the second channel
+ int32_t *decoded_buffer;
+ int decoded_size;
+ int32_t *decoded[MAX_CHANNELS]; ///< decoded data for each channel
+ int blocks_per_loop; ///< maximum number of samples to decode for each call
int16_t* filterbuf[APE_FILTER_LEVELS]; ///< filter memory
@@ -155,6 +158,7 @@ typedef struct APEContext {
uint8_t *data; ///< current frame data
uint8_t *data_end; ///< frame data end
+ int data_size; ///< frame data allocated size
const uint8_t *ptr; ///< current position in frame data
int error;
@@ -170,7 +174,10 @@ static av_cold int ape_decode_close(AVCodecContext *avctx)
for (i = 0; i < APE_FILTER_LEVELS; i++)
av_freep(&s->filterbuf[i]);
+ av_freep(&s->decoded_buffer);
av_freep(&s->data);
+ s->decoded_size = s->data_size = 0;
+
return 0;
}
@@ -183,14 +190,26 @@ static av_cold int ape_decode_init(AVCodecContext *avctx)
av_log(avctx, AV_LOG_ERROR, "Incorrect extradata\n");
return AVERROR(EINVAL);
}
- if (avctx->bits_per_coded_sample != 16) {
- av_log(avctx, AV_LOG_ERROR, "Only 16-bit samples are supported\n");
- return AVERROR(EINVAL);
- }
if (avctx->channels > 2) {
av_log(avctx, AV_LOG_ERROR, "Only mono and stereo is supported\n");
return AVERROR(EINVAL);
}
+ s->bps = avctx->bits_per_coded_sample;
+ switch (s->bps) {
+ case 8:
+ avctx->sample_fmt = AV_SAMPLE_FMT_U8P;
+ break;
+ case 16:
+ avctx->sample_fmt = AV_SAMPLE_FMT_S16P;
+ break;
+ case 24:
+ avctx->sample_fmt = AV_SAMPLE_FMT_S32P;
+ break;
+ default:
+ av_log_ask_for_sample(avctx, "Unsupported bits per coded sample %d\n",
+ s->bps);
+ return AVERROR_PATCHWELCOME;
+ }
s->avctx = avctx;
s->channels = avctx->channels;
s->fileversion = AV_RL16(avctx->extradata);
@@ -213,8 +232,7 @@ static av_cold int ape_decode_init(AVCodecContext *avctx)
filter_alloc_fail);
}
- dsputil_init(&s->dsp, avctx);
- avctx->sample_fmt = AV_SAMPLE_FMT_S16;
+ ff_dsputil_init(&s->dsp, avctx);
avctx->channel_layout = (avctx->channels==2) ? AV_CH_LAYOUT_STEREO : AV_CH_LAYOUT_MONO;
avcodec_get_frame_defaults(&s->frame);
@@ -376,7 +394,7 @@ static inline int range_get_symbol(APEContext *ctx,
}
/** @} */ // group rangecoder
-static inline void update_rice(APERice *rice, int x)
+static inline void update_rice(APERice *rice, unsigned int x)
{
int lim = rice->k ? (1 << (rice->k + 4)) : 0;
rice->ksum += ((x + 1) / 2) - ((rice->ksum + 16) >> 5);
@@ -389,7 +407,7 @@ static inline void update_rice(APERice *rice, int x)
static inline int ape_decode_value(APEContext *ctx, APERice *rice)
{
- int x, overflow;
+ unsigned int x, overflow;
if (ctx->fileversion < 3990) {
int tmpk;
@@ -459,19 +477,13 @@ static inline int ape_decode_value(APEContext *ctx, APERice *rice)
static void entropy_decode(APEContext *ctx, int blockstodecode, int stereo)
{
- int32_t *decoded0 = ctx->decoded0;
- int32_t *decoded1 = ctx->decoded1;
+ int32_t *decoded0 = ctx->decoded[0];
+ int32_t *decoded1 = ctx->decoded[1];
- if (ctx->frameflags & APE_FRAMECODE_STEREO_SILENCE) {
- /* We are pure silence, just memset the output buffer. */
- memset(decoded0, 0, blockstodecode * sizeof(int32_t));
- memset(decoded1, 0, blockstodecode * sizeof(int32_t));
- } else {
- while (blockstodecode--) {
- *decoded0++ = ape_decode_value(ctx, &ctx->riceY);
- if (stereo)
- *decoded1++ = ape_decode_value(ctx, &ctx->riceX);
- }
+ while (blockstodecode--) {
+ *decoded0++ = ape_decode_value(ctx, &ctx->riceY);
+ if (stereo)
+ *decoded1++ = ape_decode_value(ctx, &ctx->riceX);
}
}
@@ -515,7 +527,7 @@ static void init_predictor_decoder(APEContext *ctx)
APEPredictor *p = &ctx->predictor;
/* Zero the history buffers */
- memset(p->historybuffer, 0, PREDICTOR_SIZE * sizeof(int32_t));
+ memset(p->historybuffer, 0, PREDICTOR_SIZE * sizeof(*p->historybuffer));
p->buf = p->historybuffer;
/* Initialize and zero the coefficients */
@@ -583,8 +595,8 @@ static av_always_inline int predictor_update_filter(APEPredictor *p,
static void predictor_decode_stereo(APEContext *ctx, int count)
{
APEPredictor *p = &ctx->predictor;
- int32_t *decoded0 = ctx->decoded0;
- int32_t *decoded1 = ctx->decoded1;
+ int32_t *decoded0 = ctx->decoded[0];
+ int32_t *decoded1 = ctx->decoded[1];
while (count--) {
/* Predictor Y */
@@ -600,7 +612,8 @@ static void predictor_decode_stereo(APEContext *ctx, int count)
/* Have we filled the history buffer? */
if (p->buf == p->historybuffer + HISTORY_SIZE) {
- memmove(p->historybuffer, p->buf, PREDICTOR_SIZE * sizeof(int32_t));
+ memmove(p->historybuffer, p->buf,
+ PREDICTOR_SIZE * sizeof(*p->historybuffer));
p->buf = p->historybuffer;
}
}
@@ -609,7 +622,7 @@ static void predictor_decode_stereo(APEContext *ctx, int count)
static void predictor_decode_mono(APEContext *ctx, int count)
{
APEPredictor *p = &ctx->predictor;
- int32_t *decoded0 = ctx->decoded0;
+ int32_t *decoded0 = ctx->decoded[0];
int32_t predictionA, currentA, A, sign;
currentA = p->lastA[0];
@@ -640,7 +653,8 @@ static void predictor_decode_mono(APEContext *ctx, int count)
/* Have we filled the history buffer? */
if (p->buf == p->historybuffer + HISTORY_SIZE) {
- memmove(p->historybuffer, p->buf, PREDICTOR_SIZE * sizeof(int32_t));
+ memmove(p->historybuffer, p->buf,
+ PREDICTOR_SIZE * sizeof(*p->historybuffer));
p->buf = p->historybuffer;
}
@@ -658,8 +672,8 @@ static void do_init_filter(APEFilter *f, int16_t *buf, int order)
f->delay = f->historybuffer + order * 2;
f->adaptcoeffs = f->historybuffer + order;
- memset(f->historybuffer, 0, (order * 2) * sizeof(int16_t));
- memset(f->coeffs, 0, order * sizeof(int16_t));
+ memset(f->historybuffer, 0, (order * 2) * sizeof(*f->historybuffer));
+ memset(f->coeffs, 0, order * sizeof(*f->coeffs));
f->avg = 0;
}
@@ -715,7 +729,7 @@ static void do_apply_filter(APEContext *ctx, int version, APEFilter *f,
/* Have we filled the history buffer? */
if (f->delay == f->historybuffer + HISTORY_SIZE + (order * 2)) {
memmove(f->historybuffer, f->delay - (order * 2),
- (order * 2) * sizeof(int16_t));
+ (order * 2) * sizeof(*f->historybuffer));
f->delay = f->historybuffer + order * 2;
f->adaptcoeffs = f->historybuffer + order;
}
@@ -763,33 +777,29 @@ static int init_frame_decoder(APEContext *ctx)
static void ape_unpack_mono(APEContext *ctx, int count)
{
- int32_t *decoded0 = ctx->decoded0;
- int32_t *decoded1 = ctx->decoded1;
-
if (ctx->frameflags & APE_FRAMECODE_STEREO_SILENCE) {
- entropy_decode(ctx, count, 0);
/* We are pure silence, so we're done. */
av_log(ctx->avctx, AV_LOG_DEBUG, "pure silence mono\n");
return;
}
entropy_decode(ctx, count, 0);
- ape_apply_filters(ctx, decoded0, NULL, count);
+ ape_apply_filters(ctx, ctx->decoded[0], NULL, count);
/* Now apply the predictor decoding */
predictor_decode_mono(ctx, count);
/* Pseudo-stereo - just copy left channel to right channel */
if (ctx->channels == 2) {
- memcpy(decoded1, decoded0, count * sizeof(*decoded1));
+ memcpy(ctx->decoded[1], ctx->decoded[0], count * sizeof(*ctx->decoded[1]));
}
}
static void ape_unpack_stereo(APEContext *ctx, int count)
{
int32_t left, right;
- int32_t *decoded0 = ctx->decoded0;
- int32_t *decoded1 = ctx->decoded1;
+ int32_t *decoded0 = ctx->decoded[0];
+ int32_t *decoded1 = ctx->decoded[1];
if (ctx->frameflags & APE_FRAMECODE_STEREO_SILENCE) {
/* We are pure silence, so we're done. */
@@ -817,10 +827,11 @@ static int ape_decode_frame(AVCodecContext *avctx, void *data,
int *got_frame_ptr, AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
- int buf_size = avpkt->size;
APEContext *s = avctx->priv_data;
- int16_t *samples;
- int i, ret;
+ uint8_t *sample8;
+ int16_t *sample16;
+ int32_t *sample24;
+ int i, ch, ret;
int blockstodecode;
int bytes_used = 0;
@@ -830,21 +841,25 @@ static int ape_decode_frame(AVCodecContext *avctx, void *data,
if(!s->samples){
uint32_t nblocks, offset;
- void *tmp_data;
+ int buf_size;
- if (!buf_size) {
+ if (!avpkt->size) {
*got_frame_ptr = 0;
return 0;
}
- if (buf_size < 8) {
+ if (avpkt->size < 8) {
av_log(avctx, AV_LOG_ERROR, "Packet is too small\n");
return AVERROR_INVALIDDATA;
}
+ buf_size = avpkt->size & ~3;
+ if (buf_size != avpkt->size) {
+ av_log(avctx, AV_LOG_WARNING, "packet size is not a multiple of 4. "
+ "extra bytes at the end will be skipped.\n");
+ }
- tmp_data = av_realloc(s->data, FFALIGN(buf_size, 4));
- if (!tmp_data)
+ av_fast_malloc(&s->data, &s->data_size, buf_size);
+ if (!s->data)
return AVERROR(ENOMEM);
- s->data = tmp_data;
s->dsp.bswap_buf((uint32_t*)s->data, (const uint32_t*)buf, buf_size >> 2);
s->ptr = s->data;
s->data_end = s->data + buf_size;
@@ -868,32 +883,37 @@ static int ape_decode_frame(AVCodecContext *avctx, void *data,
}
s->samples = nblocks;
- memset(s->decoded0, 0, sizeof(s->decoded0));
- memset(s->decoded1, 0, sizeof(s->decoded1));
-
/* Initialize the frame decoder */
if (init_frame_decoder(s) < 0) {
av_log(avctx, AV_LOG_ERROR, "Error reading frame header\n");
return AVERROR_INVALIDDATA;
}
- bytes_used = buf_size;
+ bytes_used = avpkt->size;
}
if (!s->data) {
*got_frame_ptr = 0;
- return buf_size;
+ return avpkt->size;
}
- blockstodecode = FFMIN(BLOCKS_PER_LOOP, s->samples);
+ blockstodecode = FFMIN(s->blocks_per_loop, s->samples);
+
+ /* reallocate decoded sample buffer if needed */
+ av_fast_malloc(&s->decoded_buffer, &s->decoded_size,
+ 2 * FFALIGN(blockstodecode, 8) * sizeof(*s->decoded_buffer));
+ if (!s->decoded_buffer)
+ return AVERROR(ENOMEM);
+ memset(s->decoded_buffer, 0, s->decoded_size);
+ s->decoded[0] = s->decoded_buffer;
+ s->decoded[1] = s->decoded_buffer + FFALIGN(blockstodecode, 8);
/* get output buffer */
s->frame.nb_samples = blockstodecode;
- if ((ret = avctx->get_buffer(avctx, &s->frame)) < 0) {
+ if ((ret = ff_get_buffer(avctx, &s->frame)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return ret;
}
- samples = (int16_t *)s->frame.data[0];
s->error=0;
@@ -909,10 +929,28 @@ static int ape_decode_frame(AVCodecContext *avctx, void *data,
return AVERROR_INVALIDDATA;
}
- for (i = 0; i < blockstodecode; i++) {
- *samples++ = s->decoded0[i];
- if(s->channels == 2)
- *samples++ = s->decoded1[i];
+ switch (s->bps) {
+ case 8:
+ for (ch = 0; ch < s->channels; ch++) {
+ sample8 = (uint8_t *)s->frame.data[ch];
+ for (i = 0; i < blockstodecode; i++)
+ *sample8++ = (s->decoded[ch][i] + 0x80) & 0xff;
+ }
+ break;
+ case 16:
+ for (ch = 0; ch < s->channels; ch++) {
+ sample16 = (int16_t *)s->frame.data[ch];
+ for (i = 0; i < blockstodecode; i++)
+ *sample16++ = s->decoded[ch][i];
+ }
+ break;
+ case 24:
+ for (ch = 0; ch < s->channels; ch++) {
+ sample24 = (int32_t *)s->frame.data[ch];
+ for (i = 0; i < blockstodecode; i++)
+ *sample24++ = s->decoded[ch][i] << 8;
+ }
+ break;
}
s->samples -= blockstodecode;
@@ -929,15 +967,35 @@ static void ape_flush(AVCodecContext *avctx)
s->samples= 0;
}
+#define OFFSET(x) offsetof(APEContext, x)
+#define PAR (AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_AUDIO_PARAM)
+static const AVOption options[] = {
+ { "max_samples", "maximum number of samples decoded per call", OFFSET(blocks_per_loop), AV_OPT_TYPE_INT, { .i64 = 4608 }, 1, INT_MAX, PAR, "max_samples" },
+ { "all", "no maximum. decode all samples for each packet at once", 0, AV_OPT_TYPE_CONST, { .i64 = INT_MAX }, INT_MIN, INT_MAX, PAR, "max_samples" },
+ { NULL},
+};
+
+static const AVClass ape_decoder_class = {
+ .class_name = "APE decoder",
+ .item_name = av_default_item_name,
+ .option = options,
+ .version = LIBAVUTIL_VERSION_INT,
+};
+
AVCodec ff_ape_decoder = {
.name = "ape",
.type = AVMEDIA_TYPE_AUDIO,
- .id = CODEC_ID_APE,
+ .id = AV_CODEC_ID_APE,
.priv_data_size = sizeof(APEContext),
.init = ape_decode_init,
.close = ape_decode_close,
.decode = ape_decode_frame,
.capabilities = CODEC_CAP_SUBFRAMES | CODEC_CAP_DELAY | CODEC_CAP_DR1,
- .flush = ape_flush,
- .long_name = NULL_IF_CONFIG_SMALL("Monkey's Audio"),
+ .flush = ape_flush,
+ .long_name = NULL_IF_CONFIG_SMALL("Monkey's Audio"),
+ .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_U8P,
+ AV_SAMPLE_FMT_S16P,
+ AV_SAMPLE_FMT_S32P,
+ AV_SAMPLE_FMT_NONE },
+ .priv_class = &ape_decoder_class,
};
diff --git a/gst-libs/ext/libav/libavcodec/api-example.c b/gst-libs/ext/libav/libavcodec/api-example.c
index 970a90e..949b3ef 100644
--- a/gst-libs/ext/libav/libavcodec/api-example.c
+++ b/gst-libs/ext/libav/libavcodec/api-example.c
@@ -37,6 +37,9 @@
#endif
#include "libavcodec/avcodec.h"
+#include "libavutil/channel_layout.h"
+#include "libavutil/common.h"
+#include "libavutil/imgutils.h"
#include "libavutil/mathematics.h"
#include "libavutil/samplefmt.h"
@@ -44,6 +47,59 @@
#define AUDIO_INBUF_SIZE 20480
#define AUDIO_REFILL_THRESH 4096
+/* check that a given sample format is supported by the encoder */
+static int check_sample_fmt(AVCodec *codec, enum AVSampleFormat sample_fmt)
+{
+ const enum AVSampleFormat *p = codec->sample_fmts;
+
+ while (*p != AV_SAMPLE_FMT_NONE) {
+ if (*p == sample_fmt)
+ return 1;
+ p++;
+ }
+ return 0;
+}
+
+/* just pick the highest supported samplerate */
+static int select_sample_rate(AVCodec *codec)
+{
+ const int *p;
+ int best_samplerate = 0;
+
+ if (!codec->supported_samplerates)
+ return 44100;
+
+ p = codec->supported_samplerates;
+ while (*p) {
+ best_samplerate = FFMAX(*p, best_samplerate);
+ p++;
+ }
+ return best_samplerate;
+}
+
+/* select layout with the highest channel count */
+static int select_channel_layout(AVCodec *codec)
+{
+ const uint64_t *p;
+ uint64_t best_ch_layout = 0;
+ int best_nb_channells = 0;
+
+ if (!codec->channel_layouts)
+ return AV_CH_LAYOUT_STEREO;
+
+ p = codec->channel_layouts;
+ while (*p) {
+ int nb_channels = av_get_channel_layout_nb_channels(*p);
+
+ if (nb_channels > best_nb_channells) {
+ best_ch_layout = *p;
+ best_nb_channells = nb_channels;
+ }
+ p++;
+ }
+ return best_ch_layout;
+}
+
/*
* Audio encoding example
*/
@@ -51,16 +107,18 @@ static void audio_encode_example(const char *filename)
{
AVCodec *codec;
AVCodecContext *c= NULL;
- int frame_size, i, j, out_size, outbuf_size;
+ AVFrame *frame;
+ AVPacket pkt;
+ int i, j, k, ret, got_output;
+ int buffer_size;
FILE *f;
- short *samples;
+ uint16_t *samples;
float t, tincr;
- uint8_t *outbuf;
printf("Audio encoding\n");
/* find the MP2 encoder */
- codec = avcodec_find_encoder(CODEC_ID_MP2);
+ codec = avcodec_find_encoder(AV_CODEC_ID_MP2);
if (!codec) {
fprintf(stderr, "codec not found\n");
exit(1);
@@ -70,44 +128,91 @@ static void audio_encode_example(const char *filename)
/* put sample parameters */
c->bit_rate = 64000;
- c->sample_rate = 44100;
- c->channels = 2;
+
+ /* check that the encoder supports s16 pcm input */
+ c->sample_fmt = AV_SAMPLE_FMT_S16;
+ if (!check_sample_fmt(codec, c->sample_fmt)) {
+ fprintf(stderr, "encoder does not support %s",
+ av_get_sample_fmt_name(c->sample_fmt));
+ exit(1);
+ }
+
+ /* select other audio parameters supported by the encoder */
+ c->sample_rate = select_sample_rate(codec);
+ c->channel_layout = select_channel_layout(codec);
+ c->channels = av_get_channel_layout_nb_channels(c->channel_layout);
/* open it */
- if (avcodec_open(c, codec) < 0) {
+ if (avcodec_open2(c, codec, NULL) < 0) {
fprintf(stderr, "could not open codec\n");
exit(1);
}
- /* the codec gives us the frame size, in samples */
- frame_size = c->frame_size;
- samples = malloc(frame_size * 2 * c->channels);
- outbuf_size = 10000;
- outbuf = malloc(outbuf_size);
-
f = fopen(filename, "wb");
if (!f) {
fprintf(stderr, "could not open %s\n", filename);
exit(1);
}
+ /* frame containing input raw audio */
+ frame = avcodec_alloc_frame();
+ if (!frame) {
+ fprintf(stderr, "could not allocate audio frame\n");
+ exit(1);
+ }
+
+ frame->nb_samples = c->frame_size;
+ frame->format = c->sample_fmt;
+ frame->channel_layout = c->channel_layout;
+
+ /* the codec gives us the frame size, in samples,
+ * we calculate the size of the samples buffer in bytes */
+ buffer_size = av_samples_get_buffer_size(NULL, c->channels, c->frame_size,
+ c->sample_fmt, 0);
+ samples = av_malloc(buffer_size);
+ if (!samples) {
+ fprintf(stderr, "could not allocate %d bytes for samples buffer\n",
+ buffer_size);
+ exit(1);
+ }
+ /* setup the data pointers in the AVFrame */
+ ret = avcodec_fill_audio_frame(frame, c->channels, c->sample_fmt,
+ (const uint8_t*)samples, buffer_size, 0);
+ if (ret < 0) {
+ fprintf(stderr, "could not setup audio frame\n");
+ exit(1);
+ }
+
/* encode a single tone sound */
t = 0;
tincr = 2 * M_PI * 440.0 / c->sample_rate;
for(i=0;i<200;i++) {
- for(j=0;j<frame_size;j++) {
+ av_init_packet(&pkt);
+ pkt.data = NULL; // packet data will be allocated by the encoder
+ pkt.size = 0;
+
+ for (j = 0; j < c->frame_size; j++) {
samples[2*j] = (int)(sin(t) * 10000);
- samples[2*j+1] = samples[2*j];
+
+ for (k = 1; k < c->channels; k++)
+ samples[2*j + k] = samples[2*j];
t += tincr;
}
/* encode the samples */
- out_size = avcodec_encode_audio(c, outbuf, outbuf_size, samples);
- fwrite(outbuf, 1, out_size, f);
+ ret = avcodec_encode_audio2(c, &pkt, frame, &got_output);
+ if (ret < 0) {
+ fprintf(stderr, "error encoding audio frame\n");
+ exit(1);
+ }
+ if (got_output) {
+ fwrite(pkt.data, 1, pkt.size, f);
+ av_free_packet(&pkt);
+ }
}
fclose(f);
- free(outbuf);
- free(samples);
+ av_freep(&samples);
+ avcodec_free_frame(&frame);
avcodec_close(c);
av_free(c);
}
@@ -130,7 +235,7 @@ static void audio_decode_example(const char *outfilename, const char *filename)
printf("Audio decoding\n");
/* find the mpeg audio decoder */
- codec = avcodec_find_decoder(CODEC_ID_MP2);
+ codec = avcodec_find_decoder(AV_CODEC_ID_MP2);
if (!codec) {
fprintf(stderr, "codec not found\n");
exit(1);
@@ -139,7 +244,7 @@ static void audio_decode_example(const char *outfilename, const char *filename)
c = avcodec_alloc_context3(codec);
/* open it */
- if (avcodec_open(c, codec) < 0) {
+ if (avcodec_open2(c, codec, NULL) < 0) {
fprintf(stderr, "could not open codec\n");
exit(1);
}
@@ -203,7 +308,7 @@ static void audio_decode_example(const char *outfilename, const char *filename)
avcodec_close(c);
av_free(c);
- av_free(decoded_frame);
+ avcodec_free_frame(&decoded_frame);
}
/*
@@ -213,15 +318,16 @@ static void video_encode_example(const char *filename)
{
AVCodec *codec;
AVCodecContext *c= NULL;
- int i, out_size, size, x, y, outbuf_size;
+ int i, ret, x, y, got_output;
FILE *f;
AVFrame *picture;
- uint8_t *outbuf, *picture_buf;
+ AVPacket pkt;
+ uint8_t endcode[] = { 0, 0, 1, 0xb7 };
printf("Video encoding\n");
/* find the mpeg1 video encoder */
- codec = avcodec_find_encoder(CODEC_ID_MPEG1VIDEO);
+ codec = avcodec_find_encoder(AV_CODEC_ID_MPEG1VIDEO);
if (!codec) {
fprintf(stderr, "codec not found\n");
exit(1);
@@ -239,10 +345,10 @@ static void video_encode_example(const char *filename)
c->time_base= (AVRational){1,25};
c->gop_size = 10; /* emit one intra frame every ten frames */
c->max_b_frames=1;
- c->pix_fmt = PIX_FMT_YUV420P;
+ c->pix_fmt = AV_PIX_FMT_YUV420P;
/* open it */
- if (avcodec_open(c, codec) < 0) {
+ if (avcodec_open2(c, codec, NULL) < 0) {
fprintf(stderr, "could not open codec\n");
exit(1);
}
@@ -253,21 +359,22 @@ static void video_encode_example(const char *filename)
exit(1);
}
- /* alloc image and output buffer */
- outbuf_size = 100000;
- outbuf = malloc(outbuf_size);
- size = c->width * c->height;
- picture_buf = malloc((size * 3) / 2); /* size for YUV 420 */
-
- picture->data[0] = picture_buf;
- picture->data[1] = picture->data[0] + size;
- picture->data[2] = picture->data[1] + size / 4;
- picture->linesize[0] = c->width;
- picture->linesize[1] = c->width / 2;
- picture->linesize[2] = c->width / 2;
+ ret = av_image_alloc(picture->data, picture->linesize, c->width, c->height,
+ c->pix_fmt, 32);
+ if (ret < 0) {
+ fprintf(stderr, "could not alloc raw picture buffer\n");
+ exit(1);
+ }
+ picture->format = c->pix_fmt;
+ picture->width = c->width;
+ picture->height = c->height;
/* encode 1 second of video */
for(i=0;i<25;i++) {
+ av_init_packet(&pkt);
+ pkt.data = NULL; // packet data will be allocated by the encoder
+ pkt.size = 0;
+
fflush(stdout);
/* prepare a dummy image */
/* Y */
@@ -285,34 +392,47 @@ static void video_encode_example(const char *filename)
}
}
+ picture->pts = i;
+
/* encode the image */
- out_size = avcodec_encode_video(c, outbuf, outbuf_size, picture);
- printf("encoding frame %3d (size=%5d)\n", i, out_size);
- fwrite(outbuf, 1, out_size, f);
+ ret = avcodec_encode_video2(c, &pkt, picture, &got_output);
+ if (ret < 0) {
+ fprintf(stderr, "error encoding frame\n");
+ exit(1);
+ }
+
+ if (got_output) {
+ printf("encoding frame %3d (size=%5d)\n", i, pkt.size);
+ fwrite(pkt.data, 1, pkt.size, f);
+ av_free_packet(&pkt);
+ }
}
/* get the delayed frames */
- for(; out_size; i++) {
+ for (got_output = 1; got_output; i++) {
fflush(stdout);
- out_size = avcodec_encode_video(c, outbuf, outbuf_size, NULL);
- printf("write frame %3d (size=%5d)\n", i, out_size);
- fwrite(outbuf, 1, out_size, f);
+ ret = avcodec_encode_video2(c, &pkt, NULL, &got_output);
+ if (ret < 0) {
+ fprintf(stderr, "error encoding frame\n");
+ exit(1);
+ }
+
+ if (got_output) {
+ printf("encoding frame %3d (size=%5d)\n", i, pkt.size);
+ fwrite(pkt.data, 1, pkt.size, f);
+ av_free_packet(&pkt);
+ }
}
/* add sequence end code to have a real mpeg file */
- outbuf[0] = 0x00;
- outbuf[1] = 0x00;
- outbuf[2] = 0x01;
- outbuf[3] = 0xb7;
- fwrite(outbuf, 1, 4, f);
+ fwrite(endcode, 1, sizeof(endcode), f);
fclose(f);
- free(picture_buf);
- free(outbuf);
avcodec_close(c);
av_free(c);
- av_free(picture);
+ av_freep(&picture->data[0]);
+ avcodec_free_frame(&picture);
printf("\n");
}
@@ -352,7 +472,7 @@ static void video_decode_example(const char *outfilename, const char *filename)
printf("Video decoding\n");
/* find the mpeg1 video decoder */
- codec = avcodec_find_decoder(CODEC_ID_MPEG1VIDEO);
+ codec = avcodec_find_decoder(AV_CODEC_ID_MPEG1VIDEO);
if (!codec) {
fprintf(stderr, "codec not found\n");
exit(1);
@@ -369,7 +489,7 @@ static void video_decode_example(const char *outfilename, const char *filename)
available in the bitstream. */
/* open it */
- if (avcodec_open(c, codec) < 0) {
+ if (avcodec_open2(c, codec, NULL) < 0) {
fprintf(stderr, "could not open codec\n");
exit(1);
}
@@ -448,7 +568,7 @@ static void video_decode_example(const char *outfilename, const char *filename)
avcodec_close(c);
av_free(c);
- av_free(picture);
+ avcodec_free_frame(&picture);
printf("\n");
}
@@ -456,9 +576,6 @@ int main(int argc, char **argv)
{
const char *filename;
- /* must be called before using avcodec lib */
- avcodec_init();
-
/* register all the codecs */
avcodec_register_all();
diff --git a/gst-libs/ext/libav/libavcodec/arm/Makefile b/gst-libs/ext/libav/libavcodec/arm/Makefile
index fc17113..ac486f4 100644
--- a/gst-libs/ext/libav/libavcodec/arm/Makefile
+++ b/gst-libs/ext/libav/libavcodec/arm/Makefile
@@ -1,48 +1,62 @@
OBJS-$(CONFIG_AC3DSP) += arm/ac3dsp_init_arm.o \
arm/ac3dsp_arm.o
+OBJS-$(CONFIG_AAC_DECODER) += arm/sbrdsp_init_arm.o \
+ arm/aacpsdsp_init_arm.o
+
OBJS-$(CONFIG_DCA_DECODER) += arm/dcadsp_init_arm.o \
ARMV6-OBJS-$(CONFIG_AC3DSP) += arm/ac3dsp_armv6.o
+OBJS-$(CONFIG_FLAC_DECODER) += arm/flacdsp_init_arm.o \
+ arm/flacdsp_arm.o \
+
OBJS-$(CONFIG_MPEGAUDIODSP) += arm/mpegaudiodsp_init_arm.o
ARMV6-OBJS-$(CONFIG_MPEGAUDIODSP) += arm/mpegaudiodsp_fixed_armv6.o
+OBJS-$(CONFIG_MPEGVIDEO) += arm/mpegvideo_arm.o
+OBJS-$(CONFIG_VP3DSP) += arm/vp3dsp_init_arm.o
OBJS-$(CONFIG_VP5_DECODER) += arm/vp56dsp_init_arm.o
OBJS-$(CONFIG_VP6_DECODER) += arm/vp56dsp_init_arm.o
OBJS-$(CONFIG_VP8_DECODER) += arm/vp8dsp_init_arm.o
-ARMV6-OBJS-$(CONFIG_VP8_DECODER) += arm/vp8_armv6.o
+ARMV6-OBJS-$(CONFIG_VP8_DECODER) += arm/vp8_armv6.o \
+ arm/vp8dsp_init_armv6.o \
+ arm/vp8dsp_armv6.o
OBJS-$(CONFIG_H264DSP) += arm/h264dsp_init_arm.o
OBJS-$(CONFIG_H264PRED) += arm/h264pred_init_arm.o
+OBJS-$(CONFIG_RV30_DECODER) += arm/rv34dsp_init_arm.o
+OBJS-$(CONFIG_RV40_DECODER) += arm/rv34dsp_init_arm.o \
+ arm/rv40dsp_init_arm.o \
+
+OBJS-$(CONFIG_VIDEODSP) += arm/videodsp_init_arm.o \
+
OBJS += arm/dsputil_init_arm.o \
arm/dsputil_arm.o \
arm/fft_init_arm.o \
arm/fft_fixed_init_arm.o \
arm/fmtconvert_init_arm.o \
arm/jrevdct_arm.o \
- arm/mpegvideo_arm.o \
arm/simple_idct_arm.o \
-OBJS-$(HAVE_ARMV5TE) += arm/dsputil_init_armv5te.o \
- arm/mpegvideo_armv5te.o \
+ARMV5TE-OBJS-$(CONFIG_MPEGVIDEO) += arm/mpegvideo_armv5te.o \
arm/mpegvideo_armv5te_s.o \
+
+ARMV5TE-OBJS-$(CONFIG_VIDEODSP) += arm/videodsp_init_armv5te.o \
+ arm/videodsp_armv5te.o \
+
+ARMV5TE-OBJS += arm/dsputil_init_armv5te.o \
arm/simple_idct_armv5te.o \
-OBJS-$(HAVE_ARMV6) += arm/dsputil_init_armv6.o \
+ARMV6-OBJS += arm/dsputil_init_armv6.o \
arm/dsputil_armv6.o \
arm/simple_idct_armv6.o \
- $(ARMV6-OBJS-yes)
-VFP-OBJS-$(HAVE_ARMV6) += arm/fmtconvert_vfp.o \
+VFP-OBJS-$(HAVE_ARMV6) += arm/fmtconvert_vfp.o
-OBJS-$(HAVE_ARMVFP) += arm/dsputil_vfp.o \
+VFP-OBJS += arm/dsputil_vfp.o \
arm/dsputil_init_vfp.o \
- $(VFP-OBJS-yes)
-
-OBJS-$(HAVE_IWMMXT) += arm/dsputil_iwmmxt.o \
- arm/mpegvideo_iwmmxt.o \
NEON-OBJS-$(CONFIG_FFT) += arm/fft_neon.o \
arm/fft_fixed_neon.o \
@@ -60,32 +74,29 @@ NEON-OBJS-$(CONFIG_H264PRED) += arm/h264pred_neon.o \
NEON-OBJS-$(CONFIG_AC3DSP) += arm/ac3dsp_neon.o
+NEON-OBJS-$(CONFIG_AAC_DECODER) += arm/sbrdsp_neon.o \
+ arm/aacpsdsp_neon.o
+
NEON-OBJS-$(CONFIG_DCA_DECODER) += arm/dcadsp_neon.o \
arm/synth_filter_neon.o \
-NEON-OBJS-$(CONFIG_RV30_DECODER) += arm/rv34dsp_init_neon.o \
- arm/rv34dsp_neon.o \
-
-NEON-OBJS-$(CONFIG_RV40_DECODER) += arm/rv34dsp_init_neon.o \
- arm/rv34dsp_neon.o \
- arm/rv40dsp_init_neon.o \
+NEON-OBJS-$(CONFIG_MPEGVIDEO) += arm/mpegvideo_neon.o
+NEON-OBJS-$(CONFIG_RV30_DECODER) += arm/rv34dsp_neon.o
+NEON-OBJS-$(CONFIG_RV40_DECODER) += arm/rv34dsp_neon.o \
arm/rv40dsp_neon.o \
arm/h264cmc_neon.o \
-NEON-OBJS-$(CONFIG_VP3_DECODER) += arm/vp3dsp_neon.o
+NEON-OBJS-$(CONFIG_VP3DSP) += arm/vp3dsp_neon.o
NEON-OBJS-$(CONFIG_VP5_DECODER) += arm/vp56dsp_neon.o \
- arm/vp3dsp_neon.o \
NEON-OBJS-$(CONFIG_VP6_DECODER) += arm/vp56dsp_neon.o \
- arm/vp3dsp_neon.o \
-NEON-OBJS-$(CONFIG_VP8_DECODER) += arm/vp8dsp_neon.o
+NEON-OBJS-$(CONFIG_VP8_DECODER) += arm/vp8dsp_init_neon.o \
+ arm/vp8dsp_neon.o
-OBJS-$(HAVE_NEON) += arm/dsputil_init_neon.o \
+NEON-OBJS += arm/dsputil_init_neon.o \
arm/dsputil_neon.o \
arm/fmtconvert_neon.o \
arm/int_neon.o \
- arm/mpegvideo_neon.o \
arm/simple_idct_neon.o \
- $(NEON-OBJS-yes)
diff --git a/gst-libs/ext/libav/libavcodec/arm/aac.h b/gst-libs/ext/libav/libavcodec/arm/aac.h
index 83b5aef..4f143cb 100644
--- a/gst-libs/ext/libav/libavcodec/arm/aac.h
+++ b/gst-libs/ext/libav/libavcodec/arm/aac.h
@@ -23,7 +23,7 @@
#include "config.h"
-#if HAVE_NEON && HAVE_INLINE_ASM
+#if HAVE_NEON_INLINE
#define VMUL2 VMUL2
static inline float *VMUL2(float *dst, const float *v, unsigned idx,
@@ -138,6 +138,6 @@ static inline float *VMUL4S(float *dst, const float *v, unsigned idx,
return dst;
}
-#endif /* HAVE_NEON && HAVE_INLINE_ASM */
+#endif /* HAVE_NEON_INLINE */
#endif /* AVCODEC_ARM_AAC_H */
diff --git a/gst-libs/ext/libav/libavcodec/arm/aacpsdsp_init_arm.c b/gst-libs/ext/libav/libavcodec/arm/aacpsdsp_init_arm.c
new file mode 100644
index 0000000..6326376
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/arm/aacpsdsp_init_arm.c
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2012 Mans Rullgard
+ *
+ * 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
+ */
+
+#include "config.h"
+
+#include "libavutil/arm/cpu.h"
+#include "libavutil/attributes.h"
+#include "libavcodec/aacpsdsp.h"
+
+void ff_ps_add_squares_neon(float *dst, const float (*src)[2], int n);
+void ff_ps_mul_pair_single_neon(float (*dst)[2], float (*src0)[2],
+ float *src1, int n);
+void ff_ps_hybrid_analysis_neon(float (*out)[2], float (*in)[2],
+ const float (*filter)[8][2],
+ int stride, int n);
+void ff_ps_hybrid_analysis_ileave_neon(float (*out)[32][2], float L[2][38][64],
+ int i, int len);
+void ff_ps_hybrid_synthesis_deint_neon(float out[2][38][64], float (*in)[32][2],
+ int i, int len);
+void ff_ps_decorrelate_neon(float (*out)[2], float (*delay)[2],
+ float (*ap_delay)[PS_QMF_TIME_SLOTS+PS_MAX_AP_DELAY][2],
+ const float phi_fract[2], float (*Q_fract)[2],
+ const float *transient_gain, float g_decay_slope,
+ int len);
+void ff_ps_stereo_interpolate_neon(float (*l)[2], float (*r)[2],
+ float h[2][4], float h_step[2][4],
+ int len);
+
+av_cold void ff_psdsp_init_arm(PSDSPContext *s)
+{
+ int cpu_flags = av_get_cpu_flags();
+
+ if (have_neon(cpu_flags)) {
+ s->add_squares = ff_ps_add_squares_neon;
+ s->mul_pair_single = ff_ps_mul_pair_single_neon;
+ s->hybrid_synthesis_deint = ff_ps_hybrid_synthesis_deint_neon;
+ s->hybrid_analysis = ff_ps_hybrid_analysis_neon;
+ s->stereo_interpolate[0] = ff_ps_stereo_interpolate_neon;
+ }
+}
diff --git a/gst-libs/ext/libav/libavcodec/arm/aacpsdsp_neon.S b/gst-libs/ext/libav/libavcodec/arm/aacpsdsp_neon.S
new file mode 100644
index 0000000..fb00900
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/arm/aacpsdsp_neon.S
@@ -0,0 +1,272 @@
+/*
+ * Copyright (c) 2012 Mans Rullgard
+ *
+ * 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
+ */
+
+#include "libavutil/arm/asm.S"
+
+function ff_ps_add_squares_neon, export=1
+ mov r3, r0
+ sub r2, r2, #4
+ vld1.32 {q0}, [r1,:128]!
+ vmul.f32 q0, q0, q0
+ vld1.32 {q2}, [r1,:128]!
+ vmul.f32 q2, q2, q2
+ vld1.32 {q1}, [r0,:128]!
+1:
+ vpadd.f32 d6, d0, d1
+ vld1.32 {q0}, [r1,:128]!
+ vpadd.f32 d7, d4, d5
+ vmul.f32 q0, q0, q0
+ vld1.32 {q2}, [r1,:128]!
+ vadd.f32 q3, q1, q3
+ vld1.32 {q1}, [r0,:128]!
+ vmul.f32 q2, q2, q2
+ vst1.32 {q3}, [r3,:128]!
+ subs r2, r2, #4
+ bgt 1b
+ vpadd.f32 d6, d0, d1
+ vpadd.f32 d7, d4, d5
+ vadd.f32 q1, q1, q3
+ vst1.32 {q1}, [r3,:128]!
+ bx lr
+endfunc
+
+function ff_ps_mul_pair_single_neon, export=1
+ sub r3, r3, #4
+ tst r1, #8
+ bne 2f
+ vld1.32 {q0}, [r1,:128]!
+1:
+ vld1.32 {q3}, [r2,:128]!
+ vmul.f32 d4, d0, d6[0]
+ vmul.f32 d5, d1, d6[1]
+ vld1.32 {q1}, [r1,:128]!
+ vmul.f32 d6, d2, d7[0]
+ vmul.f32 d7, d3, d7[1]
+ vld1.32 {q0}, [r1,:128]!
+ vst1.32 {q2,q3}, [r0,:128]!
+ subs r3, r3, #4
+ bgt 1b
+ vld1.32 {q3}, [r2,:128]!
+ vmul.f32 d4, d0, d6[0]
+ vmul.f32 d5, d1, d6[1]
+ vld1.32 {q1}, [r1,:128]!
+ vmul.f32 d6, d2, d7[0]
+ vmul.f32 d7, d3, d7[1]
+ vst1.32 {q2,q3}, [r0,:128]!
+ bx lr
+2:
+ vld1.32 {d0}, [r1,:64]!
+ vld1.32 {d1,d2}, [r1,:128]!
+1:
+ vld1.32 {q3}, [r2,:128]!
+ vmul.f32 d4, d0, d6[0]
+ vmul.f32 d5, d1, d6[1]
+ vld1.32 {d0,d1}, [r1,:128]!
+ vmul.f32 d6, d2, d7[0]
+ vmul.f32 d7, d0, d7[1]
+ vmov d0, d1
+ vld1.32 {d1,d2}, [r1,:128]!
+ vst1.32 {q2,q3}, [r0,:128]!
+ subs r3, r3, #4
+ bgt 1b
+ vld1.32 {q3}, [r2,:128]!
+ vmul.f32 d4, d0, d6[0]
+ vmul.f32 d5, d1, d6[1]
+ vld1.32 {d0}, [r1,:64]!
+ vmul.f32 d6, d2, d7[0]
+ vmul.f32 d7, d0, d7[1]
+ vst1.32 {q2,q3}, [r0,:128]!
+ bx lr
+endfunc
+
+function ff_ps_hybrid_synthesis_deint_neon, export=1
+ push {r4-r8,lr}
+ add r0, r0, r2, lsl #2
+ add r1, r1, r2, lsl #5+1+2
+ rsb r2, r2, #64
+ mov r5, #64*4
+ mov lr, r0
+ add r4, r0, #38*64*4
+ mov r12, r3
+2:
+ vld1.32 {d0,d1}, [r1,:128]!
+ vst1.32 {d0[0]}, [lr,:32], r5
+ vst1.32 {d0[1]}, [r4,:32], r5
+ vst1.32 {d1[0]}, [lr,:32], r5
+ vst1.32 {d1[1]}, [r4,:32], r5
+ subs r12, r12, #2
+ bgt 2b
+ add r0, r0, #4
+ sub r2, r2, #1
+ tst r2, #2
+ bne 6f
+1:
+ mov lr, r0
+ add r4, r0, #38*64*4
+ add r6, r1, # 32*2*4
+ add r7, r1, #2*32*2*4
+ add r8, r1, #3*32*2*4
+ mov r12, r3
+2:
+ vld1.32 {d0,d1}, [r1,:128]!
+ vld1.32 {d2,d3}, [r6,:128]!
+ vld1.32 {d4,d5}, [r7,:128]!
+ vld1.32 {d6,d7}, [r8,:128]!
+ vst4.32 {d0[0],d2[0],d4[0],d6[0]}, [lr,:128], r5
+ vst4.32 {d0[1],d2[1],d4[1],d6[1]}, [r4,:128], r5
+ vst4.32 {d1[0],d3[0],d5[0],d7[0]}, [lr,:128], r5
+ vst4.32 {d1[1],d3[1],d5[1],d7[1]}, [r4,:128], r5
+ subs r12, r12, #2
+ bgt 2b
+ add r0, r0, #16
+ add r1, r1, #3*32*2*4
+ subs r2, r2, #4
+ bgt 1b
+ pop {r4-r8,pc}
+6:
+ mov lr, r0
+ add r4, r0, #38*64*4
+ add r6, r1, #32*2*4
+ mov r12, r3
+2:
+ vld1.32 {d0,d1}, [r1,:128]!
+ vld1.32 {d2,d3}, [r6,:128]!
+ vst2.32 {d0[0],d2[0]}, [lr,:64], r5
+ vst2.32 {d0[1],d2[1]}, [r4,:64], r5
+ vst2.32 {d1[0],d3[0]}, [lr,:64], r5
+ vst2.32 {d1[1],d3[1]}, [r4,:64], r5
+ subs r12, r12, #2
+ bgt 2b
+ add r0, r0, #8
+ add r1, r1, #32*2*4
+ sub r2, r2, #2
+ b 1b
+endfunc
+
+function ff_ps_hybrid_analysis_neon, export=1
+ vldm r1, {d19-d31}
+ ldr r12, [sp]
+ lsl r3, r3, #3
+ vadd.f32 d16, d19, d31
+ vadd.f32 d17, d20, d30
+ vsub.f32 d18, d19, d31
+ vsub.f32 d19, d20, d30
+ vsub.f32 d0, d21, d29
+ vsub.f32 d1, d22, d28
+ vadd.f32 d2, d21, d29
+ vadd.f32 d3, d22, d28
+ vadd.f32 d20, d23, d27
+ vadd.f32 d21, d24, d26
+ vsub.f32 d22, d23, d27
+ vsub.f32 d23, d24, d26
+ vmov.i32 d6, #1<<31
+ vmov.i32 d7, #0
+ vmov.f32 q14, #0.0
+ vmov.f32 q15, #0.0
+ vtrn.32 d6, d7
+ vrev64.32 q9, q9
+ vrev64.32 q0, q0
+ vrev64.32 q11, q11
+ veor q9, q9, q3
+ veor q0, q0, q3
+ veor q11, q11, q3
+ vld1.32 {q13}, [r2,:128]!
+ vtrn.32 q8, q9
+ vtrn.32 q1, q0
+ vtrn.32 q10, q11
+ sub r12, r12, #1
+ vmla.f32 q14, q8, q13
+ vld1.32 {q2}, [r2,:128]!
+ vmla.f32 q15, q9, q13
+1:
+ vmla.f32 q14, q1, q2
+ vld1.32 {q13}, [r2,:128]!
+ vmla.f32 q15, q0, q2
+ vmla.f32 q14, q10, q13
+ vld1.32 {q2}, [r2,:128]!
+ vmla.f32 q15, q11, q13
+ vld1.32 {q13}, [r2,:128]!
+ vadd.f32 d6, d28, d29
+ vadd.f32 d7, d30, d31
+ vmov.f32 q14, #0.0
+ vmov.f32 q15, #0.0
+ vmla.f32 q14, q8, q13
+ vpadd.f32 d6, d6, d7
+ vmla.f32 q15, q9, q13
+ vmla.f32 d6, d25, d4[0]
+ vld1.32 {q2}, [r2,:128]!
+ vst1.32 {d6}, [r0,:64], r3
+ subs r12, r12, #1
+ bgt 1b
+ vmla.f32 q14, q1, q2
+ vld1.32 {q13}, [r2,:128]!
+ vmla.f32 q15, q0, q2
+ vmla.f32 q14, q10, q13
+ vld1.32 {q2}, [r2,:128]!
+ vmla.f32 q15, q11, q13
+ vadd.f32 d6, d28, d29
+ vadd.f32 d7, d30, d31
+ vpadd.f32 d6, d6, d7
+ vmla.f32 d6, d25, d4[0]
+ vst1.32 {d6}, [r0,:64], r3
+ bx lr
+endfunc
+
+function ff_ps_stereo_interpolate_neon, export=1
+ vld1.32 {q0}, [r2]
+ vld1.32 {q14}, [r3]
+ vadd.f32 q15, q14, q14
+ mov r2, r0
+ mov r3, r1
+ ldr r12, [sp]
+ vadd.f32 q1, q0, q14
+ vadd.f32 q0, q0, q15
+ vld1.32 {q2}, [r0,:64]!
+ vld1.32 {q3}, [r1,:64]!
+ subs r12, r12, #1
+ beq 2f
+1:
+ vmul.f32 d16, d4, d2[0]
+ vmul.f32 d17, d5, d0[0]
+ vmul.f32 d18, d4, d2[1]
+ vmul.f32 d19, d5, d0[1]
+ vmla.f32 d16, d6, d3[0]
+ vmla.f32 d17, d7, d1[0]
+ vmla.f32 d18, d6, d3[1]
+ vmla.f32 d19, d7, d1[1]
+ vadd.f32 q1, q1, q15
+ vadd.f32 q0, q0, q15
+ vld1.32 {q2}, [r0,:64]!
+ vld1.32 {q3}, [r1,:64]!
+ vst1.32 {q8}, [r2,:64]!
+ vst1.32 {q9}, [r3,:64]!
+ subs r12, r12, #2
+ bgt 1b
+ it lt
+ bxlt lr
+2:
+ vmul.f32 d16, d4, d2[0]
+ vmul.f32 d18, d4, d2[1]
+ vmla.f32 d16, d6, d3[0]
+ vmla.f32 d18, d6, d3[1]
+ vst1.32 {d16}, [r2,:64]!
+ vst1.32 {d18}, [r3,:64]!
+ bx lr
+endfunc
diff --git a/gst-libs/ext/libav/libavcodec/arm/ac3dsp_arm.S b/gst-libs/ext/libav/libavcodec/arm/ac3dsp_arm.S
index 9a7d20e..ed8eb37 100644
--- a/gst-libs/ext/libav/libavcodec/arm/ac3dsp_arm.S
+++ b/gst-libs/ext/libav/libavcodec/arm/ac3dsp_arm.S
@@ -18,7 +18,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "asm.S"
+#include "libavutil/arm/asm.S"
function ff_ac3_update_bap_counts_arm, export=1
push {lr}
diff --git a/gst-libs/ext/libav/libavcodec/arm/ac3dsp_armv6.S b/gst-libs/ext/libav/libavcodec/arm/ac3dsp_armv6.S
index b6aee86..2028d0b 100644
--- a/gst-libs/ext/libav/libavcodec/arm/ac3dsp_armv6.S
+++ b/gst-libs/ext/libav/libavcodec/arm/ac3dsp_armv6.S
@@ -18,7 +18,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "asm.S"
+#include "libavutil/arm/asm.S"
function ff_ac3_bit_alloc_calc_bap_armv6, export=1
ldr r12, [sp]
@@ -26,32 +26,31 @@ function ff_ac3_bit_alloc_calc_bap_armv6, export=1
beq 4f
push {r4-r11,lr}
add r5, sp, #40
- movrel r4, X(ff_ac3_bin_to_band_tab)
- movrel lr, X(ff_ac3_band_start_tab)
+ movrelx r4, X(ff_ac3_bin_to_band_tab), r11
+ movrelx lr, X(ff_ac3_band_start_tab)
ldm r5, {r5-r7}
ldrb r4, [r4, r2]
add r1, r1, r2, lsl #1 @ psd + start
add r0, r0, r4, lsl #1 @ mask + band
- add r4, lr, r4
+ add r4, r4, lr
add r7, r7, r2 @ bap + start
- ldrb r10, [r4], #1
1:
ldrsh r9, [r0], #2 @ mask[band]
mov r8, #0xff0
sub r9, r9, r12 @ - snr_offset
- mov r11, r10
- ldrb r10, [r4], #1 @ band_start_tab[band++]
+ ldrb r10, [r4, #1]! @ band_start_tab[++band]
subs r9, r9, r5 @ - floor
it lt
movlt r9, #0
cmp r10, r3 @ - end
and r9, r9, r8, lsl #1 @ & 0x1fe0
ite gt
- subgt r8, r3, r11
- suble r8, r10, r11
+ subgt r8, r3, r2
+ suble r8, r10, r2
+ mov r2, r10
add r9, r9, r5 @ + floor => m
tst r8, #1
- add r2, r7, r8
+ add r11, r7, r8
bne 3f
b 5f
2:
@@ -65,9 +64,9 @@ function ff_ac3_bit_alloc_calc_bap_armv6, export=1
ldrb lr, [r6, lr]
strb r8, [r7], #1 @ bap[bin]
strb lr, [r7], #1
-5: cmp r7, r2
+5: cmp r7, r11
blo 2b
- cmp r3, r11
+ cmp r3, r10
bgt 1b
pop {r4-r11,pc}
3:
diff --git a/gst-libs/ext/libav/libavcodec/arm/ac3dsp_init_arm.c b/gst-libs/ext/libav/libavcodec/arm/ac3dsp_init_arm.c
index aed11f4..d7cb95b 100644
--- a/gst-libs/ext/libav/libavcodec/arm/ac3dsp_init_arm.c
+++ b/gst-libs/ext/libav/libavcodec/arm/ac3dsp_init_arm.c
@@ -19,6 +19,8 @@
*/
#include <stdint.h>
+
+#include "libavutil/arm/cpu.h"
#include "libavutil/attributes.h"
#include "libavcodec/ac3dsp.h"
#include "config.h"
@@ -39,13 +41,15 @@ void ff_ac3_update_bap_counts_arm(uint16_t mant_cnt[16], uint8_t *bap, int len);
av_cold void ff_ac3dsp_init_arm(AC3DSPContext *c, int bit_exact)
{
+ int cpu_flags = av_get_cpu_flags();
+
c->update_bap_counts = ff_ac3_update_bap_counts_arm;
- if (HAVE_ARMV6) {
+ if (have_armv6(cpu_flags)) {
c->bit_alloc_calc_bap = ff_ac3_bit_alloc_calc_bap_armv6;
}
- if (HAVE_NEON) {
+ if (have_neon(cpu_flags)) {
c->ac3_exponent_min = ff_ac3_exponent_min_neon;
c->ac3_max_msb_abs_int16 = ff_ac3_max_msb_abs_int16_neon;
c->ac3_lshift_int16 = ff_ac3_lshift_int16_neon;
diff --git a/gst-libs/ext/libav/libavcodec/arm/ac3dsp_neon.S b/gst-libs/ext/libav/libavcodec/arm/ac3dsp_neon.S
index e97197c..82ff8af 100644
--- a/gst-libs/ext/libav/libavcodec/arm/ac3dsp_neon.S
+++ b/gst-libs/ext/libav/libavcodec/arm/ac3dsp_neon.S
@@ -18,7 +18,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "asm.S"
+#include "libavutil/arm/asm.S"
function ff_ac3_max_msb_abs_int16_neon, export=1
vmov.i16 q0, #0
diff --git a/gst-libs/ext/libav/libavcodec/arm/asm.S b/gst-libs/ext/libav/libavcodec/arm/asm.S
deleted file mode 100644
index 3b495a2..0000000
--- a/gst-libs/ext/libav/libavcodec/arm/asm.S
+++ /dev/null
@@ -1,212 +0,0 @@
-/*
- * Copyright (c) 2008 Mans Rullgard <mans@mansr.com>
- *
- * 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
- */
-
-#include "config.h"
-
-#ifdef __ELF__
-# define ELF
-#else
-# define ELF @
-#endif
-
-#if CONFIG_THUMB
-# define A @
-# define T
-#else
-# define A
-# define T @
-#endif
-
-#if HAVE_NEON
- .arch armv7-a
-#elif HAVE_ARMV6T2
- .arch armv6t2
-#elif HAVE_ARMV6
- .arch armv6
-#elif HAVE_ARMV5TE
- .arch armv5te
-#endif
-
-#if HAVE_NEON
- .fpu neon
-#elif HAVE_ARMVFP
- .fpu vfp
-#endif
-
- .syntax unified
-T .thumb
-
-.macro require8 val=1
-ELF .eabi_attribute 24, \val
-.endm
-
-.macro preserve8 val=1
-ELF .eabi_attribute 25, \val
-.endm
-
-.macro function name, export=0
- .macro endfunc
-ELF .size \name, . - \name
- .endfunc
- .purgem endfunc
- .endm
- .text
- .align 2
- .if \export
- .global EXTERN_ASM\name
-EXTERN_ASM\name:
- .endif
-ELF .type \name, %function
- .func \name
-\name:
-.endm
-
-.macro const name, align=2
- .macro endconst
-ELF .size \name, . - \name
- .purgem endconst
- .endm
- .section .rodata
- .align \align
-\name:
-.endm
-
-.macro mov32 rd, val
-#if HAVE_ARMV6T2
- movw \rd, #(\val) & 0xffff
- .if (\val) >> 16
- movt \rd, #(\val) >> 16
- .endif
-#else
- ldr \rd, =\val
-#endif
-.endm
-
-.macro movrel rd, val
-#if HAVE_ARMV6T2 && !CONFIG_PIC && !defined(__APPLE__)
- movw \rd, #:lower16:\val
- movt \rd, #:upper16:\val
-#else
- ldr \rd, =\val
-#endif
-.endm
-
-.macro ldr_pre rt, rn, rm:vararg
-A ldr \rt, [\rn, \rm]!
-T add \rn, \rn, \rm
-T ldr \rt, [\rn]
-.endm
-
-.macro ldr_dpre rt, rn, rm:vararg
-A ldr \rt, [\rn, -\rm]!
-T sub \rn, \rn, \rm
-T ldr \rt, [\rn]
-.endm
-
-.macro ldr_post rt, rn, rm:vararg
-A ldr \rt, [\rn], \rm
-T ldr \rt, [\rn]
-T add \rn, \rn, \rm
-.endm
-
-.macro ldrd_reg rt, rt2, rn, rm
-A ldrd \rt, \rt2, [\rn, \rm]
-T add \rt, \rn, \rm
-T ldrd \rt, \rt2, [\rt]
-.endm
-
-.macro ldrd_post rt, rt2, rn, rm
-A ldrd \rt, \rt2, [\rn], \rm
-T ldrd \rt, \rt2, [\rn]
-T add \rn, \rn, \rm
-.endm
-
-.macro ldrh_pre rt, rn, rm
-A ldrh \rt, [\rn, \rm]!
-T add \rn, \rn, \rm
-T ldrh \rt, [\rn]
-.endm
-
-.macro ldrh_dpre rt, rn, rm
-A ldrh \rt, [\rn, -\rm]!
-T sub \rn, \rn, \rm
-T ldrh \rt, [\rn]
-.endm
-
-.macro ldrh_post rt, rn, rm
-A ldrh \rt, [\rn], \rm
-T ldrh \rt, [\rn]
-T add \rn, \rn, \rm
-.endm
-
-.macro str_post rt, rn, rm:vararg
-A str \rt, [\rn], \rm
-T str \rt, [\rn]
-T add \rn, \rn, \rm
-.endm
-
-.macro strb_post rt, rn, rm:vararg
-A strb \rt, [\rn], \rm
-T strb \rt, [\rn]
-T add \rn, \rn, \rm
-.endm
-
-.macro strd_post rt, rt2, rn, rm
-A strd \rt, \rt2, [\rn], \rm
-T strd \rt, \rt2, [\rn]
-T add \rn, \rn, \rm
-.endm
-
-.macro strh_pre rt, rn, rm
-A strh \rt, [\rn, \rm]!
-T add \rn, \rn, \rm
-T strh \rt, [\rn]
-.endm
-
-.macro strh_dpre rt, rn, rm
-A strh \rt, [\rn, -\rm]!
-T sub \rn, \rn, \rm
-T strh \rt, [\rn]
-.endm
-
-.macro strh_post rt, rn, rm
-A strh \rt, [\rn], \rm
-T strh \rt, [\rn]
-T add \rn, \rn, \rm
-.endm
-
-.macro strh_dpost rt, rn, rm
-A strh \rt, [\rn], -\rm
-T strh \rt, [\rn]
-T sub \rn, \rn, \rm
-.endm
-
-#if HAVE_VFP_ARGS
- .eabi_attribute 28, 1
-# define VFP
-# define NOVFP @
-#else
-# define VFP @
-# define NOVFP
-#endif
-
-#define GLUE(a, b) a ## b
-#define JOIN(a, b) GLUE(a, b)
-#define X(s) JOIN(EXTERN_ASM, s)
diff --git a/gst-libs/ext/libav/libavcodec/arm/dca.h b/gst-libs/ext/libav/libavcodec/arm/dca.h
index 9b0efc0..09b6e64 100644
--- a/gst-libs/ext/libav/libavcodec/arm/dca.h
+++ b/gst-libs/ext/libav/libavcodec/arm/dca.h
@@ -25,7 +25,7 @@
#include "config.h"
#include "libavutil/intmath.h"
-#if HAVE_ARMV6 && HAVE_INLINE_ASM && AV_GCC_VERSION_AT_LEAST(4,4)
+#if HAVE_ARMV6_INLINE && AV_GCC_VERSION_AT_LEAST(4,4)
#define decode_blockcodes decode_blockcodes
static inline int decode_blockcodes(int code1, int code2, int levels,
@@ -79,7 +79,7 @@ static inline int decode_blockcodes(int code1, int code2, int levels,
#endif
-#if HAVE_NEON && HAVE_INLINE_ASM && HAVE_ASM_MOD_Y
+#if HAVE_NEON_INLINE && HAVE_ASM_MOD_Y
#define int8x8_fmul_int32 int8x8_fmul_int32
static inline void int8x8_fmul_int32(float *dst, const int8_t *src, int scale)
diff --git a/gst-libs/ext/libav/libavcodec/arm/dcadsp_init_arm.c b/gst-libs/ext/libav/libavcodec/arm/dcadsp_init_arm.c
index b5ac206..f0375c9 100644
--- a/gst-libs/ext/libav/libavcodec/arm/dcadsp_init_arm.c
+++ b/gst-libs/ext/libav/libavcodec/arm/dcadsp_init_arm.c
@@ -19,14 +19,18 @@
*/
#include "config.h"
+
+#include "libavutil/arm/cpu.h"
#include "libavutil/attributes.h"
#include "libavcodec/dcadsp.h"
void ff_dca_lfe_fir_neon(float *out, const float *in, const float *coefs,
int decifactor, float scale);
-void av_cold ff_dcadsp_init_arm(DCADSPContext *s)
+av_cold void ff_dcadsp_init_arm(DCADSPContext *s)
{
- if (HAVE_NEON)
+ int cpu_flags = av_get_cpu_flags();
+
+ if (have_neon(cpu_flags))
s->lfe_fir = ff_dca_lfe_fir_neon;
}
diff --git a/gst-libs/ext/libav/libavcodec/arm/dcadsp_neon.S b/gst-libs/ext/libav/libavcodec/arm/dcadsp_neon.S
index 71f5dd8..fe3aae8 100644
--- a/gst-libs/ext/libav/libavcodec/arm/dcadsp_neon.S
+++ b/gst-libs/ext/libav/libavcodec/arm/dcadsp_neon.S
@@ -18,7 +18,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "asm.S"
+#include "libavutil/arm/asm.S"
function ff_dca_lfe_fir_neon, export=1
push {r4-r6,lr}
diff --git a/gst-libs/ext/libav/libavcodec/arm/dsputil_arm.S b/gst-libs/ext/libav/libavcodec/arm/dsputil_arm.S
index 136551f..8504032 100644
--- a/gst-libs/ext/libav/libavcodec/arm/dsputil_arm.S
+++ b/gst-libs/ext/libav/libavcodec/arm/dsputil_arm.S
@@ -20,19 +20,9 @@
@
#include "config.h"
-#include "asm.S"
+#include "libavutil/arm/asm.S"
- preserve8
-
-#if HAVE_ARMV5TE
-function ff_prefetch_arm, export=1
- subs r2, r2, #1
- pld [r0]
- add r0, r0, r1
- bne ff_prefetch_arm
- bx lr
-endfunc
-#else
+#if !HAVE_ARMV5TE_EXTERNAL
#define pld @
#endif
@@ -632,7 +622,7 @@ function ff_add_pixels_clamped_arm, export=1
ldrsh r7, [r0, #2]
and r6, r4, #0xFF
and r8, r4, #0xFF00
- add r6, r5, r6
+ add r6, r6, r5
add r8, r7, r8, lsr #8
mvn r5, r5
mvn r7, r7
@@ -674,7 +664,7 @@ function ff_add_pixels_clamped_arm, export=1
ldrsh r7, [r0, #10]
and r6, r4, #0xFF
and r8, r4, #0xFF00
- add r6, r5, r6
+ add r6, r6, r5
add r8, r7, r8, lsr #8
mvn r5, r5
mvn r7, r7
diff --git a/gst-libs/ext/libav/libavcodec/arm/dsputil_arm.h b/gst-libs/ext/libav/libavcodec/arm/dsputil_arm.h
index 6d7e6a6..36d5d56 100644
--- a/gst-libs/ext/libav/libavcodec/arm/dsputil_arm.h
+++ b/gst-libs/ext/libav/libavcodec/arm/dsputil_arm.h
@@ -28,6 +28,5 @@ void ff_dsputil_init_armv5te(DSPContext* c, AVCodecContext *avctx);
void ff_dsputil_init_armv6(DSPContext* c, AVCodecContext *avctx);
void ff_dsputil_init_vfp(DSPContext* c, AVCodecContext *avctx);
void ff_dsputil_init_neon(DSPContext *c, AVCodecContext *avctx);
-void ff_dsputil_init_iwmmxt(DSPContext* c, AVCodecContext *avctx);
#endif /* AVCODEC_ARM_DSPUTIL_H */
diff --git a/gst-libs/ext/libav/libavcodec/arm/dsputil_armv6.S b/gst-libs/ext/libav/libavcodec/arm/dsputil_armv6.S
index becf851..61535a1 100644
--- a/gst-libs/ext/libav/libavcodec/arm/dsputil_armv6.S
+++ b/gst-libs/ext/libav/libavcodec/arm/dsputil_armv6.S
@@ -18,9 +18,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "asm.S"
-
- preserve8
+#include "libavutil/arm/asm.S"
.macro call_2x_pixels type, subp
function ff_\type\()_pixels16\subp\()_armv6, export=1
diff --git a/gst-libs/ext/libav/libavcodec/arm/dsputil_init_arm.c b/gst-libs/ext/libav/libavcodec/arm/dsputil_init_arm.c
index 743be1a..0c1563d 100644
--- a/gst-libs/ext/libav/libavcodec/arm/dsputil_init_arm.c
+++ b/gst-libs/ext/libav/libavcodec/arm/dsputil_init_arm.c
@@ -19,6 +19,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "libavutil/arm/cpu.h"
#include "libavcodec/dsputil.h"
#include "dsputil_arm.h"
@@ -73,14 +74,15 @@ static void simple_idct_arm_add(uint8_t *dest, int line_size, DCTELEM *block)
ff_add_pixels_clamped(block, dest, line_size);
}
-void dsputil_init_arm(DSPContext* c, AVCodecContext *avctx)
+void ff_dsputil_init_arm(DSPContext* c, AVCodecContext *avctx)
{
const int high_bit_depth = avctx->bits_per_raw_sample > 8;
+ int cpu_flags = av_get_cpu_flags();
ff_put_pixels_clamped = c->put_pixels_clamped;
ff_add_pixels_clamped = c->add_pixels_clamped;
- if (!avctx->lowres && avctx->bits_per_raw_sample <= 8) {
+ if (avctx->bits_per_raw_sample <= 8) {
if(avctx->idct_algo == FF_IDCT_AUTO ||
avctx->idct_algo == FF_IDCT_ARM){
c->idct_put = j_rev_dct_arm_put;
@@ -117,9 +119,8 @@ void dsputil_init_arm(DSPContext* c, AVCodecContext *avctx)
c->put_no_rnd_pixels_tab[1][3] = ff_put_no_rnd_pixels8_xy2_arm;
}
- if (HAVE_ARMV5TE) ff_dsputil_init_armv5te(c, avctx);
- if (HAVE_ARMV6) ff_dsputil_init_armv6(c, avctx);
- if (HAVE_IWMMXT) ff_dsputil_init_iwmmxt(c, avctx);
- if (HAVE_ARMVFP) ff_dsputil_init_vfp(c, avctx);
- if (HAVE_NEON) ff_dsputil_init_neon(c, avctx);
+ if (have_armv5te(cpu_flags)) ff_dsputil_init_armv5te(c, avctx);
+ if (have_armv6(cpu_flags)) ff_dsputil_init_armv6(c, avctx);
+ if (have_vfp(cpu_flags)) ff_dsputil_init_vfp(c, avctx);
+ if (have_neon(cpu_flags)) ff_dsputil_init_neon(c, avctx);
}
diff --git a/gst-libs/ext/libav/libavcodec/arm/dsputil_init_armv5te.c b/gst-libs/ext/libav/libavcodec/arm/dsputil_init_armv5te.c
index e0224da..17017aa 100644
--- a/gst-libs/ext/libav/libavcodec/arm/dsputil_init_armv5te.c
+++ b/gst-libs/ext/libav/libavcodec/arm/dsputil_init_armv5te.c
@@ -25,11 +25,9 @@ void ff_simple_idct_armv5te(DCTELEM *data);
void ff_simple_idct_put_armv5te(uint8_t *dest, int line_size, DCTELEM *data);
void ff_simple_idct_add_armv5te(uint8_t *dest, int line_size, DCTELEM *data);
-void ff_prefetch_arm(void *mem, int stride, int h);
-
-void av_cold ff_dsputil_init_armv5te(DSPContext* c, AVCodecContext *avctx)
+av_cold void ff_dsputil_init_armv5te(DSPContext *c, AVCodecContext *avctx)
{
- if (!avctx->lowres && avctx->bits_per_raw_sample <= 8 &&
+ if (avctx->bits_per_raw_sample <= 8 &&
(avctx->idct_algo == FF_IDCT_AUTO ||
avctx->idct_algo == FF_IDCT_SIMPLEARMV5TE)) {
c->idct_put = ff_simple_idct_put_armv5te;
@@ -37,6 +35,4 @@ void av_cold ff_dsputil_init_armv5te(DSPContext* c, AVCodecContext *avctx)
c->idct = ff_simple_idct_armv5te;
c->idct_permutation_type = FF_NO_IDCT_PERM;
}
-
- c->prefetch = ff_prefetch_arm;
}
diff --git a/gst-libs/ext/libav/libavcodec/arm/dsputil_init_armv6.c b/gst-libs/ext/libav/libavcodec/arm/dsputil_init_armv6.c
index eff4ee3..fbe6014 100644
--- a/gst-libs/ext/libav/libavcodec/arm/dsputil_init_armv6.c
+++ b/gst-libs/ext/libav/libavcodec/arm/dsputil_init_armv6.c
@@ -70,11 +70,11 @@ int ff_sse16_armv6(void *s, uint8_t *blk1, uint8_t *blk2,
int ff_pix_norm1_armv6(uint8_t *pix, int line_size);
int ff_pix_sum_armv6(uint8_t *pix, int line_size);
-void av_cold ff_dsputil_init_armv6(DSPContext* c, AVCodecContext *avctx)
+av_cold void ff_dsputil_init_armv6(DSPContext *c, AVCodecContext *avctx)
{
const int high_bit_depth = avctx->bits_per_raw_sample > 8;
- if (!avctx->lowres && avctx->bits_per_raw_sample <= 8 &&
+ if (avctx->bits_per_raw_sample <= 8 &&
(avctx->idct_algo == FF_IDCT_AUTO ||
avctx->idct_algo == FF_IDCT_SIMPLEARMV6)) {
c->idct_put = ff_simple_idct_put_armv6;
diff --git a/gst-libs/ext/libav/libavcodec/arm/dsputil_init_neon.c b/gst-libs/ext/libav/libavcodec/arm/dsputil_init_neon.c
index 68e5b3e..b2e7204 100644
--- a/gst-libs/ext/libav/libavcodec/arm/dsputil_init_neon.c
+++ b/gst-libs/ext/libav/libavcodec/arm/dsputil_init_neon.c
@@ -29,11 +29,6 @@ void ff_simple_idct_neon(DCTELEM *data);
void ff_simple_idct_put_neon(uint8_t *dest, int line_size, DCTELEM *data);
void ff_simple_idct_add_neon(uint8_t *dest, int line_size, DCTELEM *data);
-void ff_vp3_idct_neon(DCTELEM *data);
-void ff_vp3_idct_put_neon(uint8_t *dest, int line_size, DCTELEM *data);
-void ff_vp3_idct_add_neon(uint8_t *dest, int line_size, DCTELEM *data);
-void ff_vp3_idct_dc_add_neon(uint8_t *dest, int line_size, const DCTELEM *data);
-
void ff_clear_block_neon(DCTELEM *block);
void ff_clear_blocks_neon(DCTELEM *blocks);
@@ -147,16 +142,8 @@ void ff_avg_h264_chroma_mc8_neon(uint8_t *, uint8_t *, int, int, int, int);
void ff_avg_h264_chroma_mc4_neon(uint8_t *, uint8_t *, int, int, int, int);
void ff_avg_h264_chroma_mc2_neon(uint8_t *, uint8_t *, int, int, int, int);
-void ff_vp3_v_loop_filter_neon(uint8_t *, int, int *);
-void ff_vp3_h_loop_filter_neon(uint8_t *, int, int *);
-
-void ff_vector_fmul_neon(float *dst, const float *src0, const float *src1, int len);
void ff_vector_fmul_window_neon(float *dst, const float *src0,
const float *src1, const float *win, int len);
-void ff_vector_fmul_scalar_neon(float *dst, const float *src, float mul,
- int len);
-void ff_vector_fmac_scalar_neon(float *dst, const float *src, float mul,
- int len);
void ff_butterflies_float_neon(float *v1, float *v2, int len);
float ff_scalarproduct_float_neon(const float *v1, const float *v2, int len);
void ff_vector_fmul_reverse_neon(float *dst, const float *src0,
@@ -171,8 +158,7 @@ void ff_vector_clip_int32_neon(int32_t *dst, const int32_t *src, int32_t min,
void ff_vorbis_inverse_coupling_neon(float *mag, float *ang, int blocksize);
-int32_t ff_scalarproduct_int16_neon(const int16_t *v1, const int16_t *v2, int len,
- int shift);
+int32_t ff_scalarproduct_int16_neon(const int16_t *v1, const int16_t *v2, int len);
int32_t ff_scalarproduct_and_madd_int16_neon(int16_t *v1, const int16_t *v2,
const int16_t *v3, int len, int mul);
@@ -183,20 +169,13 @@ void ff_dsputil_init_neon(DSPContext *c, AVCodecContext *avctx)
{
const int high_bit_depth = avctx->bits_per_raw_sample > 8;
- if (!avctx->lowres && avctx->bits_per_raw_sample <= 8) {
+ if (avctx->bits_per_raw_sample <= 8) {
if (avctx->idct_algo == FF_IDCT_AUTO ||
avctx->idct_algo == FF_IDCT_SIMPLENEON) {
c->idct_put = ff_simple_idct_put_neon;
c->idct_add = ff_simple_idct_add_neon;
c->idct = ff_simple_idct_neon;
c->idct_permutation_type = FF_PARTTRANS_IDCT_PERM;
- } else if ((CONFIG_VP3_DECODER || CONFIG_VP5_DECODER ||
- CONFIG_VP6_DECODER) &&
- avctx->idct_algo == FF_IDCT_VP3) {
- c->idct_put = ff_vp3_idct_put_neon;
- c->idct_add = ff_vp3_idct_add_neon;
- c->idct = ff_vp3_idct_neon;
- c->idct_permutation_type = FF_TRANSPOSE_IDCT_PERM;
}
}
@@ -323,16 +302,7 @@ void ff_dsputil_init_neon(DSPContext *c, AVCodecContext *avctx)
c->avg_h264_qpel_pixels_tab[1][15] = ff_avg_h264_qpel8_mc33_neon;
}
- if (CONFIG_VP3_DECODER) {
- c->vp3_v_loop_filter = ff_vp3_v_loop_filter_neon;
- c->vp3_h_loop_filter = ff_vp3_h_loop_filter_neon;
- c->vp3_idct_dc_add = ff_vp3_idct_dc_add_neon;
- }
-
- c->vector_fmul = ff_vector_fmul_neon;
c->vector_fmul_window = ff_vector_fmul_window_neon;
- c->vector_fmul_scalar = ff_vector_fmul_scalar_neon;
- c->vector_fmac_scalar = ff_vector_fmac_scalar_neon;
c->butterflies_float = ff_butterflies_float_neon;
c->scalarproduct_float = ff_scalarproduct_float_neon;
c->vector_fmul_reverse = ff_vector_fmul_reverse_neon;
diff --git a/gst-libs/ext/libav/libavcodec/arm/dsputil_init_vfp.c b/gst-libs/ext/libav/libavcodec/arm/dsputil_init_vfp.c
index 9cda890..d77d686 100644
--- a/gst-libs/ext/libav/libavcodec/arm/dsputil_init_vfp.c
+++ b/gst-libs/ext/libav/libavcodec/arm/dsputil_init_vfp.c
@@ -21,14 +21,10 @@
#include "libavcodec/dsputil.h"
#include "dsputil_arm.h"
-void ff_vector_fmul_vfp(float *dst, const float *src0,
- const float *src1, int len);
void ff_vector_fmul_reverse_vfp(float *dst, const float *src0,
const float *src1, int len);
void ff_dsputil_init_vfp(DSPContext* c, AVCodecContext *avctx)
{
- if (!HAVE_VFPV3)
- c->vector_fmul = ff_vector_fmul_vfp;
c->vector_fmul_reverse = ff_vector_fmul_reverse_vfp;
}
diff --git a/gst-libs/ext/libav/libavcodec/arm/dsputil_iwmmxt.c b/gst-libs/ext/libav/libavcodec/arm/dsputil_iwmmxt.c
deleted file mode 100644
index dec5d77..0000000
--- a/gst-libs/ext/libav/libavcodec/arm/dsputil_iwmmxt.c
+++ /dev/null
@@ -1,210 +0,0 @@
-/*
- * iWMMXt optimized DSP utils
- * Copyright (c) 2004 AGAWA Koji
- *
- * 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
- */
-
-#include "libavutil/cpu.h"
-#include "libavcodec/dsputil.h"
-
-#define DEF(x, y) x ## _no_rnd_ ## y ##_iwmmxt
-#define SET_RND(regd) __asm__ volatile ("mov r12, #1 \n\t tbcsth " #regd ", r12":::"r12");
-#define WAVG2B "wavg2b"
-#include "dsputil_iwmmxt_rnd_template.c"
-#undef DEF
-#undef SET_RND
-#undef WAVG2B
-
-#define DEF(x, y) x ## _ ## y ##_iwmmxt
-#define SET_RND(regd) __asm__ volatile ("mov r12, #2 \n\t tbcsth " #regd ", r12":::"r12");
-#define WAVG2B "wavg2br"
-#include "dsputil_iwmmxt_rnd_template.c"
-#undef DEF
-#undef SET_RND
-#undef WAVG2BR
-
-// need scheduling
-#define OP(AVG) \
- __asm__ volatile ( \
- /* alignment */ \
- "and r12, %[pixels], #7 \n\t" \
- "bic %[pixels], %[pixels], #7 \n\t" \
- "tmcr wcgr1, r12 \n\t" \
- \
- "wldrd wr0, [%[pixels]] \n\t" \
- "wldrd wr1, [%[pixels], #8] \n\t" \
- "add %[pixels], %[pixels], %[line_size] \n\t" \
- "walignr1 wr4, wr0, wr1 \n\t" \
- \
- "1: \n\t" \
- \
- "wldrd wr2, [%[pixels]] \n\t" \
- "wldrd wr3, [%[pixels], #8] \n\t" \
- "add %[pixels], %[pixels], %[line_size] \n\t" \
- "pld [%[pixels]] \n\t" \
- "walignr1 wr5, wr2, wr3 \n\t" \
- AVG " wr6, wr4, wr5 \n\t" \
- "wstrd wr6, [%[block]] \n\t" \
- "add %[block], %[block], %[line_size] \n\t" \
- \
- "wldrd wr0, [%[pixels]] \n\t" \
- "wldrd wr1, [%[pixels], #8] \n\t" \
- "add %[pixels], %[pixels], %[line_size] \n\t" \
- "walignr1 wr4, wr0, wr1 \n\t" \
- "pld [%[pixels]] \n\t" \
- AVG " wr6, wr4, wr5 \n\t" \
- "wstrd wr6, [%[block]] \n\t" \
- "add %[block], %[block], %[line_size] \n\t" \
- \
- "subs %[h], %[h], #2 \n\t" \
- "bne 1b \n\t" \
- : [block]"+r"(block), [pixels]"+r"(pixels), [h]"+r"(h) \
- : [line_size]"r"(line_size) \
- : "memory", "r12");
-void put_pixels8_y2_iwmmxt(uint8_t *block, const uint8_t *pixels, const int line_size, int h)
-{
- OP("wavg2br");
-}
-void put_no_rnd_pixels8_y2_iwmmxt(uint8_t *block, const uint8_t *pixels, const int line_size, int h)
-{
- OP("wavg2b");
-}
-#undef OP
-
-void add_pixels_clamped_iwmmxt(const DCTELEM *block, uint8_t *pixels, int line_size)
-{
- uint8_t *pixels2 = pixels + line_size;
-
- __asm__ volatile (
- "mov r12, #4 \n\t"
- "1: \n\t"
- "pld [%[pixels], %[line_size2]] \n\t"
- "pld [%[pixels2], %[line_size2]] \n\t"
- "wldrd wr4, [%[pixels]] \n\t"
- "wldrd wr5, [%[pixels2]] \n\t"
- "pld [%[block], #32] \n\t"
- "wunpckelub wr6, wr4 \n\t"
- "wldrd wr0, [%[block]] \n\t"
- "wunpckehub wr7, wr4 \n\t"
- "wldrd wr1, [%[block], #8] \n\t"
- "wunpckelub wr8, wr5 \n\t"
- "wldrd wr2, [%[block], #16] \n\t"
- "wunpckehub wr9, wr5 \n\t"
- "wldrd wr3, [%[block], #24] \n\t"
- "add %[block], %[block], #32 \n\t"
- "waddhss wr10, wr0, wr6 \n\t"
- "waddhss wr11, wr1, wr7 \n\t"
- "waddhss wr12, wr2, wr8 \n\t"
- "waddhss wr13, wr3, wr9 \n\t"
- "wpackhus wr14, wr10, wr11 \n\t"
- "wpackhus wr15, wr12, wr13 \n\t"
- "wstrd wr14, [%[pixels]] \n\t"
- "add %[pixels], %[pixels], %[line_size2] \n\t"
- "subs r12, r12, #1 \n\t"
- "wstrd wr15, [%[pixels2]] \n\t"
- "add %[pixels2], %[pixels2], %[line_size2] \n\t"
- "bne 1b \n\t"
- : [block]"+r"(block), [pixels]"+r"(pixels), [pixels2]"+r"(pixels2)
- : [line_size2]"r"(line_size << 1)
- : "cc", "memory", "r12");
-}
-
-static void clear_blocks_iwmmxt(DCTELEM *blocks)
-{
- __asm__ volatile(
- "wzero wr0 \n\t"
- "mov r1, #(128 * 6 / 32) \n\t"
- "1: \n\t"
- "wstrd wr0, [%0] \n\t"
- "wstrd wr0, [%0, #8] \n\t"
- "wstrd wr0, [%0, #16] \n\t"
- "wstrd wr0, [%0, #24] \n\t"
- "subs r1, r1, #1 \n\t"
- "add %0, %0, #32 \n\t"
- "bne 1b \n\t"
- : "+r"(blocks)
- :
- : "r1"
- );
-}
-
-static void nop(uint8_t *block, const uint8_t *pixels, int line_size, int h)
-{
- return;
-}
-
-/* A run time test is not simple. If this file is compiled in
- * then we should install the functions
- */
-
-void ff_dsputil_init_iwmmxt(DSPContext* c, AVCodecContext *avctx)
-{
- int mm_flags = AV_CPU_FLAG_IWMMXT; /* multimedia extension flags */
- const int high_bit_depth = avctx->bits_per_raw_sample > 8;
-
- if (avctx->dsp_mask) {
- if (avctx->dsp_mask & AV_CPU_FLAG_FORCE)
- mm_flags |= (avctx->dsp_mask & 0xffff);
- else
- mm_flags &= ~(avctx->dsp_mask & 0xffff);
- }
-
- if (!(mm_flags & AV_CPU_FLAG_IWMMXT)) return;
-
- c->add_pixels_clamped = add_pixels_clamped_iwmmxt;
-
- if (!high_bit_depth) {
- c->clear_blocks = clear_blocks_iwmmxt;
-
- c->put_pixels_tab[0][0] = put_pixels16_iwmmxt;
- c->put_pixels_tab[0][1] = put_pixels16_x2_iwmmxt;
- c->put_pixels_tab[0][2] = put_pixels16_y2_iwmmxt;
- c->put_pixels_tab[0][3] = put_pixels16_xy2_iwmmxt;
- c->put_no_rnd_pixels_tab[0][0] = put_pixels16_iwmmxt;
- c->put_no_rnd_pixels_tab[0][1] = put_no_rnd_pixels16_x2_iwmmxt;
- c->put_no_rnd_pixels_tab[0][2] = put_no_rnd_pixels16_y2_iwmmxt;
- c->put_no_rnd_pixels_tab[0][3] = put_no_rnd_pixels16_xy2_iwmmxt;
-
- c->put_pixels_tab[1][0] = put_pixels8_iwmmxt;
- c->put_pixels_tab[1][1] = put_pixels8_x2_iwmmxt;
- c->put_pixels_tab[1][2] = put_pixels8_y2_iwmmxt;
- c->put_pixels_tab[1][3] = put_pixels8_xy2_iwmmxt;
- c->put_no_rnd_pixels_tab[1][0] = put_pixels8_iwmmxt;
- c->put_no_rnd_pixels_tab[1][1] = put_no_rnd_pixels8_x2_iwmmxt;
- c->put_no_rnd_pixels_tab[1][2] = put_no_rnd_pixels8_y2_iwmmxt;
- c->put_no_rnd_pixels_tab[1][3] = put_no_rnd_pixels8_xy2_iwmmxt;
-
- c->avg_pixels_tab[0][0] = avg_pixels16_iwmmxt;
- c->avg_pixels_tab[0][1] = avg_pixels16_x2_iwmmxt;
- c->avg_pixels_tab[0][2] = avg_pixels16_y2_iwmmxt;
- c->avg_pixels_tab[0][3] = avg_pixels16_xy2_iwmmxt;
- c->avg_no_rnd_pixels_tab[0][0] = avg_pixels16_iwmmxt;
- c->avg_no_rnd_pixels_tab[0][1] = avg_no_rnd_pixels16_x2_iwmmxt;
- c->avg_no_rnd_pixels_tab[0][2] = avg_no_rnd_pixels16_y2_iwmmxt;
- c->avg_no_rnd_pixels_tab[0][3] = avg_no_rnd_pixels16_xy2_iwmmxt;
-
- c->avg_pixels_tab[1][0] = avg_pixels8_iwmmxt;
- c->avg_pixels_tab[1][1] = avg_pixels8_x2_iwmmxt;
- c->avg_pixels_tab[1][2] = avg_pixels8_y2_iwmmxt;
- c->avg_pixels_tab[1][3] = avg_pixels8_xy2_iwmmxt;
- c->avg_no_rnd_pixels_tab[1][0] = avg_no_rnd_pixels8_iwmmxt;
- c->avg_no_rnd_pixels_tab[1][1] = avg_no_rnd_pixels8_x2_iwmmxt;
- c->avg_no_rnd_pixels_tab[1][2] = avg_no_rnd_pixels8_y2_iwmmxt;
- c->avg_no_rnd_pixels_tab[1][3] = avg_no_rnd_pixels8_xy2_iwmmxt;
- }
-}
diff --git a/gst-libs/ext/libav/libavcodec/arm/dsputil_iwmmxt_rnd_template.c b/gst-libs/ext/libav/libavcodec/arm/dsputil_iwmmxt_rnd_template.c
deleted file mode 100644
index df0ead6..0000000
--- a/gst-libs/ext/libav/libavcodec/arm/dsputil_iwmmxt_rnd_template.c
+++ /dev/null
@@ -1,1114 +0,0 @@
-/*
- * iWMMXt optimized DSP utils
- * copyright (c) 2004 AGAWA Koji
- *
- * 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
- */
-
-void DEF(put, pixels8)(uint8_t *block, const uint8_t *pixels, const int line_size, int h)
-{
- int stride = line_size;
- __asm__ volatile (
- "and r12, %[pixels], #7 \n\t"
- "bic %[pixels], %[pixels], #7 \n\t"
- "tmcr wcgr1, r12 \n\t"
- "add r4, %[pixels], %[line_size] \n\t"
- "add r5, %[block], %[line_size] \n\t"
- "mov %[line_size], %[line_size], lsl #1 \n\t"
- "1: \n\t"
- "wldrd wr0, [%[pixels]] \n\t"
- "subs %[h], %[h], #2 \n\t"
- "wldrd wr1, [%[pixels], #8] \n\t"
- "add %[pixels], %[pixels], %[line_size] \n\t"
- "wldrd wr3, [r4] \n\t"
- "pld [%[pixels]] \n\t"
- "pld [%[pixels], #32] \n\t"
- "wldrd wr4, [r4, #8] \n\t"
- "add r4, r4, %[line_size] \n\t"
- "walignr1 wr8, wr0, wr1 \n\t"
- "pld [r4] \n\t"
- "pld [r4, #32] \n\t"
- "walignr1 wr10, wr3, wr4 \n\t"
- "wstrd wr8, [%[block]] \n\t"
- "add %[block], %[block], %[line_size] \n\t"
- "wstrd wr10, [r5] \n\t"
- "add r5, r5, %[line_size] \n\t"
- "bne 1b \n\t"
- : [block]"+r"(block), [pixels]"+r"(pixels), [line_size]"+r"(stride), [h]"+r"(h)
- :
- : "memory", "r4", "r5", "r12");
-}
-
-void DEF(avg, pixels8)(uint8_t *block, const uint8_t *pixels, const int line_size, int h)
-{
- int stride = line_size;
- __asm__ volatile (
- "and r12, %[pixels], #7 \n\t"
- "bic %[pixels], %[pixels], #7 \n\t"
- "tmcr wcgr1, r12 \n\t"
- "add r4, %[pixels], %[line_size] \n\t"
- "add r5, %[block], %[line_size] \n\t"
- "mov %[line_size], %[line_size], lsl #1 \n\t"
- "1: \n\t"
- "wldrd wr0, [%[pixels]] \n\t"
- "subs %[h], %[h], #2 \n\t"
- "wldrd wr1, [%[pixels], #8] \n\t"
- "add %[pixels], %[pixels], %[line_size] \n\t"
- "wldrd wr3, [r4] \n\t"
- "pld [%[pixels]] \n\t"
- "pld [%[pixels], #32] \n\t"
- "wldrd wr4, [r4, #8] \n\t"
- "add r4, r4, %[line_size] \n\t"
- "walignr1 wr8, wr0, wr1 \n\t"
- "wldrd wr0, [%[block]] \n\t"
- "wldrd wr2, [r5] \n\t"
- "pld [r4] \n\t"
- "pld [r4, #32] \n\t"
- "walignr1 wr10, wr3, wr4 \n\t"
- WAVG2B" wr8, wr8, wr0 \n\t"
- WAVG2B" wr10, wr10, wr2 \n\t"
- "wstrd wr8, [%[block]] \n\t"
- "add %[block], %[block], %[line_size] \n\t"
- "wstrd wr10, [r5] \n\t"
- "pld [%[block]] \n\t"
- "pld [%[block], #32] \n\t"
- "add r5, r5, %[line_size] \n\t"
- "pld [r5] \n\t"
- "pld [r5, #32] \n\t"
- "bne 1b \n\t"
- : [block]"+r"(block), [pixels]"+r"(pixels), [line_size]"+r"(stride), [h]"+r"(h)
- :
- : "memory", "r4", "r5", "r12");
-}
-
-void DEF(put, pixels16)(uint8_t *block, const uint8_t *pixels, const int line_size, int h)
-{
- int stride = line_size;
- __asm__ volatile (
- "and r12, %[pixels], #7 \n\t"
- "bic %[pixels], %[pixels], #7 \n\t"
- "tmcr wcgr1, r12 \n\t"
- "add r4, %[pixels], %[line_size] \n\t"
- "add r5, %[block], %[line_size] \n\t"
- "mov %[line_size], %[line_size], lsl #1 \n\t"
- "1: \n\t"
- "wldrd wr0, [%[pixels]] \n\t"
- "wldrd wr1, [%[pixels], #8] \n\t"
- "subs %[h], %[h], #2 \n\t"
- "wldrd wr2, [%[pixels], #16] \n\t"
- "add %[pixels], %[pixels], %[line_size] \n\t"
- "wldrd wr3, [r4] \n\t"
- "pld [%[pixels]] \n\t"
- "pld [%[pixels], #32] \n\t"
- "walignr1 wr8, wr0, wr1 \n\t"
- "wldrd wr4, [r4, #8] \n\t"
- "walignr1 wr9, wr1, wr2 \n\t"
- "wldrd wr5, [r4, #16] \n\t"
- "add r4, r4, %[line_size] \n\t"
- "pld [r4] \n\t"
- "pld [r4, #32] \n\t"
- "walignr1 wr10, wr3, wr4 \n\t"
- "wstrd wr8, [%[block]] \n\t"
- "walignr1 wr11, wr4, wr5 \n\t"
- "wstrd wr9, [%[block], #8] \n\t"
- "add %[block], %[block], %[line_size] \n\t"
- "wstrd wr10, [r5] \n\t"
- "wstrd wr11, [r5, #8] \n\t"
- "add r5, r5, %[line_size] \n\t"
- "bne 1b \n\t"
- : [block]"+r"(block), [pixels]"+r"(pixels), [line_size]"+r"(stride), [h]"+r"(h)
- :
- : "memory", "r4", "r5", "r12");
-}
-
-void DEF(avg, pixels16)(uint8_t *block, const uint8_t *pixels, const int line_size, int h)
-{
- int stride = line_size;
- __asm__ volatile (
- "pld [%[pixels]] \n\t"
- "pld [%[pixels], #32] \n\t"
- "pld [%[block]] \n\t"
- "pld [%[block], #32] \n\t"
- "and r12, %[pixels], #7 \n\t"
- "bic %[pixels], %[pixels], #7 \n\t"
- "tmcr wcgr1, r12 \n\t"
- "add r4, %[pixels], %[line_size]\n\t"
- "add r5, %[block], %[line_size] \n\t"
- "mov %[line_size], %[line_size], lsl #1 \n\t"
- "1: \n\t"
- "wldrd wr0, [%[pixels]] \n\t"
- "wldrd wr1, [%[pixels], #8] \n\t"
- "subs %[h], %[h], #2 \n\t"
- "wldrd wr2, [%[pixels], #16] \n\t"
- "add %[pixels], %[pixels], %[line_size] \n\t"
- "wldrd wr3, [r4] \n\t"
- "pld [%[pixels]] \n\t"
- "pld [%[pixels], #32] \n\t"
- "walignr1 wr8, wr0, wr1 \n\t"
- "wldrd wr4, [r4, #8] \n\t"
- "walignr1 wr9, wr1, wr2 \n\t"
- "wldrd wr5, [r4, #16] \n\t"
- "add r4, r4, %[line_size] \n\t"
- "wldrd wr0, [%[block]] \n\t"
- "pld [r4] \n\t"
- "wldrd wr1, [%[block], #8] \n\t"
- "pld [r4, #32] \n\t"
- "wldrd wr2, [r5] \n\t"
- "walignr1 wr10, wr3, wr4 \n\t"
- "wldrd wr3, [r5, #8] \n\t"
- WAVG2B" wr8, wr8, wr0 \n\t"
- WAVG2B" wr9, wr9, wr1 \n\t"
- WAVG2B" wr10, wr10, wr2 \n\t"
- "wstrd wr8, [%[block]] \n\t"
- "walignr1 wr11, wr4, wr5 \n\t"
- WAVG2B" wr11, wr11, wr3 \n\t"
- "wstrd wr9, [%[block], #8] \n\t"
- "add %[block], %[block], %[line_size] \n\t"
- "wstrd wr10, [r5] \n\t"
- "pld [%[block]] \n\t"
- "pld [%[block], #32] \n\t"
- "wstrd wr11, [r5, #8] \n\t"
- "add r5, r5, %[line_size] \n\t"
- "pld [r5] \n\t"
- "pld [r5, #32] \n\t"
- "bne 1b \n\t"
- : [block]"+r"(block), [pixels]"+r"(pixels), [line_size]"+r"(stride), [h]"+r"(h)
- :
- : "memory", "r4", "r5", "r12");
-}
-
-void DEF(put, pixels8_x2)(uint8_t *block, const uint8_t *pixels, const int line_size, int h)
-{
- int stride = line_size;
- // [wr0 wr1 wr2 wr3] for previous line
- // [wr4 wr5 wr6 wr7] for current line
- SET_RND(wr15); // =2 for rnd and =1 for no_rnd version
- __asm__ volatile(
- "pld [%[pixels]] \n\t"
- "pld [%[pixels], #32] \n\t"
- "and r12, %[pixels], #7 \n\t"
- "bic %[pixels], %[pixels], #7 \n\t"
- "tmcr wcgr1, r12 \n\t"
- "add r12, r12, #1 \n\t"
- "add r4, %[pixels], %[line_size]\n\t"
- "tmcr wcgr2, r12 \n\t"
- "add r5, %[block], %[line_size] \n\t"
- "mov %[line_size], %[line_size], lsl #1 \n\t"
-
- "1: \n\t"
- "wldrd wr10, [%[pixels]] \n\t"
- "cmp r12, #8 \n\t"
- "wldrd wr11, [%[pixels], #8] \n\t"
- "add %[pixels], %[pixels], %[line_size] \n\t"
- "wldrd wr13, [r4] \n\t"
- "pld [%[pixels]] \n\t"
- "wldrd wr14, [r4, #8] \n\t"
- "pld [%[pixels], #32] \n\t"
- "add r4, r4, %[line_size] \n\t"
- "walignr1 wr0, wr10, wr11 \n\t"
- "pld [r4] \n\t"
- "pld [r4, #32] \n\t"
- "walignr1 wr2, wr13, wr14 \n\t"
- "wmoveq wr4, wr11 \n\t"
- "wmoveq wr6, wr14 \n\t"
- "walignr2ne wr4, wr10, wr11 \n\t"
- "walignr2ne wr6, wr13, wr14 \n\t"
- WAVG2B" wr0, wr0, wr4 \n\t"
- WAVG2B" wr2, wr2, wr6 \n\t"
- "wstrd wr0, [%[block]] \n\t"
- "subs %[h], %[h], #2 \n\t"
- "wstrd wr2, [r5] \n\t"
- "add %[block], %[block], %[line_size] \n\t"
- "add r5, r5, %[line_size] \n\t"
- "bne 1b \n\t"
- : [h]"+r"(h), [pixels]"+r"(pixels), [block]"+r"(block), [line_size]"+r"(stride)
- :
- : "r4", "r5", "r12", "memory");
-}
-
-void DEF(put, pixels16_x2)(uint8_t *block, const uint8_t *pixels, const int line_size, int h)
-{
- int stride = line_size;
- // [wr0 wr1 wr2 wr3] for previous line
- // [wr4 wr5 wr6 wr7] for current line
- SET_RND(wr15); // =2 for rnd and =1 for no_rnd version
- __asm__ volatile(
- "pld [%[pixels]] \n\t"
- "pld [%[pixels], #32] \n\t"
- "and r12, %[pixels], #7 \n\t"
- "bic %[pixels], %[pixels], #7 \n\t"
- "tmcr wcgr1, r12 \n\t"
- "add r12, r12, #1 \n\t"
- "add r4, %[pixels], %[line_size]\n\t"
- "tmcr wcgr2, r12 \n\t"
- "add r5, %[block], %[line_size] \n\t"
- "mov %[line_size], %[line_size], lsl #1 \n\t"
-
- "1: \n\t"
- "wldrd wr10, [%[pixels]] \n\t"
- "cmp r12, #8 \n\t"
- "wldrd wr11, [%[pixels], #8] \n\t"
- "wldrd wr12, [%[pixels], #16] \n\t"
- "add %[pixels], %[pixels], %[line_size] \n\t"
- "wldrd wr13, [r4] \n\t"
- "pld [%[pixels]] \n\t"
- "wldrd wr14, [r4, #8] \n\t"
- "pld [%[pixels], #32] \n\t"
- "wldrd wr15, [r4, #16] \n\t"
- "add r4, r4, %[line_size] \n\t"
- "walignr1 wr0, wr10, wr11 \n\t"
- "pld [r4] \n\t"
- "pld [r4, #32] \n\t"
- "walignr1 wr1, wr11, wr12 \n\t"
- "walignr1 wr2, wr13, wr14 \n\t"
- "walignr1 wr3, wr14, wr15 \n\t"
- "wmoveq wr4, wr11 \n\t"
- "wmoveq wr5, wr12 \n\t"
- "wmoveq wr6, wr14 \n\t"
- "wmoveq wr7, wr15 \n\t"
- "walignr2ne wr4, wr10, wr11 \n\t"
- "walignr2ne wr5, wr11, wr12 \n\t"
- "walignr2ne wr6, wr13, wr14 \n\t"
- "walignr2ne wr7, wr14, wr15 \n\t"
- WAVG2B" wr0, wr0, wr4 \n\t"
- WAVG2B" wr1, wr1, wr5 \n\t"
- "wstrd wr0, [%[block]] \n\t"
- WAVG2B" wr2, wr2, wr6 \n\t"
- "wstrd wr1, [%[block], #8] \n\t"
- WAVG2B" wr3, wr3, wr7 \n\t"
- "add %[block], %[block], %[line_size] \n\t"
- "wstrd wr2, [r5] \n\t"
- "subs %[h], %[h], #2 \n\t"
- "wstrd wr3, [r5, #8] \n\t"
- "add r5, r5, %[line_size] \n\t"
- "bne 1b \n\t"
- : [h]"+r"(h), [pixels]"+r"(pixels), [block]"+r"(block), [line_size]"+r"(stride)
- :
- : "r4", "r5", "r12", "memory");
-}
-
-void DEF(avg, pixels8_x2)(uint8_t *block, const uint8_t *pixels, const int line_size, int h)
-{
- int stride = line_size;
- // [wr0 wr1 wr2 wr3] for previous line
- // [wr4 wr5 wr6 wr7] for current line
- SET_RND(wr15); // =2 for rnd and =1 for no_rnd version
- __asm__ volatile(
- "pld [%[pixels]] \n\t"
- "pld [%[pixels], #32] \n\t"
- "pld [%[block]] \n\t"
- "pld [%[block], #32] \n\t"
- "and r12, %[pixels], #7 \n\t"
- "bic %[pixels], %[pixels], #7 \n\t"
- "tmcr wcgr1, r12 \n\t"
- "add r12, r12, #1 \n\t"
- "add r4, %[pixels], %[line_size]\n\t"
- "tmcr wcgr2, r12 \n\t"
- "add r5, %[block], %[line_size] \n\t"
- "mov %[line_size], %[line_size], lsl #1 \n\t"
- "pld [r5] \n\t"
- "pld [r5, #32] \n\t"
-
- "1: \n\t"
- "wldrd wr10, [%[pixels]] \n\t"
- "cmp r12, #8 \n\t"
- "wldrd wr11, [%[pixels], #8] \n\t"
- "add %[pixels], %[pixels], %[line_size] \n\t"
- "wldrd wr13, [r4] \n\t"
- "pld [%[pixels]] \n\t"
- "wldrd wr14, [r4, #8] \n\t"
- "pld [%[pixels], #32] \n\t"
- "add r4, r4, %[line_size] \n\t"
- "walignr1 wr0, wr10, wr11 \n\t"
- "pld [r4] \n\t"
- "pld [r4, #32] \n\t"
- "walignr1 wr2, wr13, wr14 \n\t"
- "wmoveq wr4, wr11 \n\t"
- "wmoveq wr6, wr14 \n\t"
- "walignr2ne wr4, wr10, wr11 \n\t"
- "wldrd wr10, [%[block]] \n\t"
- "walignr2ne wr6, wr13, wr14 \n\t"
- "wldrd wr12, [r5] \n\t"
- WAVG2B" wr0, wr0, wr4 \n\t"
- WAVG2B" wr2, wr2, wr6 \n\t"
- WAVG2B" wr0, wr0, wr10 \n\t"
- WAVG2B" wr2, wr2, wr12 \n\t"
- "wstrd wr0, [%[block]] \n\t"
- "subs %[h], %[h], #2 \n\t"
- "wstrd wr2, [r5] \n\t"
- "add %[block], %[block], %[line_size] \n\t"
- "add r5, r5, %[line_size] \n\t"
- "pld [%[block]] \n\t"
- "pld [%[block], #32] \n\t"
- "pld [r5] \n\t"
- "pld [r5, #32] \n\t"
- "bne 1b \n\t"
- : [h]"+r"(h), [pixels]"+r"(pixels), [block]"+r"(block), [line_size]"+r"(stride)
- :
- : "r4", "r5", "r12", "memory");
-}
-
-void DEF(avg, pixels16_x2)(uint8_t *block, const uint8_t *pixels, const int line_size, int h)
-{
- int stride = line_size;
- // [wr0 wr1 wr2 wr3] for previous line
- // [wr4 wr5 wr6 wr7] for current line
- SET_RND(wr15); // =2 for rnd and =1 for no_rnd version
- __asm__ volatile(
- "pld [%[pixels]] \n\t"
- "pld [%[pixels], #32] \n\t"
- "pld [%[block]] \n\t"
- "pld [%[block], #32] \n\t"
- "and r12, %[pixels], #7 \n\t"
- "bic %[pixels], %[pixels], #7 \n\t"
- "tmcr wcgr1, r12 \n\t"
- "add r12, r12, #1 \n\t"
- "add r4, %[pixels], %[line_size]\n\t"
- "tmcr wcgr2, r12 \n\t"
- "add r5, %[block], %[line_size] \n\t"
- "mov %[line_size], %[line_size], lsl #1 \n\t"
- "pld [r5] \n\t"
- "pld [r5, #32] \n\t"
-
- "1: \n\t"
- "wldrd wr10, [%[pixels]] \n\t"
- "cmp r12, #8 \n\t"
- "wldrd wr11, [%[pixels], #8] \n\t"
- "wldrd wr12, [%[pixels], #16] \n\t"
- "add %[pixels], %[pixels], %[line_size] \n\t"
- "wldrd wr13, [r4] \n\t"
- "pld [%[pixels]] \n\t"
- "wldrd wr14, [r4, #8] \n\t"
- "pld [%[pixels], #32] \n\t"
- "wldrd wr15, [r4, #16] \n\t"
- "add r4, r4, %[line_size] \n\t"
- "walignr1 wr0, wr10, wr11 \n\t"
- "pld [r4] \n\t"
- "pld [r4, #32] \n\t"
- "walignr1 wr1, wr11, wr12 \n\t"
- "walignr1 wr2, wr13, wr14 \n\t"
- "walignr1 wr3, wr14, wr15 \n\t"
- "wmoveq wr4, wr11 \n\t"
- "wmoveq wr5, wr12 \n\t"
- "wmoveq wr6, wr14 \n\t"
- "wmoveq wr7, wr15 \n\t"
- "walignr2ne wr4, wr10, wr11 \n\t"
- "walignr2ne wr5, wr11, wr12 \n\t"
- "walignr2ne wr6, wr13, wr14 \n\t"
- "walignr2ne wr7, wr14, wr15 \n\t"
- "wldrd wr10, [%[block]] \n\t"
- WAVG2B" wr0, wr0, wr4 \n\t"
- "wldrd wr11, [%[block], #8] \n\t"
- WAVG2B" wr1, wr1, wr5 \n\t"
- "wldrd wr12, [r5] \n\t"
- WAVG2B" wr2, wr2, wr6 \n\t"
- "wldrd wr13, [r5, #8] \n\t"
- WAVG2B" wr3, wr3, wr7 \n\t"
- WAVG2B" wr0, wr0, wr10 \n\t"
- WAVG2B" wr1, wr1, wr11 \n\t"
- WAVG2B" wr2, wr2, wr12 \n\t"
- WAVG2B" wr3, wr3, wr13 \n\t"
- "wstrd wr0, [%[block]] \n\t"
- "subs %[h], %[h], #2 \n\t"
- "wstrd wr1, [%[block], #8] \n\t"
- "add %[block], %[block], %[line_size] \n\t"
- "wstrd wr2, [r5] \n\t"
- "pld [%[block]] \n\t"
- "wstrd wr3, [r5, #8] \n\t"
- "add r5, r5, %[line_size] \n\t"
- "pld [%[block], #32] \n\t"
- "pld [r5] \n\t"
- "pld [r5, #32] \n\t"
- "bne 1b \n\t"
- : [h]"+r"(h), [pixels]"+r"(pixels), [block]"+r"(block), [line_size]"+r"(stride)
- :
- :"r4", "r5", "r12", "memory");
-}
-
-void DEF(avg, pixels8_y2)(uint8_t *block, const uint8_t *pixels, const int line_size, int h)
-{
- int stride = line_size;
- // [wr0 wr1 wr2 wr3] for previous line
- // [wr4 wr5 wr6 wr7] for current line
- __asm__ volatile(
- "pld [%[pixels]] \n\t"
- "pld [%[pixels], #32] \n\t"
- "and r12, %[pixels], #7 \n\t"
- "tmcr wcgr1, r12 \n\t"
- "bic %[pixels], %[pixels], #7 \n\t"
-
- "wldrd wr10, [%[pixels]] \n\t"
- "wldrd wr11, [%[pixels], #8] \n\t"
- "pld [%[block]] \n\t"
- "add %[pixels], %[pixels], %[line_size] \n\t"
- "walignr1 wr0, wr10, wr11 \n\t"
- "pld [%[pixels]] \n\t"
- "pld [%[pixels], #32] \n\t"
-
- "1: \n\t"
- "wldrd wr10, [%[pixels]] \n\t"
- "wldrd wr11, [%[pixels], #8] \n\t"
- "add %[pixels], %[pixels], %[line_size] \n\t"
- "pld [%[pixels]] \n\t"
- "pld [%[pixels], #32] \n\t"
- "walignr1 wr4, wr10, wr11 \n\t"
- "wldrd wr10, [%[block]] \n\t"
- WAVG2B" wr8, wr0, wr4 \n\t"
- WAVG2B" wr8, wr8, wr10 \n\t"
- "wstrd wr8, [%[block]] \n\t"
- "add %[block], %[block], %[line_size] \n\t"
-
- "wldrd wr10, [%[pixels]] \n\t"
- "wldrd wr11, [%[pixels], #8] \n\t"
- "pld [%[block]] \n\t"
- "add %[pixels], %[pixels], %[line_size] \n\t"
- "pld [%[pixels]] \n\t"
- "pld [%[pixels], #32] \n\t"
- "walignr1 wr0, wr10, wr11 \n\t"
- "wldrd wr10, [%[block]] \n\t"
- WAVG2B" wr8, wr0, wr4 \n\t"
- WAVG2B" wr8, wr8, wr10 \n\t"
- "wstrd wr8, [%[block]] \n\t"
- "add %[block], %[block], %[line_size] \n\t"
-
- "subs %[h], %[h], #2 \n\t"
- "pld [%[block]] \n\t"
- "bne 1b \n\t"
- : [h]"+r"(h), [pixels]"+r"(pixels), [block]"+r"(block), [line_size]"+r"(stride)
- :
- : "cc", "memory", "r12");
-}
-
-void DEF(put, pixels16_y2)(uint8_t *block, const uint8_t *pixels, const int line_size, int h)
-{
- int stride = line_size;
- // [wr0 wr1 wr2 wr3] for previous line
- // [wr4 wr5 wr6 wr7] for current line
- __asm__ volatile(
- "pld [%[pixels]] \n\t"
- "pld [%[pixels], #32] \n\t"
- "and r12, %[pixels], #7 \n\t"
- "tmcr wcgr1, r12 \n\t"
- "bic %[pixels], %[pixels], #7 \n\t"
-
- "wldrd wr10, [%[pixels]] \n\t"
- "wldrd wr11, [%[pixels], #8] \n\t"
- "wldrd wr12, [%[pixels], #16] \n\t"
- "add %[pixels], %[pixels], %[line_size] \n\t"
- "pld [%[pixels]] \n\t"
- "pld [%[pixels], #32] \n\t"
- "walignr1 wr0, wr10, wr11 \n\t"
- "walignr1 wr1, wr11, wr12 \n\t"
-
- "1: \n\t"
- "wldrd wr10, [%[pixels]] \n\t"
- "wldrd wr11, [%[pixels], #8] \n\t"
- "wldrd wr12, [%[pixels], #16] \n\t"
- "add %[pixels], %[pixels], %[line_size] \n\t"
- "pld [%[pixels]] \n\t"
- "pld [%[pixels], #32] \n\t"
- "walignr1 wr4, wr10, wr11 \n\t"
- "walignr1 wr5, wr11, wr12 \n\t"
- WAVG2B" wr8, wr0, wr4 \n\t"
- WAVG2B" wr9, wr1, wr5 \n\t"
- "wstrd wr8, [%[block]] \n\t"
- "wstrd wr9, [%[block], #8] \n\t"
- "add %[block], %[block], %[line_size] \n\t"
-
- "wldrd wr10, [%[pixels]] \n\t"
- "wldrd wr11, [%[pixels], #8] \n\t"
- "wldrd wr12, [%[pixels], #16] \n\t"
- "add %[pixels], %[pixels], %[line_size] \n\t"
- "pld [%[pixels]] \n\t"
- "pld [%[pixels], #32] \n\t"
- "walignr1 wr0, wr10, wr11 \n\t"
- "walignr1 wr1, wr11, wr12 \n\t"
- WAVG2B" wr8, wr0, wr4 \n\t"
- WAVG2B" wr9, wr1, wr5 \n\t"
- "wstrd wr8, [%[block]] \n\t"
- "wstrd wr9, [%[block], #8] \n\t"
- "add %[block], %[block], %[line_size] \n\t"
-
- "subs %[h], %[h], #2 \n\t"
- "bne 1b \n\t"
- : [h]"+r"(h), [pixels]"+r"(pixels), [block]"+r"(block), [line_size]"+r"(stride)
- :
- : "r4", "r5", "r12", "memory");
-}
-
-void DEF(avg, pixels16_y2)(uint8_t *block, const uint8_t *pixels, const int line_size, int h)
-{
- int stride = line_size;
- // [wr0 wr1 wr2 wr3] for previous line
- // [wr4 wr5 wr6 wr7] for current line
- __asm__ volatile(
- "pld [%[pixels]] \n\t"
- "pld [%[pixels], #32] \n\t"
- "and r12, %[pixels], #7 \n\t"
- "tmcr wcgr1, r12 \n\t"
- "bic %[pixels], %[pixels], #7 \n\t"
-
- "wldrd wr10, [%[pixels]] \n\t"
- "wldrd wr11, [%[pixels], #8] \n\t"
- "pld [%[block]] \n\t"
- "wldrd wr12, [%[pixels], #16] \n\t"
- "add %[pixels], %[pixels], %[line_size] \n\t"
- "pld [%[pixels]] \n\t"
- "pld [%[pixels], #32] \n\t"
- "walignr1 wr0, wr10, wr11 \n\t"
- "walignr1 wr1, wr11, wr12 \n\t"
-
- "1: \n\t"
- "wldrd wr10, [%[pixels]] \n\t"
- "wldrd wr11, [%[pixels], #8] \n\t"
- "wldrd wr12, [%[pixels], #16] \n\t"
- "add %[pixels], %[pixels], %[line_size] \n\t"
- "pld [%[pixels]] \n\t"
- "pld [%[pixels], #32] \n\t"
- "walignr1 wr4, wr10, wr11 \n\t"
- "walignr1 wr5, wr11, wr12 \n\t"
- "wldrd wr10, [%[block]] \n\t"
- "wldrd wr11, [%[block], #8] \n\t"
- WAVG2B" wr8, wr0, wr4 \n\t"
- WAVG2B" wr9, wr1, wr5 \n\t"
- WAVG2B" wr8, wr8, wr10 \n\t"
- WAVG2B" wr9, wr9, wr11 \n\t"
- "wstrd wr8, [%[block]] \n\t"
- "wstrd wr9, [%[block], #8] \n\t"
- "add %[block], %[block], %[line_size] \n\t"
-
- "wldrd wr10, [%[pixels]] \n\t"
- "wldrd wr11, [%[pixels], #8] \n\t"
- "pld [%[block]] \n\t"
- "wldrd wr12, [%[pixels], #16] \n\t"
- "add %[pixels], %[pixels], %[line_size] \n\t"
- "pld [%[pixels]] \n\t"
- "pld [%[pixels], #32] \n\t"
- "walignr1 wr0, wr10, wr11 \n\t"
- "walignr1 wr1, wr11, wr12 \n\t"
- "wldrd wr10, [%[block]] \n\t"
- "wldrd wr11, [%[block], #8] \n\t"
- WAVG2B" wr8, wr0, wr4 \n\t"
- WAVG2B" wr9, wr1, wr5 \n\t"
- WAVG2B" wr8, wr8, wr10 \n\t"
- WAVG2B" wr9, wr9, wr11 \n\t"
- "wstrd wr8, [%[block]] \n\t"
- "wstrd wr9, [%[block], #8] \n\t"
- "add %[block], %[block], %[line_size] \n\t"
-
- "subs %[h], %[h], #2 \n\t"
- "pld [%[block]] \n\t"
- "bne 1b \n\t"
- : [h]"+r"(h), [pixels]"+r"(pixels), [block]"+r"(block), [line_size]"+r"(stride)
- :
- : "r4", "r5", "r12", "memory");
-}
-
-void DEF(put, pixels8_xy2)(uint8_t *block, const uint8_t *pixels, const int line_size, int h)
-{
- // [wr0 wr1 wr2 wr3] for previous line
- // [wr4 wr5 wr6 wr7] for current line
- SET_RND(wr15); // =2 for rnd and =1 for no_rnd version
- __asm__ volatile(
- "pld [%[pixels]] \n\t"
- "mov r12, #2 \n\t"
- "pld [%[pixels], #32] \n\t"
- "tmcr wcgr0, r12 \n\t" /* for shift value */
- "and r12, %[pixels], #7 \n\t"
- "bic %[pixels], %[pixels], #7 \n\t"
- "tmcr wcgr1, r12 \n\t"
-
- // [wr0 wr1 wr2 wr3] <= *
- // [wr4 wr5 wr6 wr7]
- "wldrd wr12, [%[pixels]] \n\t"
- "add r12, r12, #1 \n\t"
- "wldrd wr13, [%[pixels], #8] \n\t"
- "tmcr wcgr2, r12 \n\t"
- "add %[pixels], %[pixels], %[line_size] \n\t"
- "cmp r12, #8 \n\t"
- "pld [%[pixels]] \n\t"
- "pld [%[pixels], #32] \n\t"
- "walignr1 wr2, wr12, wr13 \n\t"
- "wmoveq wr10, wr13 \n\t"
- "walignr2ne wr10, wr12, wr13 \n\t"
- "wunpckelub wr0, wr2 \n\t"
- "wunpckehub wr1, wr2 \n\t"
- "wunpckelub wr8, wr10 \n\t"
- "wunpckehub wr9, wr10 \n\t"
- "waddhus wr0, wr0, wr8 \n\t"
- "waddhus wr1, wr1, wr9 \n\t"
-
- "1: \n\t"
- // [wr0 wr1 wr2 wr3]
- // [wr4 wr5 wr6 wr7] <= *
- "wldrd wr12, [%[pixels]] \n\t"
- "cmp r12, #8 \n\t"
- "wldrd wr13, [%[pixels], #8] \n\t"
- "add %[pixels], %[pixels], %[line_size] \n\t"
- "walignr1 wr6, wr12, wr13 \n\t"
- "pld [%[pixels]] \n\t"
- "pld [%[pixels], #32] \n\t"
- "wmoveq wr10, wr13 \n\t"
- "walignr2ne wr10, wr12, wr13 \n\t"
- "wunpckelub wr4, wr6 \n\t"
- "wunpckehub wr5, wr6 \n\t"
- "wunpckelub wr8, wr10 \n\t"
- "wunpckehub wr9, wr10 \n\t"
- "waddhus wr4, wr4, wr8 \n\t"
- "waddhus wr5, wr5, wr9 \n\t"
- "waddhus wr8, wr0, wr4 \n\t"
- "waddhus wr9, wr1, wr5 \n\t"
- "waddhus wr8, wr8, wr15 \n\t"
- "waddhus wr9, wr9, wr15 \n\t"
- "wsrlhg wr8, wr8, wcgr0 \n\t"
- "wsrlhg wr9, wr9, wcgr0 \n\t"
- "wpackhus wr8, wr8, wr9 \n\t"
- "wstrd wr8, [%[block]] \n\t"
- "add %[block], %[block], %[line_size] \n\t"
-
- // [wr0 wr1 wr2 wr3] <= *
- // [wr4 wr5 wr6 wr7]
- "wldrd wr12, [%[pixels]] \n\t"
- "wldrd wr13, [%[pixels], #8] \n\t"
- "add %[pixels], %[pixels], %[line_size] \n\t"
- "walignr1 wr2, wr12, wr13 \n\t"
- "pld [%[pixels]] \n\t"
- "pld [%[pixels], #32] \n\t"
- "wmoveq wr10, wr13 \n\t"
- "walignr2ne wr10, wr12, wr13 \n\t"
- "wunpckelub wr0, wr2 \n\t"
- "wunpckehub wr1, wr2 \n\t"
- "wunpckelub wr8, wr10 \n\t"
- "wunpckehub wr9, wr10 \n\t"
- "waddhus wr0, wr0, wr8 \n\t"
- "waddhus wr1, wr1, wr9 \n\t"
- "waddhus wr8, wr0, wr4 \n\t"
- "waddhus wr9, wr1, wr5 \n\t"
- "waddhus wr8, wr8, wr15 \n\t"
- "waddhus wr9, wr9, wr15 \n\t"
- "wsrlhg wr8, wr8, wcgr0 \n\t"
- "wsrlhg wr9, wr9, wcgr0 \n\t"
- "wpackhus wr8, wr8, wr9 \n\t"
- "subs %[h], %[h], #2 \n\t"
- "wstrd wr8, [%[block]] \n\t"
- "add %[block], %[block], %[line_size] \n\t"
- "bne 1b \n\t"
- : [h]"+r"(h), [pixels]"+r"(pixels), [block]"+r"(block)
- : [line_size]"r"(line_size)
- : "r12", "memory");
-}
-
-void DEF(put, pixels16_xy2)(uint8_t *block, const uint8_t *pixels, const int line_size, int h)
-{
- // [wr0 wr1 wr2 wr3] for previous line
- // [wr4 wr5 wr6 wr7] for current line
- SET_RND(wr15); // =2 for rnd and =1 for no_rnd version
- __asm__ volatile(
- "pld [%[pixels]] \n\t"
- "mov r12, #2 \n\t"
- "pld [%[pixels], #32] \n\t"
- "tmcr wcgr0, r12 \n\t" /* for shift value */
- /* alignment */
- "and r12, %[pixels], #7 \n\t"
- "bic %[pixels], %[pixels], #7 \n\t"
- "tmcr wcgr1, r12 \n\t"
- "add r12, r12, #1 \n\t"
- "tmcr wcgr2, r12 \n\t"
-
- // [wr0 wr1 wr2 wr3] <= *
- // [wr4 wr5 wr6 wr7]
- "wldrd wr12, [%[pixels]] \n\t"
- "cmp r12, #8 \n\t"
- "wldrd wr13, [%[pixels], #8] \n\t"
- "wldrd wr14, [%[pixels], #16] \n\t"
- "add %[pixels], %[pixels], %[line_size] \n\t"
- "pld [%[pixels]] \n\t"
- "walignr1 wr2, wr12, wr13 \n\t"
- "pld [%[pixels], #32] \n\t"
- "walignr1 wr3, wr13, wr14 \n\t"
- "wmoveq wr10, wr13 \n\t"
- "wmoveq wr11, wr14 \n\t"
- "walignr2ne wr10, wr12, wr13 \n\t"
- "walignr2ne wr11, wr13, wr14 \n\t"
- "wunpckelub wr0, wr2 \n\t"
- "wunpckehub wr1, wr2 \n\t"
- "wunpckelub wr2, wr3 \n\t"
- "wunpckehub wr3, wr3 \n\t"
- "wunpckelub wr8, wr10 \n\t"
- "wunpckehub wr9, wr10 \n\t"
- "wunpckelub wr10, wr11 \n\t"
- "wunpckehub wr11, wr11 \n\t"
- "waddhus wr0, wr0, wr8 \n\t"
- "waddhus wr1, wr1, wr9 \n\t"
- "waddhus wr2, wr2, wr10 \n\t"
- "waddhus wr3, wr3, wr11 \n\t"
-
- "1: \n\t"
- // [wr0 wr1 wr2 wr3]
- // [wr4 wr5 wr6 wr7] <= *
- "wldrd wr12, [%[pixels]] \n\t"
- "cmp r12, #8 \n\t"
- "wldrd wr13, [%[pixels], #8] \n\t"
- "wldrd wr14, [%[pixels], #16] \n\t"
- "add %[pixels], %[pixels], %[line_size] \n\t"
- "walignr1 wr6, wr12, wr13 \n\t"
- "pld [%[pixels]] \n\t"
- "pld [%[pixels], #32] \n\t"
- "walignr1 wr7, wr13, wr14 \n\t"
- "wmoveq wr10, wr13 \n\t"
- "wmoveq wr11, wr14 \n\t"
- "walignr2ne wr10, wr12, wr13 \n\t"
- "walignr2ne wr11, wr13, wr14 \n\t"
- "wunpckelub wr4, wr6 \n\t"
- "wunpckehub wr5, wr6 \n\t"
- "wunpckelub wr6, wr7 \n\t"
- "wunpckehub wr7, wr7 \n\t"
- "wunpckelub wr8, wr10 \n\t"
- "wunpckehub wr9, wr10 \n\t"
- "wunpckelub wr10, wr11 \n\t"
- "wunpckehub wr11, wr11 \n\t"
- "waddhus wr4, wr4, wr8 \n\t"
- "waddhus wr5, wr5, wr9 \n\t"
- "waddhus wr6, wr6, wr10 \n\t"
- "waddhus wr7, wr7, wr11 \n\t"
- "waddhus wr8, wr0, wr4 \n\t"
- "waddhus wr9, wr1, wr5 \n\t"
- "waddhus wr10, wr2, wr6 \n\t"
- "waddhus wr11, wr3, wr7 \n\t"
- "waddhus wr8, wr8, wr15 \n\t"
- "waddhus wr9, wr9, wr15 \n\t"
- "waddhus wr10, wr10, wr15 \n\t"
- "waddhus wr11, wr11, wr15 \n\t"
- "wsrlhg wr8, wr8, wcgr0 \n\t"
- "wsrlhg wr9, wr9, wcgr0 \n\t"
- "wsrlhg wr10, wr10, wcgr0 \n\t"
- "wsrlhg wr11, wr11, wcgr0 \n\t"
- "wpackhus wr8, wr8, wr9 \n\t"
- "wpackhus wr9, wr10, wr11 \n\t"
- "wstrd wr8, [%[block]] \n\t"
- "wstrd wr9, [%[block], #8] \n\t"
- "add %[block], %[block], %[line_size] \n\t"
-
- // [wr0 wr1 wr2 wr3] <= *
- // [wr4 wr5 wr6 wr7]
- "wldrd wr12, [%[pixels]] \n\t"
- "wldrd wr13, [%[pixels], #8] \n\t"
- "wldrd wr14, [%[pixels], #16] \n\t"
- "add %[pixels], %[pixels], %[line_size] \n\t"
- "walignr1 wr2, wr12, wr13 \n\t"
- "pld [%[pixels]] \n\t"
- "pld [%[pixels], #32] \n\t"
- "walignr1 wr3, wr13, wr14 \n\t"
- "wmoveq wr10, wr13 \n\t"
- "wmoveq wr11, wr14 \n\t"
- "walignr2ne wr10, wr12, wr13 \n\t"
- "walignr2ne wr11, wr13, wr14 \n\t"
- "wunpckelub wr0, wr2 \n\t"
- "wunpckehub wr1, wr2 \n\t"
- "wunpckelub wr2, wr3 \n\t"
- "wunpckehub wr3, wr3 \n\t"
- "wunpckelub wr8, wr10 \n\t"
- "wunpckehub wr9, wr10 \n\t"
- "wunpckelub wr10, wr11 \n\t"
- "wunpckehub wr11, wr11 \n\t"
- "waddhus wr0, wr0, wr8 \n\t"
- "waddhus wr1, wr1, wr9 \n\t"
- "waddhus wr2, wr2, wr10 \n\t"
- "waddhus wr3, wr3, wr11 \n\t"
- "waddhus wr8, wr0, wr4 \n\t"
- "waddhus wr9, wr1, wr5 \n\t"
- "waddhus wr10, wr2, wr6 \n\t"
- "waddhus wr11, wr3, wr7 \n\t"
- "waddhus wr8, wr8, wr15 \n\t"
- "waddhus wr9, wr9, wr15 \n\t"
- "waddhus wr10, wr10, wr15 \n\t"
- "waddhus wr11, wr11, wr15 \n\t"
- "wsrlhg wr8, wr8, wcgr0 \n\t"
- "wsrlhg wr9, wr9, wcgr0 \n\t"
- "wsrlhg wr10, wr10, wcgr0 \n\t"
- "wsrlhg wr11, wr11, wcgr0 \n\t"
- "wpackhus wr8, wr8, wr9 \n\t"
- "wpackhus wr9, wr10, wr11 \n\t"
- "wstrd wr8, [%[block]] \n\t"
- "wstrd wr9, [%[block], #8] \n\t"
- "add %[block], %[block], %[line_size] \n\t"
-
- "subs %[h], %[h], #2 \n\t"
- "bne 1b \n\t"
- : [h]"+r"(h), [pixels]"+r"(pixels), [block]"+r"(block)
- : [line_size]"r"(line_size)
- : "r12", "memory");
-}
-
-void DEF(avg, pixels8_xy2)(uint8_t *block, const uint8_t *pixels, const int line_size, int h)
-{
- // [wr0 wr1 wr2 wr3] for previous line
- // [wr4 wr5 wr6 wr7] for current line
- SET_RND(wr15); // =2 for rnd and =1 for no_rnd version
- __asm__ volatile(
- "pld [%[block]] \n\t"
- "pld [%[block], #32] \n\t"
- "pld [%[pixels]] \n\t"
- "mov r12, #2 \n\t"
- "pld [%[pixels], #32] \n\t"
- "tmcr wcgr0, r12 \n\t" /* for shift value */
- "and r12, %[pixels], #7 \n\t"
- "bic %[pixels], %[pixels], #7 \n\t"
- "tmcr wcgr1, r12 \n\t"
-
- // [wr0 wr1 wr2 wr3] <= *
- // [wr4 wr5 wr6 wr7]
- "wldrd wr12, [%[pixels]] \n\t"
- "add r12, r12, #1 \n\t"
- "wldrd wr13, [%[pixels], #8] \n\t"
- "tmcr wcgr2, r12 \n\t"
- "add %[pixels], %[pixels], %[line_size] \n\t"
- "cmp r12, #8 \n\t"
- "pld [%[pixels]] \n\t"
- "pld [%[pixels], #32] \n\t"
- "walignr1 wr2, wr12, wr13 \n\t"
- "wmoveq wr10, wr13 \n\t"
- "walignr2ne wr10, wr12, wr13 \n\t"
- "wunpckelub wr0, wr2 \n\t"
- "wunpckehub wr1, wr2 \n\t"
- "wunpckelub wr8, wr10 \n\t"
- "wunpckehub wr9, wr10 \n\t"
- "waddhus wr0, wr0, wr8 \n\t"
- "waddhus wr1, wr1, wr9 \n\t"
-
- "1: \n\t"
- // [wr0 wr1 wr2 wr3]
- // [wr4 wr5 wr6 wr7] <= *
- "wldrd wr12, [%[pixels]] \n\t"
- "cmp r12, #8 \n\t"
- "wldrd wr13, [%[pixels], #8] \n\t"
- "add %[pixels], %[pixels], %[line_size] \n\t"
- "walignr1 wr6, wr12, wr13 \n\t"
- "pld [%[pixels]] \n\t"
- "pld [%[pixels], #32] \n\t"
- "wmoveq wr10, wr13 \n\t"
- "walignr2ne wr10, wr12, wr13 \n\t"
- "wunpckelub wr4, wr6 \n\t"
- "wunpckehub wr5, wr6 \n\t"
- "wunpckelub wr8, wr10 \n\t"
- "wunpckehub wr9, wr10 \n\t"
- "waddhus wr4, wr4, wr8 \n\t"
- "waddhus wr5, wr5, wr9 \n\t"
- "waddhus wr8, wr0, wr4 \n\t"
- "waddhus wr9, wr1, wr5 \n\t"
- "waddhus wr8, wr8, wr15 \n\t"
- "waddhus wr9, wr9, wr15 \n\t"
- "wldrd wr12, [%[block]] \n\t"
- "wsrlhg wr8, wr8, wcgr0 \n\t"
- "wsrlhg wr9, wr9, wcgr0 \n\t"
- "wpackhus wr8, wr8, wr9 \n\t"
- WAVG2B" wr8, wr8, wr12 \n\t"
- "wstrd wr8, [%[block]] \n\t"
- "add %[block], %[block], %[line_size] \n\t"
- "wldrd wr12, [%[pixels]] \n\t"
- "pld [%[block]] \n\t"
- "pld [%[block], #32] \n\t"
-
- // [wr0 wr1 wr2 wr3] <= *
- // [wr4 wr5 wr6 wr7]
- "wldrd wr13, [%[pixels], #8] \n\t"
- "add %[pixels], %[pixels], %[line_size] \n\t"
- "walignr1 wr2, wr12, wr13 \n\t"
- "pld [%[pixels]] \n\t"
- "pld [%[pixels], #32] \n\t"
- "wmoveq wr10, wr13 \n\t"
- "walignr2ne wr10, wr12, wr13 \n\t"
- "wunpckelub wr0, wr2 \n\t"
- "wunpckehub wr1, wr2 \n\t"
- "wunpckelub wr8, wr10 \n\t"
- "wunpckehub wr9, wr10 \n\t"
- "waddhus wr0, wr0, wr8 \n\t"
- "waddhus wr1, wr1, wr9 \n\t"
- "waddhus wr8, wr0, wr4 \n\t"
- "waddhus wr9, wr1, wr5 \n\t"
- "waddhus wr8, wr8, wr15 \n\t"
- "waddhus wr9, wr9, wr15 \n\t"
- "wldrd wr12, [%[block]] \n\t"
- "wsrlhg wr8, wr8, wcgr0 \n\t"
- "wsrlhg wr9, wr9, wcgr0 \n\t"
- "wpackhus wr8, wr8, wr9 \n\t"
- "subs %[h], %[h], #2 \n\t"
- WAVG2B" wr8, wr8, wr12 \n\t"
- "wstrd wr8, [%[block]] \n\t"
- "add %[block], %[block], %[line_size] \n\t"
- "pld [%[block]] \n\t"
- "pld [%[block], #32] \n\t"
- "bne 1b \n\t"
- : [h]"+r"(h), [pixels]"+r"(pixels), [block]"+r"(block)
- : [line_size]"r"(line_size)
- : "r12", "memory");
-}
-
-void DEF(avg, pixels16_xy2)(uint8_t *block, const uint8_t *pixels, const int line_size, int h)
-{
- // [wr0 wr1 wr2 wr3] for previous line
- // [wr4 wr5 wr6 wr7] for current line
- SET_RND(wr15); // =2 for rnd and =1 for no_rnd version
- __asm__ volatile(
- "pld [%[block]] \n\t"
- "pld [%[block], #32] \n\t"
- "pld [%[pixels]] \n\t"
- "mov r12, #2 \n\t"
- "pld [%[pixels], #32] \n\t"
- "tmcr wcgr0, r12 \n\t" /* for shift value */
- /* alignment */
- "and r12, %[pixels], #7 \n\t"
- "bic %[pixels], %[pixels], #7 \n\t"
- "tmcr wcgr1, r12 \n\t"
- "add r12, r12, #1 \n\t"
- "tmcr wcgr2, r12 \n\t"
-
- // [wr0 wr1 wr2 wr3] <= *
- // [wr4 wr5 wr6 wr7]
- "wldrd wr12, [%[pixels]] \n\t"
- "cmp r12, #8 \n\t"
- "wldrd wr13, [%[pixels], #8] \n\t"
- "wldrd wr14, [%[pixels], #16] \n\t"
- "add %[pixels], %[pixels], %[line_size] \n\t"
- "pld [%[pixels]] \n\t"
- "walignr1 wr2, wr12, wr13 \n\t"
- "pld [%[pixels], #32] \n\t"
- "walignr1 wr3, wr13, wr14 \n\t"
- "wmoveq wr10, wr13 \n\t"
- "wmoveq wr11, wr14 \n\t"
- "walignr2ne wr10, wr12, wr13 \n\t"
- "walignr2ne wr11, wr13, wr14 \n\t"
- "wunpckelub wr0, wr2 \n\t"
- "wunpckehub wr1, wr2 \n\t"
- "wunpckelub wr2, wr3 \n\t"
- "wunpckehub wr3, wr3 \n\t"
- "wunpckelub wr8, wr10 \n\t"
- "wunpckehub wr9, wr10 \n\t"
- "wunpckelub wr10, wr11 \n\t"
- "wunpckehub wr11, wr11 \n\t"
- "waddhus wr0, wr0, wr8 \n\t"
- "waddhus wr1, wr1, wr9 \n\t"
- "waddhus wr2, wr2, wr10 \n\t"
- "waddhus wr3, wr3, wr11 \n\t"
-
- "1: \n\t"
- // [wr0 wr1 wr2 wr3]
- // [wr4 wr5 wr6 wr7] <= *
- "wldrd wr12, [%[pixels]] \n\t"
- "cmp r12, #8 \n\t"
- "wldrd wr13, [%[pixels], #8] \n\t"
- "wldrd wr14, [%[pixels], #16] \n\t"
- "add %[pixels], %[pixels], %[line_size] \n\t"
- "walignr1 wr6, wr12, wr13 \n\t"
- "pld [%[pixels]] \n\t"
- "pld [%[pixels], #32] \n\t"
- "walignr1 wr7, wr13, wr14 \n\t"
- "wmoveq wr10, wr13 \n\t"
- "wmoveq wr11, wr14 \n\t"
- "walignr2ne wr10, wr12, wr13 \n\t"
- "walignr2ne wr11, wr13, wr14 \n\t"
- "wunpckelub wr4, wr6 \n\t"
- "wunpckehub wr5, wr6 \n\t"
- "wunpckelub wr6, wr7 \n\t"
- "wunpckehub wr7, wr7 \n\t"
- "wunpckelub wr8, wr10 \n\t"
- "wunpckehub wr9, wr10 \n\t"
- "wunpckelub wr10, wr11 \n\t"
- "wunpckehub wr11, wr11 \n\t"
- "waddhus wr4, wr4, wr8 \n\t"
- "waddhus wr5, wr5, wr9 \n\t"
- "waddhus wr6, wr6, wr10 \n\t"
- "waddhus wr7, wr7, wr11 \n\t"
- "waddhus wr8, wr0, wr4 \n\t"
- "waddhus wr9, wr1, wr5 \n\t"
- "waddhus wr10, wr2, wr6 \n\t"
- "waddhus wr11, wr3, wr7 \n\t"
- "waddhus wr8, wr8, wr15 \n\t"
- "waddhus wr9, wr9, wr15 \n\t"
- "waddhus wr10, wr10, wr15 \n\t"
- "waddhus wr11, wr11, wr15 \n\t"
- "wsrlhg wr8, wr8, wcgr0 \n\t"
- "wsrlhg wr9, wr9, wcgr0 \n\t"
- "wldrd wr12, [%[block]] \n\t"
- "wldrd wr13, [%[block], #8] \n\t"
- "wsrlhg wr10, wr10, wcgr0 \n\t"
- "wsrlhg wr11, wr11, wcgr0 \n\t"
- "wpackhus wr8, wr8, wr9 \n\t"
- "wpackhus wr9, wr10, wr11 \n\t"
- WAVG2B" wr8, wr8, wr12 \n\t"
- WAVG2B" wr9, wr9, wr13 \n\t"
- "wstrd wr8, [%[block]] \n\t"
- "wstrd wr9, [%[block], #8] \n\t"
- "add %[block], %[block], %[line_size] \n\t"
-
- // [wr0 wr1 wr2 wr3] <= *
- // [wr4 wr5 wr6 wr7]
- "wldrd wr12, [%[pixels]] \n\t"
- "pld [%[block]] \n\t"
- "wldrd wr13, [%[pixels], #8] \n\t"
- "pld [%[block], #32] \n\t"
- "wldrd wr14, [%[pixels], #16] \n\t"
- "add %[pixels], %[pixels], %[line_size] \n\t"
- "walignr1 wr2, wr12, wr13 \n\t"
- "pld [%[pixels]] \n\t"
- "pld [%[pixels], #32] \n\t"
- "walignr1 wr3, wr13, wr14 \n\t"
- "wmoveq wr10, wr13 \n\t"
- "wmoveq wr11, wr14 \n\t"
- "walignr2ne wr10, wr12, wr13 \n\t"
- "walignr2ne wr11, wr13, wr14 \n\t"
- "wunpckelub wr0, wr2 \n\t"
- "wunpckehub wr1, wr2 \n\t"
- "wunpckelub wr2, wr3 \n\t"
- "wunpckehub wr3, wr3 \n\t"
- "wunpckelub wr8, wr10 \n\t"
- "wunpckehub wr9, wr10 \n\t"
- "wunpckelub wr10, wr11 \n\t"
- "wunpckehub wr11, wr11 \n\t"
- "waddhus wr0, wr0, wr8 \n\t"
- "waddhus wr1, wr1, wr9 \n\t"
- "waddhus wr2, wr2, wr10 \n\t"
- "waddhus wr3, wr3, wr11 \n\t"
- "waddhus wr8, wr0, wr4 \n\t"
- "waddhus wr9, wr1, wr5 \n\t"
- "waddhus wr10, wr2, wr6 \n\t"
- "waddhus wr11, wr3, wr7 \n\t"
- "waddhus wr8, wr8, wr15 \n\t"
- "waddhus wr9, wr9, wr15 \n\t"
- "waddhus wr10, wr10, wr15 \n\t"
- "waddhus wr11, wr11, wr15 \n\t"
- "wsrlhg wr8, wr8, wcgr0 \n\t"
- "wsrlhg wr9, wr9, wcgr0 \n\t"
- "wldrd wr12, [%[block]] \n\t"
- "wldrd wr13, [%[block], #8] \n\t"
- "wsrlhg wr10, wr10, wcgr0 \n\t"
- "wsrlhg wr11, wr11, wcgr0 \n\t"
- "wpackhus wr8, wr8, wr9 \n\t"
- "wpackhus wr9, wr10, wr11 \n\t"
- WAVG2B" wr8, wr8, wr12 \n\t"
- WAVG2B" wr9, wr9, wr13 \n\t"
- "wstrd wr8, [%[block]] \n\t"
- "wstrd wr9, [%[block], #8] \n\t"
- "add %[block], %[block], %[line_size] \n\t"
- "subs %[h], %[h], #2 \n\t"
- "pld [%[block]] \n\t"
- "pld [%[block], #32] \n\t"
- "bne 1b \n\t"
- : [h]"+r"(h), [pixels]"+r"(pixels), [block]"+r"(block)
- : [line_size]"r"(line_size)
- : "r12", "memory");
-}
diff --git a/gst-libs/ext/libav/libavcodec/arm/dsputil_neon.S b/gst-libs/ext/libav/libavcodec/arm/dsputil_neon.S
index d49aedd..cf9ad9e 100644
--- a/gst-libs/ext/libav/libavcodec/arm/dsputil_neon.S
+++ b/gst-libs/ext/libav/libavcodec/arm/dsputil_neon.S
@@ -20,9 +20,7 @@
*/
#include "config.h"
-#include "asm.S"
-
- preserve8
+#include "libavutil/arm/asm.S"
function ff_clear_block_neon, export=1
vmov.i16 q0, #0
@@ -44,22 +42,22 @@ endfunc
.if \avg
mov r12, r0
.endif
-1: vld1.64 {q0}, [r1], r2
- vld1.64 {q1}, [r1], r2
- vld1.64 {q2}, [r1], r2
+1: vld1.8 {q0}, [r1], r2
+ vld1.8 {q1}, [r1], r2
+ vld1.8 {q2}, [r1], r2
pld [r1, r2, lsl #2]
- vld1.64 {q3}, [r1], r2
+ vld1.8 {q3}, [r1], r2
pld [r1]
pld [r1, r2]
pld [r1, r2, lsl #1]
.if \avg
- vld1.64 {q8}, [r12,:128], r2
+ vld1.8 {q8}, [r12,:128], r2
vrhadd.u8 q0, q0, q8
- vld1.64 {q9}, [r12,:128], r2
+ vld1.8 {q9}, [r12,:128], r2
vrhadd.u8 q1, q1, q9
- vld1.64 {q10}, [r12,:128], r2
+ vld1.8 {q10}, [r12,:128], r2
vrhadd.u8 q2, q2, q10
- vld1.64 {q11}, [r12,:128], r2
+ vld1.8 {q11}, [r12,:128], r2
vrhadd.u8 q3, q3, q11
.endif
subs r3, r3, #4
@@ -72,8 +70,8 @@ endfunc
.endm
.macro pixels16_x2 rnd=1, avg=0
-1: vld1.64 {d0-d2}, [r1], r2
- vld1.64 {d4-d6}, [r1], r2
+1: vld1.8 {d0-d2}, [r1], r2
+ vld1.8 {d4-d6}, [r1], r2
pld [r1]
pld [r1, r2]
subs r3, r3, #2
@@ -88,20 +86,21 @@ endfunc
vrhadd.u8 q2, q2, q3
sub r0, r0, r2
.endif
- vst1.64 {q0}, [r0,:128], r2
- vst1.64 {q2}, [r0,:128], r2
+ vst1.8 {q0}, [r0,:128], r2
+ vst1.8 {q2}, [r0,:128], r2
bne 1b
bx lr
.endm
.macro pixels16_y2 rnd=1, avg=0
- vld1.64 {q0}, [r1], r2
- vld1.64 {q1}, [r1], r2
+ sub r3, r3, #2
+ vld1.8 {q0}, [r1], r2
+ vld1.8 {q1}, [r1], r2
1: subs r3, r3, #2
avg q2, q0, q1
- vld1.64 {q0}, [r1], r2
+ vld1.8 {q0}, [r1], r2
avg q3, q0, q1
- vld1.64 {q1}, [r1], r2
+ vld1.8 {q1}, [r1], r2
pld [r1]
pld [r1, r2]
.if \avg
@@ -111,18 +110,31 @@ endfunc
vrhadd.u8 q3, q3, q9
sub r0, r0, r2
.endif
- vst1.64 {q2}, [r0,:128], r2
- vst1.64 {q3}, [r0,:128], r2
+ vst1.8 {q2}, [r0,:128], r2
+ vst1.8 {q3}, [r0,:128], r2
bne 1b
+
+ avg q2, q0, q1
+ vld1.8 {q0}, [r1], r2
+ avg q3, q0, q1
+ .if \avg
+ vld1.8 {q8}, [r0,:128], r2
+ vld1.8 {q9}, [r0,:128]
+ vrhadd.u8 q2, q2, q8
+ vrhadd.u8 q3, q3, q9
+ sub r0, r0, r2
+ .endif
+ vst1.8 {q2}, [r0,:128], r2
+ vst1.8 {q3}, [r0,:128], r2
+
bx lr
.endm
.macro pixels16_xy2 rnd=1, avg=0
- vld1.64 {d0-d2}, [r1], r2
- vld1.64 {d4-d6}, [r1], r2
- .ifeq \rnd
- vmov.i16 q13, #1
- .endif
+ sub r3, r3, #2
+ vld1.8 {d0-d2}, [r1], r2
+ vld1.8 {d4-d6}, [r1], r2
+NRND vmov.i16 q13, #1
pld [r1]
pld [r1, r2]
vext.8 q1, q0, q1, #1
@@ -132,38 +144,30 @@ endfunc
vaddl.u8 q9, d4, d6
vaddl.u8 q11, d5, d7
1: subs r3, r3, #2
- vld1.64 {d0-d2}, [r1], r2
+ vld1.8 {d0-d2}, [r1], r2
vadd.u16 q12, q8, q9
pld [r1]
- .ifeq \rnd
- vadd.u16 q12, q12, q13
- .endif
+NRND vadd.u16 q12, q12, q13
vext.8 q15, q0, q1, #1
vadd.u16 q1 , q10, q11
shrn d28, q12, #2
- .ifeq \rnd
- vadd.u16 q1, q1, q13
- .endif
+NRND vadd.u16 q1, q1, q13
shrn d29, q1, #2
.if \avg
vld1.8 {q8}, [r0,:128]
vrhadd.u8 q14, q14, q8
.endif
vaddl.u8 q8, d0, d30
- vld1.64 {d2-d4}, [r1], r2
+ vld1.8 {d2-d4}, [r1], r2
vaddl.u8 q10, d1, d31
- vst1.64 {q14}, [r0,:128], r2
+ vst1.8 {q14}, [r0,:128], r2
vadd.u16 q12, q8, q9
pld [r1, r2]
- .ifeq \rnd
- vadd.u16 q12, q12, q13
- .endif
+NRND vadd.u16 q12, q12, q13
vext.8 q2, q1, q2, #1
vadd.u16 q0, q10, q11
shrn d30, q12, #2
- .ifeq \rnd
- vadd.u16 q0, q0, q13
- .endif
+NRND vadd.u16 q0, q0, q13
shrn d31, q0, #2
.if \avg
vld1.8 {q9}, [r0,:128]
@@ -171,44 +175,72 @@ endfunc
.endif
vaddl.u8 q9, d2, d4
vaddl.u8 q11, d3, d5
- vst1.64 {q15}, [r0,:128], r2
+ vst1.8 {q15}, [r0,:128], r2
bgt 1b
+
+ vld1.8 {d0-d2}, [r1], r2
+ vadd.u16 q12, q8, q9
+NRND vadd.u16 q12, q12, q13
+ vext.8 q15, q0, q1, #1
+ vadd.u16 q1 , q10, q11
+ shrn d28, q12, #2
+NRND vadd.u16 q1, q1, q13
+ shrn d29, q1, #2
+ .if \avg
+ vld1.8 {q8}, [r0,:128]
+ vrhadd.u8 q14, q14, q8
+ .endif
+ vaddl.u8 q8, d0, d30
+ vaddl.u8 q10, d1, d31
+ vst1.8 {q14}, [r0,:128], r2
+ vadd.u16 q12, q8, q9
+NRND vadd.u16 q12, q12, q13
+ vadd.u16 q0, q10, q11
+ shrn d30, q12, #2
+NRND vadd.u16 q0, q0, q13
+ shrn d31, q0, #2
+ .if \avg
+ vld1.8 {q9}, [r0,:128]
+ vrhadd.u8 q15, q15, q9
+ .endif
+ vst1.8 {q15}, [r0,:128], r2
+
bx lr
.endm
.macro pixels8 rnd=1, avg=0
-1: vld1.64 {d0}, [r1], r2
- vld1.64 {d1}, [r1], r2
- vld1.64 {d2}, [r1], r2
+1: vld1.8 {d0}, [r1], r2
+ vld1.8 {d1}, [r1], r2
+ vld1.8 {d2}, [r1], r2
pld [r1, r2, lsl #2]
- vld1.64 {d3}, [r1], r2
+ vld1.8 {d3}, [r1], r2
pld [r1]
pld [r1, r2]
pld [r1, r2, lsl #1]
.if \avg
- vld1.64 {d4}, [r0,:64], r2
+ vld1.8 {d4}, [r0,:64], r2
vrhadd.u8 d0, d0, d4
- vld1.64 {d5}, [r0,:64], r2
+ vld1.8 {d5}, [r0,:64], r2
vrhadd.u8 d1, d1, d5
- vld1.64 {d6}, [r0,:64], r2
+ vld1.8 {d6}, [r0,:64], r2
vrhadd.u8 d2, d2, d6
- vld1.64 {d7}, [r0,:64], r2
+ vld1.8 {d7}, [r0,:64], r2
vrhadd.u8 d3, d3, d7
sub r0, r0, r2, lsl #2
.endif
subs r3, r3, #4
- vst1.64 {d0}, [r0,:64], r2
- vst1.64 {d1}, [r0,:64], r2
- vst1.64 {d2}, [r0,:64], r2
- vst1.64 {d3}, [r0,:64], r2
+ vst1.8 {d0}, [r0,:64], r2
+ vst1.8 {d1}, [r0,:64], r2
+ vst1.8 {d2}, [r0,:64], r2
+ vst1.8 {d3}, [r0,:64], r2
bne 1b
bx lr
.endm
.macro pixels8_x2 rnd=1, avg=0
-1: vld1.64 {q0}, [r1], r2
+1: vld1.8 {q0}, [r1], r2
vext.8 d1, d0, d1, #1
- vld1.64 {q1}, [r1], r2
+ vld1.8 {q1}, [r1], r2
vext.8 d3, d2, d3, #1
pld [r1]
pld [r1, r2]
@@ -221,20 +253,21 @@ endfunc
vrhadd.u8 q0, q0, q2
sub r0, r0, r2
.endif
- vst1.64 {d0}, [r0,:64], r2
- vst1.64 {d1}, [r0,:64], r2
+ vst1.8 {d0}, [r0,:64], r2
+ vst1.8 {d1}, [r0,:64], r2
bne 1b
bx lr
.endm
.macro pixels8_y2 rnd=1, avg=0
- vld1.64 {d0}, [r1], r2
- vld1.64 {d1}, [r1], r2
+ sub r3, r3, #2
+ vld1.8 {d0}, [r1], r2
+ vld1.8 {d1}, [r1], r2
1: subs r3, r3, #2
avg d4, d0, d1
- vld1.64 {d0}, [r1], r2
+ vld1.8 {d0}, [r1], r2
avg d5, d0, d1
- vld1.64 {d1}, [r1], r2
+ vld1.8 {d1}, [r1], r2
pld [r1]
pld [r1, r2]
.if \avg
@@ -243,18 +276,30 @@ endfunc
vrhadd.u8 q2, q2, q1
sub r0, r0, r2
.endif
- vst1.64 {d4}, [r0,:64], r2
- vst1.64 {d5}, [r0,:64], r2
+ vst1.8 {d4}, [r0,:64], r2
+ vst1.8 {d5}, [r0,:64], r2
bne 1b
+
+ avg d4, d0, d1
+ vld1.8 {d0}, [r1], r2
+ avg d5, d0, d1
+ .if \avg
+ vld1.8 {d2}, [r0,:64], r2
+ vld1.8 {d3}, [r0,:64]
+ vrhadd.u8 q2, q2, q1
+ sub r0, r0, r2
+ .endif
+ vst1.8 {d4}, [r0,:64], r2
+ vst1.8 {d5}, [r0,:64], r2
+
bx lr
.endm
.macro pixels8_xy2 rnd=1, avg=0
- vld1.64 {q0}, [r1], r2
- vld1.64 {q1}, [r1], r2
- .ifeq \rnd
- vmov.i16 q11, #1
- .endif
+ sub r3, r3, #2
+ vld1.8 {q0}, [r1], r2
+ vld1.8 {q1}, [r1], r2
+NRND vmov.i16 q11, #1
pld [r1]
pld [r1, r2]
vext.8 d4, d0, d1, #1
@@ -262,26 +307,22 @@ endfunc
vaddl.u8 q8, d0, d4
vaddl.u8 q9, d2, d6
1: subs r3, r3, #2
- vld1.64 {q0}, [r1], r2
+ vld1.8 {q0}, [r1], r2
pld [r1]
vadd.u16 q10, q8, q9
vext.8 d4, d0, d1, #1
- .ifeq \rnd
- vadd.u16 q10, q10, q11
- .endif
+NRND vadd.u16 q10, q10, q11
vaddl.u8 q8, d0, d4
shrn d5, q10, #2
- vld1.64 {q1}, [r1], r2
+ vld1.8 {q1}, [r1], r2
vadd.u16 q10, q8, q9
pld [r1, r2]
.if \avg
vld1.8 {d7}, [r0,:64]
vrhadd.u8 d5, d5, d7
.endif
- .ifeq \rnd
- vadd.u16 q10, q10, q11
- .endif
- vst1.64 {d5}, [r0,:64], r2
+NRND vadd.u16 q10, q10, q11
+ vst1.8 {d5}, [r0,:64], r2
shrn d7, q10, #2
.if \avg
vld1.8 {d5}, [r0,:64]
@@ -289,8 +330,29 @@ endfunc
.endif
vext.8 d6, d2, d3, #1
vaddl.u8 q9, d2, d6
- vst1.64 {d7}, [r0,:64], r2
+ vst1.8 {d7}, [r0,:64], r2
bgt 1b
+
+ vld1.8 {q0}, [r1], r2
+ vadd.u16 q10, q8, q9
+ vext.8 d4, d0, d1, #1
+NRND vadd.u16 q10, q10, q11
+ vaddl.u8 q8, d0, d4
+ shrn d5, q10, #2
+ vadd.u16 q10, q8, q9
+ .if \avg
+ vld1.8 {d7}, [r0,:64]
+ vrhadd.u8 d5, d5, d7
+ .endif
+NRND vadd.u16 q10, q10, q11
+ vst1.8 {d5}, [r0,:64], r2
+ shrn d7, q10, #2
+ .if \avg
+ vld1.8 {d5}, [r0,:64]
+ vrhadd.u8 d7, d7, d5
+ .endif
+ vst1.8 {d7}, [r0,:64], r2
+
bx lr
.endm
@@ -302,6 +364,8 @@ endfunc
.macro shrn rd, rn, rm
vrshrn.u16 \rd, \rn, \rm
.endm
+ .macro NRND insn:vararg
+ .endm
.else
.macro avg rd, rn, rm
vhadd.u8 \rd, \rn, \rm
@@ -309,12 +373,16 @@ endfunc
.macro shrn rd, rn, rm
vshrn.u16 \rd, \rn, \rm
.endm
+ .macro NRND insn:vararg
+ \insn
+ .endm
.endif
function ff_\pfx\name\suf\()_neon, export=1
\name \rnd, \avg
endfunc
.purgem avg
.purgem shrn
+ .purgem NRND
.endm
.macro pixfunc2 pfx, name, avg=0
@@ -359,147 +427,108 @@ endfunc
pixfunc2 avg_, pixels8_xy2, avg=1
function ff_put_pixels_clamped_neon, export=1
- vld1.64 {d16-d19}, [r0,:128]!
+ vld1.16 {d16-d19}, [r0,:128]!
vqmovun.s16 d0, q8
- vld1.64 {d20-d23}, [r0,:128]!
+ vld1.16 {d20-d23}, [r0,:128]!
vqmovun.s16 d1, q9
- vld1.64 {d24-d27}, [r0,:128]!
+ vld1.16 {d24-d27}, [r0,:128]!
vqmovun.s16 d2, q10
- vld1.64 {d28-d31}, [r0,:128]!
+ vld1.16 {d28-d31}, [r0,:128]!
vqmovun.s16 d3, q11
- vst1.64 {d0}, [r1,:64], r2
+ vst1.8 {d0}, [r1,:64], r2
vqmovun.s16 d4, q12
- vst1.64 {d1}, [r1,:64], r2
+ vst1.8 {d1}, [r1,:64], r2
vqmovun.s16 d5, q13
- vst1.64 {d2}, [r1,:64], r2
+ vst1.8 {d2}, [r1,:64], r2
vqmovun.s16 d6, q14
- vst1.64 {d3}, [r1,:64], r2
+ vst1.8 {d3}, [r1,:64], r2
vqmovun.s16 d7, q15
- vst1.64 {d4}, [r1,:64], r2
- vst1.64 {d5}, [r1,:64], r2
- vst1.64 {d6}, [r1,:64], r2
- vst1.64 {d7}, [r1,:64], r2
+ vst1.8 {d4}, [r1,:64], r2
+ vst1.8 {d5}, [r1,:64], r2
+ vst1.8 {d6}, [r1,:64], r2
+ vst1.8 {d7}, [r1,:64], r2
bx lr
endfunc
function ff_put_signed_pixels_clamped_neon, export=1
vmov.u8 d31, #128
- vld1.64 {d16-d17}, [r0,:128]!
+ vld1.16 {d16-d17}, [r0,:128]!
vqmovn.s16 d0, q8
- vld1.64 {d18-d19}, [r0,:128]!
+ vld1.16 {d18-d19}, [r0,:128]!
vqmovn.s16 d1, q9
- vld1.64 {d16-d17}, [r0,:128]!
+ vld1.16 {d16-d17}, [r0,:128]!
vqmovn.s16 d2, q8
- vld1.64 {d18-d19}, [r0,:128]!
+ vld1.16 {d18-d19}, [r0,:128]!
vadd.u8 d0, d0, d31
- vld1.64 {d20-d21}, [r0,:128]!
+ vld1.16 {d20-d21}, [r0,:128]!
vadd.u8 d1, d1, d31
- vld1.64 {d22-d23}, [r0,:128]!
+ vld1.16 {d22-d23}, [r0,:128]!
vadd.u8 d2, d2, d31
- vst1.64 {d0}, [r1,:64], r2
+ vst1.8 {d0}, [r1,:64], r2
vqmovn.s16 d3, q9
- vst1.64 {d1}, [r1,:64], r2
+ vst1.8 {d1}, [r1,:64], r2
vqmovn.s16 d4, q10
- vst1.64 {d2}, [r1,:64], r2
+ vst1.8 {d2}, [r1,:64], r2
vqmovn.s16 d5, q11
- vld1.64 {d24-d25}, [r0,:128]!
+ vld1.16 {d24-d25}, [r0,:128]!
vadd.u8 d3, d3, d31
- vld1.64 {d26-d27}, [r0,:128]!
+ vld1.16 {d26-d27}, [r0,:128]!
vadd.u8 d4, d4, d31
vadd.u8 d5, d5, d31
- vst1.64 {d3}, [r1,:64], r2
+ vst1.8 {d3}, [r1,:64], r2
vqmovn.s16 d6, q12
- vst1.64 {d4}, [r1,:64], r2
+ vst1.8 {d4}, [r1,:64], r2
vqmovn.s16 d7, q13
- vst1.64 {d5}, [r1,:64], r2
+ vst1.8 {d5}, [r1,:64], r2
vadd.u8 d6, d6, d31
vadd.u8 d7, d7, d31
- vst1.64 {d6}, [r1,:64], r2
- vst1.64 {d7}, [r1,:64], r2
+ vst1.8 {d6}, [r1,:64], r2
+ vst1.8 {d7}, [r1,:64], r2
bx lr
endfunc
function ff_add_pixels_clamped_neon, export=1
mov r3, r1
- vld1.64 {d16}, [r1,:64], r2
- vld1.64 {d0-d1}, [r0,:128]!
+ vld1.8 {d16}, [r1,:64], r2
+ vld1.16 {d0-d1}, [r0,:128]!
vaddw.u8 q0, q0, d16
- vld1.64 {d17}, [r1,:64], r2
- vld1.64 {d2-d3}, [r0,:128]!
+ vld1.8 {d17}, [r1,:64], r2
+ vld1.16 {d2-d3}, [r0,:128]!
vqmovun.s16 d0, q0
- vld1.64 {d18}, [r1,:64], r2
+ vld1.8 {d18}, [r1,:64], r2
vaddw.u8 q1, q1, d17
- vld1.64 {d4-d5}, [r0,:128]!
+ vld1.16 {d4-d5}, [r0,:128]!
vaddw.u8 q2, q2, d18
- vst1.64 {d0}, [r3,:64], r2
+ vst1.8 {d0}, [r3,:64], r2
vqmovun.s16 d2, q1
- vld1.64 {d19}, [r1,:64], r2
- vld1.64 {d6-d7}, [r0,:128]!
+ vld1.8 {d19}, [r1,:64], r2
+ vld1.16 {d6-d7}, [r0,:128]!
vaddw.u8 q3, q3, d19
vqmovun.s16 d4, q2
- vst1.64 {d2}, [r3,:64], r2
- vld1.64 {d16}, [r1,:64], r2
+ vst1.8 {d2}, [r3,:64], r2
+ vld1.8 {d16}, [r1,:64], r2
vqmovun.s16 d6, q3
- vld1.64 {d0-d1}, [r0,:128]!
+ vld1.16 {d0-d1}, [r0,:128]!
vaddw.u8 q0, q0, d16
- vst1.64 {d4}, [r3,:64], r2
- vld1.64 {d17}, [r1,:64], r2
- vld1.64 {d2-d3}, [r0,:128]!
+ vst1.8 {d4}, [r3,:64], r2
+ vld1.8 {d17}, [r1,:64], r2
+ vld1.16 {d2-d3}, [r0,:128]!
vaddw.u8 q1, q1, d17
- vst1.64 {d6}, [r3,:64], r2
+ vst1.8 {d6}, [r3,:64], r2
vqmovun.s16 d0, q0
- vld1.64 {d18}, [r1,:64], r2
- vld1.64 {d4-d5}, [r0,:128]!
+ vld1.8 {d18}, [r1,:64], r2
+ vld1.16 {d4-d5}, [r0,:128]!
vaddw.u8 q2, q2, d18
- vst1.64 {d0}, [r3,:64], r2
+ vst1.8 {d0}, [r3,:64], r2
vqmovun.s16 d2, q1
- vld1.64 {d19}, [r1,:64], r2
+ vld1.8 {d19}, [r1,:64], r2
vqmovun.s16 d4, q2
- vld1.64 {d6-d7}, [r0,:128]!
+ vld1.16 {d6-d7}, [r0,:128]!
vaddw.u8 q3, q3, d19
- vst1.64 {d2}, [r3,:64], r2
+ vst1.8 {d2}, [r3,:64], r2
vqmovun.s16 d6, q3
- vst1.64 {d4}, [r3,:64], r2
- vst1.64 {d6}, [r3,:64], r2
- bx lr
-endfunc
-
-function ff_vector_fmul_neon, export=1
- subs r3, r3, #8
- vld1.64 {d0-d3}, [r1,:128]!
- vld1.64 {d4-d7}, [r2,:128]!
- vmul.f32 q8, q0, q2
- vmul.f32 q9, q1, q3
- beq 3f
- bics ip, r3, #15
- beq 2f
-1: subs ip, ip, #16
- vld1.64 {d0-d1}, [r1,:128]!
- vld1.64 {d4-d5}, [r2,:128]!
- vmul.f32 q10, q0, q2
- vld1.64 {d2-d3}, [r1,:128]!
- vld1.64 {d6-d7}, [r2,:128]!
- vmul.f32 q11, q1, q3
- vst1.64 {d16-d19},[r0,:128]!
- vld1.64 {d0-d1}, [r1,:128]!
- vld1.64 {d4-d5}, [r2,:128]!
- vmul.f32 q8, q0, q2
- vld1.64 {d2-d3}, [r1,:128]!
- vld1.64 {d6-d7}, [r2,:128]!
- vmul.f32 q9, q1, q3
- vst1.64 {d20-d23},[r0,:128]!
- bne 1b
- ands r3, r3, #15
- beq 3f
-2: vld1.64 {d0-d1}, [r1,:128]!
- vld1.64 {d4-d5}, [r2,:128]!
- vst1.64 {d16-d17},[r0,:128]!
- vmul.f32 q8, q0, q2
- vld1.64 {d2-d3}, [r1,:128]!
- vld1.64 {d6-d7}, [r2,:128]!
- vst1.64 {d18-d19},[r0,:128]!
- vmul.f32 q9, q1, q3
-3: vst1.64 {d16-d19},[r0,:128]!
+ vst1.8 {d4}, [r3,:64], r2
+ vst1.8 {d6}, [r3,:64], r2
bx lr
endfunc
@@ -512,10 +541,10 @@ function ff_vector_fmul_window_neon, export=1
add r4, r3, r5, lsl #3
add ip, r0, r5, lsl #3
mov r5, #-16
- vld1.64 {d0,d1}, [r1,:128]!
- vld1.64 {d2,d3}, [r2,:128], r5
- vld1.64 {d4,d5}, [r3,:128]!
- vld1.64 {d6,d7}, [r4,:128], r5
+ vld1.32 {d0,d1}, [r1,:128]!
+ vld1.32 {d2,d3}, [r2,:128], r5
+ vld1.32 {d4,d5}, [r3,:128]!
+ vld1.32 {d6,d7}, [r4,:128], r5
1: subs lr, lr, #4
vmul.f32 d22, d0, d4
vrev64.32 q3, q3
@@ -525,19 +554,19 @@ function ff_vector_fmul_window_neon, export=1
vmul.f32 d21, d1, d6
beq 2f
vmla.f32 d22, d3, d7
- vld1.64 {d0,d1}, [r1,:128]!
+ vld1.32 {d0,d1}, [r1,:128]!
vmla.f32 d23, d2, d6
- vld1.64 {d18,d19},[r2,:128], r5
+ vld1.32 {d18,d19},[r2,:128], r5
vmls.f32 d20, d3, d4
- vld1.64 {d24,d25},[r3,:128]!
+ vld1.32 {d24,d25},[r3,:128]!
vmls.f32 d21, d2, d5
- vld1.64 {d6,d7}, [r4,:128], r5
+ vld1.32 {d6,d7}, [r4,:128], r5
vmov q1, q9
vrev64.32 q11, q11
vmov q2, q12
vswp d22, d23
- vst1.64 {d20,d21},[r0,:128]!
- vst1.64 {d22,d23},[ip,:128], r5
+ vst1.32 {d20,d21},[r0,:128]!
+ vst1.32 {d22,d23},[ip,:128], r5
b 1b
2: vmla.f32 d22, d3, d7
vmla.f32 d23, d2, d6
@@ -545,8 +574,8 @@ function ff_vector_fmul_window_neon, export=1
vmls.f32 d21, d2, d5
vrev64.32 q11, q11
vswp d22, d23
- vst1.64 {d20,d21},[r0,:128]!
- vst1.64 {d22,d23},[ip,:128], r5
+ vst1.32 {d20,d21},[r0,:128]!
+ vst1.32 {d22,d23},[ip,:128], r5
pop {r4,r5,pc}
endfunc
@@ -613,92 +642,6 @@ function ff_vorbis_inverse_coupling_neon, export=1
endfunc
#endif
-function ff_vector_fmul_scalar_neon, export=1
-VFP len .req r2
-NOVFP len .req r3
-VFP vdup.32 q8, d0[0]
-NOVFP vdup.32 q8, r2
- bics r12, len, #15
- beq 3f
- vld1.32 {q0},[r1,:128]!
- vld1.32 {q1},[r1,:128]!
-1: vmul.f32 q0, q0, q8
- vld1.32 {q2},[r1,:128]!
- vmul.f32 q1, q1, q8
- vld1.32 {q3},[r1,:128]!
- vmul.f32 q2, q2, q8
- vst1.32 {q0},[r0,:128]!
- vmul.f32 q3, q3, q8
- vst1.32 {q1},[r0,:128]!
- subs r12, r12, #16
- beq 2f
- vld1.32 {q0},[r1,:128]!
- vst1.32 {q2},[r0,:128]!
- vld1.32 {q1},[r1,:128]!
- vst1.32 {q3},[r0,:128]!
- b 1b
-2: vst1.32 {q2},[r0,:128]!
- vst1.32 {q3},[r0,:128]!
- ands len, len, #15
- it eq
- bxeq lr
-3: vld1.32 {q0},[r1,:128]!
- vmul.f32 q0, q0, q8
- vst1.32 {q0},[r0,:128]!
- subs len, len, #4
- bgt 3b
- bx lr
- .unreq len
-endfunc
-
-function ff_vector_fmac_scalar_neon, export=1
-VFP len .req r2
-VFP acc .req r3
-NOVFP len .req r3
-NOVFP acc .req r2
-VFP vdup.32 q15, d0[0]
-NOVFP vdup.32 q15, r2
- bics r12, len, #15
- mov acc, r0
- beq 3f
- vld1.32 {q0}, [r1,:128]!
- vld1.32 {q8}, [acc,:128]!
- vld1.32 {q1}, [r1,:128]!
- vld1.32 {q9}, [acc,:128]!
-1: vmla.f32 q8, q0, q15
- vld1.32 {q2}, [r1,:128]!
- vld1.32 {q10}, [acc,:128]!
- vmla.f32 q9, q1, q15
- vld1.32 {q3}, [r1,:128]!
- vld1.32 {q11}, [acc,:128]!
- vmla.f32 q10, q2, q15
- vst1.32 {q8}, [r0,:128]!
- vmla.f32 q11, q3, q15
- vst1.32 {q9}, [r0,:128]!
- subs r12, r12, #16
- beq 2f
- vld1.32 {q0}, [r1,:128]!
- vld1.32 {q8}, [acc,:128]!
- vst1.32 {q10}, [r0,:128]!
- vld1.32 {q1}, [r1,:128]!
- vld1.32 {q9}, [acc,:128]!
- vst1.32 {q11}, [r0,:128]!
- b 1b
-2: vst1.32 {q10}, [r0,:128]!
- vst1.32 {q11}, [r0,:128]!
- ands len, len, #15
- it eq
- bxeq lr
-3: vld1.32 {q0}, [r1,:128]!
- vld1.32 {q8}, [acc,:128]!
- vmla.f32 q8, q0, q15
- vst1.32 {q8}, [r0,:128]!
- subs len, len, #4
- bgt 3b
- bx lr
- .unreq len
-endfunc
-
function ff_butterflies_float_neon, export=1
1: vld1.32 {q0},[r0,:128]
vld1.32 {q1},[r1,:128]
diff --git a/gst-libs/ext/libav/libavcodec/arm/dsputil_vfp.S b/gst-libs/ext/libav/libavcodec/arm/dsputil_vfp.S
index cbc4bd6..9df955d 100644
--- a/gst-libs/ext/libav/libavcodec/arm/dsputil_vfp.S
+++ b/gst-libs/ext/libav/libavcodec/arm/dsputil_vfp.S
@@ -19,7 +19,7 @@
*/
#include "config.h"
-#include "asm.S"
+#include "libavutil/arm/asm.S"
/*
* VFP is a floating point coprocessor used in some ARM cores. VFP11 has 1 cycle
@@ -37,53 +37,6 @@
*/
/**
- * ARM VFP optimized implementation of 'vector_fmul_c' function.
- * Assume that len is a positive number and is multiple of 8
- */
-@ void ff_vector_fmul_vfp(float *dst, const float *src0, const float *src1, int len)
-function ff_vector_fmul_vfp, export=1
- vpush {d8-d15}
- fmrx r12, fpscr
- orr r12, r12, #(3 << 16) /* set vector size to 4 */
- fmxr fpscr, r12
-
- vldmia r1!, {s0-s3}
- vldmia r2!, {s8-s11}
- vldmia r1!, {s4-s7}
- vldmia r2!, {s12-s15}
- vmul.f32 s8, s0, s8
-1:
- subs r3, r3, #16
- vmul.f32 s12, s4, s12
- itttt ge
- vldmiage r1!, {s16-s19}
- vldmiage r2!, {s24-s27}
- vldmiage r1!, {s20-s23}
- vldmiage r2!, {s28-s31}
- it ge
- vmulge.f32 s24, s16, s24
- vstmia r0!, {s8-s11}
- vstmia r0!, {s12-s15}
- it ge
- vmulge.f32 s28, s20, s28
- itttt gt
- vldmiagt r1!, {s0-s3}
- vldmiagt r2!, {s8-s11}
- vldmiagt r1!, {s4-s7}
- vldmiagt r2!, {s12-s15}
- ittt ge
- vmulge.f32 s8, s0, s8
- vstmiage r0!, {s24-s27}
- vstmiage r0!, {s28-s31}
- bgt 1b
-
- bic r12, r12, #(7 << 16) /* set vector size back to 1 */
- fmxr fpscr, r12
- vpop {d8-d15}
- bx lr
-endfunc
-
-/**
* ARM VFP optimized implementation of 'vector_fmul_reverse_c' function.
* Assume that len is a positive number and is multiple of 8
*/
diff --git a/gst-libs/ext/libav/libavcodec/arm/fft_fixed_init_arm.c b/gst-libs/ext/libav/libavcodec/arm/fft_fixed_init_arm.c
index be412cd..50532f2 100644
--- a/gst-libs/ext/libav/libavcodec/arm/fft_fixed_init_arm.c
+++ b/gst-libs/ext/libav/libavcodec/arm/fft_fixed_init_arm.c
@@ -18,6 +18,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "libavutil/arm/cpu.h"
+
#define CONFIG_FFT_FLOAT 0
#include "libavcodec/fft.h"
@@ -27,12 +29,14 @@ void ff_mdct_fixed_calcw_neon(FFTContext *s, FFTDouble *o, const FFTSample *i);
av_cold void ff_fft_fixed_init_arm(FFTContext *s)
{
- if (HAVE_NEON) {
+ int cpu_flags = av_get_cpu_flags();
+
+ if (have_neon(cpu_flags)) {
s->fft_permutation = FF_FFT_PERM_SWAP_LSBS;
s->fft_calc = ff_fft_fixed_calc_neon;
#if CONFIG_MDCT
- if (!s->inverse && s->mdct_bits >= 5) {
+ if (!s->inverse && s->nbits >= 3) {
s->mdct_permutation = FF_MDCT_PERM_INTERLEAVE;
s->mdct_calc = ff_mdct_fixed_calc_neon;
s->mdct_calcw = ff_mdct_fixed_calcw_neon;
diff --git a/gst-libs/ext/libav/libavcodec/arm/fft_fixed_neon.S b/gst-libs/ext/libav/libavcodec/arm/fft_fixed_neon.S
index 0508088..faddc00 100644
--- a/gst-libs/ext/libav/libavcodec/arm/fft_fixed_neon.S
+++ b/gst-libs/ext/libav/libavcodec/arm/fft_fixed_neon.S
@@ -18,7 +18,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "asm.S"
+#include "libavutil/arm/asm.S"
.macro bflies d0, d1, r0, r1
vrev64.32 \r0, \d1 @ t5, t6, t1, t2
@@ -214,7 +214,7 @@ function fft\n\()_neon
bl fft\n4\()_neon
mov r0, r4
pop {r4, lr}
- movrel r1, X(ff_cos_\n\()_fixed)
+ movrelx r1, X(ff_cos_\n\()_fixed)
mov r2, #\n4/2
b fft_pass_neon
endfunc
diff --git a/gst-libs/ext/libav/libavcodec/arm/fft_init_arm.c b/gst-libs/ext/libav/libavcodec/arm/fft_init_arm.c
index b2c3b72..9ec620f 100644
--- a/gst-libs/ext/libav/libavcodec/arm/fft_init_arm.c
+++ b/gst-libs/ext/libav/libavcodec/arm/fft_init_arm.c
@@ -18,6 +18,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "libavutil/arm/cpu.h"
#include "libavcodec/fft.h"
#include "libavcodec/rdft.h"
#include "libavcodec/synth_filter.h"
@@ -39,7 +40,9 @@ void ff_synth_filter_float_neon(FFTContext *imdct,
av_cold void ff_fft_init_arm(FFTContext *s)
{
- if (HAVE_NEON) {
+ int cpu_flags = av_get_cpu_flags();
+
+ if (have_neon(cpu_flags)) {
s->fft_permute = ff_fft_permute_neon;
s->fft_calc = ff_fft_calc_neon;
#if CONFIG_MDCT
@@ -54,7 +57,9 @@ av_cold void ff_fft_init_arm(FFTContext *s)
#if CONFIG_RDFT
av_cold void ff_rdft_init_arm(RDFTContext *s)
{
- if (HAVE_NEON)
+ int cpu_flags = av_get_cpu_flags();
+
+ if (have_neon(cpu_flags))
s->rdft_calc = ff_rdft_calc_neon;
}
#endif
@@ -62,7 +67,9 @@ av_cold void ff_rdft_init_arm(RDFTContext *s)
#if CONFIG_DCA_DECODER
av_cold void ff_synth_filter_init_arm(SynthFilterContext *s)
{
- if (HAVE_NEON)
+ int cpu_flags = av_get_cpu_flags();
+
+ if (have_neon(cpu_flags))
s->synth_filter_float = ff_synth_filter_float_neon;
}
#endif
diff --git a/gst-libs/ext/libav/libavcodec/arm/fft_neon.S b/gst-libs/ext/libav/libavcodec/arm/fft_neon.S
index a458985..c4d8918 100644
--- a/gst-libs/ext/libav/libavcodec/arm/fft_neon.S
+++ b/gst-libs/ext/libav/libavcodec/arm/fft_neon.S
@@ -24,7 +24,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "asm.S"
+#include "libavutil/arm/asm.S"
#define M_SQRT1_2 0.70710678118654752440
@@ -143,7 +143,7 @@ function fft16_neon
vswp d29, d30 @ q14{r12,i12,i14,r15} q15{r13,i13,i15,r14}
vadd.f32 q0, q12, q13 @ {t1,t2,t5,t6}
vadd.f32 q1, q14, q15 @ {t1a,t2a,t5a,t6a}
- movrel r2, X(ff_cos_16)
+ movrelx r2, X(ff_cos_16)
vsub.f32 q13, q12, q13 @ {t3,t4,t7,t8}
vrev64.32 d1, d1
vsub.f32 q15, q14, q15 @ {t3a,t4a,t7a,t8a}
@@ -290,7 +290,7 @@ function fft\n\()_neon
bl fft\n4\()_neon
mov r0, r4
pop {r4, lr}
- movrel r1, X(ff_cos_\n)
+ movrelx r1, X(ff_cos_\n)
mov r2, #\n4/2
b fft_pass_neon
endfunc
diff --git a/gst-libs/ext/libav/libavcodec/arm/flacdsp_arm.S b/gst-libs/ext/libav/libavcodec/arm/flacdsp_arm.S
new file mode 100644
index 0000000..d4441da
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/arm/flacdsp_arm.S
@@ -0,0 +1,146 @@
+/*
+ * Copyright (c) 2012 Mans Rullgard <mans@mansr.com>
+ *
+ * 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
+ */
+
+#include "libavutil/arm/asm.S"
+
+function flac_lpc_16_1_arm
+ ldr r12, [sp]
+ push {r4, lr}
+ ldr r1, [r1]
+ subs r12, r12, #2
+ ldr lr, [r0], #4
+ beq 2f
+ it lt
+ poplt {r4, pc}
+1:
+ mul r4, lr, r1
+ ldm r0, {r2, lr}
+ add_sh r2, r2, r4, asr r3
+ mul r4, r2, r1
+ subs r12, r12, #2
+ add_sh lr, lr, r4, asr r3
+ stm r0!, {r2, lr}
+ bgt 1b
+ it lt
+ poplt {r4, pc}
+2:
+ mul r4, lr, r1
+ ldr r2, [r0]
+ add_sh r2, r2, r4, asr r3
+ str r2, [r0]
+ pop {r4, pc}
+endfunc
+
+function flac_lpc_16_2_arm
+ ldr r12, [sp]
+ subs r12, r12, r2
+ it le
+ bxle lr
+
+ push {r4-r9, lr}
+ ldm r0!, {r6, r7}
+ ldm r1, {r8, r9}
+ subs r12, r12, #1
+ beq 2f
+1:
+ mul r4, r6, r8
+ mul r5, r7, r8
+ mla r4, r7, r9, r4
+ ldm r0, {r6, r7}
+ add_sh r6, r6, r4, asr r3
+ mla r5, r6, r9, r5
+ add_sh r7, r7, r5, asr r3
+ stm r0!, {r6, r7}
+ subs r12, r12, #2
+ bgt 1b
+ it lt
+ poplt {r4-r9, pc}
+2:
+ mul r4, r6, r8
+ mla r4, r7, r9, r4
+ ldr r5, [r0]
+ add_sh r5, r5, r4, asr r3
+ str r5, [r0]
+ pop {r4-r9, pc}
+endfunc
+
+function ff_flac_lpc_16_arm, export=1
+ cmp r2, #2
+ blt flac_lpc_16_1_arm
+ beq flac_lpc_16_2_arm
+
+ ldr r12, [sp]
+ subs r12, r12, r2
+ it le
+ bxle lr
+
+ push {r4-r9, lr}
+
+ subs r12, r12, #1
+ beq 3f
+1:
+ sub lr, r2, #2
+ mov r4, #0
+ mov r5, #0
+
+ ldr r7, [r0], #4
+ ldr r9, [r1], #4
+2:
+ mla r4, r7, r9, r4
+ ldm r0!, {r6, r7}
+ mla r5, r6, r9, r5
+ ldm r1!, {r8, r9}
+ mla r4, r6, r8, r4
+ subs lr, lr, #2
+ mla r5, r7, r8, r5
+ bgt 2b
+ blt 6f
+
+ mla r4, r7, r9, r4
+ ldr r7, [r0], #4
+ mla r5, r7, r9, r5
+ ldr r9, [r1], #4
+6:
+ mla r4, r7, r9, r4
+ ldm r0, {r6, r7}
+ add_sh r6, r6, r4, asr r3
+ mla r5, r6, r9, r5
+ add_sh r7, r7, r5, asr r3
+ stm r0!, {r6, r7}
+ sub r0, r0, r2, lsl #2
+ sub r1, r1, r2, lsl #2
+
+ subs r12, r12, #2
+ bgt 1b
+ it lt
+ poplt {r4-r9, pc}
+3:
+ mov r4, #0
+4:
+ ldr r5, [r1], #4
+ ldr r6, [r0], #4
+ mla r4, r5, r6, r4
+ subs r2, r2, #1
+ bgt 4b
+ ldr r5, [r0]
+ add_sh r5, r5, r4, asr r3
+ str r5, [r0]
+ pop {r4-r9, pc}
+endfunc
diff --git a/gst-libs/ext/libav/libavcodec/arm/flacdsp_init_arm.c b/gst-libs/ext/libav/libavcodec/arm/flacdsp_init_arm.c
new file mode 100644
index 0000000..0530cf7
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/arm/flacdsp_init_arm.c
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2012 Mans Rullgard <mans@mansr.com>
+ *
+ * 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
+ */
+
+#include "libavcodec/flacdsp.h"
+#include "config.h"
+
+void ff_flac_lpc_16_arm(int32_t *samples, const int coeffs[32], int order,
+ int qlevel, int len);
+
+av_cold void ff_flacdsp_init_arm(FLACDSPContext *c, enum AVSampleFormat fmt,
+ int bps)
+{
+ if (bps <= 16)
+ c->lpc = ff_flac_lpc_16_arm;
+}
diff --git a/gst-libs/ext/libav/libavcodec/arm/fmtconvert_init_arm.c b/gst-libs/ext/libav/libavcodec/arm/fmtconvert_init_arm.c
index 92e07f1..9435263 100644
--- a/gst-libs/ext/libav/libavcodec/arm/fmtconvert_init_arm.c
+++ b/gst-libs/ext/libav/libavcodec/arm/fmtconvert_init_arm.c
@@ -20,6 +20,7 @@
#include <stdint.h>
+#include "libavutil/arm/cpu.h"
#include "libavcodec/avcodec.h"
#include "libavcodec/fmtconvert.h"
@@ -33,11 +34,13 @@ void ff_float_to_int16_vfp(int16_t *dst, const float *src, long len);
void ff_fmt_convert_init_arm(FmtConvertContext *c, AVCodecContext *avctx)
{
- if (HAVE_ARMVFP && HAVE_ARMV6) {
+ int cpu_flags = av_get_cpu_flags();
+
+ if (have_vfp(cpu_flags) && have_armv6(cpu_flags)) {
c->float_to_int16 = ff_float_to_int16_vfp;
}
- if (HAVE_NEON) {
+ if (have_neon(cpu_flags)) {
c->int32_to_float_fmul_scalar = ff_int32_to_float_fmul_scalar_neon;
if (!(avctx->flags & CODEC_FLAG_BITEXACT)) {
diff --git a/gst-libs/ext/libav/libavcodec/arm/fmtconvert_neon.S b/gst-libs/ext/libav/libavcodec/arm/fmtconvert_neon.S
index ad1c15d..41a095a 100644
--- a/gst-libs/ext/libav/libavcodec/arm/fmtconvert_neon.S
+++ b/gst-libs/ext/libav/libavcodec/arm/fmtconvert_neon.S
@@ -20,9 +20,7 @@
*/
#include "config.h"
-#include "asm.S"
-
- preserve8
+#include "libavutil/arm/asm.S"
function ff_float_to_int16_neon, export=1
subs r2, r2, #8
diff --git a/gst-libs/ext/libav/libavcodec/arm/fmtconvert_vfp.S b/gst-libs/ext/libav/libavcodec/arm/fmtconvert_vfp.S
index f7b0e3d..fb12de1 100644
--- a/gst-libs/ext/libav/libavcodec/arm/fmtconvert_vfp.S
+++ b/gst-libs/ext/libav/libavcodec/arm/fmtconvert_vfp.S
@@ -19,13 +19,13 @@
*/
#include "config.h"
-#include "asm.S"
+#include "libavutil/arm/asm.S"
/**
* ARM VFP optimized float to int16 conversion.
* Assume that len is a positive number and is multiple of 8, destination
* buffer is at least 4 bytes aligned (8 bytes alignment is better for
- * performance), little endian byte sex
+ * performance), little-endian byte sex.
*/
@ void ff_float_to_int16_vfp(int16_t *dst, const float *src, int len)
function ff_float_to_int16_vfp, export=1
diff --git a/gst-libs/ext/libav/libavcodec/arm/h264cmc_neon.S b/gst-libs/ext/libav/libavcodec/arm/h264cmc_neon.S
index a6feadd..3427e36 100644
--- a/gst-libs/ext/libav/libavcodec/arm/h264cmc_neon.S
+++ b/gst-libs/ext/libav/libavcodec/arm/h264cmc_neon.S
@@ -18,13 +18,13 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "asm.S"
+#include "libavutil/arm/asm.S"
/* chroma_mc8(uint8_t *dst, uint8_t *src, int stride, int h, int x, int y) */
.macro h264_chroma_mc8 type, codec=h264
function ff_\type\()_\codec\()_chroma_mc8_neon, export=1
push {r4-r7, lr}
- ldrd r4, [sp, #20]
+ ldrd r4, r5, [sp, #20]
.ifc \type,avg
mov lr, r0
.endif
@@ -51,24 +51,20 @@ T cmp r7, #0
beq 2f
- add r5, r1, r2
-
vdup.8 d0, r4
- lsl r4, r2, #1
vdup.8 d1, r12
- vld1.8 {d4, d5}, [r1], r4
+ vld1.8 {d4, d5}, [r1], r2
vdup.8 d2, r6
- vld1.8 {d6, d7}, [r5], r4
vdup.8 d3, r7
-
vext.8 d5, d4, d5, #1
- vext.8 d7, d6, d7, #1
-1: pld [r5]
+1: vld1.8 {d6, d7}, [r1], r2
vmull.u8 q8, d4, d0
vmlal.u8 q8, d5, d1
- vld1.8 {d4, d5}, [r1], r4
+ vext.8 d7, d6, d7, #1
+ vld1.8 {d4, d5}, [r1], r2
vmlal.u8 q8, d6, d2
+ pld [r1]
vext.8 d5, d4, d5, #1
vmlal.u8 q8, d7, d3
vmull.u8 q9, d6, d0
@@ -76,8 +72,7 @@ T cmp r7, #0
vmlal.u8 q9, d7, d1
vmlal.u8 q9, d4, d2
vmlal.u8 q9, d5, d3
- vld1.8 {d6, d7}, [r5], r4
- pld [r1]
+ pld [r1, r2]
.ifc \codec,h264
vrshrn.u16 d16, q8, #6
vrshrn.u16 d17, q9, #6
@@ -92,7 +87,6 @@ T cmp r7, #0
vld1.8 {d21}, [lr,:64], r2
vrhadd.u8 q8, q8, q10
.endif
- vext.8 d7, d6, d7, #1
vst1.8 {d16}, [r0,:64], r2
vst1.8 {d17}, [r0,:64], r2
bgt 1b
@@ -106,18 +100,15 @@ T cmp r7, #0
beq 4f
- add r5, r1, r2
- lsl r4, r2, #1
- vld1.8 {d4}, [r1], r4
- vld1.8 {d6}, [r5], r4
+ vld1.8 {d4}, [r1], r2
-3: pld [r5]
+3: vld1.8 {d6}, [r1], r2
vmull.u8 q8, d4, d0
vmlal.u8 q8, d6, d1
- vld1.8 {d4}, [r1], r4
+ vld1.8 {d4}, [r1], r2
vmull.u8 q9, d6, d0
vmlal.u8 q9, d4, d1
- vld1.8 {d6}, [r5], r4
+ pld [r1]
.ifc \codec,h264
vrshrn.u16 d16, q8, #6
vrshrn.u16 d17, q9, #6
@@ -127,13 +118,13 @@ T cmp r7, #0
vshrn.u16 d16, q8, #6
vshrn.u16 d17, q9, #6
.endif
+ pld [r1, r2]
.ifc \type,avg
vld1.8 {d20}, [lr,:64], r2
vld1.8 {d21}, [lr,:64], r2
vrhadd.u8 q8, q8, q10
.endif
subs r3, r3, #2
- pld [r1]
vst1.8 {d16}, [r0,:64], r2
vst1.8 {d17}, [r0,:64], r2
bgt 3b
@@ -144,16 +135,13 @@ T cmp r7, #0
vld1.8 {d6, d7}, [r1], r2
vext.8 d5, d4, d5, #1
vext.8 d7, d6, d7, #1
-
-5: pld [r1]
+ pld [r1]
subs r3, r3, #2
vmull.u8 q8, d4, d0
vmlal.u8 q8, d5, d1
- vld1.8 {d4, d5}, [r1], r2
vmull.u8 q9, d6, d0
vmlal.u8 q9, d7, d1
- pld [r1]
- vext.8 d5, d4, d5, #1
+ pld [r1, r2]
.ifc \codec,h264
vrshrn.u16 d16, q8, #6
vrshrn.u16 d17, q9, #6
@@ -168,11 +156,9 @@ T cmp r7, #0
vld1.8 {d21}, [lr,:64], r2
vrhadd.u8 q8, q8, q10
.endif
- vld1.8 {d6, d7}, [r1], r2
- vext.8 d7, d6, d7, #1
vst1.8 {d16}, [r0,:64], r2
vst1.8 {d17}, [r0,:64], r2
- bgt 5b
+ bgt 4b
pop {r4-r7, pc}
endfunc
@@ -182,7 +168,7 @@ endfunc
.macro h264_chroma_mc4 type, codec=h264
function ff_\type\()_\codec\()_chroma_mc4_neon, export=1
push {r4-r7, lr}
- ldrd r4, [sp, #20]
+ ldrd r4, r5, [sp, #20]
.ifc \type,avg
mov lr, r0
.endif
@@ -209,33 +195,29 @@ T cmp r7, #0
beq 2f
- add r5, r1, r2
-
vdup.8 d0, r4
- lsl r4, r2, #1
vdup.8 d1, r12
- vld1.8 {d4}, [r1], r4
+ vld1.8 {d4}, [r1], r2
vdup.8 d2, r6
- vld1.8 {d6}, [r5], r4
vdup.8 d3, r7
vext.8 d5, d4, d5, #1
- vext.8 d7, d6, d7, #1
vtrn.32 d4, d5
- vtrn.32 d6, d7
vtrn.32 d0, d1
vtrn.32 d2, d3
-1: pld [r5]
+1: vld1.8 {d6}, [r1], r2
+ vext.8 d7, d6, d7, #1
+ vtrn.32 d6, d7
vmull.u8 q8, d4, d0
vmlal.u8 q8, d6, d2
- vld1.8 {d4}, [r1], r4
+ vld1.8 {d4}, [r1], r2
vext.8 d5, d4, d5, #1
vtrn.32 d4, d5
+ pld [r1]
vmull.u8 q9, d6, d0
vmlal.u8 q9, d4, d2
- vld1.8 {d6}, [r5], r4
vadd.i16 d16, d16, d17
vadd.i16 d17, d18, d19
.ifc \codec,h264
@@ -245,14 +227,12 @@ T cmp r7, #0
vshrn.u16 d16, q8, #6
.endif
subs r3, r3, #2
- pld [r1]
+ pld [r1, r2]
.ifc \type,avg
vld1.32 {d20[0]}, [lr,:32], r2
vld1.32 {d20[1]}, [lr,:32], r2
vrhadd.u8 d16, d16, d20
.endif
- vext.8 d7, d6, d7, #1
- vtrn.32 d6, d7
vst1.32 {d16[0]}, [r0,:32], r2
vst1.32 {d16[1]}, [r0,:32], r2
bgt 1b
@@ -268,18 +248,15 @@ T cmp r7, #0
beq 4f
vext.32 d1, d0, d1, #1
- add r5, r1, r2
- lsl r4, r2, #1
- vld1.32 {d4[0]}, [r1], r4
- vld1.32 {d4[1]}, [r5], r4
+ vld1.32 {d4[0]}, [r1], r2
-3: pld [r5]
+3: vld1.32 {d4[1]}, [r1], r2
vmull.u8 q8, d4, d0
- vld1.32 {d4[0]}, [r1], r4
+ vld1.32 {d4[0]}, [r1], r2
vmull.u8 q9, d4, d1
- vld1.32 {d4[1]}, [r5], r4
vadd.i16 d16, d16, d17
vadd.i16 d17, d18, d19
+ pld [r1]
.ifc \codec,h264
vrshrn.u16 d16, q8, #6
.else
@@ -292,7 +269,7 @@ T cmp r7, #0
vrhadd.u8 d16, d16, d20
.endif
subs r3, r3, #2
- pld [r1]
+ pld [r1, r2]
vst1.32 {d16[0]}, [r0,:32], r2
vst1.32 {d16[1]}, [r0,:32], r2
bgt 3b
@@ -305,13 +282,9 @@ T cmp r7, #0
vext.8 d7, d6, d7, #1
vtrn.32 d4, d5
vtrn.32 d6, d7
-
-5: vmull.u8 q8, d4, d0
+ vmull.u8 q8, d4, d0
vmull.u8 q9, d6, d0
subs r3, r3, #2
- vld1.8 {d4}, [r1], r2
- vext.8 d5, d4, d5, #1
- vtrn.32 d4, d5
vadd.i16 d16, d16, d17
vadd.i16 d17, d18, d19
pld [r1]
@@ -326,13 +299,10 @@ T cmp r7, #0
vld1.32 {d20[1]}, [lr,:32], r2
vrhadd.u8 d16, d16, d20
.endif
- vld1.8 {d6}, [r1], r2
- vext.8 d7, d6, d7, #1
- vtrn.32 d6, d7
pld [r1]
vst1.32 {d16[0]}, [r0,:32], r2
vst1.32 {d16[1]}, [r0,:32], r2
- bgt 5b
+ bgt 4b
pop {r4-r7, pc}
endfunc
diff --git a/gst-libs/ext/libav/libavcodec/arm/h264dsp_init_arm.c b/gst-libs/ext/libav/libavcodec/arm/h264dsp_init_arm.c
index 1c331a4..b4277a5 100644
--- a/gst-libs/ext/libav/libavcodec/arm/h264dsp_init_arm.c
+++ b/gst-libs/ext/libav/libavcodec/arm/h264dsp_init_arm.c
@@ -20,6 +20,7 @@
#include <stdint.h>
+#include "libavutil/arm/cpu.h"
#include "libavcodec/dsputil.h"
#include "libavcodec/h264dsp.h"
@@ -97,5 +98,8 @@ static void ff_h264dsp_init_neon(H264DSPContext *c, const int bit_depth, const i
void ff_h264dsp_init_arm(H264DSPContext *c, const int bit_depth, const int chroma_format_idc)
{
- if (HAVE_NEON) ff_h264dsp_init_neon(c, bit_depth, chroma_format_idc);
+ int cpu_flags = av_get_cpu_flags();
+
+ if (have_neon(cpu_flags))
+ ff_h264dsp_init_neon(c, bit_depth, chroma_format_idc);
}
diff --git a/gst-libs/ext/libav/libavcodec/arm/h264dsp_neon.S b/gst-libs/ext/libav/libavcodec/arm/h264dsp_neon.S
index a4abf66..9daabe0 100644
--- a/gst-libs/ext/libav/libavcodec/arm/h264dsp_neon.S
+++ b/gst-libs/ext/libav/libavcodec/arm/h264dsp_neon.S
@@ -18,7 +18,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "asm.S"
+#include "libavutil/arm/asm.S"
#include "neon.S"
/* H.264 loop filter */
@@ -886,7 +886,7 @@ T mov sp, r0
mov r12, #8
vpush {d8-d15}
bl put_h264_qpel8_h_lowpass_neon
- ldrd r0, [r11], #8
+ ldrd r0, r1, [r11], #8
mov r3, r2
add r12, sp, #64
sub r1, r1, r2, lsl #1
@@ -913,7 +913,7 @@ T mov sp, r0
vpush {d8-d15}
bl put_h264_qpel8_h_lowpass_neon
mov r4, r0
- ldrd r0, [r11], #8
+ ldrd r0, r1, [r11], #8
sub r1, r1, r2, lsl #1
sub r1, r1, #2
mov r3, r2
@@ -958,7 +958,7 @@ T mov sp, r0
vpush {d8-d15}
bl put_h264_qpel8_v_lowpass_neon
mov r4, r0
- ldrd r0, [r11], #8
+ ldrd r0, r1, [r11], #8
sub r1, r1, r3, lsl #1
sub r1, r1, #2
sub r2, r4, #64
@@ -1071,7 +1071,7 @@ T mov sp, r0
mov r3, #16
vpush {d8-d15}
bl put_h264_qpel16_h_lowpass_neon
- ldrd r0, [r11], #8
+ ldrd r0, r1, [r11], #8
mov r3, r2
add r12, sp, #64
sub r1, r1, r2, lsl #1
@@ -1096,7 +1096,7 @@ T mov sp, r0
vpush {d8-d15}
bl put_h264_qpel16_h_lowpass_neon_packed
mov r4, r0
- ldrd r0, [r11], #8
+ ldrd r0, r1, [r11], #8
sub r1, r1, r2, lsl #1
sub r1, r1, #2
mov r3, r2
@@ -1139,7 +1139,7 @@ T mov sp, r0
vpush {d8-d15}
bl put_h264_qpel16_v_lowpass_neon_packed
mov r4, r0
- ldrd r0, [r11], #8
+ ldrd r0, r1, [r11], #8
sub r1, r1, r3, lsl #1
sub r1, r1, #2
mov r2, r3
diff --git a/gst-libs/ext/libav/libavcodec/arm/h264idct_neon.S b/gst-libs/ext/libav/libavcodec/arm/h264idct_neon.S
index edb2ae5..b23ddb1 100644
--- a/gst-libs/ext/libav/libavcodec/arm/h264idct_neon.S
+++ b/gst-libs/ext/libav/libavcodec/arm/h264idct_neon.S
@@ -18,9 +18,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "asm.S"
-
- preserve8
+#include "libavutil/arm/asm.S"
function ff_h264_idct_add_neon, export=1
vld1.64 {d0-d3}, [r1,:128]
diff --git a/gst-libs/ext/libav/libavcodec/arm/h264pred_init_arm.c b/gst-libs/ext/libav/libavcodec/arm/h264pred_init_arm.c
index 5fc07bc..39c0121 100644
--- a/gst-libs/ext/libav/libavcodec/arm/h264pred_init_arm.c
+++ b/gst-libs/ext/libav/libavcodec/arm/h264pred_init_arm.c
@@ -20,27 +20,28 @@
#include <stdint.h>
+#include "libavutil/arm/cpu.h"
#include "libavcodec/h264pred.h"
-void ff_pred16x16_vert_neon(uint8_t *src, int stride);
-void ff_pred16x16_hor_neon(uint8_t *src, int stride);
-void ff_pred16x16_plane_neon(uint8_t *src, int stride);
-void ff_pred16x16_dc_neon(uint8_t *src, int stride);
-void ff_pred16x16_128_dc_neon(uint8_t *src, int stride);
-void ff_pred16x16_left_dc_neon(uint8_t *src, int stride);
-void ff_pred16x16_top_dc_neon(uint8_t *src, int stride);
+void ff_pred16x16_vert_neon(uint8_t *src, ptrdiff_t stride);
+void ff_pred16x16_hor_neon(uint8_t *src, ptrdiff_t stride);
+void ff_pred16x16_plane_neon(uint8_t *src, ptrdiff_t stride);
+void ff_pred16x16_dc_neon(uint8_t *src, ptrdiff_t stride);
+void ff_pred16x16_128_dc_neon(uint8_t *src, ptrdiff_t stride);
+void ff_pred16x16_left_dc_neon(uint8_t *src, ptrdiff_t stride);
+void ff_pred16x16_top_dc_neon(uint8_t *src, ptrdiff_t stride);
-void ff_pred8x8_vert_neon(uint8_t *src, int stride);
-void ff_pred8x8_hor_neon(uint8_t *src, int stride);
-void ff_pred8x8_plane_neon(uint8_t *src, int stride);
-void ff_pred8x8_dc_neon(uint8_t *src, int stride);
-void ff_pred8x8_128_dc_neon(uint8_t *src, int stride);
-void ff_pred8x8_left_dc_neon(uint8_t *src, int stride);
-void ff_pred8x8_top_dc_neon(uint8_t *src, int stride);
-void ff_pred8x8_l0t_dc_neon(uint8_t *src, int stride);
-void ff_pred8x8_0lt_dc_neon(uint8_t *src, int stride);
-void ff_pred8x8_l00_dc_neon(uint8_t *src, int stride);
-void ff_pred8x8_0l0_dc_neon(uint8_t *src, int stride);
+void ff_pred8x8_vert_neon(uint8_t *src, ptrdiff_t stride);
+void ff_pred8x8_hor_neon(uint8_t *src, ptrdiff_t stride);
+void ff_pred8x8_plane_neon(uint8_t *src, ptrdiff_t stride);
+void ff_pred8x8_dc_neon(uint8_t *src, ptrdiff_t stride);
+void ff_pred8x8_128_dc_neon(uint8_t *src, ptrdiff_t stride);
+void ff_pred8x8_left_dc_neon(uint8_t *src, ptrdiff_t stride);
+void ff_pred8x8_top_dc_neon(uint8_t *src, ptrdiff_t stride);
+void ff_pred8x8_l0t_dc_neon(uint8_t *src, ptrdiff_t stride);
+void ff_pred8x8_0lt_dc_neon(uint8_t *src, ptrdiff_t stride);
+void ff_pred8x8_l00_dc_neon(uint8_t *src, ptrdiff_t stride);
+void ff_pred8x8_0l0_dc_neon(uint8_t *src, ptrdiff_t stride);
static void ff_h264_pred_init_neon(H264PredContext *h, int codec_id, const int bit_depth, const int chroma_format_idc)
{
@@ -51,10 +52,10 @@ static void ff_h264_pred_init_neon(H264PredContext *h, int codec_id, const int b
h->pred8x8[VERT_PRED8x8 ] = ff_pred8x8_vert_neon;
h->pred8x8[HOR_PRED8x8 ] = ff_pred8x8_hor_neon;
- if (codec_id != CODEC_ID_VP8)
+ if (codec_id != AV_CODEC_ID_VP8)
h->pred8x8[PLANE_PRED8x8] = ff_pred8x8_plane_neon;
h->pred8x8[DC_128_PRED8x8 ] = ff_pred8x8_128_dc_neon;
- if (codec_id != CODEC_ID_RV40 && codec_id != CODEC_ID_VP8) {
+ if (codec_id != AV_CODEC_ID_RV40 && codec_id != AV_CODEC_ID_VP8) {
h->pred8x8[DC_PRED8x8 ] = ff_pred8x8_dc_neon;
h->pred8x8[LEFT_DC_PRED8x8] = ff_pred8x8_left_dc_neon;
h->pred8x8[TOP_DC_PRED8x8 ] = ff_pred8x8_top_dc_neon;
@@ -70,11 +71,14 @@ static void ff_h264_pred_init_neon(H264PredContext *h, int codec_id, const int b
h->pred16x16[LEFT_DC_PRED8x8] = ff_pred16x16_left_dc_neon;
h->pred16x16[TOP_DC_PRED8x8 ] = ff_pred16x16_top_dc_neon;
h->pred16x16[DC_128_PRED8x8 ] = ff_pred16x16_128_dc_neon;
- if (codec_id != CODEC_ID_SVQ3 && codec_id != CODEC_ID_RV40 && codec_id != CODEC_ID_VP8)
+ if (codec_id != AV_CODEC_ID_SVQ3 && codec_id != AV_CODEC_ID_RV40 && codec_id != AV_CODEC_ID_VP8)
h->pred16x16[PLANE_PRED8x8 ] = ff_pred16x16_plane_neon;
}
void ff_h264_pred_init_arm(H264PredContext *h, int codec_id, int bit_depth, const int chroma_format_idc)
{
- if (HAVE_NEON) ff_h264_pred_init_neon(h, codec_id, bit_depth, chroma_format_idc);
+ int cpu_flags = av_get_cpu_flags();
+
+ if (have_neon(cpu_flags))
+ ff_h264_pred_init_neon(h, codec_id, bit_depth, chroma_format_idc);
}
diff --git a/gst-libs/ext/libav/libavcodec/arm/h264pred_neon.S b/gst-libs/ext/libav/libavcodec/arm/h264pred_neon.S
index 815b67b..332f94b 100644
--- a/gst-libs/ext/libav/libavcodec/arm/h264pred_neon.S
+++ b/gst-libs/ext/libav/libavcodec/arm/h264pred_neon.S
@@ -18,7 +18,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "asm.S"
+#include "libavutil/arm/asm.S"
.macro ldcol.8 rd, rs, rt, n=8, hi=0
.if \n == 8 || \hi == 0
diff --git a/gst-libs/ext/libav/libavcodec/arm/int_neon.S b/gst-libs/ext/libav/libavcodec/arm/int_neon.S
index 8bb58af..04208c2 100644
--- a/gst-libs/ext/libav/libavcodec/arm/int_neon.S
+++ b/gst-libs/ext/libav/libavcodec/arm/int_neon.S
@@ -19,9 +19,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "asm.S"
+#include "libavutil/arm/asm.S"
- preserve8
.fpu neon
function ff_scalarproduct_int16_neon, export=1
@@ -29,32 +28,8 @@ function ff_scalarproduct_int16_neon, export=1
vmov.i16 q1, #0
vmov.i16 q2, #0
vmov.i16 q3, #0
- negs r3, r3
- beq 2f
-
- vdup.s32 q12, r3
1: vld1.16 {d16-d17}, [r0]!
vld1.16 {d20-d21}, [r1,:128]!
- vmull.s16 q12, d16, d20
- vld1.16 {d18-d19}, [r0]!
- vmull.s16 q13, d17, d21
- vld1.16 {d22-d23}, [r1,:128]!
- vmull.s16 q14, d18, d22
- vmull.s16 q15, d19, d23
- vshl.s32 q8, q12, q12
- vshl.s32 q9, q13, q12
- vadd.s32 q0, q0, q8
- vshl.s32 q10, q14, q12
- vadd.s32 q1, q1, q9
- vshl.s32 q11, q15, q12
- vadd.s32 q2, q2, q10
- vadd.s32 q3, q3, q11
- subs r2, r2, #16
- bne 1b
- b 3f
-
-2: vld1.16 {d16-d17}, [r0]!
- vld1.16 {d20-d21}, [r1,:128]!
vmlal.s16 q0, d16, d20
vld1.16 {d18-d19}, [r0]!
vmlal.s16 q1, d17, d21
@@ -62,9 +37,9 @@ function ff_scalarproduct_int16_neon, export=1
vmlal.s16 q2, d18, d22
vmlal.s16 q3, d19, d23
subs r2, r2, #16
- bne 2b
+ bne 1b
-3: vpadd.s32 d16, d0, d1
+ vpadd.s32 d16, d0, d1
vpadd.s32 d17, d2, d3
vpadd.s32 d10, d4, d5
vpadd.s32 d11, d6, d7
diff --git a/gst-libs/ext/libav/libavcodec/arm/jrevdct_arm.S b/gst-libs/ext/libav/libavcodec/arm/jrevdct_arm.S
index 93cbbbe..331ad85 100644
--- a/gst-libs/ext/libav/libavcodec/arm/jrevdct_arm.S
+++ b/gst-libs/ext/libav/libavcodec/arm/jrevdct_arm.S
@@ -25,7 +25,7 @@
*/
-#include "asm.S"
+#include "libavutil/arm/asm.S"
#define FIX_0_298631336 2446
#define FIX_0_541196100 4433
diff --git a/gst-libs/ext/libav/libavcodec/arm/mathops.h b/gst-libs/ext/libav/libavcodec/arm/mathops.h
index 3803fcd..45ac67d 100644
--- a/gst-libs/ext/libav/libavcodec/arm/mathops.h
+++ b/gst-libs/ext/libav/libavcodec/arm/mathops.h
@@ -28,7 +28,7 @@
#if HAVE_INLINE_ASM
-#if HAVE_ARMV6
+#if HAVE_ARMV6_INLINE
#define MULH MULH
static inline av_const int MULH(int a, int b)
{
@@ -36,11 +36,35 @@ static inline av_const int MULH(int a, int b)
__asm__ ("smmul %0, %1, %2" : "=r"(r) : "r"(a), "r"(b));
return r;
}
+
+#define FASTDIV FASTDIV
+static av_always_inline av_const int FASTDIV(int a, int b)
+{
+ int r;
+ __asm__ ("cmp %2, #2 \n\t"
+ "ldr %0, [%3, %2, lsl #2] \n\t"
+ "ite le \n\t"
+ "lsrle %0, %1, #1 \n\t"
+ "smmulgt %0, %0, %1 \n\t"
+ : "=&r"(r) : "r"(a), "r"(b), "r"(ff_inverse) : "cc");
+ return r;
+}
+
+#else /* HAVE_ARMV6_INLINE */
+
+#define FASTDIV FASTDIV
+static av_always_inline av_const int FASTDIV(int a, int b)
+{
+ int r, t;
+ __asm__ ("umull %1, %0, %2, %3"
+ : "=&r"(r), "=&r"(t) : "r"(a), "r"(ff_inverse[b]));
+ return r;
+}
#endif
#define MLS64(d, a, b) MAC64(d, -(a), b)
-#if HAVE_ARMV5TE
+#if HAVE_ARMV5TE_INLINE
/* signed 16x16 -> 32 multiply add accumulate */
# define MAC16(rt, ra, rb) \
diff --git a/gst-libs/ext/libav/libavcodec/arm/mdct_fixed_neon.S b/gst-libs/ext/libav/libavcodec/arm/mdct_fixed_neon.S
index d219216..c77be59 100644
--- a/gst-libs/ext/libav/libavcodec/arm/mdct_fixed_neon.S
+++ b/gst-libs/ext/libav/libavcodec/arm/mdct_fixed_neon.S
@@ -18,9 +18,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "asm.S"
-
- preserve8
+#include "libavutil/arm/asm.S"
.macro prerot dst, rt
lsr r3, r6, #2 @ n4
diff --git a/gst-libs/ext/libav/libavcodec/arm/mdct_neon.S b/gst-libs/ext/libav/libavcodec/arm/mdct_neon.S
index 5669075..9f7cb46 100644
--- a/gst-libs/ext/libav/libavcodec/arm/mdct_neon.S
+++ b/gst-libs/ext/libav/libavcodec/arm/mdct_neon.S
@@ -19,9 +19,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "asm.S"
-
- preserve8
+#include "libavutil/arm/asm.S"
#define ff_fft_calc_neon X(ff_fft_calc_neon)
diff --git a/gst-libs/ext/libav/libavcodec/arm/mpegaudiodsp_fixed_armv6.S b/gst-libs/ext/libav/libavcodec/arm/mpegaudiodsp_fixed_armv6.S
index b517b97..49bd0bc 100644
--- a/gst-libs/ext/libav/libavcodec/arm/mpegaudiodsp_fixed_armv6.S
+++ b/gst-libs/ext/libav/libavcodec/arm/mpegaudiodsp_fixed_armv6.S
@@ -18,7 +18,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "asm.S"
+#include "libavutil/arm/asm.S"
.macro skip args:vararg
.endm
diff --git a/gst-libs/ext/libav/libavcodec/arm/mpegaudiodsp_init_arm.c b/gst-libs/ext/libav/libavcodec/arm/mpegaudiodsp_init_arm.c
index 94a5578..a9804e9 100644
--- a/gst-libs/ext/libav/libavcodec/arm/mpegaudiodsp_init_arm.c
+++ b/gst-libs/ext/libav/libavcodec/arm/mpegaudiodsp_init_arm.c
@@ -19,6 +19,8 @@
*/
#include <stdint.h>
+
+#include "libavutil/arm/cpu.h"
#include "libavcodec/mpegaudiodsp.h"
#include "config.h"
@@ -27,7 +29,9 @@ void ff_mpadsp_apply_window_fixed_armv6(int32_t *synth_buf, int32_t *window,
void ff_mpadsp_init_arm(MPADSPContext *s)
{
- if (HAVE_ARMV6) {
+ int cpu_flags = av_get_cpu_flags();
+
+ if (have_armv6(cpu_flags)) {
s->apply_window_fixed = ff_mpadsp_apply_window_fixed_armv6;
}
}
diff --git a/gst-libs/ext/libav/libavcodec/arm/mpegvideo_arm.c b/gst-libs/ext/libav/libavcodec/arm/mpegvideo_arm.c
index b1d1312..cce90c7 100644
--- a/gst-libs/ext/libav/libavcodec/arm/mpegvideo_arm.c
+++ b/gst-libs/ext/libav/libavcodec/arm/mpegvideo_arm.c
@@ -18,6 +18,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "libavutil/arm/cpu.h"
#include "libavcodec/avcodec.h"
#include "libavcodec/dsputil.h"
#include "libavcodec/mpegvideo.h"
@@ -38,20 +39,14 @@ void ff_dct_unquantize_h263_inter_neon(MpegEncContext *s, DCTELEM *block,
void ff_dct_unquantize_h263_intra_neon(MpegEncContext *s, DCTELEM *block,
int n, int qscale);
-void MPV_common_init_arm(MpegEncContext *s)
+void ff_MPV_common_init_arm(MpegEncContext *s)
{
- /* IWMMXT support is a superset of armv5te, so
- * allow optimized functions for armv5te unless
- * a better iwmmxt function exists
- */
-#if HAVE_ARMV5TE
- MPV_common_init_armv5te(s);
-#endif
-#if HAVE_IWMMXT
- MPV_common_init_iwmmxt(s);
-#endif
+ int cpu_flags = av_get_cpu_flags();
+
+ if (have_armv5te(cpu_flags))
+ ff_MPV_common_init_armv5te(s);
- if (HAVE_NEON) {
+ if (have_neon(cpu_flags)) {
s->dct_unquantize_h263_intra = ff_dct_unquantize_h263_intra_neon;
s->dct_unquantize_h263_inter = ff_dct_unquantize_h263_inter_neon;
}
diff --git a/gst-libs/ext/libav/libavcodec/arm/mpegvideo_arm.h b/gst-libs/ext/libav/libavcodec/arm/mpegvideo_arm.h
index a36da61..d69fa2f 100644
--- a/gst-libs/ext/libav/libavcodec/arm/mpegvideo_arm.h
+++ b/gst-libs/ext/libav/libavcodec/arm/mpegvideo_arm.h
@@ -21,7 +21,6 @@
#include "libavcodec/mpegvideo.h"
-void MPV_common_init_iwmmxt(MpegEncContext *s);
-void MPV_common_init_armv5te(MpegEncContext *s);
+void ff_MPV_common_init_armv5te(MpegEncContext *s);
#endif /* AVCODEC_ARM_MPEGVIDEO_H */
diff --git a/gst-libs/ext/libav/libavcodec/arm/mpegvideo_armv5te.c b/gst-libs/ext/libav/libavcodec/arm/mpegvideo_armv5te.c
index 30197d8..f6839dd 100644
--- a/gst-libs/ext/libav/libavcodec/arm/mpegvideo_armv5te.c
+++ b/gst-libs/ext/libav/libavcodec/arm/mpegvideo_armv5te.c
@@ -94,7 +94,7 @@ static void dct_unquantize_h263_inter_armv5te(MpegEncContext *s,
ff_dct_unquantize_h263_armv5te(block, qmul, qadd, nCoeffs + 1);
}
-void MPV_common_init_armv5te(MpegEncContext *s)
+void ff_MPV_common_init_armv5te(MpegEncContext *s)
{
s->dct_unquantize_h263_intra = dct_unquantize_h263_intra_armv5te;
s->dct_unquantize_h263_inter = dct_unquantize_h263_inter_armv5te;
diff --git a/gst-libs/ext/libav/libavcodec/arm/mpegvideo_armv5te_s.S b/gst-libs/ext/libav/libavcodec/arm/mpegvideo_armv5te_s.S
index 952c8d7..4426e15 100644
--- a/gst-libs/ext/libav/libavcodec/arm/mpegvideo_armv5te_s.S
+++ b/gst-libs/ext/libav/libavcodec/arm/mpegvideo_armv5te_s.S
@@ -20,7 +20,7 @@
*/
#include "config.h"
-#include "asm.S"
+#include "libavutil/arm/asm.S"
/*
* Special optimized version of dct_unquantize_h263_helper_c, it
@@ -61,9 +61,9 @@ function ff_dct_unquantize_h263_armv5te, export=1
mov ip, #0
subs r3, r3, #2
ble 2f
- ldrd r4, [r0, #0]
+ ldrd r4, r5, [r0, #0]
1:
- ldrd r6, [r0, #8]
+ ldrd r6, r7, [r0, #8]
dequant_t r9, r4, r1, r2, r9
dequant_t lr, r5, r1, r2, lr
@@ -87,7 +87,7 @@ function ff_dct_unquantize_h263_armv5te, export=1
subs r3, r3, #8
it gt
- ldrdgt r4, [r0, #0] /* load data early to avoid load/use pipeline stall */
+ ldrdgt r4, r5, [r0, #0] /* load data early to avoid load/use pipeline stall */
bgt 1b
adds r3, r3, #2
diff --git a/gst-libs/ext/libav/libavcodec/arm/mpegvideo_iwmmxt.c b/gst-libs/ext/libav/libavcodec/arm/mpegvideo_iwmmxt.c
deleted file mode 100644
index 6edc4c2..0000000
--- a/gst-libs/ext/libav/libavcodec/arm/mpegvideo_iwmmxt.c
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * copyright (c) 2004 AGAWA Koji
- *
- * 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
- */
-
-#include "libavutil/cpu.h"
-#include "libavcodec/avcodec.h"
-#include "libavcodec/dsputil.h"
-#include "libavcodec/mpegvideo.h"
-#include "mpegvideo_arm.h"
-
-static void dct_unquantize_h263_intra_iwmmxt(MpegEncContext *s,
- DCTELEM *block, int n, int qscale)
-{
- int level, qmul, qadd;
- int nCoeffs;
- DCTELEM *block_orig = block;
-
- assert(s->block_last_index[n]>=0);
-
- qmul = qscale << 1;
-
- if (!s->h263_aic) {
- if (n < 4)
- level = block[0] * s->y_dc_scale;
- else
- level = block[0] * s->c_dc_scale;
- qadd = (qscale - 1) | 1;
- }else{
- qadd = 0;
- level = block[0];
- }
- if(s->ac_pred)
- nCoeffs=63;
- else
- nCoeffs= s->inter_scantable.raster_end[ s->block_last_index[n] ];
-
- __asm__ volatile (
-/* "movd %1, %%mm6 \n\t" //qmul */
-/* "packssdw %%mm6, %%mm6 \n\t" */
-/* "packssdw %%mm6, %%mm6 \n\t" */
- "tbcsth wr6, %[qmul] \n\t"
-/* "movd %2, %%mm5 \n\t" //qadd */
-/* "packssdw %%mm5, %%mm5 \n\t" */
-/* "packssdw %%mm5, %%mm5 \n\t" */
- "tbcsth wr5, %[qadd] \n\t"
- "wzero wr7 \n\t" /* "pxor %%mm7, %%mm7 \n\t" */
- "wzero wr4 \n\t" /* "pxor %%mm4, %%mm4 \n\t" */
- "wsubh wr7, wr5, wr7 \n\t" /* "psubw %%mm5, %%mm7 \n\t" */
- "1: \n\t"
- "wldrd wr2, [%[block]] \n\t" /* "movq (%0, %3), %%mm0 \n\t" */
- "wldrd wr3, [%[block], #8] \n\t" /* "movq 8(%0, %3), %%mm1 \n\t" */
- "wmulsl wr0, wr6, wr2 \n\t" /* "pmullw %%mm6, %%mm0 \n\t" */
- "wmulsl wr1, wr6, wr3 \n\t" /* "pmullw %%mm6, %%mm1 \n\t" */
-/* "movq (%0, %3), %%mm2 \n\t" */
-/* "movq 8(%0, %3), %%mm3 \n\t" */
- "wcmpgtsh wr2, wr4, wr2 \n\t" /* "pcmpgtw %%mm4, %%mm2 \n\t" // block[i] < 0 ? -1 : 0 */
- "wcmpgtsh wr3, wr4, wr2 \n\t" /* "pcmpgtw %%mm4, %%mm3 \n\t" // block[i] < 0 ? -1 : 0 */
- "wxor wr0, wr2, wr0 \n\t" /* "pxor %%mm2, %%mm0 \n\t" */
- "wxor wr1, wr3, wr1 \n\t" /* "pxor %%mm3, %%mm1 \n\t" */
- "waddh wr0, wr7, wr0 \n\t" /* "paddw %%mm7, %%mm0 \n\t" */
- "waddh wr1, wr7, wr1 \n\t" /* "paddw %%mm7, %%mm1 \n\t" */
- "wxor wr2, wr0, wr2 \n\t" /* "pxor %%mm0, %%mm2 \n\t" */
- "wxor wr3, wr1, wr3 \n\t" /* "pxor %%mm1, %%mm3 \n\t" */
- "wcmpeqh wr0, wr7, wr0 \n\t" /* "pcmpeqw %%mm7, %%mm0 \n\t" // block[i] == 0 ? -1 : 0 */
- "wcmpeqh wr1, wr7, wr1 \n\t" /* "pcmpeqw %%mm7, %%mm1 \n\t" // block[i] == 0 ? -1 : 0 */
- "wandn wr0, wr2, wr0 \n\t" /* "pandn %%mm2, %%mm0 \n\t" */
- "wandn wr1, wr3, wr1 \n\t" /* "pandn %%mm3, %%mm1 \n\t" */
- "wstrd wr0, [%[block]] \n\t" /* "movq %%mm0, (%0, %3) \n\t" */
- "wstrd wr1, [%[block], #8] \n\t" /* "movq %%mm1, 8(%0, %3) \n\t" */
- "add %[block], %[block], #16 \n\t" /* "addl $16, %3 \n\t" */
- "subs %[i], %[i], #1 \n\t"
- "bne 1b \n\t" /* "jng 1b \n\t" */
- :[block]"+r"(block)
- :[i]"r"((nCoeffs + 8) / 8), [qmul]"r"(qmul), [qadd]"r"(qadd)
- :"memory");
-
- block_orig[0] = level;
-}
-
-void MPV_common_init_iwmmxt(MpegEncContext *s)
-{
- if (!(mm_flags & AV_CPU_FLAG_IWMMXT)) return;
-
- s->dct_unquantize_h263_intra = dct_unquantize_h263_intra_iwmmxt;
-}
diff --git a/gst-libs/ext/libav/libavcodec/arm/mpegvideo_neon.S b/gst-libs/ext/libav/libavcodec/arm/mpegvideo_neon.S
index 206a71a..0c6c428 100644
--- a/gst-libs/ext/libav/libavcodec/arm/mpegvideo_neon.S
+++ b/gst-libs/ext/libav/libavcodec/arm/mpegvideo_neon.S
@@ -18,7 +18,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "asm.S"
+#include "libavutil/arm/asm.S"
#include "asm-offsets.h"
function ff_dct_unquantize_h263_inter_neon, export=1
diff --git a/gst-libs/ext/libav/libavcodec/arm/rdft_neon.S b/gst-libs/ext/libav/libavcodec/arm/rdft_neon.S
index fba275e..7d01d53 100644
--- a/gst-libs/ext/libav/libavcodec/arm/rdft_neon.S
+++ b/gst-libs/ext/libav/libavcodec/arm/rdft_neon.S
@@ -19,9 +19,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "asm.S"
-
- preserve8
+#include "libavutil/arm/asm.S"
function ff_rdft_calc_neon, export=1
push {r4-r8,lr}
diff --git a/gst-libs/ext/libav/libavcodec/arm/rv34dsp_init_arm.c b/gst-libs/ext/libav/libavcodec/arm/rv34dsp_init_arm.c
new file mode 100644
index 0000000..07f5598
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/arm/rv34dsp_init_arm.c
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2011 Janne Grunau <janne-libav@jannau.net>
+ *
+ * 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
+ */
+
+#include <stdint.h>
+
+#include "libavcodec/avcodec.h"
+#include "libavcodec/rv34dsp.h"
+#include "libavutil/arm/cpu.h"
+
+void ff_rv34_inv_transform_noround_neon(DCTELEM *block);
+
+void ff_rv34_inv_transform_noround_dc_neon(DCTELEM *block);
+
+void ff_rv34_idct_add_neon(uint8_t *dst, ptrdiff_t stride, DCTELEM *block);
+void ff_rv34_idct_dc_add_neon(uint8_t *dst, ptrdiff_t stride, int dc);
+
+void ff_rv34dsp_init_arm(RV34DSPContext *c, DSPContext* dsp)
+{
+ int cpu_flags = av_get_cpu_flags();
+
+ if (have_neon(cpu_flags)) {
+ c->rv34_inv_transform = ff_rv34_inv_transform_noround_neon;
+ c->rv34_inv_transform_dc = ff_rv34_inv_transform_noround_dc_neon;
+
+ c->rv34_idct_add = ff_rv34_idct_add_neon;
+ c->rv34_idct_dc_add = ff_rv34_idct_dc_add_neon;
+ }
+}
diff --git a/gst-libs/ext/libav/libavcodec/arm/rv34dsp_init_neon.c b/gst-libs/ext/libav/libavcodec/arm/rv34dsp_init_neon.c
deleted file mode 100644
index 744818c..0000000
--- a/gst-libs/ext/libav/libavcodec/arm/rv34dsp_init_neon.c
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 2011 Janne Grunau <janne-libav@jannau.net>
- *
- * 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
- */
-
-#include <stdint.h>
-
-#include "libavcodec/avcodec.h"
-#include "libavcodec/rv34dsp.h"
-
-void ff_rv34_inv_transform_noround_neon(DCTELEM *block);
-
-void ff_rv34_inv_transform_noround_dc_neon(DCTELEM *block);
-
-void ff_rv34_idct_add_neon(uint8_t *dst, int stride, DCTELEM *block);
-void ff_rv34_idct_dc_add_neon(uint8_t *dst, int stride, int dc);
-
-void ff_rv34dsp_init_neon(RV34DSPContext *c, DSPContext* dsp)
-{
- c->rv34_inv_transform = ff_rv34_inv_transform_noround_neon;
- c->rv34_inv_transform_dc = ff_rv34_inv_transform_noround_dc_neon;
-
- c->rv34_idct_add = ff_rv34_idct_add_neon;
- c->rv34_idct_dc_add = ff_rv34_idct_dc_add_neon;
-}
diff --git a/gst-libs/ext/libav/libavcodec/arm/rv34dsp_neon.S b/gst-libs/ext/libav/libavcodec/arm/rv34dsp_neon.S
index 15a015d..522e387 100644
--- a/gst-libs/ext/libav/libavcodec/arm/rv34dsp_neon.S
+++ b/gst-libs/ext/libav/libavcodec/arm/rv34dsp_neon.S
@@ -18,7 +18,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "asm.S"
+#include "libavutil/arm/asm.S"
#include "neon.S"
.macro rv34_inv_transform r0
diff --git a/gst-libs/ext/libav/libavcodec/arm/rv40dsp_init_arm.c b/gst-libs/ext/libav/libavcodec/arm/rv40dsp_init_arm.c
new file mode 100644
index 0000000..83f4355
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/arm/rv40dsp_init_arm.c
@@ -0,0 +1,147 @@
+/*
+ * Copyright (c) 2011 Janne Grunau <janne-libav@jannau.net>
+ *
+ * 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
+ */
+
+#include <stdint.h>
+
+#include "libavcodec/avcodec.h"
+#include "libavcodec/rv34dsp.h"
+#include "libavutil/arm/cpu.h"
+
+#define DECL_QPEL3(type, w, pos) \
+ void ff_##type##_rv40_qpel##w##_mc##pos##_neon(uint8_t *dst, uint8_t *src,\
+ int stride)
+#define DECL_QPEL2(w, pos) \
+ DECL_QPEL3(put, w, pos); \
+ DECL_QPEL3(avg, w, pos)
+
+#define DECL_QPEL_XY(x, y) \
+ DECL_QPEL2(16, x ## y); \
+ DECL_QPEL2(8, x ## y)
+
+#define DECL_QPEL_Y(y) \
+ DECL_QPEL_XY(0, y); \
+ DECL_QPEL_XY(1, y); \
+ DECL_QPEL_XY(2, y); \
+ DECL_QPEL_XY(3, y); \
+
+DECL_QPEL_Y(0);
+DECL_QPEL_Y(1);
+DECL_QPEL_Y(2);
+DECL_QPEL_Y(3);
+
+void ff_put_rv40_chroma_mc8_neon(uint8_t *, uint8_t *, int, int, int, int);
+void ff_put_rv40_chroma_mc4_neon(uint8_t *, uint8_t *, int, int, int, int);
+
+void ff_avg_rv40_chroma_mc8_neon(uint8_t *, uint8_t *, int, int, int, int);
+void ff_avg_rv40_chroma_mc4_neon(uint8_t *, uint8_t *, int, int, int, int);
+
+void ff_rv40_weight_func_16_neon(uint8_t *, uint8_t *, uint8_t *, int, int, ptrdiff_t);
+void ff_rv40_weight_func_8_neon(uint8_t *, uint8_t *, uint8_t *, int, int, ptrdiff_t);
+
+int ff_rv40_h_loop_filter_strength_neon(uint8_t *src, ptrdiff_t stride,
+ int beta, int beta2, int edge,
+ int *p1, int *q1);
+int ff_rv40_v_loop_filter_strength_neon(uint8_t *src, ptrdiff_t stride,
+ int beta, int beta2, int edge,
+ int *p1, int *q1);
+
+void ff_rv40_h_weak_loop_filter_neon(uint8_t *src, ptrdiff_t stride, int filter_p1,
+ int filter_q1, int alpha, int beta,
+ int lim_p0q0, int lim_q1, int lim_p1);
+void ff_rv40_v_weak_loop_filter_neon(uint8_t *src, ptrdiff_t stride, int filter_p1,
+ int filter_q1, int alpha, int beta,
+ int lim_p0q0, int lim_q1, int lim_p1);
+
+static void ff_rv40dsp_init_neon(RV34DSPContext *c)
+{
+ c->put_pixels_tab[0][ 1] = ff_put_rv40_qpel16_mc10_neon;
+ c->put_pixels_tab[0][ 3] = ff_put_rv40_qpel16_mc30_neon;
+ c->put_pixels_tab[0][ 4] = ff_put_rv40_qpel16_mc01_neon;
+ c->put_pixels_tab[0][ 5] = ff_put_rv40_qpel16_mc11_neon;
+ c->put_pixels_tab[0][ 6] = ff_put_rv40_qpel16_mc21_neon;
+ c->put_pixels_tab[0][ 7] = ff_put_rv40_qpel16_mc31_neon;
+ c->put_pixels_tab[0][ 9] = ff_put_rv40_qpel16_mc12_neon;
+ c->put_pixels_tab[0][10] = ff_put_rv40_qpel16_mc22_neon;
+ c->put_pixels_tab[0][11] = ff_put_rv40_qpel16_mc32_neon;
+ c->put_pixels_tab[0][12] = ff_put_rv40_qpel16_mc03_neon;
+ c->put_pixels_tab[0][13] = ff_put_rv40_qpel16_mc13_neon;
+ c->put_pixels_tab[0][14] = ff_put_rv40_qpel16_mc23_neon;
+ c->put_pixels_tab[0][15] = ff_put_rv40_qpel16_mc33_neon;
+ c->avg_pixels_tab[0][ 1] = ff_avg_rv40_qpel16_mc10_neon;
+ c->avg_pixels_tab[0][ 3] = ff_avg_rv40_qpel16_mc30_neon;
+ c->avg_pixels_tab[0][ 4] = ff_avg_rv40_qpel16_mc01_neon;
+ c->avg_pixels_tab[0][ 5] = ff_avg_rv40_qpel16_mc11_neon;
+ c->avg_pixels_tab[0][ 6] = ff_avg_rv40_qpel16_mc21_neon;
+ c->avg_pixels_tab[0][ 7] = ff_avg_rv40_qpel16_mc31_neon;
+ c->avg_pixels_tab[0][ 9] = ff_avg_rv40_qpel16_mc12_neon;
+ c->avg_pixels_tab[0][10] = ff_avg_rv40_qpel16_mc22_neon;
+ c->avg_pixels_tab[0][11] = ff_avg_rv40_qpel16_mc32_neon;
+ c->avg_pixels_tab[0][12] = ff_avg_rv40_qpel16_mc03_neon;
+ c->avg_pixels_tab[0][13] = ff_avg_rv40_qpel16_mc13_neon;
+ c->avg_pixels_tab[0][14] = ff_avg_rv40_qpel16_mc23_neon;
+ c->avg_pixels_tab[0][15] = ff_avg_rv40_qpel16_mc33_neon;
+ c->put_pixels_tab[1][ 1] = ff_put_rv40_qpel8_mc10_neon;
+ c->put_pixels_tab[1][ 3] = ff_put_rv40_qpel8_mc30_neon;
+ c->put_pixels_tab[1][ 4] = ff_put_rv40_qpel8_mc01_neon;
+ c->put_pixels_tab[1][ 5] = ff_put_rv40_qpel8_mc11_neon;
+ c->put_pixels_tab[1][ 6] = ff_put_rv40_qpel8_mc21_neon;
+ c->put_pixels_tab[1][ 7] = ff_put_rv40_qpel8_mc31_neon;
+ c->put_pixels_tab[1][ 9] = ff_put_rv40_qpel8_mc12_neon;
+ c->put_pixels_tab[1][10] = ff_put_rv40_qpel8_mc22_neon;
+ c->put_pixels_tab[1][11] = ff_put_rv40_qpel8_mc32_neon;
+ c->put_pixels_tab[1][12] = ff_put_rv40_qpel8_mc03_neon;
+ c->put_pixels_tab[1][13] = ff_put_rv40_qpel8_mc13_neon;
+ c->put_pixels_tab[1][14] = ff_put_rv40_qpel8_mc23_neon;
+ c->put_pixels_tab[1][15] = ff_put_rv40_qpel8_mc33_neon;
+ c->avg_pixels_tab[1][ 1] = ff_avg_rv40_qpel8_mc10_neon;
+ c->avg_pixels_tab[1][ 3] = ff_avg_rv40_qpel8_mc30_neon;
+ c->avg_pixels_tab[1][ 4] = ff_avg_rv40_qpel8_mc01_neon;
+ c->avg_pixels_tab[1][ 5] = ff_avg_rv40_qpel8_mc11_neon;
+ c->avg_pixels_tab[1][ 6] = ff_avg_rv40_qpel8_mc21_neon;
+ c->avg_pixels_tab[1][ 7] = ff_avg_rv40_qpel8_mc31_neon;
+ c->avg_pixels_tab[1][ 9] = ff_avg_rv40_qpel8_mc12_neon;
+ c->avg_pixels_tab[1][10] = ff_avg_rv40_qpel8_mc22_neon;
+ c->avg_pixels_tab[1][11] = ff_avg_rv40_qpel8_mc32_neon;
+ c->avg_pixels_tab[1][12] = ff_avg_rv40_qpel8_mc03_neon;
+ c->avg_pixels_tab[1][13] = ff_avg_rv40_qpel8_mc13_neon;
+ c->avg_pixels_tab[1][14] = ff_avg_rv40_qpel8_mc23_neon;
+ c->avg_pixels_tab[1][15] = ff_avg_rv40_qpel8_mc33_neon;
+
+ c->put_chroma_pixels_tab[0] = ff_put_rv40_chroma_mc8_neon;
+ c->put_chroma_pixels_tab[1] = ff_put_rv40_chroma_mc4_neon;
+ c->avg_chroma_pixels_tab[0] = ff_avg_rv40_chroma_mc8_neon;
+ c->avg_chroma_pixels_tab[1] = ff_avg_rv40_chroma_mc4_neon;
+
+ c->rv40_weight_pixels_tab[0][0] = ff_rv40_weight_func_16_neon;
+ c->rv40_weight_pixels_tab[0][1] = ff_rv40_weight_func_8_neon;
+
+ c->rv40_loop_filter_strength[0] = ff_rv40_h_loop_filter_strength_neon;
+ c->rv40_loop_filter_strength[1] = ff_rv40_v_loop_filter_strength_neon;
+ c->rv40_weak_loop_filter[0] = ff_rv40_h_weak_loop_filter_neon;
+ c->rv40_weak_loop_filter[1] = ff_rv40_v_weak_loop_filter_neon;
+}
+
+void ff_rv40dsp_init_arm(RV34DSPContext *c, DSPContext* dsp)
+{
+ int cpu_flags = av_get_cpu_flags();
+
+ if (have_neon(cpu_flags))
+ ff_rv40dsp_init_neon(c);
+}
diff --git a/gst-libs/ext/libav/libavcodec/arm/rv40dsp_init_neon.c b/gst-libs/ext/libav/libavcodec/arm/rv40dsp_init_neon.c
deleted file mode 100644
index 898b841..0000000
--- a/gst-libs/ext/libav/libavcodec/arm/rv40dsp_init_neon.c
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * Copyright (c) 2011 Janne Grunau <janne-libav@jannau.net>
- *
- * 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
- */
-
-#include <stdint.h>
-
-#include "libavcodec/avcodec.h"
-#include "libavcodec/rv34dsp.h"
-
-#define DECL_QPEL3(type, w, pos) \
- void ff_##type##_rv40_qpel##w##_mc##pos##_neon(uint8_t *dst, uint8_t *src,\
- int stride)
-#define DECL_QPEL2(w, pos) \
- DECL_QPEL3(put, w, pos); \
- DECL_QPEL3(avg, w, pos)
-
-#define DECL_QPEL_XY(x, y) \
- DECL_QPEL2(16, x ## y); \
- DECL_QPEL2(8, x ## y)
-
-#define DECL_QPEL_Y(y) \
- DECL_QPEL_XY(0, y); \
- DECL_QPEL_XY(1, y); \
- DECL_QPEL_XY(2, y); \
- DECL_QPEL_XY(3, y); \
-
-DECL_QPEL_Y(0);
-DECL_QPEL_Y(1);
-DECL_QPEL_Y(2);
-DECL_QPEL_Y(3);
-
-void ff_put_rv40_chroma_mc8_neon(uint8_t *, uint8_t *, int, int, int, int);
-void ff_put_rv40_chroma_mc4_neon(uint8_t *, uint8_t *, int, int, int, int);
-
-void ff_avg_rv40_chroma_mc8_neon(uint8_t *, uint8_t *, int, int, int, int);
-void ff_avg_rv40_chroma_mc4_neon(uint8_t *, uint8_t *, int, int, int, int);
-
-void ff_rv40_weight_func_16_neon(uint8_t *, uint8_t *, uint8_t *, int, int, int);
-void ff_rv40_weight_func_8_neon(uint8_t *, uint8_t *, uint8_t *, int, int, int);
-
-int ff_rv40_h_loop_filter_strength_neon(uint8_t *src, int stride,
- int beta, int beta2, int edge,
- int *p1, int *q1);
-int ff_rv40_v_loop_filter_strength_neon(uint8_t *src, int stride,
- int beta, int beta2, int edge,
- int *p1, int *q1);
-
-void ff_rv40_h_weak_loop_filter_neon(uint8_t *src, int stride, int filter_p1,
- int filter_q1, int alpha, int beta,
- int lim_p0q0, int lim_q1, int lim_p1);
-void ff_rv40_v_weak_loop_filter_neon(uint8_t *src, int stride, int filter_p1,
- int filter_q1, int alpha, int beta,
- int lim_p0q0, int lim_q1, int lim_p1);
-
-void ff_rv40dsp_init_neon(RV34DSPContext *c, DSPContext* dsp)
-{
- c->put_pixels_tab[0][ 1] = ff_put_rv40_qpel16_mc10_neon;
- c->put_pixels_tab[0][ 3] = ff_put_rv40_qpel16_mc30_neon;
- c->put_pixels_tab[0][ 4] = ff_put_rv40_qpel16_mc01_neon;
- c->put_pixels_tab[0][ 5] = ff_put_rv40_qpel16_mc11_neon;
- c->put_pixels_tab[0][ 6] = ff_put_rv40_qpel16_mc21_neon;
- c->put_pixels_tab[0][ 7] = ff_put_rv40_qpel16_mc31_neon;
- c->put_pixels_tab[0][ 9] = ff_put_rv40_qpel16_mc12_neon;
- c->put_pixels_tab[0][10] = ff_put_rv40_qpel16_mc22_neon;
- c->put_pixels_tab[0][11] = ff_put_rv40_qpel16_mc32_neon;
- c->put_pixels_tab[0][12] = ff_put_rv40_qpel16_mc03_neon;
- c->put_pixels_tab[0][13] = ff_put_rv40_qpel16_mc13_neon;
- c->put_pixels_tab[0][14] = ff_put_rv40_qpel16_mc23_neon;
- c->put_pixels_tab[0][15] = ff_put_rv40_qpel16_mc33_neon;
- c->avg_pixels_tab[0][ 1] = ff_avg_rv40_qpel16_mc10_neon;
- c->avg_pixels_tab[0][ 3] = ff_avg_rv40_qpel16_mc30_neon;
- c->avg_pixels_tab[0][ 4] = ff_avg_rv40_qpel16_mc01_neon;
- c->avg_pixels_tab[0][ 5] = ff_avg_rv40_qpel16_mc11_neon;
- c->avg_pixels_tab[0][ 6] = ff_avg_rv40_qpel16_mc21_neon;
- c->avg_pixels_tab[0][ 7] = ff_avg_rv40_qpel16_mc31_neon;
- c->avg_pixels_tab[0][ 9] = ff_avg_rv40_qpel16_mc12_neon;
- c->avg_pixels_tab[0][10] = ff_avg_rv40_qpel16_mc22_neon;
- c->avg_pixels_tab[0][11] = ff_avg_rv40_qpel16_mc32_neon;
- c->avg_pixels_tab[0][12] = ff_avg_rv40_qpel16_mc03_neon;
- c->avg_pixels_tab[0][13] = ff_avg_rv40_qpel16_mc13_neon;
- c->avg_pixels_tab[0][14] = ff_avg_rv40_qpel16_mc23_neon;
- c->avg_pixels_tab[0][15] = ff_avg_rv40_qpel16_mc33_neon;
- c->put_pixels_tab[1][ 1] = ff_put_rv40_qpel8_mc10_neon;
- c->put_pixels_tab[1][ 3] = ff_put_rv40_qpel8_mc30_neon;
- c->put_pixels_tab[1][ 4] = ff_put_rv40_qpel8_mc01_neon;
- c->put_pixels_tab[1][ 5] = ff_put_rv40_qpel8_mc11_neon;
- c->put_pixels_tab[1][ 6] = ff_put_rv40_qpel8_mc21_neon;
- c->put_pixels_tab[1][ 7] = ff_put_rv40_qpel8_mc31_neon;
- c->put_pixels_tab[1][ 9] = ff_put_rv40_qpel8_mc12_neon;
- c->put_pixels_tab[1][10] = ff_put_rv40_qpel8_mc22_neon;
- c->put_pixels_tab[1][11] = ff_put_rv40_qpel8_mc32_neon;
- c->put_pixels_tab[1][12] = ff_put_rv40_qpel8_mc03_neon;
- c->put_pixels_tab[1][13] = ff_put_rv40_qpel8_mc13_neon;
- c->put_pixels_tab[1][14] = ff_put_rv40_qpel8_mc23_neon;
- c->put_pixels_tab[1][15] = ff_put_rv40_qpel8_mc33_neon;
- c->avg_pixels_tab[1][ 1] = ff_avg_rv40_qpel8_mc10_neon;
- c->avg_pixels_tab[1][ 3] = ff_avg_rv40_qpel8_mc30_neon;
- c->avg_pixels_tab[1][ 4] = ff_avg_rv40_qpel8_mc01_neon;
- c->avg_pixels_tab[1][ 5] = ff_avg_rv40_qpel8_mc11_neon;
- c->avg_pixels_tab[1][ 6] = ff_avg_rv40_qpel8_mc21_neon;
- c->avg_pixels_tab[1][ 7] = ff_avg_rv40_qpel8_mc31_neon;
- c->avg_pixels_tab[1][ 9] = ff_avg_rv40_qpel8_mc12_neon;
- c->avg_pixels_tab[1][10] = ff_avg_rv40_qpel8_mc22_neon;
- c->avg_pixels_tab[1][11] = ff_avg_rv40_qpel8_mc32_neon;
- c->avg_pixels_tab[1][12] = ff_avg_rv40_qpel8_mc03_neon;
- c->avg_pixels_tab[1][13] = ff_avg_rv40_qpel8_mc13_neon;
- c->avg_pixels_tab[1][14] = ff_avg_rv40_qpel8_mc23_neon;
- c->avg_pixels_tab[1][15] = ff_avg_rv40_qpel8_mc33_neon;
-
- c->put_chroma_pixels_tab[0] = ff_put_rv40_chroma_mc8_neon;
- c->put_chroma_pixels_tab[1] = ff_put_rv40_chroma_mc4_neon;
- c->avg_chroma_pixels_tab[0] = ff_avg_rv40_chroma_mc8_neon;
- c->avg_chroma_pixels_tab[1] = ff_avg_rv40_chroma_mc4_neon;
-
- c->rv40_weight_pixels_tab[0] = ff_rv40_weight_func_16_neon;
- c->rv40_weight_pixels_tab[1] = ff_rv40_weight_func_8_neon;
-
- c->rv40_loop_filter_strength[0] = ff_rv40_h_loop_filter_strength_neon;
- c->rv40_loop_filter_strength[1] = ff_rv40_v_loop_filter_strength_neon;
- c->rv40_weak_loop_filter[0] = ff_rv40_h_weak_loop_filter_neon;
- c->rv40_weak_loop_filter[1] = ff_rv40_v_weak_loop_filter_neon;
-}
diff --git a/gst-libs/ext/libav/libavcodec/arm/rv40dsp_neon.S b/gst-libs/ext/libav/libavcodec/arm/rv40dsp_neon.S
index f68f382..6bd45eb 100644
--- a/gst-libs/ext/libav/libavcodec/arm/rv40dsp_neon.S
+++ b/gst-libs/ext/libav/libavcodec/arm/rv40dsp_neon.S
@@ -19,7 +19,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "asm.S"
+#include "libavutil/arm/asm.S"
#include "neon.S"
.macro qpel_lowpass r0, r1, rc1, rc2, shift
diff --git a/gst-libs/ext/libav/libavcodec/arm/sbrdsp_init_arm.c b/gst-libs/ext/libav/libavcodec/arm/sbrdsp_init_arm.c
new file mode 100644
index 0000000..4da7967
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/arm/sbrdsp_init_arm.c
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2012 Mans Rullgard
+ *
+ * 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
+ */
+
+#include "config.h"
+#include "libavutil/arm/cpu.h"
+#include "libavutil/attributes.h"
+#include "libavcodec/sbrdsp.h"
+
+void ff_sbr_sum64x5_neon(float *z);
+float ff_sbr_sum_square_neon(float (*x)[2], int n);
+void ff_sbr_neg_odd_64_neon(float *x);
+void ff_sbr_qmf_pre_shuffle_neon(float *z);
+void ff_sbr_qmf_post_shuffle_neon(float W[32][2], const float *z);
+void ff_sbr_qmf_deint_neg_neon(float *v, const float *src);
+void ff_sbr_qmf_deint_bfly_neon(float *v, const float *src0, const float *src1);
+void ff_sbr_hf_g_filt_neon(float (*Y)[2], const float (*X_high)[40][2],
+ const float *g_filt, int m_max, intptr_t ixh);
+void ff_sbr_hf_gen_neon(float (*X_high)[2], const float (*X_low)[2],
+ const float alpha0[2], const float alpha1[2],
+ float bw, int start, int end);
+void ff_sbr_autocorrelate_neon(const float x[40][2], float phi[3][2][2]);
+
+void ff_sbr_hf_apply_noise_0_neon(float Y[64][2], const float *s_m,
+ const float *q_filt, int noise,
+ int kx, int m_max);
+void ff_sbr_hf_apply_noise_1_neon(float Y[64][2], const float *s_m,
+ const float *q_filt, int noise,
+ int kx, int m_max);
+void ff_sbr_hf_apply_noise_2_neon(float Y[64][2], const float *s_m,
+ const float *q_filt, int noise,
+ int kx, int m_max);
+void ff_sbr_hf_apply_noise_3_neon(float Y[64][2], const float *s_m,
+ const float *q_filt, int noise,
+ int kx, int m_max);
+
+av_cold void ff_sbrdsp_init_arm(SBRDSPContext *s)
+{
+ int cpu_flags = av_get_cpu_flags();
+
+ if (have_neon(cpu_flags)) {
+ s->sum64x5 = ff_sbr_sum64x5_neon;
+ s->sum_square = ff_sbr_sum_square_neon;
+ s->neg_odd_64 = ff_sbr_neg_odd_64_neon;
+ s->qmf_pre_shuffle = ff_sbr_qmf_pre_shuffle_neon;
+ s->qmf_post_shuffle = ff_sbr_qmf_post_shuffle_neon;
+ s->qmf_deint_neg = ff_sbr_qmf_deint_neg_neon;
+ s->qmf_deint_bfly = ff_sbr_qmf_deint_bfly_neon;
+ s->hf_g_filt = ff_sbr_hf_g_filt_neon;
+ s->hf_gen = ff_sbr_hf_gen_neon;
+ s->autocorrelate = ff_sbr_autocorrelate_neon;
+ s->hf_apply_noise[0] = ff_sbr_hf_apply_noise_0_neon;
+ s->hf_apply_noise[1] = ff_sbr_hf_apply_noise_1_neon;
+ s->hf_apply_noise[2] = ff_sbr_hf_apply_noise_2_neon;
+ s->hf_apply_noise[3] = ff_sbr_hf_apply_noise_3_neon;
+ }
+}
diff --git a/gst-libs/ext/libav/libavcodec/arm/sbrdsp_neon.S b/gst-libs/ext/libav/libavcodec/arm/sbrdsp_neon.S
new file mode 100644
index 0000000..610397f
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/arm/sbrdsp_neon.S
@@ -0,0 +1,411 @@
+/*
+ * Copyright (c) 2012 Mans Rullgard
+ *
+ * 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
+ */
+
+#include "libavutil/arm/asm.S"
+
+function ff_sbr_sum64x5_neon, export=1
+ push {lr}
+ add r1, r0, # 64*4
+ add r2, r0, #128*4
+ add r3, r0, #192*4
+ add lr, r0, #256*4
+ mov r12, #64
+1:
+ vld1.32 {q0}, [r0,:128]
+ vld1.32 {q1}, [r1,:128]!
+ vadd.f32 q0, q0, q1
+ vld1.32 {q2}, [r2,:128]!
+ vadd.f32 q0, q0, q2
+ vld1.32 {q3}, [r3,:128]!
+ vadd.f32 q0, q0, q3
+ vld1.32 {q8}, [lr,:128]!
+ vadd.f32 q0, q0, q8
+ vst1.32 {q0}, [r0,:128]!
+ subs r12, #4
+ bgt 1b
+ pop {pc}
+endfunc
+
+function ff_sbr_sum_square_neon, export=1
+ vmov.f32 q0, #0.0
+1:
+ vld1.32 {q1}, [r0,:128]!
+ vmla.f32 q0, q1, q1
+ subs r1, r1, #2
+ bgt 1b
+ vadd.f32 d0, d0, d1
+ vpadd.f32 d0, d0, d0
+NOVFP vmov.32 r0, d0[0]
+ bx lr
+endfunc
+
+function ff_sbr_neg_odd_64_neon, export=1
+ mov r1, r0
+ vmov.i32 q8, #1<<31
+ vld2.32 {q0,q1}, [r0,:128]!
+ veor q1, q1, q8
+ vld2.32 {q2,q3}, [r0,:128]!
+ .rept 3
+ vst2.32 {q0,q1}, [r1,:128]!
+ veor q3, q3, q8
+ vld2.32 {q0,q1}, [r0,:128]!
+ vst2.32 {q2,q3}, [r1,:128]!
+ veor q1, q1, q8
+ vld2.32 {q2,q3}, [r0,:128]!
+ .endr
+ veor q3, q3, q8
+ vst2.32 {q0,q1}, [r1,:128]!
+ vst2.32 {q2,q3}, [r1,:128]!
+ bx lr
+endfunc
+
+function ff_sbr_qmf_pre_shuffle_neon, export=1
+ add r1, r0, #60*4
+ add r2, r0, #64*4
+ vld1.32 {d0}, [r0,:64]!
+ vst1.32 {d0}, [r2,:64]!
+ mov r3, #-16
+ mov r12, #24
+ vmov.i32 q8, #1<<31
+ vld1.32 {q0}, [r1,:128], r3
+ vld1.32 {d2}, [r0,:64]!
+1:
+ vld1.32 {d3,d4}, [r0,:128]!
+ vrev64.32 q0, q0
+ vld1.32 {q9}, [r1,:128], r3
+ veor q0, q0, q8
+ vld1.32 {d5,d6}, [r0,:128]!
+ vswp d0, d1
+ vrev64.32 q9, q9
+ vst2.32 {q0,q1}, [r2,:64]!
+ vmov q10, q2
+ veor q9, q9, q8
+ vmov d2, d6
+ vswp d18, d19
+ vld1.32 {q0}, [r1,:128], r3
+ vst2.32 {q9,q10}, [r2,:64]!
+ subs r12, r12, #8
+ bgt 1b
+ vld1.32 {d3,d4}, [r0,:128]!
+ vrev64.32 q0, q0
+ vld1.32 {q9}, [r1,:128], r3
+ veor q0, q0, q8
+ vld1.32 {d5}, [r0,:64]!
+ vswp d0, d1
+ vrev64.32 q9, q9
+ vst2.32 {q0,q1}, [r2,:64]!
+ vswp d4, d5
+ veor q1, q9, q8
+ vst2.32 {d3,d5}, [r2,:64]!
+ vst2.32 {d2[0],d4[0]}, [r2,:64]!
+ bx lr
+endfunc
+
+function ff_sbr_qmf_post_shuffle_neon, export=1
+ add r2, r1, #60*4
+ mov r3, #-16
+ mov r12, #32
+ vmov.i32 q8, #1<<31
+ vld1.32 {q0}, [r2,:128], r3
+ vld1.32 {q1}, [r1,:128]!
+1:
+ pld [r2, #-32]
+ vrev64.32 q0, q0
+ vswp d2, d3
+ veor q0, q0, q8
+ vld1.32 {q2}, [r2,:128], r3
+ vld1.32 {q3}, [r1,:128]!
+ vst2.32 {d1,d3}, [r0,:128]!
+ vst2.32 {d0,d2}, [r0,:128]!
+ pld [r2, #-32]
+ vrev64.32 q2, q2
+ vswp d6, d7
+ veor q2, q2, q8
+ vld1.32 {q0}, [r2,:128], r3
+ vld1.32 {q1}, [r1,:128]!
+ vst2.32 {d5,d7}, [r0,:128]!
+ vst2.32 {d4,d6}, [r0,:128]!
+ subs r12, r12, #8
+ bgt 1b
+ bx lr
+endfunc
+
+function ff_sbr_qmf_deint_neg_neon, export=1
+ add r1, r1, #60*4
+ add r2, r0, #62*4
+ mov r3, #-16
+ mov r12, #32
+ vmov.i32 d2, #1<<31
+1:
+ vld2.32 {d0,d1}, [r1,:128], r3
+ veor d0, d0, d2
+ vrev64.32 d1, d1
+ vst1.32 {d0}, [r2,:64]
+ vst1.32 {d1}, [r0,:64]!
+ sub r2, r2, #8
+ subs r12, r12, #2
+ bgt 1b
+ bx lr
+endfunc
+
+function ff_sbr_qmf_deint_bfly_neon, export=1
+ push {lr}
+ add r2, r2, #60*4
+ add r3, r0, #124*4
+ mov r12, #64
+ mov lr, #-16
+1:
+ vld1.32 {q0}, [r1,:128]!
+ vld1.32 {q1}, [r2,:128], lr
+ vrev64.32 q2, q0
+ vrev64.32 q3, q1
+ vadd.f32 d3, d4, d3
+ vadd.f32 d2, d5, d2
+ vsub.f32 d0, d0, d7
+ vsub.f32 d1, d1, d6
+ vst1.32 {q1}, [r3,:128], lr
+ vst1.32 {q0}, [r0,:128]!
+ subs r12, r12, #4
+ bgt 1b
+ pop {pc}
+endfunc
+
+function ff_sbr_hf_g_filt_neon, export=1
+ ldr r12, [sp]
+ add r1, r1, r12, lsl #3
+ mov r12, #40*2*4
+ sub r3, r3, #1
+ vld2.32 {d2[],d3[]},[r2,:64]!
+ vld1.32 {d0}, [r1,:64], r12
+1:
+ vld1.32 {d1}, [r1,:64], r12
+ vmul.f32 q3, q0, q1
+ vld2.32 {d2[],d3[]},[r2,:64]!
+ vld1.32 {d0}, [r1,:64], r12
+ vst1.32 {q3}, [r0,:64]!
+ subs r3, r3, #2
+ bgt 1b
+ it lt
+ bxlt lr
+ vmul.f32 d0, d0, d2
+ vst1.32 {d0}, [r0,:64]!
+ bx lr
+endfunc
+
+function ff_sbr_hf_gen_neon, export=1
+NOVFP vld1.32 {d1[]}, [sp,:32]
+VFP vdup.32 d1, d0[0]
+ vmul.f32 d0, d1, d1
+ vld1.32 {d3}, [r2,:64]
+ vld1.32 {d2}, [r3,:64]
+ vmul.f32 q0, q0, q1
+ ldrd r2, r3, [sp, #4*!HAVE_VFP_ARGS]
+ vtrn.32 d0, d1
+ vneg.f32 d18, d1
+ vtrn.32 d18, d1
+ add r0, r0, r2, lsl #3
+ add r1, r1, r2, lsl #3
+ sub r1, r1, #2*8
+ sub r3, r3, r2
+ vld1.32 {q1}, [r1,:128]!
+1:
+ vld1.32 {q3}, [r1,:128]!
+ vrev64.32 q2, q1
+ vmov q8, q3
+ vrev64.32 d20, d3
+ vrev64.32 d21, d6
+ vmla.f32 q3, q1, d0[0]
+ vmla.f32 d6, d4, d18
+ vmla.f32 d7, d20, d18
+ vmla.f32 d6, d3, d0[1]
+ vmla.f32 d7, d16, d0[1]
+ vmla.f32 d6, d5, d1
+ vmla.f32 d7, d21, d1
+ vmov q1, q8
+ vst1.32 {q3}, [r0,:128]!
+ subs r3, r3, #2
+ bgt 1b
+ bx lr
+endfunc
+
+function ff_sbr_autocorrelate_neon, export=1
+ vld1.32 {q0}, [r0,:128]!
+ vmov.f32 q1, #0.0
+ vmov.f32 q3, #0.0
+ vmov.f32 d20, #0.0
+ vmul.f32 d21, d1, d1
+ vmov q8, q0
+ vmov q11, q0
+ mov r12, #36
+1:
+ vld1.32 {q2}, [r0,:128]!
+ vrev64.32 q12, q2
+ vmla.f32 q10, q2, q2
+ vmla.f32 d2, d1, d4
+ vmla.f32 d3, d1, d24
+ vmla.f32 d6, d0, d4
+ vmla.f32 d7, d0, d24
+ vmla.f32 d2, d4, d5
+ vmla.f32 d3, d4, d25
+ vmla.f32 d6, d1, d5
+ vmla.f32 d7, d1, d25
+ vmov q0, q2
+ subs r12, r12, #2
+ bgt 1b
+ vld1.32 {q2}, [r0,:128]!
+ vrev64.32 q12, q2
+ vmla.f32 d2, d1, d4
+ vmla.f32 d3, d1, d24
+ vmla.f32 d6, d0, d4
+ vmla.f32 d7, d0, d24
+ vadd.f32 d20, d20, d21
+ vrev64.32 d18, d17
+ vmla.f32 d6, d1, d5
+ vmla.f32 d7, d1, d25
+ vmov q0, q1
+ vmla.f32 d0, d16, d17
+ vmla.f32 d1, d16, d18
+ vmla.f32 d2, d4, d5
+ vmla.f32 d3, d4, d25
+ vneg.f32 s15, s15
+ vmov d21, d20
+ vpadd.f32 d0, d0, d2
+ vpadd.f32 d7, d6, d7
+ vtrn.32 d1, d3
+ vsub.f32 d6, d1, d3
+ vmla.f32 d20, d22, d22
+ vmla.f32 d21, d4, d4
+ vtrn.32 d0, d6
+ vpadd.f32 d20, d20, d21
+ vst1.32 {q3}, [r1,:128]!
+ vst1.32 {d20[1]}, [r1,:32]
+ add r1, r1, #2*4
+ vst1.32 {d0}, [r1,:64]
+ add r1, r1, #4*4
+ vst1.32 {d20[0]}, [r1,:32]
+ bx lr
+endfunc
+
+function ff_sbr_hf_apply_noise_0_neon, export=1
+ vmov.i32 d3, #0
+.Lhf_apply_noise_0:
+ push {r4,lr}
+ movrelx r4, X(ff_sbr_noise_table)
+ ldr r12, [sp, #12]
+ add r3, r3, #1
+ bfc r3, #9, #23
+ sub r12, r12, #1
+1:
+ add lr, r4, r3, lsl #3
+ vld2.32 {q0}, [r0,:64]
+ vld2.32 {q3}, [lr,:64]
+ vld1.32 {d2}, [r1,:64]!
+ vld1.32 {d18}, [r2,:64]!
+ vceq.f32 d16, d2, #0
+ veor d2, d2, d3
+ vmov q2, q0
+ vmla.f32 d0, d6, d18
+ vmla.f32 d1, d7, d18
+ vadd.f32 d4, d4, d2
+ add r3, r3, #2
+ bfc r3, #9, #23
+ vbif d0, d4, d16
+ vbif d1, d5, d16
+ vst2.32 {q0}, [r0,:64]!
+ subs r12, r12, #2
+ bgt 1b
+ blt 2f
+ add lr, r4, r3, lsl #3
+ vld1.32 {d0}, [r0,:64]
+ vld1.32 {d6}, [lr,:64]
+ vld1.32 {d2[]}, [r1,:32]!
+ vld1.32 {d3[]}, [r2,:32]!
+ vceq.f32 d4, d2, #0
+ veor d2, d2, d3
+ vmov d1, d0
+ vmla.f32 d0, d6, d3
+ vadd.f32 s2, s2, s4
+ vbif d0, d1, d4
+ vst1.32 {d0}, [r0,:64]!
+2:
+ pop {r4,pc}
+endfunc
+
+function ff_sbr_hf_apply_noise_1_neon, export=1
+ ldr r12, [sp]
+ push {r4,lr}
+ lsl r12, r12, #31
+ eor lr, r12, #1<<31
+ vmov d3, r12, lr
+.Lhf_apply_noise_1:
+ movrelx r4, X(ff_sbr_noise_table)
+ ldr r12, [sp, #12]
+ add r3, r3, #1
+ bfc r3, #9, #23
+ sub r12, r12, #1
+1:
+ add lr, r4, r3, lsl #3
+ vld2.32 {q0}, [r0,:64]
+ vld2.32 {q3}, [lr,:64]
+ vld1.32 {d2}, [r1,:64]!
+ vld1.32 {d18}, [r2,:64]!
+ vceq.f32 d16, d2, #0
+ veor d2, d2, d3
+ vmov q2, q0
+ vmla.f32 d0, d6, d18
+ vmla.f32 d1, d7, d18
+ vadd.f32 d5, d5, d2
+ add r3, r3, #2
+ bfc r3, #9, #23
+ vbif d0, d4, d16
+ vbif d1, d5, d16
+ vst2.32 {q0}, [r0,:64]!
+ subs r12, r12, #2
+ bgt 1b
+ blt 2f
+ add lr, r4, r3, lsl #3
+ vld1.32 {d0}, [r0,:64]
+ vld1.32 {d6}, [lr,:64]
+ vld1.32 {d2[]}, [r1,:32]!
+ vld1.32 {d18[]}, [r2,:32]!
+ vceq.f32 d4, d2, #0
+ veor d2, d2, d3
+ vmov d1, d0
+ vmla.f32 d0, d6, d18
+ vadd.f32 s3, s3, s5
+ vbif d0, d1, d4
+ vst1.32 {d0}, [r0,:64]!
+2:
+ pop {r4,pc}
+endfunc
+
+function ff_sbr_hf_apply_noise_2_neon, export=1
+ vmov.i32 d3, #1<<31
+ b .Lhf_apply_noise_0
+endfunc
+
+function ff_sbr_hf_apply_noise_3_neon, export=1
+ ldr r12, [sp]
+ push {r4,lr}
+ lsl r12, r12, #31
+ eor lr, r12, #1<<31
+ vmov d3, lr, r12
+ b .Lhf_apply_noise_1
+endfunc
diff --git a/gst-libs/ext/libav/libavcodec/arm/simple_idct_arm.S b/gst-libs/ext/libav/libavcodec/arm/simple_idct_arm.S
index a9c3095..8ba6c48 100644
--- a/gst-libs/ext/libav/libavcodec/arm/simple_idct_arm.S
+++ b/gst-libs/ext/libav/libavcodec/arm/simple_idct_arm.S
@@ -23,10 +23,9 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "asm.S"
+#include "libavutil/arm/asm.S"
-/* useful constants for the algorithm, they are save in __constant_ptr__ at */
-/* the end of the source code.*/
+/* useful constants for the algorithm */
#define W1 22725
#define W2 21407
#define W3 19266
@@ -36,16 +35,6 @@
#define W7 4520
#define MASK_MSHW 0xFFFF0000
-/* offsets of the constants in the vector */
-#define offW1 0
-#define offW2 4
-#define offW3 8
-#define offW4 12
-#define offW5 16
-#define offW6 20
-#define offW7 24
-#define offMASK_MSHW 28
-
#define ROW_SHIFT 11
#define ROW_SHIFT2MSHW (16-11)
#define COL_SHIFT 20
@@ -63,7 +52,6 @@ function ff_simple_idct_arm, export=1
stmfd sp!, {r4-r11, r14} @ R14 is also called LR
@@ at this point, R0=block, other registers are free.
add r14, r0, #112 @ R14=&block[8*7], better start from the last row, and decrease the value until row=0, i.e. R12=block.
- adr r12, __constant_ptr__ @ R12=__constant_ptr__, the vector containing the constants, probably not necessary to reserve a register for it
@@ add 2 temporary variables in the stack: R0 and R14
sub sp, sp, #8 @ allow 2 local variables
str r0, [sp, #0] @ save block in sp[0]
@@ -109,13 +97,13 @@ __b_evaluation:
@@ MAC16(b1, -W7, row[3]);
@@ MAC16(b2, -W1, row[3]);
@@ MAC16(b3, -W5, row[3]);
- ldr r8, [r12, #offW1] @ R8=W1
+ ldr r8, =W1 @ R8=W1
mov r2, r2, asr #16 @ R2=ROWr16[3]
mul r0, r8, r7 @ R0=W1*ROWr16[1]=b0 (ROWr16[1] must be the second arg, to have the possibility to save 1 cycle)
- ldr r9, [r12, #offW3] @ R9=W3
- ldr r10, [r12, #offW5] @ R10=W5
+ ldr r9, =W3 @ R9=W3
+ ldr r10, =W5 @ R10=W5
mul r1, r9, r7 @ R1=W3*ROWr16[1]=b1 (ROWr16[1] must be the second arg, to have the possibility to save 1 cycle)
- ldr r11, [r12, #offW7] @ R11=W7
+ ldr r11, =W7 @ R11=W7
mul r5, r10, r7 @ R5=W5*ROWr16[1]=b2 (ROWr16[1] must be the second arg, to have the possibility to save 1 cycle)
mul r7, r11, r7 @ R7=W7*ROWr16[1]=b3 (ROWr16[1] must be the second arg, to have the possibility to save 1 cycle)
teq r2, #0 @ if null avoid muls
@@ -177,14 +165,14 @@ __a_evaluation:
@@ a2 = a0 - W6 * row[2];
@@ a3 = a0 - W2 * row[2];
@@ a0 = a0 + W2 * row[2];
- ldr r9, [r12, #offW4] @ R9=W4
+ ldr r9, =W4 @ R9=W4
mul r6, r9, r6 @ R6=W4*ROWr16[0]
- ldr r10, [r12, #offW6] @ R10=W6
+ ldr r10, =W6 @ R10=W6
ldrsh r4, [r14, #4] @ R4=ROWr16[2] (a3 not defined yet)
add r6, r6, #ROW_SHIFTED_1 @ R6=W4*ROWr16[0] + 1<<(ROW_SHIFT-1) (a0)
mul r11, r10, r4 @ R11=W6*ROWr16[2]
- ldr r8, [r12, #offW2] @ R8=W2
+ ldr r8, =W2 @ R8=W2
sub r3, r6, r11 @ R3=a0-W6*ROWr16[2] (a2)
@@ temp = ((uint32_t*)row)[2] | ((uint32_t*)row)[3];
@@ if (temp != 0) {}
@@ -248,7 +236,7 @@ __end_a_evaluation:
add r9, r2, r1 @ R9=a1+b1
@@ put 2 16 bits half-words in a 32bits word
@@ ROWr32[0]=ROWr16[0] | (ROWr16[1]<<16) (only Little Endian compliant then!!!)
- ldr r10, [r12, #offMASK_MSHW] @ R10=0xFFFF0000
+ ldr r10, =MASK_MSHW @ R10=0xFFFF0000
and r9, r10, r9, lsl #ROW_SHIFT2MSHW @ R9=0xFFFF0000 & ((a1+b1)<<5)
mvn r11, r10 @ R11= NOT R10= 0x0000FFFF
and r8, r11, r8, asr #ROW_SHIFT @ R8=0x0000FFFF & ((a0+b0)>>11)
@@ -319,13 +307,13 @@ __b_evaluation2:
@@ MAC16(b1, -W7, col[8x3]);
@@ MAC16(b2, -W1, col[8x3]);
@@ MAC16(b3, -W5, col[8x3]);
- ldr r8, [r12, #offW1] @ R8=W1
+ ldr r8, =W1 @ R8=W1
ldrsh r7, [r14, #16]
mul r0, r8, r7 @ R0=W1*ROWr16[1]=b0 (ROWr16[1] must be the second arg, to have the possibility to save 1 cycle)
- ldr r9, [r12, #offW3] @ R9=W3
- ldr r10, [r12, #offW5] @ R10=W5
+ ldr r9, =W3 @ R9=W3
+ ldr r10, =W5 @ R10=W5
mul r1, r9, r7 @ R1=W3*ROWr16[1]=b1 (ROWr16[1] must be the second arg, to have the possibility to save 1 cycle)
- ldr r11, [r12, #offW7] @ R11=W7
+ ldr r11, =W7 @ R11=W7
mul r5, r10, r7 @ R5=W5*ROWr16[1]=b2 (ROWr16[1] must be the second arg, to have the possibility to save 1 cycle)
ldrsh r2, [r14, #48]
mul r7, r11, r7 @ R7=W7*ROWr16[1]=b3 (ROWr16[1] must be the second arg, to have the possibility to save 1 cycle)
@@ -381,13 +369,13 @@ __a_evaluation2:
@@ a3 = a0 - W2 * row[2];
@@ a0 = a0 + W2 * row[2];
ldrsh r6, [r14, #0]
- ldr r9, [r12, #offW4] @ R9=W4
+ ldr r9, =W4 @ R9=W4
mul r6, r9, r6 @ R6=W4*ROWr16[0]
- ldr r10, [r12, #offW6] @ R10=W6
+ ldr r10, =W6 @ R10=W6
ldrsh r4, [r14, #32] @ R4=ROWr16[2] (a3 not defined yet)
add r6, r6, #COL_SHIFTED_1 @ R6=W4*ROWr16[0] + 1<<(COL_SHIFT-1) (a0)
mul r11, r10, r4 @ R11=W6*ROWr16[2]
- ldr r8, [r12, #offW2] @ R8=W2
+ ldr r8, =W2 @ R8=W2
add r2, r6, r11 @ R2=a0+W6*ROWr16[2] (a1)
sub r3, r6, r11 @ R3=a0-W6*ROWr16[2] (a2)
mul r11, r8, r4 @ R11=W2*ROWr16[2]
@@ -489,15 +477,3 @@ __end_bef_a_evaluation:
sub r4, r6, r11 @ R4=a0-W2*ROWr16[2] (a3)
add r6, r6, r11 @ R6=a0+W2*ROWr16[2] (a0)
bal __end_a_evaluation
-
-
- .align
-__constant_ptr__: @@ see #defines at the beginning of the source code for values.
- .word W1
- .word W2
- .word W3
- .word W4
- .word W5
- .word W6
- .word W7
- .word MASK_MSHW
diff --git a/gst-libs/ext/libav/libavcodec/arm/simple_idct_armv5te.S b/gst-libs/ext/libav/libavcodec/arm/simple_idct_armv5te.S
index 24641e4..bf509ee 100644
--- a/gst-libs/ext/libav/libavcodec/arm/simple_idct_armv5te.S
+++ b/gst-libs/ext/libav/libavcodec/arm/simple_idct_armv5te.S
@@ -21,7 +21,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "asm.S"
+#include "libavutil/arm/asm.S"
#define W1 22725 /* cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5 */
#define W2 21407 /* cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5 */
@@ -37,17 +37,11 @@
#define W26 (W2 | (W6 << 16))
#define W57 (W5 | (W7 << 16))
- .text
- .align
-w13: .long W13
-w26: .long W26
-w57: .long W57
-
function idct_row_armv5te
str lr, [sp, #-4]!
- ldrd v1, [a1, #8]
- ldrd a3, [a1] /* a3 = row[1:0], a4 = row[3:2] */
+ ldrd v1, v2, [a1, #8]
+ ldrd a3, a4, [a1] /* a3 = row[1:0], a4 = row[3:2] */
orrs v1, v1, v2
itt eq
cmpeq v1, a4
@@ -58,7 +52,7 @@ function idct_row_armv5te
mov ip, #16384
sub ip, ip, #1 /* ip = W4 */
smlabb v1, ip, a3, v1 /* v1 = W4*row[0]+(1<<(RS-1)) */
- ldr ip, w26 /* ip = W2 | (W6 << 16) */
+ ldr ip, =W26 /* ip = W2 | (W6 << 16) */
smultb a2, ip, a4
smulbb lr, ip, a4
add v2, v1, a2
@@ -66,8 +60,8 @@ function idct_row_armv5te
sub v4, v1, lr
add v1, v1, lr
- ldr ip, w13 /* ip = W1 | (W3 << 16) */
- ldr lr, w57 /* lr = W5 | (W7 << 16) */
+ ldr ip, =W13 /* ip = W1 | (W3 << 16) */
+ ldr lr, =W57 /* lr = W5 | (W7 << 16) */
smulbt v5, ip, a3
smultt v6, lr, a4
smlatt v5, ip, a4, v5
@@ -78,7 +72,7 @@ function idct_row_armv5te
smultt fp, lr, a3
sub v7, v7, a2
smulbt a2, lr, a4
- ldrd a3, [a1, #8] /* a3=row[5:4] a4=row[7:6] */
+ ldrd a3, a4, [a1, #8] /* a3=row[5:4] a4=row[7:6] */
sub fp, fp, a2
orrs a2, a3, a4
@@ -94,7 +88,7 @@ function idct_row_armv5te
smlatt v7, ip, a4, v7
sub fp, fp, a2
- ldr ip, w26 /* ip = W2 | (W6 << 16) */
+ ldr ip, =W26 /* ip = W2 | (W6 << 16) */
mov a2, #16384
sub a2, a2, #1 /* a2 = W4 */
smulbb a2, a2, a3 /* a2 = W4*row[4] */
@@ -121,7 +115,7 @@ function idct_row_armv5te
add a2, v4, fp
mov a2, a2, lsr #11
add a4, a4, a2, lsl #16
- strd a3, [a1]
+ strd a3, a4, [a1]
sub a2, v4, fp
mov a3, a2, lsr #11
@@ -135,7 +129,7 @@ function idct_row_armv5te
sub a2, v1, v5
mov a2, a2, lsr #11
add a4, a4, a2, lsl #16
- strd a3, [a1, #8]
+ strd a3, a4, [a1, #8]
ldr pc, [sp], #4
@@ -144,8 +138,8 @@ row_dc_only:
bic a3, a3, #0xe000
mov a3, a3, lsl #3
mov a4, a3
- strd a3, [a1]
- strd a3, [a1, #8]
+ strd a3, a4, [a1]
+ strd a3, a4, [a1, #8]
ldr pc, [sp], #4
endfunc
@@ -178,7 +172,7 @@ endfunc
sub v4, v2, a3
sub v6, v2, a3
add fp, v2, a3
- ldr ip, w26
+ ldr ip, =W26
ldr a4, [a1, #(16*2)]
add v2, v2, a3
@@ -211,9 +205,9 @@ endfunc
stmfd sp!, {v1, v2, v3, v4, v5, v6, v7, fp}
- ldr ip, w13
+ ldr ip, =W13
ldr a4, [a1, #(16*1)]
- ldr lr, w57
+ ldr lr, =W57
smulbb v1, ip, a4
smultb v3, ip, a4
smulbb v5, lr, a4
diff --git a/gst-libs/ext/libav/libavcodec/arm/simple_idct_armv6.S b/gst-libs/ext/libav/libavcodec/arm/simple_idct_armv6.S
index 284eb1f..0342b06 100644
--- a/gst-libs/ext/libav/libavcodec/arm/simple_idct_armv6.S
+++ b/gst-libs/ext/libav/libavcodec/arm/simple_idct_armv6.S
@@ -21,7 +21,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "asm.S"
+#include "libavutil/arm/asm.S"
#define W1 22725 /* cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5 */
#define W2 21407 /* cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5 */
@@ -40,15 +40,6 @@
#define W46 (W4 | (W6 << 16))
#define W57 (W5 | (W7 << 16))
- .text
- .align
-w13: .long W13
-w26: .long W26
-w42: .long W42
-w42n: .long W42n
-w46: .long W46
-w57: .long W57
-
/*
Compute partial IDCT of single row.
shift = left-shift amount
@@ -60,12 +51,12 @@ w57: .long W57
Output in registers r4--r11
*/
.macro idct_row shift
- ldr lr, w46 /* lr = W4 | (W6 << 16) */
+ ldr lr, =W46 /* lr = W4 | (W6 << 16) */
mov r1, #(1<<(\shift-1))
smlad r4, r2, ip, r1
smlsd r7, r2, ip, r1
- ldr ip, w13 /* ip = W1 | (W3 << 16) */
- ldr r10,w57 /* r10 = W5 | (W7 << 16) */
+ ldr ip, =W13 /* ip = W1 | (W3 << 16) */
+ ldr r10,=W57 /* r10 = W5 | (W7 << 16) */
smlad r5, r2, lr, r1
smlsd r6, r2, lr, r1
@@ -78,11 +69,11 @@ w57: .long W57
smlad r8, lr, r10,r8 /* B0 += W5*row[5] + W7*row[7] */
smusdx r10,r3, r1 /* r10 = B2 = W5*row[1] - W1*row[3] */
- ldr r3, w42n /* r3 = -W4 | (-W2 << 16) */
+ ldr r3, =W42n /* r3 = -W4 | (-W2 << 16) */
smlad r10,lr, r2, r10 /* B2 += W7*row[5] + W3*row[7] */
ldr r2, [r0, #4] /* r2 = row[6,4] */
smlsdx r11,lr, ip, r11 /* B3 += W3*row[5] - W1*row[7] */
- ldr ip, w46 /* ip = W4 | (W6 << 16) */
+ ldr ip, =W46 /* ip = W4 | (W6 << 16) */
smlad r9, lr, r1, r9 /* B1 -= W1*row[5] + W5*row[7] */
smlad r5, r2, r3, r5 /* A1 += -W4*row[4] - W2*row[6] */
@@ -101,12 +92,12 @@ w57: .long W57
Output in registers r4--r11
*/
.macro idct_row4 shift
- ldr lr, w46 /* lr = W4 | (W6 << 16) */
- ldr r10,w57 /* r10 = W5 | (W7 << 16) */
+ ldr lr, =W46 /* lr = W4 | (W6 << 16) */
+ ldr r10,=W57 /* r10 = W5 | (W7 << 16) */
mov r1, #(1<<(\shift-1))
smlad r4, r2, ip, r1
smlsd r7, r2, ip, r1
- ldr ip, w13 /* ip = W1 | (W3 << 16) */
+ ldr ip, =W13 /* ip = W1 | (W3 << 16) */
smlad r5, r2, lr, r1
smlsd r6, r2, lr, r1
smusdx r11,r3, r10 /* r11 = B3 = W7*row[1] - W5*row[3] */
@@ -205,7 +196,7 @@ function idct_row_armv6
cmpeq lr, r2, lsr #16
beq 1f
push {r1}
- ldr ip, w42 /* ip = W4 | (W2 << 16) */
+ ldr ip, =W42 /* ip = W4 | (W2 << 16) */
cmp lr, #0
beq 2f
@@ -249,7 +240,7 @@ function idct_col_armv6
push {r1, lr}
ldr r2, [r0] /* r2 = row[2,0] */
- ldr ip, w42 /* ip = W4 | (W2 << 16) */
+ ldr ip, =W42 /* ip = W4 | (W2 << 16) */
ldr r3, [r0, #8] /* r3 = row[3,1] */
idct_row COL_SHIFT
pop {r1}
@@ -277,7 +268,7 @@ function idct_col_put_armv6
push {r1, r2, lr}
ldr r2, [r0] /* r2 = row[2,0] */
- ldr ip, w42 /* ip = W4 | (W2 << 16) */
+ ldr ip, =W42 /* ip = W4 | (W2 << 16) */
ldr r3, [r0, #8] /* r3 = row[3,1] */
idct_row COL_SHIFT
pop {r1, r2}
@@ -307,7 +298,7 @@ function idct_col_add_armv6
push {r1, r2, lr}
ldr r2, [r0] /* r2 = row[2,0] */
- ldr ip, w42 /* ip = W4 | (W2 << 16) */
+ ldr ip, =W42 /* ip = W4 | (W2 << 16) */
ldr r3, [r0, #8] /* r3 = row[3,1] */
idct_row COL_SHIFT
pop {r1, r2}
diff --git a/gst-libs/ext/libav/libavcodec/arm/simple_idct_neon.S b/gst-libs/ext/libav/libavcodec/arm/simple_idct_neon.S
index 0c4e05d..b3e97d5 100644
--- a/gst-libs/ext/libav/libavcodec/arm/simple_idct_neon.S
+++ b/gst-libs/ext/libav/libavcodec/arm/simple_idct_neon.S
@@ -23,7 +23,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "asm.S"
+#include "libavutil/arm/asm.S"
#define W1 22725 //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
#define W2 21407 //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
@@ -159,8 +159,8 @@ function idct_col4_neon
vmull.s16 q15, d30, w4 /* q15 = W4*(col[0]+(1<<COL_SHIFT-1)/W4)*/
vld1.64 {d8}, [r2,:64], ip /* d5 = col[3] */
- ldrd r4, [r2]
- ldrd r6, [r2, #16]
+ ldrd r4, r5, [r2]
+ ldrd r6, r7, [r2, #16]
orrs r4, r4, r5
idct_col4_top
@@ -176,7 +176,7 @@ function idct_col4_neon
vadd.i32 q14, q14, q7
1: orrs r6, r6, r7
- ldrd r4, [r2, #16]
+ ldrd r4, r5, [r2, #16]
it eq
addeq r2, r2, #16
beq 2f
@@ -188,7 +188,7 @@ function idct_col4_neon
vmlal.s16 q6, d5, w3 /* q6 += W3 * col[5] */
2: orrs r4, r4, r5
- ldrd r4, [r2, #16]
+ ldrd r4, r5, [r2, #16]
it eq
addeq r2, r2, #16
beq 3f
diff --git a/gst-libs/ext/libav/libavcodec/arm/synth_filter_neon.S b/gst-libs/ext/libav/libavcodec/arm/synth_filter_neon.S
index 1d6e5b2..62bb667 100644
--- a/gst-libs/ext/libav/libavcodec/arm/synth_filter_neon.S
+++ b/gst-libs/ext/libav/libavcodec/arm/synth_filter_neon.S
@@ -18,9 +18,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "asm.S"
-
- preserve8
+#include "libavutil/arm/asm.S"
function ff_synth_filter_float_neon, export=1
push {r3-r11,lr}
diff --git a/gst-libs/ext/libav/libavcodec/arm/videodsp_arm.h b/gst-libs/ext/libav/libavcodec/arm/videodsp_arm.h
new file mode 100644
index 0000000..a708759
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/arm/videodsp_arm.h
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2009 Mans Rullgard <mans@mansr.com>
+ *
+ * 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
+ */
+
+#ifndef AVCODEC_ARM_VIDEODSP_ARM_H
+#define AVCODEC_ARM_VIDEODSP_ARM_H
+
+#include "libavcodec/avcodec.h"
+#include "libavcodec/videodsp.h"
+
+void ff_videodsp_init_armv5te(VideoDSPContext* ctx, int bpc);
+
+#endif /* AVCODEC_ARM_VIDEODSP_ARM_H */
diff --git a/gst-libs/ext/libav/libavcodec/arm/videodsp_armv5te.S b/gst-libs/ext/libav/libavcodec/arm/videodsp_armv5te.S
new file mode 100644
index 0000000..120069d
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/arm/videodsp_armv5te.S
@@ -0,0 +1,31 @@
+@
+@ ARMv5te optimized DSP utils
+@ Copyright (c) 2004 AGAWA Koji <i (AT) atty (DOT) jp>
+@
+@ 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
+@
+
+#include "config.h"
+#include "libavutil/arm/asm.S"
+
+function ff_prefetch_arm, export=1
+ subs r2, r2, #1
+ pld [r0]
+ add r0, r0, r1
+ bne ff_prefetch_arm
+ bx lr
+endfunc
diff --git a/gst-libs/ext/libav/libavcodec/arm/videodsp_init_arm.c b/gst-libs/ext/libav/libavcodec/arm/videodsp_init_arm.c
new file mode 100644
index 0000000..6c97b2c
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/arm/videodsp_init_arm.c
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2012 Ronald S. Bultje
+ *
+ * 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
+ */
+
+#include "libavutil/arm/cpu.h"
+#include "libavcodec/videodsp.h"
+#include "videodsp_arm.h"
+
+void ff_videodsp_init_arm(VideoDSPContext *ctx, int bpc)
+{
+ int cpu_flags = av_get_cpu_flags();
+ if (have_armv5te(cpu_flags)) ff_videodsp_init_armv5te(ctx, bpc);
+}
diff --git a/gst-libs/ext/libav/libavcodec/arm/videodsp_init_armv5te.c b/gst-libs/ext/libav/libavcodec/arm/videodsp_init_armv5te.c
new file mode 100644
index 0000000..a7b8b23
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/arm/videodsp_init_armv5te.c
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2012 Ronald S. Bultje
+ *
+ * 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
+ */
+
+#include "libavutil/arm/cpu.h"
+#include <libavcodec/videodsp.h>
+#include "videodsp_arm.h"
+
+void ff_prefetch_arm(uint8_t *mem, ptrdiff_t stride, int h);
+
+void ff_videodsp_init_armv5te(VideoDSPContext *ctx, int bpc)
+{
+ ctx->prefetch = ff_prefetch_arm;
+}
diff --git a/gst-libs/ext/libav/libavcodec/arm/vp3dsp_init_arm.c b/gst-libs/ext/libav/libavcodec/arm/vp3dsp_init_arm.c
new file mode 100644
index 0000000..ea99bfd
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/arm/vp3dsp_init_arm.c
@@ -0,0 +1,45 @@
+/*
+ * 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
+ */
+
+#include <stdint.h>
+
+#include "libavutil/attributes.h"
+#include "libavutil/cpu.h"
+#include "libavutil/arm/cpu.h"
+#include "libavcodec/vp3dsp.h"
+
+void ff_vp3_idct_put_neon(uint8_t *dest, int line_size, DCTELEM *data);
+void ff_vp3_idct_add_neon(uint8_t *dest, int line_size, DCTELEM *data);
+void ff_vp3_idct_dc_add_neon(uint8_t *dest, int line_size, const DCTELEM *data);
+
+void ff_vp3_v_loop_filter_neon(uint8_t *, int, int *);
+void ff_vp3_h_loop_filter_neon(uint8_t *, int, int *);
+
+av_cold void ff_vp3dsp_init_arm(VP3DSPContext *c, int flags)
+{
+ int cpu_flags = av_get_cpu_flags();
+
+ if (have_neon(cpu_flags)) {
+ c->idct_put = ff_vp3_idct_put_neon;
+ c->idct_add = ff_vp3_idct_add_neon;
+ c->idct_dc_add = ff_vp3_idct_dc_add_neon;
+ c->v_loop_filter = ff_vp3_v_loop_filter_neon;
+ c->h_loop_filter = ff_vp3_h_loop_filter_neon;
+ c->idct_perm = FF_TRANSPOSE_IDCT_PERM;
+ }
+}
diff --git a/gst-libs/ext/libav/libavcodec/arm/vp3dsp_neon.S b/gst-libs/ext/libav/libavcodec/arm/vp3dsp_neon.S
index 279b132..e09de57 100644
--- a/gst-libs/ext/libav/libavcodec/arm/vp3dsp_neon.S
+++ b/gst-libs/ext/libav/libavcodec/arm/vp3dsp_neon.S
@@ -18,7 +18,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "asm.S"
+#include "libavutil/arm/asm.S"
const vp3_idct_constants, align=4
.short 64277, 60547, 54491, 46341, 36410, 25080, 12785
@@ -116,9 +116,8 @@ function vp3_idct_start_neon
vadd.s16 q1, q8, q12
vsub.s16 q8, q8, q12
vld1.64 {d28-d31}, [r2,:128]!
-endfunc
-function vp3_idct_core_neon
+vp3_idct_core_neon:
vmull.s16 q2, d18, xC1S7 // (ip[1] * C1) << 16
vmull.s16 q3, d19, xC1S7
vmull.s16 q4, d2, xC4S4 // ((ip[0] + ip[4]) * C4) << 16
@@ -261,32 +260,6 @@ endfunc
VP3_IDCT_END row
VP3_IDCT_END col
-function ff_vp3_idct_neon, export=1
- mov ip, lr
- mov r2, r0
- bl vp3_idct_start_neon
- bl vp3_idct_end_row_neon
- mov r3, #8
- bl vp3_idct_core_neon
- bl vp3_idct_end_col_neon
- mov lr, ip
- vpop {d8-d15}
-
- vshr.s16 q8, q8, #4
- vshr.s16 q9, q9, #4
- vshr.s16 q10, q10, #4
- vshr.s16 q11, q11, #4
- vshr.s16 q12, q12, #4
- vst1.64 {d16-d19}, [r0,:128]!
- vshr.s16 q13, q13, #4
- vshr.s16 q14, q14, #4
- vst1.64 {d20-d23}, [r0,:128]!
- vshr.s16 q15, q15, #4
- vst1.64 {d24-d27}, [r0,:128]!
- vst1.64 {d28-d31}, [r0,:128]!
- bx lr
-endfunc
-
function ff_vp3_idct_put_neon, export=1
mov ip, lr
bl vp3_idct_start_neon
diff --git a/gst-libs/ext/libav/libavcodec/arm/vp56_arith.h b/gst-libs/ext/libav/libavcodec/arm/vp56_arith.h
index ef30ffe..6bc9456 100644
--- a/gst-libs/ext/libav/libavcodec/arm/vp56_arith.h
+++ b/gst-libs/ext/libav/libavcodec/arm/vp56_arith.h
@@ -29,7 +29,15 @@
# define T(x)
#endif
-#if HAVE_ARMV6 && HAVE_INLINE_ASM
+#if CONFIG_THUMB || defined __clang__
+# define L(x)
+# define U(x) x
+#else
+# define L(x) x
+# define U(x)
+#endif
+
+#if HAVE_ARMV6_INLINE
#define vp56_rac_get_prob vp56_rac_get_prob_armv6
static inline int vp56_rac_get_prob_armv6(VP56RangeCoder *c, int pr)
@@ -42,8 +50,8 @@ static inline int vp56_rac_get_prob_armv6(VP56RangeCoder *c, int pr)
__asm__ ("adds %3, %3, %0 \n"
"itt cs \n"
"cmpcs %7, %4 \n"
- A("ldrcsh %2, [%4], #2 \n")
- T("ldrhcs %2, [%4], #2 \n")
+ L("ldrcsh %2, [%4], #2 \n")
+ U("ldrhcs %2, [%4], #2 \n")
"rsb %0, %6, #256 \n"
"smlabb %0, %5, %6, %0 \n"
T("itttt cs \n")
@@ -80,8 +88,8 @@ static inline int vp56_rac_get_prob_branchy_armv6(VP56RangeCoder *c, int pr)
__asm__ ("adds %3, %3, %0 \n"
"itt cs \n"
"cmpcs %7, %4 \n"
- A("ldrcsh %2, [%4], #2 \n")
- T("ldrhcs %2, [%4], #2 \n")
+ L("ldrcsh %2, [%4], #2 \n")
+ U("ldrhcs %2, [%4], #2 \n")
"rsb %0, %6, #256 \n"
"smlabb %0, %5, %6, %0 \n"
T("itttt cs \n")
diff --git a/gst-libs/ext/libav/libavcodec/arm/vp56dsp_init_arm.c b/gst-libs/ext/libav/libavcodec/arm/vp56dsp_init_arm.c
index 5989602..afa5070 100644
--- a/gst-libs/ext/libav/libavcodec/arm/vp56dsp_init_arm.c
+++ b/gst-libs/ext/libav/libavcodec/arm/vp56dsp_init_arm.c
@@ -19,15 +19,19 @@
*/
#include <stdint.h>
+
+#include "libavutil/arm/cpu.h"
#include "libavcodec/avcodec.h"
#include "libavcodec/vp56dsp.h"
void ff_vp6_edge_filter_hor_neon(uint8_t *yuv, int stride, int t);
void ff_vp6_edge_filter_ver_neon(uint8_t *yuv, int stride, int t);
-void ff_vp56dsp_init_arm(VP56DSPContext *s, enum CodecID codec)
+void ff_vp56dsp_init_arm(VP56DSPContext *s, enum AVCodecID codec)
{
- if (codec != CODEC_ID_VP5 && HAVE_NEON) {
+ int cpu_flags = av_get_cpu_flags();
+
+ if (codec != AV_CODEC_ID_VP5 && have_neon(cpu_flags)) {
s->edge_filter_hor = ff_vp6_edge_filter_hor_neon;
s->edge_filter_ver = ff_vp6_edge_filter_ver_neon;
}
diff --git a/gst-libs/ext/libav/libavcodec/arm/vp56dsp_neon.S b/gst-libs/ext/libav/libavcodec/arm/vp56dsp_neon.S
index b95d8ab..10b4d0f 100644
--- a/gst-libs/ext/libav/libavcodec/arm/vp56dsp_neon.S
+++ b/gst-libs/ext/libav/libavcodec/arm/vp56dsp_neon.S
@@ -18,7 +18,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "asm.S"
+#include "libavutil/arm/asm.S"
.macro vp6_edge_filter
vdup.16 q3, r2 @ t
diff --git a/gst-libs/ext/libav/libavcodec/arm/vp8.h b/gst-libs/ext/libav/libavcodec/arm/vp8.h
index 76a0397..5ce17a4 100644
--- a/gst-libs/ext/libav/libavcodec/arm/vp8.h
+++ b/gst-libs/ext/libav/libavcodec/arm/vp8.h
@@ -1,4 +1,4 @@
-/**
+/*
* This file is part of Libav.
*
* Libav is free software; you can redistribute it and/or
@@ -19,7 +19,9 @@
#ifndef AVCODEC_ARM_VP8_H
#define AVCODEC_ARM_VP8_H
-#if HAVE_ARMV6
+#include "config.h"
+
+#if HAVE_ARMV6_EXTERNAL
#define decode_block_coeffs_internal ff_decode_block_coeffs_armv6
int ff_decode_block_coeffs_armv6(VP56RangeCoder *rc, DCTELEM block[16],
uint8_t probs[8][3][NUM_DCT_TOKENS-1],
diff --git a/gst-libs/ext/libav/libavcodec/arm/vp8_armv6.S b/gst-libs/ext/libav/libavcodec/arm/vp8_armv6.S
index 594046d..3863dc3 100644
--- a/gst-libs/ext/libav/libavcodec/arm/vp8_armv6.S
+++ b/gst-libs/ext/libav/libavcodec/arm/vp8_armv6.S
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (C) 2010 Mans Rullgard
*
* This file is part of Libav.
@@ -18,7 +18,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "asm.S"
+#include "libavutil/arm/asm.S"
.macro rac_get_prob h, bs, buf, cw, pr, t0, t1
adds \bs, \bs, \t0
@@ -65,7 +65,7 @@ T orrcs \cw, \cw, \t1
function ff_decode_block_coeffs_armv6, export=1
push {r0,r1,r4-r11,lr}
- movrel lr, X(ff_vp56_norm_shift)
+ movrelx lr, X(ff_vp56_norm_shift)
ldrd r4, r5, [sp, #44] @ token_prob, qmul
cmp r3, #0
ldr r11, [r5]
@@ -88,7 +88,7 @@ function ff_decode_block_coeffs_armv6, export=1
add r4, r3, r3, lsl #5
sxth r12, r11
- add r4, r2, r4
+ add r4, r4, r2
adds r6, r6, r9
add r4, r4, #11
lsl r8, r8, r9
@@ -138,7 +138,7 @@ A orrcs r8, r8, r10, lsl r6
2:
add r4, r3, r3, lsl #5
cmp r3, #16
- add r4, r2, r4
+ add r4, r4, r2
pkhtb r11, r11, r11, asr #16
bne 0b
b 6b
@@ -206,7 +206,7 @@ A orrcs r8, r8, r10, lsl r6
mov r9, #8
it ge
addge r12, r12, #1
- movrel r4, X(ff_vp8_dct_cat_prob)
+ movrelx r4, X(ff_vp8_dct_cat_prob), r1
lsl r9, r9, r12
ldr r4, [r4, r12, lsl #2]
add r12, r9, #3
@@ -226,7 +226,7 @@ A orrcs r8, r8, r10, lsl r6
ldr r1, [sp, #4]
4:
add r4, r3, r3, lsl #5
- add r4, r2, r4
+ add r4, r4, r2
add r4, r4, #22
rac_get_128 r5, r6, r7, r8, r9, r10
it ge
diff --git a/gst-libs/ext/libav/libavcodec/arm/vp8dsp.h b/gst-libs/ext/libav/libavcodec/arm/vp8dsp.h
new file mode 100644
index 0000000..ce00e4a
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/arm/vp8dsp.h
@@ -0,0 +1,78 @@
+/*
+ * 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
+ */
+
+#ifndef AVCODEC_ARM_VP8DSP_H
+#define AVCODEC_ARM_VP8DSP_H
+
+#include "libavcodec/vp8dsp.h"
+
+void ff_vp8dsp_init_armv6(VP8DSPContext *dsp);
+void ff_vp8dsp_init_neon(VP8DSPContext *dsp);
+
+#define VP8_LF_Y(hv, inner, opt) \
+ void ff_vp8_##hv##_loop_filter16##inner##_##opt(uint8_t *dst, \
+ ptrdiff_t stride, \
+ int flim_E, int flim_I, \
+ int hev_thresh)
+
+#define VP8_LF_UV(hv, inner, opt) \
+ void ff_vp8_##hv##_loop_filter8uv##inner##_##opt(uint8_t *dstU, \
+ uint8_t *dstV, \
+ ptrdiff_t stride, \
+ int flim_E, int flim_I, \
+ int hev_thresh)
+
+#define VP8_LF_SIMPLE(hv, opt) \
+ void ff_vp8_##hv##_loop_filter16_simple_##opt(uint8_t *dst, \
+ ptrdiff_t stride, \
+ int flim)
+
+#define VP8_LF_HV(inner, opt) \
+ VP8_LF_Y(h, inner, opt); \
+ VP8_LF_Y(v, inner, opt); \
+ VP8_LF_UV(h, inner, opt); \
+ VP8_LF_UV(v, inner, opt)
+
+#define VP8_LF(opt) \
+ VP8_LF_HV(, opt); \
+ VP8_LF_HV(_inner, opt); \
+ VP8_LF_SIMPLE(h, opt); \
+ VP8_LF_SIMPLE(v, opt)
+
+#define VP8_MC(n, opt) \
+ void ff_put_vp8_##n##_##opt(uint8_t *dst, ptrdiff_t dststride, \
+ uint8_t *src, ptrdiff_t srcstride, \
+ int h, int x, int y)
+
+#define VP8_EPEL(w, opt) \
+ VP8_MC(pixels ## w, opt); \
+ VP8_MC(epel ## w ## _h4, opt); \
+ VP8_MC(epel ## w ## _h6, opt); \
+ VP8_MC(epel ## w ## _v4, opt); \
+ VP8_MC(epel ## w ## _h4v4, opt); \
+ VP8_MC(epel ## w ## _h6v4, opt); \
+ VP8_MC(epel ## w ## _v6, opt); \
+ VP8_MC(epel ## w ## _h4v6, opt); \
+ VP8_MC(epel ## w ## _h6v6, opt)
+
+#define VP8_BILIN(w, opt) \
+ VP8_MC(bilin ## w ## _h, opt); \
+ VP8_MC(bilin ## w ## _v, opt); \
+ VP8_MC(bilin ## w ## _hv, opt)
+
+#endif /* AVCODEC_ARM_VP8DSP_H */
diff --git a/gst-libs/ext/libav/libavcodec/arm/vp8dsp_armv6.S b/gst-libs/ext/libav/libavcodec/arm/vp8dsp_armv6.S
new file mode 100644
index 0000000..4047aab
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/arm/vp8dsp_armv6.S
@@ -0,0 +1,1634 @@
+/*
+ * VP8 ARMv6 optimisations
+ *
+ * Copyright (c) 2010 Google Inc.
+ * Copyright (c) 2010 Rob Clark <rob@ti.com>
+ * Copyright (c) 2011 Mans Rullgard <mans@mansr.com>
+ *
+ * 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
+ *
+ * This code was partially ported from libvpx, which uses this license:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * Neither the name of Google nor the names of its contributors may
+ * be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "libavutil/arm/asm.S"
+
+@ idct
+
+@ void vp8_luma_dc_wht(DCTELEM block[4][4][16], DCTELEM dc[16])
+function ff_vp8_luma_dc_wht_armv6, export=1
+ push {r4-r10, lr}
+
+ ldm r1, {r2-r9}
+ mov r10, #0
+ mov lr, #0
+ uadd16 r12, r2, r8 @ t0[0,1]
+ usub16 r2, r2, r8 @ t3[0,1]
+ stm r1!, {r10, lr}
+ uadd16 r8, r4, r6 @ t1[0,1]
+ usub16 r4, r4, r6 @ t2[0,1]
+ stm r1!, {r10, lr}
+ uadd16 r6, r12, r8 @ dc0[0,1]
+ usub16 r12, r12, r8 @ dc2[0,1]
+ stm r1!, {r10, lr}
+ uadd16 r8, r2, r4 @ dc1[0,1]
+ usub16 r2, r2, r4 @ dc3[0,1]
+ stm r1!, {r10, lr}
+
+ uadd16 lr, r3, r9 @ t0[2,3]
+ usub16 r3, r3, r9 @ t3[2,3]
+ uadd16 r9, r5, r7 @ t1[2,3]
+ usub16 r5, r5, r7 @ t2[2,3]
+
+ uadd16 r7, lr, r9 @ dc0[2,3]
+ usub16 lr, lr, r9 @ dc2[2,3]
+ uadd16 r9, r3, r5 @ dc1[2,3]
+ usub16 r3, r3, r5 @ dc3[2,3]
+
+ mov r1, #3
+ orr r1, r1, #0x30000 @ 3 | 3 (round)
+
+ pkhbt r4, r6, r8, lsl #16 @ dc{0,1}[0]
+ pkhtb r6, r8, r6, asr #16 @ dc{0,1}[1]
+ pkhbt r5, r12, r2, lsl #16 @ dc{2,3}[0]
+ pkhtb r12, r2, r12, asr #16 @ dc{2,3}[1]
+ pkhbt r8, r7, r9, lsl #16 @ dc{0,1}[2]
+ uadd16 r4, r4, r1
+ uadd16 r5, r5, r1
+ pkhtb r7, r9, r7, asr #16 @ dc{0,1}[3]
+ pkhbt r2, lr, r3, lsl #16 @ dc{2,3}[2]
+ pkhtb lr, r3, lr, asr #16 @ dc{2,3}[3]
+
+ uadd16 r9, r4, r7 @ t0[0,1]
+ uadd16 r3, r5, lr @ t0[2,3]
+ usub16 r4, r4, r7 @ t3[0,1]
+ usub16 r5, r5, lr @ t3[2,3]
+ uadd16 r7, r6, r8 @ t1[0,1]
+ uadd16 lr, r12, r2 @ t1[2,3]
+ usub16 r6, r6, r8 @ t2[0,1]
+ usub16 r12, r12, r2 @ t2[2,3]
+
+ uadd16 r8, r9, r7 @ block[0,1][0]
+ uadd16 r2, r3, lr @ block[2,3][0]
+ usub16 r9, r9, r7 @ block[0,1][2]
+ usub16 r3, r3, lr @ block[2,3][2]
+ uadd16 r7, r4, r6 @ block[0,1][1]
+ uadd16 lr, r5, r12 @ block[2,3][1]
+ usub16 r4, r4, r6 @ block[0,1][3]
+ usub16 r5, r5, r12 @ block[2,3][3]
+
+#if HAVE_ARMV6T2_EXTERNAL
+ sbfx r6, r8, #3, #13
+ sbfx r12, r7, #3, #13
+ sbfx r1, r9, #3, #13
+ sbfx r10, r4, #3, #13
+#else
+ sxth r6, r8
+ sxth r12, r7
+ sxth r1, r9
+ sxth r10, r4
+ asr r6, #3 @ block[0][0]
+ asr r12, #3 @ block[0][1]
+ asr r1, #3 @ block[0][2]
+ asr r10, #3 @ block[0][3]
+#endif
+
+ strh r6, [r0], #32
+ asr r8, r8, #19 @ block[1][0]
+ strh r12, [r0], #32
+ asr r7, r7, #19 @ block[1][1]
+ strh r1, [r0], #32
+ asr r9, r9, #19 @ block[1][2]
+ strh r10, [r0], #32
+ asr r4, r4, #19 @ block[1][3]
+ strh r8, [r0], #32
+ asr r6, r2, #19 @ block[3][0]
+ strh r7, [r0], #32
+ asr r12, lr, #19 @ block[3][1]
+ strh r9, [r0], #32
+ asr r1, r3, #19 @ block[3][2]
+ strh r4, [r0], #32
+ asr r10, r5, #19 @ block[3][3]
+
+#if HAVE_ARMV6T2_EXTERNAL
+ sbfx r2, r2, #3, #13
+ sbfx lr, lr, #3, #13
+ sbfx r3, r3, #3, #13
+ sbfx r5, r5, #3, #13
+#else
+ sxth r2, r2
+ sxth lr, lr
+ sxth r3, r3
+ sxth r5, r5
+ asr r2, #3 @ block[2][0]
+ asr lr, #3 @ block[2][1]
+ asr r3, #3 @ block[2][2]
+ asr r5, #3 @ block[2][3]
+#endif
+
+ strh r2, [r0], #32
+ strh lr, [r0], #32
+ strh r3, [r0], #32
+ strh r5, [r0], #32
+ strh r6, [r0], #32
+ strh r12, [r0], #32
+ strh r1, [r0], #32
+ strh r10, [r0], #32
+
+ pop {r4-r10, pc}
+endfunc
+
+@ void vp8_luma_dc_wht_dc(DCTELEM block[4][4][16], DCTELEM dc[16])
+function ff_vp8_luma_dc_wht_dc_armv6, export=1
+ ldrsh r2, [r1]
+ mov r3, #0
+ add r2, r2, #3
+ strh r3, [r1]
+ asr r2, r2, #3
+ .rept 16
+ strh r2, [r0], #32
+ .endr
+ bx lr
+endfunc
+
+@ void vp8_idct_add(uint8_t *dst, DCTELEM block[16], int stride)
+function ff_vp8_idct_add_armv6, export=1
+ push {r4-r12, lr}
+ sub sp, sp, #32
+
+ movw r3, #20091 @ cospi8sqrt2minus1
+ movw r4, #35468 @ sinpi8sqrt2
+ mov r5, sp
+1:
+ ldr r6, [r1, #8] @ i5 | i4 = block1[1] | block1[0]
+ ldr lr, [r1, #16] @ i9 | i8 = block2[1] | block2[0]
+ ldr r12, [r1, #24] @ i13 | i12 = block3[1] | block3[0]
+
+ smulwt r9, r3, r6 @ ip[5] * cospi8sqrt2minus1
+ smulwb r7, r3, r6 @ ip[4] * cospi8sqrt2minus1
+ smulwt r10, r4, r6 @ ip[5] * sinpi8sqrt2
+ smulwb r8, r4, r6 @ ip[4] * sinpi8sqrt2
+ pkhbt r7, r7, r9, lsl #16 @ 5c | 4c
+ smulwt r11, r3, r12 @ ip[13] * cospi8sqrt2minus1
+ pkhbt r8, r8, r10, lsl #16 @ 5s | 4s = t2 first half
+ uadd16 r6, r6, r7 @ 5c+5 | 4c+4 = t3 first half
+ smulwb r9, r3, r12 @ ip[12] * cospi8sqrt2minus1
+ smulwt r7, r4, r12 @ ip[13] * sinpi8sqrt2
+ smulwb r10, r4, r12 @ ip[12] * sinpi8sqrt2
+
+ pkhbt r9, r9, r11, lsl #16 @ 13c | 12c
+ ldr r11, [r1] @ i1 | i0
+ pkhbt r10, r10, r7, lsl #16 @ 13s | 12s = t3 second half
+ uadd16 r7, r12, r9 @ 13c+13 | 12c+12 = t2 2nd half
+ uadd16 r6, r6, r10 @ d = t3
+ uadd16 r10, r11, lr @ a = t0
+ usub16 r7, r8, r7 @ c = t2
+ usub16 r8, r11, lr @ b = t1
+ uadd16 r9, r10, r6 @ a+d = tmp{0,1}[0]
+ usub16 r10, r10, r6 @ a-d = tmp{0,1}[3]
+ uadd16 r6, r8, r7 @ b+c = tmp{0,1}[1]
+ usub16 r7, r8, r7 @ b-c = tmp{0,1}[2]
+ mov r8, #0
+ cmp sp, r5
+ str r6, [r5, #8] @ o5 | o4
+ str r7, [r5, #16] @ o9 | o8
+ str r10, [r5, #24] @ o13 | o12
+ str r9, [r5], #4 @ o1 | o0
+ str r8, [r1, #8]
+ str r8, [r1, #16]
+ str r8, [r1, #24]
+ str r8, [r1], #4
+ beq 1b
+
+ mov r5, #2
+2:
+ pop {r1, r6, r12, lr}
+ smulwt r9, r3, r12 @ ip[5] * cospi8sqrt2minus1
+ smulwt r7, r3, r1 @ ip[1] * cospi8sqrt2minus1
+ smulwt r10, r4, r12 @ ip[5] * sinpi8sqrt2
+ smulwt r8, r4, r1 @ ip[1] * sinpi8sqrt2
+ pkhbt r11, r1, r12, lsl #16 @ i4 | i0 = t0/t1 first half
+ pkhtb r1, r12, r1, asr #16 @ i5 | i1
+ pkhbt r7, r7, r9, lsl #16 @ 5c | 1c
+ pkhbt r8, r8, r10, lsl #16 @ 5s | 1s = t2 first half
+ pkhbt r9, r6, lr, lsl #16 @ i6 | i2 = t0/t1 second half
+ pkhtb r12, lr, r6, asr #16 @ i7 | i3
+ uadd16 r1, r7, r1 @ 5c+5 | 1c+1 = t3 first half
+ uadd16 r10, r11, r9 @ a = t0
+ usub16 r9, r11, r9 @ b = t1
+ smulwt r7, r3, r12 @ ip[7] * cospi8sqrt2minus1
+ smulwb lr, r3, r12 @ ip[3] * cospi8sqrt2minus1
+ smulwt r11, r4, r12 @ ip[7] * sinpi8sqrt2
+ smulwb r6, r4, r12 @ ip[3] * sinpi8sqrt2
+ subs r5, r5, #1
+ pkhbt r7, lr, r7, lsl #16 @ 7c | 3c
+ pkhbt r11, r6, r11, lsl #16 @ 7s | 3s = t3 second half
+ mov r6, #0x4
+ orr r6, r6, #0x40000
+ uadd16 r12, r7, r12 @ 7c+7 | 3c+3 = t2 second half
+ uadd16 r10, r10, r6 @ t0 + 4
+ uadd16 r9, r9, r6 @ t1 + 4
+ usub16 lr, r8, r12 @ c (o5 | o1) = t2
+ uadd16 r12, r11, r1 @ d (o7 | o3) = t3
+ usub16 r1, r9, lr @ b-c = dst{0,1}[2]
+ uadd16 r7, r10, r12 @ a+d = dst{0,1}[0]
+ usub16 r12, r10, r12 @ a-d = dst{0,1}[3]
+ uadd16 r10, r9, lr @ b+c = dst{0,1}[1]
+
+ asr lr, r1, #3 @ o[1][2]
+ asr r9, r12, #3 @ o[1][3]
+ pkhtb r8, lr, r7, asr #19 @ o[1][0,2]
+ pkhtb r11, r9, r10, asr #19 @ o[1][1,3]
+ ldr lr, [r0]
+ sxth r12, r12
+ ldr r9, [r0, r2]
+ sxth r1, r1
+#if HAVE_ARMV6T2_EXTERNAL
+ sbfx r7, r7, #3, #13
+ sbfx r10, r10, #3, #13
+#else
+ sxth r7, r7
+ sxth r10, r10
+ asr r7, #3 @ o[0][0]
+ asr r10, #3 @ o[0][1]
+#endif
+ pkhbt r7, r7, r1, lsl #13 @ o[0][0,2]
+ pkhbt r10, r10, r12, lsl #13 @ o[0][1,3]
+
+ uxtab16 r7, r7, lr
+ uxtab16 r10, r10, lr, ror #8
+ uxtab16 r8, r8, r9
+ uxtab16 r11, r11, r9, ror #8
+ usat16 r7, #8, r7
+ usat16 r10, #8, r10
+ usat16 r8, #8, r8
+ usat16 r11, #8, r11
+ orr r7, r7, r10, lsl #8
+ orr r8, r8, r11, lsl #8
+ str r8, [r0, r2]
+ str_post r7, r0, r2, lsl #1
+
+ bne 2b
+
+ pop {r4-r12, pc}
+endfunc
+
+@ void vp8_idct_dc_add(uint8_t *dst, DCTELEM block[16], int stride)
+function ff_vp8_idct_dc_add_armv6, export=1
+ push {r4-r6, lr}
+ add r6, r0, r2, lsl #1
+ ldrsh r3, [r1]
+ mov r4, #0
+ add r3, r3, #4
+ strh r4, [r1], #32
+ asr r3, #3
+ ldr r5, [r0]
+ ldr r4, [r0, r2]
+ pkhbt r3, r3, r3, lsl #16
+ uxtab16 lr, r3, r5 @ a1+2 | a1+0
+ uxtab16 r5, r3, r5, ror #8 @ a1+3 | a1+1
+ uxtab16 r12, r3, r4
+ uxtab16 r4, r3, r4, ror #8
+ usat16 lr, #8, lr
+ usat16 r5, #8, r5
+ usat16 r12, #8, r12
+ usat16 r4, #8, r4
+ orr lr, lr, r5, lsl #8
+ ldr r5, [r6]
+ orr r12, r12, r4, lsl #8
+ ldr r4, [r6, r2]
+ str lr, [r0]
+ uxtab16 lr, r3, r5
+ str r12, [r0, r2]
+ uxtab16 r5, r3, r5, ror #8
+ uxtab16 r12, r3, r4
+ uxtab16 r4, r3, r4, ror #8
+ usat16 lr, #8, lr
+ usat16 r5, #8, r5
+ usat16 r12, #8, r12
+ usat16 r4, #8, r4
+ orr lr, lr, r5, lsl #8
+ orr r12, r12, r4, lsl #8
+ str lr, [r6]
+ str r12, [r6, r2]
+ pop {r4-r6, pc}
+endfunc
+
+@ void vp8_idct_dc_add4uv(uint8_t *dst, DCTELEM block[4][16], int stride)
+function ff_vp8_idct_dc_add4uv_armv6, export=1
+ push {r4, lr}
+
+ bl ff_vp8_idct_dc_add_armv6
+ add r0, r0, #4
+ bl ff_vp8_idct_dc_add_armv6
+ add r0, r0, r2, lsl #2
+ sub r0, r0, #4
+ bl ff_vp8_idct_dc_add_armv6
+ add r0, r0, #4
+ bl ff_vp8_idct_dc_add_armv6
+
+ pop {r4, pc}
+endfunc
+
+@ void vp8_idct_dc_add4y(uint8_t *dst, DCTELEM block[4][16], int stride)
+function ff_vp8_idct_dc_add4y_armv6, export=1
+ push {r4, lr}
+
+ bl ff_vp8_idct_dc_add_armv6
+ add r0, r0, #4
+ bl ff_vp8_idct_dc_add_armv6
+ add r0, r0, #4
+ bl ff_vp8_idct_dc_add_armv6
+ add r0, r0, #4
+ bl ff_vp8_idct_dc_add_armv6
+
+ pop {r4, pc}
+endfunc
+
+@ loopfilter
+
+.macro transpose o3, o2, o1, o0, i0, i1, i2, i3
+ uxtb16 \o1, \i1 @ xx 12 xx 10
+ uxtb16 \o0, \i0 @ xx 02 xx 00
+ uxtb16 \o3, \i3 @ xx 32 xx 30
+ uxtb16 \o2, \i2 @ xx 22 xx 20
+ orr \o1, \o0, \o1, lsl #8 @ 12 02 10 00
+ orr \o3, \o2, \o3, lsl #8 @ 32 22 30 20
+
+ uxtb16 \i1, \i1, ror #8 @ xx 13 xx 11
+ uxtb16 \i3, \i3, ror #8 @ xx 33 xx 31
+ uxtb16 \i0, \i0, ror #8 @ xx 03 xx 01
+ uxtb16 \i2, \i2, ror #8 @ xx 23 xx 21
+ orr \i0, \i0, \i1, lsl #8 @ 13 03 11 01
+ orr \i2, \i2, \i3, lsl #8 @ 33 23 31 21
+
+ pkhtb \o2, \o3, \o1, asr #16 @ 32 22 12 02
+ pkhbt \o0, \o1, \o3, lsl #16 @ 30 20 10 00
+ pkhtb \o3, \i2, \i0, asr #16 @ 33 23 13 03
+ pkhbt \o1, \i0, \i2, lsl #16 @ 31 21 11 01
+.endm
+
+.macro simple_filter
+ uqsub8 r7, r3, r6 @ p1 - q1
+ uqsub8 r8, r6, r3 @ q1 - p1
+ uqsub8 r10, r4, r5 @ p0 - q0
+ uqsub8 r9, r5, r4 @ q0 - p0
+ orr r7, r7, r8 @ abs(p1 - q1)
+ orr r9, r9, r10 @ abs(p0 - q0)
+ uhadd8 r7, r7, lr @ abs(p1 - q2) >> 1
+ uqadd8 r9, r9, r9 @ abs(p0 - q0) * 2
+ uqadd8 r7, r7, r9 @ abs(p0 - q0)*2 + abs(p1-q1)/2
+ mvn r8, #0
+ usub8 r10, r12, r7 @ compare to flimit
+ sel r10, r8, lr @ filter mask: F or 0
+ cmp r10, #0
+ beq 2f
+
+ eor r3, r3, r2 @ ps1
+ eor r6, r6, r2 @ qs1
+ eor r4, r4, r2 @ ps0
+ eor r5, r5, r2 @ qs0
+
+ qsub8 r3, r3, r6 @ vp8_filter = p1 - q1
+ qsub8 r6, r5, r4 @ q0 - p0
+ qadd8 r3, r3, r6 @ += q0 - p0
+ lsr r7, r2, #5 @ 0x04040404
+ qadd8 r3, r3, r6 @ += q0 - p0
+ sub r9, r7, r2, lsr #7 @ 0x03030303
+ qadd8 r3, r3, r6 @ vp8_filter = p1-q1 + 3*(q0-p0)
+ and r3, r3, r10 @ vp8_filter &= mask
+
+ qadd8 r9, r3, r9 @ Filter2 = vp8_filter + 3
+ qadd8 r3, r3, r7 @ Filter1 = vp8_filter + 4
+
+ shadd8 r9, r9, lr
+ shadd8 r3, r3, lr
+ shadd8 r9, r9, lr
+ shadd8 r3, r3, lr
+ shadd8 r9, r9, lr @ Filter2 >>= 3
+ shadd8 r3, r3, lr @ Filter1 >>= 3
+
+ qadd8 r4, r4, r9 @ u = p0 + Filter2
+ qsub8 r5, r5, r3 @ u = q0 - Filter1
+ eor r4, r4, r2 @ *op0 = u ^ 0x80
+ eor r5, r5, r2 @ *oq0 = u ^ 0x80
+.endm
+
+@ void vp8_v_loop_filter16_simple(uint8_t *dst, int stride, int flim)
+function ff_vp8_v_loop_filter16_simple_armv6, export=1
+ push {r4-r11, lr}
+
+ orr r2, r2, r2, lsl #16
+ mov r11, #4
+ mov lr, #0
+ orr r12, r2, r2, lsl #8
+ mov32 r2, 0x80808080
+1:
+ ldr_nreg r3, r0, r1, lsl #1 @ p1
+ ldr_nreg r4, r0, r1 @ p0
+ ldr r5, [r0] @ q0
+ ldr r6, [r0, r1] @ q1
+ simple_filter
+T sub r7, r0, r1
+ str r5, [r0] @ oq0
+A str r4, [r0, -r1] @ op0
+T str r4, [r7]
+2:
+ subs r11, r11, #1
+ add r0, r0, #4
+ bne 1b
+
+ pop {r4-r11, pc}
+endfunc
+
+.macro filter_mask_p
+ uqsub8 r6, r9, r10 @ p3 - p2
+ uqsub8 r7, r10, r9 @ p2 - p3
+ uqsub8 r8, r10, r11 @ p2 - p1
+ uqsub8 r10, r11, r10 @ p1 - p2
+ orr r6, r6, r7 @ abs(p3-p2)
+ orr r8, r8, r10 @ abs(p2-p1)
+ uqsub8 lr, r6, r2 @ compare to limit
+ uqsub8 r8, r8, r2 @ compare to limit
+ uqsub8 r6, r11, r12 @ p1 - p0
+ orr lr, lr, r8
+ uqsub8 r7, r12, r11 @ p0 - p1
+ orr r6, r6, r7 @ abs(p1-p0)
+ uqsub8 r7, r6, r2 @ compare to limit
+ uqsub8 r8, r6, r3 @ compare to thresh
+ orr lr, lr, r7
+.endm
+
+.macro filter_mask_pq
+ uqsub8 r6, r11, r10 @ p1 - q1
+ uqsub8 r7, r10, r11 @ q1 - p1
+ uqsub8 r11, r12, r9 @ p0 - q0
+ uqsub8 r12, r9, r12 @ q0 - p0
+ orr r6, r6, r7 @ abs(p1-q1)
+ orr r12, r11, r12 @ abs(p0-q0)
+ mov32 r7, 0x7f7f7f7f
+ uqadd8 r12, r12, r12 @ abs(p0-q0) * 2
+ and r6, r7, r6, lsr #1 @ abs(p1-q1) / 2
+ uqadd8 r12, r12, r6 @ abs(p0-q0) * 2 + abs(p1-q1)/2
+.endm
+
+.macro filter_mask_v
+ filter_mask_p
+
+ ldr r10, [r0, r1] @ q1
+ ldr_post r9, r0, r1, lsl #1 @ q0
+
+ filter_mask_pq
+
+ ldr r11, [r0] @ q2
+
+ uqsub8 r7, r9, r10 @ q0 - q1
+ uqsub8 r6, r10, r9 @ q1 - q0
+ uqsub8 r12, r12, r4 @ compare to flimit
+ uqsub8 r9, r11, r10 @ q2 - q1
+ uqsub8 r10, r10, r11 @ q1 - q2
+ orr lr, lr, r12
+ ldr r12, [r0, r1] @ q3
+ orr r6, r7, r6 @ abs(q1-q0)
+ orr r10, r9, r10 @ abs(q2-q1)
+ uqsub8 r9, r12, r11 @ q3 - q2
+ uqsub8 r11, r11, r12 @ q2 - q3
+ uqsub8 r7, r6, r2 @ compare to limit
+ uqsub8 r10, r10, r2 @ compare to limit
+ uqsub8 r6, r6, r3 @ compare to thresh
+ orr r9, r9, r11 @ abs(q3-q2)
+ orr lr, lr, r7
+ orr lr, lr, r10
+ uqsub8 r9, r9, r2 @ compare to limit
+ orr lr, lr, r9
+
+ mov r12, #0
+ usub8 lr, r12, lr
+ mvn r11, #0
+ sel lr, r11, r12 @ filter mask
+ sub r0, r0, r1, lsl #1
+.endm
+
+.macro filter_mask_h
+ transpose r12, r11, r10, r9, r6, r7, r8, lr
+
+ filter_mask_p
+
+ stm sp, {r8, r11, r12, lr}
+ sub r0, r0, r1, lsl #2
+ add r0, r0, #4
+
+ ldr r7, [r0, r1]
+ ldr_post r6, r0, r1, lsl #1
+ ldr lr, [r0, r1]
+ ldr r8, [r0]
+
+ transpose r12, r11, r10, r9, r6, r7, r8, lr
+
+ uqsub8 r8, r12, r11 @ q3 - q2
+ uqsub8 lr, r11, r12 @ q2 - q3
+ uqsub8 r7, r9, r10 @ q0 - q1
+ uqsub8 r6, r10, r9 @ q1 - q0
+ uqsub8 r12, r11, r10 @ q2 - q1
+ uqsub8 r11, r10, r11 @ q1 - q2
+ orr r8, r8, lr @ abs(q3-q2)
+ orr r6, r7, r6 @ abs(q1-q0)
+ orr r11, r12, r11 @ abs(q2-q1)
+ ldr lr, [sp, #12] @ load back (f)limit accumulator
+ uqsub8 r8, r8, r2 @ compare to limit
+ uqsub8 r7, r6, r2 @ compare to limit
+ uqsub8 r11, r11, r2 @ compare to limit
+ orr lr, lr, r8
+ uqsub8 r8, r6, r3 @ compare to thresh
+ orr lr, lr, r7
+ ldr r12, [sp, #8] @ p1
+ orr lr, lr, r11
+
+ ldr r11, [sp, #4] @ p0
+
+ filter_mask_pq
+
+ mov r10, #0
+ uqsub8 r12, r12, r4 @ compare to flimit
+ mvn r11, #0
+ orr lr, lr, r12
+ usub8 lr, r10, lr
+ sel lr, r11, r10 @ filter mask
+.endm
+
+.macro filter inner
+ mov32 r12, 0x80808080
+ eor r11, r7, r12 @ ps1
+ eor r8, r8, r12 @ ps0
+ eor r9, r9, r12 @ qs0
+ eor r10, r10, r12 @ qs1
+
+ stm sp, {r8-r11}
+
+ qsub8 r7, r11, r10 @ vp8_signed_char_clamp(ps1-qs1)
+ qsub8 r8, r9, r8 @ vp8_signed_char_clamp(vp8_filter + 3 * ( qs0 - ps0))
+ .if \inner
+ and r7, r7, r6 @ vp8_filter &= hev
+ .endif
+ qadd8 r7, r7, r8
+ lsr r10, r12, #5 @ 0x04040404
+ qadd8 r7, r7, r8
+ sub r9, r10, r12, lsr #7 @ 0x03030303
+ qadd8 r7, r7, r8
+
+ and r7, r7, lr @ vp8_filter &= mask
+ .if !\inner
+ mov r12, r7 @ Filter2
+ and r7, r7, r6 @ Filter2 &= hev
+ .endif
+ qadd8 lr, r7, r9 @ Filter2 = vp8_signed_char_clamp(vp8_filter+3)
+ qadd8 r7, r7, r10 @ Filter1 = vp8_signed_char_clamp(vp8_filter+4)
+
+ mov r9, #0
+ shadd8 lr, lr, r9 @ Filter2 >>= 3
+ shadd8 r7, r7, r9 @ Filter1 >>= 3
+ shadd8 lr, lr, r9
+ shadd8 r7, r7, r9
+ shadd8 lr, lr, r9 @ Filter2
+ shadd8 r7, r7, r9 @ Filter1
+.endm
+
+.macro filter_v inner
+ orr r10, r6, r8 @ calculate vp8_hevmask
+ ldr_nreg r7, r0, r1, lsl #1 @ p1
+ usub8 r10, r12, r10
+ ldr_nreg r8, r0, r1 @ p0
+ sel r6, r12, r11 @ obtain vp8_hevmask
+ ldr r9, [r0] @ q0
+ ldr r10, [r0, r1] @ q1
+ filter \inner
+.endm
+
+.macro filter_h inner
+ orr r9, r6, r8
+ usub8 r9, r12, r9
+ sel r6, r12, r11 @ hev mask
+
+ stm sp, {r6, lr}
+
+ ldr_nreg r12, r0, r1, lsl #1
+ ldr_nreg r11, r0, r1
+ ldr r6, [r0]
+ ldr lr, [r0, r1]
+
+ transpose r10, r9, r8, r7, r12, r11, r6, lr
+
+ ldm sp, {r6, lr}
+ filter \inner
+.endm
+
+.macro filter_inner
+ ldm sp, {r8, r9}
+ lsr r10, r10, #2 @ 0x01010101
+ qadd8 r8, r8, lr @ u = vp8_signed_char_clamp(ps0 + Filter2)
+ mov lr, #0
+ qsub8 r9, r9, r7 @ u = vp8_signed_char_clamp(qs0 - Filter1)
+ sadd8 r7, r7, r10 @ vp8_filter += 1
+ ldr r10, [sp, #8] @ qs1
+ shadd8 r7, r7, lr @ vp8_filter >>= 1
+ eor r8, r8, r12 @ *op0 = u ^ 0x80
+ bic r7, r7, r6 @ vp8_filter &= ~hev
+ qadd8 r11, r11, r7 @ u = vp8_signed_char_clamp(ps1 + vp8_filter)
+ eor r9, r9, r12 @ *oq0 = u ^ 0x80
+ qsub8 r10, r10, r7 @ u = vp8_signed_char_clamp(qs1 - vp8_filter)
+ eor r11, r11, r12 @ *op1 = u ^ 0x80
+ eor r10, r10, r12 @ *oq1 = u ^ 0x80
+.endm
+
+.macro filter_x c0
+ mov lr, \c0
+ mov r7, #63
+
+ sxtb16 r6, r12
+ sxtb16 r10, r12, ror #8
+ smlabb r8, r6, lr, r7
+ smlatb r6, r6, lr, r7
+ smlabb r7, r10, lr, r7
+ smultb r10, r10, lr
+ ssat r8, #8, r8, asr #7
+ ssat r6, #8, r6, asr #7
+ add r10, r10, #63
+ ssat r7, #8, r7, asr #7
+ ssat r10, #8, r10, asr #7
+
+ pkhbt r6, r8, r6, lsl #16
+ pkhbt r10, r7, r10, lsl #16
+ uxtb16 r6, r6
+ uxtb16 r10, r10
+
+ mov32 lr, 0x80808080
+
+ orr r10, r6, r10, lsl #8 @ u = vp8_signed_char_clamp((63 + Filter2 * 27)>>7)
+ qsub8 r8, r9, r10 @ s = vp8_signed_char_clamp(qs0 - u)
+ qadd8 r10, r11, r10 @ s = vp8_signed_char_clamp(ps0 + u)
+ eor r8, r8, lr @ *oq0 = s ^ 0x80
+ eor r10, r10, lr @ *op0 = s ^ 0x80
+.endm
+
+.macro filter_1
+ ldm sp, {r8, r9}
+ qadd8 r11, r8, lr
+ qsub8 r9, r9, r7
+ bic r12, r12, r6 @ vp8_filter &= ~hev
+ filter_x #27
+.endm
+
+.macro filter_2
+ ldr r9, [sp, #8] @ qs1
+ ldr r11, [sp, #12] @ ps1
+ filter_x #18
+.endm
+
+.macro filter_3
+ eor r9, r9, lr
+ eor r11, r11, lr
+ filter_x #9
+.endm
+
+function vp8_v_loop_filter_inner_armv6
+ mov r5, #4
+ sub sp, sp, #16
+
+ orr r2, r2, r2, lsl #16
+ orr r3, r3, r3, lsl #16
+ orr r6, r6, r6, lsl #16
+ orr r4, r2, r2, lsl #8 @ flimE
+ orr r2, r3, r3, lsl #8 @ flimI
+ orr r3, r6, r6, lsl #8 @ thresh
+1:
+ sub r0, r0, r1, lsl #2
+ ldr r10, [r0, r1] @ p2
+ ldr_post r9, r0, r1, lsl #1 @ p3
+ ldr r12, [r0, r1] @ p0
+ ldr_post r11, r0, r1, lsl #1 @ p1
+
+ filter_mask_v
+ cmp lr, #0
+ beq 2f
+ filter_v inner=1
+ filter_inner
+
+A str r11, [r0, -r1, lsl #1] @ op1
+A str r8, [r0, -r1] @ op0
+T sub r0, r0, r1, lsl #1
+T str r8, [r0, r1]
+T str_post r11, r0, r1, lsl #1
+ str r9, [r0] @ oq0
+ str r10, [r0, r1] @ oq1
+2:
+ add r0, r0, #4
+ cmp r5, #3
+ it eq
+ ldreq r0, [sp, #16]
+ subs r5, r5, #1
+ bne 1b
+
+ add sp, sp, #16
+ pop {r0, r4-r11, pc}
+endfunc
+
+function ff_vp8_v_loop_filter16_inner_armv6, export=1
+ push {r4-r11, lr}
+ add r12, r0, #8
+ push {r12}
+ ldr r6, [sp, #40]
+ orr r2, r2, r2, lsl #16
+ b vp8_v_loop_filter_inner_armv6
+endfunc
+
+function ff_vp8_v_loop_filter8uv_inner_armv6, export=1
+ push {r1, r4-r11, lr}
+ mov r1, r2
+ orr r2, r3, r3, lsl #16
+ ldr r3, [sp, #40]
+ ldr r6, [sp, #44]
+ b vp8_v_loop_filter_inner_armv6
+endfunc
+
+function vp8_v_loop_filter_armv6
+ mov r5, #4
+ sub sp, sp, #16
+
+ orr r3, r3, r3, lsl #16
+ orr r6, r6, r6, lsl #16
+ orr r4, r2, r2, lsl #8 @ flimE
+ orr r2, r3, r3, lsl #8 @ flimI
+ orr r3, r6, r6, lsl #8 @ thresh
+1:
+ sub r0, r0, r1, lsl #2
+ ldr r10, [r0, r1] @ p2
+ ldr_post r9, r0, r1, lsl #1 @ p3
+ ldr r12, [r0, r1] @ p0
+ ldr_post r11, r0, r1, lsl #1 @ p1
+
+ filter_mask_v
+ cmp lr, #0
+ beq 2f
+
+ filter_v inner=0
+ filter_1
+
+ str r8, [r0] @ *oq0
+A str r10, [r0, -r1] @ *op0
+T sub r0, r0, r1, lsl #1
+T str r10, [r0, r1]
+
+ filter_2
+
+A str r10, [r0, -r1, lsl #1] @ *op1
+T str_post r10, r0, r1, lsl #1
+ str r8, [r0, r1] @ *oq1
+
+ ldr r9, [r0, r1, lsl #1] @ q2
+ add r0, r0, r1
+A ldr r11, [r0, -r1, lsl #2] @ p2
+T ldr_dpre r11, r0, r1, lsl #2
+
+ filter_3
+
+A str r10, [r0, -r1, lsl #2] @ *op2
+T str_post r10, r0, r1, lsl #2
+ str r8, [r0, r1] @ *oq2
+ sub r0, r0, r1
+2:
+ add r0, r0, #4
+ cmp r5, #3
+ it eq
+ ldreq r0, [sp, #16]
+ subs r5, r5, #1
+ bne 1b
+
+ add sp, sp, #16
+ pop {r0, r4-r11, pc}
+endfunc
+
+function ff_vp8_v_loop_filter16_armv6, export=1
+ push {r4-r11, lr}
+ add r12, r0, #8
+ push {r12}
+ ldr r6, [sp, #40]
+ orr r2, r2, r2, lsl #16
+ b vp8_v_loop_filter_armv6
+endfunc
+
+function ff_vp8_v_loop_filter8uv_armv6, export=1
+ push {r1, r4-r11, lr}
+ mov r1, r2
+ orr r2, r3, r3, lsl #16
+ ldr r3, [sp, #40]
+ ldr r6, [sp, #44]
+ b vp8_v_loop_filter_armv6
+endfunc
+
+@ void vp8_h_loop_filter16_simple(uint8_t *dst, int stride, int flim)
+function ff_vp8_h_loop_filter16_simple_armv6, export=1
+ push {r4-r11, lr}
+ orr r12, r2, r2, lsl #16
+ mov32 r2, 0x80808080
+ orr r12, r12, r12, lsl #8
+
+ mov lr, #0
+ mov r11, #4
+1:
+ sub r0, r0, #2
+ ldr r8, [r0, r1]
+ ldr_post r7, r0, r1, lsl #1
+ ldr r10, [r0, r1]
+ ldr_post r9, r0, r1, lsl #1
+ add r0, r0, #2
+ transpose r6, r5, r4, r3, r7, r8, r9, r10
+ simple_filter
+ sub r0, r0, r1, lsl #2
+ sub r0, r0, #1
+
+ uxtb16 r6, r4
+ uxtb16 r8, r5
+ uxtb16 r7, r4, ror #8
+ uxtb16 r9, r5, ror #8
+ orr r6, r6, r8, lsl #8
+ orr r7, r7, r9, lsl #8
+ lsr r4, r6, #16
+ lsr r5, r7, #16
+
+ strh_post r6, r0, r1
+ strh_post r7, r0, r1
+ strh_post r4, r0, r1
+ strh_post r5, r0, r1
+ add r0, r0, #1
+2:
+ subs r11, r11, #1
+ bne 1b
+
+ pop {r4-r11, pc}
+endfunc
+
+function vp8_h_loop_filter_inner_armv6
+ mov r5, #4
+ sub sp, sp, #16
+
+ orr r3, r3, r3, lsl #16
+ orr r9, r9, r9, lsl #16
+ orr r4, r2, r2, lsl #8 @ flimE
+ orr r2, r3, r3, lsl #8 @ flimI
+ orr r3, r9, r9, lsl #8 @ thresh
+ sub r0, r0, #4
+1:
+ ldr r7, [r0, r1]
+ ldr_post r6, r0, r1, lsl #1
+ ldr lr, [r0, r1]
+ ldr_post r8, r0, r1, lsl #1
+
+ filter_mask_h
+
+ cmp lr, #0
+ sub r0, r0, #2
+ beq 2f
+
+ ldr r6, [sp]
+
+ filter_h inner=1
+ filter_inner
+
+ transpose lr, r12, r7, r6, r11, r8, r9, r10
+
+A str r6, [r0, -r1, lsl #1]
+A str r7, [r0, -r1]
+T sub r0, r0, r1, lsl #1
+T str r7, [r0, r1]
+T str_post r6, r0, r1, lsl #1
+ str r12, [r0]
+ str lr, [r0, r1]
+2:
+ sub r0, r0, #2
+ add r0, r0, r1, lsl #1
+ cmp r5, #3
+ it eq
+ ldreq r0, [sp, #16]
+ subs r5, r5, #1
+ bne 1b
+
+ add sp, sp, #16
+ pop {r0, r4-r11, pc}
+endfunc
+
+function ff_vp8_h_loop_filter16_inner_armv6, export=1
+ push {r4-r11, lr}
+ add r12, r0, r1, lsl #3
+ sub r12, r12, #4
+ push {r12}
+ ldr r9, [sp, #40]
+ orr r2, r2, r2, lsl #16
+ b vp8_h_loop_filter_inner_armv6
+endfunc
+
+function ff_vp8_h_loop_filter8uv_inner_armv6, export=1
+ sub r1, r1, #4
+ push {r1, r4-r11, lr}
+ mov r1, r2
+ orr r2, r3, r3, lsl #16
+ ldr r3, [sp, #40]
+ ldr r9, [sp, #44]
+ b vp8_h_loop_filter_inner_armv6
+endfunc
+
+function vp8_h_loop_filter_armv6
+ mov r5, #4
+ sub sp, sp, #16
+
+ orr r3, r3, r3, lsl #16
+ orr r9, r9, r9, lsl #16
+ orr r4, r2, r2, lsl #8 @ flimE
+ orr r2, r3, r3, lsl #8 @ flimI
+ orr r3, r9, r9, lsl #8 @ thresh
+1:
+ sub r0, r0, #4
+ ldr r7, [r0, r1]
+ ldr_post r6, r0, r1, lsl #1
+ ldr lr, [r0, r1]
+ ldr_post r8, r0, r1, lsl #1
+
+ filter_mask_h
+ cmp lr, #0
+ it eq
+ addeq r0, r0, r1, lsl #1
+ beq 2f
+
+ ldr r6, [sp]
+ sub r0, r0, #2
+
+ filter_h inner=0
+ filter_1
+
+ sub r0, r0, r1, lsl #1
+ uxtb16 r6, r10
+ uxtb16 r7, r8
+ uxtb16 r10, r10, ror #8
+ uxtb16 r8, r8, ror #8
+ orr r6, r6, r7, lsl #8
+ orr r10, r10, r8, lsl #8
+ lsr r7, r6, #16
+ lsr r8, r10, #16
+
+ add r0, r0, #1
+ strh_post r6, r0, r1
+ strh_post r10, r0, r1
+ strh_post r7, r0, r1
+ strh_post r8, r0, r1
+
+ filter_2
+
+ sub r0, r0, r1, lsl #2
+ add r0, r0, #3
+
+ ldrb r11, [r0, #-5] @ p2 for 1/7th difference
+ strb r10, [r0, #-4] @ op1
+ strb r8, [r0, #-1] @ oq1
+ ldrb_post r9, r0, r1 @ q2 for 1/7th difference
+
+ lsr r10, r10, #8
+ lsr r8, r8, #8
+
+ ldrb r6, [r0, #-5]
+ strb r10, [r0, #-4]
+ strb r8, [r0, #-1]
+ ldrb_post r7, r0, r1
+
+ lsr r10, r10, #8
+ lsr r8, r8, #8
+ orr r11, r11, r6, lsl #8
+ orr r9, r9, r7, lsl #8
+
+ ldrb r6, [r0, #-5]
+ strb r10, [r0, #-4]
+ strb r8, [r0, #-1]
+ ldrb_post r7, r0, r1
+
+ lsr r10, r10, #8
+ lsr r8, r8, #8
+ orr r11, r11, r6, lsl #16
+ orr r9, r9, r7, lsl #16
+
+ ldrb r6, [r0, #-5]
+ strb r10, [r0, #-4]
+ strb r8, [r0, #-1]
+ ldrb_post r7, r0, r1
+ orr r11, r11, r6, lsl #24
+ orr r9, r9, r7, lsl #24
+
+ filter_3
+
+ sub r0, r0, r1, lsl #2
+ strb r10, [r0, #-5]
+ strb_post r8, r0, r1
+ lsr r10, r10, #8
+ lsr r8, r8, #8
+ strb r10, [r0, #-5]
+ strb_post r8, r0, r1
+ lsr r10, r10, #8
+ lsr r8, r8, #8
+ strb r10, [r0, #-5]
+ strb_post r8, r0, r1
+ lsr r10, r10, #8
+ lsr r8, r8, #8
+ strb r10, [r0, #-5]
+ strb_post r8, r0, r1
+
+ sub r0, r0, #2
+2:
+ cmp r5, #3
+ it eq
+ ldreq r0, [sp, #16]
+ subs r5, r5, #1
+ bne 1b
+
+ add sp, sp, #16
+ pop {r0, r4-r11, pc}
+endfunc
+
+function ff_vp8_h_loop_filter16_armv6, export=1
+ push {r4-r11, lr}
+ add r12, r0, r1, lsl #3
+ push {r12}
+ ldr r9, [sp, #40]
+ orr r2, r2, r2, lsl #16
+ b vp8_h_loop_filter_armv6
+endfunc
+
+function ff_vp8_h_loop_filter8uv_armv6, export=1
+ push {r1, r4-r11, lr}
+ mov r1, r2
+ orr r2, r3, r3, lsl #16
+ ldr r3, [sp, #40]
+ ldr r9, [sp, #44]
+ b vp8_h_loop_filter_armv6
+endfunc
+
+.ltorg
+
+@ MC
+
+@ void put_vp8_pixels16(uint8_t *dst, int dststride, uint8_t *src,
+@ int srcstride, int h, int mx, int my)
+function ff_put_vp8_pixels16_armv6, export=1
+ push {r4-r11}
+ ldr r12, [sp, #32] @ h
+1:
+ subs r12, r12, #2
+ ldr r5, [r2, #4]
+ ldr r6, [r2, #8]
+ ldr r7, [r2, #12]
+ ldr_post r4, r2, r3
+ ldr r9, [r2, #4]
+ ldr r10, [r2, #8]
+ ldr r11, [r2, #12]
+ ldr_post r8, r2, r3
+ strd r6, r7, [r0, #8]
+ strd_post r4, r5, r0, r1
+ strd r10, r11, [r0, #8]
+ strd_post r8, r9, r0, r1
+ bgt 1b
+ pop {r4-r11}
+ bx lr
+endfunc
+
+@ void put_vp8_pixels8(uint8_t *dst, int dststride, uint8_t *src,
+@ int srcstride, int h, int mx, int my)
+function ff_put_vp8_pixels8_armv6, export=1
+ push {r4-r11}
+ ldr r12, [sp, #32] @ h
+1:
+ subs r12, r12, #4
+ ldr r5, [r2, #4]
+ ldr_post r4, r2, r3
+ ldr r7, [r2, #4]
+ ldr_post r6, r2, r3
+ ldr r9, [r2, #4]
+ ldr_post r8, r2, r3
+ ldr r11, [r2, #4]
+ ldr_post r10, r2, r3
+ strd_post r4, r5, r0, r1
+ strd_post r6, r7, r0, r1
+ strd_post r8, r9, r0, r1
+ strd_post r10, r11, r0, r1
+ bgt 1b
+ pop {r4-r11}
+ bx lr
+endfunc
+
+@ void put_vp8_pixels4(uint8_t *dst, int dststride, uint8_t *src,
+@ int srcstride, int h, int mx, int my)
+function ff_put_vp8_pixels4_armv6, export=1
+ ldr r12, [sp, #0] @ h
+ push {r4-r6,lr}
+1:
+ subs r12, r12, #4
+ ldr_post r4, r2, r3
+ ldr_post r5, r2, r3
+ ldr_post r6, r2, r3
+ ldr_post lr, r2, r3
+ str_post r4, r0, r1
+ str_post r5, r0, r1
+ str_post r6, r0, r1
+ str_post lr, r0, r1
+ bgt 1b
+ pop {r4-r6,pc}
+endfunc
+
+@ note: worst case sum of all 6-tap filter values * 255 is 0x7f80 so 16 bit
+@ arithmatic can be used to apply filters
+const sixtap_filters_13245600, align=4
+ .short 2, 108, -11, 36, -8, 1, 0, 0
+ .short 3, 77, -16, 77, -16, 3, 0, 0
+ .short 1, 36, -8, 108, -11, 2, 0, 0
+endconst
+
+const fourtap_filters_1324, align=4
+ .short -6, 12, 123, -1
+ .short -9, 50, 93, -6
+ .short -6, 93, 50, -9
+ .short -1, 123, 12, -6
+endconst
+
+.macro vp8_mc_1 name, size, hv
+function ff_put_vp8_\name\size\()_\hv\()_armv6, export=1
+ sub r1, r1, #\size
+ mov r12, sp
+ push {r1, r4-r11, lr}
+ ldm r12, {r5-r7}
+ mov r4, #\size
+ stm r12, {r4, r5}
+ orr r12, r6, r7
+ b vp8_put_\name\()_\hv\()_armv6 + 4
+endfunc
+.endm
+
+vp8_mc_1 epel, 16, h6
+vp8_mc_1 epel, 16, v6
+vp8_mc_1 epel, 8, h6
+vp8_mc_1 epel, 8, v6
+vp8_mc_1 epel, 8, h4
+vp8_mc_1 epel, 8, v4
+vp8_mc_1 epel, 4, h6
+vp8_mc_1 epel, 4, v6
+vp8_mc_1 epel, 4, h4
+vp8_mc_1 epel, 4, v4
+
+vp8_mc_1 bilin, 16, h
+vp8_mc_1 bilin, 16, v
+vp8_mc_1 bilin, 8, h
+vp8_mc_1 bilin, 8, v
+vp8_mc_1 bilin, 4, h
+vp8_mc_1 bilin, 4, v
+
+/* True relational expressions have the value -1 in the GNU assembler,
+ +1 in Apple's. */
+#ifdef __APPLE__
+# define TMPSIZE \size * (8 + 8*(\size > 4) + \ytaps - 1)
+#else
+# define TMPSIZE \size * (8 - 8*(\size > 4) + \ytaps - 1)
+#endif
+
+.macro vp8_mc_hv name, size, h, v, ytaps
+function ff_put_vp8_\name\size\()_\h\v\()_armv6, export=1
+ push {r0, r1, r4, lr}
+ add r0, sp, #16
+ sub sp, sp, #TMPSIZE+16
+ ldm r0, {r0, r12}
+ mov r4, #\size
+ add lr, r0, #\ytaps-1
+ .if \ytaps > 2
+ sub r2, r2, r3, lsl #\ytaps >> 1 & 1
+ .endif
+ stm sp, {r4, lr}
+ add r0, sp, #16
+ mov r1, #0
+ bl vp8_put_\name\()_\h\()_armv6
+ add r0, sp, #TMPSIZE+16
+ ldr lr, [sp, #TMPSIZE+16+16]
+ ldm r0, {r0, r1}
+ mov r3, #\size
+ ldr r12, [sp, #TMPSIZE+16+16+8]
+ str lr, [sp, #4]
+ add r2, sp, #16 + \size * (\ytaps / 2 - 1)
+ sub r1, r1, #\size
+ bl vp8_put_\name\()_\v\()_armv6
+ add sp, sp, #TMPSIZE+16+8
+ pop {r4, pc}
+endfunc
+.endm
+
+vp8_mc_hv epel, 16, h6, v6, 6
+vp8_mc_hv epel, 8, h6, v6, 6
+vp8_mc_hv epel, 8, h4, v6, 6
+vp8_mc_hv epel, 8, h6, v4, 4
+vp8_mc_hv epel, 8, h4, v4, 4
+vp8_mc_hv epel, 4, h6, v6, 6
+vp8_mc_hv epel, 4, h4, v6, 6
+vp8_mc_hv epel, 4, h6, v4, 4
+vp8_mc_hv epel, 4, h4, v4, 4
+
+vp8_mc_hv bilin, 16, h, v, 2
+vp8_mc_hv bilin, 8, h, v, 2
+vp8_mc_hv bilin, 4, h, v, 2
+
+.macro sat4 r0, r1, r2, r3
+ asr \r0, \r0, #7
+ asr \r1, \r1, #7
+ pkhbt \r0, \r0, \r2, lsl #9
+ pkhbt \r1, \r1, \r3, lsl #9
+ usat16 \r0, #8, \r0
+ usat16 \r1, #8, \r1
+ orr \r0, \r0, \r1, lsl #8
+.endm
+
+@ Calling convention for the inner MC functions:
+@ r0 dst
+@ r1 dst_stride - block_width
+@ r2 src
+@ r3 src_stride
+@ r4 block_width
+@ r12 filter_index
+@ [sp] block_width
+@ [sp+4] height
+@ [sp+8] scratch
+
+function vp8_put_epel_h6_armv6
+ push {r1, r4-r11, lr}
+ sub r2, r2, #2
+ movrel lr, sixtap_filters_13245600 - 16
+ add lr, lr, r12, lsl #3
+ sub r3, r3, r4
+ str r3, [sp, #48]
+ ldm lr, {r1, r3, lr}
+1:
+ ldr r7, [r2, #5] @ src[5-8]
+ ldr r6, [r2, #2] @ src[2-5]
+ ldr r5, [r2], #4 @ src[0-3]
+
+ pkhtb r7, r7, r7, asr #8 @ src[8,7,7,6]
+ uxtb16 r9, r6, ror #8 @ src[5] | src[3]
+ uxtb16 r6, r6 @ src[4] | src[2]
+ uxtb16 r8, r5, ror #8 @ src[3] | src[1]
+ uxtb16 r11, r7, ror #8 @ src[8] | src[7]
+ uxtb16 r7, r7 @ src[7] | src[6]
+ uxtb16 r5, r5 @ src[2] | src[0]
+
+ mov r10, #0x40
+ smlad r5, r5, r1, r10 @ filter[0][0]
+ smlad r11, r11, lr, r10 @ filter[3][2]
+ smlad r12, r7, lr, r10 @ filter[2][2]
+ smlad r10, r8, r1, r10 @ filter[1][0]
+ smlad r5, r8, r3, r5 @ filter[0][1]
+ smlad r11, r9, r1, r11 @ filter[3][0]
+ smlad r12, r9, r3, r12 @ filter[2][1]
+ pkhtb r9, r9, r6, asr #16 @ src[5] | src[4]
+ smlad r10, r6, r3, r10 @ filter[1][1]
+ pkhbt r7, r9, r7, lsl #16 @ src[6] | src[4]
+ smlad r5, r9, lr, r5 @ filter[0][2]
+ pkhtb r8, r7, r9, asr #16 @ src[6] | src[5]
+ smlad r11, r7, r3, r11 @ filter[3][1]
+ smlad r9, r8, lr, r10 @ filter[1][2]
+ smlad r7, r6, r1, r12 @ filter[2][0]
+
+ subs r4, r4, #4
+
+ sat4 r5, r9, r7, r11
+ str r5, [r0], #4
+
+ bne 1b
+
+ add r4, sp, #40
+ ldm r4, {r4, r5, r12}
+ ldr r6, [sp]
+ subs r5, r5, #1
+ add r2, r2, r12
+ str r5, [sp, #44]
+ add r0, r0, r6
+
+ bne 1b
+
+ pop {r1, r4-r11, pc}
+endfunc
+
+function vp8_put_epel_v6_armv6
+ push {r1, r4-r11, lr}
+ movrel lr, sixtap_filters_13245600 - 16
+ add lr, lr, r12, lsl #3
+ str r3, [sp, #48]
+1:
+ add r1, r3, r3, lsl #1 @ stride * 3
+ ldr_nreg r5, r2, r3 @ src[0,1,2,3 + stride * 1]
+ ldr r6, [r2, r3] @ src[0,1,2,3 + stride * 3]
+ ldr r7, [r2, r3, lsl #1] @ src[0,1,2,3 + stride * 4]
+ ldr r8, [r2, r1] @ src[0,1,2,3 + stride * 5]
+
+ uxtb16 r9, r5, ror #8 @ src[3 + s*1] | src[1 + s*1]
+ uxtb16 r10, r6, ror #8 @ src[3 + s*3] | src[1 + s*3]
+ uxtb16 r11, r7, ror #8 @ src[3 + s*4] | src[1 + s*4]
+ uxtb16 r12, r8, ror #8 @ src[3 + s*5] | src[1 + s*5]
+ uxtb16 r5, r5 @ src[2 + s*1] | src[0 + s*1]
+ uxtb16 r6, r6 @ src[2 + s*3] | src[0 + s*3]
+ uxtb16 r7, r7 @ src[2 + s*4] | src[0 + s*4]
+ uxtb16 r8, r8 @ src[2 + s*5] | src[0 + s*5]
+ pkhbt r1, r9, r10, lsl #16 @ src[1 + s*3] | src[1 + s*1]
+ pkhtb r9, r10, r9, asr #16 @ src[3 + s*3] | src[3 + s*1]
+ pkhbt r10, r11, r12, lsl #16 @ src[1 + s*5] | src[1 + s*4]
+ pkhtb r11, r12, r11, asr #16 @ src[3 + s*5] | src[3 + s*4]
+ pkhbt r12, r5, r6, lsl #16 @ src[0 + s*3] | src[0 + s*1]
+ pkhtb r5, r6, r5, asr #16 @ src[2 + s*3] | src[2 + s*1]
+ pkhbt r6, r7, r8, lsl #16 @ src[0 + s*5] | src[0 + s*4]
+ pkhtb r7, r8, r7, asr #16 @ src[2 + s*5] | src[2 + s*4]
+
+ ldr r8, [lr, #4]
+ mov r3, #0x40
+ smlad r12, r12, r8, r3 @ filter[0][1]
+ smlad r1, r1, r8, r3 @ filter[1][1]
+ smlad r5, r5, r8, r3 @ filter[2][1]
+ smlad r9, r9, r8, r3 @ filter[3][1]
+ ldr r8, [lr, #8]
+ ldr r3, [sp, #48]
+ smlad r12, r6, r8, r12 @ filter[0][2]
+ smlad r1, r10, r8, r1 @ filter[1][2]
+ ldr_nreg r6, r2, r3, lsl #1 @ src[0,1,2,3 + stride * 0]
+ ldr r10, [r2], #4 @ src[0,1,2,3 + stride * 2]
+ smlad r5, r7, r8, r5 @ filter[2][2]
+ smlad r9, r11, r8, r9 @ filter[3][2]
+
+ uxtb16 r7, r6, ror #8 @ src[3 + s*0] | src[1 + s*0]
+ uxtb16 r11, r10, ror #8 @ src[3 + s*2] | src[1 + s*2]
+ uxtb16 r6, r6 @ src[2 + s*0] | src[0 + s*0]
+ uxtb16 r10, r10 @ src[2 + s*2] | src[0 + s*2]
+
+ pkhbt r8, r7, r11, lsl #16 @ src[1 + s*2] | src[1 + s*0]
+ pkhtb r7, r11, r7, asr #16 @ src[3 + s*2] | src[3 + s*0]
+ pkhbt r11, r6, r10, lsl #16 @ src[0 + s*2] | src[0 + s*0]
+ pkhtb r6, r10, r6, asr #16 @ src[2 + s*2] | src[2 + s*0]
+
+ ldr r10, [lr]
+ subs r4, r4, #4
+ smlad r12, r11, r10, r12 @ filter[0][0]
+ smlad r1, r8, r10, r1 @ filter[1][0]
+ smlad r5, r6, r10, r5 @ filter[2][0]
+ smlad r9, r7, r10, r9 @ filter[3][0]
+
+ sat4 r12, r1, r5, r9
+ str r12, [r0], #4
+
+ bne 1b
+
+ ldrd r4, r5, [sp, #40]
+ ldr r6, [sp]
+ subs r5, r5, #1
+ sub r2, r2, r4
+ str r5, [sp, #44]
+ add r0, r0, r6
+ add r2, r2, r3
+
+ bne 1b
+
+ pop {r1, r4-r11, pc}
+endfunc
+
+function vp8_put_epel_h4_armv6
+ push {r1, r4-r11, lr}
+ subs r2, r2, #1
+ movrel lr, fourtap_filters_1324 - 4
+ add lr, lr, r12, lsl #2
+ sub r3, r3, r4
+ ldm lr, {r5, r6}
+ ldr lr, [sp, #44]
+1:
+ ldr r9, [r2, #3]
+ ldr r8, [r2, #2]
+ ldr r7, [r2], #4
+
+ uxtb16 r9, r9, ror #8 @ src[6] | src[4]
+ uxtb16 r10, r8, ror #8 @ src[5] | src[3]
+ uxtb16 r8, r8 @ src[4] | src[2]
+ uxtb16 r11, r7, ror #8 @ src[3] | src[1]
+ uxtb16 r7, r7 @ src[2] | src[0]
+
+ mov r12, #0x40
+ smlad r9, r9, r6, r12 @ filter[3][1]
+ smlad r7, r7, r5, r12 @ filter[0][0]
+ smlad r9, r10, r5, r9 @ filter[3][0]
+ smlad r10, r10, r6, r12 @ filter[2][1]
+ smlad r12, r11, r5, r12 @ filter[1][0]
+ smlad r7, r11, r6, r7 @ filter[0][1]
+ smlad r10, r8, r5, r10 @ filter[2][0]
+ smlad r12, r8, r6, r12 @ filter[1][1]
+
+ subs r4, r4, #4
+
+ sat4 r7, r12, r10, r9
+ str r7, [r0], #4
+
+ bne 1b
+
+ subs lr, lr, #1
+ ldr r4, [sp, #40]
+ add r2, r2, r3
+ add r0, r0, r1
+
+ bne 1b
+
+ pop {r1, r4-r11, pc}
+endfunc
+
+function vp8_put_epel_v4_armv6
+ push {r1, r4-r11, lr}
+ movrel lr, fourtap_filters_1324 - 4
+ add lr, lr, r12, lsl #2
+ ldm lr, {r5, r6}
+ str r3, [sp, #48]
+1:
+ ldr lr, [r2, r3, lsl #1]
+ ldr r12, [r2, r3]
+ ldr_nreg r7, r2, r3
+ ldr r11, [r2], #4
+
+ uxtb16 r8, lr, ror #8 @ src[3 + s*3] | src[1 + s*3]
+ uxtb16 r9, r12, ror #8 @ src[3 + s*2] | src[1 + s*2]
+ uxtb16 r3, r7, ror #8 @ src[3 + s*0] | src[1 + s*0]
+ uxtb16 r1, r11, ror #8 @ src[3 + s*1] | src[1 + s*1]
+ uxtb16 lr, lr @ src[2 + s*3] | src[0 + s*3]
+ uxtb16 r12, r12 @ src[2 + s*2] | src[0 + s*2]
+ uxtb16 r7, r7 @ src[2 + s*0] | src[0 + s*0]
+ uxtb16 r11, r11 @ src[2 + s*1] | src[0 + s*1]
+ pkhbt r10, r1, r8, lsl #16 @ src[1 + s*3] | src[1 + s*1]
+ pkhtb r1, r8, r1, asr #16 @ src[3 + s*3] | src[3 + s*1]
+ pkhbt r8, r3, r9, lsl #16 @ src[1 + s*2] | src[1 + s*0]
+ pkhtb r3, r9, r3, asr #16 @ src[3 + s*2] | src[3 + s*0]
+ pkhbt r9, r11, lr, lsl #16 @ src[0 + s*3] | src[0 + s*1]
+ pkhtb r11, lr, r11, asr #16 @ src[2 + s*3] | src[2 + s*1]
+ pkhbt lr, r7, r12, lsl #16 @ src[0 + s*2] | src[0 + s*0]
+ pkhtb r7, r12, r7, asr #16 @ src[2 + s*2] | src[2 + s*0]
+
+ mov r12, #0x40
+ smlad r9, r9, r6, r12 @ filter[0][1]
+ smlad r10, r10, r6, r12 @ filter[1][1]
+ smlad r11, r11, r6, r12 @ filter[2][1]
+ smlad r1, r1, r6, r12 @ filter[3][1]
+ smlad r9, lr, r5, r9 @ filter[0][0]
+ smlad r10, r8, r5, r10 @ filter[1][0]
+ smlad r11, r7, r5, r11 @ filter[2][0]
+ smlad r1, r3, r5, r1 @ filter[3][0]
+
+ subs r4, r4, #4
+ ldr r3, [sp, #48]
+
+ sat4 r9, r10, r11, r1
+ str r9, [r0], #4
+
+ bne 1b
+
+ ldr r4, [sp, #40]
+ ldr r12, [sp, #44]
+ add r2, r2, r3
+ ldr r9, [sp, #0]
+ subs r12, r12, #1
+ sub r2, r2, r4
+ str r12, [sp, #44]
+ add r0, r0, r9
+
+ bne 1b
+
+ pop {r1, r4-r11, pc}
+endfunc
+
+function vp8_put_bilin_h_armv6
+ push {r1, r4-r11, lr}
+ rsb r5, r12, r12, lsl #16
+ ldr r12, [sp, #44]
+ sub r3, r3, r4
+ add r5, r5, #8
+1:
+ ldrb r6, [r2], #1
+ ldrb r7, [r2], #1
+ ldrb r8, [r2], #1
+ ldrb r9, [r2], #1
+ ldrb lr, [r2]
+
+ pkhbt r6, r6, r7, lsl #16 @ src[1] | src[0]
+ pkhbt r7, r7, r8, lsl #16 @ src[2] | src[1]
+ pkhbt r8, r8, r9, lsl #16 @ src[3] | src[2]
+ pkhbt r9, r9, lr, lsl #16 @ src[4] | src[3]
+
+ mov r10, #4
+ smlad r6, r6, r5, r10
+ smlad r7, r7, r5, r10
+ smlad r8, r8, r5, r10
+ smlad r9, r9, r5, r10
+
+ subs r4, r4, #4
+
+ asr r6, #3
+ asr r7, #3
+ pkhbt r6, r6, r8, lsl #13
+ pkhbt r7, r7, r9, lsl #13
+ orr r6, r6, r7, lsl #8
+ str r6, [r0], #4
+
+ bne 1b
+
+ ldr r4, [sp, #40]
+ subs r12, r12, #1
+ add r2, r2, r3
+ add r0, r0, r1
+
+ bne 1b
+
+ pop {r1, r4-r11, pc}
+endfunc
+
+function vp8_put_bilin_v_armv6
+ push {r1, r4-r11, lr}
+ rsb r5, r12, r12, lsl #16
+ ldr r12, [sp, #44]
+ add r5, r5, #8
+1:
+ ldrb r10, [r2, r3]
+ ldrb r6, [r2], #1
+ ldrb r11, [r2, r3]
+ ldrb r7, [r2], #1
+ ldrb lr, [r2, r3]
+ ldrb r8, [r2], #1
+ ldrb r9, [r2, r3]
+ pkhbt r6, r6, r10, lsl #16
+ ldrb r10, [r2], #1
+ pkhbt r7, r7, r11, lsl #16
+ pkhbt r8, r8, lr, lsl #16
+ pkhbt r9, r10, r9, lsl #16
+
+ mov r10, #4
+ smlad r6, r6, r5, r10
+ smlad r7, r7, r5, r10
+ smlad r8, r8, r5, r10
+ smlad r9, r9, r5, r10
+
+ subs r4, r4, #4
+
+ asr r6, #3
+ asr r7, #3
+ pkhbt r6, r6, r8, lsl #13
+ pkhbt r7, r7, r9, lsl #13
+ orr r6, r6, r7, lsl #8
+ str r6, [r0], #4
+
+ bne 1b
+
+ ldr r4, [sp, #40]
+ subs r12, r12, #1
+ add r2, r2, r3
+ add r0, r0, r1
+ sub r2, r2, r4
+
+ bne 1b
+ pop {r1, r4-r11, pc}
+endfunc
diff --git a/gst-libs/ext/libav/libavcodec/arm/vp8dsp_init_arm.c b/gst-libs/ext/libav/libavcodec/arm/vp8dsp_init_arm.c
index 269c6e3..603f68c 100644
--- a/gst-libs/ext/libav/libavcodec/arm/vp8dsp_init_arm.c
+++ b/gst-libs/ext/libav/libavcodec/arm/vp8dsp_init_arm.c
@@ -1,4 +1,4 @@
-/**
+/*
* This file is part of Libav.
*
* Libav is free software; you can redistribute it and/or
@@ -17,147 +17,17 @@
*/
#include <stdint.h>
-#include "libavcodec/vp8dsp.h"
-
-void ff_vp8_luma_dc_wht_neon(DCTELEM block[4][4][16], DCTELEM dc[16]);
-void ff_vp8_luma_dc_wht_dc_neon(DCTELEM block[4][4][16], DCTELEM dc[16]);
-
-void ff_vp8_idct_add_neon(uint8_t *dst, DCTELEM block[16], int stride);
-void ff_vp8_idct_dc_add_neon(uint8_t *dst, DCTELEM block[16], int stride);
-void ff_vp8_idct_dc_add4y_neon(uint8_t *dst, DCTELEM block[4][16], int stride);
-void ff_vp8_idct_dc_add4uv_neon(uint8_t *dst, DCTELEM block[4][16], int stride);
-
-void ff_vp8_v_loop_filter16_neon(uint8_t *dst, int stride,
- int flim_E, int flim_I, int hev_thresh);
-void ff_vp8_h_loop_filter16_neon(uint8_t *dst, int stride,
- int flim_E, int flim_I, int hev_thresh);
-void ff_vp8_v_loop_filter8uv_neon(uint8_t *dstU, uint8_t *dstV, int stride,
- int flim_E, int flim_I, int hev_thresh);
-void ff_vp8_h_loop_filter8uv_neon(uint8_t *dstU, uint8_t *dstV, int stride,
- int flim_E, int flim_I, int hev_thresh);
-
-void ff_vp8_v_loop_filter16_inner_neon(uint8_t *dst, int stride,
- int flim_E, int flim_I, int hev_thresh);
-void ff_vp8_h_loop_filter16_inner_neon(uint8_t *dst, int stride,
- int flim_E, int flim_I, int hev_thresh);
-void ff_vp8_v_loop_filter8uv_inner_neon(uint8_t *dstU, uint8_t *dstV,
- int stride, int flim_E, int flim_I,
- int hev_thresh);
-void ff_vp8_h_loop_filter8uv_inner_neon(uint8_t *dstU, uint8_t *dstV,
- int stride, int flim_E, int flim_I,
- int hev_thresh);
-
-void ff_vp8_v_loop_filter16_simple_neon(uint8_t *dst, int stride, int flim);
-void ff_vp8_h_loop_filter16_simple_neon(uint8_t *dst, int stride, int flim);
-
-
-#define VP8_MC(n) \
- void ff_put_vp8_##n##_neon(uint8_t *dst, int dststride, \
- uint8_t *src, int srcstride, \
- int h, int x, int y)
-
-#define VP8_EPEL(w) \
- VP8_MC(pixels ## w); \
- VP8_MC(epel ## w ## _h4); \
- VP8_MC(epel ## w ## _h6); \
- VP8_MC(epel ## w ## _v4); \
- VP8_MC(epel ## w ## _h4v4); \
- VP8_MC(epel ## w ## _h6v4); \
- VP8_MC(epel ## w ## _v6); \
- VP8_MC(epel ## w ## _h4v6); \
- VP8_MC(epel ## w ## _h6v6)
-
-VP8_EPEL(16);
-VP8_EPEL(8);
-VP8_EPEL(4);
-VP8_MC(bilin16_h);
-VP8_MC(bilin16_v);
-VP8_MC(bilin16_hv);
-VP8_MC(bilin8_h);
-VP8_MC(bilin8_v);
-VP8_MC(bilin8_hv);
-VP8_MC(bilin4_h);
-VP8_MC(bilin4_v);
-VP8_MC(bilin4_hv);
+#include "libavutil/arm/cpu.h"
+#include "libavcodec/vp8dsp.h"
+#include "vp8dsp.h"
av_cold void ff_vp8dsp_init_arm(VP8DSPContext *dsp)
{
- if (HAVE_NEON) {
- dsp->vp8_luma_dc_wht = ff_vp8_luma_dc_wht_neon;
- dsp->vp8_luma_dc_wht_dc = ff_vp8_luma_dc_wht_dc_neon;
-
- dsp->vp8_idct_add = ff_vp8_idct_add_neon;
- dsp->vp8_idct_dc_add = ff_vp8_idct_dc_add_neon;
- dsp->vp8_idct_dc_add4y = ff_vp8_idct_dc_add4y_neon;
- dsp->vp8_idct_dc_add4uv = ff_vp8_idct_dc_add4uv_neon;
-
- dsp->vp8_v_loop_filter16y = ff_vp8_v_loop_filter16_neon;
- dsp->vp8_h_loop_filter16y = ff_vp8_h_loop_filter16_neon;
- dsp->vp8_v_loop_filter8uv = ff_vp8_v_loop_filter8uv_neon;
- dsp->vp8_h_loop_filter8uv = ff_vp8_h_loop_filter8uv_neon;
-
- dsp->vp8_v_loop_filter16y_inner = ff_vp8_v_loop_filter16_inner_neon;
- dsp->vp8_h_loop_filter16y_inner = ff_vp8_h_loop_filter16_inner_neon;
- dsp->vp8_v_loop_filter8uv_inner = ff_vp8_v_loop_filter8uv_inner_neon;
- dsp->vp8_h_loop_filter8uv_inner = ff_vp8_h_loop_filter8uv_inner_neon;
-
- dsp->vp8_v_loop_filter_simple = ff_vp8_v_loop_filter16_simple_neon;
- dsp->vp8_h_loop_filter_simple = ff_vp8_h_loop_filter16_simple_neon;
-
- dsp->put_vp8_epel_pixels_tab[0][0][0] = ff_put_vp8_pixels16_neon;
- dsp->put_vp8_epel_pixels_tab[0][0][2] = ff_put_vp8_epel16_h6_neon;
- dsp->put_vp8_epel_pixels_tab[0][2][0] = ff_put_vp8_epel16_v6_neon;
- dsp->put_vp8_epel_pixels_tab[0][2][2] = ff_put_vp8_epel16_h6v6_neon;
-
- dsp->put_vp8_epel_pixels_tab[1][0][0] = ff_put_vp8_pixels8_neon;
- dsp->put_vp8_epel_pixels_tab[1][0][1] = ff_put_vp8_epel8_h4_neon;
- dsp->put_vp8_epel_pixels_tab[1][0][2] = ff_put_vp8_epel8_h6_neon;
- dsp->put_vp8_epel_pixels_tab[1][1][0] = ff_put_vp8_epel8_v4_neon;
- dsp->put_vp8_epel_pixels_tab[1][1][1] = ff_put_vp8_epel8_h4v4_neon;
- dsp->put_vp8_epel_pixels_tab[1][1][2] = ff_put_vp8_epel8_h6v4_neon;
- dsp->put_vp8_epel_pixels_tab[1][2][0] = ff_put_vp8_epel8_v6_neon;
- dsp->put_vp8_epel_pixels_tab[1][2][1] = ff_put_vp8_epel8_h4v6_neon;
- dsp->put_vp8_epel_pixels_tab[1][2][2] = ff_put_vp8_epel8_h6v6_neon;
-
- dsp->put_vp8_epel_pixels_tab[2][0][0] = ff_put_vp8_pixels4_neon;
- dsp->put_vp8_epel_pixels_tab[2][0][1] = ff_put_vp8_epel4_h4_neon;
- dsp->put_vp8_epel_pixels_tab[2][0][2] = ff_put_vp8_epel4_h6_neon;
- dsp->put_vp8_epel_pixels_tab[2][1][0] = ff_put_vp8_epel4_v4_neon;
- dsp->put_vp8_epel_pixels_tab[2][1][1] = ff_put_vp8_epel4_h4v4_neon;
- dsp->put_vp8_epel_pixels_tab[2][1][2] = ff_put_vp8_epel4_h6v4_neon;
- dsp->put_vp8_epel_pixels_tab[2][2][0] = ff_put_vp8_epel4_v6_neon;
- dsp->put_vp8_epel_pixels_tab[2][2][1] = ff_put_vp8_epel4_h4v6_neon;
- dsp->put_vp8_epel_pixels_tab[2][2][2] = ff_put_vp8_epel4_h6v6_neon;
-
- dsp->put_vp8_bilinear_pixels_tab[0][0][0] = ff_put_vp8_pixels16_neon;
- dsp->put_vp8_bilinear_pixels_tab[0][0][1] = ff_put_vp8_bilin16_h_neon;
- dsp->put_vp8_bilinear_pixels_tab[0][0][2] = ff_put_vp8_bilin16_h_neon;
- dsp->put_vp8_bilinear_pixels_tab[0][1][0] = ff_put_vp8_bilin16_v_neon;
- dsp->put_vp8_bilinear_pixels_tab[0][1][1] = ff_put_vp8_bilin16_hv_neon;
- dsp->put_vp8_bilinear_pixels_tab[0][1][2] = ff_put_vp8_bilin16_hv_neon;
- dsp->put_vp8_bilinear_pixels_tab[0][2][0] = ff_put_vp8_bilin16_v_neon;
- dsp->put_vp8_bilinear_pixels_tab[0][2][1] = ff_put_vp8_bilin16_hv_neon;
- dsp->put_vp8_bilinear_pixels_tab[0][2][2] = ff_put_vp8_bilin16_hv_neon;
-
- dsp->put_vp8_bilinear_pixels_tab[1][0][0] = ff_put_vp8_pixels8_neon;
- dsp->put_vp8_bilinear_pixels_tab[1][0][1] = ff_put_vp8_bilin8_h_neon;
- dsp->put_vp8_bilinear_pixels_tab[1][0][2] = ff_put_vp8_bilin8_h_neon;
- dsp->put_vp8_bilinear_pixels_tab[1][1][0] = ff_put_vp8_bilin8_v_neon;
- dsp->put_vp8_bilinear_pixels_tab[1][1][1] = ff_put_vp8_bilin8_hv_neon;
- dsp->put_vp8_bilinear_pixels_tab[1][1][2] = ff_put_vp8_bilin8_hv_neon;
- dsp->put_vp8_bilinear_pixels_tab[1][2][0] = ff_put_vp8_bilin8_v_neon;
- dsp->put_vp8_bilinear_pixels_tab[1][2][1] = ff_put_vp8_bilin8_hv_neon;
- dsp->put_vp8_bilinear_pixels_tab[1][2][2] = ff_put_vp8_bilin8_hv_neon;
+ int cpu_flags = av_get_cpu_flags();
- dsp->put_vp8_bilinear_pixels_tab[2][0][0] = ff_put_vp8_pixels4_neon;
- dsp->put_vp8_bilinear_pixels_tab[2][0][1] = ff_put_vp8_bilin4_h_neon;
- dsp->put_vp8_bilinear_pixels_tab[2][0][2] = ff_put_vp8_bilin4_h_neon;
- dsp->put_vp8_bilinear_pixels_tab[2][1][0] = ff_put_vp8_bilin4_v_neon;
- dsp->put_vp8_bilinear_pixels_tab[2][1][1] = ff_put_vp8_bilin4_hv_neon;
- dsp->put_vp8_bilinear_pixels_tab[2][1][2] = ff_put_vp8_bilin4_hv_neon;
- dsp->put_vp8_bilinear_pixels_tab[2][2][0] = ff_put_vp8_bilin4_v_neon;
- dsp->put_vp8_bilinear_pixels_tab[2][2][1] = ff_put_vp8_bilin4_hv_neon;
- dsp->put_vp8_bilinear_pixels_tab[2][2][2] = ff_put_vp8_bilin4_hv_neon;
- }
+ if (have_armv6(cpu_flags))
+ ff_vp8dsp_init_armv6(dsp);
+ if (have_neon(cpu_flags))
+ ff_vp8dsp_init_neon(dsp);
}
diff --git a/gst-libs/ext/libav/libavcodec/arm/vp8dsp_init_armv6.c b/gst-libs/ext/libav/libavcodec/arm/vp8dsp_init_armv6.c
new file mode 100644
index 0000000..85a803a
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/arm/vp8dsp_init_armv6.c
@@ -0,0 +1,118 @@
+/*
+ * 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
+ */
+
+#include <stdint.h>
+#include "libavcodec/vp8dsp.h"
+#include "vp8dsp.h"
+
+void ff_vp8_luma_dc_wht_armv6(DCTELEM block[4][4][16], DCTELEM dc[16]);
+void ff_vp8_luma_dc_wht_dc_armv6(DCTELEM block[4][4][16], DCTELEM dc[16]);
+
+void ff_vp8_idct_add_armv6(uint8_t *dst, DCTELEM block[16], ptrdiff_t stride);
+void ff_vp8_idct_dc_add_armv6(uint8_t *dst, DCTELEM block[16], ptrdiff_t stride);
+void ff_vp8_idct_dc_add4y_armv6(uint8_t *dst, DCTELEM block[4][16], ptrdiff_t stride);
+void ff_vp8_idct_dc_add4uv_armv6(uint8_t *dst, DCTELEM block[4][16], ptrdiff_t stride);
+
+VP8_LF(armv6);
+
+VP8_EPEL(16, armv6);
+VP8_EPEL(8, armv6);
+VP8_EPEL(4, armv6);
+
+VP8_BILIN(16, armv6);
+VP8_BILIN(8, armv6);
+VP8_BILIN(4, armv6);
+
+av_cold void ff_vp8dsp_init_armv6(VP8DSPContext *dsp)
+{
+ dsp->vp8_luma_dc_wht = ff_vp8_luma_dc_wht_armv6;
+ dsp->vp8_luma_dc_wht_dc = ff_vp8_luma_dc_wht_dc_armv6;
+
+ dsp->vp8_idct_add = ff_vp8_idct_add_armv6;
+ dsp->vp8_idct_dc_add = ff_vp8_idct_dc_add_armv6;
+ dsp->vp8_idct_dc_add4y = ff_vp8_idct_dc_add4y_armv6;
+ dsp->vp8_idct_dc_add4uv = ff_vp8_idct_dc_add4uv_armv6;
+
+ dsp->vp8_v_loop_filter16y = ff_vp8_v_loop_filter16_armv6;
+ dsp->vp8_h_loop_filter16y = ff_vp8_h_loop_filter16_armv6;
+ dsp->vp8_v_loop_filter8uv = ff_vp8_v_loop_filter8uv_armv6;
+ dsp->vp8_h_loop_filter8uv = ff_vp8_h_loop_filter8uv_armv6;
+
+ dsp->vp8_v_loop_filter16y_inner = ff_vp8_v_loop_filter16_inner_armv6;
+ dsp->vp8_h_loop_filter16y_inner = ff_vp8_h_loop_filter16_inner_armv6;
+ dsp->vp8_v_loop_filter8uv_inner = ff_vp8_v_loop_filter8uv_inner_armv6;
+ dsp->vp8_h_loop_filter8uv_inner = ff_vp8_h_loop_filter8uv_inner_armv6;
+
+ dsp->vp8_v_loop_filter_simple = ff_vp8_v_loop_filter16_simple_armv6;
+ dsp->vp8_h_loop_filter_simple = ff_vp8_h_loop_filter16_simple_armv6;
+
+ dsp->put_vp8_epel_pixels_tab[0][0][0] = ff_put_vp8_pixels16_armv6;
+ dsp->put_vp8_epel_pixels_tab[0][0][2] = ff_put_vp8_epel16_h6_armv6;
+ dsp->put_vp8_epel_pixels_tab[0][2][0] = ff_put_vp8_epel16_v6_armv6;
+ dsp->put_vp8_epel_pixels_tab[0][2][2] = ff_put_vp8_epel16_h6v6_armv6;
+
+ dsp->put_vp8_epel_pixels_tab[1][0][0] = ff_put_vp8_pixels8_armv6;
+ dsp->put_vp8_epel_pixels_tab[1][0][1] = ff_put_vp8_epel8_h4_armv6;
+ dsp->put_vp8_epel_pixels_tab[1][0][2] = ff_put_vp8_epel8_h6_armv6;
+ dsp->put_vp8_epel_pixels_tab[1][1][0] = ff_put_vp8_epel8_v4_armv6;
+ dsp->put_vp8_epel_pixels_tab[1][1][1] = ff_put_vp8_epel8_h4v4_armv6;
+ dsp->put_vp8_epel_pixels_tab[1][1][2] = ff_put_vp8_epel8_h6v4_armv6;
+ dsp->put_vp8_epel_pixels_tab[1][2][0] = ff_put_vp8_epel8_v6_armv6;
+ dsp->put_vp8_epel_pixels_tab[1][2][1] = ff_put_vp8_epel8_h4v6_armv6;
+ dsp->put_vp8_epel_pixels_tab[1][2][2] = ff_put_vp8_epel8_h6v6_armv6;
+
+ dsp->put_vp8_epel_pixels_tab[2][0][0] = ff_put_vp8_pixels4_armv6;
+ dsp->put_vp8_epel_pixels_tab[2][0][1] = ff_put_vp8_epel4_h4_armv6;
+ dsp->put_vp8_epel_pixels_tab[2][0][2] = ff_put_vp8_epel4_h6_armv6;
+ dsp->put_vp8_epel_pixels_tab[2][1][0] = ff_put_vp8_epel4_v4_armv6;
+ dsp->put_vp8_epel_pixels_tab[2][1][1] = ff_put_vp8_epel4_h4v4_armv6;
+ dsp->put_vp8_epel_pixels_tab[2][1][2] = ff_put_vp8_epel4_h6v4_armv6;
+ dsp->put_vp8_epel_pixels_tab[2][2][0] = ff_put_vp8_epel4_v6_armv6;
+ dsp->put_vp8_epel_pixels_tab[2][2][1] = ff_put_vp8_epel4_h4v6_armv6;
+ dsp->put_vp8_epel_pixels_tab[2][2][2] = ff_put_vp8_epel4_h6v6_armv6;
+
+ dsp->put_vp8_bilinear_pixels_tab[0][0][0] = ff_put_vp8_pixels16_armv6;
+ dsp->put_vp8_bilinear_pixels_tab[0][0][1] = ff_put_vp8_bilin16_h_armv6;
+ dsp->put_vp8_bilinear_pixels_tab[0][0][2] = ff_put_vp8_bilin16_h_armv6;
+ dsp->put_vp8_bilinear_pixels_tab[0][1][0] = ff_put_vp8_bilin16_v_armv6;
+ dsp->put_vp8_bilinear_pixels_tab[0][1][1] = ff_put_vp8_bilin16_hv_armv6;
+ dsp->put_vp8_bilinear_pixels_tab[0][1][2] = ff_put_vp8_bilin16_hv_armv6;
+ dsp->put_vp8_bilinear_pixels_tab[0][2][0] = ff_put_vp8_bilin16_v_armv6;
+ dsp->put_vp8_bilinear_pixels_tab[0][2][1] = ff_put_vp8_bilin16_hv_armv6;
+ dsp->put_vp8_bilinear_pixels_tab[0][2][2] = ff_put_vp8_bilin16_hv_armv6;
+
+ dsp->put_vp8_bilinear_pixels_tab[1][0][0] = ff_put_vp8_pixels8_armv6;
+ dsp->put_vp8_bilinear_pixels_tab[1][0][1] = ff_put_vp8_bilin8_h_armv6;
+ dsp->put_vp8_bilinear_pixels_tab[1][0][2] = ff_put_vp8_bilin8_h_armv6;
+ dsp->put_vp8_bilinear_pixels_tab[1][1][0] = ff_put_vp8_bilin8_v_armv6;
+ dsp->put_vp8_bilinear_pixels_tab[1][1][1] = ff_put_vp8_bilin8_hv_armv6;
+ dsp->put_vp8_bilinear_pixels_tab[1][1][2] = ff_put_vp8_bilin8_hv_armv6;
+ dsp->put_vp8_bilinear_pixels_tab[1][2][0] = ff_put_vp8_bilin8_v_armv6;
+ dsp->put_vp8_bilinear_pixels_tab[1][2][1] = ff_put_vp8_bilin8_hv_armv6;
+ dsp->put_vp8_bilinear_pixels_tab[1][2][2] = ff_put_vp8_bilin8_hv_armv6;
+
+ dsp->put_vp8_bilinear_pixels_tab[2][0][0] = ff_put_vp8_pixels4_armv6;
+ dsp->put_vp8_bilinear_pixels_tab[2][0][1] = ff_put_vp8_bilin4_h_armv6;
+ dsp->put_vp8_bilinear_pixels_tab[2][0][2] = ff_put_vp8_bilin4_h_armv6;
+ dsp->put_vp8_bilinear_pixels_tab[2][1][0] = ff_put_vp8_bilin4_v_armv6;
+ dsp->put_vp8_bilinear_pixels_tab[2][1][1] = ff_put_vp8_bilin4_hv_armv6;
+ dsp->put_vp8_bilinear_pixels_tab[2][1][2] = ff_put_vp8_bilin4_hv_armv6;
+ dsp->put_vp8_bilinear_pixels_tab[2][2][0] = ff_put_vp8_bilin4_v_armv6;
+ dsp->put_vp8_bilinear_pixels_tab[2][2][1] = ff_put_vp8_bilin4_hv_armv6;
+ dsp->put_vp8_bilinear_pixels_tab[2][2][2] = ff_put_vp8_bilin4_hv_armv6;
+}
diff --git a/gst-libs/ext/libav/libavcodec/arm/vp8dsp_init_neon.c b/gst-libs/ext/libav/libavcodec/arm/vp8dsp_init_neon.c
new file mode 100644
index 0000000..dbe5b9f
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/arm/vp8dsp_init_neon.c
@@ -0,0 +1,114 @@
+/*
+ * 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
+ */
+
+#include <stdint.h>
+#include "libavcodec/vp8dsp.h"
+#include "vp8dsp.h"
+
+void ff_vp8_luma_dc_wht_neon(DCTELEM block[4][4][16], DCTELEM dc[16]);
+
+void ff_vp8_idct_add_neon(uint8_t *dst, DCTELEM block[16], ptrdiff_t stride);
+void ff_vp8_idct_dc_add_neon(uint8_t *dst, DCTELEM block[16], ptrdiff_t stride);
+void ff_vp8_idct_dc_add4y_neon(uint8_t *dst, DCTELEM block[4][16], ptrdiff_t stride);
+void ff_vp8_idct_dc_add4uv_neon(uint8_t *dst, DCTELEM block[4][16], ptrdiff_t stride);
+
+VP8_LF(neon);
+
+VP8_EPEL(16, neon);
+VP8_EPEL(8, neon);
+VP8_EPEL(4, neon);
+
+VP8_BILIN(16, neon);
+VP8_BILIN(8, neon);
+VP8_BILIN(4, neon);
+
+av_cold void ff_vp8dsp_init_neon(VP8DSPContext *dsp)
+{
+ dsp->vp8_luma_dc_wht = ff_vp8_luma_dc_wht_neon;
+
+ dsp->vp8_idct_add = ff_vp8_idct_add_neon;
+ dsp->vp8_idct_dc_add = ff_vp8_idct_dc_add_neon;
+ dsp->vp8_idct_dc_add4y = ff_vp8_idct_dc_add4y_neon;
+ dsp->vp8_idct_dc_add4uv = ff_vp8_idct_dc_add4uv_neon;
+
+ dsp->vp8_v_loop_filter16y = ff_vp8_v_loop_filter16_neon;
+ dsp->vp8_h_loop_filter16y = ff_vp8_h_loop_filter16_neon;
+ dsp->vp8_v_loop_filter8uv = ff_vp8_v_loop_filter8uv_neon;
+ dsp->vp8_h_loop_filter8uv = ff_vp8_h_loop_filter8uv_neon;
+
+ dsp->vp8_v_loop_filter16y_inner = ff_vp8_v_loop_filter16_inner_neon;
+ dsp->vp8_h_loop_filter16y_inner = ff_vp8_h_loop_filter16_inner_neon;
+ dsp->vp8_v_loop_filter8uv_inner = ff_vp8_v_loop_filter8uv_inner_neon;
+ dsp->vp8_h_loop_filter8uv_inner = ff_vp8_h_loop_filter8uv_inner_neon;
+
+ dsp->vp8_v_loop_filter_simple = ff_vp8_v_loop_filter16_simple_neon;
+ dsp->vp8_h_loop_filter_simple = ff_vp8_h_loop_filter16_simple_neon;
+
+ dsp->put_vp8_epel_pixels_tab[0][0][0] = ff_put_vp8_pixels16_neon;
+ dsp->put_vp8_epel_pixels_tab[0][0][2] = ff_put_vp8_epel16_h6_neon;
+ dsp->put_vp8_epel_pixels_tab[0][2][0] = ff_put_vp8_epel16_v6_neon;
+ dsp->put_vp8_epel_pixels_tab[0][2][2] = ff_put_vp8_epel16_h6v6_neon;
+
+ dsp->put_vp8_epel_pixels_tab[1][0][0] = ff_put_vp8_pixels8_neon;
+ dsp->put_vp8_epel_pixels_tab[1][0][1] = ff_put_vp8_epel8_h4_neon;
+ dsp->put_vp8_epel_pixels_tab[1][0][2] = ff_put_vp8_epel8_h6_neon;
+ dsp->put_vp8_epel_pixels_tab[1][1][0] = ff_put_vp8_epel8_v4_neon;
+ dsp->put_vp8_epel_pixels_tab[1][1][1] = ff_put_vp8_epel8_h4v4_neon;
+ dsp->put_vp8_epel_pixels_tab[1][1][2] = ff_put_vp8_epel8_h6v4_neon;
+ dsp->put_vp8_epel_pixels_tab[1][2][0] = ff_put_vp8_epel8_v6_neon;
+ dsp->put_vp8_epel_pixels_tab[1][2][1] = ff_put_vp8_epel8_h4v6_neon;
+ dsp->put_vp8_epel_pixels_tab[1][2][2] = ff_put_vp8_epel8_h6v6_neon;
+
+ dsp->put_vp8_epel_pixels_tab[2][0][1] = ff_put_vp8_epel4_h4_neon;
+ dsp->put_vp8_epel_pixels_tab[2][0][2] = ff_put_vp8_epel4_h6_neon;
+ dsp->put_vp8_epel_pixels_tab[2][1][0] = ff_put_vp8_epel4_v4_neon;
+ dsp->put_vp8_epel_pixels_tab[2][1][1] = ff_put_vp8_epel4_h4v4_neon;
+ dsp->put_vp8_epel_pixels_tab[2][1][2] = ff_put_vp8_epel4_h6v4_neon;
+ dsp->put_vp8_epel_pixels_tab[2][2][0] = ff_put_vp8_epel4_v6_neon;
+ dsp->put_vp8_epel_pixels_tab[2][2][1] = ff_put_vp8_epel4_h4v6_neon;
+ dsp->put_vp8_epel_pixels_tab[2][2][2] = ff_put_vp8_epel4_h6v6_neon;
+
+ dsp->put_vp8_bilinear_pixels_tab[0][0][0] = ff_put_vp8_pixels16_neon;
+ dsp->put_vp8_bilinear_pixels_tab[0][0][1] = ff_put_vp8_bilin16_h_neon;
+ dsp->put_vp8_bilinear_pixels_tab[0][0][2] = ff_put_vp8_bilin16_h_neon;
+ dsp->put_vp8_bilinear_pixels_tab[0][1][0] = ff_put_vp8_bilin16_v_neon;
+ dsp->put_vp8_bilinear_pixels_tab[0][1][1] = ff_put_vp8_bilin16_hv_neon;
+ dsp->put_vp8_bilinear_pixels_tab[0][1][2] = ff_put_vp8_bilin16_hv_neon;
+ dsp->put_vp8_bilinear_pixels_tab[0][2][0] = ff_put_vp8_bilin16_v_neon;
+ dsp->put_vp8_bilinear_pixels_tab[0][2][1] = ff_put_vp8_bilin16_hv_neon;
+ dsp->put_vp8_bilinear_pixels_tab[0][2][2] = ff_put_vp8_bilin16_hv_neon;
+
+ dsp->put_vp8_bilinear_pixels_tab[1][0][0] = ff_put_vp8_pixels8_neon;
+ dsp->put_vp8_bilinear_pixels_tab[1][0][1] = ff_put_vp8_bilin8_h_neon;
+ dsp->put_vp8_bilinear_pixels_tab[1][0][2] = ff_put_vp8_bilin8_h_neon;
+ dsp->put_vp8_bilinear_pixels_tab[1][1][0] = ff_put_vp8_bilin8_v_neon;
+ dsp->put_vp8_bilinear_pixels_tab[1][1][1] = ff_put_vp8_bilin8_hv_neon;
+ dsp->put_vp8_bilinear_pixels_tab[1][1][2] = ff_put_vp8_bilin8_hv_neon;
+ dsp->put_vp8_bilinear_pixels_tab[1][2][0] = ff_put_vp8_bilin8_v_neon;
+ dsp->put_vp8_bilinear_pixels_tab[1][2][1] = ff_put_vp8_bilin8_hv_neon;
+ dsp->put_vp8_bilinear_pixels_tab[1][2][2] = ff_put_vp8_bilin8_hv_neon;
+
+ dsp->put_vp8_bilinear_pixels_tab[2][0][1] = ff_put_vp8_bilin4_h_neon;
+ dsp->put_vp8_bilinear_pixels_tab[2][0][2] = ff_put_vp8_bilin4_h_neon;
+ dsp->put_vp8_bilinear_pixels_tab[2][1][0] = ff_put_vp8_bilin4_v_neon;
+ dsp->put_vp8_bilinear_pixels_tab[2][1][1] = ff_put_vp8_bilin4_hv_neon;
+ dsp->put_vp8_bilinear_pixels_tab[2][1][2] = ff_put_vp8_bilin4_hv_neon;
+ dsp->put_vp8_bilinear_pixels_tab[2][2][0] = ff_put_vp8_bilin4_v_neon;
+ dsp->put_vp8_bilinear_pixels_tab[2][2][1] = ff_put_vp8_bilin4_hv_neon;
+ dsp->put_vp8_bilinear_pixels_tab[2][2][2] = ff_put_vp8_bilin4_hv_neon;
+}
diff --git a/gst-libs/ext/libav/libavcodec/arm/vp8dsp_neon.S b/gst-libs/ext/libav/libavcodec/arm/vp8dsp_neon.S
index 4ff53ad..0cd2efa 100644
--- a/gst-libs/ext/libav/libavcodec/arm/vp8dsp_neon.S
+++ b/gst-libs/ext/libav/libavcodec/arm/vp8dsp_neon.S
@@ -1,4 +1,4 @@
-/**
+/*
* VP8 NEON optimisations
*
* Copyright (c) 2010 Rob Clark <rob@ti.com>
@@ -21,7 +21,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "asm.S"
+#include "libavutil/arm/asm.S"
#include "neon.S"
function ff_vp8_luma_dc_wht_neon, export=1
@@ -77,18 +77,6 @@ function ff_vp8_luma_dc_wht_neon, export=1
bx lr
endfunc
-function ff_vp8_luma_dc_wht_dc_neon, export=1
- ldrsh r2, [r1]
- mov r3, #0
- add r2, r2, #3
- strh r3, [r1]
- asr r2, r2, #3
- .rept 16
- strh r2, [r0], #32
- .endr
- bx lr
-endfunc
-
function ff_vp8_idct_add_neon, export=1
vld1.16 {q0-q1}, [r1,:128]
movw r3, #20091
@@ -725,23 +713,6 @@ function ff_put_vp8_pixels8_neon, export=1
bx lr
endfunc
-function ff_put_vp8_pixels4_neon, export=1
- ldr r12, [sp, #0] @ h
- push {r4-r6,lr}
-1:
- subs r12, r12, #4
- ldr_post r4, r2, r3
- ldr_post r5, r2, r3
- ldr_post r6, r2, r3
- ldr_post lr, r2, r3
- str_post r4, r0, r1
- str_post r5, r0, r1
- str_post r6, r0, r1
- str_post lr, r0, r1
- bgt 1b
- pop {r4-r6,pc}
-endfunc
-
/* 4/6-tap 8th-pel MC */
.macro vp8_epel8_h6 d, a, b
diff --git a/gst-libs/ext/libav/libavcodec/ass.c b/gst-libs/ext/libav/libavcodec/ass.c
index 327a77b..3585b93 100644
--- a/gst-libs/ext/libav/libavcodec/ass.c
+++ b/gst-libs/ext/libav/libavcodec/ass.c
@@ -22,6 +22,7 @@
#include "avcodec.h"
#include "ass.h"
#include "libavutil/avstring.h"
+#include "libavutil/common.h"
/**
* Generate a suitable AVCodecContext.subtitle_header for SUBTITLE_ASS.
diff --git a/gst-libs/ext/libav/libavcodec/assdec.c b/gst-libs/ext/libav/libavcodec/assdec.c
index 98f7be3..7a69582 100644
--- a/gst-libs/ext/libav/libavcodec/assdec.c
+++ b/gst-libs/ext/libav/libavcodec/assdec.c
@@ -19,8 +19,12 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <string.h>
+
#include "avcodec.h"
#include "ass.h"
+#include "libavutil/internal.h"
+#include "libavutil/mem.h"
static av_cold int ass_decode_init(AVCodecContext *avctx)
{
@@ -54,9 +58,9 @@ static int ass_decode_frame(AVCodecContext *avctx, void *data, int *got_sub_ptr,
AVCodec ff_ass_decoder = {
.name = "ass",
- .long_name = NULL_IF_CONFIG_SMALL("Advanced SubStation Alpha subtitle"),
+ .long_name = NULL_IF_CONFIG_SMALL("SSA (SubStation Alpha) subtitle"),
.type = AVMEDIA_TYPE_SUBTITLE,
- .id = CODEC_ID_SSA,
+ .id = AV_CODEC_ID_SSA,
.init = ass_decode_init,
.decode = ass_decode_frame,
};
diff --git a/gst-libs/ext/libav/libavcodec/assenc.c b/gst-libs/ext/libav/libavcodec/assenc.c
index b7836ff..caf266e 100644
--- a/gst-libs/ext/libav/libavcodec/assenc.c
+++ b/gst-libs/ext/libav/libavcodec/assenc.c
@@ -19,8 +19,12 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <string.h>
+
#include "avcodec.h"
#include "libavutil/avstring.h"
+#include "libavutil/internal.h"
+#include "libavutil/mem.h"
static av_cold int ass_encode_init(AVCodecContext *avctx)
{
@@ -33,9 +37,9 @@ static av_cold int ass_encode_init(AVCodecContext *avctx)
}
static int ass_encode_frame(AVCodecContext *avctx,
- unsigned char *buf, int bufsize, void *data)
+ unsigned char *buf, int bufsize,
+ const AVSubtitle *sub)
{
- AVSubtitle *sub = data;
int i, len, total_len = 0;
for (i=0; i<sub->num_rects; i++) {
@@ -59,9 +63,9 @@ static int ass_encode_frame(AVCodecContext *avctx,
AVCodec ff_ass_encoder = {
.name = "ass",
- .long_name = NULL_IF_CONFIG_SMALL("Advanced SubStation Alpha subtitle"),
+ .long_name = NULL_IF_CONFIG_SMALL("SSA (SubStation Alpha) subtitle"),
.type = AVMEDIA_TYPE_SUBTITLE,
- .id = CODEC_ID_SSA,
+ .id = AV_CODEC_ID_SSA,
.init = ass_encode_init,
- .encode = ass_encode_frame,
+ .encode_sub = ass_encode_frame,
};
diff --git a/gst-libs/ext/libav/libavcodec/asv.c b/gst-libs/ext/libav/libavcodec/asv.c
new file mode 100644
index 0000000..b15182d
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/asv.c
@@ -0,0 +1,95 @@
+/*
+ * Copyright (c) 2003 Michael Niedermayer
+ *
+ * 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
+ * ASUS V1/V2 encoder/decoder common data
+ */
+
+#include <stdint.h>
+
+#include "asv.h"
+#include "avcodec.h"
+#include "dsputil.h"
+
+const uint8_t ff_asv_scantab[64] = {
+ 0x00,0x08,0x01,0x09,0x10,0x18,0x11,0x19,
+ 0x02,0x0A,0x03,0x0B,0x12,0x1A,0x13,0x1B,
+ 0x04,0x0C,0x05,0x0D,0x20,0x28,0x21,0x29,
+ 0x06,0x0E,0x07,0x0F,0x14,0x1C,0x15,0x1D,
+ 0x22,0x2A,0x23,0x2B,0x30,0x38,0x31,0x39,
+ 0x16,0x1E,0x17,0x1F,0x24,0x2C,0x25,0x2D,
+ 0x32,0x3A,0x33,0x3B,0x26,0x2E,0x27,0x2F,
+ 0x34,0x3C,0x35,0x3D,0x36,0x3E,0x37,0x3F,
+};
+
+const uint8_t ff_asv_ccp_tab[17][2] = {
+ {0x2,2}, {0x7,5}, {0xB,5}, {0x3,5},
+ {0xD,5}, {0x5,5}, {0x9,5}, {0x1,5},
+ {0xE,5}, {0x6,5}, {0xA,5}, {0x2,5},
+ {0xC,5}, {0x4,5}, {0x8,5}, {0x3,2},
+ {0xF,5}, //EOB
+};
+
+const uint8_t ff_asv_level_tab[7][2] = {
+ {3,4}, {3,3}, {3,2}, {0,3}, {2,2}, {2,3}, {2,4}
+};
+
+const uint8_t ff_asv_dc_ccp_tab[8][2] = {
+ {0x1,2}, {0xD,4}, {0xF,4}, {0xC,4},
+ {0x5,3}, {0xE,4}, {0x4,3}, {0x0,2},
+};
+
+const uint8_t ff_asv_ac_ccp_tab[16][2] = {
+ {0x00,2}, {0x3B,6}, {0x0A,4}, {0x3A,6},
+ {0x02,3}, {0x39,6}, {0x3C,6}, {0x38,6},
+ {0x03,3}, {0x3D,6}, {0x08,4}, {0x1F,5},
+ {0x09,4}, {0x0B,4}, {0x0D,4}, {0x0C,4},
+};
+
+const uint8_t ff_asv2_level_tab[63][2] = {
+ {0x3F,10},{0x2F,10},{0x37,10},{0x27,10},{0x3B,10},{0x2B,10},{0x33,10},{0x23,10},
+ {0x3D,10},{0x2D,10},{0x35,10},{0x25,10},{0x39,10},{0x29,10},{0x31,10},{0x21,10},
+ {0x1F, 8},{0x17, 8},{0x1B, 8},{0x13, 8},{0x1D, 8},{0x15, 8},{0x19, 8},{0x11, 8},
+ {0x0F, 6},{0x0B, 6},{0x0D, 6},{0x09, 6},
+ {0x07, 4},{0x05, 4},
+ {0x03, 2},
+ {0x00, 5},
+ {0x02, 2},
+ {0x04, 4},{0x06, 4},
+ {0x08, 6},{0x0C, 6},{0x0A, 6},{0x0E, 6},
+ {0x10, 8},{0x18, 8},{0x14, 8},{0x1C, 8},{0x12, 8},{0x1A, 8},{0x16, 8},{0x1E, 8},
+ {0x20,10},{0x30,10},{0x28,10},{0x38,10},{0x24,10},{0x34,10},{0x2C,10},{0x3C,10},
+ {0x22,10},{0x32,10},{0x2A,10},{0x3A,10},{0x26,10},{0x36,10},{0x2E,10},{0x3E,10},
+};
+
+av_cold void ff_asv_common_init(AVCodecContext *avctx) {
+ ASV1Context * const a = avctx->priv_data;
+
+ ff_dsputil_init(&a->dsp, avctx);
+
+ a->mb_width = (avctx->width + 15) / 16;
+ a->mb_height = (avctx->height + 15) / 16;
+ a->mb_width2 = (avctx->width + 0) / 16;
+ a->mb_height2 = (avctx->height + 0) / 16;
+
+ avctx->coded_frame= &a->picture;
+ a->avctx= avctx;
+}
diff --git a/gst-libs/ext/libav/libavcodec/asv.h b/gst-libs/ext/libav/libavcodec/asv.h
new file mode 100644
index 0000000..3440f93
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/asv.h
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2003 Michael Niedermayer
+ *
+ * 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
+ * ASUS V1/V2 encoder/decoder common data.
+ */
+
+#ifndef AVCODEC_ASV_H
+#define AVCODEC_ASV_H
+
+#include <stdint.h>
+
+#include "libavutil/attributes.h"
+#include "libavutil/mem.h"
+
+#include "avcodec.h"
+#include "dsputil.h"
+#include "get_bits.h"
+#include "put_bits.h"
+
+typedef struct ASV1Context{
+ AVCodecContext *avctx;
+ DSPContext dsp;
+ AVFrame picture;
+ PutBitContext pb;
+ GetBitContext gb;
+ ScanTable scantable;
+ int inv_qscale;
+ int mb_width;
+ int mb_height;
+ int mb_width2;
+ int mb_height2;
+ DECLARE_ALIGNED(16, DCTELEM, block)[6][64];
+ uint16_t intra_matrix[64];
+ int q_intra_matrix[64];
+ uint8_t *bitstream_buffer;
+ unsigned int bitstream_buffer_size;
+} ASV1Context;
+
+extern const uint8_t ff_asv_scantab[64];
+extern const uint8_t ff_asv_ccp_tab[17][2];
+extern const uint8_t ff_asv_level_tab[7][2];
+extern const uint8_t ff_asv_dc_ccp_tab[8][2];
+extern const uint8_t ff_asv_ac_ccp_tab[16][2];
+extern const uint8_t ff_asv2_level_tab[63][2];
+
+av_cold void ff_asv_common_init(AVCodecContext *avctx);
+
+#endif /* AVCODEC_ASV_H */
diff --git a/gst-libs/ext/libav/libavcodec/asv1.c b/gst-libs/ext/libav/libavcodec/asv1.c
deleted file mode 100644
index 8db23c0..0000000
--- a/gst-libs/ext/libav/libavcodec/asv1.c
+++ /dev/null
@@ -1,655 +0,0 @@
-/*
- * ASUS V1/V2 codec
- * Copyright (c) 2003 Michael Niedermayer
- *
- * 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
- * ASUS V1/V2 codec.
- */
-
-#include "avcodec.h"
-#include "libavutil/common.h"
-#include "put_bits.h"
-#include "dsputil.h"
-#include "mpeg12data.h"
-
-//#undef NDEBUG
-//#include <assert.h>
-
-#define VLC_BITS 6
-#define ASV2_LEVEL_VLC_BITS 10
-
-typedef struct ASV1Context{
- AVCodecContext *avctx;
- DSPContext dsp;
- AVFrame picture;
- PutBitContext pb;
- GetBitContext gb;
- ScanTable scantable;
- int inv_qscale;
- int mb_width;
- int mb_height;
- int mb_width2;
- int mb_height2;
- DECLARE_ALIGNED(16, DCTELEM, block)[6][64];
- uint16_t intra_matrix[64];
- int q_intra_matrix[64];
- uint8_t *bitstream_buffer;
- unsigned int bitstream_buffer_size;
-} ASV1Context;
-
-static const uint8_t scantab[64]={
- 0x00,0x08,0x01,0x09,0x10,0x18,0x11,0x19,
- 0x02,0x0A,0x03,0x0B,0x12,0x1A,0x13,0x1B,
- 0x04,0x0C,0x05,0x0D,0x20,0x28,0x21,0x29,
- 0x06,0x0E,0x07,0x0F,0x14,0x1C,0x15,0x1D,
- 0x22,0x2A,0x23,0x2B,0x30,0x38,0x31,0x39,
- 0x16,0x1E,0x17,0x1F,0x24,0x2C,0x25,0x2D,
- 0x32,0x3A,0x33,0x3B,0x26,0x2E,0x27,0x2F,
- 0x34,0x3C,0x35,0x3D,0x36,0x3E,0x37,0x3F,
-};
-
-
-static const uint8_t ccp_tab[17][2]={
- {0x2,2}, {0x7,5}, {0xB,5}, {0x3,5},
- {0xD,5}, {0x5,5}, {0x9,5}, {0x1,5},
- {0xE,5}, {0x6,5}, {0xA,5}, {0x2,5},
- {0xC,5}, {0x4,5}, {0x8,5}, {0x3,2},
- {0xF,5}, //EOB
-};
-
-static const uint8_t level_tab[7][2]={
- {3,4}, {3,3}, {3,2}, {0,3}, {2,2}, {2,3}, {2,4}
-};
-
-static const uint8_t dc_ccp_tab[8][2]={
- {0x1,2}, {0xD,4}, {0xF,4}, {0xC,4},
- {0x5,3}, {0xE,4}, {0x4,3}, {0x0,2},
-};
-
-static const uint8_t ac_ccp_tab[16][2]={
- {0x00,2}, {0x3B,6}, {0x0A,4}, {0x3A,6},
- {0x02,3}, {0x39,6}, {0x3C,6}, {0x38,6},
- {0x03,3}, {0x3D,6}, {0x08,4}, {0x1F,5},
- {0x09,4}, {0x0B,4}, {0x0D,4}, {0x0C,4},
-};
-
-static const uint8_t asv2_level_tab[63][2]={
- {0x3F,10},{0x2F,10},{0x37,10},{0x27,10},{0x3B,10},{0x2B,10},{0x33,10},{0x23,10},
- {0x3D,10},{0x2D,10},{0x35,10},{0x25,10},{0x39,10},{0x29,10},{0x31,10},{0x21,10},
- {0x1F, 8},{0x17, 8},{0x1B, 8},{0x13, 8},{0x1D, 8},{0x15, 8},{0x19, 8},{0x11, 8},
- {0x0F, 6},{0x0B, 6},{0x0D, 6},{0x09, 6},
- {0x07, 4},{0x05, 4},
- {0x03, 2},
- {0x00, 5},
- {0x02, 2},
- {0x04, 4},{0x06, 4},
- {0x08, 6},{0x0C, 6},{0x0A, 6},{0x0E, 6},
- {0x10, 8},{0x18, 8},{0x14, 8},{0x1C, 8},{0x12, 8},{0x1A, 8},{0x16, 8},{0x1E, 8},
- {0x20,10},{0x30,10},{0x28,10},{0x38,10},{0x24,10},{0x34,10},{0x2C,10},{0x3C,10},
- {0x22,10},{0x32,10},{0x2A,10},{0x3A,10},{0x26,10},{0x36,10},{0x2E,10},{0x3E,10},
-};
-
-
-static VLC ccp_vlc;
-static VLC level_vlc;
-static VLC dc_ccp_vlc;
-static VLC ac_ccp_vlc;
-static VLC asv2_level_vlc;
-
-static av_cold void init_vlcs(ASV1Context *a){
- static int done = 0;
-
- if (!done) {
- done = 1;
-
- INIT_VLC_STATIC(&ccp_vlc, VLC_BITS, 17,
- &ccp_tab[0][1], 2, 1,
- &ccp_tab[0][0], 2, 1, 64);
- INIT_VLC_STATIC(&dc_ccp_vlc, VLC_BITS, 8,
- &dc_ccp_tab[0][1], 2, 1,
- &dc_ccp_tab[0][0], 2, 1, 64);
- INIT_VLC_STATIC(&ac_ccp_vlc, VLC_BITS, 16,
- &ac_ccp_tab[0][1], 2, 1,
- &ac_ccp_tab[0][0], 2, 1, 64);
- INIT_VLC_STATIC(&level_vlc, VLC_BITS, 7,
- &level_tab[0][1], 2, 1,
- &level_tab[0][0], 2, 1, 64);
- INIT_VLC_STATIC(&asv2_level_vlc, ASV2_LEVEL_VLC_BITS, 63,
- &asv2_level_tab[0][1], 2, 1,
- &asv2_level_tab[0][0], 2, 1, 1024);
- }
-}
-
-//FIXME write a reversed bitstream reader to avoid the double reverse
-static inline int asv2_get_bits(GetBitContext *gb, int n){
- return av_reverse[ get_bits(gb, n) << (8-n) ];
-}
-
-static inline void asv2_put_bits(PutBitContext *pb, int n, int v){
- put_bits(pb, n, av_reverse[ v << (8-n) ]);
-}
-
-static inline int asv1_get_level(GetBitContext *gb){
- int code= get_vlc2(gb, level_vlc.table, VLC_BITS, 1);
-
- if(code==3) return get_sbits(gb, 8);
- else return code - 3;
-}
-
-static inline int asv2_get_level(GetBitContext *gb){
- int code= get_vlc2(gb, asv2_level_vlc.table, ASV2_LEVEL_VLC_BITS, 1);
-
- if(code==31) return (int8_t)asv2_get_bits(gb, 8);
- else return code - 31;
-}
-
-static inline void asv1_put_level(PutBitContext *pb, int level){
- unsigned int index= level + 3;
-
- if(index <= 6) put_bits(pb, level_tab[index][1], level_tab[index][0]);
- else{
- put_bits(pb, level_tab[3][1], level_tab[3][0]);
- put_sbits(pb, 8, level);
- }
-}
-
-static inline void asv2_put_level(PutBitContext *pb, int level){
- unsigned int index= level + 31;
-
- if(index <= 62) put_bits(pb, asv2_level_tab[index][1], asv2_level_tab[index][0]);
- else{
- put_bits(pb, asv2_level_tab[31][1], asv2_level_tab[31][0]);
- asv2_put_bits(pb, 8, level&0xFF);
- }
-}
-
-static inline int asv1_decode_block(ASV1Context *a, DCTELEM block[64]){
- int i;
-
- block[0]= 8*get_bits(&a->gb, 8);
-
- for(i=0; i<11; i++){
- const int ccp= get_vlc2(&a->gb, ccp_vlc.table, VLC_BITS, 1);
-
- if(ccp){
- if(ccp == 16) break;
- if(ccp < 0 || i>=10){
- av_log(a->avctx, AV_LOG_ERROR, "coded coeff pattern damaged\n");
- return -1;
- }
-
- if(ccp&8) block[a->scantable.permutated[4*i+0]]= (asv1_get_level(&a->gb) * a->intra_matrix[4*i+0])>>4;
- if(ccp&4) block[a->scantable.permutated[4*i+1]]= (asv1_get_level(&a->gb) * a->intra_matrix[4*i+1])>>4;
- if(ccp&2) block[a->scantable.permutated[4*i+2]]= (asv1_get_level(&a->gb) * a->intra_matrix[4*i+2])>>4;
- if(ccp&1) block[a->scantable.permutated[4*i+3]]= (asv1_get_level(&a->gb) * a->intra_matrix[4*i+3])>>4;
- }
- }
-
- return 0;
-}
-
-static inline int asv2_decode_block(ASV1Context *a, DCTELEM block[64]){
- int i, count, ccp;
-
- count= asv2_get_bits(&a->gb, 4);
-
- block[0]= 8*asv2_get_bits(&a->gb, 8);
-
- ccp= get_vlc2(&a->gb, dc_ccp_vlc.table, VLC_BITS, 1);
- if(ccp){
- if(ccp&4) block[a->scantable.permutated[1]]= (asv2_get_level(&a->gb) * a->intra_matrix[1])>>4;
- if(ccp&2) block[a->scantable.permutated[2]]= (asv2_get_level(&a->gb) * a->intra_matrix[2])>>4;
- if(ccp&1) block[a->scantable.permutated[3]]= (asv2_get_level(&a->gb) * a->intra_matrix[3])>>4;
- }
-
- for(i=1; i<count+1; i++){
- const int ccp= get_vlc2(&a->gb, ac_ccp_vlc.table, VLC_BITS, 1);
-
- if(ccp){
- if(ccp&8) block[a->scantable.permutated[4*i+0]]= (asv2_get_level(&a->gb) * a->intra_matrix[4*i+0])>>4;
- if(ccp&4) block[a->scantable.permutated[4*i+1]]= (asv2_get_level(&a->gb) * a->intra_matrix[4*i+1])>>4;
- if(ccp&2) block[a->scantable.permutated[4*i+2]]= (asv2_get_level(&a->gb) * a->intra_matrix[4*i+2])>>4;
- if(ccp&1) block[a->scantable.permutated[4*i+3]]= (asv2_get_level(&a->gb) * a->intra_matrix[4*i+3])>>4;
- }
- }
-
- return 0;
-}
-
-static inline void asv1_encode_block(ASV1Context *a, DCTELEM block[64]){
- int i;
- int nc_count=0;
-
- put_bits(&a->pb, 8, (block[0] + 32)>>6);
- block[0]= 0;
-
- for(i=0; i<10; i++){
- const int index= scantab[4*i];
- int ccp=0;
-
- if( (block[index + 0] = (block[index + 0]*a->q_intra_matrix[index + 0] + (1<<15))>>16) ) ccp |= 8;
- if( (block[index + 8] = (block[index + 8]*a->q_intra_matrix[index + 8] + (1<<15))>>16) ) ccp |= 4;
- if( (block[index + 1] = (block[index + 1]*a->q_intra_matrix[index + 1] + (1<<15))>>16) ) ccp |= 2;
- if( (block[index + 9] = (block[index + 9]*a->q_intra_matrix[index + 9] + (1<<15))>>16) ) ccp |= 1;
-
- if(ccp){
- for(;nc_count; nc_count--)
- put_bits(&a->pb, ccp_tab[0][1], ccp_tab[0][0]);
-
- put_bits(&a->pb, ccp_tab[ccp][1], ccp_tab[ccp][0]);
-
- if(ccp&8) asv1_put_level(&a->pb, block[index + 0]);
- if(ccp&4) asv1_put_level(&a->pb, block[index + 8]);
- if(ccp&2) asv1_put_level(&a->pb, block[index + 1]);
- if(ccp&1) asv1_put_level(&a->pb, block[index + 9]);
- }else{
- nc_count++;
- }
- }
- put_bits(&a->pb, ccp_tab[16][1], ccp_tab[16][0]);
-}
-
-static inline void asv2_encode_block(ASV1Context *a, DCTELEM block[64]){
- int i;
- int count=0;
-
- for(count=63; count>3; count--){
- const int index= scantab[count];
-
- if( (block[index]*a->q_intra_matrix[index] + (1<<15))>>16 )
- break;
- }
-
- count >>= 2;
-
- asv2_put_bits(&a->pb, 4, count);
- asv2_put_bits(&a->pb, 8, (block[0] + 32)>>6);
- block[0]= 0;
-
- for(i=0; i<=count; i++){
- const int index= scantab[4*i];
- int ccp=0;
-
- if( (block[index + 0] = (block[index + 0]*a->q_intra_matrix[index + 0] + (1<<15))>>16) ) ccp |= 8;
- if( (block[index + 8] = (block[index + 8]*a->q_intra_matrix[index + 8] + (1<<15))>>16) ) ccp |= 4;
- if( (block[index + 1] = (block[index + 1]*a->q_intra_matrix[index + 1] + (1<<15))>>16) ) ccp |= 2;
- if( (block[index + 9] = (block[index + 9]*a->q_intra_matrix[index + 9] + (1<<15))>>16) ) ccp |= 1;
-
- assert(i || ccp<8);
- if(i) put_bits(&a->pb, ac_ccp_tab[ccp][1], ac_ccp_tab[ccp][0]);
- else put_bits(&a->pb, dc_ccp_tab[ccp][1], dc_ccp_tab[ccp][0]);
-
- if(ccp){
- if(ccp&8) asv2_put_level(&a->pb, block[index + 0]);
- if(ccp&4) asv2_put_level(&a->pb, block[index + 8]);
- if(ccp&2) asv2_put_level(&a->pb, block[index + 1]);
- if(ccp&1) asv2_put_level(&a->pb, block[index + 9]);
- }
- }
-}
-
-static inline int decode_mb(ASV1Context *a, DCTELEM block[6][64]){
- int i;
-
- a->dsp.clear_blocks(block[0]);
-
- if(a->avctx->codec_id == CODEC_ID_ASV1){
- for(i=0; i<6; i++){
- if( asv1_decode_block(a, block[i]) < 0)
- return -1;
- }
- }else{
- for(i=0; i<6; i++){
- if( asv2_decode_block(a, block[i]) < 0)
- return -1;
- }
- }
- return 0;
-}
-
-static inline int encode_mb(ASV1Context *a, DCTELEM block[6][64]){
- int i;
-
- if(a->pb.buf_end - a->pb.buf - (put_bits_count(&a->pb)>>3) < 30*16*16*3/2/8){
- av_log(a->avctx, AV_LOG_ERROR, "encoded frame too large\n");
- return -1;
- }
-
- if(a->avctx->codec_id == CODEC_ID_ASV1){
- for(i=0; i<6; i++)
- asv1_encode_block(a, block[i]);
- }else{
- for(i=0; i<6; i++)
- asv2_encode_block(a, block[i]);
- }
- return 0;
-}
-
-static inline void idct_put(ASV1Context *a, int mb_x, int mb_y){
- DCTELEM (*block)[64]= a->block;
- int linesize= a->picture.linesize[0];
-
- uint8_t *dest_y = a->picture.data[0] + (mb_y * 16* linesize ) + mb_x * 16;
- uint8_t *dest_cb = a->picture.data[1] + (mb_y * 8 * a->picture.linesize[1]) + mb_x * 8;
- uint8_t *dest_cr = a->picture.data[2] + (mb_y * 8 * a->picture.linesize[2]) + mb_x * 8;
-
- a->dsp.idct_put(dest_y , linesize, block[0]);
- a->dsp.idct_put(dest_y + 8, linesize, block[1]);
- a->dsp.idct_put(dest_y + 8*linesize , linesize, block[2]);
- a->dsp.idct_put(dest_y + 8*linesize + 8, linesize, block[3]);
-
- if(!(a->avctx->flags&CODEC_FLAG_GRAY)){
- a->dsp.idct_put(dest_cb, a->picture.linesize[1], block[4]);
- a->dsp.idct_put(dest_cr, a->picture.linesize[2], block[5]);
- }
-}
-
-static inline void dct_get(ASV1Context *a, int mb_x, int mb_y){
- DCTELEM (*block)[64]= a->block;
- int linesize= a->picture.linesize[0];
- int i;
-
- uint8_t *ptr_y = a->picture.data[0] + (mb_y * 16* linesize ) + mb_x * 16;
- uint8_t *ptr_cb = a->picture.data[1] + (mb_y * 8 * a->picture.linesize[1]) + mb_x * 8;
- uint8_t *ptr_cr = a->picture.data[2] + (mb_y * 8 * a->picture.linesize[2]) + mb_x * 8;
-
- a->dsp.get_pixels(block[0], ptr_y , linesize);
- a->dsp.get_pixels(block[1], ptr_y + 8, linesize);
- a->dsp.get_pixels(block[2], ptr_y + 8*linesize , linesize);
- a->dsp.get_pixels(block[3], ptr_y + 8*linesize + 8, linesize);
- for(i=0; i<4; i++)
- a->dsp.fdct(block[i]);
-
- if(!(a->avctx->flags&CODEC_FLAG_GRAY)){
- a->dsp.get_pixels(block[4], ptr_cb, a->picture.linesize[1]);
- a->dsp.get_pixels(block[5], ptr_cr, a->picture.linesize[2]);
- for(i=4; i<6; i++)
- a->dsp.fdct(block[i]);
- }
-}
-
-static int decode_frame(AVCodecContext *avctx,
- void *data, int *data_size,
- AVPacket *avpkt)
-{
- const uint8_t *buf = avpkt->data;
- int buf_size = avpkt->size;
- ASV1Context * const a = avctx->priv_data;
- AVFrame *picture = data;
- AVFrame * const p= &a->picture;
- int mb_x, mb_y;
-
- if(p->data[0])
- avctx->release_buffer(avctx, p);
-
- p->reference= 0;
- if(avctx->get_buffer(avctx, p) < 0){
- av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
- return -1;
- }
- p->pict_type= AV_PICTURE_TYPE_I;
- p->key_frame= 1;
-
- av_fast_malloc(&a->bitstream_buffer, &a->bitstream_buffer_size, buf_size + FF_INPUT_BUFFER_PADDING_SIZE);
- if (!a->bitstream_buffer)
- return AVERROR(ENOMEM);
-
- if(avctx->codec_id == CODEC_ID_ASV1)
- a->dsp.bswap_buf((uint32_t*)a->bitstream_buffer, (const uint32_t*)buf, buf_size/4);
- else{
- int i;
- for(i=0; i<buf_size; i++)
- a->bitstream_buffer[i]= av_reverse[ buf[i] ];
- }
-
- init_get_bits(&a->gb, a->bitstream_buffer, buf_size*8);
-
- for(mb_y=0; mb_y<a->mb_height2; mb_y++){
- for(mb_x=0; mb_x<a->mb_width2; mb_x++){
- if( decode_mb(a, a->block) <0)
- return -1;
-
- idct_put(a, mb_x, mb_y);
- }
- }
-
- if(a->mb_width2 != a->mb_width){
- mb_x= a->mb_width2;
- for(mb_y=0; mb_y<a->mb_height2; mb_y++){
- if( decode_mb(a, a->block) <0)
- return -1;
-
- idct_put(a, mb_x, mb_y);
- }
- }
-
- if(a->mb_height2 != a->mb_height){
- mb_y= a->mb_height2;
- for(mb_x=0; mb_x<a->mb_width; mb_x++){
- if( decode_mb(a, a->block) <0)
- return -1;
-
- idct_put(a, mb_x, mb_y);
- }
- }
-
- *picture= *(AVFrame*)&a->picture;
- *data_size = sizeof(AVPicture);
-
- emms_c();
-
- return (get_bits_count(&a->gb)+31)/32*4;
-}
-
-#if CONFIG_ASV1_ENCODER || CONFIG_ASV2_ENCODER
-static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size, void *data){
- ASV1Context * const a = avctx->priv_data;
- AVFrame *pict = data;
- AVFrame * const p= &a->picture;
- int size;
- int mb_x, mb_y;
-
- init_put_bits(&a->pb, buf, buf_size);
-
- *p = *pict;
- p->pict_type= AV_PICTURE_TYPE_I;
- p->key_frame= 1;
-
- for(mb_y=0; mb_y<a->mb_height2; mb_y++){
- for(mb_x=0; mb_x<a->mb_width2; mb_x++){
- dct_get(a, mb_x, mb_y);
- encode_mb(a, a->block);
- }
- }
-
- if(a->mb_width2 != a->mb_width){
- mb_x= a->mb_width2;
- for(mb_y=0; mb_y<a->mb_height2; mb_y++){
- dct_get(a, mb_x, mb_y);
- encode_mb(a, a->block);
- }
- }
-
- if(a->mb_height2 != a->mb_height){
- mb_y= a->mb_height2;
- for(mb_x=0; mb_x<a->mb_width; mb_x++){
- dct_get(a, mb_x, mb_y);
- encode_mb(a, a->block);
- }
- }
- emms_c();
-
- avpriv_align_put_bits(&a->pb);
- while(put_bits_count(&a->pb)&31)
- put_bits(&a->pb, 8, 0);
-
- size= put_bits_count(&a->pb)/32;
-
- if(avctx->codec_id == CODEC_ID_ASV1)
- a->dsp.bswap_buf((uint32_t*)buf, (uint32_t*)buf, size);
- else{
- int i;
- for(i=0; i<4*size; i++)
- buf[i]= av_reverse[ buf[i] ];
- }
-
- return size*4;
-}
-#endif /* CONFIG_ASV1_ENCODER || CONFIG_ASV2_ENCODER */
-
-static av_cold void common_init(AVCodecContext *avctx){
- ASV1Context * const a = avctx->priv_data;
-
- dsputil_init(&a->dsp, avctx);
-
- a->mb_width = (avctx->width + 15) / 16;
- a->mb_height = (avctx->height + 15) / 16;
- a->mb_width2 = (avctx->width + 0) / 16;
- a->mb_height2 = (avctx->height + 0) / 16;
-
- avctx->coded_frame= &a->picture;
- a->avctx= avctx;
-}
-
-static av_cold int decode_init(AVCodecContext *avctx){
- ASV1Context * const a = avctx->priv_data;
- AVFrame *p= &a->picture;
- int i;
- const int scale= avctx->codec_id == CODEC_ID_ASV1 ? 1 : 2;
-
- common_init(avctx);
- init_vlcs(a);
- ff_init_scantable(a->dsp.idct_permutation, &a->scantable, scantab);
- avctx->pix_fmt= PIX_FMT_YUV420P;
-
- a->inv_qscale= avctx->extradata[0];
- if(a->inv_qscale == 0){
- av_log(avctx, AV_LOG_ERROR, "illegal qscale 0\n");
- if(avctx->codec_id == CODEC_ID_ASV1)
- a->inv_qscale= 6;
- else
- a->inv_qscale= 10;
- }
-
- for(i=0; i<64; i++){
- int index= scantab[i];
-
- a->intra_matrix[i]= 64*scale*ff_mpeg1_default_intra_matrix[index] / a->inv_qscale;
- }
-
- p->qstride= a->mb_width;
- p->qscale_table= av_malloc( p->qstride * a->mb_height);
- p->quality= (32*scale + a->inv_qscale/2)/a->inv_qscale;
- memset(p->qscale_table, p->quality, p->qstride*a->mb_height);
-
- return 0;
-}
-
-#if CONFIG_ASV1_ENCODER || CONFIG_ASV2_ENCODER
-static av_cold int encode_init(AVCodecContext *avctx){
- ASV1Context * const a = avctx->priv_data;
- int i;
- const int scale= avctx->codec_id == CODEC_ID_ASV1 ? 1 : 2;
-
- common_init(avctx);
-
- if(avctx->global_quality == 0) avctx->global_quality= 4*FF_QUALITY_SCALE;
-
- a->inv_qscale= (32*scale*FF_QUALITY_SCALE + avctx->global_quality/2) / avctx->global_quality;
-
- avctx->extradata= av_mallocz(8);
- avctx->extradata_size=8;
- ((uint32_t*)avctx->extradata)[0]= av_le2ne32(a->inv_qscale);
- ((uint32_t*)avctx->extradata)[1]= av_le2ne32(AV_RL32("ASUS"));
-
- for(i=0; i<64; i++){
- int q= 32*scale*ff_mpeg1_default_intra_matrix[i];
- a->q_intra_matrix[i]= ((a->inv_qscale<<16) + q/2) / q;
- }
-
- return 0;
-}
-#endif /* CONFIG_ASV1_ENCODER || CONFIG_ASV2_ENCODER */
-
-static av_cold int decode_end(AVCodecContext *avctx){
- ASV1Context * const a = avctx->priv_data;
-
- av_freep(&a->bitstream_buffer);
- av_freep(&a->picture.qscale_table);
- a->bitstream_buffer_size=0;
-
- if(a->picture.data[0])
- avctx->release_buffer(avctx, &a->picture);
-
- return 0;
-}
-
-AVCodec ff_asv1_decoder = {
- .name = "asv1",
- .type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_ASV1,
- .priv_data_size = sizeof(ASV1Context),
- .init = decode_init,
- .close = decode_end,
- .decode = decode_frame,
- .capabilities = CODEC_CAP_DR1,
- .long_name= NULL_IF_CONFIG_SMALL("ASUS V1"),
-};
-
-AVCodec ff_asv2_decoder = {
- .name = "asv2",
- .type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_ASV2,
- .priv_data_size = sizeof(ASV1Context),
- .init = decode_init,
- .close = decode_end,
- .decode = decode_frame,
- .capabilities = CODEC_CAP_DR1,
- .long_name= NULL_IF_CONFIG_SMALL("ASUS V2"),
-};
-
-#if CONFIG_ASV1_ENCODER
-AVCodec ff_asv1_encoder = {
- .name = "asv1",
- .type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_ASV1,
- .priv_data_size = sizeof(ASV1Context),
- .init = encode_init,
- .encode = encode_frame,
- //encode_end,
- .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE},
- .long_name= NULL_IF_CONFIG_SMALL("ASUS V1"),
-};
-#endif
-
-#if CONFIG_ASV2_ENCODER
-AVCodec ff_asv2_encoder = {
- .name = "asv2",
- .type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_ASV2,
- .priv_data_size = sizeof(ASV1Context),
- .init = encode_init,
- .encode = encode_frame,
- //encode_end,
- .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE},
- .long_name= NULL_IF_CONFIG_SMALL("ASUS V2"),
-};
-#endif
diff --git a/gst-libs/ext/libav/libavcodec/asvdec.c b/gst-libs/ext/libav/libavcodec/asvdec.c
new file mode 100644
index 0000000..16722a9
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/asvdec.c
@@ -0,0 +1,353 @@
+/*
+ * Copyright (c) 2003 Michael Niedermayer
+ *
+ * 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
+ * ASUS V1/V2 decoder.
+ */
+
+#include "libavutil/attributes.h"
+#include "libavutil/mem.h"
+
+#include "asv.h"
+#include "avcodec.h"
+#include "put_bits.h"
+#include "dsputil.h"
+#include "internal.h"
+#include "mathops.h"
+#include "mpeg12data.h"
+
+//#undef NDEBUG
+//#include <assert.h>
+
+#define VLC_BITS 6
+#define ASV2_LEVEL_VLC_BITS 10
+
+static VLC ccp_vlc;
+static VLC level_vlc;
+static VLC dc_ccp_vlc;
+static VLC ac_ccp_vlc;
+static VLC asv2_level_vlc;
+
+static av_cold void init_vlcs(ASV1Context *a)
+{
+ static int done = 0;
+
+ if (!done) {
+ done = 1;
+
+ INIT_VLC_STATIC(&ccp_vlc, VLC_BITS, 17,
+ &ff_asv_ccp_tab[0][1], 2, 1,
+ &ff_asv_ccp_tab[0][0], 2, 1, 64);
+ INIT_VLC_STATIC(&dc_ccp_vlc, VLC_BITS, 8,
+ &ff_asv_dc_ccp_tab[0][1], 2, 1,
+ &ff_asv_dc_ccp_tab[0][0], 2, 1, 64);
+ INIT_VLC_STATIC(&ac_ccp_vlc, VLC_BITS, 16,
+ &ff_asv_ac_ccp_tab[0][1], 2, 1,
+ &ff_asv_ac_ccp_tab[0][0], 2, 1, 64);
+ INIT_VLC_STATIC(&level_vlc, VLC_BITS, 7,
+ &ff_asv_level_tab[0][1], 2, 1,
+ &ff_asv_level_tab[0][0], 2, 1, 64);
+ INIT_VLC_STATIC(&asv2_level_vlc, ASV2_LEVEL_VLC_BITS, 63,
+ &ff_asv2_level_tab[0][1], 2, 1,
+ &ff_asv2_level_tab[0][0], 2, 1, 1024);
+ }
+}
+
+//FIXME write a reversed bitstream reader to avoid the double reverse
+static inline int asv2_get_bits(GetBitContext *gb, int n)
+{
+ return ff_reverse[get_bits(gb, n) << (8-n)];
+}
+
+static inline int asv1_get_level(GetBitContext *gb)
+{
+ int code = get_vlc2(gb, level_vlc.table, VLC_BITS, 1);
+
+ if (code == 3)
+ return get_sbits(gb, 8);
+ else
+ return code - 3;
+}
+
+static inline int asv2_get_level(GetBitContext *gb)
+{
+ int code = get_vlc2(gb, asv2_level_vlc.table, ASV2_LEVEL_VLC_BITS, 1);
+
+ if (code == 31)
+ return (int8_t)asv2_get_bits(gb, 8);
+ else
+ return code - 31;
+}
+
+static inline int asv1_decode_block(ASV1Context *a, DCTELEM block[64])
+{
+ int i;
+
+ block[0] = 8 * get_bits(&a->gb, 8);
+
+ for (i = 0; i < 11; i++) {
+ const int ccp = get_vlc2(&a->gb, ccp_vlc.table, VLC_BITS, 1);
+
+ if (ccp) {
+ if (ccp == 16)
+ break;
+ if (ccp < 0 || i >= 10) {
+ av_log(a->avctx, AV_LOG_ERROR, "coded coeff pattern damaged\n");
+ return -1;
+ }
+
+ if (ccp & 8)
+ block[a->scantable.permutated[4 * i + 0]] = (asv1_get_level(&a->gb) * a->intra_matrix[4 * i + 0]) >> 4;
+ if (ccp & 4)
+ block[a->scantable.permutated[4 * i + 1]] = (asv1_get_level(&a->gb) * a->intra_matrix[4 * i + 1]) >> 4;
+ if (ccp & 2)
+ block[a->scantable.permutated[4 * i + 2]] = (asv1_get_level(&a->gb) * a->intra_matrix[4 * i + 2]) >> 4;
+ if (ccp & 1)
+ block[a->scantable.permutated[4 * i + 3]] = (asv1_get_level(&a->gb) * a->intra_matrix[4 * i + 3]) >> 4;
+ }
+ }
+
+ return 0;
+}
+
+static inline int asv2_decode_block(ASV1Context *a, DCTELEM block[64])
+{
+ int i, count, ccp;
+
+ count = asv2_get_bits(&a->gb, 4);
+
+ block[0] = 8 * asv2_get_bits(&a->gb, 8);
+
+ ccp = get_vlc2(&a->gb, dc_ccp_vlc.table, VLC_BITS, 1);
+ if (ccp) {
+ if (ccp & 4)
+ block[a->scantable.permutated[1]] = (asv2_get_level(&a->gb) * a->intra_matrix[1]) >> 4;
+ if (ccp & 2)
+ block[a->scantable.permutated[2]] = (asv2_get_level(&a->gb) * a->intra_matrix[2]) >> 4;
+ if (ccp & 1)
+ block[a->scantable.permutated[3]] = (asv2_get_level(&a->gb) * a->intra_matrix[3]) >> 4;
+ }
+
+ for (i = 1; i < count + 1; i++) {
+ const int ccp = get_vlc2(&a->gb, ac_ccp_vlc.table, VLC_BITS, 1);
+
+ if (ccp) {
+ if (ccp & 8)
+ block[a->scantable.permutated[4*i + 0]] = (asv2_get_level(&a->gb) * a->intra_matrix[4*i + 0]) >> 4;
+ if (ccp & 4)
+ block[a->scantable.permutated[4*i + 1]] = (asv2_get_level(&a->gb) * a->intra_matrix[4*i + 1]) >> 4;
+ if (ccp & 2)
+ block[a->scantable.permutated[4*i + 2]] = (asv2_get_level(&a->gb) * a->intra_matrix[4*i + 2]) >> 4;
+ if (ccp & 1)
+ block[a->scantable.permutated[4*i + 3]] = (asv2_get_level(&a->gb) * a->intra_matrix[4*i + 3]) >> 4;
+ }
+ }
+
+ return 0;
+}
+
+static inline int decode_mb(ASV1Context *a, DCTELEM block[6][64])
+{
+ int i;
+
+ a->dsp.clear_blocks(block[0]);
+
+ if (a->avctx->codec_id == AV_CODEC_ID_ASV1) {
+ for (i = 0; i < 6; i++) {
+ if (asv1_decode_block(a, block[i]) < 0)
+ return -1;
+ }
+ } else {
+ for (i = 0; i < 6; i++) {
+ if (asv2_decode_block(a, block[i]) < 0)
+ return -1;
+ }
+ }
+ return 0;
+}
+
+static inline void idct_put(ASV1Context *a, int mb_x, int mb_y)
+{
+ DCTELEM (*block)[64] = a->block;
+ int linesize = a->picture.linesize[0];
+
+ uint8_t *dest_y = a->picture.data[0] + (mb_y * 16* linesize ) + mb_x * 16;
+ uint8_t *dest_cb = a->picture.data[1] + (mb_y * 8 * a->picture.linesize[1]) + mb_x * 8;
+ uint8_t *dest_cr = a->picture.data[2] + (mb_y * 8 * a->picture.linesize[2]) + mb_x * 8;
+
+ a->dsp.idct_put(dest_y , linesize, block[0]);
+ a->dsp.idct_put(dest_y + 8, linesize, block[1]);
+ a->dsp.idct_put(dest_y + 8*linesize , linesize, block[2]);
+ a->dsp.idct_put(dest_y + 8*linesize + 8, linesize, block[3]);
+
+ if (!(a->avctx->flags&CODEC_FLAG_GRAY)) {
+ a->dsp.idct_put(dest_cb, a->picture.linesize[1], block[4]);
+ a->dsp.idct_put(dest_cr, a->picture.linesize[2], block[5]);
+ }
+}
+
+static int decode_frame(AVCodecContext *avctx,
+ void *data, int *got_frame,
+ AVPacket *avpkt)
+{
+ ASV1Context * const a = avctx->priv_data;
+ const uint8_t *buf = avpkt->data;
+ int buf_size = avpkt->size;
+ AVFrame *picture = data;
+ AVFrame * const p = &a->picture;
+ int mb_x, mb_y;
+
+ if (p->data[0])
+ avctx->release_buffer(avctx, p);
+
+ p->reference = 0;
+ if (ff_get_buffer(avctx, p) < 0) {
+ av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
+ return -1;
+ }
+ p->pict_type = AV_PICTURE_TYPE_I;
+ p->key_frame = 1;
+
+ av_fast_padded_malloc(&a->bitstream_buffer, &a->bitstream_buffer_size,
+ buf_size);
+ if (!a->bitstream_buffer)
+ return AVERROR(ENOMEM);
+
+ if (avctx->codec_id == AV_CODEC_ID_ASV1)
+ a->dsp.bswap_buf((uint32_t*)a->bitstream_buffer, (const uint32_t*)buf, buf_size/4);
+ else {
+ int i;
+ for (i = 0; i < buf_size; i++)
+ a->bitstream_buffer[i] = ff_reverse[buf[i]];
+ }
+
+ init_get_bits(&a->gb, a->bitstream_buffer, buf_size*8);
+
+ for (mb_y = 0; mb_y < a->mb_height2; mb_y++) {
+ for (mb_x = 0; mb_x < a->mb_width2; mb_x++) {
+ if (decode_mb(a, a->block) < 0)
+ return -1;
+
+ idct_put(a, mb_x, mb_y);
+ }
+ }
+
+ if (a->mb_width2 != a->mb_width) {
+ mb_x = a->mb_width2;
+ for (mb_y = 0; mb_y < a->mb_height2; mb_y++) {
+ if (decode_mb(a, a->block) < 0)
+ return -1;
+
+ idct_put(a, mb_x, mb_y);
+ }
+ }
+
+ if (a->mb_height2 != a->mb_height) {
+ mb_y = a->mb_height2;
+ for (mb_x = 0; mb_x < a->mb_width; mb_x++) {
+ if (decode_mb(a, a->block) < 0)
+ return -1;
+
+ idct_put(a, mb_x, mb_y);
+ }
+ }
+
+ *picture = a->picture;
+ *got_frame = 1;
+
+ emms_c();
+
+ return (get_bits_count(&a->gb) + 31) / 32 * 4;
+}
+
+static av_cold int decode_init(AVCodecContext *avctx)
+{
+ ASV1Context * const a = avctx->priv_data;
+ AVFrame *p = &a->picture;
+ const int scale = avctx->codec_id == AV_CODEC_ID_ASV1 ? 1 : 2;
+ int i;
+
+ ff_asv_common_init(avctx);
+ init_vlcs(a);
+ ff_init_scantable(a->dsp.idct_permutation, &a->scantable, ff_asv_scantab);
+ avctx->pix_fmt = AV_PIX_FMT_YUV420P;
+
+ a->inv_qscale = avctx->extradata[0];
+ if (a->inv_qscale == 0) {
+ av_log(avctx, AV_LOG_ERROR, "illegal qscale 0\n");
+ if (avctx->codec_id == AV_CODEC_ID_ASV1)
+ a->inv_qscale = 6;
+ else
+ a->inv_qscale = 10;
+ }
+
+ for (i = 0; i < 64; i++) {
+ int index = ff_asv_scantab[i];
+
+ a->intra_matrix[i] = 64 * scale * ff_mpeg1_default_intra_matrix[index] / a->inv_qscale;
+ }
+
+ p->qstride = a->mb_width;
+ p->qscale_table = av_malloc(p->qstride * a->mb_height);
+ p->quality = (32 * scale + a->inv_qscale / 2) / a->inv_qscale;
+ memset(p->qscale_table, p->quality, p->qstride * a->mb_height);
+
+ return 0;
+}
+
+static av_cold int decode_end(AVCodecContext *avctx)
+{
+ ASV1Context * const a = avctx->priv_data;
+
+ av_freep(&a->bitstream_buffer);
+ av_freep(&a->picture.qscale_table);
+ a->bitstream_buffer_size = 0;
+
+ if (a->picture.data[0])
+ avctx->release_buffer(avctx, &a->picture);
+
+ return 0;
+}
+
+AVCodec ff_asv1_decoder = {
+ .name = "asv1",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .id = AV_CODEC_ID_ASV1,
+ .priv_data_size = sizeof(ASV1Context),
+ .init = decode_init,
+ .close = decode_end,
+ .decode = decode_frame,
+ .capabilities = CODEC_CAP_DR1,
+ .long_name = NULL_IF_CONFIG_SMALL("ASUS V1"),
+};
+
+AVCodec ff_asv2_decoder = {
+ .name = "asv2",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .id = AV_CODEC_ID_ASV2,
+ .priv_data_size = sizeof(ASV1Context),
+ .init = decode_init,
+ .close = decode_end,
+ .decode = decode_frame,
+ .capabilities = CODEC_CAP_DR1,
+ .long_name = NULL_IF_CONFIG_SMALL("ASUS V2"),
+};
+
diff --git a/gst-libs/ext/libav/libavcodec/asvenc.c b/gst-libs/ext/libav/libavcodec/asvenc.c
new file mode 100644
index 0000000..f36f3ef
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/asvenc.c
@@ -0,0 +1,290 @@
+/*
+ * Copyright (c) 2003 Michael Niedermayer
+ *
+ * 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
+ * ASUS V1/V2 encoder.
+ */
+
+#include "libavutil/attributes.h"
+#include "libavutil/mem.h"
+
+#include "asv.h"
+#include "avcodec.h"
+#include "mathops.h"
+#include "mpeg12data.h"
+
+static inline void asv2_put_bits(PutBitContext *pb, int n, int v){
+ put_bits(pb, n, ff_reverse[ v << (8-n) ]);
+}
+
+static inline void asv1_put_level(PutBitContext *pb, int level){
+ unsigned int index= level + 3;
+
+ if(index <= 6) put_bits(pb, ff_asv_level_tab[index][1], ff_asv_level_tab[index][0]);
+ else{
+ put_bits(pb, ff_asv_level_tab[3][1], ff_asv_level_tab[3][0]);
+ put_sbits(pb, 8, level);
+ }
+}
+
+static inline void asv2_put_level(PutBitContext *pb, int level){
+ unsigned int index= level + 31;
+
+ if(index <= 62) put_bits(pb, ff_asv2_level_tab[index][1], ff_asv2_level_tab[index][0]);
+ else{
+ put_bits(pb, ff_asv2_level_tab[31][1], ff_asv2_level_tab[31][0]);
+ asv2_put_bits(pb, 8, level&0xFF);
+ }
+}
+
+static inline void asv1_encode_block(ASV1Context *a, DCTELEM block[64]){
+ int i;
+ int nc_count=0;
+
+ put_bits(&a->pb, 8, (block[0] + 32)>>6);
+ block[0]= 0;
+
+ for(i=0; i<10; i++){
+ const int index = ff_asv_scantab[4*i];
+ int ccp=0;
+
+ if( (block[index + 0] = (block[index + 0]*a->q_intra_matrix[index + 0] + (1<<15))>>16) ) ccp |= 8;
+ if( (block[index + 8] = (block[index + 8]*a->q_intra_matrix[index + 8] + (1<<15))>>16) ) ccp |= 4;
+ if( (block[index + 1] = (block[index + 1]*a->q_intra_matrix[index + 1] + (1<<15))>>16) ) ccp |= 2;
+ if( (block[index + 9] = (block[index + 9]*a->q_intra_matrix[index + 9] + (1<<15))>>16) ) ccp |= 1;
+
+ if(ccp){
+ for(;nc_count; nc_count--)
+ put_bits(&a->pb, ff_asv_ccp_tab[0][1], ff_asv_ccp_tab[0][0]);
+
+ put_bits(&a->pb, ff_asv_ccp_tab[ccp][1], ff_asv_ccp_tab[ccp][0]);
+
+ if(ccp&8) asv1_put_level(&a->pb, block[index + 0]);
+ if(ccp&4) asv1_put_level(&a->pb, block[index + 8]);
+ if(ccp&2) asv1_put_level(&a->pb, block[index + 1]);
+ if(ccp&1) asv1_put_level(&a->pb, block[index + 9]);
+ }else{
+ nc_count++;
+ }
+ }
+ put_bits(&a->pb, ff_asv_ccp_tab[16][1], ff_asv_ccp_tab[16][0]);
+}
+
+static inline void asv2_encode_block(ASV1Context *a, DCTELEM block[64]){
+ int i;
+ int count=0;
+
+ for(count=63; count>3; count--){
+ const int index = ff_asv_scantab[count];
+
+ if( (block[index]*a->q_intra_matrix[index] + (1<<15))>>16 )
+ break;
+ }
+
+ count >>= 2;
+
+ asv2_put_bits(&a->pb, 4, count);
+ asv2_put_bits(&a->pb, 8, (block[0] + 32)>>6);
+ block[0]= 0;
+
+ for(i=0; i<=count; i++){
+ const int index = ff_asv_scantab[4*i];
+ int ccp=0;
+
+ if( (block[index + 0] = (block[index + 0]*a->q_intra_matrix[index + 0] + (1<<15))>>16) ) ccp |= 8;
+ if( (block[index + 8] = (block[index + 8]*a->q_intra_matrix[index + 8] + (1<<15))>>16) ) ccp |= 4;
+ if( (block[index + 1] = (block[index + 1]*a->q_intra_matrix[index + 1] + (1<<15))>>16) ) ccp |= 2;
+ if( (block[index + 9] = (block[index + 9]*a->q_intra_matrix[index + 9] + (1<<15))>>16) ) ccp |= 1;
+
+ assert(i || ccp<8);
+ if(i) put_bits(&a->pb, ff_asv_ac_ccp_tab[ccp][1], ff_asv_ac_ccp_tab[ccp][0]);
+ else put_bits(&a->pb, ff_asv_dc_ccp_tab[ccp][1], ff_asv_dc_ccp_tab[ccp][0]);
+
+ if(ccp){
+ if(ccp&8) asv2_put_level(&a->pb, block[index + 0]);
+ if(ccp&4) asv2_put_level(&a->pb, block[index + 8]);
+ if(ccp&2) asv2_put_level(&a->pb, block[index + 1]);
+ if(ccp&1) asv2_put_level(&a->pb, block[index + 9]);
+ }
+ }
+}
+
+#define MAX_MB_SIZE (30*16*16*3/2/8)
+
+static inline int encode_mb(ASV1Context *a, DCTELEM block[6][64]){
+ int i;
+
+ if (a->pb.buf_end - a->pb.buf - (put_bits_count(&a->pb)>>3) < MAX_MB_SIZE) {
+ av_log(a->avctx, AV_LOG_ERROR, "encoded frame too large\n");
+ return -1;
+ }
+
+ if(a->avctx->codec_id == AV_CODEC_ID_ASV1){
+ for(i=0; i<6; i++)
+ asv1_encode_block(a, block[i]);
+ }else{
+ for(i=0; i<6; i++)
+ asv2_encode_block(a, block[i]);
+ }
+ return 0;
+}
+
+static inline void dct_get(ASV1Context *a, int mb_x, int mb_y){
+ DCTELEM (*block)[64]= a->block;
+ int linesize= a->picture.linesize[0];
+ int i;
+
+ uint8_t *ptr_y = a->picture.data[0] + (mb_y * 16* linesize ) + mb_x * 16;
+ uint8_t *ptr_cb = a->picture.data[1] + (mb_y * 8 * a->picture.linesize[1]) + mb_x * 8;
+ uint8_t *ptr_cr = a->picture.data[2] + (mb_y * 8 * a->picture.linesize[2]) + mb_x * 8;
+
+ a->dsp.get_pixels(block[0], ptr_y , linesize);
+ a->dsp.get_pixels(block[1], ptr_y + 8, linesize);
+ a->dsp.get_pixels(block[2], ptr_y + 8*linesize , linesize);
+ a->dsp.get_pixels(block[3], ptr_y + 8*linesize + 8, linesize);
+ for(i=0; i<4; i++)
+ a->dsp.fdct(block[i]);
+
+ if(!(a->avctx->flags&CODEC_FLAG_GRAY)){
+ a->dsp.get_pixels(block[4], ptr_cb, a->picture.linesize[1]);
+ a->dsp.get_pixels(block[5], ptr_cr, a->picture.linesize[2]);
+ for(i=4; i<6; i++)
+ a->dsp.fdct(block[i]);
+ }
+}
+
+static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
+ const AVFrame *pict, int *got_packet)
+{
+ ASV1Context * const a = avctx->priv_data;
+ AVFrame * const p= &a->picture;
+ int size, ret;
+ int mb_x, mb_y;
+
+ if (!pkt->data &&
+ (ret = av_new_packet(pkt, a->mb_height*a->mb_width*MAX_MB_SIZE +
+ FF_MIN_BUFFER_SIZE)) < 0) {
+ av_log(avctx, AV_LOG_ERROR, "Error getting output packet.\n");
+ return ret;
+ }
+
+ init_put_bits(&a->pb, pkt->data, pkt->size);
+
+ *p = *pict;
+ p->pict_type= AV_PICTURE_TYPE_I;
+ p->key_frame= 1;
+
+ for(mb_y=0; mb_y<a->mb_height2; mb_y++){
+ for(mb_x=0; mb_x<a->mb_width2; mb_x++){
+ dct_get(a, mb_x, mb_y);
+ encode_mb(a, a->block);
+ }
+ }
+
+ if(a->mb_width2 != a->mb_width){
+ mb_x= a->mb_width2;
+ for(mb_y=0; mb_y<a->mb_height2; mb_y++){
+ dct_get(a, mb_x, mb_y);
+ encode_mb(a, a->block);
+ }
+ }
+
+ if(a->mb_height2 != a->mb_height){
+ mb_y= a->mb_height2;
+ for(mb_x=0; mb_x<a->mb_width; mb_x++){
+ dct_get(a, mb_x, mb_y);
+ encode_mb(a, a->block);
+ }
+ }
+ emms_c();
+
+ avpriv_align_put_bits(&a->pb);
+ while(put_bits_count(&a->pb)&31)
+ put_bits(&a->pb, 8, 0);
+
+ size= put_bits_count(&a->pb)/32;
+
+ if(avctx->codec_id == AV_CODEC_ID_ASV1)
+ a->dsp.bswap_buf((uint32_t*)pkt->data, (uint32_t*)pkt->data, size);
+ else{
+ int i;
+ for(i=0; i<4*size; i++)
+ pkt->data[i] = ff_reverse[pkt->data[i]];
+ }
+
+ pkt->size = size*4;
+ pkt->flags |= AV_PKT_FLAG_KEY;
+ *got_packet = 1;
+
+ return 0;
+}
+
+static av_cold int encode_init(AVCodecContext *avctx){
+ ASV1Context * const a = avctx->priv_data;
+ int i;
+ const int scale= avctx->codec_id == AV_CODEC_ID_ASV1 ? 1 : 2;
+
+ ff_asv_common_init(avctx);
+
+ if(avctx->global_quality == 0) avctx->global_quality= 4*FF_QUALITY_SCALE;
+
+ a->inv_qscale= (32*scale*FF_QUALITY_SCALE + avctx->global_quality/2) / avctx->global_quality;
+
+ avctx->extradata= av_mallocz(8);
+ avctx->extradata_size=8;
+ ((uint32_t*)avctx->extradata)[0]= av_le2ne32(a->inv_qscale);
+ ((uint32_t*)avctx->extradata)[1]= av_le2ne32(AV_RL32("ASUS"));
+
+ for(i=0; i<64; i++){
+ int q= 32*scale*ff_mpeg1_default_intra_matrix[i];
+ a->q_intra_matrix[i]= ((a->inv_qscale<<16) + q/2) / q;
+ }
+
+ return 0;
+}
+
+#if CONFIG_ASV1_ENCODER
+AVCodec ff_asv1_encoder = {
+ .name = "asv1",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .id = AV_CODEC_ID_ASV1,
+ .priv_data_size = sizeof(ASV1Context),
+ .init = encode_init,
+ .encode2 = encode_frame,
+ .pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_YUV420P,
+ AV_PIX_FMT_NONE },
+ .long_name = NULL_IF_CONFIG_SMALL("ASUS V1"),
+};
+#endif
+
+#if CONFIG_ASV2_ENCODER
+AVCodec ff_asv2_encoder = {
+ .name = "asv2",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .id = AV_CODEC_ID_ASV2,
+ .priv_data_size = sizeof(ASV1Context),
+ .init = encode_init,
+ .encode2 = encode_frame,
+ .pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_YUV420P,
+ AV_PIX_FMT_NONE },
+ .long_name = NULL_IF_CONFIG_SMALL("ASUS V2"),
+};
+#endif
diff --git a/gst-libs/ext/libav/libavcodec/atrac.c b/gst-libs/ext/libav/libavcodec/atrac.c
index 2c39aad..a772e7d 100644
--- a/gst-libs/ext/libav/libavcodec/atrac.c
+++ b/gst-libs/ext/libav/libavcodec/atrac.c
@@ -27,6 +27,7 @@
#include <math.h>
#include <stddef.h>
#include <stdio.h>
+#include <string.h>
#include "avcodec.h"
#include "dsputil.h"
@@ -48,7 +49,7 @@ static const float qmf_48tap_half[24] = {
* Generate common tables
*/
-void atrac_generate_tables(void)
+void ff_atrac_generate_tables(void)
{
int i;
float s;
@@ -79,7 +80,7 @@ void atrac_generate_tables(void)
*/
-void atrac_iqmf (float *inlo, float *inhi, unsigned int nIn, float *pOut, float *delayBuf, float *temp)
+void ff_atrac_iqmf (float *inlo, float *inhi, unsigned int nIn, float *pOut, float *delayBuf, float *temp)
{
int i, j;
float *p1, *p3;
@@ -117,4 +118,3 @@ void atrac_iqmf (float *inlo, float *inhi, unsigned int nIn, float *pOut, float
/* Update the delay buffer. */
memcpy(delayBuf, temp + nIn*2, 46*sizeof(float));
}
-
diff --git a/gst-libs/ext/libav/libavcodec/atrac.h b/gst-libs/ext/libav/libavcodec/atrac.h
index 2223a5e..39fb331 100644
--- a/gst-libs/ext/libav/libavcodec/atrac.h
+++ b/gst-libs/ext/libav/libavcodec/atrac.h
@@ -30,7 +30,7 @@
extern float ff_atrac_sf_table[64];
-void atrac_generate_tables(void);
-void atrac_iqmf (float *inlo, float *inhi, unsigned int nIn, float *pOut, float *delayBuf, float *temp);
+void ff_atrac_generate_tables(void);
+void ff_atrac_iqmf (float *inlo, float *inhi, unsigned int nIn, float *pOut, float *delayBuf, float *temp);
#endif /* AVCODEC_ATRAC_H */
diff --git a/gst-libs/ext/libav/libavcodec/atrac1.c b/gst-libs/ext/libav/libavcodec/atrac1.c
index 9ead80d..268ce86 100644
--- a/gst-libs/ext/libav/libavcodec/atrac1.c
+++ b/gst-libs/ext/libav/libavcodec/atrac1.c
@@ -36,7 +36,7 @@
#include "get_bits.h"
#include "dsputil.h"
#include "fft.h"
-#include "fmtconvert.h"
+#include "internal.h"
#include "sinewin.h"
#include "atrac.h"
@@ -80,11 +80,8 @@ typedef struct {
DECLARE_ALIGNED(32, float, mid)[256];
DECLARE_ALIGNED(32, float, high)[512];
float* bands[3];
- float *out_samples[AT1_MAX_CHANNELS];
FFTContext mdct_ctx[3];
- int channels;
DSPContext dsp;
- FmtConvertContext fmt_conv;
} AT1Ctx;
/** size of the transform in samples in the long mode for each QMF band */
@@ -262,14 +259,14 @@ static void at1_subband_synthesis(AT1Ctx *q, AT1SUCtx* su, float *pOut)
float iqmf_temp[512 + 46];
/* combine low and middle bands */
- atrac_iqmf(q->bands[0], q->bands[1], 128, temp, su->fst_qmf_delay, iqmf_temp);
+ ff_atrac_iqmf(q->bands[0], q->bands[1], 128, temp, su->fst_qmf_delay, iqmf_temp);
/* delay the signal of the high band by 23 samples */
memcpy( su->last_qmf_delay, &su->last_qmf_delay[256], sizeof(float) * 23);
memcpy(&su->last_qmf_delay[23], q->bands[2], sizeof(float) * 256);
/* combine (low + middle) and high bands */
- atrac_iqmf(temp, su->last_qmf_delay, 256, pOut, su->snd_qmf_delay, iqmf_temp);
+ ff_atrac_iqmf(temp, su->last_qmf_delay, 256, pOut, su->snd_qmf_delay, iqmf_temp);
}
@@ -281,23 +278,21 @@ static int atrac1_decode_frame(AVCodecContext *avctx, void *data,
AT1Ctx *q = avctx->priv_data;
int ch, ret;
GetBitContext gb;
- float *samples;
- if (buf_size < 212 * q->channels) {
+ if (buf_size < 212 * avctx->channels) {
av_log(avctx, AV_LOG_ERROR, "Not enough data to decode!\n");
return AVERROR_INVALIDDATA;
}
/* get output buffer */
q->frame.nb_samples = AT1_SU_SAMPLES;
- if ((ret = avctx->get_buffer(avctx, &q->frame)) < 0) {
+ if ((ret = ff_get_buffer(avctx, &q->frame)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return ret;
}
- samples = (float *)q->frame.data[0];
- for (ch = 0; ch < q->channels; ch++) {
+ for (ch = 0; ch < avctx->channels; ch++) {
AT1SUCtx* su = &q->SUs[ch];
init_get_bits(&gb, &buf[212 * ch], 212 * 8);
@@ -314,13 +309,7 @@ static int atrac1_decode_frame(AVCodecContext *avctx, void *data,
ret = at1_imdct_block(su, q);
if (ret < 0)
return ret;
- at1_subband_synthesis(q, su, q->channels == 1 ? samples : q->out_samples[ch]);
- }
-
- /* interleave */
- if (q->channels == 2) {
- q->fmt_conv.float_interleave(samples, (const float **)q->out_samples,
- AT1_SU_SAMPLES, 2);
+ at1_subband_synthesis(q, su, (float *)q->frame.extended_data[ch]);
}
*got_frame_ptr = 1;
@@ -334,8 +323,6 @@ static av_cold int atrac1_decode_end(AVCodecContext * avctx)
{
AT1Ctx *q = avctx->priv_data;
- av_freep(&q->out_samples[0]);
-
ff_mdct_end(&q->mdct_ctx[0]);
ff_mdct_end(&q->mdct_ctx[1]);
ff_mdct_end(&q->mdct_ctx[2]);
@@ -349,23 +336,13 @@ static av_cold int atrac1_decode_init(AVCodecContext *avctx)
AT1Ctx *q = avctx->priv_data;
int ret;
- avctx->sample_fmt = AV_SAMPLE_FMT_FLT;
+ avctx->sample_fmt = AV_SAMPLE_FMT_FLTP;
if (avctx->channels < 1 || avctx->channels > AT1_MAX_CHANNELS) {
av_log(avctx, AV_LOG_ERROR, "Unsupported number of channels: %d\n",
avctx->channels);
return AVERROR(EINVAL);
}
- q->channels = avctx->channels;
-
- if (avctx->channels == 2) {
- q->out_samples[0] = av_malloc(2 * AT1_SU_SAMPLES * sizeof(*q->out_samples[0]));
- q->out_samples[1] = q->out_samples[0] + AT1_SU_SAMPLES;
- if (!q->out_samples[0]) {
- av_freep(&q->out_samples[0]);
- return AVERROR(ENOMEM);
- }
- }
/* Init the mdct transforms */
if ((ret = ff_mdct_init(&q->mdct_ctx[0], 6, 1, -1.0/ (1 << 15))) ||
@@ -378,10 +355,9 @@ static av_cold int atrac1_decode_init(AVCodecContext *avctx)
ff_init_ff_sine_windows(5);
- atrac_generate_tables();
+ ff_atrac_generate_tables();
- dsputil_init(&q->dsp, avctx);
- ff_fmt_convert_init(&q->fmt_conv, avctx);
+ ff_dsputil_init(&q->dsp, avctx);
q->bands[0] = q->low;
q->bands[1] = q->mid;
@@ -401,13 +377,15 @@ static av_cold int atrac1_decode_init(AVCodecContext *avctx)
AVCodec ff_atrac1_decoder = {
- .name = "atrac1",
- .type = AVMEDIA_TYPE_AUDIO,
- .id = CODEC_ID_ATRAC1,
+ .name = "atrac1",
+ .type = AVMEDIA_TYPE_AUDIO,
+ .id = AV_CODEC_ID_ATRAC1,
.priv_data_size = sizeof(AT1Ctx),
- .init = atrac1_decode_init,
- .close = atrac1_decode_end,
- .decode = atrac1_decode_frame,
- .capabilities = CODEC_CAP_DR1,
- .long_name = NULL_IF_CONFIG_SMALL("Atrac 1 (Adaptive TRansform Acoustic Coding)"),
+ .init = atrac1_decode_init,
+ .close = atrac1_decode_end,
+ .decode = atrac1_decode_frame,
+ .capabilities = CODEC_CAP_DR1,
+ .long_name = NULL_IF_CONFIG_SMALL("Atrac 1 (Adaptive TRansform Acoustic Coding)"),
+ .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP,
+ AV_SAMPLE_FMT_NONE },
};
diff --git a/gst-libs/ext/libav/libavcodec/atrac3.c b/gst-libs/ext/libav/libavcodec/atrac3.c
index 40a44c7..910c15e 100644
--- a/gst-libs/ext/libav/libavcodec/atrac3.c
+++ b/gst-libs/ext/libav/libavcodec/atrac3.c
@@ -36,12 +36,13 @@
#include <stddef.h>
#include <stdio.h>
+#include "libavutil/float_dsp.h"
#include "avcodec.h"
-#include "get_bits.h"
-#include "dsputil.h"
#include "bytestream.h"
#include "fft.h"
#include "fmtconvert.h"
+#include "get_bits.h"
+#include "internal.h"
#include "atrac.h"
#include "atrac3data.h"
@@ -52,146 +53,124 @@
#define SAMPLES_PER_FRAME 1024
#define MDCT_SIZE 512
-/* These structures are needed to store the parsed gain control data. */
-typedef struct {
- int num_gain_data;
- int levcode[8];
- int loccode[8];
-} gain_info;
-
-typedef struct {
- gain_info gBlock[4];
-} gain_block;
-
-typedef struct {
- int pos;
- int numCoefs;
- float coef[8];
-} tonal_component;
-
-typedef struct {
- int bandsCoded;
- int numComponents;
- tonal_component components[64];
- float prevFrame[SAMPLES_PER_FRAME];
- int gcBlkSwitch;
- gain_block gainBlock[2];
+typedef struct GainInfo {
+ int num_gain_data;
+ int lev_code[8];
+ int loc_code[8];
+} GainInfo;
+
+typedef struct GainBlock {
+ GainInfo g_block[4];
+} GainBlock;
+
+typedef struct TonalComponent {
+ int pos;
+ int num_coefs;
+ float coef[8];
+} TonalComponent;
+
+typedef struct ChannelUnit {
+ int bands_coded;
+ int num_components;
+ float prev_frame[SAMPLES_PER_FRAME];
+ int gc_blk_switch;
+ TonalComponent components[64];
+ GainBlock gain_block[2];
DECLARE_ALIGNED(32, float, spectrum)[SAMPLES_PER_FRAME];
- DECLARE_ALIGNED(32, float, IMDCT_buf)[SAMPLES_PER_FRAME];
+ DECLARE_ALIGNED(32, float, imdct_buf)[SAMPLES_PER_FRAME];
- float delayBuf1[46]; ///<qmf delay buffers
- float delayBuf2[46];
- float delayBuf3[46];
-} channel_unit;
+ float delay_buf1[46]; ///<qmf delay buffers
+ float delay_buf2[46];
+ float delay_buf3[46];
+} ChannelUnit;
-typedef struct {
- AVFrame frame;
- GetBitContext gb;
+typedef struct ATRAC3Context {
+ AVFrame frame;
+ GetBitContext gb;
//@{
/** stream data */
- int channels;
- int codingMode;
- int bit_rate;
- int sample_rate;
- int samples_per_channel;
- int samples_per_frame;
-
- int bits_per_frame;
- int bytes_per_frame;
- int pBs;
- channel_unit* pUnits;
+ int coding_mode;
+
+ ChannelUnit *units;
//@}
//@{
/** joint-stereo related variables */
- int matrix_coeff_index_prev[4];
- int matrix_coeff_index_now[4];
- int matrix_coeff_index_next[4];
- int weighting_delay[6];
+ int matrix_coeff_index_prev[4];
+ int matrix_coeff_index_now[4];
+ int matrix_coeff_index_next[4];
+ int weighting_delay[6];
//@}
//@{
/** data buffers */
- float *outSamples[2];
- uint8_t* decoded_bytes_buffer;
- float tempBuf[1070];
+ uint8_t *decoded_bytes_buffer;
+ float temp_buf[1070];
//@}
//@{
/** extradata */
- int atrac3version;
- int delay;
- int scrambled_stream;
- int frame_factor;
+ int scrambled_stream;
//@}
- FFTContext mdct_ctx;
- FmtConvertContext fmt_conv;
+ FFTContext mdct_ctx;
+ FmtConvertContext fmt_conv;
+ AVFloatDSPContext fdsp;
} ATRAC3Context;
static DECLARE_ALIGNED(32, float, mdct_window)[MDCT_SIZE];
-static VLC spectral_coeff_tab[7];
-static float gain_tab1[16];
-static float gain_tab2[31];
-static DSPContext dsp;
+static VLC_TYPE atrac3_vlc_table[4096][2];
+static VLC spectral_coeff_tab[7];
+static float gain_tab1[16];
+static float gain_tab2[31];
-/**
- * Regular 512 points IMDCT without overlapping, with the exception of the swapping of odd bands
- * caused by the reverse spectra of the QMF.
+/*
+ * Regular 512 points IMDCT without overlapping, with the exception of the
+ * swapping of odd bands caused by the reverse spectra of the QMF.
*
- * @param pInput float input
- * @param pOutput float output
* @param odd_band 1 if the band is an odd band
*/
-
-static void IMLT(ATRAC3Context *q, float *pInput, float *pOutput, int odd_band)
+static void imlt(ATRAC3Context *q, float *input, float *output, int odd_band)
{
- int i;
+ int i;
if (odd_band) {
/**
- * Reverse the odd bands before IMDCT, this is an effect of the QMF transform
- * or it gives better compression to do it this way.
- * FIXME: It should be possible to handle this in imdct_calc
- * for that to happen a modification of the prerotation step of
- * all SIMD code and C code is needed.
- * Or fix the functions before so they generate a pre reversed spectrum.
- */
-
- for (i=0; i<128; i++)
- FFSWAP(float, pInput[i], pInput[255-i]);
+ * Reverse the odd bands before IMDCT, this is an effect of the QMF
+ * transform or it gives better compression to do it this way.
+ * FIXME: It should be possible to handle this in imdct_calc
+ * for that to happen a modification of the prerotation step of
+ * all SIMD code and C code is needed.
+ * Or fix the functions before so they generate a pre reversed spectrum.
+ */
+ for (i = 0; i < 128; i++)
+ FFSWAP(float, input[i], input[255 - i]);
}
- q->mdct_ctx.imdct_calc(&q->mdct_ctx,pOutput,pInput);
+ q->mdct_ctx.imdct_calc(&q->mdct_ctx, output, input);
/* Perform windowing on the output. */
- dsp.vector_fmul(pOutput, pOutput, mdct_window, MDCT_SIZE);
-
+ q->fdsp.vector_fmul(output, output, mdct_window, MDCT_SIZE);
}
-
-/**
- * Atrac 3 indata descrambling, only used for data coming from the rm container
- *
- * @param inbuffer pointer to 8 bit array of indata
- * @param out pointer to 8 bit array of outdata
- * @param bytes amount of bytes
+/*
+ * indata descrambling, only used for data coming from the rm container
*/
-
-static int decode_bytes(const uint8_t* inbuffer, uint8_t* out, int bytes){
+static int decode_bytes(const uint8_t *input, uint8_t *out, int bytes)
+{
int i, off;
uint32_t c;
- const uint32_t* buf;
- uint32_t* obuf = (uint32_t*) out;
+ const uint32_t *buf;
+ uint32_t *output = (uint32_t *)out;
- off = (intptr_t)inbuffer & 3;
- buf = (const uint32_t *)(inbuffer - off);
+ off = (intptr_t)input & 3;
+ buf = (const uint32_t *)(input - off);
if (off)
c = av_be2ne32((0x537F6103U >> (off * 8)) | (0x537F6103U << (32 - (off * 8))));
else
c = av_be2ne32(0x537F6103U);
bytes += 3 + off;
- for (i = 0; i < bytes/4; i++)
- obuf[i] = c ^ buf[i];
+ for (i = 0; i < bytes / 4; i++)
+ output[i] = c ^ buf[i];
if (off)
av_log_ask_for_sample(NULL, "Offset of %d not handled.\n", off);
@@ -199,229 +178,227 @@ static int decode_bytes(const uint8_t* inbuffer, uint8_t* out, int bytes){
return off;
}
+static av_cold void init_atrac3_window(void)
+{
+ int i, j;
-static av_cold int init_atrac3_transforms(ATRAC3Context *q, int is_float) {
- float enc_window[256];
- int i;
-
- /* Generate the mdct window, for details see
+ /* generate the mdct window, for details see
* http://wiki.multimedia.cx/index.php?title=RealAudio_atrc#Windows */
- for (i=0 ; i<256; i++)
- enc_window[i] = (sin(((i + 0.5) / 256.0 - 0.5) * M_PI) + 1.0) * 0.5;
-
- if (!mdct_window[0])
- for (i=0 ; i<256; i++) {
- mdct_window[i] = enc_window[i]/(enc_window[i]*enc_window[i] + enc_window[255-i]*enc_window[255-i]);
- mdct_window[511-i] = mdct_window[i];
- }
-
- /* Initialize the MDCT transform. */
- return ff_mdct_init(&q->mdct_ctx, 9, 1, is_float ? 1.0 / 32768 : 1.0);
+ for (i = 0, j = 255; i < 128; i++, j--) {
+ float wi = sin(((i + 0.5) / 256.0 - 0.5) * M_PI) + 1.0;
+ float wj = sin(((j + 0.5) / 256.0 - 0.5) * M_PI) + 1.0;
+ float w = 0.5 * (wi * wi + wj * wj);
+ mdct_window[i] = mdct_window[511 - i] = wi / w;
+ mdct_window[j] = mdct_window[511 - j] = wj / w;
+ }
}
-/**
- * Atrac3 uninit, free all allocated memory
- */
-
static av_cold int atrac3_decode_close(AVCodecContext *avctx)
{
ATRAC3Context *q = avctx->priv_data;
- av_free(q->pUnits);
+ av_free(q->units);
av_free(q->decoded_bytes_buffer);
- av_freep(&q->outSamples[0]);
ff_mdct_end(&q->mdct_ctx);
return 0;
}
-/**
-/ * Mantissa decoding
+/*
+ * Mantissa decoding
*
- * @param gb the GetBit context
- * @param selector what table is the output values coded with
- * @param codingFlag constant length coding or variable length coding
- * @param mantissas mantissa output table
- * @param numCodes amount of values to get
+ * @param selector which table the output values are coded with
+ * @param coding_flag constant length coding or variable length coding
+ * @param mantissas mantissa output table
+ * @param num_codes number of values to get
*/
-
-static void readQuantSpectralCoeffs (GetBitContext *gb, int selector, int codingFlag, int* mantissas, int numCodes)
+static void read_quant_spectral_coeffs(GetBitContext *gb, int selector,
+ int coding_flag, int *mantissas,
+ int num_codes)
{
- int numBits, cnt, code, huffSymb;
+ int i, code, huff_symb;
if (selector == 1)
- numCodes /= 2;
+ num_codes /= 2;
- if (codingFlag != 0) {
+ if (coding_flag != 0) {
/* constant length coding (CLC) */
- numBits = CLCLengthTab[selector];
+ int num_bits = clc_length_tab[selector];
if (selector > 1) {
- for (cnt = 0; cnt < numCodes; cnt++) {
- if (numBits)
- code = get_sbits(gb, numBits);
+ for (i = 0; i < num_codes; i++) {
+ if (num_bits)
+ code = get_sbits(gb, num_bits);
else
code = 0;
- mantissas[cnt] = code;
+ mantissas[i] = code;
}
} else {
- for (cnt = 0; cnt < numCodes; cnt++) {
- if (numBits)
- code = get_bits(gb, numBits); //numBits is always 4 in this case
+ for (i = 0; i < num_codes; i++) {
+ if (num_bits)
+ code = get_bits(gb, num_bits); // num_bits is always 4 in this case
else
code = 0;
- mantissas[cnt*2] = seTab_0[code >> 2];
- mantissas[cnt*2+1] = seTab_0[code & 3];
+ mantissas[i * 2 ] = mantissa_clc_tab[code >> 2];
+ mantissas[i * 2 + 1] = mantissa_clc_tab[code & 3];
}
}
} else {
/* variable length coding (VLC) */
if (selector != 1) {
- for (cnt = 0; cnt < numCodes; cnt++) {
- huffSymb = get_vlc2(gb, spectral_coeff_tab[selector-1].table, spectral_coeff_tab[selector-1].bits, 3);
- huffSymb += 1;
- code = huffSymb >> 1;
- if (huffSymb & 1)
+ for (i = 0; i < num_codes; i++) {
+ huff_symb = get_vlc2(gb, spectral_coeff_tab[selector-1].table,
+ spectral_coeff_tab[selector-1].bits, 3);
+ huff_symb += 1;
+ code = huff_symb >> 1;
+ if (huff_symb & 1)
code = -code;
- mantissas[cnt] = code;
+ mantissas[i] = code;
}
} else {
- for (cnt = 0; cnt < numCodes; cnt++) {
- huffSymb = get_vlc2(gb, spectral_coeff_tab[selector-1].table, spectral_coeff_tab[selector-1].bits, 3);
- mantissas[cnt*2] = decTable1[huffSymb*2];
- mantissas[cnt*2+1] = decTable1[huffSymb*2+1];
+ for (i = 0; i < num_codes; i++) {
+ huff_symb = get_vlc2(gb, spectral_coeff_tab[selector - 1].table,
+ spectral_coeff_tab[selector - 1].bits, 3);
+ mantissas[i * 2 ] = mantissa_vlc_tab[huff_symb * 2 ];
+ mantissas[i * 2 + 1] = mantissa_vlc_tab[huff_symb * 2 + 1];
}
}
}
}
-/**
+/*
* Restore the quantized band spectrum coefficients
*
- * @param gb the GetBit context
- * @param pOut decoded band spectrum
- * @return outSubbands subband counter, fix for broken specification/files
+ * @return subband count, fix for broken specification/files
*/
-
-static int decodeSpectrum (GetBitContext *gb, float *pOut)
+static int decode_spectrum(GetBitContext *gb, float *output)
{
- int numSubbands, codingMode, cnt, first, last, subbWidth, *pIn;
- int subband_vlc_index[32], SF_idxs[32];
- int mantissas[128];
- float SF;
-
- numSubbands = get_bits(gb, 5); // number of coded subbands
- codingMode = get_bits1(gb); // coding Mode: 0 - VLC/ 1-CLC
-
- /* Get the VLC selector table for the subbands, 0 means not coded. */
- for (cnt = 0; cnt <= numSubbands; cnt++)
- subband_vlc_index[cnt] = get_bits(gb, 3);
-
- /* Read the scale factor indexes from the stream. */
- for (cnt = 0; cnt <= numSubbands; cnt++) {
- if (subband_vlc_index[cnt] != 0)
- SF_idxs[cnt] = get_bits(gb, 6);
+ int num_subbands, coding_mode, i, j, first, last, subband_size;
+ int subband_vlc_index[32], sf_index[32];
+ int mantissas[128];
+ float scale_factor;
+
+ num_subbands = get_bits(gb, 5); // number of coded subbands
+ coding_mode = get_bits1(gb); // coding Mode: 0 - VLC/ 1-CLC
+
+ /* get the VLC selector table for the subbands, 0 means not coded */
+ for (i = 0; i <= num_subbands; i++)
+ subband_vlc_index[i] = get_bits(gb, 3);
+
+ /* read the scale factor indexes from the stream */
+ for (i = 0; i <= num_subbands; i++) {
+ if (subband_vlc_index[i] != 0)
+ sf_index[i] = get_bits(gb, 6);
}
- for (cnt = 0; cnt <= numSubbands; cnt++) {
- first = subbandTab[cnt];
- last = subbandTab[cnt+1];
+ for (i = 0; i <= num_subbands; i++) {
+ first = subband_tab[i ];
+ last = subband_tab[i + 1];
- subbWidth = last - first;
+ subband_size = last - first;
- if (subband_vlc_index[cnt] != 0) {
- /* Decode spectral coefficients for this subband. */
+ if (subband_vlc_index[i] != 0) {
+ /* decode spectral coefficients for this subband */
/* TODO: This can be done faster is several blocks share the
* same VLC selector (subband_vlc_index) */
- readQuantSpectralCoeffs (gb, subband_vlc_index[cnt], codingMode, mantissas, subbWidth);
+ read_quant_spectral_coeffs(gb, subband_vlc_index[i], coding_mode,
+ mantissas, subband_size);
- /* Decode the scale factor for this subband. */
- SF = ff_atrac_sf_table[SF_idxs[cnt]] * iMaxQuant[subband_vlc_index[cnt]];
+ /* decode the scale factor for this subband */
+ scale_factor = ff_atrac_sf_table[sf_index[i]] *
+ inv_max_quant[subband_vlc_index[i]];
- /* Inverse quantize the coefficients. */
- for (pIn=mantissas ; first<last; first++, pIn++)
- pOut[first] = *pIn * SF;
+ /* inverse quantize the coefficients */
+ for (j = 0; first < last; first++, j++)
+ output[first] = mantissas[j] * scale_factor;
} else {
- /* This subband was not coded, so zero the entire subband. */
- memset(pOut+first, 0, subbWidth*sizeof(float));
+ /* this subband was not coded, so zero the entire subband */
+ memset(output + first, 0, subband_size * sizeof(*output));
}
}
- /* Clear the subbands that were not coded. */
- first = subbandTab[cnt];
- memset(pOut+first, 0, (SAMPLES_PER_FRAME - first) * sizeof(float));
- return numSubbands;
+ /* clear the subbands that were not coded */
+ first = subband_tab[i];
+ memset(output + first, 0, (SAMPLES_PER_FRAME - first) * sizeof(*output));
+ return num_subbands;
}
-/**
+/*
* Restore the quantized tonal components
*
- * @param gb the GetBit context
- * @param pComponent tone component
- * @param numBands amount of coded bands
+ * @param components tonal components
+ * @param num_bands number of coded bands
*/
-
-static int decodeTonalComponents (GetBitContext *gb, tonal_component *pComponent, int numBands)
+static int decode_tonal_components(GetBitContext *gb,
+ TonalComponent *components, int num_bands)
{
- int i,j,k,cnt;
- int components, coding_mode_selector, coding_mode, coded_values_per_component;
- int sfIndx, coded_values, max_coded_values, quant_step_index, coded_components;
- int band_flags[4], mantissa[8];
- float *pCoef;
- float scalefactor;
- int component_count = 0;
+ int i, b, c, m;
+ int nb_components, coding_mode_selector, coding_mode;
+ int band_flags[4], mantissa[8];
+ int component_count = 0;
- components = get_bits(gb,5);
+ nb_components = get_bits(gb, 5);
/* no tonal components */
- if (components == 0)
+ if (nb_components == 0)
return 0;
- coding_mode_selector = get_bits(gb,2);
+ coding_mode_selector = get_bits(gb, 2);
if (coding_mode_selector == 2)
return AVERROR_INVALIDDATA;
coding_mode = coding_mode_selector & 1;
- for (i = 0; i < components; i++) {
- for (cnt = 0; cnt <= numBands; cnt++)
- band_flags[cnt] = get_bits1(gb);
+ for (i = 0; i < nb_components; i++) {
+ int coded_values_per_component, quant_step_index;
+
+ for (b = 0; b <= num_bands; b++)
+ band_flags[b] = get_bits1(gb);
- coded_values_per_component = get_bits(gb,3);
+ coded_values_per_component = get_bits(gb, 3);
- quant_step_index = get_bits(gb,3);
+ quant_step_index = get_bits(gb, 3);
if (quant_step_index <= 1)
return AVERROR_INVALIDDATA;
if (coding_mode_selector == 3)
coding_mode = get_bits1(gb);
- for (j = 0; j < (numBands + 1) * 4; j++) {
- if (band_flags[j >> 2] == 0)
+ for (b = 0; b < (num_bands + 1) * 4; b++) {
+ int coded_components;
+
+ if (band_flags[b >> 2] == 0)
continue;
- coded_components = get_bits(gb,3);
+ coded_components = get_bits(gb, 3);
+
+ for (c = 0; c < coded_components; c++) {
+ TonalComponent *cmp = &components[component_count];
+ int sf_index, coded_values, max_coded_values;
+ float scale_factor;
- for (k=0; k<coded_components; k++) {
- sfIndx = get_bits(gb,6);
+ sf_index = get_bits(gb, 6);
if (component_count >= 64)
return AVERROR_INVALIDDATA;
- pComponent[component_count].pos = j * 64 + (get_bits(gb,6));
- max_coded_values = SAMPLES_PER_FRAME - pComponent[component_count].pos;
- coded_values = coded_values_per_component + 1;
- coded_values = FFMIN(max_coded_values,coded_values);
- scalefactor = ff_atrac_sf_table[sfIndx] * iMaxQuant[quant_step_index];
+ cmp->pos = b * 64 + get_bits(gb, 6);
- readQuantSpectralCoeffs(gb, quant_step_index, coding_mode, mantissa, coded_values);
+ max_coded_values = SAMPLES_PER_FRAME - cmp->pos;
+ coded_values = coded_values_per_component + 1;
+ coded_values = FFMIN(max_coded_values, coded_values);
- pComponent[component_count].numCoefs = coded_values;
+ scale_factor = ff_atrac_sf_table[sf_index] *
+ inv_max_quant[quant_step_index];
+
+ read_quant_spectral_coeffs(gb, quant_step_index, coding_mode,
+ mantissa, coded_values);
+
+ cmp->num_coefs = coded_values;
/* inverse quant */
- pCoef = pComponent[component_count].coef;
- for (cnt = 0; cnt < coded_values; cnt++)
- pCoef[cnt] = mantissa[cnt] * scalefactor;
+ for (m = 0; m < coded_values; m++)
+ cmp->coef[m] = mantissa[m] * scale_factor;
component_count++;
}
@@ -431,417 +408,404 @@ static int decodeTonalComponents (GetBitContext *gb, tonal_component *pComponent
return component_count;
}
-/**
+/*
* Decode gain parameters for the coded bands
*
- * @param gb the GetBit context
- * @param pGb the gainblock for the current band
- * @param numBands amount of coded bands
+ * @param block the gainblock for the current band
+ * @param num_bands amount of coded bands
*/
-
-static int decodeGainControl (GetBitContext *gb, gain_block *pGb, int numBands)
+static int decode_gain_control(GetBitContext *gb, GainBlock *block,
+ int num_bands)
{
- int i, cf, numData;
- int *pLevel, *pLoc;
-
- gain_info *pGain = pGb->gBlock;
-
- for (i=0 ; i<=numBands; i++)
- {
- numData = get_bits(gb,3);
- pGain[i].num_gain_data = numData;
- pLevel = pGain[i].levcode;
- pLoc = pGain[i].loccode;
-
- for (cf = 0; cf < numData; cf++){
- pLevel[cf]= get_bits(gb,4);
- pLoc [cf]= get_bits(gb,5);
- if(cf && pLoc[cf] <= pLoc[cf-1])
+ int i, cf, num_data;
+ int *level, *loc;
+
+ GainInfo *gain = block->g_block;
+
+ for (i = 0; i <= num_bands; i++) {
+ num_data = get_bits(gb, 3);
+ gain[i].num_gain_data = num_data;
+ level = gain[i].lev_code;
+ loc = gain[i].loc_code;
+
+ for (cf = 0; cf < gain[i].num_gain_data; cf++) {
+ level[cf] = get_bits(gb, 4);
+ loc [cf] = get_bits(gb, 5);
+ if (cf && loc[cf] <= loc[cf - 1])
return AVERROR_INVALIDDATA;
}
}
/* Clear the unused blocks. */
- for (; i<4 ; i++)
- pGain[i].num_gain_data = 0;
+ for (; i < 4 ; i++)
+ gain[i].num_gain_data = 0;
return 0;
}
-/**
+/*
* Apply gain parameters and perform the MDCT overlapping part
*
- * @param pIn input float buffer
- * @param pPrev previous float buffer to perform overlap against
- * @param pOut output float buffer
- * @param pGain1 current band gain info
- * @param pGain2 next band gain info
+ * @param input input buffer
+ * @param prev previous buffer to perform overlap against
+ * @param output output buffer
+ * @param gain1 current band gain info
+ * @param gain2 next band gain info
*/
-
-static void gainCompensateAndOverlap (float *pIn, float *pPrev, float *pOut, gain_info *pGain1, gain_info *pGain2)
+static void gain_compensate_and_overlap(float *input, float *prev,
+ float *output, GainInfo *gain1,
+ GainInfo *gain2)
{
- /* gain compensation function */
- float gain1, gain2, gain_inc;
- int cnt, numdata, nsample, startLoc, endLoc;
+ float g1, g2, gain_inc;
+ int i, j, num_data, start_loc, end_loc;
- if (pGain2->num_gain_data == 0)
- gain1 = 1.0;
+ if (gain2->num_gain_data == 0)
+ g1 = 1.0;
else
- gain1 = gain_tab1[pGain2->levcode[0]];
+ g1 = gain_tab1[gain2->lev_code[0]];
- if (pGain1->num_gain_data == 0) {
- for (cnt = 0; cnt < 256; cnt++)
- pOut[cnt] = pIn[cnt] * gain1 + pPrev[cnt];
+ if (gain1->num_gain_data == 0) {
+ for (i = 0; i < 256; i++)
+ output[i] = input[i] * g1 + prev[i];
} else {
- numdata = pGain1->num_gain_data;
- pGain1->loccode[numdata] = 32;
- pGain1->levcode[numdata] = 4;
-
- nsample = 0; // current sample = 0
+ num_data = gain1->num_gain_data;
+ gain1->loc_code[num_data] = 32;
+ gain1->lev_code[num_data] = 4;
- for (cnt = 0; cnt < numdata; cnt++) {
- startLoc = pGain1->loccode[cnt] * 8;
- endLoc = startLoc + 8;
+ for (i = 0, j = 0; i < num_data; i++) {
+ start_loc = gain1->loc_code[i] * 8;
+ end_loc = start_loc + 8;
- gain2 = gain_tab1[pGain1->levcode[cnt]];
- gain_inc = gain_tab2[(pGain1->levcode[cnt+1] - pGain1->levcode[cnt])+15];
+ g2 = gain_tab1[gain1->lev_code[i]];
+ gain_inc = gain_tab2[gain1->lev_code[i + 1] -
+ gain1->lev_code[i ] + 15];
/* interpolate */
- for (; nsample < startLoc; nsample++)
- pOut[nsample] = (pIn[nsample] * gain1 + pPrev[nsample]) * gain2;
+ for (; j < start_loc; j++)
+ output[j] = (input[j] * g1 + prev[j]) * g2;
/* interpolation is done over eight samples */
- for (; nsample < endLoc; nsample++) {
- pOut[nsample] = (pIn[nsample] * gain1 + pPrev[nsample]) * gain2;
- gain2 *= gain_inc;
+ for (; j < end_loc; j++) {
+ output[j] = (input[j] * g1 + prev[j]) * g2;
+ g2 *= gain_inc;
}
}
- for (; nsample < 256; nsample++)
- pOut[nsample] = (pIn[nsample] * gain1) + pPrev[nsample];
+ for (; j < 256; j++)
+ output[j] = input[j] * g1 + prev[j];
}
/* Delay for the overlapping part. */
- memcpy(pPrev, &pIn[256], 256*sizeof(float));
+ memcpy(prev, &input[256], 256 * sizeof(*prev));
}
-/**
+/*
* Combine the tonal band spectrum and regular band spectrum
- * Return position of the last tonal coefficient
*
- * @param pSpectrum output spectrum buffer
- * @param numComponents amount of tonal components
- * @param pComponent tonal components for this band
+ * @param spectrum output spectrum buffer
+ * @param num_components number of tonal components
+ * @param components tonal components for this band
+ * @return position of the last tonal coefficient
*/
-
-static int addTonalComponents (float *pSpectrum, int numComponents, tonal_component *pComponent)
+static int add_tonal_components(float *spectrum, int num_components,
+ TonalComponent *components)
{
- int cnt, i, lastPos = -1;
- float *pIn, *pOut;
+ int i, j, last_pos = -1;
+ float *input, *output;
- for (cnt = 0; cnt < numComponents; cnt++){
- lastPos = FFMAX(pComponent[cnt].pos + pComponent[cnt].numCoefs, lastPos);
- pIn = pComponent[cnt].coef;
- pOut = &(pSpectrum[pComponent[cnt].pos]);
+ for (i = 0; i < num_components; i++) {
+ last_pos = FFMAX(components[i].pos + components[i].num_coefs, last_pos);
+ input = components[i].coef;
+ output = &spectrum[components[i].pos];
- for (i=0 ; i<pComponent[cnt].numCoefs ; i++)
- pOut[i] += pIn[i];
+ for (j = 0; j < components[i].num_coefs; j++)
+ output[j] += input[j];
}
- return lastPos;
+ return last_pos;
}
+#define INTERPOLATE(old, new, nsample) \
+ ((old) + (nsample) * 0.125 * ((new) - (old)))
-#define INTERPOLATE(old,new,nsample) ((old) + (nsample)*0.125*((new)-(old)))
-
-static void reverseMatrixing(float *su1, float *su2, int *pPrevCode, int *pCurrCode)
+static void reverse_matrixing(float *su1, float *su2, int *prev_code,
+ int *curr_code)
{
- int i, band, nsample, s1, s2;
- float c1, c2;
- float mc1_l, mc1_r, mc2_l, mc2_r;
+ int i, nsample, band;
+ float mc1_l, mc1_r, mc2_l, mc2_r;
- for (i=0,band = 0; band < 4*256; band+=256,i++) {
- s1 = pPrevCode[i];
- s2 = pCurrCode[i];
- nsample = 0;
+ for (i = 0, band = 0; band < 4 * 256; band += 256, i++) {
+ int s1 = prev_code[i];
+ int s2 = curr_code[i];
+ nsample = band;
if (s1 != s2) {
/* Selector value changed, interpolation needed. */
- mc1_l = matrixCoeffs[s1*2];
- mc1_r = matrixCoeffs[s1*2+1];
- mc2_l = matrixCoeffs[s2*2];
- mc2_r = matrixCoeffs[s2*2+1];
+ mc1_l = matrix_coeffs[s1 * 2 ];
+ mc1_r = matrix_coeffs[s1 * 2 + 1];
+ mc2_l = matrix_coeffs[s2 * 2 ];
+ mc2_r = matrix_coeffs[s2 * 2 + 1];
/* Interpolation is done over the first eight samples. */
- for(; nsample < 8; nsample++) {
- c1 = su1[band+nsample];
- c2 = su2[band+nsample];
- c2 = c1 * INTERPOLATE(mc1_l,mc2_l,nsample) + c2 * INTERPOLATE(mc1_r,mc2_r,nsample);
- su1[band+nsample] = c2;
- su2[band+nsample] = c1 * 2.0 - c2;
+ for (; nsample < band + 8; nsample++) {
+ float c1 = su1[nsample];
+ float c2 = su2[nsample];
+ c2 = c1 * INTERPOLATE(mc1_l, mc2_l, nsample - band) +
+ c2 * INTERPOLATE(mc1_r, mc2_r, nsample - band);
+ su1[nsample] = c2;
+ su2[nsample] = c1 * 2.0 - c2;
}
}
/* Apply the matrix without interpolation. */
switch (s2) {
- case 0: /* M/S decoding */
- for (; nsample < 256; nsample++) {
- c1 = su1[band+nsample];
- c2 = su2[band+nsample];
- su1[band+nsample] = c2 * 2.0;
- su2[band+nsample] = (c1 - c2) * 2.0;
- }
- break;
-
- case 1:
- for (; nsample < 256; nsample++) {
- c1 = su1[band+nsample];
- c2 = su2[band+nsample];
- su1[band+nsample] = (c1 + c2) * 2.0;
- su2[band+nsample] = c2 * -2.0;
- }
- break;
- case 2:
- case 3:
- for (; nsample < 256; nsample++) {
- c1 = su1[band+nsample];
- c2 = su2[band+nsample];
- su1[band+nsample] = c1 + c2;
- su2[band+nsample] = c1 - c2;
- }
- break;
- default:
- assert(0);
+ case 0: /* M/S decoding */
+ for (; nsample < band + 256; nsample++) {
+ float c1 = su1[nsample];
+ float c2 = su2[nsample];
+ su1[nsample] = c2 * 2.0;
+ su2[nsample] = (c1 - c2) * 2.0;
+ }
+ break;
+ case 1:
+ for (; nsample < band + 256; nsample++) {
+ float c1 = su1[nsample];
+ float c2 = su2[nsample];
+ su1[nsample] = (c1 + c2) * 2.0;
+ su2[nsample] = c2 * -2.0;
+ }
+ break;
+ case 2:
+ case 3:
+ for (; nsample < band + 256; nsample++) {
+ float c1 = su1[nsample];
+ float c2 = su2[nsample];
+ su1[nsample] = c1 + c2;
+ su2[nsample] = c1 - c2;
+ }
+ break;
+ default:
+ assert(0);
}
}
}
-static void getChannelWeights (int indx, int flag, float ch[2]){
-
- if (indx == 7) {
+static void get_channel_weights(int index, int flag, float ch[2])
+{
+ if (index == 7) {
ch[0] = 1.0;
ch[1] = 1.0;
} else {
- ch[0] = (float)(indx & 7) / 7.0;
- ch[1] = sqrt(2 - ch[0]*ch[0]);
- if(flag)
+ ch[0] = (index & 7) / 7.0;
+ ch[1] = sqrt(2 - ch[0] * ch[0]);
+ if (flag)
FFSWAP(float, ch[0], ch[1]);
}
}
-static void channelWeighting (float *su1, float *su2, int *p3)
+static void channel_weighting(float *su1, float *su2, int *p3)
{
- int band, nsample;
+ int band, nsample;
/* w[x][y] y=0 is left y=1 is right */
float w[2][2];
- if (p3[1] != 7 || p3[3] != 7){
- getChannelWeights(p3[1], p3[0], w[0]);
- getChannelWeights(p3[3], p3[2], w[1]);
+ if (p3[1] != 7 || p3[3] != 7) {
+ get_channel_weights(p3[1], p3[0], w[0]);
+ get_channel_weights(p3[3], p3[2], w[1]);
- for(band = 1; band < 4; band++) {
- /* scale the channels by the weights */
- for(nsample = 0; nsample < 8; nsample++) {
- su1[band*256+nsample] *= INTERPOLATE(w[0][0], w[0][1], nsample);
- su2[band*256+nsample] *= INTERPOLATE(w[1][0], w[1][1], nsample);
+ for (band = 256; band < 4 * 256; band += 256) {
+ for (nsample = band; nsample < band + 8; nsample++) {
+ su1[nsample] *= INTERPOLATE(w[0][0], w[0][1], nsample - band);
+ su2[nsample] *= INTERPOLATE(w[1][0], w[1][1], nsample - band);
}
-
- for(; nsample < 256; nsample++) {
- su1[band*256+nsample] *= w[1][0];
- su2[band*256+nsample] *= w[1][1];
+ for(; nsample < band + 256; nsample++) {
+ su1[nsample] *= w[1][0];
+ su2[nsample] *= w[1][1];
}
}
}
}
-
-/**
+/*
* Decode a Sound Unit
*
- * @param gb the GetBit context
- * @param pSnd the channel unit to be used
- * @param pOut the decoded samples before IQMF in float representation
- * @param channelNum channel number
- * @param codingMode the coding mode (JOINT_STEREO or regular stereo/mono)
+ * @param snd the channel unit to be used
+ * @param output the decoded samples before IQMF in float representation
+ * @param channel_num channel number
+ * @param coding_mode the coding mode (JOINT_STEREO or regular stereo/mono)
*/
-
-
-static int decodeChannelSoundUnit (ATRAC3Context *q, GetBitContext *gb, channel_unit *pSnd, float *pOut, int channelNum, int codingMode)
+static int decode_channel_sound_unit(ATRAC3Context *q, GetBitContext *gb,
+ ChannelUnit *snd, float *output,
+ int channel_num, int coding_mode)
{
- int band, result=0, numSubbands, lastTonal, numBands;
+ int band, ret, num_subbands, last_tonal, num_bands;
+ GainBlock *gain1 = &snd->gain_block[ snd->gc_blk_switch];
+ GainBlock *gain2 = &snd->gain_block[1 - snd->gc_blk_switch];
- if (codingMode == JOINT_STEREO && channelNum == 1) {
- if (get_bits(gb,2) != 3) {
+ if (coding_mode == JOINT_STEREO && channel_num == 1) {
+ if (get_bits(gb, 2) != 3) {
av_log(NULL,AV_LOG_ERROR,"JS mono Sound Unit id != 3.\n");
return AVERROR_INVALIDDATA;
}
} else {
- if (get_bits(gb,6) != 0x28) {
+ if (get_bits(gb, 6) != 0x28) {
av_log(NULL,AV_LOG_ERROR,"Sound Unit id != 0x28.\n");
return AVERROR_INVALIDDATA;
}
}
/* number of coded QMF bands */
- pSnd->bandsCoded = get_bits(gb,2);
+ snd->bands_coded = get_bits(gb, 2);
- result = decodeGainControl (gb, &(pSnd->gainBlock[pSnd->gcBlkSwitch]), pSnd->bandsCoded);
- if (result) return result;
+ ret = decode_gain_control(gb, gain2, snd->bands_coded);
+ if (ret)
+ return ret;
- pSnd->numComponents = decodeTonalComponents (gb, pSnd->components, pSnd->bandsCoded);
- if (pSnd->numComponents == -1) return -1;
+ snd->num_components = decode_tonal_components(gb, snd->components,
+ snd->bands_coded);
+ if (snd->num_components == -1)
+ return -1;
- numSubbands = decodeSpectrum (gb, pSnd->spectrum);
+ num_subbands = decode_spectrum(gb, snd->spectrum);
/* Merge the decoded spectrum and tonal components. */
- lastTonal = addTonalComponents (pSnd->spectrum, pSnd->numComponents, pSnd->components);
+ last_tonal = add_tonal_components(snd->spectrum, snd->num_components,
+ snd->components);
- /* calculate number of used MLT/QMF bands according to the amount of coded spectral lines */
- numBands = (subbandTab[numSubbands] - 1) >> 8;
- if (lastTonal >= 0)
- numBands = FFMAX((lastTonal + 256) >> 8, numBands);
+ /* calculate number of used MLT/QMF bands according to the amount of coded
+ spectral lines */
+ num_bands = (subband_tab[num_subbands] - 1) >> 8;
+ if (last_tonal >= 0)
+ num_bands = FFMAX((last_tonal + 256) >> 8, num_bands);
/* Reconstruct time domain samples. */
- for (band=0; band<4; band++) {
+ for (band = 0; band < 4; band++) {
/* Perform the IMDCT step without overlapping. */
- if (band <= numBands) {
- IMLT(q, &(pSnd->spectrum[band*256]), pSnd->IMDCT_buf, band&1);
- } else
- memset(pSnd->IMDCT_buf, 0, 512 * sizeof(float));
+ if (band <= num_bands)
+ imlt(q, &snd->spectrum[band * 256], snd->imdct_buf, band & 1);
+ else
+ memset(snd->imdct_buf, 0, 512 * sizeof(*snd->imdct_buf));
/* gain compensation and overlapping */
- gainCompensateAndOverlap(pSnd->IMDCT_buf, &pSnd->prevFrame[band * 256],
- &pOut[band * 256],
- &pSnd->gainBlock[1 - pSnd->gcBlkSwitch].gBlock[band],
- &pSnd->gainBlock[ pSnd->gcBlkSwitch].gBlock[band]);
+ gain_compensate_and_overlap(snd->imdct_buf,
+ &snd->prev_frame[band * 256],
+ &output[band * 256],
+ &gain1->g_block[band],
+ &gain2->g_block[band]);
}
/* Swap the gain control buffers for the next frame. */
- pSnd->gcBlkSwitch ^= 1;
+ snd->gc_blk_switch ^= 1;
return 0;
}
-/**
- * Frame handling
- *
- * @param q Atrac3 private context
- * @param databuf the input data
- */
-
-static int decodeFrame(ATRAC3Context *q, const uint8_t* databuf,
- float **out_samples)
+static int decode_frame(AVCodecContext *avctx, const uint8_t *databuf,
+ float **out_samples)
{
- int result, i;
- float *p1, *p2, *p3, *p4;
+ ATRAC3Context *q = avctx->priv_data;
+ int ret, i;
uint8_t *ptr1;
- if (q->codingMode == JOINT_STEREO) {
-
+ if (q->coding_mode == JOINT_STEREO) {
/* channel coupling mode */
/* decode Sound Unit 1 */
- init_get_bits(&q->gb,databuf,q->bits_per_frame);
+ init_get_bits(&q->gb, databuf, avctx->block_align * 8);
- result = decodeChannelSoundUnit(q,&q->gb, q->pUnits, out_samples[0], 0, JOINT_STEREO);
- if (result != 0)
- return result;
+ ret = decode_channel_sound_unit(q, &q->gb, q->units, out_samples[0], 0,
+ JOINT_STEREO);
+ if (ret != 0)
+ return ret;
/* Framedata of the su2 in the joint-stereo mode is encoded in
* reverse byte order so we need to swap it first. */
if (databuf == q->decoded_bytes_buffer) {
- uint8_t *ptr2 = q->decoded_bytes_buffer+q->bytes_per_frame-1;
- ptr1 = q->decoded_bytes_buffer;
- for (i = 0; i < (q->bytes_per_frame/2); i++, ptr1++, ptr2--) {
- FFSWAP(uint8_t,*ptr1,*ptr2);
- }
+ uint8_t *ptr2 = q->decoded_bytes_buffer + avctx->block_align - 1;
+ ptr1 = q->decoded_bytes_buffer;
+ for (i = 0; i < avctx->block_align / 2; i++, ptr1++, ptr2--)
+ FFSWAP(uint8_t, *ptr1, *ptr2);
} else {
- const uint8_t *ptr2 = databuf+q->bytes_per_frame-1;
- for (i = 0; i < q->bytes_per_frame; i++)
+ const uint8_t *ptr2 = databuf + avctx->block_align - 1;
+ for (i = 0; i < avctx->block_align; i++)
q->decoded_bytes_buffer[i] = *ptr2--;
}
/* Skip the sync codes (0xF8). */
ptr1 = q->decoded_bytes_buffer;
for (i = 4; *ptr1 == 0xF8; i++, ptr1++) {
- if (i >= q->bytes_per_frame)
+ if (i >= avctx->block_align)
return AVERROR_INVALIDDATA;
}
/* set the bitstream reader at the start of the second Sound Unit*/
- init_get_bits(&q->gb,ptr1,q->bits_per_frame);
+ init_get_bits(&q->gb, ptr1, avctx->block_align * 8);
/* Fill the Weighting coeffs delay buffer */
- memmove(q->weighting_delay,&(q->weighting_delay[2]),4*sizeof(int));
+ memmove(q->weighting_delay, &q->weighting_delay[2],
+ 4 * sizeof(*q->weighting_delay));
q->weighting_delay[4] = get_bits1(&q->gb);
- q->weighting_delay[5] = get_bits(&q->gb,3);
+ q->weighting_delay[5] = get_bits(&q->gb, 3);
for (i = 0; i < 4; i++) {
q->matrix_coeff_index_prev[i] = q->matrix_coeff_index_now[i];
- q->matrix_coeff_index_now[i] = q->matrix_coeff_index_next[i];
- q->matrix_coeff_index_next[i] = get_bits(&q->gb,2);
+ q->matrix_coeff_index_now[i] = q->matrix_coeff_index_next[i];
+ q->matrix_coeff_index_next[i] = get_bits(&q->gb, 2);
}
/* Decode Sound Unit 2. */
- result = decodeChannelSoundUnit(q,&q->gb, &q->pUnits[1], out_samples[1], 1, JOINT_STEREO);
- if (result != 0)
- return result;
+ ret = decode_channel_sound_unit(q, &q->gb, &q->units[1],
+ out_samples[1], 1, JOINT_STEREO);
+ if (ret != 0)
+ return ret;
/* Reconstruct the channel coefficients. */
- reverseMatrixing(out_samples[0], out_samples[1], q->matrix_coeff_index_prev, q->matrix_coeff_index_now);
-
- channelWeighting(out_samples[0], out_samples[1], q->weighting_delay);
+ reverse_matrixing(out_samples[0], out_samples[1],
+ q->matrix_coeff_index_prev,
+ q->matrix_coeff_index_now);
+ channel_weighting(out_samples[0], out_samples[1], q->weighting_delay);
} else {
/* normal stereo mode or mono */
/* Decode the channel sound units. */
- for (i=0 ; i<q->channels ; i++) {
-
+ for (i = 0; i < avctx->channels; i++) {
/* Set the bitstream reader at the start of a channel sound unit. */
init_get_bits(&q->gb,
- databuf + i * q->bytes_per_frame / q->channels,
- q->bits_per_frame / q->channels);
+ databuf + i * avctx->block_align / avctx->channels,
+ avctx->block_align * 8 / avctx->channels);
- result = decodeChannelSoundUnit(q,&q->gb, &q->pUnits[i], out_samples[i], i, q->codingMode);
- if (result != 0)
- return result;
+ ret = decode_channel_sound_unit(q, &q->gb, &q->units[i],
+ out_samples[i], i, q->coding_mode);
+ if (ret != 0)
+ return ret;
}
}
/* Apply the iQMF synthesis filter. */
- for (i=0 ; i<q->channels ; i++) {
- p1 = out_samples[i];
- p2= p1+256;
- p3= p2+256;
- p4= p3+256;
- atrac_iqmf (p1, p2, 256, p1, q->pUnits[i].delayBuf1, q->tempBuf);
- atrac_iqmf (p4, p3, 256, p3, q->pUnits[i].delayBuf2, q->tempBuf);
- atrac_iqmf (p1, p3, 512, p1, q->pUnits[i].delayBuf3, q->tempBuf);
+ for (i = 0; i < avctx->channels; i++) {
+ float *p1 = out_samples[i];
+ float *p2 = p1 + 256;
+ float *p3 = p2 + 256;
+ float *p4 = p3 + 256;
+ ff_atrac_iqmf(p1, p2, 256, p1, q->units[i].delay_buf1, q->temp_buf);
+ ff_atrac_iqmf(p4, p3, 256, p3, q->units[i].delay_buf2, q->temp_buf);
+ ff_atrac_iqmf(p1, p3, 512, p1, q->units[i].delay_buf3, q->temp_buf);
}
return 0;
}
-
-/**
- * Atrac frame decoding
- *
- * @param avctx pointer to the AVCodecContext
- */
-
static int atrac3_decode_frame(AVCodecContext *avctx, void *data,
int *got_frame_ptr, AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
ATRAC3Context *q = avctx->priv_data;
- int result;
- const uint8_t* databuf;
- float *samples_flt;
- int16_t *samples_s16;
+ int ret;
+ const uint8_t *databuf;
if (buf_size < avctx->block_align) {
av_log(avctx, AV_LOG_ERROR,
@@ -851,12 +815,10 @@ static int atrac3_decode_frame(AVCodecContext *avctx, void *data,
/* get output buffer */
q->frame.nb_samples = SAMPLES_PER_FRAME;
- if ((result = avctx->get_buffer(avctx, &q->frame)) < 0) {
+ if ((ret = ff_get_buffer(avctx, &q->frame)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
- return result;
+ return ret;
}
- samples_flt = (float *)q->frame.data[0];
- samples_s16 = (int16_t *)q->frame.data[0];
/* Check if we need to descramble and what buffer to pass on. */
if (q->scrambled_stream) {
@@ -866,25 +828,10 @@ static int atrac3_decode_frame(AVCodecContext *avctx, void *data,
databuf = buf;
}
- if (q->channels == 1 && avctx->sample_fmt == AV_SAMPLE_FMT_FLT)
- result = decodeFrame(q, databuf, &samples_flt);
- else
- result = decodeFrame(q, databuf, q->outSamples);
-
- if (result != 0) {
- av_log(NULL,AV_LOG_ERROR,"Frame decoding error!\n");
- return result;
- }
-
- /* interleave */
- if (q->channels == 2 && avctx->sample_fmt == AV_SAMPLE_FMT_FLT) {
- q->fmt_conv.float_interleave(samples_flt,
- (const float **)q->outSamples,
- SAMPLES_PER_FRAME, 2);
- } else if (avctx->sample_fmt == AV_SAMPLE_FMT_S16) {
- q->fmt_conv.float_to_int16_interleave(samples_s16,
- (const float **)q->outSamples,
- SAMPLES_PER_FRAME, q->channels);
+ ret = decode_frame(avctx, databuf, (float **)q->frame.extended_data);
+ if (ret) {
+ av_log(NULL, AV_LOG_ERROR, "Frame decoding error!\n");
+ return ret;
}
*got_frame_ptr = 1;
@@ -893,141 +840,132 @@ static int atrac3_decode_frame(AVCodecContext *avctx, void *data,
return avctx->block_align;
}
+static void atrac3_init_static_data(AVCodec *codec)
+{
+ int i;
-/**
- * Atrac3 initialization
- *
- * @param avctx pointer to the AVCodecContext
- */
+ init_atrac3_window();
+ ff_atrac_generate_tables();
+
+ /* Initialize the VLC tables. */
+ for (i = 0; i < 7; i++) {
+ spectral_coeff_tab[i].table = &atrac3_vlc_table[atrac3_vlc_offs[i]];
+ spectral_coeff_tab[i].table_allocated = atrac3_vlc_offs[i + 1] -
+ atrac3_vlc_offs[i ];
+ init_vlc(&spectral_coeff_tab[i], 9, huff_tab_sizes[i],
+ huff_bits[i], 1, 1,
+ huff_codes[i], 1, 1, INIT_VLC_USE_NEW_STATIC);
+ }
+
+ /* Generate gain tables */
+ for (i = 0; i < 16; i++)
+ gain_tab1[i] = powf(2.0, (4 - i));
+
+ for (i = -15; i < 16; i++)
+ gain_tab2[i + 15] = powf(2.0, i * -0.125);
+}
static av_cold int atrac3_decode_init(AVCodecContext *avctx)
{
int i, ret;
+ int version, delay, samples_per_frame, frame_factor;
const uint8_t *edata_ptr = avctx->extradata;
ATRAC3Context *q = avctx->priv_data;
- static VLC_TYPE atrac3_vlc_table[4096][2];
- static int vlcs_initialized = 0;
- /* Take data from the AVCodecContext (RM container). */
- q->sample_rate = avctx->sample_rate;
- q->channels = avctx->channels;
- q->bit_rate = avctx->bit_rate;
- q->bits_per_frame = avctx->block_align * 8;
- q->bytes_per_frame = avctx->block_align;
+ if (avctx->channels <= 0 || avctx->channels > 2) {
+ av_log(avctx, AV_LOG_ERROR, "Channel configuration error!\n");
+ return AVERROR(EINVAL);
+ }
/* Take care of the codec-specific extradata. */
if (avctx->extradata_size == 14) {
/* Parse the extradata, WAV format */
- av_log(avctx,AV_LOG_DEBUG,"[0-1] %d\n",bytestream_get_le16(&edata_ptr)); //Unknown value always 1
- q->samples_per_channel = bytestream_get_le32(&edata_ptr);
- q->codingMode = bytestream_get_le16(&edata_ptr);
- av_log(avctx,AV_LOG_DEBUG,"[8-9] %d\n",bytestream_get_le16(&edata_ptr)); //Dupe of coding mode
- q->frame_factor = bytestream_get_le16(&edata_ptr); //Unknown always 1
- av_log(avctx,AV_LOG_DEBUG,"[12-13] %d\n",bytestream_get_le16(&edata_ptr)); //Unknown always 0
+ av_log(avctx, AV_LOG_DEBUG, "[0-1] %d\n",
+ bytestream_get_le16(&edata_ptr)); // Unknown value always 1
+ edata_ptr += 4; // samples per channel
+ q->coding_mode = bytestream_get_le16(&edata_ptr);
+ av_log(avctx, AV_LOG_DEBUG,"[8-9] %d\n",
+ bytestream_get_le16(&edata_ptr)); //Dupe of coding mode
+ frame_factor = bytestream_get_le16(&edata_ptr); // Unknown always 1
+ av_log(avctx, AV_LOG_DEBUG,"[12-13] %d\n",
+ bytestream_get_le16(&edata_ptr)); // Unknown always 0
/* setup */
- q->samples_per_frame = SAMPLES_PER_FRAME * q->channels;
- q->atrac3version = 4;
- q->delay = 0x88E;
- if (q->codingMode)
- q->codingMode = JOINT_STEREO;
- else
- q->codingMode = STEREO;
-
- q->scrambled_stream = 0;
-
- if ((q->bytes_per_frame == 96*q->channels*q->frame_factor) || (q->bytes_per_frame == 152*q->channels*q->frame_factor) || (q->bytes_per_frame == 192*q->channels*q->frame_factor)) {
- } else {
- av_log(avctx,AV_LOG_ERROR,"Unknown frame/channel/frame_factor configuration %d/%d/%d\n", q->bytes_per_frame, q->channels, q->frame_factor);
+ samples_per_frame = SAMPLES_PER_FRAME * avctx->channels;
+ version = 4;
+ delay = 0x88E;
+ q->coding_mode = q->coding_mode ? JOINT_STEREO : STEREO;
+ q->scrambled_stream = 0;
+
+ if (avctx->block_align != 96 * avctx->channels * frame_factor &&
+ avctx->block_align != 152 * avctx->channels * frame_factor &&
+ avctx->block_align != 192 * avctx->channels * frame_factor) {
+ av_log(avctx, AV_LOG_ERROR, "Unknown frame/channel/frame_factor "
+ "configuration %d/%d/%d\n", avctx->block_align,
+ avctx->channels, frame_factor);
return AVERROR_INVALIDDATA;
}
-
} else if (avctx->extradata_size == 10) {
/* Parse the extradata, RM format. */
- q->atrac3version = bytestream_get_be32(&edata_ptr);
- q->samples_per_frame = bytestream_get_be16(&edata_ptr);
- q->delay = bytestream_get_be16(&edata_ptr);
- q->codingMode = bytestream_get_be16(&edata_ptr);
-
- q->samples_per_channel = q->samples_per_frame / q->channels;
- q->scrambled_stream = 1;
+ version = bytestream_get_be32(&edata_ptr);
+ samples_per_frame = bytestream_get_be16(&edata_ptr);
+ delay = bytestream_get_be16(&edata_ptr);
+ q->coding_mode = bytestream_get_be16(&edata_ptr);
+ q->scrambled_stream = 1;
} else {
- av_log(NULL,AV_LOG_ERROR,"Unknown extradata size %d.\n",avctx->extradata_size);
+ av_log(NULL, AV_LOG_ERROR, "Unknown extradata size %d.\n",
+ avctx->extradata_size);
+ return AVERROR(EINVAL);
}
- /* Check the extradata. */
- if (q->atrac3version != 4) {
- av_log(avctx,AV_LOG_ERROR,"Version %d != 4.\n",q->atrac3version);
+ /* Check the extradata */
+
+ if (version != 4) {
+ av_log(avctx, AV_LOG_ERROR, "Version %d != 4.\n", version);
return AVERROR_INVALIDDATA;
}
- if (q->samples_per_frame != SAMPLES_PER_FRAME && q->samples_per_frame != SAMPLES_PER_FRAME*2) {
- av_log(avctx,AV_LOG_ERROR,"Unknown amount of samples per frame %d.\n",q->samples_per_frame);
+ if (samples_per_frame != SAMPLES_PER_FRAME &&
+ samples_per_frame != SAMPLES_PER_FRAME * 2) {
+ av_log(avctx, AV_LOG_ERROR, "Unknown amount of samples per frame %d.\n",
+ samples_per_frame);
return AVERROR_INVALIDDATA;
}
- if (q->delay != 0x88E) {
- av_log(avctx,AV_LOG_ERROR,"Unknown amount of delay %x != 0x88E.\n",q->delay);
+ if (delay != 0x88E) {
+ av_log(avctx, AV_LOG_ERROR, "Unknown amount of delay %x != 0x88E.\n",
+ delay);
return AVERROR_INVALIDDATA;
}
- if (q->codingMode == STEREO) {
- av_log(avctx,AV_LOG_DEBUG,"Normal stereo detected.\n");
- } else if (q->codingMode == JOINT_STEREO) {
- av_log(avctx,AV_LOG_DEBUG,"Joint stereo detected.\n");
- } else {
- av_log(avctx,AV_LOG_ERROR,"Unknown channel coding mode %x!\n",q->codingMode);
+ if (q->coding_mode == STEREO)
+ av_log(avctx, AV_LOG_DEBUG, "Normal stereo detected.\n");
+ else if (q->coding_mode == JOINT_STEREO)
+ av_log(avctx, AV_LOG_DEBUG, "Joint stereo detected.\n");
+ else {
+ av_log(avctx, AV_LOG_ERROR, "Unknown channel coding mode %x!\n",
+ q->coding_mode);
return AVERROR_INVALIDDATA;
}
- if (avctx->channels <= 0 || avctx->channels > 2 /*|| ((avctx->channels * 1024) != q->samples_per_frame)*/) {
- av_log(avctx,AV_LOG_ERROR,"Channel configuration error!\n");
+ if (avctx->block_align >= UINT_MAX / 2)
return AVERROR(EINVAL);
- }
-
- if(avctx->block_align >= UINT_MAX/2)
- return AVERROR(EINVAL);
-
- /* Pad the data buffer with FF_INPUT_BUFFER_PADDING_SIZE,
- * this is for the bitstream reader. */
- if ((q->decoded_bytes_buffer = av_mallocz((avctx->block_align+(4-avctx->block_align%4) + FF_INPUT_BUFFER_PADDING_SIZE))) == NULL)
+ q->decoded_bytes_buffer = av_mallocz(FFALIGN(avctx->block_align, 4) +
+ FF_INPUT_BUFFER_PADDING_SIZE);
+ if (q->decoded_bytes_buffer == NULL)
return AVERROR(ENOMEM);
+ avctx->sample_fmt = AV_SAMPLE_FMT_FLTP;
- /* Initialize the VLC tables. */
- if (!vlcs_initialized) {
- for (i=0 ; i<7 ; i++) {
- spectral_coeff_tab[i].table = &atrac3_vlc_table[atrac3_vlc_offs[i]];
- spectral_coeff_tab[i].table_allocated = atrac3_vlc_offs[i + 1] - atrac3_vlc_offs[i];
- init_vlc (&spectral_coeff_tab[i], 9, huff_tab_sizes[i],
- huff_bits[i], 1, 1,
- huff_codes[i], 1, 1, INIT_VLC_USE_NEW_STATIC);
- }
- vlcs_initialized = 1;
- }
-
- if (avctx->request_sample_fmt == AV_SAMPLE_FMT_FLT)
- avctx->sample_fmt = AV_SAMPLE_FMT_FLT;
- else
- avctx->sample_fmt = AV_SAMPLE_FMT_S16;
-
- if ((ret = init_atrac3_transforms(q, avctx->sample_fmt == AV_SAMPLE_FMT_FLT))) {
+ /* initialize the MDCT transform */
+ if ((ret = ff_mdct_init(&q->mdct_ctx, 9, 1, 1.0 / 32768)) < 0) {
av_log(avctx, AV_LOG_ERROR, "Error initializing MDCT\n");
av_freep(&q->decoded_bytes_buffer);
return ret;
}
- atrac_generate_tables();
-
- /* Generate gain tables. */
- for (i=0 ; i<16 ; i++)
- gain_tab1[i] = powf (2.0, (4 - i));
-
- for (i=-15 ; i<16 ; i++)
- gain_tab2[i+15] = powf (2.0, i * -0.125);
-
/* init the joint-stereo decoding data */
q->weighting_delay[0] = 0;
q->weighting_delay[1] = 7;
@@ -1036,46 +974,38 @@ static av_cold int atrac3_decode_init(AVCodecContext *avctx)
q->weighting_delay[4] = 0;
q->weighting_delay[5] = 7;
- for (i=0; i<4; i++) {
+ for (i = 0; i < 4; i++) {
q->matrix_coeff_index_prev[i] = 3;
- q->matrix_coeff_index_now[i] = 3;
+ q->matrix_coeff_index_now[i] = 3;
q->matrix_coeff_index_next[i] = 3;
}
- dsputil_init(&dsp, avctx);
+ avpriv_float_dsp_init(&q->fdsp, avctx->flags & CODEC_FLAG_BITEXACT);
ff_fmt_convert_init(&q->fmt_conv, avctx);
- q->pUnits = av_mallocz(sizeof(channel_unit)*q->channels);
- if (!q->pUnits) {
+ q->units = av_mallocz(sizeof(*q->units) * avctx->channels);
+ if (!q->units) {
atrac3_decode_close(avctx);
return AVERROR(ENOMEM);
}
- if (avctx->channels > 1 || avctx->sample_fmt == AV_SAMPLE_FMT_S16) {
- q->outSamples[0] = av_mallocz(SAMPLES_PER_FRAME * avctx->channels * sizeof(*q->outSamples[0]));
- q->outSamples[1] = q->outSamples[0] + SAMPLES_PER_FRAME;
- if (!q->outSamples[0]) {
- atrac3_decode_close(avctx);
- return AVERROR(ENOMEM);
- }
- }
-
avcodec_get_frame_defaults(&q->frame);
avctx->coded_frame = &q->frame;
return 0;
}
-
-AVCodec ff_atrac3_decoder =
-{
- .name = "atrac3",
- .type = AVMEDIA_TYPE_AUDIO,
- .id = CODEC_ID_ATRAC3,
- .priv_data_size = sizeof(ATRAC3Context),
- .init = atrac3_decode_init,
- .close = atrac3_decode_close,
- .decode = atrac3_decode_frame,
- .capabilities = CODEC_CAP_SUBFRAMES | CODEC_CAP_DR1,
- .long_name = NULL_IF_CONFIG_SMALL("Atrac 3 (Adaptive TRansform Acoustic Coding 3)"),
+AVCodec ff_atrac3_decoder = {
+ .name = "atrac3",
+ .type = AVMEDIA_TYPE_AUDIO,
+ .id = AV_CODEC_ID_ATRAC3,
+ .priv_data_size = sizeof(ATRAC3Context),
+ .init = atrac3_decode_init,
+ .init_static_data = atrac3_init_static_data,
+ .close = atrac3_decode_close,
+ .decode = atrac3_decode_frame,
+ .capabilities = CODEC_CAP_SUBFRAMES | CODEC_CAP_DR1,
+ .long_name = NULL_IF_CONFIG_SMALL("Atrac 3 (Adaptive TRansform Acoustic Coding 3)"),
+ .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP,
+ AV_SAMPLE_FMT_NONE },
};
diff --git a/gst-libs/ext/libav/libavcodec/atrac3data.h b/gst-libs/ext/libav/libavcodec/atrac3data.h
index 9076d3a..40518ab 100644
--- a/gst-libs/ext/libav/libavcodec/atrac3data.h
+++ b/gst-libs/ext/libav/libavcodec/atrac3data.h
@@ -33,101 +33,109 @@
/* VLC tables */
static const uint8_t huffcode1[9] = {
- 0x0,0x4,0x5,0xC,0xD,0x1C,0x1D,0x1E,0x1F,
+ 0x0, 0x4, 0x5, 0xC, 0xD, 0x1C, 0x1D, 0x1E, 0x1F
};
-static const uint8_t huffbits1[9] = {
- 1,3,3,4,4,5,5,5,5,
-};
+static const uint8_t huffbits1[9] = { 1, 3, 3, 4, 4, 5, 5, 5, 5 };
-static const uint8_t huffcode2[5] = {
- 0x0,0x4,0x5,0x6,0x7,
-};
+static const uint8_t huffcode2[5] = { 0x0, 0x4, 0x5, 0x6, 0x7 };
-static const uint8_t huffbits2[5] = {
- 1,3,3,3,3,
-};
+static const uint8_t huffbits2[5] = { 1, 3, 3, 3, 3 };
-static const uint8_t huffcode3[7] = {
-0x0,0x4,0x5,0xC,0xD,0xE,0xF,
-};
+static const uint8_t huffcode3[7] = { 0x0, 0x4, 0x5, 0xC, 0xD, 0xE, 0xF };
-static const uint8_t huffbits3[7] = {
- 1,3,3,4,4,4,4,
-};
+static const uint8_t huffbits3[7] = { 1, 3, 3, 4, 4, 4, 4 };
static const uint8_t huffcode4[9] = {
- 0x0,0x4,0x5,0xC,0xD,0x1C,0x1D,0x1E,0x1F,
+ 0x0, 0x4, 0x5, 0xC, 0xD, 0x1C, 0x1D, 0x1E, 0x1F
};
-static const uint8_t huffbits4[9] = {
- 1,3,3,4,4,5,5,5,5,
-};
+static const uint8_t huffbits4[9] = { 1, 3, 3, 4, 4, 5, 5, 5, 5 };
static const uint8_t huffcode5[15] = {
- 0x0,0x2,0x3,0x8,0x9,0xA,0xB,0x1C,0x1D,0x3C,0x3D,0x3E,0x3F,0xC,0xD,
+ 0x00, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B, 0x1C,
+ 0x1D, 0x3C, 0x3D, 0x3E, 0x3F, 0x0C, 0x0D
};
static const uint8_t huffbits5[15] = {
- 2,3,3,4,4,4,4,5,5,6,6,6,6,4,4
+ 2, 3, 3, 4, 4, 4, 4, 5, 5, 6, 6, 6, 6, 4, 4
};
static const uint8_t huffcode6[31] = {
- 0x0,0x2,0x3,0x4,0x5,0x6,0x7,0x14,0x15,0x16,0x17,0x18,0x19,0x34,0x35,
- 0x36,0x37,0x38,0x39,0x3A,0x3B,0x78,0x79,0x7A,0x7B,0x7C,0x7D,0x7E,0x7F,0x8,0x9,
+ 0x00, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x14,
+ 0x15, 0x16, 0x17, 0x18, 0x19, 0x34, 0x35, 0x36,
+ 0x37, 0x38, 0x39, 0x3A, 0x3B, 0x78, 0x79, 0x7A,
+ 0x7B, 0x7C, 0x7D, 0x7E, 0x7F, 0x08, 0x09
};
static const uint8_t huffbits6[31] = {
- 3,4,4,4,4,4,4,5,5,5,5,5,5,6,6,6,6,6,6,6,6,7,7,7,7,7,7,7,7,4,4
+ 3, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 6, 6, 6,
+ 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 4, 4
};
static const uint8_t huffcode7[63] = {
- 0x0,0x8,0x9,0xA,0xB,0xC,0xD,0xE,0xF,0x10,0x11,0x24,0x25,0x26,0x27,0x28,
- 0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F,0x30,0x31,0x32,0x33,0x68,0x69,0x6A,0x6B,0x6C,
- 0x6D,0x6E,0x6F,0x70,0x71,0x72,0x73,0x74,0x75,0xEC,0xED,0xEE,0xEF,0xF0,0xF1,0xF2,
- 0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF,0x2,0x3,
+ 0x00, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E,
+ 0x0F, 0x10, 0x11, 0x24, 0x25, 0x26, 0x27, 0x28,
+ 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F, 0x30,
+ 0x31, 0x32, 0x33, 0x68, 0x69, 0x6A, 0x6B, 0x6C,
+ 0x6D, 0x6E, 0x6F, 0x70, 0x71, 0x72, 0x73, 0x74,
+ 0x75, 0xEC, 0xED, 0xEE, 0xEF, 0xF0, 0xF1, 0xF2,
+ 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, 0xF8, 0xF9, 0xFA,
+ 0xFB, 0xFC, 0xFD, 0xFE, 0xFF, 0x02, 0x03
};
static const uint8_t huffbits7[63] = {
- 3,5,5,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,4,4
+ 3, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6,
+ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7,
+ 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8,
+ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 4, 4
};
static const uint8_t huff_tab_sizes[7] = {
- 9, 5, 7, 9, 15, 31, 63,
+ 9, 5, 7, 9, 15, 31, 63,
};
static const uint8_t* const huff_codes[7] = {
- huffcode1,huffcode2,huffcode3,huffcode4,huffcode5,huffcode6,huffcode7,
+ huffcode1, huffcode2, huffcode3, huffcode4, huffcode5, huffcode6, huffcode7
};
static const uint8_t* const huff_bits[7] = {
- huffbits1,huffbits2,huffbits3,huffbits4,huffbits5,huffbits6,huffbits7,
+ huffbits1, huffbits2, huffbits3, huffbits4, huffbits5, huffbits6, huffbits7,
};
-static const uint16_t atrac3_vlc_offs[] = {
- 0,512,1024,1536,2048,2560,3072,3584,4096
+static const uint16_t atrac3_vlc_offs[9] = {
+ 0, 512, 1024, 1536, 2048, 2560, 3072, 3584, 4096
};
/* selector tables */
-static const uint8_t CLCLengthTab[8] = {0, 4, 3, 3, 4, 4, 5, 6};
-static const int8_t seTab_0[4] = {0, 1, -2, -1};
-static const int8_t decTable1[18] = {0,0, 0,1, 0,-1, 1,0, -1,0, 1,1, 1,-1, -1,1, -1,-1};
+static const uint8_t clc_length_tab[8] = { 0, 4, 3, 3, 4, 4, 5, 6 };
+
+static const int8_t mantissa_clc_tab[4] = { 0, 1, -2, -1 };
+
+static const int8_t mantissa_vlc_tab[18] = {
+ 0, 0, 0, 1, 0, -1, 1, 0, -1, 0, 1, 1, 1, -1, -1, 1, -1, -1
+};
/* tables for the scalefactor decoding */
-static const float iMaxQuant[8] = {
- 0.0, 1.0/1.5, 1.0/2.5, 1.0/3.5, 1.0/4.5, 1.0/7.5, 1.0/15.5, 1.0/31.5
+static const float inv_max_quant[8] = {
+ 0.0, 1.0 / 1.5, 1.0 / 2.5, 1.0 / 3.5,
+ 1.0 / 4.5, 1.0 / 7.5, 1.0 / 15.5, 1.0 / 31.5
};
-static const uint16_t subbandTab[33] = {
- 0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160, 176, 192, 224,
- 256, 288, 320, 352, 384, 416, 448, 480, 512, 576, 640, 704, 768, 896, 1024
+static const uint16_t subband_tab[33] = {
+ 0, 8, 16, 24, 32, 40, 48, 56,
+ 64, 80, 96, 112, 128, 144, 160, 176,
+ 192, 224, 256, 288, 320, 352, 384, 416,
+ 448, 480, 512, 576, 640, 704, 768, 896,
+ 1024
};
/* joint stereo related tables */
-static const float matrixCoeffs[8] = {0.0, 2.0, 2.0, 2.0, 0.0, 0.0, 1.0, 1.0};
+static const float matrix_coeffs[8] = {
+ 0.0, 2.0, 2.0, 2.0, 0.0, 0.0, 1.0, 1.0
+};
#endif /* AVCODEC_ATRAC3DATA_H */
diff --git a/gst-libs/ext/libav/libavcodec/audio_frame_queue.c b/gst-libs/ext/libav/libavcodec/audio_frame_queue.c
new file mode 100644
index 0000000..80f3100
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/audio_frame_queue.c
@@ -0,0 +1,163 @@
+/*
+ * Audio Frame Queue
+ * Copyright (c) 2012 Justin Ruggles
+ *
+ * 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
+ */
+
+#include "libavutil/common.h"
+#include "libavutil/mathematics.h"
+#include "internal.h"
+#include "audio_frame_queue.h"
+
+void ff_af_queue_init(AVCodecContext *avctx, AudioFrameQueue *afq)
+{
+ afq->avctx = avctx;
+ afq->next_pts = AV_NOPTS_VALUE;
+ afq->remaining_delay = avctx->delay;
+ afq->remaining_samples = avctx->delay;
+ afq->frame_queue = NULL;
+}
+
+static void delete_next_frame(AudioFrameQueue *afq)
+{
+ AudioFrame *f = afq->frame_queue;
+ if (f) {
+ afq->frame_queue = f->next;
+ f->next = NULL;
+ av_freep(&f);
+ }
+}
+
+void ff_af_queue_close(AudioFrameQueue *afq)
+{
+ /* remove/free any remaining frames */
+ while (afq->frame_queue)
+ delete_next_frame(afq);
+ memset(afq, 0, sizeof(*afq));
+}
+
+#ifdef DEBUG
+static void af_queue_log_state(AudioFrameQueue *afq)
+{
+ AudioFrame *f;
+ av_dlog(afq->avctx, "remaining delay = %d\n", afq->remaining_delay);
+ av_dlog(afq->avctx, "remaining samples = %d\n", afq->remaining_samples);
+ av_dlog(afq->avctx, "frames:\n");
+ f = afq->frame_queue;
+ while (f) {
+ av_dlog(afq->avctx, " [ pts=%9"PRId64" duration=%d ]\n",
+ f->pts, f->duration);
+ f = f->next;
+ }
+}
+#endif /* DEBUG */
+
+int ff_af_queue_add(AudioFrameQueue *afq, const AVFrame *f)
+{
+ AudioFrame *new_frame;
+ AudioFrame *queue_end = afq->frame_queue;
+
+ /* find the end of the queue */
+ while (queue_end && queue_end->next)
+ queue_end = queue_end->next;
+
+ /* allocate new frame queue entry */
+ if (!(new_frame = av_malloc(sizeof(*new_frame))))
+ return AVERROR(ENOMEM);
+
+ /* get frame parameters */
+ new_frame->next = NULL;
+ new_frame->duration = f->nb_samples;
+ if (f->pts != AV_NOPTS_VALUE) {
+ new_frame->pts = av_rescale_q(f->pts,
+ afq->avctx->time_base,
+ (AVRational){ 1, afq->avctx->sample_rate });
+ afq->next_pts = new_frame->pts + new_frame->duration;
+ } else {
+ new_frame->pts = AV_NOPTS_VALUE;
+ afq->next_pts = AV_NOPTS_VALUE;
+ }
+
+ /* add new frame to the end of the queue */
+ if (!queue_end)
+ afq->frame_queue = new_frame;
+ else
+ queue_end->next = new_frame;
+
+ /* add frame sample count */
+ afq->remaining_samples += f->nb_samples;
+
+#ifdef DEBUG
+ af_queue_log_state(afq);
+#endif
+
+ return 0;
+}
+
+void ff_af_queue_remove(AudioFrameQueue *afq, int nb_samples, int64_t *pts,
+ int *duration)
+{
+ int64_t out_pts = AV_NOPTS_VALUE;
+ int removed_samples = 0;
+
+#ifdef DEBUG
+ af_queue_log_state(afq);
+#endif
+
+ /* get output pts from the next frame or generated pts */
+ if (afq->frame_queue) {
+ if (afq->frame_queue->pts != AV_NOPTS_VALUE)
+ out_pts = afq->frame_queue->pts - afq->remaining_delay;
+ } else {
+ if (afq->next_pts != AV_NOPTS_VALUE)
+ out_pts = afq->next_pts - afq->remaining_delay;
+ }
+ if (pts) {
+ if (out_pts != AV_NOPTS_VALUE)
+ *pts = ff_samples_to_time_base(afq->avctx, out_pts);
+ else
+ *pts = AV_NOPTS_VALUE;
+ }
+
+ /* if the delay is larger than the packet duration, we use up delay samples
+ for the output packet and leave all frames in the queue */
+ if (afq->remaining_delay >= nb_samples) {
+ removed_samples += nb_samples;
+ afq->remaining_delay -= nb_samples;
+ }
+ /* remove frames from the queue until we have enough to cover the
+ requested number of samples or until the queue is empty */
+ while (removed_samples < nb_samples && afq->frame_queue) {
+ removed_samples += afq->frame_queue->duration;
+ delete_next_frame(afq);
+ }
+ afq->remaining_samples -= removed_samples;
+
+ /* if there are no frames left and we have room for more samples, use
+ any remaining delay samples */
+ if (removed_samples < nb_samples && afq->remaining_samples > 0) {
+ int add_samples = FFMIN(afq->remaining_samples,
+ nb_samples - removed_samples);
+ removed_samples += add_samples;
+ afq->remaining_samples -= add_samples;
+ }
+ if (removed_samples > nb_samples)
+ av_log(afq->avctx, AV_LOG_WARNING, "frame_size is too large\n");
+ if (duration)
+ *duration = ff_samples_to_time_base(afq->avctx, removed_samples);
+}
diff --git a/gst-libs/ext/libav/libavcodec/audio_frame_queue.h b/gst-libs/ext/libav/libavcodec/audio_frame_queue.h
new file mode 100644
index 0000000..4a29770
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/audio_frame_queue.h
@@ -0,0 +1,83 @@
+/*
+ * Audio Frame Queue
+ * Copyright (c) 2012 Justin Ruggles
+ *
+ * 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
+ */
+
+#ifndef AVCODEC_AUDIO_FRAME_QUEUE_H
+#define AVCODEC_AUDIO_FRAME_QUEUE_H
+
+#include "avcodec.h"
+
+typedef struct AudioFrame {
+ int64_t pts;
+ int duration;
+ struct AudioFrame *next;
+} AudioFrame;
+
+typedef struct AudioFrameQueue {
+ AVCodecContext *avctx;
+ int64_t next_pts;
+ int remaining_delay;
+ int remaining_samples;
+ AudioFrame *frame_queue;
+} AudioFrameQueue;
+
+/**
+ * Initialize AudioFrameQueue.
+ *
+ * @param avctx context to use for time_base and av_log
+ * @param afq queue context
+ */
+void ff_af_queue_init(AVCodecContext *avctx, AudioFrameQueue *afq);
+
+/**
+ * Close AudioFrameQueue.
+ *
+ * Frees memory if needed.
+ *
+ * @param afq queue context
+ */
+void ff_af_queue_close(AudioFrameQueue *afq);
+
+/**
+ * Add a frame to the queue.
+ *
+ * @param afq queue context
+ * @param f frame to add to the queue
+ */
+int ff_af_queue_add(AudioFrameQueue *afq, const AVFrame *f);
+
+/**
+ * Remove frame(s) from the queue.
+ *
+ * Retrieves the pts of the next available frame, or a generated pts based on
+ * the last frame duration if there are no frames left in the queue. The number
+ * of requested samples should be the full number of samples represented by the
+ * packet that will be output by the encoder. If fewer samples are available
+ * in the queue, a smaller value will be used for the output duration.
+ *
+ * @param afq queue context
+ * @param nb_samples number of samples to remove from the queue
+ * @param[out] pts output packet pts
+ * @param[out] duration output packet duration
+ */
+void ff_af_queue_remove(AudioFrameQueue *afq, int nb_samples, int64_t *pts,
+ int *duration);
+
+#endif /* AVCODEC_AUDIO_FRAME_QUEUE_H */
diff --git a/gst-libs/ext/libav/libavcodec/audioconvert.c b/gst-libs/ext/libav/libavcodec/audioconvert.c
index a244345..3714de7 100644
--- a/gst-libs/ext/libav/libavcodec/audioconvert.c
+++ b/gst-libs/ext/libav/libavcodec/audioconvert.c
@@ -26,59 +26,12 @@
*/
#include "libavutil/avstring.h"
+#include "libavutil/common.h"
#include "libavutil/libm.h"
#include "libavutil/samplefmt.h"
#include "avcodec.h"
#include "audioconvert.h"
-#if FF_API_OLD_SAMPLE_FMT
-const char *avcodec_get_sample_fmt_name(int sample_fmt)
-{
- return av_get_sample_fmt_name(sample_fmt);
-}
-
-enum AVSampleFormat avcodec_get_sample_fmt(const char* name)
-{
- return av_get_sample_fmt(name);
-}
-
-void avcodec_sample_fmt_string (char *buf, int buf_size, int sample_fmt)
-{
- av_get_sample_fmt_string(buf, buf_size, sample_fmt);
-}
-#endif
-
-uint64_t avcodec_guess_channel_layout(int nb_channels, enum CodecID codec_id, const char *fmt_name)
-{
- switch(nb_channels) {
- case 1: return AV_CH_LAYOUT_MONO;
- case 2: return AV_CH_LAYOUT_STEREO;
- case 3: return AV_CH_LAYOUT_SURROUND;
- case 4: return AV_CH_LAYOUT_QUAD;
- case 5: return AV_CH_LAYOUT_5POINT0;
- case 6: return AV_CH_LAYOUT_5POINT1;
- case 8: return AV_CH_LAYOUT_7POINT1;
- default: return 0;
- }
-}
-
-#if FF_API_OLD_AUDIOCONVERT
-int64_t avcodec_get_channel_layout(const char *name)
-{
- return av_get_channel_layout(name);
-}
-
-void avcodec_get_channel_layout_string(char *buf, int buf_size, int nb_channels, int64_t channel_layout)
-{
- av_get_channel_layout_string(buf, buf_size, nb_channels, channel_layout);
-}
-
-int avcodec_channel_layout_num_channels(int64_t channel_layout)
-{
- return av_get_channel_layout_nb_channels(channel_layout);
-}
-#endif
-
struct AVAudioConvert {
int in_channels, out_channels;
int fmt_pair;
diff --git a/gst-libs/ext/libav/libavcodec/audioconvert.h b/gst-libs/ext/libav/libavcodec/audioconvert.h
index f50eb3e..7d76fd6 100644
--- a/gst-libs/ext/libav/libavcodec/audioconvert.h
+++ b/gst-libs/ext/libav/libavcodec/audioconvert.h
@@ -31,56 +31,7 @@
#include "libavutil/cpu.h"
#include "avcodec.h"
-#include "libavutil/audioconvert.h"
-
-#if FF_API_OLD_SAMPLE_FMT
-/**
- * @deprecated Use av_get_sample_fmt_string() instead.
- */
-attribute_deprecated
-void avcodec_sample_fmt_string(char *buf, int buf_size, int sample_fmt);
-
-/**
- * @deprecated Use av_get_sample_fmt_name() instead.
- */
-attribute_deprecated
-const char *avcodec_get_sample_fmt_name(int sample_fmt);
-
-/**
- * @deprecated Use av_get_sample_fmt() instead.
- */
-attribute_deprecated
-enum AVSampleFormat avcodec_get_sample_fmt(const char* name);
-#endif
-
-#if FF_API_OLD_AUDIOCONVERT
-/**
- * @deprecated Use av_get_channel_layout() instead.
- */
-attribute_deprecated
-int64_t avcodec_get_channel_layout(const char *name);
-
-/**
- * @deprecated Use av_get_channel_layout_string() instead.
- */
-attribute_deprecated
-void avcodec_get_channel_layout_string(char *buf, int buf_size, int nb_channels, int64_t channel_layout);
-
-/**
- * @deprecated Use av_get_channel_layout_nb_channels() instead.
- */
-attribute_deprecated
-int avcodec_channel_layout_num_channels(int64_t channel_layout);
-#endif
-
-/**
- * Guess the channel layout
- * @param nb_channels
- * @param codec_id Codec identifier, or CODEC_ID_NONE if unknown
- * @param fmt_name Format name, or NULL if unknown
- * @return Channel layout mask
- */
-uint64_t avcodec_guess_channel_layout(int nb_channels, enum CodecID codec_id, const char *fmt_name);
+#include "libavutil/channel_layout.h"
struct AVAudioConvert;
typedef struct AVAudioConvert AVAudioConvert;
diff --git a/gst-libs/ext/libav/libavcodec/aura.c b/gst-libs/ext/libav/libavcodec/aura.c
index f1fdb5c..4960bf8 100644
--- a/gst-libs/ext/libav/libavcodec/aura.c
+++ b/gst-libs/ext/libav/libavcodec/aura.c
@@ -24,6 +24,8 @@
*/
#include "avcodec.h"
+#include "internal.h"
+#include "libavutil/internal.h"
typedef struct AuraDecodeContext {
AVCodecContext *avctx;
@@ -38,17 +40,16 @@ static av_cold int aura_decode_init(AVCodecContext *avctx)
/* width needs to be divisible by 4 for this codec to work */
if (avctx->width & 0x3)
return -1;
- avctx->pix_fmt = PIX_FMT_YUV422P;
+ avctx->pix_fmt = AV_PIX_FMT_YUV422P;
return 0;
}
static int aura_decode_frame(AVCodecContext *avctx,
- void *data, int *data_size,
+ void *data, int *got_frame,
AVPacket *pkt)
{
- AuraDecodeContext *s=avctx->priv_data;
-
+ AuraDecodeContext *s = avctx->priv_data;
uint8_t *Y, *U, *V;
uint8_t val;
int x, y;
@@ -66,12 +67,12 @@ static int aura_decode_frame(AVCodecContext *avctx,
/* pixel data starts 48 bytes in, after 3x16-byte tables */
buf += 48;
- if(s->frame.data[0])
+ if (s->frame.data[0])
avctx->release_buffer(avctx, &s->frame);
s->frame.buffer_hints = FF_BUFFER_HINTS_VALID;
s->frame.reference = 0;
- if(avctx->get_buffer(avctx, &s->frame) < 0) {
+ if (ff_get_buffer(avctx, &s->frame) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return -1;
}
@@ -83,31 +84,31 @@ static int aura_decode_frame(AVCodecContext *avctx,
/* iterate through each line in the height */
for (y = 0; y < avctx->height; y++) {
/* reset predictors */
- val = *buf++;
+ val = *buf++;
U[0] = val & 0xF0;
Y[0] = val << 4;
- val = *buf++;
+ val = *buf++;
V[0] = val & 0xF0;
Y[1] = Y[0] + delta_table[val & 0xF];
- Y += 2; U++; V++;
+ Y += 2; U++; V++;
/* iterate through the remaining pixel groups (4 pixels/group) */
for (x = 1; x < (avctx->width >> 1); x++) {
- val = *buf++;
+ val = *buf++;
U[0] = U[-1] + delta_table[val >> 4];
Y[0] = Y[-1] + delta_table[val & 0xF];
- val = *buf++;
+ val = *buf++;
V[0] = V[-1] + delta_table[val >> 4];
Y[1] = Y[ 0] + delta_table[val & 0xF];
- Y += 2; U++; V++;
+ Y += 2; U++; V++;
}
Y += s->frame.linesize[0] - avctx->width;
U += s->frame.linesize[1] - (avctx->width >> 1);
V += s->frame.linesize[2] - (avctx->width >> 1);
}
- *data_size=sizeof(AVFrame);
- *(AVFrame*)data= s->frame;
+ *got_frame = 1;
+ *(AVFrame*)data = s->frame;
return pkt->size;
}
@@ -125,12 +126,11 @@ static av_cold int aura_decode_end(AVCodecContext *avctx)
AVCodec ff_aura2_decoder = {
.name = "aura2",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_AURA2,
+ .id = AV_CODEC_ID_AURA2,
.priv_data_size = sizeof(AuraDecodeContext),
.init = aura_decode_init,
.close = aura_decode_end,
.decode = aura_decode_frame,
.capabilities = CODEC_CAP_DR1,
- .long_name = NULL_IF_CONFIG_SMALL("Auravision Aura 2"),
+ .long_name = NULL_IF_CONFIG_SMALL("Auravision Aura 2"),
};
-
diff --git a/gst-libs/ext/libav/libavcodec/avcodec.h b/gst-libs/ext/libav/libavcodec/avcodec.h
index 2451294..e6b8ec6 100644
--- a/gst-libs/ext/libav/libavcodec/avcodec.h
+++ b/gst-libs/ext/libav/libavcodec/avcodec.h
@@ -67,6 +67,15 @@
*
*/
+/**
+ * @defgroup lavc_core Core functions/structures.
+ * @ingroup libavc
+ *
+ * Basic definitions, functions for querying libavcodec capabilities,
+ * allocating core structures, etc.
+ * @{
+ */
+
/**
* Identify the syntax and semantics of the bitstream.
@@ -79,415 +88,407 @@
* If you add a codec ID to this list, add it so that
* 1. no value of a existing codec ID changes (that would break ABI),
* 2. it is as close as possible to similar codecs.
+ *
+ * After adding new codec IDs, do not forget to add an entry to the codec
+ * descriptor list and bump libavcodec minor version.
*/
-enum CodecID {
- CODEC_ID_NONE,
+enum AVCodecID {
+ AV_CODEC_ID_NONE,
/* video codecs */
- CODEC_ID_MPEG1VIDEO,
- CODEC_ID_MPEG2VIDEO, ///< preferred ID for MPEG-1/2 video decoding
- CODEC_ID_MPEG2VIDEO_XVMC,
- CODEC_ID_H261,
- CODEC_ID_H263,
- CODEC_ID_RV10,
- CODEC_ID_RV20,
- CODEC_ID_MJPEG,
- CODEC_ID_MJPEGB,
- CODEC_ID_LJPEG,
- CODEC_ID_SP5X,
- CODEC_ID_JPEGLS,
- CODEC_ID_MPEG4,
- CODEC_ID_RAWVIDEO,
- CODEC_ID_MSMPEG4V1,
- CODEC_ID_MSMPEG4V2,
- CODEC_ID_MSMPEG4V3,
- CODEC_ID_WMV1,
- CODEC_ID_WMV2,
- CODEC_ID_H263P,
- CODEC_ID_H263I,
- CODEC_ID_FLV1,
- CODEC_ID_SVQ1,
- CODEC_ID_SVQ3,
- CODEC_ID_DVVIDEO,
- CODEC_ID_HUFFYUV,
- CODEC_ID_CYUV,
- CODEC_ID_H264,
- CODEC_ID_INDEO3,
- CODEC_ID_VP3,
- CODEC_ID_THEORA,
- CODEC_ID_ASV1,
- CODEC_ID_ASV2,
- CODEC_ID_FFV1,
- CODEC_ID_4XM,
- CODEC_ID_VCR1,
- CODEC_ID_CLJR,
- CODEC_ID_MDEC,
- CODEC_ID_ROQ,
- CODEC_ID_INTERPLAY_VIDEO,
- CODEC_ID_XAN_WC3,
- CODEC_ID_XAN_WC4,
- CODEC_ID_RPZA,
- CODEC_ID_CINEPAK,
- CODEC_ID_WS_VQA,
- CODEC_ID_MSRLE,
- CODEC_ID_MSVIDEO1,
- CODEC_ID_IDCIN,
- CODEC_ID_8BPS,
- CODEC_ID_SMC,
- CODEC_ID_FLIC,
- CODEC_ID_TRUEMOTION1,
- CODEC_ID_VMDVIDEO,
- CODEC_ID_MSZH,
- CODEC_ID_ZLIB,
- CODEC_ID_QTRLE,
- CODEC_ID_SNOW,
- CODEC_ID_TSCC,
- CODEC_ID_ULTI,
- CODEC_ID_QDRAW,
- CODEC_ID_VIXL,
- CODEC_ID_QPEG,
- CODEC_ID_PNG,
- CODEC_ID_PPM,
- CODEC_ID_PBM,
- CODEC_ID_PGM,
- CODEC_ID_PGMYUV,
- CODEC_ID_PAM,
- CODEC_ID_FFVHUFF,
- CODEC_ID_RV30,
- CODEC_ID_RV40,
- CODEC_ID_VC1,
- CODEC_ID_WMV3,
- CODEC_ID_LOCO,
- CODEC_ID_WNV1,
- CODEC_ID_AASC,
- CODEC_ID_INDEO2,
- CODEC_ID_FRAPS,
- CODEC_ID_TRUEMOTION2,
- CODEC_ID_BMP,
- CODEC_ID_CSCD,
- CODEC_ID_MMVIDEO,
- CODEC_ID_ZMBV,
- CODEC_ID_AVS,
- CODEC_ID_SMACKVIDEO,
- CODEC_ID_NUV,
- CODEC_ID_KMVC,
- CODEC_ID_FLASHSV,
- CODEC_ID_CAVS,
- CODEC_ID_JPEG2000,
- CODEC_ID_VMNC,
- CODEC_ID_VP5,
- CODEC_ID_VP6,
- CODEC_ID_VP6F,
- CODEC_ID_TARGA,
- CODEC_ID_DSICINVIDEO,
- CODEC_ID_TIERTEXSEQVIDEO,
- CODEC_ID_TIFF,
- CODEC_ID_GIF,
-#if LIBAVCODEC_VERSION_MAJOR == 53
- CODEC_ID_FFH264,
-#endif
- CODEC_ID_DXA,
- CODEC_ID_DNXHD,
- CODEC_ID_THP,
- CODEC_ID_SGI,
- CODEC_ID_C93,
- CODEC_ID_BETHSOFTVID,
- CODEC_ID_PTX,
- CODEC_ID_TXD,
- CODEC_ID_VP6A,
- CODEC_ID_AMV,
- CODEC_ID_VB,
- CODEC_ID_PCX,
- CODEC_ID_SUNRAST,
- CODEC_ID_INDEO4,
- CODEC_ID_INDEO5,
- CODEC_ID_MIMIC,
- CODEC_ID_RL2,
-#if LIBAVCODEC_VERSION_MAJOR == 53
- CODEC_ID_8SVX_EXP,
- CODEC_ID_8SVX_FIB,
-#endif
- CODEC_ID_ESCAPE124,
- CODEC_ID_DIRAC,
- CODEC_ID_BFI,
- CODEC_ID_CMV,
- CODEC_ID_MOTIONPIXELS,
- CODEC_ID_TGV,
- CODEC_ID_TGQ,
- CODEC_ID_TQI,
- CODEC_ID_AURA,
- CODEC_ID_AURA2,
- CODEC_ID_V210X,
- CODEC_ID_TMV,
- CODEC_ID_V210,
- CODEC_ID_DPX,
- CODEC_ID_MAD,
- CODEC_ID_FRWU,
- CODEC_ID_FLASHSV2,
- CODEC_ID_CDGRAPHICS,
- CODEC_ID_R210,
- CODEC_ID_ANM,
- CODEC_ID_BINKVIDEO,
- CODEC_ID_IFF_ILBM,
- CODEC_ID_IFF_BYTERUN1,
- CODEC_ID_KGV1,
- CODEC_ID_YOP,
- CODEC_ID_VP8,
- CODEC_ID_PICTOR,
- CODEC_ID_ANSI,
- CODEC_ID_A64_MULTI,
- CODEC_ID_A64_MULTI5,
- CODEC_ID_R10K,
- CODEC_ID_MXPEG,
- CODEC_ID_LAGARITH,
- CODEC_ID_PRORES,
- CODEC_ID_JV,
- CODEC_ID_DFA,
- CODEC_ID_WMV3IMAGE,
- CODEC_ID_VC1IMAGE,
-#if LIBAVCODEC_VERSION_MAJOR == 53
- CODEC_ID_G723_1,
- CODEC_ID_G729,
-#endif
- CODEC_ID_UTVIDEO,
- CODEC_ID_BMV_VIDEO,
- CODEC_ID_VBLE,
- CODEC_ID_DXTORY,
- CODEC_ID_V410,
+ AV_CODEC_ID_MPEG1VIDEO,
+ AV_CODEC_ID_MPEG2VIDEO, ///< preferred ID for MPEG-1/2 video decoding
+ AV_CODEC_ID_MPEG2VIDEO_XVMC,
+ AV_CODEC_ID_H261,
+ AV_CODEC_ID_H263,
+ AV_CODEC_ID_RV10,
+ AV_CODEC_ID_RV20,
+ AV_CODEC_ID_MJPEG,
+ AV_CODEC_ID_MJPEGB,
+ AV_CODEC_ID_LJPEG,
+ AV_CODEC_ID_SP5X,
+ AV_CODEC_ID_JPEGLS,
+ AV_CODEC_ID_MPEG4,
+ AV_CODEC_ID_RAWVIDEO,
+ AV_CODEC_ID_MSMPEG4V1,
+ AV_CODEC_ID_MSMPEG4V2,
+ AV_CODEC_ID_MSMPEG4V3,
+ AV_CODEC_ID_WMV1,
+ AV_CODEC_ID_WMV2,
+ AV_CODEC_ID_H263P,
+ AV_CODEC_ID_H263I,
+ AV_CODEC_ID_FLV1,
+ AV_CODEC_ID_SVQ1,
+ AV_CODEC_ID_SVQ3,
+ AV_CODEC_ID_DVVIDEO,
+ AV_CODEC_ID_HUFFYUV,
+ AV_CODEC_ID_CYUV,
+ AV_CODEC_ID_H264,
+ AV_CODEC_ID_INDEO3,
+ AV_CODEC_ID_VP3,
+ AV_CODEC_ID_THEORA,
+ AV_CODEC_ID_ASV1,
+ AV_CODEC_ID_ASV2,
+ AV_CODEC_ID_FFV1,
+ AV_CODEC_ID_4XM,
+ AV_CODEC_ID_VCR1,
+ AV_CODEC_ID_CLJR,
+ AV_CODEC_ID_MDEC,
+ AV_CODEC_ID_ROQ,
+ AV_CODEC_ID_INTERPLAY_VIDEO,
+ AV_CODEC_ID_XAN_WC3,
+ AV_CODEC_ID_XAN_WC4,
+ AV_CODEC_ID_RPZA,
+ AV_CODEC_ID_CINEPAK,
+ AV_CODEC_ID_WS_VQA,
+ AV_CODEC_ID_MSRLE,
+ AV_CODEC_ID_MSVIDEO1,
+ AV_CODEC_ID_IDCIN,
+ AV_CODEC_ID_8BPS,
+ AV_CODEC_ID_SMC,
+ AV_CODEC_ID_FLIC,
+ AV_CODEC_ID_TRUEMOTION1,
+ AV_CODEC_ID_VMDVIDEO,
+ AV_CODEC_ID_MSZH,
+ AV_CODEC_ID_ZLIB,
+ AV_CODEC_ID_QTRLE,
+ AV_CODEC_ID_SNOW,
+ AV_CODEC_ID_TSCC,
+ AV_CODEC_ID_ULTI,
+ AV_CODEC_ID_QDRAW,
+ AV_CODEC_ID_VIXL,
+ AV_CODEC_ID_QPEG,
+ AV_CODEC_ID_PNG,
+ AV_CODEC_ID_PPM,
+ AV_CODEC_ID_PBM,
+ AV_CODEC_ID_PGM,
+ AV_CODEC_ID_PGMYUV,
+ AV_CODEC_ID_PAM,
+ AV_CODEC_ID_FFVHUFF,
+ AV_CODEC_ID_RV30,
+ AV_CODEC_ID_RV40,
+ AV_CODEC_ID_VC1,
+ AV_CODEC_ID_WMV3,
+ AV_CODEC_ID_LOCO,
+ AV_CODEC_ID_WNV1,
+ AV_CODEC_ID_AASC,
+ AV_CODEC_ID_INDEO2,
+ AV_CODEC_ID_FRAPS,
+ AV_CODEC_ID_TRUEMOTION2,
+ AV_CODEC_ID_BMP,
+ AV_CODEC_ID_CSCD,
+ AV_CODEC_ID_MMVIDEO,
+ AV_CODEC_ID_ZMBV,
+ AV_CODEC_ID_AVS,
+ AV_CODEC_ID_SMACKVIDEO,
+ AV_CODEC_ID_NUV,
+ AV_CODEC_ID_KMVC,
+ AV_CODEC_ID_FLASHSV,
+ AV_CODEC_ID_CAVS,
+ AV_CODEC_ID_JPEG2000,
+ AV_CODEC_ID_VMNC,
+ AV_CODEC_ID_VP5,
+ AV_CODEC_ID_VP6,
+ AV_CODEC_ID_VP6F,
+ AV_CODEC_ID_TARGA,
+ AV_CODEC_ID_DSICINVIDEO,
+ AV_CODEC_ID_TIERTEXSEQVIDEO,
+ AV_CODEC_ID_TIFF,
+ AV_CODEC_ID_GIF,
+ AV_CODEC_ID_DXA,
+ AV_CODEC_ID_DNXHD,
+ AV_CODEC_ID_THP,
+ AV_CODEC_ID_SGI,
+ AV_CODEC_ID_C93,
+ AV_CODEC_ID_BETHSOFTVID,
+ AV_CODEC_ID_PTX,
+ AV_CODEC_ID_TXD,
+ AV_CODEC_ID_VP6A,
+ AV_CODEC_ID_AMV,
+ AV_CODEC_ID_VB,
+ AV_CODEC_ID_PCX,
+ AV_CODEC_ID_SUNRAST,
+ AV_CODEC_ID_INDEO4,
+ AV_CODEC_ID_INDEO5,
+ AV_CODEC_ID_MIMIC,
+ AV_CODEC_ID_RL2,
+ AV_CODEC_ID_ESCAPE124,
+ AV_CODEC_ID_DIRAC,
+ AV_CODEC_ID_BFI,
+ AV_CODEC_ID_CMV,
+ AV_CODEC_ID_MOTIONPIXELS,
+ AV_CODEC_ID_TGV,
+ AV_CODEC_ID_TGQ,
+ AV_CODEC_ID_TQI,
+ AV_CODEC_ID_AURA,
+ AV_CODEC_ID_AURA2,
+ AV_CODEC_ID_V210X,
+ AV_CODEC_ID_TMV,
+ AV_CODEC_ID_V210,
+ AV_CODEC_ID_DPX,
+ AV_CODEC_ID_MAD,
+ AV_CODEC_ID_FRWU,
+ AV_CODEC_ID_FLASHSV2,
+ AV_CODEC_ID_CDGRAPHICS,
+ AV_CODEC_ID_R210,
+ AV_CODEC_ID_ANM,
+ AV_CODEC_ID_BINKVIDEO,
+ AV_CODEC_ID_IFF_ILBM,
+ AV_CODEC_ID_IFF_BYTERUN1,
+ AV_CODEC_ID_KGV1,
+ AV_CODEC_ID_YOP,
+ AV_CODEC_ID_VP8,
+ AV_CODEC_ID_PICTOR,
+ AV_CODEC_ID_ANSI,
+ AV_CODEC_ID_A64_MULTI,
+ AV_CODEC_ID_A64_MULTI5,
+ AV_CODEC_ID_R10K,
+ AV_CODEC_ID_MXPEG,
+ AV_CODEC_ID_LAGARITH,
+ AV_CODEC_ID_PRORES,
+ AV_CODEC_ID_JV,
+ AV_CODEC_ID_DFA,
+ AV_CODEC_ID_WMV3IMAGE,
+ AV_CODEC_ID_VC1IMAGE,
+ AV_CODEC_ID_UTVIDEO,
+ AV_CODEC_ID_BMV_VIDEO,
+ AV_CODEC_ID_VBLE,
+ AV_CODEC_ID_DXTORY,
+ AV_CODEC_ID_V410,
+ AV_CODEC_ID_XWD,
+ AV_CODEC_ID_CDXL,
+ AV_CODEC_ID_XBM,
+ AV_CODEC_ID_ZEROCODEC,
+ AV_CODEC_ID_MSS1,
+ AV_CODEC_ID_MSA1,
+ AV_CODEC_ID_TSCC2,
+ AV_CODEC_ID_MTS2,
+ AV_CODEC_ID_CLLC,
+ AV_CODEC_ID_MSS2,
/* various PCM "codecs" */
- CODEC_ID_FIRST_AUDIO = 0x10000, ///< A dummy id pointing at the start of audio codecs
- CODEC_ID_PCM_S16LE = 0x10000,
- CODEC_ID_PCM_S16BE,
- CODEC_ID_PCM_U16LE,
- CODEC_ID_PCM_U16BE,
- CODEC_ID_PCM_S8,
- CODEC_ID_PCM_U8,
- CODEC_ID_PCM_MULAW,
- CODEC_ID_PCM_ALAW,
- CODEC_ID_PCM_S32LE,
- CODEC_ID_PCM_S32BE,
- CODEC_ID_PCM_U32LE,
- CODEC_ID_PCM_U32BE,
- CODEC_ID_PCM_S24LE,
- CODEC_ID_PCM_S24BE,
- CODEC_ID_PCM_U24LE,
- CODEC_ID_PCM_U24BE,
- CODEC_ID_PCM_S24DAUD,
- CODEC_ID_PCM_ZORK,
- CODEC_ID_PCM_S16LE_PLANAR,
- CODEC_ID_PCM_DVD,
- CODEC_ID_PCM_F32BE,
- CODEC_ID_PCM_F32LE,
- CODEC_ID_PCM_F64BE,
- CODEC_ID_PCM_F64LE,
- CODEC_ID_PCM_BLURAY,
- CODEC_ID_PCM_LXF,
- CODEC_ID_S302M,
- CODEC_ID_PCM_S8_PLANAR,
+ AV_CODEC_ID_FIRST_AUDIO = 0x10000, ///< A dummy id pointing at the start of audio codecs
+ AV_CODEC_ID_PCM_S16LE = 0x10000,
+ AV_CODEC_ID_PCM_S16BE,
+ AV_CODEC_ID_PCM_U16LE,
+ AV_CODEC_ID_PCM_U16BE,
+ AV_CODEC_ID_PCM_S8,
+ AV_CODEC_ID_PCM_U8,
+ AV_CODEC_ID_PCM_MULAW,
+ AV_CODEC_ID_PCM_ALAW,
+ AV_CODEC_ID_PCM_S32LE,
+ AV_CODEC_ID_PCM_S32BE,
+ AV_CODEC_ID_PCM_U32LE,
+ AV_CODEC_ID_PCM_U32BE,
+ AV_CODEC_ID_PCM_S24LE,
+ AV_CODEC_ID_PCM_S24BE,
+ AV_CODEC_ID_PCM_U24LE,
+ AV_CODEC_ID_PCM_U24BE,
+ AV_CODEC_ID_PCM_S24DAUD,
+ AV_CODEC_ID_PCM_ZORK,
+ AV_CODEC_ID_PCM_S16LE_PLANAR,
+ AV_CODEC_ID_PCM_DVD,
+ AV_CODEC_ID_PCM_F32BE,
+ AV_CODEC_ID_PCM_F32LE,
+ AV_CODEC_ID_PCM_F64BE,
+ AV_CODEC_ID_PCM_F64LE,
+ AV_CODEC_ID_PCM_BLURAY,
+ AV_CODEC_ID_PCM_LXF,
+ AV_CODEC_ID_S302M,
+ AV_CODEC_ID_PCM_S8_PLANAR,
/* various ADPCM codecs */
- CODEC_ID_ADPCM_IMA_QT = 0x11000,
- CODEC_ID_ADPCM_IMA_WAV,
- CODEC_ID_ADPCM_IMA_DK3,
- CODEC_ID_ADPCM_IMA_DK4,
- CODEC_ID_ADPCM_IMA_WS,
- CODEC_ID_ADPCM_IMA_SMJPEG,
- CODEC_ID_ADPCM_MS,
- CODEC_ID_ADPCM_4XM,
- CODEC_ID_ADPCM_XA,
- CODEC_ID_ADPCM_ADX,
- CODEC_ID_ADPCM_EA,
- CODEC_ID_ADPCM_G726,
- CODEC_ID_ADPCM_CT,
- CODEC_ID_ADPCM_SWF,
- CODEC_ID_ADPCM_YAMAHA,
- CODEC_ID_ADPCM_SBPRO_4,
- CODEC_ID_ADPCM_SBPRO_3,
- CODEC_ID_ADPCM_SBPRO_2,
- CODEC_ID_ADPCM_THP,
- CODEC_ID_ADPCM_IMA_AMV,
- CODEC_ID_ADPCM_EA_R1,
- CODEC_ID_ADPCM_EA_R3,
- CODEC_ID_ADPCM_EA_R2,
- CODEC_ID_ADPCM_IMA_EA_SEAD,
- CODEC_ID_ADPCM_IMA_EA_EACS,
- CODEC_ID_ADPCM_EA_XAS,
- CODEC_ID_ADPCM_EA_MAXIS_XA,
- CODEC_ID_ADPCM_IMA_ISS,
- CODEC_ID_ADPCM_G722,
+ AV_CODEC_ID_ADPCM_IMA_QT = 0x11000,
+ AV_CODEC_ID_ADPCM_IMA_WAV,
+ AV_CODEC_ID_ADPCM_IMA_DK3,
+ AV_CODEC_ID_ADPCM_IMA_DK4,
+ AV_CODEC_ID_ADPCM_IMA_WS,
+ AV_CODEC_ID_ADPCM_IMA_SMJPEG,
+ AV_CODEC_ID_ADPCM_MS,
+ AV_CODEC_ID_ADPCM_4XM,
+ AV_CODEC_ID_ADPCM_XA,
+ AV_CODEC_ID_ADPCM_ADX,
+ AV_CODEC_ID_ADPCM_EA,
+ AV_CODEC_ID_ADPCM_G726,
+ AV_CODEC_ID_ADPCM_CT,
+ AV_CODEC_ID_ADPCM_SWF,
+ AV_CODEC_ID_ADPCM_YAMAHA,
+ AV_CODEC_ID_ADPCM_SBPRO_4,
+ AV_CODEC_ID_ADPCM_SBPRO_3,
+ AV_CODEC_ID_ADPCM_SBPRO_2,
+ AV_CODEC_ID_ADPCM_THP,
+ AV_CODEC_ID_ADPCM_IMA_AMV,
+ AV_CODEC_ID_ADPCM_EA_R1,
+ AV_CODEC_ID_ADPCM_EA_R3,
+ AV_CODEC_ID_ADPCM_EA_R2,
+ AV_CODEC_ID_ADPCM_IMA_EA_SEAD,
+ AV_CODEC_ID_ADPCM_IMA_EA_EACS,
+ AV_CODEC_ID_ADPCM_EA_XAS,
+ AV_CODEC_ID_ADPCM_EA_MAXIS_XA,
+ AV_CODEC_ID_ADPCM_IMA_ISS,
+ AV_CODEC_ID_ADPCM_G722,
+ AV_CODEC_ID_ADPCM_IMA_APC,
/* AMR */
- CODEC_ID_AMR_NB = 0x12000,
- CODEC_ID_AMR_WB,
+ AV_CODEC_ID_AMR_NB = 0x12000,
+ AV_CODEC_ID_AMR_WB,
/* RealAudio codecs*/
- CODEC_ID_RA_144 = 0x13000,
- CODEC_ID_RA_288,
+ AV_CODEC_ID_RA_144 = 0x13000,
+ AV_CODEC_ID_RA_288,
/* various DPCM codecs */
- CODEC_ID_ROQ_DPCM = 0x14000,
- CODEC_ID_INTERPLAY_DPCM,
- CODEC_ID_XAN_DPCM,
- CODEC_ID_SOL_DPCM,
+ AV_CODEC_ID_ROQ_DPCM = 0x14000,
+ AV_CODEC_ID_INTERPLAY_DPCM,
+ AV_CODEC_ID_XAN_DPCM,
+ AV_CODEC_ID_SOL_DPCM,
/* audio codecs */
- CODEC_ID_MP2 = 0x15000,
- CODEC_ID_MP3, ///< preferred ID for decoding MPEG audio layer 1, 2 or 3
- CODEC_ID_AAC,
- CODEC_ID_AC3,
- CODEC_ID_DTS,
- CODEC_ID_VORBIS,
- CODEC_ID_DVAUDIO,
- CODEC_ID_WMAV1,
- CODEC_ID_WMAV2,
- CODEC_ID_MACE3,
- CODEC_ID_MACE6,
- CODEC_ID_VMDAUDIO,
-#if LIBAVCODEC_VERSION_MAJOR == 53
- CODEC_ID_SONIC,
- CODEC_ID_SONIC_LS,
-#endif
- CODEC_ID_FLAC,
- CODEC_ID_MP3ADU,
- CODEC_ID_MP3ON4,
- CODEC_ID_SHORTEN,
- CODEC_ID_ALAC,
- CODEC_ID_WESTWOOD_SND1,
- CODEC_ID_GSM, ///< as in Berlin toast format
- CODEC_ID_QDM2,
- CODEC_ID_COOK,
- CODEC_ID_TRUESPEECH,
- CODEC_ID_TTA,
- CODEC_ID_SMACKAUDIO,
- CODEC_ID_QCELP,
- CODEC_ID_WAVPACK,
- CODEC_ID_DSICINAUDIO,
- CODEC_ID_IMC,
- CODEC_ID_MUSEPACK7,
- CODEC_ID_MLP,
- CODEC_ID_GSM_MS, /* as found in WAV */
- CODEC_ID_ATRAC3,
- CODEC_ID_VOXWARE,
- CODEC_ID_APE,
- CODEC_ID_NELLYMOSER,
- CODEC_ID_MUSEPACK8,
- CODEC_ID_SPEEX,
- CODEC_ID_WMAVOICE,
- CODEC_ID_WMAPRO,
- CODEC_ID_WMALOSSLESS,
- CODEC_ID_ATRAC3P,
- CODEC_ID_EAC3,
- CODEC_ID_SIPR,
- CODEC_ID_MP1,
- CODEC_ID_TWINVQ,
- CODEC_ID_TRUEHD,
- CODEC_ID_MP4ALS,
- CODEC_ID_ATRAC1,
- CODEC_ID_BINKAUDIO_RDFT,
- CODEC_ID_BINKAUDIO_DCT,
- CODEC_ID_AAC_LATM,
- CODEC_ID_QDMC,
- CODEC_ID_CELT,
-#if LIBAVCODEC_VERSION_MAJOR > 53
- CODEC_ID_G723_1,
- CODEC_ID_G729,
- CODEC_ID_8SVX_EXP,
- CODEC_ID_8SVX_FIB,
-#endif
- CODEC_ID_BMV_AUDIO,
+ AV_CODEC_ID_MP2 = 0x15000,
+ AV_CODEC_ID_MP3, ///< preferred ID for decoding MPEG audio layer 1, 2 or 3
+ AV_CODEC_ID_AAC,
+ AV_CODEC_ID_AC3,
+ AV_CODEC_ID_DTS,
+ AV_CODEC_ID_VORBIS,
+ AV_CODEC_ID_DVAUDIO,
+ AV_CODEC_ID_WMAV1,
+ AV_CODEC_ID_WMAV2,
+ AV_CODEC_ID_MACE3,
+ AV_CODEC_ID_MACE6,
+ AV_CODEC_ID_VMDAUDIO,
+ AV_CODEC_ID_FLAC,
+ AV_CODEC_ID_MP3ADU,
+ AV_CODEC_ID_MP3ON4,
+ AV_CODEC_ID_SHORTEN,
+ AV_CODEC_ID_ALAC,
+ AV_CODEC_ID_WESTWOOD_SND1,
+ AV_CODEC_ID_GSM, ///< as in Berlin toast format
+ AV_CODEC_ID_QDM2,
+ AV_CODEC_ID_COOK,
+ AV_CODEC_ID_TRUESPEECH,
+ AV_CODEC_ID_TTA,
+ AV_CODEC_ID_SMACKAUDIO,
+ AV_CODEC_ID_QCELP,
+ AV_CODEC_ID_WAVPACK,
+ AV_CODEC_ID_DSICINAUDIO,
+ AV_CODEC_ID_IMC,
+ AV_CODEC_ID_MUSEPACK7,
+ AV_CODEC_ID_MLP,
+ AV_CODEC_ID_GSM_MS, /* as found in WAV */
+ AV_CODEC_ID_ATRAC3,
+ AV_CODEC_ID_VOXWARE,
+ AV_CODEC_ID_APE,
+ AV_CODEC_ID_NELLYMOSER,
+ AV_CODEC_ID_MUSEPACK8,
+ AV_CODEC_ID_SPEEX,
+ AV_CODEC_ID_WMAVOICE,
+ AV_CODEC_ID_WMAPRO,
+ AV_CODEC_ID_WMALOSSLESS,
+ AV_CODEC_ID_ATRAC3P,
+ AV_CODEC_ID_EAC3,
+ AV_CODEC_ID_SIPR,
+ AV_CODEC_ID_MP1,
+ AV_CODEC_ID_TWINVQ,
+ AV_CODEC_ID_TRUEHD,
+ AV_CODEC_ID_MP4ALS,
+ AV_CODEC_ID_ATRAC1,
+ AV_CODEC_ID_BINKAUDIO_RDFT,
+ AV_CODEC_ID_BINKAUDIO_DCT,
+ AV_CODEC_ID_AAC_LATM,
+ AV_CODEC_ID_QDMC,
+ AV_CODEC_ID_CELT,
+ AV_CODEC_ID_G723_1,
+ AV_CODEC_ID_G729,
+ AV_CODEC_ID_8SVX_EXP,
+ AV_CODEC_ID_8SVX_FIB,
+ AV_CODEC_ID_BMV_AUDIO,
+ AV_CODEC_ID_RALF,
+ AV_CODEC_ID_IAC,
+ AV_CODEC_ID_ILBC,
+ AV_CODEC_ID_OPUS,
+ AV_CODEC_ID_COMFORT_NOISE,
+ AV_CODEC_ID_TAK,
/* subtitle codecs */
- CODEC_ID_FIRST_SUBTITLE = 0x17000, ///< A dummy ID pointing at the start of subtitle codecs.
- CODEC_ID_DVD_SUBTITLE = 0x17000,
- CODEC_ID_DVB_SUBTITLE,
- CODEC_ID_TEXT, ///< raw UTF-8 text
- CODEC_ID_XSUB,
- CODEC_ID_SSA,
- CODEC_ID_MOV_TEXT,
- CODEC_ID_HDMV_PGS_SUBTITLE,
- CODEC_ID_DVB_TELETEXT,
- CODEC_ID_SRT,
+ AV_CODEC_ID_FIRST_SUBTITLE = 0x17000, ///< A dummy ID pointing at the start of subtitle codecs.
+ AV_CODEC_ID_DVD_SUBTITLE = 0x17000,
+ AV_CODEC_ID_DVB_SUBTITLE,
+ AV_CODEC_ID_TEXT, ///< raw UTF-8 text
+ AV_CODEC_ID_XSUB,
+ AV_CODEC_ID_SSA,
+ AV_CODEC_ID_MOV_TEXT,
+ AV_CODEC_ID_HDMV_PGS_SUBTITLE,
+ AV_CODEC_ID_DVB_TELETEXT,
+ AV_CODEC_ID_SRT,
/* other specific kind of codecs (generally used for attachments) */
- CODEC_ID_FIRST_UNKNOWN = 0x18000, ///< A dummy ID pointing at the start of various fake codecs.
- CODEC_ID_TTF = 0x18000,
+ AV_CODEC_ID_FIRST_UNKNOWN = 0x18000, ///< A dummy ID pointing at the start of various fake codecs.
+ AV_CODEC_ID_TTF = 0x18000,
- CODEC_ID_PROBE = 0x19000, ///< codec_id is not known (like CODEC_ID_NONE) but lavf should attempt to identify it
+ AV_CODEC_ID_PROBE = 0x19000, ///< codec_id is not known (like AV_CODEC_ID_NONE) but lavf should attempt to identify it
- CODEC_ID_MPEG2TS = 0x20000, /**< _FAKE_ codec to indicate a raw MPEG-2 TS
+ AV_CODEC_ID_MPEG2TS = 0x20000, /**< _FAKE_ codec to indicate a raw MPEG-2 TS
* stream (only used by libavformat) */
- CODEC_ID_MPEG4SYSTEMS = 0x20001, /**< _FAKE_ codec to indicate a MPEG-4 Systems
+ AV_CODEC_ID_MPEG4SYSTEMS = 0x20001, /**< _FAKE_ codec to indicate a MPEG-4 Systems
* stream (only used by libavformat) */
- CODEC_ID_FFMETADATA = 0x21000, ///< Dummy codec for streams containing only metadata information.
-};
-
-#if FF_API_OLD_SAMPLE_FMT
-#define SampleFormat AVSampleFormat
+ AV_CODEC_ID_FFMETADATA = 0x21000, ///< Dummy codec for streams containing only metadata information.
-#define SAMPLE_FMT_NONE AV_SAMPLE_FMT_NONE
-#define SAMPLE_FMT_U8 AV_SAMPLE_FMT_U8
-#define SAMPLE_FMT_S16 AV_SAMPLE_FMT_S16
-#define SAMPLE_FMT_S32 AV_SAMPLE_FMT_S32
-#define SAMPLE_FMT_FLT AV_SAMPLE_FMT_FLT
-#define SAMPLE_FMT_DBL AV_SAMPLE_FMT_DBL
-#define SAMPLE_FMT_NB AV_SAMPLE_FMT_NB
+#if FF_API_CODEC_ID
+#include "old_codec_ids.h"
#endif
+};
-#if FF_API_OLD_AUDIOCONVERT
-#include "libavutil/audioconvert.h"
-
-/* Audio channel masks */
-#define CH_FRONT_LEFT AV_CH_FRONT_LEFT
-#define CH_FRONT_RIGHT AV_CH_FRONT_RIGHT
-#define CH_FRONT_CENTER AV_CH_FRONT_CENTER
-#define CH_LOW_FREQUENCY AV_CH_LOW_FREQUENCY
-#define CH_BACK_LEFT AV_CH_BACK_LEFT
-#define CH_BACK_RIGHT AV_CH_BACK_RIGHT
-#define CH_FRONT_LEFT_OF_CENTER AV_CH_FRONT_LEFT_OF_CENTER
-#define CH_FRONT_RIGHT_OF_CENTER AV_CH_FRONT_RIGHT_OF_CENTER
-#define CH_BACK_CENTER AV_CH_BACK_CENTER
-#define CH_SIDE_LEFT AV_CH_SIDE_LEFT
-#define CH_SIDE_RIGHT AV_CH_SIDE_RIGHT
-#define CH_TOP_CENTER AV_CH_TOP_CENTER
-#define CH_TOP_FRONT_LEFT AV_CH_TOP_FRONT_LEFT
-#define CH_TOP_FRONT_CENTER AV_CH_TOP_FRONT_CENTER
-#define CH_TOP_FRONT_RIGHT AV_CH_TOP_FRONT_RIGHT
-#define CH_TOP_BACK_LEFT AV_CH_TOP_BACK_LEFT
-#define CH_TOP_BACK_CENTER AV_CH_TOP_BACK_CENTER
-#define CH_TOP_BACK_RIGHT AV_CH_TOP_BACK_RIGHT
-#define CH_STEREO_LEFT AV_CH_STEREO_LEFT
-#define CH_STEREO_RIGHT AV_CH_STEREO_RIGHT
-
-/** Channel mask value used for AVCodecContext.request_channel_layout
- to indicate that the user requests the channel order of the decoder output
- to be the native codec channel order. */
-#define CH_LAYOUT_NATIVE AV_CH_LAYOUT_NATIVE
-
-/* Audio channel convenience macros */
-#define CH_LAYOUT_MONO AV_CH_LAYOUT_MONO
-#define CH_LAYOUT_STEREO AV_CH_LAYOUT_STEREO
-#define CH_LAYOUT_2_1 AV_CH_LAYOUT_2_1
-#define CH_LAYOUT_SURROUND AV_CH_LAYOUT_SURROUND
-#define CH_LAYOUT_4POINT0 AV_CH_LAYOUT_4POINT0
-#define CH_LAYOUT_2_2 AV_CH_LAYOUT_2_2
-#define CH_LAYOUT_QUAD AV_CH_LAYOUT_QUAD
-#define CH_LAYOUT_5POINT0 AV_CH_LAYOUT_5POINT0
-#define CH_LAYOUT_5POINT1 AV_CH_LAYOUT_5POINT1
-#define CH_LAYOUT_5POINT0_BACK AV_CH_LAYOUT_5POINT0_BACK
-#define CH_LAYOUT_5POINT1_BACK AV_CH_LAYOUT_5POINT1_BACK
-#define CH_LAYOUT_7POINT0 AV_CH_LAYOUT_7POINT0
-#define CH_LAYOUT_7POINT1 AV_CH_LAYOUT_7POINT1
-#define CH_LAYOUT_7POINT1_WIDE AV_CH_LAYOUT_7POINT1_WIDE
-#define CH_LAYOUT_STEREO_DOWNMIX AV_CH_LAYOUT_STEREO_DOWNMIX
+#if FF_API_CODEC_ID
+#define CodecID AVCodecID
#endif
+/**
+ * This struct describes the properties of a single codec described by an
+ * AVCodecID.
+ * @see avcodec_get_descriptor()
+ */
+typedef struct AVCodecDescriptor {
+ enum AVCodecID id;
+ enum AVMediaType type;
+ /**
+ * Name of the codec described by this descriptor. It is non-empty and
+ * unique for each codec descriptor. It should contain alphanumeric
+ * characters and '_' only.
+ */
+ const char *name;
+ /**
+ * A more descriptive name for this codec. May be NULL.
+ */
+ const char *long_name;
+ /**
+ * Codec properties, a combination of AV_CODEC_PROP_* flags.
+ */
+ int props;
+} AVCodecDescriptor;
+
+/**
+ * Codec uses only intra compression.
+ * Video codecs only.
+ */
+#define AV_CODEC_PROP_INTRA_ONLY (1 << 0)
+/**
+ * Codec supports lossy compression. Audio and video codecs only.
+ * @note a codec may support both lossy and lossless
+ * compression modes
+ */
+#define AV_CODEC_PROP_LOSSY (1 << 1)
+/**
+ * Codec supports lossless compression. Audio and video codecs only.
+ */
+#define AV_CODEC_PROP_LOSSLESS (1 << 2)
+
#if FF_API_OLD_DECODE_AUDIO
/* in bytes */
#define AVCODEC_MAX_AUDIO_FRAME_SIZE 192000 // 1 second of 48khz 32bit audio
#endif
/**
+ * @ingroup lavc_decoding
* Required number of additionally allocated bytes at the end of the input bitstream for decoding.
* This is mainly needed because some optimized bitstream readers read
* 32 or 64 bit at once and could read over the end.<br>
@@ -497,6 +498,7 @@ enum CodecID {
#define FF_INPUT_BUFFER_PADDING_SIZE 8
/**
+ * @ingroup lavc_encoding
* minimum encoding buffer size
* Used to avoid some checks during header writing.
*/
@@ -504,6 +506,7 @@ enum CodecID {
/**
+ * @ingroup lavc_encoding
* motion estimation type.
*/
enum Motion_Est_ID {
@@ -519,52 +522,57 @@ enum Motion_Est_ID {
ME_TESA, ///< transformed exhaustive search algorithm
};
+/**
+ * @ingroup lavc_decoding
+ */
enum AVDiscard{
/* We leave some space between them for extensions (drop some
* keyframes for intra-only or drop just some bidir frames). */
- AVDISCARD_NONE =-16, ///< discard nothing
- AVDISCARD_DEFAULT= 0, ///< discard useless packets like 0 size packets in avi
- AVDISCARD_NONREF = 8, ///< discard all non reference
- AVDISCARD_BIDIR = 16, ///< discard all bidirectional frames
- AVDISCARD_NONKEY = 32, ///< discard all frames except keyframes
- AVDISCARD_ALL = 48, ///< discard all
+ AVDISCARD_NONE =-16, ///< discard nothing
+ AVDISCARD_DEFAULT = 0, ///< discard useless packets like 0 size packets in avi
+ AVDISCARD_NONREF = 8, ///< discard all non reference
+ AVDISCARD_BIDIR = 16, ///< discard all bidirectional frames
+ AVDISCARD_NONKEY = 32, ///< discard all frames except keyframes
+ AVDISCARD_ALL = 48, ///< discard all
};
enum AVColorPrimaries{
- AVCOL_PRI_BT709 =1, ///< also ITU-R BT1361 / IEC 61966-2-4 / SMPTE RP177 Annex B
- AVCOL_PRI_UNSPECIFIED=2,
- AVCOL_PRI_BT470M =4,
- AVCOL_PRI_BT470BG =5, ///< also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM
- AVCOL_PRI_SMPTE170M =6, ///< also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC
- AVCOL_PRI_SMPTE240M =7, ///< functionally identical to above
- AVCOL_PRI_FILM =8,
- AVCOL_PRI_NB , ///< Not part of ABI
+ AVCOL_PRI_BT709 = 1, ///< also ITU-R BT1361 / IEC 61966-2-4 / SMPTE RP177 Annex B
+ AVCOL_PRI_UNSPECIFIED = 2,
+ AVCOL_PRI_BT470M = 4,
+ AVCOL_PRI_BT470BG = 5, ///< also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM
+ AVCOL_PRI_SMPTE170M = 6, ///< also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC
+ AVCOL_PRI_SMPTE240M = 7, ///< functionally identical to above
+ AVCOL_PRI_FILM = 8,
+ AVCOL_PRI_NB , ///< Not part of ABI
};
enum AVColorTransferCharacteristic{
- AVCOL_TRC_BT709 =1, ///< also ITU-R BT1361
- AVCOL_TRC_UNSPECIFIED=2,
- AVCOL_TRC_GAMMA22 =4, ///< also ITU-R BT470M / ITU-R BT1700 625 PAL & SECAM
- AVCOL_TRC_GAMMA28 =5, ///< also ITU-R BT470BG
- AVCOL_TRC_NB , ///< Not part of ABI
+ AVCOL_TRC_BT709 = 1, ///< also ITU-R BT1361
+ AVCOL_TRC_UNSPECIFIED = 2,
+ AVCOL_TRC_GAMMA22 = 4, ///< also ITU-R BT470M / ITU-R BT1700 625 PAL & SECAM
+ AVCOL_TRC_GAMMA28 = 5, ///< also ITU-R BT470BG
+ AVCOL_TRC_SMPTE240M = 7,
+ AVCOL_TRC_NB , ///< Not part of ABI
};
enum AVColorSpace{
- AVCOL_SPC_RGB =0,
- AVCOL_SPC_BT709 =1, ///< also ITU-R BT1361 / IEC 61966-2-4 xvYCC709 / SMPTE RP177 Annex B
- AVCOL_SPC_UNSPECIFIED=2,
- AVCOL_SPC_FCC =4,
- AVCOL_SPC_BT470BG =5, ///< also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM / IEC 61966-2-4 xvYCC601
- AVCOL_SPC_SMPTE170M =6, ///< also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC / functionally identical to above
- AVCOL_SPC_SMPTE240M =7,
- AVCOL_SPC_NB , ///< Not part of ABI
+ AVCOL_SPC_RGB = 0,
+ AVCOL_SPC_BT709 = 1, ///< also ITU-R BT1361 / IEC 61966-2-4 xvYCC709 / SMPTE RP177 Annex B
+ AVCOL_SPC_UNSPECIFIED = 2,
+ AVCOL_SPC_FCC = 4,
+ AVCOL_SPC_BT470BG = 5, ///< also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM / IEC 61966-2-4 xvYCC601
+ AVCOL_SPC_SMPTE170M = 6, ///< also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC / functionally identical to above
+ AVCOL_SPC_SMPTE240M = 7,
+ AVCOL_SPC_YCOCG = 8, ///< Used by Dirac / VC-2 and H.264 FRext, see ITU-T SG16
+ AVCOL_SPC_NB , ///< Not part of ABI
};
enum AVColorRange{
- AVCOL_RANGE_UNSPECIFIED=0,
- AVCOL_RANGE_MPEG =1, ///< the normal 219*2^(n-8) "MPEG" YUV ranges
- AVCOL_RANGE_JPEG =2, ///< the normal 2^n-1 "JPEG" YUV ranges
- AVCOL_RANGE_NB , ///< Not part of ABI
+ AVCOL_RANGE_UNSPECIFIED = 0,
+ AVCOL_RANGE_MPEG = 1, ///< the normal 219*2^(n-8) "MPEG" YUV ranges
+ AVCOL_RANGE_JPEG = 2, ///< the normal 2^n-1 "JPEG" YUV ranges
+ AVCOL_RANGE_NB , ///< Not part of ABI
};
/**
@@ -573,29 +581,15 @@ enum AVColorRange{
* X X 5 6 X 0 is undefined/unknown position
*/
enum AVChromaLocation{
- AVCHROMA_LOC_UNSPECIFIED=0,
- AVCHROMA_LOC_LEFT =1, ///< mpeg2/4, h264 default
- AVCHROMA_LOC_CENTER =2, ///< mpeg1, jpeg, h263
- AVCHROMA_LOC_TOPLEFT =3, ///< DV
- AVCHROMA_LOC_TOP =4,
- AVCHROMA_LOC_BOTTOMLEFT =5,
- AVCHROMA_LOC_BOTTOM =6,
- AVCHROMA_LOC_NB , ///< Not part of ABI
-};
-
-#if FF_API_FLAC_GLOBAL_OPTS
-/**
- * LPC analysis type
- */
-enum AVLPCType {
- AV_LPC_TYPE_DEFAULT = -1, ///< use the codec default LPC type
- AV_LPC_TYPE_NONE = 0, ///< do not use LPC prediction or use all zero coefficients
- AV_LPC_TYPE_FIXED = 1, ///< fixed LPC coefficients
- AV_LPC_TYPE_LEVINSON = 2, ///< Levinson-Durbin recursion
- AV_LPC_TYPE_CHOLESKY = 3, ///< Cholesky factorization
- AV_LPC_TYPE_NB , ///< Not part of ABI
+ AVCHROMA_LOC_UNSPECIFIED = 0,
+ AVCHROMA_LOC_LEFT = 1, ///< mpeg2/4, h264 default
+ AVCHROMA_LOC_CENTER = 2, ///< mpeg1, jpeg, h263
+ AVCHROMA_LOC_TOPLEFT = 3, ///< DV
+ AVCHROMA_LOC_TOP = 4,
+ AVCHROMA_LOC_BOTTOMLEFT = 5,
+ AVCHROMA_LOC_BOTTOM = 6,
+ AVCHROMA_LOC_NB , ///< Not part of ABI
};
-#endif
enum AVAudioServiceType {
AV_AUDIO_SERVICE_TYPE_MAIN = 0,
@@ -610,6 +604,9 @@ enum AVAudioServiceType {
AV_AUDIO_SERVICE_TYPE_NB , ///< Not part of ABI
};
+/**
+ * @ingroup lavc_encoding
+ */
typedef struct RcOverride{
int start_frame;
int end_frame;
@@ -649,59 +646,19 @@ typedef struct RcOverride{
#define CODEC_FLAG_BITEXACT 0x00800000 ///< Use only bitexact stuff (except (I)DCT).
/* Fx : Flag for h263+ extra options */
#define CODEC_FLAG_AC_PRED 0x01000000 ///< H.263 advanced intra coding / MPEG-4 AC prediction
-#define CODEC_FLAG_CBP_RD 0x04000000 ///< Use rate distortion optimization for cbp.
-#define CODEC_FLAG_QP_RD 0x08000000 ///< Use rate distortion optimization for qp selectioon.
#define CODEC_FLAG_LOOP_FILTER 0x00000800 ///< loop filter
#define CODEC_FLAG_INTERLACED_ME 0x20000000 ///< interlaced motion estimation
#define CODEC_FLAG_CLOSED_GOP 0x80000000
#define CODEC_FLAG2_FAST 0x00000001 ///< Allow non spec compliant speedup tricks.
-#define CODEC_FLAG2_STRICT_GOP 0x00000002 ///< Strictly enforce GOP size.
#define CODEC_FLAG2_NO_OUTPUT 0x00000004 ///< Skip bitstream encoding.
#define CODEC_FLAG2_LOCAL_HEADER 0x00000008 ///< Place global headers at every keyframe instead of in extradata.
+#if FF_API_MPV_GLOBAL_OPTS
+#define CODEC_FLAG_CBP_RD 0x04000000 ///< Use rate distortion optimization for cbp.
+#define CODEC_FLAG_QP_RD 0x08000000 ///< Use rate distortion optimization for qp selectioon.
+#define CODEC_FLAG2_STRICT_GOP 0x00000002 ///< Strictly enforce GOP size.
#define CODEC_FLAG2_SKIP_RD 0x00004000 ///< RD optimal MB level residual skipping
-#define CODEC_FLAG2_CHUNKS 0x00008000 ///< Input bitstream might be truncated at a packet boundaries instead of only at frame boundaries.
-/**
- * @defgroup deprecated_flags Deprecated codec flags
- * Use corresponding private codec options instead.
- * @{
- */
-#if FF_API_MPEGVIDEO_GLOBAL_OPTS
-#define CODEC_FLAG_OBMC 0x00000001 ///< OBMC
-#define CODEC_FLAG_H263P_AIV 0x00000008 ///< H.263 alternative inter VLC
-#define CODEC_FLAG_PART 0x0080 ///< Use data partitioning.
-#define CODEC_FLAG_ALT_SCAN 0x00100000 ///< Use alternate scan.
-#define CODEC_FLAG_H263P_UMV 0x02000000 ///< unlimited motion vector
-#define CODEC_FLAG_H263P_SLICE_STRUCT 0x10000000
-#define CODEC_FLAG_SVCD_SCAN_OFFSET 0x40000000 ///< Will reserve space for SVCD scan offset user data.
-#define CODEC_FLAG2_INTRA_VLC 0x00000800 ///< Use MPEG-2 intra VLC table.
-#define CODEC_FLAG2_DROP_FRAME_TIMECODE 0x00002000 ///< timecode is in drop frame format.
-#define CODEC_FLAG2_NON_LINEAR_QUANT 0x00010000 ///< Use MPEG-2 nonlinear quantizer.
-#endif
-#if FF_API_MJPEG_GLOBAL_OPTS
-#define CODEC_FLAG_EXTERN_HUFF 0x1000 ///< Use external Huffman table (for MJPEG).
-#endif
-#if FF_API_X264_GLOBAL_OPTS
-#define CODEC_FLAG2_BPYRAMID 0x00000010 ///< H.264 allow B-frames to be used as references.
-#define CODEC_FLAG2_WPRED 0x00000020 ///< H.264 weighted biprediction for B-frames
-#define CODEC_FLAG2_MIXED_REFS 0x00000040 ///< H.264 one reference per partition, as opposed to one reference per macroblock
-#define CODEC_FLAG2_8X8DCT 0x00000080 ///< H.264 high profile 8x8 transform
-#define CODEC_FLAG2_FASTPSKIP 0x00000100 ///< H.264 fast pskip
-#define CODEC_FLAG2_AUD 0x00000200 ///< H.264 access unit delimiters
-#define CODEC_FLAG2_BRDO 0x00000400 ///< B-frame rate-distortion optimization
-#define CODEC_FLAG2_MBTREE 0x00040000 ///< Use macroblock tree ratecontrol (x264 only)
-#define CODEC_FLAG2_PSY 0x00080000 ///< Use psycho visual optimizations.
-#define CODEC_FLAG2_SSIM 0x00100000 ///< Compute SSIM during encoding, error[] values are undefined.
-#define CODEC_FLAG2_INTRA_REFRESH 0x00200000 ///< Use periodic insertion of intra blocks instead of keyframes.
#endif
-#if FF_API_SNOW_GLOBAL_OPTS
-#define CODEC_FLAG2_MEMC_ONLY 0x00001000 ///< Only do ME/MC (I frames -> ref, P frame -> ME+MC).
-#endif
-#if FF_API_LAME_GLOBAL_OPTS
-#define CODEC_FLAG2_BIT_RESERVOIR 0x00020000 ///< Use a bit reservoir when encoding if possible
-#endif
-/**
- * @}
- */
+#define CODEC_FLAG2_CHUNKS 0x00008000 ///< Input bitstream might be truncated at a packet boundaries instead of only at frame boundaries.
/* Unsupported options :
* Syntax Arithmetic coding (SAC)
@@ -717,10 +674,6 @@ typedef struct RcOverride{
* assume the buffer was allocated by avcodec_default_get_buffer.
*/
#define CODEC_CAP_DR1 0x0002
-#if FF_API_PARSE_FRAME
-/* If 'parse_only' field is true, then avcodec_parse_frame() can be used. */
-#define CODEC_CAP_PARSE_ONLY 0x0004
-#endif
#define CODEC_CAP_TRUNCATED 0x0008
/* Codec can export data for HW decoding (XvMC). */
#define CODEC_CAP_HWACCEL 0x0010
@@ -866,28 +819,82 @@ typedef struct AVPanScan{
#define FF_BUFFER_TYPE_SHARED 4 ///< Buffer from somewhere else; don't deallocate image (data/base), all other tables are not shared.
#define FF_BUFFER_TYPE_COPY 8 ///< Just a (modified) copy of some other buffer, don't deallocate anything.
-#if FF_API_OLD_FF_PICT_TYPES
-/* DEPRECATED, directly use the AV_PICTURE_TYPE_* enum values */
-#define FF_I_TYPE AV_PICTURE_TYPE_I ///< Intra
-#define FF_P_TYPE AV_PICTURE_TYPE_P ///< Predicted
-#define FF_B_TYPE AV_PICTURE_TYPE_B ///< Bi-dir predicted
-#define FF_S_TYPE AV_PICTURE_TYPE_S ///< S(GMC)-VOP MPEG4
-#define FF_SI_TYPE AV_PICTURE_TYPE_SI ///< Switching Intra
-#define FF_SP_TYPE AV_PICTURE_TYPE_SP ///< Switching Predicted
-#define FF_BI_TYPE AV_PICTURE_TYPE_BI
-#endif
-
#define FF_BUFFER_HINTS_VALID 0x01 // Buffer hints value is meaningful (if 0 ignore).
#define FF_BUFFER_HINTS_READABLE 0x02 // Codec will read from buffer.
#define FF_BUFFER_HINTS_PRESERVE 0x04 // User must not alter buffer content.
#define FF_BUFFER_HINTS_REUSABLE 0x08 // Codec will reuse the buffer (update).
+/**
+ * @defgroup lavc_packet AVPacket
+ *
+ * Types and functions for working with AVPacket.
+ * @{
+ */
enum AVPacketSideDataType {
AV_PKT_DATA_PALETTE,
AV_PKT_DATA_NEW_EXTRADATA,
+
+ /**
+ * An AV_PKT_DATA_PARAM_CHANGE side data packet is laid out as follows:
+ * @code
+ * u32le param_flags
+ * if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT)
+ * s32le channel_count
+ * if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_LAYOUT)
+ * u64le channel_layout
+ * if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_SAMPLE_RATE)
+ * s32le sample_rate
+ * if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_DIMENSIONS)
+ * s32le width
+ * s32le height
+ * @endcode
+ */
AV_PKT_DATA_PARAM_CHANGE,
+
+ /**
+ * An AV_PKT_DATA_H263_MB_INFO side data packet contains a number of
+ * structures with info about macroblocks relevant to splitting the
+ * packet into smaller packets on macroblock edges (e.g. as for RFC 2190).
+ * That is, it does not necessarily contain info about all macroblocks,
+ * as long as the distance between macroblocks in the info is smaller
+ * than the target payload size.
+ * Each MB info structure is 12 bytes, and is laid out as follows:
+ * @code
+ * u32le bit offset from the start of the packet
+ * u8 current quantizer at the start of the macroblock
+ * u8 GOB number
+ * u16le macroblock address within the GOB
+ * u8 horizontal MV predictor
+ * u8 vertical MV predictor
+ * u8 horizontal MV predictor for block number 3
+ * u8 vertical MV predictor for block number 3
+ * @endcode
+ */
+ AV_PKT_DATA_H263_MB_INFO,
};
+/**
+ * This structure stores compressed data. It is typically exported by demuxers
+ * and then passed as input to decoders, or received as output from encoders and
+ * then passed to muxers.
+ *
+ * For video, it should typically contain one compressed frame. For audio it may
+ * contain several compressed frames.
+ *
+ * AVPacket is one of the few structs in Libav, whose size is a part of public
+ * ABI. Thus it may be allocated on stack and no new fields can be added to it
+ * without libavcodec and libavformat major bump.
+ *
+ * The semantics of data ownership depends on the destruct field.
+ * If it is set, the packet data is dynamically allocated and is valid
+ * indefinitely until av_free_packet() is called (which in turn calls the
+ * destruct callback to free the data). If destruct is not set, the packet data
+ * is typically backed by some static buffer somewhere and is only valid for a
+ * limited time (e.g. until the next read call when demuxing).
+ *
+ * The side data is always allocated with av_malloc() and is freed in
+ * av_free_packet().
+ */
typedef struct AVPacket {
/**
* Presentation timestamp in AVStream->time_base units; the time at which
@@ -954,40 +961,33 @@ typedef struct AVPacket {
#define AV_PKT_FLAG_KEY 0x0001 ///< The packet contains a keyframe
#define AV_PKT_FLAG_CORRUPT 0x0002 ///< The packet content is corrupted
-/**
- * An AV_PKT_DATA_PARAM_CHANGE side data packet is laid out as follows:
- * u32le param_flags
- * if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT)
- * s32le channel_count
- * if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_LAYOUT)
- * u64le channel_layout
- * if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_SAMPLE_RATE)
- * s32le sample_rate
- * if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_DIMENSIONS)
- * s32le width
- * s32le height
- */
-
enum AVSideDataParamChangeFlags {
AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT = 0x0001,
AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_LAYOUT = 0x0002,
AV_SIDE_DATA_PARAM_CHANGE_SAMPLE_RATE = 0x0004,
AV_SIDE_DATA_PARAM_CHANGE_DIMENSIONS = 0x0008,
};
+/**
+ * @}
+ */
/**
- * Audio Video Frame.
- * New fields can be added to the end of AVFRAME with minor version
- * bumps. Removal, reordering and changes to existing fields require
- * a major version bump.
- * sizeof(AVFrame) must not be used outside libav*.
+ * This structure describes decoded (raw) audio or video data.
+ *
+ * AVFrame must be allocated using avcodec_alloc_frame() and freed with
+ * avcodec_free_frame(). Note that this allocates only the AVFrame itself. The
+ * buffers for the data must be managed through other means.
+ *
+ * AVFrame is typically allocated once and then reused multiple times to hold
+ * different data (e.g. a single AVFrame to hold frames received from a
+ * decoder). In such a case, avcodec_get_frame_defaults() should be used to
+ * reset the frame to its original clean state before it is reused again.
+ *
+ * sizeof(AVFrame) is not a part of the public ABI, so new fields may be added
+ * to the end with a minor bump.
*/
typedef struct AVFrame {
-#if FF_API_DATA_POINTERS
-#define AV_NUM_DATA_POINTERS 4
-#else
#define AV_NUM_DATA_POINTERS 8
-#endif
/**
* pointer to the picture/channel planes.
* This might be different from the first allocated byte
@@ -1002,18 +1002,54 @@ typedef struct AVFrame {
* For audio, only linesize[0] may be set. For planar audio, each channel
* plane must be the same size.
*
- * - encoding: Set by user (video only)
+ * - encoding: Set by user
* - decoding: set by AVCodecContext.get_buffer()
*/
int linesize[AV_NUM_DATA_POINTERS];
/**
- * pointer to the first allocated byte of the picture. Can be used in get_buffer/release_buffer.
- * This isn't used by libavcodec unless the default get/release_buffer() is used.
- * - encoding:
- * - decoding:
+ * pointers to the data planes/channels.
+ *
+ * For video, this should simply point to data[].
+ *
+ * For planar audio, each channel has a separate data pointer, and
+ * linesize[0] contains the size of each channel buffer.
+ * For packed audio, there is just one data pointer, and linesize[0]
+ * contains the total size of the buffer for all channels.
+ *
+ * Note: Both data and extended_data will always be set by get_buffer(),
+ * but for planar audio with more channels that can fit in data,
+ * extended_data must be used by the decoder in order to access all
+ * channels.
+ *
+ * encoding: set by user
+ * decoding: set by AVCodecContext.get_buffer()
*/
- uint8_t *base[AV_NUM_DATA_POINTERS];
+ uint8_t **extended_data;
+
+ /**
+ * width and height of the video frame
+ * - encoding: unused
+ * - decoding: Read by user.
+ */
+ int width, height;
+
+ /**
+ * number of audio samples (per channel) described by this frame
+ * - encoding: Set by user
+ * - decoding: Set by libavcodec
+ */
+ int nb_samples;
+
+ /**
+ * format of the frame, -1 if unknown or unset
+ * Values correspond to enum AVPixelFormat for video frames,
+ * enum AVSampleFormat for audio)
+ * - encoding: unused
+ * - decoding: Read by user.
+ */
+ int format;
+
/**
* 1 -> keyframe, 0-> not
* - encoding: Set by libavcodec.
@@ -1029,6 +1065,21 @@ typedef struct AVFrame {
enum AVPictureType pict_type;
/**
+ * pointer to the first allocated byte of the picture. Can be used in get_buffer/release_buffer.
+ * This isn't used by libavcodec unless the default get/release_buffer() is used.
+ * - encoding:
+ * - decoding:
+ */
+ uint8_t *base[AV_NUM_DATA_POINTERS];
+
+ /**
+ * sample aspect ratio for the video frame, 0/1 if unknown/unspecified
+ * - encoding: unused
+ * - decoding: Read by user.
+ */
+ AVRational sample_aspect_ratio;
+
+ /**
* presentation timestamp in time_base units (time when frame should be shown to user)
* If AV_NOPTS_VALUE then frame_rate = 1/time_base will be assumed.
* - encoding: MUST be set by user.
@@ -1037,6 +1088,20 @@ typedef struct AVFrame {
int64_t pts;
/**
+ * pts copied from the AVPacket that was decoded to produce this frame
+ * - encoding: unused
+ * - decoding: Read by user.
+ */
+ int64_t pkt_pts;
+
+ /**
+ * dts copied from the AVPacket that triggered returning this frame
+ * - encoding: unused
+ * - decoding: Read by user.
+ */
+ int64_t pkt_dts;
+
+ /**
* picture number in bitstream order
* - encoding: set by
* - decoding: Set by libavcodec.
@@ -1056,13 +1121,6 @@ typedef struct AVFrame {
*/
int quality;
-#if FF_API_AVFRAME_AGE
- /**
- * @deprecated unused
- */
- attribute_deprecated int age;
-#endif
-
/**
* is this picture used as reference
* The values for this are the same as the MpegEncContext.picture_structure
@@ -1087,6 +1145,11 @@ typedef struct AVFrame {
int qstride;
/**
+ *
+ */
+ int qscale_type;
+
+ /**
* mbskip_table[mb]>=1 if MB didn't change
* stride= mb_width = (width+15)>>4
* - encoding: unused
@@ -1117,12 +1180,19 @@ typedef struct AVFrame {
uint32_t *mb_type;
/**
- * log2 of the size of the block which a single vector in motion_val represents:
- * (4->16x16, 3->8x8, 2-> 4x4, 1-> 2x2)
+ * DCT coefficients
* - encoding: unused
* - decoding: Set by libavcodec.
*/
- uint8_t motion_subsample_log2;
+ short *dct_coeff;
+
+ /**
+ * motion reference frame index
+ * the order in which these are stored can depend on the codec.
+ * - encoding: Set by user.
+ * - decoding: Set by libavcodec.
+ */
+ int8_t *ref_index[2];
/**
* for some private data of the user
@@ -1155,11 +1225,6 @@ typedef struct AVFrame {
int repeat_pict;
/**
- *
- */
- int qscale_type;
-
- /**
* The content of the picture is interlaced.
* - encoding: Set by user.
* - decoding: Set by libavcodec. (default 0)
@@ -1174,13 +1239,6 @@ typedef struct AVFrame {
int top_field_first;
/**
- * Pan scan.
- * - encoding: Set by user.
- * - decoding: Set by libavcodec.
- */
- AVPanScan *pan_scan;
-
- /**
* Tell user application that palette has changed from previous frame.
* - encoding: ??? (no palette-enabled encoder yet)
* - decoding: Set by libavcodec. (default 0).
@@ -1195,19 +1253,11 @@ typedef struct AVFrame {
int buffer_hints;
/**
- * DCT coefficients
- * - encoding: unused
- * - decoding: Set by libavcodec.
- */
- short *dct_coeff;
-
- /**
- * motion reference frame index
- * the order in which these are stored can depend on the codec.
+ * Pan scan.
* - encoding: Set by user.
* - decoding: Set by libavcodec.
*/
- int8_t *ref_index[2];
+ AVPanScan *pan_scan;
/**
* reordered opaque 64bit (generally an integer or a double precision float
@@ -1230,20 +1280,6 @@ typedef struct AVFrame {
void *hwaccel_picture_private;
/**
- * reordered pts from the last AVPacket that has been input into the decoder
- * - encoding: unused
- * - decoding: Read by user.
- */
- int64_t pkt_pts;
-
- /**
- * dts from the last AVPacket that has been input into the decoder
- * - encoding: unused
- * - decoding: Read by user.
- */
- int64_t pkt_dts;
-
- /**
* the AVCodecContext which ff_thread_get_buffer() was last called on
* - encoding: Set by libavcodec.
* - decoding: Set by libavcodec.
@@ -1258,54 +1294,28 @@ typedef struct AVFrame {
void *thread_opaque;
/**
- * number of audio samples (per channel) described by this frame
+ * log2 of the size of the block which a single vector in motion_val represents:
+ * (4->16x16, 3->8x8, 2-> 4x4, 1-> 2x2)
* - encoding: unused
- * - decoding: Set by libavcodec
+ * - decoding: Set by libavcodec.
*/
- int nb_samples;
+ uint8_t motion_subsample_log2;
/**
- * pointers to the data planes/channels.
- *
- * For video, this should simply point to data[].
- *
- * For planar audio, each channel has a separate data pointer, and
- * linesize[0] contains the size of each channel buffer.
- * For packed audio, there is just one data pointer, and linesize[0]
- * contains the total size of the buffer for all channels.
- *
- * Note: Both data and extended_data will always be set by get_buffer(),
- * but for planar audio with more channels that can fit in data,
- * extended_data must be used by the decoder in order to access all
- * channels.
+ * Sample rate of the audio data.
*
- * encoding: unused
- * decoding: set by AVCodecContext.get_buffer()
- */
- uint8_t **extended_data;
-
- /**
- * sample aspect ratio for the video frame, 0/1 if unknown\unspecified
- * - encoding: unused
- * - decoding: Read by user.
- */
- AVRational sample_aspect_ratio;
-
- /**
- * width and height of the video frame
* - encoding: unused
- * - decoding: Read by user.
+ * - decoding: set by get_buffer()
*/
- int width, height;
+ int sample_rate;
/**
- * format of the frame, -1 if unknown or unset
- * Values correspond to enum PixelFormat for video frames,
- * enum AVSampleFormat for audio)
+ * Channel layout of the audio data.
+ *
* - encoding: unused
- * - decoding: Read by user.
+ * - decoding: set by get_buffer()
*/
- int format;
+ uint64_t channel_layout;
} AVFrame;
struct AVCodecInternal;
@@ -1332,6 +1342,60 @@ typedef struct AVCodecContext {
* - set by avcodec_alloc_context3
*/
const AVClass *av_class;
+ int log_level_offset;
+
+ enum AVMediaType codec_type; /* see AVMEDIA_TYPE_xxx */
+ const struct AVCodec *codec;
+ char codec_name[32];
+ enum AVCodecID codec_id; /* see AV_CODEC_ID_xxx */
+
+ /**
+ * fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
+ * This is used to work around some encoder bugs.
+ * A demuxer should set this to what is stored in the field used to identify the codec.
+ * If there are multiple such fields in a container then the demuxer should choose the one
+ * which maximizes the information about the used codec.
+ * If the codec tag field in a container is larger than 32 bits then the demuxer should
+ * remap the longer ID to 32 bits with a table or other structure. Alternatively a new
+ * extra_codec_tag + size could be added but for this a clear advantage must be demonstrated
+ * first.
+ * - encoding: Set by user, if not then the default based on codec_id will be used.
+ * - decoding: Set by user, will be converted to uppercase by libavcodec during init.
+ */
+ unsigned int codec_tag;
+
+ /**
+ * fourcc from the AVI stream header (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
+ * This is used to work around some encoder bugs.
+ * - encoding: unused
+ * - decoding: Set by user, will be converted to uppercase by libavcodec during init.
+ */
+ unsigned int stream_codec_tag;
+
+#if FF_API_SUB_ID
+ /**
+ * @deprecated this field is unused
+ */
+ attribute_deprecated int sub_id;
+#endif
+
+ void *priv_data;
+
+ /**
+ * Private context used for internal data.
+ *
+ * Unlike priv_data, this is not codec-specific. It is used in general
+ * libavcodec functions.
+ */
+ struct AVCodecInternal *internal;
+
+ /**
+ * Private data of the user, can be used to carry app specific stuff.
+ * - encoding: Set by user.
+ * - decoding: Set by user.
+ */
+ void *opaque;
+
/**
* the average bitrate
* - encoding: Set by user; unused for constant quantizer encoding.
@@ -1348,30 +1412,33 @@ typedef struct AVCodecContext {
int bit_rate_tolerance;
/**
- * CODEC_FLAG_*.
+ * Global quality for codecs which cannot change it per frame.
+ * This should be proportional to MPEG-1/2/4 qscale.
* - encoding: Set by user.
- * - decoding: Set by user.
+ * - decoding: unused
*/
- int flags;
+ int global_quality;
/**
- * Some codecs need additional format info. It is stored here.
- * If any muxer uses this then ALL demuxers/parsers AND encoders for the
- * specific codec MUST set it correctly otherwise stream copy breaks.
- * In general use of this field by muxers is not recommended.
- * - encoding: Set by libavcodec.
- * - decoding: Set by libavcodec. (FIXME: Is this OK?)
+ * - encoding: Set by user.
+ * - decoding: unused
*/
- int sub_id;
+ int compression_level;
+#define FF_COMPRESSION_DEFAULT -1
/**
- * Motion estimation algorithm used for video coding.
- * 1 (zero), 2 (full), 3 (log), 4 (phods), 5 (epzs), 6 (x1), 7 (hex),
- * 8 (umh), 9 (iter), 10 (tesa) [7, 8, 10 are x264 specific, 9 is snow specific]
- * - encoding: MUST be set by user.
- * - decoding: unused
+ * CODEC_FLAG_*.
+ * - encoding: Set by user.
+ * - decoding: Set by user.
*/
- int me_method;
+ int flags;
+
+ /**
+ * CODEC_FLAG2_*
+ * - encoding: Set by user.
+ * - decoding: Set by user.
+ */
+ int flags2;
/**
* some codecs need / can use extradata like Huffman tables.
@@ -1397,6 +1464,39 @@ typedef struct AVCodecContext {
*/
AVRational time_base;
+ /**
+ * For some codecs, the time base is closer to the field rate than the frame rate.
+ * Most notably, H.264 and MPEG-2 specify time_base as half of frame duration
+ * if no telecine is used ...
+ *
+ * Set to time_base ticks per frame. Default 1, e.g., H.264/MPEG-2 set it to 2.
+ */
+ int ticks_per_frame;
+
+ /**
+ * Codec delay.
+ *
+ * Video:
+ * Number of frames the decoded output will be delayed relative to the
+ * encoded input.
+ *
+ * Audio:
+ * For encoding, this is the number of "priming" samples added to the
+ * beginning of the stream. The decoded output will be delayed by this
+ * many samples relative to the input to the encoder. Note that this
+ * field is purely informational and does not directly affect the pts
+ * output by the encoder, which should always be based on the actual
+ * presentation time, including any delay.
+ * For decoding, this is the number of samples the decoder needs to
+ * output before the decoder's output is valid. When seeking, you should
+ * start decoding this many samples prior to your desired seek point.
+ *
+ * - encoding: Set by libavcodec.
+ * - decoding: Set by libavcodec.
+ */
+ int delay;
+
+
/* video only */
/**
* picture width / height.
@@ -1407,6 +1507,13 @@ typedef struct AVCodecContext {
*/
int width, height;
+ /**
+ * Bitstream width / height, may be different from width/height.
+ * - encoding: unused
+ * - decoding: Set by user before init if known. Codec should override / dynamically change if needed.
+ */
+ int coded_width, coded_height;
+
#define FF_ASPECT_EXTENDED 15
/**
@@ -1417,13 +1524,22 @@ typedef struct AVCodecContext {
int gop_size;
/**
- * Pixel format, see PIX_FMT_xxx.
+ * Pixel format, see AV_PIX_FMT_xxx.
* May be set by the demuxer if known from headers.
* May be overriden by the decoder if it knows better.
* - encoding: Set by user.
* - decoding: Set by user if known, overridden by libavcodec if known
*/
- enum PixelFormat pix_fmt;
+ enum AVPixelFormat pix_fmt;
+
+ /**
+ * Motion estimation algorithm used for video coding.
+ * 1 (zero), 2 (full), 3 (log), 4 (phods), 5 (epzs), 6 (x1), 7 (hex),
+ * 8 (umh), 9 (iter), 10 (tesa) [7, 8, 10 are x264 specific, 9 is snow specific]
+ * - encoding: MUST be set by user.
+ * - decoding: unused
+ */
+ int me_method;
/**
* If non NULL, 'draw_horiz_band' is called by the libavcodec
@@ -1452,56 +1568,16 @@ typedef struct AVCodecContext {
const AVFrame *src, int offset[AV_NUM_DATA_POINTERS],
int y, int type, int height);
- /* audio only */
- int sample_rate; ///< samples per second
- int channels; ///< number of audio channels
-
- /**
- * audio sample format
- * - encoding: Set by user.
- * - decoding: Set by libavcodec.
- */
- enum AVSampleFormat sample_fmt; ///< sample format
-
- /* The following data should not be initialized. */
/**
- * Samples per packet, initialized when calling 'init'.
- */
- int frame_size;
- int frame_number; ///< audio or video frame number
-
- /**
- * Number of frames the decoded output will be delayed relative to
- * the encoded input.
- * - encoding: Set by libavcodec.
- * - decoding: unused
- */
- int delay;
-
- /* - encoding parameters */
- float qcompress; ///< amount of qscale change between easy & hard scenes (0.0-1.0)
- float qblur; ///< amount of qscale smoothing over time (0.0-1.0)
-
- /**
- * minimum quantizer
- * - encoding: Set by user.
- * - decoding: unused
- */
- int qmin;
-
- /**
- * maximum quantizer
- * - encoding: Set by user.
- * - decoding: unused
- */
- int qmax;
-
- /**
- * maximum quantizer difference between frames
- * - encoding: Set by user.
- * - decoding: unused
+ * callback to negotiate the pixelFormat
+ * @param fmt is the list of formats which are supported by the codec,
+ * it is terminated by -1 as 0 is a valid format, the formats are ordered by quality.
+ * The first is always the native one.
+ * @return the chosen format
+ * - encoding: unused
+ * - decoding: Set by user, if not set the native format will be chosen.
*/
- int max_qdiff;
+ enum AVPixelFormat (*get_format)(struct AVCodecContext *s, const enum AVPixelFormat * fmt);
/**
* maximum number of B-frames between non-B-frames
@@ -1526,125 +1602,21 @@ typedef struct AVCodecContext {
int b_frame_strategy;
- struct AVCodec *codec;
-
- void *priv_data;
-
- int rtp_payload_size; /* The size of the RTP payload: the coder will */
- /* do its best to deliver a chunk with size */
- /* below rtp_payload_size, the chunk will start */
- /* with a start code on some codecs like H.263. */
- /* This doesn't take account of any particular */
- /* headers inside the transmitted RTP payload. */
-
-
- /* The RTP callback: This function is called */
- /* every time the encoder has a packet to send. */
- /* It depends on the encoder if the data starts */
- /* with a Start Code (it should). H.263 does. */
- /* mb_nb contains the number of macroblocks */
- /* encoded in the RTP payload. */
- void (*rtp_callback)(struct AVCodecContext *avctx, void *data, int size, int mb_nb);
-
- /* statistics, used for 2-pass encoding */
- int mv_bits;
- int header_bits;
- int i_tex_bits;
- int p_tex_bits;
- int i_count;
- int p_count;
- int skip_count;
- int misc_bits;
-
- /**
- * number of bits used for the previously encoded frame
- * - encoding: Set by libavcodec.
- * - decoding: unused
- */
- int frame_bits;
-
- /**
- * Private data of the user, can be used to carry app specific stuff.
- * - encoding: Set by user.
- * - decoding: Set by user.
- */
- void *opaque;
-
- char codec_name[32];
- enum AVMediaType codec_type; /* see AVMEDIA_TYPE_xxx */
- enum CodecID codec_id; /* see CODEC_ID_xxx */
-
- /**
- * fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
- * This is used to work around some encoder bugs.
- * A demuxer should set this to what is stored in the field used to identify the codec.
- * If there are multiple such fields in a container then the demuxer should choose the one
- * which maximizes the information about the used codec.
- * If the codec tag field in a container is larger than 32 bits then the demuxer should
- * remap the longer ID to 32 bits with a table or other structure. Alternatively a new
- * extra_codec_tag + size could be added but for this a clear advantage must be demonstrated
- * first.
- * - encoding: Set by user, if not then the default based on codec_id will be used.
- * - decoding: Set by user, will be converted to uppercase by libavcodec during init.
- */
- unsigned int codec_tag;
-
- /**
- * Work around bugs in encoders which sometimes cannot be detected automatically.
- * - encoding: Set by user
- * - decoding: Set by user
- */
- int workaround_bugs;
-#define FF_BUG_AUTODETECT 1 ///< autodetection
-#define FF_BUG_OLD_MSMPEG4 2
-#define FF_BUG_XVID_ILACE 4
-#define FF_BUG_UMP4 8
-#define FF_BUG_NO_PADDING 16
-#define FF_BUG_AMV 32
-#define FF_BUG_AC_VLC 0 ///< Will be removed, libavcodec can now handle these non-compliant files by default.
-#define FF_BUG_QPEL_CHROMA 64
-#define FF_BUG_STD_QPEL 128
-#define FF_BUG_QPEL_CHROMA2 256
-#define FF_BUG_DIRECT_BLOCKSIZE 512
-#define FF_BUG_EDGE 1024
-#define FF_BUG_HPEL_CHROMA 2048
-#define FF_BUG_DC_CLIP 4096
-#define FF_BUG_MS 8192 ///< Work around various bugs in Microsoft's broken decoders.
-#define FF_BUG_TRUNCATED 16384
-//#define FF_BUG_FAKE_SCALABILITY 16 //Autodetection should work 100%.
-
+#if FF_API_MPV_GLOBAL_OPTS
/**
* luma single coefficient elimination threshold
* - encoding: Set by user.
* - decoding: unused
*/
- int luma_elim_threshold;
+ attribute_deprecated int luma_elim_threshold;
/**
* chroma single coeff elimination threshold
* - encoding: Set by user.
* - decoding: unused
*/
- int chroma_elim_threshold;
-
- /**
- * strictly follow the standard (MPEG4, ...).
- * - encoding: Set by user.
- * - decoding: Set by user.
- * Setting this to STRICT or higher means the encoder and decoder will
- * generally do stupid things, whereas setting it to unofficial or lower
- * will mean the encoder might produce output that is not supported by all
- * spec-compliant decoders. Decoders don't differentiate between normal,
- * unofficial and experimental (that is, they always try to decode things
- * when they can) unless they are explicitly asked to behave stupidly
- * (=strictly conform to the specs)
- */
- int strict_std_compliance;
-#define FF_COMPLIANCE_VERY_STRICT 2 ///< Strictly conform to an older more strict version of the spec or reference software.
-#define FF_COMPLIANCE_STRICT 1 ///< Strictly conform to all the things in the spec no matter what consequences.
-#define FF_COMPLIANCE_NORMAL 0
-#define FF_COMPLIANCE_UNOFFICIAL -1 ///< Allow unofficial extensions
-#define FF_COMPLIANCE_EXPERIMENTAL -2 ///< Allow nonstandardized experimental things.
+ attribute_deprecated int chroma_elim_threshold;
+#endif
/**
* qscale offset between IP and B-frames
@@ -1653,89 +1625,6 @@ typedef struct AVCodecContext {
*/
float b_quant_offset;
-#if FF_API_ER
- /**
- * Error recognition; higher values will detect more errors but may
- * misdetect some more or less valid parts as errors.
- * - encoding: unused
- * - decoding: Set by user.
- */
- attribute_deprecated int error_recognition;
-#define FF_ER_CAREFUL 1
-#define FF_ER_COMPLIANT 2
-#define FF_ER_AGGRESSIVE 3
-#define FF_ER_VERY_AGGRESSIVE 4
-#define FF_ER_EXPLODE 5
-#endif /* FF_API_ER */
-
- /**
- * Called at the beginning of each frame to get a buffer for it.
- *
- * The function will set AVFrame.data[], AVFrame.linesize[].
- * AVFrame.extended_data[] must also be set, but it should be the same as
- * AVFrame.data[] except for planar audio with more channels than can fit
- * in AVFrame.data[]. In that case, AVFrame.data[] shall still contain as
- * many data pointers as it can hold.
- *
- * if CODEC_CAP_DR1 is not set then get_buffer() must call
- * avcodec_default_get_buffer() instead of providing buffers allocated by
- * some other means.
- *
- * AVFrame.data[] should be 32- or 16-byte-aligned unless the CPU doesn't
- * need it. avcodec_default_get_buffer() aligns the output buffer properly,
- * but if get_buffer() is overridden then alignment considerations should
- * be taken into account.
- *
- * @see avcodec_default_get_buffer()
- *
- * Video:
- *
- * If pic.reference is set then the frame will be read later by libavcodec.
- * avcodec_align_dimensions2() should be used to find the required width and
- * height, as they normally need to be rounded up to the next multiple of 16.
- *
- * If frame multithreading is used and thread_safe_callbacks is set,
- * it may be called from a different thread, but not from more than one at
- * once. Does not need to be reentrant.
- *
- * @see release_buffer(), reget_buffer()
- * @see avcodec_align_dimensions2()
- *
- * Audio:
- *
- * Decoders request a buffer of a particular size by setting
- * AVFrame.nb_samples prior to calling get_buffer(). The decoder may,
- * however, utilize only part of the buffer by setting AVFrame.nb_samples
- * to a smaller value in the output frame.
- *
- * Decoders cannot use the buffer after returning from
- * avcodec_decode_audio4(), so they will not call release_buffer(), as it
- * is assumed to be released immediately upon return.
- *
- * As a convenience, av_samples_get_buffer_size() and
- * av_samples_fill_arrays() in libavutil may be used by custom get_buffer()
- * functions to find the required data size and to fill data pointers and
- * linesize. In AVFrame.linesize, only linesize[0] may be set for audio
- * since all planes must be the same size.
- *
- * @see av_samples_get_buffer_size(), av_samples_fill_arrays()
- *
- * - encoding: unused
- * - decoding: Set by libavcodec, user can override.
- */
- int (*get_buffer)(struct AVCodecContext *c, AVFrame *pic);
-
- /**
- * Called to release buffers which were allocated with get_buffer.
- * A released buffer can be reused in get_buffer().
- * pic.data[*] must be set to NULL.
- * May be called from a different thread if frame multithreading is used,
- * but not by more than one thread at once, so does not need to be reentrant.
- * - encoding: unused
- * - decoding: Set by libavcodec, user can override.
- */
- void (*release_buffer)(struct AVCodecContext *c, AVFrame *pic);
-
/**
* Size of the frame reordering buffer in the decoder.
* For MPEG-2 it is 1 IPB or 0 low delay IP.
@@ -1745,22 +1634,6 @@ typedef struct AVCodecContext {
int has_b_frames;
/**
- * number of bytes per packet if constant and known or 0
- * Used by some WAV based audio codecs.
- */
- int block_align;
-
-#if FF_API_PARSE_FRAME
- /**
- * If true, only parsing is done. The frame data is returned.
- * Only MPEG audio decoders support this now.
- * - encoding: unused
- * - decoding: Set by user
- */
- attribute_deprecated int parse_only;
-#endif
-
- /**
* 0-> h263 quant 1-> mpeg quant
* - encoding: Set by user.
* - decoding: unused
@@ -1768,69 +1641,6 @@ typedef struct AVCodecContext {
int mpeg_quant;
/**
- * pass1 encoding statistics output buffer
- * - encoding: Set by libavcodec.
- * - decoding: unused
- */
- char *stats_out;
-
- /**
- * pass2 encoding statistics input buffer
- * Concatenated stuff from stats_out of pass1 should be placed here.
- * - encoding: Allocated/set/freed by user.
- * - decoding: unused
- */
- char *stats_in;
-
- /**
- * ratecontrol qmin qmax limiting method
- * 0-> clipping, 1-> use a nice continous function to limit qscale wthin qmin/qmax.
- * - encoding: Set by user.
- * - decoding: unused
- */
- float rc_qsquish;
-
- float rc_qmod_amp;
- int rc_qmod_freq;
-
- /**
- * ratecontrol override, see RcOverride
- * - encoding: Allocated/set/freed by user.
- * - decoding: unused
- */
- RcOverride *rc_override;
- int rc_override_count;
-
- /**
- * rate control equation
- * - encoding: Set by user
- * - decoding: unused
- */
- const char *rc_eq;
-
- /**
- * maximum bitrate
- * - encoding: Set by user.
- * - decoding: unused
- */
- int rc_max_rate;
-
- /**
- * minimum bitrate
- * - encoding: Set by user.
- * - decoding: unused
- */
- int rc_min_rate;
-
- /**
- * decoder bitstream buffer size
- * - encoding: Set by user.
- * - decoding: unused
- */
- int rc_buffer_size;
- float rc_buffer_aggressivity;
-
- /**
* qscale factor between P and I-frames
* If > 0 then the last p frame quantizer will be used (q= lastp_q*factor+offset).
* If < 0 then normal ratecontrol will be done (q= -normal_q*factor+offset).
@@ -1847,27 +1657,6 @@ typedef struct AVCodecContext {
float i_quant_offset;
/**
- * initial complexity for pass1 ratecontrol
- * - encoding: Set by user.
- * - decoding: unused
- */
- float rc_initial_cplx;
-
- /**
- * DCT algorithm, see FF_DCT_* below
- * - encoding: Set by user.
- * - decoding: unused
- */
- int dct_algo;
-#define FF_DCT_AUTO 0
-#define FF_DCT_FASTINT 1
-#define FF_DCT_INT 2
-#define FF_DCT_MMX 3
-#define FF_DCT_MLIB 4
-#define FF_DCT_ALTIVEC 5
-#define FF_DCT_FAAN 6
-
- /**
* luminance masking (0-> disabled)
* - encoding: Set by user.
* - decoding: unused
@@ -1903,77 +1692,12 @@ typedef struct AVCodecContext {
float dark_masking;
/**
- * IDCT algorithm, see FF_IDCT_* below.
- * - encoding: Set by user.
- * - decoding: Set by user.
- */
- int idct_algo;
-#define FF_IDCT_AUTO 0
-#define FF_IDCT_INT 1
-#define FF_IDCT_SIMPLE 2
-#define FF_IDCT_SIMPLEMMX 3
-#define FF_IDCT_LIBMPEG2MMX 4
-#define FF_IDCT_PS2 5
-#define FF_IDCT_MLIB 6
-#define FF_IDCT_ARM 7
-#define FF_IDCT_ALTIVEC 8
-#define FF_IDCT_SH4 9
-#define FF_IDCT_SIMPLEARM 10
-#define FF_IDCT_H264 11
-#define FF_IDCT_VP3 12
-#define FF_IDCT_IPP 13
-#define FF_IDCT_XVIDMMX 14
-#define FF_IDCT_CAVS 15
-#define FF_IDCT_SIMPLEARMV5TE 16
-#define FF_IDCT_SIMPLEARMV6 17
-#define FF_IDCT_SIMPLEVIS 18
-#define FF_IDCT_WMV2 19
-#define FF_IDCT_FAAN 20
-#define FF_IDCT_EA 21
-#define FF_IDCT_SIMPLENEON 22
-#define FF_IDCT_SIMPLEALPHA 23
-#define FF_IDCT_BINK 24
-
- /**
* slice count
* - encoding: Set by libavcodec.
* - decoding: Set by user (or 0).
*/
int slice_count;
/**
- * slice offsets in the frame in bytes
- * - encoding: Set/allocated by libavcodec.
- * - decoding: Set/allocated by user (or NULL).
- */
- int *slice_offset;
-
- /**
- * error concealment flags
- * - encoding: unused
- * - decoding: Set by user.
- */
- int error_concealment;
-#define FF_EC_GUESS_MVS 1
-#define FF_EC_DEBLOCK 2
-
- /**
- * dsp_mask could be add used to disable unwanted CPU features
- * CPU features (i.e. MMX, SSE. ...)
- *
- * With the FORCE flag you may instead enable given CPU features.
- * (Dangerous: Usable in case of misdetection, improper usage however will
- * result into program crash.)
- */
- unsigned dsp_mask;
-
- /**
- * bits per sample/pixel from the demuxer (needed for huffyuv).
- * - encoding: Set by libavcodec.
- * - decoding: Set by user.
- */
- int bits_per_coded_sample;
-
- /**
* prediction method (needed for huffyuv)
* - encoding: Set by user.
* - decoding: unused
@@ -1984,6 +1708,13 @@ typedef struct AVCodecContext {
#define FF_PRED_MEDIAN 2
/**
+ * slice offsets in the frame in bytes
+ * - encoding: Set/allocated by libavcodec.
+ * - decoding: Set/allocated by user (or NULL).
+ */
+ int *slice_offset;
+
+ /**
* sample aspect ratio (0 if unknown)
* That is the width of a pixel divided by the height of the pixel.
* Numerator and denominator must be relatively prime and smaller than 256 for some video standards.
@@ -1993,54 +1724,6 @@ typedef struct AVCodecContext {
AVRational sample_aspect_ratio;
/**
- * the picture in the bitstream
- * - encoding: Set by libavcodec.
- * - decoding: Set by libavcodec.
- */
- AVFrame *coded_frame;
-
- /**
- * debug
- * - encoding: Set by user.
- * - decoding: Set by user.
- */
- int debug;
-#define FF_DEBUG_PICT_INFO 1
-#define FF_DEBUG_RC 2
-#define FF_DEBUG_BITSTREAM 4
-#define FF_DEBUG_MB_TYPE 8
-#define FF_DEBUG_QP 16
-#define FF_DEBUG_MV 32
-#define FF_DEBUG_DCT_COEFF 0x00000040
-#define FF_DEBUG_SKIP 0x00000080
-#define FF_DEBUG_STARTCODE 0x00000100
-#define FF_DEBUG_PTS 0x00000200
-#define FF_DEBUG_ER 0x00000400
-#define FF_DEBUG_MMCO 0x00000800
-#define FF_DEBUG_BUGS 0x00001000
-#define FF_DEBUG_VIS_QP 0x00002000
-#define FF_DEBUG_VIS_MB_TYPE 0x00004000
-#define FF_DEBUG_BUFFERS 0x00008000
-#define FF_DEBUG_THREADS 0x00010000
-
- /**
- * debug
- * - encoding: Set by user.
- * - decoding: Set by user.
- */
- int debug_mv;
-#define FF_DEBUG_VIS_MV_P_FOR 0x00000001 //visualize forward predicted MVs of P frames
-#define FF_DEBUG_VIS_MV_B_FOR 0x00000002 //visualize forward predicted MVs of B frames
-#define FF_DEBUG_VIS_MV_B_BACK 0x00000004 //visualize backward predicted MVs of B frames
-
- /**
- * error
- * - encoding: Set by libavcodec if flags&CODEC_FLAG_PSNR.
- * - decoding: unused
- */
- uint64_t error[AV_NUM_DATA_POINTERS];
-
- /**
* motion estimation comparison function
* - encoding: Set by user.
* - decoding: unused
@@ -2124,17 +1807,6 @@ typedef struct AVCodecContext {
int me_subpel_quality;
/**
- * callback to negotiate the pixelFormat
- * @param fmt is the list of formats which are supported by the codec,
- * it is terminated by -1 as 0 is a valid format, the formats are ordered by quality.
- * The first is always the native one.
- * @return the chosen format
- * - encoding: unused
- * - decoding: Set by user, if not set the native format will be chosen.
- */
- enum PixelFormat (*get_format)(struct AVCodecContext *s, const enum PixelFormat * fmt);
-
- /**
* DTG active format information (additional aspect ratio
* information only used in DVB MPEG-2 transport streams)
* 0 if not set.
@@ -2175,63 +1847,14 @@ typedef struct AVCodecContext {
*/
int inter_quant_bias;
+#if FF_API_COLOR_TABLE_ID
/**
* color table ID
* - encoding: unused
* - decoding: Which clrtable should be used for 8bit RGB images.
* Tables have to be stored somewhere. FIXME
*/
- int color_table_id;
-
-#if FF_API_INTERNAL_CONTEXT
- /**
- * internal_buffer count
- * Don't touch, used by libavcodec default_get_buffer().
- * @deprecated this field was moved to an internal context
- */
- attribute_deprecated int internal_buffer_count;
-
- /**
- * internal_buffers
- * Don't touch, used by libavcodec default_get_buffer().
- * @deprecated this field was moved to an internal context
- */
- attribute_deprecated void *internal_buffer;
-#endif
-
- /**
- * Global quality for codecs which cannot change it per frame.
- * This should be proportional to MPEG-1/2/4 qscale.
- * - encoding: Set by user.
- * - decoding: unused
- */
- int global_quality;
-
-#define FF_CODER_TYPE_VLC 0
-#define FF_CODER_TYPE_AC 1
-#define FF_CODER_TYPE_RAW 2
-#define FF_CODER_TYPE_RLE 3
-#define FF_CODER_TYPE_DEFLATE 4
- /**
- * coder type
- * - encoding: Set by user.
- * - decoding: unused
- */
- int coder_type;
-
- /**
- * context model
- * - encoding: Set by user.
- * - decoding: unused
- */
- int context_model;
-#if 0
- /**
- *
- * - encoding: unused
- * - decoding: Set by user.
- */
- uint8_t * (*realloc)(struct AVCodecContext *s, uint8_t *buf, int buf_size);
+ attribute_deprecated int color_table_id;
#endif
/**
@@ -2276,14 +1899,6 @@ typedef struct AVCodecContext {
uint16_t *inter_matrix;
/**
- * fourcc from the AVI stream header (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
- * This is used to work around some encoder bugs.
- * - encoding: unused
- * - decoding: Set by user, will be converted to uppercase by libavcodec during init.
- */
- unsigned int stream_codec_tag;
-
- /**
* scene change detection threshold
* 0 is default, larger means fewer detected scene changes.
* - encoding: Set by user.
@@ -2292,482 +1907,541 @@ typedef struct AVCodecContext {
int scenechange_threshold;
/**
- * minimum Lagrange multipler
+ * noise reduction strength
* - encoding: Set by user.
* - decoding: unused
*/
- int lmin;
+ int noise_reduction;
+#if FF_API_INTER_THRESHOLD
/**
- * maximum Lagrange multipler
- * - encoding: Set by user.
- * - decoding: unused
+ * @deprecated this field is unused
*/
- int lmax;
+ attribute_deprecated int inter_threshold;
+#endif
-#if FF_API_PALETTE_CONTROL
+#if FF_API_MPV_GLOBAL_OPTS
/**
- * palette control structure
- * - encoding: ??? (no palette-enabled encoder yet)
- * - decoding: Set by user.
+ * @deprecated use mpegvideo private options instead
*/
- struct AVPaletteControl *palctrl;
+ attribute_deprecated int quantizer_noise_shaping;
#endif
/**
- * noise reduction strength
+ * Motion estimation threshold below which no motion estimation is
+ * performed, but instead the user specified motion vectors are used.
+ *
* - encoding: Set by user.
* - decoding: unused
*/
- int noise_reduction;
+ int me_threshold;
/**
- * Called at the beginning of a frame to get cr buffer for it.
- * Buffer type (size, hints) must be the same. libavcodec won't check it.
- * libavcodec will pass previous buffer in pic, function should return
- * same buffer or new buffer with old frame "painted" into it.
- * If pic.data[0] == NULL must behave like get_buffer().
- * if CODEC_CAP_DR1 is not set then reget_buffer() must call
- * avcodec_default_reget_buffer() instead of providing buffers allocated by
- * some other means.
- * - encoding: unused
- * - decoding: Set by libavcodec, user can override.
+ * Macroblock threshold below which the user specified macroblock types will be used.
+ * - encoding: Set by user.
+ * - decoding: unused
*/
- int (*reget_buffer)(struct AVCodecContext *c, AVFrame *pic);
+ int mb_threshold;
/**
- * Number of bits which should be loaded into the rc buffer before decoding starts.
+ * precision of the intra DC coefficient - 8
* - encoding: Set by user.
* - decoding: unused
*/
- int rc_initial_buffer_occupancy;
+ int intra_dc_precision;
/**
- *
+ * Number of macroblock rows at the top which are skipped.
+ * - encoding: unused
+ * - decoding: Set by user.
+ */
+ int skip_top;
+
+ /**
+ * Number of macroblock rows at the bottom which are skipped.
+ * - encoding: unused
+ * - decoding: Set by user.
+ */
+ int skip_bottom;
+
+ /**
+ * Border processing masking, raises the quantizer for mbs on the borders
+ * of the picture.
* - encoding: Set by user.
* - decoding: unused
*/
- int inter_threshold;
+ float border_masking;
/**
- * CODEC_FLAG2_*
+ * minimum MB lagrange multipler
* - encoding: Set by user.
- * - decoding: Set by user.
+ * - decoding: unused
*/
- int flags2;
+ int mb_lmin;
/**
- * Simulates errors in the bitstream to test error concealment.
+ * maximum MB lagrange multipler
* - encoding: Set by user.
* - decoding: unused
*/
- int error_rate;
+ int mb_lmax;
-#if FF_API_ANTIALIAS_ALGO
/**
- * MP3 antialias algorithm, see FF_AA_* below.
- * - encoding: unused
- * - decoding: Set by user.
+ *
+ * - encoding: Set by user.
+ * - decoding: unused
*/
- attribute_deprecated int antialias_algo;
-#define FF_AA_AUTO 0
-#define FF_AA_FASTINT 1 //not implemented yet
-#define FF_AA_INT 2
-#define FF_AA_FLOAT 3
-#endif
+ int me_penalty_compensation;
/**
- * quantizer noise shaping
+ *
* - encoding: Set by user.
* - decoding: unused
*/
- int quantizer_noise_shaping;
+ int bidir_refine;
/**
- * thread count
- * is used to decide how many independent tasks should be passed to execute()
+ *
* - encoding: Set by user.
- * - decoding: Set by user.
+ * - decoding: unused
*/
- int thread_count;
+ int brd_scale;
/**
- * The codec may call this to execute several independent things.
- * It will return only after finishing all tasks.
- * The user may replace this with some multithreaded implementation,
- * the default implementation will execute the parts serially.
- * @param count the number of things to execute
- * - encoding: Set by libavcodec, user can override.
- * - decoding: Set by libavcodec, user can override.
+ * minimum GOP size
+ * - encoding: Set by user.
+ * - decoding: unused
*/
- int (*execute)(struct AVCodecContext *c, int (*func)(struct AVCodecContext *c2, void *arg), void *arg2, int *ret, int count, int size);
+ int keyint_min;
/**
- * thread opaque
- * Can be used by execute() to store some per AVCodecContext stuff.
- * - encoding: set by execute()
- * - decoding: set by execute()
+ * number of reference frames
+ * - encoding: Set by user.
+ * - decoding: Set by lavc.
*/
- void *thread_opaque;
+ int refs;
/**
- * Motion estimation threshold below which no motion estimation is
- * performed, but instead the user specified motion vectors are used.
- *
+ * chroma qp offset from luma
* - encoding: Set by user.
* - decoding: unused
*/
- int me_threshold;
+ int chromaoffset;
/**
- * Macroblock threshold below which the user specified macroblock types will be used.
+ * Multiplied by qscale for each frame and added to scene_change_score.
* - encoding: Set by user.
* - decoding: unused
*/
- int mb_threshold;
+ int scenechange_factor;
/**
- * precision of the intra DC coefficient - 8
+ *
+ * Note: Value depends upon the compare function used for fullpel ME.
* - encoding: Set by user.
* - decoding: unused
*/
- int intra_dc_precision;
+ int mv0_threshold;
/**
- * noise vs. sse weight for the nsse comparsion function
+ * Adjust sensitivity of b_frame_strategy 1.
* - encoding: Set by user.
* - decoding: unused
*/
- int nsse_weight;
+ int b_sensitivity;
/**
- * Number of macroblock rows at the top which are skipped.
- * - encoding: unused
- * - decoding: Set by user.
+ * Chromaticity coordinates of the source primaries.
+ * - encoding: Set by user
+ * - decoding: Set by libavcodec
*/
- int skip_top;
+ enum AVColorPrimaries color_primaries;
/**
- * Number of macroblock rows at the bottom which are skipped.
- * - encoding: unused
- * - decoding: Set by user.
+ * Color Transfer Characteristic.
+ * - encoding: Set by user
+ * - decoding: Set by libavcodec
*/
- int skip_bottom;
+ enum AVColorTransferCharacteristic color_trc;
/**
- * profile
- * - encoding: Set by user.
- * - decoding: Set by libavcodec.
+ * YUV colorspace type.
+ * - encoding: Set by user
+ * - decoding: Set by libavcodec
*/
- int profile;
-#define FF_PROFILE_UNKNOWN -99
-#define FF_PROFILE_RESERVED -100
-
-#define FF_PROFILE_AAC_MAIN 0
-#define FF_PROFILE_AAC_LOW 1
-#define FF_PROFILE_AAC_SSR 2
-#define FF_PROFILE_AAC_LTP 3
-
-#define FF_PROFILE_DTS 20
-#define FF_PROFILE_DTS_ES 30
-#define FF_PROFILE_DTS_96_24 40
-#define FF_PROFILE_DTS_HD_HRA 50
-#define FF_PROFILE_DTS_HD_MA 60
+ enum AVColorSpace colorspace;
-#define FF_PROFILE_MPEG2_422 0
-#define FF_PROFILE_MPEG2_HIGH 1
-#define FF_PROFILE_MPEG2_SS 2
-#define FF_PROFILE_MPEG2_SNR_SCALABLE 3
-#define FF_PROFILE_MPEG2_MAIN 4
-#define FF_PROFILE_MPEG2_SIMPLE 5
+ /**
+ * MPEG vs JPEG YUV range.
+ * - encoding: Set by user
+ * - decoding: Set by libavcodec
+ */
+ enum AVColorRange color_range;
-#define FF_PROFILE_H264_CONSTRAINED (1<<9) // 8+1; constraint_set1_flag
-#define FF_PROFILE_H264_INTRA (1<<11) // 8+3; constraint_set3_flag
+ /**
+ * This defines the location of chroma samples.
+ * - encoding: Set by user
+ * - decoding: Set by libavcodec
+ */
+ enum AVChromaLocation chroma_sample_location;
-#define FF_PROFILE_H264_BASELINE 66
-#define FF_PROFILE_H264_CONSTRAINED_BASELINE (66|FF_PROFILE_H264_CONSTRAINED)
-#define FF_PROFILE_H264_MAIN 77
-#define FF_PROFILE_H264_EXTENDED 88
-#define FF_PROFILE_H264_HIGH 100
-#define FF_PROFILE_H264_HIGH_10 110
-#define FF_PROFILE_H264_HIGH_10_INTRA (110|FF_PROFILE_H264_INTRA)
-#define FF_PROFILE_H264_HIGH_422 122
-#define FF_PROFILE_H264_HIGH_422_INTRA (122|FF_PROFILE_H264_INTRA)
-#define FF_PROFILE_H264_HIGH_444 144
-#define FF_PROFILE_H264_HIGH_444_PREDICTIVE 244
-#define FF_PROFILE_H264_HIGH_444_INTRA (244|FF_PROFILE_H264_INTRA)
-#define FF_PROFILE_H264_CAVLC_444 44
+ /**
+ * Number of slices.
+ * Indicates number of picture subdivisions. Used for parallelized
+ * decoding.
+ * - encoding: Set by user
+ * - decoding: unused
+ */
+ int slices;
-#define FF_PROFILE_VC1_SIMPLE 0
-#define FF_PROFILE_VC1_MAIN 1
-#define FF_PROFILE_VC1_COMPLEX 2
-#define FF_PROFILE_VC1_ADVANCED 3
+ /** Field order
+ * - encoding: set by libavcodec
+ * - decoding: Set by libavcodec
+ */
+ enum AVFieldOrder field_order;
-#define FF_PROFILE_MPEG4_SIMPLE 0
-#define FF_PROFILE_MPEG4_SIMPLE_SCALABLE 1
-#define FF_PROFILE_MPEG4_CORE 2
-#define FF_PROFILE_MPEG4_MAIN 3
-#define FF_PROFILE_MPEG4_N_BIT 4
-#define FF_PROFILE_MPEG4_SCALABLE_TEXTURE 5
-#define FF_PROFILE_MPEG4_SIMPLE_FACE_ANIMATION 6
-#define FF_PROFILE_MPEG4_BASIC_ANIMATED_TEXTURE 7
-#define FF_PROFILE_MPEG4_HYBRID 8
-#define FF_PROFILE_MPEG4_ADVANCED_REAL_TIME 9
-#define FF_PROFILE_MPEG4_CORE_SCALABLE 10
-#define FF_PROFILE_MPEG4_ADVANCED_CODING 11
-#define FF_PROFILE_MPEG4_ADVANCED_CORE 12
-#define FF_PROFILE_MPEG4_ADVANCED_SCALABLE_TEXTURE 13
-#define FF_PROFILE_MPEG4_SIMPLE_STUDIO 14
-#define FF_PROFILE_MPEG4_ADVANCED_SIMPLE 15
+ /* audio only */
+ int sample_rate; ///< samples per second
+ int channels; ///< number of audio channels
/**
- * level
+ * audio sample format
* - encoding: Set by user.
* - decoding: Set by libavcodec.
*/
- int level;
-#define FF_LEVEL_UNKNOWN -99
+ enum AVSampleFormat sample_fmt; ///< sample format
+ /* The following data should not be initialized. */
/**
- * low resolution decoding, 1-> 1/2 size, 2->1/4 size
- * - encoding: unused
- * - decoding: Set by user.
+ * Number of samples per channel in an audio frame.
+ *
+ * - encoding: set by libavcodec in avcodec_open2(). Each submitted frame
+ * except the last must contain exactly frame_size samples per channel.
+ * May be 0 when the codec has CODEC_CAP_VARIABLE_FRAME_SIZE set, then the
+ * frame size is not restricted.
+ * - decoding: may be set by some decoders to indicate constant frame size
*/
- int lowres;
+ int frame_size;
/**
- * Bitstream width / height, may be different from width/height if lowres enabled.
- * - encoding: unused
- * - decoding: Set by user before init if known. Codec should override / dynamically change if needed.
+ * Frame counter, set by libavcodec.
+ *
+ * - decoding: total number of frames returned from the decoder so far.
+ * - encoding: total number of frames passed to the encoder so far.
+ *
+ * @note the counter is not incremented if encoding/decoding resulted in
+ * an error.
*/
- int coded_width, coded_height;
+ int frame_number;
/**
- * frame skip threshold
- * - encoding: Set by user.
- * - decoding: unused
+ * number of bytes per packet if constant and known or 0
+ * Used by some WAV based audio codecs.
*/
- int frame_skip_threshold;
+ int block_align;
/**
- * frame skip factor
+ * Audio cutoff bandwidth (0 means "automatic")
* - encoding: Set by user.
* - decoding: unused
*/
- int frame_skip_factor;
+ int cutoff;
+#if FF_API_REQUEST_CHANNELS
/**
- * frame skip exponent
- * - encoding: Set by user.
- * - decoding: unused
+ * Decoder should decode to this many channels if it can (0 for default)
+ * - encoding: unused
+ * - decoding: Set by user.
+ * @deprecated Deprecated in favor of request_channel_layout.
*/
- int frame_skip_exp;
+ int request_channels;
+#endif
/**
- * frame skip comparison function
- * - encoding: Set by user.
- * - decoding: unused
+ * Audio channel layout.
+ * - encoding: set by user.
+ * - decoding: set by libavcodec.
*/
- int frame_skip_cmp;
+ uint64_t channel_layout;
/**
- * Border processing masking, raises the quantizer for mbs on the borders
- * of the picture.
- * - encoding: Set by user.
- * - decoding: unused
+ * Request decoder to use this channel layout if it can (0 for default)
+ * - encoding: unused
+ * - decoding: Set by user.
*/
- float border_masking;
+ uint64_t request_channel_layout;
/**
- * minimum MB lagrange multipler
+ * Type of service that the audio stream conveys.
* - encoding: Set by user.
- * - decoding: unused
+ * - decoding: Set by libavcodec.
*/
- int mb_lmin;
+ enum AVAudioServiceType audio_service_type;
/**
- * maximum MB lagrange multipler
- * - encoding: Set by user.
- * - decoding: unused
+ * Used to request a sample format from the decoder.
+ * - encoding: unused.
+ * - decoding: Set by user.
*/
- int mb_lmax;
+ enum AVSampleFormat request_sample_fmt;
/**
+ * Called at the beginning of each frame to get a buffer for it.
*
- * - encoding: Set by user.
- * - decoding: unused
- */
- int me_penalty_compensation;
-
- /**
+ * The function will set AVFrame.data[], AVFrame.linesize[].
+ * AVFrame.extended_data[] must also be set, but it should be the same as
+ * AVFrame.data[] except for planar audio with more channels than can fit
+ * in AVFrame.data[]. In that case, AVFrame.data[] shall still contain as
+ * many data pointers as it can hold.
+ *
+ * if CODEC_CAP_DR1 is not set then get_buffer() must call
+ * avcodec_default_get_buffer() instead of providing buffers allocated by
+ * some other means.
+ *
+ * AVFrame.data[] should be 32- or 16-byte-aligned unless the CPU doesn't
+ * need it. avcodec_default_get_buffer() aligns the output buffer properly,
+ * but if get_buffer() is overridden then alignment considerations should
+ * be taken into account.
+ *
+ * @see avcodec_default_get_buffer()
+ *
+ * Video:
+ *
+ * If pic.reference is set then the frame will be read later by libavcodec.
+ * avcodec_align_dimensions2() should be used to find the required width and
+ * height, as they normally need to be rounded up to the next multiple of 16.
+ *
+ * If frame multithreading is used and thread_safe_callbacks is set,
+ * it may be called from a different thread, but not from more than one at
+ * once. Does not need to be reentrant.
+ *
+ * @see release_buffer(), reget_buffer()
+ * @see avcodec_align_dimensions2()
+ *
+ * Audio:
+ *
+ * Decoders request a buffer of a particular size by setting
+ * AVFrame.nb_samples prior to calling get_buffer(). The decoder may,
+ * however, utilize only part of the buffer by setting AVFrame.nb_samples
+ * to a smaller value in the output frame.
+ *
+ * Decoders cannot use the buffer after returning from
+ * avcodec_decode_audio4(), so they will not call release_buffer(), as it
+ * is assumed to be released immediately upon return. In some rare cases,
+ * a decoder may need to call get_buffer() more than once in a single
+ * call to avcodec_decode_audio4(). In that case, when get_buffer() is
+ * called again after it has already been called once, the previously
+ * acquired buffer is assumed to be released at that time and may not be
+ * reused by the decoder.
+ *
+ * As a convenience, av_samples_get_buffer_size() and
+ * av_samples_fill_arrays() in libavutil may be used by custom get_buffer()
+ * functions to find the required data size and to fill data pointers and
+ * linesize. In AVFrame.linesize, only linesize[0] may be set for audio
+ * since all planes must be the same size.
+ *
+ * @see av_samples_get_buffer_size(), av_samples_fill_arrays()
*
* - encoding: unused
- * - decoding: Set by user.
+ * - decoding: Set by libavcodec, user can override.
*/
- enum AVDiscard skip_loop_filter;
+ int (*get_buffer)(struct AVCodecContext *c, AVFrame *pic);
/**
- *
+ * Called to release buffers which were allocated with get_buffer.
+ * A released buffer can be reused in get_buffer().
+ * pic.data[*] must be set to NULL.
+ * May be called from a different thread if frame multithreading is used,
+ * but not by more than one thread at once, so does not need to be reentrant.
* - encoding: unused
- * - decoding: Set by user.
+ * - decoding: Set by libavcodec, user can override.
*/
- enum AVDiscard skip_idct;
+ void (*release_buffer)(struct AVCodecContext *c, AVFrame *pic);
/**
- *
+ * Called at the beginning of a frame to get cr buffer for it.
+ * Buffer type (size, hints) must be the same. libavcodec won't check it.
+ * libavcodec will pass previous buffer in pic, function should return
+ * same buffer or new buffer with old frame "painted" into it.
+ * If pic.data[0] == NULL must behave like get_buffer().
+ * if CODEC_CAP_DR1 is not set then reget_buffer() must call
+ * avcodec_default_reget_buffer() instead of providing buffers allocated by
+ * some other means.
* - encoding: unused
- * - decoding: Set by user.
+ * - decoding: Set by libavcodec, user can override.
*/
- enum AVDiscard skip_frame;
+ int (*reget_buffer)(struct AVCodecContext *c, AVFrame *pic);
+
+
+ /* - encoding parameters */
+ float qcompress; ///< amount of qscale change between easy & hard scenes (0.0-1.0)
+ float qblur; ///< amount of qscale smoothing over time (0.0-1.0)
/**
- *
+ * minimum quantizer
* - encoding: Set by user.
* - decoding: unused
*/
- int bidir_refine;
+ int qmin;
/**
- *
+ * maximum quantizer
* - encoding: Set by user.
* - decoding: unused
*/
- int brd_scale;
+ int qmax;
-#if FF_API_X264_GLOBAL_OPTS
/**
- * constant rate factor - quality-based VBR - values ~correspond to qps
+ * maximum quantizer difference between frames
* - encoding: Set by user.
* - decoding: unused
- * @deprecated use 'crf' libx264 private option
*/
- attribute_deprecated float crf;
+ int max_qdiff;
/**
- * constant quantization parameter rate control method
+ * ratecontrol qmin qmax limiting method
+ * 0-> clipping, 1-> use a nice continuous function to limit qscale wthin qmin/qmax.
* - encoding: Set by user.
* - decoding: unused
- * @deprecated use 'cqp' libx264 private option
*/
- attribute_deprecated int cqp;
-#endif
+ float rc_qsquish;
+
+ float rc_qmod_amp;
+ int rc_qmod_freq;
/**
- * minimum GOP size
+ * decoder bitstream buffer size
* - encoding: Set by user.
* - decoding: unused
*/
- int keyint_min;
+ int rc_buffer_size;
/**
- * number of reference frames
- * - encoding: Set by user.
- * - decoding: Set by lavc.
+ * ratecontrol override, see RcOverride
+ * - encoding: Allocated/set/freed by user.
+ * - decoding: unused
*/
- int refs;
+ int rc_override_count;
+ RcOverride *rc_override;
/**
- * chroma qp offset from luma
+ * rate control equation
+ * - encoding: Set by user
+ * - decoding: unused
+ */
+ const char *rc_eq;
+
+ /**
+ * maximum bitrate
* - encoding: Set by user.
* - decoding: unused
*/
- int chromaoffset;
+ int rc_max_rate;
-#if FF_API_X264_GLOBAL_OPTS
/**
- * Influence how often B-frames are used.
+ * minimum bitrate
* - encoding: Set by user.
* - decoding: unused
*/
- attribute_deprecated int bframebias;
-#endif
+ int rc_min_rate;
+
+ float rc_buffer_aggressivity;
/**
- * trellis RD quantization
+ * initial complexity for pass1 ratecontrol
* - encoding: Set by user.
* - decoding: unused
*/
- int trellis;
+ float rc_initial_cplx;
-#if FF_API_X264_GLOBAL_OPTS
/**
- * Reduce fluctuations in qp (before curve compression).
+ * Ratecontrol attempt to use, at maximum, <value> of what can be used without an underflow.
+ * - encoding: Set by user.
+ * - decoding: unused.
+ */
+ float rc_max_available_vbv_use;
+
+ /**
+ * Ratecontrol attempt to use, at least, <value> times the amount needed to prevent a vbv overflow.
+ * - encoding: Set by user.
+ * - decoding: unused.
+ */
+ float rc_min_vbv_overflow_use;
+
+ /**
+ * Number of bits which should be loaded into the rc buffer before decoding starts.
* - encoding: Set by user.
* - decoding: unused
*/
- attribute_deprecated float complexityblur;
+ int rc_initial_buffer_occupancy;
+#define FF_CODER_TYPE_VLC 0
+#define FF_CODER_TYPE_AC 1
+#define FF_CODER_TYPE_RAW 2
+#define FF_CODER_TYPE_RLE 3
+#define FF_CODER_TYPE_DEFLATE 4
/**
- * in-loop deblocking filter alphac0 parameter
- * alpha is in the range -6...6
+ * coder type
* - encoding: Set by user.
* - decoding: unused
*/
- attribute_deprecated int deblockalpha;
+ int coder_type;
/**
- * in-loop deblocking filter beta parameter
- * beta is in the range -6...6
+ * context model
* - encoding: Set by user.
* - decoding: unused
*/
- attribute_deprecated int deblockbeta;
+ int context_model;
/**
- * macroblock subpartition sizes to consider - p8x8, p4x4, b8x8, i8x8, i4x4
+ * minimum Lagrange multipler
* - encoding: Set by user.
* - decoding: unused
*/
- attribute_deprecated int partitions;
-#define X264_PART_I4X4 0x001 /* Analyze i4x4 */
-#define X264_PART_I8X8 0x002 /* Analyze i8x8 (requires 8x8 transform) */
-#define X264_PART_P8X8 0x010 /* Analyze p16x8, p8x16 and p8x8 */
-#define X264_PART_P4X4 0x020 /* Analyze p8x4, p4x8, p4x4 */
-#define X264_PART_B8X8 0x100 /* Analyze b16x8, b8x16 and b8x8 */
+ int lmin;
/**
- * direct MV prediction mode - 0 (none), 1 (spatial), 2 (temporal), 3 (auto)
+ * maximum Lagrange multipler
* - encoding: Set by user.
* - decoding: unused
*/
- attribute_deprecated int directpred;
-#endif
+ int lmax;
/**
- * Audio cutoff bandwidth (0 means "automatic")
+ * frame skip threshold
* - encoding: Set by user.
* - decoding: unused
*/
- int cutoff;
+ int frame_skip_threshold;
/**
- * Multiplied by qscale for each frame and added to scene_change_score.
+ * frame skip factor
* - encoding: Set by user.
* - decoding: unused
*/
- int scenechange_factor;
+ int frame_skip_factor;
/**
- *
- * Note: Value depends upon the compare function used for fullpel ME.
+ * frame skip exponent
* - encoding: Set by user.
* - decoding: unused
*/
- int mv0_threshold;
+ int frame_skip_exp;
/**
- * Adjust sensitivity of b_frame_strategy 1.
+ * frame skip comparison function
* - encoding: Set by user.
* - decoding: unused
*/
- int b_sensitivity;
+ int frame_skip_cmp;
/**
+ * trellis RD quantization
* - encoding: Set by user.
* - decoding: unused
*/
- int compression_level;
-#define FF_COMPRESSION_DEFAULT -1
+ int trellis;
/**
* - encoding: Set by user.
@@ -2781,70 +2455,155 @@ typedef struct AVCodecContext {
*/
int max_prediction_order;
-#if FF_API_FLAC_GLOBAL_OPTS
/**
- * @name FLAC options
- * @deprecated Use FLAC encoder private options instead.
- * @{
+ * GOP timecode frame start number, in non drop frame format
+ * - encoding: Set by user.
+ * - decoding: unused
*/
+ int64_t timecode_frame_start;
+
+ /* The RTP callback: This function is called */
+ /* every time the encoder has a packet to send. */
+ /* It depends on the encoder if the data starts */
+ /* with a Start Code (it should). H.263 does. */
+ /* mb_nb contains the number of macroblocks */
+ /* encoded in the RTP payload. */
+ void (*rtp_callback)(struct AVCodecContext *avctx, void *data, int size, int mb_nb);
+
+ int rtp_payload_size; /* The size of the RTP payload: the coder will */
+ /* do its best to deliver a chunk with size */
+ /* below rtp_payload_size, the chunk will start */
+ /* with a start code on some codecs like H.263. */
+ /* This doesn't take account of any particular */
+ /* headers inside the transmitted RTP payload. */
+
+ /* statistics, used for 2-pass encoding */
+ int mv_bits;
+ int header_bits;
+ int i_tex_bits;
+ int p_tex_bits;
+ int i_count;
+ int p_count;
+ int skip_count;
+ int misc_bits;
/**
- * LPC coefficient precision - used by FLAC encoder
- * - encoding: Set by user.
+ * number of bits used for the previously encoded frame
+ * - encoding: Set by libavcodec.
* - decoding: unused
*/
- attribute_deprecated int lpc_coeff_precision;
+ int frame_bits;
/**
- * search method for selecting prediction order
- * - encoding: Set by user.
+ * pass1 encoding statistics output buffer
+ * - encoding: Set by libavcodec.
* - decoding: unused
*/
- attribute_deprecated int prediction_order_method;
+ char *stats_out;
/**
- * - encoding: Set by user.
+ * pass2 encoding statistics input buffer
+ * Concatenated stuff from stats_out of pass1 should be placed here.
+ * - encoding: Allocated/set/freed by user.
* - decoding: unused
*/
- attribute_deprecated int min_partition_order;
+ char *stats_in;
/**
+ * Work around bugs in encoders which sometimes cannot be detected automatically.
+ * - encoding: Set by user
+ * - decoding: Set by user
+ */
+ int workaround_bugs;
+#define FF_BUG_AUTODETECT 1 ///< autodetection
+#define FF_BUG_OLD_MSMPEG4 2
+#define FF_BUG_XVID_ILACE 4
+#define FF_BUG_UMP4 8
+#define FF_BUG_NO_PADDING 16
+#define FF_BUG_AMV 32
+#define FF_BUG_AC_VLC 0 ///< Will be removed, libavcodec can now handle these non-compliant files by default.
+#define FF_BUG_QPEL_CHROMA 64
+#define FF_BUG_STD_QPEL 128
+#define FF_BUG_QPEL_CHROMA2 256
+#define FF_BUG_DIRECT_BLOCKSIZE 512
+#define FF_BUG_EDGE 1024
+#define FF_BUG_HPEL_CHROMA 2048
+#define FF_BUG_DC_CLIP 4096
+#define FF_BUG_MS 8192 ///< Work around various bugs in Microsoft's broken decoders.
+#define FF_BUG_TRUNCATED 16384
+
+ /**
+ * strictly follow the standard (MPEG4, ...).
* - encoding: Set by user.
- * - decoding: unused
+ * - decoding: Set by user.
+ * Setting this to STRICT or higher means the encoder and decoder will
+ * generally do stupid things, whereas setting it to unofficial or lower
+ * will mean the encoder might produce output that is not supported by all
+ * spec-compliant decoders. Decoders don't differentiate between normal,
+ * unofficial and experimental (that is, they always try to decode things
+ * when they can) unless they are explicitly asked to behave stupidly
+ * (=strictly conform to the specs)
*/
- attribute_deprecated int max_partition_order;
+ int strict_std_compliance;
+#define FF_COMPLIANCE_VERY_STRICT 2 ///< Strictly conform to an older more strict version of the spec or reference software.
+#define FF_COMPLIANCE_STRICT 1 ///< Strictly conform to all the things in the spec no matter what consequences.
+#define FF_COMPLIANCE_NORMAL 0
+#define FF_COMPLIANCE_UNOFFICIAL -1 ///< Allow unofficial extensions
+#define FF_COMPLIANCE_EXPERIMENTAL -2 ///< Allow nonstandardized experimental things.
+
/**
- * @}
+ * error concealment flags
+ * - encoding: unused
+ * - decoding: Set by user.
*/
-#endif
+ int error_concealment;
+#define FF_EC_GUESS_MVS 1
+#define FF_EC_DEBLOCK 2
/**
- * GOP timecode frame start number, in non drop frame format
+ * debug
* - encoding: Set by user.
- * - decoding: unused
+ * - decoding: Set by user.
*/
- int64_t timecode_frame_start;
+ int debug;
+#define FF_DEBUG_PICT_INFO 1
+#define FF_DEBUG_RC 2
+#define FF_DEBUG_BITSTREAM 4
+#define FF_DEBUG_MB_TYPE 8
+#define FF_DEBUG_QP 16
+#define FF_DEBUG_MV 32
+#define FF_DEBUG_DCT_COEFF 0x00000040
+#define FF_DEBUG_SKIP 0x00000080
+#define FF_DEBUG_STARTCODE 0x00000100
+#define FF_DEBUG_PTS 0x00000200
+#define FF_DEBUG_ER 0x00000400
+#define FF_DEBUG_MMCO 0x00000800
+#define FF_DEBUG_BUGS 0x00001000
+#define FF_DEBUG_VIS_QP 0x00002000
+#define FF_DEBUG_VIS_MB_TYPE 0x00004000
+#define FF_DEBUG_BUFFERS 0x00008000
+#define FF_DEBUG_THREADS 0x00010000
-#if FF_API_REQUEST_CHANNELS
/**
- * Decoder should decode to this many channels if it can (0 for default)
- * - encoding: unused
+ * debug
+ * - encoding: Set by user.
* - decoding: Set by user.
- * @deprecated Deprecated in favor of request_channel_layout.
*/
- int request_channels;
-#endif
+ int debug_mv;
+#define FF_DEBUG_VIS_MV_P_FOR 0x00000001 //visualize forward predicted MVs of P frames
+#define FF_DEBUG_VIS_MV_B_FOR 0x00000002 //visualize forward predicted MVs of B frames
+#define FF_DEBUG_VIS_MV_B_BACK 0x00000004 //visualize backward predicted MVs of B frames
-#if FF_API_DRC_SCALE
/**
- * Percentage of dynamic range compression to be applied by the decoder.
- * The default value is 1.0, corresponding to full compression.
+ * Error recognition; may misdetect some more or less valid parts as errors.
* - encoding: unused
* - decoding: Set by user.
- * @deprecated use AC3 decoder private option instead.
*/
- attribute_deprecated float drc_scale;
-#endif
+ int err_recognition;
+#define AV_EF_CRCCHECK (1<<0)
+#define AV_EF_BITSTREAM (1<<1)
+#define AV_EF_BUFFER (1<<2)
+#define AV_EF_EXPLODE (1<<3)
/**
* opaque 64bit number (generally a PTS) that will be reordered and
@@ -2856,102 +2615,162 @@ typedef struct AVCodecContext {
int64_t reordered_opaque;
/**
- * Bits per sample/pixel of internal libavcodec pixel/sample format.
- * - encoding: set by user.
- * - decoding: set by libavcodec.
+ * Hardware accelerator in use
+ * - encoding: unused.
+ * - decoding: Set by libavcodec
*/
- int bits_per_raw_sample;
+ struct AVHWAccel *hwaccel;
/**
- * Audio channel layout.
- * - encoding: set by user.
- * - decoding: set by libavcodec.
+ * Hardware accelerator context.
+ * For some hardware accelerators, a global context needs to be
+ * provided by the user. In that case, this holds display-dependent
+ * data Libav cannot instantiate itself. Please refer to the
+ * Libav HW accelerator documentation to know how to fill this
+ * is. e.g. for VA API, this is a struct vaapi_context.
+ * - encoding: unused
+ * - decoding: Set by user
*/
- uint64_t channel_layout;
+ void *hwaccel_context;
/**
- * Request decoder to use this channel layout if it can (0 for default)
- * - encoding: unused
- * - decoding: Set by user.
+ * error
+ * - encoding: Set by libavcodec if flags&CODEC_FLAG_PSNR.
+ * - decoding: unused
*/
- uint64_t request_channel_layout;
+ uint64_t error[AV_NUM_DATA_POINTERS];
/**
- * Ratecontrol attempt to use, at maximum, <value> of what can be used without an underflow.
+ * DCT algorithm, see FF_DCT_* below
* - encoding: Set by user.
- * - decoding: unused.
+ * - decoding: unused
*/
- float rc_max_available_vbv_use;
+ int dct_algo;
+#define FF_DCT_AUTO 0
+#define FF_DCT_FASTINT 1
+#define FF_DCT_INT 2
+#define FF_DCT_MMX 3
+#define FF_DCT_ALTIVEC 5
+#define FF_DCT_FAAN 6
/**
- * Ratecontrol attempt to use, at least, <value> times the amount needed to prevent a vbv overflow.
+ * IDCT algorithm, see FF_IDCT_* below.
* - encoding: Set by user.
- * - decoding: unused.
+ * - decoding: Set by user.
*/
- float rc_min_vbv_overflow_use;
+ int idct_algo;
+#define FF_IDCT_AUTO 0
+#define FF_IDCT_INT 1
+#define FF_IDCT_SIMPLE 2
+#define FF_IDCT_SIMPLEMMX 3
+#if FF_API_LIBMPEG2
+#define FF_IDCT_LIBMPEG2MMX 4
+#endif
+#if FF_API_MMI
+#define FF_IDCT_MMI 5
+#endif
+#define FF_IDCT_ARM 7
+#define FF_IDCT_ALTIVEC 8
+#define FF_IDCT_SH4 9
+#define FF_IDCT_SIMPLEARM 10
+#define FF_IDCT_H264 11
+#define FF_IDCT_VP3 12
+#define FF_IDCT_IPP 13
+#define FF_IDCT_XVIDMMX 14
+#define FF_IDCT_CAVS 15
+#define FF_IDCT_SIMPLEARMV5TE 16
+#define FF_IDCT_SIMPLEARMV6 17
+#define FF_IDCT_SIMPLEVIS 18
+#define FF_IDCT_WMV2 19
+#define FF_IDCT_FAAN 20
+#define FF_IDCT_EA 21
+#define FF_IDCT_SIMPLENEON 22
+#define FF_IDCT_SIMPLEALPHA 23
+#define FF_IDCT_BINK 24
+#if FF_API_DSP_MASK
/**
- * Hardware accelerator in use
- * - encoding: unused.
- * - decoding: Set by libavcodec
+ * Unused.
+ * @deprecated use av_set_cpu_flags_mask() instead.
*/
- struct AVHWAccel *hwaccel;
+ attribute_deprecated unsigned dsp_mask;
+#endif
/**
- * For some codecs, the time base is closer to the field rate than the frame rate.
- * Most notably, H.264 and MPEG-2 specify time_base as half of frame duration
- * if no telecine is used ...
- *
- * Set to time_base ticks per frame. Default 1, e.g., H.264/MPEG-2 set it to 2.
+ * bits per sample/pixel from the demuxer (needed for huffyuv).
+ * - encoding: Set by libavcodec.
+ * - decoding: Set by user.
*/
- int ticks_per_frame;
+ int bits_per_coded_sample;
/**
- * Hardware accelerator context.
- * For some hardware accelerators, a global context needs to be
- * provided by the user. In that case, this holds display-dependent
- * data Libav cannot instantiate itself. Please refer to the
- * Libav HW accelerator documentation to know how to fill this
- * is. e.g. for VA API, this is a struct vaapi_context.
+ * Bits per sample/pixel of internal libavcodec pixel/sample format.
+ * - encoding: set by user.
+ * - decoding: set by libavcodec.
+ */
+ int bits_per_raw_sample;
+
+ /**
+ * low resolution decoding, 1-> 1/2 size, 2->1/4 size
* - encoding: unused
- * - decoding: Set by user
+ * - decoding: Set by user.
*/
- void *hwaccel_context;
+ attribute_deprecated int lowres;
/**
- * Chromaticity coordinates of the source primaries.
- * - encoding: Set by user
- * - decoding: Set by libavcodec
+ * the picture in the bitstream
+ * - encoding: Set by libavcodec.
+ * - decoding: Set by libavcodec.
*/
- enum AVColorPrimaries color_primaries;
+ AVFrame *coded_frame;
/**
- * Color Transfer Characteristic.
- * - encoding: Set by user
- * - decoding: Set by libavcodec
+ * thread count
+ * is used to decide how many independent tasks should be passed to execute()
+ * - encoding: Set by user.
+ * - decoding: Set by user.
*/
- enum AVColorTransferCharacteristic color_trc;
+ int thread_count;
/**
- * YUV colorspace type.
- * - encoding: Set by user
- * - decoding: Set by libavcodec
+ * Which multithreading methods to use.
+ * Use of FF_THREAD_FRAME will increase decoding delay by one frame per thread,
+ * so clients which cannot provide future frames should not use it.
+ *
+ * - encoding: Set by user, otherwise the default is used.
+ * - decoding: Set by user, otherwise the default is used.
*/
- enum AVColorSpace colorspace;
+ int thread_type;
+#define FF_THREAD_FRAME 1 ///< Decode more than one frame at once
+#define FF_THREAD_SLICE 2 ///< Decode more than one part of a single frame at once
/**
- * MPEG vs JPEG YUV range.
- * - encoding: Set by user
- * - decoding: Set by libavcodec
+ * Which multithreading methods are in use by the codec.
+ * - encoding: Set by libavcodec.
+ * - decoding: Set by libavcodec.
*/
- enum AVColorRange color_range;
+ int active_thread_type;
/**
- * This defines the location of chroma samples.
- * - encoding: Set by user
- * - decoding: Set by libavcodec
+ * Set by the client if its custom get_buffer() callback can be called
+ * synchronously from another thread, which allows faster multithreaded decoding.
+ * draw_horiz_band() will be called from other threads regardless of this setting.
+ * Ignored if the default get_buffer() is used.
+ * - encoding: Set by user.
+ * - decoding: Set by user.
*/
- enum AVChromaLocation chroma_sample_location;
+ int thread_safe_callbacks;
+
+ /**
+ * The codec may call this to execute several independent things.
+ * It will return only after finishing all tasks.
+ * The user may replace this with some multithreaded implementation,
+ * the default implementation will execute the parts serially.
+ * @param count the number of things to execute
+ * - encoding: Set by libavcodec, user can override.
+ * - decoding: Set by libavcodec, user can override.
+ */
+ int (*execute)(struct AVCodecContext *c, int (*func)(struct AVCodecContext *c2, void *arg), void *arg2, int *ret, int count, int size);
/**
* The codec may call this to execute several independent things.
@@ -2973,95 +2792,119 @@ typedef struct AVCodecContext {
*/
int (*execute2)(struct AVCodecContext *c, int (*func)(struct AVCodecContext *c2, void *arg, int jobnr, int threadnr), void *arg2, int *ret, int count);
-#if FF_API_X264_GLOBAL_OPTS
/**
- * explicit P-frame weighted prediction analysis method
- * 0: off
- * 1: fast blind weighting (one reference duplicate with -1 offset)
- * 2: smart weighting (full fade detection analysis)
- * - encoding: Set by user.
- * - decoding: unused
+ * thread opaque
+ * Can be used by execute() to store some per AVCodecContext stuff.
+ * - encoding: set by execute()
+ * - decoding: set by execute()
*/
- attribute_deprecated int weighted_p_pred;
+ void *thread_opaque;
/**
- * AQ mode
- * 0: Disabled
- * 1: Variance AQ (complexity mask)
- * 2: Auto-variance AQ (experimental)
- * - encoding: Set by user
+ * noise vs. sse weight for the nsse comparsion function
+ * - encoding: Set by user.
* - decoding: unused
*/
- attribute_deprecated int aq_mode;
+ int nsse_weight;
/**
- * AQ strength
- * Reduces blocking and blurring in flat and textured areas.
- * - encoding: Set by user
- * - decoding: unused
+ * profile
+ * - encoding: Set by user.
+ * - decoding: Set by libavcodec.
*/
- attribute_deprecated float aq_strength;
+ int profile;
+#define FF_PROFILE_UNKNOWN -99
+#define FF_PROFILE_RESERVED -100
- /**
- * PSY RD
- * Strength of psychovisual optimization
- * - encoding: Set by user
- * - decoding: unused
- */
- attribute_deprecated float psy_rd;
+#define FF_PROFILE_AAC_MAIN 0
+#define FF_PROFILE_AAC_LOW 1
+#define FF_PROFILE_AAC_SSR 2
+#define FF_PROFILE_AAC_LTP 3
+#define FF_PROFILE_AAC_HE 4
+#define FF_PROFILE_AAC_HE_V2 28
+#define FF_PROFILE_AAC_LD 22
+#define FF_PROFILE_AAC_ELD 38
- /**
- * PSY trellis
- * Strength of psychovisual optimization
- * - encoding: Set by user
- * - decoding: unused
- */
- attribute_deprecated float psy_trellis;
+#define FF_PROFILE_DTS 20
+#define FF_PROFILE_DTS_ES 30
+#define FF_PROFILE_DTS_96_24 40
+#define FF_PROFILE_DTS_HD_HRA 50
+#define FF_PROFILE_DTS_HD_MA 60
- /**
- * RC lookahead
- * Number of frames for frametype and ratecontrol lookahead
- * - encoding: Set by user
- * - decoding: unused
- */
- attribute_deprecated int rc_lookahead;
+#define FF_PROFILE_MPEG2_422 0
+#define FF_PROFILE_MPEG2_HIGH 1
+#define FF_PROFILE_MPEG2_SS 2
+#define FF_PROFILE_MPEG2_SNR_SCALABLE 3
+#define FF_PROFILE_MPEG2_MAIN 4
+#define FF_PROFILE_MPEG2_SIMPLE 5
+
+#define FF_PROFILE_H264_CONSTRAINED (1<<9) // 8+1; constraint_set1_flag
+#define FF_PROFILE_H264_INTRA (1<<11) // 8+3; constraint_set3_flag
+
+#define FF_PROFILE_H264_BASELINE 66
+#define FF_PROFILE_H264_CONSTRAINED_BASELINE (66|FF_PROFILE_H264_CONSTRAINED)
+#define FF_PROFILE_H264_MAIN 77
+#define FF_PROFILE_H264_EXTENDED 88
+#define FF_PROFILE_H264_HIGH 100
+#define FF_PROFILE_H264_HIGH_10 110
+#define FF_PROFILE_H264_HIGH_10_INTRA (110|FF_PROFILE_H264_INTRA)
+#define FF_PROFILE_H264_HIGH_422 122
+#define FF_PROFILE_H264_HIGH_422_INTRA (122|FF_PROFILE_H264_INTRA)
+#define FF_PROFILE_H264_HIGH_444 144
+#define FF_PROFILE_H264_HIGH_444_PREDICTIVE 244
+#define FF_PROFILE_H264_HIGH_444_INTRA (244|FF_PROFILE_H264_INTRA)
+#define FF_PROFILE_H264_CAVLC_444 44
+
+#define FF_PROFILE_VC1_SIMPLE 0
+#define FF_PROFILE_VC1_MAIN 1
+#define FF_PROFILE_VC1_COMPLEX 2
+#define FF_PROFILE_VC1_ADVANCED 3
+
+#define FF_PROFILE_MPEG4_SIMPLE 0
+#define FF_PROFILE_MPEG4_SIMPLE_SCALABLE 1
+#define FF_PROFILE_MPEG4_CORE 2
+#define FF_PROFILE_MPEG4_MAIN 3
+#define FF_PROFILE_MPEG4_N_BIT 4
+#define FF_PROFILE_MPEG4_SCALABLE_TEXTURE 5
+#define FF_PROFILE_MPEG4_SIMPLE_FACE_ANIMATION 6
+#define FF_PROFILE_MPEG4_BASIC_ANIMATED_TEXTURE 7
+#define FF_PROFILE_MPEG4_HYBRID 8
+#define FF_PROFILE_MPEG4_ADVANCED_REAL_TIME 9
+#define FF_PROFILE_MPEG4_CORE_SCALABLE 10
+#define FF_PROFILE_MPEG4_ADVANCED_CODING 11
+#define FF_PROFILE_MPEG4_ADVANCED_CORE 12
+#define FF_PROFILE_MPEG4_ADVANCED_SCALABLE_TEXTURE 13
+#define FF_PROFILE_MPEG4_SIMPLE_STUDIO 14
+#define FF_PROFILE_MPEG4_ADVANCED_SIMPLE 15
/**
- * Constant rate factor maximum
- * With CRF encoding mode and VBV restrictions enabled, prevents quality from being worse
- * than crf_max, even if doing so would violate VBV restrictions.
+ * level
* - encoding: Set by user.
- * - decoding: unused
+ * - decoding: Set by libavcodec.
*/
- attribute_deprecated float crf_max;
-#endif
-
- int log_level_offset;
+ int level;
+#define FF_LEVEL_UNKNOWN -99
-#if FF_API_FLAC_GLOBAL_OPTS
/**
- * Determine which LPC analysis algorithm to use.
- * - encoding: Set by user
- * - decoding: unused
+ *
+ * - encoding: unused
+ * - decoding: Set by user.
*/
- attribute_deprecated enum AVLPCType lpc_type;
+ enum AVDiscard skip_loop_filter;
/**
- * Number of passes to use for Cholesky factorization during LPC analysis
- * - encoding: Set by user
- * - decoding: unused
+ *
+ * - encoding: unused
+ * - decoding: Set by user.
*/
- attribute_deprecated int lpc_passes;
-#endif
+ enum AVDiscard skip_idct;
/**
- * Number of slices.
- * Indicates number of picture subdivisions. Used for parallelized
- * decoding.
- * - encoding: Set by user
- * - decoding: unused
+ *
+ * - encoding: unused
+ * - decoding: Set by user.
*/
- int slices;
+ enum AVDiscard skip_frame;
/**
* Header containing style information for text subtitles.
@@ -3075,6 +2918,13 @@ typedef struct AVCodecContext {
int subtitle_header_size;
/**
+ * Simulates errors in the bitstream to test error concealment.
+ * - encoding: Set by user.
+ * - decoding: unused
+ */
+ int error_rate;
+
+ /**
* Current packet as passed into the decoder, to avoid having
* to pass the packet into every function. Currently only valid
* inside lavc and get/release_buffer callbacks.
@@ -3083,48 +2933,6 @@ typedef struct AVCodecContext {
*/
AVPacket *pkt;
-#if FF_API_INTERNAL_CONTEXT
- /**
- * Whether this is a copy of the context which had init() called on it.
- * This is used by multithreading - shared tables and picture pointers
- * should be freed from the original context only.
- * - encoding: Set by libavcodec.
- * - decoding: Set by libavcodec.
- *
- * @deprecated this field has been moved to an internal context
- */
- attribute_deprecated int is_copy;
-#endif
-
- /**
- * Which multithreading methods to use.
- * Use of FF_THREAD_FRAME will increase decoding delay by one frame per thread,
- * so clients which cannot provide future frames should not use it.
- *
- * - encoding: Set by user, otherwise the default is used.
- * - decoding: Set by user, otherwise the default is used.
- */
- int thread_type;
-#define FF_THREAD_FRAME 1 ///< Decode more than one frame at once
-#define FF_THREAD_SLICE 2 ///< Decode more than one part of a single frame at once
-
- /**
- * Which multithreading methods are in use by the codec.
- * - encoding: Set by libavcodec.
- * - decoding: Set by libavcodec.
- */
- int active_thread_type;
-
- /**
- * Set by the client if its custom get_buffer() callback can be called
- * from another thread, which allows faster multithreaded decoding.
- * draw_horiz_band() will be called from other threads regardless of this setting.
- * Ignored if the default get_buffer() is used.
- * - encoding: Set by user.
- * - decoding: Set by user.
- */
- int thread_safe_callbacks;
-
/**
* VBV delay coded in the last frame (in periods of a 27 MHz clock).
* Used for compliant TS muxing.
@@ -3132,45 +2940,6 @@ typedef struct AVCodecContext {
* - decoding: unused.
*/
uint64_t vbv_delay;
-
- /**
- * Type of service that the audio stream conveys.
- * - encoding: Set by user.
- * - decoding: Set by libavcodec.
- */
- enum AVAudioServiceType audio_service_type;
-
- /**
- * Used to request a sample format from the decoder.
- * - encoding: unused.
- * - decoding: Set by user.
- */
- enum AVSampleFormat request_sample_fmt;
-
- /**
- * Error recognition; may misdetect some more or less valid parts as errors.
- * - encoding: unused
- * - decoding: Set by user.
- */
- int err_recognition;
-#define AV_EF_CRCCHECK (1<<0)
-#define AV_EF_BITSTREAM (1<<1)
-#define AV_EF_BUFFER (1<<2)
-#define AV_EF_EXPLODE (1<<3)
-
- /**
- * Private context used for internal data.
- *
- * Unlike priv_data, this is not codec-specific. It is used in general
- * libavcodec functions.
- */
- struct AVCodecInternal *internal;
-
- /** Field order
- * - encoding: set by libavcodec
- * - decoding: Set by libavcodec
- */
- enum AVFieldOrder field_order;
} AVCodecContext;
/**
@@ -3183,6 +2952,8 @@ typedef struct AVProfile {
typedef struct AVCodecDefault AVCodecDefault;
+struct AVSubtitle;
+
/**
* AVCodec.
*/
@@ -3194,38 +2965,36 @@ typedef struct AVCodec {
* This is the primary way to find a codec from the user perspective.
*/
const char *name;
+ /**
+ * Descriptive name for the codec, meant to be more human readable than name.
+ * You should use the NULL_IF_CONFIG_SMALL() macro to define it.
+ */
+ const char *long_name;
enum AVMediaType type;
- enum CodecID id;
- int priv_data_size;
- int (*init)(AVCodecContext *);
- int (*encode)(AVCodecContext *, uint8_t *buf, int buf_size, void *data);
- int (*close)(AVCodecContext *);
- int (*decode)(AVCodecContext *, void *outdata, int *outdata_size, AVPacket *avpkt);
+ enum AVCodecID id;
/**
* Codec capabilities.
* see CODEC_CAP_*
*/
int capabilities;
- struct AVCodec *next;
- /**
- * Flush buffers.
- * Will be called when seeking
- */
- void (*flush)(AVCodecContext *);
const AVRational *supported_framerates; ///< array of supported framerates, or NULL if any, array is terminated by {0,0}
- const enum PixelFormat *pix_fmts; ///< array of supported pixel formats, or NULL if unknown, array is terminated by -1
- /**
- * Descriptive name for the codec, meant to be more human readable than name.
- * You should use the NULL_IF_CONFIG_SMALL() macro to define it.
- */
- const char *long_name;
+ const enum AVPixelFormat *pix_fmts; ///< array of supported pixel formats, or NULL if unknown, array is terminated by -1
const int *supported_samplerates; ///< array of supported audio samplerates, or NULL if unknown, array is terminated by 0
const enum AVSampleFormat *sample_fmts; ///< array of supported sample formats, or NULL if unknown, array is terminated by -1
const uint64_t *channel_layouts; ///< array of support channel layouts, or NULL if unknown. array is terminated by 0
- uint8_t max_lowres; ///< maximum value for lowres supported by the decoder
+ attribute_deprecated uint8_t max_lowres; ///< maximum value for lowres supported by the decoder
const AVClass *priv_class; ///< AVClass for the private context
const AVProfile *profiles; ///< array of recognized profiles, or NULL if unknown, array is terminated by {FF_PROFILE_UNKNOWN}
+ /*****************************************************************
+ * No fields below this line are part of the public API. They
+ * may not be used outside of libavcodec and can be changed and
+ * removed at will.
+ * New public fields should be added right above.
+ *****************************************************************
+ */
+ int priv_data_size;
+ struct AVCodec *next;
/**
* @name Frame-level threading support functions
* @{
@@ -3256,6 +3025,9 @@ typedef struct AVCodec {
*/
void (*init_static_data)(struct AVCodec *codec);
+ int (*init)(AVCodecContext *);
+ int (*encode_sub)(AVCodecContext *, uint8_t *buf, int buf_size,
+ const struct AVSubtitle *sub);
/**
* Encode data to an AVPacket.
*
@@ -3268,6 +3040,13 @@ typedef struct AVCodec {
*/
int (*encode2)(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame,
int *got_packet_ptr);
+ int (*decode)(AVCodecContext *, void *outdata, int *outdata_size, AVPacket *avpkt);
+ int (*close)(AVCodecContext *);
+ /**
+ * Flush buffers.
+ * Will be called when seeking
+ */
+ void (*flush)(AVCodecContext *);
} AVCodec;
/**
@@ -3291,16 +3070,16 @@ typedef struct AVHWAccel {
/**
* Codec implemented by the hardware accelerator.
*
- * See CODEC_ID_xxx
+ * See AV_CODEC_ID_xxx
*/
- enum CodecID id;
+ enum AVCodecID id;
/**
* Supported pixel format.
*
* Only hardware accelerated formats are supported here.
*/
- enum PixelFormat pix_fmt;
+ enum AVPixelFormat pix_fmt;
/**
* Hardware accelerated codec capabilities.
@@ -3361,6 +3140,13 @@ typedef struct AVHWAccel {
} AVHWAccel;
/**
+ * @defgroup lavc_picture AVPicture
+ *
+ * Functions for working with AVPicture
+ * @{
+ */
+
+/**
* four components are given, that's all.
* the last component is alpha
*/
@@ -3369,31 +3155,12 @@ typedef struct AVPicture {
int linesize[AV_NUM_DATA_POINTERS]; ///< number of bytes per line
} AVPicture;
-#define AVPALETTE_SIZE 1024
-#define AVPALETTE_COUNT 256
-#if FF_API_PALETTE_CONTROL
/**
- * AVPaletteControl
- * This structure defines a method for communicating palette changes
- * between and demuxer and a decoder.
- *
- * @deprecated Use AVPacket to send palette changes instead.
- * This is totally broken.
+ * @}
*/
-typedef struct AVPaletteControl {
-
- /* Demuxer sets this to 1 to indicate the palette has changed;
- * decoder resets to 0. */
- int palette_changed;
- /* 4-byte ARGB palette entries, stored in native byte order; note that
- * the individual palette components should be on a 8-bit scale; if
- * the palette data comes from an IBM VGA native format, the component
- * data is probably 6 bits in size and needs to be scaled. */
- unsigned int palette[AVPALETTE_COUNT];
-
-} AVPaletteControl attribute_deprecated;
-#endif
+#define AVPALETTE_SIZE 1024
+#define AVPALETTE_COUNT 256
enum AVSubtitleType {
SUBTITLE_NONE,
@@ -3413,6 +3180,8 @@ enum AVSubtitleType {
SUBTITLE_ASS,
};
+#define AV_SUBTITLE_FLAG_FORCED 0x00000001
+
typedef struct AVSubtitleRect {
int x; ///< top left corner of pict, undefined when pict is not set
int y; ///< top left corner of pict, undefined when pict is not set
@@ -3435,6 +3204,7 @@ typedef struct AVSubtitleRect {
* struct.
*/
char *ass;
+ int flags;
} AVSubtitleRect;
typedef struct AVSubtitle {
@@ -3446,512 +3216,303 @@ typedef struct AVSubtitle {
int64_t pts; ///< Same as packet pts, in AV_TIME_BASE
} AVSubtitle;
-/* packet functions */
-
/**
- * @deprecated use NULL instead
+ * If c is NULL, returns the first registered codec,
+ * if c is non-NULL, returns the next registered codec after c,
+ * or NULL if c is the last one.
*/
-attribute_deprecated void av_destruct_packet_nofree(AVPacket *pkt);
+AVCodec *av_codec_next(const AVCodec *c);
/**
- * Default packet destructor.
+ * Return the LIBAVCODEC_VERSION_INT constant.
*/
-void av_destruct_packet(AVPacket *pkt);
+unsigned avcodec_version(void);
/**
- * Initialize optional fields of a packet with default values.
- *
- * @param pkt packet
+ * Return the libavcodec build-time configuration.
*/
-void av_init_packet(AVPacket *pkt);
+const char *avcodec_configuration(void);
/**
- * Allocate the payload of a packet and initialize its fields with
- * default values.
- *
- * @param pkt packet
- * @param size wanted payload size
- * @return 0 if OK, AVERROR_xxx otherwise
+ * Return the libavcodec license.
*/
-int av_new_packet(AVPacket *pkt, int size);
+const char *avcodec_license(void);
/**
- * Reduce packet size, correctly zeroing padding
+ * Register the codec codec and initialize libavcodec.
*
- * @param pkt packet
- * @param size new size
- */
-void av_shrink_packet(AVPacket *pkt, int size);
-
-/**
- * Increase packet size, correctly zeroing padding
+ * @warning either this function or avcodec_register_all() must be called
+ * before any other libavcodec functions.
*
- * @param pkt packet
- * @param grow_by number of bytes by which to increase the size of the packet
- */
-int av_grow_packet(AVPacket *pkt, int grow_by);
-
-/**
- * @warning This is a hack - the packet memory allocation stuff is broken. The
- * packet is allocated if it was not really allocated.
+ * @see avcodec_register_all()
*/
-int av_dup_packet(AVPacket *pkt);
+void avcodec_register(AVCodec *codec);
/**
- * Free a packet.
+ * Register all the codecs, parsers and bitstream filters which were enabled at
+ * configuration time. If you do not call this function you can select exactly
+ * which formats you want to support, by using the individual registration
+ * functions.
*
- * @param pkt packet to free
+ * @see avcodec_register
+ * @see av_register_codec_parser
+ * @see av_register_bitstream_filter
*/
-void av_free_packet(AVPacket *pkt);
+void avcodec_register_all(void);
/**
- * Allocate new information of a packet.
+ * Allocate an AVCodecContext and set its fields to default values. The
+ * resulting struct can be deallocated by calling avcodec_close() on it followed
+ * by av_free().
*
- * @param pkt packet
- * @param type side information type
- * @param size side information size
- * @return pointer to fresh allocated data or NULL otherwise
- */
-uint8_t* av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
- int size);
-
-/**
- * Get side information from packet.
+ * @param codec if non-NULL, allocate private data and initialize defaults
+ * for the given codec. It is illegal to then call avcodec_open2()
+ * with a different codec.
+ * If NULL, then the codec-specific defaults won't be initialized,
+ * which may result in suboptimal default settings (this is
+ * important mainly for encoders, e.g. libx264).
*
- * @param pkt packet
- * @param type desired side information type
- * @param size pointer for side information size to store (optional)
- * @return pointer to data if present or NULL otherwise
+ * @return An AVCodecContext filled with default values or NULL on failure.
+ * @see avcodec_get_context_defaults
*/
-uint8_t* av_packet_get_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
- int *size);
-
-/* resample.c */
-
-struct ReSampleContext;
-struct AVResampleContext;
-
-typedef struct ReSampleContext ReSampleContext;
+AVCodecContext *avcodec_alloc_context3(const AVCodec *codec);
/**
- * Initialize audio resampling context.
+ * Set the fields of the given AVCodecContext to default values corresponding
+ * to the given codec (defaults may be codec-dependent).
*
- * @param output_channels number of output channels
- * @param input_channels number of input channels
- * @param output_rate output sample rate
- * @param input_rate input sample rate
- * @param sample_fmt_out requested output sample format
- * @param sample_fmt_in input sample format
- * @param filter_length length of each FIR filter in the filterbank relative to the cutoff frequency
- * @param log2_phase_count log2 of the number of entries in the polyphase filterbank
- * @param linear if 1 then the used FIR filter will be linearly interpolated
- between the 2 closest, if 0 the closest will be used
- * @param cutoff cutoff frequency, 1.0 corresponds to half the output sampling rate
- * @return allocated ReSampleContext, NULL if error occurred
+ * Do not call this function if a non-NULL codec has been passed
+ * to avcodec_alloc_context3() that allocated this AVCodecContext.
+ * If codec is non-NULL, it is illegal to call avcodec_open2() with a
+ * different codec on this AVCodecContext.
*/
-ReSampleContext *av_audio_resample_init(int output_channels, int input_channels,
- int output_rate, int input_rate,
- enum AVSampleFormat sample_fmt_out,
- enum AVSampleFormat sample_fmt_in,
- int filter_length, int log2_phase_count,
- int linear, double cutoff);
-
-int audio_resample(ReSampleContext *s, short *output, short *input, int nb_samples);
+int avcodec_get_context_defaults3(AVCodecContext *s, const AVCodec *codec);
/**
- * Free resample context.
+ * Get the AVClass for AVCodecContext. It can be used in combination with
+ * AV_OPT_SEARCH_FAKE_OBJ for examining options.
*
- * @param s a non-NULL pointer to a resample context previously
- * created with av_audio_resample_init()
- */
-void audio_resample_close(ReSampleContext *s);
-
-
-/**
- * Initialize an audio resampler.
- * Note, if either rate is not an integer then simply scale both rates up so they are.
- * @param filter_length length of each FIR filter in the filterbank relative to the cutoff freq
- * @param log2_phase_count log2 of the number of entries in the polyphase filterbank
- * @param linear If 1 then the used FIR filter will be linearly interpolated
- between the 2 closest, if 0 the closest will be used
- * @param cutoff cutoff frequency, 1.0 corresponds to half the output sampling rate
- */
-struct AVResampleContext *av_resample_init(int out_rate, int in_rate, int filter_length, int log2_phase_count, int linear, double cutoff);
-
-/**
- * Resample an array of samples using a previously configured context.
- * @param src an array of unconsumed samples
- * @param consumed the number of samples of src which have been consumed are returned here
- * @param src_size the number of unconsumed samples available
- * @param dst_size the amount of space in samples available in dst
- * @param update_ctx If this is 0 then the context will not be modified, that way several channels can be resampled with the same context.
- * @return the number of samples written in dst or -1 if an error occurred
+ * @see av_opt_find().
*/
-int av_resample(struct AVResampleContext *c, short *dst, short *src, int *consumed, int src_size, int dst_size, int update_ctx);
-
+const AVClass *avcodec_get_class(void);
/**
- * Compensate samplerate/timestamp drift. The compensation is done by changing
- * the resampler parameters, so no audible clicks or similar distortions occur
- * @param compensation_distance distance in output samples over which the compensation should be performed
- * @param sample_delta number of output samples which should be output less
- *
- * example: av_resample_compensate(c, 10, 500)
- * here instead of 510 samples only 500 samples would be output
+ * Copy the settings of the source AVCodecContext into the destination
+ * AVCodecContext. The resulting destination codec context will be
+ * unopened, i.e. you are required to call avcodec_open2() before you
+ * can use this AVCodecContext to decode/encode video/audio data.
*
- * note, due to rounding the actual compensation might be slightly different,
- * especially if the compensation_distance is large and the in_rate used during init is small
+ * @param dest target codec context, should be initialized with
+ * avcodec_alloc_context3(), but otherwise uninitialized
+ * @param src source codec context
+ * @return AVERROR() on error (e.g. memory allocation error), 0 on success
*/
-void av_resample_compensate(struct AVResampleContext *c, int sample_delta, int compensation_distance);
-void av_resample_close(struct AVResampleContext *c);
+int avcodec_copy_context(AVCodecContext *dest, const AVCodecContext *src);
/**
- * Allocate memory for a picture. Call avpicture_free() to free it.
- *
- * @see avpicture_fill()
+ * Allocate an AVFrame and set its fields to default values. The resulting
+ * struct must be freed using avcodec_free_frame().
*
- * @param picture the picture to be filled in
- * @param pix_fmt the format of the picture
- * @param width the width of the picture
- * @param height the height of the picture
- * @return zero if successful, a negative value if not
+ * @return An AVFrame filled with default values or NULL on failure.
+ * @see avcodec_get_frame_defaults
*/
-int avpicture_alloc(AVPicture *picture, enum PixelFormat pix_fmt, int width, int height);
+AVFrame *avcodec_alloc_frame(void);
/**
- * Free a picture previously allocated by avpicture_alloc().
- * The data buffer used by the AVPicture is freed, but the AVPicture structure
- * itself is not.
+ * Set the fields of the given AVFrame to default values.
*
- * @param picture the AVPicture to be freed
+ * @param frame The AVFrame of which the fields should be set to default values.
*/
-void avpicture_free(AVPicture *picture);
+void avcodec_get_frame_defaults(AVFrame *frame);
/**
- * Fill in the AVPicture fields.
- * The fields of the given AVPicture are filled in by using the 'ptr' address
- * which points to the image data buffer. Depending on the specified picture
- * format, one or multiple image data pointers and line sizes will be set.
- * If a planar format is specified, several pointers will be set pointing to
- * the different picture planes and the line sizes of the different planes
- * will be stored in the lines_sizes array.
- * Call with ptr == NULL to get the required size for the ptr buffer.
+ * Free the frame and any dynamically allocated objects in it,
+ * e.g. extended_data.
*
- * To allocate the buffer and fill in the AVPicture fields in one call,
- * use avpicture_alloc().
+ * @param frame frame to be freed. The pointer will be set to NULL.
*
- * @param picture AVPicture whose fields are to be filled in
- * @param ptr Buffer which will contain or contains the actual image data
- * @param pix_fmt The format in which the picture data is stored.
- * @param width the width of the image in pixels
- * @param height the height of the image in pixels
- * @return size of the image data in bytes
+ * @warning this function does NOT free the data buffers themselves
+ * (it does not know how, since they might have been allocated with
+ * a custom get_buffer()).
*/
-int avpicture_fill(AVPicture *picture, uint8_t *ptr,
- enum PixelFormat pix_fmt, int width, int height);
+void avcodec_free_frame(AVFrame **frame);
/**
- * Copy pixel data from an AVPicture into a buffer.
- * The data is stored compactly, without any gaps for alignment or padding
- * which may be applied by avpicture_fill().
- *
- * @see avpicture_get_size()
+ * Initialize the AVCodecContext to use the given AVCodec. Prior to using this
+ * function the context has to be allocated with avcodec_alloc_context3().
*
- * @param[in] src AVPicture containing image data
- * @param[in] pix_fmt The format in which the picture data is stored.
- * @param[in] width the width of the image in pixels.
- * @param[in] height the height of the image in pixels.
- * @param[out] dest A buffer into which picture data will be copied.
- * @param[in] dest_size The size of 'dest'.
- * @return The number of bytes written to dest, or a negative value (error code) on error.
- */
-int avpicture_layout(const AVPicture* src, enum PixelFormat pix_fmt, int width, int height,
- unsigned char *dest, int dest_size);
-
-/**
- * Calculate the size in bytes that a picture of the given width and height
- * would occupy if stored in the given picture format.
- * Note that this returns the size of a compact representation as generated
- * by avpicture_layout(), which can be smaller than the size required for e.g.
- * avpicture_fill().
+ * The functions avcodec_find_decoder_by_name(), avcodec_find_encoder_by_name(),
+ * avcodec_find_decoder() and avcodec_find_encoder() provide an easy way for
+ * retrieving a codec.
*
- * @param pix_fmt the given picture format
- * @param width the width of the image
- * @param height the height of the image
- * @return Image data size in bytes or -1 on error (e.g. too large dimensions).
- */
-int avpicture_get_size(enum PixelFormat pix_fmt, int width, int height);
-void avcodec_get_chroma_sub_sample(enum PixelFormat pix_fmt, int *h_shift, int *v_shift);
-
-#if FF_API_GET_PIX_FMT_NAME
-/**
- * @deprecated Deprecated in favor of av_get_pix_fmt_name().
- */
-attribute_deprecated
-const char *avcodec_get_pix_fmt_name(enum PixelFormat pix_fmt);
-#endif
-
-void avcodec_set_dimensions(AVCodecContext *s, int width, int height);
-
-/**
- * Return a value representing the fourCC code associated to the
- * pixel format pix_fmt, or 0 if no associated fourCC code can be
- * found.
- */
-unsigned int avcodec_pix_fmt_to_codec_tag(enum PixelFormat pix_fmt);
-
-/**
- * Put a string representing the codec tag codec_tag in buf.
+ * @warning This function is not thread safe!
*
- * @param buf_size size in bytes of buf
- * @return the length of the string that would have been generated if
- * enough space had been available, excluding the trailing null
- */
-size_t av_get_codec_tag_string(char *buf, size_t buf_size, unsigned int codec_tag);
-
-#define FF_LOSS_RESOLUTION 0x0001 /**< loss due to resolution change */
-#define FF_LOSS_DEPTH 0x0002 /**< loss due to color depth change */
-#define FF_LOSS_COLORSPACE 0x0004 /**< loss due to color space conversion */
-#define FF_LOSS_ALPHA 0x0008 /**< loss of alpha bits */
-#define FF_LOSS_COLORQUANT 0x0010 /**< loss due to color quantization */
-#define FF_LOSS_CHROMA 0x0020 /**< loss of chroma (e.g. RGB to gray conversion) */
-
-/**
- * Compute what kind of losses will occur when converting from one specific
- * pixel format to another.
- * When converting from one pixel format to another, information loss may occur.
- * For example, when converting from RGB24 to GRAY, the color information will
- * be lost. Similarly, other losses occur when converting from some formats to
- * other formats. These losses can involve loss of chroma, but also loss of
- * resolution, loss of color depth, loss due to the color space conversion, loss
- * of the alpha bits or loss due to color quantization.
- * avcodec_get_fix_fmt_loss() informs you about the various types of losses
- * which will occur when converting from one pixel format to another.
+ * @code
+ * avcodec_register_all();
+ * av_dict_set(&opts, "b", "2.5M", 0);
+ * codec = avcodec_find_decoder(AV_CODEC_ID_H264);
+ * if (!codec)
+ * exit(1);
*
- * @param[in] dst_pix_fmt destination pixel format
- * @param[in] src_pix_fmt source pixel format
- * @param[in] has_alpha Whether the source pixel format alpha channel is used.
- * @return Combination of flags informing you what kind of losses will occur.
- */
-int avcodec_get_pix_fmt_loss(enum PixelFormat dst_pix_fmt, enum PixelFormat src_pix_fmt,
- int has_alpha);
-
-/**
- * Find the best pixel format to convert to given a certain source pixel
- * format. When converting from one pixel format to another, information loss
- * may occur. For example, when converting from RGB24 to GRAY, the color
- * information will be lost. Similarly, other losses occur when converting from
- * some formats to other formats. avcodec_find_best_pix_fmt() searches which of
- * the given pixel formats should be used to suffer the least amount of loss.
- * The pixel formats from which it chooses one, are determined by the
- * pix_fmt_mask parameter.
+ * context = avcodec_alloc_context3(codec);
*
- * @code
- * src_pix_fmt = PIX_FMT_YUV420P;
- * pix_fmt_mask = (1 << PIX_FMT_YUV422P) || (1 << PIX_FMT_RGB24);
- * dst_pix_fmt = avcodec_find_best_pix_fmt(pix_fmt_mask, src_pix_fmt, alpha, &loss);
+ * if (avcodec_open2(context, codec, opts) < 0)
+ * exit(1);
* @endcode
*
- * @param[in] pix_fmt_mask bitmask determining which pixel format to choose from
- * @param[in] src_pix_fmt source pixel format
- * @param[in] has_alpha Whether the source pixel format alpha channel is used.
- * @param[out] loss_ptr Combination of flags informing you what kind of losses will occur.
- * @return The best pixel format to convert to or -1 if none was found.
- */
-enum PixelFormat avcodec_find_best_pix_fmt(int64_t pix_fmt_mask, enum PixelFormat src_pix_fmt,
- int has_alpha, int *loss_ptr);
-
-#if FF_API_GET_ALPHA_INFO
-#define FF_ALPHA_TRANSP 0x0001 /* image has some totally transparent pixels */
-#define FF_ALPHA_SEMI_TRANSP 0x0002 /* image has some transparent pixels */
-
-/**
- * Tell if an image really has transparent alpha values.
- * @return ored mask of FF_ALPHA_xxx constants
+ * @param avctx The context to initialize.
+ * @param codec The codec to open this context for. If a non-NULL codec has been
+ * previously passed to avcodec_alloc_context3() or
+ * avcodec_get_context_defaults3() for this context, then this
+ * parameter MUST be either NULL or equal to the previously passed
+ * codec.
+ * @param options A dictionary filled with AVCodecContext and codec-private options.
+ * On return this object will be filled with options that were not found.
+ *
+ * @return zero on success, a negative value on error
+ * @see avcodec_alloc_context3(), avcodec_find_decoder(), avcodec_find_encoder(),
+ * av_dict_set(), av_opt_find().
*/
-attribute_deprecated
-int img_get_alpha_info(const AVPicture *src,
- enum PixelFormat pix_fmt, int width, int height);
-#endif
-
-/* deinterlace a picture */
-/* deinterlace - if not supported return -1 */
-int avpicture_deinterlace(AVPicture *dst, const AVPicture *src,
- enum PixelFormat pix_fmt, int width, int height);
-
-/* external high level API */
+int avcodec_open2(AVCodecContext *avctx, const AVCodec *codec, AVDictionary **options);
/**
- * If c is NULL, returns the first registered codec,
- * if c is non-NULL, returns the next registered codec after c,
- * or NULL if c is the last one.
+ * Close a given AVCodecContext and free all the data associated with it
+ * (but not the AVCodecContext itself).
+ *
+ * Calling this function on an AVCodecContext that hasn't been opened will free
+ * the codec-specific data allocated in avcodec_alloc_context3() /
+ * avcodec_get_context_defaults3() with a non-NULL codec. Subsequent calls will
+ * do nothing.
*/
-AVCodec *av_codec_next(AVCodec *c);
+int avcodec_close(AVCodecContext *avctx);
/**
- * Return the LIBAVCODEC_VERSION_INT constant.
+ * Free all allocated data in the given subtitle struct.
+ *
+ * @param sub AVSubtitle to free.
*/
-unsigned avcodec_version(void);
+void avsubtitle_free(AVSubtitle *sub);
/**
- * Return the libavcodec build-time configuration.
+ * @}
*/
-const char *avcodec_configuration(void);
/**
- * Return the libavcodec license.
+ * @addtogroup lavc_packet
+ * @{
*/
-const char *avcodec_license(void);
-#if FF_API_AVCODEC_INIT
/**
- * @deprecated this function is called automatically from avcodec_register()
- * and avcodec_register_all(), there is no need to call it manually
+ * Default packet destructor.
*/
-attribute_deprecated
-void avcodec_init(void);
-#endif
+void av_destruct_packet(AVPacket *pkt);
/**
- * Register the codec codec and initialize libavcodec.
+ * Initialize optional fields of a packet with default values.
*
- * @warning either this function or avcodec_register_all() must be called
- * before any other libavcodec functions.
+ * Note, this does not touch the data and size members, which have to be
+ * initialized separately.
*
- * @see avcodec_register_all()
+ * @param pkt packet
*/
-void avcodec_register(AVCodec *codec);
+void av_init_packet(AVPacket *pkt);
/**
- * Find a registered encoder with a matching codec ID.
+ * Allocate the payload of a packet and initialize its fields with
+ * default values.
*
- * @param id CodecID of the requested encoder
- * @return An encoder if one was found, NULL otherwise.
+ * @param pkt packet
+ * @param size wanted payload size
+ * @return 0 if OK, AVERROR_xxx otherwise
*/
-AVCodec *avcodec_find_encoder(enum CodecID id);
+int av_new_packet(AVPacket *pkt, int size);
/**
- * Find a registered encoder with the specified name.
+ * Reduce packet size, correctly zeroing padding
*
- * @param name name of the requested encoder
- * @return An encoder if one was found, NULL otherwise.
+ * @param pkt packet
+ * @param size new size
*/
-AVCodec *avcodec_find_encoder_by_name(const char *name);
+void av_shrink_packet(AVPacket *pkt, int size);
/**
- * Find a registered decoder with a matching codec ID.
+ * Increase packet size, correctly zeroing padding
*
- * @param id CodecID of the requested decoder
- * @return A decoder if one was found, NULL otherwise.
+ * @param pkt packet
+ * @param grow_by number of bytes by which to increase the size of the packet
*/
-AVCodec *avcodec_find_decoder(enum CodecID id);
+int av_grow_packet(AVPacket *pkt, int grow_by);
/**
- * Find a registered decoder with the specified name.
- *
- * @param name name of the requested decoder
- * @return A decoder if one was found, NULL otherwise.
+ * @warning This is a hack - the packet memory allocation stuff is broken. The
+ * packet is allocated if it was not really allocated.
*/
-AVCodec *avcodec_find_decoder_by_name(const char *name);
-void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode);
+int av_dup_packet(AVPacket *pkt);
/**
- * Return a name for the specified profile, if available.
+ * Free a packet.
*
- * @param codec the codec that is searched for the given profile
- * @param profile the profile value for which a name is requested
- * @return A name for the profile if found, NULL otherwise.
+ * @param pkt packet to free
*/
-const char *av_get_profile_name(const AVCodec *codec, int profile);
+void av_free_packet(AVPacket *pkt);
-#if FF_API_ALLOC_CONTEXT
/**
- * Set the fields of the given AVCodecContext to default values.
+ * Allocate new information of a packet.
*
- * @param s The AVCodecContext of which the fields should be set to default values.
- * @deprecated use avcodec_get_context_defaults3
+ * @param pkt packet
+ * @param type side information type
+ * @param size side information size
+ * @return pointer to fresh allocated data or NULL otherwise
*/
-attribute_deprecated
-void avcodec_get_context_defaults(AVCodecContext *s);
-
-/** THIS FUNCTION IS NOT YET PART OF THE PUBLIC API!
- * we WILL change its arguments and name a few times! */
-attribute_deprecated
-void avcodec_get_context_defaults2(AVCodecContext *s, enum AVMediaType);
-#endif
+uint8_t* av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
+ int size);
/**
- * Set the fields of the given AVCodecContext to default values corresponding
- * to the given codec (defaults may be codec-dependent).
+ * Shrink the already allocated side data buffer
*
- * Do not call this function if a non-NULL codec has been passed
- * to avcodec_alloc_context3() that allocated this AVCodecContext.
- * If codec is non-NULL, it is illegal to call avcodec_open2() with a
- * different codec on this AVCodecContext.
+ * @param pkt packet
+ * @param type side information type
+ * @param size new side information size
+ * @return 0 on success, < 0 on failure
*/
-int avcodec_get_context_defaults3(AVCodecContext *s, AVCodec *codec);
+int av_packet_shrink_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
+ int size);
-#if FF_API_ALLOC_CONTEXT
/**
- * Allocate an AVCodecContext and set its fields to default values. The
- * resulting struct can be deallocated by simply calling av_free().
- *
- * @return An AVCodecContext filled with default values or NULL on failure.
- * @see avcodec_get_context_defaults
+ * Get side information from packet.
*
- * @deprecated use avcodec_alloc_context3()
+ * @param pkt packet
+ * @param type desired side information type
+ * @param size pointer for side information size to store (optional)
+ * @return pointer to data if present or NULL otherwise
*/
-attribute_deprecated
-AVCodecContext *avcodec_alloc_context(void);
-
-/** THIS FUNCTION IS NOT YET PART OF THE PUBLIC API!
- * we WILL change its arguments and name a few times! */
-attribute_deprecated
-AVCodecContext *avcodec_alloc_context2(enum AVMediaType);
-#endif
+uint8_t* av_packet_get_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
+ int *size);
/**
- * Allocate an AVCodecContext and set its fields to default values. The
- * resulting struct can be deallocated by calling avcodec_close() on it followed
- * by av_free().
- *
- * @param codec if non-NULL, allocate private data and initialize defaults
- * for the given codec. It is illegal to then call avcodec_open2()
- * with a different codec.
- *
- * @return An AVCodecContext filled with default values or NULL on failure.
- * @see avcodec_get_context_defaults
+ * @}
*/
-AVCodecContext *avcodec_alloc_context3(AVCodec *codec);
/**
- * Copy the settings of the source AVCodecContext into the destination
- * AVCodecContext. The resulting destination codec context will be
- * unopened, i.e. you are required to call avcodec_open2() before you
- * can use this AVCodecContext to decode/encode video/audio data.
- *
- * @param dest target codec context, should be initialized with
- * avcodec_alloc_context3(), but otherwise uninitialized
- * @param src source codec context
- * @return AVERROR() on error (e.g. memory allocation error), 0 on success
+ * @addtogroup lavc_decoding
+ * @{
*/
-int avcodec_copy_context(AVCodecContext *dest, const AVCodecContext *src);
/**
- * Set the fields of the given AVFrame to default values.
+ * Find a registered decoder with a matching codec ID.
*
- * @param pic The AVFrame of which the fields should be set to default values.
+ * @param id AVCodecID of the requested decoder
+ * @return A decoder if one was found, NULL otherwise.
*/
-void avcodec_get_frame_defaults(AVFrame *pic);
+AVCodec *avcodec_find_decoder(enum AVCodecID id);
/**
- * Allocate an AVFrame and set its fields to default values. The resulting
- * struct can be deallocated by simply calling av_free().
+ * Find a registered decoder with the specified name.
*
- * @return An AVFrame filled with default values or NULL on failure.
- * @see avcodec_get_frame_defaults
+ * @param name name of the requested decoder
+ * @return A decoder if one was found, NULL otherwise.
*/
-AVFrame *avcodec_alloc_frame(void);
+AVCodec *avcodec_find_decoder_by_name(const char *name);
int avcodec_default_get_buffer(AVCodecContext *s, AVFrame *pic);
void avcodec_default_release_buffer(AVCodecContext *s, AVFrame *pic);
@@ -3965,6 +3526,7 @@ int avcodec_default_reget_buffer(AVCodecContext *s, AVFrame *pic);
* @return Required padding in pixels.
*/
unsigned avcodec_get_edge_width(void);
+
/**
* Modify width and height values so that they will result in a memory
* buffer that is acceptable for the codec if you do not use any horizontal
@@ -3975,6 +3537,7 @@ unsigned avcodec_get_edge_width(void);
* according to avcodec_get_edge_width() before.
*/
void avcodec_align_dimensions(AVCodecContext *s, int *width, int *height);
+
/**
* Modify width and height values so that they will result in a memory
* buffer that is acceptable for the codec if you also ensure that all
@@ -3987,92 +3550,6 @@ void avcodec_align_dimensions(AVCodecContext *s, int *width, int *height);
void avcodec_align_dimensions2(AVCodecContext *s, int *width, int *height,
int linesize_align[AV_NUM_DATA_POINTERS]);
-enum PixelFormat avcodec_default_get_format(struct AVCodecContext *s, const enum PixelFormat * fmt);
-
-#if FF_API_THREAD_INIT
-/**
- * @deprecated Set s->thread_count before calling avcodec_open2() instead of calling this.
- */
-attribute_deprecated
-int avcodec_thread_init(AVCodecContext *s, int thread_count);
-#endif
-
-int avcodec_default_execute(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2),void *arg, int *ret, int count, int size);
-int avcodec_default_execute2(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2, int, int),void *arg, int *ret, int count);
-//FIXME func typedef
-
-#if FF_API_AVCODEC_OPEN
-/**
- * Initialize the AVCodecContext to use the given AVCodec. Prior to using this
- * function the context has to be allocated.
- *
- * The functions avcodec_find_decoder_by_name(), avcodec_find_encoder_by_name(),
- * avcodec_find_decoder() and avcodec_find_encoder() provide an easy way for
- * retrieving a codec.
- *
- * @warning This function is not thread safe!
- *
- * @code
- * avcodec_register_all();
- * codec = avcodec_find_decoder(CODEC_ID_H264);
- * if (!codec)
- * exit(1);
- *
- * context = avcodec_alloc_context3(codec);
- *
- * if (avcodec_open(context, codec) < 0)
- * exit(1);
- * @endcode
- *
- * @param avctx The context which will be set up to use the given codec.
- * @param codec The codec to use within the context.
- * @return zero on success, a negative value on error
- * @see avcodec_alloc_context3, avcodec_find_decoder, avcodec_find_encoder, avcodec_close
- *
- * @deprecated use avcodec_open2
- */
-attribute_deprecated
-int avcodec_open(AVCodecContext *avctx, AVCodec *codec);
-#endif
-
-/**
- * Initialize the AVCodecContext to use the given AVCodec. Prior to using this
- * function the context has to be allocated with avcodec_alloc_context3().
- *
- * The functions avcodec_find_decoder_by_name(), avcodec_find_encoder_by_name(),
- * avcodec_find_decoder() and avcodec_find_encoder() provide an easy way for
- * retrieving a codec.
- *
- * @warning This function is not thread safe!
- *
- * @code
- * avcodec_register_all();
- * av_dict_set(&opts, "b", "2.5M", 0);
- * codec = avcodec_find_decoder(CODEC_ID_H264);
- * if (!codec)
- * exit(1);
- *
- * context = avcodec_alloc_context3(codec);
- *
- * if (avcodec_open2(context, codec, opts) < 0)
- * exit(1);
- * @endcode
- *
- * @param avctx The context to initialize.
- * @param codec The codec to open this context for. If a non-NULL codec has been
- * previously passed to avcodec_alloc_context3() or
- * avcodec_get_context_defaults3() for this context, then this
- * parameter MUST be either NULL or equal to the previously passed
- * codec.
- * @param options A dictionary filled with AVCodecContext and codec-private options.
- * On return this object will be filled with options that were not found.
- *
- * @return zero on success, a negative value on error
- * @see avcodec_alloc_context3(), avcodec_find_decoder(), avcodec_find_encoder(),
- * av_dict_set(), av_opt_find().
- */
-int avcodec_open2(AVCodecContext *avctx, AVCodec *codec, AVDictionary **options);
-
#if FF_API_OLD_DECODE_AUDIO
/**
* Wrapper function which calls avcodec_decode_audio4.
@@ -4235,181 +3712,10 @@ int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub,
AVPacket *avpkt);
/**
- * Free all allocated data in the given subtitle struct.
- *
- * @param sub AVSubtitle to free.
- */
-void avsubtitle_free(AVSubtitle *sub);
-
-#if FF_API_OLD_ENCODE_AUDIO
-/**
- * Encode an audio frame from samples into buf.
- *
- * @deprecated Use avcodec_encode_audio2 instead.
- *
- * @note The output buffer should be at least FF_MIN_BUFFER_SIZE bytes large.
- * However, for codecs with avctx->frame_size equal to 0 (e.g. PCM) the user
- * will know how much space is needed because it depends on the value passed
- * in buf_size as described below. In that case a lower value can be used.
- *
- * @param avctx the codec context
- * @param[out] buf the output buffer
- * @param[in] buf_size the output buffer size
- * @param[in] samples the input buffer containing the samples
- * The number of samples read from this buffer is frame_size*channels,
- * both of which are defined in avctx.
- * For codecs which have avctx->frame_size equal to 0 (e.g. PCM) the number of
- * samples read from samples is equal to:
- * buf_size * 8 / (avctx->channels * av_get_bits_per_sample(avctx->codec_id))
- * This also implies that av_get_bits_per_sample() must not return 0 for these
- * codecs.
- * @return On error a negative value is returned, on success zero or the number
- * of bytes used to encode the data read from the input buffer.
- */
-int attribute_deprecated avcodec_encode_audio(AVCodecContext *avctx,
- uint8_t *buf, int buf_size,
- const short *samples);
-#endif
-
-/**
- * Encode a frame of audio.
- *
- * Takes input samples from frame and writes the next output packet, if
- * available, to avpkt. The output packet does not necessarily contain data for
- * the most recent frame, as encoders can delay, split, and combine input frames
- * internally as needed.
- *
- * @param avctx codec context
- * @param avpkt output AVPacket.
- * The user can supply an output buffer by setting
- * avpkt->data and avpkt->size prior to calling the
- * function, but if the size of the user-provided data is not
- * large enough, encoding will fail. All other AVPacket fields
- * will be reset by the encoder using av_init_packet(). If
- * avpkt->data is NULL, the encoder will allocate it.
- * The encoder will set avpkt->size to the size of the
- * output packet.
- * @param[in] frame AVFrame containing the raw audio data to be encoded.
- * May be NULL when flushing an encoder that has the
- * CODEC_CAP_DELAY capability set.
- * There are 2 codec capabilities that affect the allowed
- * values of frame->nb_samples.
- * If CODEC_CAP_SMALL_LAST_FRAME is set, then only the final
- * frame may be smaller than avctx->frame_size, and all other
- * frames must be equal to avctx->frame_size.
- * If CODEC_CAP_VARIABLE_FRAME_SIZE is set, then each frame
- * can have any number of samples.
- * If neither is set, frame->nb_samples must be equal to
- * avctx->frame_size for all frames.
- * @param[out] got_packet_ptr This field is set to 1 by libavcodec if the
- * output packet is non-empty, and to 0 if it is
- * empty. If the function returns an error, the
- * packet can be assumed to be invalid, and the
- * value of got_packet_ptr is undefined and should
- * not be used.
- * @return 0 on success, negative error code on failure
- */
-int avcodec_encode_audio2(AVCodecContext *avctx, AVPacket *avpkt,
- const AVFrame *frame, int *got_packet_ptr);
-
-/**
- * Fill audio frame data and linesize.
- * AVFrame extended_data channel pointers are allocated if necessary for
- * planar audio.
- *
- * @param frame the AVFrame
- * frame->nb_samples must be set prior to calling the
- * function. This function fills in frame->data,
- * frame->extended_data, frame->linesize[0].
- * @param nb_channels channel count
- * @param sample_fmt sample format
- * @param buf buffer to use for frame data
- * @param buf_size size of buffer
- * @param align plane size sample alignment
- * @return 0 on success, negative error code on failure
- */
-int avcodec_fill_audio_frame(AVFrame *frame, int nb_channels,
- enum AVSampleFormat sample_fmt, const uint8_t *buf,
- int buf_size, int align);
-
-/**
- * Encode a video frame from pict into buf.
- * The input picture should be
- * stored using a specific format, namely avctx.pix_fmt.
- *
- * @param avctx the codec context
- * @param[out] buf the output buffer for the bitstream of encoded frame
- * @param[in] buf_size the size of the output buffer in bytes
- * @param[in] pict the input picture to encode
- * @return On error a negative value is returned, on success zero or the number
- * of bytes used from the output buffer.
- */
-int avcodec_encode_video(AVCodecContext *avctx, uint8_t *buf, int buf_size,
- const AVFrame *pict);
-int avcodec_encode_subtitle(AVCodecContext *avctx, uint8_t *buf, int buf_size,
- const AVSubtitle *sub);
-
-/**
- * Close a given AVCodecContext and free all the data associated with it
- * (but not the AVCodecContext itself).
- *
- * Calling this function on an AVCodecContext that hasn't been opened will free
- * the codec-specific data allocated in avcodec_alloc_context3() /
- * avcodec_get_context_defaults3() with a non-NULL codec. Subsequent calls will
- * do nothing.
- */
-int avcodec_close(AVCodecContext *avctx);
-
-/**
- * Register all the codecs, parsers and bitstream filters which were enabled at
- * configuration time. If you do not call this function you can select exactly
- * which formats you want to support, by using the individual registration
- * functions.
- *
- * @see avcodec_register
- * @see av_register_codec_parser
- * @see av_register_bitstream_filter
- */
-void avcodec_register_all(void);
-
-/**
- * Flush buffers, should be called when seeking or when switching to a different stream.
- */
-void avcodec_flush_buffers(AVCodecContext *avctx);
-
-void avcodec_default_free_buffers(AVCodecContext *s);
-
-/* misc useful functions */
-
-#if FF_API_OLD_FF_PICT_TYPES
-/**
- * Return a single letter to describe the given picture type pict_type.
- *
- * @param[in] pict_type the picture type
- * @return A single character representing the picture type.
- * @deprecated Use av_get_picture_type_char() instead.
- */
-attribute_deprecated
-char av_get_pict_type_char(int pict_type);
-#endif
-
-/**
- * Return codec bits per sample.
- *
- * @param[in] codec_id the codec
- * @return Number of bits per sample or zero if unknown for the given codec.
- */
-int av_get_bits_per_sample(enum CodecID codec_id);
-
-#if FF_API_OLD_SAMPLE_FMT
-/**
- * @deprecated Use av_get_bytes_per_sample() instead.
+ * @defgroup lavc_parsing Frame parsing
+ * @{
*/
-attribute_deprecated
-int av_get_bits_per_sample_format(enum AVSampleFormat sample_fmt);
-#endif
-/* frame parsing */
typedef struct AVCodecParserContext {
void *priv_data;
struct AVCodecParser *parser;
@@ -4536,6 +3842,13 @@ typedef struct AVCodecParserContext {
* Previous frame byte position.
*/
int64_t last_pos;
+
+ /**
+ * Duration of the current frame.
+ * For audio, this is in units of 1 / AVCodecContext.sample_rate.
+ * For all other types, this is in units of AVCodecContext.time_base.
+ */
+ int duration;
} AVCodecParserContext;
typedef struct AVCodecParser {
@@ -4591,12 +3904,579 @@ int av_parser_parse2(AVCodecParserContext *s,
int64_t pts, int64_t dts,
int64_t pos);
+/**
+ * @return 0 if the output buffer is a subset of the input, 1 if it is allocated and must be freed
+ * @deprecated use AVBitstreamFilter
+ */
int av_parser_change(AVCodecParserContext *s,
AVCodecContext *avctx,
uint8_t **poutbuf, int *poutbuf_size,
const uint8_t *buf, int buf_size, int keyframe);
void av_parser_close(AVCodecParserContext *s);
+/**
+ * @}
+ * @}
+ */
+
+/**
+ * @addtogroup lavc_encoding
+ * @{
+ */
+
+/**
+ * Find a registered encoder with a matching codec ID.
+ *
+ * @param id AVCodecID of the requested encoder
+ * @return An encoder if one was found, NULL otherwise.
+ */
+AVCodec *avcodec_find_encoder(enum AVCodecID id);
+
+/**
+ * Find a registered encoder with the specified name.
+ *
+ * @param name name of the requested encoder
+ * @return An encoder if one was found, NULL otherwise.
+ */
+AVCodec *avcodec_find_encoder_by_name(const char *name);
+
+#if FF_API_OLD_ENCODE_AUDIO
+/**
+ * Encode an audio frame from samples into buf.
+ *
+ * @deprecated Use avcodec_encode_audio2 instead.
+ *
+ * @note The output buffer should be at least FF_MIN_BUFFER_SIZE bytes large.
+ * However, for codecs with avctx->frame_size equal to 0 (e.g. PCM) the user
+ * will know how much space is needed because it depends on the value passed
+ * in buf_size as described below. In that case a lower value can be used.
+ *
+ * @param avctx the codec context
+ * @param[out] buf the output buffer
+ * @param[in] buf_size the output buffer size
+ * @param[in] samples the input buffer containing the samples
+ * The number of samples read from this buffer is frame_size*channels,
+ * both of which are defined in avctx.
+ * For codecs which have avctx->frame_size equal to 0 (e.g. PCM) the number of
+ * samples read from samples is equal to:
+ * buf_size * 8 / (avctx->channels * av_get_bits_per_sample(avctx->codec_id))
+ * This also implies that av_get_bits_per_sample() must not return 0 for these
+ * codecs.
+ * @return On error a negative value is returned, on success zero or the number
+ * of bytes used to encode the data read from the input buffer.
+ */
+int attribute_deprecated avcodec_encode_audio(AVCodecContext *avctx,
+ uint8_t *buf, int buf_size,
+ const short *samples);
+#endif
+
+/**
+ * Encode a frame of audio.
+ *
+ * Takes input samples from frame and writes the next output packet, if
+ * available, to avpkt. The output packet does not necessarily contain data for
+ * the most recent frame, as encoders can delay, split, and combine input frames
+ * internally as needed.
+ *
+ * @param avctx codec context
+ * @param avpkt output AVPacket.
+ * The user can supply an output buffer by setting
+ * avpkt->data and avpkt->size prior to calling the
+ * function, but if the size of the user-provided data is not
+ * large enough, encoding will fail. All other AVPacket fields
+ * will be reset by the encoder using av_init_packet(). If
+ * avpkt->data is NULL, the encoder will allocate it.
+ * The encoder will set avpkt->size to the size of the
+ * output packet.
+ *
+ * If this function fails or produces no output, avpkt will be
+ * freed using av_free_packet() (i.e. avpkt->destruct will be
+ * called to free the user supplied buffer).
+ * @param[in] frame AVFrame containing the raw audio data to be encoded.
+ * May be NULL when flushing an encoder that has the
+ * CODEC_CAP_DELAY capability set.
+ * If CODEC_CAP_VARIABLE_FRAME_SIZE is set, then each frame
+ * can have any number of samples.
+ * If it is not set, frame->nb_samples must be equal to
+ * avctx->frame_size for all frames except the last.
+ * The final frame may be smaller than avctx->frame_size.
+ * @param[out] got_packet_ptr This field is set to 1 by libavcodec if the
+ * output packet is non-empty, and to 0 if it is
+ * empty. If the function returns an error, the
+ * packet can be assumed to be invalid, and the
+ * value of got_packet_ptr is undefined and should
+ * not be used.
+ * @return 0 on success, negative error code on failure
+ */
+int avcodec_encode_audio2(AVCodecContext *avctx, AVPacket *avpkt,
+ const AVFrame *frame, int *got_packet_ptr);
+
+#if FF_API_OLD_ENCODE_VIDEO
+/**
+ * @deprecated use avcodec_encode_video2() instead.
+ *
+ * Encode a video frame from pict into buf.
+ * The input picture should be
+ * stored using a specific format, namely avctx.pix_fmt.
+ *
+ * @param avctx the codec context
+ * @param[out] buf the output buffer for the bitstream of encoded frame
+ * @param[in] buf_size the size of the output buffer in bytes
+ * @param[in] pict the input picture to encode
+ * @return On error a negative value is returned, on success zero or the number
+ * of bytes used from the output buffer.
+ */
+attribute_deprecated
+int avcodec_encode_video(AVCodecContext *avctx, uint8_t *buf, int buf_size,
+ const AVFrame *pict);
+#endif
+
+/**
+ * Encode a frame of video.
+ *
+ * Takes input raw video data from frame and writes the next output packet, if
+ * available, to avpkt. The output packet does not necessarily contain data for
+ * the most recent frame, as encoders can delay and reorder input frames
+ * internally as needed.
+ *
+ * @param avctx codec context
+ * @param avpkt output AVPacket.
+ * The user can supply an output buffer by setting
+ * avpkt->data and avpkt->size prior to calling the
+ * function, but if the size of the user-provided data is not
+ * large enough, encoding will fail. All other AVPacket fields
+ * will be reset by the encoder using av_init_packet(). If
+ * avpkt->data is NULL, the encoder will allocate it.
+ * The encoder will set avpkt->size to the size of the
+ * output packet. The returned data (if any) belongs to the
+ * caller, he is responsible for freeing it.
+ *
+ * If this function fails or produces no output, avpkt will be
+ * freed using av_free_packet() (i.e. avpkt->destruct will be
+ * called to free the user supplied buffer).
+ * @param[in] frame AVFrame containing the raw video data to be encoded.
+ * May be NULL when flushing an encoder that has the
+ * CODEC_CAP_DELAY capability set.
+ * @param[out] got_packet_ptr This field is set to 1 by libavcodec if the
+ * output packet is non-empty, and to 0 if it is
+ * empty. If the function returns an error, the
+ * packet can be assumed to be invalid, and the
+ * value of got_packet_ptr is undefined and should
+ * not be used.
+ * @return 0 on success, negative error code on failure
+ */
+int avcodec_encode_video2(AVCodecContext *avctx, AVPacket *avpkt,
+ const AVFrame *frame, int *got_packet_ptr);
+
+int avcodec_encode_subtitle(AVCodecContext *avctx, uint8_t *buf, int buf_size,
+ const AVSubtitle *sub);
+
+
+/**
+ * @}
+ */
+
+#if FF_API_AVCODEC_RESAMPLE
+/**
+ * @defgroup lavc_resample Audio resampling
+ * @ingroup libavc
+ * @deprecated use libavresample instead
+ *
+ * @{
+ */
+struct ReSampleContext;
+struct AVResampleContext;
+
+typedef struct ReSampleContext ReSampleContext;
+
+/**
+ * Initialize audio resampling context.
+ *
+ * @param output_channels number of output channels
+ * @param input_channels number of input channels
+ * @param output_rate output sample rate
+ * @param input_rate input sample rate
+ * @param sample_fmt_out requested output sample format
+ * @param sample_fmt_in input sample format
+ * @param filter_length length of each FIR filter in the filterbank relative to the cutoff frequency
+ * @param log2_phase_count log2 of the number of entries in the polyphase filterbank
+ * @param linear if 1 then the used FIR filter will be linearly interpolated
+ between the 2 closest, if 0 the closest will be used
+ * @param cutoff cutoff frequency, 1.0 corresponds to half the output sampling rate
+ * @return allocated ReSampleContext, NULL if error occurred
+ */
+attribute_deprecated
+ReSampleContext *av_audio_resample_init(int output_channels, int input_channels,
+ int output_rate, int input_rate,
+ enum AVSampleFormat sample_fmt_out,
+ enum AVSampleFormat sample_fmt_in,
+ int filter_length, int log2_phase_count,
+ int linear, double cutoff);
+
+attribute_deprecated
+int audio_resample(ReSampleContext *s, short *output, short *input, int nb_samples);
+
+/**
+ * Free resample context.
+ *
+ * @param s a non-NULL pointer to a resample context previously
+ * created with av_audio_resample_init()
+ */
+attribute_deprecated
+void audio_resample_close(ReSampleContext *s);
+
+
+/**
+ * Initialize an audio resampler.
+ * Note, if either rate is not an integer then simply scale both rates up so they are.
+ * @param filter_length length of each FIR filter in the filterbank relative to the cutoff freq
+ * @param log2_phase_count log2 of the number of entries in the polyphase filterbank
+ * @param linear If 1 then the used FIR filter will be linearly interpolated
+ between the 2 closest, if 0 the closest will be used
+ * @param cutoff cutoff frequency, 1.0 corresponds to half the output sampling rate
+ */
+attribute_deprecated
+struct AVResampleContext *av_resample_init(int out_rate, int in_rate, int filter_length, int log2_phase_count, int linear, double cutoff);
+
+/**
+ * Resample an array of samples using a previously configured context.
+ * @param src an array of unconsumed samples
+ * @param consumed the number of samples of src which have been consumed are returned here
+ * @param src_size the number of unconsumed samples available
+ * @param dst_size the amount of space in samples available in dst
+ * @param update_ctx If this is 0 then the context will not be modified, that way several channels can be resampled with the same context.
+ * @return the number of samples written in dst or -1 if an error occurred
+ */
+attribute_deprecated
+int av_resample(struct AVResampleContext *c, short *dst, short *src, int *consumed, int src_size, int dst_size, int update_ctx);
+
+
+/**
+ * Compensate samplerate/timestamp drift. The compensation is done by changing
+ * the resampler parameters, so no audible clicks or similar distortions occur
+ * @param compensation_distance distance in output samples over which the compensation should be performed
+ * @param sample_delta number of output samples which should be output less
+ *
+ * example: av_resample_compensate(c, 10, 500)
+ * here instead of 510 samples only 500 samples would be output
+ *
+ * note, due to rounding the actual compensation might be slightly different,
+ * especially if the compensation_distance is large and the in_rate used during init is small
+ */
+attribute_deprecated
+void av_resample_compensate(struct AVResampleContext *c, int sample_delta, int compensation_distance);
+attribute_deprecated
+void av_resample_close(struct AVResampleContext *c);
+
+/**
+ * @}
+ */
+#endif
+
+/**
+ * @addtogroup lavc_picture
+ * @{
+ */
+
+/**
+ * Allocate memory for a picture. Call avpicture_free() to free it.
+ *
+ * @see avpicture_fill()
+ *
+ * @param picture the picture to be filled in
+ * @param pix_fmt the format of the picture
+ * @param width the width of the picture
+ * @param height the height of the picture
+ * @return zero if successful, a negative value if not
+ */
+int avpicture_alloc(AVPicture *picture, enum AVPixelFormat pix_fmt, int width, int height);
+
+/**
+ * Free a picture previously allocated by avpicture_alloc().
+ * The data buffer used by the AVPicture is freed, but the AVPicture structure
+ * itself is not.
+ *
+ * @param picture the AVPicture to be freed
+ */
+void avpicture_free(AVPicture *picture);
+
+/**
+ * Fill in the AVPicture fields.
+ * The fields of the given AVPicture are filled in by using the 'ptr' address
+ * which points to the image data buffer. Depending on the specified picture
+ * format, one or multiple image data pointers and line sizes will be set.
+ * If a planar format is specified, several pointers will be set pointing to
+ * the different picture planes and the line sizes of the different planes
+ * will be stored in the lines_sizes array.
+ * Call with ptr == NULL to get the required size for the ptr buffer.
+ *
+ * To allocate the buffer and fill in the AVPicture fields in one call,
+ * use avpicture_alloc().
+ *
+ * @param picture AVPicture whose fields are to be filled in
+ * @param ptr Buffer which will contain or contains the actual image data
+ * @param pix_fmt The format in which the picture data is stored.
+ * @param width the width of the image in pixels
+ * @param height the height of the image in pixels
+ * @return size of the image data in bytes
+ */
+int avpicture_fill(AVPicture *picture, uint8_t *ptr,
+ enum AVPixelFormat pix_fmt, int width, int height);
+
+/**
+ * Copy pixel data from an AVPicture into a buffer.
+ * The data is stored compactly, without any gaps for alignment or padding
+ * which may be applied by avpicture_fill().
+ *
+ * @see avpicture_get_size()
+ *
+ * @param[in] src AVPicture containing image data
+ * @param[in] pix_fmt The format in which the picture data is stored.
+ * @param[in] width the width of the image in pixels.
+ * @param[in] height the height of the image in pixels.
+ * @param[out] dest A buffer into which picture data will be copied.
+ * @param[in] dest_size The size of 'dest'.
+ * @return The number of bytes written to dest, or a negative value (error code) on error.
+ */
+int avpicture_layout(const AVPicture* src, enum AVPixelFormat pix_fmt,
+ int width, int height,
+ unsigned char *dest, int dest_size);
+
+/**
+ * Calculate the size in bytes that a picture of the given width and height
+ * would occupy if stored in the given picture format.
+ * Note that this returns the size of a compact representation as generated
+ * by avpicture_layout(), which can be smaller than the size required for e.g.
+ * avpicture_fill().
+ *
+ * @param pix_fmt the given picture format
+ * @param width the width of the image
+ * @param height the height of the image
+ * @return Image data size in bytes or -1 on error (e.g. too large dimensions).
+ */
+int avpicture_get_size(enum AVPixelFormat pix_fmt, int width, int height);
+
+/**
+ * deinterlace - if not supported return -1
+ */
+int avpicture_deinterlace(AVPicture *dst, const AVPicture *src,
+ enum AVPixelFormat pix_fmt, int width, int height);
+/**
+ * Copy image src to dst. Wraps av_picture_data_copy() above.
+ */
+void av_picture_copy(AVPicture *dst, const AVPicture *src,
+ enum AVPixelFormat pix_fmt, int width, int height);
+
+/**
+ * Crop image top and left side.
+ */
+int av_picture_crop(AVPicture *dst, const AVPicture *src,
+ enum AVPixelFormat pix_fmt, int top_band, int left_band);
+
+/**
+ * Pad image.
+ */
+int av_picture_pad(AVPicture *dst, const AVPicture *src, int height, int width, enum AVPixelFormat pix_fmt,
+ int padtop, int padbottom, int padleft, int padright, int *color);
+
+/**
+ * @}
+ */
+
+/**
+ * @defgroup lavc_misc Utility functions
+ * @ingroup libavc
+ *
+ * Miscellaneous utility functions related to both encoding and decoding
+ * (or neither).
+ * @{
+ */
+
+/**
+ * @defgroup lavc_misc_pixfmt Pixel formats
+ *
+ * Functions for working with pixel formats.
+ * @{
+ */
+
+/**
+ * @deprecated Use av_pix_fmt_get_chroma_sub_sample
+ */
+
+void attribute_deprecated avcodec_get_chroma_sub_sample(enum AVPixelFormat pix_fmt, int *h_shift, int *v_shift);
+
+/**
+ * Return a value representing the fourCC code associated to the
+ * pixel format pix_fmt, or 0 if no associated fourCC code can be
+ * found.
+ */
+unsigned int avcodec_pix_fmt_to_codec_tag(enum AVPixelFormat pix_fmt);
+
+#define FF_LOSS_RESOLUTION 0x0001 /**< loss due to resolution change */
+#define FF_LOSS_DEPTH 0x0002 /**< loss due to color depth change */
+#define FF_LOSS_COLORSPACE 0x0004 /**< loss due to color space conversion */
+#define FF_LOSS_ALPHA 0x0008 /**< loss of alpha bits */
+#define FF_LOSS_COLORQUANT 0x0010 /**< loss due to color quantization */
+#define FF_LOSS_CHROMA 0x0020 /**< loss of chroma (e.g. RGB to gray conversion) */
+
+/**
+ * Compute what kind of losses will occur when converting from one specific
+ * pixel format to another.
+ * When converting from one pixel format to another, information loss may occur.
+ * For example, when converting from RGB24 to GRAY, the color information will
+ * be lost. Similarly, other losses occur when converting from some formats to
+ * other formats. These losses can involve loss of chroma, but also loss of
+ * resolution, loss of color depth, loss due to the color space conversion, loss
+ * of the alpha bits or loss due to color quantization.
+ * avcodec_get_fix_fmt_loss() informs you about the various types of losses
+ * which will occur when converting from one pixel format to another.
+ *
+ * @param[in] dst_pix_fmt destination pixel format
+ * @param[in] src_pix_fmt source pixel format
+ * @param[in] has_alpha Whether the source pixel format alpha channel is used.
+ * @return Combination of flags informing you what kind of losses will occur.
+ */
+int avcodec_get_pix_fmt_loss(enum AVPixelFormat dst_pix_fmt, enum AVPixelFormat src_pix_fmt,
+ int has_alpha);
+
+#if FF_API_FIND_BEST_PIX_FMT
+/**
+ * @deprecated use avcodec_find_best_pix_fmt2() instead.
+ *
+ * Find the best pixel format to convert to given a certain source pixel
+ * format. When converting from one pixel format to another, information loss
+ * may occur. For example, when converting from RGB24 to GRAY, the color
+ * information will be lost. Similarly, other losses occur when converting from
+ * some formats to other formats. avcodec_find_best_pix_fmt() searches which of
+ * the given pixel formats should be used to suffer the least amount of loss.
+ * The pixel formats from which it chooses one, are determined by the
+ * pix_fmt_mask parameter.
+ *
+ * @code
+ * src_pix_fmt = AV_PIX_FMT_YUV420P;
+ * pix_fmt_mask = (1 << AV_PIX_FMT_YUV422P) || (1 << AV_PIX_FMT_RGB24);
+ * dst_pix_fmt = avcodec_find_best_pix_fmt(pix_fmt_mask, src_pix_fmt, alpha, &loss);
+ * @endcode
+ *
+ * @param[in] pix_fmt_mask bitmask determining which pixel format to choose from
+ * @param[in] src_pix_fmt source pixel format
+ * @param[in] has_alpha Whether the source pixel format alpha channel is used.
+ * @param[out] loss_ptr Combination of flags informing you what kind of losses will occur.
+ * @return The best pixel format to convert to or -1 if none was found.
+ */
+attribute_deprecated
+enum AVPixelFormat avcodec_find_best_pix_fmt(int64_t pix_fmt_mask, enum AVPixelFormat src_pix_fmt,
+ int has_alpha, int *loss_ptr);
+#endif /* FF_API_FIND_BEST_PIX_FMT */
+
+/**
+ * Find the best pixel format to convert to given a certain source pixel
+ * format. When converting from one pixel format to another, information loss
+ * may occur. For example, when converting from RGB24 to GRAY, the color
+ * information will be lost. Similarly, other losses occur when converting from
+ * some formats to other formats. avcodec_find_best_pix_fmt2() searches which of
+ * the given pixel formats should be used to suffer the least amount of loss.
+ * The pixel formats from which it chooses one, are determined by the
+ * pix_fmt_list parameter.
+ *
+ *
+ * @param[in] pix_fmt_list AV_PIX_FMT_NONE terminated array of pixel formats to choose from
+ * @param[in] src_pix_fmt source pixel format
+ * @param[in] has_alpha Whether the source pixel format alpha channel is used.
+ * @param[out] loss_ptr Combination of flags informing you what kind of losses will occur.
+ * @return The best pixel format to convert to or -1 if none was found.
+ */
+enum AVPixelFormat avcodec_find_best_pix_fmt2(enum AVPixelFormat *pix_fmt_list,
+ enum AVPixelFormat src_pix_fmt,
+ int has_alpha, int *loss_ptr);
+
+enum AVPixelFormat avcodec_default_get_format(struct AVCodecContext *s, const enum AVPixelFormat * fmt);
+
+/**
+ * @}
+ */
+
+void avcodec_set_dimensions(AVCodecContext *s, int width, int height);
+
+/**
+ * Put a string representing the codec tag codec_tag in buf.
+ *
+ * @param buf_size size in bytes of buf
+ * @return the length of the string that would have been generated if
+ * enough space had been available, excluding the trailing null
+ */
+size_t av_get_codec_tag_string(char *buf, size_t buf_size, unsigned int codec_tag);
+
+void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode);
+
+/**
+ * Return a name for the specified profile, if available.
+ *
+ * @param codec the codec that is searched for the given profile
+ * @param profile the profile value for which a name is requested
+ * @return A name for the profile if found, NULL otherwise.
+ */
+const char *av_get_profile_name(const AVCodec *codec, int profile);
+
+int avcodec_default_execute(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2),void *arg, int *ret, int count, int size);
+int avcodec_default_execute2(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2, int, int),void *arg, int *ret, int count);
+//FIXME func typedef
+
+/**
+ * Fill audio frame data and linesize.
+ * AVFrame extended_data channel pointers are allocated if necessary for
+ * planar audio.
+ *
+ * @param frame the AVFrame
+ * frame->nb_samples must be set prior to calling the
+ * function. This function fills in frame->data,
+ * frame->extended_data, frame->linesize[0].
+ * @param nb_channels channel count
+ * @param sample_fmt sample format
+ * @param buf buffer to use for frame data
+ * @param buf_size size of buffer
+ * @param align plane size sample alignment (0 = default)
+ * @return 0 on success, negative error code on failure
+ */
+int avcodec_fill_audio_frame(AVFrame *frame, int nb_channels,
+ enum AVSampleFormat sample_fmt, const uint8_t *buf,
+ int buf_size, int align);
+
+/**
+ * Flush buffers, should be called when seeking or when switching to a different stream.
+ */
+void avcodec_flush_buffers(AVCodecContext *avctx);
+
+void avcodec_default_free_buffers(AVCodecContext *s);
+
+/**
+ * Return codec bits per sample.
+ *
+ * @param[in] codec_id the codec
+ * @return Number of bits per sample or zero if unknown for the given codec.
+ */
+int av_get_bits_per_sample(enum AVCodecID codec_id);
+
+/**
+ * Return codec bits per sample.
+ * Only return non-zero if the bits per sample is exactly correct, not an
+ * approximation.
+ *
+ * @param[in] codec_id the codec
+ * @return Number of bits per sample or zero if unknown for the given codec.
+ */
+int av_get_exact_bits_per_sample(enum AVCodecID codec_id);
+
+/**
+ * Return audio frame duration.
+ *
+ * @param avctx codec context
+ * @param frame_bytes size of the frame, or 0 if unknown
+ * @return frame duration, in samples, if known. 0 if not able to
+ * determine.
+ */
+int av_get_audio_frame_duration(AVCodecContext *avctx, int frame_bytes);
+
typedef struct AVBitStreamFilterContext {
void *priv_data;
@@ -4651,22 +4531,13 @@ void *av_fast_realloc(void *ptr, unsigned int *size, size_t min_size);
void av_fast_malloc(void *ptr, unsigned int *size, size_t min_size);
/**
- * Copy image src to dst. Wraps av_picture_data_copy() above.
- */
-void av_picture_copy(AVPicture *dst, const AVPicture *src,
- enum PixelFormat pix_fmt, int width, int height);
-
-/**
- * Crop image top and left side.
- */
-int av_picture_crop(AVPicture *dst, const AVPicture *src,
- enum PixelFormat pix_fmt, int top_band, int left_band);
-
-/**
- * Pad image.
+ * Allocate a buffer with padding, reusing the given one if large enough.
+ *
+ * Same behaviour av_fast_malloc but the buffer has additional
+ * FF_INPUT_PADDING_SIZE at the end which will always memset to 0.
+ *
*/
-int av_picture_pad(AVPicture *dst, const AVPicture *src, int height, int width, enum PixelFormat pix_fmt,
- int padtop, int padbottom, int padleft, int padright, int *color);
+void av_fast_padded_malloc(void *ptr, unsigned int *size, size_t min_size);
/**
* Encode extradata length to a buffer. Used by xiph codecs.
@@ -4742,20 +4613,46 @@ int av_lockmgr_register(int (*cb)(void **mutex, enum AVLockOp op));
/**
* Get the type of the given codec.
*/
-enum AVMediaType avcodec_get_type(enum CodecID codec_id);
+enum AVMediaType avcodec_get_type(enum AVCodecID codec_id);
/**
- * Get the AVClass for AVCodecContext. It can be used in combination with
- * AV_OPT_SEARCH_FAKE_OBJ for examining options.
+ * @return a positive value if s is open (i.e. avcodec_open2() was called on it
+ * with no corresponding avcodec_close()), 0 otherwise.
+ */
+int avcodec_is_open(AVCodecContext *s);
+
+/**
+ * @return a non-zero number if codec is an encoder, zero otherwise
+ */
+int av_codec_is_encoder(const AVCodec *codec);
+
+/**
+ * @return a non-zero number if codec is a decoder, zero otherwise
+ */
+int av_codec_is_decoder(const AVCodec *codec);
+
+/**
+ * @return descriptor for given codec ID or NULL if no descriptor exists.
+ */
+const AVCodecDescriptor *avcodec_descriptor_get(enum AVCodecID id);
+
+/**
+ * Iterate over all codec descriptors known to libavcodec.
*
- * @see av_opt_find().
+ * @param prev previous descriptor. NULL to get the first descriptor.
+ *
+ * @return next descriptor or NULL after the last descriptor
*/
-const AVClass *avcodec_get_class(void);
+const AVCodecDescriptor *avcodec_descriptor_next(const AVCodecDescriptor *prev);
/**
- * @return a positive value if s is open (i.e. avcodec_open2() was called on it
- * with no corresponding avcodec_close()), 0 otherwise.
+ * @return codec descriptor with the given name or NULL if no such descriptor
+ * exists.
+ */
+const AVCodecDescriptor *avcodec_descriptor_get_by_name(const char *name);
+
+/**
+ * @}
*/
-int avcodec_is_open(AVCodecContext *s);
#endif /* AVCODEC_AVCODEC_H */
diff --git a/gst-libs/ext/libav/libavcodec/avfft.h b/gst-libs/ext/libav/libavcodec/avfft.h
index 91fe2f4..b896182 100644
--- a/gst-libs/ext/libav/libavcodec/avfft.h
+++ b/gst-libs/ext/libav/libavcodec/avfft.h
@@ -19,6 +19,19 @@
#ifndef AVCODEC_AVFFT_H
#define AVCODEC_AVFFT_H
+/**
+ * @file
+ * @ingroup lavc_fft
+ * FFT functions
+ */
+
+/**
+ * @defgroup lavc_fft FFT functions
+ * @ingroup lavc_misc
+ *
+ * @{
+ */
+
typedef float FFTSample;
typedef struct FFTComplex {
@@ -96,4 +109,8 @@ DCTContext *av_dct_init(int nbits, enum DCTTransformType type);
void av_dct_calc(DCTContext *s, FFTSample *data);
void av_dct_end (DCTContext *s);
+/**
+ * @}
+ */
+
#endif /* AVCODEC_AVFFT_H */
diff --git a/gst-libs/ext/libav/libavcodec/avpacket.c b/gst-libs/ext/libav/libavcodec/avpacket.c
index e0e4df4..cb24948 100644
--- a/gst-libs/ext/libav/libavcodec/avpacket.c
+++ b/gst-libs/ext/libav/libavcodec/avpacket.c
@@ -19,23 +19,19 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "avcodec.h"
-#include "libavutil/avassert.h"
-
+#include <string.h>
-void av_destruct_packet_nofree(AVPacket *pkt)
-{
- pkt->data = NULL; pkt->size = 0;
- pkt->side_data = NULL;
- pkt->side_data_elems = 0;
-}
+#include "libavutil/avassert.h"
+#include "libavutil/mem.h"
+#include "avcodec.h"
void av_destruct_packet(AVPacket *pkt)
{
int i;
av_free(pkt->data);
- pkt->data = NULL; pkt->size = 0;
+ pkt->data = NULL;
+ pkt->size = 0;
for (i = 0; i < pkt->side_data_elems; i++)
av_free(pkt->side_data[i].data);
@@ -45,40 +41,41 @@ void av_destruct_packet(AVPacket *pkt)
void av_init_packet(AVPacket *pkt)
{
- pkt->pts = AV_NOPTS_VALUE;
- pkt->dts = AV_NOPTS_VALUE;
- pkt->pos = -1;
- pkt->duration = 0;
+ pkt->pts = AV_NOPTS_VALUE;
+ pkt->dts = AV_NOPTS_VALUE;
+ pkt->pos = -1;
+ pkt->duration = 0;
pkt->convergence_duration = 0;
- pkt->flags = 0;
- pkt->stream_index = 0;
- pkt->destruct= NULL;
- pkt->side_data = NULL;
- pkt->side_data_elems = 0;
+ pkt->flags = 0;
+ pkt->stream_index = 0;
+ pkt->destruct = NULL;
+ pkt->side_data = NULL;
+ pkt->side_data_elems = 0;
}
int av_new_packet(AVPacket *pkt, int size)
{
- uint8_t *data= NULL;
- if((unsigned)size < (unsigned)size + FF_INPUT_BUFFER_PADDING_SIZE)
+ uint8_t *data = NULL;
+ if ((unsigned)size < (unsigned)size + FF_INPUT_BUFFER_PADDING_SIZE)
data = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE);
- if (data){
+ if (data) {
memset(data + size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
- }else
- size=0;
+ } else
+ size = 0;
av_init_packet(pkt);
- pkt->data = data;
- pkt->size = size;
+ pkt->data = data;
+ pkt->size = size;
pkt->destruct = av_destruct_packet;
- if(!data)
+ if (!data)
return AVERROR(ENOMEM);
return 0;
}
void av_shrink_packet(AVPacket *pkt, int size)
{
- if (pkt->size <= size) return;
+ if (pkt->size <= size)
+ return;
pkt->size = size;
memset(pkt->data + size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
}
@@ -89,40 +86,44 @@ int av_grow_packet(AVPacket *pkt, int grow_by)
av_assert0((unsigned)pkt->size <= INT_MAX - FF_INPUT_BUFFER_PADDING_SIZE);
if (!pkt->size)
return av_new_packet(pkt, grow_by);
- if ((unsigned)grow_by > INT_MAX - (pkt->size + FF_INPUT_BUFFER_PADDING_SIZE))
+ if ((unsigned)grow_by >
+ INT_MAX - (pkt->size + FF_INPUT_BUFFER_PADDING_SIZE))
return -1;
- new_ptr = av_realloc(pkt->data, pkt->size + grow_by + FF_INPUT_BUFFER_PADDING_SIZE);
+ new_ptr = av_realloc(pkt->data,
+ pkt->size + grow_by + FF_INPUT_BUFFER_PADDING_SIZE);
if (!new_ptr)
return AVERROR(ENOMEM);
- pkt->data = new_ptr;
+ pkt->data = new_ptr;
pkt->size += grow_by;
memset(pkt->data + pkt->size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
return 0;
}
-#define DUP_DATA(dst, src, size, padding) \
- do { \
- void *data; \
- if (padding) { \
- if ((unsigned)(size) > (unsigned)(size) + FF_INPUT_BUFFER_PADDING_SIZE) \
- goto failed_alloc; \
- data = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE); \
- } else { \
- data = av_malloc(size); \
- } \
- if (!data) \
- goto failed_alloc; \
- memcpy(data, src, size); \
- if (padding) \
- memset((uint8_t*)data + size, 0, FF_INPUT_BUFFER_PADDING_SIZE); \
- dst = data; \
- } while(0)
+#define DUP_DATA(dst, src, size, padding) \
+ do { \
+ void *data; \
+ if (padding) { \
+ if ((unsigned)(size) > \
+ (unsigned)(size) + FF_INPUT_BUFFER_PADDING_SIZE) \
+ goto failed_alloc; \
+ data = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE); \
+ } else { \
+ data = av_malloc(size); \
+ } \
+ if (!data) \
+ goto failed_alloc; \
+ memcpy(data, src, size); \
+ if (padding) \
+ memset((uint8_t *)data + size, 0, \
+ FF_INPUT_BUFFER_PADDING_SIZE); \
+ dst = data; \
+ } while (0)
int av_dup_packet(AVPacket *pkt)
{
AVPacket tmp_pkt;
- if (((pkt->destruct == av_destruct_packet_nofree) || (pkt->destruct == NULL)) && pkt->data) {
+ if (pkt->destruct == NULL && pkt->data) {
tmp_pkt = *pkt;
pkt->data = NULL;
@@ -135,14 +136,15 @@ int av_dup_packet(AVPacket *pkt)
DUP_DATA(pkt->side_data, tmp_pkt.side_data,
pkt->side_data_elems * sizeof(*pkt->side_data), 0);
- memset(pkt->side_data, 0, pkt->side_data_elems * sizeof(*pkt->side_data));
- for (i = 0; i < pkt->side_data_elems; i++) {
+ memset(pkt->side_data, 0,
+ pkt->side_data_elems * sizeof(*pkt->side_data));
+ for (i = 0; i < pkt->side_data_elems; i++)
DUP_DATA(pkt->side_data[i].data, tmp_pkt.side_data[i].data,
- pkt->side_data[i].size, 1);
- }
+ tmp_pkt.side_data[i].size, 1);
}
}
return 0;
+
failed_alloc:
av_destruct_packet(pkt);
return AVERROR(ENOMEM);
@@ -151,14 +153,16 @@ failed_alloc:
void av_free_packet(AVPacket *pkt)
{
if (pkt) {
- if (pkt->destruct) pkt->destruct(pkt);
- pkt->data = NULL; pkt->size = 0;
+ if (pkt->destruct)
+ pkt->destruct(pkt);
+ pkt->data = NULL;
+ pkt->size = 0;
pkt->side_data = NULL;
pkt->side_data_elems = 0;
}
}
-uint8_t* av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
+uint8_t *av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
int size)
{
int elems = pkt->side_data_elems;
@@ -168,7 +172,8 @@ uint8_t* av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
if ((unsigned)size > INT_MAX - FF_INPUT_BUFFER_PADDING_SIZE)
return NULL;
- pkt->side_data = av_realloc(pkt->side_data, (elems + 1) * sizeof(*pkt->side_data));
+ pkt->side_data = av_realloc(pkt->side_data,
+ (elems + 1) * sizeof(*pkt->side_data));
if (!pkt->side_data)
return NULL;
@@ -182,7 +187,7 @@ uint8_t* av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
return pkt->side_data[elems].data;
}
-uint8_t* av_packet_get_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
+uint8_t *av_packet_get_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
int *size)
{
int i;
@@ -196,3 +201,19 @@ uint8_t* av_packet_get_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
}
return NULL;
}
+
+int av_packet_shrink_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
+ int size)
+{
+ int i;
+
+ for (i = 0; i < pkt->side_data_elems; i++) {
+ if (pkt->side_data[i].type == type) {
+ if (size > pkt->side_data[i].size)
+ return AVERROR(ENOMEM);
+ pkt->side_data[i].size = size;
+ return 0;
+ }
+ }
+ return AVERROR(ENOENT);
+}
diff --git a/gst-libs/ext/libav/libavcodec/avpicture.c b/gst-libs/ext/libav/libavcodec/avpicture.c
new file mode 100644
index 0000000..259fd8e
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/avpicture.c
@@ -0,0 +1,125 @@
+/*
+ * AVPicture management routines
+ * Copyright (c) 2001, 2002, 2003 Fabrice Bellard
+ *
+ * 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
+ * AVPicture management routines
+ */
+
+#include "avcodec.h"
+#include "internal.h"
+#include "libavutil/common.h"
+#include "libavutil/pixdesc.h"
+#include "libavutil/imgutils.h"
+#include "libavutil/colorspace.h"
+
+int avpicture_fill(AVPicture *picture, uint8_t *ptr,
+ enum AVPixelFormat pix_fmt, int width, int height)
+{
+ int ret;
+
+ if ((ret = av_image_check_size(width, height, 0, NULL)) < 0)
+ return ret;
+
+ if ((ret = av_image_fill_linesizes(picture->linesize, pix_fmt, width)) < 0)
+ return ret;
+
+ return av_image_fill_pointers(picture->data, pix_fmt,
+ height, ptr, picture->linesize);
+}
+
+int avpicture_layout(const AVPicture* src, enum AVPixelFormat pix_fmt,
+ int width, int height,
+ unsigned char *dest, int dest_size)
+{
+ int i, j, nb_planes = 0, linesizes[4];
+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
+ int size = avpicture_get_size(pix_fmt, width, height);
+
+ if (size > dest_size || size < 0)
+ return AVERROR(EINVAL);
+
+ for (i = 0; i < desc->nb_components; i++)
+ nb_planes = FFMAX(desc->comp[i].plane, nb_planes);
+
+ nb_planes++;
+
+ av_image_fill_linesizes(linesizes, pix_fmt, width);
+ for (i = 0; i < nb_planes; i++) {
+ int h, shift = (i == 1 || i == 2) ? desc->log2_chroma_h : 0;
+ const unsigned char *s = src->data[i];
+ h = (height + (1 << shift) - 1) >> shift;
+
+ for (j = 0; j < h; j++) {
+ memcpy(dest, s, linesizes[i]);
+ dest += linesizes[i];
+ s += src->linesize[i];
+ }
+ }
+
+ if (desc->flags & PIX_FMT_PAL)
+ memcpy((unsigned char *)(((size_t)dest + 3) & ~3),
+ src->data[1], 256 * 4);
+
+ return size;
+}
+
+int avpicture_get_size(enum AVPixelFormat pix_fmt, int width, int height)
+{
+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
+ AVPicture dummy_pict;
+ int ret;
+
+ if (!desc)
+ return AVERROR(EINVAL);
+ if ((ret = av_image_check_size(width, height, 0, NULL)) < 0)
+ return ret;
+ if (desc->flags & PIX_FMT_PSEUDOPAL)
+ // do not include palette for these pseudo-paletted formats
+ return width * height;
+ return avpicture_fill(&dummy_pict, NULL, pix_fmt, width, height);
+}
+
+int avpicture_alloc(AVPicture *picture,
+ enum AVPixelFormat pix_fmt, int width, int height)
+{
+ int ret = av_image_alloc(picture->data, picture->linesize,
+ width, height, pix_fmt, 1);
+ if (ret < 0) {
+ memset(picture, 0, sizeof(AVPicture));
+ return ret;
+ }
+
+ return 0;
+}
+
+void avpicture_free(AVPicture *picture)
+{
+ av_free(picture->data[0]);
+}
+
+void av_picture_copy(AVPicture *dst, const AVPicture *src,
+ enum AVPixelFormat pix_fmt, int width, int height)
+{
+ av_image_copy(dst->data, dst->linesize, src->data,
+ src->linesize, pix_fmt, width, height);
+}
+
diff --git a/gst-libs/ext/libav/libavcodec/avs.c b/gst-libs/ext/libav/libavcodec/avs.c
index 0ce190a..98a53f2 100644
--- a/gst-libs/ext/libav/libavcodec/avs.c
+++ b/gst-libs/ext/libav/libavcodec/avs.c
@@ -44,14 +44,14 @@ typedef enum {
static int
avs_decode_frame(AVCodecContext * avctx,
- void *data, int *data_size, AVPacket *avpkt)
+ void *data, int *got_frame, AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
const uint8_t *buf_end = avpkt->data + avpkt->size;
int buf_size = avpkt->size;
AvsContext *const avs = avctx->priv_data;
AVFrame *picture = data;
- AVFrame *const p = (AVFrame *) & avs->picture;
+ AVFrame *const p = &avs->picture;
const uint8_t *table, *vect;
uint8_t *out;
int i, j, x, y, stride, vect_w = 3, vect_h = 3;
@@ -149,15 +149,15 @@ avs_decode_frame(AVCodecContext * avctx,
align_get_bits(&change_map);
}
- *picture = *(AVFrame *) & avs->picture;
- *data_size = sizeof(AVPicture);
+ *picture = avs->picture;
+ *got_frame = 1;
return buf_size;
}
static av_cold int avs_decode_init(AVCodecContext * avctx)
{
- avctx->pix_fmt = PIX_FMT_PAL8;
+ avctx->pix_fmt = AV_PIX_FMT_PAL8;
avcodec_set_dimensions(avctx, 318, 198);
return 0;
}
@@ -174,11 +174,11 @@ static av_cold int avs_decode_end(AVCodecContext *avctx)
AVCodec ff_avs_decoder = {
.name = "avs",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_AVS,
+ .id = AV_CODEC_ID_AVS,
.priv_data_size = sizeof(AvsContext),
.init = avs_decode_init,
.decode = avs_decode_frame,
.close = avs_decode_end,
.capabilities = CODEC_CAP_DR1,
- .long_name = NULL_IF_CONFIG_SMALL("AVS (Audio Video Standard) video"),
+ .long_name = NULL_IF_CONFIG_SMALL("AVS (Audio Video Standard) video"),
};
diff --git a/gst-libs/ext/libav/libavcodec/bethsoftvideo.c b/gst-libs/ext/libav/libavcodec/bethsoftvideo.c
index fa0457c..316adb6 100644
--- a/gst-libs/ext/libav/libavcodec/bethsoftvideo.c
+++ b/gst-libs/ext/libav/libavcodec/bethsoftvideo.c
@@ -43,7 +43,7 @@ static av_cold int bethsoftvid_decode_init(AVCodecContext *avctx)
vid->frame.reference = 1;
vid->frame.buffer_hints = FF_BUFFER_HINTS_VALID |
FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE;
- avctx->pix_fmt = PIX_FMT_PAL8;
+ avctx->pix_fmt = AV_PIX_FMT_PAL8;
return 0;
}
@@ -59,11 +59,11 @@ static int set_palette(BethsoftvidContext *ctx)
palette[a] = bytestream2_get_be24u(&ctx->g) * 4;
}
ctx->frame.palette_has_changed = 1;
- return 256*3;
+ return 0;
}
static int bethsoftvid_decode_frame(AVCodecContext *avctx,
- void *data, int *data_size,
+ void *data, int *got_frame,
AVPacket *avpkt)
{
BethsoftvidContext * vid = avctx->priv_data;
@@ -71,14 +71,23 @@ static int bethsoftvid_decode_frame(AVCodecContext *avctx,
uint8_t * dst;
uint8_t * frame_end;
int remaining = avctx->width; // number of bytes remaining on a line
- const int wrap_to_next_line = vid->frame.linesize[0] - avctx->width;
- int code;
+ int wrap_to_next_line;
+ int code, ret;
int yoffset;
if (avctx->reget_buffer(avctx, &vid->frame)) {
av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n");
return -1;
}
+ wrap_to_next_line = vid->frame.linesize[0] - avctx->width;
+
+ if (avpkt->side_data_elems > 0 &&
+ avpkt->side_data[0].type == AV_PKT_DATA_PALETTE) {
+ bytestream2_init(&vid->g, avpkt->side_data[0].data,
+ avpkt->side_data[0].size);
+ if ((ret = set_palette(vid)) < 0)
+ return ret;
+ }
bytestream2_init(&vid->g, avpkt->data, avpkt->size);
dst = vid->frame.data[0];
@@ -86,7 +95,12 @@ static int bethsoftvid_decode_frame(AVCodecContext *avctx,
switch(block_type = bytestream2_get_byte(&vid->g)){
case PALETTE_BLOCK: {
- return set_palette(vid);
+ *got_frame = 0;
+ if ((ret = set_palette(vid)) < 0) {
+ av_log(avctx, AV_LOG_ERROR, "error reading palette\n");
+ return ret;
+ }
+ return bytestream2_tell(&vid->g);
}
case VIDEO_YOFF_P_FRAME:
yoffset = bytestream2_get_le16(&vid->g);
@@ -122,7 +136,7 @@ static int bethsoftvid_decode_frame(AVCodecContext *avctx,
}
end:
- *data_size = sizeof(AVFrame);
+ *got_frame = 1;
*(AVFrame*)data = vid->frame;
return avpkt->size;
@@ -137,13 +151,13 @@ static av_cold int bethsoftvid_decode_end(AVCodecContext *avctx)
}
AVCodec ff_bethsoftvid_decoder = {
- .name = "bethsoftvid",
- .type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_BETHSOFTVID,
+ .name = "bethsoftvid",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .id = AV_CODEC_ID_BETHSOFTVID,
.priv_data_size = sizeof(BethsoftvidContext),
- .init = bethsoftvid_decode_init,
- .close = bethsoftvid_decode_end,
- .decode = bethsoftvid_decode_frame,
- .capabilities = CODEC_CAP_DR1,
- .long_name = NULL_IF_CONFIG_SMALL("Bethesda VID video"),
+ .init = bethsoftvid_decode_init,
+ .close = bethsoftvid_decode_end,
+ .decode = bethsoftvid_decode_frame,
+ .capabilities = CODEC_CAP_DR1,
+ .long_name = NULL_IF_CONFIG_SMALL("Bethesda VID video"),
};
diff --git a/gst-libs/ext/libav/libavcodec/bfi.c b/gst-libs/ext/libav/libavcodec/bfi.c
index 542ba54..50b20ba 100644
--- a/gst-libs/ext/libav/libavcodec/bfi.c
+++ b/gst-libs/ext/libav/libavcodec/bfi.c
@@ -29,6 +29,7 @@
#include "libavutil/common.h"
#include "avcodec.h"
#include "bytestream.h"
+#include "internal.h"
typedef struct BFIContext {
AVCodecContext *avctx;
@@ -39,18 +40,18 @@ typedef struct BFIContext {
static av_cold int bfi_decode_init(AVCodecContext *avctx)
{
BFIContext *bfi = avctx->priv_data;
- avctx->pix_fmt = PIX_FMT_PAL8;
- bfi->dst = av_mallocz(avctx->width * avctx->height);
+ avctx->pix_fmt = AV_PIX_FMT_PAL8;
+ bfi->dst = av_mallocz(avctx->width * avctx->height);
return 0;
}
static int bfi_decode_frame(AVCodecContext *avctx, void *data,
- int *data_size, AVPacket *avpkt)
+ int *got_frame, AVPacket *avpkt)
{
GetByteContext g;
- int buf_size = avpkt->size;
+ int buf_size = avpkt->size;
BFIContext *bfi = avctx->priv_data;
- uint8_t *dst = bfi->dst;
+ uint8_t *dst = bfi->dst;
uint8_t *src, *dst_offset, colour1, colour2;
uint8_t *frame_end = bfi->dst + avctx->width * avctx->height;
uint32_t *pal;
@@ -61,7 +62,7 @@ static int bfi_decode_frame(AVCodecContext *avctx, void *data,
bfi->frame.reference = 1;
- if (avctx->get_buffer(avctx, &bfi->frame) < 0) {
+ if (ff_get_buffer(avctx, &bfi->frame) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return -1;
}
@@ -82,9 +83,8 @@ static int bfi_decode_frame(AVCodecContext *avctx, void *data,
int shift = 16;
*pal = 0;
for (j = 0; j < 3; j++, shift -= 8)
- *pal +=
- ((avctx->extradata[i * 3 + j] << 2) |
- (avctx->extradata[i * 3 + j] >> 4)) << shift;
+ *pal += ((avctx->extradata[i * 3 + j] << 2) |
+ (avctx->extradata[i * 3 + j] >> 4)) << shift;
pal++;
}
bfi->frame.palette_has_changed = 1;
@@ -107,7 +107,7 @@ static int bfi_decode_frame(AVCodecContext *avctx, void *data,
return -1;
}
- /* Get length and offset(if required) */
+ /* Get length and offset (if required) */
if (length == 0) {
if (code == 1) {
length = bytestream2_get_byte(&g);
@@ -127,8 +127,7 @@ static int bfi_decode_frame(AVCodecContext *avctx, void *data,
break;
switch (code) {
-
- case 0: //Normal Chain
+ case 0: // normal chain
if (length >= bytestream2_get_bytes_left(&g)) {
av_log(avctx, AV_LOG_ERROR, "Frame larger than buffer.\n");
return -1;
@@ -136,21 +135,18 @@ static int bfi_decode_frame(AVCodecContext *avctx, void *data,
bytestream2_get_buffer(&g, dst, length);
dst += length;
break;
-
- case 1: //Back Chain
+ case 1: // back chain
dst_offset = dst - offset;
- length *= 4; //Convert dwords to bytes.
+ length *= 4; // Convert dwords to bytes.
if (dst_offset < bfi->dst)
break;
while (length--)
*dst++ = *dst_offset++;
break;
-
- case 2: //Skip Chain
+ case 2: // skip chain
dst += length;
break;
-
- case 3: //Fill Chain
+ case 3: // fill chain
colour1 = bytestream2_get_byte(&g);
colour2 = bytestream2_get_byte(&g);
while (length--) {
@@ -158,7 +154,6 @@ static int bfi_decode_frame(AVCodecContext *avctx, void *data,
*dst++ = colour2;
}
break;
-
}
}
@@ -169,12 +164,12 @@ static int bfi_decode_frame(AVCodecContext *avctx, void *data,
src += avctx->width;
dst += bfi->frame.linesize[0];
}
- *data_size = sizeof(AVFrame);
+ *got_frame = 1;
*(AVFrame *)data = bfi->frame;
return buf_size;
}
-static av_cold int bfi_decode_close(AVCodecContext * avctx)
+static av_cold int bfi_decode_close(AVCodecContext *avctx)
{
BFIContext *bfi = avctx->priv_data;
if (bfi->frame.data[0])
@@ -184,13 +179,13 @@ static av_cold int bfi_decode_close(AVCodecContext * avctx)
}
AVCodec ff_bfi_decoder = {
- .name = "bfi",
- .type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_BFI,
+ .name = "bfi",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .id = AV_CODEC_ID_BFI,
.priv_data_size = sizeof(BFIContext),
- .init = bfi_decode_init,
- .close = bfi_decode_close,
- .decode = bfi_decode_frame,
- .capabilities = CODEC_CAP_DR1,
- .long_name = NULL_IF_CONFIG_SMALL("Brute Force & Ignorance"),
+ .init = bfi_decode_init,
+ .close = bfi_decode_close,
+ .decode = bfi_decode_frame,
+ .capabilities = CODEC_CAP_DR1,
+ .long_name = NULL_IF_CONFIG_SMALL("Brute Force & Ignorance"),
};
diff --git a/gst-libs/ext/libav/libavcodec/bfin/Makefile b/gst-libs/ext/libav/libavcodec/bfin/Makefile
index e50e3cd..be81e6c 100644
--- a/gst-libs/ext/libav/libavcodec/bfin/Makefile
+++ b/gst-libs/ext/libav/libavcodec/bfin/Makefile
@@ -1,7 +1,8 @@
-OBJS += bfin/dsputil_bfin.o \
- bfin/fdct_bfin.o \
- bfin/idct_bfin.o \
- bfin/mpegvideo_bfin.o \
- bfin/pixels_bfin.o \
- bfin/vp3_bfin.o \
- bfin/vp3_idct_bfin.o \
+OBJS += bfin/dsputil_bfin.o \
+ bfin/fdct_bfin.o \
+ bfin/idct_bfin.o \
+ bfin/pixels_bfin.o \
+ bfin/vp3_bfin.o \
+ bfin/vp3_idct_bfin.o \
+
+OBJS-$(CONFIG_MPEGVIDEOENC) += bfin/mpegvideo_bfin.o
diff --git a/gst-libs/ext/libav/libavcodec/bfin/dsputil_bfin.c b/gst-libs/ext/libav/libavcodec/bfin/dsputil_bfin.c
index 58ec394..8597ec1 100644
--- a/gst-libs/ext/libav/libavcodec/bfin/dsputil_bfin.c
+++ b/gst-libs/ext/libav/libavcodec/bfin/dsputil_bfin.c
@@ -195,7 +195,7 @@ static int bfin_pix_abs8_xy2 (void *c, uint8_t *blk1, uint8_t *blk2, int line_si
*/
-void dsputil_init_bfin( DSPContext* c, AVCodecContext *avctx )
+void ff_dsputil_init_bfin( DSPContext* c, AVCodecContext *avctx )
{
const int high_bit_depth = avctx->bits_per_raw_sample > 8;
@@ -270,6 +270,3 @@ void dsputil_init_bfin( DSPContext* c, AVCodecContext *avctx )
}
}
}
-
-
-
diff --git a/gst-libs/ext/libav/libavcodec/bfin/fdct_bfin.S b/gst-libs/ext/libav/libavcodec/bfin/fdct_bfin.S
index 47ec381..8ca490d 100644
--- a/gst-libs/ext/libav/libavcodec/bfin/fdct_bfin.S
+++ b/gst-libs/ext/libav/libavcodec/bfin/fdct_bfin.S
@@ -328,4 +328,3 @@ DEFUN(fdct,mL1,
(r7:4,p5:3) = [sp++];
RTS;
DEFUN_END(fdct)
-
diff --git a/gst-libs/ext/libav/libavcodec/bfin/idct_bfin.S b/gst-libs/ext/libav/libavcodec/bfin/idct_bfin.S
index 36d50a7..b384840 100644
--- a/gst-libs/ext/libav/libavcodec/bfin/idct_bfin.S
+++ b/gst-libs/ext/libav/libavcodec/bfin/idct_bfin.S
@@ -302,5 +302,3 @@ DEFUN(idct,mL1,
unlink;
RTS;
DEFUN_END(idct)
-
-
diff --git a/gst-libs/ext/libav/libavcodec/bfin/mpegvideo_bfin.c b/gst-libs/ext/libav/libavcodec/bfin/mpegvideo_bfin.c
index ad68876..8e88d88 100644
--- a/gst-libs/ext/libav/libavcodec/bfin/mpegvideo_bfin.c
+++ b/gst-libs/ext/libav/libavcodec/bfin/mpegvideo_bfin.c
@@ -141,8 +141,7 @@ static int dct_quantize_bfin (MpegEncContext *s,
return last_non_zero;
}
-void MPV_common_init_bfin (MpegEncContext *s)
+void ff_MPV_common_init_bfin (MpegEncContext *s)
{
/* s->dct_quantize= dct_quantize_bfin; */
}
-
diff --git a/gst-libs/ext/libav/libavcodec/bfin/pixels_bfin.S b/gst-libs/ext/libav/libavcodec/bfin/pixels_bfin.S
index 085ff46..45a3ab6 100644
--- a/gst-libs/ext/libav/libavcodec/bfin/pixels_bfin.S
+++ b/gst-libs/ext/libav/libavcodec/bfin/pixels_bfin.S
@@ -737,5 +737,3 @@ DEFUN(sse16,mL1,
unlink;
rts;
DEFUN_END(sse16)
-
-
diff --git a/gst-libs/ext/libav/libavcodec/bfin/vp3_bfin.c b/gst-libs/ext/libav/libavcodec/bfin/vp3_bfin.c
index 4b08042..bec25a0 100644
--- a/gst-libs/ext/libav/libavcodec/bfin/vp3_bfin.c
+++ b/gst-libs/ext/libav/libavcodec/bfin/vp3_bfin.c
@@ -41,5 +41,3 @@ void ff_bfin_vp3_idct_add (uint8_t *dest, int line_size, DCTELEM *block)
ff_bfin_vp3_idct (block);
ff_bfin_add_pixels_clamped (block, dest, line_size);
}
-
-
diff --git a/gst-libs/ext/libav/libavcodec/bfin/vp3_idct_bfin.S b/gst-libs/ext/libav/libavcodec/bfin/vp3_idct_bfin.S
index 4c678f1..2e18f91 100644
--- a/gst-libs/ext/libav/libavcodec/bfin/vp3_idct_bfin.S
+++ b/gst-libs/ext/libav/libavcodec/bfin/vp3_idct_bfin.S
@@ -278,5 +278,3 @@ DEFUN(vp3_idct,mL1,
unlink;
RTS;
DEFUN_END(vp3_idct)
-
-
diff --git a/gst-libs/ext/libav/libavcodec/bgmc.c b/gst-libs/ext/libav/libavcodec/bgmc.c
index b17c3b1..ec8cf9b 100644
--- a/gst-libs/ext/libav/libavcodec/bgmc.c
+++ b/gst-libs/ext/libav/libavcodec/bgmc.c
@@ -25,10 +25,8 @@
* @author Thilo Borgmann <thilo.borgmann _at_ googlemail.com>
*/
-
#include "bgmc.h"
-
#define FREQ_BITS 14 // bits used by frequency counters
#define VALUE_BITS 18 // bits used to represent the values
#define TOP_VALUE ((1 << VALUE_BITS) - 1) // maximum value
@@ -41,382 +39,381 @@
#define LUT_BUFF 4 // number of buffered lookup tables
-/** Cumulative frequency tables for block Gilbert-Moore coding.
- */
+/** Cumulative frequency tables for block Gilbert-Moore coding. */
static const uint16_t cf_tables_1[3][129] = {
{
- 16384, 16066, 15748, 15431, 15114, 14799, 14485, 14173, 13861, 13552,
- 13243, 12939, 12635, 12336, 12038, 11745, 11452, 11161, 10870, 10586,
- 10303, 10027, 9751, 9483, 9215, 8953, 8692, 8440, 8189, 7946,
- 7704, 7472, 7240, 7008, 6776, 6554, 6333, 6122, 5912, 5711,
- 5512, 5320, 5128, 4947, 4766, 4595, 4425, 4264, 4104, 3946,
- 3788, 3640, 3493, 3355, 3218, 3090, 2963, 2842, 2721, 2609,
- 2498, 2395, 2292, 2196, 2100, 2004, 1908, 1820, 1732, 1651,
- 1570, 1497, 1424, 1355, 1287, 1223, 1161, 1100, 1044, 988,
- 938, 888, 839, 790, 746, 702, 662, 623, 588, 553,
- 520, 488, 459, 431, 405, 380, 357, 334, 311, 288,
- 268, 248, 230, 213, 197, 182, 168, 154, 142, 130,
- 119, 108, 99, 90, 81, 72, 64, 56, 49, 42,
- 36, 30, 25, 20, 15, 11, 7, 3, 0
- },
- {
- 16384, 16080, 15776, 15473, 15170, 14868, 14567, 14268, 13970, 13674,
- 13378, 13086, 12794, 12505, 12218, 11936, 11654, 11373, 11092, 10818,
- 10544, 10276, 10008, 9749, 9490, 9236, 8982, 8737, 8492, 8256,
- 8020, 7792, 7564, 7336, 7108, 6888, 6669, 6459, 6249, 6050,
- 5852, 5660, 5468, 5286, 5104, 4931, 4760, 4598, 4436, 4275,
- 4115, 3965, 3816, 3674, 3534, 3403, 3272, 3147, 3023, 2907,
- 2792, 2684, 2577, 2476, 2375, 2274, 2173, 2079, 1986, 1897,
- 1810, 1724, 1645, 1567, 1493, 1419, 1351, 1284, 1222, 1161,
- 1105, 1050, 995, 941, 891, 842, 797, 753, 713, 673,
- 636, 599, 566, 533, 503, 473, 446, 419, 392, 365,
- 340, 316, 294, 272, 253, 234, 216, 199, 184, 169,
- 155, 142, 130, 118, 106, 95, 85, 75, 66, 57,
- 49, 41, 34, 27, 21, 15, 10, 5, 0
- },
- {
- 16384, 16092, 15801, 15510, 15219, 14930, 14641, 14355, 14069, 13785,
- 13501, 13219, 12938, 12661, 12384, 12112, 11841, 11571, 11301, 11037,
- 10773, 10514, 10256, 10005, 9754, 9508, 9263, 9025, 8787, 8557,
- 8327, 8103, 7879, 7655, 7431, 7215, 7000, 6792, 6585, 6387,
- 6190, 5998, 5807, 5625, 5445, 5272, 5100, 4937, 4774, 4613,
- 4452, 4301, 4150, 4007, 3865, 3731, 3597, 3469, 3341, 3218,
- 3099, 2981, 2869, 2758, 2652, 2546, 2440, 2334, 2234, 2134,
- 2041, 1949, 1864, 1779, 1699, 1620, 1547, 1474, 1407, 1340,
- 1278, 1217, 1157, 1097, 1043, 989, 940, 891, 846, 801,
- 759, 718, 680, 643, 609, 575, 543, 511, 479, 447,
- 418, 389, 363, 337, 314, 291, 270, 249, 230, 212,
- 195, 179, 164, 149, 135, 121, 108, 96, 85, 74,
- 64, 54, 45, 36, 28, 20, 13, 6, 0
- }
+ 16384, 16066, 15748, 15431, 15114, 14799, 14485, 14173, 13861, 13552,
+ 13243, 12939, 12635, 12336, 12038, 11745, 11452, 11161, 10870, 10586,
+ 10303, 10027, 9751, 9483, 9215, 8953, 8692, 8440, 8189, 7946,
+ 7704, 7472, 7240, 7008, 6776, 6554, 6333, 6122, 5912, 5711,
+ 5512, 5320, 5128, 4947, 4766, 4595, 4425, 4264, 4104, 3946,
+ 3788, 3640, 3493, 3355, 3218, 3090, 2963, 2842, 2721, 2609,
+ 2498, 2395, 2292, 2196, 2100, 2004, 1908, 1820, 1732, 1651,
+ 1570, 1497, 1424, 1355, 1287, 1223, 1161, 1100, 1044, 988,
+ 938, 888, 839, 790, 746, 702, 662, 623, 588, 553,
+ 520, 488, 459, 431, 405, 380, 357, 334, 311, 288,
+ 268, 248, 230, 213, 197, 182, 168, 154, 142, 130,
+ 119, 108, 99, 90, 81, 72, 64, 56, 49, 42,
+ 36, 30, 25, 20, 15, 11, 7, 3, 0
+ },
+ {
+ 16384, 16080, 15776, 15473, 15170, 14868, 14567, 14268, 13970, 13674,
+ 13378, 13086, 12794, 12505, 12218, 11936, 11654, 11373, 11092, 10818,
+ 10544, 10276, 10008, 9749, 9490, 9236, 8982, 8737, 8492, 8256,
+ 8020, 7792, 7564, 7336, 7108, 6888, 6669, 6459, 6249, 6050,
+ 5852, 5660, 5468, 5286, 5104, 4931, 4760, 4598, 4436, 4275,
+ 4115, 3965, 3816, 3674, 3534, 3403, 3272, 3147, 3023, 2907,
+ 2792, 2684, 2577, 2476, 2375, 2274, 2173, 2079, 1986, 1897,
+ 1810, 1724, 1645, 1567, 1493, 1419, 1351, 1284, 1222, 1161,
+ 1105, 1050, 995, 941, 891, 842, 797, 753, 713, 673,
+ 636, 599, 566, 533, 503, 473, 446, 419, 392, 365,
+ 340, 316, 294, 272, 253, 234, 216, 199, 184, 169,
+ 155, 142, 130, 118, 106, 95, 85, 75, 66, 57,
+ 49, 41, 34, 27, 21, 15, 10, 5, 0
+ },
+ {
+ 16384, 16092, 15801, 15510, 15219, 14930, 14641, 14355, 14069, 13785,
+ 13501, 13219, 12938, 12661, 12384, 12112, 11841, 11571, 11301, 11037,
+ 10773, 10514, 10256, 10005, 9754, 9508, 9263, 9025, 8787, 8557,
+ 8327, 8103, 7879, 7655, 7431, 7215, 7000, 6792, 6585, 6387,
+ 6190, 5998, 5807, 5625, 5445, 5272, 5100, 4937, 4774, 4613,
+ 4452, 4301, 4150, 4007, 3865, 3731, 3597, 3469, 3341, 3218,
+ 3099, 2981, 2869, 2758, 2652, 2546, 2440, 2334, 2234, 2134,
+ 2041, 1949, 1864, 1779, 1699, 1620, 1547, 1474, 1407, 1340,
+ 1278, 1217, 1157, 1097, 1043, 989, 940, 891, 846, 801,
+ 759, 718, 680, 643, 609, 575, 543, 511, 479, 447,
+ 418, 389, 363, 337, 314, 291, 270, 249, 230, 212,
+ 195, 179, 164, 149, 135, 121, 108, 96, 85, 74,
+ 64, 54, 45, 36, 28, 20, 13, 6, 0
+ }
};
static const uint16_t cf_tables_2[8][193] = {
{
- 16384, 16104, 15825, 15546, 15268, 14991, 14714, 14439, 14164, 13891,
- 13620, 13350, 13081, 12815, 12549, 12287, 12025, 11765, 11505, 11250,
- 10996, 10746, 10497, 10254, 10011, 9772, 9534, 9303, 9072, 8848,
- 8624, 8406, 8188, 7970, 7752, 7539, 7327, 7123, 6919, 6724,
- 6529, 6339, 6150, 5970, 5790, 5618, 5446, 5282, 5119, 4957,
- 4795, 4642, 4490, 4345, 4201, 4065, 3929, 3798, 3669, 3547,
- 3425, 3310, 3196, 3086, 2976, 2866, 2756, 2650, 2545, 2447,
- 2350, 2260, 2170, 2085, 2000, 1921, 1843, 1770, 1698, 1632,
- 1566, 1501, 1436, 1376, 1316, 1261, 1207, 1157, 1108, 1061,
- 1015, 973, 931, 893, 855, 819, 783, 747, 711, 677,
- 644, 614, 584, 557, 530, 505, 480, 458, 436, 416,
- 396, 378, 360, 343, 326, 310, 295, 281, 267, 255,
- 243, 232, 221, 211, 201, 192, 183, 174, 166, 158,
- 150, 142, 134, 126, 119, 112, 106, 100, 95, 90,
- 85, 80, 76, 72, 69, 66, 63, 60, 57, 54,
- 51, 48, 46, 44, 42, 40, 38, 36, 34, 33,
- 32, 31, 30, 29, 28, 27, 26, 25, 24, 23,
- 22, 21, 20, 19, 18, 17, 16, 15, 14, 13,
- 12, 11, 10, 9, 8, 7, 6, 5, 4, 3,
- 2, 1, 0
+ 16384, 16104, 15825, 15546, 15268, 14991, 14714, 14439, 14164, 13891,
+ 13620, 13350, 13081, 12815, 12549, 12287, 12025, 11765, 11505, 11250,
+ 10996, 10746, 10497, 10254, 10011, 9772, 9534, 9303, 9072, 8848,
+ 8624, 8406, 8188, 7970, 7752, 7539, 7327, 7123, 6919, 6724,
+ 6529, 6339, 6150, 5970, 5790, 5618, 5446, 5282, 5119, 4957,
+ 4795, 4642, 4490, 4345, 4201, 4065, 3929, 3798, 3669, 3547,
+ 3425, 3310, 3196, 3086, 2976, 2866, 2756, 2650, 2545, 2447,
+ 2350, 2260, 2170, 2085, 2000, 1921, 1843, 1770, 1698, 1632,
+ 1566, 1501, 1436, 1376, 1316, 1261, 1207, 1157, 1108, 1061,
+ 1015, 973, 931, 893, 855, 819, 783, 747, 711, 677,
+ 644, 614, 584, 557, 530, 505, 480, 458, 436, 416,
+ 396, 378, 360, 343, 326, 310, 295, 281, 267, 255,
+ 243, 232, 221, 211, 201, 192, 183, 174, 166, 158,
+ 150, 142, 134, 126, 119, 112, 106, 100, 95, 90,
+ 85, 80, 76, 72, 69, 66, 63, 60, 57, 54,
+ 51, 48, 46, 44, 42, 40, 38, 36, 34, 33,
+ 32, 31, 30, 29, 28, 27, 26, 25, 24, 23,
+ 22, 21, 20, 19, 18, 17, 16, 15, 14, 13,
+ 12, 11, 10, 9, 8, 7, 6, 5, 4, 3,
+ 2, 1, 0
},
{
- 16384, 16116, 15849, 15582, 15316, 15050, 14785, 14521, 14257, 13995,
- 13734, 13476, 13218, 12963, 12708, 12457, 12206, 11956, 11706, 11460,
- 11215, 10975, 10735, 10500, 10265, 10034, 9803, 9579, 9355, 9136,
- 8917, 8703, 8489, 8275, 8061, 7853, 7645, 7444, 7244, 7051,
- 6858, 6671, 6484, 6305, 6127, 5956, 5785, 5622, 5459, 5298,
- 5137, 4983, 4830, 4684, 4539, 4401, 4263, 4131, 3999, 3874,
- 3750, 3632, 3515, 3401, 3287, 3173, 3059, 2949, 2840, 2737,
- 2635, 2539, 2444, 2354, 2264, 2181, 2098, 2020, 1943, 1872,
- 1801, 1731, 1661, 1596, 1532, 1472, 1412, 1357, 1303, 1251,
- 1200, 1153, 1106, 1063, 1020, 979, 938, 897, 856, 818,
- 780, 746, 712, 681, 650, 621, 592, 566, 540, 517,
- 494, 473, 452, 431, 410, 391, 373, 356, 340, 325,
- 310, 296, 282, 270, 258, 247, 236, 225, 214, 203,
- 192, 182, 172, 162, 153, 144, 136, 128, 121, 114,
- 108, 102, 97, 92, 87, 82, 77, 73, 69, 65,
- 62, 59, 56, 53, 50, 47, 45, 43, 41, 39,
- 37, 35, 33, 31, 29, 27, 26, 25, 24, 23,
- 22, 21, 20, 19, 18, 17, 16, 15, 14, 13,
- 12, 11, 10, 9, 8, 7, 6, 5, 4, 3,
- 2, 1, 0
+ 16384, 16116, 15849, 15582, 15316, 15050, 14785, 14521, 14257, 13995,
+ 13734, 13476, 13218, 12963, 12708, 12457, 12206, 11956, 11706, 11460,
+ 11215, 10975, 10735, 10500, 10265, 10034, 9803, 9579, 9355, 9136,
+ 8917, 8703, 8489, 8275, 8061, 7853, 7645, 7444, 7244, 7051,
+ 6858, 6671, 6484, 6305, 6127, 5956, 5785, 5622, 5459, 5298,
+ 5137, 4983, 4830, 4684, 4539, 4401, 4263, 4131, 3999, 3874,
+ 3750, 3632, 3515, 3401, 3287, 3173, 3059, 2949, 2840, 2737,
+ 2635, 2539, 2444, 2354, 2264, 2181, 2098, 2020, 1943, 1872,
+ 1801, 1731, 1661, 1596, 1532, 1472, 1412, 1357, 1303, 1251,
+ 1200, 1153, 1106, 1063, 1020, 979, 938, 897, 856, 818,
+ 780, 746, 712, 681, 650, 621, 592, 566, 540, 517,
+ 494, 473, 452, 431, 410, 391, 373, 356, 340, 325,
+ 310, 296, 282, 270, 258, 247, 236, 225, 214, 203,
+ 192, 182, 172, 162, 153, 144, 136, 128, 121, 114,
+ 108, 102, 97, 92, 87, 82, 77, 73, 69, 65,
+ 62, 59, 56, 53, 50, 47, 45, 43, 41, 39,
+ 37, 35, 33, 31, 29, 27, 26, 25, 24, 23,
+ 22, 21, 20, 19, 18, 17, 16, 15, 14, 13,
+ 12, 11, 10, 9, 8, 7, 6, 5, 4, 3,
+ 2, 1, 0
},
{
- 16384, 16128, 15872, 15617, 15362, 15107, 14853, 14600, 14347, 14096,
- 13846, 13597, 13350, 13105, 12860, 12618, 12376, 12135, 11894, 11657,
- 11421, 11189, 10957, 10730, 10503, 10279, 10056, 9838, 9620, 9407,
- 9195, 8987, 8779, 8571, 8363, 8159, 7955, 7758, 7561, 7371,
- 7182, 6997, 6812, 6635, 6459, 6289, 6120, 5957, 5795, 5634,
- 5473, 5319, 5165, 5018, 4871, 4732, 4593, 4458, 4324, 4197,
- 4071, 3951, 3831, 3714, 3597, 3480, 3363, 3250, 3138, 3032,
- 2927, 2828, 2729, 2635, 2541, 2453, 2366, 2284, 2202, 2126,
- 2050, 1975, 1900, 1830, 1761, 1697, 1633, 1574, 1515, 1459,
- 1403, 1351, 1300, 1252, 1205, 1160, 1115, 1070, 1025, 982,
- 939, 899, 860, 824, 789, 756, 723, 693, 663, 636,
- 609, 584, 559, 535, 511, 489, 467, 447, 427, 409,
- 391, 374, 358, 343, 328, 313, 300, 287, 274, 261,
- 248, 235, 223, 211, 200, 189, 179, 169, 160, 151,
- 143, 135, 128, 121, 115, 109, 103, 97, 92, 87,
- 82, 77, 73, 69, 65, 61, 58, 55, 52, 49,
- 46, 43, 40, 37, 35, 33, 31, 29, 27, 25,
- 23, 21, 20, 19, 18, 17, 16, 15, 14, 13,
- 12, 11, 10, 9, 8, 7, 6, 5, 4, 3,
- 2, 1, 0
+ 16384, 16128, 15872, 15617, 15362, 15107, 14853, 14600, 14347, 14096,
+ 13846, 13597, 13350, 13105, 12860, 12618, 12376, 12135, 11894, 11657,
+ 11421, 11189, 10957, 10730, 10503, 10279, 10056, 9838, 9620, 9407,
+ 9195, 8987, 8779, 8571, 8363, 8159, 7955, 7758, 7561, 7371,
+ 7182, 6997, 6812, 6635, 6459, 6289, 6120, 5957, 5795, 5634,
+ 5473, 5319, 5165, 5018, 4871, 4732, 4593, 4458, 4324, 4197,
+ 4071, 3951, 3831, 3714, 3597, 3480, 3363, 3250, 3138, 3032,
+ 2927, 2828, 2729, 2635, 2541, 2453, 2366, 2284, 2202, 2126,
+ 2050, 1975, 1900, 1830, 1761, 1697, 1633, 1574, 1515, 1459,
+ 1403, 1351, 1300, 1252, 1205, 1160, 1115, 1070, 1025, 982,
+ 939, 899, 860, 824, 789, 756, 723, 693, 663, 636,
+ 609, 584, 559, 535, 511, 489, 467, 447, 427, 409,
+ 391, 374, 358, 343, 328, 313, 300, 287, 274, 261,
+ 248, 235, 223, 211, 200, 189, 179, 169, 160, 151,
+ 143, 135, 128, 121, 115, 109, 103, 97, 92, 87,
+ 82, 77, 73, 69, 65, 61, 58, 55, 52, 49,
+ 46, 43, 40, 37, 35, 33, 31, 29, 27, 25,
+ 23, 21, 20, 19, 18, 17, 16, 15, 14, 13,
+ 12, 11, 10, 9, 8, 7, 6, 5, 4, 3,
+ 2, 1, 0
},
{
- 16384, 16139, 15894, 15649, 15405, 15162, 14919, 14677, 14435, 14195,
- 13955, 13717, 13479, 13243, 13008, 12775, 12542, 12310, 12079, 11851,
- 11623, 11399, 11176, 10956, 10737, 10521, 10305, 10094, 9883, 9677,
- 9471, 9268, 9065, 8862, 8659, 8459, 8260, 8067, 7874, 7688,
- 7502, 7321, 7140, 6965, 6790, 6621, 6452, 6290, 6128, 5968,
- 5808, 5655, 5503, 5356, 5209, 5069, 4929, 4794, 4660, 4532,
- 4404, 4282, 4160, 4041, 3922, 3803, 3684, 3568, 3452, 3343,
- 3234, 3131, 3029, 2931, 2833, 2741, 2649, 2563, 2477, 2396,
- 2316, 2236, 2157, 2083, 2009, 1940, 1871, 1807, 1743, 1683,
- 1623, 1567, 1511, 1459, 1407, 1357, 1307, 1257, 1207, 1159,
- 1111, 1067, 1023, 983, 943, 905, 868, 834, 800, 769,
- 738, 709, 681, 653, 625, 600, 575, 552, 529, 508,
- 487, 466, 447, 428, 410, 392, 376, 360, 344, 328,
- 313, 298, 283, 268, 255, 242, 230, 218, 207, 196,
- 186, 176, 167, 158, 150, 142, 135, 128, 121, 114,
- 108, 102, 97, 92, 87, 82, 78, 74, 70, 66,
- 62, 58, 54, 50, 47, 44, 41, 38, 35, 32,
- 30, 28, 26, 24, 22, 20, 18, 16, 14, 13,
- 12, 11, 10, 9, 8, 7, 6, 5, 4, 3,
- 2, 1, 0
+ 16384, 16139, 15894, 15649, 15405, 15162, 14919, 14677, 14435, 14195,
+ 13955, 13717, 13479, 13243, 13008, 12775, 12542, 12310, 12079, 11851,
+ 11623, 11399, 11176, 10956, 10737, 10521, 10305, 10094, 9883, 9677,
+ 9471, 9268, 9065, 8862, 8659, 8459, 8260, 8067, 7874, 7688,
+ 7502, 7321, 7140, 6965, 6790, 6621, 6452, 6290, 6128, 5968,
+ 5808, 5655, 5503, 5356, 5209, 5069, 4929, 4794, 4660, 4532,
+ 4404, 4282, 4160, 4041, 3922, 3803, 3684, 3568, 3452, 3343,
+ 3234, 3131, 3029, 2931, 2833, 2741, 2649, 2563, 2477, 2396,
+ 2316, 2236, 2157, 2083, 2009, 1940, 1871, 1807, 1743, 1683,
+ 1623, 1567, 1511, 1459, 1407, 1357, 1307, 1257, 1207, 1159,
+ 1111, 1067, 1023, 983, 943, 905, 868, 834, 800, 769,
+ 738, 709, 681, 653, 625, 600, 575, 552, 529, 508,
+ 487, 466, 447, 428, 410, 392, 376, 360, 344, 328,
+ 313, 298, 283, 268, 255, 242, 230, 218, 207, 196,
+ 186, 176, 167, 158, 150, 142, 135, 128, 121, 114,
+ 108, 102, 97, 92, 87, 82, 78, 74, 70, 66,
+ 62, 58, 54, 50, 47, 44, 41, 38, 35, 32,
+ 30, 28, 26, 24, 22, 20, 18, 16, 14, 13,
+ 12, 11, 10, 9, 8, 7, 6, 5, 4, 3,
+ 2, 1, 0
},
{
- 16384, 16149, 15915, 15681, 15447, 15214, 14981, 14749, 14517, 14286,
- 14055, 13827, 13599, 13373, 13147, 12923, 12699, 12476, 12253, 12034,
- 11815, 11599, 11383, 11171, 10959, 10750, 10541, 10337, 10133, 9933,
- 9733, 9536, 9339, 9142, 8945, 8751, 8557, 8369, 8181, 7998,
- 7816, 7638, 7460, 7288, 7116, 6950, 6785, 6625, 6465, 6306,
- 6147, 5995, 5843, 5697, 5551, 5411, 5271, 5135, 5000, 4871,
- 4742, 4618, 4495, 4374, 4253, 4132, 4011, 3893, 3775, 3663,
- 3552, 3446, 3340, 3239, 3138, 3043, 2948, 2858, 2768, 2684,
- 2600, 2516, 2433, 2355, 2278, 2205, 2133, 2065, 1997, 1932,
- 1867, 1807, 1747, 1690, 1634, 1580, 1526, 1472, 1418, 1366,
- 1314, 1266, 1218, 1174, 1130, 1088, 1047, 1009, 971, 936,
- 901, 868, 836, 804, 772, 743, 714, 685, 658, 631,
- 606, 582, 559, 536, 515, 494, 475, 456, 437, 418,
- 399, 380, 362, 344, 328, 312, 297, 283, 270, 257,
- 245, 233, 222, 211, 201, 191, 181, 172, 163, 155,
- 147, 139, 132, 125, 119, 113, 107, 101, 96, 91,
- 86, 81, 76, 71, 66, 62, 58, 54, 50, 46,
- 43, 40, 37, 34, 31, 28, 26, 24, 22, 20,
- 18, 16, 14, 12, 10, 8, 6, 5, 4, 3,
- 2, 1, 0
+ 16384, 16149, 15915, 15681, 15447, 15214, 14981, 14749, 14517, 14286,
+ 14055, 13827, 13599, 13373, 13147, 12923, 12699, 12476, 12253, 12034,
+ 11815, 11599, 11383, 11171, 10959, 10750, 10541, 10337, 10133, 9933,
+ 9733, 9536, 9339, 9142, 8945, 8751, 8557, 8369, 8181, 7998,
+ 7816, 7638, 7460, 7288, 7116, 6950, 6785, 6625, 6465, 6306,
+ 6147, 5995, 5843, 5697, 5551, 5411, 5271, 5135, 5000, 4871,
+ 4742, 4618, 4495, 4374, 4253, 4132, 4011, 3893, 3775, 3663,
+ 3552, 3446, 3340, 3239, 3138, 3043, 2948, 2858, 2768, 2684,
+ 2600, 2516, 2433, 2355, 2278, 2205, 2133, 2065, 1997, 1932,
+ 1867, 1807, 1747, 1690, 1634, 1580, 1526, 1472, 1418, 1366,
+ 1314, 1266, 1218, 1174, 1130, 1088, 1047, 1009, 971, 936,
+ 901, 868, 836, 804, 772, 743, 714, 685, 658, 631,
+ 606, 582, 559, 536, 515, 494, 475, 456, 437, 418,
+ 399, 380, 362, 344, 328, 312, 297, 283, 270, 257,
+ 245, 233, 222, 211, 201, 191, 181, 172, 163, 155,
+ 147, 139, 132, 125, 119, 113, 107, 101, 96, 91,
+ 86, 81, 76, 71, 66, 62, 58, 54, 50, 46,
+ 43, 40, 37, 34, 31, 28, 26, 24, 22, 20,
+ 18, 16, 14, 12, 10, 8, 6, 5, 4, 3,
+ 2, 1, 0
},
{
- 16384, 16159, 15934, 15709, 15485, 15261, 15038, 14816, 14594, 14373,
- 14152, 13933, 13714, 13497, 13280, 13065, 12850, 12636, 12422, 12211,
- 12000, 11791, 11583, 11378, 11173, 10971, 10769, 10571, 10373, 10179,
- 9985, 9793, 9601, 9409, 9217, 9029, 8842, 8658, 8475, 8297,
- 8120, 7946, 7773, 7604, 7435, 7271, 7108, 6950, 6792, 6634,
- 6477, 6326, 6175, 6029, 5883, 5742, 5602, 5466, 5330, 5199,
- 5068, 4943, 4818, 4696, 4574, 4452, 4330, 4211, 4093, 3979,
- 3866, 3759, 3652, 3549, 3446, 3348, 3250, 3157, 3065, 2977,
- 2889, 2802, 2716, 2634, 2553, 2476, 2399, 2326, 2254, 2185,
- 2117, 2052, 1987, 1926, 1866, 1808, 1750, 1692, 1634, 1578,
- 1522, 1470, 1418, 1369, 1321, 1275, 1229, 1187, 1145, 1105,
- 1066, 1027, 991, 955, 919, 883, 850, 817, 786, 756,
- 728, 700, 674, 648, 624, 600, 578, 556, 534, 512,
- 490, 468, 447, 426, 407, 388, 371, 354, 338, 322,
- 307, 293, 280, 267, 255, 243, 231, 219, 209, 199,
- 189, 179, 170, 161, 153, 145, 138, 131, 124, 117,
- 111, 105, 99, 93, 87, 81, 76, 71, 66, 61,
- 57, 53, 49, 45, 42, 39, 36, 33, 30, 27,
- 24, 21, 19, 17, 15, 13, 11, 9, 7, 5,
- 3, 1, 0
+ 16384, 16159, 15934, 15709, 15485, 15261, 15038, 14816, 14594, 14373,
+ 14152, 13933, 13714, 13497, 13280, 13065, 12850, 12636, 12422, 12211,
+ 12000, 11791, 11583, 11378, 11173, 10971, 10769, 10571, 10373, 10179,
+ 9985, 9793, 9601, 9409, 9217, 9029, 8842, 8658, 8475, 8297,
+ 8120, 7946, 7773, 7604, 7435, 7271, 7108, 6950, 6792, 6634,
+ 6477, 6326, 6175, 6029, 5883, 5742, 5602, 5466, 5330, 5199,
+ 5068, 4943, 4818, 4696, 4574, 4452, 4330, 4211, 4093, 3979,
+ 3866, 3759, 3652, 3549, 3446, 3348, 3250, 3157, 3065, 2977,
+ 2889, 2802, 2716, 2634, 2553, 2476, 2399, 2326, 2254, 2185,
+ 2117, 2052, 1987, 1926, 1866, 1808, 1750, 1692, 1634, 1578,
+ 1522, 1470, 1418, 1369, 1321, 1275, 1229, 1187, 1145, 1105,
+ 1066, 1027, 991, 955, 919, 883, 850, 817, 786, 756,
+ 728, 700, 674, 648, 624, 600, 578, 556, 534, 512,
+ 490, 468, 447, 426, 407, 388, 371, 354, 338, 322,
+ 307, 293, 280, 267, 255, 243, 231, 219, 209, 199,
+ 189, 179, 170, 161, 153, 145, 138, 131, 124, 117,
+ 111, 105, 99, 93, 87, 81, 76, 71, 66, 61,
+ 57, 53, 49, 45, 42, 39, 36, 33, 30, 27,
+ 24, 21, 19, 17, 15, 13, 11, 9, 7, 5,
+ 3, 1, 0
},
{
- 16384, 16169, 15954, 15739, 15524, 15310, 15096, 14883, 14670, 14458,
- 14246, 14035, 13824, 13614, 13405, 13198, 12991, 12785, 12579, 12376,
- 12173, 11972, 11772, 11574, 11377, 11182, 10987, 10795, 10603, 10414,
- 10226, 10040, 9854, 9668, 9482, 9299, 9116, 8937, 8759, 8585,
- 8411, 8241, 8071, 7906, 7741, 7580, 7419, 7263, 7107, 6952,
- 6797, 6647, 6497, 6353, 6209, 6070, 5931, 5796, 5661, 5531,
- 5401, 5275, 5150, 5027, 4904, 4781, 4658, 4538, 4419, 4304,
- 4190, 4081, 3972, 3867, 3762, 3662, 3562, 3467, 3372, 3281,
- 3191, 3101, 3012, 2928, 2844, 2764, 2684, 2608, 2533, 2460,
- 2387, 2318, 2250, 2185, 2121, 2059, 1997, 1935, 1873, 1813,
- 1754, 1698, 1642, 1588, 1535, 1483, 1433, 1384, 1338, 1292,
- 1249, 1206, 1165, 1125, 1085, 1045, 1008, 971, 937, 903,
- 871, 840, 810, 780, 752, 724, 698, 672, 647, 622,
- 597, 572, 548, 524, 502, 480, 460, 440, 421, 403,
- 386, 369, 353, 337, 323, 309, 295, 281, 268, 255,
- 243, 231, 220, 209, 199, 189, 180, 171, 163, 155,
- 147, 139, 131, 123, 116, 109, 102, 95, 89, 83,
- 77, 72, 67, 62, 57, 52, 48, 44, 40, 36,
- 32, 28, 25, 22, 19, 16, 13, 10, 8, 6,
- 4, 2, 0
+ 16384, 16169, 15954, 15739, 15524, 15310, 15096, 14883, 14670, 14458,
+ 14246, 14035, 13824, 13614, 13405, 13198, 12991, 12785, 12579, 12376,
+ 12173, 11972, 11772, 11574, 11377, 11182, 10987, 10795, 10603, 10414,
+ 10226, 10040, 9854, 9668, 9482, 9299, 9116, 8937, 8759, 8585,
+ 8411, 8241, 8071, 7906, 7741, 7580, 7419, 7263, 7107, 6952,
+ 6797, 6647, 6497, 6353, 6209, 6070, 5931, 5796, 5661, 5531,
+ 5401, 5275, 5150, 5027, 4904, 4781, 4658, 4538, 4419, 4304,
+ 4190, 4081, 3972, 3867, 3762, 3662, 3562, 3467, 3372, 3281,
+ 3191, 3101, 3012, 2928, 2844, 2764, 2684, 2608, 2533, 2460,
+ 2387, 2318, 2250, 2185, 2121, 2059, 1997, 1935, 1873, 1813,
+ 1754, 1698, 1642, 1588, 1535, 1483, 1433, 1384, 1338, 1292,
+ 1249, 1206, 1165, 1125, 1085, 1045, 1008, 971, 937, 903,
+ 871, 840, 810, 780, 752, 724, 698, 672, 647, 622,
+ 597, 572, 548, 524, 502, 480, 460, 440, 421, 403,
+ 386, 369, 353, 337, 323, 309, 295, 281, 268, 255,
+ 243, 231, 220, 209, 199, 189, 180, 171, 163, 155,
+ 147, 139, 131, 123, 116, 109, 102, 95, 89, 83,
+ 77, 72, 67, 62, 57, 52, 48, 44, 40, 36,
+ 32, 28, 25, 22, 19, 16, 13, 10, 8, 6,
+ 4, 2, 0
},
{
- 16384, 16177, 15970, 15764, 15558, 15353, 15148, 14944, 14740, 14537,
- 14334, 14132, 13930, 13729, 13529, 13330, 13131, 12933, 12735, 12539,
- 12343, 12150, 11957, 11766, 11576, 11388, 11200, 11015, 10830, 10647,
- 10465, 10285, 10105, 9925, 9745, 9568, 9391, 9218, 9045, 8876,
- 8707, 8541, 8375, 8213, 8051, 7894, 7737, 7583, 7429, 7277,
- 7125, 6977, 6830, 6687, 6544, 6406, 6268, 6133, 5998, 5868,
- 5738, 5612, 5487, 5364, 5241, 5118, 4995, 4875, 4755, 4640,
- 4525, 4414, 4304, 4198, 4092, 3990, 3888, 3790, 3693, 3600,
- 3507, 3415, 3323, 3235, 3147, 3064, 2981, 2902, 2823, 2746,
- 2670, 2594, 2522, 2450, 2382, 2314, 2248, 2182, 2116, 2050,
- 1987, 1924, 1864, 1804, 1748, 1692, 1638, 1585, 1534, 1484,
- 1437, 1390, 1346, 1302, 1258, 1215, 1174, 1133, 1095, 1057,
- 1021, 986, 952, 918, 887, 856, 827, 798, 770, 742,
- 714, 686, 659, 632, 607, 582, 559, 536, 514, 492,
- 472, 452, 433, 415, 398, 381, 364, 348, 333, 318,
- 304, 290, 277, 264, 252, 240, 229, 218, 208, 198,
- 188, 178, 168, 158, 149, 140, 132, 124, 116, 108,
- 101, 94, 87, 81, 75, 69, 64, 59, 54, 49,
- 44, 39, 35, 31, 27, 23, 19, 15, 12, 9,
- 6, 3, 0
+ 16384, 16177, 15970, 15764, 15558, 15353, 15148, 14944, 14740, 14537,
+ 14334, 14132, 13930, 13729, 13529, 13330, 13131, 12933, 12735, 12539,
+ 12343, 12150, 11957, 11766, 11576, 11388, 11200, 11015, 10830, 10647,
+ 10465, 10285, 10105, 9925, 9745, 9568, 9391, 9218, 9045, 8876,
+ 8707, 8541, 8375, 8213, 8051, 7894, 7737, 7583, 7429, 7277,
+ 7125, 6977, 6830, 6687, 6544, 6406, 6268, 6133, 5998, 5868,
+ 5738, 5612, 5487, 5364, 5241, 5118, 4995, 4875, 4755, 4640,
+ 4525, 4414, 4304, 4198, 4092, 3990, 3888, 3790, 3693, 3600,
+ 3507, 3415, 3323, 3235, 3147, 3064, 2981, 2902, 2823, 2746,
+ 2670, 2594, 2522, 2450, 2382, 2314, 2248, 2182, 2116, 2050,
+ 1987, 1924, 1864, 1804, 1748, 1692, 1638, 1585, 1534, 1484,
+ 1437, 1390, 1346, 1302, 1258, 1215, 1174, 1133, 1095, 1057,
+ 1021, 986, 952, 918, 887, 856, 827, 798, 770, 742,
+ 714, 686, 659, 632, 607, 582, 559, 536, 514, 492,
+ 472, 452, 433, 415, 398, 381, 364, 348, 333, 318,
+ 304, 290, 277, 264, 252, 240, 229, 218, 208, 198,
+ 188, 178, 168, 158, 149, 140, 132, 124, 116, 108,
+ 101, 94, 87, 81, 75, 69, 64, 59, 54, 49,
+ 44, 39, 35, 31, 27, 23, 19, 15, 12, 9,
+ 6, 3, 0
}
};
static const uint16_t cf_tables_3[5][257] = {
{
- 16384, 16187, 15990, 15793, 15597, 15401, 15205, 15009, 14813, 14618,
- 14423, 14230, 14037, 13845, 13653, 13463, 13273, 13083, 12894, 12706,
- 12518, 12332, 12146, 11962, 11778, 11597, 11416, 11237, 11059, 10882,
- 10706, 10532, 10358, 10184, 10010, 9838, 9666, 9497, 9328, 9163,
- 8999, 8837, 8675, 8517, 8359, 8205, 8051, 7901, 7751, 7602,
- 7453, 7308, 7163, 7022, 6882, 6745, 6609, 6476, 6343, 6214,
- 6085, 5960, 5835, 5712, 5589, 5466, 5343, 5223, 5103, 4987,
- 4872, 4761, 4650, 4542, 4435, 4332, 4229, 4130, 4031, 3936,
- 3841, 3747, 3653, 3563, 3473, 3387, 3302, 3220, 3138, 3059,
- 2980, 2905, 2830, 2759, 2688, 2619, 2550, 2481, 2412, 2345,
- 2278, 2215, 2152, 2092, 2032, 1974, 1917, 1863, 1809, 1758,
- 1707, 1659, 1611, 1564, 1517, 1473, 1429, 1387, 1346, 1307,
- 1268, 1230, 1193, 1158, 1123, 1090, 1058, 1026, 994, 962,
- 930, 899, 869, 841, 813, 786, 760, 735, 710, 687,
- 664, 643, 622, 602, 582, 562, 543, 525, 507, 490,
- 473, 457, 442, 427, 412, 398, 385, 373, 361, 349,
- 337, 325, 313, 301, 290, 279, 269, 259, 249, 240,
- 231, 222, 214, 206, 199, 192, 185, 178, 171, 165,
- 159, 153, 148, 143, 138, 133, 128, 123, 119, 115,
- 111, 107, 103, 99, 95, 91, 87, 83, 80, 77,
- 74, 71, 68, 65, 63, 61, 59, 57, 55, 53,
- 51, 49, 47, 45, 43, 41, 40, 39, 38, 37,
- 36, 35, 34, 33, 32, 31, 30, 29, 28, 27,
- 26, 25, 24, 23, 22, 21, 20, 19, 18, 17,
- 16, 15, 14, 13, 12, 11, 10, 9, 8, 7,
- 6, 5, 4, 3, 2, 1, 0
+ 16384, 16187, 15990, 15793, 15597, 15401, 15205, 15009, 14813, 14618,
+ 14423, 14230, 14037, 13845, 13653, 13463, 13273, 13083, 12894, 12706,
+ 12518, 12332, 12146, 11962, 11778, 11597, 11416, 11237, 11059, 10882,
+ 10706, 10532, 10358, 10184, 10010, 9838, 9666, 9497, 9328, 9163,
+ 8999, 8837, 8675, 8517, 8359, 8205, 8051, 7901, 7751, 7602,
+ 7453, 7308, 7163, 7022, 6882, 6745, 6609, 6476, 6343, 6214,
+ 6085, 5960, 5835, 5712, 5589, 5466, 5343, 5223, 5103, 4987,
+ 4872, 4761, 4650, 4542, 4435, 4332, 4229, 4130, 4031, 3936,
+ 3841, 3747, 3653, 3563, 3473, 3387, 3302, 3220, 3138, 3059,
+ 2980, 2905, 2830, 2759, 2688, 2619, 2550, 2481, 2412, 2345,
+ 2278, 2215, 2152, 2092, 2032, 1974, 1917, 1863, 1809, 1758,
+ 1707, 1659, 1611, 1564, 1517, 1473, 1429, 1387, 1346, 1307,
+ 1268, 1230, 1193, 1158, 1123, 1090, 1058, 1026, 994, 962,
+ 930, 899, 869, 841, 813, 786, 760, 735, 710, 687,
+ 664, 643, 622, 602, 582, 562, 543, 525, 507, 490,
+ 473, 457, 442, 427, 412, 398, 385, 373, 361, 349,
+ 337, 325, 313, 301, 290, 279, 269, 259, 249, 240,
+ 231, 222, 214, 206, 199, 192, 185, 178, 171, 165,
+ 159, 153, 148, 143, 138, 133, 128, 123, 119, 115,
+ 111, 107, 103, 99, 95, 91, 87, 83, 80, 77,
+ 74, 71, 68, 65, 63, 61, 59, 57, 55, 53,
+ 51, 49, 47, 45, 43, 41, 40, 39, 38, 37,
+ 36, 35, 34, 33, 32, 31, 30, 29, 28, 27,
+ 26, 25, 24, 23, 22, 21, 20, 19, 18, 17,
+ 16, 15, 14, 13, 12, 11, 10, 9, 8, 7,
+ 6, 5, 4, 3, 2, 1, 0
},
{
- 16384, 16195, 16006, 15817, 15629, 15441, 15253, 15065, 14878, 14692,
- 14506, 14321, 14136, 13952, 13768, 13585, 13402, 13219, 13037, 12857,
- 12677, 12499, 12321, 12144, 11967, 11792, 11617, 11444, 11271, 11100,
- 10930, 10762, 10594, 10426, 10258, 10091, 9925, 9761, 9598, 9438,
- 9278, 9120, 8963, 8809, 8655, 8504, 8354, 8207, 8060, 7914,
- 7769, 7627, 7485, 7347, 7209, 7074, 6939, 6807, 6676, 6548,
- 6420, 6296, 6172, 6050, 5928, 5806, 5684, 5564, 5444, 5328,
- 5212, 5100, 4988, 4879, 4771, 4667, 4563, 4462, 4362, 4265,
- 4169, 4073, 3978, 3886, 3795, 3707, 3619, 3535, 3451, 3369,
- 3288, 3210, 3133, 3059, 2985, 2913, 2841, 2769, 2697, 2627,
- 2557, 2490, 2424, 2360, 2297, 2237, 2177, 2119, 2062, 2007,
- 1953, 1901, 1849, 1798, 1748, 1700, 1652, 1607, 1562, 1519,
- 1476, 1435, 1394, 1355, 1317, 1281, 1245, 1210, 1175, 1140,
- 1105, 1071, 1037, 1005, 973, 943, 913, 885, 857, 830,
- 804, 779, 754, 731, 708, 685, 663, 642, 621, 601,
- 581, 563, 545, 528, 511, 495, 479, 463, 448, 433,
- 419, 405, 391, 377, 364, 351, 338, 326, 314, 302,
- 291, 280, 270, 260, 251, 242, 234, 226, 218, 210,
- 202, 195, 188, 181, 174, 168, 162, 156, 150, 144,
- 139, 134, 129, 124, 119, 114, 109, 104, 100, 96,
- 92, 88, 84, 80, 77, 74, 71, 68, 65, 62,
- 59, 56, 54, 52, 50, 48, 46, 44, 42, 40,
- 38, 36, 34, 33, 32, 31, 30, 29, 28, 27,
- 26, 25, 24, 23, 22, 21, 20, 19, 18, 17,
- 16, 15, 14, 13, 12, 11, 10, 9, 8, 7,
- 6, 5, 4, 3, 2, 1, 0
+ 16384, 16195, 16006, 15817, 15629, 15441, 15253, 15065, 14878, 14692,
+ 14506, 14321, 14136, 13952, 13768, 13585, 13402, 13219, 13037, 12857,
+ 12677, 12499, 12321, 12144, 11967, 11792, 11617, 11444, 11271, 11100,
+ 10930, 10762, 10594, 10426, 10258, 10091, 9925, 9761, 9598, 9438,
+ 9278, 9120, 8963, 8809, 8655, 8504, 8354, 8207, 8060, 7914,
+ 7769, 7627, 7485, 7347, 7209, 7074, 6939, 6807, 6676, 6548,
+ 6420, 6296, 6172, 6050, 5928, 5806, 5684, 5564, 5444, 5328,
+ 5212, 5100, 4988, 4879, 4771, 4667, 4563, 4462, 4362, 4265,
+ 4169, 4073, 3978, 3886, 3795, 3707, 3619, 3535, 3451, 3369,
+ 3288, 3210, 3133, 3059, 2985, 2913, 2841, 2769, 2697, 2627,
+ 2557, 2490, 2424, 2360, 2297, 2237, 2177, 2119, 2062, 2007,
+ 1953, 1901, 1849, 1798, 1748, 1700, 1652, 1607, 1562, 1519,
+ 1476, 1435, 1394, 1355, 1317, 1281, 1245, 1210, 1175, 1140,
+ 1105, 1071, 1037, 1005, 973, 943, 913, 885, 857, 830,
+ 804, 779, 754, 731, 708, 685, 663, 642, 621, 601,
+ 581, 563, 545, 528, 511, 495, 479, 463, 448, 433,
+ 419, 405, 391, 377, 364, 351, 338, 326, 314, 302,
+ 291, 280, 270, 260, 251, 242, 234, 226, 218, 210,
+ 202, 195, 188, 181, 174, 168, 162, 156, 150, 144,
+ 139, 134, 129, 124, 119, 114, 109, 104, 100, 96,
+ 92, 88, 84, 80, 77, 74, 71, 68, 65, 62,
+ 59, 56, 54, 52, 50, 48, 46, 44, 42, 40,
+ 38, 36, 34, 33, 32, 31, 30, 29, 28, 27,
+ 26, 25, 24, 23, 22, 21, 20, 19, 18, 17,
+ 16, 15, 14, 13, 12, 11, 10, 9, 8, 7,
+ 6, 5, 4, 3, 2, 1, 0
},
{
- 16384, 16203, 16022, 15842, 15662, 15482, 15302, 15122, 14942, 14763,
- 14584, 14406, 14228, 14051, 13874, 13698, 13522, 13347, 13172, 12998,
- 12824, 12652, 12480, 12310, 12140, 11971, 11803, 11637, 11471, 11307,
- 11143, 10980, 10817, 10654, 10491, 10330, 10169, 10011, 9853, 9697,
- 9542, 9389, 9236, 9086, 8936, 8789, 8642, 8498, 8355, 8212,
- 8070, 7931, 7792, 7656, 7520, 7388, 7256, 7126, 6996, 6870,
- 6744, 6621, 6498, 6377, 6256, 6135, 6014, 5895, 5776, 5660,
- 5545, 5433, 5321, 5212, 5104, 4999, 4895, 4793, 4692, 4594,
- 4496, 4400, 4304, 4211, 4118, 4028, 3939, 3853, 3767, 3684,
- 3601, 3521, 3441, 3364, 3287, 3212, 3137, 3062, 2987, 2915,
- 2843, 2773, 2704, 2638, 2572, 2508, 2445, 2384, 2324, 2266,
- 2208, 2153, 2098, 2044, 1990, 1939, 1888, 1839, 1791, 1745,
- 1699, 1655, 1611, 1569, 1527, 1487, 1448, 1409, 1370, 1331,
- 1292, 1255, 1218, 1183, 1148, 1115, 1082, 1051, 1020, 990,
- 960, 932, 904, 878, 852, 826, 801, 777, 753, 731,
- 709, 687, 666, 645, 625, 605, 586, 567, 550, 533,
- 516, 499, 482, 465, 449, 433, 418, 403, 389, 375,
- 362, 349, 337, 325, 314, 303, 293, 283, 273, 263,
- 254, 245, 236, 227, 219, 211, 204, 197, 190, 183,
- 177, 171, 165, 159, 153, 147, 141, 135, 130, 125,
- 120, 115, 110, 105, 101, 97, 93, 89, 85, 81,
- 77, 74, 71, 68, 65, 62, 59, 56, 53, 51,
- 49, 47, 45, 43, 41, 39, 37, 35, 33, 31,
- 29, 27, 25, 23, 22, 21, 20, 19, 18, 17,
- 16, 15, 14, 13, 12, 11, 10, 9, 8, 7,
- 6, 5, 4, 3, 2, 1, 0
+ 16384, 16203, 16022, 15842, 15662, 15482, 15302, 15122, 14942, 14763,
+ 14584, 14406, 14228, 14051, 13874, 13698, 13522, 13347, 13172, 12998,
+ 12824, 12652, 12480, 12310, 12140, 11971, 11803, 11637, 11471, 11307,
+ 11143, 10980, 10817, 10654, 10491, 10330, 10169, 10011, 9853, 9697,
+ 9542, 9389, 9236, 9086, 8936, 8789, 8642, 8498, 8355, 8212,
+ 8070, 7931, 7792, 7656, 7520, 7388, 7256, 7126, 6996, 6870,
+ 6744, 6621, 6498, 6377, 6256, 6135, 6014, 5895, 5776, 5660,
+ 5545, 5433, 5321, 5212, 5104, 4999, 4895, 4793, 4692, 4594,
+ 4496, 4400, 4304, 4211, 4118, 4028, 3939, 3853, 3767, 3684,
+ 3601, 3521, 3441, 3364, 3287, 3212, 3137, 3062, 2987, 2915,
+ 2843, 2773, 2704, 2638, 2572, 2508, 2445, 2384, 2324, 2266,
+ 2208, 2153, 2098, 2044, 1990, 1939, 1888, 1839, 1791, 1745,
+ 1699, 1655, 1611, 1569, 1527, 1487, 1448, 1409, 1370, 1331,
+ 1292, 1255, 1218, 1183, 1148, 1115, 1082, 1051, 1020, 990,
+ 960, 932, 904, 878, 852, 826, 801, 777, 753, 731,
+ 709, 687, 666, 645, 625, 605, 586, 567, 550, 533,
+ 516, 499, 482, 465, 449, 433, 418, 403, 389, 375,
+ 362, 349, 337, 325, 314, 303, 293, 283, 273, 263,
+ 254, 245, 236, 227, 219, 211, 204, 197, 190, 183,
+ 177, 171, 165, 159, 153, 147, 141, 135, 130, 125,
+ 120, 115, 110, 105, 101, 97, 93, 89, 85, 81,
+ 77, 74, 71, 68, 65, 62, 59, 56, 53, 51,
+ 49, 47, 45, 43, 41, 39, 37, 35, 33, 31,
+ 29, 27, 25, 23, 22, 21, 20, 19, 18, 17,
+ 16, 15, 14, 13, 12, 11, 10, 9, 8, 7,
+ 6, 5, 4, 3, 2, 1, 0
},
{
- 16384, 16210, 16036, 15863, 15690, 15517, 15344, 15172, 15000, 14828,
- 14656, 14485, 14314, 14145, 13976, 13808, 13640, 13472, 13304, 13137,
- 12970, 12804, 12639, 12475, 12312, 12149, 11987, 11827, 11667, 11508,
- 11349, 11192, 11035, 10878, 10721, 10565, 10410, 10257, 10104, 9953,
- 9802, 9654, 9506, 9359, 9213, 9070, 8927, 8787, 8647, 8508,
- 8369, 8233, 8097, 7964, 7831, 7700, 7570, 7442, 7315, 7190,
- 7065, 6943, 6821, 6701, 6581, 6461, 6341, 6223, 6105, 5990,
- 5876, 5764, 5653, 5545, 5437, 5331, 5226, 5124, 5022, 4924,
- 4826, 4729, 4632, 4538, 4444, 4353, 4262, 4174, 4087, 4002,
- 3917, 3835, 3753, 3674, 3595, 3518, 3441, 3364, 3287, 3212,
- 3138, 3066, 2995, 2926, 2858, 2792, 2726, 2662, 2599, 2538,
- 2478, 2420, 2362, 2305, 2249, 2195, 2141, 2089, 2037, 1988,
- 1939, 1891, 1844, 1799, 1754, 1711, 1668, 1626, 1584, 1542,
- 1500, 1459, 1418, 1380, 1342, 1305, 1269, 1234, 1199, 1166,
- 1133, 1102, 1071, 1041, 1012, 983, 954, 926, 899, 872,
- 847, 822, 798, 774, 751, 728, 707, 686, 666, 646,
- 627, 608, 589, 570, 552, 534, 517, 500, 484, 468,
- 453, 438, 424, 410, 397, 384, 372, 360, 348, 336,
- 325, 314, 303, 293, 283, 273, 264, 255, 246, 237,
- 229, 221, 213, 205, 197, 189, 181, 174, 167, 160,
- 154, 148, 142, 136, 131, 126, 121, 116, 111, 106,
- 101, 97, 93, 89, 85, 81, 77, 73, 70, 67,
- 64, 61, 58, 55, 52, 49, 46, 43, 40, 37,
- 35, 33, 31, 29, 27, 25, 23, 21, 19, 17,
- 16, 15, 14, 13, 12, 11, 10, 9, 8, 7,
- 6, 5, 4, 3, 2, 1, 0
+ 16384, 16210, 16036, 15863, 15690, 15517, 15344, 15172, 15000, 14828,
+ 14656, 14485, 14314, 14145, 13976, 13808, 13640, 13472, 13304, 13137,
+ 12970, 12804, 12639, 12475, 12312, 12149, 11987, 11827, 11667, 11508,
+ 11349, 11192, 11035, 10878, 10721, 10565, 10410, 10257, 10104, 9953,
+ 9802, 9654, 9506, 9359, 9213, 9070, 8927, 8787, 8647, 8508,
+ 8369, 8233, 8097, 7964, 7831, 7700, 7570, 7442, 7315, 7190,
+ 7065, 6943, 6821, 6701, 6581, 6461, 6341, 6223, 6105, 5990,
+ 5876, 5764, 5653, 5545, 5437, 5331, 5226, 5124, 5022, 4924,
+ 4826, 4729, 4632, 4538, 4444, 4353, 4262, 4174, 4087, 4002,
+ 3917, 3835, 3753, 3674, 3595, 3518, 3441, 3364, 3287, 3212,
+ 3138, 3066, 2995, 2926, 2858, 2792, 2726, 2662, 2599, 2538,
+ 2478, 2420, 2362, 2305, 2249, 2195, 2141, 2089, 2037, 1988,
+ 1939, 1891, 1844, 1799, 1754, 1711, 1668, 1626, 1584, 1542,
+ 1500, 1459, 1418, 1380, 1342, 1305, 1269, 1234, 1199, 1166,
+ 1133, 1102, 1071, 1041, 1012, 983, 954, 926, 899, 872,
+ 847, 822, 798, 774, 751, 728, 707, 686, 666, 646,
+ 627, 608, 589, 570, 552, 534, 517, 500, 484, 468,
+ 453, 438, 424, 410, 397, 384, 372, 360, 348, 336,
+ 325, 314, 303, 293, 283, 273, 264, 255, 246, 237,
+ 229, 221, 213, 205, 197, 189, 181, 174, 167, 160,
+ 154, 148, 142, 136, 131, 126, 121, 116, 111, 106,
+ 101, 97, 93, 89, 85, 81, 77, 73, 70, 67,
+ 64, 61, 58, 55, 52, 49, 46, 43, 40, 37,
+ 35, 33, 31, 29, 27, 25, 23, 21, 19, 17,
+ 16, 15, 14, 13, 12, 11, 10, 9, 8, 7,
+ 6, 5, 4, 3, 2, 1, 0
},
{
- 16384, 16218, 16052, 15886, 15720, 15554, 15389, 15224, 15059, 14895,
- 14731, 14567, 14403, 14240, 14077, 13915, 13753, 13591, 13429, 13269,
- 13109, 12950, 12791, 12633, 12476, 12320, 12164, 12009, 11854, 11701,
- 11548, 11396, 11244, 11092, 10940, 10790, 10640, 10492, 10344, 10198,
- 10052, 9908, 9764, 9622, 9481, 9342, 9203, 9066, 8929, 8793,
- 8657, 8524, 8391, 8261, 8131, 8003, 7875, 7749, 7624, 7502,
- 7380, 7260, 7140, 7022, 6904, 6786, 6668, 6551, 6435, 6322,
- 6209, 6099, 5989, 5881, 5773, 5668, 5563, 5461, 5359, 5260,
- 5161, 5063, 4965, 4871, 4777, 4686, 4595, 4506, 4417, 4331,
- 4245, 4162, 4079, 3999, 3919, 3841, 3763, 3685, 3607, 3530,
- 3454, 3380, 3307, 3236, 3166, 3097, 3029, 2963, 2897, 2834,
- 2771, 2710, 2650, 2591, 2532, 2475, 2418, 2363, 2309, 2257,
- 2205, 2155, 2105, 2057, 2009, 1963, 1918, 1873, 1828, 1783,
- 1738, 1694, 1650, 1607, 1565, 1524, 1484, 1445, 1407, 1369,
- 1333, 1297, 1263, 1229, 1197, 1165, 1134, 1103, 1073, 1043,
- 1015, 987, 960, 933, 907, 882, 858, 834, 811, 788,
- 766, 744, 722, 700, 679, 658, 638, 618, 599, 581,
- 563, 545, 528, 511, 495, 480, 465, 451, 437, 423,
- 410, 397, 384, 372, 360, 348, 337, 326, 315, 305,
- 295, 285, 275, 265, 255, 245, 236, 227, 219, 211,
- 203, 195, 188, 181, 174, 167, 161, 155, 149, 143,
- 137, 131, 126, 121, 116, 111, 106, 101, 97, 93,
- 89, 85, 81, 77, 73, 69, 65, 61, 58, 55,
- 52, 49, 46, 43, 40, 37, 34, 32, 30, 28,
- 26, 24, 22, 20, 18, 16, 14, 12, 10, 8,
- 6, 5, 4, 3, 2, 1, 0
+ 16384, 16218, 16052, 15886, 15720, 15554, 15389, 15224, 15059, 14895,
+ 14731, 14567, 14403, 14240, 14077, 13915, 13753, 13591, 13429, 13269,
+ 13109, 12950, 12791, 12633, 12476, 12320, 12164, 12009, 11854, 11701,
+ 11548, 11396, 11244, 11092, 10940, 10790, 10640, 10492, 10344, 10198,
+ 10052, 9908, 9764, 9622, 9481, 9342, 9203, 9066, 8929, 8793,
+ 8657, 8524, 8391, 8261, 8131, 8003, 7875, 7749, 7624, 7502,
+ 7380, 7260, 7140, 7022, 6904, 6786, 6668, 6551, 6435, 6322,
+ 6209, 6099, 5989, 5881, 5773, 5668, 5563, 5461, 5359, 5260,
+ 5161, 5063, 4965, 4871, 4777, 4686, 4595, 4506, 4417, 4331,
+ 4245, 4162, 4079, 3999, 3919, 3841, 3763, 3685, 3607, 3530,
+ 3454, 3380, 3307, 3236, 3166, 3097, 3029, 2963, 2897, 2834,
+ 2771, 2710, 2650, 2591, 2532, 2475, 2418, 2363, 2309, 2257,
+ 2205, 2155, 2105, 2057, 2009, 1963, 1918, 1873, 1828, 1783,
+ 1738, 1694, 1650, 1607, 1565, 1524, 1484, 1445, 1407, 1369,
+ 1333, 1297, 1263, 1229, 1197, 1165, 1134, 1103, 1073, 1043,
+ 1015, 987, 960, 933, 907, 882, 858, 834, 811, 788,
+ 766, 744, 722, 700, 679, 658, 638, 618, 599, 581,
+ 563, 545, 528, 511, 495, 480, 465, 451, 437, 423,
+ 410, 397, 384, 372, 360, 348, 337, 326, 315, 305,
+ 295, 285, 275, 265, 255, 245, 236, 227, 219, 211,
+ 203, 195, 188, 181, 174, 167, 161, 155, 149, 143,
+ 137, 131, 126, 121, 116, 111, 106, 101, 97, 93,
+ 89, 85, 81, 77, 73, 69, 65, 61, 58, 55,
+ 52, 49, 46, 43, 40, 37, 34, 32, 30, 28,
+ 26, 24, 22, 20, 18, 16, 14, 12, 10, 8,
+ 6, 5, 4, 3, 2, 1, 0
}
};
-static const uint16_t * const cf_table[16] = {
+static const uint16_t *const cf_table[16] = {
cf_tables_1[0], cf_tables_1[1], cf_tables_1[2], cf_tables_2[0],
cf_tables_2[1], cf_tables_2[2], cf_tables_2[3], cf_tables_2[4],
cf_tables_2[5], cf_tables_2[6], cf_tables_2[7], cf_tables_3[0],
@@ -424,10 +421,8 @@ static const uint16_t * const cf_table[16] = {
};
-/** Initialize a given lookup table using a given delta
- */
-static void bgmc_lut_fillp(uint8_t *lut, int *lut_status,
- int delta)
+/** Initialize a given lookup table using a given delta */
+static void bgmc_lut_fillp(uint8_t *lut, int *lut_status, int delta)
{
unsigned int sx, i;
@@ -446,10 +441,8 @@ static void bgmc_lut_fillp(uint8_t *lut, int *lut_status,
}
-/** Retune the index of a suitable lookup table for a given delta
- */
-static uint8_t* bgmc_lut_getp(uint8_t *lut, int *lut_status,
- int delta)
+/** Retune the index of a suitable lookup table for a given delta */
+static uint8_t *bgmc_lut_getp(uint8_t *lut, int *lut_status, int delta)
{
unsigned int i = av_clip(delta, 0, LUT_BUFF - 1);
@@ -462,20 +455,18 @@ static uint8_t* bgmc_lut_getp(uint8_t *lut, int *lut_status,
}
-/** Initialize the lookup table arrays
- */
+/** Initialize the lookup table arrays */
int ff_bgmc_init(AVCodecContext *avctx, uint8_t **cf_lut, int **cf_lut_status)
{
- *cf_lut = av_malloc(sizeof(*cf_lut ) * LUT_BUFF * 16 * LUT_SIZE);
+ *cf_lut = av_malloc(sizeof(*cf_lut) * LUT_BUFF * 16 * LUT_SIZE);
*cf_lut_status = av_malloc(sizeof(*cf_lut_status) * LUT_BUFF);
- if (!cf_lut || !cf_lut_status) {
+ if (!*cf_lut || !*cf_lut_status) {
ff_bgmc_end(cf_lut, cf_lut_status);
av_log(avctx, AV_LOG_ERROR, "Allocating buffer memory failed.\n");
return AVERROR(ENOMEM);
} else {
- // initialize lut_status buffer to a value never used to compare
- // against
+ // initialize lut_status buffer to a value never used to compare against
memset(*cf_lut_status, -1, sizeof(*cf_lut_status) * LUT_BUFF);
}
@@ -483,8 +474,7 @@ int ff_bgmc_init(AVCodecContext *avctx, uint8_t **cf_lut, int **cf_lut_status)
}
-/** Release the lookup table arrays
- */
+/** Release the lookup table arrays */
void ff_bgmc_end(uint8_t **cf_lut, int **cf_lut_status)
{
av_freep(cf_lut);
@@ -492,10 +482,9 @@ void ff_bgmc_end(uint8_t **cf_lut, int **cf_lut_status)
}
-/** Initialize decoding and reads the first value
- */
-void ff_bgmc_decode_init(GetBitContext *gb,
- unsigned int *h, unsigned int *l, unsigned int *v)
+/** Initialize decoding and reads the first value */
+void ff_bgmc_decode_init(GetBitContext *gb, unsigned int *h, unsigned int *l,
+ unsigned int *v)
{
*h = TOP_VALUE;
*l = 0;
@@ -503,16 +492,14 @@ void ff_bgmc_decode_init(GetBitContext *gb,
}
-/** Finish decoding
- */
+/** Finish decoding */
void ff_bgmc_decode_end(GetBitContext *gb)
{
skip_bits_long(gb, -(VALUE_BITS - 2));
}
-/** Read and decode a block Gilbert-Moore coded symbol
- */
+/** Read and decode a block Gilbert-Moore coded symbol */
void ff_bgmc_decode(GetBitContext *gb, unsigned int num, int32_t *dst,
int delta, unsigned int sx,
unsigned int *h, unsigned int *l, unsigned int *v,
@@ -522,9 +509,9 @@ void ff_bgmc_decode(GetBitContext *gb, unsigned int num, int32_t *dst,
uint8_t *lut = bgmc_lut_getp(cf_lut, cf_lut_status, delta);
// read current state
- unsigned int high = *h;
- unsigned int low = *l;
- unsigned int value = *v;
+ unsigned int high = *h;
+ unsigned int low = *l;
+ unsigned int value = *v;
lut += sx * LUT_SIZE;
@@ -539,12 +526,12 @@ void ff_bgmc_decode(GetBitContext *gb, unsigned int num, int32_t *dst,
symbol = (symbol >> delta) - 1;
- high = low + ((range * cf_table[sx][(symbol ) << delta] - (1 << FREQ_BITS)) >> FREQ_BITS);
- low = low + ((range * cf_table[sx][(symbol + 1) << delta] ) >> FREQ_BITS);
+ high = low + ((range * cf_table[sx][(symbol) << delta] - (1 << FREQ_BITS)) >> FREQ_BITS);
+ low = low + ((range * cf_table[sx][(symbol + 1) << delta]) >> FREQ_BITS);
while (1) {
if (high >= HALF) {
- if (low >= HALF) {
+ if (low >= HALF) {
value -= HALF;
low -= HALF;
high -= HALF;
@@ -552,12 +539,13 @@ void ff_bgmc_decode(GetBitContext *gb, unsigned int num, int32_t *dst,
value -= FIRST_QTR;
low -= FIRST_QTR;
high -= FIRST_QTR;
- } else break;
+ } else
+ break;
}
- low *= 2;
- high = 2 * high + 1;
- value = 2 * value + get_bits1(gb);
+ low *= 2;
+ high = 2 * high + 1;
+ value = 2 * value + get_bits1(gb);
}
*dst++ = symbol;
diff --git a/gst-libs/ext/libav/libavcodec/bink.c b/gst-libs/ext/libav/libavcodec/bink.c
index f38c030..059601d 100644
--- a/gst-libs/ext/libav/libavcodec/bink.c
+++ b/gst-libs/ext/libav/libavcodec/bink.c
@@ -25,6 +25,7 @@
#include "dsputil.h"
#include "binkdata.h"
#include "binkdsp.h"
+#include "internal.h"
#include "mathops.h"
#define BITSTREAM_READER_LE
@@ -146,6 +147,8 @@ enum BlockTypes {
*/
static void init_lengths(BinkContext *c, int width, int bw)
{
+ width = FFALIGN(width, 8);
+
c->bundle[BINK_SRC_BLOCK_TYPES].len = av_log2((width >> 3) + 511) + 1;
c->bundle[BINK_SRC_SUB_BLOCK_TYPES].len = av_log2((width >> 4) + 511) + 1;
@@ -231,7 +234,7 @@ static void merge(GetBitContext *gb, uint8_t *dst, uint8_t *src, int size)
*/
static void read_tree(GetBitContext *gb, Tree *tree)
{
- uint8_t tmp1[16], tmp2[16], *in = tmp1, *out = tmp2;
+ uint8_t tmp1[16] = { 0 }, tmp2[16], *in = tmp1, *out = tmp2;
int i, t, len;
tree->vlc_num = get_bits(gb, 4);
@@ -242,7 +245,6 @@ static void read_tree(GetBitContext *gb, Tree *tree)
}
if (get_bits1(gb)) {
len = get_bits(gb, 3);
- memset(tmp1, 0, sizeof(tmp1));
for (i = 0; i <= len; i++) {
tree->syms[i] = get_bits(gb, 4);
tmp1[tree->syms[i]] = 1;
@@ -1159,7 +1161,7 @@ static int bink_decode_plane(BinkContext *c, GetBitContext *gb, int plane_idx,
return 0;
}
-static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *pkt)
+static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *pkt)
{
BinkContext * const c = avctx->priv_data;
GetBitContext gb;
@@ -1170,7 +1172,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
if(c->pic.data[0])
avctx->release_buffer(avctx, &c->pic);
- if(avctx->get_buffer(avctx, &c->pic) < 0){
+ if(ff_get_buffer(avctx, &c->pic) < 0){
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return -1;
}
@@ -1206,7 +1208,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
}
emms_c();
- *data_size = sizeof(AVFrame);
+ *got_frame = 1;
*(AVFrame*)data = c->pic;
if (c->version > 'b')
@@ -1295,10 +1297,10 @@ static av_cold int decode_init(AVCodecContext *avctx)
return 1;
}
- avctx->pix_fmt = c->has_alpha ? PIX_FMT_YUVA420P : PIX_FMT_YUV420P;
+ avctx->pix_fmt = c->has_alpha ? AV_PIX_FMT_YUVA420P : AV_PIX_FMT_YUV420P;
avctx->idct_algo = FF_IDCT_BINK;
- dsputil_init(&c->dsp, avctx);
+ ff_dsputil_init(&c->dsp, avctx);
ff_binkdsp_init(&c->bdsp);
init_bundles(c);
@@ -1329,10 +1331,11 @@ static av_cold int decode_end(AVCodecContext *avctx)
AVCodec ff_bink_decoder = {
.name = "binkvideo",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_BINKVIDEO,
+ .id = AV_CODEC_ID_BINKVIDEO,
.priv_data_size = sizeof(BinkContext),
.init = decode_init,
.close = decode_end,
.decode = decode_frame,
- .long_name = NULL_IF_CONFIG_SMALL("Bink video"),
+ .long_name = NULL_IF_CONFIG_SMALL("Bink video"),
+ .capabilities = CODEC_CAP_DR1,
};
diff --git a/gst-libs/ext/libav/libavcodec/binkaudio.c b/gst-libs/ext/libav/libavcodec/binkaudio.c
index d73ffcd..0e5d981 100644
--- a/gst-libs/ext/libav/libavcodec/binkaudio.c
+++ b/gst-libs/ext/libav/libavcodec/binkaudio.c
@@ -28,6 +28,7 @@
* http://wiki.multimedia.cx/index.php?title=Bink_Audio
*/
+#include "libavutil/channel_layout.h"
#include "avcodec.h"
#define BITSTREAM_READER_LE
#include "get_bits.h"
@@ -35,6 +36,7 @@
#include "dct.h"
#include "rdft.h"
#include "fmtconvert.h"
+#include "internal.h"
#include "libavutil/intfloat.h"
extern const uint16_t ff_wma_critical_freqs[25];
@@ -47,8 +49,6 @@ static float quant_table[96];
typedef struct {
AVFrame frame;
GetBitContext gb;
- DSPContext dsp;
- FmtConvertContext fmt_conv;
int version_b; ///< Bink version 'b'
int first;
int channels;
@@ -59,10 +59,7 @@ typedef struct {
unsigned int *bands;
float root;
DECLARE_ALIGNED(32, FFTSample, coeffs)[BINK_BLOCK_MAX_SIZE];
- DECLARE_ALIGNED(16, int16_t, previous)[BINK_BLOCK_MAX_SIZE / 16]; ///< coeffs from previous audio block
- DECLARE_ALIGNED(16, int16_t, current)[BINK_BLOCK_MAX_SIZE / 16];
- float *coeffs_ptr[MAX_CHANNELS]; ///< pointers to the coeffs arrays for float_to_int16_interleave
- float *prev_ptr[MAX_CHANNELS]; ///< pointers to the overlap points in the coeffs array
+ float previous[MAX_CHANNELS][BINK_BLOCK_MAX_SIZE / 16]; ///< coeffs from previous audio block
uint8_t *packet_buffer;
union {
RDFTContext rdft;
@@ -79,9 +76,6 @@ static av_cold int decode_init(AVCodecContext *avctx)
int i;
int frame_len_bits;
- dsputil_init(&s->dsp, avctx);
- ff_fmt_convert_init(&s->fmt_conv, avctx);
-
/* determine frame length */
if (avctx->sample_rate < 22050) {
frame_len_bits = 9;
@@ -95,24 +89,31 @@ static av_cold int decode_init(AVCodecContext *avctx)
av_log(avctx, AV_LOG_ERROR, "too many channels: %d\n", avctx->channels);
return -1;
}
+ avctx->channel_layout = avctx->channels == 1 ? AV_CH_LAYOUT_MONO :
+ AV_CH_LAYOUT_STEREO;
s->version_b = avctx->extradata && avctx->extradata[3] == 'b';
- if (avctx->codec->id == CODEC_ID_BINKAUDIO_RDFT) {
+ if (avctx->codec->id == AV_CODEC_ID_BINKAUDIO_RDFT) {
// audio is already interleaved for the RDFT format variant
+ avctx->sample_fmt = AV_SAMPLE_FMT_FLT;
sample_rate *= avctx->channels;
s->channels = 1;
if (!s->version_b)
frame_len_bits += av_log2(avctx->channels);
} else {
s->channels = avctx->channels;
+ avctx->sample_fmt = AV_SAMPLE_FMT_FLTP;
}
s->frame_len = 1 << frame_len_bits;
s->overlap_len = s->frame_len / 16;
s->block_size = (s->frame_len - s->overlap_len) * s->channels;
sample_rate_half = (sample_rate + 1) / 2;
- s->root = 2.0 / sqrt(s->frame_len);
+ if (avctx->codec->id == AV_CODEC_ID_BINKAUDIO_RDFT)
+ s->root = 2.0 / (sqrt(s->frame_len) * 32768.0);
+ else
+ s->root = s->frame_len / (sqrt(s->frame_len) * 32768.0);
for (i = 0; i < 96; i++) {
/* constant is result of 0.066399999/log10(M_E) */
quant_table[i] = expf(i * 0.15289164787221953823f) * s->root;
@@ -134,14 +135,8 @@ static av_cold int decode_init(AVCodecContext *avctx)
s->bands[s->num_bands] = s->frame_len;
s->first = 1;
- avctx->sample_fmt = AV_SAMPLE_FMT_S16;
-
- for (i = 0; i < s->channels; i++) {
- s->coeffs_ptr[i] = s->coeffs + i * s->frame_len;
- s->prev_ptr[i] = s->coeffs_ptr[i] + s->frame_len - s->overlap_len;
- }
- if (CONFIG_BINKAUDIO_RDFT_DECODER && avctx->codec->id == CODEC_ID_BINKAUDIO_RDFT)
+ if (CONFIG_BINKAUDIO_RDFT_DECODER && avctx->codec->id == AV_CODEC_ID_BINKAUDIO_RDFT)
ff_rdft_init(&s->trans.rdft, frame_len_bits, DFT_C2R);
else if (CONFIG_BINKAUDIO_DCT_DECODER)
ff_dct_init(&s->trans.dct, frame_len_bits, DCT_III);
@@ -167,18 +162,12 @@ static const uint8_t rle_length_tab[16] = {
2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 14, 15, 16, 32, 64
};
-#define GET_BITS_SAFE(out, nbits) do { \
- if (get_bits_left(gb) < nbits) \
- return AVERROR_INVALIDDATA; \
- out = get_bits(gb, nbits); \
-} while (0)
-
/**
* Decode Bink Audio block
* @param[out] out Output buffer (must contain s->block_size elements)
* @return 0 on success, negative error code on failure
*/
-static int decode_block(BinkAudioContext *s, int16_t *out, int use_dct)
+static int decode_block(BinkAudioContext *s, float **out, int use_dct)
{
int ch, i, j, k;
float q, quant[25];
@@ -189,7 +178,8 @@ static int decode_block(BinkAudioContext *s, int16_t *out, int use_dct)
skip_bits(gb, 2);
for (ch = 0; ch < s->channels; ch++) {
- FFTSample *coeffs = s->coeffs_ptr[ch];
+ FFTSample *coeffs = out[ch];
+
if (s->version_b) {
if (get_bits_left(gb) < 64)
return AVERROR_INVALIDDATA;
@@ -218,10 +208,9 @@ static int decode_block(BinkAudioContext *s, int16_t *out, int use_dct)
if (s->version_b) {
j = i + 16;
} else {
- int v;
- GET_BITS_SAFE(v, 1);
+ int v = get_bits1(gb);
if (v) {
- GET_BITS_SAFE(v, 4);
+ v = get_bits(gb, 4);
j = i + rle_length_tab[v] * 8;
} else {
j = i + 8;
@@ -230,7 +219,7 @@ static int decode_block(BinkAudioContext *s, int16_t *out, int use_dct)
j = FFMIN(j, s->frame_len);
- GET_BITS_SAFE(width, 4);
+ width = get_bits(gb, 4);
if (width == 0) {
memset(coeffs + i, 0, (j - i) * sizeof(*coeffs));
i = j;
@@ -240,10 +229,10 @@ static int decode_block(BinkAudioContext *s, int16_t *out, int use_dct)
while (i < j) {
if (s->bands[k] == i)
q = quant[k++];
- GET_BITS_SAFE(coeff, width);
+ coeff = get_bits(gb, width);
if (coeff) {
int v;
- GET_BITS_SAFE(v, 1);
+ v = get_bits1(gb);
if (v)
coeffs[i] = -q * coeff;
else
@@ -259,30 +248,24 @@ static int decode_block(BinkAudioContext *s, int16_t *out, int use_dct)
if (CONFIG_BINKAUDIO_DCT_DECODER && use_dct) {
coeffs[0] /= 0.5;
s->trans.dct.dct_calc(&s->trans.dct, coeffs);
- s->dsp.vector_fmul_scalar(coeffs, coeffs, s->frame_len / 2, s->frame_len);
}
else if (CONFIG_BINKAUDIO_RDFT_DECODER)
s->trans.rdft.rdft_calc(&s->trans.rdft, coeffs);
}
- s->fmt_conv.float_to_int16_interleave(s->current,
- (const float **)s->prev_ptr,
- s->overlap_len, s->channels);
- s->fmt_conv.float_to_int16_interleave(out, (const float **)s->coeffs_ptr,
- s->frame_len - s->overlap_len,
- s->channels);
-
- if (!s->first) {
+ for (ch = 0; ch < s->channels; ch++) {
+ int j;
int count = s->overlap_len * s->channels;
- int shift = av_log2(count);
- for (i = 0; i < count; i++) {
- out[i] = (s->previous[i] * (count - i) + out[i] * i) >> shift;
+ if (!s->first) {
+ j = ch;
+ for (i = 0; i < s->overlap_len; i++, j += s->channels)
+ out[ch][i] = (s->previous[ch][i] * (count - j) +
+ out[ch][i] * j) / count;
}
+ memcpy(s->previous[ch], &out[ch][s->frame_len - s->overlap_len],
+ s->overlap_len * sizeof(*s->previous[ch]));
}
- memcpy(s->previous, s->current,
- s->overlap_len * s->channels * sizeof(*s->previous));
-
s->first = 0;
return 0;
@@ -293,7 +276,7 @@ static av_cold int decode_end(AVCodecContext *avctx)
BinkAudioContext * s = avctx->priv_data;
av_freep(&s->bands);
av_freep(&s->packet_buffer);
- if (CONFIG_BINKAUDIO_RDFT_DECODER && avctx->codec->id == CODEC_ID_BINKAUDIO_RDFT)
+ if (CONFIG_BINKAUDIO_RDFT_DECODER && avctx->codec->id == AV_CODEC_ID_BINKAUDIO_RDFT)
ff_rdft_end(&s->trans.rdft);
else if (CONFIG_BINKAUDIO_DCT_DECODER)
ff_dct_end(&s->trans.dct);
@@ -311,7 +294,6 @@ static int decode_frame(AVCodecContext *avctx, void *data,
int *got_frame_ptr, AVPacket *avpkt)
{
BinkAudioContext *s = avctx->priv_data;
- int16_t *samples;
GetBitContext *gb = &s->gb;
int ret, consumed = 0;
@@ -339,19 +321,20 @@ static int decode_frame(AVCodecContext *avctx, void *data,
}
/* get output buffer */
- s->frame.nb_samples = s->block_size / avctx->channels;
- if ((ret = avctx->get_buffer(avctx, &s->frame)) < 0) {
+ s->frame.nb_samples = s->frame_len;
+ if ((ret = ff_get_buffer(avctx, &s->frame)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return ret;
}
- samples = (int16_t *)s->frame.data[0];
- if (decode_block(s, samples, avctx->codec->id == CODEC_ID_BINKAUDIO_DCT)) {
+ if (decode_block(s, (float **)s->frame.extended_data,
+ avctx->codec->id == AV_CODEC_ID_BINKAUDIO_DCT)) {
av_log(avctx, AV_LOG_ERROR, "Incomplete packet\n");
return AVERROR_INVALIDDATA;
}
get_bits_align32(gb);
+ s->frame.nb_samples = s->block_size / avctx->channels;
*got_frame_ptr = 1;
*(AVFrame *)data = s->frame;
@@ -361,23 +344,23 @@ static int decode_frame(AVCodecContext *avctx, void *data,
AVCodec ff_binkaudio_rdft_decoder = {
.name = "binkaudio_rdft",
.type = AVMEDIA_TYPE_AUDIO,
- .id = CODEC_ID_BINKAUDIO_RDFT,
+ .id = AV_CODEC_ID_BINKAUDIO_RDFT,
.priv_data_size = sizeof(BinkAudioContext),
.init = decode_init,
.close = decode_end,
.decode = decode_frame,
.capabilities = CODEC_CAP_DELAY | CODEC_CAP_DR1,
- .long_name = NULL_IF_CONFIG_SMALL("Bink Audio (RDFT)")
+ .long_name = NULL_IF_CONFIG_SMALL("Bink Audio (RDFT)")
};
AVCodec ff_binkaudio_dct_decoder = {
.name = "binkaudio_dct",
.type = AVMEDIA_TYPE_AUDIO,
- .id = CODEC_ID_BINKAUDIO_DCT,
+ .id = AV_CODEC_ID_BINKAUDIO_DCT,
.priv_data_size = sizeof(BinkAudioContext),
.init = decode_init,
.close = decode_end,
.decode = decode_frame,
.capabilities = CODEC_CAP_DELAY | CODEC_CAP_DR1,
- .long_name = NULL_IF_CONFIG_SMALL("Bink Audio (DCT)")
+ .long_name = NULL_IF_CONFIG_SMALL("Bink Audio (DCT)")
};
diff --git a/gst-libs/ext/libav/libavcodec/bitstream.c b/gst-libs/ext/libav/libavcodec/bitstream.c
index 7fe38be..2c8692a 100644
--- a/gst-libs/ext/libav/libavcodec/bitstream.c
+++ b/gst-libs/ext/libav/libavcodec/bitstream.c
@@ -29,6 +29,7 @@
*/
#include "avcodec.h"
+#include "mathops.h"
#include "get_bits.h"
#include "put_bits.h"
@@ -46,7 +47,7 @@ void avpriv_align_put_bits(PutBitContext *s)
put_bits(s,s->bit_left & 7,0);
}
-void ff_put_string(PutBitContext *pb, const char *string, int terminate_string)
+void avpriv_put_string(PutBitContext *pb, const char *string, int terminate_string)
{
while(*string){
put_bits(pb, 8, *string);
@@ -114,10 +115,10 @@ static int alloc_table(VLC *vlc, int size, int use_static)
}
static av_always_inline uint32_t bitswap_32(uint32_t x) {
- return (uint32_t)av_reverse[x&0xFF]<<24
- | (uint32_t)av_reverse[(x>>8)&0xFF]<<16
- | (uint32_t)av_reverse[(x>>16)&0xFF]<<8
- | (uint32_t)av_reverse[x>>24];
+ return (uint32_t)ff_reverse[x&0xFF]<<24
+ | (uint32_t)ff_reverse[(x>>8)&0xFF]<<16
+ | (uint32_t)ff_reverse[(x>>16)&0xFF]<<8
+ | (uint32_t)ff_reverse[x>>24];
}
typedef struct {
@@ -168,7 +169,7 @@ static int build_table(VLC *vlc, int table_nb_bits, int nb_codes,
table[i][0] = -1; //codes
}
- /* first pass: map codes and compute auxillary table sizes */
+ /* first pass: map codes and compute auxiliary table sizes */
for (i = 0; i < nb_codes; i++) {
n = codes[i].bits;
code = codes[i].code;
@@ -322,4 +323,3 @@ void ff_free_vlc(VLC *vlc)
{
av_freep(&vlc->table);
}
-
diff --git a/gst-libs/ext/libav/libavcodec/bitstream_filter.c b/gst-libs/ext/libav/libavcodec/bitstream_filter.c
index b803ca4..b2d61da 100644
--- a/gst-libs/ext/libav/libavcodec/bitstream_filter.c
+++ b/gst-libs/ext/libav/libavcodec/bitstream_filter.c
@@ -18,7 +18,10 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <string.h>
+
#include "avcodec.h"
+#include "libavutil/mem.h"
static AVBitStreamFilter *first_bitstream_filter= NULL;
@@ -39,7 +42,7 @@ AVBitStreamFilterContext *av_bitstream_filter_init(const char *name){
if(!strcmp(name, bsf->name)){
AVBitStreamFilterContext *bsfc= av_mallocz(sizeof(AVBitStreamFilterContext));
bsfc->filter= bsf;
- bsfc->priv_data= av_mallocz(bsf->priv_data_size);
+ bsfc->priv_data = bsf->priv_data_size ? av_mallocz(bsf->priv_data_size) : NULL;
return bsfc;
}
bsf= bsf->next;
diff --git a/gst-libs/ext/libav/libavcodec/bmp.c b/gst-libs/ext/libav/libavcodec/bmp.c
index 01c6fb0..9c8988c 100644
--- a/gst-libs/ext/libav/libavcodec/bmp.c
+++ b/gst-libs/ext/libav/libavcodec/bmp.c
@@ -22,26 +22,28 @@
#include "avcodec.h"
#include "bytestream.h"
#include "bmp.h"
+#include "internal.h"
#include "msrledec.h"
-static av_cold int bmp_decode_init(AVCodecContext *avctx){
+static av_cold int bmp_decode_init(AVCodecContext *avctx)
+{
BMPContext *s = avctx->priv_data;
- avcodec_get_frame_defaults((AVFrame*)&s->picture);
- avctx->coded_frame = (AVFrame*)&s->picture;
+ avcodec_get_frame_defaults(&s->picture);
+ avctx->coded_frame = &s->picture;
return 0;
}
static int bmp_decode_frame(AVCodecContext *avctx,
- void *data, int *data_size,
+ void *data, int *got_frame,
AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
- int buf_size = avpkt->size;
- BMPContext *s = avctx->priv_data;
- AVFrame *picture = data;
- AVFrame *p = &s->picture;
+ int buf_size = avpkt->size;
+ BMPContext *s = avctx->priv_data;
+ AVFrame *picture = data;
+ AVFrame *p = &s->picture;
unsigned int fsize, hsize;
int width, height;
unsigned int depth;
@@ -54,19 +56,19 @@ static int bmp_decode_frame(AVCodecContext *avctx,
const uint8_t *buf0 = buf;
GetByteContext gb;
- if(buf_size < 14){
+ if (buf_size < 14) {
av_log(avctx, AV_LOG_ERROR, "buf size too small (%d)\n", buf_size);
return -1;
}
- if(bytestream_get_byte(&buf) != 'B' ||
- bytestream_get_byte(&buf) != 'M') {
+ if (bytestream_get_byte(&buf) != 'B' ||
+ bytestream_get_byte(&buf) != 'M') {
av_log(avctx, AV_LOG_ERROR, "bad magic number\n");
return -1;
}
fsize = bytestream_get_le32(&buf);
- if(buf_size < fsize){
+ if (buf_size < fsize) {
av_log(avctx, AV_LOG_ERROR, "not enough data (%d < %d), trying to decode anyway\n",
buf_size, fsize);
fsize = buf_size;
@@ -75,29 +77,29 @@ static int bmp_decode_frame(AVCodecContext *avctx,
buf += 2; /* reserved1 */
buf += 2; /* reserved2 */
- hsize = bytestream_get_le32(&buf); /* header size */
- ihsize = bytestream_get_le32(&buf); /* more header size */
- if(ihsize + 14 > hsize){
+ hsize = bytestream_get_le32(&buf); /* header size */
+ ihsize = bytestream_get_le32(&buf); /* more header size */
+ if (ihsize + 14 > hsize) {
av_log(avctx, AV_LOG_ERROR, "invalid header size %d\n", hsize);
return -1;
}
/* sometimes file size is set to some headers size, set a real size in that case */
- if(fsize == 14 || fsize == ihsize + 14)
+ if (fsize == 14 || fsize == ihsize + 14)
fsize = buf_size - 2;
- if(fsize <= hsize){
+ if (fsize <= hsize) {
av_log(avctx, AV_LOG_ERROR, "declared file size is less than header size (%d < %d)\n",
fsize, hsize);
return -1;
}
- switch(ihsize){
+ switch (ihsize) {
case 40: // windib v3
case 64: // OS/2 v2
case 108: // windib v4
case 124: // windib v5
- width = bytestream_get_le32(&buf);
+ width = bytestream_get_le32(&buf);
height = bytestream_get_le32(&buf);
break;
case 12: // OS/2 v1
@@ -109,44 +111,46 @@ static int bmp_decode_frame(AVCodecContext *avctx,
return -1;
}
- if(bytestream_get_le16(&buf) != 1){ /* planes */
+ /* planes */
+ if (bytestream_get_le16(&buf) != 1) {
av_log(avctx, AV_LOG_ERROR, "invalid BMP header\n");
return -1;
}
depth = bytestream_get_le16(&buf);
- if(ihsize == 40)
+ if (ihsize == 40)
comp = bytestream_get_le32(&buf);
else
comp = BMP_RGB;
- if(comp != BMP_RGB && comp != BMP_BITFIELDS && comp != BMP_RLE4 && comp != BMP_RLE8){
+ if (comp != BMP_RGB && comp != BMP_BITFIELDS && comp != BMP_RLE4 &&
+ comp != BMP_RLE8) {
av_log(avctx, AV_LOG_ERROR, "BMP coding %d not supported\n", comp);
return -1;
}
- if(comp == BMP_BITFIELDS){
+ if (comp == BMP_BITFIELDS) {
buf += 20;
rgb[0] = bytestream_get_le32(&buf);
rgb[1] = bytestream_get_le32(&buf);
rgb[2] = bytestream_get_le32(&buf);
}
- avctx->width = width;
- avctx->height = height > 0? height: -height;
+ avctx->width = width;
+ avctx->height = height > 0 ? height : -height;
- avctx->pix_fmt = PIX_FMT_NONE;
+ avctx->pix_fmt = AV_PIX_FMT_NONE;
- switch(depth){
+ switch (depth) {
case 32:
- if(comp == BMP_BITFIELDS){
+ if (comp == BMP_BITFIELDS) {
rgb[0] = (rgb[0] >> 15) & 3;
rgb[1] = (rgb[1] >> 15) & 3;
rgb[2] = (rgb[2] >> 15) & 3;
- if(rgb[0] + rgb[1] + rgb[2] != 3 ||
- rgb[0] == rgb[1] || rgb[0] == rgb[2] || rgb[1] == rgb[2]){
+ if (rgb[0] + rgb[1] + rgb[2] != 3 ||
+ rgb[0] == rgb[1] || rgb[0] == rgb[2] || rgb[1] == rgb[2]) {
break;
}
} else {
@@ -155,21 +159,21 @@ static int bmp_decode_frame(AVCodecContext *avctx,
rgb[2] = 0;
}
- avctx->pix_fmt = PIX_FMT_BGR24;
+ avctx->pix_fmt = AV_PIX_FMT_BGR24;
break;
case 24:
- avctx->pix_fmt = PIX_FMT_BGR24;
+ avctx->pix_fmt = AV_PIX_FMT_BGR24;
break;
case 16:
- if(comp == BMP_RGB)
- avctx->pix_fmt = PIX_FMT_RGB555;
+ if (comp == BMP_RGB)
+ avctx->pix_fmt = AV_PIX_FMT_RGB555;
else if (comp == BMP_BITFIELDS) {
if (rgb[0] == 0xF800 && rgb[1] == 0x07E0 && rgb[2] == 0x001F)
- avctx->pix_fmt = PIX_FMT_RGB565;
+ avctx->pix_fmt = AV_PIX_FMT_RGB565;
else if (rgb[0] == 0x7C00 && rgb[1] == 0x03E0 && rgb[2] == 0x001F)
- avctx->pix_fmt = PIX_FMT_RGB555;
+ avctx->pix_fmt = AV_PIX_FMT_RGB555;
else if (rgb[0] == 0x0F00 && rgb[1] == 0x00F0 && rgb[2] == 0x000F)
- avctx->pix_fmt = PIX_FMT_RGB444;
+ avctx->pix_fmt = AV_PIX_FMT_RGB444;
else {
av_log(avctx, AV_LOG_ERROR, "Unknown bitfields %0X %0X %0X\n", rgb[0], rgb[1], rgb[2]);
return AVERROR(EINVAL);
@@ -177,16 +181,16 @@ static int bmp_decode_frame(AVCodecContext *avctx,
}
break;
case 8:
- if(hsize - ihsize - 14 > 0)
- avctx->pix_fmt = PIX_FMT_PAL8;
+ if (hsize - ihsize - 14 > 0)
+ avctx->pix_fmt = AV_PIX_FMT_PAL8;
else
- avctx->pix_fmt = PIX_FMT_GRAY8;
+ avctx->pix_fmt = AV_PIX_FMT_GRAY8;
break;
case 1:
case 4:
- if(hsize - ihsize - 14 > 0){
- avctx->pix_fmt = PIX_FMT_PAL8;
- }else{
+ if (hsize - ihsize - 14 > 0) {
+ avctx->pix_fmt = AV_PIX_FMT_PAL8;
+ } else {
av_log(avctx, AV_LOG_ERROR, "Unknown palette for %d-colour BMP\n", 1<<depth);
return -1;
}
@@ -196,84 +200,85 @@ static int bmp_decode_frame(AVCodecContext *avctx,
return -1;
}
- if(avctx->pix_fmt == PIX_FMT_NONE){
+ if (avctx->pix_fmt == AV_PIX_FMT_NONE) {
av_log(avctx, AV_LOG_ERROR, "unsupported pixel format\n");
return -1;
}
- if(p->data[0])
+ if (p->data[0])
avctx->release_buffer(avctx, p);
p->reference = 0;
- if(avctx->get_buffer(avctx, p) < 0){
+ if (ff_get_buffer(avctx, p) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return -1;
}
p->pict_type = AV_PICTURE_TYPE_I;
p->key_frame = 1;
- buf = buf0 + hsize;
+ buf = buf0 + hsize;
dsize = buf_size - hsize;
/* Line size in file multiple of 4 */
n = ((avctx->width * depth) / 8 + 3) & ~3;
- if(n * avctx->height > dsize && comp != BMP_RLE4 && comp != BMP_RLE8){
+ if (n * avctx->height > dsize && comp != BMP_RLE4 && comp != BMP_RLE8) {
av_log(avctx, AV_LOG_ERROR, "not enough data (%d < %d)\n",
dsize, n * avctx->height);
return -1;
}
// RLE may skip decoding some picture areas, so blank picture before decoding
- if(comp == BMP_RLE4 || comp == BMP_RLE8)
+ if (comp == BMP_RLE4 || comp == BMP_RLE8)
memset(p->data[0], 0, avctx->height * p->linesize[0]);
- if(height > 0){
- ptr = p->data[0] + (avctx->height - 1) * p->linesize[0];
+ if (height > 0) {
+ ptr = p->data[0] + (avctx->height - 1) * p->linesize[0];
linesize = -p->linesize[0];
} else {
- ptr = p->data[0];
+ ptr = p->data[0];
linesize = p->linesize[0];
}
- if(avctx->pix_fmt == PIX_FMT_PAL8){
+ if (avctx->pix_fmt == AV_PIX_FMT_PAL8) {
int colors = 1 << depth;
memset(p->data[1], 0, 1024);
- if(ihsize >= 36){
+ if (ihsize >= 36) {
int t;
buf = buf0 + 46;
- t = bytestream_get_le32(&buf);
- if(t < 0 || t > (1 << depth)){
+ t = bytestream_get_le32(&buf);
+ if (t < 0 || t > (1 << depth)) {
av_log(avctx, AV_LOG_ERROR, "Incorrect number of colors - %X for bitdepth %d\n", t, depth);
- }else if(t){
+ } else if (t) {
colors = t;
}
}
buf = buf0 + 14 + ihsize; //palette location
- if((hsize-ihsize-14) < (colors << 2)){ // OS/2 bitmap, 3 bytes per palette entry
- for(i = 0; i < colors; i++)
+ // OS/2 bitmap, 3 bytes per palette entry
+ if ((hsize-ihsize-14) < (colors << 2)) {
+ for (i = 0; i < colors; i++)
((uint32_t*)p->data[1])[i] = bytestream_get_le24(&buf);
- }else{
- for(i = 0; i < colors; i++)
+ } else {
+ for (i = 0; i < colors; i++)
((uint32_t*)p->data[1])[i] = bytestream_get_le32(&buf);
}
buf = buf0 + hsize;
}
- if(comp == BMP_RLE4 || comp == BMP_RLE8){
- if(height < 0){
- p->data[0] += p->linesize[0] * (avctx->height - 1);
+ if (comp == BMP_RLE4 || comp == BMP_RLE8) {
+ if (height < 0) {
+ p->data[0] += p->linesize[0] * (avctx->height - 1);
p->linesize[0] = -p->linesize[0];
}
bytestream2_init(&gb, buf, dsize);
ff_msrle_decode(avctx, (AVPicture*)p, depth, &gb);
- if(height < 0){
- p->data[0] += p->linesize[0] * (avctx->height - 1);
+ if (height < 0) {
+ p->data[0] += p->linesize[0] * (avctx->height - 1);
p->linesize[0] = -p->linesize[0];
}
- }else{
- switch(depth){
+ } else {
+ switch (depth) {
case 1:
for (i = 0; i < avctx->height; i++) {
int j;
@@ -293,16 +298,16 @@ static int bmp_decode_frame(AVCodecContext *avctx,
break;
case 8:
case 24:
- for(i = 0; i < avctx->height; i++){
+ for (i = 0; i < avctx->height; i++) {
memcpy(ptr, buf, n);
buf += n;
ptr += linesize;
}
break;
case 4:
- for(i = 0; i < avctx->height; i++){
+ for (i = 0; i < avctx->height; i++) {
int j;
- for(j = 0; j < n; j++){
+ for (j = 0; j < n; j++) {
ptr[j*2+0] = (buf[j] >> 4) & 0xF;
ptr[j*2+1] = buf[j] & 0xF;
}
@@ -311,11 +316,11 @@ static int bmp_decode_frame(AVCodecContext *avctx,
}
break;
case 16:
- for(i = 0; i < avctx->height; i++){
+ for (i = 0; i < avctx->height; i++) {
const uint16_t *src = (const uint16_t *) buf;
- uint16_t *dst = (uint16_t *) ptr;
+ uint16_t *dst = (uint16_t *) ptr;
- for(j = 0; j < avctx->width; j++)
+ for (j = 0; j < avctx->width; j++)
*dst++ = av_le2ne16(*src++);
buf += n;
@@ -323,11 +328,11 @@ static int bmp_decode_frame(AVCodecContext *avctx,
}
break;
case 32:
- for(i = 0; i < avctx->height; i++){
+ for (i = 0; i < avctx->height; i++) {
const uint8_t *src = buf;
- uint8_t *dst = ptr;
+ uint8_t *dst = ptr;
- for(j = 0; j < avctx->width; j++){
+ for (j = 0; j < avctx->width; j++) {
dst[0] = src[rgb[2]];
dst[1] = src[rgb[1]];
dst[2] = src[rgb[0]];
@@ -346,7 +351,7 @@ static int bmp_decode_frame(AVCodecContext *avctx,
}
*picture = s->picture;
- *data_size = sizeof(AVPicture);
+ *got_frame = 1;
return buf_size;
}
@@ -364,11 +369,11 @@ static av_cold int bmp_decode_end(AVCodecContext *avctx)
AVCodec ff_bmp_decoder = {
.name = "bmp",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_BMP,
+ .id = AV_CODEC_ID_BMP,
.priv_data_size = sizeof(BMPContext),
.init = bmp_decode_init,
.close = bmp_decode_end,
.decode = bmp_decode_frame,
.capabilities = CODEC_CAP_DR1,
- .long_name = NULL_IF_CONFIG_SMALL("BMP image"),
+ .long_name = NULL_IF_CONFIG_SMALL("BMP (Windows and OS/2 bitmap)"),
};
diff --git a/gst-libs/ext/libav/libavcodec/bmpenc.c b/gst-libs/ext/libav/libavcodec/bmpenc.c
index ca2951a..d27282d 100644
--- a/gst-libs/ext/libav/libavcodec/bmpenc.c
+++ b/gst-libs/ext/libav/libavcodec/bmpenc.c
@@ -24,6 +24,7 @@
#include "avcodec.h"
#include "bytestream.h"
#include "bmp.h"
+#include "internal.h"
static const uint32_t monoblack_pal[] = { 0x000000, 0xFFFFFF };
static const uint32_t rgb565_masks[] = { 0xF800, 0x07E0, 0x001F };
@@ -32,27 +33,27 @@ static const uint32_t rgb444_masks[] = { 0x0F00, 0x00F0, 0x000F };
static av_cold int bmp_encode_init(AVCodecContext *avctx){
BMPContext *s = avctx->priv_data;
- avcodec_get_frame_defaults((AVFrame*)&s->picture);
- avctx->coded_frame = (AVFrame*)&s->picture;
+ avcodec_get_frame_defaults(&s->picture);
+ avctx->coded_frame = &s->picture;
switch (avctx->pix_fmt) {
- case PIX_FMT_BGR24:
+ case AV_PIX_FMT_BGR24:
avctx->bits_per_coded_sample = 24;
break;
- case PIX_FMT_RGB555:
- case PIX_FMT_RGB565:
- case PIX_FMT_RGB444:
+ case AV_PIX_FMT_RGB555:
+ case AV_PIX_FMT_RGB565:
+ case AV_PIX_FMT_RGB444:
avctx->bits_per_coded_sample = 16;
break;
- case PIX_FMT_RGB8:
- case PIX_FMT_BGR8:
- case PIX_FMT_RGB4_BYTE:
- case PIX_FMT_BGR4_BYTE:
- case PIX_FMT_GRAY8:
- case PIX_FMT_PAL8:
+ case AV_PIX_FMT_RGB8:
+ case AV_PIX_FMT_BGR8:
+ case AV_PIX_FMT_RGB4_BYTE:
+ case AV_PIX_FMT_BGR4_BYTE:
+ case AV_PIX_FMT_GRAY8:
+ case AV_PIX_FMT_PAL8:
avctx->bits_per_coded_sample = 8;
break;
- case PIX_FMT_MONOBLACK:
+ case AV_PIX_FMT_MONOBLACK:
avctx->bits_per_coded_sample = 1;
break;
default:
@@ -63,40 +64,40 @@ static av_cold int bmp_encode_init(AVCodecContext *avctx){
return 0;
}
-static int bmp_encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size, void *data){
+static int bmp_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
+ const AVFrame *pict, int *got_packet)
+{
BMPContext *s = avctx->priv_data;
- AVFrame *pict = data;
- AVFrame * const p= (AVFrame*)&s->picture;
- int n_bytes_image, n_bytes_per_row, n_bytes, i, n, hsize;
+ AVFrame * const p = &s->picture;
+ int n_bytes_image, n_bytes_per_row, n_bytes, i, n, hsize, ret;
const uint32_t *pal = NULL;
int pad_bytes_per_row, pal_entries = 0, compression = BMP_RGB;
int bit_count = avctx->bits_per_coded_sample;
- uint8_t *ptr;
- unsigned char* buf0 = buf;
+ uint8_t *ptr, *buf;
*p = *pict;
p->pict_type= AV_PICTURE_TYPE_I;
p->key_frame= 1;
switch (avctx->pix_fmt) {
- case PIX_FMT_RGB444:
+ case AV_PIX_FMT_RGB444:
compression = BMP_BITFIELDS;
pal = rgb444_masks; // abuse pal to hold color masks
pal_entries = 3;
break;
- case PIX_FMT_RGB565:
+ case AV_PIX_FMT_RGB565:
compression = BMP_BITFIELDS;
pal = rgb565_masks; // abuse pal to hold color masks
pal_entries = 3;
break;
- case PIX_FMT_RGB8:
- case PIX_FMT_BGR8:
- case PIX_FMT_RGB4_BYTE:
- case PIX_FMT_BGR4_BYTE:
- case PIX_FMT_GRAY8:
- ff_set_systematic_pal2((uint32_t*)p->data[1], avctx->pix_fmt);
- case PIX_FMT_PAL8:
+ case AV_PIX_FMT_RGB8:
+ case AV_PIX_FMT_BGR8:
+ case AV_PIX_FMT_RGB4_BYTE:
+ case AV_PIX_FMT_BGR4_BYTE:
+ case AV_PIX_FMT_GRAY8:
+ avpriv_set_systematic_pal2((uint32_t*)p->data[1], avctx->pix_fmt);
+ case AV_PIX_FMT_PAL8:
pal = (uint32_t *)p->data[1];
break;
- case PIX_FMT_MONOBLACK:
+ case AV_PIX_FMT_MONOBLACK:
pal = monoblack_pal;
break;
}
@@ -111,10 +112,11 @@ static int bmp_encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_s
#define SIZE_BITMAPINFOHEADER 40
hsize = SIZE_BITMAPFILEHEADER + SIZE_BITMAPINFOHEADER + (pal_entries << 2);
n_bytes = n_bytes_image + hsize;
- if(n_bytes>buf_size) {
- av_log(avctx, AV_LOG_ERROR, "buf size too small (need %d, got %d)\n", n_bytes, buf_size);
- return -1;
+ if ((ret = ff_alloc_packet(pkt, n_bytes)) < 0) {
+ av_log(avctx, AV_LOG_ERROR, "Error getting output packet.\n");
+ return ret;
}
+ buf = pkt->data;
bytestream_put_byte(&buf, 'B'); // BITMAPFILEHEADER.bfType
bytestream_put_byte(&buf, 'M'); // do.
bytestream_put_le32(&buf, n_bytes); // BITMAPFILEHEADER.bfSize
@@ -136,7 +138,7 @@ static int bmp_encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_s
bytestream_put_le32(&buf, pal[i] & 0xFFFFFF);
// BMP files are bottom-to-top so we start from the end...
ptr = p->data[0] + (avctx->height - 1) * p->linesize[0];
- buf = buf0 + hsize;
+ buf = pkt->data + hsize;
for(i = 0; i < avctx->height; i++) {
if (bit_count == 16) {
const uint16_t *src = (const uint16_t *) ptr;
@@ -151,21 +153,25 @@ static int bmp_encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_s
buf += pad_bytes_per_row;
ptr -= p->linesize[0]; // ... and go back
}
- return n_bytes;
+
+ pkt->flags |= AV_PKT_FLAG_KEY;
+ *got_packet = 1;
+ return 0;
}
AVCodec ff_bmp_encoder = {
.name = "bmp",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_BMP,
+ .id = AV_CODEC_ID_BMP,
.priv_data_size = sizeof(BMPContext),
.init = bmp_encode_init,
- .encode = bmp_encode_frame,
- .pix_fmts = (const enum PixelFormat[]){
- PIX_FMT_BGR24,
- PIX_FMT_RGB555, PIX_FMT_RGB444, PIX_FMT_RGB565,
- PIX_FMT_RGB8, PIX_FMT_BGR8, PIX_FMT_RGB4_BYTE, PIX_FMT_BGR4_BYTE, PIX_FMT_GRAY8, PIX_FMT_PAL8,
- PIX_FMT_MONOBLACK,
- PIX_FMT_NONE},
- .long_name = NULL_IF_CONFIG_SMALL("BMP image"),
+ .encode2 = bmp_encode_frame,
+ .pix_fmts = (const enum AVPixelFormat[]){
+ AV_PIX_FMT_BGR24,
+ AV_PIX_FMT_RGB555, AV_PIX_FMT_RGB444, AV_PIX_FMT_RGB565,
+ AV_PIX_FMT_RGB8, AV_PIX_FMT_BGR8, AV_PIX_FMT_RGB4_BYTE, AV_PIX_FMT_BGR4_BYTE, AV_PIX_FMT_GRAY8, AV_PIX_FMT_PAL8,
+ AV_PIX_FMT_MONOBLACK,
+ AV_PIX_FMT_NONE
+ },
+ .long_name = NULL_IF_CONFIG_SMALL("BMP (Windows and OS/2 bitmap)"),
};
diff --git a/gst-libs/ext/libav/libavcodec/bmv.c b/gst-libs/ext/libav/libavcodec/bmv.c
index 920e752..bcb1380 100644
--- a/gst-libs/ext/libav/libavcodec/bmv.c
+++ b/gst-libs/ext/libav/libavcodec/bmv.c
@@ -19,8 +19,10 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "libavutil/channel_layout.h"
#include "avcodec.h"
#include "bytestream.h"
+#include "internal.h"
enum BMVFlags{
BMV_NOP = 0,
@@ -52,7 +54,7 @@ typedef struct BMVDecContext {
static int decode_bmv_frame(const uint8_t *source, int src_len, uint8_t *frame, int frame_off)
{
- int val, saved_val = 0;
+ unsigned val, saved_val = 0;
int tmplen = src_len;
const uint8_t *src, *source_end = source + src_len;
uint8_t *frame_end = frame + SCREEN_WIDE * SCREEN_HIGH;
@@ -140,7 +142,9 @@ static int decode_bmv_frame(const uint8_t *source, int src_len, uint8_t *frame,
case 1:
if (forward) {
if (dst - frame + SCREEN_WIDE < frame_off ||
- frame_end - dst < frame_off + len)
+ dst - frame + SCREEN_WIDE + frame_off < 0 ||
+ frame_end - dst < frame_off + len ||
+ frame_end - dst < len)
return -1;
for (i = 0; i < len; i++)
dst[i] = dst[frame_off + i];
@@ -148,7 +152,9 @@ static int decode_bmv_frame(const uint8_t *source, int src_len, uint8_t *frame,
} else {
dst -= len;
if (dst - frame + SCREEN_WIDE < frame_off ||
- frame_end - dst < frame_off + len)
+ dst - frame + SCREEN_WIDE + frame_off < 0 ||
+ frame_end - dst < frame_off + len ||
+ frame_end - dst < len)
return -1;
for (i = len - 1; i >= 0; i--)
dst[i] = dst[frame_off + i];
@@ -188,11 +194,12 @@ static int decode_bmv_frame(const uint8_t *source, int src_len, uint8_t *frame,
return 0;
}
-static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *pkt)
+static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
+ AVPacket *pkt)
{
BMVDecContext * const c = avctx->priv_data;
int type, scr_off;
- int i;
+ int i, ret;
uint8_t *srcptr, *outptr;
c->stream = pkt->data;
@@ -233,6 +240,15 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
scr_off = 0;
}
+ if (c->pic.data[0])
+ avctx->release_buffer(avctx, &c->pic);
+
+ c->pic.reference = 3;
+ if ((ret = ff_get_buffer(avctx, &c->pic)) < 0) {
+ av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
+ return ret;
+ }
+
if (decode_bmv_frame(c->stream, pkt->size - (c->stream - pkt->data), c->frame, scr_off)) {
av_log(avctx, AV_LOG_ERROR, "Error decoding frame data\n");
return AVERROR_INVALIDDATA;
@@ -250,7 +266,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
outptr += c->pic.linesize[0];
}
- *data_size = sizeof(AVFrame);
+ *got_frame = 1;
*(AVFrame*)data = c->pic;
/* always report that the buffer was completely consumed */
@@ -262,13 +278,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
BMVDecContext * const c = avctx->priv_data;
c->avctx = avctx;
- avctx->pix_fmt = PIX_FMT_PAL8;
-
- c->pic.reference = 1;
- if (avctx->get_buffer(avctx, &c->pic) < 0) {
- av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
- return -1;
- }
+ avctx->pix_fmt = AV_PIX_FMT_PAL8;
c->frame = c->frame_base + 640;
@@ -297,12 +307,9 @@ static av_cold int bmv_aud_decode_init(AVCodecContext *avctx)
{
BMVAudioDecContext *c = avctx->priv_data;
- if (avctx->channels != 2) {
- av_log(avctx, AV_LOG_INFO, "invalid number of channels\n");
- return AVERROR(EINVAL);
- }
-
- avctx->sample_fmt = AV_SAMPLE_FMT_S16;
+ avctx->channels = 2;
+ avctx->channel_layout = AV_CH_LAYOUT_STEREO;
+ avctx->sample_fmt = AV_SAMPLE_FMT_S16;
avcodec_get_frame_defaults(&c->frame);
avctx->coded_frame = &c->frame;
@@ -330,7 +337,7 @@ static int bmv_aud_decode_frame(AVCodecContext *avctx, void *data,
/* get output buffer */
c->frame.nb_samples = total_blocks * 32;
- if ((ret = avctx->get_buffer(avctx, &c->frame)) < 0) {
+ if ((ret = ff_get_buffer(avctx, &c->frame)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return ret;
}
@@ -356,18 +363,19 @@ static int bmv_aud_decode_frame(AVCodecContext *avctx, void *data,
AVCodec ff_bmv_video_decoder = {
.name = "bmv_video",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_BMV_VIDEO,
+ .id = AV_CODEC_ID_BMV_VIDEO,
.priv_data_size = sizeof(BMVDecContext),
.init = decode_init,
.close = decode_end,
.decode = decode_frame,
+ .capabilities = CODEC_CAP_DR1,
.long_name = NULL_IF_CONFIG_SMALL("Discworld II BMV video"),
};
AVCodec ff_bmv_audio_decoder = {
.name = "bmv_audio",
.type = AVMEDIA_TYPE_AUDIO,
- .id = CODEC_ID_BMV_AUDIO,
+ .id = AV_CODEC_ID_BMV_AUDIO,
.priv_data_size = sizeof(BMVAudioDecContext),
.init = bmv_aud_decode_init,
.decode = bmv_aud_decode_frame,
diff --git a/gst-libs/ext/libav/libavcodec/bytestream.h b/gst-libs/ext/libav/libavcodec/bytestream.h
index 6814620..0f89558 100644
--- a/gst-libs/ext/libav/libavcodec/bytestream.h
+++ b/gst-libs/ext/libav/libavcodec/bytestream.h
@@ -23,21 +23,22 @@
#ifndef AVCODEC_BYTESTREAM_H
#define AVCODEC_BYTESTREAM_H
+#include <stdint.h>
#include <string.h>
#include "libavutil/common.h"
#include "libavutil/intreadwrite.h"
-typedef struct {
+typedef struct GetByteContext {
const uint8_t *buffer, *buffer_end, *buffer_start;
} GetByteContext;
-typedef struct {
+typedef struct PutByteContext {
uint8_t *buffer, *buffer_end, *buffer_start;
int eof;
} PutByteContext;
-#define DEF_T(type, name, bytes, read, write) \
+#define DEF(type, name, bytes, read, write) \
static av_always_inline type bytestream_get_ ## name(const uint8_t **b) \
{ \
(*b) += bytes; \
@@ -80,24 +81,15 @@ static av_always_inline type bytestream2_peek_ ## name(GetByteContext *g) \
return read(g->buffer); \
}
-#define DEF(name, bytes, read, write) \
- DEF_T(unsigned int, name, bytes, read, write)
-#define DEF64(name, bytes, read, write) \
- DEF_T(uint64_t, name, bytes, read, write)
-
-DEF64(le64, 8, AV_RL64, AV_WL64)
-DEF (le32, 4, AV_RL32, AV_WL32)
-DEF (le24, 3, AV_RL24, AV_WL24)
-DEF (le16, 2, AV_RL16, AV_WL16)
-DEF64(be64, 8, AV_RB64, AV_WB64)
-DEF (be32, 4, AV_RB32, AV_WB32)
-DEF (be24, 3, AV_RB24, AV_WB24)
-DEF (be16, 2, AV_RB16, AV_WB16)
-DEF (byte, 1, AV_RB8 , AV_WB8 )
-
-#undef DEF
-#undef DEF64
-#undef DEF_T
+DEF(uint64_t, le64, 8, AV_RL64, AV_WL64)
+DEF(unsigned int, le32, 4, AV_RL32, AV_WL32)
+DEF(unsigned int, le24, 3, AV_RL24, AV_WL24)
+DEF(unsigned int, le16, 2, AV_RL16, AV_WL16)
+DEF(uint64_t, be64, 8, AV_RB64, AV_WB64)
+DEF(unsigned int, be32, 4, AV_RB32, AV_WB32)
+DEF(unsigned int, be24, 3, AV_RB24, AV_WB24)
+DEF(unsigned int, be16, 2, AV_RB16, AV_WB16)
+DEF(unsigned int, byte, 1, AV_RB8 , AV_WB8)
#if HAVE_BIGENDIAN
# define bytestream2_get_ne16 bytestream2_get_be16
diff --git a/gst-libs/ext/libav/libavcodec/c93.c b/gst-libs/ext/libav/libavcodec/c93.c
index ecfd035..b820f5a 100644
--- a/gst-libs/ext/libav/libavcodec/c93.c
+++ b/gst-libs/ext/libav/libavcodec/c93.c
@@ -47,7 +47,7 @@ typedef enum {
static av_cold int decode_init(AVCodecContext *avctx)
{
- avctx->pix_fmt = PIX_FMT_PAL8;
+ avctx->pix_fmt = AV_PIX_FMT_PAL8;
return 0;
}
@@ -113,7 +113,7 @@ static inline void draw_n_color(uint8_t *out, int stride, int width,
}
static int decode_frame(AVCodecContext *avctx, void *data,
- int *data_size, AVPacket *avpkt)
+ int *got_frame, AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
@@ -121,8 +121,9 @@ static int decode_frame(AVCodecContext *avctx, void *data,
AVFrame * const newpic = &c93->pictures[c93->currentpic];
AVFrame * const oldpic = &c93->pictures[c93->currentpic^1];
AVFrame *picture = data;
+ GetByteContext gb;
uint8_t *out;
- int stride, i, x, y, bt = 0;
+ int stride, i, x, y, b, bt = 0;
c93->currentpic ^= 1;
@@ -136,7 +137,9 @@ static int decode_frame(AVCodecContext *avctx, void *data,
stride = newpic->linesize[0];
- if (buf[0] & C93_FIRST_FRAME) {
+ bytestream2_init(&gb, buf, buf_size);
+ b = bytestream2_get_byte(&gb);
+ if (b & C93_FIRST_FRAME) {
newpic->pict_type = AV_PICTURE_TYPE_I;
newpic->key_frame = 1;
} else {
@@ -144,17 +147,6 @@ static int decode_frame(AVCodecContext *avctx, void *data,
newpic->key_frame = 0;
}
- if (*buf++ & C93_HAS_PALETTE) {
- uint32_t *palette = (uint32_t *) newpic->data[1];
- const uint8_t *palbuf = buf + buf_size - 768 - 1;
- for (i = 0; i < 256; i++) {
- palette[i] = bytestream_get_be24(&palbuf);
- }
- } else {
- if (oldpic->data[1])
- memcpy(newpic->data[1], oldpic->data[1], 256 * 4);
- }
-
for (y = 0; y < HEIGHT; y += 8) {
out = newpic->data[0] + y * stride;
for (x = 0; x < WIDTH; x += 8) {
@@ -164,12 +156,12 @@ static int decode_frame(AVCodecContext *avctx, void *data,
C93BlockType block_type;
if (!bt)
- bt = *buf++;
+ bt = bytestream2_get_byte(&gb);
block_type= bt & 0x0F;
switch (block_type) {
case C93_8X8_FROM_PREV:
- offset = bytestream_get_le16(&buf);
+ offset = bytestream2_get_le16(&gb);
if (copy_block(avctx, out, copy_from, offset, 8, stride))
return -1;
break;
@@ -179,7 +171,7 @@ static int decode_frame(AVCodecContext *avctx, void *data,
case C93_4X4_FROM_PREV:
for (j = 0; j < 8; j += 4) {
for (i = 0; i < 8; i += 4) {
- offset = bytestream_get_le16(&buf);
+ offset = bytestream2_get_le16(&gb);
if (copy_block(avctx, &out[j*stride+i],
copy_from, offset, 4, stride))
return -1;
@@ -188,10 +180,10 @@ static int decode_frame(AVCodecContext *avctx, void *data,
break;
case C93_8X8_2COLOR:
- bytestream_get_buffer(&buf, cols, 2);
+ bytestream2_get_buffer(&gb, cols, 2);
for (i = 0; i < 8; i++) {
draw_n_color(out + i*stride, stride, 8, 1, 1, cols,
- NULL, *buf++);
+ NULL, bytestream2_get_byte(&gb));
}
break;
@@ -202,17 +194,17 @@ static int decode_frame(AVCodecContext *avctx, void *data,
for (j = 0; j < 8; j += 4) {
for (i = 0; i < 8; i += 4) {
if (block_type == C93_4X4_2COLOR) {
- bytestream_get_buffer(&buf, cols, 2);
+ bytestream2_get_buffer(&gb, cols, 2);
draw_n_color(out + i + j*stride, stride, 4, 4,
- 1, cols, NULL, bytestream_get_le16(&buf));
+ 1, cols, NULL, bytestream2_get_le16(&gb));
} else if (block_type == C93_4X4_4COLOR) {
- bytestream_get_buffer(&buf, cols, 4);
+ bytestream2_get_buffer(&gb, cols, 4);
draw_n_color(out + i + j*stride, stride, 4, 4,
- 2, cols, NULL, bytestream_get_le32(&buf));
+ 2, cols, NULL, bytestream2_get_le32(&gb));
} else {
- bytestream_get_buffer(&buf, grps, 4);
+ bytestream2_get_buffer(&gb, grps, 4);
draw_n_color(out + i + j*stride, stride, 4, 4,
- 1, cols, grps, bytestream_get_le16(&buf));
+ 1, cols, grps, bytestream2_get_le16(&gb));
}
}
}
@@ -223,7 +215,7 @@ static int decode_frame(AVCodecContext *avctx, void *data,
case C93_8X8_INTRA:
for (j = 0; j < 8; j++)
- bytestream_get_buffer(&buf, out + j*stride, 8);
+ bytestream2_get_buffer(&gb, out + j*stride, 8);
break;
default:
@@ -236,8 +228,19 @@ static int decode_frame(AVCodecContext *avctx, void *data,
}
}
+ if (b & C93_HAS_PALETTE) {
+ uint32_t *palette = (uint32_t *) newpic->data[1];
+ for (i = 0; i < 256; i++) {
+ palette[i] = bytestream2_get_be24(&gb);
+ }
+ newpic->palette_has_changed = 1;
+ } else {
+ if (oldpic->data[1])
+ memcpy(newpic->data[1], oldpic->data[1], 256 * 4);
+ }
+
*picture = *newpic;
- *data_size = sizeof(AVFrame);
+ *got_frame = 1;
return buf_size;
}
@@ -245,11 +248,11 @@ static int decode_frame(AVCodecContext *avctx, void *data,
AVCodec ff_c93_decoder = {
.name = "c93",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_C93,
+ .id = AV_CODEC_ID_C93,
.priv_data_size = sizeof(C93DecoderContext),
.init = decode_init,
.close = decode_end,
.decode = decode_frame,
.capabilities = CODEC_CAP_DR1,
- .long_name = NULL_IF_CONFIG_SMALL("Interplay C93"),
+ .long_name = NULL_IF_CONFIG_SMALL("Interplay C93"),
};
diff --git a/gst-libs/ext/libav/libavcodec/cabac.c b/gst-libs/ext/libav/libavcodec/cabac.c
index 4afcafb..02d2911 100644
--- a/gst-libs/ext/libav/libavcodec/cabac.c
+++ b/gst-libs/ext/libav/libavcodec/cabac.c
@@ -31,6 +31,29 @@
#include "cabac.h"
#include "cabac_functions.h"
+uint8_t ff_h264_cabac_tables[512 + 4*2*64 + 4*64 + 63] = {
+ 9,8,7,7,6,6,6,6,5,5,5,5,5,5,5,5,
+ 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,
+ 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,
+ 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,
+ 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
+ 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
+ 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
+ 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+};
+
static const uint8_t lps_range[64][4]= {
{128,176,208,240}, {128,167,197,227}, {128,158,187,216}, {123,150,178,205},
{116,142,169,195}, {111,135,160,185}, {105,128,152,175}, {100,122,144,166},
@@ -50,8 +73,6 @@ static const uint8_t lps_range[64][4]= {
{ 6, 8, 9, 11}, { 6, 7, 9, 10}, { 6, 7, 8, 9}, { 2, 2, 2, 2},
};
-uint8_t ff_h264_mlps_state[4*64];
-uint8_t ff_h264_lps_range[4*2*64];
static uint8_t h264_mps_state[2 * 64];
static const uint8_t mps_state[64]= {
@@ -76,27 +97,11 @@ static const uint8_t lps_state[64]= {
36,36,37,37,37,38,38,63,
};
-const uint8_t ff_h264_norm_shift[512]= {
- 9,8,7,7,6,6,6,6,5,5,5,5,5,5,5,5,
- 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,
- 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,
- 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,
- 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
- 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
- 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
- 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
- 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
- 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
- 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
- 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+static const uint8_t last_coeff_flag_offset_8x8[63] = {
+ 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4,
+ 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8
};
/**
@@ -153,151 +158,7 @@ void ff_init_cabac_states(CABACContext *c){
ff_h264_mlps_state[128-2*i-2]= 0;
}
}
-}
-
-#ifdef TEST
-#define SIZE 10240
-
-#include "libavutil/lfg.h"
-#include "avcodec.h"
-#include "cabac.h"
-
-static inline void put_cabac_bit(CABACContext *c, int b){
- put_bits(&c->pb, 1, b);
- for(;c->outstanding_count; c->outstanding_count--){
- put_bits(&c->pb, 1, 1-b);
- }
-}
-
-static inline void renorm_cabac_encoder(CABACContext *c){
- while(c->range < 0x100){
- //FIXME optimize
- if(c->low<0x100){
- put_cabac_bit(c, 0);
- }else if(c->low<0x200){
- c->outstanding_count++;
- c->low -= 0x100;
- }else{
- put_cabac_bit(c, 1);
- c->low -= 0x200;
- }
-
- c->range+= c->range;
- c->low += c->low;
- }
-}
-
-static void put_cabac(CABACContext *c, uint8_t * const state, int bit){
- int RangeLPS= ff_h264_lps_range[2*(c->range&0xC0) + *state];
-
- if(bit == ((*state)&1)){
- c->range -= RangeLPS;
- *state = h264_mps_state[*state];
- }else{
- c->low += c->range - RangeLPS;
- c->range = RangeLPS;
- }
-
- renorm_cabac_encoder(c);
-}
-
-/**
- * @param bit 0 -> write zero bit, !=0 write one bit
- */
-static void put_cabac_bypass(CABACContext *c, int bit){
- c->low += c->low;
-
- if(bit){
- c->low += c->range;
- }
-//FIXME optimize
- if(c->low<0x200){
- put_cabac_bit(c, 0);
- }else if(c->low<0x400){
- c->outstanding_count++;
- c->low -= 0x200;
- }else{
- put_cabac_bit(c, 1);
- c->low -= 0x400;
+ for(i=0; i< 63; i++){
+ ff_h264_last_coeff_flag_offset_8x8[i] = last_coeff_flag_offset_8x8[i];
}
}
-
-/**
- *
- * @return the number of bytes written
- */
-static int put_cabac_terminate(CABACContext *c, int bit){
- c->range -= 2;
-
- if(!bit){
- renorm_cabac_encoder(c);
- }else{
- c->low += c->range;
- c->range= 2;
-
- renorm_cabac_encoder(c);
-
- assert(c->low <= 0x1FF);
- put_cabac_bit(c, c->low>>9);
- put_bits(&c->pb, 2, ((c->low>>7)&3)|1);
-
- flush_put_bits(&c->pb); //FIXME FIXME FIXME XXX wrong
- }
-
- return (put_bits_count(&c->pb)+7)>>3;
-}
-
-int main(void){
- CABACContext c;
- uint8_t b[9*SIZE];
- uint8_t r[9*SIZE];
- int i;
- uint8_t state[10]= {0};
- AVLFG prng;
-
- av_lfg_init(&prng, 1);
- ff_init_cabac_encoder(&c, b, SIZE);
- ff_init_cabac_states(&c);
-
- for(i=0; i<SIZE; i++){
- r[i] = av_lfg_get(&prng) % 7;
- }
-
- for(i=0; i<SIZE; i++){
-START_TIMER
- put_cabac_bypass(&c, r[i]&1);
-STOP_TIMER("put_cabac_bypass")
- }
-
- for(i=0; i<SIZE; i++){
-START_TIMER
- put_cabac(&c, state, r[i]&1);
-STOP_TIMER("put_cabac")
- }
-
- put_cabac_terminate(&c, 1);
-
- ff_init_cabac_decoder(&c, b, SIZE);
-
- memset(state, 0, sizeof(state));
-
- for(i=0; i<SIZE; i++){
-START_TIMER
- if( (r[i]&1) != get_cabac_bypass(&c) )
- av_log(NULL, AV_LOG_ERROR, "CABAC bypass failure at %d\n", i);
-STOP_TIMER("get_cabac_bypass")
- }
-
- for(i=0; i<SIZE; i++){
-START_TIMER
- if( (r[i]&1) != get_cabac(&c, state) )
- av_log(NULL, AV_LOG_ERROR, "CABAC failure at %d\n", i);
-STOP_TIMER("get_cabac")
- }
- if(!get_cabac_terminate(&c))
- av_log(NULL, AV_LOG_ERROR, "where's the Terminator?\n");
-
- return 0;
-}
-
-#endif /* TEST */
diff --git a/gst-libs/ext/libav/libavcodec/cabac.h b/gst-libs/ext/libav/libavcodec/cabac.h
index 5a99f0b..1f1c943 100644
--- a/gst-libs/ext/libav/libavcodec/cabac.h
+++ b/gst-libs/ext/libav/libavcodec/cabac.h
@@ -31,6 +31,11 @@
#include "put_bits.h"
+#define H264_NORM_SHIFT_OFFSET 0
+#define H264_LPS_RANGE_OFFSET 512
+#define H264_MLPS_STATE_OFFSET 1024
+#define H264_LAST_COEFF_FLAG_OFFSET_8x8_OFFSET 1280
+
#define CABAC_BITS 16
#define CABAC_MASK ((1<<CABAC_BITS)-1)
diff --git a/gst-libs/ext/libav/libavcodec/cabac_functions.h b/gst-libs/ext/libav/libavcodec/cabac_functions.h
index b150aab..484ba85 100644
--- a/gst-libs/ext/libav/libavcodec/cabac_functions.h
+++ b/gst-libs/ext/libav/libavcodec/cabac_functions.h
@@ -36,9 +36,11 @@
# include "x86/cabac.h"
#endif
-extern const uint8_t ff_h264_norm_shift[512];
-extern uint8_t ff_h264_mlps_state[4*64];
-extern uint8_t ff_h264_lps_range[4*2*64]; ///< rangeTabLPS
+extern uint8_t ff_h264_cabac_tables[512 + 4*2*64 + 4*64 + 63];
+static uint8_t * const ff_h264_norm_shift = ff_h264_cabac_tables + H264_NORM_SHIFT_OFFSET;
+static uint8_t * const ff_h264_lps_range = ff_h264_cabac_tables + H264_LPS_RANGE_OFFSET;
+static uint8_t * const ff_h264_mlps_state = ff_h264_cabac_tables + H264_MLPS_STATE_OFFSET;
+static uint8_t * const ff_h264_last_coeff_flag_offset_8x8 = ff_h264_cabac_tables + H264_LAST_COEFF_FLAG_OFFSET_8x8_OFFSET;
static void refill(CABACContext *c){
#if CABAC_BITS == 16
@@ -47,7 +49,8 @@ static void refill(CABACContext *c){
c->low+= c->bytestream[0]<<1;
#endif
c->low -= CABAC_MASK;
- c->bytestream+= CABAC_BITS/8;
+ if (c->bytestream < c->bytestream_end)
+ c->bytestream += CABAC_BITS / 8;
}
static inline void renorm_cabac_decoder_once(CABACContext *c){
@@ -74,7 +77,8 @@ static void refill2(CABACContext *c){
#endif
c->low += x<<i;
- c->bytestream+= CABAC_BITS/8;
+ if (c->bytestream < c->bytestream_end)
+ c->bytestream += CABAC_BITS/8;
}
static av_always_inline int get_cabac_inline(CABACContext *c, uint8_t * const state){
diff --git a/gst-libs/ext/libav/libavcodec/cavs.c b/gst-libs/ext/libav/libavcodec/cavs.c
index 9ff0e51..f9b876f 100644
--- a/gst-libs/ext/libav/libavcodec/cavs.c
+++ b/gst-libs/ext/libav/libavcodec/cavs.c
@@ -30,7 +30,36 @@
#include "golomb.h"
#include "mathops.h"
#include "cavs.h"
-#include "cavsdata.h"
+
+static const uint8_t alpha_tab[64] = {
+ 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 3, 3,
+ 4, 4, 5, 5, 6, 7, 8, 9, 10, 11, 12, 13, 15, 16, 18, 20,
+ 22, 24, 26, 28, 30, 33, 33, 35, 35, 36, 37, 37, 39, 39, 42, 44,
+ 46, 48, 50, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64
+};
+
+static const uint8_t beta_tab[64] = {
+ 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2,
+ 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6,
+ 6, 7, 7, 7, 8, 8, 8, 9, 9, 10, 10, 11, 11, 12, 13, 14,
+ 15, 16, 17, 18, 19, 20, 21, 22, 23, 23, 24, 24, 25, 25, 26, 27
+};
+
+static const uint8_t tc_tab[64] = {
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2,
+ 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4,
+ 5, 5, 5, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 9, 9, 9
+};
+
+/** mark block as unavailable, i.e. out of picture
+ or not yet decoded */
+static const cavs_vector un_mv = { 0, 0, 1, NOT_AVAIL };
+
+static const int8_t left_modifier_l[8] = { 0, -1, 6, -1, -1, 7, 6, 7 };
+static const int8_t top_modifier_l[8] = { -1, 1, 5, -1, -1, 5, 7, 7 };
+static const int8_t left_modifier_c[7] = { 5, -1, 2, -1, 6, 5, 6 };
+static const int8_t top_modifier_c[7] = { 4, 1, -1, -1, 4, 6, 6 };
/*****************************************************************************
*
@@ -38,27 +67,28 @@
*
****************************************************************************/
-static inline int get_bs(cavs_vector *mvP, cavs_vector *mvQ, int b) {
- if((mvP->ref == REF_INTRA) || (mvQ->ref == REF_INTRA))
+static inline int get_bs(cavs_vector *mvP, cavs_vector *mvQ, int b)
+{
+ if ((mvP->ref == REF_INTRA) || (mvQ->ref == REF_INTRA))
return 2;
- if( (abs(mvP->x - mvQ->x) >= 4) || (abs(mvP->y - mvQ->y) >= 4) )
+ if ((abs(mvP->x - mvQ->x) >= 4) || (abs(mvP->y - mvQ->y) >= 4))
return 1;
- if(b){
+ if (b) {
mvP += MV_BWD_OFFS;
mvQ += MV_BWD_OFFS;
- if( (abs(mvP->x - mvQ->x) >= 4) || (abs(mvP->y - mvQ->y) >= 4) )
+ if ((abs(mvP->x - mvQ->x) >= 4) || (abs(mvP->y - mvQ->y) >= 4))
return 1;
- }else{
- if(mvP->ref != mvQ->ref)
+ } else {
+ if (mvP->ref != mvQ->ref)
return 1;
}
return 0;
}
-#define SET_PARAMS \
- alpha = alpha_tab[av_clip(qp_avg + h->alpha_offset,0,63)]; \
- beta = beta_tab[av_clip(qp_avg + h->beta_offset, 0,63)]; \
- tc = tc_tab[av_clip(qp_avg + h->alpha_offset,0,63)];
+#define SET_PARAMS \
+ alpha = alpha_tab[av_clip(qp_avg + h->alpha_offset, 0, 63)]; \
+ beta = beta_tab[av_clip(qp_avg + h->beta_offset, 0, 63)]; \
+ tc = tc_tab[av_clip(qp_avg + h->alpha_offset, 0, 63)];
/**
* in-loop deblocking filter for a single macroblock
@@ -72,35 +102,36 @@ static inline int get_bs(cavs_vector *mvP, cavs_vector *mvQ, int b) {
* ---------
*
*/
-void ff_cavs_filter(AVSContext *h, enum cavs_mb mb_type) {
+void ff_cavs_filter(AVSContext *h, enum cavs_mb mb_type)
+{
uint8_t bs[8];
int qp_avg, alpha, beta, tc;
int i;
/* save un-deblocked lines */
- h->topleft_border_y = h->top_border_y[h->mbx*16+15];
- h->topleft_border_u = h->top_border_u[h->mbx*10+8];
- h->topleft_border_v = h->top_border_v[h->mbx*10+8];
- memcpy(&h->top_border_y[h->mbx*16], h->cy + 15* h->l_stride,16);
- memcpy(&h->top_border_u[h->mbx*10+1], h->cu + 7* h->c_stride,8);
- memcpy(&h->top_border_v[h->mbx*10+1], h->cv + 7* h->c_stride,8);
- for(i=0;i<8;i++) {
- h->left_border_y[i*2+1] = *(h->cy + 15 + (i*2+0)*h->l_stride);
- h->left_border_y[i*2+2] = *(h->cy + 15 + (i*2+1)*h->l_stride);
- h->left_border_u[i+1] = *(h->cu + 7 + i*h->c_stride);
- h->left_border_v[i+1] = *(h->cv + 7 + i*h->c_stride);
+ h->topleft_border_y = h->top_border_y[h->mbx * 16 + 15];
+ h->topleft_border_u = h->top_border_u[h->mbx * 10 + 8];
+ h->topleft_border_v = h->top_border_v[h->mbx * 10 + 8];
+ memcpy(&h->top_border_y[h->mbx * 16], h->cy + 15 * h->l_stride, 16);
+ memcpy(&h->top_border_u[h->mbx * 10 + 1], h->cu + 7 * h->c_stride, 8);
+ memcpy(&h->top_border_v[h->mbx * 10 + 1], h->cv + 7 * h->c_stride, 8);
+ for (i = 0; i < 8; i++) {
+ h->left_border_y[i * 2 + 1] = *(h->cy + 15 + (i * 2 + 0) * h->l_stride);
+ h->left_border_y[i * 2 + 2] = *(h->cy + 15 + (i * 2 + 1) * h->l_stride);
+ h->left_border_u[i + 1] = *(h->cu + 7 + i * h->c_stride);
+ h->left_border_v[i + 1] = *(h->cv + 7 + i * h->c_stride);
}
- if(!h->loop_filter_disable) {
+ if (!h->loop_filter_disable) {
/* determine bs */
- if(mb_type == I_8X8)
- memset(bs,2,8);
+ if (mb_type == I_8X8)
+ memset(bs, 2, 8);
else{
- memset(bs,0,8);
- if(ff_cavs_partition_flags[mb_type] & SPLITV){
+ memset(bs, 0, 8);
+ if (ff_cavs_partition_flags[mb_type] & SPLITV) {
bs[2] = get_bs(&h->mv[MV_FWD_X0], &h->mv[MV_FWD_X1], mb_type > P_8X8);
bs[3] = get_bs(&h->mv[MV_FWD_X2], &h->mv[MV_FWD_X3], mb_type > P_8X8);
}
- if(ff_cavs_partition_flags[mb_type] & SPLITH){
+ if (ff_cavs_partition_flags[mb_type] & SPLITH) {
bs[6] = get_bs(&h->mv[MV_FWD_X0], &h->mv[MV_FWD_X2], mb_type > P_8X8);
bs[7] = get_bs(&h->mv[MV_FWD_X1], &h->mv[MV_FWD_X3], mb_type > P_8X8);
}
@@ -109,30 +140,29 @@ void ff_cavs_filter(AVSContext *h, enum cavs_mb mb_type) {
bs[4] = get_bs(&h->mv[MV_FWD_B2], &h->mv[MV_FWD_X0], mb_type > P_8X8);
bs[5] = get_bs(&h->mv[MV_FWD_B3], &h->mv[MV_FWD_X1], mb_type > P_8X8);
}
- if(AV_RN64(bs)) {
- if(h->flags & A_AVAIL) {
+ if (AV_RN64(bs)) {
+ if (h->flags & A_AVAIL) {
qp_avg = (h->qp + h->left_qp + 1) >> 1;
SET_PARAMS;
- h->cdsp.cavs_filter_lv(h->cy,h->l_stride,alpha,beta,tc,bs[0],bs[1]);
- h->cdsp.cavs_filter_cv(h->cu,h->c_stride,alpha,beta,tc,bs[0],bs[1]);
- h->cdsp.cavs_filter_cv(h->cv,h->c_stride,alpha,beta,tc,bs[0],bs[1]);
+ h->cdsp.cavs_filter_lv(h->cy, h->l_stride, alpha, beta, tc, bs[0], bs[1]);
+ h->cdsp.cavs_filter_cv(h->cu, h->c_stride, alpha, beta, tc, bs[0], bs[1]);
+ h->cdsp.cavs_filter_cv(h->cv, h->c_stride, alpha, beta, tc, bs[0], bs[1]);
}
qp_avg = h->qp;
SET_PARAMS;
- h->cdsp.cavs_filter_lv(h->cy + 8,h->l_stride,alpha,beta,tc,bs[2],bs[3]);
- h->cdsp.cavs_filter_lh(h->cy + 8*h->l_stride,h->l_stride,alpha,beta,tc,
- bs[6],bs[7]);
+ h->cdsp.cavs_filter_lv(h->cy + 8, h->l_stride, alpha, beta, tc, bs[2], bs[3]);
+ h->cdsp.cavs_filter_lh(h->cy + 8 * h->l_stride, h->l_stride, alpha, beta, tc, bs[6], bs[7]);
- if(h->flags & B_AVAIL) {
+ if (h->flags & B_AVAIL) {
qp_avg = (h->qp + h->top_qp[h->mbx] + 1) >> 1;
SET_PARAMS;
- h->cdsp.cavs_filter_lh(h->cy,h->l_stride,alpha,beta,tc,bs[4],bs[5]);
- h->cdsp.cavs_filter_ch(h->cu,h->c_stride,alpha,beta,tc,bs[4],bs[5]);
- h->cdsp.cavs_filter_ch(h->cv,h->c_stride,alpha,beta,tc,bs[4],bs[5]);
+ h->cdsp.cavs_filter_lh(h->cy, h->l_stride, alpha, beta, tc, bs[4], bs[5]);
+ h->cdsp.cavs_filter_ch(h->cu, h->c_stride, alpha, beta, tc, bs[4], bs[5]);
+ h->cdsp.cavs_filter_ch(h->cv, h->c_stride, alpha, beta, tc, bs[4], bs[5]);
}
}
}
- h->left_qp = h->qp;
+ h->left_qp = h->qp;
h->top_qp[h->mbx] = h->qp;
}
@@ -145,176 +175,197 @@ void ff_cavs_filter(AVSContext *h, enum cavs_mb mb_type) {
****************************************************************************/
void ff_cavs_load_intra_pred_luma(AVSContext *h, uint8_t *top,
- uint8_t **left, int block) {
+ uint8_t **left, int block)
+{
int i;
- switch(block) {
+ switch (block) {
case 0:
- *left = h->left_border_y;
+ *left = h->left_border_y;
h->left_border_y[0] = h->left_border_y[1];
- memset(&h->left_border_y[17],h->left_border_y[16],9);
- memcpy(&top[1],&h->top_border_y[h->mbx*16],16);
+ memset(&h->left_border_y[17], h->left_border_y[16], 9);
+ memcpy(&top[1], &h->top_border_y[h->mbx * 16], 16);
top[17] = top[16];
- top[0] = top[1];
- if((h->flags & A_AVAIL) && (h->flags & B_AVAIL))
+ top[0] = top[1];
+ if ((h->flags & A_AVAIL) && (h->flags & B_AVAIL))
h->left_border_y[0] = top[0] = h->topleft_border_y;
break;
case 1:
*left = h->intern_border_y;
- for(i=0;i<8;i++)
- h->intern_border_y[i+1] = *(h->cy + 7 + i*h->l_stride);
- memset(&h->intern_border_y[9],h->intern_border_y[8],9);
+ for (i = 0; i < 8; i++)
+ h->intern_border_y[i + 1] = *(h->cy + 7 + i * h->l_stride);
+ memset(&h->intern_border_y[9], h->intern_border_y[8], 9);
h->intern_border_y[0] = h->intern_border_y[1];
- memcpy(&top[1],&h->top_border_y[h->mbx*16+8],8);
- if(h->flags & C_AVAIL)
- memcpy(&top[9],&h->top_border_y[(h->mbx + 1)*16],8);
+ memcpy(&top[1], &h->top_border_y[h->mbx * 16 + 8], 8);
+ if (h->flags & C_AVAIL)
+ memcpy(&top[9], &h->top_border_y[(h->mbx + 1) * 16], 8);
else
- memset(&top[9],top[8],9);
+ memset(&top[9], top[8], 9);
top[17] = top[16];
- top[0] = top[1];
- if(h->flags & B_AVAIL)
- h->intern_border_y[0] = top[0] = h->top_border_y[h->mbx*16+7];
+ top[0] = top[1];
+ if (h->flags & B_AVAIL)
+ h->intern_border_y[0] = top[0] = h->top_border_y[h->mbx * 16 + 7];
break;
case 2:
*left = &h->left_border_y[8];
- memcpy(&top[1],h->cy + 7*h->l_stride,16);
+ memcpy(&top[1], h->cy + 7 * h->l_stride, 16);
top[17] = top[16];
- top[0] = top[1];
- if(h->flags & A_AVAIL)
+ top[0] = top[1];
+ if (h->flags & A_AVAIL)
top[0] = h->left_border_y[8];
break;
case 3:
*left = &h->intern_border_y[8];
- for(i=0;i<8;i++)
- h->intern_border_y[i+9] = *(h->cy + 7 + (i+8)*h->l_stride);
- memset(&h->intern_border_y[17],h->intern_border_y[16],9);
- memcpy(&top[0],h->cy + 7 + 7*h->l_stride,9);
- memset(&top[9],top[8],9);
+ for (i = 0; i < 8; i++)
+ h->intern_border_y[i + 9] = *(h->cy + 7 + (i + 8) * h->l_stride);
+ memset(&h->intern_border_y[17], h->intern_border_y[16], 9);
+ memcpy(&top[0], h->cy + 7 + 7 * h->l_stride, 9);
+ memset(&top[9], top[8], 9);
break;
}
}
-void ff_cavs_load_intra_pred_chroma(AVSContext *h) {
+void ff_cavs_load_intra_pred_chroma(AVSContext *h)
+{
/* extend borders by one pixel */
h->left_border_u[9] = h->left_border_u[8];
h->left_border_v[9] = h->left_border_v[8];
- h->top_border_u[h->mbx*10+9] = h->top_border_u[h->mbx*10+8];
- h->top_border_v[h->mbx*10+9] = h->top_border_v[h->mbx*10+8];
- if(h->mbx && h->mby) {
- h->top_border_u[h->mbx*10] = h->left_border_u[0] = h->topleft_border_u;
- h->top_border_v[h->mbx*10] = h->left_border_v[0] = h->topleft_border_v;
+ h->top_border_u[h->mbx * 10 + 9] = h->top_border_u[h->mbx * 10 + 8];
+ h->top_border_v[h->mbx * 10 + 9] = h->top_border_v[h->mbx * 10 + 8];
+ if (h->mbx && h->mby) {
+ h->top_border_u[h->mbx * 10] = h->left_border_u[0] = h->topleft_border_u;
+ h->top_border_v[h->mbx * 10] = h->left_border_v[0] = h->topleft_border_v;
} else {
h->left_border_u[0] = h->left_border_u[1];
h->left_border_v[0] = h->left_border_v[1];
- h->top_border_u[h->mbx*10] = h->top_border_u[h->mbx*10+1];
- h->top_border_v[h->mbx*10] = h->top_border_v[h->mbx*10+1];
+ h->top_border_u[h->mbx * 10] = h->top_border_u[h->mbx * 10 + 1];
+ h->top_border_v[h->mbx * 10] = h->top_border_v[h->mbx * 10 + 1];
}
}
-static void intra_pred_vert(uint8_t *d,uint8_t *top,uint8_t *left,int stride) {
+static void intra_pred_vert(uint8_t *d,uint8_t *top,uint8_t *left,int stride)
+{
int y;
uint64_t a = AV_RN64(&top[1]);
- for(y=0;y<8;y++) {
- *((uint64_t *)(d+y*stride)) = a;
+ for (y = 0; y < 8; y++) {
+ *((uint64_t *)(d + y * stride)) = a;
}
}
-static void intra_pred_horiz(uint8_t *d,uint8_t *top,uint8_t *left,int stride) {
+static void intra_pred_horiz(uint8_t *d,uint8_t *top,uint8_t *left,int stride)
+{
int y;
uint64_t a;
- for(y=0;y<8;y++) {
- a = left[y+1] * 0x0101010101010101ULL;
- *((uint64_t *)(d+y*stride)) = a;
+ for (y = 0; y < 8; y++) {
+ a = left[y + 1] * 0x0101010101010101ULL;
+ *((uint64_t *)(d + y * stride)) = a;
}
}
-static void intra_pred_dc_128(uint8_t *d,uint8_t *top,uint8_t *left,int stride) {
+static void intra_pred_dc_128(uint8_t *d,uint8_t *top,uint8_t *left,int stride)
+{
int y;
uint64_t a = 0x8080808080808080ULL;
- for(y=0;y<8;y++)
- *((uint64_t *)(d+y*stride)) = a;
+ for (y = 0; y < 8; y++)
+ *((uint64_t *)(d + y * stride)) = a;
}
-static void intra_pred_plane(uint8_t *d,uint8_t *top,uint8_t *left,int stride) {
- int x,y,ia;
+static void intra_pred_plane(uint8_t *d,uint8_t *top,uint8_t *left,int stride)
+{
+ int x, y, ia;
int ih = 0;
int iv = 0;
uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
- for(x=0; x<4; x++) {
- ih += (x+1)*(top[5+x]-top[3-x]);
- iv += (x+1)*(left[5+x]-left[3-x]);
+ for (x = 0; x < 4; x++) {
+ ih += (x + 1) * (top [5 + x] - top [3 - x]);
+ iv += (x + 1) * (left[5 + x] - left[3 - x]);
}
- ia = (top[8]+left[8])<<4;
- ih = (17*ih+16)>>5;
- iv = (17*iv+16)>>5;
- for(y=0; y<8; y++)
- for(x=0; x<8; x++)
- d[y*stride+x] = cm[(ia+(x-3)*ih+(y-3)*iv+16)>>5];
+ ia = (top[8] + left[8]) << 4;
+ ih = (17 * ih + 16) >> 5;
+ iv = (17 * iv + 16) >> 5;
+ for (y = 0; y < 8; y++)
+ for (x = 0; x < 8; x++)
+ d[y * stride + x] = cm[(ia + (x - 3) * ih + (y - 3) * iv + 16) >> 5];
}
#define LOWPASS(ARRAY,INDEX) \
- (( ARRAY[(INDEX)-1] + 2*ARRAY[(INDEX)] + ARRAY[(INDEX)+1] + 2) >> 2)
-
-static void intra_pred_lp(uint8_t *d,uint8_t *top,uint8_t *left,int stride) {
- int x,y;
- for(y=0; y<8; y++)
- for(x=0; x<8; x++)
- d[y*stride+x] = (LOWPASS(top,x+1) + LOWPASS(left,y+1)) >> 1;
+ ((ARRAY[(INDEX) - 1] + 2 * ARRAY[(INDEX)] + ARRAY[(INDEX) + 1] + 2) >> 2)
+
+static void intra_pred_lp(uint8_t *d,uint8_t *top,uint8_t *left,int stride)
+{
+ int x, y;
+ for (y = 0; y < 8; y++)
+ for (x = 0; x < 8; x++)
+ d[y * stride + x] = (LOWPASS(top, x + 1) + LOWPASS(left, y + 1)) >> 1;
}
-static void intra_pred_down_left(uint8_t *d,uint8_t *top,uint8_t *left,int stride) {
- int x,y;
- for(y=0; y<8; y++)
- for(x=0; x<8; x++)
- d[y*stride+x] = (LOWPASS(top,x+y+2) + LOWPASS(left,x+y+2)) >> 1;
+static void intra_pred_down_left(uint8_t *d,uint8_t *top,uint8_t *left,int stride)
+{
+ int x, y;
+ for (y = 0; y < 8; y++)
+ for (x = 0; x < 8; x++)
+ d[y * stride + x] = (LOWPASS(top, x + y + 2) + LOWPASS(left, x + y + 2)) >> 1;
}
-static void intra_pred_down_right(uint8_t *d,uint8_t *top,uint8_t *left,int stride) {
- int x,y;
- for(y=0; y<8; y++)
- for(x=0; x<8; x++)
- if(x==y)
- d[y*stride+x] = (left[1]+2*top[0]+top[1]+2)>>2;
- else if(x>y)
- d[y*stride+x] = LOWPASS(top,x-y);
+static void intra_pred_down_right(uint8_t *d,uint8_t *top,uint8_t *left,int stride)
+{
+ int x, y;
+ for (y = 0; y < 8; y++)
+ for (x = 0; x < 8; x++)
+ if (x == y)
+ d[y * stride + x] = (left[1] + 2 * top[0] + top[1] + 2) >> 2;
+ else if (x > y)
+ d[y * stride + x] = LOWPASS(top, x - y);
else
- d[y*stride+x] = LOWPASS(left,y-x);
+ d[y * stride + x] = LOWPASS(left, y - x);
}
-static void intra_pred_lp_left(uint8_t *d,uint8_t *top,uint8_t *left,int stride) {
- int x,y;
- for(y=0; y<8; y++)
- for(x=0; x<8; x++)
- d[y*stride+x] = LOWPASS(left,y+1);
+static void intra_pred_lp_left(uint8_t *d,uint8_t *top,uint8_t *left,int stride)
+{
+ int x, y;
+ for (y = 0; y < 8; y++)
+ for (x = 0; x < 8; x++)
+ d[y * stride + x] = LOWPASS(left, y + 1);
}
-static void intra_pred_lp_top(uint8_t *d,uint8_t *top,uint8_t *left,int stride) {
- int x,y;
- for(y=0; y<8; y++)
- for(x=0; x<8; x++)
- d[y*stride+x] = LOWPASS(top,x+1);
+static void intra_pred_lp_top(uint8_t *d,uint8_t *top,uint8_t *left,int stride)
+{
+ int x, y;
+ for (y = 0; y < 8; y++)
+ for (x = 0; x < 8; x++)
+ d[y * stride + x] = LOWPASS(top, x + 1);
}
#undef LOWPASS
-void ff_cavs_modify_mb_i(AVSContext *h, int *pred_mode_uv) {
+static inline void modify_pred(const int8_t *mod_table, int *mode)
+{
+ *mode = mod_table[*mode];
+ if (*mode < 0) {
+ av_log(NULL, AV_LOG_ERROR, "Illegal intra prediction mode\n");
+ *mode = 0;
+ }
+}
+
+void ff_cavs_modify_mb_i(AVSContext *h, int *pred_mode_uv)
+{
/* save pred modes before they get modified */
h->pred_mode_Y[3] = h->pred_mode_Y[5];
h->pred_mode_Y[6] = h->pred_mode_Y[8];
- h->top_pred_Y[h->mbx*2+0] = h->pred_mode_Y[7];
- h->top_pred_Y[h->mbx*2+1] = h->pred_mode_Y[8];
+ h->top_pred_Y[h->mbx * 2 + 0] = h->pred_mode_Y[7];
+ h->top_pred_Y[h->mbx * 2 + 1] = h->pred_mode_Y[8];
/* modify pred modes according to availability of neighbour samples */
- if(!(h->flags & A_AVAIL)) {
- modify_pred(ff_left_modifier_l, &h->pred_mode_Y[4] );
- modify_pred(ff_left_modifier_l, &h->pred_mode_Y[7] );
- modify_pred(ff_left_modifier_c, pred_mode_uv );
+ if (!(h->flags & A_AVAIL)) {
+ modify_pred(left_modifier_l, &h->pred_mode_Y[4]);
+ modify_pred(left_modifier_l, &h->pred_mode_Y[7]);
+ modify_pred(left_modifier_c, pred_mode_uv);
}
- if(!(h->flags & B_AVAIL)) {
- modify_pred(ff_top_modifier_l, &h->pred_mode_Y[4] );
- modify_pred(ff_top_modifier_l, &h->pred_mode_Y[5] );
- modify_pred(ff_top_modifier_c, pred_mode_uv );
+ if (!(h->flags & B_AVAIL)) {
+ modify_pred(top_modifier_l, &h->pred_mode_Y[4]);
+ modify_pred(top_modifier_l, &h->pred_mode_Y[5]);
+ modify_pred(top_modifier_c, pred_mode_uv);
}
}
@@ -324,19 +375,19 @@ void ff_cavs_modify_mb_i(AVSContext *h, int *pred_mode_uv) {
*
****************************************************************************/
-static inline void mc_dir_part(AVSContext *h,Picture *pic,int square,
- int chroma_height,int delta,int list,uint8_t *dest_y,
- uint8_t *dest_cb,uint8_t *dest_cr,int src_x_offset,
- int src_y_offset,qpel_mc_func *qpix_op,
- h264_chroma_mc_func chroma_op,cavs_vector *mv){
- MpegEncContext * const s = &h->s;
+static inline void mc_dir_part(AVSContext *h, AVFrame *pic,
+ int chroma_height,int delta,int list,uint8_t *dest_y,
+ uint8_t *dest_cb,uint8_t *dest_cr,int src_x_offset,
+ int src_y_offset,qpel_mc_func *qpix_op,
+ h264_chroma_mc_func chroma_op,cavs_vector *mv)
+{
const int mx= mv->x + src_x_offset*8;
const int my= mv->y + src_y_offset*8;
const int luma_xy= (mx&3) + ((my&3)<<2);
- uint8_t * src_y = pic->f.data[0] + (mx >> 2) + (my >> 2) * h->l_stride;
- uint8_t * src_cb = pic->f.data[1] + (mx >> 3) + (my >> 3) * h->c_stride;
- uint8_t * src_cr = pic->f.data[2] + (mx >> 3) + (my >> 3) * h->c_stride;
- int extra_width= 0; //(s->flags&CODEC_FLAG_EMU_EDGE) ? 0 : 16;
+ uint8_t * src_y = pic->data[0] + (mx >> 2) + (my >> 2) * h->l_stride;
+ uint8_t * src_cb = pic->data[1] + (mx >> 3) + (my >> 3) * h->c_stride;
+ uint8_t * src_cr = pic->data[2] + (mx >> 3) + (my >> 3) * h->c_stride;
+ int extra_width = 0;
int extra_height= extra_width;
int emu=0;
const int full_mx= mx>>2;
@@ -344,7 +395,7 @@ static inline void mc_dir_part(AVSContext *h,Picture *pic,int square,
const int pic_width = 16*h->mb_width;
const int pic_height = 16*h->mb_height;
- if(!pic->f.data[0])
+ if (!pic->data[0])
return;
if(mx&7) extra_width -= 3;
if(my&7) extra_height -= 3;
@@ -353,37 +404,35 @@ static inline void mc_dir_part(AVSContext *h,Picture *pic,int square,
|| full_my < 0-extra_height
|| full_mx + 16/*FIXME*/ > pic_width + extra_width
|| full_my + 16/*FIXME*/ > pic_height + extra_height){
- s->dsp.emulated_edge_mc(s->edge_emu_buffer, src_y - 2 - 2*h->l_stride, h->l_stride,
+ h->vdsp.emulated_edge_mc(h->edge_emu_buffer, src_y - 2 - 2*h->l_stride, h->l_stride,
16+5, 16+5/*FIXME*/, full_mx-2, full_my-2, pic_width, pic_height);
- src_y= s->edge_emu_buffer + 2 + 2*h->l_stride;
+ src_y= h->edge_emu_buffer + 2 + 2*h->l_stride;
emu=1;
}
qpix_op[luma_xy](dest_y, src_y, h->l_stride); //FIXME try variable height perhaps?
- if(!square){
- qpix_op[luma_xy](dest_y + delta, src_y + delta, h->l_stride);
- }
if(emu){
- s->dsp.emulated_edge_mc(s->edge_emu_buffer, src_cb, h->c_stride,
+ h->vdsp.emulated_edge_mc(h->edge_emu_buffer, src_cb, h->c_stride,
9, 9/*FIXME*/, (mx>>3), (my>>3), pic_width>>1, pic_height>>1);
- src_cb= s->edge_emu_buffer;
+ src_cb= h->edge_emu_buffer;
}
chroma_op(dest_cb, src_cb, h->c_stride, chroma_height, mx&7, my&7);
if(emu){
- s->dsp.emulated_edge_mc(s->edge_emu_buffer, src_cr, h->c_stride,
+ h->vdsp.emulated_edge_mc(h->edge_emu_buffer, src_cr, h->c_stride,
9, 9/*FIXME*/, (mx>>3), (my>>3), pic_width>>1, pic_height>>1);
- src_cr= s->edge_emu_buffer;
+ src_cr= h->edge_emu_buffer;
}
chroma_op(dest_cr, src_cr, h->c_stride, chroma_height, mx&7, my&7);
}
-static inline void mc_part_std(AVSContext *h,int square,int chroma_height,int delta,
- uint8_t *dest_y,uint8_t *dest_cb,uint8_t *dest_cr,
- int x_offset, int y_offset,qpel_mc_func *qpix_put,
- h264_chroma_mc_func chroma_put,qpel_mc_func *qpix_avg,
- h264_chroma_mc_func chroma_avg, cavs_vector *mv){
+static inline void mc_part_std(AVSContext *h,int chroma_height,int delta,
+ uint8_t *dest_y,uint8_t *dest_cb,uint8_t *dest_cr,
+ int x_offset, int y_offset,qpel_mc_func *qpix_put,
+ h264_chroma_mc_func chroma_put,qpel_mc_func *qpix_avg,
+ h264_chroma_mc_func chroma_avg, cavs_vector *mv)
+{
qpel_mc_func *qpix_op= qpix_put;
h264_chroma_mc_func chroma_op= chroma_put;
@@ -394,8 +443,8 @@ static inline void mc_part_std(AVSContext *h,int square,int chroma_height,int de
y_offset += 8*h->mby;
if(mv->ref >= 0){
- Picture *ref= &h->DPB[mv->ref];
- mc_dir_part(h, ref, square, chroma_height, delta, 0,
+ AVFrame *ref = h->DPB[mv->ref].f;
+ mc_dir_part(h, ref, chroma_height, delta, 0,
dest_y, dest_cb, dest_cr, x_offset, y_offset,
qpix_op, chroma_op, mv);
@@ -404,8 +453,8 @@ static inline void mc_part_std(AVSContext *h,int square,int chroma_height,int de
}
if((mv+MV_BWD_OFFS)->ref >= 0){
- Picture *ref= &h->DPB[0];
- mc_dir_part(h, ref, square, chroma_height, delta, 1,
+ AVFrame *ref = h->DPB[0].f;
+ mc_dir_part(h, ref, chroma_height, delta, 1,
dest_y, dest_cb, dest_cr, x_offset, y_offset,
qpix_op, chroma_op, mv+MV_BWD_OFFS);
}
@@ -413,32 +462,32 @@ static inline void mc_part_std(AVSContext *h,int square,int chroma_height,int de
void ff_cavs_inter(AVSContext *h, enum cavs_mb mb_type) {
if(ff_cavs_partition_flags[mb_type] == 0){ // 16x16
- mc_part_std(h, 1, 8, 0, h->cy, h->cu, h->cv, 0, 0,
+ mc_part_std(h, 8, 0, h->cy, h->cu, h->cv, 0, 0,
h->cdsp.put_cavs_qpel_pixels_tab[0],
- h->s.dsp.put_h264_chroma_pixels_tab[0],
+ h->dsp.put_h264_chroma_pixels_tab[0],
h->cdsp.avg_cavs_qpel_pixels_tab[0],
- h->s.dsp.avg_h264_chroma_pixels_tab[0],&h->mv[MV_FWD_X0]);
+ h->dsp.avg_h264_chroma_pixels_tab[0],&h->mv[MV_FWD_X0]);
}else{
- mc_part_std(h, 1, 4, 0, h->cy, h->cu, h->cv, 0, 0,
+ mc_part_std(h, 4, 0, h->cy, h->cu, h->cv, 0, 0,
h->cdsp.put_cavs_qpel_pixels_tab[1],
- h->s.dsp.put_h264_chroma_pixels_tab[1],
+ h->dsp.put_h264_chroma_pixels_tab[1],
h->cdsp.avg_cavs_qpel_pixels_tab[1],
- h->s.dsp.avg_h264_chroma_pixels_tab[1],&h->mv[MV_FWD_X0]);
- mc_part_std(h, 1, 4, 0, h->cy, h->cu, h->cv, 4, 0,
+ h->dsp.avg_h264_chroma_pixels_tab[1],&h->mv[MV_FWD_X0]);
+ mc_part_std(h, 4, 0, h->cy, h->cu, h->cv, 4, 0,
h->cdsp.put_cavs_qpel_pixels_tab[1],
- h->s.dsp.put_h264_chroma_pixels_tab[1],
+ h->dsp.put_h264_chroma_pixels_tab[1],
h->cdsp.avg_cavs_qpel_pixels_tab[1],
- h->s.dsp.avg_h264_chroma_pixels_tab[1],&h->mv[MV_FWD_X1]);
- mc_part_std(h, 1, 4, 0, h->cy, h->cu, h->cv, 0, 4,
+ h->dsp.avg_h264_chroma_pixels_tab[1],&h->mv[MV_FWD_X1]);
+ mc_part_std(h, 4, 0, h->cy, h->cu, h->cv, 0, 4,
h->cdsp.put_cavs_qpel_pixels_tab[1],
- h->s.dsp.put_h264_chroma_pixels_tab[1],
+ h->dsp.put_h264_chroma_pixels_tab[1],
h->cdsp.avg_cavs_qpel_pixels_tab[1],
- h->s.dsp.avg_h264_chroma_pixels_tab[1],&h->mv[MV_FWD_X2]);
- mc_part_std(h, 1, 4, 0, h->cy, h->cu, h->cv, 4, 4,
+ h->dsp.avg_h264_chroma_pixels_tab[1],&h->mv[MV_FWD_X2]);
+ mc_part_std(h, 4, 0, h->cy, h->cu, h->cv, 4, 4,
h->cdsp.put_cavs_qpel_pixels_tab[1],
- h->s.dsp.put_h264_chroma_pixels_tab[1],
+ h->dsp.put_h264_chroma_pixels_tab[1],
h->cdsp.avg_cavs_qpel_pixels_tab[1],
- h->s.dsp.avg_h264_chroma_pixels_tab[1],&h->mv[MV_FWD_X3]);
+ h->dsp.avg_h264_chroma_pixels_tab[1],&h->mv[MV_FWD_X3]);
}
}
@@ -497,7 +546,7 @@ void ff_cavs_mv(AVSContext *h, enum cavs_mv_loc nP, enum cavs_mv_loc nC,
((mvA->ref == NOT_AVAIL) || (mvB->ref == NOT_AVAIL) ||
((mvA->x | mvA->y | mvA->ref) == 0) ||
((mvB->x | mvB->y | mvB->ref) == 0) )) {
- mvP2 = &ff_cavs_un_mv;
+ mvP2 = &un_mv;
/* if there is only one suitable candidate, take it */
} else if((mvA->ref >= 0) && (mvB->ref < 0) && (mvC->ref < 0)) {
mvP2= mvA;
@@ -519,8 +568,8 @@ void ff_cavs_mv(AVSContext *h, enum cavs_mv_loc nP, enum cavs_mv_loc nC,
mv_pred_median(h, mvP, mvA, mvB, mvC);
if(mode < MV_PRED_PSKIP) {
- mvP->x += get_se_golomb(&h->s.gb);
- mvP->y += get_se_golomb(&h->s.gb);
+ mvP->x += get_se_golomb(&h->gb);
+ mvP->y += get_se_golomb(&h->gb);
}
set_mvs(mvP,size);
}
@@ -546,10 +595,10 @@ void ff_cavs_init_mb(AVSContext *h) {
h->pred_mode_Y[2] = h->top_pred_Y[h->mbx*2+1];
/* clear top predictors if MB B is not available */
if(!(h->flags & B_AVAIL)) {
- h->mv[MV_FWD_B2] = ff_cavs_un_mv;
- h->mv[MV_FWD_B3] = ff_cavs_un_mv;
- h->mv[MV_BWD_B2] = ff_cavs_un_mv;
- h->mv[MV_BWD_B3] = ff_cavs_un_mv;
+ h->mv[MV_FWD_B2] = un_mv;
+ h->mv[MV_FWD_B3] = un_mv;
+ h->mv[MV_BWD_B2] = un_mv;
+ h->mv[MV_BWD_B3] = un_mv;
h->pred_mode_Y[1] = h->pred_mode_Y[2] = NOT_AVAIL;
h->flags &= ~(C_AVAIL|D_AVAIL);
} else if(h->mbx) {
@@ -559,13 +608,13 @@ void ff_cavs_init_mb(AVSContext *h) {
h->flags &= ~C_AVAIL;
/* clear top-right predictors if MB C is not available */
if(!(h->flags & C_AVAIL)) {
- h->mv[MV_FWD_C2] = ff_cavs_un_mv;
- h->mv[MV_BWD_C2] = ff_cavs_un_mv;
+ h->mv[MV_FWD_C2] = un_mv;
+ h->mv[MV_BWD_C2] = un_mv;
}
/* clear top-left predictors if MB D is not available */
if(!(h->flags & D_AVAIL)) {
- h->mv[MV_FWD_D3] = ff_cavs_un_mv;
- h->mv[MV_BWD_D3] = ff_cavs_un_mv;
+ h->mv[MV_FWD_D3] = un_mv;
+ h->mv[MV_BWD_D3] = un_mv;
}
}
@@ -598,13 +647,13 @@ int ff_cavs_next_mb(AVSContext *h) {
h->pred_mode_Y[3] = h->pred_mode_Y[6] = NOT_AVAIL;
/* clear left mv predictors */
for(i=0;i<=20;i+=4)
- h->mv[i] = ff_cavs_un_mv;
+ h->mv[i] = un_mv;
h->mbx = 0;
h->mby++;
/* re-calculate sample pointers */
- h->cy = h->picture.f.data[0] + h->mby * 16 * h->l_stride;
- h->cu = h->picture.f.data[1] + h->mby * 8 * h->c_stride;
- h->cv = h->picture.f.data[2] + h->mby * 8 * h->c_stride;
+ h->cy = h->cur.f->data[0] + h->mby * 16 * h->l_stride;
+ h->cu = h->cur.f->data[1] + h->mby * 8 * h->c_stride;
+ h->cv = h->cur.f->data[2] + h->mby * 8 * h->c_stride;
if(h->mby == h->mb_height) { //frame end
return 0;
}
@@ -623,17 +672,17 @@ void ff_cavs_init_pic(AVSContext *h) {
/* clear some predictors */
for(i=0;i<=20;i+=4)
- h->mv[i] = ff_cavs_un_mv;
+ h->mv[i] = un_mv;
h->mv[MV_BWD_X0] = ff_cavs_dir_mv;
set_mvs(&h->mv[MV_BWD_X0], BLK_16X16);
h->mv[MV_FWD_X0] = ff_cavs_dir_mv;
set_mvs(&h->mv[MV_FWD_X0], BLK_16X16);
h->pred_mode_Y[3] = h->pred_mode_Y[6] = NOT_AVAIL;
- h->cy = h->picture.f.data[0];
- h->cu = h->picture.f.data[1];
- h->cv = h->picture.f.data[2];
- h->l_stride = h->picture.f.linesize[0];
- h->c_stride = h->picture.f.linesize[1];
+ h->cy = h->cur.f->data[0];
+ h->cu = h->cur.f->data[1];
+ h->cv = h->cur.f->data[2];
+ h->l_stride = h->cur.f->linesize[0];
+ h->c_stride = h->cur.f->linesize[1];
h->luma_scan[2] = 8*h->l_stride;
h->luma_scan[3] = 8*h->l_stride+8;
h->mbx = h->mby = h->mbidx = 0;
@@ -653,29 +702,40 @@ void ff_cavs_init_pic(AVSContext *h) {
*/
void ff_cavs_init_top_lines(AVSContext *h) {
/* alloc top line of predictors */
- h->top_qp = av_malloc( h->mb_width);
- h->top_mv[0] = av_malloc((h->mb_width*2+1)*sizeof(cavs_vector));
- h->top_mv[1] = av_malloc((h->mb_width*2+1)*sizeof(cavs_vector));
- h->top_pred_Y = av_malloc( h->mb_width*2*sizeof(*h->top_pred_Y));
- h->top_border_y = av_malloc((h->mb_width+1)*16);
- h->top_border_u = av_malloc( h->mb_width * 10);
- h->top_border_v = av_malloc( h->mb_width * 10);
+ h->top_qp = av_mallocz( h->mb_width);
+ h->top_mv[0] = av_mallocz((h->mb_width*2+1)*sizeof(cavs_vector));
+ h->top_mv[1] = av_mallocz((h->mb_width*2+1)*sizeof(cavs_vector));
+ h->top_pred_Y = av_mallocz( h->mb_width*2*sizeof(*h->top_pred_Y));
+ h->top_border_y = av_mallocz((h->mb_width+1)*16);
+ h->top_border_u = av_mallocz( h->mb_width * 10);
+ h->top_border_v = av_mallocz( h->mb_width * 10);
/* alloc space for co-located MVs and types */
- h->col_mv = av_malloc( h->mb_width*h->mb_height*4*sizeof(cavs_vector));
- h->col_type_base = av_malloc(h->mb_width*h->mb_height);
+ h->col_mv = av_mallocz( h->mb_width*h->mb_height*4*sizeof(cavs_vector));
+ h->col_type_base = av_mallocz(h->mb_width*h->mb_height);
h->block = av_mallocz(64*sizeof(DCTELEM));
}
av_cold int ff_cavs_init(AVCodecContext *avctx) {
AVSContext *h = avctx->priv_data;
- MpegEncContext * const s = &h->s;
- MPV_decode_defaults(s);
+ ff_dsputil_init(&h->dsp, avctx);
+ ff_videodsp_init(&h->vdsp, 8);
ff_cavsdsp_init(&h->cdsp, avctx);
- s->avctx = avctx;
-
- avctx->pix_fmt= PIX_FMT_YUV420P;
+ ff_init_scantable_permutation(h->dsp.idct_permutation,
+ h->cdsp.idct_perm);
+ ff_init_scantable(h->dsp.idct_permutation, &h->scantable, ff_zigzag_direct);
+
+ h->avctx = avctx;
+ avctx->pix_fmt= AV_PIX_FMT_YUV420P;
+
+ h->cur.f = avcodec_alloc_frame();
+ h->DPB[0].f = avcodec_alloc_frame();
+ h->DPB[1].f = avcodec_alloc_frame();
+ if (!h->cur.f || !h->DPB[0].f || !h->DPB[1].f) {
+ ff_cavs_end(avctx);
+ return AVERROR(ENOMEM);
+ }
h->luma_scan[0] = 0;
h->luma_scan[1] = 8;
@@ -694,14 +754,24 @@ av_cold int ff_cavs_init(AVCodecContext *avctx) {
h->intra_pred_c[ INTRA_C_LP_LEFT] = intra_pred_lp_left;
h->intra_pred_c[ INTRA_C_LP_TOP] = intra_pred_lp_top;
h->intra_pred_c[ INTRA_C_DC_128] = intra_pred_dc_128;
- h->mv[ 7] = ff_cavs_un_mv;
- h->mv[19] = ff_cavs_un_mv;
+ h->mv[ 7] = un_mv;
+ h->mv[19] = un_mv;
return 0;
}
av_cold int ff_cavs_end(AVCodecContext *avctx) {
AVSContext *h = avctx->priv_data;
+ if (h->cur.f->data[0])
+ avctx->release_buffer(avctx, h->cur.f);
+ if (h->DPB[0].f->data[0])
+ avctx->release_buffer(avctx, h->DPB[0].f);
+ if (h->DPB[1].f->data[0])
+ avctx->release_buffer(avctx, h->DPB[1].f);
+ avcodec_free_frame(&h->cur.f);
+ avcodec_free_frame(&h->DPB[0].f);
+ avcodec_free_frame(&h->DPB[1].f);
+
av_free(h->top_qp);
av_free(h->top_mv[0]);
av_free(h->top_mv[1]);
@@ -712,5 +782,6 @@ av_cold int ff_cavs_end(AVCodecContext *avctx) {
av_free(h->col_mv);
av_free(h->col_type_base);
av_free(h->block);
+ av_freep(&h->edge_emu_buffer);
return 0;
}
diff --git a/gst-libs/ext/libav/libavcodec/cavs.h b/gst-libs/ext/libav/libavcodec/cavs.h
index eda76a8..26f1e9c 100644
--- a/gst-libs/ext/libav/libavcodec/cavs.h
+++ b/gst-libs/ext/libav/libavcodec/cavs.h
@@ -22,9 +22,10 @@
#ifndef AVCODEC_CAVS_H
#define AVCODEC_CAVS_H
-#include "dsputil.h"
-#include "mpegvideo.h"
#include "cavsdsp.h"
+#include "dsputil.h"
+#include "get_bits.h"
+#include "videodsp.h"
#define SLICE_MAX_START_CODE 0x000001af
#define EXT_START_CODE 0x000001b5
@@ -152,16 +153,25 @@ struct dec_2dvlc {
int8_t max_run;
};
-typedef struct {
- MpegEncContext s;
- CAVSDSPContext cdsp;
- Picture picture; ///< currently decoded frame
- Picture DPB[2]; ///< reference frames
+typedef struct AVSFrame {
+ AVFrame *f;
+ int poc;
+} AVSFrame;
+
+typedef struct AVSContext {
+ AVCodecContext *avctx;
+ DSPContext dsp;
+ VideoDSPContext vdsp;
+ CAVSDSPContext cdsp;
+ GetBitContext gb;
+ AVSFrame cur; ///< currently decoded frame
+ AVSFrame DPB[2]; ///< reference frames
int dist[2]; ///< temporal distances from current frame to ref frames
+ int low_delay;
int profile, level;
int aspect_ratio;
int mb_width, mb_height;
- int pic_type;
+ int width, height;
int stream_revision; ///<0 for samples from 2006, 1 for rm52j encoder
int progressive;
int pic_structure;
@@ -221,45 +231,16 @@ typedef struct {
int direct_den[2]; ///< for scaling in direct B block
int scale_den[2]; ///< for scaling neighbouring MVs
+ uint8_t *edge_emu_buffer;
+
int got_keyframe;
DCTELEM *block;
} AVSContext;
-extern const uint8_t ff_cavs_dequant_shift[64];
-extern const uint16_t ff_cavs_dequant_mul[64];
-extern const struct dec_2dvlc ff_cavs_intra_dec[7];
-extern const struct dec_2dvlc ff_cavs_inter_dec[7];
-extern const struct dec_2dvlc ff_cavs_chroma_dec[5];
-extern const uint8_t ff_cavs_chroma_qp[64];
-extern const uint8_t ff_cavs_scan3x3[4];
extern const uint8_t ff_cavs_partition_flags[30];
-extern const int8_t ff_left_modifier_l[8];
-extern const int8_t ff_top_modifier_l[8];
-extern const int8_t ff_left_modifier_c[7];
-extern const int8_t ff_top_modifier_c[7];
extern const cavs_vector ff_cavs_intra_mv;
-extern const cavs_vector ff_cavs_un_mv;
extern const cavs_vector ff_cavs_dir_mv;
-static inline void modify_pred(const int8_t *mod_table, int *mode)
-{
- *mode = mod_table[*mode];
- if(*mode < 0) {
- av_log(NULL, AV_LOG_ERROR, "Illegal intra prediction mode\n");
- *mode = 0;
- }
-}
-
-static inline void set_intra_mode_default(AVSContext *h) {
- if(h->stream_revision > 0) {
- h->pred_mode_Y[3] = h->pred_mode_Y[6] = NOT_AVAIL;
- h->top_pred_Y[h->mbx*2+0] = h->top_pred_Y[h->mbx*2+1] = NOT_AVAIL;
- } else {
- h->pred_mode_Y[3] = h->pred_mode_Y[6] = INTRA_L_LP;
- h->top_pred_Y[h->mbx*2+0] = h->top_pred_Y[h->mbx*2+1] = INTRA_L_LP;
- }
-}
-
static inline void set_mvs(cavs_vector *mv, enum cavs_block size) {
switch(size) {
case BLK_16X16:
@@ -274,35 +255,6 @@ static inline void set_mvs(cavs_vector *mv, enum cavs_block size) {
}
}
-static inline void set_mv_intra(AVSContext *h) {
- h->mv[MV_FWD_X0] = ff_cavs_intra_mv;
- set_mvs(&h->mv[MV_FWD_X0], BLK_16X16);
- h->mv[MV_BWD_X0] = ff_cavs_intra_mv;
- set_mvs(&h->mv[MV_BWD_X0], BLK_16X16);
- if(h->pic_type != AV_PICTURE_TYPE_B)
- h->col_type_base[h->mbidx] = I_8X8;
-}
-
-static inline int dequant(AVSContext *h, DCTELEM *level_buf, uint8_t *run_buf,
- DCTELEM *dst, int mul, int shift, int coeff_num) {
- int round = 1 << (shift - 1);
- int pos = -1;
- const uint8_t *scantab = h->scantable.permutated;
-
- /* inverse scan and dequantization */
- while(--coeff_num >= 0){
- pos += run_buf[coeff_num];
- if(pos > 63) {
- av_log(h->s.avctx, AV_LOG_ERROR,
- "position out of block bounds at pic %d MB(%d,%d)\n",
- h->picture.poc, h->mbx, h->mby);
- return -1;
- }
- dst[scantab[pos]] = (level_buf[coeff_num]*mul + round) >> shift;
- }
- return 0;
-}
-
void ff_cavs_filter(AVSContext *h, enum cavs_mb mb_type);
void ff_cavs_load_intra_pred_luma(AVSContext *h, uint8_t *top, uint8_t **left,
int block);
diff --git a/gst-libs/ext/libav/libavcodec/cavs_parser.c b/gst-libs/ext/libav/libavcodec/cavs_parser.c
index a91be3a..84f647c 100644
--- a/gst-libs/ext/libav/libavcodec/cavs_parser.c
+++ b/gst-libs/ext/libav/libavcodec/cavs_parser.c
@@ -98,9 +98,9 @@ static int cavsvideo_parse(AVCodecParserContext *s,
}
AVCodecParser ff_cavsvideo_parser = {
- .codec_ids = { CODEC_ID_CAVS },
- .priv_data_size = sizeof(ParseContext1),
+ .codec_ids = { AV_CODEC_ID_CAVS },
+ .priv_data_size = sizeof(ParseContext),
.parser_parse = cavsvideo_parse,
- .parser_close = ff_parse1_close,
+ .parser_close = ff_parse_close,
.split = ff_mpeg4video_split,
};
diff --git a/gst-libs/ext/libav/libavcodec/cavsdata.c b/gst-libs/ext/libav/libavcodec/cavsdata.c
new file mode 100644
index 0000000..4e4a131
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/cavsdata.c
@@ -0,0 +1,62 @@
+/*
+ * Chinese AVS video (AVS1-P2, JiZhun profile) decoder.
+ * Copyright (c) 2006 Stefan Gehrer <stefan.gehrer@gmx.de>
+ *
+ * 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
+ */
+
+#include "cavs.h"
+
+const uint8_t ff_cavs_partition_flags[30] = {
+ 0, //I_8X8
+ 0, //P_SKIP
+ 0, //P_16X16
+ SPLITH, //P_16X8
+ SPLITV, //P_8X16
+ SPLITH|SPLITV, //P_8X8
+ SPLITH|SPLITV, //B_SKIP
+ SPLITH|SPLITV, //B_DIRECT
+ 0, //B_FWD_16X16
+ 0, //B_BWD_16X16
+ 0, //B_SYM_16X16
+ FWD0|FWD1 |SPLITH,
+ FWD0|FWD1 |SPLITV,
+ BWD0|BWD1 |SPLITH,
+ BWD0|BWD1 |SPLITV,
+ FWD0|BWD1 |SPLITH,
+ FWD0|BWD1 |SPLITV,
+ BWD0|FWD1 |SPLITH,
+ BWD0|FWD1 |SPLITV,
+ FWD0|FWD1 |SYM1|SPLITH,
+ FWD0|FWD1 |SYM1 |SPLITV,
+ BWD0|FWD1 |SYM1|SPLITH,
+ BWD0|FWD1 |SYM1 |SPLITV,
+ FWD0|FWD1|SYM0 |SPLITH,
+ FWD0|FWD1|SYM0 |SPLITV,
+ FWD0|BWD1|SYM0 |SPLITH,
+ FWD0|BWD1|SYM0 |SPLITV,
+ FWD0|FWD1|SYM0|SYM1|SPLITH,
+ FWD0|FWD1|SYM0|SYM1 |SPLITV,
+ SPLITH|SPLITV, //B_8X8 = 29
+};
+
+/** mark block as "no prediction from this direction"
+ e.g. forward motion vector in BWD partition */
+const cavs_vector ff_cavs_dir_mv = {0,0,1,REF_DIR};
+
+/** mark block as using intra prediction */
+const cavs_vector ff_cavs_intra_mv = {0,0,1,REF_INTRA};
diff --git a/gst-libs/ext/libav/libavcodec/cavsdata.h b/gst-libs/ext/libav/libavcodec/cavsdata.h
index 210169f..b6117e3 100644
--- a/gst-libs/ext/libav/libavcodec/cavsdata.h
+++ b/gst-libs/ext/libav/libavcodec/cavsdata.h
@@ -57,41 +57,6 @@ const uint8_t ff_cavs_partition_flags[30] = {
SPLITH|SPLITV, //B_8X8 = 29
};
-const uint8_t ff_cavs_scan3x3[4] = {4,5,7,8};
-
-const uint8_t ff_cavs_chroma_qp[64] = {
- 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,
- 32,33,34,35,36,37,38,39,40,41,42,42,43,43,44,44,
- 45,45,46,46,47,47,48,48,48,49,49,49,50,50,50,51
-};
-
-const uint8_t ff_cavs_dequant_shift[64] = {
- 14,14,14,14,14,14,14,14,
- 13,13,13,13,13,13,13,13,
- 13,12,12,12,12,12,12,12,
- 11,11,11,11,11,11,11,11,
- 11,10,10,10,10,10,10,10,
- 10, 9, 9, 9, 9, 9, 9, 9,
- 9, 8, 8, 8, 8, 8, 8, 8,
- 7, 7, 7, 7, 7, 7, 7, 7
-};
-
-const uint16_t ff_cavs_dequant_mul[64] = {
- 32768,36061,38968,42495,46341,50535,55437,60424,
- 32932,35734,38968,42495,46177,50535,55109,59933,
- 65535,35734,38968,42577,46341,50617,55027,60097,
- 32809,35734,38968,42454,46382,50576,55109,60056,
- 65535,35734,38968,42495,46320,50515,55109,60076,
- 65535,35744,38968,42495,46341,50535,55099,60087,
- 65535,35734,38973,42500,46341,50535,55109,60097,
- 32771,35734,38965,42497,46341,50535,55109,60099
-};
-
-/** mark block as unavailable, i.e. out of picture
- or not yet decoded */
-const cavs_vector ff_cavs_un_mv = {0,0,1,NOT_AVAIL};
-
/** mark block as "no prediction from this direction"
e.g. forward motion vector in BWD partition */
const cavs_vector ff_cavs_dir_mv = {0,0,1,REF_DIR};
@@ -99,407 +64,4 @@ const cavs_vector ff_cavs_dir_mv = {0,0,1,REF_DIR};
/** mark block as using intra prediction */
const cavs_vector ff_cavs_intra_mv = {0,0,1,REF_INTRA};
-#define EOB 0,0,0
-
-const struct dec_2dvlc ff_cavs_intra_dec[7] = {
- {
- { //level / run / table_inc
- { 1, 1, 1},{ -1, 1, 1},{ 1, 2, 1},{ -1, 2, 1},{ 1, 3, 1},{ -1, 3, 1},
- { 1, 4, 1},{ -1, 4, 1},{ 1, 5, 1},{ -1, 5, 1},{ 1, 6, 1},{ -1, 6, 1},
- { 1, 7, 1},{ -1, 7, 1},{ 1, 8, 1},{ -1, 8, 1},{ 1, 9, 1},{ -1, 9, 1},
- { 1,10, 1},{ -1,10, 1},{ 1,11, 1},{ -1,11, 1},{ 2, 1, 2},{ -2, 1, 2},
- { 1,12, 1},{ -1,12, 1},{ 1,13, 1},{ -1,13, 1},{ 1,14, 1},{ -1,14, 1},
- { 1,15, 1},{ -1,15, 1},{ 2, 2, 2},{ -2, 2, 2},{ 1,16, 1},{ -1,16, 1},
- { 1,17, 1},{ -1,17, 1},{ 3, 1, 3},{ -3, 1, 3},{ 1,18, 1},{ -1,18, 1},
- { 1,19, 1},{ -1,19, 1},{ 2, 3, 2},{ -2, 3, 2},{ 1,20, 1},{ -1,20, 1},
- { 1,21, 1},{ -1,21, 1},{ 2, 4, 2},{ -2, 4, 2},{ 1,22, 1},{ -1,22, 1},
- { 2, 5, 2},{ -2, 5, 2},{ 1,23, 1},{ -1,23, 1},{ EOB }
- },
- //level_add
- { 0, 4, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2,-1,-1,-1},
- 2, //golomb_order
- 0, //inc_limit
- 23, //max_run
- },{
- { //level / run
- { 1, 1, 0},{ -1, 1, 0},{ 1, 2, 0},{ -1, 2, 0},{ 2, 1, 1},{ -2, 1, 1},
- { 1, 3, 0},{ -1, 3, 0},{ EOB },{ 1, 4, 0},{ -1, 4, 0},{ 1, 5, 0},
- { -1, 5, 0},{ 1, 6, 0},{ -1, 6, 0},{ 3, 1, 2},{ -3, 1, 2},{ 2, 2, 1},
- { -2, 2, 1},{ 1, 7, 0},{ -1, 7, 0},{ 1, 8, 0},{ -1, 8, 0},{ 1, 9, 0},
- { -1, 9, 0},{ 2, 3, 1},{ -2, 3, 1},{ 4, 1, 2},{ -4, 1, 2},{ 1,10, 0},
- { -1,10, 0},{ 1,11, 0},{ -1,11, 0},{ 2, 4, 1},{ -2, 4, 1},{ 3, 2, 2},
- { -3, 2, 2},{ 1,12, 0},{ -1,12, 0},{ 2, 5, 1},{ -2, 5, 1},{ 5, 1, 3},
- { -5, 1, 3},{ 1,13, 0},{ -1,13, 0},{ 2, 6, 1},{ -2, 6, 1},{ 1,14, 0},
- { -1,14, 0},{ 2, 7, 1},{ -2, 7, 1},{ 2, 8, 1},{ -2, 8, 1},{ 3, 3, 2},
- { -3, 3, 2},{ 6, 1, 3},{ -6, 1, 3},{ 1,15, 0},{ -1,15, 0}
- },
- //level_add
- { 0, 7, 4, 4, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2,-1,
- -1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
- 2, //golomb_order
- 1, //inc_limit
- 15, //max_run
- },{
- { //level / run
- { 1, 1, 0},{ -1, 1, 0},{ 2, 1, 0},{ -2, 1, 0},{ 1, 2, 0},{ -1, 2, 0},
- { 3, 1, 1},{ -3, 1, 1},{ EOB },{ 1, 3, 0},{ -1, 3, 0},{ 2, 2, 0},
- { -2, 2, 0},{ 4, 1, 1},{ -4, 1, 1},{ 1, 4, 0},{ -1, 4, 0},{ 5, 1, 2},
- { -5, 1, 2},{ 1, 5, 0},{ -1, 5, 0},{ 3, 2, 1},{ -3, 2, 1},{ 2, 3, 0},
- { -2, 3, 0},{ 1, 6, 0},{ -1, 6, 0},{ 6, 1, 2},{ -6, 1, 2},{ 2, 4, 0},
- { -2, 4, 0},{ 1, 7, 0},{ -1, 7, 0},{ 4, 2, 1},{ -4, 2, 1},{ 7, 1, 2},
- { -7, 1, 2},{ 3, 3, 1},{ -3, 3, 1},{ 2, 5, 0},{ -2, 5, 0},{ 1, 8, 0},
- { -1, 8, 0},{ 2, 6, 0},{ -2, 6, 0},{ 8, 1, 3},{ -8, 1, 3},{ 1, 9, 0},
- { -1, 9, 0},{ 5, 2, 2},{ -5, 2, 2},{ 3, 4, 1},{ -3, 4, 1},{ 2, 7, 0},
- { -2, 7, 0},{ 9, 1, 3},{ -9, 1, 3},{ 1,10, 0},{ -1,10, 0}
- },
- //level_add
- { 0,10, 6, 4, 4, 3, 3, 3, 2, 2, 2,-1,-1,-1,-1,-1,-1,
- -1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
- 2, //golomb_order
- 2, //inc_limit
- 10, //max_run
- },{
- { //level / run
- { 1, 1, 0},{ -1, 1, 0},{ 2, 1, 0},{ -2, 1, 0},{ 3, 1, 0},{ -3, 1, 0},
- { 1, 2, 0},{ -1, 2, 0},{ EOB },{ 4, 1, 0},{ -4, 1, 0},{ 5, 1, 1},
- { -5, 1, 1},{ 2, 2, 0},{ -2, 2, 0},{ 1, 3, 0},{ -1, 3, 0},{ 6, 1, 1},
- { -6, 1, 1},{ 3, 2, 0},{ -3, 2, 0},{ 7, 1, 1},{ -7, 1, 1},{ 1, 4, 0},
- { -1, 4, 0},{ 8, 1, 2},{ -8, 1, 2},{ 2, 3, 0},{ -2, 3, 0},{ 4, 2, 0},
- { -4, 2, 0},{ 1, 5, 0},{ -1, 5, 0},{ 9, 1, 2},{ -9, 1, 2},{ 5, 2, 1},
- { -5, 2, 1},{ 2, 4, 0},{ -2, 4, 0},{ 10, 1, 2},{-10, 1, 2},{ 3, 3, 0},
- { -3, 3, 0},{ 1, 6, 0},{ -1, 6, 0},{ 11, 1, 3},{-11, 1, 3},{ 6, 2, 1},
- { -6, 2, 1},{ 1, 7, 0},{ -1, 7, 0},{ 2, 5, 0},{ -2, 5, 0},{ 3, 4, 0},
- { -3, 4, 0},{ 12, 1, 3},{-12, 1, 3},{ 4, 3, 0},{ -4, 3, 0}
- },
- //level_add
- { 0,13, 7, 5, 4, 3, 2, 2,-1,-1,-1 -1,-1,-1,-1,-1,-1,
- -1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
- 2, //golomb_order
- 4, //inc_limit
- 7, //max_run
- },{
- { //level / run
- { 1, 1, 0},{ -1, 1, 0},{ 2, 1, 0},{ -2, 1, 0},{ 3, 1, 0},{ -3, 1, 0},
- { EOB },{ 4, 1, 0},{ -4, 1, 0},{ 5, 1, 0},{ -5, 1, 0},{ 6, 1, 0},
- { -6, 1, 0},{ 1, 2, 0},{ -1, 2, 0},{ 7, 1, 0},{ -7, 1, 0},{ 8, 1, 1},
- { -8, 1, 1},{ 2, 2, 0},{ -2, 2, 0},{ 9, 1, 1},{ -9, 1, 1},{ 10, 1, 1},
- {-10, 1, 1},{ 1, 3, 0},{ -1, 3, 0},{ 3, 2, 0},{ -3, 2, 0},{ 11, 1, 2},
- {-11, 1, 2},{ 4, 2, 0},{ -4, 2, 0},{ 12, 1, 2},{-12, 1, 2},{ 13, 1, 2},
- {-13, 1, 2},{ 5, 2, 0},{ -5, 2, 0},{ 1, 4, 0},{ -1, 4, 0},{ 2, 3, 0},
- { -2, 3, 0},{ 14, 1, 2},{-14, 1, 2},{ 6, 2, 0},{ -6, 2, 0},{ 15, 1, 2},
- {-15, 1, 2},{ 16, 1, 2},{-16, 1, 2},{ 3, 3, 0},{ -3, 3, 0},{ 1, 5, 0},
- { -1, 5, 0},{ 7, 2, 0},{ -7, 2, 0},{ 17, 1, 2},{-17, 1, 2}
- },
- //level_add
- { 0,18, 8, 4, 2, 2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
- -1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
- 2, //golomb_order
- 7, //inc_limit
- 5, //max_run
- },{
- { //level / run
- { EOB },{ 1, 1, 0},{ -1, 1, 0},{ 2, 1, 0},{ -2, 1, 0},{ 3, 1, 0},
- { -3, 1, 0},{ 4, 1, 0},{ -4, 1, 0},{ 5, 1, 0},{ -5, 1, 0},{ 6, 1, 0},
- { -6, 1, 0},{ 7, 1, 0},{ -7, 1, 0},{ 8, 1, 0},{ -8, 1, 0},{ 9, 1, 0},
- { -9, 1, 0},{ 10, 1, 0},{-10, 1, 0},{ 1, 2, 0},{ -1, 2, 0},{ 11, 1, 1},
- {-11, 1, 1},{ 12, 1, 1},{-12, 1, 1},{ 13, 1, 1},{-13, 1, 1},{ 2, 2, 0},
- { -2, 2, 0},{ 14, 1, 1},{-14, 1, 1},{ 15, 1, 1},{-15, 1, 1},{ 3, 2, 0},
- { -3, 2, 0},{ 16, 1, 1},{-16, 1, 1},{ 1, 3, 0},{ -1, 3, 0},{ 17, 1, 1},
- {-17, 1, 1},{ 4, 2, 0},{ -4, 2, 0},{ 18, 1, 1},{-18, 1, 1},{ 5, 2, 0},
- { -5, 2, 0},{ 19, 1, 1},{-19, 1, 1},{ 20, 1, 1},{-20, 1, 1},{ 6, 2, 0},
- { -6, 2, 0},{ 21, 1, 1},{-21, 1, 1},{ 2, 3, 0},{ -2, 3, 0}
- },
- //level_add
- { 0,22, 7, 3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
- -1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
- 2, //golomb_order
- 10, //inc_limit
- 3, //max_run
- },{
- { //level / run
- { EOB },{ 1, 1, 0},{ -1, 1, 0},{ 2, 1, 0},{ -2, 1, 0},{ 3, 1, 0},
- { -3, 1, 0},{ 4, 1, 0},{ -4, 1, 0},{ 5, 1, 0},{ -5, 1, 0},{ 6, 1, 0},
- { -6, 1, 0},{ 7, 1, 0},{ -7, 1, 0},{ 8, 1, 0},{ -8, 1, 0},{ 9, 1, 0},
- { -9, 1, 0},{ 10, 1, 0},{-10, 1, 0},{ 11, 1, 0},{-11, 1, 0},{ 12, 1, 0},
- {-12, 1, 0},{ 13, 1, 0},{-13, 1, 0},{ 14, 1, 0},{-14, 1, 0},{ 15, 1, 0},
- {-15, 1, 0},{ 16, 1, 0},{-16, 1, 0},{ 1, 2, 0},{ -1, 2, 0},{ 17, 1, 0},
- {-17, 1, 0},{ 18, 1, 0},{-18, 1, 0},{ 19, 1, 0},{-19, 1, 0},{ 20, 1, 0},
- {-20, 1, 0},{ 21, 1, 0},{-21, 1, 0},{ 2, 2, 0},{ -2, 2, 0},{ 22, 1, 0},
- {-22, 1, 0},{ 23, 1, 0},{-23, 1, 0},{ 24, 1, 0},{-24, 1, 0},{ 25, 1, 0},
- {-25, 1, 0},{ 3, 2, 0},{ -3, 2, 0},{ 26, 1, 0},{-26, 1, 0}
- },
- //level_add
- { 0,27, 4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
- -1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
- 2, //golomb_order
- INT_MAX, //inc_limit
- 2, //max_run
- }
-};
-
-const struct dec_2dvlc ff_cavs_inter_dec[7] = {
- {
- { //level / run
- { 1, 1, 1},{ -1, 1, 1},{ 1, 2, 1},{ -1, 2, 1},{ 1, 3, 1},{ -1, 3, 1},
- { 1, 4, 1},{ -1, 4, 1},{ 1, 5, 1},{ -1, 5, 1},{ 1, 6, 1},{ -1, 6, 1},
- { 1, 7, 1},{ -1, 7, 1},{ 1, 8, 1},{ -1, 8, 1},{ 1, 9, 1},{ -1, 9, 1},
- { 1,10, 1},{ -1,10, 1},{ 1,11, 1},{ -1,11, 1},{ 1,12, 1},{ -1,12, 1},
- { 1,13, 1},{ -1,13, 1},{ 2, 1, 2},{ -2, 1, 2},{ 1,14, 1},{ -1,14, 1},
- { 1,15, 1},{ -1,15, 1},{ 1,16, 1},{ -1,16, 1},{ 1,17, 1},{ -1,17, 1},
- { 1,18, 1},{ -1,18, 1},{ 1,19, 1},{ -1,19, 1},{ 3, 1, 3},{ -3, 1, 3},
- { 1,20, 1},{ -1,20, 1},{ 1,21, 1},{ -1,21, 1},{ 2, 2, 2},{ -2, 2, 2},
- { 1,22, 1},{ -1,22, 1},{ 1,23, 1},{ -1,23, 1},{ 1,24, 1},{ -1,24, 1},
- { 1,25, 1},{ -1,25, 1},{ 1,26, 1},{ -1,26, 1},{ EOB }
- },
- //level_add
- { 0, 4, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2},
- 3, //golomb_order
- 0, //inc_limit
- 26 //max_run
- },{
- { //level / run
- { 1, 1, 0},{ -1, 1, 0},{ EOB },{ 1, 2, 0},{ -1, 2, 0},{ 1, 3, 0},
- { -1, 3, 0},{ 1, 4, 0},{ -1, 4, 0},{ 1, 5, 0},{ -1, 5, 0},{ 1, 6, 0},
- { -1, 6, 0},{ 2, 1, 1},{ -2, 1, 1},{ 1, 7, 0},{ -1, 7, 0},{ 1, 8, 0},
- { -1, 8, 0},{ 1, 9, 0},{ -1, 9, 0},{ 1,10, 0},{ -1,10, 0},{ 2, 2, 1},
- { -2, 2, 1},{ 1,11, 0},{ -1,11, 0},{ 1,12, 0},{ -1,12, 0},{ 3, 1, 2},
- { -3, 1, 2},{ 1,13, 0},{ -1,13, 0},{ 1,14, 0},{ -1,14, 0},{ 2, 3, 1},
- { -2, 3, 1},{ 1,15, 0},{ -1,15, 0},{ 2, 4, 1},{ -2, 4, 1},{ 1,16, 0},
- { -1,16, 0},{ 2, 5, 1},{ -2, 5, 1},{ 1,17, 0},{ -1,17, 0},{ 4, 1, 3},
- { -4, 1, 3},{ 2, 6, 1},{ -2, 6, 1},{ 1,18, 0},{ -1,18, 0},{ 1,19, 0},
- { -1,19, 0},{ 2, 7, 1},{ -2, 7, 1},{ 3, 2, 2},{ -3, 2, 2}
- },
- //level_add
- { 0, 5, 4, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2,-1,-1,-1,-1,-1,-1,-1},
- 2, //golomb_order
- 1, //inc_limit
- 19 //max_run
- },{
- { //level / run
- { 1, 1, 0},{ -1, 1, 0},{ EOB },{ 1, 2, 0},{ -1, 2, 0},{ 2, 1, 0},
- { -2, 1, 0},{ 1, 3, 0},{ -1, 3, 0},{ 1, 4, 0},{ -1, 4, 0},{ 3, 1, 1},
- { -3, 1, 1},{ 2, 2, 0},{ -2, 2, 0},{ 1, 5, 0},{ -1, 5, 0},{ 1, 6, 0},
- { -1, 6, 0},{ 1, 7, 0},{ -1, 7, 0},{ 2, 3, 0},{ -2, 3, 0},{ 4, 1, 2},
- { -4, 1, 2},{ 1, 8, 0},{ -1, 8, 0},{ 3, 2, 1},{ -3, 2, 1},{ 2, 4, 0},
- { -2, 4, 0},{ 1, 9, 0},{ -1, 9, 0},{ 1,10, 0},{ -1,10, 0},{ 5, 1, 2},
- { -5, 1, 2},{ 2, 5, 0},{ -2, 5, 0},{ 1,11, 0},{ -1,11, 0},{ 2, 6, 0},
- { -2, 6, 0},{ 1,12, 0},{ -1,12, 0},{ 3, 3, 1},{ -3, 3, 1},{ 6, 1, 2},
- { -6, 1, 2},{ 4, 2, 2},{ -4, 2, 2},{ 1,13, 0},{ -1,13, 0},{ 2, 7, 0},
- { -2, 7, 0},{ 3, 4, 1},{ -3, 4, 1},{ 1,14, 0},{ -1,14, 0}
- },
- //level_add
- { 0, 7, 5, 4, 4, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2,-1,-1,
- -1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
- 2, //golomb_order
- 2, //inc_limit
- 14 //max_run
- },{
- { //level / run
- { 1, 1, 0},{ -1, 1, 0},{ EOB },{ 2, 1, 0},{ -2, 1, 0},{ 1, 2, 0},
- { -1, 2, 0},{ 3, 1, 0},{ -3, 1, 0},{ 1, 3, 0},{ -1, 3, 0},{ 2, 2, 0},
- { -2, 2, 0},{ 4, 1, 1},{ -4, 1, 1},{ 1, 4, 0},{ -1, 4, 0},{ 5, 1, 1},
- { -5, 1, 1},{ 1, 5, 0},{ -1, 5, 0},{ 3, 2, 0},{ -3, 2, 0},{ 2, 3, 0},
- { -2, 3, 0},{ 1, 6, 0},{ -1, 6, 0},{ 6, 1, 1},{ -6, 1, 1},{ 2, 4, 0},
- { -2, 4, 0},{ 1, 7, 0},{ -1, 7, 0},{ 4, 2, 1},{ -4, 2, 1},{ 7, 1, 2},
- { -7, 1, 2},{ 3, 3, 0},{ -3, 3, 0},{ 1, 8, 0},{ -1, 8, 0},{ 2, 5, 0},
- { -2, 5, 0},{ 8, 1, 2},{ -8, 1, 2},{ 1, 9, 0},{ -1, 9, 0},{ 3, 4, 0},
- { -3, 4, 0},{ 2, 6, 0},{ -2, 6, 0},{ 5, 2, 1},{ -5, 2, 1},{ 1,10, 0},
- { -1,10, 0},{ 9, 1, 2},{ -9, 1, 2},{ 4, 3, 1},{ -4, 3, 1}
- },
- //level_add
- { 0,10, 6, 5, 4, 3, 3, 2, 2, 2, 2,-1,-1,-1,-1,-1,-1,
- -1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
- 2, //golomb_order
- 3, //inc_limit
- 10 //max_run
- },{
- { //level / run
- { 1, 1, 0},{ -1, 1, 0},{ EOB },{ 2, 1, 0},{ -2, 1, 0},{ 3, 1, 0},
- { -3, 1, 0},{ 1, 2, 0},{ -1, 2, 0},{ 4, 1, 0},{ -4, 1, 0},{ 5, 1, 0},
- { -5, 1, 0},{ 2, 2, 0},{ -2, 2, 0},{ 1, 3, 0},{ -1, 3, 0},{ 6, 1, 0},
- { -6, 1, 0},{ 3, 2, 0},{ -3, 2, 0},{ 7, 1, 1},{ -7, 1, 1},{ 1, 4, 0},
- { -1, 4, 0},{ 8, 1, 1},{ -8, 1, 1},{ 2, 3, 0},{ -2, 3, 0},{ 4, 2, 0},
- { -4, 2, 0},{ 1, 5, 0},{ -1, 5, 0},{ 9, 1, 1},{ -9, 1, 1},{ 5, 2, 0},
- { -5, 2, 0},{ 2, 4, 0},{ -2, 4, 0},{ 1, 6, 0},{ -1, 6, 0},{ 10, 1, 2},
- {-10, 1, 2},{ 3, 3, 0},{ -3, 3, 0},{ 11, 1, 2},{-11, 1, 2},{ 1, 7, 0},
- { -1, 7, 0},{ 6, 2, 0},{ -6, 2, 0},{ 3, 4, 0},{ -3, 4, 0},{ 2, 5, 0},
- { -2, 5, 0},{ 12, 1, 2},{-12, 1, 2},{ 4, 3, 0},{ -4, 3, 0}
- },
- //level_add
- { 0,13, 7, 5, 4, 3, 2, 2,-1,-1,-1,-1,-1,-1,-1,-1,-1,
- -1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
- 2, //golomb_order
- 6, //inc_limit
- 7 //max_run
- },{
- { //level / run
- { EOB },{ 1, 1, 0},{ -1, 1, 0},{ 2, 1, 0},{ -2, 1, 0},{ 3, 1, 0},
- { -3, 1, 0},{ 4, 1, 0},{ -4, 1, 0},{ 5, 1, 0},{ -5, 1, 0},{ 1, 2, 0},
- { -1, 2, 0},{ 6, 1, 0},{ -6, 1, 0},{ 7, 1, 0},{ -7, 1, 0},{ 8, 1, 0},
- { -8, 1, 0},{ 2, 2, 0},{ -2, 2, 0},{ 9, 1, 0},{ -9, 1, 0},{ 1, 3, 0},
- { -1, 3, 0},{ 10, 1, 1},{-10, 1, 1},{ 3, 2, 0},{ -3, 2, 0},{ 11, 1, 1},
- {-11, 1, 1},{ 4, 2, 0},{ -4, 2, 0},{ 12, 1, 1},{-12, 1, 1},{ 1, 4, 0},
- { -1, 4, 0},{ 2, 3, 0},{ -2, 3, 0},{ 13, 1, 1},{-13, 1, 1},{ 5, 2, 0},
- { -5, 2, 0},{ 14, 1, 1},{-14, 1, 1},{ 6, 2, 0},{ -6, 2, 0},{ 1, 5, 0},
- { -1, 5, 0},{ 15, 1, 1},{-15, 1, 1},{ 3, 3, 0},{ -3, 3, 0},{ 16, 1, 1},
- {-16, 1, 1},{ 2, 4, 0},{ -2, 4, 0},{ 7, 2, 0},{ -7, 2, 0}
- },
- //level_add
- { 0,17, 8, 4, 3, 2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
- -1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
- 2, //golomb_order
- 9, //inc_limit
- 5 //max_run
- },{
- { //level / run
- { EOB },{ 1, 1, 0},{ -1, 1, 0},{ 2, 1, 0},{ -2, 1, 0},{ 3, 1, 0},
- { -3, 1, 0},{ 4, 1, 0},{ -4, 1, 0},{ 5, 1, 0},{ -5, 1, 0},{ 6, 1, 0},
- { -6, 1, 0},{ 7, 1, 0},{ -7, 1, 0},{ 1, 2, 0},{ -1, 2, 0},{ 8, 1, 0},
- { -8, 1, 0},{ 9, 1, 0},{ -9, 1, 0},{ 10, 1, 0},{-10, 1, 0},{ 11, 1, 0},
- {-11, 1, 0},{ 12, 1, 0},{-12, 1, 0},{ 2, 2, 0},{ -2, 2, 0},{ 13, 1, 0},
- {-13, 1, 0},{ 1, 3, 0},{ -1, 3, 0},{ 14, 1, 0},{-14, 1, 0},{ 15, 1, 0},
- {-15, 1, 0},{ 3, 2, 0},{ -3, 2, 0},{ 16, 1, 0},{-16, 1, 0},{ 17, 1, 0},
- {-17, 1, 0},{ 18, 1, 0},{-18, 1, 0},{ 4, 2, 0},{ -4, 2, 0},{ 19, 1, 0},
- {-19, 1, 0},{ 20, 1, 0},{-20, 1, 0},{ 2, 3, 0},{ -2, 3, 0},{ 1, 4, 0},
- { -1, 4, 0},{ 5, 2, 0},{ -5, 2, 0},{ 21, 1, 0},{-21, 1, 0}
- },
- //level_add
- { 0,22, 6, 3, 2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
- -1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
- 2, //golomb_order
- INT_MAX, //inc_limit
- 4 //max_run
- }
-};
-
-const struct dec_2dvlc ff_cavs_chroma_dec[5] = {
- {
- { //level / run
- { 1, 1, 1},{ -1, 1, 1},{ 1, 2, 1},{ -1, 2, 1},{ 1, 3, 1},{ -1, 3, 1},
- { 1, 4, 1},{ -1, 4, 1},{ 1, 5, 1},{ -1, 5, 1},{ 1, 6, 1},{ -1, 6, 1},
- { 1, 7, 1},{ -1, 7, 1},{ 2, 1, 2},{ -2, 1, 2},{ 1, 8, 1},{ -1, 8, 1},
- { 1, 9, 1},{ -1, 9, 1},{ 1,10, 1},{ -1,10, 1},{ 1,11, 1},{ -1,11, 1},
- { 1,12, 1},{ -1,12, 1},{ 1,13, 1},{ -1,13, 1},{ 1,14, 1},{ -1,14, 1},
- { 1,15, 1},{ -1,15, 1},{ 3, 1, 3},{ -3, 1, 3},{ 1,16, 1},{ -1,16, 1},
- { 1,17, 1},{ -1,17, 1},{ 1,18, 1},{ -1,18, 1},{ 1,19, 1},{ -1,19, 1},
- { 1,20, 1},{ -1,20, 1},{ 1,21, 1},{ -1,21, 1},{ 1,22, 1},{ -1,22, 1},
- { 2, 2, 2},{ -2, 2, 2},{ 1,23, 1},{ -1,23, 1},{ 1,24, 1},{ -1,24, 1},
- { 1,25, 1},{ -1,25, 1},{ 4, 1, 3},{ -4, 1, 3},{ EOB }
- },
- //level_add
- { 0, 5, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2,-1},
- 2, //golomb_order
- 0, //inc_limit
- 25 //max_run
- },{
- { //level / run
- { EOB },{ 1, 1, 0},{ -1, 1, 0},{ 1, 2, 0},{ -1, 2, 0},{ 2, 1, 1},
- { -2, 1, 1},{ 1, 3, 0},{ -1, 3, 0},{ 1, 4, 0},{ -1, 4, 0},{ 1, 5, 0},
- { -1, 5, 0},{ 1, 6, 0},{ -1, 6, 0},{ 3, 1, 2},{ -3, 1, 2},{ 1, 7, 0},
- { -1, 7, 0},{ 1, 8, 0},{ -1, 8, 0},{ 2, 2, 1},{ -2, 2, 1},{ 1, 9, 0},
- { -1, 9, 0},{ 1,10, 0},{ -1,10, 0},{ 1,11, 0},{ -1,11, 0},{ 4, 1, 2},
- { -4, 1, 2},{ 1,12, 0},{ -1,12, 0},{ 1,13, 0},{ -1,13, 0},{ 1,14, 0},
- { -1,14, 0},{ 2, 3, 1},{ -2, 3, 1},{ 1,15, 0},{ -1,15, 0},{ 2, 4, 1},
- { -2, 4, 1},{ 5, 1, 3},{ -5, 1, 3},{ 3, 2, 2},{ -3, 2, 2},{ 1,16, 0},
- { -1,16, 0},{ 1,17, 0},{ -1,17, 0},{ 1,18, 0},{ -1,18, 0},{ 2, 5, 1},
- { -2, 5, 1},{ 1,19, 0},{ -1,19, 0},{ 1,20, 0},{ -1,20, 0}
- },
- //level_add
- { 0, 6, 4, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2,-1,-1,-1,-1,-1,-1},
- 0, //golomb_order
- 1, //inc_limit
- 20 //max_run
- },{
- { //level / run
- { 1, 1, 0},{ -1, 1, 0},{ EOB },{ 2, 1, 0},{ -2, 1, 0},{ 1, 2, 0},
- { -1, 2, 0},{ 3, 1, 1},{ -3, 1, 1},{ 1, 3, 0},{ -1, 3, 0},{ 4, 1, 1},
- { -4, 1, 1},{ 2, 2, 0},{ -2, 2, 0},{ 1, 4, 0},{ -1, 4, 0},{ 5, 1, 2},
- { -5, 1, 2},{ 1, 5, 0},{ -1, 5, 0},{ 3, 2, 1},{ -3, 2, 1},{ 2, 3, 0},
- { -2, 3, 0},{ 1, 6, 0},{ -1, 6, 0},{ 6, 1, 2},{ -6, 1, 2},{ 1, 7, 0},
- { -1, 7, 0},{ 2, 4, 0},{ -2, 4, 0},{ 7, 1, 2},{ -7, 1, 2},{ 1, 8, 0},
- { -1, 8, 0},{ 4, 2, 1},{ -4, 2, 1},{ 1, 9, 0},{ -1, 9, 0},{ 3, 3, 1},
- { -3, 3, 1},{ 2, 5, 0},{ -2, 5, 0},{ 2, 6, 0},{ -2, 6, 0},{ 8, 1, 2},
- { -8, 1, 2},{ 1,10, 0},{ -1,10, 0},{ 1,11, 0},{ -1,11, 0},{ 9, 1, 2},
- { -9, 1, 2},{ 5, 2, 2},{ -5, 2, 2},{ 3, 4, 1},{ -3, 4, 1},
- },
- //level_add
- { 0,10, 6, 4, 4, 3, 3, 2, 2, 2, 2, 2,-1,-1,-1,-1,-1,
- -1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
- 1, //golomb_order
- 2, //inc_limit
- 11 //max_run
- },{
- { //level / run
- { EOB },{ 1, 1, 0},{ -1, 1, 0},{ 2, 1, 0},{ -2, 1, 0},{ 3, 1, 0},
- { -3, 1, 0},{ 4, 1, 0},{ -4, 1, 0},{ 1, 2, 0},{ -1, 2, 0},{ 5, 1, 1},
- { -5, 1, 1},{ 2, 2, 0},{ -2, 2, 0},{ 6, 1, 1},{ -6, 1, 1},{ 1, 3, 0},
- { -1, 3, 0},{ 7, 1, 1},{ -7, 1, 1},{ 3, 2, 0},{ -3, 2, 0},{ 8, 1, 1},
- { -8, 1, 1},{ 1, 4, 0},{ -1, 4, 0},{ 2, 3, 0},{ -2, 3, 0},{ 9, 1, 1},
- { -9, 1, 1},{ 4, 2, 0},{ -4, 2, 0},{ 1, 5, 0},{ -1, 5, 0},{ 10, 1, 1},
- {-10, 1, 1},{ 3, 3, 0},{ -3, 3, 0},{ 5, 2, 1},{ -5, 2, 1},{ 2, 4, 0},
- { -2, 4, 0},{ 11, 1, 1},{-11, 1, 1},{ 1, 6, 0},{ -1, 6, 0},{ 12, 1, 1},
- {-12, 1, 1},{ 1, 7, 0},{ -1, 7, 0},{ 6, 2, 1},{ -6, 2, 1},{ 13, 1, 1},
- {-13, 1, 1},{ 2, 5, 0},{ -2, 5, 0},{ 1, 8, 0},{ -1, 8, 0},
- },
- //level_add
- { 0,14, 7, 4, 3, 3, 2, 2, 2,-1,-1,-1,-1,-1,-1,-1,-1,
- -1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
- 1, //golomb_order
- 4, //inc_limit
- 8 //max_run
- },{
- { //level / run
- { EOB },{ 1, 1, 0},{ -1, 1, 0},{ 2, 1, 0},{ -2, 1, 0},{ 3, 1, 0},
- { -3, 1, 0},{ 4, 1, 0},{ -4, 1, 0},{ 5, 1, 0},{ -5, 1, 0},{ 6, 1, 0},
- { -6, 1, 0},{ 7, 1, 0},{ -7, 1, 0},{ 8, 1, 0},{ -8, 1, 0},{ 1, 2, 0},
- { -1, 2, 0},{ 9, 1, 0},{ -9, 1, 0},{ 10, 1, 0},{-10, 1, 0},{ 11, 1, 0},
- {-11, 1, 0},{ 2, 2, 0},{ -2, 2, 0},{ 12, 1, 0},{-12, 1, 0},{ 13, 1, 0},
- {-13, 1, 0},{ 3, 2, 0},{ -3, 2, 0},{ 14, 1, 0},{-14, 1, 0},{ 1, 3, 0},
- { -1, 3, 0},{ 15, 1, 0},{-15, 1, 0},{ 4, 2, 0},{ -4, 2, 0},{ 16, 1, 0},
- {-16, 1, 0},{ 17, 1, 0},{-17, 1, 0},{ 5, 2, 0},{ -5, 2, 0},{ 1, 4, 0},
- { -1, 4, 0},{ 2, 3, 0},{ -2, 3, 0},{ 18, 1, 0},{-18, 1, 0},{ 6, 2, 0},
- { -6, 2, 0},{ 19, 1, 0},{-19, 1, 0},{ 1, 5, 0},{ -1, 5, 0},
- },
- //level_add
- { 0,20, 7, 3, 2, 2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
- -1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
- 0, //golomb_order
- INT_MAX, //inc_limit
- 5, //max_run
- }
-};
-
-#undef EOB
-
-static const uint8_t alpha_tab[64] = {
- 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 3, 3,
- 4, 4, 5, 5, 6, 7, 8, 9, 10, 11, 12, 13, 15, 16, 18, 20,
- 22, 24, 26, 28, 30, 33, 33, 35, 35, 36, 37, 37, 39, 39, 42, 44,
- 46, 48, 50, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64
-};
-
-static const uint8_t beta_tab[64] = {
- 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2,
- 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6,
- 6, 7, 7, 7, 8, 8, 8, 9, 9, 10, 10, 11, 11, 12, 13, 14,
- 15, 16, 17, 18, 19, 20, 21, 22, 23, 23, 24, 24, 25, 25, 26, 27
-};
-
-static const uint8_t tc_tab[64] = {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2,
- 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4,
- 5, 5, 5, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 9, 9, 9
-};
-
-const int8_t ff_left_modifier_l[8] = { 0, -1, 6, -1, -1, 7, 6, 7 };
-const int8_t ff_top_modifier_l[8] = { -1, 1, 5, -1, -1, 5, 7, 7 };
-const int8_t ff_left_modifier_c[7] = { 5, -1, 2, -1, 6, 5, 6 };
-const int8_t ff_top_modifier_c[7] = { 4, 1, -1, -1, 4, 6, 6 };
-
#endif /* AVCODEC_CAVSDATA_H */
diff --git a/gst-libs/ext/libav/libavcodec/cavsdec.c b/gst-libs/ext/libav/libavcodec/cavsdec.c
index 1dd237a..cef6b95 100644
--- a/gst-libs/ext/libav/libavcodec/cavsdec.c
+++ b/gst-libs/ext/libav/libavcodec/cavsdec.c
@@ -29,38 +29,448 @@
#include "get_bits.h"
#include "golomb.h"
#include "cavs.h"
+#include "internal.h"
+#include "mpeg12data.h"
+#include "mpegvideo.h"
static const uint8_t mv_scan[4] = {
- MV_FWD_X0,MV_FWD_X1,
- MV_FWD_X2,MV_FWD_X3
+ MV_FWD_X0, MV_FWD_X1,
+ MV_FWD_X2, MV_FWD_X3
};
static const uint8_t cbp_tab[64][2] = {
- {63, 0},{15,15},{31,63},{47,31},{ 0,16},{14,32},{13,47},{11,13},
- { 7,14},{ 5,11},{10,12},{ 8, 5},{12,10},{61, 7},{ 4,48},{55, 3},
- { 1, 2},{ 2, 8},{59, 4},{ 3, 1},{62,61},{ 9,55},{ 6,59},{29,62},
- {45,29},{51,27},{23,23},{39,19},{27,30},{46,28},{53, 9},{30, 6},
- {43,60},{37,21},{60,44},{16,26},{21,51},{28,35},{19,18},{35,20},
- {42,24},{26,53},{44,17},{32,37},{58,39},{24,45},{20,58},{17,43},
- {18,42},{48,46},{22,36},{33,33},{25,34},{49,40},{40,52},{36,49},
- {34,50},{50,56},{52,25},{54,22},{41,54},{56,57},{38,41},{57,38}
+ { 63, 0 }, { 15, 15 }, { 31, 63 }, { 47, 31 }, { 0, 16 }, { 14, 32 }, { 13, 47 }, { 11, 13 },
+ { 7, 14 }, { 5, 11 }, { 10, 12 }, { 8, 5 }, { 12, 10 }, { 61, 7 }, { 4, 48 }, { 55, 3 },
+ { 1, 2 }, { 2, 8 }, { 59, 4 }, { 3, 1 }, { 62, 61 }, { 9, 55 }, { 6, 59 }, { 29, 62 },
+ { 45, 29 }, { 51, 27 }, { 23, 23 }, { 39, 19 }, { 27, 30 }, { 46, 28 }, { 53, 9 }, { 30, 6 },
+ { 43, 60 }, { 37, 21 }, { 60, 44 }, { 16, 26 }, { 21, 51 }, { 28, 35 }, { 19, 18 }, { 35, 20 },
+ { 42, 24 }, { 26, 53 }, { 44, 17 }, { 32, 37 }, { 58, 39 }, { 24, 45 }, { 20, 58 }, { 17, 43 },
+ { 18, 42 }, { 48, 46 }, { 22, 36 }, { 33, 33 }, { 25, 34 }, { 49, 40 }, { 40, 52 }, { 36, 49 },
+ { 34, 50 }, { 50, 56 }, { 52, 25 }, { 54, 22 }, { 41, 54 }, { 56, 57 }, { 38, 41 }, { 57, 38 }
};
+static const uint8_t scan3x3[4] = { 4, 5, 7, 8 };
+
+static const uint8_t cavs_chroma_qp[64] = {
+ 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,
+ 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 42, 43, 43, 44, 44,
+ 45, 45, 46, 46, 47, 47, 48, 48, 48, 49, 49, 49, 50, 50, 50, 51
+};
+
+static const uint8_t dequant_shift[64] = {
+ 14, 14, 14, 14, 14, 14, 14, 14,
+ 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 12, 12, 12, 12, 12, 12, 12,
+ 11, 11, 11, 11, 11, 11, 11, 11,
+ 11, 10, 10, 10, 10, 10, 10, 10,
+ 10, 9, 9, 9, 9, 9, 9, 9,
+ 9, 8, 8, 8, 8, 8, 8, 8,
+ 7, 7, 7, 7, 7, 7, 7, 7
+};
+
+static const uint16_t dequant_mul[64] = {
+ 32768, 36061, 38968, 42495, 46341, 50535, 55437, 60424,
+ 32932, 35734, 38968, 42495, 46177, 50535, 55109, 59933,
+ 65535, 35734, 38968, 42577, 46341, 50617, 55027, 60097,
+ 32809, 35734, 38968, 42454, 46382, 50576, 55109, 60056,
+ 65535, 35734, 38968, 42495, 46320, 50515, 55109, 60076,
+ 65535, 35744, 38968, 42495, 46341, 50535, 55099, 60087,
+ 65535, 35734, 38973, 42500, 46341, 50535, 55109, 60097,
+ 32771, 35734, 38965, 42497, 46341, 50535, 55109, 60099
+};
+
+#define EOB 0, 0, 0
+
+static const struct dec_2dvlc intra_dec[7] = {
+ {
+ { //level / run / table_inc
+ { 1, 1, 1 }, { -1, 1, 1 }, { 1, 2, 1 }, { -1, 2, 1 }, { 1, 3, 1 }, { -1, 3, 1 },
+ { 1, 4, 1 }, { -1, 4, 1 }, { 1, 5, 1 }, { -1, 5, 1 }, { 1, 6, 1 }, { -1, 6, 1 },
+ { 1, 7, 1 }, { -1, 7, 1 }, { 1, 8, 1 }, { -1, 8, 1 }, { 1, 9, 1 }, { -1, 9, 1 },
+ { 1, 10, 1 }, { -1, 10, 1 }, { 1, 11, 1 }, { -1, 11, 1 }, { 2, 1, 2 }, { -2, 1, 2 },
+ { 1, 12, 1 }, { -1, 12, 1 }, { 1, 13, 1 }, { -1, 13, 1 }, { 1, 14, 1 }, { -1, 14, 1 },
+ { 1, 15, 1 }, { -1, 15, 1 }, { 2, 2, 2 }, { -2, 2, 2 }, { 1, 16, 1 }, { -1, 16, 1 },
+ { 1, 17, 1 }, { -1, 17, 1 }, { 3, 1, 3 }, { -3, 1, 3 }, { 1, 18, 1 }, { -1, 18, 1 },
+ { 1, 19, 1 }, { -1, 19, 1 }, { 2, 3, 2 }, { -2, 3, 2 }, { 1, 20, 1 }, { -1, 20, 1 },
+ { 1, 21, 1 }, { -1, 21, 1 }, { 2, 4, 2 }, { -2, 4, 2 }, { 1, 22, 1 }, { -1, 22, 1 },
+ { 2, 5, 2 }, { -2, 5, 2 }, { 1, 23, 1 }, { -1, 23, 1 }, { EOB }
+ },
+ //level_add
+ { 0, 4, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, -1, -1, -1 },
+ 2, //golomb_order
+ 0, //inc_limit
+ 23, //max_run
+ },
+ {
+ { //level / run
+ { 1, 1, 0 }, { -1, 1, 0 }, { 1, 2, 0 }, { -1, 2, 0 }, { 2, 1, 1 }, { -2, 1, 1 },
+ { 1, 3, 0 }, { -1, 3, 0 }, { EOB }, { 1, 4, 0 }, { -1, 4, 0 }, { 1, 5, 0 },
+ { -1, 5, 0 }, { 1, 6, 0 }, { -1, 6, 0 }, { 3, 1, 2 }, { -3, 1, 2 }, { 2, 2, 1 },
+ { -2, 2, 1 }, { 1, 7, 0 }, { -1, 7, 0 }, { 1, 8, 0 }, { -1, 8, 0 }, { 1, 9, 0 },
+ { -1, 9, 0 }, { 2, 3, 1 }, { -2, 3, 1 }, { 4, 1, 2 }, { -4, 1, 2 }, { 1, 10, 0 },
+ { -1, 10, 0 }, { 1, 11, 0 }, { -1, 11, 0 }, { 2, 4, 1 }, { -2, 4, 1 }, { 3, 2, 2 },
+ { -3, 2, 2 }, { 1, 12, 0 }, { -1, 12, 0 }, { 2, 5, 1 }, { -2, 5, 1 }, { 5, 1, 3 },
+ { -5, 1, 3 }, { 1, 13, 0 }, { -1, 13, 0 }, { 2, 6, 1 }, { -2, 6, 1 }, { 1, 14, 0 },
+ { -1, 14, 0 }, { 2, 7, 1 }, { -2, 7, 1 }, { 2, 8, 1 }, { -2, 8, 1 }, { 3, 3, 2 },
+ { -3, 3, 2 }, { 6, 1, 3 }, { -6, 1, 3 }, { 1, 15, 0 }, { -1, 15, 0 }
+ },
+ //level_add
+ { 0, 7, 4, 4, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
+ 2, //golomb_order
+ 1, //inc_limit
+ 15, //max_run
+ },
+ {
+ { //level / run
+ { 1, 1, 0 }, { -1, 1, 0 }, { 2, 1, 0 }, { -2, 1, 0 }, { 1, 2, 0 }, { -1, 2, 0 },
+ { 3, 1, 1 }, { -3, 1, 1 }, { EOB }, { 1, 3, 0 }, { -1, 3, 0 }, { 2, 2, 0 },
+ { -2, 2, 0 }, { 4, 1, 1 }, { -4, 1, 1 }, { 1, 4, 0 }, { -1, 4, 0 }, { 5, 1, 2 },
+ { -5, 1, 2 }, { 1, 5, 0 }, { -1, 5, 0 }, { 3, 2, 1 }, { -3, 2, 1 }, { 2, 3, 0 },
+ { -2, 3, 0 }, { 1, 6, 0 }, { -1, 6, 0 }, { 6, 1, 2 }, { -6, 1, 2 }, { 2, 4, 0 },
+ { -2, 4, 0 }, { 1, 7, 0 }, { -1, 7, 0 }, { 4, 2, 1 }, { -4, 2, 1 }, { 7, 1, 2 },
+ { -7, 1, 2 }, { 3, 3, 1 }, { -3, 3, 1 }, { 2, 5, 0 }, { -2, 5, 0 }, { 1, 8, 0 },
+ { -1, 8, 0 }, { 2, 6, 0 }, { -2, 6, 0 }, { 8, 1, 3 }, { -8, 1, 3 }, { 1, 9, 0 },
+ { -1, 9, 0 }, { 5, 2, 2 }, { -5, 2, 2 }, { 3, 4, 1 }, { -3, 4, 1 }, { 2, 7, 0 },
+ { -2, 7, 0 }, { 9, 1, 3 }, { -9, 1, 3 }, { 1, 10, 0 }, { -1, 10, 0 }
+ },
+ //level_add
+ { 0, 10, 6, 4, 4, 3, 3, 3, 2, 2, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
+ 2, //golomb_order
+ 2, //inc_limit
+ 10, //max_run
+ },
+ {
+ { //level / run
+ { 1, 1, 0 }, { -1, 1, 0 }, { 2, 1, 0 }, { -2, 1, 0 }, { 3, 1, 0 }, { -3, 1, 0 },
+ { 1, 2, 0 }, { -1, 2, 0 }, { EOB }, { 4, 1, 0 }, { -4, 1, 0 }, { 5, 1, 1 },
+ { -5, 1, 1 }, { 2, 2, 0 }, { -2, 2, 0 }, { 1, 3, 0 }, { -1, 3, 0 }, { 6, 1, 1 },
+ { -6, 1, 1 }, { 3, 2, 0 }, { -3, 2, 0 }, { 7, 1, 1 }, { -7, 1, 1 }, { 1, 4, 0 },
+ { -1, 4, 0 }, { 8, 1, 2 }, { -8, 1, 2 }, { 2, 3, 0 }, { -2, 3, 0 }, { 4, 2, 0 },
+ { -4, 2, 0 }, { 1, 5, 0 }, { -1, 5, 0 }, { 9, 1, 2 }, { -9, 1, 2 }, { 5, 2, 1 },
+ { -5, 2, 1 }, { 2, 4, 0 }, { -2, 4, 0 }, { 10, 1, 2 }, {-10, 1, 2 }, { 3, 3, 0 },
+ { -3, 3, 0 }, { 1, 6, 0 }, { -1, 6, 0 }, { 11, 1, 3 }, {-11, 1, 3 }, { 6, 2, 1 },
+ { -6, 2, 1 }, { 1, 7, 0 }, { -1, 7, 0 }, { 2, 5, 0 }, { -2, 5, 0 }, { 3, 4, 0 },
+ { -3, 4, 0 }, { 12, 1, 3 }, {-12, 1, 3 }, { 4, 3, 0 }, { -4, 3, 0 }
+ },
+ //level_add
+ { 0, 13, 7, 5, 4, 3, 2, 2, -1, -1, -1 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
+ 2, //golomb_order
+ 4, //inc_limit
+ 7, //max_run
+ },
+ {
+ { //level / run
+ { 1, 1, 0 }, { -1, 1, 0 }, { 2, 1, 0 }, { -2, 1, 0 }, { 3, 1, 0 }, { -3, 1, 0 },
+ { EOB }, { 4, 1, 0 }, { -4, 1, 0 }, { 5, 1, 0 }, { -5, 1, 0 }, { 6, 1, 0 },
+ { -6, 1, 0 }, { 1, 2, 0 }, { -1, 2, 0 }, { 7, 1, 0 }, { -7, 1, 0 }, { 8, 1, 1 },
+ { -8, 1, 1 }, { 2, 2, 0 }, { -2, 2, 0 }, { 9, 1, 1 }, { -9, 1, 1 }, { 10, 1, 1 },
+ {-10, 1, 1 }, { 1, 3, 0 }, { -1, 3, 0 }, { 3, 2, 0 }, { -3, 2, 0 }, { 11, 1, 2 },
+ {-11, 1, 2 }, { 4, 2, 0 }, { -4, 2, 0 }, { 12, 1, 2 }, {-12, 1, 2 }, { 13, 1, 2 },
+ {-13, 1, 2 }, { 5, 2, 0 }, { -5, 2, 0 }, { 1, 4, 0 }, { -1, 4, 0 }, { 2, 3, 0 },
+ { -2, 3, 0 }, { 14, 1, 2 }, {-14, 1, 2 }, { 6, 2, 0 }, { -6, 2, 0 }, { 15, 1, 2 },
+ {-15, 1, 2 }, { 16, 1, 2 }, {-16, 1, 2 }, { 3, 3, 0 }, { -3, 3, 0 }, { 1, 5, 0 },
+ { -1, 5, 0 }, { 7, 2, 0 }, { -7, 2, 0 }, { 17, 1, 2 }, {-17, 1, 2 }
+ },
+ //level_add
+ { 0,18, 8, 4, 2, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
+ 2, //golomb_order
+ 7, //inc_limit
+ 5, //max_run
+ },
+ {
+ { //level / run
+ { EOB }, { 1, 1, 0 }, { -1, 1, 0 }, { 2, 1, 0 }, { -2, 1, 0 }, { 3, 1, 0 },
+ { -3, 1, 0 }, { 4, 1, 0 }, { -4, 1, 0 }, { 5, 1, 0 }, { -5, 1, 0 }, { 6, 1, 0 },
+ { -6, 1, 0 }, { 7, 1, 0 }, { -7, 1, 0 }, { 8, 1, 0 }, { -8, 1, 0 }, { 9, 1, 0 },
+ { -9, 1, 0 }, { 10, 1, 0 }, {-10, 1, 0 }, { 1, 2, 0 }, { -1, 2, 0 }, { 11, 1, 1 },
+ {-11, 1, 1 }, { 12, 1, 1 }, {-12, 1, 1 }, { 13, 1, 1 }, {-13, 1, 1 }, { 2, 2, 0 },
+ { -2, 2, 0 }, { 14, 1, 1 }, {-14, 1, 1 }, { 15, 1, 1 }, {-15, 1, 1 }, { 3, 2, 0 },
+ { -3, 2, 0 }, { 16, 1, 1 }, {-16, 1, 1 }, { 1, 3, 0 }, { -1, 3, 0 }, { 17, 1, 1 },
+ {-17, 1, 1 }, { 4, 2, 0 }, { -4, 2, 0 }, { 18, 1, 1 }, {-18, 1, 1 }, { 5, 2, 0 },
+ { -5, 2, 0 }, { 19, 1, 1 }, {-19, 1, 1 }, { 20, 1, 1 }, {-20, 1, 1 }, { 6, 2, 0 },
+ { -6, 2, 0 }, { 21, 1, 1 }, {-21, 1, 1 }, { 2, 3, 0 }, { -2, 3, 0 }
+ },
+ //level_add
+ { 0, 22, 7, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
+ 2, //golomb_order
+ 10, //inc_limit
+ 3, //max_run
+ },
+ {
+ { //level / run
+ { EOB }, { 1, 1, 0 }, { -1, 1, 0 }, { 2, 1, 0 }, { -2, 1, 0 }, { 3, 1, 0 },
+ { -3, 1, 0 }, { 4, 1, 0 }, { -4, 1, 0 }, { 5, 1, 0 }, { -5, 1, 0 }, { 6, 1, 0 },
+ { -6, 1, 0 }, { 7, 1, 0 }, { -7, 1, 0 }, { 8, 1, 0 }, { -8, 1, 0 }, { 9, 1, 0 },
+ { -9, 1, 0 }, { 10, 1, 0 }, {-10, 1, 0 }, { 11, 1, 0 }, {-11, 1, 0 }, { 12, 1, 0 },
+ {-12, 1, 0 }, { 13, 1, 0 }, {-13, 1, 0 }, { 14, 1, 0 }, {-14, 1, 0 }, { 15, 1, 0 },
+ {-15, 1, 0 }, { 16, 1, 0 }, {-16, 1, 0 }, { 1, 2, 0 }, { -1, 2, 0 }, { 17, 1, 0 },
+ {-17, 1, 0 }, { 18, 1, 0 }, {-18, 1, 0 }, { 19, 1, 0 }, {-19, 1, 0 }, { 20, 1, 0 },
+ {-20, 1, 0 }, { 21, 1, 0 }, {-21, 1, 0 }, { 2, 2, 0 }, { -2, 2, 0 }, { 22, 1, 0 },
+ {-22, 1, 0 }, { 23, 1, 0 }, {-23, 1, 0 }, { 24, 1, 0 }, {-24, 1, 0 }, { 25, 1, 0 },
+ {-25, 1, 0 }, { 3, 2, 0 }, { -3, 2, 0 }, { 26, 1, 0 }, {-26, 1, 0 }
+ },
+ //level_add
+ { 0, 27, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
+ 2, //golomb_order
+ INT_MAX, //inc_limit
+ 2, //max_run
+ }
+};
+
+static const struct dec_2dvlc inter_dec[7] = {
+ {
+ { //level / run
+ { 1, 1, 1 }, { -1, 1, 1 }, { 1, 2, 1 }, { -1, 2, 1 }, { 1, 3, 1 }, { -1, 3, 1 },
+ { 1, 4, 1 }, { -1, 4, 1 }, { 1, 5, 1 }, { -1, 5, 1 }, { 1, 6, 1 }, { -1, 6, 1 },
+ { 1, 7, 1 }, { -1, 7, 1 }, { 1, 8, 1 }, { -1, 8, 1 }, { 1, 9, 1 }, { -1, 9, 1 },
+ { 1, 10, 1 }, { -1, 10, 1 }, { 1, 11, 1 }, { -1, 11, 1 }, { 1, 12, 1 }, { -1, 12, 1 },
+ { 1, 13, 1 }, { -1, 13, 1 }, { 2, 1, 2 }, { -2, 1, 2 }, { 1, 14, 1 }, { -1, 14, 1 },
+ { 1, 15, 1 }, { -1, 15, 1 }, { 1, 16, 1 }, { -1, 16, 1 }, { 1, 17, 1 }, { -1, 17, 1 },
+ { 1, 18, 1 }, { -1, 18, 1 }, { 1, 19, 1 }, { -1, 19, 1 }, { 3, 1, 3 }, { -3, 1, 3 },
+ { 1, 20, 1 }, { -1, 20, 1 }, { 1, 21, 1 }, { -1, 21, 1 }, { 2, 2, 2 }, { -2, 2, 2 },
+ { 1, 22, 1 }, { -1, 22, 1 }, { 1, 23, 1 }, { -1, 23, 1 }, { 1, 24, 1 }, { -1, 24, 1 },
+ { 1, 25, 1 }, { -1, 25, 1 }, { 1, 26, 1 }, { -1, 26, 1 }, { EOB }
+ },
+ //level_add
+ { 0, 4, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 },
+ 3, //golomb_order
+ 0, //inc_limit
+ 26 //max_run
+ },
+ {
+ { //level / run
+ { 1, 1, 0 }, { -1, 1, 0 }, { EOB }, { 1, 2, 0 }, { -1, 2, 0 }, { 1, 3, 0 },
+ { -1, 3, 0 }, { 1, 4, 0 }, { -1, 4, 0 }, { 1, 5, 0 }, { -1, 5, 0 }, { 1, 6, 0 },
+ { -1, 6, 0 }, { 2, 1, 1 }, { -2, 1, 1 }, { 1, 7, 0 }, { -1, 7, 0 }, { 1, 8, 0 },
+ { -1, 8, 0 }, { 1, 9, 0 }, { -1, 9, 0 }, { 1, 10, 0 }, { -1, 10, 0 }, { 2, 2, 1 },
+ { -2, 2, 1 }, { 1, 11, 0 }, { -1, 11, 0 }, { 1, 12, 0 }, { -1, 12, 0 }, { 3, 1, 2 },
+ { -3, 1, 2 }, { 1, 13, 0 }, { -1, 13, 0 }, { 1, 14, 0 }, { -1, 14, 0 }, { 2, 3, 1 },
+ { -2, 3, 1 }, { 1, 15, 0 }, { -1, 15, 0 }, { 2, 4, 1 }, { -2, 4, 1 }, { 1, 16, 0 },
+ { -1, 16, 0 }, { 2, 5, 1 }, { -2, 5, 1 }, { 1, 17, 0 }, { -1, 17, 0 }, { 4, 1, 3 },
+ { -4, 1, 3 }, { 2, 6, 1 }, { -2, 6, 1 }, { 1, 18, 0 }, { -1, 18, 0 }, { 1, 19, 0 },
+ { -1, 19, 0 }, { 2, 7, 1 }, { -2, 7, 1 }, { 3, 2, 2 }, { -3, 2, 2 }
+ },
+ //level_add
+ { 0, 5, 4, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, -1, -1, -1, -1, -1, -1, -1 },
+ 2, //golomb_order
+ 1, //inc_limit
+ 19 //max_run
+ },
+ {
+ { //level / run
+ { 1, 1, 0 }, { -1, 1, 0 }, { EOB }, { 1, 2, 0 }, { -1, 2, 0 }, { 2, 1, 0 },
+ { -2, 1, 0 }, { 1, 3, 0 }, { -1, 3, 0 }, { 1, 4, 0 }, { -1, 4, 0 }, { 3, 1, 1 },
+ { -3, 1, 1 }, { 2, 2, 0 }, { -2, 2, 0 }, { 1, 5, 0 }, { -1, 5, 0 }, { 1, 6, 0 },
+ { -1, 6, 0 }, { 1, 7, 0 }, { -1, 7, 0 }, { 2, 3, 0 }, { -2, 3, 0 }, { 4, 1, 2 },
+ { -4, 1, 2 }, { 1, 8, 0 }, { -1, 8, 0 }, { 3, 2, 1 }, { -3, 2, 1 }, { 2, 4, 0 },
+ { -2, 4, 0 }, { 1, 9, 0 }, { -1, 9, 0 }, { 1, 10, 0 }, { -1, 10, 0 }, { 5, 1, 2 },
+ { -5, 1, 2 }, { 2, 5, 0 }, { -2, 5, 0 }, { 1, 11, 0 }, { -1, 11, 0 }, { 2, 6, 0 },
+ { -2, 6, 0 }, { 1, 12, 0 }, { -1, 12, 0 }, { 3, 3, 1 }, { -3, 3, 1 }, { 6, 1, 2 },
+ { -6, 1, 2 }, { 4, 2, 2 }, { -4, 2, 2 }, { 1, 13, 0 }, { -1, 13, 0 }, { 2, 7, 0 },
+ { -2, 7, 0 }, { 3, 4, 1 }, { -3, 4, 1 }, { 1, 14, 0 }, { -1, 14, 0 }
+ },
+ //level_add
+ { 0, 7, 5, 4, 4, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
+ 2, //golomb_order
+ 2, //inc_limit
+ 14 //max_run
+ },
+ {
+ { //level / run
+ { 1, 1, 0 }, { -1, 1, 0 }, { EOB }, { 2, 1, 0 }, { -2, 1, 0 }, { 1, 2, 0 },
+ { -1, 2, 0 }, { 3, 1, 0 }, { -3, 1, 0 }, { 1, 3, 0 }, { -1, 3, 0 }, { 2, 2, 0 },
+ { -2, 2, 0 }, { 4, 1, 1 }, { -4, 1, 1 }, { 1, 4, 0 }, { -1, 4, 0 }, { 5, 1, 1 },
+ { -5, 1, 1 }, { 1, 5, 0 }, { -1, 5, 0 }, { 3, 2, 0 }, { -3, 2, 0 }, { 2, 3, 0 },
+ { -2, 3, 0 }, { 1, 6, 0 }, { -1, 6, 0 }, { 6, 1, 1 }, { -6, 1, 1 }, { 2, 4, 0 },
+ { -2, 4, 0 }, { 1, 7, 0 }, { -1, 7, 0 }, { 4, 2, 1 }, { -4, 2, 1 }, { 7, 1, 2 },
+ { -7, 1, 2 }, { 3, 3, 0 }, { -3, 3, 0 }, { 1, 8, 0 }, { -1, 8, 0 }, { 2, 5, 0 },
+ { -2, 5, 0 }, { 8, 1, 2 }, { -8, 1, 2 }, { 1, 9, 0 }, { -1, 9, 0 }, { 3, 4, 0 },
+ { -3, 4, 0 }, { 2, 6, 0 }, { -2, 6, 0 }, { 5, 2, 1 }, { -5, 2, 1 }, { 1, 10, 0 },
+ { -1, 10, 0 }, { 9, 1, 2 }, { -9, 1, 2 }, { 4, 3, 1 }, { -4, 3, 1 }
+ },
+ //level_add
+ { 0,10, 6, 5, 4, 3, 3, 2, 2, 2, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
+ 2, //golomb_order
+ 3, //inc_limit
+ 10 //max_run
+ },
+ {
+ { //level / run
+ { 1, 1, 0 }, { -1, 1, 0 }, { EOB }, { 2, 1, 0 }, { -2, 1, 0 }, { 3, 1, 0 },
+ { -3, 1, 0 }, { 1, 2, 0 }, { -1, 2, 0 }, { 4, 1, 0 }, { -4, 1, 0 }, { 5, 1, 0 },
+ { -5, 1, 0 }, { 2, 2, 0 }, { -2, 2, 0 }, { 1, 3, 0 }, { -1, 3, 0 }, { 6, 1, 0 },
+ { -6, 1, 0 }, { 3, 2, 0 }, { -3, 2, 0 }, { 7, 1, 1 }, { -7, 1, 1 }, { 1, 4, 0 },
+ { -1, 4, 0 }, { 8, 1, 1 }, { -8, 1, 1 }, { 2, 3, 0 }, { -2, 3, 0 }, { 4, 2, 0 },
+ { -4, 2, 0 }, { 1, 5, 0 }, { -1, 5, 0 }, { 9, 1, 1 }, { -9, 1, 1 }, { 5, 2, 0 },
+ { -5, 2, 0 }, { 2, 4, 0 }, { -2, 4, 0 }, { 1, 6, 0 }, { -1, 6, 0 }, { 10, 1, 2 },
+ {-10, 1, 2 }, { 3, 3, 0 }, { -3, 3, 0 }, { 11, 1, 2 }, {-11, 1, 2 }, { 1, 7, 0 },
+ { -1, 7, 0 }, { 6, 2, 0 }, { -6, 2, 0 }, { 3, 4, 0 }, { -3, 4, 0 }, { 2, 5, 0 },
+ { -2, 5, 0 }, { 12, 1, 2 }, {-12, 1, 2 }, { 4, 3, 0 }, { -4, 3, 0 }
+ },
+ //level_add
+ { 0, 13, 7, 5, 4, 3, 2, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
+ 2, //golomb_order
+ 6, //inc_limit
+ 7 //max_run
+ },
+ {
+ { //level / run
+ { EOB }, { 1, 1, 0 }, { -1, 1, 0 }, { 2, 1, 0 }, { -2, 1, 0 }, { 3, 1, 0 },
+ { -3, 1, 0 }, { 4, 1, 0 }, { -4, 1, 0 }, { 5, 1, 0 }, { -5, 1, 0 }, { 1, 2, 0 },
+ { -1, 2, 0 }, { 6, 1, 0 }, { -6, 1, 0 }, { 7, 1, 0 }, { -7, 1, 0 }, { 8, 1, 0 },
+ { -8, 1, 0 }, { 2, 2, 0 }, { -2, 2, 0 }, { 9, 1, 0 }, { -9, 1, 0 }, { 1, 3, 0 },
+ { -1, 3, 0 }, { 10, 1, 1 }, { -10, 1, 1 }, { 3, 2, 0 }, { -3, 2, 0 }, { 11, 1, 1 },
+ { -11, 1, 1 }, { 4, 2, 0 }, { -4, 2, 0 }, { 12, 1, 1 }, { -12, 1, 1 }, { 1, 4, 0 },
+ { -1, 4, 0 }, { 2, 3, 0 }, { -2, 3, 0 }, { 13, 1, 1 }, { -13, 1, 1 }, { 5, 2, 0 },
+ { -5, 2, 0 }, { 14, 1, 1 }, { -14, 1, 1 }, { 6, 2, 0 }, { -6, 2, 0 }, { 1, 5, 0 },
+ { -1, 5, 0 }, { 15, 1, 1 }, { -15, 1, 1 }, { 3, 3, 0 }, { -3, 3, 0 }, { 16, 1, 1 },
+ { -16, 1, 1 }, { 2, 4, 0 }, { -2, 4, 0 }, { 7, 2, 0 }, { -7, 2, 0 }
+ },
+ //level_add
+ { 0, 17, 8, 4, 3, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
+ 2, //golomb_order
+ 9, //inc_limit
+ 5 //max_run
+ },
+ {
+ { //level / run
+ { EOB }, { 1, 1, 0 }, { -1, 1, 0 }, { 2, 1, 0 }, { -2, 1, 0 }, { 3, 1, 0 },
+ { -3, 1, 0 }, { 4, 1, 0 }, { -4, 1, 0 }, { 5, 1, 0 }, { -5, 1, 0 }, { 6, 1, 0 },
+ { -6, 1, 0 }, { 7, 1, 0 }, { -7, 1, 0 }, { 1, 2, 0 }, { -1, 2, 0 }, { 8, 1, 0 },
+ { -8, 1, 0 }, { 9, 1, 0 }, { -9, 1, 0 }, { 10, 1, 0 }, { -10, 1, 0 }, { 11, 1, 0 },
+ { -11, 1, 0 }, { 12, 1, 0 }, { -12, 1, 0 }, { 2, 2, 0 }, { -2, 2, 0 }, { 13, 1, 0 },
+ { -13, 1, 0 }, { 1, 3, 0 }, { -1, 3, 0 }, { 14, 1, 0 }, { -14, 1, 0 }, { 15, 1, 0 },
+ { -15, 1, 0 }, { 3, 2, 0 }, { -3, 2, 0 }, { 16, 1, 0 }, { -16, 1, 0 }, { 17, 1, 0 },
+ { -17, 1, 0 }, { 18, 1, 0 }, { -18, 1, 0 }, { 4, 2, 0 }, { -4, 2, 0 }, { 19, 1, 0 },
+ { -19, 1, 0 }, { 20, 1, 0 }, { -20, 1, 0 }, { 2, 3, 0 }, { -2, 3, 0 }, { 1, 4, 0 },
+ { -1, 4, 0 }, { 5, 2, 0 }, { -5, 2, 0 }, { 21, 1, 0 }, { -21, 1, 0 }
+ },
+ //level_add
+ { 0, 22, 6, 3, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
+ 2, //golomb_order
+ INT_MAX, //inc_limit
+ 4 //max_run
+ }
+};
+
+static const struct dec_2dvlc chroma_dec[5] = {
+ {
+ { //level / run
+ { 1, 1, 1 }, { -1, 1, 1 }, { 1, 2, 1 }, { -1, 2, 1 }, { 1, 3, 1 }, { -1, 3, 1 },
+ { 1, 4, 1 }, { -1, 4, 1 }, { 1, 5, 1 }, { -1, 5, 1 }, { 1, 6, 1 }, { -1, 6, 1 },
+ { 1, 7, 1 }, { -1, 7, 1 }, { 2, 1, 2 }, { -2, 1, 2 }, { 1, 8, 1 }, { -1, 8, 1 },
+ { 1, 9, 1 }, { -1, 9, 1 }, { 1, 10, 1 }, { -1, 10, 1 }, { 1, 11, 1 }, { -1, 11, 1 },
+ { 1, 12, 1 }, { -1, 12, 1 }, { 1, 13, 1 }, { -1, 13, 1 }, { 1, 14, 1 }, { -1, 14, 1 },
+ { 1, 15, 1 }, { -1, 15, 1 }, { 3, 1, 3 }, { -3, 1, 3 }, { 1, 16, 1 }, { -1, 16, 1 },
+ { 1, 17, 1 }, { -1, 17, 1 }, { 1, 18, 1 }, { -1, 18, 1 }, { 1, 19, 1 }, { -1, 19, 1 },
+ { 1, 20, 1 }, { -1, 20, 1 }, { 1, 21, 1 }, { -1, 21, 1 }, { 1, 22, 1 }, { -1, 22, 1 },
+ { 2, 2, 2 }, { -2, 2, 2 }, { 1, 23, 1 }, { -1, 23, 1 }, { 1, 24, 1 }, { -1, 24, 1 },
+ { 1, 25, 1 }, { -1, 25, 1 }, { 4, 1, 3 }, { -4, 1, 3 }, { EOB }
+ },
+ //level_add
+ { 0, 5, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, -1 },
+ 2, //golomb_order
+ 0, //inc_limit
+ 25 //max_run
+ },
+ {
+ { //level / run
+ { EOB }, { 1, 1, 0 }, { -1, 1, 0 }, { 1, 2, 0 }, { -1, 2, 0 }, { 2, 1, 1 },
+ { -2, 1, 1 }, { 1, 3, 0 }, { -1, 3, 0 }, { 1, 4, 0 }, { -1, 4, 0 }, { 1, 5, 0 },
+ { -1, 5, 0 }, { 1, 6, 0 }, { -1, 6, 0 }, { 3, 1, 2 }, { -3, 1, 2 }, { 1, 7, 0 },
+ { -1, 7, 0 }, { 1, 8, 0 }, { -1, 8, 0 }, { 2, 2, 1 }, { -2, 2, 1 }, { 1, 9, 0 },
+ { -1, 9, 0 }, { 1, 10, 0 }, { -1, 10, 0 }, { 1, 11, 0 }, { -1, 11, 0 }, { 4, 1, 2 },
+ { -4, 1, 2 }, { 1, 12, 0 }, { -1, 12, 0 }, { 1, 13, 0 }, { -1, 13, 0 }, { 1, 14, 0 },
+ { -1, 14, 0 }, { 2, 3, 1 }, { -2, 3, 1 }, { 1, 15, 0 }, { -1, 15, 0 }, { 2, 4, 1 },
+ { -2, 4, 1 }, { 5, 1, 3 }, { -5, 1, 3 }, { 3, 2, 2 }, { -3, 2, 2 }, { 1, 16, 0 },
+ { -1, 16, 0 }, { 1, 17, 0 }, { -1, 17, 0 }, { 1, 18, 0 }, { -1, 18, 0 }, { 2, 5, 1 },
+ { -2, 5, 1 }, { 1, 19, 0 }, { -1, 19, 0 }, { 1, 20, 0 }, { -1, 20, 0 }
+ },
+ //level_add
+ { 0, 6, 4, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, -1, -1, -1, -1, -1, -1 },
+ 0, //golomb_order
+ 1, //inc_limit
+ 20 //max_run
+ },
+ {
+ { //level / run
+ { 1, 1, 0 }, { -1, 1, 0 }, { EOB }, { 2, 1, 0 }, { -2, 1, 0 }, { 1, 2, 0 },
+ { -1, 2, 0 }, { 3, 1, 1 }, { -3, 1, 1 }, { 1, 3, 0 }, { -1, 3, 0 }, { 4, 1, 1 },
+ { -4, 1, 1 }, { 2, 2, 0 }, { -2, 2, 0 }, { 1, 4, 0 }, { -1, 4, 0 }, { 5, 1, 2 },
+ { -5, 1, 2 }, { 1, 5, 0 }, { -1, 5, 0 }, { 3, 2, 1 }, { -3, 2, 1 }, { 2, 3, 0 },
+ { -2, 3, 0 }, { 1, 6, 0 }, { -1, 6, 0 }, { 6, 1, 2 }, { -6, 1, 2 }, { 1, 7, 0 },
+ { -1, 7, 0 }, { 2, 4, 0 }, { -2, 4, 0 }, { 7, 1, 2 }, { -7, 1, 2 }, { 1, 8, 0 },
+ { -1, 8, 0 }, { 4, 2, 1 }, { -4, 2, 1 }, { 1, 9, 0 }, { -1, 9, 0 }, { 3, 3, 1 },
+ { -3, 3, 1 }, { 2, 5, 0 }, { -2, 5, 0 }, { 2, 6, 0 }, { -2, 6, 0 }, { 8, 1, 2 },
+ { -8, 1, 2 }, { 1, 10, 0 }, { -1, 10, 0 }, { 1, 11, 0 }, { -1, 11, 0 }, { 9, 1, 2 },
+ { -9, 1, 2 }, { 5, 2, 2 }, { -5, 2, 2 }, { 3, 4, 1 }, { -3, 4, 1 },
+ },
+ //level_add
+ { 0,10, 6, 4, 4, 3, 3, 2, 2, 2, 2, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
+ 1, //golomb_order
+ 2, //inc_limit
+ 11 //max_run
+ },
+ {
+ { //level / run
+ { EOB }, { 1, 1, 0 }, { -1, 1, 0 }, { 2, 1, 0 }, { -2, 1, 0 }, { 3, 1, 0 },
+ { -3, 1, 0 }, { 4, 1, 0 }, { -4, 1, 0 }, { 1, 2, 0 }, { -1, 2, 0 }, { 5, 1, 1 },
+ { -5, 1, 1 }, { 2, 2, 0 }, { -2, 2, 0 }, { 6, 1, 1 }, { -6, 1, 1 }, { 1, 3, 0 },
+ { -1, 3, 0 }, { 7, 1, 1 }, { -7, 1, 1 }, { 3, 2, 0 }, { -3, 2, 0 }, { 8, 1, 1 },
+ { -8, 1, 1 }, { 1, 4, 0 }, { -1, 4, 0 }, { 2, 3, 0 }, { -2, 3, 0 }, { 9, 1, 1 },
+ { -9, 1, 1 }, { 4, 2, 0 }, { -4, 2, 0 }, { 1, 5, 0 }, { -1, 5, 0 }, { 10, 1, 1 },
+ {-10, 1, 1 }, { 3, 3, 0 }, { -3, 3, 0 }, { 5, 2, 1 }, { -5, 2, 1 }, { 2, 4, 0 },
+ { -2, 4, 0 }, { 11, 1, 1 }, {-11, 1, 1 }, { 1, 6, 0 }, { -1, 6, 0 }, { 12, 1, 1 },
+ {-12, 1, 1 }, { 1, 7, 0 }, { -1, 7, 0 }, { 6, 2, 1 }, { -6, 2, 1 }, { 13, 1, 1 },
+ {-13, 1, 1 }, { 2, 5, 0 }, { -2, 5, 0 }, { 1, 8, 0 }, { -1, 8, 0 },
+ },
+ //level_add
+ { 0, 14, 7, 4, 3, 3, 2, 2, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
+ 1, //golomb_order
+ 4, //inc_limit
+ 8 //max_run
+ },
+ {
+ { //level / run
+ { EOB }, { 1, 1, 0 }, { -1, 1, 0 }, { 2, 1, 0 }, { -2, 1, 0 }, { 3, 1, 0 },
+ { -3, 1, 0 }, { 4, 1, 0 }, { -4, 1, 0 }, { 5, 1, 0 }, { -5, 1, 0 }, { 6, 1, 0 },
+ { -6, 1, 0 }, { 7, 1, 0 }, { -7, 1, 0 }, { 8, 1, 0 }, { -8, 1, 0 }, { 1, 2, 0 },
+ { -1, 2, 0 }, { 9, 1, 0 }, { -9, 1, 0 }, { 10, 1, 0 }, { -10, 1, 0 }, { 11, 1, 0 },
+ { -11, 1, 0 }, { 2, 2, 0 }, { -2, 2, 0 }, { 12, 1, 0 }, { -12, 1, 0 }, { 13, 1, 0 },
+ { -13, 1, 0 }, { 3, 2, 0 }, { -3, 2, 0 }, { 14, 1, 0 }, { -14, 1, 0 }, { 1, 3, 0 },
+ { -1, 3, 0 }, { 15, 1, 0 }, { -15, 1, 0 }, { 4, 2, 0 }, { -4, 2, 0 }, { 16, 1, 0 },
+ { -16, 1, 0 }, { 17, 1, 0 }, { -17, 1, 0 }, { 5, 2, 0 }, { -5, 2, 0 }, { 1, 4, 0 },
+ { -1, 4, 0 }, { 2, 3, 0 }, { -2, 3, 0 }, { 18, 1, 0 }, { -18, 1, 0 }, { 6, 2, 0 },
+ { -6, 2, 0 }, { 19, 1, 0 }, { -19, 1, 0 }, { 1, 5, 0 }, { -1, 5, 0 },
+ },
+ //level_add
+ { 0, 20, 7, 3, 2, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
+ 0, //golomb_order
+ INT_MAX, //inc_limit
+ 5, //max_run
+ }
+};
+
+#undef EOB
+
/*****************************************************************************
*
* motion vector prediction
*
****************************************************************************/
-static inline void store_mvs(AVSContext *h) {
- h->col_mv[h->mbidx*4 + 0] = h->mv[MV_FWD_X0];
- h->col_mv[h->mbidx*4 + 1] = h->mv[MV_FWD_X1];
- h->col_mv[h->mbidx*4 + 2] = h->mv[MV_FWD_X2];
- h->col_mv[h->mbidx*4 + 3] = h->mv[MV_FWD_X3];
+static inline void store_mvs(AVSContext *h)
+{
+ h->col_mv[h->mbidx * 4 + 0] = h->mv[MV_FWD_X0];
+ h->col_mv[h->mbidx * 4 + 1] = h->mv[MV_FWD_X1];
+ h->col_mv[h->mbidx * 4 + 2] = h->mv[MV_FWD_X2];
+ h->col_mv[h->mbidx * 4 + 3] = h->mv[MV_FWD_X3];
}
static inline void mv_pred_direct(AVSContext *h, cavs_vector *pmv_fw,
- cavs_vector *col_mv) {
+ cavs_vector *col_mv)
+{
cavs_vector *pmv_bw = pmv_fw + MV_BWD_OFFS;
int den = h->direct_den[col_mv->ref];
int m = col_mv->x >> 31;
@@ -70,14 +480,16 @@ static inline void mv_pred_direct(AVSContext *h, cavs_vector *pmv_fw,
pmv_fw->ref = 1;
pmv_bw->ref = 0;
/* scale the co-located motion vector according to its temporal span */
- pmv_fw->x = (((den+(den*col_mv->x*pmv_fw->dist^m)-m-1)>>14)^m)-m;
- pmv_bw->x = m-(((den+(den*col_mv->x*pmv_bw->dist^m)-m-1)>>14)^m);
+ pmv_fw->x = (((den + (den * col_mv->x * pmv_fw->dist ^ m) - m - 1) >> 14) ^ m) - m;
+ pmv_bw->x = m - (((den + (den * col_mv->x * pmv_bw->dist ^ m) - m - 1) >> 14) ^ m);
m = col_mv->y >> 31;
- pmv_fw->y = (((den+(den*col_mv->y*pmv_fw->dist^m)-m-1)>>14)^m)-m;
- pmv_bw->y = m-(((den+(den*col_mv->y*pmv_bw->dist^m)-m-1)>>14)^m);
+ pmv_fw->y = (((den + (den * col_mv->y * pmv_fw->dist ^ m) - m - 1) >> 14) ^ m) - m;
+ pmv_bw->y = m - (((den + (den * col_mv->y * pmv_bw->dist ^ m) - m - 1) >> 14) ^ m);
}
-static inline void mv_pred_sym(AVSContext *h, cavs_vector *src, enum cavs_block size) {
+static inline void mv_pred_sym(AVSContext *h, cavs_vector *src,
+ enum cavs_block size)
+{
cavs_vector *dst = src + MV_BWD_OFFS;
/* backward mv is the scaled and negated forward mv */
@@ -95,14 +507,36 @@ static inline void mv_pred_sym(AVSContext *h, cavs_vector *src, enum cavs_block
****************************************************************************/
/** kth-order exponential golomb code */
-static inline int get_ue_code(GetBitContext *gb, int order) {
- if(order) {
+static inline int get_ue_code(GetBitContext *gb, int order)
+{
+ if (order) {
int ret = get_ue_golomb(gb) << order;
- return ret + get_bits(gb,order);
+ return ret + get_bits(gb, order);
}
return get_ue_golomb(gb);
}
+static inline int dequant(AVSContext *h, DCTELEM *level_buf, uint8_t *run_buf,
+ DCTELEM *dst, int mul, int shift, int coeff_num)
+{
+ int round = 1 << (shift - 1);
+ int pos = -1;
+ const uint8_t *scantab = h->scantable.permutated;
+
+ /* inverse scan and dequantization */
+ while (--coeff_num >= 0) {
+ pos += run_buf[coeff_num];
+ if (pos > 63) {
+ av_log(h->avctx, AV_LOG_ERROR,
+ "position out of block bounds at pic %d MB(%d,%d)\n",
+ h->cur.poc, h->mbx, h->mby);
+ return -1;
+ }
+ dst[scantab[pos]] = (level_buf[coeff_num] * mul + round) >> shift;
+ }
+ return 0;
+}
+
/**
* decode coefficients from one 8x8 block, dequantize, inverse transform
* and add them to sample block
@@ -114,69 +548,72 @@ static inline int get_ue_code(GetBitContext *gb, int order) {
*/
static int decode_residual_block(AVSContext *h, GetBitContext *gb,
const struct dec_2dvlc *r, int esc_golomb_order,
- int qp, uint8_t *dst, int stride) {
+ int qp, uint8_t *dst, int stride)
+{
int i, level_code, esc_code, level, run, mask;
DCTELEM level_buf[65];
uint8_t run_buf[65];
DCTELEM *block = h->block;
- for(i=0;i<65;i++) {
- level_code = get_ue_code(gb,r->golomb_order);
- if(level_code >= ESCAPE_CODE) {
- run = ((level_code - ESCAPE_CODE) >> 1) + 1;
- esc_code = get_ue_code(gb,esc_golomb_order);
- level = esc_code + (run > r->max_run ? 1 : r->level_add[run]);
- while(level > r->inc_limit)
+ for (i = 0;i < 65; i++) {
+ level_code = get_ue_code(gb, r->golomb_order);
+ if (level_code >= ESCAPE_CODE) {
+ run = ((level_code - ESCAPE_CODE) >> 1) + 1;
+ esc_code = get_ue_code(gb, esc_golomb_order);
+ level = esc_code + (run > r->max_run ? 1 : r->level_add[run]);
+ while (level > r->inc_limit)
r++;
- mask = -(level_code & 1);
- level = (level^mask) - mask;
+ mask = -(level_code & 1);
+ level = (level ^ mask) - mask;
} else if (level_code >= 0) {
level = r->rltab[level_code][0];
- if(!level) //end of block signal
+ if (!level) //end of block signal
break;
- run = r->rltab[level_code][1];
- r += r->rltab[level_code][2];
+ run = r->rltab[level_code][1];
+ r += r->rltab[level_code][2];
} else {
break;
}
level_buf[i] = level;
- run_buf[i] = run;
+ run_buf[i] = run;
}
- if(dequant(h,level_buf, run_buf, block, ff_cavs_dequant_mul[qp],
- ff_cavs_dequant_shift[qp], i))
+ if (dequant(h, level_buf, run_buf, block, dequant_mul[qp],
+ dequant_shift[qp], i))
return -1;
- h->cdsp.cavs_idct8_add(dst,block,stride);
- h->s.dsp.clear_block(block);
+ h->cdsp.cavs_idct8_add(dst, block, stride);
+ h->dsp.clear_block(block);
return 0;
}
-static inline void decode_residual_chroma(AVSContext *h) {
- if(h->cbp & (1<<4))
- decode_residual_block(h,&h->s.gb,ff_cavs_chroma_dec,0,
- ff_cavs_chroma_qp[h->qp],h->cu,h->c_stride);
- if(h->cbp & (1<<5))
- decode_residual_block(h,&h->s.gb,ff_cavs_chroma_dec,0,
- ff_cavs_chroma_qp[h->qp],h->cv,h->c_stride);
+static inline void decode_residual_chroma(AVSContext *h)
+{
+ if (h->cbp & (1 << 4))
+ decode_residual_block(h, &h->gb, chroma_dec, 0,
+ cavs_chroma_qp[h->qp], h->cu, h->c_stride);
+ if (h->cbp & (1 << 5))
+ decode_residual_block(h, &h->gb, chroma_dec, 0,
+ cavs_chroma_qp[h->qp], h->cv, h->c_stride);
}
-static inline int decode_residual_inter(AVSContext *h) {
+static inline int decode_residual_inter(AVSContext *h)
+{
int block;
/* get coded block pattern */
- int cbp= get_ue_golomb(&h->s.gb);
- if(cbp > 63){
- av_log(h->s.avctx, AV_LOG_ERROR, "illegal inter cbp\n");
+ int cbp = get_ue_golomb(&h->gb);
+ if (cbp > 63) {
+ av_log(h->avctx, AV_LOG_ERROR, "illegal inter cbp\n");
return -1;
}
h->cbp = cbp_tab[cbp][1];
/* get quantizer */
- if(h->cbp && !h->qp_fixed)
- h->qp = (h->qp + get_se_golomb(&h->s.gb)) & 63;
- for(block=0;block<4;block++)
- if(h->cbp & (1<<block))
- decode_residual_block(h,&h->s.gb,ff_cavs_inter_dec,0,h->qp,
+ if (h->cbp && !h->qp_fixed)
+ h->qp = (h->qp + get_se_golomb(&h->gb)) & 63;
+ for (block = 0; block < 4; block++)
+ if (h->cbp & (1 << block))
+ decode_residual_block(h, &h->gb, inter_dec, 0, h->qp,
h->cy + h->luma_scan[block], h->l_stride);
decode_residual_chroma(h);
@@ -189,8 +626,19 @@ static inline int decode_residual_inter(AVSContext *h) {
*
****************************************************************************/
-static int decode_mb_i(AVSContext *h, int cbp_code) {
- GetBitContext *gb = &h->s.gb;
+static inline void set_mv_intra(AVSContext *h)
+{
+ h->mv[MV_FWD_X0] = ff_cavs_intra_mv;
+ set_mvs(&h->mv[MV_FWD_X0], BLK_16X16);
+ h->mv[MV_BWD_X0] = ff_cavs_intra_mv;
+ set_mvs(&h->mv[MV_BWD_X0], BLK_16X16);
+ if (h->cur.f->pict_type != AV_PICTURE_TYPE_B)
+ h->col_type_base[h->mbidx] = I_8X8;
+}
+
+static int decode_mb_i(AVSContext *h, int cbp_code)
+{
+ GetBitContext *gb = &h->gb;
unsigned pred_mode_uv;
int block;
uint8_t top[18];
@@ -200,74 +648,86 @@ static int decode_mb_i(AVSContext *h, int cbp_code) {
ff_cavs_init_mb(h);
/* get intra prediction modes from stream */
- for(block=0;block<4;block++) {
- int nA,nB,predpred;
- int pos = ff_cavs_scan3x3[block];
-
- nA = h->pred_mode_Y[pos-1];
- nB = h->pred_mode_Y[pos-3];
- predpred = FFMIN(nA,nB);
- if(predpred == NOT_AVAIL) // if either is not available
+ for (block = 0; block < 4; block++) {
+ int nA, nB, predpred;
+ int pos = scan3x3[block];
+
+ nA = h->pred_mode_Y[pos - 1];
+ nB = h->pred_mode_Y[pos - 3];
+ predpred = FFMIN(nA, nB);
+ if (predpred == NOT_AVAIL) // if either is not available
predpred = INTRA_L_LP;
- if(!get_bits1(gb)){
- int rem_mode= get_bits(gb, 2);
- predpred = rem_mode + (rem_mode >= predpred);
+ if (!get_bits1(gb)) {
+ int rem_mode = get_bits(gb, 2);
+ predpred = rem_mode + (rem_mode >= predpred);
}
h->pred_mode_Y[pos] = predpred;
}
pred_mode_uv = get_ue_golomb(gb);
- if(pred_mode_uv > 6) {
- av_log(h->s.avctx, AV_LOG_ERROR, "illegal intra chroma pred mode\n");
+ if (pred_mode_uv > 6) {
+ av_log(h->avctx, AV_LOG_ERROR, "illegal intra chroma pred mode\n");
return -1;
}
ff_cavs_modify_mb_i(h, &pred_mode_uv);
/* get coded block pattern */
- if(h->pic_type == AV_PICTURE_TYPE_I)
+ if (h->cur.f->pict_type == AV_PICTURE_TYPE_I)
cbp_code = get_ue_golomb(gb);
- if(cbp_code > 63){
- av_log(h->s.avctx, AV_LOG_ERROR, "illegal intra cbp\n");
+ if (cbp_code > 63) {
+ av_log(h->avctx, AV_LOG_ERROR, "illegal intra cbp\n");
return -1;
}
h->cbp = cbp_tab[cbp_code][0];
- if(h->cbp && !h->qp_fixed)
+ if (h->cbp && !h->qp_fixed)
h->qp = (h->qp + get_se_golomb(gb)) & 63; //qp_delta
/* luma intra prediction interleaved with residual decode/transform/add */
- for(block=0;block<4;block++) {
+ for (block = 0; block < 4; block++) {
d = h->cy + h->luma_scan[block];
ff_cavs_load_intra_pred_luma(h, top, &left, block);
- h->intra_pred_l[h->pred_mode_Y[ff_cavs_scan3x3[block]]]
+ h->intra_pred_l[h->pred_mode_Y[scan3x3[block]]]
(d, top, left, h->l_stride);
- if(h->cbp & (1<<block))
- decode_residual_block(h,gb,ff_cavs_intra_dec,1,h->qp,d,h->l_stride);
+ if (h->cbp & (1<<block))
+ decode_residual_block(h, gb, intra_dec, 1, h->qp, d, h->l_stride);
}
/* chroma intra prediction */
ff_cavs_load_intra_pred_chroma(h);
- h->intra_pred_c[pred_mode_uv](h->cu, &h->top_border_u[h->mbx*10],
+ h->intra_pred_c[pred_mode_uv](h->cu, &h->top_border_u[h->mbx * 10],
h->left_border_u, h->c_stride);
- h->intra_pred_c[pred_mode_uv](h->cv, &h->top_border_v[h->mbx*10],
+ h->intra_pred_c[pred_mode_uv](h->cv, &h->top_border_v[h->mbx * 10],
h->left_border_v, h->c_stride);
decode_residual_chroma(h);
- ff_cavs_filter(h,I_8X8);
+ ff_cavs_filter(h, I_8X8);
set_mv_intra(h);
return 0;
}
-static void decode_mb_p(AVSContext *h, enum cavs_mb mb_type) {
- GetBitContext *gb = &h->s.gb;
+static inline void set_intra_mode_default(AVSContext *h)
+{
+ if (h->stream_revision > 0) {
+ h->pred_mode_Y[3] = h->pred_mode_Y[6] = NOT_AVAIL;
+ h->top_pred_Y[h->mbx * 2 + 0] = h->top_pred_Y[h->mbx * 2 + 1] = NOT_AVAIL;
+ } else {
+ h->pred_mode_Y[3] = h->pred_mode_Y[6] = INTRA_L_LP;
+ h->top_pred_Y[h->mbx * 2 + 0] = h->top_pred_Y[h->mbx * 2 + 1] = INTRA_L_LP;
+ }
+}
+
+static void decode_mb_p(AVSContext *h, enum cavs_mb mb_type)
+{
+ GetBitContext *gb = &h->gb;
int ref[4];
ff_cavs_init_mb(h);
- switch(mb_type) {
+ switch (mb_type) {
case P_SKIP:
ff_cavs_mv(h, MV_FWD_X0, MV_FWD_C2, MV_PRED_PSKIP, BLK_16X16, 0);
break;
case P_16X16:
ref[0] = h->ref_flag ? 0 : get_bits1(gb);
- ff_cavs_mv(h, MV_FWD_X0, MV_FWD_C2, MV_PRED_MEDIAN, BLK_16X16,ref[0]);
+ ff_cavs_mv(h, MV_FWD_X0, MV_FWD_C2, MV_PRED_MEDIAN, BLK_16X16, ref[0]);
break;
case P_16X8:
ref[0] = h->ref_flag ? 0 : get_bits1(gb);
@@ -278,8 +738,8 @@ static void decode_mb_p(AVSContext *h, enum cavs_mb mb_type) {
case P_8X16:
ref[0] = h->ref_flag ? 0 : get_bits1(gb);
ref[1] = h->ref_flag ? 0 : get_bits1(gb);
- ff_cavs_mv(h, MV_FWD_X0, MV_FWD_B3, MV_PRED_LEFT, BLK_8X16, ref[0]);
- ff_cavs_mv(h, MV_FWD_X1, MV_FWD_C2, MV_PRED_TOPRIGHT,BLK_8X16, ref[1]);
+ ff_cavs_mv(h, MV_FWD_X0, MV_FWD_B3, MV_PRED_LEFT, BLK_8X16, ref[0]);
+ ff_cavs_mv(h, MV_FWD_X1, MV_FWD_C2, MV_PRED_TOPRIGHT, BLK_8X16, ref[1]);
break;
case P_8X8:
ref[0] = h->ref_flag ? 0 : get_bits1(gb);
@@ -294,13 +754,14 @@ static void decode_mb_p(AVSContext *h, enum cavs_mb mb_type) {
ff_cavs_inter(h, mb_type);
set_intra_mode_default(h);
store_mvs(h);
- if(mb_type != P_SKIP)
+ if (mb_type != P_SKIP)
decode_residual_inter(h);
- ff_cavs_filter(h,mb_type);
+ ff_cavs_filter(h, mb_type);
h->col_type_base[h->mbidx] = mb_type;
}
-static void decode_mb_b(AVSContext *h, enum cavs_mb mb_type) {
+static void decode_mb_b(AVSContext *h, enum cavs_mb mb_type)
+{
int block;
enum cavs_sub_mb sub_type[4];
int flags;
@@ -312,18 +773,18 @@ static void decode_mb_b(AVSContext *h, enum cavs_mb mb_type) {
set_mvs(&h->mv[MV_FWD_X0], BLK_16X16);
h->mv[MV_BWD_X0] = ff_cavs_dir_mv;
set_mvs(&h->mv[MV_BWD_X0], BLK_16X16);
- switch(mb_type) {
+ switch (mb_type) {
case B_SKIP:
case B_DIRECT:
- if(!h->col_type_base[h->mbidx]) {
+ if (!h->col_type_base[h->mbidx]) {
/* intra MB at co-location, do in-plane prediction */
ff_cavs_mv(h, MV_FWD_X0, MV_FWD_C2, MV_PRED_BSKIP, BLK_16X16, 1);
ff_cavs_mv(h, MV_BWD_X0, MV_BWD_C2, MV_PRED_BSKIP, BLK_16X16, 0);
} else
/* direct prediction from co-located P MB, block-wise */
- for(block=0;block<4;block++)
- mv_pred_direct(h,&h->mv[mv_scan[block]],
- &h->col_mv[h->mbidx*4 + block]);
+ for (block = 0; block < 4; block++)
+ mv_pred_direct(h, &h->mv[mv_scan[block]],
+ &h->col_mv[h->mbidx * 4 + block]);
break;
case B_FWD_16X16:
ff_cavs_mv(h, MV_FWD_X0, MV_FWD_C2, MV_PRED_MEDIAN, BLK_16X16, 1);
@@ -336,76 +797,76 @@ static void decode_mb_b(AVSContext *h, enum cavs_mb mb_type) {
ff_cavs_mv(h, MV_BWD_X0, MV_BWD_C2, MV_PRED_MEDIAN, BLK_16X16, 0);
break;
case B_8X8:
- for(block=0;block<4;block++)
- sub_type[block] = get_bits(&h->s.gb,2);
- for(block=0;block<4;block++) {
- switch(sub_type[block]) {
+ for (block = 0; block < 4; block++)
+ sub_type[block] = get_bits(&h->gb, 2);
+ for (block = 0; block < 4; block++) {
+ switch (sub_type[block]) {
case B_SUB_DIRECT:
- if(!h->col_type_base[h->mbidx]) {
+ if (!h->col_type_base[h->mbidx]) {
/* intra MB at co-location, do in-plane prediction */
- ff_cavs_mv(h, mv_scan[block], mv_scan[block]-3,
- MV_PRED_BSKIP, BLK_8X8, 1);
- ff_cavs_mv(h, mv_scan[block]+MV_BWD_OFFS,
- mv_scan[block]-3+MV_BWD_OFFS,
- MV_PRED_BSKIP, BLK_8X8, 0);
+ ff_cavs_mv(h, mv_scan[block], mv_scan[block] - 3,
+ MV_PRED_BSKIP, BLK_8X8, 1);
+ ff_cavs_mv(h, mv_scan[block] + MV_BWD_OFFS,
+ mv_scan[block] - 3 + MV_BWD_OFFS,
+ MV_PRED_BSKIP, BLK_8X8, 0);
} else
- mv_pred_direct(h,&h->mv[mv_scan[block]],
- &h->col_mv[h->mbidx*4 + block]);
+ mv_pred_direct(h, &h->mv[mv_scan[block]],
+ &h->col_mv[h->mbidx * 4 + block]);
break;
case B_SUB_FWD:
- ff_cavs_mv(h, mv_scan[block], mv_scan[block]-3,
- MV_PRED_MEDIAN, BLK_8X8, 1);
+ ff_cavs_mv(h, mv_scan[block], mv_scan[block] - 3,
+ MV_PRED_MEDIAN, BLK_8X8, 1);
break;
case B_SUB_SYM:
- ff_cavs_mv(h, mv_scan[block], mv_scan[block]-3,
- MV_PRED_MEDIAN, BLK_8X8, 1);
+ ff_cavs_mv(h, mv_scan[block], mv_scan[block] - 3,
+ MV_PRED_MEDIAN, BLK_8X8, 1);
mv_pred_sym(h, &h->mv[mv_scan[block]], BLK_8X8);
break;
}
}
- for(block=0;block<4;block++) {
- if(sub_type[block] == B_SUB_BWD)
- ff_cavs_mv(h, mv_scan[block]+MV_BWD_OFFS,
- mv_scan[block]+MV_BWD_OFFS-3,
- MV_PRED_MEDIAN, BLK_8X8, 0);
+ for (block = 0; block < 4; block++) {
+ if (sub_type[block] == B_SUB_BWD)
+ ff_cavs_mv(h, mv_scan[block] + MV_BWD_OFFS,
+ mv_scan[block] + MV_BWD_OFFS - 3,
+ MV_PRED_MEDIAN, BLK_8X8, 0);
}
break;
default:
assert((mb_type > B_SYM_16X16) && (mb_type < B_8X8));
flags = ff_cavs_partition_flags[mb_type];
- if(mb_type & 1) { /* 16x8 macroblock types */
- if(flags & FWD0)
+ if (mb_type & 1) { /* 16x8 macroblock types */
+ if (flags & FWD0)
ff_cavs_mv(h, MV_FWD_X0, MV_FWD_C2, MV_PRED_TOP, BLK_16X8, 1);
- if(flags & SYM0)
+ if (flags & SYM0)
mv_pred_sym(h, &h->mv[MV_FWD_X0], BLK_16X8);
- if(flags & FWD1)
+ if (flags & FWD1)
ff_cavs_mv(h, MV_FWD_X2, MV_FWD_A1, MV_PRED_LEFT, BLK_16X8, 1);
- if(flags & SYM1)
+ if (flags & SYM1)
mv_pred_sym(h, &h->mv[MV_FWD_X2], BLK_16X8);
- if(flags & BWD0)
+ if (flags & BWD0)
ff_cavs_mv(h, MV_BWD_X0, MV_BWD_C2, MV_PRED_TOP, BLK_16X8, 0);
- if(flags & BWD1)
+ if (flags & BWD1)
ff_cavs_mv(h, MV_BWD_X2, MV_BWD_A1, MV_PRED_LEFT, BLK_16X8, 0);
} else { /* 8x16 macroblock types */
- if(flags & FWD0)
+ if (flags & FWD0)
ff_cavs_mv(h, MV_FWD_X0, MV_FWD_B3, MV_PRED_LEFT, BLK_8X16, 1);
- if(flags & SYM0)
+ if (flags & SYM0)
mv_pred_sym(h, &h->mv[MV_FWD_X0], BLK_8X16);
- if(flags & FWD1)
- ff_cavs_mv(h,MV_FWD_X1,MV_FWD_C2,MV_PRED_TOPRIGHT,BLK_8X16,1);
- if(flags & SYM1)
+ if (flags & FWD1)
+ ff_cavs_mv(h, MV_FWD_X1, MV_FWD_C2, MV_PRED_TOPRIGHT, BLK_8X16, 1);
+ if (flags & SYM1)
mv_pred_sym(h, &h->mv[MV_FWD_X1], BLK_8X16);
- if(flags & BWD0)
+ if (flags & BWD0)
ff_cavs_mv(h, MV_BWD_X0, MV_BWD_B3, MV_PRED_LEFT, BLK_8X16, 0);
- if(flags & BWD1)
- ff_cavs_mv(h,MV_BWD_X1,MV_BWD_C2,MV_PRED_TOPRIGHT,BLK_8X16,0);
+ if (flags & BWD1)
+ ff_cavs_mv(h, MV_BWD_X1, MV_BWD_C2, MV_PRED_TOPRIGHT, BLK_8X16, 0);
}
}
ff_cavs_inter(h, mb_type);
set_intra_mode_default(h);
- if(mb_type != B_SKIP)
+ if (mb_type != B_SKIP)
decode_residual_inter(h);
- ff_cavs_filter(h,mb_type);
+ ff_cavs_filter(h, mb_type);
}
/*****************************************************************************
@@ -414,43 +875,46 @@ static void decode_mb_b(AVSContext *h, enum cavs_mb mb_type) {
*
****************************************************************************/
-static inline int decode_slice_header(AVSContext *h, GetBitContext *gb) {
- if(h->stc > 0xAF)
- av_log(h->s.avctx, AV_LOG_ERROR, "unexpected start code 0x%02x\n", h->stc);
- h->mby = h->stc;
- h->mbidx = h->mby*h->mb_width;
+static inline int decode_slice_header(AVSContext *h, GetBitContext *gb)
+{
+ if (h->stc > 0xAF)
+ av_log(h->avctx, AV_LOG_ERROR, "unexpected start code 0x%02x\n", h->stc);
+ h->mby = h->stc;
+ h->mbidx = h->mby * h->mb_width;
/* mark top macroblocks as unavailable */
- h->flags &= ~(B_AVAIL|C_AVAIL);
- if((h->mby == 0) && (!h->qp_fixed)){
+ h->flags &= ~(B_AVAIL | C_AVAIL);
+ if ((h->mby == 0) && (!h->qp_fixed)) {
h->qp_fixed = get_bits1(gb);
- h->qp = get_bits(gb,6);
+ h->qp = get_bits(gb, 6);
}
/* inter frame or second slice can have weighting params */
- if((h->pic_type != AV_PICTURE_TYPE_I) || (!h->pic_structure && h->mby >= h->mb_width/2))
- if(get_bits1(gb)) { //slice_weighting_flag
- av_log(h->s.avctx, AV_LOG_ERROR,
+ if ((h->cur.f->pict_type != AV_PICTURE_TYPE_I) ||
+ (!h->pic_structure && h->mby >= h->mb_width / 2))
+ if (get_bits1(gb)) { //slice_weighting_flag
+ av_log(h->avctx, AV_LOG_ERROR,
"weighted prediction not yet supported\n");
}
return 0;
}
-static inline int check_for_slice(AVSContext *h) {
- GetBitContext *gb = &h->s.gb;
+static inline int check_for_slice(AVSContext *h)
+{
+ GetBitContext *gb = &h->gb;
int align;
- if(h->mbx)
+ if (h->mbx)
return 0;
align = (-get_bits_count(gb)) & 7;
/* check for stuffing byte */
- if(!align && (show_bits(gb,8) == 0x80))
+ if (!align && (show_bits(gb, 8) == 0x80))
align = 8;
- if((show_bits_long(gb,24+align) & 0xFFFFFF) == 0x000001) {
- skip_bits_long(gb,24+align);
- h->stc = get_bits(gb,8);
+ if ((show_bits_long(gb, 24 + align) & 0xFFFFFF) == 0x000001) {
+ skip_bits_long(gb, 24 + align);
+ h->stc = get_bits(gb, 8);
if (h->stc >= h->mb_height)
return 0;
- decode_slice_header(h,gb);
+ decode_slice_header(h, gb);
return 1;
}
return 0;
@@ -462,139 +926,140 @@ static inline int check_for_slice(AVSContext *h) {
*
****************************************************************************/
-static int decode_pic(AVSContext *h) {
- MpegEncContext *s = &h->s;
- int skip_count = -1;
+static int decode_pic(AVSContext *h)
+{
+ int skip_count = -1;
enum cavs_mb mb_type;
- if (!s->context_initialized) {
- s->avctx->idct_algo = FF_IDCT_CAVS;
- if (MPV_common_init(s) < 0)
- return -1;
- ff_init_scantable(s->dsp.idct_permutation,&h->scantable,ff_zigzag_direct);
- }
- skip_bits(&s->gb,16);//bbv_dwlay
- if(h->stc == PIC_PB_START_CODE) {
- h->pic_type = get_bits(&s->gb,2) + AV_PICTURE_TYPE_I;
- if(h->pic_type > AV_PICTURE_TYPE_B) {
- av_log(s->avctx, AV_LOG_ERROR, "illegal picture type\n");
+ skip_bits(&h->gb, 16);//bbv_dwlay
+ if (h->stc == PIC_PB_START_CODE) {
+ h->cur.f->pict_type = get_bits(&h->gb, 2) + AV_PICTURE_TYPE_I;
+ if (h->cur.f->pict_type > AV_PICTURE_TYPE_B) {
+ av_log(h->avctx, AV_LOG_ERROR, "illegal picture type\n");
return -1;
}
/* make sure we have the reference frames we need */
- if(!h->DPB[0].f.data[0] ||
- (!h->DPB[1].f.data[0] && h->pic_type == AV_PICTURE_TYPE_B))
+ if (!h->DPB[0].f->data[0] ||
+ (!h->DPB[1].f->data[0] && h->cur.f->pict_type == AV_PICTURE_TYPE_B))
return -1;
} else {
- h->pic_type = AV_PICTURE_TYPE_I;
- if(get_bits1(&s->gb))
- skip_bits(&s->gb,24);//time_code
+ h->cur.f->pict_type = AV_PICTURE_TYPE_I;
+ if (get_bits1(&h->gb))
+ skip_bits(&h->gb, 24);//time_code
/* old sample clips were all progressive and no low_delay,
bump stream revision if detected otherwise */
- if (s->low_delay || !(show_bits(&s->gb,9) & 1))
+ if (h->low_delay || !(show_bits(&h->gb, 9) & 1))
h->stream_revision = 1;
/* similarly test top_field_first and repeat_first_field */
- else if(show_bits(&s->gb,11) & 3)
+ else if (show_bits(&h->gb, 11) & 3)
h->stream_revision = 1;
- if(h->stream_revision > 0)
- skip_bits(&s->gb,1); //marker_bit
+ if (h->stream_revision > 0)
+ skip_bits(&h->gb, 1); //marker_bit
}
/* release last B frame */
- if(h->picture.f.data[0])
- s->avctx->release_buffer(s->avctx, (AVFrame *)&h->picture);
+ if (h->cur.f->data[0])
+ h->avctx->release_buffer(h->avctx, h->cur.f);
+
+ ff_get_buffer(h->avctx, h->cur.f);
+
+ if (!h->edge_emu_buffer) {
+ int alloc_size = FFALIGN(FFABS(h->cur.f->linesize[0]) + 32, 32);
+ h->edge_emu_buffer = av_mallocz(alloc_size * 2 * 24);
+ if (!h->edge_emu_buffer)
+ return AVERROR(ENOMEM);
+ }
- s->avctx->get_buffer(s->avctx, (AVFrame *)&h->picture);
ff_cavs_init_pic(h);
- h->picture.poc = get_bits(&s->gb,8)*2;
+ h->cur.poc = get_bits(&h->gb, 8) * 2;
/* get temporal distances and MV scaling factors */
- if(h->pic_type != AV_PICTURE_TYPE_B) {
- h->dist[0] = (h->picture.poc - h->DPB[0].poc + 512) % 512;
+ if (h->cur.f->pict_type != AV_PICTURE_TYPE_B) {
+ h->dist[0] = (h->cur.poc - h->DPB[0].poc + 512) % 512;
} else {
- h->dist[0] = (h->DPB[0].poc - h->picture.poc + 512) % 512;
+ h->dist[0] = (h->DPB[0].poc - h->cur.poc + 512) % 512;
}
- h->dist[1] = (h->picture.poc - h->DPB[1].poc + 512) % 512;
+ h->dist[1] = (h->cur.poc - h->DPB[1].poc + 512) % 512;
h->scale_den[0] = h->dist[0] ? 512/h->dist[0] : 0;
h->scale_den[1] = h->dist[1] ? 512/h->dist[1] : 0;
- if(h->pic_type == AV_PICTURE_TYPE_B) {
- h->sym_factor = h->dist[0]*h->scale_den[1];
+ if (h->cur.f->pict_type == AV_PICTURE_TYPE_B) {
+ h->sym_factor = h->dist[0] * h->scale_den[1];
} else {
- h->direct_den[0] = h->dist[0] ? 16384/h->dist[0] : 0;
- h->direct_den[1] = h->dist[1] ? 16384/h->dist[1] : 0;
+ h->direct_den[0] = h->dist[0] ? 16384 / h->dist[0] : 0;
+ h->direct_den[1] = h->dist[1] ? 16384 / h->dist[1] : 0;
}
- if(s->low_delay)
- get_ue_golomb(&s->gb); //bbv_check_times
- h->progressive = get_bits1(&s->gb);
+ if (h->low_delay)
+ get_ue_golomb(&h->gb); //bbv_check_times
+ h->progressive = get_bits1(&h->gb);
h->pic_structure = 1;
- if(!h->progressive)
- h->pic_structure = get_bits1(&s->gb);
- if(!h->pic_structure && h->stc == PIC_PB_START_CODE)
- skip_bits1(&s->gb); //advanced_pred_mode_disable
- skip_bits1(&s->gb); //top_field_first
- skip_bits1(&s->gb); //repeat_first_field
- h->qp_fixed = get_bits1(&s->gb);
- h->qp = get_bits(&s->gb,6);
- if(h->pic_type == AV_PICTURE_TYPE_I) {
- if(!h->progressive && !h->pic_structure)
- skip_bits1(&s->gb);//what is this?
- skip_bits(&s->gb,4); //reserved bits
+ if (!h->progressive)
+ h->pic_structure = get_bits1(&h->gb);
+ if (!h->pic_structure && h->stc == PIC_PB_START_CODE)
+ skip_bits1(&h->gb); //advanced_pred_mode_disable
+ skip_bits1(&h->gb); //top_field_first
+ skip_bits1(&h->gb); //repeat_first_field
+ h->qp_fixed = get_bits1(&h->gb);
+ h->qp = get_bits(&h->gb, 6);
+ if (h->cur.f->pict_type == AV_PICTURE_TYPE_I) {
+ if (!h->progressive && !h->pic_structure)
+ skip_bits1(&h->gb);//what is this?
+ skip_bits(&h->gb, 4); //reserved bits
} else {
- if(!(h->pic_type == AV_PICTURE_TYPE_B && h->pic_structure == 1))
- h->ref_flag = get_bits1(&s->gb);
- skip_bits(&s->gb,4); //reserved bits
- h->skip_mode_flag = get_bits1(&s->gb);
+ if (!(h->cur.f->pict_type == AV_PICTURE_TYPE_B && h->pic_structure == 1))
+ h->ref_flag = get_bits1(&h->gb);
+ skip_bits(&h->gb, 4); //reserved bits
+ h->skip_mode_flag = get_bits1(&h->gb);
}
- h->loop_filter_disable = get_bits1(&s->gb);
- if(!h->loop_filter_disable && get_bits1(&s->gb)) {
- h->alpha_offset = get_se_golomb(&s->gb);
- h->beta_offset = get_se_golomb(&s->gb);
+ h->loop_filter_disable = get_bits1(&h->gb);
+ if (!h->loop_filter_disable && get_bits1(&h->gb)) {
+ h->alpha_offset = get_se_golomb(&h->gb);
+ h->beta_offset = get_se_golomb(&h->gb);
} else {
h->alpha_offset = h->beta_offset = 0;
}
- if(h->pic_type == AV_PICTURE_TYPE_I) {
+ if (h->cur.f->pict_type == AV_PICTURE_TYPE_I) {
do {
check_for_slice(h);
decode_mb_i(h, 0);
- } while(ff_cavs_next_mb(h));
- } else if(h->pic_type == AV_PICTURE_TYPE_P) {
+ } while (ff_cavs_next_mb(h));
+ } else if (h->cur.f->pict_type == AV_PICTURE_TYPE_P) {
do {
- if(check_for_slice(h))
+ if (check_for_slice(h))
skip_count = -1;
- if(h->skip_mode_flag && (skip_count < 0))
- skip_count = get_ue_golomb(&s->gb);
- if(h->skip_mode_flag && skip_count--) {
- decode_mb_p(h,P_SKIP);
+ if (h->skip_mode_flag && (skip_count < 0))
+ skip_count = get_ue_golomb(&h->gb);
+ if (h->skip_mode_flag && skip_count--) {
+ decode_mb_p(h, P_SKIP);
} else {
- mb_type = get_ue_golomb(&s->gb) + P_SKIP + h->skip_mode_flag;
- if(mb_type > P_8X8)
+ mb_type = get_ue_golomb(&h->gb) + P_SKIP + h->skip_mode_flag;
+ if (mb_type > P_8X8)
decode_mb_i(h, mb_type - P_8X8 - 1);
else
- decode_mb_p(h,mb_type);
+ decode_mb_p(h, mb_type);
}
- } while(ff_cavs_next_mb(h));
+ } while (ff_cavs_next_mb(h));
} else { /* AV_PICTURE_TYPE_B */
do {
- if(check_for_slice(h))
+ if (check_for_slice(h))
skip_count = -1;
- if(h->skip_mode_flag && (skip_count < 0))
- skip_count = get_ue_golomb(&s->gb);
- if(h->skip_mode_flag && skip_count--) {
- decode_mb_b(h,B_SKIP);
+ if (h->skip_mode_flag && (skip_count < 0))
+ skip_count = get_ue_golomb(&h->gb);
+ if (h->skip_mode_flag && skip_count--) {
+ decode_mb_b(h, B_SKIP);
} else {
- mb_type = get_ue_golomb(&s->gb) + B_SKIP + h->skip_mode_flag;
- if(mb_type > B_8X8)
+ mb_type = get_ue_golomb(&h->gb) + B_SKIP + h->skip_mode_flag;
+ if (mb_type > B_8X8)
decode_mb_i(h, mb_type - B_8X8 - 1);
else
- decode_mb_b(h,mb_type);
+ decode_mb_b(h, mb_type);
}
- } while(ff_cavs_next_mb(h));
+ } while (ff_cavs_next_mb(h));
}
- if(h->pic_type != AV_PICTURE_TYPE_B) {
- if(h->DPB[1].f.data[0])
- s->avctx->release_buffer(s->avctx, (AVFrame *)&h->DPB[1]);
- h->DPB[1] = h->DPB[0];
- h->DPB[0] = h->picture;
- memset(&h->picture,0,sizeof(Picture));
+ if (h->cur.f->pict_type != AV_PICTURE_TYPE_B) {
+ if (h->DPB[1].f->data[0])
+ h->avctx->release_buffer(h->avctx, h->DPB[1].f);
+ FFSWAP(AVSFrame, h->cur, h->DPB[1]);
+ FFSWAP(AVSFrame, h->DPB[0], h->DPB[1]);
}
return 0;
}
@@ -605,67 +1070,68 @@ static int decode_pic(AVSContext *h) {
*
****************************************************************************/
-static int decode_seq_header(AVSContext *h) {
- MpegEncContext *s = &h->s;
+static int decode_seq_header(AVSContext *h)
+{
int frame_rate_code;
int width, height;
- h->profile = get_bits(&s->gb,8);
- h->level = get_bits(&s->gb,8);
- skip_bits1(&s->gb); //progressive sequence
+ h->profile = get_bits(&h->gb, 8);
+ h->level = get_bits(&h->gb, 8);
+ skip_bits1(&h->gb); //progressive sequence
- width = get_bits(&s->gb, 14);
- height = get_bits(&s->gb, 14);
- if ((s->width || s->height) && (s->width != width || s->height != height)) {
- av_log_missing_feature(s, "Width/height changing in CAVS is", 0);
+ width = get_bits(&h->gb, 14);
+ height = get_bits(&h->gb, 14);
+ if ((h->width || h->height) && (h->width != width || h->height != height)) {
+ av_log_missing_feature(h->avctx, "Width/height changing in CAVS", 0);
return AVERROR_PATCHWELCOME;
}
- s->width = width;
- s->height = height;
-
- skip_bits(&s->gb,2); //chroma format
- skip_bits(&s->gb,3); //sample_precision
- h->aspect_ratio = get_bits(&s->gb,4);
- frame_rate_code = get_bits(&s->gb,4);
- skip_bits(&s->gb,18);//bit_rate_lower
- skip_bits1(&s->gb); //marker_bit
- skip_bits(&s->gb,12);//bit_rate_upper
- s->low_delay = get_bits1(&s->gb);
- h->mb_width = (s->width + 15) >> 4;
- h->mb_height = (s->height + 15) >> 4;
- h->s.avctx->time_base.den = avpriv_frame_rate_tab[frame_rate_code].num;
- h->s.avctx->time_base.num = avpriv_frame_rate_tab[frame_rate_code].den;
- h->s.avctx->width = s->width;
- h->s.avctx->height = s->height;
- if(!h->top_qp)
+ h->width = width;
+ h->height = height;
+
+ skip_bits(&h->gb, 2); //chroma format
+ skip_bits(&h->gb, 3); //sample_precision
+ h->aspect_ratio = get_bits(&h->gb, 4);
+ frame_rate_code = get_bits(&h->gb, 4);
+ skip_bits(&h->gb, 18); //bit_rate_lower
+ skip_bits1(&h->gb); //marker_bit
+ skip_bits(&h->gb, 12); //bit_rate_upper
+ h->low_delay = get_bits1(&h->gb);
+ h->mb_width = (h->width + 15) >> 4;
+ h->mb_height = (h->height + 15) >> 4;
+ h->avctx->time_base.den = ff_mpeg12_frame_rate_tab[frame_rate_code].num;
+ h->avctx->time_base.num = ff_mpeg12_frame_rate_tab[frame_rate_code].den;
+ h->avctx->width = h->width;
+ h->avctx->height = h->height;
+ if (!h->top_qp)
ff_cavs_init_top_lines(h);
return 0;
}
-static void cavs_flush(AVCodecContext * avctx) {
+static void cavs_flush(AVCodecContext * avctx)
+{
AVSContext *h = avctx->priv_data;
h->got_keyframe = 0;
}
-static int cavs_decode_frame(AVCodecContext * avctx,void *data, int *data_size,
- AVPacket *avpkt) {
+static int cavs_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
+ AVPacket *avpkt)
+{
+ AVSContext *h = avctx->priv_data;
const uint8_t *buf = avpkt->data;
- int buf_size = avpkt->size;
- AVSContext *h = avctx->priv_data;
- MpegEncContext *s = &h->s;
+ int buf_size = avpkt->size;
+ AVFrame *picture = data;
+ uint32_t stc = -1;
int input_size;
const uint8_t *buf_end;
const uint8_t *buf_ptr;
- AVFrame *picture = data;
- uint32_t stc = -1;
-
- s->avctx = avctx;
if (buf_size == 0) {
- if (!s->low_delay && h->DPB[0].f.data[0]) {
- *data_size = sizeof(AVPicture);
- *picture = h->DPB[0].f;
- memset(&h->DPB[0], 0, sizeof(h->DPB[0]));
+ if (!h->low_delay && h->DPB[0].f->data[0]) {
+ *got_frame = 1;
+ *picture = *h->DPB[0].f;
+ if (h->cur.f->data[0])
+ avctx->release_buffer(avctx, h->cur.f);
+ FFSWAP(AVSFrame, h->cur, h->DPB[0]);
}
return 0;
}
@@ -673,51 +1139,51 @@ static int cavs_decode_frame(AVCodecContext * avctx,void *data, int *data_size,
buf_ptr = buf;
buf_end = buf + buf_size;
for(;;) {
- buf_ptr = avpriv_mpv_find_start_code(buf_ptr,buf_end, &stc);
- if((stc & 0xFFFFFE00) || buf_ptr == buf_end)
- return FFMAX(0, buf_ptr - buf - s->parse_context.last_index);
- input_size = (buf_end - buf_ptr)*8;
- switch(stc) {
+ buf_ptr = avpriv_mpv_find_start_code(buf_ptr, buf_end, &stc);
+ if ((stc & 0xFFFFFE00) || buf_ptr == buf_end)
+ return FFMAX(0, buf_ptr - buf);
+ input_size = (buf_end - buf_ptr) * 8;
+ switch (stc) {
case CAVS_START_CODE:
- init_get_bits(&s->gb, buf_ptr, input_size);
+ init_get_bits(&h->gb, buf_ptr, input_size);
decode_seq_header(h);
break;
case PIC_I_START_CODE:
- if(!h->got_keyframe) {
- if(h->DPB[0].f.data[0])
- avctx->release_buffer(avctx, (AVFrame *)&h->DPB[0]);
- if(h->DPB[1].f.data[0])
- avctx->release_buffer(avctx, (AVFrame *)&h->DPB[1]);
+ if (!h->got_keyframe) {
+ if(h->DPB[0].f->data[0])
+ avctx->release_buffer(avctx, h->DPB[0].f);
+ if(h->DPB[1].f->data[0])
+ avctx->release_buffer(avctx, h->DPB[1].f);
h->got_keyframe = 1;
}
case PIC_PB_START_CODE:
- *data_size = 0;
- if(!h->got_keyframe)
+ *got_frame = 0;
+ if (!h->got_keyframe)
break;
- init_get_bits(&s->gb, buf_ptr, input_size);
+ init_get_bits(&h->gb, buf_ptr, input_size);
h->stc = stc;
- if(decode_pic(h))
+ if (decode_pic(h))
break;
- *data_size = sizeof(AVPicture);
- if(h->pic_type != AV_PICTURE_TYPE_B) {
- if(h->DPB[1].f.data[0]) {
- *picture = *(AVFrame *) &h->DPB[1];
+ *got_frame = 1;
+ if (h->cur.f->pict_type != AV_PICTURE_TYPE_B) {
+ if (h->DPB[1].f->data[0]) {
+ *picture = *h->DPB[1].f;
} else {
- *data_size = 0;
+ *got_frame = 0;
}
} else
- *picture = *(AVFrame *) &h->picture;
+ *picture = *h->cur.f;
break;
case EXT_START_CODE:
- //mpeg_decode_extension(avctx,buf_ptr, input_size);
+ //mpeg_decode_extension(avctx, buf_ptr, input_size);
break;
case USER_START_CODE:
- //mpeg_decode_user_data(avctx,buf_ptr, input_size);
+ //mpeg_decode_user_data(avctx, buf_ptr, input_size);
break;
default:
if (stc <= SLICE_MAX_START_CODE) {
- init_get_bits(&s->gb, buf_ptr, input_size);
- decode_slice_header(h, &s->gb);
+ init_get_bits(&h->gb, buf_ptr, input_size);
+ decode_slice_header(h, &h->gb);
}
break;
}
@@ -727,12 +1193,12 @@ static int cavs_decode_frame(AVCodecContext * avctx,void *data, int *data_size,
AVCodec ff_cavs_decoder = {
.name = "cavs",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_CAVS,
+ .id = AV_CODEC_ID_CAVS,
.priv_data_size = sizeof(AVSContext),
.init = ff_cavs_init,
.close = ff_cavs_end,
.decode = cavs_decode_frame,
.capabilities = CODEC_CAP_DR1 | CODEC_CAP_DELAY,
- .flush= cavs_flush,
- .long_name= NULL_IF_CONFIG_SMALL("Chinese AVS video (AVS1-P2, JiZhun profile)"),
+ .flush = cavs_flush,
+ .long_name = NULL_IF_CONFIG_SMALL("Chinese AVS (Audio Video Standard) (AVS1-P2, JiZhun profile)"),
};
diff --git a/gst-libs/ext/libav/libavcodec/cavsdsp.c b/gst-libs/ext/libav/libavcodec/cavsdsp.c
index 04e521b..15020a8 100644
--- a/gst-libs/ext/libav/libavcodec/cavsdsp.c
+++ b/gst-libs/ext/libav/libavcodec/cavsdsp.c
@@ -25,6 +25,7 @@
#include <stdio.h>
#include "dsputil.h"
#include "cavsdsp.h"
+#include "libavutil/common.h"
/*****************************************************************************
*
@@ -543,6 +544,8 @@ av_cold void ff_cavsdsp_init(CAVSDSPContext* c, AVCodecContext *avctx) {
c->cavs_filter_cv = cavs_filter_cv_c;
c->cavs_filter_ch = cavs_filter_ch_c;
c->cavs_idct8_add = cavs_idct8_add_c;
+ c->idct_perm = FF_NO_IDCT_PERM;
- if (HAVE_MMX) ff_cavsdsp_init_mmx(c, avctx);
+ if (ARCH_X86)
+ ff_cavsdsp_init_x86(c, avctx);
}
diff --git a/gst-libs/ext/libav/libavcodec/cavsdsp.h b/gst-libs/ext/libav/libavcodec/cavsdsp.h
index b1133b7..fff9c1c 100644
--- a/gst-libs/ext/libav/libavcodec/cavsdsp.h
+++ b/gst-libs/ext/libav/libavcodec/cavsdsp.h
@@ -33,9 +33,10 @@ typedef struct CAVSDSPContext {
void (*cavs_filter_cv)(uint8_t *pix, int stride, int alpha, int beta, int tc, int bs1, int bs2);
void (*cavs_filter_ch)(uint8_t *pix, int stride, int alpha, int beta, int tc, int bs1, int bs2);
void (*cavs_idct8_add)(uint8_t *dst, DCTELEM *block, int stride);
+ int idct_perm;
} CAVSDSPContext;
void ff_cavsdsp_init(CAVSDSPContext* c, AVCodecContext *avctx);
-void ff_cavsdsp_init_mmx(CAVSDSPContext* c, AVCodecContext *avctx);
+void ff_cavsdsp_init_x86(CAVSDSPContext* c, AVCodecContext *avctx);
#endif /* AVCODEC_CAVSDSP_H */
diff --git a/gst-libs/ext/libav/libavcodec/cdgraphics.c b/gst-libs/ext/libav/libavcodec/cdgraphics.c
index f1f474f..e4ed83b 100644
--- a/gst-libs/ext/libav/libavcodec/cdgraphics.c
+++ b/gst-libs/ext/libav/libavcodec/cdgraphics.c
@@ -21,6 +21,7 @@
#include "avcodec.h"
#include "bytestream.h"
+#include "internal.h"
/**
* @file
@@ -86,7 +87,7 @@ static av_cold int cdg_decode_init(AVCodecContext *avctx)
avctx->width = CDG_FULL_WIDTH;
avctx->height = CDG_FULL_HEIGHT;
- avctx->pix_fmt = PIX_FMT_PAL8;
+ avctx->pix_fmt = AV_PIX_FMT_PAL8;
return 0;
}
@@ -218,7 +219,7 @@ static void cdg_scroll(CDGraphicsContext *cc, uint8_t *data,
vscmd = (data[2] & 0x30) >> 4;
h_off = FFMIN(data[1] & 0x07, CDG_BORDER_WIDTH - 1);
- v_off = FFMIN(data[2] & 0x07, CDG_BORDER_HEIGHT - 1);
+ v_off = FFMIN(data[2] & 0x0F, CDG_BORDER_HEIGHT - 1);
/// find the difference and save the offset for cdg_tile_block usage
hinc = h_off - cc->hscroll;
@@ -266,7 +267,7 @@ static void cdg_scroll(CDGraphicsContext *cc, uint8_t *data,
}
static int cdg_decode_frame(AVCodecContext *avctx,
- void *data, int *data_size, AVPacket *avpkt)
+ void *data, int *got_frame, AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
@@ -333,7 +334,7 @@ static int cdg_decode_frame(AVCodecContext *avctx,
}
cdg_init_frame(&new_frame);
- ret = avctx->get_buffer(avctx, &new_frame);
+ ret = ff_get_buffer(avctx, &new_frame);
if (ret) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return ret;
@@ -347,9 +348,9 @@ static int cdg_decode_frame(AVCodecContext *avctx,
break;
}
- *data_size = sizeof(AVFrame);
+ *got_frame = 1;
} else {
- *data_size = 0;
+ *got_frame = 0;
buf_size = 0;
}
@@ -370,11 +371,11 @@ static av_cold int cdg_decode_end(AVCodecContext *avctx)
AVCodec ff_cdgraphics_decoder = {
.name = "cdgraphics",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_CDGRAPHICS,
+ .id = AV_CODEC_ID_CDGRAPHICS,
.priv_data_size = sizeof(CDGraphicsContext),
.init = cdg_decode_init,
.close = cdg_decode_end,
.decode = cdg_decode_frame,
.capabilities = CODEC_CAP_DR1,
- .long_name = NULL_IF_CONFIG_SMALL("CD Graphics video"),
+ .long_name = NULL_IF_CONFIG_SMALL("CD Graphics video"),
};
diff --git a/gst-libs/ext/libav/libavcodec/cdxl.c b/gst-libs/ext/libav/libavcodec/cdxl.c
new file mode 100644
index 0000000..0b3d59c
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/cdxl.c
@@ -0,0 +1,311 @@
+/*
+ * CDXL video decoder
+ * Copyright (c) 2011-2012 Paul B Mahol
+ *
+ * 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
+ */
+
+#include "libavutil/intreadwrite.h"
+#include "libavutil/imgutils.h"
+#include "avcodec.h"
+#include "get_bits.h"
+#include "internal.h"
+
+#define BIT_PLANAR 0x00
+#define BYTE_PLANAR 0x20
+#define CHUNKY 0x40
+#define BIT_LINE 0x80
+#define BYTE_LINE 0xC0
+
+typedef struct {
+ AVCodecContext *avctx;
+ AVFrame frame;
+ int bpp;
+ int format;
+ int padded_bits;
+ const uint8_t *palette;
+ int palette_size;
+ const uint8_t *video;
+ int video_size;
+ uint8_t *new_video;
+ int new_video_size;
+} CDXLVideoContext;
+
+static av_cold int cdxl_decode_init(AVCodecContext *avctx)
+{
+ CDXLVideoContext *c = avctx->priv_data;
+
+ avcodec_get_frame_defaults(&c->frame);
+ c->new_video_size = 0;
+ c->avctx = avctx;
+
+ return 0;
+}
+
+static void import_palette(CDXLVideoContext *c, uint32_t *new_palette)
+{
+ int i;
+
+ for (i = 0; i < c->palette_size / 2; i++) {
+ unsigned rgb = AV_RB16(&c->palette[i * 2]);
+ unsigned r = ((rgb >> 8) & 0xF) * 0x11;
+ unsigned g = ((rgb >> 4) & 0xF) * 0x11;
+ unsigned b = (rgb & 0xF) * 0x11;
+ AV_WN32(&new_palette[i], (r << 16) | (g << 8) | b);
+ }
+}
+
+static void bitplanar2chunky(CDXLVideoContext *c, int linesize, uint8_t *out)
+{
+ GetBitContext gb;
+ int x, y, plane;
+
+ init_get_bits(&gb, c->video, c->video_size * 8);
+ for (plane = 0; plane < c->bpp; plane++) {
+ for (y = 0; y < c->avctx->height; y++) {
+ for (x = 0; x < c->avctx->width; x++)
+ out[linesize * y + x] |= get_bits1(&gb) << plane;
+ skip_bits(&gb, c->padded_bits);
+ }
+ }
+}
+
+static void bitline2chunky(CDXLVideoContext *c, int linesize, uint8_t *out)
+{
+ GetBitContext gb;
+ int x, y, plane;
+
+ init_get_bits(&gb, c->video, c->video_size * 8);
+ for (y = 0; y < c->avctx->height; y++) {
+ for (plane = 0; plane < c->bpp; plane++) {
+ for (x = 0; x < c->avctx->width; x++)
+ out[linesize * y + x] |= get_bits1(&gb) << plane;
+ skip_bits(&gb, c->padded_bits);
+ }
+ }
+}
+
+static void import_format(CDXLVideoContext *c, int linesize, uint8_t *out)
+{
+ memset(out, 0, linesize * c->avctx->height);
+
+ switch (c->format) {
+ case BIT_PLANAR:
+ bitplanar2chunky(c, linesize, out);
+ break;
+ case BIT_LINE:
+ bitline2chunky(c, linesize, out);
+ break;
+ }
+}
+
+static void cdxl_decode_rgb(CDXLVideoContext *c)
+{
+ uint32_t *new_palette = (uint32_t *)c->frame.data[1];
+
+ import_palette(c, new_palette);
+ import_format(c, c->frame.linesize[0], c->frame.data[0]);
+}
+
+static void cdxl_decode_ham6(CDXLVideoContext *c)
+{
+ AVCodecContext *avctx = c->avctx;
+ uint32_t new_palette[16], r, g, b;
+ uint8_t *ptr, *out, index, op;
+ int x, y;
+
+ ptr = c->new_video;
+ out = c->frame.data[0];
+
+ import_palette(c, new_palette);
+ import_format(c, avctx->width, c->new_video);
+
+ for (y = 0; y < avctx->height; y++) {
+ r = new_palette[0] & 0xFF0000;
+ g = new_palette[0] & 0xFF00;
+ b = new_palette[0] & 0xFF;
+ for (x = 0; x < avctx->width; x++) {
+ index = *ptr++;
+ op = index >> 4;
+ index &= 15;
+ switch (op) {
+ case 0:
+ r = new_palette[index] & 0xFF0000;
+ g = new_palette[index] & 0xFF00;
+ b = new_palette[index] & 0xFF;
+ break;
+ case 1:
+ b = index * 0x11;
+ break;
+ case 2:
+ r = index * 0x11 << 16;
+ break;
+ case 3:
+ g = index * 0x11 << 8;
+ break;
+ }
+ AV_WL24(out + x * 3, r | g | b);
+ }
+ out += c->frame.linesize[0];
+ }
+}
+
+static void cdxl_decode_ham8(CDXLVideoContext *c)
+{
+ AVCodecContext *avctx = c->avctx;
+ uint32_t new_palette[64], r, g, b;
+ uint8_t *ptr, *out, index, op;
+ int x, y;
+
+ ptr = c->new_video;
+ out = c->frame.data[0];
+
+ import_palette(c, new_palette);
+ import_format(c, avctx->width, c->new_video);
+
+ for (y = 0; y < avctx->height; y++) {
+ r = new_palette[0] & 0xFF0000;
+ g = new_palette[0] & 0xFF00;
+ b = new_palette[0] & 0xFF;
+ for (x = 0; x < avctx->width; x++) {
+ index = *ptr++;
+ op = index >> 6;
+ index &= 63;
+ switch (op) {
+ case 0:
+ r = new_palette[index] & 0xFF0000;
+ g = new_palette[index] & 0xFF00;
+ b = new_palette[index] & 0xFF;
+ break;
+ case 1:
+ b = (index << 2) | (b & 3);
+ break;
+ case 2:
+ r = (index << 18) | (r & (3 << 16));
+ break;
+ case 3:
+ g = (index << 10) | (g & (3 << 8));
+ break;
+ }
+ AV_WL24(out + x * 3, r | g | b);
+ }
+ out += c->frame.linesize[0];
+ }
+}
+
+static int cdxl_decode_frame(AVCodecContext *avctx, void *data,
+ int *got_frame, AVPacket *pkt)
+{
+ CDXLVideoContext *c = avctx->priv_data;
+ AVFrame * const p = &c->frame;
+ int ret, w, h, encoding, aligned_width, buf_size = pkt->size;
+ const uint8_t *buf = pkt->data;
+
+ if (buf_size < 32)
+ return AVERROR_INVALIDDATA;
+ encoding = buf[1] & 7;
+ c->format = buf[1] & 0xE0;
+ w = AV_RB16(&buf[14]);
+ h = AV_RB16(&buf[16]);
+ c->bpp = buf[19];
+ c->palette_size = AV_RB16(&buf[20]);
+ c->palette = buf + 32;
+ c->video = c->palette + c->palette_size;
+ c->video_size = buf_size - c->palette_size - 32;
+
+ if (c->palette_size > 512)
+ return AVERROR_INVALIDDATA;
+ if (buf_size < c->palette_size + 32)
+ return AVERROR_INVALIDDATA;
+ if (c->bpp < 1)
+ return AVERROR_INVALIDDATA;
+ if (c->format != BIT_PLANAR && c->format != BIT_LINE) {
+ av_log_ask_for_sample(avctx, "unsupported pixel format: 0x%0x\n", c->format);
+ return AVERROR_PATCHWELCOME;
+ }
+
+ if ((ret = av_image_check_size(w, h, 0, avctx)) < 0)
+ return ret;
+ if (w != avctx->width || h != avctx->height)
+ avcodec_set_dimensions(avctx, w, h);
+
+ aligned_width = FFALIGN(c->avctx->width, 16);
+ c->padded_bits = aligned_width - c->avctx->width;
+ if (c->video_size < aligned_width * avctx->height * c->bpp / 8)
+ return AVERROR_INVALIDDATA;
+ if (!encoding && c->palette_size && c->bpp <= 8) {
+ avctx->pix_fmt = AV_PIX_FMT_PAL8;
+ } else if (encoding == 1 && (c->bpp == 6 || c->bpp == 8)) {
+ if (c->palette_size != (1 << (c->bpp - 1)))
+ return AVERROR_INVALIDDATA;
+ avctx->pix_fmt = AV_PIX_FMT_BGR24;
+ } else {
+ av_log_ask_for_sample(avctx, "unsupported encoding %d and bpp %d\n",
+ encoding, c->bpp);
+ return AVERROR_PATCHWELCOME;
+ }
+
+ if (p->data[0])
+ avctx->release_buffer(avctx, p);
+
+ p->reference = 0;
+ if ((ret = ff_get_buffer(avctx, p)) < 0) {
+ av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
+ return ret;
+ }
+ p->pict_type = AV_PICTURE_TYPE_I;
+
+ if (encoding) {
+ av_fast_padded_malloc(&c->new_video, &c->new_video_size,
+ h * w + FF_INPUT_BUFFER_PADDING_SIZE);
+ if (!c->new_video)
+ return AVERROR(ENOMEM);
+ if (c->bpp == 8)
+ cdxl_decode_ham8(c);
+ else
+ cdxl_decode_ham6(c);
+ } else {
+ cdxl_decode_rgb(c);
+ }
+ *got_frame = 1;
+ *(AVFrame*)data = c->frame;
+
+ return buf_size;
+}
+
+static av_cold int cdxl_decode_end(AVCodecContext *avctx)
+{
+ CDXLVideoContext *c = avctx->priv_data;
+
+ av_free(c->new_video);
+ if (c->frame.data[0])
+ avctx->release_buffer(avctx, &c->frame);
+
+ return 0;
+}
+
+AVCodec ff_cdxl_decoder = {
+ .name = "cdxl",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .id = AV_CODEC_ID_CDXL,
+ .priv_data_size = sizeof(CDXLVideoContext),
+ .init = cdxl_decode_init,
+ .close = cdxl_decode_end,
+ .decode = cdxl_decode_frame,
+ .capabilities = CODEC_CAP_DR1,
+ .long_name = NULL_IF_CONFIG_SMALL("Commodore CDXL video"),
+};
diff --git a/gst-libs/ext/libav/libavcodec/celp_filters.c b/gst-libs/ext/libav/libavcodec/celp_filters.c
index 849cda4..381ffa4 100644
--- a/gst-libs/ext/libav/libavcodec/celp_filters.c
+++ b/gst-libs/ext/libav/libavcodec/celp_filters.c
@@ -24,6 +24,7 @@
#include "avcodec.h"
#include "celp_filters.h"
+#include "libavutil/common.h"
void ff_celp_convolve_circ(int16_t* fc_out, const int16_t* fc_in,
const int16_t* filter, int len)
@@ -58,22 +59,21 @@ void ff_celp_circ_addf(float *out, const float *in,
int ff_celp_lp_synthesis_filter(int16_t *out, const int16_t *filter_coeffs,
const int16_t *in, int buffer_length,
int filter_length, int stop_on_overflow,
- int rounder)
+ int shift, int rounder)
{
int i,n;
for (n = 0; n < buffer_length; n++) {
- int sum = rounder;
+ int sum = -rounder, sum1;
for (i = 1; i <= filter_length; i++)
- sum -= filter_coeffs[i-1] * out[n-i];
+ sum += filter_coeffs[i-1] * out[n-i];
- sum = (sum >> 12) + in[n];
+ sum1 = ((-sum >> 12) + in[n]) >> shift;
+ sum = av_clip_int16(sum1);
+
+ if (stop_on_overflow && sum != sum1)
+ return 1;
- if (sum + 0x8000 > 0xFFFFU) {
- if (stop_on_overflow)
- return 1;
- sum = (sum >> 31) ^ 32767;
- }
out[n] = sum;
}
diff --git a/gst-libs/ext/libav/libavcodec/celp_filters.h b/gst-libs/ext/libav/libavcodec/celp_filters.h
index cfd08fd..c328258 100644
--- a/gst-libs/ext/libav/libavcodec/celp_filters.h
+++ b/gst-libs/ext/libav/libavcodec/celp_filters.h
@@ -63,6 +63,7 @@ void ff_celp_circ_addf(float *out, const float *in,
* @param filter_length filter length (10 for 10th order LP filter)
* @param stop_on_overflow 1 - return immediately if overflow occurs
* 0 - ignore overflows
+ * @param shift the result is shifted right by this value
* @param rounder the amount to add for rounding (usually 0x800 or 0xfff)
*
* @return 1 if overflow occurred, 0 - otherwise
@@ -75,7 +76,7 @@ void ff_celp_circ_addf(float *out, const float *in,
int ff_celp_lp_synthesis_filter(int16_t *out, const int16_t *filter_coeffs,
const int16_t *in, int buffer_length,
int filter_length, int stop_on_overflow,
- int rounder);
+ int shift, int rounder);
/**
* LP synthesis filter.
diff --git a/gst-libs/ext/libav/libavcodec/celp_math.c b/gst-libs/ext/libav/libavcodec/celp_math.c
index 8d36d4e..a9ebef6 100644
--- a/gst-libs/ext/libav/libavcodec/celp_math.c
+++ b/gst-libs/ext/libav/libavcodec/celp_math.c
@@ -26,21 +26,7 @@
#include "avcodec.h"
#include "celp_math.h"
-
-/**
- * Cosine table: base_cos[i] = (1<<15) * cos(i*PI/64)
- */
-static const int16_t tab_cos[65] =
-{
- 32767, 32738, 32617, 32421, 32145, 31793, 31364, 30860,
- 30280, 29629, 28905, 28113, 27252, 26326, 25336, 24285,
- 23176, 22011, 20793, 19525, 18210, 16851, 15451, 14014,
- 12543, 11043, 9515, 7965, 6395, 4810, 3214, 1609,
- 1, -1607, -3211, -4808, -6393, -7962, -9513, -11040,
- -12541, -14012, -15449, -16848, -18207, -19523, -20791, -22009,
- -23174, -24283, -25334, -26324, -27250, -28111, -28904, -29627,
- -30279, -30858, -31363, -31792, -32144, -32419, -32616, -32736, -32768,
-};
+#include "libavutil/common.h"
static const uint16_t exp2a[]=
{
@@ -58,16 +44,6 @@ static const uint16_t exp2b[]=
17176, 17898, 18620, 19343, 20066, 20790, 21514, 22238,
};
-int16_t ff_cos(uint16_t arg)
-{
- uint8_t offset= arg;
- uint8_t ind = arg >> 8;
-
- assert(arg <= 0x3fff);
-
- return tab_cos[ind] + (offset * (tab_cos[ind+1] - tab_cos[ind]) >> 8);
-}
-
int ff_exp2(uint16_t power)
{
unsigned int result= exp2a[power>>10] + 0x10000;
@@ -91,7 +67,7 @@ static const uint16_t tab_log2[33] =
26457, 27294, 28116, 28924, 29719, 30500, 31269, 32025, 32769,
};
-int ff_log2(uint32_t value)
+int ff_log2_q15(uint32_t value)
{
uint8_t power_int;
uint8_t frac_x0;
@@ -110,14 +86,3 @@ int ff_log2(uint32_t value)
return (power_int << 15) + value;
}
-
-float ff_dot_productf(const float* a, const float* b, int length)
-{
- float sum = 0;
- int i;
-
- for(i=0; i<length; i++)
- sum += a[i] * b[i];
-
- return sum;
-}
diff --git a/gst-libs/ext/libav/libavcodec/celp_math.h b/gst-libs/ext/libav/libavcodec/celp_math.h
index 4a502ca..ed3f8c0 100644
--- a/gst-libs/ext/libav/libavcodec/celp_math.h
+++ b/gst-libs/ext/libav/libavcodec/celp_math.h
@@ -26,14 +26,6 @@
#include <stdint.h>
/**
- * fixed-point implementation of cosine in [0; PI) domain.
- * @param arg fixed-point cosine argument, 0 <= arg < 0x4000
- *
- * @return value of (1<<15) * cos(arg * PI / (1<<14)), -0x8000 <= result <= 0x7fff
- */
-int16_t ff_cos(uint16_t arg);
-
-/**
* fixed-point implementation of exp2(x) in [0; 1] domain.
* @param power argument to exp2, 0 <= power <= 0x7fff
*
@@ -48,7 +40,7 @@ int ff_exp2(uint16_t power);
*
* @return value of (1<<15) * log2(value)
*/
-int ff_log2(uint32_t value);
+int ff_log2_q15(uint32_t value);
/**
* Shift value left or right depending on sign of offset parameter.
@@ -63,14 +55,4 @@ static inline int bidir_sal(int value, int offset)
else return value << offset;
}
-/**
- * Return the dot product.
- * @param a input data array
- * @param b input data array
- * @param length number of elements
- *
- * @return dot product = sum of elementwise products
- */
-float ff_dot_productf(const float* a, const float* b, int length);
-
#endif /* AVCODEC_CELP_MATH_H */
diff --git a/gst-libs/ext/libav/libavcodec/cinepak.c b/gst-libs/ext/libav/libavcodec/cinepak.c
index 08ab05f..9bf6863 100644
--- a/gst-libs/ext/libav/libavcodec/cinepak.c
+++ b/gst-libs/ext/libav/libavcodec/cinepak.c
@@ -34,6 +34,7 @@
#include <stdlib.h>
#include <string.h>
+#include "libavutil/common.h"
#include "libavutil/intreadwrite.h"
#include "avcodec.h"
@@ -333,7 +334,7 @@ static int cinepak_decode (CinepakContext *s)
if (s->sega_film_skip_bytes == -1) {
if (!encoded_buf_size) {
av_log_ask_for_sample(s->avctx, "encoded_buf_size is 0");
- return AVERROR_INVALIDDATA;
+ return AVERROR_PATCHWELCOME;
}
if (encoded_buf_size != s->size && (s->size % encoded_buf_size) != 0) {
/* If the encoded frame size differs from the frame size as indicated
@@ -406,10 +407,10 @@ static av_cold int cinepak_decode_init(AVCodecContext *avctx)
// check for paletted data
if (avctx->bits_per_coded_sample != 8) {
s->palette_video = 0;
- avctx->pix_fmt = PIX_FMT_YUV420P;
+ avctx->pix_fmt = AV_PIX_FMT_YUV420P;
} else {
s->palette_video = 1;
- avctx->pix_fmt = PIX_FMT_PAL8;
+ avctx->pix_fmt = AV_PIX_FMT_PAL8;
}
s->frame.data[0] = NULL;
@@ -418,7 +419,7 @@ static av_cold int cinepak_decode_init(AVCodecContext *avctx)
}
static int cinepak_decode_frame(AVCodecContext *avctx,
- void *data, int *data_size,
+ void *data, int *got_frame,
AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
@@ -449,7 +450,7 @@ static int cinepak_decode_frame(AVCodecContext *avctx,
if (s->palette_video)
memcpy (s->frame.data[1], s->pal, AVPALETTE_SIZE);
- *data_size = sizeof(AVFrame);
+ *got_frame = 1;
*(AVFrame*)data = s->frame;
/* report that the buffer was completely consumed */
@@ -469,11 +470,11 @@ static av_cold int cinepak_decode_end(AVCodecContext *avctx)
AVCodec ff_cinepak_decoder = {
.name = "cinepak",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_CINEPAK,
+ .id = AV_CODEC_ID_CINEPAK,
.priv_data_size = sizeof(CinepakContext),
.init = cinepak_decode_init,
.close = cinepak_decode_end,
.decode = cinepak_decode_frame,
.capabilities = CODEC_CAP_DR1,
- .long_name = NULL_IF_CONFIG_SMALL("Cinepak"),
+ .long_name = NULL_IF_CONFIG_SMALL("Cinepak"),
};
diff --git a/gst-libs/ext/libav/libavcodec/cljr.c b/gst-libs/ext/libav/libavcodec/cljr.c
index cf307bb..9ba5138 100644
--- a/gst-libs/ext/libav/libavcodec/cljr.c
+++ b/gst-libs/ext/libav/libavcodec/cljr.c
@@ -26,6 +26,7 @@
#include "avcodec.h"
#include "get_bits.h"
+#include "internal.h"
#include "put_bits.h"
typedef struct CLJRContext {
@@ -43,7 +44,7 @@ static av_cold int common_init(AVCodecContext *avctx)
#if CONFIG_CLJR_DECODER
static int decode_frame(AVCodecContext *avctx,
- void *data, int *data_size,
+ void *data, int *got_frame,
AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
@@ -69,7 +70,7 @@ static int decode_frame(AVCodecContext *avctx,
}
p->reference = 0;
- if (avctx->get_buffer(avctx, p) < 0) {
+ if (ff_get_buffer(avctx, p) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return -1;
}
@@ -94,14 +95,14 @@ static int decode_frame(AVCodecContext *avctx,
}
*picture = a->picture;
- *data_size = sizeof(AVPicture);
+ *got_frame = 1;
return buf_size;
}
static av_cold int decode_init(AVCodecContext *avctx)
{
- avctx->pix_fmt = PIX_FMT_YUV411P;
+ avctx->pix_fmt = AV_PIX_FMT_YUV411P;
return common_init(avctx);
}
@@ -117,7 +118,7 @@ static av_cold int decode_end(AVCodecContext *avctx)
AVCodec ff_cljr_decoder = {
.name = "cljr",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_CLJR,
+ .id = AV_CODEC_ID_CLJR,
.priv_data_size = sizeof(CLJRContext),
.init = decode_init,
.close = decode_end,
@@ -128,17 +129,21 @@ AVCodec ff_cljr_decoder = {
#endif
#if CONFIG_CLJR_ENCODER
-static int encode_frame(AVCodecContext *avctx, unsigned char *buf,
- int buf_size, void *data)
+static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
+ const AVFrame *p, int *got_packet)
{
PutBitContext pb;
- AVFrame *p = data;
- int x, y;
+ int x, y, ret;
- p->pict_type = AV_PICTURE_TYPE_I;
- p->key_frame = 1;
+ if ((ret = ff_alloc_packet(pkt, 32*avctx->height*avctx->width/4)) < 0) {
+ av_log(avctx, AV_LOG_ERROR, "Error getting output packet.\n");
+ return ret;
+ }
+
+ avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I;
+ avctx->coded_frame->key_frame = 1;
- init_put_bits(&pb, buf, buf_size / 8);
+ init_put_bits(&pb, pkt->data, pkt->size);
for (y = 0; y < avctx->height; y++) {
uint8_t *luma = &p->data[0][y * p->linesize[0]];
@@ -157,18 +162,21 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf,
flush_put_bits(&pb);
- return put_bits_count(&pb) / 8;
+ pkt->size = put_bits_count(&pb) / 8;
+ pkt->flags |= AV_PKT_FLAG_KEY;
+ *got_packet = 1;
+ return 0;
}
AVCodec ff_cljr_encoder = {
.name = "cljr",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_CLJR,
+ .id = AV_CODEC_ID_CLJR,
.priv_data_size = sizeof(CLJRContext),
.init = common_init,
- .encode = encode_frame,
- .pix_fmts = (const enum PixelFormat[]) { PIX_FMT_YUV411P,
- PIX_FMT_NONE },
+ .encode2 = encode_frame,
+ .pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_YUV411P,
+ AV_PIX_FMT_NONE },
.long_name = NULL_IF_CONFIG_SMALL("Cirrus Logic AccuPak"),
};
#endif
diff --git a/gst-libs/ext/libav/libavcodec/cllc.c b/gst-libs/ext/libav/libavcodec/cllc.c
new file mode 100644
index 0000000..30dc53c
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/cllc.c
@@ -0,0 +1,420 @@
+/*
+ * Canopus Lossless Codec decoder
+ *
+ * Copyright (c) 2012 Derek Buitenhuis
+ *
+ * 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
+ */
+
+#include "libavutil/intreadwrite.h"
+#include "dsputil.h"
+#include "get_bits.h"
+#include "avcodec.h"
+#include "internal.h"
+
+typedef struct CLLCContext {
+ DSPContext dsp;
+ AVCodecContext *avctx;
+
+ uint8_t *swapped_buf;
+ int swapped_buf_size;
+} CLLCContext;
+
+static int read_code_table(CLLCContext *ctx, GetBitContext *gb, VLC *vlc)
+{
+ uint8_t symbols[256];
+ uint8_t bits[256];
+ uint16_t codes[256];
+ int num_lens, num_codes, num_codes_sum, prefix;
+ int i, j, count;
+
+ prefix = 0;
+ count = 0;
+ num_codes_sum = 0;
+
+ num_lens = get_bits(gb, 5);
+
+ for (i = 0; i < num_lens; i++) {
+ num_codes = get_bits(gb, 9);
+ num_codes_sum += num_codes;
+
+ if (num_codes_sum > 256) {
+ vlc->table = NULL;
+
+ av_log(ctx->avctx, AV_LOG_ERROR,
+ "Too many VLCs (%d) to be read.\n", num_codes_sum);
+ return AVERROR_INVALIDDATA;
+ }
+
+ for (j = 0; j < num_codes; j++) {
+ symbols[count] = get_bits(gb, 8);
+ bits[count] = i + 1;
+ codes[count] = prefix++;
+
+ count++;
+ }
+
+ prefix <<= 1;
+ }
+
+ return ff_init_vlc_sparse(vlc, 7, count, bits, 1, 1,
+ codes, 2, 2, symbols, 1, 1, 0);
+}
+
+/*
+ * Unlike the RGB24 read/restore, which reads in a component at a time,
+ * ARGB read/restore reads in ARGB quads.
+ */
+static int read_argb_line(CLLCContext *ctx, GetBitContext *gb, int *top_left,
+ VLC *vlc, uint8_t *outbuf)
+{
+ uint8_t *dst;
+ int pred[4];
+ int code;
+ int i;
+
+ OPEN_READER(bits, gb);
+
+ dst = outbuf;
+ pred[0] = top_left[0];
+ pred[1] = top_left[1];
+ pred[2] = top_left[2];
+ pred[3] = top_left[3];
+
+ for (i = 0; i < ctx->avctx->width; i++) {
+ /* Always get the alpha component */
+ UPDATE_CACHE(bits, gb);
+ GET_VLC(code, bits, gb, vlc[0].table, 7, 2);
+
+ pred[0] += code;
+ dst[0] = pred[0];
+
+ /* Skip the components if they are entirely transparent */
+ if (dst[0]) {
+ /* Red */
+ UPDATE_CACHE(bits, gb);
+ GET_VLC(code, bits, gb, vlc[1].table, 7, 2);
+
+ pred[1] += code;
+ dst[1] = pred[1];
+
+ /* Green */
+ UPDATE_CACHE(bits, gb);
+ GET_VLC(code, bits, gb, vlc[2].table, 7, 2);
+
+ pred[2] += code;
+ dst[2] = pred[2];
+
+ /* Blue */
+ UPDATE_CACHE(bits, gb);
+ GET_VLC(code, bits, gb, vlc[3].table, 7, 2);
+
+ pred[3] += code;
+ dst[3] = pred[3];
+ } else {
+ dst[1] = 0;
+ dst[2] = 0;
+ dst[3] = 0;
+ }
+
+ dst += 4;
+ }
+
+ CLOSE_READER(bits, gb);
+
+ dst -= 4 * ctx->avctx->width;
+ top_left[0] = dst[0];
+
+ /* Only stash components if they are not transparent */
+ if (top_left[0]) {
+ top_left[1] = dst[1];
+ top_left[2] = dst[2];
+ top_left[3] = dst[3];
+ }
+
+ return 0;
+}
+
+static int read_rgb24_component_line(CLLCContext *ctx, GetBitContext *gb,
+ int *top_left, VLC *vlc, uint8_t *outbuf)
+{
+ uint8_t *dst;
+ int pred, code;
+ int i;
+
+ OPEN_READER(bits, gb);
+
+ dst = outbuf;
+ pred = *top_left;
+
+ /* Simultaneously read and restore the line */
+ for (i = 0; i < ctx->avctx->width; i++) {
+ UPDATE_CACHE(bits, gb);
+ GET_VLC(code, bits, gb, vlc->table, 7, 2);
+
+ pred += code;
+ dst[0] = pred;
+ dst += 3;
+ }
+
+ CLOSE_READER(bits, gb);
+
+ /* Stash the first pixel */
+ *top_left = dst[-3 * ctx->avctx->width];
+
+ return 0;
+}
+
+static int decode_argb_frame(CLLCContext *ctx, GetBitContext *gb, AVFrame *pic)
+{
+ AVCodecContext *avctx = ctx->avctx;
+ uint8_t *dst;
+ int pred[4];
+ int ret;
+ int i, j;
+ VLC vlc[4];
+
+ pred[0] = 0;
+ pred[1] = 0x80;
+ pred[2] = 0x80;
+ pred[3] = 0x80;
+
+ dst = pic->data[0];
+
+ skip_bits(gb, 16);
+
+ /* Read in code table for each plane */
+ for (i = 0; i < 4; i++) {
+ ret = read_code_table(ctx, gb, &vlc[i]);
+ if (ret < 0) {
+ for (j = 0; j <= i; j++)
+ ff_free_vlc(&vlc[j]);
+
+ av_log(ctx->avctx, AV_LOG_ERROR,
+ "Could not read code table %d.\n", i);
+ return ret;
+ }
+ }
+
+ /* Read in and restore every line */
+ for (i = 0; i < avctx->height; i++) {
+ read_argb_line(ctx, gb, pred, vlc, dst);
+
+ dst += pic->linesize[0];
+ }
+
+ for (i = 0; i < 4; i++)
+ ff_free_vlc(&vlc[i]);
+
+ return 0;
+}
+
+static int decode_rgb24_frame(CLLCContext *ctx, GetBitContext *gb, AVFrame *pic)
+{
+ AVCodecContext *avctx = ctx->avctx;
+ uint8_t *dst;
+ int pred[3];
+ int ret;
+ int i, j;
+ VLC vlc[3];
+
+ pred[0] = 0x80;
+ pred[1] = 0x80;
+ pred[2] = 0x80;
+
+ dst = pic->data[0];
+
+ skip_bits(gb, 16);
+
+ /* Read in code table for each plane */
+ for (i = 0; i < 3; i++) {
+ ret = read_code_table(ctx, gb, &vlc[i]);
+ if (ret < 0) {
+ for (j = 0; j <= i; j++)
+ ff_free_vlc(&vlc[j]);
+
+ av_log(ctx->avctx, AV_LOG_ERROR,
+ "Could not read code table %d.\n", i);
+ return ret;
+ }
+ }
+
+ /* Read in and restore every line */
+ for (i = 0; i < avctx->height; i++) {
+ for (j = 0; j < 3; j++)
+ read_rgb24_component_line(ctx, gb, &pred[j], &vlc[j], &dst[j]);
+
+ dst += pic->linesize[0];
+ }
+
+ for (i = 0; i < 3; i++)
+ ff_free_vlc(&vlc[i]);
+
+ return 0;
+}
+
+static int cllc_decode_frame(AVCodecContext *avctx, void *data,
+ int *got_picture_ptr, AVPacket *avpkt)
+{
+ CLLCContext *ctx = avctx->priv_data;
+ AVFrame *pic = avctx->coded_frame;
+ uint8_t *src = avpkt->data;
+ uint32_t info_tag, info_offset;
+ int data_size;
+ GetBitContext gb;
+ int coding_type, ret;
+
+ if (pic->data[0])
+ avctx->release_buffer(avctx, pic);
+
+ pic->reference = 0;
+
+ /* Skip the INFO header if present */
+ info_offset = 0;
+ info_tag = AV_RL32(src);
+ if (info_tag == MKTAG('I', 'N', 'F', 'O')) {
+ info_offset = AV_RL32(src + 4);
+ if (info_offset > UINT32_MAX - 8 || info_offset + 8 > avpkt->size) {
+ av_log(avctx, AV_LOG_ERROR,
+ "Invalid INFO header offset: 0x%08X is too large.\n",
+ info_offset);
+ return AVERROR_INVALIDDATA;
+ }
+
+ info_offset += 8;
+ src += info_offset;
+
+ av_log(avctx, AV_LOG_DEBUG, "Skipping INFO chunk.\n");
+ }
+
+ data_size = (avpkt->size - info_offset) & ~1;
+
+ /* Make sure our bswap16'd buffer is big enough */
+ av_fast_padded_malloc(&ctx->swapped_buf,
+ &ctx->swapped_buf_size, data_size);
+ if (!ctx->swapped_buf) {
+ av_log(avctx, AV_LOG_ERROR, "Could not allocate swapped buffer.\n");
+ return AVERROR(ENOMEM);
+ }
+
+ /* bswap16 the buffer since CLLC's bitreader works in 16-bit words */
+ ctx->dsp.bswap16_buf((uint16_t *) ctx->swapped_buf, (uint16_t *) src,
+ data_size / 2);
+
+ init_get_bits(&gb, ctx->swapped_buf, data_size * 8);
+
+ /*
+ * Read in coding type. The types are as follows:
+ *
+ * 0 - YUY2
+ * 1 - BGR24 (Triples)
+ * 2 - BGR24 (Quads)
+ * 3 - BGRA
+ */
+ coding_type = (AV_RL32(src) >> 8) & 0xFF;
+ av_log(avctx, AV_LOG_DEBUG, "Frame coding type: %d\n", coding_type);
+
+ switch (coding_type) {
+ case 1:
+ case 2:
+ avctx->pix_fmt = AV_PIX_FMT_RGB24;
+ avctx->bits_per_raw_sample = 8;
+
+ ret = ff_get_buffer(avctx, pic);
+ if (ret < 0) {
+ av_log(avctx, AV_LOG_ERROR, "Could not allocate buffer.\n");
+ return ret;
+ }
+
+ ret = decode_rgb24_frame(ctx, &gb, pic);
+ if (ret < 0)
+ return ret;
+
+ break;
+ case 3:
+ avctx->pix_fmt = AV_PIX_FMT_ARGB;
+ avctx->bits_per_raw_sample = 8;
+
+ ret = ff_get_buffer(avctx, pic);
+ if (ret < 0) {
+ av_log(avctx, AV_LOG_ERROR, "Could not allocate buffer.\n");
+ return ret;
+ }
+
+ ret = decode_argb_frame(ctx, &gb, pic);
+ if (ret < 0)
+ return ret;
+
+ break;
+ default:
+ av_log(avctx, AV_LOG_ERROR, "Unknown coding type: %d.\n", coding_type);
+ return AVERROR_INVALIDDATA;
+ }
+
+ pic->key_frame = 1;
+ pic->pict_type = AV_PICTURE_TYPE_I;
+
+ *got_picture_ptr = 1;
+ *(AVFrame *)data = *pic;
+
+ return avpkt->size;
+}
+
+static av_cold int cllc_decode_close(AVCodecContext *avctx)
+{
+ CLLCContext *ctx = avctx->priv_data;
+
+ if (avctx->coded_frame->data[0])
+ avctx->release_buffer(avctx, avctx->coded_frame);
+
+ av_freep(&avctx->coded_frame);
+ av_freep(&ctx->swapped_buf);
+
+ return 0;
+}
+
+static av_cold int cllc_decode_init(AVCodecContext *avctx)
+{
+ CLLCContext *ctx = avctx->priv_data;
+
+ /* Initialize various context values */
+ ctx->avctx = avctx;
+ ctx->swapped_buf = NULL;
+ ctx->swapped_buf_size = 0;
+
+ ff_dsputil_init(&ctx->dsp, avctx);
+
+ avctx->coded_frame = avcodec_alloc_frame();
+ if (!avctx->coded_frame) {
+ av_log(avctx, AV_LOG_ERROR, "Could not allocate frame.\n");
+ return AVERROR(ENOMEM);
+ }
+
+ return 0;
+}
+
+AVCodec ff_cllc_decoder = {
+ .name = "cllc",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .id = AV_CODEC_ID_CLLC,
+ .priv_data_size = sizeof(CLLCContext),
+ .init = cllc_decode_init,
+ .decode = cllc_decode_frame,
+ .close = cllc_decode_close,
+ .capabilities = CODEC_CAP_DR1,
+ .long_name = NULL_IF_CONFIG_SMALL("Canopus Lossless Codec"),
+};
diff --git a/gst-libs/ext/libav/libavcodec/cngdec.c b/gst-libs/ext/libav/libavcodec/cngdec.c
new file mode 100644
index 0000000..6eb0e72
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/cngdec.c
@@ -0,0 +1,177 @@
+/*
+ * RFC 3389 comfort noise generator
+ * Copyright (c) 2012 Martin Storsjo
+ *
+ * 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
+ */
+
+#include <math.h>
+
+#include "libavutil/common.h"
+#include "avcodec.h"
+#include "celp_filters.h"
+#include "internal.h"
+#include "libavutil/lfg.h"
+
+typedef struct CNGContext {
+ AVFrame avframe;
+ float *refl_coef, *target_refl_coef;
+ float *lpc_coef;
+ int order;
+ int energy, target_energy;
+ int inited;
+ float *filter_out;
+ float *excitation;
+ AVLFG lfg;
+} CNGContext;
+
+static av_cold int cng_decode_close(AVCodecContext *avctx)
+{
+ CNGContext *p = avctx->priv_data;
+ av_free(p->refl_coef);
+ av_free(p->target_refl_coef);
+ av_free(p->lpc_coef);
+ av_free(p->filter_out);
+ av_free(p->excitation);
+ return 0;
+}
+
+static av_cold int cng_decode_init(AVCodecContext *avctx)
+{
+ CNGContext *p = avctx->priv_data;
+
+ avctx->sample_fmt = AV_SAMPLE_FMT_S16;
+ avctx->channels = 1;
+ avctx->sample_rate = 8000;
+
+ avcodec_get_frame_defaults(&p->avframe);
+ avctx->coded_frame = &p->avframe;
+ p->order = 12;
+ avctx->frame_size = 640;
+ p->refl_coef = av_mallocz(p->order * sizeof(*p->refl_coef));
+ p->target_refl_coef = av_mallocz(p->order * sizeof(*p->target_refl_coef));
+ p->lpc_coef = av_mallocz(p->order * sizeof(*p->lpc_coef));
+ p->filter_out = av_mallocz((avctx->frame_size + p->order) *
+ sizeof(*p->filter_out));
+ p->excitation = av_mallocz(avctx->frame_size * sizeof(*p->excitation));
+ if (!p->refl_coef || !p->target_refl_coef || !p->lpc_coef ||
+ !p->filter_out || !p->excitation) {
+ cng_decode_close(avctx);
+ return AVERROR(ENOMEM);
+ }
+
+ av_lfg_init(&p->lfg, 0);
+
+ return 0;
+}
+
+static void make_lpc_coefs(float *lpc, const float *refl, int order)
+{
+ float buf[100];
+ float *next, *cur;
+ int m, i;
+ next = buf;
+ cur = lpc;
+ for (m = 0; m < order; m++) {
+ next[m] = refl[m];
+ for (i = 0; i < m; i++)
+ next[i] = cur[i] + refl[m] * cur[m - i - 1];
+ FFSWAP(float*, next, cur);
+ }
+ if (cur != lpc)
+ memcpy(lpc, cur, sizeof(*lpc) * order);
+}
+
+static void cng_decode_flush(AVCodecContext *avctx)
+{
+ CNGContext *p = avctx->priv_data;
+ p->inited = 0;
+}
+
+static int cng_decode_frame(AVCodecContext *avctx, void *data,
+ int *got_frame_ptr, AVPacket *avpkt)
+{
+
+ CNGContext *p = avctx->priv_data;
+ int buf_size = avpkt->size;
+ int ret, i;
+ int16_t *buf_out;
+ float e = 1.0;
+ float scaling;
+
+ if (avpkt->size) {
+ int dbov = -avpkt->data[0];
+ p->target_energy = 1081109975 * pow(10, dbov / 10.0) * 0.75;
+ memset(p->target_refl_coef, 0, p->order * sizeof(*p->target_refl_coef));
+ for (i = 0; i < FFMIN(avpkt->size - 1, p->order); i++) {
+ p->target_refl_coef[i] = (avpkt->data[1 + i] - 127) / 128.0;
+ }
+ }
+
+ if (p->inited) {
+ p->energy = p->energy / 2 + p->target_energy / 2;
+ for (i = 0; i < p->order; i++)
+ p->refl_coef[i] = 0.6 *p->refl_coef[i] + 0.4 * p->target_refl_coef[i];
+ } else {
+ p->energy = p->target_energy;
+ memcpy(p->refl_coef, p->target_refl_coef, p->order * sizeof(*p->refl_coef));
+ p->inited = 1;
+ }
+ make_lpc_coefs(p->lpc_coef, p->refl_coef, p->order);
+
+ for (i = 0; i < p->order; i++)
+ e *= 1.0 - p->refl_coef[i]*p->refl_coef[i];
+
+ scaling = sqrt(e * p->energy / 1081109975);
+ for (i = 0; i < avctx->frame_size; i++) {
+ int r = (av_lfg_get(&p->lfg) & 0xffff) - 0x8000;
+ p->excitation[i] = scaling * r;
+ }
+ ff_celp_lp_synthesis_filterf(p->filter_out + p->order, p->lpc_coef,
+ p->excitation, avctx->frame_size, p->order);
+
+ p->avframe.nb_samples = avctx->frame_size;
+ if ((ret = ff_get_buffer(avctx, &p->avframe)) < 0) {
+ av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
+ return ret;
+ }
+ buf_out = (int16_t *)p->avframe.data[0];
+ for (i = 0; i < avctx->frame_size; i++)
+ buf_out[i] = p->filter_out[i + p->order];
+ memcpy(p->filter_out, p->filter_out + avctx->frame_size,
+ p->order * sizeof(*p->filter_out));
+
+ *got_frame_ptr = 1;
+ *(AVFrame *)data = p->avframe;
+
+ return buf_size;
+}
+
+AVCodec ff_comfortnoise_decoder = {
+ .name = "comfortnoise",
+ .type = AVMEDIA_TYPE_AUDIO,
+ .id = AV_CODEC_ID_COMFORT_NOISE,
+ .priv_data_size = sizeof(CNGContext),
+ .init = cng_decode_init,
+ .decode = cng_decode_frame,
+ .flush = cng_decode_flush,
+ .close = cng_decode_close,
+ .long_name = NULL_IF_CONFIG_SMALL("RFC 3389 comfort noise generator"),
+ .sample_fmts = (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_S16,
+ AV_SAMPLE_FMT_NONE },
+ .capabilities = CODEC_CAP_DELAY | CODEC_CAP_DR1,
+};
diff --git a/gst-libs/ext/libav/libavcodec/cngenc.c b/gst-libs/ext/libav/libavcodec/cngenc.c
new file mode 100644
index 0000000..a553a3f
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/cngenc.c
@@ -0,0 +1,116 @@
+/*
+ * RFC 3389 comfort noise generator
+ * Copyright (c) 2012 Martin Storsjo
+ *
+ * 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
+ */
+
+#include <math.h>
+
+#include "libavutil/common.h"
+#include "avcodec.h"
+#include "internal.h"
+#include "lpc.h"
+
+typedef struct CNGContext {
+ LPCContext lpc;
+ int order;
+ int32_t *samples32;
+ double *ref_coef;
+} CNGContext;
+
+static av_cold int cng_encode_close(AVCodecContext *avctx)
+{
+ CNGContext *p = avctx->priv_data;
+ ff_lpc_end(&p->lpc);
+ av_free(p->samples32);
+ av_free(p->ref_coef);
+ return 0;
+}
+
+static av_cold int cng_encode_init(AVCodecContext *avctx)
+{
+ CNGContext *p = avctx->priv_data;
+ int ret;
+
+ if (avctx->channels != 1) {
+ av_log(avctx, AV_LOG_ERROR, "Only mono supported\n");
+ return AVERROR(EINVAL);
+ }
+
+ avctx->frame_size = 640;
+ p->order = 10;
+ if ((ret = ff_lpc_init(&p->lpc, avctx->frame_size, p->order, FF_LPC_TYPE_LEVINSON)) < 0)
+ return ret;
+ p->samples32 = av_malloc(avctx->frame_size * sizeof(*p->samples32));
+ p->ref_coef = av_malloc(p->order * sizeof(*p->ref_coef));
+ if (!p->samples32 || !p->ref_coef) {
+ cng_encode_close(avctx);
+ return AVERROR(ENOMEM);
+ }
+
+ return 0;
+}
+
+static int cng_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
+ const AVFrame *frame, int *got_packet_ptr)
+{
+ CNGContext *p = avctx->priv_data;
+ int ret, i;
+ double energy = 0;
+ int qdbov;
+ int16_t *samples = (int16_t*) frame->data[0];
+
+ if ((ret = ff_alloc_packet(avpkt, 1 + p->order))) {
+ av_log(avctx, AV_LOG_ERROR, "Error getting output packet\n");
+ return ret;
+ }
+
+ for (i = 0; i < frame->nb_samples; i++) {
+ p->samples32[i] = samples[i];
+ energy += samples[i] * samples[i];
+ }
+ energy /= frame->nb_samples;
+ if (energy > 0) {
+ double dbov = 10 * log10(energy / 1081109975);
+ qdbov = av_clip(-floor(dbov), 0, 127);
+ } else {
+ qdbov = 127;
+ }
+ ret = ff_lpc_calc_ref_coefs(&p->lpc, p->samples32, p->order, p->ref_coef);
+ avpkt->data[0] = qdbov;
+ for (i = 0; i < p->order; i++)
+ avpkt->data[1 + i] = p->ref_coef[i] * 127 + 127;
+
+ *got_packet_ptr = 1;
+ avpkt->size = 1 + p->order;
+
+ return 0;
+}
+
+AVCodec ff_comfortnoise_encoder = {
+ .name = "comfortnoise",
+ .type = AVMEDIA_TYPE_AUDIO,
+ .id = AV_CODEC_ID_COMFORT_NOISE,
+ .priv_data_size = sizeof(CNGContext),
+ .init = cng_encode_init,
+ .encode2 = cng_encode_frame,
+ .close = cng_encode_close,
+ .long_name = NULL_IF_CONFIG_SMALL("RFC 3389 comfort noise generator"),
+ .sample_fmts = (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_S16,
+ AV_SAMPLE_FMT_NONE },
+};
diff --git a/gst-libs/ext/libav/libavcodec/codec_desc.c b/gst-libs/ext/libav/libavcodec/codec_desc.c
new file mode 100644
index 0000000..0400c31
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/codec_desc.c
@@ -0,0 +1,2215 @@
+/*
+ * 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
+ */
+
+#include <string.h>
+
+#include "avcodec.h"
+
+#include "libavutil/common.h"
+#include "libavutil/internal.h"
+
+static const AVCodecDescriptor codec_descriptors[] = {
+ /* video codecs */
+ {
+ .id = AV_CODEC_ID_MPEG1VIDEO,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "mpeg1video",
+ .long_name = NULL_IF_CONFIG_SMALL("MPEG-1 video"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_MPEG2VIDEO,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "mpeg2video",
+ .long_name = NULL_IF_CONFIG_SMALL("MPEG-1 video"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_MPEG2VIDEO_XVMC,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "mpegvideo_xvmc",
+ .long_name = NULL_IF_CONFIG_SMALL("MPEG-1/2 video XvMC (X-Video Motion Compensation)"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_H261,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "h261",
+ .long_name = NULL_IF_CONFIG_SMALL("H.261"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_H263,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "h263",
+ .long_name = NULL_IF_CONFIG_SMALL("H.263 / H.263-1996, H.263+ / H.263-1998 / H.263 version 2"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_RV10,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "rv10",
+ .long_name = NULL_IF_CONFIG_SMALL("RealVideo 1.0"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_RV20,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "rv20",
+ .long_name = NULL_IF_CONFIG_SMALL("RealVideo 1.0"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_MJPEG,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "mjpeg",
+ .long_name = NULL_IF_CONFIG_SMALL("Motion JPEG"),
+ .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_MJPEGB,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "mjpegb",
+ .long_name = NULL_IF_CONFIG_SMALL("Apple MJPEG-B"),
+ .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_LJPEG,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "ljpeg",
+ .long_name = NULL_IF_CONFIG_SMALL("Lossless JPEG"),
+ .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS,
+ },
+ {
+ .id = AV_CODEC_ID_SP5X,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "sp5x",
+ .long_name = NULL_IF_CONFIG_SMALL("Sunplus JPEG (SP5X)"),
+ .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_JPEGLS,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "jpegls",
+ .long_name = NULL_IF_CONFIG_SMALL("JPEG-LS"),
+ .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY |
+ AV_CODEC_PROP_LOSSLESS,
+ },
+ {
+ .id = AV_CODEC_ID_MPEG4,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "mpeg4",
+ .long_name = NULL_IF_CONFIG_SMALL("MPEG-4 part 2"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_RAWVIDEO,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "rawvideo",
+ .long_name = NULL_IF_CONFIG_SMALL("raw video"),
+ .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS,
+ },
+ {
+ .id = AV_CODEC_ID_MSMPEG4V1,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "msmpeg4v1",
+ .long_name = NULL_IF_CONFIG_SMALL("MPEG-4 part 2 Microsoft variant version 1"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_MSMPEG4V2,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "msmpeg4v2",
+ .long_name = NULL_IF_CONFIG_SMALL("MPEG-4 part 2 Microsoft variant version 2"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_MSMPEG4V3,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "msmpeg4v3",
+ .long_name = NULL_IF_CONFIG_SMALL("MPEG-4 part 2 Microsoft variant version 3"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_WMV1,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "wmv1",
+ .long_name = NULL_IF_CONFIG_SMALL("Windows Media Video 7"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_WMV2,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "wmv2",
+ .long_name = NULL_IF_CONFIG_SMALL("Windows Media Video 8"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_H263P,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "h263p",
+ .long_name = NULL_IF_CONFIG_SMALL("H.263+ / H.263-1998 / H.263 version 2"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_H263I,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "h263i",
+ .long_name = NULL_IF_CONFIG_SMALL("Intel H.263"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_FLV1,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "flv1",
+ .long_name = NULL_IF_CONFIG_SMALL("FLV / Sorenson Spark / Sorenson H.263 (Flash Video)"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_SVQ1,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "svq1",
+ .long_name = NULL_IF_CONFIG_SMALL("Sorenson Vector Quantizer 1 / Sorenson Video 1 / SVQ1"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_SVQ3,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "svq3",
+ .long_name = NULL_IF_CONFIG_SMALL("Sorenson Vector Quantizer 3 / Sorenson Video 3 / SVQ3"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_DVVIDEO,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "dvvideo",
+ .long_name = NULL_IF_CONFIG_SMALL("DV (Digital Video)"),
+ .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_HUFFYUV,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "huffyuv",
+ .long_name = NULL_IF_CONFIG_SMALL("HuffYUV"),
+ .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS,
+ },
+ {
+ .id = AV_CODEC_ID_CYUV,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "cyuv",
+ .long_name = NULL_IF_CONFIG_SMALL("Creative YUV (CYUV)"),
+ .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_H264,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "h264",
+ .long_name = NULL_IF_CONFIG_SMALL("H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10"),
+ .props = AV_CODEC_PROP_LOSSY | AV_CODEC_PROP_LOSSLESS,
+ },
+ {
+ .id = AV_CODEC_ID_INDEO3,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "indeo3",
+ .long_name = NULL_IF_CONFIG_SMALL("Intel Indeo 3"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_VP3,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "vp3",
+ .long_name = NULL_IF_CONFIG_SMALL("On2 VP3"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_THEORA,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "theora",
+ .long_name = NULL_IF_CONFIG_SMALL("Theora"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_ASV1,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "asv1",
+ .long_name = NULL_IF_CONFIG_SMALL("ASUS V1"),
+ .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_ASV2,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "asv2",
+ .long_name = NULL_IF_CONFIG_SMALL("ASUS V2"),
+ .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_FFV1,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "ffv1",
+ .long_name = NULL_IF_CONFIG_SMALL("FFmpeg video codec #1"),
+ .props = AV_CODEC_PROP_LOSSLESS,
+ },
+ {
+ .id = AV_CODEC_ID_4XM,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "4xm",
+ .long_name = NULL_IF_CONFIG_SMALL("4X Movie"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_VCR1,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "vcr1",
+ .long_name = NULL_IF_CONFIG_SMALL("ATI VCR1"),
+ .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_CLJR,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "cljr",
+ .long_name = NULL_IF_CONFIG_SMALL("Cirrus Logic AccuPak"),
+ .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_MDEC,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "mdec",
+ .long_name = NULL_IF_CONFIG_SMALL("Sony PlayStation MDEC (Motion DECoder)"),
+ .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_ROQ,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "roq",
+ .long_name = NULL_IF_CONFIG_SMALL("id RoQ video"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_INTERPLAY_VIDEO,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "interplayvideo",
+ .long_name = NULL_IF_CONFIG_SMALL("Interplay MVE video"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_XAN_WC3,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "xan_wc3",
+ .long_name = NULL_IF_CONFIG_SMALL("Wing Commander III / Xan"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_XAN_WC4,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "xan_wc4",
+ .long_name = NULL_IF_CONFIG_SMALL("Wing Commander IV / Xxan"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_RPZA,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "rpza",
+ .long_name = NULL_IF_CONFIG_SMALL("QuickTime video (RPZA)"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_CINEPAK,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "cinepak",
+ .long_name = NULL_IF_CONFIG_SMALL("Cinepak"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_WS_VQA,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "ws_vqa",
+ .long_name = NULL_IF_CONFIG_SMALL("Westwood Studios VQA (Vector Quantized Animation) video"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_MSRLE,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "msrle",
+ .long_name = NULL_IF_CONFIG_SMALL("Microsoft RLE"),
+ .props = AV_CODEC_PROP_LOSSLESS,
+ },
+ {
+ .id = AV_CODEC_ID_MSVIDEO1,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "msvideo1",
+ .long_name = NULL_IF_CONFIG_SMALL("Microsoft Video 1"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_IDCIN,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "idcin",
+ .long_name = NULL_IF_CONFIG_SMALL("id Quake II CIN video"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_8BPS,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "8bps",
+ .long_name = NULL_IF_CONFIG_SMALL("QuickTime 8BPS video"),
+ .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS,
+ },
+ {
+ .id = AV_CODEC_ID_SMC,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "smc",
+ .long_name = NULL_IF_CONFIG_SMALL("QuickTime Graphics (SMC)"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_FLIC,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "flic",
+ .long_name = NULL_IF_CONFIG_SMALL("Autodesk Animator Flic video"),
+ .props = AV_CODEC_PROP_LOSSLESS,
+ },
+ {
+ .id = AV_CODEC_ID_TRUEMOTION1,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "truemotion1",
+ .long_name = NULL_IF_CONFIG_SMALL("Duck TrueMotion 1.0"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_VMDVIDEO,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "vmdvideo",
+ .long_name = NULL_IF_CONFIG_SMALL("Sierra VMD video"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_MSZH,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "mszh",
+ .long_name = NULL_IF_CONFIG_SMALL("LCL (LossLess Codec Library) MSZH"),
+ .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS,
+ },
+ {
+ .id = AV_CODEC_ID_ZLIB,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "zlib",
+ .long_name = NULL_IF_CONFIG_SMALL("LCL (LossLess Codec Library) ZLIB"),
+ .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS,
+ },
+ {
+ .id = AV_CODEC_ID_QTRLE,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "qtrle",
+ .long_name = NULL_IF_CONFIG_SMALL("QuickTime Animation (RLE) video"),
+ .props = AV_CODEC_PROP_LOSSLESS,
+ },
+ {
+ .id = AV_CODEC_ID_SNOW,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "snow",
+ .long_name = NULL_IF_CONFIG_SMALL("Snow"),
+ .props = AV_CODEC_PROP_LOSSY | AV_CODEC_PROP_LOSSLESS,
+ },
+ {
+ .id = AV_CODEC_ID_TSCC,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "tscc",
+ .long_name = NULL_IF_CONFIG_SMALL("TechSmith Screen Capture Codec"),
+ .props = AV_CODEC_PROP_LOSSLESS,
+ },
+ {
+ .id = AV_CODEC_ID_ULTI,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "ulti",
+ .long_name = NULL_IF_CONFIG_SMALL("IBM UltiMotion"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_QDRAW,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "qdraw",
+ .long_name = NULL_IF_CONFIG_SMALL("Apple QuickDraw"),
+ .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS,
+ },
+ {
+ .id = AV_CODEC_ID_VIXL,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "vixl",
+ .long_name = NULL_IF_CONFIG_SMALL("Miro VideoXL"),
+ .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_QPEG,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "qpeg",
+ .long_name = NULL_IF_CONFIG_SMALL("Q-team QPEG"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_PNG,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "png",
+ .long_name = NULL_IF_CONFIG_SMALL("PNG (Portable Network Graphics) image"),
+ .props = AV_CODEC_PROP_LOSSLESS,
+ },
+ {
+ .id = AV_CODEC_ID_PPM,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "ppm",
+ .long_name = NULL_IF_CONFIG_SMALL("PPM (Portable PixelMap) image"),
+ .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS,
+ },
+ {
+ .id = AV_CODEC_ID_PBM,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "pbm",
+ .long_name = NULL_IF_CONFIG_SMALL("PBM (Portable BitMap) image"),
+ .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS,
+ },
+ {
+ .id = AV_CODEC_ID_PGM,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "pgm",
+ .long_name = NULL_IF_CONFIG_SMALL("PGM (Portable GrayMap) image"),
+ .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS,
+ },
+ {
+ .id = AV_CODEC_ID_PGMYUV,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "pgmyuv",
+ .long_name = NULL_IF_CONFIG_SMALL("PGMYUV (Portable GrayMap YUV) image"),
+ .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS,
+ },
+ {
+ .id = AV_CODEC_ID_PAM,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "pam",
+ .long_name = NULL_IF_CONFIG_SMALL("PAM (Portable AnyMap) image"),
+ .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS,
+ },
+ {
+ .id = AV_CODEC_ID_FFVHUFF,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "ffvhuff",
+ .long_name = NULL_IF_CONFIG_SMALL("Huffyuv FFmpeg variant"),
+ .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS,
+ },
+ {
+ .id = AV_CODEC_ID_RV30,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "rv30",
+ .long_name = NULL_IF_CONFIG_SMALL("RealVideo 3.0"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_RV40,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "rv40",
+ .long_name = NULL_IF_CONFIG_SMALL("RealVideo 4.0"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_VC1,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "vc1",
+ .long_name = NULL_IF_CONFIG_SMALL("SMPTE VC-1"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_WMV3,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "wmv3",
+ .long_name = NULL_IF_CONFIG_SMALL("Windows Media Video 9"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_LOCO,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "loco",
+ .long_name = NULL_IF_CONFIG_SMALL("LOCO"),
+ .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS,
+ },
+ {
+ .id = AV_CODEC_ID_WNV1,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "wnv1",
+ .long_name = NULL_IF_CONFIG_SMALL("Winnov WNV1"),
+ .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_AASC,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "aasc",
+ .long_name = NULL_IF_CONFIG_SMALL("Autodesk RLE"),
+ .props = AV_CODEC_PROP_LOSSLESS,
+ },
+ {
+ .id = AV_CODEC_ID_INDEO2,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "indeo2",
+ .long_name = NULL_IF_CONFIG_SMALL("Intel Indeo 2"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_FRAPS,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "fraps",
+ .long_name = NULL_IF_CONFIG_SMALL("Fraps"),
+ .props = AV_CODEC_PROP_LOSSLESS,
+ },
+ {
+ .id = AV_CODEC_ID_TRUEMOTION2,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "truemotion2",
+ .long_name = NULL_IF_CONFIG_SMALL("Duck TrueMotion 2.0"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_BMP,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "bmp",
+ .long_name = NULL_IF_CONFIG_SMALL("BMP (Windows and OS/2 bitmap)"),
+ .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS,
+ },
+ {
+ .id = AV_CODEC_ID_CSCD,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "cscd",
+ .long_name = NULL_IF_CONFIG_SMALL("CamStudio"),
+ .props = AV_CODEC_PROP_LOSSLESS,
+ },
+ {
+ .id = AV_CODEC_ID_MMVIDEO,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "mmvideo",
+ .long_name = NULL_IF_CONFIG_SMALL("American Laser Games MM Video"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_ZMBV,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "zmbv",
+ .long_name = NULL_IF_CONFIG_SMALL("Zip Motion Blocks Video"),
+ .props = AV_CODEC_PROP_LOSSLESS,
+ },
+ {
+ .id = AV_CODEC_ID_AVS,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "avs",
+ .long_name = NULL_IF_CONFIG_SMALL("AVS (Audio Video Standard) video"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_SMACKVIDEO,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "smackvideo",
+ .long_name = NULL_IF_CONFIG_SMALL("Smacker video"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_NUV,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "nuv",
+ .long_name = NULL_IF_CONFIG_SMALL("NuppelVideo/RTJPEG"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_KMVC,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "kmvc",
+ .long_name = NULL_IF_CONFIG_SMALL("Karl Morton's video codec"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_FLASHSV,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "flashsv",
+ .long_name = NULL_IF_CONFIG_SMALL("Flash Screen Video v1"),
+ .props = AV_CODEC_PROP_LOSSLESS,
+ },
+ {
+ .id = AV_CODEC_ID_CAVS,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "cavs",
+ .long_name = NULL_IF_CONFIG_SMALL("Chinese AVS (Audio Video Standard) (AVS1-P2, JiZhun profile)"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_JPEG2000,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "jpeg2000",
+ .long_name = NULL_IF_CONFIG_SMALL("JPEG 2000"),
+ .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY |
+ AV_CODEC_PROP_LOSSLESS,
+ },
+ {
+ .id = AV_CODEC_ID_VMNC,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "vmnc",
+ .long_name = NULL_IF_CONFIG_SMALL("VMware Screen Codec / VMware Video"),
+ .props = AV_CODEC_PROP_LOSSLESS,
+ },
+ {
+ .id = AV_CODEC_ID_VP5,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "vp5",
+ .long_name = NULL_IF_CONFIG_SMALL("On2 VP5"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_VP6,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "vp6",
+ .long_name = NULL_IF_CONFIG_SMALL("On2 VP6"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_VP6F,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "vp6f",
+ .long_name = NULL_IF_CONFIG_SMALL("On2 VP6 (Flash version)"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_TARGA,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "targa",
+ .long_name = NULL_IF_CONFIG_SMALL("Truevision Targa image"),
+ .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS,
+ },
+ {
+ .id = AV_CODEC_ID_DSICINVIDEO,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "dsicinvideo",
+ .long_name = NULL_IF_CONFIG_SMALL("Delphine Software International CIN video"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_TIERTEXSEQVIDEO,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "tiertexseqvideo",
+ .long_name = NULL_IF_CONFIG_SMALL("Tiertex Limited SEQ video"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_TIFF,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "tiff",
+ .long_name = NULL_IF_CONFIG_SMALL("TIFF image"),
+ .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS,
+ },
+ {
+ .id = AV_CODEC_ID_GIF,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "gif",
+ .long_name = NULL_IF_CONFIG_SMALL("GIF (Graphics Interchange Format)"),
+ .props = AV_CODEC_PROP_LOSSLESS,
+ },
+ {
+ .id = AV_CODEC_ID_DXA,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "dxa",
+ .long_name = NULL_IF_CONFIG_SMALL("Feeble Files/ScummVM DXA"),
+ .props = AV_CODEC_PROP_LOSSLESS,
+ },
+ {
+ .id = AV_CODEC_ID_DNXHD,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "dnxhd",
+ .long_name = NULL_IF_CONFIG_SMALL("VC3/DNxHD"),
+ .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_THP,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "thp",
+ .long_name = NULL_IF_CONFIG_SMALL("Nintendo Gamecube THP video"),
+ .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_SGI,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "sgi",
+ .long_name = NULL_IF_CONFIG_SMALL("SGI image"),
+ .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_C93,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "c93",
+ .long_name = NULL_IF_CONFIG_SMALL("Interplay C93"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_BETHSOFTVID,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "bethsoftvid",
+ .long_name = NULL_IF_CONFIG_SMALL("Bethesda VID video"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_PTX,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "ptx",
+ .long_name = NULL_IF_CONFIG_SMALL("V.Flash PTX image"),
+ .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_TXD,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "txd",
+ .long_name = NULL_IF_CONFIG_SMALL("Renderware TXD (TeXture Dictionary) image"),
+ .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_VP6A,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "vp6a",
+ .long_name = NULL_IF_CONFIG_SMALL("On2 VP6 (Flash version, with alpha channel)"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_AMV,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "amv",
+ .long_name = NULL_IF_CONFIG_SMALL("AMV Video"),
+ .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_VB,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "vb",
+ .long_name = NULL_IF_CONFIG_SMALL("Beam Software VB"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_PCX,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "pcx",
+ .long_name = NULL_IF_CONFIG_SMALL("PC Paintbrush PCX image"),
+ .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS,
+ },
+ {
+ .id = AV_CODEC_ID_SUNRAST,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "sunrast",
+ .long_name = NULL_IF_CONFIG_SMALL("Sun Rasterfile image"),
+ .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS,
+ },
+ {
+ .id = AV_CODEC_ID_INDEO4,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "indeo4",
+ .long_name = NULL_IF_CONFIG_SMALL("Intel Indeo Video Interactive 4"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_INDEO5,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "indeo5",
+ .long_name = NULL_IF_CONFIG_SMALL("Intel Indeo Video Interactive 5"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_MIMIC,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "mimic",
+ .long_name = NULL_IF_CONFIG_SMALL("Mimic"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_RL2,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "rl2",
+ .long_name = NULL_IF_CONFIG_SMALL("RL2 video"),
+ .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_ESCAPE124,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "escape124",
+ .long_name = NULL_IF_CONFIG_SMALL("Escape 124"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_DIRAC,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "dirac",
+ .long_name = NULL_IF_CONFIG_SMALL("Dirac"),
+ .props = AV_CODEC_PROP_LOSSY | AV_CODEC_PROP_LOSSLESS,
+ },
+ {
+ .id = AV_CODEC_ID_BFI,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "bfi",
+ .long_name = NULL_IF_CONFIG_SMALL("Brute Force & Ignorance"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_CMV,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "cmv",
+ .long_name = NULL_IF_CONFIG_SMALL("Electronic Arts CMV video"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_MOTIONPIXELS,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "motionpixels",
+ .long_name = NULL_IF_CONFIG_SMALL("Motion Pixels video"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_TGV,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "tgv",
+ .long_name = NULL_IF_CONFIG_SMALL("Electronic Arts TGV video"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_TGQ,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "tgq",
+ .long_name = NULL_IF_CONFIG_SMALL("Electronic Arts TGQ video"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_TQI,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "tqi",
+ .long_name = NULL_IF_CONFIG_SMALL("Electronic Arts TQI video"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_AURA,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "aura",
+ .long_name = NULL_IF_CONFIG_SMALL("Auravision AURA"),
+ .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_AURA2,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "aura2",
+ .long_name = NULL_IF_CONFIG_SMALL("Auravision Aura 2"),
+ .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_V210X,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "v210x",
+ .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS,
+ },
+ {
+ .id = AV_CODEC_ID_TMV,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "tmv",
+ .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_V210,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "v210",
+ .long_name = NULL_IF_CONFIG_SMALL("Uncompressed 4:2:2 10-bit"),
+ .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS,
+ },
+ {
+ .id = AV_CODEC_ID_DPX,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "dpx",
+ .long_name = NULL_IF_CONFIG_SMALL("DPX image"),
+ .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_MAD,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "mad",
+ .long_name = NULL_IF_CONFIG_SMALL("Electronic Arts Madcow Video"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_FRWU,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "frwu",
+ .long_name = NULL_IF_CONFIG_SMALL("Forward Uncompressed"),
+ .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS,
+ },
+ {
+ .id = AV_CODEC_ID_FLASHSV2,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "flashsv2",
+ .long_name = NULL_IF_CONFIG_SMALL("Flash Screen Video v2"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_CDGRAPHICS,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "cdgraphics",
+ .long_name = NULL_IF_CONFIG_SMALL("CD Graphics video"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_R210,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "r210",
+ .long_name = NULL_IF_CONFIG_SMALL("Uncompressed RGB 10-bit"),
+ .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS,
+ },
+ {
+ .id = AV_CODEC_ID_ANM,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "anm",
+ .long_name = NULL_IF_CONFIG_SMALL("Deluxe Paint Animation"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_BINKVIDEO,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "binkvideo",
+ .long_name = NULL_IF_CONFIG_SMALL("Bink video"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_IFF_ILBM,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "iff_ilbm",
+ .long_name = NULL_IF_CONFIG_SMALL("IFF ILBM"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_IFF_BYTERUN1,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "iff_byterun1",
+ .long_name = NULL_IF_CONFIG_SMALL("IFF ByteRun1"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_KGV1,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "kgv1",
+ .long_name = NULL_IF_CONFIG_SMALL("Kega Game Video"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_YOP,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "yop",
+ .long_name = NULL_IF_CONFIG_SMALL("Psygnosis YOP Video"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_VP8,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "vp8",
+ .long_name = NULL_IF_CONFIG_SMALL("On2 VP8"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_PICTOR,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "pictor",
+ .long_name = NULL_IF_CONFIG_SMALL("Pictor/PC Paint"),
+ .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_ANSI,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "ansi",
+ .long_name = NULL_IF_CONFIG_SMALL("ASCII/ANSI art"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_A64_MULTI,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "a64_multi",
+ .long_name = NULL_IF_CONFIG_SMALL("Multicolor charset for Commodore 64"),
+ .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_A64_MULTI5,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "a64_multi5",
+ .long_name = NULL_IF_CONFIG_SMALL("Multicolor charset for Commodore 64, extended with 5th color (colram)"),
+ .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_R10K,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "r10k",
+ .long_name = NULL_IF_CONFIG_SMALL("AJA Kona 10-bit RGB Codec"),
+ .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS,
+ },
+ {
+ .id = AV_CODEC_ID_MXPEG,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "mxpeg",
+ .long_name = NULL_IF_CONFIG_SMALL("Mobotix MxPEG video"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_LAGARITH,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "lagarith",
+ .long_name = NULL_IF_CONFIG_SMALL("Lagarith lossless"),
+ .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS,
+ },
+ {
+ .id = AV_CODEC_ID_PRORES,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "prores",
+ .long_name = NULL_IF_CONFIG_SMALL("Apple ProRes (iCodec Pro)"),
+ .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_JV,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "jv",
+ .long_name = NULL_IF_CONFIG_SMALL("Bitmap Brothers JV video"),
+ .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_DFA,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "dfa",
+ .long_name = NULL_IF_CONFIG_SMALL("Chronomaster DFA"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_WMV3IMAGE,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "wmv3image",
+ .long_name = NULL_IF_CONFIG_SMALL("Windows Media Video 9 Image"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_VC1IMAGE,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "vc1image",
+ .long_name = NULL_IF_CONFIG_SMALL("Windows Media Video 9 Image v2"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_UTVIDEO,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "utvideo",
+ .long_name = NULL_IF_CONFIG_SMALL("Ut Video"),
+ .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS,
+ },
+ {
+ .id = AV_CODEC_ID_BMV_VIDEO,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "bmv_video",
+ .long_name = NULL_IF_CONFIG_SMALL("Discworld II BMV video"),
+ .props = AV_CODEC_PROP_LOSSLESS,
+ },
+ {
+ .id = AV_CODEC_ID_VBLE,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "vble",
+ .long_name = NULL_IF_CONFIG_SMALL("VBLE Lossless Codec"),
+ .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS,
+ },
+ {
+ .id = AV_CODEC_ID_DXTORY,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "dxtory",
+ .long_name = NULL_IF_CONFIG_SMALL("Dxtory"),
+ .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS,
+ },
+ {
+ .id = AV_CODEC_ID_V410,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "v410",
+ .long_name = NULL_IF_CONFIG_SMALL("Uncompressed 4:4:4 10-bit"),
+ .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS,
+ },
+ {
+ .id = AV_CODEC_ID_XWD,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "xwd",
+ .long_name = NULL_IF_CONFIG_SMALL("XWD (X Window Dump) image"),
+ .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS,
+ },
+ {
+ .id = AV_CODEC_ID_CDXL,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "cdxl",
+ .long_name = NULL_IF_CONFIG_SMALL("Commodore CDXL video"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_XBM,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "xbm",
+ .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS,
+ },
+ {
+ .id = AV_CODEC_ID_ZEROCODEC,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "zerocodec",
+ .long_name = NULL_IF_CONFIG_SMALL("ZeroCodec Lossless Video"),
+ .props = AV_CODEC_PROP_LOSSLESS,
+ },
+ {
+ .id = AV_CODEC_ID_MSS1,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "mss1",
+ .long_name = NULL_IF_CONFIG_SMALL("MS Screen 1"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_MSA1,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "msa1",
+ .long_name = NULL_IF_CONFIG_SMALL("MS ATC Screen"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_TSCC2,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "tscc2",
+ .long_name = NULL_IF_CONFIG_SMALL("TechSmith Screen Codec 2"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_MTS2,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "mts2",
+ .long_name = NULL_IF_CONFIG_SMALL("MS Expression Encoder Screen"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_CLLC,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "cllc",
+ .long_name = NULL_IF_CONFIG_SMALL("Canopus Lossless Codec"),
+ .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS,
+ },
+ {
+ .id = AV_CODEC_ID_MSS2,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "mss2",
+ .long_name = NULL_IF_CONFIG_SMALL("MS Windows Media Video V9 Screen"),
+ .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY,
+ },
+
+ /* various PCM "codecs" */
+ {
+ .id = AV_CODEC_ID_PCM_S16LE,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "pcm_s16le",
+ .long_name = NULL_IF_CONFIG_SMALL("PCM signed 16-bit little-endian"),
+ .props = AV_CODEC_PROP_LOSSLESS,
+ },
+ {
+ .id = AV_CODEC_ID_PCM_S16BE,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "pcm_s16be",
+ .long_name = NULL_IF_CONFIG_SMALL("PCM signed 16-bit big-endian"),
+ .props = AV_CODEC_PROP_LOSSLESS,
+ },
+ {
+ .id = AV_CODEC_ID_PCM_U16LE,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "pcm_u16le",
+ .long_name = NULL_IF_CONFIG_SMALL("PCM unsigned 16-bit little-endian"),
+ .props = AV_CODEC_PROP_LOSSLESS,
+ },
+ {
+ .id = AV_CODEC_ID_PCM_U16BE,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "pcm_u16be",
+ .long_name = NULL_IF_CONFIG_SMALL("PCM unsigned 16-bit big-endian"),
+ .props = AV_CODEC_PROP_LOSSLESS,
+ },
+ {
+ .id = AV_CODEC_ID_PCM_S8,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "pcm_s8",
+ .long_name = NULL_IF_CONFIG_SMALL("PCM signed 8-bit"),
+ .props = AV_CODEC_PROP_LOSSLESS,
+ },
+ {
+ .id = AV_CODEC_ID_PCM_U8,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "pcm_u8",
+ .long_name = NULL_IF_CONFIG_SMALL("PCM unsigned 8-bit"),
+ .props = AV_CODEC_PROP_LOSSLESS,
+ },
+ {
+ .id = AV_CODEC_ID_PCM_MULAW,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "pcm_mulaw",
+ .long_name = NULL_IF_CONFIG_SMALL("PCM mu-law"),
+ },
+ {
+ .id = AV_CODEC_ID_PCM_ALAW,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "pcm_alaw",
+ .long_name = NULL_IF_CONFIG_SMALL("PCM A-law"),
+ },
+ {
+ .id = AV_CODEC_ID_PCM_S32LE,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "pcm_s32le",
+ .long_name = NULL_IF_CONFIG_SMALL("PCM signed 32-bit little-endian"),
+ .props = AV_CODEC_PROP_LOSSLESS,
+ },
+ {
+ .id = AV_CODEC_ID_PCM_S32BE,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "pcm_s32be",
+ .long_name = NULL_IF_CONFIG_SMALL("PCM signed 32-bit big-endian"),
+ .props = AV_CODEC_PROP_LOSSLESS,
+ },
+ {
+ .id = AV_CODEC_ID_PCM_U32LE,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "pcm_u32le",
+ .long_name = NULL_IF_CONFIG_SMALL("PCM unsigned 32-bit little-endian"),
+ .props = AV_CODEC_PROP_LOSSLESS,
+ },
+ {
+ .id = AV_CODEC_ID_PCM_U32BE,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "pcm_u32be",
+ .long_name = NULL_IF_CONFIG_SMALL("PCM unsigned 32-bit big-endian"),
+ .props = AV_CODEC_PROP_LOSSLESS,
+ },
+ {
+ .id = AV_CODEC_ID_PCM_S24LE,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "pcm_s24le",
+ .long_name = NULL_IF_CONFIG_SMALL("PCM signed 24-bit little-endian"),
+ .props = AV_CODEC_PROP_LOSSLESS,
+ },
+ {
+ .id = AV_CODEC_ID_PCM_S24BE,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "pcm_s24be",
+ .long_name = NULL_IF_CONFIG_SMALL("PCM signed 24-bit big-endian"),
+ .props = AV_CODEC_PROP_LOSSLESS,
+ },
+ {
+ .id = AV_CODEC_ID_PCM_U24LE,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "pcm_u24le",
+ .long_name = NULL_IF_CONFIG_SMALL("PCM unsigned 24-bit little-endian"),
+ .props = AV_CODEC_PROP_LOSSLESS,
+ },
+ {
+ .id = AV_CODEC_ID_PCM_U24BE,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "pcm_u24be",
+ .long_name = NULL_IF_CONFIG_SMALL("PCM unsigned 24-bit big-endian"),
+ .props = AV_CODEC_PROP_LOSSLESS,
+ },
+ {
+ .id = AV_CODEC_ID_PCM_S24DAUD,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "pcm_s24daud",
+ .long_name = NULL_IF_CONFIG_SMALL("PCM D-Cinema audio signed 24-bit"),
+ .props = AV_CODEC_PROP_LOSSLESS,
+ },
+ {
+ .id = AV_CODEC_ID_PCM_ZORK,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "pcm_zork",
+ .long_name = NULL_IF_CONFIG_SMALL("PCM Zork"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_PCM_S16LE_PLANAR,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "pcm_s16le_planar",
+ .long_name = NULL_IF_CONFIG_SMALL("PCM 16-bit little-endian planar"),
+ .props = AV_CODEC_PROP_LOSSLESS,
+ },
+ {
+ .id = AV_CODEC_ID_PCM_DVD,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "pcm_dvd",
+ .long_name = NULL_IF_CONFIG_SMALL("PCM signed 20|24-bit big-endian"),
+ .props = AV_CODEC_PROP_LOSSLESS,
+ },
+ {
+ .id = AV_CODEC_ID_PCM_F32BE,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "pcm_f32be",
+ .long_name = NULL_IF_CONFIG_SMALL("PCM 32-bit floating point big-endian"),
+ .props = AV_CODEC_PROP_LOSSLESS,
+ },
+ {
+ .id = AV_CODEC_ID_PCM_F32LE,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "pcm_f32le",
+ .long_name = NULL_IF_CONFIG_SMALL("PCM 32-bit floating point little-endian"),
+ .props = AV_CODEC_PROP_LOSSLESS,
+ },
+ {
+ .id = AV_CODEC_ID_PCM_F64BE,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "pcm_f64be",
+ .long_name = NULL_IF_CONFIG_SMALL("PCM 64-bit floating point big-endian"),
+ .props = AV_CODEC_PROP_LOSSLESS,
+ },
+ {
+ .id = AV_CODEC_ID_PCM_F64LE,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "pcm_f64le",
+ .long_name = NULL_IF_CONFIG_SMALL("PCM 64-bit floating point little-endian"),
+ .props = AV_CODEC_PROP_LOSSLESS,
+ },
+ {
+ .id = AV_CODEC_ID_PCM_BLURAY,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "pcm_bluray",
+ .long_name = NULL_IF_CONFIG_SMALL("PCM signed 16|20|24-bit big-endian for Blu-ray media"),
+ .props = AV_CODEC_PROP_LOSSLESS,
+ },
+ {
+ .id = AV_CODEC_ID_PCM_LXF,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "pcm_lxf",
+ .long_name = NULL_IF_CONFIG_SMALL("PCM signed 20-bit little-endian planar"),
+ .props = AV_CODEC_PROP_LOSSLESS,
+ },
+ {
+ .id = AV_CODEC_ID_S302M,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "s302m",
+ .long_name = NULL_IF_CONFIG_SMALL("SMPTE 302M"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_PCM_S8_PLANAR,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "pcm_s8_planar",
+ .long_name = NULL_IF_CONFIG_SMALL("PCM signed 8-bit planar"),
+ .props = AV_CODEC_PROP_LOSSLESS,
+ },
+
+ /* various ADPCM codecs */
+ {
+ .id = AV_CODEC_ID_ADPCM_IMA_QT,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "adpcm_ima_qt",
+ .long_name = NULL_IF_CONFIG_SMALL("ADPCM IMA QuickTime"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_ADPCM_IMA_WAV,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "adpcm_ima_wav",
+ .long_name = NULL_IF_CONFIG_SMALL("ADPCM IMA WAV"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_ADPCM_IMA_DK3,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "adpcm_ima_dk3",
+ .long_name = NULL_IF_CONFIG_SMALL("ADPCM IMA Duck DK3"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_ADPCM_IMA_DK4,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "adpcm_ima_dk4",
+ .long_name = NULL_IF_CONFIG_SMALL("ADPCM IMA Duck DK4"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_ADPCM_IMA_WS,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "adpcm_ima_ws",
+ .long_name = NULL_IF_CONFIG_SMALL("ADPCM IMA Westwood"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_ADPCM_IMA_SMJPEG,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "adpcm_ima_smjpeg",
+ .long_name = NULL_IF_CONFIG_SMALL("ADPCM IMA Loki SDL MJPEG"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_ADPCM_MS,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "adpcm_ms",
+ .long_name = NULL_IF_CONFIG_SMALL("ADPCM Microsoft"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_ADPCM_4XM,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "adpcm_4xm",
+ .long_name = NULL_IF_CONFIG_SMALL("ADPCM 4X Movie"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_ADPCM_XA,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "adpcm_xa",
+ .long_name = NULL_IF_CONFIG_SMALL("ADPCM CDROM XA"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_ADPCM_ADX,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "adpcm_adx",
+ .long_name = NULL_IF_CONFIG_SMALL("SEGA CRI ADX ADPCM"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_ADPCM_EA,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "adpcm_ea",
+ .long_name = NULL_IF_CONFIG_SMALL("ADPCM Electronic Arts"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_ADPCM_G726,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "adpcm_g726",
+ .long_name = NULL_IF_CONFIG_SMALL("G.726 ADPCM"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_ADPCM_CT,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "adpcm_ct",
+ .long_name = NULL_IF_CONFIG_SMALL("ADPCM Creative Technology"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_ADPCM_SWF,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "adpcm_swf",
+ .long_name = NULL_IF_CONFIG_SMALL("ADPCM Shockwave Flash"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_ADPCM_YAMAHA,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "adpcm_yamaha",
+ .long_name = NULL_IF_CONFIG_SMALL("ADPCM Yamaha"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_ADPCM_SBPRO_4,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "adpcm_sbpro_4",
+ .long_name = NULL_IF_CONFIG_SMALL("ADPCM Sound Blaster Pro 4-bit"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_ADPCM_SBPRO_3,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "adpcm_sbpro_3",
+ .long_name = NULL_IF_CONFIG_SMALL("ADPCM Sound Blaster Pro 2.6-bit"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_ADPCM_SBPRO_2,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "adpcm_sbpro_2",
+ .long_name = NULL_IF_CONFIG_SMALL("ADPCM Sound Blaster Pro 2-bit"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_ADPCM_THP,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "adpcm_thp",
+ .long_name = NULL_IF_CONFIG_SMALL("ADPCM Nintendo Gamecube THP"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_ADPCM_IMA_AMV,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "adpcm_ima_amv",
+ .long_name = NULL_IF_CONFIG_SMALL("ADPCM IMA AMV"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_ADPCM_EA_R1,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "adpcm_ea_r1",
+ .long_name = NULL_IF_CONFIG_SMALL("ADPCM Electronic Arts R1"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_ADPCM_EA_R3,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "adpcm_ea_r3",
+ .long_name = NULL_IF_CONFIG_SMALL("ADPCM Electronic Arts R3"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_ADPCM_EA_R2,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "adpcm_ea_r2",
+ .long_name = NULL_IF_CONFIG_SMALL("ADPCM Electronic Arts R2"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_ADPCM_IMA_EA_SEAD,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "adpcm_ima_ea_sead",
+ .long_name = NULL_IF_CONFIG_SMALL("ADPCM IMA Electronic Arts SEAD"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_ADPCM_IMA_EA_EACS,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "adpcm_ima_ea_eacs",
+ .long_name = NULL_IF_CONFIG_SMALL("ADPCM IMA Electronic Arts EACS"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_ADPCM_EA_XAS,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "adpcm_ea_xas",
+ .long_name = NULL_IF_CONFIG_SMALL("ADPCM Electronic Arts XAS"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_ADPCM_EA_MAXIS_XA,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "adpcm_ea_maxis_xa",
+ .long_name = NULL_IF_CONFIG_SMALL("ADPCM Electronic Arts Maxis CDROM XA"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_ADPCM_IMA_ISS,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "adpcm_ima_iss",
+ .long_name = NULL_IF_CONFIG_SMALL("ADPCM IMA Funcom ISS"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_ADPCM_G722,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "adpcm_g722",
+ .long_name = NULL_IF_CONFIG_SMALL("G.722 ADPCM"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_ADPCM_IMA_APC,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "adpcm_ima_apc",
+ .long_name = NULL_IF_CONFIG_SMALL("ADPCM IMA CRYO APC"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+
+ /* AMR */
+ {
+ .id = AV_CODEC_ID_AMR_NB,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "amr_nb",
+ .long_name = NULL_IF_CONFIG_SMALL("AMR-NB (Adaptive Multi-Rate NarrowBand)"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_AMR_WB,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "amr_wb",
+ .long_name = NULL_IF_CONFIG_SMALL("AMR-WB (Adaptive Multi-Rate WideBand)"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+
+ /* RealAudio codecs*/
+ {
+ .id = AV_CODEC_ID_RA_144,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "ra_144",
+ .long_name = NULL_IF_CONFIG_SMALL("RealAudio 1.0 (14.4K)"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_RA_288,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "ra_288",
+ .long_name = NULL_IF_CONFIG_SMALL("RealAudio 2.0 (28.8K)"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+
+ /* various DPCM codecs */
+ {
+ .id = AV_CODEC_ID_ROQ_DPCM,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "roq_dpcm",
+ .long_name = NULL_IF_CONFIG_SMALL("DPCM id RoQ"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_INTERPLAY_DPCM,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "interplay_dpcm",
+ .long_name = NULL_IF_CONFIG_SMALL("DPCM Interplay"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_XAN_DPCM,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "xan_dpcm",
+ .long_name = NULL_IF_CONFIG_SMALL("DPCM Xan"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_SOL_DPCM,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "sol_dpcm",
+ .long_name = NULL_IF_CONFIG_SMALL("DPCM Sol"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+
+ /* audio codecs */
+ {
+ .id = AV_CODEC_ID_MP2,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "mp2",
+ .long_name = NULL_IF_CONFIG_SMALL("MP2 (MPEG audio layer 2)"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_MP3,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "mp3",
+ .long_name = NULL_IF_CONFIG_SMALL("MP3 (MPEG audio layer 3)"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_AAC,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "aac",
+ .long_name = NULL_IF_CONFIG_SMALL("AAC (Advanced Audio Coding)"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_AC3,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "ac3",
+ .long_name = NULL_IF_CONFIG_SMALL("ATSC A/52A (AC-3)"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_DTS,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "dts",
+ .long_name = NULL_IF_CONFIG_SMALL("DCA (DTS Coherent Acoustics)"),
+ .props = AV_CODEC_PROP_LOSSY | AV_CODEC_PROP_LOSSLESS,
+ },
+ {
+ .id = AV_CODEC_ID_VORBIS,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "vorbis",
+ .long_name = NULL_IF_CONFIG_SMALL("Vorbis"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_DVAUDIO,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "dvaudio",
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_WMAV1,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "wmav1",
+ .long_name = NULL_IF_CONFIG_SMALL("Windows Media Audio 1"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_WMAV2,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "wmav2",
+ .long_name = NULL_IF_CONFIG_SMALL("Windows Media Audio 2"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_MACE3,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "mace3",
+ .long_name = NULL_IF_CONFIG_SMALL("MACE (Macintosh Audio Compression/Expansion) 3:1"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_MACE6,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "mace6",
+ .long_name = NULL_IF_CONFIG_SMALL("MACE (Macintosh Audio Compression/Expansion) 6:1"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_VMDAUDIO,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "vmdaudio",
+ .long_name = NULL_IF_CONFIG_SMALL("Sierra VMD audio"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_FLAC,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "flac",
+ .long_name = NULL_IF_CONFIG_SMALL("FLAC (Free Lossless Audio Codec)"),
+ .props = AV_CODEC_PROP_LOSSLESS,
+ },
+ {
+ .id = AV_CODEC_ID_MP3ADU,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "mp3adu",
+ .long_name = NULL_IF_CONFIG_SMALL("ADU (Application Data Unit) MP3 (MPEG audio layer 3)"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_MP3ON4,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "mp3on4",
+ .long_name = NULL_IF_CONFIG_SMALL("MP3onMP4"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_SHORTEN,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "shorten",
+ .long_name = NULL_IF_CONFIG_SMALL("Shorten"),
+ .props = AV_CODEC_PROP_LOSSLESS,
+ },
+ {
+ .id = AV_CODEC_ID_ALAC,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "alac",
+ .long_name = NULL_IF_CONFIG_SMALL("ALAC (Apple Lossless Audio Codec)"),
+ .props = AV_CODEC_PROP_LOSSLESS,
+ },
+ {
+ .id = AV_CODEC_ID_WESTWOOD_SND1,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "westwood_snd1",
+ .long_name = NULL_IF_CONFIG_SMALL("Westwood Audio (SND1)"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_GSM,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "gsm",
+ .long_name = NULL_IF_CONFIG_SMALL("GSM"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_QDM2,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "qdm2",
+ .long_name = NULL_IF_CONFIG_SMALL("QDesign Music Codec 2"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_COOK,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "cook",
+ .long_name = NULL_IF_CONFIG_SMALL("Cook / Cooker / Gecko (RealAudio G2)"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_TRUESPEECH,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "truespeech",
+ .long_name = NULL_IF_CONFIG_SMALL("DSP Group TrueSpeech"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_TTA,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "tta",
+ .long_name = NULL_IF_CONFIG_SMALL("TTA (True Audio)"),
+ .props = AV_CODEC_PROP_LOSSLESS,
+ },
+ {
+ .id = AV_CODEC_ID_SMACKAUDIO,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "smackaudio",
+ .long_name = NULL_IF_CONFIG_SMALL("Smacker audio"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_QCELP,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "qcelp",
+ .long_name = NULL_IF_CONFIG_SMALL("QCELP / PureVoice"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_WAVPACK,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "wavpack",
+ .long_name = NULL_IF_CONFIG_SMALL("WavPack"),
+ .props = AV_CODEC_PROP_LOSSY | AV_CODEC_PROP_LOSSLESS,
+ },
+ {
+ .id = AV_CODEC_ID_DSICINAUDIO,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "dsicinaudio",
+ .long_name = NULL_IF_CONFIG_SMALL("Delphine Software International CIN audio"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_IMC,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "imc",
+ .long_name = NULL_IF_CONFIG_SMALL("IMC (Intel Music Coder)"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_MUSEPACK7,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "musepack7",
+ .long_name = NULL_IF_CONFIG_SMALL("Musepack SV7"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_MLP,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "mlp",
+ .long_name = NULL_IF_CONFIG_SMALL("MLP (Meridian Lossless Packing)"),
+ .props = AV_CODEC_PROP_LOSSLESS,
+ },
+ {
+ .id = AV_CODEC_ID_GSM_MS,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "gsm_ms",
+ .long_name = NULL_IF_CONFIG_SMALL("GSM Microsoft variant"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_ATRAC3,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "atrac3",
+ .long_name = NULL_IF_CONFIG_SMALL("Atrac 3 (Adaptive TRansform Acoustic Coding 3)"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_VOXWARE,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "voxware",
+ .long_name = NULL_IF_CONFIG_SMALL("Voxware RT29 Metasound"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_APE,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "ape",
+ .long_name = NULL_IF_CONFIG_SMALL("Monkey's Audio"),
+ .props = AV_CODEC_PROP_LOSSLESS,
+ },
+ {
+ .id = AV_CODEC_ID_NELLYMOSER,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "nellymoser",
+ .long_name = NULL_IF_CONFIG_SMALL("Nellymoser Asao"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_MUSEPACK8,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "musepack8",
+ .long_name = NULL_IF_CONFIG_SMALL("Musepack SV8"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_SPEEX,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "speex",
+ .long_name = NULL_IF_CONFIG_SMALL("Speex"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_WMAVOICE,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "wmavoice",
+ .long_name = NULL_IF_CONFIG_SMALL("Windows Media Audio Voice"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_WMAPRO,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "wmapro",
+ .long_name = NULL_IF_CONFIG_SMALL("Windows Media Audio 9 Professional"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_WMALOSSLESS,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "wmalossless",
+ .long_name = NULL_IF_CONFIG_SMALL("Windows Media Audio Lossless"),
+ .props = AV_CODEC_PROP_LOSSLESS,
+ },
+ {
+ .id = AV_CODEC_ID_ATRAC3P,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "atrac3p",
+ .long_name = NULL_IF_CONFIG_SMALL("Sony ATRAC3+"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_EAC3,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "eac3",
+ .long_name = NULL_IF_CONFIG_SMALL("ATSC A/52B (AC-3, E-AC-3)"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_SIPR,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "sipr",
+ .long_name = NULL_IF_CONFIG_SMALL("RealAudio SIPR / ACELP.NET"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_MP1,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "mp1",
+ .long_name = NULL_IF_CONFIG_SMALL("MP1 (MPEG audio layer 1)"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_TWINVQ,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "twinvq",
+ .long_name = NULL_IF_CONFIG_SMALL("VQF TwinVQ"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_TRUEHD,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "truehd",
+ .long_name = NULL_IF_CONFIG_SMALL("TrueHD"),
+ .props = AV_CODEC_PROP_LOSSLESS,
+ },
+ {
+ .id = AV_CODEC_ID_MP4ALS,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "mp4als",
+ .long_name = NULL_IF_CONFIG_SMALL("MPEG-4 Audio Lossless Coding (ALS)"),
+ .props = AV_CODEC_PROP_LOSSLESS,
+ },
+ {
+ .id = AV_CODEC_ID_ATRAC1,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "atrac1",
+ .long_name = NULL_IF_CONFIG_SMALL("Atrac 1 (Adaptive TRansform Acoustic Coding)"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_BINKAUDIO_RDFT,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "binkaudio_rdft",
+ .long_name = NULL_IF_CONFIG_SMALL("Bink Audio (RDFT)"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_BINKAUDIO_DCT,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "binkaudio_dct",
+ .long_name = NULL_IF_CONFIG_SMALL("Bink Audio (DCT)"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_AAC_LATM,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "aac_latm",
+ .long_name = NULL_IF_CONFIG_SMALL("AAC LATM (Advanced Audio Coding LATM syntax)"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_QDMC,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "qdmc",
+ .long_name = NULL_IF_CONFIG_SMALL("QDesign Music"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_CELT,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "celt",
+ .long_name = NULL_IF_CONFIG_SMALL("Constrained Energy Lapped Transform (CELT)"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_G723_1,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "g723_1",
+ .long_name = NULL_IF_CONFIG_SMALL("G.723.1"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_G729,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "g729",
+ .long_name = NULL_IF_CONFIG_SMALL("G.729"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_8SVX_EXP,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "8svx_exp",
+ .long_name = NULL_IF_CONFIG_SMALL("8SVX exponential"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_8SVX_FIB,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "8svx_fib",
+ .long_name = NULL_IF_CONFIG_SMALL("8SVX fibonacci"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_BMV_AUDIO,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "bmv_audio",
+ .long_name = NULL_IF_CONFIG_SMALL("Discworld II BMV audio"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_RALF,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "ralf",
+ .long_name = NULL_IF_CONFIG_SMALL("RealAudio Lossless"),
+ .props = AV_CODEC_PROP_LOSSLESS,
+ },
+ {
+ .id = AV_CODEC_ID_IAC,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "iac",
+ .long_name = NULL_IF_CONFIG_SMALL("IAC (Indeo Audio Coder)"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_ILBC,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "ilbc",
+ .long_name = NULL_IF_CONFIG_SMALL("iLBC (Internet Low Bitrate Codec)"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_OPUS,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "opus",
+ .long_name = NULL_IF_CONFIG_SMALL("Opus (Opus Interactive Audio Codec)"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_COMFORT_NOISE,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "comfortnoise",
+ .long_name = NULL_IF_CONFIG_SMALL("RFC 3389 Comfort Noise"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_TAK,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "tak",
+ .long_name = NULL_IF_CONFIG_SMALL("TAK (Tom's lossless Audio Kompressor)"),
+ .props = AV_CODEC_PROP_LOSSLESS,
+ },
+
+ /* subtitle codecs */
+ {
+ .id = AV_CODEC_ID_DVD_SUBTITLE,
+ .type = AVMEDIA_TYPE_SUBTITLE,
+ .name = "dvd_subtitle",
+ .long_name = NULL_IF_CONFIG_SMALL("DVD subtitles"),
+ },
+ {
+ .id = AV_CODEC_ID_DVB_SUBTITLE,
+ .type = AVMEDIA_TYPE_SUBTITLE,
+ .name = "dvb_subtitle",
+ .long_name = NULL_IF_CONFIG_SMALL("DVB subtitles"),
+ },
+ {
+ .id = AV_CODEC_ID_TEXT,
+ .type = AVMEDIA_TYPE_SUBTITLE,
+ .name = "text",
+ .long_name = NULL_IF_CONFIG_SMALL("raw UTF-8 text"),
+ },
+ {
+ .id = AV_CODEC_ID_XSUB,
+ .type = AVMEDIA_TYPE_SUBTITLE,
+ .name = "xsub",
+ .long_name = NULL_IF_CONFIG_SMALL("XSUB"),
+ },
+ {
+ .id = AV_CODEC_ID_SSA,
+ .type = AVMEDIA_TYPE_SUBTITLE,
+ .name = "ssa",
+ .long_name = NULL_IF_CONFIG_SMALL("SSA (SubStation Alpha) / ASS (Advanced SSA) subtitle"),
+ },
+ {
+ .id = AV_CODEC_ID_MOV_TEXT,
+ .type = AVMEDIA_TYPE_SUBTITLE,
+ .name = "mov_text",
+ .long_name = NULL_IF_CONFIG_SMALL("MOV text"),
+ },
+ {
+ .id = AV_CODEC_ID_HDMV_PGS_SUBTITLE,
+ .type = AVMEDIA_TYPE_SUBTITLE,
+ .name = "hdmv_pgs_subtitle",
+ .long_name = NULL_IF_CONFIG_SMALL("HDMV Presentation Graphic Stream subtitles"),
+ },
+ {
+ .id = AV_CODEC_ID_DVB_TELETEXT,
+ .type = AVMEDIA_TYPE_SUBTITLE,
+ .name = "dvb_teletext",
+ .long_name = NULL_IF_CONFIG_SMALL("DVB teletext"),
+ },
+ {
+ .id = AV_CODEC_ID_SRT,
+ .type = AVMEDIA_TYPE_SUBTITLE,
+ .name = "srt",
+ .long_name = NULL_IF_CONFIG_SMALL("SubRip Text"),
+ },
+};
+
+const AVCodecDescriptor *avcodec_descriptor_get(enum AVCodecID id)
+{
+ int i;
+
+ for (i = 0; i < FF_ARRAY_ELEMS(codec_descriptors); i++)
+ if (codec_descriptors[i].id == id)
+ return &codec_descriptors[i];
+ return NULL;
+}
+
+const AVCodecDescriptor *avcodec_descriptor_next(const AVCodecDescriptor *prev)
+{
+ if (!prev)
+ return &codec_descriptors[0];
+ if (prev - codec_descriptors < FF_ARRAY_ELEMS(codec_descriptors) - 1)
+ return prev + 1;
+ return NULL;
+}
+
+const AVCodecDescriptor *avcodec_descriptor_get_by_name(const char *name)
+{
+ const AVCodecDescriptor *desc = NULL;
+
+ while ((desc = avcodec_descriptor_next(desc))) {
+ if (!strcmp(desc->name, name))
+ return desc;
+ }
+ return NULL;
+}
diff --git a/gst-libs/ext/libav/libavcodec/cook.c b/gst-libs/ext/libav/libavcodec/cook.c
index 7437852..85565bb 100644
--- a/gst-libs/ext/libav/libavcodec/cook.c
+++ b/gst-libs/ext/libav/libavcodec/cook.c
@@ -42,13 +42,14 @@
* available.
*/
+#include "libavutil/channel_layout.h"
#include "libavutil/lfg.h"
#include "avcodec.h"
#include "get_bits.h"
#include "dsputil.h"
#include "bytestream.h"
#include "fft.h"
-#include "libavutil/audioconvert.h"
+#include "internal.h"
#include "sinewin.h"
#include "cookdata.h"
@@ -72,23 +73,22 @@ typedef struct {
int size;
int num_channels;
int cookversion;
- int samples_per_frame;
int subbands;
int js_subband_start;
int js_vlc_bits;
int samples_per_channel;
int log2_numvector_size;
unsigned int channel_mask;
- VLC ccpl; ///< channel coupling
+ VLC channel_coupling;
int joint_stereo;
int bits_per_subpacket;
int bits_per_subpdiv;
int total_subbands;
- int numvector_size; ///< 1 << log2_numvector_size;
+ int numvector_size; // 1 << log2_numvector_size;
float mono_previous_buffer1[1024];
float mono_previous_buffer2[1024];
- /** gain buffers */
+
cook_gains gains1;
cook_gains gains2;
int gain_1[9];
@@ -119,15 +119,13 @@ typedef struct cook {
void (*interpolate)(struct cook *q, float *buffer,
int gain_index, int gain_index_next);
- void (*saturate_output)(struct cook *q, int chan, float *out);
+ void (*saturate_output)(struct cook *q, float *out);
AVCodecContext* avctx;
+ DSPContext dsp;
AVFrame frame;
GetBitContext gb;
/* stream data */
- int nb_channels;
- int bit_rate;
- int sample_rate;
int num_vectors;
int samples_per_channel;
/* states */
@@ -204,7 +202,8 @@ static av_cold int init_cook_vlc_tables(COOKContext *q)
for (i = 0; i < q->num_subpackets; i++) {
if (q->subpacket[i].joint_stereo == 1) {
- result |= init_vlc(&q->subpacket[i].ccpl, 6, (1 << q->subpacket[i].js_vlc_bits) - 1,
+ result |= init_vlc(&q->subpacket[i].channel_coupling, 6,
+ (1 << q->subpacket[i].js_vlc_bits) - 1,
ccpl_huffbits[q->subpacket[i].js_vlc_bits - 2], 1, 1,
ccpl_huffcodes[q->subpacket[i].js_vlc_bits - 2], 2, 2, 0);
av_log(q->avctx, AV_LOG_DEBUG, "subpacket %i Joint-stereo VLC used.\n", i);
@@ -239,17 +238,11 @@ static av_cold int init_cook_mlt(COOKContext *q)
return 0;
}
-static const float *maybe_reformat_buffer32(COOKContext *q, const float *ptr, int n)
-{
- if (1)
- return ptr;
-}
-
static av_cold void init_cplscales_table(COOKContext *q)
{
int i;
for (i = 0; i < 5; i++)
- q->cplscales[i] = maybe_reformat_buffer32(q, cplscales[i], (1 << (i + 2)) - 1);
+ q->cplscales[i] = cplscales[i];
}
/*************** init functions end ***********/
@@ -280,8 +273,8 @@ static av_cold void init_cplscales_table(COOKContext *q)
static inline int decode_bytes(const uint8_t *inbuffer, uint8_t *out, int bytes)
{
static const uint32_t tab[4] = {
- AV_BE2NE32C(0x37c511f2), AV_BE2NE32C(0xf237c511),
- AV_BE2NE32C(0x11f237c5), AV_BE2NE32C(0xc511f237),
+ AV_BE2NE32C(0x37c511f2u), AV_BE2NE32C(0xf237c511u),
+ AV_BE2NE32C(0x11f237c5u), AV_BE2NE32C(0xc511f237u),
};
int i, off;
uint32_t c;
@@ -303,9 +296,6 @@ static inline int decode_bytes(const uint8_t *inbuffer, uint8_t *out, int bytes)
return off;
}
-/**
- * Cook uninit
- */
static av_cold int cook_decode_close(AVCodecContext *avctx)
{
int i;
@@ -325,7 +315,7 @@ static av_cold int cook_decode_close(AVCodecContext *avctx)
for (i = 0; i < 7; i++)
ff_free_vlc(&q->sqvh[i]);
for (i = 0; i < q->num_subpackets; i++)
- ff_free_vlc(&q->subpacket[i].ccpl);
+ ff_free_vlc(&q->subpacket[i].channel_coupling);
av_log(avctx, AV_LOG_DEBUG, "Memory deallocated.\n");
@@ -411,24 +401,18 @@ static void categorize(COOKContext *q, COOKSubpacket *p, int *quant_index_table,
int *category, int *category_index)
{
int exp_idx, bias, tmpbias1, tmpbias2, bits_left, num_bits, index, v, i, j;
- int exp_index2[102];
- int exp_index1[102];
+ int exp_index2[102] = { 0 };
+ int exp_index1[102] = { 0 };
- int tmp_categorize_array[128 * 2];
+ int tmp_categorize_array[128 * 2] = { 0 };
int tmp_categorize_array1_idx = p->numvector_size;
int tmp_categorize_array2_idx = p->numvector_size;
bits_left = p->bits_per_subpacket - get_bits_count(&q->gb);
- if (bits_left > q->samples_per_channel) {
+ if (bits_left > q->samples_per_channel)
bits_left = q->samples_per_channel +
((bits_left - q->samples_per_channel) * 5) / 8;
- //av_log(q->avctx, AV_LOG_ERROR, "bits_left = %d\n",bits_left);
- }
-
- memset(&exp_index1, 0, sizeof(exp_index1));
- memset(&exp_index2, 0, sizeof(exp_index2));
- memset(&tmp_categorize_array, 0, sizeof(tmp_categorize_array));
bias = -32;
@@ -641,22 +625,13 @@ static void decode_vectors(COOKContext *q, COOKSubpacket *p, int *category,
}
-/**
- * function for decoding mono data
- *
- * @param q pointer to the COOKContext
- * @param mlt_buffer pointer to mlt coefficients
- */
static int mono_decode(COOKContext *q, COOKSubpacket *p, float *mlt_buffer)
{
- int category_index[128];
+ int category_index[128] = { 0 };
+ int category[128] = { 0 };
int quant_index_table[102];
- int category[128];
int res;
- memset(&category, 0, sizeof(category));
- memset(&category_index, 0, sizeof(category_index));
-
if ((res = decode_envelope(q, p, quant_index_table)) < 0)
return res;
q->num_vectors = get_bits(&q->gb, p->log2_numvector_size);
@@ -760,7 +735,6 @@ static void imlt_gain(COOKContext *q, float *inbuffer,
*
* @param q pointer to the COOKContext
* @param decouple_tab decoupling array
- *
*/
static void decouple_info(COOKContext *q, COOKSubpacket *p, int *decouple_tab)
{
@@ -775,7 +749,9 @@ static void decouple_info(COOKContext *q, COOKSubpacket *p, int *decouple_tab)
if (vlc)
for (i = 0; i < length; i++)
- decouple_tab[start + i] = get_vlc2(&q->gb, p->ccpl.table, p->ccpl.bits, 2);
+ decouple_tab[start + i] = get_vlc2(&q->gb,
+ p->channel_coupling.table,
+ p->channel_coupling.bits, 2);
else
for (i = 0; i < length; i++)
decouple_tab[start + i] = get_bits(&q->gb, p->js_vlc_bits);
@@ -814,22 +790,21 @@ static void decouple_float(COOKContext *q,
* @param mlt_buffer1 pointer to left channel mlt coefficients
* @param mlt_buffer2 pointer to right channel mlt coefficients
*/
-static int joint_decode(COOKContext *q, COOKSubpacket *p, float *mlt_buffer1,
- float *mlt_buffer2)
+static int joint_decode(COOKContext *q, COOKSubpacket *p,
+ float *mlt_buffer_left, float *mlt_buffer_right)
{
int i, j, res;
- int decouple_tab[SUBBAND_SIZE];
+ int decouple_tab[SUBBAND_SIZE] = { 0 };
float *decode_buffer = q->decode_buffer_0;
int idx, cpl_tmp;
float f1, f2;
const float *cplscale;
- memset(decouple_tab, 0, sizeof(decouple_tab));
memset(decode_buffer, 0, sizeof(q->decode_buffer_0));
/* Make sure the buffers are zeroed out. */
- memset(mlt_buffer1, 0, 1024 * sizeof(*mlt_buffer1));
- memset(mlt_buffer2, 0, 1024 * sizeof(*mlt_buffer2));
+ memset(mlt_buffer_left, 0, 1024 * sizeof(*mlt_buffer_left));
+ memset(mlt_buffer_right, 0, 1024 * sizeof(*mlt_buffer_right));
decouple_info(q, p, decouple_tab);
if ((res = mono_decode(q, p, decode_buffer)) < 0)
return res;
@@ -837,8 +812,8 @@ static int joint_decode(COOKContext *q, COOKSubpacket *p, float *mlt_buffer1,
/* The two channels are stored interleaved in decode_buffer. */
for (i = 0; i < p->js_subband_start; i++) {
for (j = 0; j < SUBBAND_SIZE; j++) {
- mlt_buffer1[i * 20 + j] = decode_buffer[i * 40 + j];
- mlt_buffer2[i * 20 + j] = decode_buffer[i * 40 + 20 + j];
+ mlt_buffer_left[i * 20 + j] = decode_buffer[i * 40 + j];
+ mlt_buffer_right[i * 20 + j] = decode_buffer[i * 40 + 20 + j];
}
}
@@ -851,7 +826,8 @@ static int joint_decode(COOKContext *q, COOKSubpacket *p, float *mlt_buffer1,
cplscale = q->cplscales[p->js_vlc_bits - 2]; // choose decoupler table
f1 = cplscale[decouple_tab[cpl_tmp] + 1];
f2 = cplscale[idx];
- q->decouple(q, p, i, f1, f2, decode_buffer, mlt_buffer1, mlt_buffer2);
+ q->decouple(q, p, i, f1, f2, decode_buffer,
+ mlt_buffer_left, mlt_buffer_right);
idx = (1 << p->js_vlc_bits) - 1;
}
@@ -886,18 +862,15 @@ static inline void decode_bytes_and_gain(COOKContext *q, COOKSubpacket *p,
* Saturate the output signal and interleave.
*
* @param q pointer to the COOKContext
- * @param chan channel to saturate
* @param out pointer to the output vector
*/
-static void saturate_output_float(COOKContext *q, int chan, float *out)
+static void saturate_output_float(COOKContext *q, float *out)
{
- int j;
- float *output = q->mono_mdct_output + q->samples_per_channel;
- for (j = 0; j < q->samples_per_channel; j++) {
- out[chan + q->nb_channels * j] = av_clipf(output[j], -1.0, 1.0);
- }
+ q->dsp.vector_clipf(out, q->mono_mdct_output + q->samples_per_channel,
+ -1.0f, 1.0f, FFALIGN(q->samples_per_channel, 8));
}
+
/**
* Final part of subpacket decoding:
* Apply modulated lapped transform, gain compensation,
@@ -908,15 +881,14 @@ static void saturate_output_float(COOKContext *q, int chan, float *out)
* @param gains_ptr array of current/prev gain pointers
* @param previous_buffer pointer to the previous buffer to be used for overlapping
* @param out pointer to the output buffer
- * @param chan 0: left or single channel, 1: right channel
*/
static inline void mlt_compensate_output(COOKContext *q, float *decode_buffer,
cook_gains *gains_ptr, float *previous_buffer,
- float *out, int chan)
+ float *out)
{
imlt_gain(q, decode_buffer, gains_ptr, previous_buffer);
if (out)
- q->saturate_output(q, chan, out);
+ q->saturate_output(q, out);
}
@@ -929,14 +901,11 @@ static inline void mlt_compensate_output(COOKContext *q, float *decode_buffer,
* @param outbuffer pointer to the outbuffer
*/
static int decode_subpacket(COOKContext *q, COOKSubpacket *p,
- const uint8_t *inbuffer, float *outbuffer)
+ const uint8_t *inbuffer, float **outbuffer)
{
int sub_packet_size = p->size;
int res;
- /* packet dump */
- // for (i = 0; i < sub_packet_size ; i++)
- // av_log(q->avctx, AV_LOG_ERROR, "%02x", inbuffer[i]);
- // av_log(q->avctx, AV_LOG_ERROR, "\n");
+
memset(q->decode_buffer_1, 0, sizeof(q->decode_buffer_1));
decode_bytes_and_gain(q, p, inbuffer, &p->gains1);
@@ -955,32 +924,30 @@ static int decode_subpacket(COOKContext *q, COOKSubpacket *p,
}
mlt_compensate_output(q, q->decode_buffer_1, &p->gains1,
- p->mono_previous_buffer1, outbuffer, p->ch_idx);
+ p->mono_previous_buffer1,
+ outbuffer ? outbuffer[p->ch_idx] : NULL);
if (p->num_channels == 2)
if (p->joint_stereo)
mlt_compensate_output(q, q->decode_buffer_2, &p->gains1,
- p->mono_previous_buffer2, outbuffer, p->ch_idx + 1);
+ p->mono_previous_buffer2,
+ outbuffer ? outbuffer[p->ch_idx + 1] : NULL);
else
mlt_compensate_output(q, q->decode_buffer_2, &p->gains2,
- p->mono_previous_buffer2, outbuffer, p->ch_idx + 1);
+ p->mono_previous_buffer2,
+ outbuffer ? outbuffer[p->ch_idx + 1] : NULL);
return 0;
}
-/**
- * Cook frame decoding
- *
- * @param avctx pointer to the AVCodecContext
- */
static int cook_decode_frame(AVCodecContext *avctx, void *data,
int *got_frame_ptr, AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
COOKContext *q = avctx->priv_data;
- float *samples = NULL;
+ float **samples = NULL;
int i, ret;
int offset = 0;
int chidx = 0;
@@ -991,11 +958,11 @@ static int cook_decode_frame(AVCodecContext *avctx, void *data,
/* get output buffer */
if (q->discarded_packets >= 2) {
q->frame.nb_samples = q->samples_per_channel;
- if ((ret = avctx->get_buffer(avctx, &q->frame)) < 0) {
+ if ((ret = ff_get_buffer(avctx, &q->frame)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return ret;
}
- samples = (float *) q->frame.data[0];
+ samples = (float **)q->frame.extended_data;
}
/* estimate subpacket sizes */
@@ -1046,19 +1013,18 @@ static int cook_decode_frame(AVCodecContext *avctx, void *data,
static void dump_cook_context(COOKContext *q)
{
//int i=0;
-#define PRINT(a, b) av_log(q->avctx, AV_LOG_ERROR, " %s = %d\n", a, b);
- av_log(q->avctx, AV_LOG_ERROR, "COOKextradata\n");
- av_log(q->avctx, AV_LOG_ERROR, "cookversion=%x\n", q->subpacket[0].cookversion);
+#define PRINT(a, b) av_dlog(q->avctx, " %s = %d\n", a, b);
+ av_dlog(q->avctx, "COOKextradata\n");
+ av_dlog(q->avctx, "cookversion=%x\n", q->subpacket[0].cookversion);
if (q->subpacket[0].cookversion > STEREO) {
PRINT("js_subband_start", q->subpacket[0].js_subband_start);
PRINT("js_vlc_bits", q->subpacket[0].js_vlc_bits);
}
- av_log(q->avctx, AV_LOG_ERROR, "COOKContext\n");
- PRINT("nb_channels", q->nb_channels);
- PRINT("bit_rate", q->bit_rate);
- PRINT("sample_rate", q->sample_rate);
+ av_dlog(q->avctx, "COOKContext\n");
+ PRINT("nb_channels", q->avctx->channels);
+ PRINT("bit_rate", q->avctx->bit_rate);
+ PRINT("sample_rate", q->avctx->sample_rate);
PRINT("samples_per_channel", q->subpacket[0].samples_per_channel);
- PRINT("samples_per_frame", q->subpacket[0].samples_per_frame);
PRINT("subbands", q->subpacket[0].subbands);
PRINT("js_subband_start", q->subpacket[0].js_subband_start);
PRINT("log2_numvector_size", q->subpacket[0].log2_numvector_size);
@@ -1067,16 +1033,6 @@ static void dump_cook_context(COOKContext *q)
}
#endif
-static av_cold int cook_count_channels(unsigned int mask)
-{
- int i;
- int channels = 0;
- for (i = 0; i < 32; i++)
- if (mask & (1 << i))
- ++channels;
- return channels;
-}
-
/**
* Cook initialization
*
@@ -1090,6 +1046,7 @@ static av_cold int cook_decode_init(AVCodecContext *avctx)
int extradata_size = avctx->extradata_size;
int s = 0;
unsigned int channel_mask = 0;
+ int samples_per_frame;
int ret;
q->avctx = avctx;
@@ -1101,10 +1058,7 @@ static av_cold int cook_decode_init(AVCodecContext *avctx)
av_log(avctx, AV_LOG_DEBUG, "codecdata_length=%d\n", avctx->extradata_size);
/* Take data from the AVCodecContext (RM container). */
- q->sample_rate = avctx->sample_rate;
- q->nb_channels = avctx->channels;
- q->bit_rate = avctx->bit_rate;
- if (!q->nb_channels) {
+ if (!avctx->channels) {
av_log(avctx, AV_LOG_ERROR, "Invalid number of channels\n");
return AVERROR_INVALIDDATA;
}
@@ -1112,12 +1066,14 @@ static av_cold int cook_decode_init(AVCodecContext *avctx)
/* Initialize RNG. */
av_lfg_init(&q->random_state, 0);
+ ff_dsputil_init(&q->dsp, avctx);
+
while (edata_ptr < edata_ptr_end) {
/* 8 for mono, 16 for stereo, ? for multichannel
Swap to right endianness so we don't need to care later on. */
if (extradata_size >= 8) {
q->subpacket[s].cookversion = bytestream_get_be32(&edata_ptr);
- q->subpacket[s].samples_per_frame = bytestream_get_be16(&edata_ptr);
+ samples_per_frame = bytestream_get_be16(&edata_ptr);
q->subpacket[s].subbands = bytestream_get_be16(&edata_ptr);
extradata_size -= 8;
}
@@ -1129,7 +1085,7 @@ static av_cold int cook_decode_init(AVCodecContext *avctx)
}
/* Initialize extradata related variables. */
- q->subpacket[s].samples_per_channel = q->subpacket[s].samples_per_frame / q->nb_channels;
+ q->subpacket[s].samples_per_channel = samples_per_frame / avctx->channels;
q->subpacket[s].bits_per_subpacket = avctx->block_align * 8;
/* Initialize default data states. */
@@ -1144,21 +1100,21 @@ static av_cold int cook_decode_init(AVCodecContext *avctx)
q->subpacket[s].joint_stereo = 0;
switch (q->subpacket[s].cookversion) {
case MONO:
- if (q->nb_channels != 1) {
+ if (avctx->channels != 1) {
av_log_ask_for_sample(avctx, "Container channels != 1.\n");
return AVERROR_PATCHWELCOME;
}
av_log(avctx, AV_LOG_DEBUG, "MONO\n");
break;
case STEREO:
- if (q->nb_channels != 1) {
+ if (avctx->channels != 1) {
q->subpacket[s].bits_per_subpdiv = 1;
q->subpacket[s].num_channels = 2;
}
av_log(avctx, AV_LOG_DEBUG, "STEREO\n");
break;
case JOINT_STEREO:
- if (q->nb_channels != 2) {
+ if (avctx->channels != 2) {
av_log_ask_for_sample(avctx, "Container channels != 2.\n");
return AVERROR_PATCHWELCOME;
}
@@ -1181,12 +1137,12 @@ static av_cold int cook_decode_init(AVCodecContext *avctx)
if (extradata_size >= 4)
channel_mask |= q->subpacket[s].channel_mask = bytestream_get_be32(&edata_ptr);
- if (cook_count_channels(q->subpacket[s].channel_mask) > 1) {
+ if (av_get_channel_layout_nb_channels(q->subpacket[s].channel_mask) > 1) {
q->subpacket[s].total_subbands = q->subpacket[s].subbands +
q->subpacket[s].js_subband_start;
q->subpacket[s].joint_stereo = 1;
q->subpacket[s].num_channels = 2;
- q->subpacket[s].samples_per_channel = q->subpacket[s].samples_per_frame >> 1;
+ q->subpacket[s].samples_per_channel = samples_per_frame >> 1;
if (q->subpacket[s].samples_per_channel > 256) {
q->subpacket[s].log2_numvector_size = 6;
@@ -1195,7 +1151,7 @@ static av_cold int cook_decode_init(AVCodecContext *avctx)
q->subpacket[s].log2_numvector_size = 7;
}
} else
- q->subpacket[s].samples_per_channel = q->subpacket[s].samples_per_frame;
+ q->subpacket[s].samples_per_channel = samples_per_frame;
break;
default:
@@ -1278,16 +1234,15 @@ static av_cold int cook_decode_init(AVCodecContext *avctx)
}
/* Try to catch some obviously faulty streams, othervise it might be exploitable */
- if ((q->samples_per_channel == 256) || (q->samples_per_channel == 512)
- || (q->samples_per_channel == 1024)) {
- } else {
+ if (q->samples_per_channel != 256 && q->samples_per_channel != 512 &&
+ q->samples_per_channel != 1024) {
av_log_ask_for_sample(avctx,
"unknown amount of samples_per_channel = %d\n",
q->samples_per_channel);
return AVERROR_PATCHWELCOME;
}
- avctx->sample_fmt = AV_SAMPLE_FMT_FLT;
+ avctx->sample_fmt = AV_SAMPLE_FMT_FLTP;
if (channel_mask)
avctx->channel_layout = channel_mask;
else
@@ -1305,11 +1260,13 @@ static av_cold int cook_decode_init(AVCodecContext *avctx)
AVCodec ff_cook_decoder = {
.name = "cook",
.type = AVMEDIA_TYPE_AUDIO,
- .id = CODEC_ID_COOK,
+ .id = AV_CODEC_ID_COOK,
.priv_data_size = sizeof(COOKContext),
.init = cook_decode_init,
.close = cook_decode_close,
.decode = cook_decode_frame,
.capabilities = CODEC_CAP_DR1,
- .long_name = NULL_IF_CONFIG_SMALL("COOK"),
+ .long_name = NULL_IF_CONFIG_SMALL("Cook / Cooker / Gecko (RealAudio G2)"),
+ .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP,
+ AV_SAMPLE_FMT_NONE },
};
diff --git a/gst-libs/ext/libav/libavcodec/cook_parser.c b/gst-libs/ext/libav/libavcodec/cook_parser.c
new file mode 100644
index 0000000..f140e90
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/cook_parser.c
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2012 Justin Ruggles <justin.ruggles@gmail.com>
+ *
+ * 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
+ * Cook audio parser
+ *
+ * Determines subpacket duration from extradata.
+ */
+
+#include <stdint.h>
+
+#include "libavutil/intreadwrite.h"
+#include "parser.h"
+
+typedef struct CookParseContext {
+ int duration;
+} CookParseContext;
+
+static int cook_parse(AVCodecParserContext *s1, AVCodecContext *avctx,
+ const uint8_t **poutbuf, int *poutbuf_size,
+ const uint8_t *buf, int buf_size)
+{
+ CookParseContext *s = s1->priv_data;
+
+ if (s->duration)
+ s1->duration = s->duration;
+ else if (avctx->extradata && avctx->extradata_size >= 8 && avctx->channels)
+ s->duration = AV_RB16(avctx->extradata + 4) / avctx->channels;
+
+ /* always return the full packet. this parser isn't doing any splitting or
+ combining, only setting packet duration */
+ *poutbuf = buf;
+ *poutbuf_size = buf_size;
+ return buf_size;
+}
+
+AVCodecParser ff_cook_parser = {
+ .codec_ids = { AV_CODEC_ID_COOK },
+ .priv_data_size = sizeof(CookParseContext),
+ .parser_parse = cook_parse,
+};
diff --git a/gst-libs/ext/libav/libavcodec/cos_tablegen.c b/gst-libs/ext/libav/libavcodec/cos_tablegen.c
index 5e52c48..8a90857 100644
--- a/gst-libs/ext/libav/libavcodec/cos_tablegen.c
+++ b/gst-libs/ext/libav/libavcodec/cos_tablegen.c
@@ -24,9 +24,6 @@
#include <string.h>
#include <math.h>
-#ifndef M_PI
-#define M_PI 3.14159265358979323846
-#endif
#define BITS 16
#define FLOATFMT "%.18e"
#define FIXEDFMT "%6d"
diff --git a/gst-libs/ext/libav/libavcodec/cscd.c b/gst-libs/ext/libav/libavcodec/cscd.c
index 1edab91..2c1b2e7 100644
--- a/gst-libs/ext/libav/libavcodec/cscd.c
+++ b/gst-libs/ext/libav/libavcodec/cscd.c
@@ -22,6 +22,8 @@
#include <stdlib.h>
#include "avcodec.h"
+#include "internal.h"
+#include "libavutil/common.h"
#if CONFIG_ZLIB
#include <zlib.h>
@@ -135,7 +137,7 @@ static void add_frame_32(AVFrame *f, const uint8_t *src,
}
#endif
-static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
+static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
AVPacket *avpkt) {
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
@@ -152,7 +154,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
c->pic.reference = 1;
c->pic.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_READABLE |
FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE;
- if (avctx->get_buffer(avctx, &c->pic) < 0) {
+ if (ff_get_buffer(avctx, &c->pic) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return -1;
}
@@ -213,7 +215,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
}
*picture = c->pic;
- *data_size = sizeof(AVFrame);
+ *got_frame = 1;
return buf_size;
}
@@ -221,9 +223,9 @@ static av_cold int decode_init(AVCodecContext *avctx) {
CamStudioContext *c = avctx->priv_data;
int stride;
switch (avctx->bits_per_coded_sample) {
- case 16: avctx->pix_fmt = PIX_FMT_RGB555; break;
- case 24: avctx->pix_fmt = PIX_FMT_BGR24; break;
- case 32: avctx->pix_fmt = PIX_FMT_RGB32; break;
+ case 16: avctx->pix_fmt = AV_PIX_FMT_RGB555; break;
+ case 24: avctx->pix_fmt = AV_PIX_FMT_BGR24; break;
+ case 32: avctx->pix_fmt = AV_PIX_FMT_RGB32; break;
default:
av_log(avctx, AV_LOG_ERROR,
"CamStudio codec error: invalid depth %i bpp\n",
@@ -257,12 +259,11 @@ static av_cold int decode_end(AVCodecContext *avctx) {
AVCodec ff_cscd_decoder = {
.name = "camstudio",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_CSCD,
+ .id = AV_CODEC_ID_CSCD,
.priv_data_size = sizeof(CamStudioContext),
.init = decode_init,
.close = decode_end,
.decode = decode_frame,
.capabilities = CODEC_CAP_DR1,
- .long_name = NULL_IF_CONFIG_SMALL("CamStudio"),
+ .long_name = NULL_IF_CONFIG_SMALL("CamStudio"),
};
-
diff --git a/gst-libs/ext/libav/libavcodec/cyuv.c b/gst-libs/ext/libav/libavcodec/cyuv.c
index 60cce82..49cf64c 100644
--- a/gst-libs/ext/libav/libavcodec/cyuv.c
+++ b/gst-libs/ext/libav/libavcodec/cyuv.c
@@ -34,6 +34,8 @@
#include "avcodec.h"
#include "dsputil.h"
+#include "internal.h"
+#include "libavutil/internal.h"
typedef struct CyuvDecodeContext {
@@ -52,13 +54,13 @@ static av_cold int cyuv_decode_init(AVCodecContext *avctx)
if (s->width & 0x3)
return -1;
s->height = avctx->height;
- avctx->pix_fmt = PIX_FMT_YUV411P;
+ avctx->pix_fmt = AV_PIX_FMT_YUV411P;
return 0;
}
static int cyuv_decode_frame(AVCodecContext *avctx,
- void *data, int *data_size,
+ void *data, int *got_frame,
AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
@@ -82,7 +84,7 @@ static int cyuv_decode_frame(AVCodecContext *avctx,
unsigned char cur_byte;
int pixel_groups;
- if (avctx->codec_id == CODEC_ID_AURA) {
+ if (avctx->codec_id == AV_CODEC_ID_AURA) {
y_table = u_table;
u_table = v_table;
}
@@ -104,7 +106,7 @@ static int cyuv_decode_frame(AVCodecContext *avctx,
s->frame.buffer_hints = FF_BUFFER_HINTS_VALID;
s->frame.reference = 0;
- if (avctx->get_buffer(avctx, &s->frame) < 0) {
+ if (ff_get_buffer(avctx, &s->frame) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return -1;
}
@@ -161,7 +163,7 @@ static int cyuv_decode_frame(AVCodecContext *avctx,
}
}
- *data_size=sizeof(AVFrame);
+ *got_frame = 1;
*(AVFrame*)data= s->frame;
return buf_size;
@@ -181,13 +183,13 @@ static av_cold int cyuv_decode_end(AVCodecContext *avctx)
AVCodec ff_aura_decoder = {
.name = "aura",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_AURA,
+ .id = AV_CODEC_ID_AURA,
.priv_data_size = sizeof(CyuvDecodeContext),
.init = cyuv_decode_init,
.close = cyuv_decode_end,
.decode = cyuv_decode_frame,
.capabilities = CODEC_CAP_DR1,
- .long_name = NULL_IF_CONFIG_SMALL("Auravision AURA"),
+ .long_name = NULL_IF_CONFIG_SMALL("Auravision AURA"),
};
#endif
@@ -195,12 +197,12 @@ AVCodec ff_aura_decoder = {
AVCodec ff_cyuv_decoder = {
.name = "cyuv",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_CYUV,
+ .id = AV_CODEC_ID_CYUV,
.priv_data_size = sizeof(CyuvDecodeContext),
.init = cyuv_decode_init,
.close = cyuv_decode_end,
.decode = cyuv_decode_frame,
.capabilities = CODEC_CAP_DR1,
- .long_name = NULL_IF_CONFIG_SMALL("Creative YUV (CYUV)"),
+ .long_name = NULL_IF_CONFIG_SMALL("Creative YUV (CYUV)"),
};
#endif
diff --git a/gst-libs/ext/libav/libavcodec/dca.c b/gst-libs/ext/libav/libavcodec/dca.c
index a83d082..0f1eeec 100644
--- a/gst-libs/ext/libav/libavcodec/dca.c
+++ b/gst-libs/ext/libav/libavcodec/dca.c
@@ -1,9 +1,5 @@
/*
- * DCA compatible decoder
- * Copyright (C) 2004 Gildas Bazin
- * Copyright (C) 2004 Benjamin Zores
- * Copyright (C) 2006 Benjamin Larsson
- * Copyright (C) 2007 Konstantin Shishkov
+ * DCA compatible decoder data
*
* This file is part of Libav.
*
@@ -22,1990 +18,12 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include <math.h>
-#include <stddef.h>
-#include <stdio.h>
+#include <stdint.h>
-#include "libavutil/common.h"
-#include "libavutil/intmath.h"
-#include "libavutil/intreadwrite.h"
-#include "libavutil/mathematics.h"
-#include "libavutil/audioconvert.h"
-#include "avcodec.h"
-#include "dsputil.h"
-#include "fft.h"
-#include "get_bits.h"
-#include "put_bits.h"
-#include "dcadata.h"
-#include "dcahuff.h"
#include "dca.h"
-#include "synth_filter.h"
-#include "dcadsp.h"
-#include "fmtconvert.h"
-#if ARCH_ARM
-# include "arm/dca.h"
-#endif
-
-//#define TRACE
-
-#define DCA_PRIM_CHANNELS_MAX (7)
-#define DCA_SUBBANDS (32)
-#define DCA_ABITS_MAX (32) /* Should be 28 */
-#define DCA_SUBSUBFRAMES_MAX (4)
-#define DCA_SUBFRAMES_MAX (16)
-#define DCA_BLOCKS_MAX (16)
-#define DCA_LFE_MAX (3)
-
-enum DCAMode {
- DCA_MONO = 0,
- DCA_CHANNEL,
- DCA_STEREO,
- DCA_STEREO_SUMDIFF,
- DCA_STEREO_TOTAL,
- DCA_3F,
- DCA_2F1R,
- DCA_3F1R,
- DCA_2F2R,
- DCA_3F2R,
- DCA_4F2R
-};
-
-/* these are unconfirmed but should be mostly correct */
-enum DCAExSSSpeakerMask {
- DCA_EXSS_FRONT_CENTER = 0x0001,
- DCA_EXSS_FRONT_LEFT_RIGHT = 0x0002,
- DCA_EXSS_SIDE_REAR_LEFT_RIGHT = 0x0004,
- DCA_EXSS_LFE = 0x0008,
- DCA_EXSS_REAR_CENTER = 0x0010,
- DCA_EXSS_FRONT_HIGH_LEFT_RIGHT = 0x0020,
- DCA_EXSS_REAR_LEFT_RIGHT = 0x0040,
- DCA_EXSS_FRONT_HIGH_CENTER = 0x0080,
- DCA_EXSS_OVERHEAD = 0x0100,
- DCA_EXSS_CENTER_LEFT_RIGHT = 0x0200,
- DCA_EXSS_WIDE_LEFT_RIGHT = 0x0400,
- DCA_EXSS_SIDE_LEFT_RIGHT = 0x0800,
- DCA_EXSS_LFE2 = 0x1000,
- DCA_EXSS_SIDE_HIGH_LEFT_RIGHT = 0x2000,
- DCA_EXSS_REAR_HIGH_CENTER = 0x4000,
- DCA_EXSS_REAR_HIGH_LEFT_RIGHT = 0x8000,
-};
-
-enum DCAExtensionMask {
- DCA_EXT_CORE = 0x001, ///< core in core substream
- DCA_EXT_XXCH = 0x002, ///< XXCh channels extension in core substream
- DCA_EXT_X96 = 0x004, ///< 96/24 extension in core substream
- DCA_EXT_XCH = 0x008, ///< XCh channel extension in core substream
- DCA_EXT_EXSS_CORE = 0x010, ///< core in ExSS (extension substream)
- DCA_EXT_EXSS_XBR = 0x020, ///< extended bitrate extension in ExSS
- DCA_EXT_EXSS_XXCH = 0x040, ///< XXCh channels extension in ExSS
- DCA_EXT_EXSS_X96 = 0x080, ///< 96/24 extension in ExSS
- DCA_EXT_EXSS_LBR = 0x100, ///< low bitrate component in ExSS
- DCA_EXT_EXSS_XLL = 0x200, ///< lossless extension in ExSS
-};
-
-/* -1 are reserved or unknown */
-static const int dca_ext_audio_descr_mask[] = {
- DCA_EXT_XCH,
- -1,
- DCA_EXT_X96,
- DCA_EXT_XCH | DCA_EXT_X96,
- -1,
- -1,
- DCA_EXT_XXCH,
- -1,
-};
-
-/* extensions that reside in core substream */
-#define DCA_CORE_EXTS (DCA_EXT_XCH | DCA_EXT_XXCH | DCA_EXT_X96)
-
-/* Tables for mapping dts channel configurations to libavcodec multichannel api.
- * Some compromises have been made for special configurations. Most configurations
- * are never used so complete accuracy is not needed.
- *
- * L = left, R = right, C = center, S = surround, F = front, R = rear, T = total, OV = overhead.
- * S -> side, when both rear and back are configured move one of them to the side channel
- * OV -> center back
- * All 2 channel configurations -> AV_CH_LAYOUT_STEREO
- */
-static const uint64_t dca_core_channel_layout[] = {
- AV_CH_FRONT_CENTER, ///< 1, A
- AV_CH_LAYOUT_STEREO, ///< 2, A + B (dual mono)
- AV_CH_LAYOUT_STEREO, ///< 2, L + R (stereo)
- AV_CH_LAYOUT_STEREO, ///< 2, (L + R) + (L - R) (sum-difference)
- AV_CH_LAYOUT_STEREO, ///< 2, LT + RT (left and right total)
- AV_CH_LAYOUT_STEREO | AV_CH_FRONT_CENTER, ///< 3, C + L + R
- AV_CH_LAYOUT_STEREO | AV_CH_BACK_CENTER, ///< 3, L + R + S
- AV_CH_LAYOUT_STEREO | AV_CH_FRONT_CENTER | AV_CH_BACK_CENTER, ///< 4, C + L + R + S
- AV_CH_LAYOUT_STEREO | AV_CH_SIDE_LEFT | AV_CH_SIDE_RIGHT, ///< 4, L + R + SL + SR
-
- AV_CH_LAYOUT_STEREO | AV_CH_FRONT_CENTER | AV_CH_SIDE_LEFT |
- AV_CH_SIDE_RIGHT, ///< 5, C + L + R + SL + SR
-
- AV_CH_LAYOUT_STEREO | AV_CH_SIDE_LEFT | AV_CH_SIDE_RIGHT |
- AV_CH_FRONT_LEFT_OF_CENTER | AV_CH_FRONT_RIGHT_OF_CENTER, ///< 6, CL + CR + L + R + SL + SR
-
- AV_CH_LAYOUT_STEREO | AV_CH_BACK_LEFT | AV_CH_BACK_RIGHT |
- AV_CH_FRONT_CENTER | AV_CH_BACK_CENTER, ///< 6, C + L + R + LR + RR + OV
-
- AV_CH_FRONT_CENTER | AV_CH_FRONT_RIGHT_OF_CENTER |
- AV_CH_FRONT_LEFT_OF_CENTER | AV_CH_BACK_CENTER |
- AV_CH_BACK_LEFT | AV_CH_BACK_RIGHT, ///< 6, CF + CR + LF + RF + LR + RR
-
- AV_CH_FRONT_LEFT_OF_CENTER | AV_CH_FRONT_CENTER |
- AV_CH_FRONT_RIGHT_OF_CENTER | AV_CH_LAYOUT_STEREO |
- AV_CH_SIDE_LEFT | AV_CH_SIDE_RIGHT, ///< 7, CL + C + CR + L + R + SL + SR
-
- AV_CH_FRONT_LEFT_OF_CENTER | AV_CH_FRONT_RIGHT_OF_CENTER |
- AV_CH_LAYOUT_STEREO | AV_CH_SIDE_LEFT | AV_CH_SIDE_RIGHT |
- AV_CH_BACK_LEFT | AV_CH_BACK_RIGHT, ///< 8, CL + CR + L + R + SL1 + SL2 + SR1 + SR2
-
- AV_CH_FRONT_LEFT_OF_CENTER | AV_CH_FRONT_CENTER |
- AV_CH_FRONT_RIGHT_OF_CENTER | AV_CH_LAYOUT_STEREO |
- AV_CH_SIDE_LEFT | AV_CH_BACK_CENTER | AV_CH_SIDE_RIGHT, ///< 8, CL + C + CR + L + R + SL + S + SR
-};
-
-static const int8_t dca_lfe_index[] = {
- 1, 2, 2, 2, 2, 3, 2, 3, 2, 3, 2, 3, 1, 3, 2, 3
-};
-
-static const int8_t dca_channel_reorder_lfe[][9] = {
- { 0, -1, -1, -1, -1, -1, -1, -1, -1},
- { 0, 1, -1, -1, -1, -1, -1, -1, -1},
- { 0, 1, -1, -1, -1, -1, -1, -1, -1},
- { 0, 1, -1, -1, -1, -1, -1, -1, -1},
- { 0, 1, -1, -1, -1, -1, -1, -1, -1},
- { 2, 0, 1, -1, -1, -1, -1, -1, -1},
- { 0, 1, 3, -1, -1, -1, -1, -1, -1},
- { 2, 0, 1, 4, -1, -1, -1, -1, -1},
- { 0, 1, 3, 4, -1, -1, -1, -1, -1},
- { 2, 0, 1, 4, 5, -1, -1, -1, -1},
- { 3, 4, 0, 1, 5, 6, -1, -1, -1},
- { 2, 0, 1, 4, 5, 6, -1, -1, -1},
- { 0, 6, 4, 5, 2, 3, -1, -1, -1},
- { 4, 2, 5, 0, 1, 6, 7, -1, -1},
- { 5, 6, 0, 1, 7, 3, 8, 4, -1},
- { 4, 2, 5, 0, 1, 6, 8, 7, -1},
-};
-
-static const int8_t dca_channel_reorder_lfe_xch[][9] = {
- { 0, 2, -1, -1, -1, -1, -1, -1, -1},
- { 0, 1, 3, -1, -1, -1, -1, -1, -1},
- { 0, 1, 3, -1, -1, -1, -1, -1, -1},
- { 0, 1, 3, -1, -1, -1, -1, -1, -1},
- { 0, 1, 3, -1, -1, -1, -1, -1, -1},
- { 2, 0, 1, 4, -1, -1, -1, -1, -1},
- { 0, 1, 3, 4, -1, -1, -1, -1, -1},
- { 2, 0, 1, 4, 5, -1, -1, -1, -1},
- { 0, 1, 4, 5, 3, -1, -1, -1, -1},
- { 2, 0, 1, 5, 6, 4, -1, -1, -1},
- { 3, 4, 0, 1, 6, 7, 5, -1, -1},
- { 2, 0, 1, 4, 5, 6, 7, -1, -1},
- { 0, 6, 4, 5, 2, 3, 7, -1, -1},
- { 4, 2, 5, 0, 1, 7, 8, 6, -1},
- { 5, 6, 0, 1, 8, 3, 9, 4, 7},
- { 4, 2, 5, 0, 1, 6, 9, 8, 7},
-};
-
-static const int8_t dca_channel_reorder_nolfe[][9] = {
- { 0, -1, -1, -1, -1, -1, -1, -1, -1},
- { 0, 1, -1, -1, -1, -1, -1, -1, -1},
- { 0, 1, -1, -1, -1, -1, -1, -1, -1},
- { 0, 1, -1, -1, -1, -1, -1, -1, -1},
- { 0, 1, -1, -1, -1, -1, -1, -1, -1},
- { 2, 0, 1, -1, -1, -1, -1, -1, -1},
- { 0, 1, 2, -1, -1, -1, -1, -1, -1},
- { 2, 0, 1, 3, -1, -1, -1, -1, -1},
- { 0, 1, 2, 3, -1, -1, -1, -1, -1},
- { 2, 0, 1, 3, 4, -1, -1, -1, -1},
- { 2, 3, 0, 1, 4, 5, -1, -1, -1},
- { 2, 0, 1, 3, 4, 5, -1, -1, -1},
- { 0, 5, 3, 4, 1, 2, -1, -1, -1},
- { 3, 2, 4, 0, 1, 5, 6, -1, -1},
- { 4, 5, 0, 1, 6, 2, 7, 3, -1},
- { 3, 2, 4, 0, 1, 5, 7, 6, -1},
-};
-
-static const int8_t dca_channel_reorder_nolfe_xch[][9] = {
- { 0, 1, -1, -1, -1, -1, -1, -1, -1},
- { 0, 1, 2, -1, -1, -1, -1, -1, -1},
- { 0, 1, 2, -1, -1, -1, -1, -1, -1},
- { 0, 1, 2, -1, -1, -1, -1, -1, -1},
- { 0, 1, 2, -1, -1, -1, -1, -1, -1},
- { 2, 0, 1, 3, -1, -1, -1, -1, -1},
- { 0, 1, 2, 3, -1, -1, -1, -1, -1},
- { 2, 0, 1, 3, 4, -1, -1, -1, -1},
- { 0, 1, 3, 4, 2, -1, -1, -1, -1},
- { 2, 0, 1, 4, 5, 3, -1, -1, -1},
- { 2, 3, 0, 1, 5, 6, 4, -1, -1},
- { 2, 0, 1, 3, 4, 5, 6, -1, -1},
- { 0, 5, 3, 4, 1, 2, 6, -1, -1},
- { 3, 2, 4, 0, 1, 6, 7, 5, -1},
- { 4, 5, 0, 1, 7, 2, 8, 3, 6},
- { 3, 2, 4, 0, 1, 5, 8, 7, 6},
-};
-
-#define DCA_DOLBY 101 /* FIXME */
-
-#define DCA_CHANNEL_BITS 6
-#define DCA_CHANNEL_MASK 0x3F
-
-#define DCA_LFE 0x80
-
-#define HEADER_SIZE 14
-
-#define DCA_MAX_FRAME_SIZE 16384
-#define DCA_MAX_EXSS_HEADER_SIZE 4096
-
-#define DCA_BUFFER_PADDING_SIZE 1024
-
-/** Bit allocation */
-typedef struct {
- int offset; ///< code values offset
- int maxbits[8]; ///< max bits in VLC
- int wrap; ///< wrap for get_vlc2()
- VLC vlc[8]; ///< actual codes
-} BitAlloc;
-
-static BitAlloc dca_bitalloc_index; ///< indexes for samples VLC select
-static BitAlloc dca_tmode; ///< transition mode VLCs
-static BitAlloc dca_scalefactor; ///< scalefactor VLCs
-static BitAlloc dca_smpl_bitalloc[11]; ///< samples VLCs
-
-static av_always_inline int get_bitalloc(GetBitContext *gb, BitAlloc *ba,
- int idx)
-{
- return get_vlc2(gb, ba->vlc[idx].table, ba->vlc[idx].bits, ba->wrap) +
- ba->offset;
-}
-
-typedef struct {
- AVCodecContext *avctx;
- AVFrame frame;
- /* Frame header */
- int frame_type; ///< type of the current frame
- int samples_deficit; ///< deficit sample count
- int crc_present; ///< crc is present in the bitstream
- int sample_blocks; ///< number of PCM sample blocks
- int frame_size; ///< primary frame byte size
- int amode; ///< audio channels arrangement
- int sample_rate; ///< audio sampling rate
- int bit_rate; ///< transmission bit rate
- int bit_rate_index; ///< transmission bit rate index
-
- int downmix; ///< embedded downmix enabled
- int dynrange; ///< embedded dynamic range flag
- int timestamp; ///< embedded time stamp flag
- int aux_data; ///< auxiliary data flag
- int hdcd; ///< source material is mastered in HDCD
- int ext_descr; ///< extension audio descriptor flag
- int ext_coding; ///< extended coding flag
- int aspf; ///< audio sync word insertion flag
- int lfe; ///< low frequency effects flag
- int predictor_history; ///< predictor history flag
- int header_crc; ///< header crc check bytes
- int multirate_inter; ///< multirate interpolator switch
- int version; ///< encoder software revision
- int copy_history; ///< copy history
- int source_pcm_res; ///< source pcm resolution
- int front_sum; ///< front sum/difference flag
- int surround_sum; ///< surround sum/difference flag
- int dialog_norm; ///< dialog normalisation parameter
-
- /* Primary audio coding header */
- int subframes; ///< number of subframes
- int is_channels_set; ///< check for if the channel number is already set
- int total_channels; ///< number of channels including extensions
- int prim_channels; ///< number of primary audio channels
- int subband_activity[DCA_PRIM_CHANNELS_MAX]; ///< subband activity count
- int vq_start_subband[DCA_PRIM_CHANNELS_MAX]; ///< high frequency vq start subband
- int joint_intensity[DCA_PRIM_CHANNELS_MAX]; ///< joint intensity coding index
- int transient_huffman[DCA_PRIM_CHANNELS_MAX]; ///< transient mode code book
- int scalefactor_huffman[DCA_PRIM_CHANNELS_MAX]; ///< scale factor code book
- int bitalloc_huffman[DCA_PRIM_CHANNELS_MAX]; ///< bit allocation quantizer select
- int quant_index_huffman[DCA_PRIM_CHANNELS_MAX][DCA_ABITS_MAX]; ///< quantization index codebook select
- float scalefactor_adj[DCA_PRIM_CHANNELS_MAX][DCA_ABITS_MAX]; ///< scale factor adjustment
-
- /* Primary audio coding side information */
- int subsubframes[DCA_SUBFRAMES_MAX]; ///< number of subsubframes
- int partial_samples[DCA_SUBFRAMES_MAX]; ///< partial subsubframe samples count
- int prediction_mode[DCA_PRIM_CHANNELS_MAX][DCA_SUBBANDS]; ///< prediction mode (ADPCM used or not)
- int prediction_vq[DCA_PRIM_CHANNELS_MAX][DCA_SUBBANDS]; ///< prediction VQ coefs
- int bitalloc[DCA_PRIM_CHANNELS_MAX][DCA_SUBBANDS]; ///< bit allocation index
- int transition_mode[DCA_PRIM_CHANNELS_MAX][DCA_SUBBANDS]; ///< transition mode (transients)
- int scale_factor[DCA_PRIM_CHANNELS_MAX][DCA_SUBBANDS][2]; ///< scale factors (2 if transient)
- int joint_huff[DCA_PRIM_CHANNELS_MAX]; ///< joint subband scale factors codebook
- int joint_scale_factor[DCA_PRIM_CHANNELS_MAX][DCA_SUBBANDS]; ///< joint subband scale factors
- int downmix_coef[DCA_PRIM_CHANNELS_MAX][2]; ///< stereo downmix coefficients
- int dynrange_coef; ///< dynamic range coefficient
-
- int high_freq_vq[DCA_PRIM_CHANNELS_MAX][DCA_SUBBANDS]; ///< VQ encoded high frequency subbands
-
- float lfe_data[2 * DCA_LFE_MAX * (DCA_BLOCKS_MAX + 4)]; ///< Low frequency effect data
- int lfe_scale_factor;
-
- /* Subband samples history (for ADPCM) */
- DECLARE_ALIGNED(16, float, subband_samples_hist)[DCA_PRIM_CHANNELS_MAX][DCA_SUBBANDS][4];
- DECLARE_ALIGNED(32, float, subband_fir_hist)[DCA_PRIM_CHANNELS_MAX][512];
- DECLARE_ALIGNED(32, float, subband_fir_noidea)[DCA_PRIM_CHANNELS_MAX][32];
- int hist_index[DCA_PRIM_CHANNELS_MAX];
- DECLARE_ALIGNED(32, float, raXin)[32];
-
- int output; ///< type of output
- float scale_bias; ///< output scale
-
- DECLARE_ALIGNED(32, float, subband_samples)[DCA_BLOCKS_MAX][DCA_PRIM_CHANNELS_MAX][DCA_SUBBANDS][8];
- DECLARE_ALIGNED(32, float, samples)[(DCA_PRIM_CHANNELS_MAX + 1) * 256];
- const float *samples_chanptr[DCA_PRIM_CHANNELS_MAX + 1];
-
- uint8_t dca_buffer[DCA_MAX_FRAME_SIZE + DCA_MAX_EXSS_HEADER_SIZE + DCA_BUFFER_PADDING_SIZE];
- int dca_buffer_size; ///< how much data is in the dca_buffer
-
- const int8_t *channel_order_tab; ///< channel reordering table, lfe and non lfe
- GetBitContext gb;
- /* Current position in DCA frame */
- int current_subframe;
- int current_subsubframe;
-
- int core_ext_mask; ///< present extensions in the core substream
-
- /* XCh extension information */
- int xch_present; ///< XCh extension present and valid
- int xch_base_channel; ///< index of first (only) channel containing XCH data
-
- /* ExSS header parser */
- int static_fields; ///< static fields present
- int mix_metadata; ///< mixing metadata present
- int num_mix_configs; ///< number of mix out configurations
- int mix_config_num_ch[4]; ///< number of channels in each mix out configuration
-
- int profile;
-
- int debug_flag; ///< used for suppressing repeated error messages output
- DSPContext dsp;
- FFTContext imdct;
- SynthFilterContext synth;
- DCADSPContext dcadsp;
- FmtConvertContext fmt_conv;
-} DCAContext;
-
-static const uint16_t dca_vlc_offs[] = {
- 0, 512, 640, 768, 1282, 1794, 2436, 3080, 3770, 4454, 5364,
- 5372, 5380, 5388, 5392, 5396, 5412, 5420, 5428, 5460, 5492, 5508,
- 5572, 5604, 5668, 5796, 5860, 5892, 6412, 6668, 6796, 7308, 7564,
- 7820, 8076, 8620, 9132, 9388, 9910, 10166, 10680, 11196, 11726, 12240,
- 12752, 13298, 13810, 14326, 14840, 15500, 16022, 16540, 17158, 17678, 18264,
- 18796, 19352, 19926, 20468, 21472, 22398, 23014, 23622,
-};
-
-static av_cold void dca_init_vlcs(void)
-{
- static int vlcs_initialized = 0;
- int i, j, c = 14;
- static VLC_TYPE dca_table[23622][2];
-
- if (vlcs_initialized)
- return;
-
- dca_bitalloc_index.offset = 1;
- dca_bitalloc_index.wrap = 2;
- for (i = 0; i < 5; i++) {
- dca_bitalloc_index.vlc[i].table = &dca_table[dca_vlc_offs[i]];
- dca_bitalloc_index.vlc[i].table_allocated = dca_vlc_offs[i + 1] - dca_vlc_offs[i];
- init_vlc(&dca_bitalloc_index.vlc[i], bitalloc_12_vlc_bits[i], 12,
- bitalloc_12_bits[i], 1, 1,
- bitalloc_12_codes[i], 2, 2, INIT_VLC_USE_NEW_STATIC);
- }
- dca_scalefactor.offset = -64;
- dca_scalefactor.wrap = 2;
- for (i = 0; i < 5; i++) {
- dca_scalefactor.vlc[i].table = &dca_table[dca_vlc_offs[i + 5]];
- dca_scalefactor.vlc[i].table_allocated = dca_vlc_offs[i + 6] - dca_vlc_offs[i + 5];
- init_vlc(&dca_scalefactor.vlc[i], SCALES_VLC_BITS, 129,
- scales_bits[i], 1, 1,
- scales_codes[i], 2, 2, INIT_VLC_USE_NEW_STATIC);
- }
- dca_tmode.offset = 0;
- dca_tmode.wrap = 1;
- for (i = 0; i < 4; i++) {
- dca_tmode.vlc[i].table = &dca_table[dca_vlc_offs[i + 10]];
- dca_tmode.vlc[i].table_allocated = dca_vlc_offs[i + 11] - dca_vlc_offs[i + 10];
- init_vlc(&dca_tmode.vlc[i], tmode_vlc_bits[i], 4,
- tmode_bits[i], 1, 1,
- tmode_codes[i], 2, 2, INIT_VLC_USE_NEW_STATIC);
- }
-
- for (i = 0; i < 10; i++)
- for (j = 0; j < 7; j++) {
- if (!bitalloc_codes[i][j])
- break;
- dca_smpl_bitalloc[i + 1].offset = bitalloc_offsets[i];
- dca_smpl_bitalloc[i + 1].wrap = 1 + (j > 4);
- dca_smpl_bitalloc[i + 1].vlc[j].table = &dca_table[dca_vlc_offs[c]];
- dca_smpl_bitalloc[i + 1].vlc[j].table_allocated = dca_vlc_offs[c + 1] - dca_vlc_offs[c];
-
- init_vlc(&dca_smpl_bitalloc[i + 1].vlc[j], bitalloc_maxbits[i][j],
- bitalloc_sizes[i],
- bitalloc_bits[i][j], 1, 1,
- bitalloc_codes[i][j], 2, 2, INIT_VLC_USE_NEW_STATIC);
- c++;
- }
- vlcs_initialized = 1;
-}
-
-static inline void get_array(GetBitContext *gb, int *dst, int len, int bits)
-{
- while (len--)
- *dst++ = get_bits(gb, bits);
-}
-
-static int dca_parse_audio_coding_header(DCAContext *s, int base_channel)
-{
- int i, j;
- static const float adj_table[4] = { 1.0, 1.1250, 1.2500, 1.4375 };
- static const int bitlen[11] = { 0, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3 };
- static const int thr[11] = { 0, 1, 3, 3, 3, 3, 7, 7, 7, 7, 7 };
-
- s->total_channels = get_bits(&s->gb, 3) + 1 + base_channel;
- s->prim_channels = s->total_channels;
-
- if (s->prim_channels > DCA_PRIM_CHANNELS_MAX)
- s->prim_channels = DCA_PRIM_CHANNELS_MAX;
-
-
- for (i = base_channel; i < s->prim_channels; i++) {
- s->subband_activity[i] = get_bits(&s->gb, 5) + 2;
- if (s->subband_activity[i] > DCA_SUBBANDS)
- s->subband_activity[i] = DCA_SUBBANDS;
- }
- for (i = base_channel; i < s->prim_channels; i++) {
- s->vq_start_subband[i] = get_bits(&s->gb, 5) + 1;
- if (s->vq_start_subband[i] > DCA_SUBBANDS)
- s->vq_start_subband[i] = DCA_SUBBANDS;
- }
- get_array(&s->gb, s->joint_intensity + base_channel, s->prim_channels - base_channel, 3);
- get_array(&s->gb, s->transient_huffman + base_channel, s->prim_channels - base_channel, 2);
- get_array(&s->gb, s->scalefactor_huffman + base_channel, s->prim_channels - base_channel, 3);
- get_array(&s->gb, s->bitalloc_huffman + base_channel, s->prim_channels - base_channel, 3);
-
- /* Get codebooks quantization indexes */
- if (!base_channel)
- memset(s->quant_index_huffman, 0, sizeof(s->quant_index_huffman));
- for (j = 1; j < 11; j++)
- for (i = base_channel; i < s->prim_channels; i++)
- s->quant_index_huffman[i][j] = get_bits(&s->gb, bitlen[j]);
-
- /* Get scale factor adjustment */
- for (j = 0; j < 11; j++)
- for (i = base_channel; i < s->prim_channels; i++)
- s->scalefactor_adj[i][j] = 1;
-
- for (j = 1; j < 11; j++)
- for (i = base_channel; i < s->prim_channels; i++)
- if (s->quant_index_huffman[i][j] < thr[j])
- s->scalefactor_adj[i][j] = adj_table[get_bits(&s->gb, 2)];
-
- if (s->crc_present) {
- /* Audio header CRC check */
- get_bits(&s->gb, 16);
- }
-
- s->current_subframe = 0;
- s->current_subsubframe = 0;
-
-#ifdef TRACE
- av_log(s->avctx, AV_LOG_DEBUG, "subframes: %i\n", s->subframes);
- av_log(s->avctx, AV_LOG_DEBUG, "prim channels: %i\n", s->prim_channels);
- for (i = base_channel; i < s->prim_channels; i++) {
- av_log(s->avctx, AV_LOG_DEBUG, "subband activity: %i\n",
- s->subband_activity[i]);
- av_log(s->avctx, AV_LOG_DEBUG, "vq start subband: %i\n",
- s->vq_start_subband[i]);
- av_log(s->avctx, AV_LOG_DEBUG, "joint intensity: %i\n",
- s->joint_intensity[i]);
- av_log(s->avctx, AV_LOG_DEBUG, "transient mode codebook: %i\n",
- s->transient_huffman[i]);
- av_log(s->avctx, AV_LOG_DEBUG, "scale factor codebook: %i\n",
- s->scalefactor_huffman[i]);
- av_log(s->avctx, AV_LOG_DEBUG, "bit allocation quantizer: %i\n",
- s->bitalloc_huffman[i]);
- av_log(s->avctx, AV_LOG_DEBUG, "quant index huff:");
- for (j = 0; j < 11; j++)
- av_log(s->avctx, AV_LOG_DEBUG, " %i", s->quant_index_huffman[i][j]);
- av_log(s->avctx, AV_LOG_DEBUG, "\n");
- av_log(s->avctx, AV_LOG_DEBUG, "scalefac adj:");
- for (j = 0; j < 11; j++)
- av_log(s->avctx, AV_LOG_DEBUG, " %1.3f", s->scalefactor_adj[i][j]);
- av_log(s->avctx, AV_LOG_DEBUG, "\n");
- }
-#endif
-
- return 0;
-}
-
-static int dca_parse_frame_header(DCAContext *s)
-{
- init_get_bits(&s->gb, s->dca_buffer, s->dca_buffer_size * 8);
-
- /* Sync code */
- skip_bits_long(&s->gb, 32);
-
- /* Frame header */
- s->frame_type = get_bits(&s->gb, 1);
- s->samples_deficit = get_bits(&s->gb, 5) + 1;
- s->crc_present = get_bits(&s->gb, 1);
- s->sample_blocks = get_bits(&s->gb, 7) + 1;
- s->frame_size = get_bits(&s->gb, 14) + 1;
- if (s->frame_size < 95)
- return AVERROR_INVALIDDATA;
- s->amode = get_bits(&s->gb, 6);
- s->sample_rate = dca_sample_rates[get_bits(&s->gb, 4)];
- if (!s->sample_rate)
- return AVERROR_INVALIDDATA;
- s->bit_rate_index = get_bits(&s->gb, 5);
- s->bit_rate = dca_bit_rates[s->bit_rate_index];
- if (!s->bit_rate)
- return AVERROR_INVALIDDATA;
-
- s->downmix = get_bits(&s->gb, 1);
- s->dynrange = get_bits(&s->gb, 1);
- s->timestamp = get_bits(&s->gb, 1);
- s->aux_data = get_bits(&s->gb, 1);
- s->hdcd = get_bits(&s->gb, 1);
- s->ext_descr = get_bits(&s->gb, 3);
- s->ext_coding = get_bits(&s->gb, 1);
- s->aspf = get_bits(&s->gb, 1);
- s->lfe = get_bits(&s->gb, 2);
- s->predictor_history = get_bits(&s->gb, 1);
-
- /* TODO: check CRC */
- if (s->crc_present)
- s->header_crc = get_bits(&s->gb, 16);
-
- s->multirate_inter = get_bits(&s->gb, 1);
- s->version = get_bits(&s->gb, 4);
- s->copy_history = get_bits(&s->gb, 2);
- s->source_pcm_res = get_bits(&s->gb, 3);
- s->front_sum = get_bits(&s->gb, 1);
- s->surround_sum = get_bits(&s->gb, 1);
- s->dialog_norm = get_bits(&s->gb, 4);
-
- /* FIXME: channels mixing levels */
- s->output = s->amode;
- if (s->lfe)
- s->output |= DCA_LFE;
-
-#ifdef TRACE
- av_log(s->avctx, AV_LOG_DEBUG, "frame type: %i\n", s->frame_type);
- av_log(s->avctx, AV_LOG_DEBUG, "samples deficit: %i\n", s->samples_deficit);
- av_log(s->avctx, AV_LOG_DEBUG, "crc present: %i\n", s->crc_present);
- av_log(s->avctx, AV_LOG_DEBUG, "sample blocks: %i (%i samples)\n",
- s->sample_blocks, s->sample_blocks * 32);
- av_log(s->avctx, AV_LOG_DEBUG, "frame size: %i bytes\n", s->frame_size);
- av_log(s->avctx, AV_LOG_DEBUG, "amode: %i (%i channels)\n",
- s->amode, dca_channels[s->amode]);
- av_log(s->avctx, AV_LOG_DEBUG, "sample rate: %i Hz\n",
- s->sample_rate);
- av_log(s->avctx, AV_LOG_DEBUG, "bit rate: %i bits/s\n",
- s->bit_rate);
- av_log(s->avctx, AV_LOG_DEBUG, "downmix: %i\n", s->downmix);
- av_log(s->avctx, AV_LOG_DEBUG, "dynrange: %i\n", s->dynrange);
- av_log(s->avctx, AV_LOG_DEBUG, "timestamp: %i\n", s->timestamp);
- av_log(s->avctx, AV_LOG_DEBUG, "aux_data: %i\n", s->aux_data);
- av_log(s->avctx, AV_LOG_DEBUG, "hdcd: %i\n", s->hdcd);
- av_log(s->avctx, AV_LOG_DEBUG, "ext descr: %i\n", s->ext_descr);
- av_log(s->avctx, AV_LOG_DEBUG, "ext coding: %i\n", s->ext_coding);
- av_log(s->avctx, AV_LOG_DEBUG, "aspf: %i\n", s->aspf);
- av_log(s->avctx, AV_LOG_DEBUG, "lfe: %i\n", s->lfe);
- av_log(s->avctx, AV_LOG_DEBUG, "predictor history: %i\n",
- s->predictor_history);
- av_log(s->avctx, AV_LOG_DEBUG, "header crc: %i\n", s->header_crc);
- av_log(s->avctx, AV_LOG_DEBUG, "multirate inter: %i\n",
- s->multirate_inter);
- av_log(s->avctx, AV_LOG_DEBUG, "version number: %i\n", s->version);
- av_log(s->avctx, AV_LOG_DEBUG, "copy history: %i\n", s->copy_history);
- av_log(s->avctx, AV_LOG_DEBUG,
- "source pcm resolution: %i (%i bits/sample)\n",
- s->source_pcm_res, dca_bits_per_sample[s->source_pcm_res]);
- av_log(s->avctx, AV_LOG_DEBUG, "front sum: %i\n", s->front_sum);
- av_log(s->avctx, AV_LOG_DEBUG, "surround sum: %i\n", s->surround_sum);
- av_log(s->avctx, AV_LOG_DEBUG, "dialog norm: %i\n", s->dialog_norm);
- av_log(s->avctx, AV_LOG_DEBUG, "\n");
-#endif
-
- /* Primary audio coding header */
- s->subframes = get_bits(&s->gb, 4) + 1;
-
- return dca_parse_audio_coding_header(s, 0);
-}
-
-
-static inline int get_scale(GetBitContext *gb, int level, int value, int log2range)
-{
- if (level < 5) {
- /* huffman encoded */
- value += get_bitalloc(gb, &dca_scalefactor, level);
- value = av_clip(value, 0, (1 << log2range) - 1);
- } else if (level < 8) {
- if (level + 1 > log2range) {
- skip_bits(gb, level + 1 - log2range);
- value = get_bits(gb, log2range);
- } else {
- value = get_bits(gb, level + 1);
- }
- }
- return value;
-}
-
-static int dca_subframe_header(DCAContext *s, int base_channel, int block_index)
-{
- /* Primary audio coding side information */
- int j, k;
-
- if (get_bits_left(&s->gb) < 0)
- return AVERROR_INVALIDDATA;
-
- if (!base_channel) {
- s->subsubframes[s->current_subframe] = get_bits(&s->gb, 2) + 1;
- s->partial_samples[s->current_subframe] = get_bits(&s->gb, 3);
- }
-
- for (j = base_channel; j < s->prim_channels; j++) {
- for (k = 0; k < s->subband_activity[j]; k++)
- s->prediction_mode[j][k] = get_bits(&s->gb, 1);
- }
-
- /* Get prediction codebook */
- for (j = base_channel; j < s->prim_channels; j++) {
- for (k = 0; k < s->subband_activity[j]; k++) {
- if (s->prediction_mode[j][k] > 0) {
- /* (Prediction coefficient VQ address) */
- s->prediction_vq[j][k] = get_bits(&s->gb, 12);
- }
- }
- }
-
- /* Bit allocation index */
- for (j = base_channel; j < s->prim_channels; j++) {
- for (k = 0; k < s->vq_start_subband[j]; k++) {
- if (s->bitalloc_huffman[j] == 6)
- s->bitalloc[j][k] = get_bits(&s->gb, 5);
- else if (s->bitalloc_huffman[j] == 5)
- s->bitalloc[j][k] = get_bits(&s->gb, 4);
- else if (s->bitalloc_huffman[j] == 7) {
- av_log(s->avctx, AV_LOG_ERROR,
- "Invalid bit allocation index\n");
- return AVERROR_INVALIDDATA;
- } else {
- s->bitalloc[j][k] =
- get_bitalloc(&s->gb, &dca_bitalloc_index, s->bitalloc_huffman[j]);
- }
-
- if (s->bitalloc[j][k] > 26) {
- // av_log(s->avctx, AV_LOG_DEBUG, "bitalloc index [%i][%i] too big (%i)\n",
- // j, k, s->bitalloc[j][k]);
- return AVERROR_INVALIDDATA;
- }
- }
- }
-
- /* Transition mode */
- for (j = base_channel; j < s->prim_channels; j++) {
- for (k = 0; k < s->subband_activity[j]; k++) {
- s->transition_mode[j][k] = 0;
- if (s->subsubframes[s->current_subframe] > 1 &&
- k < s->vq_start_subband[j] && s->bitalloc[j][k] > 0) {
- s->transition_mode[j][k] =
- get_bitalloc(&s->gb, &dca_tmode, s->transient_huffman[j]);
- }
- }
- }
-
- if (get_bits_left(&s->gb) < 0)
- return AVERROR_INVALIDDATA;
-
- for (j = base_channel; j < s->prim_channels; j++) {
- const uint32_t *scale_table;
- int scale_sum, log_size;
-
- memset(s->scale_factor[j], 0,
- s->subband_activity[j] * sizeof(s->scale_factor[0][0][0]) * 2);
-
- if (s->scalefactor_huffman[j] == 6) {
- scale_table = scale_factor_quant7;
- log_size = 7;
- } else {
- scale_table = scale_factor_quant6;
- log_size = 6;
- }
-
- /* When huffman coded, only the difference is encoded */
- scale_sum = 0;
-
- for (k = 0; k < s->subband_activity[j]; k++) {
- if (k >= s->vq_start_subband[j] || s->bitalloc[j][k] > 0) {
- scale_sum = get_scale(&s->gb, s->scalefactor_huffman[j], scale_sum, log_size);
- s->scale_factor[j][k][0] = scale_table[scale_sum];
- }
-
- if (k < s->vq_start_subband[j] && s->transition_mode[j][k]) {
- /* Get second scale factor */
- scale_sum = get_scale(&s->gb, s->scalefactor_huffman[j], scale_sum, log_size);
- s->scale_factor[j][k][1] = scale_table[scale_sum];
- }
- }
- }
-
- /* Joint subband scale factor codebook select */
- for (j = base_channel; j < s->prim_channels; j++) {
- /* Transmitted only if joint subband coding enabled */
- if (s->joint_intensity[j] > 0)
- s->joint_huff[j] = get_bits(&s->gb, 3);
- }
-
- if (get_bits_left(&s->gb) < 0)
- return AVERROR_INVALIDDATA;
-
- /* Scale factors for joint subband coding */
- for (j = base_channel; j < s->prim_channels; j++) {
- int source_channel;
-
- /* Transmitted only if joint subband coding enabled */
- if (s->joint_intensity[j] > 0) {
- int scale = 0;
- source_channel = s->joint_intensity[j] - 1;
-
- /* When huffman coded, only the difference is encoded
- * (is this valid as well for joint scales ???) */
-
- for (k = s->subband_activity[j]; k < s->subband_activity[source_channel]; k++) {
- scale = get_scale(&s->gb, s->joint_huff[j], 64 /* bias */, 7);
- s->joint_scale_factor[j][k] = scale; /*joint_scale_table[scale]; */
- }
-
- if (!(s->debug_flag & 0x02)) {
- av_log(s->avctx, AV_LOG_DEBUG,
- "Joint stereo coding not supported\n");
- s->debug_flag |= 0x02;
- }
- }
- }
-
- /* Stereo downmix coefficients */
- if (!base_channel && s->prim_channels > 2) {
- if (s->downmix) {
- for (j = base_channel; j < s->prim_channels; j++) {
- s->downmix_coef[j][0] = get_bits(&s->gb, 7);
- s->downmix_coef[j][1] = get_bits(&s->gb, 7);
- }
- } else {
- int am = s->amode & DCA_CHANNEL_MASK;
- if (am >= FF_ARRAY_ELEMS(dca_default_coeffs)) {
- av_log(s->avctx, AV_LOG_ERROR,
- "Invalid channel mode %d\n", am);
- return AVERROR_INVALIDDATA;
- }
- for (j = base_channel; j < s->prim_channels; j++) {
- s->downmix_coef[j][0] = dca_default_coeffs[am][j][0];
- s->downmix_coef[j][1] = dca_default_coeffs[am][j][1];
- }
- }
- }
-
- /* Dynamic range coefficient */
- if (!base_channel && s->dynrange)
- s->dynrange_coef = get_bits(&s->gb, 8);
-
- /* Side information CRC check word */
- if (s->crc_present) {
- get_bits(&s->gb, 16);
- }
-
- /*
- * Primary audio data arrays
- */
-
- /* VQ encoded high frequency subbands */
- for (j = base_channel; j < s->prim_channels; j++)
- for (k = s->vq_start_subband[j]; k < s->subband_activity[j]; k++)
- /* 1 vector -> 32 samples */
- s->high_freq_vq[j][k] = get_bits(&s->gb, 10);
-
- /* Low frequency effect data */
- if (!base_channel && s->lfe) {
- /* LFE samples */
- int lfe_samples = 2 * s->lfe * (4 + block_index);
- int lfe_end_sample = 2 * s->lfe * (4 + block_index + s->subsubframes[s->current_subframe]);
- float lfe_scale;
-
- for (j = lfe_samples; j < lfe_end_sample; j++) {
- /* Signed 8 bits int */
- s->lfe_data[j] = get_sbits(&s->gb, 8);
- }
-
- /* Scale factor index */
- skip_bits(&s->gb, 1);
- s->lfe_scale_factor = scale_factor_quant7[get_bits(&s->gb, 7)];
-
- /* Quantization step size * scale factor */
- lfe_scale = 0.035 * s->lfe_scale_factor;
-
- for (j = lfe_samples; j < lfe_end_sample; j++)
- s->lfe_data[j] *= lfe_scale;
- }
-
-#ifdef TRACE
- av_log(s->avctx, AV_LOG_DEBUG, "subsubframes: %i\n",
- s->subsubframes[s->current_subframe]);
- av_log(s->avctx, AV_LOG_DEBUG, "partial samples: %i\n",
- s->partial_samples[s->current_subframe]);
-
- for (j = base_channel; j < s->prim_channels; j++) {
- av_log(s->avctx, AV_LOG_DEBUG, "prediction mode:");
- for (k = 0; k < s->subband_activity[j]; k++)
- av_log(s->avctx, AV_LOG_DEBUG, " %i", s->prediction_mode[j][k]);
- av_log(s->avctx, AV_LOG_DEBUG, "\n");
- }
- for (j = base_channel; j < s->prim_channels; j++) {
- for (k = 0; k < s->subband_activity[j]; k++)
- av_log(s->avctx, AV_LOG_DEBUG,
- "prediction coefs: %f, %f, %f, %f\n",
- (float) adpcm_vb[s->prediction_vq[j][k]][0] / 8192,
- (float) adpcm_vb[s->prediction_vq[j][k]][1] / 8192,
- (float) adpcm_vb[s->prediction_vq[j][k]][2] / 8192,
- (float) adpcm_vb[s->prediction_vq[j][k]][3] / 8192);
- }
- for (j = base_channel; j < s->prim_channels; j++) {
- av_log(s->avctx, AV_LOG_DEBUG, "bitalloc index: ");
- for (k = 0; k < s->vq_start_subband[j]; k++)
- av_log(s->avctx, AV_LOG_DEBUG, "%2.2i ", s->bitalloc[j][k]);
- av_log(s->avctx, AV_LOG_DEBUG, "\n");
- }
- for (j = base_channel; j < s->prim_channels; j++) {
- av_log(s->avctx, AV_LOG_DEBUG, "Transition mode:");
- for (k = 0; k < s->subband_activity[j]; k++)
- av_log(s->avctx, AV_LOG_DEBUG, " %i", s->transition_mode[j][k]);
- av_log(s->avctx, AV_LOG_DEBUG, "\n");
- }
- for (j = base_channel; j < s->prim_channels; j++) {
- av_log(s->avctx, AV_LOG_DEBUG, "Scale factor:");
- for (k = 0; k < s->subband_activity[j]; k++) {
- if (k >= s->vq_start_subband[j] || s->bitalloc[j][k] > 0)
- av_log(s->avctx, AV_LOG_DEBUG, " %i", s->scale_factor[j][k][0]);
- if (k < s->vq_start_subband[j] && s->transition_mode[j][k])
- av_log(s->avctx, AV_LOG_DEBUG, " %i(t)", s->scale_factor[j][k][1]);
- }
- av_log(s->avctx, AV_LOG_DEBUG, "\n");
- }
- for (j = base_channel; j < s->prim_channels; j++) {
- if (s->joint_intensity[j] > 0) {
- int source_channel = s->joint_intensity[j] - 1;
- av_log(s->avctx, AV_LOG_DEBUG, "Joint scale factor index:\n");
- for (k = s->subband_activity[j]; k < s->subband_activity[source_channel]; k++)
- av_log(s->avctx, AV_LOG_DEBUG, " %i", s->joint_scale_factor[j][k]);
- av_log(s->avctx, AV_LOG_DEBUG, "\n");
- }
- }
- if (!base_channel && s->prim_channels > 2 && s->downmix) {
- av_log(s->avctx, AV_LOG_DEBUG, "Downmix coeffs:\n");
- for (j = 0; j < s->prim_channels; j++) {
- av_log(s->avctx, AV_LOG_DEBUG, "Channel 0, %d = %f\n", j,
- dca_downmix_coeffs[s->downmix_coef[j][0]]);
- av_log(s->avctx, AV_LOG_DEBUG, "Channel 1, %d = %f\n", j,
- dca_downmix_coeffs[s->downmix_coef[j][1]]);
- }
- av_log(s->avctx, AV_LOG_DEBUG, "\n");
- }
- for (j = base_channel; j < s->prim_channels; j++)
- for (k = s->vq_start_subband[j]; k < s->subband_activity[j]; k++)
- av_log(s->avctx, AV_LOG_DEBUG, "VQ index: %i\n", s->high_freq_vq[j][k]);
- if (!base_channel && s->lfe) {
- int lfe_samples = 2 * s->lfe * (4 + block_index);
- int lfe_end_sample = 2 * s->lfe * (4 + block_index + s->subsubframes[s->current_subframe]);
-
- av_log(s->avctx, AV_LOG_DEBUG, "LFE samples:\n");
- for (j = lfe_samples; j < lfe_end_sample; j++)
- av_log(s->avctx, AV_LOG_DEBUG, " %f", s->lfe_data[j]);
- av_log(s->avctx, AV_LOG_DEBUG, "\n");
- }
-#endif
-
- return 0;
-}
-
-static void qmf_32_subbands(DCAContext *s, int chans,
- float samples_in[32][8], float *samples_out,
- float scale)
-{
- const float *prCoeff;
- int i;
-
- int sb_act = s->subband_activity[chans];
- int subindex;
-
- scale *= sqrt(1 / 8.0);
-
- /* Select filter */
- if (!s->multirate_inter) /* Non-perfect reconstruction */
- prCoeff = fir_32bands_nonperfect;
- else /* Perfect reconstruction */
- prCoeff = fir_32bands_perfect;
-
- for (i = sb_act; i < 32; i++)
- s->raXin[i] = 0.0;
-
- /* Reconstructed channel sample index */
- for (subindex = 0; subindex < 8; subindex++) {
- /* Load in one sample from each subband and clear inactive subbands */
- for (i = 0; i < sb_act; i++) {
- unsigned sign = (i - 1) & 2;
- uint32_t v = AV_RN32A(&samples_in[i][subindex]) ^ sign << 30;
- AV_WN32A(&s->raXin[i], v);
- }
-
- s->synth.synth_filter_float(&s->imdct,
- s->subband_fir_hist[chans],
- &s->hist_index[chans],
- s->subband_fir_noidea[chans], prCoeff,
- samples_out, s->raXin, scale);
- samples_out += 32;
- }
-}
-
-static void lfe_interpolation_fir(DCAContext *s, int decimation_select,
- int num_deci_sample, float *samples_in,
- float *samples_out, float scale)
-{
- /* samples_in: An array holding decimated samples.
- * Samples in current subframe starts from samples_in[0],
- * while samples_in[-1], samples_in[-2], ..., stores samples
- * from last subframe as history.
- *
- * samples_out: An array holding interpolated samples
- */
-
- int decifactor;
- const float *prCoeff;
- int deciindex;
-
- /* Select decimation filter */
- if (decimation_select == 1) {
- decifactor = 64;
- prCoeff = lfe_fir_128;
- } else {
- decifactor = 32;
- prCoeff = lfe_fir_64;
- }
- /* Interpolation */
- for (deciindex = 0; deciindex < num_deci_sample; deciindex++) {
- s->dcadsp.lfe_fir(samples_out, samples_in, prCoeff, decifactor, scale);
- samples_in++;
- samples_out += 2 * decifactor;
- }
-}
-
-/* downmixing routines */
-#define MIX_REAR1(samples, si1, rs, coef) \
- samples[i] += samples[si1] * coef[rs][0]; \
- samples[i+256] += samples[si1] * coef[rs][1];
-
-#define MIX_REAR2(samples, si1, si2, rs, coef) \
- samples[i] += samples[si1] * coef[rs][0] + samples[si2] * coef[rs + 1][0]; \
- samples[i+256] += samples[si1] * coef[rs][1] + samples[si2] * coef[rs + 1][1];
-
-#define MIX_FRONT3(samples, coef) \
- t = samples[i + c]; \
- u = samples[i + l]; \
- v = samples[i + r]; \
- samples[i] = t * coef[0][0] + u * coef[1][0] + v * coef[2][0]; \
- samples[i+256] = t * coef[0][1] + u * coef[1][1] + v * coef[2][1];
-
-#define DOWNMIX_TO_STEREO(op1, op2) \
- for (i = 0; i < 256; i++) { \
- op1 \
- op2 \
- }
-
-static void dca_downmix(float *samples, int srcfmt,
- int downmix_coef[DCA_PRIM_CHANNELS_MAX][2],
- const int8_t *channel_mapping)
-{
- int c, l, r, sl, sr, s;
- int i;
- float t, u, v;
- float coef[DCA_PRIM_CHANNELS_MAX][2];
-
- for (i = 0; i < DCA_PRIM_CHANNELS_MAX; i++) {
- coef[i][0] = dca_downmix_coeffs[downmix_coef[i][0]];
- coef[i][1] = dca_downmix_coeffs[downmix_coef[i][1]];
- }
-
- switch (srcfmt) {
- case DCA_MONO:
- case DCA_CHANNEL:
- case DCA_STEREO_TOTAL:
- case DCA_STEREO_SUMDIFF:
- case DCA_4F2R:
- av_log(NULL, 0, "Not implemented!\n");
- break;
- case DCA_STEREO:
- break;
- case DCA_3F:
- c = channel_mapping[0] * 256;
- l = channel_mapping[1] * 256;
- r = channel_mapping[2] * 256;
- DOWNMIX_TO_STEREO(MIX_FRONT3(samples, coef), );
- break;
- case DCA_2F1R:
- s = channel_mapping[2] * 256;
- DOWNMIX_TO_STEREO(MIX_REAR1(samples, i + s, 2, coef), );
- break;
- case DCA_3F1R:
- c = channel_mapping[0] * 256;
- l = channel_mapping[1] * 256;
- r = channel_mapping[2] * 256;
- s = channel_mapping[3] * 256;
- DOWNMIX_TO_STEREO(MIX_FRONT3(samples, coef),
- MIX_REAR1(samples, i + s, 3, coef));
- break;
- case DCA_2F2R:
- sl = channel_mapping[2] * 256;
- sr = channel_mapping[3] * 256;
- DOWNMIX_TO_STEREO(MIX_REAR2(samples, i + sl, i + sr, 2, coef), );
- break;
- case DCA_3F2R:
- c = channel_mapping[0] * 256;
- l = channel_mapping[1] * 256;
- r = channel_mapping[2] * 256;
- sl = channel_mapping[3] * 256;
- sr = channel_mapping[4] * 256;
- DOWNMIX_TO_STEREO(MIX_FRONT3(samples, coef),
- MIX_REAR2(samples, i + sl, i + sr, 3, coef));
- break;
- }
-}
-
-
-#ifndef decode_blockcodes
-/* Very compact version of the block code decoder that does not use table
- * look-up but is slightly slower */
-static int decode_blockcode(int code, int levels, int *values)
-{
- int i;
- int offset = (levels - 1) >> 1;
-
- for (i = 0; i < 4; i++) {
- int div = FASTDIV(code, levels);
- values[i] = code - offset - div * levels;
- code = div;
- }
-
- return code;
-}
-
-static int decode_blockcodes(int code1, int code2, int levels, int *values)
-{
- return decode_blockcode(code1, levels, values) |
- decode_blockcode(code2, levels, values + 4);
-}
-#endif
-
-static const uint8_t abits_sizes[7] = { 7, 10, 12, 13, 15, 17, 19 };
-static const uint8_t abits_levels[7] = { 3, 5, 7, 9, 13, 17, 25 };
-
-#ifndef int8x8_fmul_int32
-static inline void int8x8_fmul_int32(float *dst, const int8_t *src, int scale)
-{
- float fscale = scale / 16.0;
- int i;
- for (i = 0; i < 8; i++)
- dst[i] = src[i] * fscale;
-}
-#endif
-
-static int dca_subsubframe(DCAContext *s, int base_channel, int block_index)
-{
- int k, l;
- int subsubframe = s->current_subsubframe;
-
- const float *quant_step_table;
-
- /* FIXME */
- float (*subband_samples)[DCA_SUBBANDS][8] = s->subband_samples[block_index];
- LOCAL_ALIGNED_16(int, block, [8]);
-
- /*
- * Audio data
- */
-
- /* Select quantization step size table */
- if (s->bit_rate_index == 0x1f)
- quant_step_table = lossless_quant_d;
- else
- quant_step_table = lossy_quant_d;
-
- for (k = base_channel; k < s->prim_channels; k++) {
- if (get_bits_left(&s->gb) < 0)
- return AVERROR_INVALIDDATA;
-
- for (l = 0; l < s->vq_start_subband[k]; l++) {
- int m;
-
- /* Select the mid-tread linear quantizer */
- int abits = s->bitalloc[k][l];
-
- float quant_step_size = quant_step_table[abits];
-
- /*
- * Determine quantization index code book and its type
- */
-
- /* Select quantization index code book */
- int sel = s->quant_index_huffman[k][abits];
-
- /*
- * Extract bits from the bit stream
- */
- if (!abits) {
- memset(subband_samples[k][l], 0, 8 * sizeof(subband_samples[0][0][0]));
- } else {
- /* Deal with transients */
- int sfi = s->transition_mode[k][l] && subsubframe >= s->transition_mode[k][l];
- float rscale = quant_step_size * s->scale_factor[k][l][sfi] *
- s->scalefactor_adj[k][sel];
-
- if (abits >= 11 || !dca_smpl_bitalloc[abits].vlc[sel].table) {
- if (abits <= 7) {
- /* Block code */
- int block_code1, block_code2, size, levels, err;
-
- size = abits_sizes[abits - 1];
- levels = abits_levels[abits - 1];
-
- block_code1 = get_bits(&s->gb, size);
- block_code2 = get_bits(&s->gb, size);
- err = decode_blockcodes(block_code1, block_code2,
- levels, block);
- if (err) {
- av_log(s->avctx, AV_LOG_ERROR,
- "ERROR: block code look-up failed\n");
- return AVERROR_INVALIDDATA;
- }
- } else {
- /* no coding */
- for (m = 0; m < 8; m++)
- block[m] = get_sbits(&s->gb, abits - 3);
- }
- } else {
- /* Huffman coded */
- for (m = 0; m < 8; m++)
- block[m] = get_bitalloc(&s->gb,
- &dca_smpl_bitalloc[abits], sel);
- }
-
- s->fmt_conv.int32_to_float_fmul_scalar(subband_samples[k][l],
- block, rscale, 8);
- }
-
- /*
- * Inverse ADPCM if in prediction mode
- */
- if (s->prediction_mode[k][l]) {
- int n;
- for (m = 0; m < 8; m++) {
- for (n = 1; n <= 4; n++)
- if (m >= n)
- subband_samples[k][l][m] +=
- (adpcm_vb[s->prediction_vq[k][l]][n - 1] *
- subband_samples[k][l][m - n] / 8192);
- else if (s->predictor_history)
- subband_samples[k][l][m] +=
- (adpcm_vb[s->prediction_vq[k][l]][n - 1] *
- s->subband_samples_hist[k][l][m - n + 4] / 8192);
- }
- }
- }
-
- /*
- * Decode VQ encoded high frequencies
- */
- for (l = s->vq_start_subband[k]; l < s->subband_activity[k]; l++) {
- /* 1 vector -> 32 samples but we only need the 8 samples
- * for this subsubframe. */
- int hfvq = s->high_freq_vq[k][l];
-
- if (!s->debug_flag & 0x01) {
- av_log(s->avctx, AV_LOG_DEBUG,
- "Stream with high frequencies VQ coding\n");
- s->debug_flag |= 0x01;
- }
-
- int8x8_fmul_int32(subband_samples[k][l],
- &high_freq_vq[hfvq][subsubframe * 8],
- s->scale_factor[k][l][0]);
- }
- }
-
- /* Check for DSYNC after subsubframe */
- if (s->aspf || subsubframe == s->subsubframes[s->current_subframe] - 1) {
- if (0xFFFF == get_bits(&s->gb, 16)) { /* 0xFFFF */
-#ifdef TRACE
- av_log(s->avctx, AV_LOG_DEBUG, "Got subframe DSYNC\n");
-#endif
- } else {
- av_log(s->avctx, AV_LOG_ERROR, "Didn't get subframe DSYNC\n");
- }
- }
-
- /* Backup predictor history for adpcm */
- for (k = base_channel; k < s->prim_channels; k++)
- for (l = 0; l < s->vq_start_subband[k]; l++)
- memcpy(s->subband_samples_hist[k][l],
- &subband_samples[k][l][4],
- 4 * sizeof(subband_samples[0][0][0]));
-
- return 0;
-}
-
-static int dca_filter_channels(DCAContext *s, int block_index)
+const uint32_t avpriv_dca_sample_rates[16] =
{
- float (*subband_samples)[DCA_SUBBANDS][8] = s->subband_samples[block_index];
- int k;
-
- /* 32 subbands QMF */
- for (k = 0; k < s->prim_channels; k++) {
-/* static float pcm_to_double[8] = { 32768.0, 32768.0, 524288.0, 524288.0,
- 0, 8388608.0, 8388608.0 };*/
- qmf_32_subbands(s, k, subband_samples[k],
- &s->samples[256 * s->channel_order_tab[k]],
- M_SQRT1_2 * s->scale_bias /* pcm_to_double[s->source_pcm_res] */);
- }
-
- /* Down mixing */
- if (s->avctx->request_channels == 2 && s->prim_channels > 2) {
- dca_downmix(s->samples, s->amode, s->downmix_coef, s->channel_order_tab);
- }
-
- /* Generate LFE samples for this subsubframe FIXME!!! */
- if (s->output & DCA_LFE) {
- lfe_interpolation_fir(s, s->lfe, 2 * s->lfe,
- s->lfe_data + 2 * s->lfe * (block_index + 4),
- &s->samples[256 * dca_lfe_index[s->amode]],
- (1.0 / 256.0) * s->scale_bias);
- /* Outputs 20bits pcm samples */
- }
-
- return 0;
-}
-
-
-static int dca_subframe_footer(DCAContext *s, int base_channel)
-{
- int aux_data_count = 0, i;
-
- /*
- * Unpack optional information
- */
-
- /* presumably optional information only appears in the core? */
- if (!base_channel) {
- if (s->timestamp)
- skip_bits_long(&s->gb, 32);
-
- if (s->aux_data)
- aux_data_count = get_bits(&s->gb, 6);
-
- for (i = 0; i < aux_data_count; i++)
- get_bits(&s->gb, 8);
-
- if (s->crc_present && (s->downmix || s->dynrange))
- get_bits(&s->gb, 16);
- }
-
- return 0;
-}
-
-/**
- * Decode a dca frame block
- *
- * @param s pointer to the DCAContext
- */
-
-static int dca_decode_block(DCAContext *s, int base_channel, int block_index)
-{
- int ret;
-
- /* Sanity check */
- if (s->current_subframe >= s->subframes) {
- av_log(s->avctx, AV_LOG_DEBUG, "check failed: %i>%i",
- s->current_subframe, s->subframes);
- return AVERROR_INVALIDDATA;
- }
-
- if (!s->current_subsubframe) {
-#ifdef TRACE
- av_log(s->avctx, AV_LOG_DEBUG, "DSYNC dca_subframe_header\n");
-#endif
- /* Read subframe header */
- if ((ret = dca_subframe_header(s, base_channel, block_index)))
- return ret;
- }
-
- /* Read subsubframe */
-#ifdef TRACE
- av_log(s->avctx, AV_LOG_DEBUG, "DSYNC dca_subsubframe\n");
-#endif
- if ((ret = dca_subsubframe(s, base_channel, block_index)))
- return ret;
-
- /* Update state */
- s->current_subsubframe++;
- if (s->current_subsubframe >= s->subsubframes[s->current_subframe]) {
- s->current_subsubframe = 0;
- s->current_subframe++;
- }
- if (s->current_subframe >= s->subframes) {
-#ifdef TRACE
- av_log(s->avctx, AV_LOG_DEBUG, "DSYNC dca_subframe_footer\n");
-#endif
- /* Read subframe footer */
- if ((ret = dca_subframe_footer(s, base_channel)))
- return ret;
- }
-
- return 0;
-}
-
-/**
- * Convert bitstream to one representation based on sync marker
- */
-static int dca_convert_bitstream(const uint8_t *src, int src_size, uint8_t *dst,
- int max_size)
-{
- uint32_t mrk;
- int i, tmp;
- const uint16_t *ssrc = (const uint16_t *) src;
- uint16_t *sdst = (uint16_t *) dst;
- PutBitContext pb;
-
- if ((unsigned) src_size > (unsigned) max_size) {
-// av_log(NULL, AV_LOG_ERROR, "Input frame size larger than DCA_MAX_FRAME_SIZE!\n");
-// return -1;
- src_size = max_size;
- }
-
- mrk = AV_RB32(src);
- switch (mrk) {
- case DCA_MARKER_RAW_BE:
- memcpy(dst, src, src_size);
- return src_size;
- case DCA_MARKER_RAW_LE:
- for (i = 0; i < (src_size + 1) >> 1; i++)
- *sdst++ = av_bswap16(*ssrc++);
- return src_size;
- case DCA_MARKER_14B_BE:
- case DCA_MARKER_14B_LE:
- init_put_bits(&pb, dst, max_size);
- for (i = 0; i < (src_size + 1) >> 1; i++, src += 2) {
- tmp = ((mrk == DCA_MARKER_14B_BE) ? AV_RB16(src) : AV_RL16(src)) & 0x3FFF;
- put_bits(&pb, 14, tmp);
- }
- flush_put_bits(&pb);
- return (put_bits_count(&pb) + 7) >> 3;
- default:
- return AVERROR_INVALIDDATA;
- }
-}
-
-/**
- * Return the number of channels in an ExSS speaker mask (HD)
- */
-static int dca_exss_mask2count(int mask)
-{
- /* count bits that mean speaker pairs twice */
- return av_popcount(mask) +
- av_popcount(mask & (DCA_EXSS_CENTER_LEFT_RIGHT |
- DCA_EXSS_FRONT_LEFT_RIGHT |
- DCA_EXSS_FRONT_HIGH_LEFT_RIGHT |
- DCA_EXSS_WIDE_LEFT_RIGHT |
- DCA_EXSS_SIDE_LEFT_RIGHT |
- DCA_EXSS_SIDE_HIGH_LEFT_RIGHT |
- DCA_EXSS_SIDE_REAR_LEFT_RIGHT |
- DCA_EXSS_REAR_LEFT_RIGHT |
- DCA_EXSS_REAR_HIGH_LEFT_RIGHT));
-}
-
-/**
- * Skip mixing coefficients of a single mix out configuration (HD)
- */
-static void dca_exss_skip_mix_coeffs(GetBitContext *gb, int channels, int out_ch)
-{
- int i;
-
- for (i = 0; i < channels; i++) {
- int mix_map_mask = get_bits(gb, out_ch);
- int num_coeffs = av_popcount(mix_map_mask);
- skip_bits_long(gb, num_coeffs * 6);
- }
-}
-
-/**
- * Parse extension substream asset header (HD)
- */
-static int dca_exss_parse_asset_header(DCAContext *s)
-{
- int header_pos = get_bits_count(&s->gb);
- int header_size;
- int channels;
- int embedded_stereo = 0;
- int embedded_6ch = 0;
- int drc_code_present;
- int extensions_mask;
- int i, j;
-
- if (get_bits_left(&s->gb) < 16)
- return -1;
-
- /* We will parse just enough to get to the extensions bitmask with which
- * we can set the profile value. */
-
- header_size = get_bits(&s->gb, 9) + 1;
- skip_bits(&s->gb, 3); // asset index
-
- if (s->static_fields) {
- if (get_bits1(&s->gb))
- skip_bits(&s->gb, 4); // asset type descriptor
- if (get_bits1(&s->gb))
- skip_bits_long(&s->gb, 24); // language descriptor
-
- if (get_bits1(&s->gb)) {
- /* How can one fit 1024 bytes of text here if the maximum value
- * for the asset header size field above was 512 bytes? */
- int text_length = get_bits(&s->gb, 10) + 1;
- if (get_bits_left(&s->gb) < text_length * 8)
- return -1;
- skip_bits_long(&s->gb, text_length * 8); // info text
- }
-
- skip_bits(&s->gb, 5); // bit resolution - 1
- skip_bits(&s->gb, 4); // max sample rate code
- channels = get_bits(&s->gb, 8) + 1;
-
- if (get_bits1(&s->gb)) { // 1-to-1 channels to speakers
- int spkr_remap_sets;
- int spkr_mask_size = 16;
- int num_spkrs[7];
-
- if (channels > 2)
- embedded_stereo = get_bits1(&s->gb);
- if (channels > 6)
- embedded_6ch = get_bits1(&s->gb);
-
- if (get_bits1(&s->gb)) {
- spkr_mask_size = (get_bits(&s->gb, 2) + 1) << 2;
- skip_bits(&s->gb, spkr_mask_size); // spkr activity mask
- }
-
- spkr_remap_sets = get_bits(&s->gb, 3);
-
- for (i = 0; i < spkr_remap_sets; i++) {
- /* std layout mask for each remap set */
- num_spkrs[i] = dca_exss_mask2count(get_bits(&s->gb, spkr_mask_size));
- }
-
- for (i = 0; i < spkr_remap_sets; i++) {
- int num_dec_ch_remaps = get_bits(&s->gb, 5) + 1;
- if (get_bits_left(&s->gb) < 0)
- return -1;
-
- for (j = 0; j < num_spkrs[i]; j++) {
- int remap_dec_ch_mask = get_bits_long(&s->gb, num_dec_ch_remaps);
- int num_dec_ch = av_popcount(remap_dec_ch_mask);
- skip_bits_long(&s->gb, num_dec_ch * 5); // remap codes
- }
- }
-
- } else {
- skip_bits(&s->gb, 3); // representation type
- }
- }
-
- drc_code_present = get_bits1(&s->gb);
- if (drc_code_present)
- get_bits(&s->gb, 8); // drc code
-
- if (get_bits1(&s->gb))
- skip_bits(&s->gb, 5); // dialog normalization code
-
- if (drc_code_present && embedded_stereo)
- get_bits(&s->gb, 8); // drc stereo code
-
- if (s->mix_metadata && get_bits1(&s->gb)) {
- skip_bits(&s->gb, 1); // external mix
- skip_bits(&s->gb, 6); // post mix gain code
-
- if (get_bits(&s->gb, 2) != 3) // mixer drc code
- skip_bits(&s->gb, 3); // drc limit
- else
- skip_bits(&s->gb, 8); // custom drc code
-
- if (get_bits1(&s->gb)) // channel specific scaling
- for (i = 0; i < s->num_mix_configs; i++)
- skip_bits_long(&s->gb, s->mix_config_num_ch[i] * 6); // scale codes
- else
- skip_bits_long(&s->gb, s->num_mix_configs * 6); // scale codes
-
- for (i = 0; i < s->num_mix_configs; i++) {
- if (get_bits_left(&s->gb) < 0)
- return -1;
- dca_exss_skip_mix_coeffs(&s->gb, channels, s->mix_config_num_ch[i]);
- if (embedded_6ch)
- dca_exss_skip_mix_coeffs(&s->gb, 6, s->mix_config_num_ch[i]);
- if (embedded_stereo)
- dca_exss_skip_mix_coeffs(&s->gb, 2, s->mix_config_num_ch[i]);
- }
- }
-
- switch (get_bits(&s->gb, 2)) {
- case 0: extensions_mask = get_bits(&s->gb, 12); break;
- case 1: extensions_mask = DCA_EXT_EXSS_XLL; break;
- case 2: extensions_mask = DCA_EXT_EXSS_LBR; break;
- case 3: extensions_mask = 0; /* aux coding */ break;
- }
-
- /* not parsed further, we were only interested in the extensions mask */
-
- if (get_bits_left(&s->gb) < 0)
- return -1;
-
- if (get_bits_count(&s->gb) - header_pos > header_size * 8) {
- av_log(s->avctx, AV_LOG_WARNING, "Asset header size mismatch.\n");
- return -1;
- }
- skip_bits_long(&s->gb, header_pos + header_size * 8 - get_bits_count(&s->gb));
-
- if (extensions_mask & DCA_EXT_EXSS_XLL)
- s->profile = FF_PROFILE_DTS_HD_MA;
- else if (extensions_mask & (DCA_EXT_EXSS_XBR | DCA_EXT_EXSS_X96 |
- DCA_EXT_EXSS_XXCH))
- s->profile = FF_PROFILE_DTS_HD_HRA;
-
- if (!(extensions_mask & DCA_EXT_CORE))
- av_log(s->avctx, AV_LOG_WARNING, "DTS core detection mismatch.\n");
- if ((extensions_mask & DCA_CORE_EXTS) != s->core_ext_mask)
- av_log(s->avctx, AV_LOG_WARNING,
- "DTS extensions detection mismatch (%d, %d)\n",
- extensions_mask & DCA_CORE_EXTS, s->core_ext_mask);
-
- return 0;
-}
-
-/**
- * Parse extension substream header (HD)
- */
-static void dca_exss_parse_header(DCAContext *s)
-{
- int ss_index;
- int blownup;
- int num_audiop = 1;
- int num_assets = 1;
- int active_ss_mask[8];
- int i, j;
-
- if (get_bits_left(&s->gb) < 52)
- return;
-
- skip_bits(&s->gb, 8); // user data
- ss_index = get_bits(&s->gb, 2);
-
- blownup = get_bits1(&s->gb);
- skip_bits(&s->gb, 8 + 4 * blownup); // header_size
- skip_bits(&s->gb, 16 + 4 * blownup); // hd_size
-
- s->static_fields = get_bits1(&s->gb);
- if (s->static_fields) {
- skip_bits(&s->gb, 2); // reference clock code
- skip_bits(&s->gb, 3); // frame duration code
-
- if (get_bits1(&s->gb))
- skip_bits_long(&s->gb, 36); // timestamp
-
- /* a single stream can contain multiple audio assets that can be
- * combined to form multiple audio presentations */
-
- num_audiop = get_bits(&s->gb, 3) + 1;
- if (num_audiop > 1) {
- av_log_ask_for_sample(s->avctx, "Multiple DTS-HD audio presentations.");
- /* ignore such streams for now */
- return;
- }
-
- num_assets = get_bits(&s->gb, 3) + 1;
- if (num_assets > 1) {
- av_log_ask_for_sample(s->avctx, "Multiple DTS-HD audio assets.");
- /* ignore such streams for now */
- return;
- }
-
- for (i = 0; i < num_audiop; i++)
- active_ss_mask[i] = get_bits(&s->gb, ss_index + 1);
-
- for (i = 0; i < num_audiop; i++)
- for (j = 0; j <= ss_index; j++)
- if (active_ss_mask[i] & (1 << j))
- skip_bits(&s->gb, 8); // active asset mask
-
- s->mix_metadata = get_bits1(&s->gb);
- if (s->mix_metadata) {
- int mix_out_mask_size;
-
- skip_bits(&s->gb, 2); // adjustment level
- mix_out_mask_size = (get_bits(&s->gb, 2) + 1) << 2;
- s->num_mix_configs = get_bits(&s->gb, 2) + 1;
-
- for (i = 0; i < s->num_mix_configs; i++) {
- int mix_out_mask = get_bits(&s->gb, mix_out_mask_size);
- s->mix_config_num_ch[i] = dca_exss_mask2count(mix_out_mask);
- }
- }
- }
-
- for (i = 0; i < num_assets; i++)
- skip_bits_long(&s->gb, 16 + 4 * blownup); // asset size
-
- for (i = 0; i < num_assets; i++) {
- if (dca_exss_parse_asset_header(s))
- return;
- }
-
- /* not parsed further, we were only interested in the extensions mask
- * from the asset header */
-}
-
-/**
- * Main frame decoding function
- * FIXME add arguments
- */
-static int dca_decode_frame(AVCodecContext *avctx, void *data,
- int *got_frame_ptr, AVPacket *avpkt)
-{
- const uint8_t *buf = avpkt->data;
- int buf_size = avpkt->size;
-
- int lfe_samples;
- int num_core_channels = 0;
- int i, ret;
- float *samples_flt;
- int16_t *samples_s16;
- DCAContext *s = avctx->priv_data;
- int channels;
- int core_ss_end;
-
-
- s->xch_present = 0;
-
- s->dca_buffer_size = dca_convert_bitstream(buf, buf_size, s->dca_buffer,
- DCA_MAX_FRAME_SIZE + DCA_MAX_EXSS_HEADER_SIZE);
- if (s->dca_buffer_size == AVERROR_INVALIDDATA) {
- av_log(avctx, AV_LOG_ERROR, "Not a valid DCA frame\n");
- return AVERROR_INVALIDDATA;
- }
-
- init_get_bits(&s->gb, s->dca_buffer, s->dca_buffer_size * 8);
- if ((ret = dca_parse_frame_header(s)) < 0) {
- //seems like the frame is corrupt, try with the next one
- return ret;
- }
- //set AVCodec values with parsed data
- avctx->sample_rate = s->sample_rate;
- avctx->bit_rate = s->bit_rate;
- avctx->frame_size = s->sample_blocks * 32;
-
- s->profile = FF_PROFILE_DTS;
-
- for (i = 0; i < (s->sample_blocks / 8); i++) {
- if ((ret = dca_decode_block(s, 0, i))) {
- av_log(avctx, AV_LOG_ERROR, "error decoding block\n");
- return ret;
- }
- }
-
- /* record number of core channels incase less than max channels are requested */
- num_core_channels = s->prim_channels;
-
- if (s->ext_coding)
- s->core_ext_mask = dca_ext_audio_descr_mask[s->ext_descr];
- else
- s->core_ext_mask = 0;
-
- core_ss_end = FFMIN(s->frame_size, s->dca_buffer_size) * 8;
-
- /* only scan for extensions if ext_descr was unknown or indicated a
- * supported XCh extension */
- if (s->core_ext_mask < 0 || s->core_ext_mask & DCA_EXT_XCH) {
-
- /* if ext_descr was unknown, clear s->core_ext_mask so that the
- * extensions scan can fill it up */
- s->core_ext_mask = FFMAX(s->core_ext_mask, 0);
-
- /* extensions start at 32-bit boundaries into bitstream */
- skip_bits_long(&s->gb, (-get_bits_count(&s->gb)) & 31);
-
- while (core_ss_end - get_bits_count(&s->gb) >= 32) {
- uint32_t bits = get_bits_long(&s->gb, 32);
-
- switch (bits) {
- case 0x5a5a5a5a: {
- int ext_amode, xch_fsize;
-
- s->xch_base_channel = s->prim_channels;
-
- /* validate sync word using XCHFSIZE field */
- xch_fsize = show_bits(&s->gb, 10);
- if ((s->frame_size != (get_bits_count(&s->gb) >> 3) - 4 + xch_fsize) &&
- (s->frame_size != (get_bits_count(&s->gb) >> 3) - 4 + xch_fsize + 1))
- continue;
-
- /* skip length-to-end-of-frame field for the moment */
- skip_bits(&s->gb, 10);
-
- s->core_ext_mask |= DCA_EXT_XCH;
-
- /* extension amode(number of channels in extension) should be 1 */
- /* AFAIK XCh is not used for more channels */
- if ((ext_amode = get_bits(&s->gb, 4)) != 1) {
- av_log(avctx, AV_LOG_ERROR, "XCh extension amode %d not"
- " supported!\n", ext_amode);
- continue;
- }
-
- /* much like core primary audio coding header */
- dca_parse_audio_coding_header(s, s->xch_base_channel);
-
- for (i = 0; i < (s->sample_blocks / 8); i++)
- if ((ret = dca_decode_block(s, s->xch_base_channel, i))) {
- av_log(avctx, AV_LOG_ERROR, "error decoding XCh extension\n");
- continue;
- }
-
- s->xch_present = 1;
- break;
- }
- case 0x47004a03:
- /* XXCh: extended channels */
- /* usually found either in core or HD part in DTS-HD HRA streams,
- * but not in DTS-ES which contains XCh extensions instead */
- s->core_ext_mask |= DCA_EXT_XXCH;
- break;
-
- case 0x1d95f262: {
- int fsize96 = show_bits(&s->gb, 12) + 1;
- if (s->frame_size != (get_bits_count(&s->gb) >> 3) - 4 + fsize96)
- continue;
-
- av_log(avctx, AV_LOG_DEBUG, "X96 extension found at %d bits\n",
- get_bits_count(&s->gb));
- skip_bits(&s->gb, 12);
- av_log(avctx, AV_LOG_DEBUG, "FSIZE96 = %d bytes\n", fsize96);
- av_log(avctx, AV_LOG_DEBUG, "REVNO = %d\n", get_bits(&s->gb, 4));
-
- s->core_ext_mask |= DCA_EXT_X96;
- break;
- }
- }
-
- skip_bits_long(&s->gb, (-get_bits_count(&s->gb)) & 31);
- }
- } else {
- /* no supported extensions, skip the rest of the core substream */
- skip_bits_long(&s->gb, core_ss_end - get_bits_count(&s->gb));
- }
-
- if (s->core_ext_mask & DCA_EXT_X96)
- s->profile = FF_PROFILE_DTS_96_24;
- else if (s->core_ext_mask & (DCA_EXT_XCH | DCA_EXT_XXCH))
- s->profile = FF_PROFILE_DTS_ES;
-
- /* check for ExSS (HD part) */
- if (s->dca_buffer_size - s->frame_size > 32 &&
- get_bits_long(&s->gb, 32) == DCA_HD_MARKER)
- dca_exss_parse_header(s);
-
- avctx->profile = s->profile;
-
- channels = s->prim_channels + !!s->lfe;
-
- if (s->amode < 16) {
- avctx->channel_layout = dca_core_channel_layout[s->amode];
-
- if (s->xch_present && (!avctx->request_channels ||
- avctx->request_channels > num_core_channels + !!s->lfe)) {
- avctx->channel_layout |= AV_CH_BACK_CENTER;
- if (s->lfe) {
- avctx->channel_layout |= AV_CH_LOW_FREQUENCY;
- s->channel_order_tab = dca_channel_reorder_lfe_xch[s->amode];
- } else {
- s->channel_order_tab = dca_channel_reorder_nolfe_xch[s->amode];
- }
- } else {
- channels = num_core_channels + !!s->lfe;
- s->xch_present = 0; /* disable further xch processing */
- if (s->lfe) {
- avctx->channel_layout |= AV_CH_LOW_FREQUENCY;
- s->channel_order_tab = dca_channel_reorder_lfe[s->amode];
- } else
- s->channel_order_tab = dca_channel_reorder_nolfe[s->amode];
- }
-
- if (channels > !!s->lfe &&
- s->channel_order_tab[channels - 1 - !!s->lfe] < 0)
- return AVERROR_INVALIDDATA;
-
- if (avctx->request_channels == 2 && s->prim_channels > 2) {
- channels = 2;
- s->output = DCA_STEREO;
- avctx->channel_layout = AV_CH_LAYOUT_STEREO;
- }
- } else {
- av_log(avctx, AV_LOG_ERROR, "Non standard configuration %d !\n", s->amode);
- return AVERROR_INVALIDDATA;
- }
-
-
- /* There is nothing that prevents a dts frame to change channel configuration
- but Libav doesn't support that so only set the channels if it is previously
- unset. Ideally during the first probe for channels the crc should be checked
- and only set avctx->channels when the crc is ok. Right now the decoder could
- set the channels based on a broken first frame.*/
- if (s->is_channels_set == 0) {
- s->is_channels_set = 1;
- avctx->channels = channels;
- }
- if (avctx->channels != channels) {
- av_log(avctx, AV_LOG_ERROR, "DCA decoder does not support number of "
- "channels changing in stream. Skipping frame.\n");
- return AVERROR_PATCHWELCOME;
- }
-
- /* get output buffer */
- s->frame.nb_samples = 256 * (s->sample_blocks / 8);
- if ((ret = avctx->get_buffer(avctx, &s->frame)) < 0) {
- av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
- return ret;
- }
- samples_flt = (float *) s->frame.data[0];
- samples_s16 = (int16_t *) s->frame.data[0];
-
- /* filter to get final output */
- for (i = 0; i < (s->sample_blocks / 8); i++) {
- dca_filter_channels(s, i);
-
- /* If this was marked as a DTS-ES stream we need to subtract back- */
- /* channel from SL & SR to remove matrixed back-channel signal */
- if ((s->source_pcm_res & 1) && s->xch_present) {
- float *back_chan = s->samples + s->channel_order_tab[s->xch_base_channel] * 256;
- float *lt_chan = s->samples + s->channel_order_tab[s->xch_base_channel - 2] * 256;
- float *rt_chan = s->samples + s->channel_order_tab[s->xch_base_channel - 1] * 256;
- s->dsp.vector_fmac_scalar(lt_chan, back_chan, -M_SQRT1_2, 256);
- s->dsp.vector_fmac_scalar(rt_chan, back_chan, -M_SQRT1_2, 256);
- }
-
- if (avctx->sample_fmt == AV_SAMPLE_FMT_FLT) {
- s->fmt_conv.float_interleave(samples_flt, s->samples_chanptr, 256,
- channels);
- samples_flt += 256 * channels;
- } else {
- s->fmt_conv.float_to_int16_interleave(samples_s16,
- s->samples_chanptr, 256,
- channels);
- samples_s16 += 256 * channels;
- }
- }
-
- /* update lfe history */
- lfe_samples = 2 * s->lfe * (s->sample_blocks / 8);
- for (i = 0; i < 2 * s->lfe * 4; i++)
- s->lfe_data[i] = s->lfe_data[i + lfe_samples];
-
- *got_frame_ptr = 1;
- *(AVFrame *) data = s->frame;
-
- return buf_size;
-}
-
-
-
-/**
- * DCA initialization
- *
- * @param avctx pointer to the AVCodecContext
- */
-
-static av_cold int dca_decode_init(AVCodecContext *avctx)
-{
- DCAContext *s = avctx->priv_data;
- int i;
-
- s->avctx = avctx;
- dca_init_vlcs();
-
- dsputil_init(&s->dsp, avctx);
- ff_mdct_init(&s->imdct, 6, 1, 1.0);
- ff_synth_filter_init(&s->synth);
- ff_dcadsp_init(&s->dcadsp);
- ff_fmt_convert_init(&s->fmt_conv, avctx);
-
- for (i = 0; i < DCA_PRIM_CHANNELS_MAX + 1; i++)
- s->samples_chanptr[i] = s->samples + i * 256;
-
- if (avctx->request_sample_fmt == AV_SAMPLE_FMT_FLT) {
- avctx->sample_fmt = AV_SAMPLE_FMT_FLT;
- s->scale_bias = 1.0 / 32768.0;
- } else {
- avctx->sample_fmt = AV_SAMPLE_FMT_S16;
- s->scale_bias = 1.0;
- }
-
- /* allow downmixing to stereo */
- if (avctx->channels > 0 && avctx->request_channels < avctx->channels &&
- avctx->request_channels == 2) {
- avctx->channels = avctx->request_channels;
- }
-
- avcodec_get_frame_defaults(&s->frame);
- avctx->coded_frame = &s->frame;
-
- return 0;
-}
-
-static av_cold int dca_decode_end(AVCodecContext *avctx)
-{
- DCAContext *s = avctx->priv_data;
- ff_mdct_end(&s->imdct);
- return 0;
-}
-
-static const AVProfile profiles[] = {
- { FF_PROFILE_DTS, "DTS" },
- { FF_PROFILE_DTS_ES, "DTS-ES" },
- { FF_PROFILE_DTS_96_24, "DTS 96/24" },
- { FF_PROFILE_DTS_HD_HRA, "DTS-HD HRA" },
- { FF_PROFILE_DTS_HD_MA, "DTS-HD MA" },
- { FF_PROFILE_UNKNOWN },
-};
-
-AVCodec ff_dca_decoder = {
- .name = "dca",
- .type = AVMEDIA_TYPE_AUDIO,
- .id = CODEC_ID_DTS,
- .priv_data_size = sizeof(DCAContext),
- .init = dca_decode_init,
- .decode = dca_decode_frame,
- .close = dca_decode_end,
- .long_name = NULL_IF_CONFIG_SMALL("DCA (DTS Coherent Acoustics)"),
- .capabilities = CODEC_CAP_CHANNEL_CONF | CODEC_CAP_DR1,
- .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLT,
- AV_SAMPLE_FMT_S16,
- AV_SAMPLE_FMT_NONE },
- .profiles = NULL_IF_CONFIG_SMALL(profiles),
+ 0, 8000, 16000, 32000, 0, 0, 11025, 22050, 44100, 0, 0,
+ 12000, 24000, 48000, 96000, 192000
};
diff --git a/gst-libs/ext/libav/libavcodec/dca.h b/gst-libs/ext/libav/libavcodec/dca.h
index 8ea6049..76342f0 100644
--- a/gst-libs/ext/libav/libavcodec/dca.h
+++ b/gst-libs/ext/libav/libavcodec/dca.h
@@ -25,6 +25,9 @@
#ifndef AVCODEC_DCA_H
#define AVCODEC_DCA_H
+#include <stdint.h>
+#include "libavutil/internal.h"
+
/** DCA syncwords, also used for bitstream type detection */
#define DCA_MARKER_RAW_BE 0x7FFE8001
#define DCA_MARKER_RAW_LE 0xFE7F0180
@@ -34,4 +37,6 @@
/** DCA-HD specific block starts with this marker. */
#define DCA_HD_MARKER 0x64582025
+extern av_export const uint32_t avpriv_dca_sample_rates[16];
+
#endif /* AVCODEC_DCA_H */
diff --git a/gst-libs/ext/libav/libavcodec/dca_parser.c b/gst-libs/ext/libav/libavcodec/dca_parser.c
index 136cc45..ab235cf 100644
--- a/gst-libs/ext/libav/libavcodec/dca_parser.c
+++ b/gst-libs/ext/libav/libavcodec/dca_parser.c
@@ -24,6 +24,9 @@
#include "parser.h"
#include "dca.h"
+#include "dca_parser.h"
+#include "get_bits.h"
+#include "put_bits.h"
typedef struct DCAParseContext {
ParseContext pc;
@@ -100,6 +103,71 @@ static av_cold int dca_parse_init(AVCodecParserContext * s)
return 0;
}
+int ff_dca_convert_bitstream(const uint8_t *src, int src_size, uint8_t *dst,
+ int max_size)
+{
+ uint32_t mrk;
+ int i, tmp;
+ const uint16_t *ssrc = (const uint16_t *) src;
+ uint16_t *sdst = (uint16_t *) dst;
+ PutBitContext pb;
+
+ if ((unsigned) src_size > (unsigned) max_size)
+ src_size = max_size;
+
+ mrk = AV_RB32(src);
+ switch (mrk) {
+ case DCA_MARKER_RAW_BE:
+ memcpy(dst, src, src_size);
+ return src_size;
+ case DCA_MARKER_RAW_LE:
+ for (i = 0; i < (src_size + 1) >> 1; i++)
+ *sdst++ = av_bswap16(*ssrc++);
+ return src_size;
+ case DCA_MARKER_14B_BE:
+ case DCA_MARKER_14B_LE:
+ init_put_bits(&pb, dst, max_size);
+ for (i = 0; i < (src_size + 1) >> 1; i++, src += 2) {
+ tmp = ((mrk == DCA_MARKER_14B_BE) ? AV_RB16(src) : AV_RL16(src)) & 0x3FFF;
+ put_bits(&pb, 14, tmp);
+ }
+ flush_put_bits(&pb);
+ return (put_bits_count(&pb) + 7) >> 3;
+ default:
+ return AVERROR_INVALIDDATA;
+ }
+}
+
+static int dca_parse_params(const uint8_t *buf, int buf_size, int *duration,
+ int *sample_rate)
+{
+ GetBitContext gb;
+ uint8_t hdr[12 + FF_INPUT_BUFFER_PADDING_SIZE] = { 0 };
+ int ret, sample_blocks, sr_code;
+
+ if (buf_size < 12)
+ return AVERROR_INVALIDDATA;
+
+ if ((ret = ff_dca_convert_bitstream(buf, 12, hdr, 12)) < 0)
+ return ret;
+
+ init_get_bits(&gb, hdr, 96);
+
+ skip_bits_long(&gb, 39);
+ sample_blocks = get_bits(&gb, 7) + 1;
+ if (sample_blocks < 8)
+ return AVERROR_INVALIDDATA;
+ *duration = 256 * (sample_blocks / 8);
+
+ skip_bits(&gb, 20);
+ sr_code = get_bits(&gb, 4);
+ *sample_rate = avpriv_dca_sample_rates[sr_code];
+ if (*sample_rate == 0)
+ return AVERROR_INVALIDDATA;
+
+ return 0;
+}
+
static int dca_parse(AVCodecParserContext * s,
AVCodecContext * avctx,
const uint8_t ** poutbuf, int *poutbuf_size,
@@ -107,7 +175,7 @@ static int dca_parse(AVCodecParserContext * s,
{
DCAParseContext *pc1 = s->priv_data;
ParseContext *pc = &pc1->pc;
- int next;
+ int next, duration, sample_rate;
if (s->flags & PARSER_FLAG_COMPLETE_FRAMES) {
next = buf_size;
@@ -120,13 +188,21 @@ static int dca_parse(AVCodecParserContext * s,
return buf_size;
}
}
+
+ /* read the duration and sample rate from the frame header */
+ if (!dca_parse_params(buf, buf_size, &duration, &sample_rate)) {
+ s->duration = duration;
+ avctx->sample_rate = sample_rate;
+ } else
+ s->duration = 0;
+
*poutbuf = buf;
*poutbuf_size = buf_size;
return next;
}
AVCodecParser ff_dca_parser = {
- .codec_ids = { CODEC_ID_DTS },
+ .codec_ids = { AV_CODEC_ID_DTS },
.priv_data_size = sizeof(DCAParseContext),
.parser_init = dca_parse_init,
.parser_parse = dca_parse,
diff --git a/gst-libs/ext/libav/libavcodec/dca_parser.h b/gst-libs/ext/libav/libavcodec/dca_parser.h
new file mode 100644
index 0000000..f480eab
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/dca_parser.h
@@ -0,0 +1,36 @@
+/*
+ * DCA parser
+ * Copyright (C) 2004 Gildas Bazin
+ * Copyright (C) 2004 Benjamin Zores
+ * Copyright (C) 2006 Benjamin Larsson
+ * Copyright (C) 2007 Konstantin Shishkov
+ *
+ * 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
+ */
+
+#ifndef AVCODEC_DCA_PARSER_H
+#define AVCODEC_DCA_PARSER_H
+
+#include <stdint.h>
+
+/**
+ * Convert bitstream to one representation based on sync marker
+ */
+int ff_dca_convert_bitstream(const uint8_t *src, int src_size, uint8_t *dst,
+ int max_size);
+
+#endif /* AVCODEC_DCA_PARSER_H */
diff --git a/gst-libs/ext/libav/libavcodec/dcadata.h b/gst-libs/ext/libav/libavcodec/dcadata.h
index 4b58ef7..324e40f 100644
--- a/gst-libs/ext/libav/libavcodec/dcadata.h
+++ b/gst-libs/ext/libav/libavcodec/dcadata.h
@@ -28,12 +28,6 @@
/* Generic tables */
-static const uint32_t dca_sample_rates[16] =
-{
- 0, 8000, 16000, 32000, 0, 0, 11025, 22050, 44100, 0, 0,
- 12000, 24000, 48000, 96000, 192000
-};
-
static const uint32_t dca_bit_rates[32] =
{
32000, 56000, 64000, 96000, 112000, 128000,
diff --git a/gst-libs/ext/libav/libavcodec/dcadec.c b/gst-libs/ext/libav/libavcodec/dcadec.c
new file mode 100644
index 0000000..f26111a
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/dcadec.c
@@ -0,0 +1,1964 @@
+/*
+ * DCA compatible decoder
+ * Copyright (C) 2004 Gildas Bazin
+ * Copyright (C) 2004 Benjamin Zores
+ * Copyright (C) 2006 Benjamin Larsson
+ * Copyright (C) 2007 Konstantin Shishkov
+ *
+ * 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
+ */
+
+#include <math.h>
+#include <stddef.h>
+#include <stdio.h>
+
+#include "libavutil/channel_layout.h"
+#include "libavutil/common.h"
+#include "libavutil/float_dsp.h"
+#include "libavutil/intmath.h"
+#include "libavutil/intreadwrite.h"
+#include "libavutil/mathematics.h"
+#include "libavutil/samplefmt.h"
+#include "avcodec.h"
+#include "dsputil.h"
+#include "fft.h"
+#include "get_bits.h"
+#include "put_bits.h"
+#include "dcadata.h"
+#include "dcahuff.h"
+#include "dca.h"
+#include "dca_parser.h"
+#include "synth_filter.h"
+#include "dcadsp.h"
+#include "fmtconvert.h"
+#include "internal.h"
+
+#if ARCH_ARM
+# include "arm/dca.h"
+#endif
+
+//#define TRACE
+
+#define DCA_PRIM_CHANNELS_MAX (7)
+#define DCA_SUBBANDS (32)
+#define DCA_ABITS_MAX (32) /* Should be 28 */
+#define DCA_SUBSUBFRAMES_MAX (4)
+#define DCA_SUBFRAMES_MAX (16)
+#define DCA_BLOCKS_MAX (16)
+#define DCA_LFE_MAX (3)
+
+enum DCAMode {
+ DCA_MONO = 0,
+ DCA_CHANNEL,
+ DCA_STEREO,
+ DCA_STEREO_SUMDIFF,
+ DCA_STEREO_TOTAL,
+ DCA_3F,
+ DCA_2F1R,
+ DCA_3F1R,
+ DCA_2F2R,
+ DCA_3F2R,
+ DCA_4F2R
+};
+
+/* these are unconfirmed but should be mostly correct */
+enum DCAExSSSpeakerMask {
+ DCA_EXSS_FRONT_CENTER = 0x0001,
+ DCA_EXSS_FRONT_LEFT_RIGHT = 0x0002,
+ DCA_EXSS_SIDE_REAR_LEFT_RIGHT = 0x0004,
+ DCA_EXSS_LFE = 0x0008,
+ DCA_EXSS_REAR_CENTER = 0x0010,
+ DCA_EXSS_FRONT_HIGH_LEFT_RIGHT = 0x0020,
+ DCA_EXSS_REAR_LEFT_RIGHT = 0x0040,
+ DCA_EXSS_FRONT_HIGH_CENTER = 0x0080,
+ DCA_EXSS_OVERHEAD = 0x0100,
+ DCA_EXSS_CENTER_LEFT_RIGHT = 0x0200,
+ DCA_EXSS_WIDE_LEFT_RIGHT = 0x0400,
+ DCA_EXSS_SIDE_LEFT_RIGHT = 0x0800,
+ DCA_EXSS_LFE2 = 0x1000,
+ DCA_EXSS_SIDE_HIGH_LEFT_RIGHT = 0x2000,
+ DCA_EXSS_REAR_HIGH_CENTER = 0x4000,
+ DCA_EXSS_REAR_HIGH_LEFT_RIGHT = 0x8000,
+};
+
+enum DCAExtensionMask {
+ DCA_EXT_CORE = 0x001, ///< core in core substream
+ DCA_EXT_XXCH = 0x002, ///< XXCh channels extension in core substream
+ DCA_EXT_X96 = 0x004, ///< 96/24 extension in core substream
+ DCA_EXT_XCH = 0x008, ///< XCh channel extension in core substream
+ DCA_EXT_EXSS_CORE = 0x010, ///< core in ExSS (extension substream)
+ DCA_EXT_EXSS_XBR = 0x020, ///< extended bitrate extension in ExSS
+ DCA_EXT_EXSS_XXCH = 0x040, ///< XXCh channels extension in ExSS
+ DCA_EXT_EXSS_X96 = 0x080, ///< 96/24 extension in ExSS
+ DCA_EXT_EXSS_LBR = 0x100, ///< low bitrate component in ExSS
+ DCA_EXT_EXSS_XLL = 0x200, ///< lossless extension in ExSS
+};
+
+/* -1 are reserved or unknown */
+static const int dca_ext_audio_descr_mask[] = {
+ DCA_EXT_XCH,
+ -1,
+ DCA_EXT_X96,
+ DCA_EXT_XCH | DCA_EXT_X96,
+ -1,
+ -1,
+ DCA_EXT_XXCH,
+ -1,
+};
+
+/* extensions that reside in core substream */
+#define DCA_CORE_EXTS (DCA_EXT_XCH | DCA_EXT_XXCH | DCA_EXT_X96)
+
+/* Tables for mapping dts channel configurations to libavcodec multichannel api.
+ * Some compromises have been made for special configurations. Most configurations
+ * are never used so complete accuracy is not needed.
+ *
+ * L = left, R = right, C = center, S = surround, F = front, R = rear, T = total, OV = overhead.
+ * S -> side, when both rear and back are configured move one of them to the side channel
+ * OV -> center back
+ * All 2 channel configurations -> AV_CH_LAYOUT_STEREO
+ */
+static const uint64_t dca_core_channel_layout[] = {
+ AV_CH_FRONT_CENTER, ///< 1, A
+ AV_CH_LAYOUT_STEREO, ///< 2, A + B (dual mono)
+ AV_CH_LAYOUT_STEREO, ///< 2, L + R (stereo)
+ AV_CH_LAYOUT_STEREO, ///< 2, (L + R) + (L - R) (sum-difference)
+ AV_CH_LAYOUT_STEREO, ///< 2, LT + RT (left and right total)
+ AV_CH_LAYOUT_STEREO | AV_CH_FRONT_CENTER, ///< 3, C + L + R
+ AV_CH_LAYOUT_STEREO | AV_CH_BACK_CENTER, ///< 3, L + R + S
+ AV_CH_LAYOUT_STEREO | AV_CH_FRONT_CENTER | AV_CH_BACK_CENTER, ///< 4, C + L + R + S
+ AV_CH_LAYOUT_STEREO | AV_CH_SIDE_LEFT | AV_CH_SIDE_RIGHT, ///< 4, L + R + SL + SR
+
+ AV_CH_LAYOUT_STEREO | AV_CH_FRONT_CENTER | AV_CH_SIDE_LEFT |
+ AV_CH_SIDE_RIGHT, ///< 5, C + L + R + SL + SR
+
+ AV_CH_LAYOUT_STEREO | AV_CH_SIDE_LEFT | AV_CH_SIDE_RIGHT |
+ AV_CH_FRONT_LEFT_OF_CENTER | AV_CH_FRONT_RIGHT_OF_CENTER, ///< 6, CL + CR + L + R + SL + SR
+
+ AV_CH_LAYOUT_STEREO | AV_CH_BACK_LEFT | AV_CH_BACK_RIGHT |
+ AV_CH_FRONT_CENTER | AV_CH_BACK_CENTER, ///< 6, C + L + R + LR + RR + OV
+
+ AV_CH_FRONT_CENTER | AV_CH_FRONT_RIGHT_OF_CENTER |
+ AV_CH_FRONT_LEFT_OF_CENTER | AV_CH_BACK_CENTER |
+ AV_CH_BACK_LEFT | AV_CH_BACK_RIGHT, ///< 6, CF + CR + LF + RF + LR + RR
+
+ AV_CH_FRONT_LEFT_OF_CENTER | AV_CH_FRONT_CENTER |
+ AV_CH_FRONT_RIGHT_OF_CENTER | AV_CH_LAYOUT_STEREO |
+ AV_CH_SIDE_LEFT | AV_CH_SIDE_RIGHT, ///< 7, CL + C + CR + L + R + SL + SR
+
+ AV_CH_FRONT_LEFT_OF_CENTER | AV_CH_FRONT_RIGHT_OF_CENTER |
+ AV_CH_LAYOUT_STEREO | AV_CH_SIDE_LEFT | AV_CH_SIDE_RIGHT |
+ AV_CH_BACK_LEFT | AV_CH_BACK_RIGHT, ///< 8, CL + CR + L + R + SL1 + SL2 + SR1 + SR2
+
+ AV_CH_FRONT_LEFT_OF_CENTER | AV_CH_FRONT_CENTER |
+ AV_CH_FRONT_RIGHT_OF_CENTER | AV_CH_LAYOUT_STEREO |
+ AV_CH_SIDE_LEFT | AV_CH_BACK_CENTER | AV_CH_SIDE_RIGHT, ///< 8, CL + C + CR + L + R + SL + S + SR
+};
+
+static const int8_t dca_lfe_index[] = {
+ 1, 2, 2, 2, 2, 3, 2, 3, 2, 3, 2, 3, 1, 3, 2, 3
+};
+
+static const int8_t dca_channel_reorder_lfe[][9] = {
+ { 0, -1, -1, -1, -1, -1, -1, -1, -1},
+ { 0, 1, -1, -1, -1, -1, -1, -1, -1},
+ { 0, 1, -1, -1, -1, -1, -1, -1, -1},
+ { 0, 1, -1, -1, -1, -1, -1, -1, -1},
+ { 0, 1, -1, -1, -1, -1, -1, -1, -1},
+ { 2, 0, 1, -1, -1, -1, -1, -1, -1},
+ { 0, 1, 3, -1, -1, -1, -1, -1, -1},
+ { 2, 0, 1, 4, -1, -1, -1, -1, -1},
+ { 0, 1, 3, 4, -1, -1, -1, -1, -1},
+ { 2, 0, 1, 4, 5, -1, -1, -1, -1},
+ { 3, 4, 0, 1, 5, 6, -1, -1, -1},
+ { 2, 0, 1, 4, 5, 6, -1, -1, -1},
+ { 0, 6, 4, 5, 2, 3, -1, -1, -1},
+ { 4, 2, 5, 0, 1, 6, 7, -1, -1},
+ { 5, 6, 0, 1, 7, 3, 8, 4, -1},
+ { 4, 2, 5, 0, 1, 6, 8, 7, -1},
+};
+
+static const int8_t dca_channel_reorder_lfe_xch[][9] = {
+ { 0, 2, -1, -1, -1, -1, -1, -1, -1},
+ { 0, 1, 3, -1, -1, -1, -1, -1, -1},
+ { 0, 1, 3, -1, -1, -1, -1, -1, -1},
+ { 0, 1, 3, -1, -1, -1, -1, -1, -1},
+ { 0, 1, 3, -1, -1, -1, -1, -1, -1},
+ { 2, 0, 1, 4, -1, -1, -1, -1, -1},
+ { 0, 1, 3, 4, -1, -1, -1, -1, -1},
+ { 2, 0, 1, 4, 5, -1, -1, -1, -1},
+ { 0, 1, 4, 5, 3, -1, -1, -1, -1},
+ { 2, 0, 1, 5, 6, 4, -1, -1, -1},
+ { 3, 4, 0, 1, 6, 7, 5, -1, -1},
+ { 2, 0, 1, 4, 5, 6, 7, -1, -1},
+ { 0, 6, 4, 5, 2, 3, 7, -1, -1},
+ { 4, 2, 5, 0, 1, 7, 8, 6, -1},
+ { 5, 6, 0, 1, 8, 3, 9, 4, 7},
+ { 4, 2, 5, 0, 1, 6, 9, 8, 7},
+};
+
+static const int8_t dca_channel_reorder_nolfe[][9] = {
+ { 0, -1, -1, -1, -1, -1, -1, -1, -1},
+ { 0, 1, -1, -1, -1, -1, -1, -1, -1},
+ { 0, 1, -1, -1, -1, -1, -1, -1, -1},
+ { 0, 1, -1, -1, -1, -1, -1, -1, -1},
+ { 0, 1, -1, -1, -1, -1, -1, -1, -1},
+ { 2, 0, 1, -1, -1, -1, -1, -1, -1},
+ { 0, 1, 2, -1, -1, -1, -1, -1, -1},
+ { 2, 0, 1, 3, -1, -1, -1, -1, -1},
+ { 0, 1, 2, 3, -1, -1, -1, -1, -1},
+ { 2, 0, 1, 3, 4, -1, -1, -1, -1},
+ { 2, 3, 0, 1, 4, 5, -1, -1, -1},
+ { 2, 0, 1, 3, 4, 5, -1, -1, -1},
+ { 0, 5, 3, 4, 1, 2, -1, -1, -1},
+ { 3, 2, 4, 0, 1, 5, 6, -1, -1},
+ { 4, 5, 0, 1, 6, 2, 7, 3, -1},
+ { 3, 2, 4, 0, 1, 5, 7, 6, -1},
+};
+
+static const int8_t dca_channel_reorder_nolfe_xch[][9] = {
+ { 0, 1, -1, -1, -1, -1, -1, -1, -1},
+ { 0, 1, 2, -1, -1, -1, -1, -1, -1},
+ { 0, 1, 2, -1, -1, -1, -1, -1, -1},
+ { 0, 1, 2, -1, -1, -1, -1, -1, -1},
+ { 0, 1, 2, -1, -1, -1, -1, -1, -1},
+ { 2, 0, 1, 3, -1, -1, -1, -1, -1},
+ { 0, 1, 2, 3, -1, -1, -1, -1, -1},
+ { 2, 0, 1, 3, 4, -1, -1, -1, -1},
+ { 0, 1, 3, 4, 2, -1, -1, -1, -1},
+ { 2, 0, 1, 4, 5, 3, -1, -1, -1},
+ { 2, 3, 0, 1, 5, 6, 4, -1, -1},
+ { 2, 0, 1, 3, 4, 5, 6, -1, -1},
+ { 0, 5, 3, 4, 1, 2, 6, -1, -1},
+ { 3, 2, 4, 0, 1, 6, 7, 5, -1},
+ { 4, 5, 0, 1, 7, 2, 8, 3, 6},
+ { 3, 2, 4, 0, 1, 5, 8, 7, 6},
+};
+
+#define DCA_DOLBY 101 /* FIXME */
+
+#define DCA_CHANNEL_BITS 6
+#define DCA_CHANNEL_MASK 0x3F
+
+#define DCA_LFE 0x80
+
+#define HEADER_SIZE 14
+
+#define DCA_MAX_FRAME_SIZE 16384
+#define DCA_MAX_EXSS_HEADER_SIZE 4096
+
+#define DCA_BUFFER_PADDING_SIZE 1024
+
+/** Bit allocation */
+typedef struct {
+ int offset; ///< code values offset
+ int maxbits[8]; ///< max bits in VLC
+ int wrap; ///< wrap for get_vlc2()
+ VLC vlc[8]; ///< actual codes
+} BitAlloc;
+
+static BitAlloc dca_bitalloc_index; ///< indexes for samples VLC select
+static BitAlloc dca_tmode; ///< transition mode VLCs
+static BitAlloc dca_scalefactor; ///< scalefactor VLCs
+static BitAlloc dca_smpl_bitalloc[11]; ///< samples VLCs
+
+static av_always_inline int get_bitalloc(GetBitContext *gb, BitAlloc *ba,
+ int idx)
+{
+ return get_vlc2(gb, ba->vlc[idx].table, ba->vlc[idx].bits, ba->wrap) +
+ ba->offset;
+}
+
+typedef struct {
+ AVCodecContext *avctx;
+ AVFrame frame;
+ /* Frame header */
+ int frame_type; ///< type of the current frame
+ int samples_deficit; ///< deficit sample count
+ int crc_present; ///< crc is present in the bitstream
+ int sample_blocks; ///< number of PCM sample blocks
+ int frame_size; ///< primary frame byte size
+ int amode; ///< audio channels arrangement
+ int sample_rate; ///< audio sampling rate
+ int bit_rate; ///< transmission bit rate
+ int bit_rate_index; ///< transmission bit rate index
+
+ int downmix; ///< embedded downmix enabled
+ int dynrange; ///< embedded dynamic range flag
+ int timestamp; ///< embedded time stamp flag
+ int aux_data; ///< auxiliary data flag
+ int hdcd; ///< source material is mastered in HDCD
+ int ext_descr; ///< extension audio descriptor flag
+ int ext_coding; ///< extended coding flag
+ int aspf; ///< audio sync word insertion flag
+ int lfe; ///< low frequency effects flag
+ int predictor_history; ///< predictor history flag
+ int header_crc; ///< header crc check bytes
+ int multirate_inter; ///< multirate interpolator switch
+ int version; ///< encoder software revision
+ int copy_history; ///< copy history
+ int source_pcm_res; ///< source pcm resolution
+ int front_sum; ///< front sum/difference flag
+ int surround_sum; ///< surround sum/difference flag
+ int dialog_norm; ///< dialog normalisation parameter
+
+ /* Primary audio coding header */
+ int subframes; ///< number of subframes
+ int total_channels; ///< number of channels including extensions
+ int prim_channels; ///< number of primary audio channels
+ int subband_activity[DCA_PRIM_CHANNELS_MAX]; ///< subband activity count
+ int vq_start_subband[DCA_PRIM_CHANNELS_MAX]; ///< high frequency vq start subband
+ int joint_intensity[DCA_PRIM_CHANNELS_MAX]; ///< joint intensity coding index
+ int transient_huffman[DCA_PRIM_CHANNELS_MAX]; ///< transient mode code book
+ int scalefactor_huffman[DCA_PRIM_CHANNELS_MAX]; ///< scale factor code book
+ int bitalloc_huffman[DCA_PRIM_CHANNELS_MAX]; ///< bit allocation quantizer select
+ int quant_index_huffman[DCA_PRIM_CHANNELS_MAX][DCA_ABITS_MAX]; ///< quantization index codebook select
+ float scalefactor_adj[DCA_PRIM_CHANNELS_MAX][DCA_ABITS_MAX]; ///< scale factor adjustment
+
+ /* Primary audio coding side information */
+ int subsubframes[DCA_SUBFRAMES_MAX]; ///< number of subsubframes
+ int partial_samples[DCA_SUBFRAMES_MAX]; ///< partial subsubframe samples count
+ int prediction_mode[DCA_PRIM_CHANNELS_MAX][DCA_SUBBANDS]; ///< prediction mode (ADPCM used or not)
+ int prediction_vq[DCA_PRIM_CHANNELS_MAX][DCA_SUBBANDS]; ///< prediction VQ coefs
+ int bitalloc[DCA_PRIM_CHANNELS_MAX][DCA_SUBBANDS]; ///< bit allocation index
+ int transition_mode[DCA_PRIM_CHANNELS_MAX][DCA_SUBBANDS]; ///< transition mode (transients)
+ int scale_factor[DCA_PRIM_CHANNELS_MAX][DCA_SUBBANDS][2]; ///< scale factors (2 if transient)
+ int joint_huff[DCA_PRIM_CHANNELS_MAX]; ///< joint subband scale factors codebook
+ int joint_scale_factor[DCA_PRIM_CHANNELS_MAX][DCA_SUBBANDS]; ///< joint subband scale factors
+ int downmix_coef[DCA_PRIM_CHANNELS_MAX][2]; ///< stereo downmix coefficients
+ int dynrange_coef; ///< dynamic range coefficient
+
+ int high_freq_vq[DCA_PRIM_CHANNELS_MAX][DCA_SUBBANDS]; ///< VQ encoded high frequency subbands
+
+ float lfe_data[2 * DCA_LFE_MAX * (DCA_BLOCKS_MAX + 4)]; ///< Low frequency effect data
+ int lfe_scale_factor;
+
+ /* Subband samples history (for ADPCM) */
+ DECLARE_ALIGNED(16, float, subband_samples_hist)[DCA_PRIM_CHANNELS_MAX][DCA_SUBBANDS][4];
+ DECLARE_ALIGNED(32, float, subband_fir_hist)[DCA_PRIM_CHANNELS_MAX][512];
+ DECLARE_ALIGNED(32, float, subband_fir_noidea)[DCA_PRIM_CHANNELS_MAX][32];
+ int hist_index[DCA_PRIM_CHANNELS_MAX];
+ DECLARE_ALIGNED(32, float, raXin)[32];
+
+ int output; ///< type of output
+
+ DECLARE_ALIGNED(32, float, subband_samples)[DCA_BLOCKS_MAX][DCA_PRIM_CHANNELS_MAX][DCA_SUBBANDS][8];
+ float *samples_chanptr[DCA_PRIM_CHANNELS_MAX + 1];
+ float *extra_channels[DCA_PRIM_CHANNELS_MAX + 1];
+ uint8_t *extra_channels_buffer;
+ unsigned int extra_channels_buffer_size;
+
+ uint8_t dca_buffer[DCA_MAX_FRAME_SIZE + DCA_MAX_EXSS_HEADER_SIZE + DCA_BUFFER_PADDING_SIZE];
+ int dca_buffer_size; ///< how much data is in the dca_buffer
+
+ const int8_t *channel_order_tab; ///< channel reordering table, lfe and non lfe
+ GetBitContext gb;
+ /* Current position in DCA frame */
+ int current_subframe;
+ int current_subsubframe;
+
+ int core_ext_mask; ///< present extensions in the core substream
+
+ /* XCh extension information */
+ int xch_present; ///< XCh extension present and valid
+ int xch_base_channel; ///< index of first (only) channel containing XCH data
+
+ /* ExSS header parser */
+ int static_fields; ///< static fields present
+ int mix_metadata; ///< mixing metadata present
+ int num_mix_configs; ///< number of mix out configurations
+ int mix_config_num_ch[4]; ///< number of channels in each mix out configuration
+
+ int profile;
+
+ int debug_flag; ///< used for suppressing repeated error messages output
+ AVFloatDSPContext fdsp;
+ FFTContext imdct;
+ SynthFilterContext synth;
+ DCADSPContext dcadsp;
+ FmtConvertContext fmt_conv;
+} DCAContext;
+
+static const uint16_t dca_vlc_offs[] = {
+ 0, 512, 640, 768, 1282, 1794, 2436, 3080, 3770, 4454, 5364,
+ 5372, 5380, 5388, 5392, 5396, 5412, 5420, 5428, 5460, 5492, 5508,
+ 5572, 5604, 5668, 5796, 5860, 5892, 6412, 6668, 6796, 7308, 7564,
+ 7820, 8076, 8620, 9132, 9388, 9910, 10166, 10680, 11196, 11726, 12240,
+ 12752, 13298, 13810, 14326, 14840, 15500, 16022, 16540, 17158, 17678, 18264,
+ 18796, 19352, 19926, 20468, 21472, 22398, 23014, 23622,
+};
+
+static av_cold void dca_init_vlcs(void)
+{
+ static int vlcs_initialized = 0;
+ int i, j, c = 14;
+ static VLC_TYPE dca_table[23622][2];
+
+ if (vlcs_initialized)
+ return;
+
+ dca_bitalloc_index.offset = 1;
+ dca_bitalloc_index.wrap = 2;
+ for (i = 0; i < 5; i++) {
+ dca_bitalloc_index.vlc[i].table = &dca_table[dca_vlc_offs[i]];
+ dca_bitalloc_index.vlc[i].table_allocated = dca_vlc_offs[i + 1] - dca_vlc_offs[i];
+ init_vlc(&dca_bitalloc_index.vlc[i], bitalloc_12_vlc_bits[i], 12,
+ bitalloc_12_bits[i], 1, 1,
+ bitalloc_12_codes[i], 2, 2, INIT_VLC_USE_NEW_STATIC);
+ }
+ dca_scalefactor.offset = -64;
+ dca_scalefactor.wrap = 2;
+ for (i = 0; i < 5; i++) {
+ dca_scalefactor.vlc[i].table = &dca_table[dca_vlc_offs[i + 5]];
+ dca_scalefactor.vlc[i].table_allocated = dca_vlc_offs[i + 6] - dca_vlc_offs[i + 5];
+ init_vlc(&dca_scalefactor.vlc[i], SCALES_VLC_BITS, 129,
+ scales_bits[i], 1, 1,
+ scales_codes[i], 2, 2, INIT_VLC_USE_NEW_STATIC);
+ }
+ dca_tmode.offset = 0;
+ dca_tmode.wrap = 1;
+ for (i = 0; i < 4; i++) {
+ dca_tmode.vlc[i].table = &dca_table[dca_vlc_offs[i + 10]];
+ dca_tmode.vlc[i].table_allocated = dca_vlc_offs[i + 11] - dca_vlc_offs[i + 10];
+ init_vlc(&dca_tmode.vlc[i], tmode_vlc_bits[i], 4,
+ tmode_bits[i], 1, 1,
+ tmode_codes[i], 2, 2, INIT_VLC_USE_NEW_STATIC);
+ }
+
+ for (i = 0; i < 10; i++)
+ for (j = 0; j < 7; j++) {
+ if (!bitalloc_codes[i][j])
+ break;
+ dca_smpl_bitalloc[i + 1].offset = bitalloc_offsets[i];
+ dca_smpl_bitalloc[i + 1].wrap = 1 + (j > 4);
+ dca_smpl_bitalloc[i + 1].vlc[j].table = &dca_table[dca_vlc_offs[c]];
+ dca_smpl_bitalloc[i + 1].vlc[j].table_allocated = dca_vlc_offs[c + 1] - dca_vlc_offs[c];
+
+ init_vlc(&dca_smpl_bitalloc[i + 1].vlc[j], bitalloc_maxbits[i][j],
+ bitalloc_sizes[i],
+ bitalloc_bits[i][j], 1, 1,
+ bitalloc_codes[i][j], 2, 2, INIT_VLC_USE_NEW_STATIC);
+ c++;
+ }
+ vlcs_initialized = 1;
+}
+
+static inline void get_array(GetBitContext *gb, int *dst, int len, int bits)
+{
+ while (len--)
+ *dst++ = get_bits(gb, bits);
+}
+
+static int dca_parse_audio_coding_header(DCAContext *s, int base_channel)
+{
+ int i, j;
+ static const float adj_table[4] = { 1.0, 1.1250, 1.2500, 1.4375 };
+ static const int bitlen[11] = { 0, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3 };
+ static const int thr[11] = { 0, 1, 3, 3, 3, 3, 7, 7, 7, 7, 7 };
+
+ s->total_channels = get_bits(&s->gb, 3) + 1 + base_channel;
+ s->prim_channels = s->total_channels;
+
+ if (s->prim_channels > DCA_PRIM_CHANNELS_MAX)
+ s->prim_channels = DCA_PRIM_CHANNELS_MAX;
+
+
+ for (i = base_channel; i < s->prim_channels; i++) {
+ s->subband_activity[i] = get_bits(&s->gb, 5) + 2;
+ if (s->subband_activity[i] > DCA_SUBBANDS)
+ s->subband_activity[i] = DCA_SUBBANDS;
+ }
+ for (i = base_channel; i < s->prim_channels; i++) {
+ s->vq_start_subband[i] = get_bits(&s->gb, 5) + 1;
+ if (s->vq_start_subband[i] > DCA_SUBBANDS)
+ s->vq_start_subband[i] = DCA_SUBBANDS;
+ }
+ get_array(&s->gb, s->joint_intensity + base_channel, s->prim_channels - base_channel, 3);
+ get_array(&s->gb, s->transient_huffman + base_channel, s->prim_channels - base_channel, 2);
+ get_array(&s->gb, s->scalefactor_huffman + base_channel, s->prim_channels - base_channel, 3);
+ get_array(&s->gb, s->bitalloc_huffman + base_channel, s->prim_channels - base_channel, 3);
+
+ /* Get codebooks quantization indexes */
+ if (!base_channel)
+ memset(s->quant_index_huffman, 0, sizeof(s->quant_index_huffman));
+ for (j = 1; j < 11; j++)
+ for (i = base_channel; i < s->prim_channels; i++)
+ s->quant_index_huffman[i][j] = get_bits(&s->gb, bitlen[j]);
+
+ /* Get scale factor adjustment */
+ for (j = 0; j < 11; j++)
+ for (i = base_channel; i < s->prim_channels; i++)
+ s->scalefactor_adj[i][j] = 1;
+
+ for (j = 1; j < 11; j++)
+ for (i = base_channel; i < s->prim_channels; i++)
+ if (s->quant_index_huffman[i][j] < thr[j])
+ s->scalefactor_adj[i][j] = adj_table[get_bits(&s->gb, 2)];
+
+ if (s->crc_present) {
+ /* Audio header CRC check */
+ get_bits(&s->gb, 16);
+ }
+
+ s->current_subframe = 0;
+ s->current_subsubframe = 0;
+
+#ifdef TRACE
+ av_log(s->avctx, AV_LOG_DEBUG, "subframes: %i\n", s->subframes);
+ av_log(s->avctx, AV_LOG_DEBUG, "prim channels: %i\n", s->prim_channels);
+ for (i = base_channel; i < s->prim_channels; i++) {
+ av_log(s->avctx, AV_LOG_DEBUG, "subband activity: %i\n",
+ s->subband_activity[i]);
+ av_log(s->avctx, AV_LOG_DEBUG, "vq start subband: %i\n",
+ s->vq_start_subband[i]);
+ av_log(s->avctx, AV_LOG_DEBUG, "joint intensity: %i\n",
+ s->joint_intensity[i]);
+ av_log(s->avctx, AV_LOG_DEBUG, "transient mode codebook: %i\n",
+ s->transient_huffman[i]);
+ av_log(s->avctx, AV_LOG_DEBUG, "scale factor codebook: %i\n",
+ s->scalefactor_huffman[i]);
+ av_log(s->avctx, AV_LOG_DEBUG, "bit allocation quantizer: %i\n",
+ s->bitalloc_huffman[i]);
+ av_log(s->avctx, AV_LOG_DEBUG, "quant index huff:");
+ for (j = 0; j < 11; j++)
+ av_log(s->avctx, AV_LOG_DEBUG, " %i", s->quant_index_huffman[i][j]);
+ av_log(s->avctx, AV_LOG_DEBUG, "\n");
+ av_log(s->avctx, AV_LOG_DEBUG, "scalefac adj:");
+ for (j = 0; j < 11; j++)
+ av_log(s->avctx, AV_LOG_DEBUG, " %1.3f", s->scalefactor_adj[i][j]);
+ av_log(s->avctx, AV_LOG_DEBUG, "\n");
+ }
+#endif
+
+ return 0;
+}
+
+static int dca_parse_frame_header(DCAContext *s)
+{
+ init_get_bits(&s->gb, s->dca_buffer, s->dca_buffer_size * 8);
+
+ /* Sync code */
+ skip_bits_long(&s->gb, 32);
+
+ /* Frame header */
+ s->frame_type = get_bits(&s->gb, 1);
+ s->samples_deficit = get_bits(&s->gb, 5) + 1;
+ s->crc_present = get_bits(&s->gb, 1);
+ s->sample_blocks = get_bits(&s->gb, 7) + 1;
+ s->frame_size = get_bits(&s->gb, 14) + 1;
+ if (s->frame_size < 95)
+ return AVERROR_INVALIDDATA;
+ s->amode = get_bits(&s->gb, 6);
+ s->sample_rate = avpriv_dca_sample_rates[get_bits(&s->gb, 4)];
+ if (!s->sample_rate)
+ return AVERROR_INVALIDDATA;
+ s->bit_rate_index = get_bits(&s->gb, 5);
+ s->bit_rate = dca_bit_rates[s->bit_rate_index];
+ if (!s->bit_rate)
+ return AVERROR_INVALIDDATA;
+
+ s->downmix = get_bits(&s->gb, 1);
+ s->dynrange = get_bits(&s->gb, 1);
+ s->timestamp = get_bits(&s->gb, 1);
+ s->aux_data = get_bits(&s->gb, 1);
+ s->hdcd = get_bits(&s->gb, 1);
+ s->ext_descr = get_bits(&s->gb, 3);
+ s->ext_coding = get_bits(&s->gb, 1);
+ s->aspf = get_bits(&s->gb, 1);
+ s->lfe = get_bits(&s->gb, 2);
+ s->predictor_history = get_bits(&s->gb, 1);
+
+ /* TODO: check CRC */
+ if (s->crc_present)
+ s->header_crc = get_bits(&s->gb, 16);
+
+ s->multirate_inter = get_bits(&s->gb, 1);
+ s->version = get_bits(&s->gb, 4);
+ s->copy_history = get_bits(&s->gb, 2);
+ s->source_pcm_res = get_bits(&s->gb, 3);
+ s->front_sum = get_bits(&s->gb, 1);
+ s->surround_sum = get_bits(&s->gb, 1);
+ s->dialog_norm = get_bits(&s->gb, 4);
+
+ /* FIXME: channels mixing levels */
+ s->output = s->amode;
+ if (s->lfe)
+ s->output |= DCA_LFE;
+
+#ifdef TRACE
+ av_log(s->avctx, AV_LOG_DEBUG, "frame type: %i\n", s->frame_type);
+ av_log(s->avctx, AV_LOG_DEBUG, "samples deficit: %i\n", s->samples_deficit);
+ av_log(s->avctx, AV_LOG_DEBUG, "crc present: %i\n", s->crc_present);
+ av_log(s->avctx, AV_LOG_DEBUG, "sample blocks: %i (%i samples)\n",
+ s->sample_blocks, s->sample_blocks * 32);
+ av_log(s->avctx, AV_LOG_DEBUG, "frame size: %i bytes\n", s->frame_size);
+ av_log(s->avctx, AV_LOG_DEBUG, "amode: %i (%i channels)\n",
+ s->amode, dca_channels[s->amode]);
+ av_log(s->avctx, AV_LOG_DEBUG, "sample rate: %i Hz\n",
+ s->sample_rate);
+ av_log(s->avctx, AV_LOG_DEBUG, "bit rate: %i bits/s\n",
+ s->bit_rate);
+ av_log(s->avctx, AV_LOG_DEBUG, "downmix: %i\n", s->downmix);
+ av_log(s->avctx, AV_LOG_DEBUG, "dynrange: %i\n", s->dynrange);
+ av_log(s->avctx, AV_LOG_DEBUG, "timestamp: %i\n", s->timestamp);
+ av_log(s->avctx, AV_LOG_DEBUG, "aux_data: %i\n", s->aux_data);
+ av_log(s->avctx, AV_LOG_DEBUG, "hdcd: %i\n", s->hdcd);
+ av_log(s->avctx, AV_LOG_DEBUG, "ext descr: %i\n", s->ext_descr);
+ av_log(s->avctx, AV_LOG_DEBUG, "ext coding: %i\n", s->ext_coding);
+ av_log(s->avctx, AV_LOG_DEBUG, "aspf: %i\n", s->aspf);
+ av_log(s->avctx, AV_LOG_DEBUG, "lfe: %i\n", s->lfe);
+ av_log(s->avctx, AV_LOG_DEBUG, "predictor history: %i\n",
+ s->predictor_history);
+ av_log(s->avctx, AV_LOG_DEBUG, "header crc: %i\n", s->header_crc);
+ av_log(s->avctx, AV_LOG_DEBUG, "multirate inter: %i\n",
+ s->multirate_inter);
+ av_log(s->avctx, AV_LOG_DEBUG, "version number: %i\n", s->version);
+ av_log(s->avctx, AV_LOG_DEBUG, "copy history: %i\n", s->copy_history);
+ av_log(s->avctx, AV_LOG_DEBUG,
+ "source pcm resolution: %i (%i bits/sample)\n",
+ s->source_pcm_res, dca_bits_per_sample[s->source_pcm_res]);
+ av_log(s->avctx, AV_LOG_DEBUG, "front sum: %i\n", s->front_sum);
+ av_log(s->avctx, AV_LOG_DEBUG, "surround sum: %i\n", s->surround_sum);
+ av_log(s->avctx, AV_LOG_DEBUG, "dialog norm: %i\n", s->dialog_norm);
+ av_log(s->avctx, AV_LOG_DEBUG, "\n");
+#endif
+
+ /* Primary audio coding header */
+ s->subframes = get_bits(&s->gb, 4) + 1;
+
+ return dca_parse_audio_coding_header(s, 0);
+}
+
+
+static inline int get_scale(GetBitContext *gb, int level, int value, int log2range)
+{
+ if (level < 5) {
+ /* huffman encoded */
+ value += get_bitalloc(gb, &dca_scalefactor, level);
+ value = av_clip(value, 0, (1 << log2range) - 1);
+ } else if (level < 8) {
+ if (level + 1 > log2range) {
+ skip_bits(gb, level + 1 - log2range);
+ value = get_bits(gb, log2range);
+ } else {
+ value = get_bits(gb, level + 1);
+ }
+ }
+ return value;
+}
+
+static int dca_subframe_header(DCAContext *s, int base_channel, int block_index)
+{
+ /* Primary audio coding side information */
+ int j, k;
+
+ if (get_bits_left(&s->gb) < 0)
+ return AVERROR_INVALIDDATA;
+
+ if (!base_channel) {
+ s->subsubframes[s->current_subframe] = get_bits(&s->gb, 2) + 1;
+ s->partial_samples[s->current_subframe] = get_bits(&s->gb, 3);
+ }
+
+ for (j = base_channel; j < s->prim_channels; j++) {
+ for (k = 0; k < s->subband_activity[j]; k++)
+ s->prediction_mode[j][k] = get_bits(&s->gb, 1);
+ }
+
+ /* Get prediction codebook */
+ for (j = base_channel; j < s->prim_channels; j++) {
+ for (k = 0; k < s->subband_activity[j]; k++) {
+ if (s->prediction_mode[j][k] > 0) {
+ /* (Prediction coefficient VQ address) */
+ s->prediction_vq[j][k] = get_bits(&s->gb, 12);
+ }
+ }
+ }
+
+ /* Bit allocation index */
+ for (j = base_channel; j < s->prim_channels; j++) {
+ for (k = 0; k < s->vq_start_subband[j]; k++) {
+ if (s->bitalloc_huffman[j] == 6)
+ s->bitalloc[j][k] = get_bits(&s->gb, 5);
+ else if (s->bitalloc_huffman[j] == 5)
+ s->bitalloc[j][k] = get_bits(&s->gb, 4);
+ else if (s->bitalloc_huffman[j] == 7) {
+ av_log(s->avctx, AV_LOG_ERROR,
+ "Invalid bit allocation index\n");
+ return AVERROR_INVALIDDATA;
+ } else {
+ s->bitalloc[j][k] =
+ get_bitalloc(&s->gb, &dca_bitalloc_index, s->bitalloc_huffman[j]);
+ }
+
+ if (s->bitalloc[j][k] > 26) {
+ av_dlog(s->avctx, "bitalloc index [%i][%i] too big (%i)\n",
+ j, k, s->bitalloc[j][k]);
+ return AVERROR_INVALIDDATA;
+ }
+ }
+ }
+
+ /* Transition mode */
+ for (j = base_channel; j < s->prim_channels; j++) {
+ for (k = 0; k < s->subband_activity[j]; k++) {
+ s->transition_mode[j][k] = 0;
+ if (s->subsubframes[s->current_subframe] > 1 &&
+ k < s->vq_start_subband[j] && s->bitalloc[j][k] > 0) {
+ s->transition_mode[j][k] =
+ get_bitalloc(&s->gb, &dca_tmode, s->transient_huffman[j]);
+ }
+ }
+ }
+
+ if (get_bits_left(&s->gb) < 0)
+ return AVERROR_INVALIDDATA;
+
+ for (j = base_channel; j < s->prim_channels; j++) {
+ const uint32_t *scale_table;
+ int scale_sum, log_size;
+
+ memset(s->scale_factor[j], 0,
+ s->subband_activity[j] * sizeof(s->scale_factor[0][0][0]) * 2);
+
+ if (s->scalefactor_huffman[j] == 6) {
+ scale_table = scale_factor_quant7;
+ log_size = 7;
+ } else {
+ scale_table = scale_factor_quant6;
+ log_size = 6;
+ }
+
+ /* When huffman coded, only the difference is encoded */
+ scale_sum = 0;
+
+ for (k = 0; k < s->subband_activity[j]; k++) {
+ if (k >= s->vq_start_subband[j] || s->bitalloc[j][k] > 0) {
+ scale_sum = get_scale(&s->gb, s->scalefactor_huffman[j], scale_sum, log_size);
+ s->scale_factor[j][k][0] = scale_table[scale_sum];
+ }
+
+ if (k < s->vq_start_subband[j] && s->transition_mode[j][k]) {
+ /* Get second scale factor */
+ scale_sum = get_scale(&s->gb, s->scalefactor_huffman[j], scale_sum, log_size);
+ s->scale_factor[j][k][1] = scale_table[scale_sum];
+ }
+ }
+ }
+
+ /* Joint subband scale factor codebook select */
+ for (j = base_channel; j < s->prim_channels; j++) {
+ /* Transmitted only if joint subband coding enabled */
+ if (s->joint_intensity[j] > 0)
+ s->joint_huff[j] = get_bits(&s->gb, 3);
+ }
+
+ if (get_bits_left(&s->gb) < 0)
+ return AVERROR_INVALIDDATA;
+
+ /* Scale factors for joint subband coding */
+ for (j = base_channel; j < s->prim_channels; j++) {
+ int source_channel;
+
+ /* Transmitted only if joint subband coding enabled */
+ if (s->joint_intensity[j] > 0) {
+ int scale = 0;
+ source_channel = s->joint_intensity[j] - 1;
+
+ /* When huffman coded, only the difference is encoded
+ * (is this valid as well for joint scales ???) */
+
+ for (k = s->subband_activity[j]; k < s->subband_activity[source_channel]; k++) {
+ scale = get_scale(&s->gb, s->joint_huff[j], 64 /* bias */, 7);
+ s->joint_scale_factor[j][k] = scale; /*joint_scale_table[scale]; */
+ }
+
+ if (!(s->debug_flag & 0x02)) {
+ av_log(s->avctx, AV_LOG_DEBUG,
+ "Joint stereo coding not supported\n");
+ s->debug_flag |= 0x02;
+ }
+ }
+ }
+
+ /* Stereo downmix coefficients */
+ if (!base_channel && s->prim_channels > 2) {
+ if (s->downmix) {
+ for (j = base_channel; j < s->prim_channels; j++) {
+ s->downmix_coef[j][0] = get_bits(&s->gb, 7);
+ s->downmix_coef[j][1] = get_bits(&s->gb, 7);
+ }
+ } else {
+ int am = s->amode & DCA_CHANNEL_MASK;
+ if (am >= FF_ARRAY_ELEMS(dca_default_coeffs)) {
+ av_log(s->avctx, AV_LOG_ERROR,
+ "Invalid channel mode %d\n", am);
+ return AVERROR_INVALIDDATA;
+ }
+ for (j = base_channel; j < s->prim_channels; j++) {
+ s->downmix_coef[j][0] = dca_default_coeffs[am][j][0];
+ s->downmix_coef[j][1] = dca_default_coeffs[am][j][1];
+ }
+ }
+ }
+
+ /* Dynamic range coefficient */
+ if (!base_channel && s->dynrange)
+ s->dynrange_coef = get_bits(&s->gb, 8);
+
+ /* Side information CRC check word */
+ if (s->crc_present) {
+ get_bits(&s->gb, 16);
+ }
+
+ /*
+ * Primary audio data arrays
+ */
+
+ /* VQ encoded high frequency subbands */
+ for (j = base_channel; j < s->prim_channels; j++)
+ for (k = s->vq_start_subband[j]; k < s->subband_activity[j]; k++)
+ /* 1 vector -> 32 samples */
+ s->high_freq_vq[j][k] = get_bits(&s->gb, 10);
+
+ /* Low frequency effect data */
+ if (!base_channel && s->lfe) {
+ /* LFE samples */
+ int lfe_samples = 2 * s->lfe * (4 + block_index);
+ int lfe_end_sample = 2 * s->lfe * (4 + block_index + s->subsubframes[s->current_subframe]);
+ float lfe_scale;
+
+ for (j = lfe_samples; j < lfe_end_sample; j++) {
+ /* Signed 8 bits int */
+ s->lfe_data[j] = get_sbits(&s->gb, 8);
+ }
+
+ /* Scale factor index */
+ skip_bits(&s->gb, 1);
+ s->lfe_scale_factor = scale_factor_quant7[get_bits(&s->gb, 7)];
+
+ /* Quantization step size * scale factor */
+ lfe_scale = 0.035 * s->lfe_scale_factor;
+
+ for (j = lfe_samples; j < lfe_end_sample; j++)
+ s->lfe_data[j] *= lfe_scale;
+ }
+
+#ifdef TRACE
+ av_log(s->avctx, AV_LOG_DEBUG, "subsubframes: %i\n",
+ s->subsubframes[s->current_subframe]);
+ av_log(s->avctx, AV_LOG_DEBUG, "partial samples: %i\n",
+ s->partial_samples[s->current_subframe]);
+
+ for (j = base_channel; j < s->prim_channels; j++) {
+ av_log(s->avctx, AV_LOG_DEBUG, "prediction mode:");
+ for (k = 0; k < s->subband_activity[j]; k++)
+ av_log(s->avctx, AV_LOG_DEBUG, " %i", s->prediction_mode[j][k]);
+ av_log(s->avctx, AV_LOG_DEBUG, "\n");
+ }
+ for (j = base_channel; j < s->prim_channels; j++) {
+ for (k = 0; k < s->subband_activity[j]; k++)
+ av_log(s->avctx, AV_LOG_DEBUG,
+ "prediction coefs: %f, %f, %f, %f\n",
+ (float) adpcm_vb[s->prediction_vq[j][k]][0] / 8192,
+ (float) adpcm_vb[s->prediction_vq[j][k]][1] / 8192,
+ (float) adpcm_vb[s->prediction_vq[j][k]][2] / 8192,
+ (float) adpcm_vb[s->prediction_vq[j][k]][3] / 8192);
+ }
+ for (j = base_channel; j < s->prim_channels; j++) {
+ av_log(s->avctx, AV_LOG_DEBUG, "bitalloc index: ");
+ for (k = 0; k < s->vq_start_subband[j]; k++)
+ av_log(s->avctx, AV_LOG_DEBUG, "%2.2i ", s->bitalloc[j][k]);
+ av_log(s->avctx, AV_LOG_DEBUG, "\n");
+ }
+ for (j = base_channel; j < s->prim_channels; j++) {
+ av_log(s->avctx, AV_LOG_DEBUG, "Transition mode:");
+ for (k = 0; k < s->subband_activity[j]; k++)
+ av_log(s->avctx, AV_LOG_DEBUG, " %i", s->transition_mode[j][k]);
+ av_log(s->avctx, AV_LOG_DEBUG, "\n");
+ }
+ for (j = base_channel; j < s->prim_channels; j++) {
+ av_log(s->avctx, AV_LOG_DEBUG, "Scale factor:");
+ for (k = 0; k < s->subband_activity[j]; k++) {
+ if (k >= s->vq_start_subband[j] || s->bitalloc[j][k] > 0)
+ av_log(s->avctx, AV_LOG_DEBUG, " %i", s->scale_factor[j][k][0]);
+ if (k < s->vq_start_subband[j] && s->transition_mode[j][k])
+ av_log(s->avctx, AV_LOG_DEBUG, " %i(t)", s->scale_factor[j][k][1]);
+ }
+ av_log(s->avctx, AV_LOG_DEBUG, "\n");
+ }
+ for (j = base_channel; j < s->prim_channels; j++) {
+ if (s->joint_intensity[j] > 0) {
+ int source_channel = s->joint_intensity[j] - 1;
+ av_log(s->avctx, AV_LOG_DEBUG, "Joint scale factor index:\n");
+ for (k = s->subband_activity[j]; k < s->subband_activity[source_channel]; k++)
+ av_log(s->avctx, AV_LOG_DEBUG, " %i", s->joint_scale_factor[j][k]);
+ av_log(s->avctx, AV_LOG_DEBUG, "\n");
+ }
+ }
+ if (!base_channel && s->prim_channels > 2 && s->downmix) {
+ av_log(s->avctx, AV_LOG_DEBUG, "Downmix coeffs:\n");
+ for (j = 0; j < s->prim_channels; j++) {
+ av_log(s->avctx, AV_LOG_DEBUG, "Channel 0, %d = %f\n", j,
+ dca_downmix_coeffs[s->downmix_coef[j][0]]);
+ av_log(s->avctx, AV_LOG_DEBUG, "Channel 1, %d = %f\n", j,
+ dca_downmix_coeffs[s->downmix_coef[j][1]]);
+ }
+ av_log(s->avctx, AV_LOG_DEBUG, "\n");
+ }
+ for (j = base_channel; j < s->prim_channels; j++)
+ for (k = s->vq_start_subband[j]; k < s->subband_activity[j]; k++)
+ av_log(s->avctx, AV_LOG_DEBUG, "VQ index: %i\n", s->high_freq_vq[j][k]);
+ if (!base_channel && s->lfe) {
+ int lfe_samples = 2 * s->lfe * (4 + block_index);
+ int lfe_end_sample = 2 * s->lfe * (4 + block_index + s->subsubframes[s->current_subframe]);
+
+ av_log(s->avctx, AV_LOG_DEBUG, "LFE samples:\n");
+ for (j = lfe_samples; j < lfe_end_sample; j++)
+ av_log(s->avctx, AV_LOG_DEBUG, " %f", s->lfe_data[j]);
+ av_log(s->avctx, AV_LOG_DEBUG, "\n");
+ }
+#endif
+
+ return 0;
+}
+
+static void qmf_32_subbands(DCAContext *s, int chans,
+ float samples_in[32][8], float *samples_out,
+ float scale)
+{
+ const float *prCoeff;
+ int i;
+
+ int sb_act = s->subband_activity[chans];
+ int subindex;
+
+ scale *= sqrt(1 / 8.0);
+
+ /* Select filter */
+ if (!s->multirate_inter) /* Non-perfect reconstruction */
+ prCoeff = fir_32bands_nonperfect;
+ else /* Perfect reconstruction */
+ prCoeff = fir_32bands_perfect;
+
+ for (i = sb_act; i < 32; i++)
+ s->raXin[i] = 0.0;
+
+ /* Reconstructed channel sample index */
+ for (subindex = 0; subindex < 8; subindex++) {
+ /* Load in one sample from each subband and clear inactive subbands */
+ for (i = 0; i < sb_act; i++) {
+ unsigned sign = (i - 1) & 2;
+ uint32_t v = AV_RN32A(&samples_in[i][subindex]) ^ sign << 30;
+ AV_WN32A(&s->raXin[i], v);
+ }
+
+ s->synth.synth_filter_float(&s->imdct,
+ s->subband_fir_hist[chans],
+ &s->hist_index[chans],
+ s->subband_fir_noidea[chans], prCoeff,
+ samples_out, s->raXin, scale);
+ samples_out += 32;
+ }
+}
+
+static void lfe_interpolation_fir(DCAContext *s, int decimation_select,
+ int num_deci_sample, float *samples_in,
+ float *samples_out, float scale)
+{
+ /* samples_in: An array holding decimated samples.
+ * Samples in current subframe starts from samples_in[0],
+ * while samples_in[-1], samples_in[-2], ..., stores samples
+ * from last subframe as history.
+ *
+ * samples_out: An array holding interpolated samples
+ */
+
+ int decifactor;
+ const float *prCoeff;
+ int deciindex;
+
+ /* Select decimation filter */
+ if (decimation_select == 1) {
+ decifactor = 64;
+ prCoeff = lfe_fir_128;
+ } else {
+ decifactor = 32;
+ prCoeff = lfe_fir_64;
+ }
+ /* Interpolation */
+ for (deciindex = 0; deciindex < num_deci_sample; deciindex++) {
+ s->dcadsp.lfe_fir(samples_out, samples_in, prCoeff, decifactor, scale);
+ samples_in++;
+ samples_out += 2 * decifactor;
+ }
+}
+
+/* downmixing routines */
+#define MIX_REAR1(samples, s1, rs, coef) \
+ samples[0][i] += samples[s1][i] * coef[rs][0]; \
+ samples[1][i] += samples[s1][i] * coef[rs][1];
+
+#define MIX_REAR2(samples, s1, s2, rs, coef) \
+ samples[0][i] += samples[s1][i] * coef[rs][0] + samples[s2][i] * coef[rs + 1][0]; \
+ samples[1][i] += samples[s1][i] * coef[rs][1] + samples[s2][i] * coef[rs + 1][1];
+
+#define MIX_FRONT3(samples, coef) \
+ t = samples[c][i]; \
+ u = samples[l][i]; \
+ v = samples[r][i]; \
+ samples[0][i] = t * coef[0][0] + u * coef[1][0] + v * coef[2][0]; \
+ samples[1][i] = t * coef[0][1] + u * coef[1][1] + v * coef[2][1];
+
+#define DOWNMIX_TO_STEREO(op1, op2) \
+ for (i = 0; i < 256; i++) { \
+ op1 \
+ op2 \
+ }
+
+static void dca_downmix(float **samples, int srcfmt,
+ int downmix_coef[DCA_PRIM_CHANNELS_MAX][2],
+ const int8_t *channel_mapping)
+{
+ int c, l, r, sl, sr, s;
+ int i;
+ float t, u, v;
+ float coef[DCA_PRIM_CHANNELS_MAX][2];
+
+ for (i = 0; i < DCA_PRIM_CHANNELS_MAX; i++) {
+ coef[i][0] = dca_downmix_coeffs[downmix_coef[i][0]];
+ coef[i][1] = dca_downmix_coeffs[downmix_coef[i][1]];
+ }
+
+ switch (srcfmt) {
+ case DCA_MONO:
+ case DCA_CHANNEL:
+ case DCA_STEREO_TOTAL:
+ case DCA_STEREO_SUMDIFF:
+ case DCA_4F2R:
+ av_log(NULL, 0, "Not implemented!\n");
+ break;
+ case DCA_STEREO:
+ break;
+ case DCA_3F:
+ c = channel_mapping[0];
+ l = channel_mapping[1];
+ r = channel_mapping[2];
+ DOWNMIX_TO_STEREO(MIX_FRONT3(samples, coef), );
+ break;
+ case DCA_2F1R:
+ s = channel_mapping[2];
+ DOWNMIX_TO_STEREO(MIX_REAR1(samples, s, 2, coef), );
+ break;
+ case DCA_3F1R:
+ c = channel_mapping[0];
+ l = channel_mapping[1];
+ r = channel_mapping[2];
+ s = channel_mapping[3];
+ DOWNMIX_TO_STEREO(MIX_FRONT3(samples, coef),
+ MIX_REAR1(samples, s, 3, coef));
+ break;
+ case DCA_2F2R:
+ sl = channel_mapping[2];
+ sr = channel_mapping[3];
+ DOWNMIX_TO_STEREO(MIX_REAR2(samples, sl, sr, 2, coef), );
+ break;
+ case DCA_3F2R:
+ c = channel_mapping[0];
+ l = channel_mapping[1];
+ r = channel_mapping[2];
+ sl = channel_mapping[3];
+ sr = channel_mapping[4];
+ DOWNMIX_TO_STEREO(MIX_FRONT3(samples, coef),
+ MIX_REAR2(samples, sl, sr, 3, coef));
+ break;
+ }
+}
+
+
+#ifndef decode_blockcodes
+/* Very compact version of the block code decoder that does not use table
+ * look-up but is slightly slower */
+static int decode_blockcode(int code, int levels, int *values)
+{
+ int i;
+ int offset = (levels - 1) >> 1;
+
+ for (i = 0; i < 4; i++) {
+ int div = FASTDIV(code, levels);
+ values[i] = code - offset - div * levels;
+ code = div;
+ }
+
+ return code;
+}
+
+static int decode_blockcodes(int code1, int code2, int levels, int *values)
+{
+ return decode_blockcode(code1, levels, values) |
+ decode_blockcode(code2, levels, values + 4);
+}
+#endif
+
+static const uint8_t abits_sizes[7] = { 7, 10, 12, 13, 15, 17, 19 };
+static const uint8_t abits_levels[7] = { 3, 5, 7, 9, 13, 17, 25 };
+
+#ifndef int8x8_fmul_int32
+static inline void int8x8_fmul_int32(float *dst, const int8_t *src, int scale)
+{
+ float fscale = scale / 16.0;
+ int i;
+ for (i = 0; i < 8; i++)
+ dst[i] = src[i] * fscale;
+}
+#endif
+
+static int dca_subsubframe(DCAContext *s, int base_channel, int block_index)
+{
+ int k, l;
+ int subsubframe = s->current_subsubframe;
+
+ const float *quant_step_table;
+
+ /* FIXME */
+ float (*subband_samples)[DCA_SUBBANDS][8] = s->subband_samples[block_index];
+ LOCAL_ALIGNED_16(int, block, [8]);
+
+ /*
+ * Audio data
+ */
+
+ /* Select quantization step size table */
+ if (s->bit_rate_index == 0x1f)
+ quant_step_table = lossless_quant_d;
+ else
+ quant_step_table = lossy_quant_d;
+
+ for (k = base_channel; k < s->prim_channels; k++) {
+ if (get_bits_left(&s->gb) < 0)
+ return AVERROR_INVALIDDATA;
+
+ for (l = 0; l < s->vq_start_subband[k]; l++) {
+ int m;
+
+ /* Select the mid-tread linear quantizer */
+ int abits = s->bitalloc[k][l];
+
+ float quant_step_size = quant_step_table[abits];
+
+ /*
+ * Determine quantization index code book and its type
+ */
+
+ /* Select quantization index code book */
+ int sel = s->quant_index_huffman[k][abits];
+
+ /*
+ * Extract bits from the bit stream
+ */
+ if (!abits) {
+ memset(subband_samples[k][l], 0, 8 * sizeof(subband_samples[0][0][0]));
+ } else {
+ /* Deal with transients */
+ int sfi = s->transition_mode[k][l] && subsubframe >= s->transition_mode[k][l];
+ float rscale = quant_step_size * s->scale_factor[k][l][sfi] *
+ s->scalefactor_adj[k][sel];
+
+ if (abits >= 11 || !dca_smpl_bitalloc[abits].vlc[sel].table) {
+ if (abits <= 7) {
+ /* Block code */
+ int block_code1, block_code2, size, levels, err;
+
+ size = abits_sizes[abits - 1];
+ levels = abits_levels[abits - 1];
+
+ block_code1 = get_bits(&s->gb, size);
+ block_code2 = get_bits(&s->gb, size);
+ err = decode_blockcodes(block_code1, block_code2,
+ levels, block);
+ if (err) {
+ av_log(s->avctx, AV_LOG_ERROR,
+ "ERROR: block code look-up failed\n");
+ return AVERROR_INVALIDDATA;
+ }
+ } else {
+ /* no coding */
+ for (m = 0; m < 8; m++)
+ block[m] = get_sbits(&s->gb, abits - 3);
+ }
+ } else {
+ /* Huffman coded */
+ for (m = 0; m < 8; m++)
+ block[m] = get_bitalloc(&s->gb,
+ &dca_smpl_bitalloc[abits], sel);
+ }
+
+ s->fmt_conv.int32_to_float_fmul_scalar(subband_samples[k][l],
+ block, rscale, 8);
+ }
+
+ /*
+ * Inverse ADPCM if in prediction mode
+ */
+ if (s->prediction_mode[k][l]) {
+ int n;
+ for (m = 0; m < 8; m++) {
+ for (n = 1; n <= 4; n++)
+ if (m >= n)
+ subband_samples[k][l][m] +=
+ (adpcm_vb[s->prediction_vq[k][l]][n - 1] *
+ subband_samples[k][l][m - n] / 8192);
+ else if (s->predictor_history)
+ subband_samples[k][l][m] +=
+ (adpcm_vb[s->prediction_vq[k][l]][n - 1] *
+ s->subband_samples_hist[k][l][m - n + 4] / 8192);
+ }
+ }
+ }
+
+ /*
+ * Decode VQ encoded high frequencies
+ */
+ for (l = s->vq_start_subband[k]; l < s->subband_activity[k]; l++) {
+ /* 1 vector -> 32 samples but we only need the 8 samples
+ * for this subsubframe. */
+ int hfvq = s->high_freq_vq[k][l];
+
+ if (!s->debug_flag & 0x01) {
+ av_log(s->avctx, AV_LOG_DEBUG,
+ "Stream with high frequencies VQ coding\n");
+ s->debug_flag |= 0x01;
+ }
+
+ int8x8_fmul_int32(subband_samples[k][l],
+ &high_freq_vq[hfvq][subsubframe * 8],
+ s->scale_factor[k][l][0]);
+ }
+ }
+
+ /* Check for DSYNC after subsubframe */
+ if (s->aspf || subsubframe == s->subsubframes[s->current_subframe] - 1) {
+ if (0xFFFF == get_bits(&s->gb, 16)) { /* 0xFFFF */
+#ifdef TRACE
+ av_log(s->avctx, AV_LOG_DEBUG, "Got subframe DSYNC\n");
+#endif
+ } else {
+ av_log(s->avctx, AV_LOG_ERROR, "Didn't get subframe DSYNC\n");
+ }
+ }
+
+ /* Backup predictor history for adpcm */
+ for (k = base_channel; k < s->prim_channels; k++)
+ for (l = 0; l < s->vq_start_subband[k]; l++)
+ memcpy(s->subband_samples_hist[k][l],
+ &subband_samples[k][l][4],
+ 4 * sizeof(subband_samples[0][0][0]));
+
+ return 0;
+}
+
+static int dca_filter_channels(DCAContext *s, int block_index)
+{
+ float (*subband_samples)[DCA_SUBBANDS][8] = s->subband_samples[block_index];
+ int k;
+
+ /* 32 subbands QMF */
+ for (k = 0; k < s->prim_channels; k++) {
+/* static float pcm_to_double[8] = { 32768.0, 32768.0, 524288.0, 524288.0,
+ 0, 8388608.0, 8388608.0 };*/
+ if (s->channel_order_tab[k] >= 0)
+ qmf_32_subbands(s, k, subband_samples[k],
+ s->samples_chanptr[s->channel_order_tab[k]],
+ M_SQRT1_2 / 32768.0 /* pcm_to_double[s->source_pcm_res] */);
+ }
+
+ /* Down mixing */
+ if (s->avctx->request_channels == 2 && s->prim_channels > 2) {
+ dca_downmix(s->samples_chanptr, s->amode, s->downmix_coef, s->channel_order_tab);
+ }
+
+ /* Generate LFE samples for this subsubframe FIXME!!! */
+ if (s->output & DCA_LFE) {
+ lfe_interpolation_fir(s, s->lfe, 2 * s->lfe,
+ s->lfe_data + 2 * s->lfe * (block_index + 4),
+ s->samples_chanptr[dca_lfe_index[s->amode]],
+ 1.0 / (256.0 * 32768.0));
+ /* Outputs 20bits pcm samples */
+ }
+
+ return 0;
+}
+
+
+static int dca_subframe_footer(DCAContext *s, int base_channel)
+{
+ int aux_data_count = 0, i;
+
+ /*
+ * Unpack optional information
+ */
+
+ /* presumably optional information only appears in the core? */
+ if (!base_channel) {
+ if (s->timestamp)
+ skip_bits_long(&s->gb, 32);
+
+ if (s->aux_data)
+ aux_data_count = get_bits(&s->gb, 6);
+
+ for (i = 0; i < aux_data_count; i++)
+ get_bits(&s->gb, 8);
+
+ if (s->crc_present && (s->downmix || s->dynrange))
+ get_bits(&s->gb, 16);
+ }
+
+ return 0;
+}
+
+/**
+ * Decode a dca frame block
+ *
+ * @param s pointer to the DCAContext
+ */
+
+static int dca_decode_block(DCAContext *s, int base_channel, int block_index)
+{
+ int ret;
+
+ /* Sanity check */
+ if (s->current_subframe >= s->subframes) {
+ av_log(s->avctx, AV_LOG_DEBUG, "check failed: %i>%i",
+ s->current_subframe, s->subframes);
+ return AVERROR_INVALIDDATA;
+ }
+
+ if (!s->current_subsubframe) {
+#ifdef TRACE
+ av_log(s->avctx, AV_LOG_DEBUG, "DSYNC dca_subframe_header\n");
+#endif
+ /* Read subframe header */
+ if ((ret = dca_subframe_header(s, base_channel, block_index)))
+ return ret;
+ }
+
+ /* Read subsubframe */
+#ifdef TRACE
+ av_log(s->avctx, AV_LOG_DEBUG, "DSYNC dca_subsubframe\n");
+#endif
+ if ((ret = dca_subsubframe(s, base_channel, block_index)))
+ return ret;
+
+ /* Update state */
+ s->current_subsubframe++;
+ if (s->current_subsubframe >= s->subsubframes[s->current_subframe]) {
+ s->current_subsubframe = 0;
+ s->current_subframe++;
+ }
+ if (s->current_subframe >= s->subframes) {
+#ifdef TRACE
+ av_log(s->avctx, AV_LOG_DEBUG, "DSYNC dca_subframe_footer\n");
+#endif
+ /* Read subframe footer */
+ if ((ret = dca_subframe_footer(s, base_channel)))
+ return ret;
+ }
+
+ return 0;
+}
+
+/**
+ * Return the number of channels in an ExSS speaker mask (HD)
+ */
+static int dca_exss_mask2count(int mask)
+{
+ /* count bits that mean speaker pairs twice */
+ return av_popcount(mask) +
+ av_popcount(mask & (DCA_EXSS_CENTER_LEFT_RIGHT |
+ DCA_EXSS_FRONT_LEFT_RIGHT |
+ DCA_EXSS_FRONT_HIGH_LEFT_RIGHT |
+ DCA_EXSS_WIDE_LEFT_RIGHT |
+ DCA_EXSS_SIDE_LEFT_RIGHT |
+ DCA_EXSS_SIDE_HIGH_LEFT_RIGHT |
+ DCA_EXSS_SIDE_REAR_LEFT_RIGHT |
+ DCA_EXSS_REAR_LEFT_RIGHT |
+ DCA_EXSS_REAR_HIGH_LEFT_RIGHT));
+}
+
+/**
+ * Skip mixing coefficients of a single mix out configuration (HD)
+ */
+static void dca_exss_skip_mix_coeffs(GetBitContext *gb, int channels, int out_ch)
+{
+ int i;
+
+ for (i = 0; i < channels; i++) {
+ int mix_map_mask = get_bits(gb, out_ch);
+ int num_coeffs = av_popcount(mix_map_mask);
+ skip_bits_long(gb, num_coeffs * 6);
+ }
+}
+
+/**
+ * Parse extension substream asset header (HD)
+ */
+static int dca_exss_parse_asset_header(DCAContext *s)
+{
+ int header_pos = get_bits_count(&s->gb);
+ int header_size;
+ int channels;
+ int embedded_stereo = 0;
+ int embedded_6ch = 0;
+ int drc_code_present;
+ int extensions_mask;
+ int i, j;
+
+ if (get_bits_left(&s->gb) < 16)
+ return -1;
+
+ /* We will parse just enough to get to the extensions bitmask with which
+ * we can set the profile value. */
+
+ header_size = get_bits(&s->gb, 9) + 1;
+ skip_bits(&s->gb, 3); // asset index
+
+ if (s->static_fields) {
+ if (get_bits1(&s->gb))
+ skip_bits(&s->gb, 4); // asset type descriptor
+ if (get_bits1(&s->gb))
+ skip_bits_long(&s->gb, 24); // language descriptor
+
+ if (get_bits1(&s->gb)) {
+ /* How can one fit 1024 bytes of text here if the maximum value
+ * for the asset header size field above was 512 bytes? */
+ int text_length = get_bits(&s->gb, 10) + 1;
+ if (get_bits_left(&s->gb) < text_length * 8)
+ return -1;
+ skip_bits_long(&s->gb, text_length * 8); // info text
+ }
+
+ skip_bits(&s->gb, 5); // bit resolution - 1
+ skip_bits(&s->gb, 4); // max sample rate code
+ channels = get_bits(&s->gb, 8) + 1;
+
+ if (get_bits1(&s->gb)) { // 1-to-1 channels to speakers
+ int spkr_remap_sets;
+ int spkr_mask_size = 16;
+ int num_spkrs[7];
+
+ if (channels > 2)
+ embedded_stereo = get_bits1(&s->gb);
+ if (channels > 6)
+ embedded_6ch = get_bits1(&s->gb);
+
+ if (get_bits1(&s->gb)) {
+ spkr_mask_size = (get_bits(&s->gb, 2) + 1) << 2;
+ skip_bits(&s->gb, spkr_mask_size); // spkr activity mask
+ }
+
+ spkr_remap_sets = get_bits(&s->gb, 3);
+
+ for (i = 0; i < spkr_remap_sets; i++) {
+ /* std layout mask for each remap set */
+ num_spkrs[i] = dca_exss_mask2count(get_bits(&s->gb, spkr_mask_size));
+ }
+
+ for (i = 0; i < spkr_remap_sets; i++) {
+ int num_dec_ch_remaps = get_bits(&s->gb, 5) + 1;
+ if (get_bits_left(&s->gb) < 0)
+ return -1;
+
+ for (j = 0; j < num_spkrs[i]; j++) {
+ int remap_dec_ch_mask = get_bits_long(&s->gb, num_dec_ch_remaps);
+ int num_dec_ch = av_popcount(remap_dec_ch_mask);
+ skip_bits_long(&s->gb, num_dec_ch * 5); // remap codes
+ }
+ }
+
+ } else {
+ skip_bits(&s->gb, 3); // representation type
+ }
+ }
+
+ drc_code_present = get_bits1(&s->gb);
+ if (drc_code_present)
+ get_bits(&s->gb, 8); // drc code
+
+ if (get_bits1(&s->gb))
+ skip_bits(&s->gb, 5); // dialog normalization code
+
+ if (drc_code_present && embedded_stereo)
+ get_bits(&s->gb, 8); // drc stereo code
+
+ if (s->mix_metadata && get_bits1(&s->gb)) {
+ skip_bits(&s->gb, 1); // external mix
+ skip_bits(&s->gb, 6); // post mix gain code
+
+ if (get_bits(&s->gb, 2) != 3) // mixer drc code
+ skip_bits(&s->gb, 3); // drc limit
+ else
+ skip_bits(&s->gb, 8); // custom drc code
+
+ if (get_bits1(&s->gb)) // channel specific scaling
+ for (i = 0; i < s->num_mix_configs; i++)
+ skip_bits_long(&s->gb, s->mix_config_num_ch[i] * 6); // scale codes
+ else
+ skip_bits_long(&s->gb, s->num_mix_configs * 6); // scale codes
+
+ for (i = 0; i < s->num_mix_configs; i++) {
+ if (get_bits_left(&s->gb) < 0)
+ return -1;
+ dca_exss_skip_mix_coeffs(&s->gb, channels, s->mix_config_num_ch[i]);
+ if (embedded_6ch)
+ dca_exss_skip_mix_coeffs(&s->gb, 6, s->mix_config_num_ch[i]);
+ if (embedded_stereo)
+ dca_exss_skip_mix_coeffs(&s->gb, 2, s->mix_config_num_ch[i]);
+ }
+ }
+
+ switch (get_bits(&s->gb, 2)) {
+ case 0: extensions_mask = get_bits(&s->gb, 12); break;
+ case 1: extensions_mask = DCA_EXT_EXSS_XLL; break;
+ case 2: extensions_mask = DCA_EXT_EXSS_LBR; break;
+ case 3: extensions_mask = 0; /* aux coding */ break;
+ }
+
+ /* not parsed further, we were only interested in the extensions mask */
+
+ if (get_bits_left(&s->gb) < 0)
+ return -1;
+
+ if (get_bits_count(&s->gb) - header_pos > header_size * 8) {
+ av_log(s->avctx, AV_LOG_WARNING, "Asset header size mismatch.\n");
+ return -1;
+ }
+ skip_bits_long(&s->gb, header_pos + header_size * 8 - get_bits_count(&s->gb));
+
+ if (extensions_mask & DCA_EXT_EXSS_XLL)
+ s->profile = FF_PROFILE_DTS_HD_MA;
+ else if (extensions_mask & (DCA_EXT_EXSS_XBR | DCA_EXT_EXSS_X96 |
+ DCA_EXT_EXSS_XXCH))
+ s->profile = FF_PROFILE_DTS_HD_HRA;
+
+ if (!(extensions_mask & DCA_EXT_CORE))
+ av_log(s->avctx, AV_LOG_WARNING, "DTS core detection mismatch.\n");
+ if ((extensions_mask & DCA_CORE_EXTS) != s->core_ext_mask)
+ av_log(s->avctx, AV_LOG_WARNING,
+ "DTS extensions detection mismatch (%d, %d)\n",
+ extensions_mask & DCA_CORE_EXTS, s->core_ext_mask);
+
+ return 0;
+}
+
+/**
+ * Parse extension substream header (HD)
+ */
+static void dca_exss_parse_header(DCAContext *s)
+{
+ int ss_index;
+ int blownup;
+ int num_audiop = 1;
+ int num_assets = 1;
+ int active_ss_mask[8];
+ int i, j;
+
+ if (get_bits_left(&s->gb) < 52)
+ return;
+
+ skip_bits(&s->gb, 8); // user data
+ ss_index = get_bits(&s->gb, 2);
+
+ blownup = get_bits1(&s->gb);
+ skip_bits(&s->gb, 8 + 4 * blownup); // header_size
+ skip_bits(&s->gb, 16 + 4 * blownup); // hd_size
+
+ s->static_fields = get_bits1(&s->gb);
+ if (s->static_fields) {
+ skip_bits(&s->gb, 2); // reference clock code
+ skip_bits(&s->gb, 3); // frame duration code
+
+ if (get_bits1(&s->gb))
+ skip_bits_long(&s->gb, 36); // timestamp
+
+ /* a single stream can contain multiple audio assets that can be
+ * combined to form multiple audio presentations */
+
+ num_audiop = get_bits(&s->gb, 3) + 1;
+ if (num_audiop > 1) {
+ av_log_ask_for_sample(s->avctx, "Multiple DTS-HD audio presentations.");
+ /* ignore such streams for now */
+ return;
+ }
+
+ num_assets = get_bits(&s->gb, 3) + 1;
+ if (num_assets > 1) {
+ av_log_ask_for_sample(s->avctx, "Multiple DTS-HD audio assets.");
+ /* ignore such streams for now */
+ return;
+ }
+
+ for (i = 0; i < num_audiop; i++)
+ active_ss_mask[i] = get_bits(&s->gb, ss_index + 1);
+
+ for (i = 0; i < num_audiop; i++)
+ for (j = 0; j <= ss_index; j++)
+ if (active_ss_mask[i] & (1 << j))
+ skip_bits(&s->gb, 8); // active asset mask
+
+ s->mix_metadata = get_bits1(&s->gb);
+ if (s->mix_metadata) {
+ int mix_out_mask_size;
+
+ skip_bits(&s->gb, 2); // adjustment level
+ mix_out_mask_size = (get_bits(&s->gb, 2) + 1) << 2;
+ s->num_mix_configs = get_bits(&s->gb, 2) + 1;
+
+ for (i = 0; i < s->num_mix_configs; i++) {
+ int mix_out_mask = get_bits(&s->gb, mix_out_mask_size);
+ s->mix_config_num_ch[i] = dca_exss_mask2count(mix_out_mask);
+ }
+ }
+ }
+
+ for (i = 0; i < num_assets; i++)
+ skip_bits_long(&s->gb, 16 + 4 * blownup); // asset size
+
+ for (i = 0; i < num_assets; i++) {
+ if (dca_exss_parse_asset_header(s))
+ return;
+ }
+
+ /* not parsed further, we were only interested in the extensions mask
+ * from the asset header */
+}
+
+/**
+ * Main frame decoding function
+ * FIXME add arguments
+ */
+static int dca_decode_frame(AVCodecContext *avctx, void *data,
+ int *got_frame_ptr, AVPacket *avpkt)
+{
+ const uint8_t *buf = avpkt->data;
+ int buf_size = avpkt->size;
+
+ int lfe_samples;
+ int num_core_channels = 0;
+ int i, ret;
+ float **samples_flt;
+ DCAContext *s = avctx->priv_data;
+ int channels, full_channels;
+ int core_ss_end;
+
+
+ s->xch_present = 0;
+
+ s->dca_buffer_size = ff_dca_convert_bitstream(buf, buf_size, s->dca_buffer,
+ DCA_MAX_FRAME_SIZE + DCA_MAX_EXSS_HEADER_SIZE);
+ if (s->dca_buffer_size == AVERROR_INVALIDDATA) {
+ av_log(avctx, AV_LOG_ERROR, "Not a valid DCA frame\n");
+ return AVERROR_INVALIDDATA;
+ }
+
+ init_get_bits(&s->gb, s->dca_buffer, s->dca_buffer_size * 8);
+ if ((ret = dca_parse_frame_header(s)) < 0) {
+ //seems like the frame is corrupt, try with the next one
+ return ret;
+ }
+ //set AVCodec values with parsed data
+ avctx->sample_rate = s->sample_rate;
+ avctx->bit_rate = s->bit_rate;
+
+ s->profile = FF_PROFILE_DTS;
+
+ for (i = 0; i < (s->sample_blocks / 8); i++) {
+ if ((ret = dca_decode_block(s, 0, i))) {
+ av_log(avctx, AV_LOG_ERROR, "error decoding block\n");
+ return ret;
+ }
+ }
+
+ /* record number of core channels incase less than max channels are requested */
+ num_core_channels = s->prim_channels;
+
+ if (s->ext_coding)
+ s->core_ext_mask = dca_ext_audio_descr_mask[s->ext_descr];
+ else
+ s->core_ext_mask = 0;
+
+ core_ss_end = FFMIN(s->frame_size, s->dca_buffer_size) * 8;
+
+ /* only scan for extensions if ext_descr was unknown or indicated a
+ * supported XCh extension */
+ if (s->core_ext_mask < 0 || s->core_ext_mask & DCA_EXT_XCH) {
+
+ /* if ext_descr was unknown, clear s->core_ext_mask so that the
+ * extensions scan can fill it up */
+ s->core_ext_mask = FFMAX(s->core_ext_mask, 0);
+
+ /* extensions start at 32-bit boundaries into bitstream */
+ skip_bits_long(&s->gb, (-get_bits_count(&s->gb)) & 31);
+
+ while (core_ss_end - get_bits_count(&s->gb) >= 32) {
+ uint32_t bits = get_bits_long(&s->gb, 32);
+
+ switch (bits) {
+ case 0x5a5a5a5a: {
+ int ext_amode, xch_fsize;
+
+ s->xch_base_channel = s->prim_channels;
+
+ /* validate sync word using XCHFSIZE field */
+ xch_fsize = show_bits(&s->gb, 10);
+ if ((s->frame_size != (get_bits_count(&s->gb) >> 3) - 4 + xch_fsize) &&
+ (s->frame_size != (get_bits_count(&s->gb) >> 3) - 4 + xch_fsize + 1))
+ continue;
+
+ /* skip length-to-end-of-frame field for the moment */
+ skip_bits(&s->gb, 10);
+
+ s->core_ext_mask |= DCA_EXT_XCH;
+
+ /* extension amode(number of channels in extension) should be 1 */
+ /* AFAIK XCh is not used for more channels */
+ if ((ext_amode = get_bits(&s->gb, 4)) != 1) {
+ av_log(avctx, AV_LOG_ERROR, "XCh extension amode %d not"
+ " supported!\n", ext_amode);
+ continue;
+ }
+
+ /* much like core primary audio coding header */
+ dca_parse_audio_coding_header(s, s->xch_base_channel);
+
+ for (i = 0; i < (s->sample_blocks / 8); i++)
+ if ((ret = dca_decode_block(s, s->xch_base_channel, i))) {
+ av_log(avctx, AV_LOG_ERROR, "error decoding XCh extension\n");
+ continue;
+ }
+
+ s->xch_present = 1;
+ break;
+ }
+ case 0x47004a03:
+ /* XXCh: extended channels */
+ /* usually found either in core or HD part in DTS-HD HRA streams,
+ * but not in DTS-ES which contains XCh extensions instead */
+ s->core_ext_mask |= DCA_EXT_XXCH;
+ break;
+
+ case 0x1d95f262: {
+ int fsize96 = show_bits(&s->gb, 12) + 1;
+ if (s->frame_size != (get_bits_count(&s->gb) >> 3) - 4 + fsize96)
+ continue;
+
+ av_log(avctx, AV_LOG_DEBUG, "X96 extension found at %d bits\n",
+ get_bits_count(&s->gb));
+ skip_bits(&s->gb, 12);
+ av_log(avctx, AV_LOG_DEBUG, "FSIZE96 = %d bytes\n", fsize96);
+ av_log(avctx, AV_LOG_DEBUG, "REVNO = %d\n", get_bits(&s->gb, 4));
+
+ s->core_ext_mask |= DCA_EXT_X96;
+ break;
+ }
+ }
+
+ skip_bits_long(&s->gb, (-get_bits_count(&s->gb)) & 31);
+ }
+ } else {
+ /* no supported extensions, skip the rest of the core substream */
+ skip_bits_long(&s->gb, core_ss_end - get_bits_count(&s->gb));
+ }
+
+ if (s->core_ext_mask & DCA_EXT_X96)
+ s->profile = FF_PROFILE_DTS_96_24;
+ else if (s->core_ext_mask & (DCA_EXT_XCH | DCA_EXT_XXCH))
+ s->profile = FF_PROFILE_DTS_ES;
+
+ /* check for ExSS (HD part) */
+ if (s->dca_buffer_size - s->frame_size > 32 &&
+ get_bits_long(&s->gb, 32) == DCA_HD_MARKER)
+ dca_exss_parse_header(s);
+
+ avctx->profile = s->profile;
+
+ full_channels = channels = s->prim_channels + !!s->lfe;
+
+ if (s->amode < 16) {
+ avctx->channel_layout = dca_core_channel_layout[s->amode];
+
+ if (s->xch_present && (!avctx->request_channels ||
+ avctx->request_channels > num_core_channels + !!s->lfe)) {
+ avctx->channel_layout |= AV_CH_BACK_CENTER;
+ if (s->lfe) {
+ avctx->channel_layout |= AV_CH_LOW_FREQUENCY;
+ s->channel_order_tab = dca_channel_reorder_lfe_xch[s->amode];
+ } else {
+ s->channel_order_tab = dca_channel_reorder_nolfe_xch[s->amode];
+ }
+ } else {
+ channels = num_core_channels + !!s->lfe;
+ s->xch_present = 0; /* disable further xch processing */
+ if (s->lfe) {
+ avctx->channel_layout |= AV_CH_LOW_FREQUENCY;
+ s->channel_order_tab = dca_channel_reorder_lfe[s->amode];
+ } else
+ s->channel_order_tab = dca_channel_reorder_nolfe[s->amode];
+ }
+
+ if (channels > !!s->lfe &&
+ s->channel_order_tab[channels - 1 - !!s->lfe] < 0)
+ return AVERROR_INVALIDDATA;
+
+ if (avctx->request_channels == 2 && s->prim_channels > 2) {
+ channels = 2;
+ s->output = DCA_STEREO;
+ avctx->channel_layout = AV_CH_LAYOUT_STEREO;
+ }
+ } else {
+ av_log(avctx, AV_LOG_ERROR, "Non standard configuration %d !\n", s->amode);
+ return AVERROR_INVALIDDATA;
+ }
+ avctx->channels = channels;
+
+ /* get output buffer */
+ s->frame.nb_samples = 256 * (s->sample_blocks / 8);
+ if ((ret = ff_get_buffer(avctx, &s->frame)) < 0) {
+ av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
+ return ret;
+ }
+ samples_flt = (float **) s->frame.extended_data;
+
+ /* allocate buffer for extra channels if downmixing */
+ if (avctx->channels < full_channels) {
+ ret = av_samples_get_buffer_size(NULL, full_channels - channels,
+ s->frame.nb_samples,
+ avctx->sample_fmt, 0);
+ if (ret < 0)
+ return ret;
+
+ av_fast_malloc(&s->extra_channels_buffer,
+ &s->extra_channels_buffer_size, ret);
+ if (!s->extra_channels_buffer)
+ return AVERROR(ENOMEM);
+
+ ret = av_samples_fill_arrays((uint8_t **)s->extra_channels, NULL,
+ s->extra_channels_buffer,
+ full_channels - channels,
+ s->frame.nb_samples, avctx->sample_fmt, 0);
+ if (ret < 0)
+ return ret;
+ }
+
+ /* filter to get final output */
+ for (i = 0; i < (s->sample_blocks / 8); i++) {
+ int ch;
+
+ for (ch = 0; ch < channels; ch++)
+ s->samples_chanptr[ch] = samples_flt[ch] + i * 256;
+ for (; ch < full_channels; ch++)
+ s->samples_chanptr[ch] = s->extra_channels[ch - channels] + i * 256;
+
+ dca_filter_channels(s, i);
+
+ /* If this was marked as a DTS-ES stream we need to subtract back- */
+ /* channel from SL & SR to remove matrixed back-channel signal */
+ if ((s->source_pcm_res & 1) && s->xch_present) {
+ float *back_chan = s->samples_chanptr[s->channel_order_tab[s->xch_base_channel]];
+ float *lt_chan = s->samples_chanptr[s->channel_order_tab[s->xch_base_channel - 2]];
+ float *rt_chan = s->samples_chanptr[s->channel_order_tab[s->xch_base_channel - 1]];
+ s->fdsp.vector_fmac_scalar(lt_chan, back_chan, -M_SQRT1_2, 256);
+ s->fdsp.vector_fmac_scalar(rt_chan, back_chan, -M_SQRT1_2, 256);
+ }
+ }
+
+ /* update lfe history */
+ lfe_samples = 2 * s->lfe * (s->sample_blocks / 8);
+ for (i = 0; i < 2 * s->lfe * 4; i++)
+ s->lfe_data[i] = s->lfe_data[i + lfe_samples];
+
+ *got_frame_ptr = 1;
+ *(AVFrame *) data = s->frame;
+
+ return buf_size;
+}
+
+
+
+/**
+ * DCA initialization
+ *
+ * @param avctx pointer to the AVCodecContext
+ */
+
+static av_cold int dca_decode_init(AVCodecContext *avctx)
+{
+ DCAContext *s = avctx->priv_data;
+
+ s->avctx = avctx;
+ dca_init_vlcs();
+
+ avpriv_float_dsp_init(&s->fdsp, avctx->flags & CODEC_FLAG_BITEXACT);
+ ff_mdct_init(&s->imdct, 6, 1, 1.0);
+ ff_synth_filter_init(&s->synth);
+ ff_dcadsp_init(&s->dcadsp);
+ ff_fmt_convert_init(&s->fmt_conv, avctx);
+
+ avctx->sample_fmt = AV_SAMPLE_FMT_FLTP;
+
+ /* allow downmixing to stereo */
+ if (avctx->channels > 0 && avctx->request_channels < avctx->channels &&
+ avctx->request_channels == 2) {
+ avctx->channels = avctx->request_channels;
+ }
+
+ avcodec_get_frame_defaults(&s->frame);
+ avctx->coded_frame = &s->frame;
+
+ return 0;
+}
+
+static av_cold int dca_decode_end(AVCodecContext *avctx)
+{
+ DCAContext *s = avctx->priv_data;
+ ff_mdct_end(&s->imdct);
+ av_freep(&s->extra_channels_buffer);
+ return 0;
+}
+
+static const AVProfile profiles[] = {
+ { FF_PROFILE_DTS, "DTS" },
+ { FF_PROFILE_DTS_ES, "DTS-ES" },
+ { FF_PROFILE_DTS_96_24, "DTS 96/24" },
+ { FF_PROFILE_DTS_HD_HRA, "DTS-HD HRA" },
+ { FF_PROFILE_DTS_HD_MA, "DTS-HD MA" },
+ { FF_PROFILE_UNKNOWN },
+};
+
+AVCodec ff_dca_decoder = {
+ .name = "dca",
+ .type = AVMEDIA_TYPE_AUDIO,
+ .id = AV_CODEC_ID_DTS,
+ .priv_data_size = sizeof(DCAContext),
+ .init = dca_decode_init,
+ .decode = dca_decode_frame,
+ .close = dca_decode_end,
+ .long_name = NULL_IF_CONFIG_SMALL("DCA (DTS Coherent Acoustics)"),
+ .capabilities = CODEC_CAP_CHANNEL_CONF | CODEC_CAP_DR1,
+ .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP,
+ AV_SAMPLE_FMT_NONE },
+ .profiles = NULL_IF_CONFIG_SMALL(profiles),
+};
diff --git a/gst-libs/ext/libav/libavcodec/dct-test.c b/gst-libs/ext/libav/libavcodec/dct-test.c
index daa95bd..3ce0270 100644
--- a/gst-libs/ext/libav/libavcodec/dct-test.c
+++ b/gst-libs/ext/libav/libavcodec/dct-test.c
@@ -25,16 +25,19 @@
* Started from sample code by Juan J. Sierralta P.
*/
+#include "config.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#include <sys/time.h>
+#if HAVE_UNISTD_H
#include <unistd.h>
+#endif
#include <math.h>
#include "libavutil/cpu.h"
#include "libavutil/common.h"
#include "libavutil/lfg.h"
+#include "libavutil/time.h"
#include "simple_idct.h"
#include "aandcttab.h"
@@ -45,18 +48,12 @@
#undef printf
-void ff_mmx_idct(DCTELEM *data);
-void ff_mmxext_idct(DCTELEM *data);
-
-void odivx_idct_c(short *block);
-
// BFIN
void ff_bfin_idct(DCTELEM *block);
void ff_bfin_fdct(DCTELEM *block);
// ALTIVEC
-void fdct_altivec(DCTELEM *block);
-//void idct_altivec(DCTELEM *block);?? no routine
+void ff_fdct_altivec(DCTELEM *block);
// ARM
void ff_j_rev_dct_arm(DCTELEM *data);
@@ -76,28 +73,22 @@ struct algo {
int nonspec;
};
-#ifndef FAAN_POSTSCALE
-#define FAAN_SCALE SCALE_PERM
-#else
-#define FAAN_SCALE NO_PERM
-#endif
-
static int cpu_flags;
static const struct algo fdct_tab[] = {
{ "REF-DBL", ff_ref_fdct, NO_PERM },
- { "FAAN", ff_faandct, FAAN_SCALE },
- { "IJG-AAN-INT", fdct_ifast, SCALE_PERM },
+ { "FAAN", ff_faandct, NO_PERM },
+ { "IJG-AAN-INT", ff_fdct_ifast, SCALE_PERM },
{ "IJG-LLM-INT", ff_jpeg_fdct_islow_8, NO_PERM },
-#if HAVE_MMX
+#if HAVE_MMX_INLINE
{ "MMX", ff_fdct_mmx, NO_PERM, AV_CPU_FLAG_MMX },
- { "MMX2", ff_fdct_mmx2, NO_PERM, AV_CPU_FLAG_MMX2 },
+ { "MMXEXT", ff_fdct_mmxext, NO_PERM, AV_CPU_FLAG_MMXEXT },
{ "SSE2", ff_fdct_sse2, NO_PERM, AV_CPU_FLAG_SSE2 },
#endif
#if HAVE_ALTIVEC
- { "altivecfdct", fdct_altivec, NO_PERM, AV_CPU_FLAG_ALTIVEC },
+ { "altivecfdct", ff_fdct_altivec, NO_PERM, AV_CPU_FLAG_ALTIVEC },
#endif
#if ARCH_BFIN
@@ -110,17 +101,13 @@ static const struct algo fdct_tab[] = {
static const struct algo idct_tab[] = {
{ "FAANI", ff_faanidct, NO_PERM },
{ "REF-DBL", ff_ref_idct, NO_PERM },
- { "INT", j_rev_dct, MMX_PERM },
+ { "INT", ff_j_rev_dct, MMX_PERM },
{ "SIMPLE-C", ff_simple_idct_8, NO_PERM },
-#if HAVE_MMX
-#if CONFIG_GPL
- { "LIBMPEG2-MMX", ff_mmx_idct, MMX_PERM, AV_CPU_FLAG_MMX, 1 },
- { "LIBMPEG2-MMX2", ff_mmxext_idct, MMX_PERM, AV_CPU_FLAG_MMX2, 1 },
-#endif
+#if HAVE_MMX_INLINE
{ "SIMPLE-MMX", ff_simple_idct_mmx, MMX_SIMPLE_PERM, AV_CPU_FLAG_MMX },
{ "XVID-MMX", ff_idct_xvid_mmx, NO_PERM, AV_CPU_FLAG_MMX, 1 },
- { "XVID-MMX2", ff_idct_xvid_mmx2, NO_PERM, AV_CPU_FLAG_MMX2, 1 },
+ { "XVID-MMXEXT", ff_idct_xvid_mmxext, NO_PERM, AV_CPU_FLAG_MMXEXT, 1 },
{ "XVID-SSE2", ff_idct_xvid_sse2, SSE2_PERM, AV_CPU_FLAG_SSE2, 1 },
#endif
@@ -133,13 +120,13 @@ static const struct algo idct_tab[] = {
{ "INT-ARM", ff_j_rev_dct_arm, MMX_PERM },
#endif
#if HAVE_ARMV5TE
- { "SIMPLE-ARMV5TE", ff_simple_idct_armv5te,NO_PERM },
+ { "SIMPLE-ARMV5TE", ff_simple_idct_armv5te,NO_PERM, AV_CPU_FLAG_ARMV5TE },
#endif
#if HAVE_ARMV6
- { "SIMPLE-ARMV6", ff_simple_idct_armv6, MMX_PERM },
+ { "SIMPLE-ARMV6", ff_simple_idct_armv6, MMX_PERM, AV_CPU_FLAG_ARMV6 },
#endif
#if HAVE_NEON
- { "SIMPLE-NEON", ff_simple_idct_neon, PARTTRANS_PERM },
+ { "SIMPLE-NEON", ff_simple_idct_neon, PARTTRANS_PERM, AV_CPU_FLAG_NEON },
#endif
#if ARCH_ALPHA
@@ -151,13 +138,6 @@ static const struct algo idct_tab[] = {
#define AANSCALE_BITS 12
-static int64_t gettime(void)
-{
- struct timeval tv;
- gettimeofday(&tv, NULL);
- return (int64_t)tv.tv_sec * 1000000 + tv.tv_usec;
-}
-
#define NB_ITS 20000
#define NB_ITS_SPEED 50000
@@ -189,14 +169,6 @@ static void idct_mmx_init(void)
DECLARE_ALIGNED(16, static DCTELEM, block)[64];
DECLARE_ALIGNED(8, static DCTELEM, block1)[64];
-static inline void mmx_emms(void)
-{
-#if HAVE_MMX
- if (cpu_flags & AV_CPU_FLAG_MMX)
- __asm__ volatile ("emms\n\t");
-#endif
-}
-
static void init_block(DCTELEM block[64], int test, int is_idct, AVLFG *prng)
{
int i, j;
@@ -271,7 +243,7 @@ static int dct_error(const struct algo *dct, int test, int is_idct, int speed)
permute(block, block1, dct->format);
dct->func(block);
- mmx_emms();
+ emms_c();
if (dct->format == SCALE_PERM) {
for (i = 0; i < 64; i++) {
@@ -328,7 +300,7 @@ static int dct_error(const struct algo *dct, int test, int is_idct, int speed)
init_block(block, test, is_idct, &prng);
permute(block1, block, dct->format);
- ti = gettime();
+ ti = av_gettime();
it1 = 0;
do {
for (it = 0; it < NB_ITS_SPEED; it++) {
@@ -336,9 +308,9 @@ static int dct_error(const struct algo *dct, int test, int is_idct, int speed)
dct->func(block);
}
it1 += NB_ITS_SPEED;
- ti1 = gettime() - ti;
+ ti1 = av_gettime() - ti;
} while (ti1 < 1000000);
- mmx_emms();
+ emms_c();
printf("%s %s: %0.1f kdct/s\n", is_idct ? "IDCT" : "DCT", dct->name,
(double) it1 * 1000.0 / (double) ti1);
@@ -469,7 +441,7 @@ static void idct248_error(const char *name,
if (!speed)
return;
- ti = gettime();
+ ti = av_gettime();
it1 = 0;
do {
for (it = 0; it < NB_ITS_SPEED; it++) {
@@ -478,9 +450,9 @@ static void idct248_error(const char *name,
idct248_put(img_dest, 8, block);
}
it1 += NB_ITS_SPEED;
- ti1 = gettime() - ti;
+ ti1 = av_gettime() - ti;
} while (ti1 < 1000000);
- mmx_emms();
+ emms_c();
printf("%s %s: %0.1f kdct/s\n", 1 ? "IDCT248" : "DCT248", name,
(double) it1 * 1000.0 / (double) ti1);
@@ -497,6 +469,10 @@ static void help(void)
"-t speed test\n");
}
+#if !HAVE_GETOPT
+#include "compat/getopt.c"
+#endif
+
int main(int argc, char **argv)
{
int test_idct = 0, test_248_dct = 0;
diff --git a/gst-libs/ext/libav/libavcodec/dct.c b/gst-libs/ext/libav/libavcodec/dct.c
index e65671e..0128c7d 100644
--- a/gst-libs/ext/libav/libavcodec/dct.c
+++ b/gst-libs/ext/libav/libavcodec/dct.c
@@ -28,6 +28,7 @@
*/
#include <math.h>
+#include <string.h>
#include "libavutil/mathematics.h"
#include "dct.h"
@@ -208,8 +209,8 @@ av_cold int ff_dct_init(DCTContext *s, int nbits, enum DCTTransformType inverse)
}
s->dct32 = ff_dct32_float;
- if (HAVE_MMX)
- ff_dct_init_mmx(s);
+ if (ARCH_X86)
+ ff_dct_init_x86(s);
return 0;
}
diff --git a/gst-libs/ext/libav/libavcodec/dct.h b/gst-libs/ext/libav/libavcodec/dct.h
index c898856..905cc01 100644
--- a/gst-libs/ext/libav/libavcodec/dct.h
+++ b/gst-libs/ext/libav/libavcodec/dct.h
@@ -47,6 +47,6 @@ struct DCTContext {
int ff_dct_init(DCTContext *s, int nbits, enum DCTTransformType type);
void ff_dct_end (DCTContext *s);
-void ff_dct_init_mmx(DCTContext *s);
+void ff_dct_init_x86(DCTContext *s);
#endif /* AVCODEC_DCT_H */
diff --git a/gst-libs/ext/libav/libavcodec/dfa.c b/gst-libs/ext/libav/libavcodec/dfa.c
index 0ae89a8..332a53e 100644
--- a/gst-libs/ext/libav/libavcodec/dfa.c
+++ b/gst-libs/ext/libav/libavcodec/dfa.c
@@ -22,9 +22,10 @@
#include "avcodec.h"
#include "bytestream.h"
+#include "internal.h"
#include "libavutil/imgutils.h"
-#include "libavutil/lzo.h" // for av_memcpy_backptr
+#include "libavutil/mem.h"
typedef struct DfaContext {
AVFrame pic;
@@ -38,12 +39,12 @@ static av_cold int dfa_decode_init(AVCodecContext *avctx)
DfaContext *s = avctx->priv_data;
int ret;
- avctx->pix_fmt = PIX_FMT_PAL8;
+ avctx->pix_fmt = AV_PIX_FMT_PAL8;
if ((ret = av_image_check_size(avctx->width, avctx->height, 0, avctx)) < 0)
return ret;
- s->frame_buf = av_mallocz(avctx->width * avctx->height + AV_LZO_OUTPUT_PADDING);
+ s->frame_buf = av_mallocz(avctx->width * avctx->height);
if (!s->frame_buf)
return AVERROR(ENOMEM);
@@ -122,9 +123,7 @@ static int decode_dsw1(GetByteContext *gb, uint8_t *frame, int width, int height
count = ((v >> 13) + 2) << 1;
if (frame - frame_start < offset || frame_end - frame < count)
return AVERROR_INVALIDDATA;
- // can't use av_memcpy_backptr() since it can overwrite following pixels
- for (v = 0; v < count; v++)
- frame[v] = frame[v - offset];
+ av_memcpy_backptr(frame, offset, count);
frame += count;
} else if (bitbuf & (mask << 1)) {
frame += bytestream2_get_le16(gb);
@@ -311,7 +310,7 @@ static const char* chunk_name[8] = {
};
static int dfa_decode_frame(AVCodecContext *avctx,
- void *data, int *data_size,
+ void *data, int *got_frame,
AVPacket *avpkt)
{
DfaContext *s = avctx->priv_data;
@@ -325,7 +324,7 @@ static int dfa_decode_frame(AVCodecContext *avctx,
if (s->pic.data[0])
avctx->release_buffer(avctx, &s->pic);
- if ((ret = avctx->get_buffer(avctx, &s->pic))) {
+ if ((ret = ff_get_buffer(avctx, &s->pic))) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return ret;
}
@@ -366,7 +365,7 @@ static int dfa_decode_frame(AVCodecContext *avctx,
}
memcpy(s->pic.data[1], s->pal, sizeof(s->pal));
- *data_size = sizeof(AVFrame);
+ *got_frame = 1;
*(AVFrame*)data = s->pic;
return avpkt->size;
@@ -387,11 +386,11 @@ static av_cold int dfa_decode_end(AVCodecContext *avctx)
AVCodec ff_dfa_decoder = {
.name = "dfa",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_DFA,
+ .id = AV_CODEC_ID_DFA,
.priv_data_size = sizeof(DfaContext),
.init = dfa_decode_init,
.close = dfa_decode_end,
.decode = dfa_decode_frame,
.capabilities = CODEC_CAP_DR1,
- .long_name = NULL_IF_CONFIG_SMALL("Chronomaster DFA"),
+ .long_name = NULL_IF_CONFIG_SMALL("Chronomaster DFA"),
};
diff --git a/gst-libs/ext/libav/libavcodec/dirac.c b/gst-libs/ext/libav/libavcodec/dirac.c
index bf56088..e11fea7 100644
--- a/gst-libs/ext/libav/libavcodec/dirac.c
+++ b/gst-libs/ext/libav/libavcodec/dirac.c
@@ -58,6 +58,7 @@ static const dirac_source_params dirac_source_parameters_defaults[] = {
{ 7680, 4320, 1, 0, 1, 6, 1, 3840, 2160, 0, 0, 3, 3 },
};
+/* [DIRAC_STD] Table 10.4 - Available preset pixel aspect ratio values */
static const AVRational dirac_preset_aspect_ratios[] = {
{1, 1},
{10, 11},
@@ -67,11 +68,16 @@ static const AVRational dirac_preset_aspect_ratios[] = {
{4, 3},
};
+/* [DIRAC_STD] Values 9,10 of 10.3.5 Frame Rate.
+ * Table 10.3 Available preset frame rate values
+ */
static const AVRational dirac_frame_rate[] = {
{15000, 1001},
{25, 2},
};
+/* [DIRAC_STD] This should be equivalent to Table 10.5 Available signal
+ * range presets */
static const struct {
uint8_t bitdepth;
enum AVColorRange color_range;
@@ -100,98 +106,126 @@ static const struct {
{ AVCOL_PRI_BT709, AVCOL_SPC_BT709, AVCOL_TRC_UNSPECIFIED /* DCinema */ },
};
-static const enum PixelFormat dirac_pix_fmt[2][3] = {
- { PIX_FMT_YUV444P, PIX_FMT_YUV422P, PIX_FMT_YUV420P },
- { PIX_FMT_YUVJ444P, PIX_FMT_YUVJ422P, PIX_FMT_YUVJ420P },
+/* [DIRAC_STD] Table 10.2 Supported chroma sampling formats + luma Offset */
+static const enum AVPixelFormat dirac_pix_fmt[2][3] = {
+ { AV_PIX_FMT_YUV444P, AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUV420P },
+ { AV_PIX_FMT_YUVJ444P, AV_PIX_FMT_YUVJ422P, AV_PIX_FMT_YUVJ420P },
};
+/* [DIRAC_STD] 10.3 Parse Source Parameters.
+ * source_parameters(base_video_format) */
static int parse_source_parameters(AVCodecContext *avctx, GetBitContext *gb,
dirac_source_params *source)
{
- AVRational frame_rate = (AVRational){0,0};
+ AVRational frame_rate = {0,0};
unsigned luma_depth = 8, luma_offset = 16;
int idx;
+ /* [DIRAC_STD] 10.3.2 Frame size. frame_size(video_params) */
+ /* [DIRAC_STD] custom_dimensions_flag */
if (get_bits1(gb)) {
- source->width = svq3_get_ue_golomb(gb);
- source->height = svq3_get_ue_golomb(gb);
+ source->width = svq3_get_ue_golomb(gb); /* [DIRAC_STD] FRAME_WIDTH */
+ source->height = svq3_get_ue_golomb(gb); /* [DIRAC_STD] FRAME_HEIGHT */
}
- // chroma subsampling
+ /* [DIRAC_STD] 10.3.3 Chroma Sampling Format.
+ * chroma_sampling_format(video_params) */
+ /* [DIRAC_STD] custom_chroma_format_flag */
if (get_bits1(gb))
+ /* [DIRAC_STD] CHROMA_FORMAT_INDEX */
source->chroma_format = svq3_get_ue_golomb(gb);
if (source->chroma_format > 2) {
av_log(avctx, AV_LOG_ERROR, "Unknown chroma format %d\n",
source->chroma_format);
- return -1;
+ return AVERROR_INVALIDDATA;
}
+ /* [DIRAC_STD] 10.3.4 Scan Format. scan_format(video_params) */
+ /* [DIRAC_STD] custom_scan_format_flag */
if (get_bits1(gb))
+ /* [DIRAC_STD] SOURCE_SAMPLING */
source->interlaced = svq3_get_ue_golomb(gb);
if (source->interlaced > 1)
- return -1;
+ return AVERROR_INVALIDDATA;
- // frame rate
- if (get_bits1(gb)) {
+ /* [DIRAC_STD] 10.3.5 Frame Rate. frame_rate(video_params) */
+ if (get_bits1(gb)) { /* [DIRAC_STD] custom_frame_rate_flag */
source->frame_rate_index = svq3_get_ue_golomb(gb);
if (source->frame_rate_index > 10)
- return -1;
+ return AVERROR_INVALIDDATA;
if (!source->frame_rate_index) {
+ /* [DIRAC_STD] FRAME_RATE_NUMER */
frame_rate.num = svq3_get_ue_golomb(gb);
+ /* [DIRAC_STD] FRAME_RATE_DENOM */
frame_rate.den = svq3_get_ue_golomb(gb);
}
}
+ /* [DIRAC_STD] preset_frame_rate(video_params, index) */
if (source->frame_rate_index > 0) {
if (source->frame_rate_index <= 8)
- frame_rate = avpriv_frame_rate_tab[source->frame_rate_index];
+ frame_rate = ff_mpeg12_frame_rate_tab[source->frame_rate_index];
else
+ /* [DIRAC_STD] Table 10.3 values 9-10 */
frame_rate = dirac_frame_rate[source->frame_rate_index-9];
}
av_reduce(&avctx->time_base.num, &avctx->time_base.den,
frame_rate.den, frame_rate.num, 1<<30);
- // aspect ratio
- if (get_bits1(gb)) {
+ /* [DIRAC_STD] 10.3.6 Pixel Aspect Ratio.
+ * pixel_aspect_ratio(video_params) */
+ if (get_bits1(gb)) { /* [DIRAC_STD] custom_pixel_aspect_ratio_flag */
+ /* [DIRAC_STD] index */
source->aspect_ratio_index = svq3_get_ue_golomb(gb);
if (source->aspect_ratio_index > 6)
- return -1;
+ return AVERROR_INVALIDDATA;
if (!source->aspect_ratio_index) {
avctx->sample_aspect_ratio.num = svq3_get_ue_golomb(gb);
avctx->sample_aspect_ratio.den = svq3_get_ue_golomb(gb);
}
}
+ /* [DIRAC_STD] Take value from Table 10.4 Available preset pixel
+ * aspect ratio values */
if (source->aspect_ratio_index > 0)
avctx->sample_aspect_ratio =
dirac_preset_aspect_ratios[source->aspect_ratio_index-1];
- if (get_bits1(gb)) {
+ /* [DIRAC_STD] 10.3.7 Clean area. clean_area(video_params) */
+ if (get_bits1(gb)) { /* [DIRAC_STD] custom_clean_area_flag */
+ /* [DIRAC_STD] CLEAN_WIDTH */
source->clean_width = svq3_get_ue_golomb(gb);
+ /* [DIRAC_STD] CLEAN_HEIGHT */
source->clean_height = svq3_get_ue_golomb(gb);
+ /* [DIRAC_STD] CLEAN_LEFT_OFFSET */
source->clean_left_offset = svq3_get_ue_golomb(gb);
+ /* [DIRAC_STD] CLEAN_RIGHT_OFFSET */
source->clean_right_offset = svq3_get_ue_golomb(gb);
}
- // Override signal range.
- if (get_bits1(gb)) {
+ /* [DIRAC_STD] 10.3.8 Signal range. signal_range(video_params)
+ * WARNING: Some adaptation seems to be done using the
+ * AVCOL_RANGE_MPEG/JPEG values */
+ if (get_bits1(gb)) { /* [DIRAC_STD] custom_signal_range_flag */
+ /* [DIRAC_STD] index */
source->pixel_range_index = svq3_get_ue_golomb(gb);
if (source->pixel_range_index > 4)
- return -1;
+ return AVERROR_INVALIDDATA;
// This assumes either fullrange or MPEG levels only
if (!source->pixel_range_index) {
luma_offset = svq3_get_ue_golomb(gb);
luma_depth = av_log2(svq3_get_ue_golomb(gb))+1;
- svq3_get_ue_golomb(gb); // chroma offset
- svq3_get_ue_golomb(gb); // chroma excursion
-
+ svq3_get_ue_golomb(gb); /* chroma offset */
+ svq3_get_ue_golomb(gb); /* chroma excursion */
avctx->color_range = luma_offset ? AVCOL_RANGE_MPEG : AVCOL_RANGE_JPEG;
}
}
+ /* [DIRAC_STD] Table 10.5
+ * Available signal range presets <--> pixel_range_presets */
if (source->pixel_range_index > 0) {
idx = source->pixel_range_index-1;
luma_depth = pixel_range_presets[idx].bitdepth;
@@ -203,24 +237,26 @@ static int parse_source_parameters(AVCodecContext *avctx, GetBitContext *gb,
avctx->pix_fmt = dirac_pix_fmt[!luma_offset][source->chroma_format];
- // color spec
- if (get_bits1(gb)) {
+ /* [DIRAC_STD] 10.3.9 Colour specification. colour_spec(video_params) */
+ if (get_bits1(gb)) { /* [DIRAC_STD] custom_colour_spec_flag */
+ /* [DIRAC_STD] index */
idx = source->color_spec_index = svq3_get_ue_golomb(gb);
if (source->color_spec_index > 4)
- return -1;
+ return AVERROR_INVALIDDATA;
avctx->color_primaries = dirac_color_presets[idx].color_primaries;
avctx->colorspace = dirac_color_presets[idx].colorspace;
avctx->color_trc = dirac_color_presets[idx].color_trc;
if (!source->color_spec_index) {
+ /* [DIRAC_STD] 10.3.9.1 Colour primaries */
if (get_bits1(gb)) {
idx = svq3_get_ue_golomb(gb);
if (idx < 3)
avctx->color_primaries = dirac_primaries[idx];
}
-
+ /* [DIRAC_STD] 10.3.9.2 Colour matrix */
if (get_bits1(gb)) {
idx = svq3_get_ue_golomb(gb);
if (!idx)
@@ -228,7 +264,7 @@ static int parse_source_parameters(AVCodecContext *avctx, GetBitContext *gb,
else if (idx == 1)
avctx->colorspace = AVCOL_SPC_BT470BG;
}
-
+ /* [DIRAC_STD] 10.3.9.3 Transfer function */
if (get_bits1(gb) && !svq3_get_ue_golomb(gb))
avctx->color_trc = AVCOL_TRC_BT709;
}
@@ -242,16 +278,21 @@ static int parse_source_parameters(AVCodecContext *avctx, GetBitContext *gb,
return 0;
}
+/* [DIRAC_STD] 10. Sequence Header. sequence_header() */
int avpriv_dirac_parse_sequence_header(AVCodecContext *avctx, GetBitContext *gb,
dirac_source_params *source)
{
unsigned version_major;
unsigned video_format, picture_coding_mode;
+ int ret;
+ /* [DIRAC_SPEC] 10.1 Parse Parameters. parse_parameters() */
version_major = svq3_get_ue_golomb(gb);
svq3_get_ue_golomb(gb); /* version_minor */
avctx->profile = svq3_get_ue_golomb(gb);
avctx->level = svq3_get_ue_golomb(gb);
+ /* [DIRAC_SPEC] sequence_header() -> base_video_format as defined in
+ * 10.2 Base Video Format, table 10.1 Dirac predefined video formats */
video_format = svq3_get_ue_golomb(gb);
if (version_major < 2)
@@ -260,26 +301,28 @@ int avpriv_dirac_parse_sequence_header(AVCodecContext *avctx, GetBitContext *gb,
av_log(avctx, AV_LOG_WARNING, "Stream may have unhandled features\n");
if (video_format > 20)
- return -1;
+ return AVERROR_INVALIDDATA;
// Fill in defaults for the source parameters.
*source = dirac_source_parameters_defaults[video_format];
- // Override the defaults.
- if (parse_source_parameters(avctx, gb, source))
- return -1;
+ /* [DIRAC_STD] 10.3 Source Parameters
+ * Override the defaults. */
+ if (ret = parse_source_parameters(avctx, gb, source))
+ return ret;
- if (av_image_check_size(source->width, source->height, 0, avctx))
- return -1;
+ if (ret = av_image_check_size(source->width, source->height, 0, avctx))
+ return ret;
avcodec_set_dimensions(avctx, source->width, source->height);
- // currently only used to signal field coding
+ /* [DIRAC_STD] picture_coding_mode shall be 0 for fields and 1 for frames
+ * currently only used to signal field coding */
picture_coding_mode = svq3_get_ue_golomb(gb);
if (picture_coding_mode != 0) {
av_log(avctx, AV_LOG_ERROR, "Unsupported picture coding mode %d",
picture_coding_mode);
- return -1;
+ return AVERROR_INVALIDDATA;
}
return 0;
}
diff --git a/gst-libs/ext/libav/libavcodec/dirac.h b/gst-libs/ext/libav/libavcodec/dirac.h
index f8063d9..e5b79b0 100644
--- a/gst-libs/ext/libav/libavcodec/dirac.h
+++ b/gst-libs/ext/libav/libavcodec/dirac.h
@@ -31,7 +31,7 @@
#include "avcodec.h"
#include "get_bits.h"
-typedef struct {
+typedef struct dirac_source_params {
unsigned width;
unsigned height;
uint8_t chroma_format; ///< 0: 444 1: 422 2: 420
diff --git a/gst-libs/ext/libav/libavcodec/dirac_parser.c b/gst-libs/ext/libav/libavcodec/dirac_parser.c
index 11d0cf8..46f5430 100644
--- a/gst-libs/ext/libav/libavcodec/dirac_parser.c
+++ b/gst-libs/ext/libav/libavcodec/dirac_parser.c
@@ -27,7 +27,10 @@
* @author Marco Gerards <marco@gnu.org>
*/
+#include <string.h>
+
#include "libavutil/intreadwrite.h"
+#include "libavutil/mem.h"
#include "parser.h"
#define DIRAC_PARSE_INFO_PREFIX 0x42424344
@@ -248,7 +251,7 @@ static void dirac_parse_close(AVCodecParserContext *s)
}
AVCodecParser ff_dirac_parser = {
- .codec_ids = { CODEC_ID_DIRAC },
+ .codec_ids = { AV_CODEC_ID_DIRAC },
.priv_data_size = sizeof(DiracParseContext),
.parser_parse = dirac_parse,
.parser_close = dirac_parse_close,
diff --git a/gst-libs/ext/libav/libavcodec/dnxhd_parser.c b/gst-libs/ext/libav/libavcodec/dnxhd_parser.c
index 870fed4..d981079 100644
--- a/gst-libs/ext/libav/libavcodec/dnxhd_parser.c
+++ b/gst-libs/ext/libav/libavcodec/dnxhd_parser.c
@@ -87,7 +87,7 @@ static int dnxhd_parse(AVCodecParserContext *s,
}
AVCodecParser ff_dnxhd_parser = {
- .codec_ids = { CODEC_ID_DNXHD },
+ .codec_ids = { AV_CODEC_ID_DNXHD },
.priv_data_size = sizeof(ParseContext),
.parser_parse = dnxhd_parse,
.parser_close = ff_parse_close,
diff --git a/gst-libs/ext/libav/libavcodec/dnxhddata.c b/gst-libs/ext/libav/libavcodec/dnxhddata.c
index 576e85e..96895da 100644
--- a/gst-libs/ext/libav/libavcodec/dnxhddata.c
+++ b/gst-libs/ext/libav/libavcodec/dnxhddata.c
@@ -21,6 +21,7 @@
#include "avcodec.h"
#include "dnxhddata.h"
+#include "libavutil/common.h"
static const uint8_t dnxhd_1235_luma_weight[] = {
0, 32, 32, 32, 33, 35, 38, 39,
diff --git a/gst-libs/ext/libav/libavcodec/dnxhddata.h b/gst-libs/ext/libav/libavcodec/dnxhddata.h
index 74cf0b5..66b0349 100644
--- a/gst-libs/ext/libav/libavcodec/dnxhddata.h
+++ b/gst-libs/ext/libav/libavcodec/dnxhddata.h
@@ -25,7 +25,7 @@
#include <stdint.h>
#include "avcodec.h"
-typedef struct {
+typedef struct CIDEntry {
int cid;
unsigned int width, height;
int interlaced;
diff --git a/gst-libs/ext/libav/libavcodec/dnxhddec.c b/gst-libs/ext/libav/libavcodec/dnxhddec.c
index bf5acf3..7cc17c4 100644
--- a/gst-libs/ext/libav/libavcodec/dnxhddec.c
+++ b/gst-libs/ext/libav/libavcodec/dnxhddec.c
@@ -30,6 +30,7 @@
#include "get_bits.h"
#include "dnxhddata.h"
#include "dsputil.h"
+#include "internal.h"
typedef struct DNXHDContext {
AVCodecContext *avctx;
@@ -124,18 +125,18 @@ static int dnxhd_decode_header(DNXHDContext *ctx, const uint8_t *buf, int buf_si
av_dlog(ctx->avctx, "width %d, height %d\n", ctx->width, ctx->height);
if (buf[0x21] & 0x40) {
- ctx->avctx->pix_fmt = PIX_FMT_YUV422P10;
+ ctx->avctx->pix_fmt = AV_PIX_FMT_YUV422P10;
ctx->avctx->bits_per_raw_sample = 10;
if (ctx->bit_depth != 10) {
- dsputil_init(&ctx->dsp, ctx->avctx);
+ ff_dsputil_init(&ctx->dsp, ctx->avctx);
ctx->bit_depth = 10;
ctx->decode_dct_block = dnxhd_decode_dct_block_10;
}
} else {
- ctx->avctx->pix_fmt = PIX_FMT_YUV422P;
+ ctx->avctx->pix_fmt = AV_PIX_FMT_YUV422P;
ctx->avctx->bits_per_raw_sample = 8;
if (ctx->bit_depth != 8) {
- dsputil_init(&ctx->dsp, ctx->avctx);
+ ff_dsputil_init(&ctx->dsp, ctx->avctx);
ctx->bit_depth = 8;
ctx->decode_dct_block = dnxhd_decode_dct_block_8;
}
@@ -208,18 +209,14 @@ static av_always_inline void dnxhd_decode_dct_block(DNXHDContext *ctx,
ctx->last_dc[component] += level;
}
block[0] = ctx->last_dc[component];
- //av_log(ctx->avctx, AV_LOG_DEBUG, "dc %d\n", block[0]);
for (i = 1; ; i++) {
UPDATE_CACHE(bs, &ctx->gb);
GET_VLC(index1, bs, &ctx->gb, ctx->ac_vlc.table,
DNXHD_VLC_BITS, 2);
- //av_log(ctx->avctx, AV_LOG_DEBUG, "index %d\n", index1);
level = ctx->cid_table->ac_level[index1];
- if (!level) { /* EOB */
- //av_log(ctx->avctx, AV_LOG_DEBUG, "EOB\n");
+ if (!level) /* EOB */
break;
- }
sign = SHOW_SBITS(bs, &ctx->gb, 1);
SKIP_BITS(bs, &ctx->gb, 1);
@@ -242,14 +239,11 @@ static av_always_inline void dnxhd_decode_dct_block(DNXHDContext *ctx,
}
j = ctx->scantable.permutated[i];
- //av_log(ctx->avctx, AV_LOG_DEBUG, "j %d\n", j);
- //av_log(ctx->avctx, AV_LOG_DEBUG, "level %d, weight %d\n", level, weight_matrix[i]);
level = (2*level+1) * qscale * weight_matrix[i];
if (level_bias < 32 || weight_matrix[i] != level_bias)
level += level_bias;
level >>= level_shift;
- //av_log(NULL, AV_LOG_DEBUG, "i %d, j %d, end level %d\n", i, j, level);
block[j] = (level^sign) - sign;
}
@@ -279,7 +273,6 @@ static int dnxhd_decode_macroblock(DNXHDContext *ctx, int x, int y)
qscale = get_bits(&ctx->gb, 11);
skip_bits1(&ctx->gb);
- //av_log(ctx->avctx, AV_LOG_DEBUG, "qscale %d\n", qscale);
for (i = 0; i < 8; i++) {
ctx->dsp.clear_block(ctx->blocks[i]);
@@ -336,7 +329,7 @@ static int dnxhd_decode_macroblocks(DNXHDContext *ctx, const uint8_t *buf, int b
return 0;
}
-static int dnxhd_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
+static int dnxhd_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
@@ -365,7 +358,7 @@ static int dnxhd_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
if (first_field) {
if (ctx->picture.data[0])
avctx->release_buffer(avctx, &ctx->picture);
- if (avctx->get_buffer(avctx, &ctx->picture) < 0) {
+ if (ff_get_buffer(avctx, &ctx->picture) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return -1;
}
@@ -381,7 +374,7 @@ static int dnxhd_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
}
*picture = ctx->picture;
- *data_size = sizeof(AVPicture);
+ *got_frame = 1;
return buf_size;
}
@@ -400,11 +393,11 @@ static av_cold int dnxhd_decode_close(AVCodecContext *avctx)
AVCodec ff_dnxhd_decoder = {
.name = "dnxhd",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_DNXHD,
+ .id = AV_CODEC_ID_DNXHD,
.priv_data_size = sizeof(DNXHDContext),
.init = dnxhd_decode_init,
.close = dnxhd_decode_close,
.decode = dnxhd_decode_frame,
.capabilities = CODEC_CAP_DR1,
- .long_name = NULL_IF_CONFIG_SMALL("VC3/DNxHD"),
+ .long_name = NULL_IF_CONFIG_SMALL("VC3/DNxHD"),
};
diff --git a/gst-libs/ext/libav/libavcodec/dnxhdenc.c b/gst-libs/ext/libav/libavcodec/dnxhdenc.c
index 2b7089b..97e0fed 100644
--- a/gst-libs/ext/libav/libavcodec/dnxhdenc.c
+++ b/gst-libs/ext/libav/libavcodec/dnxhdenc.c
@@ -29,15 +29,15 @@
#include "libavutil/opt.h"
#include "avcodec.h"
#include "dsputil.h"
+#include "internal.h"
#include "mpegvideo.h"
-#include "mpegvideo_common.h"
#include "dnxhdenc.h"
#define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
#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), AV_OPT_TYPE_INT, {.dbl = 0}, 0, 1, VE},
+ {"nitris_compat", "encode with Avid Nitris compatibility", offsetof(DNXHDEncContext, nitris_compat), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1, VE},
{NULL}
};
static const AVClass class = { "dnxhd", av_default_item_name, options, LIBAVUTIL_VERSION_INT };
@@ -233,10 +233,10 @@ static int dnxhd_encode_init(AVCodecContext *avctx)
int i, index, bit_depth;
switch (avctx->pix_fmt) {
- case PIX_FMT_YUV422P:
+ case AV_PIX_FMT_YUV422P:
bit_depth = 8;
break;
- case PIX_FMT_YUV422P10:
+ case AV_PIX_FMT_YUV422P10:
bit_depth = 10;
break;
default:
@@ -260,10 +260,10 @@ static int dnxhd_encode_init(AVCodecContext *avctx)
avctx->bits_per_raw_sample = ctx->cid_table->bit_depth;
- dsputil_init(&ctx->m.dsp, avctx);
+ ff_dsputil_init(&ctx->m.dsp, avctx);
ff_dct_common_init(&ctx->m);
if (!ctx->m.dct_quantize)
- ctx->m.dct_quantize = dct_quantize_c;
+ ctx->m.dct_quantize = ff_dct_quantize_c;
if (ctx->cid_table->bit_depth == 10) {
ctx->m.dct_quantize = dnxhd_10bit_dct_quantize;
@@ -274,9 +274,8 @@ static int dnxhd_encode_init(AVCodecContext *avctx)
ctx->block_width_l2 = 3;
}
-#if HAVE_MMX
- ff_dnxhd_init_mmx(ctx);
-#endif
+ if (ARCH_X86)
+ ff_dnxhdenc_init_x86(ctx);
ctx->m.mb_height = (avctx->height + 15) / 16;
ctx->m.mb_width = (avctx->width + 15) / 16;
@@ -616,14 +615,35 @@ static void dnxhd_setup_threads_slices(DNXHDEncContext *ctx)
static int dnxhd_mb_var_thread(AVCodecContext *avctx, void *arg, int jobnr, int threadnr)
{
DNXHDEncContext *ctx = avctx->priv_data;
- int mb_y = jobnr, mb_x;
+ int mb_y = jobnr, mb_x, x, y;
+ int partial_last_row = (mb_y == ctx->m.mb_height - 1) &&
+ ((avctx->height >> ctx->interlaced) & 0xF);
+
ctx = ctx->thread[threadnr];
if (ctx->cid_table->bit_depth == 8) {
uint8_t *pix = ctx->thread[0]->src[0] + ((mb_y<<4) * ctx->m.linesize);
for (mb_x = 0; mb_x < ctx->m.mb_width; ++mb_x, pix += 16) {
unsigned mb = mb_y * ctx->m.mb_width + mb_x;
- int sum = ctx->m.dsp.pix_sum(pix, ctx->m.linesize);
- int varc = (ctx->m.dsp.pix_norm1(pix, ctx->m.linesize) - (((unsigned)sum*sum)>>8)+128)>>8;
+ int sum;
+ int varc;
+
+ if (!partial_last_row && mb_x * 16 <= avctx->width - 16) {
+ sum = ctx->m.dsp.pix_sum(pix, ctx->m.linesize);
+ varc = ctx->m.dsp.pix_norm1(pix, ctx->m.linesize);
+ } else {
+ int bw = FFMIN(avctx->width - 16 * mb_x, 16);
+ int bh = FFMIN((avctx->height >> ctx->interlaced) - 16 * mb_y, 16);
+ sum = varc = 0;
+ for (y = 0; y < bh; y++) {
+ for (x = 0; x < bw; x++) {
+ uint8_t val = pix[x + y * ctx->m.linesize];
+ sum += val;
+ varc += val * val;
+ }
+ }
+ }
+ varc = (varc - (((unsigned)sum * sum) >> 8) + 128) >> 8;
+
ctx->mb_cmp[mb].value = varc;
ctx->mb_cmp[mb].mb = mb;
}
@@ -903,18 +923,21 @@ static void dnxhd_load_picture(DNXHDEncContext *ctx, const AVFrame *frame)
ctx->cur_field = frame->interlaced_frame && !frame->top_field_first;
}
-static int dnxhd_encode_picture(AVCodecContext *avctx, unsigned char *buf, int buf_size, void *data)
+static int dnxhd_encode_picture(AVCodecContext *avctx, AVPacket *pkt,
+ const AVFrame *frame, int *got_packet)
{
DNXHDEncContext *ctx = avctx->priv_data;
int first_field = 1;
int offset, i, ret;
+ uint8_t *buf;
- if (buf_size < ctx->cid_table->frame_size) {
+ if ((ret = ff_alloc_packet(pkt, ctx->cid_table->frame_size)) < 0) {
av_log(avctx, AV_LOG_ERROR, "output buffer is too small to compress picture\n");
- return -1;
+ return ret;
}
+ buf = pkt->data;
- dnxhd_load_picture(ctx, data);
+ dnxhd_load_picture(ctx, frame);
encode_coding_unit:
for (i = 0; i < 3; i++) {
@@ -955,13 +978,14 @@ static int dnxhd_encode_picture(AVCodecContext *avctx, unsigned char *buf, int b
first_field = 0;
ctx->cur_field ^= 1;
buf += ctx->cid_table->coding_unit_size;
- buf_size -= ctx->cid_table->coding_unit_size;
goto encode_coding_unit;
}
ctx->frame.quality = ctx->qscale*FF_QP2LAMBDA;
- return ctx->cid_table->frame_size;
+ pkt->flags |= AV_PKT_FLAG_KEY;
+ *got_packet = 1;
+ return 0;
}
static int dnxhd_encode_end(AVCodecContext *avctx)
@@ -996,13 +1020,15 @@ static int dnxhd_encode_end(AVCodecContext *avctx)
AVCodec ff_dnxhd_encoder = {
.name = "dnxhd",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_DNXHD,
+ .id = AV_CODEC_ID_DNXHD,
.priv_data_size = sizeof(DNXHDEncContext),
.init = dnxhd_encode_init,
- .encode = dnxhd_encode_picture,
+ .encode2 = dnxhd_encode_picture,
.close = dnxhd_encode_end,
- .capabilities = CODEC_CAP_SLICE_THREADS,
- .pix_fmts = (const enum PixelFormat[]){PIX_FMT_YUV422P, PIX_FMT_YUV422P10, PIX_FMT_NONE},
- .long_name = NULL_IF_CONFIG_SMALL("VC3/DNxHD"),
- .priv_class = &class,
+ .capabilities = CODEC_CAP_SLICE_THREADS,
+ .pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_YUV422P,
+ AV_PIX_FMT_YUV422P10,
+ AV_PIX_FMT_NONE },
+ .long_name = NULL_IF_CONFIG_SMALL("VC3/DNxHD"),
+ .priv_class = &class,
};
diff --git a/gst-libs/ext/libav/libavcodec/dnxhdenc.h b/gst-libs/ext/libav/libavcodec/dnxhdenc.h
index 861546a..c74b9a7 100644
--- a/gst-libs/ext/libav/libavcodec/dnxhdenc.h
+++ b/gst-libs/ext/libav/libavcodec/dnxhdenc.h
@@ -29,12 +29,12 @@
#include "mpegvideo.h"
#include "dnxhddata.h"
-typedef struct {
+typedef struct RCCMPEntry {
uint16_t mb;
int value;
} RCCMPEntry;
-typedef struct {
+typedef struct RCEntry {
int ssd;
int bits;
} RCEntry;
@@ -92,9 +92,9 @@ typedef struct DNXHDEncContext {
RCCMPEntry *mb_cmp;
RCEntry (*mb_rc)[8160];
- void (*get_pixels_8x4_sym)(DCTELEM */*align 16*/, const uint8_t *, int);
+ void (*get_pixels_8x4_sym)(DCTELEM * /*align 16*/, const uint8_t *, int);
} DNXHDEncContext;
-void ff_dnxhd_init_mmx(DNXHDEncContext *ctx);
+void ff_dnxhdenc_init_x86(DNXHDEncContext *ctx);
#endif /* AVCODEC_DNXHDENC_H */
diff --git a/gst-libs/ext/libav/libavcodec/dpcm.c b/gst-libs/ext/libav/libavcodec/dpcm.c
index 7f5dbfe..2726d35 100644
--- a/gst-libs/ext/libav/libavcodec/dpcm.c
+++ b/gst-libs/ext/libav/libavcodec/dpcm.c
@@ -40,10 +40,11 @@
#include "libavutil/intreadwrite.h"
#include "avcodec.h"
#include "bytestream.h"
+#include "internal.h"
+#include "mathops.h"
typedef struct DPCMContext {
AVFrame frame;
- int channels;
int16_t roq_square_array[256];
int sample[2]; ///< previous sample (for SOL_DPCM)
const int8_t *sol_table; ///< delta table for SOL_DPCM
@@ -122,12 +123,11 @@ static av_cold int dpcm_decode_init(AVCodecContext *avctx)
return AVERROR(EINVAL);
}
- s->channels = avctx->channels;
s->sample[0] = s->sample[1] = 0;
switch(avctx->codec->id) {
- case CODEC_ID_ROQ_DPCM:
+ case AV_CODEC_ID_ROQ_DPCM:
/* initialize square table */
for (i = 0; i < 128; i++) {
int16_t square = i * i;
@@ -136,7 +136,7 @@ static av_cold int dpcm_decode_init(AVCodecContext *avctx)
}
break;
- case CODEC_ID_SOL_DPCM:
+ case AV_CODEC_ID_SOL_DPCM:
switch(avctx->codec_tag){
case 1:
s->sol_table = sol_table_old;
@@ -158,7 +158,7 @@ static av_cold int dpcm_decode_init(AVCodecContext *avctx)
break;
}
- if (avctx->codec->id == CODEC_ID_SOL_DPCM && avctx->codec_tag != 3)
+ if (avctx->codec->id == AV_CODEC_ID_SOL_DPCM && avctx->codec_tag != 3)
avctx->sample_fmt = AV_SAMPLE_FMT_U8;
else
avctx->sample_fmt = AV_SAMPLE_FMT_S16;
@@ -173,33 +173,31 @@ static av_cold int dpcm_decode_init(AVCodecContext *avctx)
static int dpcm_decode_frame(AVCodecContext *avctx, void *data,
int *got_frame_ptr, AVPacket *avpkt)
{
- const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
- const uint8_t *buf_end = buf + buf_size;
DPCMContext *s = avctx->priv_data;
int out = 0, ret;
int predictor[2];
int ch = 0;
- int stereo = s->channels - 1;
- int16_t *output_samples;
+ int stereo = avctx->channels - 1;
+ int16_t *output_samples, *samples_end;
+ GetByteContext gb;
- if (stereo && (buf_size & 1)) {
+ if (stereo && (buf_size & 1))
buf_size--;
- buf_end--;
- }
+ bytestream2_init(&gb, avpkt->data, buf_size);
/* calculate output size */
switch(avctx->codec->id) {
- case CODEC_ID_ROQ_DPCM:
+ case AV_CODEC_ID_ROQ_DPCM:
out = buf_size - 8;
break;
- case CODEC_ID_INTERPLAY_DPCM:
- out = buf_size - 6 - s->channels;
+ case AV_CODEC_ID_INTERPLAY_DPCM:
+ out = buf_size - 6 - avctx->channels;
break;
- case CODEC_ID_XAN_DPCM:
- out = buf_size - 2 * s->channels;
+ case AV_CODEC_ID_XAN_DPCM:
+ out = buf_size - 2 * avctx->channels;
break;
- case CODEC_ID_SOL_DPCM:
+ case AV_CODEC_ID_SOL_DPCM:
if (avctx->codec_tag != 3)
out = buf_size * 2;
else
@@ -212,28 +210,29 @@ static int dpcm_decode_frame(AVCodecContext *avctx, void *data,
}
/* get output buffer */
- s->frame.nb_samples = out / s->channels;
- if ((ret = avctx->get_buffer(avctx, &s->frame)) < 0) {
+ s->frame.nb_samples = out / avctx->channels;
+ if ((ret = ff_get_buffer(avctx, &s->frame)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return ret;
}
output_samples = (int16_t *)s->frame.data[0];
+ samples_end = output_samples + out;
switch(avctx->codec->id) {
- case CODEC_ID_ROQ_DPCM:
- buf += 6;
+ case AV_CODEC_ID_ROQ_DPCM:
+ bytestream2_skipu(&gb, 6);
if (stereo) {
- predictor[1] = (int16_t)(bytestream_get_byte(&buf) << 8);
- predictor[0] = (int16_t)(bytestream_get_byte(&buf) << 8);
+ predictor[1] = sign_extend(bytestream2_get_byteu(&gb) << 8, 16);
+ predictor[0] = sign_extend(bytestream2_get_byteu(&gb) << 8, 16);
} else {
- predictor[0] = (int16_t)bytestream_get_le16(&buf);
+ predictor[0] = sign_extend(bytestream2_get_le16u(&gb), 16);
}
/* decode the samples */
- while (buf < buf_end) {
- predictor[ch] += s->roq_square_array[*buf++];
+ while (output_samples < samples_end) {
+ predictor[ch] += s->roq_square_array[bytestream2_get_byteu(&gb)];
predictor[ch] = av_clip_int16(predictor[ch]);
*output_samples++ = predictor[ch];
@@ -242,17 +241,17 @@ static int dpcm_decode_frame(AVCodecContext *avctx, void *data,
}
break;
- case CODEC_ID_INTERPLAY_DPCM:
- buf += 6; /* skip over the stream mask and stream length */
+ case AV_CODEC_ID_INTERPLAY_DPCM:
+ bytestream2_skipu(&gb, 6); /* skip over the stream mask and stream length */
- for (ch = 0; ch < s->channels; ch++) {
- predictor[ch] = (int16_t)bytestream_get_le16(&buf);
+ for (ch = 0; ch < avctx->channels; ch++) {
+ predictor[ch] = sign_extend(bytestream2_get_le16u(&gb), 16);
*output_samples++ = predictor[ch];
}
ch = 0;
- while (buf < buf_end) {
- predictor[ch] += interplay_delta_table[*buf++];
+ while (output_samples < samples_end) {
+ predictor[ch] += interplay_delta_table[bytestream2_get_byteu(&gb)];
predictor[ch] = av_clip_int16(predictor[ch]);
*output_samples++ = predictor[ch];
@@ -261,21 +260,24 @@ static int dpcm_decode_frame(AVCodecContext *avctx, void *data,
}
break;
- case CODEC_ID_XAN_DPCM:
+ case AV_CODEC_ID_XAN_DPCM:
{
int shift[2] = { 4, 4 };
- for (ch = 0; ch < s->channels; ch++)
- predictor[ch] = (int16_t)bytestream_get_le16(&buf);
+ for (ch = 0; ch < avctx->channels; ch++)
+ predictor[ch] = sign_extend(bytestream2_get_le16u(&gb), 16);
ch = 0;
- while (buf < buf_end) {
- uint8_t n = *buf++;
- int16_t diff = (n & 0xFC) << 8;
- if ((n & 0x03) == 3)
+ while (output_samples < samples_end) {
+ int diff = bytestream2_get_byteu(&gb);
+ int n = diff & 3;
+
+ if (n == 3)
shift[ch]++;
else
- shift[ch] -= (2 * (n & 3));
+ shift[ch] -= (2 * n);
+ diff = sign_extend((diff &~ 3) << 8, 16);
+
/* saturate the shifter to a lower limit of 0 */
if (shift[ch] < 0)
shift[ch] = 0;
@@ -291,11 +293,12 @@ static int dpcm_decode_frame(AVCodecContext *avctx, void *data,
}
break;
}
- case CODEC_ID_SOL_DPCM:
+ case AV_CODEC_ID_SOL_DPCM:
if (avctx->codec_tag != 3) {
- uint8_t *output_samples_u8 = s->frame.data[0];
- while (buf < buf_end) {
- uint8_t n = *buf++;
+ uint8_t *output_samples_u8 = s->frame.data[0],
+ *samples_end_u8 = output_samples_u8 + out;
+ while (output_samples_u8 < samples_end_u8) {
+ int n = bytestream2_get_byteu(&gb);
s->sample[0] += s->sol_table[n >> 4];
s->sample[0] = av_clip_uint8(s->sample[0]);
@@ -306,8 +309,8 @@ static int dpcm_decode_frame(AVCodecContext *avctx, void *data,
*output_samples_u8++ = s->sample[stereo];
}
} else {
- while (buf < buf_end) {
- uint8_t n = *buf++;
+ while (output_samples < samples_end) {
+ int n = bytestream2_get_byteu(&gb);
if (n & 0x80) s->sample[ch] -= sol_table_16[n & 0x7F];
else s->sample[ch] += sol_table_16[n & 0x7F];
s->sample[ch] = av_clip_int16(s->sample[ch]);
@@ -337,7 +340,7 @@ AVCodec ff_ ## name_ ## _decoder = { \
.long_name = NULL_IF_CONFIG_SMALL(long_name_), \
}
-DPCM_DECODER(CODEC_ID_INTERPLAY_DPCM, interplay_dpcm, "DPCM Interplay");
-DPCM_DECODER(CODEC_ID_ROQ_DPCM, roq_dpcm, "DPCM id RoQ");
-DPCM_DECODER(CODEC_ID_SOL_DPCM, sol_dpcm, "DPCM Sol");
-DPCM_DECODER(CODEC_ID_XAN_DPCM, xan_dpcm, "DPCM Xan");
+DPCM_DECODER(AV_CODEC_ID_INTERPLAY_DPCM, interplay_dpcm, "DPCM Interplay");
+DPCM_DECODER(AV_CODEC_ID_ROQ_DPCM, roq_dpcm, "DPCM id RoQ");
+DPCM_DECODER(AV_CODEC_ID_SOL_DPCM, sol_dpcm, "DPCM Sol");
+DPCM_DECODER(AV_CODEC_ID_XAN_DPCM, xan_dpcm, "DPCM Xan");
diff --git a/gst-libs/ext/libav/libavcodec/dpx.c b/gst-libs/ext/libav/libavcodec/dpx.c
index 156f1de..7c01bab 100644
--- a/gst-libs/ext/libav/libavcodec/dpx.c
+++ b/gst-libs/ext/libav/libavcodec/dpx.c
@@ -23,6 +23,7 @@
#include "libavutil/imgutils.h"
#include "bytestream.h"
#include "avcodec.h"
+#include "internal.h"
typedef struct DPXContext {
AVFrame picture;
@@ -51,7 +52,7 @@ static inline unsigned make_16bit(unsigned value)
static int decode_frame(AVCodecContext *avctx,
void *data,
- int *data_size,
+ int *got_frame,
AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
@@ -62,7 +63,8 @@ static int decode_frame(AVCodecContext *avctx,
AVFrame *const p = &s->picture;
uint8_t *ptr;
- int magic_num, offset, endian;
+ unsigned int offset;
+ int magic_num, endian;
int x, y;
int w, h, stride, bits_per_color, descriptor, elements, target_packet_size, source_packet_size;
@@ -125,24 +127,24 @@ static int decode_frame(AVCodecContext *avctx,
switch (bits_per_color) {
case 8:
if (elements == 4) {
- avctx->pix_fmt = PIX_FMT_RGBA;
+ avctx->pix_fmt = AV_PIX_FMT_RGBA;
} else {
- avctx->pix_fmt = PIX_FMT_RGB24;
+ avctx->pix_fmt = AV_PIX_FMT_RGB24;
}
source_packet_size = elements;
target_packet_size = elements;
break;
case 10:
- avctx->pix_fmt = PIX_FMT_RGB48;
+ avctx->pix_fmt = AV_PIX_FMT_RGB48;
target_packet_size = 6;
source_packet_size = 4;
break;
case 12:
case 16:
if (endian) {
- avctx->pix_fmt = PIX_FMT_RGB48BE;
+ avctx->pix_fmt = AV_PIX_FMT_RGB48BE;
} else {
- avctx->pix_fmt = PIX_FMT_RGB48LE;
+ avctx->pix_fmt = AV_PIX_FMT_RGB48LE;
}
target_packet_size = 6;
source_packet_size = elements * 2;
@@ -158,7 +160,7 @@ static int decode_frame(AVCodecContext *avctx,
return -1;
if (w != avctx->width || h != avctx->height)
avcodec_set_dimensions(avctx, w, h);
- if (avctx->get_buffer(avctx, p) < 0) {
+ if (ff_get_buffer(avctx, p) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return -1;
}
@@ -211,7 +213,7 @@ static int decode_frame(AVCodecContext *avctx,
}
*picture = s->picture;
- *data_size = sizeof(AVPicture);
+ *got_frame = 1;
return buf_size;
}
@@ -236,10 +238,11 @@ static av_cold int decode_end(AVCodecContext *avctx)
AVCodec ff_dpx_decoder = {
.name = "dpx",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_DPX,
+ .id = AV_CODEC_ID_DPX,
.priv_data_size = sizeof(DPXContext),
.init = decode_init,
.close = decode_end,
.decode = decode_frame,
- .long_name = NULL_IF_CONFIG_SMALL("DPX image"),
+ .long_name = NULL_IF_CONFIG_SMALL("DPX image"),
+ .capabilities = CODEC_CAP_DR1,
};
diff --git a/gst-libs/ext/libav/libavcodec/dpxenc.c b/gst-libs/ext/libav/libavcodec/dpxenc.c
index 1ff9d97..d263161 100644
--- a/gst-libs/ext/libav/libavcodec/dpxenc.c
+++ b/gst-libs/ext/libav/libavcodec/dpxenc.c
@@ -19,9 +19,11 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "libavutil/common.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/imgutils.h"
#include "avcodec.h"
+#include "internal.h"
typedef struct DPXContext {
AVFrame picture;
@@ -43,14 +45,14 @@ static av_cold int encode_init(AVCodecContext *avctx)
s->descriptor = 50; /* RGB */
switch (avctx->pix_fmt) {
- case PIX_FMT_RGB24:
+ case AV_PIX_FMT_RGB24:
break;
- case PIX_FMT_RGBA:
+ case AV_PIX_FMT_RGBA:
s->descriptor = 51; /* RGBA */
break;
- case PIX_FMT_RGB48LE:
+ case AV_PIX_FMT_RGB48LE:
s->big_endian = 0;
- case PIX_FMT_RGB48BE:
+ case AV_PIX_FMT_RGB48BE:
s->bits_per_component = avctx->bits_per_raw_sample ? avctx->bits_per_raw_sample : 16;
break;
default:
@@ -99,15 +101,23 @@ static void encode_rgb48_10bit(AVCodecContext *avctx, const AVPicture *pic,
}
}
-static int encode_frame(AVCodecContext *avctx, unsigned char *buf,
- int buf_size, void *data)
+static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
+ const AVFrame *frame, int *got_packet)
{
DPXContext *s = avctx->priv_data;
- int size;
+ int size, ret;
+ uint8_t *buf;
#define HEADER_SIZE 1664 /* DPX Generic header */
- if (buf_size < HEADER_SIZE)
- return -1;
+ if (s->bits_per_component == 10)
+ size = avctx->height * avctx->width * 4;
+ else
+ size = avpicture_get_size(avctx->pix_fmt, avctx->width, avctx->height);
+ if ((ret = ff_alloc_packet(pkt, size + HEADER_SIZE)) < 0) {
+ av_log(avctx, AV_LOG_ERROR, "Error getting output packet.\n");
+ return ret;
+ }
+ buf = pkt->data;
memset(buf, 0, HEADER_SIZE);
@@ -117,7 +127,8 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf,
memcpy (buf + 8, "V1.0", 4);
write32(buf + 20, 1); /* new image */
write32(buf + 24, HEADER_SIZE);
- memcpy (buf + 160, LIBAVCODEC_IDENT, FFMIN(sizeof(LIBAVCODEC_IDENT), 100));
+ if (!(avctx->flags & CODEC_FLAG_BITEXACT))
+ memcpy (buf + 160, LIBAVCODEC_IDENT, FFMIN(sizeof(LIBAVCODEC_IDENT), 100));
write32(buf + 660, 0xFFFFFFFF); /* unencrypted */
/* Image information header */
@@ -138,17 +149,14 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf,
switch (s->bits_per_component) {
case 8:
case 16:
- size = avpicture_layout(data, avctx->pix_fmt,
+ size = avpicture_layout((const AVPicture*)frame, avctx->pix_fmt,
avctx->width, avctx->height,
- buf + HEADER_SIZE, buf_size - HEADER_SIZE);
+ buf + HEADER_SIZE, pkt->size - HEADER_SIZE);
if (size < 0)
return size;
break;
case 10:
- size = avctx->height * avctx->width * 4;
- if (buf_size < HEADER_SIZE + size)
- return -1;
- encode_rgb48_10bit(avctx, data, buf + HEADER_SIZE);
+ encode_rgb48_10bit(avctx, (const AVPicture*)frame, buf + HEADER_SIZE);
break;
default:
av_log(avctx, AV_LOG_ERROR, "Unsupported bit depth: %d\n", s->bits_per_component);
@@ -158,21 +166,25 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf,
size += HEADER_SIZE;
write32(buf + 16, size); /* file size */
- return size;
+
+ pkt->flags |= AV_PKT_FLAG_KEY;
+ *got_packet = 1;
+
+ return 0;
}
AVCodec ff_dpx_encoder = {
.name = "dpx",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_DPX,
+ .id = AV_CODEC_ID_DPX,
.priv_data_size = sizeof(DPXContext),
.init = encode_init,
- .encode = encode_frame,
- .pix_fmts = (const enum PixelFormat[]){
- PIX_FMT_RGB24,
- PIX_FMT_RGBA,
- PIX_FMT_RGB48LE,
- PIX_FMT_RGB48BE,
- PIX_FMT_NONE},
+ .encode2 = encode_frame,
+ .pix_fmts = (const enum AVPixelFormat[]){
+ AV_PIX_FMT_RGB24,
+ AV_PIX_FMT_RGBA,
+ AV_PIX_FMT_RGB48LE,
+ AV_PIX_FMT_RGB48BE,
+ AV_PIX_FMT_NONE},
.long_name = NULL_IF_CONFIG_SMALL("DPX image"),
};
diff --git a/gst-libs/ext/libav/libavcodec/dsicinav.c b/gst-libs/ext/libav/libavcodec/dsicinav.c
index a379531..39b6a4c 100644
--- a/gst-libs/ext/libav/libavcodec/dsicinav.c
+++ b/gst-libs/ext/libav/libavcodec/dsicinav.c
@@ -24,8 +24,10 @@
* Delphine Software International CIN audio/video decoders
*/
+#include "libavutil/channel_layout.h"
#include "avcodec.h"
#include "bytestream.h"
+#include "internal.h"
#include "mathops.h"
@@ -93,7 +95,7 @@ static av_cold int cinvideo_decode_init(AVCodecContext *avctx)
unsigned int i;
cin->avctx = avctx;
- avctx->pix_fmt = PIX_FMT_PAL8;
+ avctx->pix_fmt = AV_PIX_FMT_PAL8;
cin->frame.data[0] = NULL;
@@ -121,7 +123,7 @@ static int cin_decode_huffman(const unsigned char *src, int src_size, unsigned c
unsigned char *dst_end = dst + dst_size;
const unsigned char *src_end = src + src_size;
- memcpy(huff_code_table, src, 15); src += 15; src_size -= 15;
+ memcpy(huff_code_table, src, 15); src += 15;
while (src < src_end) {
huff_code = *src++;
@@ -199,7 +201,7 @@ static void cin_decode_rle(const unsigned char *src, int src_size, unsigned char
}
static int cinvideo_decode_frame(AVCodecContext *avctx,
- void *data, int *data_size,
+ void *data, int *got_frame,
AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
@@ -295,7 +297,7 @@ static int cinvideo_decode_frame(AVCodecContext *avctx,
FFSWAP(uint8_t *, cin->bitmap_table[CIN_CUR_BMP], cin->bitmap_table[CIN_PRE_BMP]);
- *data_size = sizeof(AVFrame);
+ *got_frame = 1;
*(AVFrame *)data = cin->frame;
return buf_size;
@@ -319,14 +321,11 @@ static av_cold int cinaudio_decode_init(AVCodecContext *avctx)
{
CinAudioContext *cin = avctx->priv_data;
- if (avctx->channels != 1) {
- av_log_ask_for_sample(avctx, "Number of channels is not supported\n");
- return AVERROR_PATCHWELCOME;
- }
-
cin->initial_decode_frame = 1;
- cin->delta = 0;
- avctx->sample_fmt = AV_SAMPLE_FMT_S16;
+ cin->delta = 0;
+ avctx->sample_fmt = AV_SAMPLE_FMT_S16;
+ avctx->channels = 1;
+ avctx->channel_layout = AV_CH_LAYOUT_MONO;
avcodec_get_frame_defaults(&cin->frame);
avctx->coded_frame = &cin->frame;
@@ -345,7 +344,7 @@ static int cinaudio_decode_frame(AVCodecContext *avctx, void *data,
/* get output buffer */
cin->frame.nb_samples = avpkt->size - cin->initial_decode_frame;
- if ((ret = avctx->get_buffer(avctx, &cin->frame)) < 0) {
+ if ((ret = ff_get_buffer(avctx, &cin->frame)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return ret;
}
@@ -375,22 +374,22 @@ static int cinaudio_decode_frame(AVCodecContext *avctx, void *data,
AVCodec ff_dsicinvideo_decoder = {
.name = "dsicinvideo",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_DSICINVIDEO,
+ .id = AV_CODEC_ID_DSICINVIDEO,
.priv_data_size = sizeof(CinVideoContext),
.init = cinvideo_decode_init,
.close = cinvideo_decode_end,
.decode = cinvideo_decode_frame,
.capabilities = CODEC_CAP_DR1,
- .long_name = NULL_IF_CONFIG_SMALL("Delphine Software International CIN video"),
+ .long_name = NULL_IF_CONFIG_SMALL("Delphine Software International CIN video"),
};
AVCodec ff_dsicinaudio_decoder = {
.name = "dsicinaudio",
.type = AVMEDIA_TYPE_AUDIO,
- .id = CODEC_ID_DSICINAUDIO,
+ .id = AV_CODEC_ID_DSICINAUDIO,
.priv_data_size = sizeof(CinAudioContext),
.init = cinaudio_decode_init,
.decode = cinaudio_decode_frame,
.capabilities = CODEC_CAP_DR1,
- .long_name = NULL_IF_CONFIG_SMALL("Delphine Software International CIN audio"),
+ .long_name = NULL_IF_CONFIG_SMALL("Delphine Software International CIN audio"),
};
diff --git a/gst-libs/ext/libav/libavcodec/dsputil.c b/gst-libs/ext/libav/libavcodec/dsputil.c
index 050081a..4696bc7 100644
--- a/gst-libs/ext/libav/libavcodec/dsputil.c
+++ b/gst-libs/ext/libav/libavcodec/dsputil.c
@@ -36,9 +36,7 @@
#include "mathops.h"
#include "mpegvideo.h"
#include "config.h"
-#include "ac3dec.h"
#include "vorbis.h"
-#include "png.h"
uint8_t ff_cropTbl[256 + 2 * MAX_NEG_CROP] = {0, };
uint32_t ff_squareTbl[512] = {0, };
@@ -83,7 +81,7 @@ const uint8_t ff_zigzag248_direct[64] = {
};
/* not permutated inverse zigzag_direct + 1 for MMX quantizer */
-DECLARE_ALIGNED(16, uint16_t, inv_zigzag_direct16)[64];
+DECLARE_ALIGNED(16, uint16_t, ff_inv_zigzag_direct16)[64];
const uint8_t ff_alternate_horizontal_scan[64] = {
0, 1, 2, 3, 8, 9, 16, 17,
@@ -131,9 +129,6 @@ void ff_init_scantable(uint8_t *permutation, ScanTable *st, const uint8_t *src_s
int j;
j = src_scantable[i];
st->permutated[i] = permutation[j];
-#if ARCH_PPC
- st->inverse[j] = i;
-#endif
}
end=-1;
@@ -363,8 +358,8 @@ static void diff_pixels_c(DCTELEM *restrict block, const uint8_t *s1,
}
-void ff_put_pixels_clamped_c(const DCTELEM *block, uint8_t *restrict pixels,
- int line_size)
+static void put_pixels_clamped_c(const DCTELEM *block, uint8_t *restrict pixels,
+ int line_size)
{
int i;
@@ -384,41 +379,9 @@ void ff_put_pixels_clamped_c(const DCTELEM *block, uint8_t *restrict pixels,
}
}
-static void put_pixels_clamped4_c(const DCTELEM *block, uint8_t *restrict pixels,
- int line_size)
-{
- int i;
-
- /* read the pixels */
- for(i=0;i<4;i++) {
- pixels[0] = av_clip_uint8(block[0]);
- pixels[1] = av_clip_uint8(block[1]);
- pixels[2] = av_clip_uint8(block[2]);
- pixels[3] = av_clip_uint8(block[3]);
-
- pixels += line_size;
- block += 8;
- }
-}
-
-static void put_pixels_clamped2_c(const DCTELEM *block, uint8_t *restrict pixels,
- int line_size)
-{
- int i;
-
- /* read the pixels */
- for(i=0;i<2;i++) {
- pixels[0] = av_clip_uint8(block[0]);
- pixels[1] = av_clip_uint8(block[1]);
-
- pixels += line_size;
- block += 8;
- }
-}
-
-void ff_put_signed_pixels_clamped_c(const DCTELEM *block,
- uint8_t *restrict pixels,
- int line_size)
+static void put_signed_pixels_clamped_c(const DCTELEM *block,
+ uint8_t *restrict pixels,
+ int line_size)
{
int i, j;
@@ -437,8 +400,8 @@ void ff_put_signed_pixels_clamped_c(const DCTELEM *block,
}
}
-void ff_add_pixels_clamped_c(const DCTELEM *block, uint8_t *restrict pixels,
- int line_size)
+static void add_pixels_clamped_c(const DCTELEM *block, uint8_t *restrict pixels,
+ int line_size)
{
int i;
@@ -457,36 +420,6 @@ void ff_add_pixels_clamped_c(const DCTELEM *block, uint8_t *restrict pixels,
}
}
-static void add_pixels_clamped4_c(const DCTELEM *block, uint8_t *restrict pixels,
- int line_size)
-{
- int i;
-
- /* read the pixels */
- for(i=0;i<4;i++) {
- pixels[0] = av_clip_uint8(pixels[0] + block[0]);
- pixels[1] = av_clip_uint8(pixels[1] + block[1]);
- pixels[2] = av_clip_uint8(pixels[2] + block[2]);
- pixels[3] = av_clip_uint8(pixels[3] + block[3]);
- pixels += line_size;
- block += 8;
- }
-}
-
-static void add_pixels_clamped2_c(const DCTELEM *block, uint8_t *restrict pixels,
- int line_size)
-{
- int i;
-
- /* read the pixels */
- for(i=0;i<2;i++) {
- pixels[0] = av_clip_uint8(pixels[0] + block[0]);
- pixels[1] = av_clip_uint8(pixels[1] + block[1]);
- pixels += line_size;
- block += 8;
- }
-}
-
static int sum_abs_dctelem_c(DCTELEM *block)
{
int sum=0, i;
@@ -1876,17 +1809,6 @@ static void add_bytes_c(uint8_t *dst, uint8_t *src, int w){
dst[i+0] += src[i+0];
}
-static void add_bytes_l2_c(uint8_t *dst, uint8_t *src1, uint8_t *src2, int w){
- long i;
- for(i=0; i<=w-sizeof(long); i+=sizeof(long)){
- long a = *(long*)(src1+i);
- long b = *(long*)(src2+i);
- *(long*)(dst+i) = ((a&pb_7f) + (b&pb_7f)) ^ ((a^b)&pb_80);
- }
- for(; i<w; i++)
- dst[i] = src1[i]+src2[i];
-}
-
static void diff_bytes_c(uint8_t *dst, uint8_t *src1, uint8_t *src2, int w){
long i;
#if !HAVE_FAST_UNALIGNED
@@ -2440,12 +2362,6 @@ WRAPPER8_16_SQ(quant_psnr8x8_c, quant_psnr16_c)
WRAPPER8_16_SQ(rd8x8_c, rd16_c)
WRAPPER8_16_SQ(bit8x8_c, bit16_c)
-static void vector_fmul_c(float *dst, const float *src0, const float *src1, int len){
- int i;
- for(i=0; i<len; i++)
- dst[i] = src0[i] * src1[i];
-}
-
static void vector_fmul_reverse_c(float *dst, const float *src0, const float *src1, int len){
int i;
src1 += len-1;
@@ -2476,22 +2392,6 @@ static void vector_fmul_window_c(float *dst, const float *src0,
}
}
-static void vector_fmul_scalar_c(float *dst, const float *src, float mul,
- int len)
-{
- int i;
- for (i = 0; i < len; i++)
- dst[i] = src[i] * mul;
-}
-
-static void vector_fmac_scalar_c(float *dst, const float *src, float mul,
- int len)
-{
- int i;
- for (i = 0; i < len; i++)
- dst[i] += src[i] * mul;
-}
-
static void butterflies_float_c(float *restrict v1, float *restrict v2,
int len)
{
@@ -2515,7 +2415,7 @@ static void butterflies_float_interleave_c(float *dst, const float *src0,
}
}
-static float scalarproduct_float_c(const float *v1, const float *v2, int len)
+float ff_scalarproduct_float_c(const float *v1, const float *v2, int len)
{
float p = 0.0;
int i;
@@ -2571,12 +2471,12 @@ static void vector_clipf_c(float *dst, const float *src, float min, float max, i
}
}
-static int32_t scalarproduct_int16_c(const int16_t * v1, const int16_t * v2, int order, int shift)
+static int32_t scalarproduct_int16_c(const int16_t * v1, const int16_t * v2, int order)
{
int res = 0;
while (order--)
- res += (*v1++ * *v2++) >> shift;
+ res += *v1++ * *v2++;
return res;
}
@@ -2697,59 +2597,26 @@ void ff_wmv2_idct_c(short * block){
static void ff_wmv2_idct_put_c(uint8_t *dest, int line_size, DCTELEM *block)
{
ff_wmv2_idct_c(block);
- ff_put_pixels_clamped_c(block, dest, line_size);
+ put_pixels_clamped_c(block, dest, line_size);
}
static void ff_wmv2_idct_add_c(uint8_t *dest, int line_size, DCTELEM *block)
{
ff_wmv2_idct_c(block);
- ff_add_pixels_clamped_c(block, dest, line_size);
+ add_pixels_clamped_c(block, dest, line_size);
}
static void ff_jref_idct_put(uint8_t *dest, int line_size, DCTELEM *block)
{
- j_rev_dct (block);
- ff_put_pixels_clamped_c(block, dest, line_size);
+ ff_j_rev_dct (block);
+ put_pixels_clamped_c(block, dest, line_size);
}
static void ff_jref_idct_add(uint8_t *dest, int line_size, DCTELEM *block)
{
- j_rev_dct (block);
- ff_add_pixels_clamped_c(block, dest, line_size);
-}
-
-static void ff_jref_idct4_put(uint8_t *dest, int line_size, DCTELEM *block)
-{
- j_rev_dct4 (block);
- put_pixels_clamped4_c(block, dest, line_size);
-}
-static void ff_jref_idct4_add(uint8_t *dest, int line_size, DCTELEM *block)
-{
- j_rev_dct4 (block);
- add_pixels_clamped4_c(block, dest, line_size);
-}
-
-static void ff_jref_idct2_put(uint8_t *dest, int line_size, DCTELEM *block)
-{
- j_rev_dct2 (block);
- put_pixels_clamped2_c(block, dest, line_size);
-}
-static void ff_jref_idct2_add(uint8_t *dest, int line_size, DCTELEM *block)
-{
- j_rev_dct2 (block);
- add_pixels_clamped2_c(block, dest, line_size);
+ ff_j_rev_dct (block);
+ add_pixels_clamped_c(block, dest, line_size);
}
-static void ff_jref_idct1_put(uint8_t *dest, int line_size, DCTELEM *block)
-{
- dest[0] = av_clip_uint8((block[0] + 4)>>3);
-}
-static void ff_jref_idct1_add(uint8_t *dest, int line_size, DCTELEM *block)
-{
- dest[0] = av_clip_uint8(dest[0] + ((block[0] + 4)>>3));
-}
-
-static void just_return(void *mem av_unused, int stride av_unused, int h av_unused) { return; }
-
/* init static data */
-av_cold void dsputil_static_init(void)
+av_cold void ff_dsputil_static_init(void)
{
int i;
@@ -2763,7 +2630,7 @@ av_cold void dsputil_static_init(void)
ff_squareTbl[i] = (i - 256) * (i - 256);
}
- for(i=0; i<64; i++) inv_zigzag_direct16[ff_zigzag_direct[i]]= i+1;
+ for(i=0; i<64; i++) ff_inv_zigzag_direct16[ff_zigzag_direct[i]]= i+1;
}
int ff_check_alignment(void){
@@ -2786,7 +2653,7 @@ int ff_check_alignment(void){
return 0;
}
-av_cold void dsputil_init(DSPContext* c, AVCodecContext *avctx)
+av_cold void ff_dsputil_init(DSPContext* c, AVCodecContext *avctx)
{
int i, j;
@@ -2798,8 +2665,8 @@ av_cold void dsputil_init(DSPContext* c, AVCodecContext *avctx)
c->fdct248 = ff_fdct248_islow_10;
} else {
if(avctx->dct_algo==FF_DCT_FASTINT) {
- c->fdct = fdct_ifast;
- c->fdct248 = fdct_ifast248;
+ c->fdct = ff_fdct_ifast;
+ c->fdct248 = ff_fdct_ifast248;
}
else if(avctx->dct_algo==FF_DCT_FAAN) {
c->fdct = ff_faandct;
@@ -2812,39 +2679,17 @@ av_cold void dsputil_init(DSPContext* c, AVCodecContext *avctx)
}
#endif //CONFIG_ENCODERS
- if(avctx->lowres==1){
- c->idct_put= ff_jref_idct4_put;
- c->idct_add= ff_jref_idct4_add;
- c->idct = j_rev_dct4;
- c->idct_permutation_type= FF_NO_IDCT_PERM;
- }else if(avctx->lowres==2){
- c->idct_put= ff_jref_idct2_put;
- c->idct_add= ff_jref_idct2_add;
- c->idct = j_rev_dct2;
- c->idct_permutation_type= FF_NO_IDCT_PERM;
- }else if(avctx->lowres==3){
- c->idct_put= ff_jref_idct1_put;
- c->idct_add= ff_jref_idct1_add;
- c->idct = j_rev_dct1;
- c->idct_permutation_type= FF_NO_IDCT_PERM;
- }else{
- if (avctx->bits_per_raw_sample == 10) {
- c->idct_put = ff_simple_idct_put_10;
- c->idct_add = ff_simple_idct_add_10;
- c->idct = ff_simple_idct_10;
- c->idct_permutation_type = FF_NO_IDCT_PERM;
- } else {
+ if (avctx->bits_per_raw_sample == 10) {
+ c->idct_put = ff_simple_idct_put_10;
+ c->idct_add = ff_simple_idct_add_10;
+ c->idct = ff_simple_idct_10;
+ c->idct_permutation_type = FF_NO_IDCT_PERM;
+ } else {
if(avctx->idct_algo==FF_IDCT_INT){
c->idct_put= ff_jref_idct_put;
c->idct_add= ff_jref_idct_add;
- c->idct = j_rev_dct;
+ c->idct = ff_j_rev_dct;
c->idct_permutation_type= FF_LIBMPEG2_IDCT_PERM;
- }else if((CONFIG_VP3_DECODER || CONFIG_VP5_DECODER || CONFIG_VP6_DECODER ) &&
- avctx->idct_algo==FF_IDCT_VP3){
- c->idct_put= ff_vp3_idct_put_c;
- c->idct_add= ff_vp3_idct_add_c;
- c->idct = ff_vp3_idct_c;
- c->idct_permutation_type= FF_NO_IDCT_PERM;
}else if(avctx->idct_algo==FF_IDCT_WMV2){
c->idct_put= ff_wmv2_idct_put_c;
c->idct_add= ff_wmv2_idct_add_c;
@@ -2855,22 +2700,18 @@ av_cold void dsputil_init(DSPContext* c, AVCodecContext *avctx)
c->idct_add= ff_faanidct_add;
c->idct = ff_faanidct;
c->idct_permutation_type= FF_NO_IDCT_PERM;
- }else if(CONFIG_EATGQ_DECODER && avctx->idct_algo==FF_IDCT_EA) {
- c->idct_put= ff_ea_idct_put_c;
- c->idct_permutation_type= FF_NO_IDCT_PERM;
}else{ //accurate/default
c->idct_put = ff_simple_idct_put_8;
c->idct_add = ff_simple_idct_add_8;
c->idct = ff_simple_idct_8;
c->idct_permutation_type= FF_NO_IDCT_PERM;
}
- }
}
c->diff_pixels = diff_pixels_c;
- c->put_pixels_clamped = ff_put_pixels_clamped_c;
- c->put_signed_pixels_clamped = ff_put_signed_pixels_clamped_c;
- c->add_pixels_clamped = ff_add_pixels_clamped_c;
+ c->put_pixels_clamped = put_pixels_clamped_c;
+ c->put_signed_pixels_clamped = put_signed_pixels_clamped_c;
+ c->add_pixels_clamped = add_pixels_clamped_c;
c->sum_abs_dctelem = sum_abs_dctelem_c;
c->gmc1 = gmc1_c;
c->gmc = ff_gmc_c;
@@ -2942,13 +2783,6 @@ av_cold void dsputil_init(DSPContext* c, AVCodecContext *avctx)
#undef dspfunc
-#if CONFIG_MLP_DECODER || CONFIG_TRUEHD_DECODER
- ff_mlp_init(c, avctx);
-#endif
-#if CONFIG_WMV2_DECODER || CONFIG_VC1_DECODER
- ff_intrax8dsp_init(c,avctx);
-#endif
-
c->put_mspel_pixels_tab[0]= ff_put_pixels8x8_c;
c->put_mspel_pixels_tab[1]= put_mspel8_mc10_c;
c->put_mspel_pixels_tab[2]= put_mspel8_mc20_c;
@@ -2993,7 +2827,6 @@ av_cold void dsputil_init(DSPContext* c, AVCodecContext *avctx)
c->ssd_int8_vs_int16 = ssd_int8_vs_int16_c;
c->add_bytes= add_bytes_c;
- c->add_bytes_l2= add_bytes_l2_c;
c->diff_bytes= diff_bytes_c;
c->add_hfyu_median_prediction= add_hfyu_median_prediction_c;
c->sub_hfyu_median_prediction= sub_hfyu_median_prediction_c;
@@ -3001,33 +2834,20 @@ av_cold void dsputil_init(DSPContext* c, AVCodecContext *avctx)
c->add_hfyu_left_prediction_bgr32 = add_hfyu_left_prediction_bgr32_c;
c->bswap_buf= bswap_buf;
c->bswap16_buf = bswap16_buf;
-#if CONFIG_PNG_DECODER
- c->add_png_paeth_prediction= ff_add_png_paeth_prediction;
-#endif
if (CONFIG_H263_DECODER || CONFIG_H263_ENCODER) {
c->h263_h_loop_filter= h263_h_loop_filter_c;
c->h263_v_loop_filter= h263_v_loop_filter_c;
}
- if (CONFIG_VP3_DECODER) {
- c->vp3_h_loop_filter= ff_vp3_h_loop_filter_c;
- c->vp3_v_loop_filter= ff_vp3_v_loop_filter_c;
- c->vp3_idct_dc_add= ff_vp3_idct_dc_add_c;
- }
-
c->h261_loop_filter= h261_loop_filter_c;
c->try_8x8basis= try_8x8basis_c;
c->add_8x8basis= add_8x8basis_c;
#if CONFIG_VORBIS_DECODER
- c->vorbis_inverse_coupling = vorbis_inverse_coupling;
-#endif
-#if CONFIG_AC3_DECODER
- c->ac3_downmix = ff_ac3_downmix_c;
+ c->vorbis_inverse_coupling = ff_vorbis_inverse_coupling;
#endif
- c->vector_fmul = vector_fmul_c;
c->vector_fmul_reverse = vector_fmul_reverse_c;
c->vector_fmul_add = vector_fmul_add_c;
c->vector_fmul_window = vector_fmul_window_c;
@@ -3036,19 +2856,15 @@ av_cold void dsputil_init(DSPContext* c, AVCodecContext *avctx)
c->scalarproduct_and_madd_int16 = scalarproduct_and_madd_int16_c;
c->apply_window_int16 = apply_window_int16_c;
c->vector_clip_int32 = vector_clip_int32_c;
- c->scalarproduct_float = scalarproduct_float_c;
+ c->scalarproduct_float = ff_scalarproduct_float_c;
c->butterflies_float = butterflies_float_c;
c->butterflies_float_interleave = butterflies_float_interleave_c;
- c->vector_fmul_scalar = vector_fmul_scalar_c;
- c->vector_fmac_scalar = vector_fmac_scalar_c;
c->shrink[0]= av_image_copy_plane;
c->shrink[1]= ff_shrink22;
c->shrink[2]= ff_shrink44;
c->shrink[3]= ff_shrink88;
- c->prefetch= just_return;
-
memset(c->put_2tap_qpel_pixels_tab, 0, sizeof(c->put_2tap_qpel_pixels_tab));
memset(c->avg_2tap_qpel_pixels_tab, 0, sizeof(c->avg_2tap_qpel_pixels_tab));
@@ -3085,7 +2901,6 @@ av_cold void dsputil_init(DSPContext* c, AVCodecContext *avctx)
#define BIT_DEPTH_FUNCS(depth, dct)\
c->get_pixels = FUNCC(get_pixels ## dct , depth);\
c->draw_edges = FUNCC(draw_edges , depth);\
- c->emulated_edge_mc = FUNC (ff_emulated_edge_mc , depth);\
c->clear_block = FUNCC(clear_block ## dct , depth);\
c->clear_blocks = FUNCC(clear_blocks ## dct , depth);\
c->add_pixels8 = FUNCC(add_pixels8 ## dct , depth);\
@@ -3137,22 +2952,18 @@ av_cold void dsputil_init(DSPContext* c, AVCodecContext *avctx)
}
break;
default:
- av_log(avctx, AV_LOG_DEBUG, "Unsupported bit depth: %d\n", avctx->bits_per_raw_sample);
- case 8:
BIT_DEPTH_FUNCS(8, _16);
break;
}
- if (HAVE_MMX) dsputil_init_mmx (c, avctx);
- if (ARCH_ARM) dsputil_init_arm (c, avctx);
- if (CONFIG_MLIB) dsputil_init_mlib (c, avctx);
- if (HAVE_VIS) dsputil_init_vis (c, avctx);
- if (ARCH_ALPHA) dsputil_init_alpha (c, avctx);
- if (ARCH_PPC) dsputil_init_ppc (c, avctx);
- if (HAVE_MMI) dsputil_init_mmi (c, avctx);
- if (ARCH_SH4) dsputil_init_sh4 (c, avctx);
- if (ARCH_BFIN) dsputil_init_bfin (c, avctx);
+ if (HAVE_MMX) ff_dsputil_init_mmx (c, avctx);
+ if (ARCH_ARM) ff_dsputil_init_arm (c, avctx);
+ if (HAVE_VIS) ff_dsputil_init_vis (c, avctx);
+ if (ARCH_ALPHA) ff_dsputil_init_alpha (c, avctx);
+ if (ARCH_PPC) ff_dsputil_init_ppc (c, avctx);
+ if (ARCH_SH4) ff_dsputil_init_sh4 (c, avctx);
+ if (ARCH_BFIN) ff_dsputil_init_bfin (c, avctx);
for (i = 0; i < 4; i++) {
for (j = 0; j < 16; j++) {
diff --git a/gst-libs/ext/libav/libavcodec/dsputil.h b/gst-libs/ext/libav/libavcodec/dsputil.h
index 3001609..57c8beb 100644
--- a/gst-libs/ext/libav/libavcodec/dsputil.h
+++ b/gst-libs/ext/libav/libavcodec/dsputil.h
@@ -38,21 +38,18 @@
/* dct code */
typedef short DCTELEM;
-void fdct_ifast (DCTELEM *data);
-void fdct_ifast248 (DCTELEM *data);
+void ff_fdct_ifast (DCTELEM *data);
+void ff_fdct_ifast248 (DCTELEM *data);
void ff_jpeg_fdct_islow_8(DCTELEM *data);
void ff_jpeg_fdct_islow_10(DCTELEM *data);
void ff_fdct248_islow_8(DCTELEM *data);
void ff_fdct248_islow_10(DCTELEM *data);
-void j_rev_dct (DCTELEM *data);
-void j_rev_dct4 (DCTELEM *data);
-void j_rev_dct2 (DCTELEM *data);
-void j_rev_dct1 (DCTELEM *data);
+void ff_j_rev_dct (DCTELEM *data);
void ff_wmv2_idct_c(DCTELEM *data);
void ff_fdct_mmx(DCTELEM *block);
-void ff_fdct_mmx2(DCTELEM *block);
+void ff_fdct_mmxext(DCTELEM *block);
void ff_fdct_sse2(DCTELEM *block);
#define H264_IDCT(depth) \
@@ -104,18 +101,6 @@ PUTAVG_PIXELS(10)
#define ff_put_pixels16x16_c ff_put_pixels16x16_8_c
#define ff_avg_pixels16x16_c ff_avg_pixels16x16_8_c
-/* VP3 DSP functions */
-void ff_vp3_idct_c(DCTELEM *block/* align 16*/);
-void ff_vp3_idct_put_c(uint8_t *dest/*align 8*/, int line_size, DCTELEM *block/*align 16*/);
-void ff_vp3_idct_add_c(uint8_t *dest/*align 8*/, int line_size, DCTELEM *block/*align 16*/);
-void ff_vp3_idct_dc_add_c(uint8_t *dest/*align 8*/, int line_size, const DCTELEM *block/*align 16*/);
-
-void ff_vp3_v_loop_filter_c(uint8_t *src, int stride, int *bounding_values);
-void ff_vp3_h_loop_filter_c(uint8_t *src, int stride, int *bounding_values);
-
-/* EA functions */
-void ff_ea_idct_put_c(uint8_t *dest, int linesize, DCTELEM *block);
-
/* RV40 functions */
void ff_put_rv40_qpel16_mc33_c(uint8_t *dst, uint8_t *src, int stride);
void ff_avg_rv40_qpel16_mc33_c(uint8_t *dst, uint8_t *src, int stride);
@@ -197,29 +182,12 @@ typedef struct ScanTable{
const uint8_t *scantable;
uint8_t permutated[64];
uint8_t raster_end[64];
-#if ARCH_PPC
- /** Used by dct_quantize_altivec to find last-non-zero */
- DECLARE_ALIGNED(16, uint8_t, inverse)[64];
-#endif
} ScanTable;
void ff_init_scantable(uint8_t *, ScanTable *st, const uint8_t *src_scantable);
void ff_init_scantable_permutation(uint8_t *idct_permutation,
int idct_permutation_type);
-#define EMULATED_EDGE(depth) \
-void ff_emulated_edge_mc_ ## depth (uint8_t *buf, const uint8_t *src, int linesize,\
- int block_w, int block_h,\
- int src_x, int src_y, int w, int h);
-
-EMULATED_EDGE(8)
-EMULATED_EDGE(9)
-EMULATED_EDGE(10)
-
-void ff_add_pixels_clamped_c(const DCTELEM *block, uint8_t *dest, int linesize);
-void ff_put_pixels_clamped_c(const DCTELEM *block, uint8_t *dest, int linesize);
-void ff_put_signed_pixels_clamped_c(const DCTELEM *block, uint8_t *dest, int linesize);
-
/**
* DSPContext.
*/
@@ -239,21 +207,6 @@ typedef struct DSPContext {
void (*add_pixels4)(uint8_t *pixels, DCTELEM *block, int line_size);
int (*sum_abs_dctelem)(DCTELEM *block/*align 16*/);
/**
- * Motion estimation with emulated edge values.
- * @param buf pointer to destination buffer (unaligned)
- * @param src pointer to pixel source (unaligned)
- * @param linesize width (in pixels) for src/buf
- * @param block_w number of pixels (per row) to copy to buf
- * @param block_h nummber of pixel rows to copy to buf
- * @param src_x offset of src to start of row - this may be negative
- * @param src_y offset of src to top of image - this may be negative
- * @param w width of src in pixels
- * @param h height of src in pixels
- */
- void (*emulated_edge_mc)(uint8_t *buf, const uint8_t *src, int linesize,
- int block_w, int block_h,
- int src_x, int src_y, int w, int h);
- /**
* translational global motion compensation.
*/
void (*gmc1)(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int srcStride, int h, int x16, int y16, int rounder);
@@ -378,7 +331,6 @@ typedef struct DSPContext {
/* huffyuv specific */
void (*add_bytes)(uint8_t *dst/*align 16*/, uint8_t *src/*align 16*/, int w);
- void (*add_bytes_l2)(uint8_t *dst/*align 16*/, uint8_t *src1/*align 16*/, uint8_t *src2/*align 16*/, int w);
void (*diff_bytes)(uint8_t *dst/*align 16*/, uint8_t *src1/*align 16*/, uint8_t *src2/*align 1*/,int w);
/**
* subtract huffyuv's variant of median prediction
@@ -388,8 +340,6 @@ typedef struct DSPContext {
void (*add_hfyu_median_prediction)(uint8_t *dst, const uint8_t *top, const uint8_t *diff, int w, int *left, int *left_top);
int (*add_hfyu_left_prediction)(uint8_t *dst, const uint8_t *src, int w, int left);
void (*add_hfyu_left_prediction_bgr32)(uint8_t *dst, const uint8_t *src, int w, int *red, int *green, int *blue, int *alpha);
- /* this might write to dst[w] */
- void (*add_png_paeth_prediction)(uint8_t *dst, uint8_t *src, uint8_t *top, int w, int bpp);
void (*bswap_buf)(uint32_t *dst, const uint32_t *src, int w);
void (*bswap16_buf)(uint16_t *dst, const uint16_t *src, int len);
@@ -398,18 +348,9 @@ typedef struct DSPContext {
void (*h261_loop_filter)(uint8_t *src, int stride);
- void (*x8_v_loop_filter)(uint8_t *src, int stride, int qscale);
- void (*x8_h_loop_filter)(uint8_t *src, int stride, int qscale);
-
- void (*vp3_idct_dc_add)(uint8_t *dest/*align 8*/, int line_size, const DCTELEM *block/*align 16*/);
- void (*vp3_v_loop_filter)(uint8_t *src, int stride, int *bounding_values);
- void (*vp3_h_loop_filter)(uint8_t *src, int stride, int *bounding_values);
-
/* assume len is a multiple of 4, and arrays are 16-byte aligned */
void (*vorbis_inverse_coupling)(float *mag, float *ang, int blocksize);
- void (*ac3_downmix)(float (*samples)[256], float (*matrix)[2], int out_ch, int in_ch, int len);
- /* assume len is a multiple of 8, and arrays are 16-byte aligned */
- void (*vector_fmul)(float *dst, const float *src0, const float *src1, int len);
+ /* assume len is a multiple of 16, and arrays are 32-byte aligned */
void (*vector_fmul_reverse)(float *dst, const float *src0, const float *src1, int len);
/* assume len is a multiple of 8, and src arrays are 16-byte aligned */
void (*vector_fmul_add)(float *dst, const float *src0, const float *src1, const float *src2, int len);
@@ -418,27 +359,6 @@ typedef struct DSPContext {
/* assume len is a multiple of 8, and arrays are 16-byte aligned */
void (*vector_clipf)(float *dst /* align 16 */, const float *src /* align 16 */, float min, float max, int len /* align 16 */);
/**
- * Multiply a vector of floats by a scalar float. Source and
- * destination vectors must overlap exactly or not at all.
- * @param dst result vector, 16-byte aligned
- * @param src input vector, 16-byte aligned
- * @param mul scalar value
- * @param len length of vector, multiple of 4
- */
- void (*vector_fmul_scalar)(float *dst, const float *src, float mul,
- int len);
- /**
- * Multiply a vector of floats by a scalar float and add to
- * destination vector. Source and destination vectors must
- * overlap exactly or not at all.
- * @param dst result vector, 16-byte aligned
- * @param src input vector, 16-byte aligned
- * @param mul scalar value
- * @param len length of vector, multiple of 4
- */
- void (*vector_fmac_scalar)(float *dst, const float *src, float mul,
- int len);
- /**
* Calculate the scalar product of two vectors of floats.
* @param v1 first vector, 16-byte aligned
* @param v2 second vector, 16-byte aligned
@@ -521,27 +441,13 @@ typedef struct DSPContext {
#define EDGE_TOP 1
#define EDGE_BOTTOM 2
- void (*prefetch)(void *mem, int stride, int h);
-
void (*shrink[4])(uint8_t *dst, int dst_wrap, const uint8_t *src, int src_wrap, int width, int height);
- /* mlp/truehd functions */
- void (*mlp_filter_channel)(int32_t *state, const int32_t *coeff,
- int firorder, int iirorder,
- unsigned int filter_shift, int32_t mask, int blocksize,
- int32_t *sample_buffer);
-
- /* intrax8 functions */
- void (*x8_spatial_compensation[12])(uint8_t *src , uint8_t *dst, int linesize);
- void (*x8_setup_spatial_compensation)(uint8_t *src, uint8_t *dst, int linesize,
- int * range, int * sum, int edges);
-
/**
* Calculate scalar product of two vectors.
* @param len length of vectors, should be multiple of 16
- * @param shift number of bits to discard from product
*/
- int32_t (*scalarproduct_int16)(const int16_t *v1, const int16_t *v2/*align 16*/, int len, int shift);
+ int32_t (*scalarproduct_int16)(const int16_t *v1, const int16_t *v2/*align 16*/, int len);
/* ape functions */
/**
* Calculate scalar product of v1 and v2,
@@ -571,9 +477,9 @@ typedef struct DSPContext {
* @param src source array
* constraints: 16-byte aligned
* @param min minimum value
- * constraints: must in the the range [-(1<<24), 1<<24]
+ * constraints: must be in the range [-(1 << 24), 1 << 24]
* @param max maximum value
- * constraints: must in the the range [-(1<<24), 1<<24]
+ * constraints: must be in the range [-(1 << 24), 1 << 24]
* @param len number of elements in the array
* constraints: multiple of 32 greater than zero
*/
@@ -583,12 +489,23 @@ typedef struct DSPContext {
op_fill_func fill_block_tab[2];
} DSPContext;
-void dsputil_static_init(void);
-void dsputil_init(DSPContext* p, AVCodecContext *avctx);
+void ff_dsputil_static_init(void);
+void ff_dsputil_init(DSPContext* p, AVCodecContext *avctx);
int ff_check_alignment(void);
/**
+ * Return the scalar product of two vectors.
+ *
+ * @param v1 first input vector
+ * @param v2 first input vector
+ * @param len number of elements
+ *
+ * @return sum of elementwise products
+ */
+float ff_scalarproduct_float_c(const float *v1, const float *v2, int len);
+
+/**
* permute block according to permuatation.
* @param last last non zero element in scantable order
*/
@@ -643,67 +560,48 @@ static inline int get_penalty_factor(int lambda, int lambda2, int type){
}
}
-void dsputil_init_alpha(DSPContext* c, AVCodecContext *avctx);
-void dsputil_init_arm(DSPContext* c, AVCodecContext *avctx);
-void dsputil_init_bfin(DSPContext* c, AVCodecContext *avctx);
-void dsputil_init_mlib(DSPContext* c, AVCodecContext *avctx);
-void dsputil_init_mmi(DSPContext* c, AVCodecContext *avctx);
-void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx);
-void dsputil_init_ppc(DSPContext* c, AVCodecContext *avctx);
-void dsputil_init_sh4(DSPContext* c, AVCodecContext *avctx);
-void dsputil_init_vis(DSPContext* c, AVCodecContext *avctx);
+void ff_dsputil_init_alpha(DSPContext* c, AVCodecContext *avctx);
+void ff_dsputil_init_arm(DSPContext* c, AVCodecContext *avctx);
+void ff_dsputil_init_bfin(DSPContext* c, AVCodecContext *avctx);
+void ff_dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx);
+void ff_dsputil_init_ppc(DSPContext* c, AVCodecContext *avctx);
+void ff_dsputil_init_sh4(DSPContext* c, AVCodecContext *avctx);
+void ff_dsputil_init_vis(DSPContext* c, AVCodecContext *avctx);
void ff_dsputil_init_dwt(DSPContext *c);
-void ff_intrax8dsp_init(DSPContext* c, AVCodecContext *avctx);
-void ff_mlp_init(DSPContext* c, AVCodecContext *avctx);
-void ff_mlp_init_x86(DSPContext* c, AVCodecContext *avctx);
-#if ARCH_ARM
-
-#if HAVE_NEON
+#if (ARCH_ARM && HAVE_NEON) || ARCH_PPC || HAVE_MMX
# define STRIDE_ALIGN 16
-#endif
-
-#elif ARCH_PPC
-
-#define STRIDE_ALIGN 16
-
-#elif HAVE_MMI
-
-#define STRIDE_ALIGN 16
-
-#endif
-
-#ifndef STRIDE_ALIGN
+#else
# define STRIDE_ALIGN 8
#endif
+// Some broken preprocessors need a second expansion
+// to be forced to tokenize __VA_ARGS__
+#define E(x) x
+
#define LOCAL_ALIGNED_A(a, t, v, s, o, ...) \
uint8_t la_##v[sizeof(t s o) + (a)]; \
t (*v) o = (void *)FFALIGN((uintptr_t)la_##v, a)
-#define LOCAL_ALIGNED_D(a, t, v, s, o, ...) DECLARE_ALIGNED(a, t, v) s o
+#define LOCAL_ALIGNED_D(a, t, v, s, o, ...) \
+ DECLARE_ALIGNED(a, t, la_##v) s o; \
+ t (*v) o = la_##v
-#define LOCAL_ALIGNED(a, t, v, ...) LOCAL_ALIGNED_A(a, t, v, __VA_ARGS__,,)
+#define LOCAL_ALIGNED(a, t, v, ...) E(LOCAL_ALIGNED_A(a, t, v, __VA_ARGS__,,))
#if HAVE_LOCAL_ALIGNED_8
-# define LOCAL_ALIGNED_8(t, v, ...) LOCAL_ALIGNED_D(8, t, v, __VA_ARGS__,,)
+# define LOCAL_ALIGNED_8(t, v, ...) E(LOCAL_ALIGNED_D(8, t, v, __VA_ARGS__,,))
#else
# define LOCAL_ALIGNED_8(t, v, ...) LOCAL_ALIGNED(8, t, v, __VA_ARGS__)
#endif
#if HAVE_LOCAL_ALIGNED_16
-# define LOCAL_ALIGNED_16(t, v, ...) LOCAL_ALIGNED_D(16, t, v, __VA_ARGS__,,)
+# define LOCAL_ALIGNED_16(t, v, ...) E(LOCAL_ALIGNED_D(16, t, v, __VA_ARGS__,,))
#else
# define LOCAL_ALIGNED_16(t, v, ...) LOCAL_ALIGNED(16, t, v, __VA_ARGS__)
#endif
-#define WRAPPER8_16(name8, name16)\
-static int name16(void /*MpegEncContext*/ *s, uint8_t *dst, uint8_t *src, int stride, int h){\
- return name8(s, dst , src , stride, h)\
- +name8(s, dst+8 , src+8 , stride, h);\
-}
-
#define WRAPPER8_16_SQ(name8, name16)\
static int name16(void /*MpegEncContext*/ *s, uint8_t *dst, uint8_t *src, int stride, int h){\
int score=0;\
@@ -724,7 +622,7 @@ static inline void copy_block2(uint8_t *dst, const uint8_t *src, int dstStride,
int i;
for(i=0; i<h; i++)
{
- AV_WN16(dst , AV_RN16(src ));
+ AV_COPY16U(dst, src);
dst+=dstStride;
src+=srcStride;
}
@@ -735,7 +633,7 @@ static inline void copy_block4(uint8_t *dst, const uint8_t *src, int dstStride,
int i;
for(i=0; i<h; i++)
{
- AV_WN32(dst , AV_RN32(src ));
+ AV_COPY32U(dst, src);
dst+=dstStride;
src+=srcStride;
}
@@ -746,8 +644,7 @@ static inline void copy_block8(uint8_t *dst, const uint8_t *src, int dstStride,
int i;
for(i=0; i<h; i++)
{
- AV_WN32(dst , AV_RN32(src ));
- AV_WN32(dst+4 , AV_RN32(src+4 ));
+ AV_COPY64U(dst, src);
dst+=dstStride;
src+=srcStride;
}
@@ -758,8 +655,7 @@ static inline void copy_block9(uint8_t *dst, const uint8_t *src, int dstStride,
int i;
for(i=0; i<h; i++)
{
- AV_WN32(dst , AV_RN32(src ));
- AV_WN32(dst+4 , AV_RN32(src+4 ));
+ AV_COPY64U(dst, src);
dst[8]= src[8];
dst+=dstStride;
src+=srcStride;
@@ -771,10 +667,7 @@ static inline void copy_block16(uint8_t *dst, const uint8_t *src, int dstStride,
int i;
for(i=0; i<h; i++)
{
- AV_WN32(dst , AV_RN32(src ));
- AV_WN32(dst+4 , AV_RN32(src+4 ));
- AV_WN32(dst+8 , AV_RN32(src+8 ));
- AV_WN32(dst+12, AV_RN32(src+12));
+ AV_COPY128U(dst, src);
dst+=dstStride;
src+=srcStride;
}
@@ -785,10 +678,7 @@ static inline void copy_block17(uint8_t *dst, const uint8_t *src, int dstStride,
int i;
for(i=0; i<h; i++)
{
- AV_WN32(dst , AV_RN32(src ));
- AV_WN32(dst+4 , AV_RN32(src+4 ));
- AV_WN32(dst+8 , AV_RN32(src+8 ));
- AV_WN32(dst+12, AV_RN32(src+12));
+ AV_COPY128U(dst, src);
dst[16]= src[16];
dst+=dstStride;
src+=srcStride;
diff --git a/gst-libs/ext/libav/libavcodec/dsputil_template.c b/gst-libs/ext/libav/libavcodec/dsputil_template.c
index 72ed6bf..13f7628 100644
--- a/gst-libs/ext/libav/libavcodec/dsputil_template.c
+++ b/gst-libs/ext/libav/libavcodec/dsputil_template.c
@@ -113,85 +113,6 @@ static void FUNCC(draw_edges)(uint8_t *_buf, int _wrap, int width, int height, i
memcpy(last_line + (i + 1) * wrap, last_line, (width + w + w) * sizeof(pixel)); // bottom
}
-/**
- * Copy a rectangular area of samples to a temporary buffer and replicate the border samples.
- * @param buf destination buffer
- * @param src source buffer
- * @param linesize number of bytes between 2 vertically adjacent samples in both the source and destination buffers
- * @param block_w width of block
- * @param block_h height of block
- * @param src_x x coordinate of the top left sample of the block in the source buffer
- * @param src_y y coordinate of the top left sample of the block in the source buffer
- * @param w width of the source buffer
- * @param h height of the source buffer
- */
-void FUNC(ff_emulated_edge_mc)(uint8_t *buf, const uint8_t *src, int linesize, int block_w, int block_h,
- int src_x, int src_y, int w, int h){
- int x, y;
- int start_y, start_x, end_y, end_x;
-
- if(src_y>= h){
- src+= (h-1-src_y)*linesize;
- src_y=h-1;
- }else if(src_y<=-block_h){
- src+= (1-block_h-src_y)*linesize;
- src_y=1-block_h;
- }
- if(src_x>= w){
- src+= (w-1-src_x)*sizeof(pixel);
- src_x=w-1;
- }else if(src_x<=-block_w){
- src+= (1-block_w-src_x)*sizeof(pixel);
- src_x=1-block_w;
- }
-
- start_y= FFMAX(0, -src_y);
- start_x= FFMAX(0, -src_x);
- end_y= FFMIN(block_h, h-src_y);
- end_x= FFMIN(block_w, w-src_x);
- assert(start_y < end_y && block_h);
- assert(start_x < end_x && block_w);
-
- w = end_x - start_x;
- src += start_y*linesize + start_x*sizeof(pixel);
- buf += start_x*sizeof(pixel);
-
- //top
- for(y=0; y<start_y; y++){
- memcpy(buf, src, w*sizeof(pixel));
- buf += linesize;
- }
-
- // copy existing part
- for(; y<end_y; y++){
- memcpy(buf, src, w*sizeof(pixel));
- src += linesize;
- buf += linesize;
- }
-
- //bottom
- src -= linesize;
- for(; y<block_h; y++){
- memcpy(buf, src, w*sizeof(pixel));
- buf += linesize;
- }
-
- buf -= block_h * linesize + start_x*sizeof(pixel);
- while (block_h--){
- pixel *bufp = (pixel*)buf;
- //left
- for(x=0; x<start_x; x++){
- bufp[x] = bufp[start_x];
- }
-
- //right
- for(x=end_x; x<block_w; x++){
- bufp[x] = bufp[end_x - 1];
- }
- buf += linesize;
- }
-}
-
#define DCTELEM_FUNCS(dctcoef, suffix) \
static void FUNCC(get_pixels ## suffix)(DCTELEM *restrict _block, \
const uint8_t *_pixels, \
diff --git a/gst-libs/ext/libav/libavcodec/dump_extradata_bsf.c b/gst-libs/ext/libav/libavcodec/dump_extradata_bsf.c
index ba77b15..17d9434 100644
--- a/gst-libs/ext/libav/libavcodec/dump_extradata_bsf.c
+++ b/gst-libs/ext/libav/libavcodec/dump_extradata_bsf.c
@@ -18,7 +18,10 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <string.h>
+
#include "avcodec.h"
+#include "libavutil/mem.h"
static int dump_extradata(AVBitStreamFilterContext *bsfc, AVCodecContext *avctx, const char *args,
diff --git a/gst-libs/ext/libav/libavcodec/dv.c b/gst-libs/ext/libav/libavcodec/dv.c
index 6f74e7b..0cbb106 100644
--- a/gst-libs/ext/libav/libavcodec/dv.c
+++ b/gst-libs/ext/libav/libavcodec/dv.c
@@ -42,42 +42,14 @@
#include "avcodec.h"
#include "dsputil.h"
#include "get_bits.h"
+#include "internal.h"
#include "put_bits.h"
#include "simple_idct.h"
#include "dvdata.h"
#include "dv_tablegen.h"
-//#undef NDEBUG
-//#include <assert.h>
-
-typedef struct DVVideoContext {
- const DVprofile *sys;
- AVFrame picture;
- AVCodecContext *avctx;
- uint8_t *buf;
-
- uint8_t dv_zigzag[2][64];
-
- void (*get_pixels)(DCTELEM *block, const uint8_t *pixels, int line_size);
- void (*fdct[2])(DCTELEM *block);
- void (*idct_put[2])(uint8_t *dest, int line_size, DCTELEM *block);
- me_cmp_func ildct_cmp;
-} DVVideoContext;
-
-#define TEX_VLC_BITS 9
-
/* XXX: also include quantization */
-static RL_VLC_ELEM dv_rl_vlc[1184];
-
-static inline int dv_work_pool_size(const DVprofile *d)
-{
- int size = d->n_difchan*d->difseg_size*27;
- if (DV_PROFILE_IS_1080i50(d))
- size -= 3*27;
- if (DV_PROFILE_IS_720p50(d))
- size -= 4*27;
- return size;
-}
+RL_VLC_ELEM ff_dv_rl_vlc[1184];
static inline void dv_calc_mb_coordinates(const DVprofile *d, int chan, int seq, int slot,
uint16_t *tbl)
@@ -165,19 +137,19 @@ static inline void dv_calc_mb_coordinates(const DVprofile *d, int chan, int seq,
break;
case 720:
switch (d->pix_fmt) {
- case PIX_FMT_YUV422P:
+ case AV_PIX_FMT_YUV422P:
x = shuf3[m] + slot/3;
y = serpent1[slot] +
((((seq + off[m]) % d->difseg_size)<<1) + chan)*3;
tbl[m] = (x<<1)|(y<<8);
break;
- case PIX_FMT_YUV420P:
+ case AV_PIX_FMT_YUV420P:
x = shuf3[m] + slot/3;
y = serpent1[slot] +
((seq + off[m]) % d->difseg_size)*3;
tbl[m] = (x<<1)|(y<<9);
break;
- case PIX_FMT_YUV411P:
+ case AV_PIX_FMT_YUV411P:
i = (seq + off[m]) % d->difseg_size;
k = slot + ((m==1||m==2)?3:0);
@@ -194,7 +166,16 @@ static inline void dv_calc_mb_coordinates(const DVprofile *d, int chan, int seq,
}
}
-static int dv_init_dynamic_tables(const DVprofile *d)
+/* quantization quanta by QNO for DV100 */
+static const uint8_t dv100_qstep[16] = {
+ 1, /* QNO = 0 and 1 both have no quantization */
+ 1,
+ 2, 3, 4, 5, 6, 7, 8, 16, 18, 20, 22, 24, 28, 52
+};
+
+static const uint8_t dv_quant_areas[4] = { 6, 21, 43, 64 };
+
+int ff_dv_init_dynamic_tables(const DVprofile *d)
{
int j,i,c,s,p;
uint32_t *factor1, *factor2;
@@ -222,11 +203,11 @@ static int dv_init_dynamic_tables(const DVprofile *d)
factor1 = &d->idct_factor[0];
factor2 = &d->idct_factor[DV_PROFILE_IS_HD(d)?4096:2816];
if (d->height == 720) {
- iweight1 = &dv_iweight_720_y[0];
- iweight2 = &dv_iweight_720_c[0];
+ iweight1 = &ff_dv_iweight_720_y[0];
+ iweight2 = &ff_dv_iweight_720_c[0];
} else {
- iweight1 = &dv_iweight_1080_y[0];
- iweight2 = &dv_iweight_1080_c[0];
+ iweight1 = &ff_dv_iweight_1080_y[0];
+ iweight2 = &ff_dv_iweight_1080_c[0];
}
if (DV_PROFILE_IS_HD(d)) {
for (c = 0; c < 4; c++) {
@@ -238,12 +219,12 @@ static int dv_init_dynamic_tables(const DVprofile *d)
}
}
} else {
- iweight1 = &dv_iweight_88[0];
- for (j = 0; j < 2; j++, iweight1 = &dv_iweight_248[0]) {
+ iweight1 = &ff_dv_iweight_88[0];
+ for (j = 0; j < 2; j++, iweight1 = &ff_dv_iweight_248[0]) {
for (s = 0; s < 22; s++) {
for (i = c = 0; c < 4; c++) {
for (; i < dv_quant_areas[c]; i++) {
- *factor1 = iweight1[i] << (dv_quant_shifts[s][c] + 1);
+ *factor1 = iweight1[i] << (ff_dv_quant_shifts[s][c] + 1);
*factor2++ = (*factor1++) << 1;
}
}
@@ -255,7 +236,7 @@ static int dv_init_dynamic_tables(const DVprofile *d)
return 0;
}
-static av_cold int dvvideo_init(AVCodecContext *avctx)
+av_cold int ff_dvvideo_init(AVCodecContext *avctx)
{
DVVideoContext *s = avctx->priv_data;
DSPContext dsp;
@@ -308,17 +289,15 @@ static av_cold int dvvideo_init(AVCodecContext *avctx)
run = new_dv_vlc_run [code] + 1;
level = new_dv_vlc_level[code];
}
- dv_rl_vlc[i].len = len;
- dv_rl_vlc[i].level = level;
- dv_rl_vlc[i].run = run;
+ ff_dv_rl_vlc[i].len = len;
+ ff_dv_rl_vlc[i].level = level;
+ ff_dv_rl_vlc[i].run = run;
}
ff_free_vlc(&dv_vlc);
-
- dv_vlc_map_tableinit();
}
/* Generic DSP setup */
- dsputil_init(&dsp, avctx);
+ ff_dsputil_init(&dsp, avctx);
ff_set_cmp(&dsp, dsp.ildct_cmp, avctx->ildct_cmp);
s->get_pixels = dsp.get_pixels;
s->ildct_cmp = dsp.ildct_cmp[5];
@@ -332,13 +311,7 @@ static av_cold int dvvideo_init(AVCodecContext *avctx)
/* 248DCT setup */
s->fdct[1] = dsp.fdct248;
s->idct_put[1] = ff_simple_idct248_put; // FIXME: need to add it to DSP
- if (avctx->lowres){
- for (i = 0; i < 64; i++){
- int j = ff_zigzag248_direct[i];
- s->dv_zigzag[1][i] = dsp.idct_permutation[(j & 7) + (j & 8) * 4 + (j & 48) / 2];
- }
- }else
- memcpy(s->dv_zigzag[1], ff_zigzag248_direct, 64);
+ memcpy(s->dv_zigzag[1], ff_zigzag248_direct, 64);
avctx->coded_frame = &s->picture;
s->avctx = avctx;
@@ -350,290 +323,22 @@ static av_cold int dvvideo_init(AVCodecContext *avctx)
static av_cold int dvvideo_init_encoder(AVCodecContext *avctx)
{
if (!avpriv_dv_codec_profile(avctx)) {
- av_log(avctx, AV_LOG_ERROR, "Found no DV profile for %ix%i %s video\n",
+ av_log(avctx, AV_LOG_ERROR, "Found no DV profile for %ix%i %s video. "
+ "Valid DV profiles are:\n",
avctx->width, avctx->height, av_get_pix_fmt_name(avctx->pix_fmt));
- return -1;
+ ff_dv_print_profiles(avctx, AV_LOG_ERROR);
+ return AVERROR(EINVAL);
}
- return dvvideo_init(avctx);
-}
+ dv_vlc_map_tableinit();
-typedef struct BlockInfo {
- const uint32_t *factor_table;
- const uint8_t *scan_table;
- uint8_t pos; /* position in block */
- void (*idct_put)(uint8_t *dest, int line_size, DCTELEM *block);
- uint8_t partial_bit_count;
- uint32_t partial_bit_buffer;
- int shift_offset;
-} BlockInfo;
+ return ff_dvvideo_init(avctx);
+}
/* bit budget for AC only in 5 MBs */
static const int vs_total_ac_bits = (100 * 4 + 68*2) * 5;
static const int mb_area_start[5] = { 1, 6, 21, 43, 64 };
-/* decode AC coefficients */
-static void dv_decode_ac(GetBitContext *gb, BlockInfo *mb, DCTELEM *block)
-{
- int last_index = gb->size_in_bits;
- const uint8_t *scan_table = mb->scan_table;
- const uint32_t *factor_table = mb->factor_table;
- int pos = mb->pos;
- int partial_bit_count = mb->partial_bit_count;
- int level, run, vlc_len, index;
-
- OPEN_READER(re, gb);
- UPDATE_CACHE(re, gb);
-
- /* if we must parse a partial VLC, we do it here */
- if (partial_bit_count > 0) {
- re_cache = re_cache >> partial_bit_count | mb->partial_bit_buffer;
- re_index -= partial_bit_count;
- mb->partial_bit_count = 0;
- }
-
- /* get the AC coefficients until last_index is reached */
- for (;;) {
- av_dlog(NULL, "%2d: bits=%04x index=%d\n", pos, SHOW_UBITS(re, gb, 16),
- re_index);
- /* our own optimized GET_RL_VLC */
- index = NEG_USR32(re_cache, TEX_VLC_BITS);
- vlc_len = dv_rl_vlc[index].len;
- if (vlc_len < 0) {
- index = NEG_USR32((unsigned)re_cache << TEX_VLC_BITS, -vlc_len) + dv_rl_vlc[index].level;
- vlc_len = TEX_VLC_BITS - vlc_len;
- }
- level = dv_rl_vlc[index].level;
- run = dv_rl_vlc[index].run;
-
- /* gotta check if we're still within gb boundaries */
- if (re_index + vlc_len > last_index) {
- /* should be < 16 bits otherwise a codeword could have been parsed */
- mb->partial_bit_count = last_index - re_index;
- mb->partial_bit_buffer = re_cache & ~(-1u >> mb->partial_bit_count);
- re_index = last_index;
- break;
- }
- re_index += vlc_len;
-
- av_dlog(NULL, "run=%d level=%d\n", run, level);
- pos += run;
- if (pos >= 64)
- break;
-
- level = (level * factor_table[pos] + (1 << (dv_iweight_bits - 1))) >> dv_iweight_bits;
- block[scan_table[pos]] = level;
-
- UPDATE_CACHE(re, gb);
- }
- CLOSE_READER(re, gb);
- mb->pos = pos;
-}
-
-static inline void bit_copy(PutBitContext *pb, GetBitContext *gb)
-{
- int bits_left = get_bits_left(gb);
- while (bits_left >= MIN_CACHE_BITS) {
- put_bits(pb, MIN_CACHE_BITS, get_bits(gb, MIN_CACHE_BITS));
- bits_left -= MIN_CACHE_BITS;
- }
- if (bits_left > 0) {
- put_bits(pb, bits_left, get_bits(gb, bits_left));
- }
-}
-
-static inline void dv_calculate_mb_xy(DVVideoContext *s, DVwork_chunk *work_chunk, int m, int *mb_x, int *mb_y)
-{
- *mb_x = work_chunk->mb_coordinates[m] & 0xff;
- *mb_y = work_chunk->mb_coordinates[m] >> 8;
-
- /* We work with 720p frames split in half. The odd half-frame (chan==2,3) is displaced :-( */
- if (s->sys->height == 720 && !(s->buf[1]&0x0C)) {
- *mb_y -= (*mb_y>17)?18:-72; /* shifting the Y coordinate down by 72/2 macro blocks */
- }
-}
-
-/* mb_x and mb_y are in units of 8 pixels */
-static int dv_decode_video_segment(AVCodecContext *avctx, void *arg)
-{
- DVVideoContext *s = avctx->priv_data;
- DVwork_chunk *work_chunk = arg;
- int quant, dc, dct_mode, class1, j;
- int mb_index, mb_x, mb_y, last_index;
- int y_stride, linesize;
- DCTELEM *block, *block1;
- int c_offset;
- uint8_t *y_ptr;
- const uint8_t *buf_ptr;
- PutBitContext pb, vs_pb;
- GetBitContext gb;
- BlockInfo mb_data[5 * DV_MAX_BPM], *mb, *mb1;
- LOCAL_ALIGNED_16(DCTELEM, sblock, [5*DV_MAX_BPM], [64]);
- LOCAL_ALIGNED_16(uint8_t, mb_bit_buffer, [ 80 + FF_INPUT_BUFFER_PADDING_SIZE]); /* allow some slack */
- LOCAL_ALIGNED_16(uint8_t, vs_bit_buffer, [5*80 + FF_INPUT_BUFFER_PADDING_SIZE]); /* allow some slack */
- const int log2_blocksize = 3-s->avctx->lowres;
- int is_field_mode[5];
-
- assert((((int)mb_bit_buffer) & 7) == 0);
- assert((((int)vs_bit_buffer) & 7) == 0);
-
- memset(sblock, 0, 5*DV_MAX_BPM*sizeof(*sblock));
-
- /* pass 1: read DC and AC coefficients in blocks */
- buf_ptr = &s->buf[work_chunk->buf_offset*80];
- block1 = &sblock[0][0];
- mb1 = mb_data;
- init_put_bits(&vs_pb, vs_bit_buffer, 5 * 80);
- for (mb_index = 0; mb_index < 5; mb_index++, mb1 += s->sys->bpm, block1 += s->sys->bpm * 64) {
- /* skip header */
- quant = buf_ptr[3] & 0x0f;
- buf_ptr += 4;
- init_put_bits(&pb, mb_bit_buffer, 80);
- mb = mb1;
- block = block1;
- is_field_mode[mb_index] = 0;
- for (j = 0; j < s->sys->bpm; j++) {
- last_index = s->sys->block_sizes[j];
- init_get_bits(&gb, buf_ptr, last_index);
-
- /* get the DC */
- dc = get_sbits(&gb, 9);
- dct_mode = get_bits1(&gb);
- class1 = get_bits(&gb, 2);
- if (DV_PROFILE_IS_HD(s->sys)) {
- mb->idct_put = s->idct_put[0];
- mb->scan_table = s->dv_zigzag[0];
- mb->factor_table = &s->sys->idct_factor[(j >= 4)*4*16*64 + class1*16*64 + quant*64];
- is_field_mode[mb_index] |= !j && dct_mode;
- } else {
- mb->idct_put = s->idct_put[dct_mode && log2_blocksize == 3];
- mb->scan_table = s->dv_zigzag[dct_mode];
- mb->factor_table = &s->sys->idct_factor[(class1 == 3)*2*22*64 + dct_mode*22*64 +
- (quant + dv_quant_offset[class1])*64];
- }
- dc = dc << 2;
- /* convert to unsigned because 128 is not added in the
- standard IDCT */
- dc += 1024;
- block[0] = dc;
- buf_ptr += last_index >> 3;
- mb->pos = 0;
- mb->partial_bit_count = 0;
-
- av_dlog(avctx, "MB block: %d, %d ", mb_index, j);
- dv_decode_ac(&gb, mb, block);
-
- /* write the remaining bits in a new buffer only if the
- block is finished */
- if (mb->pos >= 64)
- bit_copy(&pb, &gb);
-
- block += 64;
- mb++;
- }
-
- /* pass 2: we can do it just after */
- av_dlog(avctx, "***pass 2 size=%d MB#=%d\n", put_bits_count(&pb), mb_index);
- block = block1;
- mb = mb1;
- init_get_bits(&gb, mb_bit_buffer, put_bits_count(&pb));
- put_bits32(&pb, 0); // padding must be zeroed
- flush_put_bits(&pb);
- for (j = 0; j < s->sys->bpm; j++, block += 64, mb++) {
- if (mb->pos < 64 && get_bits_left(&gb) > 0) {
- dv_decode_ac(&gb, mb, block);
- /* if still not finished, no need to parse other blocks */
- if (mb->pos < 64)
- break;
- }
- }
- /* all blocks are finished, so the extra bytes can be used at
- the video segment level */
- if (j >= s->sys->bpm)
- bit_copy(&vs_pb, &gb);
- }
-
- /* we need a pass over the whole video segment */
- av_dlog(avctx, "***pass 3 size=%d\n", put_bits_count(&vs_pb));
- block = &sblock[0][0];
- mb = mb_data;
- init_get_bits(&gb, vs_bit_buffer, put_bits_count(&vs_pb));
- put_bits32(&vs_pb, 0); // padding must be zeroed
- flush_put_bits(&vs_pb);
- for (mb_index = 0; mb_index < 5; mb_index++) {
- for (j = 0; j < s->sys->bpm; j++) {
- if (mb->pos < 64) {
- av_dlog(avctx, "start %d:%d\n", mb_index, j);
- dv_decode_ac(&gb, mb, block);
- }
- if (mb->pos >= 64 && mb->pos < 127)
- av_log(avctx, AV_LOG_ERROR, "AC EOB marker is absent pos=%d\n", mb->pos);
- block += 64;
- mb++;
- }
- }
-
- /* compute idct and place blocks */
- block = &sblock[0][0];
- mb = mb_data;
- for (mb_index = 0; mb_index < 5; mb_index++) {
- dv_calculate_mb_xy(s, work_chunk, mb_index, &mb_x, &mb_y);
-
- /* idct_put'ting luminance */
- if ((s->sys->pix_fmt == PIX_FMT_YUV420P) ||
- (s->sys->pix_fmt == PIX_FMT_YUV411P && mb_x >= (704 / 8)) ||
- (s->sys->height >= 720 && mb_y != 134)) {
- y_stride = (s->picture.linesize[0] << ((!is_field_mode[mb_index]) * log2_blocksize));
- } else {
- y_stride = (2 << log2_blocksize);
- }
- y_ptr = s->picture.data[0] + ((mb_y * s->picture.linesize[0] + mb_x) << log2_blocksize);
- linesize = s->picture.linesize[0] << is_field_mode[mb_index];
- mb[0] .idct_put(y_ptr , linesize, block + 0*64);
- if (s->sys->video_stype == 4) { /* SD 422 */
- mb[2].idct_put(y_ptr + (1 << log2_blocksize) , linesize, block + 2*64);
- } else {
- mb[1].idct_put(y_ptr + (1 << log2_blocksize) , linesize, block + 1*64);
- mb[2].idct_put(y_ptr + y_stride, linesize, block + 2*64);
- mb[3].idct_put(y_ptr + (1 << log2_blocksize) + y_stride, linesize, block + 3*64);
- }
- mb += 4;
- block += 4*64;
-
- /* idct_put'ting chrominance */
- c_offset = (((mb_y >> (s->sys->pix_fmt == PIX_FMT_YUV420P)) * s->picture.linesize[1] +
- (mb_x >> ((s->sys->pix_fmt == PIX_FMT_YUV411P) ? 2 : 1))) << log2_blocksize);
- for (j = 2; j; j--) {
- uint8_t *c_ptr = s->picture.data[j] + c_offset;
- if (s->sys->pix_fmt == PIX_FMT_YUV411P && mb_x >= (704 / 8)) {
- uint64_t aligned_pixels[64/8];
- uint8_t *pixels = (uint8_t*)aligned_pixels;
- uint8_t *c_ptr1, *ptr1;
- int x, y;
- mb->idct_put(pixels, 8, block);
- for (y = 0; y < (1 << log2_blocksize); y++, c_ptr += s->picture.linesize[j], pixels += 8) {
- ptr1 = pixels + (1 << (log2_blocksize - 1));
- c_ptr1 = c_ptr + (s->picture.linesize[j] << log2_blocksize);
- for (x = 0; x < (1 << (log2_blocksize - 1)); x++) {
- c_ptr[x] = pixels[x];
- c_ptr1[x] = ptr1[x];
- }
- }
- block += 64; mb++;
- } else {
- y_stride = (mb_y == 134) ? (1 << log2_blocksize) :
- s->picture.linesize[j] << ((!is_field_mode[mb_index]) * log2_blocksize);
- linesize = s->picture.linesize[j] << is_field_mode[mb_index];
- (mb++)-> idct_put(c_ptr , linesize, block); block += 64;
- if (s->sys->bpm == 8) {
- (mb++)->idct_put(c_ptr + y_stride, linesize, block); block += 64;
- }
- }
- }
- }
- return 0;
-}
-
#if CONFIG_SMALL
/* Converts run and level (where level != 0) pair into VLC, returning bit size */
static av_always_inline int dv_rl2vlc(int run, int level, int sign, uint32_t* vlc)
@@ -759,6 +464,28 @@ static av_always_inline int dv_guess_dct_mode(DVVideoContext *s, uint8_t *data,
return 0;
}
+static const int dv_weight_bits = 18;
+static const int dv_weight_88[64] = {
+ 131072, 257107, 257107, 242189, 252167, 242189, 235923, 237536,
+ 237536, 235923, 229376, 231390, 223754, 231390, 229376, 222935,
+ 224969, 217965, 217965, 224969, 222935, 200636, 218652, 211916,
+ 212325, 211916, 218652, 200636, 188995, 196781, 205965, 206433,
+ 206433, 205965, 196781, 188995, 185364, 185364, 200636, 200704,
+ 200636, 185364, 185364, 174609, 180568, 195068, 195068, 180568,
+ 174609, 170091, 175557, 189591, 175557, 170091, 165371, 170627,
+ 170627, 165371, 160727, 153560, 160727, 144651, 144651, 136258,
+};
+static const int dv_weight_248[64] = {
+ 131072, 242189, 257107, 237536, 229376, 200636, 242189, 223754,
+ 224969, 196781, 262144, 242189, 229376, 200636, 257107, 237536,
+ 211916, 185364, 235923, 217965, 229376, 211916, 206433, 180568,
+ 242189, 223754, 224969, 196781, 211916, 185364, 235923, 217965,
+ 200704, 175557, 222935, 205965, 200636, 185364, 195068, 170627,
+ 229376, 211916, 206433, 180568, 200704, 175557, 222935, 205965,
+ 175557, 153560, 188995, 174609, 165371, 144651, 200636, 185364,
+ 195068, 170627, 175557, 153560, 188995, 174609, 165371, 144651,
+};
+
static av_always_inline int dv_init_enc_block(EncBlockInfo* bi, uint8_t *data, int linesize, DVVideoContext *s, int bias)
{
const int *weight;
@@ -870,7 +597,7 @@ static inline void dv_guess_qnos(EncBlockInfo* blks, int* qnos)
size[i] = 0;
for (j = 0; j < 6; j++, b++) {
for (a = 0; a < 4; a++) {
- if (b->area_q[a] != dv_quant_shifts[qnos[i] + dv_quant_offset[b->cno]][a]) {
+ if (b->area_q[a] != ff_dv_quant_shifts[qnos[i] + ff_dv_quant_offset[b->cno]][a]) {
b->bit_size[a] = 1; // 4 areas 4 bits for EOB :)
b->area_q[a]++;
prev = b->prev[a];
@@ -930,7 +657,7 @@ static int dv_encode_video_segment(AVCodecContext *avctx, void *arg)
int mb_x, mb_y, c_offset, linesize, y_stride;
uint8_t* y_ptr;
uint8_t* dif;
- LOCAL_ALIGNED_8(uint8_t, scratch, [64]);
+ LOCAL_ALIGNED_8(uint8_t, scratch, [128]);
EncBlockInfo enc_blks[5*DV_MAX_BPM];
PutBitContext pbs[5*DV_MAX_BPM];
PutBitContext* pb;
@@ -945,8 +672,8 @@ static int dv_encode_video_segment(AVCodecContext *avctx, void *arg)
dv_calculate_mb_xy(s, work_chunk, mb_index, &mb_x, &mb_y);
/* initializing luminance blocks */
- if ((s->sys->pix_fmt == PIX_FMT_YUV420P) ||
- (s->sys->pix_fmt == PIX_FMT_YUV411P && mb_x >= (704 / 8)) ||
+ if ((s->sys->pix_fmt == AV_PIX_FMT_YUV420P) ||
+ (s->sys->pix_fmt == AV_PIX_FMT_YUV411P && mb_x >= (704 / 8)) ||
(s->sys->height >= 720 && mb_y != 134)) {
y_stride = s->picture.linesize[0] << 3;
} else {
@@ -971,13 +698,13 @@ static int dv_encode_video_segment(AVCodecContext *avctx, void *arg)
enc_blk += 4;
/* initializing chrominance blocks */
- c_offset = (((mb_y >> (s->sys->pix_fmt == PIX_FMT_YUV420P)) * s->picture.linesize[1] +
- (mb_x >> ((s->sys->pix_fmt == PIX_FMT_YUV411P) ? 2 : 1))) << 3);
+ c_offset = (((mb_y >> (s->sys->pix_fmt == AV_PIX_FMT_YUV420P)) * s->picture.linesize[1] +
+ (mb_x >> ((s->sys->pix_fmt == AV_PIX_FMT_YUV411P) ? 2 : 1))) << 3);
for (j = 2; j; j--) {
uint8_t *c_ptr = s->picture.data[j] + c_offset;
linesize = s->picture.linesize[j];
y_stride = (mb_y == 134) ? 8 : (s->picture.linesize[j] << 3);
- if (s->sys->pix_fmt == PIX_FMT_YUV411P && mb_x >= (704 / 8)) {
+ if (s->sys->pix_fmt == AV_PIX_FMT_YUV411P && mb_x >= (704 / 8)) {
uint8_t* d;
uint8_t* b = scratch;
for (i = 0; i < 8; i++) {
@@ -985,10 +712,10 @@ static int dv_encode_video_segment(AVCodecContext *avctx, void *arg)
b[0] = c_ptr[0]; b[1] = c_ptr[1]; b[2] = c_ptr[2]; b[3] = c_ptr[3];
b[4] = d[0]; b[5] = d[1]; b[6] = d[2]; b[7] = d[3];
c_ptr += linesize;
- b += 8;
+ b += 16;
}
c_ptr = scratch;
- linesize = 8;
+ linesize = 16;
}
vs_bit_size += dv_init_enc_block( enc_blk++, c_ptr , linesize, s, 1);
@@ -1053,64 +780,6 @@ static int dv_encode_video_segment(AVCodecContext *avctx, void *arg)
return 0;
}
-#if CONFIG_DVVIDEO_DECODER
-/* NOTE: exactly one frame must be given (120000 bytes for NTSC,
- 144000 bytes for PAL - or twice those for 50Mbps) */
-static int dvvideo_decode_frame(AVCodecContext *avctx,
- void *data, int *data_size,
- AVPacket *avpkt)
-{
- const uint8_t *buf = avpkt->data;
- int buf_size = avpkt->size;
- DVVideoContext *s = avctx->priv_data;
- const uint8_t* vsc_pack;
- int apt, is16_9;
-
- s->sys = avpriv_dv_frame_profile(s->sys, buf, buf_size);
- if (!s->sys || buf_size < s->sys->frame_size || dv_init_dynamic_tables(s->sys)) {
- av_log(avctx, AV_LOG_ERROR, "could not find dv frame profile\n");
- return -1; /* NOTE: we only accept several full frames */
- }
-
- if (s->picture.data[0])
- avctx->release_buffer(avctx, &s->picture);
-
- s->picture.reference = 0;
- s->picture.key_frame = 1;
- s->picture.pict_type = AV_PICTURE_TYPE_I;
- avctx->pix_fmt = s->sys->pix_fmt;
- avctx->time_base = s->sys->time_base;
- avcodec_set_dimensions(avctx, s->sys->width, s->sys->height);
- if (avctx->get_buffer(avctx, &s->picture) < 0) {
- av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
- return -1;
- }
- s->picture.interlaced_frame = 1;
- s->picture.top_field_first = 0;
-
- s->buf = buf;
- avctx->execute(avctx, dv_decode_video_segment, s->sys->work_chunks, NULL,
- dv_work_pool_size(s->sys), sizeof(DVwork_chunk));
-
- emms_c();
-
- /* return image */
- *data_size = sizeof(AVFrame);
- *(AVFrame*)data = s->picture;
-
- /* Determine the codec's sample_aspect ratio from the packet */
- vsc_pack = buf + 80*5 + 48 + 5;
- if ( *vsc_pack == dv_video_control ) {
- apt = buf[4] & 0x07;
- is16_9 = (vsc_pack && ((vsc_pack[2] & 0x07) == 0x02 || (!apt && (vsc_pack[2] & 0x07) == 0x07)));
- avctx->sample_aspect_ratio = s->sys->sar[is16_9];
- }
-
- return s->sys->frame_size;
-}
-#endif /* CONFIG_DVVIDEO_DECODER */
-
-
static inline int dv_write_pack(enum dv_pack_type pack_id, DVVideoContext *c,
uint8_t* buf)
{
@@ -1132,7 +801,7 @@ static inline int dv_write_pack(enum dv_pack_type pack_id, DVVideoContext *c,
* 2. It is not at all clear what STYPE is used for 4:2:0 PAL
* compression scheme (if any).
*/
- int apt = (c->sys->pix_fmt == PIX_FMT_YUV420P ? 0 : 1);
+ int apt = (c->sys->pix_fmt == AV_PIX_FMT_YUV420P ? 0 : 1);
uint8_t aspect = 0;
if ((int)(av_q2d(c->avctx->sample_aspect_ratio) * c->avctx->width / c->avctx->height * 10) >= 17) /* 16:9 */
@@ -1184,6 +853,41 @@ static inline int dv_write_pack(enum dv_pack_type pack_id, DVVideoContext *c,
}
#if CONFIG_DVVIDEO_ENCODER
+static inline int dv_write_dif_id(enum dv_section_type t, uint8_t chan_num,
+ uint8_t seq_num, uint8_t dif_num,
+ uint8_t* buf)
+{
+ buf[0] = (uint8_t)t; /* Section type */
+ buf[1] = (seq_num << 4) | /* DIF seq number 0-9 for 525/60; 0-11 for 625/50 */
+ (chan_num << 3) | /* FSC: for 50Mb/s 0 - first channel; 1 - second */
+ 7; /* reserved -- always 1 */
+ buf[2] = dif_num; /* DIF block number Video: 0-134, Audio: 0-8 */
+ return 3;
+}
+
+
+static inline int dv_write_ssyb_id(uint8_t syb_num, uint8_t fr, uint8_t* buf)
+{
+ if (syb_num == 0 || syb_num == 6) {
+ buf[0] = (fr << 7) | /* FR ID 1 - first half of each channel; 0 - second */
+ (0 << 4) | /* AP3 (Subcode application ID) */
+ 0x0f; /* reserved -- always 1 */
+ }
+ else if (syb_num == 11) {
+ buf[0] = (fr << 7) | /* FR ID 1 - first half of each channel; 0 - second */
+ 0x7f; /* reserved -- always 1 */
+ }
+ else {
+ buf[0] = (fr << 7) | /* FR ID 1 - first half of each channel; 0 - second */
+ (0 << 4) | /* APT (Track application ID) */
+ 0x0f; /* reserved -- always 1 */
+ }
+ buf[1] = 0xf0 | /* reserved -- always 1 */
+ (syb_num & 0x0f); /* SSYB number 0 - 11 */
+ buf[2] = 0xff; /* reserved -- always 1 */
+ return 3;
+}
+
static void dv_format_frame(DVVideoContext* c, uint8_t* buf)
{
int chan, i, j, k;
@@ -1234,68 +938,50 @@ static void dv_format_frame(DVVideoContext* c, uint8_t* buf)
}
-static int dvvideo_encode_frame(AVCodecContext *c, uint8_t *buf, int buf_size,
- void *data)
+static int dvvideo_encode_frame(AVCodecContext *c, AVPacket *pkt,
+ const AVFrame *frame, int *got_packet)
{
DVVideoContext *s = c->priv_data;
+ int ret;
s->sys = avpriv_dv_codec_profile(c);
- if (!s->sys || buf_size < s->sys->frame_size || dv_init_dynamic_tables(s->sys))
+ if (!s->sys || ff_dv_init_dynamic_tables(s->sys))
return -1;
+ if ((ret = ff_alloc_packet(pkt, s->sys->frame_size)) < 0) {
+ av_log(c, AV_LOG_ERROR, "Error getting output packet.\n");
+ return ret;
+ }
c->pix_fmt = s->sys->pix_fmt;
- s->picture = *((AVFrame *)data);
+ s->picture = *frame;
s->picture.key_frame = 1;
s->picture.pict_type = AV_PICTURE_TYPE_I;
- s->buf = buf;
+ s->buf = pkt->data;
c->execute(c, dv_encode_video_segment, s->sys->work_chunks, NULL,
dv_work_pool_size(s->sys), sizeof(DVwork_chunk));
emms_c();
- dv_format_frame(s, buf);
-
- return s->sys->frame_size;
-}
-#endif
-
-static int dvvideo_close(AVCodecContext *c)
-{
- DVVideoContext *s = c->priv_data;
+ dv_format_frame(s, pkt->data);
- if (s->picture.data[0])
- c->release_buffer(c, &s->picture);
+ pkt->flags |= AV_PKT_FLAG_KEY;
+ *got_packet = 1;
return 0;
}
-
-#if CONFIG_DVVIDEO_ENCODER
AVCodec ff_dvvideo_encoder = {
.name = "dvvideo",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_DVVIDEO,
+ .id = AV_CODEC_ID_DVVIDEO,
.priv_data_size = sizeof(DVVideoContext),
.init = dvvideo_init_encoder,
- .encode = dvvideo_encode_frame,
- .capabilities = CODEC_CAP_SLICE_THREADS,
- .pix_fmts = (const enum PixelFormat[]) {PIX_FMT_YUV411P, PIX_FMT_YUV422P, PIX_FMT_YUV420P, PIX_FMT_NONE},
- .long_name = NULL_IF_CONFIG_SMALL("DV (Digital Video)"),
+ .encode2 = dvvideo_encode_frame,
+ .capabilities = CODEC_CAP_SLICE_THREADS,
+ .pix_fmts = (const enum AVPixelFormat[]) {
+ AV_PIX_FMT_YUV411P, AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUV420P, AV_PIX_FMT_NONE
+ },
+ .long_name = NULL_IF_CONFIG_SMALL("DV (Digital Video)"),
};
#endif // CONFIG_DVVIDEO_ENCODER
-
-#if CONFIG_DVVIDEO_DECODER
-AVCodec ff_dvvideo_decoder = {
- .name = "dvvideo",
- .type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_DVVIDEO,
- .priv_data_size = sizeof(DVVideoContext),
- .init = dvvideo_init,
- .close = dvvideo_close,
- .decode = dvvideo_decode_frame,
- .capabilities = CODEC_CAP_DR1 | CODEC_CAP_SLICE_THREADS,
- .max_lowres = 3,
- .long_name = NULL_IF_CONFIG_SMALL("DV (Digital Video)"),
-};
-#endif
diff --git a/gst-libs/ext/libav/libavcodec/dv_profile.c b/gst-libs/ext/libav/libavcodec/dv_profile.c
new file mode 100644
index 0000000..be392bb
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/dv_profile.c
@@ -0,0 +1,332 @@
+/*
+ * 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
+ */
+
+#include <stdint.h>
+
+#include "libavutil/common.h"
+#include "libavutil/log.h"
+#include "libavutil/pixdesc.h"
+#include "avcodec.h"
+#include "dv_profile.h"
+
+static DVwork_chunk work_chunks_dv25pal [1*12*27];
+static DVwork_chunk work_chunks_dv25pal411[1*12*27];
+static DVwork_chunk work_chunks_dv25ntsc [1*10*27];
+static DVwork_chunk work_chunks_dv50pal [2*12*27];
+static DVwork_chunk work_chunks_dv50ntsc [2*10*27];
+static DVwork_chunk work_chunks_dv100palp [2*12*27];
+static DVwork_chunk work_chunks_dv100ntscp[2*10*27];
+static DVwork_chunk work_chunks_dv100pali [4*12*27];
+static DVwork_chunk work_chunks_dv100ntsci[4*10*27];
+
+static uint32_t dv_idct_factor_sd [2*2*22*64];
+static uint32_t dv_idct_factor_hd1080[2*4*16*64];
+static uint32_t dv_idct_factor_hd720 [2*4*16*64];
+
+static const uint8_t dv_audio_shuffle525[10][9] = {
+ { 0, 30, 60, 20, 50, 80, 10, 40, 70 }, /* 1st channel */
+ { 6, 36, 66, 26, 56, 86, 16, 46, 76 },
+ { 12, 42, 72, 2, 32, 62, 22, 52, 82 },
+ { 18, 48, 78, 8, 38, 68, 28, 58, 88 },
+ { 24, 54, 84, 14, 44, 74, 4, 34, 64 },
+
+ { 1, 31, 61, 21, 51, 81, 11, 41, 71 }, /* 2nd channel */
+ { 7, 37, 67, 27, 57, 87, 17, 47, 77 },
+ { 13, 43, 73, 3, 33, 63, 23, 53, 83 },
+ { 19, 49, 79, 9, 39, 69, 29, 59, 89 },
+ { 25, 55, 85, 15, 45, 75, 5, 35, 65 },
+};
+
+static const uint8_t dv_audio_shuffle625[12][9] = {
+ { 0, 36, 72, 26, 62, 98, 16, 52, 88}, /* 1st channel */
+ { 6, 42, 78, 32, 68, 104, 22, 58, 94},
+ { 12, 48, 84, 2, 38, 74, 28, 64, 100},
+ { 18, 54, 90, 8, 44, 80, 34, 70, 106},
+ { 24, 60, 96, 14, 50, 86, 4, 40, 76},
+ { 30, 66, 102, 20, 56, 92, 10, 46, 82},
+
+ { 1, 37, 73, 27, 63, 99, 17, 53, 89}, /* 2nd channel */
+ { 7, 43, 79, 33, 69, 105, 23, 59, 95},
+ { 13, 49, 85, 3, 39, 75, 29, 65, 101},
+ { 19, 55, 91, 9, 45, 81, 35, 71, 107},
+ { 25, 61, 97, 15, 51, 87, 5, 41, 77},
+ { 31, 67, 103, 21, 57, 93, 11, 47, 83},
+};
+
+/* macroblock bit budgets */
+static const uint8_t block_sizes_dv2550[8] = {
+ 112, 112, 112, 112, 80, 80, 0, 0,
+};
+
+static const uint8_t block_sizes_dv100[8] = {
+ 80, 80, 80, 80, 80, 80, 64, 64,
+};
+
+static const DVprofile dv_profiles[] = {
+ { .dsf = 0,
+ .video_stype = 0x0,
+ .frame_size = 120000, /* IEC 61834, SMPTE-314M - 525/60 (NTSC) */
+ .difseg_size = 10,
+ .n_difchan = 1,
+ .time_base = { 1001, 30000 },
+ .ltc_divisor = 30,
+ .height = 480,
+ .width = 720,
+ .sar = {{8, 9}, {32, 27}},
+ .work_chunks = &work_chunks_dv25ntsc[0],
+ .idct_factor = &dv_idct_factor_sd[0],
+ .pix_fmt = AV_PIX_FMT_YUV411P,
+ .bpm = 6,
+ .block_sizes = block_sizes_dv2550,
+ .audio_stride = 90,
+ .audio_min_samples = { 1580, 1452, 1053 }, /* for 48, 44.1 and 32kHz */
+ .audio_samples_dist = { 1600, 1602, 1602, 1602, 1602 }, /* per SMPTE-314M */
+ .audio_shuffle = dv_audio_shuffle525,
+ },
+ { .dsf = 1,
+ .video_stype = 0x0,
+ .frame_size = 144000, /* IEC 61834 - 625/50 (PAL) */
+ .difseg_size = 12,
+ .n_difchan = 1,
+ .time_base = { 1, 25 },
+ .ltc_divisor = 25,
+ .height = 576,
+ .width = 720,
+ .sar = {{16, 15}, {64, 45}},
+ .work_chunks = &work_chunks_dv25pal[0],
+ .idct_factor = &dv_idct_factor_sd[0],
+ .pix_fmt = AV_PIX_FMT_YUV420P,
+ .bpm = 6,
+ .block_sizes = block_sizes_dv2550,
+ .audio_stride = 108,
+ .audio_min_samples = { 1896, 1742, 1264 }, /* for 48, 44.1 and 32kHz */
+ .audio_samples_dist = { 1920, 1920, 1920, 1920, 1920 },
+ .audio_shuffle = dv_audio_shuffle625,
+ },
+ { .dsf = 1,
+ .video_stype = 0x0,
+ .frame_size = 144000, /* SMPTE-314M - 625/50 (PAL) */
+ .difseg_size = 12,
+ .n_difchan = 1,
+ .time_base = { 1, 25 },
+ .ltc_divisor = 25,
+ .height = 576,
+ .width = 720,
+ .sar = {{16, 15}, {64, 45}},
+ .work_chunks = &work_chunks_dv25pal411[0],
+ .idct_factor = &dv_idct_factor_sd[0],
+ .pix_fmt = AV_PIX_FMT_YUV411P,
+ .bpm = 6,
+ .block_sizes = block_sizes_dv2550,
+ .audio_stride = 108,
+ .audio_min_samples = { 1896, 1742, 1264 }, /* for 48, 44.1 and 32kHz */
+ .audio_samples_dist = { 1920, 1920, 1920, 1920, 1920 },
+ .audio_shuffle = dv_audio_shuffle625,
+ },
+ { .dsf = 0,
+ .video_stype = 0x4,
+ .frame_size = 240000, /* SMPTE-314M - 525/60 (NTSC) 50 Mbps */
+ .difseg_size = 10, /* also known as "DVCPRO50" */
+ .n_difchan = 2,
+ .time_base = { 1001, 30000 },
+ .ltc_divisor = 30,
+ .height = 480,
+ .width = 720,
+ .sar = {{8, 9}, {32, 27}},
+ .work_chunks = &work_chunks_dv50ntsc[0],
+ .idct_factor = &dv_idct_factor_sd[0],
+ .pix_fmt = AV_PIX_FMT_YUV422P,
+ .bpm = 6,
+ .block_sizes = block_sizes_dv2550,
+ .audio_stride = 90,
+ .audio_min_samples = { 1580, 1452, 1053 }, /* for 48, 44.1 and 32kHz */
+ .audio_samples_dist = { 1600, 1602, 1602, 1602, 1602 }, /* per SMPTE-314M */
+ .audio_shuffle = dv_audio_shuffle525,
+ },
+ { .dsf = 1,
+ .video_stype = 0x4,
+ .frame_size = 288000, /* SMPTE-314M - 625/50 (PAL) 50 Mbps */
+ .difseg_size = 12, /* also known as "DVCPRO50" */
+ .n_difchan = 2,
+ .time_base = { 1, 25 },
+ .ltc_divisor = 25,
+ .height = 576,
+ .width = 720,
+ .sar = {{16, 15}, {64, 45}},
+ .work_chunks = &work_chunks_dv50pal[0],
+ .idct_factor = &dv_idct_factor_sd[0],
+ .pix_fmt = AV_PIX_FMT_YUV422P,
+ .bpm = 6,
+ .block_sizes = block_sizes_dv2550,
+ .audio_stride = 108,
+ .audio_min_samples = { 1896, 1742, 1264 }, /* for 48, 44.1 and 32kHz */
+ .audio_samples_dist = { 1920, 1920, 1920, 1920, 1920 },
+ .audio_shuffle = dv_audio_shuffle625,
+ },
+ { .dsf = 0,
+ .video_stype = 0x14,
+ .frame_size = 480000, /* SMPTE-370M - 1080i60 100 Mbps */
+ .difseg_size = 10, /* also known as "DVCPRO HD" */
+ .n_difchan = 4,
+ .time_base = { 1001, 30000 },
+ .ltc_divisor = 30,
+ .height = 1080,
+ .width = 1280,
+ .sar = {{1, 1}, {3, 2}},
+ .work_chunks = &work_chunks_dv100ntsci[0],
+ .idct_factor = &dv_idct_factor_hd1080[0],
+ .pix_fmt = AV_PIX_FMT_YUV422P,
+ .bpm = 8,
+ .block_sizes = block_sizes_dv100,
+ .audio_stride = 90,
+ .audio_min_samples = { 1580, 1452, 1053 }, /* for 48, 44.1 and 32kHz */
+ .audio_samples_dist = { 1600, 1602, 1602, 1602, 1602 }, /* per SMPTE-314M */
+ .audio_shuffle = dv_audio_shuffle525,
+ },
+ { .dsf = 1,
+ .video_stype = 0x14,
+ .frame_size = 576000, /* SMPTE-370M - 1080i50 100 Mbps */
+ .difseg_size = 12, /* also known as "DVCPRO HD" */
+ .n_difchan = 4,
+ .time_base = { 1, 25 },
+ .ltc_divisor = 25,
+ .height = 1080,
+ .width = 1440,
+ .sar = {{1, 1}, {4, 3}},
+ .work_chunks = &work_chunks_dv100pali[0],
+ .idct_factor = &dv_idct_factor_hd1080[0],
+ .pix_fmt = AV_PIX_FMT_YUV422P,
+ .bpm = 8,
+ .block_sizes = block_sizes_dv100,
+ .audio_stride = 108,
+ .audio_min_samples = { 1896, 1742, 1264 }, /* for 48, 44.1 and 32kHz */
+ .audio_samples_dist = { 1920, 1920, 1920, 1920, 1920 },
+ .audio_shuffle = dv_audio_shuffle625,
+ },
+ { .dsf = 0,
+ .video_stype = 0x18,
+ .frame_size = 240000, /* SMPTE-370M - 720p60 100 Mbps */
+ .difseg_size = 10, /* also known as "DVCPRO HD" */
+ .n_difchan = 2,
+ .time_base = { 1001, 60000 },
+ .ltc_divisor = 60,
+ .height = 720,
+ .width = 960,
+ .sar = {{1, 1}, {4, 3}},
+ .work_chunks = &work_chunks_dv100ntscp[0],
+ .idct_factor = &dv_idct_factor_hd720[0],
+ .pix_fmt = AV_PIX_FMT_YUV422P,
+ .bpm = 8,
+ .block_sizes = block_sizes_dv100,
+ .audio_stride = 90,
+ .audio_min_samples = { 1580, 1452, 1053 }, /* for 48, 44.1 and 32kHz */
+ .audio_samples_dist = { 1600, 1602, 1602, 1602, 1602 }, /* per SMPTE-314M */
+ .audio_shuffle = dv_audio_shuffle525,
+ },
+ { .dsf = 1,
+ .video_stype = 0x18,
+ .frame_size = 288000, /* SMPTE-370M - 720p50 100 Mbps */
+ .difseg_size = 12, /* also known as "DVCPRO HD" */
+ .n_difchan = 2,
+ .time_base = { 1, 50 },
+ .ltc_divisor = 50,
+ .height = 720,
+ .width = 960,
+ .sar = {{1, 1}, {4, 3}},
+ .work_chunks = &work_chunks_dv100palp[0],
+ .idct_factor = &dv_idct_factor_hd720[0],
+ .pix_fmt = AV_PIX_FMT_YUV422P,
+ .bpm = 8,
+ .block_sizes = block_sizes_dv100,
+ .audio_stride = 90,
+ .audio_min_samples = { 1896, 1742, 1264 }, /* for 48, 44.1 and 32kHz */
+ .audio_samples_dist = { 1920, 1920, 1920, 1920, 1920 },
+ .audio_shuffle = dv_audio_shuffle625,
+ },
+ { .dsf = 1,
+ .video_stype = 0x1,
+ .frame_size = 144000, /* IEC 61883-5 - 625/50 (PAL) */
+ .difseg_size = 12,
+ .n_difchan = 1,
+ .time_base = { 1, 25 },
+ .ltc_divisor = 25,
+ .height = 576,
+ .width = 720,
+ .sar = {{16, 15}, {64, 45}},
+ .work_chunks = &work_chunks_dv25pal[0],
+ .idct_factor = &dv_idct_factor_sd[0],
+ .pix_fmt = AV_PIX_FMT_YUV420P,
+ .bpm = 6,
+ .block_sizes = block_sizes_dv2550,
+ .audio_stride = 108,
+ .audio_min_samples = { 1896, 1742, 1264 }, /* for 48, 44.1 and 32kHz */
+ .audio_samples_dist = { 1920, 1920, 1920, 1920, 1920 },
+ .audio_shuffle = dv_audio_shuffle625,
+ }
+};
+
+const DVprofile* avpriv_dv_frame_profile(const DVprofile *sys,
+ const uint8_t* frame, unsigned buf_size)
+{
+ int i, dsf, stype;
+
+ if (buf_size < 80 * 5 + 48 + 4)
+ return NULL;
+
+ dsf = (frame[3] & 0x80) >> 7;
+ stype = frame[80 * 5 + 48 + 3] & 0x1f;
+
+ /* 576i50 25Mbps 4:1:1 is a special case */
+ if (dsf == 1 && stype == 0 && frame[4] & 0x07 /* the APT field */) {
+ return &dv_profiles[2];
+ }
+
+ for (i = 0; i < FF_ARRAY_ELEMS(dv_profiles); i++)
+ if (dsf == dv_profiles[i].dsf && stype == dv_profiles[i].video_stype)
+ return &dv_profiles[i];
+
+ /* check if old sys matches and assumes corrupted input */
+ if (sys && buf_size == sys->frame_size)
+ return sys;
+
+ return NULL;
+}
+
+const DVprofile* avpriv_dv_codec_profile(AVCodecContext* codec)
+{
+ int i;
+
+ for (i=0; i<FF_ARRAY_ELEMS(dv_profiles); i++)
+ if (codec->height == dv_profiles[i].height &&
+ codec->pix_fmt == dv_profiles[i].pix_fmt &&
+ codec->width == dv_profiles[i].width)
+ return &dv_profiles[i];
+
+ return NULL;
+}
+
+void ff_dv_print_profiles(void *logctx, int loglevel)
+{
+ int i;
+ for (i = 0; i < FF_ARRAY_ELEMS(dv_profiles); i++) {
+ const DVprofile *p = &dv_profiles[i];
+ av_log(logctx, loglevel, "Frame size: %dx%d; pixel format: %s, "
+ "framerate: %d/%d\n", p->width, p->height, av_get_pix_fmt_name(p->pix_fmt),
+ p->time_base.den, p->time_base.num);
+ }
+}
diff --git a/gst-libs/ext/libav/libavcodec/dv_profile.h b/gst-libs/ext/libav/libavcodec/dv_profile.h
new file mode 100644
index 0000000..c6d2278
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/dv_profile.h
@@ -0,0 +1,72 @@
+/*
+ * 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
+ */
+
+#ifndef AVCODEC_DV_PROFILE_H
+#define AVCODEC_DV_PROFILE_H
+
+#include <stdint.h>
+
+#include "libavutil/pixfmt.h"
+#include "libavutil/rational.h"
+#include "avcodec.h"
+
+typedef struct DVwork_chunk {
+ uint16_t buf_offset;
+ uint16_t mb_coordinates[5];
+} DVwork_chunk;
+
+/*
+ * DVprofile is used to express the differences between various
+ * DV flavors. For now it's primarily used for differentiating
+ * 525/60 and 625/50, but the plans are to use it for various
+ * DV specs as well (e.g. SMPTE314M vs. IEC 61834).
+ */
+typedef struct DVprofile {
+ int dsf; /* value of the dsf in the DV header */
+ int video_stype; /* stype for VAUX source pack */
+ int frame_size; /* total size of one frame in bytes */
+ int difseg_size; /* number of DIF segments per DIF channel */
+ int n_difchan; /* number of DIF channels per frame */
+ AVRational time_base; /* 1/framerate */
+ int ltc_divisor; /* FPS from the LTS standpoint */
+ int height; /* picture height in pixels */
+ int width; /* picture width in pixels */
+ AVRational sar[2]; /* sample aspect ratios for 4:3 and 16:9 */
+ DVwork_chunk *work_chunks; /* each thread gets its own chunk of frame to work on */
+ uint32_t *idct_factor; /* set of iDCT factor tables */
+ enum AVPixelFormat pix_fmt; /* picture pixel format */
+ int bpm; /* blocks per macroblock */
+ const uint8_t *block_sizes; /* AC block sizes, in bits */
+ int audio_stride; /* size of audio_shuffle table */
+ int audio_min_samples[3]; /* min amount of audio samples */
+ /* for 48kHz, 44.1kHz and 32kHz */
+ int audio_samples_dist[5]; /* how many samples are supposed to be */
+ /* in each frame in a 5 frames window */
+ const uint8_t (*audio_shuffle)[9]; /* PCM shuffling table */
+} DVprofile;
+
+const DVprofile* avpriv_dv_frame_profile(const DVprofile *sys,
+ const uint8_t* frame, unsigned buf_size);
+const DVprofile* avpriv_dv_codec_profile(AVCodecContext* codec);
+
+/**
+ * Print all allowed DV profiles into logctx at specified logging level.
+ */
+void ff_dv_print_profiles(void *logctx, int loglevel);
+
+#endif /* AVCODEC_DV_PROFILE_H */
diff --git a/gst-libs/ext/libav/libavcodec/dv_tablegen.h b/gst-libs/ext/libav/libavcodec/dv_tablegen.h
index 4fa8d91..05831ea 100644
--- a/gst-libs/ext/libav/libavcodec/dv_tablegen.h
+++ b/gst-libs/ext/libav/libavcodec/dv_tablegen.h
@@ -24,6 +24,7 @@
#define AVCODEC_DV_TABLEGEN_H
#include <stdint.h>
+
#include "dv_vlc_data.h"
#if CONFIG_SMALL
diff --git a/gst-libs/ext/libav/libavcodec/dv_vlc_data.h b/gst-libs/ext/libav/libavcodec/dv_vlc_data.h
index b5c1dde..d62fd6b 100644
--- a/gst-libs/ext/libav/libavcodec/dv_vlc_data.h
+++ b/gst-libs/ext/libav/libavcodec/dv_vlc_data.h
@@ -36,7 +36,7 @@
* between (run, level) and vlc is not 1-1. So you have to watch out for that
* when building misc. tables. E.g. (1, 0) can be either 0x7cf or 0x1f82.
*/
-static const uint16_t dv_vlc_bits[409] = {
+static const uint16_t dv_vlc_bits[NB_DV_VLC] = {
0x0000, 0x0002, 0x0007, 0x0008, 0x0009, 0x0014, 0x0015, 0x0016,
0x0017, 0x0030, 0x0031, 0x0032, 0x0033, 0x0068, 0x0069, 0x006a,
0x006b, 0x006c, 0x006d, 0x006e, 0x006f, 0x00e0, 0x00e1, 0x00e2,
@@ -91,7 +91,7 @@ static const uint16_t dv_vlc_bits[409] = {
0x0006,
};
-static const uint8_t dv_vlc_len[409] = {
+static const uint8_t dv_vlc_len[NB_DV_VLC] = {
2, 3, 4, 4, 4, 5, 5, 5,
5, 6, 6, 6, 6, 7, 7, 7,
7, 7, 7, 7, 7, 8, 8, 8,
@@ -146,7 +146,7 @@ static const uint8_t dv_vlc_len[409] = {
4,
};
-static const uint8_t dv_vlc_run[409] = {
+static const uint8_t dv_vlc_run[NB_DV_VLC] = {
0, 0, 1, 0, 0, 2, 1, 0,
0, 3, 4, 0, 0, 5, 6, 2,
1, 1, 0, 0, 0, 7, 8, 9,
@@ -201,7 +201,7 @@ static const uint8_t dv_vlc_run[409] = {
127,
};
-static const uint8_t dv_vlc_level[409] = {
+static const uint8_t dv_vlc_level[NB_DV_VLC] = {
1, 2, 1, 3, 4, 1, 2, 5,
6, 1, 1, 7, 8, 1, 1, 2,
3, 4, 9, 10, 11, 1, 1, 1,
diff --git a/gst-libs/ext/libav/libavcodec/dvbsub.c b/gst-libs/ext/libav/libavcodec/dvbsub.c
index 4788d50..26d14bd 100644
--- a/gst-libs/ext/libav/libavcodec/dvbsub.c
+++ b/gst-libs/ext/libav/libavcodec/dvbsub.c
@@ -195,7 +195,7 @@ static void dvb_encode_rle4(uint8_t **pq,
}
static int encode_dvb_subtitles(DVBSubtitleContext *s,
- uint8_t *outbuf, AVSubtitle *h)
+ uint8_t *outbuf, const AVSubtitle *h)
{
uint8_t *q, *pseg_len;
int page_id, region_id, clut_id, object_id, i, bpp_index, page_state;
@@ -392,10 +392,10 @@ static int encode_dvb_subtitles(DVBSubtitleContext *s,
}
static int dvbsub_encode(AVCodecContext *avctx,
- unsigned char *buf, int buf_size, void *data)
+ unsigned char *buf, int buf_size,
+ const AVSubtitle *sub)
{
DVBSubtitleContext *s = avctx->priv_data;
- AVSubtitle *sub = data;
int ret;
ret = encode_dvb_subtitles(s, buf, sub);
@@ -405,8 +405,8 @@ static int dvbsub_encode(AVCodecContext *avctx,
AVCodec ff_dvbsub_encoder = {
.name = "dvbsub",
.type = AVMEDIA_TYPE_SUBTITLE,
- .id = CODEC_ID_DVB_SUBTITLE,
+ .id = AV_CODEC_ID_DVB_SUBTITLE,
.priv_data_size = sizeof(DVBSubtitleContext),
- .encode = dvbsub_encode,
- .long_name = NULL_IF_CONFIG_SMALL("DVB subtitles"),
+ .encode_sub = dvbsub_encode,
+ .long_name = NULL_IF_CONFIG_SMALL("DVB subtitles"),
};
diff --git a/gst-libs/ext/libav/libavcodec/dvbsub_parser.c b/gst-libs/ext/libav/libavcodec/dvbsub_parser.c
index 6433528..c13aab6 100644
--- a/gst-libs/ext/libav/libavcodec/dvbsub_parser.c
+++ b/gst-libs/ext/libav/libavcodec/dvbsub_parser.c
@@ -172,7 +172,7 @@ static av_cold void dvbsub_parse_close(AVCodecParserContext *s)
}
AVCodecParser ff_dvbsub_parser = {
- .codec_ids = { CODEC_ID_DVB_SUBTITLE },
+ .codec_ids = { AV_CODEC_ID_DVB_SUBTITLE },
.priv_data_size = sizeof(DVBSubParseContext),
.parser_init = dvbsub_parse_init,
.parser_parse = dvbsub_parse,
diff --git a/gst-libs/ext/libav/libavcodec/dvbsubdec.c b/gst-libs/ext/libav/libavcodec/dvbsubdec.c
index aafc046..b4aba49 100644
--- a/gst-libs/ext/libav/libavcodec/dvbsubdec.c
+++ b/gst-libs/ext/libav/libavcodec/dvbsubdec.c
@@ -150,7 +150,7 @@ static void png_save2(const char *filename, uint32_t *bitmap, int w, int h)
}
#endif
-#define RGBA(r,g,b,a) (((a) << 24) | ((r) << 16) | ((g) << 8) | (b))
+#define RGBA(r,g,b,a) (((unsigned)(a) << 24) | ((r) << 16) | ((g) << 8) | (b))
typedef struct DVBSubCLUT {
int id;
@@ -1466,10 +1466,10 @@ static int dvbsub_decode(AVCodecContext *avctx,
AVCodec ff_dvbsub_decoder = {
.name = "dvbsub",
.type = AVMEDIA_TYPE_SUBTITLE,
- .id = CODEC_ID_DVB_SUBTITLE,
+ .id = AV_CODEC_ID_DVB_SUBTITLE,
.priv_data_size = sizeof(DVBSubContext),
.init = dvbsub_init_decoder,
.close = dvbsub_close_decoder,
.decode = dvbsub_decode,
- .long_name = NULL_IF_CONFIG_SMALL("DVB subtitles"),
+ .long_name = NULL_IF_CONFIG_SMALL("DVB subtitles"),
};
diff --git a/gst-libs/ext/libav/libavcodec/dvdata.c b/gst-libs/ext/libav/libavcodec/dvdata.c
index 62e569c..c779277 100644
--- a/gst-libs/ext/libav/libavcodec/dvdata.c
+++ b/gst-libs/ext/libav/libavcodec/dvdata.c
@@ -24,264 +24,99 @@
* Constants for DV codec.
*/
-#include "libavutil/rational.h"
#include "avcodec.h"
#include "dvdata.h"
-static DVwork_chunk work_chunks_dv25pal [1*12*27];
-static DVwork_chunk work_chunks_dv25pal411[1*12*27];
-static DVwork_chunk work_chunks_dv25ntsc [1*10*27];
-static DVwork_chunk work_chunks_dv50pal [2*12*27];
-static DVwork_chunk work_chunks_dv50ntsc [2*10*27];
-static DVwork_chunk work_chunks_dv100palp [2*12*27];
-static DVwork_chunk work_chunks_dv100ntscp[2*10*27];
-static DVwork_chunk work_chunks_dv100pali [4*12*27];
-static DVwork_chunk work_chunks_dv100ntsci[4*10*27];
-
-static uint32_t dv_idct_factor_sd [2*2*22*64];
-static uint32_t dv_idct_factor_hd1080[2*4*16*64];
-static uint32_t dv_idct_factor_hd720 [2*4*16*64];
-
-static const DVprofile dv_profiles[] = {
- { .dsf = 0,
- .video_stype = 0x0,
- .frame_size = 120000, /* IEC 61834, SMPTE-314M - 525/60 (NTSC) */
- .difseg_size = 10,
- .n_difchan = 1,
- .time_base = { 1001, 30000 },
- .ltc_divisor = 30,
- .height = 480,
- .width = 720,
- .sar = {{8, 9}, {32, 27}},
- .work_chunks = &work_chunks_dv25ntsc[0],
- .idct_factor = &dv_idct_factor_sd[0],
- .pix_fmt = PIX_FMT_YUV411P,
- .bpm = 6,
- .block_sizes = block_sizes_dv2550,
- .audio_stride = 90,
- .audio_min_samples = { 1580, 1452, 1053 }, /* for 48, 44.1 and 32kHz */
- .audio_samples_dist = { 1600, 1602, 1602, 1602, 1602 }, /* per SMPTE-314M */
- .audio_shuffle = dv_audio_shuffle525,
- },
- { .dsf = 1,
- .video_stype = 0x0,
- .frame_size = 144000, /* IEC 61834 - 625/50 (PAL) */
- .difseg_size = 12,
- .n_difchan = 1,
- .time_base = { 1, 25 },
- .ltc_divisor = 25,
- .height = 576,
- .width = 720,
- .sar = {{16, 15}, {64, 45}},
- .work_chunks = &work_chunks_dv25pal[0],
- .idct_factor = &dv_idct_factor_sd[0],
- .pix_fmt = PIX_FMT_YUV420P,
- .bpm = 6,
- .block_sizes = block_sizes_dv2550,
- .audio_stride = 108,
- .audio_min_samples = { 1896, 1742, 1264 }, /* for 48, 44.1 and 32kHz */
- .audio_samples_dist = { 1920, 1920, 1920, 1920, 1920 },
- .audio_shuffle = dv_audio_shuffle625,
- },
- { .dsf = 1,
- .video_stype = 0x0,
- .frame_size = 144000, /* SMPTE-314M - 625/50 (PAL) */
- .difseg_size = 12,
- .n_difchan = 1,
- .time_base = { 1, 25 },
- .ltc_divisor = 25,
- .height = 576,
- .width = 720,
- .sar = {{16, 15}, {64, 45}},
- .work_chunks = &work_chunks_dv25pal411[0],
- .idct_factor = &dv_idct_factor_sd[0],
- .pix_fmt = PIX_FMT_YUV411P,
- .bpm = 6,
- .block_sizes = block_sizes_dv2550,
- .audio_stride = 108,
- .audio_min_samples = { 1896, 1742, 1264 }, /* for 48, 44.1 and 32kHz */
- .audio_samples_dist = { 1920, 1920, 1920, 1920, 1920 },
- .audio_shuffle = dv_audio_shuffle625,
- },
- { .dsf = 0,
- .video_stype = 0x4,
- .frame_size = 240000, /* SMPTE-314M - 525/60 (NTSC) 50 Mbps */
- .difseg_size = 10, /* also known as "DVCPRO50" */
- .n_difchan = 2,
- .time_base = { 1001, 30000 },
- .ltc_divisor = 30,
- .height = 480,
- .width = 720,
- .sar = {{8, 9}, {32, 27}},
- .work_chunks = &work_chunks_dv50ntsc[0],
- .idct_factor = &dv_idct_factor_sd[0],
- .pix_fmt = PIX_FMT_YUV422P,
- .bpm = 6,
- .block_sizes = block_sizes_dv2550,
- .audio_stride = 90,
- .audio_min_samples = { 1580, 1452, 1053 }, /* for 48, 44.1 and 32kHz */
- .audio_samples_dist = { 1600, 1602, 1602, 1602, 1602 }, /* per SMPTE-314M */
- .audio_shuffle = dv_audio_shuffle525,
- },
- { .dsf = 1,
- .video_stype = 0x4,
- .frame_size = 288000, /* SMPTE-314M - 625/50 (PAL) 50 Mbps */
- .difseg_size = 12, /* also known as "DVCPRO50" */
- .n_difchan = 2,
- .time_base = { 1, 25 },
- .ltc_divisor = 25,
- .height = 576,
- .width = 720,
- .sar = {{16, 15}, {64, 45}},
- .work_chunks = &work_chunks_dv50pal[0],
- .idct_factor = &dv_idct_factor_sd[0],
- .pix_fmt = PIX_FMT_YUV422P,
- .bpm = 6,
- .block_sizes = block_sizes_dv2550,
- .audio_stride = 108,
- .audio_min_samples = { 1896, 1742, 1264 }, /* for 48, 44.1 and 32kHz */
- .audio_samples_dist = { 1920, 1920, 1920, 1920, 1920 },
- .audio_shuffle = dv_audio_shuffle625,
- },
- { .dsf = 0,
- .video_stype = 0x14,
- .frame_size = 480000, /* SMPTE-370M - 1080i60 100 Mbps */
- .difseg_size = 10, /* also known as "DVCPRO HD" */
- .n_difchan = 4,
- .time_base = { 1001, 30000 },
- .ltc_divisor = 30,
- .height = 1080,
- .width = 1280,
- .sar = {{1, 1}, {3, 2}},
- .work_chunks = &work_chunks_dv100ntsci[0],
- .idct_factor = &dv_idct_factor_hd1080[0],
- .pix_fmt = PIX_FMT_YUV422P,
- .bpm = 8,
- .block_sizes = block_sizes_dv100,
- .audio_stride = 90,
- .audio_min_samples = { 1580, 1452, 1053 }, /* for 48, 44.1 and 32kHz */
- .audio_samples_dist = { 1600, 1602, 1602, 1602, 1602 }, /* per SMPTE-314M */
- .audio_shuffle = dv_audio_shuffle525,
- },
- { .dsf = 1,
- .video_stype = 0x14,
- .frame_size = 576000, /* SMPTE-370M - 1080i50 100 Mbps */
- .difseg_size = 12, /* also known as "DVCPRO HD" */
- .n_difchan = 4,
- .time_base = { 1, 25 },
- .ltc_divisor = 25,
- .height = 1080,
- .width = 1440,
- .sar = {{1, 1}, {4, 3}},
- .work_chunks = &work_chunks_dv100pali[0],
- .idct_factor = &dv_idct_factor_hd1080[0],
- .pix_fmt = PIX_FMT_YUV422P,
- .bpm = 8,
- .block_sizes = block_sizes_dv100,
- .audio_stride = 108,
- .audio_min_samples = { 1896, 1742, 1264 }, /* for 48, 44.1 and 32kHz */
- .audio_samples_dist = { 1920, 1920, 1920, 1920, 1920 },
- .audio_shuffle = dv_audio_shuffle625,
- },
- { .dsf = 0,
- .video_stype = 0x18,
- .frame_size = 240000, /* SMPTE-370M - 720p60 100 Mbps */
- .difseg_size = 10, /* also known as "DVCPRO HD" */
- .n_difchan = 2,
- .time_base = { 1001, 60000 },
- .ltc_divisor = 60,
- .height = 720,
- .width = 960,
- .sar = {{1, 1}, {4, 3}},
- .work_chunks = &work_chunks_dv100ntscp[0],
- .idct_factor = &dv_idct_factor_hd720[0],
- .pix_fmt = PIX_FMT_YUV422P,
- .bpm = 8,
- .block_sizes = block_sizes_dv100,
- .audio_stride = 90,
- .audio_min_samples = { 1580, 1452, 1053 }, /* for 48, 44.1 and 32kHz */
- .audio_samples_dist = { 1600, 1602, 1602, 1602, 1602 }, /* per SMPTE-314M */
- .audio_shuffle = dv_audio_shuffle525,
- },
- { .dsf = 1,
- .video_stype = 0x18,
- .frame_size = 288000, /* SMPTE-370M - 720p50 100 Mbps */
- .difseg_size = 12, /* also known as "DVCPRO HD" */
- .n_difchan = 2,
- .time_base = { 1, 50 },
- .ltc_divisor = 50,
- .height = 720,
- .width = 960,
- .sar = {{1, 1}, {4, 3}},
- .work_chunks = &work_chunks_dv100palp[0],
- .idct_factor = &dv_idct_factor_hd720[0],
- .pix_fmt = PIX_FMT_YUV422P,
- .bpm = 8,
- .block_sizes = block_sizes_dv100,
- .audio_stride = 90,
- .audio_min_samples = { 1896, 1742, 1264 }, /* for 48, 44.1 and 32kHz */
- .audio_samples_dist = { 1920, 1920, 1920, 1920, 1920 },
- .audio_shuffle = dv_audio_shuffle625,
- },
- { .dsf = 1,
- .video_stype = 0x1,
- .frame_size = 144000, /* IEC 61883-5 - 625/50 (PAL) */
- .difseg_size = 12,
- .n_difchan = 1,
- .time_base = { 1, 25 },
- .ltc_divisor = 25,
- .height = 576,
- .width = 720,
- .sar = {{16, 15}, {64, 45}},
- .work_chunks = &work_chunks_dv25pal[0],
- .idct_factor = &dv_idct_factor_sd[0],
- .pix_fmt = PIX_FMT_YUV420P,
- .bpm = 6,
- .block_sizes = block_sizes_dv2550,
- .audio_stride = 108,
- .audio_min_samples = { 1896, 1742, 1264 }, /* for 48, 44.1 and 32kHz */
- .audio_samples_dist = { 1920, 1920, 1920, 1920, 1920 },
- .audio_shuffle = dv_audio_shuffle625,
- }
+/* unquant tables (not used directly) */
+const uint8_t ff_dv_quant_shifts[22][4] = {
+ { 3,3,4,4 },
+ { 3,3,4,4 },
+ { 2,3,3,4 },
+ { 2,3,3,4 },
+ { 2,2,3,3 },
+ { 2,2,3,3 },
+ { 1,2,2,3 },
+ { 1,2,2,3 },
+ { 1,1,2,2 },
+ { 1,1,2,2 },
+ { 0,1,1,2 },
+ { 0,1,1,2 },
+ { 0,0,1,1 },
+ { 0,0,1,1 },
+ { 0,0,0,1 },
+ { 0,0,0,0 },
+ { 0,0,0,0 },
+ { 0,0,0,0 },
+ { 0,0,0,0 },
+ { 0,0,0,0 },
+ { 0,0,0,0 },
+ { 0,0,0,0 },
};
-const DVprofile* avpriv_dv_frame_profile(const DVprofile *sys,
- const uint8_t* frame, unsigned buf_size)
-{
- int i, dsf, stype;
-
- if (buf_size < 80*5 + 48 + 4)
- return NULL;
-
- dsf = (frame[3] & 0x80) >> 7;
- stype = frame[80*5 + 48 + 3] & 0x1f;
-
- /* 576i50 25Mbps 4:1:1 is a special case */
- if (dsf == 1 && stype == 0 && frame[4] & 0x07 /* the APT field */) {
- return &dv_profiles[2];
- }
-
- for (i=0; i<FF_ARRAY_ELEMS(dv_profiles); i++)
- if (dsf == dv_profiles[i].dsf && stype == dv_profiles[i].video_stype)
- return &dv_profiles[i];
-
- /* check if old sys matches and assumes corrupted input */
- if (sys && buf_size == sys->frame_size)
- return sys;
-
- return NULL;
-}
-
-const DVprofile* avpriv_dv_codec_profile(AVCodecContext* codec)
-{
- int i;
-
- for (i=0; i<FF_ARRAY_ELEMS(dv_profiles); i++)
- if (codec->height == dv_profiles[i].height &&
- codec->pix_fmt == dv_profiles[i].pix_fmt &&
- codec->width == dv_profiles[i].width)
- return &dv_profiles[i];
+const uint8_t ff_dv_quant_offset[4] = { 6, 3, 0, 1 };
+
+const int ff_dv_iweight_88[64] = {
+ 32768, 16710, 16710, 17735, 17015, 17735, 18197, 18079,
+ 18079, 18197, 18725, 18559, 19196, 18559, 18725, 19284,
+ 19108, 19692, 19692, 19108, 19284, 21400, 19645, 20262,
+ 20214, 20262, 19645, 21400, 22733, 21845, 20867, 20815,
+ 20815, 20867, 21845, 22733, 23173, 23173, 21400, 21400,
+ 21400, 23173, 23173, 24600, 23764, 22017, 22017, 23764,
+ 24600, 25267, 24457, 22672, 24457, 25267, 25971, 25191,
+ 25191, 25971, 26715, 27962, 26715, 29642, 29642, 31536,
+};
+const int ff_dv_iweight_248[64] = {
+ 32768, 17735, 16710, 18079, 18725, 21400, 17735, 19196,
+ 19108, 21845, 16384, 17735, 18725, 21400, 16710, 18079,
+ 20262, 23173, 18197, 19692, 18725, 20262, 20815, 23764,
+ 17735, 19196, 19108, 21845, 20262, 23173, 18197, 19692,
+ 21400, 24457, 19284, 20867, 21400, 23173, 22017, 25191,
+ 18725, 20262, 20815, 23764, 21400, 24457, 19284, 20867,
+ 24457, 27962, 22733, 24600, 25971, 29642, 21400, 23173,
+ 22017, 25191, 24457, 27962, 22733, 24600, 25971, 29642,
+};
- return NULL;
-}
+/**
+ * The "inverse" DV100 weights are actually just the spec weights (zig-zagged).
+ */
+const int ff_dv_iweight_1080_y[64] = {
+ 128, 16, 16, 17, 17, 17, 18, 18,
+ 18, 18, 18, 18, 19, 18, 18, 19,
+ 19, 19, 19, 19, 19, 42, 38, 40,
+ 40, 40, 38, 42, 44, 43, 41, 41,
+ 41, 41, 43, 44, 45, 45, 42, 42,
+ 42, 45, 45, 48, 46, 43, 43, 46,
+ 48, 49, 48, 44, 48, 49, 101, 98,
+ 98, 101, 104, 109, 104, 116, 116, 123,
+};
+const int ff_dv_iweight_1080_c[64] = {
+ 128, 16, 16, 17, 17, 17, 25, 25,
+ 25, 25, 26, 25, 26, 25, 26, 26,
+ 26, 27, 27, 26, 26, 42, 38, 40,
+ 40, 40, 38, 42, 44, 43, 41, 41,
+ 41, 41, 43, 44, 91, 91, 84, 84,
+ 84, 91, 91, 96, 93, 86, 86, 93,
+ 96, 197, 191, 177, 191, 197, 203, 197,
+ 197, 203, 209, 219, 209, 232, 232, 246,
+};
+const int ff_dv_iweight_720_y[64] = {
+ 128, 16, 16, 17, 17, 17, 18, 18,
+ 18, 18, 18, 18, 19, 18, 18, 19,
+ 19, 19, 19, 19, 19, 42, 38, 40,
+ 40, 40, 38, 42, 44, 43, 41, 41,
+ 41, 41, 43, 44, 68, 68, 63, 63,
+ 63, 68, 68, 96, 92, 86, 86, 92,
+ 96, 98, 96, 88, 96, 98, 202, 196,
+ 196, 202, 208, 218, 208, 232, 232, 246,
+};
+const int ff_dv_iweight_720_c[64] = {
+ 128, 24, 24, 26, 26, 26, 36, 36,
+ 36, 36, 36, 36, 38, 36, 36, 38,
+ 38, 38, 38, 38, 38, 84, 76, 80,
+ 80, 80, 76, 84, 88, 86, 82, 82,
+ 82, 82, 86, 88, 182, 182, 168, 168,
+ 168, 182, 182, 192, 186, 192, 172, 186,
+ 192, 394, 382, 354, 382, 394, 406, 394,
+ 394, 406, 418, 438, 418, 464, 464, 492,
+};
diff --git a/gst-libs/ext/libav/libavcodec/dvdata.h b/gst-libs/ext/libav/libavcodec/dvdata.h
index b2fb127..c50fa5f 100644
--- a/gst-libs/ext/libav/libavcodec/dvdata.h
+++ b/gst-libs/ext/libav/libavcodec/dvdata.h
@@ -27,211 +27,24 @@
#ifndef AVCODEC_DVDATA_H
#define AVCODEC_DVDATA_H
-#include "libavutil/rational.h"
#include "avcodec.h"
+#include "dsputil.h"
+#include "get_bits.h"
+#include "dv_profile.h"
-typedef struct DVwork_chunk {
- uint16_t buf_offset;
- uint16_t mb_coordinates[5];
-} DVwork_chunk;
+typedef struct DVVideoContext {
+ const DVprofile *sys;
+ AVFrame picture;
+ AVCodecContext *avctx;
+ uint8_t *buf;
-/*
- * DVprofile is used to express the differences between various
- * DV flavors. For now it's primarily used for differentiating
- * 525/60 and 625/50, but the plans are to use it for various
- * DV specs as well (e.g. SMPTE314M vs. IEC 61834).
- */
-typedef struct DVprofile {
- int dsf; /* value of the dsf in the DV header */
- int video_stype; /* stype for VAUX source pack */
- int frame_size; /* total size of one frame in bytes */
- int difseg_size; /* number of DIF segments per DIF channel */
- int n_difchan; /* number of DIF channels per frame */
- AVRational time_base; /* 1/framerate */
- int ltc_divisor; /* FPS from the LTS standpoint */
- int height; /* picture height in pixels */
- int width; /* picture width in pixels */
- AVRational sar[2]; /* sample aspect ratios for 4:3 and 16:9 */
- DVwork_chunk *work_chunks; /* each thread gets its own chunk of frame to work on */
- uint32_t *idct_factor; /* set of iDCT factor tables */
- enum PixelFormat pix_fmt; /* picture pixel format */
- int bpm; /* blocks per macroblock */
- const uint8_t *block_sizes; /* AC block sizes, in bits */
- int audio_stride; /* size of audio_shuffle table */
- int audio_min_samples[3]; /* min amount of audio samples */
- /* for 48kHz, 44.1kHz and 32kHz */
- int audio_samples_dist[5]; /* how many samples are supposed to be */
- /* in each frame in a 5 frames window */
- const uint8_t (*audio_shuffle)[9]; /* PCM shuffling table */
-} DVprofile;
-
-/* unquant tables (not used directly) */
-static const uint8_t dv_quant_shifts[22][4] = {
- { 3,3,4,4 },
- { 3,3,4,4 },
- { 2,3,3,4 },
- { 2,3,3,4 },
- { 2,2,3,3 },
- { 2,2,3,3 },
- { 1,2,2,3 },
- { 1,2,2,3 },
- { 1,1,2,2 },
- { 1,1,2,2 },
- { 0,1,1,2 },
- { 0,1,1,2 },
- { 0,0,1,1 },
- { 0,0,1,1 },
- { 0,0,0,1 },
- { 0,0,0,0 },
- { 0,0,0,0 },
- { 0,0,0,0 },
- { 0,0,0,0 },
- { 0,0,0,0 },
- { 0,0,0,0 },
- { 0,0,0,0 },
-};
-
-static const uint8_t dv_quant_offset[4] = { 6, 3, 0, 1 };
-static const uint8_t dv_quant_areas[4] = { 6, 21, 43, 64 };
-
-/* quantization quanta by QNO for DV100 */
-static const uint8_t dv100_qstep[16] = {
- 1, /* QNO = 0 and 1 both have no quantization */
- 1,
- 2, 3, 4, 5, 6, 7, 8, 16, 18, 20, 22, 24, 28, 52
-};
-
-/* DV25/50 DCT coefficient weights and inverse weights */
-/* created by dvtables.py */
-static const int dv_weight_bits = 18;
-static const int dv_weight_88[64] = {
- 131072, 257107, 257107, 242189, 252167, 242189, 235923, 237536,
- 237536, 235923, 229376, 231390, 223754, 231390, 229376, 222935,
- 224969, 217965, 217965, 224969, 222935, 200636, 218652, 211916,
- 212325, 211916, 218652, 200636, 188995, 196781, 205965, 206433,
- 206433, 205965, 196781, 188995, 185364, 185364, 200636, 200704,
- 200636, 185364, 185364, 174609, 180568, 195068, 195068, 180568,
- 174609, 170091, 175557, 189591, 175557, 170091, 165371, 170627,
- 170627, 165371, 160727, 153560, 160727, 144651, 144651, 136258,
-};
-static const int dv_weight_248[64] = {
- 131072, 242189, 257107, 237536, 229376, 200636, 242189, 223754,
- 224969, 196781, 262144, 242189, 229376, 200636, 257107, 237536,
- 211916, 185364, 235923, 217965, 229376, 211916, 206433, 180568,
- 242189, 223754, 224969, 196781, 211916, 185364, 235923, 217965,
- 200704, 175557, 222935, 205965, 200636, 185364, 195068, 170627,
- 229376, 211916, 206433, 180568, 200704, 175557, 222935, 205965,
- 175557, 153560, 188995, 174609, 165371, 144651, 200636, 185364,
- 195068, 170627, 175557, 153560, 188995, 174609, 165371, 144651,
-};
-static const int dv_iweight_bits = 14;
-static const int dv_iweight_88[64] = {
- 32768, 16710, 16710, 17735, 17015, 17735, 18197, 18079,
- 18079, 18197, 18725, 18559, 19196, 18559, 18725, 19284,
- 19108, 19692, 19692, 19108, 19284, 21400, 19645, 20262,
- 20214, 20262, 19645, 21400, 22733, 21845, 20867, 20815,
- 20815, 20867, 21845, 22733, 23173, 23173, 21400, 21400,
- 21400, 23173, 23173, 24600, 23764, 22017, 22017, 23764,
- 24600, 25267, 24457, 22672, 24457, 25267, 25971, 25191,
- 25191, 25971, 26715, 27962, 26715, 29642, 29642, 31536,
-};
-static const int dv_iweight_248[64] = {
- 32768, 17735, 16710, 18079, 18725, 21400, 17735, 19196,
- 19108, 21845, 16384, 17735, 18725, 21400, 16710, 18079,
- 20262, 23173, 18197, 19692, 18725, 20262, 20815, 23764,
- 17735, 19196, 19108, 21845, 20262, 23173, 18197, 19692,
- 21400, 24457, 19284, 20867, 21400, 23173, 22017, 25191,
- 18725, 20262, 20815, 23764, 21400, 24457, 19284, 20867,
- 24457, 27962, 22733, 24600, 25971, 29642, 21400, 23173,
- 22017, 25191, 24457, 27962, 22733, 24600, 25971, 29642,
-};
-
-/**
- * The "inverse" DV100 weights are actually just the spec weights (zig-zagged).
- */
-static const int dv_iweight_1080_y[64] = {
- 128, 16, 16, 17, 17, 17, 18, 18,
- 18, 18, 18, 18, 19, 18, 18, 19,
- 19, 19, 19, 19, 19, 42, 38, 40,
- 40, 40, 38, 42, 44, 43, 41, 41,
- 41, 41, 43, 44, 45, 45, 42, 42,
- 42, 45, 45, 48, 46, 43, 43, 46,
- 48, 49, 48, 44, 48, 49, 101, 98,
- 98, 101, 104, 109, 104, 116, 116, 123,
-};
-static const int dv_iweight_1080_c[64] = {
- 128, 16, 16, 17, 17, 17, 25, 25,
- 25, 25, 26, 25, 26, 25, 26, 26,
- 26, 27, 27, 26, 26, 42, 38, 40,
- 40, 40, 38, 42, 44, 43, 41, 41,
- 41, 41, 43, 44, 91, 91, 84, 84,
- 84, 91, 91, 96, 93, 86, 86, 93,
- 96, 197, 191, 177, 191, 197, 203, 197,
- 197, 203, 209, 219, 209, 232, 232, 246,
-};
-static const int dv_iweight_720_y[64] = {
- 128, 16, 16, 17, 17, 17, 18, 18,
- 18, 18, 18, 18, 19, 18, 18, 19,
- 19, 19, 19, 19, 19, 42, 38, 40,
- 40, 40, 38, 42, 44, 43, 41, 41,
- 41, 41, 43, 44, 68, 68, 63, 63,
- 63, 68, 68, 96, 92, 86, 86, 92,
- 96, 98, 96, 88, 96, 98, 202, 196,
- 196, 202, 208, 218, 208, 232, 232, 246,
-};
-static const int dv_iweight_720_c[64] = {
- 128, 24, 24, 26, 26, 26, 36, 36,
- 36, 36, 36, 36, 38, 36, 36, 38,
- 38, 38, 38, 38, 38, 84, 76, 80,
- 80, 80, 76, 84, 88, 86, 82, 82,
- 82, 82, 86, 88, 182, 182, 168, 168,
- 168, 182, 182, 192, 186, 192, 172, 186,
- 192, 394, 382, 354, 382, 394, 406, 394,
- 394, 406, 418, 438, 418, 464, 464, 492,
-};
-
-static const uint8_t dv_audio_shuffle525[10][9] = {
- { 0, 30, 60, 20, 50, 80, 10, 40, 70 }, /* 1st channel */
- { 6, 36, 66, 26, 56, 86, 16, 46, 76 },
- { 12, 42, 72, 2, 32, 62, 22, 52, 82 },
- { 18, 48, 78, 8, 38, 68, 28, 58, 88 },
- { 24, 54, 84, 14, 44, 74, 4, 34, 64 },
-
- { 1, 31, 61, 21, 51, 81, 11, 41, 71 }, /* 2nd channel */
- { 7, 37, 67, 27, 57, 87, 17, 47, 77 },
- { 13, 43, 73, 3, 33, 63, 23, 53, 83 },
- { 19, 49, 79, 9, 39, 69, 29, 59, 89 },
- { 25, 55, 85, 15, 45, 75, 5, 35, 65 },
-};
-
-static const uint8_t dv_audio_shuffle625[12][9] = {
- { 0, 36, 72, 26, 62, 98, 16, 52, 88}, /* 1st channel */
- { 6, 42, 78, 32, 68, 104, 22, 58, 94},
- { 12, 48, 84, 2, 38, 74, 28, 64, 100},
- { 18, 54, 90, 8, 44, 80, 34, 70, 106},
- { 24, 60, 96, 14, 50, 86, 4, 40, 76},
- { 30, 66, 102, 20, 56, 92, 10, 46, 82},
-
- { 1, 37, 73, 27, 63, 99, 17, 53, 89}, /* 2nd channel */
- { 7, 43, 79, 33, 69, 105, 23, 59, 95},
- { 13, 49, 85, 3, 39, 75, 29, 65, 101},
- { 19, 55, 91, 9, 45, 81, 35, 71, 107},
- { 25, 61, 97, 15, 51, 87, 5, 41, 77},
- { 31, 67, 103, 21, 57, 93, 11, 47, 83},
-};
-
-static const av_unused int dv_audio_frequency[3] = {
- 48000, 44100, 32000,
-};
+ uint8_t dv_zigzag[2][64];
-/* macroblock bit budgets */
-static const uint8_t block_sizes_dv2550[8] = {
- 112, 112, 112, 112, 80, 80, 0, 0,
-};
-
-static const uint8_t block_sizes_dv100[8] = {
- 80, 80, 80, 80, 80, 80, 64, 64,
-};
+ void (*get_pixels)(DCTELEM *block, const uint8_t *pixels, int line_size);
+ void (*fdct[2])(DCTELEM *block);
+ void (*idct_put[2])(uint8_t *dest, int line_size, DCTELEM *block);
+ me_cmp_func ildct_cmp;
+} DVVideoContext;
enum dv_section_type {
dv_sect_header = 0x1f,
@@ -256,6 +69,16 @@ enum dv_pack_type {
dv_unknown_pack = 0xff,
};
+extern const uint8_t ff_dv_quant_shifts[22][4];
+extern const uint8_t ff_dv_quant_offset[4];
+
+extern const int ff_dv_iweight_88[64];
+extern const int ff_dv_iweight_248[64];
+extern const int ff_dv_iweight_1080_y[64];
+extern const int ff_dv_iweight_1080_c[64];
+extern const int ff_dv_iweight_720_y[64];
+extern const int ff_dv_iweight_720_c[64];
+
#define DV_PROFILE_IS_HD(p) ((p)->video_stype & 0x10)
#define DV_PROFILE_IS_1080i50(p) (((p)->video_stype == 0x14) && ((p)->dsf == 1))
#define DV_PROFILE_IS_720p50(p) (((p)->video_stype == 0x18) && ((p)->dsf == 1))
@@ -274,43 +97,32 @@ enum dv_pack_type {
*/
#define DV_MAX_BPM 8
-const DVprofile* avpriv_dv_frame_profile(const DVprofile *sys,
- const uint8_t* frame, unsigned buf_size);
-const DVprofile* avpriv_dv_codec_profile(AVCodecContext* codec);
+#define TEX_VLC_BITS 9
-static inline int dv_write_dif_id(enum dv_section_type t, uint8_t chan_num,
- uint8_t seq_num, uint8_t dif_num,
- uint8_t* buf)
+extern RL_VLC_ELEM ff_dv_rl_vlc[1184];
+
+int ff_dv_init_dynamic_tables(const DVprofile *d);
+int ff_dvvideo_init(AVCodecContext *avctx);
+
+static inline int dv_work_pool_size(const DVprofile *d)
{
- buf[0] = (uint8_t)t; /* Section type */
- buf[1] = (seq_num << 4) | /* DIF seq number 0-9 for 525/60; 0-11 for 625/50 */
- (chan_num << 3) | /* FSC: for 50Mb/s 0 - first channel; 1 - second */
- 7; /* reserved -- always 1 */
- buf[2] = dif_num; /* DIF block number Video: 0-134, Audio: 0-8 */
- return 3;
+ int size = d->n_difchan*d->difseg_size*27;
+ if (DV_PROFILE_IS_1080i50(d))
+ size -= 3*27;
+ if (DV_PROFILE_IS_720p50(d))
+ size -= 4*27;
+ return size;
}
-
-static inline int dv_write_ssyb_id(uint8_t syb_num, uint8_t fr, uint8_t* buf)
+static inline void dv_calculate_mb_xy(DVVideoContext *s, DVwork_chunk *work_chunk, int m, int *mb_x, int *mb_y)
{
- if (syb_num == 0 || syb_num == 6) {
- buf[0] = (fr << 7) | /* FR ID 1 - first half of each channel; 0 - second */
- (0 << 4) | /* AP3 (Subcode application ID) */
- 0x0f; /* reserved -- always 1 */
- }
- else if (syb_num == 11) {
- buf[0] = (fr << 7) | /* FR ID 1 - first half of each channel; 0 - second */
- 0x7f; /* reserved -- always 1 */
- }
- else {
- buf[0] = (fr << 7) | /* FR ID 1 - first half of each channel; 0 - second */
- (0 << 4) | /* APT (Track application ID) */
- 0x0f; /* reserved -- always 1 */
- }
- buf[1] = 0xf0 | /* reserved -- always 1 */
- (syb_num & 0x0f); /* SSYB number 0 - 11 */
- buf[2] = 0xff; /* reserved -- always 1 */
- return 3;
+ *mb_x = work_chunk->mb_coordinates[m] & 0xff;
+ *mb_y = work_chunk->mb_coordinates[m] >> 8;
+
+ /* We work with 720p frames split in half. The odd half-frame (chan==2,3) is displaced :-( */
+ if (s->sys->height == 720 && !(s->buf[1]&0x0C)) {
+ *mb_y -= (*mb_y>17)?18:-72; /* shifting the Y coordinate down by 72/2 macro blocks */
+ }
}
#endif /* AVCODEC_DVDATA_H */
diff --git a/gst-libs/ext/libav/libavcodec/dvdec.c b/gst-libs/ext/libav/libavcodec/dvdec.c
new file mode 100644
index 0000000..bc1bb55
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/dvdec.c
@@ -0,0 +1,386 @@
+/*
+ * DV decoder
+ * Copyright (c) 2002 Fabrice Bellard
+ * Copyright (c) 2004 Roman Shaposhnik
+ *
+ * 50 Mbps (DVCPRO50) support
+ * Copyright (c) 2006 Daniel Maas <dmaas@maasdigital.com>
+ *
+ * 100 Mbps (DVCPRO HD) support
+ * Initial code by Daniel Maas <dmaas@maasdigital.com> (funded by BBC R&D)
+ * Final code by Roman Shaposhnik
+ *
+ * Many thanks to Dan Dennedy <dan@dennedy.org> for providing wealth
+ * of DV technical info.
+ *
+ * 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
+ * DV decoder
+ */
+
+#include "libavutil/pixdesc.h"
+#include "avcodec.h"
+#include "dsputil.h"
+#include "internal.h"
+#include "get_bits.h"
+#include "put_bits.h"
+#include "simple_idct.h"
+#include "dvdata.h"
+
+typedef struct BlockInfo {
+ const uint32_t *factor_table;
+ const uint8_t *scan_table;
+ uint8_t pos; /* position in block */
+ void (*idct_put)(uint8_t *dest, int line_size, DCTELEM *block);
+ uint8_t partial_bit_count;
+ uint32_t partial_bit_buffer;
+ int shift_offset;
+} BlockInfo;
+
+static const int dv_iweight_bits = 14;
+
+/* decode AC coefficients */
+static void dv_decode_ac(GetBitContext *gb, BlockInfo *mb, DCTELEM *block)
+{
+ int last_index = gb->size_in_bits;
+ const uint8_t *scan_table = mb->scan_table;
+ const uint32_t *factor_table = mb->factor_table;
+ int pos = mb->pos;
+ int partial_bit_count = mb->partial_bit_count;
+ int level, run, vlc_len, index;
+
+ OPEN_READER(re, gb);
+ UPDATE_CACHE(re, gb);
+
+ /* if we must parse a partial VLC, we do it here */
+ if (partial_bit_count > 0) {
+ re_cache = re_cache >> partial_bit_count | mb->partial_bit_buffer;
+ re_index -= partial_bit_count;
+ mb->partial_bit_count = 0;
+ }
+
+ /* get the AC coefficients until last_index is reached */
+ for (;;) {
+ av_dlog(NULL, "%2d: bits=%04x index=%d\n", pos, SHOW_UBITS(re, gb, 16),
+ re_index);
+ /* our own optimized GET_RL_VLC */
+ index = NEG_USR32(re_cache, TEX_VLC_BITS);
+ vlc_len = ff_dv_rl_vlc[index].len;
+ if (vlc_len < 0) {
+ index = NEG_USR32((unsigned)re_cache << TEX_VLC_BITS, -vlc_len) +
+ ff_dv_rl_vlc[index].level;
+ vlc_len = TEX_VLC_BITS - vlc_len;
+ }
+ level = ff_dv_rl_vlc[index].level;
+ run = ff_dv_rl_vlc[index].run;
+
+ /* gotta check if we're still within gb boundaries */
+ if (re_index + vlc_len > last_index) {
+ /* should be < 16 bits otherwise a codeword could have been parsed */
+ mb->partial_bit_count = last_index - re_index;
+ mb->partial_bit_buffer = re_cache & ~(-1u >> mb->partial_bit_count);
+ re_index = last_index;
+ break;
+ }
+ re_index += vlc_len;
+
+ av_dlog(NULL, "run=%d level=%d\n", run, level);
+ pos += run;
+ if (pos >= 64)
+ break;
+
+ level = (level * factor_table[pos] + (1 << (dv_iweight_bits - 1))) >> dv_iweight_bits;
+ block[scan_table[pos]] = level;
+
+ UPDATE_CACHE(re, gb);
+ }
+ CLOSE_READER(re, gb);
+ mb->pos = pos;
+}
+
+static inline void bit_copy(PutBitContext *pb, GetBitContext *gb)
+{
+ int bits_left = get_bits_left(gb);
+ while (bits_left >= MIN_CACHE_BITS) {
+ put_bits(pb, MIN_CACHE_BITS, get_bits(gb, MIN_CACHE_BITS));
+ bits_left -= MIN_CACHE_BITS;
+ }
+ if (bits_left > 0) {
+ put_bits(pb, bits_left, get_bits(gb, bits_left));
+ }
+}
+
+/* mb_x and mb_y are in units of 8 pixels */
+static int dv_decode_video_segment(AVCodecContext *avctx, void *arg)
+{
+ DVVideoContext *s = avctx->priv_data;
+ DVwork_chunk *work_chunk = arg;
+ int quant, dc, dct_mode, class1, j;
+ int mb_index, mb_x, mb_y, last_index;
+ int y_stride, linesize;
+ DCTELEM *block, *block1;
+ int c_offset;
+ uint8_t *y_ptr;
+ const uint8_t *buf_ptr;
+ PutBitContext pb, vs_pb;
+ GetBitContext gb;
+ BlockInfo mb_data[5 * DV_MAX_BPM], *mb, *mb1;
+ LOCAL_ALIGNED_16(DCTELEM, sblock, [5*DV_MAX_BPM], [64]);
+ LOCAL_ALIGNED_16(uint8_t, mb_bit_buffer, [ 80 + FF_INPUT_BUFFER_PADDING_SIZE]); /* allow some slack */
+ LOCAL_ALIGNED_16(uint8_t, vs_bit_buffer, [5*80 + FF_INPUT_BUFFER_PADDING_SIZE]); /* allow some slack */
+ const int log2_blocksize = 3;
+ int is_field_mode[5];
+
+ assert((((int)mb_bit_buffer) & 7) == 0);
+ assert((((int)vs_bit_buffer) & 7) == 0);
+
+ memset(sblock, 0, 5*DV_MAX_BPM*sizeof(*sblock));
+
+ /* pass 1: read DC and AC coefficients in blocks */
+ buf_ptr = &s->buf[work_chunk->buf_offset*80];
+ block1 = &sblock[0][0];
+ mb1 = mb_data;
+ init_put_bits(&vs_pb, vs_bit_buffer, 5 * 80);
+ for (mb_index = 0; mb_index < 5; mb_index++, mb1 += s->sys->bpm, block1 += s->sys->bpm * 64) {
+ /* skip header */
+ quant = buf_ptr[3] & 0x0f;
+ buf_ptr += 4;
+ init_put_bits(&pb, mb_bit_buffer, 80);
+ mb = mb1;
+ block = block1;
+ is_field_mode[mb_index] = 0;
+ for (j = 0; j < s->sys->bpm; j++) {
+ last_index = s->sys->block_sizes[j];
+ init_get_bits(&gb, buf_ptr, last_index);
+
+ /* get the DC */
+ dc = get_sbits(&gb, 9);
+ dct_mode = get_bits1(&gb);
+ class1 = get_bits(&gb, 2);
+ if (DV_PROFILE_IS_HD(s->sys)) {
+ mb->idct_put = s->idct_put[0];
+ mb->scan_table = s->dv_zigzag[0];
+ mb->factor_table = &s->sys->idct_factor[(j >= 4)*4*16*64 + class1*16*64 + quant*64];
+ is_field_mode[mb_index] |= !j && dct_mode;
+ } else {
+ mb->idct_put = s->idct_put[dct_mode && log2_blocksize == 3];
+ mb->scan_table = s->dv_zigzag[dct_mode];
+ mb->factor_table = &s->sys->idct_factor[(class1 == 3)*2*22*64 + dct_mode*22*64 +
+ (quant + ff_dv_quant_offset[class1])*64];
+ }
+ dc = dc << 2;
+ /* convert to unsigned because 128 is not added in the
+ standard IDCT */
+ dc += 1024;
+ block[0] = dc;
+ buf_ptr += last_index >> 3;
+ mb->pos = 0;
+ mb->partial_bit_count = 0;
+
+ av_dlog(avctx, "MB block: %d, %d ", mb_index, j);
+ dv_decode_ac(&gb, mb, block);
+
+ /* write the remaining bits in a new buffer only if the
+ block is finished */
+ if (mb->pos >= 64)
+ bit_copy(&pb, &gb);
+
+ block += 64;
+ mb++;
+ }
+
+ /* pass 2: we can do it just after */
+ av_dlog(avctx, "***pass 2 size=%d MB#=%d\n", put_bits_count(&pb), mb_index);
+ block = block1;
+ mb = mb1;
+ init_get_bits(&gb, mb_bit_buffer, put_bits_count(&pb));
+ put_bits32(&pb, 0); // padding must be zeroed
+ flush_put_bits(&pb);
+ for (j = 0; j < s->sys->bpm; j++, block += 64, mb++) {
+ if (mb->pos < 64 && get_bits_left(&gb) > 0) {
+ dv_decode_ac(&gb, mb, block);
+ /* if still not finished, no need to parse other blocks */
+ if (mb->pos < 64)
+ break;
+ }
+ }
+ /* all blocks are finished, so the extra bytes can be used at
+ the video segment level */
+ if (j >= s->sys->bpm)
+ bit_copy(&vs_pb, &gb);
+ }
+
+ /* we need a pass over the whole video segment */
+ av_dlog(avctx, "***pass 3 size=%d\n", put_bits_count(&vs_pb));
+ block = &sblock[0][0];
+ mb = mb_data;
+ init_get_bits(&gb, vs_bit_buffer, put_bits_count(&vs_pb));
+ put_bits32(&vs_pb, 0); // padding must be zeroed
+ flush_put_bits(&vs_pb);
+ for (mb_index = 0; mb_index < 5; mb_index++) {
+ for (j = 0; j < s->sys->bpm; j++) {
+ if (mb->pos < 64) {
+ av_dlog(avctx, "start %d:%d\n", mb_index, j);
+ dv_decode_ac(&gb, mb, block);
+ }
+ if (mb->pos >= 64 && mb->pos < 127)
+ av_log(avctx, AV_LOG_ERROR, "AC EOB marker is absent pos=%d\n", mb->pos);
+ block += 64;
+ mb++;
+ }
+ }
+
+ /* compute idct and place blocks */
+ block = &sblock[0][0];
+ mb = mb_data;
+ for (mb_index = 0; mb_index < 5; mb_index++) {
+ dv_calculate_mb_xy(s, work_chunk, mb_index, &mb_x, &mb_y);
+
+ /* idct_put'ting luminance */
+ if ((s->sys->pix_fmt == AV_PIX_FMT_YUV420P) ||
+ (s->sys->pix_fmt == AV_PIX_FMT_YUV411P && mb_x >= (704 / 8)) ||
+ (s->sys->height >= 720 && mb_y != 134)) {
+ y_stride = (s->picture.linesize[0] << ((!is_field_mode[mb_index]) * log2_blocksize));
+ } else {
+ y_stride = (2 << log2_blocksize);
+ }
+ y_ptr = s->picture.data[0] + ((mb_y * s->picture.linesize[0] + mb_x) << log2_blocksize);
+ linesize = s->picture.linesize[0] << is_field_mode[mb_index];
+ mb[0] .idct_put(y_ptr , linesize, block + 0*64);
+ if (s->sys->video_stype == 4) { /* SD 422 */
+ mb[2].idct_put(y_ptr + (1 << log2_blocksize) , linesize, block + 2*64);
+ } else {
+ mb[1].idct_put(y_ptr + (1 << log2_blocksize) , linesize, block + 1*64);
+ mb[2].idct_put(y_ptr + y_stride, linesize, block + 2*64);
+ mb[3].idct_put(y_ptr + (1 << log2_blocksize) + y_stride, linesize, block + 3*64);
+ }
+ mb += 4;
+ block += 4*64;
+
+ /* idct_put'ting chrominance */
+ c_offset = (((mb_y >> (s->sys->pix_fmt == AV_PIX_FMT_YUV420P)) * s->picture.linesize[1] +
+ (mb_x >> ((s->sys->pix_fmt == AV_PIX_FMT_YUV411P) ? 2 : 1))) << log2_blocksize);
+ for (j = 2; j; j--) {
+ uint8_t *c_ptr = s->picture.data[j] + c_offset;
+ if (s->sys->pix_fmt == AV_PIX_FMT_YUV411P && mb_x >= (704 / 8)) {
+ uint64_t aligned_pixels[64/8];
+ uint8_t *pixels = (uint8_t*)aligned_pixels;
+ uint8_t *c_ptr1, *ptr1;
+ int x, y;
+ mb->idct_put(pixels, 8, block);
+ for (y = 0; y < (1 << log2_blocksize); y++, c_ptr += s->picture.linesize[j], pixels += 8) {
+ ptr1 = pixels + (1 << (log2_blocksize - 1));
+ c_ptr1 = c_ptr + (s->picture.linesize[j] << log2_blocksize);
+ for (x = 0; x < (1 << (log2_blocksize - 1)); x++) {
+ c_ptr[x] = pixels[x];
+ c_ptr1[x] = ptr1[x];
+ }
+ }
+ block += 64; mb++;
+ } else {
+ y_stride = (mb_y == 134) ? (1 << log2_blocksize) :
+ s->picture.linesize[j] << ((!is_field_mode[mb_index]) * log2_blocksize);
+ linesize = s->picture.linesize[j] << is_field_mode[mb_index];
+ (mb++)-> idct_put(c_ptr , linesize, block); block += 64;
+ if (s->sys->bpm == 8) {
+ (mb++)->idct_put(c_ptr + y_stride, linesize, block); block += 64;
+ }
+ }
+ }
+ }
+ return 0;
+}
+
+/* NOTE: exactly one frame must be given (120000 bytes for NTSC,
+ 144000 bytes for PAL - or twice those for 50Mbps) */
+static int dvvideo_decode_frame(AVCodecContext *avctx,
+ void *data, int *got_frame,
+ AVPacket *avpkt)
+{
+ uint8_t *buf = avpkt->data;
+ int buf_size = avpkt->size;
+ DVVideoContext *s = avctx->priv_data;
+ const uint8_t* vsc_pack;
+ int apt, is16_9;
+
+ s->sys = avpriv_dv_frame_profile(s->sys, buf, buf_size);
+ if (!s->sys || buf_size < s->sys->frame_size || ff_dv_init_dynamic_tables(s->sys)) {
+ av_log(avctx, AV_LOG_ERROR, "could not find dv frame profile\n");
+ return -1; /* NOTE: we only accept several full frames */
+ }
+
+ if (s->picture.data[0])
+ avctx->release_buffer(avctx, &s->picture);
+
+ s->picture.reference = 0;
+ s->picture.key_frame = 1;
+ s->picture.pict_type = AV_PICTURE_TYPE_I;
+ avctx->pix_fmt = s->sys->pix_fmt;
+ avctx->time_base = s->sys->time_base;
+ avcodec_set_dimensions(avctx, s->sys->width, s->sys->height);
+ if (ff_get_buffer(avctx, &s->picture) < 0) {
+ av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
+ return -1;
+ }
+ s->picture.interlaced_frame = 1;
+ s->picture.top_field_first = 0;
+
+ s->buf = buf;
+ avctx->execute(avctx, dv_decode_video_segment, s->sys->work_chunks, NULL,
+ dv_work_pool_size(s->sys), sizeof(DVwork_chunk));
+
+ emms_c();
+
+ /* return image */
+ *got_frame = 1;
+ *(AVFrame*)data = s->picture;
+
+ /* Determine the codec's sample_aspect ratio from the packet */
+ vsc_pack = buf + 80*5 + 48 + 5;
+ if ( *vsc_pack == dv_video_control ) {
+ apt = buf[4] & 0x07;
+ is16_9 = (vsc_pack && ((vsc_pack[2] & 0x07) == 0x02 || (!apt && (vsc_pack[2] & 0x07) == 0x07)));
+ avctx->sample_aspect_ratio = s->sys->sar[is16_9];
+ }
+
+ return s->sys->frame_size;
+}
+
+static int dvvideo_close(AVCodecContext *c)
+{
+ DVVideoContext *s = c->priv_data;
+
+ if (s->picture.data[0])
+ c->release_buffer(c, &s->picture);
+
+ return 0;
+}
+
+AVCodec ff_dvvideo_decoder = {
+ .name = "dvvideo",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .id = AV_CODEC_ID_DVVIDEO,
+ .priv_data_size = sizeof(DVVideoContext),
+ .init = ff_dvvideo_init,
+ .close = dvvideo_close,
+ .decode = dvvideo_decode_frame,
+ .capabilities = CODEC_CAP_DR1 | CODEC_CAP_SLICE_THREADS,
+ .long_name = NULL_IF_CONFIG_SMALL("DV (Digital Video)"),
+};
diff --git a/gst-libs/ext/libav/libavcodec/dvdsub_parser.c b/gst-libs/ext/libav/libavcodec/dvdsub_parser.c
index f46d1a4..2ad3b33 100644
--- a/gst-libs/ext/libav/libavcodec/dvdsub_parser.c
+++ b/gst-libs/ext/libav/libavcodec/dvdsub_parser.c
@@ -19,7 +19,10 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <string.h>
+
#include "libavutil/intreadwrite.h"
+#include "libavutil/mem.h"
#include "avcodec.h"
/* parser definition */
@@ -77,7 +80,7 @@ static av_cold void dvdsub_parse_close(AVCodecParserContext *s)
}
AVCodecParser ff_dvdsub_parser = {
- .codec_ids = { CODEC_ID_DVD_SUBTITLE },
+ .codec_ids = { AV_CODEC_ID_DVD_SUBTITLE },
.priv_data_size = sizeof(DVDSubParseContext),
.parser_init = dvdsub_parse_init,
.parser_parse = dvdsub_parse,
diff --git a/gst-libs/ext/libav/libavcodec/dvdsubdec.c b/gst-libs/ext/libav/libavcodec/dvdsubdec.c
index ee9331c..e52205d 100644
--- a/gst-libs/ext/libav/libavcodec/dvdsubdec.c
+++ b/gst-libs/ext/libav/libavcodec/dvdsubdec.c
@@ -120,13 +120,12 @@ static void guess_palette(uint32_t *rgba_palette,
uint8_t *alpha,
uint32_t subtitle_color)
{
- uint8_t color_used[16];
+ uint8_t color_used[16] = { 0 };
int nb_opaque_colors, i, level, j, r, g, b;
for(i = 0; i < 4; i++)
rgba_palette[i] = 0;
- memset(color_used, 0, 16);
nb_opaque_colors = 0;
for(i = 0; i < 4; i++) {
if (alpha[i] != 0 && !color_used[colormap[i]]) {
@@ -371,14 +370,13 @@ static int is_transp(const uint8_t *buf, int pitch, int n,
/* return 0 if empty rectangle, 1 if non empty */
static int find_smallest_bounding_rectangle(AVSubtitle *s)
{
- uint8_t transp_color[256];
+ uint8_t transp_color[256] = { 0 };
int y1, y2, x1, x2, y, w, h, i;
uint8_t *bitmap;
if (s->num_rects == 0 || s->rects == NULL || s->rects[0]->w <= 0 || s->rects[0]->h <= 0)
return 0;
- memset(transp_color, 0, 256);
for(i = 0; i < s->rects[0]->nb_colors; i++) {
if ((((uint32_t*)s->rects[0]->pict.data[1])[i] >> 24) == 0)
transp_color[i] = 1;
@@ -489,7 +487,7 @@ static int dvdsub_decode(AVCodecContext *avctx,
AVCodec ff_dvdsub_decoder = {
.name = "dvdsub",
.type = AVMEDIA_TYPE_SUBTITLE,
- .id = CODEC_ID_DVD_SUBTITLE,
+ .id = AV_CODEC_ID_DVD_SUBTITLE,
.decode = dvdsub_decode,
- .long_name = NULL_IF_CONFIG_SMALL("DVD subtitles"),
+ .long_name = NULL_IF_CONFIG_SMALL("DVD subtitles"),
};
diff --git a/gst-libs/ext/libav/libavcodec/dvdsubenc.c b/gst-libs/ext/libav/libavcodec/dvdsubenc.c
index 82d0608..5e362b7 100644
--- a/gst-libs/ext/libav/libavcodec/dvdsubenc.c
+++ b/gst-libs/ext/libav/libavcodec/dvdsubenc.c
@@ -205,10 +205,10 @@ static int encode_dvd_subtitles(uint8_t *outbuf, int outbuf_size,
}
static int dvdsub_encode(AVCodecContext *avctx,
- unsigned char *buf, int buf_size, void *data)
+ unsigned char *buf, int buf_size,
+ const AVSubtitle *sub)
{
//DVDSubtitleContext *s = avctx->priv_data;
- AVSubtitle *sub = data;
int ret;
ret = encode_dvd_subtitles(buf, buf_size, sub);
@@ -218,7 +218,7 @@ static int dvdsub_encode(AVCodecContext *avctx,
AVCodec ff_dvdsub_encoder = {
.name = "dvdsub",
.type = AVMEDIA_TYPE_SUBTITLE,
- .id = CODEC_ID_DVD_SUBTITLE,
- .encode = dvdsub_encode,
- .long_name = NULL_IF_CONFIG_SMALL("DVD subtitles"),
+ .id = AV_CODEC_ID_DVD_SUBTITLE,
+ .encode_sub = dvdsub_encode,
+ .long_name = NULL_IF_CONFIG_SMALL("DVD subtitles"),
};
diff --git a/gst-libs/ext/libav/libavcodec/dwt.c b/gst-libs/ext/libav/libavcodec/dwt.c
index 2c5b56c..93cf2c6 100644
--- a/gst-libs/ext/libav/libavcodec/dwt.c
+++ b/gst-libs/ext/libav/libavcodec/dwt.c
@@ -19,30 +19,47 @@
*/
#include "libavutil/attributes.h"
+#include "libavutil/common.h"
#include "dsputil.h"
#include "dwt.h"
-void ff_slice_buffer_init(slice_buffer * buf, int line_count, int max_allocated_lines, int line_width, IDWTELEM * base_buffer)
+int ff_slice_buffer_init(slice_buffer *buf, int line_count,
+ int max_allocated_lines, int line_width,
+ IDWTELEM *base_buffer)
{
int i;
buf->base_buffer = base_buffer;
- buf->line_count = line_count;
- buf->line_width = line_width;
- buf->data_count = max_allocated_lines;
- buf->line = av_mallocz (sizeof(IDWTELEM *) * line_count);
- buf->data_stack = av_malloc (sizeof(IDWTELEM *) * max_allocated_lines);
-
- for(i = 0; i < max_allocated_lines; i++){
- buf->data_stack[i] = av_malloc (sizeof(IDWTELEM) * line_width);
+ buf->line_count = line_count;
+ buf->line_width = line_width;
+ buf->data_count = max_allocated_lines;
+ buf->line = av_mallocz(sizeof(IDWTELEM *) * line_count);
+ if (!buf->line)
+ return AVERROR(ENOMEM);
+ buf->data_stack = av_malloc(sizeof(IDWTELEM *) * max_allocated_lines);
+ if (!buf->data_stack) {
+ av_free(buf->line);
+ return AVERROR(ENOMEM);
+ }
+
+ for (i = 0; i < max_allocated_lines; i++) {
+ buf->data_stack[i] = av_malloc(sizeof(IDWTELEM) * line_width);
+ if (!buf->data_stack[i]) {
+ for (i--; i >=0; i--)
+ av_free(buf->data_stack[i]);
+ av_free(buf->data_stack);
+ av_free(buf->line);
+ return AVERROR(ENOMEM);
+ }
}
buf->data_stack_top = max_allocated_lines - 1;
+ return 0;
}
-IDWTELEM * ff_slice_buffer_load_line(slice_buffer * buf, int line)
+IDWTELEM *ff_slice_buffer_load_line(slice_buffer *buf, int line)
{
- IDWTELEM * buffer;
+ IDWTELEM *buffer;
assert(buf->data_stack_top >= 0);
// assert(!buf->line[line]);
@@ -56,9 +73,9 @@ IDWTELEM * ff_slice_buffer_load_line(slice_buffer * buf, int line)
return buffer;
}
-void ff_slice_buffer_release(slice_buffer * buf, int line)
+void ff_slice_buffer_release(slice_buffer *buf, int line)
{
- IDWTELEM * buffer;
+ IDWTELEM *buffer;
assert(line >= 0 && line < buf->line_count);
assert(buf->line[line]);
@@ -66,778 +83,779 @@ void ff_slice_buffer_release(slice_buffer * buf, int line)
buffer = buf->line[line];
buf->data_stack_top++;
buf->data_stack[buf->data_stack_top] = buffer;
- buf->line[line] = NULL;
+ buf->line[line] = NULL;
}
-void ff_slice_buffer_flush(slice_buffer * buf)
+void ff_slice_buffer_flush(slice_buffer *buf)
{
int i;
- for(i = 0; i < buf->line_count; i++){
+ for (i = 0; i < buf->line_count; i++)
if (buf->line[i])
ff_slice_buffer_release(buf, i);
- }
}
-void ff_slice_buffer_destroy(slice_buffer * buf)
+void ff_slice_buffer_destroy(slice_buffer *buf)
{
int i;
ff_slice_buffer_flush(buf);
- for(i = buf->data_count - 1; i >= 0; i--){
+ for (i = buf->data_count - 1; i >= 0; i--)
av_freep(&buf->data_stack[i]);
- }
av_freep(&buf->data_stack);
av_freep(&buf->line);
}
-static inline int mirror(int v, int m){
- while((unsigned)v > (unsigned)m){
- v=-v;
- if(v<0) v+= 2*m;
+static inline int mirror(int v, int m)
+{
+ while ((unsigned)v > (unsigned)m) {
+ v = -v;
+ if (v < 0)
+ v += 2 * m;
}
return v;
}
-static av_always_inline void
-lift(DWTELEM *dst, DWTELEM *src, DWTELEM *ref,
- int dst_step, int src_step, int ref_step,
- int width, int mul, int add, int shift,
- int highpass, int inverse){
- const int mirror_left= !highpass;
- const int mirror_right= (width&1) ^ highpass;
- const int w= (width>>1) - 1 + (highpass & width);
- int i;
-
-#define LIFT(src, ref, inv) ((src) + ((inv) ? - (ref) : + (ref)))
- if(mirror_left){
- dst[0] = LIFT(src[0], ((mul*2*ref[0]+add)>>shift), inverse);
- dst += dst_step;
- src += src_step;
- }
-
- for(i=0; i<w; i++){
- dst[i*dst_step] =
- LIFT(src[i*src_step],
- ((mul*(ref[i*ref_step] + ref[(i+1)*ref_step])+add)>>shift),
- inverse);
- }
-
- if(mirror_right){
- dst[w*dst_step] =
- LIFT(src[w*src_step],
- ((mul*2*ref[w*ref_step]+add)>>shift),
- inverse);
- }
-}
-
-static av_always_inline void
-inv_lift(IDWTELEM *dst, IDWTELEM *src, IDWTELEM *ref,
- int dst_step, int src_step, int ref_step,
- int width, int mul, int add, int shift,
- int highpass, int inverse){
- const int mirror_left= !highpass;
- const int mirror_right= (width&1) ^ highpass;
- const int w= (width>>1) - 1 + (highpass & width);
+static av_always_inline void lift(DWTELEM *dst, DWTELEM *src, DWTELEM *ref,
+ int dst_step, int src_step, int ref_step,
+ int width, int mul, int add, int shift,
+ int highpass, int inverse)
+{
+ const int mirror_left = !highpass;
+ const int mirror_right = (width & 1) ^ highpass;
+ const int w = (width >> 1) - 1 + (highpass & width);
int i;
-#define LIFT(src, ref, inv) ((src) + ((inv) ? - (ref) : + (ref)))
- if(mirror_left){
- dst[0] = LIFT(src[0], ((mul*2*ref[0]+add)>>shift), inverse);
- dst += dst_step;
- src += src_step;
+#define LIFT(src, ref, inv) ((src) + ((inv) ? -(ref) : +(ref)))
+ if (mirror_left) {
+ dst[0] = LIFT(src[0], ((mul * 2 * ref[0] + add) >> shift), inverse);
+ dst += dst_step;
+ src += src_step;
}
- for(i=0; i<w; i++){
- dst[i*dst_step] =
- LIFT(src[i*src_step],
- ((mul*(ref[i*ref_step] + ref[(i+1)*ref_step])+add)>>shift),
- inverse);
- }
+ for (i = 0; i < w; i++)
+ dst[i * dst_step] = LIFT(src[i * src_step],
+ ((mul * (ref[i * ref_step] +
+ ref[(i + 1) * ref_step]) +
+ add) >> shift),
+ inverse);
- if(mirror_right){
- dst[w*dst_step] =
- LIFT(src[w*src_step],
- ((mul*2*ref[w*ref_step]+add)>>shift),
- inverse);
- }
+ if (mirror_right)
+ dst[w * dst_step] = LIFT(src[w * src_step],
+ ((mul * 2 * ref[w * ref_step] + add) >> shift),
+ inverse);
}
-#ifndef liftS
-static av_always_inline void
-liftS(DWTELEM *dst, DWTELEM *src, DWTELEM *ref,
- int dst_step, int src_step, int ref_step,
- int width, int mul, int add, int shift,
- int highpass, int inverse){
- const int mirror_left= !highpass;
- const int mirror_right= (width&1) ^ highpass;
- const int w= (width>>1) - 1 + (highpass & width);
- int i;
-
- assert(shift == 4);
-#define LIFTS(src, ref, inv) \
- ((inv) ? \
- (src) + (((ref) + 4*(src))>>shift): \
- -((-16*(src) + (ref) + add/4 + 1 + (5<<25))/(5*4) - (1<<23)))
- if(mirror_left){
- dst[0] = LIFTS(src[0], mul*2*ref[0]+add, inverse);
- dst += dst_step;
- src += src_step;
- }
-
- for(i=0; i<w; i++){
- dst[i*dst_step] =
- LIFTS(src[i*src_step],
- mul*(ref[i*ref_step] + ref[(i+1)*ref_step])+add,
- inverse);
- }
-
- if(mirror_right){
- dst[w*dst_step] =
- LIFTS(src[w*src_step], mul*2*ref[w*ref_step]+add, inverse);
- }
-}
-static av_always_inline void
-inv_liftS(IDWTELEM *dst, IDWTELEM *src, IDWTELEM *ref,
- int dst_step, int src_step, int ref_step,
- int width, int mul, int add, int shift,
- int highpass, int inverse){
- const int mirror_left= !highpass;
- const int mirror_right= (width&1) ^ highpass;
- const int w= (width>>1) - 1 + (highpass & width);
+static av_always_inline void liftS(DWTELEM *dst, DWTELEM *src, DWTELEM *ref,
+ int dst_step, int src_step, int ref_step,
+ int width, int mul, int add, int shift,
+ int highpass, int inverse)
+{
+ const int mirror_left = !highpass;
+ const int mirror_right = (width & 1) ^ highpass;
+ const int w = (width >> 1) - 1 + (highpass & width);
int i;
assert(shift == 4);
-#define LIFTS(src, ref, inv) \
- ((inv) ? \
- (src) + (((ref) + 4*(src))>>shift): \
- -((-16*(src) + (ref) + add/4 + 1 + (5<<25))/(5*4) - (1<<23)))
- if(mirror_left){
- dst[0] = LIFTS(src[0], mul*2*ref[0]+add, inverse);
- dst += dst_step;
- src += src_step;
+#define LIFTS(src, ref, inv) \
+ ((inv) ? (src) + (((ref) + 4 * (src)) >> shift) \
+ : -((-16 * (src) + (ref) + add / \
+ 4 + 1 + (5 << 25)) / (5 * 4) - (1 << 23)))
+ if (mirror_left) {
+ dst[0] = LIFTS(src[0], mul * 2 * ref[0] + add, inverse);
+ dst += dst_step;
+ src += src_step;
}
- for(i=0; i<w; i++){
- dst[i*dst_step] =
- LIFTS(src[i*src_step],
- mul*(ref[i*ref_step] + ref[(i+1)*ref_step])+add,
- inverse);
- }
+ for (i = 0; i < w; i++)
+ dst[i * dst_step] = LIFTS(src[i * src_step],
+ mul * (ref[i * ref_step] +
+ ref[(i + 1) * ref_step]) + add,
+ inverse);
- if(mirror_right){
- dst[w*dst_step] =
- LIFTS(src[w*src_step], mul*2*ref[w*ref_step]+add, inverse);
- }
+ if (mirror_right)
+ dst[w * dst_step] = LIFTS(src[w * src_step],
+ mul * 2 * ref[w * ref_step] + add,
+ inverse);
}
-#endif /* ! liftS */
-static void horizontal_decompose53i(DWTELEM *b, int width){
- DWTELEM temp[width];
- const int width2= width>>1;
+static void horizontal_decompose53i(DWTELEM *b, DWTELEM *temp, int width)
+{
+ const int width2 = width >> 1;
int x;
- const int w2= (width+1)>>1;
+ const int w2 = (width + 1) >> 1;
- for(x=0; x<width2; x++){
- temp[x ]= b[2*x ];
- temp[x+w2]= b[2*x + 1];
- }
- if(width&1)
- temp[x ]= b[2*x ];
-#if 0
- {
- int A1,A2,A3,A4;
- A2= temp[1 ];
- A4= temp[0 ];
- A1= temp[0+width2];
- A1 -= (A2 + A4)>>1;
- A4 += (A1 + 1)>>1;
- b[0+width2] = A1;
- b[0 ] = A4;
- for(x=1; x+1<width2; x+=2){
- A3= temp[x+width2];
- A4= temp[x+1 ];
- A3 -= (A2 + A4)>>1;
- A2 += (A1 + A3 + 2)>>2;
- b[x+width2] = A3;
- b[x ] = A2;
-
- A1= temp[x+1+width2];
- A2= temp[x+2 ];
- A1 -= (A2 + A4)>>1;
- A4 += (A1 + A3 + 2)>>2;
- b[x+1+width2] = A1;
- b[x+1 ] = A4;
+ for (x = 0; x < width2; x++) {
+ temp[x] = b[2 * x];
+ temp[x + w2] = b[2 * x + 1];
}
- A3= temp[width-1];
- A3 -= A2;
- A2 += (A1 + A3 + 2)>>2;
- b[width -1] = A3;
- b[width2-1] = A2;
- }
-#else
- lift(b+w2, temp+w2, temp, 1, 1, 1, width, -1, 0, 1, 1, 0);
- lift(b , temp , b+w2, 1, 1, 1, width, 1, 2, 2, 0, 0);
-#endif /* 0 */
+ if (width & 1)
+ temp[x] = b[2 * x];
+ lift(b + w2, temp + w2, temp, 1, 1, 1, width, -1, 0, 1, 1, 0);
+ lift(b, temp, b + w2, 1, 1, 1, width, 1, 2, 2, 0, 0);
}
-static void vertical_decompose53iH0(DWTELEM *b0, DWTELEM *b1, DWTELEM *b2, int width){
+static void vertical_decompose53iH0(DWTELEM *b0, DWTELEM *b1, DWTELEM *b2,
+ int width)
+{
int i;
- for(i=0; i<width; i++){
- b1[i] -= (b0[i] + b2[i])>>1;
- }
+ for (i = 0; i < width; i++)
+ b1[i] -= (b0[i] + b2[i]) >> 1;
}
-static void vertical_decompose53iL0(DWTELEM *b0, DWTELEM *b1, DWTELEM *b2, int width){
+static void vertical_decompose53iL0(DWTELEM *b0, DWTELEM *b1, DWTELEM *b2,
+ int width)
+{
int i;
- for(i=0; i<width; i++){
- b1[i] += (b0[i] + b2[i] + 2)>>2;
- }
+ for (i = 0; i < width; i++)
+ b1[i] += (b0[i] + b2[i] + 2) >> 2;
}
-static void spatial_decompose53i(DWTELEM *buffer, int width, int height, int stride){
+static void spatial_decompose53i(DWTELEM *buffer, DWTELEM *temp,
+ int width, int height, int stride)
+{
int y;
- DWTELEM *b0= buffer + mirror(-2-1, height-1)*stride;
- DWTELEM *b1= buffer + mirror(-2 , height-1)*stride;
+ DWTELEM *b0 = buffer + mirror(-2 - 1, height - 1) * stride;
+ DWTELEM *b1 = buffer + mirror(-2, height - 1) * stride;
- for(y=-2; y<height; y+=2){
- DWTELEM *b2= buffer + mirror(y+1, height-1)*stride;
- DWTELEM *b3= buffer + mirror(y+2, height-1)*stride;
+ for (y = -2; y < height; y += 2) {
+ DWTELEM *b2 = buffer + mirror(y + 1, height - 1) * stride;
+ DWTELEM *b3 = buffer + mirror(y + 2, height - 1) * stride;
- if(y+1<(unsigned)height) horizontal_decompose53i(b2, width);
- if(y+2<(unsigned)height) horizontal_decompose53i(b3, width);
+ if (y + 1 < (unsigned)height)
+ horizontal_decompose53i(b2, temp, width);
+ if (y + 2 < (unsigned)height)
+ horizontal_decompose53i(b3, temp, width);
- if(y+1<(unsigned)height) vertical_decompose53iH0(b1, b2, b3, width);
- if(y+0<(unsigned)height) vertical_decompose53iL0(b0, b1, b2, width);
+ if (y + 1 < (unsigned)height)
+ vertical_decompose53iH0(b1, b2, b3, width);
+ if (y + 0 < (unsigned)height)
+ vertical_decompose53iL0(b0, b1, b2, width);
- b0=b2;
- b1=b3;
+ b0 = b2;
+ b1 = b3;
}
}
-static void horizontal_decompose97i(DWTELEM *b, int width){
- DWTELEM temp[width];
- const int w2= (width+1)>>1;
+static void horizontal_decompose97i(DWTELEM *b, DWTELEM *temp, int width)
+{
+ const int w2 = (width + 1) >> 1;
- lift (temp+w2, b +1, b , 1, 2, 2, width, W_AM, W_AO, W_AS, 1, 1);
- liftS(temp , b , temp+w2, 1, 2, 1, width, W_BM, W_BO, W_BS, 0, 0);
- lift (b +w2, temp+w2, temp , 1, 1, 1, width, W_CM, W_CO, W_CS, 1, 0);
- lift (b , temp , b +w2, 1, 1, 1, width, W_DM, W_DO, W_DS, 0, 0);
+ lift(temp + w2, b + 1, b, 1, 2, 2, width, W_AM, W_AO, W_AS, 1, 1);
+ liftS(temp, b, temp + w2, 1, 2, 1, width, W_BM, W_BO, W_BS, 0, 0);
+ lift(b + w2, temp + w2, temp, 1, 1, 1, width, W_CM, W_CO, W_CS, 1, 0);
+ lift(b, temp, b + w2, 1, 1, 1, width, W_DM, W_DO, W_DS, 0, 0);
}
-
-static void vertical_decompose97iH0(DWTELEM *b0, DWTELEM *b1, DWTELEM *b2, int width){
+static void vertical_decompose97iH0(DWTELEM *b0, DWTELEM *b1, DWTELEM *b2,
+ int width)
+{
int i;
- for(i=0; i<width; i++){
- b1[i] -= (W_AM*(b0[i] + b2[i])+W_AO)>>W_AS;
- }
+ for (i = 0; i < width; i++)
+ b1[i] -= (W_AM * (b0[i] + b2[i]) + W_AO) >> W_AS;
}
-static void vertical_decompose97iH1(DWTELEM *b0, DWTELEM *b1, DWTELEM *b2, int width){
+static void vertical_decompose97iH1(DWTELEM *b0, DWTELEM *b1, DWTELEM *b2,
+ int width)
+{
int i;
- for(i=0; i<width; i++){
- b1[i] += (W_CM*(b0[i] + b2[i])+W_CO)>>W_CS;
- }
+ for (i = 0; i < width; i++)
+ b1[i] += (W_CM * (b0[i] + b2[i]) + W_CO) >> W_CS;
}
-static void vertical_decompose97iL0(DWTELEM *b0, DWTELEM *b1, DWTELEM *b2, int width){
+static void vertical_decompose97iL0(DWTELEM *b0, DWTELEM *b1, DWTELEM *b2,
+ int width)
+{
int i;
- for(i=0; i<width; i++){
-#ifdef liftS
- b1[i] -= (W_BM*(b0[i] + b2[i])+W_BO)>>W_BS;
-#else
- b1[i] = (16*4*b1[i] - 4*(b0[i] + b2[i]) + W_BO*5 + (5<<27)) / (5*16) - (1<<23);
-#endif
- }
+ for (i = 0; i < width; i++)
+ b1[i] = (16 * 4 * b1[i] - 4 * (b0[i] + b2[i]) + W_BO * 5 + (5 << 27)) /
+ (5 * 16) - (1 << 23);
}
-static void vertical_decompose97iL1(DWTELEM *b0, DWTELEM *b1, DWTELEM *b2, int width){
+static void vertical_decompose97iL1(DWTELEM *b0, DWTELEM *b1, DWTELEM *b2,
+ int width)
+{
int i;
- for(i=0; i<width; i++){
- b1[i] += (W_DM*(b0[i] + b2[i])+W_DO)>>W_DS;
- }
+ for (i = 0; i < width; i++)
+ b1[i] += (W_DM * (b0[i] + b2[i]) + W_DO) >> W_DS;
}
-static void spatial_decompose97i(DWTELEM *buffer, int width, int height, int stride){
+static void spatial_decompose97i(DWTELEM *buffer, DWTELEM *temp,
+ int width, int height, int stride)
+{
int y;
- DWTELEM *b0= buffer + mirror(-4-1, height-1)*stride;
- DWTELEM *b1= buffer + mirror(-4 , height-1)*stride;
- DWTELEM *b2= buffer + mirror(-4+1, height-1)*stride;
- DWTELEM *b3= buffer + mirror(-4+2, height-1)*stride;
-
- for(y=-4; y<height; y+=2){
- DWTELEM *b4= buffer + mirror(y+3, height-1)*stride;
- DWTELEM *b5= buffer + mirror(y+4, height-1)*stride;
-
- if(y+3<(unsigned)height) horizontal_decompose97i(b4, width);
- if(y+4<(unsigned)height) horizontal_decompose97i(b5, width);
-
- if(y+3<(unsigned)height) vertical_decompose97iH0(b3, b4, b5, width);
- if(y+2<(unsigned)height) vertical_decompose97iL0(b2, b3, b4, width);
- if(y+1<(unsigned)height) vertical_decompose97iH1(b1, b2, b3, width);
- if(y+0<(unsigned)height) vertical_decompose97iL1(b0, b1, b2, width);
-
- b0=b2;
- b1=b3;
- b2=b4;
- b3=b5;
- }
-}
-
-void ff_spatial_dwt(DWTELEM *buffer, int width, int height, int stride, int type, int decomposition_count){
+ DWTELEM *b0 = buffer + mirror(-4 - 1, height - 1) * stride;
+ DWTELEM *b1 = buffer + mirror(-4, height - 1) * stride;
+ DWTELEM *b2 = buffer + mirror(-4 + 1, height - 1) * stride;
+ DWTELEM *b3 = buffer + mirror(-4 + 2, height - 1) * stride;
+
+ for (y = -4; y < height; y += 2) {
+ DWTELEM *b4 = buffer + mirror(y + 3, height - 1) * stride;
+ DWTELEM *b5 = buffer + mirror(y + 4, height - 1) * stride;
+
+ if (y + 3 < (unsigned)height)
+ horizontal_decompose97i(b4, temp, width);
+ if (y + 4 < (unsigned)height)
+ horizontal_decompose97i(b5, temp, width);
+
+ if (y + 3 < (unsigned)height)
+ vertical_decompose97iH0(b3, b4, b5, width);
+ if (y + 2 < (unsigned)height)
+ vertical_decompose97iL0(b2, b3, b4, width);
+ if (y + 1 < (unsigned)height)
+ vertical_decompose97iH1(b1, b2, b3, width);
+ if (y + 0 < (unsigned)height)
+ vertical_decompose97iL1(b0, b1, b2, width);
+
+ b0 = b2;
+ b1 = b3;
+ b2 = b4;
+ b3 = b5;
+ }
+}
+
+void ff_spatial_dwt(DWTELEM *buffer, DWTELEM *temp, int width, int height,
+ int stride, int type, int decomposition_count)
+{
int level;
- for(level=0; level<decomposition_count; level++){
- switch(type){
- case DWT_97: spatial_decompose97i(buffer, width>>level, height>>level, stride<<level); break;
- case DWT_53: spatial_decompose53i(buffer, width>>level, height>>level, stride<<level); break;
+ for (level = 0; level < decomposition_count; level++) {
+ switch (type) {
+ case DWT_97:
+ spatial_decompose97i(buffer, temp,
+ width >> level, height >> level,
+ stride << level);
+ break;
+ case DWT_53:
+ spatial_decompose53i(buffer, temp,
+ width >> level, height >> level,
+ stride << level);
+ break;
}
}
}
-static void horizontal_compose53i(IDWTELEM *b, int width){
- IDWTELEM temp[width];
- const int width2= width>>1;
- const int w2= (width+1)>>1;
+static void horizontal_compose53i(IDWTELEM *b, IDWTELEM *temp, int width)
+{
+ const int width2 = width >> 1;
+ const int w2 = (width + 1) >> 1;
int x;
- for(x=0; x<width2; x++){
- temp[2*x ]= b[x ];
- temp[2*x + 1]= b[x+w2];
+ for (x = 0; x < width2; x++) {
+ temp[2 * x] = b[x];
+ temp[2 * x + 1] = b[x + w2];
}
- if(width&1)
- temp[2*x ]= b[x ];
+ if (width & 1)
+ temp[2 * x] = b[x];
- b[0] = temp[0] - ((temp[1]+1)>>1);
- for(x=2; x<width-1; x+=2){
- b[x ] = temp[x ] - ((temp[x-1] + temp[x+1]+2)>>2);
- b[x-1] = temp[x-1] + ((b [x-2] + b [x ]+1)>>1);
+ b[0] = temp[0] - ((temp[1] + 1) >> 1);
+ for (x = 2; x < width - 1; x += 2) {
+ b[x] = temp[x] - ((temp[x - 1] + temp[x + 1] + 2) >> 2);
+ b[x - 1] = temp[x - 1] + ((b[x - 2] + b[x] + 1) >> 1);
}
- if(width&1){
- b[x ] = temp[x ] - ((temp[x-1]+1)>>1);
- b[x-1] = temp[x-1] + ((b [x-2] + b [x ]+1)>>1);
- }else
- b[x-1] = temp[x-1] + b[x-2];
+ if (width & 1) {
+ b[x] = temp[x] - ((temp[x - 1] + 1) >> 1);
+ b[x - 1] = temp[x - 1] + ((b[x - 2] + b[x] + 1) >> 1);
+ } else
+ b[x - 1] = temp[x - 1] + b[x - 2];
}
-static void vertical_compose53iH0(IDWTELEM *b0, IDWTELEM *b1, IDWTELEM *b2, int width){
+static void vertical_compose53iH0(IDWTELEM *b0, IDWTELEM *b1, IDWTELEM *b2,
+ int width)
+{
int i;
- for(i=0; i<width; i++){
- b1[i] += (b0[i] + b2[i])>>1;
- }
+ for (i = 0; i < width; i++)
+ b1[i] += (b0[i] + b2[i]) >> 1;
}
-static void vertical_compose53iL0(IDWTELEM *b0, IDWTELEM *b1, IDWTELEM *b2, int width){
+static void vertical_compose53iL0(IDWTELEM *b0, IDWTELEM *b1, IDWTELEM *b2,
+ int width)
+{
int i;
- for(i=0; i<width; i++){
- b1[i] -= (b0[i] + b2[i] + 2)>>2;
- }
+ for (i = 0; i < width; i++)
+ b1[i] -= (b0[i] + b2[i] + 2) >> 2;
}
-static void spatial_compose53i_buffered_init(DWTCompose *cs, slice_buffer * sb, int height, int stride_line){
- cs->b0 = slice_buffer_get_line(sb, mirror(-1-1, height-1) * stride_line);
- cs->b1 = slice_buffer_get_line(sb, mirror(-1 , height-1) * stride_line);
- cs->y = -1;
+static void spatial_compose53i_buffered_init(DWTCompose *cs, slice_buffer *sb,
+ int height, int stride_line)
+{
+ cs->b0 = slice_buffer_get_line(sb,
+ mirror(-1 - 1, height - 1) * stride_line);
+ cs->b1 = slice_buffer_get_line(sb, mirror(-1, height - 1) * stride_line);
+ cs->y = -1;
}
-static void spatial_compose53i_init(DWTCompose *cs, IDWTELEM *buffer, int height, int stride){
- cs->b0 = buffer + mirror(-1-1, height-1)*stride;
- cs->b1 = buffer + mirror(-1 , height-1)*stride;
- cs->y = -1;
+static void spatial_compose53i_init(DWTCompose *cs, IDWTELEM *buffer,
+ int height, int stride)
+{
+ cs->b0 = buffer + mirror(-1 - 1, height - 1) * stride;
+ cs->b1 = buffer + mirror(-1, height - 1) * stride;
+ cs->y = -1;
}
-static void spatial_compose53i_dy_buffered(DWTCompose *cs, slice_buffer * sb, int width, int height, int stride_line){
- int y= cs->y;
+static void spatial_compose53i_dy_buffered(DWTCompose *cs, slice_buffer *sb,
+ IDWTELEM *temp,
+ int width, int height,
+ int stride_line)
+{
+ int y = cs->y;
- IDWTELEM *b0= cs->b0;
- IDWTELEM *b1= cs->b1;
- IDWTELEM *b2= slice_buffer_get_line(sb, mirror(y+1, height-1) * stride_line);
- IDWTELEM *b3= slice_buffer_get_line(sb, mirror(y+2, height-1) * stride_line);
+ IDWTELEM *b0 = cs->b0;
+ IDWTELEM *b1 = cs->b1;
+ IDWTELEM *b2 = slice_buffer_get_line(sb,
+ mirror(y + 1, height - 1) *
+ stride_line);
+ IDWTELEM *b3 = slice_buffer_get_line(sb,
+ mirror(y + 2, height - 1) *
+ stride_line);
- if(y+1<(unsigned)height && y<(unsigned)height){
+ if (y + 1 < (unsigned)height && y < (unsigned)height) {
int x;
- for(x=0; x<width; x++){
- b2[x] -= (b1[x] + b3[x] + 2)>>2;
- b1[x] += (b0[x] + b2[x])>>1;
+ for (x = 0; x < width; x++) {
+ b2[x] -= (b1[x] + b3[x] + 2) >> 2;
+ b1[x] += (b0[x] + b2[x]) >> 1;
}
- }else{
- if(y+1<(unsigned)height) vertical_compose53iL0(b1, b2, b3, width);
- if(y+0<(unsigned)height) vertical_compose53iH0(b0, b1, b2, width);
+ } else {
+ if (y + 1 < (unsigned)height)
+ vertical_compose53iL0(b1, b2, b3, width);
+ if (y + 0 < (unsigned)height)
+ vertical_compose53iH0(b0, b1, b2, width);
}
- if(y-1<(unsigned)height) horizontal_compose53i(b0, width);
- if(y+0<(unsigned)height) horizontal_compose53i(b1, width);
+ if (y - 1 < (unsigned)height)
+ horizontal_compose53i(b0, temp, width);
+ if (y + 0 < (unsigned)height)
+ horizontal_compose53i(b1, temp, width);
- cs->b0 = b2;
- cs->b1 = b3;
- cs->y += 2;
+ cs->b0 = b2;
+ cs->b1 = b3;
+ cs->y += 2;
}
-static void spatial_compose53i_dy(DWTCompose *cs, IDWTELEM *buffer, int width, int height, int stride){
- int y= cs->y;
- IDWTELEM *b0= cs->b0;
- IDWTELEM *b1= cs->b1;
- IDWTELEM *b2= buffer + mirror(y+1, height-1)*stride;
- IDWTELEM *b3= buffer + mirror(y+2, height-1)*stride;
-
- if(y+1<(unsigned)height) vertical_compose53iL0(b1, b2, b3, width);
- if(y+0<(unsigned)height) vertical_compose53iH0(b0, b1, b2, width);
+static void spatial_compose53i_dy(DWTCompose *cs, IDWTELEM *buffer,
+ IDWTELEM *temp, int width, int height,
+ int stride)
+{
+ int y = cs->y;
+ IDWTELEM *b0 = cs->b0;
+ IDWTELEM *b1 = cs->b1;
+ IDWTELEM *b2 = buffer + mirror(y + 1, height - 1) * stride;
+ IDWTELEM *b3 = buffer + mirror(y + 2, height - 1) * stride;
- if(y-1<(unsigned)height) horizontal_compose53i(b0, width);
- if(y+0<(unsigned)height) horizontal_compose53i(b1, width);
+ if (y + 1 < (unsigned)height)
+ vertical_compose53iL0(b1, b2, b3, width);
+ if (y + 0 < (unsigned)height)
+ vertical_compose53iH0(b0, b1, b2, width);
- cs->b0 = b2;
- cs->b1 = b3;
- cs->y += 2;
-}
+ if (y - 1 < (unsigned)height)
+ horizontal_compose53i(b0, temp, width);
+ if (y + 0 < (unsigned)height)
+ horizontal_compose53i(b1, temp, width);
-static void av_unused spatial_compose53i(IDWTELEM *buffer, int width, int height, int stride){
- DWTCompose cs;
- spatial_compose53i_init(&cs, buffer, height, stride);
- while(cs.y <= height)
- spatial_compose53i_dy(&cs, buffer, width, height, stride);
+ cs->b0 = b2;
+ cs->b1 = b3;
+ cs->y += 2;
}
-
-void ff_snow_horizontal_compose97i(IDWTELEM *b, int width){
- IDWTELEM temp[width];
- const int w2= (width+1)>>1;
-
-#if 0 //maybe more understadable but slower
- inv_lift (temp , b , b +w2, 2, 1, 1, width, W_DM, W_DO, W_DS, 0, 1);
- inv_lift (temp+1 , b +w2, temp , 2, 1, 2, width, W_CM, W_CO, W_CS, 1, 1);
-
- inv_liftS(b , temp , temp+1 , 2, 2, 2, width, W_BM, W_BO, W_BS, 0, 1);
- inv_lift (b+1 , temp+1 , b , 2, 2, 2, width, W_AM, W_AO, W_AS, 1, 0);
-#else
+void ff_snow_horizontal_compose97i(IDWTELEM *b, IDWTELEM *temp, int width)
+{
+ const int w2 = (width + 1) >> 1;
int x;
- temp[0] = b[0] - ((3*b[w2]+2)>>2);
- for(x=1; x<(width>>1); x++){
- temp[2*x ] = b[x ] - ((3*(b [x+w2-1] + b[x+w2])+4)>>3);
- temp[2*x-1] = b[x+w2-1] - temp[2*x-2] - temp[2*x];
+
+ temp[0] = b[0] - ((3 * b[w2] + 2) >> 2);
+ for (x = 1; x < (width >> 1); x++) {
+ temp[2 * x] = b[x] - ((3 * (b[x + w2 - 1] + b[x + w2]) + 4) >> 3);
+ temp[2 * x - 1] = b[x + w2 - 1] - temp[2 * x - 2] - temp[2 * x];
}
- if(width&1){
- temp[2*x ] = b[x ] - ((3*b [x+w2-1]+2)>>2);
- temp[2*x-1] = b[x+w2-1] - temp[2*x-2] - temp[2*x];
- }else
- temp[2*x-1] = b[x+w2-1] - 2*temp[2*x-2];
-
- b[0] = temp[0] + ((2*temp[0] + temp[1]+4)>>3);
- for(x=2; x<width-1; x+=2){
- b[x ] = temp[x ] + ((4*temp[x ] + temp[x-1] + temp[x+1]+8)>>4);
- b[x-1] = temp[x-1] + ((3*(b [x-2] + b [x ] ))>>1);
+ if (width & 1) {
+ temp[2 * x] = b[x] - ((3 * b[x + w2 - 1] + 2) >> 2);
+ temp[2 * x - 1] = b[x + w2 - 1] - temp[2 * x - 2] - temp[2 * x];
+ } else
+ temp[2 * x - 1] = b[x + w2 - 1] - 2 * temp[2 * x - 2];
+
+ b[0] = temp[0] + ((2 * temp[0] + temp[1] + 4) >> 3);
+ for (x = 2; x < width - 1; x += 2) {
+ b[x] = temp[x] + ((4 * temp[x] + temp[x - 1] + temp[x + 1] + 8) >> 4);
+ b[x - 1] = temp[x - 1] + ((3 * (b[x - 2] + b[x])) >> 1);
}
- if(width&1){
- b[x ] = temp[x ] + ((2*temp[x ] + temp[x-1]+4)>>3);
- b[x-1] = temp[x-1] + ((3*(b [x-2] + b [x ] ))>>1);
- }else
- b[x-1] = temp[x-1] + 3*b [x-2];
-#endif
+ if (width & 1) {
+ b[x] = temp[x] + ((2 * temp[x] + temp[x - 1] + 4) >> 3);
+ b[x - 1] = temp[x - 1] + ((3 * (b[x - 2] + b[x])) >> 1);
+ } else
+ b[x - 1] = temp[x - 1] + 3 * b[x - 2];
}
-static void vertical_compose97iH0(IDWTELEM *b0, IDWTELEM *b1, IDWTELEM *b2, int width){
+static void vertical_compose97iH0(IDWTELEM *b0, IDWTELEM *b1, IDWTELEM *b2,
+ int width)
+{
int i;
- for(i=0; i<width; i++){
- b1[i] += (W_AM*(b0[i] + b2[i])+W_AO)>>W_AS;
- }
+ for (i = 0; i < width; i++)
+ b1[i] += (W_AM * (b0[i] + b2[i]) + W_AO) >> W_AS;
}
-static void vertical_compose97iH1(IDWTELEM *b0, IDWTELEM *b1, IDWTELEM *b2, int width){
+static void vertical_compose97iH1(IDWTELEM *b0, IDWTELEM *b1, IDWTELEM *b2,
+ int width)
+{
int i;
- for(i=0; i<width; i++){
- b1[i] -= (W_CM*(b0[i] + b2[i])+W_CO)>>W_CS;
- }
+ for (i = 0; i < width; i++)
+ b1[i] -= (W_CM * (b0[i] + b2[i]) + W_CO) >> W_CS;
}
-static void vertical_compose97iL0(IDWTELEM *b0, IDWTELEM *b1, IDWTELEM *b2, int width){
+static void vertical_compose97iL0(IDWTELEM *b0, IDWTELEM *b1, IDWTELEM *b2,
+ int width)
+{
int i;
- for(i=0; i<width; i++){
-#ifdef liftS
- b1[i] += (W_BM*(b0[i] + b2[i])+W_BO)>>W_BS;
-#else
- b1[i] += (W_BM*(b0[i] + b2[i])+4*b1[i]+W_BO)>>W_BS;
-#endif
- }
+ for (i = 0; i < width; i++)
+ b1[i] += (W_BM * (b0[i] + b2[i]) + 4 * b1[i] + W_BO) >> W_BS;
}
-static void vertical_compose97iL1(IDWTELEM *b0, IDWTELEM *b1, IDWTELEM *b2, int width){
+static void vertical_compose97iL1(IDWTELEM *b0, IDWTELEM *b1, IDWTELEM *b2,
+ int width)
+{
int i;
- for(i=0; i<width; i++){
- b1[i] -= (W_DM*(b0[i] + b2[i])+W_DO)>>W_DS;
- }
+ for (i = 0; i < width; i++)
+ b1[i] -= (W_DM * (b0[i] + b2[i]) + W_DO) >> W_DS;
}
-void ff_snow_vertical_compose97i(IDWTELEM *b0, IDWTELEM *b1, IDWTELEM *b2, IDWTELEM *b3, IDWTELEM *b4, IDWTELEM *b5, int width){
+void ff_snow_vertical_compose97i(IDWTELEM *b0, IDWTELEM *b1, IDWTELEM *b2,
+ IDWTELEM *b3, IDWTELEM *b4, IDWTELEM *b5,
+ int width)
+{
int i;
- for(i=0; i<width; i++){
- b4[i] -= (W_DM*(b3[i] + b5[i])+W_DO)>>W_DS;
- b3[i] -= (W_CM*(b2[i] + b4[i])+W_CO)>>W_CS;
-#ifdef liftS
- b2[i] += (W_BM*(b1[i] + b3[i])+W_BO)>>W_BS;
-#else
- b2[i] += (W_BM*(b1[i] + b3[i])+4*b2[i]+W_BO)>>W_BS;
-#endif
- b1[i] += (W_AM*(b0[i] + b2[i])+W_AO)>>W_AS;
+ for (i = 0; i < width; i++) {
+ b4[i] -= (W_DM * (b3[i] + b5[i]) + W_DO) >> W_DS;
+ b3[i] -= (W_CM * (b2[i] + b4[i]) + W_CO) >> W_CS;
+ b2[i] += (W_BM * (b1[i] + b3[i]) + 4 * b2[i] + W_BO) >> W_BS;
+ b1[i] += (W_AM * (b0[i] + b2[i]) + W_AO) >> W_AS;
}
}
-static void spatial_compose97i_buffered_init(DWTCompose *cs, slice_buffer * sb, int height, int stride_line){
- cs->b0 = slice_buffer_get_line(sb, mirror(-3-1, height-1) * stride_line);
- cs->b1 = slice_buffer_get_line(sb, mirror(-3 , height-1) * stride_line);
- cs->b2 = slice_buffer_get_line(sb, mirror(-3+1, height-1) * stride_line);
- cs->b3 = slice_buffer_get_line(sb, mirror(-3+2, height-1) * stride_line);
- cs->y = -3;
+static void spatial_compose97i_buffered_init(DWTCompose *cs, slice_buffer *sb,
+ int height, int stride_line)
+{
+ cs->b0 = slice_buffer_get_line(sb, mirror(-3 - 1, height - 1) * stride_line);
+ cs->b1 = slice_buffer_get_line(sb, mirror(-3, height - 1) * stride_line);
+ cs->b2 = slice_buffer_get_line(sb, mirror(-3 + 1, height - 1) * stride_line);
+ cs->b3 = slice_buffer_get_line(sb, mirror(-3 + 2, height - 1) * stride_line);
+ cs->y = -3;
}
-static void spatial_compose97i_init(DWTCompose *cs, IDWTELEM *buffer, int height, int stride){
- cs->b0 = buffer + mirror(-3-1, height-1)*stride;
- cs->b1 = buffer + mirror(-3 , height-1)*stride;
- cs->b2 = buffer + mirror(-3+1, height-1)*stride;
- cs->b3 = buffer + mirror(-3+2, height-1)*stride;
- cs->y = -3;
+static void spatial_compose97i_init(DWTCompose *cs, IDWTELEM *buffer, int height,
+ int stride)
+{
+ cs->b0 = buffer + mirror(-3 - 1, height - 1) * stride;
+ cs->b1 = buffer + mirror(-3, height - 1) * stride;
+ cs->b2 = buffer + mirror(-3 + 1, height - 1) * stride;
+ cs->b3 = buffer + mirror(-3 + 2, height - 1) * stride;
+ cs->y = -3;
}
-static void spatial_compose97i_dy_buffered(DWTContext *dsp, DWTCompose *cs, slice_buffer * sb, int width, int height, int stride_line){
+static void spatial_compose97i_dy_buffered(DWTContext *dsp, DWTCompose *cs,
+ slice_buffer * sb, IDWTELEM *temp,
+ int width, int height,
+ int stride_line)
+{
int y = cs->y;
- IDWTELEM *b0= cs->b0;
- IDWTELEM *b1= cs->b1;
- IDWTELEM *b2= cs->b2;
- IDWTELEM *b3= cs->b3;
- IDWTELEM *b4= slice_buffer_get_line(sb, mirror(y + 3, height - 1) * stride_line);
- IDWTELEM *b5= slice_buffer_get_line(sb, mirror(y + 4, height - 1) * stride_line);
-
- if(y>0 && y+4<height){
+ IDWTELEM *b0 = cs->b0;
+ IDWTELEM *b1 = cs->b1;
+ IDWTELEM *b2 = cs->b2;
+ IDWTELEM *b3 = cs->b3;
+ IDWTELEM *b4 = slice_buffer_get_line(sb,
+ mirror(y + 3, height - 1) *
+ stride_line);
+ IDWTELEM *b5 = slice_buffer_get_line(sb,
+ mirror(y + 4, height - 1) *
+ stride_line);
+
+ if (y > 0 && y + 4 < height) {
dsp->vertical_compose97i(b0, b1, b2, b3, b4, b5, width);
- }else{
- if(y+3<(unsigned)height) vertical_compose97iL1(b3, b4, b5, width);
- if(y+2<(unsigned)height) vertical_compose97iH1(b2, b3, b4, width);
- if(y+1<(unsigned)height) vertical_compose97iL0(b1, b2, b3, width);
- if(y+0<(unsigned)height) vertical_compose97iH0(b0, b1, b2, width);
- }
-
- if(y-1<(unsigned)height) dsp->horizontal_compose97i(b0, width);
- if(y+0<(unsigned)height) dsp->horizontal_compose97i(b1, width);
-
- cs->b0=b2;
- cs->b1=b3;
- cs->b2=b4;
- cs->b3=b5;
- cs->y += 2;
-}
-
-static void spatial_compose97i_dy(DWTCompose *cs, IDWTELEM *buffer, int width, int height, int stride){
- int y = cs->y;
- IDWTELEM *b0= cs->b0;
- IDWTELEM *b1= cs->b1;
- IDWTELEM *b2= cs->b2;
- IDWTELEM *b3= cs->b3;
- IDWTELEM *b4= buffer + mirror(y+3, height-1)*stride;
- IDWTELEM *b5= buffer + mirror(y+4, height-1)*stride;
-
- if(y+3<(unsigned)height) vertical_compose97iL1(b3, b4, b5, width);
- if(y+2<(unsigned)height) vertical_compose97iH1(b2, b3, b4, width);
- if(y+1<(unsigned)height) vertical_compose97iL0(b1, b2, b3, width);
- if(y+0<(unsigned)height) vertical_compose97iH0(b0, b1, b2, width);
-
- if(y-1<(unsigned)height) ff_snow_horizontal_compose97i(b0, width);
- if(y+0<(unsigned)height) ff_snow_horizontal_compose97i(b1, width);
-
- cs->b0=b2;
- cs->b1=b3;
- cs->b2=b4;
- cs->b3=b5;
- cs->y += 2;
-}
-
-static void av_unused spatial_compose97i(IDWTELEM *buffer, int width, int height, int stride){
- DWTCompose cs;
- spatial_compose97i_init(&cs, buffer, height, stride);
- while(cs.y <= height)
- spatial_compose97i_dy(&cs, buffer, width, height, stride);
-}
-
-void ff_spatial_idwt_buffered_init(DWTCompose *cs, slice_buffer * sb, int width, int height, int stride_line, int type, int decomposition_count){
+ } else {
+ if (y + 3 < (unsigned)height)
+ vertical_compose97iL1(b3, b4, b5, width);
+ if (y + 2 < (unsigned)height)
+ vertical_compose97iH1(b2, b3, b4, width);
+ if (y + 1 < (unsigned)height)
+ vertical_compose97iL0(b1, b2, b3, width);
+ if (y + 0 < (unsigned)height)
+ vertical_compose97iH0(b0, b1, b2, width);
+ }
+
+ if (y - 1 < (unsigned)height)
+ dsp->horizontal_compose97i(b0, temp, width);
+ if (y + 0 < (unsigned)height)
+ dsp->horizontal_compose97i(b1, temp, width);
+
+ cs->b0 = b2;
+ cs->b1 = b3;
+ cs->b2 = b4;
+ cs->b3 = b5;
+ cs->y += 2;
+}
+
+static void spatial_compose97i_dy(DWTCompose *cs, IDWTELEM *buffer,
+ IDWTELEM *temp, int width, int height,
+ int stride)
+{
+ int y = cs->y;
+ IDWTELEM *b0 = cs->b0;
+ IDWTELEM *b1 = cs->b1;
+ IDWTELEM *b2 = cs->b2;
+ IDWTELEM *b3 = cs->b3;
+ IDWTELEM *b4 = buffer + mirror(y + 3, height - 1) * stride;
+ IDWTELEM *b5 = buffer + mirror(y + 4, height - 1) * stride;
+
+ if (y + 3 < (unsigned)height)
+ vertical_compose97iL1(b3, b4, b5, width);
+ if (y + 2 < (unsigned)height)
+ vertical_compose97iH1(b2, b3, b4, width);
+ if (y + 1 < (unsigned)height)
+ vertical_compose97iL0(b1, b2, b3, width);
+ if (y + 0 < (unsigned)height)
+ vertical_compose97iH0(b0, b1, b2, width);
+
+ if (y - 1 < (unsigned)height)
+ ff_snow_horizontal_compose97i(b0, temp, width);
+ if (y + 0 < (unsigned)height)
+ ff_snow_horizontal_compose97i(b1, temp, width);
+
+ cs->b0 = b2;
+ cs->b1 = b3;
+ cs->b2 = b4;
+ cs->b3 = b5;
+ cs->y += 2;
+}
+
+void ff_spatial_idwt_buffered_init(DWTCompose *cs, slice_buffer *sb, int width,
+ int height, int stride_line, int type,
+ int decomposition_count)
+{
int level;
- for(level=decomposition_count-1; level>=0; level--){
- switch(type){
- case DWT_97: spatial_compose97i_buffered_init(cs+level, sb, height>>level, stride_line<<level); break;
- case DWT_53: spatial_compose53i_buffered_init(cs+level, sb, height>>level, stride_line<<level); break;
+ for (level = decomposition_count - 1; level >= 0; level--) {
+ switch (type) {
+ case DWT_97:
+ spatial_compose97i_buffered_init(cs + level, sb, height >> level,
+ stride_line << level);
+ break;
+ case DWT_53:
+ spatial_compose53i_buffered_init(cs + level, sb, height >> level,
+ stride_line << level);
+ break;
}
}
}
-void ff_spatial_idwt_buffered_slice(DWTContext *dsp, DWTCompose *cs, slice_buffer * slice_buf, int width, int height, int stride_line, int type, int decomposition_count, int y){
- const int support = type==1 ? 3 : 5;
+void ff_spatial_idwt_buffered_slice(DWTContext *dsp, DWTCompose *cs,
+ slice_buffer *slice_buf, IDWTELEM *temp,
+ int width, int height, int stride_line,
+ int type, int decomposition_count, int y)
+{
+ const int support = type == 1 ? 3 : 5;
int level;
- if(type==2) return;
-
- for(level=decomposition_count-1; level>=0; level--){
- while(cs[level].y <= FFMIN((y>>level)+support, height>>level)){
- switch(type){
- case DWT_97: spatial_compose97i_dy_buffered(dsp, cs+level, slice_buf, width>>level, height>>level, stride_line<<level);
+ if (type == 2)
+ return;
+
+ for (level = decomposition_count - 1; level >= 0; level--)
+ while (cs[level].y <= FFMIN((y >> level) + support, height >> level)) {
+ switch (type) {
+ case DWT_97:
+ spatial_compose97i_dy_buffered(dsp, cs + level, slice_buf, temp,
+ width >> level,
+ height >> level,
+ stride_line << level);
break;
- case DWT_53: spatial_compose53i_dy_buffered(cs+level, slice_buf, width>>level, height>>level, stride_line<<level);
+ case DWT_53:
+ spatial_compose53i_dy_buffered(cs + level, slice_buf, temp,
+ width >> level,
+ height >> level,
+ stride_line << level);
break;
}
}
- }
}
-static void ff_spatial_idwt_init(DWTCompose *cs, IDWTELEM *buffer, int width, int height, int stride, int type, int decomposition_count){
+static void ff_spatial_idwt_init(DWTCompose *cs, IDWTELEM *buffer, int width,
+ int height, int stride, int type,
+ int decomposition_count)
+{
int level;
- for(level=decomposition_count-1; level>=0; level--){
- switch(type){
- case DWT_97: spatial_compose97i_init(cs+level, buffer, height>>level, stride<<level); break;
- case DWT_53: spatial_compose53i_init(cs+level, buffer, height>>level, stride<<level); break;
+ for (level = decomposition_count - 1; level >= 0; level--) {
+ switch (type) {
+ case DWT_97:
+ spatial_compose97i_init(cs + level, buffer, height >> level,
+ stride << level);
+ break;
+ case DWT_53:
+ spatial_compose53i_init(cs + level, buffer, height >> level,
+ stride << level);
+ break;
}
}
}
-static void ff_spatial_idwt_slice(DWTCompose *cs, IDWTELEM *buffer, int width, int height, int stride, int type, int decomposition_count, int y){
- const int support = type==1 ? 3 : 5;
+static void ff_spatial_idwt_slice(DWTCompose *cs, IDWTELEM *buffer,
+ IDWTELEM *temp, int width, int height,
+ int stride, int type,
+ int decomposition_count, int y)
+{
+ const int support = type == 1 ? 3 : 5;
int level;
- if(type==2) return;
-
- for(level=decomposition_count-1; level>=0; level--){
- while(cs[level].y <= FFMIN((y>>level)+support, height>>level)){
- switch(type){
- case DWT_97: spatial_compose97i_dy(cs+level, buffer, width>>level, height>>level, stride<<level);
+ if (type == 2)
+ return;
+
+ for (level = decomposition_count - 1; level >= 0; level--)
+ while (cs[level].y <= FFMIN((y >> level) + support, height >> level)) {
+ switch (type) {
+ case DWT_97:
+ spatial_compose97i_dy(cs + level, buffer, temp, width >> level,
+ height >> level, stride << level);
break;
- case DWT_53: spatial_compose53i_dy(cs+level, buffer, width>>level, height>>level, stride<<level);
+ case DWT_53:
+ spatial_compose53i_dy(cs + level, buffer, temp, width >> level,
+ height >> level, stride << level);
break;
}
}
- }
}
-void ff_spatial_idwt(IDWTELEM *buffer, int width, int height, int stride, int type, int decomposition_count){
- DWTCompose cs[MAX_DECOMPOSITIONS];
- int y;
- ff_spatial_idwt_init(cs, buffer, width, height, stride, type, decomposition_count);
- for(y=0; y<height; y+=4)
- ff_spatial_idwt_slice(cs, buffer, width, height, stride, type, decomposition_count, y);
+void ff_spatial_idwt(IDWTELEM *buffer, IDWTELEM *temp, int width, int height,
+ int stride, int type, int decomposition_count)
+{
+ DWTCompose cs[MAX_DECOMPOSITIONS];
+ int y;
+ ff_spatial_idwt_init(cs, buffer, width, height, stride, type,
+ decomposition_count);
+ for (y = 0; y < height; y += 4)
+ ff_spatial_idwt_slice(cs, buffer, temp, width, height, stride, type,
+ decomposition_count, y);
}
-static inline int w_c(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int w, int h, int type){
+static inline int w_c(void *v, uint8_t *pix1, uint8_t *pix2, int line_size,
+ int w, int h, int type)
+{
int s, i, j;
- const int dec_count= w==8 ? 3 : 4;
- int tmp[32*32];
+ const int dec_count = w == 8 ? 3 : 4;
+ int tmp[32 * 32], tmp2[32];
int level, ori;
- static const int scale[2][2][4][4]={
- {
+ static const int scale[2][2][4][4] = {
{
- // 9/7 8x8 dec=3
- {268, 239, 239, 213},
- { 0, 224, 224, 152},
- { 0, 135, 135, 110},
- },{
- // 9/7 16x16 or 32x32 dec=4
- {344, 310, 310, 280},
- { 0, 320, 320, 228},
- { 0, 175, 175, 136},
- { 0, 129, 129, 102},
- }
- },{
+ { // 9/7 8x8 dec=3
+ { 268, 239, 239, 213 },
+ { 0, 224, 224, 152 },
+ { 0, 135, 135, 110 },
+ },
+ { // 9/7 16x16 or 32x32 dec=4
+ { 344, 310, 310, 280 },
+ { 0, 320, 320, 228 },
+ { 0, 175, 175, 136 },
+ { 0, 129, 129, 102 },
+ }
+ },
{
- // 5/3 8x8 dec=3
- {275, 245, 245, 218},
- { 0, 230, 230, 156},
- { 0, 138, 138, 113},
- },{
- // 5/3 16x16 or 32x32 dec=4
- {352, 317, 317, 286},
- { 0, 328, 328, 233},
- { 0, 180, 180, 140},
- { 0, 132, 132, 105},
+ { // 5/3 8x8 dec=3
+ { 275, 245, 245, 218 },
+ { 0, 230, 230, 156 },
+ { 0, 138, 138, 113 },
+ },
+ { // 5/3 16x16 or 32x32 dec=4
+ { 352, 317, 317, 286 },
+ { 0, 328, 328, 233 },
+ { 0, 180, 180, 140 },
+ { 0, 132, 132, 105 },
+ }
}
- }
};
for (i = 0; i < h; i++) {
- for (j = 0; j < w; j+=4) {
- tmp[32*i+j+0] = (pix1[j+0] - pix2[j+0])<<4;
- tmp[32*i+j+1] = (pix1[j+1] - pix2[j+1])<<4;
- tmp[32*i+j+2] = (pix1[j+2] - pix2[j+2])<<4;
- tmp[32*i+j+3] = (pix1[j+3] - pix2[j+3])<<4;
+ for (j = 0; j < w; j += 4) {
+ tmp[32 * i + j + 0] = (pix1[j + 0] - pix2[j + 0]) << 4;
+ tmp[32 * i + j + 1] = (pix1[j + 1] - pix2[j + 1]) << 4;
+ tmp[32 * i + j + 2] = (pix1[j + 2] - pix2[j + 2]) << 4;
+ tmp[32 * i + j + 3] = (pix1[j + 3] - pix2[j + 3]) << 4;
}
pix1 += line_size;
pix2 += line_size;
}
- ff_spatial_dwt(tmp, w, h, 32, type, dec_count);
+ ff_spatial_dwt(tmp, tmp2, w, h, 32, type, dec_count);
- s=0;
- assert(w==h);
- for(level=0; level<dec_count; level++){
- for(ori= level ? 1 : 0; ori<4; ori++){
- int size= w>>(dec_count-level);
- int sx= (ori&1) ? size : 0;
- int stride= 32<<(dec_count-level);
- int sy= (ori&2) ? stride>>1 : 0;
+ s = 0;
+ assert(w == h);
+ for (level = 0; level < dec_count; level++)
+ for (ori = level ? 1 : 0; ori < 4; ori++) {
+ int size = w >> (dec_count - level);
+ int sx = (ori & 1) ? size : 0;
+ int stride = 32 << (dec_count - level);
+ int sy = (ori & 2) ? stride >> 1 : 0;
- for(i=0; i<size; i++){
- for(j=0; j<size; j++){
- int v= tmp[sx + sy + i*stride + j] * scale[type][dec_count-3][level][ori];
+ for (i = 0; i < size; i++)
+ for (j = 0; j < size; j++) {
+ int v = tmp[sx + sy + i * stride + j] *
+ scale[type][dec_count - 3][level][ori];
s += FFABS(v);
}
- }
}
- }
- assert(s>=0);
- return s>>9;
+ assert(s >= 0);
+ return s >> 9;
}
-static int w53_8_c(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int h){
- return w_c(v, pix1, pix2, line_size, 8, h, 1);
+static int w53_8_c(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h)
+{
+ return w_c(v, pix1, pix2, line_size, 8, h, 1);
}
-static int w97_8_c(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int h){
- return w_c(v, pix1, pix2, line_size, 8, h, 0);
+static int w97_8_c(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h)
+{
+ return w_c(v, pix1, pix2, line_size, 8, h, 0);
}
-static int w53_16_c(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int h){
+static int w53_16_c(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h)
+{
return w_c(v, pix1, pix2, line_size, 16, h, 1);
}
-static int w97_16_c(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int h){
+static int w97_16_c(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h)
+{
return w_c(v, pix1, pix2, line_size, 16, h, 0);
}
-int ff_w53_32_c(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int h){
+int ff_w53_32_c(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h)
+{
return w_c(v, pix1, pix2, line_size, 32, h, 1);
}
-int ff_w97_32_c(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int h){
+int ff_w97_32_c(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h)
+{
return w_c(v, pix1, pix2, line_size, 32, h, 0);
}
void ff_dsputil_init_dwt(DSPContext *c)
{
- c->w53[0]= w53_16_c;
- c->w53[1]= w53_8_c;
- c->w97[0]= w97_16_c;
- c->w97[1]= w97_8_c;
+ c->w53[0] = w53_16_c;
+ c->w53[1] = w53_8_c;
+ c->w97[0] = w97_16_c;
+ c->w97[1] = w97_8_c;
}
void ff_dwt_init(DWTContext *c)
{
- c->vertical_compose97i = ff_snow_vertical_compose97i;
+ c->vertical_compose97i = ff_snow_vertical_compose97i;
c->horizontal_compose97i = ff_snow_horizontal_compose97i;
- c->inner_add_yblock = ff_snow_inner_add_yblock;
+ c->inner_add_yblock = ff_snow_inner_add_yblock;
- if (HAVE_MMX) ff_dwt_init_x86(c);
+ if (HAVE_MMX)
+ ff_dwt_init_x86(c);
}
diff --git a/gst-libs/ext/libav/libavcodec/dwt.h b/gst-libs/ext/libav/libavcodec/dwt.h
index fc73fe7..e06f3f9 100644
--- a/gst-libs/ext/libav/libavcodec/dwt.h
+++ b/gst-libs/ext/libav/libavcodec/dwt.h
@@ -26,7 +26,7 @@
typedef int DWTELEM;
typedef short IDWTELEM;
-typedef struct {
+typedef struct DWTCompose {
IDWTELEM *b0;
IDWTELEM *b1;
IDWTELEM *b2;
@@ -34,21 +34,27 @@ typedef struct {
int y;
} DWTCompose;
-/** Used to minimize the amount of memory used in order to optimize cache performance. **/
+/** Used to minimize the amount of memory used in order to
+ * optimize cache performance. **/
typedef struct slice_buffer_s {
- IDWTELEM * * line; ///< For use by idwt and predict_slices.
- IDWTELEM * * data_stack; ///< Used for internal purposes.
+ IDWTELEM **line; ///< For use by idwt and predict_slices.
+ IDWTELEM **data_stack; ///< Used for internal purposes.
int data_stack_top;
int line_count;
int line_width;
int data_count;
- IDWTELEM * base_buffer; ///< Buffer that this structure is caching.
+ IDWTELEM *base_buffer; ///< Buffer that this structure is caching.
} slice_buffer;
typedef struct DWTContext {
- void (*vertical_compose97i)(IDWTELEM *b0, IDWTELEM *b1, IDWTELEM *b2, IDWTELEM *b3, IDWTELEM *b4, IDWTELEM *b5, int width);
- void (*horizontal_compose97i)(IDWTELEM *b, int width);
- void (*inner_add_yblock)(const uint8_t *obmc, const int obmc_stride, uint8_t * * block, int b_w, int b_h, int src_x, int src_y, int src_stride, slice_buffer * sb, int add, uint8_t * dst8);
+ void (*vertical_compose97i)(IDWTELEM *b0, IDWTELEM *b1, IDWTELEM *b2,
+ IDWTELEM *b3, IDWTELEM *b4, IDWTELEM *b5,
+ int width);
+ void (*horizontal_compose97i)(IDWTELEM *b, IDWTELEM *temp, int width);
+ void (*inner_add_yblock)(const uint8_t *obmc, const int obmc_stride,
+ uint8_t **block, int b_w, int b_h, int src_x,
+ int src_y, int src_stride, slice_buffer *sb,
+ int add, uint8_t *dst8);
} DWTContext;
#define MAX_DECOMPOSITIONS 8
@@ -57,7 +63,6 @@ typedef struct DWTContext {
#define DWT_53 1
#define liftS lift
-#if 1
#define W_AM 3
#define W_AO 0
#define W_AS 1
@@ -74,79 +79,44 @@ typedef struct DWTContext {
#define W_DM 3
#define W_DO 4
#define W_DS 3
-#elif 0
-#define W_AM 55
-#define W_AO 16
-#define W_AS 5
-
-#define W_BM 3
-#define W_BO 32
-#define W_BS 6
-
-#define W_CM 127
-#define W_CO 64
-#define W_CS 7
-
-#define W_DM 7
-#define W_DO 8
-#define W_DS 4
-#elif 0
-#define W_AM 97
-#define W_AO 32
-#define W_AS 6
-
-#define W_BM 63
-#define W_BO 512
-#define W_BS 10
-
-#define W_CM 13
-#define W_CO 8
-#define W_CS 4
-
-#define W_DM 15
-#define W_DO 16
-#define W_DS 5
-
-#else
-
-#define W_AM 203
-#define W_AO 64
-#define W_AS 7
-
-#define W_BM 217
-#define W_BO 2048
-#define W_BS 12
-
-#define W_CM 113
-#define W_CO 64
-#define W_CS 7
-
-#define W_DM 227
-#define W_DO 128
-#define W_DS 9
-#endif
-
-#define slice_buffer_get_line(slice_buf, line_num) ((slice_buf)->line[line_num] ? (slice_buf)->line[line_num] : ff_slice_buffer_load_line((slice_buf), (line_num)))
-//#define slice_buffer_get_line(slice_buf, line_num) (ff_slice_buffer_load_line((slice_buf), (line_num)))
-
-void ff_slice_buffer_init(slice_buffer * buf, int line_count, int max_allocated_lines, int line_width, IDWTELEM * base_buffer);
-void ff_slice_buffer_release(slice_buffer * buf, int line);
-void ff_slice_buffer_flush(slice_buffer * buf);
-void ff_slice_buffer_destroy(slice_buffer * buf);
-IDWTELEM * ff_slice_buffer_load_line(slice_buffer * buf, int line);
-
-void ff_snow_vertical_compose97i(IDWTELEM *b0, IDWTELEM *b1, IDWTELEM *b2, IDWTELEM *b3, IDWTELEM *b4, IDWTELEM *b5, int width);
-void ff_snow_horizontal_compose97i(IDWTELEM *b, int width);
-void ff_snow_inner_add_yblock(const uint8_t *obmc, const int obmc_stride, uint8_t * * block, int b_w, int b_h, int src_x, int src_y, int src_stride, slice_buffer * sb, int add, uint8_t * dst8);
-
-int ff_w53_32_c(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int h);
-int ff_w97_32_c(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int h);
-
-void ff_spatial_dwt(int *buffer, int width, int height, int stride, int type, int decomposition_count);
-
-void ff_spatial_idwt_buffered_init(DWTCompose *cs, slice_buffer * sb, int width, int height, int stride_line, int type, int decomposition_count);
-void ff_spatial_idwt_buffered_slice(DWTContext *dsp, DWTCompose *cs, slice_buffer * slice_buf, int width, int height, int stride_line, int type, int decomposition_count, int y);
-void ff_spatial_idwt(IDWTELEM *buffer, int width, int height, int stride, int type, int decomposition_count);
+
+#define slice_buffer_get_line(slice_buf, line_num) \
+ ((slice_buf)->line[line_num] ? (slice_buf)->line[line_num] \
+ : ff_slice_buffer_load_line((slice_buf), \
+ (line_num)))
+
+int ff_slice_buffer_init(slice_buffer *buf, int line_count,
+ int max_allocated_lines, int line_width,
+ IDWTELEM *base_buffer);
+void ff_slice_buffer_release(slice_buffer *buf, int line);
+void ff_slice_buffer_flush(slice_buffer *buf);
+void ff_slice_buffer_destroy(slice_buffer *buf);
+IDWTELEM *ff_slice_buffer_load_line(slice_buffer *buf, int line);
+
+void ff_snow_vertical_compose97i(IDWTELEM *b0, IDWTELEM *b1, IDWTELEM *b2,
+ IDWTELEM *b3, IDWTELEM *b4, IDWTELEM *b5,
+ int width);
+void ff_snow_horizontal_compose97i(IDWTELEM *b, IDWTELEM *temp, int width);
+void ff_snow_inner_add_yblock(const uint8_t *obmc, const int obmc_stride,
+ uint8_t **block, int b_w, int b_h, int src_x,
+ int src_y, int src_stride, slice_buffer *sb,
+ int add, uint8_t *dst8);
+
+int ff_w53_32_c(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h);
+int ff_w97_32_c(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h);
+
+void ff_spatial_dwt(int *buffer, int *temp, int width, int height, int stride,
+ int type, int decomposition_count);
+
+void ff_spatial_idwt_buffered_init(DWTCompose *cs, slice_buffer *sb, int width,
+ int height, int stride_line, int type,
+ int decomposition_count);
+void ff_spatial_idwt_buffered_slice(DWTContext *dsp, DWTCompose *cs,
+ slice_buffer *slice_buf, IDWTELEM *temp,
+ int width, int height, int stride_line,
+ int type, int decomposition_count, int y);
+void ff_spatial_idwt(IDWTELEM *buffer, IDWTELEM *temp, int width, int height,
+ int stride, int type, int decomposition_count);
void ff_dwt_init(DWTContext *c);
void ff_dwt_init_x86(DWTContext *c);
diff --git a/gst-libs/ext/libav/libavcodec/dxa.c b/gst-libs/ext/libav/libavcodec/dxa.c
index 97b912a..0f590f1 100644
--- a/gst-libs/ext/libav/libavcodec/dxa.c
+++ b/gst-libs/ext/libav/libavcodec/dxa.c
@@ -27,8 +27,10 @@
#include <stdio.h>
#include <stdlib.h>
+#include "libavutil/common.h"
#include "libavutil/intreadwrite.h"
#include "avcodec.h"
+#include "internal.h"
#include <zlib.h>
@@ -36,7 +38,6 @@
* Decoder context
*/
typedef struct DxaDecContext {
- AVCodecContext *avctx;
AVFrame pic, prev;
int dsize;
@@ -188,7 +189,7 @@ static int decode_13(AVCodecContext *avctx, DxaDecContext *c, uint8_t* dst, uint
return 0;
}
-static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt)
+static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
@@ -215,7 +216,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
buf_size -= 768+4;
}
- if(avctx->get_buffer(avctx, &c->pic) < 0){
+ if(ff_get_buffer(avctx, &c->pic) < 0){
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return -1;
}
@@ -281,7 +282,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
if(c->pic.data[0])
avctx->release_buffer(avctx, &c->pic);
- *data_size = sizeof(AVFrame);
+ *got_frame = 1;
*(AVFrame*)data = c->prev;
/* always report that the buffer was completely consumed */
@@ -292,8 +293,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
{
DxaDecContext * const c = avctx->priv_data;
- c->avctx = avctx;
- avctx->pix_fmt = PIX_FMT_PAL8;
+ avctx->pix_fmt = AV_PIX_FMT_PAL8;
c->dsize = avctx->width * avctx->height * 2;
if((c->decomp_buf = av_malloc(c->dsize)) == NULL) {
@@ -320,12 +320,11 @@ static av_cold int decode_end(AVCodecContext *avctx)
AVCodec ff_dxa_decoder = {
.name = "dxa",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_DXA,
+ .id = AV_CODEC_ID_DXA,
.priv_data_size = sizeof(DxaDecContext),
.init = decode_init,
.close = decode_end,
.decode = decode_frame,
.capabilities = CODEC_CAP_DR1,
- .long_name = NULL_IF_CONFIG_SMALL("Feeble Files/ScummVM DXA"),
+ .long_name = NULL_IF_CONFIG_SMALL("Feeble Files/ScummVM DXA"),
};
-
diff --git a/gst-libs/ext/libav/libavcodec/dxtory.c b/gst-libs/ext/libav/libavcodec/dxtory.c
index 5f67fbd..30983f8 100644
--- a/gst-libs/ext/libav/libavcodec/dxtory.c
+++ b/gst-libs/ext/libav/libavcodec/dxtory.c
@@ -21,11 +21,13 @@
*/
#include "avcodec.h"
+#include "internal.h"
+#include "libavutil/common.h"
#include "libavutil/intreadwrite.h"
static av_cold int decode_init(AVCodecContext *avctx)
{
- avctx->pix_fmt = PIX_FMT_YUV420P;
+ avctx->pix_fmt = AV_PIX_FMT_YUV420P;
avctx->coded_frame = avcodec_alloc_frame();
if (!avctx->coded_frame)
return AVERROR(ENOMEM);
@@ -33,7 +35,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
return 0;
}
-static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
+static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
AVPacket *avpkt)
{
int h, w;
@@ -51,7 +53,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
}
pic->reference = 0;
- if ((ret = avctx->get_buffer(avctx, pic)) < 0)
+ if ((ret = ff_get_buffer(avctx, pic)) < 0)
return ret;
pic->pict_type = AV_PICTURE_TYPE_I;
@@ -69,8 +71,8 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
V = pic->data[2];
for (h = 0; h < avctx->height; h += 2) {
for (w = 0; w < avctx->width; w += 2) {
- AV_WN16A(Y1 + w, AV_RN16A(src));
- AV_WN16A(Y2 + w, AV_RN16A(src + 2));
+ AV_COPY16(Y1 + w, src);
+ AV_COPY16(Y2 + w, src + 2);
U[w >> 1] = src[4] + 0x80;
V[w >> 1] = src[5] + 0x80;
src += 6;
@@ -81,7 +83,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
V += pic->linesize[2];
}
- *data_size = sizeof(AVFrame);
+ *got_frame = 1;
*(AVFrame*)data = *pic;
return avpkt->size;
@@ -101,7 +103,7 @@ AVCodec ff_dxtory_decoder = {
.name = "dxtory",
.long_name = NULL_IF_CONFIG_SMALL("Dxtory"),
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_DXTORY,
+ .id = AV_CODEC_ID_DXTORY,
.init = decode_init,
.close = decode_close,
.decode = decode_frame,
diff --git a/gst-libs/ext/libav/libavcodec/dxva2.c b/gst-libs/ext/libav/libavcodec/dxva2.c
index e56a645..71c8405 100644
--- a/gst-libs/ext/libav/libavcodec/dxva2.c
+++ b/gst-libs/ext/libav/libavcodec/dxva2.c
@@ -86,7 +86,7 @@ int ff_dxva2_common_end_frame(AVCodecContext *avctx, MpegEncContext *s,
struct dxva_context *ctx = avctx->hwaccel_context;
unsigned buffer_count = 0;
DXVA2_DecodeBufferDesc buffer[4];
- DXVA2_DecodeExecuteParams exec;
+ DXVA2_DecodeExecuteParams exec = { 0 };
int result;
if (FAILED(IDirectXVideoDecoder_BeginFrame(ctx->decoder,
@@ -132,7 +132,6 @@ int ff_dxva2_common_end_frame(AVCodecContext *avctx, MpegEncContext *s,
assert(buffer_count == 1 + (qm_size > 0) + 2);
- memset(&exec, 0, sizeof(exec));
exec.NumCompBuffers = buffer_count;
exec.pCompressedBuffers = buffer;
exec.pExtensionData = NULL;
@@ -151,4 +150,3 @@ end:
ff_draw_horiz_band(s, 0, s->avctx->height);
return result;
}
-
diff --git a/gst-libs/ext/libav/libavcodec/dxva2.h b/gst-libs/ext/libav/libavcodec/dxva2.h
index 374ae03..c06f1f3 100644
--- a/gst-libs/ext/libav/libavcodec/dxva2.h
+++ b/gst-libs/ext/libav/libavcodec/dxva2.h
@@ -23,11 +23,24 @@
#ifndef AVCODEC_DXVA_H
#define AVCODEC_DXVA_H
+/**
+ * @file
+ * @ingroup lavc_codec_hwaccel_dxva2
+ * Public libavcodec DXVA2 header.
+ */
+
#include <stdint.h>
#include <d3d9.h>
#include <dxva2api.h>
+/**
+ * @defgroup lavc_codec_hwaccel_dxva2 DXVA2
+ * @ingroup lavc_codec_hwaccel
+ *
+ * @{
+ */
+
#define FF_DXVA2_WORKAROUND_SCALING_LIST_ZIGZAG 1 ///< Work around for DXVA2 and old UVD/UVD+ ATI video cards
/**
@@ -68,4 +81,8 @@ struct dxva_context {
unsigned report_id;
};
+/**
+ * @}
+ */
+
#endif /* AVCODEC_DXVA_H */
diff --git a/gst-libs/ext/libav/libavcodec/dxva2_h264.c b/gst-libs/ext/libav/libavcodec/dxva2_h264.c
index 9608ecb..2fd0767 100644
--- a/gst-libs/ext/libav/libavcodec/dxva2_h264.c
+++ b/gst-libs/ext/libav/libavcodec/dxva2_h264.c
@@ -93,7 +93,8 @@ static void fill_picture_parameters(struct dxva_context *ctx, const H264Context
pp->num_ref_frames = h->sps.ref_frame_count;
pp->wBitFields = ((s->picture_structure != PICT_FRAME) << 0) |
- (h->sps.mb_aff << 1) |
+ ((h->sps.mb_aff &&
+ (s->picture_structure == PICT_FRAME)) << 1) |
(h->sps.residual_color_transform_flag << 2) |
/* sp_for_switch_flag (not implemented by Libav) */
(0 << 3) |
@@ -441,11 +442,10 @@ static int end_frame(AVCodecContext *avctx)
AVHWAccel ff_h264_dxva2_hwaccel = {
.name = "h264_dxva2",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_H264,
- .pix_fmt = PIX_FMT_DXVA2_VLD,
+ .id = AV_CODEC_ID_H264,
+ .pix_fmt = AV_PIX_FMT_DXVA2_VLD,
.start_frame = start_frame,
.decode_slice = decode_slice,
.end_frame = end_frame,
.priv_data_size = sizeof(struct dxva2_picture_context),
};
-
diff --git a/gst-libs/ext/libav/libavcodec/dxva2_mpeg2.c b/gst-libs/ext/libav/libavcodec/dxva2_mpeg2.c
index 2e77cd1..fa6ae7b 100644
--- a/gst-libs/ext/libav/libavcodec/dxva2_mpeg2.c
+++ b/gst-libs/ext/libav/libavcodec/dxva2_mpeg2.c
@@ -263,11 +263,10 @@ static int end_frame(AVCodecContext *avctx)
AVHWAccel ff_mpeg2_dxva2_hwaccel = {
.name = "mpeg2_dxva2",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_MPEG2VIDEO,
- .pix_fmt = PIX_FMT_DXVA2_VLD,
+ .id = AV_CODEC_ID_MPEG2VIDEO,
+ .pix_fmt = AV_PIX_FMT_DXVA2_VLD,
.start_frame = start_frame,
.decode_slice = decode_slice,
.end_frame = end_frame,
.priv_data_size = sizeof(struct dxva2_picture_context),
};
-
diff --git a/gst-libs/ext/libav/libavcodec/dxva2_vc1.c b/gst-libs/ext/libav/libavcodec/dxva2_vc1.c
index 22ad459..5aed2f3 100644
--- a/gst-libs/ext/libav/libavcodec/dxva2_vc1.c
+++ b/gst-libs/ext/libav/libavcodec/dxva2_vc1.c
@@ -42,11 +42,11 @@ static void fill_picture_parameters(AVCodecContext *avctx,
memset(pp, 0, sizeof(*pp));
pp->wDecodedPictureIndex =
pp->wDeblockedPictureIndex = ff_dxva2_get_surface_index(ctx, current_picture);
- if (s->pict_type != AV_PICTURE_TYPE_I)
+ if (s->pict_type != AV_PICTURE_TYPE_I && !v->bi_type)
pp->wForwardRefPictureIndex = ff_dxva2_get_surface_index(ctx, &s->last_picture);
else
pp->wForwardRefPictureIndex = 0xffff;
- if (s->pict_type == AV_PICTURE_TYPE_B)
+ if (s->pict_type == AV_PICTURE_TYPE_B && !v->bi_type)
pp->wBackwardRefPictureIndex = ff_dxva2_get_surface_index(ctx, &s->next_picture);
else
pp->wBackwardRefPictureIndex = 0xffff;
@@ -69,8 +69,8 @@ static void fill_picture_parameters(AVCodecContext *avctx,
if (s->picture_structure & PICT_BOTTOM_FIELD)
pp->bPicStructure |= 0x02;
pp->bSecondField = v->interlace && v->fcm != ILACE_FIELD && !s->first_field;
- pp->bPicIntra = s->pict_type == AV_PICTURE_TYPE_I;
- pp->bPicBackwardPrediction = s->pict_type == AV_PICTURE_TYPE_B;
+ pp->bPicIntra = s->pict_type == AV_PICTURE_TYPE_I || v->bi_type;
+ pp->bPicBackwardPrediction = s->pict_type == AV_PICTURE_TYPE_B && !v->bi_type;
pp->bBidirectionalAveragingMode = (1 << 7) |
((ctx->cfg->ConfigIntraResidUnsigned != 0) << 6) |
((ctx->cfg->ConfigResidDiffAccelerator != 0) << 5) |
@@ -101,7 +101,8 @@ static void fill_picture_parameters(AVCodecContext *avctx,
(v->rangered << 3) |
(s->max_b_frames );
pp->bPicExtrapolation = (!v->interlace || v->fcm == PROGRESSIVE) ? 1 : 2;
- pp->bPicDeblocked = ((v->profile != PROFILE_ADVANCED && v->rangeredfrm) << 5) |
+ pp->bPicDeblocked = ((!pp->bPicBackwardPrediction && v->overlap) << 6) |
+ ((v->profile != PROFILE_ADVANCED && v->rangeredfrm) << 5) |
(s->loop_filter << 1);
pp->bPicDeblockConfined = (v->postprocflag << 7) |
(v->broadcast << 6) |
@@ -166,7 +167,7 @@ static int commit_bitstream_and_slice_buffer(AVCodecContext *avctx,
DXVA_SliceInfo *slice = &ctx_pic->si;
static const uint8_t start_code[] = { 0, 0, 1, 0x0d };
- const unsigned start_code_size = avctx->codec_id == CODEC_ID_VC1 ? sizeof(start_code) : 0;
+ const unsigned start_code_size = avctx->codec_id == AV_CODEC_ID_VC1 ? sizeof(start_code) : 0;
const unsigned slice_size = slice->dwSliceBitsInBuffer / 8;
const unsigned padding = 128 - ((start_code_size + slice_size) & 127);
const unsigned data_size = start_code_size + slice_size + padding;
@@ -236,7 +237,7 @@ static int decode_slice(AVCodecContext *avctx,
if (ctx_pic->bitstream_size > 0)
return -1;
- if (avctx->codec_id == CODEC_ID_VC1 &&
+ if (avctx->codec_id == AV_CODEC_ID_VC1 &&
size >= 4 && IS_MARKER(AV_RB32(buffer))) {
buffer += 4;
size -= 4;
@@ -267,8 +268,8 @@ static int end_frame(AVCodecContext *avctx)
AVHWAccel ff_wmv3_dxva2_hwaccel = {
.name = "wmv3_dxva2",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_WMV3,
- .pix_fmt = PIX_FMT_DXVA2_VLD,
+ .id = AV_CODEC_ID_WMV3,
+ .pix_fmt = AV_PIX_FMT_DXVA2_VLD,
.start_frame = start_frame,
.decode_slice = decode_slice,
.end_frame = end_frame,
@@ -279,11 +280,10 @@ AVHWAccel ff_wmv3_dxva2_hwaccel = {
AVHWAccel ff_vc1_dxva2_hwaccel = {
.name = "vc1_dxva2",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_VC1,
- .pix_fmt = PIX_FMT_DXVA2_VLD,
+ .id = AV_CODEC_ID_VC1,
+ .pix_fmt = AV_PIX_FMT_DXVA2_VLD,
.start_frame = start_frame,
.decode_slice = decode_slice,
.end_frame = end_frame,
.priv_data_size = sizeof(struct dxva2_picture_context),
};
-
diff --git a/gst-libs/ext/libav/libavcodec/eac3dec.c b/gst-libs/ext/libav/libavcodec/eac3dec.c
index 212f6b4..3a80cb1 100644
--- a/gst-libs/ext/libav/libavcodec/eac3dec.c
+++ b/gst-libs/ext/libav/libavcodec/eac3dec.c
@@ -140,7 +140,7 @@ void ff_eac3_apply_spectral_extension(AC3DecodeContext *s)
each band. */
bin = s->spx_src_start_freq;
for (bnd = 0; bnd < s->num_spx_bands; bnd++) {
- float nscale = s->spx_noise_blend[ch][bnd] * rms_energy[bnd] * (1.0f/(1<<31));
+ float nscale = s->spx_noise_blend[ch][bnd] * rms_energy[bnd] * (1.0f / INT32_MIN);
float sscale = s->spx_signal_blend[ch][bnd];
for (i = 0; i < s->spx_band_sizes[bnd]; i++) {
float noise = nscale * (int32_t)av_lfg_get(&s->dith_state);
@@ -321,8 +321,8 @@ int ff_eac3_parse_header(AC3DecodeContext *s)
rates in bit allocation. The best assumption would be that it is
handled like AC-3 DolbyNet, but we cannot be sure until we have a
sample which utilizes this feature. */
- av_log_missing_feature(s->avctx, "Reduced sampling rates", 1);
- return -1;
+ av_log_missing_feature(s->avctx, "Reduced sampling rate", 1);
+ return AVERROR_PATCHWELCOME;
}
skip_bits(gbc, 5); // skip bitstream id
@@ -491,7 +491,7 @@ int ff_eac3_parse_header(AC3DecodeContext *s)
s->skip_syntax = get_bits1(gbc);
parse_spx_atten_data = get_bits1(gbc);
- /* coupling strategy occurance and coupling use per block */
+ /* coupling strategy occurrence and coupling use per block */
num_cpl_blocks = 0;
if (s->channel_mode > 1) {
for (blk = 0; blk < s->num_blocks; blk++) {
diff --git a/gst-libs/ext/libav/libavcodec/eac3enc.c b/gst-libs/ext/libav/libavcodec/eac3enc.c
index f3b4418..3c7a611 100644
--- a/gst-libs/ext/libav/libavcodec/eac3enc.c
+++ b/gst-libs/ext/libav/libavcodec/eac3enc.c
@@ -33,7 +33,7 @@
#define AC3ENC_TYPE AC3ENC_TYPE_EAC3
#include "ac3enc_opts_template.c"
static const AVClass eac3enc_class = { "E-AC-3 Encoder", av_default_item_name,
- eac3_options, LIBAVUTIL_VERSION_INT };
+ ac3_options, LIBAVUTIL_VERSION_INT };
/**
@@ -249,14 +249,16 @@ void ff_eac3_output_frame_header(AC3EncodeContext *s)
AVCodec ff_eac3_encoder = {
.name = "eac3",
.type = AVMEDIA_TYPE_AUDIO,
- .id = CODEC_ID_EAC3,
+ .id = AV_CODEC_ID_EAC3,
.priv_data_size = sizeof(AC3EncodeContext),
.init = ff_ac3_encode_init,
- .encode = ff_ac3_float_encode_frame,
+ .encode2 = ff_ac3_float_encode_frame,
.close = ff_ac3_encode_close,
- .sample_fmts = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_FLT,AV_SAMPLE_FMT_NONE},
+ .sample_fmts = (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_FLTP,
+ AV_SAMPLE_FMT_NONE },
.long_name = NULL_IF_CONFIG_SMALL("ATSC A/52 E-AC-3"),
.priv_class = &eac3enc_class,
.channel_layouts = ff_ac3_channel_layouts,
+ .defaults = ac3_defaults,
};
#endif
diff --git a/gst-libs/ext/libav/libavcodec/eacmv.c b/gst-libs/ext/libav/libavcodec/eacmv.c
index 085e2d8..0dce066 100644
--- a/gst-libs/ext/libav/libavcodec/eacmv.c
+++ b/gst-libs/ext/libav/libavcodec/eacmv.c
@@ -28,9 +28,11 @@
* http://wiki.multimedia.cx/index.php?title=Electronic_Arts_CMV
*/
+#include "libavutil/common.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/imgutils.h"
#include "avcodec.h"
+#include "internal.h"
typedef struct CmvContext {
AVCodecContext *avctx;
@@ -44,7 +46,7 @@ typedef struct CmvContext {
static av_cold int cmv_decode_init(AVCodecContext *avctx){
CmvContext *s = avctx->priv_data;
s->avctx = avctx;
- avctx->pix_fmt = PIX_FMT_PAL8;
+ avctx->pix_fmt = AV_PIX_FMT_PAL8;
return 0;
}
@@ -145,7 +147,7 @@ static void cmv_process_header(CmvContext *s, const uint8_t *buf, const uint8_t
#define MVIh_TAG MKTAG('M', 'V', 'I', 'h')
static int cmv_decode_frame(AVCodecContext *avctx,
- void *data, int *data_size,
+ void *data, int *got_frame,
AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
@@ -172,7 +174,7 @@ static int cmv_decode_frame(AVCodecContext *avctx,
s->frame.reference = 1;
s->frame.buffer_hints = FF_BUFFER_HINTS_VALID;
- if (avctx->get_buffer(avctx, &s->frame)<0) {
+ if (ff_get_buffer(avctx, &s->frame)<0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return -1;
}
@@ -190,7 +192,7 @@ static int cmv_decode_frame(AVCodecContext *avctx,
cmv_decode_intra(s, buf+2, buf_end);
}
- *data_size = sizeof(AVFrame);
+ *got_frame = 1;
*(AVFrame*)data = s->frame;
return buf_size;
@@ -211,11 +213,11 @@ static av_cold int cmv_decode_end(AVCodecContext *avctx){
AVCodec ff_eacmv_decoder = {
.name = "eacmv",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_CMV,
+ .id = AV_CODEC_ID_CMV,
.priv_data_size = sizeof(CmvContext),
.init = cmv_decode_init,
.close = cmv_decode_end,
.decode = cmv_decode_frame,
.capabilities = CODEC_CAP_DR1,
- .long_name = NULL_IF_CONFIG_SMALL("Electronic Arts CMV video"),
+ .long_name = NULL_IF_CONFIG_SMALL("Electronic Arts CMV video"),
};
diff --git a/gst-libs/ext/libav/libavcodec/eaidct.c b/gst-libs/ext/libav/libavcodec/eaidct.c
index 9d829c4..9f2d5cc 100644
--- a/gst-libs/ext/libav/libavcodec/eaidct.c
+++ b/gst-libs/ext/libav/libavcodec/eaidct.c
@@ -26,6 +26,8 @@
*/
#include "dsputil.h"
+#include "eaidct.h"
+#include "libavutil/common.h"
#define ASQRT 181 /* (1/sqrt(2))<<8 */
#define A4 669 /* cos(pi/8)*sqrt(2)<<9 */
diff --git a/gst-libs/ext/libav/libavcodec/eaidct.h b/gst-libs/ext/libav/libavcodec/eaidct.h
new file mode 100644
index 0000000..4c0b5ae
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/eaidct.h
@@ -0,0 +1,27 @@
+/*
+ * 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
+ */
+
+#ifndef AVCODEC_EAIDCT_H
+#define AVCODEC_EAIDCT_H
+
+#include <stdint.h>
+#include "dsputil.h"
+
+void ff_ea_idct_put_c(uint8_t *dest, int linesize, DCTELEM *block);
+
+#endif /* AVCODEC_EAIDCT_H */
diff --git a/gst-libs/ext/libav/libavcodec/eamad.c b/gst-libs/ext/libav/libavcodec/eamad.c
index c5aa6ac..bb4c7ba 100644
--- a/gst-libs/ext/libav/libavcodec/eamad.c
+++ b/gst-libs/ext/libav/libavcodec/eamad.c
@@ -32,6 +32,8 @@
#include "get_bits.h"
#include "dsputil.h"
#include "aandcttab.h"
+#include "eaidct.h"
+#include "internal.h"
#include "mpeg12.h"
#include "mpeg12data.h"
#include "libavutil/imgutils.h"
@@ -42,31 +44,28 @@
#define MADe_TAG MKTAG('M', 'A', 'D', 'e') /* MAD lqp-frame */
typedef struct MadContext {
- MpegEncContext s;
+ AVCodecContext *avctx;
+ DSPContext dsp;
AVFrame frame;
AVFrame last_frame;
+ GetBitContext gb;
void *bitstream_buf;
unsigned int bitstream_buf_size;
DECLARE_ALIGNED(16, DCTELEM, block)[64];
+ ScanTable scantable;
+ uint16_t quant_matrix[64];
+ int mb_x;
+ int mb_y;
} MadContext;
-static void bswap16_buf(uint16_t *dst, const uint16_t *src, int count)
-{
- int i;
- for (i=0; i<count; i++)
- dst[i] = av_bswap16(src[i]);
-}
-
static av_cold int decode_init(AVCodecContext *avctx)
{
- MadContext *t = avctx->priv_data;
- MpegEncContext *s = &t->s;
+ MadContext *s = avctx->priv_data;
s->avctx = avctx;
- avctx->pix_fmt = PIX_FMT_YUV420P;
- if (avctx->idct_algo == FF_IDCT_AUTO)
- avctx->idct_algo = FF_IDCT_EA;
- dsputil_init(&s->dsp, avctx);
- ff_init_scantable(s->dsp.idct_permutation, &s->intra_scantable, ff_zigzag_direct);
+ avctx->pix_fmt = AV_PIX_FMT_YUV420P;
+ ff_dsputil_init(&s->dsp, avctx);
+ ff_init_scantable_permutation(s->dsp.idct_permutation, FF_NO_IDCT_PERM);
+ ff_init_scantable(s->dsp.idct_permutation, &s->scantable, ff_zigzag_direct);
ff_mpeg12_init_vlcs();
return 0;
}
@@ -83,13 +82,12 @@ static inline void comp(unsigned char *dst, int dst_stride,
static inline void comp_block(MadContext *t, int mb_x, int mb_y,
int j, int mv_x, int mv_y, int add)
{
- MpegEncContext *s = &t->s;
if (j < 4) {
comp(t->frame.data[0] + (mb_y*16 + ((j&2)<<2))*t->frame.linesize[0] + mb_x*16 + ((j&1)<<3),
t->frame.linesize[0],
t->last_frame.data[0] + (mb_y*16 + ((j&2)<<2) + mv_y)*t->last_frame.linesize[0] + mb_x*16 + ((j&1)<<3) + mv_x,
t->last_frame.linesize[0], add);
- } else if (!(s->avctx->flags & CODEC_FLAG_GRAY)) {
+ } else if (!(t->avctx->flags & CODEC_FLAG_GRAY)) {
int index = j - 3;
comp(t->frame.data[index] + (mb_y*8)*t->frame.linesize[index] + mb_x * 8,
t->frame.linesize[index],
@@ -100,26 +98,24 @@ static inline void comp_block(MadContext *t, int mb_x, int mb_y,
static inline void idct_put(MadContext *t, DCTELEM *block, int mb_x, int mb_y, int j)
{
- MpegEncContext *s = &t->s;
if (j < 4) {
- s->dsp.idct_put(
+ ff_ea_idct_put_c(
t->frame.data[0] + (mb_y*16 + ((j&2)<<2))*t->frame.linesize[0] + mb_x*16 + ((j&1)<<3),
t->frame.linesize[0], block);
- } else if (!(s->avctx->flags & CODEC_FLAG_GRAY)) {
+ } else if (!(t->avctx->flags & CODEC_FLAG_GRAY)) {
int index = j - 3;
- s->dsp.idct_put(
+ ff_ea_idct_put_c(
t->frame.data[index] + (mb_y*8)*t->frame.linesize[index] + mb_x*8,
t->frame.linesize[index], block);
}
}
-static inline void decode_block_intra(MadContext * t, DCTELEM * block)
+static inline void decode_block_intra(MadContext *s, DCTELEM * block)
{
- MpegEncContext *s = &t->s;
int level, i, j, run;
RLTable *rl = &ff_rl_mpeg1;
- const uint8_t *scantable = s->intra_scantable.permutated;
- int16_t *quant_matrix = s->intra_matrix;
+ const uint8_t *scantable = s->scantable.permutated;
+ int16_t *quant_matrix = s->quant_matrix;
block[0] = (128 + get_sbits(&s->gb, 8)) * quant_matrix[0];
@@ -184,9 +180,8 @@ static int decode_motion(GetBitContext *gb)
return value;
}
-static void decode_mb(MadContext *t, int inter)
+static void decode_mb(MadContext *s, int inter)
{
- MpegEncContext *s = &t->s;
int mv_map = 0;
int mv_x, mv_y;
int j;
@@ -205,46 +200,39 @@ static void decode_mb(MadContext *t, int inter)
for (j=0; j<6; j++) {
if (mv_map & (1<<j)) { // mv_x and mv_y are guarded by mv_map
int add = 2*decode_motion(&s->gb);
- comp_block(t, s->mb_x, s->mb_y, j, mv_x, mv_y, add);
+ comp_block(s, s->mb_x, s->mb_y, j, mv_x, mv_y, add);
} else {
- s->dsp.clear_block(t->block);
- decode_block_intra(t, t->block);
- idct_put(t, t->block, s->mb_x, s->mb_y, j);
+ s->dsp.clear_block(s->block);
+ decode_block_intra(s, s->block);
+ idct_put(s, s->block, s->mb_x, s->mb_y, j);
}
}
}
-static void calc_intra_matrix(MadContext *t, int qscale)
+static void calc_quant_matrix(MadContext *s, int qscale)
{
- MpegEncContext *s = &t->s;
int i;
- if (s->avctx->idct_algo == FF_IDCT_EA) {
- s->intra_matrix[0] = (ff_inv_aanscales[0]*ff_mpeg1_default_intra_matrix[0]) >> 11;
- for (i=1; i<64; i++)
- s->intra_matrix[i] = (ff_inv_aanscales[i]*ff_mpeg1_default_intra_matrix[i]*qscale + 32) >> 10;
- } else {
- s->intra_matrix[0] = ff_mpeg1_default_intra_matrix[0];
- for (i=1; i<64; i++)
- s->intra_matrix[i] = (ff_mpeg1_default_intra_matrix[i]*qscale) << 1;
- }
+ s->quant_matrix[0] = (ff_inv_aanscales[0]*ff_mpeg1_default_intra_matrix[0]) >> 11;
+ for (i=1; i<64; i++)
+ s->quant_matrix[i] = (ff_inv_aanscales[i]*ff_mpeg1_default_intra_matrix[i]*qscale + 32) >> 10;
}
static int decode_frame(AVCodecContext *avctx,
- void *data, int *data_size,
+ void *data, int *got_frame,
AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
const uint8_t *buf_end = buf+buf_size;
- MadContext *t = avctx->priv_data;
- MpegEncContext *s = &t->s;
+ MadContext *s = avctx->priv_data;
+ int width, height;
int chunk_type;
int inter;
if (buf_size < 17) {
av_log(avctx, AV_LOG_ERROR, "Input buffer too small\n");
- *data_size = 0;
+ *got_frame = 0;
return -1;
}
@@ -255,42 +243,58 @@ static int decode_frame(AVCodecContext *avctx,
av_reduce(&avctx->time_base.num, &avctx->time_base.den,
AV_RL16(&buf[6]), 1000, 1<<30);
- s->width = AV_RL16(&buf[8]);
- s->height = AV_RL16(&buf[10]);
- calc_intra_matrix(t, buf[13]);
+ width = AV_RL16(&buf[8]);
+ height = AV_RL16(&buf[10]);
+ calc_quant_matrix(s, buf[13]);
buf += 16;
- if (avctx->width != s->width || avctx->height != s->height) {
- if (av_image_check_size(s->width, s->height, 0, avctx) < 0)
+ if (avctx->width != width || avctx->height != height) {
+ if (av_image_check_size(width, height, 0, avctx) < 0)
return -1;
- avcodec_set_dimensions(avctx, s->width, s->height);
- if (t->frame.data[0])
- avctx->release_buffer(avctx, &t->frame);
+ avcodec_set_dimensions(avctx, width, height);
+ if (s->frame.data[0])
+ avctx->release_buffer(avctx, &s->frame);
}
- t->frame.reference = 1;
- if (!t->frame.data[0]) {
- if (avctx->get_buffer(avctx, &t->frame) < 0) {
+ s->frame.reference = 1;
+ if (!s->frame.data[0]) {
+ if (ff_get_buffer(avctx, &s->frame) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return -1;
}
}
- av_fast_malloc(&t->bitstream_buf, &t->bitstream_buf_size, (buf_end-buf) + FF_INPUT_BUFFER_PADDING_SIZE);
- if (!t->bitstream_buf)
+ if (inter && !s->last_frame.data[0]) {
+ int ret;
+ av_log(avctx, AV_LOG_WARNING, "Missing reference frame.\n");
+ s->last_frame.reference = 1;
+ ret = ff_get_buffer(avctx, &s->last_frame);
+ if (ret < 0)
+ return ret;
+ memset(s->last_frame.data[0], 0, s->last_frame.height *
+ s->last_frame.linesize[0]);
+ memset(s->last_frame.data[1], 0x80, s->last_frame.height / 2 *
+ s->last_frame.linesize[1]);
+ memset(s->last_frame.data[2], 0x80, s->last_frame.height / 2 *
+ s->last_frame.linesize[2]);
+ }
+
+ av_fast_padded_malloc(&s->bitstream_buf, &s->bitstream_buf_size,
+ buf_end - buf);
+ if (!s->bitstream_buf)
return AVERROR(ENOMEM);
- bswap16_buf(t->bitstream_buf, (const uint16_t*)buf, (buf_end-buf)/2);
- init_get_bits(&s->gb, t->bitstream_buf, 8*(buf_end-buf));
+ s->dsp.bswap16_buf(s->bitstream_buf, (const uint16_t*)buf, (buf_end-buf)/2);
+ init_get_bits(&s->gb, s->bitstream_buf, 8*(buf_end-buf));
for (s->mb_y=0; s->mb_y < (avctx->height+15)/16; s->mb_y++)
for (s->mb_x=0; s->mb_x < (avctx->width +15)/16; s->mb_x++)
- decode_mb(t, inter);
+ decode_mb(s, inter);
- *data_size = sizeof(AVFrame);
- *(AVFrame*)data = t->frame;
+ *got_frame = 1;
+ *(AVFrame*)data = s->frame;
if (chunk_type != MADe_TAG)
- FFSWAP(AVFrame, t->frame, t->last_frame);
+ FFSWAP(AVFrame, s->frame, s->last_frame);
return buf_size;
}
@@ -309,11 +313,11 @@ static av_cold int decode_end(AVCodecContext *avctx)
AVCodec ff_eamad_decoder = {
.name = "eamad",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_MAD,
+ .id = AV_CODEC_ID_MAD,
.priv_data_size = sizeof(MadContext),
.init = decode_init,
.close = decode_end,
.decode = decode_frame,
.capabilities = CODEC_CAP_DR1,
- .long_name = NULL_IF_CONFIG_SMALL("Electronic Arts Madcow Video")
+ .long_name = NULL_IF_CONFIG_SMALL("Electronic Arts Madcow Video")
};
diff --git a/gst-libs/ext/libav/libavcodec/eatgq.c b/gst-libs/ext/libav/libavcodec/eatgq.c
index 5be1f55..d6a6e55 100644
--- a/gst-libs/ext/libav/libavcodec/eatgq.c
+++ b/gst-libs/ext/libav/libavcodec/eatgq.c
@@ -34,10 +34,11 @@
#include "bytestream.h"
#include "dsputil.h"
#include "aandcttab.h"
+#include "eaidct.h"
+#include "internal.h"
typedef struct TgqContext {
AVCodecContext *avctx;
- DSPContext dsp;
AVFrame frame;
int width,height;
ScanTable scantable;
@@ -48,13 +49,12 @@ typedef struct TgqContext {
static av_cold int tgq_decode_init(AVCodecContext *avctx){
TgqContext *s = avctx->priv_data;
+ uint8_t idct_permutation[64];
s->avctx = avctx;
- if(avctx->idct_algo==FF_IDCT_AUTO)
- avctx->idct_algo=FF_IDCT_EA;
- dsputil_init(&s->dsp, avctx);
- ff_init_scantable(s->dsp.idct_permutation, &s->scantable, ff_zigzag_direct);
+ ff_init_scantable_permutation(idct_permutation, FF_NO_IDCT_PERM);
+ ff_init_scantable(idct_permutation, &s->scantable, ff_zigzag_direct);
avctx->time_base = (AVRational){1, 15};
- avctx->pix_fmt = PIX_FMT_YUV420P;
+ avctx->pix_fmt = AV_PIX_FMT_YUV420P;
return 0;
}
@@ -109,13 +109,13 @@ static void tgq_idct_put_mb(TgqContext *s, DCTELEM (*block)[64], int mb_x, int m
uint8_t *dest_cb = s->frame.data[1] + (mb_y * 8 * s->frame.linesize[1]) + mb_x * 8;
uint8_t *dest_cr = s->frame.data[2] + (mb_y * 8 * s->frame.linesize[2]) + mb_x * 8;
- s->dsp.idct_put(dest_y , linesize, block[0]);
- s->dsp.idct_put(dest_y + 8, linesize, block[1]);
- s->dsp.idct_put(dest_y + 8*linesize , linesize, block[2]);
- s->dsp.idct_put(dest_y + 8*linesize + 8, linesize, block[3]);
+ ff_ea_idct_put_c(dest_y , linesize, block[0]);
+ ff_ea_idct_put_c(dest_y + 8, linesize, block[1]);
+ ff_ea_idct_put_c(dest_y + 8*linesize , linesize, block[2]);
+ ff_ea_idct_put_c(dest_y + 8*linesize + 8, linesize, block[3]);
if(!(s->avctx->flags&CODEC_FLAG_GRAY)){
- s->dsp.idct_put(dest_cb, s->frame.linesize[1], block[4]);
- s->dsp.idct_put(dest_cr, s->frame.linesize[2], block[5]);
+ ff_ea_idct_put_c(dest_cb, s->frame.linesize[1], block[4]);
+ ff_ea_idct_put_c(dest_cr, s->frame.linesize[2], block[5]);
}
}
@@ -180,14 +180,11 @@ static void tgq_calculate_qtable(TgqContext *s, int quant){
const int b = (11*(100-quant))/100 + 4;
for(j=0;j<8;j++)
for(i=0;i<8;i++)
- if (s->avctx->idct_algo==FF_IDCT_EA)
- s->qtable[j*8+i] = ((a*(j+i)/(7+7) + b)*ff_inv_aanscales[j*8+i])>>(14-4);
- else
- s->qtable[j*8+i] = (a*(j+i)/(7+7) + b)<<3;
+ s->qtable[j*8+i] = ((a*(j+i)/(7+7) + b)*ff_inv_aanscales[j*8+i])>>(14-4);
}
static int tgq_decode_frame(AVCodecContext *avctx,
- void *data, int *data_size,
+ void *data, int *got_frame,
AVPacket *avpkt){
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
@@ -220,7 +217,7 @@ static int tgq_decode_frame(AVCodecContext *avctx,
s->frame.key_frame = 1;
s->frame.pict_type = AV_PICTURE_TYPE_I;
s->frame.buffer_hints = FF_BUFFER_HINTS_VALID;
- if (avctx->get_buffer(avctx, &s->frame)) {
+ if (ff_get_buffer(avctx, &s->frame)) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return -1;
}
@@ -230,7 +227,7 @@ static int tgq_decode_frame(AVCodecContext *avctx,
for (x = 0; x < FFALIGN(avctx->width, 16) >> 4; x++)
tgq_decode_mb(s, y, x);
- *data_size = sizeof(AVFrame);
+ *got_frame = 1;
*(AVFrame*)data = s->frame;
return avpkt->size;
@@ -246,11 +243,11 @@ static av_cold int tgq_decode_end(AVCodecContext *avctx){
AVCodec ff_eatgq_decoder = {
.name = "eatgq",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_TGQ,
+ .id = AV_CODEC_ID_TGQ,
.priv_data_size = sizeof(TgqContext),
.init = tgq_decode_init,
.close = tgq_decode_end,
.decode = tgq_decode_frame,
.capabilities = CODEC_CAP_DR1,
- .long_name = NULL_IF_CONFIG_SMALL("Electronic Arts TGQ video"),
+ .long_name = NULL_IF_CONFIG_SMALL("Electronic Arts TGQ video"),
};
diff --git a/gst-libs/ext/libav/libavcodec/eatgv.c b/gst-libs/ext/libav/libavcodec/eatgv.c
index ccdb35e..46644ab 100644
--- a/gst-libs/ext/libav/libavcodec/eatgv.c
+++ b/gst-libs/ext/libav/libavcodec/eatgv.c
@@ -31,8 +31,8 @@
#include "avcodec.h"
#define BITSTREAM_READER_LE
#include "get_bits.h"
-#include "libavutil/lzo.h"
#include "libavutil/imgutils.h"
+#include "libavutil/mem.h"
#define EA_PREAMBLE_SIZE 8
#define kVGT_TAG MKTAG('k', 'V', 'G', 'T')
@@ -54,7 +54,7 @@ static av_cold int tgv_decode_init(AVCodecContext *avctx){
TgvContext *s = avctx->priv_data;
s->avctx = avctx;
avctx->time_base = (AVRational){1, 15};
- avctx->pix_fmt = PIX_FMT_PAL8;
+ avctx->pix_fmt = AV_PIX_FMT_PAL8;
return 0;
}
@@ -64,7 +64,7 @@ static av_cold int tgv_decode_init(AVCodecContext *avctx){
*/
static int unpack(const uint8_t *src, const uint8_t *src_end, unsigned char *dst, int width, int height) {
unsigned char *dst_end = dst + width*height;
- int size, size1, size2, av_uninit(offset), run;
+ int size, size1, size2, offset, run;
unsigned char *dst_start = dst;
if (src[0] & 0x01)
@@ -136,7 +136,6 @@ static int unpack(const uint8_t *src, const uint8_t *src_end, unsigned char *dst
* @return 0 on success, -1 on critical buffer underflow
*/
static int tgv_decode_inter(TgvContext * s, const uint8_t *buf, const uint8_t *buf_end){
- unsigned char *frame0_end = s->last_frame.data[0] + s->avctx->width*s->last_frame.linesize[0];
int num_mvs;
int num_blocks_raw;
int num_blocks_packed;
@@ -155,6 +154,12 @@ static int tgv_decode_inter(TgvContext * s, const uint8_t *buf, const uint8_t *b
vector_bits = AV_RL16(&buf[6]);
buf += 12;
+ if (vector_bits > MIN_CACHE_BITS || !vector_bits) {
+ av_log(s->avctx, AV_LOG_ERROR,
+ "Invalid value for motion vector bits: %d\n", vector_bits);
+ return AVERROR_INVALIDDATA;
+ }
+
/* allocate codebook buffers as necessary */
if (num_mvs > s->num_mvs) {
s->mv_codebook = av_realloc(s->mv_codebook, num_mvs*2*sizeof(int));
@@ -205,12 +210,15 @@ static int tgv_decode_inter(TgvContext * s, const uint8_t *buf, const uint8_t *b
int src_stride;
if (vector < num_mvs) {
- src = s->last_frame.data[0] +
- (y*4 + s->mv_codebook[vector][1])*s->last_frame.linesize[0] +
- x*4 + s->mv_codebook[vector][0];
- src_stride = s->last_frame.linesize[0];
- if (src+3*src_stride+3>=frame0_end)
+ int mx = x * 4 + s->mv_codebook[vector][0];
+ int my = y * 4 + s->mv_codebook[vector][1];
+
+ if ( mx < 0 || mx + 4 > s->avctx->width
+ || my < 0 || my + 4 > s->avctx->height)
continue;
+
+ src = s->last_frame.data[0] + mx + my * s->last_frame.linesize[0];
+ src_stride = s->last_frame.linesize[0];
}else{
int offset = vector - num_mvs;
if (offset<num_blocks_raw)
@@ -241,7 +249,7 @@ static void cond_release_buffer(AVFrame *pic)
}
static int tgv_decode_frame(AVCodecContext *avctx,
- void *data, int *data_size,
+ void *data, int *got_frame,
AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
@@ -286,8 +294,7 @@ static int tgv_decode_frame(AVCodecContext *avctx,
s->frame.buffer_hints = FF_BUFFER_HINTS_VALID;
s->frame.linesize[0] = s->width;
- /* allocate additional 12 bytes to accommodate av_memcpy_backptr() OUTBUF_PADDED optimisation */
- s->frame.data[0] = av_malloc(s->width*s->height + 12);
+ s->frame.data[0] = av_malloc(s->width * s->height);
if (!s->frame.data[0])
return AVERROR(ENOMEM);
s->frame.data[1] = av_malloc(AVPALETTE_SIZE);
@@ -318,7 +325,7 @@ static int tgv_decode_frame(AVCodecContext *avctx,
}
}
- *data_size = sizeof(AVFrame);
+ *got_frame = 1;
*(AVFrame*)data = s->frame;
return buf_size;
@@ -337,10 +344,10 @@ static av_cold int tgv_decode_end(AVCodecContext *avctx)
AVCodec ff_eatgv_decoder = {
.name = "eatgv",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_TGV,
+ .id = AV_CODEC_ID_TGV,
.priv_data_size = sizeof(TgvContext),
.init = tgv_decode_init,
.close = tgv_decode_end,
.decode = tgv_decode_frame,
- .long_name = NULL_IF_CONFIG_SMALL("Electronic Arts TGV video"),
+ .long_name = NULL_IF_CONFIG_SMALL("Electronic Arts TGV video"),
};
diff --git a/gst-libs/ext/libav/libavcodec/eatqi.c b/gst-libs/ext/libav/libavcodec/eatqi.c
index 66d3819..f9141e2 100644
--- a/gst-libs/ext/libav/libavcodec/eatqi.c
+++ b/gst-libs/ext/libav/libavcodec/eatqi.c
@@ -30,6 +30,8 @@
#include "get_bits.h"
#include "dsputil.h"
#include "aandcttab.h"
+#include "eaidct.h"
+#include "internal.h"
#include "mpeg12.h"
#include "mpegvideo.h"
@@ -46,13 +48,12 @@ static av_cold int tqi_decode_init(AVCodecContext *avctx)
TqiContext *t = avctx->priv_data;
MpegEncContext *s = &t->s;
s->avctx = avctx;
- if(avctx->idct_algo==FF_IDCT_AUTO)
- avctx->idct_algo=FF_IDCT_EA;
- dsputil_init(&s->dsp, avctx);
+ ff_dsputil_init(&s->dsp, avctx);
+ ff_init_scantable_permutation(s->dsp.idct_permutation, FF_NO_IDCT_PERM);
ff_init_scantable(s->dsp.idct_permutation, &s->intra_scantable, ff_zigzag_direct);
s->qscale = 1;
avctx->time_base = (AVRational){1, 15};
- avctx->pix_fmt = PIX_FMT_YUV420P;
+ avctx->pix_fmt = AV_PIX_FMT_YUV420P;
ff_mpeg12_init_vlcs();
return 0;
}
@@ -76,13 +77,13 @@ static inline void tqi_idct_put(TqiContext *t, DCTELEM (*block)[64])
uint8_t *dest_cb = t->frame.data[1] + (s->mb_y * 8 * t->frame.linesize[1]) + s->mb_x * 8;
uint8_t *dest_cr = t->frame.data[2] + (s->mb_y * 8 * t->frame.linesize[2]) + s->mb_x * 8;
- s->dsp.idct_put(dest_y , linesize, block[0]);
- s->dsp.idct_put(dest_y + 8, linesize, block[1]);
- s->dsp.idct_put(dest_y + 8*linesize , linesize, block[2]);
- s->dsp.idct_put(dest_y + 8*linesize + 8, linesize, block[3]);
+ ff_ea_idct_put_c(dest_y , linesize, block[0]);
+ ff_ea_idct_put_c(dest_y + 8, linesize, block[1]);
+ ff_ea_idct_put_c(dest_y + 8*linesize , linesize, block[2]);
+ ff_ea_idct_put_c(dest_y + 8*linesize + 8, linesize, block[3]);
if(!(s->avctx->flags&CODEC_FLAG_GRAY)) {
- s->dsp.idct_put(dest_cb, t->frame.linesize[1], block[4]);
- s->dsp.idct_put(dest_cr, t->frame.linesize[2], block[5]);
+ ff_ea_idct_put_c(dest_cb, t->frame.linesize[1], block[4]);
+ ff_ea_idct_put_c(dest_cr, t->frame.linesize[2], block[5]);
}
}
@@ -90,19 +91,13 @@ static void tqi_calculate_qtable(MpegEncContext *s, int quant)
{
const int qscale = (215 - 2*quant)*5;
int i;
- if (s->avctx->idct_algo==FF_IDCT_EA) {
- s->intra_matrix[0] = (ff_inv_aanscales[0]*ff_mpeg1_default_intra_matrix[0])>>11;
- for(i=1; i<64; i++)
- s->intra_matrix[i] = (ff_inv_aanscales[i]*ff_mpeg1_default_intra_matrix[i]*qscale + 32)>>14;
- }else{
- s->intra_matrix[0] = ff_mpeg1_default_intra_matrix[0];
- for(i=1; i<64; i++)
- s->intra_matrix[i] = (ff_mpeg1_default_intra_matrix[i]*qscale + 32)>>3;
- }
+ s->intra_matrix[0] = (ff_inv_aanscales[0]*ff_mpeg1_default_intra_matrix[0])>>11;
+ for(i=1; i<64; i++)
+ s->intra_matrix[i] = (ff_inv_aanscales[i]*ff_mpeg1_default_intra_matrix[i]*qscale + 32)>>14;
}
static int tqi_decode_frame(AVCodecContext *avctx,
- void *data, int *data_size,
+ void *data, int *got_frame,
AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
@@ -122,12 +117,13 @@ static int tqi_decode_frame(AVCodecContext *avctx,
if (s->avctx->width!=s->width || s->avctx->height!=s->height)
avcodec_set_dimensions(s->avctx, s->width, s->height);
- if(avctx->get_buffer(avctx, &t->frame) < 0) {
+ if(ff_get_buffer(avctx, &t->frame) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return -1;
}
- av_fast_malloc(&t->bitstream_buf, &t->bitstream_buf_size, (buf_end-buf) + FF_INPUT_BUFFER_PADDING_SIZE);
+ av_fast_padded_malloc(&t->bitstream_buf, &t->bitstream_buf_size,
+ buf_end - buf);
if (!t->bitstream_buf)
return AVERROR(ENOMEM);
s->dsp.bswap_buf(t->bitstream_buf, (const uint32_t*)buf, (buf_end-buf)/4);
@@ -142,7 +138,7 @@ static int tqi_decode_frame(AVCodecContext *avctx,
tqi_idct_put(t, t->block);
}
- *data_size = sizeof(AVFrame);
+ *got_frame = 1;
*(AVFrame*)data = t->frame;
return buf_size;
}
@@ -159,11 +155,11 @@ static av_cold int tqi_decode_end(AVCodecContext *avctx)
AVCodec ff_eatqi_decoder = {
.name = "eatqi",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_TQI,
+ .id = AV_CODEC_ID_TQI,
.priv_data_size = sizeof(TqiContext),
.init = tqi_decode_init,
.close = tqi_decode_end,
.decode = tqi_decode_frame,
.capabilities = CODEC_CAP_DR1,
- .long_name = NULL_IF_CONFIG_SMALL("Electronic Arts TQI Video"),
+ .long_name = NULL_IF_CONFIG_SMALL("Electronic Arts TQI Video"),
};
diff --git a/gst-libs/ext/libav/libavcodec/elbg.c b/gst-libs/ext/libav/libavcodec/elbg.c
index 030c3a6..0aa8e16 100644
--- a/gst-libs/ext/libav/libavcodec/elbg.c
+++ b/gst-libs/ext/libav/libavcodec/elbg.c
@@ -25,6 +25,7 @@
#include <string.h>
+#include "libavutil/common.h"
#include "libavutil/lfg.h"
#include "elbg.h"
#include "avcodec.h"
@@ -110,7 +111,7 @@ static int get_high_utility_cell(elbg_data *elbg)
while (elbg->utility_inc[i] < r)
i++;
- assert(!elbg->cells[i]);
+ assert(elbg->cells[i]);
return i;
}
diff --git a/gst-libs/ext/libav/libavcodec/error_resilience.c b/gst-libs/ext/libav/libavcodec/error_resilience.c
index 96f49c8..ae9ef68 100644
--- a/gst-libs/ext/libav/libavcodec/error_resilience.c
+++ b/gst-libs/ext/libav/libavcodec/error_resilience.c
@@ -46,7 +46,7 @@ static void decode_mb(MpegEncContext *s, int ref)
s->dest[1] = s->current_picture.f.data[1] + (s->mb_y * (16 >> s->chroma_y_shift) * s->uvlinesize) + s->mb_x * (16 >> s->chroma_x_shift);
s->dest[2] = s->current_picture.f.data[2] + (s->mb_y * (16 >> s->chroma_y_shift) * s->uvlinesize) + s->mb_x * (16 >> s->chroma_x_shift);
- if (CONFIG_H264_DECODER && s->codec_id == CODEC_ID_H264) {
+ if (CONFIG_H264_DECODER && s->codec_id == AV_CODEC_ID_H264) {
H264Context *h = (void*)s;
h->mb_xy = s->mb_x + s->mb_y * s->mb_stride;
memset(h->non_zero_count_cache, 0, sizeof(h->non_zero_count_cache));
@@ -66,7 +66,7 @@ static void decode_mb(MpegEncContext *s, int ref)
ff_h264_hl_decode_mb(h);
} else {
assert(ref == 0);
- MPV_decode_mb(s, s->block);
+ ff_MPV_decode_mb(s, s->block);
}
}
@@ -76,7 +76,7 @@ static void decode_mb(MpegEncContext *s, int ref)
*/
static void set_mv_strides(MpegEncContext *s, int *mv_step, int *stride)
{
- if (s->codec_id == CODEC_ID_H264) {
+ if (s->codec_id == AV_CODEC_ID_H264) {
H264Context *h = (void*)s;
assert(s->quarter_sample);
*mv_step = 4;
@@ -388,7 +388,7 @@ static void v_block_filter(MpegEncContext *s, uint8_t *dst, int w, int h,
static void guess_mv(MpegEncContext *s)
{
- uint8_t fixed[s->mb_stride * s->mb_height];
+ uint8_t *fixed = s->er_temp_buffer;
#define MV_FROZEN 3
#define MV_CHANGED 2
#define MV_UNCHANGED 1
@@ -599,10 +599,10 @@ skip_mean_and_median:
pred_count++;
if (!fixed[mb_xy]) {
- if (s->avctx->codec_id == CODEC_ID_H264) {
+ if (s->avctx->codec_id == AV_CODEC_ID_H264) {
// FIXME
} else {
- ff_thread_await_progress((AVFrame *) s->last_picture_ptr,
+ ff_thread_await_progress(&s->last_picture_ptr->f,
mb_y, 0);
}
if (!s->last_picture.f.motion_val[0] ||
@@ -699,8 +699,6 @@ skip_last_mv:
fixed[mb_xy] = MV_UNCHANGED;
}
}
-
- // printf(".%d/%d", changed, score_sum); fflush(stdout);
}
if (none_left)
@@ -711,7 +709,6 @@ skip_last_mv:
if (fixed[mb_xy])
fixed[mb_xy] = MV_FROZEN;
}
- // printf(":"); fflush(stdout);
}
}
@@ -730,7 +727,7 @@ static int is_intra_more_likely(MpegEncContext *s)
undamaged_count++;
}
- if (s->codec_id == CODEC_ID_H264) {
+ if (s->codec_id == AV_CODEC_ID_H264) {
H264Context *h = (void*) s;
if (h->list_count <= 0 || h->ref_count[0] <= 0 ||
!h->ref_list[0][0].f.data[0])
@@ -770,10 +767,10 @@ static int is_intra_more_likely(MpegEncContext *s)
uint8_t *last_mb_ptr = s->last_picture.f.data[0] +
mb_x * 16 + mb_y * 16 * s->linesize;
- if (s->avctx->codec_id == CODEC_ID_H264) {
+ if (s->avctx->codec_id == AV_CODEC_ID_H264) {
// FIXME
} else {
- ff_thread_await_progress((AVFrame *) s->last_picture_ptr,
+ ff_thread_await_progress(&s->last_picture_ptr->f,
mb_y, 0);
}
is_intra_likely += s->dsp.sad[0](NULL, last_mb_ptr, mb_ptr,
@@ -789,7 +786,6 @@ static int is_intra_more_likely(MpegEncContext *s)
}
}
}
- // printf("is_intra_likely: %d type:%d\n", is_intra_likely, s->pict_type);
return is_intra_likely > 0;
}
@@ -891,7 +887,7 @@ void ff_er_frame_end(MpegEncContext *s)
/* We do not support ER of field pictures yet,
* though it should not crash if enabled. */
- if (!s->err_recognition || s->error_count == 0 || s->avctx->lowres ||
+ if (!s->err_recognition || s->error_count == 0 ||
s->avctx->hwaccel ||
s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU ||
s->picture_structure != PICT_FRAME ||
@@ -1161,10 +1157,10 @@ void ff_er_frame_end(MpegEncContext *s)
int time_pp = s->pp_time;
int time_pb = s->pb_time;
- if (s->avctx->codec_id == CODEC_ID_H264) {
+ if (s->avctx->codec_id == AV_CODEC_ID_H264) {
// FIXME
} else {
- ff_thread_await_progress((AVFrame *) s->next_picture_ptr, mb_y, 0);
+ ff_thread_await_progress(&s->next_picture_ptr->f, mb_y, 0);
}
s->mv[0][0][0] = s->next_picture.f.motion_val[0][xy][0] * time_pb / time_pp;
s->mv[0][0][1] = s->next_picture.f.motion_val[0][xy][1] * time_pb / time_pp;
diff --git a/gst-libs/ext/libav/libavcodec/escape124.c b/gst-libs/ext/libav/libavcodec/escape124.c
index 9efafdb..a27ab68 100644
--- a/gst-libs/ext/libav/libavcodec/escape124.c
+++ b/gst-libs/ext/libav/libavcodec/escape124.c
@@ -20,6 +20,7 @@
*/
#include "avcodec.h"
+#include "internal.h"
#define BITSTREAM_READER_LE
#include "get_bits.h"
@@ -61,7 +62,7 @@ static av_cold int escape124_decode_init(AVCodecContext *avctx)
{
Escape124Context *s = avctx->priv_data;
- avctx->pix_fmt = PIX_FMT_RGB555;
+ avctx->pix_fmt = AV_PIX_FMT_RGB555;
s->num_superblocks = ((unsigned)avctx->width / 8) *
((unsigned)avctx->height / 8);
@@ -196,7 +197,7 @@ static const uint16_t mask_matrix[] = {0x1, 0x2, 0x10, 0x20,
0x400, 0x800, 0x4000, 0x8000};
static int escape124_decode_frame(AVCodecContext *avctx,
- void *data, int *data_size,
+ void *data, int *got_frame,
AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
@@ -231,7 +232,7 @@ static int escape124_decode_frame(AVCodecContext *avctx,
if (!(frame_flags & 0x114) || !(frame_flags & 0x7800000)) {
av_log(NULL, AV_LOG_DEBUG, "Skipping frame\n");
- *data_size = sizeof(AVFrame);
+ *got_frame = 1;
*(AVFrame*)data = s->frame;
return frame_size;
@@ -266,7 +267,7 @@ static int escape124_decode_frame(AVCodecContext *avctx,
}
new_frame.reference = 3;
- if (avctx->get_buffer(avctx, &new_frame)) {
+ if (ff_get_buffer(avctx, &new_frame)) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return -1;
}
@@ -357,7 +358,7 @@ static int escape124_decode_frame(AVCodecContext *avctx,
avctx->release_buffer(avctx, &s->frame);
*(AVFrame*)data = s->frame = new_frame;
- *data_size = sizeof(AVFrame);
+ *got_frame = 1;
return frame_size;
}
@@ -366,12 +367,11 @@ static int escape124_decode_frame(AVCodecContext *avctx,
AVCodec ff_escape124_decoder = {
.name = "escape124",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_ESCAPE124,
+ .id = AV_CODEC_ID_ESCAPE124,
.priv_data_size = sizeof(Escape124Context),
.init = escape124_decode_init,
.close = escape124_decode_close,
.decode = escape124_decode_frame,
.capabilities = CODEC_CAP_DR1,
- .long_name = NULL_IF_CONFIG_SMALL("Escape 124"),
+ .long_name = NULL_IF_CONFIG_SMALL("Escape 124"),
};
-
diff --git a/gst-libs/ext/libav/libavcodec/faandct.c b/gst-libs/ext/libav/libavcodec/faandct.c
index a986f65..1379394 100644
--- a/gst-libs/ext/libav/libavcodec/faandct.c
+++ b/gst-libs/ext/libav/libavcodec/faandct.c
@@ -27,13 +27,10 @@
#include "dsputil.h"
#include "faandct.h"
+#include "libavutil/internal.h"
+#include "libavutil/libm.h"
#define FLOAT float
-#ifdef FAAN_POSTSCALE
-# define SCALE(x) postscale[x]
-#else
-# define SCALE(x) 1
-#endif
//numbers generated by simple c code (not as accurate as they could be)
/*
@@ -150,13 +147,13 @@ void ff_faandct(DCTELEM * data)
tmp11= tmp1 + tmp2;
tmp12= tmp1 - tmp2;
- data[8*0 + i]= lrintf(SCALE(8*0 + i) * (tmp10 + tmp11));
- data[8*4 + i]= lrintf(SCALE(8*4 + i) * (tmp10 - tmp11));
+ data[8*0 + i]= lrintf(postscale[8*0 + i] * (tmp10 + tmp11));
+ data[8*4 + i]= lrintf(postscale[8*4 + i] * (tmp10 - tmp11));
tmp12 += tmp13;
tmp12 *= A1;
- data[8*2 + i]= lrintf(SCALE(8*2 + i) * (tmp13 + tmp12));
- data[8*6 + i]= lrintf(SCALE(8*6 + i) * (tmp13 - tmp12));
+ data[8*2 + i]= lrintf(postscale[8*2 + i] * (tmp13 + tmp12));
+ data[8*6 + i]= lrintf(postscale[8*6 + i] * (tmp13 - tmp12));
tmp4 += tmp5;
tmp5 += tmp6;
@@ -175,10 +172,10 @@ void ff_faandct(DCTELEM * data)
z11= tmp7 + tmp5;
z13= tmp7 - tmp5;
- data[8*5 + i]= lrintf(SCALE(8*5 + i) * (z13 + z2));
- data[8*3 + i]= lrintf(SCALE(8*3 + i) * (z13 - z2));
- data[8*1 + i]= lrintf(SCALE(8*1 + i) * (z11 + z4));
- data[8*7 + i]= lrintf(SCALE(8*7 + i) * (z11 - z4));
+ data[8*5 + i]= lrintf(postscale[8*5 + i] * (z13 + z2));
+ data[8*3 + i]= lrintf(postscale[8*3 + i] * (z13 - z2));
+ data[8*1 + i]= lrintf(postscale[8*1 + i] * (z11 + z4));
+ data[8*7 + i]= lrintf(postscale[8*7 + i] * (z11 - z4));
}
}
@@ -208,25 +205,25 @@ void ff_faandct248(DCTELEM * data)
tmp12 = tmp1 - tmp2;
tmp13 = tmp0 - tmp3;
- data[8*0 + i] = lrintf(SCALE(8*0 + i) * (tmp10 + tmp11));
- data[8*4 + i] = lrintf(SCALE(8*4 + i) * (tmp10 - tmp11));
+ data[8*0 + i] = lrintf(postscale[8*0 + i] * (tmp10 + tmp11));
+ data[8*4 + i] = lrintf(postscale[8*4 + i] * (tmp10 - tmp11));
tmp12 += tmp13;
tmp12 *= A1;
- data[8*2 + i] = lrintf(SCALE(8*2 + i) * (tmp13 + tmp12));
- data[8*6 + i] = lrintf(SCALE(8*6 + i) * (tmp13 - tmp12));
+ data[8*2 + i] = lrintf(postscale[8*2 + i] * (tmp13 + tmp12));
+ data[8*6 + i] = lrintf(postscale[8*6 + i] * (tmp13 - tmp12));
tmp10 = tmp4 + tmp7;
tmp11 = tmp5 + tmp6;
tmp12 = tmp5 - tmp6;
tmp13 = tmp4 - tmp7;
- data[8*1 + i] = lrintf(SCALE(8*0 + i) * (tmp10 + tmp11));
- data[8*5 + i] = lrintf(SCALE(8*4 + i) * (tmp10 - tmp11));
+ data[8*1 + i] = lrintf(postscale[8*0 + i] * (tmp10 + tmp11));
+ data[8*5 + i] = lrintf(postscale[8*4 + i] * (tmp10 - tmp11));
tmp12 += tmp13;
tmp12 *= A1;
- data[8*3 + i] = lrintf(SCALE(8*2 + i) * (tmp13 + tmp12));
- data[8*7 + i] = lrintf(SCALE(8*6 + i) * (tmp13 - tmp12));
+ data[8*3 + i] = lrintf(postscale[8*2 + i] * (tmp13 + tmp12));
+ data[8*7 + i] = lrintf(postscale[8*6 + i] * (tmp13 - tmp12));
}
}
diff --git a/gst-libs/ext/libav/libavcodec/faandct.h b/gst-libs/ext/libav/libavcodec/faandct.h
index da8c0e4..cd98236 100644
--- a/gst-libs/ext/libav/libavcodec/faandct.h
+++ b/gst-libs/ext/libav/libavcodec/faandct.h
@@ -31,8 +31,6 @@
#include "dsputil.h"
-#define FAAN_POSTSCALE
-
void ff_faandct(DCTELEM * data);
void ff_faandct248(DCTELEM * data);
diff --git a/gst-libs/ext/libav/libavcodec/faanidct.c b/gst-libs/ext/libav/libavcodec/faanidct.c
index 0b9b458..cd8ca27 100644
--- a/gst-libs/ext/libav/libavcodec/faanidct.c
+++ b/gst-libs/ext/libav/libavcodec/faanidct.c
@@ -19,6 +19,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "faanidct.h"
+#include "libavutil/common.h"
/* To allow switching to double. */
#define FLOAT float
diff --git a/gst-libs/ext/libav/libavcodec/faxcompr.c b/gst-libs/ext/libav/libavcodec/faxcompr.c
index a0fa825..077e740 100644
--- a/gst-libs/ext/libav/libavcodec/faxcompr.c
+++ b/gst-libs/ext/libav/libavcodec/faxcompr.c
@@ -275,12 +275,17 @@ int ff_ccitt_unpack(AVCodecContext *avctx,
{
int j;
GetBitContext gb;
- int *runs, *ref, *runend;
+ int *runs, *ref = NULL, *runend;
int ret;
int runsize= avctx->width + 2;
+ int err = 0;
runs = av_malloc(runsize * sizeof(runs[0]));
ref = av_malloc(runsize * sizeof(ref[0]));
+ if (!runs || ! ref) {
+ err = AVERROR(ENOMEM);
+ goto fail;
+ }
ref[0] = avctx->width;
ref[1] = 0;
ref[2] = 0;
@@ -290,9 +295,8 @@ int ff_ccitt_unpack(AVCodecContext *avctx,
if(compr == TIFF_G4){
ret = decode_group3_2d_line(avctx, &gb, avctx->width, runs, runend, ref);
if(ret < 0){
- av_free(runs);
- av_free(ref);
- return -1;
+ err = -1;
+ goto fail;
}
}else{
int g3d1 = (compr == TIFF_G3) && !(opts & 1);
@@ -313,7 +317,8 @@ int ff_ccitt_unpack(AVCodecContext *avctx,
}
dst += stride;
}
+fail:
av_free(runs);
av_free(ref);
- return 0;
+ return err;
}
diff --git a/gst-libs/ext/libav/libavcodec/fft-test.c b/gst-libs/ext/libav/libavcodec/fft-test.c
index f890de6..1e46750 100644
--- a/gst-libs/ext/libav/libavcodec/fft-test.c
+++ b/gst-libs/ext/libav/libavcodec/fft-test.c
@@ -23,17 +23,20 @@
* FFT and MDCT tests.
*/
+#include "libavutil/cpu.h"
#include "libavutil/mathematics.h"
#include "libavutil/lfg.h"
#include "libavutil/log.h"
+#include "libavutil/time.h"
#include "fft.h"
#if CONFIG_FFT_FLOAT
#include "dct.h"
#include "rdft.h"
#endif
#include <math.h>
+#if HAVE_UNISTD_H
#include <unistd.h>
-#include <sys/time.h>
+#endif
#include <stdlib.h>
#include <string.h>
@@ -185,13 +188,6 @@ static FFTSample frandom(AVLFG *prng)
return (int16_t)av_lfg_get(prng) / 32768.0 * RANGE;
}
-static int64_t gettime(void)
-{
- struct timeval tv;
- gettimeofday(&tv,NULL);
- return (int64_t)tv.tv_sec * 1000000 + tv.tv_usec;
-}
-
static int check_diff(FFTSample *tab1, FFTSample *tab2, int n, double scale)
{
int i;
@@ -235,11 +231,16 @@ enum tf_transform {
TRANSFORM_DCT,
};
+#if !HAVE_GETOPT
+#include "compat/getopt.c"
+#endif
+
int main(int argc, char **argv)
{
FFTComplex *tab, *tab1, *tab_ref;
FFTSample *tab2;
int it, i, c;
+ int cpuflags;
int do_speed = 0;
int err = 1;
enum tf_transform transform = TRANSFORM_FFT;
@@ -258,7 +259,7 @@ int main(int argc, char **argv)
fft_nbits = 9;
for(;;) {
- c = getopt(argc, argv, "hsimrdn:f:");
+ c = getopt(argc, argv, "hsimrdn:f:c:");
if (c == -1)
break;
switch(c) {
@@ -286,6 +287,12 @@ int main(int argc, char **argv)
case 'f':
scale = atof(optarg);
break;
+ case 'c':
+ cpuflags = av_parse_cpu_flags(optarg);
+ if (cpuflags < 0)
+ return 1;
+ av_set_cpu_flags_mask(cpuflags);
+ break;
}
}
@@ -422,7 +429,7 @@ int main(int argc, char **argv)
/* we measure during about 1 seconds */
nb_its = 1;
for(;;) {
- time_start = gettime();
+ time_start = av_gettime();
for (it = 0; it < nb_its; it++) {
switch (transform) {
case TRANSFORM_MDCT:
@@ -448,7 +455,7 @@ int main(int argc, char **argv)
#endif
}
}
- duration = gettime() - time_start;
+ duration = av_gettime() - time_start;
if (duration >= 1000000)
break;
nb_its *= 2;
diff --git a/gst-libs/ext/libav/libavcodec/fft.c b/gst-libs/ext/libav/libavcodec/fft.c
index aa34b34..0983e80 100644
--- a/gst-libs/ext/libav/libavcodec/fft.c
+++ b/gst-libs/ext/libav/libavcodec/fft.c
@@ -160,7 +160,7 @@ av_cold int ff_fft_init(FFTContext *s, int nbits, int inverse)
#if CONFIG_FFT_FLOAT
if (ARCH_ARM) ff_fft_init_arm(s);
if (HAVE_ALTIVEC) ff_fft_init_altivec(s);
- if (HAVE_MMX) ff_fft_init_mmx(s);
+ if (ARCH_X86) ff_fft_init_x86(s);
if (CONFIG_MDCT) s->mdct_calcw = s->mdct_calc;
#else
if (CONFIG_MDCT) s->mdct_calcw = ff_mdct_calcw_c;
@@ -350,4 +350,3 @@ static void ff_fft_calc_c(FFTContext *s, FFTComplex *z)
{
fft_dispatch[s->nbits-2](z);
}
-
diff --git a/gst-libs/ext/libav/libavcodec/fft.h b/gst-libs/ext/libav/libavcodec/fft.h
index 706f94b..7f10f72 100644
--- a/gst-libs/ext/libav/libavcodec/fft.h
+++ b/gst-libs/ext/libav/libavcodec/fft.h
@@ -135,7 +135,7 @@ int ff_fft_init(FFTContext *s, int nbits, int inverse);
#if CONFIG_FFT_FLOAT
void ff_fft_init_altivec(FFTContext *s);
-void ff_fft_init_mmx(FFTContext *s);
+void ff_fft_init_x86(FFTContext *s);
void ff_fft_init_arm(FFTContext *s);
#else
void ff_fft_fixed_init_arm(FFTContext *s);
diff --git a/gst-libs/ext/libav/libavcodec/ffv1.c b/gst-libs/ext/libav/libavcodec/ffv1.c
index 8a6f33f..682d111 100644
--- a/gst-libs/ext/libav/libavcodec/ffv1.c
+++ b/gst-libs/ext/libav/libavcodec/ffv1.c
@@ -25,6 +25,7 @@
* FF Video Codec 1 (a lossless codec)
*/
+#include "libavutil/avassert.h"
#include "avcodec.h"
#include "get_bits.h"
#include "put_bits.h"
@@ -32,1189 +33,249 @@
#include "rangecoder.h"
#include "golomb.h"
#include "mathops.h"
-#include "libavutil/avassert.h"
-
-#define MAX_PLANES 4
-#define CONTEXT_SIZE 32
-
-#define MAX_QUANT_TABLES 8
-#define MAX_CONTEXT_INPUTS 5
-
-extern const uint8_t ff_log2_run[41];
-
-static const int8_t quant5_10bit[256]={
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
--2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,
--2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,
--2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,
--2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,
--2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-1,
--1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
--1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
--1,-1,-1,-1,-1,-1,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,
+#include "ffv1.h"
+
+const int8_t ffv1_quant5_10bit[256] = {
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
+ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
+ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
+ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
+ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0,
};
-static const int8_t quant5[256]={
- 0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
--2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,
--2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,
--2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,
--2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,
--2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,
--2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,
--2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,
--2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-1,-1,-1,
+const int8_t ffv1_quant5[256] = {
+ 0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
+ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
+ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
+ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
+ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
+ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
+ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
+ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -1, -1, -1,
};
-static const int8_t quant9_10bit[256]={
- 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
--4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,
--4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,
--4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,
--4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,
--4,-4,-4,-4,-4,-4,-4,-4,-4,-3,-3,-3,-3,-3,-3,-3,
--3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,
--3,-3,-3,-3,-3,-3,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,
--2,-2,-2,-2,-1,-1,-1,-1,-1,-1,-1,-1,-0,-0,-0,-0,
+const int8_t ffv1_quant9_10bit[256] = {
+ 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
+ -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4,
+ -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4,
+ -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4,
+ -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4,
+ -4, -4, -4, -4, -4, -4, -4, -4, -4, -3, -3, -3, -3, -3, -3, -3,
+ -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3,
+ -3, -3, -3, -3, -3, -3, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
+ -2, -2, -2, -2, -1, -1, -1, -1, -1, -1, -1, -1, -0, -0, -0, -0,
};
-static const int8_t quant11[256]={
- 0, 1, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
--5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,
--5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,
--5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,
--5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,
--5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,
--5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-4,-4,
--4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,
--4,-4,-4,-4,-4,-3,-3,-3,-3,-3,-3,-3,-2,-2,-2,-1,
+const int8_t ffv1_quant11[256] = {
+ 0, 1, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5,
+ -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5,
+ -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5,
+ -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5,
+ -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5,
+ -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -4, -4,
+ -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4,
+ -4, -4, -4, -4, -4, -3, -3, -3, -3, -3, -3, -3, -2, -2, -2, -1,
};
-static const uint8_t ver2_state[256]= {
- 0, 10, 10, 10, 10, 16, 16, 16, 28, 16, 16, 29, 42, 49, 20, 49,
- 59, 25, 26, 26, 27, 31, 33, 33, 33, 34, 34, 37, 67, 38, 39, 39,
- 40, 40, 41, 79, 43, 44, 45, 45, 48, 48, 64, 50, 51, 52, 88, 52,
- 53, 74, 55, 57, 58, 58, 74, 60, 101, 61, 62, 84, 66, 66, 68, 69,
- 87, 82, 71, 97, 73, 73, 82, 75, 111, 77, 94, 78, 87, 81, 83, 97,
- 85, 83, 94, 86, 99, 89, 90, 99, 111, 92, 93, 134, 95, 98, 105, 98,
- 105, 110, 102, 108, 102, 118, 103, 106, 106, 113, 109, 112, 114, 112, 116, 125,
- 115, 116, 117, 117, 126, 119, 125, 121, 121, 123, 145, 124, 126, 131, 127, 129,
- 165, 130, 132, 138, 133, 135, 145, 136, 137, 139, 146, 141, 143, 142, 144, 148,
- 147, 155, 151, 149, 151, 150, 152, 157, 153, 154, 156, 168, 158, 162, 161, 160,
- 172, 163, 169, 164, 166, 184, 167, 170, 177, 174, 171, 173, 182, 176, 180, 178,
- 175, 189, 179, 181, 186, 183, 192, 185, 200, 187, 191, 188, 190, 197, 193, 196,
- 197, 194, 195, 196, 198, 202, 199, 201, 210, 203, 207, 204, 205, 206, 208, 214,
- 209, 211, 221, 212, 213, 215, 224, 216, 217, 218, 219, 220, 222, 228, 223, 225,
- 226, 224, 227, 229, 240, 230, 231, 232, 233, 234, 235, 236, 238, 239, 237, 242,
- 241, 243, 242, 244, 245, 246, 247, 248, 249, 250, 251, 252, 252, 253, 254, 255,
+const uint8_t ffv1_ver2_state[256] = {
+ 0, 10, 10, 10, 10, 16, 16, 16, 28, 16, 16, 29, 42, 49, 20, 49,
+ 59, 25, 26, 26, 27, 31, 33, 33, 33, 34, 34, 37, 67, 38, 39, 39,
+ 40, 40, 41, 79, 43, 44, 45, 45, 48, 48, 64, 50, 51, 52, 88, 52,
+ 53, 74, 55, 57, 58, 58, 74, 60, 101, 61, 62, 84, 66, 66, 68, 69,
+ 87, 82, 71, 97, 73, 73, 82, 75, 111, 77, 94, 78, 87, 81, 83, 97,
+ 85, 83, 94, 86, 99, 89, 90, 99, 111, 92, 93, 134, 95, 98, 105, 98,
+ 105, 110, 102, 108, 102, 118, 103, 106, 106, 113, 109, 112, 114, 112, 116, 125,
+ 115, 116, 117, 117, 126, 119, 125, 121, 121, 123, 145, 124, 126, 131, 127, 129,
+ 165, 130, 132, 138, 133, 135, 145, 136, 137, 139, 146, 141, 143, 142, 144, 148,
+ 147, 155, 151, 149, 151, 150, 152, 157, 153, 154, 156, 168, 158, 162, 161, 160,
+ 172, 163, 169, 164, 166, 184, 167, 170, 177, 174, 171, 173, 182, 176, 180, 178,
+ 175, 189, 179, 181, 186, 183, 192, 185, 200, 187, 191, 188, 190, 197, 193, 196,
+ 197, 194, 195, 196, 198, 202, 199, 201, 210, 203, 207, 204, 205, 206, 208, 214,
+ 209, 211, 221, 212, 213, 215, 224, 216, 217, 218, 219, 220, 222, 228, 223, 225,
+ 226, 224, 227, 229, 240, 230, 231, 232, 233, 234, 235, 236, 238, 239, 237, 242,
+ 241, 243, 242, 244, 245, 246, 247, 248, 249, 250, 251, 252, 252, 253, 254, 255,
};
-typedef struct VlcState{
- int16_t drift;
- uint16_t error_sum;
- int8_t bias;
- uint8_t count;
-} VlcState;
-
-typedef struct PlaneContext{
- int16_t quant_table[MAX_CONTEXT_INPUTS][256];
- int quant_table_index;
- int context_count;
- uint8_t (*state)[CONTEXT_SIZE];
- VlcState *vlc_state;
- uint8_t interlace_bit_state[2];
-} PlaneContext;
-
-#define MAX_SLICES 256
-
-typedef struct FFV1Context{
- AVCodecContext *avctx;
- RangeCoder c;
- GetBitContext gb;
- PutBitContext pb;
- uint64_t rc_stat[256][2];
- uint64_t (*rc_stat2[MAX_QUANT_TABLES])[32][2];
- int version;
- int width, height;
- int chroma_h_shift, chroma_v_shift;
- int flags;
- int picture_number;
- AVFrame picture;
- int plane_count;
- int ac; ///< 1=range coder <-> 0=golomb rice
- PlaneContext plane[MAX_PLANES];
- int16_t quant_table[MAX_CONTEXT_INPUTS][256];
- int16_t quant_tables[MAX_QUANT_TABLES][MAX_CONTEXT_INPUTS][256];
- int context_count[MAX_QUANT_TABLES];
- uint8_t state_transition[256];
- uint8_t (*initial_states[MAX_QUANT_TABLES])[32];
- int run_index;
- int colorspace;
- int16_t *sample_buffer;
- int gob_count;
-
- int quant_table_count;
-
- DSPContext dsp;
-
- struct FFV1Context *slice_context[MAX_SLICES];
- int slice_count;
- int num_v_slices;
- int num_h_slices;
- int slice_width;
- int slice_height;
- int slice_x;
- int slice_y;
-}FFV1Context;
-
-static av_always_inline int fold(int diff, int bits){
- if(bits==8)
- diff= (int8_t)diff;
- else{
- diff+= 1<<(bits-1);
- diff&=(1<<bits)-1;
- diff-= 1<<(bits-1);
- }
-
- return diff;
-}
-
-static inline int predict(int16_t *src, int16_t *last)
-{
- const int LT= last[-1];
- const int T= last[ 0];
- const int L = src[-1];
-
- return mid_pred(L, L + T - LT, T);
-}
-
-static inline int get_context(PlaneContext *p, int16_t *src,
- int16_t *last, int16_t *last2)
-{
- const int LT= last[-1];
- const int T= last[ 0];
- const int RT= last[ 1];
- const int L = src[-1];
-
- if(p->quant_table[3][127]){
- const int TT= last2[0];
- const int LL= src[-2];
- return p->quant_table[0][(L-LT) & 0xFF] + p->quant_table[1][(LT-T) & 0xFF] + p->quant_table[2][(T-RT) & 0xFF]
- +p->quant_table[3][(LL-L) & 0xFF] + p->quant_table[4][(TT-T) & 0xFF];
- }else
- return p->quant_table[0][(L-LT) & 0xFF] + p->quant_table[1][(LT-T) & 0xFF] + p->quant_table[2][(T-RT) & 0xFF];
-}
-
-static void find_best_state(uint8_t best_state[256][256], const uint8_t one_state[256]){
- int i,j,k,m;
- double l2tab[256];
-
- for(i=1; i<256; i++)
- l2tab[i]= log2(i/256.0);
-
- for(i=0; i<256; i++){
- double best_len[256];
- double p= i/256.0;
-
- for(j=0; j<256; j++)
- best_len[j]= 1<<30;
-
- for(j=FFMAX(i-10,1); j<FFMIN(i+11,256); j++){
- double occ[256]={0};
- double len=0;
- occ[j]=1.0;
- for(k=0; k<256; k++){
- double newocc[256]={0};
- for(m=0; m<256; m++){
- if(occ[m]){
- len -=occ[m]*( p *l2tab[ m]
- + (1-p)*l2tab[256-m]);
- }
- }
- if(len < best_len[k]){
- best_len[k]= len;
- best_state[i][k]= j;
- }
- for(m=0; m<256; m++){
- if(occ[m]){
- newocc[ one_state[ m]] += occ[m]* p ;
- newocc[256-one_state[256-m]] += occ[m]*(1-p);
- }
- }
- memcpy(occ, newocc, sizeof(occ));
- }
- }
- }
-}
-
-static av_always_inline av_flatten void put_symbol_inline(RangeCoder *c, uint8_t *state, int v, int is_signed, uint64_t rc_stat[256][2], uint64_t rc_stat2[32][2]){
- int i;
-
-#define put_rac(C,S,B) \
-do{\
- if(rc_stat){\
- rc_stat[*(S)][B]++;\
- rc_stat2[(S)-state][B]++;\
- }\
- put_rac(C,S,B);\
-}while(0)
-
- if(v){
- const int a= FFABS(v);
- const int e= av_log2(a);
- put_rac(c, state+0, 0);
- if(e<=9){
- for(i=0; i<e; i++){
- put_rac(c, state+1+i, 1); //1..10
- }
- put_rac(c, state+1+i, 0);
-
- for(i=e-1; i>=0; i--){
- put_rac(c, state+22+i, (a>>i)&1); //22..31
- }
-
- if(is_signed)
- put_rac(c, state+11 + e, v < 0); //11..21
- }else{
- for(i=0; i<e; i++){
- put_rac(c, state+1+FFMIN(i,9), 1); //1..10
- }
- put_rac(c, state+1+9, 0);
-
- for(i=e-1; i>=0; i--){
- put_rac(c, state+22+FFMIN(i,9), (a>>i)&1); //22..31
- }
-
- if(is_signed)
- put_rac(c, state+11 + 10, v < 0); //11..21
- }
- }else{
- put_rac(c, state+0, 1);
- }
-#undef put_rac
-}
-
-static void av_noinline put_symbol(RangeCoder *c, uint8_t *state, int v, int is_signed){
- put_symbol_inline(c, state, v, is_signed, NULL, NULL);
-}
-
-static inline av_flatten int get_symbol_inline(RangeCoder *c, uint8_t *state, int is_signed){
- if(get_rac(c, state+0))
- return 0;
- else{
- int i, e, a;
- e= 0;
- while(get_rac(c, state+1 + FFMIN(e,9))){ //1..10
- e++;
- }
-
- a= 1;
- for(i=e-1; i>=0; i--){
- a += a + get_rac(c, state+22 + FFMIN(i,9)); //22..31
- }
-
- e= -(is_signed && get_rac(c, state+11 + FFMIN(e, 10))); //11..21
- return (a^e)-e;
- }
-}
-
-static int av_noinline get_symbol(RangeCoder *c, uint8_t *state, int is_signed){
- return get_symbol_inline(c, state, is_signed);
-}
-
-static inline void update_vlc_state(VlcState * const state, const int v){
- int drift= state->drift;
- int count= state->count;
- state->error_sum += FFABS(v);
- drift += v;
-
- if(count == 128){ //FIXME variable
- count >>= 1;
- drift >>= 1;
- state->error_sum >>= 1;
- }
- count++;
-
- if(drift <= -count){
- if(state->bias > -128) state->bias--;
-
- drift += count;
- if(drift <= -count)
- drift= -count + 1;
- }else if(drift > 0){
- if(state->bias < 127) state->bias++;
-
- drift -= count;
- if(drift > 0)
- drift= 0;
- }
-
- state->drift= drift;
- state->count= count;
-}
-
-static inline void put_vlc_symbol(PutBitContext *pb, VlcState * const state, int v, int bits){
- int i, k, code;
-//printf("final: %d ", v);
- v = fold(v - state->bias, bits);
-
- i= state->count;
- k=0;
- while(i < state->error_sum){ //FIXME optimize
- k++;
- i += i;
- }
-
- assert(k<=8);
-
-#if 0 // JPEG LS
- if(k==0 && 2*state->drift <= - state->count) code= v ^ (-1);
- else code= v;
-#else
- code= v ^ ((2*state->drift + state->count)>>31);
-#endif
-
-//printf("v:%d/%d bias:%d error:%d drift:%d count:%d k:%d\n", v, code, state->bias, state->error_sum, state->drift, state->count, k);
- set_sr_golomb(pb, code, k, 12, bits);
-
- update_vlc_state(state, v);
-}
-
-static inline int get_vlc_symbol(GetBitContext *gb, VlcState * const state, int bits){
- int k, i, v, ret;
-
- i= state->count;
- k=0;
- while(i < state->error_sum){ //FIXME optimize
- k++;
- i += i;
- }
-
- assert(k<=8);
-
- v= get_sr_golomb(gb, k, 12, bits);
-//printf("v:%d bias:%d error:%d drift:%d count:%d k:%d", v, state->bias, state->error_sum, state->drift, state->count, k);
-
-#if 0 // JPEG LS
- if(k==0 && 2*state->drift <= - state->count) v ^= (-1);
-#else
- v ^= ((2*state->drift + state->count)>>31);
-#endif
-
- ret= fold(v + state->bias, bits);
-
- update_vlc_state(state, v);
-//printf("final: %d\n", ret);
- return ret;
-}
-#if CONFIG_FFV1_ENCODER
-static av_always_inline int encode_line(FFV1Context *s, int w,
- int16_t *sample[2],
- int plane_index, int bits)
+int ffv1_common_init(AVCodecContext *avctx)
{
- PlaneContext * const p= &s->plane[plane_index];
- RangeCoder * const c= &s->c;
- int x;
- int run_index= s->run_index;
- int run_count=0;
- int run_mode=0;
-
- if(s->ac){
- if(c->bytestream_end - c->bytestream < w*20){
- av_log(s->avctx, AV_LOG_ERROR, "encoded frame too large\n");
- return -1;
- }
- }else{
- if(s->pb.buf_end - s->pb.buf - (put_bits_count(&s->pb)>>3) < w*4){
- av_log(s->avctx, AV_LOG_ERROR, "encoded frame too large\n");
- return -1;
- }
- }
-
- for(x=0; x<w; x++){
- int diff, context;
-
- context= get_context(p, sample[0]+x, sample[1]+x, sample[2]+x);
- diff= sample[0][x] - predict(sample[0]+x, sample[1]+x);
+ FFV1Context *s = avctx->priv_data;
- if(context < 0){
- context = -context;
- diff= -diff;
- }
+ s->avctx = avctx;
+ s->flags = avctx->flags;
- diff= fold(diff, bits);
+ if (!avctx->width || !avctx->height)
+ return AVERROR_INVALIDDATA;
- if(s->ac){
- if(s->flags & CODEC_FLAG_PASS1){
- put_symbol_inline(c, p->state[context], diff, 1, s->rc_stat, s->rc_stat2[p->quant_table_index][context]);
- }else{
- put_symbol_inline(c, p->state[context], diff, 1, NULL, NULL);
- }
- }else{
- if(context == 0) run_mode=1;
+ avcodec_get_frame_defaults(&s->picture);
- if(run_mode){
+ ff_dsputil_init(&s->dsp, avctx);
- if(diff){
- while(run_count >= 1<<ff_log2_run[run_index]){
- run_count -= 1<<ff_log2_run[run_index];
- run_index++;
- put_bits(&s->pb, 1, 1);
- }
+ s->width = avctx->width;
+ s->height = avctx->height;
- put_bits(&s->pb, 1 + ff_log2_run[run_index], run_count);
- if(run_index) run_index--;
- run_count=0;
- run_mode=0;
- if(diff>0) diff--;
- }else{
- run_count++;
- }
- }
-
-// printf("count:%d index:%d, mode:%d, x:%d y:%d pos:%d\n", run_count, run_index, run_mode, x, y, (int)put_bits_count(&s->pb));
-
- if(run_mode == 0)
- put_vlc_symbol(&s->pb, &p->vlc_state[context], diff, bits);
- }
- }
- if(run_mode){
- while(run_count >= 1<<ff_log2_run[run_index]){
- run_count -= 1<<ff_log2_run[run_index];
- run_index++;
- put_bits(&s->pb, 1, 1);
- }
-
- if(run_count)
- put_bits(&s->pb, 1, 1);
- }
- s->run_index= run_index;
+ // defaults
+ s->num_h_slices = 1;
+ s->num_v_slices = 1;
return 0;
}
-static void encode_plane(FFV1Context *s, uint8_t *src, int w, int h, int stride, int plane_index){
- int x,y,i;
- const int ring_size= s->avctx->context_model ? 3 : 2;
- int16_t *sample[3];
- s->run_index=0;
-
- memset(s->sample_buffer, 0, ring_size*(w+6)*sizeof(*s->sample_buffer));
-
- for(y=0; y<h; y++){
- for(i=0; i<ring_size; i++)
- sample[i]= s->sample_buffer + (w+6)*((h+i-y)%ring_size) + 3;
-
- sample[0][-1]= sample[1][0 ];
- sample[1][ w]= sample[1][w-1];
-//{START_TIMER
- if(s->avctx->bits_per_raw_sample<=8){
- for(x=0; x<w; x++){
- sample[0][x]= src[x + stride*y];
- }
- encode_line(s, w, sample, plane_index, 8);
- }else{
- for(x=0; x<w; x++){
- sample[0][x]= ((uint16_t*)(src + stride*y))[x] >> (16 - s->avctx->bits_per_raw_sample);
- }
- encode_line(s, w, sample, plane_index, s->avctx->bits_per_raw_sample);
- }
-//STOP_TIMER("encode line")}
- }
-}
-
-static void encode_rgb_frame(FFV1Context *s, uint32_t *src, int w, int h, int stride){
- int x, y, p, i;
- const int ring_size= s->avctx->context_model ? 3 : 2;
- int16_t *sample[3][3];
- s->run_index=0;
-
- memset(s->sample_buffer, 0, ring_size*3*(w+6)*sizeof(*s->sample_buffer));
-
- for(y=0; y<h; y++){
- for(i=0; i<ring_size; i++)
- for(p=0; p<3; p++)
- sample[p][i]= s->sample_buffer + p*ring_size*(w+6) + ((h+i-y)%ring_size)*(w+6) + 3;
-
- for(x=0; x<w; x++){
- int v= src[x + stride*y];
- int b= v&0xFF;
- int g= (v>>8)&0xFF;
- int r= (v>>16)&0xFF;
-
- b -= g;
- r -= g;
- g += (b + r)>>2;
- b += 0x100;
- r += 0x100;
-
-// assert(g>=0 && b>=0 && r>=0);
-// assert(g<256 && b<512 && r<512);
- sample[0][0][x]= g;
- sample[1][0][x]= b;
- sample[2][0][x]= r;
- }
- for(p=0; p<3; p++){
- sample[p][0][-1]= sample[p][1][0 ];
- sample[p][1][ w]= sample[p][1][w-1];
- encode_line(s, w, sample[p], FFMIN(p, 1), 9);
- }
- }
-}
-
-static void write_quant_table(RangeCoder *c, int16_t *quant_table){
- int last=0;
- int i;
- uint8_t state[CONTEXT_SIZE];
- memset(state, 128, sizeof(state));
-
- for(i=1; i<128 ; i++){
- if(quant_table[i] != quant_table[i-1]){
- put_symbol(c, state, i-last-1, 0);
- last= i;
- }
- }
- put_symbol(c, state, i-last-1, 0);
-}
-
-static void write_quant_tables(RangeCoder *c, int16_t quant_table[MAX_CONTEXT_INPUTS][256]){
- int i;
- for(i=0; i<5; i++)
- write_quant_table(c, quant_table[i]);
-}
-
-static void write_header(FFV1Context *f){
- uint8_t state[CONTEXT_SIZE];
- int i, j;
- RangeCoder * const c= &f->slice_context[0]->c;
-
- memset(state, 128, sizeof(state));
-
- if(f->version < 2){
- put_symbol(c, state, f->version, 0);
- put_symbol(c, state, f->ac, 0);
- if(f->ac>1){
- for(i=1; i<256; i++){
- put_symbol(c, state, f->state_transition[i] - c->one_state[i], 1);
- }
- }
- put_symbol(c, state, f->colorspace, 0); //YUV cs type
- if(f->version>0)
- put_symbol(c, state, f->avctx->bits_per_raw_sample, 0);
- put_rac(c, state, 1); //chroma planes
- put_symbol(c, state, f->chroma_h_shift, 0);
- put_symbol(c, state, f->chroma_v_shift, 0);
- put_rac(c, state, 0); //no transparency plane
-
- write_quant_tables(c, f->quant_table);
- }else{
- put_symbol(c, state, f->slice_count, 0);
- for(i=0; i<f->slice_count; i++){
- FFV1Context *fs= f->slice_context[i];
- put_symbol(c, state, (fs->slice_x +1)*f->num_h_slices / f->width , 0);
- put_symbol(c, state, (fs->slice_y +1)*f->num_v_slices / f->height , 0);
- put_symbol(c, state, (fs->slice_width +1)*f->num_h_slices / f->width -1, 0);
- put_symbol(c, state, (fs->slice_height+1)*f->num_v_slices / f->height-1, 0);
- for(j=0; j<f->plane_count; j++){
- put_symbol(c, state, f->plane[j].quant_table_index, 0);
- av_assert0(f->plane[j].quant_table_index == f->avctx->context_model);
- }
+int ffv1_init_slice_state(FFV1Context *f, FFV1Context *fs)
+{
+ int j;
+
+ fs->plane_count = f->plane_count;
+ fs->transparency = f->transparency;
+ for (j = 0; j < f->plane_count; j++) {
+ PlaneContext *const p = &fs->plane[j];
+
+ if (fs->ac) {
+ if (!p->state)
+ p->state = av_malloc(CONTEXT_SIZE * p->context_count *
+ sizeof(uint8_t));
+ if (!p->state)
+ return AVERROR(ENOMEM);
+ } else {
+ if (!p->vlc_state)
+ p->vlc_state = av_malloc(p->context_count * sizeof(VlcState));
+ if (!p->vlc_state)
+ return AVERROR(ENOMEM);
}
}
-}
-#endif /* CONFIG_FFV1_ENCODER */
-
-static av_cold int common_init(AVCodecContext *avctx){
- FFV1Context *s = avctx->priv_data;
-
- s->avctx= avctx;
- s->flags= avctx->flags;
-
- dsputil_init(&s->dsp, avctx);
-
- s->width = avctx->width;
- s->height= avctx->height;
-
- assert(s->width && s->height);
- //defaults
- s->num_h_slices=1;
- s->num_v_slices=1;
-
-
- return 0;
-}
-
-static int init_slice_state(FFV1Context *f){
- int i, j;
-
- for(i=0; i<f->slice_count; i++){
- FFV1Context *fs= f->slice_context[i];
- for(j=0; j<f->plane_count; j++){
- PlaneContext * const p= &fs->plane[j];
-
- if(fs->ac){
- if(!p-> state) p-> state= av_malloc(CONTEXT_SIZE*p->context_count*sizeof(uint8_t));
- if(!p-> state)
- return AVERROR(ENOMEM);
- }else{
- if(!p->vlc_state) p->vlc_state= av_malloc(p->context_count*sizeof(VlcState));
- if(!p->vlc_state)
- return AVERROR(ENOMEM);
- }
- }
- if (fs->ac>1){
- //FIXME only redo if state_transition changed
- for(j=1; j<256; j++){
- fs->c.one_state [ j]= fs->state_transition[j];
- fs->c.zero_state[256-j]= 256-fs->c.one_state [j];
- }
+ if (fs->ac > 1) {
+ //FIXME only redo if state_transition changed
+ for (j = 1; j < 256; j++) {
+ fs->c.one_state[j] = f->state_transition[j];
+ fs->c.zero_state[256 - j] = 256 - fs->c.one_state[j];
}
}
return 0;
}
-static av_cold int init_slice_contexts(FFV1Context *f){
+av_cold int ffv1_init_slice_contexts(FFV1Context *f)
+{
int i;
- f->slice_count= f->num_h_slices * f->num_v_slices;
-
- for(i=0; i<f->slice_count; i++){
- FFV1Context *fs= av_mallocz(sizeof(*fs));
- int sx= i % f->num_h_slices;
- int sy= i / f->num_h_slices;
- int sxs= f->avctx->width * sx / f->num_h_slices;
- int sxe= f->avctx->width *(sx+1) / f->num_h_slices;
- int sys= f->avctx->height* sy / f->num_v_slices;
- int sye= f->avctx->height*(sy+1) / f->num_v_slices;
- f->slice_context[i]= fs;
+ f->slice_count = f->num_h_slices * f->num_v_slices;
+
+ for (i = 0; i < f->slice_count; i++) {
+ FFV1Context *fs = av_mallocz(sizeof(*fs));
+ int sx = i % f->num_h_slices;
+ int sy = i / f->num_h_slices;
+ int sxs = f->avctx->width * sx / f->num_h_slices;
+ int sxe = f->avctx->width * (sx + 1) / f->num_h_slices;
+ int sys = f->avctx->height * sy / f->num_v_slices;
+ int sye = f->avctx->height * (sy + 1) / f->num_v_slices;
+ f->slice_context[i] = fs;
memcpy(fs, f, sizeof(*fs));
memset(fs->rc_stat2, 0, sizeof(fs->rc_stat2));
- fs->slice_width = sxe - sxs;
- fs->slice_height= sye - sys;
- fs->slice_x = sxs;
- fs->slice_y = sys;
+ fs->slice_width = sxe - sxs;
+ fs->slice_height = sye - sys;
+ fs->slice_x = sxs;
+ fs->slice_y = sys;
- fs->sample_buffer = av_malloc(9 * (fs->width+6) * sizeof(*fs->sample_buffer));
+ fs->sample_buffer = av_malloc(3 * MAX_PLANES * (fs->width + 6) *
+ sizeof(*fs->sample_buffer));
if (!fs->sample_buffer)
return AVERROR(ENOMEM);
}
return 0;
}
-static int allocate_initial_states(FFV1Context *f){
+int ffv1_allocate_initial_states(FFV1Context *f)
+{
int i;
- for(i=0; i<f->quant_table_count; i++){
- f->initial_states[i]= av_malloc(f->context_count[i]*sizeof(*f->initial_states[i]));
- if(!f->initial_states[i])
+ for (i = 0; i < f->quant_table_count; i++) {
+ f->initial_states[i] = av_malloc(f->context_count[i] *
+ sizeof(*f->initial_states[i]));
+ if (!f->initial_states[i])
return AVERROR(ENOMEM);
- memset(f->initial_states[i], 128, f->context_count[i]*sizeof(*f->initial_states[i]));
- }
- return 0;
-}
-
-#if CONFIG_FFV1_ENCODER
-static int write_extra_header(FFV1Context *f){
- RangeCoder * const c= &f->c;
- uint8_t state[CONTEXT_SIZE];
- int i, j, k;
- uint8_t state2[32][CONTEXT_SIZE];
-
- memset(state2, 128, sizeof(state2));
- memset(state, 128, sizeof(state));
-
- f->avctx->extradata= av_malloc(f->avctx->extradata_size= 10000 + (11*11*5*5*5+11*11*11)*32);
- ff_init_range_encoder(c, f->avctx->extradata, f->avctx->extradata_size);
- ff_build_rac_states(c, 0.05*(1LL<<32), 256-8);
-
- put_symbol(c, state, f->version, 0);
- put_symbol(c, state, f->ac, 0);
- if(f->ac>1){
- for(i=1; i<256; i++){
- put_symbol(c, state, f->state_transition[i] - c->one_state[i], 1);
- }
+ memset(f->initial_states[i], 128,
+ f->context_count[i] * sizeof(*f->initial_states[i]));
}
- put_symbol(c, state, f->colorspace, 0); //YUV cs type
- put_symbol(c, state, f->avctx->bits_per_raw_sample, 0);
- put_rac(c, state, 1); //chroma planes
- put_symbol(c, state, f->chroma_h_shift, 0);
- put_symbol(c, state, f->chroma_v_shift, 0);
- put_rac(c, state, 0); //no transparency plane
- put_symbol(c, state, f->num_h_slices-1, 0);
- put_symbol(c, state, f->num_v_slices-1, 0);
-
- put_symbol(c, state, f->quant_table_count, 0);
- for(i=0; i<f->quant_table_count; i++)
- write_quant_tables(c, f->quant_tables[i]);
-
- for(i=0; i<f->quant_table_count; i++){
- for(j=0; j<f->context_count[i]*CONTEXT_SIZE; j++)
- if(f->initial_states[i] && f->initial_states[i][0][j] != 128)
- break;
- if(j<f->context_count[i]*CONTEXT_SIZE){
- put_rac(c, state, 1);
- for(j=0; j<f->context_count[i]; j++){
- for(k=0; k<CONTEXT_SIZE; k++){
- int pred= j ? f->initial_states[i][j-1][k] : 128;
- put_symbol(c, state2[k], (int8_t)(f->initial_states[i][j][k]-pred), 1);
- }
- }
- }else{
- put_rac(c, state, 0);
- }
- }
-
- f->avctx->extradata_size= ff_rac_terminate(c);
-
return 0;
}
-static int sort_stt(FFV1Context *s, uint8_t stt[256]){
- int i,i2,changed,print=0;
-
- do{
- changed=0;
- for(i=12; i<244; i++){
- for(i2=i+1; i2<245 && i2<i+4; i2++){
-#define COST(old, new) \
- s->rc_stat[old][0]*-log2((256-(new))/256.0)\
- +s->rc_stat[old][1]*-log2( (new) /256.0)
-
-#define COST2(old, new) \
- COST(old, new)\
- +COST(256-(old), 256-(new))
-
- double size0= COST2(i, i ) + COST2(i2, i2);
- double sizeX= COST2(i, i2) + COST2(i2, i );
- if(sizeX < size0 && i!=128 && i2!=128){
- int j;
- FFSWAP(int, stt[ i], stt[ i2]);
- FFSWAP(int, s->rc_stat[i ][0],s->rc_stat[ i2][0]);
- FFSWAP(int, s->rc_stat[i ][1],s->rc_stat[ i2][1]);
- if(i != 256-i2){
- FFSWAP(int, stt[256-i], stt[256-i2]);
- FFSWAP(int, s->rc_stat[256-i][0],s->rc_stat[256-i2][0]);
- FFSWAP(int, s->rc_stat[256-i][1],s->rc_stat[256-i2][1]);
- }
- for(j=1; j<256; j++){
- if (stt[j] == i ) stt[j] = i2;
- else if(stt[j] == i2) stt[j] = i ;
- if(i != 256-i2){
- if (stt[256-j] == 256-i ) stt[256-j] = 256-i2;
- else if(stt[256-j] == 256-i2) stt[256-j] = 256-i ;
- }
- }
- print=changed=1;
- }
- }
- }
- }while(changed);
- return print;
-}
-
-static av_cold int encode_init(AVCodecContext *avctx)
+void ffv1_clear_slice_state(FFV1Context *f, FFV1Context *fs)
{
- FFV1Context *s = avctx->priv_data;
- int i, j, k, m;
-
- common_init(avctx);
-
- s->version=0;
- s->ac= avctx->coder_type ? 2:0;
-
- if(s->ac>1)
- for(i=1; i<256; i++)
- s->state_transition[i]=ver2_state[i];
-
- s->plane_count=2;
- for(i=0; i<256; i++){
- s->quant_table_count=2;
- if(avctx->bits_per_raw_sample <=8){
- s->quant_tables[0][0][i]= quant11[i];
- s->quant_tables[0][1][i]= 11*quant11[i];
- s->quant_tables[0][2][i]= 11*11*quant11[i];
- s->quant_tables[1][0][i]= quant11[i];
- s->quant_tables[1][1][i]= 11*quant11[i];
- s->quant_tables[1][2][i]= 11*11*quant5 [i];
- s->quant_tables[1][3][i]= 5*11*11*quant5 [i];
- s->quant_tables[1][4][i]= 5*5*11*11*quant5 [i];
- }else{
- s->quant_tables[0][0][i]= quant9_10bit[i];
- s->quant_tables[0][1][i]= 11*quant9_10bit[i];
- s->quant_tables[0][2][i]= 11*11*quant9_10bit[i];
- s->quant_tables[1][0][i]= quant9_10bit[i];
- s->quant_tables[1][1][i]= 11*quant9_10bit[i];
- s->quant_tables[1][2][i]= 11*11*quant5_10bit[i];
- s->quant_tables[1][3][i]= 5*11*11*quant5_10bit[i];
- s->quant_tables[1][4][i]= 5*5*11*11*quant5_10bit[i];
- }
- }
- s->context_count[0]= (11*11*11+1)/2;
- s->context_count[1]= (11*11*5*5*5+1)/2;
- memcpy(s->quant_table, s->quant_tables[avctx->context_model], sizeof(s->quant_table));
-
- for(i=0; i<s->plane_count; i++){
- PlaneContext * const p= &s->plane[i];
-
- memcpy(p->quant_table, s->quant_table, sizeof(p->quant_table));
- p->quant_table_index= avctx->context_model;
- p->context_count= s->context_count[p->quant_table_index];
- }
-
- if(allocate_initial_states(s) < 0)
- return AVERROR(ENOMEM);
-
- avctx->coded_frame= &s->picture;
- switch(avctx->pix_fmt){
- case PIX_FMT_YUV444P16:
- case PIX_FMT_YUV422P16:
- case PIX_FMT_YUV420P16:
- if(avctx->bits_per_raw_sample <=8){
- av_log(avctx, AV_LOG_ERROR, "bits_per_raw_sample invalid\n");
- return -1;
- }
- if(!s->ac){
- av_log(avctx, AV_LOG_ERROR, "bits_per_raw_sample of more than 8 needs -coder 1 currently\n");
- return -1;
- }
- s->version= FFMAX(s->version, 1);
- case PIX_FMT_YUV444P:
- case PIX_FMT_YUV422P:
- case PIX_FMT_YUV420P:
- case PIX_FMT_YUV411P:
- case PIX_FMT_YUV410P:
- s->colorspace= 0;
- break;
- case PIX_FMT_RGB32:
- s->colorspace= 1;
- break;
- default:
- av_log(avctx, AV_LOG_ERROR, "format not supported\n");
- return -1;
- }
- avcodec_get_chroma_sub_sample(avctx->pix_fmt, &s->chroma_h_shift, &s->chroma_v_shift);
-
- s->picture_number=0;
-
- if(avctx->flags & (CODEC_FLAG_PASS1|CODEC_FLAG_PASS2)){
- for(i=0; i<s->quant_table_count; i++){
- s->rc_stat2[i]= av_mallocz(s->context_count[i]*sizeof(*s->rc_stat2[i]));
- if(!s->rc_stat2[i])
- return AVERROR(ENOMEM);
- }
- }
- if(avctx->stats_in){
- char *p= avctx->stats_in;
- uint8_t best_state[256][256];
- int gob_count=0;
- char *next;
-
- av_assert0(s->version>=2);
-
- for(;;){
- for(j=0; j<256; j++){
- for(i=0; i<2; i++){
- s->rc_stat[j][i]= strtol(p, &next, 0);
- if(next==p){
- av_log(avctx, AV_LOG_ERROR, "2Pass file invalid at %d %d [%s]\n", j,i,p);
- return -1;
- }
- p=next;
- }
- }
- for(i=0; i<s->quant_table_count; i++){
- for(j=0; j<s->context_count[i]; j++){
- for(k=0; k<32; k++){
- for(m=0; m<2; m++){
- s->rc_stat2[i][j][k][m]= strtol(p, &next, 0);
- if(next==p){
- av_log(avctx, AV_LOG_ERROR, "2Pass file invalid at %d %d %d %d [%s]\n", i,j,k,m,p);
- return -1;
- }
- p=next;
- }
- }
- }
- }
- gob_count= strtol(p, &next, 0);
- if(next==p || gob_count <0){
- av_log(avctx, AV_LOG_ERROR, "2Pass file invalid\n");
- return -1;
- }
- p=next;
- while(*p=='\n' || *p==' ') p++;
- if(p[0]==0) break;
- }
- sort_stt(s, s->state_transition);
-
- find_best_state(best_state, s->state_transition);
-
- for(i=0; i<s->quant_table_count; i++){
- for(j=0; j<s->context_count[i]; j++){
- for(k=0; k<32; k++){
- double p= 128;
- if(s->rc_stat2[i][j][k][0]+s->rc_stat2[i][j][k][1]){
- p=256.0*s->rc_stat2[i][j][k][1] / (s->rc_stat2[i][j][k][0]+s->rc_stat2[i][j][k][1]);
- }
- s->initial_states[i][j][k]= best_state[av_clip(round(p), 1, 255)][av_clip((s->rc_stat2[i][j][k][0]+s->rc_stat2[i][j][k][1])/gob_count, 0, 255)];
- }
- }
- }
- }
-
- if(s->version>1){
- s->num_h_slices=2;
- s->num_v_slices=2;
- write_extra_header(s);
- }
-
- if(init_slice_contexts(s) < 0)
- return -1;
- if(init_slice_state(s) < 0)
- return -1;
-
-#define STATS_OUT_SIZE 1024*1024*6
- if(avctx->flags & CODEC_FLAG_PASS1){
- avctx->stats_out= av_mallocz(STATS_OUT_SIZE);
- for(i=0; i<s->quant_table_count; i++){
- for(j=0; j<s->slice_count; j++){
- FFV1Context *sf= s->slice_context[j];
- av_assert0(!sf->rc_stat2[i]);
- sf->rc_stat2[i]= av_mallocz(s->context_count[i]*sizeof(*sf->rc_stat2[i]));
- if(!sf->rc_stat2[i])
- return AVERROR(ENOMEM);
- }
- }
- }
-
- return 0;
-}
-#endif /* CONFIG_FFV1_ENCODER */
-
-
-static void clear_state(FFV1Context *f){
- int i, si, j;
+ int i, j;
- for(si=0; si<f->slice_count; si++){
- FFV1Context *fs= f->slice_context[si];
- for(i=0; i<f->plane_count; i++){
- PlaneContext *p= &fs->plane[i];
+ for (i = 0; i < f->plane_count; i++) {
+ PlaneContext *p = &fs->plane[i];
- p->interlace_bit_state[0]= 128;
- p->interlace_bit_state[1]= 128;
+ p->interlace_bit_state[0] = 128;
+ p->interlace_bit_state[1] = 128;
- if(fs->ac){
- if(f->initial_states[p->quant_table_index]){
- memcpy(p->state, f->initial_states[p->quant_table_index], CONTEXT_SIZE*p->context_count);
- }else
- memset(p->state, 128, CONTEXT_SIZE*p->context_count);
- }else{
- for(j=0; j<p->context_count; j++){
- p->vlc_state[j].drift= 0;
- p->vlc_state[j].error_sum= 4; //FFMAX((RANGE + 32)/64, 2);
- p->vlc_state[j].bias= 0;
- p->vlc_state[j].count= 1;
- }
+ if (fs->ac) {
+ if (f->initial_states[p->quant_table_index]) {
+ memcpy(p->state, f->initial_states[p->quant_table_index],
+ CONTEXT_SIZE * p->context_count);
+ } else
+ memset(p->state, 128, CONTEXT_SIZE * p->context_count);
+ } else {
+ for (j = 0; j < p->context_count; j++) {
+ p->vlc_state[j].drift = 0;
+ p->vlc_state[j].error_sum = 4; //FFMAX((RANGE + 32)/64, 2);
+ p->vlc_state[j].bias = 0;
+ p->vlc_state[j].count = 1;
}
}
}
}
-#if CONFIG_FFV1_ENCODER
-static int encode_slice(AVCodecContext *c, void *arg){
- FFV1Context *fs= *(void**)arg;
- FFV1Context *f= fs->avctx->priv_data;
- int width = fs->slice_width;
- int height= fs->slice_height;
- int x= fs->slice_x;
- int y= fs->slice_y;
- AVFrame * const p= &f->picture;
-
- if(f->colorspace==0){
- const int chroma_width = -((-width )>>f->chroma_h_shift);
- const int chroma_height= -((-height)>>f->chroma_v_shift);
- const int cx= x>>f->chroma_h_shift;
- const int cy= y>>f->chroma_v_shift;
-
- encode_plane(fs, p->data[0] + x + y*p->linesize[0], width, height, p->linesize[0], 0);
-
- encode_plane(fs, p->data[1] + cx+cy*p->linesize[1], chroma_width, chroma_height, p->linesize[1], 1);
- encode_plane(fs, p->data[2] + cx+cy*p->linesize[2], chroma_width, chroma_height, p->linesize[2], 1);
- }else{
- encode_rgb_frame(fs, (uint32_t*)(p->data[0]) + x + y*(p->linesize[0]/4), width, height, p->linesize[0]/4);
- }
- emms_c();
-
- return 0;
-}
-
-static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size, void *data){
- FFV1Context *f = avctx->priv_data;
- RangeCoder * const c= &f->slice_context[0]->c;
- AVFrame *pict = data;
- AVFrame * const p= &f->picture;
- int used_count= 0;
- uint8_t keystate=128;
- uint8_t *buf_p;
- int i;
-
- ff_init_range_encoder(c, buf, buf_size);
- ff_build_rac_states(c, 0.05*(1LL<<32), 256-8);
-
- *p = *pict;
- p->pict_type= AV_PICTURE_TYPE_I;
-
- if(avctx->gop_size==0 || f->picture_number % avctx->gop_size == 0){
- put_rac(c, &keystate, 1);
- p->key_frame= 1;
- f->gob_count++;
- write_header(f);
- clear_state(f);
- }else{
- put_rac(c, &keystate, 0);
- p->key_frame= 0;
- }
-
- if(!f->ac){
- used_count += ff_rac_terminate(c);
-//printf("pos=%d\n", used_count);
- init_put_bits(&f->slice_context[0]->pb, buf + used_count, buf_size - used_count);
- }else if (f->ac>1){
- int i;
- for(i=1; i<256; i++){
- c->one_state[i]= f->state_transition[i];
- c->zero_state[256-i]= 256-c->one_state[i];
- }
- }
-
- for(i=1; i<f->slice_count; i++){
- FFV1Context *fs= f->slice_context[i];
- uint8_t *start= buf + (buf_size-used_count)*i/f->slice_count;
- int len= buf_size/f->slice_count;
-
- if(fs->ac){
- ff_init_range_encoder(&fs->c, start, len);
- }else{
- init_put_bits(&fs->pb, start, len);
- }
- }
- avctx->execute(avctx, encode_slice, &f->slice_context[0], NULL, f->slice_count, sizeof(void*));
-
- buf_p=buf;
- for(i=0; i<f->slice_count; i++){
- FFV1Context *fs= f->slice_context[i];
- int bytes;
-
- if(fs->ac){
- uint8_t state=128;
- put_rac(&fs->c, &state, 0);
- bytes= ff_rac_terminate(&fs->c);
- }else{
- flush_put_bits(&fs->pb); //nicer padding FIXME
- bytes= used_count + (put_bits_count(&fs->pb)+7)/8;
- used_count= 0;
- }
- if(i>0){
- av_assert0(bytes < buf_size/f->slice_count);
- memmove(buf_p, fs->ac ? fs->c.bytestream_start : fs->pb.buf, bytes);
- av_assert0(bytes < (1<<24));
- AV_WB24(buf_p+bytes, bytes);
- bytes+=3;
- }
- buf_p += bytes;
- }
-
- if((avctx->flags&CODEC_FLAG_PASS1) && (f->picture_number&31)==0){
- int j, k, m;
- char *p= avctx->stats_out;
- char *end= p + STATS_OUT_SIZE;
-
- memset(f->rc_stat, 0, sizeof(f->rc_stat));
- for(i=0; i<f->quant_table_count; i++)
- memset(f->rc_stat2[i], 0, f->context_count[i]*sizeof(*f->rc_stat2[i]));
-
- for(j=0; j<f->slice_count; j++){
- FFV1Context *fs= f->slice_context[j];
- for(i=0; i<256; i++){
- f->rc_stat[i][0] += fs->rc_stat[i][0];
- f->rc_stat[i][1] += fs->rc_stat[i][1];
- }
- for(i=0; i<f->quant_table_count; i++){
- for(k=0; k<f->context_count[i]; k++){
- for(m=0; m<32; m++){
- f->rc_stat2[i][k][m][0] += fs->rc_stat2[i][k][m][0];
- f->rc_stat2[i][k][m][1] += fs->rc_stat2[i][k][m][1];
- }
- }
- }
- }
-
- for(j=0; j<256; j++){
- snprintf(p, end-p, "%"PRIu64" %"PRIu64" ", f->rc_stat[j][0], f->rc_stat[j][1]);
- p+= strlen(p);
- }
- snprintf(p, end-p, "\n");
-
- for(i=0; i<f->quant_table_count; i++){
- for(j=0; j<f->context_count[i]; j++){
- for(m=0; m<32; m++){
- snprintf(p, end-p, "%"PRIu64" %"PRIu64" ", f->rc_stat2[i][j][m][0], f->rc_stat2[i][j][m][1]);
- p+= strlen(p);
- }
- }
- }
- snprintf(p, end-p, "%d\n", f->gob_count);
- } else if(avctx->flags&CODEC_FLAG_PASS1)
- avctx->stats_out[0] = '\0';
-
- f->picture_number++;
- return buf_p-buf;
-}
-#endif /* CONFIG_FFV1_ENCODER */
-
-static av_cold int common_end(AVCodecContext *avctx){
+av_cold int ffv1_close(AVCodecContext *avctx)
+{
FFV1Context *s = avctx->priv_data;
int i, j;
if (avctx->codec->decode && s->picture.data[0])
avctx->release_buffer(avctx, &s->picture);
+ if (avctx->codec->decode && s->last_picture.data[0])
+ avctx->release_buffer(avctx, &s->last_picture);
- for(j=0; j<s->slice_count; j++){
- FFV1Context *fs= s->slice_context[j];
- for(i=0; i<s->plane_count; i++){
- PlaneContext *p= &fs->plane[i];
+ for (j = 0; j < s->slice_count; j++) {
+ FFV1Context *fs = s->slice_context[j];
+ for (i = 0; i < s->plane_count; i++) {
+ PlaneContext *p = &fs->plane[i];
av_freep(&p->state);
av_freep(&p->vlc_state);
@@ -1223,529 +284,17 @@ static av_cold int common_end(AVCodecContext *avctx){
}
av_freep(&avctx->stats_out);
- for(j=0; j<s->quant_table_count; j++){
+ for (j = 0; j < s->quant_table_count; j++) {
av_freep(&s->initial_states[j]);
- for(i=0; i<s->slice_count; i++){
- FFV1Context *sf= s->slice_context[i];
+ for (i = 0; i < s->slice_count; i++) {
+ FFV1Context *sf = s->slice_context[i];
av_freep(&sf->rc_stat2[j]);
}
av_freep(&s->rc_stat2[j]);
}
- for(i=0; i<s->slice_count; i++){
+ for (i = 0; i < s->slice_count; i++)
av_freep(&s->slice_context[i]);
- }
return 0;
}
-
-static av_always_inline void decode_line(FFV1Context *s, int w,
- int16_t *sample[2],
- int plane_index, int bits)
-{
- PlaneContext * const p= &s->plane[plane_index];
- RangeCoder * const c= &s->c;
- int x;
- int run_count=0;
- int run_mode=0;
- int run_index= s->run_index;
-
- for(x=0; x<w; x++){
- int diff, context, sign;
-
- context= get_context(p, sample[1] + x, sample[0] + x, sample[1] + x);
- if(context < 0){
- context= -context;
- sign=1;
- }else
- sign=0;
-
- av_assert2(context < p->context_count);
-
- if(s->ac){
- diff= get_symbol_inline(c, p->state[context], 1);
- }else{
- if(context == 0 && run_mode==0) run_mode=1;
-
- if(run_mode){
- if(run_count==0 && run_mode==1){
- if(get_bits1(&s->gb)){
- run_count = 1<<ff_log2_run[run_index];
- if(x + run_count <= w) run_index++;
- }else{
- if(ff_log2_run[run_index]) run_count = get_bits(&s->gb, ff_log2_run[run_index]);
- else run_count=0;
- if(run_index) run_index--;
- run_mode=2;
- }
- }
- run_count--;
- if(run_count < 0){
- run_mode=0;
- run_count=0;
- diff= get_vlc_symbol(&s->gb, &p->vlc_state[context], bits);
- if(diff>=0) diff++;
- }else
- diff=0;
- }else
- diff= get_vlc_symbol(&s->gb, &p->vlc_state[context], bits);
-
-// printf("count:%d index:%d, mode:%d, x:%d y:%d pos:%d\n", run_count, run_index, run_mode, x, y, get_bits_count(&s->gb));
- }
-
- if(sign) diff= -diff;
-
- sample[1][x]= (predict(sample[1] + x, sample[0] + x) + diff) & ((1<<bits)-1);
- }
- s->run_index= run_index;
-}
-
-static void decode_plane(FFV1Context *s, uint8_t *src, int w, int h, int stride, int plane_index){
- int x, y;
- int16_t *sample[2];
- sample[0]=s->sample_buffer +3;
- sample[1]=s->sample_buffer+w+6+3;
-
- s->run_index=0;
-
- memset(s->sample_buffer, 0, 2*(w+6)*sizeof(*s->sample_buffer));
-
- for(y=0; y<h; y++){
- int16_t *temp = sample[0]; //FIXME try a normal buffer
-
- sample[0]= sample[1];
- sample[1]= temp;
-
- sample[1][-1]= sample[0][0 ];
- sample[0][ w]= sample[0][w-1];
-
-//{START_TIMER
- if(s->avctx->bits_per_raw_sample <= 8){
- decode_line(s, w, sample, plane_index, 8);
- for(x=0; x<w; x++){
- src[x + stride*y]= sample[1][x];
- }
- }else{
- decode_line(s, w, sample, plane_index, s->avctx->bits_per_raw_sample);
- for(x=0; x<w; x++){
- ((uint16_t*)(src + stride*y))[x]= sample[1][x] << (16 - s->avctx->bits_per_raw_sample);
- }
- }
-//STOP_TIMER("decode-line")}
- }
-}
-
-static void decode_rgb_frame(FFV1Context *s, uint32_t *src, int w, int h, int stride){
- int x, y, p;
- int16_t *sample[3][2];
- for(x=0; x<3; x++){
- sample[x][0] = s->sample_buffer + x*2 *(w+6) + 3;
- sample[x][1] = s->sample_buffer + (x*2+1)*(w+6) + 3;
- }
-
- s->run_index=0;
-
- memset(s->sample_buffer, 0, 6*(w+6)*sizeof(*s->sample_buffer));
-
- for(y=0; y<h; y++){
- for(p=0; p<3; p++){
- int16_t *temp = sample[p][0]; //FIXME try a normal buffer
-
- sample[p][0]= sample[p][1];
- sample[p][1]= temp;
-
- sample[p][1][-1]= sample[p][0][0 ];
- sample[p][0][ w]= sample[p][0][w-1];
- decode_line(s, w, sample[p], FFMIN(p, 1), 9);
- }
- for(x=0; x<w; x++){
- int g= sample[0][1][x];
- int b= sample[1][1][x];
- int r= sample[2][1][x];
-
-// assert(g>=0 && b>=0 && r>=0);
-// assert(g<256 && b<512 && r<512);
-
- b -= 0x100;
- r -= 0x100;
- g -= (b + r)>>2;
- b += g;
- r += g;
-
- src[x + stride*y]= b + (g<<8) + (r<<16) + (0xFF<<24);
- }
- }
-}
-
-static int decode_slice(AVCodecContext *c, void *arg){
- FFV1Context *fs= *(void**)arg;
- FFV1Context *f= fs->avctx->priv_data;
- int width = fs->slice_width;
- int height= fs->slice_height;
- int x= fs->slice_x;
- int y= fs->slice_y;
- AVFrame * const p= &f->picture;
-
- av_assert1(width && height);
- if(f->colorspace==0){
- const int chroma_width = -((-width )>>f->chroma_h_shift);
- const int chroma_height= -((-height)>>f->chroma_v_shift);
- const int cx= x>>f->chroma_h_shift;
- const int cy= y>>f->chroma_v_shift;
- decode_plane(fs, p->data[0] + x + y*p->linesize[0], width, height, p->linesize[0], 0);
-
- decode_plane(fs, p->data[1] + cx+cy*p->linesize[1], chroma_width, chroma_height, p->linesize[1], 1);
- decode_plane(fs, p->data[2] + cx+cy*p->linesize[1], chroma_width, chroma_height, p->linesize[2], 1);
- }else{
- decode_rgb_frame(fs, (uint32_t*)p->data[0] + x + y*(p->linesize[0]/4), width, height, p->linesize[0]/4);
- }
-
- emms_c();
-
- return 0;
-}
-
-static int read_quant_table(RangeCoder *c, int16_t *quant_table, int scale){
- int v;
- int i=0;
- uint8_t state[CONTEXT_SIZE];
-
- memset(state, 128, sizeof(state));
-
- for(v=0; i<128 ; v++){
- int len= get_symbol(c, state, 0) + 1;
-
- if(len + i > 128) return -1;
-
- while(len--){
- quant_table[i] = scale*v;
- i++;
-//printf("%2d ",v);
-//if(i%16==0) printf("\n");
- }
- }
-
- for(i=1; i<128; i++){
- quant_table[256-i]= -quant_table[i];
- }
- quant_table[128]= -quant_table[127];
-
- return 2*v - 1;
-}
-
-static int read_quant_tables(RangeCoder *c, int16_t quant_table[MAX_CONTEXT_INPUTS][256]){
- int i;
- int context_count=1;
-
- for(i=0; i<5; i++){
- context_count*= read_quant_table(c, quant_table[i], context_count);
- if(context_count > 32768U){
- return -1;
- }
- }
- return (context_count+1)/2;
-}
-
-static int read_extra_header(FFV1Context *f){
- RangeCoder * const c= &f->c;
- uint8_t state[CONTEXT_SIZE];
- int i, j, k;
- uint8_t state2[32][CONTEXT_SIZE];
-
- memset(state2, 128, sizeof(state2));
- memset(state, 128, sizeof(state));
-
- ff_init_range_decoder(c, f->avctx->extradata, f->avctx->extradata_size);
- ff_build_rac_states(c, 0.05*(1LL<<32), 256-8);
-
- f->version= get_symbol(c, state, 0);
- f->ac= f->avctx->coder_type= get_symbol(c, state, 0);
- if(f->ac>1){
- for(i=1; i<256; i++){
- f->state_transition[i]= get_symbol(c, state, 1) + c->one_state[i];
- }
- }
- f->colorspace= get_symbol(c, state, 0); //YUV cs type
- f->avctx->bits_per_raw_sample= get_symbol(c, state, 0);
- get_rac(c, state); //no chroma = false
- f->chroma_h_shift= get_symbol(c, state, 0);
- f->chroma_v_shift= get_symbol(c, state, 0);
- get_rac(c, state); //transparency plane
- f->plane_count= 2;
- f->num_h_slices= 1 + get_symbol(c, state, 0);
- f->num_v_slices= 1 + get_symbol(c, state, 0);
- if(f->num_h_slices > (unsigned)f->width || f->num_v_slices > (unsigned)f->height){
- av_log(f->avctx, AV_LOG_ERROR, "too many slices\n");
- return -1;
- }
-
- f->quant_table_count= get_symbol(c, state, 0);
- if(f->quant_table_count > (unsigned)MAX_QUANT_TABLES)
- return -1;
- for(i=0; i<f->quant_table_count; i++){
- if((f->context_count[i]= read_quant_tables(c, f->quant_tables[i])) < 0){
- av_log(f->avctx, AV_LOG_ERROR, "read_quant_table error\n");
- return -1;
- }
- }
-
- if(allocate_initial_states(f) < 0)
- return AVERROR(ENOMEM);
-
- for(i=0; i<f->quant_table_count; i++){
- if(get_rac(c, state)){
- for(j=0; j<f->context_count[i]; j++){
- for(k=0; k<CONTEXT_SIZE; k++){
- int pred= j ? f->initial_states[i][j-1][k] : 128;
- f->initial_states[i][j][k]= (pred+get_symbol(c, state2[k], 1))&0xFF;
- }
- }
- }
- }
-
- return 0;
-}
-
-static int read_header(FFV1Context *f){
- uint8_t state[CONTEXT_SIZE];
- int i, j, context_count;
- RangeCoder * const c= &f->slice_context[0]->c;
-
- memset(state, 128, sizeof(state));
-
- if(f->version < 2){
- f->version= get_symbol(c, state, 0);
- f->ac= f->avctx->coder_type= get_symbol(c, state, 0);
- if(f->ac>1){
- for(i=1; i<256; i++){
- f->state_transition[i]= get_symbol(c, state, 1) + c->one_state[i];
- }
- }
- f->colorspace= get_symbol(c, state, 0); //YUV cs type
- if(f->version>0)
- f->avctx->bits_per_raw_sample= get_symbol(c, state, 0);
- get_rac(c, state); //no chroma = false
- f->chroma_h_shift= get_symbol(c, state, 0);
- f->chroma_v_shift= get_symbol(c, state, 0);
- get_rac(c, state); //transparency plane
- f->plane_count= 2;
- }
-
- if(f->colorspace==0){
- if(f->avctx->bits_per_raw_sample<=8){
- switch(16*f->chroma_h_shift + f->chroma_v_shift){
- case 0x00: f->avctx->pix_fmt= PIX_FMT_YUV444P; break;
- case 0x10: f->avctx->pix_fmt= PIX_FMT_YUV422P; break;
- case 0x11: f->avctx->pix_fmt= PIX_FMT_YUV420P; break;
- case 0x20: f->avctx->pix_fmt= PIX_FMT_YUV411P; break;
- case 0x22: f->avctx->pix_fmt= PIX_FMT_YUV410P; break;
- default:
- av_log(f->avctx, AV_LOG_ERROR, "format not supported\n");
- return -1;
- }
- }else{
- switch(16*f->chroma_h_shift + f->chroma_v_shift){
- case 0x00: f->avctx->pix_fmt= PIX_FMT_YUV444P16; break;
- case 0x10: f->avctx->pix_fmt= PIX_FMT_YUV422P16; break;
- case 0x11: f->avctx->pix_fmt= PIX_FMT_YUV420P16; break;
- default:
- av_log(f->avctx, AV_LOG_ERROR, "format not supported\n");
- return -1;
- }
- }
- }else if(f->colorspace==1){
- if(f->chroma_h_shift || f->chroma_v_shift){
- av_log(f->avctx, AV_LOG_ERROR, "chroma subsampling not supported in this colorspace\n");
- return -1;
- }
- f->avctx->pix_fmt= PIX_FMT_RGB32;
- }else{
- av_log(f->avctx, AV_LOG_ERROR, "colorspace not supported\n");
- return -1;
- }
-
-//printf("%d %d %d\n", f->chroma_h_shift, f->chroma_v_shift,f->avctx->pix_fmt);
- if(f->version < 2){
- context_count= read_quant_tables(c, f->quant_table);
- if(context_count < 0){
- av_log(f->avctx, AV_LOG_ERROR, "read_quant_table error\n");
- return -1;
- }
- }else{
- f->slice_count= get_symbol(c, state, 0);
- if(f->slice_count > (unsigned)MAX_SLICES)
- return -1;
- }
-
- for(j=0; j<f->slice_count; j++){
- FFV1Context *fs= f->slice_context[j];
- fs->ac= f->ac;
-
- if(f->version >= 2){
- fs->slice_x = get_symbol(c, state, 0) *f->width ;
- fs->slice_y = get_symbol(c, state, 0) *f->height;
- fs->slice_width =(get_symbol(c, state, 0)+1)*f->width + fs->slice_x;
- fs->slice_height=(get_symbol(c, state, 0)+1)*f->height + fs->slice_y;
-
- fs->slice_x /= f->num_h_slices;
- fs->slice_y /= f->num_v_slices;
- fs->slice_width = fs->slice_width /f->num_h_slices - fs->slice_x;
- fs->slice_height = fs->slice_height/f->num_v_slices - fs->slice_y;
- if((unsigned)fs->slice_width > f->width || (unsigned)fs->slice_height > f->height)
- return -1;
- if( (unsigned)fs->slice_x + (uint64_t)fs->slice_width > f->width
- || (unsigned)fs->slice_y + (uint64_t)fs->slice_height > f->height)
- return -1;
- }
-
- for(i=0; i<f->plane_count; i++){
- PlaneContext * const p= &fs->plane[i];
-
- if(f->version >= 2){
- int idx=get_symbol(c, state, 0);
- if(idx > (unsigned)f->quant_table_count){
- av_log(f->avctx, AV_LOG_ERROR, "quant_table_index out of range\n");
- return -1;
- }
- p->quant_table_index= idx;
- memcpy(p->quant_table, f->quant_tables[idx], sizeof(p->quant_table));
- context_count= f->context_count[idx];
- }else{
- memcpy(p->quant_table, f->quant_table, sizeof(p->quant_table));
- }
-
- if(p->context_count < context_count){
- av_freep(&p->state);
- av_freep(&p->vlc_state);
- }
- p->context_count= context_count;
- }
- }
-
- return 0;
-}
-
-static av_cold int decode_init(AVCodecContext *avctx)
-{
- FFV1Context *f = avctx->priv_data;
-
- common_init(avctx);
-
- if(avctx->extradata && read_extra_header(f) < 0)
- return -1;
-
- if(init_slice_contexts(f) < 0)
- return -1;
-
- return 0;
-}
-
-static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt){
- const uint8_t *buf = avpkt->data;
- int buf_size = avpkt->size;
- FFV1Context *f = avctx->priv_data;
- RangeCoder * const c= &f->slice_context[0]->c;
- AVFrame * const p= &f->picture;
- int bytes_read, i;
- uint8_t keystate= 128;
- const uint8_t *buf_p;
-
- AVFrame *picture = data;
-
- /* release previously stored data */
- if (p->data[0])
- avctx->release_buffer(avctx, p);
-
- ff_init_range_decoder(c, buf, buf_size);
- ff_build_rac_states(c, 0.05*(1LL<<32), 256-8);
-
-
- p->pict_type= AV_PICTURE_TYPE_I; //FIXME I vs. P
- if(get_rac(c, &keystate)){
- p->key_frame= 1;
- if(read_header(f) < 0)
- return -1;
- if(init_slice_state(f) < 0)
- return -1;
-
- clear_state(f);
- }else{
- p->key_frame= 0;
- }
- if(f->ac>1){
- int i;
- for(i=1; i<256; i++){
- c->one_state[i]= f->state_transition[i];
- c->zero_state[256-i]= 256-c->one_state[i];
- }
- }
-
- p->reference= 0;
- if(avctx->get_buffer(avctx, p) < 0){
- av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
- return -1;
- }
-
- if(avctx->debug&FF_DEBUG_PICT_INFO)
- av_log(avctx, AV_LOG_ERROR, "keyframe:%d coder:%d\n", p->key_frame, f->ac);
-
- if(!f->ac){
- bytes_read = c->bytestream - c->bytestream_start - 1;
- if(bytes_read ==0) av_log(avctx, AV_LOG_ERROR, "error at end of AC stream\n"); //FIXME
-//printf("pos=%d\n", bytes_read);
- init_get_bits(&f->slice_context[0]->gb, buf + bytes_read, (buf_size - bytes_read) * 8);
- } else {
- bytes_read = 0; /* avoid warning */
- }
-
- buf_p= buf + buf_size;
- for(i=f->slice_count-1; i>0; i--){
- FFV1Context *fs= f->slice_context[i];
- int v= AV_RB24(buf_p-3)+3;
- if(buf_p - buf <= v){
- av_log(avctx, AV_LOG_ERROR, "Slice pointer chain broken\n");
- return -1;
- }
- buf_p -= v;
- if(fs->ac){
- ff_init_range_decoder(&fs->c, buf_p, v);
- }else{
- init_get_bits(&fs->gb, buf_p, v * 8);
- }
- }
-
- avctx->execute(avctx, decode_slice, &f->slice_context[0], NULL, f->slice_count, sizeof(void*));
- f->picture_number++;
-
- *picture= *p;
- *data_size = sizeof(AVFrame);
-
- return buf_size;
-}
-
-AVCodec ff_ffv1_decoder = {
- .name = "ffv1",
- .type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_FFV1,
- .priv_data_size = sizeof(FFV1Context),
- .init = decode_init,
- .close = common_end,
- .decode = decode_frame,
- .capabilities = CODEC_CAP_DR1 /*| CODEC_CAP_DRAW_HORIZ_BAND*/ | CODEC_CAP_SLICE_THREADS,
- .long_name= NULL_IF_CONFIG_SMALL("FFmpeg video codec #1"),
-};
-
-#if CONFIG_FFV1_ENCODER
-AVCodec ff_ffv1_encoder = {
- .name = "ffv1",
- .type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_FFV1,
- .priv_data_size = sizeof(FFV1Context),
- .init = encode_init,
- .encode = encode_frame,
- .close = common_end,
- .capabilities = CODEC_CAP_SLICE_THREADS,
- .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_YUV444P, PIX_FMT_YUV422P, PIX_FMT_YUV411P, PIX_FMT_YUV410P, PIX_FMT_RGB32, PIX_FMT_YUV420P16, PIX_FMT_YUV422P16, PIX_FMT_YUV444P16, PIX_FMT_NONE},
- .long_name= NULL_IF_CONFIG_SMALL("FFmpeg video codec #1"),
-};
-#endif
diff --git a/gst-libs/ext/libav/libavcodec/ffv1.h b/gst-libs/ext/libav/libavcodec/ffv1.h
new file mode 100644
index 0000000..4752cea
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/ffv1.h
@@ -0,0 +1,203 @@
+/*
+ * FFV1 codec for libavcodec
+ *
+ * Copyright (c) 2003-2012 Michael Niedermayer <michaelni@gmx.at>
+ *
+ * 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
+ */
+
+#ifndef AVCODEC_FFV1_H
+#define AVCODEC_FFV1_H
+
+#include <stdint.h>
+
+#include "avcodec.h"
+#include "dsputil.h"
+#include "get_bits.h"
+#include "put_bits.h"
+#include "rangecoder.h"
+
+#define MAX_PLANES 4
+#define CONTEXT_SIZE 32
+
+#define MAX_QUANT_TABLES 8
+#define MAX_CONTEXT_INPUTS 5
+
+extern const uint8_t ff_log2_run[41];
+
+extern const int8_t ffv1_quant5_10bit[256];
+extern const int8_t ffv1_quant5[256];
+extern const int8_t ffv1_quant9_10bit[256];
+extern const int8_t ffv1_quant11[256];
+extern const uint8_t ffv1_ver2_state[256];
+
+typedef struct VlcState {
+ int16_t drift;
+ uint16_t error_sum;
+ int8_t bias;
+ uint8_t count;
+} VlcState;
+
+typedef struct PlaneContext {
+ int16_t quant_table[MAX_CONTEXT_INPUTS][256];
+ int quant_table_index;
+ int context_count;
+ uint8_t (*state)[CONTEXT_SIZE];
+ VlcState *vlc_state;
+ uint8_t interlace_bit_state[2];
+} PlaneContext;
+
+#define MAX_SLICES 256
+
+typedef struct FFV1Context {
+ AVClass *class;
+ AVCodecContext *avctx;
+ RangeCoder c;
+ GetBitContext gb;
+ PutBitContext pb;
+ uint64_t rc_stat[256][2];
+ uint64_t (*rc_stat2[MAX_QUANT_TABLES])[32][2];
+ int version;
+ int minor_version;
+ int width, height;
+ int chroma_planes;
+ int chroma_h_shift, chroma_v_shift;
+ int transparency;
+ int flags;
+ int picture_number;
+ AVFrame picture, last_picture;
+ int plane_count;
+ int ac; // 1 = range coder <-> 0 = golomb rice
+ int ac_byte_count; // number of bytes used for AC coding
+ PlaneContext plane[MAX_PLANES];
+ int16_t quant_table[MAX_CONTEXT_INPUTS][256];
+ int16_t quant_tables[MAX_QUANT_TABLES][MAX_CONTEXT_INPUTS][256];
+ int context_count[MAX_QUANT_TABLES];
+ uint8_t state_transition[256];
+ uint8_t (*initial_states[MAX_QUANT_TABLES])[32];
+ int run_index;
+ int colorspace;
+ int16_t *sample_buffer;
+
+ int ec;
+ int slice_damaged;
+ int key_frame_ok;
+
+ int bits_per_raw_sample;
+ int packed_at_lsb;
+
+ int gob_count;
+ int quant_table_count;
+
+ DSPContext dsp;
+
+ struct FFV1Context *slice_context[MAX_SLICES];
+ int slice_count;
+ int num_v_slices;
+ int num_h_slices;
+ int slice_width;
+ int slice_height;
+ int slice_x;
+ int slice_y;
+} FFV1Context;
+
+static av_always_inline int fold(int diff, int bits)
+{
+ if (bits == 8)
+ diff = (int8_t)diff;
+ else {
+ diff += 1 << (bits - 1);
+ diff &= (1 << bits) - 1;
+ diff -= 1 << (bits - 1);
+ }
+
+ return diff;
+}
+
+static inline int predict(int16_t *src, int16_t *last)
+{
+ const int LT = last[-1];
+ const int T = last[0];
+ const int L = src[-1];
+
+ return mid_pred(L, L + T - LT, T);
+}
+
+static inline int get_context(PlaneContext *p, int16_t *src,
+ int16_t *last, int16_t *last2)
+{
+ const int LT = last[-1];
+ const int T = last[0];
+ const int RT = last[1];
+ const int L = src[-1];
+
+ if (p->quant_table[3][127]) {
+ const int TT = last2[0];
+ const int LL = src[-2];
+ return p->quant_table[0][(L - LT) & 0xFF] +
+ p->quant_table[1][(LT - T) & 0xFF] +
+ p->quant_table[2][(T - RT) & 0xFF] +
+ p->quant_table[3][(LL - L) & 0xFF] +
+ p->quant_table[4][(TT - T) & 0xFF];
+ } else
+ return p->quant_table[0][(L - LT) & 0xFF] +
+ p->quant_table[1][(LT - T) & 0xFF] +
+ p->quant_table[2][(T - RT) & 0xFF];
+}
+
+static inline void update_vlc_state(VlcState *const state, const int v)
+{
+ int drift = state->drift;
+ int count = state->count;
+ state->error_sum += FFABS(v);
+ drift += v;
+
+ if (count == 128) { // FIXME: variable
+ count >>= 1;
+ drift >>= 1;
+ state->error_sum >>= 1;
+ }
+ count++;
+
+ if (drift <= -count) {
+ if (state->bias > -128)
+ state->bias--;
+
+ drift += count;
+ if (drift <= -count)
+ drift = -count + 1;
+ } else if (drift > 0) {
+ if (state->bias < 127)
+ state->bias++;
+
+ drift -= count;
+ if (drift > 0)
+ drift = 0;
+ }
+
+ state->drift = drift;
+ state->count = count;
+}
+
+int ffv1_common_init(AVCodecContext *avctx);
+int ffv1_init_slice_state(FFV1Context *f, FFV1Context *fs);
+int ffv1_init_slice_contexts(FFV1Context *f);
+int ffv1_allocate_initial_states(FFV1Context *f);
+void ffv1_clear_slice_state(FFV1Context *f, FFV1Context *fs);
+int ffv1_close(AVCodecContext *avctx);
+
+#endif /* AVCODEC_FFV1_H */
diff --git a/gst-libs/ext/libav/libavcodec/ffv1dec.c b/gst-libs/ext/libav/libavcodec/ffv1dec.c
new file mode 100644
index 0000000..97e2bd5
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/ffv1dec.c
@@ -0,0 +1,922 @@
+/*
+ * FFV1 decoder
+ *
+ * Copyright (c) 2003-2012 Michael Niedermayer <michaelni@gmx.at>
+ *
+ * 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
+ * FF Video Codec 1 (a lossless codec) decoder
+ */
+
+#include "libavutil/avassert.h"
+#include "libavutil/pixdesc.h"
+#include "libavutil/crc.h"
+#include "libavutil/opt.h"
+#include "libavutil/imgutils.h"
+#include "avcodec.h"
+#include "internal.h"
+#include "get_bits.h"
+#include "put_bits.h"
+#include "dsputil.h"
+#include "rangecoder.h"
+#include "golomb.h"
+#include "mathops.h"
+#include "ffv1.h"
+
+static inline av_flatten int get_symbol_inline(RangeCoder *c, uint8_t *state,
+ int is_signed)
+{
+ if (get_rac(c, state + 0))
+ return 0;
+ else {
+ int i, e, a;
+ e = 0;
+ while (get_rac(c, state + 1 + FFMIN(e, 9))) // 1..10
+ e++;
+
+ a = 1;
+ for (i = e - 1; i >= 0; i--)
+ a += a + get_rac(c, state + 22 + FFMIN(i, 9)); // 22..31
+
+ e = -(is_signed && get_rac(c, state + 11 + FFMIN(e, 10))); // 11..21
+ return (a ^ e) - e;
+ }
+}
+
+static av_noinline int get_symbol(RangeCoder *c, uint8_t *state, int is_signed)
+{
+ return get_symbol_inline(c, state, is_signed);
+}
+
+static inline int get_vlc_symbol(GetBitContext *gb, VlcState *const state,
+ int bits)
+{
+ int k, i, v, ret;
+
+ i = state->count;
+ k = 0;
+ while (i < state->error_sum) { // FIXME: optimize
+ k++;
+ i += i;
+ }
+
+ assert(k <= 8);
+
+ v = get_sr_golomb(gb, k, 12, bits);
+ av_dlog(NULL, "v:%d bias:%d error:%d drift:%d count:%d k:%d",
+ v, state->bias, state->error_sum, state->drift, state->count, k);
+
+#if 0 // JPEG LS
+ if (k == 0 && 2 * state->drift <= -state->count)
+ v ^= (-1);
+#else
+ v ^= ((2 * state->drift + state->count) >> 31);
+#endif
+
+ ret = fold(v + state->bias, bits);
+
+ update_vlc_state(state, v);
+
+ return ret;
+}
+
+static av_always_inline void decode_line(FFV1Context *s, int w,
+ int16_t *sample[2],
+ int plane_index, int bits)
+{
+ PlaneContext *const p = &s->plane[plane_index];
+ RangeCoder *const c = &s->c;
+ int x;
+ int run_count = 0;
+ int run_mode = 0;
+ int run_index = s->run_index;
+
+ for (x = 0; x < w; x++) {
+ int diff, context, sign;
+
+ context = get_context(p, sample[1] + x, sample[0] + x, sample[1] + x);
+ if (context < 0) {
+ context = -context;
+ sign = 1;
+ } else
+ sign = 0;
+
+ av_assert2(context < p->context_count);
+
+ if (s->ac) {
+ diff = get_symbol_inline(c, p->state[context], 1);
+ } else {
+ if (context == 0 && run_mode == 0)
+ run_mode = 1;
+
+ if (run_mode) {
+ if (run_count == 0 && run_mode == 1) {
+ if (get_bits1(&s->gb)) {
+ run_count = 1 << ff_log2_run[run_index];
+ if (x + run_count <= w)
+ run_index++;
+ } else {
+ if (ff_log2_run[run_index])
+ run_count = get_bits(&s->gb, ff_log2_run[run_index]);
+ else
+ run_count = 0;
+ if (run_index)
+ run_index--;
+ run_mode = 2;
+ }
+ }
+ run_count--;
+ if (run_count < 0) {
+ run_mode = 0;
+ run_count = 0;
+ diff = get_vlc_symbol(&s->gb, &p->vlc_state[context],
+ bits);
+ if (diff >= 0)
+ diff++;
+ } else
+ diff = 0;
+ } else
+ diff = get_vlc_symbol(&s->gb, &p->vlc_state[context], bits);
+
+ av_dlog(s->avctx, "count:%d index:%d, mode:%d, x:%d pos:%d\n",
+ run_count, run_index, run_mode, x, get_bits_count(&s->gb));
+ }
+
+ if (sign)
+ diff = -diff;
+
+ sample[1][x] = (predict(sample[1] + x, sample[0] + x) + diff) &
+ ((1 << bits) - 1);
+ }
+ s->run_index = run_index;
+}
+
+static void decode_plane(FFV1Context *s, uint8_t *src,
+ int w, int h, int stride, int plane_index)
+{
+ int x, y;
+ int16_t *sample[2];
+ sample[0] = s->sample_buffer + 3;
+ sample[1] = s->sample_buffer + w + 6 + 3;
+
+ s->run_index = 0;
+
+ memset(s->sample_buffer, 0, 2 * (w + 6) * sizeof(*s->sample_buffer));
+
+ for (y = 0; y < h; y++) {
+ int16_t *temp = sample[0]; // FIXME: try a normal buffer
+
+ sample[0] = sample[1];
+ sample[1] = temp;
+
+ sample[1][-1] = sample[0][0];
+ sample[0][w] = sample[0][w - 1];
+
+// { START_TIMER
+ if (s->avctx->bits_per_raw_sample <= 8) {
+ decode_line(s, w, sample, plane_index, 8);
+ for (x = 0; x < w; x++)
+ src[x + stride * y] = sample[1][x];
+ } else {
+ decode_line(s, w, sample, plane_index,
+ s->avctx->bits_per_raw_sample);
+ if (s->packed_at_lsb) {
+ for (x = 0; x < w; x++)
+ ((uint16_t *)(src + stride * y))[x] = sample[1][x];
+ } else {
+ for (x = 0; x < w; x++)
+ ((uint16_t *)(src + stride * y))[x] = sample[1][x] << (16 - s->avctx->bits_per_raw_sample);
+ }
+ }
+// STOP_TIMER("decode-line") }
+ }
+}
+
+static void decode_rgb_frame(FFV1Context *s, uint8_t *src[3], int w, int h,
+ int stride[3])
+{
+ int x, y, p;
+ int16_t *sample[4][2];
+ int lbd = s->avctx->bits_per_raw_sample <= 8;
+ int bits = s->avctx->bits_per_raw_sample > 0
+ ? s->avctx->bits_per_raw_sample
+ : 8;
+ int offset = 1 << bits;
+
+ for (x = 0; x < 4; x++) {
+ sample[x][0] = s->sample_buffer + x * 2 * (w + 6) + 3;
+ sample[x][1] = s->sample_buffer + (x * 2 + 1) * (w + 6) + 3;
+ }
+
+ s->run_index = 0;
+
+ memset(s->sample_buffer, 0, 8 * (w + 6) * sizeof(*s->sample_buffer));
+
+ for (y = 0; y < h; y++) {
+ for (p = 0; p < 3 + s->transparency; p++) {
+ int16_t *temp = sample[p][0]; //FIXME try a normal buffer
+
+ sample[p][0] = sample[p][1];
+ sample[p][1] = temp;
+
+ sample[p][1][-1] = sample[p][0][0];
+ sample[p][0][w] = sample[p][0][w - 1];
+ if (lbd)
+ decode_line(s, w, sample[p], (p + 1) / 2, 9);
+ else
+ decode_line(s, w, sample[p], (p + 1) / 2, bits + 1);
+ }
+ for (x = 0; x < w; x++) {
+ int g = sample[0][1][x];
+ int b = sample[1][1][x];
+ int r = sample[2][1][x];
+ int a = sample[3][1][x];
+
+ b -= offset;
+ r -= offset;
+ g -= (b + r) >> 2;
+ b += g;
+ r += g;
+
+ if (lbd)
+ *((uint32_t *)(src[0] + x * 4 + stride[0] * y)) = b +
+ (g << 8) + (r << 16) + (a << 24);
+ else {
+ *((uint16_t *)(src[0] + x * 2 + stride[0] * y)) = b;
+ *((uint16_t *)(src[1] + x * 2 + stride[1] * y)) = g;
+ *((uint16_t *)(src[2] + x * 2 + stride[2] * y)) = r;
+ }
+ }
+ }
+}
+
+static int decode_slice_header(FFV1Context *f, FFV1Context *fs)
+{
+ RangeCoder *c = &fs->c;
+ uint8_t state[CONTEXT_SIZE];
+ unsigned ps, i, context_count;
+ memset(state, 128, sizeof(state));
+
+ if (fs->ac > 1) {
+ for (i = 1; i < 256; i++) {
+ fs->c.one_state[i] = f->state_transition[i];
+ fs->c.zero_state[256 - i] = 256 - fs->c.one_state[i];
+ }
+ }
+
+ fs->slice_x = get_symbol(c, state, 0) * f->width;
+ fs->slice_y = get_symbol(c, state, 0) * f->height;
+ fs->slice_width = (get_symbol(c, state, 0) + 1) * f->width + fs->slice_x;
+ fs->slice_height = (get_symbol(c, state, 0) + 1) * f->height + fs->slice_y;
+
+ fs->slice_x /= f->num_h_slices;
+ fs->slice_y /= f->num_v_slices;
+ fs->slice_width = fs->slice_width / f->num_h_slices - fs->slice_x;
+ fs->slice_height = fs->slice_height / f->num_v_slices - fs->slice_y;
+ if ((unsigned)fs->slice_width > f->width ||
+ (unsigned)fs->slice_height > f->height)
+ return AVERROR_INVALIDDATA;
+ if ((unsigned)fs->slice_x + (uint64_t)fs->slice_width > f->width ||
+ (unsigned)fs->slice_y + (uint64_t)fs->slice_height > f->height)
+ return AVERROR_INVALIDDATA;
+
+ for (i = 0; i < f->plane_count; i++) {
+ PlaneContext *const p = &fs->plane[i];
+ int idx = get_symbol(c, state, 0);
+ if (idx > (unsigned)f->quant_table_count) {
+ av_log(f->avctx, AV_LOG_ERROR, "quant_table_index out of range\n");
+ return AVERROR_INVALIDDATA;
+ }
+ p->quant_table_index = idx;
+ memcpy(p->quant_table, f->quant_tables[idx], sizeof(p->quant_table));
+ context_count = f->context_count[idx];
+
+ if (p->context_count < context_count) {
+ av_freep(&p->state);
+ av_freep(&p->vlc_state);
+ }
+ p->context_count = context_count;
+ }
+
+ ps = get_symbol(c, state, 0);
+ if (ps == 1) {
+ f->picture.interlaced_frame = 1;
+ f->picture.top_field_first = 1;
+ } else if (ps == 2) {
+ f->picture.interlaced_frame = 1;
+ f->picture.top_field_first = 0;
+ } else if (ps == 3) {
+ f->picture.interlaced_frame = 0;
+ }
+ f->picture.sample_aspect_ratio.num = get_symbol(c, state, 0);
+ f->picture.sample_aspect_ratio.den = get_symbol(c, state, 0);
+
+ return 0;
+}
+
+static int decode_slice(AVCodecContext *c, void *arg)
+{
+ FFV1Context *fs = *(void **)arg;
+ FFV1Context *f = fs->avctx->priv_data;
+ int width, height, x, y, ret;
+ const int ps = (av_pix_fmt_desc_get(c->pix_fmt)->flags & PIX_FMT_PLANAR)
+ ? (c->bits_per_raw_sample > 8) + 1
+ : 4;
+ AVFrame *const p = &f->picture;
+
+ if (f->version > 2) {
+ if (decode_slice_header(f, fs) < 0) {
+ fs->slice_damaged = 1;
+ return AVERROR_INVALIDDATA;
+ }
+ }
+ if ((ret = ffv1_init_slice_state(f, fs)) < 0)
+ return ret;
+ if (f->picture.key_frame)
+ ffv1_clear_slice_state(f, fs);
+ width = fs->slice_width;
+ height = fs->slice_height;
+ x = fs->slice_x;
+ y = fs->slice_y;
+
+ if (!fs->ac) {
+ if (f->version == 3 && f->minor_version > 1 || f->version > 3)
+ get_rac(&fs->c, (uint8_t[]) { 129 });
+ fs->ac_byte_count = f->version > 2 || (!x && !y) ? fs->c.bytestream - fs->c.bytestream_start - 1 : 0;
+ init_get_bits(&fs->gb, fs->c.bytestream_start + fs->ac_byte_count,
+ (fs->c.bytestream_end - fs->c.bytestream_start -
+ fs->ac_byte_count) * 8);
+ }
+
+ av_assert1(width && height);
+ if (f->colorspace == 0) {
+ const int chroma_width = -((-width) >> f->chroma_h_shift);
+ const int chroma_height = -((-height) >> f->chroma_v_shift);
+ const int cx = x >> f->chroma_h_shift;
+ const int cy = y >> f->chroma_v_shift;
+ decode_plane(fs, p->data[0] + ps * x + y * p->linesize[0], width,
+ height, p->linesize[0],
+ 0);
+
+ if (f->chroma_planes) {
+ decode_plane(fs, p->data[1] + ps * cx + cy * p->linesize[1],
+ chroma_width, chroma_height, p->linesize[1],
+ 1);
+ decode_plane(fs, p->data[2] + ps * cx + cy * p->linesize[2],
+ chroma_width, chroma_height, p->linesize[2],
+ 1);
+ }
+ if (fs->transparency)
+ decode_plane(fs, p->data[3] + ps * x + y * p->linesize[3], width,
+ height, p->linesize[3],
+ 2);
+ } else {
+ uint8_t *planes[3] = { p->data[0] + ps * x + y * p->linesize[0],
+ p->data[1] + ps * x + y * p->linesize[1],
+ p->data[2] + ps * x + y * p->linesize[2] };
+ decode_rgb_frame(fs, planes, width, height, p->linesize);
+ }
+ if (fs->ac && f->version > 2) {
+ int v;
+ get_rac(&fs->c, (uint8_t[]) { 129 });
+ v = fs->c.bytestream_end - fs->c.bytestream - 2 - 5 * f->ec;
+ if (v) {
+ av_log(f->avctx, AV_LOG_ERROR, "bytestream end mismatching by %d\n",
+ v);
+ fs->slice_damaged = 1;
+ }
+ }
+
+ emms_c();
+
+ return 0;
+}
+
+static int read_quant_table(RangeCoder *c, int16_t *quant_table, int scale)
+{
+ int v;
+ int i = 0;
+ uint8_t state[CONTEXT_SIZE];
+
+ memset(state, 128, sizeof(state));
+
+ for (v = 0; i < 128; v++) {
+ unsigned len = get_symbol(c, state, 0) + 1;
+
+ if (len > 128 - i)
+ return -1;
+
+ while (len--) {
+ quant_table[i] = scale * v;
+ i++;
+ }
+ }
+
+ for (i = 1; i < 128; i++)
+ quant_table[256 - i] = -quant_table[i];
+ quant_table[128] = -quant_table[127];
+
+ return 2 * v - 1;
+}
+
+static int read_quant_tables(RangeCoder *c,
+ int16_t quant_table[MAX_CONTEXT_INPUTS][256])
+{
+ int i;
+ int context_count = 1;
+
+ for (i = 0; i < 5; i++) {
+ context_count *= read_quant_table(c, quant_table[i], context_count);
+ if (context_count > 32768U) {
+ return -1;
+ }
+ }
+ return (context_count + 1) / 2;
+}
+
+static int read_extra_header(FFV1Context *f)
+{
+ RangeCoder *const c = &f->c;
+ uint8_t state[CONTEXT_SIZE];
+ int i, j, k, ret;
+ uint8_t state2[32][CONTEXT_SIZE];
+
+ memset(state2, 128, sizeof(state2));
+ memset(state, 128, sizeof(state));
+
+ ff_init_range_decoder(c, f->avctx->extradata, f->avctx->extradata_size);
+ ff_build_rac_states(c, 0.05 * (1LL << 32), 256 - 8);
+
+ f->version = get_symbol(c, state, 0);
+ if (f->version > 2) {
+ c->bytestream_end -= 4;
+ f->minor_version = get_symbol(c, state, 0);
+ }
+ f->ac = f->avctx->coder_type = get_symbol(c, state, 0);
+
+ if (f->ac > 1) {
+ for (i = 1; i < 256; i++)
+ f->state_transition[i] = get_symbol(c, state, 1) + c->one_state[i];
+ }
+
+ f->colorspace = get_symbol(c, state, 0); //YUV cs type
+ f->avctx->bits_per_raw_sample = get_symbol(c, state, 0);
+ f->chroma_planes = get_rac(c, state);
+ f->chroma_h_shift = get_symbol(c, state, 0);
+ f->chroma_v_shift = get_symbol(c, state, 0);
+ f->transparency = get_rac(c, state);
+ f->plane_count = 2 + f->transparency;
+ f->num_h_slices = 1 + get_symbol(c, state, 0);
+ f->num_v_slices = 1 + get_symbol(c, state, 0);
+
+ if (f->num_h_slices > (unsigned)f->width ||
+ f->num_v_slices > (unsigned)f->height) {
+ av_log(f->avctx, AV_LOG_ERROR, "too many slices\n");
+ return AVERROR_INVALIDDATA;
+ }
+
+ f->quant_table_count = get_symbol(c, state, 0);
+ if (f->quant_table_count > (unsigned)MAX_QUANT_TABLES)
+ return AVERROR_INVALIDDATA;
+ for (i = 0; i < f->quant_table_count; i++) {
+ f->context_count[i] = read_quant_tables(c, f->quant_tables[i]);
+ if (f->context_count[i] < 0) {
+ av_log(f->avctx, AV_LOG_ERROR, "read_quant_table error\n");
+ return AVERROR_INVALIDDATA;
+ }
+ }
+ if ((ret = ffv1_allocate_initial_states(f)) < 0)
+ return ret;
+
+ for (i = 0; i < f->quant_table_count; i++)
+ if (get_rac(c, state)) {
+ for (j = 0; j < f->context_count[i]; j++)
+ for (k = 0; k < CONTEXT_SIZE; k++) {
+ int pred = j ? f->initial_states[i][j - 1][k] : 128;
+ f->initial_states[i][j][k] =
+ (pred + get_symbol(c, state2[k], 1)) & 0xFF;
+ }
+ }
+
+ if (f->version > 2) {
+ f->ec = get_symbol(c, state, 0);
+ }
+
+ if (f->version > 2) {
+ unsigned v;
+ v = av_crc(av_crc_get_table(AV_CRC_32_IEEE), 0,
+ f->avctx->extradata, f->avctx->extradata_size);
+ if (v) {
+ av_log(f->avctx, AV_LOG_ERROR, "CRC mismatch %X!\n", v);
+ return AVERROR_INVALIDDATA;
+ }
+ }
+
+ return 0;
+}
+
+
+static int read_header(FFV1Context *f)
+{
+ uint8_t state[CONTEXT_SIZE];
+ int i, j, context_count = -1;
+ RangeCoder *const c = &f->slice_context[0]->c;
+
+ memset(state, 128, sizeof(state));
+
+ if (f->version < 2) {
+ unsigned v = get_symbol(c, state, 0);
+ if (v > 1) {
+ av_log(f->avctx, AV_LOG_ERROR,
+ "invalid version %d in version 1 header\n", v);
+ return AVERROR_INVALIDDATA;
+ }
+ f->version = v;
+
+ f->ac = f->avctx->coder_type = get_symbol(c, state, 0);
+
+ if (f->ac > 1) {
+ for (i = 1; i < 256; i++)
+ f->state_transition[i] =
+ get_symbol(c, state, 1) + c->one_state[i];
+ }
+
+ f->colorspace = get_symbol(c, state, 0); //YUV cs type
+
+ if (f->version > 0)
+ f->avctx->bits_per_raw_sample = get_symbol(c, state, 0);
+
+ f->chroma_planes = get_rac(c, state);
+ f->chroma_h_shift = get_symbol(c, state, 0);
+ f->chroma_v_shift = get_symbol(c, state, 0);
+ f->transparency = get_rac(c, state);
+ f->plane_count = 2 + f->transparency;
+ }
+
+ if (f->colorspace == 0) {
+ if (!f->transparency && !f->chroma_planes) {
+ if (f->avctx->bits_per_raw_sample <= 8)
+ f->avctx->pix_fmt = AV_PIX_FMT_GRAY8;
+ else
+ f->avctx->pix_fmt = AV_PIX_FMT_GRAY16;
+ } else if (f->avctx->bits_per_raw_sample <= 8 && !f->transparency) {
+ switch (16 * f->chroma_h_shift + f->chroma_v_shift) {
+ case 0x00:
+ f->avctx->pix_fmt = AV_PIX_FMT_YUV444P;
+ break;
+ case 0x01:
+ f->avctx->pix_fmt = AV_PIX_FMT_YUV440P;
+ break;
+ case 0x10:
+ f->avctx->pix_fmt = AV_PIX_FMT_YUV422P;
+ break;
+ case 0x11:
+ f->avctx->pix_fmt = AV_PIX_FMT_YUV420P;
+ break;
+ case 0x20:
+ f->avctx->pix_fmt = AV_PIX_FMT_YUV411P;
+ break;
+ case 0x22:
+ f->avctx->pix_fmt = AV_PIX_FMT_YUV410P;
+ break;
+ default:
+ av_log(f->avctx, AV_LOG_ERROR, "format not supported\n");
+ return AVERROR(ENOSYS);
+ }
+ } else if (f->avctx->bits_per_raw_sample <= 8 && f->transparency) {
+ switch (16 * f->chroma_h_shift + f->chroma_v_shift) {
+ case 0x00:
+ f->avctx->pix_fmt = AV_PIX_FMT_YUVA444P;
+ break;
+ case 0x10:
+ f->avctx->pix_fmt = AV_PIX_FMT_YUVA422P;
+ break;
+ case 0x11:
+ f->avctx->pix_fmt = AV_PIX_FMT_YUVA420P;
+ break;
+ default:
+ av_log(f->avctx, AV_LOG_ERROR, "format not supported\n");
+ return AVERROR(ENOSYS);
+ }
+ } else if (f->avctx->bits_per_raw_sample == 9) {
+ f->packed_at_lsb = 1;
+ switch (16 * f->chroma_h_shift + f->chroma_v_shift) {
+ case 0x00:
+ f->avctx->pix_fmt = AV_PIX_FMT_YUV444P9;
+ break;
+ case 0x10:
+ f->avctx->pix_fmt = AV_PIX_FMT_YUV422P9;
+ break;
+ case 0x11:
+ f->avctx->pix_fmt = AV_PIX_FMT_YUV420P9;
+ break;
+ default:
+ av_log(f->avctx, AV_LOG_ERROR, "format not supported\n");
+ return AVERROR(ENOSYS);
+ }
+ } else if (f->avctx->bits_per_raw_sample == 10) {
+ f->packed_at_lsb = 1;
+ switch (16 * f->chroma_h_shift + f->chroma_v_shift) {
+ case 0x00:
+ f->avctx->pix_fmt = AV_PIX_FMT_YUV444P10;
+ break;
+ case 0x10:
+ f->avctx->pix_fmt = AV_PIX_FMT_YUV422P10;
+ break;
+ case 0x11:
+ f->avctx->pix_fmt = AV_PIX_FMT_YUV420P10;
+ break;
+ default:
+ av_log(f->avctx, AV_LOG_ERROR, "format not supported\n");
+ return AVERROR(ENOSYS);
+ }
+ } else {
+ switch (16 * f->chroma_h_shift + f->chroma_v_shift) {
+ case 0x00:
+ f->avctx->pix_fmt = AV_PIX_FMT_YUV444P16;
+ break;
+ case 0x10:
+ f->avctx->pix_fmt = AV_PIX_FMT_YUV422P16;
+ break;
+ case 0x11:
+ f->avctx->pix_fmt = AV_PIX_FMT_YUV420P16;
+ break;
+ default:
+ av_log(f->avctx, AV_LOG_ERROR, "format not supported\n");
+ return AVERROR(ENOSYS);
+ }
+ }
+ } else if (f->colorspace == 1) {
+ if (f->chroma_h_shift || f->chroma_v_shift) {
+ av_log(f->avctx, AV_LOG_ERROR,
+ "chroma subsampling not supported in this colorspace\n");
+ return AVERROR(ENOSYS);
+ }
+ switch (f->avctx->bits_per_raw_sample) {
+ case 8:
+ f->avctx->pix_fmt = AV_PIX_FMT_RGB32;
+ break;
+ case 9:
+ f->avctx->pix_fmt = AV_PIX_FMT_GBRP9;
+ break;
+ case 10:
+ f->avctx->pix_fmt = AV_PIX_FMT_GBRP10;
+ break;
+ default:
+ av_log(f->avctx, AV_LOG_ERROR,
+ "bit depth %d not supported\n",
+ f->avctx->bits_per_raw_sample);
+ return AVERROR(ENOSYS);
+ }
+ } else {
+ av_log(f->avctx, AV_LOG_ERROR, "colorspace not supported\n");
+ return AVERROR(ENOSYS);
+ }
+
+ av_dlog(f->avctx, "%d %d %d\n",
+ f->chroma_h_shift, f->chroma_v_shift, f->avctx->pix_fmt);
+ if (f->version < 2) {
+ context_count = read_quant_tables(c, f->quant_table);
+ if (context_count < 0) {
+ av_log(f->avctx, AV_LOG_ERROR, "read_quant_table error\n");
+ return AVERROR_INVALIDDATA;
+ }
+ } else if (f->version < 3) {
+ f->slice_count = get_symbol(c, state, 0);
+ } else {
+ const uint8_t *p = c->bytestream_end;
+ for (f->slice_count = 0;
+ f->slice_count < MAX_SLICES && 3 < p - c->bytestream_start;
+ f->slice_count++) {
+ int trailer = 3 + 5 * !!f->ec;
+ int size = AV_RB24(p - trailer);
+ if (size + trailer > p - c->bytestream_start)
+ break;
+ p -= size + trailer;
+ }
+ }
+ if (f->slice_count > (unsigned)MAX_SLICES || f->slice_count <= 0) {
+ av_log(f->avctx, AV_LOG_ERROR, "slice count %d is invalid\n",
+ f->slice_count);
+ return AVERROR_INVALIDDATA;
+ }
+
+ for (j = 0; j < f->slice_count; j++) {
+ FFV1Context *fs = f->slice_context[j];
+ fs->ac = f->ac;
+ fs->packed_at_lsb = f->packed_at_lsb;
+
+ fs->slice_damaged = 0;
+
+ if (f->version == 2) {
+ fs->slice_x = get_symbol(c, state, 0) * f->width;
+ fs->slice_y = get_symbol(c, state, 0) * f->height;
+ fs->slice_width =
+ (get_symbol(c, state, 0) + 1) * f->width + fs->slice_x;
+ fs->slice_height =
+ (get_symbol(c, state, 0) + 1) * f->height + fs->slice_y;
+
+ fs->slice_x /= f->num_h_slices;
+ fs->slice_y /= f->num_v_slices;
+ fs->slice_width = fs->slice_width / f->num_h_slices - fs->slice_x;
+ fs->slice_height = fs->slice_height / f->num_v_slices - fs->slice_y;
+ if ((unsigned)fs->slice_width > f->width ||
+ (unsigned)fs->slice_height > f->height)
+ return AVERROR_INVALIDDATA;
+ if ((unsigned)fs->slice_x + (uint64_t)fs->slice_width > f->width
+ || (unsigned)fs->slice_y + (uint64_t)fs->slice_height >
+ f->height)
+ return AVERROR_INVALIDDATA;
+ }
+
+ for (i = 0; i < f->plane_count; i++) {
+ PlaneContext *const p = &fs->plane[i];
+
+ if (f->version == 2) {
+ int idx = get_symbol(c, state, 0);
+ if (idx > (unsigned)f->quant_table_count) {
+ av_log(f->avctx, AV_LOG_ERROR,
+ "quant_table_index out of range\n");
+ return AVERROR_INVALIDDATA;
+ }
+ p->quant_table_index = idx;
+ memcpy(p->quant_table, f->quant_tables[idx],
+ sizeof(p->quant_table));
+ context_count = f->context_count[idx];
+ } else {
+ memcpy(p->quant_table, f->quant_table, sizeof(p->quant_table));
+ }
+
+ if (f->version <= 2) {
+ av_assert0(context_count >= 0);
+ if (p->context_count < context_count) {
+ av_freep(&p->state);
+ av_freep(&p->vlc_state);
+ }
+ p->context_count = context_count;
+ }
+ }
+ }
+ return 0;
+}
+
+static av_cold int ffv1_decode_init(AVCodecContext *avctx)
+{
+ FFV1Context *f = avctx->priv_data;
+ int ret;
+
+ ffv1_common_init(avctx);
+
+ if (avctx->extradata && (ret = read_extra_header(f)) < 0)
+ return ret;
+
+ if ((ret = ffv1_init_slice_contexts(f)) < 0)
+ return ret;
+
+ return 0;
+}
+
+static int ffv1_decode_frame(AVCodecContext *avctx, void *data,
+ int *got_frame, AVPacket *avpkt)
+{
+ const uint8_t *buf = avpkt->data;
+ int buf_size = avpkt->size;
+ FFV1Context *f = avctx->priv_data;
+ RangeCoder *const c = &f->slice_context[0]->c;
+ AVFrame *const p = &f->picture;
+ int i, ret;
+ uint8_t keystate = 128;
+ const uint8_t *buf_p;
+
+ AVFrame *picture = data;
+
+ /* release previously stored data */
+ if (p->data[0])
+ avctx->release_buffer(avctx, p);
+
+ ff_init_range_decoder(c, buf, buf_size);
+ ff_build_rac_states(c, 0.05 * (1LL << 32), 256 - 8);
+
+ p->pict_type = AV_PICTURE_TYPE_I; //FIXME I vs. P
+ if (get_rac(c, &keystate)) {
+ p->key_frame = 1;
+ f->key_frame_ok = 0;
+ if ((ret = read_header(f)) < 0)
+ return ret;
+ f->key_frame_ok = 1;
+ } else {
+ if (!f->key_frame_ok) {
+ av_log(avctx, AV_LOG_ERROR,
+ "Cannot decode non-keyframe without valid keyframe\n");
+ return AVERROR_INVALIDDATA;
+ }
+ p->key_frame = 0;
+ }
+
+ p->reference = 3; //for error concealment
+ if ((ret = ff_get_buffer(avctx, p)) < 0) {
+ av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
+ return ret;
+ }
+
+ if (avctx->debug & FF_DEBUG_PICT_INFO)
+ av_log(avctx, AV_LOG_DEBUG,
+ "ver:%d keyframe:%d coder:%d ec:%d slices:%d bps:%d\n",
+ f->version, p->key_frame, f->ac, f->ec, f->slice_count,
+ f->avctx->bits_per_raw_sample);
+
+ buf_p = buf + buf_size;
+ for (i = f->slice_count - 1; i >= 0; i--) {
+ FFV1Context *fs = f->slice_context[i];
+ int trailer = 3 + 5 * !!f->ec;
+ int v;
+
+ if (i || f->version > 2)
+ v = AV_RB24(buf_p - trailer) + trailer;
+ else
+ v = buf_p - c->bytestream_start;
+ if (buf_p - c->bytestream_start < v) {
+ av_log(avctx, AV_LOG_ERROR, "Slice pointer chain broken\n");
+ return AVERROR_INVALIDDATA;
+ }
+ buf_p -= v;
+
+ if (f->ec) {
+ unsigned crc = av_crc(av_crc_get_table(AV_CRC_32_IEEE), 0, buf_p, v);
+ if (crc) {
+ av_log(f->avctx, AV_LOG_ERROR, "CRC mismatch %X!\n", crc);
+ fs->slice_damaged = 1;
+ }
+ }
+
+ if (i) {
+ ff_init_range_decoder(&fs->c, buf_p, v);
+ } else
+ fs->c.bytestream_end = (uint8_t *)(buf_p + v);
+ }
+
+ avctx->execute(avctx, decode_slice, &f->slice_context[0], NULL,
+ f->slice_count,
+ sizeof(void *));
+
+ for (i = f->slice_count - 1; i >= 0; i--) {
+ FFV1Context *fs = f->slice_context[i];
+ int j;
+ if (fs->slice_damaged && f->last_picture.data[0]) {
+ const uint8_t *src[4];
+ uint8_t *dst[4];
+ for (j = 0; j < 4; j++) {
+ int sh = (j == 1 || j == 2) ? f->chroma_h_shift : 0;
+ int sv = (j == 1 || j == 2) ? f->chroma_v_shift : 0;
+ dst[j] = f->picture.data[j] + f->picture.linesize[j] *
+ (fs->slice_y >> sv) + (fs->slice_x >> sh);
+ src[j] = f->last_picture.data[j] +
+ f->last_picture.linesize[j] *
+ (fs->slice_y >> sv) + (fs->slice_x >> sh);
+ }
+ av_image_copy(dst, f->picture.linesize, (const uint8_t **)src,
+ f->last_picture.linesize,
+ avctx->pix_fmt, fs->slice_width,
+ fs->slice_height);
+ }
+ }
+
+ f->picture_number++;
+
+ *picture = *p;
+ *got_frame = 1;
+
+ FFSWAP(AVFrame, f->picture, f->last_picture);
+
+ return buf_size;
+}
+
+AVCodec ff_ffv1_decoder = {
+ .name = "ffv1",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .id = AV_CODEC_ID_FFV1,
+ .priv_data_size = sizeof(FFV1Context),
+ .init = ffv1_decode_init,
+ .close = ffv1_close,
+ .decode = ffv1_decode_frame,
+ .capabilities = CODEC_CAP_DR1 /*| CODEC_CAP_DRAW_HORIZ_BAND*/ |
+ CODEC_CAP_SLICE_THREADS,
+ .long_name = NULL_IF_CONFIG_SMALL("FFmpeg video codec #1"),
+};
diff --git a/gst-libs/ext/libav/libavcodec/ffv1enc.c b/gst-libs/ext/libav/libavcodec/ffv1enc.c
new file mode 100644
index 0000000..8c6fc9a
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/ffv1enc.c
@@ -0,0 +1,1102 @@
+/*
+ * FFV1 encoder for libavcodec
+ *
+ * Copyright (c) 2003-2012 Michael Niedermayer <michaelni@gmx.at>
+ *
+ * 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
+ * FF Video Codec 1 (a lossless codec) encoder
+ */
+
+#include "libavutil/avassert.h"
+#include "libavutil/pixdesc.h"
+#include "libavutil/crc.h"
+#include "libavutil/opt.h"
+#include "libavutil/imgutils.h"
+#include "avcodec.h"
+#include "internal.h"
+#include "get_bits.h"
+#include "put_bits.h"
+#include "dsputil.h"
+#include "rangecoder.h"
+#include "golomb.h"
+#include "mathops.h"
+#include "ffv1.h"
+
+static void find_best_state(uint8_t best_state[256][256],
+ const uint8_t one_state[256])
+{
+ int i, j, k, m;
+ double l2tab[256];
+
+ for (i = 1; i < 256; i++)
+ l2tab[i] = log2(i / 256.0);
+
+ for (i = 0; i < 256; i++) {
+ double best_len[256];
+ double p = i / 256.0;
+
+ for (j = 0; j < 256; j++)
+ best_len[j] = 1 << 30;
+
+ for (j = FFMAX(i - 10, 1); j < FFMIN(i + 11, 256); j++) {
+ double occ[256] = { 0 };
+ double len = 0;
+ occ[j] = 1.0;
+ for (k = 0; k < 256; k++) {
+ double newocc[256] = { 0 };
+ for (m = 1; m < 256; m++)
+ if (occ[m]) {
+ len -= occ[m] * (p * l2tab[m] +
+ (1 - p) * l2tab[256 - m]);
+ }
+ if (len < best_len[k]) {
+ best_len[k] = len;
+ best_state[i][k] = j;
+ }
+ for (m = 0; m < 256; m++)
+ if (occ[m]) {
+ newocc[one_state[m]] += occ[m] * p;
+ newocc[256 - one_state[256 - m]] += occ[m] * (1 - p);
+ }
+ memcpy(occ, newocc, sizeof(occ));
+ }
+ }
+ }
+}
+
+static av_always_inline av_flatten void put_symbol_inline(RangeCoder *c,
+ uint8_t *state, int v,
+ int is_signed,
+ uint64_t rc_stat[256][2],
+ uint64_t rc_stat2[32][2])
+{
+ int i;
+
+#define put_rac(C, S, B) \
+ do { \
+ if (rc_stat) { \
+ rc_stat[*(S)][B]++; \
+ rc_stat2[(S) - state][B]++; \
+ } \
+ put_rac(C, S, B); \
+ } while (0)
+
+ if (v) {
+ const int a = FFABS(v);
+ const int e = av_log2(a);
+ put_rac(c, state + 0, 0);
+ if (e <= 9) {
+ for (i = 0; i < e; i++)
+ put_rac(c, state + 1 + i, 1); // 1..10
+ put_rac(c, state + 1 + i, 0);
+
+ for (i = e - 1; i >= 0; i--)
+ put_rac(c, state + 22 + i, (a >> i) & 1); // 22..31
+
+ if (is_signed)
+ put_rac(c, state + 11 + e, v < 0); // 11..21
+ } else {
+ for (i = 0; i < e; i++)
+ put_rac(c, state + 1 + FFMIN(i, 9), 1); // 1..10
+ put_rac(c, state + 1 + 9, 0);
+
+ for (i = e - 1; i >= 0; i--)
+ put_rac(c, state + 22 + FFMIN(i, 9), (a >> i) & 1); // 22..31
+
+ if (is_signed)
+ put_rac(c, state + 11 + 10, v < 0); // 11..21
+ }
+ } else {
+ put_rac(c, state + 0, 1);
+ }
+#undef put_rac
+}
+
+static av_noinline void put_symbol(RangeCoder *c, uint8_t *state,
+ int v, int is_signed)
+{
+ put_symbol_inline(c, state, v, is_signed, NULL, NULL);
+}
+
+static inline void put_vlc_symbol(PutBitContext *pb, VlcState *const state,
+ int v, int bits)
+{
+ int i, k, code;
+ v = fold(v - state->bias, bits);
+
+ i = state->count;
+ k = 0;
+ while (i < state->error_sum) { // FIXME: optimize
+ k++;
+ i += i;
+ }
+
+ assert(k <= 13);
+
+#if 0 // JPEG LS
+ if (k == 0 && 2 * state->drift <= -state->count)
+ code = v ^ (-1);
+ else
+ code = v;
+#else
+ code = v ^ ((2 * state->drift + state->count) >> 31);
+#endif
+
+ av_dlog(NULL, "v:%d/%d bias:%d error:%d drift:%d count:%d k:%d\n", v, code,
+ state->bias, state->error_sum, state->drift, state->count, k);
+ set_sr_golomb(pb, code, k, 12, bits);
+
+ update_vlc_state(state, v);
+}
+
+static av_always_inline int encode_line(FFV1Context *s, int w,
+ int16_t *sample[3],
+ int plane_index, int bits)
+{
+ PlaneContext *const p = &s->plane[plane_index];
+ RangeCoder *const c = &s->c;
+ int x;
+ int run_index = s->run_index;
+ int run_count = 0;
+ int run_mode = 0;
+
+ if (s->ac) {
+ if (c->bytestream_end - c->bytestream < w * 20) {
+ av_log(s->avctx, AV_LOG_ERROR, "encoded frame too large\n");
+ return AVERROR_INVALIDDATA;
+ }
+ } else {
+ if (s->pb.buf_end - s->pb.buf - (put_bits_count(&s->pb) >> 3) < w * 4) {
+ av_log(s->avctx, AV_LOG_ERROR, "encoded frame too large\n");
+ return AVERROR_INVALIDDATA;
+ }
+ }
+
+ for (x = 0; x < w; x++) {
+ int diff, context;
+
+ context = get_context(p, sample[0] + x, sample[1] + x, sample[2] + x);
+ diff = sample[0][x] - predict(sample[0] + x, sample[1] + x);
+
+ if (context < 0) {
+ context = -context;
+ diff = -diff;
+ }
+
+ diff = fold(diff, bits);
+
+ if (s->ac) {
+ if (s->flags & CODEC_FLAG_PASS1) {
+ put_symbol_inline(c, p->state[context], diff, 1, s->rc_stat,
+ s->rc_stat2[p->quant_table_index][context]);
+ } else {
+ put_symbol_inline(c, p->state[context], diff, 1, NULL, NULL);
+ }
+ } else {
+ if (context == 0)
+ run_mode = 1;
+
+ if (run_mode) {
+ if (diff) {
+ while (run_count >= 1 << ff_log2_run[run_index]) {
+ run_count -= 1 << ff_log2_run[run_index];
+ run_index++;
+ put_bits(&s->pb, 1, 1);
+ }
+
+ put_bits(&s->pb, 1 + ff_log2_run[run_index], run_count);
+ if (run_index)
+ run_index--;
+ run_count = 0;
+ run_mode = 0;
+ if (diff > 0)
+ diff--;
+ } else {
+ run_count++;
+ }
+ }
+
+ av_dlog(s->avctx, "count:%d index:%d, mode:%d, x:%d pos:%d\n",
+ run_count, run_index, run_mode, x,
+ (int)put_bits_count(&s->pb));
+
+ if (run_mode == 0)
+ put_vlc_symbol(&s->pb, &p->vlc_state[context], diff, bits);
+ }
+ }
+ if (run_mode) {
+ while (run_count >= 1 << ff_log2_run[run_index]) {
+ run_count -= 1 << ff_log2_run[run_index];
+ run_index++;
+ put_bits(&s->pb, 1, 1);
+ }
+
+ if (run_count)
+ put_bits(&s->pb, 1, 1);
+ }
+ s->run_index = run_index;
+
+ return 0;
+}
+
+static void encode_plane(FFV1Context *s, uint8_t *src, int w, int h,
+ int stride, int plane_index)
+{
+ int x, y, i;
+ const int ring_size = s->avctx->context_model ? 3 : 2;
+ int16_t *sample[3];
+ s->run_index = 0;
+
+ memset(s->sample_buffer, 0, ring_size * (w + 6) * sizeof(*s->sample_buffer));
+
+ for (y = 0; y < h; y++) {
+ for (i = 0; i < ring_size; i++)
+ sample[i] = s->sample_buffer + (w + 6) * ((h + i - y) % ring_size) + 3;
+
+ sample[0][-1] = sample[1][0];
+ sample[1][w] = sample[1][w - 1];
+// { START_TIMER
+ if (s->bits_per_raw_sample <= 8) {
+ for (x = 0; x < w; x++)
+ sample[0][x] = src[x + stride * y];
+ encode_line(s, w, sample, plane_index, 8);
+ } else {
+ if (s->packed_at_lsb) {
+ for (x = 0; x < w; x++)
+ sample[0][x] = ((uint16_t *)(src + stride * y))[x];
+ } else {
+ for (x = 0; x < w; x++)
+ sample[0][x] =
+ ((uint16_t *)(src + stride * y))[x] >> (16 - s->bits_per_raw_sample);
+ }
+ encode_line(s, w, sample, plane_index, s->bits_per_raw_sample);
+ }
+// STOP_TIMER("encode line") }
+ }
+}
+
+static void encode_rgb_frame(FFV1Context *s, uint8_t *src[3], int w, int h,
+ int stride[3])
+{
+ int x, y, p, i;
+ const int ring_size = s->avctx->context_model ? 3 : 2;
+ int16_t *sample[MAX_PLANES][3];
+ int lbd = s->avctx->bits_per_raw_sample <= 8;
+ int bits = s->avctx->bits_per_raw_sample > 0
+ ? s->avctx->bits_per_raw_sample
+ : 8;
+ int offset = 1 << bits;
+
+ s->run_index = 0;
+
+ memset(s->sample_buffer, 0, ring_size * MAX_PLANES *
+ (w + 6) * sizeof(*s->sample_buffer));
+
+ for (y = 0; y < h; y++) {
+ for (i = 0; i < ring_size; i++)
+ for (p = 0; p < MAX_PLANES; p++)
+ sample[p][i] = s->sample_buffer + p * ring_size *
+ (w + 6) +
+ ((h + i - y) % ring_size) * (w + 6) + 3;
+
+ for (x = 0; x < w; x++) {
+ int b, g, r, av_uninit(a);
+ if (lbd) {
+ unsigned v = *((uint32_t *)(src[0] + x * 4 + stride[0] * y));
+ b = v & 0xFF;
+ g = (v >> 8) & 0xFF;
+ r = (v >> 16) & 0xFF;
+ a = v >> 24;
+ } else {
+ b = *((uint16_t *)(src[0] + x * 2 + stride[0] * y));
+ g = *((uint16_t *)(src[1] + x * 2 + stride[1] * y));
+ r = *((uint16_t *)(src[2] + x * 2 + stride[2] * y));
+ }
+
+ b -= g;
+ r -= g;
+ g += (b + r) >> 2;
+ b += offset;
+ r += offset;
+
+ sample[0][0][x] = g;
+ sample[1][0][x] = b;
+ sample[2][0][x] = r;
+ sample[3][0][x] = a;
+ }
+ for (p = 0; p < 3 + s->transparency; p++) {
+ sample[p][0][-1] = sample[p][1][0];
+ sample[p][1][w] = sample[p][1][w - 1];
+ if (lbd)
+ encode_line(s, w, sample[p], (p + 1) / 2, 9);
+ else
+ encode_line(s, w, sample[p], (p + 1) / 2, bits + 1);
+ }
+ }
+}
+
+
+static void write_quant_table(RangeCoder *c, int16_t *quant_table)
+{
+ int last = 0;
+ int i;
+ uint8_t state[CONTEXT_SIZE];
+ memset(state, 128, sizeof(state));
+
+ for (i = 1; i < 128; i++)
+ if (quant_table[i] != quant_table[i - 1]) {
+ put_symbol(c, state, i - last - 1, 0);
+ last = i;
+ }
+ put_symbol(c, state, i - last - 1, 0);
+}
+
+static void write_quant_tables(RangeCoder *c,
+ int16_t quant_table[MAX_CONTEXT_INPUTS][256])
+{
+ int i;
+ for (i = 0; i < 5; i++)
+ write_quant_table(c, quant_table[i]);
+}
+
+static void write_header(FFV1Context *f)
+{
+ uint8_t state[CONTEXT_SIZE];
+ int i, j;
+ RangeCoder *const c = &f->slice_context[0]->c;
+
+ memset(state, 128, sizeof(state));
+
+ if (f->version < 2) {
+ put_symbol(c, state, f->version, 0);
+ put_symbol(c, state, f->ac, 0);
+ if (f->ac > 1) {
+ for (i = 1; i < 256; i++)
+ put_symbol(c, state,
+ f->state_transition[i] - c->one_state[i], 1);
+ }
+ put_symbol(c, state, f->colorspace, 0); // YUV cs type
+ if (f->version > 0)
+ put_symbol(c, state, f->bits_per_raw_sample, 0);
+ put_rac(c, state, f->chroma_planes);
+ put_symbol(c, state, f->chroma_h_shift, 0);
+ put_symbol(c, state, f->chroma_v_shift, 0);
+ put_rac(c, state, f->transparency);
+
+ write_quant_tables(c, f->quant_table);
+ } else if (f->version < 3) {
+ put_symbol(c, state, f->slice_count, 0);
+ for (i = 0; i < f->slice_count; i++) {
+ FFV1Context *fs = f->slice_context[i];
+ put_symbol(c, state,
+ (fs->slice_x + 1) * f->num_h_slices / f->width, 0);
+ put_symbol(c, state,
+ (fs->slice_y + 1) * f->num_v_slices / f->height, 0);
+ put_symbol(c, state,
+ (fs->slice_width + 1) * f->num_h_slices / f->width - 1,
+ 0);
+ put_symbol(c, state,
+ (fs->slice_height + 1) * f->num_v_slices / f->height - 1,
+ 0);
+ for (j = 0; j < f->plane_count; j++) {
+ put_symbol(c, state, f->plane[j].quant_table_index, 0);
+ av_assert0(f->plane[j].quant_table_index == f->avctx->context_model);
+ }
+ }
+ }
+}
+
+static int write_extradata(FFV1Context *f)
+{
+ RangeCoder *const c = &f->c;
+ uint8_t state[CONTEXT_SIZE];
+ int i, j, k;
+ uint8_t state2[32][CONTEXT_SIZE];
+ unsigned v;
+
+ memset(state2, 128, sizeof(state2));
+ memset(state, 128, sizeof(state));
+
+ f->avctx->extradata_size = 10000 + 4 +
+ (11 * 11 * 5 * 5 * 5 + 11 * 11 * 11) * 32;
+ f->avctx->extradata = av_malloc(f->avctx->extradata_size);
+ ff_init_range_encoder(c, f->avctx->extradata, f->avctx->extradata_size);
+ ff_build_rac_states(c, 0.05 * (1LL << 32), 256 - 8);
+
+ put_symbol(c, state, f->version, 0);
+ if (f->version > 2) {
+ if (f->version == 3)
+ f->minor_version = 2;
+ put_symbol(c, state, f->minor_version, 0);
+ }
+
+ put_symbol(c, state, f->ac, 0);
+ if (f->ac > 1)
+ for (i = 1; i < 256; i++)
+ put_symbol(c, state, f->state_transition[i] - c->one_state[i], 1);
+
+ put_symbol(c, state, f->colorspace, 0); // YUV cs type
+ put_symbol(c, state, f->bits_per_raw_sample, 0);
+ put_rac(c, state, f->chroma_planes);
+ put_symbol(c, state, f->chroma_h_shift, 0);
+ put_symbol(c, state, f->chroma_v_shift, 0);
+ put_rac(c, state, f->transparency);
+ put_symbol(c, state, f->num_h_slices - 1, 0);
+ put_symbol(c, state, f->num_v_slices - 1, 0);
+
+ put_symbol(c, state, f->quant_table_count, 0);
+ for (i = 0; i < f->quant_table_count; i++)
+ write_quant_tables(c, f->quant_tables[i]);
+
+ for (i = 0; i < f->quant_table_count; i++) {
+ for (j = 0; j < f->context_count[i] * CONTEXT_SIZE; j++)
+ if (f->initial_states[i] && f->initial_states[i][0][j] != 128)
+ break;
+ if (j < f->context_count[i] * CONTEXT_SIZE) {
+ put_rac(c, state, 1);
+ for (j = 0; j < f->context_count[i]; j++)
+ for (k = 0; k < CONTEXT_SIZE; k++) {
+ int pred = j ? f->initial_states[i][j - 1][k] : 128;
+ put_symbol(c, state2[k],
+ (int8_t)(f->initial_states[i][j][k] - pred), 1);
+ }
+ } else {
+ put_rac(c, state, 0);
+ }
+ }
+
+ if (f->version > 2) {
+ put_symbol(c, state, f->ec, 0);
+ }
+
+ f->avctx->extradata_size = ff_rac_terminate(c);
+
+ v = av_crc(av_crc_get_table(AV_CRC_32_IEEE), 0,
+ f->avctx->extradata, f->avctx->extradata_size);
+ AV_WL32(f->avctx->extradata + f->avctx->extradata_size, v);
+ f->avctx->extradata_size += 4;
+
+ return 0;
+}
+
+static int sort_stt(FFV1Context *s, uint8_t stt[256])
+{
+ int i, i2, changed, print = 0;
+
+ do {
+ changed = 0;
+ for (i = 12; i < 244; i++) {
+ for (i2 = i + 1; i2 < 245 && i2 < i + 4; i2++) {
+
+#define COST(old, new) \
+ s->rc_stat[old][0] * -log2((256 - (new)) / 256.0) + \
+ s->rc_stat[old][1] * -log2((new) / 256.0)
+
+#define COST2(old, new) \
+ COST(old, new) + COST(256 - (old), 256 - (new))
+
+ double size0 = COST2(i, i) + COST2(i2, i2);
+ double sizeX = COST2(i, i2) + COST2(i2, i);
+ if (sizeX < size0 && i != 128 && i2 != 128) {
+ int j;
+ FFSWAP(int, stt[i], stt[i2]);
+ FFSWAP(int, s->rc_stat[i][0], s->rc_stat[i2][0]);
+ FFSWAP(int, s->rc_stat[i][1], s->rc_stat[i2][1]);
+ if (i != 256 - i2) {
+ FFSWAP(int, stt[256 - i], stt[256 - i2]);
+ FFSWAP(int, s->rc_stat[256 - i][0], s->rc_stat[256 - i2][0]);
+ FFSWAP(int, s->rc_stat[256 - i][1], s->rc_stat[256 - i2][1]);
+ }
+ for (j = 1; j < 256; j++) {
+ if (stt[j] == i)
+ stt[j] = i2;
+ else if (stt[j] == i2)
+ stt[j] = i;
+ if (i != 256 - i2) {
+ if (stt[256 - j] == 256 - i)
+ stt[256 - j] = 256 - i2;
+ else if (stt[256 - j] == 256 - i2)
+ stt[256 - j] = 256 - i;
+ }
+ }
+ print = changed = 1;
+ }
+ }
+ }
+ } while (changed);
+ return print;
+}
+
+static int init_slices_state(FFV1Context *f)
+{
+ int i, ret;
+ for (i = 0; i < f->slice_count; i++) {
+ FFV1Context *fs = f->slice_context[i];
+ if ((ret = ffv1_init_slice_state(f, fs)) < 0)
+ return AVERROR(ENOMEM);
+ }
+ return 0;
+}
+
+static av_cold int ffv1_encode_init(AVCodecContext *avctx)
+{
+ FFV1Context *s = avctx->priv_data;
+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(avctx->pix_fmt);
+ int i, j, k, m, ret;
+
+ ffv1_common_init(avctx);
+
+ s->version = 0;
+
+ if ((avctx->flags & (CODEC_FLAG_PASS1 | CODEC_FLAG_PASS2)) ||
+ avctx->slices > 1)
+ s->version = FFMAX(s->version, 2);
+
+ if (avctx->level == 3) {
+ s->version = 3;
+ }
+
+ if (s->ec < 0) {
+ s->ec = (s->version >= 3);
+ }
+
+ if (s->version >= 2 &&
+ avctx->strict_std_compliance > FF_COMPLIANCE_EXPERIMENTAL) {
+ av_log(avctx, AV_LOG_ERROR,
+ "Version %d requested, please set -strict experimental in "
+ "order to enable it\n",
+ s->version);
+ return AVERROR(ENOSYS);
+ }
+
+ s->ac = avctx->coder_type > 0 ? 2 : 0;
+
+ s->plane_count = 3;
+ switch (avctx->pix_fmt) {
+ case AV_PIX_FMT_YUV444P9:
+ case AV_PIX_FMT_YUV422P9:
+ case AV_PIX_FMT_YUV420P9:
+ if (!avctx->bits_per_raw_sample)
+ s->bits_per_raw_sample = 9;
+ case AV_PIX_FMT_YUV444P10:
+ case AV_PIX_FMT_YUV420P10:
+ case AV_PIX_FMT_YUV422P10:
+ s->packed_at_lsb = 1;
+ if (!avctx->bits_per_raw_sample && !s->bits_per_raw_sample)
+ s->bits_per_raw_sample = 10;
+ case AV_PIX_FMT_GRAY16:
+ case AV_PIX_FMT_YUV444P16:
+ case AV_PIX_FMT_YUV422P16:
+ case AV_PIX_FMT_YUV420P16:
+ if (!avctx->bits_per_raw_sample && !s->bits_per_raw_sample) {
+ s->bits_per_raw_sample = 16;
+ } else if (!s->bits_per_raw_sample) {
+ s->bits_per_raw_sample = avctx->bits_per_raw_sample;
+ }
+ if (s->bits_per_raw_sample <= 8) {
+ av_log(avctx, AV_LOG_ERROR, "bits_per_raw_sample invalid\n");
+ return AVERROR_INVALIDDATA;
+ }
+ if (!s->ac && avctx->coder_type == -1) {
+ av_log(avctx, AV_LOG_INFO,
+ "bits_per_raw_sample > 8, forcing coder 1\n");
+ s->ac = 2;
+ }
+ if (!s->ac) {
+ av_log(
+ avctx, AV_LOG_ERROR,
+ "bits_per_raw_sample of more than 8 needs -coder 1 currently\n");
+ return AVERROR_INVALIDDATA;
+ }
+ s->version = FFMAX(s->version, 1);
+ case AV_PIX_FMT_GRAY8:
+ case AV_PIX_FMT_YUV444P:
+ case AV_PIX_FMT_YUV440P:
+ case AV_PIX_FMT_YUV422P:
+ case AV_PIX_FMT_YUV420P:
+ case AV_PIX_FMT_YUV411P:
+ case AV_PIX_FMT_YUV410P:
+ s->chroma_planes = desc->nb_components < 3 ? 0 : 1;
+ s->colorspace = 0;
+ break;
+ case AV_PIX_FMT_YUVA444P:
+ case AV_PIX_FMT_YUVA422P:
+ case AV_PIX_FMT_YUVA420P:
+ s->chroma_planes = 1;
+ s->colorspace = 0;
+ s->transparency = 1;
+ break;
+ case AV_PIX_FMT_RGB32:
+ s->colorspace = 1;
+ s->transparency = 1;
+ break;
+ case AV_PIX_FMT_GBRP9:
+ if (!avctx->bits_per_raw_sample)
+ s->bits_per_raw_sample = 9;
+ case AV_PIX_FMT_GBRP10:
+ if (!avctx->bits_per_raw_sample && !s->bits_per_raw_sample)
+ s->bits_per_raw_sample = 10;
+ case AV_PIX_FMT_GBRP16:
+ if (!avctx->bits_per_raw_sample && !s->bits_per_raw_sample)
+ s->bits_per_raw_sample = 16;
+ else if (!s->bits_per_raw_sample)
+ s->bits_per_raw_sample = avctx->bits_per_raw_sample;
+ s->colorspace = 1;
+ s->chroma_planes = 1;
+ s->version = FFMAX(s->version, 1);
+ break;
+ default:
+ av_log(avctx, AV_LOG_ERROR, "format not supported\n");
+ return AVERROR_INVALIDDATA;
+ }
+ if (s->transparency) {
+ av_log(
+ avctx, AV_LOG_WARNING,
+ "Storing alpha plane, this will require a recent FFV1 decoder to playback!\n");
+ }
+ if (avctx->context_model > 1U) {
+ av_log(avctx, AV_LOG_ERROR,
+ "Invalid context model %d, valid values are 0 and 1\n",
+ avctx->context_model);
+ return AVERROR(EINVAL);
+ }
+
+ if (s->ac > 1)
+ for (i = 1; i < 256; i++)
+ s->state_transition[i] = ffv1_ver2_state[i];
+
+ for (i = 0; i < 256; i++) {
+ s->quant_table_count = 2;
+ if (s->bits_per_raw_sample <= 8) {
+ s->quant_tables[0][0][i] = ffv1_quant11[i];
+ s->quant_tables[0][1][i] = ffv1_quant11[i] * 11;
+ s->quant_tables[0][2][i] = ffv1_quant11[i] * 11 * 11;
+ s->quant_tables[1][0][i] = ffv1_quant11[i];
+ s->quant_tables[1][1][i] = ffv1_quant11[i] * 11;
+ s->quant_tables[1][2][i] = ffv1_quant5[i] * 11 * 11;
+ s->quant_tables[1][3][i] = ffv1_quant5[i] * 5 * 11 * 11;
+ s->quant_tables[1][4][i] = ffv1_quant5[i] * 5 * 5 * 11 * 11;
+ } else {
+ s->quant_tables[0][0][i] = ffv1_quant9_10bit[i];
+ s->quant_tables[0][1][i] = ffv1_quant9_10bit[i] * 11;
+ s->quant_tables[0][2][i] = ffv1_quant9_10bit[i] * 11 * 11;
+ s->quant_tables[1][0][i] = ffv1_quant9_10bit[i];
+ s->quant_tables[1][1][i] = ffv1_quant9_10bit[i] * 11;
+ s->quant_tables[1][2][i] = ffv1_quant5_10bit[i] * 11 * 11;
+ s->quant_tables[1][3][i] = ffv1_quant5_10bit[i] * 5 * 11 * 11;
+ s->quant_tables[1][4][i] = ffv1_quant5_10bit[i] * 5 * 5 * 11 * 11;
+ }
+ }
+ s->context_count[0] = (11 * 11 * 11 + 1) / 2;
+ s->context_count[1] = (11 * 11 * 5 * 5 * 5 + 1) / 2;
+ memcpy(s->quant_table, s->quant_tables[avctx->context_model],
+ sizeof(s->quant_table));
+
+ for (i = 0; i < s->plane_count; i++) {
+ PlaneContext *const p = &s->plane[i];
+
+ memcpy(p->quant_table, s->quant_table, sizeof(p->quant_table));
+ p->quant_table_index = avctx->context_model;
+ p->context_count = s->context_count[p->quant_table_index];
+ }
+
+ if ((ret = ffv1_allocate_initial_states(s)) < 0)
+ return ret;
+
+ avctx->coded_frame = &s->picture;
+ if (!s->transparency)
+ s->plane_count = 2;
+
+ av_pix_fmt_get_chroma_sub_sample(avctx->pix_fmt, &s->chroma_h_shift,
+ &s->chroma_v_shift);
+
+ s->picture_number = 0;
+
+ if (avctx->flags & (CODEC_FLAG_PASS1 | CODEC_FLAG_PASS2)) {
+ for (i = 0; i < s->quant_table_count; i++) {
+ s->rc_stat2[i] = av_mallocz(s->context_count[i] *
+ sizeof(*s->rc_stat2[i]));
+ if (!s->rc_stat2[i])
+ return AVERROR(ENOMEM);
+ }
+ }
+ if (avctx->stats_in) {
+ char *p = avctx->stats_in;
+ uint8_t best_state[256][256];
+ int gob_count = 0;
+ char *next;
+
+ av_assert0(s->version >= 2);
+
+ for (;; ) {
+ for (j = 0; j < 256; j++)
+ for (i = 0; i < 2; i++) {
+ s->rc_stat[j][i] = strtol(p, &next, 0);
+ if (next == p) {
+ av_log(avctx, AV_LOG_ERROR,
+ "2Pass file invalid at %d %d [%s]\n", j, i, p);
+ return AVERROR_INVALIDDATA;
+ }
+ p = next;
+ }
+ for (i = 0; i < s->quant_table_count; i++)
+ for (j = 0; j < s->context_count[i]; j++) {
+ for (k = 0; k < 32; k++)
+ for (m = 0; m < 2; m++) {
+ s->rc_stat2[i][j][k][m] = strtol(p, &next, 0);
+ if (next == p) {
+ av_log(avctx, AV_LOG_ERROR,
+ "2Pass file invalid at %d %d %d %d [%s]\n",
+ i, j, k, m, p);
+ return AVERROR_INVALIDDATA;
+ }
+ p = next;
+ }
+ }
+ gob_count = strtol(p, &next, 0);
+ if (next == p || gob_count <= 0) {
+ av_log(avctx, AV_LOG_ERROR, "2Pass file invalid\n");
+ return AVERROR_INVALIDDATA;
+ }
+ p = next;
+ while (*p == '\n' || *p == ' ')
+ p++;
+ if (p[0] == 0)
+ break;
+ }
+ sort_stt(s, s->state_transition);
+
+ find_best_state(best_state, s->state_transition);
+
+ for (i = 0; i < s->quant_table_count; i++) {
+ for (j = 0; j < s->context_count[i]; j++)
+ for (k = 0; k < 32; k++) {
+ double p = 128;
+ if (s->rc_stat2[i][j][k][0] + s->rc_stat2[i][j][k][1]) {
+ p = 256.0 * s->rc_stat2[i][j][k][1] /
+ (s->rc_stat2[i][j][k][0] + s->rc_stat2[i][j][k][1]);
+ }
+ s->initial_states[i][j][k] =
+ best_state[av_clip(round(p), 1, 255)][av_clip((s->rc_stat2[i][j][k][0] +
+ s->rc_stat2[i][j][k][1]) /
+ gob_count, 0, 255)];
+ }
+ }
+ }
+
+ if (s->version > 1) {
+ for (s->num_v_slices = 2; s->num_v_slices < 9; s->num_v_slices++)
+ for (s->num_h_slices = s->num_v_slices;
+ s->num_h_slices < 2 * s->num_v_slices; s->num_h_slices++)
+ if (avctx->slices == s->num_h_slices * s->num_v_slices &&
+ avctx->slices <= 64 || !avctx->slices)
+ goto slices_ok;
+ av_log(avctx, AV_LOG_ERROR,
+ "Unsupported number %d of slices requested, please specify a "
+ "supported number with -slices (ex:4,6,9,12,16, ...)\n",
+ avctx->slices);
+ return AVERROR(ENOSYS);
+slices_ok:
+ write_extradata(s);
+ }
+
+ if ((ret = ffv1_init_slice_contexts(s)) < 0)
+ return ret;
+ if ((ret = init_slices_state(s)) < 0)
+ return ret;
+
+#define STATS_OUT_SIZE 1024 * 1024 * 6
+ if (avctx->flags & CODEC_FLAG_PASS1) {
+ avctx->stats_out = av_mallocz(STATS_OUT_SIZE);
+ for (i = 0; i < s->quant_table_count; i++)
+ for (j = 0; j < s->slice_count; j++) {
+ FFV1Context *sf = s->slice_context[j];
+ av_assert0(!sf->rc_stat2[i]);
+ sf->rc_stat2[i] = av_mallocz(s->context_count[i] *
+ sizeof(*sf->rc_stat2[i]));
+ if (!sf->rc_stat2[i])
+ return AVERROR(ENOMEM);
+ }
+ }
+
+ return 0;
+}
+
+static void encode_slice_header(FFV1Context *f, FFV1Context *fs)
+{
+ RangeCoder *c = &fs->c;
+ uint8_t state[CONTEXT_SIZE];
+ int j;
+ memset(state, 128, sizeof(state));
+
+ put_symbol(c, state, (fs->slice_x + 1) * f->num_h_slices / f->width, 0);
+ put_symbol(c, state, (fs->slice_y + 1) * f->num_v_slices / f->height, 0);
+ put_symbol(c, state, (fs->slice_width + 1) * f->num_h_slices / f->width - 1,
+ 0);
+ put_symbol(c, state,
+ (fs->slice_height + 1) * f->num_v_slices / f->height - 1,
+ 0);
+ for (j = 0; j < f->plane_count; j++) {
+ put_symbol(c, state, f->plane[j].quant_table_index, 0);
+ av_assert0(f->plane[j].quant_table_index == f->avctx->context_model);
+ }
+ if (!f->picture.interlaced_frame)
+ put_symbol(c, state, 3, 0);
+ else
+ put_symbol(c, state, 1 + !f->picture.top_field_first, 0);
+ put_symbol(c, state, f->picture.sample_aspect_ratio.num, 0);
+ put_symbol(c, state, f->picture.sample_aspect_ratio.den, 0);
+}
+
+static int encode_slice(AVCodecContext *c, void *arg)
+{
+ FFV1Context *fs = *(void **)arg;
+ FFV1Context *f = fs->avctx->priv_data;
+ int width = fs->slice_width;
+ int height = fs->slice_height;
+ int x = fs->slice_x;
+ int y = fs->slice_y;
+ AVFrame *const p = &f->picture;
+ const int ps = (av_pix_fmt_desc_get(c->pix_fmt)->flags & PIX_FMT_PLANAR)
+ ? (f->bits_per_raw_sample > 8) + 1
+ : 4;
+
+ if (p->key_frame)
+ ffv1_clear_slice_state(f, fs);
+ if (f->version > 2) {
+ encode_slice_header(f, fs);
+ }
+ if (!fs->ac) {
+ if (f->version > 2)
+ put_rac(&fs->c, (uint8_t[]) { 129 }, 0);
+ fs->ac_byte_count = f->version > 2 || (!x && !y) ? ff_rac_terminate( &fs->c) : 0;
+ init_put_bits(&fs->pb, fs->c.bytestream_start + fs->ac_byte_count,
+ fs->c.bytestream_end - fs->c.bytestream_start - fs->ac_byte_count);
+ }
+
+ if (f->colorspace == 0) {
+ const int chroma_width = -((-width) >> f->chroma_h_shift);
+ const int chroma_height = -((-height) >> f->chroma_v_shift);
+ const int cx = x >> f->chroma_h_shift;
+ const int cy = y >> f->chroma_v_shift;
+
+ encode_plane(fs, p->data[0] + ps * x + y * p->linesize[0],
+ width, height, p->linesize[0], 0);
+
+ if (f->chroma_planes) {
+ encode_plane(fs, p->data[1] + ps * cx + cy * p->linesize[1],
+ chroma_width, chroma_height, p->linesize[1], 1);
+ encode_plane(fs, p->data[2] + ps * cx + cy * p->linesize[2],
+ chroma_width, chroma_height, p->linesize[2], 1);
+ }
+ if (fs->transparency)
+ encode_plane(fs, p->data[3] + ps * x + y * p->linesize[3], width,
+ height, p->linesize[3], 2);
+ } else {
+ uint8_t *planes[3] = { p->data[0] + ps * x + y * p->linesize[0],
+ p->data[1] + ps * x + y * p->linesize[1],
+ p->data[2] + ps * x + y * p->linesize[2] };
+ encode_rgb_frame(fs, planes, width, height, p->linesize);
+ }
+ emms_c();
+
+ return 0;
+}
+
+static int ffv1_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
+ const AVFrame *pict, int *got_packet)
+{
+ FFV1Context *f = avctx->priv_data;
+ RangeCoder *const c = &f->slice_context[0]->c;
+ AVFrame *const p = &f->picture;
+ int used_count = 0;
+ uint8_t keystate = 128;
+ uint8_t *buf_p;
+ int i, ret;
+
+ if ((ret = ff_alloc_packet(pkt, avctx->width * avctx->height *
+ ((8 * 2 + 1 + 1) * 4) / 8 +
+ FF_MIN_BUFFER_SIZE)) < 0) {
+ av_log(avctx, AV_LOG_ERROR, "Error getting output packet.\n");
+ return ret;
+ }
+
+ ff_init_range_encoder(c, pkt->data, pkt->size);
+ ff_build_rac_states(c, 0.05 * (1LL << 32), 256 - 8);
+
+ *p = *pict;
+ p->pict_type = AV_PICTURE_TYPE_I;
+
+ if (avctx->gop_size == 0 || f->picture_number % avctx->gop_size == 0) {
+ put_rac(c, &keystate, 1);
+ p->key_frame = 1;
+ f->gob_count++;
+ write_header(f);
+ } else {
+ put_rac(c, &keystate, 0);
+ p->key_frame = 0;
+ }
+
+ if (f->ac > 1) {
+ int i;
+ for (i = 1; i < 256; i++) {
+ c->one_state[i] = f->state_transition[i];
+ c->zero_state[256 - i] = 256 - c->one_state[i];
+ }
+ }
+
+ for (i = 1; i < f->slice_count; i++) {
+ FFV1Context *fs = f->slice_context[i];
+ uint8_t *start = pkt->data +
+ (pkt->size - used_count) * (int64_t)i / f->slice_count;
+ int len = pkt->size / f->slice_count;
+ ff_init_range_encoder(&fs->c, start, len);
+ }
+ avctx->execute(avctx, encode_slice, &f->slice_context[0], NULL,
+ f->slice_count, sizeof(void *));
+
+ buf_p = pkt->data;
+ for (i = 0; i < f->slice_count; i++) {
+ FFV1Context *fs = f->slice_context[i];
+ int bytes;
+
+ if (fs->ac) {
+ uint8_t state = 129;
+ put_rac(&fs->c, &state, 0);
+ bytes = ff_rac_terminate(&fs->c);
+ } else {
+ flush_put_bits(&fs->pb); // FIXME: nicer padding
+ bytes = fs->ac_byte_count + (put_bits_count(&fs->pb) + 7) / 8;
+ }
+ if (i > 0 || f->version > 2) {
+ av_assert0(bytes < pkt->size / f->slice_count);
+ memmove(buf_p, fs->c.bytestream_start, bytes);
+ av_assert0(bytes < (1 << 24));
+ AV_WB24(buf_p + bytes, bytes);
+ bytes += 3;
+ }
+ if (f->ec) {
+ unsigned v;
+ buf_p[bytes++] = 0;
+ v = av_crc(av_crc_get_table(AV_CRC_32_IEEE), 0, buf_p, bytes);
+ AV_WL32(buf_p + bytes, v);
+ bytes += 4;
+ }
+ buf_p += bytes;
+ }
+
+ if ((avctx->flags & CODEC_FLAG_PASS1) && (f->picture_number & 31) == 0) {
+ int j, k, m;
+ char *p = avctx->stats_out;
+ char *end = p + STATS_OUT_SIZE;
+
+ memset(f->rc_stat, 0, sizeof(f->rc_stat));
+ for (i = 0; i < f->quant_table_count; i++)
+ memset(f->rc_stat2[i], 0, f->context_count[i] * sizeof(*f->rc_stat2[i]));
+
+ for (j = 0; j < f->slice_count; j++) {
+ FFV1Context *fs = f->slice_context[j];
+ for (i = 0; i < 256; i++) {
+ f->rc_stat[i][0] += fs->rc_stat[i][0];
+ f->rc_stat[i][1] += fs->rc_stat[i][1];
+ }
+ for (i = 0; i < f->quant_table_count; i++) {
+ for (k = 0; k < f->context_count[i]; k++)
+ for (m = 0; m < 32; m++) {
+ f->rc_stat2[i][k][m][0] += fs->rc_stat2[i][k][m][0];
+ f->rc_stat2[i][k][m][1] += fs->rc_stat2[i][k][m][1];
+ }
+ }
+ }
+
+ for (j = 0; j < 256; j++) {
+ snprintf(p, end - p, "%" PRIu64 " %" PRIu64 " ",
+ f->rc_stat[j][0], f->rc_stat[j][1]);
+ p += strlen(p);
+ }
+ snprintf(p, end - p, "\n");
+
+ for (i = 0; i < f->quant_table_count; i++) {
+ for (j = 0; j < f->context_count[i]; j++)
+ for (m = 0; m < 32; m++) {
+ snprintf(p, end - p, "%" PRIu64 " %" PRIu64 " ",
+ f->rc_stat2[i][j][m][0], f->rc_stat2[i][j][m][1]);
+ p += strlen(p);
+ }
+ }
+ snprintf(p, end - p, "%d\n", f->gob_count);
+ } else if (avctx->flags & CODEC_FLAG_PASS1)
+ avctx->stats_out[0] = '\0';
+
+ f->picture_number++;
+ pkt->size = buf_p - pkt->data;
+ pkt->flags |= AV_PKT_FLAG_KEY * p->key_frame;
+ *got_packet = 1;
+
+ return 0;
+}
+
+#define OFFSET(x) offsetof(FFV1Context, x)
+#define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
+static const AVOption options[] = {
+ { "slicecrc", "Protect slices with CRCs", OFFSET(ec), AV_OPT_TYPE_INT,
+ { .i64 = -1 }, -1, 1, VE },
+ { NULL }
+};
+
+static const AVClass class = {
+ .class_name = "ffv1 encoder",
+ .item_name = av_default_item_name,
+ .option = options,
+ .version = LIBAVUTIL_VERSION_INT,
+};
+
+static const AVCodecDefault ffv1_defaults[] = {
+ { "coder", "-1" },
+ { NULL },
+};
+
+AVCodec ff_ffv1_encoder = {
+ .name = "ffv1",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .id = AV_CODEC_ID_FFV1,
+ .priv_data_size = sizeof(FFV1Context),
+ .init = ffv1_encode_init,
+ .encode2 = ffv1_encode_frame,
+ .close = ffv1_close,
+ .capabilities = CODEC_CAP_SLICE_THREADS,
+ .pix_fmts = (const enum AVPixelFormat[]) {
+ AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUV444P,
+ AV_PIX_FMT_YUV411P, AV_PIX_FMT_YUV410P,
+ AV_PIX_FMT_YUV444P9, AV_PIX_FMT_YUV422P9, AV_PIX_FMT_YUV420P9,
+ AV_PIX_FMT_YUV420P10, AV_PIX_FMT_YUV422P10, AV_PIX_FMT_YUV444P10,
+ AV_PIX_FMT_YUV420P16, AV_PIX_FMT_YUV422P16, AV_PIX_FMT_YUV444P16,
+ AV_PIX_FMT_RGB32,
+ AV_PIX_FMT_GBRP9, AV_PIX_FMT_GBRP10,
+ AV_PIX_FMT_YUVA420P, AV_PIX_FMT_YUVA422P, AV_PIX_FMT_YUVA444P,
+ AV_PIX_FMT_GRAY16, AV_PIX_FMT_GRAY8,
+ AV_PIX_FMT_NONE
+
+ },
+ .long_name = NULL_IF_CONFIG_SMALL("FFmpeg video codec #1"),
+ .defaults = ffv1_defaults,
+ .priv_class = &class,
+};
diff --git a/gst-libs/ext/libav/libavcodec/flac.c b/gst-libs/ext/libav/libavcodec/flac.c
index e6a427a..32b28d0 100644
--- a/gst-libs/ext/libav/libavcodec/flac.c
+++ b/gst-libs/ext/libav/libavcodec/flac.c
@@ -19,12 +19,25 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "libavutil/channel_layout.h"
#include "libavutil/crc.h"
+#include "libavutil/log.h"
+#include "bytestream.h"
+#include "get_bits.h"
#include "flac.h"
#include "flacdata.h"
static const int8_t sample_size_table[] = { 0, 8, 12, 0, 16, 20, 24, 0 };
+static const int64_t flac_channel_layouts[6] = {
+ AV_CH_LAYOUT_MONO,
+ AV_CH_LAYOUT_STEREO,
+ AV_CH_LAYOUT_SURROUND,
+ AV_CH_LAYOUT_QUAD,
+ AV_CH_LAYOUT_5POINT0,
+ AV_CH_LAYOUT_5POINT1
+};
+
static int64_t get_utf8(GetBitContext *gb)
{
int64_t val;
@@ -55,8 +68,9 @@ int ff_flac_decode_frame_header(AVCodecContext *avctx, GetBitContext *gb,
if (fi->ch_mode < FLAC_MAX_CHANNELS) {
fi->channels = fi->ch_mode + 1;
fi->ch_mode = FLAC_CHMODE_INDEPENDENT;
- } else if (fi->ch_mode <= FLAC_CHMODE_MID_SIDE) {
+ } else if (fi->ch_mode < FLAC_MAX_CHANNELS + FLAC_CHMODE_MID_SIDE) {
fi->channels = 2;
+ fi->ch_mode -= FLAC_MAX_CHANNELS - 1;
} else {
av_log(avctx, AV_LOG_ERROR + log_level_offset,
"invalid channel mode: %d\n", fi->ch_mode);
@@ -149,3 +163,83 @@ int ff_flac_get_max_frame_size(int blocksize, int ch, int bps)
return count;
}
+
+int avpriv_flac_is_extradata_valid(AVCodecContext *avctx,
+ enum FLACExtradataFormat *format,
+ uint8_t **streaminfo_start)
+{
+ if (!avctx->extradata || avctx->extradata_size < FLAC_STREAMINFO_SIZE) {
+ av_log(avctx, AV_LOG_ERROR, "extradata NULL or too small.\n");
+ return 0;
+ }
+ if (AV_RL32(avctx->extradata) != MKTAG('f','L','a','C')) {
+ /* extradata contains STREAMINFO only */
+ if (avctx->extradata_size != FLAC_STREAMINFO_SIZE) {
+ av_log(avctx, AV_LOG_WARNING, "extradata contains %d bytes too many.\n",
+ FLAC_STREAMINFO_SIZE-avctx->extradata_size);
+ }
+ *format = FLAC_EXTRADATA_FORMAT_STREAMINFO;
+ *streaminfo_start = avctx->extradata;
+ } else {
+ if (avctx->extradata_size < 8+FLAC_STREAMINFO_SIZE) {
+ av_log(avctx, AV_LOG_ERROR, "extradata too small.\n");
+ return 0;
+ }
+ *format = FLAC_EXTRADATA_FORMAT_FULL_HEADER;
+ *streaminfo_start = &avctx->extradata[8];
+ }
+ return 1;
+}
+
+void ff_flac_set_channel_layout(AVCodecContext *avctx)
+{
+ if (avctx->channels <= FF_ARRAY_ELEMS(flac_channel_layouts))
+ avctx->channel_layout = flac_channel_layouts[avctx->channels - 1];
+ else
+ avctx->channel_layout = 0;
+}
+
+void avpriv_flac_parse_streaminfo(AVCodecContext *avctx, struct FLACStreaminfo *s,
+ const uint8_t *buffer)
+{
+ GetBitContext gb;
+ init_get_bits(&gb, buffer, FLAC_STREAMINFO_SIZE*8);
+
+ skip_bits(&gb, 16); /* skip min blocksize */
+ s->max_blocksize = get_bits(&gb, 16);
+ if (s->max_blocksize < FLAC_MIN_BLOCKSIZE) {
+ av_log(avctx, AV_LOG_WARNING, "invalid max blocksize: %d\n",
+ s->max_blocksize);
+ s->max_blocksize = 16;
+ }
+
+ skip_bits(&gb, 24); /* skip min frame size */
+ s->max_framesize = get_bits_long(&gb, 24);
+
+ s->samplerate = get_bits_long(&gb, 20);
+ s->channels = get_bits(&gb, 3) + 1;
+ s->bps = get_bits(&gb, 5) + 1;
+
+ avctx->channels = s->channels;
+ avctx->sample_rate = s->samplerate;
+ avctx->bits_per_raw_sample = s->bps;
+ ff_flac_set_channel_layout(avctx);
+
+ s->samples = get_bits_long(&gb, 32) << 4;
+ s->samples |= get_bits(&gb, 4);
+
+ skip_bits_long(&gb, 64); /* md5 sum */
+ skip_bits_long(&gb, 64); /* md5 sum */
+}
+
+void avpriv_flac_parse_block_header(const uint8_t *block_header,
+ int *last, int *type, int *size)
+{
+ int tmp = bytestream_get_byte(&block_header);
+ if (last)
+ *last = tmp & 0x80;
+ if (type)
+ *type = tmp & 0x7F;
+ if (size)
+ *size = bytestream_get_be24(&block_header);
+}
diff --git a/gst-libs/ext/libav/libavcodec/flac.h b/gst-libs/ext/libav/libavcodec/flac.h
index b826fd4..63f41c2 100644
--- a/gst-libs/ext/libav/libavcodec/flac.h
+++ b/gst-libs/ext/libav/libavcodec/flac.h
@@ -37,10 +37,10 @@
#define FLAC_MIN_FRAME_SIZE 11
enum {
- FLAC_CHMODE_INDEPENDENT = 0,
- FLAC_CHMODE_LEFT_SIDE = 8,
- FLAC_CHMODE_RIGHT_SIDE = 9,
- FLAC_CHMODE_MID_SIDE = 10,
+ FLAC_CHMODE_INDEPENDENT = 0,
+ FLAC_CHMODE_LEFT_SIDE = 1,
+ FLAC_CHMODE_RIGHT_SIDE = 2,
+ FLAC_CHMODE_MID_SIDE = 3,
};
enum {
@@ -137,4 +137,7 @@ int ff_flac_get_max_frame_size(int blocksize, int ch, int bps);
*/
int ff_flac_decode_frame_header(AVCodecContext *avctx, GetBitContext *gb,
FLACFrameInfo *fi, int log_level_offset);
+
+void ff_flac_set_channel_layout(AVCodecContext *avctx);
+
#endif /* AVCODEC_FLAC_H */
diff --git a/gst-libs/ext/libav/libavcodec/flac_parser.c b/gst-libs/ext/libav/libavcodec/flac_parser.c
index 87f3f95..3d8e17f 100644
--- a/gst-libs/ext/libav/libavcodec/flac_parser.c
+++ b/gst-libs/ext/libav/libavcodec/flac_parser.c
@@ -71,6 +71,7 @@ typedef struct FLACHeaderMarker {
} FLACHeaderMarker;
typedef struct FLACParseContext {
+ AVCodecParserContext *pc; /**< parent context */
AVCodecContext *avctx; /**< codec context pointer for logging */
FLACHeaderMarker *headers; /**< linked-list that starts at the first
CRC-8 verified header within buffer */
@@ -456,9 +457,13 @@ static int get_best_header(FLACParseContext* fpc, const uint8_t **poutbuf,
check_header_mismatch(fpc, header, child, 0);
}
+ if (header->fi.channels != fpc->avctx->channels ||
+ (!fpc->avctx->channel_layout && header->fi.channels <= 6)) {
+ fpc->avctx->channels = header->fi.channels;
+ ff_flac_set_channel_layout(fpc->avctx);
+ }
fpc->avctx->sample_rate = header->fi.samplerate;
- fpc->avctx->channels = header->fi.channels;
- fpc->avctx->frame_size = header->fi.blocksize;
+ fpc->pc->duration = header->fi.blocksize;
*poutbuf = flac_fifo_read_wrap(fpc, header->offset, *poutbuf_size,
&fpc->wrap_buf,
&fpc->wrap_buf_allocated_size);
@@ -484,7 +489,7 @@ static int flac_parse(AVCodecParserContext *s, AVCodecContext *avctx,
if (s->flags & PARSER_FLAG_COMPLETE_FRAMES) {
FLACFrameInfo fi;
if (frame_header_is_valid(avctx, buf, &fi))
- avctx->frame_size = fi.blocksize;
+ s->duration = fi.blocksize;
*poutbuf = buf;
*poutbuf_size = buf_size;
return buf_size;
@@ -572,8 +577,7 @@ static int flac_parse(AVCodecParserContext *s, AVCodecContext *avctx,
av_fifo_generic_write(fpc->fifo_buf, (void*) read_start,
read_end - read_start, NULL);
} else {
- int8_t pad[MAX_FRAME_HEADER_SIZE];
- memset(pad, 0, sizeof(pad));
+ int8_t pad[MAX_FRAME_HEADER_SIZE] = { 0 };
av_fifo_generic_write(fpc->fifo_buf, (void*) pad, sizeof(pad), NULL);
}
@@ -630,8 +634,8 @@ static int flac_parse(AVCodecParserContext *s, AVCodecContext *avctx,
av_log(avctx, AV_LOG_DEBUG, "Junk frame till offset %i\n",
fpc->best_header->offset);
- /* Set frame_size to 0. It is unknown or invalid in a junk frame. */
- avctx->frame_size = 0;
+ /* Set duration to 0. It is unknown or invalid in a junk frame. */
+ s->duration = 0;
*poutbuf_size = fpc->best_header->offset;
*poutbuf = flac_fifo_read_wrap(fpc, 0, *poutbuf_size,
&fpc->wrap_buf,
@@ -652,6 +656,7 @@ handle_error:
static int flac_parse_init(AVCodecParserContext *c)
{
FLACParseContext *fpc = c->priv_data;
+ fpc->pc = c;
/* There will generally be FLAC_MIN_HEADERS buffered in the fifo before
it drains. This is allocated early to avoid slow reallocation. */
fpc->fifo_buf = av_fifo_alloc(FLAC_AVG_FRAME_SIZE * (FLAC_MIN_HEADERS + 3));
@@ -674,7 +679,7 @@ static void flac_parse_close(AVCodecParserContext *c)
}
AVCodecParser ff_flac_parser = {
- .codec_ids = { CODEC_ID_FLAC },
+ .codec_ids = { AV_CODEC_ID_FLAC },
.priv_data_size = sizeof(FLACParseContext),
.parser_init = flac_parse_init,
.parser_parse = flac_parse,
diff --git a/gst-libs/ext/libav/libavcodec/flacdec.c b/gst-libs/ext/libav/libavcodec/flacdec.c
index 440a55d..51fd196 100644
--- a/gst-libs/ext/libav/libavcodec/flacdec.c
+++ b/gst-libs/ext/libav/libavcodec/flacdec.c
@@ -33,6 +33,7 @@
#include <limits.h>
+#include "libavutil/channel_layout.h"
#include "libavutil/crc.h"
#include "avcodec.h"
#include "internal.h"
@@ -41,6 +42,7 @@
#include "golomb.h"
#include "flac.h"
#include "flacdata.h"
+#include "flacdsp.h"
#undef NDEBUG
#include <assert.h>
@@ -53,53 +55,49 @@ typedef struct FLACContext {
GetBitContext gb; ///< GetBitContext initialized to start at the current frame
int blocksize; ///< number of samples in the current frame
- int curr_bps; ///< bps for current subframe, adjusted for channel correlation and wasted bits
int sample_shift; ///< shift required to make output samples 16-bit or 32-bit
- int is32; ///< flag to indicate if output should be 32-bit instead of 16-bit
int ch_mode; ///< channel decorrelation type in the current frame
int got_streaminfo; ///< indicates if the STREAMINFO has been read
int32_t *decoded[FLAC_MAX_CHANNELS]; ///< decoded samples
+ uint8_t *decoded_buffer;
+ unsigned int decoded_buffer_size;
+
+ FLACDSPContext dsp;
} FLACContext;
-static void allocate_buffers(FLACContext *s);
+static int allocate_buffers(FLACContext *s);
-int avpriv_flac_is_extradata_valid(AVCodecContext *avctx,
- enum FLACExtradataFormat *format,
- uint8_t **streaminfo_start)
+static void flac_set_bps(FLACContext *s)
{
- if (!avctx->extradata || avctx->extradata_size < FLAC_STREAMINFO_SIZE) {
- av_log(avctx, AV_LOG_ERROR, "extradata NULL or too small.\n");
- return 0;
- }
- if (AV_RL32(avctx->extradata) != MKTAG('f','L','a','C')) {
- /* extradata contains STREAMINFO only */
- if (avctx->extradata_size != FLAC_STREAMINFO_SIZE) {
- av_log(avctx, AV_LOG_WARNING, "extradata contains %d bytes too many.\n",
- FLAC_STREAMINFO_SIZE-avctx->extradata_size);
- }
- *format = FLAC_EXTRADATA_FORMAT_STREAMINFO;
- *streaminfo_start = avctx->extradata;
+ enum AVSampleFormat req = s->avctx->request_sample_fmt;
+ int need32 = s->bps > 16;
+ int want32 = av_get_bytes_per_sample(req) > 2;
+ int planar = av_sample_fmt_is_planar(req);
+
+ if (need32 || want32) {
+ if (planar)
+ s->avctx->sample_fmt = AV_SAMPLE_FMT_S32P;
+ else
+ s->avctx->sample_fmt = AV_SAMPLE_FMT_S32;
+ s->sample_shift = 32 - s->bps;
} else {
- if (avctx->extradata_size < 8+FLAC_STREAMINFO_SIZE) {
- av_log(avctx, AV_LOG_ERROR, "extradata too small.\n");
- return 0;
- }
- *format = FLAC_EXTRADATA_FORMAT_FULL_HEADER;
- *streaminfo_start = &avctx->extradata[8];
+ if (planar)
+ s->avctx->sample_fmt = AV_SAMPLE_FMT_S16P;
+ else
+ s->avctx->sample_fmt = AV_SAMPLE_FMT_S16;
+ s->sample_shift = 16 - s->bps;
}
- return 1;
}
static av_cold int flac_decode_init(AVCodecContext *avctx)
{
enum FLACExtradataFormat format;
uint8_t *streaminfo;
+ int ret;
FLACContext *s = avctx->priv_data;
s->avctx = avctx;
- avctx->sample_fmt = AV_SAMPLE_FMT_S16;
-
/* for now, the raw FLAC header is allowed to be passed to the decoder as
frame data instead of extradata. */
if (!avctx->extradata)
@@ -110,11 +108,11 @@ static av_cold int flac_decode_init(AVCodecContext *avctx)
/* initialize based on the demuxer-supplied streamdata header */
avpriv_flac_parse_streaminfo(avctx, (FLACStreaminfo *)s, streaminfo);
- if (s->bps > 16)
- avctx->sample_fmt = AV_SAMPLE_FMT_S32;
- else
- avctx->sample_fmt = AV_SAMPLE_FMT_S16;
- allocate_buffers(s);
+ ret = allocate_buffers(s);
+ if (ret < 0)
+ return ret;
+ flac_set_bps(s);
+ ff_flacdsp_init(&s->dsp, avctx->sample_fmt, s->bps);
s->got_streaminfo = 1;
avcodec_get_frame_defaults(&s->frame);
@@ -132,62 +130,24 @@ static void dump_headers(AVCodecContext *avctx, FLACStreaminfo *s)
av_log(avctx, AV_LOG_DEBUG, " Bits: %d\n", s->bps);
}
-static void allocate_buffers(FLACContext *s)
+static int allocate_buffers(FLACContext *s)
{
- int i;
+ int buf_size;
assert(s->max_blocksize);
- for (i = 0; i < s->channels; i++) {
- s->decoded[i] = av_realloc(s->decoded[i],
- sizeof(int32_t)*s->max_blocksize);
- }
-}
-
-void avpriv_flac_parse_streaminfo(AVCodecContext *avctx, struct FLACStreaminfo *s,
- const uint8_t *buffer)
-{
- GetBitContext gb;
- init_get_bits(&gb, buffer, FLAC_STREAMINFO_SIZE*8);
-
- skip_bits(&gb, 16); /* skip min blocksize */
- s->max_blocksize = get_bits(&gb, 16);
- if (s->max_blocksize < FLAC_MIN_BLOCKSIZE) {
- av_log(avctx, AV_LOG_WARNING, "invalid max blocksize: %d\n",
- s->max_blocksize);
- s->max_blocksize = 16;
- }
-
- skip_bits(&gb, 24); /* skip min frame size */
- s->max_framesize = get_bits_long(&gb, 24);
-
- s->samplerate = get_bits_long(&gb, 20);
- s->channels = get_bits(&gb, 3) + 1;
- s->bps = get_bits(&gb, 5) + 1;
-
- avctx->channels = s->channels;
- avctx->sample_rate = s->samplerate;
- avctx->bits_per_raw_sample = s->bps;
-
- s->samples = get_bits_long(&gb, 32) << 4;
- s->samples |= get_bits(&gb, 4);
-
- skip_bits_long(&gb, 64); /* md5 sum */
- skip_bits_long(&gb, 64); /* md5 sum */
+ buf_size = av_samples_get_buffer_size(NULL, s->channels, s->max_blocksize,
+ AV_SAMPLE_FMT_S32P, 0);
+ if (buf_size < 0)
+ return buf_size;
- dump_headers(avctx, s);
-}
+ av_fast_malloc(&s->decoded_buffer, &s->decoded_buffer_size, buf_size);
+ if (!s->decoded_buffer)
+ return AVERROR(ENOMEM);
-void avpriv_flac_parse_block_header(const uint8_t *block_header,
- int *last, int *type, int *size)
-{
- int tmp = bytestream_get_byte(&block_header);
- if (last)
- *last = tmp & 0x80;
- if (type)
- *type = tmp & 0x7F;
- if (size)
- *size = bytestream_get_be24(&block_header);
+ return av_samples_fill_arrays((uint8_t **)s->decoded, NULL,
+ s->decoded_buffer, s->channels,
+ s->max_blocksize, AV_SAMPLE_FMT_S32P, 0);
}
/**
@@ -199,7 +159,7 @@ void avpriv_flac_parse_block_header(const uint8_t *block_header,
*/
static int parse_streaminfo(FLACContext *s, const uint8_t *buf, int buf_size)
{
- int metadata_type, metadata_size;
+ int metadata_type, metadata_size, ret;
if (buf_size < FLAC_STREAMINFO_SIZE+8) {
/* need more data */
@@ -211,7 +171,11 @@ static int parse_streaminfo(FLACContext *s, const uint8_t *buf, int buf_size)
return AVERROR_INVALIDDATA;
}
avpriv_flac_parse_streaminfo(s->avctx, (FLACStreaminfo *)s, &buf[8]);
- allocate_buffers(s);
+ ret = allocate_buffers(s);
+ if (ret < 0)
+ return ret;
+ flac_set_bps(s);
+ ff_flacdsp_init(&s->dsp, s->avctx->sample_fmt, s->bps);
s->got_streaminfo = 1;
return 0;
@@ -244,10 +208,11 @@ static int get_metadata_size(const uint8_t *buf, int buf_size)
return buf_size - (buf_end - buf);
}
-static int decode_residuals(FLACContext *s, int channel, int pred_order)
+static int decode_residuals(FLACContext *s, int32_t *decoded, int pred_order)
{
int i, tmp, partition, method_type, rice_order;
- int sample = 0, samples;
+ int rice_bits, rice_esc;
+ int samples;
method_type = get_bits(&s->gb, 2);
if (method_type > 1) {
@@ -265,17 +230,20 @@ static int decode_residuals(FLACContext *s, int channel, int pred_order)
return -1;
}
- sample=
+ rice_bits = 4 + method_type;
+ rice_esc = (1 << rice_bits) - 1;
+
+ decoded += pred_order;
i= pred_order;
for (partition = 0; partition < (1 << rice_order); partition++) {
- tmp = get_bits(&s->gb, method_type == 0 ? 4 : 5);
- if (tmp == (method_type == 0 ? 15 : 31)) {
+ tmp = get_bits(&s->gb, rice_bits);
+ if (tmp == rice_esc) {
tmp = get_bits(&s->gb, 5);
- for (; i < samples; i++, sample++)
- s->decoded[channel][sample] = get_sbits_long(&s->gb, tmp);
+ for (; i < samples; i++)
+ *decoded++ = get_sbits_long(&s->gb, tmp);
} else {
- for (; i < samples; i++, sample++) {
- s->decoded[channel][sample] = get_sr_golomb_flac(&s->gb, tmp, INT_MAX, 0);
+ for (; i < samples; i++) {
+ *decoded++ = get_sr_golomb_flac(&s->gb, tmp, INT_MAX, 0);
}
}
i= 0;
@@ -284,18 +252,18 @@ static int decode_residuals(FLACContext *s, int channel, int pred_order)
return 0;
}
-static int decode_subframe_fixed(FLACContext *s, int channel, int pred_order)
+static int decode_subframe_fixed(FLACContext *s, int32_t *decoded,
+ int pred_order, int bps)
{
const int blocksize = s->blocksize;
- int32_t *decoded = s->decoded[channel];
- int av_uninit(a), av_uninit(b), av_uninit(c), av_uninit(d), i;
+ int a, b, c, d, i;
/* warm up samples */
for (i = 0; i < pred_order; i++) {
- decoded[i] = get_sbits_long(&s->gb, s->curr_bps);
+ decoded[i] = get_sbits_long(&s->gb, bps);
}
- if (decode_residuals(s, channel, pred_order) < 0)
+ if (decode_residuals(s, decoded, pred_order) < 0)
return -1;
if (pred_order > 0)
@@ -334,16 +302,16 @@ static int decode_subframe_fixed(FLACContext *s, int channel, int pred_order)
return 0;
}
-static int decode_subframe_lpc(FLACContext *s, int channel, int pred_order)
+static int decode_subframe_lpc(FLACContext *s, int32_t *decoded, int pred_order,
+ int bps)
{
- int i, j;
+ int i;
int coeff_prec, qlevel;
int coeffs[32];
- int32_t *decoded = s->decoded[channel];
/* warm up samples */
for (i = 0; i < pred_order; i++) {
- decoded[i] = get_sbits_long(&s->gb, s->curr_bps);
+ decoded[i] = get_sbits_long(&s->gb, bps);
}
coeff_prec = get_bits(&s->gb, 4) + 1;
@@ -359,60 +327,30 @@ static int decode_subframe_lpc(FLACContext *s, int channel, int pred_order)
}
for (i = 0; i < pred_order; i++) {
- coeffs[i] = get_sbits(&s->gb, coeff_prec);
+ coeffs[pred_order - i - 1] = get_sbits(&s->gb, coeff_prec);
}
- if (decode_residuals(s, channel, pred_order) < 0)
+ if (decode_residuals(s, decoded, pred_order) < 0)
return -1;
- if (s->bps > 16) {
- int64_t sum;
- for (i = pred_order; i < s->blocksize; i++) {
- sum = 0;
- for (j = 0; j < pred_order; j++)
- sum += (int64_t)coeffs[j] * decoded[i-j-1];
- decoded[i] += sum >> qlevel;
- }
- } else {
- for (i = pred_order; i < s->blocksize-1; i += 2) {
- int c;
- int d = decoded[i-pred_order];
- int s0 = 0, s1 = 0;
- for (j = pred_order-1; j > 0; j--) {
- c = coeffs[j];
- s0 += c*d;
- d = decoded[i-j];
- s1 += c*d;
- }
- c = coeffs[0];
- s0 += c*d;
- d = decoded[i] += s0 >> qlevel;
- s1 += c*d;
- decoded[i+1] += s1 >> qlevel;
- }
- if (i < s->blocksize) {
- int sum = 0;
- for (j = 0; j < pred_order; j++)
- sum += coeffs[j] * decoded[i-j-1];
- decoded[i] += sum >> qlevel;
- }
- }
+ s->dsp.lpc(decoded, coeffs, pred_order, qlevel, s->blocksize);
return 0;
}
static inline int decode_subframe(FLACContext *s, int channel)
{
+ int32_t *decoded = s->decoded[channel];
int type, wasted = 0;
+ int bps = s->bps;
int i, tmp;
- s->curr_bps = s->bps;
if (channel == 0) {
if (s->ch_mode == FLAC_CHMODE_RIGHT_SIDE)
- s->curr_bps++;
+ bps++;
} else {
if (s->ch_mode == FLAC_CHMODE_LEFT_SIDE || s->ch_mode == FLAC_CHMODE_MID_SIDE)
- s->curr_bps++;
+ bps++;
}
if (get_bits1(&s->gb)) {
@@ -425,35 +363,35 @@ static inline int decode_subframe(FLACContext *s, int channel)
int left = get_bits_left(&s->gb);
wasted = 1;
if ( left < 0 ||
- (left < s->curr_bps && !show_bits_long(&s->gb, left)) ||
- !show_bits_long(&s->gb, s->curr_bps)) {
+ (left < bps && !show_bits_long(&s->gb, left)) ||
+ !show_bits_long(&s->gb, bps)) {
av_log(s->avctx, AV_LOG_ERROR,
"Invalid number of wasted bits > available bits (%d) - left=%d\n",
- s->curr_bps, left);
+ bps, left);
return AVERROR_INVALIDDATA;
}
while (!get_bits1(&s->gb))
wasted++;
- s->curr_bps -= wasted;
+ bps -= wasted;
}
- if (s->curr_bps > 32) {
- av_log_missing_feature(s->avctx, "decorrelated bit depth > 32", 0);
- return -1;
+ if (bps > 32) {
+ av_log_missing_feature(s->avctx, "Decorrelated bit depth > 32", 0);
+ return AVERROR_PATCHWELCOME;
}
//FIXME use av_log2 for types
if (type == 0) {
- tmp = get_sbits_long(&s->gb, s->curr_bps);
+ tmp = get_sbits_long(&s->gb, bps);
for (i = 0; i < s->blocksize; i++)
- s->decoded[channel][i] = tmp;
+ decoded[i] = tmp;
} else if (type == 1) {
for (i = 0; i < s->blocksize; i++)
- s->decoded[channel][i] = get_sbits_long(&s->gb, s->curr_bps);
+ decoded[i] = get_sbits_long(&s->gb, bps);
} else if ((type >= 8) && (type <= 12)) {
- if (decode_subframe_fixed(s, channel, type & ~0x8) < 0)
+ if (decode_subframe_fixed(s, decoded, type & ~0x8, bps) < 0)
return -1;
} else if (type >= 32) {
- if (decode_subframe_lpc(s, channel, (type & ~0x20)+1) < 0)
+ if (decode_subframe_lpc(s, decoded, (type & ~0x20)+1, bps) < 0)
return -1;
} else {
av_log(s->avctx, AV_LOG_ERROR, "invalid coding type\n");
@@ -463,7 +401,7 @@ static inline int decode_subframe(FLACContext *s, int channel)
if (wasted) {
int i;
for (i = 0; i < s->blocksize; i++)
- s->decoded[channel][i] <<= wasted;
+ decoded[i] <<= wasted;
}
return 0;
@@ -471,7 +409,7 @@ static inline int decode_subframe(FLACContext *s, int channel)
static int decode_frame(FLACContext *s)
{
- int i;
+ int i, ret;
GetBitContext *gb = &s->gb;
FLACFrameInfo fi;
@@ -480,12 +418,16 @@ static int decode_frame(FLACContext *s)
return -1;
}
- if (s->channels && fi.channels != s->channels) {
- av_log(s->avctx, AV_LOG_ERROR, "switching channel layout mid-stream "
- "is not supported\n");
- return -1;
+ if (s->channels && fi.channels != s->channels && s->got_streaminfo) {
+ s->channels = s->avctx->channels = fi.channels;
+ ff_flac_set_channel_layout(s->avctx);
+ ret = allocate_buffers(s);
+ if (ret < 0)
+ return ret;
}
s->channels = s->avctx->channels = fi.channels;
+ if (!s->avctx->channel_layout && s->channels <= 6)
+ ff_flac_set_channel_layout(s->avctx);
s->ch_mode = fi.ch_mode;
if (!s->bps && !fi.bps) {
@@ -499,16 +441,10 @@ static int decode_frame(FLACContext *s)
"supported\n");
return -1;
}
- s->bps = s->avctx->bits_per_raw_sample = fi.bps;
- if (s->bps > 16) {
- s->avctx->sample_fmt = AV_SAMPLE_FMT_S32;
- s->sample_shift = 32 - s->bps;
- s->is32 = 1;
- } else {
- s->avctx->sample_fmt = AV_SAMPLE_FMT_S16;
- s->sample_shift = 16 - s->bps;
- s->is32 = 0;
+ if (!s->bps) {
+ s->bps = s->avctx->bits_per_raw_sample = fi.bps;
+ flac_set_bps(s);
}
if (!s->max_blocksize)
@@ -525,16 +461,15 @@ static int decode_frame(FLACContext *s)
" or frame header\n");
return -1;
}
- if (fi.samplerate == 0) {
+ if (fi.samplerate == 0)
fi.samplerate = s->samplerate;
- } else if (s->samplerate && fi.samplerate != s->samplerate) {
- av_log(s->avctx, AV_LOG_WARNING, "sample rate changed from %d to %d\n",
- s->samplerate, fi.samplerate);
- }
s->samplerate = s->avctx->sample_rate = fi.samplerate;
if (!s->got_streaminfo) {
- allocate_buffers(s);
+ ret = allocate_buffers(s);
+ if (ret < 0)
+ return ret;
+ ff_flacdsp_init(&s->dsp, s->avctx->sample_fmt, s->bps);
s->got_streaminfo = 1;
dump_headers(s->avctx, (FLACStreaminfo *)s);
}
@@ -561,9 +496,7 @@ static int flac_decode_frame(AVCodecContext *avctx, void *data,
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
FLACContext *s = avctx->priv_data;
- int i, j = 0, bytes_read = 0;
- int16_t *samples_16;
- int32_t *samples_32;
+ int bytes_read = 0;
int ret;
*got_frame_ptr = 0;
@@ -599,46 +532,13 @@ static int flac_decode_frame(AVCodecContext *avctx, void *data,
/* get output buffer */
s->frame.nb_samples = s->blocksize;
- if ((ret = avctx->get_buffer(avctx, &s->frame)) < 0) {
+ if ((ret = ff_get_buffer(avctx, &s->frame)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return ret;
}
- samples_16 = (int16_t *)s->frame.data[0];
- samples_32 = (int32_t *)s->frame.data[0];
-
-#define DECORRELATE(left, right)\
- assert(s->channels == 2);\
- for (i = 0; i < s->blocksize; i++) {\
- int a= s->decoded[0][i];\
- int b= s->decoded[1][i];\
- if (s->is32) {\
- *samples_32++ = (left) << s->sample_shift;\
- *samples_32++ = (right) << s->sample_shift;\
- } else {\
- *samples_16++ = (left) << s->sample_shift;\
- *samples_16++ = (right) << s->sample_shift;\
- }\
- }\
- break;
-
- switch (s->ch_mode) {
- case FLAC_CHMODE_INDEPENDENT:
- for (j = 0; j < s->blocksize; j++) {
- for (i = 0; i < s->channels; i++) {
- if (s->is32)
- *samples_32++ = s->decoded[i][j] << s->sample_shift;
- else
- *samples_16++ = s->decoded[i][j] << s->sample_shift;
- }
- }
- break;
- case FLAC_CHMODE_LEFT_SIDE:
- DECORRELATE(a,a-b)
- case FLAC_CHMODE_RIGHT_SIDE:
- DECORRELATE(a+b,b)
- case FLAC_CHMODE_MID_SIDE:
- DECORRELATE( (a-=b>>1) + b, a)
- }
+
+ s->dsp.decorrelate[s->ch_mode](s->frame.data, s->decoded, s->channels,
+ s->blocksize, s->sample_shift);
if (bytes_read > buf_size) {
av_log(s->avctx, AV_LOG_ERROR, "overread: %d\n", bytes_read - buf_size);
@@ -658,11 +558,8 @@ static int flac_decode_frame(AVCodecContext *avctx, void *data,
static av_cold int flac_decode_close(AVCodecContext *avctx)
{
FLACContext *s = avctx->priv_data;
- int i;
- for (i = 0; i < s->channels; i++) {
- av_freep(&s->decoded[i]);
- }
+ av_freep(&s->decoded_buffer);
return 0;
}
@@ -670,11 +567,16 @@ static av_cold int flac_decode_close(AVCodecContext *avctx)
AVCodec ff_flac_decoder = {
.name = "flac",
.type = AVMEDIA_TYPE_AUDIO,
- .id = CODEC_ID_FLAC,
+ .id = AV_CODEC_ID_FLAC,
.priv_data_size = sizeof(FLACContext),
.init = flac_decode_init,
.close = flac_decode_close,
.decode = flac_decode_frame,
.capabilities = CODEC_CAP_DR1,
- .long_name= NULL_IF_CONFIG_SMALL("FLAC (Free Lossless Audio Codec)"),
+ .long_name = NULL_IF_CONFIG_SMALL("FLAC (Free Lossless Audio Codec)"),
+ .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_S16,
+ AV_SAMPLE_FMT_S16P,
+ AV_SAMPLE_FMT_S32,
+ AV_SAMPLE_FMT_S32P,
+ -1 },
};
diff --git a/gst-libs/ext/libav/libavcodec/flacdsp.c b/gst-libs/ext/libav/libavcodec/flacdsp.c
new file mode 100644
index 0000000..b916869
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/flacdsp.c
@@ -0,0 +1,131 @@
+/*
+ * Copyright (c) 2012 Mans Rullgard <mans@mansr.com>
+ *
+ * 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
+ */
+
+#include "libavutil/attributes.h"
+#include "libavutil/samplefmt.h"
+#include "flacdsp.h"
+#include "config.h"
+
+#define SAMPLE_SIZE 16
+#define PLANAR 0
+#include "flacdsp_template.c"
+#include "flacdsp_lpc_template.c"
+
+#undef PLANAR
+#define PLANAR 1
+#include "flacdsp_template.c"
+
+#undef SAMPLE_SIZE
+#undef PLANAR
+#define SAMPLE_SIZE 32
+#define PLANAR 0
+#include "flacdsp_template.c"
+#include "flacdsp_lpc_template.c"
+
+#undef PLANAR
+#define PLANAR 1
+#include "flacdsp_template.c"
+
+static void flac_lpc_16_c(int32_t *decoded, const int coeffs[32],
+ int pred_order, int qlevel, int len)
+{
+ int i, j;
+
+ for (i = pred_order; i < len - 1; i += 2, decoded += 2) {
+ int c = coeffs[0];
+ int d = decoded[0];
+ int s0 = 0, s1 = 0;
+ for (j = 1; j < pred_order; j++) {
+ s0 += c*d;
+ d = decoded[j];
+ s1 += c*d;
+ c = coeffs[j];
+ }
+ s0 += c*d;
+ d = decoded[j] += s0 >> qlevel;
+ s1 += c*d;
+ decoded[j + 1] += s1 >> qlevel;
+ }
+ if (i < len) {
+ int sum = 0;
+ for (j = 0; j < pred_order; j++)
+ sum += coeffs[j] * decoded[j];
+ decoded[j] += sum >> qlevel;
+ }
+}
+
+static void flac_lpc_32_c(int32_t *decoded, const int coeffs[32],
+ int pred_order, int qlevel, int len)
+{
+ int i, j;
+
+ for (i = pred_order; i < len; i++, decoded++) {
+ int64_t sum = 0;
+ for (j = 0; j < pred_order; j++)
+ sum += (int64_t)coeffs[j] * decoded[j];
+ decoded[j] += sum >> qlevel;
+ }
+
+}
+
+av_cold void ff_flacdsp_init(FLACDSPContext *c, enum AVSampleFormat fmt,
+ int bps)
+{
+ if (bps > 16) {
+ c->lpc = flac_lpc_32_c;
+ c->lpc_encode = flac_lpc_encode_c_32;
+ } else {
+ c->lpc = flac_lpc_16_c;
+ c->lpc_encode = flac_lpc_encode_c_16;
+ }
+
+ switch (fmt) {
+ case AV_SAMPLE_FMT_S32:
+ c->decorrelate[0] = flac_decorrelate_indep_c_32;
+ c->decorrelate[1] = flac_decorrelate_ls_c_32;
+ c->decorrelate[2] = flac_decorrelate_rs_c_32;
+ c->decorrelate[3] = flac_decorrelate_ms_c_32;
+ break;
+
+ case AV_SAMPLE_FMT_S32P:
+ c->decorrelate[0] = flac_decorrelate_indep_c_32p;
+ c->decorrelate[1] = flac_decorrelate_ls_c_32p;
+ c->decorrelate[2] = flac_decorrelate_rs_c_32p;
+ c->decorrelate[3] = flac_decorrelate_ms_c_32p;
+ break;
+
+ case AV_SAMPLE_FMT_S16:
+ c->decorrelate[0] = flac_decorrelate_indep_c_16;
+ c->decorrelate[1] = flac_decorrelate_ls_c_16;
+ c->decorrelate[2] = flac_decorrelate_rs_c_16;
+ c->decorrelate[3] = flac_decorrelate_ms_c_16;
+ break;
+
+ case AV_SAMPLE_FMT_S16P:
+ c->decorrelate[0] = flac_decorrelate_indep_c_16p;
+ c->decorrelate[1] = flac_decorrelate_ls_c_16p;
+ c->decorrelate[2] = flac_decorrelate_rs_c_16p;
+ c->decorrelate[3] = flac_decorrelate_ms_c_16p;
+ break;
+ }
+
+ if (ARCH_ARM)
+ ff_flacdsp_init_arm(c, fmt, bps);
+}
diff --git a/gst-libs/ext/libav/libavcodec/flacdsp.h b/gst-libs/ext/libav/libavcodec/flacdsp.h
new file mode 100644
index 0000000..33184b5
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/flacdsp.h
@@ -0,0 +1,37 @@
+/*
+ * 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
+ */
+
+#ifndef AVCODEC_FLACDSP_H
+#define AVCODEC_FLACDSP_H
+
+#include <stdint.h>
+#include "libavutil/samplefmt.h"
+
+typedef struct FLACDSPContext {
+ void (*decorrelate[4])(uint8_t **out, int32_t **in, int channels,
+ int len, int shift);
+ void (*lpc)(int32_t *samples, const int coeffs[32], int order,
+ int qlevel, int len);
+ void (*lpc_encode)(int32_t *res, const int32_t *smp, int len, int order,
+ const int32_t *coefs, int shift);
+} FLACDSPContext;
+
+void ff_flacdsp_init(FLACDSPContext *c, enum AVSampleFormat fmt, int bps);
+void ff_flacdsp_init_arm(FLACDSPContext *c, enum AVSampleFormat fmt, int bps);
+
+#endif /* AVCODEC_FLACDSP_H */
diff --git a/gst-libs/ext/libav/libavcodec/flacdsp_lpc_template.c b/gst-libs/ext/libav/libavcodec/flacdsp_lpc_template.c
new file mode 100644
index 0000000..269e64b
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/flacdsp_lpc_template.c
@@ -0,0 +1,141 @@
+/*
+ * 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
+ */
+
+#include <stdint.h>
+#include "libavutil/avutil.h"
+#include "mathops.h"
+
+#undef FUNC
+#undef sum_type
+#undef MUL
+#undef CLIP
+#undef FSUF
+
+#define FUNC(n) AV_JOIN(n ## _, SAMPLE_SIZE)
+
+#if SAMPLE_SIZE == 32
+# define sum_type int64_t
+# define MUL(a, b) MUL64(a, b)
+# define CLIP(x) av_clipl_int32(x)
+#else
+# define sum_type int32_t
+# define MUL(a, b) ((a) * (b))
+# define CLIP(x) (x)
+#endif
+
+#define LPC1(x) { \
+ int c = coefs[(x)-1]; \
+ p0 += MUL(c, s); \
+ s = smp[i-(x)+1]; \
+ p1 += MUL(c, s); \
+}
+
+static av_always_inline void FUNC(lpc_encode_unrolled)(int32_t *res,
+ const int32_t *smp, int len, int order,
+ const int32_t *coefs, int shift, int big)
+{
+ int i;
+ for (i = order; i < len; i += 2) {
+ int s = smp[i-order];
+ sum_type p0 = 0, p1 = 0;
+ if (big) {
+ switch (order) {
+ case 32: LPC1(32)
+ case 31: LPC1(31)
+ case 30: LPC1(30)
+ case 29: LPC1(29)
+ case 28: LPC1(28)
+ case 27: LPC1(27)
+ case 26: LPC1(26)
+ case 25: LPC1(25)
+ case 24: LPC1(24)
+ case 23: LPC1(23)
+ case 22: LPC1(22)
+ case 21: LPC1(21)
+ case 20: LPC1(20)
+ case 19: LPC1(19)
+ case 18: LPC1(18)
+ case 17: LPC1(17)
+ case 16: LPC1(16)
+ case 15: LPC1(15)
+ case 14: LPC1(14)
+ case 13: LPC1(13)
+ case 12: LPC1(12)
+ case 11: LPC1(11)
+ case 10: LPC1(10)
+ case 9: LPC1( 9)
+ LPC1( 8)
+ LPC1( 7)
+ LPC1( 6)
+ LPC1( 5)
+ LPC1( 4)
+ LPC1( 3)
+ LPC1( 2)
+ LPC1( 1)
+ }
+ } else {
+ switch (order) {
+ case 8: LPC1( 8)
+ case 7: LPC1( 7)
+ case 6: LPC1( 6)
+ case 5: LPC1( 5)
+ case 4: LPC1( 4)
+ case 3: LPC1( 3)
+ case 2: LPC1( 2)
+ case 1: LPC1( 1)
+ }
+ }
+ res[i ] = smp[i ] - CLIP(p0 >> shift);
+ res[i+1] = smp[i+1] - CLIP(p1 >> shift);
+ }
+}
+
+static void FUNC(flac_lpc_encode_c)(int32_t *res, const int32_t *smp, int len,
+ int order, const int32_t *coefs, int shift)
+{
+ int i;
+ for (i = 0; i < order; i++)
+ res[i] = smp[i];
+#if CONFIG_SMALL
+ for (i = order; i < len; i += 2) {
+ int j;
+ int s = smp[i];
+ sum_type p0 = 0, p1 = 0;
+ for (j = 0; j < order; j++) {
+ int c = coefs[j];
+ p1 += MUL(c, s);
+ s = smp[i-j-1];
+ p0 += MUL(c, s);
+ }
+ res[i ] = smp[i ] - CLIP(p0 >> shift);
+ res[i+1] = smp[i+1] - CLIP(p1 >> shift);
+ }
+#else
+ switch (order) {
+ case 1: FUNC(lpc_encode_unrolled)(res, smp, len, 1, coefs, shift, 0); break;
+ case 2: FUNC(lpc_encode_unrolled)(res, smp, len, 2, coefs, shift, 0); break;
+ case 3: FUNC(lpc_encode_unrolled)(res, smp, len, 3, coefs, shift, 0); break;
+ case 4: FUNC(lpc_encode_unrolled)(res, smp, len, 4, coefs, shift, 0); break;
+ case 5: FUNC(lpc_encode_unrolled)(res, smp, len, 5, coefs, shift, 0); break;
+ case 6: FUNC(lpc_encode_unrolled)(res, smp, len, 6, coefs, shift, 0); break;
+ case 7: FUNC(lpc_encode_unrolled)(res, smp, len, 7, coefs, shift, 0); break;
+ case 8: FUNC(lpc_encode_unrolled)(res, smp, len, 8, coefs, shift, 0); break;
+ default: FUNC(lpc_encode_unrolled)(res, smp, len, order, coefs, shift, 1); break;
+ }
+#endif
+}
diff --git a/gst-libs/ext/libav/libavcodec/flacdsp_template.c b/gst-libs/ext/libav/libavcodec/flacdsp_template.c
new file mode 100644
index 0000000..0affe22
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/flacdsp_template.c
@@ -0,0 +1,103 @@
+/*
+ * Copyright (c) 2012 Mans Rullgard <mans@mansr.com>
+ *
+ * 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
+ */
+
+#include <stdint.h>
+#include "libavutil/avutil.h"
+
+#undef FUNC
+#undef FSUF
+#undef sample
+#undef sample_type
+#undef OUT
+#undef S
+
+#if SAMPLE_SIZE == 32
+# define sample_type int32_t
+#else
+# define sample_type int16_t
+#endif
+
+#if PLANAR
+# define FSUF AV_JOIN(SAMPLE_SIZE, p)
+# define sample sample_type *
+# define OUT(n) n
+# define S(s, c, i) (s[c][i])
+#else
+# define FSUF SAMPLE_SIZE
+# define sample sample_type
+# define OUT(n) n[0]
+# define S(s, c, i) (*s++)
+#endif
+
+#define FUNC(n) AV_JOIN(n ## _, FSUF)
+
+static void FUNC(flac_decorrelate_indep_c)(uint8_t **out, int32_t **in,
+ int channels, int len, int shift)
+{
+ sample *samples = (sample *) OUT(out);
+ int i, j;
+
+ for (j = 0; j < len; j++)
+ for (i = 0; i < channels; i++)
+ S(samples, i, j) = in[i][j] << shift;
+}
+
+static void FUNC(flac_decorrelate_ls_c)(uint8_t **out, int32_t **in,
+ int channels, int len, int shift)
+{
+ sample *samples = (sample *) OUT(out);
+ int i;
+
+ for (i = 0; i < len; i++) {
+ int a = in[0][i];
+ int b = in[1][i];
+ S(samples, 0, i) = a << shift;
+ S(samples, 1, i) = (a - b) << shift;
+ }
+}
+
+static void FUNC(flac_decorrelate_rs_c)(uint8_t **out, int32_t **in,
+ int channels, int len, int shift)
+{
+ sample *samples = (sample *) OUT(out);
+ int i;
+
+ for (i = 0; i < len; i++) {
+ int a = in[0][i];
+ int b = in[1][i];
+ S(samples, 0, i) = (a + b) << shift;
+ S(samples, 1, i) = b << shift;
+ }
+}
+
+static void FUNC(flac_decorrelate_ms_c)(uint8_t **out, int32_t **in,
+ int channels, int len, int shift)
+{
+ sample *samples = (sample *) OUT(out);
+ int i;
+
+ for (i = 0; i < len; i++) {
+ int a = in[0][i];
+ int b = in[1][i];
+ a -= b >> 1;
+ S(samples, 0, i) = (a + b) << shift;
+ S(samples, 1, i) = a << shift;
+ }
+}
diff --git a/gst-libs/ext/libav/libavcodec/flacenc.c b/gst-libs/ext/libav/libavcodec/flacenc.c
index 2bd4788..7808e20 100644
--- a/gst-libs/ext/libav/libavcodec/flacenc.c
+++ b/gst-libs/ext/libav/libavcodec/flacenc.c
@@ -1,4 +1,4 @@
-/**
+/*
* FLAC audio encoder
* Copyright (c) 2006 Justin Ruggles <justin.ruggles@gmail.com>
*
@@ -20,14 +20,18 @@
*/
#include "libavutil/crc.h"
+#include "libavutil/intmath.h"
#include "libavutil/md5.h"
#include "libavutil/opt.h"
#include "avcodec.h"
+#include "dsputil.h"
#include "get_bits.h"
#include "golomb.h"
+#include "internal.h"
#include "lpc.h"
#include "flac.h"
#include "flacdata.h"
+#include "flacdsp.h"
#define FLAC_SUBFRAME_CONSTANT 0
#define FLAC_SUBFRAME_VERBATIM 1
@@ -39,7 +43,11 @@
#define MAX_PARTITIONS (1 << MAX_PARTITION_ORDER)
#define MAX_LPC_PRECISION 15
#define MAX_LPC_SHIFT 15
-#define MAX_RICE_PARAM 14
+
+enum CodingMode {
+ CODING_MODE_RICE = 4,
+ CODING_MODE_RICE2 = 5,
+};
typedef struct CompressionOptions {
int compression_level;
@@ -52,9 +60,11 @@ typedef struct CompressionOptions {
int prediction_order_method;
int min_partition_order;
int max_partition_order;
+ int ch_mode;
} CompressionOptions;
typedef struct RiceContext {
+ enum CodingMode coding_mode;
int porder;
int params[MAX_PARTITIONS];
} RiceContext;
@@ -63,6 +73,7 @@ typedef struct FlacSubframe {
int type;
int type_code;
int obits;
+ int wasted;
int order;
int32_t coefs[MAX_LPC_ORDER];
int shift;
@@ -86,6 +97,7 @@ typedef struct FlacEncodeContext {
int channels;
int samplerate;
int sr_code[2];
+ int bps_code;
int max_blocksize;
int min_framesize;
int max_framesize;
@@ -98,6 +110,10 @@ typedef struct FlacEncodeContext {
AVCodecContext *avctx;
LPCContext lpc_ctx;
struct AVMD5 *md5ctx;
+ uint8_t *md5_buffer;
+ unsigned int md5_buffer_size;
+ DSPContext dsp;
+ FLACDSPContext flac_dsp;
} FlacEncodeContext;
@@ -118,7 +134,7 @@ static void write_streaminfo(FlacEncodeContext *s, uint8_t *header)
put_bits(&pb, 24, s->max_framesize);
put_bits(&pb, 20, s->samplerate);
put_bits(&pb, 3, s->channels-1);
- put_bits(&pb, 5, 15); /* bits per sample - 1 */
+ put_bits(&pb, 5, s->avctx->bits_per_raw_sample - 1);
/* write 36-bit sample count in 2 put_bits() calls */
put_bits(&pb, 24, (s->sample_count & 0xFFFFFF000LL) >> 12);
put_bits(&pb, 12, s->sample_count & 0x000000FFFLL);
@@ -218,8 +234,18 @@ static av_cold int flac_encode_init(AVCodecContext *avctx)
s->avctx = avctx;
- if (avctx->sample_fmt != AV_SAMPLE_FMT_S16)
- return -1;
+ switch (avctx->sample_fmt) {
+ case AV_SAMPLE_FMT_S16:
+ avctx->bits_per_raw_sample = 16;
+ s->bps_code = 4;
+ break;
+ case AV_SAMPLE_FMT_S32:
+ if (avctx->bits_per_raw_sample != 24)
+ av_log(avctx, AV_LOG_WARNING, "encoding as 24 bits-per-sample\n");
+ avctx->bits_per_raw_sample = 24;
+ s->bps_code = 6;
+ break;
+ }
if (channels < 1 || channels > FLAC_MAX_CHANNELS)
return -1;
@@ -295,29 +321,6 @@ static av_cold int flac_encode_init(AVCodecContext *avctx)
if (s->options.max_partition_order < 0)
s->options.max_partition_order = ((int[]){ 2, 2, 3, 3, 3, 8, 8, 8, 8, 8, 8, 8, 8})[level];
- /* set compression option overrides from AVCodecContext */
-#if FF_API_FLAC_GLOBAL_OPTS
- if (avctx->lpc_type > FF_LPC_TYPE_DEFAULT) {
- if (avctx->lpc_type > FF_LPC_TYPE_CHOLESKY) {
- av_log(avctx, AV_LOG_ERROR, "unknown lpc type: %d\n", avctx->lpc_type);
- return -1;
- }
- s->options.lpc_type = avctx->lpc_type;
- if (s->options.lpc_type == FF_LPC_TYPE_CHOLESKY) {
- if (avctx->lpc_passes < 0) {
- // default number of passes for Cholesky
- s->options.lpc_passes = 2;
- } else if (avctx->lpc_passes == 0) {
- av_log(avctx, AV_LOG_ERROR, "invalid number of lpc passes: %d\n",
- avctx->lpc_passes);
- return -1;
- } else {
- s->options.lpc_passes = avctx->lpc_passes;
- }
- }
- }
-#endif
-
if (s->options.lpc_type == FF_LPC_TYPE_NONE) {
s->options.min_prediction_order = 0;
} else if (avctx->min_prediction_order >= 0) {
@@ -358,39 +361,6 @@ static av_cold int flac_encode_init(AVCodecContext *avctx)
return -1;
}
-#if FF_API_FLAC_GLOBAL_OPTS
- if (avctx->prediction_order_method >= 0) {
- if (avctx->prediction_order_method > ORDER_METHOD_LOG) {
- av_log(avctx, AV_LOG_ERROR, "invalid prediction order method: %d\n",
- avctx->prediction_order_method);
- return -1;
- }
- s->options.prediction_order_method = avctx->prediction_order_method;
- }
-
- if (avctx->min_partition_order >= 0) {
- if (avctx->min_partition_order > MAX_PARTITION_ORDER) {
- av_log(avctx, AV_LOG_ERROR, "invalid min partition order: %d\n",
- avctx->min_partition_order);
- return -1;
- }
- s->options.min_partition_order = avctx->min_partition_order;
- }
- if (avctx->max_partition_order >= 0) {
- if (avctx->max_partition_order > MAX_PARTITION_ORDER) {
- av_log(avctx, AV_LOG_ERROR, "invalid max partition order: %d\n",
- avctx->max_partition_order);
- return -1;
- }
- s->options.max_partition_order = avctx->max_partition_order;
- }
- if (s->options.max_partition_order < s->options.min_partition_order) {
- av_log(avctx, AV_LOG_ERROR, "invalid partition orders: min=%d max=%d\n",
- s->options.min_partition_order, s->options.max_partition_order);
- return -1;
- }
-#endif
-
if (avctx->frame_size > 0) {
if (avctx->frame_size < FLAC_MIN_BLOCKSIZE ||
avctx->frame_size > FLAC_MAX_BLOCKSIZE) {
@@ -403,24 +373,13 @@ static av_cold int flac_encode_init(AVCodecContext *avctx)
}
s->max_blocksize = s->avctx->frame_size;
-#if FF_API_FLAC_GLOBAL_OPTS
- /* set LPC precision */
- if (avctx->lpc_coeff_precision > 0) {
- if (avctx->lpc_coeff_precision > MAX_LPC_PRECISION) {
- av_log(avctx, AV_LOG_ERROR, "invalid lpc coeff precision: %d\n",
- avctx->lpc_coeff_precision);
- return -1;
- }
- s->options.lpc_coeff_precision = avctx->lpc_coeff_precision;
- }
-#endif
-
/* set maximum encoded frame size in verbatim mode */
s->max_framesize = ff_flac_get_max_frame_size(s->avctx->frame_size,
- s->channels, 16);
+ s->channels,
+ s->avctx->bits_per_raw_sample);
/* initialize MD5 context */
- s->md5ctx = av_malloc(av_md5_size);
+ s->md5ctx = av_md5_alloc();
if (!s->md5ctx)
return AVERROR(ENOMEM);
av_md5_init(s->md5ctx);
@@ -435,20 +394,26 @@ static av_cold int flac_encode_init(AVCodecContext *avctx)
s->frame_count = 0;
s->min_framesize = s->max_framesize;
+#if FF_API_OLD_ENCODE_AUDIO
avctx->coded_frame = avcodec_alloc_frame();
if (!avctx->coded_frame)
return AVERROR(ENOMEM);
+#endif
ret = ff_lpc_init(&s->lpc_ctx, avctx->frame_size,
s->options.max_prediction_order, FF_LPC_TYPE_LEVINSON);
+ ff_dsputil_init(&s->dsp, avctx);
+ ff_flacdsp_init(&s->flac_dsp, avctx->sample_fmt,
+ avctx->bits_per_raw_sample);
+
dprint_compression_options(s);
return ret;
}
-static void init_frame(FlacEncodeContext *s)
+static void init_frame(FlacEncodeContext *s, int nb_samples)
{
int i, ch;
FlacFrame *frame;
@@ -456,7 +421,7 @@ static void init_frame(FlacEncodeContext *s)
frame = &s->frame;
for (i = 0; i < 16; i++) {
- if (s->avctx->frame_size == ff_flac_blocksize_table[i]) {
+ if (nb_samples == ff_flac_blocksize_table[i]) {
frame->blocksize = ff_flac_blocksize_table[i];
frame->bs_code[0] = i;
frame->bs_code[1] = 0;
@@ -464,7 +429,7 @@ static void init_frame(FlacEncodeContext *s)
}
}
if (i == 16) {
- frame->blocksize = s->avctx->frame_size;
+ frame->blocksize = nb_samples;
if (frame->blocksize <= 256) {
frame->bs_code[0] = 6;
frame->bs_code[1] = frame->blocksize-1;
@@ -474,8 +439,17 @@ static void init_frame(FlacEncodeContext *s)
}
}
- for (ch = 0; ch < s->channels; ch++)
- frame->subframes[ch].obits = 16;
+ for (ch = 0; ch < s->channels; ch++) {
+ FlacSubframe *sub = &frame->subframes[ch];
+
+ sub->wasted = 0;
+ sub->obits = s->avctx->bits_per_raw_sample;
+
+ if (sub->obits > 16)
+ sub->rc.coding_mode = CODING_MODE_RICE2;
+ else
+ sub->rc.coding_mode = CODING_MODE_RICE;
+ }
frame->verbatim_only = 0;
}
@@ -484,22 +458,32 @@ static void init_frame(FlacEncodeContext *s)
/**
* Copy channel-interleaved input samples into separate subframes.
*/
-static void copy_samples(FlacEncodeContext *s, const int16_t *samples)
+static void copy_samples(FlacEncodeContext *s, const void *samples)
{
int i, j, ch;
FlacFrame *frame;
-
- frame = &s->frame;
- for (i = 0, j = 0; i < frame->blocksize; i++)
- for (ch = 0; ch < s->channels; ch++, j++)
- frame->subframes[ch].samples[i] = samples[j];
+ int shift = av_get_bytes_per_sample(s->avctx->sample_fmt) * 8 -
+ s->avctx->bits_per_raw_sample;
+
+#define COPY_SAMPLES(bits) do { \
+ const int ## bits ## _t *samples0 = samples; \
+ frame = &s->frame; \
+ for (i = 0, j = 0; i < frame->blocksize; i++) \
+ for (ch = 0; ch < s->channels; ch++, j++) \
+ frame->subframes[ch].samples[i] = samples0[j] >> shift; \
+} while (0)
+
+ if (s->avctx->sample_fmt == AV_SAMPLE_FMT_S16)
+ COPY_SAMPLES(16);
+ else
+ COPY_SAMPLES(32);
}
-static int rice_count_exact(int32_t *res, int n, int k)
+static uint64_t rice_count_exact(int32_t *res, int n, int k)
{
int i;
- int count = 0;
+ uint64_t count = 0;
for (i = 0; i < n; i++) {
int32_t v = -2 * res[i] - 1;
@@ -510,12 +494,12 @@ static int rice_count_exact(int32_t *res, int n, int k)
}
-static int subframe_count_exact(FlacEncodeContext *s, FlacSubframe *sub,
- int pred_order)
+static uint64_t subframe_count_exact(FlacEncodeContext *s, FlacSubframe *sub,
+ int pred_order)
{
int p, porder, psize;
int i, part_end;
- int count = 0;
+ uint64_t count = 0;
/* subframe header */
count += 8;
@@ -546,7 +530,7 @@ static int subframe_count_exact(FlacEncodeContext *s, FlacSubframe *sub,
part_end = psize;
for (p = 0; p < 1 << porder; p++) {
int k = sub->rc.params[p];
- count += 4;
+ count += sub->rc.coding_mode;
count += rice_count_exact(&sub->residual[i], part_end - i, k);
i = part_end;
part_end = FFMIN(s->frame.blocksize, part_end + psize);
@@ -562,32 +546,34 @@ static int subframe_count_exact(FlacEncodeContext *s, FlacSubframe *sub,
/**
* Solve for d/dk(rice_encode_count) = n-((sum-(n>>1))>>(k+1)) = 0.
*/
-static int find_optimal_param(uint32_t sum, int n)
+static int find_optimal_param(uint64_t sum, int n, int max_param)
{
int k;
- uint32_t sum2;
+ uint64_t sum2;
if (sum <= n >> 1)
return 0;
sum2 = sum - (n >> 1);
- k = av_log2(n < 256 ? FASTDIV(sum2, n) : sum2 / n);
- return FFMIN(k, MAX_RICE_PARAM);
+ k = av_log2(av_clipl_int32(sum2 / n));
+ return FFMIN(k, max_param);
}
-static uint32_t calc_optimal_rice_params(RiceContext *rc, int porder,
- uint32_t *sums, int n, int pred_order)
+static uint64_t calc_optimal_rice_params(RiceContext *rc, int porder,
+ uint64_t *sums, int n, int pred_order)
{
int i;
- int k, cnt, part;
- uint32_t all_bits;
+ int k, cnt, part, max_param;
+ uint64_t all_bits;
+
+ max_param = (1 << rc->coding_mode) - 2;
part = (1 << porder);
all_bits = 4 * part;
cnt = (n >> porder) - pred_order;
for (i = 0; i < part; i++) {
- k = find_optimal_param(sums[i], cnt);
+ k = find_optimal_param(sums[i], cnt, max_param);
rc->params[i] = k;
all_bits += rice_encode_count(sums[i], cnt, k);
cnt = n >> porder;
@@ -600,7 +586,7 @@ static uint32_t calc_optimal_rice_params(RiceContext *rc, int porder,
static void calc_sums(int pmin, int pmax, uint32_t *data, int n, int pred_order,
- uint32_t sums[][MAX_PARTITIONS])
+ uint64_t sums[][MAX_PARTITIONS])
{
int i, j;
int parts;
@@ -611,7 +597,7 @@ static void calc_sums(int pmin, int pmax, uint32_t *data, int n, int pred_order,
res = &data[pred_order];
res_end = &data[n >> pmax];
for (i = 0; i < parts; i++) {
- uint32_t sum = 0;
+ uint64_t sum = 0;
while (res < res_end)
sum += *(res++);
sums[pmax][i] = sum;
@@ -626,20 +612,22 @@ static void calc_sums(int pmin, int pmax, uint32_t *data, int n, int pred_order,
}
-static uint32_t calc_rice_params(RiceContext *rc, int pmin, int pmax,
+static uint64_t calc_rice_params(RiceContext *rc, int pmin, int pmax,
int32_t *data, int n, int pred_order)
{
int i;
- uint32_t bits[MAX_PARTITION_ORDER+1];
+ uint64_t bits[MAX_PARTITION_ORDER+1];
int opt_porder;
RiceContext tmp_rc;
uint32_t *udata;
- uint32_t sums[MAX_PARTITION_ORDER+1][MAX_PARTITIONS];
+ uint64_t sums[MAX_PARTITION_ORDER+1][MAX_PARTITIONS];
assert(pmin >= 0 && pmin <= MAX_PARTITION_ORDER);
assert(pmax >= 0 && pmax <= MAX_PARTITION_ORDER);
assert(pmin <= pmax);
+ tmp_rc.coding_mode = rc->coding_mode;
+
udata = av_malloc(n * sizeof(uint32_t));
for (i = 0; i < n; i++)
udata[i] = (2*data[i]) ^ (data[i]>>31);
@@ -670,7 +658,7 @@ static int get_max_p_order(int max_porder, int n, int order)
}
-static uint32_t find_subframe_rice_params(FlacEncodeContext *s,
+static uint64_t find_subframe_rice_params(FlacEncodeContext *s,
FlacSubframe *sub, int pred_order)
{
int pmin = get_max_p_order(s->options.min_partition_order,
@@ -678,7 +666,7 @@ static uint32_t find_subframe_rice_params(FlacEncodeContext *s,
int pmax = get_max_p_order(s->options.max_partition_order,
s->frame.blocksize, pred_order);
- uint32_t bits = 8 + pred_order * sub->obits + 2 + 4;
+ uint64_t bits = 8 + pred_order * sub->obits + 2 + sub->rc.coding_mode;
if (sub->type == FLAC_SUBFRAME_LPC)
bits += 4 + 5 + pred_order * s->options.lpc_coeff_precision;
bits += calc_rice_params(&sub->rc, pmin, pmax, sub->residual,
@@ -738,110 +726,6 @@ static void encode_residual_fixed(int32_t *res, const int32_t *smp, int n,
}
-#define LPC1(x) {\
- int c = coefs[(x)-1];\
- p0 += c * s;\
- s = smp[i-(x)+1];\
- p1 += c * s;\
-}
-
-static av_always_inline void encode_residual_lpc_unrolled(int32_t *res,
- const int32_t *smp, int n, int order,
- const int32_t *coefs, int shift, int big)
-{
- int i;
- for (i = order; i < n; i += 2) {
- int s = smp[i-order];
- int p0 = 0, p1 = 0;
- if (big) {
- switch (order) {
- case 32: LPC1(32)
- case 31: LPC1(31)
- case 30: LPC1(30)
- case 29: LPC1(29)
- case 28: LPC1(28)
- case 27: LPC1(27)
- case 26: LPC1(26)
- case 25: LPC1(25)
- case 24: LPC1(24)
- case 23: LPC1(23)
- case 22: LPC1(22)
- case 21: LPC1(21)
- case 20: LPC1(20)
- case 19: LPC1(19)
- case 18: LPC1(18)
- case 17: LPC1(17)
- case 16: LPC1(16)
- case 15: LPC1(15)
- case 14: LPC1(14)
- case 13: LPC1(13)
- case 12: LPC1(12)
- case 11: LPC1(11)
- case 10: LPC1(10)
- case 9: LPC1( 9)
- LPC1( 8)
- LPC1( 7)
- LPC1( 6)
- LPC1( 5)
- LPC1( 4)
- LPC1( 3)
- LPC1( 2)
- LPC1( 1)
- }
- } else {
- switch (order) {
- case 8: LPC1( 8)
- case 7: LPC1( 7)
- case 6: LPC1( 6)
- case 5: LPC1( 5)
- case 4: LPC1( 4)
- case 3: LPC1( 3)
- case 2: LPC1( 2)
- case 1: LPC1( 1)
- }
- }
- res[i ] = smp[i ] - (p0 >> shift);
- res[i+1] = smp[i+1] - (p1 >> shift);
- }
-}
-
-
-static void encode_residual_lpc(int32_t *res, const int32_t *smp, int n,
- int order, const int32_t *coefs, int shift)
-{
- int i;
- for (i = 0; i < order; i++)
- res[i] = smp[i];
-#if CONFIG_SMALL
- for (i = order; i < n; i += 2) {
- int j;
- int s = smp[i];
- int p0 = 0, p1 = 0;
- for (j = 0; j < order; j++) {
- int c = coefs[j];
- p1 += c * s;
- s = smp[i-j-1];
- p0 += c * s;
- }
- res[i ] = smp[i ] - (p0 >> shift);
- res[i+1] = smp[i+1] - (p1 >> shift);
- }
-#else
- switch (order) {
- case 1: encode_residual_lpc_unrolled(res, smp, n, 1, coefs, shift, 0); break;
- case 2: encode_residual_lpc_unrolled(res, smp, n, 2, coefs, shift, 0); break;
- case 3: encode_residual_lpc_unrolled(res, smp, n, 3, coefs, shift, 0); break;
- case 4: encode_residual_lpc_unrolled(res, smp, n, 4, coefs, shift, 0); break;
- case 5: encode_residual_lpc_unrolled(res, smp, n, 5, coefs, shift, 0); break;
- case 6: encode_residual_lpc_unrolled(res, smp, n, 6, coefs, shift, 0); break;
- case 7: encode_residual_lpc_unrolled(res, smp, n, 7, coefs, shift, 0); break;
- case 8: encode_residual_lpc_unrolled(res, smp, n, 8, coefs, shift, 0); break;
- default: encode_residual_lpc_unrolled(res, smp, n, order, coefs, shift, 1); break;
- }
-#endif
-}
-
-
static int encode_residual_ch(FlacEncodeContext *s, int ch)
{
int i, n;
@@ -883,7 +767,7 @@ static int encode_residual_ch(FlacEncodeContext *s, int ch)
sub->type = FLAC_SUBFRAME_FIXED;
if (s->options.lpc_type == FF_LPC_TYPE_NONE ||
s->options.lpc_type == FF_LPC_TYPE_FIXED || n <= max_order) {
- uint32_t bits[MAX_FIXED_ORDER+1];
+ uint64_t bits[MAX_FIXED_ORDER+1];
if (max_order > MAX_FIXED_ORDER)
max_order = MAX_FIXED_ORDER;
opt_order = 0;
@@ -914,7 +798,7 @@ static int encode_residual_ch(FlacEncodeContext *s, int ch)
omethod == ORDER_METHOD_4LEVEL ||
omethod == ORDER_METHOD_8LEVEL) {
int levels = 1 << omethod;
- uint32_t bits[1 << ORDER_METHOD_8LEVEL];
+ uint64_t bits[1 << ORDER_METHOD_8LEVEL];
int order = -1;
int opt_index = levels-1;
opt_order = max_order-1;
@@ -925,7 +809,8 @@ static int encode_residual_ch(FlacEncodeContext *s, int ch)
order = av_clip(order, min_order - 1, max_order - 1);
if (order == last_order)
continue;
- encode_residual_lpc(res, smp, n, order+1, coefs[order], shift[order]);
+ s->flac_dsp.lpc_encode(res, smp, n, order+1, coefs[order],
+ shift[order]);
bits[i] = find_subframe_rice_params(s, sub, order+1);
if (bits[i] < bits[opt_index]) {
opt_index = i;
@@ -935,18 +820,18 @@ static int encode_residual_ch(FlacEncodeContext *s, int ch)
opt_order++;
} else if (omethod == ORDER_METHOD_SEARCH) {
// brute-force optimal order search
- uint32_t bits[MAX_LPC_ORDER];
+ uint64_t bits[MAX_LPC_ORDER];
opt_order = 0;
bits[0] = UINT32_MAX;
for (i = min_order-1; i < max_order; i++) {
- encode_residual_lpc(res, smp, n, i+1, coefs[i], shift[i]);
+ s->flac_dsp.lpc_encode(res, smp, n, i+1, coefs[i], shift[i]);
bits[i] = find_subframe_rice_params(s, sub, i+1);
if (bits[i] < bits[opt_order])
opt_order = i;
}
opt_order++;
} else if (omethod == ORDER_METHOD_LOG) {
- uint32_t bits[MAX_LPC_ORDER];
+ uint64_t bits[MAX_LPC_ORDER];
int step;
opt_order = min_order - 1 + (max_order-min_order)/3;
@@ -957,7 +842,7 @@ static int encode_residual_ch(FlacEncodeContext *s, int ch)
for (i = last-step; i <= last+step; i += step) {
if (i < min_order-1 || i >= max_order || bits[i] < UINT32_MAX)
continue;
- encode_residual_lpc(res, smp, n, i+1, coefs[i], shift[i]);
+ s->flac_dsp.lpc_encode(res, smp, n, i+1, coefs[i], shift[i]);
bits[i] = find_subframe_rice_params(s, sub, i+1);
if (bits[i] < bits[opt_order])
opt_order = i;
@@ -972,7 +857,7 @@ static int encode_residual_ch(FlacEncodeContext *s, int ch)
for (i = 0; i < sub->order; i++)
sub->coefs[i] = coefs[sub->order-1][i];
- encode_residual_lpc(res, smp, n, sub->order, sub->coefs, sub->shift);
+ s->flac_dsp.lpc_encode(res, smp, n, sub->order, sub->coefs, sub->shift);
find_subframe_rice_params(s, sub, sub->order);
@@ -1018,7 +903,8 @@ static int count_frame_header(FlacEncodeContext *s)
static int encode_frame(FlacEncodeContext *s)
{
- int ch, count;
+ int ch;
+ uint64_t count;
count = count_frame_header(s);
@@ -1028,11 +914,47 @@ static int encode_frame(FlacEncodeContext *s)
count += (8 - (count & 7)) & 7; // byte alignment
count += 16; // CRC-16
- return count >> 3;
+ count >>= 3;
+ if (count > INT_MAX)
+ return AVERROR_BUG;
+ return count;
+}
+
+
+static void remove_wasted_bits(FlacEncodeContext *s)
+{
+ int ch, i;
+
+ for (ch = 0; ch < s->channels; ch++) {
+ FlacSubframe *sub = &s->frame.subframes[ch];
+ int32_t v = 0;
+
+ for (i = 0; i < s->frame.blocksize; i++) {
+ v |= sub->samples[i];
+ if (v & 1)
+ break;
+ }
+
+ if (v && !(v & 1)) {
+ v = av_ctz(v);
+
+ for (i = 0; i < s->frame.blocksize; i++)
+ sub->samples[i] >>= v;
+
+ sub->wasted = v;
+ sub->obits -= v;
+
+ /* for 24-bit, check if removing wasted bits makes the range better
+ suited for using RICE instead of RICE2 for entropy coding */
+ if (sub->obits <= 17)
+ sub->rc.coding_mode = CODING_MODE_RICE;
+ }
+ }
}
-static int estimate_stereo_mode(int32_t *left_ch, int32_t *right_ch, int n)
+static int estimate_stereo_mode(int32_t *left_ch, int32_t *right_ch, int n,
+ int max_rice_param)
{
int i, best;
int32_t lt, rt;
@@ -1052,7 +974,7 @@ static int estimate_stereo_mode(int32_t *left_ch, int32_t *right_ch, int n)
}
/* estimate bit counts */
for (i = 0; i < 4; i++) {
- k = find_optimal_param(2 * sum[i], n);
+ k = find_optimal_param(2 * sum[i], n, max_rice_param);
sum[i] = rice_encode_count( 2 * sum[i], n, k);
}
@@ -1067,15 +989,8 @@ static int estimate_stereo_mode(int32_t *left_ch, int32_t *right_ch, int n)
for (i = 1; i < 4; i++)
if (score[i] < score[best])
best = i;
- if (best == 0) {
- return FLAC_CHMODE_INDEPENDENT;
- } else if (best == 1) {
- return FLAC_CHMODE_LEFT_SIDE;
- } else if (best == 2) {
- return FLAC_CHMODE_RIGHT_SIDE;
- } else {
- return FLAC_CHMODE_MID_SIDE;
- }
+
+ return best;
}
@@ -1098,7 +1013,11 @@ static void channel_decorrelation(FlacEncodeContext *s)
return;
}
- frame->ch_mode = estimate_stereo_mode(left, right, n);
+ if (s->options.ch_mode < 0) {
+ int max_rice_param = (1 << frame->subframes[0].rc.coding_mode) - 2;
+ frame->ch_mode = estimate_stereo_mode(left, right, n, max_rice_param);
+ } else
+ frame->ch_mode = s->options.ch_mode;
/* perform decorrelation and adjust bits-per-sample */
if (frame->ch_mode == FLAC_CHMODE_INDEPENDENT)
@@ -1144,9 +1063,9 @@ static void write_frame_header(FlacEncodeContext *s)
if (frame->ch_mode == FLAC_CHMODE_INDEPENDENT)
put_bits(&s->pb, 4, s->channels-1);
else
- put_bits(&s->pb, 4, frame->ch_mode);
+ put_bits(&s->pb, 4, frame->ch_mode + FLAC_MAX_CHANNELS - 1);
- put_bits(&s->pb, 3, 4); /* bits-per-sample code */
+ put_bits(&s->pb, 3, s->bps_code);
put_bits(&s->pb, 1, 0);
write_utf8(&s->pb, s->frame_count);
@@ -1181,7 +1100,9 @@ static void write_subframes(FlacEncodeContext *s)
/* subframe header */
put_bits(&s->pb, 1, 0);
put_bits(&s->pb, 6, sub->type_code);
- put_bits(&s->pb, 1, 0); /* no wasted bits */
+ put_bits(&s->pb, 1, !!sub->wasted);
+ if (sub->wasted)
+ put_bits(&s->pb, sub->wasted, 1);
/* subframe */
if (sub->type == FLAC_SUBFRAME_CONSTANT) {
@@ -1204,7 +1125,7 @@ static void write_subframes(FlacEncodeContext *s)
}
/* rice-encoded block */
- put_bits(&s->pb, 2, 0);
+ put_bits(&s->pb, 2, sub->rc.coding_mode - 4);
/* partition order */
porder = sub->rc.porder;
@@ -1215,7 +1136,7 @@ static void write_subframes(FlacEncodeContext *s)
part_end = &sub->residual[psize];
for (p = 0; p < 1 << porder; p++) {
int k = sub->rc.params[p];
- put_bits(&s->pb, 4, k);
+ put_bits(&s->pb, sub->rc.coding_mode, k);
while (res < part_end)
set_sr_golomb_flac(&s->pb, *res++, k, INT32_MAX, 0);
part_end = FFMIN(frame_end, part_end + psize);
@@ -1236,9 +1157,9 @@ static void write_frame_footer(FlacEncodeContext *s)
}
-static int write_frame(FlacEncodeContext *s, uint8_t *frame, int buf_size)
+static int write_frame(FlacEncodeContext *s, AVPacket *avpkt)
{
- init_put_bits(&s->pb, frame, buf_size);
+ init_put_bits(&s->pb, avpkt->data, avpkt->size);
write_frame_header(s);
write_subframes(s);
write_frame_footer(s);
@@ -1246,31 +1167,54 @@ static int write_frame(FlacEncodeContext *s, uint8_t *frame, int buf_size)
}
-static void update_md5_sum(FlacEncodeContext *s, const int16_t *samples)
+static int update_md5_sum(FlacEncodeContext *s, const void *samples)
{
-#if HAVE_BIGENDIAN
- int i;
- for (i = 0; i < s->frame.blocksize * s->channels; i++) {
- int16_t smp = av_le2ne16(samples[i]);
- av_md5_update(s->md5ctx, (uint8_t *)&smp, 2);
+ const uint8_t *buf;
+ int buf_size = s->frame.blocksize * s->channels *
+ ((s->avctx->bits_per_raw_sample + 7) / 8);
+
+ if (s->avctx->bits_per_raw_sample > 16 || HAVE_BIGENDIAN) {
+ av_fast_malloc(&s->md5_buffer, &s->md5_buffer_size, buf_size);
+ if (!s->md5_buffer)
+ return AVERROR(ENOMEM);
}
-#else
- av_md5_update(s->md5ctx, (const uint8_t *)samples, s->frame.blocksize*s->channels*2);
+
+ if (s->avctx->bits_per_raw_sample <= 16) {
+ buf = (const uint8_t *)samples;
+#if HAVE_BIGENDIAN
+ s->dsp.bswap16_buf((uint16_t *)s->md5_buffer,
+ (const uint16_t *)samples, buf_size / 2);
+ buf = s->md5_buffer;
#endif
+ } else {
+ int i;
+ const int32_t *samples0 = samples;
+ uint8_t *tmp = s->md5_buffer;
+
+ for (i = 0; i < s->frame.blocksize * s->channels; i++) {
+ int32_t v = samples0[i] >> 8;
+ *tmp++ = (v ) & 0xFF;
+ *tmp++ = (v >> 8) & 0xFF;
+ *tmp++ = (v >> 16) & 0xFF;
+ }
+ buf = s->md5_buffer;
+ }
+ av_md5_update(s->md5ctx, buf, buf_size);
+
+ return 0;
}
-static int flac_encode_frame(AVCodecContext *avctx, uint8_t *frame,
- int buf_size, void *data)
+static int flac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
+ const AVFrame *frame, int *got_packet_ptr)
{
FlacEncodeContext *s;
- const int16_t *samples = data;
- int frame_bytes, out_bytes;
+ int frame_bytes, out_bytes, ret;
s = avctx->priv_data;
/* when the last block is reached, update the header in extradata */
- if (!data) {
+ if (!frame) {
s->max_framesize = s->max_encoded_framesize;
av_md5_final(s->md5ctx, s->md5sum);
write_streaminfo(s, avctx->extradata);
@@ -1278,42 +1222,56 @@ static int flac_encode_frame(AVCodecContext *avctx, uint8_t *frame,
}
/* change max_framesize for small final frame */
- if (avctx->frame_size < s->frame.blocksize) {
- s->max_framesize = ff_flac_get_max_frame_size(avctx->frame_size,
- s->channels, 16);
+ if (frame->nb_samples < s->frame.blocksize) {
+ s->max_framesize = ff_flac_get_max_frame_size(frame->nb_samples,
+ s->channels,
+ avctx->bits_per_raw_sample);
}
- init_frame(s);
+ init_frame(s, frame->nb_samples);
- copy_samples(s, samples);
+ copy_samples(s, frame->data[0]);
channel_decorrelation(s);
+ remove_wasted_bits(s);
+
frame_bytes = encode_frame(s);
/* fallback to verbatim mode if the compressed frame is larger than it
would be if encoded uncompressed. */
- if (frame_bytes > s->max_framesize) {
+ if (frame_bytes < 0 || frame_bytes > s->max_framesize) {
s->frame.verbatim_only = 1;
frame_bytes = encode_frame(s);
+ if (frame_bytes < 0) {
+ av_log(avctx, AV_LOG_ERROR, "Bad frame count\n");
+ return frame_bytes;
+ }
}
- if (buf_size < frame_bytes) {
- av_log(avctx, AV_LOG_ERROR, "output buffer too small\n");
- return 0;
+ if ((ret = ff_alloc_packet(avpkt, frame_bytes))) {
+ av_log(avctx, AV_LOG_ERROR, "Error getting output packet\n");
+ return ret;
}
- out_bytes = write_frame(s, frame, buf_size);
+
+ out_bytes = write_frame(s, avpkt);
s->frame_count++;
- avctx->coded_frame->pts = s->sample_count;
- s->sample_count += avctx->frame_size;
- update_md5_sum(s, samples);
+ s->sample_count += frame->nb_samples;
+ if ((ret = update_md5_sum(s, frame->data[0])) < 0) {
+ av_log(avctx, AV_LOG_ERROR, "Error updating MD5 checksum\n");
+ return ret;
+ }
if (out_bytes > s->max_encoded_framesize)
s->max_encoded_framesize = out_bytes;
if (out_bytes < s->min_framesize)
s->min_framesize = out_bytes;
- return out_bytes;
+ avpkt->pts = frame->pts;
+ avpkt->duration = ff_samples_to_time_base(avctx, frame->nb_samples);
+ avpkt->size = out_bytes;
+ *got_packet_ptr = 1;
+ return 0;
}
@@ -1322,32 +1280,41 @@ static av_cold int flac_encode_close(AVCodecContext *avctx)
if (avctx->priv_data) {
FlacEncodeContext *s = avctx->priv_data;
av_freep(&s->md5ctx);
+ av_freep(&s->md5_buffer);
ff_lpc_end(&s->lpc_ctx);
}
av_freep(&avctx->extradata);
avctx->extradata_size = 0;
+#if FF_API_OLD_ENCODE_AUDIO
av_freep(&avctx->coded_frame);
+#endif
return 0;
}
#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), 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" },
+{ "lpc_coeff_precision", "LPC coefficient precision", offsetof(FlacEncodeContext, options.lpc_coeff_precision), AV_OPT_TYPE_INT, {.i64 = 15 }, 0, MAX_LPC_PRECISION, FLAGS },
+{ "lpc_type", "LPC algorithm", offsetof(FlacEncodeContext, options.lpc_type), AV_OPT_TYPE_INT, {.i64 = FF_LPC_TYPE_DEFAULT }, FF_LPC_TYPE_DEFAULT, FF_LPC_TYPE_NB-1, FLAGS, "lpc_type" },
+{ "none", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_LPC_TYPE_NONE }, INT_MIN, INT_MAX, FLAGS, "lpc_type" },
+{ "fixed", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_LPC_TYPE_FIXED }, INT_MIN, INT_MAX, FLAGS, "lpc_type" },
+{ "levinson", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_LPC_TYPE_LEVINSON }, INT_MIN, INT_MAX, FLAGS, "lpc_type" },
+{ "cholesky", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = 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, {.i64 = 1 }, 1, INT_MAX, FLAGS },
+{ "min_partition_order", NULL, offsetof(FlacEncodeContext, options.min_partition_order), AV_OPT_TYPE_INT, {.i64 = -1 }, -1, MAX_PARTITION_ORDER, FLAGS },
+{ "max_partition_order", NULL, offsetof(FlacEncodeContext, options.max_partition_order), AV_OPT_TYPE_INT, {.i64 = -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, {.i64 = -1 }, -1, ORDER_METHOD_LOG, FLAGS, "predm" },
+{ "estimation", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = ORDER_METHOD_EST }, INT_MIN, INT_MAX, FLAGS, "predm" },
+{ "2level", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = ORDER_METHOD_2LEVEL }, INT_MIN, INT_MAX, FLAGS, "predm" },
+{ "4level", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = ORDER_METHOD_4LEVEL }, INT_MIN, INT_MAX, FLAGS, "predm" },
+{ "8level", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = ORDER_METHOD_8LEVEL }, INT_MIN, INT_MAX, FLAGS, "predm" },
+{ "search", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = ORDER_METHOD_SEARCH }, INT_MIN, INT_MAX, FLAGS, "predm" },
+{ "log", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = ORDER_METHOD_LOG }, INT_MIN, INT_MAX, FLAGS, "predm" },
+{ "ch_mode", "Stereo decorrelation mode", offsetof(FlacEncodeContext, options.ch_mode), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, FLAC_CHMODE_MID_SIDE, FLAGS, "ch_mode" },
+{ "auto", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = -1 }, INT_MIN, INT_MAX, FLAGS, "ch_mode" },
+{ "indep", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = FLAC_CHMODE_INDEPENDENT }, INT_MIN, INT_MAX, FLAGS, "ch_mode" },
+{ "left_side", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = FLAC_CHMODE_LEFT_SIDE }, INT_MIN, INT_MAX, FLAGS, "ch_mode" },
+{ "right_side", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = FLAC_CHMODE_RIGHT_SIDE }, INT_MIN, INT_MAX, FLAGS, "ch_mode" },
+{ "mid_side", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = FLAC_CHMODE_MID_SIDE }, INT_MIN, INT_MAX, FLAGS, "ch_mode" },
{ NULL },
};
@@ -1361,13 +1328,15 @@ static const AVClass flac_encoder_class = {
AVCodec ff_flac_encoder = {
.name = "flac",
.type = AVMEDIA_TYPE_AUDIO,
- .id = CODEC_ID_FLAC,
+ .id = AV_CODEC_ID_FLAC,
.priv_data_size = sizeof(FlacEncodeContext),
.init = flac_encode_init,
- .encode = flac_encode_frame,
+ .encode2 = flac_encode_frame,
.close = flac_encode_close,
- .capabilities = CODEC_CAP_SMALL_LAST_FRAME | CODEC_CAP_DELAY,
- .sample_fmts = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_NONE},
- .long_name = NULL_IF_CONFIG_SMALL("FLAC (Free Lossless Audio Codec)"),
- .priv_class = &flac_encoder_class,
+ .capabilities = CODEC_CAP_SMALL_LAST_FRAME | CODEC_CAP_DELAY,
+ .sample_fmts = (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_S16,
+ AV_SAMPLE_FMT_S32,
+ AV_SAMPLE_FMT_NONE },
+ .long_name = NULL_IF_CONFIG_SMALL("FLAC (Free Lossless Audio Codec)"),
+ .priv_class = &flac_encoder_class,
};
diff --git a/gst-libs/ext/libav/libavcodec/flashsv.c b/gst-libs/ext/libav/libavcodec/flashsv.c
index 4a231ce..3c5a35c 100644
--- a/gst-libs/ext/libav/libavcodec/flashsv.c
+++ b/gst-libs/ext/libav/libavcodec/flashsv.c
@@ -45,7 +45,6 @@
typedef struct BlockInfo {
uint8_t *pos;
int size;
- int unp_size;
} BlockInfo;
typedef struct FlashSVContext {
@@ -114,17 +113,17 @@ static av_cold int flashsv_decode_init(AVCodecContext *avctx)
av_log(avctx, AV_LOG_ERROR, "Inflate init error: %d\n", zret);
return 1;
}
- avctx->pix_fmt = PIX_FMT_BGR24;
+ avctx->pix_fmt = AV_PIX_FMT_BGR24;
s->frame.data[0] = NULL;
return 0;
}
-static void flashsv2_prime(FlashSVContext *s, uint8_t *src,
- int size, int unp_size)
+static int flashsv2_prime(FlashSVContext *s, uint8_t *src, int size)
{
z_stream zs;
+ int zret; // Zlib return code
zs.zalloc = NULL;
zs.zfree = NULL;
@@ -144,13 +143,18 @@ static void flashsv2_prime(FlashSVContext *s, uint8_t *src,
deflate(&zs, Z_SYNC_FLUSH);
deflateEnd(&zs);
- inflateReset(&s->zstream);
+ if ((zret = inflateReset(&s->zstream)) != Z_OK) {
+ av_log(s->avctx, AV_LOG_ERROR, "Inflate reset error: %d\n", zret);
+ return AVERROR_UNKNOWN;
+ }
s->zstream.next_in = s->deflate_block;
s->zstream.avail_in = s->deflate_block_size - zs.avail_out;
s->zstream.next_out = s->tmpblock;
s->zstream.avail_out = s->block_size * 3;
inflate(&s->zstream, Z_SYNC_FLUSH);
+
+ return 0;
}
static int flashsv_decode_block(AVCodecContext *avctx, AVPacket *avpkt,
@@ -163,11 +167,15 @@ static int flashsv_decode_block(AVCodecContext *avctx, AVPacket *avpkt,
int k;
int ret = inflateReset(&s->zstream);
if (ret != Z_OK) {
- //return -1;
+ av_log(avctx, AV_LOG_ERROR, "Inflate reset error: %d\n", ret);
+ return AVERROR_UNKNOWN;
}
if (s->zlibprime_curr || s->zlibprime_prev) {
- flashsv2_prime(s, s->blocks[blk_idx].pos, s->blocks[blk_idx].size,
- s->blocks[blk_idx].unp_size);
+ ret = flashsv2_prime(s,
+ s->blocks[blk_idx].pos,
+ s->blocks[blk_idx].size);
+ if (ret < 0)
+ return ret;
}
s->zstream.next_in = avpkt->data + get_bits_count(gb) / 8;
s->zstream.avail_in = block_size;
@@ -187,7 +195,6 @@ static int flashsv_decode_block(AVCodecContext *avctx, AVPacket *avpkt,
if (s->is_keyframe) {
s->blocks[blk_idx].pos = s->keyframedata + (get_bits_count(gb) / 8);
s->blocks[blk_idx].size = block_size;
- s->blocks[blk_idx].unp_size = s->block_size * 3 - s->zstream.avail_out;
}
if (!s->color_depth) {
/* Flash Screen Video stores the image upside down, so copy
@@ -227,7 +234,7 @@ static int calc_deflate_block_size(int tmpblock_size)
}
static int flashsv_decode_frame(AVCodecContext *avctx, void *data,
- int *data_size, AVPacket *avpkt)
+ int *got_frame, AVPacket *avpkt)
{
int buf_size = avpkt->size;
FlashSVContext *s = avctx->priv_data;
@@ -255,7 +262,7 @@ static int flashsv_decode_frame(AVCodecContext *avctx, void *data,
return AVERROR_PATCHWELCOME;
}
if (get_bits1(&gb)) {
- av_log_missing_feature(avctx, "custom palette", 1);
+ av_log_missing_feature(avctx, "Custom palette", 1);
return AVERROR_PATCHWELCOME;
}
}
@@ -434,7 +441,7 @@ static int flashsv_decode_frame(AVCodecContext *avctx, void *data,
memcpy(s->keyframe, s->frame.data[0], s->frame.linesize[0] * avctx->height);
}
- *data_size = sizeof(AVFrame);
+ *got_frame = 1;
*(AVFrame*)data = s->frame;
if ((get_bits_count(&gb) / 8) != buf_size)
@@ -465,13 +472,13 @@ static av_cold int flashsv_decode_end(AVCodecContext *avctx)
AVCodec ff_flashsv_decoder = {
.name = "flashsv",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_FLASHSV,
+ .id = AV_CODEC_ID_FLASHSV,
.priv_data_size = sizeof(FlashSVContext),
.init = flashsv_decode_init,
.close = flashsv_decode_end,
.decode = flashsv_decode_frame,
.capabilities = CODEC_CAP_DR1,
- .pix_fmts = (const enum PixelFormat[]){PIX_FMT_BGR24, PIX_FMT_NONE},
+ .pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_BGR24, AV_PIX_FMT_NONE },
.long_name = NULL_IF_CONFIG_SMALL("Flash Screen Video v1"),
};
#endif /* CONFIG_FLASHSV_DECODER */
@@ -528,13 +535,13 @@ static av_cold int flashsv2_decode_end(AVCodecContext *avctx)
AVCodec ff_flashsv2_decoder = {
.name = "flashsv2",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_FLASHSV2,
+ .id = AV_CODEC_ID_FLASHSV2,
.priv_data_size = sizeof(FlashSVContext),
.init = flashsv2_decode_init,
.close = flashsv2_decode_end,
.decode = flashsv_decode_frame,
.capabilities = CODEC_CAP_DR1,
- .pix_fmts = (const enum PixelFormat[]){PIX_FMT_BGR24, PIX_FMT_NONE},
+ .pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_BGR24, AV_PIX_FMT_NONE },
.long_name = NULL_IF_CONFIG_SMALL("Flash Screen Video v2"),
};
#endif /* CONFIG_FLASHSV2_DECODER */
diff --git a/gst-libs/ext/libav/libavcodec/flashsvenc.c b/gst-libs/ext/libav/libavcodec/flashsvenc.c
index 81aa5b6..0b78880 100644
--- a/gst-libs/ext/libav/libavcodec/flashsvenc.c
+++ b/gst-libs/ext/libav/libavcodec/flashsvenc.c
@@ -49,6 +49,7 @@
#include <zlib.h>
#include "avcodec.h"
+#include "internal.h"
#include "put_bits.h"
#include "bytestream.h"
@@ -194,11 +195,10 @@ static int encode_bitstream(FlashSVContext *s, AVFrame *p, uint8_t *buf,
}
-static int flashsv_encode_frame(AVCodecContext *avctx, uint8_t *buf,
- int buf_size, void *data)
+static int flashsv_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
+ const AVFrame *pict, int *got_packet)
{
FlashSVContext * const s = avctx->priv_data;
- AVFrame *pict = data;
AVFrame * const p = &s->frame;
uint8_t *pfptr;
int res;
@@ -228,15 +228,15 @@ static int flashsv_encode_frame(AVCodecContext *avctx, uint8_t *buf,
I_frame = 1;
}
- if (buf_size < s->image_width * s->image_height * 3) {
+ if ((res = ff_alloc_packet(pkt, s->image_width * s->image_height * 3)) < 0) {
//Conservative upper bound check for compressed data
- av_log(avctx, AV_LOG_ERROR, "buf_size %d < %d\n",
- buf_size, s->image_width * s->image_height * 3);
- return -1;
+ av_log(avctx, AV_LOG_ERROR, "Error getting output packet of size %d.\n",
+ s->image_width * s->image_height * 3);
+ return res;
}
- res = encode_bitstream(s, p, buf, buf_size, opt_w * 16, opt_h * 16,
- pfptr, &I_frame);
+ pkt->size = encode_bitstream(s, p, pkt->data, pkt->size, opt_w * 16, opt_h * 16,
+ pfptr, &I_frame);
//save the current frame
if (p->linesize[0] > 0)
@@ -259,7 +259,11 @@ static int flashsv_encode_frame(AVCodecContext *avctx, uint8_t *buf,
avctx->coded_frame = p;
- return res;
+ if (p->key_frame)
+ pkt->flags |= AV_PKT_FLAG_KEY;
+ *got_packet = 1;
+
+ return 0;
}
static av_cold int flashsv_encode_end(AVCodecContext *avctx)
@@ -278,12 +282,11 @@ static av_cold int flashsv_encode_end(AVCodecContext *avctx)
AVCodec ff_flashsv_encoder = {
.name = "flashsv",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_FLASHSV,
+ .id = AV_CODEC_ID_FLASHSV,
.priv_data_size = sizeof(FlashSVContext),
.init = flashsv_encode_init,
- .encode = flashsv_encode_frame,
+ .encode2 = flashsv_encode_frame,
.close = flashsv_encode_end,
- .pix_fmts = (const enum PixelFormat[]){PIX_FMT_BGR24, PIX_FMT_NONE},
+ .pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_BGR24, AV_PIX_FMT_NONE },
.long_name = NULL_IF_CONFIG_SMALL("Flash Screen Video"),
};
-
diff --git a/gst-libs/ext/libav/libavcodec/flicvideo.c b/gst-libs/ext/libav/libavcodec/flicvideo.c
index b7bbfb4..0841335 100644
--- a/gst-libs/ext/libav/libavcodec/flicvideo.c
+++ b/gst-libs/ext/libav/libavcodec/flicvideo.c
@@ -111,10 +111,10 @@ static av_cold int flic_decode_init(AVCodecContext *avctx)
}
switch (depth) {
- case 8 : avctx->pix_fmt = PIX_FMT_PAL8; break;
- case 15 : avctx->pix_fmt = PIX_FMT_RGB555; break;
- case 16 : avctx->pix_fmt = PIX_FMT_RGB565; break;
- case 24 : avctx->pix_fmt = PIX_FMT_BGR24; /* Supposedly BGR, but havent any files to test with */
+ case 8 : avctx->pix_fmt = AV_PIX_FMT_PAL8; break;
+ case 15 : avctx->pix_fmt = AV_PIX_FMT_RGB555; break;
+ case 16 : avctx->pix_fmt = AV_PIX_FMT_RGB565; break;
+ case 24 : avctx->pix_fmt = AV_PIX_FMT_BGR24; /* Supposedly BGR, but havent any files to test with */
av_log(avctx, AV_LOG_ERROR, "24Bpp FLC/FLX is unsupported due to no test files.\n");
return -1;
default :
@@ -129,7 +129,7 @@ static av_cold int flic_decode_init(AVCodecContext *avctx)
}
static int flic_decode_frame_8BPP(AVCodecContext *avctx,
- void *data, int *data_size,
+ void *data, int *got_frame,
const uint8_t *buf, int buf_size)
{
FlicDecodeContext *s = avctx->priv_data;
@@ -348,6 +348,11 @@ static int flic_decode_frame_8BPP(AVCodecContext *avctx,
pixel_countdown = s->avctx->width;
while (pixel_countdown > 0) {
byte_run = sign_extend(bytestream2_get_byte(&g2), 8);
+ if (!byte_run) {
+ av_log(avctx, AV_LOG_ERROR, "Invalid byte run value.\n");
+ return AVERROR_INVALIDDATA;
+ }
+
if (byte_run > 0) {
palette_idx1 = bytestream2_get_byte(&g2);
CHECK_PIXEL_PTR(byte_run);
@@ -419,14 +424,14 @@ static int flic_decode_frame_8BPP(AVCodecContext *avctx,
s->new_palette = 0;
}
- *data_size=sizeof(AVFrame);
+ *got_frame = 1;
*(AVFrame*)data = s->frame;
return buf_size;
}
static int flic_decode_frame_15_16BPP(AVCodecContext *avctx,
- void *data, int *data_size,
+ void *data, int *got_frame,
const uint8_t *buf, int buf_size)
{
/* Note, the only difference between the 15Bpp and 16Bpp */
@@ -486,7 +491,9 @@ static int flic_decode_frame_15_16BPP(AVCodecContext *avctx,
/* For some reason, it seems that non-palettized flics do
* include one of these chunks in their first frame.
* Why I do not know, it seems rather extraneous. */
-/* av_log(avctx, AV_LOG_ERROR, "Unexpected Palette chunk %d in non-paletised FLC\n",chunk_type);*/
+ av_dlog(avctx,
+ "Unexpected Palette chunk %d in non-palettized FLC\n",
+ chunk_type);
bytestream2_skip(&g2, chunk_size - 6);
break;
@@ -579,7 +586,7 @@ static int flic_decode_frame_15_16BPP(AVCodecContext *avctx,
}
/* Now FLX is strange, in that it is "byte" as opposed to "pixel" run length compressed.
- * This does not give us any good oportunity to perform word endian conversion
+ * This does not give us any good opportunity to perform word endian conversion
* during decompression. So if it is required (i.e., this is not a LE target, we do
* a second pass over the line here, swapping the bytes.
*/
@@ -679,14 +686,14 @@ static int flic_decode_frame_15_16BPP(AVCodecContext *avctx,
"and final chunk ptr = %d\n", buf_size, bytestream2_tell(&g2));
- *data_size=sizeof(AVFrame);
+ *got_frame = 1;
*(AVFrame*)data = s->frame;
return buf_size;
}
static int flic_decode_frame_24BPP(AVCodecContext *avctx,
- void *data, int *data_size,
+ void *data, int *got_frame,
const uint8_t *buf, int buf_size)
{
av_log(avctx, AV_LOG_ERROR, "24Bpp FLC Unsupported due to lack of test files.\n");
@@ -694,22 +701,22 @@ static int flic_decode_frame_24BPP(AVCodecContext *avctx,
}
static int flic_decode_frame(AVCodecContext *avctx,
- void *data, int *data_size,
+ void *data, int *got_frame,
AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
- if (avctx->pix_fmt == PIX_FMT_PAL8) {
- return flic_decode_frame_8BPP(avctx, data, data_size,
+ if (avctx->pix_fmt == AV_PIX_FMT_PAL8) {
+ return flic_decode_frame_8BPP(avctx, data, got_frame,
buf, buf_size);
}
- else if ((avctx->pix_fmt == PIX_FMT_RGB555) ||
- (avctx->pix_fmt == PIX_FMT_RGB565)) {
- return flic_decode_frame_15_16BPP(avctx, data, data_size,
+ else if ((avctx->pix_fmt == AV_PIX_FMT_RGB555) ||
+ (avctx->pix_fmt == AV_PIX_FMT_RGB565)) {
+ return flic_decode_frame_15_16BPP(avctx, data, got_frame,
buf, buf_size);
}
- else if (avctx->pix_fmt == PIX_FMT_BGR24) {
- return flic_decode_frame_24BPP(avctx, data, data_size,
+ else if (avctx->pix_fmt == AV_PIX_FMT_BGR24) {
+ return flic_decode_frame_24BPP(avctx, data, got_frame,
buf, buf_size);
}
@@ -735,11 +742,11 @@ static av_cold int flic_decode_end(AVCodecContext *avctx)
AVCodec ff_flic_decoder = {
.name = "flic",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_FLIC,
+ .id = AV_CODEC_ID_FLIC,
.priv_data_size = sizeof(FlicDecodeContext),
.init = flic_decode_init,
.close = flic_decode_end,
.decode = flic_decode_frame,
.capabilities = CODEC_CAP_DR1,
- .long_name = NULL_IF_CONFIG_SMALL("Autodesk Animator Flic video"),
+ .long_name = NULL_IF_CONFIG_SMALL("Autodesk Animator Flic video"),
};
diff --git a/gst-libs/ext/libav/libavcodec/flvdec.c b/gst-libs/ext/libav/libavcodec/flvdec.c
index 29d6808..3640d29 100644
--- a/gst-libs/ext/libav/libavcodec/flvdec.c
+++ b/gst-libs/ext/libav/libavcodec/flvdec.c
@@ -89,8 +89,8 @@ int ff_flv_decode_picture_header(MpegEncContext *s)
s->height = height;
s->pict_type = AV_PICTURE_TYPE_I + get_bits(&s->gb, 2);
- s->dropable= s->pict_type > AV_PICTURE_TYPE_P;
- if (s->dropable)
+ s->droppable = s->pict_type > AV_PICTURE_TYPE_P;
+ if (s->droppable)
s->pict_type = AV_PICTURE_TYPE_P;
skip_bits1(&s->gb); /* deblocking flag */
@@ -109,7 +109,8 @@ int ff_flv_decode_picture_header(MpegEncContext *s)
if(s->avctx->debug & FF_DEBUG_PICT_INFO){
av_log(s->avctx, AV_LOG_DEBUG, "%c esc_type:%d, qp:%d num:%d\n",
- s->dropable ? 'D' : av_get_picture_type_char(s->pict_type), s->h263_flv-1, s->qscale, s->picture_number);
+ s->droppable ? 'D' : av_get_picture_type_char(s->pict_type),
+ s->h263_flv - 1, s->qscale, s->picture_number);
}
s->y_dc_scale_table=
@@ -121,13 +122,12 @@ int ff_flv_decode_picture_header(MpegEncContext *s)
AVCodec ff_flv_decoder = {
.name = "flv",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_FLV1,
+ .id = AV_CODEC_ID_FLV1,
.priv_data_size = sizeof(MpegEncContext),
.init = ff_h263_decode_init,
.close = ff_h263_decode_end,
.decode = ff_h263_decode_frame,
.capabilities = CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1,
- .max_lowres= 3,
- .long_name= NULL_IF_CONFIG_SMALL("Flash Video (FLV) / Sorenson Spark / Sorenson H.263"),
- .pix_fmts= ff_pixfmt_list_420,
+ .long_name = NULL_IF_CONFIG_SMALL("FLV / Sorenson Spark / Sorenson H.263 (Flash Video)"),
+ .pix_fmts = ff_pixfmt_list_420,
};
diff --git a/gst-libs/ext/libav/libavcodec/flvenc.c b/gst-libs/ext/libav/libavcodec/flvenc.c
index c0d9a04..5427cbc 100644
--- a/gst-libs/ext/libav/libavcodec/flvenc.c
+++ b/gst-libs/ext/libav/libavcodec/flvenc.c
@@ -84,14 +84,17 @@ void ff_flv2_encode_ac_esc(PutBitContext *pb, int slevel, int level, int run, in
}
}
+FF_MPV_GENERIC_CLASS(flv)
+
AVCodec ff_flv_encoder = {
.name = "flv",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_FLV1,
+ .id = AV_CODEC_ID_FLV1,
.priv_data_size = sizeof(MpegEncContext),
- .init = MPV_encode_init,
- .encode = MPV_encode_picture,
- .close = MPV_encode_end,
- .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE},
- .long_name= NULL_IF_CONFIG_SMALL("Flash Video (FLV) / Sorenson Spark / Sorenson H.263"),
+ .init = ff_MPV_encode_init,
+ .encode2 = ff_MPV_encode_picture,
+ .close = ff_MPV_encode_end,
+ .pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_YUV420P, AV_PIX_FMT_NONE },
+ .long_name = NULL_IF_CONFIG_SMALL("FLV / Sorenson Spark / Sorenson H.263 (Flash Video)"),
+ .priv_class = &flv_class,
};
diff --git a/gst-libs/ext/libav/libavcodec/fmtconvert.c b/gst-libs/ext/libav/libavcodec/fmtconvert.c
index 58fece7..642e1d2 100644
--- a/gst-libs/ext/libav/libavcodec/fmtconvert.c
+++ b/gst-libs/ext/libav/libavcodec/fmtconvert.c
@@ -22,6 +22,7 @@
#include "avcodec.h"
#include "fmtconvert.h"
+#include "libavutil/common.h"
static void int32_to_float_fmul_scalar_c(float *dst, const int *src, float mul, int len){
int i;
@@ -84,5 +85,5 @@ av_cold void ff_fmt_convert_init(FmtConvertContext *c, AVCodecContext *avctx)
if (ARCH_ARM) ff_fmt_convert_init_arm(c, avctx);
if (HAVE_ALTIVEC) ff_fmt_convert_init_altivec(c, avctx);
- if (HAVE_MMX) ff_fmt_convert_init_x86(c, avctx);
+ if (ARCH_X86) ff_fmt_convert_init_x86(c, avctx);
}
diff --git a/gst-libs/ext/libav/libavcodec/fmtconvert.h b/gst-libs/ext/libav/libavcodec/fmtconvert.h
index 1b53401..b879ee6 100644
--- a/gst-libs/ext/libav/libavcodec/fmtconvert.h
+++ b/gst-libs/ext/libav/libavcodec/fmtconvert.h
@@ -87,7 +87,7 @@ typedef struct FmtConvertContext {
void ff_float_interleave_c(float *dst, const float **src, unsigned int len,
int channels);
-void ff_fmt_convert_init(FmtConvertContext *c, AVCodecContext *avctx);
+av_cold void ff_fmt_convert_init(FmtConvertContext *c, AVCodecContext *avctx);
void ff_fmt_convert_init_arm(FmtConvertContext *c, AVCodecContext *avctx);
void ff_fmt_convert_init_altivec(FmtConvertContext *c, AVCodecContext *avctx);
diff --git a/gst-libs/ext/libav/libavcodec/fraps.c b/gst-libs/ext/libav/libavcodec/fraps.c
index 4d03057..6ac0c61 100644
--- a/gst-libs/ext/libav/libavcodec/fraps.c
+++ b/gst-libs/ext/libav/libavcodec/fraps.c
@@ -46,6 +46,7 @@ typedef struct FrapsContext{
AVCodecContext *avctx;
AVFrame frame;
uint8_t *tmpbuf;
+ int tmpbuf_size;
DSPContext dsp;
} FrapsContext;
@@ -59,13 +60,13 @@ static av_cold int decode_init(AVCodecContext *avctx)
{
FrapsContext * const s = avctx->priv_data;
- avctx->coded_frame = (AVFrame*)&s->frame;
- avctx->pix_fmt= PIX_FMT_NONE; /* set in decode_frame */
+ avctx->coded_frame = &s->frame;
+ avctx->pix_fmt= AV_PIX_FMT_NONE; /* set in decode_frame */
s->avctx = avctx;
s->tmpbuf = NULL;
- dsputil_init(&s->dsp, avctx);
+ ff_dsputil_init(&s->dsp, avctx);
return 0;
}
@@ -123,14 +124,14 @@ static int fraps2_decode_plane(FrapsContext *s, uint8_t *dst, int stride, int w,
}
static int decode_frame(AVCodecContext *avctx,
- void *data, int *data_size,
+ void *data, int *got_frame,
AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
FrapsContext * const s = avctx->priv_data;
AVFrame *frame = data;
- AVFrame * const f = (AVFrame*)&s->frame;
+ AVFrame * const f = &s->frame;
uint32_t header;
unsigned int version,header_size;
unsigned int x, y;
@@ -138,7 +139,7 @@ static int decode_frame(AVCodecContext *avctx,
uint32_t *luma1,*luma2,*cb,*cr;
uint32_t offs[4];
int i, j, is_chroma, planes;
- enum PixelFormat pix_fmt;
+ enum AVPixelFormat pix_fmt;
header = AV_RL32(buf);
version = header & 0xff;
@@ -155,7 +156,7 @@ static int decode_frame(AVCodecContext *avctx,
if (header_size == 8)
buf+=4;
- pix_fmt = version & 1 ? PIX_FMT_BGR24 : PIX_FMT_YUVJ420P;
+ pix_fmt = version & 1 ? AV_PIX_FMT_BGR24 : AV_PIX_FMT_YUVJ420P;
if (avctx->pix_fmt != pix_fmt && f->data[0]) {
avctx->release_buffer(avctx, f);
}
@@ -234,7 +235,7 @@ static int decode_frame(AVCodecContext *avctx,
if (f->pict_type == AV_PICTURE_TYPE_I) {
for(y=0; y<avctx->height; y++)
- memcpy(&f->data[0][ (avctx->height-y)*f->linesize[0] ],
+ memcpy(&f->data[0][ (avctx->height - y -1) * f->linesize[0]],
&buf[y*avctx->width*3],
3*avctx->width);
}
@@ -277,7 +278,10 @@ static int decode_frame(AVCodecContext *avctx,
offs[planes] = buf_size;
for(i = 0; i < planes; i++){
is_chroma = !!i;
- s->tmpbuf = av_realloc(s->tmpbuf, offs[i + 1] - offs[i] - 1024 + FF_INPUT_BUFFER_PADDING_SIZE);
+ av_fast_padded_malloc(&s->tmpbuf, &s->tmpbuf_size,
+ offs[i + 1] - offs[i] - 1024);
+ if (!s->tmpbuf)
+ return AVERROR(ENOMEM);
if(fraps2_decode_plane(s, f->data[i], f->linesize[i], avctx->width >> is_chroma,
avctx->height >> is_chroma, buf + offs[i], offs[i + 1] - offs[i], is_chroma, 1) < 0) {
av_log(avctx, AV_LOG_ERROR, "Error decoding plane %i\n", i);
@@ -318,7 +322,10 @@ static int decode_frame(AVCodecContext *avctx,
}
offs[planes] = buf_size;
for(i = 0; i < planes; i++){
- s->tmpbuf = av_realloc(s->tmpbuf, offs[i + 1] - offs[i] - 1024 + FF_INPUT_BUFFER_PADDING_SIZE);
+ av_fast_padded_malloc(&s->tmpbuf, &s->tmpbuf_size,
+ offs[i + 1] - offs[i] - 1024);
+ if (!s->tmpbuf)
+ return AVERROR(ENOMEM);
if(fraps2_decode_plane(s, f->data[0] + i + (f->linesize[0] * (avctx->height - 1)), -f->linesize[0],
avctx->width, avctx->height, buf + offs[i], offs[i + 1] - offs[i], 0, 3) < 0) {
av_log(avctx, AV_LOG_ERROR, "Error decoding plane %i\n", i);
@@ -336,7 +343,7 @@ static int decode_frame(AVCodecContext *avctx,
}
*frame = *f;
- *data_size = sizeof(AVFrame);
+ *got_frame = 1;
return buf_size;
}
@@ -362,11 +369,11 @@ static av_cold int decode_end(AVCodecContext *avctx)
AVCodec ff_fraps_decoder = {
.name = "fraps",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_FRAPS,
+ .id = AV_CODEC_ID_FRAPS,
.priv_data_size = sizeof(FrapsContext),
.init = decode_init,
.close = decode_end,
.decode = decode_frame,
.capabilities = CODEC_CAP_DR1,
- .long_name = NULL_IF_CONFIG_SMALL("Fraps"),
+ .long_name = NULL_IF_CONFIG_SMALL("Fraps"),
};
diff --git a/gst-libs/ext/libav/libavcodec/frwu.c b/gst-libs/ext/libav/libavcodec/frwu.c
index 061c460..3f8f6ba 100644
--- a/gst-libs/ext/libav/libavcodec/frwu.c
+++ b/gst-libs/ext/libav/libavcodec/frwu.c
@@ -22,25 +22,27 @@
#include "avcodec.h"
#include "bytestream.h"
-#include "libavutil/intreadwrite.h"
+#include "internal.h"
static av_cold int decode_init(AVCodecContext *avctx)
{
if (avctx->width & 1) {
- av_log(avctx, AV_LOG_ERROR, "FRWU needs even width\n");
- return -1;
+ av_log(avctx, AV_LOG_ERROR, "frwu needs even width\n");
+ return AVERROR(EINVAL);
}
- avctx->pix_fmt = PIX_FMT_UYVY422;
+ avctx->pix_fmt = AV_PIX_FMT_UYVY422;
avctx->coded_frame = avcodec_alloc_frame();
+ if (!avctx->coded_frame)
+ return AVERROR(ENOMEM);
return 0;
}
-static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
+static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
AVPacket *avpkt)
{
- int field;
+ int field, ret;
AVFrame *pic = avctx->coded_frame;
const uint8_t *buf = avpkt->data;
const uint8_t *buf_end = buf + avpkt->size;
@@ -50,16 +52,18 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
if (avpkt->size < avctx->width * 2 * avctx->height + 4 + 2*8) {
av_log(avctx, AV_LOG_ERROR, "Packet is too small.\n");
- return -1;
+ return AVERROR_INVALIDDATA;
}
- if (bytestream_get_le32(&buf) != AV_RL32("FRW1")) {
+ if (bytestream_get_le32(&buf) != MKTAG('F', 'R', 'W', '1')) {
av_log(avctx, AV_LOG_ERROR, "incorrect marker\n");
- return -1;
+ return AVERROR_INVALIDDATA;
}
pic->reference = 0;
- if (avctx->get_buffer(avctx, pic) < 0)
- return -1;
+ if ((ret = ff_get_buffer(avctx, pic)) < 0) {
+ av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
+ return ret;
+ }
pic->pict_type = AV_PICTURE_TYPE_I;
pic->key_frame = 1;
@@ -72,16 +76,16 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
int field_size, min_field_size = avctx->width * 2 * field_h;
uint8_t *dst = pic->data[0];
if (buf_end - buf < 8)
- return -1;
+ return AVERROR_INVALIDDATA;
buf += 4; // flags? 0x80 == bottom field maybe?
field_size = bytestream_get_le32(&buf);
if (field_size < min_field_size) {
av_log(avctx, AV_LOG_ERROR, "Field size %i is too small (required %i)\n", field_size, min_field_size);
- return -1;
+ return AVERROR_INVALIDDATA;
}
if (buf_end - buf < field_size) {
av_log(avctx, AV_LOG_ERROR, "Packet is too small, need %i, have %i\n", field_size, (int)(buf_end - buf));
- return -1;
+ return AVERROR_INVALIDDATA;
}
if (field)
dst += pic->linesize[0];
@@ -93,7 +97,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
buf += field_size - min_field_size;
}
- *data_size = sizeof(AVFrame);
+ *got_frame = 1;
*(AVFrame*)data = *pic;
return avpkt->size;
@@ -110,12 +114,12 @@ static av_cold int decode_close(AVCodecContext *avctx)
}
AVCodec ff_frwu_decoder = {
- .name = "FRWU",
+ .name = "frwu",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_FRWU,
+ .id = AV_CODEC_ID_FRWU,
.init = decode_init,
.close = decode_close,
.decode = decode_frame,
.capabilities = CODEC_CAP_DR1,
- .long_name = NULL_IF_CONFIG_SMALL("Forward Uncompressed"),
+ .long_name = NULL_IF_CONFIG_SMALL("Forward Uncompressed"),
};
diff --git a/gst-libs/ext/libav/libavcodec/g722.h b/gst-libs/ext/libav/libavcodec/g722.h
index eb3b9b8..bab1da4 100644
--- a/gst-libs/ext/libav/libavcodec/g722.h
+++ b/gst-libs/ext/libav/libavcodec/g722.h
@@ -30,7 +30,7 @@
#define PREV_SAMPLES_BUF_SIZE 1024
-typedef struct {
+typedef struct G722Context {
const AVClass *class;
AVFrame frame;
int bits_per_codeword;
diff --git a/gst-libs/ext/libav/libavcodec/g722dec.c b/gst-libs/ext/libav/libavcodec/g722dec.c
index 72bb0ef..51d5721 100644
--- a/gst-libs/ext/libav/libavcodec/g722dec.c
+++ b/gst-libs/ext/libav/libavcodec/g722dec.c
@@ -34,15 +34,17 @@
* respectively of each byte are ignored.
*/
+#include "libavutil/channel_layout.h"
+#include "libavutil/opt.h"
#include "avcodec.h"
#include "get_bits.h"
#include "g722.h"
-#include "libavutil/opt.h"
+#include "internal.h"
#define OFFSET(x) offsetof(G722Context, x)
#define AD AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_DECODING_PARAM
static const AVOption options[] = {
- { "bits_per_codeword", "Bits per G722 codeword", OFFSET(bits_per_codeword), AV_OPT_TYPE_FLAGS, { 8 }, 6, 8, AD },
+ { "bits_per_codeword", "Bits per G722 codeword", OFFSET(bits_per_codeword), AV_OPT_TYPE_FLAGS, { .i64 = 8 }, 6, 8, AD },
{ NULL }
};
@@ -57,11 +59,9 @@ static av_cold int g722_decode_init(AVCodecContext * avctx)
{
G722Context *c = avctx->priv_data;
- if (avctx->channels != 1) {
- av_log(avctx, AV_LOG_ERROR, "Only mono tracks are allowed.\n");
- return AVERROR_INVALIDDATA;
- }
- avctx->sample_fmt = AV_SAMPLE_FMT_S16;
+ avctx->channels = 1;
+ avctx->channel_layout = AV_CH_LAYOUT_MONO;
+ avctx->sample_fmt = AV_SAMPLE_FMT_S16;
c->band[0].scale_factor = 8;
c->band[1].scale_factor = 2;
@@ -96,7 +96,7 @@ static int g722_decode_frame(AVCodecContext *avctx, void *data,
/* get output buffer */
c->frame.nb_samples = avpkt->size * 2;
- if ((ret = avctx->get_buffer(avctx, &c->frame)) < 0) {
+ if ((ret = ff_get_buffer(avctx, &c->frame)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return ret;
}
@@ -144,7 +144,7 @@ static int g722_decode_frame(AVCodecContext *avctx, void *data,
AVCodec ff_adpcm_g722_decoder = {
.name = "g722",
.type = AVMEDIA_TYPE_AUDIO,
- .id = CODEC_ID_ADPCM_G722,
+ .id = AV_CODEC_ID_ADPCM_G722,
.priv_data_size = sizeof(G722Context),
.init = g722_decode_init,
.decode = g722_decode_frame,
diff --git a/gst-libs/ext/libav/libavcodec/g722enc.c b/gst-libs/ext/libav/libavcodec/g722enc.c
index b5707e3..11d3f20 100644
--- a/gst-libs/ext/libav/libavcodec/g722enc.c
+++ b/gst-libs/ext/libav/libavcodec/g722enc.c
@@ -28,7 +28,9 @@
*/
#include "avcodec.h"
+#include "internal.h"
#include "g722.h"
+#include "libavutil/common.h"
#define FREEZE_INTERVAL 128
@@ -41,9 +43,25 @@
#define MIN_TRELLIS 0
#define MAX_TRELLIS 16
+static av_cold int g722_encode_close(AVCodecContext *avctx)
+{
+ G722Context *c = avctx->priv_data;
+ int i;
+ for (i = 0; i < 2; i++) {
+ av_freep(&c->paths[i]);
+ av_freep(&c->node_buf[i]);
+ av_freep(&c->nodep_buf[i]);
+ }
+#if FF_API_OLD_ENCODE_AUDIO
+ av_freep(&avctx->coded_frame);
+#endif
+ return 0;
+}
+
static av_cold int g722_encode_init(AVCodecContext * avctx)
{
G722Context *c = avctx->priv_data;
+ int ret;
if (avctx->channels != 1) {
av_log(avctx, AV_LOG_ERROR, "Only mono tracks are allowed.\n");
@@ -62,6 +80,10 @@ static av_cold int g722_encode_init(AVCodecContext * avctx)
c->paths[i] = av_mallocz(max_paths * sizeof(**c->paths));
c->node_buf[i] = av_mallocz(2 * frontier * sizeof(**c->node_buf));
c->nodep_buf[i] = av_mallocz(2 * frontier * sizeof(**c->nodep_buf));
+ if (!c->paths[i] || !c->node_buf[i] || !c->nodep_buf[i]) {
+ ret = AVERROR(ENOMEM);
+ goto error;
+ }
}
}
@@ -87,6 +109,7 @@ static av_cold int g722_encode_init(AVCodecContext * avctx)
a common packet size for VoIP applications */
avctx->frame_size = 320;
}
+ avctx->delay = 22;
if (avctx->trellis) {
/* validate trellis */
@@ -99,19 +122,18 @@ static av_cold int g722_encode_init(AVCodecContext * avctx)
}
}
- return 0;
-}
-
-static av_cold int g722_encode_close(AVCodecContext *avctx)
-{
- G722Context *c = avctx->priv_data;
- int i;
- for (i = 0; i < 2; i++) {
- av_freep(&c->paths[i]);
- av_freep(&c->node_buf[i]);
- av_freep(&c->nodep_buf[i]);
+#if FF_API_OLD_ENCODE_AUDIO
+ avctx->coded_frame = avcodec_alloc_frame();
+ if (!avctx->coded_frame) {
+ ret = AVERROR(ENOMEM);
+ goto error;
}
+#endif
+
return 0;
+error:
+ g722_encode_close(avctx);
+ return ret;
}
static const int16_t low_quant[33] = {
@@ -174,7 +196,7 @@ static void g722_encode_trellis(G722Context *c, int trellis,
for (i = 0; i < 2; i++) {
nodes[i] = c->nodep_buf[i];
nodes_next[i] = c->nodep_buf[i] + frontier;
- memset(c->nodep_buf[i], 0, 2 * frontier * sizeof(*c->nodep_buf));
+ memset(c->nodep_buf[i], 0, 2 * frontier * sizeof(*c->nodep_buf[i]));
nodes[i][0] = c->node_buf[i] + frontier;
nodes[i][0]->ssd = 0;
nodes[i][0]->path = 0;
@@ -337,38 +359,48 @@ static void g722_encode_no_trellis(G722Context *c,
encode_byte(c, dst++, &samples[i]);
}
-static int g722_encode_frame(AVCodecContext *avctx,
- uint8_t *dst, int buf_size, void *data)
+static int g722_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
+ const AVFrame *frame, int *got_packet_ptr)
{
G722Context *c = avctx->priv_data;
- const int16_t *samples = data;
- int nb_samples;
+ const int16_t *samples = (const int16_t *)frame->data[0];
+ int nb_samples, out_size, ret;
- nb_samples = avctx->frame_size - (avctx->frame_size & 1);
+ out_size = (frame->nb_samples + 1) / 2;
+ if ((ret = ff_alloc_packet(avpkt, out_size))) {
+ av_log(avctx, AV_LOG_ERROR, "Error getting output packet\n");
+ return ret;
+ }
+
+ nb_samples = frame->nb_samples - (frame->nb_samples & 1);
if (avctx->trellis)
- g722_encode_trellis(c, avctx->trellis, dst, nb_samples, samples);
+ g722_encode_trellis(c, avctx->trellis, avpkt->data, nb_samples, samples);
else
- g722_encode_no_trellis(c, dst, nb_samples, samples);
+ g722_encode_no_trellis(c, avpkt->data, nb_samples, samples);
/* handle last frame with odd frame_size */
- if (nb_samples < avctx->frame_size) {
+ if (nb_samples < frame->nb_samples) {
int16_t last_samples[2] = { samples[nb_samples], samples[nb_samples] };
- encode_byte(c, &dst[nb_samples >> 1], last_samples);
+ encode_byte(c, &avpkt->data[nb_samples >> 1], last_samples);
}
- return (avctx->frame_size + 1) >> 1;
+ if (frame->pts != AV_NOPTS_VALUE)
+ avpkt->pts = frame->pts - ff_samples_to_time_base(avctx, avctx->delay);
+ *got_packet_ptr = 1;
+ return 0;
}
AVCodec ff_adpcm_g722_encoder = {
.name = "g722",
.type = AVMEDIA_TYPE_AUDIO,
- .id = CODEC_ID_ADPCM_G722,
+ .id = AV_CODEC_ID_ADPCM_G722,
.priv_data_size = sizeof(G722Context),
.init = g722_encode_init,
.close = g722_encode_close,
- .encode = g722_encode_frame,
+ .encode2 = g722_encode_frame,
.capabilities = CODEC_CAP_SMALL_LAST_FRAME,
.long_name = NULL_IF_CONFIG_SMALL("G.722 ADPCM"),
- .sample_fmts = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_NONE},
+ .sample_fmts = (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_S16,
+ AV_SAMPLE_FMT_NONE },
};
diff --git a/gst-libs/ext/libav/libavcodec/g723_1.c b/gst-libs/ext/libav/libavcodec/g723_1.c
new file mode 100644
index 0000000..b1fbe98
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/g723_1.c
@@ -0,0 +1,1382 @@
+/*
+ * G.723.1 compatible decoder
+ * Copyright (c) 2006 Benjamin Larsson
+ * Copyright (c) 2010 Mohamed Naufal Basheer
+ *
+ * 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
+ * G.723.1 compatible decoder
+ */
+
+#define BITSTREAM_READER_LE
+#include "libavutil/channel_layout.h"
+#include "libavutil/mem.h"
+#include "libavutil/opt.h"
+#include "avcodec.h"
+#include "get_bits.h"
+#include "acelp_vectors.h"
+#include "celp_filters.h"
+#include "g723_1_data.h"
+#include "internal.h"
+
+#define CNG_RANDOM_SEED 12345
+
+/**
+ * G723.1 frame types
+ */
+enum FrameType {
+ ACTIVE_FRAME, ///< Active speech
+ SID_FRAME, ///< Silence Insertion Descriptor frame
+ UNTRANSMITTED_FRAME
+};
+
+enum Rate {
+ RATE_6300,
+ RATE_5300
+};
+
+/**
+ * G723.1 unpacked data subframe
+ */
+typedef struct {
+ int ad_cb_lag; ///< adaptive codebook lag
+ int ad_cb_gain;
+ int dirac_train;
+ int pulse_sign;
+ int grid_index;
+ int amp_index;
+ int pulse_pos;
+} G723_1_Subframe;
+
+/**
+ * Pitch postfilter parameters
+ */
+typedef struct {
+ int index; ///< postfilter backward/forward lag
+ int16_t opt_gain; ///< optimal gain
+ int16_t sc_gain; ///< scaling gain
+} PPFParam;
+
+typedef struct g723_1_context {
+ AVClass *class;
+ AVFrame frame;
+
+ G723_1_Subframe subframe[4];
+ enum FrameType cur_frame_type;
+ enum FrameType past_frame_type;
+ enum Rate cur_rate;
+ uint8_t lsp_index[LSP_BANDS];
+ int pitch_lag[2];
+ int erased_frames;
+
+ int16_t prev_lsp[LPC_ORDER];
+ int16_t sid_lsp[LPC_ORDER];
+ int16_t prev_excitation[PITCH_MAX];
+ int16_t excitation[PITCH_MAX + FRAME_LEN + 4];
+ int16_t synth_mem[LPC_ORDER];
+ int16_t fir_mem[LPC_ORDER];
+ int iir_mem[LPC_ORDER];
+
+ int random_seed;
+ int cng_random_seed;
+ int interp_index;
+ int interp_gain;
+ int sid_gain;
+ int cur_gain;
+ int reflection_coef;
+ int pf_gain;
+ int postfilter;
+
+ int16_t audio[FRAME_LEN + LPC_ORDER + PITCH_MAX + 4];
+} G723_1_Context;
+
+static av_cold int g723_1_decode_init(AVCodecContext *avctx)
+{
+ G723_1_Context *p = avctx->priv_data;
+
+ avctx->channel_layout = AV_CH_LAYOUT_MONO;
+ avctx->sample_fmt = AV_SAMPLE_FMT_S16;
+ avctx->channels = 1;
+ avctx->sample_rate = 8000;
+ p->pf_gain = 1 << 12;
+
+ avcodec_get_frame_defaults(&p->frame);
+ avctx->coded_frame = &p->frame;
+
+ memcpy(p->prev_lsp, dc_lsp, LPC_ORDER * sizeof(*p->prev_lsp));
+ memcpy(p->sid_lsp, dc_lsp, LPC_ORDER * sizeof(*p->sid_lsp));
+
+ p->cng_random_seed = CNG_RANDOM_SEED;
+ p->past_frame_type = SID_FRAME;
+
+ return 0;
+}
+
+/**
+ * Unpack the frame into parameters.
+ *
+ * @param p the context
+ * @param buf pointer to the input buffer
+ * @param buf_size size of the input buffer
+ */
+static int unpack_bitstream(G723_1_Context *p, const uint8_t *buf,
+ int buf_size)
+{
+ GetBitContext gb;
+ int ad_cb_len;
+ int temp, info_bits, i;
+
+ init_get_bits(&gb, buf, buf_size * 8);
+
+ /* Extract frame type and rate info */
+ info_bits = get_bits(&gb, 2);
+
+ if (info_bits == 3) {
+ p->cur_frame_type = UNTRANSMITTED_FRAME;
+ return 0;
+ }
+
+ /* Extract 24 bit lsp indices, 8 bit for each band */
+ p->lsp_index[2] = get_bits(&gb, 8);
+ p->lsp_index[1] = get_bits(&gb, 8);
+ p->lsp_index[0] = get_bits(&gb, 8);
+
+ if (info_bits == 2) {
+ p->cur_frame_type = SID_FRAME;
+ p->subframe[0].amp_index = get_bits(&gb, 6);
+ return 0;
+ }
+
+ /* Extract the info common to both rates */
+ p->cur_rate = info_bits ? RATE_5300 : RATE_6300;
+ p->cur_frame_type = ACTIVE_FRAME;
+
+ p->pitch_lag[0] = get_bits(&gb, 7);
+ if (p->pitch_lag[0] > 123) /* test if forbidden code */
+ return -1;
+ p->pitch_lag[0] += PITCH_MIN;
+ p->subframe[1].ad_cb_lag = get_bits(&gb, 2);
+
+ p->pitch_lag[1] = get_bits(&gb, 7);
+ if (p->pitch_lag[1] > 123)
+ return -1;
+ p->pitch_lag[1] += PITCH_MIN;
+ p->subframe[3].ad_cb_lag = get_bits(&gb, 2);
+ p->subframe[0].ad_cb_lag = 1;
+ p->subframe[2].ad_cb_lag = 1;
+
+ for (i = 0; i < SUBFRAMES; i++) {
+ /* Extract combined gain */
+ temp = get_bits(&gb, 12);
+ ad_cb_len = 170;
+ p->subframe[i].dirac_train = 0;
+ if (p->cur_rate == RATE_6300 && p->pitch_lag[i >> 1] < SUBFRAME_LEN - 2) {
+ p->subframe[i].dirac_train = temp >> 11;
+ temp &= 0x7FF;
+ ad_cb_len = 85;
+ }
+ p->subframe[i].ad_cb_gain = FASTDIV(temp, GAIN_LEVELS);
+ if (p->subframe[i].ad_cb_gain < ad_cb_len) {
+ p->subframe[i].amp_index = temp - p->subframe[i].ad_cb_gain *
+ GAIN_LEVELS;
+ } else {
+ return -1;
+ }
+ }
+
+ p->subframe[0].grid_index = get_bits(&gb, 1);
+ p->subframe[1].grid_index = get_bits(&gb, 1);
+ p->subframe[2].grid_index = get_bits(&gb, 1);
+ p->subframe[3].grid_index = get_bits(&gb, 1);
+
+ if (p->cur_rate == RATE_6300) {
+ skip_bits(&gb, 1); /* skip reserved bit */
+
+ /* Compute pulse_pos index using the 13-bit combined position index */
+ temp = get_bits(&gb, 13);
+ p->subframe[0].pulse_pos = temp / 810;
+
+ temp -= p->subframe[0].pulse_pos * 810;
+ p->subframe[1].pulse_pos = FASTDIV(temp, 90);
+
+ temp -= p->subframe[1].pulse_pos * 90;
+ p->subframe[2].pulse_pos = FASTDIV(temp, 9);
+ p->subframe[3].pulse_pos = temp - p->subframe[2].pulse_pos * 9;
+
+ p->subframe[0].pulse_pos = (p->subframe[0].pulse_pos << 16) +
+ get_bits(&gb, 16);
+ p->subframe[1].pulse_pos = (p->subframe[1].pulse_pos << 14) +
+ get_bits(&gb, 14);
+ p->subframe[2].pulse_pos = (p->subframe[2].pulse_pos << 16) +
+ get_bits(&gb, 16);
+ p->subframe[3].pulse_pos = (p->subframe[3].pulse_pos << 14) +
+ get_bits(&gb, 14);
+
+ p->subframe[0].pulse_sign = get_bits(&gb, 6);
+ p->subframe[1].pulse_sign = get_bits(&gb, 5);
+ p->subframe[2].pulse_sign = get_bits(&gb, 6);
+ p->subframe[3].pulse_sign = get_bits(&gb, 5);
+ } else { /* 5300 bps */
+ p->subframe[0].pulse_pos = get_bits(&gb, 12);
+ p->subframe[1].pulse_pos = get_bits(&gb, 12);
+ p->subframe[2].pulse_pos = get_bits(&gb, 12);
+ p->subframe[3].pulse_pos = get_bits(&gb, 12);
+
+ p->subframe[0].pulse_sign = get_bits(&gb, 4);
+ p->subframe[1].pulse_sign = get_bits(&gb, 4);
+ p->subframe[2].pulse_sign = get_bits(&gb, 4);
+ p->subframe[3].pulse_sign = get_bits(&gb, 4);
+ }
+
+ return 0;
+}
+
+/**
+ * Bitexact implementation of sqrt(val/2).
+ */
+static int16_t square_root(int val)
+{
+ int16_t res = 0;
+ int16_t exp = 0x4000;
+ int i;
+
+ for (i = 0; i < 14; i ++) {
+ int res_exp = res + exp;
+ if (val >= res_exp * res_exp << 1)
+ res += exp;
+ exp >>= 1;
+ }
+ return res;
+}
+
+/**
+ * Calculate the number of left-shifts required for normalizing the input.
+ *
+ * @param num input number
+ * @param width width of the input, 16 bits(0) / 32 bits(1)
+ */
+static int normalize_bits(int num, int width)
+{
+ return width - av_log2(num) - 1;
+}
+
+/**
+ * Scale vector contents based on the largest of their absolutes.
+ */
+static int scale_vector(int16_t *dst, const int16_t *vector, int length)
+{
+ int bits, max = 0;
+ int i;
+
+
+ for (i = 0; i < length; i++)
+ max |= FFABS(vector[i]);
+
+ max = FFMIN(max, 0x7FFF);
+ bits = normalize_bits(max, 15);
+
+ for (i = 0; i < length; i++)
+ dst[i] = vector[i] << bits >> 3;
+
+ return bits - 3;
+}
+
+/**
+ * Perform inverse quantization of LSP frequencies.
+ *
+ * @param cur_lsp the current LSP vector
+ * @param prev_lsp the previous LSP vector
+ * @param lsp_index VQ indices
+ * @param bad_frame bad frame flag
+ */
+static void inverse_quant(int16_t *cur_lsp, int16_t *prev_lsp,
+ uint8_t *lsp_index, int bad_frame)
+{
+ int min_dist, pred;
+ int i, j, temp, stable;
+
+ /* Check for frame erasure */
+ if (!bad_frame) {
+ min_dist = 0x100;
+ pred = 12288;
+ } else {
+ min_dist = 0x200;
+ pred = 23552;
+ lsp_index[0] = lsp_index[1] = lsp_index[2] = 0;
+ }
+
+ /* Get the VQ table entry corresponding to the transmitted index */
+ cur_lsp[0] = lsp_band0[lsp_index[0]][0];
+ cur_lsp[1] = lsp_band0[lsp_index[0]][1];
+ cur_lsp[2] = lsp_band0[lsp_index[0]][2];
+ cur_lsp[3] = lsp_band1[lsp_index[1]][0];
+ cur_lsp[4] = lsp_band1[lsp_index[1]][1];
+ cur_lsp[5] = lsp_band1[lsp_index[1]][2];
+ cur_lsp[6] = lsp_band2[lsp_index[2]][0];
+ cur_lsp[7] = lsp_band2[lsp_index[2]][1];
+ cur_lsp[8] = lsp_band2[lsp_index[2]][2];
+ cur_lsp[9] = lsp_band2[lsp_index[2]][3];
+
+ /* Add predicted vector & DC component to the previously quantized vector */
+ for (i = 0; i < LPC_ORDER; i++) {
+ temp = ((prev_lsp[i] - dc_lsp[i]) * pred + (1 << 14)) >> 15;
+ cur_lsp[i] += dc_lsp[i] + temp;
+ }
+
+ for (i = 0; i < LPC_ORDER; i++) {
+ cur_lsp[0] = FFMAX(cur_lsp[0], 0x180);
+ cur_lsp[LPC_ORDER - 1] = FFMIN(cur_lsp[LPC_ORDER - 1], 0x7e00);
+
+ /* Stability check */
+ for (j = 1; j < LPC_ORDER; j++) {
+ temp = min_dist + cur_lsp[j - 1] - cur_lsp[j];
+ if (temp > 0) {
+ temp >>= 1;
+ cur_lsp[j - 1] -= temp;
+ cur_lsp[j] += temp;
+ }
+ }
+ stable = 1;
+ for (j = 1; j < LPC_ORDER; j++) {
+ temp = cur_lsp[j - 1] + min_dist - cur_lsp[j] - 4;
+ if (temp > 0) {
+ stable = 0;
+ break;
+ }
+ }
+ if (stable)
+ break;
+ }
+ if (!stable)
+ memcpy(cur_lsp, prev_lsp, LPC_ORDER * sizeof(*cur_lsp));
+}
+
+/**
+ * Bitexact implementation of 2ab scaled by 1/2^16.
+ *
+ * @param a 32 bit multiplicand
+ * @param b 16 bit multiplier
+ */
+#define MULL2(a, b) \
+ ((((a) >> 16) * (b) << 1) + (((a) & 0xffff) * (b) >> 15))
+
+/**
+ * Convert LSP frequencies to LPC coefficients.
+ *
+ * @param lpc buffer for LPC coefficients
+ */
+static void lsp2lpc(int16_t *lpc)
+{
+ int f1[LPC_ORDER / 2 + 1];
+ int f2[LPC_ORDER / 2 + 1];
+ int i, j;
+
+ /* Calculate negative cosine */
+ for (j = 0; j < LPC_ORDER; j++) {
+ int index = lpc[j] >> 7;
+ int offset = lpc[j] & 0x7f;
+ int temp1 = cos_tab[index] << 16;
+ int temp2 = (cos_tab[index + 1] - cos_tab[index]) *
+ ((offset << 8) + 0x80) << 1;
+
+ lpc[j] = -(av_sat_dadd32(1 << 15, temp1 + temp2) >> 16);
+ }
+
+ /*
+ * Compute sum and difference polynomial coefficients
+ * (bitexact alternative to lsp2poly() in lsp.c)
+ */
+ /* Initialize with values in Q28 */
+ f1[0] = 1 << 28;
+ f1[1] = (lpc[0] << 14) + (lpc[2] << 14);
+ f1[2] = lpc[0] * lpc[2] + (2 << 28);
+
+ f2[0] = 1 << 28;
+ f2[1] = (lpc[1] << 14) + (lpc[3] << 14);
+ f2[2] = lpc[1] * lpc[3] + (2 << 28);
+
+ /*
+ * Calculate and scale the coefficients by 1/2 in
+ * each iteration for a final scaling factor of Q25
+ */
+ for (i = 2; i < LPC_ORDER / 2; i++) {
+ f1[i + 1] = f1[i - 1] + MULL2(f1[i], lpc[2 * i]);
+ f2[i + 1] = f2[i - 1] + MULL2(f2[i], lpc[2 * i + 1]);
+
+ for (j = i; j >= 2; j--) {
+ f1[j] = MULL2(f1[j - 1], lpc[2 * i]) +
+ (f1[j] >> 1) + (f1[j - 2] >> 1);
+ f2[j] = MULL2(f2[j - 1], lpc[2 * i + 1]) +
+ (f2[j] >> 1) + (f2[j - 2] >> 1);
+ }
+
+ f1[0] >>= 1;
+ f2[0] >>= 1;
+ f1[1] = ((lpc[2 * i] << 16 >> i) + f1[1]) >> 1;
+ f2[1] = ((lpc[2 * i + 1] << 16 >> i) + f2[1]) >> 1;
+ }
+
+ /* Convert polynomial coefficients to LPC coefficients */
+ for (i = 0; i < LPC_ORDER / 2; i++) {
+ int64_t ff1 = f1[i + 1] + f1[i];
+ int64_t ff2 = f2[i + 1] - f2[i];
+
+ lpc[i] = av_clipl_int32(((ff1 + ff2) << 3) + (1 << 15)) >> 16;
+ lpc[LPC_ORDER - i - 1] = av_clipl_int32(((ff1 - ff2) << 3) +
+ (1 << 15)) >> 16;
+ }
+}
+
+/**
+ * Quantize LSP frequencies by interpolation and convert them to
+ * the corresponding LPC coefficients.
+ *
+ * @param lpc buffer for LPC coefficients
+ * @param cur_lsp the current LSP vector
+ * @param prev_lsp the previous LSP vector
+ */
+static void lsp_interpolate(int16_t *lpc, int16_t *cur_lsp, int16_t *prev_lsp)
+{
+ int i;
+ int16_t *lpc_ptr = lpc;
+
+ /* cur_lsp * 0.25 + prev_lsp * 0.75 */
+ ff_acelp_weighted_vector_sum(lpc, cur_lsp, prev_lsp,
+ 4096, 12288, 1 << 13, 14, LPC_ORDER);
+ ff_acelp_weighted_vector_sum(lpc + LPC_ORDER, cur_lsp, prev_lsp,
+ 8192, 8192, 1 << 13, 14, LPC_ORDER);
+ ff_acelp_weighted_vector_sum(lpc + 2 * LPC_ORDER, cur_lsp, prev_lsp,
+ 12288, 4096, 1 << 13, 14, LPC_ORDER);
+ memcpy(lpc + 3 * LPC_ORDER, cur_lsp, LPC_ORDER * sizeof(*lpc));
+
+ for (i = 0; i < SUBFRAMES; i++) {
+ lsp2lpc(lpc_ptr);
+ lpc_ptr += LPC_ORDER;
+ }
+}
+
+/**
+ * Generate a train of dirac functions with period as pitch lag.
+ */
+static void gen_dirac_train(int16_t *buf, int pitch_lag)
+{
+ int16_t vector[SUBFRAME_LEN];
+ int i, j;
+
+ memcpy(vector, buf, SUBFRAME_LEN * sizeof(*vector));
+ for (i = pitch_lag; i < SUBFRAME_LEN; i += pitch_lag) {
+ for (j = 0; j < SUBFRAME_LEN - i; j++)
+ buf[i + j] += vector[j];
+ }
+}
+
+/**
+ * Generate fixed codebook excitation vector.
+ *
+ * @param vector decoded excitation vector
+ * @param subfrm current subframe
+ * @param cur_rate current bitrate
+ * @param pitch_lag closed loop pitch lag
+ * @param index current subframe index
+ */
+static void gen_fcb_excitation(int16_t *vector, G723_1_Subframe *subfrm,
+ enum Rate cur_rate, int pitch_lag, int index)
+{
+ int temp, i, j;
+
+ memset(vector, 0, SUBFRAME_LEN * sizeof(*vector));
+
+ if (cur_rate == RATE_6300) {
+ if (subfrm->pulse_pos >= max_pos[index])
+ return;
+
+ /* Decode amplitudes and positions */
+ j = PULSE_MAX - pulses[index];
+ temp = subfrm->pulse_pos;
+ for (i = 0; i < SUBFRAME_LEN / GRID_SIZE; i++) {
+ temp -= combinatorial_table[j][i];
+ if (temp >= 0)
+ continue;
+ temp += combinatorial_table[j++][i];
+ if (subfrm->pulse_sign & (1 << (PULSE_MAX - j))) {
+ vector[subfrm->grid_index + GRID_SIZE * i] =
+ -fixed_cb_gain[subfrm->amp_index];
+ } else {
+ vector[subfrm->grid_index + GRID_SIZE * i] =
+ fixed_cb_gain[subfrm->amp_index];
+ }
+ if (j == PULSE_MAX)
+ break;
+ }
+ if (subfrm->dirac_train == 1)
+ gen_dirac_train(vector, pitch_lag);
+ } else { /* 5300 bps */
+ int cb_gain = fixed_cb_gain[subfrm->amp_index];
+ int cb_shift = subfrm->grid_index;
+ int cb_sign = subfrm->pulse_sign;
+ int cb_pos = subfrm->pulse_pos;
+ int offset, beta, lag;
+
+ for (i = 0; i < 8; i += 2) {
+ offset = ((cb_pos & 7) << 3) + cb_shift + i;
+ vector[offset] = (cb_sign & 1) ? cb_gain : -cb_gain;
+ cb_pos >>= 3;
+ cb_sign >>= 1;
+ }
+
+ /* Enhance harmonic components */
+ lag = pitch_contrib[subfrm->ad_cb_gain << 1] + pitch_lag +
+ subfrm->ad_cb_lag - 1;
+ beta = pitch_contrib[(subfrm->ad_cb_gain << 1) + 1];
+
+ if (lag < SUBFRAME_LEN - 2) {
+ for (i = lag; i < SUBFRAME_LEN; i++)
+ vector[i] += beta * vector[i - lag] >> 15;
+ }
+ }
+}
+
+/**
+ * Get delayed contribution from the previous excitation vector.
+ */
+static void get_residual(int16_t *residual, int16_t *prev_excitation, int lag)
+{
+ int offset = PITCH_MAX - PITCH_ORDER / 2 - lag;
+ int i;
+
+ residual[0] = prev_excitation[offset];
+ residual[1] = prev_excitation[offset + 1];
+
+ offset += 2;
+ for (i = 2; i < SUBFRAME_LEN + PITCH_ORDER - 1; i++)
+ residual[i] = prev_excitation[offset + (i - 2) % lag];
+}
+
+static int dot_product(const int16_t *a, const int16_t *b, int length)
+{
+ int i, sum = 0;
+
+ for (i = 0; i < length; i++) {
+ int prod = a[i] * b[i];
+ sum = av_sat_dadd32(sum, prod);
+ }
+ return sum;
+}
+
+/**
+ * Generate adaptive codebook excitation.
+ */
+static void gen_acb_excitation(int16_t *vector, int16_t *prev_excitation,
+ int pitch_lag, G723_1_Subframe *subfrm,
+ enum Rate cur_rate)
+{
+ int16_t residual[SUBFRAME_LEN + PITCH_ORDER - 1];
+ const int16_t *cb_ptr;
+ int lag = pitch_lag + subfrm->ad_cb_lag - 1;
+
+ int i;
+ int sum;
+
+ get_residual(residual, prev_excitation, lag);
+
+ /* Select quantization table */
+ if (cur_rate == RATE_6300 && pitch_lag < SUBFRAME_LEN - 2)
+ cb_ptr = adaptive_cb_gain85;
+ else
+ cb_ptr = adaptive_cb_gain170;
+
+ /* Calculate adaptive vector */
+ cb_ptr += subfrm->ad_cb_gain * 20;
+ for (i = 0; i < SUBFRAME_LEN; i++) {
+ sum = dot_product(residual + i, cb_ptr, PITCH_ORDER);
+ vector[i] = av_sat_dadd32(1 << 15, sum) >> 16;
+ }
+}
+
+/**
+ * Estimate maximum auto-correlation around pitch lag.
+ *
+ * @param buf buffer with offset applied
+ * @param offset offset of the excitation vector
+ * @param ccr_max pointer to the maximum auto-correlation
+ * @param pitch_lag decoded pitch lag
+ * @param length length of autocorrelation
+ * @param dir forward lag(1) / backward lag(-1)
+ */
+static int autocorr_max(const int16_t *buf, int offset, int *ccr_max,
+ int pitch_lag, int length, int dir)
+{
+ int limit, ccr, lag = 0;
+ int i;
+
+ pitch_lag = FFMIN(PITCH_MAX - 3, pitch_lag);
+ if (dir > 0)
+ limit = FFMIN(FRAME_LEN + PITCH_MAX - offset - length, pitch_lag + 3);
+ else
+ limit = pitch_lag + 3;
+
+ for (i = pitch_lag - 3; i <= limit; i++) {
+ ccr = dot_product(buf, buf + dir * i, length);
+
+ if (ccr > *ccr_max) {
+ *ccr_max = ccr;
+ lag = i;
+ }
+ }
+ return lag;
+}
+
+/**
+ * Calculate pitch postfilter optimal and scaling gains.
+ *
+ * @param lag pitch postfilter forward/backward lag
+ * @param ppf pitch postfilter parameters
+ * @param cur_rate current bitrate
+ * @param tgt_eng target energy
+ * @param ccr cross-correlation
+ * @param res_eng residual energy
+ */
+static void comp_ppf_gains(int lag, PPFParam *ppf, enum Rate cur_rate,
+ int tgt_eng, int ccr, int res_eng)
+{
+ int pf_residual; /* square of postfiltered residual */
+ int temp1, temp2;
+
+ ppf->index = lag;
+
+ temp1 = tgt_eng * res_eng >> 1;
+ temp2 = ccr * ccr << 1;
+
+ if (temp2 > temp1) {
+ if (ccr >= res_eng) {
+ ppf->opt_gain = ppf_gain_weight[cur_rate];
+ } else {
+ ppf->opt_gain = (ccr << 15) / res_eng *
+ ppf_gain_weight[cur_rate] >> 15;
+ }
+ /* pf_res^2 = tgt_eng + 2*ccr*gain + res_eng*gain^2 */
+ temp1 = (tgt_eng << 15) + (ccr * ppf->opt_gain << 1);
+ temp2 = (ppf->opt_gain * ppf->opt_gain >> 15) * res_eng;
+ pf_residual = av_sat_add32(temp1, temp2 + (1 << 15)) >> 16;
+
+ if (tgt_eng >= pf_residual << 1) {
+ temp1 = 0x7fff;
+ } else {
+ temp1 = (tgt_eng << 14) / pf_residual;
+ }
+
+ /* scaling_gain = sqrt(tgt_eng/pf_res^2) */
+ ppf->sc_gain = square_root(temp1 << 16);
+ } else {
+ ppf->opt_gain = 0;
+ ppf->sc_gain = 0x7fff;
+ }
+
+ ppf->opt_gain = av_clip_int16(ppf->opt_gain * ppf->sc_gain >> 15);
+}
+
+/**
+ * Calculate pitch postfilter parameters.
+ *
+ * @param p the context
+ * @param offset offset of the excitation vector
+ * @param pitch_lag decoded pitch lag
+ * @param ppf pitch postfilter parameters
+ * @param cur_rate current bitrate
+ */
+static void comp_ppf_coeff(G723_1_Context *p, int offset, int pitch_lag,
+ PPFParam *ppf, enum Rate cur_rate)
+{
+
+ int16_t scale;
+ int i;
+ int temp1, temp2;
+
+ /*
+ * 0 - target energy
+ * 1 - forward cross-correlation
+ * 2 - forward residual energy
+ * 3 - backward cross-correlation
+ * 4 - backward residual energy
+ */
+ int energy[5] = {0, 0, 0, 0, 0};
+ int16_t *buf = p->audio + LPC_ORDER + offset;
+ int fwd_lag = autocorr_max(buf, offset, &energy[1], pitch_lag,
+ SUBFRAME_LEN, 1);
+ int back_lag = autocorr_max(buf, offset, &energy[3], pitch_lag,
+ SUBFRAME_LEN, -1);
+
+ ppf->index = 0;
+ ppf->opt_gain = 0;
+ ppf->sc_gain = 0x7fff;
+
+ /* Case 0, Section 3.6 */
+ if (!back_lag && !fwd_lag)
+ return;
+
+ /* Compute target energy */
+ energy[0] = dot_product(buf, buf, SUBFRAME_LEN);
+
+ /* Compute forward residual energy */
+ if (fwd_lag)
+ energy[2] = dot_product(buf + fwd_lag, buf + fwd_lag, SUBFRAME_LEN);
+
+ /* Compute backward residual energy */
+ if (back_lag)
+ energy[4] = dot_product(buf - back_lag, buf - back_lag, SUBFRAME_LEN);
+
+ /* Normalize and shorten */
+ temp1 = 0;
+ for (i = 0; i < 5; i++)
+ temp1 = FFMAX(energy[i], temp1);
+
+ scale = normalize_bits(temp1, 31);
+ for (i = 0; i < 5; i++)
+ energy[i] = (energy[i] << scale) >> 16;
+
+ if (fwd_lag && !back_lag) { /* Case 1 */
+ comp_ppf_gains(fwd_lag, ppf, cur_rate, energy[0], energy[1],
+ energy[2]);
+ } else if (!fwd_lag) { /* Case 2 */
+ comp_ppf_gains(-back_lag, ppf, cur_rate, energy[0], energy[3],
+ energy[4]);
+ } else { /* Case 3 */
+
+ /*
+ * Select the largest of energy[1]^2/energy[2]
+ * and energy[3]^2/energy[4]
+ */
+ temp1 = energy[4] * ((energy[1] * energy[1] + (1 << 14)) >> 15);
+ temp2 = energy[2] * ((energy[3] * energy[3] + (1 << 14)) >> 15);
+ if (temp1 >= temp2) {
+ comp_ppf_gains(fwd_lag, ppf, cur_rate, energy[0], energy[1],
+ energy[2]);
+ } else {
+ comp_ppf_gains(-back_lag, ppf, cur_rate, energy[0], energy[3],
+ energy[4]);
+ }
+ }
+}
+
+/**
+ * Classify frames as voiced/unvoiced.
+ *
+ * @param p the context
+ * @param pitch_lag decoded pitch_lag
+ * @param exc_eng excitation energy estimation
+ * @param scale scaling factor of exc_eng
+ *
+ * @return residual interpolation index if voiced, 0 otherwise
+ */
+static int comp_interp_index(G723_1_Context *p, int pitch_lag,
+ int *exc_eng, int *scale)
+{
+ int offset = PITCH_MAX + 2 * SUBFRAME_LEN;
+ int16_t *buf = p->audio + LPC_ORDER;
+
+ int index, ccr, tgt_eng, best_eng, temp;
+
+ *scale = scale_vector(buf, p->excitation, FRAME_LEN + PITCH_MAX);
+ buf += offset;
+
+ /* Compute maximum backward cross-correlation */
+ ccr = 0;
+ index = autocorr_max(buf, offset, &ccr, pitch_lag, SUBFRAME_LEN * 2, -1);
+ ccr = av_sat_add32(ccr, 1 << 15) >> 16;
+
+ /* Compute target energy */
+ tgt_eng = dot_product(buf, buf, SUBFRAME_LEN * 2);
+ *exc_eng = av_sat_add32(tgt_eng, 1 << 15) >> 16;
+
+ if (ccr <= 0)
+ return 0;
+
+ /* Compute best energy */
+ best_eng = dot_product(buf - index, buf - index, SUBFRAME_LEN * 2);
+ best_eng = av_sat_add32(best_eng, 1 << 15) >> 16;
+
+ temp = best_eng * *exc_eng >> 3;
+
+ if (temp < ccr * ccr)
+ return index;
+ else
+ return 0;
+}
+
+/**
+ * Peform residual interpolation based on frame classification.
+ *
+ * @param buf decoded excitation vector
+ * @param out output vector
+ * @param lag decoded pitch lag
+ * @param gain interpolated gain
+ * @param rseed seed for random number generator
+ */
+static void residual_interp(int16_t *buf, int16_t *out, int lag,
+ int gain, int *rseed)
+{
+ int i;
+ if (lag) { /* Voiced */
+ int16_t *vector_ptr = buf + PITCH_MAX;
+ /* Attenuate */
+ for (i = 0; i < lag; i++)
+ out[i] = vector_ptr[i - lag] * 3 >> 2;
+ av_memcpy_backptr((uint8_t*)(out + lag), lag * sizeof(*out),
+ (FRAME_LEN - lag) * sizeof(*out));
+ } else { /* Unvoiced */
+ for (i = 0; i < FRAME_LEN; i++) {
+ *rseed = *rseed * 521 + 259;
+ out[i] = gain * *rseed >> 15;
+ }
+ memset(buf, 0, (FRAME_LEN + PITCH_MAX) * sizeof(*buf));
+ }
+}
+
+/**
+ * Perform IIR filtering.
+ *
+ * @param fir_coef FIR coefficients
+ * @param iir_coef IIR coefficients
+ * @param src source vector
+ * @param dest destination vector
+ */
+static inline void iir_filter(int16_t *fir_coef, int16_t *iir_coef,
+ int16_t *src, int *dest)
+{
+ int m, n;
+
+ for (m = 0; m < SUBFRAME_LEN; m++) {
+ int64_t filter = 0;
+ for (n = 1; n <= LPC_ORDER; n++) {
+ filter -= fir_coef[n - 1] * src[m - n] -
+ iir_coef[n - 1] * (dest[m - n] >> 16);
+ }
+
+ dest[m] = av_clipl_int32((src[m] << 16) + (filter << 3) + (1 << 15));
+ }
+}
+
+/**
+ * Adjust gain of postfiltered signal.
+ *
+ * @param p the context
+ * @param buf postfiltered output vector
+ * @param energy input energy coefficient
+ */
+static void gain_scale(G723_1_Context *p, int16_t * buf, int energy)
+{
+ int num, denom, gain, bits1, bits2;
+ int i;
+
+ num = energy;
+ denom = 0;
+ for (i = 0; i < SUBFRAME_LEN; i++) {
+ int temp = buf[i] >> 2;
+ temp *= temp;
+ denom = av_sat_dadd32(denom, temp);
+ }
+
+ if (num && denom) {
+ bits1 = normalize_bits(num, 31);
+ bits2 = normalize_bits(denom, 31);
+ num = num << bits1 >> 1;
+ denom <<= bits2;
+
+ bits2 = 5 + bits1 - bits2;
+ bits2 = FFMAX(0, bits2);
+
+ gain = (num >> 1) / (denom >> 16);
+ gain = square_root(gain << 16 >> bits2);
+ } else {
+ gain = 1 << 12;
+ }
+
+ for (i = 0; i < SUBFRAME_LEN; i++) {
+ p->pf_gain = (15 * p->pf_gain + gain + (1 << 3)) >> 4;
+ buf[i] = av_clip_int16((buf[i] * (p->pf_gain + (p->pf_gain >> 4)) +
+ (1 << 10)) >> 11);
+ }
+}
+
+/**
+ * Perform formant filtering.
+ *
+ * @param p the context
+ * @param lpc quantized lpc coefficients
+ * @param buf input buffer
+ * @param dst output buffer
+ */
+static void formant_postfilter(G723_1_Context *p, int16_t *lpc,
+ int16_t *buf, int16_t *dst)
+{
+ int16_t filter_coef[2][LPC_ORDER];
+ int filter_signal[LPC_ORDER + FRAME_LEN], *signal_ptr;
+ int i, j, k;
+
+ memcpy(buf, p->fir_mem, LPC_ORDER * sizeof(*buf));
+ memcpy(filter_signal, p->iir_mem, LPC_ORDER * sizeof(*filter_signal));
+
+ for (i = LPC_ORDER, j = 0; j < SUBFRAMES; i += SUBFRAME_LEN, j++) {
+ for (k = 0; k < LPC_ORDER; k++) {
+ filter_coef[0][k] = (-lpc[k] * postfilter_tbl[0][k] +
+ (1 << 14)) >> 15;
+ filter_coef[1][k] = (-lpc[k] * postfilter_tbl[1][k] +
+ (1 << 14)) >> 15;
+ }
+ iir_filter(filter_coef[0], filter_coef[1], buf + i,
+ filter_signal + i);
+ lpc += LPC_ORDER;
+ }
+
+ memcpy(p->fir_mem, buf + FRAME_LEN, LPC_ORDER * sizeof(*p->fir_mem));
+ memcpy(p->iir_mem, filter_signal + FRAME_LEN,
+ LPC_ORDER * sizeof(*p->iir_mem));
+
+ buf += LPC_ORDER;
+ signal_ptr = filter_signal + LPC_ORDER;
+ for (i = 0; i < SUBFRAMES; i++) {
+ int temp;
+ int auto_corr[2];
+ int scale, energy;
+
+ /* Normalize */
+ scale = scale_vector(dst, buf, SUBFRAME_LEN);
+
+ /* Compute auto correlation coefficients */
+ auto_corr[0] = dot_product(dst, dst + 1, SUBFRAME_LEN - 1);
+ auto_corr[1] = dot_product(dst, dst, SUBFRAME_LEN);
+
+ /* Compute reflection coefficient */
+ temp = auto_corr[1] >> 16;
+ if (temp) {
+ temp = (auto_corr[0] >> 2) / temp;
+ }
+ p->reflection_coef = (3 * p->reflection_coef + temp + 2) >> 2;
+ temp = -p->reflection_coef >> 1 & ~3;
+
+ /* Compensation filter */
+ for (j = 0; j < SUBFRAME_LEN; j++) {
+ dst[j] = av_sat_dadd32(signal_ptr[j],
+ (signal_ptr[j - 1] >> 16) * temp) >> 16;
+ }
+
+ /* Compute normalized signal energy */
+ temp = 2 * scale + 4;
+ if (temp < 0) {
+ energy = av_clipl_int32((int64_t)auto_corr[1] << -temp);
+ } else
+ energy = auto_corr[1] >> temp;
+
+ gain_scale(p, dst, energy);
+
+ buf += SUBFRAME_LEN;
+ signal_ptr += SUBFRAME_LEN;
+ dst += SUBFRAME_LEN;
+ }
+}
+
+static int sid_gain_to_lsp_index(int gain)
+{
+ if (gain < 0x10)
+ return gain << 6;
+ else if (gain < 0x20)
+ return gain - 8 << 7;
+ else
+ return gain - 20 << 8;
+}
+
+static inline int cng_rand(int *state, int base)
+{
+ *state = (*state * 521 + 259) & 0xFFFF;
+ return (*state & 0x7FFF) * base >> 15;
+}
+
+static int estimate_sid_gain(G723_1_Context *p)
+{
+ int i, shift, seg, seg2, t, val, val_add, x, y;
+
+ shift = 16 - p->cur_gain * 2;
+ if (shift > 0)
+ t = p->sid_gain << shift;
+ else
+ t = p->sid_gain >> -shift;
+ x = t * cng_filt[0] >> 16;
+
+ if (x >= cng_bseg[2])
+ return 0x3F;
+
+ if (x >= cng_bseg[1]) {
+ shift = 4;
+ seg = 3;
+ } else {
+ shift = 3;
+ seg = (x >= cng_bseg[0]);
+ }
+ seg2 = FFMIN(seg, 3);
+
+ val = 1 << shift;
+ val_add = val >> 1;
+ for (i = 0; i < shift; i++) {
+ t = seg * 32 + (val << seg2);
+ t *= t;
+ if (x >= t)
+ val += val_add;
+ else
+ val -= val_add;
+ val_add >>= 1;
+ }
+
+ t = seg * 32 + (val << seg2);
+ y = t * t - x;
+ if (y <= 0) {
+ t = seg * 32 + (val + 1 << seg2);
+ t = t * t - x;
+ val = (seg2 - 1 << 4) + val;
+ if (t >= y)
+ val++;
+ } else {
+ t = seg * 32 + (val - 1 << seg2);
+ t = t * t - x;
+ val = (seg2 - 1 << 4) + val;
+ if (t >= y)
+ val--;
+ }
+
+ return val;
+}
+
+static void generate_noise(G723_1_Context *p)
+{
+ int i, j, idx, t;
+ int off[SUBFRAMES];
+ int signs[SUBFRAMES / 2 * 11], pos[SUBFRAMES / 2 * 11];
+ int tmp[SUBFRAME_LEN * 2];
+ int16_t *vector_ptr;
+ int64_t sum;
+ int b0, c, delta, x, shift;
+
+ p->pitch_lag[0] = cng_rand(&p->cng_random_seed, 21) + 123;
+ p->pitch_lag[1] = cng_rand(&p->cng_random_seed, 19) + 123;
+
+ for (i = 0; i < SUBFRAMES; i++) {
+ p->subframe[i].ad_cb_gain = cng_rand(&p->cng_random_seed, 50) + 1;
+ p->subframe[i].ad_cb_lag = cng_adaptive_cb_lag[i];
+ }
+
+ for (i = 0; i < SUBFRAMES / 2; i++) {
+ t = cng_rand(&p->cng_random_seed, 1 << 13);
+ off[i * 2] = t & 1;
+ off[i * 2 + 1] = ((t >> 1) & 1) + SUBFRAME_LEN;
+ t >>= 2;
+ for (j = 0; j < 11; j++) {
+ signs[i * 11 + j] = (t & 1) * 2 - 1 << 14;
+ t >>= 1;
+ }
+ }
+
+ idx = 0;
+ for (i = 0; i < SUBFRAMES; i++) {
+ for (j = 0; j < SUBFRAME_LEN / 2; j++)
+ tmp[j] = j;
+ t = SUBFRAME_LEN / 2;
+ for (j = 0; j < pulses[i]; j++, idx++) {
+ int idx2 = cng_rand(&p->cng_random_seed, t);
+
+ pos[idx] = tmp[idx2] * 2 + off[i];
+ tmp[idx2] = tmp[--t];
+ }
+ }
+
+ vector_ptr = p->audio + LPC_ORDER;
+ memcpy(vector_ptr, p->prev_excitation,
+ PITCH_MAX * sizeof(*p->excitation));
+ for (i = 0; i < SUBFRAMES; i += 2) {
+ gen_acb_excitation(vector_ptr, vector_ptr,
+ p->pitch_lag[i >> 1], &p->subframe[i],
+ p->cur_rate);
+ gen_acb_excitation(vector_ptr + SUBFRAME_LEN,
+ vector_ptr + SUBFRAME_LEN,
+ p->pitch_lag[i >> 1], &p->subframe[i + 1],
+ p->cur_rate);
+
+ t = 0;
+ for (j = 0; j < SUBFRAME_LEN * 2; j++)
+ t |= FFABS(vector_ptr[j]);
+ t = FFMIN(t, 0x7FFF);
+ if (!t) {
+ shift = 0;
+ } else {
+ shift = -10 + av_log2(t);
+ if (shift < -2)
+ shift = -2;
+ }
+ sum = 0;
+ if (shift < 0) {
+ for (j = 0; j < SUBFRAME_LEN * 2; j++) {
+ t = vector_ptr[j] << -shift;
+ sum += t * t;
+ tmp[j] = t;
+ }
+ } else {
+ for (j = 0; j < SUBFRAME_LEN * 2; j++) {
+ t = vector_ptr[j] >> shift;
+ sum += t * t;
+ tmp[j] = t;
+ }
+ }
+
+ b0 = 0;
+ for (j = 0; j < 11; j++)
+ b0 += tmp[pos[(i / 2) * 11 + j]] * signs[(i / 2) * 11 + j];
+ b0 = b0 * 2 * 2979LL + (1 << 29) >> 30; // approximated division by 11
+
+ c = p->cur_gain * (p->cur_gain * SUBFRAME_LEN >> 5);
+ if (shift * 2 + 3 >= 0)
+ c >>= shift * 2 + 3;
+ else
+ c <<= -(shift * 2 + 3);
+ c = (av_clipl_int32(sum << 1) - c) * 2979LL >> 15;
+
+ delta = b0 * b0 * 2 - c;
+ if (delta <= 0) {
+ x = -b0;
+ } else {
+ delta = square_root(delta);
+ x = delta - b0;
+ t = delta + b0;
+ if (FFABS(t) < FFABS(x))
+ x = -t;
+ }
+ shift++;
+ if (shift < 0)
+ x >>= -shift;
+ else
+ x <<= shift;
+ x = av_clip(x, -10000, 10000);
+
+ for (j = 0; j < 11; j++) {
+ idx = (i / 2) * 11 + j;
+ vector_ptr[pos[idx]] = av_clip_int16(vector_ptr[pos[idx]] +
+ (x * signs[idx] >> 15));
+ }
+
+ /* copy decoded data to serve as a history for the next decoded subframes */
+ memcpy(vector_ptr + PITCH_MAX, vector_ptr,
+ sizeof(*vector_ptr) * SUBFRAME_LEN * 2);
+ vector_ptr += SUBFRAME_LEN * 2;
+ }
+ /* Save the excitation for the next frame */
+ memcpy(p->prev_excitation, p->audio + LPC_ORDER + FRAME_LEN,
+ PITCH_MAX * sizeof(*p->excitation));
+}
+
+static int g723_1_decode_frame(AVCodecContext *avctx, void *data,
+ int *got_frame_ptr, AVPacket *avpkt)
+{
+ G723_1_Context *p = avctx->priv_data;
+ const uint8_t *buf = avpkt->data;
+ int buf_size = avpkt->size;
+ int dec_mode = buf[0] & 3;
+
+ PPFParam ppf[SUBFRAMES];
+ int16_t cur_lsp[LPC_ORDER];
+ int16_t lpc[SUBFRAMES * LPC_ORDER];
+ int16_t acb_vector[SUBFRAME_LEN];
+ int16_t *out;
+ int bad_frame = 0, i, j, ret;
+ int16_t *audio = p->audio;
+
+ if (buf_size < frame_size[dec_mode]) {
+ if (buf_size)
+ av_log(avctx, AV_LOG_WARNING,
+ "Expected %d bytes, got %d - skipping packet\n",
+ frame_size[dec_mode], buf_size);
+ *got_frame_ptr = 0;
+ return buf_size;
+ }
+
+ if (unpack_bitstream(p, buf, buf_size) < 0) {
+ bad_frame = 1;
+ if (p->past_frame_type == ACTIVE_FRAME)
+ p->cur_frame_type = ACTIVE_FRAME;
+ else
+ p->cur_frame_type = UNTRANSMITTED_FRAME;
+ }
+
+ p->frame.nb_samples = FRAME_LEN;
+ if ((ret = ff_get_buffer(avctx, &p->frame)) < 0) {
+ av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
+ return ret;
+ }
+
+ out = (int16_t *)p->frame.data[0];
+
+ if (p->cur_frame_type == ACTIVE_FRAME) {
+ if (!bad_frame)
+ p->erased_frames = 0;
+ else if (p->erased_frames != 3)
+ p->erased_frames++;
+
+ inverse_quant(cur_lsp, p->prev_lsp, p->lsp_index, bad_frame);
+ lsp_interpolate(lpc, cur_lsp, p->prev_lsp);
+
+ /* Save the lsp_vector for the next frame */
+ memcpy(p->prev_lsp, cur_lsp, LPC_ORDER * sizeof(*p->prev_lsp));
+
+ /* Generate the excitation for the frame */
+ memcpy(p->excitation, p->prev_excitation,
+ PITCH_MAX * sizeof(*p->excitation));
+ if (!p->erased_frames) {
+ int16_t *vector_ptr = p->excitation + PITCH_MAX;
+
+ /* Update interpolation gain memory */
+ p->interp_gain = fixed_cb_gain[(p->subframe[2].amp_index +
+ p->subframe[3].amp_index) >> 1];
+ for (i = 0; i < SUBFRAMES; i++) {
+ gen_fcb_excitation(vector_ptr, &p->subframe[i], p->cur_rate,
+ p->pitch_lag[i >> 1], i);
+ gen_acb_excitation(acb_vector, &p->excitation[SUBFRAME_LEN * i],
+ p->pitch_lag[i >> 1], &p->subframe[i],
+ p->cur_rate);
+ /* Get the total excitation */
+ for (j = 0; j < SUBFRAME_LEN; j++) {
+ int v = av_clip_int16(vector_ptr[j] << 1);
+ vector_ptr[j] = av_clip_int16(v + acb_vector[j]);
+ }
+ vector_ptr += SUBFRAME_LEN;
+ }
+
+ vector_ptr = p->excitation + PITCH_MAX;
+
+ p->interp_index = comp_interp_index(p, p->pitch_lag[1],
+ &p->sid_gain, &p->cur_gain);
+
+ /* Peform pitch postfiltering */
+ if (p->postfilter) {
+ i = PITCH_MAX;
+ for (j = 0; j < SUBFRAMES; i += SUBFRAME_LEN, j++)
+ comp_ppf_coeff(p, i, p->pitch_lag[j >> 1],
+ ppf + j, p->cur_rate);
+
+ for (i = 0, j = 0; j < SUBFRAMES; i += SUBFRAME_LEN, j++)
+ ff_acelp_weighted_vector_sum(p->audio + LPC_ORDER + i,
+ vector_ptr + i,
+ vector_ptr + i + ppf[j].index,
+ ppf[j].sc_gain,
+ ppf[j].opt_gain,
+ 1 << 14, 15, SUBFRAME_LEN);
+ } else {
+ audio = vector_ptr - LPC_ORDER;
+ }
+
+ /* Save the excitation for the next frame */
+ memcpy(p->prev_excitation, p->excitation + FRAME_LEN,
+ PITCH_MAX * sizeof(*p->excitation));
+ } else {
+ p->interp_gain = (p->interp_gain * 3 + 2) >> 2;
+ if (p->erased_frames == 3) {
+ /* Mute output */
+ memset(p->excitation, 0,
+ (FRAME_LEN + PITCH_MAX) * sizeof(*p->excitation));
+ memset(p->prev_excitation, 0,
+ PITCH_MAX * sizeof(*p->excitation));
+ memset(p->frame.data[0], 0,
+ (FRAME_LEN + LPC_ORDER) * sizeof(int16_t));
+ } else {
+ int16_t *buf = p->audio + LPC_ORDER;
+
+ /* Regenerate frame */
+ residual_interp(p->excitation, buf, p->interp_index,
+ p->interp_gain, &p->random_seed);
+
+ /* Save the excitation for the next frame */
+ memcpy(p->prev_excitation, buf + (FRAME_LEN - PITCH_MAX),
+ PITCH_MAX * sizeof(*p->excitation));
+ }
+ }
+ p->cng_random_seed = CNG_RANDOM_SEED;
+ } else {
+ if (p->cur_frame_type == SID_FRAME) {
+ p->sid_gain = sid_gain_to_lsp_index(p->subframe[0].amp_index);
+ inverse_quant(p->sid_lsp, p->prev_lsp, p->lsp_index, 0);
+ } else if (p->past_frame_type == ACTIVE_FRAME) {
+ p->sid_gain = estimate_sid_gain(p);
+ }
+
+ if (p->past_frame_type == ACTIVE_FRAME)
+ p->cur_gain = p->sid_gain;
+ else
+ p->cur_gain = (p->cur_gain * 7 + p->sid_gain) >> 3;
+ generate_noise(p);
+ lsp_interpolate(lpc, p->sid_lsp, p->prev_lsp);
+ /* Save the lsp_vector for the next frame */
+ memcpy(p->prev_lsp, p->sid_lsp, LPC_ORDER * sizeof(*p->prev_lsp));
+ }
+
+ p->past_frame_type = p->cur_frame_type;
+
+ memcpy(p->audio, p->synth_mem, LPC_ORDER * sizeof(*p->audio));
+ for (i = LPC_ORDER, j = 0; j < SUBFRAMES; i += SUBFRAME_LEN, j++)
+ ff_celp_lp_synthesis_filter(p->audio + i, &lpc[j * LPC_ORDER],
+ audio + i, SUBFRAME_LEN, LPC_ORDER,
+ 0, 1, 1 << 12);
+ memcpy(p->synth_mem, p->audio + FRAME_LEN, LPC_ORDER * sizeof(*p->audio));
+
+ if (p->postfilter) {
+ formant_postfilter(p, lpc, p->audio, out);
+ } else { // if output is not postfiltered it should be scaled by 2
+ for (i = 0; i < FRAME_LEN; i++)
+ out[i] = av_clip_int16(p->audio[LPC_ORDER + i] << 1);
+ }
+
+ *got_frame_ptr = 1;
+ *(AVFrame *)data = p->frame;
+
+ return frame_size[dec_mode];
+}
+
+#define OFFSET(x) offsetof(G723_1_Context, x)
+#define AD AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_DECODING_PARAM
+
+static const AVOption options[] = {
+ { "postfilter", "postfilter on/off", OFFSET(postfilter), AV_OPT_TYPE_INT,
+ { .i64 = 1 }, 0, 1, AD },
+ { NULL }
+};
+
+
+static const AVClass g723_1dec_class = {
+ .class_name = "G.723.1 decoder",
+ .item_name = av_default_item_name,
+ .option = options,
+ .version = LIBAVUTIL_VERSION_INT,
+};
+
+AVCodec ff_g723_1_decoder = {
+ .name = "g723_1",
+ .type = AVMEDIA_TYPE_AUDIO,
+ .id = AV_CODEC_ID_G723_1,
+ .priv_data_size = sizeof(G723_1_Context),
+ .init = g723_1_decode_init,
+ .decode = g723_1_decode_frame,
+ .long_name = NULL_IF_CONFIG_SMALL("G.723.1"),
+ .capabilities = CODEC_CAP_SUBFRAMES | CODEC_CAP_DR1,
+ .priv_class = &g723_1dec_class,
+};
diff --git a/gst-libs/ext/libav/libavcodec/g723_1_data.h b/gst-libs/ext/libav/libavcodec/g723_1_data.h
new file mode 100644
index 0000000..04f8a06
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/g723_1_data.h
@@ -0,0 +1,1200 @@
+/*
+ * G.723.1 compatible decoder data tables.
+ * Copyright (c) 2006 Benjamin Larsson
+ * Copyright (c) 2010 Mohamed Naufal Basheer
+ *
+ * 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
+ * G.723.1 compatible decoder data tables
+ */
+
+#ifndef AVCODEC_G723_1_DATA_H
+#define AVCODEC_G723_1_DATA_H
+
+#include <stdint.h>
+
+#define SUBFRAMES 4
+#define SUBFRAME_LEN 60
+#define FRAME_LEN (SUBFRAME_LEN << 2)
+#define LPC_ORDER 10
+#define LSP_BANDS 3
+#define LSP_CB_SIZE 256
+#define PITCH_MIN 18
+#define PITCH_MAX (PITCH_MIN + 127)
+#define PITCH_ORDER 5
+#define GRID_SIZE 2
+#define PULSE_MAX 6
+#define GAIN_LEVELS 24
+#define COS_TBL_SIZE 512
+
+static const uint8_t frame_size[4] = { 24, 20, 4, 1 };
+
+/* Postfilter gain weighting factors scaled by 2^15 */
+static const int16_t ppf_gain_weight[2] = { 0x1800, 0x2000 };
+
+/* LSP DC component */
+static const int16_t dc_lsp[LPC_ORDER] = {
+ 0x0c3b, 0x1271, 0x1e0a, 0x2a36, 0x3630,
+ 0x406f, 0x4d28, 0x56f4, 0x638c, 0x6c46
+};
+
+/* Cosine table scaled by 2^14 */
+static const int16_t cos_tab[COS_TBL_SIZE] = {
+ 16384, 16383, 16379, 16373, 16364, 16353, 16340, 16324,
+ 16305, 16284, 16261, 16235, 16207, 16176, 16143, 16107,
+ 16069, 16029, 15986, 15941, 15893, 15843, 15791, 15736,
+ 15679, 15619, 15557, 15493, 15426, 15357, 15286, 15213,
+ 15137, 15059, 14978, 14896, 14811, 14724, 14635, 14543,
+ 14449, 14354, 14256, 14155, 14053, 13949, 13842, 13733,
+ 13623, 13510, 13395, 13279, 13160, 13039, 12916, 12792,
+ 12665, 12537, 12406, 12274, 12140, 12004, 11866, 11727,
+ 11585, 11442, 11297, 11151, 11003, 10853, 10702, 10549,
+ 10394, 10238, 10080, 9921, 9760, 9598, 9434, 9269,
+ 9102, 8935, 8765, 8595, 8423, 8250, 8076, 7900,
+ 7723, 7545, 7366, 7186, 7005, 6823, 6639, 6455,
+ 6270, 6084, 5897, 5708, 5520, 5330, 5139, 4948,
+ 4756, 4563, 4370, 4176, 3981, 3786, 3590, 3393,
+ 3196, 2999, 2801, 2603, 2404, 2205, 2006, 1806,
+ 1606, 1406, 1205, 1005, 804, 603, 402, 201,
+ 0, -201, -402, -603, -804, -1005, -1205, -1406,
+ -1606, -1806, -2006, -2205, -2404, -2603, -2801, -2999,
+ -3196, -3393, -3590, -3786, -3981, -4176, -4370, -4563,
+ -4756, -4948, -5139, -5330, -5520, -5708, -5897, -6084,
+ -6270, -6455, -6639, -6823, -7005, -7186, -7366, -7545,
+ -7723, -7900, -8076, -8250, -8423, -8595, -8765, -8935,
+ -9102, -9269, -9434, -9598, -9760, -9921, -10080, -10238,
+ -10394, -10549, -10702, -10853, -11003, -11151, -11297, -11442,
+ -11585, -11727, -11866, -12004, -12140, -12274, -12406, -12537,
+ -12665, -12792, -12916, -13039, -13160, -13279, -13395, -13510,
+ -13623, -13733, -13842, -13949, -14053, -14155, -14256, -14354,
+ -14449, -14543, -14635, -14724, -14811, -14896, -14978, -15059,
+ -15137, -15213, -15286, -15357, -15426, -15493, -15557, -15619,
+ -15679, -15736, -15791, -15843, -15893, -15941, -15986, -16029,
+ -16069, -16107, -16143, -16176, -16207, -16235, -16261, -16284,
+ -16305, -16324, -16340, -16353, -16364, -16373, -16379, -16383,
+ -16384, -16383, -16379, -16373, -16364, -16353, -16340, -16324,
+ -16305, -16284, -16261, -16235, -16207, -16176, -16143, -16107,
+ -16069, -16029, -15986, -15941, -15893, -15843, -15791, -15736,
+ -15679, -15619, -15557, -15493, -15426, -15357, -15286, -15213,
+ -15137, -15059, -14978, -14896, -14811, -14724, -14635, -14543,
+ -14449, -14354, -14256, -14155, -14053, -13949, -13842, -13733,
+ -13623, -13510, -13395, -13279, -13160, -13039, -12916, -12792,
+ -12665, -12537, -12406, -12274, -12140, -12004, -11866, -11727,
+ -11585, -11442, -11297, -11151, -11003, -10853, -10702, -10549,
+ -10394, -10238, -10080, -9921, -9760, -9598, -9434, -9269,
+ -9102, -8935, -8765, -8595, -8423, -8250, -8076, -7900,
+ -7723, -7545, -7366, -7186, -7005, -6823, -6639, -6455,
+ -6270, -6084, -5897, -5708, -5520, -5330, -5139, -4948,
+ -4756, -4563, -4370, -4176, -3981, -3786, -3590, -3393,
+ -3196, -2999, -2801, -2603, -2404, -2205, -2006, -1806,
+ -1606, -1406, -1205, -1005, -804, -603, -402, -201,
+ 0, 201, 402, 603, 804, 1005, 1205, 1406,
+ 1606, 1806, 2006, 2205, 2404, 2603, 2801, 2999,
+ 3196, 3393, 3590, 3786, 3981, 4176, 4370, 4563,
+ 4756, 4948, 5139, 5330, 5520, 5708, 5897, 6084,
+ 6270, 6455, 6639, 6823, 7005, 7186, 7366, 7545,
+ 7723, 7900, 8076, 8250, 8423, 8595, 8765, 8935,
+ 9102, 9269, 9434, 9598, 9760, 9921, 10080, 10238,
+ 10394, 10549, 10702, 10853, 11003, 11151, 11297, 11442,
+ 11585, 11727, 11866, 12004, 12140, 12274, 12406, 12537,
+ 12665, 12792, 12916, 13039, 13160, 13279, 13395, 13510,
+ 13623, 13733, 13842, 13949, 14053, 14155, 14256, 14354,
+ 14449, 14543, 14635, 14724, 14811, 14896, 14978, 15059,
+ 15137, 15213, 15286, 15357, 15426, 15493, 15557, 15619,
+ 15679, 15736, 15791, 15843, 15893, 15941, 15986, 16029,
+ 16069, 16107, 16143, 16176, 16207, 16235, 16261, 16284,
+ 16305, 16324, 16340, 16353, 16364, 16373, 16379, 16383,
+};
+
+/* LSP VQ tables */
+static const int16_t lsp_band0[LSP_CB_SIZE][3] = {
+ { 0, 0, 0}, { -270, -1372, -1032}, { -541, -1650, -1382},
+ { -723, -2011, -2213}, { -941, -1122, -1942}, { -780, -1145, -2454},
+ { -884, -1309, -1373}, {-1051, -1523, -1766}, {-1083, -1622, -2300},
+ { -777, -1377, -2147}, { -935, -1467, -2763}, { -802, -1327, -3471},
+ { -935, -1959, -3999}, { -240, -89, 222}, { -661, -257, -160},
+ { -994, -466, -419}, { -188, -164, -278}, { -342, -512, -415},
+ { -607, -511, -797}, { 16, 19, -716}, { 374, 425, -972},
+ { -346, 245, -282}, { -265, 506, -754}, { -620, -147, 1955},
+ { -742, -860, 2597}, { -150, -352, 2704}, { 305, 880, 1954},
+ { 123, 731, 2766}, { -348, 765, 3327}, { 618, 221, 3258},
+ { -178, -47, 4219}, { 393, 1304, 3842}, { 698, 1702, 4801},
+ { 63, -584, 1229}, { -215, -732, 1704}, { 172, -335, 1909},
+ { -2, 216, 1797}, { 353, 127, 2205}, {-1208, 188, 11},
+ { -513, -75, -683}, { -973, 222, -646}, { -616, -843, -388},
+ { -950, -1113, -359}, {-1431, -623, -705}, {-1398, -1063, -178},
+ { -45, -461, 35}, { -9, -657, -216}, { 127, -1078, 95},
+ { -950, -1156, 584}, {-1480, -1494, 449}, { -120, -705, 516},
+ { -368, -961, 727}, { -378, -526, 973}, { -793, -614, 676},
+ { -801, -755, 1287}, {-1476, -340, 1636}, { -505, -1254, 1543},
+ {-1243, -1622, 1532}, { -776, -1477, -655}, {-1151, -1296, -823},
+ {-1153, -1672, -1124}, {-1291, -2003, -1702}, { -622, -1283, 57},
+ { -471, -1611, 509}, {-1060, -1570, -139}, { -873, -2156, -536},
+ {-1716, -2021, -364}, {-2150, -3218, -1291}, {-1248, -1945, -2904},
+ {-1215, -2633, -2855}, { 167, -244, 84}, { 349, -412, -217},
+ { -40, -352, 632}, { 227, -529, 405}, { 68, -383, -443},
+ { 167, -558, -706}, { -275, -854, -14}, { -351, -1089, -449},
+ { 341, -72, -289}, { 603, -106, -474}, { 322, -219, -649},
+ { 179, -317, -998}, { 450, -291, -996}, { 555, 195, -525},
+ { 784, 272, -831}, { -148, -384, -849}, { 82, -536, -1357},
+ { 238, -172, -1354}, { 422, -268, -1841}, { 297, -737, -2079},
+ { -111, -801, -598}, { 1, -668, -984}, { -131, -818, -1299},
+ { -329, -521, -1310}, { -151, -778, -1834}, { -93, -352, -1746},
+ { -568, -640, -1821}, { -509, -941, -2183}, { 464, -815, -1250},
+ { 79, -1133, -1597}, { -184, -1353, -2123}, { -196, -410, -2427},
+ { -192, -833, -2810}, { -259, -1382, -3045}, { -217, 4, -1166},
+ { -800, -325, -1219}, { -363, -830, -898}, { -661, -1134, -960},
+ { -386, -980, -1501}, { -627, -1159, -1722}, { -903, -829, -855},
+ { -685, -829, -1313}, {-1065, -959, -1405}, { 441, 25, -847},
+ { 655, -27, -1181}, { 1159, -110, -705}, { 856, 253, -1671},
+ { 415, 404, -1}, { 322, 903, -398}, { 670, 499, -292},
+ { 803, 591, -610}, { 1144, 591, -814}, { 717, 183, 393},
+ { 857, 381, 106}, { 609, 62, -27}, { 792, 198, -325},
+ { 735, 805, 88}, { 1142, 812, 78}, { 1028, 366, -292},
+ { 1309, 743, -237}, { 1615, 589, -79}, { 1010, 639, -243},
+ { 999, 964, -311}, { 1500, 1137, -615}, { 988, 357, 646},
+ { 1227, 667, 683}, { 1164, 1565, 894}, { 1392, 2015, 477},
+ { 1138, 533, 250}, { 1437, 896, 391}, { 1765, 1118, 99},
+ { 1112, 1090, 802}, { 1596, 846, 1134}, { 937, 1161, 279},
+ { 1719, 1254, 683}, { 1338, 1086, 35}, { 1419, 1324, 428},
+ { 1428, 1524, 40}, { 2108, 1594, 89}, { 1015, 544, 1222},
+ { 1121, 925, 1263}, { 1030, 1318, 1485}, { 1295, 789, 1817},
+ { 1323, 1272, 1909}, { 1724, 1237, 1803}, { 1797, 1689, 858},
+ { 2149, 1367, 1301}, { 2302, 1867, 761}, { 2863, 2351, 1053},
+ { 52, 163, -76}, { 230, 309, -492}, { -71, 619, 39},
+ { -218, 856, 499}, { -654, 736, -207}, { -535, 1259, 155},
+ { -480, 1476, 643}, { 262, 1081, 102}, { 309, 1592, -182},
+ { 627, 1629, 534}, { 337, 643, 456}, { 758, 670, 713},
+ { 202, 1126, 658}, { 612, 1131, 666}, { 686, 1223, 1136},
+ { -131, 377, 525}, { 42, 708, 907}, { 87, 1488, 1035},
+ { 432, 2117, 904}, { 137, 981, 1332}, { -447, 1014, 1136},
+ { -839, 1793, 1246}, { -559, 297, 198}, { -850, 685, 446},
+ {-1273, 632, 826}, { -401, -544, 173}, { -753, -793, 144},
+ { -436, -9, 772}, { -115, -243, 1310}, { -670, -269, 374},
+ {-1027, -13, 639}, { -887, -81, 1137}, {-1277, -455, 158},
+ {-1411, -720, 736}, { 172, 88, 403}, { 386, 255, 756},
+ { -500, 522, 910}, { -958, 659, 1388}, { -395, 301, 1344},
+ { -356, 768, 1813}, { -613, 841, 2419}, { 445, -122, 252},
+ { 629, -87, 723}, { 283, -253, 870}, { 456, -116, 1381},
+ { 757, 180, 1059}, { 532, 408, 1509}, { 947, 288, 1806},
+ { 1325, 994, 2524}, { 892, 1219, 3023}, { 1397, 1596, 3406},
+ { 1143, 1552, 2546}, { 1850, 1433, 2710}, { -10, 134, 1002},
+ { 154, 499, 1323}, { 508, 792, 1117}, { 509, 1340, 1616},
+ { 762, 862, 1608}, { 787, 740, 2320}, { 794, 1727, 1283},
+ { 465, 2108, 1660}, { -120, 1451, 1613}, { -386, 2016, 2169},
+ { 891, 1225, 2050}, { 456, 1480, 2185}, { 1493, 1283, 1209},
+ { 1397, 1636, 1518}, { 1776, 1738, 1552}, { 1572, 1698, 2141},
+ { 1389, 2126, 1271}, { 1959, 2413, 1119}, { 1365, 2892, 1505},
+ { 2206, 1971, 1623}, { 2076, 1950, 2280}, { 1717, 2291, 1867},
+ { 2366, 2515, 1953}, { 2865, 2838, 2522}, { 2535, 3465, 2011},
+ { 3381, 4127, 2638}, { 836, 2667, 2289}, { 1761, 2773, 2337},
+ { 1415, 3325, 2911}, { 2354, 3138, 3126}, { 2659, 4192, 4010},
+ { 1048, 1786, 1818}, { 1242, 2111, 2240}, { 1512, 2079, 2780},
+ { 1573, 2491, 3138}, { 2230, 2377, 2782}, { 416, 1773, 2704},
+ { 725, 2336, 3297}, { 1252, 2373, 3978}, { 2094, 2268, 3568},
+ { 2011, 2712, 4528}, { 1341, 3507, 3876}, { 1216, 3919, 4922},
+ { 1693, 4793, 6012}
+};
+
+static const int16_t lsp_band1[LSP_CB_SIZE][3] = {
+ { 0, 0, 0}, {-2114, -1302, 76}, {-2652, -1278, -1368},
+ {-2847, -828, -349}, {-3812, -2190, -349}, {-3946, -364, -449},
+ {-2725, -4492, -3607}, {-3495, -4764, -1744}, { -51, -756, 84},
+ { -153, -1191, 504}, { 108, -1418, 1167}, { -835, -896, 390},
+ { -569, -1702, 87}, {-1151, -1818, 933}, {-1826, -2547, 411},
+ {-1842, -1818, 1451}, {-2438, -1611, 781}, {-2747, -2477, 1311},
+ { -940, 1252, 477}, {-1629, 1688, 602}, {-1202, 617, 280},
+ {-1737, 393, 580}, {-1528, 1077, 1199}, {-2165, -161, 1408},
+ {-2504, -1087, 2371}, {-3458, -175, 1395}, {-1397, -98, -843},
+ {-2252, -177, -1149}, {-1489, -726, -1283}, {-1558, -265, -1744},
+ {-1867, -821, -1897}, {-2062, -1516, -2340}, {-2595, -1142, -2861},
+ { 170, 46, -819}, { -193, -204, -1151}, { 326, -196, -1532},
+ { 780, 329, -816}, { 201, 369, -1243}, { 650, -209, -1060},
+ { 1144, -15, -1216}, { 1203, -259, -1867}, { -890, -564, -1430},
+ { -638, -852, -1921}, { 177, -739, -1358}, { -261, -526, -1666},
+ { 206, -407, -2255}, { 338, -526, -822}, { 421, -1095, -1009},
+ { 765, -607, -1408}, { 825, -1295, -2004}, { 357, -905, -1815},
+ { -58, -1248, -1588}, { -596, -1436, -2046}, { -73, -1159, -2116},
+ { -115, -1382, -2581}, { -160, -1723, -1952}, { -6, -2196, -2954},
+ { -649, -1705, -2603}, { -617, -1453, -3282}, { -949, -2019, -3102},
+ { -812, 1544, 1937}, {-1854, 574, 2000}, {-1463, 1140, 2649},
+ {-2683, 1748, 1452}, {-2486, 2241, 2523}, { 783, 1910, 1435},
+ { 581, 2682, 1376}, { 236, 2197, 1885}, { -453, 2943, 2057},
+ { -682, 2178, 2565}, {-1342, 3201, 3328}, { -288, -184, 262},
+ { 121, -149, -183}, { 758, -412, 206}, { 1038, -204, 853},
+ { 1577, -457, 700}, { 937, -640, -567}, { 1508, -528, -1024},
+ { -225, -527, -427}, { -564, -1095, -332}, { -742, -353, -186},
+ {-1288, -459, 84}, {-1853, -484, -274}, {-1554, -731, 825},
+ {-2425, -234, 382}, {-1722, 293, -271}, {-2515, 425, -564},
+ {-2599, 818, 464}, { -358, 118, -375}, { -613, 198, -874},
+ { -690, 683, -324}, {-1352, 1155, -168}, {-1093, 129, -324},
+ {-1184, 611, -858}, { 433, 386, -372}, { -120, 486, -634},
+ { 234, 851, -631}, { 602, 128, 46}, { 1099, 410, 159},
+ { 715, -145, -424}, { 1198, -85, -593}, { 1390, 367, -358},
+ { 1683, 362, -964}, { 1711, 622, 45}, { 2033, 833, -383},
+ { 2890, 549, -506}, { 7, 401, 52}, { 72, 811, 415},
+ { 566, 668, 41}, { 467, 1218, 130}, { 68, 957, -187},
+ { -25, 1649, -103}, { -661, 260, 214}, { -925, -94, 612},
+ { -321, -422, 965}, { -788, -672, 1783}, { 400, -673, 779},
+ { 741, -595, 1635}, { -161, 307, 657}, { -382, 836, 871},
+ { -814, 400, 1223}, { 364, 606, 1247}, { 57, 75, 1571},
+ { 151, 471, 2287}, { -81, 1021, 1502}, { 227, 1470, 1097},
+ { 658, 1275, 1653}, { 664, 1478, 2377}, { 263, -127, 444},
+ { 264, 89, 969}, { 794, 171, 576}, { 821, 186, 1226},
+ { 404, 462, 517}, { 339, 918, 794}, { 1280, 1423, 196},
+ { 1453, 2019, 365}, { 1615, 1481, 672}, { 2394, 1708, 508},
+ { 806, 1238, 573}, { 713, 1158, 1078}, { 1285, 1436, 1232},
+ { 1790, 1188, 1141}, { 765, 643, 864}, { 1032, 797, 1279},
+ { 900, 563, 1827}, { 1514, 673, 2312}, { 1544, 1129, 3240},
+ { 1469, 1050, 1594}, { 1945, 1318, 1988}, { 2397, 2026, 2060},
+ { 3538, 2057, 2620}, { 1249, -118, 74}, { 1727, 194, 421},
+ { 2078, -50, -463}, { 970, 688, -432}, { 1149, 952, -110},
+ { 1254, 1275, -651}, { 1386, 929, 401}, { 1960, 1167, 232},
+ { 407, -752, -243}, { 859, -1118, 172}, { -227, -860, -992},
+ { -796, -1175, -1380}, { 8, -1282, -388}, { 353, -1781, -1037},
+ { -732, -397, -807}, { -853, -28, -1342}, {-1229, -1207, -1959},
+ {-1015, -1125, -2543}, {-1452, -1791, -2725}, {-1891, -2416, -3269},
+ { -918, -1629, -783}, { -580, -2155, -698}, {-1097, -2364, -96},
+ {-1387, -1513, 7}, {-1588, -2076, -664}, {-1473, -2740, -784},
+ {-2378, -3149, -56}, {-2856, -2092, -169}, {-3391, -3708, 316},
+ {-1176, -890, -614}, {-1944, -1061, -800}, { -299, -1517, -1000},
+ { -640, -1850, -1526}, {-1454, -1536, -1233}, {-1890, -1955, -1756},
+ {-1086, -1921, -2122}, { -750, -2325, -2260}, {-1325, -2413, -2673},
+ {-1114, -2542, -3459}, {-1341, -2901, -3963}, {-1160, -2226, -1393},
+ {-1001, -2772, -1573}, {-1594, -2641, -1978}, {-1534, -3046, -2624},
+ {-2224, -2196, -675}, {-2807, -3054, -1102}, {-2008, -2840, -1186},
+ {-1980, -3332, -1695}, {-1715, -3562, -505}, {-2527, -4000, -1887},
+ {-2333, -2734, -2296}, {-3440, -2401, -3211}, {-2008, -3528, -3337},
+ {-2247, -3291, -4510}, { -475, 949, 155}, { -149, 1365, 545},
+ { -757, 1644, 1083}, { -217, 2053, 1353}, {-1433, 2301, 1462},
+ { 495, 1661, 529}, { 10, 2037, 740}, { 2082, 1898, 978},
+ { 2831, 2294, 911}, { 842, 793, 420}, { 1223, 1023, 863},
+ { 1237, 451, 780}, { 1744, 708, 822}, { 1533, 284, 1384},
+ { 2135, 609, 1538}, { 2305, 626, 540}, { 2368, 1187, 955},
+ { 2586, 1255, -7}, { 3116, 1131, 726}, { 3431, 1730, 428},
+ { 2734, 1648, 1307}, { 2988, 1231, 2010}, { 3523, 2024, 1488},
+ { 1034, 1657, 871}, { 1206, 2163, 1036}, { 1807, 2372, 1233},
+ { 1808, 1769, 1493}, { 1573, 2332, 1779}, { 1216, 1609, 1866},
+ { 1480, 1898, 2513}, { 465, 2708, 2776}, { 771, 3638, 3338},
+ { 1869, 2599, 2623}, { 2825, 2745, 2468}, { 2638, 2439, 1585},
+ { 2094, 2970, 1308}, { 2022, 3057, 1999}, { 3428, 2912, 1816},
+ { 4536, 2974, 2129}, { 1046, 2563, 2086}, { 1363, 3562, 2318},
+ { 2511, 1891, 2984}, { 1866, 2306, 3986}, { 3272, 2924, 3682},
+ { 3146, 3564, 2272}, { 3592, 3968, 2822}, { 2431, 3369, 3069},
+ { 1931, 4709, 3090}, { 2629, 4220, 3986}, { 4639, 4056, 3664},
+ { 4035, 5334, 4912}
+};
+
+static const int16_t lsp_band2[LSP_CB_SIZE][4] = {
+ { 0, 0, 0, 0}, { 601, 512, -542, 334},
+ { 428, 1087, -484, -132}, { 652, 622, -391, -572},
+ { 378, 799, 141, -860}, { 1040, 409, 112, -554},
+ { 1123, 670, -75, -847}, { 1421, 494, -315, -1095},
+ { 787, 1001, 114, -460}, { 988, 1672, 216, -681},
+ { 1007, 1241, -132, -1247}, { 1073, 399, 186, -5},
+ { 1262, 193, -694, -129}, { 325, 196, 51, -641},
+ { 861, -59, 350, -458}, { 1261, 567, 586, -346},
+ { 1532, 885, 210, -517}, { 2027, 937, 113, -792},
+ { 1383, 1064, 334, 38}, { 1964, 1468, 459, 133},
+ { 2062, 1186, -98, -121}, { 2577, 1445, 506, -373},
+ { 2310, 1682, -2, -960}, { 2876, 1939, 765, 138},
+ { 3581, 2360, 649, -414}, { 219, 176, -398, -309},
+ { 434, -78, -435, -880}, { -344, 301, 265, -552},
+ { -915, 470, 657, -380}, { 419, -432, -163, -453},
+ { 351, -953, 8, -562}, { 789, -43, 20, -958},
+ { 302, -594, -352, -1159}, { 1040, 108, -668, -924},
+ { 1333, 210, -1217, -1663}, { 483, 589, -350, -1140},
+ { 1003, 824, -802, -1184}, { 745, 58, -589, -1443},
+ { 346, 247, -915, -1683}, { 270, 796, -720, -2043},
+ { 1208, 722, -222, -193}, { 1486, 1180, -412, -672},
+ { 1722, 179, -69, -521}, { 2047, 860, -666, -1410},
+ { -146, 222, -281, -805}, { -189, 90, -114, -1307},
+ { -152, 1086, -241, -764}, { -439, 733, -601, -1302},
+ { -833, -167, -351, -601}, { -856, -422, -411, -1059},
+ { -747, -355, -582, -1644}, { -837, 210, -916, -1144},
+ {-1800, 32, -878, -1687}, { -48, -23, -1146, 52},
+ { -350, -409, -1656, -364}, { 265, -728, -858, -577},
+ { 458, -247, -1141, -997}, { 691, -407, -1988, -1161},
+ { -66, -104, -705, -1249}, { -431, -93, -1191, -1844},
+ { 203, -732, -1000, -1693}, { 10, -832, -1846, -1819},
+ { 493, -128, -1436, -1768}, { 488, -311, -1730, -2540},
+ { -653, -532, -1150, -1172}, {-1086, -289, -1706, -1533},
+ { -699, -1205, -1216, -1766}, {-1032, -1481, -2074, -1523},
+ { -721, -1220, -2277, -2600}, { 12, -539, -1484, -1131},
+ { -40, -911, -2106, -441}, { -471, -484, -2267, -1549},
+ { -141, -988, -3006, -1721}, {-1545, -2102, -583, 342},
+ {-1383, -2772, -386, -13}, {-2118, -2589, -1205, 72},
+ {-2147, -3231, -965, 390}, {-2949, -3300, -621, 637},
+ {-3907, -4138, -865, 803}, {-1287, -845, -375, -548},
+ {-1416, -1169, -487, -1277}, {-1400, -1690, -1027, -418},
+ {-2018, -1909, -1188, -1260}, {-1418, -2222, -2029, -128},
+ {-2067, -2998, -2693, -310}, { -950, -1028, -1538, 185},
+ {-1616, -915, -2205, -549}, { 19, -821, -1145, 352},
+ { 184, -1175, -1356, -627}, { -547, -1088, -1661, -911},
+ { -216, -1502, -2197, -948}, { -795, -1306, -2374, -451},
+ { -924, -1889, -2796, -680}, { -600, -1614, -3609, -885},
+ {-2392, -2528, 319, 303}, {-2908, -2095, -310, 573},
+ {-3460, -2141, 49, -113}, {-2231, -448, 675, -146},
+ {-2805, -532, 1231, 479}, {-2684, -486, -200, 611},
+ {-3525, -971, -198, 704}, {-3707, 173, 349, 254},
+ {-4734, -1447, -34, 880}, { 777, -512, 114, -10},
+ { 1250, -66, 442, -5}, { 604, 613, 452, -352},
+ { 1224, 777, 675, -1014}, {-1372, -79, -1208, -238},
+ {-2389, -17, -1157, -818}, {-1504, -673, -1133, -1060},
+ {-1984, -799, -2005, -1973}, {-2037, -798, -1068, -105},
+ {-3190, -899, -1817, -194}, { -156, -886, 394, -318},
+ { -258, -1283, 551, 202}, { -536, -1729, 910, 331},
+ { -847, -1109, 795, -163}, {-1171, -1128, 715, 519},
+ {-1080, -1319, 1685, 668}, {-1000, -1921, 96, 211},
+ {-1487, -2148, 831, 174}, {-1139, -374, 414, -4},
+ {-1517, -1383, 396, -352}, {-1012, 439, -59, -967},
+ {-1812, 706, -440, -1030}, {-1971, -329, -34, -827},
+ {-2472, -1588, -151, -606}, {-2161, 374, -281, 76},
+ {-3012, 231, -15, -690}, { 1104, 566, 721, 209},
+ { 1685, 564, 383, 98}, { 1898, 750, 792, -97},
+ { 556, -64, 561, -93}, { 876, 162, 913, -22},
+ { 961, 675, 1296, 140}, { 756, -396, 851, 544},
+ { 360, -303, 1341, 396}, { 878, -22, 1464, 863},
+ { -309, -273, 642, -129}, { -686, -82, 842, 454},
+ { -5, -47, 1069, 998}, { -94, 967, 1277, 298},
+ { -489, 385, 1473, 746}, { -369, -717, 1333, 242},
+ { 281, -993, 1726, 924}, { 464, 601, 1575, 1376},
+ { -250, 206, 2339, 1175}, { -438, 377, -597, -285},
+ {-1020, 787, -790, -287}, { -458, -410, 215, 295},
+ { -589, -860, -121, 797}, {-1175, 122, -437, 466},
+ {-1480, -121, 367, 924}, { 234, 323, 770, -555},
+ { 145, 30, 996, 26}, { 66, 849, 93, -145},
+ { -117, 1261, 474, -399}, {-1495, 1051, 218, -506},
+ {-1390, 694, 994, 88}, { 616, 7, 78, 304},
+ { 1060, 52, -62, 835}, { 833, 454, 649, 1359},
+ { -770, 464, 47, 93}, { -574, 1199, -39, 379},
+ { 114, -98, 488, 485}, { 727, 244, 606, 696},
+ { -76, 455, 671, 546}, { -565, -13, 145, 819},
+ { -376, 569, 448, 1128}, { 218, 122, 265, 1167},
+ { 230, 738, 932, 1003}, { 138, 477, 36, 450},
+ { 404, 787, -73, 1000}, { 497, 1259, 387, 1231},
+ { 17, 207, 195, -79}, { 562, 358, 53, -158},
+ { 493, 387, 478, 189}, { 678, 831, 640, 558},
+ { -197, 523, 613, 57}, { 429, 894, 769, 111},
+ { 67, 1174, 568, 511}, { 1242, 824, 251, 840},
+ { 1419, 1074, 864, 481}, { 924, 1474, 669, 724},
+ { 1539, 1879, 654, 1590}, { 445, 337, 1111, 541},
+ { 472, 1421, 1264, 1094}, { 794, 735, 1103, 668},
+ { 1055, 863, 1192, 1020}, { 778, 1105, 806, 1798},
+ { 1052, 1527, 1587, 2151}, { 881, 1552, 1265, 391},
+ { 726, 872, 1812, 601}, { 1469, 280, 1008, 616},
+ { 1403, 577, 1803, 1244}, { 1650, 1314, 1148, 1072},
+ { 1297, 1669, 1911, 1026}, { 2093, 1044, 2115, 1189},
+ { 1644, 1961, 2587, 1512}, { 25, -315, -9, -106},
+ { 290, -339, 428, -444}, { -68, -783, 735, 772},
+ { 245, -555, 468, 47}, { 334, -895, 814, 146},
+ { 235, 368, -964, -959}, { -203, 315, -1566, -1217},
+ { 801, 17, -276, -354}, { 894, -495, -789, -635},
+ { 716, 291, -1189, -357}, { 560, -260, -733, -2},
+ { 679, -508, -1429, 211}, { -51, -62, -428, 557},
+ { 322, -638, -211, 614}, { -878, -1057, -84, -71},
+ { -388, -1415, -167, -318}, { -754, -1574, 214, -539},
+ {-1419, -2004, -92, -787}, { -47, -856, -347, -255},
+ { 23, -1211, -173, 320}, { -658, -487, -893, 353},
+ { -783, -1587, -584, 507}, {-1420, -859, -378, 441},
+ {-2095, -1491, -137, 439}, { -321, -1450, -1288, -12},
+ { -359, -2113, -553, -8}, { -831, -1918, -1561, 32},
+ {-1014, -2487, -1359, -939}, { -475, -311, -169, -236},
+ { -907, -426, 276, -611}, { -96, -400, 50, -710},
+ { -426, -1022, -10, -985}, { -197, -258, -744, -575},
+ { -611, -930, -771, -394}, { -267, -776, -612, -939},
+ { -256, -1346, -802, -1122}, { -796, -1570, -825, -754},
+ { 712, 876, 141, 227}, { 981, 1509, 85, 124},
+ { 1462, 1228, 979, -39}, { 1734, 999, 1481, 440},
+ { 2293, 1116, 769, 440}, { 2504, 1480, 1241, 356},
+ { 2474, 1909, 1558, 810}, { 917, 1134, 607, -134},
+ { 509, 1809, 781, -123}, { 1712, 1506, 559, -423},
+ { 2037, 2317, 726, -155}, { 3031, 2676, 1203, 331},
+ { 3664, 3274, 1768, 531}, { 1610, 1839, 867, 183},
+ { 1774, 1972, 1538, 97}, { 1822, 2158, 1282, 659},
+ { 2222, 2758, 1818, 900}, { 3251, 2124, 1723, 996},
+ { 3633, 2336, 2408, 1453}, { 2923, 3517, 2567, 1318},
+};
+
+/*
+ * Used for the coding/decoding of the pulses positions
+ * for the MP-MLQ codebook
+ */
+static const int32_t combinatorial_table[PULSE_MAX][SUBFRAME_LEN/GRID_SIZE] = {
+ {118755, 98280, 80730, 65780L, 53130,
+ 42504, 33649, 26334, 20349, 15504,
+ 11628, 8568, 6188, 4368, 3003,
+ 2002, 1287, 792, 462, 252,
+ 126, 56, 21, 6, 1,
+ 0, 0, 0, 0, 0},
+
+ { 23751, 20475, 17550, 14950, 12650,
+ 10626, 8855, 7315, 5985, 4845,
+ 3876, 3060, 2380, 1820, 1365,
+ 1001, 715, 495, 330, 210,
+ 126, 70, 35, 15, 5,
+ 1, 0, 0, 0, 0},
+
+ { 3654, 3276, 2925, 2600, 2300,
+ 2024, 1771, 1540, 1330, 1140,
+ 969, 816, 680, 560, 455,
+ 364, 286, 220, 165, 120,
+ 84, 56, 35, 20, 10,
+ 4, 1, 0, 0, 0},
+
+ { 406, 378, 351, 325, 300,
+ 276, 253, 231, 210, 190,
+ 171, 153, 136, 120, 105,
+ 91, 78, 66, 55, 45,
+ 36, 28, 21, 15, 10,
+ 6, 3, 1, 0, 0},
+
+ { 29, 28, 27, 26, 25,
+ 24, 23, 22, 21, 20,
+ 19, 18, 17, 16, 15,
+ 14, 13, 12, 11, 10,
+ 9, 8, 7, 6, 5,
+ 4, 3, 2, 1, 0},
+
+ { 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1},
+};
+
+static const int16_t pitch_contrib[340] = {
+ 60, 0, 0, 2489, 60, 0, 0, 5217,
+ 1, 6171, 0, 3953, 0, 10364, 1, 9357,
+ -1, 8843, 1, 9396, 0, 5794, -1, 10816,
+ 2, 11606, -2, 12072, 0, 8616, 1, 12170,
+ 0, 14440, 0, 7787, -1, 13721, 0, 18205,
+ 0, 14471, 0, 15807, 1, 15275, 0, 13480,
+ -1, 18375, -1, 0, 1, 11194, -1, 13010,
+ 1, 18836, -2, 20354, 1, 16233, -1, 0,
+ 60, 0, 0, 12130, 0, 13385, 1, 17834,
+ 1, 20875, 0, 21996, 1, 0, 1, 18277,
+ -1, 21321, 1, 13738, -1, 19094, -1, 20387,
+ -1, 0, 0, 21008, 60, 0, -2, 22807,
+ 0, 15900, 1, 0, 0, 17989, -1, 22259,
+ 1, 24395, 1, 23138, 0, 23948, 1, 22997,
+ 2, 22604, -1, 25942, 0, 26246, 1, 25321,
+ 0, 26423, 0, 24061, 0, 27247, 60, 0,
+ -1, 25572, 1, 23918, 1, 25930, 2, 26408,
+ -1, 19049, 1, 27357, -1, 24538, 60, 0,
+ -1, 25093, 0, 28549, 1, 0, 0, 22793,
+ -1, 25659, 0, 29377, 0, 30276, 0, 26198,
+ 1, 22521, -1, 28919, 0, 27384, 1, 30162,
+ -1, 0, 0, 24237, -1, 30062, 0, 21763,
+ 1, 30917, 60, 0, 0, 31284, 0, 29433,
+ 1, 26821, 1, 28655, 0, 31327, 2, 30799,
+ 1, 31389, 0, 32322, 1, 31760, -2, 31830,
+ 0, 26936, -1, 31180, 1, 30875, 0, 27873,
+ -1, 30429, 1, 31050, 0, 0, 0, 31912,
+ 1, 31611, 0, 31565, 0, 25557, 0, 31357,
+ 60, 0, 1, 29536, 1, 28985, -1, 26984,
+ -1, 31587, 2, 30836, -2, 31133, 0, 30243,
+ -1, 30742, -1, 32090, 60, 0, 2, 30902,
+ 60, 0, 0, 30027, 0, 29042, 60, 0,
+ 0, 31756, 0, 24553, 0, 25636, -2, 30501,
+ 60, 0, -1, 29617, 0, 30649, 60, 0,
+ 0, 29274, 2, 30415, 0, 27480, 0, 31213,
+ -1, 28147, 0, 30600, 1, 31652, 2, 29068,
+ 60, 0, 1, 28571, 1, 28730, 1, 31422,
+ 0, 28257, 0, 24797, 60, 0, 0, 0,
+ 60, 0, 0, 22105, 0, 27852, 60, 0,
+ 60, 0, -1, 24214, 0, 24642, 0, 23305,
+ 60, 0, 60, 0, 1, 22883, 0, 21601,
+ 60, 0, 2, 25650, 60, 0, -2, 31253,
+ -2, 25144, 0, 17998
+};
+
+/* Number of non-zero pulses in the MP-MLQ excitation */
+static const int8_t pulses[4] = {6, 5, 6, 5};
+
+/* Size of the MP-MLQ fixed excitation codebooks */
+static const int32_t max_pos[4] = {593775, 142506, 593775, 142506};
+
+static const int16_t fixed_cb_gain[GAIN_LEVELS] = {
+ 1, 2, 3, 4, 6, 9, 13, 18,
+ 26, 38, 55, 80, 115, 166, 240, 348,
+ 502, 726, 1050, 1517, 2193, 3170, 4582, 6623,
+};
+
+static const int16_t adaptive_cb_gain85[85 * 20] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 800, 1496, 167, -256,
+ -338, -39, -136, -1, -4, -6, -73, -8,
+ -15, 12, 23, 2, 16, 30, 3, -5,
+ -462, -686, 493, 2575, 311, -13, -28, -14,
+ -404, -5, -19, 13, 20, 72, 107, -77,
+ 8, 13, -9, -48, 1483, 144, 784, 928,
+ 1243, -134, -1, -37, -52, -94, -13, -71,
+ -6, -84, -8, -44, -112, -10, -59, -70,
+ -77, 275, 3522, 1056, -1254, 0, -4, -757,
+ -68, -95, 1, 16, -59, 4, -17, -227,
+ -5, 21, 269, 80, -125, -40, -264, 381,
+ 5027, 0, 0, -4, -8, -1542, 0, -2,
+ 0, 2, 0, 6, 38, 12, 81, -117,
+ 138, 332, 2215, 2574, 1339, -1, -6, -299,
+ -404, -109, -2, -18, -44, -21, -52, -348,
+ -11, -27, -181, -210, 3685, 2883, -887, 866,
+ -1639, -828, -507, -48, -45, -164, -648, 199,
+ 156, -194, -152, 46, 368, 288, -88, 86,
+ 1396, 2146, 2235, 345, 942, -118, -281, -305,
+ -7, -54, -182, -190, -292, -29, -45, -47,
+ -80, -123, -128, -19, 13, 4475, 3549, -804,
+ -655, 0, -1222, -768, -39, -26, -3, -2,
+ -969, 0, 219, 174, 0, 179, 141, -32,
+ -724, 254, 242, 6049, 2462, -32, -3, -3,
+ -2233, -370, 11, 10, -3, 267, -94, -89,
+ 108, -38, -36, -909, 626, -1713, 6121, 4561,
+ -1061, -23, -179, -2287, -1270, -68, 65, -233,
+ 640, -174, 477, -1704, 40, -111, 396, 295,
+ -350, 1391, 7985, 511, -405, -7, -118, -3892,
+ -15, -10, 29, 170, -678, 10, -43, -249,
+ -8, 34, 197, 12, 3144, -529, 608, 2530,
+ 3878, -603, -17, -22, -390, -918, 101, -116,
+ 19, -485, 81, -93, -744, 125, -144, -599,
+ 2589, -689, 3045, 5603, -404, -409, -29, -566,
+ -1916, -10, 108, -481, 128, -885, 235, -1041,
+ 63, -17, 75, 138, 3107, 513, 1374, -3594,
+ -4922, -589, -16, -115, -788, -1478, -97, -260,
+ -43, 681, 112, 301, 933, 154, 413, -1079,
+ 2468, 6010, 1107, -390, 1961, -372, -2204, -74,
+ -9, -234, -905, -166, -406, 58, 143, 26,
+ -295, -719, -132, 46, 4773, 2766, 2368, 4862,
+ -4044, -1390, -467, -342, -1443, -998, -806, -690,
+ -399, -1416, -821, -702, 1178, 682, 584, 1200,
+ 1665, -1879, 1443, 1701, 8562, -169, -215, -127,
+ -176, -4475, 190, -146, 165, -172, 195, -149,
+ -870, 982, -754, -889, 2716, 9011, -1007, 755,
+ -1785, -450, -4956, -61, -34, -194, -1493, 167,
+ 554, -125, -415, 46, 296, 982, -109, 82,
+ -2727, 7548, 1285, 938, 3420, -453, -3478, -100,
+ -53, -714, 1256, 213, -592, 156, -432, -73,
+ 569, -1576, -268, -196, 3677, 882, 4050, 1202,
+ 2323, -825, -47, -1001, -88, -329, -198, -909,
+ -218, -269, -64, -297, -521, -125, -574, -170,
+ 2046, -753, 122, 10102, 603, -255, -34, 0,
+ -6229, -22, 94, -15, 5, -1261, 464, -75,
+ -75, 27, -4, -372, 449, -1815, 10690, 3870,
+ -527, -12, -201, -6976, -914, -16, 49, -293,
+ 1184, -106, 428, -2525, 14, -58, 344, 124,
+ -941, 2352, 5049, 3650, 2637, -54, -337, -1556,
+ -813, -424, 135, 290, -725, 209, -524, -1125,
+ 151, -378, -812, -587, -1879, 796, 3117, 9569,
+ -404, -215, -38, -593, -5589, -9, 91, 357,
+ -151, 1097, -464, -1821, -46, 19, 76, 236,
+ -1715, 2043, -2096, 9946, 4001, -179, -254, -268,
+ -6038, -977, 213, -219, 261, 1041, -1240, 1272,
+ 418, -498, 511, -2429, -5772, -618, -3921, 284,
+ -3155, -2033, -23, -938, -4, -607, -218, -1381,
+ -148, 100, 10, 68, -1111, -119, -755, 54,
+ 382, 4748, 8003, -2064, 2198, -8, -1376, -3909,
+ -260, -294, -110, -186, -2319, 48, 598, 1008,
+ -51, -637, -1073, 277, -867, 3015, 11926, -1675,
+ 947, -45, -555, -8681, -171, -54, 159, 631,
+ -2195, -88, 308, 1219, 50, -174, -690, 96,
+ -4933, -432, 6757, 3771, 1352, -1485, -11, -2786,
+ -867, -111, -130, 2034, 178, 1135, 99, -1555,
+ 407, 35, -557, -311, 152, 9726, 4231, -1928,
+ 1490, -1, -5774, -1092, -226, -135, -90, -39,
+ -2511, 17, 1144, 498, -13, -884, -384, 175,
+ 2512, 193, 9033, 5361, -3148, -385, -2, -4980,
+ -1754, -605, -29, -1385, -106, -822, -63, -2956,
+ 482, 37, 1735, 1030, 8464, 2844, 12, 549,
+ 2132, -4373, -493, 0, -18, -277, -1469, -6,
+ -2, -284, -95, 0, -1101, -370, -1, -71,
+ 2141, -2602, 7166, 9046, -1350, -279, -413, -3134,
+ -4994, -111, 340, -936, 1138, -1182, 1436, -3957,
+ 176, -214, 590, 745, -244, 278, 13307, 1227,
+ -161, -3, -4, -10808, -91, -1, 4, 198,
+ -226, 18, -20, -997, -2, 2, 131, 12,
+ -1947, 8217, 6269, 917, -2559, -231, -4121, -2399,
+ -51, -399, 976, 745, -3144, 108, -460, -350,
+ -304, 1283, 979, 143, -1810, 2061, -2781, 6056,
+ 10058, -200, -259, -472, -2238, -6174, 227, -307,
+ 349, 669, -761, 1028, 1111, -1265, 1707, -3717,
+ 7827, 9161, -3409, 2473, -1510, -3739, -5122, -709,
+ -373, -139, -4376, 1628, 1906, -1181, -1382, 514,
+ 721, 844, -314, 228, -1430, 8313, 9541, -2955,
+ 1626, -124, -4218, -5556, -533, -161, 725, 832,
+ -4841, -257, 1499, 1721, 142, -825, -947, 293,
+ 2819, -4247, 5391, 8673, 2756, -485, -1101, -1774,
+ -4591, -463, 730, -927, 1397, -1492, 2248, -2854,
+ -474, 714, -907, -1459, 141, 14552, 690, 257,
+ -112, -1, -12926, -29, -4, 0, -125, -5,
+ -613, -2, -228, -10, 0, 99, 4, 1,
+ 11938, -1859, 1806, -962, -884, -8699, -211, -199,
+ -56, -47, 1355, -1316, 205, 701, -109, 106,
+ 644, -100, 97, -51, 3728, 1982, 2264, 4584,
+ 3131, -848, -239, -312, -1282, -598, -451, -515,
+ -273, -1043, -554, -633, -712, -378, -432, -876,
+ -1181, 766, 720, 14303, -216, -85, -35, -31,
+ -12486, -2, 55, 51, -33, 1031, -668, -628,
+ -15, 10, 9, 189, -4385, 4826, 10112, 1569,
+ 3388, -1173, -1421, -6242, -150, -700, 1291, 2706,
+ -2979, 420, -462, -969, 906, -998, -2091, -324,
+ -448, 1932, 15591, -1842, 657, -12, -227, -14837,
+ -207, -26, 52, 427, -1838, -50, 217, 1753,
+ 18, -77, -626, 74, -4141, 1844, 3962, 5517,
+ 6220, -1046, -207, -958, -1858, -2361, 466, 1001,
+ -446, 1394, -621, -1334, 1572, -700, -1504, -2094,
+ 729, -2299, 14755, 3657, -952, -32, -322, -13288,
+ -816, -55, 102, -656, 2071, -162, 513, -3294,
+ 42, -133, 857, 212, -1385, 5801, 13339, -3137,
+ 1344, -117, -2054, -10861, -600, -110, 490, 1127,
+ -4723, -265, 1111, 2554, 113, -476, -1094, 257,
+ 4710, 9661, 1073, -2467, 3274, -1354, -5697, -70,
+ -371, -654, -2777, -308, -633, 709, 1455, 161,
+ -941, -1930, -214, 493, 1843, -3624, 12422, 6898,
+ -1559, -207, -802, -9419, -2904, -148, 407, -1397,
+ 2748, -775, 1526, -5230, 175, -344, 1182, 656,
+ 1433, 2394, 2507, 1380, 8780, -125, -349, -383,
+ -116, -4705, -209, -219, -366, -120, -201, -211,
+ -768, -1283, -1343, -740, -1712, 12915, 5883, -2197,
+ 991, -179, -10181, -2112, -294, -60, 1350, 615,
+ -4638, -229, 1732, 789, 103, -781, -356, 133,
+ 15072, 2158, -1245, 910, -496, -13865, -284, -94,
+ -50, -15, -1986, 1145, 164, -837, -119, 69,
+ 456, 65, -37, 27, 4655, 7319, 4916, 586,
+ -3381, -1322, -3270, -1475, -20, -697, -2079, -1396,
+ -2196, -166, -261, -175, 960, 1510, 1014, 120,
+ 1191, -2140, 5120, 13498, -1418, -86, -279, -1600,
+ -11121, -122, 155, -372, 669, -981, 1763, -4218,
+ 103, -185, 443, 1168, -1530, -817, 8191, 9632,
+ -1452, -143, -40, -4095, -5663, -128, -76, 765,
+ 408, 900, 480, -4815, -135, -72, 726, 854,
+ -3236, 607, 1696, -2106, 11485, -639, -22, -175,
+ -270, -8051, 119, 335, -62, -416, 78, 218,
+ 2268, -425, -1189, 1476, 3203, -1903, -837, 9679,
+ 7057, -626, -221, -42, -5718, -3039, 372, 163,
+ -97, -1892, 1124, 494, -1380, 819, 360, -4169,
+ 213, -655, 17015, 620, -384, -2, -26, -17671,
+ -23, -9, 8, -221, 681, -8, 24, -644,
+ 5, -15, 399, 14, 5088, 35, -3339, 3726,
+ 8488, -1580, 0, -680, -847, -4397, -10, 1037,
+ 7, -1157, -8, 759, -2636, -18, 1730, -1930,
+ -988, 1454, -2688, 15039, 2682, -59, -129, -441,
+ -13805, -439, 87, -162, 238, 907, -1335, 2467,
+ 161, -238, 440, -2462, -4865, -2842, -53, 5495,
+ 6523, -1445, -493, 0, -1843, -2597, -844, -16,
+ -9, 1632, 953, 18, 1937, 1131, 21, -2188,
+ 3076, 15069, -2914, 1810, -971, -577, -13860, -518,
+ -200, -57, -2829, 547, 2680, -339, -1665, 322,
+ 182, 893, -172, 107, 1311, 5355, 11054, 2299,
+ -3654, -105, -1750, -7458, -322, -814, -428, -885,
+ -3613, -184, -751, -1551, 292, 1194, 2465, 512,
+ 4035, 5619, 4618, 1815, 1912, -994, -1927, -1301,
+ -201, -223, -1384, -1137, -1583, -447, -622, -511,
+ -471, -656, -539, -211, -2131, 2754, -4501, 12879,
+ 7432, -277, -463, -1236, -10124, -3371, 358, -585,
+ 756, 1675, -2165, 3538, 967, -1249, 2042, -5842,
+ 5618, -515, 3219, -4149, 4857, -1926, -16, -632,
+ -1050, -1440, 176, -1104, 101, 1422, -130, 815,
+ -1666, 152, -954, 1230, 1838, -1709, 1139, 16867,
+ 716, -206, -178, -79, -17366, -31, 191, -127,
+ 118, -1892, 1759, -1173, -80, 74, -49, -737,
+ 1978, -3845, 10050, 11854, -2492, -238, -902, -6164,
+ -8576, -379, 464, -1213, 2358, -1431, 2782, -7271,
+ 301, -585, 1529, 1803, -2600, 11246, 11289, -3647,
+ 1463, -412, -7720, -7778, -812, -130, 1784, 1791,
+ -7749, -578, 2504, 2513, 232, -1004, -1008, 325,
+ 3442, 907, 2725, 8970, 3638, -723, -50, -453,
+ -4911, -808, -190, -572, -150, -1884, -496, -1492,
+ -764, -201, -605, -1992, -126, 17498, 3481, -2003,
+ 1090, 0, -18689, -739, -244, -72, 135, 26,
+ -3717, -15, 2139, 425, 8, -1165, -231, 133,
+ -1814, 1048, -2164, 4070, 16272, -200, -67, -285,
+ -1011, -16160, 116, -239, 138, 450, -260, 537,
+ 1801, -1041, 2149, -4042, 9354, 12580, -1883, 962,
+ -617, -5341, -9660, -216, -56, -23, -7183, 1075,
+ 1446, -549, -738, 110, 352, 474, -71, 36,
+ 1708, 4199, 7387, 6335, 1003, -178, -1076, -3330,
+ -2449, -61, -437, -770, -1893, -660, -1623, -2856,
+ -104, -257, -452, -388, -2624, 5623, 17310, -2353,
+ 592, -420, -1930, -18288, -338, -21, 900, 2772,
+ -5941, -376, 807, 2486, 94, -203, -625, 85,
+ 1211, -850, 1193, -1926, 15992, -89, -44, -86,
+ -226, -15609, 62, -88, 61, 142, -100, 140,
+ -1182, 830, -1165, 1880, 3983, -2054, 11506, -19,
+ 3622, -968, -257, -8080, 0, -801, 499, -2797,
+ 1442, 4, -2, 13, -880, 454, -2544, 4,
+ -786, -1354, 16092, 7246, -1665, -37, -111, -15805,
+ -3205, -169, -65, 772, 1330, 348, 599, -7117,
+ -80, -137, 1636, 736, -4316, -511, 6674, 11665,
+ 4633, -1137, -15, -2719, -8305, -1310, -134, 1758,
+ 208, 3073, 364, -4752, 1220, 144, -1887, -3299,
+ 7912, 4557, 1937, 1885, 7037, -3821, -1267, -229,
+ -216, -3022, -2200, -935, -538, -910, -524, -222,
+ -3398, -1957, -832, -809, 3434, 2967, 5867, 8196,
+ 8766, -720, -537, -2101, -4100, -4690, -622, -1230,
+ -1062, -1718, -1484, -2935, -1837, -1588, -3139, -4385,
+ 5881, 9176, 8119, 3934, 3355, -2111, -5139, -4023,
+ -944, -687, -3294, -2914, -4547, -1412, -2203, -1949,
+ -1204, -1879, -1662, -805
+};
+
+static const int16_t adaptive_cb_gain170[170 * 20] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 776, 212, 715, 670,
+ 809, -36, -2, -31, -27, -39, -10, -33,
+ -9, -31, -8, -29, -38, -10, -35, -33,
+ 1296, 1316, -168, -320, -815, -102, -105, -1,
+ -6, -40, -104, 13, 13, 25, 25, -3,
+ 64, 65, -8, -15, -589, 680, 2478, 308,
+ -596, -21, -28, -375, -5, -21, 24, 89,
+ -102, 11, -12, -46, -21, 24, 90, 11,
+ -735, -487, -5, 2948, 468, -33, -14, 0,
+ -530, -13, -21, 0, 0, 132, 87, 0,
+ 21, 13, 0, -84, 1042, 1730, 1068, 333,
+ 626, -66, -182, -69, -6, -23, -110, -67,
+ -112, -21, -35, -21, -39, -66, -40, -12,
+ 486, -769, 4074, 2825, -1107, -14, -36, -1013,
+ -487, -74, 22, -120, 191, -83, 132, -702,
+ 32, -52, 275, 191, 1521, -767, -124, 4320,
+ 1026, -141, -35, 0, -1139, -64, 71, 11,
+ -5, -401, 202, 32, -95, 48, 7, -270,
+ 2425, 1267, 3439, -91, -1166, -359, -98, -722,
+ 0, -83, -187, -509, -266, 13, 7, 19,
+ 172, 90, 244, -6, -1251, 975, 173, 4039,
+ 2005, -95, -58, -1, -996, -245, 74, 13,
+ -10, 308, -240, -42, 153, -119, -21, -494,
+ 1820, 632, 1322, 2062, 1031, -202, -24, -106,
+ -259, -64, -70, -146, -51, -229, -79, -166,
+ -114, -39, -83, -129, -447, 4904, 244, -315,
+ -2038, -12, -1467, -3, -6, -253, 134, 6,
+ -73, -8, 94, 4, -55, 610, 30, -39,
+ -208, -1102, 463, -448, 5653, -2, -74, -13,
+ -12, -1950, -14, 5, 31, -5, -30, 12,
+ 71, 380, -159, 154, 4739, 2600, -1864, 856,
+ -1554, -1371, -412, -212, -44, -147, -752, 539,
+ 295, -247, -135, 97, 449, 246, -176, 81,
+ 1894, 3533, 35, -26, 2145, -219, -762, 0,
+ 0, -280, -408, -4, -7, 3, 5, 0,
+ -248, -462, -4, 3, -2699, 1841, 4072, 2443,
+ 1582, -444, -207, -1012, -364, -152, 303, 670,
+ -457, 402, -274, -607, 260, -177, -393, -236,
+ -844, 3358, 6106, -1059, -537, -43, -688, -2275,
+ -68, -17, 173, 314, -1251, -54, 217, 395,
+ -27, 110, 200, -34, 1251, 1016, 3020, 2210,
+ 1445, -95, -63, -556, -298, -127, -77, -230,
+ -187, -168, -137, -407, -110, -89, -266, -194,
+ 2099, 2277, 4038, 3533, -2870, -269, -316, -995,
+ -762, -503, -291, -517, -561, -452, -491, -871,
+ 367, 399, 707, 619, 400, -1114, 8516, 2422,
+ -1117, -9, -75, -4426, -358, -76, 27, -208,
+ 579, -59, 164, -1259, 27, -75, 580, 165,
+ -4398, -2011, 3912, -2407, 2258, -1180, -247, -934,
+ -353, -311, -540, 1050, 480, -646, -295, 575,
+ 606, 277, -539, 331, 1767, -1447, 4240, 6160,
+ -757, -190, -127, -1097, -2316, -35, 156, -457,
+ 374, -664, 544, -1594, 81, -66, 195, 284,
+ 1594, -1463, 1035, 6938, 1920, -155, -130, -65,
+ -2938, -225, 142, -100, 92, -675, 619, -438,
+ -186, 171, -121, -813, -562, 4716, 4085, -591,
+ 2421, -19, -1357, -1018, -21, -357, 162, 140,
+ -1175, -20, 170, 147, 83, -696, -603, 87,
+ 1552, 8778, -935, 354, -1424, -147, -4703, -53,
+ -7, -123, -831, 88, 501, -33, -189, 20,
+ 134, 763, -81, 30, 4831, -4431, 41, -1479,
+ -2976, -1424, -1198, 0, -133, -540, 1306, -12,
+ 11, 436, -400, 3, 877, -804, 7, -268,
+ 2090, 1192, 1006, 1645, 4853, -266, -86, -61,
+ -165, -1437, -152, -128, -73, -210, -119, -101,
+ -619, -353, -298, -487, 2386, 5712, 1426, -94,
+ 1350, -347, -1991, -124, 0, -111, -832, -207,
+ -497, 13, 32, 8, -196, -470, -117, 7,
+ -1349, 1091, 1659, 8891, 313, -111, -72, -168,
+ -4825, -5, 89, 136, -110, 732, -592, -900,
+ 25, -20, -31, -170, 9980, 916, -381, -808,
+ 88, -6080, -51, -8, -39, 0, -558, 232,
+ 21, 492, 45, -18, -53, -4, 2, 4,
+ 2338, -1031, -248, 3928, 6484, -333, -64, -3,
+ -942, -2566, 147, 35, -15, -560, 247, 59,
+ -925, 408, 98, -1555, 6166, -1240, -337, 3672,
+ -1277, -2320, -93, -6, -823, -99, 466, 126,
+ -25, -1382, 278, 75, 480, -96, -26, 286,
+ 4377, -132, -2588, 1701, 4865, -1169, -1, -409,
+ -176, -1444, 35, 691, -20, -454, 13, 268,
+ -1299, 39, 768, -505, 2594, 3295, 3944, 1481,
+ 682, -410, -662, -949, -133, -28, -521, -624,
+ -793, -234, -297, -356, -108, -137, -164, -61,
+ 4151, 624, 815, 4485, 2229, -1052, -23, -40,
+ -1228, -303, -158, -206, -31, -1136, -170, -223,
+ -565, -84, -111, -610, -3575, -361, 4924, 2791,
+ 4698, -780, -7, -1480, -475, -1347, -78, 1074,
+ 108, 609, 61, -839, 1025, 103, -1412, -800,
+ -2518, 3791, 8623, 315, 2465, -387, -877, -4538,
+ -6, -370, 582, 1325, -1995, 48, -73, -166,
+ 378, -570, -1297, -47, -691, 2989, 9957, -421,
+ -1142, -29, -545, -6051, -10, -79, 126, 420,
+ -1817, -17, 76, 256, -48, 208, 694, -29,
+ -1918, 104, -3190, -3410, -4440, -224, 0, -621,
+ -709, -1203, 12, -373, 20, -399, 21, -664,
+ -519, 28, -864, -924, -3359, -1668, 1854, 6939,
+ 1430, -688, -169, -209, -2939, -124, -341, 380,
+ 188, 1422, 706, -785, 293, 145, -161, -606,
+ 42, 9706, 3164, -952, 907, 0, -5750, -611,
+ -55, -50, -25, -8, -1874, 2, 564, 183,
+ -2, -537, -175, 52, 1607, 785, 2862, 4327,
+ 3307, -157, -37, -500, -1143, -667, -77, -280,
+ -137, -424, -207, -756, -324, -158, -577, -873,
+ 6801, 3416, 2227, 1682, -3217, -2823, -712, -302,
+ -172, -631, -1418, -924, -464, -698, -350, -228,
+ 1335, 670, 437, 330, 3459, 3898, 364, 7841,
+ -2640, -730, -927, -8, -3753, -425, -823, -76,
+ -86, -1655, -1865, -174, 557, 628, 58, 1263,
+ -5902, -3458, -2465, -1886, 4334, -2126, -730, -371,
+ -217, -1146, -1245, -888, -520, -679, -398, -283,
+ 1561, 915, 652, 499, -3710, 1133, 7849, 3443,
+ -215, -840, -78, -3760, -723, -2, 256, 1777,
+ -543, 779, -238, -1649, -48, 14, 103, 45,
+ 4132, 2828, 2, -4212, -4116, -1042, -488, 0,
+ -1083, -1034, -713, 0, 0, 1062, 727, 0,
+ 1038, 710, 0, -1058, 5875, 8496, -1796, 1376,
+ -1786, -2107, -4406, -197, -115, -194, -3047, 644,
+ 931, -493, -713, 150, 640, 926, -195, 150,
+ 3143, 3483, 3546, -793, 4489, -603, -740, -767,
+ -38, -1230, -668, -680, -754, 152, 168, 171,
+ -861, -954, -971, 217, 2845, 7965, 3695, -5432,
+ 3978, -494, -3873, -833, -1801, -966, -1383, -641,
+ -1796, 943, 2641, 1225, -691, -1934, -897, 1319,
+ 1538, 150, 7139, 2049, 3097, -144, -1, -3110,
+ -256, -585, -14, -670, -65, -192, -18, -892,
+ -290, -28, -1349, -387, 618, 7520, 4729, -238,
+ -3373, -23, -3452, -1365, -3, -694, -283, -178,
+ -2170, 8, 109, 68, 127, 1548, 973, -49,
+ 2965, -3013, 7912, 7076, -1997, -536, -554, -3821,
+ -3056, -243, 545, -1431, 1455, -1280, 1301, -3417,
+ 361, -367, 964, 862, 2443, -929, -1113, 9677,
+ 4138, -364, -52, -75, -5716, -1045, 138, 166,
+ -63, -1443, 549, 657, -617, 234, 281, -2444,
+ 1966, 3309, 10085, -3399, 2105, -236, -668, -6207,
+ -705, -270, -397, -1210, -2037, 408, 686, 2092,
+ -252, -425, -1295, 436, -112, -1368, 8868, 4822,
+ 2048, 0, -114, -4800, -1419, -256, -9, 61,
+ 740, 33, 402, -2610, 14, 171, -1108, -602,
+ -2597, 438, -1839, 6229, 7266, -411, -11, -206,
+ -2368, -3223, 69, -291, 49, 987, -166, 699,
+ 1152, -194, 816, -2763, 3454, 553, 9127, 4946,
+ -5596, -728, -18, -5084, -1493, -1911, -116, -1924,
+ -308, -1042, -166, -2755, 1179, 188, 3117, 1689,
+ -532, -663, 12262, 2495, -1004, -17, -26, -9177,
+ -380, -61, -21, 398, 496, 81, 101, -1867,
+ -32, -40, 751, 152, -2100, 1317, -1509, 11425,
+ 2997, -269, -105, -139, -7967, -548, 168, -193,
+ 121, 1464, -918, 1052, 384, -240, 276, -2090,
+ 1193, -2697, 11259, 5373, -763, -86, -444, -7737,
+ -1762, -35, 196, -819, 1853, -391, 884, -3692,
+ 55, -125, 525, 250, 2405, -471, 11079, 203,
+ 782, -353, -13, -7491, -2, -37, 69, -1626,
+ 318, -29, 5, -137, -114, 22, -529, -9,
+ -1871, 5685, 11290, -2662, 1353, -213, -1972, -7780,
+ -432, -111, 649, 1289, -3917, -304, 923, 1834,
+ 154, -469, -932, 220, -3768, 5927, -3093, 5041,
+ 5212, -866, -2144, -584, -1551, -1658, 1363, -711,
+ 1119, 1159, -1824, 951, 1198, -1885, 984, -1603,
+ -2546, 9502, 5969, -2440, 1928, -395, -5511, -2175,
+ -363, -226, 1477, 927, -3462, -379, 1415, 889,
+ 299, -1118, -702, 287, -4963, 3568, 4592, 5508,
+ 3451, -1503, -777, -1287, -1851, -727, 1080, 1391,
+ -1000, 1668, -1199, -1543, 1045, -751, -967, -1160,
+ 1745, -2586, 3983, 10899, -1551, -186, -408, -968,
+ -7250, -146, 275, -424, 628, -1161, 1720, -2649,
+ 165, -244, 377, 1032, 867, -456, -727, 3369,
+ 11822, -45, -12, -32, -692, -8531, 24, 38,
+ -20, -178, 93, 149, -625, 329, 525, -2431,
+ 7535, 2422, 1926, 1405, 1599, -3466, -358, -226,
+ -120, -156, -1114, -886, -284, -646, -207, -165,
+ -735, -236, -188, -137, 1041, -735, -142, 13209,
+ 1515, -66, -33, -1, -10649, -140, 46, 9,
+ -6, -839, 593, 114, -96, 68, 13, -1222,
+ 7950, 6745, -1444, -1008, 2721, -3857, -2777, -127,
+ -62, -452, -3273, 700, 594, 489, 415, -88,
+ -1320, -1120, 239, 167, -4754, -1379, 4522, -578,
+ -5733, -1379, -116, -1248, -20, -2006, -400, 1312,
+ 380, -167, -48, 159, -1663, -482, 1582, -202,
+ 3220, 5978, 5923, 2430, -2689, -633, -2181, -2141,
+ -360, -441, -1175, -1164, -2161, -477, -886, -878,
+ 528, 981, 972, 398, 377, 1312, 13978, -1470,
+ 677, -8, -105, -11925, -132, -28, -30, -321,
+ -1119, 33, 117, 1254, -15, -54, -577, 60,
+ -3435, 6770, 314, -885, 5686, -720, -2797, -6,
+ -47, -1973, 1419, 65, -129, -185, 366, 16,
+ 1192, -2349, -109, 307, 3171, 8774, -2260, 2679,
+ 3069, -613, -4699, -312, -438, -575, -1698, 437,
+ 1210, -518, -1435, 369, -594, -1643, 423, -501,
+ 5557, 1509, 5407, -125, -7386, -1884, -139, -1784,
+ 0, -3330, -511, -1834, -498, 42, 11, 41,
+ 2505, 680, 2438, -56, -2838, 2595, 13228, 271,
+ 1793, -491, -411, -10680, -4, -196, 449, 2291,
+ -2095, 47, -42, -219, 310, -284, -1447, -29,
+ 664, -278, 14966, 951, -711, -26, -4, -13672,
+ -55, -30, 11, -606, 253, -38, 16, -869,
+ 28, -12, 650, 41, 808, 1770, 8658, 5863,
+ -1486, -39, -191, -4576, -2098, -134, -87, -427,
+ -935, -289, -633, -3098, 73, 160, 785, 531,
+ 3063, 1539, 2000, -542, 9576, -572, -144, -244,
+ -17, -5597, -287, -374, -188, 101, 51, 66,
+ -1790, -900, -1169, 317, 514, 14083, -323, 896,
+ -891, -16, -12106, -6, -49, -48, -442, 10,
+ 277, -28, -770, 17, 27, 766, -17, 48,
+ 892, 158, 5237, 11057, -1603, -48, -1, -1674,
+ -7462, -156, -8, -285, -50, -602, -106, -3534,
+ 87, 15, 512, 1082, -1612, 2564, -4296, 12526,
+ 5710, -158, -401, -1126, -9576, -1990, 252, -422,
+ 672, 1232, -1960, 3284, 561, -893, 1497, -4365,
+ 4889, -6878, 612, 6109, 4753, -1459, -2887, -22,
+ -2277, -1379, 2052, -182, 257, -1823, 2564, -228,
+ -1418, 1995, -177, -1772, 3053, -506, 2403, 9625,
+ 1322, -569, -15, -352, -5655, -106, 94, -448,
+ 74, -1794, 297, -1412, -246, 40, -194, -777,
+ -754, 12904, 4480, -2113, 1471, -34, -10163, -1225,
+ -272, -132, 594, 206, -3529, -97, 1664, 577,
+ 67, -1159, -402, 189, 4255, 1476, 5055, 2393,
+ 2912, -1105, -132, -1559, -349, -517, -383, -1313,
+ -455, -621, -215, -738, -756, -262, -898, -425,
+ -1371, 535, 1417, 14604, -997, -114, -17, -122,
+ -13017, -60, 44, 118, -46, 1222, -477, -1263,
+ -83, 32, 86, 888, 5368, -1744, 4083, -1236,
+ 3753, -1758, -185, -1017, -93, -860, 571, -1338,
+ 434, 405, -131, 308, -1229, 399, -935, 283,
+ 1588, -3097, 14415, 3699, -1171, -154, -585, -12683,
+ -835, -83, 300, -1397, 2725, -358, 699, -3255,
+ 113, -221, 1030, 264, 212, 7989, 9471, -3344,
+ 2009, -2, -3895, -5475, -682, -246, -103, -123,
+ -4618, 43, 1630, 1933, -26, -979, -1161, 410,
+ 856, 2294, -627, 6930, 6929, -44, -321, -24,
+ -2931, -2930, -119, 32, 87, -362, -970, 265,
+ -362, -970, 265, -2931, 2357, -4187, 7162, 7683,
+ 3371, -339, -1070, -3131, -3603, -693, 602, -1030,
+ 1830, -1105, 1963, -3359, -485, 861, -1474, -1581,
+ 350, 4585, 14053, -3819, 1218, -7, -1283, -12054,
+ -890, -90, -97, -300, -3933, 81, 1068, 3275,
+ -26, -341, -1045, 284, -3248, 3531, 475, 2137,
+ 11711, -644, -761, -13, -278, -8372, 700, 94,
+ -102, 423, -460, -62, 2322, -2524, -340, -1528,
+ -3017, 3852, 1725, 8440, 5257, -555, -905, -181,
+ -4348, -1686, 709, 317, -405, 1554, -1984, -889,
+ 968, -1236, -553, -2708, -909, 3196, 15512, -2528,
+ 1066, -50, -623, -14686, -390, -69, 177, 861,
+ -3026, -140, 493, 2393, 59, -208, -1009, 164,
+ 959, -3370, 9617, 9545, -1761, -56, -693, -5645,
+ -5561, -189, 197, -563, 1978, -558, 1963, -5603,
+ 103, -362, 1034, 1026, 7575, 11796, -4845, 3252,
+ -1703, -3502, -8493, -1433, -645, -177, -5454, 2240,
+ 3488, -1503, -2341, 961, 787, 1226, -503, 338,
+ 6409, 1722, 1764, -4191, 6015, -2507, -181, -189,
+ -1072, -2208, -673, -690, -185, 1639, 440, 451,
+ -2353, -632, -647, 1538, -2420, 12161, 5038, 1286,
+ -2098, -357, -9027, -1549, -100, -268, 1796, 744,
+ -3740, 190, -954, -395, -310, 1557, 645, 164,
+ -2232, -1341, 7246, 9470, -1977, -304, -109, -3204,
+ -5474, -238, -182, 987, 593, 1290, 775, -4188,
+ -269, -161, 874, 1143, 1030, 7034, 4231, 1551,
+ 3077, -64, -3019, -1093, -146, -577, -442, -266,
+ -1816, -97, -666, -400, -193, -1321, -794, -291,
+ 5121, 11835, -477, -1749, 2298, -1601, -8549, -13,
+ -186, -322, -3699, 149, 344, 546, 1264, -50,
+ -718, -1660, 66, 245, -3328, 3827, 5921, 9976,
+ -1045, -676, -894, -2140, -6075, -66, 777, 1203,
+ -1383, 2027, -2330, -3605, -212, 244, 377, 636,
+ 3813, 5718, -4666, -3412, 5674, -887, -1995, -1329,
+ -710, -1965, -1331, 1086, 1628, 794, 1191, -972,
+ -1320, -1980, 1616, 1181, 1348, -3672, 13154, 6938,
+ -1690, -110, -823, -10561, -2938, -174, 302, -1082,
+ 2948, -570, 1555, -5570, 139, -379, 1357, 716,
+ 2151, -3586, 6949, 12131, -1224, -282, -785, -2947,
+ -8982, -91, 470, -912, 1521, -1592, 2655, -5145,
+ 160, -268, 519, 906, -2889, 9647, 10276, -2728,
+ 995, -509, -5680, -6445, -454, -60, 1701, 1812,
+ -6051, -481, 1606, 1711, 175, -586, -624, 165,
+ 6177, 2184, 555, 1985, 6589, -2329, -291, -18,
+ -240, -2650, -823, -209, -74, -748, -264, -67,
+ -2484, -878, -223, -798, -492, 391, 17166, -681,
+ 240, -14, -9, -17987, -28, -3, 11, 515,
+ -410, -20, 16, 713, 7, -5, -252, 10,
+ 12628, 5448, -2630, 3011, -2695, -9733, -1811, -422,
+ -553, -443, -4199, 2027, 874, -2321, -1001, 483,
+ 2077, 896, -432, 495, -3628, -534, 3447, 7002,
+ 6751, -803, -17, -725, -2992, -2782, -118, 763,
+ 112, 1550, 228, -1473, 1495, 220, -1420, -2885,
+ -5239, 5901, 8107, 3650, 4846, -1675, -2125, -4012,
+ -813, -1433, 1887, 2592, -2920, 1167, -1315, -1806,
+ 1550, -1745, -2398, -1080, 6157, 6678, 4099, -1074,
+ 2348, -2314, -2722, -1025, -70, -336, -2509, -1540,
+ -1670, 403, 437, 268, -882, -957, -587, 153,
+ 1079, 16099, 242, -881, 1690, -71, -15820, -3,
+ -47, -174, -1060, -16, -238, 58, 865, 13,
+ -111, -1661, -25, 90, -278, 227, -1039, 1636,
+ 16945, -4, -3, -65, -163, -17526, 3, -17,
+ 14, 27, -22, 103, 287, -234, 1074, -1693,
+ 15778, -1454, 574, -603, -107, -15195, -129, -20,
+ -22, 0, 1400, -553, 51, 581, -53, 21,
+ 103, -9, 3, -3, 2406, -836, 13224, 7993,
+ -4266, -353, -42, -10673, -3899, -1111, 122, -1942,
+ 674, -1174, 407, -6451, 626, -217, 3443, 2081,
+ 3184, 14368, -3336, 2255, -1801, -619, -12600, -679,
+ -310, -198, -2793, 648, 2926, -438, -1977, 459,
+ 350, 1580, -366, 247, -1698, 17076, 2504, -539,
+ -646, -176, -17798, -382, -17, -25, 1770, 259,
+ -2610, -55, 561, 82, -67, 673, 98, -21,
+ 2375, -797, -2696, 14483, 5383, -344, -38, -443,
+ -12803, -1769, 115, 391, -131, -2100, 705, 2384,
+ -780, 262, 886, -4759, -2691, 2554, -4520, 9573,
+ 10655, -442, -398, -1247, -5594, -6930, 419, -742,
+ 704, 1572, -1492, 2641, 1750, -1661, 2939, -6226,
+ -4332, -4399, -1657, 4880, 7375, -1145, -1181, -167,
+ -1453, -3319, -1163, -438, -444, 1290, 1310, 493,
+ 1950, 1980, 745, -2196, -3498, 7405, 9955, 2693,
+ -2971, -746, -3347, -6049, -442, -538, 1581, 2125,
+ -4499, 575, -1217, -1636, -634, 1342, 1805, 488,
+ 6717, -3792, 7739, 2798, 3489, -2754, -877, -3655,
+ -477, -743, 1554, -3173, 1791, -1147, 647, -1321,
+ -1430, 807, -1648, -595, 5263, 9770, 3463, 1069,
+ -3971, -1690, -5826, -732, -69, -962, -3138, -1112,
+ -2065, -343, -637, -226, 1275, 2368, 839, 259,
+ 1243, -2634, 16772, 1871, 332, -94, -423, -17169,
+ -213, -6, 199, -1273, 2696, -142, 300, -1915,
+ -25, 53, -339, -37, 2691, 2836, 3105, 5711,
+ 4817, -442, -491, -588, -1991, -1416, -465, -510,
+ -537, -938, -988, -1082, -791, -834, -913, -1679,
+ 4366, 2944, 7210, 3627, 1161, -1163, -529, -3172,
+ -803, -82, -784, -1921, -1295, -966, -651, -1596,
+ -309, -208, -511, -257, 13888, 3951, -671, -2305,
+ 3354, -11773, -953, -27, -324, -686, -3349, 569,
+ 161, 1954, 556, -94, -2843, -809, 137, 472,
+ 7053, 5847, 2929, 8378, -4794, -3036, -2086, -523,
+ -4284, -1403, -2517, -1261, -1045, -3607, -2990, -1498,
+ 2064, 1711, 857, 2451, -2191, 12838, 9182, -3915,
+ 1617, -293, -10059, -5146, -935, -159, 1717, 1228,
+ -7195, -523, 3068, 2194, 216, -1267, -906, 386,
+ -4881, 13114, 5767, -435, 4155, -1454, -10498, -2030,
+ -11, -1054, 3907, 1718, -4616, -129, 348, 153,
+ 1238, -3326, -1462, 110, 7843, -1250, 210, 7106,
+ -5203, -3754, -95, -2, -3082, -1652, 598, -100,
+ 16, -3402, 542, -91, 2491, -397, 66, 2257,
+ -2463, 8168, 14551, -3908, 1828, -370, -4072, -12923,
+ -932, -204, 1228, 2188, -7254, -587, 1948, 3471,
+ 274, -911, -1623, 436, -1579, 347, -272, -2735,
+ 16031, -152, -7, -4, -456, -15686, 33, -26,
+ 5, -263, 58, -45, 1545, -340, 266, 2676,
+ -6327, 1328, 5093, -5079, 7617, -2443, -107, -1583,
+ -1574, -3541, 513, 1967, -413, -1961, 411, 1578,
+ 2941, -617, -2367, 2361, 3286, -4509, 11306, 11025,
+ -2623, -659, -1241, -7802, -7419, -420, 904, -2267,
+ 3112, -2211, 3034, -7608, 526, -722, 1810, 1765,
+ 5567, 17853, -3754, 1166, -519, -1892, -19455, -860,
+ -83, -16, -6067, 1275, 4090, -396, -1271, 267,
+ 176, 566, -119, 37, -2136, -424, 15292, 5108,
+ -1648, -278, -10, -14273, -1593, -165, -55, 1993,
+ 396, 666, 132, -4768, -214, -42, 1538, 514,
+ 2267, -3297, 2549, 16563, -791, -313, -663, -396,
+ -16745, -38, 456, -352, 513, -2291, 3333, -2576,
+ 109, -159, 123, 799, 3655, 1899, -3364, 6279,
+ 12510, -815, -220, -690, -2406, -9552, -423, 750,
+ 390, -1400, -728, 1289, -2791, -1450, 2568, -4794,
+ 8052, 2285, -6193, 5138, 6003, -3957, -318, -2341,
+ -1611, -2199, -1123, 3044, 864, -2525, -716, 1942,
+ -2950, -837, 2269, -1882, -386, -2291, 7679, 15387,
+ -2723, -9, -320, -3599, -14452, -452, -54, 181,
+ 1074, 362, 2152, -7212, -64, -380, 1276, 2557,
+ 2777, -1173, 3984, 13079, 2508, -470, -84, -969,
+ -10440, -384, 198, -675, 285, -2217, 936, -3180,
+ -425, 179, -610, -2002, -1879, 1771, -2684, 16705,
+ 1833, -215, -191, -439, -17032, -205, 203, -308,
+ 290, 1916, -1805, 2736, 210, -198, 300, -1869,
+ 1052, 4495, 15519, 1467, -4032, -67, -1233, -14700,
+ -131, -992, -288, -997, -4257, -94, -402, -1389,
+ 259, 1106, 3819, 361, 3010, 2544, 6969, 7559,
+ 1996, -553, -395, -2964, -3487, -243, -467, -1280,
+ -1082, -1388, -1174, -3215, -366, -310, -849, -921,
+ -5209, -1867, 8713, 10351, 1549, -1656, -212, -4634,
+ -6540, -146, -593, 2770, 993, 3291, 1180, -5505,
+ 492, 176, -824, -979, -4314, 8513, 913, 7547,
+ -2723, -1135, -4423, -50, -3476, -452, 2241, 240,
+ -474, 1987, -3921, -420, -717, 1415, 151, 1254,
+ 12929, -1219, 2448, 1757, 6303, -10204, -90, -365,
+ -188, -2425, 962, -1932, 182, -1386, 130, -262,
+ -4974, 469, -941, -676, 6465, 4132, 3167, 3160,
+ 5697, -2551, -1042, -612, -609, -1981, -1630, -1249,
+ -798, -1247, -797, -611, -2248, -1437, -1101, -1099,
+ -3636, 4859, 18914, -1335, 810, -807, -1441, -21836,
+ -108, -40, 1078, 4198, -5609, -296, 396, 1541,
+ 179, -240, -936, 66, 8844, 7864, 654, -4063,
+ -5680, -4774, -3774, -26, -1007, -1969, -4245, -353,
+ -314, 2193, 1950, 162, 3066, 2726, 226, -1408,
+ 1859, 2634, 9228, 996, 9464, -211, -423, -5197,
+ -60, -5467, -299, -1047, -1483, -113, -160, -561,
+ -1074, -1521, -5330, -575, 2949, 12260, 10290, -497,
+ -3943, -530, -9174, -6463, -15, -949, -2206, -1852,
+ -7700, 89, 372, 312, 709, 2950, 2476, -119,
+ -2903, 1552, 14867, 9970, -496, -514, -147, -13491,
+ -6068, -15, 275, 2634, -1408, 1766, -944, -9047,
+ -87, 47, 450, 302, 3243, 8234, 7586, 3373,
+ 2151, -642, -4138, -3512, -694, -282, -1630, -1501,
+ -3812, -667, -1695, -1561, -425, -1081, -996, -442,
+ -9631, 60, 3501, 5359, 10150, -5662, 0, -748,
+ -1752, -6288, 35, 2058, -12, 3150, -19, -1145,
+ 5967, -37, -2169, -3320, -6874, -2553, -5446, -2195,
+ -7841, -2884, -397, -1810, -294, -3753, -1071, -2285,
+ -848, -921, -342, -729, -3290, -1221, -2606, -1050,
+ -3413, -1141, 4630, 13612, 7897, -711, -79, -1308,
+ -11310, -3806, -237, 964, 322, 2836, 948, -3847,
+ 1645, 550, -2231, -6561, 4410, -5678, 8006, -3992,
+ 3811, -1187, -1968, -3912, -973, -886, 1528, -2155,
+ 2775, 1074, -1383, 1951, -1025, 1321, -1862, 928,
+ 5659, 11535, 2203, -452, 7169, -1954, -8121, -296,
+ -12, -3137, -3984, -761, -1551, 156, 318, 60,
+ -2476, -5048, -964, 197, 2914, -2914, 3485, -3965,
+ 13675, -518, -518, -741, -959, -11414, 518, -620,
+ 620, 705, -705, 843, -2433, 2432, -2909, 3310,
+ 7843, 1907, 1022, 8882, 7972, -3755, -222, -63,
+ -4815, -3879, -913, -489, -119, -4252, -1034, -554,
+ -3816, -928, -497, -4322, 13807, 9531, 1436, 1612,
+ 1779, -11636, -5544, -125, -158, -193, -8032, -1210,
+ -835, -1358, -938, -141, -1499, -1035, -156, -175,
+ 13620, -5337, 5450, -2263, 1723, -11322, -1738, -1813,
+ -312, -181, 4436, -4531, 1775, 1881, -737, 752,
+ -1432, 561, -573, 238, 5297, 8374, 8872, 7694,
+ 6538, -1712, -4280, -4804, -3613, -2609, -2707, -2868,
+ -4534, -2487, -3932, -4166, -2113, -3341, -3540, -3070
+};
+
+/* 0.65^i (Zero part) and 0.75^i (Pole part) scaled by 2^15 */
+static const int16_t postfilter_tbl[2][LPC_ORDER] = {
+ /* Zero */
+ { 21299, 13844, 8999, 5849, 3802, 2471, 1606, 1044, 679, 441 },
+ /* Pole */
+ { 24576, 18432, 13824, 10368, 7776, 5832, 4374, 3281, 2460, 1845 }
+};
+
+static const int cng_adaptive_cb_lag[4] = { 1, 0, 1, 3 };
+
+static const int cng_filt[4] = { 273, 998, 499, 333 };
+
+static const int cng_bseg[3] = { 2048, 18432, 231233 };
+
+#endif /* AVCODEC_G723_1_DATA_H */
diff --git a/gst-libs/ext/libav/libavcodec/g726.c b/gst-libs/ext/libav/libavcodec/g726.c
index 85711f8..dbe9e02 100644
--- a/gst-libs/ext/libav/libavcodec/g726.c
+++ b/gst-libs/ext/libav/libavcodec/g726.c
@@ -22,7 +22,9 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <limits.h>
+
#include "libavutil/avassert.h"
+#include "libavutil/channel_layout.h"
#include "libavutil/opt.h"
#include "avcodec.h"
#include "internal.h"
@@ -32,7 +34,7 @@
/**
* G.726 11bit float.
* G.726 Standard uses rather odd 11bit floating point arithmentic for
- * numerous occasions. It's a mistery to me why they did it this way
+ * numerous occasions. It's a mystery to me why they did it this way
* instead of simply using 32bit integer arithmetic.
*/
typedef struct Float11 {
@@ -330,10 +332,12 @@ static av_cold int g726_encode_init(AVCodecContext *avctx)
g726_reset(c);
+#if FF_API_OLD_ENCODE_AUDIO
avctx->coded_frame = avcodec_alloc_frame();
if (!avctx->coded_frame)
return AVERROR(ENOMEM);
avctx->coded_frame->key_frame = 1;
+#endif
/* select a frame size that will end on a byte boundary and have a size of
approximately 1024 bytes */
@@ -342,34 +346,43 @@ static av_cold int g726_encode_init(AVCodecContext *avctx)
return 0;
}
+#if FF_API_OLD_ENCODE_AUDIO
static av_cold int g726_encode_close(AVCodecContext *avctx)
{
av_freep(&avctx->coded_frame);
return 0;
}
+#endif
-static int g726_encode_frame(AVCodecContext *avctx,
- uint8_t *dst, int buf_size, void *data)
+static int g726_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
+ const AVFrame *frame, int *got_packet_ptr)
{
G726Context *c = avctx->priv_data;
- const int16_t *samples = data;
+ const int16_t *samples = (const int16_t *)frame->data[0];
PutBitContext pb;
- int i;
+ int i, ret, out_size;
- init_put_bits(&pb, dst, 1024*1024);
+ out_size = (frame->nb_samples * c->code_size + 7) / 8;
+ if ((ret = ff_alloc_packet(avpkt, out_size))) {
+ av_log(avctx, AV_LOG_ERROR, "Error getting output packet\n");
+ return ret;
+ }
+ init_put_bits(&pb, avpkt->data, avpkt->size);
- for (i = 0; i < avctx->frame_size; i++)
+ for (i = 0; i < frame->nb_samples; i++)
put_bits(&pb, c->code_size, g726_encode(c, *samples++));
flush_put_bits(&pb);
- return put_bits_count(&pb)>>3;
+ avpkt->size = out_size;
+ *got_packet_ptr = 1;
+ return 0;
}
#define OFFSET(x) offsetof(G726Context, x)
#define AE AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
static const AVOption options[] = {
- { "code_size", "Bits per code", OFFSET(code_size), AV_OPT_TYPE_INT, { 4 }, 2, 5, AE },
+ { "code_size", "Bits per code", OFFSET(code_size), AV_OPT_TYPE_INT, { .i64 = 4 }, 2, 5, AE },
{ NULL },
};
@@ -388,14 +401,17 @@ static const AVCodecDefault defaults[] = {
AVCodec ff_adpcm_g726_encoder = {
.name = "g726",
.type = AVMEDIA_TYPE_AUDIO,
- .id = CODEC_ID_ADPCM_G726,
+ .id = AV_CODEC_ID_ADPCM_G726,
.priv_data_size = sizeof(G726Context),
.init = g726_encode_init,
- .encode = g726_encode_frame,
+ .encode2 = g726_encode_frame,
+#if FF_API_OLD_ENCODE_AUDIO
.close = g726_encode_close,
- .capabilities = CODEC_CAP_SMALL_LAST_FRAME,
- .sample_fmts = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_NONE},
- .long_name = NULL_IF_CONFIG_SMALL("G.726 ADPCM"),
+#endif
+ .capabilities = CODEC_CAP_SMALL_LAST_FRAME,
+ .sample_fmts = (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_S16,
+ AV_SAMPLE_FMT_NONE },
+ .long_name = NULL_IF_CONFIG_SMALL("G.726 ADPCM"),
.priv_class = &class,
.defaults = defaults,
};
@@ -406,18 +422,8 @@ static av_cold int g726_decode_init(AVCodecContext *avctx)
{
G726Context* c = avctx->priv_data;
- if (avctx->strict_std_compliance >= FF_COMPLIANCE_STRICT &&
- avctx->sample_rate != 8000) {
- av_log(avctx, AV_LOG_ERROR, "Only 8kHz sample rate is allowed when "
- "the compliance level is strict. Reduce the compliance level "
- "if you wish to decode the stream anyway.\n");
- return AVERROR(EINVAL);
- }
-
- if(avctx->channels != 1){
- av_log(avctx, AV_LOG_ERROR, "Only mono is supported\n");
- return AVERROR(EINVAL);
- }
+ avctx->channels = 1;
+ avctx->channel_layout = AV_CH_LAYOUT_MONO;
c->code_size = avctx->bits_per_coded_sample;
if (c->code_size < 2 || c->code_size > 5) {
@@ -448,7 +454,7 @@ static int g726_decode_frame(AVCodecContext *avctx, void *data,
/* get output buffer */
c->frame.nb_samples = out_samples;
- if ((ret = avctx->get_buffer(avctx, &c->frame)) < 0) {
+ if ((ret = ff_get_buffer(avctx, &c->frame)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return ret;
}
@@ -477,12 +483,12 @@ static void g726_decode_flush(AVCodecContext *avctx)
AVCodec ff_adpcm_g726_decoder = {
.name = "g726",
.type = AVMEDIA_TYPE_AUDIO,
- .id = CODEC_ID_ADPCM_G726,
+ .id = AV_CODEC_ID_ADPCM_G726,
.priv_data_size = sizeof(G726Context),
.init = g726_decode_init,
.decode = g726_decode_frame,
.flush = g726_decode_flush,
.capabilities = CODEC_CAP_DR1,
- .long_name = NULL_IF_CONFIG_SMALL("G.726 ADPCM"),
+ .long_name = NULL_IF_CONFIG_SMALL("G.726 ADPCM"),
};
#endif
diff --git a/gst-libs/ext/libav/libavcodec/get_bits.h b/gst-libs/ext/libav/libavcodec/get_bits.h
index dc348c7..ffa0656 100644
--- a/gst-libs/ext/libav/libavcodec/get_bits.h
+++ b/gst-libs/ext/libav/libavcodec/get_bits.h
@@ -313,6 +313,24 @@ static inline unsigned int get_bits_long(GetBitContext *s, int n)
}
}
+/*
+ * Read 0-64 bits.
+ */
+static inline uint64_t get_bits64(GetBitContext *s, int n)
+{
+ if (n <= 32) {
+ return get_bits_long(s, n);
+ } else {
+#ifdef BITSTREAM_READER_LE
+ uint64_t ret = get_bits_long(s, 32);
+ return ret | (uint64_t)get_bits_long(s, n - 32) << 32;
+#else
+ uint64_t ret = (uint64_t)get_bits_long(s, n - 32) << 32;
+ return ret | get_bits_long(s, 32);
+#endif
+ }
+}
+
/**
* Read 0-32 bits as a signed integer.
*/
@@ -357,7 +375,7 @@ static inline int init_get_bits(GetBitContext *s, const uint8_t *buffer,
int buffer_size;
int ret = 0;
- if (bit_size > INT_MAX - 7 || bit_size <= 0) {
+ if (bit_size > INT_MAX - 7 || bit_size < 0 || !buffer) {
buffer_size = bit_size = 0;
buffer = NULL;
ret = AVERROR_INVALIDDATA;
@@ -375,6 +393,22 @@ static inline int init_get_bits(GetBitContext *s, const uint8_t *buffer,
return ret;
}
+/**
+ * Initialize GetBitContext.
+ * @param buffer bitstream buffer, must be FF_INPUT_BUFFER_PADDING_SIZE bytes
+ * larger than the actual read bits because some optimized bitstream
+ * readers read 32 or 64 bit at once and could read over the end
+ * @param byte_size the size of the buffer in bytes
+ * @return 0 on success, AVERROR_INVALIDDATA if the buffer_size would overflow.
+ */
+static inline int init_get_bits8(GetBitContext *s, const uint8_t *buffer,
+ int byte_size)
+{
+ if (byte_size > INT_MAX / 8)
+ return AVERROR_INVALIDDATA;
+ return init_get_bits(s, buffer, byte_size * 8);
+}
+
static inline void align_get_bits(GetBitContext *s)
{
int n = -get_bits_count(s) & 7;
@@ -529,7 +563,7 @@ static inline void print_bin(int bits, int n)
av_log(NULL, AV_LOG_DEBUG, " ");
}
-static inline int get_bits_trace(GetBitContext *s, int n, char *file,
+static inline int get_bits_trace(GetBitContext *s, int n, const char *file,
const char *func, int line)
{
int r = get_bits(s, n);
@@ -540,7 +574,7 @@ static inline int get_bits_trace(GetBitContext *s, int n, char *file,
return r;
}
static inline int get_vlc_trace(GetBitContext *s, VLC_TYPE (*table)[2],
- int bits, int max_depth, char *file,
+ int bits, int max_depth, const char *file,
const char *func, int line)
{
int show = show_bits(s, 24);
@@ -555,7 +589,7 @@ static inline int get_vlc_trace(GetBitContext *s, VLC_TYPE (*table)[2],
bits2, len, r, pos, file, func, line);
return r;
}
-static inline int get_xbits_trace(GetBitContext *s, int n, char *file,
+static inline int get_xbits_trace(GetBitContext *s, int n, const char *file,
const char *func, int line)
{
int show = show_bits(s, n);
diff --git a/gst-libs/ext/libav/libavcodec/gif.c b/gst-libs/ext/libav/libavcodec/gif.c
index c7e7bcd..af57fff 100644
--- a/gst-libs/ext/libav/libavcodec/gif.c
+++ b/gst-libs/ext/libav/libavcodec/gif.c
@@ -43,6 +43,7 @@
#include "avcodec.h"
#include "bytestream.h"
+#include "internal.h"
#include "lzw.h"
/* The GIF format uses reversed order for bitstreams... */
@@ -141,20 +142,32 @@ static av_cold int gif_encode_init(AVCodecContext *avctx)
}
/* better than nothing gif encoder */
-static int gif_encode_frame(AVCodecContext *avctx, unsigned char *outbuf, int buf_size, void *data)
+static int gif_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
+ const AVFrame *pict, int *got_packet)
{
GIFContext *s = avctx->priv_data;
- AVFrame *pict = data;
- AVFrame *const p = (AVFrame *)&s->picture;
- uint8_t *outbuf_ptr = outbuf;
- uint8_t *end = outbuf + buf_size;
+ AVFrame *const p = &s->picture;
+ uint8_t *outbuf_ptr, *end;
+ int ret;
+
+ if ((ret = ff_alloc_packet(pkt, avctx->width*avctx->height*7/5 + FF_MIN_BUFFER_SIZE)) < 0) {
+ av_log(avctx, AV_LOG_ERROR, "Error getting output packet.\n");
+ return ret;
+ }
+ outbuf_ptr = pkt->data;
+ end = pkt->data + pkt->size;
*p = *pict;
p->pict_type = AV_PICTURE_TYPE_I;
p->key_frame = 1;
gif_image_write_header(avctx, &outbuf_ptr, (uint32_t *)pict->data[1]);
gif_image_write_image(avctx, &outbuf_ptr, end, pict->data[0], pict->linesize[0]);
- return outbuf_ptr - outbuf;
+
+ pkt->size = outbuf_ptr - pkt->data;
+ pkt->flags |= AV_PKT_FLAG_KEY;
+ *got_packet = 1;
+
+ return 0;
}
static int gif_encode_close(AVCodecContext *avctx)
@@ -169,11 +182,14 @@ static int gif_encode_close(AVCodecContext *avctx)
AVCodec ff_gif_encoder = {
.name = "gif",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_GIF,
+ .id = AV_CODEC_ID_GIF,
.priv_data_size = sizeof(GIFContext),
.init = gif_encode_init,
- .encode = gif_encode_frame,
+ .encode2 = gif_encode_frame,
.close = gif_encode_close,
- .pix_fmts= (const enum PixelFormat[]){PIX_FMT_RGB8, PIX_FMT_BGR8, PIX_FMT_RGB4_BYTE, PIX_FMT_BGR4_BYTE, PIX_FMT_GRAY8, PIX_FMT_PAL8, PIX_FMT_NONE},
- .long_name= NULL_IF_CONFIG_SMALL("GIF (Graphics Interchange Format)"),
+ .pix_fmts = (const enum AVPixelFormat[]){
+ AV_PIX_FMT_RGB8, AV_PIX_FMT_BGR8, AV_PIX_FMT_RGB4_BYTE, AV_PIX_FMT_BGR4_BYTE,
+ AV_PIX_FMT_GRAY8, AV_PIX_FMT_PAL8, AV_PIX_FMT_NONE
+ },
+ .long_name = NULL_IF_CONFIG_SMALL("GIF (Graphics Interchange Format)"),
};
diff --git a/gst-libs/ext/libav/libavcodec/gifdec.c b/gst-libs/ext/libav/libavcodec/gifdec.c
index 9bac254..8f1d694 100644
--- a/gst-libs/ext/libav/libavcodec/gifdec.c
+++ b/gst-libs/ext/libav/libavcodec/gifdec.c
@@ -25,6 +25,7 @@
#include "libavutil/imgutils.h"
#include "avcodec.h"
#include "bytestream.h"
+#include "internal.h"
#include "lzw.h"
#define GCE_DISPOSAL_NONE 0
@@ -281,7 +282,8 @@ static av_cold int gif_decode_init(AVCodecContext *avctx)
return 0;
}
-static int gif_decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt)
+static int gif_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
+ AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
@@ -294,14 +296,14 @@ static int gif_decode_frame(AVCodecContext *avctx, void *data, int *data_size, A
if (gif_read_header1(s) < 0)
return -1;
- avctx->pix_fmt = PIX_FMT_PAL8;
+ avctx->pix_fmt = AV_PIX_FMT_PAL8;
if (av_image_check_size(s->screen_width, s->screen_height, 0, avctx))
return -1;
avcodec_set_dimensions(avctx, s->screen_width, s->screen_height);
if (s->picture.data[0])
avctx->release_buffer(avctx, &s->picture);
- if (avctx->get_buffer(avctx, &s->picture) < 0) {
+ if (ff_get_buffer(avctx, &s->picture) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return -1;
}
@@ -311,7 +313,7 @@ static int gif_decode_frame(AVCodecContext *avctx, void *data, int *data_size, A
return ret;
*picture = s->picture;
- *data_size = sizeof(AVPicture);
+ *got_frame = 1;
return s->bytestream - buf;
}
@@ -328,11 +330,11 @@ static av_cold int gif_decode_close(AVCodecContext *avctx)
AVCodec ff_gif_decoder = {
.name = "gif",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_GIF,
+ .id = AV_CODEC_ID_GIF,
.priv_data_size = sizeof(GifState),
.init = gif_decode_init,
.close = gif_decode_close,
.decode = gif_decode_frame,
.capabilities = CODEC_CAP_DR1,
- .long_name = NULL_IF_CONFIG_SMALL("GIF (Graphics Interchange Format)"),
+ .long_name = NULL_IF_CONFIG_SMALL("GIF (Graphics Interchange Format)"),
};
diff --git a/gst-libs/ext/libav/libavcodec/golomb-test.c b/gst-libs/ext/libav/libavcodec/golomb-test.c
new file mode 100644
index 0000000..e740a20
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/golomb-test.c
@@ -0,0 +1,97 @@
+/*
+ * 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
+ */
+
+#include <stdint.h>
+#include <stdio.h>
+
+#include "libavutil/mem.h"
+
+#include "get_bits.h"
+#include "golomb.h"
+#include "put_bits.h"
+
+#define COUNT 8191
+#define SIZE (COUNT * 4)
+
+int main(void)
+{
+ int i, ret = 0;
+ uint8_t *temp;
+ PutBitContext pb;
+ GetBitContext gb;
+
+ temp = av_malloc(SIZE);
+ if (!temp)
+ return 2;
+
+ init_put_bits(&pb, temp, SIZE);
+ for (i = 0; i < COUNT; i++)
+ set_ue_golomb(&pb, i);
+ flush_put_bits(&pb);
+
+ init_get_bits(&gb, temp, 8 * SIZE);
+ for (i = 0; i < COUNT; i++) {
+ int j, s = show_bits(&gb, 25);
+
+ j = get_ue_golomb(&gb);
+ if (j != i) {
+ fprintf(stderr, "get_ue_golomb: expected %d, got %d. bits: %7x\n",
+ i, j, s);
+ ret = 1;
+ }
+ }
+
+#define EXTEND(i) (i << 3 | i & 7)
+ init_put_bits(&pb, temp, SIZE);
+ for (i = 0; i < COUNT; i++)
+ set_ue_golomb(&pb, EXTEND(i));
+ flush_put_bits(&pb);
+
+ init_get_bits(&gb, temp, 8 * SIZE);
+ for (i = 0; i < COUNT; i++) {
+ int j, s = show_bits_long(&gb, 32);
+
+ j = get_ue_golomb_long(&gb);
+ if (j != EXTEND(i)) {
+ fprintf(stderr, "get_ue_golomb_long: expected %d, got %d. "
+ "bits: %8x\n", EXTEND(i), j, s);
+ ret = 1;
+ }
+ }
+
+ init_put_bits(&pb, temp, SIZE);
+ for (i = 0; i < COUNT; i++)
+ set_se_golomb(&pb, i - COUNT / 2);
+ flush_put_bits(&pb);
+
+ init_get_bits(&gb, temp, 8 * SIZE);
+ for (i = 0; i < COUNT; i++) {
+ int j, s = show_bits(&gb, 25);
+
+ j = get_se_golomb(&gb);
+ if (j != i - COUNT / 2) {
+ fprintf(stderr, "get_se_golomb: expected %d, got %d. bits: %7x\n",
+ i - COUNT / 2, j, s);
+ ret = 1;
+ }
+ }
+
+ av_free(temp);
+
+ return ret;
+}
diff --git a/gst-libs/ext/libav/libavcodec/golomb.h b/gst-libs/ext/libav/libavcodec/golomb.h
index b6b8cc8..564ba4e 100644
--- a/gst-libs/ext/libav/libavcodec/golomb.h
+++ b/gst-libs/ext/libav/libavcodec/golomb.h
@@ -107,7 +107,8 @@ static inline int get_ue_golomb_31(GetBitContext *gb){
return ff_ue_golomb_vlc_code[buf];
}
-static inline int svq3_get_ue_golomb(GetBitContext *gb){
+static inline unsigned svq3_get_ue_golomb(GetBitContext *gb)
+{
uint32_t buf;
OPEN_READER(re, gb);
@@ -121,7 +122,7 @@ static inline int svq3_get_ue_golomb(GetBitContext *gb){
return ff_interleaved_ue_golomb_vlc_code[buf];
}else{
- int ret = 1;
+ unsigned ret = 1;
do {
buf >>= 32 - 8;
@@ -372,7 +373,9 @@ static inline int get_sr_golomb_shorten(GetBitContext* gb, int k)
#ifdef TRACE
-static inline int get_ue(GetBitContext *s, char *file, const char *func, int line){
+static inline int get_ue(GetBitContext *s, const char *file, const char *func,
+ int line)
+{
int show= show_bits(s, 24);
int pos= get_bits_count(s);
int i= get_ue_golomb(s);
@@ -386,7 +389,9 @@ static inline int get_ue(GetBitContext *s, char *file, const char *func, int lin
return i;
}
-static inline int get_se(GetBitContext *s, char *file, const char *func, int line){
+static inline int get_se(GetBitContext *s, const char *file, const char *func,
+ int line)
+{
int show= show_bits(s, 24);
int pos= get_bits_count(s);
int i= get_se_golomb(s);
@@ -459,8 +464,6 @@ static inline void set_te_golomb(PutBitContext *pb, int i, int range){
* write signed exp golomb code. 16 bits at most.
*/
static inline void set_se_golomb(PutBitContext *pb, int i){
-// if (i>32767 || i<-32767)
-// av_log(NULL,AV_LOG_ERROR,"value out of range %d\n", i);
#if 0
if(i<=0) i= -2*i;
else i= 2*i-1;
diff --git a/gst-libs/ext/libav/libavcodec/gsm_parser.c b/gst-libs/ext/libav/libavcodec/gsm_parser.c
index a2965d3..1d381fc 100644
--- a/gst-libs/ext/libav/libavcodec/gsm_parser.c
+++ b/gst-libs/ext/libav/libavcodec/gsm_parser.c
@@ -31,6 +31,7 @@
typedef struct GSMParseContext {
ParseContext pc;
int block_size;
+ int duration;
int remaining;
} GSMParseContext;
@@ -44,8 +45,14 @@ static int gsm_parse(AVCodecParserContext *s1, AVCodecContext *avctx,
if (!s->block_size) {
switch (avctx->codec_id) {
- case CODEC_ID_GSM: s->block_size = GSM_BLOCK_SIZE; break;
- case CODEC_ID_GSM_MS: s->block_size = GSM_MS_BLOCK_SIZE; break;
+ case AV_CODEC_ID_GSM:
+ s->block_size = GSM_BLOCK_SIZE;
+ s->duration = GSM_FRAME_SIZE;
+ break;
+ case AV_CODEC_ID_GSM_MS:
+ s->block_size = GSM_MS_BLOCK_SIZE;
+ s->duration = GSM_FRAME_SIZE * 2;
+ break;
default:
return AVERROR(EINVAL);
}
@@ -66,13 +73,16 @@ static int gsm_parse(AVCodecParserContext *s1, AVCodecContext *avctx,
*poutbuf_size = 0;
return buf_size;
}
+
+ s1->duration = s->duration;
+
*poutbuf = buf;
*poutbuf_size = buf_size;
return next;
}
AVCodecParser ff_gsm_parser = {
- .codec_ids = { CODEC_ID_GSM, CODEC_ID_GSM_MS },
+ .codec_ids = { AV_CODEC_ID_GSM, AV_CODEC_ID_GSM_MS },
.priv_data_size = sizeof(GSMParseContext),
.parser_parse = gsm_parse,
.parser_close = ff_parse_close,
diff --git a/gst-libs/ext/libav/libavcodec/gsmdec.c b/gst-libs/ext/libav/libavcodec/gsmdec.c
index 97b6fe8..4304723 100644
--- a/gst-libs/ext/libav/libavcodec/gsmdec.c
+++ b/gst-libs/ext/libav/libavcodec/gsmdec.c
@@ -24,8 +24,10 @@
* GSM decoder
*/
+#include "libavutil/channel_layout.h"
#include "avcodec.h"
#include "get_bits.h"
+#include "internal.h"
#include "msgsmdec.h"
#include "gsmdec_template.c"
@@ -34,17 +36,17 @@ static av_cold int gsm_init(AVCodecContext *avctx)
{
GSMContext *s = avctx->priv_data;
- avctx->channels = 1;
- if (!avctx->sample_rate)
- avctx->sample_rate = 8000;
- avctx->sample_fmt = AV_SAMPLE_FMT_S16;
+ avctx->channels = 1;
+ avctx->channel_layout = AV_CH_LAYOUT_MONO;
+ avctx->sample_rate = 8000;
+ avctx->sample_fmt = AV_SAMPLE_FMT_S16;
switch (avctx->codec_id) {
- case CODEC_ID_GSM:
+ case AV_CODEC_ID_GSM:
avctx->frame_size = GSM_FRAME_SIZE;
avctx->block_align = GSM_BLOCK_SIZE;
break;
- case CODEC_ID_GSM_MS:
+ case AV_CODEC_ID_GSM_MS:
avctx->frame_size = 2 * GSM_FRAME_SIZE;
avctx->block_align = GSM_MS_BLOCK_SIZE;
}
@@ -72,14 +74,14 @@ static int gsm_decode_frame(AVCodecContext *avctx, void *data,
/* get output buffer */
s->frame.nb_samples = avctx->frame_size;
- if ((res = avctx->get_buffer(avctx, &s->frame)) < 0) {
+ if ((res = ff_get_buffer(avctx, &s->frame)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return res;
}
samples = (int16_t *)s->frame.data[0];
switch (avctx->codec_id) {
- case CODEC_ID_GSM:
+ case AV_CODEC_ID_GSM:
init_get_bits(&gb, buf, buf_size * 8);
if (get_bits(&gb, 4) != 0xd)
av_log(avctx, AV_LOG_WARNING, "Missing GSM magic!\n");
@@ -87,7 +89,7 @@ static int gsm_decode_frame(AVCodecContext *avctx, void *data,
if (res < 0)
return res;
break;
- case CODEC_ID_GSM_MS:
+ case AV_CODEC_ID_GSM_MS:
res = ff_msgsm_decode_block(avctx, samples, buf);
if (res < 0)
return res;
@@ -108,23 +110,23 @@ static void gsm_flush(AVCodecContext *avctx)
AVCodec ff_gsm_decoder = {
.name = "gsm",
.type = AVMEDIA_TYPE_AUDIO,
- .id = CODEC_ID_GSM,
+ .id = AV_CODEC_ID_GSM,
.priv_data_size = sizeof(GSMContext),
.init = gsm_init,
.decode = gsm_decode_frame,
.flush = gsm_flush,
.capabilities = CODEC_CAP_DR1,
- .long_name = NULL_IF_CONFIG_SMALL("GSM"),
+ .long_name = NULL_IF_CONFIG_SMALL("GSM"),
};
AVCodec ff_gsm_ms_decoder = {
.name = "gsm_ms",
.type = AVMEDIA_TYPE_AUDIO,
- .id = CODEC_ID_GSM_MS,
+ .id = AV_CODEC_ID_GSM_MS,
.priv_data_size = sizeof(GSMContext),
.init = gsm_init,
.decode = gsm_decode_frame,
.flush = gsm_flush,
.capabilities = CODEC_CAP_DR1,
- .long_name = NULL_IF_CONFIG_SMALL("GSM Microsoft variant"),
+ .long_name = NULL_IF_CONFIG_SMALL("GSM Microsoft variant"),
};
diff --git a/gst-libs/ext/libav/libavcodec/gsmdec_data.h b/gst-libs/ext/libav/libavcodec/gsmdec_data.h
index 2ff2322..2f3a2d2 100644
--- a/gst-libs/ext/libav/libavcodec/gsmdec_data.h
+++ b/gst-libs/ext/libav/libavcodec/gsmdec_data.h
@@ -19,13 +19,13 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#ifndef AVCODEC_GSMDEC_DATA
-#define AVCODEC_GSMDEC_DATA
+#ifndef AVCODEC_GSMDEC_DATA_H
+#define AVCODEC_GSMDEC_DATA_H
#include <stdint.h>
#include "avcodec.h"
-typedef struct {
+typedef struct GSMContext {
AVFrame frame;
// Contains first 120 elements from the previous frame
// (used by long_term_synth according to the "lag"),
@@ -41,4 +41,4 @@ typedef struct {
extern const uint16_t ff_gsm_long_term_gain_tab[4];
extern const int16_t ff_gsm_dequant_tab[64][8];
-#endif /* AVCODEC_GSMDEC_DATA */
+#endif /* AVCODEC_GSMDEC_DATA_H */
diff --git a/gst-libs/ext/libav/libavcodec/h261.c b/gst-libs/ext/libav/libavcodec/h261.c
index eab3640..9555613 100644
--- a/gst-libs/ext/libav/libavcodec/h261.c
+++ b/gst-libs/ext/libav/libavcodec/h261.c
@@ -51,4 +51,3 @@ void ff_h261_loop_filter(MpegEncContext *s){
s->dsp.h261_loop_filter(dest_cb, uvlinesize);
s->dsp.h261_loop_filter(dest_cr, uvlinesize);
}
-
diff --git a/gst-libs/ext/libav/libavcodec/h261_parser.c b/gst-libs/ext/libav/libavcodec/h261_parser.c
index fb50acf..8a507ee 100644
--- a/gst-libs/ext/libav/libavcodec/h261_parser.c
+++ b/gst-libs/ext/libav/libavcodec/h261_parser.c
@@ -82,7 +82,7 @@ static int h261_parse(AVCodecParserContext *s,
}
AVCodecParser ff_h261_parser = {
- .codec_ids = { CODEC_ID_H261 },
+ .codec_ids = { AV_CODEC_ID_H261 },
.priv_data_size = sizeof(ParseContext),
.parser_parse = h261_parse,
.parser_close = ff_parse_close,
diff --git a/gst-libs/ext/libav/libavcodec/h261dec.c b/gst-libs/ext/libav/libavcodec/h261dec.c
index 665cc0d..55453c1 100644
--- a/gst-libs/ext/libav/libavcodec/h261dec.c
+++ b/gst-libs/ext/libav/libavcodec/h261dec.c
@@ -76,7 +76,7 @@ static av_cold int h261_decode_init(AVCodecContext *avctx){
MpegEncContext * const s = &h->s;
// set defaults
- MPV_decode_defaults(s);
+ ff_MPV_decode_defaults(s);
s->avctx = avctx;
s->width = s->avctx->coded_width;
@@ -85,7 +85,7 @@ static av_cold int h261_decode_init(AVCodecContext *avctx){
s->out_format = FMT_H261;
s->low_delay= 1;
- avctx->pix_fmt= PIX_FMT_YUV420P;
+ avctx->pix_fmt= AV_PIX_FMT_YUV420P;
s->codec_id= avctx->codec->id;
@@ -221,7 +221,7 @@ static int h261_decode_mb_skipped(H261Context *h, int mba1, int mba2 )
s->mb_skipped = 1;
h->mtype &= ~MB_TYPE_H261_FIL;
- MPV_decode_mb(s, s->block);
+ ff_MPV_decode_mb(s, s->block);
}
return 0;
@@ -349,7 +349,7 @@ intra:
s->block_last_index[i]= -1;
}
- MPV_decode_mb(s, s->block);
+ ff_MPV_decode_mb(s, s->block);
return SLICE_OK;
}
@@ -543,7 +543,7 @@ static int get_consumed_bytes(MpegEncContext *s, int buf_size){
}
static int h261_decode_frame(AVCodecContext *avctx,
- void *data, int *data_size,
+ void *data, int *got_frame,
AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
@@ -565,7 +565,7 @@ retry:
init_get_bits(&s->gb, buf, buf_size*8);
if(!s->context_initialized){
- if (MPV_common_init(s) < 0) //we need the idct permutaton for reading a custom matrix
+ if (ff_MPV_common_init(s) < 0) //we need the idct permutaton for reading a custom matrix
return -1;
}
@@ -588,7 +588,7 @@ retry:
if (s->width != avctx->coded_width || s->height != avctx->coded_height){
ParseContext pc= s->parse_context; //FIXME move this demuxing hack to libavformat
s->parse_context.buffer=0;
- MPV_common_end(s);
+ ff_MPV_common_end(s);
s->parse_context= pc;
}
if (!s->context_initialized) {
@@ -606,7 +606,7 @@ retry:
|| avctx->skip_frame >= AVDISCARD_ALL)
return get_consumed_bytes(s, buf_size);
- if(MPV_frame_start(s, avctx) < 0)
+ if(ff_MPV_frame_start(s, avctx) < 0)
return -1;
ff_er_frame_start(s);
@@ -620,14 +620,15 @@ retry:
break;
h261_decode_gob(h);
}
- MPV_frame_end(s);
+ ff_MPV_frame_end(s);
assert(s->current_picture.f.pict_type == s->current_picture_ptr->f.pict_type);
assert(s->current_picture.f.pict_type == s->pict_type);
- *pict= *(AVFrame*)s->current_picture_ptr;
+
+ *pict = s->current_picture_ptr->f;
ff_print_debug_info(s, pict);
- *data_size = sizeof(AVFrame);
+ *got_frame = 1;
return get_consumed_bytes(s, buf_size);
}
@@ -637,19 +638,18 @@ static av_cold int h261_decode_end(AVCodecContext *avctx)
H261Context *h= avctx->priv_data;
MpegEncContext *s = &h->s;
- MPV_common_end(s);
+ ff_MPV_common_end(s);
return 0;
}
AVCodec ff_h261_decoder = {
.name = "h261",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_H261,
+ .id = AV_CODEC_ID_H261,
.priv_data_size = sizeof(H261Context),
.init = h261_decode_init,
.close = h261_decode_end,
.decode = h261_decode_frame,
.capabilities = CODEC_CAP_DR1,
- .max_lowres = 3,
- .long_name = NULL_IF_CONFIG_SMALL("H.261"),
+ .long_name = NULL_IF_CONFIG_SMALL("H.261"),
};
diff --git a/gst-libs/ext/libav/libavcodec/h261enc.c b/gst-libs/ext/libav/libavcodec/h261enc.c
index ee37fe3..d6b4cfc 100644
--- a/gst-libs/ext/libav/libavcodec/h261enc.c
+++ b/gst-libs/ext/libav/libavcodec/h261enc.c
@@ -321,15 +321,17 @@ static void h261_encode_block(H261Context * h, DCTELEM * block, int n){
}
}
+FF_MPV_GENERIC_CLASS(h261)
+
AVCodec ff_h261_encoder = {
.name = "h261",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_H261,
+ .id = AV_CODEC_ID_H261,
.priv_data_size = sizeof(H261Context),
- .init = MPV_encode_init,
- .encode = MPV_encode_picture,
- .close = MPV_encode_end,
- .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE},
- .long_name= NULL_IF_CONFIG_SMALL("H.261"),
+ .init = ff_MPV_encode_init,
+ .encode2 = ff_MPV_encode_picture,
+ .close = ff_MPV_encode_end,
+ .pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_YUV420P, AV_PIX_FMT_NONE },
+ .long_name = NULL_IF_CONFIG_SMALL("H.261"),
+ .priv_class = &h261_class,
};
-
diff --git a/gst-libs/ext/libav/libavcodec/h263.h b/gst-libs/ext/libav/libavcodec/h263.h
index d26cf63..beb32c4 100644
--- a/gst-libs/ext/libav/libavcodec/h263.h
+++ b/gst-libs/ext/libav/libavcodec/h263.h
@@ -69,7 +69,7 @@ int ff_h263_decode_motion(MpegEncContext * s, int pred, int f_code);
av_const int ff_h263_aspect_to_info(AVRational aspect);
int ff_h263_decode_init(AVCodecContext *avctx);
int ff_h263_decode_frame(AVCodecContext *avctx,
- void *data, int *data_size,
+ void *data, int *got_frame,
AVPacket *avpkt);
int ff_h263_decode_end(AVCodecContext *avctx);
void ff_h263_encode_mb(MpegEncContext *s,
@@ -148,7 +148,7 @@ static inline int get_p_cbp(MpegEncContext * s,
int motion_x, int motion_y){
int cbp, i;
- if(s->flags & CODEC_FLAG_CBP_RD){
+ if (s->mpv_flags & FF_MPV_FLAG_CBP_RD) {
int best_cbpy_score= INT_MAX;
int best_cbpc_score= INT_MAX;
int cbpc = (-1), cbpy= (-1);
diff --git a/gst-libs/ext/libav/libavcodec/h263_parser.c b/gst-libs/ext/libav/libavcodec/h263_parser.c
index 98a72d9..71e047a 100644
--- a/gst-libs/ext/libav/libavcodec/h263_parser.c
+++ b/gst-libs/ext/libav/libavcodec/h263_parser.c
@@ -84,7 +84,7 @@ static int h263_parse(AVCodecParserContext *s,
}
AVCodecParser ff_h263_parser = {
- .codec_ids = { CODEC_ID_H263 },
+ .codec_ids = { AV_CODEC_ID_H263 },
.priv_data_size = sizeof(ParseContext),
.parser_parse = h263_parse,
.parser_close = ff_parse_close,
diff --git a/gst-libs/ext/libav/libavcodec/h263dec.c b/gst-libs/ext/libav/libavcodec/h263dec.c
index a675e6e..fc5f565 100644
--- a/gst-libs/ext/libav/libavcodec/h263dec.c
+++ b/gst-libs/ext/libav/libavcodec/h263dec.c
@@ -54,52 +54,56 @@ av_cold int ff_h263_decode_init(AVCodecContext *avctx)
s->workaround_bugs= avctx->workaround_bugs;
// set defaults
- MPV_decode_defaults(s);
+ ff_MPV_decode_defaults(s);
s->quant_precision=5;
s->decode_mb= ff_h263_decode_mb;
s->low_delay= 1;
- avctx->pix_fmt= avctx->get_format(avctx, avctx->codec->pix_fmts);
+ if (avctx->codec->id == AV_CODEC_ID_MSS2)
+ avctx->pix_fmt = AV_PIX_FMT_YUV420P;
+ else
+ avctx->pix_fmt = avctx->get_format(avctx, avctx->codec->pix_fmts);
s->unrestricted_mv= 1;
/* select sub codec */
switch(avctx->codec->id) {
- case CODEC_ID_H263:
+ case AV_CODEC_ID_H263:
s->unrestricted_mv= 0;
avctx->chroma_sample_location = AVCHROMA_LOC_CENTER;
break;
- case CODEC_ID_MPEG4:
+ case AV_CODEC_ID_MPEG4:
break;
- case CODEC_ID_MSMPEG4V1:
+ case AV_CODEC_ID_MSMPEG4V1:
s->h263_pred = 1;
s->msmpeg4_version=1;
break;
- case CODEC_ID_MSMPEG4V2:
+ case AV_CODEC_ID_MSMPEG4V2:
s->h263_pred = 1;
s->msmpeg4_version=2;
break;
- case CODEC_ID_MSMPEG4V3:
+ case AV_CODEC_ID_MSMPEG4V3:
s->h263_pred = 1;
s->msmpeg4_version=3;
break;
- case CODEC_ID_WMV1:
+ case AV_CODEC_ID_WMV1:
s->h263_pred = 1;
s->msmpeg4_version=4;
break;
- case CODEC_ID_WMV2:
+ case AV_CODEC_ID_WMV2:
s->h263_pred = 1;
s->msmpeg4_version=5;
break;
- case CODEC_ID_VC1:
- case CODEC_ID_WMV3:
- case CODEC_ID_VC1IMAGE:
- case CODEC_ID_WMV3IMAGE:
+ case AV_CODEC_ID_VC1:
+ case AV_CODEC_ID_WMV3:
+ case AV_CODEC_ID_VC1IMAGE:
+ case AV_CODEC_ID_WMV3IMAGE:
+ case AV_CODEC_ID_MSS2:
s->h263_pred = 1;
s->msmpeg4_version=6;
avctx->chroma_sample_location = AVCHROMA_LOC_LEFT;
break;
- case CODEC_ID_H263I:
+ case AV_CODEC_ID_H263I:
break;
- case CODEC_ID_FLV1:
+ case AV_CODEC_ID_FLV1:
s->h263_flv = 1;
break;
default:
@@ -109,8 +113,8 @@ av_cold int ff_h263_decode_init(AVCodecContext *avctx)
avctx->hwaccel= ff_find_hwaccel(avctx->codec->id, avctx->pix_fmt);
/* for h263, we allocate the images after having read the header */
- if (avctx->codec->id != CODEC_ID_H263 && avctx->codec->id != CODEC_ID_MPEG4)
- if (MPV_common_init(s) < 0)
+ if (avctx->codec->id != AV_CODEC_ID_H263 && avctx->codec->id != AV_CODEC_ID_MPEG4)
+ if (ff_MPV_common_init(s) < 0)
return -1;
ff_h263_decode_init_vlc(s);
@@ -122,7 +126,7 @@ av_cold int ff_h263_decode_end(AVCodecContext *avctx)
{
MpegEncContext *s = avctx->priv_data;
- MPV_common_end(s);
+ ff_MPV_common_end(s);
return 0;
}
@@ -149,7 +153,7 @@ static int get_consumed_bytes(MpegEncContext *s, int buf_size){
static int decode_slice(MpegEncContext *s){
const int part_mask= s->partitioned_frame ? (ER_AC_END|ER_AC_ERROR) : 0x7F;
- const int mb_size= 16>>s->avctx->lowres;
+ const int mb_size = 16;
s->last_resync_gb= s->gb;
s->first_slice_line= 1;
@@ -168,7 +172,7 @@ static int decode_slice(MpegEncContext *s){
if(s->partitioned_frame){
const int qscale= s->qscale;
- if(CONFIG_MPEG4_DECODER && s->codec_id==CODEC_ID_MPEG4){
+ if(CONFIG_MPEG4_DECODER && s->codec_id==AV_CODEC_ID_MPEG4){
if(ff_mpeg4_decode_partitions(s) < 0)
return -1;
}
@@ -211,7 +215,8 @@ static int decode_slice(MpegEncContext *s){
s->mv_dir = MV_DIR_FORWARD;
s->mv_type = MV_TYPE_16X16;
// s->mb_skipped = 0;
-//printf("%d %d %06X\n", ret, get_bits_count(&s->gb), show_bits(&s->gb, 24));
+ av_dlog(s, "%d %d %06X\n",
+ ret, get_bits_count(&s->gb), show_bits(&s->gb, 24));
ret= s->decode_mb(s, s->block);
if (s->pict_type!=AV_PICTURE_TYPE_B)
@@ -220,11 +225,10 @@ static int decode_slice(MpegEncContext *s){
if(ret<0){
const int xy= s->mb_x + s->mb_y*s->mb_stride;
if(ret==SLICE_END){
- MPV_decode_mb(s, s->block);
+ ff_MPV_decode_mb(s, s->block);
if(s->loop_filter)
ff_h263_loop_filter(s);
-//printf("%d %d %d %06X\n", s->mb_x, s->mb_y, s->gb.size*8 - get_bits_count(&s->gb), show_bits(&s->gb, 24));
ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y, ER_MB_END&part_mask);
s->padding_bug_score--;
@@ -232,7 +236,7 @@ static int decode_slice(MpegEncContext *s){
if(++s->mb_x >= s->mb_width){
s->mb_x=0;
ff_draw_horiz_band(s, s->mb_y*mb_size, mb_size);
- MPV_report_decode_progress(s);
+ ff_MPV_report_decode_progress(s);
s->mb_y++;
}
return 0;
@@ -247,20 +251,20 @@ static int decode_slice(MpegEncContext *s){
return -1;
}
- MPV_decode_mb(s, s->block);
+ ff_MPV_decode_mb(s, s->block);
if(s->loop_filter)
ff_h263_loop_filter(s);
}
ff_draw_horiz_band(s, s->mb_y*mb_size, mb_size);
- MPV_report_decode_progress(s);
+ ff_MPV_report_decode_progress(s);
s->mb_x= 0;
}
assert(s->mb_x==0 && s->mb_y==s->mb_height);
- if(s->codec_id==CODEC_ID_MPEG4
+ if(s->codec_id==AV_CODEC_ID_MPEG4
&& (s->workaround_bugs&FF_BUG_AUTODETECT)
&& get_bits_left(&s->gb) >= 48
&& show_bits(&s->gb, 24)==0x4010
@@ -268,7 +272,7 @@ static int decode_slice(MpegEncContext *s){
s->padding_bug_score+=32;
/* try to detect the padding bug */
- if( s->codec_id==CODEC_ID_MPEG4
+ if( s->codec_id==AV_CODEC_ID_MPEG4
&& (s->workaround_bugs&FF_BUG_AUTODETECT)
&& get_bits_left(&s->gb) >=0
&& get_bits_left(&s->gb) < 48
@@ -336,7 +340,7 @@ static int decode_slice(MpegEncContext *s){
}
int ff_h263_decode_frame(AVCodecContext *avctx,
- void *data, int *data_size,
+ void *data, int *got_frame,
AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
@@ -355,10 +359,10 @@ uint64_t time= rdtsc();
if (buf_size == 0) {
/* special case for last picture */
if (s->low_delay==0 && s->next_picture_ptr) {
- *pict= *(AVFrame*)s->next_picture_ptr;
+ *pict = s->next_picture_ptr->f;
s->next_picture_ptr= NULL;
- *data_size = sizeof(AVFrame);
+ *got_frame = 1;
}
return 0;
@@ -367,9 +371,9 @@ uint64_t time= rdtsc();
if(s->flags&CODEC_FLAG_TRUNCATED){
int next;
- if(CONFIG_MPEG4_DECODER && s->codec_id==CODEC_ID_MPEG4){
+ if(CONFIG_MPEG4_DECODER && s->codec_id==AV_CODEC_ID_MPEG4){
next= ff_mpeg4_find_frame_end(&s->parse_context, buf, buf_size);
- }else if(CONFIG_H263_DECODER && s->codec_id==CODEC_ID_H263){
+ }else if(CONFIG_H263_DECODER && s->codec_id==AV_CODEC_ID_H263){
next= ff_h263_find_frame_end(&s->parse_context, buf, buf_size);
}else{
av_log(s->avctx, AV_LOG_ERROR, "this codec does not support truncated bitstreams\n");
@@ -390,7 +394,7 @@ retry:
s->bitstream_buffer_size=0;
if (!s->context_initialized) {
- if (MPV_common_init(s) < 0) //we need the idct permutaton for reading a custom matrix
+ if (ff_MPV_common_init(s) < 0) //we need the idct permutaton for reading a custom matrix
return -1;
}
@@ -407,7 +411,7 @@ retry:
if (CONFIG_WMV2_DECODER && s->msmpeg4_version==5) {
ret= ff_wmv2_decode_picture_header(s);
} else if (CONFIG_MSMPEG4_DECODER && s->msmpeg4_version) {
- ret = msmpeg4_decode_picture_header(s);
+ ret = ff_msmpeg4_decode_picture_header(s);
} else if (CONFIG_MPEG4_DECODER && s->h263_pred) {
if(s->avctx->extradata_size && s->picture_number==0){
GetBitContext gb;
@@ -416,7 +420,7 @@ retry:
ret = ff_mpeg4_decode_picture_header(s, &gb);
}
ret = ff_mpeg4_decode_picture_header(s, &s->gb);
- } else if (CONFIG_H263I_DECODER && s->codec_id == CODEC_ID_H263I) {
+ } else if (CONFIG_H263I_DECODER && s->codec_id == AV_CODEC_ID_H263I) {
ret = ff_intel_h263_decode_picture_header(s);
} else if (CONFIG_FLV_DECODER && s->h263_flv) {
ret = ff_flv_decode_picture_header(s);
@@ -430,13 +434,6 @@ retry:
if (ret < 0){
av_log(s->avctx, AV_LOG_ERROR, "header damaged\n");
return -1;
- } else if ((s->width != avctx->coded_width ||
- s->height != avctx->coded_height ||
- (s->width + 15) >> 4 != s->mb_width ||
- (s->height + 15) >> 4 != s->mb_height) &&
- (HAVE_THREADS && (s->avctx->active_thread_type & FF_THREAD_FRAME))) {
- av_log_missing_feature(s->avctx, "Width/height/bit depth/chroma idc changing with threads is", 0);
- return AVERROR_PATCHWELCOME; // width / height changed during parallelized decoding
}
avctx->has_b_frames= !s->low_delay;
@@ -513,7 +510,6 @@ retry:
if(s->divx_version>=0)
s->workaround_bugs|= FF_BUG_DIRECT_BLOCKSIZE;
-//printf("padding_bug_score: %d\n", s->padding_bug_score);
if(s->divx_version==501 && s->divx_build==20020416)
s->padding_bug_score= 256*256*256*64;
@@ -531,7 +527,7 @@ retry:
* Let us hope this at least works.
*/
if( s->resync_marker==0 && s->data_partitioning==0 && s->divx_version==-1
- && s->codec_id==CODEC_ID_MPEG4 && s->vo_type==0)
+ && s->codec_id==AV_CODEC_ID_MPEG4 && s->vo_type==0)
s->workaround_bugs|= FF_BUG_NO_PADDING;
if(s->lavc_build<4609U) //FIXME not sure about the version num but a 4609 file seems ok
@@ -561,7 +557,7 @@ retry:
s->divx_packed ? "p" : "");
#if HAVE_MMX
- if (s->codec_id == CODEC_ID_MPEG4 && s->xvid_build>=0 && avctx->idct_algo == FF_IDCT_AUTO && (av_get_cpu_flags() & AV_CPU_FLAG_MMX)) {
+ if (s->codec_id == AV_CODEC_ID_MPEG4 && s->xvid_build>=0 && avctx->idct_algo == FF_IDCT_AUTO && (av_get_cpu_flags() & AV_CPU_FLAG_MMX)) {
avctx->idct_algo= FF_IDCT_XVIDMMX;
ff_dct_common_init(s);
s->picture_number=0;
@@ -573,27 +569,30 @@ retry:
/* FIXME: By the way H263 decoder is evolving it should have */
/* an H263EncContext */
- if ( s->width != avctx->coded_width
- || s->height != avctx->coded_height) {
- /* H.263 could change picture size any time */
+ if (!avctx->coded_width || !avctx->coded_height) {
ParseContext pc= s->parse_context; //FIXME move these demuxng hack to avformat
- if (HAVE_THREADS && (s->avctx->active_thread_type&FF_THREAD_FRAME)) {
- av_log_missing_feature(s->avctx, "Width/height/bit depth/chroma idc changing with threads is", 0);
- return -1; // width / height changed during parallelized decoding
- }
-
s->parse_context.buffer=0;
- MPV_common_end(s);
+ ff_MPV_common_end(s);
s->parse_context= pc;
- }
- if (!s->context_initialized) {
avcodec_set_dimensions(avctx, s->width, s->height);
goto retry;
}
- if((s->codec_id==CODEC_ID_H263 || s->codec_id==CODEC_ID_H263P || s->codec_id == CODEC_ID_H263I))
+ if (s->width != avctx->coded_width ||
+ s->height != avctx->coded_height ||
+ s->context_reinit) {
+ /* H.263 could change picture size any time */
+ s->context_reinit = 0;
+
+ avcodec_set_dimensions(avctx, s->width, s->height);
+
+ if ((ret = ff_MPV_common_frame_size_change(s)))
+ return ret;
+ }
+
+ if((s->codec_id==AV_CODEC_ID_H263 || s->codec_id==AV_CODEC_ID_H263P || s->codec_id == AV_CODEC_ID_H263I))
s->gob_index = ff_h263_get_gob_height(s);
// for skipping the frame
@@ -601,7 +600,9 @@ retry:
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)) return get_consumed_bytes(s, buf_size);
+ if (s->last_picture_ptr == NULL &&
+ (s->pict_type == AV_PICTURE_TYPE_B || s->droppable))
+ return get_consumed_bytes(s, buf_size);
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)
@@ -625,7 +626,7 @@ retry:
s->me.qpel_avg= s->dsp.avg_qpel_pixels_tab;
}
- if(MPV_frame_start(s, avctx) < 0)
+ if(ff_MPV_frame_start(s, avctx) < 0)
return -1;
if (!s->divx_packed) ff_thread_finish_setup(avctx);
@@ -643,7 +644,7 @@ retry:
ff_er_frame_start(s);
//the second part of the wmv2 header contains the MB skip bits which are stored in current_picture->mb_type
- //which is not available before MPV_frame_start()
+ //which is not available before ff_MPV_frame_start()
if (CONFIG_WMV2_DECODER && s->msmpeg4_version==5){
ret = ff_wmv2_decode_secondary_picture_header(s);
if(ret<0) return ret;
@@ -674,14 +675,14 @@ retry:
}
if (s->msmpeg4_version && s->msmpeg4_version<4 && s->pict_type==AV_PICTURE_TYPE_I)
- if(!CONFIG_MSMPEG4_DECODER || msmpeg4_decode_ext_header(s, buf_size) < 0){
+ if(!CONFIG_MSMPEG4_DECODER || ff_msmpeg4_decode_ext_header(s, buf_size) < 0){
s->error_status_table[s->mb_num-1]= ER_MB_ERROR;
}
assert(s->bitstream_buffer_size==0);
frame_end:
/* divx 5.01+ bistream reorder stuff */
- if(s->codec_id==CODEC_ID_MPEG4 && s->divx_packed){
+ if(s->codec_id==AV_CODEC_ID_MPEG4 && s->divx_packed){
int current_pos= get_bits_count(&s->gb)>>3;
int startcode_found=0;
@@ -719,18 +720,18 @@ intrax8_decoded:
return -1;
}
- MPV_frame_end(s);
+ ff_MPV_frame_end(s);
assert(s->current_picture.f.pict_type == s->current_picture_ptr->f.pict_type);
assert(s->current_picture.f.pict_type == s->pict_type);
if (s->pict_type == AV_PICTURE_TYPE_B || s->low_delay) {
- *pict= *(AVFrame*)s->current_picture_ptr;
+ *pict = s->current_picture_ptr->f;
} else if (s->last_picture_ptr != NULL) {
- *pict= *(AVFrame*)s->last_picture_ptr;
+ *pict = s->last_picture_ptr->f;
}
if(s->last_picture_ptr || s->low_delay){
- *data_size = sizeof(AVFrame);
+ *got_frame = 1;
ff_print_debug_info(s, pict);
}
@@ -744,14 +745,14 @@ av_log(avctx, AV_LOG_DEBUG, "%"PRId64"\n", rdtsc()-time);
AVCodec ff_h263_decoder = {
.name = "h263",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_H263,
+ .id = AV_CODEC_ID_H263,
.priv_data_size = sizeof(MpegEncContext),
.init = ff_h263_decode_init,
.close = ff_h263_decode_end,
.decode = ff_h263_decode_frame,
- .capabilities = CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1 | CODEC_CAP_TRUNCATED | CODEC_CAP_DELAY,
- .flush= ff_mpeg_flush,
- .max_lowres= 3,
- .long_name= NULL_IF_CONFIG_SMALL("H.263 / H.263-1996, H.263+ / H.263-1998 / H.263 version 2"),
- .pix_fmts= ff_hwaccel_pixfmt_list_420,
+ .capabilities = CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1 |
+ CODEC_CAP_TRUNCATED | CODEC_CAP_DELAY,
+ .flush = ff_mpeg_flush,
+ .long_name = NULL_IF_CONFIG_SMALL("H.263 / H.263-1996, H.263+ / H.263-1998 / H.263 version 2"),
+ .pix_fmts = ff_hwaccel_pixfmt_list_420,
};
diff --git a/gst-libs/ext/libav/libavcodec/h264.c b/gst-libs/ext/libav/libavcodec/h264.c
index da865c6..8625b0f 100644
--- a/gst-libs/ext/libav/libavcodec/h264.c
+++ b/gst-libs/ext/libav/libavcodec/h264.c
@@ -42,94 +42,118 @@
#include "vdpau_internal.h"
#include "libavutil/avassert.h"
-//#undef NDEBUG
+// #undef NDEBUG
#include <assert.h>
-static const uint8_t rem6[QP_MAX_NUM+1]={
-0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3,
+const uint16_t ff_h264_mb_sizes[4] = { 256, 384, 512, 768 };
+
+static const uint8_t rem6[QP_MAX_NUM + 1] = {
+ 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2,
+ 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5,
+ 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3,
};
-static const uint8_t div6[QP_MAX_NUM+1]={
-0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9,10,10,10,10,
+static const uint8_t div6[QP_MAX_NUM + 1] = {
+ 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3,
+ 3, 3, 3, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6,
+ 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10,
};
-static const enum PixelFormat hwaccel_pixfmt_list_h264_jpeg_420[] = {
- PIX_FMT_DXVA2_VLD,
- PIX_FMT_VAAPI_VLD,
- PIX_FMT_VDA_VLD,
- PIX_FMT_YUVJ420P,
- PIX_FMT_NONE
+static const enum AVPixelFormat hwaccel_pixfmt_list_h264_jpeg_420[] = {
+ AV_PIX_FMT_DXVA2_VLD,
+ AV_PIX_FMT_VAAPI_VLD,
+ AV_PIX_FMT_VDA_VLD,
+ AV_PIX_FMT_YUVJ420P,
+ AV_PIX_FMT_NONE
};
/**
* Check if the top & left blocks are available if needed and
* change the dc mode so it only uses the available blocks.
*/
-int ff_h264_check_intra4x4_pred_mode(H264Context *h){
- MpegEncContext * const s = &h->s;
- static const int8_t top [12]= {-1, 0,LEFT_DC_PRED,-1,-1,-1,-1,-1, 0};
- static const int8_t left[12]= { 0,-1, TOP_DC_PRED, 0,-1,-1,-1, 0,-1,DC_128_PRED};
+int ff_h264_check_intra4x4_pred_mode(H264Context *h)
+{
+ MpegEncContext *const s = &h->s;
+ static const int8_t top[12] = {
+ -1, 0, LEFT_DC_PRED, -1, -1, -1, -1, -1, 0
+ };
+ static const int8_t left[12] = {
+ 0, -1, TOP_DC_PRED, 0, -1, -1, -1, 0, -1, DC_128_PRED
+ };
int i;
- if(!(h->top_samples_available&0x8000)){
- for(i=0; i<4; i++){
- int status= top[ h->intra4x4_pred_mode_cache[scan8[0] + i] ];
- if(status<0){
- av_log(h->s.avctx, AV_LOG_ERROR, "top block unavailable for requested intra4x4 mode %d at %d %d\n", status, s->mb_x, s->mb_y);
+ if (!(h->top_samples_available & 0x8000)) {
+ for (i = 0; i < 4; i++) {
+ int status = top[h->intra4x4_pred_mode_cache[scan8[0] + i]];
+ if (status < 0) {
+ av_log(h->s.avctx, AV_LOG_ERROR,
+ "top block unavailable for requested intra4x4 mode %d at %d %d\n",
+ status, s->mb_x, s->mb_y);
return -1;
- } else if(status){
- h->intra4x4_pred_mode_cache[scan8[0] + i]= status;
+ } else if (status) {
+ h->intra4x4_pred_mode_cache[scan8[0] + i] = status;
}
}
}
- if((h->left_samples_available&0x8888)!=0x8888){
- static const int mask[4]={0x8000,0x2000,0x80,0x20};
- for(i=0; i<4; i++){
- if(!(h->left_samples_available&mask[i])){
- int status= left[ h->intra4x4_pred_mode_cache[scan8[0] + 8*i] ];
- if(status<0){
- av_log(h->s.avctx, AV_LOG_ERROR, "left block unavailable for requested intra4x4 mode %d at %d %d\n", status, s->mb_x, s->mb_y);
+ if ((h->left_samples_available & 0x8888) != 0x8888) {
+ static const int mask[4] = { 0x8000, 0x2000, 0x80, 0x20 };
+ for (i = 0; i < 4; i++)
+ if (!(h->left_samples_available & mask[i])) {
+ int status = left[h->intra4x4_pred_mode_cache[scan8[0] + 8 * i]];
+ if (status < 0) {
+ av_log(h->s.avctx, AV_LOG_ERROR,
+ "left block unavailable for requested intra4x4 mode %d at %d %d\n",
+ status, s->mb_x, s->mb_y);
return -1;
- } else if(status){
- h->intra4x4_pred_mode_cache[scan8[0] + 8*i]= status;
+ } else if (status) {
+ h->intra4x4_pred_mode_cache[scan8[0] + 8 * i] = status;
}
}
- }
}
return 0;
-} //FIXME cleanup like ff_h264_check_intra_pred_mode
+} // FIXME cleanup like ff_h264_check_intra_pred_mode
/**
* Check if the top & left blocks are available if needed and
* change the dc mode so it only uses the available blocks.
*/
-int ff_h264_check_intra_pred_mode(H264Context *h, int mode, int is_chroma){
- MpegEncContext * const s = &h->s;
- static const int8_t top [7]= {LEFT_DC_PRED8x8, 1,-1,-1};
- static const int8_t left[7]= { TOP_DC_PRED8x8,-1, 2,-1,DC_128_PRED8x8};
-
- if(mode > 6U) {
- av_log(h->s.avctx, AV_LOG_ERROR, "out of range intra chroma pred mode at %d %d\n", s->mb_x, s->mb_y);
+int ff_h264_check_intra_pred_mode(H264Context *h, int mode, int is_chroma)
+{
+ MpegEncContext *const s = &h->s;
+ static const int8_t top[7] = { LEFT_DC_PRED8x8, 1, -1, -1 };
+ static const int8_t left[7] = { TOP_DC_PRED8x8, -1, 2, -1, DC_128_PRED8x8 };
+
+ if (mode > 6U) {
+ av_log(h->s.avctx, AV_LOG_ERROR,
+ "out of range intra chroma pred mode at %d %d\n",
+ s->mb_x, s->mb_y);
return -1;
}
- if(!(h->top_samples_available&0x8000)){
- mode= top[ mode ];
- if(mode<0){
- av_log(h->s.avctx, AV_LOG_ERROR, "top block unavailable for requested intra mode at %d %d\n", s->mb_x, s->mb_y);
+ if (!(h->top_samples_available & 0x8000)) {
+ mode = top[mode];
+ if (mode < 0) {
+ av_log(h->s.avctx, AV_LOG_ERROR,
+ "top block unavailable for requested intra mode at %d %d\n",
+ s->mb_x, s->mb_y);
return -1;
}
}
- if((h->left_samples_available&0x8080) != 0x8080){
- mode= left[ mode ];
- if(is_chroma && (h->left_samples_available&0x8080)){ //mad cow disease mode, aka MBAFF + constrained_intra_pred
- mode= ALZHEIMER_DC_L0T_PRED8x8 + (!(h->left_samples_available&0x8000)) + 2*(mode == DC_128_PRED8x8);
+ if ((h->left_samples_available & 0x8080) != 0x8080) {
+ mode = left[mode];
+ if (is_chroma && (h->left_samples_available & 0x8080)) {
+ // mad cow disease mode, aka MBAFF + constrained_intra_pred
+ mode = ALZHEIMER_DC_L0T_PRED8x8 +
+ (!(h->left_samples_available & 0x8000)) +
+ 2 * (mode == DC_128_PRED8x8);
}
- if(mode<0){
- av_log(h->s.avctx, AV_LOG_ERROR, "left block unavailable for requested intra mode at %d %d\n", s->mb_x, s->mb_y);
+ if (mode < 0) {
+ av_log(h->s.avctx, AV_LOG_ERROR,
+ "left block unavailable for requested intra mode at %d %d\n",
+ s->mb_x, s->mb_y);
return -1;
}
}
@@ -137,89 +161,109 @@ int ff_h264_check_intra_pred_mode(H264Context *h, int mode, int is_chroma){
return mode;
}
-const uint8_t *ff_h264_decode_nal(H264Context *h, const uint8_t *src, int *dst_length, int *consumed, int length){
+const uint8_t *ff_h264_decode_nal(H264Context *h, const uint8_t *src,
+ int *dst_length, int *consumed, int length)
+{
int i, si, di;
uint8_t *dst;
int bufidx;
-// src[0]&0x80; //forbidden bit
- h->nal_ref_idc= src[0]>>5;
- h->nal_unit_type= src[0]&0x1F;
+ // src[0]&0x80; // forbidden bit
+ h->nal_ref_idc = src[0] >> 5;
+ h->nal_unit_type = src[0] & 0x1F;
- src++; length--;
+ src++;
+ length--;
+#define STARTCODE_TEST \
+ if (i + 2 < length && src[i + 1] == 0 && src[i + 2] <= 3) { \
+ if (src[i + 2] != 3) { \
+ /* startcode, so we must be past the end */ \
+ length = i; \
+ } \
+ break; \
+ }
#if HAVE_FAST_UNALIGNED
-# if HAVE_FAST_64BIT
-# define RS 7
- for(i=0; i+1<length; i+=9){
- if(!((~AV_RN64A(src+i) & (AV_RN64A(src+i) - 0x0100010001000101ULL)) & 0x8000800080008080ULL))
-# else
-# define RS 3
- for(i=0; i+1<length; i+=5){
- if(!((~AV_RN32A(src+i) & (AV_RN32A(src+i) - 0x01000101U)) & 0x80008080U))
-# endif
+#define FIND_FIRST_ZERO \
+ if (i > 0 && !src[i]) \
+ i--; \
+ while (src[i]) \
+ i++
+#if HAVE_FAST_64BIT
+ for (i = 0; i + 1 < length; i += 9) {
+ if (!((~AV_RN64A(src + i) &
+ (AV_RN64A(src + i) - 0x0100010001000101ULL)) &
+ 0x8000800080008080ULL))
continue;
- if(i>0 && !src[i]) i--;
- while(src[i]) i++;
+ FIND_FIRST_ZERO;
+ STARTCODE_TEST;
+ i -= 7;
+ }
#else
-# define RS 0
- for(i=0; i+1<length; i+=2){
- if(src[i]) continue;
- if(i>0 && src[i-1]==0) i--;
+ for (i = 0; i + 1 < length; i += 5) {
+ if (!((~AV_RN32A(src + i) &
+ (AV_RN32A(src + i) - 0x01000101U)) &
+ 0x80008080U))
+ continue;
+ FIND_FIRST_ZERO;
+ STARTCODE_TEST;
+ i -= 3;
+ }
#endif
- if(i+2<length && src[i+1]==0 && src[i+2]<=3){
- if(src[i+2]!=3){
- /* startcode, so we must be past the end */
- length=i;
- }
- break;
- }
- i-= RS;
+#else
+ for (i = 0; i + 1 < length; i += 2) {
+ if (src[i])
+ continue;
+ if (i > 0 && src[i - 1] == 0)
+ i--;
+ STARTCODE_TEST;
}
+#endif
- if(i>=length-1){ //no escaped 0
- *dst_length= length;
- *consumed= length+1; //+1 for the header
+ if (i >= length - 1) { // no escaped 0
+ *dst_length = length;
+ *consumed = length + 1; // +1 for the header
return src;
}
- bufidx = h->nal_unit_type == NAL_DPC ? 1 : 0; // use second escape buffer for inter data
- av_fast_malloc(&h->rbsp_buffer[bufidx], &h->rbsp_buffer_size[bufidx], length+FF_INPUT_BUFFER_PADDING_SIZE);
- dst= h->rbsp_buffer[bufidx];
+ // use second escape buffer for inter data
+ bufidx = h->nal_unit_type == NAL_DPC ? 1 : 0;
+ av_fast_malloc(&h->rbsp_buffer[bufidx], &h->rbsp_buffer_size[bufidx],
+ length + FF_INPUT_BUFFER_PADDING_SIZE);
+ dst = h->rbsp_buffer[bufidx];
- if (dst == NULL){
+ if (dst == NULL)
return NULL;
- }
-//printf("decoding esc\n");
memcpy(dst, src, i);
- si=di=i;
- while(si+2<length){
- //remove escapes (very rare 1:2^22)
- if(src[si+2]>3){
- dst[di++]= src[si++];
- dst[di++]= src[si++];
- }else if(src[si]==0 && src[si+1]==0){
- if(src[si+2]==3){ //escape
- dst[di++]= 0;
- dst[di++]= 0;
- si+=3;
+ si = di = i;
+ while (si + 2 < length) {
+ // remove escapes (very rare 1:2^22)
+ if (src[si + 2] > 3) {
+ dst[di++] = src[si++];
+ dst[di++] = src[si++];
+ } else if (src[si] == 0 && src[si + 1] == 0) {
+ if (src[si + 2] == 3) { // escape
+ dst[di++] = 0;
+ dst[di++] = 0;
+ si += 3;
continue;
- }else //next start code
+ } else // next start code
goto nsc;
}
- dst[di++]= src[si++];
+ dst[di++] = src[si++];
}
- while(si<length)
- dst[di++]= src[si++];
+ while (si < length)
+ dst[di++] = src[si++];
nsc:
- memset(dst+di, 0, FF_INPUT_BUFFER_PADDING_SIZE);
+ memset(dst + di, 0, FF_INPUT_BUFFER_PADDING_SIZE);
- *dst_length= di;
- *consumed= si + 1;//+1 for the header
-//FIXME store exact number of bits in the getbitcontext (it is needed for decoding)
+ *dst_length = di;
+ *consumed = si + 1; // +1 for the header
+ /* FIXME store exact number of bits in the getbitcontext
+ * (it is needed for decoding) */
return dst;
}
@@ -227,59 +271,68 @@ nsc:
* Identify the exact end of the bitstream
* @return the length of the trailing, or 0 if damaged
*/
-static int ff_h264_decode_rbsp_trailing(H264Context *h, const uint8_t *src){
- int v= *src;
+static int decode_rbsp_trailing(H264Context *h, const uint8_t *src)
+{
+ int v = *src;
int r;
tprintf(h->s.avctx, "rbsp trailing %X\n", v);
- for(r=1; r<9; r++){
- if(v&1) return r;
- v>>=1;
+ for (r = 1; r < 9; r++) {
+ if (v & 1)
+ return r;
+ v >>= 1;
}
return 0;
}
-static inline int get_lowest_part_list_y(H264Context *h, Picture *pic, int n, int height,
- int y_offset, int list){
- int raw_my= h->mv_cache[list][ scan8[n] ][1];
- int filter_height= (raw_my&3) ? 2 : 0;
- int full_my= (raw_my>>2) + y_offset;
- int top = full_my - filter_height, bottom = full_my + height + filter_height;
+static inline int get_lowest_part_list_y(H264Context *h, Picture *pic, int n,
+ int height, int y_offset, int list)
+{
+ int raw_my = h->mv_cache[list][scan8[n]][1];
+ int filter_height_up = (raw_my & 3) ? 2 : 0;
+ int filter_height_down = (raw_my & 3) ? 3 : 0;
+ int full_my = (raw_my >> 2) + y_offset;
+ int top = full_my - filter_height_up;
+ int bottom = full_my + filter_height_down + height;
return FFMAX(abs(top), bottom);
}
-static inline void get_lowest_part_y(H264Context *h, int refs[2][48], int n, int height,
- int y_offset, int list0, int list1, int *nrefs){
- MpegEncContext * const s = &h->s;
+static inline void get_lowest_part_y(H264Context *h, int refs[2][48], int n,
+ int height, int y_offset, int list0,
+ int list1, int *nrefs)
+{
+ MpegEncContext *const s = &h->s;
int my;
- y_offset += 16*(s->mb_y >> MB_FIELD);
+ y_offset += 16 * (s->mb_y >> MB_FIELD);
- if(list0){
- int ref_n = h->ref_cache[0][ scan8[n] ];
- Picture *ref= &h->ref_list[0][ref_n];
+ if (list0) {
+ int ref_n = h->ref_cache[0][scan8[n]];
+ Picture *ref = &h->ref_list[0][ref_n];
// Error resilience puts the current picture in the ref list.
// Don't try to wait on these as it will cause a deadlock.
// Fields can wait on each other, though.
- if (ref->f.thread_opaque != s->current_picture.f.thread_opaque ||
- (ref->f.reference & 3) != s->picture_structure) {
+ if (ref->f.thread_opaque != s->current_picture.f.thread_opaque ||
+ (ref->f.reference & 3) != s->picture_structure) {
my = get_lowest_part_list_y(h, ref, n, height, y_offset, 0);
- if (refs[0][ref_n] < 0) nrefs[0] += 1;
+ if (refs[0][ref_n] < 0)
+ nrefs[0] += 1;
refs[0][ref_n] = FFMAX(refs[0][ref_n], my);
}
}
- if(list1){
- int ref_n = h->ref_cache[1][ scan8[n] ];
- Picture *ref= &h->ref_list[1][ref_n];
+ if (list1) {
+ int ref_n = h->ref_cache[1][scan8[n]];
+ Picture *ref = &h->ref_list[1][ref_n];
- if (ref->f.thread_opaque != s->current_picture.f.thread_opaque ||
- (ref->f.reference & 3) != s->picture_structure) {
+ if (ref->f.thread_opaque != s->current_picture.f.thread_opaque ||
+ (ref->f.reference & 3) != s->picture_structure) {
my = get_lowest_part_list_y(h, ref, n, height, y_offset, 1);
- if (refs[1][ref_n] < 0) nrefs[1] += 1;
+ if (refs[1][ref_n] < 0)
+ nrefs[1] += 1;
refs[1][ref_n] = FFMAX(refs[1][ref_n], my);
}
}
@@ -290,337 +343,321 @@ static inline void get_lowest_part_y(H264Context *h, int refs[2][48], int n, int
*
* @param h the H264 context
*/
-static void await_references(H264Context *h){
- MpegEncContext * const s = &h->s;
- const int mb_xy= h->mb_xy;
+static void await_references(H264Context *h)
+{
+ MpegEncContext *const s = &h->s;
+ const int mb_xy = h->mb_xy;
const int mb_type = s->current_picture.f.mb_type[mb_xy];
int refs[2][48];
- int nrefs[2] = {0};
+ int nrefs[2] = { 0 };
int ref, list;
memset(refs, -1, sizeof(refs));
- if(IS_16X16(mb_type)){
+ if (IS_16X16(mb_type)) {
get_lowest_part_y(h, refs, 0, 16, 0,
- IS_DIR(mb_type, 0, 0), IS_DIR(mb_type, 0, 1), nrefs);
- }else if(IS_16X8(mb_type)){
+ IS_DIR(mb_type, 0, 0), IS_DIR(mb_type, 0, 1), nrefs);
+ } else if (IS_16X8(mb_type)) {
get_lowest_part_y(h, refs, 0, 8, 0,
- IS_DIR(mb_type, 0, 0), IS_DIR(mb_type, 0, 1), nrefs);
+ IS_DIR(mb_type, 0, 0), IS_DIR(mb_type, 0, 1), nrefs);
get_lowest_part_y(h, refs, 8, 8, 8,
- IS_DIR(mb_type, 1, 0), IS_DIR(mb_type, 1, 1), nrefs);
- }else if(IS_8X16(mb_type)){
+ IS_DIR(mb_type, 1, 0), IS_DIR(mb_type, 1, 1), nrefs);
+ } else if (IS_8X16(mb_type)) {
get_lowest_part_y(h, refs, 0, 16, 0,
- IS_DIR(mb_type, 0, 0), IS_DIR(mb_type, 0, 1), nrefs);
+ IS_DIR(mb_type, 0, 0), IS_DIR(mb_type, 0, 1), nrefs);
get_lowest_part_y(h, refs, 4, 16, 0,
- IS_DIR(mb_type, 1, 0), IS_DIR(mb_type, 1, 1), nrefs);
- }else{
+ IS_DIR(mb_type, 1, 0), IS_DIR(mb_type, 1, 1), nrefs);
+ } else {
int i;
assert(IS_8X8(mb_type));
- for(i=0; i<4; i++){
- const int sub_mb_type= h->sub_mb_type[i];
- const int n= 4*i;
- int y_offset= (i&2)<<2;
-
- if(IS_SUB_8X8(sub_mb_type)){
- get_lowest_part_y(h, refs, n , 8, y_offset,
- IS_DIR(sub_mb_type, 0, 0), IS_DIR(sub_mb_type, 0, 1), nrefs);
- }else if(IS_SUB_8X4(sub_mb_type)){
- get_lowest_part_y(h, refs, n , 4, y_offset,
- IS_DIR(sub_mb_type, 0, 0), IS_DIR(sub_mb_type, 0, 1), nrefs);
- get_lowest_part_y(h, refs, n+2, 4, y_offset+4,
- IS_DIR(sub_mb_type, 0, 0), IS_DIR(sub_mb_type, 0, 1), nrefs);
- }else if(IS_SUB_4X8(sub_mb_type)){
- get_lowest_part_y(h, refs, n , 8, y_offset,
- IS_DIR(sub_mb_type, 0, 0), IS_DIR(sub_mb_type, 0, 1), nrefs);
- get_lowest_part_y(h, refs, n+1, 8, y_offset,
- IS_DIR(sub_mb_type, 0, 0), IS_DIR(sub_mb_type, 0, 1), nrefs);
- }else{
+ for (i = 0; i < 4; i++) {
+ const int sub_mb_type = h->sub_mb_type[i];
+ const int n = 4 * i;
+ int y_offset = (i & 2) << 2;
+
+ if (IS_SUB_8X8(sub_mb_type)) {
+ get_lowest_part_y(h, refs, n, 8, y_offset,
+ IS_DIR(sub_mb_type, 0, 0),
+ IS_DIR(sub_mb_type, 0, 1),
+ nrefs);
+ } else if (IS_SUB_8X4(sub_mb_type)) {
+ get_lowest_part_y(h, refs, n, 4, y_offset,
+ IS_DIR(sub_mb_type, 0, 0),
+ IS_DIR(sub_mb_type, 0, 1),
+ nrefs);
+ get_lowest_part_y(h, refs, n + 2, 4, y_offset + 4,
+ IS_DIR(sub_mb_type, 0, 0),
+ IS_DIR(sub_mb_type, 0, 1),
+ nrefs);
+ } else if (IS_SUB_4X8(sub_mb_type)) {
+ get_lowest_part_y(h, refs, n, 8, y_offset,
+ IS_DIR(sub_mb_type, 0, 0),
+ IS_DIR(sub_mb_type, 0, 1),
+ nrefs);
+ get_lowest_part_y(h, refs, n + 1, 8, y_offset,
+ IS_DIR(sub_mb_type, 0, 0),
+ IS_DIR(sub_mb_type, 0, 1),
+ nrefs);
+ } else {
int j;
assert(IS_SUB_4X4(sub_mb_type));
- for(j=0; j<4; j++){
- int sub_y_offset= y_offset + 2*(j&2);
- get_lowest_part_y(h, refs, n+j, 4, sub_y_offset,
- IS_DIR(sub_mb_type, 0, 0), IS_DIR(sub_mb_type, 0, 1), nrefs);
+ for (j = 0; j < 4; j++) {
+ int sub_y_offset = y_offset + 2 * (j & 2);
+ get_lowest_part_y(h, refs, n + j, 4, sub_y_offset,
+ IS_DIR(sub_mb_type, 0, 0),
+ IS_DIR(sub_mb_type, 0, 1),
+ nrefs);
}
}
}
}
- for(list=h->list_count-1; list>=0; list--){
- for(ref=0; ref<48 && nrefs[list]; ref++){
+ for (list = h->list_count - 1; list >= 0; list--)
+ for (ref = 0; ref < 48 && nrefs[list]; ref++) {
int row = refs[list][ref];
- if(row >= 0){
- Picture *ref_pic = &h->ref_list[list][ref];
- int ref_field = ref_pic->f.reference - 1;
+ if (row >= 0) {
+ Picture *ref_pic = &h->ref_list[list][ref];
+ int ref_field = ref_pic->f.reference - 1;
int ref_field_picture = ref_pic->field_picture;
- int pic_height = 16*s->mb_height >> ref_field_picture;
+ int pic_height = 16 * s->mb_height >> ref_field_picture;
row <<= MB_MBAFF;
nrefs[list]--;
- if(!FIELD_PICTURE && ref_field_picture){ // frame referencing two fields
- ff_thread_await_progress((AVFrame*)ref_pic, FFMIN((row >> 1) - !(row&1), pic_height-1), 1);
- ff_thread_await_progress((AVFrame*)ref_pic, FFMIN((row >> 1) , pic_height-1), 0);
- }else if(FIELD_PICTURE && !ref_field_picture){ // field referencing one field of a frame
- ff_thread_await_progress((AVFrame*)ref_pic, FFMIN(row*2 + ref_field , pic_height-1), 0);
- }else if(FIELD_PICTURE){
- ff_thread_await_progress((AVFrame*)ref_pic, FFMIN(row, pic_height-1), ref_field);
- }else{
- ff_thread_await_progress((AVFrame*)ref_pic, FFMIN(row, pic_height-1), 0);
+ if (!FIELD_PICTURE && ref_field_picture) { // frame referencing two fields
+ ff_thread_await_progress(&ref_pic->f,
+ FFMIN((row >> 1) - !(row & 1),
+ pic_height - 1),
+ 1);
+ ff_thread_await_progress(&ref_pic->f,
+ FFMIN((row >> 1), pic_height - 1),
+ 0);
+ } else if (FIELD_PICTURE && !ref_field_picture) { // field referencing one field of a frame
+ ff_thread_await_progress(&ref_pic->f,
+ FFMIN(row * 2 + ref_field,
+ pic_height - 1),
+ 0);
+ } else if (FIELD_PICTURE) {
+ ff_thread_await_progress(&ref_pic->f,
+ FFMIN(row, pic_height - 1),
+ ref_field);
+ } else {
+ ff_thread_await_progress(&ref_pic->f,
+ FFMIN(row, pic_height - 1),
+ 0);
}
}
}
- }
-}
-
-#if 0
-/**
- * DCT transforms the 16 dc values.
- * @param qp quantization parameter ??? FIXME
- */
-static void h264_luma_dc_dct_c(DCTELEM *block/*, int qp*/){
-// const int qmul= dequant_coeff[qp][0];
- int i;
- int temp[16]; //FIXME check if this is a good idea
- static const int x_offset[4]={0, 1*stride, 4* stride, 5*stride};
- static const int y_offset[4]={0, 2*stride, 8* stride, 10*stride};
-
- for(i=0; i<4; i++){
- const int offset= y_offset[i];
- const int z0= block[offset+stride*0] + block[offset+stride*4];
- const int z1= block[offset+stride*0] - block[offset+stride*4];
- const int z2= block[offset+stride*1] - block[offset+stride*5];
- const int z3= block[offset+stride*1] + block[offset+stride*5];
-
- temp[4*i+0]= z0+z3;
- temp[4*i+1]= z1+z2;
- temp[4*i+2]= z1-z2;
- temp[4*i+3]= z0-z3;
- }
-
- for(i=0; i<4; i++){
- const int offset= x_offset[i];
- const int z0= temp[4*0+i] + temp[4*2+i];
- const int z1= temp[4*0+i] - temp[4*2+i];
- const int z2= temp[4*1+i] - temp[4*3+i];
- const int z3= temp[4*1+i] + temp[4*3+i];
-
- block[stride*0 +offset]= (z0 + z3)>>1;
- block[stride*2 +offset]= (z1 + z2)>>1;
- block[stride*8 +offset]= (z1 - z2)>>1;
- block[stride*10+offset]= (z0 - z3)>>1;
- }
}
-#endif
-
-#undef xStride
-#undef stride
-
-#if 0
-static void chroma_dc_dct_c(DCTELEM *block){
- const int stride= 16*2;
- const int xStride= 16;
- int a,b,c,d,e;
-
- a= block[stride*0 + xStride*0];
- b= block[stride*0 + xStride*1];
- c= block[stride*1 + xStride*0];
- d= block[stride*1 + xStride*1];
-
- e= a-b;
- a= a+b;
- b= c-d;
- c= c+d;
-
- block[stride*0 + xStride*0]= (a+c);
- block[stride*0 + xStride*1]= (e+b);
- block[stride*1 + xStride*0]= (a-c);
- block[stride*1 + xStride*1]= (e-b);
-}
-#endif
-static av_always_inline void
-mc_dir_part(H264Context *h, Picture *pic, int n, int square,
- int height, int delta, int list,
- uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr,
- int src_x_offset, int src_y_offset,
- qpel_mc_func *qpix_op, h264_chroma_mc_func chroma_op,
- int pixel_shift, int chroma_idc)
+static av_always_inline void mc_dir_part(H264Context *h, Picture *pic,
+ int n, int square, int height,
+ int delta, int list,
+ uint8_t *dest_y, uint8_t *dest_cb,
+ uint8_t *dest_cr,
+ int src_x_offset, int src_y_offset,
+ qpel_mc_func *qpix_op,
+ h264_chroma_mc_func chroma_op,
+ int pixel_shift, int chroma_idc)
{
- MpegEncContext * const s = &h->s;
- const int mx= h->mv_cache[list][ scan8[n] ][0] + src_x_offset*8;
- int my= h->mv_cache[list][ scan8[n] ][1] + src_y_offset*8;
- const int luma_xy= (mx&3) + ((my&3)<<2);
- int offset = ((mx>>2) << pixel_shift) + (my>>2)*h->mb_linesize;
- uint8_t * src_y = pic->f.data[0] + offset;
- uint8_t * src_cb, * src_cr;
- int extra_width= h->emu_edge_width;
- int extra_height= h->emu_edge_height;
- int emu=0;
- const int full_mx= mx>>2;
- const int full_my= my>>2;
- const int pic_width = 16*s->mb_width;
- const int pic_height = 16*s->mb_height >> MB_FIELD;
+ MpegEncContext *const s = &h->s;
+ const int mx = h->mv_cache[list][scan8[n]][0] + src_x_offset * 8;
+ int my = h->mv_cache[list][scan8[n]][1] + src_y_offset * 8;
+ const int luma_xy = (mx & 3) + ((my & 3) << 2);
+ int offset = ((mx >> 2) << pixel_shift) + (my >> 2) * h->mb_linesize;
+ uint8_t *src_y = pic->f.data[0] + offset;
+ uint8_t *src_cb, *src_cr;
+ int extra_width = h->emu_edge_width;
+ int extra_height = h->emu_edge_height;
+ int emu = 0;
+ const int full_mx = mx >> 2;
+ const int full_my = my >> 2;
+ const int pic_width = 16 * s->mb_width;
+ const int pic_height = 16 * s->mb_height >> MB_FIELD;
int ysh;
- if(mx&7) extra_width -= 3;
- if(my&7) extra_height -= 3;
-
- if( full_mx < 0-extra_width
- || full_my < 0-extra_height
- || full_mx + 16/*FIXME*/ > pic_width + extra_width
- || full_my + 16/*FIXME*/ > pic_height + extra_height){
- s->dsp.emulated_edge_mc(s->edge_emu_buffer, src_y - (2 << pixel_shift) - 2*h->mb_linesize, h->mb_linesize,
- 16+5, 16+5/*FIXME*/, full_mx-2, full_my-2, pic_width, pic_height);
- src_y= s->edge_emu_buffer + (2 << pixel_shift) + 2*h->mb_linesize;
- emu=1;
- }
-
- qpix_op[luma_xy](dest_y, src_y, h->mb_linesize); //FIXME try variable height perhaps?
- if(!square){
+ if (mx & 7)
+ extra_width -= 3;
+ if (my & 7)
+ extra_height -= 3;
+
+ if (full_mx < 0 - extra_width ||
+ full_my < 0 - extra_height ||
+ full_mx + 16 /*FIXME*/ > pic_width + extra_width ||
+ full_my + 16 /*FIXME*/ > pic_height + extra_height) {
+ s->vdsp.emulated_edge_mc(s->edge_emu_buffer,
+ src_y - (2 << pixel_shift) - 2 * h->mb_linesize,
+ h->mb_linesize,
+ 16 + 5, 16 + 5 /*FIXME*/, full_mx - 2,
+ full_my - 2, pic_width, pic_height);
+ src_y = s->edge_emu_buffer + (2 << pixel_shift) + 2 * h->mb_linesize;
+ emu = 1;
+ }
+
+ qpix_op[luma_xy](dest_y, src_y, h->mb_linesize); // FIXME try variable height perhaps?
+ if (!square)
qpix_op[luma_xy](dest_y + delta, src_y + delta, h->mb_linesize);
- }
- if(CONFIG_GRAY && s->flags&CODEC_FLAG_GRAY) return;
+ if (CONFIG_GRAY && s->flags & CODEC_FLAG_GRAY)
+ return;
- if(chroma_idc == 3 /* yuv444 */){
+ if (chroma_idc == 3 /* yuv444 */) {
src_cb = pic->f.data[1] + offset;
- if(emu){
- s->dsp.emulated_edge_mc(s->edge_emu_buffer, src_cb - (2 << pixel_shift) - 2*h->mb_linesize, h->mb_linesize,
- 16+5, 16+5/*FIXME*/, full_mx-2, full_my-2, pic_width, pic_height);
- src_cb= s->edge_emu_buffer + (2 << pixel_shift) + 2*h->mb_linesize;
+ if (emu) {
+ s->vdsp.emulated_edge_mc(s->edge_emu_buffer,
+ src_cb - (2 << pixel_shift) - 2 * h->mb_linesize,
+ h->mb_linesize,
+ 16 + 5, 16 + 5 /*FIXME*/,
+ full_mx - 2, full_my - 2,
+ pic_width, pic_height);
+ src_cb = s->edge_emu_buffer + (2 << pixel_shift) + 2 * h->mb_linesize;
}
- qpix_op[luma_xy](dest_cb, src_cb, h->mb_linesize); //FIXME try variable height perhaps?
- if(!square){
+ qpix_op[luma_xy](dest_cb, src_cb, h->mb_linesize); // FIXME try variable height perhaps?
+ if (!square)
qpix_op[luma_xy](dest_cb + delta, src_cb + delta, h->mb_linesize);
- }
src_cr = pic->f.data[2] + offset;
- if(emu){
- s->dsp.emulated_edge_mc(s->edge_emu_buffer, src_cr - (2 << pixel_shift) - 2*h->mb_linesize, h->mb_linesize,
- 16+5, 16+5/*FIXME*/, full_mx-2, full_my-2, pic_width, pic_height);
- src_cr= s->edge_emu_buffer + (2 << pixel_shift) + 2*h->mb_linesize;
+ if (emu) {
+ s->vdsp.emulated_edge_mc(s->edge_emu_buffer,
+ src_cr - (2 << pixel_shift) - 2 * h->mb_linesize,
+ h->mb_linesize,
+ 16 + 5, 16 + 5 /*FIXME*/,
+ full_mx - 2, full_my - 2,
+ pic_width, pic_height);
+ src_cr = s->edge_emu_buffer + (2 << pixel_shift) + 2 * h->mb_linesize;
}
- qpix_op[luma_xy](dest_cr, src_cr, h->mb_linesize); //FIXME try variable height perhaps?
- if(!square){
+ qpix_op[luma_xy](dest_cr, src_cr, h->mb_linesize); // FIXME try variable height perhaps?
+ if (!square)
qpix_op[luma_xy](dest_cr + delta, src_cr + delta, h->mb_linesize);
- }
return;
}
ysh = 3 - (chroma_idc == 2 /* yuv422 */);
- if(chroma_idc == 1 /* yuv420 */ && MB_FIELD){
+ if (chroma_idc == 1 /* yuv420 */ && MB_FIELD) {
// chroma offset when predicting from a field of opposite parity
- my += 2 * ((s->mb_y & 1) - (pic->f.reference - 1));
- emu |= (my>>3) < 0 || (my>>3) + 8 >= (pic_height>>1);
+ my += 2 * ((s->mb_y & 1) - (pic->f.reference - 1));
+ emu |= (my >> 3) < 0 || (my >> 3) + 8 >= (pic_height >> 1);
}
- src_cb = pic->f.data[1] + ((mx >> 3) << pixel_shift) + (my >> ysh) * h->mb_uvlinesize;
- src_cr = pic->f.data[2] + ((mx >> 3) << pixel_shift) + (my >> ysh) * h->mb_uvlinesize;
+ src_cb = pic->f.data[1] + ((mx >> 3) << pixel_shift) +
+ (my >> ysh) * h->mb_uvlinesize;
+ src_cr = pic->f.data[2] + ((mx >> 3) << pixel_shift) +
+ (my >> ysh) * h->mb_uvlinesize;
- if(emu){
- s->dsp.emulated_edge_mc(s->edge_emu_buffer, src_cb, h->mb_uvlinesize,
- 9, 8 * chroma_idc + 1, (mx >> 3), (my >> ysh),
- pic_width >> 1, pic_height >> (chroma_idc == 1 /* yuv420 */));
- src_cb= s->edge_emu_buffer;
+ if (emu) {
+ s->vdsp.emulated_edge_mc(s->edge_emu_buffer, src_cb, h->mb_uvlinesize,
+ 9, 8 * chroma_idc + 1, (mx >> 3), (my >> ysh),
+ pic_width >> 1, pic_height >> (chroma_idc == 1 /* yuv420 */));
+ src_cb = s->edge_emu_buffer;
}
- chroma_op(dest_cb, src_cb, h->mb_uvlinesize, height >> (chroma_idc == 1 /* yuv420 */),
- mx&7, (my << (chroma_idc == 2 /* yuv422 */)) &7);
+ chroma_op(dest_cb, src_cb, h->mb_uvlinesize,
+ height >> (chroma_idc == 1 /* yuv420 */),
+ mx & 7, (my << (chroma_idc == 2 /* yuv422 */)) & 7);
- if(emu){
- s->dsp.emulated_edge_mc(s->edge_emu_buffer, src_cr, h->mb_uvlinesize,
- 9, 8 * chroma_idc + 1, (mx >> 3), (my >> ysh),
- pic_width >> 1, pic_height >> (chroma_idc == 1 /* yuv420 */));
- src_cr= s->edge_emu_buffer;
+ if (emu) {
+ s->vdsp.emulated_edge_mc(s->edge_emu_buffer, src_cr, h->mb_uvlinesize,
+ 9, 8 * chroma_idc + 1, (mx >> 3), (my >> ysh),
+ pic_width >> 1, pic_height >> (chroma_idc == 1 /* yuv420 */));
+ src_cr = s->edge_emu_buffer;
}
chroma_op(dest_cr, src_cr, h->mb_uvlinesize, height >> (chroma_idc == 1 /* yuv420 */),
- mx&7, (my << (chroma_idc == 2 /* yuv422 */)) &7);
+ mx & 7, (my << (chroma_idc == 2 /* yuv422 */)) & 7);
}
-static av_always_inline void
-mc_part_std(H264Context *h, int n, int square, int height, int delta,
- uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr,
- int x_offset, int y_offset,
- qpel_mc_func *qpix_put, h264_chroma_mc_func chroma_put,
- qpel_mc_func *qpix_avg, h264_chroma_mc_func chroma_avg,
- int list0, int list1, int pixel_shift, int chroma_idc)
+static av_always_inline void mc_part_std(H264Context *h, int n, int square,
+ int height, int delta,
+ uint8_t *dest_y, uint8_t *dest_cb,
+ uint8_t *dest_cr,
+ int x_offset, int y_offset,
+ qpel_mc_func *qpix_put,
+ h264_chroma_mc_func chroma_put,
+ qpel_mc_func *qpix_avg,
+ h264_chroma_mc_func chroma_avg,
+ int list0, int list1,
+ int pixel_shift, int chroma_idc)
{
- MpegEncContext * const s = &h->s;
- qpel_mc_func *qpix_op= qpix_put;
- h264_chroma_mc_func chroma_op= chroma_put;
+ MpegEncContext *const s = &h->s;
+ qpel_mc_func *qpix_op = qpix_put;
+ h264_chroma_mc_func chroma_op = chroma_put;
- dest_y += (2*x_offset << pixel_shift) + 2*y_offset*h->mb_linesize;
+ dest_y += (2 * x_offset << pixel_shift) + 2 * y_offset * h->mb_linesize;
if (chroma_idc == 3 /* yuv444 */) {
- dest_cb += (2*x_offset << pixel_shift) + 2*y_offset*h->mb_linesize;
- dest_cr += (2*x_offset << pixel_shift) + 2*y_offset*h->mb_linesize;
+ dest_cb += (2 * x_offset << pixel_shift) + 2 * y_offset * h->mb_linesize;
+ dest_cr += (2 * x_offset << pixel_shift) + 2 * y_offset * h->mb_linesize;
} else if (chroma_idc == 2 /* yuv422 */) {
- dest_cb += ( x_offset << pixel_shift) + 2*y_offset*h->mb_uvlinesize;
- dest_cr += ( x_offset << pixel_shift) + 2*y_offset*h->mb_uvlinesize;
- } else /* yuv420 */ {
- dest_cb += ( x_offset << pixel_shift) + y_offset*h->mb_uvlinesize;
- dest_cr += ( x_offset << pixel_shift) + y_offset*h->mb_uvlinesize;
+ dest_cb += (x_offset << pixel_shift) + 2 * y_offset * h->mb_uvlinesize;
+ dest_cr += (x_offset << pixel_shift) + 2 * y_offset * h->mb_uvlinesize;
+ } else { /* yuv420 */
+ dest_cb += (x_offset << pixel_shift) + y_offset * h->mb_uvlinesize;
+ dest_cr += (x_offset << pixel_shift) + y_offset * h->mb_uvlinesize;
}
- x_offset += 8*s->mb_x;
- y_offset += 8*(s->mb_y >> MB_FIELD);
+ x_offset += 8 * s->mb_x;
+ y_offset += 8 * (s->mb_y >> MB_FIELD);
- if(list0){
- Picture *ref= &h->ref_list[0][ h->ref_cache[0][ scan8[n] ] ];
+ if (list0) {
+ Picture *ref = &h->ref_list[0][h->ref_cache[0][scan8[n]]];
mc_dir_part(h, ref, n, square, height, delta, 0,
- dest_y, dest_cb, dest_cr, x_offset, y_offset,
- qpix_op, chroma_op, pixel_shift, chroma_idc);
+ dest_y, dest_cb, dest_cr, x_offset, y_offset,
+ qpix_op, chroma_op, pixel_shift, chroma_idc);
- qpix_op= qpix_avg;
- chroma_op= chroma_avg;
+ qpix_op = qpix_avg;
+ chroma_op = chroma_avg;
}
- if(list1){
- Picture *ref= &h->ref_list[1][ h->ref_cache[1][ scan8[n] ] ];
+ if (list1) {
+ Picture *ref = &h->ref_list[1][h->ref_cache[1][scan8[n]]];
mc_dir_part(h, ref, n, square, height, delta, 1,
- dest_y, dest_cb, dest_cr, x_offset, y_offset,
- qpix_op, chroma_op, pixel_shift, chroma_idc);
+ dest_y, dest_cb, dest_cr, x_offset, y_offset,
+ qpix_op, chroma_op, pixel_shift, chroma_idc);
}
}
-static av_always_inline void
-mc_part_weighted(H264Context *h, int n, int square, int height, int delta,
- uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr,
- int x_offset, int y_offset,
- qpel_mc_func *qpix_put, h264_chroma_mc_func chroma_put,
- h264_weight_func luma_weight_op, h264_weight_func chroma_weight_op,
- h264_biweight_func luma_weight_avg, h264_biweight_func chroma_weight_avg,
- int list0, int list1, int pixel_shift, int chroma_idc){
- MpegEncContext * const s = &h->s;
+static av_always_inline void mc_part_weighted(H264Context *h, int n, int square,
+ int height, int delta,
+ uint8_t *dest_y, uint8_t *dest_cb,
+ uint8_t *dest_cr,
+ int x_offset, int y_offset,
+ qpel_mc_func *qpix_put,
+ h264_chroma_mc_func chroma_put,
+ h264_weight_func luma_weight_op,
+ h264_weight_func chroma_weight_op,
+ h264_biweight_func luma_weight_avg,
+ h264_biweight_func chroma_weight_avg,
+ int list0, int list1,
+ int pixel_shift, int chroma_idc)
+{
+ MpegEncContext *const s = &h->s;
int chroma_height;
- dest_y += (2*x_offset << pixel_shift) + 2*y_offset*h->mb_linesize;
+ dest_y += (2 * x_offset << pixel_shift) + 2 * y_offset * h->mb_linesize;
if (chroma_idc == 3 /* yuv444 */) {
- chroma_height = height;
+ chroma_height = height;
chroma_weight_avg = luma_weight_avg;
- chroma_weight_op = luma_weight_op;
- dest_cb += (2*x_offset << pixel_shift) + 2*y_offset*h->mb_linesize;
- dest_cr += (2*x_offset << pixel_shift) + 2*y_offset*h->mb_linesize;
+ chroma_weight_op = luma_weight_op;
+ dest_cb += (2 * x_offset << pixel_shift) + 2 * y_offset * h->mb_linesize;
+ dest_cr += (2 * x_offset << pixel_shift) + 2 * y_offset * h->mb_linesize;
} else if (chroma_idc == 2 /* yuv422 */) {
chroma_height = height;
- dest_cb += ( x_offset << pixel_shift) + 2*y_offset*h->mb_uvlinesize;
- dest_cr += ( x_offset << pixel_shift) + 2*y_offset*h->mb_uvlinesize;
- } else /* yuv420 */ {
+ dest_cb += (x_offset << pixel_shift) + 2 * y_offset * h->mb_uvlinesize;
+ dest_cr += (x_offset << pixel_shift) + 2 * y_offset * h->mb_uvlinesize;
+ } else { /* yuv420 */
chroma_height = height >> 1;
- dest_cb += ( x_offset << pixel_shift) + y_offset*h->mb_uvlinesize;
- dest_cr += ( x_offset << pixel_shift) + y_offset*h->mb_uvlinesize;
+ dest_cb += (x_offset << pixel_shift) + y_offset * h->mb_uvlinesize;
+ dest_cr += (x_offset << pixel_shift) + y_offset * h->mb_uvlinesize;
}
- x_offset += 8*s->mb_x;
- y_offset += 8*(s->mb_y >> MB_FIELD);
+ x_offset += 8 * s->mb_x;
+ y_offset += 8 * (s->mb_y >> MB_FIELD);
- if(list0 && list1){
+ if (list0 && list1) {
/* don't optimize for luma-only case, since B-frames usually
* use implicit weights => chroma too. */
- uint8_t *tmp_cb = s->obmc_scratchpad;
- uint8_t *tmp_cr = s->obmc_scratchpad + (16 << pixel_shift);
- uint8_t *tmp_y = s->obmc_scratchpad + 16*h->mb_uvlinesize;
- int refn0 = h->ref_cache[0][ scan8[n] ];
- int refn1 = h->ref_cache[1][ scan8[n] ];
+ uint8_t *tmp_cb = h->bipred_scratchpad;
+ uint8_t *tmp_cr = h->bipred_scratchpad + (16 << pixel_shift);
+ uint8_t *tmp_y = h->bipred_scratchpad + 16 * h->mb_uvlinesize;
+ int refn0 = h->ref_cache[0][scan8[n]];
+ int refn1 = h->ref_cache[1][scan8[n]];
mc_dir_part(h, &h->ref_list[0][refn0], n, square, height, delta, 0,
dest_y, dest_cb, dest_cr,
@@ -631,215 +668,89 @@ mc_part_weighted(H264Context *h, int n, int square, int height, int delta,
x_offset, y_offset, qpix_put, chroma_put,
pixel_shift, chroma_idc);
- if(h->use_weight == 2){
- int weight0 = h->implicit_weight[refn0][refn1][s->mb_y&1];
+ if (h->use_weight == 2) {
+ int weight0 = h->implicit_weight[refn0][refn1][s->mb_y & 1];
int weight1 = 64 - weight0;
- luma_weight_avg( dest_y, tmp_y, h-> mb_linesize,
- height, 5, weight0, weight1, 0);
+ luma_weight_avg(dest_y, tmp_y, h->mb_linesize,
+ height, 5, weight0, weight1, 0);
chroma_weight_avg(dest_cb, tmp_cb, h->mb_uvlinesize,
chroma_height, 5, weight0, weight1, 0);
chroma_weight_avg(dest_cr, tmp_cr, h->mb_uvlinesize,
chroma_height, 5, weight0, weight1, 0);
- }else{
- luma_weight_avg(dest_y, tmp_y, h->mb_linesize, height, h->luma_log2_weight_denom,
- h->luma_weight[refn0][0][0] , h->luma_weight[refn1][1][0],
- h->luma_weight[refn0][0][1] + h->luma_weight[refn1][1][1]);
- chroma_weight_avg(dest_cb, tmp_cb, h->mb_uvlinesize, chroma_height, h->chroma_log2_weight_denom,
- h->chroma_weight[refn0][0][0][0] , h->chroma_weight[refn1][1][0][0],
- h->chroma_weight[refn0][0][0][1] + h->chroma_weight[refn1][1][0][1]);
- chroma_weight_avg(dest_cr, tmp_cr, h->mb_uvlinesize, chroma_height, h->chroma_log2_weight_denom,
- h->chroma_weight[refn0][0][1][0] , h->chroma_weight[refn1][1][1][0],
- h->chroma_weight[refn0][0][1][1] + h->chroma_weight[refn1][1][1][1]);
+ } else {
+ luma_weight_avg(dest_y, tmp_y, h->mb_linesize, height,
+ h->luma_log2_weight_denom,
+ h->luma_weight[refn0][0][0],
+ h->luma_weight[refn1][1][0],
+ h->luma_weight[refn0][0][1] +
+ h->luma_weight[refn1][1][1]);
+ chroma_weight_avg(dest_cb, tmp_cb, h->mb_uvlinesize, chroma_height,
+ h->chroma_log2_weight_denom,
+ h->chroma_weight[refn0][0][0][0],
+ h->chroma_weight[refn1][1][0][0],
+ h->chroma_weight[refn0][0][0][1] +
+ h->chroma_weight[refn1][1][0][1]);
+ chroma_weight_avg(dest_cr, tmp_cr, h->mb_uvlinesize, chroma_height,
+ h->chroma_log2_weight_denom,
+ h->chroma_weight[refn0][0][1][0],
+ h->chroma_weight[refn1][1][1][0],
+ h->chroma_weight[refn0][0][1][1] +
+ h->chroma_weight[refn1][1][1][1]);
}
- }else{
- int list = list1 ? 1 : 0;
- int refn = h->ref_cache[list][ scan8[n] ];
- Picture *ref= &h->ref_list[list][refn];
+ } else {
+ int list = list1 ? 1 : 0;
+ int refn = h->ref_cache[list][scan8[n]];
+ Picture *ref = &h->ref_list[list][refn];
mc_dir_part(h, ref, n, square, height, delta, list,
dest_y, dest_cb, dest_cr, x_offset, y_offset,
qpix_put, chroma_put, pixel_shift, chroma_idc);
- luma_weight_op(dest_y, h->mb_linesize, height, h->luma_log2_weight_denom,
- h->luma_weight[refn][list][0], h->luma_weight[refn][list][1]);
- if(h->use_weight_chroma){
- chroma_weight_op(dest_cb, h->mb_uvlinesize, chroma_height, h->chroma_log2_weight_denom,
- h->chroma_weight[refn][list][0][0], h->chroma_weight[refn][list][0][1]);
- chroma_weight_op(dest_cr, h->mb_uvlinesize, chroma_height, h->chroma_log2_weight_denom,
- h->chroma_weight[refn][list][1][0], h->chroma_weight[refn][list][1][1]);
+ luma_weight_op(dest_y, h->mb_linesize, height,
+ h->luma_log2_weight_denom,
+ h->luma_weight[refn][list][0],
+ h->luma_weight[refn][list][1]);
+ if (h->use_weight_chroma) {
+ chroma_weight_op(dest_cb, h->mb_uvlinesize, chroma_height,
+ h->chroma_log2_weight_denom,
+ h->chroma_weight[refn][list][0][0],
+ h->chroma_weight[refn][list][0][1]);
+ chroma_weight_op(dest_cr, h->mb_uvlinesize, chroma_height,
+ h->chroma_log2_weight_denom,
+ h->chroma_weight[refn][list][1][0],
+ h->chroma_weight[refn][list][1][1]);
}
}
}
-static av_always_inline void
-mc_part(H264Context *h, int n, int square, int height, int delta,
- uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr,
- int x_offset, int y_offset,
- qpel_mc_func *qpix_put, h264_chroma_mc_func chroma_put,
- qpel_mc_func *qpix_avg, h264_chroma_mc_func chroma_avg,
- h264_weight_func *weight_op, h264_biweight_func *weight_avg,
- int list0, int list1, int pixel_shift, int chroma_idc)
-{
- if((h->use_weight==2 && list0 && list1
- && (h->implicit_weight[ h->ref_cache[0][scan8[n]] ][ h->ref_cache[1][scan8[n]] ][h->s.mb_y&1] != 32))
- || h->use_weight==1)
- mc_part_weighted(h, n, square, height, delta, dest_y, dest_cb, dest_cr,
- x_offset, y_offset, qpix_put, chroma_put,
- weight_op[0], weight_op[1], weight_avg[0],
- weight_avg[1], list0, list1, pixel_shift, chroma_idc);
- else
- mc_part_std(h, n, square, height, delta, dest_y, dest_cb, dest_cr,
- x_offset, y_offset, qpix_put, chroma_put, qpix_avg,
- chroma_avg, list0, list1, pixel_shift, chroma_idc);
-}
-
-static av_always_inline void
-prefetch_motion(H264Context *h, int list, int pixel_shift, int chroma_idc)
+static av_always_inline void prefetch_motion(H264Context *h, int list,
+ int pixel_shift, int chroma_idc)
{
/* fetch pixels for estimated mv 4 macroblocks ahead
* optimized for 64byte cache lines */
- MpegEncContext * const s = &h->s;
+ MpegEncContext *const s = &h->s;
const int refn = h->ref_cache[list][scan8[0]];
- if(refn >= 0){
- const int mx= (h->mv_cache[list][scan8[0]][0]>>2) + 16*s->mb_x + 8;
- const int my= (h->mv_cache[list][scan8[0]][1]>>2) + 16*s->mb_y;
+ if (refn >= 0) {
+ const int mx = (h->mv_cache[list][scan8[0]][0] >> 2) + 16 * s->mb_x + 8;
+ const int my = (h->mv_cache[list][scan8[0]][1] >> 2) + 16 * s->mb_y;
uint8_t **src = h->ref_list[list][refn].f.data;
- int off= (mx << pixel_shift) + (my + (s->mb_x&3)*4)*h->mb_linesize + (64 << pixel_shift);
- s->dsp.prefetch(src[0]+off, s->linesize, 4);
+ int off = (mx << pixel_shift) +
+ (my + (s->mb_x & 3) * 4) * h->mb_linesize +
+ (64 << pixel_shift);
+ s->vdsp.prefetch(src[0] + off, s->linesize, 4);
if (chroma_idc == 3 /* yuv444 */) {
- s->dsp.prefetch(src[1]+off, s->linesize, 4);
- s->dsp.prefetch(src[2]+off, s->linesize, 4);
- }else{
- off= ((mx>>1) << pixel_shift) + ((my>>1) + (s->mb_x&7))*s->uvlinesize + (64 << pixel_shift);
- s->dsp.prefetch(src[1]+off, src[2]-src[1], 2);
- }
- }
-}
-
-static av_always_inline void hl_motion(H264Context *h, uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr,
- qpel_mc_func (*qpix_put)[16], h264_chroma_mc_func (*chroma_put),
- qpel_mc_func (*qpix_avg)[16], h264_chroma_mc_func (*chroma_avg),
- h264_weight_func *weight_op, h264_biweight_func *weight_avg,
- int pixel_shift, int chroma_idc)
-{
- MpegEncContext * const s = &h->s;
- const int mb_xy= h->mb_xy;
- const int mb_type = s->current_picture.f.mb_type[mb_xy];
-
- assert(IS_INTER(mb_type));
-
- if(HAVE_THREADS && (s->avctx->active_thread_type & FF_THREAD_FRAME))
- await_references(h);
- prefetch_motion(h, 0, pixel_shift, chroma_idc);
-
- if(IS_16X16(mb_type)){
- mc_part(h, 0, 1, 16, 0, dest_y, dest_cb, dest_cr, 0, 0,
- qpix_put[0], chroma_put[0], qpix_avg[0], chroma_avg[0],
- weight_op, weight_avg,
- IS_DIR(mb_type, 0, 0), IS_DIR(mb_type, 0, 1),
- pixel_shift, chroma_idc);
- }else if(IS_16X8(mb_type)){
- mc_part(h, 0, 0, 8, 8 << pixel_shift, dest_y, dest_cb, dest_cr, 0, 0,
- qpix_put[1], chroma_put[0], qpix_avg[1], chroma_avg[0],
- weight_op, weight_avg,
- IS_DIR(mb_type, 0, 0), IS_DIR(mb_type, 0, 1),
- pixel_shift, chroma_idc);
- mc_part(h, 8, 0, 8, 8 << pixel_shift, dest_y, dest_cb, dest_cr, 0, 4,
- qpix_put[1], chroma_put[0], qpix_avg[1], chroma_avg[0],
- weight_op, weight_avg,
- IS_DIR(mb_type, 1, 0), IS_DIR(mb_type, 1, 1),
- pixel_shift, chroma_idc);
- }else if(IS_8X16(mb_type)){
- mc_part(h, 0, 0, 16, 8*h->mb_linesize, dest_y, dest_cb, dest_cr, 0, 0,
- qpix_put[1], chroma_put[1], qpix_avg[1], chroma_avg[1],
- &weight_op[1], &weight_avg[1],
- IS_DIR(mb_type, 0, 0), IS_DIR(mb_type, 0, 1),
- pixel_shift, chroma_idc);
- mc_part(h, 4, 0, 16, 8*h->mb_linesize, dest_y, dest_cb, dest_cr, 4, 0,
- qpix_put[1], chroma_put[1], qpix_avg[1], chroma_avg[1],
- &weight_op[1], &weight_avg[1],
- IS_DIR(mb_type, 1, 0), IS_DIR(mb_type, 1, 1),
- pixel_shift, chroma_idc);
- }else{
- int i;
-
- assert(IS_8X8(mb_type));
-
- for(i=0; i<4; i++){
- const int sub_mb_type= h->sub_mb_type[i];
- const int n= 4*i;
- int x_offset= (i&1)<<2;
- int y_offset= (i&2)<<1;
-
- if(IS_SUB_8X8(sub_mb_type)){
- mc_part(h, n, 1, 8, 0, dest_y, dest_cb, dest_cr, x_offset, y_offset,
- qpix_put[1], chroma_put[1], qpix_avg[1], chroma_avg[1],
- &weight_op[1], &weight_avg[1],
- IS_DIR(sub_mb_type, 0, 0), IS_DIR(sub_mb_type, 0, 1),
- pixel_shift, chroma_idc);
- }else if(IS_SUB_8X4(sub_mb_type)){
- mc_part(h, n , 0, 4, 4 << pixel_shift, dest_y, dest_cb, dest_cr, x_offset, y_offset,
- qpix_put[2], chroma_put[1], qpix_avg[2], chroma_avg[1],
- &weight_op[1], &weight_avg[1],
- IS_DIR(sub_mb_type, 0, 0), IS_DIR(sub_mb_type, 0, 1),
- pixel_shift, chroma_idc);
- mc_part(h, n+2, 0, 4, 4 << pixel_shift, dest_y, dest_cb, dest_cr, x_offset, y_offset+2,
- qpix_put[2], chroma_put[1], qpix_avg[2], chroma_avg[1],
- &weight_op[1], &weight_avg[1],
- IS_DIR(sub_mb_type, 0, 0), IS_DIR(sub_mb_type, 0, 1),
- pixel_shift, chroma_idc);
- }else if(IS_SUB_4X8(sub_mb_type)){
- mc_part(h, n , 0, 8, 4*h->mb_linesize, dest_y, dest_cb, dest_cr, x_offset, y_offset,
- qpix_put[2], chroma_put[2], qpix_avg[2], chroma_avg[2],
- &weight_op[2], &weight_avg[2],
- IS_DIR(sub_mb_type, 0, 0), IS_DIR(sub_mb_type, 0, 1),
- pixel_shift, chroma_idc);
- mc_part(h, n+1, 0, 8, 4*h->mb_linesize, dest_y, dest_cb, dest_cr, x_offset+2, y_offset,
- qpix_put[2], chroma_put[2], qpix_avg[2], chroma_avg[2],
- &weight_op[2], &weight_avg[2],
- IS_DIR(sub_mb_type, 0, 0), IS_DIR(sub_mb_type, 0, 1),
- pixel_shift, chroma_idc);
- }else{
- int j;
- assert(IS_SUB_4X4(sub_mb_type));
- for(j=0; j<4; j++){
- int sub_x_offset= x_offset + 2*(j&1);
- int sub_y_offset= y_offset + (j&2);
- mc_part(h, n+j, 1, 4, 0, dest_y, dest_cb, dest_cr, sub_x_offset, sub_y_offset,
- qpix_put[2], chroma_put[2], qpix_avg[2], chroma_avg[2],
- &weight_op[2], &weight_avg[2],
- IS_DIR(sub_mb_type, 0, 0), IS_DIR(sub_mb_type, 0, 1),
- pixel_shift, chroma_idc);
- }
- }
+ s->vdsp.prefetch(src[1] + off, s->linesize, 4);
+ s->vdsp.prefetch(src[2] + off, s->linesize, 4);
+ } else {
+ off = ((mx >> 1) << pixel_shift) +
+ ((my >> 1) + (s->mb_x & 7)) * s->uvlinesize +
+ (64 << pixel_shift);
+ s->vdsp.prefetch(src[1] + off, src[2] - src[1], 2);
}
}
-
- prefetch_motion(h, 1, pixel_shift, chroma_idc);
-}
-
-static av_always_inline void
-hl_motion_420(H264Context *h, uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr,
- qpel_mc_func (*qpix_put)[16], h264_chroma_mc_func (*chroma_put),
- qpel_mc_func (*qpix_avg)[16], h264_chroma_mc_func (*chroma_avg),
- h264_weight_func *weight_op, h264_biweight_func *weight_avg,
- int pixel_shift)
-{
- hl_motion(h, dest_y, dest_cb, dest_cr, qpix_put, chroma_put,
- qpix_avg, chroma_avg, weight_op, weight_avg, pixel_shift, 1);
}
-static av_always_inline void
-hl_motion_422(H264Context *h, uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr,
- qpel_mc_func (*qpix_put)[16], h264_chroma_mc_func (*chroma_put),
- qpel_mc_func (*qpix_avg)[16], h264_chroma_mc_func (*chroma_avg),
- h264_weight_func *weight_op, h264_biweight_func *weight_avg,
- int pixel_shift)
+static void free_tables(H264Context *h, int free_rbsp)
{
- hl_motion(h, dest_y, dest_cb, dest_cr, qpix_put, chroma_put,
- qpix_avg, chroma_avg, weight_op, weight_avg, pixel_shift, 2);
-}
-
-static void free_tables(H264Context *h, int free_rbsp){
int i;
H264Context *hx;
@@ -851,135 +762,148 @@ static void free_tables(H264Context *h, int free_rbsp){
av_freep(&h->direct_table);
av_freep(&h->non_zero_count);
av_freep(&h->slice_table_base);
- h->slice_table= NULL;
+ h->slice_table = NULL;
av_freep(&h->list_counts);
av_freep(&h->mb2b_xy);
av_freep(&h->mb2br_xy);
- for(i = 0; i < MAX_THREADS; i++) {
+ for (i = 0; i < MAX_THREADS; i++) {
hx = h->thread_context[i];
- if(!hx) continue;
+ if (!hx)
+ continue;
av_freep(&hx->top_borders[1]);
av_freep(&hx->top_borders[0]);
- av_freep(&hx->s.obmc_scratchpad);
- if (free_rbsp){
+ av_freep(&hx->bipred_scratchpad);
+ if (free_rbsp) {
av_freep(&hx->rbsp_buffer[1]);
av_freep(&hx->rbsp_buffer[0]);
hx->rbsp_buffer_size[0] = 0;
hx->rbsp_buffer_size[1] = 0;
}
- if (i) av_freep(&h->thread_context[i]);
+ if (i)
+ av_freep(&h->thread_context[i]);
}
}
-static void init_dequant8_coeff_table(H264Context *h){
- int i,j,q,x;
- const int max_qp = 51 + 6*(h->sps.bit_depth_luma-8);
+static void init_dequant8_coeff_table(H264Context *h)
+{
+ int i, j, q, x;
+ const int max_qp = 51 + 6 * (h->sps.bit_depth_luma - 8);
- for(i=0; i<6; i++ ){
+ for (i = 0; i < 6; i++) {
h->dequant8_coeff[i] = h->dequant8_buffer[i];
- for(j=0; j<i; j++){
- if(!memcmp(h->pps.scaling_matrix8[j], h->pps.scaling_matrix8[i], 64*sizeof(uint8_t))){
+ for (j = 0; j < i; j++)
+ if (!memcmp(h->pps.scaling_matrix8[j], h->pps.scaling_matrix8[i],
+ 64 * sizeof(uint8_t))) {
h->dequant8_coeff[i] = h->dequant8_buffer[j];
break;
}
- }
- if(j<i)
+ if (j < i)
continue;
- for(q=0; q<max_qp+1; q++){
+ for (q = 0; q < max_qp + 1; q++) {
int shift = div6[q];
- int idx = rem6[q];
- for(x=0; x<64; x++)
- h->dequant8_coeff[i][q][(x>>3)|((x&7)<<3)] =
- ((uint32_t)dequant8_coeff_init[idx][ dequant8_coeff_init_scan[((x>>1)&12) | (x&3)] ] *
- h->pps.scaling_matrix8[i][x]) << shift;
+ int idx = rem6[q];
+ for (x = 0; x < 64; x++)
+ h->dequant8_coeff[i][q][(x >> 3) | ((x & 7) << 3)] =
+ ((uint32_t)dequant8_coeff_init[idx][dequant8_coeff_init_scan[((x >> 1) & 12) | (x & 3)]] *
+ h->pps.scaling_matrix8[i][x]) << shift;
}
}
}
-static void init_dequant4_coeff_table(H264Context *h){
- int i,j,q,x;
- const int max_qp = 51 + 6*(h->sps.bit_depth_luma-8);
- for(i=0; i<6; i++ ){
+static void init_dequant4_coeff_table(H264Context *h)
+{
+ int i, j, q, x;
+ const int max_qp = 51 + 6 * (h->sps.bit_depth_luma - 8);
+ for (i = 0; i < 6; i++) {
h->dequant4_coeff[i] = h->dequant4_buffer[i];
- for(j=0; j<i; j++){
- if(!memcmp(h->pps.scaling_matrix4[j], h->pps.scaling_matrix4[i], 16*sizeof(uint8_t))){
+ for (j = 0; j < i; j++)
+ if (!memcmp(h->pps.scaling_matrix4[j], h->pps.scaling_matrix4[i],
+ 16 * sizeof(uint8_t))) {
h->dequant4_coeff[i] = h->dequant4_buffer[j];
break;
}
- }
- if(j<i)
+ if (j < i)
continue;
- for(q=0; q<max_qp+1; q++){
+ for (q = 0; q < max_qp + 1; q++) {
int shift = div6[q] + 2;
- int idx = rem6[q];
- for(x=0; x<16; x++)
- h->dequant4_coeff[i][q][(x>>2)|((x<<2)&0xF)] =
- ((uint32_t)dequant4_coeff_init[idx][(x&1) + ((x>>2)&1)] *
- h->pps.scaling_matrix4[i][x]) << shift;
+ int idx = rem6[q];
+ for (x = 0; x < 16; x++)
+ h->dequant4_coeff[i][q][(x >> 2) | ((x << 2) & 0xF)] =
+ ((uint32_t)dequant4_coeff_init[idx][(x & 1) + ((x >> 2) & 1)] *
+ h->pps.scaling_matrix4[i][x]) << shift;
}
}
}
-static void init_dequant_tables(H264Context *h){
- int i,x;
+static void init_dequant_tables(H264Context *h)
+{
+ int i, x;
init_dequant4_coeff_table(h);
- if(h->pps.transform_8x8_mode)
+ if (h->pps.transform_8x8_mode)
init_dequant8_coeff_table(h);
- if(h->sps.transform_bypass){
- for(i=0; i<6; i++)
- for(x=0; x<16; x++)
- h->dequant4_coeff[i][0][x] = 1<<6;
- if(h->pps.transform_8x8_mode)
- for(i=0; i<6; i++)
- for(x=0; x<64; x++)
- h->dequant8_coeff[i][0][x] = 1<<6;
+ if (h->sps.transform_bypass) {
+ for (i = 0; i < 6; i++)
+ for (x = 0; x < 16; x++)
+ h->dequant4_coeff[i][0][x] = 1 << 6;
+ if (h->pps.transform_8x8_mode)
+ for (i = 0; i < 6; i++)
+ for (x = 0; x < 64; x++)
+ h->dequant8_coeff[i][0][x] = 1 << 6;
}
}
-
-int ff_h264_alloc_tables(H264Context *h){
- MpegEncContext * const s = &h->s;
- const int big_mb_num= s->mb_stride * (s->mb_height+1);
- const int row_mb_num= 2*s->mb_stride*s->avctx->thread_count;
- int x,y;
-
- FF_ALLOCZ_OR_GOTO(h->s.avctx, h->intra4x4_pred_mode, row_mb_num * 8 * sizeof(uint8_t), fail)
-
- FF_ALLOCZ_OR_GOTO(h->s.avctx, h->non_zero_count , big_mb_num * 48 * sizeof(uint8_t), fail)
- FF_ALLOCZ_OR_GOTO(h->s.avctx, h->slice_table_base , (big_mb_num+s->mb_stride) * sizeof(*h->slice_table_base), fail)
- FF_ALLOCZ_OR_GOTO(h->s.avctx, h->cbp_table, big_mb_num * sizeof(uint16_t), fail)
-
- FF_ALLOCZ_OR_GOTO(h->s.avctx, h->chroma_pred_mode_table, big_mb_num * sizeof(uint8_t), fail)
- FF_ALLOCZ_OR_GOTO(h->s.avctx, h->mvd_table[0], 16*row_mb_num * sizeof(uint8_t), fail);
- FF_ALLOCZ_OR_GOTO(h->s.avctx, h->mvd_table[1], 16*row_mb_num * sizeof(uint8_t), fail);
- FF_ALLOCZ_OR_GOTO(h->s.avctx, h->direct_table, 4*big_mb_num * sizeof(uint8_t) , fail);
- FF_ALLOCZ_OR_GOTO(h->s.avctx, h->list_counts, big_mb_num * sizeof(uint8_t), fail)
-
- memset(h->slice_table_base, -1, (big_mb_num+s->mb_stride) * sizeof(*h->slice_table_base));
- h->slice_table= h->slice_table_base + s->mb_stride*2 + 1;
-
- FF_ALLOCZ_OR_GOTO(h->s.avctx, h->mb2b_xy , big_mb_num * sizeof(uint32_t), fail);
- FF_ALLOCZ_OR_GOTO(h->s.avctx, h->mb2br_xy , big_mb_num * sizeof(uint32_t), fail);
- for(y=0; y<s->mb_height; y++){
- for(x=0; x<s->mb_width; x++){
- const int mb_xy= x + y*s->mb_stride;
- const int b_xy = 4*x + 4*y*h->b_stride;
-
- h->mb2b_xy [mb_xy]= b_xy;
- h->mb2br_xy[mb_xy]= 8*(FMO ? mb_xy : (mb_xy % (2*s->mb_stride)));
+int ff_h264_alloc_tables(H264Context *h)
+{
+ MpegEncContext *const s = &h->s;
+ const int big_mb_num = s->mb_stride * (s->mb_height + 1);
+ const int row_mb_num = s->mb_stride * 2 * s->avctx->thread_count;
+ int x, y;
+
+ FF_ALLOCZ_OR_GOTO(h->s.avctx, h->intra4x4_pred_mode,
+ row_mb_num * 8 * sizeof(uint8_t), fail)
+ FF_ALLOCZ_OR_GOTO(h->s.avctx, h->non_zero_count,
+ big_mb_num * 48 * sizeof(uint8_t), fail)
+ FF_ALLOCZ_OR_GOTO(h->s.avctx, h->slice_table_base,
+ (big_mb_num + s->mb_stride) * sizeof(*h->slice_table_base), fail)
+ FF_ALLOCZ_OR_GOTO(h->s.avctx, h->cbp_table,
+ big_mb_num * sizeof(uint16_t), fail)
+ FF_ALLOCZ_OR_GOTO(h->s.avctx, h->chroma_pred_mode_table,
+ big_mb_num * sizeof(uint8_t), fail)
+ FF_ALLOCZ_OR_GOTO(h->s.avctx, h->mvd_table[0],
+ 16 * row_mb_num * sizeof(uint8_t), fail);
+ FF_ALLOCZ_OR_GOTO(h->s.avctx, h->mvd_table[1],
+ 16 * row_mb_num * sizeof(uint8_t), fail);
+ FF_ALLOCZ_OR_GOTO(h->s.avctx, h->direct_table,
+ 4 * big_mb_num * sizeof(uint8_t), fail);
+ FF_ALLOCZ_OR_GOTO(h->s.avctx, h->list_counts,
+ big_mb_num * sizeof(uint8_t), fail)
+
+ memset(h->slice_table_base, -1,
+ (big_mb_num + s->mb_stride) * sizeof(*h->slice_table_base));
+ h->slice_table = h->slice_table_base + s->mb_stride * 2 + 1;
+
+ FF_ALLOCZ_OR_GOTO(h->s.avctx, h->mb2b_xy,
+ big_mb_num * sizeof(uint32_t), fail);
+ FF_ALLOCZ_OR_GOTO(h->s.avctx, h->mb2br_xy,
+ big_mb_num * sizeof(uint32_t), fail);
+ for (y = 0; y < s->mb_height; y++)
+ for (x = 0; x < s->mb_width; x++) {
+ const int mb_xy = x + y * s->mb_stride;
+ const int b_xy = 4 * x + 4 * y * h->b_stride;
+
+ h->mb2b_xy[mb_xy] = b_xy;
+ h->mb2br_xy[mb_xy] = 8 * (FMO ? mb_xy : (mb_xy % (2 * s->mb_stride)));
}
- }
-
- s->obmc_scratchpad = NULL;
- if(!h->dequant4_coeff[0])
+ if (!h->dequant4_coeff[0])
init_dequant_tables(h);
return 0;
+
fail:
free_tables(h, 1);
return -1;
@@ -988,87 +912,101 @@ fail:
/**
* Mimic alloc_tables(), but for every context thread.
*/
-static void clone_tables(H264Context *dst, H264Context *src, int i){
- MpegEncContext * const s = &src->s;
- dst->intra4x4_pred_mode = src->intra4x4_pred_mode + i*8*2*s->mb_stride;
- dst->non_zero_count = src->non_zero_count;
- dst->slice_table = src->slice_table;
- dst->cbp_table = src->cbp_table;
- dst->mb2b_xy = src->mb2b_xy;
- dst->mb2br_xy = src->mb2br_xy;
- dst->chroma_pred_mode_table = src->chroma_pred_mode_table;
- dst->mvd_table[0] = src->mvd_table[0] + i*8*2*s->mb_stride;
- dst->mvd_table[1] = src->mvd_table[1] + i*8*2*s->mb_stride;
- dst->direct_table = src->direct_table;
- dst->list_counts = src->list_counts;
-
- dst->s.obmc_scratchpad = NULL;
- ff_h264_pred_init(&dst->hpc, src->s.codec_id, src->sps.bit_depth_luma, src->sps.chroma_format_idc);
+static void clone_tables(H264Context *dst, H264Context *src, int i)
+{
+ MpegEncContext *const s = &src->s;
+ dst->intra4x4_pred_mode = src->intra4x4_pred_mode + i * 8 * 2 * s->mb_stride;
+ dst->non_zero_count = src->non_zero_count;
+ dst->slice_table = src->slice_table;
+ dst->cbp_table = src->cbp_table;
+ dst->mb2b_xy = src->mb2b_xy;
+ dst->mb2br_xy = src->mb2br_xy;
+ dst->chroma_pred_mode_table = src->chroma_pred_mode_table;
+ dst->mvd_table[0] = src->mvd_table[0] + i * 8 * 2 * s->mb_stride;
+ dst->mvd_table[1] = src->mvd_table[1] + i * 8 * 2 * s->mb_stride;
+ dst->direct_table = src->direct_table;
+ dst->list_counts = src->list_counts;
+ dst->bipred_scratchpad = NULL;
+ ff_h264_pred_init(&dst->hpc, src->s.codec_id, src->sps.bit_depth_luma,
+ src->sps.chroma_format_idc);
}
/**
* Init context
* Allocate buffers which are not shared amongst multiple threads.
*/
-static int context_init(H264Context *h){
- FF_ALLOCZ_OR_GOTO(h->s.avctx, h->top_borders[0], h->s.mb_width * 16*3 * sizeof(uint8_t)*2, fail)
- FF_ALLOCZ_OR_GOTO(h->s.avctx, h->top_borders[1], h->s.mb_width * 16*3 * sizeof(uint8_t)*2, fail)
-
- h->ref_cache[0][scan8[5 ]+1] = h->ref_cache[0][scan8[7 ]+1] = h->ref_cache[0][scan8[13]+1] =
- h->ref_cache[1][scan8[5 ]+1] = h->ref_cache[1][scan8[7 ]+1] = h->ref_cache[1][scan8[13]+1] = PART_NOT_AVAILABLE;
+static int context_init(H264Context *h)
+{
+ FF_ALLOCZ_OR_GOTO(h->s.avctx, h->top_borders[0],
+ h->s.mb_width * 16 * 3 * sizeof(uint8_t) * 2, fail)
+ FF_ALLOCZ_OR_GOTO(h->s.avctx, h->top_borders[1],
+ h->s.mb_width * 16 * 3 * sizeof(uint8_t) * 2, fail)
+
+ h->ref_cache[0][scan8[5] + 1] =
+ h->ref_cache[0][scan8[7] + 1] =
+ h->ref_cache[0][scan8[13] + 1] =
+ h->ref_cache[1][scan8[5] + 1] =
+ h->ref_cache[1][scan8[7] + 1] =
+ h->ref_cache[1][scan8[13] + 1] = PART_NOT_AVAILABLE;
return 0;
+
fail:
return -1; // free_tables will clean up for us
}
-static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size);
+static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size,
+ int parse_extradata);
-static av_cold void common_init(H264Context *h){
- MpegEncContext * const s = &h->s;
+static av_cold void common_init(H264Context *h)
+{
+ MpegEncContext *const s = &h->s;
- s->width = s->avctx->width;
- s->height = s->avctx->height;
- s->codec_id= s->avctx->codec->id;
+ s->width = s->avctx->width;
+ s->height = s->avctx->height;
+ s->codec_id = s->avctx->codec->id;
ff_h264dsp_init(&h->h264dsp, 8, 1);
ff_h264_pred_init(&h->hpc, s->codec_id, 8, 1);
- h->dequant_coeff_pps= -1;
- s->unrestricted_mv=1;
+ h->dequant_coeff_pps = -1;
+ s->unrestricted_mv = 1;
- dsputil_init(&s->dsp, s->avctx); // needed so that idct permutation is known early
+ /* needed so that IDCT permutation is known early */
+ ff_dsputil_init(&s->dsp, s->avctx);
+ ff_videodsp_init(&s->vdsp, 8);
- memset(h->pps.scaling_matrix4, 16, 6*16*sizeof(uint8_t));
- memset(h->pps.scaling_matrix8, 16, 2*64*sizeof(uint8_t));
+ memset(h->pps.scaling_matrix4, 16, 6 * 16 * sizeof(uint8_t));
+ memset(h->pps.scaling_matrix8, 16, 2 * 64 * sizeof(uint8_t));
}
int ff_h264_decode_extradata(H264Context *h)
{
AVCodecContext *avctx = h->s.avctx;
- if(avctx->extradata[0] == 1){
+ if (avctx->extradata[0] == 1) {
int i, cnt, nalsize;
unsigned char *p = avctx->extradata;
h->is_avc = 1;
- if(avctx->extradata_size < 7) {
+ if (avctx->extradata_size < 7) {
av_log(avctx, AV_LOG_ERROR, "avcC too short\n");
return -1;
}
/* sps and pps in the avcC always have length coded with 2 bytes,
- so put a fake nal_length_size = 2 while parsing them */
+ * so put a fake nal_length_size = 2 while parsing them */
h->nal_length_size = 2;
// Decode sps from avcC
- cnt = *(p+5) & 0x1f; // Number of sps
- p += 6;
+ cnt = *(p + 5) & 0x1f; // Number of sps
+ p += 6;
for (i = 0; i < cnt; i++) {
nalsize = AV_RB16(p) + 2;
if (p - avctx->extradata + nalsize > avctx->extradata_size)
return -1;
- if(decode_nal_units(h, p, nalsize) < 0) {
- av_log(avctx, AV_LOG_ERROR, "Decoding sps %d from avcC failed\n", i);
+ if (decode_nal_units(h, p, nalsize, 1) < 0) {
+ av_log(avctx, AV_LOG_ERROR,
+ "Decoding sps %d from avcC failed\n", i);
return -1;
}
p += nalsize;
@@ -1079,40 +1017,42 @@ int ff_h264_decode_extradata(H264Context *h)
nalsize = AV_RB16(p) + 2;
if (p - avctx->extradata + nalsize > avctx->extradata_size)
return -1;
- if (decode_nal_units(h, p, nalsize) < 0) {
- av_log(avctx, AV_LOG_ERROR, "Decoding pps %d from avcC failed\n", i);
+ if (decode_nal_units(h, p, nalsize, 1) < 0) {
+ av_log(avctx, AV_LOG_ERROR,
+ "Decoding pps %d from avcC failed\n", i);
return -1;
}
p += nalsize;
}
- // Now store right nal length size, that will be use to parse all other nals
+ // Now store right nal length size, that will be used to parse all other nals
h->nal_length_size = (avctx->extradata[4] & 0x03) + 1;
} else {
h->is_avc = 0;
- if(decode_nal_units(h, avctx->extradata, avctx->extradata_size) < 0)
+ if (decode_nal_units(h, avctx->extradata, avctx->extradata_size, 1) < 0)
return -1;
}
return 0;
}
-av_cold int ff_h264_decode_init(AVCodecContext *avctx){
- H264Context *h= avctx->priv_data;
- MpegEncContext * const s = &h->s;
+av_cold int ff_h264_decode_init(AVCodecContext *avctx)
+{
+ H264Context *h = avctx->priv_data;
+ MpegEncContext *const s = &h->s;
int i;
- MPV_decode_defaults(s);
+ ff_MPV_decode_defaults(s);
s->avctx = avctx;
common_init(h);
- s->out_format = FMT_H264;
- s->workaround_bugs= avctx->workaround_bugs;
+ s->out_format = FMT_H264;
+ s->workaround_bugs = avctx->workaround_bugs;
- // set defaults
-// s->decode_mb= ff_h263_decode_mb;
+ /* set defaults */
+ // s->decode_mb = ff_h263_decode_mb;
s->quarter_sample = 1;
- if(!avctx->has_b_frames)
- s->low_delay= 1;
+ if (!avctx->has_b_frames)
+ s->low_delay = 1;
avctx->chroma_sample_location = AVCHROMA_LOC_LEFT;
@@ -1122,39 +1062,43 @@ av_cold int ff_h264_decode_init(AVCodecContext *avctx){
h->sps.bit_depth_luma = avctx->bits_per_raw_sample = 8;
h->thread_context[0] = h;
- h->outputed_poc = h->next_outputed_poc = INT_MIN;
+ h->outputed_poc = h->next_outputed_poc = INT_MIN;
for (i = 0; i < MAX_DELAYED_PIC_COUNT; i++)
h->last_pocs[i] = INT_MIN;
- h->prev_poc_msb= 1<<16;
- h->x264_build = -1;
+ h->prev_poc_msb = 1 << 16;
+ h->x264_build = -1;
ff_h264_reset_sei(h);
- if(avctx->codec_id == CODEC_ID_H264){
- if(avctx->ticks_per_frame == 1){
- s->avctx->time_base.den *=2;
- }
+ if (avctx->codec_id == AV_CODEC_ID_H264) {
+ if (avctx->ticks_per_frame == 1)
+ s->avctx->time_base.den *= 2;
avctx->ticks_per_frame = 2;
}
- if(avctx->extradata_size > 0 && avctx->extradata &&
+ if (avctx->extradata_size > 0 && avctx->extradata &&
ff_h264_decode_extradata(h))
return -1;
- if(h->sps.bitstream_restriction_flag && s->avctx->has_b_frames < h->sps.num_reorder_frames){
+ if (h->sps.bitstream_restriction_flag &&
+ s->avctx->has_b_frames < h->sps.num_reorder_frames) {
s->avctx->has_b_frames = h->sps.num_reorder_frames;
- s->low_delay = 0;
+ s->low_delay = 0;
}
return 0;
}
-#define IN_RANGE(a, b, size) (((a) >= (b)) && ((a) < ((b)+(size))))
-static void copy_picture_range(Picture **to, Picture **from, int count, MpegEncContext *new_base, MpegEncContext *old_base)
+#define IN_RANGE(a, b, size) (((a) >= (b)) && ((a) < ((b) + (size))))
+
+static void copy_picture_range(Picture **to, Picture **from, int count,
+ MpegEncContext *new_base,
+ MpegEncContext *old_base)
{
int i;
- for (i=0; i<count; i++){
+ for (i = 0; i < count; i++) {
assert((IN_RANGE(from[i], old_base, sizeof(*old_base)) ||
- IN_RANGE(from[i], old_base->picture, sizeof(Picture) * old_base->picture_count) ||
+ IN_RANGE(from[i], old_base->picture,
+ sizeof(Picture) * old_base->picture_count) ||
!from[i]));
to[i] = REBASE_PICTURE(from[i], new_base, old_base);
}
@@ -1164,46 +1108,96 @@ static void copy_parameter_set(void **to, void **from, int count, int size)
{
int i;
- for (i=0; i<count; i++){
- if (to[i] && !from[i]) av_freep(&to[i]);
- else if (from[i] && !to[i]) to[i] = av_malloc(size);
+ for (i = 0; i < count; i++) {
+ if (to[i] && !from[i])
+ av_freep(&to[i]);
+ else if (from[i] && !to[i])
+ to[i] = av_malloc(size);
- if (from[i]) memcpy(to[i], from[i], size);
+ if (from[i])
+ memcpy(to[i], from[i], size);
}
}
-static int decode_init_thread_copy(AVCodecContext *avctx){
- H264Context *h= avctx->priv_data;
+static int decode_init_thread_copy(AVCodecContext *avctx)
+{
+ H264Context *h = avctx->priv_data;
if (!avctx->internal->is_copy)
return 0;
memset(h->sps_buffers, 0, sizeof(h->sps_buffers));
memset(h->pps_buffers, 0, sizeof(h->pps_buffers));
+ h->s.context_initialized = 0;
+
return 0;
}
-#define copy_fields(to, from, start_field, end_field) memcpy(&to->start_field, &from->start_field, (char*)&to->end_field - (char*)&to->start_field)
-static int decode_update_thread_context(AVCodecContext *dst, const AVCodecContext *src){
- H264Context *h= dst->priv_data, *h1= src->priv_data;
- MpegEncContext * const s = &h->s, * const s1 = &h1->s;
+#define copy_fields(to, from, start_field, end_field) \
+ memcpy(&to->start_field, &from->start_field, \
+ (char *)&to->end_field - (char *)&to->start_field)
+
+static int h264_slice_header_init(H264Context *, int);
+
+static int h264_set_parameter_from_sps(H264Context *h);
+
+static int decode_update_thread_context(AVCodecContext *dst,
+ const AVCodecContext *src)
+{
+ H264Context *h = dst->priv_data, *h1 = src->priv_data;
+ MpegEncContext *const s = &h->s, *const s1 = &h1->s;
int inited = s->context_initialized, err;
int i;
- if(dst == src || !s1->context_initialized) return 0;
+ if (dst == src || !s1->context_initialized)
+ return 0;
+
+ if (inited &&
+ (s->width != s1->width ||
+ s->height != s1->height ||
+ s->mb_width != s1->mb_width ||
+ s->mb_height != s1->mb_height ||
+ h->sps.bit_depth_luma != h1->sps.bit_depth_luma ||
+ h->sps.chroma_format_idc != h1->sps.chroma_format_idc ||
+ h->sps.colorspace != h1->sps.colorspace)) {
+
+ av_freep(&h->bipred_scratchpad);
+
+ s->width = s1->width;
+ s->height = s1->height;
+ s->mb_height = s1->mb_height;
+ h->b_stride = h1->b_stride;
+
+ if ((err = h264_slice_header_init(h, 1)) < 0) {
+ av_log(h->s.avctx, AV_LOG_ERROR, "h264_slice_header_init() failed");
+ return err;
+ }
+ h->context_reinitialized = 1;
+
+ /* update linesize on resize for h264. The h264 decoder doesn't
+ * necessarily call ff_MPV_frame_start in the new thread */
+ s->linesize = s1->linesize;
+ s->uvlinesize = s1->uvlinesize;
+
+ /* copy block_offset since frame_start may not be called */
+ memcpy(h->block_offset, h1->block_offset, sizeof(h->block_offset));
+ h264_set_parameter_from_sps(h);
+ }
err = ff_mpeg_update_thread_context(dst, src);
- if(err) return err;
+ if (err)
+ return err;
- //FIXME handle width/height changing
- if(!inited){
- for(i = 0; i < MAX_SPS_COUNT; i++)
+ if (!inited) {
+ for (i = 0; i < MAX_SPS_COUNT; i++)
av_freep(h->sps_buffers + i);
- for(i = 0; i < MAX_PPS_COUNT; i++)
+ for (i = 0; i < MAX_PPS_COUNT; i++)
av_freep(h->pps_buffers + i);
- memcpy(&h->s + 1, &h1->s + 1, sizeof(H264Context) - sizeof(MpegEncContext)); //copy all fields after MpegEnc
+ // copy all fields after MpegEnc
+ memcpy(&h->s + 1, &h1->s + 1,
+ sizeof(H264Context) - sizeof(MpegEncContext));
memset(h->sps_buffers, 0, sizeof(h->sps_buffers));
memset(h->pps_buffers, 0, sizeof(h->pps_buffers));
if (ff_h264_alloc_tables(h) < 0) {
@@ -1212,140 +1206,153 @@ static int decode_update_thread_context(AVCodecContext *dst, const AVCodecContex
}
context_init(h);
- for(i=0; i<2; i++){
- h->rbsp_buffer[i] = NULL;
+ for (i = 0; i < 2; i++) {
+ h->rbsp_buffer[i] = NULL;
h->rbsp_buffer_size[i] = 0;
}
+ h->bipred_scratchpad = NULL;
h->thread_context[0] = h;
- // frame_start may not be called for the next thread (if it's decoding a bottom field)
- // so this has to be allocated here
- h->s.obmc_scratchpad = av_malloc(16*6*s->linesize);
-
s->dsp.clear_blocks(h->mb);
- s->dsp.clear_blocks(h->mb+(24*16<<h->pixel_shift));
+ s->dsp.clear_blocks(h->mb + (24 * 16 << h->pixel_shift));
}
- //extradata/NAL handling
- h->is_avc = h1->is_avc;
+ /* frame_start may not be called for the next thread (if it's decoding
+ * a bottom field) so this has to be allocated here */
+ if (!h->bipred_scratchpad)
+ h->bipred_scratchpad = av_malloc(16 * 6 * s->linesize);
- //SPS/PPS
- copy_parameter_set((void**)h->sps_buffers, (void**)h1->sps_buffers, MAX_SPS_COUNT, sizeof(SPS));
- h->sps = h1->sps;
- copy_parameter_set((void**)h->pps_buffers, (void**)h1->pps_buffers, MAX_PPS_COUNT, sizeof(PPS));
- h->pps = h1->pps;
+ // extradata/NAL handling
+ h->is_avc = h1->is_avc;
- //Dequantization matrices
- //FIXME these are big - can they be only copied when PPS changes?
+ // SPS/PPS
+ copy_parameter_set((void **)h->sps_buffers, (void **)h1->sps_buffers,
+ MAX_SPS_COUNT, sizeof(SPS));
+ h->sps = h1->sps;
+ copy_parameter_set((void **)h->pps_buffers, (void **)h1->pps_buffers,
+ MAX_PPS_COUNT, sizeof(PPS));
+ h->pps = h1->pps;
+
+ // Dequantization matrices
+ // FIXME these are big - can they be only copied when PPS changes?
copy_fields(h, h1, dequant4_buffer, dequant4_coeff);
- for(i=0; i<6; i++)
- h->dequant4_coeff[i] = h->dequant4_buffer[0] + (h1->dequant4_coeff[i] - h1->dequant4_buffer[0]);
+ for (i = 0; i < 6; i++)
+ h->dequant4_coeff[i] = h->dequant4_buffer[0] +
+ (h1->dequant4_coeff[i] - h1->dequant4_buffer[0]);
- for(i=0; i<6; i++)
- h->dequant8_coeff[i] = h->dequant8_buffer[0] + (h1->dequant8_coeff[i] - h1->dequant8_buffer[0]);
+ for (i = 0; i < 6; i++)
+ h->dequant8_coeff[i] = h->dequant8_buffer[0] +
+ (h1->dequant8_coeff[i] - h1->dequant8_buffer[0]);
h->dequant_coeff_pps = h1->dequant_coeff_pps;
- //POC timing
+ // POC timing
copy_fields(h, h1, poc_lsb, redundant_pic_count);
- //reference lists
+ // reference lists
copy_fields(h, h1, ref_count, list_count);
- copy_fields(h, h1, ref_list, intra_gb);
+ copy_fields(h, h1, ref_list, intra_gb);
copy_fields(h, h1, short_ref, cabac_init_idc);
- copy_picture_range(h->short_ref, h1->short_ref, 32, s, s1);
- copy_picture_range(h->long_ref, h1->long_ref, 32, s, s1);
- copy_picture_range(h->delayed_pic, h1->delayed_pic, MAX_DELAYED_PIC_COUNT+2, s, s1);
+ copy_picture_range(h->short_ref, h1->short_ref, 32, s, s1);
+ copy_picture_range(h->long_ref, h1->long_ref, 32, s, s1);
+ copy_picture_range(h->delayed_pic, h1->delayed_pic,
+ MAX_DELAYED_PIC_COUNT + 2, s, s1);
h->last_slice_type = h1->last_slice_type;
- if(!s->current_picture_ptr) return 0;
+ if (!s->current_picture_ptr)
+ return 0;
- if(!s->dropable) {
+ if (!s->droppable) {
err = ff_h264_execute_ref_pic_marking(h, h->mmco, h->mmco_index);
- h->prev_poc_msb = h->poc_msb;
- h->prev_poc_lsb = h->poc_lsb;
+ h->prev_poc_msb = h->poc_msb;
+ h->prev_poc_lsb = h->poc_lsb;
}
- h->prev_frame_num_offset= h->frame_num_offset;
- h->prev_frame_num = h->frame_num;
- h->outputed_poc = h->next_outputed_poc;
+ h->prev_frame_num_offset = h->frame_num_offset;
+ h->prev_frame_num = h->frame_num;
+ h->outputed_poc = h->next_outputed_poc;
return err;
}
-int ff_h264_frame_start(H264Context *h){
- MpegEncContext * const s = &h->s;
+int ff_h264_frame_start(H264Context *h)
+{
+ MpegEncContext *const s = &h->s;
int i;
const int pixel_shift = h->pixel_shift;
- if(MPV_frame_start(s, s->avctx) < 0)
+ if (ff_MPV_frame_start(s, s->avctx) < 0)
return -1;
ff_er_frame_start(s);
/*
- * MPV_frame_start uses pict_type to derive key_frame.
+ * ff_MPV_frame_start uses pict_type to derive key_frame.
* This is incorrect for H.264; IDR markings must be used.
* Zero here; IDR markings per slice in frame or fields are ORed in later.
* See decode_nal_units().
*/
s->current_picture_ptr->f.key_frame = 0;
- s->current_picture_ptr->mmco_reset= 0;
+ s->current_picture_ptr->mmco_reset = 0;
assert(s->linesize && s->uvlinesize);
- for(i=0; i<16; i++){
- h->block_offset[i]= (4*((scan8[i] - scan8[0])&7) << pixel_shift) + 4*s->linesize*((scan8[i] - scan8[0])>>3);
- h->block_offset[48+i]= (4*((scan8[i] - scan8[0])&7) << pixel_shift) + 8*s->linesize*((scan8[i] - scan8[0])>>3);
+ for (i = 0; i < 16; i++) {
+ h->block_offset[i] = (4 * ((scan8[i] - scan8[0]) & 7) << pixel_shift) + 4 * s->linesize * ((scan8[i] - scan8[0]) >> 3);
+ h->block_offset[48 + i] = (4 * ((scan8[i] - scan8[0]) & 7) << pixel_shift) + 8 * s->linesize * ((scan8[i] - scan8[0]) >> 3);
}
- for(i=0; i<16; i++){
- h->block_offset[16+i]=
- h->block_offset[32+i]= (4*((scan8[i] - scan8[0])&7) << pixel_shift) + 4*s->uvlinesize*((scan8[i] - scan8[0])>>3);
- h->block_offset[48+16+i]=
- h->block_offset[48+32+i]= (4*((scan8[i] - scan8[0])&7) << pixel_shift) + 8*s->uvlinesize*((scan8[i] - scan8[0])>>3);
+ for (i = 0; i < 16; i++) {
+ h->block_offset[16 + i] =
+ h->block_offset[32 + i] = (4 * ((scan8[i] - scan8[0]) & 7) << pixel_shift) + 4 * s->uvlinesize * ((scan8[i] - scan8[0]) >> 3);
+ h->block_offset[48 + 16 + i] =
+ h->block_offset[48 + 32 + i] = (4 * ((scan8[i] - scan8[0]) & 7) << pixel_shift) + 8 * s->uvlinesize * ((scan8[i] - scan8[0]) >> 3);
}
/* can't be in alloc_tables because linesize isn't known there.
* FIXME: redo bipred weight to not require extra buffer? */
- for(i = 0; i < s->slice_context_count; i++)
- if(h->thread_context[i] && !h->thread_context[i]->s.obmc_scratchpad)
- h->thread_context[i]->s.obmc_scratchpad = av_malloc(16*6*s->linesize);
-
- /* some macroblocks can be accessed before they're available in case of lost slices, mbaff or threading*/
- memset(h->slice_table, -1, (s->mb_height*s->mb_stride-1) * sizeof(*h->slice_table));
-
-// s->decode = (s->flags & CODEC_FLAG_PSNR) || !s->encoding || s->current_picture.f.reference /*|| h->contains_intra*/ || 1;
-
- // We mark the current picture as non-reference after allocating it, so
- // that if we break out due to an error it can be released automatically
- // in the next MPV_frame_start().
- // SVQ3 as well as most other codecs have only last/next/current and thus
- // get released even with set reference, besides SVQ3 and others do not
- // mark frames as reference later "naturally".
- if(s->codec_id != CODEC_ID_SVQ3)
+ for (i = 0; i < s->slice_context_count; i++)
+ if (h->thread_context[i] && !h->thread_context[i]->bipred_scratchpad)
+ h->thread_context[i]->bipred_scratchpad = av_malloc(16 * 6 * s->linesize);
+
+ /* Some macroblocks can be accessed before they're available in case
+ * of lost slices, MBAFF or threading. */
+ memset(h->slice_table, -1,
+ (s->mb_height * s->mb_stride - 1) * sizeof(*h->slice_table));
+
+ // s->decode = (s->flags & CODEC_FLAG_PSNR) || !s->encoding ||
+ // s->current_picture.f.reference /* || h->contains_intra */ || 1;
+
+ /* We mark the current picture as non-reference after allocating it, so
+ * that if we break out due to an error it can be released automatically
+ * in the next ff_MPV_frame_start().
+ * SVQ3 as well as most other codecs have only last/next/current and thus
+ * get released even with set reference, besides SVQ3 and others do not
+ * mark frames as reference later "naturally". */
+ if (s->codec_id != AV_CODEC_ID_SVQ3)
s->current_picture_ptr->f.reference = 0;
- s->current_picture_ptr->field_poc[0]=
- s->current_picture_ptr->field_poc[1]= INT_MAX;
+ s->current_picture_ptr->field_poc[0] =
+ s->current_picture_ptr->field_poc[1] = INT_MAX;
h->next_output_pic = NULL;
- assert(s->current_picture_ptr->long_ref==0);
+ assert(s->current_picture_ptr->long_ref == 0);
return 0;
}
/**
- * Run setup operations that must be run after slice header decoding.
- * This includes finding the next displayed frame.
- *
- * @param h h264 master context
- * @param setup_finished enough NALs have been read that we can call
- * ff_thread_finish_setup()
- */
-static void decode_postinit(H264Context *h, int setup_finished){
- MpegEncContext * const s = &h->s;
+ * Run setup operations that must be run after slice header decoding.
+ * This includes finding the next displayed frame.
+ *
+ * @param h h264 master context
+ * @param setup_finished enough NALs have been read that we can call
+ * ff_thread_finish_setup()
+ */
+static void decode_postinit(H264Context *h, int setup_finished)
+{
+ MpegEncContext *const s = &h->s;
Picture *out = s->current_picture_ptr;
Picture *cur = s->current_picture_ptr;
int i, pics, out_of_order, out_idx;
@@ -1354,13 +1361,15 @@ static void decode_postinit(H264Context *h, int setup_finished){
s->current_picture_ptr->f.qscale_type = FF_QSCALE_TYPE_H264;
s->current_picture_ptr->f.pict_type = s->pict_type;
- if (h->next_output_pic) return;
+ if (h->next_output_pic)
+ return;
- if (cur->field_poc[0]==INT_MAX || cur->field_poc[1]==INT_MAX) {
- //FIXME: if we have two PAFF fields in one packet, we can't start the next thread here.
- //If we have one field per packet, we can. The check in decode_nal_units() is not good enough
- //to find this yet, so we assume the worst for now.
- //if (setup_finished)
+ if (cur->field_poc[0] == INT_MAX || cur->field_poc[1] == INT_MAX) {
+ /* FIXME: if we have two PAFF fields in one packet, we can't start
+ * the next thread here. If we have one field per packet, we can.
+ * The check in decode_nal_units() is not good enough to find this
+ * yet, so we assume the worst for now. */
+ // if (setup_finished)
// ff_thread_finish_setup(s->avctx);
return;
}
@@ -1369,11 +1378,11 @@ static void decode_postinit(H264Context *h, int setup_finished){
cur->f.repeat_pict = 0;
/* Signal interlacing information externally. */
- /* Prioritize picture timing SEI information over used decoding process if it exists. */
+ /* Prioritize picture timing SEI information over used
+ * decoding process if it exists. */
- if(h->sps.pic_struct_present_flag){
- switch (h->sei_pic_struct)
- {
+ if (h->sps.pic_struct_present_flag) {
+ switch (h->sei_pic_struct) {
case SEI_PIC_STRUCT_FRAME:
break;
case SEI_PIC_STRUCT_TOP_FIELD:
@@ -1390,12 +1399,13 @@ static void decode_postinit(H264Context *h, int setup_finished){
break;
case SEI_PIC_STRUCT_TOP_BOTTOM_TOP:
case SEI_PIC_STRUCT_BOTTOM_TOP_BOTTOM:
- // Signal the possibility of telecined film externally (pic_struct 5,6)
- // From these hints, let the applications decide if they apply deinterlacing.
+ /* Signal the possibility of telecined film externally
+ * (pic_struct 5,6). From these hints, let the applications
+ * decide if they apply deinterlacing. */
cur->f.repeat_pict = 1;
break;
case SEI_PIC_STRUCT_FRAME_DOUBLING:
- // Force progressive here, as doubling interlaced frame is a bad idea.
+ // Force progressive here, doubling interlaced frame is a bad idea.
cur->f.repeat_pict = 2;
break;
case SEI_PIC_STRUCT_FRAME_TRIPLING:
@@ -1403,49 +1413,52 @@ static void decode_postinit(H264Context *h, int setup_finished){
break;
}
- if ((h->sei_ct_type & 3) && h->sei_pic_struct <= SEI_PIC_STRUCT_BOTTOM_TOP)
+ if ((h->sei_ct_type & 3) &&
+ h->sei_pic_struct <= SEI_PIC_STRUCT_BOTTOM_TOP)
cur->f.interlaced_frame = (h->sei_ct_type & (1 << 1)) != 0;
- }else{
+ } else {
/* Derive interlacing flag from used decoding process. */
cur->f.interlaced_frame = FIELD_OR_MBAFF_PICTURE;
}
h->prev_interlaced_frame = cur->f.interlaced_frame;
- if (cur->field_poc[0] != cur->field_poc[1]){
+ if (cur->field_poc[0] != cur->field_poc[1]) {
/* Derive top_field_first from field pocs. */
cur->f.top_field_first = cur->field_poc[0] < cur->field_poc[1];
- }else{
+ } else {
if (cur->f.interlaced_frame || h->sps.pic_struct_present_flag) {
- /* Use picture timing SEI information. Even if it is a information of a past frame, better than nothing. */
- if(h->sei_pic_struct == SEI_PIC_STRUCT_TOP_BOTTOM
- || h->sei_pic_struct == SEI_PIC_STRUCT_TOP_BOTTOM_TOP)
+ /* Use picture timing SEI information. Even if it is a
+ * information of a past frame, better than nothing. */
+ if (h->sei_pic_struct == SEI_PIC_STRUCT_TOP_BOTTOM ||
+ h->sei_pic_struct == SEI_PIC_STRUCT_TOP_BOTTOM_TOP)
cur->f.top_field_first = 1;
else
cur->f.top_field_first = 0;
- }else{
+ } else {
/* Most likely progressive */
cur->f.top_field_first = 0;
}
}
- //FIXME do something with unavailable reference frames
+ // FIXME do something with unavailable reference frames
/* Sort B-frames into display order */
- if(h->sps.bitstream_restriction_flag
- && s->avctx->has_b_frames < h->sps.num_reorder_frames){
+ if (h->sps.bitstream_restriction_flag &&
+ s->avctx->has_b_frames < h->sps.num_reorder_frames) {
s->avctx->has_b_frames = h->sps.num_reorder_frames;
- s->low_delay = 0;
+ s->low_delay = 0;
}
- if( s->avctx->strict_std_compliance >= FF_COMPLIANCE_STRICT
- && !h->sps.bitstream_restriction_flag){
+ if (s->avctx->strict_std_compliance >= FF_COMPLIANCE_STRICT &&
+ !h->sps.bitstream_restriction_flag) {
s->avctx->has_b_frames = MAX_DELAYED_PIC_COUNT - 1;
- s->low_delay= 0;
+ s->low_delay = 0;
}
pics = 0;
- while(h->delayed_pic[pics]) pics++;
+ while (h->delayed_pic[pics])
+ pics++;
assert(pics <= MAX_DELAYED_PIC_COUNT);
@@ -1470,7 +1483,8 @@ static void decode_postinit(H264Context *h, int setup_finished){
cnt += out->poc < h->last_pocs[i];
invalid += out->poc == INT_MIN;
}
- if (!h->mmco_reset && !cur->f.key_frame && cnt + invalid == MAX_DELAYED_PIC_COUNT && cnt > 0) {
+ if (!h->mmco_reset && !cur->f.key_frame &&
+ cnt + invalid == MAX_DELAYED_PIC_COUNT && cnt > 0) {
h->mmco_reset = 2;
if (pics > 1)
h->delayed_pic[pics - 2]->mmco_reset = 2;
@@ -1481,49 +1495,55 @@ static void decode_postinit(H264Context *h, int setup_finished){
cnt = 0;
invalid = MAX_DELAYED_PIC_COUNT;
}
- out = h->delayed_pic[0];
+ out = h->delayed_pic[0];
out_idx = 0;
- for (i = 1; i < MAX_DELAYED_PIC_COUNT && h->delayed_pic[i] &&
- !h->delayed_pic[i-1]->mmco_reset && !h->delayed_pic[i]->f.key_frame; i++)
- {
- if(h->delayed_pic[i]->poc < out->poc){
- out = h->delayed_pic[i];
+ for (i = 1; i < MAX_DELAYED_PIC_COUNT &&
+ h->delayed_pic[i] &&
+ !h->delayed_pic[i - 1]->mmco_reset &&
+ !h->delayed_pic[i]->f.key_frame;
+ i++)
+ if (h->delayed_pic[i]->poc < out->poc) {
+ out = h->delayed_pic[i];
out_idx = i;
}
- }
- if (s->avctx->has_b_frames == 0 && (h->delayed_pic[0]->f.key_frame || h->mmco_reset))
+ if (s->avctx->has_b_frames == 0 &&
+ (h->delayed_pic[0]->f.key_frame || h->mmco_reset))
h->next_outputed_poc = INT_MIN;
- out_of_order = !out->f.key_frame && !h->mmco_reset && (out->poc < h->next_outputed_poc);
+ out_of_order = !out->f.key_frame && !h->mmco_reset &&
+ (out->poc < h->next_outputed_poc);
- if(h->sps.bitstream_restriction_flag && s->avctx->has_b_frames >= h->sps.num_reorder_frames)
- { }
- else if (out_of_order && pics-1 == s->avctx->has_b_frames &&
- s->avctx->has_b_frames < MAX_DELAYED_PIC_COUNT) {
+ if (h->sps.bitstream_restriction_flag &&
+ s->avctx->has_b_frames >= h->sps.num_reorder_frames) {
+ } else if (out_of_order && pics - 1 == s->avctx->has_b_frames &&
+ s->avctx->has_b_frames < MAX_DELAYED_PIC_COUNT) {
if (invalid + cnt < MAX_DELAYED_PIC_COUNT) {
s->avctx->has_b_frames = FFMAX(s->avctx->has_b_frames, cnt);
}
s->low_delay = 0;
} else if (s->low_delay &&
- ((h->next_outputed_poc != INT_MIN && out->poc > h->next_outputed_poc + 2) ||
+ ((h->next_outputed_poc != INT_MIN &&
+ out->poc > h->next_outputed_poc + 2) ||
cur->f.pict_type == AV_PICTURE_TYPE_B)) {
s->low_delay = 0;
s->avctx->has_b_frames++;
}
- if(pics > s->avctx->has_b_frames){
+ if (pics > s->avctx->has_b_frames) {
out->f.reference &= ~DELAYED_PIC_REF;
- out->owner2 = s; // for frame threading, the owner must be the second field's thread
- // or else the first thread can release the picture and reuse it unsafely
- for(i=out_idx; h->delayed_pic[i]; i++)
- h->delayed_pic[i] = h->delayed_pic[i+1];
- }
- memmove(h->last_pocs, &h->last_pocs[1], sizeof(*h->last_pocs) * (MAX_DELAYED_PIC_COUNT - 1));
+ // for frame threading, the owner must be the second field's thread or
+ // else the first thread can release the picture and reuse it unsafely
+ out->owner2 = s;
+ for (i = out_idx; h->delayed_pic[i]; i++)
+ h->delayed_pic[i] = h->delayed_pic[i + 1];
+ }
+ memmove(h->last_pocs, &h->last_pocs[1],
+ sizeof(*h->last_pocs) * (MAX_DELAYED_PIC_COUNT - 1));
h->last_pocs[MAX_DELAYED_PIC_COUNT - 1] = cur->poc;
- if(!out_of_order && pics > s->avctx->has_b_frames){
+ if (!out_of_order && pics > s->avctx->has_b_frames) {
h->next_output_pic = out;
if (out->mmco_reset) {
if (out_idx > 0) {
- h->next_outputed_poc = out->poc;
+ h->next_outputed_poc = out->poc;
h->delayed_pic[out_idx - 1]->mmco_reset = out->mmco_reset;
} else {
h->next_outputed_poc = INT_MIN;
@@ -1536,7 +1556,7 @@ static void decode_postinit(H264Context *h, int setup_finished){
}
}
h->mmco_reset = 0;
- }else{
+ } else {
av_log(s->avctx, AV_LOG_DEBUG, "no picture\n");
}
@@ -1546,122 +1566,124 @@ static void decode_postinit(H264Context *h, int setup_finished){
static av_always_inline void backup_mb_border(H264Context *h, uint8_t *src_y,
uint8_t *src_cb, uint8_t *src_cr,
- int linesize, int uvlinesize, int simple)
+ int linesize, int uvlinesize,
+ int simple)
{
- MpegEncContext * const s = &h->s;
+ MpegEncContext *const s = &h->s;
uint8_t *top_border;
int top_idx = 1;
const int pixel_shift = h->pixel_shift;
int chroma444 = CHROMA444;
int chroma422 = CHROMA422;
- src_y -= linesize;
+ src_y -= linesize;
src_cb -= uvlinesize;
src_cr -= uvlinesize;
- if(!simple && FRAME_MBAFF){
- if(s->mb_y&1){
- if(!MB_MBAFF){
+ if (!simple && FRAME_MBAFF) {
+ if (s->mb_y & 1) {
+ if (!MB_MBAFF) {
top_border = h->top_borders[0][s->mb_x];
- AV_COPY128(top_border, src_y + 15*linesize);
+ AV_COPY128(top_border, src_y + 15 * linesize);
if (pixel_shift)
- AV_COPY128(top_border+16, src_y+15*linesize+16);
- if(simple || !CONFIG_GRAY || !(s->flags&CODEC_FLAG_GRAY)){
- if(chroma444){
- if (pixel_shift){
- AV_COPY128(top_border+32, src_cb + 15*uvlinesize);
- AV_COPY128(top_border+48, src_cb + 15*uvlinesize+16);
- AV_COPY128(top_border+64, src_cr + 15*uvlinesize);
- AV_COPY128(top_border+80, src_cr + 15*uvlinesize+16);
+ AV_COPY128(top_border + 16, src_y + 15 * linesize + 16);
+ if (simple || !CONFIG_GRAY || !(s->flags & CODEC_FLAG_GRAY)) {
+ if (chroma444) {
+ if (pixel_shift) {
+ AV_COPY128(top_border + 32, src_cb + 15 * uvlinesize);
+ AV_COPY128(top_border + 48, src_cb + 15 * uvlinesize + 16);
+ AV_COPY128(top_border + 64, src_cr + 15 * uvlinesize);
+ AV_COPY128(top_border + 80, src_cr + 15 * uvlinesize + 16);
} else {
- AV_COPY128(top_border+16, src_cb + 15*uvlinesize);
- AV_COPY128(top_border+32, src_cr + 15*uvlinesize);
+ AV_COPY128(top_border + 16, src_cb + 15 * uvlinesize);
+ AV_COPY128(top_border + 32, src_cr + 15 * uvlinesize);
}
- } else if(chroma422) {
+ } else if (chroma422) {
if (pixel_shift) {
- AV_COPY128(top_border+32, src_cb + 15*uvlinesize);
- AV_COPY128(top_border+48, src_cr + 15*uvlinesize);
+ AV_COPY128(top_border + 32, src_cb + 15 * uvlinesize);
+ AV_COPY128(top_border + 48, src_cr + 15 * uvlinesize);
} else {
- AV_COPY64(top_border+16, src_cb + 15*uvlinesize);
- AV_COPY64(top_border+24, src_cr + 15*uvlinesize);
+ AV_COPY64(top_border + 16, src_cb + 15 * uvlinesize);
+ AV_COPY64(top_border + 24, src_cr + 15 * uvlinesize);
}
} else {
if (pixel_shift) {
- AV_COPY128(top_border+32, src_cb+7*uvlinesize);
- AV_COPY128(top_border+48, src_cr+7*uvlinesize);
+ AV_COPY128(top_border + 32, src_cb + 7 * uvlinesize);
+ AV_COPY128(top_border + 48, src_cr + 7 * uvlinesize);
} else {
- AV_COPY64(top_border+16, src_cb+7*uvlinesize);
- AV_COPY64(top_border+24, src_cr+7*uvlinesize);
+ AV_COPY64(top_border + 16, src_cb + 7 * uvlinesize);
+ AV_COPY64(top_border + 24, src_cr + 7 * uvlinesize);
}
}
}
}
- }else if(MB_MBAFF){
+ } else if (MB_MBAFF) {
top_idx = 0;
- }else
+ } else
return;
}
top_border = h->top_borders[top_idx][s->mb_x];
- // There are two lines saved, the line above the the top macroblock of a pair,
- // and the line above the bottom macroblock
- AV_COPY128(top_border, src_y + 16*linesize);
+ /* There are two lines saved, the line above the top macroblock
+ * of a pair, and the line above the bottom macroblock. */
+ AV_COPY128(top_border, src_y + 16 * linesize);
if (pixel_shift)
- AV_COPY128(top_border+16, src_y+16*linesize+16);
-
- if(simple || !CONFIG_GRAY || !(s->flags&CODEC_FLAG_GRAY)){
- if(chroma444){
- if (pixel_shift){
- AV_COPY128(top_border+32, src_cb + 16*linesize);
- AV_COPY128(top_border+48, src_cb + 16*linesize+16);
- AV_COPY128(top_border+64, src_cr + 16*linesize);
- AV_COPY128(top_border+80, src_cr + 16*linesize+16);
+ AV_COPY128(top_border + 16, src_y + 16 * linesize + 16);
+
+ if (simple || !CONFIG_GRAY || !(s->flags & CODEC_FLAG_GRAY)) {
+ if (chroma444) {
+ if (pixel_shift) {
+ AV_COPY128(top_border + 32, src_cb + 16 * linesize);
+ AV_COPY128(top_border + 48, src_cb + 16 * linesize + 16);
+ AV_COPY128(top_border + 64, src_cr + 16 * linesize);
+ AV_COPY128(top_border + 80, src_cr + 16 * linesize + 16);
} else {
- AV_COPY128(top_border+16, src_cb + 16*linesize);
- AV_COPY128(top_border+32, src_cr + 16*linesize);
+ AV_COPY128(top_border + 16, src_cb + 16 * linesize);
+ AV_COPY128(top_border + 32, src_cr + 16 * linesize);
}
- } else if(chroma422) {
+ } else if (chroma422) {
if (pixel_shift) {
- AV_COPY128(top_border+32, src_cb+16*uvlinesize);
- AV_COPY128(top_border+48, src_cr+16*uvlinesize);
+ AV_COPY128(top_border + 32, src_cb + 16 * uvlinesize);
+ AV_COPY128(top_border + 48, src_cr + 16 * uvlinesize);
} else {
- AV_COPY64(top_border+16, src_cb+16*uvlinesize);
- AV_COPY64(top_border+24, src_cr+16*uvlinesize);
+ AV_COPY64(top_border + 16, src_cb + 16 * uvlinesize);
+ AV_COPY64(top_border + 24, src_cr + 16 * uvlinesize);
}
} else {
if (pixel_shift) {
- AV_COPY128(top_border+32, src_cb+8*uvlinesize);
- AV_COPY128(top_border+48, src_cr+8*uvlinesize);
+ AV_COPY128(top_border + 32, src_cb + 8 * uvlinesize);
+ AV_COPY128(top_border + 48, src_cr + 8 * uvlinesize);
} else {
- AV_COPY64(top_border+16, src_cb+8*uvlinesize);
- AV_COPY64(top_border+24, src_cr+8*uvlinesize);
+ AV_COPY64(top_border + 16, src_cb + 8 * uvlinesize);
+ AV_COPY64(top_border + 24, src_cr + 8 * uvlinesize);
}
}
}
}
static av_always_inline void xchg_mb_border(H264Context *h, uint8_t *src_y,
- uint8_t *src_cb, uint8_t *src_cr,
- int linesize, int uvlinesize,
- int xchg, int chroma444,
- int simple, int pixel_shift){
- MpegEncContext * const s = &h->s;
+ uint8_t *src_cb, uint8_t *src_cr,
+ int linesize, int uvlinesize,
+ int xchg, int chroma444,
+ int simple, int pixel_shift)
+{
+ MpegEncContext *const s = &h->s;
int deblock_topleft;
int deblock_top;
int top_idx = 1;
uint8_t *top_border_m1;
uint8_t *top_border;
- if(!simple && FRAME_MBAFF){
- if(s->mb_y&1){
- if(!MB_MBAFF)
+ if (!simple && FRAME_MBAFF) {
+ if (s->mb_y & 1) {
+ if (!MB_MBAFF)
return;
- }else{
+ } else {
top_idx = MB_MBAFF ? 0 : 1;
}
}
- if(h->deblocking_filter == 2) {
+ if (h->deblocking_filter == 2) {
deblock_topleft = h->slice_table[h->mb_xy - 1 - s->mb_stride] == h->slice_num;
deblock_top = h->top_type;
} else {
@@ -1669,38 +1691,41 @@ static av_always_inline void xchg_mb_border(H264Context *h, uint8_t *src_y,
deblock_top = (s->mb_y > !!MB_FIELD);
}
- src_y -= linesize + 1 + pixel_shift;
+ src_y -= linesize + 1 + pixel_shift;
src_cb -= uvlinesize + 1 + pixel_shift;
src_cr -= uvlinesize + 1 + pixel_shift;
- top_border_m1 = h->top_borders[top_idx][s->mb_x-1];
+ top_border_m1 = h->top_borders[top_idx][s->mb_x - 1];
top_border = h->top_borders[top_idx][s->mb_x];
-#define XCHG(a,b,xchg)\
- if (pixel_shift) {\
- if (xchg) {\
- AV_SWAP64(b+0,a+0);\
- AV_SWAP64(b+8,a+8);\
- } else {\
- AV_COPY128(b,a); \
- }\
- } else \
-if (xchg) AV_SWAP64(b,a);\
-else AV_COPY64(b,a);
-
- if(deblock_top){
- if(deblock_topleft){
- XCHG(top_border_m1 + (8 << pixel_shift), src_y - (7 << pixel_shift), 1);
+#define XCHG(a, b, xchg) \
+ if (pixel_shift) { \
+ if (xchg) { \
+ AV_SWAP64(b + 0, a + 0); \
+ AV_SWAP64(b + 8, a + 8); \
+ } else { \
+ AV_COPY128(b, a); \
+ } \
+ } else if (xchg) \
+ AV_SWAP64(b, a); \
+ else \
+ AV_COPY64(b, a);
+
+ if (deblock_top) {
+ if (deblock_topleft) {
+ XCHG(top_border_m1 + (8 << pixel_shift),
+ src_y - (7 << pixel_shift), 1);
}
XCHG(top_border + (0 << pixel_shift), src_y + (1 << pixel_shift), xchg);
XCHG(top_border + (8 << pixel_shift), src_y + (9 << pixel_shift), 1);
- if(s->mb_x+1 < s->mb_width){
- XCHG(h->top_borders[top_idx][s->mb_x+1], src_y + (17 << pixel_shift), 1);
+ if (s->mb_x + 1 < s->mb_width) {
+ XCHG(h->top_borders[top_idx][s->mb_x + 1],
+ src_y + (17 << pixel_shift), 1);
}
}
- if(simple || !CONFIG_GRAY || !(s->flags&CODEC_FLAG_GRAY)){
- if(chroma444){
- if(deblock_topleft){
+ if (simple || !CONFIG_GRAY || !(s->flags & CODEC_FLAG_GRAY)) {
+ if (chroma444) {
+ if (deblock_topleft) {
XCHG(top_border_m1 + (24 << pixel_shift), src_cb - (7 << pixel_shift), 1);
XCHG(top_border_m1 + (40 << pixel_shift), src_cr - (7 << pixel_shift), 1);
}
@@ -1708,532 +1733,254 @@ else AV_COPY64(b,a);
XCHG(top_border + (24 << pixel_shift), src_cb + (9 << pixel_shift), 1);
XCHG(top_border + (32 << pixel_shift), src_cr + (1 << pixel_shift), xchg);
XCHG(top_border + (40 << pixel_shift), src_cr + (9 << pixel_shift), 1);
- if(s->mb_x+1 < s->mb_width){
- XCHG(h->top_borders[top_idx][s->mb_x+1] + (16 << pixel_shift), src_cb + (17 << pixel_shift), 1);
- XCHG(h->top_borders[top_idx][s->mb_x+1] + (32 << pixel_shift), src_cr + (17 << pixel_shift), 1);
+ if (s->mb_x + 1 < s->mb_width) {
+ XCHG(h->top_borders[top_idx][s->mb_x + 1] + (16 << pixel_shift), src_cb + (17 << pixel_shift), 1);
+ XCHG(h->top_borders[top_idx][s->mb_x + 1] + (32 << pixel_shift), src_cr + (17 << pixel_shift), 1);
}
} else {
- if(deblock_top){
- if(deblock_topleft){
+ if (deblock_top) {
+ if (deblock_topleft) {
XCHG(top_border_m1 + (16 << pixel_shift), src_cb - (7 << pixel_shift), 1);
XCHG(top_border_m1 + (24 << pixel_shift), src_cr - (7 << pixel_shift), 1);
}
- XCHG(top_border + (16 << pixel_shift), src_cb+1+pixel_shift, 1);
- XCHG(top_border + (24 << pixel_shift), src_cr+1+pixel_shift, 1);
+ XCHG(top_border + (16 << pixel_shift), src_cb + 1 + pixel_shift, 1);
+ XCHG(top_border + (24 << pixel_shift), src_cr + 1 + pixel_shift, 1);
}
}
}
}
-static av_always_inline int dctcoef_get(DCTELEM *mb, int high_bit_depth, int index) {
+static av_always_inline int dctcoef_get(DCTELEM *mb, int high_bit_depth,
+ int index)
+{
if (high_bit_depth) {
- return AV_RN32A(((int32_t*)mb) + index);
+ return AV_RN32A(((int32_t *)mb) + index);
} else
return AV_RN16A(mb + index);
}
-static av_always_inline void dctcoef_set(DCTELEM *mb, int high_bit_depth, int index, int value) {
+static av_always_inline void dctcoef_set(DCTELEM *mb, int high_bit_depth,
+ int index, int value)
+{
if (high_bit_depth) {
- AV_WN32A(((int32_t*)mb) + index, value);
+ AV_WN32A(((int32_t *)mb) + index, value);
} else
AV_WN16A(mb + index, value);
}
-static av_always_inline void hl_decode_mb_predict_luma(H264Context *h, int mb_type, int is_h264, int simple, int transform_bypass,
- int pixel_shift, int *block_offset, int linesize, uint8_t *dest_y, int p)
+static av_always_inline void hl_decode_mb_predict_luma(H264Context *h,
+ int mb_type, int is_h264,
+ int simple,
+ int transform_bypass,
+ int pixel_shift,
+ int *block_offset,
+ int linesize,
+ uint8_t *dest_y, int p)
{
- MpegEncContext * const s = &h->s;
+ MpegEncContext *const s = &h->s;
void (*idct_add)(uint8_t *dst, DCTELEM *block, int stride);
void (*idct_dc_add)(uint8_t *dst, DCTELEM *block, int stride);
int i;
- int qscale = p == 0 ? s->qscale : h->chroma_qp[p-1];
- block_offset += 16*p;
- if(IS_INTRA4x4(mb_type)){
- if(simple || !s->encoding){
- if(IS_8x8DCT(mb_type)){
- if(transform_bypass){
- idct_dc_add =
- idct_add = s->dsp.add_pixels8;
- }else{
+ int qscale = p == 0 ? s->qscale : h->chroma_qp[p - 1];
+ block_offset += 16 * p;
+ if (IS_INTRA4x4(mb_type)) {
+ if (simple || !s->encoding) {
+ if (IS_8x8DCT(mb_type)) {
+ if (transform_bypass) {
+ idct_dc_add =
+ idct_add = s->dsp.add_pixels8;
+ } else {
idct_dc_add = h->h264dsp.h264_idct8_dc_add;
idct_add = h->h264dsp.h264_idct8_add;
}
- for(i=0; i<16; i+=4){
- uint8_t * const ptr= dest_y + block_offset[i];
- const int dir= h->intra4x4_pred_mode_cache[ scan8[i] ];
- if(transform_bypass && h->sps.profile_idc==244 && dir<=1){
- h->hpc.pred8x8l_add[dir](ptr, h->mb + (i*16+p*256 << pixel_shift), linesize);
- }else{
- const int nnz = h->non_zero_count_cache[ scan8[i+p*16] ];
- h->hpc.pred8x8l[ dir ](ptr, (h->topleft_samples_available<<i)&0x8000,
- (h->topright_samples_available<<i)&0x4000, linesize);
- if(nnz){
- if(nnz == 1 && dctcoef_get(h->mb, pixel_shift, i*16+p*256))
- idct_dc_add(ptr, h->mb + (i*16+p*256 << pixel_shift), linesize);
+ for (i = 0; i < 16; i += 4) {
+ uint8_t *const ptr = dest_y + block_offset[i];
+ const int dir = h->intra4x4_pred_mode_cache[scan8[i]];
+ if (transform_bypass && h->sps.profile_idc == 244 && dir <= 1) {
+ h->hpc.pred8x8l_add[dir](ptr, h->mb + (i * 16 + p * 256 << pixel_shift), linesize);
+ } else {
+ const int nnz = h->non_zero_count_cache[scan8[i + p * 16]];
+ h->hpc.pred8x8l[dir](ptr, (h->topleft_samples_available << i) & 0x8000,
+ (h->topright_samples_available << i) & 0x4000, linesize);
+ if (nnz) {
+ if (nnz == 1 && dctcoef_get(h->mb, pixel_shift, i * 16 + p * 256))
+ idct_dc_add(ptr, h->mb + (i * 16 + p * 256 << pixel_shift), linesize);
else
- idct_add (ptr, h->mb + (i*16+p*256 << pixel_shift), linesize);
+ idct_add(ptr, h->mb + (i * 16 + p * 256 << pixel_shift), linesize);
}
}
}
- }else{
- if(transform_bypass){
- idct_dc_add =
- idct_add = s->dsp.add_pixels4;
- }else{
+ } else {
+ if (transform_bypass) {
+ idct_dc_add =
+ idct_add = s->dsp.add_pixels4;
+ } else {
idct_dc_add = h->h264dsp.h264_idct_dc_add;
idct_add = h->h264dsp.h264_idct_add;
}
- for(i=0; i<16; i++){
- uint8_t * const ptr= dest_y + block_offset[i];
- const int dir= h->intra4x4_pred_mode_cache[ scan8[i] ];
+ for (i = 0; i < 16; i++) {
+ uint8_t *const ptr = dest_y + block_offset[i];
+ const int dir = h->intra4x4_pred_mode_cache[scan8[i]];
- if(transform_bypass && h->sps.profile_idc==244 && dir<=1){
- h->hpc.pred4x4_add[dir](ptr, h->mb + (i*16+p*256 << pixel_shift), linesize);
- }else{
+ if (transform_bypass && h->sps.profile_idc == 244 && dir <= 1) {
+ h->hpc.pred4x4_add[dir](ptr, h->mb + (i * 16 + p * 256 << pixel_shift), linesize);
+ } else {
uint8_t *topright;
int nnz, tr;
uint64_t tr_high;
- if(dir == DIAG_DOWN_LEFT_PRED || dir == VERT_LEFT_PRED){
- const int topright_avail= (h->topright_samples_available<<i)&0x8000;
+ if (dir == DIAG_DOWN_LEFT_PRED || dir == VERT_LEFT_PRED) {
+ const int topright_avail = (h->topright_samples_available << i) & 0x8000;
assert(s->mb_y || linesize <= block_offset[i]);
- if(!topright_avail){
+ if (!topright_avail) {
if (pixel_shift) {
- tr_high= ((uint16_t*)ptr)[3 - linesize/2]*0x0001000100010001ULL;
- topright= (uint8_t*) &tr_high;
+ tr_high = ((uint16_t *)ptr)[3 - linesize / 2] * 0x0001000100010001ULL;
+ topright = (uint8_t *)&tr_high;
} else {
- tr= ptr[3 - linesize]*0x01010101u;
- topright= (uint8_t*) &tr;
+ tr = ptr[3 - linesize] * 0x01010101u;
+ topright = (uint8_t *)&tr;
}
- }else
- topright= ptr + (4 << pixel_shift) - linesize;
- }else
- topright= NULL;
-
- h->hpc.pred4x4[ dir ](ptr, topright, linesize);
- nnz = h->non_zero_count_cache[ scan8[i+p*16] ];
- if(nnz){
- if(is_h264){
- if(nnz == 1 && dctcoef_get(h->mb, pixel_shift, i*16+p*256))
- idct_dc_add(ptr, h->mb + (i*16+p*256 << pixel_shift), linesize);
+ } else
+ topright = ptr + (4 << pixel_shift) - linesize;
+ } else
+ topright = NULL;
+
+ h->hpc.pred4x4[dir](ptr, topright, linesize);
+ nnz = h->non_zero_count_cache[scan8[i + p * 16]];
+ if (nnz) {
+ if (is_h264) {
+ if (nnz == 1 && dctcoef_get(h->mb, pixel_shift, i * 16 + p * 256))
+ idct_dc_add(ptr, h->mb + (i * 16 + p * 256 << pixel_shift), linesize);
else
- idct_add (ptr, h->mb + (i*16+p*256 << pixel_shift), linesize);
+ idct_add(ptr, h->mb + (i * 16 + p * 256 << pixel_shift), linesize);
} else if (CONFIG_SVQ3_DECODER)
- ff_svq3_add_idct_c(ptr, h->mb + i*16+p*256, linesize, qscale, 0);
+ ff_svq3_add_idct_c(ptr, h->mb + i * 16 + p * 256, linesize, qscale, 0);
}
}
}
}
}
- }else{
- h->hpc.pred16x16[ h->intra16x16_pred_mode ](dest_y , linesize);
- if(is_h264){
- if(h->non_zero_count_cache[ scan8[LUMA_DC_BLOCK_INDEX+p] ]){
- if(!transform_bypass)
- h->h264dsp.h264_luma_dc_dequant_idct(h->mb+(p*256 << pixel_shift), h->mb_luma_dc[p], h->dequant4_coeff[p][qscale][0]);
- else{
- static const uint8_t dc_mapping[16] = { 0*16, 1*16, 4*16, 5*16, 2*16, 3*16, 6*16, 7*16,
- 8*16, 9*16,12*16,13*16,10*16,11*16,14*16,15*16};
- for(i = 0; i < 16; i++)
- dctcoef_set(h->mb+(p*256 << pixel_shift), pixel_shift, dc_mapping[i], dctcoef_get(h->mb_luma_dc[p], pixel_shift, i));
+ } else {
+ h->hpc.pred16x16[h->intra16x16_pred_mode](dest_y, linesize);
+ if (is_h264) {
+ if (h->non_zero_count_cache[scan8[LUMA_DC_BLOCK_INDEX + p]]) {
+ if (!transform_bypass)
+ h->h264dsp.h264_luma_dc_dequant_idct(h->mb + (p * 256 << pixel_shift),
+ h->mb_luma_dc[p],
+ h->dequant4_coeff[p][qscale][0]);
+ else {
+ static const uint8_t dc_mapping[16] = {
+ 0 * 16, 1 * 16, 4 * 16, 5 * 16,
+ 2 * 16, 3 * 16, 6 * 16, 7 * 16,
+ 8 * 16, 9 * 16, 12 * 16, 13 * 16,
+ 10 * 16, 11 * 16, 14 * 16, 15 * 16 };
+ for (i = 0; i < 16; i++)
+ dctcoef_set(h->mb + (p * 256 << pixel_shift),
+ pixel_shift, dc_mapping[i],
+ dctcoef_get(h->mb_luma_dc[p],
+ pixel_shift, i));
}
}
} else if (CONFIG_SVQ3_DECODER)
- ff_svq3_luma_dc_dequant_idct_c(h->mb+p*256, h->mb_luma_dc[p], qscale);
+ ff_svq3_luma_dc_dequant_idct_c(h->mb + p * 256,
+ h->mb_luma_dc[p], qscale);
}
}
-static av_always_inline void hl_decode_mb_idct_luma(H264Context *h, int mb_type, int is_h264, int simple, int transform_bypass,
- int pixel_shift, int *block_offset, int linesize, uint8_t *dest_y, int p)
+static av_always_inline void hl_decode_mb_idct_luma(H264Context *h, int mb_type,
+ int is_h264, int simple,
+ int transform_bypass,
+ int pixel_shift,
+ int *block_offset,
+ int linesize,
+ uint8_t *dest_y, int p)
{
- MpegEncContext * const s = &h->s;
+ MpegEncContext *const s = &h->s;
void (*idct_add)(uint8_t *dst, DCTELEM *block, int stride);
int i;
- block_offset += 16*p;
- if(!IS_INTRA4x4(mb_type)){
- if(is_h264){
- if(IS_INTRA16x16(mb_type)){
- if(transform_bypass){
- if(h->sps.profile_idc==244 && (h->intra16x16_pred_mode==VERT_PRED8x8 || h->intra16x16_pred_mode==HOR_PRED8x8)){
- h->hpc.pred16x16_add[h->intra16x16_pred_mode](dest_y, block_offset, h->mb + (p*256 << pixel_shift), linesize);
- }else{
- for(i=0; i<16; i++){
- if(h->non_zero_count_cache[ scan8[i+p*16] ] || dctcoef_get(h->mb, pixel_shift, i*16+p*256))
- s->dsp.add_pixels4(dest_y + block_offset[i], h->mb + (i*16+p*256 << pixel_shift), linesize);
- }
- }
- }else{
- h->h264dsp.h264_idct_add16intra(dest_y, block_offset, h->mb + (p*256 << pixel_shift), linesize, h->non_zero_count_cache+p*5*8);
- }
- }else if(h->cbp&15){
- if(transform_bypass){
- const int di = IS_8x8DCT(mb_type) ? 4 : 1;
- idct_add= IS_8x8DCT(mb_type) ? s->dsp.add_pixels8 : s->dsp.add_pixels4;
- for(i=0; i<16; i+=di){
- if(h->non_zero_count_cache[ scan8[i+p*16] ]){
- idct_add(dest_y + block_offset[i], h->mb + (i*16+p*256 << pixel_shift), linesize);
- }
- }
- }else{
- if(IS_8x8DCT(mb_type)){
- h->h264dsp.h264_idct8_add4(dest_y, block_offset, h->mb + (p*256 << pixel_shift), linesize, h->non_zero_count_cache+p*5*8);
- }else{
- h->h264dsp.h264_idct_add16(dest_y, block_offset, h->mb + (p*256 << pixel_shift), linesize, h->non_zero_count_cache+p*5*8);
- }
- }
- }
- } else if (CONFIG_SVQ3_DECODER) {
- for(i=0; i<16; i++){
- if(h->non_zero_count_cache[ scan8[i+p*16] ] || h->mb[i*16+p*256]){ //FIXME benchmark weird rule, & below
- uint8_t * const ptr= dest_y + block_offset[i];
- ff_svq3_add_idct_c(ptr, h->mb + i*16 + p*256, linesize, s->qscale, IS_INTRA(mb_type) ? 1 : 0);
- }
- }
- }
- }
-}
-
-static av_always_inline void hl_decode_mb_internal(H264Context *h, int simple, int pixel_shift)
-{
- MpegEncContext * const s = &h->s;
- const int mb_x= s->mb_x;
- const int mb_y= s->mb_y;
- const int mb_xy= h->mb_xy;
- const int mb_type = s->current_picture.f.mb_type[mb_xy];
- uint8_t *dest_y, *dest_cb, *dest_cr;
- int linesize, uvlinesize /*dct_offset*/;
- int i, j;
- int *block_offset = &h->block_offset[0];
- const int transform_bypass = !simple && (s->qscale == 0 && h->sps.transform_bypass);
- /* is_h264 should always be true if SVQ3 is disabled. */
- const int is_h264 = !CONFIG_SVQ3_DECODER || simple || s->codec_id == CODEC_ID_H264;
- void (*idct_add)(uint8_t *dst, DCTELEM *block, int stride);
- const int block_h = 16 >> s->chroma_y_shift;
- const int chroma422 = CHROMA422;
-
- dest_y = s->current_picture.f.data[0] + ((mb_x << pixel_shift) + mb_y * s->linesize ) * 16;
- dest_cb = s->current_picture.f.data[1] + (mb_x << pixel_shift)*8 + mb_y * s->uvlinesize * block_h;
- dest_cr = s->current_picture.f.data[2] + (mb_x << pixel_shift)*8 + mb_y * s->uvlinesize * block_h;
-
- s->dsp.prefetch(dest_y + (s->mb_x&3)*4*s->linesize + (64 << pixel_shift), s->linesize, 4);
- s->dsp.prefetch(dest_cb + (s->mb_x&7)*s->uvlinesize + (64 << pixel_shift), dest_cr - dest_cb, 2);
-
- h->list_counts[mb_xy]= h->list_count;
-
- if (!simple && MB_FIELD) {
- linesize = h->mb_linesize = s->linesize * 2;
- uvlinesize = h->mb_uvlinesize = s->uvlinesize * 2;
- block_offset = &h->block_offset[48];
- if(mb_y&1){ //FIXME move out of this function?
- dest_y -= s->linesize*15;
- dest_cb-= s->uvlinesize * (block_h - 1);
- dest_cr-= s->uvlinesize * (block_h - 1);
- }
- if(FRAME_MBAFF) {
- int list;
- for(list=0; list<h->list_count; list++){
- if(!USES_LIST(mb_type, list))
- continue;
- if(IS_16X16(mb_type)){
- int8_t *ref = &h->ref_cache[list][scan8[0]];
- fill_rectangle(ref, 4, 4, 8, (16+*ref)^(s->mb_y&1), 1);
- }else{
- for(i=0; i<16; i+=4){
- int ref = h->ref_cache[list][scan8[i]];
- if(ref >= 0)
- fill_rectangle(&h->ref_cache[list][scan8[i]], 2, 2, 8, (16+ref)^(s->mb_y&1), 1);
- }
- }
- }
- }
- } else {
- linesize = h->mb_linesize = s->linesize;
- uvlinesize = h->mb_uvlinesize = s->uvlinesize;
-// dct_offset = s->linesize * 16;
- }
-
- if (!simple && IS_INTRA_PCM(mb_type)) {
- if (pixel_shift) {
- const int bit_depth = h->sps.bit_depth_luma;
- int j;
- GetBitContext gb;
- init_get_bits(&gb, (uint8_t*)h->mb, 384*bit_depth);
-
- for (i = 0; i < 16; i++) {
- uint16_t *tmp_y = (uint16_t*)(dest_y + i*linesize);
- for (j = 0; j < 16; j++)
- tmp_y[j] = get_bits(&gb, bit_depth);
- }
- if(simple || !CONFIG_GRAY || !(s->flags&CODEC_FLAG_GRAY)){
- if (!h->sps.chroma_format_idc) {
- for (i = 0; i < block_h; i++) {
- uint16_t *tmp_cb = (uint16_t*)(dest_cb + i*uvlinesize);
- for (j = 0; j < 8; j++) {
- tmp_cb[j] = 1 << (bit_depth - 1);
- }
- }
- for (i = 0; i < block_h; i++) {
- uint16_t *tmp_cr = (uint16_t*)(dest_cr + i*uvlinesize);
- for (j = 0; j < 8; j++) {
- tmp_cr[j] = 1 << (bit_depth - 1);
- }
+ block_offset += 16 * p;
+ if (!IS_INTRA4x4(mb_type)) {
+ if (is_h264) {
+ if (IS_INTRA16x16(mb_type)) {
+ if (transform_bypass) {
+ if (h->sps.profile_idc == 244 &&
+ (h->intra16x16_pred_mode == VERT_PRED8x8 ||
+ h->intra16x16_pred_mode == HOR_PRED8x8)) {
+ h->hpc.pred16x16_add[h->intra16x16_pred_mode](dest_y, block_offset,
+ h->mb + (p * 256 << pixel_shift),
+ linesize);
+ } else {
+ for (i = 0; i < 16; i++)
+ if (h->non_zero_count_cache[scan8[i + p * 16]] ||
+ dctcoef_get(h->mb, pixel_shift, i * 16 + p * 256))
+ s->dsp.add_pixels4(dest_y + block_offset[i],
+ h->mb + (i * 16 + p * 256 << pixel_shift),
+ linesize);
}
} else {
- for (i = 0; i < block_h; i++) {
- uint16_t *tmp_cb = (uint16_t*)(dest_cb + i*uvlinesize);
- for (j = 0; j < 8; j++)
- tmp_cb[j] = get_bits(&gb, bit_depth);
- }
- for (i = 0; i < block_h; i++) {
- uint16_t *tmp_cr = (uint16_t*)(dest_cr + i*uvlinesize);
- for (j = 0; j < 8; j++)
- tmp_cr[j] = get_bits(&gb, bit_depth);
- }
+ h->h264dsp.h264_idct_add16intra(dest_y, block_offset,
+ h->mb + (p * 256 << pixel_shift),
+ linesize,
+ h->non_zero_count_cache + p * 5 * 8);
}
- }
- } else {
- for (i=0; i<16; i++) {
- memcpy(dest_y + i* linesize, h->mb + i*8, 16);
- }
- if(simple || !CONFIG_GRAY || !(s->flags&CODEC_FLAG_GRAY)){
- if (!h->sps.chroma_format_idc) {
- for (i = 0; i < block_h; i++) {
- memset(dest_cb + i*uvlinesize, 128, 8);
- memset(dest_cr + i*uvlinesize, 128, 8);
- }
+ } else if (h->cbp & 15) {
+ if (transform_bypass) {
+ const int di = IS_8x8DCT(mb_type) ? 4 : 1;
+ idct_add = IS_8x8DCT(mb_type) ? s->dsp.add_pixels8
+ : s->dsp.add_pixels4;
+ for (i = 0; i < 16; i += di)
+ if (h->non_zero_count_cache[scan8[i + p * 16]])
+ idct_add(dest_y + block_offset[i],
+ h->mb + (i * 16 + p * 256 << pixel_shift),
+ linesize);
} else {
- for (i = 0; i < block_h; i++) {
- memcpy(dest_cb + i*uvlinesize, h->mb + 128 + i*4, 8);
- memcpy(dest_cr + i*uvlinesize, h->mb + 160 + i*4, 8);
- }
- }
- }
- }
- } else {
- if(IS_INTRA(mb_type)){
- if(h->deblocking_filter)
- xchg_mb_border(h, dest_y, dest_cb, dest_cr, linesize, uvlinesize, 1, 0, simple, pixel_shift);
-
- if(simple || !CONFIG_GRAY || !(s->flags&CODEC_FLAG_GRAY)){
- h->hpc.pred8x8[ h->chroma_pred_mode ](dest_cb, uvlinesize);
- h->hpc.pred8x8[ h->chroma_pred_mode ](dest_cr, uvlinesize);
- }
-
- hl_decode_mb_predict_luma(h, mb_type, is_h264, simple, transform_bypass, pixel_shift, block_offset, linesize, dest_y, 0);
-
- if(h->deblocking_filter)
- xchg_mb_border(h, dest_y, dest_cb, dest_cr, linesize, uvlinesize, 0, 0, simple, pixel_shift);
- }else if(is_h264){
- if (chroma422) {
- hl_motion_422(h, dest_y, dest_cb, dest_cr,
- s->me.qpel_put, s->dsp.put_h264_chroma_pixels_tab,
- s->me.qpel_avg, s->dsp.avg_h264_chroma_pixels_tab,
- h->h264dsp.weight_h264_pixels_tab,
- h->h264dsp.biweight_h264_pixels_tab,
- pixel_shift);
- } else {
- hl_motion_420(h, dest_y, dest_cb, dest_cr,
- s->me.qpel_put, s->dsp.put_h264_chroma_pixels_tab,
- s->me.qpel_avg, s->dsp.avg_h264_chroma_pixels_tab,
- h->h264dsp.weight_h264_pixels_tab,
- h->h264dsp.biweight_h264_pixels_tab,
- pixel_shift);
- }
- }
-
- hl_decode_mb_idct_luma(h, mb_type, is_h264, simple, transform_bypass, pixel_shift, block_offset, linesize, dest_y, 0);
-
- if((simple || !CONFIG_GRAY || !(s->flags&CODEC_FLAG_GRAY)) && (h->cbp&0x30)){
- uint8_t *dest[2] = {dest_cb, dest_cr};
- if(transform_bypass){
- if(IS_INTRA(mb_type) && h->sps.profile_idc==244 && (h->chroma_pred_mode==VERT_PRED8x8 || h->chroma_pred_mode==HOR_PRED8x8)){
- h->hpc.pred8x8_add[h->chroma_pred_mode](dest[0], block_offset + 16, h->mb + (16*16*1 << pixel_shift), uvlinesize);
- h->hpc.pred8x8_add[h->chroma_pred_mode](dest[1], block_offset + 32, h->mb + (16*16*2 << pixel_shift), uvlinesize);
- }else{
- idct_add = s->dsp.add_pixels4;
- for(j=1; j<3; j++){
- for(i=j*16; i<j*16+4; i++){
- if(h->non_zero_count_cache[ scan8[i] ] || dctcoef_get(h->mb, pixel_shift, i*16))
- idct_add (dest[j-1] + block_offset[i], h->mb + (i*16 << pixel_shift), uvlinesize);
- }
- if (chroma422) {
- for(i=j*16+4; i<j*16+8; i++){
- if(h->non_zero_count_cache[ scan8[i+4] ] || dctcoef_get(h->mb, pixel_shift, i*16))
- idct_add (dest[j-1] + block_offset[i+4], h->mb + (i*16 << pixel_shift), uvlinesize);
- }
- }
- }
- }
- }else{
- if(is_h264){
- int qp[2];
- if (chroma422) {
- qp[0] = h->chroma_qp[0] + 3;
- qp[1] = h->chroma_qp[1] + 3;
- } else {
- qp[0] = h->chroma_qp[0];
- qp[1] = h->chroma_qp[1];
- }
- if(h->non_zero_count_cache[ scan8[CHROMA_DC_BLOCK_INDEX+0] ])
- h->h264dsp.h264_chroma_dc_dequant_idct(h->mb + (16*16*1 << pixel_shift), h->dequant4_coeff[IS_INTRA(mb_type) ? 1:4][qp[0]][0]);
- if(h->non_zero_count_cache[ scan8[CHROMA_DC_BLOCK_INDEX+1] ])
- h->h264dsp.h264_chroma_dc_dequant_idct(h->mb + (16*16*2 << pixel_shift), h->dequant4_coeff[IS_INTRA(mb_type) ? 2:5][qp[1]][0]);
- h->h264dsp.h264_idct_add8(dest, block_offset,
- h->mb, uvlinesize,
- h->non_zero_count_cache);
- } else if (CONFIG_SVQ3_DECODER) {
- h->h264dsp.h264_chroma_dc_dequant_idct(h->mb + 16*16*1, h->dequant4_coeff[IS_INTRA(mb_type) ? 1:4][h->chroma_qp[0]][0]);
- h->h264dsp.h264_chroma_dc_dequant_idct(h->mb + 16*16*2, h->dequant4_coeff[IS_INTRA(mb_type) ? 2:5][h->chroma_qp[1]][0]);
- for(j=1; j<3; j++){
- for(i=j*16; i<j*16+4; i++){
- if(h->non_zero_count_cache[ scan8[i] ] || h->mb[i*16]){
- uint8_t * const ptr= dest[j-1] + block_offset[i];
- ff_svq3_add_idct_c(ptr, h->mb + i*16, uvlinesize, ff_h264_chroma_qp[0][s->qscale + 12] - 12, 2);
- }
- }
- }
- }
- }
- }
- }
- if(h->cbp || IS_INTRA(mb_type))
- {
- s->dsp.clear_blocks(h->mb);
- s->dsp.clear_blocks(h->mb+(24*16<<pixel_shift));
- }
-}
-
-static av_always_inline void hl_decode_mb_444_internal(H264Context *h, int simple, int pixel_shift){
- MpegEncContext * const s = &h->s;
- const int mb_x= s->mb_x;
- const int mb_y= s->mb_y;
- const int mb_xy= h->mb_xy;
- const int mb_type = s->current_picture.f.mb_type[mb_xy];
- uint8_t *dest[3];
- int linesize;
- int i, j, p;
- int *block_offset = &h->block_offset[0];
- const int transform_bypass = !simple && (s->qscale == 0 && h->sps.transform_bypass);
- const int plane_count = (simple || !CONFIG_GRAY || !(s->flags&CODEC_FLAG_GRAY)) ? 3 : 1;
-
- for (p = 0; p < plane_count; p++)
- {
- dest[p] = s->current_picture.f.data[p] + ((mb_x << pixel_shift) + mb_y * s->linesize) * 16;
- s->dsp.prefetch(dest[p] + (s->mb_x&3)*4*s->linesize + (64 << pixel_shift), s->linesize, 4);
- }
-
- h->list_counts[mb_xy]= h->list_count;
-
- if (!simple && MB_FIELD) {
- linesize = h->mb_linesize = h->mb_uvlinesize = s->linesize * 2;
- block_offset = &h->block_offset[48];
- if(mb_y&1) //FIXME move out of this function?
- for (p = 0; p < 3; p++)
- dest[p] -= s->linesize*15;
- if(FRAME_MBAFF) {
- int list;
- for(list=0; list<h->list_count; list++){
- if(!USES_LIST(mb_type, list))
- continue;
- if(IS_16X16(mb_type)){
- int8_t *ref = &h->ref_cache[list][scan8[0]];
- fill_rectangle(ref, 4, 4, 8, (16+*ref)^(s->mb_y&1), 1);
- }else{
- for(i=0; i<16; i+=4){
- int ref = h->ref_cache[list][scan8[i]];
- if(ref >= 0)
- fill_rectangle(&h->ref_cache[list][scan8[i]], 2, 2, 8, (16+ref)^(s->mb_y&1), 1);
- }
+ if (IS_8x8DCT(mb_type))
+ h->h264dsp.h264_idct8_add4(dest_y, block_offset,
+ h->mb + (p * 256 << pixel_shift),
+ linesize,
+ h->non_zero_count_cache + p * 5 * 8);
+ else
+ h->h264dsp.h264_idct_add16(dest_y, block_offset,
+ h->mb + (p * 256 << pixel_shift),
+ linesize,
+ h->non_zero_count_cache + p * 5 * 8);
}
}
- }
- } else {
- linesize = h->mb_linesize = h->mb_uvlinesize = s->linesize;
- }
-
- if (!simple && IS_INTRA_PCM(mb_type)) {
- if (pixel_shift) {
- const int bit_depth = h->sps.bit_depth_luma;
- GetBitContext gb;
- init_get_bits(&gb, (uint8_t*)h->mb, 768*bit_depth);
-
- for (p = 0; p < plane_count; p++) {
- for (i = 0; i < 16; i++) {
- uint16_t *tmp = (uint16_t*)(dest[p] + i*linesize);
- for (j = 0; j < 16; j++)
- tmp[j] = get_bits(&gb, bit_depth);
- }
- }
- } else {
- for (p = 0; p < plane_count; p++) {
- for (i = 0; i < 16; i++) {
- memcpy(dest[p] + i*linesize, h->mb + p*128 + i*8, 16);
+ } else if (CONFIG_SVQ3_DECODER) {
+ for (i = 0; i < 16; i++)
+ if (h->non_zero_count_cache[scan8[i + p * 16]] || h->mb[i * 16 + p * 256]) {
+ // FIXME benchmark weird rule, & below
+ uint8_t *const ptr = dest_y + block_offset[i];
+ ff_svq3_add_idct_c(ptr, h->mb + i * 16 + p * 256, linesize,
+ s->qscale, IS_INTRA(mb_type) ? 1 : 0);
}
- }
- }
- } else {
- if(IS_INTRA(mb_type)){
- if(h->deblocking_filter)
- xchg_mb_border(h, dest[0], dest[1], dest[2], linesize, linesize, 1, 1, simple, pixel_shift);
-
- for (p = 0; p < plane_count; p++)
- hl_decode_mb_predict_luma(h, mb_type, 1, simple, transform_bypass, pixel_shift, block_offset, linesize, dest[p], p);
-
- if(h->deblocking_filter)
- xchg_mb_border(h, dest[0], dest[1], dest[2], linesize, linesize, 0, 1, simple, pixel_shift);
- }else{
- hl_motion(h, dest[0], dest[1], dest[2],
- s->me.qpel_put, s->dsp.put_h264_chroma_pixels_tab,
- s->me.qpel_avg, s->dsp.avg_h264_chroma_pixels_tab,
- h->h264dsp.weight_h264_pixels_tab,
- h->h264dsp.biweight_h264_pixels_tab, pixel_shift, 3);
}
-
- for (p = 0; p < plane_count; p++)
- hl_decode_mb_idct_luma(h, mb_type, 1, simple, transform_bypass, pixel_shift, block_offset, linesize, dest[p], p);
}
- if(h->cbp || IS_INTRA(mb_type))
- {
- s->dsp.clear_blocks(h->mb);
- s->dsp.clear_blocks(h->mb+(24*16<<pixel_shift));
- }
-}
-
-/**
- * Process a macroblock; this case avoids checks for expensive uncommon cases.
- */
-#define hl_decode_mb_simple(sh, bits) \
-static void hl_decode_mb_simple_ ## bits(H264Context *h){ \
- hl_decode_mb_internal(h, 1, sh); \
}
-hl_decode_mb_simple(0, 8)
-hl_decode_mb_simple(1, 16)
-/**
- * Process a macroblock; this handles edge cases, such as interlacing.
- */
-static void av_noinline hl_decode_mb_complex(H264Context *h){
- hl_decode_mb_internal(h, 0, h->pixel_shift);
-}
+#define BITS 8
+#define SIMPLE 1
+#include "h264_mb_template.c"
-static void av_noinline hl_decode_mb_444_complex(H264Context *h){
- hl_decode_mb_444_internal(h, 0, h->pixel_shift);
-}
+#undef BITS
+#define BITS 16
+#include "h264_mb_template.c"
-static void av_noinline hl_decode_mb_444_simple(H264Context *h){
- hl_decode_mb_444_internal(h, 1, 0);
-}
+#undef SIMPLE
+#define SIMPLE 0
+#include "h264_mb_template.c"
-void ff_h264_hl_decode_mb(H264Context *h){
- MpegEncContext * const s = &h->s;
- const int mb_xy= h->mb_xy;
+void ff_h264_hl_decode_mb(H264Context *h)
+{
+ MpegEncContext *const s = &h->s;
+ const int mb_xy = h->mb_xy;
const int mb_type = s->current_picture.f.mb_type[mb_xy];
- int is_complex = CONFIG_SMALL || h->is_complex || IS_INTRA_PCM(mb_type) || s->qscale == 0;
+ int is_complex = CONFIG_SMALL || h->is_complex || IS_INTRA_PCM(mb_type) || s->qscale == 0;
if (CHROMA444) {
- if(is_complex || h->pixel_shift)
+ if (is_complex || h->pixel_shift)
hl_decode_mb_444_complex(h);
else
- hl_decode_mb_444_simple(h);
+ hl_decode_mb_444_simple_8(h);
} else if (is_complex) {
hl_decode_mb_complex(h);
} else if (h->pixel_shift) {
@@ -2242,64 +1989,66 @@ void ff_h264_hl_decode_mb(H264Context *h){
hl_decode_mb_simple_8(h);
}
-static int pred_weight_table(H264Context *h){
- MpegEncContext * const s = &h->s;
+static int pred_weight_table(H264Context *h)
+{
+ MpegEncContext *const s = &h->s;
int list, i;
int luma_def, chroma_def;
- h->use_weight= 0;
- h->use_weight_chroma= 0;
- h->luma_log2_weight_denom= get_ue_golomb(&s->gb);
- if(h->sps.chroma_format_idc)
- h->chroma_log2_weight_denom= get_ue_golomb(&s->gb);
- luma_def = 1<<h->luma_log2_weight_denom;
- chroma_def = 1<<h->chroma_log2_weight_denom;
+ h->use_weight = 0;
+ h->use_weight_chroma = 0;
+ h->luma_log2_weight_denom = get_ue_golomb(&s->gb);
+ if (h->sps.chroma_format_idc)
+ h->chroma_log2_weight_denom = get_ue_golomb(&s->gb);
+ luma_def = 1 << h->luma_log2_weight_denom;
+ chroma_def = 1 << h->chroma_log2_weight_denom;
- for(list=0; list<2; list++){
+ for (list = 0; list < 2; list++) {
h->luma_weight_flag[list] = 0;
h->chroma_weight_flag[list] = 0;
- for(i=0; i<h->ref_count[list]; i++){
+ for (i = 0; i < h->ref_count[list]; i++) {
int luma_weight_flag, chroma_weight_flag;
- luma_weight_flag= get_bits1(&s->gb);
- if(luma_weight_flag){
- h->luma_weight[i][list][0]= get_se_golomb(&s->gb);
- h->luma_weight[i][list][1]= get_se_golomb(&s->gb);
- if( h->luma_weight[i][list][0] != luma_def
- || h->luma_weight[i][list][1] != 0) {
- h->use_weight= 1;
- h->luma_weight_flag[list]= 1;
+ luma_weight_flag = get_bits1(&s->gb);
+ if (luma_weight_flag) {
+ h->luma_weight[i][list][0] = get_se_golomb(&s->gb);
+ h->luma_weight[i][list][1] = get_se_golomb(&s->gb);
+ if (h->luma_weight[i][list][0] != luma_def ||
+ h->luma_weight[i][list][1] != 0) {
+ h->use_weight = 1;
+ h->luma_weight_flag[list] = 1;
}
- }else{
- h->luma_weight[i][list][0]= luma_def;
- h->luma_weight[i][list][1]= 0;
+ } else {
+ h->luma_weight[i][list][0] = luma_def;
+ h->luma_weight[i][list][1] = 0;
}
- if(h->sps.chroma_format_idc){
- chroma_weight_flag= get_bits1(&s->gb);
- if(chroma_weight_flag){
+ if (h->sps.chroma_format_idc) {
+ chroma_weight_flag = get_bits1(&s->gb);
+ if (chroma_weight_flag) {
int j;
- for(j=0; j<2; j++){
- h->chroma_weight[i][list][j][0]= get_se_golomb(&s->gb);
- h->chroma_weight[i][list][j][1]= get_se_golomb(&s->gb);
- if( h->chroma_weight[i][list][j][0] != chroma_def
- || h->chroma_weight[i][list][j][1] != 0) {
- h->use_weight_chroma= 1;
- h->chroma_weight_flag[list]= 1;
+ for (j = 0; j < 2; j++) {
+ h->chroma_weight[i][list][j][0] = get_se_golomb(&s->gb);
+ h->chroma_weight[i][list][j][1] = get_se_golomb(&s->gb);
+ if (h->chroma_weight[i][list][j][0] != chroma_def ||
+ h->chroma_weight[i][list][j][1] != 0) {
+ h->use_weight_chroma = 1;
+ h->chroma_weight_flag[list] = 1;
}
}
- }else{
+ } else {
int j;
- for(j=0; j<2; j++){
- h->chroma_weight[i][list][j][0]= chroma_def;
- h->chroma_weight[i][list][j][1]= 0;
+ for (j = 0; j < 2; j++) {
+ h->chroma_weight[i][list][j][0] = chroma_def;
+ h->chroma_weight[i][list][j][1] = 0;
}
}
}
}
- if(h->slice_type_nos != AV_PICTURE_TYPE_B) break;
+ if (h->slice_type_nos != AV_PICTURE_TYPE_B)
+ break;
}
- h->use_weight= h->use_weight || h->use_weight_chroma;
+ h->use_weight = h->use_weight || h->use_weight_chroma;
return 0;
}
@@ -2308,8 +2057,9 @@ static int pred_weight_table(H264Context *h){
* @param field 0/1 initialize the weight for interlaced MBAFF
* -1 initializes the rest
*/
-static void implicit_weight_table(H264Context *h, int field){
- MpegEncContext * const s = &h->s;
+static void implicit_weight_table(H264Context *h, int field)
+{
+ MpegEncContext *const s = &h->s;
int ref0, ref1, i, cur_poc, ref_start, ref_count0, ref_count1;
for (i = 0; i < 2; i++) {
@@ -2317,53 +2067,53 @@ static void implicit_weight_table(H264Context *h, int field){
h->chroma_weight_flag[i] = 0;
}
- if(field < 0){
+ if (field < 0) {
if (s->picture_structure == PICT_FRAME) {
cur_poc = s->current_picture_ptr->poc;
} else {
cur_poc = s->current_picture_ptr->field_poc[s->picture_structure - 1];
}
- if( h->ref_count[0] == 1 && h->ref_count[1] == 1 && !FRAME_MBAFF
- && h->ref_list[0][0].poc + h->ref_list[1][0].poc == 2*cur_poc){
- h->use_weight= 0;
- h->use_weight_chroma= 0;
- return;
- }
- ref_start= 0;
- ref_count0= h->ref_count[0];
- ref_count1= h->ref_count[1];
- }else{
- cur_poc = s->current_picture_ptr->field_poc[field];
- ref_start= 16;
- ref_count0= 16+2*h->ref_count[0];
- ref_count1= 16+2*h->ref_count[1];
+ if (h->ref_count[0] == 1 && h->ref_count[1] == 1 && !FRAME_MBAFF &&
+ h->ref_list[0][0].poc + h->ref_list[1][0].poc == 2 * cur_poc) {
+ h->use_weight = 0;
+ h->use_weight_chroma = 0;
+ return;
+ }
+ ref_start = 0;
+ ref_count0 = h->ref_count[0];
+ ref_count1 = h->ref_count[1];
+ } else {
+ cur_poc = s->current_picture_ptr->field_poc[field];
+ ref_start = 16;
+ ref_count0 = 16 + 2 * h->ref_count[0];
+ ref_count1 = 16 + 2 * h->ref_count[1];
}
- h->use_weight= 2;
- h->use_weight_chroma= 2;
- h->luma_log2_weight_denom= 5;
- h->chroma_log2_weight_denom= 5;
+ h->use_weight = 2;
+ h->use_weight_chroma = 2;
+ h->luma_log2_weight_denom = 5;
+ h->chroma_log2_weight_denom = 5;
- for(ref0=ref_start; ref0 < ref_count0; ref0++){
+ for (ref0 = ref_start; ref0 < ref_count0; ref0++) {
int poc0 = h->ref_list[0][ref0].poc;
- for(ref1=ref_start; ref1 < ref_count1; ref1++){
+ for (ref1 = ref_start; ref1 < ref_count1; ref1++) {
int w = 32;
if (!h->ref_list[0][ref0].long_ref && !h->ref_list[1][ref1].long_ref) {
int poc1 = h->ref_list[1][ref1].poc;
- int td = av_clip(poc1 - poc0, -128, 127);
- if(td){
+ int td = av_clip(poc1 - poc0, -128, 127);
+ if (td) {
int tb = av_clip(cur_poc - poc0, -128, 127);
int tx = (16384 + (FFABS(td) >> 1)) / td;
- int dist_scale_factor = (tb*tx + 32) >> 8;
- if(dist_scale_factor >= -64 && dist_scale_factor <= 128)
+ int dist_scale_factor = (tb * tx + 32) >> 8;
+ if (dist_scale_factor >= -64 && dist_scale_factor <= 128)
w = 64 - dist_scale_factor;
}
}
- if(field<0){
- h->implicit_weight[ref0][ref1][0]=
- h->implicit_weight[ref0][ref1][1]= w;
- }else{
- h->implicit_weight[ref0][ref1][field]=w;
+ if (field < 0) {
+ h->implicit_weight[ref0][ref1][0] =
+ h->implicit_weight[ref0][ref1][1] = w;
+ } else {
+ h->implicit_weight[ref0][ref1][field] = w;
}
}
}
@@ -2372,140 +2122,156 @@ static void implicit_weight_table(H264Context *h, int field){
/**
* instantaneous decoder refresh.
*/
-static void idr(H264Context *h){
+static void idr(H264Context *h)
+{
ff_h264_remove_all_refs(h);
- h->prev_frame_num= 0;
- h->prev_frame_num_offset= 0;
- h->prev_poc_msb=
- h->prev_poc_lsb= 0;
+ h->prev_frame_num = 0;
+ h->prev_frame_num_offset = 0;
+ h->prev_poc_msb =
+ h->prev_poc_lsb = 0;
}
/* forget old pics after a seek */
-static void flush_dpb(AVCodecContext *avctx){
- H264Context *h= avctx->priv_data;
+static void flush_change(H264Context *h)
+{
int i;
- for(i=0; i<MAX_DELAYED_PIC_COUNT; i++) {
- if(h->delayed_pic[i])
- h->delayed_pic[i]->f.reference = 0;
- h->delayed_pic[i]= NULL;
- }
for (i = 0; i < MAX_DELAYED_PIC_COUNT; i++)
h->last_pocs[i] = INT_MIN;
- h->outputed_poc=h->next_outputed_poc= INT_MIN;
+ h->outputed_poc = h->next_outputed_poc = INT_MIN;
h->prev_interlaced_frame = 1;
idr(h);
- if(h->s.current_picture_ptr)
+ if (h->s.current_picture_ptr)
h->s.current_picture_ptr->f.reference = 0;
- h->s.first_field= 0;
+ h->s.first_field = 0;
+ memset(h->ref_list[0], 0, sizeof(h->ref_list[0]));
+ memset(h->ref_list[1], 0, sizeof(h->ref_list[1]));
+ memset(h->default_ref_list[0], 0, sizeof(h->default_ref_list[0]));
+ memset(h->default_ref_list[1], 0, sizeof(h->default_ref_list[1]));
ff_h264_reset_sei(h);
+}
+
+/* forget old pics after a seek */
+static void flush_dpb(AVCodecContext *avctx)
+{
+ H264Context *h = avctx->priv_data;
+ int i;
+
+ for (i = 0; i < MAX_DELAYED_PIC_COUNT; i++) {
+ if (h->delayed_pic[i])
+ h->delayed_pic[i]->f.reference = 0;
+ h->delayed_pic[i] = NULL;
+ }
+
+ flush_change(h);
ff_mpeg_flush(avctx);
}
-static int init_poc(H264Context *h){
- MpegEncContext * const s = &h->s;
- const int max_frame_num= 1<<h->sps.log2_max_frame_num;
+static int init_poc(H264Context *h)
+{
+ MpegEncContext *const s = &h->s;
+ const int max_frame_num = 1 << h->sps.log2_max_frame_num;
int field_poc[2];
Picture *cur = s->current_picture_ptr;
- h->frame_num_offset= h->prev_frame_num_offset;
- if(h->frame_num < h->prev_frame_num)
+ h->frame_num_offset = h->prev_frame_num_offset;
+ if (h->frame_num < h->prev_frame_num)
h->frame_num_offset += max_frame_num;
- if(h->sps.poc_type==0){
- const int max_poc_lsb= 1<<h->sps.log2_max_poc_lsb;
+ if (h->sps.poc_type == 0) {
+ const int max_poc_lsb = 1 << h->sps.log2_max_poc_lsb;
- if (h->poc_lsb < h->prev_poc_lsb && h->prev_poc_lsb - h->poc_lsb >= max_poc_lsb/2)
+ if (h->poc_lsb < h->prev_poc_lsb && h->prev_poc_lsb - h->poc_lsb >= max_poc_lsb / 2)
h->poc_msb = h->prev_poc_msb + max_poc_lsb;
- else if(h->poc_lsb > h->prev_poc_lsb && h->prev_poc_lsb - h->poc_lsb < -max_poc_lsb/2)
+ else if (h->poc_lsb > h->prev_poc_lsb && h->prev_poc_lsb - h->poc_lsb < -max_poc_lsb / 2)
h->poc_msb = h->prev_poc_msb - max_poc_lsb;
else
h->poc_msb = h->prev_poc_msb;
-//printf("poc: %d %d\n", h->poc_msb, h->poc_lsb);
field_poc[0] =
field_poc[1] = h->poc_msb + h->poc_lsb;
- if(s->picture_structure == PICT_FRAME)
+ if (s->picture_structure == PICT_FRAME)
field_poc[1] += h->delta_poc_bottom;
- }else if(h->sps.poc_type==1){
+ } else if (h->sps.poc_type == 1) {
int abs_frame_num, expected_delta_per_poc_cycle, expectedpoc;
int i;
- if(h->sps.poc_cycle_length != 0)
+ if (h->sps.poc_cycle_length != 0)
abs_frame_num = h->frame_num_offset + h->frame_num;
else
abs_frame_num = 0;
- if(h->nal_ref_idc==0 && abs_frame_num > 0)
+ if (h->nal_ref_idc == 0 && abs_frame_num > 0)
abs_frame_num--;
expected_delta_per_poc_cycle = 0;
- for(i=0; i < h->sps.poc_cycle_length; i++)
- expected_delta_per_poc_cycle += h->sps.offset_for_ref_frame[ i ]; //FIXME integrate during sps parse
+ for (i = 0; i < h->sps.poc_cycle_length; i++)
+ // FIXME integrate during sps parse
+ expected_delta_per_poc_cycle += h->sps.offset_for_ref_frame[i];
- if(abs_frame_num > 0){
+ if (abs_frame_num > 0) {
int poc_cycle_cnt = (abs_frame_num - 1) / h->sps.poc_cycle_length;
int frame_num_in_poc_cycle = (abs_frame_num - 1) % h->sps.poc_cycle_length;
expectedpoc = poc_cycle_cnt * expected_delta_per_poc_cycle;
- for(i = 0; i <= frame_num_in_poc_cycle; i++)
- expectedpoc = expectedpoc + h->sps.offset_for_ref_frame[ i ];
+ for (i = 0; i <= frame_num_in_poc_cycle; i++)
+ expectedpoc = expectedpoc + h->sps.offset_for_ref_frame[i];
} else
expectedpoc = 0;
- if(h->nal_ref_idc == 0)
+ if (h->nal_ref_idc == 0)
expectedpoc = expectedpoc + h->sps.offset_for_non_ref_pic;
field_poc[0] = expectedpoc + h->delta_poc[0];
field_poc[1] = field_poc[0] + h->sps.offset_for_top_to_bottom_field;
- if(s->picture_structure == PICT_FRAME)
+ if (s->picture_structure == PICT_FRAME)
field_poc[1] += h->delta_poc[1];
- }else{
- int poc= 2*(h->frame_num_offset + h->frame_num);
+ } else {
+ int poc = 2 * (h->frame_num_offset + h->frame_num);
- if(!h->nal_ref_idc)
+ if (!h->nal_ref_idc)
poc--;
- field_poc[0]= poc;
- field_poc[1]= poc;
+ field_poc[0] = poc;
+ field_poc[1] = poc;
}
- if(s->picture_structure != PICT_BOTTOM_FIELD)
- s->current_picture_ptr->field_poc[0]= field_poc[0];
- if(s->picture_structure != PICT_TOP_FIELD)
- s->current_picture_ptr->field_poc[1]= field_poc[1];
- cur->poc= FFMIN(cur->field_poc[0], cur->field_poc[1]);
+ if (s->picture_structure != PICT_BOTTOM_FIELD)
+ s->current_picture_ptr->field_poc[0] = field_poc[0];
+ if (s->picture_structure != PICT_TOP_FIELD)
+ s->current_picture_ptr->field_poc[1] = field_poc[1];
+ cur->poc = FFMIN(cur->field_poc[0], cur->field_poc[1]);
return 0;
}
-
/**
* initialize scan tables
*/
-static void init_scan_tables(H264Context *h){
+static void init_scan_tables(H264Context *h)
+{
int i;
- for(i=0; i<16; i++){
-#define T(x) (x>>2) | ((x<<2) & 0xF)
+ for (i = 0; i < 16; i++) {
+#define T(x) (x >> 2) | ((x << 2) & 0xF)
h->zigzag_scan[i] = T(zigzag_scan[i]);
- h-> field_scan[i] = T( field_scan[i]);
+ h->field_scan[i] = T(field_scan[i]);
#undef T
}
- for(i=0; i<64; i++){
-#define T(x) (x>>3) | ((x&7)<<3)
+ for (i = 0; i < 64; i++) {
+#define T(x) (x >> 3) | ((x & 7) << 3)
h->zigzag_scan8x8[i] = T(ff_zigzag_direct[i]);
h->zigzag_scan8x8_cavlc[i] = T(zigzag_scan8x8_cavlc[i]);
h->field_scan8x8[i] = T(field_scan8x8[i]);
h->field_scan8x8_cavlc[i] = T(field_scan8x8_cavlc[i]);
#undef T
}
- if(h->sps.transform_bypass){ //FIXME same ugly
+ if (h->sps.transform_bypass) { // FIXME same ugly
h->zigzag_scan_q0 = zigzag_scan;
h->zigzag_scan8x8_q0 = ff_zigzag_direct;
h->zigzag_scan8x8_cavlc_q0 = zigzag_scan8x8_cavlc;
h->field_scan_q0 = field_scan;
h->field_scan8x8_q0 = field_scan8x8;
h->field_scan8x8_cavlc_q0 = field_scan8x8_cavlc;
- }else{
+ } else {
h->zigzag_scan_q0 = h->zigzag_scan;
h->zigzag_scan8x8_q0 = h->zigzag_scan8x8;
h->zigzag_scan8x8_cavlc_q0 = h->zigzag_scan8x8_cavlc;
@@ -2515,36 +2281,40 @@ static void init_scan_tables(H264Context *h){
}
}
-static int field_end(H264Context *h, int in_setup){
- MpegEncContext * const s = &h->s;
- AVCodecContext * const avctx= s->avctx;
+static int field_end(H264Context *h, int in_setup)
+{
+ MpegEncContext *const s = &h->s;
+ AVCodecContext *const avctx = s->avctx;
int err = 0;
- s->mb_y= 0;
+ s->mb_y = 0;
- if (!in_setup && !s->dropable)
+ if (!in_setup && !s->droppable)
ff_thread_report_progress(&s->current_picture_ptr->f, INT_MAX,
s->picture_structure == PICT_BOTTOM_FIELD);
- if (CONFIG_H264_VDPAU_DECODER && s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU)
+ if (CONFIG_H264_VDPAU_DECODER &&
+ s->avctx->codec->capabilities & CODEC_CAP_HWACCEL_VDPAU)
ff_vdpau_h264_set_reference_frames(s);
- if(in_setup || !(avctx->active_thread_type&FF_THREAD_FRAME)){
- if(!s->dropable) {
+ if (in_setup || !(avctx->active_thread_type & FF_THREAD_FRAME)) {
+ if (!s->droppable) {
err = ff_h264_execute_ref_pic_marking(h, h->mmco, h->mmco_index);
- h->prev_poc_msb= h->poc_msb;
- h->prev_poc_lsb= h->poc_lsb;
+ h->prev_poc_msb = h->poc_msb;
+ h->prev_poc_lsb = h->poc_lsb;
}
- h->prev_frame_num_offset= h->frame_num_offset;
- h->prev_frame_num= h->frame_num;
- h->outputed_poc = h->next_outputed_poc;
+ h->prev_frame_num_offset = h->frame_num_offset;
+ h->prev_frame_num = h->frame_num;
+ h->outputed_poc = h->next_outputed_poc;
}
if (avctx->hwaccel) {
if (avctx->hwaccel->end_frame(avctx) < 0)
- av_log(avctx, AV_LOG_ERROR, "hardware accelerator failed to decode picture\n");
+ av_log(avctx, AV_LOG_ERROR,
+ "hardware accelerator failed to decode picture\n");
}
- if (CONFIG_H264_VDPAU_DECODER && s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU)
+ if (CONFIG_H264_VDPAU_DECODER &&
+ s->avctx->codec->capabilities & CODEC_CAP_HWACCEL_VDPAU)
ff_vdpau_h264_picture_complete(s);
/*
@@ -2562,9 +2332,9 @@ static int field_end(H264Context *h, int in_setup){
if (!FIELD_PICTURE)
ff_er_frame_end(s);
- MPV_frame_end(s);
+ ff_MPV_frame_end(s);
- h->current_slice=0;
+ h->current_slice = 0;
return err;
}
@@ -2572,20 +2342,29 @@ static int field_end(H264Context *h, int in_setup){
/**
* Replicate H264 "master" context to thread contexts.
*/
-static void clone_slice(H264Context *dst, H264Context *src)
+static int clone_slice(H264Context *dst, H264Context *src)
{
- memcpy(dst->block_offset, src->block_offset, sizeof(dst->block_offset));
- dst->s.current_picture_ptr = src->s.current_picture_ptr;
- dst->s.current_picture = src->s.current_picture;
- dst->s.linesize = src->s.linesize;
- dst->s.uvlinesize = src->s.uvlinesize;
- dst->s.first_field = src->s.first_field;
-
- dst->prev_poc_msb = src->prev_poc_msb;
- dst->prev_poc_lsb = src->prev_poc_lsb;
- dst->prev_frame_num_offset = src->prev_frame_num_offset;
- dst->prev_frame_num = src->prev_frame_num;
- dst->short_ref_count = src->short_ref_count;
+ int ret;
+
+ memcpy(dst->block_offset, src->block_offset, sizeof(dst->block_offset));
+ dst->s.current_picture_ptr = src->s.current_picture_ptr;
+ dst->s.current_picture = src->s.current_picture;
+ dst->s.linesize = src->s.linesize;
+ dst->s.uvlinesize = src->s.uvlinesize;
+ dst->s.first_field = src->s.first_field;
+
+ if (!dst->s.edge_emu_buffer &&
+ (ret = ff_mpv_frame_size_alloc(&dst->s, dst->s.linesize))) {
+ av_log(dst->s.avctx, AV_LOG_ERROR,
+ "Failed to allocate scratch buffers\n");
+ return ret;
+ }
+
+ dst->prev_poc_msb = src->prev_poc_msb;
+ dst->prev_poc_lsb = src->prev_poc_lsb;
+ dst->prev_frame_num_offset = src->prev_frame_num_offset;
+ dst->prev_frame_num = src->prev_frame_num;
+ dst->short_ref_count = src->short_ref_count;
memcpy(dst->short_ref, src->short_ref, sizeof(dst->short_ref));
memcpy(dst->long_ref, src->long_ref, sizeof(dst->long_ref));
@@ -2594,6 +2373,8 @@ static void clone_slice(H264Context *dst, H264Context *src)
memcpy(dst->dequant4_coeff, src->dequant4_coeff, sizeof(src->dequant4_coeff));
memcpy(dst->dequant8_coeff, src->dequant8_coeff, sizeof(src->dequant8_coeff));
+
+ return 0;
}
/**
@@ -2607,60 +2388,238 @@ int ff_h264_get_profile(SPS *sps)
{
int profile = sps->profile_idc;
- switch(sps->profile_idc) {
+ switch (sps->profile_idc) {
case FF_PROFILE_H264_BASELINE:
// constraint_set1_flag set to 1
- profile |= (sps->constraint_set_flags & 1<<1) ? FF_PROFILE_H264_CONSTRAINED : 0;
+ profile |= (sps->constraint_set_flags & 1 << 1) ? FF_PROFILE_H264_CONSTRAINED : 0;
break;
case FF_PROFILE_H264_HIGH_10:
case FF_PROFILE_H264_HIGH_422:
case FF_PROFILE_H264_HIGH_444_PREDICTIVE:
// constraint_set3_flag set to 1
- profile |= (sps->constraint_set_flags & 1<<3) ? FF_PROFILE_H264_INTRA : 0;
+ profile |= (sps->constraint_set_flags & 1 << 3) ? FF_PROFILE_H264_INTRA : 0;
break;
}
return profile;
}
+static int h264_set_parameter_from_sps(H264Context *h)
+{
+ MpegEncContext *s = &h->s;
+
+ if (s->flags & CODEC_FLAG_LOW_DELAY ||
+ (h->sps.bitstream_restriction_flag &&
+ !h->sps.num_reorder_frames)) {
+ if (s->avctx->has_b_frames > 1 || h->delayed_pic[0])
+ av_log(h->s.avctx, AV_LOG_WARNING, "Delayed frames seen. "
+ "Reenabling low delay requires a codec flush.\n");
+ else
+ s->low_delay = 1;
+ }
+
+ if (s->avctx->has_b_frames < 2)
+ s->avctx->has_b_frames = !s->low_delay;
+
+ if (h->sps.bit_depth_luma != h->sps.bit_depth_chroma) {
+ av_log_missing_feature(s->avctx,
+ "Different bit depth between chroma and luma", 1);
+ return AVERROR_PATCHWELCOME;
+ }
+
+ if (s->avctx->bits_per_raw_sample != h->sps.bit_depth_luma ||
+ h->cur_chroma_format_idc != h->sps.chroma_format_idc) {
+ if (s->avctx->codec &&
+ s->avctx->codec->capabilities & CODEC_CAP_HWACCEL_VDPAU &&
+ (h->sps.bit_depth_luma != 8 || h->sps.chroma_format_idc > 1)) {
+ av_log(s->avctx, AV_LOG_ERROR,
+ "VDPAU decoding does not support video colorspace.\n");
+ return AVERROR_INVALIDDATA;
+ }
+ if (h->sps.bit_depth_luma >= 8 && h->sps.bit_depth_luma <= 10) {
+ s->avctx->bits_per_raw_sample = h->sps.bit_depth_luma;
+ h->cur_chroma_format_idc = h->sps.chroma_format_idc;
+ h->pixel_shift = h->sps.bit_depth_luma > 8;
+
+ ff_h264dsp_init(&h->h264dsp, h->sps.bit_depth_luma,
+ h->sps.chroma_format_idc);
+ ff_h264_pred_init(&h->hpc, s->codec_id, h->sps.bit_depth_luma,
+ h->sps.chroma_format_idc);
+ s->dsp.dct_bits = h->sps.bit_depth_luma > 8 ? 32 : 16;
+ ff_dsputil_init(&s->dsp, s->avctx);
+ ff_videodsp_init(&s->vdsp, h->sps.bit_depth_luma);
+ } else {
+ av_log(s->avctx, AV_LOG_ERROR, "Unsupported bit depth: %d\n",
+ h->sps.bit_depth_luma);
+ return AVERROR_INVALIDDATA;
+ }
+ }
+ return 0;
+}
+
+static enum PixelFormat get_pixel_format(H264Context *h)
+{
+ MpegEncContext *const s = &h->s;
+ switch (h->sps.bit_depth_luma) {
+ case 9:
+ if (CHROMA444) {
+ if (s->avctx->colorspace == AVCOL_SPC_RGB) {
+ return AV_PIX_FMT_GBRP9;
+ } else
+ return AV_PIX_FMT_YUV444P9;
+ } else if (CHROMA422)
+ return AV_PIX_FMT_YUV422P9;
+ else
+ return AV_PIX_FMT_YUV420P9;
+ break;
+ case 10:
+ if (CHROMA444) {
+ if (s->avctx->colorspace == AVCOL_SPC_RGB) {
+ return AV_PIX_FMT_GBRP10;
+ } else
+ return AV_PIX_FMT_YUV444P10;
+ } else if (CHROMA422)
+ return AV_PIX_FMT_YUV422P10;
+ else
+ return AV_PIX_FMT_YUV420P10;
+ break;
+ case 8:
+ if (CHROMA444) {
+ if (s->avctx->colorspace == AVCOL_SPC_RGB) {
+ return AV_PIX_FMT_GBRP;
+ } else
+ return s->avctx->color_range == AVCOL_RANGE_JPEG ? AV_PIX_FMT_YUVJ444P
+ : AV_PIX_FMT_YUV444P;
+ } else if (CHROMA422) {
+ return s->avctx->color_range == AVCOL_RANGE_JPEG ? AV_PIX_FMT_YUVJ422P
+ : AV_PIX_FMT_YUV422P;
+ } else {
+ return s->avctx->get_format(s->avctx, s->avctx->codec->pix_fmts ?
+ s->avctx->codec->pix_fmts :
+ s->avctx->color_range == AVCOL_RANGE_JPEG ?
+ hwaccel_pixfmt_list_h264_jpeg_420 :
+ ff_hwaccel_pixfmt_list_420);
+ }
+ break;
+ default:
+ av_log(s->avctx, AV_LOG_ERROR,
+ "Unsupported bit depth: %d\n", h->sps.bit_depth_luma);
+ return AVERROR_INVALIDDATA;
+ }
+}
+
+static int h264_slice_header_init(H264Context *h, int reinit)
+{
+ MpegEncContext *const s = &h->s;
+ int i, ret;
+
+ avcodec_set_dimensions(s->avctx, s->width, s->height);
+ s->avctx->sample_aspect_ratio = h->sps.sar;
+ av_assert0(s->avctx->sample_aspect_ratio.den);
+
+ if (h->sps.timing_info_present_flag) {
+ int64_t den = h->sps.time_scale;
+ if (h->x264_build < 44U)
+ den *= 2;
+ av_reduce(&s->avctx->time_base.num, &s->avctx->time_base.den,
+ h->sps.num_units_in_tick, den, 1 << 30);
+ }
+
+ s->avctx->hwaccel = ff_find_hwaccel(s->avctx->codec->id, s->avctx->pix_fmt);
+
+ if (reinit) {
+ free_tables(h, 0);
+ if ((ret = ff_MPV_common_frame_size_change(s)) < 0) {
+ av_log(h->s.avctx, AV_LOG_ERROR, "ff_MPV_common_frame_size_change() failed.\n");
+ return ret;
+ }
+ } else {
+ if ((ret = ff_MPV_common_init(s) < 0)) {
+ av_log(h->s.avctx, AV_LOG_ERROR, "ff_MPV_common_init() failed.\n");
+ return ret;
+ }
+ }
+ s->first_field = 0;
+ h->prev_interlaced_frame = 1;
+
+ init_scan_tables(h);
+ if (ff_h264_alloc_tables(h) < 0) {
+ av_log(h->s.avctx, AV_LOG_ERROR,
+ "Could not allocate memory for h264\n");
+ return AVERROR(ENOMEM);
+ }
+
+ if (!HAVE_THREADS || !(s->avctx->active_thread_type & FF_THREAD_SLICE)) {
+ if (context_init(h) < 0) {
+ av_log(h->s.avctx, AV_LOG_ERROR, "context_init() failed.\n");
+ return -1;
+ }
+ } else {
+ for (i = 1; i < s->slice_context_count; i++) {
+ H264Context *c;
+ c = h->thread_context[i] = av_malloc(sizeof(H264Context));
+ memcpy(c, h->s.thread_context[i], sizeof(MpegEncContext));
+ memset(&c->s + 1, 0, sizeof(H264Context) - sizeof(MpegEncContext));
+ c->h264dsp = h->h264dsp;
+ c->sps = h->sps;
+ c->pps = h->pps;
+ c->pixel_shift = h->pixel_shift;
+ init_scan_tables(c);
+ clone_tables(c, h, i);
+ }
+
+ for (i = 0; i < s->slice_context_count; i++)
+ if (context_init(h->thread_context[i]) < 0) {
+ av_log(h->s.avctx, AV_LOG_ERROR, "context_init() failed.\n");
+ return -1;
+ }
+ }
+
+ return 0;
+}
+
/**
* Decode a slice header.
- * This will also call MPV_common_init() and frame_start() as needed.
+ * This will also call ff_MPV_common_init() and frame_start() as needed.
*
* @param h h264context
- * @param h0 h264 master context (differs from 'h' when doing sliced based parallel decoding)
+ * @param h0 h264 master context (differs from 'h' when doing sliced based
+ * parallel decoding)
*
* @return 0 if okay, <0 if an error occurred, 1 if decoding must not be multithreaded
*/
-static int decode_slice_header(H264Context *h, H264Context *h0){
- MpegEncContext * const s = &h->s;
- MpegEncContext * const s0 = &h0->s;
+static int decode_slice_header(H264Context *h, H264Context *h0)
+{
+ MpegEncContext *const s = &h->s;
+ MpegEncContext *const s0 = &h0->s;
unsigned int first_mb_in_slice;
unsigned int pps_id;
- int num_ref_idx_active_override_flag;
+ int num_ref_idx_active_override_flag, max_refs, ret;
unsigned int slice_type, tmp, i, j;
int default_ref_list_done = 0;
- int last_pic_structure, last_pic_dropable;
+ int last_pic_structure, last_pic_droppable;
+ int needs_reinit = 0;
/* FIXME: 2tap qpel isn't implemented for high bit depth. */
- if((s->avctx->flags2 & CODEC_FLAG2_FAST) && !h->nal_ref_idc && !h->pixel_shift){
- s->me.qpel_put= s->dsp.put_2tap_qpel_pixels_tab;
- s->me.qpel_avg= s->dsp.avg_2tap_qpel_pixels_tab;
- }else{
- s->me.qpel_put= s->dsp.put_h264_qpel_pixels_tab;
- s->me.qpel_avg= s->dsp.avg_h264_qpel_pixels_tab;
+ if ((s->avctx->flags2 & CODEC_FLAG2_FAST) &&
+ !h->nal_ref_idc && !h->pixel_shift) {
+ s->me.qpel_put = s->dsp.put_2tap_qpel_pixels_tab;
+ s->me.qpel_avg = s->dsp.avg_2tap_qpel_pixels_tab;
+ } else {
+ s->me.qpel_put = s->dsp.put_h264_qpel_pixels_tab;
+ s->me.qpel_avg = s->dsp.avg_h264_qpel_pixels_tab;
}
- first_mb_in_slice= get_ue_golomb(&s->gb);
+ first_mb_in_slice = get_ue_golomb(&s->gb);
- if(first_mb_in_slice == 0){ //FIXME better field boundary detection
- if(h0->current_slice && FIELD_PICTURE){
+ if (first_mb_in_slice == 0) { // FIXME better field boundary detection
+ if (h0->current_slice && FIELD_PICTURE) {
field_end(h, 1);
}
h0->current_slice = 0;
if (!s0->first_field) {
- if (s->current_picture_ptr && !s->dropable &&
+ if (s->current_picture_ptr && !s->droppable &&
s->current_picture_ptr->owner2 == s) {
ff_thread_report_progress(&s->current_picture_ptr->f, INT_MAX,
s->picture_structure == PICT_BOTTOM_FIELD);
@@ -2669,60 +2628,88 @@ static int decode_slice_header(H264Context *h, H264Context *h0){
}
}
- slice_type= get_ue_golomb_31(&s->gb);
- if(slice_type > 9){
- av_log(h->s.avctx, AV_LOG_ERROR, "slice type too large (%d) at %d %d\n", h->slice_type, s->mb_x, s->mb_y);
+ slice_type = get_ue_golomb_31(&s->gb);
+ if (slice_type > 9) {
+ av_log(h->s.avctx, AV_LOG_ERROR,
+ "slice type too large (%d) at %d %d\n",
+ h->slice_type, s->mb_x, s->mb_y);
return -1;
}
- if(slice_type > 4){
+ if (slice_type > 4) {
slice_type -= 5;
- h->slice_type_fixed=1;
- }else
- h->slice_type_fixed=0;
+ h->slice_type_fixed = 1;
+ } else
+ h->slice_type_fixed = 0;
- slice_type= golomb_to_pict_type[ slice_type ];
- if (slice_type == AV_PICTURE_TYPE_I
- || (h0->current_slice != 0 && slice_type == h0->last_slice_type) ) {
+ slice_type = golomb_to_pict_type[slice_type];
+ if (slice_type == AV_PICTURE_TYPE_I ||
+ (h0->current_slice != 0 && slice_type == h0->last_slice_type)) {
default_ref_list_done = 1;
}
- h->slice_type= slice_type;
- h->slice_type_nos= slice_type & 3;
+ h->slice_type = slice_type;
+ h->slice_type_nos = slice_type & 3;
- s->pict_type= h->slice_type; // to make a few old functions happy, it's wrong though
+ // to make a few old functions happy, it's wrong though
+ s->pict_type = h->slice_type;
- pps_id= get_ue_golomb(&s->gb);
- if(pps_id>=MAX_PPS_COUNT){
+ pps_id = get_ue_golomb(&s->gb);
+ if (pps_id >= MAX_PPS_COUNT) {
av_log(h->s.avctx, AV_LOG_ERROR, "pps_id out of range\n");
return -1;
}
- if(!h0->pps_buffers[pps_id]) {
- av_log(h->s.avctx, AV_LOG_ERROR, "non-existing PPS %u referenced\n", pps_id);
+ if (!h0->pps_buffers[pps_id]) {
+ av_log(h->s.avctx, AV_LOG_ERROR,
+ "non-existing PPS %u referenced\n",
+ pps_id);
return -1;
}
- h->pps= *h0->pps_buffers[pps_id];
+ h->pps = *h0->pps_buffers[pps_id];
- if(!h0->sps_buffers[h->pps.sps_id]) {
- av_log(h->s.avctx, AV_LOG_ERROR, "non-existing SPS %u referenced\n", h->pps.sps_id);
+ if (!h0->sps_buffers[h->pps.sps_id]) {
+ av_log(h->s.avctx, AV_LOG_ERROR,
+ "non-existing SPS %u referenced\n",
+ h->pps.sps_id);
return -1;
}
- h->sps = *h0->sps_buffers[h->pps.sps_id];
+
+ if (h->pps.sps_id != h->current_sps_id ||
+ h->context_reinitialized ||
+ h0->sps_buffers[h->pps.sps_id]->new) {
+ SPS *new_sps = h0->sps_buffers[h->pps.sps_id];
+
+ h0->sps_buffers[h->pps.sps_id]->new = 0;
+
+ if (h->sps.chroma_format_idc != new_sps->chroma_format_idc ||
+ h->sps.bit_depth_luma != new_sps->bit_depth_luma)
+ needs_reinit = 1;
+
+ h->current_sps_id = h->pps.sps_id;
+ h->sps = *h0->sps_buffers[h->pps.sps_id];
+
+ if ((ret = h264_set_parameter_from_sps(h)) < 0)
+ return ret;
+ }
s->avctx->profile = ff_h264_get_profile(&h->sps);
s->avctx->level = h->sps.level_idc;
s->avctx->refs = h->sps.ref_frame_count;
- s->mb_width= h->sps.mb_width;
- s->mb_height= h->sps.mb_height * (2 - h->sps.frame_mbs_only_flag);
+ if (s->mb_width != h->sps.mb_width ||
+ s->mb_height != h->sps.mb_height * (2 - h->sps.frame_mbs_only_flag))
+ needs_reinit = 1;
- h->b_stride= s->mb_width*4;
+ s->mb_width = h->sps.mb_width;
+ s->mb_height = h->sps.mb_height * (2 - h->sps.frame_mbs_only_flag);
+
+ h->b_stride = s->mb_width * 4;
s->chroma_y_shift = h->sps.chroma_format_idc <= 1; // 400 uses yuv420p
- s->width = 16*s->mb_width - (2>>CHROMA444)*FFMIN(h->sps.crop_right, (8<<CHROMA444)-1);
- if(h->sps.frame_mbs_only_flag)
- s->height= 16*s->mb_height - (1<<s->chroma_y_shift)*FFMIN(h->sps.crop_bottom, (16>>s->chroma_y_shift)-1);
+ s->width = 16 * s->mb_width - (2 >> CHROMA444) * FFMIN(h->sps.crop_right, (8 << CHROMA444) - 1);
+ if (h->sps.frame_mbs_only_flag)
+ s->height = 16 * s->mb_height - (1 << s->chroma_y_shift) * FFMIN(h->sps.crop_bottom, (16 >> s->chroma_y_shift) - 1);
else
- s->height= 16*s->mb_height - (2<<s->chroma_y_shift)*FFMIN(h->sps.crop_bottom, (16>>s->chroma_y_shift)-1);
+ s->height = 16 * s->mb_height - (2 << s->chroma_y_shift) * FFMIN(h->sps.crop_bottom, (16 >> s->chroma_y_shift) - 1);
if (FFALIGN(s->avctx->width, 16) == s->width &&
FFALIGN(s->avctx->height, 16) == s->height) {
@@ -2730,166 +2717,98 @@ static int decode_slice_header(H264Context *h, H264Context *h0){
s->height = s->avctx->height;
}
- if (s->context_initialized
- && ( s->width != s->avctx->width || s->height != s->avctx->height
- || av_cmp_q(h->sps.sar, s->avctx->sample_aspect_ratio))) {
- if(h != h0 || (HAVE_THREADS && h->s.avctx->active_thread_type & FF_THREAD_FRAME)) {
- av_log_missing_feature(s->avctx, "Width/height changing with threads is", 0);
- return AVERROR_PATCHWELCOME; // width / height changed during parallelized decoding
+ if (h->sps.video_signal_type_present_flag) {
+ s->avctx->color_range = h->sps.full_range ? AVCOL_RANGE_JPEG
+ : AVCOL_RANGE_MPEG;
+ if (h->sps.colour_description_present_flag) {
+ if (s->avctx->colorspace != h->sps.colorspace)
+ needs_reinit = 1;
+ s->avctx->color_primaries = h->sps.color_primaries;
+ s->avctx->color_trc = h->sps.color_trc;
+ s->avctx->colorspace = h->sps.colorspace;
}
- free_tables(h, 0);
- flush_dpb(s->avctx);
- MPV_common_end(s);
}
- if (!s->context_initialized) {
- if (h != h0) {
- av_log(h->s.avctx, AV_LOG_ERROR, "Cannot (re-)initialize context during parallel decoding.\n");
- return -1;
- }
- avcodec_set_dimensions(s->avctx, s->width, s->height);
- s->avctx->sample_aspect_ratio= h->sps.sar;
- av_assert0(s->avctx->sample_aspect_ratio.den);
+ if (s->context_initialized &&
+ (s->width != s->avctx->width ||
+ s->height != s->avctx->height ||
+ needs_reinit ||
+ av_cmp_q(h->sps.sar, s->avctx->sample_aspect_ratio))) {
- if(h->sps.video_signal_type_present_flag){
- s->avctx->color_range = h->sps.full_range ? AVCOL_RANGE_JPEG : AVCOL_RANGE_MPEG;
- if(h->sps.colour_description_present_flag){
- s->avctx->color_primaries = h->sps.color_primaries;
- s->avctx->color_trc = h->sps.color_trc;
- s->avctx->colorspace = h->sps.colorspace;
- }
+ if (h != h0) {
+ av_log(s->avctx, AV_LOG_ERROR, "changing width/height on "
+ "slice %d\n", h0->current_slice + 1);
+ return AVERROR_INVALIDDATA;
}
- if(h->sps.timing_info_present_flag){
- int64_t den= h->sps.time_scale;
- if(h->x264_build < 44U)
- den *= 2;
- av_reduce(&s->avctx->time_base.num, &s->avctx->time_base.den,
- h->sps.num_units_in_tick, den, 1<<30);
- }
+ flush_change(h);
- switch (h->sps.bit_depth_luma) {
- case 9 :
- if (CHROMA444) {
- if (s->avctx->colorspace == AVCOL_SPC_RGB) {
- s->avctx->pix_fmt = PIX_FMT_GBRP9;
- } else
- s->avctx->pix_fmt = PIX_FMT_YUV444P9;
- } else if (CHROMA422)
- s->avctx->pix_fmt = PIX_FMT_YUV422P9;
- else
- s->avctx->pix_fmt = PIX_FMT_YUV420P9;
- break;
- case 10 :
- if (CHROMA444) {
- if (s->avctx->colorspace == AVCOL_SPC_RGB) {
- s->avctx->pix_fmt = PIX_FMT_GBRP10;
- } else
- s->avctx->pix_fmt = PIX_FMT_YUV444P10;
- } else if (CHROMA422)
- s->avctx->pix_fmt = PIX_FMT_YUV422P10;
- else
- s->avctx->pix_fmt = PIX_FMT_YUV420P10;
- break;
- case 8:
- if (CHROMA444){
- if (s->avctx->colorspace == AVCOL_SPC_RGB) {
- s->avctx->pix_fmt = PIX_FMT_GBRP;
- } else
- s->avctx->pix_fmt = s->avctx->color_range == AVCOL_RANGE_JPEG ? PIX_FMT_YUVJ444P : PIX_FMT_YUV444P;
- } else if (CHROMA422) {
- s->avctx->pix_fmt = s->avctx->color_range == AVCOL_RANGE_JPEG ? PIX_FMT_YUVJ422P : PIX_FMT_YUV422P;
- }else{
- s->avctx->pix_fmt = s->avctx->get_format(s->avctx,
- s->avctx->codec->pix_fmts ?
- s->avctx->codec->pix_fmts :
- s->avctx->color_range == AVCOL_RANGE_JPEG ?
- hwaccel_pixfmt_list_h264_jpeg_420 :
- ff_hwaccel_pixfmt_list_420);
- }
- break;
- default:
- av_log(s->avctx, AV_LOG_ERROR,
- "Unsupported bit depth: %d\n", h->sps.bit_depth_luma);
- return AVERROR_INVALIDDATA;
- }
+ if ((ret = get_pixel_format(h)) < 0)
+ return ret;
+ s->avctx->pix_fmt = ret;
- s->avctx->hwaccel = ff_find_hwaccel(s->avctx->codec->id, s->avctx->pix_fmt);
+ av_log(h->s.avctx, AV_LOG_INFO, "Reinit context to %dx%d, "
+ "pix_fmt: %d\n", s->width, s->height, s->avctx->pix_fmt);
- if (MPV_common_init(s) < 0) {
- av_log(h->s.avctx, AV_LOG_ERROR, "MPV_common_init() failed.\n");
- return -1;
+ if ((ret = h264_slice_header_init(h, 1)) < 0) {
+ av_log(h->s.avctx, AV_LOG_ERROR,
+ "h264_slice_header_init() failed\n");
+ return ret;
}
- s->first_field = 0;
- h->prev_interlaced_frame = 1;
-
- init_scan_tables(h);
- if (ff_h264_alloc_tables(h) < 0) {
- av_log(h->s.avctx, AV_LOG_ERROR, "Could not allocate memory for h264\n");
- return AVERROR(ENOMEM);
+ h->context_reinitialized = 1;
+ }
+ if (!s->context_initialized) {
+ if (h != h0) {
+ av_log(h->s.avctx, AV_LOG_ERROR,
+ "Cannot (re-)initialize context during parallel decoding.\n");
+ return -1;
}
- if (!HAVE_THREADS || !(s->avctx->active_thread_type&FF_THREAD_SLICE)) {
- if (context_init(h) < 0) {
- av_log(h->s.avctx, AV_LOG_ERROR, "context_init() failed.\n");
- return -1;
- }
- } else {
- for(i = 1; i < s->slice_context_count; i++) {
- H264Context *c;
- c = h->thread_context[i] = av_malloc(sizeof(H264Context));
- memcpy(c, h->s.thread_context[i], sizeof(MpegEncContext));
- memset(&c->s + 1, 0, sizeof(H264Context) - sizeof(MpegEncContext));
- c->h264dsp = h->h264dsp;
- c->sps = h->sps;
- c->pps = h->pps;
- c->pixel_shift = h->pixel_shift;
- init_scan_tables(c);
- clone_tables(c, h, i);
- }
+ if ((ret = get_pixel_format(h)) < 0)
+ return ret;
+ s->avctx->pix_fmt = ret;
- for(i = 0; i < s->slice_context_count; i++)
- if (context_init(h->thread_context[i]) < 0) {
- av_log(h->s.avctx, AV_LOG_ERROR, "context_init() failed.\n");
- return -1;
- }
+ if ((ret = h264_slice_header_init(h, 0)) < 0) {
+ av_log(h->s.avctx, AV_LOG_ERROR,
+ "h264_slice_header_init() failed\n");
+ return ret;
}
}
- if(h == h0 && h->dequant_coeff_pps != pps_id){
+ if (h == h0 && h->dequant_coeff_pps != pps_id) {
h->dequant_coeff_pps = pps_id;
init_dequant_tables(h);
}
- h->frame_num= get_bits(&s->gb, h->sps.log2_max_frame_num);
+ h->frame_num = get_bits(&s->gb, h->sps.log2_max_frame_num);
- h->mb_mbaff = 0;
- h->mb_aff_frame = 0;
+ h->mb_mbaff = 0;
+ h->mb_aff_frame = 0;
last_pic_structure = s0->picture_structure;
- last_pic_dropable = s0->dropable;
- s->dropable = h->nal_ref_idc == 0;
- if(h->sps.frame_mbs_only_flag){
- s->picture_structure= PICT_FRAME;
- }else{
- if(get_bits1(&s->gb)) { //field_pic_flag
- s->picture_structure= PICT_TOP_FIELD + get_bits1(&s->gb); //bottom_field_flag
+ last_pic_droppable = s0->droppable;
+ s->droppable = h->nal_ref_idc == 0;
+ if (h->sps.frame_mbs_only_flag) {
+ s->picture_structure = PICT_FRAME;
+ } else {
+ if (get_bits1(&s->gb)) { // field_pic_flag
+ s->picture_structure = PICT_TOP_FIELD + get_bits1(&s->gb); // bottom_field_flag
} else {
- s->picture_structure= PICT_FRAME;
- h->mb_aff_frame = h->sps.mb_aff;
+ s->picture_structure = PICT_FRAME;
+ h->mb_aff_frame = h->sps.mb_aff;
}
}
- h->mb_field_decoding_flag= s->picture_structure != PICT_FRAME;
+ h->mb_field_decoding_flag = s->picture_structure != PICT_FRAME;
if (h0->current_slice != 0) {
if (last_pic_structure != s->picture_structure ||
- last_pic_dropable != s->dropable) {
+ last_pic_droppable != s->droppable) {
av_log(h->s.avctx, AV_LOG_ERROR,
"Changing field mode (%d -> %d) between slices is not allowed\n",
last_pic_structure, s->picture_structure);
s->picture_structure = last_pic_structure;
- s->dropable = last_pic_dropable;
+ s->droppable = last_pic_droppable;
return AVERROR_INVALIDDATA;
- } else if (!s->current_picture_ptr) {
+ } else if (!s0->current_picture_ptr) {
av_log(s->avctx, AV_LOG_ERROR,
"unset current_picture_ptr on %d. slice\n",
h0->current_slice + 1);
@@ -2902,7 +2821,8 @@ static int decode_slice_header(H264Context *h, H264Context *h0){
int unwrap_prev_frame_num = h->prev_frame_num;
int max_frame_num = 1 << h->sps.log2_max_frame_num;
- if (unwrap_prev_frame_num > h->frame_num) unwrap_prev_frame_num -= max_frame_num;
+ if (unwrap_prev_frame_num > h->frame_num)
+ unwrap_prev_frame_num -= max_frame_num;
if ((h->frame_num - unwrap_prev_frame_num) > h->sps.ref_frame_count) {
unwrap_prev_frame_num = (h->frame_num - h->sps.ref_frame_count) - 1;
@@ -2924,7 +2844,7 @@ static int decode_slice_header(H264Context *h, H264Context *h0){
assert(s0->current_picture_ptr->f.reference != DELAYED_PIC_REF);
/* Mark old field/frame as completed */
- if (!last_pic_dropable && s0->current_picture_ptr->owner2 == s0) {
+ if (!last_pic_droppable && s0->current_picture_ptr->owner2 == s0) {
ff_thread_report_progress(&s0->current_picture_ptr->f, INT_MAX,
last_pic_structure == PICT_BOTTOM_FIELD);
}
@@ -2933,7 +2853,7 @@ static int decode_slice_header(H264Context *h, H264Context *h0){
if (!FIELD_PICTURE || s->picture_structure == last_pic_structure) {
/* Previous field is unmatched. Don't display it, but let it
* remain for reference if marked as such. */
- if (!last_pic_dropable && last_pic_structure != PICT_FRAME) {
+ if (!last_pic_droppable && last_pic_structure != PICT_FRAME) {
ff_thread_report_progress(&s0->current_picture_ptr->f, INT_MAX,
last_pic_structure == PICT_TOP_FIELD);
}
@@ -2943,7 +2863,7 @@ static int decode_slice_header(H264Context *h, H264Context *h0){
* different frame_nums. Consider this field first in
* pair. Throw away previous field except for reference
* purposes. */
- if (!last_pic_dropable && last_pic_structure != PICT_FRAME) {
+ if (!last_pic_droppable && last_pic_structure != PICT_FRAME) {
ff_thread_report_progress(&s0->current_picture_ptr->f, INT_MAX,
last_pic_structure == PICT_TOP_FIELD);
}
@@ -2957,15 +2877,15 @@ static int decode_slice_header(H264Context *h, H264Context *h0){
"Invalid field mode combination %d/%d\n",
last_pic_structure, s->picture_structure);
s->picture_structure = last_pic_structure;
- s->dropable = last_pic_dropable;
+ s->droppable = last_pic_droppable;
return AVERROR_INVALIDDATA;
- } else if (last_pic_dropable != s->dropable) {
+ } else if (last_pic_droppable != s->droppable) {
av_log(s->avctx, AV_LOG_ERROR,
"Cannot combine reference and non-reference fields in the same frame\n");
av_log_ask_for_sample(s->avctx, NULL);
s->picture_structure = last_pic_structure;
- s->dropable = last_pic_dropable;
- return AVERROR_INVALIDDATA;
+ s->droppable = last_pic_droppable;
+ return AVERROR_PATCHWELCOME;
}
/* Take ownership of this buffer. Note that if another thread owned
@@ -2982,15 +2902,18 @@ static int decode_slice_header(H264Context *h, H264Context *h0){
while (h->frame_num != h->prev_frame_num &&
h->frame_num != (h->prev_frame_num + 1) % (1 << h->sps.log2_max_frame_num)) {
Picture *prev = h->short_ref_count ? h->short_ref[0] : NULL;
- av_log(h->s.avctx, AV_LOG_DEBUG, "Frame num gap %d %d\n", h->frame_num, h->prev_frame_num);
+ av_log(h->s.avctx, AV_LOG_DEBUG, "Frame num gap %d %d\n",
+ h->frame_num, h->prev_frame_num);
if (ff_h264_frame_start(h) < 0)
return -1;
h->prev_frame_num++;
- h->prev_frame_num %= 1<<h->sps.log2_max_frame_num;
- s->current_picture_ptr->frame_num= h->prev_frame_num;
- ff_thread_report_progress((AVFrame*)s->current_picture_ptr, INT_MAX, 0);
- ff_thread_report_progress((AVFrame*)s->current_picture_ptr, INT_MAX, 1);
- ff_generate_sliding_window_mmcos(h);
+ h->prev_frame_num %= 1 << h->sps.log2_max_frame_num;
+ s->current_picture_ptr->frame_num = h->prev_frame_num;
+ ff_thread_report_progress(&s->current_picture_ptr->f, INT_MAX, 0);
+ ff_thread_report_progress(&s->current_picture_ptr->f, INT_MAX, 1);
+ if ((ret = ff_generate_sliding_window_mmcos(h, 1)) < 0 &&
+ s->avctx->err_recognition & AV_EF_EXPLODE)
+ return ret;
if (ff_h264_execute_ref_pic_marking(h, h->mmco, h->mmco_index) < 0 &&
(s->avctx->err_recognition & AV_EF_EXPLODE))
return AVERROR_INVALIDDATA;
@@ -3003,9 +2926,9 @@ static int decode_slice_header(H264Context *h, H264Context *h0){
if (h->short_ref_count) {
if (prev) {
av_image_copy(h->short_ref[0]->f.data, h->short_ref[0]->f.linesize,
- (const uint8_t**)prev->f.data, prev->f.linesize,
- s->avctx->pix_fmt, s->mb_width*16, s->mb_height*16);
- h->short_ref[0]->poc = prev->poc+2;
+ (const uint8_t **)prev->f.data, prev->f.linesize,
+ s->avctx->pix_fmt, s->mb_width * 16, s->mb_height * 16);
+ h->short_ref[0]->poc = prev->poc + 2;
}
h->short_ref[0]->frame_num = h->prev_frame_num;
}
@@ -3021,13 +2944,10 @@ static int decode_slice_header(H264Context *h, H264Context *h0){
/* figure out if we have a complementary field pair */
if (!FIELD_PICTURE || s->picture_structure == last_pic_structure) {
- /*
- * Previous field is unmatched. Don't display it, but let it
- * remain for reference if marked as such.
- */
+ /* Previous field is unmatched. Don't display it, but let it
+ * remain for reference if marked as such. */
s0->current_picture_ptr = NULL;
- s0->first_field = FIELD_PICTURE;
-
+ s0->first_field = FIELD_PICTURE;
} else {
if (s0->current_picture_ptr->frame_num != h->frame_num) {
/* This and the previous field had different frame_nums.
@@ -3035,20 +2955,17 @@ static int decode_slice_header(H264Context *h, H264Context *h0){
* one except for reference purposes. */
s0->first_field = 1;
s0->current_picture_ptr = NULL;
-
} else {
/* Second field in complementary pair */
s0->first_field = 0;
}
}
-
} else {
/* Frame or first field in a potentially complementary pair */
- assert(!s0->current_picture_ptr);
s0->first_field = FIELD_PICTURE;
}
- if(!FIELD_PICTURE || s0->first_field) {
+ if (!FIELD_PICTURE || s0->first_field) {
if (ff_h264_frame_start(h) < 0) {
s0->first_field = 0;
return -1;
@@ -3057,116 +2974,119 @@ static int decode_slice_header(H264Context *h, H264Context *h0){
ff_release_unused_pictures(s, 0);
}
}
- if(h != h0)
- clone_slice(h, h0);
+ if (h != h0 && (ret = clone_slice(h, h0)) < 0)
+ return ret;
- s->current_picture_ptr->frame_num= h->frame_num; //FIXME frame_num cleanup
+ s->current_picture_ptr->frame_num = h->frame_num; // FIXME frame_num cleanup
assert(s->mb_num == s->mb_width * s->mb_height);
- if(first_mb_in_slice << FIELD_OR_MBAFF_PICTURE >= s->mb_num ||
- first_mb_in_slice >= s->mb_num){
+ if (first_mb_in_slice << FIELD_OR_MBAFF_PICTURE >= s->mb_num ||
+ first_mb_in_slice >= s->mb_num) {
av_log(h->s.avctx, AV_LOG_ERROR, "first_mb_in_slice overflow\n");
return -1;
}
- s->resync_mb_x = s->mb_x = first_mb_in_slice % s->mb_width;
+ s->resync_mb_x = s->mb_x = first_mb_in_slice % s->mb_width;
s->resync_mb_y = s->mb_y = (first_mb_in_slice / s->mb_width) << FIELD_OR_MBAFF_PICTURE;
if (s->picture_structure == PICT_BOTTOM_FIELD)
s->resync_mb_y = s->mb_y = s->mb_y + 1;
assert(s->mb_y < s->mb_height);
- if(s->picture_structure==PICT_FRAME){
- h->curr_pic_num= h->frame_num;
- h->max_pic_num= 1<< h->sps.log2_max_frame_num;
- }else{
- h->curr_pic_num= 2*h->frame_num + 1;
- h->max_pic_num= 1<<(h->sps.log2_max_frame_num + 1);
+ if (s->picture_structure == PICT_FRAME) {
+ h->curr_pic_num = h->frame_num;
+ h->max_pic_num = 1 << h->sps.log2_max_frame_num;
+ } else {
+ h->curr_pic_num = 2 * h->frame_num + 1;
+ h->max_pic_num = 1 << (h->sps.log2_max_frame_num + 1);
}
- if(h->nal_unit_type == NAL_IDR_SLICE){
+ if (h->nal_unit_type == NAL_IDR_SLICE)
get_ue_golomb(&s->gb); /* idr_pic_id */
- }
- if(h->sps.poc_type==0){
- h->poc_lsb= get_bits(&s->gb, h->sps.log2_max_poc_lsb);
+ if (h->sps.poc_type == 0) {
+ h->poc_lsb = get_bits(&s->gb, h->sps.log2_max_poc_lsb);
- if(h->pps.pic_order_present==1 && s->picture_structure==PICT_FRAME){
- h->delta_poc_bottom= get_se_golomb(&s->gb);
- }
+ if (h->pps.pic_order_present == 1 && s->picture_structure == PICT_FRAME)
+ h->delta_poc_bottom = get_se_golomb(&s->gb);
}
- if(h->sps.poc_type==1 && !h->sps.delta_pic_order_always_zero_flag){
- h->delta_poc[0]= get_se_golomb(&s->gb);
+ if (h->sps.poc_type == 1 && !h->sps.delta_pic_order_always_zero_flag) {
+ h->delta_poc[0] = get_se_golomb(&s->gb);
- if(h->pps.pic_order_present==1 && s->picture_structure==PICT_FRAME)
- h->delta_poc[1]= get_se_golomb(&s->gb);
+ if (h->pps.pic_order_present == 1 && s->picture_structure == PICT_FRAME)
+ h->delta_poc[1] = get_se_golomb(&s->gb);
}
init_poc(h);
- if(h->pps.redundant_pic_cnt_present){
- h->redundant_pic_count= get_ue_golomb(&s->gb);
- }
-
- //set defaults, might be overridden a few lines later
- h->ref_count[0]= h->pps.ref_count[0];
- h->ref_count[1]= h->pps.ref_count[1];
+ if (h->pps.redundant_pic_cnt_present)
+ h->redundant_pic_count = get_ue_golomb(&s->gb);
- if(h->slice_type_nos != AV_PICTURE_TYPE_I){
- int max_refs = s->picture_structure == PICT_FRAME ? 16 : 32;
+ // set defaults, might be overridden a few lines later
+ h->ref_count[0] = h->pps.ref_count[0];
+ h->ref_count[1] = h->pps.ref_count[1];
- if(h->slice_type_nos == AV_PICTURE_TYPE_B){
- h->direct_spatial_mv_pred= get_bits1(&s->gb);
- }
- num_ref_idx_active_override_flag= get_bits1(&s->gb);
+ if (h->slice_type_nos != AV_PICTURE_TYPE_I) {
+ if (h->slice_type_nos == AV_PICTURE_TYPE_B)
+ h->direct_spatial_mv_pred = get_bits1(&s->gb);
+ num_ref_idx_active_override_flag = get_bits1(&s->gb);
- if(num_ref_idx_active_override_flag){
- h->ref_count[0]= get_ue_golomb(&s->gb) + 1;
+ if (num_ref_idx_active_override_flag) {
+ h->ref_count[0] = get_ue_golomb(&s->gb) + 1;
if (h->ref_count[0] < 1)
return AVERROR_INVALIDDATA;
if (h->slice_type_nos == AV_PICTURE_TYPE_B) {
- h->ref_count[1]= get_ue_golomb(&s->gb) + 1;
+ h->ref_count[1] = get_ue_golomb(&s->gb) + 1;
if (h->ref_count[1] < 1)
return AVERROR_INVALIDDATA;
}
}
- if (h->ref_count[0] > max_refs || h->ref_count[1] > max_refs) {
- av_log(h->s.avctx, AV_LOG_ERROR, "reference overflow\n");
- h->ref_count[0] = h->ref_count[1] = 1;
- return AVERROR_INVALIDDATA;
- }
-
- if(h->slice_type_nos == AV_PICTURE_TYPE_B)
- h->list_count= 2;
+ if (h->slice_type_nos == AV_PICTURE_TYPE_B)
+ h->list_count = 2;
else
- h->list_count= 1;
- }else
- h->list_count= 0;
+ h->list_count = 1;
+ } else {
+ h->list_count = 0;
+ h->ref_count[0] = h->ref_count[1] = 0;
+ }
- if(!default_ref_list_done){
- ff_h264_fill_default_ref_list(h);
+
+ max_refs = s->picture_structure == PICT_FRAME ? 16 : 32;
+
+ if (h->ref_count[0] > max_refs || h->ref_count[1] > max_refs) {
+ av_log(h->s.avctx, AV_LOG_ERROR, "reference overflow\n");
+ h->ref_count[0] = h->ref_count[1] = 0;
+ return AVERROR_INVALIDDATA;
}
- if(h->slice_type_nos!=AV_PICTURE_TYPE_I && ff_h264_decode_ref_pic_list_reordering(h) < 0) {
- h->ref_count[1]= h->ref_count[0]= 0;
+ if (!default_ref_list_done)
+ ff_h264_fill_default_ref_list(h);
+
+ if (h->slice_type_nos != AV_PICTURE_TYPE_I &&
+ ff_h264_decode_ref_pic_list_reordering(h) < 0) {
+ h->ref_count[1] = h->ref_count[0] = 0;
return -1;
}
- if(h->slice_type_nos!=AV_PICTURE_TYPE_I){
- s->last_picture_ptr= &h->ref_list[0][0];
+ if (h->slice_type_nos != AV_PICTURE_TYPE_I) {
+ s->last_picture_ptr = &h->ref_list[0][0];
+ s->last_picture_ptr->owner2 = s;
ff_copy_picture(&s->last_picture, s->last_picture_ptr);
}
- if(h->slice_type_nos==AV_PICTURE_TYPE_B){
- s->next_picture_ptr= &h->ref_list[1][0];
+ if (h->slice_type_nos == AV_PICTURE_TYPE_B) {
+ s->next_picture_ptr = &h->ref_list[1][0];
+ s->next_picture_ptr->owner2 = s;
ff_copy_picture(&s->next_picture, s->next_picture_ptr);
}
- if( (h->pps.weighted_pred && h->slice_type_nos == AV_PICTURE_TYPE_P )
- || (h->pps.weighted_bipred_idc==1 && h->slice_type_nos== AV_PICTURE_TYPE_B ) )
+ if ((h->pps.weighted_pred && h->slice_type_nos == AV_PICTURE_TYPE_P) ||
+ (h->pps.weighted_bipred_idc == 1 &&
+ h->slice_type_nos == AV_PICTURE_TYPE_B))
pred_weight_table(h);
- else if(h->pps.weighted_bipred_idc==2 && h->slice_type_nos== AV_PICTURE_TYPE_B){
+ else if (h->pps.weighted_bipred_idc == 2 &&
+ h->slice_type_nos == AV_PICTURE_TYPE_B) {
implicit_weight_table(h, -1);
- }else {
+ } else {
h->use_weight = 0;
for (i = 0; i < 2; i++) {
h->luma_weight_flag[i] = 0;
@@ -3174,163 +3094,184 @@ static int decode_slice_header(H264Context *h, H264Context *h0){
}
}
- if(h->nal_ref_idc && ff_h264_decode_ref_pic_marking(h0, &s->gb) < 0 &&
- (s->avctx->err_recognition & AV_EF_EXPLODE))
+ // If frame-mt is enabled, only update mmco tables for the first slice
+ // in a field. Subsequent slices can temporarily clobber h->mmco_index
+ // or h->mmco, which will cause ref list mix-ups and decoding errors
+ // further down the line. This may break decoding if the first slice is
+ // corrupt, thus we only do this if frame-mt is enabled.
+ if (h->nal_ref_idc &&
+ ff_h264_decode_ref_pic_marking(h0, &s->gb,
+ !(s->avctx->active_thread_type & FF_THREAD_FRAME) ||
+ h0->current_slice == 0) < 0 &&
+ (s->avctx->err_recognition & AV_EF_EXPLODE))
return AVERROR_INVALIDDATA;
- if(FRAME_MBAFF){
+ if (FRAME_MBAFF) {
ff_h264_fill_mbaff_ref_list(h);
- if(h->pps.weighted_bipred_idc==2 && h->slice_type_nos== AV_PICTURE_TYPE_B){
+ if (h->pps.weighted_bipred_idc == 2 && h->slice_type_nos == AV_PICTURE_TYPE_B) {
implicit_weight_table(h, 0);
implicit_weight_table(h, 1);
}
}
- if(h->slice_type_nos==AV_PICTURE_TYPE_B && !h->direct_spatial_mv_pred)
+ if (h->slice_type_nos == AV_PICTURE_TYPE_B && !h->direct_spatial_mv_pred)
ff_h264_direct_dist_scale_factor(h);
ff_h264_direct_ref_list_init(h);
- if( h->slice_type_nos != AV_PICTURE_TYPE_I && h->pps.cabac ){
+ if (h->slice_type_nos != AV_PICTURE_TYPE_I && h->pps.cabac) {
tmp = get_ue_golomb_31(&s->gb);
- if(tmp > 2){
+ if (tmp > 2) {
av_log(s->avctx, AV_LOG_ERROR, "cabac_init_idc overflow\n");
return -1;
}
- h->cabac_init_idc= tmp;
+ h->cabac_init_idc = tmp;
}
h->last_qscale_diff = 0;
tmp = h->pps.init_qp + get_se_golomb(&s->gb);
- if(tmp>51+6*(h->sps.bit_depth_luma-8)){
+ if (tmp > 51 + 6 * (h->sps.bit_depth_luma - 8)) {
av_log(s->avctx, AV_LOG_ERROR, "QP %u out of range\n", tmp);
return -1;
}
- s->qscale= tmp;
+ s->qscale = tmp;
h->chroma_qp[0] = get_chroma_qp(h, 0, s->qscale);
h->chroma_qp[1] = get_chroma_qp(h, 1, s->qscale);
- //FIXME qscale / qp ... stuff
- if(h->slice_type == AV_PICTURE_TYPE_SP){
+ // FIXME qscale / qp ... stuff
+ if (h->slice_type == AV_PICTURE_TYPE_SP)
get_bits1(&s->gb); /* sp_for_switch_flag */
- }
- if(h->slice_type==AV_PICTURE_TYPE_SP || h->slice_type == AV_PICTURE_TYPE_SI){
+ if (h->slice_type == AV_PICTURE_TYPE_SP ||
+ h->slice_type == AV_PICTURE_TYPE_SI)
get_se_golomb(&s->gb); /* slice_qs_delta */
- }
- h->deblocking_filter = 1;
+ h->deblocking_filter = 1;
h->slice_alpha_c0_offset = 52;
- h->slice_beta_offset = 52;
- if( h->pps.deblocking_filter_parameters_present ) {
- tmp= get_ue_golomb_31(&s->gb);
- if(tmp > 2){
- av_log(s->avctx, AV_LOG_ERROR, "deblocking_filter_idc %u out of range\n", tmp);
+ h->slice_beta_offset = 52;
+ if (h->pps.deblocking_filter_parameters_present) {
+ tmp = get_ue_golomb_31(&s->gb);
+ if (tmp > 2) {
+ av_log(s->avctx, AV_LOG_ERROR,
+ "deblocking_filter_idc %u out of range\n", tmp);
return -1;
}
- h->deblocking_filter= tmp;
- if(h->deblocking_filter < 2)
- h->deblocking_filter^= 1; // 1<->0
+ h->deblocking_filter = tmp;
+ if (h->deblocking_filter < 2)
+ h->deblocking_filter ^= 1; // 1<->0
- if( h->deblocking_filter ) {
+ if (h->deblocking_filter) {
h->slice_alpha_c0_offset += get_se_golomb(&s->gb) << 1;
h->slice_beta_offset += get_se_golomb(&s->gb) << 1;
- if( h->slice_alpha_c0_offset > 104U
- || h->slice_beta_offset > 104U){
- av_log(s->avctx, AV_LOG_ERROR, "deblocking filter parameters %d %d out of range\n", h->slice_alpha_c0_offset, h->slice_beta_offset);
+ if (h->slice_alpha_c0_offset > 104U ||
+ h->slice_beta_offset > 104U) {
+ av_log(s->avctx, AV_LOG_ERROR,
+ "deblocking filter parameters %d %d out of range\n",
+ h->slice_alpha_c0_offset, h->slice_beta_offset);
return -1;
}
}
}
- if( s->avctx->skip_loop_filter >= AVDISCARD_ALL
- ||(s->avctx->skip_loop_filter >= AVDISCARD_NONKEY && h->slice_type_nos != AV_PICTURE_TYPE_I)
- ||(s->avctx->skip_loop_filter >= AVDISCARD_BIDIR && h->slice_type_nos == AV_PICTURE_TYPE_B)
- ||(s->avctx->skip_loop_filter >= AVDISCARD_NONREF && h->nal_ref_idc == 0))
- h->deblocking_filter= 0;
+ if (s->avctx->skip_loop_filter >= AVDISCARD_ALL ||
+ (s->avctx->skip_loop_filter >= AVDISCARD_NONKEY &&
+ h->slice_type_nos != AV_PICTURE_TYPE_I) ||
+ (s->avctx->skip_loop_filter >= AVDISCARD_BIDIR &&
+ h->slice_type_nos == AV_PICTURE_TYPE_B) ||
+ (s->avctx->skip_loop_filter >= AVDISCARD_NONREF &&
+ h->nal_ref_idc == 0))
+ h->deblocking_filter = 0;
- if(h->deblocking_filter == 1 && h0->max_contexts > 1) {
- if(s->avctx->flags2 & CODEC_FLAG2_FAST) {
+ if (h->deblocking_filter == 1 && h0->max_contexts > 1) {
+ if (s->avctx->flags2 & CODEC_FLAG2_FAST) {
/* Cheat slightly for speed:
- Do not bother to deblock across slices. */
+ * Do not bother to deblock across slices. */
h->deblocking_filter = 2;
} else {
h0->max_contexts = 1;
- if(!h0->single_decode_warning) {
- av_log(s->avctx, AV_LOG_INFO, "Cannot parallelize deblocking type 1, decoding such frames in sequential order\n");
+ if (!h0->single_decode_warning) {
+ av_log(s->avctx, AV_LOG_INFO,
+ "Cannot parallelize deblocking type 1, decoding such frames in sequential order\n");
h0->single_decode_warning = 1;
}
if (h != h0) {
- av_log(h->s.avctx, AV_LOG_ERROR, "Deblocking switched inside frame.\n");
+ av_log(h->s.avctx, AV_LOG_ERROR,
+ "Deblocking switched inside frame.\n");
return 1;
}
}
}
- h->qp_thresh = 15 + 52 - FFMIN(h->slice_alpha_c0_offset, h->slice_beta_offset)
- - FFMAX3(0, h->pps.chroma_qp_index_offset[0], h->pps.chroma_qp_index_offset[1])
- + 6 * (h->sps.bit_depth_luma - 8);
-
-#if 0 //FMO
- if( h->pps.num_slice_groups > 1 && h->pps.mb_slice_group_map_type >= 3 && h->pps.mb_slice_group_map_type <= 5)
- slice_group_change_cycle= get_bits(&s->gb, ?);
-#endif
+ h->qp_thresh = 15 + 52 -
+ FFMIN(h->slice_alpha_c0_offset, h->slice_beta_offset) -
+ FFMAX3(0,
+ h->pps.chroma_qp_index_offset[0],
+ h->pps.chroma_qp_index_offset[1]) +
+ 6 * (h->sps.bit_depth_luma - 8);
h0->last_slice_type = slice_type;
h->slice_num = ++h0->current_slice;
- if(h->slice_num >= MAX_SLICES){
- av_log(s->avctx, AV_LOG_ERROR, "Too many slices, increase MAX_SLICES and recompile\n");
+ if (h->slice_num >= MAX_SLICES) {
+ av_log(s->avctx, AV_LOG_ERROR,
+ "Too many slices, increase MAX_SLICES and recompile\n");
}
- for(j=0; j<2; j++){
+ for (j = 0; j < 2; j++) {
int id_list[16];
- int *ref2frm= h->ref2frm[h->slice_num&(MAX_SLICES-1)][j];
- for(i=0; i<16; i++){
- id_list[i]= 60;
+ int *ref2frm = h->ref2frm[h->slice_num & (MAX_SLICES - 1)][j];
+ for (i = 0; i < 16; i++) {
+ id_list[i] = 60;
if (h->ref_list[j][i].f.data[0]) {
int k;
uint8_t *base = h->ref_list[j][i].f.base[0];
- for(k=0; k<h->short_ref_count; k++)
+ for (k = 0; k < h->short_ref_count; k++)
if (h->short_ref[k]->f.base[0] == base) {
- id_list[i]= k;
+ id_list[i] = k;
break;
}
- for(k=0; k<h->long_ref_count; k++)
+ for (k = 0; k < h->long_ref_count; k++)
if (h->long_ref[k] && h->long_ref[k]->f.base[0] == base) {
- id_list[i]= h->short_ref_count + k;
+ id_list[i] = h->short_ref_count + k;
break;
}
}
}
- ref2frm[0]=
- ref2frm[1]= -1;
- for(i=0; i<16; i++)
- ref2frm[i+2]= 4*id_list[i]
- + (h->ref_list[j][i].f.reference & 3);
- ref2frm[18+0]=
- ref2frm[18+1]= -1;
- for(i=16; i<48; i++)
- ref2frm[i+4]= 4*id_list[(i-16)>>1]
- + (h->ref_list[j][i].f.reference & 3);
- }
-
- //FIXME: fix draw_edges+PAFF+frame threads
- h->emu_edge_width= (s->flags&CODEC_FLAG_EMU_EDGE || (!h->sps.frame_mbs_only_flag && s->avctx->active_thread_type)) ? 0 : 16;
- h->emu_edge_height= (FRAME_MBAFF || FIELD_PICTURE) ? 0 : h->emu_edge_width;
-
- if(s->avctx->debug&FF_DEBUG_PICT_INFO){
- av_log(h->s.avctx, AV_LOG_DEBUG, "slice:%d %s mb:%d %c%s%s pps:%u frame:%d poc:%d/%d ref:%d/%d qp:%d loop:%d:%d:%d weight:%d%s %s\n",
+ ref2frm[0] =
+ ref2frm[1] = -1;
+ for (i = 0; i < 16; i++)
+ ref2frm[i + 2] = 4 * id_list[i] +
+ (h->ref_list[j][i].f.reference & 3);
+ ref2frm[18 + 0] =
+ ref2frm[18 + 1] = -1;
+ for (i = 16; i < 48; i++)
+ ref2frm[i + 4] = 4 * id_list[(i - 16) >> 1] +
+ (h->ref_list[j][i].f.reference & 3);
+ }
+
+ // FIXME: fix draw_edges + PAFF + frame threads
+ h->emu_edge_width = (s->flags & CODEC_FLAG_EMU_EDGE ||
+ (!h->sps.frame_mbs_only_flag &&
+ s->avctx->active_thread_type))
+ ? 0 : 16;
+ h->emu_edge_height = (FRAME_MBAFF || FIELD_PICTURE) ? 0 : h->emu_edge_width;
+
+ if (s->avctx->debug & FF_DEBUG_PICT_INFO) {
+ av_log(h->s.avctx, AV_LOG_DEBUG,
+ "slice:%d %s mb:%d %c%s%s pps:%u frame:%d poc:%d/%d ref:%d/%d qp:%d loop:%d:%d:%d weight:%d%s %s\n",
h->slice_num,
- (s->picture_structure==PICT_FRAME ? "F" : s->picture_structure==PICT_TOP_FIELD ? "T" : "B"),
+ (s->picture_structure == PICT_FRAME ? "F" : s->picture_structure == PICT_TOP_FIELD ? "T" : "B"),
first_mb_in_slice,
- av_get_picture_type_char(h->slice_type), h->slice_type_fixed ? " fix" : "", h->nal_unit_type == NAL_IDR_SLICE ? " IDR" : "",
+ av_get_picture_type_char(h->slice_type),
+ h->slice_type_fixed ? " fix" : "",
+ h->nal_unit_type == NAL_IDR_SLICE ? " IDR" : "",
pps_id, h->frame_num,
- s->current_picture_ptr->field_poc[0], s->current_picture_ptr->field_poc[1],
+ s->current_picture_ptr->field_poc[0],
+ s->current_picture_ptr->field_poc[1],
h->ref_count[0], h->ref_count[1],
s->qscale,
- h->deblocking_filter, h->slice_alpha_c0_offset/2-26, h->slice_beta_offset/2-26,
+ h->deblocking_filter,
+ h->slice_alpha_c0_offset / 2 - 26, h->slice_beta_offset / 2 - 26,
h->use_weight,
- h->use_weight==1 && h->use_weight_chroma ? "c" : "",
- h->slice_type == AV_PICTURE_TYPE_B ? (h->direct_spatial_mv_pred ? "SPAT" : "TEMP") : ""
- );
+ h->use_weight == 1 && h->use_weight_chroma ? "c" : "",
+ h->slice_type == AV_PICTURE_TYPE_B ? (h->direct_spatial_mv_pred ? "SPAT" : "TEMP") : "");
}
return 0;
@@ -3339,88 +3280,99 @@ static int decode_slice_header(H264Context *h, H264Context *h0){
int ff_h264_get_slice_type(const H264Context *h)
{
switch (h->slice_type) {
- case AV_PICTURE_TYPE_P: return 0;
- case AV_PICTURE_TYPE_B: return 1;
- case AV_PICTURE_TYPE_I: return 2;
- case AV_PICTURE_TYPE_SP: return 3;
- case AV_PICTURE_TYPE_SI: return 4;
- default: return -1;
+ case AV_PICTURE_TYPE_P:
+ return 0;
+ case AV_PICTURE_TYPE_B:
+ return 1;
+ case AV_PICTURE_TYPE_I:
+ return 2;
+ case AV_PICTURE_TYPE_SP:
+ return 3;
+ case AV_PICTURE_TYPE_SI:
+ return 4;
+ default:
+ return -1;
}
}
-static av_always_inline void fill_filter_caches_inter(H264Context *h, MpegEncContext * const s, int mb_type, int top_xy,
- int left_xy[LEFT_MBS], int top_type, int left_type[LEFT_MBS], int mb_xy, int list)
+static av_always_inline void fill_filter_caches_inter(H264Context *h,
+ MpegEncContext *const s,
+ int mb_type, int top_xy,
+ int left_xy[LEFT_MBS],
+ int top_type,
+ int left_type[LEFT_MBS],
+ int mb_xy, int list)
{
int b_stride = h->b_stride;
- int16_t (*mv_dst)[2] = &h->mv_cache[list][scan8[0]];
+ int16_t(*mv_dst)[2] = &h->mv_cache[list][scan8[0]];
int8_t *ref_cache = &h->ref_cache[list][scan8[0]];
- if(IS_INTER(mb_type) || IS_DIRECT(mb_type)){
- if(USES_LIST(top_type, list)){
- const int b_xy= h->mb2b_xy[top_xy] + 3*b_stride;
- const int b8_xy= 4*top_xy + 2;
- int (*ref2frm)[64] = h->ref2frm[ h->slice_table[top_xy]&(MAX_SLICES-1) ][0] + (MB_MBAFF ? 20 : 2);
- AV_COPY128(mv_dst - 1*8, s->current_picture.f.motion_val[list][b_xy + 0]);
- ref_cache[0 - 1*8]=
- ref_cache[1 - 1*8]= ref2frm[list][s->current_picture.f.ref_index[list][b8_xy + 0]];
- ref_cache[2 - 1*8]=
- ref_cache[3 - 1*8]= ref2frm[list][s->current_picture.f.ref_index[list][b8_xy + 1]];
- }else{
- AV_ZERO128(mv_dst - 1*8);
- AV_WN32A(&ref_cache[0 - 1*8], ((LIST_NOT_USED)&0xFF)*0x01010101u);
+ if (IS_INTER(mb_type) || IS_DIRECT(mb_type)) {
+ if (USES_LIST(top_type, list)) {
+ const int b_xy = h->mb2b_xy[top_xy] + 3 * b_stride;
+ const int b8_xy = 4 * top_xy + 2;
+ int (*ref2frm)[64] = h->ref2frm[h->slice_table[top_xy] & (MAX_SLICES - 1)][0] + (MB_MBAFF ? 20 : 2);
+ AV_COPY128(mv_dst - 1 * 8, s->current_picture.f.motion_val[list][b_xy + 0]);
+ ref_cache[0 - 1 * 8] =
+ ref_cache[1 - 1 * 8] = ref2frm[list][s->current_picture.f.ref_index[list][b8_xy + 0]];
+ ref_cache[2 - 1 * 8] =
+ ref_cache[3 - 1 * 8] = ref2frm[list][s->current_picture.f.ref_index[list][b8_xy + 1]];
+ } else {
+ AV_ZERO128(mv_dst - 1 * 8);
+ AV_WN32A(&ref_cache[0 - 1 * 8], ((LIST_NOT_USED) & 0xFF) * 0x01010101u);
}
- if(!IS_INTERLACED(mb_type^left_type[LTOP])){
- if(USES_LIST(left_type[LTOP], list)){
- const int b_xy= h->mb2b_xy[left_xy[LTOP]] + 3;
- const int b8_xy= 4*left_xy[LTOP] + 1;
- int (*ref2frm)[64] = h->ref2frm[ h->slice_table[left_xy[LTOP]]&(MAX_SLICES-1) ][0] + (MB_MBAFF ? 20 : 2);
- AV_COPY32(mv_dst - 1 + 0, s->current_picture.f.motion_val[list][b_xy + b_stride*0]);
- AV_COPY32(mv_dst - 1 + 8, s->current_picture.f.motion_val[list][b_xy + b_stride*1]);
- AV_COPY32(mv_dst - 1 + 16, s->current_picture.f.motion_val[list][b_xy + b_stride*2]);
- AV_COPY32(mv_dst - 1 + 24, s->current_picture.f.motion_val[list][b_xy + b_stride*3]);
- ref_cache[-1 + 0]=
- ref_cache[-1 + 8]= ref2frm[list][s->current_picture.f.ref_index[list][b8_xy + 2*0]];
- ref_cache[-1 + 16]=
- ref_cache[-1 + 24]= ref2frm[list][s->current_picture.f.ref_index[list][b8_xy + 2*1]];
- }else{
- AV_ZERO32(mv_dst - 1 + 0);
- AV_ZERO32(mv_dst - 1 + 8);
- AV_ZERO32(mv_dst - 1 +16);
- AV_ZERO32(mv_dst - 1 +24);
- ref_cache[-1 + 0]=
- ref_cache[-1 + 8]=
- ref_cache[-1 + 16]=
- ref_cache[-1 + 24]= LIST_NOT_USED;
+ if (!IS_INTERLACED(mb_type ^ left_type[LTOP])) {
+ if (USES_LIST(left_type[LTOP], list)) {
+ const int b_xy = h->mb2b_xy[left_xy[LTOP]] + 3;
+ const int b8_xy = 4 * left_xy[LTOP] + 1;
+ int (*ref2frm)[64] = h->ref2frm[h->slice_table[left_xy[LTOP]] & (MAX_SLICES - 1)][0] + (MB_MBAFF ? 20 : 2);
+ AV_COPY32(mv_dst - 1 + 0, s->current_picture.f.motion_val[list][b_xy + b_stride * 0]);
+ AV_COPY32(mv_dst - 1 + 8, s->current_picture.f.motion_val[list][b_xy + b_stride * 1]);
+ AV_COPY32(mv_dst - 1 + 16, s->current_picture.f.motion_val[list][b_xy + b_stride * 2]);
+ AV_COPY32(mv_dst - 1 + 24, s->current_picture.f.motion_val[list][b_xy + b_stride * 3]);
+ ref_cache[-1 + 0] =
+ ref_cache[-1 + 8] = ref2frm[list][s->current_picture.f.ref_index[list][b8_xy + 2 * 0]];
+ ref_cache[-1 + 16] =
+ ref_cache[-1 + 24] = ref2frm[list][s->current_picture.f.ref_index[list][b8_xy + 2 * 1]];
+ } else {
+ AV_ZERO32(mv_dst - 1 + 0);
+ AV_ZERO32(mv_dst - 1 + 8);
+ AV_ZERO32(mv_dst - 1 + 16);
+ AV_ZERO32(mv_dst - 1 + 24);
+ ref_cache[-1 + 0] =
+ ref_cache[-1 + 8] =
+ ref_cache[-1 + 16] =
+ ref_cache[-1 + 24] = LIST_NOT_USED;
}
}
}
- if(!USES_LIST(mb_type, list)){
- fill_rectangle(mv_dst, 4, 4, 8, pack16to32(0,0), 4);
- AV_WN32A(&ref_cache[0*8], ((LIST_NOT_USED)&0xFF)*0x01010101u);
- AV_WN32A(&ref_cache[1*8], ((LIST_NOT_USED)&0xFF)*0x01010101u);
- AV_WN32A(&ref_cache[2*8], ((LIST_NOT_USED)&0xFF)*0x01010101u);
- AV_WN32A(&ref_cache[3*8], ((LIST_NOT_USED)&0xFF)*0x01010101u);
+ if (!USES_LIST(mb_type, list)) {
+ fill_rectangle(mv_dst, 4, 4, 8, pack16to32(0, 0), 4);
+ AV_WN32A(&ref_cache[0 * 8], ((LIST_NOT_USED) & 0xFF) * 0x01010101u);
+ AV_WN32A(&ref_cache[1 * 8], ((LIST_NOT_USED) & 0xFF) * 0x01010101u);
+ AV_WN32A(&ref_cache[2 * 8], ((LIST_NOT_USED) & 0xFF) * 0x01010101u);
+ AV_WN32A(&ref_cache[3 * 8], ((LIST_NOT_USED) & 0xFF) * 0x01010101u);
return;
}
{
- int8_t *ref = &s->current_picture.f.ref_index[list][4*mb_xy];
- int (*ref2frm)[64] = h->ref2frm[ h->slice_num&(MAX_SLICES-1) ][0] + (MB_MBAFF ? 20 : 2);
- uint32_t ref01 = (pack16to32(ref2frm[list][ref[0]],ref2frm[list][ref[1]])&0x00FF00FF)*0x0101;
- uint32_t ref23 = (pack16to32(ref2frm[list][ref[2]],ref2frm[list][ref[3]])&0x00FF00FF)*0x0101;
- AV_WN32A(&ref_cache[0*8], ref01);
- AV_WN32A(&ref_cache[1*8], ref01);
- AV_WN32A(&ref_cache[2*8], ref23);
- AV_WN32A(&ref_cache[3*8], ref23);
+ int8_t *ref = &s->current_picture.f.ref_index[list][4 * mb_xy];
+ int (*ref2frm)[64] = h->ref2frm[h->slice_num & (MAX_SLICES - 1)][0] + (MB_MBAFF ? 20 : 2);
+ uint32_t ref01 = (pack16to32(ref2frm[list][ref[0]], ref2frm[list][ref[1]]) & 0x00FF00FF) * 0x0101;
+ uint32_t ref23 = (pack16to32(ref2frm[list][ref[2]], ref2frm[list][ref[3]]) & 0x00FF00FF) * 0x0101;
+ AV_WN32A(&ref_cache[0 * 8], ref01);
+ AV_WN32A(&ref_cache[1 * 8], ref01);
+ AV_WN32A(&ref_cache[2 * 8], ref23);
+ AV_WN32A(&ref_cache[3 * 8], ref23);
}
{
- int16_t (*mv_src)[2] = &s->current_picture.f.motion_val[list][4*s->mb_x + 4*s->mb_y*b_stride];
- AV_COPY128(mv_dst + 8*0, mv_src + 0*b_stride);
- AV_COPY128(mv_dst + 8*1, mv_src + 1*b_stride);
- AV_COPY128(mv_dst + 8*2, mv_src + 2*b_stride);
- AV_COPY128(mv_dst + 8*3, mv_src + 3*b_stride);
+ int16_t(*mv_src)[2] = &s->current_picture.f.motion_val[list][4 * s->mb_x + 4 * s->mb_y * b_stride];
+ AV_COPY128(mv_dst + 8 * 0, mv_src + 0 * b_stride);
+ AV_COPY128(mv_dst + 8 * 1, mv_src + 1 * b_stride);
+ AV_COPY128(mv_dst + 8 * 2, mv_src + 2 * b_stride);
+ AV_COPY128(mv_dst + 8 * 3, mv_src + 3 * b_stride);
}
}
@@ -3428,52 +3380,56 @@ static av_always_inline void fill_filter_caches_inter(H264Context *h, MpegEncCon
*
* @return non zero if the loop filter can be skipped
*/
-static int fill_filter_caches(H264Context *h, int mb_type){
- MpegEncContext * const s = &h->s;
- const int mb_xy= h->mb_xy;
+static int fill_filter_caches(H264Context *h, int mb_type)
+{
+ MpegEncContext *const s = &h->s;
+ const int mb_xy = h->mb_xy;
int top_xy, left_xy[LEFT_MBS];
int top_type, left_type[LEFT_MBS];
uint8_t *nnz;
uint8_t *nnz_cache;
- top_xy = mb_xy - (s->mb_stride << MB_FIELD);
+ top_xy = mb_xy - (s->mb_stride << MB_FIELD);
/* Wow, what a mess, why didn't they simplify the interlacing & intra
* stuff, I can't imagine that these complex rules are worth it. */
- left_xy[LBOT] = left_xy[LTOP] = mb_xy-1;
- if(FRAME_MBAFF){
- const int left_mb_field_flag = IS_INTERLACED(s->current_picture.f.mb_type[mb_xy - 1]);
- const int curr_mb_field_flag = IS_INTERLACED(mb_type);
- if(s->mb_y&1){
- if (left_mb_field_flag != curr_mb_field_flag) {
+ left_xy[LBOT] = left_xy[LTOP] = mb_xy - 1;
+ if (FRAME_MBAFF) {
+ const int left_mb_field_flag = IS_INTERLACED(s->current_picture.f.mb_type[mb_xy - 1]);
+ const int curr_mb_field_flag = IS_INTERLACED(mb_type);
+ if (s->mb_y & 1) {
+ if (left_mb_field_flag != curr_mb_field_flag)
left_xy[LTOP] -= s->mb_stride;
- }
- }else{
- if(curr_mb_field_flag){
- top_xy += s->mb_stride & (((s->current_picture.f.mb_type[top_xy] >> 7) & 1) - 1);
- }
- if (left_mb_field_flag != curr_mb_field_flag) {
+ } else {
+ if (curr_mb_field_flag)
+ top_xy += s->mb_stride &
+ (((s->current_picture.f.mb_type[top_xy] >> 7) & 1) - 1);
+ if (left_mb_field_flag != curr_mb_field_flag)
left_xy[LBOT] += s->mb_stride;
- }
}
}
- h->top_mb_xy = top_xy;
+ h->top_mb_xy = top_xy;
h->left_mb_xy[LTOP] = left_xy[LTOP];
h->left_mb_xy[LBOT] = left_xy[LBOT];
{
- //for sufficiently low qp, filtering wouldn't do anything
- //this is a conservative estimate: could also check beta_offset and more accurate chroma_qp
- int qp_thresh = h->qp_thresh; //FIXME strictly we should store qp_thresh for each mb of a slice
- int qp = s->current_picture.f.qscale_table[mb_xy];
- if(qp <= qp_thresh
- && (left_xy[LTOP] < 0 || ((qp + s->current_picture.f.qscale_table[left_xy[LTOP]] + 1) >> 1) <= qp_thresh)
- && (top_xy < 0 || ((qp + s->current_picture.f.qscale_table[top_xy ] + 1) >> 1) <= qp_thresh)) {
- if(!FRAME_MBAFF)
+ /* For sufficiently low qp, filtering wouldn't do anything.
+ * This is a conservative estimate: could also check beta_offset
+ * and more accurate chroma_qp. */
+ int qp_thresh = h->qp_thresh; // FIXME strictly we should store qp_thresh for each mb of a slice
+ int qp = s->current_picture.f.qscale_table[mb_xy];
+ if (qp <= qp_thresh &&
+ (left_xy[LTOP] < 0 ||
+ ((qp + s->current_picture.f.qscale_table[left_xy[LTOP]] + 1) >> 1) <= qp_thresh) &&
+ (top_xy < 0 ||
+ ((qp + s->current_picture.f.qscale_table[top_xy] + 1) >> 1) <= qp_thresh)) {
+ if (!FRAME_MBAFF)
return 1;
- if ((left_xy[LTOP] < 0 || ((qp + s->current_picture.f.qscale_table[left_xy[LBOT] ] + 1) >> 1) <= qp_thresh) &&
- (top_xy < s->mb_stride || ((qp + s->current_picture.f.qscale_table[top_xy - s->mb_stride] + 1) >> 1) <= qp_thresh))
+ if ((left_xy[LTOP] < 0 ||
+ ((qp + s->current_picture.f.qscale_table[left_xy[LBOT]] + 1) >> 1) <= qp_thresh) &&
+ (top_xy < s->mb_stride ||
+ ((qp + s->current_picture.f.qscale_table[top_xy - s->mb_stride] + 1) >> 1) <= qp_thresh))
return 1;
}
}
@@ -3481,166 +3437,190 @@ static int fill_filter_caches(H264Context *h, int mb_type){
top_type = s->current_picture.f.mb_type[top_xy];
left_type[LTOP] = s->current_picture.f.mb_type[left_xy[LTOP]];
left_type[LBOT] = s->current_picture.f.mb_type[left_xy[LBOT]];
- if(h->deblocking_filter == 2){
- if(h->slice_table[top_xy ] != h->slice_num) top_type= 0;
- if(h->slice_table[left_xy[LBOT]] != h->slice_num) left_type[LTOP]= left_type[LBOT]= 0;
- }else{
- if(h->slice_table[top_xy ] == 0xFFFF) top_type= 0;
- if(h->slice_table[left_xy[LBOT]] == 0xFFFF) left_type[LTOP]= left_type[LBOT] =0;
- }
- h->top_type = top_type;
- h->left_type[LTOP]= left_type[LTOP];
- h->left_type[LBOT]= left_type[LBOT];
-
- if(IS_INTRA(mb_type))
+ if (h->deblocking_filter == 2) {
+ if (h->slice_table[top_xy] != h->slice_num)
+ top_type = 0;
+ if (h->slice_table[left_xy[LBOT]] != h->slice_num)
+ left_type[LTOP] = left_type[LBOT] = 0;
+ } else {
+ if (h->slice_table[top_xy] == 0xFFFF)
+ top_type = 0;
+ if (h->slice_table[left_xy[LBOT]] == 0xFFFF)
+ left_type[LTOP] = left_type[LBOT] = 0;
+ }
+ h->top_type = top_type;
+ h->left_type[LTOP] = left_type[LTOP];
+ h->left_type[LBOT] = left_type[LBOT];
+
+ if (IS_INTRA(mb_type))
return 0;
- fill_filter_caches_inter(h, s, mb_type, top_xy, left_xy, top_type, left_type, mb_xy, 0);
- if(h->list_count == 2)
- fill_filter_caches_inter(h, s, mb_type, top_xy, left_xy, top_type, left_type, mb_xy, 1);
+ fill_filter_caches_inter(h, s, mb_type, top_xy, left_xy,
+ top_type, left_type, mb_xy, 0);
+ if (h->list_count == 2)
+ fill_filter_caches_inter(h, s, mb_type, top_xy, left_xy,
+ top_type, left_type, mb_xy, 1);
- nnz = h->non_zero_count[mb_xy];
+ nnz = h->non_zero_count[mb_xy];
nnz_cache = h->non_zero_count_cache;
- AV_COPY32(&nnz_cache[4+8*1], &nnz[ 0]);
- AV_COPY32(&nnz_cache[4+8*2], &nnz[ 4]);
- AV_COPY32(&nnz_cache[4+8*3], &nnz[ 8]);
- AV_COPY32(&nnz_cache[4+8*4], &nnz[12]);
- h->cbp= h->cbp_table[mb_xy];
+ AV_COPY32(&nnz_cache[4 + 8 * 1], &nnz[0]);
+ AV_COPY32(&nnz_cache[4 + 8 * 2], &nnz[4]);
+ AV_COPY32(&nnz_cache[4 + 8 * 3], &nnz[8]);
+ AV_COPY32(&nnz_cache[4 + 8 * 4], &nnz[12]);
+ h->cbp = h->cbp_table[mb_xy];
- if(top_type){
+ if (top_type) {
nnz = h->non_zero_count[top_xy];
- AV_COPY32(&nnz_cache[4+8*0], &nnz[3*4]);
+ AV_COPY32(&nnz_cache[4 + 8 * 0], &nnz[3 * 4]);
}
- if(left_type[LTOP]){
+ if (left_type[LTOP]) {
nnz = h->non_zero_count[left_xy[LTOP]];
- nnz_cache[3+8*1]= nnz[3+0*4];
- nnz_cache[3+8*2]= nnz[3+1*4];
- nnz_cache[3+8*3]= nnz[3+2*4];
- nnz_cache[3+8*4]= nnz[3+3*4];
- }
-
- // CAVLC 8x8dct requires NNZ values for residual decoding that differ from what the loop filter needs
- if(!CABAC && h->pps.transform_8x8_mode){
- if(IS_8x8DCT(top_type)){
- nnz_cache[4+8*0]=
- nnz_cache[5+8*0]= (h->cbp_table[top_xy] & 0x4000) >> 12;
- nnz_cache[6+8*0]=
- nnz_cache[7+8*0]= (h->cbp_table[top_xy] & 0x8000) >> 12;
+ nnz_cache[3 + 8 * 1] = nnz[3 + 0 * 4];
+ nnz_cache[3 + 8 * 2] = nnz[3 + 1 * 4];
+ nnz_cache[3 + 8 * 3] = nnz[3 + 2 * 4];
+ nnz_cache[3 + 8 * 4] = nnz[3 + 3 * 4];
+ }
+
+ /* CAVLC 8x8dct requires NNZ values for residual decoding that differ
+ * from what the loop filter needs */
+ if (!CABAC && h->pps.transform_8x8_mode) {
+ if (IS_8x8DCT(top_type)) {
+ nnz_cache[4 + 8 * 0] =
+ nnz_cache[5 + 8 * 0] = (h->cbp_table[top_xy] & 0x4000) >> 12;
+ nnz_cache[6 + 8 * 0] =
+ nnz_cache[7 + 8 * 0] = (h->cbp_table[top_xy] & 0x8000) >> 12;
}
- if(IS_8x8DCT(left_type[LTOP])){
- nnz_cache[3+8*1]=
- nnz_cache[3+8*2]= (h->cbp_table[left_xy[LTOP]]&0x2000) >> 12; //FIXME check MBAFF
+ if (IS_8x8DCT(left_type[LTOP])) {
+ nnz_cache[3 + 8 * 1] =
+ nnz_cache[3 + 8 * 2] = (h->cbp_table[left_xy[LTOP]] & 0x2000) >> 12; // FIXME check MBAFF
}
- if(IS_8x8DCT(left_type[LBOT])){
- nnz_cache[3+8*3]=
- nnz_cache[3+8*4]= (h->cbp_table[left_xy[LBOT]]&0x8000) >> 12; //FIXME check MBAFF
+ if (IS_8x8DCT(left_type[LBOT])) {
+ nnz_cache[3 + 8 * 3] =
+ nnz_cache[3 + 8 * 4] = (h->cbp_table[left_xy[LBOT]] & 0x8000) >> 12; // FIXME check MBAFF
}
- if(IS_8x8DCT(mb_type)){
- nnz_cache[scan8[0 ]]= nnz_cache[scan8[1 ]]=
- nnz_cache[scan8[2 ]]= nnz_cache[scan8[3 ]]= (h->cbp & 0x1000) >> 12;
-
- nnz_cache[scan8[0+ 4]]= nnz_cache[scan8[1+ 4]]=
- nnz_cache[scan8[2+ 4]]= nnz_cache[scan8[3+ 4]]= (h->cbp & 0x2000) >> 12;
-
- nnz_cache[scan8[0+ 8]]= nnz_cache[scan8[1+ 8]]=
- nnz_cache[scan8[2+ 8]]= nnz_cache[scan8[3+ 8]]= (h->cbp & 0x4000) >> 12;
-
- nnz_cache[scan8[0+12]]= nnz_cache[scan8[1+12]]=
- nnz_cache[scan8[2+12]]= nnz_cache[scan8[3+12]]= (h->cbp & 0x8000) >> 12;
+ if (IS_8x8DCT(mb_type)) {
+ nnz_cache[scan8[0]] =
+ nnz_cache[scan8[1]] =
+ nnz_cache[scan8[2]] =
+ nnz_cache[scan8[3]] = (h->cbp & 0x1000) >> 12;
+
+ nnz_cache[scan8[0 + 4]] =
+ nnz_cache[scan8[1 + 4]] =
+ nnz_cache[scan8[2 + 4]] =
+ nnz_cache[scan8[3 + 4]] = (h->cbp & 0x2000) >> 12;
+
+ nnz_cache[scan8[0 + 8]] =
+ nnz_cache[scan8[1 + 8]] =
+ nnz_cache[scan8[2 + 8]] =
+ nnz_cache[scan8[3 + 8]] = (h->cbp & 0x4000) >> 12;
+
+ nnz_cache[scan8[0 + 12]] =
+ nnz_cache[scan8[1 + 12]] =
+ nnz_cache[scan8[2 + 12]] =
+ nnz_cache[scan8[3 + 12]] = (h->cbp & 0x8000) >> 12;
}
}
return 0;
}
-static void loop_filter(H264Context *h, int start_x, int end_x){
- MpegEncContext * const s = &h->s;
- uint8_t *dest_y, *dest_cb, *dest_cr;
+static void loop_filter(H264Context *h, int start_x, int end_x)
+{
+ MpegEncContext *const s = &h->s;
+ uint8_t *dest_y, *dest_cb, *dest_cr;
int linesize, uvlinesize, mb_x, mb_y;
- const int end_mb_y= s->mb_y + FRAME_MBAFF;
- const int old_slice_type= h->slice_type;
- const int pixel_shift = h->pixel_shift;
- const int block_h = 16 >> s->chroma_y_shift;
+ const int end_mb_y = s->mb_y + FRAME_MBAFF;
+ const int old_slice_type = h->slice_type;
+ const int pixel_shift = h->pixel_shift;
+ const int block_h = 16 >> s->chroma_y_shift;
- if(h->deblocking_filter) {
- for(mb_x= start_x; mb_x<end_x; mb_x++){
- for(mb_y=end_mb_y - FRAME_MBAFF; mb_y<= end_mb_y; mb_y++){
+ if (h->deblocking_filter) {
+ for (mb_x = start_x; mb_x < end_x; mb_x++)
+ for (mb_y = end_mb_y - FRAME_MBAFF; mb_y <= end_mb_y; mb_y++) {
int mb_xy, mb_type;
- mb_xy = h->mb_xy = mb_x + mb_y*s->mb_stride;
- h->slice_num= h->slice_table[mb_xy];
- mb_type = s->current_picture.f.mb_type[mb_xy];
- h->list_count= h->list_counts[mb_xy];
-
- if(FRAME_MBAFF)
- h->mb_mbaff = h->mb_field_decoding_flag = !!IS_INTERLACED(mb_type);
-
- s->mb_x= mb_x;
- s->mb_y= mb_y;
- dest_y = s->current_picture.f.data[0] + ((mb_x << pixel_shift) + mb_y * s->linesize ) * 16;
- dest_cb = s->current_picture.f.data[1] + (mb_x << pixel_shift) * (8 << CHROMA444) + mb_y * s->uvlinesize * block_h;
- dest_cr = s->current_picture.f.data[2] + (mb_x << pixel_shift) * (8 << CHROMA444) + mb_y * s->uvlinesize * block_h;
- //FIXME simplify above
+ mb_xy = h->mb_xy = mb_x + mb_y * s->mb_stride;
+ h->slice_num = h->slice_table[mb_xy];
+ mb_type = s->current_picture.f.mb_type[mb_xy];
+ h->list_count = h->list_counts[mb_xy];
+
+ if (FRAME_MBAFF)
+ h->mb_mbaff =
+ h->mb_field_decoding_flag = !!IS_INTERLACED(mb_type);
+
+ s->mb_x = mb_x;
+ s->mb_y = mb_y;
+ dest_y = s->current_picture.f.data[0] +
+ ((mb_x << pixel_shift) + mb_y * s->linesize) * 16;
+ dest_cb = s->current_picture.f.data[1] +
+ (mb_x << pixel_shift) * (8 << CHROMA444) +
+ mb_y * s->uvlinesize * block_h;
+ dest_cr = s->current_picture.f.data[2] +
+ (mb_x << pixel_shift) * (8 << CHROMA444) +
+ mb_y * s->uvlinesize * block_h;
+ // FIXME simplify above
if (MB_FIELD) {
- linesize = h->mb_linesize = s->linesize * 2;
+ linesize = h->mb_linesize = s->linesize * 2;
uvlinesize = h->mb_uvlinesize = s->uvlinesize * 2;
- if(mb_y&1){ //FIXME move out of this function?
- dest_y -= s->linesize*15;
- dest_cb-= s->uvlinesize * (block_h - 1);
- dest_cr-= s->uvlinesize * (block_h - 1);
+ if (mb_y & 1) { // FIXME move out of this function?
+ dest_y -= s->linesize * 15;
+ dest_cb -= s->uvlinesize * (block_h - 1);
+ dest_cr -= s->uvlinesize * (block_h - 1);
}
} else {
linesize = h->mb_linesize = s->linesize;
uvlinesize = h->mb_uvlinesize = s->uvlinesize;
}
- backup_mb_border(h, dest_y, dest_cb, dest_cr, linesize, uvlinesize, 0);
- if(fill_filter_caches(h, mb_type))
+ backup_mb_border(h, dest_y, dest_cb, dest_cr, linesize,
+ uvlinesize, 0);
+ if (fill_filter_caches(h, mb_type))
continue;
h->chroma_qp[0] = get_chroma_qp(h, 0, s->current_picture.f.qscale_table[mb_xy]);
h->chroma_qp[1] = get_chroma_qp(h, 1, s->current_picture.f.qscale_table[mb_xy]);
if (FRAME_MBAFF) {
- ff_h264_filter_mb (h, mb_x, mb_y, dest_y, dest_cb, dest_cr, linesize, uvlinesize);
+ ff_h264_filter_mb(h, mb_x, mb_y, dest_y, dest_cb, dest_cr,
+ linesize, uvlinesize);
} else {
- ff_h264_filter_mb_fast(h, mb_x, mb_y, dest_y, dest_cb, dest_cr, linesize, uvlinesize);
+ ff_h264_filter_mb_fast(h, mb_x, mb_y, dest_y, dest_cb,
+ dest_cr, linesize, uvlinesize);
}
}
- }
}
- h->slice_type= old_slice_type;
- s->mb_x= end_x;
- s->mb_y= end_mb_y - FRAME_MBAFF;
+ h->slice_type = old_slice_type;
+ s->mb_x = end_x;
+ s->mb_y = end_mb_y - FRAME_MBAFF;
h->chroma_qp[0] = get_chroma_qp(h, 0, s->qscale);
h->chroma_qp[1] = get_chroma_qp(h, 1, s->qscale);
}
-static void predict_field_decoding_flag(H264Context *h){
- MpegEncContext * const s = &h->s;
- const int mb_xy= s->mb_x + s->mb_y*s->mb_stride;
- int mb_type = (h->slice_table[mb_xy-1] == h->slice_num)
- ? s->current_picture.f.mb_type[mb_xy - 1]
- : (h->slice_table[mb_xy-s->mb_stride] == h->slice_num)
- ? s->current_picture.f.mb_type[mb_xy - s->mb_stride]
- : 0;
- h->mb_mbaff = h->mb_field_decoding_flag = IS_INTERLACED(mb_type) ? 1 : 0;
+static void predict_field_decoding_flag(H264Context *h)
+{
+ MpegEncContext *const s = &h->s;
+ const int mb_xy = s->mb_x + s->mb_y * s->mb_stride;
+ int mb_type = (h->slice_table[mb_xy - 1] == h->slice_num) ?
+ s->current_picture.f.mb_type[mb_xy - 1] :
+ (h->slice_table[mb_xy - s->mb_stride] == h->slice_num) ?
+ s->current_picture.f.mb_type[mb_xy - s->mb_stride] : 0;
+ h->mb_mbaff = h->mb_field_decoding_flag = IS_INTERLACED(mb_type) ? 1 : 0;
}
/**
* Draw edges and report progress for the last MB row.
*/
-static void decode_finish_row(H264Context *h){
- MpegEncContext * const s = &h->s;
- int top = 16*(s->mb_y >> FIELD_PICTURE);
- int height = 16 << FRAME_MBAFF;
+static void decode_finish_row(H264Context *h)
+{
+ MpegEncContext *const s = &h->s;
+ int top = 16 * (s->mb_y >> FIELD_PICTURE);
+ int pic_height = 16 * s->mb_height >> FIELD_PICTURE;
+ int height = 16 << FRAME_MBAFF;
int deblock_border = (16 + 4) << FRAME_MBAFF;
- int pic_height = 16*s->mb_height >> FIELD_PICTURE;
if (h->deblocking_filter) {
- if((top + height) >= pic_height)
+ if ((top + height) >= pic_height)
height += deblock_border;
-
top -= deblock_border;
}
@@ -3649,145 +3629,175 @@ static void decode_finish_row(H264Context *h){
height = FFMIN(height, pic_height - top);
if (top < h->emu_edge_height) {
- height = top+height;
- top = 0;
+ height = top + height;
+ top = 0;
}
ff_draw_horiz_band(s, top, height);
- if (s->dropable) return;
+ if (s->droppable)
+ return;
- ff_thread_report_progress((AVFrame*)s->current_picture_ptr, top + height - 1,
- s->picture_structure==PICT_BOTTOM_FIELD);
+ ff_thread_report_progress(&s->current_picture_ptr->f, top + height - 1,
+ s->picture_structure == PICT_BOTTOM_FIELD);
}
-static int decode_slice(struct AVCodecContext *avctx, void *arg){
- H264Context *h = *(void**)arg;
- MpegEncContext * const s = &h->s;
- const int part_mask= s->partitioned_frame ? (ER_AC_END|ER_AC_ERROR) : 0x7F;
+static int decode_slice(struct AVCodecContext *avctx, void *arg)
+{
+ H264Context *h = *(void **)arg;
+ MpegEncContext *const s = &h->s;
+ const int part_mask = s->partitioned_frame ? (ER_AC_END | ER_AC_ERROR)
+ : 0x7F;
int lf_x_start = s->mb_x;
- s->mb_skip_run= -1;
+ s->mb_skip_run = -1;
- h->is_complex = FRAME_MBAFF || s->picture_structure != PICT_FRAME || s->codec_id != CODEC_ID_H264 ||
- (CONFIG_GRAY && (s->flags&CODEC_FLAG_GRAY));
+ h->is_complex = FRAME_MBAFF || s->picture_structure != PICT_FRAME ||
+ s->codec_id != AV_CODEC_ID_H264 ||
+ (CONFIG_GRAY && (s->flags & CODEC_FLAG_GRAY));
- if( h->pps.cabac ) {
+ if (h->pps.cabac) {
/* realign */
- align_get_bits( &s->gb );
+ align_get_bits(&s->gb);
/* init cabac */
- ff_init_cabac_states( &h->cabac);
- ff_init_cabac_decoder( &h->cabac,
- s->gb.buffer + get_bits_count(&s->gb)/8,
- (get_bits_left(&s->gb) + 7)/8);
+ ff_init_cabac_states(&h->cabac);
+ ff_init_cabac_decoder(&h->cabac,
+ s->gb.buffer + get_bits_count(&s->gb) / 8,
+ (get_bits_left(&s->gb) + 7) / 8);
ff_h264_init_cabac_states(h);
- for(;;){
-//START_TIMER
+ for (;;) {
+ // START_TIMER
int ret = ff_h264_decode_mb_cabac(h);
int eos;
-//STOP_TIMER("decode_mb_cabac")
+ // STOP_TIMER("decode_mb_cabac")
- if(ret>=0) ff_h264_hl_decode_mb(h);
+ if (ret >= 0)
+ ff_h264_hl_decode_mb(h);
- if( ret >= 0 && FRAME_MBAFF ) { //FIXME optimal? or let mb_decode decode 16x32 ?
+ // FIXME optimal? or let mb_decode decode 16x32 ?
+ if (ret >= 0 && FRAME_MBAFF) {
s->mb_y++;
ret = ff_h264_decode_mb_cabac(h);
- if(ret>=0) ff_h264_hl_decode_mb(h);
+ if (ret >= 0)
+ ff_h264_hl_decode_mb(h);
s->mb_y--;
}
- eos = get_cabac_terminate( &h->cabac );
-
- if((s->workaround_bugs & FF_BUG_TRUNCATED) && h->cabac.bytestream > h->cabac.bytestream_end + 2){
- ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x-1, s->mb_y, ER_MB_END&part_mask);
- if (s->mb_x >= lf_x_start) loop_filter(h, lf_x_start, s->mb_x + 1);
+ eos = get_cabac_terminate(&h->cabac);
+
+ if ((s->workaround_bugs & FF_BUG_TRUNCATED) &&
+ h->cabac.bytestream > h->cabac.bytestream_end + 2) {
+ ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x - 1,
+ s->mb_y, ER_MB_END & part_mask);
+ if (s->mb_x >= lf_x_start)
+ loop_filter(h, lf_x_start, s->mb_x + 1);
return 0;
}
- if( ret < 0 || h->cabac.bytestream > h->cabac.bytestream_end + 2) {
- av_log(h->s.avctx, AV_LOG_ERROR, "error while decoding MB %d %d, bytestream (%td)\n", s->mb_x, s->mb_y, h->cabac.bytestream_end - h->cabac.bytestream);
- ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y, ER_MB_ERROR&part_mask);
+ if (ret < 0 || h->cabac.bytestream > h->cabac.bytestream_end + 2) {
+ av_log(h->s.avctx, AV_LOG_ERROR,
+ "error while decoding MB %d %d, bytestream (%td)\n",
+ s->mb_x, s->mb_y,
+ h->cabac.bytestream_end - h->cabac.bytestream);
+ ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x,
+ s->mb_y, ER_MB_ERROR & part_mask);
return -1;
}
- if( ++s->mb_x >= s->mb_width ) {
+ if (++s->mb_x >= s->mb_width) {
loop_filter(h, lf_x_start, s->mb_x);
s->mb_x = lf_x_start = 0;
decode_finish_row(h);
++s->mb_y;
- if(FIELD_OR_MBAFF_PICTURE) {
+ if (FIELD_OR_MBAFF_PICTURE) {
++s->mb_y;
- if(FRAME_MBAFF && s->mb_y < s->mb_height)
+ if (FRAME_MBAFF && s->mb_y < s->mb_height)
predict_field_decoding_flag(h);
}
}
- if( eos || s->mb_y >= s->mb_height ) {
- tprintf(s->avctx, "slice end %d %d\n", get_bits_count(&s->gb), s->gb.size_in_bits);
- ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x-1, s->mb_y, ER_MB_END&part_mask);
- if (s->mb_x > lf_x_start) loop_filter(h, lf_x_start, s->mb_x);
+ if (eos || s->mb_y >= s->mb_height) {
+ tprintf(s->avctx, "slice end %d %d\n",
+ get_bits_count(&s->gb), s->gb.size_in_bits);
+ ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x - 1,
+ s->mb_y, ER_MB_END & part_mask);
+ if (s->mb_x > lf_x_start)
+ loop_filter(h, lf_x_start, s->mb_x);
return 0;
}
}
-
} else {
- for(;;){
+ for (;;) {
int ret = ff_h264_decode_mb_cavlc(h);
- if(ret>=0) ff_h264_hl_decode_mb(h);
+ if (ret >= 0)
+ ff_h264_hl_decode_mb(h);
- if(ret>=0 && FRAME_MBAFF){ //FIXME optimal? or let mb_decode decode 16x32 ?
+ // FIXME optimal? or let mb_decode decode 16x32 ?
+ if (ret >= 0 && FRAME_MBAFF) {
s->mb_y++;
ret = ff_h264_decode_mb_cavlc(h);
- if(ret>=0) ff_h264_hl_decode_mb(h);
+ if (ret >= 0)
+ ff_h264_hl_decode_mb(h);
s->mb_y--;
}
- if(ret<0){
- av_log(h->s.avctx, AV_LOG_ERROR, "error while decoding MB %d %d\n", s->mb_x, s->mb_y);
- ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y, ER_MB_ERROR&part_mask);
+ if (ret < 0) {
+ av_log(h->s.avctx, AV_LOG_ERROR,
+ "error while decoding MB %d %d\n", s->mb_x, s->mb_y);
+ ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x,
+ s->mb_y, ER_MB_ERROR & part_mask);
return -1;
}
- if(++s->mb_x >= s->mb_width){
+ if (++s->mb_x >= s->mb_width) {
loop_filter(h, lf_x_start, s->mb_x);
s->mb_x = lf_x_start = 0;
decode_finish_row(h);
++s->mb_y;
- if(FIELD_OR_MBAFF_PICTURE) {
+ if (FIELD_OR_MBAFF_PICTURE) {
++s->mb_y;
- if(FRAME_MBAFF && s->mb_y < s->mb_height)
+ if (FRAME_MBAFF && s->mb_y < s->mb_height)
predict_field_decoding_flag(h);
}
- if(s->mb_y >= s->mb_height){
- tprintf(s->avctx, "slice end %d %d\n", get_bits_count(&s->gb), s->gb.size_in_bits);
+ if (s->mb_y >= s->mb_height) {
+ tprintf(s->avctx, "slice end %d %d\n",
+ get_bits_count(&s->gb), s->gb.size_in_bits);
if (get_bits_left(&s->gb) == 0) {
- ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x-1, s->mb_y, ER_MB_END&part_mask);
+ ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y,
+ s->mb_x - 1, s->mb_y,
+ ER_MB_END & part_mask);
return 0;
} else {
ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y,
s->mb_x - 1, s->mb_y,
ER_MB_END & part_mask);
+
return -1;
}
}
}
- if (get_bits_left(&s->gb) <= 0 && s->mb_skip_run <= 0){
- tprintf(s->avctx, "slice end %d %d\n", get_bits_count(&s->gb), s->gb.size_in_bits);
+ if (get_bits_left(&s->gb) <= 0 && s->mb_skip_run <= 0) {
+ tprintf(s->avctx, "slice end %d %d\n",
+ get_bits_count(&s->gb), s->gb.size_in_bits);
if (get_bits_left(&s->gb) == 0) {
- ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x-1, s->mb_y, ER_MB_END&part_mask);
- if (s->mb_x > lf_x_start) loop_filter(h, lf_x_start, s->mb_x);
+ ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y,
+ s->mb_x - 1, s->mb_y,
+ ER_MB_END & part_mask);
+ if (s->mb_x > lf_x_start)
+ loop_filter(h, lf_x_start, s->mb_x);
return 0;
- }else{
- ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y, ER_MB_ERROR&part_mask);
+ } else {
+ ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x,
+ s->mb_y, ER_MB_ERROR & part_mask);
return -1;
}
@@ -3802,326 +3812,331 @@ static int decode_slice(struct AVCodecContext *avctx, void *arg){
* @param h h264 master context
* @param context_count number of contexts to execute
*/
-static int execute_decode_slices(H264Context *h, int context_count){
- MpegEncContext * const s = &h->s;
- AVCodecContext * const avctx= s->avctx;
+static int execute_decode_slices(H264Context *h, int context_count)
+{
+ MpegEncContext *const s = &h->s;
+ AVCodecContext *const avctx = s->avctx;
H264Context *hx;
int i;
- if (s->avctx->hwaccel || s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU)
+ if (s->avctx->hwaccel ||
+ s->avctx->codec->capabilities & CODEC_CAP_HWACCEL_VDPAU)
return 0;
- if(context_count == 1) {
+ if (context_count == 1) {
return decode_slice(avctx, &h);
} else {
- for(i = 1; i < context_count; i++) {
- hx = h->thread_context[i];
+ for (i = 1; i < context_count; i++) {
+ hx = h->thread_context[i];
hx->s.err_recognition = avctx->err_recognition;
- hx->s.error_count = 0;
+ hx->s.error_count = 0;
}
- avctx->execute(avctx, decode_slice,
- h->thread_context, NULL, context_count, sizeof(void*));
+ avctx->execute(avctx, decode_slice, h->thread_context,
+ NULL, context_count, sizeof(void *));
/* pull back stuff from slices to master context */
- hx = h->thread_context[context_count - 1];
- s->mb_x = hx->s.mb_x;
- s->mb_y = hx->s.mb_y;
- s->dropable = hx->s.dropable;
+ hx = h->thread_context[context_count - 1];
+ s->mb_x = hx->s.mb_x;
+ s->mb_y = hx->s.mb_y;
+ s->droppable = hx->s.droppable;
s->picture_structure = hx->s.picture_structure;
- for(i = 1; i < context_count; i++)
+ for (i = 1; i < context_count; i++)
h->s.error_count += h->thread_context[i]->s.error_count;
}
return 0;
}
-
-static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size){
- MpegEncContext * const s = &h->s;
- AVCodecContext * const avctx= s->avctx;
+static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size,
+ int parse_extradata)
+{
+ MpegEncContext *const s = &h->s;
+ AVCodecContext *const avctx = s->avctx;
H264Context *hx; ///< thread context
int buf_index;
int context_count;
int next_avc;
int pass = !(avctx->active_thread_type & FF_THREAD_FRAME);
- int nals_needed=0; ///< number of NALs that need decoding before the next frame thread starts
+ int nals_needed = 0; ///< number of NALs that need decoding before the next frame thread starts
int nal_index;
h->max_contexts = s->slice_context_count;
- if(!(s->flags2 & CODEC_FLAG2_CHUNKS)){
+ if (!(s->flags2 & CODEC_FLAG2_CHUNKS)) {
h->current_slice = 0;
if (!s->first_field)
- s->current_picture_ptr= NULL;
+ s->current_picture_ptr = NULL;
ff_h264_reset_sei(h);
}
- for(;pass <= 1;pass++){
- buf_index = 0;
+ for (; pass <= 1; pass++) {
+ buf_index = 0;
context_count = 0;
- next_avc = h->is_avc ? 0 : buf_size;
- nal_index = 0;
- for(;;){
- int consumed;
- int dst_length;
- int bit_length;
- const uint8_t *ptr;
- int i, nalsize = 0;
- int err;
-
- if(buf_index >= next_avc) {
- if (buf_index >= buf_size - h->nal_length_size) break;
- nalsize = 0;
- for(i = 0; i < h->nal_length_size; i++)
- nalsize = (nalsize << 8) | buf[buf_index++];
- if(nalsize <= 0 || nalsize > buf_size - buf_index){
- av_log(h->s.avctx, AV_LOG_ERROR, "AVC: nal size %d\n", nalsize);
- break;
- }
- next_avc= buf_index + nalsize;
- } else {
- // start code prefix search
- for(; buf_index + 3 < next_avc; buf_index++){
- // This should always succeed in the first iteration.
- if(buf[buf_index] == 0 && buf[buf_index+1] == 0 && buf[buf_index+2] == 1)
+ next_avc = h->is_avc ? 0 : buf_size;
+ nal_index = 0;
+ for (;;) {
+ int consumed;
+ int dst_length;
+ int bit_length;
+ const uint8_t *ptr;
+ int i, nalsize = 0;
+ int err;
+
+ if (buf_index >= next_avc) {
+ if (buf_index >= buf_size - h->nal_length_size)
break;
- }
+ nalsize = 0;
+ for (i = 0; i < h->nal_length_size; i++)
+ nalsize = (nalsize << 8) | buf[buf_index++];
+ if (nalsize <= 0 || nalsize > buf_size - buf_index) {
+ av_log(h->s.avctx, AV_LOG_ERROR,
+ "AVC: nal size %d\n", nalsize);
+ break;
+ }
+ next_avc = buf_index + nalsize;
+ } else {
+ // start code prefix search
+ for (; buf_index + 3 < next_avc; buf_index++)
+ // This should always succeed in the first iteration.
+ if (buf[buf_index] == 0 &&
+ buf[buf_index + 1] == 0 &&
+ buf[buf_index + 2] == 1)
+ break;
+ if (buf_index + 3 >= buf_size) {
+ buf_index = buf_size;
+ break;
+ }
- if (buf_index + 3 >= buf_size) {
- buf_index = buf_size;
- break;
+ buf_index += 3;
+ if (buf_index >= next_avc)
+ continue;
}
- buf_index+=3;
- if(buf_index >= next_avc) continue;
- }
-
- hx = h->thread_context[context_count];
-
- ptr= ff_h264_decode_nal(hx, buf + buf_index, &dst_length, &consumed, next_avc - buf_index);
- if (ptr == NULL || dst_length < 0) {
- buf_index = -1;
- goto end;
- }
- i= buf_index + consumed;
- if((s->workaround_bugs & FF_BUG_AUTODETECT) && i+3<next_avc &&
- buf[i]==0x00 && buf[i+1]==0x00 && buf[i+2]==0x01 && buf[i+3]==0xE0)
- s->workaround_bugs |= FF_BUG_TRUNCATED;
-
- if(!(s->workaround_bugs & FF_BUG_TRUNCATED)){
- while(ptr[dst_length - 1] == 0 && dst_length > 0)
- dst_length--;
- }
- bit_length= !dst_length ? 0 : (8*dst_length - ff_h264_decode_rbsp_trailing(h, ptr + dst_length - 1));
-
- if(s->avctx->debug&FF_DEBUG_STARTCODE){
- av_log(h->s.avctx, AV_LOG_DEBUG, "NAL %d at %d/%d length %d\n", hx->nal_unit_type, buf_index, buf_size, dst_length);
- }
-
- if (h->is_avc && (nalsize != consumed) && nalsize){
- av_log(h->s.avctx, AV_LOG_DEBUG, "AVC: Consumed only %d bytes instead of %d\n", consumed, nalsize);
- }
-
- buf_index += consumed;
- nal_index++;
+ hx = h->thread_context[context_count];
- if(pass == 0) {
- // packets can sometimes contain multiple PPS/SPS
- // e.g. two PAFF field pictures in one packet, or a demuxer which splits NALs strangely
- // if so, when frame threading we can't start the next thread until we've read all of them
- switch (hx->nal_unit_type) {
+ ptr = ff_h264_decode_nal(hx, buf + buf_index, &dst_length,
+ &consumed, next_avc - buf_index);
+ if (ptr == NULL || dst_length < 0) {
+ buf_index = -1;
+ goto end;
+ }
+ i = buf_index + consumed;
+ if ((s->workaround_bugs & FF_BUG_AUTODETECT) && i + 3 < next_avc &&
+ buf[i] == 0x00 && buf[i + 1] == 0x00 &&
+ buf[i + 2] == 0x01 && buf[i + 3] == 0xE0)
+ s->workaround_bugs |= FF_BUG_TRUNCATED;
+
+ if (!(s->workaround_bugs & FF_BUG_TRUNCATED))
+ while (ptr[dst_length - 1] == 0 && dst_length > 0)
+ dst_length--;
+ bit_length = !dst_length ? 0
+ : (8 * dst_length -
+ decode_rbsp_trailing(h, ptr + dst_length - 1));
+
+ if (s->avctx->debug & FF_DEBUG_STARTCODE)
+ av_log(h->s.avctx, AV_LOG_DEBUG,
+ "NAL %d at %d/%d length %d\n",
+ hx->nal_unit_type, buf_index, buf_size, dst_length);
+
+ if (h->is_avc && (nalsize != consumed) && nalsize)
+ av_log(h->s.avctx, AV_LOG_DEBUG,
+ "AVC: Consumed only %d bytes instead of %d\n",
+ consumed, nalsize);
+
+ buf_index += consumed;
+ nal_index++;
+
+ if (pass == 0) {
+ /* packets can sometimes contain multiple PPS/SPS,
+ * e.g. two PAFF field pictures in one packet, or a demuxer
+ * which splits NALs strangely if so, when frame threading we
+ * can't start the next thread until we've read all of them */
+ switch (hx->nal_unit_type) {
case NAL_SPS:
case NAL_PPS:
nals_needed = nal_index;
break;
+ case NAL_DPA:
case NAL_IDR_SLICE:
case NAL_SLICE:
init_get_bits(&hx->s.gb, ptr, bit_length);
if (!get_ue_golomb(&hx->s.gb))
nals_needed = nal_index;
+ }
+ continue;
}
- continue;
- }
- //FIXME do not discard SEI id
- if(avctx->skip_frame >= AVDISCARD_NONREF && h->nal_ref_idc == 0)
- continue;
+ // FIXME do not discard SEI id
+ if (avctx->skip_frame >= AVDISCARD_NONREF && h->nal_ref_idc == 0)
+ continue;
- again:
- err = 0;
- switch(hx->nal_unit_type){
- case NAL_IDR_SLICE:
- if (h->nal_unit_type != NAL_IDR_SLICE) {
- av_log(h->s.avctx, AV_LOG_ERROR, "Invalid mix of idr and non-idr slices");
- buf_index = -1;
- goto end;
+again:
+ /* Ignore every NAL unit type except PPS and SPS during extradata
+ * parsing. Decoding slices is not possible in codec init
+ * with frame-mt */
+ if (parse_extradata && HAVE_THREADS &&
+ (s->avctx->active_thread_type & FF_THREAD_FRAME) &&
+ (hx->nal_unit_type != NAL_PPS &&
+ hx->nal_unit_type != NAL_SPS)) {
+ av_log(avctx, AV_LOG_INFO, "Ignoring NAL unit %d during "
+ "extradata parsing\n", hx->nal_unit_type);
+ hx->nal_unit_type = NAL_FF_IGNORE;
}
- idr(h); // FIXME ensure we don't lose some frames if there is reordering
- case NAL_SLICE:
- init_get_bits(&hx->s.gb, ptr, bit_length);
- hx->intra_gb_ptr=
- hx->inter_gb_ptr= &hx->s.gb;
- hx->s.data_partitioning = 0;
-
- if((err = decode_slice_header(hx, h)))
- break;
+ err = 0;
+ switch (hx->nal_unit_type) {
+ case NAL_IDR_SLICE:
+ if (h->nal_unit_type != NAL_IDR_SLICE) {
+ av_log(h->s.avctx, AV_LOG_ERROR,
+ "Invalid mix of idr and non-idr slices\n");
+ buf_index = -1;
+ goto end;
+ }
+ idr(h); // FIXME ensure we don't lose some frames if there is reordering
+ case NAL_SLICE:
+ init_get_bits(&hx->s.gb, ptr, bit_length);
+ hx->intra_gb_ptr =
+ hx->inter_gb_ptr = &hx->s.gb;
+ hx->s.data_partitioning = 0;
+
+ if ((err = decode_slice_header(hx, h)))
+ break;
- s->current_picture_ptr->f.key_frame |=
+ s->current_picture_ptr->f.key_frame |=
(hx->nal_unit_type == NAL_IDR_SLICE) ||
(h->sei_recovery_frame_cnt >= 0);
- if (h->current_slice == 1) {
- if(!(s->flags2 & CODEC_FLAG2_CHUNKS)) {
- decode_postinit(h, nal_index >= nals_needed);
- }
-
- if (s->avctx->hwaccel && s->avctx->hwaccel->start_frame(s->avctx, NULL, 0) < 0)
- return -1;
- if(CONFIG_H264_VDPAU_DECODER && s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU)
- ff_vdpau_h264_picture_start(s);
- }
+ if (h->current_slice == 1) {
+ if (!(s->flags2 & CODEC_FLAG2_CHUNKS))
+ decode_postinit(h, nal_index >= nals_needed);
- if(hx->redundant_pic_count==0
- && (avctx->skip_frame < AVDISCARD_NONREF || hx->nal_ref_idc)
- && (avctx->skip_frame < AVDISCARD_BIDIR || hx->slice_type_nos!=AV_PICTURE_TYPE_B)
- && (avctx->skip_frame < AVDISCARD_NONKEY || hx->slice_type_nos==AV_PICTURE_TYPE_I)
- && avctx->skip_frame < AVDISCARD_ALL){
- if(avctx->hwaccel) {
- if (avctx->hwaccel->decode_slice(avctx, &buf[buf_index - consumed], consumed) < 0)
+ if (s->avctx->hwaccel &&
+ s->avctx->hwaccel->start_frame(s->avctx, NULL, 0) < 0)
return -1;
- }else
- if(CONFIG_H264_VDPAU_DECODER && s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU){
- static const uint8_t start_code[] = {0x00, 0x00, 0x01};
- ff_vdpau_add_data_chunk(s, start_code, sizeof(start_code));
- ff_vdpau_add_data_chunk(s, &buf[buf_index - consumed], consumed );
- }else
- context_count++;
- }
- break;
- case NAL_DPA:
- init_get_bits(&hx->s.gb, ptr, bit_length);
- hx->intra_gb_ptr=
- hx->inter_gb_ptr= NULL;
+ if (CONFIG_H264_VDPAU_DECODER &&
+ s->avctx->codec->capabilities & CODEC_CAP_HWACCEL_VDPAU)
+ ff_vdpau_h264_picture_start(s);
+ }
- if ((err = decode_slice_header(hx, h)) < 0)
+ if (hx->redundant_pic_count == 0 &&
+ (avctx->skip_frame < AVDISCARD_NONREF ||
+ hx->nal_ref_idc) &&
+ (avctx->skip_frame < AVDISCARD_BIDIR ||
+ hx->slice_type_nos != AV_PICTURE_TYPE_B) &&
+ (avctx->skip_frame < AVDISCARD_NONKEY ||
+ hx->slice_type_nos == AV_PICTURE_TYPE_I) &&
+ avctx->skip_frame < AVDISCARD_ALL) {
+ if (avctx->hwaccel) {
+ if (avctx->hwaccel->decode_slice(avctx,
+ &buf[buf_index - consumed],
+ consumed) < 0)
+ return -1;
+ } else if (CONFIG_H264_VDPAU_DECODER &&
+ s->avctx->codec->capabilities & CODEC_CAP_HWACCEL_VDPAU) {
+ static const uint8_t start_code[] = {
+ 0x00, 0x00, 0x01 };
+ ff_vdpau_add_data_chunk(s, start_code,
+ sizeof(start_code));
+ ff_vdpau_add_data_chunk(s, &buf[buf_index - consumed],
+ consumed);
+ } else
+ context_count++;
+ }
break;
+ case NAL_DPA:
+ init_get_bits(&hx->s.gb, ptr, bit_length);
+ hx->intra_gb_ptr =
+ hx->inter_gb_ptr = NULL;
- hx->s.data_partitioning = 1;
-
- break;
- case NAL_DPB:
- init_get_bits(&hx->intra_gb, ptr, bit_length);
- hx->intra_gb_ptr= &hx->intra_gb;
- break;
- case NAL_DPC:
- init_get_bits(&hx->inter_gb, ptr, bit_length);
- hx->inter_gb_ptr= &hx->inter_gb;
-
- if(hx->redundant_pic_count==0 && hx->intra_gb_ptr && hx->s.data_partitioning
- && s->current_picture_ptr
- && s->context_initialized
- && (avctx->skip_frame < AVDISCARD_NONREF || hx->nal_ref_idc)
- && (avctx->skip_frame < AVDISCARD_BIDIR || hx->slice_type_nos!=AV_PICTURE_TYPE_B)
- && (avctx->skip_frame < AVDISCARD_NONKEY || hx->slice_type_nos==AV_PICTURE_TYPE_I)
- && avctx->skip_frame < AVDISCARD_ALL)
- context_count++;
- break;
- case NAL_SEI:
- init_get_bits(&s->gb, ptr, bit_length);
- ff_h264_decode_sei(h);
- break;
- case NAL_SPS:
- init_get_bits(&s->gb, ptr, bit_length);
- if (ff_h264_decode_seq_parameter_set(h) < 0 &&
- h->is_avc && (nalsize != consumed) && nalsize) {
- av_log(h->s.avctx, AV_LOG_DEBUG, "SPS decoding failure, "
- "try parsing the coomplete NAL\n");
- init_get_bits(&s->gb, buf + buf_index + 1 - consumed,
- 8 * (nalsize - 1));
- ff_h264_decode_seq_parameter_set(h);
- }
-
- if (s->flags & CODEC_FLAG_LOW_DELAY ||
- (h->sps.bitstream_restriction_flag &&
- !h->sps.num_reorder_frames)) {
- if (s->avctx->has_b_frames > 1 || h->delayed_pic[0])
- av_log(avctx, AV_LOG_WARNING, "Delayed frames seen "
- "reenabling low delay requires a codec "
- "flush.\n");
- else
- s->low_delay = 1;
- }
-
- if(avctx->has_b_frames < 2)
- avctx->has_b_frames= !s->low_delay;
+ if ((err = decode_slice_header(hx, h)) < 0)
+ break;
- if (h->sps.bit_depth_luma != h->sps.bit_depth_chroma) {
- av_log_missing_feature(s->avctx,
- "Different bit depth between chroma and luma", 1);
- return AVERROR_PATCHWELCOME;
- }
+ hx->s.data_partitioning = 1;
+ break;
+ case NAL_DPB:
+ init_get_bits(&hx->intra_gb, ptr, bit_length);
+ hx->intra_gb_ptr = &hx->intra_gb;
+ break;
+ case NAL_DPC:
+ init_get_bits(&hx->inter_gb, ptr, bit_length);
+ hx->inter_gb_ptr = &hx->inter_gb;
+
+ if (hx->redundant_pic_count == 0 &&
+ hx->intra_gb_ptr &&
+ hx->s.data_partitioning &&
+ s->current_picture_ptr &&
+ s->context_initialized &&
+ (avctx->skip_frame < AVDISCARD_NONREF || hx->nal_ref_idc) &&
+ (avctx->skip_frame < AVDISCARD_BIDIR ||
+ hx->slice_type_nos != AV_PICTURE_TYPE_B) &&
+ (avctx->skip_frame < AVDISCARD_NONKEY ||
+ hx->slice_type_nos == AV_PICTURE_TYPE_I) &&
+ avctx->skip_frame < AVDISCARD_ALL)
+ context_count++;
+ break;
+ case NAL_SEI:
+ init_get_bits(&s->gb, ptr, bit_length);
+ ff_h264_decode_sei(h);
+ break;
+ case NAL_SPS:
+ init_get_bits(&s->gb, ptr, bit_length);
+ if (ff_h264_decode_seq_parameter_set(h) < 0 &&
+ h->is_avc && (nalsize != consumed) && nalsize) {
+ av_log(h->s.avctx, AV_LOG_DEBUG,
+ "SPS decoding failure, trying again with the complete NAL\n");
+ init_get_bits(&s->gb, buf + buf_index + 1 - consumed,
+ 8 * (nalsize - 1));
+ ff_h264_decode_seq_parameter_set(h);
+ }
- if (avctx->bits_per_raw_sample != h->sps.bit_depth_luma ||
- h->cur_chroma_format_idc != h->sps.chroma_format_idc) {
- if (h->sps.bit_depth_luma >= 8 && h->sps.bit_depth_luma <= 10) {
- avctx->bits_per_raw_sample = h->sps.bit_depth_luma;
- h->cur_chroma_format_idc = h->sps.chroma_format_idc;
- h->pixel_shift = h->sps.bit_depth_luma > 8;
-
- ff_h264dsp_init(&h->h264dsp, h->sps.bit_depth_luma, h->sps.chroma_format_idc);
- ff_h264_pred_init(&h->hpc, s->codec_id, h->sps.bit_depth_luma, h->sps.chroma_format_idc);
- s->dsp.dct_bits = h->sps.bit_depth_luma > 8 ? 32 : 16;
- dsputil_init(&s->dsp, s->avctx);
- } else {
- av_log(avctx, AV_LOG_ERROR, "Unsupported bit depth: %d\n", h->sps.bit_depth_luma);
+ if (h264_set_parameter_from_sps(h) < 0) {
buf_index = -1;
goto end;
}
+ break;
+ case NAL_PPS:
+ init_get_bits(&s->gb, ptr, bit_length);
+ ff_h264_decode_picture_parameter_set(h, bit_length);
+ break;
+ case NAL_AUD:
+ case NAL_END_SEQUENCE:
+ case NAL_END_STREAM:
+ case NAL_FILLER_DATA:
+ case NAL_SPS_EXT:
+ case NAL_AUXILIARY_SLICE:
+ break;
+ case NAL_FF_IGNORE:
+ break;
+ default:
+ av_log(avctx, AV_LOG_DEBUG, "Unknown NAL code: %d (%d bits)\n",
+ hx->nal_unit_type, bit_length);
}
- break;
- case NAL_PPS:
- init_get_bits(&s->gb, ptr, bit_length);
- ff_h264_decode_picture_parameter_set(h, bit_length);
-
- break;
- case NAL_AUD:
- case NAL_END_SEQUENCE:
- case NAL_END_STREAM:
- case NAL_FILLER_DATA:
- case NAL_SPS_EXT:
- case NAL_AUXILIARY_SLICE:
- break;
- default:
- av_log(avctx, AV_LOG_DEBUG, "Unknown NAL code: %d (%d bits)\n", hx->nal_unit_type, bit_length);
- }
-
- if(context_count == h->max_contexts) {
- execute_decode_slices(h, context_count);
- context_count = 0;
- }
+ if (context_count == h->max_contexts) {
+ execute_decode_slices(h, context_count);
+ context_count = 0;
+ }
- if (err < 0)
- av_log(h->s.avctx, AV_LOG_ERROR, "decode_slice_header error\n");
- else if(err == 1) {
- /* Slice could not be decoded in parallel mode, copy down
- * NAL unit stuff to context 0 and restart. Note that
- * rbsp_buffer is not transferred, but since we no longer
- * run in parallel mode this should not be an issue. */
- h->nal_unit_type = hx->nal_unit_type;
- h->nal_ref_idc = hx->nal_ref_idc;
- hx = h;
- goto again;
+ if (err < 0)
+ av_log(h->s.avctx, AV_LOG_ERROR, "decode_slice_header error\n");
+ else if (err == 1) {
+ /* Slice could not be decoded in parallel mode, copy down
+ * NAL unit stuff to context 0 and restart. Note that
+ * rbsp_buffer is not transferred, but since we no longer
+ * run in parallel mode this should not be an issue. */
+ h->nal_unit_type = hx->nal_unit_type;
+ h->nal_ref_idc = hx->nal_ref_idc;
+ hx = h;
+ goto again;
+ }
}
}
- }
- if(context_count)
+ if (context_count)
execute_decode_slices(h, context_count);
end:
/* clean up */
if (s->current_picture_ptr && s->current_picture_ptr->owner2 == s &&
- !s->dropable) {
+ !s->droppable) {
ff_thread_report_progress(&s->current_picture_ptr->f, INT_MAX,
s->picture_structure == PICT_BOTTOM_FIELD);
}
@@ -4132,57 +4147,63 @@ end:
/**
* Return the number of bytes consumed for building the current frame.
*/
-static int get_consumed_bytes(MpegEncContext *s, int pos, int buf_size){
- if(pos==0) pos=1; //avoid infinite loops (i doubt that is needed but ...)
- if(pos+10>buf_size) pos=buf_size; // oops ;)
+static int get_consumed_bytes(MpegEncContext *s, int pos, int buf_size)
+{
+ if (pos == 0)
+ pos = 1; // avoid infinite loops (i doubt that is needed but ...)
+ if (pos + 10 > buf_size)
+ pos = buf_size; // oops ;)
- return pos;
+ return pos;
}
-static int decode_frame(AVCodecContext *avctx,
- void *data, int *data_size,
- AVPacket *avpkt)
+static int decode_frame(AVCodecContext *avctx, void *data,
+ int *got_frame, AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
- int buf_size = avpkt->size;
- H264Context *h = avctx->priv_data;
- MpegEncContext *s = &h->s;
- AVFrame *pict = data;
- int buf_index = 0;
+ int buf_size = avpkt->size;
+ H264Context *h = avctx->priv_data;
+ MpegEncContext *s = &h->s;
+ AVFrame *pict = data;
+ int buf_index = 0;
- s->flags= avctx->flags;
- s->flags2= avctx->flags2;
+ s->flags = avctx->flags;
+ s->flags2 = avctx->flags2;
- /* end of stream, output what is still in the buffers */
- out:
+ /* end of stream, output what is still in the buffers */
+out:
if (buf_size == 0) {
Picture *out;
int i, out_idx;
s->current_picture_ptr = NULL;
-//FIXME factorize this with the output code below
- out = h->delayed_pic[0];
+ // FIXME factorize this with the output code below
+ out = h->delayed_pic[0];
out_idx = 0;
- for (i = 1; h->delayed_pic[i] && !h->delayed_pic[i]->f.key_frame && !h->delayed_pic[i]->mmco_reset; i++)
- if(h->delayed_pic[i]->poc < out->poc){
- out = h->delayed_pic[i];
+ for (i = 1;
+ h->delayed_pic[i] &&
+ !h->delayed_pic[i]->f.key_frame &&
+ !h->delayed_pic[i]->mmco_reset;
+ i++)
+ if (h->delayed_pic[i]->poc < out->poc) {
+ out = h->delayed_pic[i];
out_idx = i;
}
- for(i=out_idx; h->delayed_pic[i]; i++)
- h->delayed_pic[i] = h->delayed_pic[i+1];
+ for (i = out_idx; h->delayed_pic[i]; i++)
+ h->delayed_pic[i] = h->delayed_pic[i + 1];
- if(out){
- *data_size = sizeof(AVFrame);
- *pict= *(AVFrame*)out;
+ if (out) {
+ *got_frame = 1;
+ *pict = out->f;
}
return buf_index;
}
- buf_index=decode_nal_units(h, buf, buf_size);
- if(buf_index < 0)
+ buf_index = decode_nal_units(h, buf, buf_size, 0);
+ if (buf_index < 0)
return -1;
if (!s->current_picture_ptr && h->nal_unit_type == NAL_END_SEQUENCE) {
@@ -4190,147 +4211,59 @@ static int decode_frame(AVCodecContext *avctx,
goto out;
}
- if(!(s->flags2 & CODEC_FLAG2_CHUNKS) && !s->current_picture_ptr){
+ if (!(s->flags2 & CODEC_FLAG2_CHUNKS) && !s->current_picture_ptr) {
if (avctx->skip_frame >= AVDISCARD_NONREF)
return 0;
av_log(avctx, AV_LOG_ERROR, "no frame!\n");
return -1;
}
- if(!(s->flags2 & CODEC_FLAG2_CHUNKS) || (s->mb_y >= s->mb_height && s->mb_height)){
-
- if(s->flags2 & CODEC_FLAG2_CHUNKS) decode_postinit(h, 1);
+ if (!(s->flags2 & CODEC_FLAG2_CHUNKS) ||
+ (s->mb_y >= s->mb_height && s->mb_height)) {
+ if (s->flags2 & CODEC_FLAG2_CHUNKS)
+ decode_postinit(h, 1);
field_end(h, 0);
+ h->context_reinitialized = 0;
if (!h->next_output_pic) {
/* Wait for second field. */
- *data_size = 0;
-
+ *got_frame = 0;
} else {
- *data_size = sizeof(AVFrame);
- *pict = *(AVFrame*)h->next_output_pic;
+ *got_frame = 1;
+ *pict = h->next_output_pic->f;
}
}
- assert(pict->data[0] || !*data_size);
+ assert(pict->data[0] || !*got_frame);
ff_print_debug_info(s, pict);
-//printf("out %d\n", (int)pict->data[0]);
return get_consumed_bytes(s, buf_index, buf_size);
}
-#if 0
-static inline void fill_mb_avail(H264Context *h){
- MpegEncContext * const s = &h->s;
- const int mb_xy= s->mb_x + s->mb_y*s->mb_stride;
-
- if(s->mb_y){
- h->mb_avail[0]= s->mb_x && h->slice_table[mb_xy - s->mb_stride - 1] == h->slice_num;
- h->mb_avail[1]= h->slice_table[mb_xy - s->mb_stride ] == h->slice_num;
- h->mb_avail[2]= s->mb_x+1 < s->mb_width && h->slice_table[mb_xy - s->mb_stride + 1] == h->slice_num;
- }else{
- h->mb_avail[0]=
- h->mb_avail[1]=
- h->mb_avail[2]= 0;
- }
- h->mb_avail[3]= s->mb_x && h->slice_table[mb_xy - 1] == h->slice_num;
- h->mb_avail[4]= 1; //FIXME move out
- h->mb_avail[5]= 0; //FIXME move out
-}
-#endif
-
-#ifdef TEST
-#undef printf
-#undef random
-#define COUNT 8000
-#define SIZE (COUNT*40)
-int main(void){
- int i;
- uint8_t temp[SIZE];
- PutBitContext pb;
- GetBitContext gb;
- DSPContext dsp;
- AVCodecContext avctx;
-
- avctx.av_class = avcodec_get_class();
- dsputil_init(&dsp, &avctx);
-
- init_put_bits(&pb, temp, SIZE);
- printf("testing unsigned exp golomb\n");
- for(i=0; i<COUNT; i++){
- START_TIMER
- set_ue_golomb(&pb, i);
- STOP_TIMER("set_ue_golomb");
- }
- flush_put_bits(&pb);
-
- init_get_bits(&gb, temp, 8*SIZE);
- for(i=0; i<COUNT; i++){
- int j, s = show_bits(&gb, 24);
-
- START_TIMER
- j= get_ue_golomb(&gb);
- if(j != i){
- printf("mismatch! at %d (%d should be %d) bits:%6X\n", i, j, i, s);
-// return -1;
- }
- STOP_TIMER("get_ue_golomb");
- }
-
-
- init_put_bits(&pb, temp, SIZE);
- printf("testing signed exp golomb\n");
- for(i=0; i<COUNT; i++){
- START_TIMER
- set_se_golomb(&pb, i - COUNT/2);
- STOP_TIMER("set_se_golomb");
- }
- flush_put_bits(&pb);
-
- init_get_bits(&gb, temp, 8*SIZE);
- for(i=0; i<COUNT; i++){
- int j, s = show_bits(&gb, 24);
-
- START_TIMER
- j= get_se_golomb(&gb);
- if(j != i - COUNT/2){
- printf("mismatch! at %d (%d should be %d) bits:%6X\n", i, j, i, s);
-// return -1;
- }
- STOP_TIMER("get_se_golomb");
- }
-
- printf("Testing RBSP\n");
-
-
- return 0;
-}
-#endif /* TEST */
-
av_cold void ff_h264_free_context(H264Context *h)
{
int i;
- free_tables(h, 1); //FIXME cleanup init stuff perhaps
+ free_tables(h, 1); // FIXME cleanup init stuff perhaps
- for(i = 0; i < MAX_SPS_COUNT; i++)
+ for (i = 0; i < MAX_SPS_COUNT; i++)
av_freep(h->sps_buffers + i);
- for(i = 0; i < MAX_PPS_COUNT; i++)
+ for (i = 0; i < MAX_PPS_COUNT; i++)
av_freep(h->pps_buffers + i);
}
-av_cold int ff_h264_decode_end(AVCodecContext *avctx)
+static av_cold int h264_decode_end(AVCodecContext *avctx)
{
- H264Context *h = avctx->priv_data;
+ H264Context *h = avctx->priv_data;
MpegEncContext *s = &h->s;
ff_h264_free_context(h);
- MPV_common_end(s);
+ ff_MPV_common_end(s);
-// memset(h, 0, sizeof(H264Context));
+ // memset(h, 0, sizeof(H264Context));
return 0;
}
@@ -4353,35 +4286,37 @@ static const AVProfile profiles[] = {
};
AVCodec ff_h264_decoder = {
- .name = "h264",
- .type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_H264,
- .priv_data_size = sizeof(H264Context),
- .init = ff_h264_decode_init,
- .close = ff_h264_decode_end,
- .decode = decode_frame,
- .capabilities = /*CODEC_CAP_DRAW_HORIZ_BAND |*/ CODEC_CAP_DR1 | CODEC_CAP_DELAY |
- CODEC_CAP_SLICE_THREADS | CODEC_CAP_FRAME_THREADS,
- .flush= flush_dpb,
- .long_name = NULL_IF_CONFIG_SMALL("H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10"),
+ .name = "h264",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .id = AV_CODEC_ID_H264,
+ .priv_data_size = sizeof(H264Context),
+ .init = ff_h264_decode_init,
+ .close = h264_decode_end,
+ .decode = decode_frame,
+ .capabilities = /*CODEC_CAP_DRAW_HORIZ_BAND |*/ CODEC_CAP_DR1 |
+ CODEC_CAP_DELAY | CODEC_CAP_SLICE_THREADS |
+ CODEC_CAP_FRAME_THREADS,
+ .flush = flush_dpb,
+ .long_name = NULL_IF_CONFIG_SMALL("H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10"),
.init_thread_copy = ONLY_IF_THREADS_ENABLED(decode_init_thread_copy),
.update_thread_context = ONLY_IF_THREADS_ENABLED(decode_update_thread_context),
- .profiles = NULL_IF_CONFIG_SMALL(profiles),
+ .profiles = NULL_IF_CONFIG_SMALL(profiles),
};
#if CONFIG_H264_VDPAU_DECODER
AVCodec ff_h264_vdpau_decoder = {
.name = "h264_vdpau",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_H264,
+ .id = AV_CODEC_ID_H264,
.priv_data_size = sizeof(H264Context),
.init = ff_h264_decode_init,
- .close = ff_h264_decode_end,
+ .close = h264_decode_end,
.decode = decode_frame,
.capabilities = CODEC_CAP_DR1 | CODEC_CAP_DELAY | CODEC_CAP_HWACCEL_VDPAU,
- .flush= flush_dpb,
- .long_name = NULL_IF_CONFIG_SMALL("H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 (VDPAU acceleration)"),
- .pix_fmts = (const enum PixelFormat[]){PIX_FMT_VDPAU_H264, PIX_FMT_NONE},
- .profiles = NULL_IF_CONFIG_SMALL(profiles),
+ .flush = flush_dpb,
+ .long_name = NULL_IF_CONFIG_SMALL("H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 (VDPAU acceleration)"),
+ .pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_VDPAU_H264,
+ AV_PIX_FMT_NONE},
+ .profiles = NULL_IF_CONFIG_SMALL(profiles),
};
#endif
diff --git a/gst-libs/ext/libav/libavcodec/h264.h b/gst-libs/ext/libav/libavcodec/h264.h
index 8680f5f..898ebf7 100644
--- a/gst-libs/ext/libav/libavcodec/h264.h
+++ b/gst-libs/ext/libav/libavcodec/h264.h
@@ -37,14 +37,14 @@
#include "rectangle.h"
#define interlaced_dct interlaced_dct_is_a_bad_name
-#define mb_intra mb_intra_is_not_initialized_see_mb_type
+#define mb_intra mb_intra_is_not_initialized_see_mb_type
-#define MAX_SPS_COUNT 32
-#define MAX_PPS_COUNT 256
+#define MAX_SPS_COUNT 32
+#define MAX_PPS_COUNT 256
-#define MAX_MMCO_COUNT 66
+#define MAX_MMCO_COUNT 66
-#define MAX_DELAYED_PIC_COUNT 16
+#define MAX_DELAYED_PIC_COUNT 16
/* Compiling in interlaced support reduces the speed
* of progressive decoding by about 2%. */
@@ -59,25 +59,25 @@
#define MAX_SLICES 16
#ifdef ALLOW_INTERLACE
-#define MB_MBAFF h->mb_mbaff
-#define MB_FIELD h->mb_field_decoding_flag
+#define MB_MBAFF h->mb_mbaff
+#define MB_FIELD h->mb_field_decoding_flag
#define FRAME_MBAFF h->mb_aff_frame
#define FIELD_PICTURE (s->picture_structure != PICT_FRAME)
#define LEFT_MBS 2
-#define LTOP 0
-#define LBOT 1
-#define LEFT(i) (i)
+#define LTOP 0
+#define LBOT 1
+#define LEFT(i) (i)
#else
-#define MB_MBAFF 0
-#define MB_FIELD 0
-#define FRAME_MBAFF 0
+#define MB_MBAFF 0
+#define MB_FIELD 0
+#define FRAME_MBAFF 0
#define FIELD_PICTURE 0
#undef IS_INTERLACED
#define IS_INTERLACED(mb_type) 0
#define LEFT_MBS 1
-#define LTOP 0
-#define LBOT 0
-#define LEFT(i) 0
+#define LTOP 0
+#define LBOT 0
+#define LEFT(i) 0
#endif
#define FIELD_OR_MBAFF_PICTURE (FRAME_MBAFF || FIELD_PICTURE)
@@ -88,24 +88,18 @@
#define CHROMA422 (h->sps.chroma_format_idc == 2)
#define CHROMA444 (h->sps.chroma_format_idc == 3)
-#define EXTENDED_SAR 255
+#define EXTENDED_SAR 255
-#define MB_TYPE_REF0 MB_TYPE_ACPRED //dirty but it fits in 16 bit
+#define MB_TYPE_REF0 MB_TYPE_ACPRED // dirty but it fits in 16 bit
#define MB_TYPE_8x8DCT 0x01000000
#define IS_REF0(a) ((a) & MB_TYPE_REF0)
#define IS_8x8DCT(a) ((a) & MB_TYPE_8x8DCT)
-/**
- * Value of Picture.reference when Picture is not a reference picture, but
- * is held for delayed output.
- */
-#define DELAYED_PIC_REF 4
-
-#define QP_MAX_NUM (51 + 2*6) // The maximum supported qp
+#define QP_MAX_NUM (51 + 2 * 6) // The maximum supported qp
/* NAL unit types */
enum {
- NAL_SLICE=1,
+ NAL_SLICE = 1,
NAL_DPA,
NAL_DPB,
NAL_DPC,
@@ -118,17 +112,18 @@ enum {
NAL_END_STREAM,
NAL_FILLER_DATA,
NAL_SPS_EXT,
- NAL_AUXILIARY_SLICE=19
+ NAL_AUXILIARY_SLICE = 19,
+ NAL_FF_IGNORE = 0xff0f001,
};
/**
* SEI message types
*/
typedef enum {
- SEI_BUFFERING_PERIOD = 0, ///< buffering period (H.264, D.1.1)
- SEI_TYPE_PIC_TIMING = 1, ///< picture timing
- SEI_TYPE_USER_DATA_UNREGISTERED = 5, ///< unregistered user data
- SEI_TYPE_RECOVERY_POINT = 6 ///< recovery point (frame # to decoder sync)
+ SEI_BUFFERING_PERIOD = 0, ///< buffering period (H.264, D.1.1)
+ SEI_TYPE_PIC_TIMING = 1, ///< picture timing
+ SEI_TYPE_USER_DATA_UNREGISTERED = 5, ///< unregistered user data
+ SEI_TYPE_RECOVERY_POINT = 6 ///< recovery point (frame # to decoder sync)
} SEI_Type;
/**
@@ -149,8 +144,7 @@ typedef enum {
/**
* Sequence parameter set
*/
-typedef struct SPS{
-
+typedef struct SPS {
int profile_idc;
int level_idc;
int chroma_format_idc;
@@ -167,9 +161,9 @@ typedef struct SPS{
int mb_width; ///< pic_width_in_mbs_minus1 + 1
int mb_height; ///< pic_height_in_map_units_minus1 + 1
int frame_mbs_only_flag;
- int mb_aff; ///<mb_adaptive_frame_field_flag
+ int mb_aff; ///< mb_adaptive_frame_field_flag
int direct_8x8_inference_flag;
- int crop; ///< frame_cropping_flag
+ int crop; ///< frame_cropping_flag
unsigned int crop_left; ///< frame_cropping_rect_left_offset
unsigned int crop_right; ///< frame_cropping_rect_right_offset
unsigned int crop_top; ///< frame_cropping_rect_top_offset
@@ -186,7 +180,7 @@ typedef struct SPS{
uint32_t num_units_in_tick;
uint32_t time_scale;
int fixed_frame_rate_flag;
- short offset_for_ref_frame[256]; //FIXME dyn aloc?
+ short offset_for_ref_frame[256]; // FIXME dyn aloc?
int bitstream_restriction_flag;
int num_reorder_frames;
int scaling_matrix_present;
@@ -196,20 +190,21 @@ typedef struct SPS{
int vcl_hrd_parameters_present_flag;
int pic_struct_present_flag;
int time_offset_length;
- int cpb_cnt; ///< See H.264 E.1.2
- int initial_cpb_removal_delay_length; ///< initial_cpb_removal_delay_length_minus1 +1
- int cpb_removal_delay_length; ///< cpb_removal_delay_length_minus1 + 1
- int dpb_output_delay_length; ///< dpb_output_delay_length_minus1 + 1
- int bit_depth_luma; ///< bit_depth_luma_minus8 + 8
- int bit_depth_chroma; ///< bit_depth_chroma_minus8 + 8
- int residual_color_transform_flag; ///< residual_colour_transform_flag
- int constraint_set_flags; ///< constraint_set[0-3]_flag
-}SPS;
+ int cpb_cnt; ///< See H.264 E.1.2
+ int initial_cpb_removal_delay_length; ///< initial_cpb_removal_delay_length_minus1 + 1
+ int cpb_removal_delay_length; ///< cpb_removal_delay_length_minus1 + 1
+ int dpb_output_delay_length; ///< dpb_output_delay_length_minus1 + 1
+ int bit_depth_luma; ///< bit_depth_luma_minus8 + 8
+ int bit_depth_chroma; ///< bit_depth_chroma_minus8 + 8
+ int residual_color_transform_flag; ///< residual_colour_transform_flag
+ int constraint_set_flags; ///< constraint_set[0-3]_flag
+ int new; ///< flag to keep track if the decoder context needs re-init due to changed SPS
+} SPS;
/**
* Picture parameter set
*/
-typedef struct PPS{
+typedef struct PPS {
unsigned int sps_id;
int cabac; ///< entropy_coding_mode_flag
int pic_order_present; ///< pic_order_present_flag
@@ -222,20 +217,20 @@ typedef struct PPS{
int init_qs; ///< pic_init_qs_minus26 + 26
int chroma_qp_index_offset[2];
int deblocking_filter_parameters_present; ///< deblocking_filter_parameters_present_flag
- int constrained_intra_pred; ///< constrained_intra_pred_flag
- int redundant_pic_cnt_present; ///< redundant_pic_cnt_present_flag
- int transform_8x8_mode; ///< transform_8x8_mode_flag
+ int constrained_intra_pred; ///< constrained_intra_pred_flag
+ int redundant_pic_cnt_present; ///< redundant_pic_cnt_present_flag
+ int transform_8x8_mode; ///< transform_8x8_mode_flag
uint8_t scaling_matrix4[6][16];
uint8_t scaling_matrix8[6][64];
- uint8_t chroma_qp_table[2][64]; ///< pre-scaled (with chroma_qp_index_offset) version of qp_table
+ uint8_t chroma_qp_table[2][64]; ///< pre-scaled (with chroma_qp_index_offset) version of qp_table
int chroma_qp_diff;
-}PPS;
+} PPS;
/**
* Memory management control operation opcode.
*/
-typedef enum MMCOOpcode{
- MMCO_END=0,
+typedef enum MMCOOpcode {
+ MMCO_END = 0,
MMCO_SHORT2UNUSED,
MMCO_LONG2UNUSED,
MMCO_SHORT2LONG,
@@ -247,7 +242,7 @@ typedef enum MMCOOpcode{
/**
* Memory management control operation.
*/
-typedef struct MMCO{
+typedef struct MMCO {
MMCOOpcode opcode;
int short_pic_num; ///< pic_num without wrapping (pic_num & max_pic_num)
int long_arg; ///< index, pic_num, or num long refs depending on opcode
@@ -256,18 +251,18 @@ typedef struct MMCO{
/**
* H264Context
*/
-typedef struct H264Context{
+typedef struct H264Context {
MpegEncContext s;
H264DSPContext h264dsp;
int pixel_shift; ///< 0 for 8-bit H264, 1 for high-bit-depth H264
- int chroma_qp[2]; //QPc
+ int chroma_qp[2]; // QPc
int qp_thresh; ///< QP threshold to skip loopfilter
int prev_mb_skipped;
int next_mb_skipped;
- //prediction stuff
+ // prediction stuff
int chroma_pred_mode;
int intra16x16_pred_mode;
@@ -281,32 +276,32 @@ typedef struct H264Context{
int topright_type;
int left_type[LEFT_MBS];
- const uint8_t * left_block;
+ const uint8_t *left_block;
int topleft_partition;
- int8_t intra4x4_pred_mode_cache[5*8];
- int8_t (*intra4x4_pred_mode);
+ int8_t intra4x4_pred_mode_cache[5 * 8];
+ int8_t(*intra4x4_pred_mode);
H264PredContext hpc;
unsigned int topleft_samples_available;
unsigned int top_samples_available;
unsigned int topright_samples_available;
unsigned int left_samples_available;
- uint8_t (*top_borders[2])[(16*3)*2];
+ uint8_t (*top_borders[2])[(16 * 3) * 2];
/**
* non zero coeff count cache.
* is 64 if not available.
*/
- DECLARE_ALIGNED(8, uint8_t, non_zero_count_cache)[15*8];
+ DECLARE_ALIGNED(8, uint8_t, non_zero_count_cache)[15 * 8];
uint8_t (*non_zero_count)[48];
/**
* Motion vector cache.
*/
- DECLARE_ALIGNED(16, int16_t, mv_cache)[2][5*8][2];
- DECLARE_ALIGNED(8, int8_t, ref_cache)[2][5*8];
-#define LIST_NOT_USED -1 //FIXME rename?
+ DECLARE_ALIGNED(16, int16_t, mv_cache)[2][5 * 8][2];
+ DECLARE_ALIGNED(8, int8_t, ref_cache)[2][5 * 8];
+#define LIST_NOT_USED -1 // FIXME rename?
#define PART_NOT_AVAILABLE -2
/**
@@ -318,49 +313,50 @@ typedef struct H264Context{
* block_offset[ 0..23] for frame macroblocks
* block_offset[24..47] for field macroblocks
*/
- int block_offset[2*(16*3)];
+ int block_offset[2 * (16 * 3)];
- uint32_t *mb2b_xy; //FIXME are these 4 a good idea?
+ uint32_t *mb2b_xy; // FIXME are these 4 a good idea?
uint32_t *mb2br_xy;
- int b_stride; //FIXME use s->b4_stride
+ int b_stride; // FIXME use s->b4_stride
- int mb_linesize; ///< may be equal to s->linesize or s->linesize*2, for mbaff
+ int mb_linesize; ///< may be equal to s->linesize or s->linesize * 2, for mbaff
int mb_uvlinesize;
int emu_edge_width;
int emu_edge_height;
+ unsigned current_sps_id; ///< id of the current SPS
SPS sps; ///< current sps
/**
* current pps
*/
- PPS pps; //FIXME move to Picture perhaps? (->no) do we need that?
+ PPS pps; // FIXME move to Picture perhaps? (->no) do we need that?
- uint32_t dequant4_buffer[6][QP_MAX_NUM+1][16]; //FIXME should these be moved down?
- uint32_t dequant8_buffer[6][QP_MAX_NUM+1][64];
- uint32_t (*dequant4_coeff[6])[16];
- uint32_t (*dequant8_coeff[6])[64];
+ uint32_t dequant4_buffer[6][QP_MAX_NUM + 1][16]; // FIXME should these be moved down?
+ uint32_t dequant8_buffer[6][QP_MAX_NUM + 1][64];
+ uint32_t(*dequant4_coeff[6])[16];
+ uint32_t(*dequant8_coeff[6])[64];
int slice_num;
- uint16_t *slice_table; ///< slice_table_base + 2*mb_stride + 1
+ uint16_t *slice_table; ///< slice_table_base + 2*mb_stride + 1
int slice_type;
- int slice_type_nos; ///< S free slice type (SI/SP are remapped to I/P)
+ int slice_type_nos; ///< S free slice type (SI/SP are remapped to I/P)
int slice_type_fixed;
- //interlacing specific flags
+ // interlacing specific flags
int mb_aff_frame;
int mb_field_decoding_flag;
- int mb_mbaff; ///< mb_aff_frame && mb_field_decoding_flag
+ int mb_mbaff; ///< mb_aff_frame && mb_field_decoding_flag
DECLARE_ALIGNED(8, uint16_t, sub_mb_type)[4];
- //Weighted pred stuff
+ // Weighted pred stuff
int use_weight;
int use_weight_chroma;
int luma_log2_weight_denom;
int chroma_log2_weight_denom;
- //The following 2 can be changed to int8_t but that causes 10cpu cycles speedloss
+ // The following 2 can be changed to int8_t but that causes 10cpu cycles speedloss
int luma_weight[48][2][2];
int chroma_weight[48][2][2][2];
int implicit_weight[48][48][2];
@@ -368,50 +364,50 @@ typedef struct H264Context{
int direct_spatial_mv_pred;
int col_parity;
int col_fieldoff;
- int dist_scale_factor[16];
+ int dist_scale_factor[32];
int dist_scale_factor_field[2][32];
- int map_col_to_list0[2][16+32];
- int map_col_to_list0_field[2][2][16+32];
+ int map_col_to_list0[2][16 + 32];
+ int map_col_to_list0_field[2][2][16 + 32];
/**
* num_ref_idx_l0/1_active_minus1 + 1
*/
- unsigned int ref_count[2]; ///< counts frames or fields, depending on current mb mode
+ unsigned int ref_count[2]; ///< counts frames or fields, depending on current mb mode
unsigned int list_count;
- uint8_t *list_counts; ///< Array of list_count per MB specifying the slice type
- Picture ref_list[2][48]; /**< 0..15: frame refs, 16..47: mbaff field refs.
- Reordered version of default_ref_list
- according to picture reordering in slice header */
- int ref2frm[MAX_SLICES][2][64]; ///< reference to frame number lists, used in the loop filter, the first 2 are for -2,-1
+ uint8_t *list_counts; ///< Array of list_count per MB specifying the slice type
+ Picture ref_list[2][48]; /**< 0..15: frame refs, 16..47: mbaff field refs.
+ * Reordered version of default_ref_list
+ * according to picture reordering in slice header */
+ int ref2frm[MAX_SLICES][2][64]; ///< reference to frame number lists, used in the loop filter, the first 2 are for -2,-1
- //data partitioning
+ // data partitioning
GetBitContext intra_gb;
GetBitContext inter_gb;
GetBitContext *intra_gb_ptr;
GetBitContext *inter_gb_ptr;
- DECLARE_ALIGNED(16, DCTELEM, mb)[16*48*2]; ///< as a dct coeffecient is int32_t in high depth, we need to reserve twice the space.
- DECLARE_ALIGNED(16, DCTELEM, mb_luma_dc)[3][16*2];
- DCTELEM mb_padding[256*2]; ///< as mb is addressed by scantable[i] and scantable is uint8_t we can either check that i is not too large or ensure that there is some unused stuff after mb
+ DECLARE_ALIGNED(16, DCTELEM, mb)[16 * 48 * 2]; ///< as a dct coeffecient is int32_t in high depth, we need to reserve twice the space.
+ DECLARE_ALIGNED(16, DCTELEM, mb_luma_dc)[3][16 * 2];
+ DCTELEM mb_padding[256 * 2]; ///< as mb is addressed by scantable[i] and scantable is uint8_t we can either check that i is not too large or ensure that there is some unused stuff after mb
/**
* Cabac
*/
CABACContext cabac;
- uint8_t cabac_state[1024];
+ uint8_t cabac_state[1024];
- /* 0x100 -> non null luma_dc, 0x80/0x40 -> non null chroma_dc (cb/cr), 0x?0 -> chroma_cbp(0,1,2), 0x0? luma_cbp */
- uint16_t *cbp_table;
+ /* 0x100 -> non null luma_dc, 0x80/0x40 -> non null chroma_dc (cb/cr), 0x?0 -> chroma_cbp(0, 1, 2), 0x0? luma_cbp */
+ uint16_t *cbp_table;
int cbp;
int top_cbp;
int left_cbp;
/* chroma_pred_mode for i4x4 or i16x16, else 0 */
- uint8_t *chroma_pred_mode_table;
- int last_qscale_diff;
- uint8_t (*mvd_table[2])[2];
- DECLARE_ALIGNED(16, uint8_t, mvd_cache)[2][5*8][2];
- uint8_t *direct_table;
- uint8_t direct_cache[5*8];
+ uint8_t *chroma_pred_mode_table;
+ int last_qscale_diff;
+ uint8_t (*mvd_table[2])[2];
+ DECLARE_ALIGNED(16, uint8_t, mvd_cache)[2][5 * 8][2];
+ uint8_t *direct_table;
+ uint8_t direct_cache[5 * 8];
uint8_t zigzag_scan[16];
uint8_t zigzag_scan8x8[64];
@@ -432,13 +428,13 @@ typedef struct H264Context{
int is_complex;
- //deblock
- int deblocking_filter; ///< disable_deblocking_filter_idc with 1<->0
+ // deblock
+ int deblocking_filter; ///< disable_deblocking_filter_idc with 1 <-> 0
int slice_alpha_c0_offset;
int slice_beta_offset;
-//=============================================================
- //Things below are not used in the MB or more inner code
+ // =============================================================
+ // Things below are not used in the MB or more inner code
int nal_ref_idc;
int nal_unit_type;
@@ -448,37 +444,38 @@ typedef struct H264Context{
/**
* Used to parse AVC variant of h264
*/
- int is_avc; ///< this flag is != 0 if codec is avc1
- int nal_length_size; ///< Number of bytes used for nal length (1, 2 or 4)
- int got_first; ///< this flag is != 0 if we've parsed a frame
+ int is_avc; ///< this flag is != 0 if codec is avc1
+ int nal_length_size; ///< Number of bytes used for nal length (1, 2 or 4)
+ int got_first; ///< this flag is != 0 if we've parsed a frame
+
+ int context_reinitialized;
SPS *sps_buffers[MAX_SPS_COUNT];
PPS *pps_buffers[MAX_PPS_COUNT];
- int dequant_coeff_pps; ///< reinit tables when pps changes
+ int dequant_coeff_pps; ///< reinit tables when pps changes
uint16_t *slice_table_base;
-
- //POC stuff
+ // POC stuff
int poc_lsb;
int poc_msb;
int delta_poc_bottom;
int delta_poc[2];
int frame_num;
- int prev_poc_msb; ///< poc_msb of the last reference pic for POC type 0
- int prev_poc_lsb; ///< poc_lsb of the last reference pic for POC type 0
- int frame_num_offset; ///< for POC type 2
- int prev_frame_num_offset; ///< for POC type 2
- int prev_frame_num; ///< frame_num of the last pic for POC type 1/2
+ int prev_poc_msb; ///< poc_msb of the last reference pic for POC type 0
+ int prev_poc_lsb; ///< poc_lsb of the last reference pic for POC type 0
+ int frame_num_offset; ///< for POC type 2
+ int prev_frame_num_offset; ///< for POC type 2
+ int prev_frame_num; ///< frame_num of the last pic for POC type 1/2
/**
- * frame_num for frames or 2*frame_num+1 for field pics.
+ * frame_num for frames or 2 * frame_num + 1 for field pics.
*/
int curr_pic_num;
/**
- * max_frame_num or 2*max_frame_num for field pics.
+ * max_frame_num or 2 * max_frame_num for field pics.
*/
int max_pic_num;
@@ -487,7 +484,7 @@ typedef struct H264Context{
Picture *short_ref[32];
Picture *long_ref[32];
Picture default_ref_list[2][32]; ///< base reference list for all slices of a coded picture
- Picture *delayed_pic[MAX_DELAYED_PIC_COUNT+2]; //FIXME size?
+ Picture *delayed_pic[MAX_DELAYED_PIC_COUNT + 2]; // FIXME size?
int last_pocs[MAX_DELAYED_PIC_COUNT];
Picture *next_output_pic;
int outputed_poc;
@@ -500,10 +497,10 @@ typedef struct H264Context{
int mmco_index;
int mmco_reset;
- int long_ref_count; ///< number of actual long term references
- int short_ref_count; ///< number of actual short term references
+ int long_ref_count; ///< number of actual long term references
+ int short_ref_count; ///< number of actual short term references
- int cabac_init_idc;
+ int cabac_init_idc;
/**
* @name Members for slice based multithreading
@@ -572,18 +569,19 @@ typedef struct H264Context{
*/
int sei_recovery_frame_cnt;
- int luma_weight_flag[2]; ///< 7.4.3.2 luma_weight_lX_flag
- int chroma_weight_flag[2]; ///< 7.4.3.2 chroma_weight_lX_flag
+ int luma_weight_flag[2]; ///< 7.4.3.2 luma_weight_lX_flag
+ int chroma_weight_flag[2]; ///< 7.4.3.2 chroma_weight_lX_flag
// Timestamp stuff
- int sei_buffering_period_present; ///< Buffering period SEI flag
- int initial_cpb_removal_delay[32]; ///< Initial timestamps for CPBs
+ int sei_buffering_period_present; ///< Buffering period SEI flag
+ int initial_cpb_removal_delay[32]; ///< Initial timestamps for CPBs
int cur_chroma_format_idc;
-}H264Context;
-
+ uint8_t *bipred_scratchpad;
+} H264Context;
-extern const uint8_t ff_h264_chroma_qp[3][QP_MAX_NUM+1]; ///< One chroma qp table for each supported bit depth (8, 9, 10).
+extern const uint8_t ff_h264_chroma_qp[3][QP_MAX_NUM + 1]; ///< One chroma qp table for each supported bit depth (8, 9, 10).
+extern const uint16_t ff_h264_mb_sizes[4];
/**
* Decode SEI
@@ -609,13 +607,16 @@ int ff_h264_decode_picture_parameter_set(H264Context *h, int bit_length);
* Decode a network abstraction layer unit.
* @param consumed is the number of bytes used as input
* @param length is the length of the array
- * @param dst_length is the number of decoded bytes FIXME here or a decode rbsp tailing?
+ * @param dst_length is the number of decoded bytes FIXME here
+ * or a decode rbsp tailing?
* @return decoded bytes, might be src+1 if no escapes
*/
-const uint8_t *ff_h264_decode_nal(H264Context *h, const uint8_t *src, int *dst_length, int *consumed, int length);
+const uint8_t *ff_h264_decode_nal(H264Context *h, const uint8_t *src,
+ int *dst_length, int *consumed, int length);
/**
- * Free any data that may have been allocated in the H264 context like SPS, PPS etc.
+ * Free any data that may have been allocated in the H264 context
+ * like SPS, PPS etc.
*/
av_cold void ff_h264_free_context(H264Context *h);
@@ -644,18 +645,20 @@ void ff_h264_remove_all_refs(H264Context *h);
*/
int ff_h264_execute_ref_pic_marking(H264Context *h, MMCO *mmco, int mmco_count);
-int ff_h264_decode_ref_pic_marking(H264Context *h, GetBitContext *gb);
-
-void ff_generate_sliding_window_mmcos(H264Context *h);
+int ff_h264_decode_ref_pic_marking(H264Context *h, GetBitContext *gb,
+ int first_slice);
+int ff_generate_sliding_window_mmcos(H264Context *h, int first_slice);
/**
- * Check if the top & left blocks are available if needed & change the dc mode so it only uses the available blocks.
+ * Check if the top & left blocks are available if needed & change the
+ * dc mode so it only uses the available blocks.
*/
int ff_h264_check_intra4x4_pred_mode(H264Context *h);
/**
- * Check if the top & left blocks are available if needed & change the dc mode so it only uses the available blocks.
+ * Check if the top & left blocks are available if needed & change the
+ * dc mode so it only uses the available blocks.
*/
int ff_h264_check_intra_pred_mode(H264Context *h, int mode, int is_chroma);
@@ -663,29 +666,32 @@ void ff_h264_hl_decode_mb(H264Context *h);
int ff_h264_frame_start(H264Context *h);
int ff_h264_decode_extradata(H264Context *h);
av_cold int ff_h264_decode_init(AVCodecContext *avctx);
-av_cold int ff_h264_decode_end(AVCodecContext *avctx);
av_cold void ff_h264_decode_init_vlc(void);
/**
* Decode a macroblock
- * @return 0 if OK, ER_AC_ERROR / ER_DC_ERROR / ER_MV_ERROR if an error is noticed
+ * @return 0 if OK, ER_AC_ERROR / ER_DC_ERROR / ER_MV_ERROR on error
*/
int ff_h264_decode_mb_cavlc(H264Context *h);
/**
* Decode a CABAC coded macroblock
- * @return 0 if OK, ER_AC_ERROR / ER_DC_ERROR / ER_MV_ERROR if an error is noticed
+ * @return 0 if OK, ER_AC_ERROR / ER_DC_ERROR / ER_MV_ERROR on error
*/
int ff_h264_decode_mb_cabac(H264Context *h);
void ff_h264_init_cabac_states(H264Context *h);
-void ff_h264_direct_dist_scale_factor(H264Context * const h);
-void ff_h264_direct_ref_list_init(H264Context * const h);
-void ff_h264_pred_direct_motion(H264Context * const h, int *mb_type);
+void ff_h264_direct_dist_scale_factor(H264Context *const h);
+void ff_h264_direct_ref_list_init(H264Context *const h);
+void ff_h264_pred_direct_motion(H264Context *const h, int *mb_type);
-void ff_h264_filter_mb_fast( H264Context *h, int mb_x, int mb_y, uint8_t *img_y, uint8_t *img_cb, uint8_t *img_cr, unsigned int linesize, unsigned int uvlinesize);
-void ff_h264_filter_mb( H264Context *h, int mb_x, int mb_y, uint8_t *img_y, uint8_t *img_cb, uint8_t *img_cr, unsigned int linesize, unsigned int uvlinesize);
+void ff_h264_filter_mb_fast(H264Context *h, int mb_x, int mb_y,
+ uint8_t *img_y, uint8_t *img_cb, uint8_t *img_cr,
+ unsigned int linesize, unsigned int uvlinesize);
+void ff_h264_filter_mb(H264Context *h, int mb_x, int mb_y,
+ uint8_t *img_y, uint8_t *img_cb, uint8_t *img_cr,
+ unsigned int linesize, unsigned int uvlinesize);
/**
* Reset SEI values at the beginning of the frame.
@@ -694,16 +700,15 @@ void ff_h264_filter_mb( H264Context *h, int mb_x, int mb_y, uint8_t *img_y, uint
*/
void ff_h264_reset_sei(H264Context *h);
-
/*
-o-o o-o
- / / /
-o-o o-o
- ,---'
-o-o o-o
- / / /
-o-o o-o
-*/
+ * o-o o-o
+ * / / /
+ * o-o o-o
+ * ,---'
+ * o-o o-o
+ * / / /
+ * o-o o-o
+ */
/* Scan8 organization:
* 0 1 2 3 4 5 6 7
@@ -728,156 +733,173 @@ o-o o-o
#define LUMA_DC_BLOCK_INDEX 48
#define CHROMA_DC_BLOCK_INDEX 49
-//This table must be here because scan8[constant] must be known at compiletime
-static const uint8_t scan8[16*3 + 3]={
- 4+ 1*8, 5+ 1*8, 4+ 2*8, 5+ 2*8,
- 6+ 1*8, 7+ 1*8, 6+ 2*8, 7+ 2*8,
- 4+ 3*8, 5+ 3*8, 4+ 4*8, 5+ 4*8,
- 6+ 3*8, 7+ 3*8, 6+ 4*8, 7+ 4*8,
- 4+ 6*8, 5+ 6*8, 4+ 7*8, 5+ 7*8,
- 6+ 6*8, 7+ 6*8, 6+ 7*8, 7+ 7*8,
- 4+ 8*8, 5+ 8*8, 4+ 9*8, 5+ 9*8,
- 6+ 8*8, 7+ 8*8, 6+ 9*8, 7+ 9*8,
- 4+11*8, 5+11*8, 4+12*8, 5+12*8,
- 6+11*8, 7+11*8, 6+12*8, 7+12*8,
- 4+13*8, 5+13*8, 4+14*8, 5+14*8,
- 6+13*8, 7+13*8, 6+14*8, 7+14*8,
- 0+ 0*8, 0+ 5*8, 0+10*8
+// This table must be here because scan8[constant] must be known at compiletime
+static const uint8_t scan8[16 * 3 + 3] = {
+ 4 + 1 * 8, 5 + 1 * 8, 4 + 2 * 8, 5 + 2 * 8,
+ 6 + 1 * 8, 7 + 1 * 8, 6 + 2 * 8, 7 + 2 * 8,
+ 4 + 3 * 8, 5 + 3 * 8, 4 + 4 * 8, 5 + 4 * 8,
+ 6 + 3 * 8, 7 + 3 * 8, 6 + 4 * 8, 7 + 4 * 8,
+ 4 + 6 * 8, 5 + 6 * 8, 4 + 7 * 8, 5 + 7 * 8,
+ 6 + 6 * 8, 7 + 6 * 8, 6 + 7 * 8, 7 + 7 * 8,
+ 4 + 8 * 8, 5 + 8 * 8, 4 + 9 * 8, 5 + 9 * 8,
+ 6 + 8 * 8, 7 + 8 * 8, 6 + 9 * 8, 7 + 9 * 8,
+ 4 + 11 * 8, 5 + 11 * 8, 4 + 12 * 8, 5 + 12 * 8,
+ 6 + 11 * 8, 7 + 11 * 8, 6 + 12 * 8, 7 + 12 * 8,
+ 4 + 13 * 8, 5 + 13 * 8, 4 + 14 * 8, 5 + 14 * 8,
+ 6 + 13 * 8, 7 + 13 * 8, 6 + 14 * 8, 7 + 14 * 8,
+ 0 + 0 * 8, 0 + 5 * 8, 0 + 10 * 8
};
-static av_always_inline uint32_t pack16to32(int a, int b){
+static av_always_inline uint32_t pack16to32(int a, int b)
+{
#if HAVE_BIGENDIAN
- return (b&0xFFFF) + (a<<16);
+ return (b & 0xFFFF) + (a << 16);
#else
- return (a&0xFFFF) + (b<<16);
+ return (a & 0xFFFF) + (b << 16);
#endif
}
-static av_always_inline uint16_t pack8to16(int a, int b){
+static av_always_inline uint16_t pack8to16(int a, int b)
+{
#if HAVE_BIGENDIAN
- return (b&0xFF) + (a<<8);
+ return (b & 0xFF) + (a << 8);
#else
- return (a&0xFF) + (b<<8);
+ return (a & 0xFF) + (b << 8);
#endif
}
/**
* Get the chroma qp.
*/
-static av_always_inline int get_chroma_qp(H264Context *h, int t, int qscale){
+static av_always_inline int get_chroma_qp(H264Context *h, int t, int qscale)
+{
return h->pps.chroma_qp_table[t][qscale];
}
/**
* Get the predicted intra4x4 prediction mode.
*/
-static av_always_inline int pred_intra_mode(H264Context *h, int n){
- const int index8= scan8[n];
- const int left= h->intra4x4_pred_mode_cache[index8 - 1];
- const int top = h->intra4x4_pred_mode_cache[index8 - 8];
- const int min= FFMIN(left, top);
+static av_always_inline int pred_intra_mode(H264Context *h, int n)
+{
+ const int index8 = scan8[n];
+ const int left = h->intra4x4_pred_mode_cache[index8 - 1];
+ const int top = h->intra4x4_pred_mode_cache[index8 - 8];
+ const int min = FFMIN(left, top);
- tprintf(h->s.avctx, "mode:%d %d min:%d\n", left ,top, min);
+ tprintf(h->s.avctx, "mode:%d %d min:%d\n", left, top, min);
- if(min<0) return DC_PRED;
- else return min;
+ if (min < 0)
+ return DC_PRED;
+ else
+ return min;
}
-static av_always_inline void write_back_intra_pred_mode(H264Context *h){
- int8_t *i4x4= h->intra4x4_pred_mode + h->mb2br_xy[h->mb_xy];
- int8_t *i4x4_cache= h->intra4x4_pred_mode_cache;
+static av_always_inline void write_back_intra_pred_mode(H264Context *h)
+{
+ int8_t *i4x4 = h->intra4x4_pred_mode + h->mb2br_xy[h->mb_xy];
+ int8_t *i4x4_cache = h->intra4x4_pred_mode_cache;
- AV_COPY32(i4x4, i4x4_cache + 4 + 8*4);
- i4x4[4]= i4x4_cache[7+8*3];
- i4x4[5]= i4x4_cache[7+8*2];
- i4x4[6]= i4x4_cache[7+8*1];
+ AV_COPY32(i4x4, i4x4_cache + 4 + 8 * 4);
+ i4x4[4] = i4x4_cache[7 + 8 * 3];
+ i4x4[5] = i4x4_cache[7 + 8 * 2];
+ i4x4[6] = i4x4_cache[7 + 8 * 1];
}
-static av_always_inline void write_back_non_zero_count(H264Context *h){
- const int mb_xy= h->mb_xy;
- uint8_t *nnz = h->non_zero_count[mb_xy];
+static av_always_inline void write_back_non_zero_count(H264Context *h)
+{
+ const int mb_xy = h->mb_xy;
+ uint8_t *nnz = h->non_zero_count[mb_xy];
uint8_t *nnz_cache = h->non_zero_count_cache;
- AV_COPY32(&nnz[ 0], &nnz_cache[4+8* 1]);
- AV_COPY32(&nnz[ 4], &nnz_cache[4+8* 2]);
- AV_COPY32(&nnz[ 8], &nnz_cache[4+8* 3]);
- AV_COPY32(&nnz[12], &nnz_cache[4+8* 4]);
- AV_COPY32(&nnz[16], &nnz_cache[4+8* 6]);
- AV_COPY32(&nnz[20], &nnz_cache[4+8* 7]);
- AV_COPY32(&nnz[32], &nnz_cache[4+8*11]);
- AV_COPY32(&nnz[36], &nnz_cache[4+8*12]);
-
- if(!h->s.chroma_y_shift){
- AV_COPY32(&nnz[24], &nnz_cache[4+8* 8]);
- AV_COPY32(&nnz[28], &nnz_cache[4+8* 9]);
- AV_COPY32(&nnz[40], &nnz_cache[4+8*13]);
- AV_COPY32(&nnz[44], &nnz_cache[4+8*14]);
+ AV_COPY32(&nnz[ 0], &nnz_cache[4 + 8 * 1]);
+ AV_COPY32(&nnz[ 4], &nnz_cache[4 + 8 * 2]);
+ AV_COPY32(&nnz[ 8], &nnz_cache[4 + 8 * 3]);
+ AV_COPY32(&nnz[12], &nnz_cache[4 + 8 * 4]);
+ AV_COPY32(&nnz[16], &nnz_cache[4 + 8 * 6]);
+ AV_COPY32(&nnz[20], &nnz_cache[4 + 8 * 7]);
+ AV_COPY32(&nnz[32], &nnz_cache[4 + 8 * 11]);
+ AV_COPY32(&nnz[36], &nnz_cache[4 + 8 * 12]);
+
+ if (!h->s.chroma_y_shift) {
+ AV_COPY32(&nnz[24], &nnz_cache[4 + 8 * 8]);
+ AV_COPY32(&nnz[28], &nnz_cache[4 + 8 * 9]);
+ AV_COPY32(&nnz[40], &nnz_cache[4 + 8 * 13]);
+ AV_COPY32(&nnz[44], &nnz_cache[4 + 8 * 14]);
}
}
-static av_always_inline void write_back_motion_list(H264Context *h, MpegEncContext * const s, int b_stride,
- int b_xy, int b8_xy, int mb_type, int list )
+static av_always_inline void write_back_motion_list(H264Context *h,
+ MpegEncContext *const s,
+ int b_stride,
+ int b_xy, int b8_xy,
+ int mb_type, int list)
{
- int16_t (*mv_dst)[2] = &s->current_picture.f.motion_val[list][b_xy];
- int16_t (*mv_src)[2] = &h->mv_cache[list][scan8[0]];
- AV_COPY128(mv_dst + 0*b_stride, mv_src + 8*0);
- AV_COPY128(mv_dst + 1*b_stride, mv_src + 8*1);
- AV_COPY128(mv_dst + 2*b_stride, mv_src + 8*2);
- AV_COPY128(mv_dst + 3*b_stride, mv_src + 8*3);
- if( CABAC ) {
- uint8_t (*mvd_dst)[2] = &h->mvd_table[list][FMO ? 8*h->mb_xy : h->mb2br_xy[h->mb_xy]];
- uint8_t (*mvd_src)[2] = &h->mvd_cache[list][scan8[0]];
- if(IS_SKIP(mb_type))
+ int16_t(*mv_dst)[2] = &s->current_picture.f.motion_val[list][b_xy];
+ int16_t(*mv_src)[2] = &h->mv_cache[list][scan8[0]];
+ AV_COPY128(mv_dst + 0 * b_stride, mv_src + 8 * 0);
+ AV_COPY128(mv_dst + 1 * b_stride, mv_src + 8 * 1);
+ AV_COPY128(mv_dst + 2 * b_stride, mv_src + 8 * 2);
+ AV_COPY128(mv_dst + 3 * b_stride, mv_src + 8 * 3);
+ if (CABAC) {
+ uint8_t (*mvd_dst)[2] = &h->mvd_table[list][FMO ? 8 * h->mb_xy
+ : h->mb2br_xy[h->mb_xy]];
+ uint8_t(*mvd_src)[2] = &h->mvd_cache[list][scan8[0]];
+ if (IS_SKIP(mb_type)) {
AV_ZERO128(mvd_dst);
- else{
- AV_COPY64(mvd_dst, mvd_src + 8*3);
- AV_COPY16(mvd_dst + 3 + 3, mvd_src + 3 + 8*0);
- AV_COPY16(mvd_dst + 3 + 2, mvd_src + 3 + 8*1);
- AV_COPY16(mvd_dst + 3 + 1, mvd_src + 3 + 8*2);
+ } else {
+ AV_COPY64(mvd_dst, mvd_src + 8 * 3);
+ AV_COPY16(mvd_dst + 3 + 3, mvd_src + 3 + 8 * 0);
+ AV_COPY16(mvd_dst + 3 + 2, mvd_src + 3 + 8 * 1);
+ AV_COPY16(mvd_dst + 3 + 1, mvd_src + 3 + 8 * 2);
}
}
{
int8_t *ref_index = &s->current_picture.f.ref_index[list][b8_xy];
int8_t *ref_cache = h->ref_cache[list];
- ref_index[0+0*2]= ref_cache[scan8[0]];
- ref_index[1+0*2]= ref_cache[scan8[4]];
- ref_index[0+1*2]= ref_cache[scan8[8]];
- ref_index[1+1*2]= ref_cache[scan8[12]];
+ ref_index[0 + 0 * 2] = ref_cache[scan8[0]];
+ ref_index[1 + 0 * 2] = ref_cache[scan8[4]];
+ ref_index[0 + 1 * 2] = ref_cache[scan8[8]];
+ ref_index[1 + 1 * 2] = ref_cache[scan8[12]];
}
}
-static av_always_inline void write_back_motion(H264Context *h, int mb_type){
- MpegEncContext * const s = &h->s;
- const int b_stride = h->b_stride;
- const int b_xy = 4*s->mb_x + 4*s->mb_y*h->b_stride; //try mb2b(8)_xy
- const int b8_xy= 4*h->mb_xy;
+static av_always_inline void write_back_motion(H264Context *h, int mb_type)
+{
+ MpegEncContext *const s = &h->s;
+ const int b_stride = h->b_stride;
+ const int b_xy = 4 * s->mb_x + 4 * s->mb_y * h->b_stride; // try mb2b(8)_xy
+ const int b8_xy = 4 * h->mb_xy;
- if(USES_LIST(mb_type, 0)){
+ if (USES_LIST(mb_type, 0)) {
write_back_motion_list(h, s, b_stride, b_xy, b8_xy, mb_type, 0);
- }else{
+ } else {
fill_rectangle(&s->current_picture.f.ref_index[0][b8_xy],
2, 2, 2, (uint8_t)LIST_NOT_USED, 1);
}
- if(USES_LIST(mb_type, 1)){
+ if (USES_LIST(mb_type, 1))
write_back_motion_list(h, s, b_stride, b_xy, b8_xy, mb_type, 1);
- }
- if(h->slice_type_nos == AV_PICTURE_TYPE_B && CABAC){
- if(IS_8X8(mb_type)){
- uint8_t *direct_table = &h->direct_table[4*h->mb_xy];
- direct_table[1] = h->sub_mb_type[1]>>1;
- direct_table[2] = h->sub_mb_type[2]>>1;
- direct_table[3] = h->sub_mb_type[3]>>1;
+ if (h->slice_type_nos == AV_PICTURE_TYPE_B && CABAC) {
+ if (IS_8X8(mb_type)) {
+ uint8_t *direct_table = &h->direct_table[4 * h->mb_xy];
+ direct_table[1] = h->sub_mb_type[1] >> 1;
+ direct_table[2] = h->sub_mb_type[2] >> 1;
+ direct_table[3] = h->sub_mb_type[3] >> 1;
}
}
}
-static av_always_inline int get_dct8x8_allowed(H264Context *h){
- if(h->sps.direct_8x8_inference_flag)
- return !(AV_RN64A(h->sub_mb_type) & ((MB_TYPE_16x8|MB_TYPE_8x16|MB_TYPE_8x8 )*0x0001000100010001ULL));
+static av_always_inline int get_dct8x8_allowed(H264Context *h)
+{
+ if (h->sps.direct_8x8_inference_flag)
+ return !(AV_RN64A(h->sub_mb_type) &
+ ((MB_TYPE_16x8 | MB_TYPE_8x16 | MB_TYPE_8x8) *
+ 0x0001000100010001ULL));
else
- return !(AV_RN64A(h->sub_mb_type) & ((MB_TYPE_16x8|MB_TYPE_8x16|MB_TYPE_8x8|MB_TYPE_DIRECT2)*0x0001000100010001ULL));
+ return !(AV_RN64A(h->sub_mb_type) &
+ ((MB_TYPE_16x8 | MB_TYPE_8x16 | MB_TYPE_8x8 | MB_TYPE_DIRECT2) *
+ 0x0001000100010001ULL));
}
#endif /* AVCODEC_H264_H */
diff --git a/gst-libs/ext/libav/libavcodec/h264_cabac.c b/gst-libs/ext/libav/libavcodec/h264_cabac.c
index 2ee4bc0..92c1c03 100644
--- a/gst-libs/ext/libav/libavcodec/h264_cabac.c
+++ b/gst-libs/ext/libav/libavcodec/h264_cabac.c
@@ -1560,13 +1560,6 @@ static av_always_inline int get_cabac_cbf_ctx( H264Context *h, int cat, int idx,
return base_ctx[cat] + ctx;
}
-DECLARE_ASM_CONST(1, uint8_t, last_coeff_flag_offset_8x8)[63] = {
- 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4,
- 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8
-};
-
static av_always_inline void
decode_cabac_residual_internal(H264Context *h, DCTELEM *block,
int cat, int n, const uint8_t *scantable,
@@ -1630,6 +1623,7 @@ decode_cabac_residual_internal(H264Context *h, DCTELEM *block,
cc.range = h->cabac.range;
cc.low = h->cabac.low;
cc.bytestream= h->cabac.bytestream;
+ cc.bytestream_end = h->cabac.bytestream_end;
#else
#define CC &h->cabac
#endif
@@ -1658,18 +1652,18 @@ decode_cabac_residual_internal(H264Context *h, DCTELEM *block,
index[coeff_count++] = last;\
}
const uint8_t *sig_off = significant_coeff_flag_offset_8x8[MB_FIELD];
-#if ARCH_X86 && HAVE_7REGS && !defined(BROKEN_RELOCATIONS)
- coeff_count= decode_significance_8x8_x86(CC, significant_coeff_ctx_base, index,
+#ifdef decode_significance
+ coeff_count = decode_significance_8x8(CC, significant_coeff_ctx_base, index,
last_coeff_ctx_base, sig_off);
} else {
if (is_dc && chroma422) { // dc 422
DECODE_SIGNIFICANCE(7, sig_coeff_offset_dc[last], sig_coeff_offset_dc[last]);
} else {
- coeff_count= decode_significance_x86(CC, max_coeff, significant_coeff_ctx_base, index,
+ coeff_count = decode_significance(CC, max_coeff, significant_coeff_ctx_base, index,
last_coeff_ctx_base-significant_coeff_ctx_base);
}
#else
- DECODE_SIGNIFICANCE( 63, sig_off[last], last_coeff_flag_offset_8x8[last] );
+ DECODE_SIGNIFICANCE( 63, sig_off[last], ff_h264_last_coeff_flag_offset_8x8[last] );
} else {
if (is_dc && chroma422) { // dc 422
DECODE_SIGNIFICANCE(7, sig_coeff_offset_dc[last], sig_coeff_offset_dc[last]);
@@ -1821,7 +1815,6 @@ static av_always_inline void decode_cabac_luma_residual( H264Context *h, const u
MpegEncContext * const s = &h->s;
int qscale = p == 0 ? s->qscale : h->chroma_qp[p-1];
if( IS_INTRA16x16( mb_type ) ) {
- //av_log( s->avctx, AV_LOG_ERROR, "INTRA16x16 DC\n" );
AV_ZERO128(h->mb_luma_dc[p]+0);
AV_ZERO128(h->mb_luma_dc[p]+8);
AV_ZERO128(h->mb_luma_dc[p]+16);
@@ -1832,7 +1825,6 @@ static av_always_inline void decode_cabac_luma_residual( H264Context *h, const u
qmul = h->dequant4_coeff[p][qscale];
for( i4x4 = 0; i4x4 < 16; i4x4++ ) {
const int index = 16*p + i4x4;
- //av_log( s->avctx, AV_LOG_ERROR, "INTRA16x16 AC:%d\n", index );
decode_cabac_residual_nondc(h, h->mb + (16*index << pixel_shift), ctx_cat[1][p], index, scan + 1, qmul, 15);
}
} else {
@@ -1850,7 +1842,6 @@ static av_always_inline void decode_cabac_luma_residual( H264Context *h, const u
qmul = h->dequant4_coeff[cqm][qscale];
for( i4x4 = 0; i4x4 < 4; i4x4++ ) {
const int index = 16*p + 4*i8x8 + i4x4;
- //av_log( s->avctx, AV_LOG_ERROR, "Luma4x4: %d\n", index );
//START_TIMER
decode_cabac_residual_nondc(h, h->mb + (16*index << pixel_shift), ctx_cat[2][p], index, scan, qmul, 16);
//STOP_TIMER("decode_residual")
@@ -1982,8 +1973,8 @@ decode_intra_mb:
h->slice_table[ mb_xy ]= h->slice_num;
if(IS_INTRA_PCM(mb_type)) {
- static const uint16_t mb_sizes[4] = {256,384,512,768};
- const int mb_size = mb_sizes[h->sps.chroma_format_idc]*h->sps.bit_depth_luma >> 3;
+ const int mb_size = ff_h264_mb_sizes[h->sps.chroma_format_idc] *
+ h->sps.bit_depth_luma >> 3;
const uint8_t *ptr;
// We assume these blocks are very rare so we do not optimize it.
@@ -2014,11 +2005,6 @@ decode_intra_mb:
return 0;
}
- if(MB_MBAFF){
- h->ref_count[0] <<= 1;
- h->ref_count[1] <<= 1;
- }
-
fill_decode_caches(h, mb_type);
if( IS_INTRA( mb_type ) ) {
@@ -2036,7 +2022,8 @@ decode_intra_mb:
int pred = pred_intra_mode( h, i );
h->intra4x4_pred_mode_cache[ scan8[i] ] = decode_cabac_mb_intra4x4_pred_mode( h, pred );
- //av_log( s->avctx, AV_LOG_ERROR, "i4x4 pred=%d mode=%d\n", pred, h->intra4x4_pred_mode_cache[ scan8[i] ] );
+ av_dlog(s->avctx, "i4x4 pred=%d mode=%d\n", pred,
+ h->intra4x4_pred_mode_cache[scan8[i]]);
}
}
write_back_intra_pred_mode(h);
@@ -2086,10 +2073,11 @@ decode_intra_mb:
for( i = 0; i < 4; i++ ) {
if(IS_DIRECT(h->sub_mb_type[i])) continue;
if(IS_DIR(h->sub_mb_type[i], 0, list)){
- if( h->ref_count[list] > 1 ){
+ int rc = h->ref_count[list] << MB_MBAFF;
+ if (rc > 1) {
ref[list][i] = decode_cabac_mb_ref( h, list, 4*i );
- if(ref[list][i] >= (unsigned)h->ref_count[list]){
- av_log(s->avctx, AV_LOG_ERROR, "Reference %d >= %d\n", ref[list][i], h->ref_count[list]);
+ if (ref[list][i] >= (unsigned) rc) {
+ av_log(s->avctx, AV_LOG_ERROR, "Reference %d >= %d\n", ref[list][i], rc);
return -1;
}
}else
@@ -2171,11 +2159,11 @@ decode_intra_mb:
if(IS_16X16(mb_type)){
for(list=0; list<h->list_count; list++){
if(IS_DIR(mb_type, 0, list)){
- int ref;
- if(h->ref_count[list] > 1){
+ int ref, rc = h->ref_count[list] << MB_MBAFF;
+ if (rc > 1) {
ref= decode_cabac_mb_ref(h, list, 0);
- if(ref >= (unsigned)h->ref_count[list]){
- av_log(s->avctx, AV_LOG_ERROR, "Reference %d >= %d\n", ref, h->ref_count[list]);
+ if (ref >= (unsigned) rc) {
+ av_log(s->avctx, AV_LOG_ERROR, "Reference %d >= %d\n", ref, rc);
return -1;
}
}else
@@ -2199,11 +2187,11 @@ decode_intra_mb:
for(list=0; list<h->list_count; list++){
for(i=0; i<2; i++){
if(IS_DIR(mb_type, i, list)){
- int ref;
- if(h->ref_count[list] > 1){
+ int ref, rc = h->ref_count[list] << MB_MBAFF;
+ if (rc > 1) {
ref= decode_cabac_mb_ref( h, list, 8*i );
- if(ref >= (unsigned)h->ref_count[list]){
- av_log(s->avctx, AV_LOG_ERROR, "Reference %d >= %d\n", ref, h->ref_count[list]);
+ if (ref >= (unsigned) rc) {
+ av_log(s->avctx, AV_LOG_ERROR, "Reference %d >= %d\n", ref, rc);
return -1;
}
}else
@@ -2234,11 +2222,11 @@ decode_intra_mb:
for(list=0; list<h->list_count; list++){
for(i=0; i<2; i++){
if(IS_DIR(mb_type, i, list)){ //FIXME optimize
- int ref;
- if(h->ref_count[list] > 1){
+ int ref, rc = h->ref_count[list] << MB_MBAFF;
+ if (rc > 1) {
ref= decode_cabac_mb_ref( h, list, 4*i );
- if(ref >= (unsigned)h->ref_count[list]){
- av_log(s->avctx, AV_LOG_ERROR, "Reference %d >= %d\n", ref, h->ref_count[list]);
+ if (ref >= (unsigned) rc) {
+ av_log(s->avctx, AV_LOG_ERROR, "Reference %d >= %d\n", ref, rc);
return -1;
}
}else
@@ -2357,12 +2345,10 @@ decode_intra_mb:
} else if (CHROMA422) {
if( cbp&0x30 ){
int c;
- for( c = 0; c < 2; c++ ) {
- //av_log( s->avctx, AV_LOG_ERROR, "INTRA C%d-DC\n",c );
+ for (c = 0; c < 2; c++)
decode_cabac_residual_dc_422(h, h->mb + ((256 + 16*16*c) << pixel_shift), 3,
CHROMA_DC_BLOCK_INDEX + c,
chroma422_dc_scan, 8);
- }
}
if( cbp&0x20 ) {
@@ -2373,7 +2359,6 @@ decode_intra_mb:
for (i8x8 = 0; i8x8 < 2; i8x8++) {
for (i = 0; i < 4; i++) {
const int index = 16 + 16 * c + 8*i8x8 + i;
- //av_log(s->avctx, AV_LOG_ERROR, "INTRA C%d-AC %d\n",c, index - 16);
decode_cabac_residual_nondc(h, mb, 4, index, scan + 1, qmul, 15);
mb += 16<<pixel_shift;
}
@@ -2386,10 +2371,8 @@ decode_intra_mb:
} else /* yuv420 */ {
if( cbp&0x30 ){
int c;
- for( c = 0; c < 2; c++ ) {
- //av_log( s->avctx, AV_LOG_ERROR, "INTRA C%d-DC\n",c );
+ for (c = 0; c < 2; c++)
decode_cabac_residual_dc(h, h->mb + ((256 + 16*16*c) << pixel_shift), 3, CHROMA_DC_BLOCK_INDEX+c, chroma_dc_scan, 4);
- }
}
if( cbp&0x20 ) {
@@ -2398,7 +2381,6 @@ decode_intra_mb:
qmul = h->dequant4_coeff[c+1+(IS_INTRA( mb_type ) ? 0:3)][h->chroma_qp[c]];
for( i = 0; i < 4; i++ ) {
const int index = 16 + 16 * c + i;
- //av_log( s->avctx, AV_LOG_ERROR, "INTRA C%d-AC %d\n",c, index - 16 );
decode_cabac_residual_nondc(h, h->mb + (16*index << pixel_shift), 4, index, scan + 1, qmul, 15);
}
}
@@ -2417,10 +2399,5 @@ decode_intra_mb:
s->current_picture.f.qscale_table[mb_xy] = s->qscale;
write_back_non_zero_count(h);
- if(MB_MBAFF){
- h->ref_count[0] >>= 1;
- h->ref_count[1] >>= 1;
- }
-
return 0;
}
diff --git a/gst-libs/ext/libav/libavcodec/h264_cavlc.c b/gst-libs/ext/libav/libavcodec/h264_cavlc.c
index da9e1cb..0cc7214 100644
--- a/gst-libs/ext/libav/libavcodec/h264_cavlc.c
+++ b/gst-libs/ext/libav/libavcodec/h264_cavlc.c
@@ -566,13 +566,13 @@ static int decode_residual(H264Context *h, GetBitContext *gb, DCTELEM *block, in
else{
if (max_coeff <= 8) {
if (max_coeff == 4)
- zeros_left = get_vlc2(gb, (chroma_dc_total_zeros_vlc-1)[total_coeff].table,
+ zeros_left = get_vlc2(gb, chroma_dc_total_zeros_vlc[total_coeff - 1].table,
CHROMA_DC_TOTAL_ZEROS_VLC_BITS, 1);
else
- zeros_left = get_vlc2(gb, (chroma422_dc_total_zeros_vlc-1)[total_coeff].table,
+ zeros_left = get_vlc2(gb, chroma422_dc_total_zeros_vlc[total_coeff - 1].table,
CHROMA422_DC_TOTAL_ZEROS_VLC_BITS, 1);
} else {
- zeros_left= get_vlc2(gb, (total_zeros_vlc-1)[ total_coeff ].table, TOTAL_ZEROS_VLC_BITS, 1);
+ zeros_left= get_vlc2(gb, total_zeros_vlc[total_coeff - 1].table, TOTAL_ZEROS_VLC_BITS, 1);
}
}
@@ -582,7 +582,7 @@ static int decode_residual(H264Context *h, GetBitContext *gb, DCTELEM *block, in
((type*)block)[*scantable] = level[0]; \
for(i=1;i<total_coeff && zeros_left > 0;i++) { \
if(zeros_left < 7) \
- run_before= get_vlc2(gb, (run_vlc-1)[zeros_left].table, RUN_VLC_BITS, 1); \
+ run_before= get_vlc2(gb, run_vlc[zeros_left - 1].table, RUN_VLC_BITS, 1); \
else \
run_before= get_vlc2(gb, run7_vlc.table, RUN7_VLC_BITS, 2); \
zeros_left -= run_before; \
@@ -597,7 +597,7 @@ static int decode_residual(H264Context *h, GetBitContext *gb, DCTELEM *block, in
((type*)block)[*scantable] = ((int)(level[0] * qmul[*scantable] + 32))>>6; \
for(i=1;i<total_coeff && zeros_left > 0;i++) { \
if(zeros_left < 7) \
- run_before= get_vlc2(gb, (run_vlc-1)[zeros_left].table, RUN_VLC_BITS, 1); \
+ run_before= get_vlc2(gb, run_vlc[zeros_left - 1].table, RUN_VLC_BITS, 1); \
else \
run_before= get_vlc2(gb, run7_vlc.table, RUN7_VLC_BITS, 2); \
zeros_left -= run_before; \
@@ -610,17 +610,18 @@ static int decode_residual(H264Context *h, GetBitContext *gb, DCTELEM *block, in
} \
}
+ if (zeros_left < 0) {
+ av_log(h->s.avctx, AV_LOG_ERROR,
+ "negative number of zero coeffs at %d %d\n", s->mb_x, s->mb_y);
+ return AVERROR_INVALIDDATA;
+ }
+
if (h->pixel_shift) {
STORE_BLOCK(int32_t)
} else {
STORE_BLOCK(int16_t)
}
- if(zeros_left<0){
- av_log(h->s.avctx, AV_LOG_ERROR, "negative number of zero coeffs at %d %d\n", s->mb_x, s->mb_y);
- return -1;
- }
-
return 0;
}
@@ -764,8 +765,8 @@ decode_intra_mb:
if(IS_INTRA_PCM(mb_type)){
unsigned int x;
- static const uint16_t mb_sizes[4] = {256,384,512,768};
- const int mb_size = mb_sizes[h->sps.chroma_format_idc]*h->sps.bit_depth_luma >> 3;
+ const int mb_size = ff_h264_mb_sizes[h->sps.chroma_format_idc] *
+ h->sps.bit_depth_luma >> 3;
// We assume these blocks are very rare so we do not optimize it.
align_get_bits(&s->gb);
@@ -784,11 +785,6 @@ decode_intra_mb:
return 0;
}
- if(MB_MBAFF){
- h->ref_count[0] <<= 1;
- h->ref_count[1] <<= 1;
- }
-
fill_decode_neighbors(h, mb_type);
fill_decode_caches(h, mb_type);
@@ -868,7 +864,7 @@ decode_intra_mb:
}
for(list=0; list<h->list_count; list++){
- int ref_count= IS_REF0(mb_type) ? 1 : h->ref_count[list];
+ int ref_count = IS_REF0(mb_type) ? 1 : h->ref_count[list] << MB_MBAFF;
for(i=0; i<4; i++){
if(IS_DIRECT(h->sub_mb_type[i])) continue;
if(IS_DIR(h->sub_mb_type[i], 0, list)){
@@ -948,13 +944,14 @@ decode_intra_mb:
for(list=0; list<h->list_count; list++){
unsigned int val;
if(IS_DIR(mb_type, 0, list)){
- if(h->ref_count[list]==1){
+ int rc = h->ref_count[list] << MB_MBAFF;
+ if (rc == 1) {
val= 0;
- }else if(h->ref_count[list]==2){
+ } else if (rc == 2) {
val= get_bits1(&s->gb)^1;
}else{
val= get_ue_golomb_31(&s->gb);
- if(val >= h->ref_count[list]){
+ if (val >= rc) {
av_log(h->s.avctx, AV_LOG_ERROR, "ref %u overflow\n", val);
return -1;
}
@@ -978,13 +975,14 @@ decode_intra_mb:
for(i=0; i<2; i++){
unsigned int val;
if(IS_DIR(mb_type, i, list)){
- if(h->ref_count[list] == 1){
+ int rc = h->ref_count[list] << MB_MBAFF;
+ if (rc == 1) {
val= 0;
- }else if(h->ref_count[list] == 2){
+ } else if (rc == 2) {
val= get_bits1(&s->gb)^1;
}else{
val= get_ue_golomb_31(&s->gb);
- if(val >= h->ref_count[list]){
+ if (val >= rc) {
av_log(h->s.avctx, AV_LOG_ERROR, "ref %u overflow\n", val);
return -1;
}
@@ -1015,13 +1013,14 @@ decode_intra_mb:
for(i=0; i<2; i++){
unsigned int val;
if(IS_DIR(mb_type, i, list)){ //FIXME optimize
- if(h->ref_count[list]==1){
+ int rc = h->ref_count[list] << MB_MBAFF;
+ if (rc == 1) {
val= 0;
- }else if(h->ref_count[list]==2){
+ } else if (rc == 2) {
val= get_bits1(&s->gb)^1;
}else{
val= get_ue_golomb_31(&s->gb);
- if(val >= h->ref_count[list]){
+ if (val >= rc) {
av_log(h->s.avctx, AV_LOG_ERROR, "ref %u overflow\n", val);
return -1;
}
@@ -1180,11 +1179,5 @@ decode_intra_mb:
s->current_picture.f.qscale_table[mb_xy] = s->qscale;
write_back_non_zero_count(h);
- if(MB_MBAFF){
- h->ref_count[0] >>= 1;
- h->ref_count[1] >>= 1;
- }
-
return 0;
}
-
diff --git a/gst-libs/ext/libav/libavcodec/h264_direct.c b/gst-libs/ext/libav/libavcodec/h264_direct.c
index 4f70ff8..2306b97 100644
--- a/gst-libs/ext/libav/libavcodec/h264_direct.c
+++ b/gst-libs/ext/libav/libavcodec/h264_direct.c
@@ -54,14 +54,17 @@ void ff_h264_direct_dist_scale_factor(H264Context * const h){
const int poc = h->s.current_picture_ptr->field_poc[ s->picture_structure == PICT_BOTTOM_FIELD ];
const int poc1 = h->ref_list[1][0].poc;
int i, field;
- for(field=0; field<2; field++){
- const int poc = h->s.current_picture_ptr->field_poc[field];
- const int poc1 = h->ref_list[1][0].field_poc[field];
- for(i=0; i < 2*h->ref_count[0]; i++)
- h->dist_scale_factor_field[field][i^field] = get_scale_factor(h, poc, poc1, i+16);
- }
- for(i=0; i<h->ref_count[0]; i++){
+ if (FRAME_MBAFF)
+ for (field = 0; field < 2; field++){
+ const int poc = h->s.current_picture_ptr->field_poc[field];
+ const int poc1 = h->ref_list[1][0].field_poc[field];
+ for (i = 0; i < 2 * h->ref_count[0]; i++)
+ h->dist_scale_factor_field[field][i^field] =
+ get_scale_factor(h, poc, poc1, i+16);
+ }
+
+ for (i = 0; i < h->ref_count[0]; i++){
h->dist_scale_factor[i] = get_scale_factor(h, poc, poc1, i);
}
}
@@ -83,13 +86,14 @@ static void fill_colmap(H264Context *h, int map[2][16+32], int list, int field,
if (!interl)
poc |= 3;
- else if( interl && (poc&3) == 3) //FIXME store all MBAFF references so this isnt needed
+ else if( interl && (poc&3) == 3) // FIXME: store all MBAFF references so this is not needed
poc= (poc&~3) + rfield + 1;
for(j=start; j<end; j++){
if (4 * h->ref_list[0][j].frame_num + (h->ref_list[0][j].f.reference & 3) == poc) {
int cur_ref= mbafi ? (j-16)^field : j;
- map[list][2*old_ref + (rfield^field) + 16] = cur_ref;
+ if (ref1->mbaff)
+ map[list][2 * old_ref + (rfield^field) + 16] = cur_ref;
if(rfield == field || !interl)
map[list][old_ref] = cur_ref;
break;
@@ -130,7 +134,7 @@ void ff_h264_direct_ref_list_init(H264Context * const h){
h->col_fieldoff = 2 * h->ref_list[1][0].f.reference - 3;
}
- if (cur->f.pict_type != AV_PICTURE_TYPE_B || h->direct_spatial_mv_pred)
+ if (h->slice_type_nos != AV_PICTURE_TYPE_B || h->direct_spatial_mv_pred)
return;
for(list=0; list<2; list++){
@@ -153,7 +157,8 @@ static void await_reference_mb_row(H264Context * const h, Picture *ref, int mb_y
//FIXME it can be safe to access mb stuff
//even if pixels aren't deblocked yet
- ff_thread_await_progress((AVFrame*)ref, FFMIN(16*mb_y >> ref_field_picture, ref_height-1),
+ ff_thread_await_progress(&ref->f,
+ FFMIN(16 * mb_y >> ref_field_picture, ref_height - 1),
ref_field_picture && ref_field);
}
diff --git a/gst-libs/ext/libav/libavcodec/h264_loopfilter.c b/gst-libs/ext/libav/libavcodec/h264_loopfilter.c
index be750ca..b045d23 100644
--- a/gst-libs/ext/libav/libavcodec/h264_loopfilter.c
+++ b/gst-libs/ext/libav/libavcodec/h264_loopfilter.c
@@ -583,9 +583,7 @@ static av_always_inline void filter_mb_dir(H264Context *h, int mb_x, int mb_y, u
// value in IPCM macroblocks.
if(bS[0]+bS[1]+bS[2]+bS[3]){
qp = (s->current_picture.f.qscale_table[mb_xy] + s->current_picture.f.qscale_table[mbm_xy] + 1) >> 1;
- //tprintf(s->avctx, "filter mb:%d/%d dir:%d edge:%d, QPy:%d, QPc:%d, QPcn:%d\n", mb_x, mb_y, dir, edge, qp, h->chroma_qp[0], s->current_picture.qscale_table[mbn_xy]);
tprintf(s->avctx, "filter mb:%d/%d dir:%d edge:%d, QPy:%d ls:%d uvls:%d", mb_x, mb_y, dir, edge, qp, linesize, uvlinesize);
- //{ int i; for (i = 0; i < 4; i++) tprintf(s->avctx, " bS[%d]:%d", i, bS[i]); tprintf(s->avctx, "\n"); }
chroma_qp_avg[0] = (h->chroma_qp[0] + get_chroma_qp(h, 0, s->current_picture.f.qscale_table[mbm_xy]) + 1) >> 1;
chroma_qp_avg[1] = (h->chroma_qp[1] + get_chroma_qp(h, 1, s->current_picture.f.qscale_table[mbm_xy]) + 1) >> 1;
if( dir == 0 ) {
@@ -668,9 +666,7 @@ static av_always_inline void filter_mb_dir(H264Context *h, int mb_x, int mb_y, u
// Do not use s->qscale as luma quantizer because it has not the same
// value in IPCM macroblocks.
qp = s->current_picture.f.qscale_table[mb_xy];
- //tprintf(s->avctx, "filter mb:%d/%d dir:%d edge:%d, QPy:%d, QPc:%d, QPcn:%d\n", mb_x, mb_y, dir, edge, qp, h->chroma_qp[0], s->current_picture.qscale_table[mbn_xy]);
tprintf(s->avctx, "filter mb:%d/%d dir:%d edge:%d, QPy:%d ls:%d uvls:%d", mb_x, mb_y, dir, edge, qp, linesize, uvlinesize);
- //{ int i; for (i = 0; i < 4; i++) tprintf(s->avctx, " bS[%d]:%d", i, bS[i]); tprintf(s->avctx, "\n"); }
if( dir == 0 ) {
filter_mb_edgev( &img_y[4*edge << h->pixel_shift], linesize, bS, qp, a, b, h, 0 );
if (chroma) {
diff --git a/gst-libs/ext/libav/libavcodec/h264_mb_template.c b/gst-libs/ext/libav/libavcodec/h264_mb_template.c
new file mode 100644
index 0000000..e27fd13
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/h264_mb_template.c
@@ -0,0 +1,380 @@
+/*
+ * H.26L/H.264/AVC/JVT/14496-10/... decoder
+ * Copyright (c) 2003 Michael Niedermayer <michaelni@gmx.at>
+ *
+ * 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
+ */
+
+#undef FUNC
+#undef PIXEL_SHIFT
+
+#if SIMPLE
+# define FUNC(n) AV_JOIN(n ## _simple_, BITS)
+# define PIXEL_SHIFT (BITS >> 4)
+#else
+# define FUNC(n) n ## _complex
+# define PIXEL_SHIFT h->pixel_shift
+#endif
+
+#undef CHROMA_IDC
+#define CHROMA_IDC 1
+#include "h264_mc_template.c"
+
+#undef CHROMA_IDC
+#define CHROMA_IDC 2
+#include "h264_mc_template.c"
+
+static av_noinline void FUNC(hl_decode_mb)(H264Context *h)
+{
+ MpegEncContext *const s = &h->s;
+ const int mb_x = s->mb_x;
+ const int mb_y = s->mb_y;
+ const int mb_xy = h->mb_xy;
+ const int mb_type = s->current_picture.f.mb_type[mb_xy];
+ uint8_t *dest_y, *dest_cb, *dest_cr;
+ int linesize, uvlinesize /*dct_offset*/;
+ int i, j;
+ int *block_offset = &h->block_offset[0];
+ const int transform_bypass = !SIMPLE && (s->qscale == 0 && h->sps.transform_bypass);
+ /* is_h264 should always be true if SVQ3 is disabled. */
+ const int is_h264 = !CONFIG_SVQ3_DECODER || SIMPLE || s->codec_id == AV_CODEC_ID_H264;
+ void (*idct_add)(uint8_t *dst, DCTELEM *block, int stride);
+ const int block_h = 16 >> s->chroma_y_shift;
+ const int chroma422 = CHROMA422;
+
+ dest_y = s->current_picture.f.data[0] + ((mb_x << PIXEL_SHIFT) + mb_y * s->linesize) * 16;
+ dest_cb = s->current_picture.f.data[1] + (mb_x << PIXEL_SHIFT) * 8 + mb_y * s->uvlinesize * block_h;
+ dest_cr = s->current_picture.f.data[2] + (mb_x << PIXEL_SHIFT) * 8 + mb_y * s->uvlinesize * block_h;
+
+ s->vdsp.prefetch(dest_y + (s->mb_x & 3) * 4 * s->linesize + (64 << PIXEL_SHIFT), s->linesize, 4);
+ s->vdsp.prefetch(dest_cb + (s->mb_x & 7) * s->uvlinesize + (64 << PIXEL_SHIFT), dest_cr - dest_cb, 2);
+
+ h->list_counts[mb_xy] = h->list_count;
+
+ if (!SIMPLE && MB_FIELD) {
+ linesize = h->mb_linesize = s->linesize * 2;
+ uvlinesize = h->mb_uvlinesize = s->uvlinesize * 2;
+ block_offset = &h->block_offset[48];
+ if (mb_y & 1) { // FIXME move out of this function?
+ dest_y -= s->linesize * 15;
+ dest_cb -= s->uvlinesize * (block_h - 1);
+ dest_cr -= s->uvlinesize * (block_h - 1);
+ }
+ if (FRAME_MBAFF) {
+ int list;
+ for (list = 0; list < h->list_count; list++) {
+ if (!USES_LIST(mb_type, list))
+ continue;
+ if (IS_16X16(mb_type)) {
+ int8_t *ref = &h->ref_cache[list][scan8[0]];
+ fill_rectangle(ref, 4, 4, 8, (16 + *ref) ^ (s->mb_y & 1), 1);
+ } else {
+ for (i = 0; i < 16; i += 4) {
+ int ref = h->ref_cache[list][scan8[i]];
+ if (ref >= 0)
+ fill_rectangle(&h->ref_cache[list][scan8[i]], 2, 2,
+ 8, (16 + ref) ^ (s->mb_y & 1), 1);
+ }
+ }
+ }
+ }
+ } else {
+ linesize = h->mb_linesize = s->linesize;
+ uvlinesize = h->mb_uvlinesize = s->uvlinesize;
+ // dct_offset = s->linesize * 16;
+ }
+
+ if (!SIMPLE && IS_INTRA_PCM(mb_type)) {
+ if (PIXEL_SHIFT) {
+ const int bit_depth = h->sps.bit_depth_luma;
+ int j;
+ GetBitContext gb;
+ init_get_bits(&gb, (uint8_t *)h->mb,
+ ff_h264_mb_sizes[h->sps.chroma_format_idc] * bit_depth);
+
+ for (i = 0; i < 16; i++) {
+ uint16_t *tmp_y = (uint16_t *)(dest_y + i * linesize);
+ for (j = 0; j < 16; j++)
+ tmp_y[j] = get_bits(&gb, bit_depth);
+ }
+ if (SIMPLE || !CONFIG_GRAY || !(s->flags & CODEC_FLAG_GRAY)) {
+ if (!h->sps.chroma_format_idc) {
+ for (i = 0; i < block_h; i++) {
+ uint16_t *tmp_cb = (uint16_t *)(dest_cb + i * uvlinesize);
+ for (j = 0; j < 8; j++)
+ tmp_cb[j] = 1 << (bit_depth - 1);
+ }
+ for (i = 0; i < block_h; i++) {
+ uint16_t *tmp_cr = (uint16_t *)(dest_cr + i * uvlinesize);
+ for (j = 0; j < 8; j++)
+ tmp_cr[j] = 1 << (bit_depth - 1);
+ }
+ } else {
+ for (i = 0; i < block_h; i++) {
+ uint16_t *tmp_cb = (uint16_t *)(dest_cb + i * uvlinesize);
+ for (j = 0; j < 8; j++)
+ tmp_cb[j] = get_bits(&gb, bit_depth);
+ }
+ for (i = 0; i < block_h; i++) {
+ uint16_t *tmp_cr = (uint16_t *)(dest_cr + i * uvlinesize);
+ for (j = 0; j < 8; j++)
+ tmp_cr[j] = get_bits(&gb, bit_depth);
+ }
+ }
+ }
+ } else {
+ for (i = 0; i < 16; i++)
+ memcpy(dest_y + i * linesize, (uint8_t *)h->mb + i * 16, 16);
+ if (SIMPLE || !CONFIG_GRAY || !(s->flags & CODEC_FLAG_GRAY)) {
+ if (!h->sps.chroma_format_idc) {
+ for (i = 0; i < block_h; i++) {
+ memset(dest_cb + i * uvlinesize, 128, 8);
+ memset(dest_cr + i * uvlinesize, 128, 8);
+ }
+ } else {
+ uint8_t *src_cb = (uint8_t *)h->mb + 256;
+ uint8_t *src_cr = (uint8_t *)h->mb + 256 + block_h * 8;
+ for (i = 0; i < block_h; i++) {
+ memcpy(dest_cb + i * uvlinesize, src_cb + i * 8, 8);
+ memcpy(dest_cr + i * uvlinesize, src_cr + i * 8, 8);
+ }
+ }
+ }
+ }
+ } else {
+ if (IS_INTRA(mb_type)) {
+ if (h->deblocking_filter)
+ xchg_mb_border(h, dest_y, dest_cb, dest_cr, linesize,
+ uvlinesize, 1, 0, SIMPLE, PIXEL_SHIFT);
+
+ if (SIMPLE || !CONFIG_GRAY || !(s->flags & CODEC_FLAG_GRAY)) {
+ h->hpc.pred8x8[h->chroma_pred_mode](dest_cb, uvlinesize);
+ h->hpc.pred8x8[h->chroma_pred_mode](dest_cr, uvlinesize);
+ }
+
+ hl_decode_mb_predict_luma(h, mb_type, is_h264, SIMPLE,
+ transform_bypass, PIXEL_SHIFT,
+ block_offset, linesize, dest_y, 0);
+
+ if (h->deblocking_filter)
+ xchg_mb_border(h, dest_y, dest_cb, dest_cr, linesize,
+ uvlinesize, 0, 0, SIMPLE, PIXEL_SHIFT);
+ } else if (is_h264) {
+ if (chroma422) {
+ FUNC(hl_motion_422)(h, dest_y, dest_cb, dest_cr,
+ s->me.qpel_put, s->dsp.put_h264_chroma_pixels_tab,
+ s->me.qpel_avg, s->dsp.avg_h264_chroma_pixels_tab,
+ h->h264dsp.weight_h264_pixels_tab,
+ h->h264dsp.biweight_h264_pixels_tab);
+ } else {
+ FUNC(hl_motion_420)(h, dest_y, dest_cb, dest_cr,
+ s->me.qpel_put, s->dsp.put_h264_chroma_pixels_tab,
+ s->me.qpel_avg, s->dsp.avg_h264_chroma_pixels_tab,
+ h->h264dsp.weight_h264_pixels_tab,
+ h->h264dsp.biweight_h264_pixels_tab);
+ }
+ }
+
+ hl_decode_mb_idct_luma(h, mb_type, is_h264, SIMPLE, transform_bypass,
+ PIXEL_SHIFT, block_offset, linesize, dest_y, 0);
+
+ if ((SIMPLE || !CONFIG_GRAY || !(s->flags & CODEC_FLAG_GRAY)) &&
+ (h->cbp & 0x30)) {
+ uint8_t *dest[2] = { dest_cb, dest_cr };
+ if (transform_bypass) {
+ if (IS_INTRA(mb_type) && h->sps.profile_idc == 244 &&
+ (h->chroma_pred_mode == VERT_PRED8x8 ||
+ h->chroma_pred_mode == HOR_PRED8x8)) {
+ h->hpc.pred8x8_add[h->chroma_pred_mode](dest[0],
+ block_offset + 16,
+ h->mb + (16 * 16 * 1 << PIXEL_SHIFT),
+ uvlinesize);
+ h->hpc.pred8x8_add[h->chroma_pred_mode](dest[1],
+ block_offset + 32,
+ h->mb + (16 * 16 * 2 << PIXEL_SHIFT),
+ uvlinesize);
+ } else {
+ idct_add = s->dsp.add_pixels4;
+ for (j = 1; j < 3; j++) {
+ for (i = j * 16; i < j * 16 + 4; i++)
+ if (h->non_zero_count_cache[scan8[i]] ||
+ dctcoef_get(h->mb, PIXEL_SHIFT, i * 16))
+ idct_add(dest[j - 1] + block_offset[i],
+ h->mb + (i * 16 << PIXEL_SHIFT),
+ uvlinesize);
+ if (chroma422) {
+ for (i = j * 16 + 4; i < j * 16 + 8; i++)
+ if (h->non_zero_count_cache[scan8[i + 4]] ||
+ dctcoef_get(h->mb, PIXEL_SHIFT, i * 16))
+ idct_add(dest[j - 1] + block_offset[i + 4],
+ h->mb + (i * 16 << PIXEL_SHIFT),
+ uvlinesize);
+ }
+ }
+ }
+ } else {
+ if (is_h264) {
+ int qp[2];
+ if (chroma422) {
+ qp[0] = h->chroma_qp[0] + 3;
+ qp[1] = h->chroma_qp[1] + 3;
+ } else {
+ qp[0] = h->chroma_qp[0];
+ qp[1] = h->chroma_qp[1];
+ }
+ if (h->non_zero_count_cache[scan8[CHROMA_DC_BLOCK_INDEX + 0]])
+ h->h264dsp.h264_chroma_dc_dequant_idct(h->mb + (16 * 16 * 1 << PIXEL_SHIFT),
+ h->dequant4_coeff[IS_INTRA(mb_type) ? 1 : 4][qp[0]][0]);
+ if (h->non_zero_count_cache[scan8[CHROMA_DC_BLOCK_INDEX + 1]])
+ h->h264dsp.h264_chroma_dc_dequant_idct(h->mb + (16 * 16 * 2 << PIXEL_SHIFT),
+ h->dequant4_coeff[IS_INTRA(mb_type) ? 2 : 5][qp[1]][0]);
+ h->h264dsp.h264_idct_add8(dest, block_offset,
+ h->mb, uvlinesize,
+ h->non_zero_count_cache);
+ } else if (CONFIG_SVQ3_DECODER) {
+ h->h264dsp.h264_chroma_dc_dequant_idct(h->mb + 16 * 16 * 1,
+ h->dequant4_coeff[IS_INTRA(mb_type) ? 1 : 4][h->chroma_qp[0]][0]);
+ h->h264dsp.h264_chroma_dc_dequant_idct(h->mb + 16 * 16 * 2,
+ h->dequant4_coeff[IS_INTRA(mb_type) ? 2 : 5][h->chroma_qp[1]][0]);
+ for (j = 1; j < 3; j++) {
+ for (i = j * 16; i < j * 16 + 4; i++)
+ if (h->non_zero_count_cache[scan8[i]] || h->mb[i * 16]) {
+ uint8_t *const ptr = dest[j - 1] + block_offset[i];
+ ff_svq3_add_idct_c(ptr, h->mb + i * 16,
+ uvlinesize,
+ ff_h264_chroma_qp[0][s->qscale + 12] - 12, 2);
+ }
+ }
+ }
+ }
+ }
+ }
+ if (h->cbp || IS_INTRA(mb_type)) {
+ s->dsp.clear_blocks(h->mb);
+ s->dsp.clear_blocks(h->mb + (24 * 16 << PIXEL_SHIFT));
+ }
+}
+
+#if !SIMPLE || BITS == 8
+
+#undef CHROMA_IDC
+#define CHROMA_IDC 3
+#include "h264_mc_template.c"
+
+static av_noinline void FUNC(hl_decode_mb_444)(H264Context *h)
+{
+ MpegEncContext *const s = &h->s;
+ const int mb_x = s->mb_x;
+ const int mb_y = s->mb_y;
+ const int mb_xy = h->mb_xy;
+ const int mb_type = s->current_picture.f.mb_type[mb_xy];
+ uint8_t *dest[3];
+ int linesize;
+ int i, j, p;
+ int *block_offset = &h->block_offset[0];
+ const int transform_bypass = !SIMPLE && (s->qscale == 0 && h->sps.transform_bypass);
+ const int plane_count = (SIMPLE || !CONFIG_GRAY || !(s->flags & CODEC_FLAG_GRAY)) ? 3 : 1;
+
+ for (p = 0; p < plane_count; p++) {
+ dest[p] = s->current_picture.f.data[p] +
+ ((mb_x << PIXEL_SHIFT) + mb_y * s->linesize) * 16;
+ s->vdsp.prefetch(dest[p] + (s->mb_x & 3) * 4 * s->linesize + (64 << PIXEL_SHIFT),
+ s->linesize, 4);
+ }
+
+ h->list_counts[mb_xy] = h->list_count;
+
+ if (!SIMPLE && MB_FIELD) {
+ linesize = h->mb_linesize = h->mb_uvlinesize = s->linesize * 2;
+ block_offset = &h->block_offset[48];
+ if (mb_y & 1) // FIXME move out of this function?
+ for (p = 0; p < 3; p++)
+ dest[p] -= s->linesize * 15;
+ if (FRAME_MBAFF) {
+ int list;
+ for (list = 0; list < h->list_count; list++) {
+ if (!USES_LIST(mb_type, list))
+ continue;
+ if (IS_16X16(mb_type)) {
+ int8_t *ref = &h->ref_cache[list][scan8[0]];
+ fill_rectangle(ref, 4, 4, 8, (16 + *ref) ^ (s->mb_y & 1), 1);
+ } else {
+ for (i = 0; i < 16; i += 4) {
+ int ref = h->ref_cache[list][scan8[i]];
+ if (ref >= 0)
+ fill_rectangle(&h->ref_cache[list][scan8[i]], 2, 2,
+ 8, (16 + ref) ^ (s->mb_y & 1), 1);
+ }
+ }
+ }
+ }
+ } else {
+ linesize = h->mb_linesize = h->mb_uvlinesize = s->linesize;
+ }
+
+ if (!SIMPLE && IS_INTRA_PCM(mb_type)) {
+ if (PIXEL_SHIFT) {
+ const int bit_depth = h->sps.bit_depth_luma;
+ GetBitContext gb;
+ init_get_bits(&gb, (uint8_t *)h->mb, 768 * bit_depth);
+
+ for (p = 0; p < plane_count; p++)
+ for (i = 0; i < 16; i++) {
+ uint16_t *tmp = (uint16_t *)(dest[p] + i * linesize);
+ for (j = 0; j < 16; j++)
+ tmp[j] = get_bits(&gb, bit_depth);
+ }
+ } else {
+ for (p = 0; p < plane_count; p++)
+ for (i = 0; i < 16; i++)
+ memcpy(dest[p] + i * linesize,
+ (uint8_t *)h->mb + p * 256 + i * 16, 16);
+ }
+ } else {
+ if (IS_INTRA(mb_type)) {
+ if (h->deblocking_filter)
+ xchg_mb_border(h, dest[0], dest[1], dest[2], linesize,
+ linesize, 1, 1, SIMPLE, PIXEL_SHIFT);
+
+ for (p = 0; p < plane_count; p++)
+ hl_decode_mb_predict_luma(h, mb_type, 1, SIMPLE,
+ transform_bypass, PIXEL_SHIFT,
+ block_offset, linesize, dest[p], p);
+
+ if (h->deblocking_filter)
+ xchg_mb_border(h, dest[0], dest[1], dest[2], linesize,
+ linesize, 0, 1, SIMPLE, PIXEL_SHIFT);
+ } else {
+ FUNC(hl_motion_444)(h, dest[0], dest[1], dest[2],
+ s->me.qpel_put, s->dsp.put_h264_chroma_pixels_tab,
+ s->me.qpel_avg, s->dsp.avg_h264_chroma_pixels_tab,
+ h->h264dsp.weight_h264_pixels_tab,
+ h->h264dsp.biweight_h264_pixels_tab);
+ }
+
+ for (p = 0; p < plane_count; p++)
+ hl_decode_mb_idct_luma(h, mb_type, 1, SIMPLE, transform_bypass,
+ PIXEL_SHIFT, block_offset, linesize,
+ dest[p], p);
+ }
+ if (h->cbp || IS_INTRA(mb_type)) {
+ s->dsp.clear_blocks(h->mb);
+ s->dsp.clear_blocks(h->mb + (24 * 16 << PIXEL_SHIFT));
+ }
+}
+
+#endif
diff --git a/gst-libs/ext/libav/libavcodec/h264_mc_template.c b/gst-libs/ext/libav/libavcodec/h264_mc_template.c
new file mode 100644
index 0000000..a3af39b
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/h264_mc_template.c
@@ -0,0 +1,160 @@
+/*
+ * H.26L/H.264/AVC/JVT/14496-10/... decoder
+ * Copyright (c) 2003 Michael Niedermayer <michaelni@gmx.at>
+ *
+ * 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
+ */
+
+#undef MCFUNC
+
+#if CHROMA_IDC == 1
+# define MCFUNC(n) FUNC(n ## _420)
+#elif CHROMA_IDC == 2
+# define MCFUNC(n) FUNC(n ## _422)
+#elif CHROMA_IDC == 3
+# define MCFUNC(n) FUNC(n ## _444)
+#endif
+
+#undef mc_part
+#define mc_part MCFUNC(mc_part)
+
+static void mc_part(H264Context *h, int n, int square,
+ int height, int delta,
+ uint8_t *dest_y, uint8_t *dest_cb,
+ uint8_t *dest_cr,
+ int x_offset, int y_offset,
+ qpel_mc_func *qpix_put,
+ h264_chroma_mc_func chroma_put,
+ qpel_mc_func *qpix_avg,
+ h264_chroma_mc_func chroma_avg,
+ h264_weight_func *weight_op,
+ h264_biweight_func *weight_avg,
+ int list0, int list1)
+{
+ if ((h->use_weight == 2 && list0 && list1 &&
+ (h->implicit_weight[h->ref_cache[0][scan8[n]]][h->ref_cache[1][scan8[n]]][h->s.mb_y & 1] != 32)) ||
+ h->use_weight == 1)
+ mc_part_weighted(h, n, square, height, delta, dest_y, dest_cb, dest_cr,
+ x_offset, y_offset, qpix_put, chroma_put,
+ weight_op[0], weight_op[1], weight_avg[0],
+ weight_avg[1], list0, list1, PIXEL_SHIFT, CHROMA_IDC);
+ else
+ mc_part_std(h, n, square, height, delta, dest_y, dest_cb, dest_cr,
+ x_offset, y_offset, qpix_put, chroma_put, qpix_avg,
+ chroma_avg, list0, list1, PIXEL_SHIFT, CHROMA_IDC);
+}
+
+static void MCFUNC(hl_motion)(H264Context *h, uint8_t *dest_y,
+ uint8_t *dest_cb, uint8_t *dest_cr,
+ qpel_mc_func(*qpix_put)[16],
+ h264_chroma_mc_func(*chroma_put),
+ qpel_mc_func(*qpix_avg)[16],
+ h264_chroma_mc_func(*chroma_avg),
+ h264_weight_func *weight_op,
+ h264_biweight_func *weight_avg)
+{
+ MpegEncContext *const s = &h->s;
+ const int mb_xy = h->mb_xy;
+ const int mb_type = s->current_picture.f.mb_type[mb_xy];
+
+ assert(IS_INTER(mb_type));
+
+ if (HAVE_THREADS && (s->avctx->active_thread_type & FF_THREAD_FRAME))
+ await_references(h);
+ prefetch_motion(h, 0, PIXEL_SHIFT, CHROMA_IDC);
+
+ if (IS_16X16(mb_type)) {
+ mc_part(h, 0, 1, 16, 0, dest_y, dest_cb, dest_cr, 0, 0,
+ qpix_put[0], chroma_put[0], qpix_avg[0], chroma_avg[0],
+ weight_op, weight_avg,
+ IS_DIR(mb_type, 0, 0), IS_DIR(mb_type, 0, 1));
+ } else if (IS_16X8(mb_type)) {
+ mc_part(h, 0, 0, 8, 8 << PIXEL_SHIFT, dest_y, dest_cb, dest_cr, 0, 0,
+ qpix_put[1], chroma_put[0], qpix_avg[1], chroma_avg[0],
+ weight_op, weight_avg,
+ IS_DIR(mb_type, 0, 0), IS_DIR(mb_type, 0, 1));
+ mc_part(h, 8, 0, 8, 8 << PIXEL_SHIFT, dest_y, dest_cb, dest_cr, 0, 4,
+ qpix_put[1], chroma_put[0], qpix_avg[1], chroma_avg[0],
+ weight_op, weight_avg,
+ IS_DIR(mb_type, 1, 0), IS_DIR(mb_type, 1, 1));
+ } else if (IS_8X16(mb_type)) {
+ mc_part(h, 0, 0, 16, 8 * h->mb_linesize, dest_y, dest_cb, dest_cr, 0, 0,
+ qpix_put[1], chroma_put[1], qpix_avg[1], chroma_avg[1],
+ &weight_op[1], &weight_avg[1],
+ IS_DIR(mb_type, 0, 0), IS_DIR(mb_type, 0, 1));
+ mc_part(h, 4, 0, 16, 8 * h->mb_linesize, dest_y, dest_cb, dest_cr, 4, 0,
+ qpix_put[1], chroma_put[1], qpix_avg[1], chroma_avg[1],
+ &weight_op[1], &weight_avg[1],
+ IS_DIR(mb_type, 1, 0), IS_DIR(mb_type, 1, 1));
+ } else {
+ int i;
+
+ assert(IS_8X8(mb_type));
+
+ for (i = 0; i < 4; i++) {
+ const int sub_mb_type = h->sub_mb_type[i];
+ const int n = 4 * i;
+ int x_offset = (i & 1) << 2;
+ int y_offset = (i & 2) << 1;
+
+ if (IS_SUB_8X8(sub_mb_type)) {
+ mc_part(h, n, 1, 8, 0, dest_y, dest_cb, dest_cr,
+ x_offset, y_offset,
+ qpix_put[1], chroma_put[1], qpix_avg[1], chroma_avg[1],
+ &weight_op[1], &weight_avg[1],
+ IS_DIR(sub_mb_type, 0, 0), IS_DIR(sub_mb_type, 0, 1));
+ } else if (IS_SUB_8X4(sub_mb_type)) {
+ mc_part(h, n, 0, 4, 4 << PIXEL_SHIFT, dest_y, dest_cb, dest_cr,
+ x_offset, y_offset,
+ qpix_put[2], chroma_put[1], qpix_avg[2], chroma_avg[1],
+ &weight_op[1], &weight_avg[1],
+ IS_DIR(sub_mb_type, 0, 0), IS_DIR(sub_mb_type, 0, 1));
+ mc_part(h, n + 2, 0, 4, 4 << PIXEL_SHIFT,
+ dest_y, dest_cb, dest_cr, x_offset, y_offset + 2,
+ qpix_put[2], chroma_put[1], qpix_avg[2], chroma_avg[1],
+ &weight_op[1], &weight_avg[1],
+ IS_DIR(sub_mb_type, 0, 0), IS_DIR(sub_mb_type, 0, 1));
+ } else if (IS_SUB_4X8(sub_mb_type)) {
+ mc_part(h, n, 0, 8, 4 * h->mb_linesize,
+ dest_y, dest_cb, dest_cr, x_offset, y_offset,
+ qpix_put[2], chroma_put[2], qpix_avg[2], chroma_avg[2],
+ &weight_op[2], &weight_avg[2],
+ IS_DIR(sub_mb_type, 0, 0), IS_DIR(sub_mb_type, 0, 1));
+ mc_part(h, n + 1, 0, 8, 4 * h->mb_linesize,
+ dest_y, dest_cb, dest_cr, x_offset + 2, y_offset,
+ qpix_put[2], chroma_put[2], qpix_avg[2], chroma_avg[2],
+ &weight_op[2], &weight_avg[2],
+ IS_DIR(sub_mb_type, 0, 0), IS_DIR(sub_mb_type, 0, 1));
+ } else {
+ int j;
+ assert(IS_SUB_4X4(sub_mb_type));
+ for (j = 0; j < 4; j++) {
+ int sub_x_offset = x_offset + 2 * (j & 1);
+ int sub_y_offset = y_offset + (j & 2);
+ mc_part(h, n + j, 1, 4, 0,
+ dest_y, dest_cb, dest_cr, sub_x_offset, sub_y_offset,
+ qpix_put[2], chroma_put[2], qpix_avg[2], chroma_avg[2],
+ &weight_op[2], &weight_avg[2],
+ IS_DIR(sub_mb_type, 0, 0), IS_DIR(sub_mb_type, 0, 1));
+ }
+ }
+ }
+ }
+
+ prefetch_motion(h, 1, PIXEL_SHIFT, CHROMA_IDC);
+}
+
diff --git a/gst-libs/ext/libav/libavcodec/h264_mp4toannexb_bsf.c b/gst-libs/ext/libav/libavcodec/h264_mp4toannexb_bsf.c
index bc49b14..276751e 100644
--- a/gst-libs/ext/libav/libavcodec/h264_mp4toannexb_bsf.c
+++ b/gst-libs/ext/libav/libavcodec/h264_mp4toannexb_bsf.c
@@ -19,7 +19,10 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <string.h>
+
#include "libavutil/intreadwrite.h"
+#include "libavutil/mem.h"
#include "avcodec.h"
typedef struct H264BSFContext {
@@ -190,4 +193,3 @@ AVBitStreamFilter ff_h264_mp4toannexb_bsf = {
sizeof(H264BSFContext),
h264_mp4toannexb_filter,
};
-
diff --git a/gst-libs/ext/libav/libavcodec/h264_mvpred.h b/gst-libs/ext/libav/libavcodec/h264_mvpred.h
index 2bd4458..5244c29 100644
--- a/gst-libs/ext/libav/libavcodec/h264_mvpred.h
+++ b/gst-libs/ext/libav/libavcodec/h264_mvpred.h
@@ -35,53 +35,53 @@
//#undef NDEBUG
#include <assert.h>
-static av_always_inline int fetch_diagonal_mv(H264Context *h, const int16_t **C, int i, int list, int part_width){
- const int topright_ref= h->ref_cache[list][ i - 8 + part_width ];
- MpegEncContext *s = &h->s;
+static av_always_inline int fetch_diagonal_mv(H264Context *h, const int16_t **C,
+ int i, int list, int part_width)
+{
+ const int topright_ref = h->ref_cache[list][i - 8 + part_width];
+ MpegEncContext *s = &h->s;
/* there is no consistent mapping of mvs to neighboring locations that will
* make mbaff happy, so we can't move all this logic to fill_caches */
- if(FRAME_MBAFF){
-
-#define SET_DIAG_MV(MV_OP, REF_OP, XY, Y4)\
- const int xy = XY, y4 = Y4;\
- const int mb_type = mb_types[xy+(y4>>2)*s->mb_stride];\
- if(!USES_LIST(mb_type,list))\
- return LIST_NOT_USED;\
- mv = s->current_picture_ptr->f.motion_val[list][h->mb2b_xy[xy] + 3 + y4*h->b_stride];\
- h->mv_cache[list][scan8[0]-2][0] = mv[0];\
- h->mv_cache[list][scan8[0]-2][1] = mv[1] MV_OP;\
- return s->current_picture_ptr->f.ref_index[list][4*xy + 1 + (y4 & ~1)] REF_OP;
-
- if(topright_ref == PART_NOT_AVAILABLE
- && i >= scan8[0]+8 && (i&7)==4
- && h->ref_cache[list][scan8[0]-1] != PART_NOT_AVAILABLE){
+ if (FRAME_MBAFF) {
+#define SET_DIAG_MV(MV_OP, REF_OP, XY, Y4) \
+ const int xy = XY, y4 = Y4; \
+ const int mb_type = mb_types[xy + (y4 >> 2) * s->mb_stride]; \
+ if (!USES_LIST(mb_type, list)) \
+ return LIST_NOT_USED; \
+ mv = s->current_picture_ptr->f.motion_val[list][h->mb2b_xy[xy] + 3 + y4 * h->b_stride]; \
+ h->mv_cache[list][scan8[0] - 2][0] = mv[0]; \
+ h->mv_cache[list][scan8[0] - 2][1] = mv[1] MV_OP; \
+ return s->current_picture_ptr->f.ref_index[list][4 * xy + 1 + (y4 & ~1)] REF_OP;
+
+ if (topright_ref == PART_NOT_AVAILABLE
+ && i >= scan8[0] + 8 && (i & 7) == 4
+ && h->ref_cache[list][scan8[0] - 1] != PART_NOT_AVAILABLE) {
const uint32_t *mb_types = s->current_picture_ptr->f.mb_type;
const int16_t *mv;
- AV_ZERO32(h->mv_cache[list][scan8[0]-2]);
- *C = h->mv_cache[list][scan8[0]-2];
+ AV_ZERO32(h->mv_cache[list][scan8[0] - 2]);
+ *C = h->mv_cache[list][scan8[0] - 2];
- if(!MB_FIELD
- && IS_INTERLACED(h->left_type[0])){
- SET_DIAG_MV(*2, >>1, h->left_mb_xy[0]+s->mb_stride, (s->mb_y&1)*2+(i>>5));
+ if (!MB_FIELD && IS_INTERLACED(h->left_type[0])) {
+ SET_DIAG_MV(* 2, >> 1, h->left_mb_xy[0] + s->mb_stride,
+ (s->mb_y & 1) * 2 + (i >> 5));
}
- if(MB_FIELD
- && !IS_INTERLACED(h->left_type[0])){
+ if (MB_FIELD && !IS_INTERLACED(h->left_type[0])) {
// left shift will turn LIST_NOT_USED into PART_NOT_AVAILABLE, but that's OK.
- SET_DIAG_MV(/2, <<1, h->left_mb_xy[i>=36], ((i>>2))&3);
+ SET_DIAG_MV(/ 2, << 1, h->left_mb_xy[i >= 36], ((i >> 2)) & 3);
}
}
#undef SET_DIAG_MV
}
- if(topright_ref != PART_NOT_AVAILABLE){
- *C= h->mv_cache[list][ i - 8 + part_width ];
+ if (topright_ref != PART_NOT_AVAILABLE) {
+ *C = h->mv_cache[list][i - 8 + part_width];
return topright_ref;
- }else{
+ } else {
tprintf(s->avctx, "topright MV not available\n");
- *C= h->mv_cache[list][ i - 8 - 1 ];
- return h->ref_cache[list][ i - 8 - 1 ];
+ *C = h->mv_cache[list][i - 8 - 1];
+ return h->ref_cache[list][i - 8 - 1];
}
}
@@ -92,53 +92,61 @@ static av_always_inline int fetch_diagonal_mv(H264Context *h, const int16_t **C,
* @param mx the x component of the predicted motion vector
* @param my the y component of the predicted motion vector
*/
-static av_always_inline void pred_motion(H264Context * const h, int n, int part_width, int list, int ref, int * const mx, int * const my){
- const int index8= scan8[n];
- const int top_ref= h->ref_cache[list][ index8 - 8 ];
- const int left_ref= h->ref_cache[list][ index8 - 1 ];
- const int16_t * const A= h->mv_cache[list][ index8 - 1 ];
- const int16_t * const B= h->mv_cache[list][ index8 - 8 ];
- const int16_t * C;
+static av_always_inline void pred_motion(H264Context *const h, int n,
+ int part_width, int list, int ref,
+ int *const mx, int *const my)
+{
+ const int index8 = scan8[n];
+ const int top_ref = h->ref_cache[list][index8 - 8];
+ const int left_ref = h->ref_cache[list][index8 - 1];
+ const int16_t *const A = h->mv_cache[list][index8 - 1];
+ const int16_t *const B = h->mv_cache[list][index8 - 8];
+ const int16_t *C;
int diagonal_ref, match_count;
- assert(part_width==1 || part_width==2 || part_width==4);
+ assert(part_width == 1 || part_width == 2 || part_width == 4);
/* mv_cache
- B . . A T T T T
- U . . L . . , .
- U . . L . . . .
- U . . L . . , .
- . . . L . . . .
-*/
-
- diagonal_ref= fetch_diagonal_mv(h, &C, index8, list, part_width);
- match_count= (diagonal_ref==ref) + (top_ref==ref) + (left_ref==ref);
+ * B . . A T T T T
+ * U . . L . . , .
+ * U . . L . . . .
+ * U . . L . . , .
+ * . . . L . . . .
+ */
+
+ diagonal_ref = fetch_diagonal_mv(h, &C, index8, list, part_width);
+ match_count = (diagonal_ref == ref) + (top_ref == ref) + (left_ref == ref);
tprintf(h->s.avctx, "pred_motion match_count=%d\n", match_count);
- if(match_count > 1){ //most common
- *mx= mid_pred(A[0], B[0], C[0]);
- *my= mid_pred(A[1], B[1], C[1]);
- }else if(match_count==1){
- if(left_ref==ref){
- *mx= A[0];
- *my= A[1];
- }else if(top_ref==ref){
- *mx= B[0];
- *my= B[1];
- }else{
- *mx= C[0];
- *my= C[1];
+ if (match_count > 1) { //most common
+ *mx = mid_pred(A[0], B[0], C[0]);
+ *my = mid_pred(A[1], B[1], C[1]);
+ } else if (match_count == 1) {
+ if (left_ref == ref) {
+ *mx = A[0];
+ *my = A[1];
+ } else if (top_ref == ref) {
+ *mx = B[0];
+ *my = B[1];
+ } else {
+ *mx = C[0];
+ *my = C[1];
}
- }else{
- if(top_ref == PART_NOT_AVAILABLE && diagonal_ref == PART_NOT_AVAILABLE && left_ref != PART_NOT_AVAILABLE){
- *mx= A[0];
- *my= A[1];
- }else{
- *mx= mid_pred(A[0], B[0], C[0]);
- *my= mid_pred(A[1], B[1], C[1]);
+ } else {
+ if (top_ref == PART_NOT_AVAILABLE &&
+ diagonal_ref == PART_NOT_AVAILABLE &&
+ left_ref != PART_NOT_AVAILABLE) {
+ *mx = A[0];
+ *my = A[1];
+ } else {
+ *mx = mid_pred(A[0], B[0], C[0]);
+ *my = mid_pred(A[1], B[1], C[1]);
}
}
- tprintf(h->s.avctx, "pred_motion (%2d %2d %2d) (%2d %2d %2d) (%2d %2d %2d) -> (%2d %2d %2d) at %2d %2d %d list %d\n", top_ref, B[0], B[1], diagonal_ref, C[0], C[1], left_ref, A[0], A[1], ref, *mx, *my, h->s.mb_x, h->s.mb_y, n, list);
+ tprintf(h->s.avctx,
+ "pred_motion (%2d %2d %2d) (%2d %2d %2d) (%2d %2d %2d) -> (%2d %2d %2d) at %2d %2d %d list %d\n",
+ top_ref, B[0], B[1], diagonal_ref, C[0], C[1], left_ref,
+ A[0], A[1], ref, *mx, *my, h->s.mb_x, h->s.mb_y, n, list);
}
/**
@@ -147,27 +155,32 @@ static av_always_inline void pred_motion(H264Context * const h, int n, int part_
* @param mx the x component of the predicted motion vector
* @param my the y component of the predicted motion vector
*/
-static av_always_inline void pred_16x8_motion(H264Context * const h, int n, int list, int ref, int * const mx, int * const my){
- if(n==0){
- const int top_ref= h->ref_cache[list][ scan8[0] - 8 ];
- const int16_t * const B= h->mv_cache[list][ scan8[0] - 8 ];
-
- tprintf(h->s.avctx, "pred_16x8: (%2d %2d %2d) at %2d %2d %d list %d\n", top_ref, B[0], B[1], h->s.mb_x, h->s.mb_y, n, list);
-
- if(top_ref == ref){
- *mx= B[0];
- *my= B[1];
+static av_always_inline void pred_16x8_motion(H264Context *const h,
+ int n, int list, int ref,
+ int *const mx, int *const my)
+{
+ if (n == 0) {
+ const int top_ref = h->ref_cache[list][scan8[0] - 8];
+ const int16_t *const B = h->mv_cache[list][scan8[0] - 8];
+
+ tprintf(h->s.avctx, "pred_16x8: (%2d %2d %2d) at %2d %2d %d list %d\n",
+ top_ref, B[0], B[1], h->s.mb_x, h->s.mb_y, n, list);
+
+ if (top_ref == ref) {
+ *mx = B[0];
+ *my = B[1];
return;
}
- }else{
- const int left_ref= h->ref_cache[list][ scan8[8] - 1 ];
- const int16_t * const A= h->mv_cache[list][ scan8[8] - 1 ];
+ } else {
+ const int left_ref = h->ref_cache[list][scan8[8] - 1];
+ const int16_t *const A = h->mv_cache[list][scan8[8] - 1];
- tprintf(h->s.avctx, "pred_16x8: (%2d %2d %2d) at %2d %2d %d list %d\n", left_ref, A[0], A[1], h->s.mb_x, h->s.mb_y, n, list);
+ tprintf(h->s.avctx, "pred_16x8: (%2d %2d %2d) at %2d %2d %d list %d\n",
+ left_ref, A[0], A[1], h->s.mb_x, h->s.mb_y, n, list);
- if(left_ref == ref){
- *mx= A[0];
- *my= A[1];
+ if (left_ref == ref) {
+ *mx = A[0];
+ *my = A[1];
return;
}
}
@@ -182,29 +195,34 @@ static av_always_inline void pred_16x8_motion(H264Context * const h, int n, int
* @param mx the x component of the predicted motion vector
* @param my the y component of the predicted motion vector
*/
-static av_always_inline void pred_8x16_motion(H264Context * const h, int n, int list, int ref, int * const mx, int * const my){
- if(n==0){
- const int left_ref= h->ref_cache[list][ scan8[0] - 1 ];
- const int16_t * const A= h->mv_cache[list][ scan8[0] - 1 ];
-
- tprintf(h->s.avctx, "pred_8x16: (%2d %2d %2d) at %2d %2d %d list %d\n", left_ref, A[0], A[1], h->s.mb_x, h->s.mb_y, n, list);
-
- if(left_ref == ref){
- *mx= A[0];
- *my= A[1];
+static av_always_inline void pred_8x16_motion(H264Context *const h,
+ int n, int list, int ref,
+ int *const mx, int *const my)
+{
+ if (n == 0) {
+ const int left_ref = h->ref_cache[list][scan8[0] - 1];
+ const int16_t *const A = h->mv_cache[list][scan8[0] - 1];
+
+ tprintf(h->s.avctx, "pred_8x16: (%2d %2d %2d) at %2d %2d %d list %d\n",
+ left_ref, A[0], A[1], h->s.mb_x, h->s.mb_y, n, list);
+
+ if (left_ref == ref) {
+ *mx = A[0];
+ *my = A[1];
return;
}
- }else{
- const int16_t * C;
+ } else {
+ const int16_t *C;
int diagonal_ref;
- diagonal_ref= fetch_diagonal_mv(h, &C, scan8[4], list, 2);
+ diagonal_ref = fetch_diagonal_mv(h, &C, scan8[4], list, 2);
- tprintf(h->s.avctx, "pred_8x16: (%2d %2d %2d) at %2d %2d %d list %d\n", diagonal_ref, C[0], C[1], h->s.mb_x, h->s.mb_y, n, list);
+ tprintf(h->s.avctx, "pred_8x16: (%2d %2d %2d) at %2d %2d %d list %d\n",
+ diagonal_ref, C[0], C[1], h->s.mb_x, h->s.mb_y, n, list);
- if(diagonal_ref == ref){
- *mx= C[0];
- *my= C[1];
+ if (diagonal_ref == ref) {
+ *mx = C[0];
+ *my = C[1];
return;
}
}
@@ -213,168 +231,174 @@ static av_always_inline void pred_8x16_motion(H264Context * const h, int n, int
pred_motion(h, n, 2, list, ref, mx, my);
}
-#define FIX_MV_MBAFF(type, refn, mvn, idx)\
- if(FRAME_MBAFF){\
- if(MB_FIELD){\
- if(!IS_INTERLACED(type)){\
- refn <<= 1;\
- AV_COPY32(mvbuf[idx], mvn);\
- mvbuf[idx][1] /= 2;\
- mvn = mvbuf[idx];\
- }\
- }else{\
- if(IS_INTERLACED(type)){\
- refn >>= 1;\
- AV_COPY32(mvbuf[idx], mvn);\
- mvbuf[idx][1] <<= 1;\
- mvn = mvbuf[idx];\
- }\
- }\
+#define FIX_MV_MBAFF(type, refn, mvn, idx) \
+ if (FRAME_MBAFF) { \
+ if (MB_FIELD) { \
+ if (!IS_INTERLACED(type)) { \
+ refn <<= 1; \
+ AV_COPY32(mvbuf[idx], mvn); \
+ mvbuf[idx][1] /= 2; \
+ mvn = mvbuf[idx]; \
+ } \
+ } else { \
+ if (IS_INTERLACED(type)) { \
+ refn >>= 1; \
+ AV_COPY32(mvbuf[idx], mvn); \
+ mvbuf[idx][1] <<= 1; \
+ mvn = mvbuf[idx]; \
+ } \
+ } \
}
-static av_always_inline void pred_pskip_motion(H264Context * const h){
- DECLARE_ALIGNED(4, static const int16_t, zeromv)[2] = {0};
+static av_always_inline void pred_pskip_motion(H264Context *const h)
+{
+ DECLARE_ALIGNED(4, static const int16_t, zeromv)[2] = { 0 };
DECLARE_ALIGNED(4, int16_t, mvbuf)[3][2];
- MpegEncContext * const s = &h->s;
- int8_t *ref = s->current_picture.f.ref_index[0];
- int16_t (*mv)[2] = s->current_picture.f.motion_val[0];
+ MpegEncContext *const s = &h->s;
+ int8_t *ref = s->current_picture.f.ref_index[0];
+ int16_t(*mv)[2] = s->current_picture.f.motion_val[0];
int top_ref, left_ref, diagonal_ref, match_count, mx, my;
const int16_t *A, *B, *C;
int b_stride = h->b_stride;
fill_rectangle(&h->ref_cache[0][scan8[0]], 4, 4, 8, 0, 1);
- /* To avoid doing an entire fill_decode_caches, we inline the relevant parts here.
- * FIXME: this is a partial duplicate of the logic in fill_decode_caches, but it's
- * faster this way. Is there a way to avoid this duplication?
+ /* To avoid doing an entire fill_decode_caches, we inline the relevant
+ * parts here.
+ * FIXME: this is a partial duplicate of the logic in fill_decode_caches,
+ * but it's faster this way. Is there a way to avoid this duplication?
*/
- if(USES_LIST(h->left_type[LTOP], 0)){
- left_ref = ref[4*h->left_mb_xy[LTOP] + 1 + (h->left_block[0]&~1)];
- A = mv[h->mb2b_xy[h->left_mb_xy[LTOP]] + 3 + b_stride*h->left_block[0]];
+ if (USES_LIST(h->left_type[LTOP], 0)) {
+ left_ref = ref[4 * h->left_mb_xy[LTOP] + 1 + (h->left_block[0] & ~1)];
+ A = mv[h->mb2b_xy[h->left_mb_xy[LTOP]] + 3 + b_stride * h->left_block[0]];
FIX_MV_MBAFF(h->left_type[LTOP], left_ref, A, 0);
- if(!(left_ref | AV_RN32A(A))){
+ if (!(left_ref | AV_RN32A(A)))
goto zeromv;
- }
- }else if(h->left_type[LTOP]){
+ } else if (h->left_type[LTOP]) {
left_ref = LIST_NOT_USED;
- A = zeromv;
- }else{
+ A = zeromv;
+ } else {
goto zeromv;
}
- if(USES_LIST(h->top_type, 0)){
- top_ref = ref[4*h->top_mb_xy + 2];
- B = mv[h->mb2b_xy[h->top_mb_xy] + 3*b_stride];
+ if (USES_LIST(h->top_type, 0)) {
+ top_ref = ref[4 * h->top_mb_xy + 2];
+ B = mv[h->mb2b_xy[h->top_mb_xy] + 3 * b_stride];
FIX_MV_MBAFF(h->top_type, top_ref, B, 1);
- if(!(top_ref | AV_RN32A(B))){
+ if (!(top_ref | AV_RN32A(B)))
goto zeromv;
- }
- }else if(h->top_type){
+ } else if (h->top_type) {
top_ref = LIST_NOT_USED;
- B = zeromv;
- }else{
+ B = zeromv;
+ } else {
goto zeromv;
}
- tprintf(h->s.avctx, "pred_pskip: (%d) (%d) at %2d %2d\n", top_ref, left_ref, h->s.mb_x, h->s.mb_y);
+ tprintf(h->s.avctx, "pred_pskip: (%d) (%d) at %2d %2d\n",
+ top_ref, left_ref, h->s.mb_x, h->s.mb_y);
- if(USES_LIST(h->topright_type, 0)){
- diagonal_ref = ref[4*h->topright_mb_xy + 2];
- C = mv[h->mb2b_xy[h->topright_mb_xy] + 3*b_stride];
+ if (USES_LIST(h->topright_type, 0)) {
+ diagonal_ref = ref[4 * h->topright_mb_xy + 2];
+ C = mv[h->mb2b_xy[h->topright_mb_xy] + 3 * b_stride];
FIX_MV_MBAFF(h->topright_type, diagonal_ref, C, 2);
- }else if(h->topright_type){
+ } else if (h->topright_type) {
diagonal_ref = LIST_NOT_USED;
C = zeromv;
- }else{
- if(USES_LIST(h->topleft_type, 0)){
- diagonal_ref = ref[4*h->topleft_mb_xy + 1 + (h->topleft_partition & 2)];
- C = mv[h->mb2b_xy[h->topleft_mb_xy] + 3 + b_stride + (h->topleft_partition & 2*b_stride)];
+ } else {
+ if (USES_LIST(h->topleft_type, 0)) {
+ diagonal_ref = ref[4 * h->topleft_mb_xy + 1 +
+ (h->topleft_partition & 2)];
+ C = mv[h->mb2b_xy[h->topleft_mb_xy] + 3 + b_stride +
+ (h->topleft_partition & 2 * b_stride)];
FIX_MV_MBAFF(h->topleft_type, diagonal_ref, C, 2);
- }else if(h->topleft_type){
+ } else if (h->topleft_type) {
diagonal_ref = LIST_NOT_USED;
- C = zeromv;
- }else{
+ C = zeromv;
+ } else {
diagonal_ref = PART_NOT_AVAILABLE;
- C = zeromv;
+ C = zeromv;
}
}
- match_count= !diagonal_ref + !top_ref + !left_ref;
+ match_count = !diagonal_ref + !top_ref + !left_ref;
tprintf(h->s.avctx, "pred_pskip_motion match_count=%d\n", match_count);
- if(match_count > 1){
+ if (match_count > 1) {
mx = mid_pred(A[0], B[0], C[0]);
my = mid_pred(A[1], B[1], C[1]);
- }else if(match_count==1){
- if(!left_ref){
+ } else if (match_count == 1) {
+ if (!left_ref) {
mx = A[0];
my = A[1];
- }else if(!top_ref){
+ } else if (!top_ref) {
mx = B[0];
my = B[1];
- }else{
+ } else {
mx = C[0];
my = C[1];
}
- }else{
+ } else {
mx = mid_pred(A[0], B[0], C[0]);
my = mid_pred(A[1], B[1], C[1]);
}
- fill_rectangle( h->mv_cache[0][scan8[0]], 4, 4, 8, pack16to32(mx,my), 4);
+ fill_rectangle(h->mv_cache[0][scan8[0]], 4, 4, 8, pack16to32(mx, my), 4);
return;
+
zeromv:
- fill_rectangle( h->mv_cache[0][scan8[0]], 4, 4, 8, 0, 4);
+ fill_rectangle(h->mv_cache[0][scan8[0]], 4, 4, 8, 0, 4);
return;
}
-static void fill_decode_neighbors(H264Context *h, int mb_type){
- MpegEncContext * const s = &h->s;
- const int mb_xy= h->mb_xy;
+static void fill_decode_neighbors(H264Context *h, int mb_type)
+{
+ MpegEncContext *const s = &h->s;
+ const int mb_xy = h->mb_xy;
int topleft_xy, top_xy, topright_xy, left_xy[LEFT_MBS];
- static const uint8_t left_block_options[4][32]={
- {0,1,2,3,7,10,8,11,3+0*4, 3+1*4, 3+2*4, 3+3*4, 1+4*4, 1+8*4, 1+5*4, 1+9*4},
- {2,2,3,3,8,11,8,11,3+2*4, 3+2*4, 3+3*4, 3+3*4, 1+5*4, 1+9*4, 1+5*4, 1+9*4},
- {0,0,1,1,7,10,7,10,3+0*4, 3+0*4, 3+1*4, 3+1*4, 1+4*4, 1+8*4, 1+4*4, 1+8*4},
- {0,2,0,2,7,10,7,10,3+0*4, 3+2*4, 3+0*4, 3+2*4, 1+4*4, 1+8*4, 1+4*4, 1+8*4}
+ static const uint8_t left_block_options[4][32] = {
+ { 0, 1, 2, 3, 7, 10, 8, 11, 3 + 0 * 4, 3 + 1 * 4, 3 + 2 * 4, 3 + 3 * 4, 1 + 4 * 4, 1 + 8 * 4, 1 + 5 * 4, 1 + 9 * 4 },
+ { 2, 2, 3, 3, 8, 11, 8, 11, 3 + 2 * 4, 3 + 2 * 4, 3 + 3 * 4, 3 + 3 * 4, 1 + 5 * 4, 1 + 9 * 4, 1 + 5 * 4, 1 + 9 * 4 },
+ { 0, 0, 1, 1, 7, 10, 7, 10, 3 + 0 * 4, 3 + 0 * 4, 3 + 1 * 4, 3 + 1 * 4, 1 + 4 * 4, 1 + 8 * 4, 1 + 4 * 4, 1 + 8 * 4 },
+ { 0, 2, 0, 2, 7, 10, 7, 10, 3 + 0 * 4, 3 + 2 * 4, 3 + 0 * 4, 3 + 2 * 4, 1 + 4 * 4, 1 + 8 * 4, 1 + 4 * 4, 1 + 8 * 4 }
};
- h->topleft_partition= -1;
+ h->topleft_partition = -1;
- top_xy = mb_xy - (s->mb_stride << MB_FIELD);
+ top_xy = mb_xy - (s->mb_stride << MB_FIELD);
/* Wow, what a mess, why didn't they simplify the interlacing & intra
* stuff, I can't imagine that these complex rules are worth it. */
- topleft_xy = top_xy - 1;
- topright_xy= top_xy + 1;
- left_xy[LBOT] = left_xy[LTOP] = mb_xy-1;
+ topleft_xy = top_xy - 1;
+ topright_xy = top_xy + 1;
+ left_xy[LBOT] = left_xy[LTOP] = mb_xy - 1;
h->left_block = left_block_options[0];
- if(FRAME_MBAFF){
+ if (FRAME_MBAFF) {
const int left_mb_field_flag = IS_INTERLACED(s->current_picture.f.mb_type[mb_xy - 1]);
const int curr_mb_field_flag = IS_INTERLACED(mb_type);
- if(s->mb_y&1){
+ if (s->mb_y & 1) {
if (left_mb_field_flag != curr_mb_field_flag) {
left_xy[LBOT] = left_xy[LTOP] = mb_xy - s->mb_stride - 1;
if (curr_mb_field_flag) {
left_xy[LBOT] += s->mb_stride;
- h->left_block = left_block_options[3];
+ h->left_block = left_block_options[3];
} else {
topleft_xy += s->mb_stride;
- // take top left mv from the middle of the mb, as opposed to all other modes which use the bottom right partition
+ /* take top left mv from the middle of the mb, as opposed
+ * to all other modes which use the bottom right partition */
h->topleft_partition = 0;
- h->left_block = left_block_options[1];
+ h->left_block = left_block_options[1];
}
}
- }else{
- if(curr_mb_field_flag){
+ } else {
+ if (curr_mb_field_flag) {
topleft_xy += s->mb_stride & (((s->current_picture.f.mb_type[top_xy - 1] >> 7) & 1) - 1);
topright_xy += s->mb_stride & (((s->current_picture.f.mb_type[top_xy + 1] >> 7) & 1) - 1);
- top_xy += s->mb_stride & (((s->current_picture.f.mb_type[top_xy ] >> 7) & 1) - 1);
+ top_xy += s->mb_stride & (((s->current_picture.f.mb_type[top_xy] >> 7) & 1) - 1);
}
if (left_mb_field_flag != curr_mb_field_flag) {
if (curr_mb_field_flag) {
left_xy[LBOT] += s->mb_stride;
- h->left_block = left_block_options[3];
+ h->left_block = left_block_options[3];
} else {
h->left_block = left_block_options[2];
}
@@ -382,9 +406,9 @@ static void fill_decode_neighbors(H264Context *h, int mb_type){
}
}
- h->topleft_mb_xy = topleft_xy;
- h->top_mb_xy = top_xy;
- h->topright_mb_xy= topright_xy;
+ h->topleft_mb_xy = topleft_xy;
+ h->top_mb_xy = top_xy;
+ h->topright_mb_xy = topright_xy;
h->left_mb_xy[LTOP] = left_xy[LTOP];
h->left_mb_xy[LBOT] = left_xy[LBOT];
//FIXME do we need all in the context?
@@ -395,351 +419,372 @@ static void fill_decode_neighbors(H264Context *h, int mb_type){
h->left_type[LTOP] = s->current_picture.f.mb_type[left_xy[LTOP]];
h->left_type[LBOT] = s->current_picture.f.mb_type[left_xy[LBOT]];
- if(FMO){
- if(h->slice_table[topleft_xy ] != h->slice_num) h->topleft_type = 0;
- if(h->slice_table[top_xy ] != h->slice_num) h->top_type = 0;
- if(h->slice_table[left_xy[LTOP] ] != h->slice_num) h->left_type[LTOP] = h->left_type[LBOT] = 0;
- }else{
- if(h->slice_table[topleft_xy ] != h->slice_num){
+ if (FMO) {
+ if (h->slice_table[topleft_xy] != h->slice_num)
+ h->topleft_type = 0;
+ if (h->slice_table[top_xy] != h->slice_num)
+ h->top_type = 0;
+ if (h->slice_table[left_xy[LTOP]] != h->slice_num)
+ h->left_type[LTOP] = h->left_type[LBOT] = 0;
+ } else {
+ if (h->slice_table[topleft_xy] != h->slice_num) {
h->topleft_type = 0;
- if(h->slice_table[top_xy ] != h->slice_num) h->top_type = 0;
- if(h->slice_table[left_xy[LTOP] ] != h->slice_num) h->left_type[LTOP] = h->left_type[LBOT] = 0;
+ if (h->slice_table[top_xy] != h->slice_num)
+ h->top_type = 0;
+ if (h->slice_table[left_xy[LTOP]] != h->slice_num)
+ h->left_type[LTOP] = h->left_type[LBOT] = 0;
}
}
- if(h->slice_table[topright_xy] != h->slice_num) h->topright_type= 0;
+ if (h->slice_table[topright_xy] != h->slice_num)
+ h->topright_type = 0;
}
-static void fill_decode_caches(H264Context *h, int mb_type){
- MpegEncContext * const s = &h->s;
+static void fill_decode_caches(H264Context *h, int mb_type)
+{
+ MpegEncContext *const s = &h->s;
int topleft_xy, top_xy, topright_xy, left_xy[LEFT_MBS];
int topleft_type, top_type, topright_type, left_type[LEFT_MBS];
- const uint8_t * left_block= h->left_block;
+ const uint8_t *left_block = h->left_block;
int i;
uint8_t *nnz;
uint8_t *nnz_cache;
- topleft_xy = h->topleft_mb_xy;
- top_xy = h->top_mb_xy;
- topright_xy = h->topright_mb_xy;
- left_xy[LTOP] = h->left_mb_xy[LTOP];
- left_xy[LBOT] = h->left_mb_xy[LBOT];
- topleft_type = h->topleft_type;
- top_type = h->top_type;
- topright_type = h->topright_type;
- left_type[LTOP]= h->left_type[LTOP];
- left_type[LBOT]= h->left_type[LBOT];
-
- if(!IS_SKIP(mb_type)){
- if(IS_INTRA(mb_type)){
- int type_mask= h->pps.constrained_intra_pred ? IS_INTRA(-1) : -1;
- h->topleft_samples_available=
- h->top_samples_available=
- h->left_samples_available= 0xFFFF;
- h->topright_samples_available= 0xEEEA;
-
- if(!(top_type & type_mask)){
- h->topleft_samples_available= 0xB3FF;
- h->top_samples_available= 0x33FF;
- h->topright_samples_available= 0x26EA;
+ topleft_xy = h->topleft_mb_xy;
+ top_xy = h->top_mb_xy;
+ topright_xy = h->topright_mb_xy;
+ left_xy[LTOP] = h->left_mb_xy[LTOP];
+ left_xy[LBOT] = h->left_mb_xy[LBOT];
+ topleft_type = h->topleft_type;
+ top_type = h->top_type;
+ topright_type = h->topright_type;
+ left_type[LTOP] = h->left_type[LTOP];
+ left_type[LBOT] = h->left_type[LBOT];
+
+ if (!IS_SKIP(mb_type)) {
+ if (IS_INTRA(mb_type)) {
+ int type_mask = h->pps.constrained_intra_pred ? IS_INTRA(-1) : -1;
+ h->topleft_samples_available =
+ h->top_samples_available =
+ h->left_samples_available = 0xFFFF;
+ h->topright_samples_available = 0xEEEA;
+
+ if (!(top_type & type_mask)) {
+ h->topleft_samples_available = 0xB3FF;
+ h->top_samples_available = 0x33FF;
+ h->topright_samples_available = 0x26EA;
}
- if(IS_INTERLACED(mb_type) != IS_INTERLACED(left_type[LTOP])){
- if(IS_INTERLACED(mb_type)){
- if(!(left_type[LTOP] & type_mask)){
- h->topleft_samples_available&= 0xDFFF;
- h->left_samples_available&= 0x5FFF;
+ if (IS_INTERLACED(mb_type) != IS_INTERLACED(left_type[LTOP])) {
+ if (IS_INTERLACED(mb_type)) {
+ if (!(left_type[LTOP] & type_mask)) {
+ h->topleft_samples_available &= 0xDFFF;
+ h->left_samples_available &= 0x5FFF;
}
- if(!(left_type[LBOT] & type_mask)){
- h->topleft_samples_available&= 0xFF5F;
- h->left_samples_available&= 0xFF5F;
+ if (!(left_type[LBOT] & type_mask)) {
+ h->topleft_samples_available &= 0xFF5F;
+ h->left_samples_available &= 0xFF5F;
}
- }else{
+ } else {
int left_typei = s->current_picture.f.mb_type[left_xy[LTOP] + s->mb_stride];
assert(left_xy[LTOP] == left_xy[LBOT]);
- if(!((left_typei & type_mask) && (left_type[LTOP] & type_mask))){
- h->topleft_samples_available&= 0xDF5F;
- h->left_samples_available&= 0x5F5F;
+ if (!((left_typei & type_mask) && (left_type[LTOP] & type_mask))) {
+ h->topleft_samples_available &= 0xDF5F;
+ h->left_samples_available &= 0x5F5F;
}
}
- }else{
- if(!(left_type[LTOP] & type_mask)){
- h->topleft_samples_available&= 0xDF5F;
- h->left_samples_available&= 0x5F5F;
+ } else {
+ if (!(left_type[LTOP] & type_mask)) {
+ h->topleft_samples_available &= 0xDF5F;
+ h->left_samples_available &= 0x5F5F;
}
}
- if(!(topleft_type & type_mask))
- h->topleft_samples_available&= 0x7FFF;
+ if (!(topleft_type & type_mask))
+ h->topleft_samples_available &= 0x7FFF;
- if(!(topright_type & type_mask))
- h->topright_samples_available&= 0xFBFF;
+ if (!(topright_type & type_mask))
+ h->topright_samples_available &= 0xFBFF;
- if(IS_INTRA4x4(mb_type)){
- if(IS_INTRA4x4(top_type)){
- AV_COPY32(h->intra4x4_pred_mode_cache+4+8*0, h->intra4x4_pred_mode + h->mb2br_xy[top_xy]);
- }else{
- h->intra4x4_pred_mode_cache[4+8*0]=
- h->intra4x4_pred_mode_cache[5+8*0]=
- h->intra4x4_pred_mode_cache[6+8*0]=
- h->intra4x4_pred_mode_cache[7+8*0]= 2 - 3*!(top_type & type_mask);
+ if (IS_INTRA4x4(mb_type)) {
+ if (IS_INTRA4x4(top_type)) {
+ AV_COPY32(h->intra4x4_pred_mode_cache + 4 + 8 * 0, h->intra4x4_pred_mode + h->mb2br_xy[top_xy]);
+ } else {
+ h->intra4x4_pred_mode_cache[4 + 8 * 0] =
+ h->intra4x4_pred_mode_cache[5 + 8 * 0] =
+ h->intra4x4_pred_mode_cache[6 + 8 * 0] =
+ h->intra4x4_pred_mode_cache[7 + 8 * 0] = 2 - 3 * !(top_type & type_mask);
}
- for(i=0; i<2; i++){
- if(IS_INTRA4x4(left_type[LEFT(i)])){
- int8_t *mode= h->intra4x4_pred_mode + h->mb2br_xy[left_xy[LEFT(i)]];
- h->intra4x4_pred_mode_cache[3+8*1 + 2*8*i]= mode[6-left_block[0+2*i]];
- h->intra4x4_pred_mode_cache[3+8*2 + 2*8*i]= mode[6-left_block[1+2*i]];
- }else{
- h->intra4x4_pred_mode_cache[3+8*1 + 2*8*i]=
- h->intra4x4_pred_mode_cache[3+8*2 + 2*8*i]= 2 - 3*!(left_type[LEFT(i)] & type_mask);
+ for (i = 0; i < 2; i++) {
+ if (IS_INTRA4x4(left_type[LEFT(i)])) {
+ int8_t *mode = h->intra4x4_pred_mode + h->mb2br_xy[left_xy[LEFT(i)]];
+ h->intra4x4_pred_mode_cache[3 + 8 * 1 + 2 * 8 * i] = mode[6 - left_block[0 + 2 * i]];
+ h->intra4x4_pred_mode_cache[3 + 8 * 2 + 2 * 8 * i] = mode[6 - left_block[1 + 2 * i]];
+ } else {
+ h->intra4x4_pred_mode_cache[3 + 8 * 1 + 2 * 8 * i] =
+ h->intra4x4_pred_mode_cache[3 + 8 * 2 + 2 * 8 * i] = 2 - 3 * !(left_type[LEFT(i)] & type_mask);
}
}
}
}
-
-/*
-0 . T T. T T T T
-1 L . .L . . . .
-2 L . .L . . . .
-3 . T TL . . . .
-4 L . .L . . . .
-5 L . .. . . . .
-*/
-//FIXME constraint_intra_pred & partitioning & nnz (let us hope this is just a typo in the spec)
- nnz_cache = h->non_zero_count_cache;
- if(top_type){
- nnz = h->non_zero_count[top_xy];
- AV_COPY32(&nnz_cache[4+8* 0], &nnz[4*3]);
- if(!s->chroma_y_shift){
- AV_COPY32(&nnz_cache[4+8* 5], &nnz[4* 7]);
- AV_COPY32(&nnz_cache[4+8*10], &nnz[4*11]);
- }else{
- AV_COPY32(&nnz_cache[4+8* 5], &nnz[4* 5]);
- AV_COPY32(&nnz_cache[4+8*10], &nnz[4* 9]);
+ /*
+ * 0 . T T. T T T T
+ * 1 L . .L . . . .
+ * 2 L . .L . . . .
+ * 3 . T TL . . . .
+ * 4 L . .L . . . .
+ * 5 L . .. . . . .
+ */
+ /* FIXME: constraint_intra_pred & partitioning & nnz
+ * (let us hope this is just a typo in the spec) */
+ nnz_cache = h->non_zero_count_cache;
+ if (top_type) {
+ nnz = h->non_zero_count[top_xy];
+ AV_COPY32(&nnz_cache[4 + 8 * 0], &nnz[4 * 3]);
+ if (!s->chroma_y_shift) {
+ AV_COPY32(&nnz_cache[4 + 8 * 5], &nnz[4 * 7]);
+ AV_COPY32(&nnz_cache[4 + 8 * 10], &nnz[4 * 11]);
+ } else {
+ AV_COPY32(&nnz_cache[4 + 8 * 5], &nnz[4 * 5]);
+ AV_COPY32(&nnz_cache[4 + 8 * 10], &nnz[4 * 9]);
+ }
+ } else {
+ uint32_t top_empty = CABAC && !IS_INTRA(mb_type) ? 0 : 0x40404040;
+ AV_WN32A(&nnz_cache[4 + 8 * 0], top_empty);
+ AV_WN32A(&nnz_cache[4 + 8 * 5], top_empty);
+ AV_WN32A(&nnz_cache[4 + 8 * 10], top_empty);
}
- }else{
- uint32_t top_empty = CABAC && !IS_INTRA(mb_type) ? 0 : 0x40404040;
- AV_WN32A(&nnz_cache[4+8* 0], top_empty);
- AV_WN32A(&nnz_cache[4+8* 5], top_empty);
- AV_WN32A(&nnz_cache[4+8*10], top_empty);
- }
- for (i=0; i<2; i++) {
- if(left_type[LEFT(i)]){
- nnz = h->non_zero_count[left_xy[LEFT(i)]];
- nnz_cache[3+8* 1 + 2*8*i]= nnz[left_block[8+0+2*i]];
- nnz_cache[3+8* 2 + 2*8*i]= nnz[left_block[8+1+2*i]];
- if(CHROMA444){
- nnz_cache[3+8* 6 + 2*8*i]= nnz[left_block[8+0+2*i]+4*4];
- nnz_cache[3+8* 7 + 2*8*i]= nnz[left_block[8+1+2*i]+4*4];
- nnz_cache[3+8*11 + 2*8*i]= nnz[left_block[8+0+2*i]+8*4];
- nnz_cache[3+8*12 + 2*8*i]= nnz[left_block[8+1+2*i]+8*4];
- }else if(CHROMA422) {
- nnz_cache[3+8* 6 + 2*8*i]= nnz[left_block[8+0+2*i]-2+4*4];
- nnz_cache[3+8* 7 + 2*8*i]= nnz[left_block[8+1+2*i]-2+4*4];
- nnz_cache[3+8*11 + 2*8*i]= nnz[left_block[8+0+2*i]-2+8*4];
- nnz_cache[3+8*12 + 2*8*i]= nnz[left_block[8+1+2*i]-2+8*4];
- }else{
- nnz_cache[3+8* 6 + 8*i]= nnz[left_block[8+4+2*i]];
- nnz_cache[3+8*11 + 8*i]= nnz[left_block[8+5+2*i]];
+ for (i = 0; i < 2; i++) {
+ if (left_type[LEFT(i)]) {
+ nnz = h->non_zero_count[left_xy[LEFT(i)]];
+ nnz_cache[3 + 8 * 1 + 2 * 8 * i] = nnz[left_block[8 + 0 + 2 * i]];
+ nnz_cache[3 + 8 * 2 + 2 * 8 * i] = nnz[left_block[8 + 1 + 2 * i]];
+ if (CHROMA444) {
+ nnz_cache[3 + 8 * 6 + 2 * 8 * i] = nnz[left_block[8 + 0 + 2 * i] + 4 * 4];
+ nnz_cache[3 + 8 * 7 + 2 * 8 * i] = nnz[left_block[8 + 1 + 2 * i] + 4 * 4];
+ nnz_cache[3 + 8 * 11 + 2 * 8 * i] = nnz[left_block[8 + 0 + 2 * i] + 8 * 4];
+ nnz_cache[3 + 8 * 12 + 2 * 8 * i] = nnz[left_block[8 + 1 + 2 * i] + 8 * 4];
+ } else if (CHROMA422) {
+ nnz_cache[3 + 8 * 6 + 2 * 8 * i] = nnz[left_block[8 + 0 + 2 * i] - 2 + 4 * 4];
+ nnz_cache[3 + 8 * 7 + 2 * 8 * i] = nnz[left_block[8 + 1 + 2 * i] - 2 + 4 * 4];
+ nnz_cache[3 + 8 * 11 + 2 * 8 * i] = nnz[left_block[8 + 0 + 2 * i] - 2 + 8 * 4];
+ nnz_cache[3 + 8 * 12 + 2 * 8 * i] = nnz[left_block[8 + 1 + 2 * i] - 2 + 8 * 4];
+ } else {
+ nnz_cache[3 + 8 * 6 + 8 * i] = nnz[left_block[8 + 4 + 2 * i]];
+ nnz_cache[3 + 8 * 11 + 8 * i] = nnz[left_block[8 + 5 + 2 * i]];
+ }
+ } else {
+ nnz_cache[3 + 8 * 1 + 2 * 8 * i] =
+ nnz_cache[3 + 8 * 2 + 2 * 8 * i] =
+ nnz_cache[3 + 8 * 6 + 2 * 8 * i] =
+ nnz_cache[3 + 8 * 7 + 2 * 8 * i] =
+ nnz_cache[3 + 8 * 11 + 2 * 8 * i] =
+ nnz_cache[3 + 8 * 12 + 2 * 8 * i] = CABAC && !IS_INTRA(mb_type) ? 0 : 64;
}
- }else{
- nnz_cache[3+8* 1 + 2*8*i]=
- nnz_cache[3+8* 2 + 2*8*i]=
- nnz_cache[3+8* 6 + 2*8*i]=
- nnz_cache[3+8* 7 + 2*8*i]=
- nnz_cache[3+8*11 + 2*8*i]=
- nnz_cache[3+8*12 + 2*8*i]= CABAC && !IS_INTRA(mb_type) ? 0 : 64;
}
- }
- if( CABAC ) {
- // top_cbp
- if(top_type) {
- h->top_cbp = h->cbp_table[top_xy];
- } else {
- h->top_cbp = IS_INTRA(mb_type) ? 0x7CF : 0x00F;
- }
- // left_cbp
- if (left_type[LTOP]) {
- h->left_cbp = (h->cbp_table[left_xy[LTOP]] & 0x7F0)
- | ((h->cbp_table[left_xy[LTOP]]>>(left_block[0]&(~1)))&2)
- | (((h->cbp_table[left_xy[LBOT]]>>(left_block[2]&(~1)))&2) << 2);
- } else {
- h->left_cbp = IS_INTRA(mb_type) ? 0x7CF : 0x00F;
+ if (CABAC) {
+ // top_cbp
+ if (top_type)
+ h->top_cbp = h->cbp_table[top_xy];
+ else
+ h->top_cbp = IS_INTRA(mb_type) ? 0x7CF : 0x00F;
+ // left_cbp
+ if (left_type[LTOP]) {
+ h->left_cbp = (h->cbp_table[left_xy[LTOP]] & 0x7F0) |
+ ((h->cbp_table[left_xy[LTOP]] >> (left_block[0] & (~1))) & 2) |
+ (((h->cbp_table[left_xy[LBOT]] >> (left_block[2] & (~1))) & 2) << 2);
+ } else {
+ h->left_cbp = IS_INTRA(mb_type) ? 0x7CF : 0x00F;
+ }
}
}
- }
- if(IS_INTER(mb_type) || (IS_DIRECT(mb_type) && h->direct_spatial_mv_pred)){
+ if (IS_INTER(mb_type) || (IS_DIRECT(mb_type) && h->direct_spatial_mv_pred)) {
int list;
int b_stride = h->b_stride;
- for(list=0; list<h->list_count; list++){
+ for (list = 0; list < h->list_count; list++) {
int8_t *ref_cache = &h->ref_cache[list][scan8[0]];
int8_t *ref = s->current_picture.f.ref_index[list];
- int16_t (*mv_cache)[2] = &h->mv_cache[list][scan8[0]];
- int16_t (*mv)[2] = s->current_picture.f.motion_val[list];
- if(!USES_LIST(mb_type, list)){
+ int16_t(*mv_cache)[2] = &h->mv_cache[list][scan8[0]];
+ int16_t(*mv)[2] = s->current_picture.f.motion_val[list];
+ if (!USES_LIST(mb_type, list))
continue;
- }
assert(!(IS_DIRECT(mb_type) && !h->direct_spatial_mv_pred));
- if(USES_LIST(top_type, list)){
- const int b_xy= h->mb2b_xy[top_xy] + 3*b_stride;
- AV_COPY128(mv_cache[0 - 1*8], mv[b_xy + 0]);
- ref_cache[0 - 1*8]=
- ref_cache[1 - 1*8]= ref[4*top_xy + 2];
- ref_cache[2 - 1*8]=
- ref_cache[3 - 1*8]= ref[4*top_xy + 3];
- }else{
- AV_ZERO128(mv_cache[0 - 1*8]);
- AV_WN32A(&ref_cache[0 - 1*8], ((top_type ? LIST_NOT_USED : PART_NOT_AVAILABLE)&0xFF)*0x01010101u);
+ if (USES_LIST(top_type, list)) {
+ const int b_xy = h->mb2b_xy[top_xy] + 3 * b_stride;
+ AV_COPY128(mv_cache[0 - 1 * 8], mv[b_xy + 0]);
+ ref_cache[0 - 1 * 8] =
+ ref_cache[1 - 1 * 8] = ref[4 * top_xy + 2];
+ ref_cache[2 - 1 * 8] =
+ ref_cache[3 - 1 * 8] = ref[4 * top_xy + 3];
+ } else {
+ AV_ZERO128(mv_cache[0 - 1 * 8]);
+ AV_WN32A(&ref_cache[0 - 1 * 8],
+ ((top_type ? LIST_NOT_USED : PART_NOT_AVAILABLE) & 0xFF) * 0x01010101u);
}
- if(mb_type & (MB_TYPE_16x8|MB_TYPE_8x8)){
- for(i=0; i<2; i++){
- int cache_idx = -1 + i*2*8;
- if(USES_LIST(left_type[LEFT(i)], list)){
- const int b_xy= h->mb2b_xy[left_xy[LEFT(i)]] + 3;
- const int b8_xy= 4*left_xy[LEFT(i)] + 1;
- AV_COPY32(mv_cache[cache_idx ], mv[b_xy + b_stride*left_block[0+i*2]]);
- AV_COPY32(mv_cache[cache_idx+8], mv[b_xy + b_stride*left_block[1+i*2]]);
- ref_cache[cache_idx ]= ref[b8_xy + (left_block[0+i*2]&~1)];
- ref_cache[cache_idx+8]= ref[b8_xy + (left_block[1+i*2]&~1)];
- }else{
- AV_ZERO32(mv_cache[cache_idx ]);
- AV_ZERO32(mv_cache[cache_idx+8]);
- ref_cache[cache_idx ]=
- ref_cache[cache_idx+8]= (left_type[LEFT(i)]) ? LIST_NOT_USED : PART_NOT_AVAILABLE;
+ if (mb_type & (MB_TYPE_16x8 | MB_TYPE_8x8)) {
+ for (i = 0; i < 2; i++) {
+ int cache_idx = -1 + i * 2 * 8;
+ if (USES_LIST(left_type[LEFT(i)], list)) {
+ const int b_xy = h->mb2b_xy[left_xy[LEFT(i)]] + 3;
+ const int b8_xy = 4 * left_xy[LEFT(i)] + 1;
+ AV_COPY32(mv_cache[cache_idx],
+ mv[b_xy + b_stride * left_block[0 + i * 2]]);
+ AV_COPY32(mv_cache[cache_idx + 8],
+ mv[b_xy + b_stride * left_block[1 + i * 2]]);
+ ref_cache[cache_idx] = ref[b8_xy + (left_block[0 + i * 2] & ~1)];
+ ref_cache[cache_idx + 8] = ref[b8_xy + (left_block[1 + i * 2] & ~1)];
+ } else {
+ AV_ZERO32(mv_cache[cache_idx]);
+ AV_ZERO32(mv_cache[cache_idx + 8]);
+ ref_cache[cache_idx] =
+ ref_cache[cache_idx + 8] = (left_type[LEFT(i)]) ? LIST_NOT_USED
+ : PART_NOT_AVAILABLE;
+ }
}
- }
- }else{
- if(USES_LIST(left_type[LTOP], list)){
- const int b_xy= h->mb2b_xy[left_xy[LTOP]] + 3;
- const int b8_xy= 4*left_xy[LTOP] + 1;
- AV_COPY32(mv_cache[-1], mv[b_xy + b_stride*left_block[0]]);
- ref_cache[-1]= ref[b8_xy + (left_block[0]&~1)];
- }else{
+ } else {
+ if (USES_LIST(left_type[LTOP], list)) {
+ const int b_xy = h->mb2b_xy[left_xy[LTOP]] + 3;
+ const int b8_xy = 4 * left_xy[LTOP] + 1;
+ AV_COPY32(mv_cache[-1], mv[b_xy + b_stride * left_block[0]]);
+ ref_cache[-1] = ref[b8_xy + (left_block[0] & ~1)];
+ } else {
AV_ZERO32(mv_cache[-1]);
- ref_cache[-1]= left_type[LTOP] ? LIST_NOT_USED : PART_NOT_AVAILABLE;
+ ref_cache[-1] = left_type[LTOP] ? LIST_NOT_USED
+ : PART_NOT_AVAILABLE;
}
}
- if(USES_LIST(topright_type, list)){
- const int b_xy= h->mb2b_xy[topright_xy] + 3*b_stride;
- AV_COPY32(mv_cache[4 - 1*8], mv[b_xy]);
- ref_cache[4 - 1*8]= ref[4*topright_xy + 2];
- }else{
- AV_ZERO32(mv_cache[4 - 1*8]);
- ref_cache[4 - 1*8]= topright_type ? LIST_NOT_USED : PART_NOT_AVAILABLE;
+ if (USES_LIST(topright_type, list)) {
+ const int b_xy = h->mb2b_xy[topright_xy] + 3 * b_stride;
+ AV_COPY32(mv_cache[4 - 1 * 8], mv[b_xy]);
+ ref_cache[4 - 1 * 8] = ref[4 * topright_xy + 2];
+ } else {
+ AV_ZERO32(mv_cache[4 - 1 * 8]);
+ ref_cache[4 - 1 * 8] = topright_type ? LIST_NOT_USED
+ : PART_NOT_AVAILABLE;
}
- if(ref_cache[4 - 1*8] < 0){
- if(USES_LIST(topleft_type, list)){
- const int b_xy = h->mb2b_xy[topleft_xy] + 3 + b_stride + (h->topleft_partition & 2*b_stride);
- const int b8_xy= 4*topleft_xy + 1 + (h->topleft_partition & 2);
- AV_COPY32(mv_cache[-1 - 1*8], mv[b_xy]);
- ref_cache[-1 - 1*8]= ref[b8_xy];
- }else{
- AV_ZERO32(mv_cache[-1 - 1*8]);
- ref_cache[-1 - 1*8]= topleft_type ? LIST_NOT_USED : PART_NOT_AVAILABLE;
+ if (ref_cache[4 - 1 * 8] < 0) {
+ if (USES_LIST(topleft_type, list)) {
+ const int b_xy = h->mb2b_xy[topleft_xy] + 3 + b_stride +
+ (h->topleft_partition & 2 * b_stride);
+ const int b8_xy = 4 * topleft_xy + 1 + (h->topleft_partition & 2);
+ AV_COPY32(mv_cache[-1 - 1 * 8], mv[b_xy]);
+ ref_cache[-1 - 1 * 8] = ref[b8_xy];
+ } else {
+ AV_ZERO32(mv_cache[-1 - 1 * 8]);
+ ref_cache[-1 - 1 * 8] = topleft_type ? LIST_NOT_USED
+ : PART_NOT_AVAILABLE;
}
}
- if((mb_type&(MB_TYPE_SKIP|MB_TYPE_DIRECT2)) && !FRAME_MBAFF)
+ if ((mb_type & (MB_TYPE_SKIP | MB_TYPE_DIRECT2)) && !FRAME_MBAFF)
continue;
- if(!(mb_type&(MB_TYPE_SKIP|MB_TYPE_DIRECT2))){
- uint8_t (*mvd_cache)[2] = &h->mvd_cache[list][scan8[0]];
- uint8_t (*mvd)[2] = h->mvd_table[list];
- ref_cache[2+8*0] =
- ref_cache[2+8*2] = PART_NOT_AVAILABLE;
- AV_ZERO32(mv_cache[2+8*0]);
- AV_ZERO32(mv_cache[2+8*2]);
-
- if( CABAC ) {
- if(USES_LIST(top_type, list)){
- const int b_xy= h->mb2br_xy[top_xy];
- AV_COPY64(mvd_cache[0 - 1*8], mvd[b_xy + 0]);
- }else{
- AV_ZERO64(mvd_cache[0 - 1*8]);
+ if (!(mb_type & (MB_TYPE_SKIP | MB_TYPE_DIRECT2))) {
+ uint8_t(*mvd_cache)[2] = &h->mvd_cache[list][scan8[0]];
+ uint8_t(*mvd)[2] = h->mvd_table[list];
+ ref_cache[2 + 8 * 0] =
+ ref_cache[2 + 8 * 2] = PART_NOT_AVAILABLE;
+ AV_ZERO32(mv_cache[2 + 8 * 0]);
+ AV_ZERO32(mv_cache[2 + 8 * 2]);
+
+ if (CABAC) {
+ if (USES_LIST(top_type, list)) {
+ const int b_xy = h->mb2br_xy[top_xy];
+ AV_COPY64(mvd_cache[0 - 1 * 8], mvd[b_xy + 0]);
+ } else {
+ AV_ZERO64(mvd_cache[0 - 1 * 8]);
}
- if(USES_LIST(left_type[LTOP], list)){
- const int b_xy= h->mb2br_xy[left_xy[LTOP]] + 6;
- AV_COPY16(mvd_cache[-1 + 0*8], mvd[b_xy - left_block[0]]);
- AV_COPY16(mvd_cache[-1 + 1*8], mvd[b_xy - left_block[1]]);
- }else{
- AV_ZERO16(mvd_cache[-1 + 0*8]);
- AV_ZERO16(mvd_cache[-1 + 1*8]);
+ if (USES_LIST(left_type[LTOP], list)) {
+ const int b_xy = h->mb2br_xy[left_xy[LTOP]] + 6;
+ AV_COPY16(mvd_cache[-1 + 0 * 8], mvd[b_xy - left_block[0]]);
+ AV_COPY16(mvd_cache[-1 + 1 * 8], mvd[b_xy - left_block[1]]);
+ } else {
+ AV_ZERO16(mvd_cache[-1 + 0 * 8]);
+ AV_ZERO16(mvd_cache[-1 + 1 * 8]);
}
- if(USES_LIST(left_type[LBOT], list)){
- const int b_xy= h->mb2br_xy[left_xy[LBOT]] + 6;
- AV_COPY16(mvd_cache[-1 + 2*8], mvd[b_xy - left_block[2]]);
- AV_COPY16(mvd_cache[-1 + 3*8], mvd[b_xy - left_block[3]]);
- }else{
- AV_ZERO16(mvd_cache[-1 + 2*8]);
- AV_ZERO16(mvd_cache[-1 + 3*8]);
+ if (USES_LIST(left_type[LBOT], list)) {
+ const int b_xy = h->mb2br_xy[left_xy[LBOT]] + 6;
+ AV_COPY16(mvd_cache[-1 + 2 * 8], mvd[b_xy - left_block[2]]);
+ AV_COPY16(mvd_cache[-1 + 3 * 8], mvd[b_xy - left_block[3]]);
+ } else {
+ AV_ZERO16(mvd_cache[-1 + 2 * 8]);
+ AV_ZERO16(mvd_cache[-1 + 3 * 8]);
}
- AV_ZERO16(mvd_cache[2+8*0]);
- AV_ZERO16(mvd_cache[2+8*2]);
- if(h->slice_type_nos == AV_PICTURE_TYPE_B){
+ AV_ZERO16(mvd_cache[2 + 8 * 0]);
+ AV_ZERO16(mvd_cache[2 + 8 * 2]);
+ if (h->slice_type_nos == AV_PICTURE_TYPE_B) {
uint8_t *direct_cache = &h->direct_cache[scan8[0]];
uint8_t *direct_table = h->direct_table;
- fill_rectangle(direct_cache, 4, 4, 8, MB_TYPE_16x16>>1, 1);
-
- if(IS_DIRECT(top_type)){
- AV_WN32A(&direct_cache[-1*8], 0x01010101u*(MB_TYPE_DIRECT2>>1));
- }else if(IS_8X8(top_type)){
- int b8_xy = 4*top_xy;
- direct_cache[0 - 1*8]= direct_table[b8_xy + 2];
- direct_cache[2 - 1*8]= direct_table[b8_xy + 3];
- }else{
- AV_WN32A(&direct_cache[-1*8], 0x01010101*(MB_TYPE_16x16>>1));
+ fill_rectangle(direct_cache, 4, 4, 8, MB_TYPE_16x16 >> 1, 1);
+
+ if (IS_DIRECT(top_type)) {
+ AV_WN32A(&direct_cache[-1 * 8],
+ 0x01010101u * (MB_TYPE_DIRECT2 >> 1));
+ } else if (IS_8X8(top_type)) {
+ int b8_xy = 4 * top_xy;
+ direct_cache[0 - 1 * 8] = direct_table[b8_xy + 2];
+ direct_cache[2 - 1 * 8] = direct_table[b8_xy + 3];
+ } else {
+ AV_WN32A(&direct_cache[-1 * 8],
+ 0x01010101 * (MB_TYPE_16x16 >> 1));
}
- if(IS_DIRECT(left_type[LTOP]))
- direct_cache[-1 + 0*8]= MB_TYPE_DIRECT2>>1;
- else if(IS_8X8(left_type[LTOP]))
- direct_cache[-1 + 0*8]= direct_table[4*left_xy[LTOP] + 1 + (left_block[0]&~1)];
+ if (IS_DIRECT(left_type[LTOP]))
+ direct_cache[-1 + 0 * 8] = MB_TYPE_DIRECT2 >> 1;
+ else if (IS_8X8(left_type[LTOP]))
+ direct_cache[-1 + 0 * 8] = direct_table[4 * left_xy[LTOP] + 1 + (left_block[0] & ~1)];
else
- direct_cache[-1 + 0*8]= MB_TYPE_16x16>>1;
+ direct_cache[-1 + 0 * 8] = MB_TYPE_16x16 >> 1;
- if(IS_DIRECT(left_type[LBOT]))
- direct_cache[-1 + 2*8]= MB_TYPE_DIRECT2>>1;
- else if(IS_8X8(left_type[LBOT]))
- direct_cache[-1 + 2*8]= direct_table[4*left_xy[LBOT] + 1 + (left_block[2]&~1)];
+ if (IS_DIRECT(left_type[LBOT]))
+ direct_cache[-1 + 2 * 8] = MB_TYPE_DIRECT2 >> 1;
+ else if (IS_8X8(left_type[LBOT]))
+ direct_cache[-1 + 2 * 8] = direct_table[4 * left_xy[LBOT] + 1 + (left_block[2] & ~1)];
else
- direct_cache[-1 + 2*8]= MB_TYPE_16x16>>1;
+ direct_cache[-1 + 2 * 8] = MB_TYPE_16x16 >> 1;
}
}
}
- if(FRAME_MBAFF){
-#define MAP_MVS\
- MAP_F2F(scan8[0] - 1 - 1*8, topleft_type)\
- MAP_F2F(scan8[0] + 0 - 1*8, top_type)\
- MAP_F2F(scan8[0] + 1 - 1*8, top_type)\
- MAP_F2F(scan8[0] + 2 - 1*8, top_type)\
- MAP_F2F(scan8[0] + 3 - 1*8, top_type)\
- MAP_F2F(scan8[0] + 4 - 1*8, topright_type)\
- MAP_F2F(scan8[0] - 1 + 0*8, left_type[LTOP])\
- MAP_F2F(scan8[0] - 1 + 1*8, left_type[LTOP])\
- MAP_F2F(scan8[0] - 1 + 2*8, left_type[LBOT])\
- MAP_F2F(scan8[0] - 1 + 3*8, left_type[LBOT])
- if(MB_FIELD){
-#define MAP_F2F(idx, mb_type)\
- if(!IS_INTERLACED(mb_type) && h->ref_cache[list][idx] >= 0){\
- h->ref_cache[list][idx] <<= 1;\
- h->mv_cache[list][idx][1] /= 2;\
- h->mvd_cache[list][idx][1] >>=1;\
- }
+
+#define MAP_MVS \
+ MAP_F2F(scan8[0] - 1 - 1 * 8, topleft_type) \
+ MAP_F2F(scan8[0] + 0 - 1 * 8, top_type) \
+ MAP_F2F(scan8[0] + 1 - 1 * 8, top_type) \
+ MAP_F2F(scan8[0] + 2 - 1 * 8, top_type) \
+ MAP_F2F(scan8[0] + 3 - 1 * 8, top_type) \
+ MAP_F2F(scan8[0] + 4 - 1 * 8, topright_type) \
+ MAP_F2F(scan8[0] - 1 + 0 * 8, left_type[LTOP]) \
+ MAP_F2F(scan8[0] - 1 + 1 * 8, left_type[LTOP]) \
+ MAP_F2F(scan8[0] - 1 + 2 * 8, left_type[LBOT]) \
+ MAP_F2F(scan8[0] - 1 + 3 * 8, left_type[LBOT])
+
+ if (FRAME_MBAFF) {
+ if (MB_FIELD) {
+
+#define MAP_F2F(idx, mb_type) \
+ if (!IS_INTERLACED(mb_type) && h->ref_cache[list][idx] >= 0) { \
+ h->ref_cache[list][idx] <<= 1; \
+ h->mv_cache[list][idx][1] /= 2; \
+ h->mvd_cache[list][idx][1] >>= 1; \
+ }
+
MAP_MVS
+ } else {
+
#undef MAP_F2F
- }else{
-#define MAP_F2F(idx, mb_type)\
- if(IS_INTERLACED(mb_type) && h->ref_cache[list][idx] >= 0){\
- h->ref_cache[list][idx] >>= 1;\
- h->mv_cache[list][idx][1] <<= 1;\
- h->mvd_cache[list][idx][1] <<= 1;\
- }
+#define MAP_F2F(idx, mb_type) \
+ if (IS_INTERLACED(mb_type) && h->ref_cache[list][idx] >= 0) { \
+ h->ref_cache[list][idx] >>= 1; \
+ h->mv_cache[list][idx][1] <<= 1; \
+ h->mvd_cache[list][idx][1] <<= 1; \
+ }
+
MAP_MVS
#undef MAP_F2F
}
@@ -747,36 +792,34 @@ static void fill_decode_caches(H264Context *h, int mb_type){
}
}
- h->neighbor_transform_size= !!IS_8x8DCT(top_type) + !!IS_8x8DCT(left_type[LTOP]);
+ h->neighbor_transform_size = !!IS_8x8DCT(top_type) + !!IS_8x8DCT(left_type[LTOP]);
}
/**
* decodes a P_SKIP or B_SKIP macroblock
*/
-static void av_unused decode_mb_skip(H264Context *h){
- MpegEncContext * const s = &h->s;
- const int mb_xy= h->mb_xy;
- int mb_type=0;
+static void av_unused decode_mb_skip(H264Context *h)
+{
+ MpegEncContext *const s = &h->s;
+ const int mb_xy = h->mb_xy;
+ int mb_type = 0;
memset(h->non_zero_count[mb_xy], 0, 48);
- if(MB_FIELD)
- mb_type|= MB_TYPE_INTERLACED;
+ if (MB_FIELD)
+ mb_type |= MB_TYPE_INTERLACED;
- if( h->slice_type_nos == AV_PICTURE_TYPE_B )
- {
+ if (h->slice_type_nos == AV_PICTURE_TYPE_B) {
// just for fill_caches. pred_direct_motion will set the real mb_type
- mb_type|= MB_TYPE_L0L1|MB_TYPE_DIRECT2|MB_TYPE_SKIP;
- if(h->direct_spatial_mv_pred){
+ mb_type |= MB_TYPE_L0L1 | MB_TYPE_DIRECT2 | MB_TYPE_SKIP;
+ if (h->direct_spatial_mv_pred) {
fill_decode_neighbors(h, mb_type);
- fill_decode_caches(h, mb_type); //FIXME check what is needed and what not ...
+ fill_decode_caches(h, mb_type); //FIXME check what is needed and what not ...
}
ff_h264_pred_direct_motion(h, &mb_type);
- mb_type|= MB_TYPE_SKIP;
- }
- else
- {
- mb_type|= MB_TYPE_16x16|MB_TYPE_P0L0|MB_TYPE_P1L0|MB_TYPE_SKIP;
+ mb_type |= MB_TYPE_SKIP;
+ } else {
+ mb_type |= MB_TYPE_16x16 | MB_TYPE_P0L0 | MB_TYPE_P1L0 | MB_TYPE_SKIP;
fill_decode_neighbors(h, mb_type);
pred_pskip_motion(h);
@@ -785,8 +828,8 @@ static void av_unused decode_mb_skip(H264Context *h){
write_back_motion(h, mb_type);
s->current_picture.f.mb_type[mb_xy] = mb_type;
s->current_picture.f.qscale_table[mb_xy] = s->qscale;
- h->slice_table[ mb_xy ]= h->slice_num;
- h->prev_mb_skipped= 1;
+ h->slice_table[mb_xy] = h->slice_num;
+ h->prev_mb_skipped = 1;
}
#endif /* AVCODEC_H264_MVPRED_H */
diff --git a/gst-libs/ext/libav/libavcodec/h264_parser.c b/gst-libs/ext/libav/libavcodec/h264_parser.c
index 48215c5..0464476 100644
--- a/gst-libs/ext/libav/libavcodec/h264_parser.c
+++ b/gst-libs/ext/libav/libavcodec/h264_parser.c
@@ -37,7 +37,6 @@ static int ff_h264_find_frame_end(H264Context *h, const uint8_t *buf, int buf_si
int i;
uint32_t state;
ParseContext *pc = &(h->s.parse_context);
-//printf("first %02X%02X%02X%02X\n", buf[0], buf[1],buf[2],buf[3]);
// mb_addr= pc->mb_addr - 1;
state= pc->state;
if(state>13)
@@ -342,7 +341,7 @@ static int init(AVCodecParserContext *s)
}
AVCodecParser ff_h264_parser = {
- .codec_ids = { CODEC_ID_H264 },
+ .codec_ids = { AV_CODEC_ID_H264 },
.priv_data_size = sizeof(H264Context),
.parser_init = init,
.parser_parse = h264_parse,
diff --git a/gst-libs/ext/libav/libavcodec/h264_ps.c b/gst-libs/ext/libav/libavcodec/h264_ps.c
index 00c5003..ff6c077 100644
--- a/gst-libs/ext/libav/libavcodec/h264_ps.c
+++ b/gst-libs/ext/libav/libavcodec/h264_ps.c
@@ -341,7 +341,7 @@ int ff_h264_decode_seq_parameter_set(H264Context *h){
sps->chroma_format_idc= get_ue_golomb_31(&s->gb);
if(sps->chroma_format_idc > 3) {
av_log(h->s.avctx, AV_LOG_ERROR, "chroma_format_idc (%u) out of range\n", sps->chroma_format_idc);
- return -1;
+ goto fail;
} else if(sps->chroma_format_idc == 3) {
sps->residual_color_transform_flag = get_bits1(&s->gb);
}
@@ -361,7 +361,7 @@ int ff_h264_decode_seq_parameter_set(H264Context *h){
av_log(h->s.avctx, AV_LOG_ERROR,
"log2_max_frame_num_minus4 out of range (0-12): %d\n",
log2_max_frame_num_minus4);
- return AVERROR_INVALIDDATA;
+ goto fail;
}
sps->log2_max_frame_num = log2_max_frame_num_minus4 + 4;
@@ -447,6 +447,7 @@ int ff_h264_decode_seq_parameter_set(H264Context *h){
sps->sar.den= 1;
if(s->avctx->debug&FF_DEBUG_PICT_INFO){
+ static const char csp[4][5] = { "Gray", "420", "422", "444" };
av_log(h->s.avctx, AV_LOG_DEBUG, "sps:%u profile:%d/%d poc:%d ref:%d %dx%d %s %s crop:%d/%d/%d/%d %s %s %d/%d\n",
sps_id, sps->profile_idc, sps->level_idc,
sps->poc_type,
@@ -457,15 +458,18 @@ int ff_h264_decode_seq_parameter_set(H264Context *h){
sps->crop_left, sps->crop_right,
sps->crop_top, sps->crop_bottom,
sps->vui_parameters_present_flag ? "VUI" : "",
- ((const char*[]){"Gray","420","422","444"})[sps->chroma_format_idc],
+ csp[sps->chroma_format_idc],
sps->timing_info_present_flag ? sps->num_units_in_tick : 0,
sps->timing_info_present_flag ? sps->time_scale : 0
);
}
+ sps->new = 1;
av_free(h->sps_buffers[sps_id]);
- h->sps_buffers[sps_id]= sps;
- h->sps = *sps;
+ h->sps_buffers[sps_id] = sps;
+ h->sps = *sps;
+ h->current_sps_id = sps_id;
+
return 0;
fail:
av_free(sps);
diff --git a/gst-libs/ext/libav/libavcodec/h264_refs.c b/gst-libs/ext/libav/libavcodec/h264_refs.c
index 273c52b..0e4bd76 100644
--- a/gst-libs/ext/libav/libavcodec/h264_refs.c
+++ b/gst-libs/ext/libav/libavcodec/h264_refs.c
@@ -146,11 +146,11 @@ int ff_h264_fill_default_ref_list(H264Context *h){
}
#ifdef TRACE
for (i=0; i<h->ref_count[0]; i++) {
- tprintf(h->s.avctx, "List0: %s fn:%d 0x%p\n", (h->default_ref_list[0][i].long_ref ? "LT" : "ST"), h->default_ref_list[0][i].pic_id, h->default_ref_list[0][i].data[0]);
+ tprintf(h->s.avctx, "List0: %s fn:%d 0x%p\n", (h->default_ref_list[0][i].long_ref ? "LT" : "ST"), h->default_ref_list[0][i].pic_id, h->default_ref_list[0][i].f.data[0]);
}
if(h->slice_type_nos==AV_PICTURE_TYPE_B){
for (i=0; i<h->ref_count[1]; i++) {
- tprintf(h->s.avctx, "List1: %s fn:%d 0x%p\n", (h->default_ref_list[1][i].long_ref ? "LT" : "ST"), h->default_ref_list[1][i].pic_id, h->default_ref_list[1][i].data[0]);
+ tprintf(h->s.avctx, "List1: %s fn:%d 0x%p\n", (h->default_ref_list[1][i].long_ref ? "LT" : "ST"), h->default_ref_list[1][i].pic_id, h->default_ref_list[1][i].f.data[0]);
}
}
#endif
@@ -476,23 +476,52 @@ static void print_long_term(H264Context *h) {
}
}
-void ff_generate_sliding_window_mmcos(H264Context *h) {
+static int check_opcodes(MMCO *mmco1, MMCO *mmco2, int n_mmcos)
+{
+ int i;
+
+ for (i = 0; i < n_mmcos; i++) {
+ if (mmco1[i].opcode != mmco2[i].opcode)
+ return -1;
+ }
+
+ return 0;
+}
+
+int ff_generate_sliding_window_mmcos(H264Context *h, int first_slice)
+{
MpegEncContext * const s = &h->s;
+ MMCO mmco_temp[MAX_MMCO_COUNT], *mmco = first_slice ? h->mmco : mmco_temp;
+ int mmco_index = 0, i;
+
assert(h->long_ref_count + h->short_ref_count <= h->sps.ref_frame_count);
- h->mmco_index= 0;
- if(h->short_ref_count && h->long_ref_count + h->short_ref_count == h->sps.ref_frame_count &&
- !(FIELD_PICTURE && !s->first_field && s->current_picture_ptr->f.reference)) {
- h->mmco[0].opcode= MMCO_SHORT2UNUSED;
- h->mmco[0].short_pic_num= h->short_ref[ h->short_ref_count - 1 ]->frame_num;
- h->mmco_index= 1;
+ if (h->short_ref_count &&
+ h->long_ref_count + h->short_ref_count == h->sps.ref_frame_count &&
+ !(FIELD_PICTURE && !s->first_field &&
+ s->current_picture_ptr->f.reference)) {
+ mmco[0].opcode = MMCO_SHORT2UNUSED;
+ mmco[0].short_pic_num = h->short_ref[h->short_ref_count - 1]->frame_num;
+ mmco_index = 1;
if (FIELD_PICTURE) {
- h->mmco[0].short_pic_num *= 2;
- h->mmco[1].opcode= MMCO_SHORT2UNUSED;
- h->mmco[1].short_pic_num= h->mmco[0].short_pic_num + 1;
- h->mmco_index= 2;
+ mmco[0].short_pic_num *= 2;
+ mmco[1].opcode = MMCO_SHORT2UNUSED;
+ mmco[1].short_pic_num = mmco[0].short_pic_num + 1;
+ mmco_index = 2;
}
}
+
+ if (first_slice) {
+ h->mmco_index = mmco_index;
+ } else if (!first_slice && mmco_index >= 0 &&
+ (mmco_index != h->mmco_index ||
+ (i = check_opcodes(h->mmco, mmco_temp, mmco_index)))) {
+ av_log(h->s.avctx, AV_LOG_ERROR,
+ "Inconsistent MMCO state between slices [%d, %d, %d]\n",
+ mmco_index, h->mmco_index, i);
+ return AVERROR_INVALIDDATA;
+ }
+ return 0;
}
int ff_h264_execute_ref_pic_marking(H264Context *h, MMCO *mmco, int mmco_count){
@@ -654,52 +683,86 @@ int ff_h264_execute_ref_pic_marking(H264Context *h, MMCO *mmco, int mmco_count){
return (h->s.avctx->err_recognition & AV_EF_EXPLODE) ? err : 0;
}
-int ff_h264_decode_ref_pic_marking(H264Context *h, GetBitContext *gb){
+int ff_h264_decode_ref_pic_marking(H264Context *h, GetBitContext *gb,
+ int first_slice)
+{
MpegEncContext * const s = &h->s;
- int i;
-
- h->mmco_index= 0;
- if(h->nal_unit_type == NAL_IDR_SLICE){ //FIXME fields
- s->broken_link= get_bits1(gb) -1;
- if(get_bits1(gb)){
- h->mmco[0].opcode= MMCO_LONG;
- h->mmco[0].long_arg= 0;
- h->mmco_index= 1;
+ int i, ret;
+ MMCO mmco_temp[MAX_MMCO_COUNT], *mmco = first_slice ? h->mmco : mmco_temp;
+ int mmco_index = 0;
+
+ if (h->nal_unit_type == NAL_IDR_SLICE){ // FIXME fields
+ s->broken_link = get_bits1(gb) - 1;
+ if (get_bits1(gb)){
+ mmco[0].opcode = MMCO_LONG;
+ mmco[0].long_arg = 0;
+ mmco_index = 1;
}
- }else{
- if(get_bits1(gb)){ // adaptive_ref_pic_marking_mode_flag
- for(i= 0; i<MAX_MMCO_COUNT; i++) {
- MMCOOpcode opcode= get_ue_golomb_31(gb);
-
- h->mmco[i].opcode= opcode;
- if(opcode==MMCO_SHORT2UNUSED || opcode==MMCO_SHORT2LONG){
- h->mmco[i].short_pic_num= (h->curr_pic_num - get_ue_golomb(gb) - 1) & (h->max_pic_num - 1);
-/* if(h->mmco[i].short_pic_num >= h->short_ref_count || h->short_ref[ h->mmco[i].short_pic_num ] == NULL){
- av_log(s->avctx, AV_LOG_ERROR, "illegal short ref in memory management control operation %d\n", mmco);
+ } else {
+ if (get_bits1(gb)) { // adaptive_ref_pic_marking_mode_flag
+ for (i = 0; i < MAX_MMCO_COUNT; i++) {
+ MMCOOpcode opcode = get_ue_golomb_31(gb);
+
+ mmco[i].opcode = opcode;
+ if (opcode == MMCO_SHORT2UNUSED || opcode == MMCO_SHORT2LONG){
+ mmco[i].short_pic_num =
+ (h->curr_pic_num - get_ue_golomb(gb) - 1) &
+ (h->max_pic_num - 1);
+#if 0
+ if (mmco[i].short_pic_num >= h->short_ref_count ||
+ h->short_ref[ mmco[i].short_pic_num ] == NULL){
+ av_log(s->avctx, AV_LOG_ERROR,
+ "illegal short ref in memory management control "
+ "operation %d\n", mmco);
return -1;
- }*/
+ }
+#endif
}
- if(opcode==MMCO_SHORT2LONG || opcode==MMCO_LONG2UNUSED || opcode==MMCO_LONG || opcode==MMCO_SET_MAX_LONG){
- unsigned int long_arg= get_ue_golomb_31(gb);
- if(long_arg >= 32 || (long_arg >= 16 && !(opcode == MMCO_SET_MAX_LONG && long_arg == 16) && !(opcode == MMCO_LONG2UNUSED && FIELD_PICTURE))){
- av_log(h->s.avctx, AV_LOG_ERROR, "illegal long ref in memory management control operation %d\n", opcode);
+ if (opcode == MMCO_SHORT2LONG || opcode == MMCO_LONG2UNUSED ||
+ opcode == MMCO_LONG || opcode == MMCO_SET_MAX_LONG) {
+ unsigned int long_arg = get_ue_golomb_31(gb);
+ if (long_arg >= 32 ||
+ (long_arg >= 16 && !(opcode == MMCO_SET_MAX_LONG &&
+ long_arg == 16) &&
+ !(opcode == MMCO_LONG2UNUSED && FIELD_PICTURE))){
+ av_log(h->s.avctx, AV_LOG_ERROR,
+ "illegal long ref in memory management control "
+ "operation %d\n", opcode);
return -1;
}
- h->mmco[i].long_arg= long_arg;
+ mmco[i].long_arg = long_arg;
}
- if(opcode > (unsigned)MMCO_LONG){
- av_log(h->s.avctx, AV_LOG_ERROR, "illegal memory management control operation %d\n", opcode);
+ if (opcode > (unsigned) MMCO_LONG){
+ av_log(h->s.avctx, AV_LOG_ERROR,
+ "illegal memory management control operation %d\n",
+ opcode);
return -1;
}
- if(opcode == MMCO_END)
+ if (opcode == MMCO_END)
break;
}
- h->mmco_index= i;
- }else{
- ff_generate_sliding_window_mmcos(h);
+ mmco_index = i;
+ } else {
+ if (first_slice) {
+ ret = ff_generate_sliding_window_mmcos(h, first_slice);
+ if (ret < 0 && s->avctx->err_recognition & AV_EF_EXPLODE)
+ return ret;
+ }
+ mmco_index = -1;
}
}
+ if (first_slice && mmco_index != -1) {
+ h->mmco_index = mmco_index;
+ } else if (!first_slice && mmco_index >= 0 &&
+ (mmco_index != h->mmco_index ||
+ (i = check_opcodes(h->mmco, mmco_temp, mmco_index)))) {
+ av_log(h->s.avctx, AV_LOG_ERROR,
+ "Inconsistent MMCO state between slices [%d, %d, %d]\n",
+ mmco_index, h->mmco_index, i);
+ return AVERROR_INVALIDDATA;
+ }
+
return 0;
}
diff --git a/gst-libs/ext/libav/libavcodec/h264data.h b/gst-libs/ext/libav/libavcodec/h264data.h
index 2cfa548..5311c21 100644
--- a/gst-libs/ext/libav/libavcodec/h264data.h
+++ b/gst-libs/ext/libav/libavcodec/h264data.h
@@ -30,240 +30,243 @@
#define AVCODEC_H264DATA_H
#include <stdint.h>
+
#include "libavutil/rational.h"
#include "mpegvideo.h"
#include "h264.h"
+static const uint8_t golomb_to_pict_type[5] = {
+ AV_PICTURE_TYPE_P, AV_PICTURE_TYPE_B, AV_PICTURE_TYPE_I,
+ AV_PICTURE_TYPE_SP, AV_PICTURE_TYPE_SI
+};
-static const uint8_t golomb_to_pict_type[5]=
-{AV_PICTURE_TYPE_P, AV_PICTURE_TYPE_B, AV_PICTURE_TYPE_I, AV_PICTURE_TYPE_SP, AV_PICTURE_TYPE_SI};
-
-static const uint8_t golomb_to_intra4x4_cbp[48]={
- 47, 31, 15, 0, 23, 27, 29, 30, 7, 11, 13, 14, 39, 43, 45, 46,
- 16, 3, 5, 10, 12, 19, 21, 26, 28, 35, 37, 42, 44, 1, 2, 4,
- 8, 17, 18, 20, 24, 6, 9, 22, 25, 32, 33, 34, 36, 40, 38, 41
+static const uint8_t golomb_to_intra4x4_cbp[48] = {
+ 47, 31, 15, 0, 23, 27, 29, 30, 7, 11, 13, 14, 39, 43, 45, 46,
+ 16, 3, 5, 10, 12, 19, 21, 26, 28, 35, 37, 42, 44, 1, 2, 4,
+ 8, 17, 18, 20, 24, 6, 9, 22, 25, 32, 33, 34, 36, 40, 38, 41
};
-static const uint8_t golomb_to_inter_cbp[48]={
- 0, 16, 1, 2, 4, 8, 32, 3, 5, 10, 12, 15, 47, 7, 11, 13,
- 14, 6, 9, 31, 35, 37, 42, 44, 33, 34, 36, 40, 39, 43, 45, 46,
- 17, 18, 20, 24, 19, 21, 26, 28, 23, 27, 29, 30, 22, 25, 38, 41
+static const uint8_t golomb_to_inter_cbp[48] = {
+ 0, 16, 1, 2, 4, 8, 32, 3, 5, 10, 12, 15, 47, 7, 11, 13,
+ 14, 6, 9, 31, 35, 37, 42, 44, 33, 34, 36, 40, 39, 43, 45, 46,
+ 17, 18, 20, 24, 19, 21, 26, 28, 23, 27, 29, 30, 22, 25, 38, 41
};
-static const uint8_t zigzag_scan[16]={
- 0+0*4, 1+0*4, 0+1*4, 0+2*4,
- 1+1*4, 2+0*4, 3+0*4, 2+1*4,
- 1+2*4, 0+3*4, 1+3*4, 2+2*4,
- 3+1*4, 3+2*4, 2+3*4, 3+3*4,
+static const uint8_t zigzag_scan[16] = {
+ 0 + 0 * 4, 1 + 0 * 4, 0 + 1 * 4, 0 + 2 * 4,
+ 1 + 1 * 4, 2 + 0 * 4, 3 + 0 * 4, 2 + 1 * 4,
+ 1 + 2 * 4, 0 + 3 * 4, 1 + 3 * 4, 2 + 2 * 4,
+ 3 + 1 * 4, 3 + 2 * 4, 2 + 3 * 4, 3 + 3 * 4,
};
-static const uint8_t field_scan[16]={
- 0+0*4, 0+1*4, 1+0*4, 0+2*4,
- 0+3*4, 1+1*4, 1+2*4, 1+3*4,
- 2+0*4, 2+1*4, 2+2*4, 2+3*4,
- 3+0*4, 3+1*4, 3+2*4, 3+3*4,
+static const uint8_t field_scan[16] = {
+ 0 + 0 * 4, 0 + 1 * 4, 1 + 0 * 4, 0 + 2 * 4,
+ 0 + 3 * 4, 1 + 1 * 4, 1 + 2 * 4, 1 + 3 * 4,
+ 2 + 0 * 4, 2 + 1 * 4, 2 + 2 * 4, 2 + 3 * 4,
+ 3 + 0 * 4, 3 + 1 * 4, 3 + 2 * 4, 3 + 3 * 4,
};
-static const uint8_t luma_dc_zigzag_scan[16]={
- 0*16 + 0*64, 1*16 + 0*64, 2*16 + 0*64, 0*16 + 2*64,
- 3*16 + 0*64, 0*16 + 1*64, 1*16 + 1*64, 2*16 + 1*64,
- 1*16 + 2*64, 2*16 + 2*64, 3*16 + 2*64, 0*16 + 3*64,
- 3*16 + 1*64, 1*16 + 3*64, 2*16 + 3*64, 3*16 + 3*64,
+static const uint8_t luma_dc_zigzag_scan[16] = {
+ 0 * 16 + 0 * 64, 1 * 16 + 0 * 64, 2 * 16 + 0 * 64, 0 * 16 + 2 * 64,
+ 3 * 16 + 0 * 64, 0 * 16 + 1 * 64, 1 * 16 + 1 * 64, 2 * 16 + 1 * 64,
+ 1 * 16 + 2 * 64, 2 * 16 + 2 * 64, 3 * 16 + 2 * 64, 0 * 16 + 3 * 64,
+ 3 * 16 + 1 * 64, 1 * 16 + 3 * 64, 2 * 16 + 3 * 64, 3 * 16 + 3 * 64,
};
-static const uint8_t luma_dc_field_scan[16]={
- 0*16 + 0*64, 2*16 + 0*64, 1*16 + 0*64, 0*16 + 2*64,
- 2*16 + 2*64, 3*16 + 0*64, 1*16 + 2*64, 3*16 + 2*64,
- 0*16 + 1*64, 2*16 + 1*64, 0*16 + 3*64, 2*16 + 3*64,
- 1*16 + 1*64, 3*16 + 1*64, 1*16 + 3*64, 3*16 + 3*64,
+static const uint8_t luma_dc_field_scan[16] = {
+ 0 * 16 + 0 * 64, 2 * 16 + 0 * 64, 1 * 16 + 0 * 64, 0 * 16 + 2 * 64,
+ 2 * 16 + 2 * 64, 3 * 16 + 0 * 64, 1 * 16 + 2 * 64, 3 * 16 + 2 * 64,
+ 0 * 16 + 1 * 64, 2 * 16 + 1 * 64, 0 * 16 + 3 * 64, 2 * 16 + 3 * 64,
+ 1 * 16 + 1 * 64, 3 * 16 + 1 * 64, 1 * 16 + 3 * 64, 3 * 16 + 3 * 64,
};
-static const uint8_t chroma_dc_scan[4]={
- (0+0*2)*16, (1+0*2)*16,
- (0+1*2)*16, (1+1*2)*16,
+static const uint8_t chroma_dc_scan[4] = {
+ (0 + 0 * 2) * 16, (1 + 0 * 2) * 16,
+ (0 + 1 * 2) * 16, (1 + 1 * 2) * 16,
};
-static const uint8_t chroma422_dc_scan[8]={
- (0+0*2)*16, (0+1*2)*16,
- (1+0*2)*16, (0+2*2)*16,
- (0+3*2)*16, (1+1*2)*16,
- (1+2*2)*16, (1+3*2)*16,
+static const uint8_t chroma422_dc_scan[8] = {
+ (0 + 0 * 2) * 16, (0 + 1 * 2) * 16,
+ (1 + 0 * 2) * 16, (0 + 2 * 2) * 16,
+ (0 + 3 * 2) * 16, (1 + 1 * 2) * 16,
+ (1 + 2 * 2) * 16, (1 + 3 * 2) * 16,
};
// zigzag_scan8x8_cavlc[i] = zigzag_scan8x8[(i/4) + 16*(i%4)]
-static const uint8_t zigzag_scan8x8_cavlc[64]={
- 0+0*8, 1+1*8, 1+2*8, 2+2*8,
- 4+1*8, 0+5*8, 3+3*8, 7+0*8,
- 3+4*8, 1+7*8, 5+3*8, 6+3*8,
- 2+7*8, 6+4*8, 5+6*8, 7+5*8,
- 1+0*8, 2+0*8, 0+3*8, 3+1*8,
- 3+2*8, 0+6*8, 4+2*8, 6+1*8,
- 2+5*8, 2+6*8, 6+2*8, 5+4*8,
- 3+7*8, 7+3*8, 4+7*8, 7+6*8,
- 0+1*8, 3+0*8, 0+4*8, 4+0*8,
- 2+3*8, 1+5*8, 5+1*8, 5+2*8,
- 1+6*8, 3+5*8, 7+1*8, 4+5*8,
- 4+6*8, 7+4*8, 5+7*8, 6+7*8,
- 0+2*8, 2+1*8, 1+3*8, 5+0*8,
- 1+4*8, 2+4*8, 6+0*8, 4+3*8,
- 0+7*8, 4+4*8, 7+2*8, 3+6*8,
- 5+5*8, 6+5*8, 6+6*8, 7+7*8,
+static const uint8_t zigzag_scan8x8_cavlc[64] = {
+ 0 + 0 * 8, 1 + 1 * 8, 1 + 2 * 8, 2 + 2 * 8,
+ 4 + 1 * 8, 0 + 5 * 8, 3 + 3 * 8, 7 + 0 * 8,
+ 3 + 4 * 8, 1 + 7 * 8, 5 + 3 * 8, 6 + 3 * 8,
+ 2 + 7 * 8, 6 + 4 * 8, 5 + 6 * 8, 7 + 5 * 8,
+ 1 + 0 * 8, 2 + 0 * 8, 0 + 3 * 8, 3 + 1 * 8,
+ 3 + 2 * 8, 0 + 6 * 8, 4 + 2 * 8, 6 + 1 * 8,
+ 2 + 5 * 8, 2 + 6 * 8, 6 + 2 * 8, 5 + 4 * 8,
+ 3 + 7 * 8, 7 + 3 * 8, 4 + 7 * 8, 7 + 6 * 8,
+ 0 + 1 * 8, 3 + 0 * 8, 0 + 4 * 8, 4 + 0 * 8,
+ 2 + 3 * 8, 1 + 5 * 8, 5 + 1 * 8, 5 + 2 * 8,
+ 1 + 6 * 8, 3 + 5 * 8, 7 + 1 * 8, 4 + 5 * 8,
+ 4 + 6 * 8, 7 + 4 * 8, 5 + 7 * 8, 6 + 7 * 8,
+ 0 + 2 * 8, 2 + 1 * 8, 1 + 3 * 8, 5 + 0 * 8,
+ 1 + 4 * 8, 2 + 4 * 8, 6 + 0 * 8, 4 + 3 * 8,
+ 0 + 7 * 8, 4 + 4 * 8, 7 + 2 * 8, 3 + 6 * 8,
+ 5 + 5 * 8, 6 + 5 * 8, 6 + 6 * 8, 7 + 7 * 8,
};
-static const uint8_t field_scan8x8[64]={
- 0+0*8, 0+1*8, 0+2*8, 1+0*8,
- 1+1*8, 0+3*8, 0+4*8, 1+2*8,
- 2+0*8, 1+3*8, 0+5*8, 0+6*8,
- 0+7*8, 1+4*8, 2+1*8, 3+0*8,
- 2+2*8, 1+5*8, 1+6*8, 1+7*8,
- 2+3*8, 3+1*8, 4+0*8, 3+2*8,
- 2+4*8, 2+5*8, 2+6*8, 2+7*8,
- 3+3*8, 4+1*8, 5+0*8, 4+2*8,
- 3+4*8, 3+5*8, 3+6*8, 3+7*8,
- 4+3*8, 5+1*8, 6+0*8, 5+2*8,
- 4+4*8, 4+5*8, 4+6*8, 4+7*8,
- 5+3*8, 6+1*8, 6+2*8, 5+4*8,
- 5+5*8, 5+6*8, 5+7*8, 6+3*8,
- 7+0*8, 7+1*8, 6+4*8, 6+5*8,
- 6+6*8, 6+7*8, 7+2*8, 7+3*8,
- 7+4*8, 7+5*8, 7+6*8, 7+7*8,
+static const uint8_t field_scan8x8[64] = {
+ 0 + 0 * 8, 0 + 1 * 8, 0 + 2 * 8, 1 + 0 * 8,
+ 1 + 1 * 8, 0 + 3 * 8, 0 + 4 * 8, 1 + 2 * 8,
+ 2 + 0 * 8, 1 + 3 * 8, 0 + 5 * 8, 0 + 6 * 8,
+ 0 + 7 * 8, 1 + 4 * 8, 2 + 1 * 8, 3 + 0 * 8,
+ 2 + 2 * 8, 1 + 5 * 8, 1 + 6 * 8, 1 + 7 * 8,
+ 2 + 3 * 8, 3 + 1 * 8, 4 + 0 * 8, 3 + 2 * 8,
+ 2 + 4 * 8, 2 + 5 * 8, 2 + 6 * 8, 2 + 7 * 8,
+ 3 + 3 * 8, 4 + 1 * 8, 5 + 0 * 8, 4 + 2 * 8,
+ 3 + 4 * 8, 3 + 5 * 8, 3 + 6 * 8, 3 + 7 * 8,
+ 4 + 3 * 8, 5 + 1 * 8, 6 + 0 * 8, 5 + 2 * 8,
+ 4 + 4 * 8, 4 + 5 * 8, 4 + 6 * 8, 4 + 7 * 8,
+ 5 + 3 * 8, 6 + 1 * 8, 6 + 2 * 8, 5 + 4 * 8,
+ 5 + 5 * 8, 5 + 6 * 8, 5 + 7 * 8, 6 + 3 * 8,
+ 7 + 0 * 8, 7 + 1 * 8, 6 + 4 * 8, 6 + 5 * 8,
+ 6 + 6 * 8, 6 + 7 * 8, 7 + 2 * 8, 7 + 3 * 8,
+ 7 + 4 * 8, 7 + 5 * 8, 7 + 6 * 8, 7 + 7 * 8,
};
-static const uint8_t field_scan8x8_cavlc[64]={
- 0+0*8, 1+1*8, 2+0*8, 0+7*8,
- 2+2*8, 2+3*8, 2+4*8, 3+3*8,
- 3+4*8, 4+3*8, 4+4*8, 5+3*8,
- 5+5*8, 7+0*8, 6+6*8, 7+4*8,
- 0+1*8, 0+3*8, 1+3*8, 1+4*8,
- 1+5*8, 3+1*8, 2+5*8, 4+1*8,
- 3+5*8, 5+1*8, 4+5*8, 6+1*8,
- 5+6*8, 7+1*8, 6+7*8, 7+5*8,
- 0+2*8, 0+4*8, 0+5*8, 2+1*8,
- 1+6*8, 4+0*8, 2+6*8, 5+0*8,
- 3+6*8, 6+0*8, 4+6*8, 6+2*8,
- 5+7*8, 6+4*8, 7+2*8, 7+6*8,
- 1+0*8, 1+2*8, 0+6*8, 3+0*8,
- 1+7*8, 3+2*8, 2+7*8, 4+2*8,
- 3+7*8, 5+2*8, 4+7*8, 5+4*8,
- 6+3*8, 6+5*8, 7+3*8, 7+7*8,
+static const uint8_t field_scan8x8_cavlc[64] = {
+ 0 + 0 * 8, 1 + 1 * 8, 2 + 0 * 8, 0 + 7 * 8,
+ 2 + 2 * 8, 2 + 3 * 8, 2 + 4 * 8, 3 + 3 * 8,
+ 3 + 4 * 8, 4 + 3 * 8, 4 + 4 * 8, 5 + 3 * 8,
+ 5 + 5 * 8, 7 + 0 * 8, 6 + 6 * 8, 7 + 4 * 8,
+ 0 + 1 * 8, 0 + 3 * 8, 1 + 3 * 8, 1 + 4 * 8,
+ 1 + 5 * 8, 3 + 1 * 8, 2 + 5 * 8, 4 + 1 * 8,
+ 3 + 5 * 8, 5 + 1 * 8, 4 + 5 * 8, 6 + 1 * 8,
+ 5 + 6 * 8, 7 + 1 * 8, 6 + 7 * 8, 7 + 5 * 8,
+ 0 + 2 * 8, 0 + 4 * 8, 0 + 5 * 8, 2 + 1 * 8,
+ 1 + 6 * 8, 4 + 0 * 8, 2 + 6 * 8, 5 + 0 * 8,
+ 3 + 6 * 8, 6 + 0 * 8, 4 + 6 * 8, 6 + 2 * 8,
+ 5 + 7 * 8, 6 + 4 * 8, 7 + 2 * 8, 7 + 6 * 8,
+ 1 + 0 * 8, 1 + 2 * 8, 0 + 6 * 8, 3 + 0 * 8,
+ 1 + 7 * 8, 3 + 2 * 8, 2 + 7 * 8, 4 + 2 * 8,
+ 3 + 7 * 8, 5 + 2 * 8, 4 + 7 * 8, 5 + 4 * 8,
+ 6 + 3 * 8, 6 + 5 * 8, 7 + 3 * 8, 7 + 7 * 8,
};
-typedef struct IMbInfo{
+typedef struct IMbInfo {
uint16_t type;
uint8_t pred_mode;
uint8_t cbp;
} IMbInfo;
-static const IMbInfo i_mb_type_info[26]={
-{MB_TYPE_INTRA4x4 , -1, -1},
-{MB_TYPE_INTRA16x16, 2, 0},
-{MB_TYPE_INTRA16x16, 1, 0},
-{MB_TYPE_INTRA16x16, 0, 0},
-{MB_TYPE_INTRA16x16, 3, 0},
-{MB_TYPE_INTRA16x16, 2, 16},
-{MB_TYPE_INTRA16x16, 1, 16},
-{MB_TYPE_INTRA16x16, 0, 16},
-{MB_TYPE_INTRA16x16, 3, 16},
-{MB_TYPE_INTRA16x16, 2, 32},
-{MB_TYPE_INTRA16x16, 1, 32},
-{MB_TYPE_INTRA16x16, 0, 32},
-{MB_TYPE_INTRA16x16, 3, 32},
-{MB_TYPE_INTRA16x16, 2, 15+0},
-{MB_TYPE_INTRA16x16, 1, 15+0},
-{MB_TYPE_INTRA16x16, 0, 15+0},
-{MB_TYPE_INTRA16x16, 3, 15+0},
-{MB_TYPE_INTRA16x16, 2, 15+16},
-{MB_TYPE_INTRA16x16, 1, 15+16},
-{MB_TYPE_INTRA16x16, 0, 15+16},
-{MB_TYPE_INTRA16x16, 3, 15+16},
-{MB_TYPE_INTRA16x16, 2, 15+32},
-{MB_TYPE_INTRA16x16, 1, 15+32},
-{MB_TYPE_INTRA16x16, 0, 15+32},
-{MB_TYPE_INTRA16x16, 3, 15+32},
-{MB_TYPE_INTRA_PCM , -1, -1},
+static const IMbInfo i_mb_type_info[26] = {
+ { MB_TYPE_INTRA4x4, -1, -1 },
+ { MB_TYPE_INTRA16x16, 2, 0 },
+ { MB_TYPE_INTRA16x16, 1, 0 },
+ { MB_TYPE_INTRA16x16, 0, 0 },
+ { MB_TYPE_INTRA16x16, 3, 0 },
+ { MB_TYPE_INTRA16x16, 2, 16 },
+ { MB_TYPE_INTRA16x16, 1, 16 },
+ { MB_TYPE_INTRA16x16, 0, 16 },
+ { MB_TYPE_INTRA16x16, 3, 16 },
+ { MB_TYPE_INTRA16x16, 2, 32 },
+ { MB_TYPE_INTRA16x16, 1, 32 },
+ { MB_TYPE_INTRA16x16, 0, 32 },
+ { MB_TYPE_INTRA16x16, 3, 32 },
+ { MB_TYPE_INTRA16x16, 2, 15 + 0 },
+ { MB_TYPE_INTRA16x16, 1, 15 + 0 },
+ { MB_TYPE_INTRA16x16, 0, 15 + 0 },
+ { MB_TYPE_INTRA16x16, 3, 15 + 0 },
+ { MB_TYPE_INTRA16x16, 2, 15 + 16 },
+ { MB_TYPE_INTRA16x16, 1, 15 + 16 },
+ { MB_TYPE_INTRA16x16, 0, 15 + 16 },
+ { MB_TYPE_INTRA16x16, 3, 15 + 16 },
+ { MB_TYPE_INTRA16x16, 2, 15 + 32 },
+ { MB_TYPE_INTRA16x16, 1, 15 + 32 },
+ { MB_TYPE_INTRA16x16, 0, 15 + 32 },
+ { MB_TYPE_INTRA16x16, 3, 15 + 32 },
+ { MB_TYPE_INTRA_PCM, -1, -1 },
};
-typedef struct PMbInfo{
+typedef struct PMbInfo {
uint16_t type;
uint8_t partition_count;
} PMbInfo;
-static const PMbInfo p_mb_type_info[5]={
-{MB_TYPE_16x16|MB_TYPE_P0L0 , 1},
-{MB_TYPE_16x8 |MB_TYPE_P0L0|MB_TYPE_P1L0, 2},
-{MB_TYPE_8x16 |MB_TYPE_P0L0|MB_TYPE_P1L0, 2},
-{MB_TYPE_8x8 |MB_TYPE_P0L0|MB_TYPE_P1L0, 4},
-{MB_TYPE_8x8 |MB_TYPE_P0L0|MB_TYPE_P1L0|MB_TYPE_REF0, 4},
+static const PMbInfo p_mb_type_info[5] = {
+ { MB_TYPE_16x16 | MB_TYPE_P0L0, 1 },
+ { MB_TYPE_16x8 | MB_TYPE_P0L0 | MB_TYPE_P1L0, 2 },
+ { MB_TYPE_8x16 | MB_TYPE_P0L0 | MB_TYPE_P1L0, 2 },
+ { MB_TYPE_8x8 | MB_TYPE_P0L0 | MB_TYPE_P1L0, 4 },
+ { MB_TYPE_8x8 | MB_TYPE_P0L0 | MB_TYPE_P1L0 | MB_TYPE_REF0, 4 },
};
-static const PMbInfo p_sub_mb_type_info[4]={
-{MB_TYPE_16x16|MB_TYPE_P0L0 , 1},
-{MB_TYPE_16x8 |MB_TYPE_P0L0 , 2},
-{MB_TYPE_8x16 |MB_TYPE_P0L0 , 2},
-{MB_TYPE_8x8 |MB_TYPE_P0L0 , 4},
+static const PMbInfo p_sub_mb_type_info[4] = {
+ { MB_TYPE_16x16 | MB_TYPE_P0L0, 1 },
+ { MB_TYPE_16x8 | MB_TYPE_P0L0, 2 },
+ { MB_TYPE_8x16 | MB_TYPE_P0L0, 2 },
+ { MB_TYPE_8x8 | MB_TYPE_P0L0, 4 },
};
-static const PMbInfo b_mb_type_info[23]={
-{MB_TYPE_DIRECT2|MB_TYPE_L0L1 , 1, },
-{MB_TYPE_16x16|MB_TYPE_P0L0 , 1, },
-{MB_TYPE_16x16 |MB_TYPE_P0L1 , 1, },
-{MB_TYPE_16x16|MB_TYPE_P0L0|MB_TYPE_P0L1 , 1, },
-{MB_TYPE_16x8 |MB_TYPE_P0L0 |MB_TYPE_P1L0 , 2, },
-{MB_TYPE_8x16 |MB_TYPE_P0L0 |MB_TYPE_P1L0 , 2, },
-{MB_TYPE_16x8 |MB_TYPE_P0L1 |MB_TYPE_P1L1, 2, },
-{MB_TYPE_8x16 |MB_TYPE_P0L1 |MB_TYPE_P1L1, 2, },
-{MB_TYPE_16x8 |MB_TYPE_P0L0 |MB_TYPE_P1L1, 2, },
-{MB_TYPE_8x16 |MB_TYPE_P0L0 |MB_TYPE_P1L1, 2, },
-{MB_TYPE_16x8 |MB_TYPE_P0L1|MB_TYPE_P1L0 , 2, },
-{MB_TYPE_8x16 |MB_TYPE_P0L1|MB_TYPE_P1L0 , 2, },
-{MB_TYPE_16x8 |MB_TYPE_P0L0 |MB_TYPE_P1L0|MB_TYPE_P1L1, 2, },
-{MB_TYPE_8x16 |MB_TYPE_P0L0 |MB_TYPE_P1L0|MB_TYPE_P1L1, 2, },
-{MB_TYPE_16x8 |MB_TYPE_P0L1|MB_TYPE_P1L0|MB_TYPE_P1L1, 2, },
-{MB_TYPE_8x16 |MB_TYPE_P0L1|MB_TYPE_P1L0|MB_TYPE_P1L1, 2, },
-{MB_TYPE_16x8 |MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_P1L0 , 2, },
-{MB_TYPE_8x16 |MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_P1L0 , 2, },
-{MB_TYPE_16x8 |MB_TYPE_P0L0|MB_TYPE_P0L1 |MB_TYPE_P1L1, 2, },
-{MB_TYPE_8x16 |MB_TYPE_P0L0|MB_TYPE_P0L1 |MB_TYPE_P1L1, 2, },
-{MB_TYPE_16x8 |MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_P1L0|MB_TYPE_P1L1, 2, },
-{MB_TYPE_8x16 |MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_P1L0|MB_TYPE_P1L1, 2, },
-{MB_TYPE_8x8 |MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_P1L0|MB_TYPE_P1L1, 4, },
+static const PMbInfo b_mb_type_info[23] = {
+ { MB_TYPE_DIRECT2 | MB_TYPE_L0L1, 1, },
+ { MB_TYPE_16x16 | MB_TYPE_P0L0, 1, },
+ { MB_TYPE_16x16 | MB_TYPE_P0L1, 1, },
+ { MB_TYPE_16x16 | MB_TYPE_P0L0 | MB_TYPE_P0L1, 1, },
+ { MB_TYPE_16x8 | MB_TYPE_P0L0 | MB_TYPE_P1L0, 2, },
+ { MB_TYPE_8x16 | MB_TYPE_P0L0 | MB_TYPE_P1L0, 2, },
+ { MB_TYPE_16x8 | MB_TYPE_P0L1 | MB_TYPE_P1L1, 2, },
+ { MB_TYPE_8x16 | MB_TYPE_P0L1 | MB_TYPE_P1L1, 2, },
+ { MB_TYPE_16x8 | MB_TYPE_P0L0 | MB_TYPE_P1L1, 2, },
+ { MB_TYPE_8x16 | MB_TYPE_P0L0 | MB_TYPE_P1L1, 2, },
+ { MB_TYPE_16x8 | MB_TYPE_P0L1 | MB_TYPE_P1L0, 2, },
+ { MB_TYPE_8x16 | MB_TYPE_P0L1 | MB_TYPE_P1L0, 2, },
+ { MB_TYPE_16x8 | MB_TYPE_P0L0 | MB_TYPE_P1L0 | MB_TYPE_P1L1, 2, },
+ { MB_TYPE_8x16 | MB_TYPE_P0L0 | MB_TYPE_P1L0 | MB_TYPE_P1L1, 2, },
+ { MB_TYPE_16x8 | MB_TYPE_P0L1 | MB_TYPE_P1L0 | MB_TYPE_P1L1, 2, },
+ { MB_TYPE_8x16 | MB_TYPE_P0L1 | MB_TYPE_P1L0 | MB_TYPE_P1L1, 2, },
+ { MB_TYPE_16x8 | MB_TYPE_P0L0 | MB_TYPE_P0L1 | MB_TYPE_P1L0, 2, },
+ { MB_TYPE_8x16 | MB_TYPE_P0L0 | MB_TYPE_P0L1 | MB_TYPE_P1L0, 2, },
+ { MB_TYPE_16x8 | MB_TYPE_P0L0 | MB_TYPE_P0L1 | MB_TYPE_P1L1, 2, },
+ { MB_TYPE_8x16 | MB_TYPE_P0L0 | MB_TYPE_P0L1 | MB_TYPE_P1L1, 2, },
+ { MB_TYPE_16x8 | MB_TYPE_P0L0 | MB_TYPE_P0L1 | MB_TYPE_P1L0 | MB_TYPE_P1L1, 2, },
+ { MB_TYPE_8x16 | MB_TYPE_P0L0 | MB_TYPE_P0L1 | MB_TYPE_P1L0 | MB_TYPE_P1L1, 2, },
+ { MB_TYPE_8x8 | MB_TYPE_P0L0 | MB_TYPE_P0L1 | MB_TYPE_P1L0 | MB_TYPE_P1L1, 4, },
};
-static const PMbInfo b_sub_mb_type_info[13]={
-{MB_TYPE_DIRECT2 , 1, },
-{MB_TYPE_16x16|MB_TYPE_P0L0 , 1, },
-{MB_TYPE_16x16 |MB_TYPE_P0L1 , 1, },
-{MB_TYPE_16x16|MB_TYPE_P0L0|MB_TYPE_P0L1 , 1, },
-{MB_TYPE_16x8 |MB_TYPE_P0L0 |MB_TYPE_P1L0 , 2, },
-{MB_TYPE_8x16 |MB_TYPE_P0L0 |MB_TYPE_P1L0 , 2, },
-{MB_TYPE_16x8 |MB_TYPE_P0L1 |MB_TYPE_P1L1, 2, },
-{MB_TYPE_8x16 |MB_TYPE_P0L1 |MB_TYPE_P1L1, 2, },
-{MB_TYPE_16x8 |MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_P1L0|MB_TYPE_P1L1, 2, },
-{MB_TYPE_8x16 |MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_P1L0|MB_TYPE_P1L1, 2, },
-{MB_TYPE_8x8 |MB_TYPE_P0L0 |MB_TYPE_P1L0 , 4, },
-{MB_TYPE_8x8 |MB_TYPE_P0L1 |MB_TYPE_P1L1, 4, },
-{MB_TYPE_8x8 |MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_P1L0|MB_TYPE_P1L1, 4, },
+static const PMbInfo b_sub_mb_type_info[13] = {
+ { MB_TYPE_DIRECT2, 1, },
+ { MB_TYPE_16x16 | MB_TYPE_P0L0, 1, },
+ { MB_TYPE_16x16 | MB_TYPE_P0L1, 1, },
+ { MB_TYPE_16x16 | MB_TYPE_P0L0 | MB_TYPE_P0L1, 1, },
+ { MB_TYPE_16x8 | MB_TYPE_P0L0 | MB_TYPE_P1L0, 2, },
+ { MB_TYPE_8x16 | MB_TYPE_P0L0 | MB_TYPE_P1L0, 2, },
+ { MB_TYPE_16x8 | MB_TYPE_P0L1 | MB_TYPE_P1L1, 2, },
+ { MB_TYPE_8x16 | MB_TYPE_P0L1 | MB_TYPE_P1L1, 2, },
+ { MB_TYPE_16x8 | MB_TYPE_P0L0 | MB_TYPE_P0L1 | MB_TYPE_P1L0 | MB_TYPE_P1L1, 2, },
+ { MB_TYPE_8x16 | MB_TYPE_P0L0 | MB_TYPE_P0L1 | MB_TYPE_P1L0 | MB_TYPE_P1L1, 2, },
+ { MB_TYPE_8x8 | MB_TYPE_P0L0 | MB_TYPE_P1L0, 4, },
+ { MB_TYPE_8x8 | MB_TYPE_P0L1 | MB_TYPE_P1L1, 4, },
+ { MB_TYPE_8x8 | MB_TYPE_P0L0 | MB_TYPE_P0L1 | MB_TYPE_P1L0 | MB_TYPE_P1L1, 4, },
};
-static const uint8_t dequant4_coeff_init[6][3]={
- {10,13,16},
- {11,14,18},
- {13,16,20},
- {14,18,23},
- {16,20,25},
- {18,23,29},
+static const uint8_t dequant4_coeff_init[6][3] = {
+ { 10, 13, 16 },
+ { 11, 14, 18 },
+ { 13, 16, 20 },
+ { 14, 18, 23 },
+ { 16, 20, 25 },
+ { 18, 23, 29 },
};
static const uint8_t dequant8_coeff_init_scan[16] = {
- 0,3,4,3, 3,1,5,1, 4,5,2,5, 3,1,5,1
+ 0, 3, 4, 3, 3, 1, 5, 1, 4, 5, 2, 5, 3, 1, 5, 1
};
-static const uint8_t dequant8_coeff_init[6][6]={
- {20,18,32,19,25,24},
- {22,19,35,21,28,26},
- {26,23,42,24,33,31},
- {28,25,45,26,35,33},
- {32,28,51,30,40,38},
- {36,32,58,34,46,43},
+
+static const uint8_t dequant8_coeff_init[6][6] = {
+ { 20, 18, 32, 19, 25, 24 },
+ { 22, 19, 35, 21, 28, 26 },
+ { 26, 23, 42, 24, 33, 31 },
+ { 28, 25, 45, 26, 35, 33 },
+ { 32, 28, 51, 30, 40, 38 },
+ { 36, 32, 58, 34, 46, 43 },
};
#endif /* AVCODEC_H264DATA_H */
diff --git a/gst-libs/ext/libav/libavcodec/h264dsp.c b/gst-libs/ext/libav/libavcodec/h264dsp.c
index ba96707..1353c1a 100644
--- a/gst-libs/ext/libav/libavcodec/h264dsp.c
+++ b/gst-libs/ext/libav/libavcodec/h264dsp.c
@@ -28,6 +28,7 @@
#include <stdint.h>
#include "avcodec.h"
#include "h264dsp.h"
+#include "libavutil/common.h"
#define BIT_DEPTH 8
#include "h264dsp_template.c"
@@ -113,5 +114,5 @@ void ff_h264dsp_init(H264DSPContext *c, const int bit_depth, const int chroma_fo
if (ARCH_ARM) ff_h264dsp_init_arm(c, bit_depth, chroma_format_idc);
if (HAVE_ALTIVEC) ff_h264dsp_init_ppc(c, bit_depth, chroma_format_idc);
- if (HAVE_MMX) ff_h264dsp_init_x86(c, bit_depth, chroma_format_idc);
+ if (ARCH_X86) ff_h264dsp_init_x86(c, bit_depth, chroma_format_idc);
}
diff --git a/gst-libs/ext/libav/libavcodec/h264dsp.h b/gst-libs/ext/libav/libavcodec/h264dsp.h
index 7cae215..248c7d0 100644
--- a/gst-libs/ext/libav/libavcodec/h264dsp.h
+++ b/gst-libs/ext/libav/libavcodec/h264dsp.h
@@ -28,57 +28,90 @@
#define AVCODEC_H264DSP_H
#include <stdint.h>
+
#include "dsputil.h"
-//typedef void (*h264_chroma_mc_func)(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int srcStride, int h, int x, int y);
typedef void (*h264_weight_func)(uint8_t *block, int stride, int height,
int log2_denom, int weight, int offset);
-typedef void (*h264_biweight_func)(uint8_t *dst, uint8_t *src, int stride, int height,
- int log2_denom, int weightd, int weights, int offset);
+typedef void (*h264_biweight_func)(uint8_t *dst, uint8_t *src,
+ int stride, int height, int log2_denom,
+ int weightd, int weights, int offset);
/**
* Context for storing H.264 DSP functions
*/
-typedef struct H264DSPContext{
+typedef struct H264DSPContext {
/* weighted MC */
h264_weight_func weight_h264_pixels_tab[4];
h264_biweight_func biweight_h264_pixels_tab[4];
/* loop filter */
- void (*h264_v_loop_filter_luma)(uint8_t *pix/*align 16*/, int stride, int alpha, int beta, int8_t *tc0);
- void (*h264_h_loop_filter_luma)(uint8_t *pix/*align 4 */, int stride, int alpha, int beta, int8_t *tc0);
- void (*h264_h_loop_filter_luma_mbaff)(uint8_t *pix/*align 16*/, int stride, int alpha, int beta, int8_t *tc0);
+ void (*h264_v_loop_filter_luma)(uint8_t *pix /*align 16*/, int stride,
+ int alpha, int beta, int8_t *tc0);
+ void (*h264_h_loop_filter_luma)(uint8_t *pix /*align 4 */, int stride,
+ int alpha, int beta, int8_t *tc0);
+ void (*h264_h_loop_filter_luma_mbaff)(uint8_t *pix /*align 16*/, int stride,
+ int alpha, int beta, int8_t *tc0);
/* v/h_loop_filter_luma_intra: align 16 */
- void (*h264_v_loop_filter_luma_intra)(uint8_t *pix, int stride, int alpha, int beta);
- void (*h264_h_loop_filter_luma_intra)(uint8_t *pix, int stride, int alpha, int beta);
- void (*h264_h_loop_filter_luma_mbaff_intra)(uint8_t *pix/*align 16*/, int stride, int alpha, int beta);
- void (*h264_v_loop_filter_chroma)(uint8_t *pix/*align 8*/, int stride, int alpha, int beta, int8_t *tc0);
- void (*h264_h_loop_filter_chroma)(uint8_t *pix/*align 4*/, int stride, int alpha, int beta, int8_t *tc0);
- void (*h264_h_loop_filter_chroma_mbaff)(uint8_t *pix/*align 8*/, int stride, int alpha, int beta, int8_t *tc0);
- void (*h264_v_loop_filter_chroma_intra)(uint8_t *pix/*align 8*/, int stride, int alpha, int beta);
- void (*h264_h_loop_filter_chroma_intra)(uint8_t *pix/*align 8*/, int stride, int alpha, int beta);
- void (*h264_h_loop_filter_chroma_mbaff_intra)(uint8_t *pix/*align 8*/, int stride, int alpha, int beta);
+ void (*h264_v_loop_filter_luma_intra)(uint8_t *pix, int stride,
+ int alpha, int beta);
+ void (*h264_h_loop_filter_luma_intra)(uint8_t *pix, int stride,
+ int alpha, int beta);
+ void (*h264_h_loop_filter_luma_mbaff_intra)(uint8_t *pix /*align 16*/,
+ int stride, int alpha, int beta);
+ void (*h264_v_loop_filter_chroma)(uint8_t *pix /*align 8*/, int stride,
+ int alpha, int beta, int8_t *tc0);
+ void (*h264_h_loop_filter_chroma)(uint8_t *pix /*align 4*/, int stride,
+ int alpha, int beta, int8_t *tc0);
+ void (*h264_h_loop_filter_chroma_mbaff)(uint8_t *pix /*align 8*/,
+ int stride, int alpha, int beta,
+ int8_t *tc0);
+ void (*h264_v_loop_filter_chroma_intra)(uint8_t *pix /*align 8*/,
+ int stride, int alpha, int beta);
+ void (*h264_h_loop_filter_chroma_intra)(uint8_t *pix /*align 8*/,
+ int stride, int alpha, int beta);
+ void (*h264_h_loop_filter_chroma_mbaff_intra)(uint8_t *pix /*align 8*/,
+ int stride, int alpha, int beta);
// h264_loop_filter_strength: simd only. the C version is inlined in h264.c
- void (*h264_loop_filter_strength)(int16_t bS[2][4][4], uint8_t nnz[40], int8_t ref[2][40], int16_t mv[2][40][2],
- int bidir, int edges, int step, int mask_mv0, int mask_mv1, int field);
+ void (*h264_loop_filter_strength)(int16_t bS[2][4][4], uint8_t nnz[40],
+ int8_t ref[2][40], int16_t mv[2][40][2],
+ int bidir, int edges, int step,
+ int mask_mv0, int mask_mv1, int field);
/* IDCT */
- void (*h264_idct_add)(uint8_t *dst/*align 4*/, DCTELEM *block/*align 16*/, int stride);
- void (*h264_idct8_add)(uint8_t *dst/*align 8*/, DCTELEM *block/*align 16*/, int stride);
- void (*h264_idct_dc_add)(uint8_t *dst/*align 4*/, DCTELEM *block/*align 16*/, int stride);
- void (*h264_idct8_dc_add)(uint8_t *dst/*align 8*/, DCTELEM *block/*align 16*/, int stride);
+ void (*h264_idct_add)(uint8_t *dst /*align 4*/,
+ DCTELEM *block /*align 16*/, int stride);
+ void (*h264_idct8_add)(uint8_t *dst /*align 8*/,
+ DCTELEM *block /*align 16*/, int stride);
+ void (*h264_idct_dc_add)(uint8_t *dst /*align 4*/,
+ DCTELEM *block /*align 16*/, int stride);
+ void (*h264_idct8_dc_add)(uint8_t *dst /*align 8*/,
+ DCTELEM *block /*align 16*/, int stride);
- void (*h264_idct_add16)(uint8_t *dst/*align 16*/, const int *blockoffset, DCTELEM *block/*align 16*/, int stride, const uint8_t nnzc[15*8]);
- void (*h264_idct8_add4)(uint8_t *dst/*align 16*/, const int *blockoffset, DCTELEM *block/*align 16*/, int stride, const uint8_t nnzc[15*8]);
- void (*h264_idct_add8)(uint8_t **dst/*align 16*/, const int *blockoffset, DCTELEM *block/*align 16*/, int stride, const uint8_t nnzc[15*8]);
- void (*h264_idct_add16intra)(uint8_t *dst/*align 16*/, const int *blockoffset, DCTELEM *block/*align 16*/, int stride, const uint8_t nnzc[15*8]);
- void (*h264_luma_dc_dequant_idct)(DCTELEM *output, DCTELEM *input/*align 16*/, int qmul);
+ void (*h264_idct_add16)(uint8_t *dst /*align 16*/, const int *blockoffset,
+ DCTELEM *block /*align 16*/, int stride,
+ const uint8_t nnzc[15 * 8]);
+ void (*h264_idct8_add4)(uint8_t *dst /*align 16*/, const int *blockoffset,
+ DCTELEM *block /*align 16*/, int stride,
+ const uint8_t nnzc[15 * 8]);
+ void (*h264_idct_add8)(uint8_t **dst /*align 16*/, const int *blockoffset,
+ DCTELEM *block /*align 16*/, int stride,
+ const uint8_t nnzc[15 * 8]);
+ void (*h264_idct_add16intra)(uint8_t *dst /*align 16*/, const int *blockoffset,
+ DCTELEM *block /*align 16*/,
+ int stride, const uint8_t nnzc[15 * 8]);
+ void (*h264_luma_dc_dequant_idct)(DCTELEM *output,
+ DCTELEM *input /*align 16*/, int qmul);
void (*h264_chroma_dc_dequant_idct)(DCTELEM *block, int qmul);
-}H264DSPContext;
+} H264DSPContext;
-void ff_h264dsp_init(H264DSPContext *c, const int bit_depth, const int chroma_format_idc);
-void ff_h264dsp_init_arm(H264DSPContext *c, const int bit_depth, const int chroma_format_idc);
-void ff_h264dsp_init_ppc(H264DSPContext *c, const int bit_depth, const int chroma_format_idc);
-void ff_h264dsp_init_x86(H264DSPContext *c, const int bit_depth, const int chroma_format_idc);
+void ff_h264dsp_init(H264DSPContext *c, const int bit_depth,
+ const int chroma_format_idc);
+void ff_h264dsp_init_arm(H264DSPContext *c, const int bit_depth,
+ const int chroma_format_idc);
+void ff_h264dsp_init_ppc(H264DSPContext *c, const int bit_depth,
+ const int chroma_format_idc);
+void ff_h264dsp_init_x86(H264DSPContext *c, const int bit_depth,
+ const int chroma_format_idc);
#endif /* AVCODEC_H264DSP_H */
diff --git a/gst-libs/ext/libav/libavcodec/h264idct_template.c b/gst-libs/ext/libav/libavcodec/h264idct_template.c
index e476f89..554483c 100644
--- a/gst-libs/ext/libav/libavcodec/h264idct_template.c
+++ b/gst-libs/ext/libav/libavcodec/h264idct_template.c
@@ -26,6 +26,7 @@
*/
#include "bit_depth_template.c"
+#include "libavutil/common.h"
#ifndef AVCODEC_H264IDCT_INTERNAL_H
#define AVCODEC_H264IDCT_INTERNAL_H
diff --git a/gst-libs/ext/libav/libavcodec/h264pred.c b/gst-libs/ext/libav/libavcodec/h264pred.c
index 37a4cf1..94cf9d0 100644
--- a/gst-libs/ext/libav/libavcodec/h264pred.c
+++ b/gst-libs/ext/libav/libavcodec/h264pred.c
@@ -39,7 +39,9 @@
#include "h264pred_template.c"
#undef BIT_DEPTH
-static void pred4x4_vertical_vp8_c(uint8_t *src, const uint8_t *topright, int stride){
+static void pred4x4_vertical_vp8_c(uint8_t *src, const uint8_t *topright,
+ ptrdiff_t stride)
+{
const unsigned lt = src[-1-1*stride];
LOAD_TOP_EDGE
LOAD_TOP_RIGHT_EDGE
@@ -54,7 +56,9 @@ static void pred4x4_vertical_vp8_c(uint8_t *src, const uint8_t *topright, int st
AV_WN32A(src+3*stride, v);
}
-static void pred4x4_horizontal_vp8_c(uint8_t *src, const uint8_t *topright, int stride){
+static void pred4x4_horizontal_vp8_c(uint8_t *src, const uint8_t *topright,
+ ptrdiff_t stride)
+{
const unsigned lt = src[-1-1*stride];
LOAD_LEFT_EDGE
@@ -64,7 +68,9 @@ static void pred4x4_horizontal_vp8_c(uint8_t *src, const uint8_t *topright, int
AV_WN32A(src+3*stride, ((l2 + 2*l3 + l3 + 2) >> 2)*0x01010101);
}
-static void pred4x4_down_left_svq3_c(uint8_t *src, const uint8_t *topright, int stride){
+static void pred4x4_down_left_svq3_c(uint8_t *src, const uint8_t *topright,
+ ptrdiff_t stride)
+{
LOAD_TOP_EDGE
LOAD_LEFT_EDGE
@@ -86,7 +92,9 @@ static void pred4x4_down_left_svq3_c(uint8_t *src, const uint8_t *topright, int
src[3+3*stride]=(l3 + t3)>>1;
}
-static void pred4x4_down_left_rv40_c(uint8_t *src, const uint8_t *topright, int stride){
+static void pred4x4_down_left_rv40_c(uint8_t *src, const uint8_t *topright,
+ ptrdiff_t stride)
+{
LOAD_TOP_EDGE
LOAD_TOP_RIGHT_EDGE
LOAD_LEFT_EDGE
@@ -110,7 +118,10 @@ static void pred4x4_down_left_rv40_c(uint8_t *src, const uint8_t *topright, int
src[3+3*stride]=(t6 + t7 + 1 + l6 + l7 + 1)>>2;
}
-static void pred4x4_down_left_rv40_nodown_c(uint8_t *src, const uint8_t *topright, int stride){
+static void pred4x4_down_left_rv40_nodown_c(uint8_t *src,
+ const uint8_t *topright,
+ ptrdiff_t stride)
+{
LOAD_TOP_EDGE
LOAD_TOP_RIGHT_EDGE
LOAD_LEFT_EDGE
@@ -133,8 +144,11 @@ static void pred4x4_down_left_rv40_nodown_c(uint8_t *src, const uint8_t *toprigh
src[3+3*stride]=(t6 + t7 + 1 + 2*l3 + 1)>>2;
}
-static void pred4x4_vertical_left_rv40(uint8_t *src, const uint8_t *topright, int stride,
- const int l0, const int l1, const int l2, const int l3, const int l4){
+static void pred4x4_vertical_left_rv40(uint8_t *src, const uint8_t *topright,
+ ptrdiff_t stride,
+ const int l0, const int l1, const int l2,
+ const int l3, const int l4)
+{
LOAD_TOP_EDGE
LOAD_TOP_RIGHT_EDGE
@@ -156,20 +170,27 @@ static void pred4x4_vertical_left_rv40(uint8_t *src, const uint8_t *topright, in
src[3+3*stride]=(t4 + 2*t5 + t6 + 2)>>2;
}
-static void pred4x4_vertical_left_rv40_c(uint8_t *src, const uint8_t *topright, int stride){
+static void pred4x4_vertical_left_rv40_c(uint8_t *src, const uint8_t *topright,
+ ptrdiff_t stride)
+{
LOAD_LEFT_EDGE
LOAD_DOWN_LEFT_EDGE
pred4x4_vertical_left_rv40(src, topright, stride, l0, l1, l2, l3, l4);
}
-static void pred4x4_vertical_left_rv40_nodown_c(uint8_t *src, const uint8_t *topright, int stride){
+static void pred4x4_vertical_left_rv40_nodown_c(uint8_t *src,
+ const uint8_t *topright,
+ ptrdiff_t stride)
+{
LOAD_LEFT_EDGE
pred4x4_vertical_left_rv40(src, topright, stride, l0, l1, l2, l3, l3);
}
-static void pred4x4_vertical_left_vp8_c(uint8_t *src, const uint8_t *topright, int stride){
+static void pred4x4_vertical_left_vp8_c(uint8_t *src, const uint8_t *topright,
+ ptrdiff_t stride)
+{
LOAD_TOP_EDGE
LOAD_TOP_RIGHT_EDGE
@@ -191,7 +212,9 @@ static void pred4x4_vertical_left_vp8_c(uint8_t *src, const uint8_t *topright, i
src[3+3*stride]=(t5 + 2*t6 + t7 + 2)>>2;
}
-static void pred4x4_horizontal_up_rv40_c(uint8_t *src, const uint8_t *topright, int stride){
+static void pred4x4_horizontal_up_rv40_c(uint8_t *src, const uint8_t *topright,
+ ptrdiff_t stride)
+{
LOAD_LEFT_EDGE
LOAD_DOWN_LEFT_EDGE
LOAD_TOP_EDGE
@@ -215,7 +238,10 @@ static void pred4x4_horizontal_up_rv40_c(uint8_t *src, const uint8_t *topright,
src[3+3*stride]=(l4 + 2*l5 + l6 + 2)>>2;
}
-static void pred4x4_horizontal_up_rv40_nodown_c(uint8_t *src, const uint8_t *topright, int stride){
+static void pred4x4_horizontal_up_rv40_nodown_c(uint8_t *src,
+ const uint8_t *topright,
+ ptrdiff_t stride)
+{
LOAD_LEFT_EDGE
LOAD_TOP_EDGE
LOAD_TOP_RIGHT_EDGE
@@ -238,7 +264,9 @@ static void pred4x4_horizontal_up_rv40_nodown_c(uint8_t *src, const uint8_t *top
src[3+3*stride]=l3;
}
-static void pred4x4_tm_vp8_c(uint8_t *src, const uint8_t *topright, int stride){
+static void pred4x4_tm_vp8_c(uint8_t *src, const uint8_t *topright,
+ ptrdiff_t stride)
+{
uint8_t *cm = ff_cropTbl + MAX_NEG_CROP - src[-1-stride];
uint8_t *top = src-stride;
int y;
@@ -253,15 +281,18 @@ static void pred4x4_tm_vp8_c(uint8_t *src, const uint8_t *topright, int stride){
}
}
-static void pred16x16_plane_svq3_c(uint8_t *src, int stride){
+static void pred16x16_plane_svq3_c(uint8_t *src, ptrdiff_t stride)
+{
pred16x16_plane_compat_8_c(src, stride, 1, 0);
}
-static void pred16x16_plane_rv40_c(uint8_t *src, int stride){
+static void pred16x16_plane_rv40_c(uint8_t *src, ptrdiff_t stride)
+{
pred16x16_plane_compat_8_c(src, stride, 0, 1);
}
-static void pred16x16_tm_vp8_c(uint8_t *src, int stride){
+static void pred16x16_tm_vp8_c(uint8_t *src, ptrdiff_t stride)
+{
uint8_t *cm = ff_cropTbl + MAX_NEG_CROP - src[-1-stride];
uint8_t *top = src-stride;
int y;
@@ -288,7 +319,8 @@ static void pred16x16_tm_vp8_c(uint8_t *src, int stride){
}
}
-static void pred8x8_left_dc_rv40_c(uint8_t *src, int stride){
+static void pred8x8_left_dc_rv40_c(uint8_t *src, ptrdiff_t stride)
+{
int i;
unsigned dc0;
@@ -303,7 +335,8 @@ static void pred8x8_left_dc_rv40_c(uint8_t *src, int stride){
}
}
-static void pred8x8_top_dc_rv40_c(uint8_t *src, int stride){
+static void pred8x8_top_dc_rv40_c(uint8_t *src, ptrdiff_t stride)
+{
int i;
unsigned dc0;
@@ -318,7 +351,8 @@ static void pred8x8_top_dc_rv40_c(uint8_t *src, int stride){
}
}
-static void pred8x8_dc_rv40_c(uint8_t *src, int stride){
+static void pred8x8_dc_rv40_c(uint8_t *src, ptrdiff_t stride)
+{
int i;
unsigned dc0 = 0;
@@ -339,7 +373,8 @@ static void pred8x8_dc_rv40_c(uint8_t *src, int stride){
}
}
-static void pred8x8_tm_vp8_c(uint8_t *src, int stride){
+static void pred8x8_tm_vp8_c(uint8_t *src, ptrdiff_t stride)
+{
uint8_t *cm = ff_cropTbl + MAX_NEG_CROP - src[-1-stride];
uint8_t *top = src-stride;
int y;
@@ -361,7 +396,9 @@ static void pred8x8_tm_vp8_c(uint8_t *src, int stride){
/**
* Set the intra prediction function pointers.
*/
-void ff_h264_pred_init(H264PredContext *h, int codec_id, const int bit_depth, const int chroma_format_idc){
+void ff_h264_pred_init(H264PredContext *h, int codec_id, const int bit_depth,
+ const int chroma_format_idc)
+{
// MpegEncContext * const s = &h->s;
#undef FUNC
@@ -371,8 +408,8 @@ void ff_h264_pred_init(H264PredContext *h, int codec_id, const int bit_depth, co
#define FUNCD(a) a ## _c
#define H264_PRED(depth) \
- if(codec_id != CODEC_ID_RV40){\
- if(codec_id == CODEC_ID_VP8) {\
+ if(codec_id != AV_CODEC_ID_RV40){\
+ if(codec_id == AV_CODEC_ID_VP8) {\
h->pred4x4[VERT_PRED ]= FUNCD(pred4x4_vertical_vp8);\
h->pred4x4[HOR_PRED ]= FUNCD(pred4x4_horizontal_vp8);\
} else {\
@@ -380,19 +417,19 @@ void ff_h264_pred_init(H264PredContext *h, int codec_id, const int bit_depth, co
h->pred4x4[HOR_PRED ]= FUNCC(pred4x4_horizontal , depth);\
}\
h->pred4x4[DC_PRED ]= FUNCC(pred4x4_dc , depth);\
- if(codec_id == CODEC_ID_SVQ3)\
+ if(codec_id == AV_CODEC_ID_SVQ3)\
h->pred4x4[DIAG_DOWN_LEFT_PRED ]= FUNCD(pred4x4_down_left_svq3);\
else\
h->pred4x4[DIAG_DOWN_LEFT_PRED ]= FUNCC(pred4x4_down_left , depth);\
h->pred4x4[DIAG_DOWN_RIGHT_PRED]= FUNCC(pred4x4_down_right , depth);\
h->pred4x4[VERT_RIGHT_PRED ]= FUNCC(pred4x4_vertical_right , depth);\
h->pred4x4[HOR_DOWN_PRED ]= FUNCC(pred4x4_horizontal_down , depth);\
- if (codec_id == CODEC_ID_VP8) {\
+ if (codec_id == AV_CODEC_ID_VP8) {\
h->pred4x4[VERT_LEFT_PRED ]= FUNCD(pred4x4_vertical_left_vp8);\
} else\
h->pred4x4[VERT_LEFT_PRED ]= FUNCC(pred4x4_vertical_left , depth);\
h->pred4x4[HOR_UP_PRED ]= FUNCC(pred4x4_horizontal_up , depth);\
- if(codec_id != CODEC_ID_VP8) {\
+ if(codec_id != AV_CODEC_ID_VP8) {\
h->pred4x4[LEFT_DC_PRED ]= FUNCC(pred4x4_left_dc , depth);\
h->pred4x4[TOP_DC_PRED ]= FUNCC(pred4x4_top_dc , depth);\
h->pred4x4[DC_128_PRED ]= FUNCC(pred4x4_128_dc , depth);\
@@ -441,7 +478,7 @@ void ff_h264_pred_init(H264PredContext *h, int codec_id, const int bit_depth, co
h->pred8x8[VERT_PRED8x8 ]= FUNCC(pred8x16_vertical , depth);\
h->pred8x8[HOR_PRED8x8 ]= FUNCC(pred8x16_horizontal , depth);\
}\
- if (codec_id != CODEC_ID_VP8) {\
+ if (codec_id != AV_CODEC_ID_VP8) {\
if (chroma_format_idc == 1) {\
h->pred8x8[PLANE_PRED8x8]= FUNCC(pred8x8_plane , depth);\
} else {\
@@ -449,7 +486,7 @@ void ff_h264_pred_init(H264PredContext *h, int codec_id, const int bit_depth, co
}\
} else\
h->pred8x8[PLANE_PRED8x8]= FUNCD(pred8x8_tm_vp8);\
- if(codec_id != CODEC_ID_RV40 && codec_id != CODEC_ID_VP8){\
+ if(codec_id != AV_CODEC_ID_RV40 && codec_id != AV_CODEC_ID_VP8){\
if (chroma_format_idc == 1) {\
h->pred8x8[DC_PRED8x8 ]= FUNCC(pred8x8_dc , depth);\
h->pred8x8[LEFT_DC_PRED8x8]= FUNCC(pred8x8_left_dc , depth);\
@@ -471,7 +508,7 @@ void ff_h264_pred_init(H264PredContext *h, int codec_id, const int bit_depth, co
h->pred8x8[DC_PRED8x8 ]= FUNCD(pred8x8_dc_rv40);\
h->pred8x8[LEFT_DC_PRED8x8]= FUNCD(pred8x8_left_dc_rv40);\
h->pred8x8[TOP_DC_PRED8x8 ]= FUNCD(pred8x8_top_dc_rv40);\
- if (codec_id == CODEC_ID_VP8) {\
+ if (codec_id == AV_CODEC_ID_VP8) {\
h->pred8x8[DC_127_PRED8x8]= FUNCC(pred8x8_127_dc , depth);\
h->pred8x8[DC_129_PRED8x8]= FUNCC(pred8x8_129_dc , depth);\
}\
@@ -486,13 +523,13 @@ void ff_h264_pred_init(H264PredContext *h, int codec_id, const int bit_depth, co
h->pred16x16[VERT_PRED8x8 ]= FUNCC(pred16x16_vertical , depth);\
h->pred16x16[HOR_PRED8x8 ]= FUNCC(pred16x16_horizontal , depth);\
switch(codec_id){\
- case CODEC_ID_SVQ3:\
+ case AV_CODEC_ID_SVQ3:\
h->pred16x16[PLANE_PRED8x8 ]= FUNCD(pred16x16_plane_svq3);\
break;\
- case CODEC_ID_RV40:\
+ case AV_CODEC_ID_RV40:\
h->pred16x16[PLANE_PRED8x8 ]= FUNCD(pred16x16_plane_rv40);\
break;\
- case CODEC_ID_VP8:\
+ case AV_CODEC_ID_VP8:\
h->pred16x16[PLANE_PRED8x8 ]= FUNCD(pred16x16_tm_vp8);\
h->pred16x16[DC_127_PRED8x8]= FUNCC(pred16x16_127_dc , depth);\
h->pred16x16[DC_129_PRED8x8]= FUNCC(pred16x16_129_dc , depth);\
@@ -533,5 +570,5 @@ void ff_h264_pred_init(H264PredContext *h, int codec_id, const int bit_depth, co
}
if (ARCH_ARM) ff_h264_pred_init_arm(h, codec_id, bit_depth, chroma_format_idc);
- if (HAVE_MMX) ff_h264_pred_init_x86(h, codec_id, bit_depth, chroma_format_idc);
+ if (ARCH_X86) ff_h264_pred_init_x86(h, codec_id, bit_depth, chroma_format_idc);
}
diff --git a/gst-libs/ext/libav/libavcodec/h264pred.h b/gst-libs/ext/libav/libavcodec/h264pred.h
index b880446..a8b3dba 100644
--- a/gst-libs/ext/libav/libavcodec/h264pred.h
+++ b/gst-libs/ext/libav/libavcodec/h264pred.h
@@ -35,18 +35,18 @@
* Prediction types
*/
//@{
-#define VERT_PRED 0
-#define HOR_PRED 1
-#define DC_PRED 2
-#define DIAG_DOWN_LEFT_PRED 3
-#define DIAG_DOWN_RIGHT_PRED 4
-#define VERT_RIGHT_PRED 5
-#define HOR_DOWN_PRED 6
-#define VERT_LEFT_PRED 7
-#define HOR_UP_PRED 8
+#define VERT_PRED 0
+#define HOR_PRED 1
+#define DC_PRED 2
+#define DIAG_DOWN_LEFT_PRED 3
+#define DIAG_DOWN_RIGHT_PRED 4
+#define VERT_RIGHT_PRED 5
+#define HOR_DOWN_PRED 6
+#define VERT_LEFT_PRED 7
+#define HOR_UP_PRED 8
// DC edge (not for VP8)
-#define LEFT_DC_PRED 9
+#define LEFT_DC_PRED 9
#define TOP_DC_PRED 10
#define DC_128_PRED 11
@@ -56,7 +56,7 @@
#define VERT_LEFT_PRED_RV40_NODOWN 14
// VP8 specific
-#define TM_VP8_PRED 9 ///< "True Motion", used instead of plane
+#define TM_VP8_PRED 9 ///< "True Motion", used instead of plane
#define VERT_VP8_PRED 10 ///< for VP8, #VERT_PRED is the average of
///< (left col+cur col x2+right col) / 4;
///< this is the "unaveraged" one
@@ -65,44 +65,55 @@
#define DC_127_PRED 12
#define DC_129_PRED 13
-#define DC_PRED8x8 0
-#define HOR_PRED8x8 1
-#define VERT_PRED8x8 2
-#define PLANE_PRED8x8 3
+#define DC_PRED8x8 0
+#define HOR_PRED8x8 1
+#define VERT_PRED8x8 2
+#define PLANE_PRED8x8 3
// DC edge
-#define LEFT_DC_PRED8x8 4
-#define TOP_DC_PRED8x8 5
-#define DC_128_PRED8x8 6
+#define LEFT_DC_PRED8x8 4
+#define TOP_DC_PRED8x8 5
+#define DC_128_PRED8x8 6
// H264/SVQ3 (8x8) specific
-#define ALZHEIMER_DC_L0T_PRED8x8 7
-#define ALZHEIMER_DC_0LT_PRED8x8 8
-#define ALZHEIMER_DC_L00_PRED8x8 9
+#define ALZHEIMER_DC_L0T_PRED8x8 7
+#define ALZHEIMER_DC_0LT_PRED8x8 8
+#define ALZHEIMER_DC_L00_PRED8x8 9
#define ALZHEIMER_DC_0L0_PRED8x8 10
// VP8 specific
-#define DC_127_PRED8x8 7
-#define DC_129_PRED8x8 8
+#define DC_127_PRED8x8 7
+#define DC_129_PRED8x8 8
//@}
/**
* Context for storing H.264 prediction functions
*/
-typedef struct H264PredContext{
- void (*pred4x4 [9+3+3])(uint8_t *src, const uint8_t *topright, int stride);//FIXME move to dsp?
- void (*pred8x8l [9+3])(uint8_t *src, int topleft, int topright, int stride);
- void (*pred8x8 [4+3+4])(uint8_t *src, int stride);
- void (*pred16x16[4+3+2])(uint8_t *src, int stride);
+typedef struct H264PredContext {
+ void(*pred4x4[9 + 3 + 3])(uint8_t *src, const uint8_t *topright,
+ ptrdiff_t stride);
+ void(*pred8x8l[9 + 3])(uint8_t *src, int topleft, int topright,
+ ptrdiff_t stride);
+ void(*pred8x8[4 + 3 + 4])(uint8_t *src, ptrdiff_t stride);
+ void(*pred16x16[4 + 3 + 2])(uint8_t *src, ptrdiff_t stride);
- void (*pred4x4_add [2])(uint8_t *pix/*align 4*/, const DCTELEM *block/*align 16*/, int stride);
- void (*pred8x8l_add [2])(uint8_t *pix/*align 8*/, const DCTELEM *block/*align 16*/, int stride);
- void (*pred8x8_add [3])(uint8_t *pix/*align 8*/, const int *block_offset, const DCTELEM *block/*align 16*/, int stride);
- void (*pred16x16_add[3])(uint8_t *pix/*align 16*/, const int *block_offset, const DCTELEM *block/*align 16*/, int stride);
-}H264PredContext;
+ void(*pred4x4_add[2])(uint8_t *pix /*align 4*/,
+ const DCTELEM *block /*align 16*/, ptrdiff_t stride);
+ void(*pred8x8l_add[2])(uint8_t *pix /*align 8*/,
+ const DCTELEM *block /*align 16*/, ptrdiff_t stride);
+ void(*pred8x8_add[3])(uint8_t *pix /*align 8*/,
+ const int *block_offset,
+ const DCTELEM *block /*align 16*/, ptrdiff_t stride);
+ void(*pred16x16_add[3])(uint8_t *pix /*align 16*/,
+ const int *block_offset,
+ const DCTELEM *block /*align 16*/, ptrdiff_t stride);
+} H264PredContext;
-void ff_h264_pred_init(H264PredContext *h, int codec_id, const int bit_depth, const int chroma_format_idc);
-void ff_h264_pred_init_arm(H264PredContext *h, int codec_id, const int bit_depth, const int chroma_format_idc);
-void ff_h264_pred_init_x86(H264PredContext *h, int codec_id, const int bit_depth, const int chroma_format_idc);
+void ff_h264_pred_init(H264PredContext *h, int codec_id,
+ const int bit_depth, const int chroma_format_idc);
+void ff_h264_pred_init_arm(H264PredContext *h, int codec_id,
+ const int bit_depth, const int chroma_format_idc);
+void ff_h264_pred_init_x86(H264PredContext *h, int codec_id,
+ const int bit_depth, const int chroma_format_idc);
#endif /* AVCODEC_H264PRED_H */
diff --git a/gst-libs/ext/libav/libavcodec/h264pred_template.c b/gst-libs/ext/libav/libavcodec/h264pred_template.c
index 19100b6..8ae13b0 100644
--- a/gst-libs/ext/libav/libavcodec/h264pred_template.c
+++ b/gst-libs/ext/libav/libavcodec/h264pred_template.c
@@ -29,7 +29,9 @@
#include "bit_depth_template.c"
-static void FUNCC(pred4x4_vertical)(uint8_t *_src, const uint8_t *topright, int _stride){
+static void FUNCC(pred4x4_vertical)(uint8_t *_src, const uint8_t *topright,
+ ptrdiff_t _stride)
+{
pixel *src = (pixel*)_src;
int stride = _stride/sizeof(pixel);
const pixel4 a= AV_RN4PA(src-stride);
@@ -40,7 +42,9 @@ static void FUNCC(pred4x4_vertical)(uint8_t *_src, const uint8_t *topright, int
AV_WN4PA(src+3*stride, a);
}
-static void FUNCC(pred4x4_horizontal)(uint8_t *_src, const uint8_t *topright, int _stride){
+static void FUNCC(pred4x4_horizontal)(uint8_t *_src, const uint8_t *topright,
+ ptrdiff_t _stride)
+{
pixel *src = (pixel*)_src;
int stride = _stride/sizeof(pixel);
AV_WN4PA(src+0*stride, PIXEL_SPLAT_X4(src[-1+0*stride]));
@@ -49,7 +53,9 @@ static void FUNCC(pred4x4_horizontal)(uint8_t *_src, const uint8_t *topright, in
AV_WN4PA(src+3*stride, PIXEL_SPLAT_X4(src[-1+3*stride]));
}
-static void FUNCC(pred4x4_dc)(uint8_t *_src, const uint8_t *topright, int _stride){
+static void FUNCC(pred4x4_dc)(uint8_t *_src, const uint8_t *topright,
+ ptrdiff_t _stride)
+{
pixel *src = (pixel*)_src;
int stride = _stride/sizeof(pixel);
const int dc= ( src[-stride] + src[1-stride] + src[2-stride] + src[3-stride]
@@ -62,7 +68,9 @@ static void FUNCC(pred4x4_dc)(uint8_t *_src, const uint8_t *topright, int _strid
AV_WN4PA(src+3*stride, a);
}
-static void FUNCC(pred4x4_left_dc)(uint8_t *_src, const uint8_t *topright, int _stride){
+static void FUNCC(pred4x4_left_dc)(uint8_t *_src, const uint8_t *topright,
+ ptrdiff_t _stride)
+{
pixel *src = (pixel*)_src;
int stride = _stride/sizeof(pixel);
const int dc= ( src[-1+0*stride] + src[-1+1*stride] + src[-1+2*stride] + src[-1+3*stride] + 2) >>2;
@@ -74,7 +82,9 @@ static void FUNCC(pred4x4_left_dc)(uint8_t *_src, const uint8_t *topright, int _
AV_WN4PA(src+3*stride, a);
}
-static void FUNCC(pred4x4_top_dc)(uint8_t *_src, const uint8_t *topright, int _stride){
+static void FUNCC(pred4x4_top_dc)(uint8_t *_src, const uint8_t *topright,
+ ptrdiff_t _stride)
+{
pixel *src = (pixel*)_src;
int stride = _stride/sizeof(pixel);
const int dc= ( src[-stride] + src[1-stride] + src[2-stride] + src[3-stride] + 2) >>2;
@@ -86,7 +96,9 @@ static void FUNCC(pred4x4_top_dc)(uint8_t *_src, const uint8_t *topright, int _s
AV_WN4PA(src+3*stride, a);
}
-static void FUNCC(pred4x4_128_dc)(uint8_t *_src, const uint8_t *topright, int _stride){
+static void FUNCC(pred4x4_128_dc)(uint8_t *_src, const uint8_t *topright,
+ ptrdiff_t _stride)
+{
pixel *src = (pixel*)_src;
int stride = _stride/sizeof(pixel);
const pixel4 a = PIXEL_SPLAT_X4(1<<(BIT_DEPTH-1));
@@ -97,7 +109,9 @@ static void FUNCC(pred4x4_128_dc)(uint8_t *_src, const uint8_t *topright, int _s
AV_WN4PA(src+3*stride, a);
}
-static void FUNCC(pred4x4_127_dc)(uint8_t *_src, const uint8_t *topright, int _stride){
+static void FUNCC(pred4x4_127_dc)(uint8_t *_src, const uint8_t *topright,
+ ptrdiff_t _stride)
+{
pixel *src = (pixel*)_src;
int stride = _stride/sizeof(pixel);
const pixel4 a = PIXEL_SPLAT_X4((1<<(BIT_DEPTH-1))-1);
@@ -108,7 +122,9 @@ static void FUNCC(pred4x4_127_dc)(uint8_t *_src, const uint8_t *topright, int _s
AV_WN4PA(src+3*stride, a);
}
-static void FUNCC(pred4x4_129_dc)(uint8_t *_src, const uint8_t *topright, int _stride){
+static void FUNCC(pred4x4_129_dc)(uint8_t *_src, const uint8_t *topright,
+ ptrdiff_t _stride)
+{
pixel *src = (pixel*)_src;
int stride = _stride/sizeof(pixel);
const pixel4 a = PIXEL_SPLAT_X4((1<<(BIT_DEPTH-1))+1);
@@ -144,7 +160,9 @@ static void FUNCC(pred4x4_129_dc)(uint8_t *_src, const uint8_t *topright, int _s
const unsigned av_unused t2 = src[ 2-1*stride];\
const unsigned av_unused t3 = src[ 3-1*stride];\
-static void FUNCC(pred4x4_down_right)(uint8_t *_src, const uint8_t *topright, int _stride){
+static void FUNCC(pred4x4_down_right)(uint8_t *_src, const uint8_t *topright,
+ ptrdiff_t _stride)
+{
pixel *src = (pixel*)_src;
int stride = _stride/sizeof(pixel);
const int lt= src[-1-1*stride];
@@ -169,7 +187,9 @@ static void FUNCC(pred4x4_down_right)(uint8_t *_src, const uint8_t *topright, in
src[3+0*stride]=(t1 + 2*t2 + t3 + 2)>>2;
}
-static void FUNCC(pred4x4_down_left)(uint8_t *_src, const uint8_t *_topright, int _stride){
+static void FUNCC(pred4x4_down_left)(uint8_t *_src, const uint8_t *_topright,
+ ptrdiff_t _stride)
+{
pixel *src = (pixel*)_src;
const pixel *topright = (const pixel*)_topright;
int stride = _stride/sizeof(pixel);
@@ -195,7 +215,10 @@ static void FUNCC(pred4x4_down_left)(uint8_t *_src, const uint8_t *_topright, in
src[3+3*stride]=(t6 + 3*t7 + 2)>>2;
}
-static void FUNCC(pred4x4_vertical_right)(uint8_t *_src, const uint8_t *topright, int _stride){
+static void FUNCC(pred4x4_vertical_right)(uint8_t *_src,
+ const uint8_t *topright,
+ ptrdiff_t _stride)
+{
pixel *src = (pixel*)_src;
int stride = _stride/sizeof(pixel);
const int lt= src[-1-1*stride];
@@ -220,7 +243,10 @@ static void FUNCC(pred4x4_vertical_right)(uint8_t *_src, const uint8_t *topright
src[0+3*stride]=(l0 + 2*l1 + l2 + 2)>>2;
}
-static void FUNCC(pred4x4_vertical_left)(uint8_t *_src, const uint8_t *_topright, int _stride){
+static void FUNCC(pred4x4_vertical_left)(uint8_t *_src,
+ const uint8_t *_topright,
+ ptrdiff_t _stride)
+{
pixel *src = (pixel*)_src;
const pixel *topright = (const pixel*)_topright;
int stride = _stride/sizeof(pixel);
@@ -245,7 +271,9 @@ static void FUNCC(pred4x4_vertical_left)(uint8_t *_src, const uint8_t *_topright
src[3+3*stride]=(t4 + 2*t5 + t6 + 2)>>2;
}
-static void FUNCC(pred4x4_horizontal_up)(uint8_t *_src, const uint8_t *topright, int _stride){
+static void FUNCC(pred4x4_horizontal_up)(uint8_t *_src, const uint8_t *topright,
+ ptrdiff_t _stride)
+{
pixel *src = (pixel*)_src;
int stride = _stride/sizeof(pixel);
LOAD_LEFT_EDGE
@@ -268,7 +296,10 @@ static void FUNCC(pred4x4_horizontal_up)(uint8_t *_src, const uint8_t *topright,
src[3+3*stride]=l3;
}
-static void FUNCC(pred4x4_horizontal_down)(uint8_t *_src, const uint8_t *topright, int _stride){
+static void FUNCC(pred4x4_horizontal_down)(uint8_t *_src,
+ const uint8_t *topright,
+ ptrdiff_t _stride)
+{
pixel *src = (pixel*)_src;
int stride = _stride/sizeof(pixel);
const int lt= src[-1-1*stride];
@@ -293,7 +324,8 @@ static void FUNCC(pred4x4_horizontal_down)(uint8_t *_src, const uint8_t *toprigh
src[1+3*stride]=(l1 + 2*l2 + l3 + 2)>>2;
}
-static void FUNCC(pred16x16_vertical)(uint8_t *_src, int _stride){
+static void FUNCC(pred16x16_vertical)(uint8_t *_src, ptrdiff_t _stride)
+{
int i;
pixel *src = (pixel*)_src;
int stride = _stride/sizeof(pixel);
@@ -310,7 +342,8 @@ static void FUNCC(pred16x16_vertical)(uint8_t *_src, int _stride){
}
}
-static void FUNCC(pred16x16_horizontal)(uint8_t *_src, int stride){
+static void FUNCC(pred16x16_horizontal)(uint8_t *_src, ptrdiff_t stride)
+{
int i;
pixel *src = (pixel*)_src;
stride /= sizeof(pixel);
@@ -334,7 +367,8 @@ static void FUNCC(pred16x16_horizontal)(uint8_t *_src, int stride){
src += stride;\
}
-static void FUNCC(pred16x16_dc)(uint8_t *_src, int stride){
+static void FUNCC(pred16x16_dc)(uint8_t *_src, ptrdiff_t stride)
+{
int i, dc=0;
pixel *src = (pixel*)_src;
pixel4 dcsplat;
@@ -352,7 +386,8 @@ static void FUNCC(pred16x16_dc)(uint8_t *_src, int stride){
PREDICT_16x16_DC(dcsplat);
}
-static void FUNCC(pred16x16_left_dc)(uint8_t *_src, int stride){
+static void FUNCC(pred16x16_left_dc)(uint8_t *_src, ptrdiff_t stride)
+{
int i, dc=0;
pixel *src = (pixel*)_src;
pixel4 dcsplat;
@@ -366,7 +401,8 @@ static void FUNCC(pred16x16_left_dc)(uint8_t *_src, int stride){
PREDICT_16x16_DC(dcsplat);
}
-static void FUNCC(pred16x16_top_dc)(uint8_t *_src, int stride){
+static void FUNCC(pred16x16_top_dc)(uint8_t *_src, ptrdiff_t stride)
+{
int i, dc=0;
pixel *src = (pixel*)_src;
pixel4 dcsplat;
@@ -381,7 +417,8 @@ static void FUNCC(pred16x16_top_dc)(uint8_t *_src, int stride){
}
#define PRED16x16_X(n, v) \
-static void FUNCC(pred16x16_##n##_dc)(uint8_t *_src, int stride){\
+static void FUNCC(pred16x16_##n##_dc)(uint8_t *_src, ptrdiff_t stride)\
+{\
int i;\
pixel *src = (pixel*)_src;\
stride /= sizeof(pixel);\
@@ -392,7 +429,11 @@ PRED16x16_X(127, (1<<(BIT_DEPTH-1))-1)
PRED16x16_X(128, (1<<(BIT_DEPTH-1))+0)
PRED16x16_X(129, (1<<(BIT_DEPTH-1))+1)
-static inline void FUNCC(pred16x16_plane_compat)(uint8_t *_src, int _stride, const int svq3, const int rv40){
+static inline void FUNCC(pred16x16_plane_compat)(uint8_t *_src,
+ ptrdiff_t _stride,
+ const int svq3,
+ const int rv40)
+{
int i, j, k;
int a;
INIT_CLIP
@@ -437,11 +478,13 @@ static inline void FUNCC(pred16x16_plane_compat)(uint8_t *_src, int _stride, con
}
}
-static void FUNCC(pred16x16_plane)(uint8_t *src, int stride){
+static void FUNCC(pred16x16_plane)(uint8_t *src, ptrdiff_t stride)
+{
FUNCC(pred16x16_plane_compat)(src, stride, 0, 0);
}
-static void FUNCC(pred8x8_vertical)(uint8_t *_src, int _stride){
+static void FUNCC(pred8x8_vertical)(uint8_t *_src, ptrdiff_t _stride)
+{
int i;
pixel *src = (pixel*)_src;
int stride = _stride/sizeof(pixel);
@@ -454,7 +497,8 @@ static void FUNCC(pred8x8_vertical)(uint8_t *_src, int _stride){
}
}
-static void FUNCC(pred8x16_vertical)(uint8_t *_src, int _stride){
+static void FUNCC(pred8x16_vertical)(uint8_t *_src, ptrdiff_t _stride)
+{
int i;
pixel *src = (pixel*)_src;
int stride = _stride>>(sizeof(pixel)-1);
@@ -467,7 +511,8 @@ static void FUNCC(pred8x16_vertical)(uint8_t *_src, int _stride){
}
}
-static void FUNCC(pred8x8_horizontal)(uint8_t *_src, int stride){
+static void FUNCC(pred8x8_horizontal)(uint8_t *_src, ptrdiff_t stride)
+{
int i;
pixel *src = (pixel*)_src;
stride /= sizeof(pixel);
@@ -479,7 +524,8 @@ static void FUNCC(pred8x8_horizontal)(uint8_t *_src, int stride){
}
}
-static void FUNCC(pred8x16_horizontal)(uint8_t *_src, int stride){
+static void FUNCC(pred8x16_horizontal)(uint8_t *_src, ptrdiff_t stride)
+{
int i;
pixel *src = (pixel*)_src;
stride >>= sizeof(pixel)-1;
@@ -491,7 +537,8 @@ static void FUNCC(pred8x16_horizontal)(uint8_t *_src, int stride){
}
#define PRED8x8_X(n, v)\
-static void FUNCC(pred8x8_##n##_dc)(uint8_t *_src, int stride){\
+static void FUNCC(pred8x8_##n##_dc)(uint8_t *_src, ptrdiff_t stride)\
+{\
int i;\
const pixel4 a = PIXEL_SPLAT_X4(v);\
pixel *src = (pixel*)_src;\
@@ -506,12 +553,14 @@ PRED8x8_X(127, (1<<(BIT_DEPTH-1))-1)
PRED8x8_X(128, (1<<(BIT_DEPTH-1))+0)
PRED8x8_X(129, (1<<(BIT_DEPTH-1))+1)
-static void FUNCC(pred8x16_128_dc)(uint8_t *_src, int stride){
+static void FUNCC(pred8x16_128_dc)(uint8_t *_src, ptrdiff_t stride)
+{
FUNCC(pred8x8_128_dc)(_src, stride);
FUNCC(pred8x8_128_dc)(_src+8*stride, stride);
}
-static void FUNCC(pred8x8_left_dc)(uint8_t *_src, int stride){
+static void FUNCC(pred8x8_left_dc)(uint8_t *_src, ptrdiff_t stride)
+{
int i;
int dc0, dc2;
pixel4 dc0splat, dc2splat;
@@ -536,12 +585,14 @@ static void FUNCC(pred8x8_left_dc)(uint8_t *_src, int stride){
}
}
-static void FUNCC(pred8x16_left_dc)(uint8_t *_src, int stride){
+static void FUNCC(pred8x16_left_dc)(uint8_t *_src, ptrdiff_t stride)
+{
FUNCC(pred8x8_left_dc)(_src, stride);
FUNCC(pred8x8_left_dc)(_src+8*stride, stride);
}
-static void FUNCC(pred8x8_top_dc)(uint8_t *_src, int stride){
+static void FUNCC(pred8x8_top_dc)(uint8_t *_src, ptrdiff_t stride)
+{
int i;
int dc0, dc1;
pixel4 dc0splat, dc1splat;
@@ -566,7 +617,8 @@ static void FUNCC(pred8x8_top_dc)(uint8_t *_src, int stride){
}
}
-static void FUNCC(pred8x16_top_dc)(uint8_t *_src, int stride){
+static void FUNCC(pred8x16_top_dc)(uint8_t *_src, ptrdiff_t stride)
+{
int i;
int dc0, dc1;
pixel4 dc0splat, dc1splat;
@@ -587,7 +639,8 @@ static void FUNCC(pred8x16_top_dc)(uint8_t *_src, int stride){
}
}
-static void FUNCC(pred8x8_dc)(uint8_t *_src, int stride){
+static void FUNCC(pred8x8_dc)(uint8_t *_src, ptrdiff_t stride)
+{
int i;
int dc0, dc1, dc2;
pixel4 dc0splat, dc1splat, dc2splat, dc3splat;
@@ -615,7 +668,8 @@ static void FUNCC(pred8x8_dc)(uint8_t *_src, int stride){
}
}
-static void FUNCC(pred8x16_dc)(uint8_t *_src, int stride){
+static void FUNCC(pred8x16_dc)(uint8_t *_src, ptrdiff_t stride)
+{
int i;
int dc0, dc1, dc2, dc3, dc4;
pixel4 dc0splat, dc1splat, dc2splat, dc3splat, dc4splat, dc5splat, dc6splat, dc7splat;
@@ -657,51 +711,60 @@ static void FUNCC(pred8x16_dc)(uint8_t *_src, int stride){
}
}
-static void FUNC(pred8x8_mad_cow_dc_l0t)(uint8_t *src, int stride){
+static void FUNC(pred8x8_mad_cow_dc_l0t)(uint8_t *src, ptrdiff_t stride)
+{
FUNCC(pred8x8_top_dc)(src, stride);
FUNCC(pred4x4_dc)(src, NULL, stride);
}
-static void FUNC(pred8x16_mad_cow_dc_l0t)(uint8_t *src, int stride){
+static void FUNC(pred8x16_mad_cow_dc_l0t)(uint8_t *src, ptrdiff_t stride)
+{
FUNCC(pred8x16_top_dc)(src, stride);
FUNCC(pred4x4_dc)(src, NULL, stride);
}
-static void FUNC(pred8x8_mad_cow_dc_0lt)(uint8_t *src, int stride){
+static void FUNC(pred8x8_mad_cow_dc_0lt)(uint8_t *src, ptrdiff_t stride)
+{
FUNCC(pred8x8_dc)(src, stride);
FUNCC(pred4x4_top_dc)(src, NULL, stride);
}
-static void FUNC(pred8x16_mad_cow_dc_0lt)(uint8_t *src, int stride){
+static void FUNC(pred8x16_mad_cow_dc_0lt)(uint8_t *src, ptrdiff_t stride)
+{
FUNCC(pred8x16_dc)(src, stride);
FUNCC(pred4x4_top_dc)(src, NULL, stride);
}
-static void FUNC(pred8x8_mad_cow_dc_l00)(uint8_t *src, int stride){
+static void FUNC(pred8x8_mad_cow_dc_l00)(uint8_t *src, ptrdiff_t stride)
+{
FUNCC(pred8x8_left_dc)(src, stride);
FUNCC(pred4x4_128_dc)(src + 4*stride , NULL, stride);
FUNCC(pred4x4_128_dc)(src + 4*stride + 4*sizeof(pixel), NULL, stride);
}
-static void FUNC(pred8x16_mad_cow_dc_l00)(uint8_t *src, int stride){
+static void FUNC(pred8x16_mad_cow_dc_l00)(uint8_t *src, ptrdiff_t stride)
+{
FUNCC(pred8x16_left_dc)(src, stride);
FUNCC(pred4x4_128_dc)(src + 4*stride , NULL, stride);
FUNCC(pred4x4_128_dc)(src + 4*stride + 4*sizeof(pixel), NULL, stride);
}
-static void FUNC(pred8x8_mad_cow_dc_0l0)(uint8_t *src, int stride){
+static void FUNC(pred8x8_mad_cow_dc_0l0)(uint8_t *src, ptrdiff_t stride)
+{
FUNCC(pred8x8_left_dc)(src, stride);
FUNCC(pred4x4_128_dc)(src , NULL, stride);
FUNCC(pred4x4_128_dc)(src + 4*sizeof(pixel), NULL, stride);
}
-static void FUNC(pred8x16_mad_cow_dc_0l0)(uint8_t *src, int stride){
+static void FUNC(pred8x16_mad_cow_dc_0l0)(uint8_t *src, ptrdiff_t stride)
+{
FUNCC(pred8x16_left_dc)(src, stride);
FUNCC(pred4x4_128_dc)(src , NULL, stride);
FUNCC(pred4x4_128_dc)(src + 4*sizeof(pixel), NULL, stride);
}
-static void FUNCC(pred8x8_plane)(uint8_t *_src, int _stride){
+static void FUNCC(pred8x8_plane)(uint8_t *_src, ptrdiff_t _stride)
+{
int j, k;
int a;
INIT_CLIP
@@ -736,7 +799,8 @@ static void FUNCC(pred8x8_plane)(uint8_t *_src, int _stride){
}
}
-static void FUNCC(pred8x16_plane)(uint8_t *_src, int _stride){
+static void FUNCC(pred8x16_plane)(uint8_t *_src, ptrdiff_t _stride)
+{
int j, k;
int a;
INIT_CLIP
@@ -815,14 +879,16 @@ static void FUNCC(pred8x16_plane)(uint8_t *_src, int _stride){
src += stride; \
}
-static void FUNCC(pred8x8l_128_dc)(uint8_t *_src, int has_topleft, int has_topright, int _stride)
+static void FUNCC(pred8x8l_128_dc)(uint8_t *_src, int has_topleft,
+ int has_topright, ptrdiff_t _stride)
{
pixel *src = (pixel*)_src;
int stride = _stride/sizeof(pixel);
PREDICT_8x8_DC(PIXEL_SPLAT_X4(1<<(BIT_DEPTH-1)));
}
-static void FUNCC(pred8x8l_left_dc)(uint8_t *_src, int has_topleft, int has_topright, int _stride)
+static void FUNCC(pred8x8l_left_dc)(uint8_t *_src, int has_topleft,
+ int has_topright, ptrdiff_t _stride)
{
pixel *src = (pixel*)_src;
int stride = _stride/sizeof(pixel);
@@ -831,7 +897,8 @@ static void FUNCC(pred8x8l_left_dc)(uint8_t *_src, int has_topleft, int has_topr
const pixel4 dc = PIXEL_SPLAT_X4((l0+l1+l2+l3+l4+l5+l6+l7+4) >> 3);
PREDICT_8x8_DC(dc);
}
-static void FUNCC(pred8x8l_top_dc)(uint8_t *_src, int has_topleft, int has_topright, int _stride)
+static void FUNCC(pred8x8l_top_dc)(uint8_t *_src, int has_topleft,
+ int has_topright, ptrdiff_t _stride)
{
pixel *src = (pixel*)_src;
int stride = _stride/sizeof(pixel);
@@ -840,7 +907,8 @@ static void FUNCC(pred8x8l_top_dc)(uint8_t *_src, int has_topleft, int has_topri
const pixel4 dc = PIXEL_SPLAT_X4((t0+t1+t2+t3+t4+t5+t6+t7+4) >> 3);
PREDICT_8x8_DC(dc);
}
-static void FUNCC(pred8x8l_dc)(uint8_t *_src, int has_topleft, int has_topright, int _stride)
+static void FUNCC(pred8x8l_dc)(uint8_t *_src, int has_topleft,
+ int has_topright, ptrdiff_t _stride)
{
pixel *src = (pixel*)_src;
int stride = _stride/sizeof(pixel);
@@ -851,7 +919,8 @@ static void FUNCC(pred8x8l_dc)(uint8_t *_src, int has_topleft, int has_topright,
+t0+t1+t2+t3+t4+t5+t6+t7+8) >> 4);
PREDICT_8x8_DC(dc);
}
-static void FUNCC(pred8x8l_horizontal)(uint8_t *_src, int has_topleft, int has_topright, int _stride)
+static void FUNCC(pred8x8l_horizontal)(uint8_t *_src, int has_topleft,
+ int has_topright, ptrdiff_t _stride)
{
pixel *src = (pixel*)_src;
int stride = _stride/sizeof(pixel);
@@ -864,7 +933,8 @@ static void FUNCC(pred8x8l_horizontal)(uint8_t *_src, int has_topleft, int has_t
ROW(0); ROW(1); ROW(2); ROW(3); ROW(4); ROW(5); ROW(6); ROW(7);
#undef ROW
}
-static void FUNCC(pred8x8l_vertical)(uint8_t *_src, int has_topleft, int has_topright, int _stride)
+static void FUNCC(pred8x8l_vertical)(uint8_t *_src, int has_topleft,
+ int has_topright, ptrdiff_t _stride)
{
int y;
pixel *src = (pixel*)_src;
@@ -887,7 +957,8 @@ static void FUNCC(pred8x8l_vertical)(uint8_t *_src, int has_topleft, int has_top
AV_WN4PA(((pixel4*)(src+y*stride))+1, b);
}
}
-static void FUNCC(pred8x8l_down_left)(uint8_t *_src, int has_topleft, int has_topright, int _stride)
+static void FUNCC(pred8x8l_down_left)(uint8_t *_src, int has_topleft,
+ int has_topright, ptrdiff_t _stride)
{
pixel *src = (pixel*)_src;
int stride = _stride/sizeof(pixel);
@@ -909,7 +980,8 @@ static void FUNCC(pred8x8l_down_left)(uint8_t *_src, int has_topleft, int has_to
SRC(6,7)=SRC(7,6)= (t13 + 2*t14 + t15 + 2) >> 2;
SRC(7,7)= (t14 + 3*t15 + 2) >> 2;
}
-static void FUNCC(pred8x8l_down_right)(uint8_t *_src, int has_topleft, int has_topright, int _stride)
+static void FUNCC(pred8x8l_down_right)(uint8_t *_src, int has_topleft,
+ int has_topright, ptrdiff_t _stride)
{
pixel *src = (pixel*)_src;
int stride = _stride/sizeof(pixel);
@@ -932,7 +1004,8 @@ static void FUNCC(pred8x8l_down_right)(uint8_t *_src, int has_topleft, int has_t
SRC(6,0)=SRC(7,1)= (t4 + 2*t5 + t6 + 2) >> 2;
SRC(7,0)= (t5 + 2*t6 + t7 + 2) >> 2;
}
-static void FUNCC(pred8x8l_vertical_right)(uint8_t *_src, int has_topleft, int has_topright, int _stride)
+static void FUNCC(pred8x8l_vertical_right)(uint8_t *_src, int has_topleft,
+ int has_topright, ptrdiff_t _stride)
{
pixel *src = (pixel*)_src;
int stride = _stride/sizeof(pixel);
@@ -962,7 +1035,8 @@ static void FUNCC(pred8x8l_vertical_right)(uint8_t *_src, int has_topleft, int h
SRC(7,1)= (t5 + 2*t6 + t7 + 2) >> 2;
SRC(7,0)= (t6 + t7 + 1) >> 1;
}
-static void FUNCC(pred8x8l_horizontal_down)(uint8_t *_src, int has_topleft, int has_topright, int _stride)
+static void FUNCC(pred8x8l_horizontal_down)(uint8_t *_src, int has_topleft,
+ int has_topright, ptrdiff_t _stride)
{
pixel *src = (pixel*)_src;
int stride = _stride/sizeof(pixel);
@@ -992,7 +1066,8 @@ static void FUNCC(pred8x8l_horizontal_down)(uint8_t *_src, int has_topleft, int
SRC(6,0)= (t5 + 2*t4 + t3 + 2) >> 2;
SRC(7,0)= (t6 + 2*t5 + t4 + 2) >> 2;
}
-static void FUNCC(pred8x8l_vertical_left)(uint8_t *_src, int has_topleft, int has_topright, int _stride)
+static void FUNCC(pred8x8l_vertical_left)(uint8_t *_src, int has_topleft,
+ int has_topright, ptrdiff_t _stride)
{
pixel *src = (pixel*)_src;
int stride = _stride/sizeof(pixel);
@@ -1021,7 +1096,8 @@ static void FUNCC(pred8x8l_vertical_left)(uint8_t *_src, int has_topleft, int ha
SRC(7,6)= (t10 + t11 + 1) >> 1;
SRC(7,7)= (t10 + 2*t11 + t12 + 2) >> 2;
}
-static void FUNCC(pred8x8l_horizontal_up)(uint8_t *_src, int has_topleft, int has_topright, int _stride)
+static void FUNCC(pred8x8l_horizontal_up)(uint8_t *_src, int has_topleft,
+ int has_topright, ptrdiff_t _stride)
{
pixel *src = (pixel*)_src;
int stride = _stride/sizeof(pixel);
@@ -1055,7 +1131,9 @@ static void FUNCC(pred8x8l_horizontal_up)(uint8_t *_src, int has_topleft, int ha
#undef PL
#undef SRC
-static void FUNCC(pred4x4_vertical_add)(uint8_t *_pix, const DCTELEM *_block, int stride){
+static void FUNCC(pred4x4_vertical_add)(uint8_t *_pix, const DCTELEM *_block,
+ ptrdiff_t stride)
+{
int i;
pixel *pix = (pixel*)_pix;
const dctcoef *block = (const dctcoef*)_block;
@@ -1072,7 +1150,9 @@ static void FUNCC(pred4x4_vertical_add)(uint8_t *_pix, const DCTELEM *_block, in
}
}
-static void FUNCC(pred4x4_horizontal_add)(uint8_t *_pix, const DCTELEM *_block, int stride){
+static void FUNCC(pred4x4_horizontal_add)(uint8_t *_pix, const DCTELEM *_block,
+ ptrdiff_t stride)
+{
int i;
pixel *pix = (pixel*)_pix;
const dctcoef *block = (const dctcoef*)_block;
@@ -1088,7 +1168,9 @@ static void FUNCC(pred4x4_horizontal_add)(uint8_t *_pix, const DCTELEM *_block,
}
}
-static void FUNCC(pred8x8l_vertical_add)(uint8_t *_pix, const DCTELEM *_block, int stride){
+static void FUNCC(pred8x8l_vertical_add)(uint8_t *_pix, const DCTELEM *_block,
+ ptrdiff_t stride)
+{
int i;
pixel *pix = (pixel*)_pix;
const dctcoef *block = (const dctcoef*)_block;
@@ -1109,7 +1191,9 @@ static void FUNCC(pred8x8l_vertical_add)(uint8_t *_pix, const DCTELEM *_block, i
}
}
-static void FUNCC(pred8x8l_horizontal_add)(uint8_t *_pix, const DCTELEM *_block, int stride){
+static void FUNCC(pred8x8l_horizontal_add)(uint8_t *_pix, const DCTELEM *_block,
+ ptrdiff_t stride)
+{
int i;
pixel *pix = (pixel*)_pix;
const dctcoef *block = (const dctcoef*)_block;
@@ -1129,25 +1213,36 @@ static void FUNCC(pred8x8l_horizontal_add)(uint8_t *_pix, const DCTELEM *_block,
}
}
-static void FUNCC(pred16x16_vertical_add)(uint8_t *pix, const int *block_offset, const DCTELEM *block, int stride){
+static void FUNCC(pred16x16_vertical_add)(uint8_t *pix, const int *block_offset,
+ const DCTELEM *block,
+ ptrdiff_t stride)
+{
int i;
for(i=0; i<16; i++)
FUNCC(pred4x4_vertical_add)(pix + block_offset[i], block + i*16*sizeof(pixel), stride);
}
-static void FUNCC(pred16x16_horizontal_add)(uint8_t *pix, const int *block_offset, const DCTELEM *block, int stride){
+static void FUNCC(pred16x16_horizontal_add)(uint8_t *pix,
+ const int *block_offset,
+ const DCTELEM *block,
+ ptrdiff_t stride)
+{
int i;
for(i=0; i<16; i++)
FUNCC(pred4x4_horizontal_add)(pix + block_offset[i], block + i*16*sizeof(pixel), stride);
}
-static void FUNCC(pred8x8_vertical_add)(uint8_t *pix, const int *block_offset, const DCTELEM *block, int stride){
+static void FUNCC(pred8x8_vertical_add)(uint8_t *pix, const int *block_offset,
+ const DCTELEM *block, ptrdiff_t stride)
+{
int i;
for(i=0; i<4; i++)
FUNCC(pred4x4_vertical_add)(pix + block_offset[i], block + i*16*sizeof(pixel), stride);
}
-static void FUNCC(pred8x16_vertical_add)(uint8_t *pix, const int *block_offset, const DCTELEM *block, int stride){
+static void FUNCC(pred8x16_vertical_add)(uint8_t *pix, const int *block_offset,
+ const DCTELEM *block, ptrdiff_t stride)
+{
int i;
for(i=0; i<4; i++)
FUNCC(pred4x4_vertical_add)(pix + block_offset[i], block + i*16*sizeof(pixel), stride);
@@ -1155,13 +1250,19 @@ static void FUNCC(pred8x16_vertical_add)(uint8_t *pix, const int *block_offset,
FUNCC(pred4x4_vertical_add)(pix + block_offset[i+4], block + i*16*sizeof(pixel), stride);
}
-static void FUNCC(pred8x8_horizontal_add)(uint8_t *pix, const int *block_offset, const DCTELEM *block, int stride){
+static void FUNCC(pred8x8_horizontal_add)(uint8_t *pix, const int *block_offset,
+ const DCTELEM *block,
+ ptrdiff_t stride)
+{
int i;
for(i=0; i<4; i++)
FUNCC(pred4x4_horizontal_add)(pix + block_offset[i], block + i*16*sizeof(pixel), stride);
}
-static void FUNCC(pred8x16_horizontal_add)(uint8_t *pix, const int *block_offset, const DCTELEM *block, int stride){
+static void FUNCC(pred8x16_horizontal_add)(uint8_t *pix,
+ const int *block_offset,
+ const DCTELEM *block, ptrdiff_t stride)
+{
int i;
for(i=0; i<4; i++)
FUNCC(pred4x4_horizontal_add)(pix + block_offset[i], block + i*16*sizeof(pixel), stride);
diff --git a/gst-libs/ext/libav/libavcodec/huffman.c b/gst-libs/ext/libav/libavcodec/huffman.c
index 9446332..aef4929 100644
--- a/gst-libs/ext/libav/libavcodec/huffman.c
+++ b/gst-libs/ext/libav/libavcodec/huffman.c
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2006 Konstantin Shishkov
+ * Copyright (c) 2007 Loren Merritt
*
* This file is part of Libav.
*
@@ -30,25 +31,84 @@
/* symbol for Huffman tree node */
#define HNODE -1
+typedef struct {
+ uint64_t val;
+ int name;
+} HeapElem;
-static void get_tree_codes(uint32_t *bits, int16_t *lens, uint8_t *xlat, Node *nodes, int node, uint32_t pfx, int pl, int *pos, int no_zero_count)
+static void heap_sift(HeapElem *h, int root, int size)
+{
+ while (root * 2 + 1 < size) {
+ int child = root * 2 + 1;
+ if (child < size - 1 && h[child].val > h[child+1].val)
+ child++;
+ if (h[root].val > h[child].val) {
+ FFSWAP(HeapElem, h[root], h[child]);
+ root = child;
+ } else
+ break;
+ }
+}
+
+void ff_huff_gen_len_table(uint8_t *dst, const uint64_t *stats)
+{
+ HeapElem h[256];
+ int up[2*256];
+ int len[2*256];
+ int offset, i, next;
+ int size = 256;
+
+ for (offset = 1; ; offset <<= 1) {
+ for (i=0; i < size; i++) {
+ h[i].name = i;
+ h[i].val = (stats[i] << 8) + offset;
+ }
+ for (i = size / 2 - 1; i >= 0; i--)
+ heap_sift(h, i, size);
+
+ for (next = size; next < size * 2 - 1; next++) {
+ // merge the two smallest entries, and put it back in the heap
+ uint64_t min1v = h[0].val;
+ up[h[0].name] = next;
+ h[0].val = INT64_MAX;
+ heap_sift(h, 0, size);
+ up[h[0].name] = next;
+ h[0].name = next;
+ h[0].val += min1v;
+ heap_sift(h, 0, size);
+ }
+
+ len[2 * size - 2] = 0;
+ for (i = 2 * size - 3; i >= size; i--)
+ len[i] = len[up[i]] + 1;
+ for (i = 0; i < size; i++) {
+ dst[i] = len[up[i]] + 1;
+ if (dst[i] >= 32) break;
+ }
+ if (i==size) break;
+ }
+}
+
+static void get_tree_codes(uint32_t *bits, int16_t *lens, uint8_t *xlat,
+ Node *nodes, int node,
+ uint32_t pfx, int pl, int *pos, int no_zero_count)
{
int s;
s = nodes[node].sym;
- if(s != HNODE || (no_zero_count && !nodes[node].count)){
+ if (s != HNODE || (no_zero_count && !nodes[node].count)) {
bits[*pos] = pfx;
lens[*pos] = pl;
xlat[*pos] = s;
(*pos)++;
- }else{
+ } else {
pfx <<= 1;
pl++;
- get_tree_codes(bits, lens, xlat, nodes, nodes[node].n0, pfx, pl, pos,
- no_zero_count);
+ get_tree_codes(bits, lens, xlat, nodes, nodes[node].n0, pfx, pl,
+ pos, no_zero_count);
pfx |= 1;
- get_tree_codes(bits, lens, xlat, nodes, nodes[node].n0+1, pfx, pl, pos,
- no_zero_count);
+ get_tree_codes(bits, lens, xlat, nodes, nodes[node].n0 + 1, pfx, pl,
+ pos, no_zero_count);
}
}
@@ -60,7 +120,8 @@ static int build_huff_tree(VLC *vlc, Node *nodes, int head, int flags)
uint8_t xlat[256];
int pos = 0;
- get_tree_codes(bits, lens, xlat, nodes, head, 0, 0, &pos, no_zero_count);
+ get_tree_codes(bits, lens, xlat, nodes, head, 0, 0,
+ &pos, no_zero_count);
return ff_init_vlc_sparse(vlc, 9, pos, lens, 2, 2, bits, 4, 4, xlat, 1, 1, 0);
}
@@ -76,35 +137,37 @@ int ff_huff_build_tree(AVCodecContext *avctx, VLC *vlc, int nb_codes,
int cur_node;
int64_t sum = 0;
- for(i = 0; i < nb_codes; i++){
+ for (i = 0; i < nb_codes; i++) {
nodes[i].sym = i;
nodes[i].n0 = -2;
sum += nodes[i].count;
}
- if(sum >> 31) {
- av_log(avctx, AV_LOG_ERROR, "Too high symbol frequencies. Tree construction is not possible\n");
+ if (sum >> 31) {
+ av_log(avctx, AV_LOG_ERROR,
+ "Too high symbol frequencies. "
+ "Tree construction is not possible\n");
return -1;
}
qsort(nodes, nb_codes, sizeof(Node), cmp);
cur_node = nb_codes;
nodes[nb_codes*2-1].count = 0;
- for(i = 0; i < nb_codes*2-1; i += 2){
+ for (i = 0; i < nb_codes * 2 - 1; i += 2) {
nodes[cur_node].sym = HNODE;
- nodes[cur_node].count = nodes[i].count + nodes[i+1].count;
+ nodes[cur_node].count = nodes[i].count + nodes[i + 1].count;
nodes[cur_node].n0 = i;
- for(j = cur_node; j > 0; j--){
- if(nodes[j].count > nodes[j-1].count ||
- (nodes[j].count == nodes[j-1].count &&
- (!(flags & FF_HUFFMAN_FLAG_HNODE_FIRST) ||
- nodes[j].n0==j-1 || nodes[j].n0==j-2 ||
- (nodes[j].sym!=HNODE && nodes[j-1].sym!=HNODE))))
+ for (j = cur_node; j > 0; j--) {
+ if (nodes[j].count > nodes[j - 1].count ||
+ (nodes[j].count == nodes[j - 1].count &&
+ (!(flags & FF_HUFFMAN_FLAG_HNODE_FIRST) ||
+ nodes[j].n0 == j - 1 || nodes[j].n0 == j - 2 ||
+ (nodes[j].sym!=HNODE && nodes[j-1].sym!=HNODE))))
break;
- FFSWAP(Node, nodes[j], nodes[j-1]);
+ FFSWAP(Node, nodes[j], nodes[j - 1]);
}
cur_node++;
}
- if(build_huff_tree(vlc, nodes, nb_codes*2-2, flags) < 0){
+ if (build_huff_tree(vlc, nodes, nb_codes * 2 - 2, flags) < 0) {
av_log(avctx, AV_LOG_ERROR, "Error building tree\n");
return -1;
}
diff --git a/gst-libs/ext/libav/libavcodec/huffman.h b/gst-libs/ext/libav/libavcodec/huffman.h
index 5625313..043e6e3 100644
--- a/gst-libs/ext/libav/libavcodec/huffman.h
+++ b/gst-libs/ext/libav/libavcodec/huffman.h
@@ -29,7 +29,7 @@
#include "avcodec.h"
#include "get_bits.h"
-typedef struct {
+typedef struct Node {
int16_t sym;
int16_t n0;
uint32_t count;
@@ -42,4 +42,6 @@ typedef int (*HuffCmp)(const void *va, const void *vb);
int ff_huff_build_tree(AVCodecContext *avctx, VLC *vlc, int nb_codes,
Node *nodes, HuffCmp cmp, int flags);
+void ff_huff_gen_len_table(uint8_t *dst, const uint64_t *stats);
+
#endif /* AVCODEC_HUFFMAN_H */
diff --git a/gst-libs/ext/libav/libavcodec/huffyuv.c b/gst-libs/ext/libav/libavcodec/huffyuv.c
index f9e101d..58559f1 100644
--- a/gst-libs/ext/libav/libavcodec/huffyuv.c
+++ b/gst-libs/ext/libav/libavcodec/huffyuv.c
@@ -28,184 +28,25 @@
* huffyuv codec for libavcodec.
*/
-#include "avcodec.h"
-#include "get_bits.h"
-#include "put_bits.h"
-#include "dsputil.h"
-#include "thread.h"
-
-#define VLC_BITS 11
-
-#if HAVE_BIGENDIAN
-#define B 3
-#define G 2
-#define R 1
-#define A 0
-#else
-#define B 0
-#define G 1
-#define R 2
-#define A 3
-#endif
-
-typedef enum Predictor{
- LEFT= 0,
- PLANE,
- MEDIAN,
-} Predictor;
-
-typedef struct HYuvContext{
- AVCodecContext *avctx;
- Predictor predictor;
- GetBitContext gb;
- PutBitContext pb;
- int interlaced;
- int decorrelate;
- int bitstream_bpp;
- int version;
- int yuy2; //use yuy2 instead of 422P
- int bgr32; //use bgr32 instead of bgr24
- int width, height;
- int flags;
- int context;
- int picture_number;
- int last_slice_end;
- uint8_t *temp[3];
- uint64_t stats[3][256];
- uint8_t len[3][256];
- uint32_t bits[3][256];
- uint32_t pix_bgr_map[1<<VLC_BITS];
- VLC vlc[6]; //Y,U,V,YY,YU,YV
- AVFrame picture;
- uint8_t *bitstream_buffer;
- unsigned int bitstream_buffer_size;
- DSPContext dsp;
-}HYuvContext;
-
-#define classic_shift_luma_table_size 42
-static const unsigned char classic_shift_luma[classic_shift_luma_table_size + FF_INPUT_BUFFER_PADDING_SIZE] = {
- 34,36,35,69,135,232,9,16,10,24,11,23,12,16,13,10,14,8,15,8,
- 16,8,17,20,16,10,207,206,205,236,11,8,10,21,9,23,8,8,199,70,
- 69,68, 0
-};
-
-#define classic_shift_chroma_table_size 59
-static const unsigned char classic_shift_chroma[classic_shift_chroma_table_size + FF_INPUT_BUFFER_PADDING_SIZE] = {
- 66,36,37,38,39,40,41,75,76,77,110,239,144,81,82,83,84,85,118,183,
- 56,57,88,89,56,89,154,57,58,57,26,141,57,56,58,57,58,57,184,119,
- 214,245,116,83,82,49,80,79,78,77,44,75,41,40,39,38,37,36,34, 0
-};
-
-static const unsigned char classic_add_luma[256] = {
- 3, 9, 5, 12, 10, 35, 32, 29, 27, 50, 48, 45, 44, 41, 39, 37,
- 73, 70, 68, 65, 64, 61, 58, 56, 53, 50, 49, 46, 44, 41, 38, 36,
- 68, 65, 63, 61, 58, 55, 53, 51, 48, 46, 45, 43, 41, 39, 38, 36,
- 35, 33, 32, 30, 29, 27, 26, 25, 48, 47, 46, 44, 43, 41, 40, 39,
- 37, 36, 35, 34, 32, 31, 30, 28, 27, 26, 24, 23, 22, 20, 19, 37,
- 35, 34, 33, 31, 30, 29, 27, 26, 24, 23, 21, 20, 18, 17, 15, 29,
- 27, 26, 24, 22, 21, 19, 17, 16, 14, 26, 25, 23, 21, 19, 18, 16,
- 15, 27, 25, 23, 21, 19, 17, 16, 14, 26, 25, 23, 21, 18, 17, 14,
- 12, 17, 19, 13, 4, 9, 2, 11, 1, 7, 8, 0, 16, 3, 14, 6,
- 12, 10, 5, 15, 18, 11, 10, 13, 15, 16, 19, 20, 22, 24, 27, 15,
- 18, 20, 22, 24, 26, 14, 17, 20, 22, 24, 27, 15, 18, 20, 23, 25,
- 28, 16, 19, 22, 25, 28, 32, 36, 21, 25, 29, 33, 38, 42, 45, 49,
- 28, 31, 34, 37, 40, 42, 44, 47, 49, 50, 52, 54, 56, 57, 59, 60,
- 62, 64, 66, 67, 69, 35, 37, 39, 40, 42, 43, 45, 47, 48, 51, 52,
- 54, 55, 57, 59, 60, 62, 63, 66, 67, 69, 71, 72, 38, 40, 42, 43,
- 46, 47, 49, 51, 26, 28, 30, 31, 33, 34, 18, 19, 11, 13, 7, 8,
-};
-
-static const unsigned char classic_add_chroma[256] = {
- 3, 1, 2, 2, 2, 2, 3, 3, 7, 5, 7, 5, 8, 6, 11, 9,
- 7, 13, 11, 10, 9, 8, 7, 5, 9, 7, 6, 4, 7, 5, 8, 7,
- 11, 8, 13, 11, 19, 15, 22, 23, 20, 33, 32, 28, 27, 29, 51, 77,
- 43, 45, 76, 81, 46, 82, 75, 55, 56,144, 58, 80, 60, 74,147, 63,
- 143, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
- 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 27, 30, 21, 22,
- 17, 14, 5, 6,100, 54, 47, 50, 51, 53,106,107,108,109,110,111,
- 112,113,114,115, 4,117,118, 92, 94,121,122, 3,124,103, 2, 1,
- 0,129,130,131,120,119,126,125,136,137,138,139,140,141,142,134,
- 135,132,133,104, 64,101, 62, 57,102, 95, 93, 59, 61, 28, 97, 96,
- 52, 49, 48, 29, 32, 25, 24, 46, 23, 98, 45, 44, 43, 20, 42, 41,
- 19, 18, 99, 40, 15, 39, 38, 16, 13, 12, 11, 37, 10, 9, 8, 36,
- 7,128,127,105,123,116, 35, 34, 33,145, 31, 79, 42,146, 78, 26,
- 83, 48, 49, 50, 44, 47, 26, 31, 30, 18, 17, 19, 21, 24, 25, 13,
- 14, 16, 17, 18, 20, 21, 12, 14, 15, 9, 10, 6, 9, 6, 5, 8,
- 6, 12, 8, 10, 7, 9, 6, 4, 6, 2, 2, 3, 3, 3, 3, 2,
-};
-
-static inline int sub_left_prediction(HYuvContext *s, uint8_t *dst, uint8_t *src, int w, int left){
- int i;
- if(w<32){
- for(i=0; i<w; i++){
- const int temp= src[i];
- dst[i]= temp - left;
- left= temp;
- }
- return left;
- }else{
- for(i=0; i<16; i++){
- const int temp= src[i];
- dst[i]= temp - left;
- left= temp;
- }
- s->dsp.diff_bytes(dst+16, src+16, src+15, w-16);
- return src[w-1];
- }
-}
+#include <stdint.h>
-static inline void sub_left_prediction_bgr32(HYuvContext *s, uint8_t *dst, uint8_t *src, int w, int *red, int *green, int *blue){
- int i;
- int r,g,b;
- r= *red;
- g= *green;
- b= *blue;
- for(i=0; i<FFMIN(w,4); i++){
- const int rt= src[i*4+R];
- const int gt= src[i*4+G];
- const int bt= src[i*4+B];
- dst[i*4+R]= rt - r;
- dst[i*4+G]= gt - g;
- dst[i*4+B]= bt - b;
- r = rt;
- g = gt;
- b = bt;
- }
- s->dsp.diff_bytes(dst+16, src+16, src+12, w*4-16);
- *red= src[(w-1)*4+R];
- *green= src[(w-1)*4+G];
- *blue= src[(w-1)*4+B];
-}
-
-static int read_len_table(uint8_t *dst, GetBitContext *gb){
- int i, val, repeat;
+#include "libavutil/mem.h"
- for(i=0; i<256;){
- repeat= get_bits(gb, 3);
- val = get_bits(gb, 5);
- if(repeat==0)
- repeat= get_bits(gb, 8);
-//printf("%d %d\n", val, repeat);
- if(i+repeat > 256 || get_bits_left(gb) < 0) {
- av_log(NULL, AV_LOG_ERROR, "Error reading huffman table\n");
- return -1;
- }
- while (repeat--)
- dst[i++] = val;
- }
- return 0;
-}
+#include "avcodec.h"
+#include "dsputil.h"
+#include "huffyuv.h"
-static int generate_bits_table(uint32_t *dst, const uint8_t *len_table){
+int ff_huffyuv_generate_bits_table(uint32_t *dst, const uint8_t *len_table)
+{
int len, index;
- uint32_t bits=0;
+ uint32_t bits = 0;
- for(len=32; len>0; len--){
- for(index=0; index<256; index++){
- if(len_table[index]==len)
- dst[index]= bits++;
+ for (len = 32; len > 0; len--) {
+ for (index = 0; index < 256; index++) {
+ if (len_table[index] == len)
+ dst[index] = bits++;
}
- if(bits & 1){
+ if (bits & 1) {
av_log(NULL, AV_LOG_ERROR, "Error generating huffman table\n");
return -1;
}
@@ -214,1282 +55,43 @@ static int generate_bits_table(uint32_t *dst, const uint8_t *len_table){
return 0;
}
-#if CONFIG_HUFFYUV_ENCODER || CONFIG_FFVHUFF_ENCODER
-typedef struct {
- uint64_t val;
- int name;
-} HeapElem;
-
-static void heap_sift(HeapElem *h, int root, int size)
+av_cold int ff_huffyuv_alloc_temp(HYuvContext *s)
{
- while(root*2+1 < size) {
- int child = root*2+1;
- if(child < size-1 && h[child].val > h[child+1].val)
- child++;
- if(h[root].val > h[child].val) {
- FFSWAP(HeapElem, h[root], h[child]);
- root = child;
- } else
- break;
- }
-}
-
-static void generate_len_table(uint8_t *dst, const uint64_t *stats){
- HeapElem h[256];
- int up[2*256];
- int len[2*256];
- int offset, i, next;
- int size = 256;
-
- for(offset=1; ; offset<<=1){
- for(i=0; i<size; i++){
- h[i].name = i;
- h[i].val = (stats[i] << 8) + offset;
- }
- for(i=size/2-1; i>=0; i--)
- heap_sift(h, i, size);
-
- for(next=size; next<size*2-1; next++){
- // merge the two smallest entries, and put it back in the heap
- uint64_t min1v = h[0].val;
- up[h[0].name] = next;
- h[0].val = INT64_MAX;
- heap_sift(h, 0, size);
- up[h[0].name] = next;
- h[0].name = next;
- h[0].val += min1v;
- heap_sift(h, 0, size);
- }
-
- len[2*size-2] = 0;
- for(i=2*size-3; i>=size; i--)
- len[i] = len[up[i]] + 1;
- for(i=0; i<size; i++) {
- dst[i] = len[up[i]] + 1;
- if(dst[i] >= 32) break;
- }
- if(i==size) break;
- }
-}
-#endif /* CONFIG_HUFFYUV_ENCODER || CONFIG_FFVHUFF_ENCODER */
-
-static void generate_joint_tables(HYuvContext *s){
- uint16_t symbols[1<<VLC_BITS];
- uint16_t bits[1<<VLC_BITS];
- uint8_t len[1<<VLC_BITS];
- if(s->bitstream_bpp < 24){
- int p, i, y, u;
- for(p=0; p<3; p++){
- for(i=y=0; y<256; y++){
- int len0 = s->len[0][y];
- int limit = VLC_BITS - len0;
- if(limit <= 0)
- continue;
- for(u=0; u<256; u++){
- int len1 = s->len[p][u];
- if(len1 > limit)
- continue;
- len[i] = len0 + len1;
- bits[i] = (s->bits[0][y] << len1) + s->bits[p][u];
- symbols[i] = (y<<8) + u;
- if(symbols[i] != 0xffff) // reserved to mean "invalid"
- i++;
- }
- }
- ff_free_vlc(&s->vlc[3+p]);
- ff_init_vlc_sparse(&s->vlc[3+p], VLC_BITS, i, len, 1, 1, bits, 2, 2, symbols, 2, 2, 0);
- }
- }else{
- uint8_t (*map)[4] = (uint8_t(*)[4])s->pix_bgr_map;
- int i, b, g, r, code;
- int p0 = s->decorrelate;
- int p1 = !s->decorrelate;
- // restrict the range to +/-16 becaues that's pretty much guaranteed to
- // cover all the combinations that fit in 11 bits total, and it doesn't
- // matter if we miss a few rare codes.
- for(i=0, g=-16; g<16; g++){
- int len0 = s->len[p0][g&255];
- int limit0 = VLC_BITS - len0;
- if(limit0 < 2)
- continue;
- for(b=-16; b<16; b++){
- int len1 = s->len[p1][b&255];
- int limit1 = limit0 - len1;
- if(limit1 < 1)
- continue;
- code = (s->bits[p0][g&255] << len1) + s->bits[p1][b&255];
- for(r=-16; r<16; r++){
- int len2 = s->len[2][r&255];
- if(len2 > limit1)
- continue;
- len[i] = len0 + len1 + len2;
- bits[i] = (code << len2) + s->bits[2][r&255];
- if(s->decorrelate){
- map[i][G] = g;
- map[i][B] = g+b;
- map[i][R] = g+r;
- }else{
- map[i][B] = g;
- map[i][G] = b;
- map[i][R] = r;
- }
- i++;
- }
- }
- }
- ff_free_vlc(&s->vlc[3]);
- init_vlc(&s->vlc[3], VLC_BITS, i, len, 1, 1, bits, 2, 2, 0);
- }
-}
-
-static int read_huffman_tables(HYuvContext *s, const uint8_t *src, int length){
- GetBitContext gb;
- int i;
-
- init_get_bits(&gb, src, length*8);
-
- for(i=0; i<3; i++){
- if(read_len_table(s->len[i], &gb)<0)
- return -1;
- if(generate_bits_table(s->bits[i], s->len[i])<0){
- return -1;
- }
- ff_free_vlc(&s->vlc[i]);
- init_vlc(&s->vlc[i], VLC_BITS, 256, s->len[i], 1, 1, s->bits[i], 4, 4, 0);
- }
-
- generate_joint_tables(s);
-
- return (get_bits_count(&gb)+7)/8;
-}
-
-static int read_old_huffman_tables(HYuvContext *s){
-#if 1
- GetBitContext gb;
- int i;
-
- init_get_bits(&gb, classic_shift_luma, classic_shift_luma_table_size*8);
- if(read_len_table(s->len[0], &gb)<0)
- return -1;
- init_get_bits(&gb, classic_shift_chroma, classic_shift_chroma_table_size*8);
- if(read_len_table(s->len[1], &gb)<0)
- return -1;
-
- for(i=0; i<256; i++) s->bits[0][i] = classic_add_luma [i];
- for(i=0; i<256; i++) s->bits[1][i] = classic_add_chroma[i];
-
- if(s->bitstream_bpp >= 24){
- memcpy(s->bits[1], s->bits[0], 256*sizeof(uint32_t));
- memcpy(s->len[1] , s->len [0], 256*sizeof(uint8_t));
- }
- memcpy(s->bits[2], s->bits[1], 256*sizeof(uint32_t));
- memcpy(s->len[2] , s->len [1], 256*sizeof(uint8_t));
-
- for(i=0; i<3; i++){
- ff_free_vlc(&s->vlc[i]);
- init_vlc(&s->vlc[i], VLC_BITS, 256, s->len[i], 1, 1, s->bits[i], 4, 4, 0);
- }
-
- generate_joint_tables(s);
-
- return 0;
-#else
- av_log(s->avctx, AV_LOG_DEBUG, "v1 huffyuv is not supported \n");
- return -1;
-#endif
-}
-
-static av_cold void alloc_temp(HYuvContext *s){
int i;
- if(s->bitstream_bpp<24){
- for(i=0; i<3; i++){
+ if (s->bitstream_bpp<24) {
+ for (i=0; i<3; i++) {
s->temp[i]= av_malloc(s->width + 16);
+ if (!s->temp[i])
+ return AVERROR(ENOMEM);
}
- }else{
+ } else {
s->temp[0]= av_mallocz(4*s->width + 16);
+ if (!s->temp[0])
+ return AVERROR(ENOMEM);
}
-}
-
-static av_cold int common_init(AVCodecContext *avctx){
- HYuvContext *s = avctx->priv_data;
-
- s->avctx= avctx;
- s->flags= avctx->flags;
-
- dsputil_init(&s->dsp, avctx);
-
- s->width= avctx->width;
- s->height= avctx->height;
- assert(s->width>0 && s->height>0);
-
return 0;
}
-#if CONFIG_HUFFYUV_DECODER || CONFIG_FFVHUFF_DECODER
-static av_cold int decode_init(AVCodecContext *avctx)
+av_cold void ff_huffyuv_common_init(AVCodecContext *avctx)
{
HYuvContext *s = avctx->priv_data;
- common_init(avctx);
- memset(s->vlc, 0, 3*sizeof(VLC));
+ s->avctx = avctx;
+ s->flags = avctx->flags;
- avctx->coded_frame= &s->picture;
- s->interlaced= s->height > 288;
-
-s->bgr32=1;
-//if(avctx->extradata)
-// printf("extradata:%X, extradata_size:%d\n", *(uint32_t*)avctx->extradata, avctx->extradata_size);
- if(avctx->extradata_size){
- if((avctx->bits_per_coded_sample&7) && avctx->bits_per_coded_sample != 12)
- s->version=1; // do such files exist at all?
- else
- s->version=2;
- }else
- s->version=0;
-
- if(s->version==2){
- int method, interlace;
-
- if (avctx->extradata_size < 4)
- return -1;
-
- method= ((uint8_t*)avctx->extradata)[0];
- s->decorrelate= method&64 ? 1 : 0;
- s->predictor= method&63;
- s->bitstream_bpp= ((uint8_t*)avctx->extradata)[1];
- if(s->bitstream_bpp==0)
- s->bitstream_bpp= avctx->bits_per_coded_sample&~7;
- interlace= (((uint8_t*)avctx->extradata)[2] & 0x30) >> 4;
- s->interlaced= (interlace==1) ? 1 : (interlace==2) ? 0 : s->interlaced;
- s->context= ((uint8_t*)avctx->extradata)[2] & 0x40 ? 1 : 0;
-
- if(read_huffman_tables(s, ((uint8_t*)avctx->extradata)+4, avctx->extradata_size-4) < 0)
- return -1;
- }else{
- switch(avctx->bits_per_coded_sample&7){
- case 1:
- s->predictor= LEFT;
- s->decorrelate= 0;
- break;
- case 2:
- s->predictor= LEFT;
- s->decorrelate= 1;
- break;
- case 3:
- s->predictor= PLANE;
- s->decorrelate= avctx->bits_per_coded_sample >= 24;
- break;
- case 4:
- s->predictor= MEDIAN;
- s->decorrelate= 0;
- break;
- default:
- s->predictor= LEFT; //OLD
- s->decorrelate= 0;
- break;
- }
- s->bitstream_bpp= avctx->bits_per_coded_sample & ~7;
- s->context= 0;
-
- if(read_old_huffman_tables(s) < 0)
- return -1;
- }
+ ff_dsputil_init(&s->dsp, avctx);
- switch(s->bitstream_bpp){
- case 12:
- avctx->pix_fmt = PIX_FMT_YUV420P;
- break;
- case 16:
- if(s->yuy2){
- avctx->pix_fmt = PIX_FMT_YUYV422;
- }else{
- avctx->pix_fmt = PIX_FMT_YUV422P;
- }
- break;
- case 24:
- case 32:
- if(s->bgr32){
- avctx->pix_fmt = PIX_FMT_RGB32;
- }else{
- avctx->pix_fmt = PIX_FMT_BGR24;
- }
- break;
- default:
- return AVERROR_INVALIDDATA;
- }
-
- alloc_temp(s);
-
-// av_log(NULL, AV_LOG_DEBUG, "pred:%d bpp:%d hbpp:%d il:%d\n", s->predictor, s->bitstream_bpp, avctx->bits_per_coded_sample, s->interlaced);
-
- return 0;
+ s->width = avctx->width;
+ s->height = avctx->height;
+ assert(s->width>0 && s->height>0);
}
-static av_cold int decode_init_thread_copy(AVCodecContext *avctx)
+void ff_huffyuv_common_end(HYuvContext *s)
{
- HYuvContext *s = avctx->priv_data;
- int i;
-
- avctx->coded_frame= &s->picture;
- alloc_temp(s);
-
- for (i = 0; i < 6; i++)
- s->vlc[i].table = NULL;
-
- if(s->version==2){
- if(read_huffman_tables(s, ((uint8_t*)avctx->extradata)+4, avctx->extradata_size) < 0)
- return -1;
- }else{
- if(read_old_huffman_tables(s) < 0)
- return -1;
- }
-
- return 0;
-}
-#endif /* CONFIG_HUFFYUV_DECODER || CONFIG_FFVHUFF_DECODER */
-
-#if CONFIG_HUFFYUV_ENCODER || CONFIG_FFVHUFF_ENCODER
-static int store_table(HYuvContext *s, const uint8_t *len, uint8_t *buf){
int i;
- int index= 0;
-
- for(i=0; i<256;){
- int val= len[i];
- int repeat=0;
-
- for(; i<256 && len[i]==val && repeat<255; i++)
- repeat++;
- assert(val < 32 && val >0 && repeat<256 && repeat>0);
- if(repeat>7){
- buf[index++]= val;
- buf[index++]= repeat;
- }else{
- buf[index++]= val | (repeat<<5);
- }
- }
-
- return index;
-}
-
-static av_cold int encode_init(AVCodecContext *avctx)
-{
- HYuvContext *s = avctx->priv_data;
- int i, j;
-
- common_init(avctx);
-
- avctx->extradata= av_mallocz(1024*30); // 256*3+4 == 772
- avctx->stats_out= av_mallocz(1024*30); // 21*256*3(%llu ) + 3(\n) + 1(0) = 16132
- s->version=2;
-
- avctx->coded_frame= &s->picture;
-
- switch(avctx->pix_fmt){
- case PIX_FMT_YUV420P:
- s->bitstream_bpp= 12;
- break;
- case PIX_FMT_YUV422P:
- s->bitstream_bpp= 16;
- break;
- case PIX_FMT_RGB32:
- s->bitstream_bpp= 24;
- break;
- default:
- av_log(avctx, AV_LOG_ERROR, "format not supported\n");
- return -1;
- }
- avctx->bits_per_coded_sample= s->bitstream_bpp;
- s->decorrelate= s->bitstream_bpp >= 24;
- s->predictor= avctx->prediction_method;
- s->interlaced= avctx->flags&CODEC_FLAG_INTERLACED_ME ? 1 : 0;
- if(avctx->context_model==1){
- s->context= avctx->context_model;
- if(s->flags & (CODEC_FLAG_PASS1|CODEC_FLAG_PASS2)){
- av_log(avctx, AV_LOG_ERROR, "context=1 is not compatible with 2 pass huffyuv encoding\n");
- return -1;
- }
- }else s->context= 0;
-
- if(avctx->codec->id==CODEC_ID_HUFFYUV){
- if(avctx->pix_fmt==PIX_FMT_YUV420P){
- av_log(avctx, AV_LOG_ERROR, "Error: YV12 is not supported by huffyuv; use vcodec=ffvhuff or format=422p\n");
- return -1;
- }
- if(avctx->context_model){
- av_log(avctx, AV_LOG_ERROR, "Error: per-frame huffman tables are not supported by huffyuv; use vcodec=ffvhuff\n");
- return -1;
- }
- if(s->interlaced != ( s->height > 288 ))
- av_log(avctx, AV_LOG_INFO, "using huffyuv 2.2.0 or newer interlacing flag\n");
- }
-
- if(s->bitstream_bpp>=24 && s->predictor==MEDIAN){
- av_log(avctx, AV_LOG_ERROR, "Error: RGB is incompatible with median predictor\n");
- return -1;
- }
-
- ((uint8_t*)avctx->extradata)[0]= s->predictor | (s->decorrelate << 6);
- ((uint8_t*)avctx->extradata)[1]= s->bitstream_bpp;
- ((uint8_t*)avctx->extradata)[2]= s->interlaced ? 0x10 : 0x20;
- if(s->context)
- ((uint8_t*)avctx->extradata)[2]|= 0x40;
- ((uint8_t*)avctx->extradata)[3]= 0;
- s->avctx->extradata_size= 4;
-
- if(avctx->stats_in){
- char *p= avctx->stats_in;
-
- for(i=0; i<3; i++)
- for(j=0; j<256; j++)
- s->stats[i][j]= 1;
-
- for(;;){
- for(i=0; i<3; i++){
- char *next;
-
- for(j=0; j<256; j++){
- s->stats[i][j]+= strtol(p, &next, 0);
- if(next==p) return -1;
- p=next;
- }
- }
- if(p[0]==0 || p[1]==0 || p[2]==0) break;
- }
- }else{
- for(i=0; i<3; i++)
- for(j=0; j<256; j++){
- int d= FFMIN(j, 256-j);
-
- s->stats[i][j]= 100000000/(d+1);
- }
- }
-
- for(i=0; i<3; i++){
- generate_len_table(s->len[i], s->stats[i]);
-
- if(generate_bits_table(s->bits[i], s->len[i])<0){
- return -1;
- }
-
- s->avctx->extradata_size+=
- store_table(s, s->len[i], &((uint8_t*)s->avctx->extradata)[s->avctx->extradata_size]);
- }
-
- if(s->context){
- for(i=0; i<3; i++){
- int pels = s->width*s->height / (i?40:10);
- for(j=0; j<256; j++){
- int d= FFMIN(j, 256-j);
- s->stats[i][j]= pels/(d+1);
- }
- }
- }else{
- for(i=0; i<3; i++)
- for(j=0; j<256; j++)
- s->stats[i][j]= 0;
- }
-
-// printf("pred:%d bpp:%d hbpp:%d il:%d\n", s->predictor, s->bitstream_bpp, avctx->bits_per_coded_sample, s->interlaced);
-
- alloc_temp(s);
-
- s->picture_number=0;
-
- return 0;
-}
-#endif /* CONFIG_HUFFYUV_ENCODER || CONFIG_FFVHUFF_ENCODER */
-
-/* TODO instead of restarting the read when the code isn't in the first level
- * of the joint table, jump into the 2nd level of the individual table. */
-#define READ_2PIX(dst0, dst1, plane1){\
- uint16_t code = get_vlc2(&s->gb, s->vlc[3+plane1].table, VLC_BITS, 1);\
- if(code != 0xffff){\
- dst0 = code>>8;\
- dst1 = code;\
- }else{\
- dst0 = get_vlc2(&s->gb, s->vlc[0].table, VLC_BITS, 3);\
- dst1 = get_vlc2(&s->gb, s->vlc[plane1].table, VLC_BITS, 3);\
- }\
-}
-
-static void decode_422_bitstream(HYuvContext *s, int count){
- int i;
-
- count/=2;
-
- if(count >= (get_bits_left(&s->gb))/(31*4)){
- for (i = 0; i < count && get_bits_left(&s->gb) > 0; i++) {
- READ_2PIX(s->temp[0][2*i ], s->temp[1][i], 1);
- READ_2PIX(s->temp[0][2*i+1], s->temp[2][i], 2);
- }
- }else{
- for(i=0; i<count; i++){
- READ_2PIX(s->temp[0][2*i ], s->temp[1][i], 1);
- READ_2PIX(s->temp[0][2*i+1], s->temp[2][i], 2);
- }
- }
-}
-
-static void decode_gray_bitstream(HYuvContext *s, int count){
- int i;
-
- count/=2;
-
- if(count >= (get_bits_left(&s->gb))/(31*2)){
- for (i = 0; i < count && get_bits_left(&s->gb) > 0; i++) {
- READ_2PIX(s->temp[0][2*i ], s->temp[0][2*i+1], 0);
- }
- }else{
- for(i=0; i<count; i++){
- READ_2PIX(s->temp[0][2*i ], s->temp[0][2*i+1], 0);
- }
- }
-}
-
-#if CONFIG_HUFFYUV_ENCODER || CONFIG_FFVHUFF_ENCODER
-static int encode_422_bitstream(HYuvContext *s, int offset, int count){
- int i;
- const uint8_t *y = s->temp[0] + offset;
- const uint8_t *u = s->temp[1] + offset/2;
- const uint8_t *v = s->temp[2] + offset/2;
-
- if(s->pb.buf_end - s->pb.buf - (put_bits_count(&s->pb)>>3) < 2*4*count){
- av_log(s->avctx, AV_LOG_ERROR, "encoded frame too large\n");
- return -1;
- }
-
-#define LOAD4\
- int y0 = y[2*i];\
- int y1 = y[2*i+1];\
- int u0 = u[i];\
- int v0 = v[i];
-
- count/=2;
- if(s->flags&CODEC_FLAG_PASS1){
- for(i=0; i<count; i++){
- LOAD4;
- s->stats[0][y0]++;
- s->stats[1][u0]++;
- s->stats[0][y1]++;
- s->stats[2][v0]++;
- }
- }
- if(s->avctx->flags2&CODEC_FLAG2_NO_OUTPUT)
- return 0;
- if(s->context){
- for(i=0; i<count; i++){
- LOAD4;
- s->stats[0][y0]++;
- put_bits(&s->pb, s->len[0][y0], s->bits[0][y0]);
- s->stats[1][u0]++;
- put_bits(&s->pb, s->len[1][u0], s->bits[1][u0]);
- s->stats[0][y1]++;
- put_bits(&s->pb, s->len[0][y1], s->bits[0][y1]);
- s->stats[2][v0]++;
- put_bits(&s->pb, s->len[2][v0], s->bits[2][v0]);
- }
- }else{
- for(i=0; i<count; i++){
- LOAD4;
- put_bits(&s->pb, s->len[0][y0], s->bits[0][y0]);
- put_bits(&s->pb, s->len[1][u0], s->bits[1][u0]);
- put_bits(&s->pb, s->len[0][y1], s->bits[0][y1]);
- put_bits(&s->pb, s->len[2][v0], s->bits[2][v0]);
- }
- }
- return 0;
-}
-
-static int encode_gray_bitstream(HYuvContext *s, int count){
- int i;
-
- if(s->pb.buf_end - s->pb.buf - (put_bits_count(&s->pb)>>3) < 4*count){
- av_log(s->avctx, AV_LOG_ERROR, "encoded frame too large\n");
- return -1;
- }
-
-#define LOAD2\
- int y0 = s->temp[0][2*i];\
- int y1 = s->temp[0][2*i+1];
-#define STAT2\
- s->stats[0][y0]++;\
- s->stats[0][y1]++;
-#define WRITE2\
- put_bits(&s->pb, s->len[0][y0], s->bits[0][y0]);\
- put_bits(&s->pb, s->len[0][y1], s->bits[0][y1]);
-
- count/=2;
- if(s->flags&CODEC_FLAG_PASS1){
- for(i=0; i<count; i++){
- LOAD2;
- STAT2;
- }
- }
- if(s->avctx->flags2&CODEC_FLAG2_NO_OUTPUT)
- return 0;
-
- if(s->context){
- for(i=0; i<count; i++){
- LOAD2;
- STAT2;
- WRITE2;
- }
- }else{
- for(i=0; i<count; i++){
- LOAD2;
- WRITE2;
- }
- }
- return 0;
-}
-#endif /* CONFIG_HUFFYUV_ENCODER || CONFIG_FFVHUFF_ENCODER */
-
-static av_always_inline void decode_bgr_1(HYuvContext *s, int count, int decorrelate, int alpha){
- int i;
- for(i=0; i<count; i++){
- int code = get_vlc2(&s->gb, s->vlc[3].table, VLC_BITS, 1);
- if(code != -1){
- *(uint32_t*)&s->temp[0][4*i] = s->pix_bgr_map[code];
- }else if(decorrelate){
- s->temp[0][4*i+G] = get_vlc2(&s->gb, s->vlc[1].table, VLC_BITS, 3);
- s->temp[0][4*i+B] = get_vlc2(&s->gb, s->vlc[0].table, VLC_BITS, 3) + s->temp[0][4*i+G];
- s->temp[0][4*i+R] = get_vlc2(&s->gb, s->vlc[2].table, VLC_BITS, 3) + s->temp[0][4*i+G];
- }else{
- s->temp[0][4*i+B] = get_vlc2(&s->gb, s->vlc[0].table, VLC_BITS, 3);
- s->temp[0][4*i+G] = get_vlc2(&s->gb, s->vlc[1].table, VLC_BITS, 3);
- s->temp[0][4*i+R] = get_vlc2(&s->gb, s->vlc[2].table, VLC_BITS, 3);
- }
- if(alpha)
- s->temp[0][4*i+A] = get_vlc2(&s->gb, s->vlc[2].table, VLC_BITS, 3);
- }
-}
-
-static void decode_bgr_bitstream(HYuvContext *s, int count){
- if(s->decorrelate){
- if(s->bitstream_bpp==24)
- decode_bgr_1(s, count, 1, 0);
- else
- decode_bgr_1(s, count, 1, 1);
- }else{
- if(s->bitstream_bpp==24)
- decode_bgr_1(s, count, 0, 0);
- else
- decode_bgr_1(s, count, 0, 1);
- }
-}
-
-static int encode_bgr_bitstream(HYuvContext *s, int count){
- int i;
-
- if(s->pb.buf_end - s->pb.buf - (put_bits_count(&s->pb)>>3) < 3*4*count){
- av_log(s->avctx, AV_LOG_ERROR, "encoded frame too large\n");
- return -1;
- }
-
-#define LOAD3\
- int g= s->temp[0][4*i+G];\
- int b= (s->temp[0][4*i+B] - g) & 0xff;\
- int r= (s->temp[0][4*i+R] - g) & 0xff;
-#define STAT3\
- s->stats[0][b]++;\
- s->stats[1][g]++;\
- s->stats[2][r]++;
-#define WRITE3\
- put_bits(&s->pb, s->len[1][g], s->bits[1][g]);\
- put_bits(&s->pb, s->len[0][b], s->bits[0][b]);\
- put_bits(&s->pb, s->len[2][r], s->bits[2][r]);
-
- if((s->flags&CODEC_FLAG_PASS1) && (s->avctx->flags2&CODEC_FLAG2_NO_OUTPUT)){
- for(i=0; i<count; i++){
- LOAD3;
- STAT3;
- }
- }else if(s->context || (s->flags&CODEC_FLAG_PASS1)){
- for(i=0; i<count; i++){
- LOAD3;
- STAT3;
- WRITE3;
- }
- }else{
- for(i=0; i<count; i++){
- LOAD3;
- WRITE3;
- }
- }
- return 0;
-}
-
-#if CONFIG_HUFFYUV_DECODER || CONFIG_FFVHUFF_DECODER
-static void draw_slice(HYuvContext *s, int y){
- int h, cy, i;
- int offset[AV_NUM_DATA_POINTERS];
-
- if(s->avctx->draw_horiz_band==NULL)
- return;
-
- h= y - s->last_slice_end;
- y -= h;
-
- if(s->bitstream_bpp==12){
- cy= y>>1;
- }else{
- cy= y;
- }
-
- offset[0] = s->picture.linesize[0]*y;
- offset[1] = s->picture.linesize[1]*cy;
- offset[2] = s->picture.linesize[2]*cy;
- for (i = 3; i < AV_NUM_DATA_POINTERS; i++)
- offset[i] = 0;
- emms_c();
-
- s->avctx->draw_horiz_band(s->avctx, &s->picture, offset, y, 3, h);
-
- s->last_slice_end= y + h;
-}
-
-static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt){
- const uint8_t *buf = avpkt->data;
- int buf_size = avpkt->size;
- HYuvContext *s = avctx->priv_data;
- const int width= s->width;
- const int width2= s->width>>1;
- const int height= s->height;
- int fake_ystride, fake_ustride, fake_vstride;
- AVFrame * const p= &s->picture;
- int table_size= 0;
-
- AVFrame *picture = data;
-
- av_fast_malloc(&s->bitstream_buffer, &s->bitstream_buffer_size, buf_size + FF_INPUT_BUFFER_PADDING_SIZE);
- if (!s->bitstream_buffer)
- return AVERROR(ENOMEM);
-
- memset(s->bitstream_buffer + buf_size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
- s->dsp.bswap_buf((uint32_t*)s->bitstream_buffer, (const uint32_t*)buf, buf_size/4);
-
- if(p->data[0])
- ff_thread_release_buffer(avctx, p);
-
- p->reference= 0;
- if(ff_thread_get_buffer(avctx, p) < 0){
- av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
- return -1;
- }
-
- if(s->context){
- table_size = read_huffman_tables(s, s->bitstream_buffer, buf_size);
- if(table_size < 0)
- return -1;
- }
-
- if((unsigned)(buf_size-table_size) >= INT_MAX/8)
- return -1;
-
- init_get_bits(&s->gb, s->bitstream_buffer+table_size, (buf_size-table_size)*8);
-
- fake_ystride= s->interlaced ? p->linesize[0]*2 : p->linesize[0];
- fake_ustride= s->interlaced ? p->linesize[1]*2 : p->linesize[1];
- fake_vstride= s->interlaced ? p->linesize[2]*2 : p->linesize[2];
-
- s->last_slice_end= 0;
-
- if(s->bitstream_bpp<24){
- int y, cy;
- int lefty, leftu, leftv;
- int lefttopy, lefttopu, lefttopv;
-
- if(s->yuy2){
- p->data[0][3]= get_bits(&s->gb, 8);
- p->data[0][2]= get_bits(&s->gb, 8);
- p->data[0][1]= get_bits(&s->gb, 8);
- p->data[0][0]= get_bits(&s->gb, 8);
-
- av_log(avctx, AV_LOG_ERROR, "YUY2 output is not implemented yet\n");
- return -1;
- }else{
-
- leftv= p->data[2][0]= get_bits(&s->gb, 8);
- lefty= p->data[0][1]= get_bits(&s->gb, 8);
- leftu= p->data[1][0]= get_bits(&s->gb, 8);
- p->data[0][0]= get_bits(&s->gb, 8);
-
- switch(s->predictor){
- case LEFT:
- case PLANE:
- decode_422_bitstream(s, width-2);
- lefty= s->dsp.add_hfyu_left_prediction(p->data[0] + 2, s->temp[0], width-2, lefty);
- if(!(s->flags&CODEC_FLAG_GRAY)){
- leftu= s->dsp.add_hfyu_left_prediction(p->data[1] + 1, s->temp[1], width2-1, leftu);
- leftv= s->dsp.add_hfyu_left_prediction(p->data[2] + 1, s->temp[2], width2-1, leftv);
- }
-
- for(cy=y=1; y<s->height; y++,cy++){
- uint8_t *ydst, *udst, *vdst;
-
- if(s->bitstream_bpp==12){
- decode_gray_bitstream(s, width);
-
- ydst= p->data[0] + p->linesize[0]*y;
-
- lefty= s->dsp.add_hfyu_left_prediction(ydst, s->temp[0], width, lefty);
- if(s->predictor == PLANE){
- if(y>s->interlaced)
- s->dsp.add_bytes(ydst, ydst - fake_ystride, width);
- }
- y++;
- if(y>=s->height) break;
- }
-
- draw_slice(s, y);
-
- ydst= p->data[0] + p->linesize[0]*y;
- udst= p->data[1] + p->linesize[1]*cy;
- vdst= p->data[2] + p->linesize[2]*cy;
-
- decode_422_bitstream(s, width);
- lefty= s->dsp.add_hfyu_left_prediction(ydst, s->temp[0], width, lefty);
- if(!(s->flags&CODEC_FLAG_GRAY)){
- leftu= s->dsp.add_hfyu_left_prediction(udst, s->temp[1], width2, leftu);
- leftv= s->dsp.add_hfyu_left_prediction(vdst, s->temp[2], width2, leftv);
- }
- if(s->predictor == PLANE){
- if(cy>s->interlaced){
- s->dsp.add_bytes(ydst, ydst - fake_ystride, width);
- if(!(s->flags&CODEC_FLAG_GRAY)){
- s->dsp.add_bytes(udst, udst - fake_ustride, width2);
- s->dsp.add_bytes(vdst, vdst - fake_vstride, width2);
- }
- }
- }
- }
- draw_slice(s, height);
-
- break;
- case MEDIAN:
- /* first line except first 2 pixels is left predicted */
- decode_422_bitstream(s, width-2);
- lefty= s->dsp.add_hfyu_left_prediction(p->data[0] + 2, s->temp[0], width-2, lefty);
- if(!(s->flags&CODEC_FLAG_GRAY)){
- leftu= s->dsp.add_hfyu_left_prediction(p->data[1] + 1, s->temp[1], width2-1, leftu);
- leftv= s->dsp.add_hfyu_left_prediction(p->data[2] + 1, s->temp[2], width2-1, leftv);
- }
-
- cy=y=1;
-
- /* second line is left predicted for interlaced case */
- if(s->interlaced){
- decode_422_bitstream(s, width);
- lefty= s->dsp.add_hfyu_left_prediction(p->data[0] + p->linesize[0], s->temp[0], width, lefty);
- if(!(s->flags&CODEC_FLAG_GRAY)){
- leftu= s->dsp.add_hfyu_left_prediction(p->data[1] + p->linesize[2], s->temp[1], width2, leftu);
- leftv= s->dsp.add_hfyu_left_prediction(p->data[2] + p->linesize[1], s->temp[2], width2, leftv);
- }
- y++; cy++;
- }
-
- /* next 4 pixels are left predicted too */
- decode_422_bitstream(s, 4);
- lefty= s->dsp.add_hfyu_left_prediction(p->data[0] + fake_ystride, s->temp[0], 4, lefty);
- if(!(s->flags&CODEC_FLAG_GRAY)){
- leftu= s->dsp.add_hfyu_left_prediction(p->data[1] + fake_ustride, s->temp[1], 2, leftu);
- leftv= s->dsp.add_hfyu_left_prediction(p->data[2] + fake_vstride, s->temp[2], 2, leftv);
- }
-
- /* next line except the first 4 pixels is median predicted */
- lefttopy= p->data[0][3];
- decode_422_bitstream(s, width-4);
- s->dsp.add_hfyu_median_prediction(p->data[0] + fake_ystride+4, p->data[0]+4, s->temp[0], width-4, &lefty, &lefttopy);
- if(!(s->flags&CODEC_FLAG_GRAY)){
- lefttopu= p->data[1][1];
- lefttopv= p->data[2][1];
- s->dsp.add_hfyu_median_prediction(p->data[1] + fake_ustride+2, p->data[1]+2, s->temp[1], width2-2, &leftu, &lefttopu);
- s->dsp.add_hfyu_median_prediction(p->data[2] + fake_vstride+2, p->data[2]+2, s->temp[2], width2-2, &leftv, &lefttopv);
- }
- y++; cy++;
-
- for(; y<height; y++,cy++){
- uint8_t *ydst, *udst, *vdst;
-
- if(s->bitstream_bpp==12){
- while(2*cy > y){
- decode_gray_bitstream(s, width);
- ydst= p->data[0] + p->linesize[0]*y;
- s->dsp.add_hfyu_median_prediction(ydst, ydst - fake_ystride, s->temp[0], width, &lefty, &lefttopy);
- y++;
- }
- if(y>=height) break;
- }
- draw_slice(s, y);
-
- decode_422_bitstream(s, width);
-
- ydst= p->data[0] + p->linesize[0]*y;
- udst= p->data[1] + p->linesize[1]*cy;
- vdst= p->data[2] + p->linesize[2]*cy;
-
- s->dsp.add_hfyu_median_prediction(ydst, ydst - fake_ystride, s->temp[0], width, &lefty, &lefttopy);
- if(!(s->flags&CODEC_FLAG_GRAY)){
- s->dsp.add_hfyu_median_prediction(udst, udst - fake_ustride, s->temp[1], width2, &leftu, &lefttopu);
- s->dsp.add_hfyu_median_prediction(vdst, vdst - fake_vstride, s->temp[2], width2, &leftv, &lefttopv);
- }
- }
-
- draw_slice(s, height);
- break;
- }
- }
- }else{
- int y;
- int leftr, leftg, leftb, lefta;
- const int last_line= (height-1)*p->linesize[0];
-
- if(s->bitstream_bpp==32){
- lefta= p->data[0][last_line+A]= get_bits(&s->gb, 8);
- leftr= p->data[0][last_line+R]= get_bits(&s->gb, 8);
- leftg= p->data[0][last_line+G]= get_bits(&s->gb, 8);
- leftb= p->data[0][last_line+B]= get_bits(&s->gb, 8);
- }else{
- leftr= p->data[0][last_line+R]= get_bits(&s->gb, 8);
- leftg= p->data[0][last_line+G]= get_bits(&s->gb, 8);
- leftb= p->data[0][last_line+B]= get_bits(&s->gb, 8);
- lefta= p->data[0][last_line+A]= 255;
- skip_bits(&s->gb, 8);
- }
-
- if(s->bgr32){
- switch(s->predictor){
- case LEFT:
- case PLANE:
- decode_bgr_bitstream(s, width-1);
- s->dsp.add_hfyu_left_prediction_bgr32(p->data[0] + last_line+4, s->temp[0], width-1, &leftr, &leftg, &leftb, &lefta);
-
- for(y=s->height-2; y>=0; y--){ //Yes it is stored upside down.
- decode_bgr_bitstream(s, width);
-
- s->dsp.add_hfyu_left_prediction_bgr32(p->data[0] + p->linesize[0]*y, s->temp[0], width, &leftr, &leftg, &leftb, &lefta);
- if(s->predictor == PLANE){
- if(s->bitstream_bpp!=32) lefta=0;
- if((y&s->interlaced)==0 && y<s->height-1-s->interlaced){
- s->dsp.add_bytes(p->data[0] + p->linesize[0]*y,
- p->data[0] + p->linesize[0]*y + fake_ystride, fake_ystride);
- }
- }
- }
- draw_slice(s, height); // just 1 large slice as this is not possible in reverse order
- break;
- default:
- av_log(avctx, AV_LOG_ERROR, "prediction type not supported!\n");
- }
- }else{
-
- av_log(avctx, AV_LOG_ERROR, "BGR24 output is not implemented yet\n");
- return -1;
- }
- }
- emms_c();
-
- *picture= *p;
- *data_size = sizeof(AVFrame);
-
- return (get_bits_count(&s->gb)+31)/32*4 + table_size;
-}
-#endif /* CONFIG_HUFFYUV_DECODER || CONFIG_FFVHUFF_DECODER */
-
-static int common_end(HYuvContext *s){
- int i;
-
- for(i=0; i<3; i++){
+ for(i = 0; i < 3; i++) {
av_freep(&s->temp[i]);
}
- return 0;
-}
-
-#if CONFIG_HUFFYUV_DECODER || CONFIG_FFVHUFF_DECODER
-static av_cold int decode_end(AVCodecContext *avctx)
-{
- HYuvContext *s = avctx->priv_data;
- int i;
-
- if (s->picture.data[0])
- avctx->release_buffer(avctx, &s->picture);
-
- common_end(s);
- av_freep(&s->bitstream_buffer);
-
- for(i=0; i<6; i++){
- ff_free_vlc(&s->vlc[i]);
- }
-
- return 0;
}
-#endif /* CONFIG_HUFFYUV_DECODER || CONFIG_FFVHUFF_DECODER */
-
-#if CONFIG_HUFFYUV_ENCODER || CONFIG_FFVHUFF_ENCODER
-static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size, void *data){
- HYuvContext *s = avctx->priv_data;
- AVFrame *pict = data;
- const int width= s->width;
- const int width2= s->width>>1;
- const int height= s->height;
- const int fake_ystride= s->interlaced ? pict->linesize[0]*2 : pict->linesize[0];
- const int fake_ustride= s->interlaced ? pict->linesize[1]*2 : pict->linesize[1];
- const int fake_vstride= s->interlaced ? pict->linesize[2]*2 : pict->linesize[2];
- AVFrame * const p= &s->picture;
- int i, j, size=0;
-
- *p = *pict;
- p->pict_type= AV_PICTURE_TYPE_I;
- p->key_frame= 1;
-
- if(s->context){
- for(i=0; i<3; i++){
- generate_len_table(s->len[i], s->stats[i]);
- if(generate_bits_table(s->bits[i], s->len[i])<0)
- return -1;
- size+= store_table(s, s->len[i], &buf[size]);
- }
-
- for(i=0; i<3; i++)
- for(j=0; j<256; j++)
- s->stats[i][j] >>= 1;
- }
-
- init_put_bits(&s->pb, buf+size, buf_size-size);
-
- if(avctx->pix_fmt == PIX_FMT_YUV422P || avctx->pix_fmt == PIX_FMT_YUV420P){
- int lefty, leftu, leftv, y, cy;
-
- put_bits(&s->pb, 8, leftv= p->data[2][0]);
- put_bits(&s->pb, 8, lefty= p->data[0][1]);
- put_bits(&s->pb, 8, leftu= p->data[1][0]);
- put_bits(&s->pb, 8, p->data[0][0]);
-
- lefty= sub_left_prediction(s, s->temp[0], p->data[0], width , 0);
- leftu= sub_left_prediction(s, s->temp[1], p->data[1], width2, 0);
- leftv= sub_left_prediction(s, s->temp[2], p->data[2], width2, 0);
-
- encode_422_bitstream(s, 2, width-2);
-
- if(s->predictor==MEDIAN){
- int lefttopy, lefttopu, lefttopv;
- cy=y=1;
- if(s->interlaced){
- lefty= sub_left_prediction(s, s->temp[0], p->data[0]+p->linesize[0], width , lefty);
- leftu= sub_left_prediction(s, s->temp[1], p->data[1]+p->linesize[1], width2, leftu);
- leftv= sub_left_prediction(s, s->temp[2], p->data[2]+p->linesize[2], width2, leftv);
-
- encode_422_bitstream(s, 0, width);
- y++; cy++;
- }
-
- lefty= sub_left_prediction(s, s->temp[0], p->data[0]+fake_ystride, 4, lefty);
- leftu= sub_left_prediction(s, s->temp[1], p->data[1]+fake_ustride, 2, leftu);
- leftv= sub_left_prediction(s, s->temp[2], p->data[2]+fake_vstride, 2, leftv);
-
- encode_422_bitstream(s, 0, 4);
-
- lefttopy= p->data[0][3];
- lefttopu= p->data[1][1];
- lefttopv= p->data[2][1];
- s->dsp.sub_hfyu_median_prediction(s->temp[0], p->data[0]+4, p->data[0] + fake_ystride+4, width-4 , &lefty, &lefttopy);
- s->dsp.sub_hfyu_median_prediction(s->temp[1], p->data[1]+2, p->data[1] + fake_ustride+2, width2-2, &leftu, &lefttopu);
- s->dsp.sub_hfyu_median_prediction(s->temp[2], p->data[2]+2, p->data[2] + fake_vstride+2, width2-2, &leftv, &lefttopv);
- encode_422_bitstream(s, 0, width-4);
- y++; cy++;
-
- for(; y<height; y++,cy++){
- uint8_t *ydst, *udst, *vdst;
-
- if(s->bitstream_bpp==12){
- while(2*cy > y){
- ydst= p->data[0] + p->linesize[0]*y;
- s->dsp.sub_hfyu_median_prediction(s->temp[0], ydst - fake_ystride, ydst, width , &lefty, &lefttopy);
- encode_gray_bitstream(s, width);
- y++;
- }
- if(y>=height) break;
- }
- ydst= p->data[0] + p->linesize[0]*y;
- udst= p->data[1] + p->linesize[1]*cy;
- vdst= p->data[2] + p->linesize[2]*cy;
-
- s->dsp.sub_hfyu_median_prediction(s->temp[0], ydst - fake_ystride, ydst, width , &lefty, &lefttopy);
- s->dsp.sub_hfyu_median_prediction(s->temp[1], udst - fake_ustride, udst, width2, &leftu, &lefttopu);
- s->dsp.sub_hfyu_median_prediction(s->temp[2], vdst - fake_vstride, vdst, width2, &leftv, &lefttopv);
-
- encode_422_bitstream(s, 0, width);
- }
- }else{
- for(cy=y=1; y<height; y++,cy++){
- uint8_t *ydst, *udst, *vdst;
-
- /* encode a luma only line & y++ */
- if(s->bitstream_bpp==12){
- ydst= p->data[0] + p->linesize[0]*y;
-
- if(s->predictor == PLANE && s->interlaced < y){
- s->dsp.diff_bytes(s->temp[1], ydst, ydst - fake_ystride, width);
-
- lefty= sub_left_prediction(s, s->temp[0], s->temp[1], width , lefty);
- }else{
- lefty= sub_left_prediction(s, s->temp[0], ydst, width , lefty);
- }
- encode_gray_bitstream(s, width);
- y++;
- if(y>=height) break;
- }
-
- ydst= p->data[0] + p->linesize[0]*y;
- udst= p->data[1] + p->linesize[1]*cy;
- vdst= p->data[2] + p->linesize[2]*cy;
-
- if(s->predictor == PLANE && s->interlaced < cy){
- s->dsp.diff_bytes(s->temp[1], ydst, ydst - fake_ystride, width);
- s->dsp.diff_bytes(s->temp[2], udst, udst - fake_ustride, width2);
- s->dsp.diff_bytes(s->temp[2] + width2, vdst, vdst - fake_vstride, width2);
-
- lefty= sub_left_prediction(s, s->temp[0], s->temp[1], width , lefty);
- leftu= sub_left_prediction(s, s->temp[1], s->temp[2], width2, leftu);
- leftv= sub_left_prediction(s, s->temp[2], s->temp[2] + width2, width2, leftv);
- }else{
- lefty= sub_left_prediction(s, s->temp[0], ydst, width , lefty);
- leftu= sub_left_prediction(s, s->temp[1], udst, width2, leftu);
- leftv= sub_left_prediction(s, s->temp[2], vdst, width2, leftv);
- }
-
- encode_422_bitstream(s, 0, width);
- }
- }
- }else if(avctx->pix_fmt == PIX_FMT_RGB32){
- uint8_t *data = p->data[0] + (height-1)*p->linesize[0];
- const int stride = -p->linesize[0];
- const int fake_stride = -fake_ystride;
- int y;
- int leftr, leftg, leftb;
-
- put_bits(&s->pb, 8, leftr= data[R]);
- put_bits(&s->pb, 8, leftg= data[G]);
- put_bits(&s->pb, 8, leftb= data[B]);
- put_bits(&s->pb, 8, 0);
-
- sub_left_prediction_bgr32(s, s->temp[0], data+4, width-1, &leftr, &leftg, &leftb);
- encode_bgr_bitstream(s, width-1);
-
- for(y=1; y<s->height; y++){
- uint8_t *dst = data + y*stride;
- if(s->predictor == PLANE && s->interlaced < y){
- s->dsp.diff_bytes(s->temp[1], dst, dst - fake_stride, width*4);
- sub_left_prediction_bgr32(s, s->temp[0], s->temp[1], width, &leftr, &leftg, &leftb);
- }else{
- sub_left_prediction_bgr32(s, s->temp[0], dst, width, &leftr, &leftg, &leftb);
- }
- encode_bgr_bitstream(s, width);
- }
- }else{
- av_log(avctx, AV_LOG_ERROR, "Format not supported!\n");
- }
- emms_c();
-
- size+= (put_bits_count(&s->pb)+31)/8;
- put_bits(&s->pb, 16, 0);
- put_bits(&s->pb, 15, 0);
- size/= 4;
-
- if((s->flags&CODEC_FLAG_PASS1) && (s->picture_number&31)==0){
- int j;
- char *p= avctx->stats_out;
- char *end= p + 1024*30;
- for(i=0; i<3; i++){
- for(j=0; j<256; j++){
- snprintf(p, end-p, "%"PRIu64" ", s->stats[i][j]);
- p+= strlen(p);
- s->stats[i][j]= 0;
- }
- snprintf(p, end-p, "\n");
- p++;
- }
- } else
- avctx->stats_out[0] = '\0';
- if(!(s->avctx->flags2 & CODEC_FLAG2_NO_OUTPUT)){
- flush_put_bits(&s->pb);
- s->dsp.bswap_buf((uint32_t*)buf, (uint32_t*)buf, size);
- }
-
- s->picture_number++;
-
- return size*4;
-}
-
-static av_cold int encode_end(AVCodecContext *avctx)
-{
- HYuvContext *s = avctx->priv_data;
-
- common_end(s);
-
- av_freep(&avctx->extradata);
- av_freep(&avctx->stats_out);
-
- return 0;
-}
-#endif /* CONFIG_HUFFYUV_ENCODER || CONFIG_FFVHUFF_ENCODER */
-
-#if CONFIG_HUFFYUV_DECODER
-AVCodec ff_huffyuv_decoder = {
- .name = "huffyuv",
- .type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_HUFFYUV,
- .priv_data_size = sizeof(HYuvContext),
- .init = decode_init,
- .close = decode_end,
- .decode = decode_frame,
- .capabilities = CODEC_CAP_DR1 | CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_FRAME_THREADS,
- .init_thread_copy = ONLY_IF_THREADS_ENABLED(decode_init_thread_copy),
- .long_name = NULL_IF_CONFIG_SMALL("Huffyuv / HuffYUV"),
-};
-#endif
-
-#if CONFIG_FFVHUFF_DECODER
-AVCodec ff_ffvhuff_decoder = {
- .name = "ffvhuff",
- .type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_FFVHUFF,
- .priv_data_size = sizeof(HYuvContext),
- .init = decode_init,
- .close = decode_end,
- .decode = decode_frame,
- .capabilities = CODEC_CAP_DR1 | CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_FRAME_THREADS,
- .init_thread_copy = ONLY_IF_THREADS_ENABLED(decode_init_thread_copy),
- .long_name = NULL_IF_CONFIG_SMALL("Huffyuv FFmpeg variant"),
-};
-#endif
-
-#if CONFIG_HUFFYUV_ENCODER
-AVCodec ff_huffyuv_encoder = {
- .name = "huffyuv",
- .type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_HUFFYUV,
- .priv_data_size = sizeof(HYuvContext),
- .init = encode_init,
- .encode = encode_frame,
- .close = encode_end,
- .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV422P, PIX_FMT_RGB32, PIX_FMT_NONE},
- .long_name = NULL_IF_CONFIG_SMALL("Huffyuv / HuffYUV"),
-};
-#endif
-
-#if CONFIG_FFVHUFF_ENCODER
-AVCodec ff_ffvhuff_encoder = {
- .name = "ffvhuff",
- .type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_FFVHUFF,
- .priv_data_size = sizeof(HYuvContext),
- .init = encode_init,
- .encode = encode_frame,
- .close = encode_end,
- .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_YUV422P, PIX_FMT_RGB32, PIX_FMT_NONE},
- .long_name = NULL_IF_CONFIG_SMALL("Huffyuv FFmpeg variant"),
-};
-#endif
diff --git a/gst-libs/ext/libav/libavcodec/huffyuv.h b/gst-libs/ext/libav/libavcodec/huffyuv.h
new file mode 100644
index 0000000..c464d83
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/huffyuv.h
@@ -0,0 +1,92 @@
+/*
+ * Copyright (c) 2002-2003 Michael Niedermayer <michaelni@gmx.at>
+ *
+ * see http://www.pcisys.net/~melanson/codecs/huffyuv.txt for a description of
+ * the algorithm used
+ *
+ * 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
+ * huffyuv codec for libavcodec.
+ */
+
+#ifndef AVCODEC_HUFFYUV_H
+#define AVCODEC_HUFFYUV_H
+
+#include <stdint.h>
+
+#include "avcodec.h"
+#include "dsputil.h"
+#include "get_bits.h"
+#include "put_bits.h"
+
+#define VLC_BITS 11
+
+#if HAVE_BIGENDIAN
+#define B 3
+#define G 2
+#define R 1
+#define A 0
+#else
+#define B 0
+#define G 1
+#define R 2
+#define A 3
+#endif
+
+typedef enum Predictor {
+ LEFT = 0,
+ PLANE,
+ MEDIAN,
+} Predictor;
+
+typedef struct HYuvContext {
+ AVCodecContext *avctx;
+ Predictor predictor;
+ GetBitContext gb;
+ PutBitContext pb;
+ int interlaced;
+ int decorrelate;
+ int bitstream_bpp;
+ int version;
+ int yuy2; //use yuy2 instead of 422P
+ int bgr32; //use bgr32 instead of bgr24
+ int width, height;
+ int flags;
+ int context;
+ int picture_number;
+ int last_slice_end;
+ uint8_t *temp[3];
+ uint64_t stats[3][256];
+ uint8_t len[3][256];
+ uint32_t bits[3][256];
+ uint32_t pix_bgr_map[1<<VLC_BITS];
+ VLC vlc[6]; //Y,U,V,YY,YU,YV
+ AVFrame picture;
+ uint8_t *bitstream_buffer;
+ unsigned int bitstream_buffer_size;
+ DSPContext dsp;
+} HYuvContext;
+
+void ff_huffyuv_common_init(AVCodecContext *s);
+void ff_huffyuv_common_end(HYuvContext *s);
+int ff_huffyuv_alloc_temp(HYuvContext *s);
+int ff_huffyuv_generate_bits_table(uint32_t *dst, const uint8_t *len_table);
+
+#endif /* AVCODEC_HUFFYUV_H */
diff --git a/gst-libs/ext/libav/libavcodec/huffyuvdec.c b/gst-libs/ext/libav/libavcodec/huffyuvdec.c
new file mode 100644
index 0000000..0946d3d
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/huffyuvdec.c
@@ -0,0 +1,782 @@
+/*
+ * huffyuv decoder
+ *
+ * Copyright (c) 2002-2003 Michael Niedermayer <michaelni@gmx.at>
+ *
+ * see http://www.pcisys.net/~melanson/codecs/huffyuv.txt for a description of
+ * the algorithm used
+ *
+ * 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
+ * huffyuv decoder
+ */
+
+#include "avcodec.h"
+#include "dsputil.h"
+#include "get_bits.h"
+#include "huffyuv.h"
+#include "thread.h"
+
+#define classic_shift_luma_table_size 42
+static const unsigned char classic_shift_luma[classic_shift_luma_table_size + FF_INPUT_BUFFER_PADDING_SIZE] = {
+ 34,36,35,69,135,232,9,16,10,24,11,23,12,16,13,10,14,8,15,8,
+ 16,8,17,20,16,10,207,206,205,236,11,8,10,21,9,23,8,8,199,70,
+ 69,68, 0
+};
+
+#define classic_shift_chroma_table_size 59
+static const unsigned char classic_shift_chroma[classic_shift_chroma_table_size + FF_INPUT_BUFFER_PADDING_SIZE] = {
+ 66,36,37,38,39,40,41,75,76,77,110,239,144,81,82,83,84,85,118,183,
+ 56,57,88,89,56,89,154,57,58,57,26,141,57,56,58,57,58,57,184,119,
+ 214,245,116,83,82,49,80,79,78,77,44,75,41,40,39,38,37,36,34, 0
+};
+
+static const unsigned char classic_add_luma[256] = {
+ 3, 9, 5, 12, 10, 35, 32, 29, 27, 50, 48, 45, 44, 41, 39, 37,
+ 73, 70, 68, 65, 64, 61, 58, 56, 53, 50, 49, 46, 44, 41, 38, 36,
+ 68, 65, 63, 61, 58, 55, 53, 51, 48, 46, 45, 43, 41, 39, 38, 36,
+ 35, 33, 32, 30, 29, 27, 26, 25, 48, 47, 46, 44, 43, 41, 40, 39,
+ 37, 36, 35, 34, 32, 31, 30, 28, 27, 26, 24, 23, 22, 20, 19, 37,
+ 35, 34, 33, 31, 30, 29, 27, 26, 24, 23, 21, 20, 18, 17, 15, 29,
+ 27, 26, 24, 22, 21, 19, 17, 16, 14, 26, 25, 23, 21, 19, 18, 16,
+ 15, 27, 25, 23, 21, 19, 17, 16, 14, 26, 25, 23, 21, 18, 17, 14,
+ 12, 17, 19, 13, 4, 9, 2, 11, 1, 7, 8, 0, 16, 3, 14, 6,
+ 12, 10, 5, 15, 18, 11, 10, 13, 15, 16, 19, 20, 22, 24, 27, 15,
+ 18, 20, 22, 24, 26, 14, 17, 20, 22, 24, 27, 15, 18, 20, 23, 25,
+ 28, 16, 19, 22, 25, 28, 32, 36, 21, 25, 29, 33, 38, 42, 45, 49,
+ 28, 31, 34, 37, 40, 42, 44, 47, 49, 50, 52, 54, 56, 57, 59, 60,
+ 62, 64, 66, 67, 69, 35, 37, 39, 40, 42, 43, 45, 47, 48, 51, 52,
+ 54, 55, 57, 59, 60, 62, 63, 66, 67, 69, 71, 72, 38, 40, 42, 43,
+ 46, 47, 49, 51, 26, 28, 30, 31, 33, 34, 18, 19, 11, 13, 7, 8,
+};
+
+static const unsigned char classic_add_chroma[256] = {
+ 3, 1, 2, 2, 2, 2, 3, 3, 7, 5, 7, 5, 8, 6, 11, 9,
+ 7, 13, 11, 10, 9, 8, 7, 5, 9, 7, 6, 4, 7, 5, 8, 7,
+ 11, 8, 13, 11, 19, 15, 22, 23, 20, 33, 32, 28, 27, 29, 51, 77,
+ 43, 45, 76, 81, 46, 82, 75, 55, 56,144, 58, 80, 60, 74,147, 63,
+ 143, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
+ 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 27, 30, 21, 22,
+ 17, 14, 5, 6,100, 54, 47, 50, 51, 53,106,107,108,109,110,111,
+ 112,113,114,115, 4,117,118, 92, 94,121,122, 3,124,103, 2, 1,
+ 0,129,130,131,120,119,126,125,136,137,138,139,140,141,142,134,
+ 135,132,133,104, 64,101, 62, 57,102, 95, 93, 59, 61, 28, 97, 96,
+ 52, 49, 48, 29, 32, 25, 24, 46, 23, 98, 45, 44, 43, 20, 42, 41,
+ 19, 18, 99, 40, 15, 39, 38, 16, 13, 12, 11, 37, 10, 9, 8, 36,
+ 7,128,127,105,123,116, 35, 34, 33,145, 31, 79, 42,146, 78, 26,
+ 83, 48, 49, 50, 44, 47, 26, 31, 30, 18, 17, 19, 21, 24, 25, 13,
+ 14, 16, 17, 18, 20, 21, 12, 14, 15, 9, 10, 6, 9, 6, 5, 8,
+ 6, 12, 8, 10, 7, 9, 6, 4, 6, 2, 2, 3, 3, 3, 3, 2,
+};
+
+static int read_len_table(uint8_t *dst, GetBitContext *gb)
+{
+ int i, val, repeat;
+
+ for (i = 0; i < 256;) {
+ repeat = get_bits(gb, 3);
+ val = get_bits(gb, 5);
+ if (repeat == 0)
+ repeat = get_bits(gb, 8);
+ if (i + repeat > 256 || get_bits_left(gb) < 0) {
+ av_log(NULL, AV_LOG_ERROR, "Error reading huffman table\n");
+ return -1;
+ }
+ while (repeat--)
+ dst[i++] = val;
+ }
+ return 0;
+}
+
+static void generate_joint_tables(HYuvContext *s)
+{
+ uint16_t symbols[1 << VLC_BITS];
+ uint16_t bits[1 << VLC_BITS];
+ uint8_t len[1 << VLC_BITS];
+ if (s->bitstream_bpp < 24) {
+ int p, i, y, u;
+ for (p = 0; p < 3; p++) {
+ for (i = y = 0; y < 256; y++) {
+ int len0 = s->len[0][y];
+ int limit = VLC_BITS - len0;
+ if(limit <= 0)
+ continue;
+ for (u = 0; u < 256; u++) {
+ int len1 = s->len[p][u];
+ if (len1 > limit)
+ continue;
+ len[i] = len0 + len1;
+ bits[i] = (s->bits[0][y] << len1) + s->bits[p][u];
+ symbols[i] = (y << 8) + u;
+ if(symbols[i] != 0xffff) // reserved to mean "invalid"
+ i++;
+ }
+ }
+ ff_free_vlc(&s->vlc[3 + p]);
+ ff_init_vlc_sparse(&s->vlc[3 + p], VLC_BITS, i, len, 1, 1,
+ bits, 2, 2, symbols, 2, 2, 0);
+ }
+ } else {
+ uint8_t (*map)[4] = (uint8_t(*)[4])s->pix_bgr_map;
+ int i, b, g, r, code;
+ int p0 = s->decorrelate;
+ int p1 = !s->decorrelate;
+ // restrict the range to +/-16 because that's pretty much guaranteed to
+ // cover all the combinations that fit in 11 bits total, and it doesn't
+ // matter if we miss a few rare codes.
+ for (i = 0, g = -16; g < 16; g++) {
+ int len0 = s->len[p0][g & 255];
+ int limit0 = VLC_BITS - len0;
+ if (limit0 < 2)
+ continue;
+ for (b = -16; b < 16; b++) {
+ int len1 = s->len[p1][b & 255];
+ int limit1 = limit0 - len1;
+ if (limit1 < 1)
+ continue;
+ code = (s->bits[p0][g & 255] << len1) + s->bits[p1][b & 255];
+ for (r = -16; r < 16; r++) {
+ int len2 = s->len[2][r & 255];
+ if (len2 > limit1)
+ continue;
+ len[i] = len0 + len1 + len2;
+ bits[i] = (code << len2) + s->bits[2][r & 255];
+ if (s->decorrelate) {
+ map[i][G] = g;
+ map[i][B] = g + b;
+ map[i][R] = g + r;
+ } else {
+ map[i][B] = g;
+ map[i][G] = b;
+ map[i][R] = r;
+ }
+ i++;
+ }
+ }
+ }
+ ff_free_vlc(&s->vlc[3]);
+ init_vlc(&s->vlc[3], VLC_BITS, i, len, 1, 1, bits, 2, 2, 0);
+ }
+}
+
+static int read_huffman_tables(HYuvContext *s, const uint8_t *src, int length)
+{
+ GetBitContext gb;
+ int i;
+
+ init_get_bits(&gb, src, length * 8);
+
+ for (i = 0; i < 3; i++) {
+ if (read_len_table(s->len[i], &gb) < 0)
+ return -1;
+ if (ff_huffyuv_generate_bits_table(s->bits[i], s->len[i]) < 0) {
+ return -1;
+ }
+ ff_free_vlc(&s->vlc[i]);
+ init_vlc(&s->vlc[i], VLC_BITS, 256, s->len[i], 1, 1,
+ s->bits[i], 4, 4, 0);
+ }
+
+ generate_joint_tables(s);
+
+ return (get_bits_count(&gb) + 7) / 8;
+}
+
+static int read_old_huffman_tables(HYuvContext *s)
+{
+ GetBitContext gb;
+ int i;
+
+ init_get_bits(&gb, classic_shift_luma,
+ classic_shift_luma_table_size * 8);
+ if (read_len_table(s->len[0], &gb) < 0)
+ return -1;
+
+ init_get_bits(&gb, classic_shift_chroma,
+ classic_shift_chroma_table_size * 8);
+ if (read_len_table(s->len[1], &gb) < 0)
+ return -1;
+
+ for(i=0; i<256; i++) s->bits[0][i] = classic_add_luma [i];
+ for(i=0; i<256; i++) s->bits[1][i] = classic_add_chroma[i];
+
+ if (s->bitstream_bpp >= 24) {
+ memcpy(s->bits[1], s->bits[0], 256 * sizeof(uint32_t));
+ memcpy(s->len[1] , s->len [0], 256 * sizeof(uint8_t));
+ }
+ memcpy(s->bits[2], s->bits[1], 256 * sizeof(uint32_t));
+ memcpy(s->len[2] , s->len [1], 256 * sizeof(uint8_t));
+
+ for (i = 0; i < 3; i++) {
+ ff_free_vlc(&s->vlc[i]);
+ init_vlc(&s->vlc[i], VLC_BITS, 256, s->len[i], 1, 1,
+ s->bits[i], 4, 4, 0);
+ }
+
+ generate_joint_tables(s);
+
+ return 0;
+}
+
+static av_cold int decode_init(AVCodecContext *avctx)
+{
+ HYuvContext *s = avctx->priv_data;
+
+ ff_huffyuv_common_init(avctx);
+ memset(s->vlc, 0, 3 * sizeof(VLC));
+
+ avctx->coded_frame = &s->picture;
+ s->interlaced = s->height > 288;
+
+ s->bgr32 = 1;
+
+ if (avctx->extradata_size) {
+ if ((avctx->bits_per_coded_sample & 7) &&
+ avctx->bits_per_coded_sample != 12)
+ s->version = 1; // do such files exist at all?
+ else
+ s->version = 2;
+ } else
+ s->version = 0;
+
+ if (s->version == 2) {
+ int method, interlace;
+
+ if (avctx->extradata_size < 4)
+ return -1;
+
+ method = ((uint8_t*)avctx->extradata)[0];
+ s->decorrelate = method & 64 ? 1 : 0;
+ s->predictor = method & 63;
+ s->bitstream_bpp = ((uint8_t*)avctx->extradata)[1];
+ if (s->bitstream_bpp == 0)
+ s->bitstream_bpp = avctx->bits_per_coded_sample & ~7;
+ interlace = (((uint8_t*)avctx->extradata)[2] & 0x30) >> 4;
+ s->interlaced = (interlace == 1) ? 1 : (interlace == 2) ? 0 : s->interlaced;
+ s->context = ((uint8_t*)avctx->extradata)[2] & 0x40 ? 1 : 0;
+
+ if ( read_huffman_tables(s, ((uint8_t*)avctx->extradata) + 4,
+ avctx->extradata_size - 4) < 0)
+ return -1;
+ }else{
+ switch (avctx->bits_per_coded_sample & 7) {
+ case 1:
+ s->predictor = LEFT;
+ s->decorrelate = 0;
+ break;
+ case 2:
+ s->predictor = LEFT;
+ s->decorrelate = 1;
+ break;
+ case 3:
+ s->predictor = PLANE;
+ s->decorrelate = avctx->bits_per_coded_sample >= 24;
+ break;
+ case 4:
+ s->predictor = MEDIAN;
+ s->decorrelate = 0;
+ break;
+ default:
+ s->predictor = LEFT; //OLD
+ s->decorrelate = 0;
+ break;
+ }
+ s->bitstream_bpp = avctx->bits_per_coded_sample & ~7;
+ s->context = 0;
+
+ if (read_old_huffman_tables(s) < 0)
+ return -1;
+ }
+
+ switch (s->bitstream_bpp) {
+ case 12:
+ avctx->pix_fmt = AV_PIX_FMT_YUV420P;
+ break;
+ case 16:
+ if (s->yuy2) {
+ avctx->pix_fmt = AV_PIX_FMT_YUYV422;
+ } else {
+ avctx->pix_fmt = AV_PIX_FMT_YUV422P;
+ }
+ break;
+ case 24:
+ case 32:
+ if (s->bgr32) {
+ avctx->pix_fmt = AV_PIX_FMT_RGB32;
+ } else {
+ avctx->pix_fmt = AV_PIX_FMT_BGR24;
+ }
+ break;
+ default:
+ return AVERROR_INVALIDDATA;
+ }
+
+ ff_huffyuv_alloc_temp(s);
+
+ return 0;
+}
+
+static av_cold int decode_init_thread_copy(AVCodecContext *avctx)
+{
+ HYuvContext *s = avctx->priv_data;
+ int i;
+
+ avctx->coded_frame= &s->picture;
+ ff_huffyuv_alloc_temp(s);
+
+ for (i = 0; i < 6; i++)
+ s->vlc[i].table = NULL;
+
+ if (s->version == 2) {
+ if (read_huffman_tables(s, ((uint8_t*)avctx->extradata) + 4,
+ avctx->extradata_size) < 0)
+ return -1;
+ } else {
+ if (read_old_huffman_tables(s) < 0)
+ return -1;
+ }
+
+ return 0;
+}
+
+/* TODO instead of restarting the read when the code isn't in the first level
+ * of the joint table, jump into the 2nd level of the individual table. */
+#define READ_2PIX(dst0, dst1, plane1){\
+ uint16_t code = get_vlc2(&s->gb, s->vlc[3+plane1].table, VLC_BITS, 1);\
+ if(code != 0xffff){\
+ dst0 = code>>8;\
+ dst1 = code;\
+ }else{\
+ dst0 = get_vlc2(&s->gb, s->vlc[0].table, VLC_BITS, 3);\
+ dst1 = get_vlc2(&s->gb, s->vlc[plane1].table, VLC_BITS, 3);\
+ }\
+}
+
+static void decode_422_bitstream(HYuvContext *s, int count)
+{
+ int i;
+
+ count /= 2;
+
+ if (count >= (get_bits_left(&s->gb)) / (31 * 4)) {
+ for (i = 0; i < count && get_bits_left(&s->gb) > 0; i++) {
+ READ_2PIX(s->temp[0][2 * i ], s->temp[1][i], 1);
+ READ_2PIX(s->temp[0][2 * i + 1], s->temp[2][i], 2);
+ }
+ } else {
+ for (i = 0; i < count; i++) {
+ READ_2PIX(s->temp[0][2 * i ], s->temp[1][i], 1);
+ READ_2PIX(s->temp[0][2 * i + 1], s->temp[2][i], 2);
+ }
+ }
+}
+
+static void decode_gray_bitstream(HYuvContext *s, int count)
+{
+ int i;
+
+ count/=2;
+
+ if (count >= (get_bits_left(&s->gb)) / (31 * 2)) {
+ for (i = 0; i < count && get_bits_left(&s->gb) > 0; i++) {
+ READ_2PIX(s->temp[0][2 * i], s->temp[0][2 * i + 1], 0);
+ }
+ } else {
+ for(i=0; i<count; i++){
+ READ_2PIX(s->temp[0][2 * i], s->temp[0][2 * i + 1], 0);
+ }
+ }
+}
+
+static av_always_inline void decode_bgr_1(HYuvContext *s, int count,
+ int decorrelate, int alpha)
+{
+ int i;
+ for (i = 0; i < count; i++) {
+ int code = get_vlc2(&s->gb, s->vlc[3].table, VLC_BITS, 1);
+ if (code != -1) {
+ *(uint32_t*)&s->temp[0][4 * i] = s->pix_bgr_map[code];
+ } else if(decorrelate) {
+ s->temp[0][4 * i + G] = get_vlc2(&s->gb, s->vlc[1].table, VLC_BITS, 3);
+ s->temp[0][4 * i + B] = get_vlc2(&s->gb, s->vlc[0].table, VLC_BITS, 3) +
+ s->temp[0][4 * i + G];
+ s->temp[0][4 * i + R] = get_vlc2(&s->gb, s->vlc[2].table, VLC_BITS, 3) +
+ s->temp[0][4 * i + G];
+ } else {
+ s->temp[0][4 * i + B] = get_vlc2(&s->gb, s->vlc[0].table, VLC_BITS, 3);
+ s->temp[0][4 * i + G] = get_vlc2(&s->gb, s->vlc[1].table, VLC_BITS, 3);
+ s->temp[0][4 * i + R] = get_vlc2(&s->gb, s->vlc[2].table, VLC_BITS, 3);
+ }
+ if (alpha)
+ s->temp[0][4 * i + A] = get_vlc2(&s->gb, s->vlc[2].table, VLC_BITS, 3);
+ }
+}
+
+static void decode_bgr_bitstream(HYuvContext *s, int count)
+{
+ if (s->decorrelate) {
+ if (s->bitstream_bpp==24)
+ decode_bgr_1(s, count, 1, 0);
+ else
+ decode_bgr_1(s, count, 1, 1);
+ } else {
+ if (s->bitstream_bpp==24)
+ decode_bgr_1(s, count, 0, 0);
+ else
+ decode_bgr_1(s, count, 0, 1);
+ }
+}
+
+static void draw_slice(HYuvContext *s, int y)
+{
+ int h, cy, i;
+ int offset[AV_NUM_DATA_POINTERS];
+
+ if (s->avctx->draw_horiz_band==NULL)
+ return;
+
+ h = y - s->last_slice_end;
+ y -= h;
+
+ if (s->bitstream_bpp == 12) {
+ cy = y>>1;
+ } else {
+ cy = y;
+ }
+
+ offset[0] = s->picture.linesize[0]*y;
+ offset[1] = s->picture.linesize[1]*cy;
+ offset[2] = s->picture.linesize[2]*cy;
+ for (i = 3; i < AV_NUM_DATA_POINTERS; i++)
+ offset[i] = 0;
+ emms_c();
+
+ s->avctx->draw_horiz_band(s->avctx, &s->picture, offset, y, 3, h);
+
+ s->last_slice_end = y + h;
+}
+
+static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
+ AVPacket *avpkt)
+{
+ const uint8_t *buf = avpkt->data;
+ int buf_size = avpkt->size;
+ HYuvContext *s = avctx->priv_data;
+ const int width = s->width;
+ const int width2 = s->width>>1;
+ const int height = s->height;
+ int fake_ystride, fake_ustride, fake_vstride;
+ AVFrame * const p = &s->picture;
+ int table_size = 0;
+
+ AVFrame *picture = data;
+
+ av_fast_malloc(&s->bitstream_buffer,
+ &s->bitstream_buffer_size,
+ buf_size + FF_INPUT_BUFFER_PADDING_SIZE);
+ if (!s->bitstream_buffer)
+ return AVERROR(ENOMEM);
+
+ memset(s->bitstream_buffer + buf_size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
+ s->dsp.bswap_buf((uint32_t*)s->bitstream_buffer,
+ (const uint32_t*)buf, buf_size / 4);
+
+ if (p->data[0])
+ ff_thread_release_buffer(avctx, p);
+
+ p->reference = 0;
+ if (ff_thread_get_buffer(avctx, p) < 0) {
+ av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
+ return -1;
+ }
+
+ if (s->context) {
+ table_size = read_huffman_tables(s, s->bitstream_buffer, buf_size);
+ if (table_size < 0)
+ return -1;
+ }
+
+ if ((unsigned)(buf_size-table_size) >= INT_MAX / 8)
+ return -1;
+
+ init_get_bits(&s->gb, s->bitstream_buffer+table_size,
+ (buf_size-table_size) * 8);
+
+ fake_ystride = s->interlaced ? p->linesize[0] * 2 : p->linesize[0];
+ fake_ustride = s->interlaced ? p->linesize[1] * 2 : p->linesize[1];
+ fake_vstride = s->interlaced ? p->linesize[2] * 2 : p->linesize[2];
+
+ s->last_slice_end = 0;
+
+ if (s->bitstream_bpp < 24) {
+ int y, cy;
+ int lefty, leftu, leftv;
+ int lefttopy, lefttopu, lefttopv;
+
+ if (s->yuy2) {
+ p->data[0][3] = get_bits(&s->gb, 8);
+ p->data[0][2] = get_bits(&s->gb, 8);
+ p->data[0][1] = get_bits(&s->gb, 8);
+ p->data[0][0] = get_bits(&s->gb, 8);
+
+ av_log(avctx, AV_LOG_ERROR,
+ "YUY2 output is not implemented yet\n");
+ return -1;
+ } else {
+
+ leftv = p->data[2][0] = get_bits(&s->gb, 8);
+ lefty = p->data[0][1] = get_bits(&s->gb, 8);
+ leftu = p->data[1][0] = get_bits(&s->gb, 8);
+ p->data[0][0] = get_bits(&s->gb, 8);
+
+ switch (s->predictor) {
+ case LEFT:
+ case PLANE:
+ decode_422_bitstream(s, width-2);
+ lefty = s->dsp.add_hfyu_left_prediction(p->data[0] + 2, s->temp[0], width-2, lefty);
+ if (!(s->flags&CODEC_FLAG_GRAY)) {
+ leftu = s->dsp.add_hfyu_left_prediction(p->data[1] + 1, s->temp[1], width2 - 1, leftu);
+ leftv = s->dsp.add_hfyu_left_prediction(p->data[2] + 1, s->temp[2], width2 - 1, leftv);
+ }
+
+ for (cy = y = 1; y < s->height; y++, cy++) {
+ uint8_t *ydst, *udst, *vdst;
+
+ if (s->bitstream_bpp == 12) {
+ decode_gray_bitstream(s, width);
+
+ ydst = p->data[0] + p->linesize[0] * y;
+
+ lefty = s->dsp.add_hfyu_left_prediction(ydst, s->temp[0], width, lefty);
+ if (s->predictor == PLANE) {
+ if (y > s->interlaced)
+ s->dsp.add_bytes(ydst, ydst - fake_ystride, width);
+ }
+ y++;
+ if (y >= s->height) break;
+ }
+
+ draw_slice(s, y);
+
+ ydst = p->data[0] + p->linesize[0]*y;
+ udst = p->data[1] + p->linesize[1]*cy;
+ vdst = p->data[2] + p->linesize[2]*cy;
+
+ decode_422_bitstream(s, width);
+ lefty = s->dsp.add_hfyu_left_prediction(ydst, s->temp[0], width, lefty);
+ if (!(s->flags & CODEC_FLAG_GRAY)) {
+ leftu= s->dsp.add_hfyu_left_prediction(udst, s->temp[1], width2, leftu);
+ leftv= s->dsp.add_hfyu_left_prediction(vdst, s->temp[2], width2, leftv);
+ }
+ if (s->predictor == PLANE) {
+ if (cy > s->interlaced) {
+ s->dsp.add_bytes(ydst, ydst - fake_ystride, width);
+ if (!(s->flags & CODEC_FLAG_GRAY)) {
+ s->dsp.add_bytes(udst, udst - fake_ustride, width2);
+ s->dsp.add_bytes(vdst, vdst - fake_vstride, width2);
+ }
+ }
+ }
+ }
+ draw_slice(s, height);
+
+ break;
+ case MEDIAN:
+ /* first line except first 2 pixels is left predicted */
+ decode_422_bitstream(s, width - 2);
+ lefty= s->dsp.add_hfyu_left_prediction(p->data[0] + 2, s->temp[0], width - 2, lefty);
+ if (!(s->flags & CODEC_FLAG_GRAY)) {
+ leftu = s->dsp.add_hfyu_left_prediction(p->data[1] + 1, s->temp[1], width2 - 1, leftu);
+ leftv = s->dsp.add_hfyu_left_prediction(p->data[2] + 1, s->temp[2], width2 - 1, leftv);
+ }
+
+ cy = y = 1;
+
+ /* second line is left predicted for interlaced case */
+ if (s->interlaced) {
+ decode_422_bitstream(s, width);
+ lefty = s->dsp.add_hfyu_left_prediction(p->data[0] + p->linesize[0], s->temp[0], width, lefty);
+ if (!(s->flags & CODEC_FLAG_GRAY)) {
+ leftu = s->dsp.add_hfyu_left_prediction(p->data[1] + p->linesize[2], s->temp[1], width2, leftu);
+ leftv = s->dsp.add_hfyu_left_prediction(p->data[2] + p->linesize[1], s->temp[2], width2, leftv);
+ }
+ y++; cy++;
+ }
+
+ /* next 4 pixels are left predicted too */
+ decode_422_bitstream(s, 4);
+ lefty = s->dsp.add_hfyu_left_prediction(p->data[0] + fake_ystride, s->temp[0], 4, lefty);
+ if (!(s->flags&CODEC_FLAG_GRAY)) {
+ leftu = s->dsp.add_hfyu_left_prediction(p->data[1] + fake_ustride, s->temp[1], 2, leftu);
+ leftv = s->dsp.add_hfyu_left_prediction(p->data[2] + fake_vstride, s->temp[2], 2, leftv);
+ }
+
+ /* next line except the first 4 pixels is median predicted */
+ lefttopy = p->data[0][3];
+ decode_422_bitstream(s, width - 4);
+ s->dsp.add_hfyu_median_prediction(p->data[0] + fake_ystride+4, p->data[0]+4, s->temp[0], width-4, &lefty, &lefttopy);
+ if (!(s->flags&CODEC_FLAG_GRAY)) {
+ lefttopu = p->data[1][1];
+ lefttopv = p->data[2][1];
+ s->dsp.add_hfyu_median_prediction(p->data[1] + fake_ustride+2, p->data[1] + 2, s->temp[1], width2 - 2, &leftu, &lefttopu);
+ s->dsp.add_hfyu_median_prediction(p->data[2] + fake_vstride+2, p->data[2] + 2, s->temp[2], width2 - 2, &leftv, &lefttopv);
+ }
+ y++; cy++;
+
+ for (; y<height; y++, cy++) {
+ uint8_t *ydst, *udst, *vdst;
+
+ if (s->bitstream_bpp == 12) {
+ while (2 * cy > y) {
+ decode_gray_bitstream(s, width);
+ ydst = p->data[0] + p->linesize[0] * y;
+ s->dsp.add_hfyu_median_prediction(ydst, ydst - fake_ystride, s->temp[0], width, &lefty, &lefttopy);
+ y++;
+ }
+ if (y >= height) break;
+ }
+ draw_slice(s, y);
+
+ decode_422_bitstream(s, width);
+
+ ydst = p->data[0] + p->linesize[0] * y;
+ udst = p->data[1] + p->linesize[1] * cy;
+ vdst = p->data[2] + p->linesize[2] * cy;
+
+ s->dsp.add_hfyu_median_prediction(ydst, ydst - fake_ystride, s->temp[0], width, &lefty, &lefttopy);
+ if (!(s->flags & CODEC_FLAG_GRAY)) {
+ s->dsp.add_hfyu_median_prediction(udst, udst - fake_ustride, s->temp[1], width2, &leftu, &lefttopu);
+ s->dsp.add_hfyu_median_prediction(vdst, vdst - fake_vstride, s->temp[2], width2, &leftv, &lefttopv);
+ }
+ }
+
+ draw_slice(s, height);
+ break;
+ }
+ }
+ } else {
+ int y;
+ int leftr, leftg, leftb, lefta;
+ const int last_line = (height - 1) * p->linesize[0];
+
+ if (s->bitstream_bpp == 32) {
+ lefta = p->data[0][last_line+A] = get_bits(&s->gb, 8);
+ leftr = p->data[0][last_line+R] = get_bits(&s->gb, 8);
+ leftg = p->data[0][last_line+G] = get_bits(&s->gb, 8);
+ leftb = p->data[0][last_line+B] = get_bits(&s->gb, 8);
+ } else {
+ leftr = p->data[0][last_line+R] = get_bits(&s->gb, 8);
+ leftg = p->data[0][last_line+G] = get_bits(&s->gb, 8);
+ leftb = p->data[0][last_line+B] = get_bits(&s->gb, 8);
+ lefta = p->data[0][last_line+A] = 255;
+ skip_bits(&s->gb, 8);
+ }
+
+ if (s->bgr32) {
+ switch (s->predictor) {
+ case LEFT:
+ case PLANE:
+ decode_bgr_bitstream(s, width - 1);
+ s->dsp.add_hfyu_left_prediction_bgr32(p->data[0] + last_line+4, s->temp[0], width - 1, &leftr, &leftg, &leftb, &lefta);
+
+ for (y = s->height - 2; y >= 0; y--) { //Yes it is stored upside down.
+ decode_bgr_bitstream(s, width);
+
+ s->dsp.add_hfyu_left_prediction_bgr32(p->data[0] + p->linesize[0]*y, s->temp[0], width, &leftr, &leftg, &leftb, &lefta);
+ if (s->predictor == PLANE) {
+ if (s->bitstream_bpp != 32) lefta = 0;
+ if ((y & s->interlaced) == 0 &&
+ y < s->height - 1 - s->interlaced) {
+ s->dsp.add_bytes(p->data[0] + p->linesize[0] * y,
+ p->data[0] + p->linesize[0] * y +
+ fake_ystride, fake_ystride);
+ }
+ }
+ }
+ // just 1 large slice as this is not possible in reverse order
+ draw_slice(s, height);
+ break;
+ default:
+ av_log(avctx, AV_LOG_ERROR,
+ "prediction type not supported!\n");
+ }
+ }else{
+ av_log(avctx, AV_LOG_ERROR,
+ "BGR24 output is not implemented yet\n");
+ return -1;
+ }
+ }
+ emms_c();
+
+ *picture = *p;
+ *got_frame = 1;
+
+ return (get_bits_count(&s->gb) + 31) / 32 * 4 + table_size;
+}
+
+static av_cold int decode_end(AVCodecContext *avctx)
+{
+ HYuvContext *s = avctx->priv_data;
+ int i;
+
+ if (s->picture.data[0])
+ avctx->release_buffer(avctx, &s->picture);
+
+ ff_huffyuv_common_end(s);
+ av_freep(&s->bitstream_buffer);
+
+ for (i = 0; i < 6; i++) {
+ ff_free_vlc(&s->vlc[i]);
+ }
+
+ return 0;
+}
+
+#if CONFIG_HUFFYUV_DECODER
+AVCodec ff_huffyuv_decoder = {
+ .name = "huffyuv",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .id = AV_CODEC_ID_HUFFYUV,
+ .priv_data_size = sizeof(HYuvContext),
+ .init = decode_init,
+ .close = decode_end,
+ .decode = decode_frame,
+ .capabilities = CODEC_CAP_DR1 | CODEC_CAP_DRAW_HORIZ_BAND |
+ CODEC_CAP_FRAME_THREADS,
+ .init_thread_copy = ONLY_IF_THREADS_ENABLED(decode_init_thread_copy),
+ .long_name = NULL_IF_CONFIG_SMALL("Huffyuv / HuffYUV"),
+};
+#endif
+
+#if CONFIG_FFVHUFF_DECODER
+AVCodec ff_ffvhuff_decoder = {
+ .name = "ffvhuff",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .id = AV_CODEC_ID_FFVHUFF,
+ .priv_data_size = sizeof(HYuvContext),
+ .init = decode_init,
+ .close = decode_end,
+ .decode = decode_frame,
+ .capabilities = CODEC_CAP_DR1 | CODEC_CAP_DRAW_HORIZ_BAND |
+ CODEC_CAP_FRAME_THREADS,
+ .init_thread_copy = ONLY_IF_THREADS_ENABLED(decode_init_thread_copy),
+ .long_name = NULL_IF_CONFIG_SMALL("Huffyuv FFmpeg variant"),
+};
+#endif
diff --git a/gst-libs/ext/libav/libavcodec/huffyuvenc.c b/gst-libs/ext/libav/libavcodec/huffyuvenc.c
new file mode 100644
index 0000000..13c0a79
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/huffyuvenc.c
@@ -0,0 +1,633 @@
+/*
+ * Copyright (c) 2002-2003 Michael Niedermayer <michaelni@gmx.at>
+ *
+ * see http://www.pcisys.net/~melanson/codecs/huffyuv.txt for a description of
+ * the algorithm used
+ *
+ * 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
+ * huffyuv encoder
+ */
+
+#include "avcodec.h"
+#include "huffyuv.h"
+#include "huffman.h"
+#include "put_bits.h"
+
+static inline int sub_left_prediction(HYuvContext *s, uint8_t *dst,
+ uint8_t *src, int w, int left)
+{
+ int i;
+ if (w < 32) {
+ for (i = 0; i < w; i++) {
+ const int temp = src[i];
+ dst[i] = temp - left;
+ left = temp;
+ }
+ return left;
+ } else {
+ for (i = 0; i < 16; i++) {
+ const int temp = src[i];
+ dst[i] = temp - left;
+ left = temp;
+ }
+ s->dsp.diff_bytes(dst + 16, src + 16, src + 15, w - 16);
+ return src[w-1];
+ }
+}
+
+static inline void sub_left_prediction_bgr32(HYuvContext *s, uint8_t *dst,
+ uint8_t *src, int w,
+ int *red, int *green, int *blue)
+{
+ int i;
+ int r,g,b;
+ r = *red;
+ g = *green;
+ b = *blue;
+
+ for (i = 0; i < FFMIN(w, 4); i++) {
+ const int rt = src[i * 4 + R];
+ const int gt = src[i * 4 + G];
+ const int bt = src[i * 4 + B];
+ dst[i * 4 + R] = rt - r;
+ dst[i * 4 + G] = gt - g;
+ dst[i * 4 + B] = bt - b;
+ r = rt;
+ g = gt;
+ b = bt;
+ }
+
+ s->dsp.diff_bytes(dst + 16, src + 16, src + 12, w * 4 - 16);
+
+ *red = src[(w - 1) * 4 + R];
+ *green = src[(w - 1) * 4 + G];
+ *blue = src[(w - 1) * 4 + B];
+}
+
+static int store_table(HYuvContext *s, const uint8_t *len, uint8_t *buf)
+{
+ int i;
+ int index = 0;
+
+ for (i = 0; i < 256;) {
+ int val = len[i];
+ int repeat = 0;
+
+ for (; i < 256 && len[i] == val && repeat < 255; i++)
+ repeat++;
+
+ assert(val < 32 && val >0 && repeat<256 && repeat>0);
+ if ( repeat > 7) {
+ buf[index++] = val;
+ buf[index++] = repeat;
+ } else {
+ buf[index++] = val | (repeat << 5);
+ }
+ }
+
+ return index;
+}
+
+static av_cold int encode_init(AVCodecContext *avctx)
+{
+ HYuvContext *s = avctx->priv_data;
+ int i, j;
+
+ ff_huffyuv_common_init(avctx);
+
+ avctx->extradata = av_mallocz(1024*30); // 256*3+4 == 772
+ avctx->stats_out = av_mallocz(1024*30); // 21*256*3(%llu ) + 3(\n) + 1(0) = 16132
+ s->version = 2;
+
+ avctx->coded_frame = &s->picture;
+
+ switch (avctx->pix_fmt) {
+ case AV_PIX_FMT_YUV420P:
+ s->bitstream_bpp = 12;
+ break;
+ case AV_PIX_FMT_YUV422P:
+ s->bitstream_bpp = 16;
+ break;
+ case AV_PIX_FMT_RGB32:
+ s->bitstream_bpp = 24;
+ break;
+ default:
+ av_log(avctx, AV_LOG_ERROR, "format not supported\n");
+ return -1;
+ }
+ avctx->bits_per_coded_sample = s->bitstream_bpp;
+ s->decorrelate = s->bitstream_bpp >= 24;
+ s->predictor = avctx->prediction_method;
+ s->interlaced = avctx->flags&CODEC_FLAG_INTERLACED_ME ? 1 : 0;
+ if (avctx->context_model == 1) {
+ s->context = avctx->context_model;
+ if (s->flags & (CODEC_FLAG_PASS1|CODEC_FLAG_PASS2)) {
+ av_log(avctx, AV_LOG_ERROR,
+ "context=1 is not compatible with "
+ "2 pass huffyuv encoding\n");
+ return -1;
+ }
+ }else s->context= 0;
+
+ if (avctx->codec->id == AV_CODEC_ID_HUFFYUV) {
+ if (avctx->pix_fmt == AV_PIX_FMT_YUV420P) {
+ av_log(avctx, AV_LOG_ERROR,
+ "Error: YV12 is not supported by huffyuv; use "
+ "vcodec=ffvhuff or format=422p\n");
+ return -1;
+ }
+ if (avctx->context_model) {
+ av_log(avctx, AV_LOG_ERROR,
+ "Error: per-frame huffman tables are not supported "
+ "by huffyuv; use vcodec=ffvhuff\n");
+ return -1;
+ }
+ if (s->interlaced != ( s->height > 288 ))
+ av_log(avctx, AV_LOG_INFO,
+ "using huffyuv 2.2.0 or newer interlacing flag\n");
+ }
+
+ if (s->bitstream_bpp >= 24 && s->predictor == MEDIAN) {
+ av_log(avctx, AV_LOG_ERROR,
+ "Error: RGB is incompatible with median predictor\n");
+ return -1;
+ }
+
+ ((uint8_t*)avctx->extradata)[0] = s->predictor | (s->decorrelate << 6);
+ ((uint8_t*)avctx->extradata)[1] = s->bitstream_bpp;
+ ((uint8_t*)avctx->extradata)[2] = s->interlaced ? 0x10 : 0x20;
+ if (s->context)
+ ((uint8_t*)avctx->extradata)[2] |= 0x40;
+ ((uint8_t*)avctx->extradata)[3] = 0;
+ s->avctx->extradata_size = 4;
+
+ if (avctx->stats_in) {
+ char *p = avctx->stats_in;
+
+ for (i = 0; i < 3; i++)
+ for (j = 0; j < 256; j++)
+ s->stats[i][j] = 1;
+
+ for (;;) {
+ for (i = 0; i < 3; i++) {
+ char *next;
+
+ for (j = 0; j < 256; j++) {
+ s->stats[i][j] += strtol(p, &next, 0);
+ if (next == p) return -1;
+ p = next;
+ }
+ }
+ if (p[0] == 0 || p[1] == 0 || p[2] == 0) break;
+ }
+ } else {
+ for (i = 0; i < 3; i++)
+ for (j = 0; j < 256; j++) {
+ int d = FFMIN(j, 256 - j);
+
+ s->stats[i][j] = 100000000 / (d + 1);
+ }
+ }
+
+ for (i = 0; i < 3; i++) {
+ ff_huff_gen_len_table(s->len[i], s->stats[i]);
+
+ if (ff_huffyuv_generate_bits_table(s->bits[i], s->len[i]) < 0) {
+ return -1;
+ }
+
+ s->avctx->extradata_size +=
+ store_table(s, s->len[i], &((uint8_t*)s->avctx->extradata)[s->avctx->extradata_size]);
+ }
+
+ if (s->context) {
+ for (i = 0; i < 3; i++) {
+ int pels = s->width * s->height / (i ? 40 : 10);
+ for (j = 0; j < 256; j++) {
+ int d = FFMIN(j, 256 - j);
+ s->stats[i][j] = pels/(d + 1);
+ }
+ }
+ } else {
+ for (i = 0; i < 3; i++)
+ for (j = 0; j < 256; j++)
+ s->stats[i][j]= 0;
+ }
+
+ ff_huffyuv_alloc_temp(s);
+
+ s->picture_number=0;
+
+ return 0;
+}
+static int encode_422_bitstream(HYuvContext *s, int offset, int count)
+{
+ int i;
+ const uint8_t *y = s->temp[0] + offset;
+ const uint8_t *u = s->temp[1] + offset / 2;
+ const uint8_t *v = s->temp[2] + offset / 2;
+
+ if (s->pb.buf_end - s->pb.buf - (put_bits_count(&s->pb) >> 3) < 2 * 4 * count) {
+ av_log(s->avctx, AV_LOG_ERROR, "encoded frame too large\n");
+ return -1;
+ }
+
+#define LOAD4\
+ int y0 = y[2 * i];\
+ int y1 = y[2 * i + 1];\
+ int u0 = u[i];\
+ int v0 = v[i];
+
+ count /= 2;
+
+ if (s->flags & CODEC_FLAG_PASS1) {
+ for(i = 0; i < count; i++) {
+ LOAD4;
+ s->stats[0][y0]++;
+ s->stats[1][u0]++;
+ s->stats[0][y1]++;
+ s->stats[2][v0]++;
+ }
+ }
+ if (s->avctx->flags2 & CODEC_FLAG2_NO_OUTPUT)
+ return 0;
+ if (s->context) {
+ for (i = 0; i < count; i++) {
+ LOAD4;
+ s->stats[0][y0]++;
+ put_bits(&s->pb, s->len[0][y0], s->bits[0][y0]);
+ s->stats[1][u0]++;
+ put_bits(&s->pb, s->len[1][u0], s->bits[1][u0]);
+ s->stats[0][y1]++;
+ put_bits(&s->pb, s->len[0][y1], s->bits[0][y1]);
+ s->stats[2][v0]++;
+ put_bits(&s->pb, s->len[2][v0], s->bits[2][v0]);
+ }
+ } else {
+ for(i = 0; i < count; i++) {
+ LOAD4;
+ put_bits(&s->pb, s->len[0][y0], s->bits[0][y0]);
+ put_bits(&s->pb, s->len[1][u0], s->bits[1][u0]);
+ put_bits(&s->pb, s->len[0][y1], s->bits[0][y1]);
+ put_bits(&s->pb, s->len[2][v0], s->bits[2][v0]);
+ }
+ }
+ return 0;
+}
+
+static int encode_gray_bitstream(HYuvContext *s, int count)
+{
+ int i;
+
+ if (s->pb.buf_end - s->pb.buf - (put_bits_count(&s->pb) >> 3) < 4 * count) {
+ av_log(s->avctx, AV_LOG_ERROR, "encoded frame too large\n");
+ return -1;
+ }
+
+#define LOAD2\
+ int y0 = s->temp[0][2 * i];\
+ int y1 = s->temp[0][2 * i + 1];
+#define STAT2\
+ s->stats[0][y0]++;\
+ s->stats[0][y1]++;
+#define WRITE2\
+ put_bits(&s->pb, s->len[0][y0], s->bits[0][y0]);\
+ put_bits(&s->pb, s->len[0][y1], s->bits[0][y1]);
+
+ count /= 2;
+
+ if (s->flags & CODEC_FLAG_PASS1) {
+ for (i = 0; i < count; i++) {
+ LOAD2;
+ STAT2;
+ }
+ }
+ if (s->avctx->flags2 & CODEC_FLAG2_NO_OUTPUT)
+ return 0;
+
+ if (s->context) {
+ for (i = 0; i < count; i++) {
+ LOAD2;
+ STAT2;
+ WRITE2;
+ }
+ } else {
+ for (i = 0; i < count; i++) {
+ LOAD2;
+ WRITE2;
+ }
+ }
+ return 0;
+}
+
+static int encode_bgr_bitstream(HYuvContext *s, int count)
+{
+ int i;
+
+ if (s->pb.buf_end - s->pb.buf - (put_bits_count(&s->pb) >> 3) < 3 * 4 * count) {
+ av_log(s->avctx, AV_LOG_ERROR, "encoded frame too large\n");
+ return -1;
+ }
+
+#define LOAD3\
+ int g = s->temp[0][4 * i + G];\
+ int b = (s->temp[0][4 * i + B] - g) & 0xff;\
+ int r = (s->temp[0][4 * i + R] - g) & 0xff;
+#define STAT3\
+ s->stats[0][b]++;\
+ s->stats[1][g]++;\
+ s->stats[2][r]++;
+#define WRITE3\
+ put_bits(&s->pb, s->len[1][g], s->bits[1][g]);\
+ put_bits(&s->pb, s->len[0][b], s->bits[0][b]);\
+ put_bits(&s->pb, s->len[2][r], s->bits[2][r]);
+
+ if ((s->flags & CODEC_FLAG_PASS1) &&
+ (s->avctx->flags2 & CODEC_FLAG2_NO_OUTPUT)) {
+ for (i = 0; i < count; i++) {
+ LOAD3;
+ STAT3;
+ }
+ } else if (s->context || (s->flags & CODEC_FLAG_PASS1)) {
+ for (i = 0; i < count; i++) {
+ LOAD3;
+ STAT3;
+ WRITE3;
+ }
+ } else {
+ for (i = 0; i < count; i++) {
+ LOAD3;
+ WRITE3;
+ }
+ }
+ return 0;
+}
+
+static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
+ const AVFrame *pict, int *got_packet)
+{
+ HYuvContext *s = avctx->priv_data;
+ const int width = s->width;
+ const int width2 = s->width>>1;
+ const int height = s->height;
+ const int fake_ystride = s->interlaced ? pict->linesize[0]*2 : pict->linesize[0];
+ const int fake_ustride = s->interlaced ? pict->linesize[1]*2 : pict->linesize[1];
+ const int fake_vstride = s->interlaced ? pict->linesize[2]*2 : pict->linesize[2];
+ AVFrame * const p = &s->picture;
+ int i, j, size = 0, ret;
+
+ if (!pkt->data &&
+ (ret = av_new_packet(pkt, width * height * 3 * 4 + FF_MIN_BUFFER_SIZE)) < 0) {
+ av_log(avctx, AV_LOG_ERROR, "Error allocating output packet.\n");
+ return ret;
+ }
+
+ *p = *pict;
+ p->pict_type = AV_PICTURE_TYPE_I;
+ p->key_frame = 1;
+
+ if (s->context) {
+ for (i = 0; i < 3; i++) {
+ ff_huff_gen_len_table(s->len[i], s->stats[i]);
+ if (ff_huffyuv_generate_bits_table(s->bits[i], s->len[i]) < 0)
+ return -1;
+ size += store_table(s, s->len[i], &pkt->data[size]);
+ }
+
+ for (i = 0; i < 3; i++)
+ for (j = 0; j < 256; j++)
+ s->stats[i][j] >>= 1;
+ }
+
+ init_put_bits(&s->pb, pkt->data + size, pkt->size - size);
+
+ if (avctx->pix_fmt == AV_PIX_FMT_YUV422P ||
+ avctx->pix_fmt == AV_PIX_FMT_YUV420P) {
+ int lefty, leftu, leftv, y, cy;
+
+ put_bits(&s->pb, 8, leftv = p->data[2][0]);
+ put_bits(&s->pb, 8, lefty = p->data[0][1]);
+ put_bits(&s->pb, 8, leftu = p->data[1][0]);
+ put_bits(&s->pb, 8, p->data[0][0]);
+
+ lefty = sub_left_prediction(s, s->temp[0], p->data[0], width , 0);
+ leftu = sub_left_prediction(s, s->temp[1], p->data[1], width2, 0);
+ leftv = sub_left_prediction(s, s->temp[2], p->data[2], width2, 0);
+
+ encode_422_bitstream(s, 2, width-2);
+
+ if (s->predictor==MEDIAN) {
+ int lefttopy, lefttopu, lefttopv;
+ cy = y = 1;
+ if (s->interlaced) {
+ lefty = sub_left_prediction(s, s->temp[0], p->data[0] + p->linesize[0], width , lefty);
+ leftu = sub_left_prediction(s, s->temp[1], p->data[1] + p->linesize[1], width2, leftu);
+ leftv = sub_left_prediction(s, s->temp[2], p->data[2] + p->linesize[2], width2, leftv);
+
+ encode_422_bitstream(s, 0, width);
+ y++; cy++;
+ }
+
+ lefty = sub_left_prediction(s, s->temp[0], p->data[0] + fake_ystride, 4, lefty);
+ leftu = sub_left_prediction(s, s->temp[1], p->data[1] + fake_ustride, 2, leftu);
+ leftv = sub_left_prediction(s, s->temp[2], p->data[2] + fake_vstride, 2, leftv);
+
+ encode_422_bitstream(s, 0, 4);
+
+ lefttopy = p->data[0][3];
+ lefttopu = p->data[1][1];
+ lefttopv = p->data[2][1];
+ s->dsp.sub_hfyu_median_prediction(s->temp[0], p->data[0]+4, p->data[0] + fake_ystride + 4, width - 4 , &lefty, &lefttopy);
+ s->dsp.sub_hfyu_median_prediction(s->temp[1], p->data[1]+2, p->data[1] + fake_ustride + 2, width2 - 2, &leftu, &lefttopu);
+ s->dsp.sub_hfyu_median_prediction(s->temp[2], p->data[2]+2, p->data[2] + fake_vstride + 2, width2 - 2, &leftv, &lefttopv);
+ encode_422_bitstream(s, 0, width - 4);
+ y++; cy++;
+
+ for (; y < height; y++,cy++) {
+ uint8_t *ydst, *udst, *vdst;
+
+ if (s->bitstream_bpp == 12) {
+ while (2 * cy > y) {
+ ydst = p->data[0] + p->linesize[0] * y;
+ s->dsp.sub_hfyu_median_prediction(s->temp[0], ydst - fake_ystride, ydst, width , &lefty, &lefttopy);
+ encode_gray_bitstream(s, width);
+ y++;
+ }
+ if (y >= height) break;
+ }
+ ydst = p->data[0] + p->linesize[0] * y;
+ udst = p->data[1] + p->linesize[1] * cy;
+ vdst = p->data[2] + p->linesize[2] * cy;
+
+ s->dsp.sub_hfyu_median_prediction(s->temp[0], ydst - fake_ystride, ydst, width , &lefty, &lefttopy);
+ s->dsp.sub_hfyu_median_prediction(s->temp[1], udst - fake_ustride, udst, width2, &leftu, &lefttopu);
+ s->dsp.sub_hfyu_median_prediction(s->temp[2], vdst - fake_vstride, vdst, width2, &leftv, &lefttopv);
+
+ encode_422_bitstream(s, 0, width);
+ }
+ } else {
+ for (cy = y = 1; y < height; y++, cy++) {
+ uint8_t *ydst, *udst, *vdst;
+
+ /* encode a luma only line & y++ */
+ if (s->bitstream_bpp == 12) {
+ ydst = p->data[0] + p->linesize[0] * y;
+
+ if (s->predictor == PLANE && s->interlaced < y) {
+ s->dsp.diff_bytes(s->temp[1], ydst, ydst - fake_ystride, width);
+
+ lefty = sub_left_prediction(s, s->temp[0], s->temp[1], width , lefty);
+ } else {
+ lefty = sub_left_prediction(s, s->temp[0], ydst, width , lefty);
+ }
+ encode_gray_bitstream(s, width);
+ y++;
+ if (y >= height) break;
+ }
+
+ ydst = p->data[0] + p->linesize[0] * y;
+ udst = p->data[1] + p->linesize[1] * cy;
+ vdst = p->data[2] + p->linesize[2] * cy;
+
+ if (s->predictor == PLANE && s->interlaced < cy) {
+ s->dsp.diff_bytes(s->temp[1], ydst, ydst - fake_ystride, width);
+ s->dsp.diff_bytes(s->temp[2], udst, udst - fake_ustride, width2);
+ s->dsp.diff_bytes(s->temp[2] + width2, vdst, vdst - fake_vstride, width2);
+
+ lefty = sub_left_prediction(s, s->temp[0], s->temp[1], width , lefty);
+ leftu = sub_left_prediction(s, s->temp[1], s->temp[2], width2, leftu);
+ leftv = sub_left_prediction(s, s->temp[2], s->temp[2] + width2, width2, leftv);
+ } else {
+ lefty = sub_left_prediction(s, s->temp[0], ydst, width , lefty);
+ leftu = sub_left_prediction(s, s->temp[1], udst, width2, leftu);
+ leftv = sub_left_prediction(s, s->temp[2], vdst, width2, leftv);
+ }
+
+ encode_422_bitstream(s, 0, width);
+ }
+ }
+ } else if(avctx->pix_fmt == AV_PIX_FMT_RGB32) {
+ uint8_t *data = p->data[0] + (height - 1) * p->linesize[0];
+ const int stride = -p->linesize[0];
+ const int fake_stride = -fake_ystride;
+ int y;
+ int leftr, leftg, leftb;
+
+ put_bits(&s->pb, 8, leftr = data[R]);
+ put_bits(&s->pb, 8, leftg = data[G]);
+ put_bits(&s->pb, 8, leftb = data[B]);
+ put_bits(&s->pb, 8, 0);
+
+ sub_left_prediction_bgr32(s, s->temp[0], data + 4, width - 1, &leftr, &leftg, &leftb);
+ encode_bgr_bitstream(s, width - 1);
+
+ for (y = 1; y < s->height; y++) {
+ uint8_t *dst = data + y*stride;
+ if (s->predictor == PLANE && s->interlaced < y) {
+ s->dsp.diff_bytes(s->temp[1], dst, dst - fake_stride, width * 4);
+ sub_left_prediction_bgr32(s, s->temp[0], s->temp[1], width, &leftr, &leftg, &leftb);
+ } else {
+ sub_left_prediction_bgr32(s, s->temp[0], dst, width, &leftr, &leftg, &leftb);
+ }
+ encode_bgr_bitstream(s, width);
+ }
+ } else {
+ av_log(avctx, AV_LOG_ERROR, "Format not supported!\n");
+ }
+ emms_c();
+
+ size += (put_bits_count(&s->pb) + 31) / 8;
+ put_bits(&s->pb, 16, 0);
+ put_bits(&s->pb, 15, 0);
+ size /= 4;
+
+ if ((s->flags&CODEC_FLAG_PASS1) && (s->picture_number & 31) == 0) {
+ int j;
+ char *p = avctx->stats_out;
+ char *end = p + 1024*30;
+ for (i = 0; i < 3; i++) {
+ for (j = 0; j < 256; j++) {
+ snprintf(p, end-p, "%"PRIu64" ", s->stats[i][j]);
+ p += strlen(p);
+ s->stats[i][j]= 0;
+ }
+ snprintf(p, end-p, "\n");
+ p++;
+ }
+ } else
+ avctx->stats_out[0] = '\0';
+ if (!(s->avctx->flags2 & CODEC_FLAG2_NO_OUTPUT)) {
+ flush_put_bits(&s->pb);
+ s->dsp.bswap_buf((uint32_t*)pkt->data, (uint32_t*)pkt->data, size);
+ }
+
+ s->picture_number++;
+
+ pkt->size = size * 4;
+ pkt->flags |= AV_PKT_FLAG_KEY;
+ *got_packet = 1;
+
+ return 0;
+}
+
+static av_cold int encode_end(AVCodecContext *avctx)
+{
+ HYuvContext *s = avctx->priv_data;
+
+ ff_huffyuv_common_end(s);
+
+ av_freep(&avctx->extradata);
+ av_freep(&avctx->stats_out);
+
+ return 0;
+}
+
+#if CONFIG_HUFFYUV_ENCODER
+AVCodec ff_huffyuv_encoder = {
+ .name = "huffyuv",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .id = AV_CODEC_ID_HUFFYUV,
+ .priv_data_size = sizeof(HYuvContext),
+ .init = encode_init,
+ .encode2 = encode_frame,
+ .close = encode_end,
+ .pix_fmts = (const enum AVPixelFormat[]){
+ AV_PIX_FMT_YUV422P, AV_PIX_FMT_RGB32, AV_PIX_FMT_NONE
+ },
+ .long_name = NULL_IF_CONFIG_SMALL("Huffyuv / HuffYUV"),
+};
+#endif
+
+#if CONFIG_FFVHUFF_ENCODER
+AVCodec ff_ffvhuff_encoder = {
+ .name = "ffvhuff",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .id = AV_CODEC_ID_FFVHUFF,
+ .priv_data_size = sizeof(HYuvContext),
+ .init = encode_init,
+ .encode2 = encode_frame,
+ .close = encode_end,
+ .pix_fmts = (const enum AVPixelFormat[]){
+ AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV422P, AV_PIX_FMT_RGB32, AV_PIX_FMT_NONE
+ },
+ .long_name = NULL_IF_CONFIG_SMALL("Huffyuv FFmpeg variant"),
+};
+#endif
diff --git a/gst-libs/ext/libav/libavcodec/idcinvideo.c b/gst-libs/ext/libav/libavcodec/idcinvideo.c
index 8ae15eb..273eca6 100644
--- a/gst-libs/ext/libav/libavcodec/idcinvideo.c
+++ b/gst-libs/ext/libav/libavcodec/idcinvideo.c
@@ -49,6 +49,8 @@
#include <string.h>
#include "avcodec.h"
+#include "internal.h"
+#include "libavutil/internal.h"
#define HUFFMAN_TABLE_SIZE 64 * 1024
#define HUF_TOKENS 256
@@ -150,7 +152,7 @@ static av_cold int idcin_decode_init(AVCodecContext *avctx)
unsigned char *histograms;
s->avctx = avctx;
- avctx->pix_fmt = PIX_FMT_PAL8;
+ avctx->pix_fmt = AV_PIX_FMT_PAL8;
/* make sure the Huffman tables make it */
if (s->avctx->extradata_size != HUFFMAN_TABLE_SIZE) {
@@ -208,7 +210,7 @@ static void idcin_decode_vlcs(IdcinContext *s)
}
static int idcin_decode_frame(AVCodecContext *avctx,
- void *data, int *data_size,
+ void *data, int *got_frame,
AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
@@ -222,7 +224,7 @@ static int idcin_decode_frame(AVCodecContext *avctx,
if (s->frame.data[0])
avctx->release_buffer(avctx, &s->frame);
- if (avctx->get_buffer(avctx, &s->frame)) {
+ if (ff_get_buffer(avctx, &s->frame)) {
av_log(avctx, AV_LOG_ERROR, " id CIN Video: get_buffer() failed\n");
return -1;
}
@@ -236,7 +238,7 @@ static int idcin_decode_frame(AVCodecContext *avctx,
/* make the palette available on the way out */
memcpy(s->frame.data[1], s->pal, AVPALETTE_SIZE);
- *data_size = sizeof(AVFrame);
+ *got_frame = 1;
*(AVFrame*)data = s->frame;
/* report that the buffer was completely consumed */
@@ -256,12 +258,11 @@ static av_cold int idcin_decode_end(AVCodecContext *avctx)
AVCodec ff_idcin_decoder = {
.name = "idcinvideo",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_IDCIN,
+ .id = AV_CODEC_ID_IDCIN,
.priv_data_size = sizeof(IdcinContext),
.init = idcin_decode_init,
.close = idcin_decode_end,
.decode = idcin_decode_frame,
.capabilities = CODEC_CAP_DR1,
- .long_name = NULL_IF_CONFIG_SMALL("id Quake II CIN video"),
+ .long_name = NULL_IF_CONFIG_SMALL("id Quake II CIN video"),
};
-
diff --git a/gst-libs/ext/libav/libavcodec/iff.c b/gst-libs/ext/libav/libavcodec/iff.c
index 41e7b59..99da7b5 100644
--- a/gst-libs/ext/libav/libavcodec/iff.c
+++ b/gst-libs/ext/libav/libavcodec/iff.c
@@ -29,6 +29,7 @@
#include "bytestream.h"
#include "avcodec.h"
#include "get_bits.h"
+#include "internal.h"
typedef struct {
AVFrame frame;
@@ -152,10 +153,10 @@ static av_cold int decode_init(AVCodecContext *avctx)
if (avctx->bits_per_coded_sample <= 8) {
avctx->pix_fmt = (avctx->bits_per_coded_sample < 8 ||
- avctx->extradata_size) ? PIX_FMT_PAL8
- : PIX_FMT_GRAY8;
+ avctx->extradata_size) ? AV_PIX_FMT_PAL8
+ : AV_PIX_FMT_GRAY8;
} else if (avctx->bits_per_coded_sample <= 32) {
- avctx->pix_fmt = PIX_FMT_BGR32;
+ avctx->pix_fmt = AV_PIX_FMT_BGR32;
} else {
return AVERROR_INVALIDDATA;
}
@@ -246,7 +247,7 @@ static int decode_byterun(uint8_t *dst, int dst_size,
}
static int decode_frame_ilbm(AVCodecContext *avctx,
- void *data, int *data_size,
+ void *data, int *got_frame,
AVPacket *avpkt)
{
IffContext *s = avctx->priv_data;
@@ -260,17 +261,17 @@ static int decode_frame_ilbm(AVCodecContext *avctx,
av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n");
return res;
}
- } else if ((res = avctx->get_buffer(avctx, &s->frame)) < 0) {
+ } else if ((res = ff_get_buffer(avctx, &s->frame)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return res;
- } else if (avctx->bits_per_coded_sample <= 8 && avctx->pix_fmt != PIX_FMT_GRAY8) {
+ } else if (avctx->bits_per_coded_sample <= 8 && avctx->pix_fmt != AV_PIX_FMT_GRAY8) {
if ((res = ff_cmap_read_palette(avctx, (uint32_t*)s->frame.data[1])) < 0)
return res;
}
s->init = 1;
if (avctx->codec_tag == MKTAG('I','L','B','M')) { // interleaved
- if (avctx->pix_fmt == PIX_FMT_PAL8 || avctx->pix_fmt == PIX_FMT_GRAY8) {
+ if (avctx->pix_fmt == AV_PIX_FMT_PAL8 || avctx->pix_fmt == AV_PIX_FMT_GRAY8) {
for(y = 0; y < avctx->height; y++ ) {
uint8_t *row = &s->frame.data[0][ y*s->frame.linesize[0] ];
memset(row, 0, avctx->width);
@@ -279,7 +280,7 @@ static int decode_frame_ilbm(AVCodecContext *avctx,
buf += s->planesize;
}
}
- } else { // PIX_FMT_BGR32
+ } else { // AV_PIX_FMT_BGR32
for(y = 0; y < avctx->height; y++ ) {
uint8_t *row = &s->frame.data[0][y*s->frame.linesize[0]];
memset(row, 0, avctx->width << 2);
@@ -289,7 +290,7 @@ static int decode_frame_ilbm(AVCodecContext *avctx,
}
}
}
- } else if (avctx->pix_fmt == PIX_FMT_PAL8 || avctx->pix_fmt == PIX_FMT_GRAY8) { // IFF-PBM
+ } else if (avctx->pix_fmt == AV_PIX_FMT_PAL8 || avctx->pix_fmt == AV_PIX_FMT_GRAY8) { // IFF-PBM
for(y = 0; y < avctx->height; y++ ) {
uint8_t *row = &s->frame.data[0][y * s->frame.linesize[0]];
memcpy(row, buf, FFMIN(avctx->width, buf_end - buf));
@@ -297,13 +298,13 @@ static int decode_frame_ilbm(AVCodecContext *avctx,
}
}
- *data_size = sizeof(AVFrame);
+ *got_frame = 1;
*(AVFrame*)data = s->frame;
return buf_size;
}
static int decode_frame_byterun1(AVCodecContext *avctx,
- void *data, int *data_size,
+ void *data, int *got_frame,
AVPacket *avpkt)
{
IffContext *s = avctx->priv_data;
@@ -317,17 +318,17 @@ static int decode_frame_byterun1(AVCodecContext *avctx,
av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n");
return res;
}
- } else if ((res = avctx->get_buffer(avctx, &s->frame)) < 0) {
+ } else if ((res = ff_get_buffer(avctx, &s->frame)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return res;
- } else if (avctx->bits_per_coded_sample <= 8 && avctx->pix_fmt != PIX_FMT_GRAY8) {
+ } else if (avctx->bits_per_coded_sample <= 8 && avctx->pix_fmt != AV_PIX_FMT_GRAY8) {
if ((res = ff_cmap_read_palette(avctx, (uint32_t*)s->frame.data[1])) < 0)
return res;
}
s->init = 1;
if (avctx->codec_tag == MKTAG('I','L','B','M')) { //interleaved
- if (avctx->pix_fmt == PIX_FMT_PAL8 || avctx->pix_fmt == PIX_FMT_GRAY8) {
+ if (avctx->pix_fmt == AV_PIX_FMT_PAL8 || avctx->pix_fmt == AV_PIX_FMT_GRAY8) {
for(y = 0; y < avctx->height ; y++ ) {
uint8_t *row = &s->frame.data[0][ y*s->frame.linesize[0] ];
memset(row, 0, avctx->width);
@@ -336,7 +337,7 @@ static int decode_frame_byterun1(AVCodecContext *avctx,
decodeplane8(row, s->planebuf, s->planesize, plane);
}
}
- } else { //PIX_FMT_BGR32
+ } else { //AV_PIX_FMT_BGR32
for(y = 0; y < avctx->height ; y++ ) {
uint8_t *row = &s->frame.data[0][y*s->frame.linesize[0]];
memset(row, 0, avctx->width << 2);
@@ -353,7 +354,7 @@ static int decode_frame_byterun1(AVCodecContext *avctx,
}
}
- *data_size = sizeof(AVFrame);
+ *got_frame = 1;
*(AVFrame*)data = s->frame;
return buf_size;
}
@@ -370,23 +371,23 @@ static av_cold int decode_end(AVCodecContext *avctx)
AVCodec ff_iff_ilbm_decoder = {
.name = "iff_ilbm",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_IFF_ILBM,
+ .id = AV_CODEC_ID_IFF_ILBM,
.priv_data_size = sizeof(IffContext),
.init = decode_init,
.close = decode_end,
.decode = decode_frame_ilbm,
.capabilities = CODEC_CAP_DR1,
- .long_name = NULL_IF_CONFIG_SMALL("IFF ILBM"),
+ .long_name = NULL_IF_CONFIG_SMALL("IFF ILBM"),
};
AVCodec ff_iff_byterun1_decoder = {
.name = "iff_byterun1",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_IFF_BYTERUN1,
+ .id = AV_CODEC_ID_IFF_BYTERUN1,
.priv_data_size = sizeof(IffContext),
.init = decode_init,
.close = decode_end,
.decode = decode_frame_byterun1,
.capabilities = CODEC_CAP_DR1,
- .long_name = NULL_IF_CONFIG_SMALL("IFF ByteRun1"),
+ .long_name = NULL_IF_CONFIG_SMALL("IFF ByteRun1"),
};
diff --git a/gst-libs/ext/libav/libavcodec/iirfilter.c b/gst-libs/ext/libav/libavcodec/iirfilter.c
index 34d3962..acfa904 100644
--- a/gst-libs/ext/libav/libavcodec/iirfilter.c
+++ b/gst-libs/ext/libav/libavcodec/iirfilter.c
@@ -26,6 +26,7 @@
#include "iirfilter.h"
#include <math.h>
+#include "libavutil/common.h"
/**
* IIR filter global parameters
@@ -311,7 +312,6 @@ av_cold void ff_iir_filter_free_coeffs(struct FFIIRFilterCoeffs *coeffs)
}
#ifdef TEST
-#undef printf
#include <stdio.h>
#define FILT_ORDER 4
diff --git a/gst-libs/ext/libav/libavcodec/imc.c b/gst-libs/ext/libav/libavcodec/imc.c
index ff8e31e..5cff70f 100644
--- a/gst-libs/ext/libav/libavcodec/imc.c
+++ b/gst-libs/ext/libav/libavcodec/imc.c
@@ -25,7 +25,7 @@
* @file
* IMC - Intel Music Coder
* A mdct based codec using a 256 points large transform
- * divied into 32 bands with some mix of scale factors.
+ * divided into 32 bands with some mix of scale factors.
* Only mono is supported.
*
*/
@@ -35,11 +35,12 @@
#include <stddef.h>
#include <stdio.h>
+#include "libavutil/channel_layout.h"
#include "avcodec.h"
#include "get_bits.h"
#include "dsputil.h"
#include "fft.h"
-#include "libavutil/audioconvert.h"
+#include "internal.h"
#include "sinewin.h"
#include "imcdata.h"
@@ -49,9 +50,7 @@
#define BANDS 32
#define COEFFS 256
-typedef struct {
- AVFrame frame;
-
+typedef struct IMCChannel {
float old_floor[BANDS];
float flcoeffs1[BANDS];
float flcoeffs2[BANDS];
@@ -61,16 +60,6 @@ typedef struct {
float flcoeffs6[BANDS];
float CWdecoded[COEFFS];
- /** MDCT tables */
- //@{
- float mdct_sine_window[COEFFS];
- float post_cos[COEFFS];
- float post_sin[COEFFS];
- float pre_coef1[COEFFS];
- float pre_coef2[COEFFS];
- float last_fft_im[COEFFS];
- //@}
-
int bandWidthT[BANDS]; ///< codewords per band
int bitsBandT[BANDS]; ///< how many bits per codeword in band
int CWlengthT[COEFFS]; ///< how many bits in each codeword
@@ -82,15 +71,36 @@ typedef struct {
int skipFlagCount[BANDS]; ///< skipped coeffients per band
int skipFlags[COEFFS]; ///< skip coefficient decoding or not
int codewords[COEFFS]; ///< raw codewords read from bitstream
+
+ float last_fft_im[COEFFS];
+
+ int decoder_reset;
+} IMCChannel;
+
+typedef struct {
+ AVFrame frame;
+
+ IMCChannel chctx[2];
+
+ /** MDCT tables */
+ //@{
+ float mdct_sine_window[COEFFS];
+ float post_cos[COEFFS];
+ float post_sin[COEFFS];
+ float pre_coef1[COEFFS];
+ float pre_coef2[COEFFS];
+ //@}
+
float sqrt_tab[30];
GetBitContext gb;
- int decoder_reset;
- float one_div_log2;
DSPContext dsp;
FFTContext fft;
- DECLARE_ALIGNED(32, FFTComplex, samples)[COEFFS/2];
+ DECLARE_ALIGNED(32, FFTComplex, samples)[COEFFS / 2];
float *out_samples;
+
+ int8_t cyclTab[32], cyclTab2[32];
+ float weights1[31], weights2[31];
} IMCContext;
static VLC huffman_vlc[4][4];
@@ -99,60 +109,119 @@ static VLC huffman_vlc[4][4];
static const int vlc_offsets[17] = {
0, 640, 1156, 1732, 2308, 2852, 3396, 3924,
- 4452, 5220, 5860, 6628, 7268, 7908, 8424, 8936, VLC_TABLES_SIZE};
+ 4452, 5220, 5860, 6628, 7268, 7908, 8424, 8936, VLC_TABLES_SIZE
+};
static VLC_TYPE vlc_tables[VLC_TABLES_SIZE][2];
-static av_cold int imc_decode_init(AVCodecContext * avctx)
+static inline double freq2bark(double freq)
+{
+ return 3.5 * atan((freq / 7500.0) * (freq / 7500.0)) + 13.0 * atan(freq * 0.00076);
+}
+
+static av_cold void iac_generate_tabs(IMCContext *q, int sampling_rate)
+{
+ double freqmin[32], freqmid[32], freqmax[32];
+ double scale = sampling_rate / (256.0 * 2.0 * 2.0);
+ double nyquist_freq = sampling_rate * 0.5;
+ double freq, bark, prev_bark = 0, tf, tb;
+ int i, j;
+
+ for (i = 0; i < 32; i++) {
+ freq = (band_tab[i] + band_tab[i + 1] - 1) * scale;
+ bark = freq2bark(freq);
+
+ if (i > 0) {
+ tb = bark - prev_bark;
+ q->weights1[i - 1] = pow(10.0, -1.0 * tb);
+ q->weights2[i - 1] = pow(10.0, -2.7 * tb);
+ }
+ prev_bark = bark;
+
+ freqmid[i] = freq;
+
+ tf = freq;
+ while (tf < nyquist_freq) {
+ tf += 0.5;
+ tb = freq2bark(tf);
+ if (tb > bark + 0.5)
+ break;
+ }
+ freqmax[i] = tf;
+
+ tf = freq;
+ while (tf > 0.0) {
+ tf -= 0.5;
+ tb = freq2bark(tf);
+ if (tb <= bark - 0.5)
+ break;
+ }
+ freqmin[i] = tf;
+ }
+
+ for (i = 0; i < 32; i++) {
+ freq = freqmax[i];
+ for (j = 31; j > 0 && freq <= freqmid[j]; j--);
+ q->cyclTab[i] = j + 1;
+
+ freq = freqmin[i];
+ for (j = 0; j < 32 && freq >= freqmid[j]; j++);
+ q->cyclTab2[i] = j - 1;
+ }
+}
+
+static av_cold int imc_decode_init(AVCodecContext *avctx)
{
int i, j, ret;
IMCContext *q = avctx->priv_data;
double r1, r2;
- if (avctx->channels != 1) {
+ if (avctx->codec_id == AV_CODEC_ID_IMC)
+ avctx->channels = 1;
+
+ if (avctx->channels > 2) {
av_log_ask_for_sample(avctx, "Number of channels is not supported\n");
return AVERROR_PATCHWELCOME;
}
- q->decoder_reset = 1;
+ for (j = 0; j < avctx->channels; j++) {
+ q->chctx[j].decoder_reset = 1;
- for(i = 0; i < BANDS; i++)
- q->old_floor[i] = 1.0;
+ for (i = 0; i < BANDS; i++)
+ q->chctx[j].old_floor[i] = 1.0;
+
+ for (i = 0; i < COEFFS / 2; i++)
+ q->chctx[j].last_fft_im[i] = 0;
+ }
/* Build mdct window, a simple sine window normalized with sqrt(2) */
ff_sine_window_init(q->mdct_sine_window, COEFFS);
- for(i = 0; i < COEFFS; i++)
+ for (i = 0; i < COEFFS; i++)
q->mdct_sine_window[i] *= sqrt(2.0);
- for(i = 0; i < COEFFS/2; i++){
+ for (i = 0; i < COEFFS / 2; i++) {
q->post_cos[i] = (1.0f / 32768) * cos(i / 256.0 * M_PI);
q->post_sin[i] = (1.0f / 32768) * sin(i / 256.0 * M_PI);
r1 = sin((i * 4.0 + 1.0) / 1024.0 * M_PI);
r2 = cos((i * 4.0 + 1.0) / 1024.0 * M_PI);
- if (i & 0x1)
- {
+ if (i & 0x1) {
q->pre_coef1[i] = (r1 + r2) * sqrt(2.0);
q->pre_coef2[i] = -(r1 - r2) * sqrt(2.0);
- }
- else
- {
+ } else {
q->pre_coef1[i] = -(r1 + r2) * sqrt(2.0);
q->pre_coef2[i] = (r1 - r2) * sqrt(2.0);
}
-
- q->last_fft_im[i] = 0;
}
/* Generate a square root table */
- for(i = 0; i < 30; i++) {
+ for (i = 0; i < 30; i++)
q->sqrt_tab[i] = sqrt(i);
- }
/* initialize the VLC tables */
- for(i = 0; i < 4 ; i++) {
- for(j = 0; j < 4; j++) {
+ for (i = 0; i < 4 ; i++) {
+ for (j = 0; j < 4; j++) {
huffman_vlc[i][j].table = &vlc_tables[vlc_offsets[i * 4 + j]];
huffman_vlc[i][j].table_allocated = vlc_offsets[i * 4 + j + 1] - vlc_offsets[i * 4 + j];
init_vlc(&huffman_vlc[i][j], 9, imc_huffman_sizes[i],
@@ -160,15 +229,24 @@ static av_cold int imc_decode_init(AVCodecContext * avctx)
imc_huffman_bits[i][j], 2, 2, INIT_VLC_USE_NEW_STATIC);
}
}
- q->one_div_log2 = 1/log(2);
+
+ if (avctx->codec_id == AV_CODEC_ID_IAC) {
+ iac_generate_tabs(q, avctx->sample_rate);
+ } else {
+ memcpy(q->cyclTab, cyclTab, sizeof(cyclTab));
+ memcpy(q->cyclTab2, cyclTab2, sizeof(cyclTab2));
+ memcpy(q->weights1, imc_weights1, sizeof(imc_weights1));
+ memcpy(q->weights2, imc_weights2, sizeof(imc_weights2));
+ }
if ((ret = ff_fft_init(&q->fft, 7, 1))) {
av_log(avctx, AV_LOG_INFO, "FFT init failed\n");
return ret;
}
- dsputil_init(&q->dsp, avctx);
- avctx->sample_fmt = AV_SAMPLE_FMT_FLT;
- avctx->channel_layout = AV_CH_LAYOUT_MONO;
+ ff_dsputil_init(&q->dsp, avctx);
+ avctx->sample_fmt = AV_SAMPLE_FMT_FLTP;
+ avctx->channel_layout = avctx->channels == 1 ? AV_CH_LAYOUT_MONO
+ : AV_CH_LAYOUT_STEREO;
avcodec_get_frame_defaults(&q->frame);
avctx->coded_frame = &q->frame;
@@ -176,8 +254,9 @@ static av_cold int imc_decode_init(AVCodecContext * avctx)
return 0;
}
-static void imc_calculate_coeffs(IMCContext* q, float* flcoeffs1, float* flcoeffs2, int* bandWidthT,
- float* flcoeffs3, float* flcoeffs5)
+static void imc_calculate_coeffs(IMCContext *q, float *flcoeffs1,
+ float *flcoeffs2, int *bandWidthT,
+ float *flcoeffs3, float *flcoeffs5)
{
float workT1[BANDS];
float workT2[BANDS];
@@ -186,13 +265,13 @@ static void imc_calculate_coeffs(IMCContext* q, float* flcoeffs1, float* flcoeff
float accum = 0.0;
int i, cnt2;
- for(i = 0; i < BANDS; i++) {
+ for (i = 0; i < BANDS; i++) {
flcoeffs5[i] = workT2[i] = 0.0;
- if (bandWidthT[i]){
+ if (bandWidthT[i]) {
workT1[i] = flcoeffs1[i] * flcoeffs1[i];
flcoeffs3[i] = 2.0 * flcoeffs2[i];
} else {
- workT1[i] = 0.0;
+ workT1[i] = 0.0;
flcoeffs3[i] = -30000.0;
}
workT3[i] = bandWidthT[i] * workT1[i] * 0.01;
@@ -200,37 +279,38 @@ static void imc_calculate_coeffs(IMCContext* q, float* flcoeffs1, float* flcoeff
workT3[i] = 0.0;
}
- for(i = 0; i < BANDS; i++) {
- for(cnt2 = i; cnt2 < cyclTab[i]; cnt2++)
+ for (i = 0; i < BANDS; i++) {
+ for (cnt2 = i; cnt2 < q->cyclTab[i]; cnt2++)
flcoeffs5[cnt2] = flcoeffs5[cnt2] + workT3[i];
- workT2[cnt2-1] = workT2[cnt2-1] + workT3[i];
+ workT2[cnt2 - 1] = workT2[cnt2 - 1] + workT3[i];
}
- for(i = 1; i < BANDS; i++) {
- accum = (workT2[i-1] + accum) * imc_weights1[i-1];
+ for (i = 1; i < BANDS; i++) {
+ accum = (workT2[i - 1] + accum) * q->weights1[i - 1];
flcoeffs5[i] += accum;
}
- for(i = 0; i < BANDS; i++)
+ for (i = 0; i < BANDS; i++)
workT2[i] = 0.0;
- for(i = 0; i < BANDS; i++) {
- for(cnt2 = i-1; cnt2 > cyclTab2[i]; cnt2--)
+ for (i = 0; i < BANDS; i++) {
+ for (cnt2 = i - 1; cnt2 > q->cyclTab2[i]; cnt2--)
flcoeffs5[cnt2] += workT3[i];
workT2[cnt2+1] += workT3[i];
}
accum = 0.0;
- for(i = BANDS-2; i >= 0; i--) {
- accum = (workT2[i+1] + accum) * imc_weights2[i];
+ for (i = BANDS-2; i >= 0; i--) {
+ accum = (workT2[i+1] + accum) * q->weights2[i];
flcoeffs5[i] += accum;
- //there is missing code here, but it seems to never be triggered
+ // there is missing code here, but it seems to never be triggered
}
}
-static void imc_read_level_coeffs(IMCContext* q, int stream_format_code, int* levlCoeffs)
+static void imc_read_level_coeffs(IMCContext *q, int stream_format_code,
+ int *levlCoeffs)
{
int i;
VLC *hufftab[4];
@@ -245,41 +325,42 @@ static void imc_read_level_coeffs(IMCContext* q, int stream_format_code, int* le
hufftab[3] = &huffman_vlc[s][3];
cb_sel = imc_cb_select[s];
- if(stream_format_code & 4)
+ if (stream_format_code & 4)
start = 1;
- if(start)
+ if (start)
levlCoeffs[0] = get_bits(&q->gb, 7);
- for(i = start; i < BANDS; i++){
- levlCoeffs[i] = get_vlc2(&q->gb, hufftab[cb_sel[i]]->table, hufftab[cb_sel[i]]->bits, 2);
- if(levlCoeffs[i] == 17)
+ for (i = start; i < BANDS; i++) {
+ levlCoeffs[i] = get_vlc2(&q->gb, hufftab[cb_sel[i]]->table,
+ hufftab[cb_sel[i]]->bits, 2);
+ if (levlCoeffs[i] == 17)
levlCoeffs[i] += get_bits(&q->gb, 4);
}
}
-static void imc_decode_level_coefficients(IMCContext* q, int* levlCoeffBuf, float* flcoeffs1,
- float* flcoeffs2)
+static void imc_decode_level_coefficients(IMCContext *q, int *levlCoeffBuf,
+ float *flcoeffs1, float *flcoeffs2)
{
int i, level;
float tmp, tmp2;
- //maybe some frequency division thingy
+ // maybe some frequency division thingy
flcoeffs1[0] = 20000.0 / pow (2, levlCoeffBuf[0] * 0.18945); // 0.18945 = log2(10) * 0.05703125
- flcoeffs2[0] = log(flcoeffs1[0])/log(2);
- tmp = flcoeffs1[0];
+ flcoeffs2[0] = log2f(flcoeffs1[0]);
+ tmp = flcoeffs1[0];
tmp2 = flcoeffs2[0];
- for(i = 1; i < BANDS; i++) {
+ for (i = 1; i < BANDS; i++) {
level = levlCoeffBuf[i];
if (level == 16) {
flcoeffs1[i] = 1.0;
flcoeffs2[i] = 0.0;
} else {
if (level < 17)
- level -=7;
+ level -= 7;
else if (level <= 24)
- level -=32;
+ level -= 32;
else
- level -=16;
+ level -= 16;
tmp *= imc_exp_tab[15 + level];
tmp2 += 0.83048 * level; // 0.83048 = log2(10) * 0.25
@@ -290,17 +371,20 @@ static void imc_decode_level_coefficients(IMCContext* q, int* levlCoeffBuf, floa
}
-static void imc_decode_level_coefficients2(IMCContext* q, int* levlCoeffBuf, float* old_floor, float* flcoeffs1,
- float* flcoeffs2) {
+static void imc_decode_level_coefficients2(IMCContext *q, int *levlCoeffBuf,
+ float *old_floor, float *flcoeffs1,
+ float *flcoeffs2)
+{
int i;
- //FIXME maybe flag_buf = noise coding and flcoeffs1 = new scale factors
- // and flcoeffs2 old scale factors
- // might be incomplete due to a missing table that is in the binary code
- for(i = 0; i < BANDS; i++) {
+ /* FIXME maybe flag_buf = noise coding and flcoeffs1 = new scale factors
+ * and flcoeffs2 old scale factors
+ * might be incomplete due to a missing table that is in the binary code
+ */
+ for (i = 0; i < BANDS; i++) {
flcoeffs1[i] = 0;
- if(levlCoeffBuf[i] < 16) {
+ if (levlCoeffBuf[i] < 16) {
flcoeffs1[i] = imc_exp_tab2[levlCoeffBuf[i]] * old_floor[i];
- flcoeffs2[i] = (levlCoeffBuf[i]-7) * 0.83048 + flcoeffs2[i]; // 0.83048 = log2(10) * 0.25
+ flcoeffs2[i] = (levlCoeffBuf[i] - 7) * 0.83048 + flcoeffs2[i]; // 0.83048 = log2(10) * 0.25
} else {
flcoeffs1[i] = old_floor[i];
}
@@ -310,7 +394,9 @@ static void imc_decode_level_coefficients2(IMCContext* q, int* levlCoeffBuf, flo
/**
* Perform bit allocation depending on bits available
*/
-static int bit_allocation (IMCContext* q, int stream_format_code, int freebits, int flag) {
+static int bit_allocation(IMCContext *q, IMCChannel *chctx,
+ int stream_format_code, int freebits, int flag)
+{
int i, j;
const float limit = -1.e20;
float highest = 0.0;
@@ -327,63 +413,63 @@ static int bit_allocation (IMCContext* q, int stream_format_code, int freebits,
int flg;
int found_indx = 0;
- for(i = 0; i < BANDS; i++)
- highest = FFMAX(highest, q->flcoeffs1[i]);
+ for (i = 0; i < BANDS; i++)
+ highest = FFMAX(highest, chctx->flcoeffs1[i]);
- for(i = 0; i < BANDS-1; i++) {
- q->flcoeffs4[i] = q->flcoeffs3[i] - log(q->flcoeffs5[i])/log(2);
- }
- q->flcoeffs4[BANDS - 1] = limit;
+ for (i = 0; i < BANDS - 1; i++)
+ chctx->flcoeffs4[i] = chctx->flcoeffs3[i] - log2f(chctx->flcoeffs5[i]);
+ chctx->flcoeffs4[BANDS - 1] = limit;
highest = highest * 0.25;
- for(i = 0; i < BANDS; i++) {
+ for (i = 0; i < BANDS; i++) {
indx = -1;
- if ((band_tab[i+1] - band_tab[i]) == q->bandWidthT[i])
+ if ((band_tab[i + 1] - band_tab[i]) == chctx->bandWidthT[i])
indx = 0;
- if ((band_tab[i+1] - band_tab[i]) > q->bandWidthT[i])
+ if ((band_tab[i + 1] - band_tab[i]) > chctx->bandWidthT[i])
indx = 1;
- if (((band_tab[i+1] - band_tab[i])/2) >= q->bandWidthT[i])
+ if (((band_tab[i + 1] - band_tab[i]) / 2) >= chctx->bandWidthT[i])
indx = 2;
if (indx == -1)
return AVERROR_INVALIDDATA;
- q->flcoeffs4[i] = q->flcoeffs4[i] + xTab[(indx*2 + (q->flcoeffs1[i] < highest)) * 2 + flag];
+ chctx->flcoeffs4[i] += xTab[(indx * 2 + (chctx->flcoeffs1[i] < highest)) * 2 + flag];
}
if (stream_format_code & 0x2) {
- q->flcoeffs4[0] = limit;
- q->flcoeffs4[1] = limit;
- q->flcoeffs4[2] = limit;
- q->flcoeffs4[3] = limit;
+ chctx->flcoeffs4[0] = limit;
+ chctx->flcoeffs4[1] = limit;
+ chctx->flcoeffs4[2] = limit;
+ chctx->flcoeffs4[3] = limit;
}
- for(i = (stream_format_code & 0x2)?4:0; i < BANDS-1; i++) {
- iacc += q->bandWidthT[i];
- summa += q->bandWidthT[i] * q->flcoeffs4[i];
+ for (i = (stream_format_code & 0x2) ? 4 : 0; i < BANDS - 1; i++) {
+ iacc += chctx->bandWidthT[i];
+ summa += chctx->bandWidthT[i] * chctx->flcoeffs4[i];
}
- q->bandWidthT[BANDS-1] = 0;
+ chctx->bandWidthT[BANDS - 1] = 0;
summa = (summa * 0.5 - freebits) / iacc;
- for(i = 0; i < BANDS/2; i++) {
+ for (i = 0; i < BANDS / 2; i++) {
rres = summer - freebits;
- if((rres >= -8) && (rres <= 8)) break;
+ if ((rres >= -8) && (rres <= 8))
+ break;
summer = 0;
- iacc = 0;
+ iacc = 0;
- for(j = (stream_format_code & 0x2)?4:0; j < BANDS; j++) {
- cwlen = av_clipf(((q->flcoeffs4[j] * 0.5) - summa + 0.5), 0, 6);
+ for (j = (stream_format_code & 0x2) ? 4 : 0; j < BANDS; j++) {
+ cwlen = av_clipf(((chctx->flcoeffs4[j] * 0.5) - summa + 0.5), 0, 6);
- q->bitsBandT[j] = cwlen;
- summer += q->bandWidthT[j] * cwlen;
+ chctx->bitsBandT[j] = cwlen;
+ summer += chctx->bandWidthT[j] * cwlen;
if (cwlen > 0)
- iacc += q->bandWidthT[j];
+ iacc += chctx->bandWidthT[j];
}
flg = t2;
@@ -392,32 +478,33 @@ static int bit_allocation (IMCContext* q, int stream_format_code, int freebits,
t2 = -1;
if (i == 0)
flg = t2;
- if(flg != t2)
+ if (flg != t2)
t1++;
summa = (float)(summer - freebits) / ((t1 + 1) * iacc) + summa;
}
- for(i = (stream_format_code & 0x2)?4:0; i < BANDS; i++) {
- for(j = band_tab[i]; j < band_tab[i+1]; j++)
- q->CWlengthT[j] = q->bitsBandT[i];
+ for (i = (stream_format_code & 0x2) ? 4 : 0; i < BANDS; i++) {
+ for (j = band_tab[i]; j < band_tab[i + 1]; j++)
+ chctx->CWlengthT[j] = chctx->bitsBandT[i];
}
if (freebits > summer) {
- for(i = 0; i < BANDS; i++) {
- workT[i] = (q->bitsBandT[i] == 6) ? -1.e20 : (q->bitsBandT[i] * -2 + q->flcoeffs4[i] - 0.415);
+ for (i = 0; i < BANDS; i++) {
+ workT[i] = (chctx->bitsBandT[i] == 6) ? -1.e20
+ : (chctx->bitsBandT[i] * -2 + chctx->flcoeffs4[i] - 0.415);
}
highest = 0.0;
- do{
+ do {
if (highest <= -1.e20)
break;
found_indx = 0;
highest = -1.e20;
- for(i = 0; i < BANDS; i++) {
+ for (i = 0; i < BANDS; i++) {
if (workT[i] > highest) {
highest = workT[i];
found_indx = i;
@@ -426,19 +513,20 @@ static int bit_allocation (IMCContext* q, int stream_format_code, int freebits,
if (highest > -1.e20) {
workT[found_indx] -= 2.0;
- if (++(q->bitsBandT[found_indx]) == 6)
+ if (++chctx->bitsBandT[found_indx] == 6)
workT[found_indx] = -1.e20;
- for(j = band_tab[found_indx]; j < band_tab[found_indx+1] && (freebits > summer); j++){
- q->CWlengthT[j]++;
+ for (j = band_tab[found_indx]; j < band_tab[found_indx + 1] && (freebits > summer); j++) {
+ chctx->CWlengthT[j]++;
summer++;
}
}
- }while (freebits > summer);
+ } while (freebits > summer);
}
if (freebits < summer) {
- for(i = 0; i < BANDS; i++) {
- workT[i] = q->bitsBandT[i] ? (q->bitsBandT[i] * -2 + q->flcoeffs4[i] + 1.585) : 1.e20;
+ for (i = 0; i < BANDS; i++) {
+ workT[i] = chctx->bitsBandT[i] ? (chctx->bitsBandT[i] * -2 + chctx->flcoeffs4[i] + 1.585)
+ : 1.e20;
}
if (stream_format_code & 0x2) {
workT[0] = 1.e20;
@@ -446,24 +534,25 @@ static int bit_allocation (IMCContext* q, int stream_format_code, int freebits,
workT[2] = 1.e20;
workT[3] = 1.e20;
}
- while (freebits < summer){
- lowest = 1.e10;
+ while (freebits < summer) {
+ lowest = 1.e10;
low_indx = 0;
- for(i = 0; i < BANDS; i++) {
+ for (i = 0; i < BANDS; i++) {
if (workT[i] < lowest) {
- lowest = workT[i];
+ lowest = workT[i];
low_indx = i;
}
}
- //if(lowest >= 1.e10) break;
+ // if (lowest >= 1.e10)
+ // break;
workT[low_indx] = lowest + 2.0;
- if (!(--q->bitsBandT[low_indx]))
+ if (!--chctx->bitsBandT[low_indx])
workT[low_indx] = 1.e20;
- for(j = band_tab[low_indx]; j < band_tab[low_indx+1] && (freebits < summer); j++){
- if(q->CWlengthT[j] > 0){
- q->CWlengthT[j]--;
+ for (j = band_tab[low_indx]; j < band_tab[low_indx+1] && (freebits < summer); j++) {
+ if (chctx->CWlengthT[j] > 0) {
+ chctx->CWlengthT[j]--;
summer--;
}
}
@@ -472,52 +561,54 @@ static int bit_allocation (IMCContext* q, int stream_format_code, int freebits,
return 0;
}
-static void imc_get_skip_coeff(IMCContext* q) {
+static void imc_get_skip_coeff(IMCContext *q, IMCChannel *chctx)
+{
int i, j;
- memset(q->skipFlagBits, 0, sizeof(q->skipFlagBits));
- memset(q->skipFlagCount, 0, sizeof(q->skipFlagCount));
- for(i = 0; i < BANDS; i++) {
- if (!q->bandFlagsBuf[i] || !q->bandWidthT[i])
+ memset(chctx->skipFlagBits, 0, sizeof(chctx->skipFlagBits));
+ memset(chctx->skipFlagCount, 0, sizeof(chctx->skipFlagCount));
+ for (i = 0; i < BANDS; i++) {
+ if (!chctx->bandFlagsBuf[i] || !chctx->bandWidthT[i])
continue;
- if (!q->skipFlagRaw[i]) {
- q->skipFlagBits[i] = band_tab[i+1] - band_tab[i];
+ if (!chctx->skipFlagRaw[i]) {
+ chctx->skipFlagBits[i] = band_tab[i + 1] - band_tab[i];
- for(j = band_tab[i]; j < band_tab[i+1]; j++) {
- if ((q->skipFlags[j] = get_bits1(&q->gb)))
- q->skipFlagCount[i]++;
+ for (j = band_tab[i]; j < band_tab[i + 1]; j++) {
+ chctx->skipFlags[j] = get_bits1(&q->gb);
+ if (chctx->skipFlags[j])
+ chctx->skipFlagCount[i]++;
}
} else {
- for(j = band_tab[i]; j < (band_tab[i+1]-1); j += 2) {
- if(!get_bits1(&q->gb)){//0
- q->skipFlagBits[i]++;
- q->skipFlags[j]=1;
- q->skipFlags[j+1]=1;
- q->skipFlagCount[i] += 2;
- }else{
- if(get_bits1(&q->gb)){//11
- q->skipFlagBits[i] +=2;
- q->skipFlags[j]=0;
- q->skipFlags[j+1]=1;
- q->skipFlagCount[i]++;
- }else{
- q->skipFlagBits[i] +=3;
- q->skipFlags[j+1]=0;
- if(!get_bits1(&q->gb)){//100
- q->skipFlags[j]=1;
- q->skipFlagCount[i]++;
- }else{//101
- q->skipFlags[j]=0;
+ for (j = band_tab[i]; j < band_tab[i + 1] - 1; j += 2) {
+ if (!get_bits1(&q->gb)) { // 0
+ chctx->skipFlagBits[i]++;
+ chctx->skipFlags[j] = 1;
+ chctx->skipFlags[j + 1] = 1;
+ chctx->skipFlagCount[i] += 2;
+ } else {
+ if (get_bits1(&q->gb)) { // 11
+ chctx->skipFlagBits[i] += 2;
+ chctx->skipFlags[j] = 0;
+ chctx->skipFlags[j + 1] = 1;
+ chctx->skipFlagCount[i]++;
+ } else {
+ chctx->skipFlagBits[i] += 3;
+ chctx->skipFlags[j + 1] = 0;
+ if (!get_bits1(&q->gb)) { // 100
+ chctx->skipFlags[j] = 1;
+ chctx->skipFlagCount[i]++;
+ } else { // 101
+ chctx->skipFlags[j] = 0;
}
}
}
}
- if (j < band_tab[i+1]) {
- q->skipFlagBits[i]++;
- if ((q->skipFlags[j] = get_bits1(&q->gb)))
- q->skipFlagCount[i]++;
+ if (j < band_tab[i + 1]) {
+ chctx->skipFlagBits[i]++;
+ if ((chctx->skipFlags[j] = get_bits1(&q->gb)))
+ chctx->skipFlagCount[i]++;
}
}
}
@@ -526,24 +617,27 @@ static void imc_get_skip_coeff(IMCContext* q) {
/**
* Increase highest' band coefficient sizes as some bits won't be used
*/
-static void imc_adjust_bit_allocation (IMCContext* q, int summer) {
+static void imc_adjust_bit_allocation(IMCContext *q, IMCChannel *chctx,
+ int summer)
+{
float workT[32];
int corrected = 0;
int i, j;
- float highest = 0;
- int found_indx=0;
+ float highest = 0;
+ int found_indx = 0;
- for(i = 0; i < BANDS; i++) {
- workT[i] = (q->bitsBandT[i] == 6) ? -1.e20 : (q->bitsBandT[i] * -2 + q->flcoeffs4[i] - 0.415);
+ for (i = 0; i < BANDS; i++) {
+ workT[i] = (chctx->bitsBandT[i] == 6) ? -1.e20
+ : (chctx->bitsBandT[i] * -2 + chctx->flcoeffs4[i] - 0.415);
}
while (corrected < summer) {
- if(highest <= -1.e20)
+ if (highest <= -1.e20)
break;
highest = -1.e20;
- for(i = 0; i < BANDS; i++) {
+ for (i = 0; i < BANDS; i++) {
if (workT[i] > highest) {
highest = workT[i];
found_indx = i;
@@ -552,12 +646,12 @@ static void imc_adjust_bit_allocation (IMCContext* q, int summer) {
if (highest > -1.e20) {
workT[found_indx] -= 2.0;
- if (++(q->bitsBandT[found_indx]) == 6)
+ if (++(chctx->bitsBandT[found_indx]) == 6)
workT[found_indx] = -1.e20;
- for(j = band_tab[found_indx]; j < band_tab[found_indx+1] && (corrected < summer); j++) {
- if (!q->skipFlags[j] && (q->CWlengthT[j] < 6)) {
- q->CWlengthT[j]++;
+ for (j = band_tab[found_indx]; j < band_tab[found_indx+1] && (corrected < summer); j++) {
+ if (!chctx->skipFlags[j] && (chctx->CWlengthT[j] < 6)) {
+ chctx->CWlengthT[j]++;
corrected++;
}
}
@@ -565,63 +659,72 @@ static void imc_adjust_bit_allocation (IMCContext* q, int summer) {
}
}
-static void imc_imdct256(IMCContext *q) {
+static void imc_imdct256(IMCContext *q, IMCChannel *chctx, int channels)
+{
int i;
float re, im;
+ float *dst1 = q->out_samples;
+ float *dst2 = q->out_samples + (COEFFS - 1);
/* prerotation */
- for(i=0; i < COEFFS/2; i++){
- q->samples[i].re = -(q->pre_coef1[i] * q->CWdecoded[COEFFS-1-i*2]) -
- (q->pre_coef2[i] * q->CWdecoded[i*2]);
- q->samples[i].im = (q->pre_coef2[i] * q->CWdecoded[COEFFS-1-i*2]) -
- (q->pre_coef1[i] * q->CWdecoded[i*2]);
+ for (i = 0; i < COEFFS / 2; i++) {
+ q->samples[i].re = -(q->pre_coef1[i] * chctx->CWdecoded[COEFFS - 1 - i * 2]) -
+ (q->pre_coef2[i] * chctx->CWdecoded[i * 2]);
+ q->samples[i].im = (q->pre_coef2[i] * chctx->CWdecoded[COEFFS - 1 - i * 2]) -
+ (q->pre_coef1[i] * chctx->CWdecoded[i * 2]);
}
/* FFT */
q->fft.fft_permute(&q->fft, q->samples);
- q->fft.fft_calc (&q->fft, q->samples);
+ q->fft.fft_calc(&q->fft, q->samples);
/* postrotation, window and reorder */
- for(i = 0; i < COEFFS/2; i++){
- re = (q->samples[i].re * q->post_cos[i]) + (-q->samples[i].im * q->post_sin[i]);
- im = (-q->samples[i].im * q->post_cos[i]) - (q->samples[i].re * q->post_sin[i]);
- q->out_samples[i*2] = (q->mdct_sine_window[COEFFS-1-i*2] * q->last_fft_im[i]) + (q->mdct_sine_window[i*2] * re);
- q->out_samples[COEFFS-1-i*2] = (q->mdct_sine_window[i*2] * q->last_fft_im[i]) - (q->mdct_sine_window[COEFFS-1-i*2] * re);
- q->last_fft_im[i] = im;
+ for (i = 0; i < COEFFS / 2; i++) {
+ re = ( q->samples[i].re * q->post_cos[i]) + (-q->samples[i].im * q->post_sin[i]);
+ im = (-q->samples[i].im * q->post_cos[i]) - ( q->samples[i].re * q->post_sin[i]);
+ *dst1 = (q->mdct_sine_window[COEFFS - 1 - i * 2] * chctx->last_fft_im[i])
+ + (q->mdct_sine_window[i * 2] * re);
+ *dst2 = (q->mdct_sine_window[i * 2] * chctx->last_fft_im[i])
+ - (q->mdct_sine_window[COEFFS - 1 - i * 2] * re);
+ dst1 += 2;
+ dst2 -= 2;
+ chctx->last_fft_im[i] = im;
}
}
-static int inverse_quant_coeff (IMCContext* q, int stream_format_code) {
+static int inverse_quant_coeff(IMCContext *q, IMCChannel *chctx,
+ int stream_format_code)
+{
int i, j;
int middle_value, cw_len, max_size;
- const float* quantizer;
+ const float *quantizer;
- for(i = 0; i < BANDS; i++) {
- for(j = band_tab[i]; j < band_tab[i+1]; j++) {
- q->CWdecoded[j] = 0;
- cw_len = q->CWlengthT[j];
+ for (i = 0; i < BANDS; i++) {
+ for (j = band_tab[i]; j < band_tab[i + 1]; j++) {
+ chctx->CWdecoded[j] = 0;
+ cw_len = chctx->CWlengthT[j];
- if (cw_len <= 0 || q->skipFlags[j])
+ if (cw_len <= 0 || chctx->skipFlags[j])
continue;
- max_size = 1 << cw_len;
+ max_size = 1 << cw_len;
middle_value = max_size >> 1;
- if (q->codewords[j] >= max_size || q->codewords[j] < 0)
+ if (chctx->codewords[j] >= max_size || chctx->codewords[j] < 0)
return AVERROR_INVALIDDATA;
- if (cw_len >= 4){
+ if (cw_len >= 4) {
quantizer = imc_quantizer2[(stream_format_code & 2) >> 1];
- if (q->codewords[j] >= middle_value)
- q->CWdecoded[j] = quantizer[q->codewords[j] - 8] * q->flcoeffs6[i];
+ if (chctx->codewords[j] >= middle_value)
+ chctx->CWdecoded[j] = quantizer[chctx->codewords[j] - 8] * chctx->flcoeffs6[i];
else
- q->CWdecoded[j] = -quantizer[max_size - q->codewords[j] - 8 - 1] * q->flcoeffs6[i];
+ chctx->CWdecoded[j] = -quantizer[max_size - chctx->codewords[j] - 8 - 1] * chctx->flcoeffs6[i];
}else{
- quantizer = imc_quantizer1[((stream_format_code & 2) >> 1) | (q->bandFlagsBuf[i] << 1)];
- if (q->codewords[j] >= middle_value)
- q->CWdecoded[j] = quantizer[q->codewords[j] - 1] * q->flcoeffs6[i];
+ quantizer = imc_quantizer1[((stream_format_code & 2) >> 1) | (chctx->bandFlagsBuf[i] << 1)];
+ if (chctx->codewords[j] >= middle_value)
+ chctx->CWdecoded[j] = quantizer[chctx->codewords[j] - 1] * chctx->flcoeffs6[i];
else
- q->CWdecoded[j] = -quantizer[max_size - 2 - q->codewords[j]] * q->flcoeffs6[i];
+ chctx->CWdecoded[j] = -quantizer[max_size - 2 - chctx->codewords[j]] * chctx->flcoeffs6[i];
}
}
}
@@ -629,209 +732,241 @@ static int inverse_quant_coeff (IMCContext* q, int stream_format_code) {
}
-static int imc_get_coeffs (IMCContext* q) {
+static int imc_get_coeffs(IMCContext *q, IMCChannel *chctx)
+{
int i, j, cw_len, cw;
- for(i = 0; i < BANDS; i++) {
- if(!q->sumLenArr[i]) continue;
- if (q->bandFlagsBuf[i] || q->bandWidthT[i]) {
- for(j = band_tab[i]; j < band_tab[i+1]; j++) {
- cw_len = q->CWlengthT[j];
+ for (i = 0; i < BANDS; i++) {
+ if (!chctx->sumLenArr[i])
+ continue;
+ if (chctx->bandFlagsBuf[i] || chctx->bandWidthT[i]) {
+ for (j = band_tab[i]; j < band_tab[i + 1]; j++) {
+ cw_len = chctx->CWlengthT[j];
cw = 0;
- if (get_bits_count(&q->gb) + cw_len > 512){
-//av_log(NULL,0,"Band %i coeff %i cw_len %i\n",i,j,cw_len);
+ if (get_bits_count(&q->gb) + cw_len > 512) {
+ av_dlog(NULL, "Band %i coeff %i cw_len %i\n", i, j, cw_len);
return AVERROR_INVALIDDATA;
}
- if(cw_len && (!q->bandFlagsBuf[i] || !q->skipFlags[j]))
+ if (cw_len && (!chctx->bandFlagsBuf[i] || !chctx->skipFlags[j]))
cw = get_bits(&q->gb, cw_len);
- q->codewords[j] = cw;
+ chctx->codewords[j] = cw;
}
}
}
return 0;
}
-static int imc_decode_frame(AVCodecContext * avctx, void *data,
- int *got_frame_ptr, AVPacket *avpkt)
+static int imc_decode_block(AVCodecContext *avctx, IMCContext *q, int ch)
{
- const uint8_t *buf = avpkt->data;
- int buf_size = avpkt->size;
-
- IMCContext *q = avctx->priv_data;
-
int stream_format_code;
int imc_hdr, i, j, ret;
int flag;
int bits, summer;
int counter, bitscount;
- LOCAL_ALIGNED_16(uint16_t, buf16, [IMC_BLOCK_SIZE / 2]);
-
- if (buf_size < IMC_BLOCK_SIZE) {
- av_log(avctx, AV_LOG_ERROR, "imc frame too small!\n");
- return AVERROR_INVALIDDATA;
- }
-
- /* get output buffer */
- q->frame.nb_samples = COEFFS;
- if ((ret = avctx->get_buffer(avctx, &q->frame)) < 0) {
- av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
- return ret;
- }
- q->out_samples = (float *)q->frame.data[0];
-
- q->dsp.bswap16_buf(buf16, (const uint16_t*)buf, IMC_BLOCK_SIZE / 2);
+ IMCChannel *chctx = q->chctx + ch;
- init_get_bits(&q->gb, (const uint8_t*)buf16, IMC_BLOCK_SIZE * 8);
/* Check the frame header */
imc_hdr = get_bits(&q->gb, 9);
- if (imc_hdr != IMC_FRAME_ID) {
- av_log(avctx, AV_LOG_ERROR, "imc frame header check failed!\n");
- av_log(avctx, AV_LOG_ERROR, "got %x instead of 0x21.\n", imc_hdr);
+ if (imc_hdr & 0x18) {
+ av_log(avctx, AV_LOG_ERROR, "frame header check failed!\n");
+ av_log(avctx, AV_LOG_ERROR, "got %X.\n", imc_hdr);
return AVERROR_INVALIDDATA;
}
stream_format_code = get_bits(&q->gb, 3);
- if(stream_format_code & 1){
- av_log(avctx, AV_LOG_ERROR, "Stream code format %X is not supported\n", stream_format_code);
- return AVERROR_INVALIDDATA;
+ if (stream_format_code & 1) {
+ av_log_ask_for_sample(avctx, "Stream format %X is not supported\n",
+ stream_format_code);
+ return AVERROR_PATCHWELCOME;
}
-// av_log(avctx, AV_LOG_DEBUG, "stream_format_code = %d\n", stream_format_code);
-
if (stream_format_code & 0x04)
- q->decoder_reset = 1;
+ chctx->decoder_reset = 1;
- if(q->decoder_reset) {
- memset(q->out_samples, 0, sizeof(q->out_samples));
- for(i = 0; i < BANDS; i++)q->old_floor[i] = 1.0;
- for(i = 0; i < COEFFS; i++)q->CWdecoded[i] = 0;
- q->decoder_reset = 0;
+ if (chctx->decoder_reset) {
+ for (i = 0; i < BANDS; i++)
+ chctx->old_floor[i] = 1.0;
+ for (i = 0; i < COEFFS; i++)
+ chctx->CWdecoded[i] = 0;
+ chctx->decoder_reset = 0;
}
flag = get_bits1(&q->gb);
- imc_read_level_coeffs(q, stream_format_code, q->levlCoeffBuf);
+ imc_read_level_coeffs(q, stream_format_code, chctx->levlCoeffBuf);
if (stream_format_code & 0x4)
- imc_decode_level_coefficients(q, q->levlCoeffBuf, q->flcoeffs1, q->flcoeffs2);
+ imc_decode_level_coefficients(q, chctx->levlCoeffBuf,
+ chctx->flcoeffs1, chctx->flcoeffs2);
else
- imc_decode_level_coefficients2(q, q->levlCoeffBuf, q->old_floor, q->flcoeffs1, q->flcoeffs2);
+ imc_decode_level_coefficients2(q, chctx->levlCoeffBuf, chctx->old_floor,
+ chctx->flcoeffs1, chctx->flcoeffs2);
- memcpy(q->old_floor, q->flcoeffs1, 32 * sizeof(float));
+ memcpy(chctx->old_floor, chctx->flcoeffs1, 32 * sizeof(float));
counter = 0;
- for (i=0 ; i<BANDS ; i++) {
- if (q->levlCoeffBuf[i] == 16) {
- q->bandWidthT[i] = 0;
+ for (i = 0; i < BANDS; i++) {
+ if (chctx->levlCoeffBuf[i] == 16) {
+ chctx->bandWidthT[i] = 0;
counter++;
} else
- q->bandWidthT[i] = band_tab[i+1] - band_tab[i];
+ chctx->bandWidthT[i] = band_tab[i + 1] - band_tab[i];
}
- memset(q->bandFlagsBuf, 0, BANDS * sizeof(int));
- for(i = 0; i < BANDS-1; i++) {
- if (q->bandWidthT[i])
- q->bandFlagsBuf[i] = get_bits1(&q->gb);
+ memset(chctx->bandFlagsBuf, 0, BANDS * sizeof(int));
+ for (i = 0; i < BANDS - 1; i++) {
+ if (chctx->bandWidthT[i])
+ chctx->bandFlagsBuf[i] = get_bits1(&q->gb);
}
- imc_calculate_coeffs(q, q->flcoeffs1, q->flcoeffs2, q->bandWidthT, q->flcoeffs3, q->flcoeffs5);
+ imc_calculate_coeffs(q, chctx->flcoeffs1, chctx->flcoeffs2, chctx->bandWidthT, chctx->flcoeffs3, chctx->flcoeffs5);
bitscount = 0;
/* first 4 bands will be assigned 5 bits per coefficient */
if (stream_format_code & 0x2) {
bitscount += 15;
- q->bitsBandT[0] = 5;
- q->CWlengthT[0] = 5;
- q->CWlengthT[1] = 5;
- q->CWlengthT[2] = 5;
- for(i = 1; i < 4; i++){
- bits = (q->levlCoeffBuf[i] == 16) ? 0 : 5;
- q->bitsBandT[i] = bits;
- for(j = band_tab[i]; j < band_tab[i+1]; j++) {
- q->CWlengthT[j] = bits;
- bitscount += bits;
+ chctx->bitsBandT[0] = 5;
+ chctx->CWlengthT[0] = 5;
+ chctx->CWlengthT[1] = 5;
+ chctx->CWlengthT[2] = 5;
+ for (i = 1; i < 4; i++) {
+ bits = (chctx->levlCoeffBuf[i] == 16) ? 0 : 5;
+ chctx->bitsBandT[i] = bits;
+ for (j = band_tab[i]; j < band_tab[i + 1]; j++) {
+ chctx->CWlengthT[j] = bits;
+ bitscount += bits;
}
}
}
+ if (avctx->codec_id == AV_CODEC_ID_IAC) {
+ bitscount += !!chctx->bandWidthT[BANDS - 1];
+ if (!(stream_format_code & 0x2))
+ bitscount += 16;
+ }
- if((ret = bit_allocation (q, stream_format_code,
- 512 - bitscount - get_bits_count(&q->gb), flag)) < 0) {
+ if ((ret = bit_allocation(q, chctx, stream_format_code,
+ 512 - bitscount - get_bits_count(&q->gb),
+ flag)) < 0) {
av_log(avctx, AV_LOG_ERROR, "Bit allocations failed\n");
- q->decoder_reset = 1;
+ chctx->decoder_reset = 1;
return ret;
}
- for(i = 0; i < BANDS; i++) {
- q->sumLenArr[i] = 0;
- q->skipFlagRaw[i] = 0;
- for(j = band_tab[i]; j < band_tab[i+1]; j++)
- q->sumLenArr[i] += q->CWlengthT[j];
- if (q->bandFlagsBuf[i])
- if( (((band_tab[i+1] - band_tab[i]) * 1.5) > q->sumLenArr[i]) && (q->sumLenArr[i] > 0))
- q->skipFlagRaw[i] = 1;
+ for (i = 0; i < BANDS; i++) {
+ chctx->sumLenArr[i] = 0;
+ chctx->skipFlagRaw[i] = 0;
+ for (j = band_tab[i]; j < band_tab[i + 1]; j++)
+ chctx->sumLenArr[i] += chctx->CWlengthT[j];
+ if (chctx->bandFlagsBuf[i])
+ if ((((band_tab[i + 1] - band_tab[i]) * 1.5) > chctx->sumLenArr[i]) && (chctx->sumLenArr[i] > 0))
+ chctx->skipFlagRaw[i] = 1;
}
- imc_get_skip_coeff(q);
+ imc_get_skip_coeff(q, chctx);
- for(i = 0; i < BANDS; i++) {
- q->flcoeffs6[i] = q->flcoeffs1[i];
+ for (i = 0; i < BANDS; i++) {
+ chctx->flcoeffs6[i] = chctx->flcoeffs1[i];
/* band has flag set and at least one coded coefficient */
- if (q->bandFlagsBuf[i] && (band_tab[i+1] - band_tab[i]) != q->skipFlagCount[i]){
- q->flcoeffs6[i] *= q->sqrt_tab[band_tab[i+1] - band_tab[i]] /
- q->sqrt_tab[(band_tab[i+1] - band_tab[i] - q->skipFlagCount[i])];
+ if (chctx->bandFlagsBuf[i] && (band_tab[i + 1] - band_tab[i]) != chctx->skipFlagCount[i]) {
+ chctx->flcoeffs6[i] *= q->sqrt_tab[ band_tab[i + 1] - band_tab[i]] /
+ q->sqrt_tab[(band_tab[i + 1] - band_tab[i] - chctx->skipFlagCount[i])];
}
}
/* calculate bits left, bits needed and adjust bit allocation */
bits = summer = 0;
- for(i = 0; i < BANDS; i++) {
- if (q->bandFlagsBuf[i]) {
- for(j = band_tab[i]; j < band_tab[i+1]; j++) {
- if(q->skipFlags[j]) {
- summer += q->CWlengthT[j];
- q->CWlengthT[j] = 0;
+ for (i = 0; i < BANDS; i++) {
+ if (chctx->bandFlagsBuf[i]) {
+ for (j = band_tab[i]; j < band_tab[i + 1]; j++) {
+ if (chctx->skipFlags[j]) {
+ summer += chctx->CWlengthT[j];
+ chctx->CWlengthT[j] = 0;
}
}
- bits += q->skipFlagBits[i];
- summer -= q->skipFlagBits[i];
+ bits += chctx->skipFlagBits[i];
+ summer -= chctx->skipFlagBits[i];
}
}
- imc_adjust_bit_allocation(q, summer);
+ imc_adjust_bit_allocation(q, chctx, summer);
- for(i = 0; i < BANDS; i++) {
- q->sumLenArr[i] = 0;
+ for (i = 0; i < BANDS; i++) {
+ chctx->sumLenArr[i] = 0;
- for(j = band_tab[i]; j < band_tab[i+1]; j++)
- if (!q->skipFlags[j])
- q->sumLenArr[i] += q->CWlengthT[j];
+ for (j = band_tab[i]; j < band_tab[i + 1]; j++)
+ if (!chctx->skipFlags[j])
+ chctx->sumLenArr[i] += chctx->CWlengthT[j];
}
- memset(q->codewords, 0, sizeof(q->codewords));
+ memset(chctx->codewords, 0, sizeof(chctx->codewords));
- if(imc_get_coeffs(q) < 0) {
+ if (imc_get_coeffs(q, chctx) < 0) {
av_log(avctx, AV_LOG_ERROR, "Read coefficients failed\n");
- q->decoder_reset = 1;
+ chctx->decoder_reset = 1;
return AVERROR_INVALIDDATA;
}
- if(inverse_quant_coeff(q, stream_format_code) < 0) {
+ if (inverse_quant_coeff(q, chctx, stream_format_code) < 0) {
av_log(avctx, AV_LOG_ERROR, "Inverse quantization of coefficients failed\n");
- q->decoder_reset = 1;
+ chctx->decoder_reset = 1;
return AVERROR_INVALIDDATA;
}
- memset(q->skipFlags, 0, sizeof(q->skipFlags));
+ memset(chctx->skipFlags, 0, sizeof(chctx->skipFlags));
- imc_imdct256(q);
+ imc_imdct256(q, chctx, avctx->channels);
+
+ return 0;
+}
+
+static int imc_decode_frame(AVCodecContext *avctx, void *data,
+ int *got_frame_ptr, AVPacket *avpkt)
+{
+ const uint8_t *buf = avpkt->data;
+ int buf_size = avpkt->size;
+ int ret, i;
+
+ IMCContext *q = avctx->priv_data;
+
+ LOCAL_ALIGNED_16(uint16_t, buf16, [IMC_BLOCK_SIZE / 2]);
+
+ if (buf_size < IMC_BLOCK_SIZE * avctx->channels) {
+ av_log(avctx, AV_LOG_ERROR, "frame too small!\n");
+ return AVERROR_INVALIDDATA;
+ }
+
+ /* get output buffer */
+ q->frame.nb_samples = COEFFS;
+ if ((ret = ff_get_buffer(avctx, &q->frame)) < 0) {
+ av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
+ return ret;
+ }
+
+ for (i = 0; i < avctx->channels; i++) {
+ q->out_samples = (float *)q->frame.extended_data[i];
+
+ q->dsp.bswap16_buf(buf16, (const uint16_t*)buf, IMC_BLOCK_SIZE / 2);
+
+ init_get_bits(&q->gb, (const uint8_t*)buf16, IMC_BLOCK_SIZE * 8);
+
+ buf += IMC_BLOCK_SIZE;
+
+ if ((ret = imc_decode_block(avctx, q, i)) < 0)
+ return ret;
+ }
+
+ if (avctx->channels == 2) {
+ q->dsp.butterflies_float((float *)q->frame.extended_data[0],
+ (float *)q->frame.extended_data[1], COEFFS);
+ }
*got_frame_ptr = 1;
*(AVFrame *)data = q->frame;
- return IMC_BLOCK_SIZE;
+ return IMC_BLOCK_SIZE * avctx->channels;
}
@@ -846,13 +981,29 @@ static av_cold int imc_decode_close(AVCodecContext * avctx)
AVCodec ff_imc_decoder = {
- .name = "imc",
- .type = AVMEDIA_TYPE_AUDIO,
- .id = CODEC_ID_IMC,
+ .name = "imc",
+ .type = AVMEDIA_TYPE_AUDIO,
+ .id = AV_CODEC_ID_IMC,
+ .priv_data_size = sizeof(IMCContext),
+ .init = imc_decode_init,
+ .close = imc_decode_close,
+ .decode = imc_decode_frame,
+ .capabilities = CODEC_CAP_DR1,
+ .long_name = NULL_IF_CONFIG_SMALL("IMC (Intel Music Coder)"),
+ .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP,
+ AV_SAMPLE_FMT_NONE },
+};
+
+AVCodec ff_iac_decoder = {
+ .name = "iac",
+ .type = AVMEDIA_TYPE_AUDIO,
+ .id = AV_CODEC_ID_IAC,
.priv_data_size = sizeof(IMCContext),
- .init = imc_decode_init,
- .close = imc_decode_close,
- .decode = imc_decode_frame,
- .capabilities = CODEC_CAP_DR1,
- .long_name = NULL_IF_CONFIG_SMALL("IMC (Intel Music Coder)"),
+ .init = imc_decode_init,
+ .close = imc_decode_close,
+ .decode = imc_decode_frame,
+ .capabilities = CODEC_CAP_DR1,
+ .long_name = NULL_IF_CONFIG_SMALL("IAC (Indeo Audio Coder)"),
+ .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP,
+ AV_SAMPLE_FMT_NONE },
};
diff --git a/gst-libs/ext/libav/libavcodec/imgconvert.c b/gst-libs/ext/libav/libavcodec/imgconvert.c
index 1dfe3b7..ff4236e 100644
--- a/gst-libs/ext/libav/libavcodec/imgconvert.c
+++ b/gst-libs/ext/libav/libavcodec/imgconvert.c
@@ -33,25 +33,16 @@
#include "avcodec.h"
#include "dsputil.h"
#include "internal.h"
-#include "imgconvert.h"
#include "libavutil/colorspace.h"
+#include "libavutil/common.h"
#include "libavutil/pixdesc.h"
#include "libavutil/imgutils.h"
-#if HAVE_MMX && HAVE_YASM
+#if HAVE_MMX_EXTERNAL
#include "x86/dsputil_mmx.h"
#endif
-#define FF_COLOR_RGB 0 /**< RGB color space */
-#define FF_COLOR_GRAY 1 /**< gray color space */
-#define FF_COLOR_YUV 2 /**< YUV color space. 16 <= Y <= 235, 16 <= U, V <= 240 */
-#define FF_COLOR_YUV_JPEG 3 /**< YUV color space. 0 <= Y <= 255, 0 <= U, V <= 255 */
-
-#define FF_PIXEL_PLANAR 0 /**< each channel has one component in AVPicture */
-#define FF_PIXEL_PACKED 1 /**< only one components containing all the channels */
-#define FF_PIXEL_PALETTE 2 /**< one components containing indexes for a palette */
-
-#if HAVE_MMX && HAVE_YASM
+#if HAVE_MMX_EXTERNAL
#define deinterlace_line_inplace ff_deinterlace_line_inplace_mmx
#define deinterlace_line ff_deinterlace_line_mmx
#else
@@ -59,579 +50,115 @@
#define deinterlace_line deinterlace_line_c
#endif
-typedef struct PixFmtInfo {
- uint8_t nb_channels; /**< number of channels (including alpha) */
- uint8_t color_type; /**< color type (see FF_COLOR_xxx constants) */
- uint8_t pixel_type; /**< pixel storage type (see FF_PIXEL_xxx constants) */
- uint8_t is_alpha : 1; /**< true if alpha can be specified */
- uint8_t depth; /**< bit depth of the color components */
-} PixFmtInfo;
-
-/* this table gives more information about formats */
-static const PixFmtInfo pix_fmt_info[PIX_FMT_NB] = {
- /* YUV formats */
- [PIX_FMT_YUV420P] = {
- .nb_channels = 3,
- .color_type = FF_COLOR_YUV,
- .pixel_type = FF_PIXEL_PLANAR,
- .depth = 8,
- },
- [PIX_FMT_YUV422P] = {
- .nb_channels = 3,
- .color_type = FF_COLOR_YUV,
- .pixel_type = FF_PIXEL_PLANAR,
- .depth = 8,
- },
- [PIX_FMT_YUV444P] = {
- .nb_channels = 3,
- .color_type = FF_COLOR_YUV,
- .pixel_type = FF_PIXEL_PLANAR,
- .depth = 8,
- },
- [PIX_FMT_YUYV422] = {
- .nb_channels = 1,
- .color_type = FF_COLOR_YUV,
- .pixel_type = FF_PIXEL_PACKED,
- .depth = 8,
- },
- [PIX_FMT_UYVY422] = {
- .nb_channels = 1,
- .color_type = FF_COLOR_YUV,
- .pixel_type = FF_PIXEL_PACKED,
- .depth = 8,
- },
- [PIX_FMT_YUV410P] = {
- .nb_channels = 3,
- .color_type = FF_COLOR_YUV,
- .pixel_type = FF_PIXEL_PLANAR,
- .depth = 8,
- },
- [PIX_FMT_YUV411P] = {
- .nb_channels = 3,
- .color_type = FF_COLOR_YUV,
- .pixel_type = FF_PIXEL_PLANAR,
- .depth = 8,
- },
- [PIX_FMT_YUV440P] = {
- .nb_channels = 3,
- .color_type = FF_COLOR_YUV,
- .pixel_type = FF_PIXEL_PLANAR,
- .depth = 8,
- },
- [PIX_FMT_YUV420P16LE] = {
- .nb_channels = 3,
- .color_type = FF_COLOR_YUV,
- .pixel_type = FF_PIXEL_PLANAR,
- .depth = 16,
- },
- [PIX_FMT_YUV422P16LE] = {
- .nb_channels = 3,
- .color_type = FF_COLOR_YUV,
- .pixel_type = FF_PIXEL_PLANAR,
- .depth = 16,
- },
- [PIX_FMT_YUV444P16LE] = {
- .nb_channels = 3,
- .color_type = FF_COLOR_YUV,
- .pixel_type = FF_PIXEL_PLANAR,
- .depth = 16,
- },
- [PIX_FMT_YUV420P16BE] = {
- .nb_channels = 3,
- .color_type = FF_COLOR_YUV,
- .pixel_type = FF_PIXEL_PLANAR,
- .depth = 16,
- },
- [PIX_FMT_YUV422P16BE] = {
- .nb_channels = 3,
- .color_type = FF_COLOR_YUV,
- .pixel_type = FF_PIXEL_PLANAR,
- .depth = 16,
- },
- [PIX_FMT_YUV444P16BE] = {
- .nb_channels = 3,
- .color_type = FF_COLOR_YUV,
- .pixel_type = FF_PIXEL_PLANAR,
- .depth = 16,
- },
-
-
- /* YUV formats with alpha plane */
- [PIX_FMT_YUVA420P] = {
- .nb_channels = 4,
- .color_type = FF_COLOR_YUV,
- .pixel_type = FF_PIXEL_PLANAR,
- .depth = 8,
- },
-
- /* JPEG YUV */
- [PIX_FMT_YUVJ420P] = {
- .nb_channels = 3,
- .color_type = FF_COLOR_YUV_JPEG,
- .pixel_type = FF_PIXEL_PLANAR,
- .depth = 8,
- },
- [PIX_FMT_YUVJ422P] = {
- .nb_channels = 3,
- .color_type = FF_COLOR_YUV_JPEG,
- .pixel_type = FF_PIXEL_PLANAR,
- .depth = 8,
- },
- [PIX_FMT_YUVJ444P] = {
- .nb_channels = 3,
- .color_type = FF_COLOR_YUV_JPEG,
- .pixel_type = FF_PIXEL_PLANAR,
- .depth = 8,
- },
- [PIX_FMT_YUVJ440P] = {
- .nb_channels = 3,
- .color_type = FF_COLOR_YUV_JPEG,
- .pixel_type = FF_PIXEL_PLANAR,
- .depth = 8,
- },
-
- /* RGB formats */
- [PIX_FMT_RGB24] = {
- .nb_channels = 3,
- .color_type = FF_COLOR_RGB,
- .pixel_type = FF_PIXEL_PACKED,
- .depth = 8,
- },
- [PIX_FMT_BGR24] = {
- .nb_channels = 3,
- .color_type = FF_COLOR_RGB,
- .pixel_type = FF_PIXEL_PACKED,
- .depth = 8,
- },
- [PIX_FMT_ARGB] = {
- .nb_channels = 4, .is_alpha = 1,
- .color_type = FF_COLOR_RGB,
- .pixel_type = FF_PIXEL_PACKED,
- .depth = 8,
- },
- [PIX_FMT_RGB48BE] = {
- .nb_channels = 3,
- .color_type = FF_COLOR_RGB,
- .pixel_type = FF_PIXEL_PACKED,
- .depth = 16,
- },
- [PIX_FMT_RGB48LE] = {
- .nb_channels = 3,
- .color_type = FF_COLOR_RGB,
- .pixel_type = FF_PIXEL_PACKED,
- .depth = 16,
- },
- [PIX_FMT_RGB565BE] = {
- .nb_channels = 3,
- .color_type = FF_COLOR_RGB,
- .pixel_type = FF_PIXEL_PACKED,
- .depth = 5,
- },
- [PIX_FMT_RGB565LE] = {
- .nb_channels = 3,
- .color_type = FF_COLOR_RGB,
- .pixel_type = FF_PIXEL_PACKED,
- .depth = 5,
- },
- [PIX_FMT_RGB555BE] = {
- .nb_channels = 3,
- .color_type = FF_COLOR_RGB,
- .pixel_type = FF_PIXEL_PACKED,
- .depth = 5,
- },
- [PIX_FMT_RGB555LE] = {
- .nb_channels = 3,
- .color_type = FF_COLOR_RGB,
- .pixel_type = FF_PIXEL_PACKED,
- .depth = 5,
- },
- [PIX_FMT_RGB444BE] = {
- .nb_channels = 3,
- .color_type = FF_COLOR_RGB,
- .pixel_type = FF_PIXEL_PACKED,
- .depth = 4,
- },
- [PIX_FMT_RGB444LE] = {
- .nb_channels = 3,
- .color_type = FF_COLOR_RGB,
- .pixel_type = FF_PIXEL_PACKED,
- .depth = 4,
- },
-
- /* gray / mono formats */
- [PIX_FMT_GRAY16BE] = {
- .nb_channels = 1,
- .color_type = FF_COLOR_GRAY,
- .pixel_type = FF_PIXEL_PLANAR,
- .depth = 16,
- },
- [PIX_FMT_GRAY16LE] = {
- .nb_channels = 1,
- .color_type = FF_COLOR_GRAY,
- .pixel_type = FF_PIXEL_PLANAR,
- .depth = 16,
- },
- [PIX_FMT_GRAY8] = {
- .nb_channels = 1,
- .color_type = FF_COLOR_GRAY,
- .pixel_type = FF_PIXEL_PLANAR,
- .depth = 8,
- },
- [PIX_FMT_MONOWHITE] = {
- .nb_channels = 1,
- .color_type = FF_COLOR_GRAY,
- .pixel_type = FF_PIXEL_PLANAR,
- .depth = 1,
- },
- [PIX_FMT_MONOBLACK] = {
- .nb_channels = 1,
- .color_type = FF_COLOR_GRAY,
- .pixel_type = FF_PIXEL_PLANAR,
- .depth = 1,
- },
-
- /* paletted formats */
- [PIX_FMT_PAL8] = {
- .nb_channels = 4, .is_alpha = 1,
- .color_type = FF_COLOR_RGB,
- .pixel_type = FF_PIXEL_PALETTE,
- .depth = 8,
- },
- [PIX_FMT_UYYVYY411] = {
- .nb_channels = 1,
- .color_type = FF_COLOR_YUV,
- .pixel_type = FF_PIXEL_PACKED,
- .depth = 8,
- },
- [PIX_FMT_ABGR] = {
- .nb_channels = 4, .is_alpha = 1,
- .color_type = FF_COLOR_RGB,
- .pixel_type = FF_PIXEL_PACKED,
- .depth = 8,
- },
- [PIX_FMT_BGR565BE] = {
- .nb_channels = 3,
- .color_type = FF_COLOR_RGB,
- .pixel_type = FF_PIXEL_PACKED,
- .depth = 5,
- },
- [PIX_FMT_BGR565LE] = {
- .nb_channels = 3,
- .color_type = FF_COLOR_RGB,
- .pixel_type = FF_PIXEL_PACKED,
- .depth = 5,
- },
- [PIX_FMT_BGR555BE] = {
- .nb_channels = 3,
- .color_type = FF_COLOR_RGB,
- .pixel_type = FF_PIXEL_PACKED,
- .depth = 5,
- },
- [PIX_FMT_BGR555LE] = {
- .nb_channels = 3,
- .color_type = FF_COLOR_RGB,
- .pixel_type = FF_PIXEL_PACKED,
- .depth = 5,
- },
- [PIX_FMT_BGR444BE] = {
- .nb_channels = 3,
- .color_type = FF_COLOR_RGB,
- .pixel_type = FF_PIXEL_PACKED,
- .depth = 4,
- },
- [PIX_FMT_BGR444LE] = {
- .nb_channels = 3,
- .color_type = FF_COLOR_RGB,
- .pixel_type = FF_PIXEL_PACKED,
- .depth = 4,
- },
- [PIX_FMT_RGB8] = {
- .nb_channels = 1,
- .color_type = FF_COLOR_RGB,
- .pixel_type = FF_PIXEL_PACKED,
- .depth = 8,
- },
- [PIX_FMT_RGB4] = {
- .nb_channels = 1,
- .color_type = FF_COLOR_RGB,
- .pixel_type = FF_PIXEL_PACKED,
- .depth = 4,
- },
- [PIX_FMT_RGB4_BYTE] = {
- .nb_channels = 1,
- .color_type = FF_COLOR_RGB,
- .pixel_type = FF_PIXEL_PACKED,
- .depth = 8,
- },
- [PIX_FMT_BGR8] = {
- .nb_channels = 1,
- .color_type = FF_COLOR_RGB,
- .pixel_type = FF_PIXEL_PACKED,
- .depth = 8,
- },
- [PIX_FMT_BGR4] = {
- .nb_channels = 1,
- .color_type = FF_COLOR_RGB,
- .pixel_type = FF_PIXEL_PACKED,
- .depth = 4,
- },
- [PIX_FMT_BGR4_BYTE] = {
- .nb_channels = 1,
- .color_type = FF_COLOR_RGB,
- .pixel_type = FF_PIXEL_PACKED,
- .depth = 8,
- },
- [PIX_FMT_NV12] = {
- .nb_channels = 2,
- .color_type = FF_COLOR_YUV,
- .pixel_type = FF_PIXEL_PLANAR,
- .depth = 8,
- },
- [PIX_FMT_NV21] = {
- .nb_channels = 2,
- .color_type = FF_COLOR_YUV,
- .pixel_type = FF_PIXEL_PLANAR,
- .depth = 8,
- },
-
- [PIX_FMT_BGRA] = {
- .nb_channels = 4, .is_alpha = 1,
- .color_type = FF_COLOR_RGB,
- .pixel_type = FF_PIXEL_PACKED,
- .depth = 8,
- },
- [PIX_FMT_RGBA] = {
- .nb_channels = 4, .is_alpha = 1,
- .color_type = FF_COLOR_RGB,
- .pixel_type = FF_PIXEL_PACKED,
- .depth = 8,
- },
-};
-
-void avcodec_get_chroma_sub_sample(enum PixelFormat pix_fmt, int *h_shift, int *v_shift)
-{
- *h_shift = av_pix_fmt_descriptors[pix_fmt].log2_chroma_w;
- *v_shift = av_pix_fmt_descriptors[pix_fmt].log2_chroma_h;
-}
-
-#if FF_API_GET_PIX_FMT_NAME
-const char *avcodec_get_pix_fmt_name(enum PixelFormat pix_fmt)
-{
- return av_get_pix_fmt_name(pix_fmt);
-}
-#endif
-
-int ff_is_hwaccel_pix_fmt(enum PixelFormat pix_fmt)
-{
- return av_pix_fmt_descriptors[pix_fmt].flags & PIX_FMT_HWACCEL;
-}
-
-int avpicture_fill(AVPicture *picture, uint8_t *ptr,
- enum PixelFormat pix_fmt, int width, int height)
-{
- int ret;
-
- if ((ret = av_image_check_size(width, height, 0, NULL)) < 0)
- return ret;
-
- if ((ret = av_image_fill_linesizes(picture->linesize, pix_fmt, width)) < 0)
- return ret;
-
- return av_image_fill_pointers(picture->data, pix_fmt, height, ptr, picture->linesize);
-}
-
-int avpicture_layout(const AVPicture* src, enum PixelFormat pix_fmt, int width, int height,
- unsigned char *dest, int dest_size)
+void avcodec_get_chroma_sub_sample(enum AVPixelFormat pix_fmt, int *h_shift, int *v_shift)
{
- int i, j, nb_planes = 0, linesizes[4];
- const AVPixFmtDescriptor *desc = &av_pix_fmt_descriptors[pix_fmt];
- int size = avpicture_get_size(pix_fmt, width, height);
-
- if (size > dest_size || size < 0)
- return AVERROR(EINVAL);
-
- for (i = 0; i < desc->nb_components; i++)
- nb_planes = FFMAX(desc->comp[i].plane, nb_planes);
- nb_planes++;
-
- av_image_fill_linesizes(linesizes, pix_fmt, width);
- for (i = 0; i < nb_planes; i++) {
- int h, shift = (i == 1 || i == 2) ? desc->log2_chroma_h : 0;
- const unsigned char *s = src->data[i];
- h = (height + (1 << shift) - 1) >> shift;
-
- for (j = 0; j < h; j++) {
- memcpy(dest, s, linesizes[i]);
- dest += linesizes[i];
- s += src->linesize[i];
- }
- }
-
- if (desc->flags & PIX_FMT_PAL)
- memcpy((unsigned char *)(((size_t)dest + 3) & ~3), src->data[1], 256 * 4);
-
- return size;
+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
+ *h_shift = desc->log2_chroma_w;
+ *v_shift = desc->log2_chroma_h;
}
-int avpicture_get_size(enum PixelFormat pix_fmt, int width, int height)
+static int is_gray(const AVPixFmtDescriptor *desc)
{
- AVPicture dummy_pict;
- if(av_image_check_size(width, height, 0, NULL))
- return -1;
- switch (pix_fmt) {
- case PIX_FMT_RGB8:
- case PIX_FMT_BGR8:
- case PIX_FMT_RGB4_BYTE:
- case PIX_FMT_BGR4_BYTE:
- case PIX_FMT_GRAY8:
- // do not include palette for these pseudo-paletted formats
- return width * height;
- }
- return avpicture_fill(&dummy_pict, NULL, pix_fmt, width, height);
+ return desc->nb_components - (desc->flags & PIX_FMT_ALPHA) == 1;
}
-int avcodec_get_pix_fmt_loss(enum PixelFormat dst_pix_fmt, enum PixelFormat src_pix_fmt,
+int avcodec_get_pix_fmt_loss(enum AVPixelFormat dst_pix_fmt,
+ enum AVPixelFormat src_pix_fmt,
int has_alpha)
{
- const PixFmtInfo *pf, *ps;
- const AVPixFmtDescriptor *src_desc = &av_pix_fmt_descriptors[src_pix_fmt];
- const AVPixFmtDescriptor *dst_desc = &av_pix_fmt_descriptors[dst_pix_fmt];
- int loss;
-
- ps = &pix_fmt_info[src_pix_fmt];
+ const AVPixFmtDescriptor *src_desc = av_pix_fmt_desc_get(src_pix_fmt);
+ const AVPixFmtDescriptor *dst_desc = av_pix_fmt_desc_get(dst_pix_fmt);
+ int loss, i, nb_components = FFMIN(src_desc->nb_components,
+ dst_desc->nb_components);
/* compute loss */
loss = 0;
- pf = &pix_fmt_info[dst_pix_fmt];
- if (pf->depth < ps->depth ||
- ((dst_pix_fmt == PIX_FMT_RGB555BE || dst_pix_fmt == PIX_FMT_RGB555LE ||
- dst_pix_fmt == PIX_FMT_BGR555BE || dst_pix_fmt == PIX_FMT_BGR555LE) &&
- (src_pix_fmt == PIX_FMT_RGB565BE || src_pix_fmt == PIX_FMT_RGB565LE ||
- src_pix_fmt == PIX_FMT_BGR565BE || src_pix_fmt == PIX_FMT_BGR565LE)))
- loss |= FF_LOSS_DEPTH;
+
+ if (dst_pix_fmt == src_pix_fmt)
+ return 0;
+
+ for (i = 0; i < nb_components; i++)
+ if (src_desc->comp[i].depth_minus1 > dst_desc->comp[i].depth_minus1)
+ loss |= FF_LOSS_DEPTH;
+
if (dst_desc->log2_chroma_w > src_desc->log2_chroma_w ||
dst_desc->log2_chroma_h > src_desc->log2_chroma_h)
loss |= FF_LOSS_RESOLUTION;
- switch(pf->color_type) {
- case FF_COLOR_RGB:
- if (ps->color_type != FF_COLOR_RGB &&
- ps->color_type != FF_COLOR_GRAY)
- loss |= FF_LOSS_COLORSPACE;
- break;
- case FF_COLOR_GRAY:
- if (ps->color_type != FF_COLOR_GRAY)
- loss |= FF_LOSS_COLORSPACE;
- break;
- case FF_COLOR_YUV:
- if (ps->color_type != FF_COLOR_YUV)
- loss |= FF_LOSS_COLORSPACE;
- break;
- case FF_COLOR_YUV_JPEG:
- if (ps->color_type != FF_COLOR_YUV_JPEG &&
- ps->color_type != FF_COLOR_YUV &&
- ps->color_type != FF_COLOR_GRAY)
- loss |= FF_LOSS_COLORSPACE;
- break;
- default:
- /* fail safe test */
- if (ps->color_type != pf->color_type)
- loss |= FF_LOSS_COLORSPACE;
- break;
- }
- if (pf->color_type == FF_COLOR_GRAY &&
- ps->color_type != FF_COLOR_GRAY)
- loss |= FF_LOSS_CHROMA;
- if (!pf->is_alpha && (ps->is_alpha && has_alpha))
+
+ if ((src_desc->flags & PIX_FMT_RGB) != (dst_desc->flags & PIX_FMT_RGB))
+ loss |= FF_LOSS_COLORSPACE;
+
+ if (has_alpha && !(dst_desc->flags & PIX_FMT_ALPHA) &&
+ (dst_desc->flags & PIX_FMT_ALPHA))
loss |= FF_LOSS_ALPHA;
- if (pf->pixel_type == FF_PIXEL_PALETTE &&
- (ps->pixel_type != FF_PIXEL_PALETTE && ps->color_type != FF_COLOR_GRAY))
- loss |= FF_LOSS_COLORQUANT;
- return loss;
-}
-static int avg_bits_per_pixel(enum PixelFormat pix_fmt)
-{
- int bits;
- const PixFmtInfo *pf;
- const AVPixFmtDescriptor *desc = &av_pix_fmt_descriptors[pix_fmt];
+ if (dst_pix_fmt == AV_PIX_FMT_PAL8 && !is_gray(src_desc))
+ return loss | FF_LOSS_COLORQUANT;
- pf = &pix_fmt_info[pix_fmt];
- switch(pf->pixel_type) {
- case FF_PIXEL_PACKED:
- switch(pix_fmt) {
- case PIX_FMT_YUYV422:
- case PIX_FMT_UYVY422:
- case PIX_FMT_RGB565BE:
- case PIX_FMT_RGB565LE:
- case PIX_FMT_RGB555BE:
- case PIX_FMT_RGB555LE:
- case PIX_FMT_RGB444BE:
- case PIX_FMT_RGB444LE:
- case PIX_FMT_BGR565BE:
- case PIX_FMT_BGR565LE:
- case PIX_FMT_BGR555BE:
- case PIX_FMT_BGR555LE:
- case PIX_FMT_BGR444BE:
- case PIX_FMT_BGR444LE:
- bits = 16;
- break;
- case PIX_FMT_UYYVYY411:
- bits = 12;
- break;
- default:
- bits = pf->depth * pf->nb_channels;
- break;
- }
- break;
- case FF_PIXEL_PLANAR:
- if (desc->log2_chroma_w == 0 && desc->log2_chroma_h == 0) {
- bits = pf->depth * pf->nb_channels;
- } else {
- bits = pf->depth + ((2 * pf->depth) >>
- (desc->log2_chroma_w + desc->log2_chroma_h));
- }
- break;
- case FF_PIXEL_PALETTE:
- bits = 8;
- break;
- default:
- bits = -1;
- break;
- }
- return bits;
+ if (src_desc->nb_components > dst_desc->nb_components)
+ if (is_gray(dst_desc))
+ loss |= FF_LOSS_CHROMA;
+
+ return loss;
}
-static enum PixelFormat avcodec_find_best_pix_fmt1(int64_t pix_fmt_mask,
- enum PixelFormat src_pix_fmt,
+static enum AVPixelFormat avcodec_find_best_pix_fmt1(enum AVPixelFormat *pix_fmt_list,
+ enum AVPixelFormat src_pix_fmt,
int has_alpha,
int loss_mask)
{
int dist, i, loss, min_dist;
- enum PixelFormat dst_pix_fmt;
+ enum AVPixelFormat dst_pix_fmt;
/* find exact color match with smallest size */
- dst_pix_fmt = PIX_FMT_NONE;
+ dst_pix_fmt = AV_PIX_FMT_NONE;
min_dist = 0x7fffffff;
- /* test only the first 64 pixel formats to avoid undefined behaviour */
- for (i = 0; i < 64; i++) {
- if (pix_fmt_mask & (1ULL << i)) {
- loss = avcodec_get_pix_fmt_loss(i, src_pix_fmt, has_alpha) & loss_mask;
- if (loss == 0) {
- dist = avg_bits_per_pixel(i);
- if (dist < min_dist) {
- min_dist = dist;
- dst_pix_fmt = i;
- }
+ i = 0;
+ while (pix_fmt_list[i] != AV_PIX_FMT_NONE) {
+ enum AVPixelFormat pix_fmt = pix_fmt_list[i];
+
+ if (i > AV_PIX_FMT_NB) {
+ av_log(NULL, AV_LOG_ERROR, "Pixel format list longer than expected, "
+ "it is either not properly terminated or contains duplicates\n");
+ return AV_PIX_FMT_NONE;
+ }
+
+ loss = avcodec_get_pix_fmt_loss(pix_fmt, src_pix_fmt, has_alpha) & loss_mask;
+ if (loss == 0) {
+ dist = av_get_bits_per_pixel(av_pix_fmt_desc_get(pix_fmt));
+ if (dist < min_dist) {
+ min_dist = dist;
+ dst_pix_fmt = pix_fmt;
}
}
+ i++;
}
return dst_pix_fmt;
}
-enum PixelFormat avcodec_find_best_pix_fmt(int64_t pix_fmt_mask, enum PixelFormat src_pix_fmt,
+#if FF_API_FIND_BEST_PIX_FMT
+enum AVPixelFormat avcodec_find_best_pix_fmt(int64_t pix_fmt_mask, enum AVPixelFormat src_pix_fmt,
int has_alpha, int *loss_ptr)
{
- enum PixelFormat dst_pix_fmt;
+ enum AVPixelFormat list[64];
+ int i, j = 0;
+
+ // test only the first 64 pixel formats to avoid undefined behaviour
+ for (i = 0; i < 64; i++) {
+ if (pix_fmt_mask & (1ULL << i))
+ list[j++] = i;
+ }
+ list[j] = AV_PIX_FMT_NONE;
+
+ return avcodec_find_best_pix_fmt2(list, src_pix_fmt, has_alpha, loss_ptr);
+}
+#endif /* FF_API_FIND_BEST_PIX_FMT */
+
+enum AVPixelFormat avcodec_find_best_pix_fmt2(enum AVPixelFormat *pix_fmt_list,
+ enum AVPixelFormat src_pix_fmt,
+ int has_alpha, int *loss_ptr)
+{
+ enum AVPixelFormat dst_pix_fmt;
int loss_mask, i;
static const int loss_mask_order[] = {
~0, /* no loss first */
@@ -647,27 +174,20 @@ enum PixelFormat avcodec_find_best_pix_fmt(int64_t pix_fmt_mask, enum PixelForma
i = 0;
for(;;) {
loss_mask = loss_mask_order[i++];
- dst_pix_fmt = avcodec_find_best_pix_fmt1(pix_fmt_mask, src_pix_fmt,
+ dst_pix_fmt = avcodec_find_best_pix_fmt1(pix_fmt_list, src_pix_fmt,
has_alpha, loss_mask);
if (dst_pix_fmt >= 0)
goto found;
if (loss_mask == 0)
break;
}
- return PIX_FMT_NONE;
+ return AV_PIX_FMT_NONE;
found:
if (loss_ptr)
*loss_ptr = avcodec_get_pix_fmt_loss(dst_pix_fmt, src_pix_fmt, has_alpha);
return dst_pix_fmt;
}
-void av_picture_copy(AVPicture *dst, const AVPicture *src,
- enum PixelFormat pix_fmt, int width, int height)
-{
- av_image_copy(dst->data, dst->linesize, src->data,
- src->linesize, pix_fmt, width, height);
-}
-
/* 2x2 -> 1x1 */
void ff_shrink22(uint8_t *dst, int dst_wrap,
const uint8_t *src, int src_wrap,
@@ -754,44 +274,25 @@ void ff_shrink88(uint8_t *dst, int dst_wrap,
}
}
-
-int avpicture_alloc(AVPicture *picture,
- enum PixelFormat pix_fmt, int width, int height)
-{
- int ret;
-
- if ((ret = av_image_alloc(picture->data, picture->linesize, width, height, pix_fmt, 1)) < 0) {
- memset(picture, 0, sizeof(AVPicture));
- return ret;
- }
-
- return 0;
-}
-
-void avpicture_free(AVPicture *picture)
-{
- av_free(picture->data[0]);
-}
-
/* return true if yuv planar */
-static inline int is_yuv_planar(const PixFmtInfo *ps)
+static inline int is_yuv_planar(const AVPixFmtDescriptor *desc)
{
- return (ps->color_type == FF_COLOR_YUV ||
- ps->color_type == FF_COLOR_YUV_JPEG) &&
- ps->pixel_type == FF_PIXEL_PLANAR;
+ return (!(desc->flags & PIX_FMT_RGB) &&
+ (desc->flags & PIX_FMT_PLANAR));
}
int av_picture_crop(AVPicture *dst, const AVPicture *src,
- enum PixelFormat pix_fmt, int top_band, int left_band)
+ enum AVPixelFormat pix_fmt, int top_band, int left_band)
{
+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
int y_shift;
int x_shift;
- if (pix_fmt < 0 || pix_fmt >= PIX_FMT_NB || !is_yuv_planar(&pix_fmt_info[pix_fmt]))
+ if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB || !is_yuv_planar(desc))
return -1;
- y_shift = av_pix_fmt_descriptors[pix_fmt].log2_chroma_h;
- x_shift = av_pix_fmt_descriptors[pix_fmt].log2_chroma_w;
+ y_shift = desc->log2_chroma_h;
+ x_shift = desc->log2_chroma_w;
dst->data[0] = src->data[0] + (top_band * src->linesize[0]) + left_band;
dst->data[1] = src->data[1] + ((top_band >> y_shift) * src->linesize[1]) + (left_band >> x_shift);
@@ -804,21 +305,22 @@ int av_picture_crop(AVPicture *dst, const AVPicture *src,
}
int av_picture_pad(AVPicture *dst, const AVPicture *src, int height, int width,
- enum PixelFormat pix_fmt, int padtop, int padbottom, int padleft, int padright,
+ enum AVPixelFormat pix_fmt, int padtop, int padbottom, int padleft, int padright,
int *color)
{
+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
uint8_t *optr;
int y_shift;
int x_shift;
int yheight;
int i, y;
- if (pix_fmt < 0 || pix_fmt >= PIX_FMT_NB ||
- !is_yuv_planar(&pix_fmt_info[pix_fmt])) return -1;
+ if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB ||
+ !is_yuv_planar(desc)) return -1;
for (i = 0; i < 3; i++) {
- x_shift = i ? av_pix_fmt_descriptors[pix_fmt].log2_chroma_w : 0;
- y_shift = i ? av_pix_fmt_descriptors[pix_fmt].log2_chroma_h : 0;
+ x_shift = i ? desc->log2_chroma_w : 0;
+ y_shift = i ? desc->log2_chroma_h : 0;
if (padtop || padleft) {
memset(dst->data[i], color[i],
@@ -863,56 +365,7 @@ int av_picture_pad(AVPicture *dst, const AVPicture *src, int height, int width,
return 0;
}
-#if FF_API_GET_ALPHA_INFO
-/* NOTE: we scan all the pixels to have an exact information */
-static int get_alpha_info_pal8(const AVPicture *src, int width, int height)
-{
- const unsigned char *p;
- int src_wrap, ret, x, y;
- unsigned int a;
- uint32_t *palette = (uint32_t *)src->data[1];
-
- p = src->data[0];
- src_wrap = src->linesize[0] - width;
- ret = 0;
- for(y=0;y<height;y++) {
- for(x=0;x<width;x++) {
- a = palette[p[0]] >> 24;
- if (a == 0x00) {
- ret |= FF_ALPHA_TRANSP;
- } else if (a != 0xff) {
- ret |= FF_ALPHA_SEMI_TRANSP;
- }
- p++;
- }
- p += src_wrap;
- }
- return ret;
-}
-
-int img_get_alpha_info(const AVPicture *src,
- enum PixelFormat pix_fmt, int width, int height)
-{
- const PixFmtInfo *pf = &pix_fmt_info[pix_fmt];
- int ret;
-
- /* no alpha can be represented in format */
- if (!pf->is_alpha)
- return 0;
- switch(pix_fmt) {
- case PIX_FMT_PAL8:
- ret = get_alpha_info_pal8(src, width, height);
- break;
- default:
- /* we do not know, so everything is indicated */
- ret = FF_ALPHA_TRANSP | FF_ALPHA_SEMI_TRANSP;
- break;
- }
- return ret;
-}
-#endif
-
-#if !(HAVE_MMX && HAVE_YASM)
+#if !HAVE_MMX_EXTERNAL
/* filter parameters: [-1 4 2 4 -1] // 8 */
static void deinterlace_line_c(uint8_t *dst,
const uint8_t *lum_m4, const uint8_t *lum_m3,
@@ -961,7 +414,7 @@ static void deinterlace_line_inplace_c(uint8_t *lum_m4, uint8_t *lum_m3,
lum++;
}
}
-#endif
+#endif /* !HAVE_MMX_EXTERNAL */
/* deinterlacing : 2 temporal taps, 3 spatial taps linear filter. The
top field is copied as is, but the bottom field is deinterlaced
@@ -1021,17 +474,17 @@ static void deinterlace_bottom_field_inplace(uint8_t *src1, int src_wrap,
}
int avpicture_deinterlace(AVPicture *dst, const AVPicture *src,
- enum PixelFormat pix_fmt, int width, int height)
+ enum AVPixelFormat pix_fmt, int width, int height)
{
int i;
- if (pix_fmt != PIX_FMT_YUV420P &&
- pix_fmt != PIX_FMT_YUVJ420P &&
- pix_fmt != PIX_FMT_YUV422P &&
- pix_fmt != PIX_FMT_YUVJ422P &&
- pix_fmt != PIX_FMT_YUV444P &&
- pix_fmt != PIX_FMT_YUV411P &&
- pix_fmt != PIX_FMT_GRAY8)
+ if (pix_fmt != AV_PIX_FMT_YUV420P &&
+ pix_fmt != AV_PIX_FMT_YUVJ420P &&
+ pix_fmt != AV_PIX_FMT_YUV422P &&
+ pix_fmt != AV_PIX_FMT_YUVJ422P &&
+ pix_fmt != AV_PIX_FMT_YUV444P &&
+ pix_fmt != AV_PIX_FMT_YUV411P &&
+ pix_fmt != AV_PIX_FMT_GRAY8)
return -1;
if ((width & 3) != 0 || (height & 3) != 0)
return -1;
@@ -1039,22 +492,22 @@ int avpicture_deinterlace(AVPicture *dst, const AVPicture *src,
for(i=0;i<3;i++) {
if (i == 1) {
switch(pix_fmt) {
- case PIX_FMT_YUVJ420P:
- case PIX_FMT_YUV420P:
+ case AV_PIX_FMT_YUVJ420P:
+ case AV_PIX_FMT_YUV420P:
width >>= 1;
height >>= 1;
break;
- case PIX_FMT_YUV422P:
- case PIX_FMT_YUVJ422P:
+ case AV_PIX_FMT_YUV422P:
+ case AV_PIX_FMT_YUVJ422P:
width >>= 1;
break;
- case PIX_FMT_YUV411P:
+ case AV_PIX_FMT_YUV411P:
width >>= 2;
break;
default:
break;
}
- if (pix_fmt == PIX_FMT_GRAY8) {
+ if (pix_fmt == AV_PIX_FMT_GRAY8) {
break;
}
}
@@ -1070,4 +523,3 @@ int avpicture_deinterlace(AVPicture *dst, const AVPicture *src,
emms_c();
return 0;
}
-
diff --git a/gst-libs/ext/libav/libavcodec/imgconvert.h b/gst-libs/ext/libav/libavcodec/imgconvert.h
deleted file mode 100644
index c99e587..0000000
--- a/gst-libs/ext/libav/libavcodec/imgconvert.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Misc image conversion routines
- * most functionality is exported to the public API, see avcodec.h
- *
- * Copyright (c) 2008 Vitor Sessak
- *
- * 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
- */
-
-#ifndef AVCODEC_IMGCONVERT_H
-#define AVCODEC_IMGCONVERT_H
-
-#include <stdint.h>
-#include "avcodec.h"
-
-#if LIBAVCODEC_VERSION_MAJOR < 53
-attribute_deprecated
-int ff_fill_linesize(AVPicture *picture, enum PixelFormat pix_fmt, int width);
-
-attribute_deprecated
-int ff_fill_pointer(AVPicture *picture, uint8_t *ptr, enum PixelFormat pix_fmt, int height);
-
-attribute_deprecated
-int ff_get_plane_bytewidth(enum PixelFormat pix_fmt, int width, int plane);
-
-attribute_deprecated
-int ff_set_systematic_pal(uint32_t pal[256], enum PixelFormat pix_fmt);
-#endif
-
-#endif /* AVCODEC_IMGCONVERT_H */
diff --git a/gst-libs/ext/libav/libavcodec/imx_dump_header_bsf.c b/gst-libs/ext/libav/libavcodec/imx_dump_header_bsf.c
index 3724daf..5f5493f 100644
--- a/gst-libs/ext/libav/libavcodec/imx_dump_header_bsf.c
+++ b/gst-libs/ext/libav/libavcodec/imx_dump_header_bsf.c
@@ -37,7 +37,7 @@ static int imx_dump_header(AVBitStreamFilterContext *bsfc, AVCodecContext *avctx
static const uint8_t imx_header[16] = { 0x06,0x0e,0x2b,0x34,0x01,0x02,0x01,0x01,0x0d,0x01,0x03,0x01,0x05,0x01,0x01,0x00 };
uint8_t *poutbufp;
- if (avctx->codec_id != CODEC_ID_MPEG2VIDEO) {
+ if (avctx->codec_id != AV_CODEC_ID_MPEG2VIDEO) {
av_log(avctx, AV_LOG_ERROR, "imx bitstream filter only applies to mpeg2video codec\n");
return 0;
}
diff --git a/gst-libs/ext/libav/libavcodec/indeo2.c b/gst-libs/ext/libav/libavcodec/indeo2.c
index ecf89cc..1dd151d 100644
--- a/gst-libs/ext/libav/libavcodec/indeo2.c
+++ b/gst-libs/ext/libav/libavcodec/indeo2.c
@@ -23,11 +23,13 @@
* @file
* Intel Indeo 2 decoder.
*/
+
#define BITSTREAM_READER_LE
+#include "libavutil/attributes.h"
#include "avcodec.h"
#include "get_bits.h"
#include "indeo2data.h"
-#include "libavutil/common.h"
+#include "mathops.h"
typedef struct Ir2Context{
AVCodecContext *avctx;
@@ -136,14 +138,14 @@ static int ir2_decode_plane_inter(Ir2Context *ctx, int width, int height, uint8_
}
static int ir2_decode_frame(AVCodecContext *avctx,
- void *data, int *data_size,
+ void *data, int *got_frame,
AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
Ir2Context * const s = avctx->priv_data;
AVFrame *picture = data;
- AVFrame * const p= (AVFrame*)&s->picture;
+ AVFrame * const p = &s->picture;
int start;
if(p->data[0])
@@ -168,7 +170,7 @@ static int ir2_decode_frame(AVCodecContext *avctx,
/* decide whether frame uses deltas or not */
#ifndef BITSTREAM_READER_LE
for (i = 0; i < buf_size; i++)
- buf[i] = av_reverse[buf[i]];
+ buf[i] = ff_reverse[buf[i]];
#endif
init_get_bits(&s->gb, buf + start, (buf_size - start) * 8);
@@ -191,8 +193,8 @@ static int ir2_decode_frame(AVCodecContext *avctx,
s->picture.data[1], s->picture.linesize[1], ir2_luma_table);
}
- *picture= *(AVFrame*)&s->picture;
- *data_size = sizeof(AVPicture);
+ *picture = s->picture;
+ *got_frame = 1;
return buf_size;
}
@@ -203,7 +205,7 @@ static av_cold int ir2_decode_init(AVCodecContext *avctx){
ic->avctx = avctx;
- avctx->pix_fmt= PIX_FMT_YUV410P;
+ avctx->pix_fmt= AV_PIX_FMT_YUV410P;
ir2_vlc.table = vlc_tables;
ir2_vlc.table_allocated = 1 << CODE_VLC_BITS;
@@ -233,11 +235,11 @@ static av_cold int ir2_decode_end(AVCodecContext *avctx){
AVCodec ff_indeo2_decoder = {
.name = "indeo2",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_INDEO2,
+ .id = AV_CODEC_ID_INDEO2,
.priv_data_size = sizeof(Ir2Context),
.init = ir2_decode_init,
.close = ir2_decode_end,
.decode = ir2_decode_frame,
.capabilities = CODEC_CAP_DR1,
- .long_name = NULL_IF_CONFIG_SMALL("Intel Indeo 2"),
+ .long_name = NULL_IF_CONFIG_SMALL("Intel Indeo 2"),
};
diff --git a/gst-libs/ext/libav/libavcodec/indeo3.c b/gst-libs/ext/libav/libavcodec/indeo3.c
index 9e90fb1..81bf0a9 100644
--- a/gst-libs/ext/libav/libavcodec/indeo3.c
+++ b/gst-libs/ext/libav/libavcodec/indeo3.c
@@ -35,6 +35,7 @@
#include "dsputil.h"
#include "bytestream.h"
#include "get_bits.h"
+#include "internal.h"
#include "indeo3data.h"
@@ -276,10 +277,10 @@ static int copy_cell(Indeo3DecodeContext *ctx, Plane *plane, Cell *cell)
/* Average 4/8 pixels at once without rounding using SWAR */
#define AVG_32(dst, src, ref) \
- AV_WN32A(dst, ((AV_RN32A(src) + AV_RN32A(ref)) >> 1) & 0x7F7F7F7FUL)
+ AV_WN32A(dst, ((AV_RN32(src) + AV_RN32(ref)) >> 1) & 0x7F7F7F7FUL)
#define AVG_64(dst, src, ref) \
- AV_WN64A(dst, ((AV_RN64A(src) + AV_RN64A(ref)) >> 1) & 0x7F7F7F7F7F7F7F7FULL)
+ AV_WN64A(dst, ((AV_RN64(src) + AV_RN64(ref)) >> 1) & 0x7F7F7F7F7F7F7F7FULL)
/*
@@ -338,7 +339,7 @@ if (*data_ptr >= last_ptr) \
copy_block4(dst, ref, row_offset, row_offset, 4 << v_zoom)
#define RLE_BLOCK_COPY_8 \
- pix64 = AV_RN64A(ref);\
+ pix64 = AV_RN64(ref);\
if (is_first_row) {/* special prediction case: top line of a cell */\
pix64 = replicate64(pix64);\
fill_64(dst + row_offset, pix64, 7, row_offset);\
@@ -350,7 +351,7 @@ if (*data_ptr >= last_ptr) \
copy_block4(dst, ref, row_offset, row_offset, num_lines << v_zoom)
#define RLE_LINES_COPY_M10 \
- pix64 = AV_RN64A(ref);\
+ pix64 = AV_RN64(ref);\
if (is_top_of_cell) {\
pix64 = replicate64(pix64);\
fill_64(dst + row_offset, pix64, (num_lines << 1) - 1, row_offset);\
@@ -360,12 +361,12 @@ if (*data_ptr >= last_ptr) \
#define APPLY_DELTA_4 \
AV_WN16A(dst + line_offset ,\
- (AV_RN16A(ref ) + delta_tab->deltas[dyad1]) & 0x7F7F);\
+ (AV_RN16(ref ) + delta_tab->deltas[dyad1]) & 0x7F7F);\
AV_WN16A(dst + line_offset + 2,\
- (AV_RN16A(ref + 2) + delta_tab->deltas[dyad2]) & 0x7F7F);\
+ (AV_RN16(ref + 2) + delta_tab->deltas[dyad2]) & 0x7F7F);\
if (mode >= 3) {\
if (is_top_of_cell && !cell->ypos) {\
- AV_COPY32(dst, dst + row_offset);\
+ AV_COPY32U(dst, dst + row_offset);\
} else {\
AVG_32(dst, ref, dst + row_offset);\
}\
@@ -375,20 +376,20 @@ if (*data_ptr >= last_ptr) \
/* apply two 32-bit VQ deltas to next even line */\
if (is_top_of_cell) { \
AV_WN32A(dst + row_offset , \
- (replicate32(AV_RN32A(ref )) + delta_tab->deltas_m10[dyad1]) & 0x7F7F7F7F);\
+ (replicate32(AV_RN32(ref )) + delta_tab->deltas_m10[dyad1]) & 0x7F7F7F7F);\
AV_WN32A(dst + row_offset + 4, \
- (replicate32(AV_RN32A(ref + 4)) + delta_tab->deltas_m10[dyad2]) & 0x7F7F7F7F);\
+ (replicate32(AV_RN32(ref + 4)) + delta_tab->deltas_m10[dyad2]) & 0x7F7F7F7F);\
} else { \
AV_WN32A(dst + row_offset , \
- (AV_RN32A(ref ) + delta_tab->deltas_m10[dyad1]) & 0x7F7F7F7F);\
+ (AV_RN32(ref ) + delta_tab->deltas_m10[dyad1]) & 0x7F7F7F7F);\
AV_WN32A(dst + row_offset + 4, \
- (AV_RN32A(ref + 4) + delta_tab->deltas_m10[dyad2]) & 0x7F7F7F7F);\
+ (AV_RN32(ref + 4) + delta_tab->deltas_m10[dyad2]) & 0x7F7F7F7F);\
} \
/* odd lines are not coded but rather interpolated/replicated */\
/* first line of the cell on the top of image? - replicate */\
/* otherwise - interpolate */\
if (is_top_of_cell && !cell->ypos) {\
- AV_COPY64(dst, dst + row_offset);\
+ AV_COPY64U(dst, dst + row_offset);\
} else \
AVG_64(dst, ref, dst + row_offset);
@@ -396,22 +397,22 @@ if (*data_ptr >= last_ptr) \
#define APPLY_DELTA_1011_INTER \
if (mode == 10) { \
AV_WN32A(dst , \
- (AV_RN32A(dst ) + delta_tab->deltas_m10[dyad1]) & 0x7F7F7F7F);\
+ (AV_RN32(dst ) + delta_tab->deltas_m10[dyad1]) & 0x7F7F7F7F);\
AV_WN32A(dst + 4 , \
- (AV_RN32A(dst + 4 ) + delta_tab->deltas_m10[dyad2]) & 0x7F7F7F7F);\
+ (AV_RN32(dst + 4 ) + delta_tab->deltas_m10[dyad2]) & 0x7F7F7F7F);\
AV_WN32A(dst + row_offset , \
- (AV_RN32A(dst + row_offset ) + delta_tab->deltas_m10[dyad1]) & 0x7F7F7F7F);\
+ (AV_RN32(dst + row_offset ) + delta_tab->deltas_m10[dyad1]) & 0x7F7F7F7F);\
AV_WN32A(dst + row_offset + 4, \
- (AV_RN32A(dst + row_offset + 4) + delta_tab->deltas_m10[dyad2]) & 0x7F7F7F7F);\
+ (AV_RN32(dst + row_offset + 4) + delta_tab->deltas_m10[dyad2]) & 0x7F7F7F7F);\
} else { \
AV_WN16A(dst , \
- (AV_RN16A(dst ) + delta_tab->deltas[dyad1]) & 0x7F7F);\
+ (AV_RN16(dst ) + delta_tab->deltas[dyad1]) & 0x7F7F);\
AV_WN16A(dst + 2 , \
- (AV_RN16A(dst + 2 ) + delta_tab->deltas[dyad2]) & 0x7F7F);\
+ (AV_RN16(dst + 2 ) + delta_tab->deltas[dyad2]) & 0x7F7F);\
AV_WN16A(dst + row_offset , \
- (AV_RN16A(dst + row_offset ) + delta_tab->deltas[dyad1]) & 0x7F7F);\
+ (AV_RN16(dst + row_offset ) + delta_tab->deltas[dyad1]) & 0x7F7F);\
AV_WN16A(dst + row_offset + 2, \
- (AV_RN16A(dst + row_offset + 2) + delta_tab->deltas[dyad2]) & 0x7F7F);\
+ (AV_RN16(dst + row_offset + 2) + delta_tab->deltas[dyad2]) & 0x7F7F);\
}
@@ -805,12 +806,12 @@ static int parse_bintree(Indeo3DecodeContext *ctx, AVCodecContext *avctx,
/* get motion vector index and setup the pointer to the mv set */
if (!ctx->need_resync)
ctx->next_cell_data = &ctx->gb.buffer[(get_bits_count(&ctx->gb) + 7) >> 3];
- mv_idx = *(ctx->next_cell_data++) << 1;
+ mv_idx = *(ctx->next_cell_data++);
if (mv_idx >= ctx->num_vectors) {
av_log(avctx, AV_LOG_ERROR, "motion vector index out of range\n");
return AVERROR_INVALIDDATA;
}
- curr_cell.mv_ptr = &ctx->mc_vectors[mv_idx];
+ curr_cell.mv_ptr = &ctx->mc_vectors[mv_idx << 1];
curr_cell.tree = 1; /* enter the VQ tree */
UPDATE_BITPOS(8);
} else { /* VQ tree DATA code */
@@ -1006,14 +1007,17 @@ static int decode_frame_headers(Indeo3DecodeContext *ctx, AVCodecContext *avctx,
* @param[in] buf_sel indicates which frame buffer the input data stored in
* @param[out] dst pointer to the buffer receiving converted pixels
* @param[in] dst_pitch pitch for moving to the next y line
+ * @param[in] dst_height output plane height
*/
-static void output_plane(const Plane *plane, int buf_sel, uint8_t *dst, int dst_pitch)
+static void output_plane(const Plane *plane, int buf_sel, uint8_t *dst,
+ int dst_pitch, int dst_height)
{
int x,y;
const uint8_t *src = plane->pixels[buf_sel];
uint32_t pitch = plane->pitch;
- for (y = 0; y < plane->height; y++) {
+ dst_height = FFMIN(dst_height, plane->height);
+ for (y = 0; y < dst_height; y++) {
/* convert four pixels at once using SWAR */
for (x = 0; x < plane->width >> 2; x++) {
AV_WN32A(dst, (AV_RN32A(src) & 0x7F7F7F7F) << 1);
@@ -1037,11 +1041,11 @@ static av_cold int decode_init(AVCodecContext *avctx)
ctx->avctx = avctx;
ctx->width = avctx->width;
ctx->height = avctx->height;
- avctx->pix_fmt = PIX_FMT_YUV410P;
+ avctx->pix_fmt = AV_PIX_FMT_YUV410P;
build_requant_tab();
- dsputil_init(&ctx->dsp, avctx);
+ ff_dsputil_init(&ctx->dsp, avctx);
allocate_frame_buffers(ctx, avctx);
@@ -1049,7 +1053,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
}
-static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
+static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
AVPacket *avpkt)
{
Indeo3DecodeContext *ctx = avctx->priv_data;
@@ -1064,7 +1068,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
/* skip sync(null) frames */
if (res) {
// we have processed 16 bytes but no data was decoded
- *data_size = 0;
+ *got_frame = 0;
return buf_size;
}
@@ -1095,16 +1099,22 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
avctx->release_buffer(avctx, &ctx->frame);
ctx->frame.reference = 0;
- if ((res = avctx->get_buffer(avctx, &ctx->frame)) < 0) {
+ if ((res = ff_get_buffer(avctx, &ctx->frame)) < 0) {
av_log(ctx->avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return res;
}
- output_plane(&ctx->planes[0], ctx->buf_sel, ctx->frame.data[0], ctx->frame.linesize[0]);
- output_plane(&ctx->planes[1], ctx->buf_sel, ctx->frame.data[1], ctx->frame.linesize[1]);
- output_plane(&ctx->planes[2], ctx->buf_sel, ctx->frame.data[2], ctx->frame.linesize[2]);
-
- *data_size = sizeof(AVFrame);
+ output_plane(&ctx->planes[0], ctx->buf_sel,
+ ctx->frame.data[0], ctx->frame.linesize[0],
+ avctx->height);
+ output_plane(&ctx->planes[1], ctx->buf_sel,
+ ctx->frame.data[1], ctx->frame.linesize[1],
+ (avctx->height + 3) >> 2);
+ output_plane(&ctx->planes[2], ctx->buf_sel,
+ ctx->frame.data[2], ctx->frame.linesize[2],
+ (avctx->height + 3) >> 2);
+
+ *got_frame = 1;
*(AVFrame*)data = ctx->frame;
return buf_size;
@@ -1126,10 +1136,11 @@ static av_cold int decode_close(AVCodecContext *avctx)
AVCodec ff_indeo3_decoder = {
.name = "indeo3",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_INDEO3,
+ .id = AV_CODEC_ID_INDEO3,
.priv_data_size = sizeof(Indeo3DecodeContext),
.init = decode_init,
.close = decode_close,
.decode = decode_frame,
+ .capabilities = CODEC_CAP_DR1,
.long_name = NULL_IF_CONFIG_SMALL("Intel Indeo 3"),
};
diff --git a/gst-libs/ext/libav/libavcodec/indeo3data.h b/gst-libs/ext/libav/libavcodec/indeo3data.h
index 6bb55ce..28c9bb6 100644
--- a/gst-libs/ext/libav/libavcodec/indeo3data.h
+++ b/gst-libs/ext/libav/libavcodec/indeo3data.h
@@ -235,7 +235,7 @@
/**
* Pack two delta values (a,b) into one 16bit word
- * according with endianess of the host machine.
+ * according with endianness of the host machine.
*/
#if HAVE_BIGENDIAN
#define PD(a,b) (((a) << 8) + (b))
@@ -247,8 +247,8 @@
* Expand a pair of delta values (a,b)
* into two/four delta entries.
*/
-#define E2(a, b) PD(a, b), PD(-a, -b)
-#define E4(a, b) PD(a, b), PD(-a, -b), PD(b, a), PD(-b, -a)
+#define E2(a, b) PD(a, b), PD(-(a), -(b))
+#define E4(a, b) PD(a, b), PD(-(a), -(b)), PD(b, a), PD(-(b), -(a))
/*
* VQ tables for 4x4 block modes.
@@ -282,7 +282,7 @@ static const int16_t delta_tab_3_5[79] = { TAB_3_5 };
/**
* Pack four delta values (a,a,b,b) into one 32bit word
- * according with endianess of the host machine.
+ * according with endianness of the host machine.
*/
#if HAVE_BIGENDIAN
#define PD(a,b) (((a) << 24) + ((a) << 16) + ((b) << 8) + (b))
@@ -320,7 +320,7 @@ static const int32_t delta_tab_3_4_m10[79] = { TAB_3_4 };
static const int32_t delta_tab_3_5_m10[79] = { TAB_3_5 };
-typedef struct {
+typedef struct vqEntry {
const int16_t *deltas; ///< delta tables for 4x4 block modes
const int32_t *deltas_m10; ///< delta tables for 8x8 block modes
uint8_t num_dyads; ///< number of two-pixel deltas
diff --git a/gst-libs/ext/libav/libavcodec/indeo4.c b/gst-libs/ext/libav/libavcodec/indeo4.c
index c8ee0be..2eebc26 100644
--- a/gst-libs/ext/libav/libavcodec/indeo4.c
+++ b/gst-libs/ext/libav/libavcodec/indeo4.c
@@ -40,7 +40,7 @@
*/
enum {
FRAMETYPE_INTRA = 0,
- FRAMETYPE_BIDIR1 = 1, ///< bidirectional frame
+ FRAMETYPE_INTRA1 = 1, ///< intra frame with slightly different bitstream coding
FRAMETYPE_INTER = 2, ///< non-droppable P-frame
FRAMETYPE_BIDIR = 3, ///< bidirectional frame
FRAMETYPE_INTER_NOREF = 4, ///< droppable P-frame
@@ -133,8 +133,7 @@ static int decode_pic_hdr(IVI45DecContext *ctx, AVCodecContext *avctx)
}
#if IVI4_STREAM_ANALYSER
- if ( ctx->frame_type == FRAMETYPE_BIDIR1
- || ctx->frame_type == FRAMETYPE_BIDIR)
+ if (ctx->frame_type == FRAMETYPE_BIDIR)
ctx->has_b_frames = 1;
#endif
@@ -471,7 +470,8 @@ static int decode_mb_info(IVI45DecContext *ctx, IVIBandDesc *band,
} else {
if (band->inherit_mv) {
mb->type = ref_mb->type; /* copy mb_type from corresponding reference mb */
- } else if (ctx->frame_type == FRAMETYPE_INTRA) {
+ } else if (ctx->frame_type == FRAMETYPE_INTRA ||
+ ctx->frame_type == FRAMETYPE_INTRA1) {
mb->type = 0; /* mb_type is always INTRA for intra-frames */
} else {
mb->type = get_bits(&ctx->gb, mb_type_bits);
@@ -539,6 +539,7 @@ static void switch_buffers(IVI45DecContext *ctx)
{
switch (ctx->prev_frame_type) {
case FRAMETYPE_INTRA:
+ case FRAMETYPE_INTRA1:
case FRAMETYPE_INTER:
ctx->buf_switch ^= 1;
ctx->dst_buf = ctx->buf_switch;
@@ -550,6 +551,7 @@ static void switch_buffers(IVI45DecContext *ctx)
switch (ctx->frame_type) {
case FRAMETYPE_INTRA:
+ case FRAMETYPE_INTRA1:
ctx->buf_switch = 0;
/* FALLTHROUGH */
case FRAMETYPE_INTER:
@@ -584,7 +586,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
ctx->pic_conf.pic_width = 0;
ctx->pic_conf.pic_height = 0;
- avctx->pix_fmt = PIX_FMT_YUV410P;
+ avctx->pix_fmt = AV_PIX_FMT_YUV410P;
ctx->decode_pic_hdr = decode_pic_hdr;
ctx->decode_band_hdr = decode_band_hdr;
@@ -599,10 +601,11 @@ static av_cold int decode_init(AVCodecContext *avctx)
AVCodec ff_indeo4_decoder = {
.name = "indeo4",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_INDEO4,
+ .id = AV_CODEC_ID_INDEO4,
.priv_data_size = sizeof(IVI45DecContext),
.init = decode_init,
.close = ff_ivi_decode_close,
.decode = ff_ivi_decode_frame,
.long_name = NULL_IF_CONFIG_SMALL("Intel Indeo Video Interactive 4"),
+ .capabilities = CODEC_CAP_DR1,
};
diff --git a/gst-libs/ext/libav/libavcodec/indeo5.c b/gst-libs/ext/libav/libavcodec/indeo5.c
index 987b1a3..dc5f6f0 100644
--- a/gst-libs/ext/libav/libavcodec/indeo5.c
+++ b/gst-libs/ext/libav/libavcodec/indeo5.c
@@ -627,7 +627,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
ctx->switch_buffers = switch_buffers;
ctx->is_nonnull_frame = is_nonnull_frame;
- avctx->pix_fmt = PIX_FMT_YUV410P;
+ avctx->pix_fmt = AV_PIX_FMT_YUV410P;
return 0;
}
@@ -636,10 +636,11 @@ static av_cold int decode_init(AVCodecContext *avctx)
AVCodec ff_indeo5_decoder = {
.name = "indeo5",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_INDEO5,
+ .id = AV_CODEC_ID_INDEO5,
.priv_data_size = sizeof(IVI45DecContext),
.init = decode_init,
.close = ff_ivi_decode_close,
.decode = ff_ivi_decode_frame,
.long_name = NULL_IF_CONFIG_SMALL("Intel Indeo Video Interactive 5"),
+ .capabilities = CODEC_CAP_DR1,
};
diff --git a/gst-libs/ext/libav/libavcodec/intelh263dec.c b/gst-libs/ext/libav/libavcodec/intelh263dec.c
index 8556128..0701cde 100644
--- a/gst-libs/ext/libav/libavcodec/intelh263dec.c
+++ b/gst-libs/ext/libav/libavcodec/intelh263dec.c
@@ -127,13 +127,12 @@ int ff_intel_h263_decode_picture_header(MpegEncContext *s)
AVCodec ff_h263i_decoder = {
.name = "h263i",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_H263I,
+ .id = AV_CODEC_ID_H263I,
.priv_data_size = sizeof(MpegEncContext),
.init = ff_h263_decode_init,
.close = ff_h263_decode_end,
.decode = ff_h263_decode_frame,
.capabilities = CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1,
- .long_name = NULL_IF_CONFIG_SMALL("Intel H.263"),
- .pix_fmts= ff_pixfmt_list_420,
+ .long_name = NULL_IF_CONFIG_SMALL("Intel H.263"),
+ .pix_fmts = ff_pixfmt_list_420,
};
-
diff --git a/gst-libs/ext/libav/libavcodec/internal.h b/gst-libs/ext/libav/libavcodec/internal.h
index 441430e..069a855 100644
--- a/gst-libs/ext/libav/libavcodec/internal.h
+++ b/gst-libs/ext/libav/libavcodec/internal.h
@@ -26,19 +26,19 @@
#include <stdint.h>
+#include "libavutil/mathematics.h"
#include "libavutil/pixfmt.h"
#include "avcodec.h"
+#define FF_SANE_NB_CHANNELS 128U
+
typedef struct InternalBuffer {
uint8_t *base[AV_NUM_DATA_POINTERS];
uint8_t *data[AV_NUM_DATA_POINTERS];
int linesize[AV_NUM_DATA_POINTERS];
int width;
int height;
- enum PixelFormat pix_fmt;
- uint8_t **extended_data;
- int audio_data_size;
- int nb_channels;
+ enum AVPixelFormat pix_fmt;
} InternalBuffer;
typedef struct AVCodecInternal {
@@ -69,6 +69,18 @@ typedef struct AVCodecInternal {
*/
int sample_count;
#endif
+
+ /**
+ * An audio frame with less than required samples has been submitted and
+ * padded with silence. Reject all subsequent frames.
+ */
+ int last_audio_frame;
+
+ /**
+ * The data for the last allocated audio frame.
+ * Stored here so we can free it.
+ */
+ uint8_t *audio_data;
} AVCodecInternal;
struct AVCodecDefault {
@@ -77,11 +89,6 @@ struct AVCodecDefault {
};
/**
- * Determine whether pix_fmt is a hardware accelerated format.
- */
-int ff_is_hwaccel_pix_fmt(enum PixelFormat pix_fmt);
-
-/**
* Return the hardware accelerated codec for codec codec_id and
* pixel format pix_fmt.
*
@@ -89,7 +96,7 @@ int ff_is_hwaccel_pix_fmt(enum PixelFormat pix_fmt);
* @param pix_fmt the pixel format to match
* @return the hardware accelerated codec, or NULL if none was found.
*/
-AVHWAccel *ff_find_hwaccel(enum CodecID codec_id, enum PixelFormat pix_fmt);
+AVHWAccel *ff_find_hwaccel(enum AVCodecID codec_id, enum AVPixelFormat pix_fmt);
/**
* Return the index into tab at which {a,b} match elements {[0],[1]} of tab.
@@ -120,10 +127,28 @@ int avpriv_unlock_avformat(void);
* If avpkt->data is already set, avpkt->size is checked
* to ensure it is large enough.
* If avpkt->data is NULL, a new buffer is allocated.
+ * avpkt->size is set to the specified size.
* All other AVPacket fields will be reset with av_init_packet().
* @param size the minimum required packet size
* @return 0 on success, negative error code on failure
*/
int ff_alloc_packet(AVPacket *avpkt, int size);
+/**
+ * Rescale from sample rate to AVCodecContext.time_base.
+ */
+static av_always_inline int64_t ff_samples_to_time_base(AVCodecContext *avctx,
+ int64_t samples)
+{
+ return av_rescale_q(samples, (AVRational){ 1, avctx->sample_rate },
+ avctx->time_base);
+}
+
+/**
+ * Get a buffer for a frame. This is a wrapper around
+ * AVCodecContext.get_buffer() and should be used instead calling get_buffer()
+ * directly.
+ */
+int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame);
+
#endif /* AVCODEC_INTERNAL_H */
diff --git a/gst-libs/ext/libav/libavcodec/interplayvideo.c b/gst-libs/ext/libav/libavcodec/interplayvideo.c
index 724f5f1..3f098ac 100644
--- a/gst-libs/ext/libav/libavcodec/interplayvideo.c
+++ b/gst-libs/ext/libav/libavcodec/interplayvideo.c
@@ -43,6 +43,7 @@
#include "dsputil.h"
#define BITSTREAM_READER_LE
#include "get_bits.h"
+#include "internal.h"
#define PALETTE_COUNT 256
@@ -56,14 +57,8 @@ typedef struct IpvideoContext {
const unsigned char *decoding_map;
int decoding_map_size;
- const unsigned char *buf;
- int size;
-
int is_16bpp;
- const unsigned char *stream_ptr;
- const unsigned char *stream_end;
- const uint8_t *mv_ptr;
- const uint8_t *mv_end;
+ GetByteContext stream_ptr, mv_ptr;
unsigned char *pixel_ptr;
int line_inc;
int stride;
@@ -72,13 +67,6 @@ typedef struct IpvideoContext {
uint32_t pal[256];
} IpvideoContext;
-#define CHECK_STREAM_PTR(stream_ptr, stream_end, n) \
- if (stream_end - stream_ptr < n) { \
- av_log(s->avctx, AV_LOG_ERROR, "Interplay video warning: stream_ptr out of bounds (%p >= %p)\n", \
- stream_ptr + n, stream_end); \
- return -1; \
- }
-
static int copy_from(IpvideoContext *s, AVFrame *src, int delta_x, int delta_y)
{
int current_offset = s->pixel_ptr - s->current_frame.data[0];
@@ -118,11 +106,9 @@ static int ipvideo_decode_block_opcode_0x2(IpvideoContext *s)
/* copy block from 2 frames ago using a motion vector; need 1 more byte */
if (!s->is_16bpp) {
- CHECK_STREAM_PTR(s->stream_ptr, s->stream_end, 1);
- B = *s->stream_ptr++;
+ B = bytestream2_get_byte(&s->stream_ptr);
} else {
- CHECK_STREAM_PTR(s->mv_ptr, s->mv_end, 1);
- B = *s->mv_ptr++;
+ B = bytestream2_get_byte(&s->mv_ptr);
}
if (B < 56) {
@@ -146,11 +132,9 @@ static int ipvideo_decode_block_opcode_0x3(IpvideoContext *s)
/* need 1 more byte for motion */
if (!s->is_16bpp) {
- CHECK_STREAM_PTR(s->stream_ptr, s->stream_end, 1);
- B = *s->stream_ptr++;
+ B = bytestream2_get_byte(&s->stream_ptr);
} else {
- CHECK_STREAM_PTR(s->mv_ptr, s->mv_end, 1);
- B = *s->mv_ptr++;
+ B = bytestream2_get_byte(&s->mv_ptr);
}
if (B < 56) {
@@ -172,11 +156,9 @@ static int ipvideo_decode_block_opcode_0x4(IpvideoContext *s)
/* copy a block from the previous frame; need 1 more byte */
if (!s->is_16bpp) {
- CHECK_STREAM_PTR(s->stream_ptr, s->stream_end, 1);
- B = *s->stream_ptr++;
+ B = bytestream2_get_byte(&s->stream_ptr);
} else {
- CHECK_STREAM_PTR(s->mv_ptr, s->mv_end, 1);
- B = *s->mv_ptr++;
+ B = bytestream2_get_byte(&s->mv_ptr);
}
BL = B & 0x0F;
@@ -194,10 +176,8 @@ static int ipvideo_decode_block_opcode_0x5(IpvideoContext *s)
/* copy a block from the previous frame using an expanded range;
* need 2 more bytes */
- CHECK_STREAM_PTR(s->stream_ptr, s->stream_end, 2);
-
- x = *s->stream_ptr++;
- y = *s->stream_ptr++;
+ x = bytestream2_get_byte(&s->stream_ptr);
+ y = bytestream2_get_byte(&s->stream_ptr);
av_dlog(NULL, " motion bytes = %d, %d\n", x, y);
return copy_from(s, &s->last_frame, x, y);
@@ -219,18 +199,14 @@ static int ipvideo_decode_block_opcode_0x7(IpvideoContext *s)
unsigned int flags;
/* 2-color encoding */
- CHECK_STREAM_PTR(s->stream_ptr, s->stream_end, 2);
-
- P[0] = *s->stream_ptr++;
- P[1] = *s->stream_ptr++;
+ P[0] = bytestream2_get_byte(&s->stream_ptr);
+ P[1] = bytestream2_get_byte(&s->stream_ptr);
if (P[0] <= P[1]) {
/* need 8 more bytes from the stream */
- CHECK_STREAM_PTR(s->stream_ptr, s->stream_end, 8);
-
for (y = 0; y < 8; y++) {
- flags = *s->stream_ptr++ | 0x100;
+ flags = bytestream2_get_byte(&s->stream_ptr) | 0x100;
for (; flags != 1; flags >>= 1)
*s->pixel_ptr++ = P[flags & 1];
s->pixel_ptr += s->line_inc;
@@ -239,9 +215,7 @@ static int ipvideo_decode_block_opcode_0x7(IpvideoContext *s)
} else {
/* need 2 more bytes from the stream */
- CHECK_STREAM_PTR(s->stream_ptr, s->stream_end, 2);
-
- flags = bytestream_get_le16(&s->stream_ptr);
+ flags = bytestream2_get_le16(&s->stream_ptr);
for (y = 0; y < 8; y += 2) {
for (x = 0; x < 8; x += 2, flags >>= 1) {
s->pixel_ptr[x ] =
@@ -260,26 +234,23 @@ static int ipvideo_decode_block_opcode_0x7(IpvideoContext *s)
static int ipvideo_decode_block_opcode_0x8(IpvideoContext *s)
{
int x, y;
- unsigned char P[2];
+ unsigned char P[4];
unsigned int flags = 0;
/* 2-color encoding for each 4x4 quadrant, or 2-color encoding on
* either top and bottom or left and right halves */
- CHECK_STREAM_PTR(s->stream_ptr, s->stream_end, 2);
-
- P[0] = *s->stream_ptr++;
- P[1] = *s->stream_ptr++;
+ P[0] = bytestream2_get_byte(&s->stream_ptr);
+ P[1] = bytestream2_get_byte(&s->stream_ptr);
if (P[0] <= P[1]) {
-
- CHECK_STREAM_PTR(s->stream_ptr, s->stream_end, 14);
- s->stream_ptr -= 2;
-
for (y = 0; y < 16; y++) {
// new values for each 4x4 block
if (!(y & 3)) {
- P[0] = *s->stream_ptr++; P[1] = *s->stream_ptr++;
- flags = bytestream_get_le16(&s->stream_ptr);
+ if (y) {
+ P[0] = bytestream2_get_byte(&s->stream_ptr);
+ P[1] = bytestream2_get_byte(&s->stream_ptr);
+ }
+ flags = bytestream2_get_le16(&s->stream_ptr);
}
for (x = 0; x < 4; x++, flags >>= 1)
@@ -290,13 +261,11 @@ static int ipvideo_decode_block_opcode_0x8(IpvideoContext *s)
}
} else {
+ flags = bytestream2_get_le32(&s->stream_ptr);
+ P[2] = bytestream2_get_byte(&s->stream_ptr);
+ P[3] = bytestream2_get_byte(&s->stream_ptr);
- /* need 10 more bytes */
- CHECK_STREAM_PTR(s->stream_ptr, s->stream_end, 10);
-
- if (s->stream_ptr[4] <= s->stream_ptr[5]) {
-
- flags = bytestream_get_le32(&s->stream_ptr);
+ if (P[2] <= P[3]) {
/* vertical split; left & right halves are 2-color encoded */
@@ -307,8 +276,9 @@ static int ipvideo_decode_block_opcode_0x8(IpvideoContext *s)
// switch to right half
if (y == 7) {
s->pixel_ptr -= 8 * s->stride - 4;
- P[0] = *s->stream_ptr++; P[1] = *s->stream_ptr++;
- flags = bytestream_get_le32(&s->stream_ptr);
+ P[0] = P[2];
+ P[1] = P[3];
+ flags = bytestream2_get_le32(&s->stream_ptr);
}
}
@@ -318,12 +288,12 @@ static int ipvideo_decode_block_opcode_0x8(IpvideoContext *s)
for (y = 0; y < 8; y++) {
if (y == 4) {
- P[0] = *s->stream_ptr++;
- P[1] = *s->stream_ptr++;
+ P[0] = P[2];
+ P[1] = P[3];
+ flags = bytestream2_get_le32(&s->stream_ptr);
}
- flags = *s->stream_ptr++ | 0x100;
- for (; flags != 1; flags >>= 1)
+ for (x = 0; x < 8; x++, flags >>= 1)
*s->pixel_ptr++ = P[flags & 1];
s->pixel_ptr += s->line_inc;
}
@@ -340,20 +310,15 @@ static int ipvideo_decode_block_opcode_0x9(IpvideoContext *s)
unsigned char P[4];
/* 4-color encoding */
- CHECK_STREAM_PTR(s->stream_ptr, s->stream_end, 4);
-
- memcpy(P, s->stream_ptr, 4);
- s->stream_ptr += 4;
+ bytestream2_get_buffer(&s->stream_ptr, P, 4);
if (P[0] <= P[1]) {
if (P[2] <= P[3]) {
/* 1 of 4 colors for each pixel, need 16 more bytes */
- CHECK_STREAM_PTR(s->stream_ptr, s->stream_end, 16);
-
for (y = 0; y < 8; y++) {
/* get the next set of 8 2-bit flags */
- int flags = bytestream_get_le16(&s->stream_ptr);
+ int flags = bytestream2_get_le16(&s->stream_ptr);
for (x = 0; x < 8; x++, flags >>= 2)
*s->pixel_ptr++ = P[flags & 0x03];
s->pixel_ptr += s->line_inc;
@@ -363,9 +328,7 @@ static int ipvideo_decode_block_opcode_0x9(IpvideoContext *s)
uint32_t flags;
/* 1 of 4 colors for each 2x2 block, need 4 more bytes */
- CHECK_STREAM_PTR(s->stream_ptr, s->stream_end, 4);
-
- flags = bytestream_get_le32(&s->stream_ptr);
+ flags = bytestream2_get_le32(&s->stream_ptr);
for (y = 0; y < 8; y += 2) {
for (x = 0; x < 8; x += 2, flags >>= 2) {
@@ -382,9 +345,7 @@ static int ipvideo_decode_block_opcode_0x9(IpvideoContext *s)
uint64_t flags;
/* 1 of 4 colors for each 2x1 or 1x2 block, need 8 more bytes */
- CHECK_STREAM_PTR(s->stream_ptr, s->stream_end, 8);
-
- flags = bytestream_get_le64(&s->stream_ptr);
+ flags = bytestream2_get_le64(&s->stream_ptr);
if (P[2] <= P[3]) {
for (y = 0; y < 8; y++) {
for (x = 0; x < 8; x += 2, flags >>= 2) {
@@ -411,24 +372,21 @@ static int ipvideo_decode_block_opcode_0x9(IpvideoContext *s)
static int ipvideo_decode_block_opcode_0xA(IpvideoContext *s)
{
int x, y;
- unsigned char P[4];
+ unsigned char P[8];
int flags = 0;
+ bytestream2_get_buffer(&s->stream_ptr, P, 4);
+
/* 4-color encoding for each 4x4 quadrant, or 4-color encoding on
* either top and bottom or left and right halves */
- CHECK_STREAM_PTR(s->stream_ptr, s->stream_end, 24);
-
- if (s->stream_ptr[0] <= s->stream_ptr[1]) {
+ if (P[0] <= P[1]) {
/* 4-color encoding for each quadrant; need 32 bytes */
- CHECK_STREAM_PTR(s->stream_ptr, s->stream_end, 32);
-
for (y = 0; y < 16; y++) {
// new values for each 4x4 block
if (!(y & 3)) {
- memcpy(P, s->stream_ptr, 4);
- s->stream_ptr += 4;
- flags = bytestream_get_le32(&s->stream_ptr);
+ if (y) bytestream2_get_buffer(&s->stream_ptr, P, 4);
+ flags = bytestream2_get_le32(&s->stream_ptr);
}
for (x = 0; x < 4; x++, flags >>= 2)
@@ -441,20 +399,16 @@ static int ipvideo_decode_block_opcode_0xA(IpvideoContext *s)
} else {
// vertical split?
- int vert = s->stream_ptr[12] <= s->stream_ptr[13];
- uint64_t flags = 0;
+ int vert;
+ uint64_t flags = bytestream2_get_le64(&s->stream_ptr);
+
+ bytestream2_get_buffer(&s->stream_ptr, P + 4, 4);
+ vert = P[4] <= P[5];
/* 4-color encoding for either left and right or top and bottom
* halves */
for (y = 0; y < 16; y++) {
- // load values for each half
- if (!(y & 7)) {
- memcpy(P, s->stream_ptr, 4);
- s->stream_ptr += 4;
- flags = bytestream_get_le64(&s->stream_ptr);
- }
-
for (x = 0; x < 4; x++, flags >>= 2)
*s->pixel_ptr++ = P[flags & 0x03];
@@ -463,6 +417,12 @@ static int ipvideo_decode_block_opcode_0xA(IpvideoContext *s)
// switch to right half
if (y == 7) s->pixel_ptr -= 8 * s->stride - 4;
} else if (y & 1) s->pixel_ptr += s->line_inc;
+
+ // load values for second half
+ if (y == 7) {
+ memcpy(P, P + 4, 4);
+ flags = bytestream2_get_le64(&s->stream_ptr);
+ }
}
}
@@ -475,11 +435,8 @@ static int ipvideo_decode_block_opcode_0xB(IpvideoContext *s)
int y;
/* 64-color encoding (each pixel in block is a different color) */
- CHECK_STREAM_PTR(s->stream_ptr, s->stream_end, 64);
-
for (y = 0; y < 8; y++) {
- memcpy(s->pixel_ptr, s->stream_ptr, 8);
- s->stream_ptr += 8;
+ bytestream2_get_buffer(&s->stream_ptr, s->pixel_ptr, 8);
s->pixel_ptr += s->stride;
}
@@ -492,14 +449,12 @@ static int ipvideo_decode_block_opcode_0xC(IpvideoContext *s)
int x, y;
/* 16-color block encoding: each 2x2 block is a different color */
- CHECK_STREAM_PTR(s->stream_ptr, s->stream_end, 16);
-
for (y = 0; y < 8; y += 2) {
for (x = 0; x < 8; x += 2) {
s->pixel_ptr[x ] =
s->pixel_ptr[x + 1 ] =
s->pixel_ptr[x + s->stride] =
- s->pixel_ptr[x + 1 + s->stride] = *s->stream_ptr++;
+ s->pixel_ptr[x + 1 + s->stride] = bytestream2_get_byte(&s->stream_ptr);
}
s->pixel_ptr += s->stride * 2;
}
@@ -514,12 +469,10 @@ static int ipvideo_decode_block_opcode_0xD(IpvideoContext *s)
unsigned char P[2];
/* 4-color block encoding: each 4x4 block is a different color */
- CHECK_STREAM_PTR(s->stream_ptr, s->stream_end, 4);
-
for (y = 0; y < 8; y++) {
if (!(y & 3)) {
- P[0] = *s->stream_ptr++;
- P[1] = *s->stream_ptr++;
+ P[0] = bytestream2_get_byte(&s->stream_ptr);
+ P[1] = bytestream2_get_byte(&s->stream_ptr);
}
memset(s->pixel_ptr, P[0], 4);
memset(s->pixel_ptr + 4, P[1], 4);
@@ -536,8 +489,7 @@ static int ipvideo_decode_block_opcode_0xE(IpvideoContext *s)
unsigned char pix;
/* 1-color encoding: the whole block is 1 solid color */
- CHECK_STREAM_PTR(s->stream_ptr, s->stream_end, 1);
- pix = *s->stream_ptr++;
+ pix = bytestream2_get_byte(&s->stream_ptr);
for (y = 0; y < 8; y++) {
memset(s->pixel_ptr, pix, 8);
@@ -554,9 +506,8 @@ static int ipvideo_decode_block_opcode_0xF(IpvideoContext *s)
unsigned char sample[2];
/* dithered encoding */
- CHECK_STREAM_PTR(s->stream_ptr, s->stream_end, 2);
- sample[0] = *s->stream_ptr++;
- sample[1] = *s->stream_ptr++;
+ sample[0] = bytestream2_get_byte(&s->stream_ptr);
+ sample[1] = bytestream2_get_byte(&s->stream_ptr);
for (y = 0; y < 8; y++) {
for (x = 0; x < 8; x += 2) {
@@ -575,10 +526,8 @@ static int ipvideo_decode_block_opcode_0x6_16(IpvideoContext *s)
signed char x, y;
/* copy a block from the second last frame using an expanded range */
- CHECK_STREAM_PTR(s->stream_ptr, s->stream_end, 2);
-
- x = *s->stream_ptr++;
- y = *s->stream_ptr++;
+ x = bytestream2_get_byte(&s->stream_ptr);
+ y = bytestream2_get_byte(&s->stream_ptr);
av_dlog(NULL, " motion bytes = %d, %d\n", x, y);
return copy_from(s, &s->second_last_frame, x, y);
@@ -592,17 +541,13 @@ static int ipvideo_decode_block_opcode_0x7_16(IpvideoContext *s)
uint16_t *pixel_ptr = (uint16_t*)s->pixel_ptr;
/* 2-color encoding */
- CHECK_STREAM_PTR(s->stream_ptr, s->stream_end, 4);
-
- P[0] = bytestream_get_le16(&s->stream_ptr);
- P[1] = bytestream_get_le16(&s->stream_ptr);
+ P[0] = bytestream2_get_le16(&s->stream_ptr);
+ P[1] = bytestream2_get_le16(&s->stream_ptr);
if (!(P[0] & 0x8000)) {
- CHECK_STREAM_PTR(s->stream_ptr, s->stream_end, 8);
-
for (y = 0; y < 8; y++) {
- flags = *s->stream_ptr++ | 0x100;
+ flags = bytestream2_get_byte(&s->stream_ptr) | 0x100;
for (; flags != 1; flags >>= 1)
*pixel_ptr++ = P[flags & 1];
pixel_ptr += s->line_inc;
@@ -610,9 +555,7 @@ static int ipvideo_decode_block_opcode_0x7_16(IpvideoContext *s)
} else {
- CHECK_STREAM_PTR(s->stream_ptr, s->stream_end, 2);
-
- flags = bytestream_get_le16(&s->stream_ptr);
+ flags = bytestream2_get_le16(&s->stream_ptr);
for (y = 0; y < 8; y += 2) {
for (x = 0; x < 8; x += 2, flags >>= 1) {
pixel_ptr[x ] =
@@ -630,28 +573,25 @@ static int ipvideo_decode_block_opcode_0x7_16(IpvideoContext *s)
static int ipvideo_decode_block_opcode_0x8_16(IpvideoContext *s)
{
int x, y;
- uint16_t P[2];
+ uint16_t P[4];
unsigned int flags = 0;
uint16_t *pixel_ptr = (uint16_t*)s->pixel_ptr;
/* 2-color encoding for each 4x4 quadrant, or 2-color encoding on
* either top and bottom or left and right halves */
- CHECK_STREAM_PTR(s->stream_ptr, s->stream_end, 4);
-
- P[0] = bytestream_get_le16(&s->stream_ptr);
- P[1] = bytestream_get_le16(&s->stream_ptr);
+ P[0] = bytestream2_get_le16(&s->stream_ptr);
+ P[1] = bytestream2_get_le16(&s->stream_ptr);
if (!(P[0] & 0x8000)) {
- CHECK_STREAM_PTR(s->stream_ptr, s->stream_end, 24);
- s->stream_ptr -= 4;
-
for (y = 0; y < 16; y++) {
// new values for each 4x4 block
if (!(y & 3)) {
- P[0] = bytestream_get_le16(&s->stream_ptr);
- P[1] = bytestream_get_le16(&s->stream_ptr);
- flags = bytestream_get_le16(&s->stream_ptr);
+ if (y) {
+ P[0] = bytestream2_get_le16(&s->stream_ptr);
+ P[1] = bytestream2_get_le16(&s->stream_ptr);
+ }
+ flags = bytestream2_get_le16(&s->stream_ptr);
}
for (x = 0; x < 4; x++, flags >>= 1)
@@ -663,11 +603,11 @@ static int ipvideo_decode_block_opcode_0x8_16(IpvideoContext *s)
} else {
- CHECK_STREAM_PTR(s->stream_ptr, s->stream_end, 12);
-
- if (!(AV_RL16(s->stream_ptr + 4) & 0x8000)) {
+ flags = bytestream2_get_le32(&s->stream_ptr);
+ P[2] = bytestream2_get_le16(&s->stream_ptr);
+ P[3] = bytestream2_get_le16(&s->stream_ptr);
- flags = bytestream_get_le32(&s->stream_ptr);
+ if (!(P[2] & 0x8000)) {
/* vertical split; left & right halves are 2-color encoded */
@@ -678,9 +618,9 @@ static int ipvideo_decode_block_opcode_0x8_16(IpvideoContext *s)
// switch to right half
if (y == 7) {
pixel_ptr -= 8 * s->stride - 4;
- P[0] = bytestream_get_le16(&s->stream_ptr);
- P[1] = bytestream_get_le16(&s->stream_ptr);
- flags = bytestream_get_le32(&s->stream_ptr);
+ P[0] = P[2];
+ P[1] = P[3];
+ flags = bytestream2_get_le32(&s->stream_ptr);
}
}
@@ -690,12 +630,12 @@ static int ipvideo_decode_block_opcode_0x8_16(IpvideoContext *s)
for (y = 0; y < 8; y++) {
if (y == 4) {
- P[0] = bytestream_get_le16(&s->stream_ptr);
- P[1] = bytestream_get_le16(&s->stream_ptr);
+ P[0] = P[2];
+ P[1] = P[3];
+ flags = bytestream2_get_le32(&s->stream_ptr);
}
- flags = *s->stream_ptr++ | 0x100;
- for (; flags != 1; flags >>= 1)
+ for (x = 0; x < 8; x++, flags >>= 1)
*pixel_ptr++ = P[flags & 1];
pixel_ptr += s->line_inc;
}
@@ -713,20 +653,16 @@ static int ipvideo_decode_block_opcode_0x9_16(IpvideoContext *s)
uint16_t *pixel_ptr = (uint16_t*)s->pixel_ptr;
/* 4-color encoding */
- CHECK_STREAM_PTR(s->stream_ptr, s->stream_end, 8);
-
for (x = 0; x < 4; x++)
- P[x] = bytestream_get_le16(&s->stream_ptr);
+ P[x] = bytestream2_get_le16(&s->stream_ptr);
if (!(P[0] & 0x8000)) {
if (!(P[2] & 0x8000)) {
/* 1 of 4 colors for each pixel */
- CHECK_STREAM_PTR(s->stream_ptr, s->stream_end, 16);
-
for (y = 0; y < 8; y++) {
/* get the next set of 8 2-bit flags */
- int flags = bytestream_get_le16(&s->stream_ptr);
+ int flags = bytestream2_get_le16(&s->stream_ptr);
for (x = 0; x < 8; x++, flags >>= 2)
*pixel_ptr++ = P[flags & 0x03];
pixel_ptr += s->line_inc;
@@ -736,9 +672,7 @@ static int ipvideo_decode_block_opcode_0x9_16(IpvideoContext *s)
uint32_t flags;
/* 1 of 4 colors for each 2x2 block */
- CHECK_STREAM_PTR(s->stream_ptr, s->stream_end, 4);
-
- flags = bytestream_get_le32(&s->stream_ptr);
+ flags = bytestream2_get_le32(&s->stream_ptr);
for (y = 0; y < 8; y += 2) {
for (x = 0; x < 8; x += 2, flags >>= 2) {
@@ -755,9 +689,7 @@ static int ipvideo_decode_block_opcode_0x9_16(IpvideoContext *s)
uint64_t flags;
/* 1 of 4 colors for each 2x1 or 1x2 block */
- CHECK_STREAM_PTR(s->stream_ptr, s->stream_end, 8);
-
- flags = bytestream_get_le64(&s->stream_ptr);
+ flags = bytestream2_get_le64(&s->stream_ptr);
if (!(P[2] & 0x8000)) {
for (y = 0; y < 8; y++) {
for (x = 0; x < 8; x += 2, flags >>= 2) {
@@ -784,25 +716,25 @@ static int ipvideo_decode_block_opcode_0x9_16(IpvideoContext *s)
static int ipvideo_decode_block_opcode_0xA_16(IpvideoContext *s)
{
int x, y;
- uint16_t P[4];
+ uint16_t P[8];
int flags = 0;
uint16_t *pixel_ptr = (uint16_t*)s->pixel_ptr;
+ for (x = 0; x < 4; x++)
+ P[x] = bytestream2_get_le16(&s->stream_ptr);
+
/* 4-color encoding for each 4x4 quadrant, or 4-color encoding on
* either top and bottom or left and right halves */
- CHECK_STREAM_PTR(s->stream_ptr, s->stream_end, 24);
-
- if (!(AV_RL16(s->stream_ptr) & 0x8000)) {
+ if (!(P[0] & 0x8000)) {
/* 4-color encoding for each quadrant */
- CHECK_STREAM_PTR(s->stream_ptr, s->stream_end, 48);
-
for (y = 0; y < 16; y++) {
// new values for each 4x4 block
if (!(y & 3)) {
- for (x = 0; x < 4; x++)
- P[x] = bytestream_get_le16(&s->stream_ptr);
- flags = bytestream_get_le32(&s->stream_ptr);
+ if (y)
+ for (x = 0; x < 4; x++)
+ P[x] = bytestream2_get_le16(&s->stream_ptr);
+ flags = bytestream2_get_le32(&s->stream_ptr);
}
for (x = 0; x < 4; x++, flags >>= 2)
@@ -815,20 +747,17 @@ static int ipvideo_decode_block_opcode_0xA_16(IpvideoContext *s)
} else {
// vertical split?
- int vert = !(AV_RL16(s->stream_ptr + 16) & 0x8000);
- uint64_t flags = 0;
+ int vert;
+ uint64_t flags = bytestream2_get_le64(&s->stream_ptr);
+
+ for (x = 4; x < 8; x++)
+ P[x] = bytestream2_get_le16(&s->stream_ptr);
+ vert = !(P[4] & 0x8000);
/* 4-color encoding for either left and right or top and bottom
* halves */
for (y = 0; y < 16; y++) {
- // load values for each half
- if (!(y & 7)) {
- for (x = 0; x < 4; x++)
- P[x] = bytestream_get_le16(&s->stream_ptr);
- flags = bytestream_get_le64(&s->stream_ptr);
- }
-
for (x = 0; x < 4; x++, flags >>= 2)
*pixel_ptr++ = P[flags & 0x03];
@@ -837,6 +766,12 @@ static int ipvideo_decode_block_opcode_0xA_16(IpvideoContext *s)
// switch to right half
if (y == 7) pixel_ptr -= 8 * s->stride - 4;
} else if (y & 1) pixel_ptr += s->line_inc;
+
+ // load values for second half
+ if (y == 7) {
+ memcpy(P, P + 4, 8);
+ flags = bytestream2_get_le64(&s->stream_ptr);
+ }
}
}
@@ -850,11 +785,9 @@ static int ipvideo_decode_block_opcode_0xB_16(IpvideoContext *s)
uint16_t *pixel_ptr = (uint16_t*)s->pixel_ptr;
/* 64-color encoding (each pixel in block is a different color) */
- CHECK_STREAM_PTR(s->stream_ptr, s->stream_end, 128);
-
for (y = 0; y < 8; y++) {
for (x = 0; x < 8; x++)
- pixel_ptr[x] = bytestream_get_le16(&s->stream_ptr);
+ pixel_ptr[x] = bytestream2_get_le16(&s->stream_ptr);
pixel_ptr += s->stride;
}
@@ -868,14 +801,12 @@ static int ipvideo_decode_block_opcode_0xC_16(IpvideoContext *s)
uint16_t *pixel_ptr = (uint16_t*)s->pixel_ptr;
/* 16-color block encoding: each 2x2 block is a different color */
- CHECK_STREAM_PTR(s->stream_ptr, s->stream_end, 32);
-
for (y = 0; y < 8; y += 2) {
for (x = 0; x < 8; x += 2) {
pixel_ptr[x ] =
pixel_ptr[x + 1 ] =
pixel_ptr[x + s->stride] =
- pixel_ptr[x + 1 + s->stride] = bytestream_get_le16(&s->stream_ptr);
+ pixel_ptr[x + 1 + s->stride] = bytestream2_get_le16(&s->stream_ptr);
}
pixel_ptr += s->stride * 2;
}
@@ -891,12 +822,10 @@ static int ipvideo_decode_block_opcode_0xD_16(IpvideoContext *s)
uint16_t *pixel_ptr = (uint16_t*)s->pixel_ptr;
/* 4-color block encoding: each 4x4 block is a different color */
- CHECK_STREAM_PTR(s->stream_ptr, s->stream_end, 8);
-
for (y = 0; y < 8; y++) {
if (!(y & 3)) {
- P[0] = bytestream_get_le16(&s->stream_ptr);
- P[1] = bytestream_get_le16(&s->stream_ptr);
+ P[0] = bytestream2_get_le16(&s->stream_ptr);
+ P[1] = bytestream2_get_le16(&s->stream_ptr);
}
for (x = 0; x < 8; x++)
pixel_ptr[x] = P[x >> 2];
@@ -914,8 +843,7 @@ static int ipvideo_decode_block_opcode_0xE_16(IpvideoContext *s)
uint16_t *pixel_ptr = (uint16_t*)s->pixel_ptr;
/* 1-color encoding: the whole block is 1 solid color */
- CHECK_STREAM_PTR(s->stream_ptr, s->stream_end, 2);
- pix = bytestream_get_le16(&s->stream_ptr);
+ pix = bytestream2_get_le16(&s->stream_ptr);
for (y = 0; y < 8; y++) {
for (x = 0; x < 8; x++)
@@ -960,19 +888,16 @@ static void ipvideo_decode_opcodes(IpvideoContext *s)
av_dlog(NULL, "------------------ frame %d\n", frame);
frame++;
+ bytestream2_skip(&s->stream_ptr, 14); /* data starts 14 bytes in */
if (!s->is_16bpp) {
/* this is PAL8, so make the palette available */
memcpy(s->current_frame.data[1], s->pal, AVPALETTE_SIZE);
s->stride = s->current_frame.linesize[0];
- s->stream_ptr = s->buf + 14; /* data starts 14 bytes in */
- s->stream_end = s->buf + s->size;
} else {
s->stride = s->current_frame.linesize[0] >> 1;
- s->stream_ptr = s->buf + 16;
- s->stream_end =
- s->mv_ptr = s->buf + 14 + AV_RL16(s->buf+14);
- s->mv_end = s->buf + s->size;
+ s->mv_ptr = s->stream_ptr;
+ bytestream2_skip(&s->mv_ptr, bytestream2_get_le16(&s->stream_ptr));
}
s->line_inc = s->stride - 8;
s->upper_motion_limit_offset = (s->avctx->height - 8) * s->current_frame.linesize[0]
@@ -983,8 +908,9 @@ static void ipvideo_decode_opcodes(IpvideoContext *s)
for (x = 0; x < s->avctx->width; x += 8) {
opcode = get_bits(&gb, 4);
- av_dlog(NULL, " block @ (%3d, %3d): encoding 0x%X, data ptr @ %p\n",
- x, y, opcode, s->stream_ptr);
+ av_dlog(s->avctx,
+ " block @ (%3d, %3d): encoding 0x%X, data ptr offset %d\n",
+ x, y, opcode, bytestream2_tell(&s->stream_ptr));
if (!s->is_16bpp) {
s->pixel_ptr = s->current_frame.data[0] + x
@@ -1002,9 +928,10 @@ static void ipvideo_decode_opcodes(IpvideoContext *s)
}
}
}
- if (s->stream_end - s->stream_ptr > 1) {
- av_log(s->avctx, AV_LOG_ERROR, " Interplay video: decode finished with %td bytes left over\n",
- s->stream_end - s->stream_ptr);
+ if (bytestream2_get_bytes_left(&s->stream_ptr) > 1) {
+ av_log(s->avctx, AV_LOG_ERROR,
+ "Interplay video: decode finished with %d bytes left over\n",
+ bytestream2_get_bytes_left(&s->stream_ptr));
}
}
@@ -1015,9 +942,9 @@ static av_cold int ipvideo_decode_init(AVCodecContext *avctx)
s->avctx = avctx;
s->is_16bpp = avctx->bits_per_coded_sample == 16;
- avctx->pix_fmt = s->is_16bpp ? PIX_FMT_RGB555 : PIX_FMT_PAL8;
+ avctx->pix_fmt = s->is_16bpp ? AV_PIX_FMT_RGB555 : AV_PIX_FMT_PAL8;
- dsputil_init(&s->dsp, avctx);
+ ff_dsputil_init(&s->dsp, avctx);
s->current_frame.data[0] = s->last_frame.data[0] =
s->second_last_frame.data[0] = NULL;
@@ -1026,7 +953,7 @@ static av_cold int ipvideo_decode_init(AVCodecContext *avctx)
}
static int ipvideo_decode_frame(AVCodecContext *avctx,
- void *data, int *data_size,
+ void *data, int *got_frame,
AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
@@ -1042,11 +969,11 @@ static int ipvideo_decode_frame(AVCodecContext *avctx,
return buf_size;
s->decoding_map = buf;
- s->buf = buf + s->decoding_map_size;
- s->size = buf_size - s->decoding_map_size;
+ bytestream2_init(&s->stream_ptr, buf + s->decoding_map_size,
+ buf_size - s->decoding_map_size);
s->current_frame.reference = 3;
- if (avctx->get_buffer(avctx, &s->current_frame)) {
+ if (ff_get_buffer(avctx, &s->current_frame)) {
av_log(avctx, AV_LOG_ERROR, " Interplay Video: get_buffer() failed\n");
return -1;
}
@@ -1061,7 +988,7 @@ static int ipvideo_decode_frame(AVCodecContext *avctx,
ipvideo_decode_opcodes(s);
- *data_size = sizeof(AVFrame);
+ *got_frame = 1;
*(AVFrame*)data = s->current_frame;
/* shuffle frames */
@@ -1091,11 +1018,11 @@ static av_cold int ipvideo_decode_end(AVCodecContext *avctx)
AVCodec ff_interplay_video_decoder = {
.name = "interplayvideo",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_INTERPLAY_VIDEO,
+ .id = AV_CODEC_ID_INTERPLAY_VIDEO,
.priv_data_size = sizeof(IpvideoContext),
.init = ipvideo_decode_init,
.close = ipvideo_decode_end,
.decode = ipvideo_decode_frame,
.capabilities = CODEC_CAP_DR1 | CODEC_CAP_PARAM_CHANGE,
- .long_name = NULL_IF_CONFIG_SMALL("Interplay MVE video"),
+ .long_name = NULL_IF_CONFIG_SMALL("Interplay MVE video"),
};
diff --git a/gst-libs/ext/libav/libavcodec/intrax8.c b/gst-libs/ext/libav/libavcodec/intrax8.c
index 0dc33e2..fad7ffe 100644
--- a/gst-libs/ext/libav/libavcodec/intrax8.c
+++ b/gst-libs/ext/libav/libavcodec/intrax8.c
@@ -27,6 +27,7 @@
#include "msmpeg4data.h"
#include "intrax8huf.h"
#include "intrax8.h"
+#include "intrax8dsp.h"
#define MAX_TABLE_DEPTH(table_bits, max_bits) ((max_bits+table_bits-1)/table_bits)
@@ -303,9 +304,9 @@ static int x8_setup_spatial_predictor(IntraX8Context * const w, const int chroma
int sum;
int quant;
- s->dsp.x8_setup_spatial_compensation(s->dest[chroma], s->edge_emu_buffer,
- s->current_picture.f.linesize[chroma>0],
- &range, &sum, w->edges);
+ w->dsp.setup_spatial_compensation(s->dest[chroma], s->edge_emu_buffer,
+ s->current_picture.f.linesize[chroma>0],
+ &range, &sum, w->edges);
if(chroma){
w->orient=w->chroma_orient;
quant=w->quant_dc_chroma;
@@ -639,7 +640,7 @@ static int x8_decode_intra_mb(IntraX8Context* const w, const int chroma){
if(w->flat_dc){
dsp_x8_put_solidcolor(w->predicted_dc, s->dest[chroma], s->current_picture.f.linesize[!!chroma]);
}else{
- s->dsp.x8_spatial_compensation[w->orient]( s->edge_emu_buffer,
+ w->dsp.spatial_compensation[w->orient]( s->edge_emu_buffer,
s->dest[chroma],
s->current_picture.f.linesize[!!chroma] );
}
@@ -659,10 +660,10 @@ block_placed:
int linesize = s->current_picture.f.linesize[!!chroma];
if(!( (w->edges&2) || ( zeros_only && (w->orient|4)==4 ) )){
- s->dsp.x8_h_loop_filter(ptr, linesize, w->quant);
+ w->dsp.h_loop_filter(ptr, linesize, w->quant);
}
if(!( (w->edges&1) || ( zeros_only && (w->orient|8)==8 ) )){
- s->dsp.x8_v_loop_filter(ptr, linesize, w->quant);
+ w->dsp.v_loop_filter(ptr, linesize, w->quant);
}
}
return 0;
@@ -696,9 +697,11 @@ av_cold void ff_intrax8_common_init(IntraX8Context * w, MpegEncContext * const s
assert(s->mb_width>0);
w->prediction_table=av_mallocz(s->mb_width*2*2);//two rows, 2 blocks per cannon mb
- ff_init_scantable(s->dsp.idct_permutation, &w->scantable[0], wmv1_scantable[0]);
- ff_init_scantable(s->dsp.idct_permutation, &w->scantable[1], wmv1_scantable[2]);
- ff_init_scantable(s->dsp.idct_permutation, &w->scantable[2], wmv1_scantable[3]);
+ ff_init_scantable(s->dsp.idct_permutation, &w->scantable[0], ff_wmv1_scantable[0]);
+ ff_init_scantable(s->dsp.idct_permutation, &w->scantable[1], ff_wmv1_scantable[2]);
+ ff_init_scantable(s->dsp.idct_permutation, &w->scantable[2], ff_wmv1_scantable[3]);
+
+ ff_intrax8dsp_init(&w->dsp);
}
/**
@@ -716,12 +719,11 @@ av_cold void ff_intrax8_common_end(IntraX8Context * w)
* The parent codec must call MPV_frame_start(), ff_er_frame_start() before calling this function.
* The parent codec must call ff_er_frame_end(), MPV_frame_end() after calling this function.
* This function does not use MPV_decode_mb().
- * lowres decoding is theoretically impossible.
* @param w pointer to IntraX8Context
* @param dquant doubled quantizer, it would be odd in case of VC-1 halfpq==1.
* @param quant_offset offset away from zero
*/
-//FIXME extern uint8_t wmv3_dc_scale_table[32];
+//FIXME extern uint8_t ff_wmv3_dc_scale_table[32];
int ff_intrax8_decode_picture(IntraX8Context * const w, int dquant, int quant_offset){
MpegEncContext * const s= w->s;
int mb_xy;
diff --git a/gst-libs/ext/libav/libavcodec/intrax8.h b/gst-libs/ext/libav/libavcodec/intrax8.h
index 3a58938..6967317 100644
--- a/gst-libs/ext/libav/libavcodec/intrax8.h
+++ b/gst-libs/ext/libav/libavcodec/intrax8.h
@@ -21,8 +21,9 @@
#include "get_bits.h"
#include "mpegvideo.h"
+#include "intrax8dsp.h"
-typedef struct{
+typedef struct IntraX8Context {
VLC * j_ac_vlc[4];//they point to the static j_mb_vlc
VLC * j_orient_vlc;
VLC * j_dc_vlc[3];
@@ -33,6 +34,7 @@ typedef struct{
ScanTable scantable[3];
//set by the caller codec
MpegEncContext * s;
+ IntraX8DSPContext dsp;
int quant;
int dquant;
int qsum;
diff --git a/gst-libs/ext/libav/libavcodec/intrax8dsp.c b/gst-libs/ext/libav/libavcodec/intrax8dsp.c
index 1a62fcd..ddceb2c 100644
--- a/gst-libs/ext/libav/libavcodec/intrax8dsp.c
+++ b/gst-libs/ext/libav/libavcodec/intrax8dsp.c
@@ -22,6 +22,8 @@
*/
#include "dsputil.h"
+#include "intrax8dsp.h"
+#include "libavutil/common.h"
/*
area positions, #3 is 1 pixel only, other are 8 pixels
@@ -152,10 +154,8 @@ static void spatial_compensation_0(uint8_t *src , uint8_t *dst, int linesize){
int x,y;
unsigned int p;//power divided by 2
int a;
- uint16_t left_sum[2][8];
- uint16_t top_sum[2][8];
- memset(left_sum,0,2*8*sizeof(uint16_t));
- memset( top_sum,0,2*8*sizeof(uint16_t));
+ uint16_t left_sum[2][8] = { { 0 } };
+ uint16_t top_sum[2][8] = { { 0 } };
for(i=0;i<8;i++){
a=src[area2+7-i]<<4;
@@ -413,20 +413,21 @@ static void x8_v_loop_filter(uint8_t *src, int stride, int qscale){
x8_loop_filter(src, 1, stride, qscale);
}
-av_cold void ff_intrax8dsp_init(DSPContext* dsp, AVCodecContext *avctx) {
- dsp->x8_h_loop_filter=x8_h_loop_filter;
- dsp->x8_v_loop_filter=x8_v_loop_filter;
- dsp->x8_setup_spatial_compensation=x8_setup_spatial_compensation;
- dsp->x8_spatial_compensation[0]=spatial_compensation_0;
- dsp->x8_spatial_compensation[1]=spatial_compensation_1;
- dsp->x8_spatial_compensation[2]=spatial_compensation_2;
- dsp->x8_spatial_compensation[3]=spatial_compensation_3;
- dsp->x8_spatial_compensation[4]=spatial_compensation_4;
- dsp->x8_spatial_compensation[5]=spatial_compensation_5;
- dsp->x8_spatial_compensation[6]=spatial_compensation_6;
- dsp->x8_spatial_compensation[7]=spatial_compensation_7;
- dsp->x8_spatial_compensation[8]=spatial_compensation_8;
- dsp->x8_spatial_compensation[9]=spatial_compensation_9;
- dsp->x8_spatial_compensation[10]=spatial_compensation_10;
- dsp->x8_spatial_compensation[11]=spatial_compensation_11;
+av_cold void ff_intrax8dsp_init(IntraX8DSPContext *dsp)
+{
+ dsp->h_loop_filter=x8_h_loop_filter;
+ dsp->v_loop_filter=x8_v_loop_filter;
+ dsp->setup_spatial_compensation=x8_setup_spatial_compensation;
+ dsp->spatial_compensation[0]=spatial_compensation_0;
+ dsp->spatial_compensation[1]=spatial_compensation_1;
+ dsp->spatial_compensation[2]=spatial_compensation_2;
+ dsp->spatial_compensation[3]=spatial_compensation_3;
+ dsp->spatial_compensation[4]=spatial_compensation_4;
+ dsp->spatial_compensation[5]=spatial_compensation_5;
+ dsp->spatial_compensation[6]=spatial_compensation_6;
+ dsp->spatial_compensation[7]=spatial_compensation_7;
+ dsp->spatial_compensation[8]=spatial_compensation_8;
+ dsp->spatial_compensation[9]=spatial_compensation_9;
+ dsp->spatial_compensation[10]=spatial_compensation_10;
+ dsp->spatial_compensation[11]=spatial_compensation_11;
}
diff --git a/gst-libs/ext/libav/libavcodec/intrax8dsp.h b/gst-libs/ext/libav/libavcodec/intrax8dsp.h
new file mode 100644
index 0000000..5c3cc4a
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/intrax8dsp.h
@@ -0,0 +1,35 @@
+/*
+ * 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
+ */
+
+#ifndef AVCODEC_INTRAX8DSP_H
+#define AVCODEC_INTRAX8DSP_H
+
+#include <stdint.h>
+
+typedef struct IntraX8DSPContext {
+ void (*v_loop_filter)(uint8_t *src, int stride, int qscale);
+ void (*h_loop_filter)(uint8_t *src, int stride, int qscale);
+
+ void (*spatial_compensation[12])(uint8_t *src , uint8_t *dst, int linesize);
+ void (*setup_spatial_compensation)(uint8_t *src, uint8_t *dst, int linesize,
+ int *range, int *sum, int edges);
+} IntraX8DSPContext;
+
+void ff_intrax8dsp_init(IntraX8DSPContext *dsp);
+
+#endif /* AVCODEC_INTRAX8DSP_H */
diff --git a/gst-libs/ext/libav/libavcodec/inverse.c b/gst-libs/ext/libav/libavcodec/inverse.c
deleted file mode 100644
index 04681d2..0000000
--- a/gst-libs/ext/libav/libavcodec/inverse.c
+++ /dev/null
@@ -1 +0,0 @@
-#include "libavutil/inverse.c"
diff --git a/gst-libs/ext/libav/libavcodec/ituh263dec.c b/gst-libs/ext/libav/libavcodec/ituh263dec.c
index 028d2a1..cb26be2 100644
--- a/gst-libs/ext/libav/libavcodec/ituh263dec.c
+++ b/gst-libs/ext/libav/libavcodec/ituh263dec.c
@@ -230,15 +230,15 @@ const uint8_t *ff_h263_find_resync_marker(const uint8_t *restrict p, const uint8
int ff_h263_resync(MpegEncContext *s){
int left, pos, ret;
- if(s->codec_id==CODEC_ID_MPEG4){
+ if(s->codec_id==AV_CODEC_ID_MPEG4){
skip_bits1(&s->gb);
align_get_bits(&s->gb);
}
if(show_bits(&s->gb, 16)==0){
pos= get_bits_count(&s->gb);
- if(CONFIG_MPEG4_DECODER && s->codec_id==CODEC_ID_MPEG4)
- ret= mpeg4_decode_video_packet_header(s);
+ if(CONFIG_MPEG4_DECODER && s->codec_id==AV_CODEC_ID_MPEG4)
+ ret= ff_mpeg4_decode_video_packet_header(s);
else
ret= h263_decode_gob_header(s);
if(ret>=0)
@@ -254,8 +254,8 @@ int ff_h263_resync(MpegEncContext *s){
GetBitContext bak= s->gb;
pos= get_bits_count(&s->gb);
- if(CONFIG_MPEG4_DECODER && s->codec_id==CODEC_ID_MPEG4)
- ret= mpeg4_decode_video_packet_header(s);
+ if(CONFIG_MPEG4_DECODER && s->codec_id==AV_CODEC_ID_MPEG4)
+ ret= ff_mpeg4_decode_video_packet_header(s);
else
ret= h263_decode_gob_header(s);
if(ret>=0)
@@ -458,14 +458,14 @@ static int h263_decode_block(MpegEncContext * s, DCTELEM * block,
}
} else if (s->mb_intra) {
/* DC coef */
- if(s->codec_id == CODEC_ID_RV10){
+ if(s->codec_id == AV_CODEC_ID_RV10){
#if CONFIG_RV10_DECODER
if (s->rv10_version == 3 && s->pict_type == AV_PICTURE_TYPE_I) {
int component, diff;
component = (n <= 3 ? 0 : n - 4 + 1);
level = s->last_dc[component];
if (s->rv10_first_dc_coded[component]) {
- diff = rv_decode_dc(s, n);
+ diff = ff_rv_decode_dc(s, n);
if (diff == 0xffff)
return -1;
level += diff;
@@ -517,7 +517,7 @@ retry:
run = get_bits(&s->gb, 6);
level = (int8_t)get_bits(&s->gb, 8);
if(level == -128){
- if (s->codec_id == CODEC_ID_RV10) {
+ if (s->codec_id == AV_CODEC_ID_RV10) {
/* XXX: should patch encoder too */
level = get_sbits(&s->gb, 12);
}else{
@@ -1083,6 +1083,22 @@ int ff_h263_decode_picture_header(MpegEncContext *s)
skip_bits(&s->gb, 2); /* Quantization information for B-pictures */
}
+ if (s->pict_type!=AV_PICTURE_TYPE_B) {
+ s->time = s->picture_number;
+ s->pp_time = s->time - s->last_non_b_time;
+ s->last_non_b_time = s->time;
+ }else{
+ s->time = s->picture_number;
+ s->pb_time = s->pp_time - (s->last_non_b_time - s->time);
+ if (s->pp_time <=s->pb_time ||
+ s->pp_time <= s->pp_time - s->pb_time ||
+ s->pp_time <= 0){
+ s->pp_time = 2;
+ s->pb_time = 1;
+ }
+ ff_mpeg4_init_direct_mv(s);
+ }
+
/* PEI */
while (get_bits1(&s->gb) != 0) {
skip_bits(&s->gb, 8);
diff --git a/gst-libs/ext/libav/libavcodec/ituh263enc.c b/gst-libs/ext/libav/libavcodec/ituh263enc.c
index 752b307..f95b1cd 100644
--- a/gst-libs/ext/libav/libavcodec/ituh263enc.c
+++ b/gst-libs/ext/libav/libavcodec/ituh263enc.c
@@ -288,7 +288,7 @@ void ff_clean_h263_qscales(MpegEncContext *s){
qscale_table[ s->mb_index2xy[i] ]= qscale_table[ s->mb_index2xy[i+1] ]+2;
}
- if(s->codec_id != CODEC_ID_H263P){
+ if(s->codec_id != AV_CODEC_ID_H263P){
for(i=1; i<s->mb_num; i++){
int mb_xy= s->mb_index2xy[i];
@@ -795,10 +795,10 @@ void ff_h263_encode_init(MpegEncContext *s)
// use fcodes >1 only for mpeg4 & h263 & h263p FIXME
switch(s->codec_id){
- case CODEC_ID_MPEG4:
+ case AV_CODEC_ID_MPEG4:
s->fcode_tab= fcode_tab;
break;
- case CODEC_ID_H263P:
+ case AV_CODEC_ID_H263P:
if(s->umvplus)
s->fcode_tab= umv_fcode_tab;
if(s->modified_quant){
@@ -810,7 +810,7 @@ void ff_h263_encode_init(MpegEncContext *s)
}
break;
//Note for mpeg4 & h263 the dc-scale table will be set per frame as needed later
- case CODEC_ID_FLV1:
+ case AV_CODEC_ID_FLV1:
if (s->h263_flv > 1) {
s->min_qcoeff= -1023;
s->max_qcoeff= 1023;
diff --git a/gst-libs/ext/libav/libavcodec/ivi_common.c b/gst-libs/ext/libav/libavcodec/ivi_common.c
index c907e2a..815a5cb 100644
--- a/gst-libs/ext/libav/libavcodec/ivi_common.c
+++ b/gst-libs/ext/libav/libavcodec/ivi_common.c
@@ -27,21 +27,37 @@
*/
#define BITSTREAM_READER_LE
+#include "libavutil/attributes.h"
#include "avcodec.h"
#include "get_bits.h"
+#include "internal.h"
+#include "mathops.h"
#include "ivi_common.h"
-#include "libavutil/common.h"
#include "ivi_dsp.h"
extern const IVIHuffDesc ff_ivi_mb_huff_desc[8]; ///< static macroblock huffman tables
extern const IVIHuffDesc ff_ivi_blk_huff_desc[8]; ///< static block huffman tables
-VLC ff_ivi_mb_vlc_tabs [8];
-VLC ff_ivi_blk_vlc_tabs[8];
+static VLC ivi_mb_vlc_tabs [8]; ///< static macroblock Huffman tables
+static VLC ivi_blk_vlc_tabs[8]; ///< static block Huffman tables
typedef void (*ivi_mc_func) (int16_t *buf, const int16_t *ref_buf,
uint32_t pitch, int mc_type);
+static int ivi_mc(ivi_mc_func mc, int16_t *buf, const int16_t *ref_buf,
+ int offs, int mv_x, int mv_y, uint32_t pitch,
+ int mc_type)
+{
+ int ref_offs = offs + mv_y * pitch + mv_x;
+
+ if (offs < 0 || ref_offs < 0 || !ref_buf)
+ return AVERROR_INVALIDDATA;
+
+ mc(buf + offs, ref_buf + ref_offs, pitch, mc_type);
+
+ return 0;
+}
+
/**
* Reverse "nbits" bits of the value "val" and return the result
* in the least significant bits.
@@ -51,14 +67,24 @@ static uint16_t inv_bits(uint16_t val, int nbits)
uint16_t res;
if (nbits <= 8) {
- res = av_reverse[val] >> (8-nbits);
+ res = ff_reverse[val] >> (8 - nbits);
} else
- res = ((av_reverse[val & 0xFF] << 8) + (av_reverse[val >> 8])) >> (16-nbits);
+ res = ((ff_reverse[val & 0xFF] << 8) +
+ (ff_reverse[val >> 8])) >> (16 - nbits);
return res;
}
-int ff_ivi_create_huff_from_desc(const IVIHuffDesc *cb, VLC *vlc, int flag)
+/*
+ * Generate a huffman codebook from the given descriptor
+ * and convert it into the Libav VLC table.
+ *
+ * @param[in] cb pointer to codebook descriptor
+ * @param[out] vlc where to place the generated VLC table
+ * @param[in] flag flag: 1 - for static or 0 for dynamic tables
+ * @return result code: 0 - OK, -1 = error (invalid codebook descriptor)
+ */
+static int ivi_create_huff_from_desc(const IVIHuffDesc *cb, VLC *vlc, int flag)
{
int pos, i, j, codes_per_row, prefix, not_last_row;
uint16_t codewords[256]; /* FIXME: move this temporal storage out? */
@@ -101,84 +127,128 @@ void ff_ivi_init_static_vlc(void)
if (initialized_vlcs)
return;
for (i = 0; i < 8; i++) {
- ff_ivi_mb_vlc_tabs[i].table = table_data + i * 2 * 8192;
- ff_ivi_mb_vlc_tabs[i].table_allocated = 8192;
- ff_ivi_create_huff_from_desc(&ff_ivi_mb_huff_desc[i], &ff_ivi_mb_vlc_tabs[i], 1);
- ff_ivi_blk_vlc_tabs[i].table = table_data + (i * 2 + 1) * 8192;
- ff_ivi_blk_vlc_tabs[i].table_allocated = 8192;
- ff_ivi_create_huff_from_desc(&ff_ivi_blk_huff_desc[i], &ff_ivi_blk_vlc_tabs[i], 1);
+ ivi_mb_vlc_tabs[i].table = table_data + i * 2 * 8192;
+ ivi_mb_vlc_tabs[i].table_allocated = 8192;
+ ivi_create_huff_from_desc(&ff_ivi_mb_huff_desc[i],
+ &ivi_mb_vlc_tabs[i], 1);
+ ivi_blk_vlc_tabs[i].table = table_data + (i * 2 + 1) * 8192;
+ ivi_blk_vlc_tabs[i].table_allocated = 8192;
+ ivi_create_huff_from_desc(&ff_ivi_blk_huff_desc[i],
+ &ivi_blk_vlc_tabs[i], 1);
}
initialized_vlcs = 1;
}
+/*
+ * Copy huffman codebook descriptors.
+ *
+ * @param[out] dst ptr to the destination descriptor
+ * @param[in] src ptr to the source descriptor
+ */
+static void ivi_huff_desc_copy(IVIHuffDesc *dst, const IVIHuffDesc *src)
+{
+ dst->num_rows = src->num_rows;
+ memcpy(dst->xbits, src->xbits, src->num_rows);
+}
+
+/*
+ * Compare two huffman codebook descriptors.
+ *
+ * @param[in] desc1 ptr to the 1st descriptor to compare
+ * @param[in] desc2 ptr to the 2nd descriptor to compare
+ * @return comparison result: 0 - equal, 1 - not equal
+ */
+static int ivi_huff_desc_cmp(const IVIHuffDesc *desc1,
+ const IVIHuffDesc *desc2)
+{
+ return desc1->num_rows != desc2->num_rows ||
+ memcmp(desc1->xbits, desc2->xbits, desc1->num_rows);
+}
+
int ff_ivi_dec_huff_desc(GetBitContext *gb, int desc_coded, int which_tab,
IVIHuffTab *huff_tab, AVCodecContext *avctx)
{
- int i, result;
+ int i, result;
IVIHuffDesc new_huff;
if (!desc_coded) {
/* select default table */
- huff_tab->tab = (which_tab) ? &ff_ivi_blk_vlc_tabs[7]
- : &ff_ivi_mb_vlc_tabs [7];
- } else {
- huff_tab->tab_sel = get_bits(gb, 3);
- if (huff_tab->tab_sel == 7) {
- /* custom huffman table (explicitly encoded) */
- new_huff.num_rows = get_bits(gb, 4);
- if (!new_huff.num_rows) {
- av_log(avctx, AV_LOG_ERROR, "Empty custom Huffman table!\n");
- return AVERROR_INVALIDDATA;
- }
+ huff_tab->tab = (which_tab) ? &ivi_blk_vlc_tabs[7]
+ : &ivi_mb_vlc_tabs [7];
+ return 0;
+ }
- for (i = 0; i < new_huff.num_rows; i++)
- new_huff.xbits[i] = get_bits(gb, 4);
+ huff_tab->tab_sel = get_bits(gb, 3);
+ if (huff_tab->tab_sel == 7) {
+ /* custom huffman table (explicitly encoded) */
+ new_huff.num_rows = get_bits(gb, 4);
+ if (!new_huff.num_rows) {
+ av_log(avctx, AV_LOG_ERROR, "Empty custom Huffman table!\n");
+ return AVERROR_INVALIDDATA;
+ }
- /* Have we got the same custom table? Rebuild if not. */
- if (ff_ivi_huff_desc_cmp(&new_huff, &huff_tab->cust_desc)) {
- ff_ivi_huff_desc_copy(&huff_tab->cust_desc, &new_huff);
+ for (i = 0; i < new_huff.num_rows; i++)
+ new_huff.xbits[i] = get_bits(gb, 4);
- if (huff_tab->cust_tab.table)
- ff_free_vlc(&huff_tab->cust_tab);
- result = ff_ivi_create_huff_from_desc(&huff_tab->cust_desc,
- &huff_tab->cust_tab, 0);
- if (result) {
- huff_tab->cust_desc.num_rows = 0; // reset faulty description
- av_log(avctx, AV_LOG_ERROR,
- "Error while initializing custom vlc table!\n");
- return result;
- }
+ /* Have we got the same custom table? Rebuild if not. */
+ if (ivi_huff_desc_cmp(&new_huff, &huff_tab->cust_desc)) {
+ ivi_huff_desc_copy(&huff_tab->cust_desc, &new_huff);
+
+ if (huff_tab->cust_tab.table)
+ ff_free_vlc(&huff_tab->cust_tab);
+ result = ivi_create_huff_from_desc(&huff_tab->cust_desc,
+ &huff_tab->cust_tab, 0);
+ if (result) {
+ // reset faulty description
+ huff_tab->cust_desc.num_rows = 0;
+ av_log(avctx, AV_LOG_ERROR,
+ "Error while initializing custom vlc table!\n");
+ return result;
}
- huff_tab->tab = &huff_tab->cust_tab;
- } else {
- /* select one of predefined tables */
- huff_tab->tab = (which_tab) ? &ff_ivi_blk_vlc_tabs[huff_tab->tab_sel]
- : &ff_ivi_mb_vlc_tabs [huff_tab->tab_sel];
}
+ huff_tab->tab = &huff_tab->cust_tab;
+ } else {
+ /* select one of predefined tables */
+ huff_tab->tab = (which_tab) ? &ivi_blk_vlc_tabs[huff_tab->tab_sel]
+ : &ivi_mb_vlc_tabs [huff_tab->tab_sel];
}
return 0;
}
-int ff_ivi_huff_desc_cmp(const IVIHuffDesc *desc1, const IVIHuffDesc *desc2)
+/*
+ * Free planes, bands and macroblocks buffers.
+ *
+ * @param[in] planes pointer to the array of the plane descriptors
+ */
+static av_cold void ivi_free_buffers(IVIPlaneDesc *planes)
{
- return desc1->num_rows != desc2->num_rows
- || memcmp(desc1->xbits, desc2->xbits, desc1->num_rows);
-}
+ int p, b, t;
-void ff_ivi_huff_desc_copy(IVIHuffDesc *dst, const IVIHuffDesc *src)
-{
- dst->num_rows = src->num_rows;
- memcpy(dst->xbits, src->xbits, src->num_rows);
+ for (p = 0; p < 3; p++) {
+ for (b = 0; b < planes[p].num_bands; b++) {
+ av_freep(&planes[p].bands[b].bufs[0]);
+ av_freep(&planes[p].bands[b].bufs[1]);
+ av_freep(&planes[p].bands[b].bufs[2]);
+
+ if (planes[p].bands[b].blk_vlc.cust_tab.table)
+ ff_free_vlc(&planes[p].bands[b].blk_vlc.cust_tab);
+ for (t = 0; t < planes[p].bands[b].num_tiles; t++)
+ av_freep(&planes[p].bands[b].tiles[t].mbs);
+ av_freep(&planes[p].bands[b].tiles);
+ }
+ av_freep(&planes[p].bands);
+ }
}
-int av_cold ff_ivi_init_planes(IVIPlaneDesc *planes, const IVIPicConfig *cfg)
+av_cold int ff_ivi_init_planes(IVIPlaneDesc *planes, const IVIPicConfig *cfg)
{
- int p, b;
- uint32_t b_width, b_height, align_fac, width_aligned, height_aligned, buf_size;
+ int p, b;
+ uint32_t b_width, b_height, align_fac, width_aligned,
+ height_aligned, buf_size;
IVIBandDesc *band;
- ff_ivi_free_buffers(planes);
+ ivi_free_buffers(planes);
/* fill in the descriptor of the luminance plane */
planes[0].width = cfg->pic_width;
@@ -198,8 +268,10 @@ int av_cold ff_ivi_init_planes(IVIPlaneDesc *planes, const IVIPicConfig *cfg)
/* select band dimensions: if there is only one band then it
* has the full size, if there are several bands each of them
* has only half size */
- b_width = planes[p].num_bands == 1 ? planes[p].width : (planes[p].width + 1) >> 1;
- b_height = planes[p].num_bands == 1 ? planes[p].height : (planes[p].height + 1) >> 1;
+ b_width = planes[p].num_bands == 1 ? planes[p].width
+ : (planes[p].width + 1) >> 1;
+ b_height = planes[p].num_bands == 1 ? planes[p].height
+ : (planes[p].height + 1) >> 1;
/* luma band buffers will be aligned on 16x16 (max macroblock size) */
/* chroma band buffers will be aligned on 8x8 (max macroblock size) */
@@ -227,39 +299,54 @@ int av_cold ff_ivi_init_planes(IVIPlaneDesc *planes, const IVIPicConfig *cfg)
if (!band->bufs[2])
return AVERROR(ENOMEM);
}
-
- planes[p].bands[0].blk_vlc.cust_desc.num_rows = 0; /* reset custom vlc */
+ /* reset custom vlc */
+ planes[p].bands[0].blk_vlc.cust_desc.num_rows = 0;
}
}
return 0;
}
-void av_cold ff_ivi_free_buffers(IVIPlaneDesc *planes)
+static int ivi_init_tiles(IVIBandDesc *band, IVITile *ref_tile,
+ int p, int b, int t_height, int t_width)
{
- int p, b, t;
-
- for (p = 0; p < 3; p++) {
- for (b = 0; b < planes[p].num_bands; b++) {
- av_freep(&planes[p].bands[b].bufs[0]);
- av_freep(&planes[p].bands[b].bufs[1]);
- av_freep(&planes[p].bands[b].bufs[2]);
+ int x, y;
+ IVITile *tile = band->tiles;
+
+ for (y = 0; y < band->height; y += t_height) {
+ for (x = 0; x < band->width; x += t_width) {
+ tile->xpos = x;
+ tile->ypos = y;
+ tile->mb_size = band->mb_size;
+ tile->width = FFMIN(band->width - x, t_width);
+ tile->height = FFMIN(band->height - y, t_height);
+ tile->is_empty = tile->data_size = 0;
+ /* calculate number of macroblocks */
+ tile->num_MBs = IVI_MBs_PER_TILE(tile->width, tile->height,
+ band->mb_size);
+
+ av_freep(&tile->mbs);
+ tile->mbs = av_malloc(tile->num_MBs * sizeof(IVIMbInfo));
+ if (!tile->mbs)
+ return AVERROR(ENOMEM);
- if (planes[p].bands[b].blk_vlc.cust_tab.table)
- ff_free_vlc(&planes[p].bands[b].blk_vlc.cust_tab);
- for (t = 0; t < planes[p].bands[b].num_tiles; t++)
- av_freep(&planes[p].bands[b].tiles[t].mbs);
- av_freep(&planes[p].bands[b].tiles);
+ tile->ref_mbs = 0;
+ if (p || b) {
+ tile->ref_mbs = ref_tile->mbs;
+ ref_tile++;
+ }
+ tile++;
}
- av_freep(&planes[p].bands);
}
+
+ return 0;
}
-int av_cold ff_ivi_init_tiles(IVIPlaneDesc *planes, int tile_width, int tile_height)
+av_cold int ff_ivi_init_tiles(IVIPlaneDesc *planes,
+ int tile_width, int tile_height)
{
- int p, b, x, y, x_tiles, y_tiles, t_width, t_height;
+ int p, b, x_tiles, y_tiles, t_width, t_height, ret;
IVIBandDesc *band;
- IVITile *tile, *ref_tile;
for (p = 0; p < 3; p++) {
t_width = !p ? tile_width : (tile_width + 3) >> 2;
@@ -281,46 +368,29 @@ int av_cold ff_ivi_init_tiles(IVIPlaneDesc *planes, int tile_width, int tile_hei
if (!band->tiles)
return AVERROR(ENOMEM);
- tile = band->tiles;
-
/* use the first luma band as reference for motion vectors
* and quant */
- ref_tile = planes[0].bands[0].tiles;
-
- for (y = 0; y < band->height; y += t_height) {
- for (x = 0; x < band->width; x += t_width) {
- tile->xpos = x;
- tile->ypos = y;
- tile->mb_size = band->mb_size;
- tile->width = FFMIN(band->width - x, t_width);
- tile->height = FFMIN(band->height - y, t_height);
- tile->is_empty = tile->data_size = 0;
- /* calculate number of macroblocks */
- tile->num_MBs = IVI_MBs_PER_TILE(tile->width, tile->height,
- band->mb_size);
-
- av_freep(&tile->mbs);
- tile->mbs = av_malloc(tile->num_MBs * sizeof(IVIMbInfo));
- if (!tile->mbs)
- return AVERROR(ENOMEM);
-
- tile->ref_mbs = 0;
- if (p || b) {
- tile->ref_mbs = ref_tile->mbs;
- ref_tile++;
- }
-
- tile++;
- }
- }
-
- }// for b
- }// for p
+ ret = ivi_init_tiles(band, planes[0].bands[0].tiles,
+ p, b, t_height, t_width);
+ if (ret < 0)
+ return ret;
+ }
+ }
return 0;
}
-int ff_ivi_dec_tile_data_size(GetBitContext *gb)
+/*
+ * Decode size of the tile data.
+ * The size is stored as a variable-length field having the following format:
+ * if (tile_data_size < 255) than this field is only one byte long
+ * if (tile_data_size >= 255) than this field four is byte long: 0xFF X1 X2 X3
+ * where X1-X3 is size of the tile data
+ *
+ * @param[in,out] gb the GetBit context
+ * @return size of the tile data in bytes
+ */
+static int ivi_dec_tile_data_size(GetBitContext *gb)
{
int len;
@@ -337,25 +407,120 @@ int ff_ivi_dec_tile_data_size(GetBitContext *gb)
return len;
}
-int ff_ivi_decode_blocks(GetBitContext *gb, IVIBandDesc *band, IVITile *tile)
+
+static int ivi_decode_coded_blocks(GetBitContext *gb, IVIBandDesc *band,
+ ivi_mc_func mc, int mv_x, int mv_y,
+ int *prev_dc, int is_intra, int mc_type,
+ uint32_t quant, int offs,
+ AVCodecContext *avctx)
{
- int mbn, blk, num_blocks, num_coeffs, blk_size, scan_pos, run, val,
- pos, is_intra, mc_type, mv_x, mv_y, col_mask;
- uint8_t col_flags[8];
- int32_t prev_dc, trvec[64];
- uint32_t cbp, sym, lo, hi, quant, buf_offs, q;
- IVIMbInfo *mb;
- RVMapDesc *rvmap = band->rv_map;
- ivi_mc_func mc_with_delta_func, mc_no_delta_func;
- const uint16_t *base_tab;
- const uint8_t *scale_tab;
+ const uint16_t *base_tab = is_intra ? band->intra_base : band->inter_base;
+ RVMapDesc *rvmap = band->rv_map;
+ uint8_t col_flags[8];
+ int32_t trvec[64];
+ uint32_t sym = 0, lo, hi, q;
+ int pos, run, val;
+ int blk_size = band->blk_size;
+ int num_coeffs = blk_size * blk_size;
+ int col_mask = blk_size - 1;
+ int scan_pos = -1;
+
+ if (!band->scan) {
+ av_log(avctx, AV_LOG_ERROR, "Scan pattern is not set.\n");
+ return AVERROR_INVALIDDATA;
+ }
+
+ /* zero transform vector */
+ memset(trvec, 0, num_coeffs * sizeof(trvec[0]));
+ /* zero column flags */
+ memset(col_flags, 0, sizeof(col_flags));
+ while (scan_pos <= num_coeffs) {
+ sym = get_vlc2(gb, band->blk_vlc.tab->table,
+ IVI_VLC_BITS, 1);
+ if (sym == rvmap->eob_sym)
+ break; /* End of block */
+
+ /* Escape - run/val explicitly coded using 3 vlc codes */
+ if (sym == rvmap->esc_sym) {
+ run = get_vlc2(gb, band->blk_vlc.tab->table, IVI_VLC_BITS, 1) + 1;
+ lo = get_vlc2(gb, band->blk_vlc.tab->table, IVI_VLC_BITS, 1);
+ hi = get_vlc2(gb, band->blk_vlc.tab->table, IVI_VLC_BITS, 1);
+ /* merge them and convert into signed val */
+ val = IVI_TOSIGNED((hi << 6) | lo);
+ } else {
+ if (sym >= 256U) {
+ av_log(avctx, AV_LOG_ERROR, "Invalid sym encountered: %d.\n", sym);
+ return AVERROR_INVALIDDATA;
+ }
+ run = rvmap->runtab[sym];
+ val = rvmap->valtab[sym];
+ }
+
+ /* de-zigzag and dequantize */
+ scan_pos += run;
+ if (scan_pos >= num_coeffs || scan_pos < 0)
+ break;
+ pos = band->scan[scan_pos];
+
+ if (!val)
+ av_dlog(avctx, "Val = 0 encountered!\n");
+
+ q = (base_tab[pos] * quant) >> 9;
+ if (q > 1)
+ val = val * q + FFSIGN(val) * (((q ^ 1) - 1) >> 1);
+ trvec[pos] = val;
+ /* track columns containing non-zero coeffs */
+ col_flags[pos & col_mask] |= !!val;
+ }
+
+ if (scan_pos < 0 || scan_pos >= num_coeffs && sym != rvmap->eob_sym)
+ return AVERROR_INVALIDDATA; /* corrupt block data */
+
+ /* undoing DC coeff prediction for intra-blocks */
+ if (is_intra && band->is_2d_trans) {
+ *prev_dc += trvec[0];
+ trvec[0] = *prev_dc;
+ col_flags[0] |= !!*prev_dc;
+ }
+
+ /* apply inverse transform */
+ band->inv_transform(trvec, band->buf + offs,
+ band->pitch, col_flags);
- prev_dc = 0; /* init intra prediction for the DC coefficient */
+ /* apply motion compensation */
+ if (!is_intra)
+ return ivi_mc(mc, band->buf, band->ref_buf, offs, mv_x, mv_y,
+ band->pitch, mc_type);
+ return 0;
+}
+/*
+ * Decode block data:
+ * extract huffman-coded transform coefficients from the bitstream,
+ * dequantize them, apply inverse transform and motion compensation
+ * in order to reconstruct the picture.
+ *
+ * @param[in,out] gb the GetBit context
+ * @param[in] band pointer to the band descriptor
+ * @param[in] tile pointer to the tile descriptor
+ * @return result code: 0 - OK, -1 = error (corrupted blocks data)
+ */
+static int ivi_decode_blocks(GetBitContext *gb, IVIBandDesc *band,
+ IVITile *tile, AVCodecContext *avctx)
+{
+ int mbn, blk, num_blocks, blk_size, ret, is_intra, mc_type = 0;
+ int mv_x = 0, mv_y = 0;
+ int32_t prev_dc;
+ uint32_t cbp, quant, buf_offs;
+ IVIMbInfo *mb;
+ ivi_mc_func mc_with_delta_func, mc_no_delta_func;
+ const uint8_t *scale_tab;
+
+ /* init intra prediction for the DC coefficient */
+ prev_dc = 0;
blk_size = band->blk_size;
- col_mask = blk_size - 1; /* column mask for tracking non-zero coeffs */
- num_blocks = (band->mb_size != blk_size) ? 4 : 1; /* number of blocks per mb */
- num_coeffs = blk_size * blk_size;
+ /* number of blocks per mb */
+ num_blocks = (band->mb_size != blk_size) ? 4 : 1;
if (blk_size == 8) {
mc_with_delta_func = ff_ivi_mc_8x8_delta;
mc_no_delta_func = ff_ivi_mc_8x8_no_delta;
@@ -371,7 +536,6 @@ int ff_ivi_decode_blocks(GetBitContext *gb, IVIBandDesc *band, IVITile *tile)
quant = av_clip(band->glob_quant + mb->q_delta, 0, 23);
- base_tab = is_intra ? band->intra_base : band->inter_base;
scale_tab = is_intra ? band->intra_scale : band->inter_scale;
if (scale_tab)
quant = scale_tab[quant];
@@ -379,9 +543,7 @@ int ff_ivi_decode_blocks(GetBitContext *gb, IVIBandDesc *band, IVITile *tile)
if (!is_intra) {
mv_x = mb->mv_x;
mv_y = mb->mv_y;
- if (!band->is_halfpel) {
- mc_type = 0; /* we have only fullpel vectors */
- } else {
+ if (band->is_halfpel) {
mc_type = ((mv_y & 1) << 1) | (mv_x & 1);
mv_x >>= 1;
mv_y >>= 1; /* convert halfpel vectors into fullpel ones */
@@ -394,10 +556,10 @@ int ff_ivi_decode_blocks(GetBitContext *gb, IVIBandDesc *band, IVITile *tile)
cx = mb->mv_x & band->is_halfpel;
cy = mb->mv_y & band->is_halfpel;
- if ( mb->xpos + dmv_x < 0
- || mb->xpos + dmv_x + band->mb_size + cx > band->pitch
- || mb->ypos + dmv_y < 0
- || mb->ypos + dmv_y + band->mb_size + cy > band->aheight) {
+ if (mb->xpos + dmv_x < 0 ||
+ mb->xpos + dmv_x + band->mb_size + cx > band->pitch ||
+ mb->ypos + dmv_y < 0 ||
+ mb->ypos + dmv_y + band->mb_size + cy > band->aheight) {
return AVERROR_INVALIDDATA;
}
}
@@ -413,69 +575,11 @@ int ff_ivi_decode_blocks(GetBitContext *gb, IVIBandDesc *band, IVITile *tile)
}
if (cbp & 1) { /* block coded ? */
- if (!band->scan) {
- av_log(NULL, AV_LOG_ERROR, "Scan pattern is not set.\n");
- return AVERROR_INVALIDDATA;
- }
-
- scan_pos = -1;
- memset(trvec, 0, num_coeffs*sizeof(trvec[0])); /* zero transform vector */
- memset(col_flags, 0, sizeof(col_flags)); /* zero column flags */
-
- while (scan_pos <= num_coeffs) {
- sym = get_vlc2(gb, band->blk_vlc.tab->table, IVI_VLC_BITS, 1);
- if (sym == rvmap->eob_sym)
- break; /* End of block */
-
- if (sym == rvmap->esc_sym) { /* Escape - run/val explicitly coded using 3 vlc codes */
- run = get_vlc2(gb, band->blk_vlc.tab->table, IVI_VLC_BITS, 1) + 1;
- lo = get_vlc2(gb, band->blk_vlc.tab->table, IVI_VLC_BITS, 1);
- hi = get_vlc2(gb, band->blk_vlc.tab->table, IVI_VLC_BITS, 1);
- val = IVI_TOSIGNED((hi << 6) | lo); /* merge them and convert into signed val */
- } else {
- if (sym >= 256U) {
- av_log(NULL, AV_LOG_ERROR, "Invalid sym encountered: %d.\n", sym);
- return AVERROR_INVALIDDATA;
- }
- run = rvmap->runtab[sym];
- val = rvmap->valtab[sym];
- }
-
- /* de-zigzag and dequantize */
- scan_pos += run;
- if (scan_pos >= num_coeffs)
- break;
- pos = band->scan[scan_pos];
-
- if (!val)
- av_dlog(NULL, "Val = 0 encountered!\n");
-
- q = (base_tab[pos] * quant) >> 9;
- if (q > 1)
- val = val * q + FFSIGN(val) * (((q ^ 1) - 1) >> 1);
- trvec[pos] = val;
- col_flags[pos & col_mask] |= !!val; /* track columns containing non-zero coeffs */
- }// while
-
- if (scan_pos >= num_coeffs && sym != rvmap->eob_sym)
- return AVERROR_INVALIDDATA; /* corrupt block data */
-
- /* undoing DC coeff prediction for intra-blocks */
- if (is_intra && band->is_2d_trans) {
- prev_dc += trvec[0];
- trvec[0] = prev_dc;
- col_flags[0] |= !!prev_dc;
- }
-
- /* apply inverse transform */
- band->inv_transform(trvec, band->buf + buf_offs,
- band->pitch, col_flags);
-
- /* apply motion compensation */
- if (!is_intra)
- mc_with_delta_func(band->buf + buf_offs,
- band->ref_buf + buf_offs + mv_y * band->pitch + mv_x,
- band->pitch, mc_type);
+ ret = ivi_decode_coded_blocks(gb, band, mc_with_delta_func,
+ mv_x, mv_y, &prev_dc, is_intra,
+ mc_type, quant, buf_offs, avctx);
+ if (ret < 0)
+ return ret;
} else {
/* block not coded */
/* for intra blocks apply the dc slant transform */
@@ -484,10 +588,12 @@ int ff_ivi_decode_blocks(GetBitContext *gb, IVIBandDesc *band, IVITile *tile)
if (band->dc_transform)
band->dc_transform(&prev_dc, band->buf + buf_offs,
band->pitch, blk_size);
- } else
- mc_no_delta_func(band->buf + buf_offs,
- band->ref_buf + buf_offs + mv_y * band->pitch + mv_x,
- band->pitch, mc_type);
+ } else {
+ ret = ivi_mc(mc_no_delta_func, band->buf, band->ref_buf,
+ buf_offs, mv_x, mv_y, band->pitch, mc_type);
+ if (ret < 0)
+ return ret;
+ }
}
cbp >>= 1;
@@ -512,7 +618,7 @@ static int ivi_process_empty_tile(AVCodecContext *avctx, IVIBandDesc *band,
IVITile *tile, int32_t mv_scale)
{
int x, y, need_mc, mbn, blk, num_blocks, mv_x, mv_y, mc_type;
- int offs, mb_offset, row_offset;
+ int offs, mb_offset, row_offset, ret;
IVIMbInfo *mb, *ref_mb;
const int16_t *src;
int16_t *dst;
@@ -590,9 +696,10 @@ static int ivi_process_empty_tile(AVCodecContext *avctx, IVIBandDesc *band,
for (blk = 0; blk < num_blocks; blk++) {
/* adjust block position in the buffer according with its number */
offs = mb->buf_offs + band->blk_size * ((blk & 1) + !!(blk & 2) * band->pitch);
- mc_no_delta_func(band->buf + offs,
- band->ref_buf + offs + mv_y * band->pitch + mv_x,
- band->pitch, mc_type);
+ ret = ivi_mc(mc_no_delta_func, band->buf, band->ref_buf,
+ offs, mv_x, mv_y, band->pitch, mc_type);
+ if (ret < 0)
+ return ret;
}
}
} else {
@@ -611,7 +718,7 @@ static int ivi_process_empty_tile(AVCodecContext *avctx, IVIBandDesc *band,
#ifdef DEBUG
-uint16_t ivi_calc_band_checksum (IVIBandDesc *band)
+static uint16_t ivi_calc_band_checksum(IVIBandDesc *band)
{
int x, y;
int16_t *src, checksum;
@@ -625,34 +732,18 @@ uint16_t ivi_calc_band_checksum (IVIBandDesc *band)
return checksum;
}
-
-int ivi_check_band (IVIBandDesc *band, const uint8_t *ref, int pitch)
-{
- int x, y, result;
- uint8_t t1, t2;
- int16_t *src;
-
- src = band->buf;
- result = 0;
-
- for (y = 0; y < band->height; src += band->pitch, y++) {
- for (x = 0; x < band->width; x++) {
- t1 = av_clip(src[x] + 128, 0, 255);
- t2 = ref[x];
- if (t1 != t2) {
- av_log(NULL, AV_LOG_ERROR, "Data mismatch: row %d, column %d\n",
- y / band->blk_size, x / band->blk_size);
- result = -1;
- }
- }
- ref += pitch;
- }
-
- return result;
-}
#endif
-void ff_ivi_output_plane(IVIPlaneDesc *plane, uint8_t *dst, int dst_pitch)
+/*
+ * Convert and output the current plane.
+ * This conversion is done by adding back the bias value of 128
+ * (subtracted in the encoder) and clipping the result.
+ *
+ * @param[in] plane pointer to the descriptor of the plane being processed
+ * @param[out] dst pointer to the buffer receiving converted pixels
+ * @param[in] dst_pitch pitch for moving to the next y line
+ */
+static void ivi_output_plane(IVIPlaneDesc *plane, uint8_t *dst, int dst_pitch)
{
int x, y;
const int16_t *src = plane->bands[0].buf;
@@ -677,13 +768,17 @@ void ff_ivi_output_plane(IVIPlaneDesc *plane, uint8_t *dst, int dst_pitch)
* @param[in] avctx ptr to the AVCodecContext
* @return result code: 0 = OK, -1 = error
*/
-static int decode_band(IVI45DecContext *ctx, int plane_num,
+static int decode_band(IVI45DecContext *ctx,
IVIBandDesc *band, AVCodecContext *avctx)
{
int result, i, t, idx1, idx2, pos;
IVITile *tile;
band->buf = band->bufs[ctx->dst_buf];
+ if (!band->buf) {
+ av_log(avctx, AV_LOG_ERROR, "Band buffer points to no data!\n");
+ return AVERROR_INVALIDDATA;
+ }
band->ref_buf = band->bufs[ctx->ref_buf];
band->data_ptr = ctx->frame_data + (get_bits_count(&ctx->gb) >> 3);
@@ -727,7 +822,7 @@ static int decode_band(IVI45DecContext *ctx, int plane_num,
break;
av_dlog(avctx, "Empty tile encountered!\n");
} else {
- tile->data_size = ff_ivi_dec_tile_data_size(&ctx->gb);
+ tile->data_size = ivi_dec_tile_data_size(&ctx->gb);
if (!tile->data_size) {
av_log(avctx, AV_LOG_ERROR, "Tile data size is zero!\n");
return AVERROR_INVALIDDATA;
@@ -737,7 +832,7 @@ static int decode_band(IVI45DecContext *ctx, int plane_num,
if (result < 0)
break;
- result = ff_ivi_decode_blocks(&ctx->gb, band, tile);
+ result = ivi_decode_blocks(&ctx->gb, band, tile, avctx);
if (result < 0) {
av_log(avctx, AV_LOG_ERROR,
"Corrupted tile data encountered!\n");
@@ -755,7 +850,8 @@ static int decode_band(IVI45DecContext *ctx, int plane_num,
}
}
- /* restore the selected rvmap table by applying its corrections in reverse order */
+ /* restore the selected rvmap table by applying its corrections in
+ * reverse order */
for (i = band->num_corr-1; i >= 0; i--) {
idx1 = band->corr[i*2];
idx2 = band->corr[i*2+1];
@@ -768,7 +864,8 @@ static int decode_band(IVI45DecContext *ctx, int plane_num,
uint16_t chksum = ivi_calc_band_checksum(band);
if (chksum != band->checksum) {
av_log(avctx, AV_LOG_ERROR,
- "Band checksum mismatch! Plane %d, band %d, received: %x, calculated: %x\n",
+ "Band checksum mismatch! Plane %d, band %d, "
+ "received: %x, calculated: %x\n",
band->plane, band->band_num, band->checksum, chksum);
}
}
@@ -779,7 +876,7 @@ static int decode_band(IVI45DecContext *ctx, int plane_num,
return result;
}
-int ff_ivi_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
+int ff_ivi_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
AVPacket *avpkt)
{
IVI45DecContext *ctx = avctx->priv_data;
@@ -812,7 +909,7 @@ int ff_ivi_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
if (ctx->is_nonnull_frame(ctx)) {
for (p = 0; p < 3; p++) {
for (b = 0; b < ctx->planes[p].num_bands; b++) {
- result = decode_band(ctx, p, &ctx->planes[p].bands[b], avctx);
+ result = decode_band(ctx, &ctx->planes[p].bands[b], avctx);
if (result < 0) {
av_log(avctx, AV_LOG_ERROR,
"Error while decoding band: %d, plane: %d\n", b, p);
@@ -824,10 +921,13 @@ int ff_ivi_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
//STOP_TIMER("decode_planes"); }
- /* If the bidirectional mode is enabled, next I and the following P frame will */
- /* be sent together. Unfortunately the approach below seems to be the only way */
- /* to handle the B-frames mode. That's exactly the same Intel decoders do. */
- if (avctx->codec_id == CODEC_ID_INDEO4 && ctx->frame_type == 0/*FRAMETYPE_INTRA*/) {
+ /* If the bidirectional mode is enabled, next I and the following P
+ * frame will be sent together. Unfortunately the approach below seems
+ * to be the only way to handle the B-frames mode.
+ * That's exactly the same Intel decoders do.
+ */
+ if (avctx->codec_id == AV_CODEC_ID_INDEO4 &&
+ ctx->frame_type == 0/*FRAMETYPE_INTRA*/) {
while (get_bits(&ctx->gb, 8)); // skip version string
skip_bits_long(&ctx->gb, 64); // skip padding, TODO: implement correct 8-bytes alignment
if (get_bits_left(&ctx->gb) > 18 && show_bits(&ctx->gb, 18) == 0x3FFF8)
@@ -839,24 +939,24 @@ int ff_ivi_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
ctx->frame.reference = 0;
avcodec_set_dimensions(avctx, ctx->planes[0].width, ctx->planes[0].height);
- if ((result = avctx->get_buffer(avctx, &ctx->frame)) < 0) {
+ if ((result = ff_get_buffer(avctx, &ctx->frame)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return result;
}
if (ctx->is_scalable) {
- if (avctx->codec_id == CODEC_ID_INDEO4)
- ff_ivi_recompose_haar(&ctx->planes[0], ctx->frame.data[0], ctx->frame.linesize[0], 4);
+ if (avctx->codec_id == AV_CODEC_ID_INDEO4)
+ ff_ivi_recompose_haar(&ctx->planes[0], ctx->frame.data[0], ctx->frame.linesize[0]);
else
- ff_ivi_recompose53 (&ctx->planes[0], ctx->frame.data[0], ctx->frame.linesize[0], 4);
+ ff_ivi_recompose53 (&ctx->planes[0], ctx->frame.data[0], ctx->frame.linesize[0]);
} else {
- ff_ivi_output_plane(&ctx->planes[0], ctx->frame.data[0], ctx->frame.linesize[0]);
+ ivi_output_plane(&ctx->planes[0], ctx->frame.data[0], ctx->frame.linesize[0]);
}
- ff_ivi_output_plane(&ctx->planes[2], ctx->frame.data[1], ctx->frame.linesize[1]);
- ff_ivi_output_plane(&ctx->planes[1], ctx->frame.data[2], ctx->frame.linesize[2]);
+ ivi_output_plane(&ctx->planes[2], ctx->frame.data[1], ctx->frame.linesize[1]);
+ ivi_output_plane(&ctx->planes[1], ctx->frame.data[2], ctx->frame.linesize[2]);
- *data_size = sizeof(AVFrame);
+ *got_frame = 1;
*(AVFrame*)data = ctx->frame;
return buf_size;
@@ -869,7 +969,7 @@ av_cold int ff_ivi_decode_close(AVCodecContext *avctx)
{
IVI45DecContext *ctx = avctx->priv_data;
- ff_ivi_free_buffers(&ctx->planes[0]);
+ ivi_free_buffers(&ctx->planes[0]);
if (ctx->mb_vlc.cust_tab.table)
ff_free_vlc(&ctx->mb_vlc.cust_tab);
@@ -878,7 +978,7 @@ av_cold int ff_ivi_decode_close(AVCodecContext *avctx)
avctx->release_buffer(avctx, &ctx->frame);
#if IVI4_STREAM_ANALYSER
- if (avctx->codec_id == CODEC_ID_INDEO4) {
+ if (avctx->codec_id == AV_CODEC_ID_INDEO4) {
if (ctx->is_scalable)
av_log(avctx, AV_LOG_ERROR, "This video uses scalability mode!\n");
if (ctx->uses_tiling)
diff --git a/gst-libs/ext/libav/libavcodec/ivi_common.h b/gst-libs/ext/libav/libavcodec/ivi_common.h
index 07736f2..8ac41a5 100644
--- a/gst-libs/ext/libav/libavcodec/ivi_common.h
+++ b/gst-libs/ext/libav/libavcodec/ivi_common.h
@@ -40,7 +40,7 @@
/**
* huffman codebook descriptor
*/
-typedef struct {
+typedef struct IVIHuffDesc {
int32_t num_rows;
uint8_t xbits[16];
} IVIHuffDesc;
@@ -48,7 +48,7 @@ typedef struct {
/**
* macroblock/block huffman table descriptor
*/
-typedef struct {
+typedef struct IVIHuffTab {
int32_t tab_sel; /// index of one of the predefined tables
/// or "7" for custom one
VLC *tab; /// pointer to the table associated with tab_sel
@@ -63,9 +63,6 @@ enum {
IVI_BLK_HUFF = 1 /// Huffman table is used for coding blocks
};
-extern VLC ff_ivi_mb_vlc_tabs [8]; ///< static macroblock Huffman tables
-extern VLC ff_ivi_blk_vlc_tabs[8]; ///< static block Huffman tables
-
/**
* Common scan patterns (defined in ivi_common.c)
@@ -85,7 +82,7 @@ typedef void (DCTransformPtr) (const int32_t *in, int16_t *out, uint32_t pitch,
/**
* run-value (RLE) table descriptor
*/
-typedef struct {
+typedef struct RVMapDesc {
uint8_t eob_sym; ///< end of block symbol
uint8_t esc_sym; ///< escape symbol
uint8_t runtab[256];
@@ -98,7 +95,7 @@ extern const RVMapDesc ff_ivi_rvmap_tabs[9];
/**
* information for Indeo macroblock (16x16, 8x8 or 4x4)
*/
-typedef struct {
+typedef struct IVIMbInfo {
int16_t xpos;
int16_t ypos;
uint32_t buf_offs; ///< address in the output buffer for this mb
@@ -113,7 +110,7 @@ typedef struct {
/**
* information for Indeo tile
*/
-typedef struct {
+typedef struct IVITile {
int xpos;
int ypos;
int width;
@@ -130,7 +127,7 @@ typedef struct {
/**
* information for Indeo wavelet band
*/
-typedef struct {
+typedef struct IVIBandDesc {
int plane; ///< plane number this band belongs to
int band_num; ///< band number
int width;
@@ -177,7 +174,7 @@ typedef struct {
/**
* color plane (luma or chroma) information
*/
-typedef struct {
+typedef struct IVIPlaneDesc {
uint16_t width;
uint16_t height;
uint8_t num_bands; ///< number of bands this plane subdivided into
@@ -185,7 +182,7 @@ typedef struct {
} IVIPlaneDesc;
-typedef struct {
+typedef struct IVIPicConfig {
uint16_t pic_width;
uint16_t pic_height;
uint16_t chroma_width;
@@ -278,17 +275,6 @@ static inline int ivi_scale_mv(int mv, int mv_scale)
}
/**
- * Generate a huffman codebook from the given descriptor
- * and convert it into the Libav VLC table.
- *
- * @param[in] cb pointer to codebook descriptor
- * @param[out] vlc where to place the generated VLC table
- * @param[in] flag flag: 1 - for static or 0 for dynamic tables
- * @return result code: 0 - OK, -1 = error (invalid codebook descriptor)
- */
-int ff_ivi_create_huff_from_desc(const IVIHuffDesc *cb, VLC *vlc, int flag);
-
-/**
* Initialize static codes used for macroblock and block decoding.
*/
void ff_ivi_init_static_vlc(void);
@@ -308,23 +294,6 @@ int ff_ivi_dec_huff_desc(GetBitContext *gb, int desc_coded, int which_tab,
IVIHuffTab *huff_tab, AVCodecContext *avctx);
/**
- * Compare two huffman codebook descriptors.
- *
- * @param[in] desc1 ptr to the 1st descriptor to compare
- * @param[in] desc2 ptr to the 2nd descriptor to compare
- * @return comparison result: 0 - equal, 1 - not equal
- */
-int ff_ivi_huff_desc_cmp(const IVIHuffDesc *desc1, const IVIHuffDesc *desc2);
-
-/**
- * Copy huffman codebook descriptors.
- *
- * @param[out] dst ptr to the destination descriptor
- * @param[in] src ptr to the source descriptor
- */
-void ff_ivi_huff_desc_copy(IVIHuffDesc *dst, const IVIHuffDesc *src);
-
-/**
* Initialize planes (prepares descriptors, allocates buffers etc).
*
* @param[in,out] planes pointer to the array of the plane descriptors
@@ -334,13 +303,6 @@ void ff_ivi_huff_desc_copy(IVIHuffDesc *dst, const IVIHuffDesc *src);
int ff_ivi_init_planes(IVIPlaneDesc *planes, const IVIPicConfig *cfg);
/**
- * Free planes, bands and macroblocks buffers.
- *
- * @param[in] planes pointer to the array of the plane descriptors
- */
-void ff_ivi_free_buffers(IVIPlaneDesc *planes);
-
-/**
* Initialize tile and macroblock descriptors.
*
* @param[in,out] planes pointer to the array of the plane descriptors
@@ -350,53 +312,7 @@ void ff_ivi_free_buffers(IVIPlaneDesc *planes);
*/
int ff_ivi_init_tiles(IVIPlaneDesc *planes, int tile_width, int tile_height);
-/**
- * Decode size of the tile data.
- * The size is stored as a variable-length field having the following format:
- * if (tile_data_size < 255) than this field is only one byte long
- * if (tile_data_size >= 255) than this field four is byte long: 0xFF X1 X2 X3
- * where X1-X3 is size of the tile data
- *
- * @param[in,out] gb the GetBit context
- * @return size of the tile data in bytes
- */
-int ff_ivi_dec_tile_data_size(GetBitContext *gb);
-
-/**
- * Decode block data:
- * extract huffman-coded transform coefficients from the bitstream,
- * dequantize them, apply inverse transform and motion compensation
- * in order to reconstruct the picture.
- *
- * @param[in,out] gb the GetBit context
- * @param[in] band pointer to the band descriptor
- * @param[in] tile pointer to the tile descriptor
- * @return result code: 0 - OK, -1 = error (corrupted blocks data)
- */
-int ff_ivi_decode_blocks(GetBitContext *gb, IVIBandDesc *band, IVITile *tile);
-
-/**
- * Convert and output the current plane.
- * This conversion is done by adding back the bias value of 128
- * (subtracted in the encoder) and clipping the result.
- *
- * @param[in] plane pointer to the descriptor of the plane being processed
- * @param[out] dst pointer to the buffer receiving converted pixels
- * @param[in] dst_pitch pitch for moving to the next y line
- */
-void ff_ivi_output_plane(IVIPlaneDesc *plane, uint8_t *dst, int dst_pitch);
-
-/**
- * Calculate band checksum from band data.
- */
-uint16_t ivi_calc_band_checksum (IVIBandDesc *band);
-
-/**
- * Verify that band data lies in range.
- */
-int ivi_check_band (IVIBandDesc *band, const uint8_t *ref, int pitch);
-
-int ff_ivi_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
+int ff_ivi_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
AVPacket *avpkt);
av_cold int ff_ivi_decode_close(AVCodecContext *avctx);
diff --git a/gst-libs/ext/libav/libavcodec/ivi_dsp.c b/gst-libs/ext/libav/libavcodec/ivi_dsp.c
index caad843..3ffe84a 100644
--- a/gst-libs/ext/libav/libavcodec/ivi_dsp.c
+++ b/gst-libs/ext/libav/libavcodec/ivi_dsp.c
@@ -33,7 +33,7 @@
#include "ivi_dsp.h"
void ff_ivi_recompose53(const IVIPlaneDesc *plane, uint8_t *dst,
- const int dst_pitch, const int num_bands)
+ const int dst_pitch)
{
int x, y, indx;
int32_t p0, p1, p2, p3, tmp0, tmp1, tmp2;
@@ -41,6 +41,7 @@ void ff_ivi_recompose53(const IVIPlaneDesc *plane, uint8_t *dst,
int32_t b3_1, b3_2, b3_3, b3_4, b3_5, b3_6, b3_7, b3_8, b3_9;
int32_t pitch, back_pitch;
const IDWTELEM *b0_ptr, *b1_ptr, *b2_ptr, *b3_ptr;
+ const int num_bands = 4;
/* all bands should have the same pitch */
pitch = plane->bands[0].pitch;
@@ -179,7 +180,7 @@ void ff_ivi_recompose53(const IVIPlaneDesc *plane, uint8_t *dst,
}
void ff_ivi_recompose_haar(const IVIPlaneDesc *plane, uint8_t *dst,
- const int dst_pitch, const int num_bands)
+ const int dst_pitch)
{
int x, y, indx, b0, b1, b2, b3, p0, p1, p2, p3;
const IDWTELEM *b0_ptr, *b1_ptr, *b2_ptr, *b3_ptr;
diff --git a/gst-libs/ext/libav/libavcodec/ivi_dsp.h b/gst-libs/ext/libav/libavcodec/ivi_dsp.h
index 0438514..c46f8b2 100644
--- a/gst-libs/ext/libav/libavcodec/ivi_dsp.h
+++ b/gst-libs/ext/libav/libavcodec/ivi_dsp.h
@@ -38,10 +38,9 @@
* @param[in] plane pointer to the descriptor of the plane being processed
* @param[out] dst pointer to the destination buffer
* @param[in] dst_pitch pitch of the destination buffer
- * @param[in] num_bands number of wavelet bands to be processed
*/
void ff_ivi_recompose53(const IVIPlaneDesc *plane, uint8_t *dst,
- const int dst_pitch, const int num_bands);
+ const int dst_pitch);
/**
* Haar wavelet recomposition filter for Indeo 4
@@ -49,10 +48,9 @@ void ff_ivi_recompose53(const IVIPlaneDesc *plane, uint8_t *dst,
* @param[in] plane pointer to the descriptor of the plane being processed
* @param[out] dst pointer to the destination buffer
* @param[in] dst_pitch pitch of the destination buffer
- * @param[in] num_bands number of wavelet bands to be processed
*/
void ff_ivi_recompose_haar(const IVIPlaneDesc *plane, uint8_t *dst,
- const int dst_pitch, const int num_bands);
+ const int dst_pitch);
/**
* two-dimensional inverse Haar 8x8 transform for Indeo 4
diff --git a/gst-libs/ext/libav/libavcodec/jfdctfst.c b/gst-libs/ext/libav/libavcodec/jfdctfst.c
index b8dc407..3e30e5d 100644
--- a/gst-libs/ext/libav/libavcodec/jfdctfst.c
+++ b/gst-libs/ext/libav/libavcodec/jfdctfst.c
@@ -205,7 +205,7 @@ static av_always_inline void row_fdct(DCTELEM * data){
*/
GLOBAL(void)
-fdct_ifast (DCTELEM * data)
+ff_fdct_ifast (DCTELEM * data)
{
int tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
int tmp10, tmp11, tmp12, tmp13;
@@ -271,7 +271,7 @@ fdct_ifast (DCTELEM * data)
*/
GLOBAL(void)
-fdct_ifast248 (DCTELEM * data)
+ff_fdct_ifast248 (DCTELEM * data)
{
int tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
int tmp10, tmp11, tmp12, tmp13;
diff --git a/gst-libs/ext/libav/libavcodec/jfdctint.c b/gst-libs/ext/libav/libavcodec/jfdctint.c
index 0482bc5..ed6b7ff 100644
--- a/gst-libs/ext/libav/libavcodec/jfdctint.c
+++ b/gst-libs/ext/libav/libavcodec/jfdctint.c
@@ -1,4 +1,4 @@
-/**
+/*
* This file is part of Libav.
*
* Libav is free software; you can redistribute it and/or
diff --git a/gst-libs/ext/libav/libavcodec/jpegls.c b/gst-libs/ext/libav/libavcodec/jpegls.c
index ebe6b85..4740f11 100644
--- a/gst-libs/ext/libav/libavcodec/jpegls.c
+++ b/gst-libs/ext/libav/libavcodec/jpegls.c
@@ -85,5 +85,5 @@ void ff_jpegls_reset_coding_parameters(JLSState *s, int reset_all){
}
if(s->reset==0 || reset_all) s->reset= 64;
-// av_log(NULL, AV_LOG_DEBUG, "[JPEG-LS RESET] T=%i,%i,%i\n", s->T1, s->T2, s->T3);
+ av_dlog(NULL, "[JPEG-LS RESET] T=%i,%i,%i\n", s->T1, s->T2, s->T3);
}
diff --git a/gst-libs/ext/libav/libavcodec/jpegls.h b/gst-libs/ext/libav/libavcodec/jpegls.h
index 1c1817e..18c71a8 100644
--- a/gst-libs/ext/libav/libavcodec/jpegls.h
+++ b/gst-libs/ext/libav/libavcodec/jpegls.h
@@ -29,6 +29,7 @@
#define AVCODEC_JPEGLS_H
#include "avcodec.h"
+#include "libavutil/common.h"
typedef struct JpeglsContext{
AVCodecContext *avctx;
diff --git a/gst-libs/ext/libav/libavcodec/jpeglsdec.c b/gst-libs/ext/libav/libavcodec/jpeglsdec.c
index d234d73..f851ec0 100644
--- a/gst-libs/ext/libav/libavcodec/jpeglsdec.c
+++ b/gst-libs/ext/libav/libavcodec/jpeglsdec.c
@@ -51,10 +51,9 @@
*/
int ff_jpegls_decode_lse(MJpegDecodeContext *s)
{
- int len, id;
+ int id;
- /* XXX: verify len field validity */
- len = get_bits(&s->gb, 16);
+ skip_bits(&s->gb, 16); /* length: FIXME: verify field validity */
id = get_bits(&s->gb, 8);
switch(id){
@@ -79,7 +78,7 @@ int ff_jpegls_decode_lse(MJpegDecodeContext *s)
av_log(s->avctx, AV_LOG_ERROR, "invalid id %d\n", id);
return AVERROR_INVALIDDATA;
}
-// av_log(s->avctx, AV_LOG_DEBUG, "ID=%i, T=%i,%i,%i\n", id, s->t1, s->t2, s->t3);
+ av_dlog(s->avctx, "ID=%i, T=%i,%i,%i\n", id, s->t1, s->t2, s->t3);
return 0;
}
@@ -283,8 +282,12 @@ int ff_jpegls_decode_picture(MJpegDecodeContext *s, int near, int point_transfor
else
shift = point_transform + (16 - s->bits);
-// av_log(s->avctx, AV_LOG_DEBUG, "JPEG-LS params: %ix%i NEAR=%i MV=%i T(%i,%i,%i) RESET=%i, LIMIT=%i, qbpp=%i, RANGE=%i\n",s->width,s->height,state->near,state->maxval,state->T1,state->T2,state->T3,state->reset,state->limit,state->qbpp, state->range);
-// av_log(s->avctx, AV_LOG_DEBUG, "JPEG params: ILV=%i Pt=%i BPP=%i, scan = %i\n", ilv, point_transform, s->bits, s->cur_scan);
+ av_dlog(s->avctx, "JPEG-LS params: %ix%i NEAR=%i MV=%i T(%i,%i,%i) RESET=%i, LIMIT=%i, qbpp=%i, RANGE=%i\n",
+ s->width, s->height, state->near, state->maxval,
+ state->T1, state->T2, state->T3,
+ state->reset, state->limit, state->qbpp, state->range);
+ av_dlog(s->avctx, "JPEG params: ILV=%i Pt=%i BPP=%i, scan = %i\n",
+ ilv, point_transform, s->bits, s->cur_scan);
if(ilv == 0) { /* separate planes */
if (s->cur_scan > s->nb_components) {
ret = AVERROR_INVALIDDATA;
@@ -371,11 +374,11 @@ end:
AVCodec ff_jpegls_decoder = {
.name = "jpegls",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_JPEGLS,
+ .id = AV_CODEC_ID_JPEGLS,
.priv_data_size = sizeof(MJpegDecodeContext),
.init = ff_mjpeg_decode_init,
.close = ff_mjpeg_decode_end,
.decode = ff_mjpeg_decode_frame,
.capabilities = CODEC_CAP_DR1,
- .long_name = NULL_IF_CONFIG_SMALL("JPEG-LS"),
+ .long_name = NULL_IF_CONFIG_SMALL("JPEG-LS"),
};
diff --git a/gst-libs/ext/libav/libavcodec/jpeglsenc.c b/gst-libs/ext/libav/libavcodec/jpeglsenc.c
index 2b6e54d..fea2a5b 100644
--- a/gst-libs/ext/libav/libavcodec/jpeglsenc.c
+++ b/gst-libs/ext/libav/libavcodec/jpeglsenc.c
@@ -28,6 +28,7 @@
#include "avcodec.h"
#include "get_bits.h"
#include "golomb.h"
+#include "internal.h"
#include "mathops.h"
#include "dsputil.h"
#include "mjpeg.h"
@@ -209,8 +210,7 @@ static inline void ls_encode_line(JLSState *state, PutBitContext *pb, void *last
static void ls_store_lse(JLSState *state, PutBitContext *pb){
/* Test if we have default params and don't need to store LSE */
- JLSState state2;
- memset(&state2, 0, sizeof(JLSState));
+ JLSState state2 = { 0 };
state2.bpp = state->bpp;
state2.near = state->near;
ff_jpegls_reset_coding_parameters(&state2, 1);
@@ -227,37 +227,44 @@ static void ls_store_lse(JLSState *state, PutBitContext *pb){
put_bits(pb, 16, state->reset);
}
-static int encode_picture_ls(AVCodecContext *avctx, unsigned char *buf, int buf_size, void *data){
+static int encode_picture_ls(AVCodecContext *avctx, AVPacket *pkt,
+ const AVFrame *pict, int *got_packet)
+{
JpeglsContext * const s = avctx->priv_data;
- AVFrame *pict = data;
- AVFrame * const p= (AVFrame*)&s->picture;
+ AVFrame * const p = &s->picture;
const int near = avctx->prediction_method;
PutBitContext pb, pb2;
GetBitContext gb;
uint8_t *buf2, *zero, *cur, *last;
JLSState *state;
- int i, size;
+ int i, size, ret;
int comps;
- buf2 = av_malloc(buf_size);
-
- init_put_bits(&pb, buf, buf_size);
- init_put_bits(&pb2, buf2, buf_size);
-
*p = *pict;
p->pict_type= AV_PICTURE_TYPE_I;
p->key_frame= 1;
- if(avctx->pix_fmt == PIX_FMT_GRAY8 || avctx->pix_fmt == PIX_FMT_GRAY16)
+ if(avctx->pix_fmt == AV_PIX_FMT_GRAY8 || avctx->pix_fmt == AV_PIX_FMT_GRAY16)
comps = 1;
else
comps = 3;
+ if ((ret = ff_alloc_packet(pkt, avctx->width*avctx->height*comps*4 +
+ FF_MIN_BUFFER_SIZE)) < 0) {
+ av_log(avctx, AV_LOG_ERROR, "Error getting output packet.\n");
+ return ret;
+ }
+
+ buf2 = av_malloc(pkt->size);
+
+ init_put_bits(&pb, pkt->data, pkt->size);
+ init_put_bits(&pb2, buf2, pkt->size);
+
/* write our own JPEG header, can't use mjpeg_picture_header */
put_marker(&pb, SOI);
put_marker(&pb, SOF48);
put_bits(&pb, 16, 8 + comps * 3); // header size depends on components
- put_bits(&pb, 8, (avctx->pix_fmt == PIX_FMT_GRAY16) ? 16 : 8); // bpp
+ put_bits(&pb, 8, (avctx->pix_fmt == AV_PIX_FMT_GRAY16) ? 16 : 8); // bpp
put_bits(&pb, 16, avctx->height);
put_bits(&pb, 16, avctx->width);
put_bits(&pb, 8, comps); // components
@@ -281,7 +288,7 @@ static int encode_picture_ls(AVCodecContext *avctx, unsigned char *buf, int buf_
state = av_mallocz(sizeof(JLSState));
/* initialize JPEG-LS state from JPEG parameters */
state->near = near;
- state->bpp = (avctx->pix_fmt == PIX_FMT_GRAY16) ? 16 : 8;
+ state->bpp = (avctx->pix_fmt == AV_PIX_FMT_GRAY16) ? 16 : 8;
ff_jpegls_reset_coding_parameters(state, 0);
ff_jpegls_init_state(state);
@@ -290,7 +297,7 @@ static int encode_picture_ls(AVCodecContext *avctx, unsigned char *buf, int buf_
zero = av_mallocz(p->linesize[0]);
last = zero;
cur = p->data[0];
- if(avctx->pix_fmt == PIX_FMT_GRAY8){
+ if(avctx->pix_fmt == AV_PIX_FMT_GRAY8){
int t = 0;
for(i = 0; i < avctx->height; i++) {
@@ -299,7 +306,7 @@ static int encode_picture_ls(AVCodecContext *avctx, unsigned char *buf, int buf_
last = cur;
cur += p->linesize[0];
}
- }else if(avctx->pix_fmt == PIX_FMT_GRAY16){
+ }else if(avctx->pix_fmt == AV_PIX_FMT_GRAY16){
int t = 0;
for(i = 0; i < avctx->height; i++) {
@@ -308,7 +315,7 @@ static int encode_picture_ls(AVCodecContext *avctx, unsigned char *buf, int buf_
last = cur;
cur += p->linesize[0];
}
- }else if(avctx->pix_fmt == PIX_FMT_RGB24){
+ }else if(avctx->pix_fmt == AV_PIX_FMT_RGB24){
int j, width;
int Rc[3] = {0, 0, 0};
@@ -321,7 +328,7 @@ static int encode_picture_ls(AVCodecContext *avctx, unsigned char *buf, int buf_
last = cur;
cur += s->picture.linesize[0];
}
- }else if(avctx->pix_fmt == PIX_FMT_BGR24){
+ }else if(avctx->pix_fmt == AV_PIX_FMT_BGR24){
int j, width;
int Rc[3] = {0, 0, 0};
@@ -366,7 +373,10 @@ static int encode_picture_ls(AVCodecContext *avctx, unsigned char *buf, int buf_
emms_c();
- return put_bits_count(&pb) >> 3;
+ pkt->size = put_bits_count(&pb) >> 3;
+ pkt->flags |= AV_PKT_FLAG_KEY;
+ *got_packet = 1;
+ return 0;
}
static av_cold int encode_init_ls(AVCodecContext *ctx) {
@@ -375,7 +385,7 @@ static av_cold int encode_init_ls(AVCodecContext *ctx) {
c->avctx = ctx;
ctx->coded_frame = &c->picture;
- if(ctx->pix_fmt != PIX_FMT_GRAY8 && ctx->pix_fmt != PIX_FMT_GRAY16 && ctx->pix_fmt != PIX_FMT_RGB24 && ctx->pix_fmt != PIX_FMT_BGR24){
+ if(ctx->pix_fmt != AV_PIX_FMT_GRAY8 && ctx->pix_fmt != AV_PIX_FMT_GRAY16 && ctx->pix_fmt != AV_PIX_FMT_RGB24 && ctx->pix_fmt != AV_PIX_FMT_BGR24){
av_log(ctx, AV_LOG_ERROR, "Only grayscale and RGB24/BGR24 images are supported\n");
return -1;
}
@@ -385,10 +395,13 @@ static av_cold int encode_init_ls(AVCodecContext *ctx) {
AVCodec ff_jpegls_encoder = { //FIXME avoid MPV_* lossless JPEG should not need them
.name = "jpegls",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_JPEGLS,
+ .id = AV_CODEC_ID_JPEGLS,
.priv_data_size = sizeof(JpeglsContext),
.init = encode_init_ls,
- .encode = encode_picture_ls,
- .pix_fmts = (const enum PixelFormat[]){PIX_FMT_BGR24, PIX_FMT_RGB24, PIX_FMT_GRAY8, PIX_FMT_GRAY16, PIX_FMT_NONE},
+ .encode2 = encode_picture_ls,
+ .pix_fmts = (const enum AVPixelFormat[]){
+ AV_PIX_FMT_BGR24, AV_PIX_FMT_RGB24, AV_PIX_FMT_GRAY8, AV_PIX_FMT_GRAY16,
+ AV_PIX_FMT_NONE
+ },
.long_name = NULL_IF_CONFIG_SMALL("JPEG-LS"),
};
diff --git a/gst-libs/ext/libav/libavcodec/jrevdct.c b/gst-libs/ext/libav/libavcodec/jrevdct.c
index 5ed96da..e33558f 100644
--- a/gst-libs/ext/libav/libavcodec/jrevdct.c
+++ b/gst-libs/ext/libav/libavcodec/jrevdct.c
@@ -207,7 +207,7 @@ ones here or successive P-frames will drift too much with Reference frame coding
* Perform the inverse DCT on one block of coefficients.
*/
-void j_rev_dct(DCTBLOCK data)
+void ff_j_rev_dct(DCTBLOCK data)
{
int32_t tmp0, tmp1, tmp2, tmp3;
int32_t tmp10, tmp11, tmp12, tmp13;
@@ -940,216 +940,3 @@ void j_rev_dct(DCTBLOCK data)
dataptr++; /* advance pointer to next column */
}
}
-
-#undef DCTSIZE
-#define DCTSIZE 4
-#define DCTSTRIDE 8
-
-void j_rev_dct4(DCTBLOCK data)
-{
- int32_t tmp0, tmp1, tmp2, tmp3;
- int32_t tmp10, tmp11, tmp12, tmp13;
- int32_t z1;
- int32_t d0, d2, d4, d6;
- register DCTELEM *dataptr;
- int rowctr;
-
- /* Pass 1: process rows. */
- /* Note results are scaled up by sqrt(8) compared to a true IDCT; */
- /* furthermore, we scale the results by 2**PASS1_BITS. */
-
- data[0] += 4;
-
- dataptr = data;
-
- for (rowctr = DCTSIZE-1; rowctr >= 0; rowctr--) {
- /* Due to quantization, we will usually find that many of the input
- * coefficients are zero, especially the AC terms. We can exploit this
- * by short-circuiting the IDCT calculation for any row in which all
- * the AC terms are zero. In that case each output is equal to the
- * DC coefficient (with scale factor as needed).
- * With typical images and quantization tables, half or more of the
- * row DCT calculations can be simplified this way.
- */
-
- register int *idataptr = (int*)dataptr;
-
- d0 = dataptr[0];
- d2 = dataptr[1];
- d4 = dataptr[2];
- d6 = dataptr[3];
-
- if ((d2 | d4 | d6) == 0) {
- /* AC terms all zero */
- if (d0) {
- /* Compute a 32 bit value to assign. */
- DCTELEM dcval = (DCTELEM) (d0 << PASS1_BITS);
- register int v = (dcval & 0xffff) | ((dcval << 16) & 0xffff0000);
-
- idataptr[0] = v;
- idataptr[1] = v;
- }
-
- dataptr += DCTSTRIDE; /* advance pointer to next row */
- continue;
- }
-
- /* Even part: reverse the even part of the forward DCT. */
- /* The rotator is sqrt(2)*c(-6). */
- if (d6) {
- if (d2) {
- /* d0 != 0, d2 != 0, d4 != 0, d6 != 0 */
- z1 = MULTIPLY(d2 + d6, FIX_0_541196100);
- tmp2 = z1 + MULTIPLY(-d6, FIX_1_847759065);
- tmp3 = z1 + MULTIPLY(d2, FIX_0_765366865);
-
- tmp0 = (d0 + d4) << CONST_BITS;
- tmp1 = (d0 - d4) << CONST_BITS;
-
- tmp10 = tmp0 + tmp3;
- tmp13 = tmp0 - tmp3;
- tmp11 = tmp1 + tmp2;
- tmp12 = tmp1 - tmp2;
- } else {
- /* d0 != 0, d2 == 0, d4 != 0, d6 != 0 */
- tmp2 = MULTIPLY(-d6, FIX_1_306562965);
- tmp3 = MULTIPLY(d6, FIX_0_541196100);
-
- tmp0 = (d0 + d4) << CONST_BITS;
- tmp1 = (d0 - d4) << CONST_BITS;
-
- tmp10 = tmp0 + tmp3;
- tmp13 = tmp0 - tmp3;
- tmp11 = tmp1 + tmp2;
- tmp12 = tmp1 - tmp2;
- }
- } else {
- if (d2) {
- /* d0 != 0, d2 != 0, d4 != 0, d6 == 0 */
- tmp2 = MULTIPLY(d2, FIX_0_541196100);
- tmp3 = MULTIPLY(d2, FIX_1_306562965);
-
- tmp0 = (d0 + d4) << CONST_BITS;
- tmp1 = (d0 - d4) << CONST_BITS;
-
- tmp10 = tmp0 + tmp3;
- tmp13 = tmp0 - tmp3;
- tmp11 = tmp1 + tmp2;
- tmp12 = tmp1 - tmp2;
- } else {
- /* d0 != 0, d2 == 0, d4 != 0, d6 == 0 */
- tmp10 = tmp13 = (d0 + d4) << CONST_BITS;
- tmp11 = tmp12 = (d0 - d4) << CONST_BITS;
- }
- }
-
- /* Final output stage: inputs are tmp10..tmp13, tmp0..tmp3 */
-
- dataptr[0] = (DCTELEM) DESCALE(tmp10, CONST_BITS-PASS1_BITS);
- dataptr[1] = (DCTELEM) DESCALE(tmp11, CONST_BITS-PASS1_BITS);
- dataptr[2] = (DCTELEM) DESCALE(tmp12, CONST_BITS-PASS1_BITS);
- dataptr[3] = (DCTELEM) DESCALE(tmp13, CONST_BITS-PASS1_BITS);
-
- dataptr += DCTSTRIDE; /* advance pointer to next row */
- }
-
- /* Pass 2: process columns. */
- /* Note that we must descale the results by a factor of 8 == 2**3, */
- /* and also undo the PASS1_BITS scaling. */
-
- dataptr = data;
- for (rowctr = DCTSIZE-1; rowctr >= 0; rowctr--) {
- /* Columns of zeroes can be exploited in the same way as we did with rows.
- * However, the row calculation has created many nonzero AC terms, so the
- * simplification applies less often (typically 5% to 10% of the time).
- * On machines with very fast multiplication, it's possible that the
- * test takes more time than it's worth. In that case this section
- * may be commented out.
- */
-
- d0 = dataptr[DCTSTRIDE*0];
- d2 = dataptr[DCTSTRIDE*1];
- d4 = dataptr[DCTSTRIDE*2];
- d6 = dataptr[DCTSTRIDE*3];
-
- /* Even part: reverse the even part of the forward DCT. */
- /* The rotator is sqrt(2)*c(-6). */
- if (d6) {
- if (d2) {
- /* d0 != 0, d2 != 0, d4 != 0, d6 != 0 */
- z1 = MULTIPLY(d2 + d6, FIX_0_541196100);
- tmp2 = z1 + MULTIPLY(-d6, FIX_1_847759065);
- tmp3 = z1 + MULTIPLY(d2, FIX_0_765366865);
-
- tmp0 = (d0 + d4) << CONST_BITS;
- tmp1 = (d0 - d4) << CONST_BITS;
-
- tmp10 = tmp0 + tmp3;
- tmp13 = tmp0 - tmp3;
- tmp11 = tmp1 + tmp2;
- tmp12 = tmp1 - tmp2;
- } else {
- /* d0 != 0, d2 == 0, d4 != 0, d6 != 0 */
- tmp2 = MULTIPLY(-d6, FIX_1_306562965);
- tmp3 = MULTIPLY(d6, FIX_0_541196100);
-
- tmp0 = (d0 + d4) << CONST_BITS;
- tmp1 = (d0 - d4) << CONST_BITS;
-
- tmp10 = tmp0 + tmp3;
- tmp13 = tmp0 - tmp3;
- tmp11 = tmp1 + tmp2;
- tmp12 = tmp1 - tmp2;
- }
- } else {
- if (d2) {
- /* d0 != 0, d2 != 0, d4 != 0, d6 == 0 */
- tmp2 = MULTIPLY(d2, FIX_0_541196100);
- tmp3 = MULTIPLY(d2, FIX_1_306562965);
-
- tmp0 = (d0 + d4) << CONST_BITS;
- tmp1 = (d0 - d4) << CONST_BITS;
-
- tmp10 = tmp0 + tmp3;
- tmp13 = tmp0 - tmp3;
- tmp11 = tmp1 + tmp2;
- tmp12 = tmp1 - tmp2;
- } else {
- /* d0 != 0, d2 == 0, d4 != 0, d6 == 0 */
- tmp10 = tmp13 = (d0 + d4) << CONST_BITS;
- tmp11 = tmp12 = (d0 - d4) << CONST_BITS;
- }
- }
-
- /* Final output stage: inputs are tmp10..tmp13, tmp0..tmp3 */
-
- dataptr[DCTSTRIDE*0] = tmp10 >> (CONST_BITS+PASS1_BITS+3);
- dataptr[DCTSTRIDE*1] = tmp11 >> (CONST_BITS+PASS1_BITS+3);
- dataptr[DCTSTRIDE*2] = tmp12 >> (CONST_BITS+PASS1_BITS+3);
- dataptr[DCTSTRIDE*3] = tmp13 >> (CONST_BITS+PASS1_BITS+3);
-
- dataptr++; /* advance pointer to next column */
- }
-}
-
-void j_rev_dct2(DCTBLOCK data){
- int d00, d01, d10, d11;
-
- data[0] += 4;
- d00 = data[0+0*DCTSTRIDE] + data[1+0*DCTSTRIDE];
- d01 = data[0+0*DCTSTRIDE] - data[1+0*DCTSTRIDE];
- d10 = data[0+1*DCTSTRIDE] + data[1+1*DCTSTRIDE];
- d11 = data[0+1*DCTSTRIDE] - data[1+1*DCTSTRIDE];
-
- data[0+0*DCTSTRIDE]= (d00 + d10)>>3;
- data[1+0*DCTSTRIDE]= (d01 + d11)>>3;
- data[0+1*DCTSTRIDE]= (d00 - d10)>>3;
- data[1+1*DCTSTRIDE]= (d01 - d11)>>3;
-}
-
-void j_rev_dct1(DCTBLOCK data){
- data[0] = (data[0] + 4)>>3;
-}
-
-#undef FIX
-#undef CONST_BITS
diff --git a/gst-libs/ext/libav/libavcodec/jvdec.c b/gst-libs/ext/libav/libavcodec/jvdec.c
index f2c9752..8c919d2 100644
--- a/gst-libs/ext/libav/libavcodec/jvdec.c
+++ b/gst-libs/ext/libav/libavcodec/jvdec.c
@@ -40,8 +40,8 @@ typedef struct JvContext {
static av_cold int decode_init(AVCodecContext *avctx)
{
JvContext *s = avctx->priv_data;
- avctx->pix_fmt = PIX_FMT_PAL8;
- dsputil_init(&s->dsp, avctx);
+ avctx->pix_fmt = AV_PIX_FMT_PAL8;
+ ff_dsputil_init(&s->dsp, avctx);
return 0;
}
@@ -129,7 +129,7 @@ static inline void decode8x8(GetBitContext *gb, uint8_t *dst, int linesize, DSPC
}
static int decode_frame(AVCodecContext *avctx,
- void *data, int *data_size,
+ void *data, int *got_frame,
AVPacket *avpkt)
{
JvContext *s = avctx->priv_data;
@@ -185,7 +185,7 @@ static int decode_frame(AVCodecContext *avctx,
s->palette_has_changed = 0;
memcpy(s->frame.data[1], s->palette, AVPALETTE_SIZE);
- *data_size = sizeof(AVFrame);
+ *got_frame = 1;
*(AVFrame*)data = s->frame;
}
@@ -206,7 +206,7 @@ AVCodec ff_jv_decoder = {
.name = "jv",
.long_name = NULL_IF_CONFIG_SMALL("Bitmap Brothers JV video"),
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_JV,
+ .id = AV_CODEC_ID_JV,
.priv_data_size = sizeof(JvContext),
.init = decode_init,
.close = decode_close,
diff --git a/gst-libs/ext/libav/libavcodec/kbdwin.c b/gst-libs/ext/libav/libavcodec/kbdwin.c
index c2c1c59..3b590b3 100644
--- a/gst-libs/ext/libav/libavcodec/kbdwin.c
+++ b/gst-libs/ext/libav/libavcodec/kbdwin.c
@@ -45,4 +45,3 @@ av_cold void ff_kbd_window_init(float *window, float alpha, int n)
for (i = 0; i < n; i++)
window[i] = sqrt(local_window[i] / sum);
}
-
diff --git a/gst-libs/ext/libav/libavcodec/kgv1dec.c b/gst-libs/ext/libav/libavcodec/kgv1dec.c
index 42bbcae..fc99b21 100644
--- a/gst-libs/ext/libav/libavcodec/kgv1dec.c
+++ b/gst-libs/ext/libav/libavcodec/kgv1dec.c
@@ -24,9 +24,11 @@
* Kega Game Video decoder
*/
+#include "libavutil/common.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/imgutils.h"
#include "avcodec.h"
+#include "internal.h"
typedef struct {
AVCodecContext *avctx;
@@ -41,7 +43,8 @@ static void decode_flush(AVCodecContext *avctx)
avctx->release_buffer(avctx, &c->prev);
}
-static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt)
+static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
+ AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
const uint8_t *buf_end = buf + avpkt->size;
@@ -70,7 +73,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
maxcnt = w * h;
c->cur.reference = 3;
- if ((res = avctx->get_buffer(avctx, &c->cur)) < 0)
+ if ((res = ff_get_buffer(avctx, &c->cur)) < 0)
return res;
out = (uint16_t *) c->cur.data[0];
if (c->prev.data[0]) {
@@ -153,7 +156,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
if (outcnt - maxcnt)
av_log(avctx, AV_LOG_DEBUG, "frame finished with %d diff\n", outcnt - maxcnt);
- *data_size = sizeof(AVFrame);
+ *got_frame = 1;
*(AVFrame*)data = c->cur;
if (c->prev.data[0])
@@ -168,7 +171,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
KgvContext * const c = avctx->priv_data;
c->avctx = avctx;
- avctx->pix_fmt = PIX_FMT_RGB555;
+ avctx->pix_fmt = AV_PIX_FMT_RGB555;
avctx->flags |= CODEC_FLAG_EMU_EDGE;
return 0;
@@ -183,11 +186,12 @@ static av_cold int decode_end(AVCodecContext *avctx)
AVCodec ff_kgv1_decoder = {
.name = "kgv1",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_KGV1,
+ .id = AV_CODEC_ID_KGV1,
.priv_data_size = sizeof(KgvContext),
.init = decode_init,
.close = decode_end,
.decode = decode_frame,
.flush = decode_flush,
- .long_name = NULL_IF_CONFIG_SMALL("Kega Game Video"),
+ .long_name = NULL_IF_CONFIG_SMALL("Kega Game Video"),
+ .capabilities = CODEC_CAP_DR1,
};
diff --git a/gst-libs/ext/libav/libavcodec/kmvc.c b/gst-libs/ext/libav/libavcodec/kmvc.c
index 4ed7811..e3dcd07 100644
--- a/gst-libs/ext/libav/libavcodec/kmvc.c
+++ b/gst-libs/ext/libav/libavcodec/kmvc.c
@@ -244,7 +244,8 @@ static int kmvc_decode_inter_8x8(KmvcContext * ctx, int w, int h)
return 0;
}
-static int decode_frame(AVCodecContext * avctx, void *data, int *data_size, AVPacket *avpkt)
+static int decode_frame(AVCodecContext * avctx, void *data, int *got_frame,
+ AVPacket *avpkt)
{
KmvcContext *const ctx = avctx->priv_data;
uint8_t *out, *src;
@@ -259,7 +260,7 @@ static int decode_frame(AVCodecContext * avctx, void *data, int *data_size, AVPa
ctx->pic.reference = 1;
ctx->pic.buffer_hints = FF_BUFFER_HINTS_VALID;
- if (avctx->get_buffer(avctx, &ctx->pic) < 0) {
+ if (ff_get_buffer(avctx, &ctx->pic) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return -1;
}
@@ -345,7 +346,7 @@ static int decode_frame(AVCodecContext * avctx, void *data, int *data_size, AVPa
ctx->prev = ctx->frm1;
}
- *data_size = sizeof(AVFrame);
+ *got_frame = 1;
*(AVFrame *) data = ctx->pic;
/* always report that the buffer was completely consumed */
@@ -377,7 +378,8 @@ static av_cold int decode_init(AVCodecContext * avctx)
}
if (avctx->extradata_size < 12) {
- av_log(NULL, 0, "Extradata missing, decoding may not work properly...\n");
+ av_log(avctx, AV_LOG_WARNING,
+ "Extradata missing, decoding may not work properly...\n");
c->palsize = 127;
} else {
c->palsize = AV_RL16(avctx->extradata + 10);
@@ -396,7 +398,7 @@ static av_cold int decode_init(AVCodecContext * avctx)
c->setpal = 1;
}
- avctx->pix_fmt = PIX_FMT_PAL8;
+ avctx->pix_fmt = AV_PIX_FMT_PAL8;
return 0;
}
@@ -404,10 +406,10 @@ static av_cold int decode_init(AVCodecContext * avctx)
AVCodec ff_kmvc_decoder = {
.name = "kmvc",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_KMVC,
+ .id = AV_CODEC_ID_KMVC,
.priv_data_size = sizeof(KmvcContext),
.init = decode_init,
.decode = decode_frame,
.capabilities = CODEC_CAP_DR1,
- .long_name = NULL_IF_CONFIG_SMALL("Karl Morton's video codec"),
+ .long_name = NULL_IF_CONFIG_SMALL("Karl Morton's video codec"),
};
diff --git a/gst-libs/ext/libav/libavcodec/lagarith.c b/gst-libs/ext/libav/libavcodec/lagarith.c
index f04d89b..33dd8b0 100644
--- a/gst-libs/ext/libav/libavcodec/lagarith.c
+++ b/gst-libs/ext/libav/libavcodec/lagarith.c
@@ -30,6 +30,7 @@
#include "mathops.h"
#include "dsputil.h"
#include "lagarithrac.h"
+#include "thread.h"
enum LagarithFrameType {
FRAME_RAW = 1, /**< uncompressed */
@@ -197,8 +198,8 @@ static int lag_read_prob_header(lag_rac *rac, GetBitContext *gb)
}
/* Comment from reference source:
* if (b & 0x80 == 0) { // order of operations is 'wrong'; it has been left this way
- * // since the compression change is negligable and fixing it
- * // breaks backwards compatibilty
+ * // since the compression change is negligible and fixing it
+ * // breaks backwards compatibility
* b =- (signed int)b;
* b &= 0xFF;
* } else {
@@ -258,7 +259,7 @@ static void lag_pred_line(LagarithContext *l, uint8_t *buf,
if (line == 1) {
/* Second line, left predict first pixel, the rest of the line is median predicted
* NOTE: In the case of RGB this pixel is top predicted */
- TL = l->avctx->pix_fmt == PIX_FMT_YUV420P ? buf[-stride] : L;
+ TL = l->avctx->pix_fmt == AV_PIX_FMT_YUV420P ? buf[-stride] : L;
} else {
/* Top left is 2 rows back, last pixel */
TL = buf[width - (2 * stride) - 1];
@@ -269,6 +270,40 @@ static void lag_pred_line(LagarithContext *l, uint8_t *buf,
}
}
+static void lag_pred_line_yuy2(LagarithContext *l, uint8_t *buf,
+ int width, int stride, int line,
+ int is_luma)
+{
+ int L, TL;
+
+ if (!line) {
+ if (is_luma) {
+ buf++;
+ width--;
+ }
+ l->dsp.add_hfyu_left_prediction(buf + 1, buf + 1, width - 1, buf[0]);
+ return;
+ }
+ if (line == 1) {
+ const int HEAD = is_luma ? 4 : 2;
+ int i;
+
+ L = buf[width - stride - 1];
+ TL = buf[HEAD - stride - 1];
+ for (i = 0; i < HEAD; i++) {
+ L += buf[i];
+ buf[i] = L;
+ }
+ buf += HEAD;
+ width -= HEAD;
+ } else {
+ TL = buf[width - (2 * stride) - 1];
+ L = buf[width - stride - 1];
+ }
+ l->dsp.add_hfyu_median_prediction(buf, buf - stride, buf, width,
+ &L, &TL);
+}
+
static int lag_decode_line(LagarithContext *l, lag_rac *rac,
uint8_t *dst, int width, int stride,
int esc_count)
@@ -393,7 +428,7 @@ static int lag_decode_arith_plane(LagarithContext *l, uint8_t *dst,
if (lag_read_prob_header(&rac, &gb) < 0)
return -1;
- lag_rac_init(&rac, &gb, length - stride);
+ ff_lag_rac_init(&rac, &gb, length - stride);
for (i = 0; i < height; i++)
read += lag_decode_line(l, &rac, dst + (i * stride), width,
@@ -437,9 +472,17 @@ static int lag_decode_arith_plane(LagarithContext *l, uint8_t *dst,
return -1;
}
- for (i = 0; i < height; i++) {
- lag_pred_line(l, dst, width, stride, i);
- dst += stride;
+ if (l->avctx->pix_fmt != AV_PIX_FMT_YUV422P) {
+ for (i = 0; i < height; i++) {
+ lag_pred_line(l, dst, width, stride, i);
+ dst += stride;
+ }
+ } else {
+ for (i = 0; i < height; i++) {
+ lag_pred_line_yuy2(l, dst, width, stride, i,
+ width == l->avctx->width);
+ dst += stride;
+ }
}
return 0;
@@ -454,7 +497,7 @@ static int lag_decode_arith_plane(LagarithContext *l, uint8_t *dst,
* @return number of consumed bytes on success or negative if decode fails
*/
static int lag_decode_frame(AVCodecContext *avctx,
- void *data, int *data_size, AVPacket *avpkt)
+ void *data, int *got_frame, AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
@@ -462,14 +505,14 @@ static int lag_decode_frame(AVCodecContext *avctx,
AVFrame *const p = &l->picture;
uint8_t frametype = 0;
uint32_t offset_gu = 0, offset_bv = 0, offset_ry = 9;
- int offs[4];
+ uint32_t offs[4];
uint8_t *srcs[4], *dst;
int i, j, planes = 3;
AVFrame *picture = data;
if (p->data[0])
- avctx->release_buffer(avctx, p);
+ ff_thread_release_buffer(avctx, p);
p->reference = 0;
p->key_frame = 1;
@@ -481,9 +524,9 @@ static int lag_decode_frame(AVCodecContext *avctx,
switch (frametype) {
case FRAME_SOLID_RGBA:
- avctx->pix_fmt = PIX_FMT_RGB32;
+ avctx->pix_fmt = AV_PIX_FMT_RGB32;
- if (avctx->get_buffer(avctx, p) < 0) {
+ if (ff_thread_get_buffer(avctx, p) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return -1;
}
@@ -496,15 +539,16 @@ static int lag_decode_frame(AVCodecContext *avctx,
}
break;
case FRAME_ARITH_RGBA:
- avctx->pix_fmt = PIX_FMT_RGB32;
+ avctx->pix_fmt = AV_PIX_FMT_RGB32;
planes = 4;
offset_ry += 4;
offs[3] = AV_RL32(buf + 9);
case FRAME_ARITH_RGB24:
- if (frametype == FRAME_ARITH_RGB24)
- avctx->pix_fmt = PIX_FMT_RGB24;
+ case FRAME_U_RGB24:
+ if (frametype == FRAME_ARITH_RGB24 || frametype == FRAME_U_RGB24)
+ avctx->pix_fmt = AV_PIX_FMT_RGB24;
- if (avctx->get_buffer(avctx, p) < 0) {
+ if (ff_thread_get_buffer(avctx, p) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return -1;
}
@@ -515,7 +559,7 @@ static int lag_decode_frame(AVCodecContext *avctx,
if (!l->rgb_planes) {
l->rgb_stride = FFALIGN(avctx->width, 16);
- l->rgb_planes = av_malloc(l->rgb_stride * avctx->height * planes);
+ l->rgb_planes = av_malloc(l->rgb_stride * avctx->height * planes + 1);
if (!l->rgb_planes) {
av_log(avctx, AV_LOG_ERROR, "cannot allocate temporary buffer\n");
return AVERROR(ENOMEM);
@@ -561,10 +605,36 @@ static int lag_decode_frame(AVCodecContext *avctx,
srcs[i] += l->rgb_stride;
}
break;
+ case FRAME_ARITH_YUY2:
+ avctx->pix_fmt = AV_PIX_FMT_YUV422P;
+
+ if (ff_thread_get_buffer(avctx, p) < 0) {
+ av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
+ return -1;
+ }
+
+ if (offset_ry >= buf_size ||
+ offset_gu >= buf_size ||
+ offset_bv >= buf_size) {
+ av_log(avctx, AV_LOG_ERROR,
+ "Invalid frame offsets\n");
+ return AVERROR_INVALIDDATA;
+ }
+
+ lag_decode_arith_plane(l, p->data[0], avctx->width, avctx->height,
+ p->linesize[0], buf + offset_ry,
+ buf_size - offset_ry);
+ lag_decode_arith_plane(l, p->data[1], avctx->width / 2,
+ avctx->height, p->linesize[1],
+ buf + offset_gu, buf_size - offset_gu);
+ lag_decode_arith_plane(l, p->data[2], avctx->width / 2,
+ avctx->height, p->linesize[2],
+ buf + offset_bv, buf_size - offset_bv);
+ break;
case FRAME_ARITH_YV12:
- avctx->pix_fmt = PIX_FMT_YUV420P;
+ avctx->pix_fmt = AV_PIX_FMT_YUV420P;
- if (avctx->get_buffer(avctx, p) < 0) {
+ if (ff_thread_get_buffer(avctx, p) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return -1;
}
@@ -594,7 +664,7 @@ static int lag_decode_frame(AVCodecContext *avctx,
}
*picture = *p;
- *data_size = sizeof(AVFrame);
+ *got_frame = 1;
return buf_size;
}
@@ -604,7 +674,7 @@ static av_cold int lag_decode_init(AVCodecContext *avctx)
LagarithContext *l = avctx->priv_data;
l->avctx = avctx;
- dsputil_init(&l->dsp, avctx);
+ ff_dsputil_init(&l->dsp, avctx);
return 0;
}
@@ -614,7 +684,7 @@ static av_cold int lag_decode_end(AVCodecContext *avctx)
LagarithContext *l = avctx->priv_data;
if (l->picture.data[0])
- avctx->release_buffer(avctx, &l->picture);
+ ff_thread_release_buffer(avctx, &l->picture);
av_freep(&l->rgb_planes);
return 0;
@@ -623,11 +693,11 @@ static av_cold int lag_decode_end(AVCodecContext *avctx)
AVCodec ff_lagarith_decoder = {
.name = "lagarith",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_LAGARITH,
+ .id = AV_CODEC_ID_LAGARITH,
.priv_data_size = sizeof(LagarithContext),
.init = lag_decode_init,
.close = lag_decode_end,
.decode = lag_decode_frame,
- .capabilities = CODEC_CAP_DR1,
- .long_name = NULL_IF_CONFIG_SMALL("Lagarith lossless"),
+ .capabilities = CODEC_CAP_DR1 | CODEC_CAP_FRAME_THREADS,
+ .long_name = NULL_IF_CONFIG_SMALL("Lagarith lossless"),
};
diff --git a/gst-libs/ext/libav/libavcodec/lagarithrac.c b/gst-libs/ext/libav/libavcodec/lagarithrac.c
index f85e012..edfb18f 100644
--- a/gst-libs/ext/libav/libavcodec/lagarithrac.c
+++ b/gst-libs/ext/libav/libavcodec/lagarithrac.c
@@ -30,7 +30,7 @@
#include "get_bits.h"
#include "lagarithrac.h"
-void lag_rac_init(lag_rac *l, GetBitContext *gb, int length)
+void ff_lag_rac_init(lag_rac *l, GetBitContext *gb, int length)
{
int i, j, left;
diff --git a/gst-libs/ext/libav/libavcodec/lagarithrac.h b/gst-libs/ext/libav/libavcodec/lagarithrac.h
index b942199..e4f066e 100644
--- a/gst-libs/ext/libav/libavcodec/lagarithrac.h
+++ b/gst-libs/ext/libav/libavcodec/lagarithrac.h
@@ -51,7 +51,7 @@ typedef struct lag_rac {
uint8_t range_hash[256]; /**< Hash table mapping upper byte to approximate symbol. */
} lag_rac;
-void lag_rac_init(lag_rac *l, GetBitContext *gb, int length);
+void ff_lag_rac_init(lag_rac *l, GetBitContext *gb, int length);
/* TODO: Optimize */
static inline void lag_rac_refill(lag_rac *l)
@@ -107,6 +107,9 @@ static inline uint8_t lag_get_rac(lag_rac *l)
l->range -= range_scaled * l->prob[255];
}
+ if (!l->range)
+ l->range = 0x80;
+
l->low -= range_scaled * l->prob[val];
return val;
diff --git a/gst-libs/ext/libav/libavcodec/latm_parser.c b/gst-libs/ext/libav/libavcodec/latm_parser.c
index bd941f6..6fdb897 100644
--- a/gst-libs/ext/libav/libavcodec/latm_parser.c
+++ b/gst-libs/ext/libav/libavcodec/latm_parser.c
@@ -106,7 +106,7 @@ static int latm_parse(AVCodecParserContext *s1, AVCodecContext *avctx,
}
AVCodecParser ff_aac_latm_parser = {
- .codec_ids = { CODEC_ID_AAC_LATM },
+ .codec_ids = { AV_CODEC_ID_AAC_LATM },
.priv_data_size = sizeof(LATMParseContext),
.parser_parse = latm_parse,
.parser_close = ff_parse_close
diff --git a/gst-libs/ext/libav/libavcodec/lcldec.c b/gst-libs/ext/libav/libavcodec/lcldec.c
index 679824c..f78401d 100644
--- a/gst-libs/ext/libav/libavcodec/lcldec.c
+++ b/gst-libs/ext/libav/libavcodec/lcldec.c
@@ -41,10 +41,11 @@
#include <stdio.h>
#include <stdlib.h>
+#include "libavutil/mem.h"
#include "avcodec.h"
#include "bytestream.h"
+#include "internal.h"
#include "lcl.h"
-#include "libavutil/lzo.h"
#if CONFIG_ZLIB_DECODER
#include <zlib.h>
@@ -157,7 +158,7 @@ static int zlib_decomp(AVCodecContext *avctx, const uint8_t *src, int src_len, i
* Decode a frame
*
*/
-static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt)
+static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
@@ -180,7 +181,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
c->pic.reference = 0;
c->pic.buffer_hints = FF_BUFFER_HINTS_VALID;
- if(avctx->get_buffer(avctx, &c->pic) < 0){
+ if(ff_get_buffer(avctx, &c->pic) < 0){
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return -1;
}
@@ -189,7 +190,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
/* Decompress frame */
switch (avctx->codec_id) {
- case CODEC_ID_MSZH:
+ case AV_CODEC_ID_MSZH:
switch (c->compression) {
case COMP_MSZH:
if (c->flags & FLAG_MULTITHREAD) {
@@ -252,14 +253,19 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
}
break;
#if CONFIG_ZLIB_DECODER
- case CODEC_ID_ZLIB:
+ case AV_CODEC_ID_ZLIB:
/* Using the original dll with normal compression (-1) and RGB format
* gives a file with ZLIB fourcc, but frame is really uncompressed.
* To be sure that's true check also frame size */
if (c->compression == COMP_ZLIB_NORMAL && c->imgtype == IMGTYPE_RGB24 &&
- len == width * height * 3)
- break;
- if (c->flags & FLAG_MULTITHREAD) {
+ len == width * height * 3) {
+ if (c->flags & FLAG_PNGFILTER) {
+ memcpy(c->decomp_buf, encoded, len);
+ encoded = c->decomp_buf;
+ } else {
+ break;
+ }
+ } else if (c->flags & FLAG_MULTITHREAD) {
int ret;
mthread_inlen = AV_RL32(encoded);
mthread_inlen = FFMIN(mthread_inlen, len - 8);
@@ -285,7 +291,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
/* Apply PNG filter */
- if (avctx->codec_id == CODEC_ID_ZLIB && (c->flags & FLAG_PNGFILTER)) {
+ if (avctx->codec_id == AV_CODEC_ID_ZLIB && (c->flags & FLAG_PNGFILTER)) {
switch (c->imgtype) {
case IMGTYPE_YUV111:
case IMGTYPE_RGB24:
@@ -455,7 +461,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
return -1;
}
- *data_size = sizeof(AVFrame);
+ *got_frame = 1;
*(AVFrame*)data = c->pic;
/* always report that the buffer was completely consumed */
@@ -471,7 +477,8 @@ static av_cold int decode_init(AVCodecContext *avctx)
{
LclDecContext * const c = avctx->priv_data;
unsigned int basesize = avctx->width * avctx->height;
- unsigned int max_basesize = FFALIGN(avctx->width, 4) * FFALIGN(avctx->height, 4) + AV_LZO_OUTPUT_PADDING;
+ unsigned int max_basesize = FFALIGN(avctx->width, 4) *
+ FFALIGN(avctx->height, 4);
unsigned int max_decomp_size;
if (avctx->extradata_size < 8) {
@@ -480,8 +487,8 @@ static av_cold int decode_init(AVCodecContext *avctx)
}
/* Check codec type */
- if ((avctx->codec_id == CODEC_ID_MSZH && avctx->extradata[7] != CODEC_MSZH) ||
- (avctx->codec_id == CODEC_ID_ZLIB && avctx->extradata[7] != CODEC_ZLIB)) {
+ if ((avctx->codec_id == AV_CODEC_ID_MSZH && avctx->extradata[7] != CODEC_MSZH) ||
+ (avctx->codec_id == AV_CODEC_ID_ZLIB && avctx->extradata[7] != CODEC_ZLIB)) {
av_log(avctx, AV_LOG_ERROR, "Codec id and codec type mismatch. This should not happen.\n");
}
@@ -490,37 +497,37 @@ static av_cold int decode_init(AVCodecContext *avctx)
case IMGTYPE_YUV111:
c->decomp_size = basesize * 3;
max_decomp_size = max_basesize * 3;
- avctx->pix_fmt = PIX_FMT_YUV444P;
+ avctx->pix_fmt = AV_PIX_FMT_YUV444P;
av_log(avctx, AV_LOG_DEBUG, "Image type is YUV 1:1:1.\n");
break;
case IMGTYPE_YUV422:
c->decomp_size = basesize * 2;
max_decomp_size = max_basesize * 2;
- avctx->pix_fmt = PIX_FMT_YUV422P;
+ avctx->pix_fmt = AV_PIX_FMT_YUV422P;
av_log(avctx, AV_LOG_DEBUG, "Image type is YUV 4:2:2.\n");
break;
case IMGTYPE_RGB24:
c->decomp_size = basesize * 3;
max_decomp_size = max_basesize * 3;
- avctx->pix_fmt = PIX_FMT_BGR24;
+ avctx->pix_fmt = AV_PIX_FMT_BGR24;
av_log(avctx, AV_LOG_DEBUG, "Image type is RGB 24.\n");
break;
case IMGTYPE_YUV411:
c->decomp_size = basesize / 2 * 3;
max_decomp_size = max_basesize / 2 * 3;
- avctx->pix_fmt = PIX_FMT_YUV411P;
+ avctx->pix_fmt = AV_PIX_FMT_YUV411P;
av_log(avctx, AV_LOG_DEBUG, "Image type is YUV 4:1:1.\n");
break;
case IMGTYPE_YUV211:
c->decomp_size = basesize * 2;
max_decomp_size = max_basesize * 2;
- avctx->pix_fmt = PIX_FMT_YUV422P;
+ avctx->pix_fmt = AV_PIX_FMT_YUV422P;
av_log(avctx, AV_LOG_DEBUG, "Image type is YUV 2:1:1.\n");
break;
case IMGTYPE_YUV420:
c->decomp_size = basesize / 2 * 3;
max_decomp_size = max_basesize / 2 * 3;
- avctx->pix_fmt = PIX_FMT_YUV420P;
+ avctx->pix_fmt = AV_PIX_FMT_YUV420P;
av_log(avctx, AV_LOG_DEBUG, "Image type is YUV 4:2:0.\n");
break;
default:
@@ -531,7 +538,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
/* Detect compression method */
c->compression = (int8_t)avctx->extradata[5];
switch (avctx->codec_id) {
- case CODEC_ID_MSZH:
+ case AV_CODEC_ID_MSZH:
switch (c->compression) {
case COMP_MSZH:
av_log(avctx, AV_LOG_DEBUG, "Compression enabled.\n");
@@ -546,7 +553,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
}
break;
#if CONFIG_ZLIB_DECODER
- case CODEC_ID_ZLIB:
+ case AV_CODEC_ID_ZLIB:
switch (c->compression) {
case COMP_ZLIB_HISPEED:
av_log(avctx, AV_LOG_DEBUG, "High speed compression.\n");
@@ -585,14 +592,14 @@ static av_cold int decode_init(AVCodecContext *avctx)
av_log(avctx, AV_LOG_DEBUG, "Multithread encoder flag set.\n");
if (c->flags & FLAG_NULLFRAME)
av_log(avctx, AV_LOG_DEBUG, "Nullframe insertion flag set.\n");
- if (avctx->codec_id == CODEC_ID_ZLIB && (c->flags & FLAG_PNGFILTER))
+ if (avctx->codec_id == AV_CODEC_ID_ZLIB && (c->flags & FLAG_PNGFILTER))
av_log(avctx, AV_LOG_DEBUG, "PNG filter flag set.\n");
if (c->flags & FLAGMASK_UNUSED)
av_log(avctx, AV_LOG_ERROR, "Unknown flag set (%d).\n", c->flags);
/* If needed init zlib */
#if CONFIG_ZLIB_DECODER
- if (avctx->codec_id == CODEC_ID_ZLIB) {
+ if (avctx->codec_id == AV_CODEC_ID_ZLIB) {
int zret;
c->zstream.zalloc = Z_NULL;
c->zstream.zfree = Z_NULL;
@@ -622,7 +629,7 @@ static av_cold int decode_end(AVCodecContext *avctx)
if (c->pic.data[0])
avctx->release_buffer(avctx, &c->pic);
#if CONFIG_ZLIB_DECODER
- if (avctx->codec_id == CODEC_ID_ZLIB)
+ if (avctx->codec_id == AV_CODEC_ID_ZLIB)
inflateEnd(&c->zstream);
#endif
@@ -633,13 +640,13 @@ static av_cold int decode_end(AVCodecContext *avctx)
AVCodec ff_mszh_decoder = {
.name = "mszh",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_MSZH,
+ .id = AV_CODEC_ID_MSZH,
.priv_data_size = sizeof(LclDecContext),
.init = decode_init,
.close = decode_end,
.decode = decode_frame,
.capabilities = CODEC_CAP_DR1,
- .long_name = NULL_IF_CONFIG_SMALL("LCL (LossLess Codec Library) MSZH"),
+ .long_name = NULL_IF_CONFIG_SMALL("LCL (LossLess Codec Library) MSZH"),
};
#endif
@@ -647,12 +654,12 @@ AVCodec ff_mszh_decoder = {
AVCodec ff_zlib_decoder = {
.name = "zlib",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_ZLIB,
+ .id = AV_CODEC_ID_ZLIB,
.priv_data_size = sizeof(LclDecContext),
.init = decode_init,
.close = decode_end,
.decode = decode_frame,
.capabilities = CODEC_CAP_DR1,
- .long_name = NULL_IF_CONFIG_SMALL("LCL (LossLess Codec Library) ZLIB"),
+ .long_name = NULL_IF_CONFIG_SMALL("LCL (LossLess Codec Library) ZLIB"),
};
#endif
diff --git a/gst-libs/ext/libav/libavcodec/lclenc.c b/gst-libs/ext/libav/libavcodec/lclenc.c
index 4c902d5..0fb303c 100644
--- a/gst-libs/ext/libav/libavcodec/lclenc.c
+++ b/gst-libs/ext/libav/libavcodec/lclenc.c
@@ -43,6 +43,8 @@
#include "avcodec.h"
#include "lcl.h"
+#include "libavutil/internal.h"
+#include "libavutil/mem.h"
#include <zlib.h>
@@ -68,18 +70,26 @@ typedef struct LclEncContext {
* Encode a frame
*
*/
-static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size, void *data){
+static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
+ const AVFrame *pict, int *got_packet)
+{
LclEncContext *c = avctx->priv_data;
- AVFrame *pict = data;
AVFrame * const p = &c->pic;
- int i;
+ int i, ret;
int zret; // Zlib return code
+ int max_size = deflateBound(&c->zstream, avctx->width * avctx->height * 3);
+
+ if (!pkt->data &&
+ (ret = av_new_packet(pkt, max_size)) < 0) {
+ av_log(avctx, AV_LOG_ERROR, "Error allocating packet of size %d.\n", max_size);
+ return ret;
+ }
*p = *pict;
p->pict_type= AV_PICTURE_TYPE_I;
p->key_frame= 1;
- if(avctx->pix_fmt != PIX_FMT_BGR24){
+ if(avctx->pix_fmt != AV_PIX_FMT_BGR24){
av_log(avctx, AV_LOG_ERROR, "Format not supported!\n");
return -1;
}
@@ -89,8 +99,8 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size,
av_log(avctx, AV_LOG_ERROR, "Deflate reset error: %d\n", zret);
return -1;
}
- c->zstream.next_out = buf;
- c->zstream.avail_out = buf_size;
+ c->zstream.next_out = pkt->data;
+ c->zstream.avail_out = pkt->size;
for(i = avctx->height - 1; i >= 0; i--) {
c->zstream.next_in = p->data[0]+p->linesize[0]*i;
@@ -107,7 +117,11 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size,
return -1;
}
- return c->zstream.total_out;
+ pkt->size = c->zstream.total_out;
+ pkt->flags |= AV_PKT_FLAG_KEY;
+ *got_packet = 1;
+
+ return 0;
}
/*
@@ -173,11 +187,11 @@ static av_cold int encode_end(AVCodecContext *avctx)
AVCodec ff_zlib_encoder = {
.name = "zlib",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_ZLIB,
+ .id = AV_CODEC_ID_ZLIB,
.priv_data_size = sizeof(LclEncContext),
.init = encode_init,
- .encode = encode_frame,
+ .encode2 = encode_frame,
.close = encode_end,
- .pix_fmts = (const enum PixelFormat[]) { PIX_FMT_BGR24, PIX_FMT_NONE },
- .long_name = NULL_IF_CONFIG_SMALL("LCL (LossLess Codec Library) ZLIB"),
+ .pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_BGR24, AV_PIX_FMT_NONE },
+ .long_name = NULL_IF_CONFIG_SMALL("LCL (LossLess Codec Library) ZLIB"),
};
diff --git a/gst-libs/ext/libav/libavcodec/libavcodec.v b/gst-libs/ext/libav/libavcodec/libavcodec.v
index a9e7674..0e1c2e1 100644
--- a/gst-libs/ext/libav/libavcodec/libavcodec.v
+++ b/gst-libs/ext/libav/libavcodec/libavcodec.v
@@ -2,7 +2,5 @@ LIBAVCODEC_$MAJOR {
global: av*;
audio_resample;
audio_resample_close;
- #deprecated, remove after next bump
- img_get_alpha_info;
local: *;
};
diff --git a/gst-libs/ext/libav/libavcodec/libdirac.h b/gst-libs/ext/libav/libavcodec/libdirac.h
deleted file mode 100644
index 4403fb2..0000000
--- a/gst-libs/ext/libav/libavcodec/libdirac.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2008 BBC, Anuradha Suraparaju <asuraparaju at gmail dot com >
- *
- * 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
-* data structures common to libdirac encoder and decoder
-*/
-
-#ifndef AVCODEC_LIBDIRAC_H
-#define AVCODEC_LIBDIRAC_H
-
-#include "avcodec.h"
-#include <libdirac_common/dirac_types.h>
-
-/**
-* Table providing a Dirac chroma format to Libav pixel format mapping.
-*/
-static const struct {
- enum PixelFormat ff_pix_fmt;
- dirac_chroma_t dirac_pix_fmt;
-} dirac_pixel_format_map[] = {
- { PIX_FMT_YUV420P, format420 },
- { PIX_FMT_YUV422P, format422 },
- { PIX_FMT_YUV444P, format444 },
-};
-
-#endif /* AVCODEC_LIBDIRAC_H */
diff --git a/gst-libs/ext/libav/libavcodec/libdirac_libschro.c b/gst-libs/ext/libav/libavcodec/libdirac_libschro.c
deleted file mode 100644
index 45b5b83..0000000
--- a/gst-libs/ext/libav/libavcodec/libdirac_libschro.c
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Copyright (c) 2008 BBC, Anuradha Suraparaju <asuraparaju at gmail dot com >
- *
- * 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
-* functions common to libdirac and libschroedinger
-*/
-
-#include "libdirac_libschro.h"
-
-static const DiracSchroVideoFormatInfo ff_dirac_schro_video_format_info[] = {
- { 640, 480, 24000, 1001},
- { 176, 120, 15000, 1001},
- { 176, 144, 25, 2 },
- { 352, 240, 15000, 1001},
- { 352, 288, 25, 2 },
- { 704, 480, 15000, 1001},
- { 704, 576, 25, 2 },
- { 720, 480, 30000, 1001},
- { 720, 576, 25, 1 },
- { 1280, 720, 60000, 1001},
- { 1280, 720, 50, 1 },
- { 1920, 1080, 30000, 1001},
- { 1920, 1080, 25, 1 },
- { 1920, 1080, 60000, 1001},
- { 1920, 1080, 50, 1 },
- { 2048, 1080, 24, 1 },
- { 4096, 2160, 24, 1 },
-};
-
-unsigned int ff_dirac_schro_get_video_format_idx(AVCodecContext *avccontext)
-{
- unsigned int ret_idx = 0;
- unsigned int idx;
- unsigned int num_formats = sizeof(ff_dirac_schro_video_format_info) /
- sizeof(ff_dirac_schro_video_format_info[0]);
-
- for (idx = 1; idx < num_formats; ++idx) {
- const DiracSchroVideoFormatInfo *vf = &ff_dirac_schro_video_format_info[idx];
- if (avccontext->width == vf->width &&
- avccontext->height == vf->height) {
- ret_idx = idx;
- if (avccontext->time_base.den == vf->frame_rate_num &&
- avccontext->time_base.num == vf->frame_rate_denom)
- return idx;
- }
- }
- return ret_idx;
-}
-
-void ff_dirac_schro_queue_init(DiracSchroQueue *queue)
-{
- queue->p_head = queue->p_tail = NULL;
- queue->size = 0;
-}
-
-void ff_dirac_schro_queue_free(DiracSchroQueue *queue,
- void (*free_func)(void *))
-{
- while (queue->p_head)
- free_func(ff_dirac_schro_queue_pop(queue));
-}
-
-int ff_dirac_schro_queue_push_back(DiracSchroQueue *queue, void *p_data)
-{
- DiracSchroQueueElement *p_new = av_mallocz(sizeof(DiracSchroQueueElement));
-
- if (!p_new)
- return -1;
-
- p_new->data = p_data;
-
- if (!queue->p_head)
- queue->p_head = p_new;
- else
- queue->p_tail->next = p_new;
- queue->p_tail = p_new;
-
- ++queue->size;
- return 0;
-}
-
-void *ff_dirac_schro_queue_pop(DiracSchroQueue *queue)
-{
- DiracSchroQueueElement *top = queue->p_head;
-
- if (top) {
- void *data = top->data;
- queue->p_head = queue->p_head->next;
- --queue->size;
- av_freep(&top);
- return data;
- }
-
- return NULL;
-}
diff --git a/gst-libs/ext/libav/libavcodec/libdirac_libschro.h b/gst-libs/ext/libav/libavcodec/libdirac_libschro.h
deleted file mode 100644
index a80558f..0000000
--- a/gst-libs/ext/libav/libavcodec/libdirac_libschro.h
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * Copyright (c) 2008 BBC, Anuradha Suraparaju <asuraparaju at gmail dot com >
- *
- * 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
-* data structures common to libdirac and libschroedinger
-*/
-
-#ifndef AVCODEC_LIBDIRAC_LIBSCHRO_H
-#define AVCODEC_LIBDIRAC_LIBSCHRO_H
-
-#include "avcodec.h"
-
-typedef struct {
- uint16_t width;
- uint16_t height;
- uint16_t frame_rate_num;
- uint16_t frame_rate_denom;
-} DiracSchroVideoFormatInfo;
-
-/**
-* Returns the index into the Dirac Schro common video format info table
-*/
-unsigned int ff_dirac_schro_get_video_format_idx(AVCodecContext *avccontext);
-
-/**
-* contains a single encoded frame returned from Dirac or Schroedinger
-*/
-typedef struct DiracSchroEncodedFrame {
- /** encoded frame data */
- uint8_t *p_encbuf;
-
- /** encoded frame size */
- uint32_t size;
-
- /** encoded frame number. Will be used as pts */
- uint32_t frame_num;
-
- /** key frame flag. 1 : is key frame , 0 : in not key frame */
- uint16_t key_frame;
-} DiracSchroEncodedFrame;
-
-/**
-* queue element
-*/
-typedef struct DiracSchroQueueElement {
- /** Data to be stored in queue*/
- void *data;
- /** Pointer to next element queue */
- struct DiracSchroQueueElement *next;
-} DiracSchroQueueElement;
-
-
-/**
-* A simple queue implementation used in libdirac and libschroedinger
-*/
-typedef struct DiracSchroQueue {
- /** Pointer to head of queue */
- DiracSchroQueueElement *p_head;
- /** Pointer to tail of queue */
- DiracSchroQueueElement *p_tail;
- /** Queue size*/
- int size;
-} DiracSchroQueue;
-
-/**
-* Initialise the queue
-*/
-void ff_dirac_schro_queue_init(DiracSchroQueue *queue);
-
-/**
-* Add an element to the end of the queue
-*/
-int ff_dirac_schro_queue_push_back(DiracSchroQueue *queue, void *p_data);
-
-/**
-* Return the first element in the queue
-*/
-void *ff_dirac_schro_queue_pop(DiracSchroQueue *queue);
-
-/**
-* Free the queue resources. free_func is a function supplied by the caller to
-* free any resources allocated by the caller. The data field of the queue
-* element is passed to it.
-*/
-void ff_dirac_schro_queue_free(DiracSchroQueue *queue,
- void (*free_func)(void *));
-#endif /* AVCODEC_LIBDIRAC_LIBSCHRO_H */
diff --git a/gst-libs/ext/libav/libavcodec/libdiracdec.c b/gst-libs/ext/libav/libavcodec/libdiracdec.c
deleted file mode 100644
index 6565171..0000000
--- a/gst-libs/ext/libav/libavcodec/libdiracdec.c
+++ /dev/null
@@ -1,208 +0,0 @@
-/*
- * Dirac decoder support via libdirac library
- * Copyright (c) 2005 BBC, Andrew Kennedy <dirac at rd dot bbc dot co dot uk>
- * Copyright (c) 2006-2008 BBC, Anuradha Suraparaju <asuraparaju at gmail dot com >
- *
- * 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
-* Dirac decoder support via libdirac library; more details about the Dirac
-* project can be found at http://dirac.sourceforge.net/.
-* The libdirac_decoder library implements Dirac specification version 2.2
-* (http://dirac.sourceforge.net/specification.html).
-*/
-
-#include "libavutil/imgutils.h"
-#include "libdirac.h"
-
-#undef NDEBUG
-#include <assert.h>
-
-#include <libdirac_decoder/dirac_parser.h>
-
-/** contains a single frame returned from Dirac */
-typedef struct DiracDecoderParams {
- /** decoder handle */
- dirac_decoder_t* p_decoder;
-
- /** buffer to hold decoded frame */
- unsigned char* p_out_frame_buf;
-} DiracDecoderParams;
-
-
-/**
-* returns Libav chroma format
-*/
-static enum PixelFormat get_chroma_format(dirac_chroma_t dirac_pix_fmt)
-{
- int num_formats = sizeof(dirac_pixel_format_map) /
- sizeof(dirac_pixel_format_map[0]);
- int idx;
-
- for (idx = 0; idx < num_formats; ++idx)
- if (dirac_pixel_format_map[idx].dirac_pix_fmt == dirac_pix_fmt)
- return dirac_pixel_format_map[idx].ff_pix_fmt;
- return PIX_FMT_NONE;
-}
-
-static av_cold int libdirac_decode_init(AVCodecContext *avccontext)
-{
-
- DiracDecoderParams *p_dirac_params = avccontext->priv_data;
- p_dirac_params->p_decoder = dirac_decoder_init(avccontext->debug);
-
- if (!p_dirac_params->p_decoder)
- return -1;
-
- return 0;
-}
-
-static int libdirac_decode_frame(AVCodecContext *avccontext,
- void *data, int *data_size,
- AVPacket *avpkt)
-{
- const uint8_t *buf = avpkt->data;
- int buf_size = avpkt->size;
-
- DiracDecoderParams *p_dirac_params = avccontext->priv_data;
- AVPicture *picture = data;
- AVPicture pic;
- int pict_size;
- unsigned char *buffer[3];
-
- *data_size = 0;
-
- if (buf_size > 0) {
- /* set data to decode into buffer */
- dirac_buffer(p_dirac_params->p_decoder, buf, buf + buf_size);
- if ((buf[4] & 0x08) == 0x08 && (buf[4] & 0x03))
- avccontext->has_b_frames = 1;
- }
- while (1) {
- /* parse data and process result */
- DecoderState state = dirac_parse(p_dirac_params->p_decoder);
- switch (state) {
- case STATE_BUFFER:
- return buf_size;
-
- case STATE_SEQUENCE:
- {
- /* tell Libav about sequence details */
- dirac_sourceparams_t *src_params = &p_dirac_params->p_decoder->src_params;
-
- if (av_image_check_size(src_params->width, src_params->height,
- 0, avccontext) < 0) {
- av_log(avccontext, AV_LOG_ERROR, "Invalid dimensions (%dx%d)\n",
- src_params->width, src_params->height);
- avccontext->height = avccontext->width = 0;
- return -1;
- }
-
- avccontext->height = src_params->height;
- avccontext->width = src_params->width;
-
- avccontext->pix_fmt = get_chroma_format(src_params->chroma);
- if (avccontext->pix_fmt == PIX_FMT_NONE) {
- av_log(avccontext, AV_LOG_ERROR,
- "Dirac chroma format %d not supported currently\n",
- src_params->chroma);
- return -1;
- }
-
- avccontext->time_base.den = src_params->frame_rate.numerator;
- avccontext->time_base.num = src_params->frame_rate.denominator;
-
- /* calculate output dimensions */
- avpicture_fill(&pic, NULL, avccontext->pix_fmt,
- avccontext->width, avccontext->height);
-
- pict_size = avpicture_get_size(avccontext->pix_fmt,
- avccontext->width,
- avccontext->height);
-
- /* allocate output buffer */
- if (!p_dirac_params->p_out_frame_buf)
- p_dirac_params->p_out_frame_buf = av_malloc(pict_size);
- buffer[0] = p_dirac_params->p_out_frame_buf;
- buffer[1] = p_dirac_params->p_out_frame_buf +
- pic.linesize[0] * avccontext->height;
- buffer[2] = buffer[1] +
- pic.linesize[1] * src_params->chroma_height;
-
- /* tell Dirac about output destination */
- dirac_set_buf(p_dirac_params->p_decoder, buffer, NULL);
- break;
- }
- case STATE_SEQUENCE_END:
- break;
-
- case STATE_PICTURE_AVAIL:
- /* fill picture with current buffer data from Dirac */
- avpicture_fill(picture, p_dirac_params->p_out_frame_buf,
- avccontext->pix_fmt,
- avccontext->width, avccontext->height);
- *data_size = sizeof(AVPicture);
- return buf_size;
-
- case STATE_INVALID:
- return -1;
-
- default:
- break;
- }
- }
-
- return buf_size;
-}
-
-
-static av_cold int libdirac_decode_close(AVCodecContext *avccontext)
-{
- DiracDecoderParams *p_dirac_params = avccontext->priv_data;
- dirac_decoder_close(p_dirac_params->p_decoder);
-
- av_freep(&p_dirac_params->p_out_frame_buf);
-
- return 0;
-}
-
-static void libdirac_flush(AVCodecContext *avccontext)
-{
- /* Got a seek request. We will need free memory held in the private
- * context and free the current Dirac decoder handle and then open
- * a new decoder handle. */
- libdirac_decode_close(avccontext);
- libdirac_decode_init(avccontext);
- return;
-}
-
-
-
-AVCodec ff_libdirac_decoder = {
- .name = "libdirac",
- .type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_DIRAC,
- .priv_data_size = sizeof(DiracDecoderParams),
- .init = libdirac_decode_init,
- .close = libdirac_decode_close,
- .decode = libdirac_decode_frame,
- .capabilities = CODEC_CAP_DELAY,
- .flush = libdirac_flush,
- .long_name = NULL_IF_CONFIG_SMALL("libdirac Dirac 2.2"),
-};
diff --git a/gst-libs/ext/libav/libavcodec/libdiracenc.c b/gst-libs/ext/libav/libavcodec/libdiracenc.c
deleted file mode 100644
index 156ba57..0000000
--- a/gst-libs/ext/libav/libavcodec/libdiracenc.c
+++ /dev/null
@@ -1,405 +0,0 @@
-/*
- * Dirac encoding support via libdirac library
- * Copyright (c) 2005 BBC, Andrew Kennedy <dirac at rd dot bbc dot co dot uk>
- * Copyright (c) 2006-2008 BBC, Anuradha Suraparaju <asuraparaju at gmail dot com >
- *
- * 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
-* Dirac encoding support via libdirac library; more details about the
-* Dirac project can be found at http://dirac.sourceforge.net/.
-* The libdirac_encoder library implements Dirac specification version 2.2
-* (http://dirac.sourceforge.net/specification.html).
-*/
-
-#include "libdirac_libschro.h"
-#include "libdirac.h"
-
-#undef NDEBUG
-#include <assert.h>
-
-
-#include <libdirac_encoder/dirac_encoder.h>
-
-/** Dirac encoder private data */
-typedef struct DiracEncoderParams {
- /** Dirac encoder context */
- dirac_encoder_context_t enc_ctx;
-
- /** frame being encoded */
- AVFrame picture;
-
- /** frame size */
- int frame_size;
-
- /** Dirac encoder handle */
- dirac_encoder_t* p_encoder;
-
- /** input frame buffer */
- unsigned char *p_in_frame_buf;
-
- /** buffer to store encoder output before writing it to the frame queue */
- unsigned char *enc_buf;
-
- /** size of encoder buffer */
- int enc_buf_size;
-
- /** queue storing encoded frames */
- DiracSchroQueue enc_frame_queue;
-
- /** end of sequence signalled by user, 0 - false, 1 - true */
- int eos_signalled;
-
- /** end of sequence returned by encoder, 0 - false, 1 - true */
- int eos_pulled;
-} DiracEncoderParams;
-
-/**
-* Works out Dirac-compatible chroma format.
-*/
-static dirac_chroma_t GetDiracChromaFormat(enum PixelFormat ff_pix_fmt)
-{
- int num_formats = sizeof(dirac_pixel_format_map) /
- sizeof(dirac_pixel_format_map[0]);
- int idx;
-
- for (idx = 0; idx < num_formats; ++idx)
- if (dirac_pixel_format_map[idx].ff_pix_fmt == ff_pix_fmt)
- return dirac_pixel_format_map[idx].dirac_pix_fmt;
- return formatNK;
-}
-
-/**
-* Dirac video preset table. Ensure that this tables matches up correctly
-* with the ff_dirac_schro_video_format_info table in libdirac_libschro.c.
-*/
-static const VideoFormat ff_dirac_video_formats[]={
- VIDEO_FORMAT_CUSTOM ,
- VIDEO_FORMAT_QSIF525 ,
- VIDEO_FORMAT_QCIF ,
- VIDEO_FORMAT_SIF525 ,
- VIDEO_FORMAT_CIF ,
- VIDEO_FORMAT_4SIF525 ,
- VIDEO_FORMAT_4CIF ,
- VIDEO_FORMAT_SD_480I60 ,
- VIDEO_FORMAT_SD_576I50 ,
- VIDEO_FORMAT_HD_720P60 ,
- VIDEO_FORMAT_HD_720P50 ,
- VIDEO_FORMAT_HD_1080I60 ,
- VIDEO_FORMAT_HD_1080I50 ,
- VIDEO_FORMAT_HD_1080P60 ,
- VIDEO_FORMAT_HD_1080P50 ,
- VIDEO_FORMAT_DIGI_CINEMA_2K24 ,
- VIDEO_FORMAT_DIGI_CINEMA_4K24 ,
-};
-
-/**
-* Returns the video format preset matching the input video dimensions and
-* time base.
-*/
-static VideoFormat GetDiracVideoFormatPreset(AVCodecContext *avccontext)
-{
- unsigned int num_formats = sizeof(ff_dirac_video_formats) /
- sizeof(ff_dirac_video_formats[0]);
-
- unsigned int idx = ff_dirac_schro_get_video_format_idx(avccontext);
-
- return (idx < num_formats) ?
- ff_dirac_video_formats[idx] : VIDEO_FORMAT_CUSTOM;
-}
-
-static av_cold int libdirac_encode_init(AVCodecContext *avccontext)
-{
-
- DiracEncoderParams* p_dirac_params = avccontext->priv_data;
- int no_local = 1;
- int verbose = avccontext->debug;
- VideoFormat preset;
-
- /* get Dirac preset */
- preset = GetDiracVideoFormatPreset(avccontext);
-
- /* initialize the encoder context */
- dirac_encoder_context_init(&p_dirac_params->enc_ctx, preset);
-
- p_dirac_params->enc_ctx.src_params.chroma = GetDiracChromaFormat(avccontext->pix_fmt);
-
- if (p_dirac_params->enc_ctx.src_params.chroma == formatNK) {
- av_log(avccontext, AV_LOG_ERROR,
- "Unsupported pixel format %d. This codec supports only "
- "Planar YUV formats (yuv420p, yuv422p, yuv444p\n",
- avccontext->pix_fmt);
- return -1;
- }
-
- p_dirac_params->enc_ctx.src_params.frame_rate.numerator = avccontext->time_base.den;
- p_dirac_params->enc_ctx.src_params.frame_rate.denominator = avccontext->time_base.num;
-
- p_dirac_params->enc_ctx.src_params.width = avccontext->width;
- p_dirac_params->enc_ctx.src_params.height = avccontext->height;
-
- p_dirac_params->frame_size = avpicture_get_size(avccontext->pix_fmt,
- avccontext->width,
- avccontext->height);
-
- avccontext->coded_frame = &p_dirac_params->picture;
-
- if (no_local) {
- p_dirac_params->enc_ctx.decode_flag = 0;
- p_dirac_params->enc_ctx.instr_flag = 0;
- } else {
- p_dirac_params->enc_ctx.decode_flag = 1;
- p_dirac_params->enc_ctx.instr_flag = 1;
- }
-
- /* Intra-only sequence */
- if (!avccontext->gop_size) {
- p_dirac_params->enc_ctx.enc_params.num_L1 = 0;
- if (avccontext->coder_type == FF_CODER_TYPE_VLC)
- p_dirac_params->enc_ctx.enc_params.using_ac = 0;
- } else
- avccontext->has_b_frames = 1;
-
- if (avccontext->flags & CODEC_FLAG_QSCALE) {
- if (avccontext->global_quality) {
- p_dirac_params->enc_ctx.enc_params.qf = avccontext->global_quality
- / (FF_QP2LAMBDA * 10.0);
- /* if it is not default bitrate then send target rate. */
- if (avccontext->bit_rate >= 1000 &&
- avccontext->bit_rate != 200000)
- p_dirac_params->enc_ctx.enc_params.trate = avccontext->bit_rate
- / 1000;
- } else
- p_dirac_params->enc_ctx.enc_params.lossless = 1;
- } else if (avccontext->bit_rate >= 1000)
- p_dirac_params->enc_ctx.enc_params.trate = avccontext->bit_rate / 1000;
-
- if ((preset > VIDEO_FORMAT_QCIF || preset < VIDEO_FORMAT_QSIF525) &&
- avccontext->bit_rate == 200000)
- p_dirac_params->enc_ctx.enc_params.trate = 0;
-
- if (avccontext->flags & CODEC_FLAG_INTERLACED_ME)
- /* all material can be coded as interlaced or progressive
- * irrespective of the type of source material */
- p_dirac_params->enc_ctx.enc_params.picture_coding_mode = 1;
-
- p_dirac_params->p_encoder = dirac_encoder_init(&p_dirac_params->enc_ctx,
- verbose);
-
- if (!p_dirac_params->p_encoder) {
- av_log(avccontext, AV_LOG_ERROR,
- "Unrecoverable Error: dirac_encoder_init failed. ");
- return EXIT_FAILURE;
- }
-
- /* allocate enough memory for the incoming data */
- p_dirac_params->p_in_frame_buf = av_malloc(p_dirac_params->frame_size);
-
- /* initialize the encoded frame queue */
- ff_dirac_schro_queue_init(&p_dirac_params->enc_frame_queue);
-
- return 0;
-}
-
-static void DiracFreeFrame(void *data)
-{
- DiracSchroEncodedFrame *enc_frame = data;
-
- av_freep(&enc_frame->p_encbuf);
- av_free(enc_frame);
-}
-
-static int libdirac_encode_frame(AVCodecContext *avccontext,
- unsigned char *frame,
- int buf_size, void *data)
-{
- int enc_size = 0;
- dirac_encoder_state_t state;
- DiracEncoderParams *p_dirac_params = avccontext->priv_data;
- DiracSchroEncodedFrame *p_frame_output = NULL;
- DiracSchroEncodedFrame *p_next_output_frame = NULL;
- int go = 1;
- int last_frame_in_sequence = 0;
-
- if (!data) {
- /* push end of sequence if not already signalled */
- if (!p_dirac_params->eos_signalled) {
- dirac_encoder_end_sequence(p_dirac_params->p_encoder);
- p_dirac_params->eos_signalled = 1;
- }
- } else {
-
- /* Allocate frame data to Dirac input buffer.
- * Input line size may differ from what the codec supports,
- * especially when transcoding from one format to another.
- * So use avpicture_layout to copy the frame. */
- avpicture_layout((AVPicture *)data, avccontext->pix_fmt,
- avccontext->width, avccontext->height,
- p_dirac_params->p_in_frame_buf,
- p_dirac_params->frame_size);
-
- /* load next frame */
- if (dirac_encoder_load(p_dirac_params->p_encoder,
- p_dirac_params->p_in_frame_buf,
- p_dirac_params->frame_size) < 0) {
- av_log(avccontext, AV_LOG_ERROR, "Unrecoverable Encoder Error."
- " dirac_encoder_load failed...\n");
- return -1;
- }
- }
-
- if (p_dirac_params->eos_pulled)
- go = 0;
-
- while (go) {
- p_dirac_params->p_encoder->enc_buf.buffer = frame;
- p_dirac_params->p_encoder->enc_buf.size = buf_size;
- /* process frame */
- state = dirac_encoder_output(p_dirac_params->p_encoder);
-
- switch (state) {
- case ENC_STATE_AVAIL:
- case ENC_STATE_EOS:
- assert(p_dirac_params->p_encoder->enc_buf.size > 0);
-
- /* All non-frame data is prepended to actual frame data to
- * be able to set the pts correctly. So we don't write data
- * to the frame output queue until we actually have a frame
- */
-
- p_dirac_params->enc_buf = av_realloc(p_dirac_params->enc_buf,
- p_dirac_params->enc_buf_size +
- p_dirac_params->p_encoder->enc_buf.size);
- memcpy(p_dirac_params->enc_buf + p_dirac_params->enc_buf_size,
- p_dirac_params->p_encoder->enc_buf.buffer,
- p_dirac_params->p_encoder->enc_buf.size);
-
- p_dirac_params->enc_buf_size += p_dirac_params->p_encoder->enc_buf.size;
-
- if (state == ENC_STATE_EOS) {
- p_dirac_params->eos_pulled = 1;
- go = 0;
- }
-
- /* If non-frame data, don't output it until it we get an
- * encoded frame back from the encoder. */
- if (p_dirac_params->p_encoder->enc_pparams.pnum == -1)
- break;
-
- /* create output frame */
- p_frame_output = av_mallocz(sizeof(DiracSchroEncodedFrame));
- /* set output data */
- p_frame_output->size = p_dirac_params->enc_buf_size;
- p_frame_output->p_encbuf = p_dirac_params->enc_buf;
- p_frame_output->frame_num = p_dirac_params->p_encoder->enc_pparams.pnum;
-
- if (p_dirac_params->p_encoder->enc_pparams.ptype == INTRA_PICTURE &&
- p_dirac_params->p_encoder->enc_pparams.rtype == REFERENCE_PICTURE)
- p_frame_output->key_frame = 1;
-
- ff_dirac_schro_queue_push_back(&p_dirac_params->enc_frame_queue,
- p_frame_output);
-
- p_dirac_params->enc_buf_size = 0;
- p_dirac_params->enc_buf = NULL;
- break;
-
- case ENC_STATE_BUFFER:
- go = 0;
- break;
-
- case ENC_STATE_INVALID:
- av_log(avccontext, AV_LOG_ERROR,
- "Unrecoverable Dirac Encoder Error. Quitting...\n");
- return -1;
-
- default:
- av_log(avccontext, AV_LOG_ERROR, "Unknown Dirac Encoder state\n");
- return -1;
- }
- }
-
- /* copy 'next' frame in queue */
-
- if (p_dirac_params->enc_frame_queue.size == 1 && p_dirac_params->eos_pulled)
- last_frame_in_sequence = 1;
-
- p_next_output_frame = ff_dirac_schro_queue_pop(&p_dirac_params->enc_frame_queue);
-
- if (!p_next_output_frame)
- return 0;
-
- memcpy(frame, p_next_output_frame->p_encbuf, p_next_output_frame->size);
- avccontext->coded_frame->key_frame = p_next_output_frame->key_frame;
- /* Use the frame number of the encoded frame as the pts. It is OK to do
- * so since Dirac is a constant framerate codec. It expects input to be
- * of constant framerate. */
- avccontext->coded_frame->pts = p_next_output_frame->frame_num;
- enc_size = p_next_output_frame->size;
-
- /* Append the end of sequence information to the last frame in the
- * sequence. */
- if (last_frame_in_sequence && p_dirac_params->enc_buf_size > 0) {
- memcpy(frame + enc_size, p_dirac_params->enc_buf,
- p_dirac_params->enc_buf_size);
- enc_size += p_dirac_params->enc_buf_size;
- av_freep(&p_dirac_params->enc_buf);
- p_dirac_params->enc_buf_size = 0;
- }
-
- /* free frame */
- DiracFreeFrame(p_next_output_frame);
-
- return enc_size;
-}
-
-static av_cold int libdirac_encode_close(AVCodecContext *avccontext)
-{
- DiracEncoderParams *p_dirac_params = avccontext->priv_data;
-
- /* close the encoder */
- dirac_encoder_close(p_dirac_params->p_encoder);
-
- /* free data in the output frame queue */
- ff_dirac_schro_queue_free(&p_dirac_params->enc_frame_queue,
- DiracFreeFrame);
-
- /* free the encoder buffer */
- if (p_dirac_params->enc_buf_size)
- av_freep(&p_dirac_params->enc_buf);
-
- /* free the input frame buffer */
- av_freep(&p_dirac_params->p_in_frame_buf);
-
- return 0;
-}
-
-
-AVCodec ff_libdirac_encoder = {
- .name = "libdirac",
- .type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_DIRAC,
- .priv_data_size = sizeof(DiracEncoderParams),
- .init = libdirac_encode_init,
- .encode = libdirac_encode_frame,
- .close = libdirac_encode_close,
- .capabilities = CODEC_CAP_DELAY,
- .pix_fmts = (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_YUV422P, PIX_FMT_YUV444P, PIX_FMT_NONE},
- .long_name = NULL_IF_CONFIG_SMALL("libdirac Dirac 2.2"),
-};
diff --git a/gst-libs/ext/libav/libavcodec/libfaac.c b/gst-libs/ext/libav/libavcodec/libfaac.c
index 7ee1f3c..d32e776 100644
--- a/gst-libs/ext/libav/libavcodec/libfaac.c
+++ b/gst-libs/ext/libav/libavcodec/libfaac.c
@@ -24,35 +24,76 @@
* Interface to libfaac for aac encoding.
*/
-#include "avcodec.h"
#include <faac.h>
+#include "libavutil/channel_layout.h"
+#include "libavutil/common.h"
+#include "avcodec.h"
+#include "audio_frame_queue.h"
+#include "internal.h"
+
+
+/* libfaac has an encoder delay of 1024 samples */
+#define FAAC_DELAY_SAMPLES 1024
+
typedef struct FaacAudioContext {
faacEncHandle faac_handle;
+ AudioFrameQueue afq;
} FaacAudioContext;
+
+static av_cold int Faac_encode_close(AVCodecContext *avctx)
+{
+ FaacAudioContext *s = avctx->priv_data;
+
+#if FF_API_OLD_ENCODE_AUDIO
+ av_freep(&avctx->coded_frame);
+#endif
+ av_freep(&avctx->extradata);
+ ff_af_queue_close(&s->afq);
+
+ if (s->faac_handle)
+ faacEncClose(s->faac_handle);
+
+ return 0;
+}
+
+static const int channel_maps[][6] = {
+ { 2, 0, 1 }, //< C L R
+ { 2, 0, 1, 3 }, //< C L R Cs
+ { 2, 0, 1, 3, 4 }, //< C L R Ls Rs
+ { 2, 0, 1, 4, 5, 3 }, //< C L R Ls Rs LFE
+};
+
static av_cold int Faac_encode_init(AVCodecContext *avctx)
{
FaacAudioContext *s = avctx->priv_data;
faacEncConfigurationPtr faac_cfg;
unsigned long samples_input, max_bytes_output;
+ int ret;
/* number of channels */
if (avctx->channels < 1 || avctx->channels > 6) {
av_log(avctx, AV_LOG_ERROR, "encoding %d channel(s) is not allowed\n", avctx->channels);
- return -1;
+ ret = AVERROR(EINVAL);
+ goto error;
}
s->faac_handle = faacEncOpen(avctx->sample_rate,
avctx->channels,
&samples_input, &max_bytes_output);
+ if (!s->faac_handle) {
+ av_log(avctx, AV_LOG_ERROR, "error in faacEncOpen()\n");
+ ret = AVERROR_UNKNOWN;
+ goto error;
+ }
/* check faac version */
faac_cfg = faacEncGetCurrentConfiguration(s->faac_handle);
if (faac_cfg->version != FAAC_CFG_VERSION) {
av_log(avctx, AV_LOG_ERROR, "wrong libfaac version (compiled for: %d, using %d)\n", FAAC_CFG_VERSION, faac_cfg->version);
- faacEncClose(s->faac_handle);
- return -1;
+ ret = AVERROR(EINVAL);
+ goto error;
}
/* put the options in the configuration struct */
@@ -72,8 +113,8 @@ static av_cold int Faac_encode_init(AVCodecContext *avctx)
break;
default:
av_log(avctx, AV_LOG_ERROR, "invalid AAC profile\n");
- faacEncClose(s->faac_handle);
- return -1;
+ ret = AVERROR(EINVAL);
+ goto error;
}
faac_cfg->mpegVersion = MPEG4;
faac_cfg->useTns = 0;
@@ -86,11 +127,19 @@ static av_cold int Faac_encode_init(AVCodecContext *avctx)
}
faac_cfg->outputFormat = 1;
faac_cfg->inputFormat = FAAC_INPUT_16BIT;
+ if (avctx->channels > 2)
+ memcpy(faac_cfg->channel_map, channel_maps[avctx->channels-3],
+ avctx->channels * sizeof(int));
avctx->frame_size = samples_input / avctx->channels;
+#if FF_API_OLD_ENCODE_AUDIO
avctx->coded_frame= avcodec_alloc_frame();
- avctx->coded_frame->key_frame= 1;
+ if (!avctx->coded_frame) {
+ ret = AVERROR(ENOMEM);
+ goto error;
+ }
+#endif
/* Set decoder specific info */
avctx->extradata_size = 0;
@@ -102,47 +151,68 @@ static av_cold int Faac_encode_init(AVCodecContext *avctx)
if (!faacEncGetDecoderSpecificInfo(s->faac_handle, &buffer,
&decoder_specific_info_size)) {
avctx->extradata = av_malloc(decoder_specific_info_size + FF_INPUT_BUFFER_PADDING_SIZE);
+ if (!avctx->extradata) {
+ ret = AVERROR(ENOMEM);
+ goto error;
+ }
avctx->extradata_size = decoder_specific_info_size;
memcpy(avctx->extradata, buffer, avctx->extradata_size);
faac_cfg->outputFormat = 0;
}
-#undef free
free(buffer);
-#define free please_use_av_free
}
if (!faacEncSetConfiguration(s->faac_handle, faac_cfg)) {
av_log(avctx, AV_LOG_ERROR, "libfaac doesn't support this output format!\n");
- return -1;
+ ret = AVERROR(EINVAL);
+ goto error;
}
+ avctx->delay = FAAC_DELAY_SAMPLES;
+ ff_af_queue_init(avctx, &s->afq);
+
return 0;
+error:
+ Faac_encode_close(avctx);
+ return ret;
}
-static int Faac_encode_frame(AVCodecContext *avctx,
- unsigned char *frame, int buf_size, void *data)
+static int Faac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
+ const AVFrame *frame, int *got_packet_ptr)
{
FaacAudioContext *s = avctx->priv_data;
- int bytes_written;
- int num_samples = data ? avctx->frame_size : 0;
+ int bytes_written, ret;
+ int num_samples = frame ? frame->nb_samples : 0;
+ void *samples = frame ? frame->data[0] : NULL;
+
+ if ((ret = ff_alloc_packet(avpkt, (7 + 768) * avctx->channels))) {
+ av_log(avctx, AV_LOG_ERROR, "Error getting output packet\n");
+ return ret;
+ }
- bytes_written = faacEncEncode(s->faac_handle,
- data,
+ bytes_written = faacEncEncode(s->faac_handle, samples,
num_samples * avctx->channels,
- frame,
- buf_size);
+ avpkt->data, avpkt->size);
+ if (bytes_written < 0) {
+ av_log(avctx, AV_LOG_ERROR, "faacEncEncode() error\n");
+ return bytes_written;
+ }
- return bytes_written;
-}
+ /* add current frame to the queue */
+ if (frame) {
+ if ((ret = ff_af_queue_add(&s->afq, frame)) < 0)
+ return ret;
+ }
-static av_cold int Faac_encode_close(AVCodecContext *avctx)
-{
- FaacAudioContext *s = avctx->priv_data;
+ if (!bytes_written)
+ return 0;
- av_freep(&avctx->coded_frame);
- av_freep(&avctx->extradata);
+ /* Get the next frame pts/duration */
+ ff_af_queue_remove(&s->afq, avctx->frame_size, &avpkt->pts,
+ &avpkt->duration);
- faacEncClose(s->faac_handle);
+ avpkt->size = bytes_written;
+ *got_packet_ptr = 1;
return 0;
}
@@ -154,16 +224,28 @@ static const AVProfile profiles[] = {
{ FF_PROFILE_UNKNOWN },
};
+static const uint64_t faac_channel_layouts[] = {
+ AV_CH_LAYOUT_MONO,
+ AV_CH_LAYOUT_STEREO,
+ AV_CH_LAYOUT_SURROUND,
+ AV_CH_LAYOUT_4POINT0,
+ AV_CH_LAYOUT_5POINT0_BACK,
+ AV_CH_LAYOUT_5POINT1_BACK,
+ 0
+};
+
AVCodec ff_libfaac_encoder = {
.name = "libfaac",
.type = AVMEDIA_TYPE_AUDIO,
- .id = CODEC_ID_AAC,
+ .id = AV_CODEC_ID_AAC,
.priv_data_size = sizeof(FaacAudioContext),
.init = Faac_encode_init,
- .encode = Faac_encode_frame,
+ .encode2 = Faac_encode_frame,
.close = Faac_encode_close,
- .capabilities = CODEC_CAP_SMALL_LAST_FRAME | CODEC_CAP_DELAY,
- .sample_fmts = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_NONE},
- .long_name = NULL_IF_CONFIG_SMALL("libfaac AAC (Advanced Audio Codec)"),
- .profiles = NULL_IF_CONFIG_SMALL(profiles),
+ .capabilities = CODEC_CAP_SMALL_LAST_FRAME | CODEC_CAP_DELAY,
+ .sample_fmts = (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_S16,
+ AV_SAMPLE_FMT_NONE },
+ .long_name = NULL_IF_CONFIG_SMALL("libfaac AAC (Advanced Audio Coding)"),
+ .profiles = NULL_IF_CONFIG_SMALL(profiles),
+ .channel_layouts = faac_channel_layouts,
};
diff --git a/gst-libs/ext/libav/libavcodec/libfdk-aacenc.c b/gst-libs/ext/libav/libavcodec/libfdk-aacenc.c
new file mode 100644
index 0000000..c40bced
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/libfdk-aacenc.c
@@ -0,0 +1,423 @@
+/*
+ * AAC encoder wrapper
+ * Copyright (c) 2012 Martin Storsjo
+ *
+ * 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
+ */
+
+#include <fdk-aac/aacenc_lib.h>
+
+#include "libavutil/channel_layout.h"
+#include "libavutil/common.h"
+#include "libavutil/opt.h"
+#include "avcodec.h"
+#include "audio_frame_queue.h"
+#include "internal.h"
+
+typedef struct AACContext {
+ const AVClass *class;
+ HANDLE_AACENCODER handle;
+ int afterburner;
+ int eld_sbr;
+ int signaling;
+ int latm;
+ int header_period;
+ int vbr;
+
+ AudioFrameQueue afq;
+} AACContext;
+
+static const AVOption aac_enc_options[] = {
+ { "afterburner", "Afterburner (improved quality)", offsetof(AACContext, afterburner), AV_OPT_TYPE_INT, { .i64 = 1 }, 0, 1, AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM },
+ { "eld_sbr", "Enable SBR for ELD (for SBR in other configurations, use the -profile parameter)", offsetof(AACContext, eld_sbr), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM },
+ { "signaling", "SBR/PS signaling style", offsetof(AACContext, signaling), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 2, AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM, "signaling" },
+ { "default", "Choose signaling implicitly (explicit hierarchical by default, implicit if global header is disabled)", 0, AV_OPT_TYPE_CONST, { .i64 = -1 }, 0, 0, AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM, "signaling" },
+ { "implicit", "Implicit backwards compatible signaling", 0, AV_OPT_TYPE_CONST, { .i64 = 0 }, 0, 0, AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM, "signaling" },
+ { "explicit_sbr", "Explicit SBR, implicit PS signaling", 0, AV_OPT_TYPE_CONST, { .i64 = 1 }, 0, 0, AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM, "signaling" },
+ { "explicit_hierarchical", "Explicit hierarchical signaling", 0, AV_OPT_TYPE_CONST, { .i64 = 2 }, 0, 0, AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM, "signaling" },
+ { "latm", "Output LATM/LOAS encapsulated data", offsetof(AACContext, latm), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM },
+ { "header_period", "StreamMuxConfig and PCE repetition period (in frames)", offsetof(AACContext, header_period), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 0xffff, AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM },
+ { "vbr", "VBR mode (1-5)", offsetof(AACContext, vbr), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 5, AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM },
+ { NULL }
+};
+
+static const AVClass aac_enc_class = {
+ "libfdk_aac", av_default_item_name, aac_enc_options, LIBAVUTIL_VERSION_INT
+};
+
+static const char *aac_get_error(AACENC_ERROR err)
+{
+ switch (err) {
+ case AACENC_OK:
+ return "No error";
+ case AACENC_INVALID_HANDLE:
+ return "Invalid handle";
+ case AACENC_MEMORY_ERROR:
+ return "Memory allocation error";
+ case AACENC_UNSUPPORTED_PARAMETER:
+ return "Unsupported parameter";
+ case AACENC_INVALID_CONFIG:
+ return "Invalid config";
+ case AACENC_INIT_ERROR:
+ return "Initialization error";
+ case AACENC_INIT_AAC_ERROR:
+ return "AAC library initialization error";
+ case AACENC_INIT_SBR_ERROR:
+ return "SBR library initialization error";
+ case AACENC_INIT_TP_ERROR:
+ return "Transport library initialization error";
+ case AACENC_INIT_META_ERROR:
+ return "Metadata library initialization error";
+ case AACENC_ENCODE_ERROR:
+ return "Encoding error";
+ case AACENC_ENCODE_EOF:
+ return "End of file";
+ default:
+ return "Unknown error";
+ }
+}
+
+static int aac_encode_close(AVCodecContext *avctx)
+{
+ AACContext *s = avctx->priv_data;
+
+ if (s->handle)
+ aacEncClose(&s->handle);
+#if FF_API_OLD_ENCODE_AUDIO
+ av_freep(&avctx->coded_frame);
+#endif
+ av_freep(&avctx->extradata);
+ ff_af_queue_close(&s->afq);
+
+ return 0;
+}
+
+static av_cold int aac_encode_init(AVCodecContext *avctx)
+{
+ AACContext *s = avctx->priv_data;
+ int ret = AVERROR(EINVAL);
+ AACENC_InfoStruct info = { 0 };
+ CHANNEL_MODE mode;
+ AACENC_ERROR err;
+ int aot = FF_PROFILE_AAC_LOW + 1;
+ int sce = 0, cpe = 0;
+
+ if ((err = aacEncOpen(&s->handle, 0, avctx->channels)) != AACENC_OK) {
+ av_log(avctx, AV_LOG_ERROR, "Unable to open the encoder: %s\n",
+ aac_get_error(err));
+ goto error;
+ }
+
+ if (avctx->profile != FF_PROFILE_UNKNOWN)
+ aot = avctx->profile + 1;
+
+ if ((err = aacEncoder_SetParam(s->handle, AACENC_AOT, aot)) != AACENC_OK) {
+ av_log(avctx, AV_LOG_ERROR, "Unable to set the AOT %d: %s\n",
+ aot, aac_get_error(err));
+ goto error;
+ }
+
+ if (aot == FF_PROFILE_AAC_ELD + 1 && s->eld_sbr) {
+ if ((err = aacEncoder_SetParam(s->handle, AACENC_SBR_MODE,
+ 1)) != AACENC_OK) {
+ av_log(avctx, AV_LOG_ERROR, "Unable to enable SBR for ELD: %s\n",
+ aac_get_error(err));
+ goto error;
+ }
+ }
+
+ if ((err = aacEncoder_SetParam(s->handle, AACENC_SAMPLERATE,
+ avctx->sample_rate)) != AACENC_OK) {
+ av_log(avctx, AV_LOG_ERROR, "Unable to set the sample rate %d: %s\n",
+ avctx->sample_rate, aac_get_error(err));
+ goto error;
+ }
+
+ switch (avctx->channels) {
+ case 1: mode = MODE_1; sce = 1; cpe = 0; break;
+ case 2: mode = MODE_2; sce = 0; cpe = 1; break;
+ case 3: mode = MODE_1_2; sce = 1; cpe = 1; break;
+ case 4: mode = MODE_1_2_1; sce = 2; cpe = 1; break;
+ case 5: mode = MODE_1_2_2; sce = 1; cpe = 2; break;
+ case 6: mode = MODE_1_2_2_1; sce = 2; cpe = 2; break;
+ default:
+ av_log(avctx, AV_LOG_ERROR,
+ "Unsupported number of channels %d\n", avctx->channels);
+ goto error;
+ }
+
+ if ((err = aacEncoder_SetParam(s->handle, AACENC_CHANNELMODE,
+ mode)) != AACENC_OK) {
+ av_log(avctx, AV_LOG_ERROR,
+ "Unable to set channel mode %d: %s\n", mode, aac_get_error(err));
+ goto error;
+ }
+
+ if ((err = aacEncoder_SetParam(s->handle, AACENC_CHANNELORDER,
+ 1)) != AACENC_OK) {
+ av_log(avctx, AV_LOG_ERROR,
+ "Unable to set wav channel order %d: %s\n",
+ mode, aac_get_error(err));
+ goto error;
+ }
+
+ if (avctx->flags & CODEC_FLAG_QSCALE || s->vbr) {
+ int mode = s->vbr ? s->vbr : avctx->global_quality;
+ if (mode < 1 || mode > 5) {
+ av_log(avctx, AV_LOG_WARNING,
+ "VBR quality %d out of range, should be 1-5\n", mode);
+ mode = av_clip(mode, 1, 5);
+ }
+ av_log(avctx, AV_LOG_WARNING,
+ "Note, the VBR setting is unsupported and only works with "
+ "some parameter combinations\n");
+ if ((err = aacEncoder_SetParam(s->handle, AACENC_BITRATEMODE,
+ mode)) != AACENC_OK) {
+ av_log(avctx, AV_LOG_ERROR, "Unable to set the VBR bitrate mode %d: %s\n",
+ mode, aac_get_error(err));
+ goto error;
+ }
+ } else {
+ if (avctx->bit_rate <= 0) {
+ if (avctx->profile == FF_PROFILE_AAC_HE_V2) {
+ sce = 1;
+ cpe = 0;
+ }
+ avctx->bit_rate = (96*sce + 128*cpe) * avctx->sample_rate / 44;
+ if (avctx->profile == FF_PROFILE_AAC_HE ||
+ avctx->profile == FF_PROFILE_AAC_HE_V2 ||
+ s->eld_sbr)
+ avctx->bit_rate /= 2;
+ }
+ if ((err = aacEncoder_SetParam(s->handle, AACENC_BITRATE,
+ avctx->bit_rate)) != AACENC_OK) {
+ av_log(avctx, AV_LOG_ERROR, "Unable to set the bitrate %d: %s\n",
+ avctx->bit_rate, aac_get_error(err));
+ goto error;
+ }
+ }
+
+ /* Choose bitstream format - if global header is requested, use
+ * raw access units, otherwise use ADTS. */
+ if ((err = aacEncoder_SetParam(s->handle, AACENC_TRANSMUX,
+ avctx->flags & CODEC_FLAG_GLOBAL_HEADER ? 0 : s->latm ? 10 : 2)) != AACENC_OK) {
+ av_log(avctx, AV_LOG_ERROR, "Unable to set the transmux format: %s\n",
+ aac_get_error(err));
+ goto error;
+ }
+
+ if (s->latm && s->header_period) {
+ if ((err = aacEncoder_SetParam(s->handle, AACENC_HEADER_PERIOD,
+ s->header_period)) != AACENC_OK) {
+ av_log(avctx, AV_LOG_ERROR, "Unable to set header period: %s\n",
+ aac_get_error(err));
+ goto error;
+ }
+ }
+
+ /* If no signaling mode is chosen, use explicit hierarchical signaling
+ * if using mp4 mode (raw access units, with global header) and
+ * implicit signaling if using ADTS. */
+ if (s->signaling < 0)
+ s->signaling = avctx->flags & CODEC_FLAG_GLOBAL_HEADER ? 2 : 0;
+
+ if ((err = aacEncoder_SetParam(s->handle, AACENC_SIGNALING_MODE,
+ s->signaling)) != AACENC_OK) {
+ av_log(avctx, AV_LOG_ERROR, "Unable to set signaling mode %d: %s\n",
+ s->signaling, aac_get_error(err));
+ goto error;
+ }
+
+ if ((err = aacEncoder_SetParam(s->handle, AACENC_AFTERBURNER,
+ s->afterburner)) != AACENC_OK) {
+ av_log(avctx, AV_LOG_ERROR, "Unable to set afterburner to %d: %s\n",
+ s->afterburner, aac_get_error(err));
+ goto error;
+ }
+
+ if (avctx->cutoff > 0) {
+ if (avctx->cutoff < (avctx->sample_rate + 255) >> 8) {
+ av_log(avctx, AV_LOG_ERROR, "cutoff valid range is %d-20000\n",
+ (avctx->sample_rate + 255) >> 8);
+ goto error;
+ }
+ if ((err = aacEncoder_SetParam(s->handle, AACENC_BANDWIDTH,
+ avctx->cutoff)) != AACENC_OK) {
+ av_log(avctx, AV_LOG_ERROR, "Unable to set the encoder bandwidth to %d: %s\n",
+ avctx->cutoff, aac_get_error(err));
+ goto error;
+ }
+ }
+
+ if ((err = aacEncEncode(s->handle, NULL, NULL, NULL, NULL)) != AACENC_OK) {
+ av_log(avctx, AV_LOG_ERROR, "Unable to initialize the encoder: %s\n",
+ aac_get_error(err));
+ return AVERROR(EINVAL);
+ }
+
+ if ((err = aacEncInfo(s->handle, &info)) != AACENC_OK) {
+ av_log(avctx, AV_LOG_ERROR, "Unable to get encoder info: %s\n",
+ aac_get_error(err));
+ goto error;
+ }
+
+#if FF_API_OLD_ENCODE_AUDIO
+ avctx->coded_frame = avcodec_alloc_frame();
+ if (!avctx->coded_frame) {
+ ret = AVERROR(ENOMEM);
+ goto error;
+ }
+#endif
+ avctx->frame_size = info.frameLength;
+ avctx->delay = info.encoderDelay;
+ ff_af_queue_init(avctx, &s->afq);
+
+ if (avctx->flags & CODEC_FLAG_GLOBAL_HEADER) {
+ avctx->extradata_size = info.confSize;
+ avctx->extradata = av_mallocz(avctx->extradata_size +
+ FF_INPUT_BUFFER_PADDING_SIZE);
+ if (!avctx->extradata) {
+ ret = AVERROR(ENOMEM);
+ goto error;
+ }
+
+ memcpy(avctx->extradata, info.confBuf, info.confSize);
+ }
+ return 0;
+error:
+ aac_encode_close(avctx);
+ return ret;
+}
+
+static int aac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
+ const AVFrame *frame, int *got_packet_ptr)
+{
+ AACContext *s = avctx->priv_data;
+ AACENC_BufDesc in_buf = { 0 }, out_buf = { 0 };
+ AACENC_InArgs in_args = { 0 };
+ AACENC_OutArgs out_args = { 0 };
+ int in_buffer_identifier = IN_AUDIO_DATA;
+ int in_buffer_size, in_buffer_element_size;
+ int out_buffer_identifier = OUT_BITSTREAM_DATA;
+ int out_buffer_size, out_buffer_element_size;
+ void *in_ptr, *out_ptr;
+ int ret;
+ AACENC_ERROR err;
+
+ /* handle end-of-stream small frame and flushing */
+ if (!frame) {
+ in_args.numInSamples = -1;
+ } else {
+ in_ptr = frame->data[0];
+ in_buffer_size = 2 * avctx->channels * frame->nb_samples;
+ in_buffer_element_size = 2;
+
+ in_args.numInSamples = avctx->channels * frame->nb_samples;
+ in_buf.numBufs = 1;
+ in_buf.bufs = &in_ptr;
+ in_buf.bufferIdentifiers = &in_buffer_identifier;
+ in_buf.bufSizes = &in_buffer_size;
+ in_buf.bufElSizes = &in_buffer_element_size;
+
+ /* add current frame to the queue */
+ if ((ret = ff_af_queue_add(&s->afq, frame)) < 0)
+ return ret;
+ }
+
+ /* The maximum packet size is 6144 bits aka 768 bytes per channel. */
+ if ((ret = ff_alloc_packet(avpkt, FFMAX(8192, 768 * avctx->channels)))) {
+ av_log(avctx, AV_LOG_ERROR, "Error getting output packet\n");
+ return ret;
+ }
+
+ out_ptr = avpkt->data;
+ out_buffer_size = avpkt->size;
+ out_buffer_element_size = 1;
+ out_buf.numBufs = 1;
+ out_buf.bufs = &out_ptr;
+ out_buf.bufferIdentifiers = &out_buffer_identifier;
+ out_buf.bufSizes = &out_buffer_size;
+ out_buf.bufElSizes = &out_buffer_element_size;
+
+ if ((err = aacEncEncode(s->handle, &in_buf, &out_buf, &in_args,
+ &out_args)) != AACENC_OK) {
+ if (!frame && err == AACENC_ENCODE_EOF)
+ return 0;
+ av_log(avctx, AV_LOG_ERROR, "Unable to encode frame: %s\n",
+ aac_get_error(err));
+ return AVERROR(EINVAL);
+ }
+
+ if (!out_args.numOutBytes)
+ return 0;
+
+ /* Get the next frame pts & duration */
+ ff_af_queue_remove(&s->afq, avctx->frame_size, &avpkt->pts,
+ &avpkt->duration);
+
+ avpkt->size = out_args.numOutBytes;
+ *got_packet_ptr = 1;
+ return 0;
+}
+
+static const AVProfile profiles[] = {
+ { FF_PROFILE_AAC_LOW, "LC" },
+ { FF_PROFILE_AAC_HE, "HE-AAC" },
+ { FF_PROFILE_AAC_HE_V2, "HE-AACv2" },
+ { FF_PROFILE_AAC_LD, "LD" },
+ { FF_PROFILE_AAC_ELD, "ELD" },
+ { FF_PROFILE_UNKNOWN },
+};
+
+static const AVCodecDefault aac_encode_defaults[] = {
+ { "b", "0" },
+ { NULL }
+};
+
+static const uint64_t aac_channel_layout[] = {
+ AV_CH_LAYOUT_MONO,
+ AV_CH_LAYOUT_STEREO,
+ AV_CH_LAYOUT_SURROUND,
+ AV_CH_LAYOUT_4POINT0,
+ AV_CH_LAYOUT_5POINT0_BACK,
+ AV_CH_LAYOUT_5POINT1_BACK,
+ 0,
+};
+
+static const int aac_sample_rates[] = {
+ 96000, 88200, 64000, 48000, 44100, 32000,
+ 24000, 22050, 16000, 12000, 11025, 8000, 0
+};
+
+AVCodec ff_libfdk_aac_encoder = {
+ .name = "libfdk_aac",
+ .type = AVMEDIA_TYPE_AUDIO,
+ .id = AV_CODEC_ID_AAC,
+ .priv_data_size = sizeof(AACContext),
+ .init = aac_encode_init,
+ .encode2 = aac_encode_frame,
+ .close = aac_encode_close,
+ .capabilities = CODEC_CAP_SMALL_LAST_FRAME | CODEC_CAP_DELAY,
+ .sample_fmts = (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_S16,
+ AV_SAMPLE_FMT_NONE },
+ .long_name = NULL_IF_CONFIG_SMALL("Fraunhofer FDK AAC"),
+ .priv_class = &aac_enc_class,
+ .defaults = aac_encode_defaults,
+ .profiles = profiles,
+ .supported_samplerates = aac_sample_rates,
+ .channel_layouts = aac_channel_layout,
+};
diff --git a/gst-libs/ext/libav/libavcodec/libgsm.c b/gst-libs/ext/libav/libavcodec/libgsm.c
index 1fa04cf..b4d1c74 100644
--- a/gst-libs/ext/libav/libavcodec/libgsm.c
+++ b/gst-libs/ext/libav/libavcodec/libgsm.c
@@ -29,7 +29,10 @@
#include <gsm/gsm.h>
+#include "libavutil/channel_layout.h"
+#include "libavutil/common.h"
#include "avcodec.h"
+#include "internal.h"
#include "gsm.h"
static av_cold int libgsm_encode_init(AVCodecContext *avctx) {
@@ -57,11 +60,11 @@ static av_cold int libgsm_encode_init(AVCodecContext *avctx) {
avctx->priv_data = gsm_create();
switch(avctx->codec_id) {
- case CODEC_ID_GSM:
+ case AV_CODEC_ID_GSM:
avctx->frame_size = GSM_FRAME_SIZE;
avctx->block_align = GSM_BLOCK_SIZE;
break;
- case CODEC_ID_GSM_MS: {
+ case AV_CODEC_ID_GSM_MS: {
int one = 1;
gsm_option(avctx->priv_data, GSM_OPT_WAV49, &one);
avctx->frame_size = 2*GSM_FRAME_SIZE;
@@ -69,56 +72,74 @@ static av_cold int libgsm_encode_init(AVCodecContext *avctx) {
}
}
+#if FF_API_OLD_ENCODE_AUDIO
avctx->coded_frame= avcodec_alloc_frame();
- avctx->coded_frame->key_frame= 1;
+ if (!avctx->coded_frame) {
+ gsm_destroy(avctx->priv_data);
+ return AVERROR(ENOMEM);
+ }
+#endif
return 0;
}
static av_cold int libgsm_encode_close(AVCodecContext *avctx) {
+#if FF_API_OLD_ENCODE_AUDIO
av_freep(&avctx->coded_frame);
+#endif
gsm_destroy(avctx->priv_data);
avctx->priv_data = NULL;
return 0;
}
-static int libgsm_encode_frame(AVCodecContext *avctx,
- unsigned char *frame, int buf_size, void *data) {
- // we need a full block
- if(buf_size < avctx->block_align) return 0;
+static int libgsm_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
+ const AVFrame *frame, int *got_packet_ptr)
+{
+ int ret;
+ gsm_signal *samples = (gsm_signal *)frame->data[0];
+ struct gsm_state *state = avctx->priv_data;
+
+ if ((ret = ff_alloc_packet(avpkt, avctx->block_align))) {
+ av_log(avctx, AV_LOG_ERROR, "Error getting output packet\n");
+ return ret;
+ }
switch(avctx->codec_id) {
- case CODEC_ID_GSM:
- gsm_encode(avctx->priv_data,data,frame);
+ case AV_CODEC_ID_GSM:
+ gsm_encode(state, samples, avpkt->data);
break;
- case CODEC_ID_GSM_MS:
- gsm_encode(avctx->priv_data,data,frame);
- gsm_encode(avctx->priv_data,((short*)data)+GSM_FRAME_SIZE,frame+32);
+ case AV_CODEC_ID_GSM_MS:
+ gsm_encode(state, samples, avpkt->data);
+ gsm_encode(state, samples + GSM_FRAME_SIZE, avpkt->data + 32);
}
- return avctx->block_align;
+
+ *got_packet_ptr = 1;
+ return 0;
}
AVCodec ff_libgsm_encoder = {
.name = "libgsm",
.type = AVMEDIA_TYPE_AUDIO,
- .id = CODEC_ID_GSM,
+ .id = AV_CODEC_ID_GSM,
.init = libgsm_encode_init,
- .encode = libgsm_encode_frame,
+ .encode2 = libgsm_encode_frame,
.close = libgsm_encode_close,
- .sample_fmts = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_NONE},
- .long_name = NULL_IF_CONFIG_SMALL("libgsm GSM"),
+ .sample_fmts = (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_S16,
+ AV_SAMPLE_FMT_NONE },
+ .long_name = NULL_IF_CONFIG_SMALL("libgsm GSM"),
};
AVCodec ff_libgsm_ms_encoder = {
.name = "libgsm_ms",
.type = AVMEDIA_TYPE_AUDIO,
- .id = CODEC_ID_GSM_MS,
+ .id = AV_CODEC_ID_GSM_MS,
.init = libgsm_encode_init,
- .encode = libgsm_encode_frame,
+ .encode2 = libgsm_encode_frame,
.close = libgsm_encode_close,
- .sample_fmts = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_NONE},
- .long_name = NULL_IF_CONFIG_SMALL("libgsm GSM Microsoft variant"),
+ .sample_fmts = (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_S16,
+ AV_SAMPLE_FMT_NONE },
+ .long_name = NULL_IF_CONFIG_SMALL("libgsm GSM Microsoft variant"),
};
typedef struct LibGSMDecodeContext {
@@ -129,28 +150,19 @@ typedef struct LibGSMDecodeContext {
static av_cold int libgsm_decode_init(AVCodecContext *avctx) {
LibGSMDecodeContext *s = avctx->priv_data;
- if (avctx->channels > 1) {
- av_log(avctx, AV_LOG_ERROR, "Mono required for GSM, got %d channels\n",
- avctx->channels);
- return -1;
- }
-
- if (!avctx->channels)
- avctx->channels = 1;
-
- if (!avctx->sample_rate)
- avctx->sample_rate = 8000;
-
- avctx->sample_fmt = AV_SAMPLE_FMT_S16;
+ avctx->channels = 1;
+ avctx->channel_layout = AV_CH_LAYOUT_MONO;
+ avctx->sample_rate = 8000;
+ avctx->sample_fmt = AV_SAMPLE_FMT_S16;
s->state = gsm_create();
switch(avctx->codec_id) {
- case CODEC_ID_GSM:
+ case AV_CODEC_ID_GSM:
avctx->frame_size = GSM_FRAME_SIZE;
avctx->block_align = GSM_BLOCK_SIZE;
break;
- case CODEC_ID_GSM_MS: {
+ case AV_CODEC_ID_GSM_MS: {
int one = 1;
gsm_option(s->state, GSM_OPT_WAV49, &one);
avctx->frame_size = 2 * GSM_FRAME_SIZE;
@@ -188,7 +200,7 @@ static int libgsm_decode_frame(AVCodecContext *avctx, void *data,
/* get output buffer */
s->frame.nb_samples = avctx->frame_size;
- if ((ret = avctx->get_buffer(avctx, &s->frame)) < 0) {
+ if ((ret = ff_get_buffer(avctx, &s->frame)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return ret;
}
@@ -213,32 +225,32 @@ static void libgsm_flush(AVCodecContext *avctx) {
gsm_destroy(s->state);
s->state = gsm_create();
- if (avctx->codec_id == CODEC_ID_GSM_MS)
+ if (avctx->codec_id == AV_CODEC_ID_GSM_MS)
gsm_option(s->state, GSM_OPT_WAV49, &one);
}
AVCodec ff_libgsm_decoder = {
.name = "libgsm",
.type = AVMEDIA_TYPE_AUDIO,
- .id = CODEC_ID_GSM,
+ .id = AV_CODEC_ID_GSM,
.priv_data_size = sizeof(LibGSMDecodeContext),
.init = libgsm_decode_init,
.close = libgsm_decode_close,
.decode = libgsm_decode_frame,
.flush = libgsm_flush,
.capabilities = CODEC_CAP_DR1,
- .long_name = NULL_IF_CONFIG_SMALL("libgsm GSM"),
+ .long_name = NULL_IF_CONFIG_SMALL("libgsm GSM"),
};
AVCodec ff_libgsm_ms_decoder = {
.name = "libgsm_ms",
.type = AVMEDIA_TYPE_AUDIO,
- .id = CODEC_ID_GSM_MS,
+ .id = AV_CODEC_ID_GSM_MS,
.priv_data_size = sizeof(LibGSMDecodeContext),
.init = libgsm_decode_init,
.close = libgsm_decode_close,
.decode = libgsm_decode_frame,
.flush = libgsm_flush,
.capabilities = CODEC_CAP_DR1,
- .long_name = NULL_IF_CONFIG_SMALL("libgsm GSM Microsoft variant"),
+ .long_name = NULL_IF_CONFIG_SMALL("libgsm GSM Microsoft variant"),
};
diff --git a/gst-libs/ext/libav/libavcodec/libilbc.c b/gst-libs/ext/libav/libavcodec/libilbc.c
new file mode 100644
index 0000000..9acaa40
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/libilbc.c
@@ -0,0 +1,212 @@
+/*
+ * iLBC decoder/encoder stub
+ * Copyright (c) 2012 Martin Storsjo
+ *
+ * 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
+ */
+
+#include <ilbc.h>
+
+#include "libavutil/channel_layout.h"
+#include "libavutil/common.h"
+#include "libavutil/opt.h"
+#include "avcodec.h"
+#include "internal.h"
+
+static int get_mode(AVCodecContext *avctx)
+{
+ if (avctx->block_align == 38)
+ return 20;
+ else if (avctx->block_align == 50)
+ return 30;
+ else if (avctx->bit_rate > 0)
+ return avctx->bit_rate <= 14000 ? 30 : 20;
+ else
+ return -1;
+}
+
+typedef struct ILBCDecContext {
+ const AVClass *class;
+ AVFrame frame;
+ iLBC_Dec_Inst_t decoder;
+ int enhance;
+} ILBCDecContext;
+
+static const AVOption ilbc_dec_options[] = {
+ { "enhance", "Enhance the decoded audio (adds delay)", offsetof(ILBCDecContext, enhance), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_DECODING_PARAM },
+ { NULL }
+};
+
+static const AVClass ilbc_dec_class = {
+ "libilbc", av_default_item_name, ilbc_dec_options, LIBAVUTIL_VERSION_INT
+};
+
+static av_cold int ilbc_decode_init(AVCodecContext *avctx)
+{
+ ILBCDecContext *s = avctx->priv_data;
+ int mode;
+
+ if ((mode = get_mode(avctx)) < 0) {
+ av_log(avctx, AV_LOG_ERROR, "iLBC frame mode not indicated\n");
+ return AVERROR(EINVAL);
+ }
+
+ WebRtcIlbcfix_InitDecode(&s->decoder, mode, s->enhance);
+ avcodec_get_frame_defaults(&s->frame);
+ avctx->coded_frame = &s->frame;
+
+ avctx->channels = 1;
+ avctx->channel_layout = AV_CH_LAYOUT_MONO;
+ avctx->sample_rate = 8000;
+ avctx->sample_fmt = AV_SAMPLE_FMT_S16;
+
+ return 0;
+}
+
+static int ilbc_decode_frame(AVCodecContext *avctx, void *data,
+ int *got_frame_ptr, AVPacket *avpkt)
+{
+ const uint8_t *buf = avpkt->data;
+ int buf_size = avpkt->size;
+ ILBCDecContext *s = avctx->priv_data;
+ int ret;
+
+ if (s->decoder.no_of_bytes > buf_size) {
+ av_log(avctx, AV_LOG_ERROR, "iLBC frame too short (%u, should be %u)\n",
+ buf_size, s->decoder.no_of_bytes);
+ return AVERROR_INVALIDDATA;
+ }
+
+ s->frame.nb_samples = s->decoder.blockl;
+ if ((ret = ff_get_buffer(avctx, &s->frame)) < 0) {
+ av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
+ return ret;
+ }
+
+ WebRtcIlbcfix_DecodeImpl((WebRtc_Word16*) s->frame.data[0],
+ (const WebRtc_UWord16*) buf, &s->decoder, 1);
+
+ *got_frame_ptr = 1;
+ *(AVFrame *)data = s->frame;
+
+ return s->decoder.no_of_bytes;
+}
+
+AVCodec ff_libilbc_decoder = {
+ .name = "libilbc",
+ .type = AVMEDIA_TYPE_AUDIO,
+ .id = AV_CODEC_ID_ILBC,
+ .priv_data_size = sizeof(ILBCDecContext),
+ .init = ilbc_decode_init,
+ .decode = ilbc_decode_frame,
+ .capabilities = CODEC_CAP_DR1,
+ .long_name = NULL_IF_CONFIG_SMALL("iLBC (Internet Low Bitrate Codec)"),
+ .priv_class = &ilbc_dec_class,
+};
+
+typedef struct ILBCEncContext {
+ const AVClass *class;
+ iLBC_Enc_Inst_t encoder;
+ int mode;
+} ILBCEncContext;
+
+static const AVOption ilbc_enc_options[] = {
+ { "mode", "iLBC mode (20 or 30 ms frames)", offsetof(ILBCEncContext, mode), AV_OPT_TYPE_INT, { .i64 = 20 }, 20, 30, AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM },
+ { NULL }
+};
+
+static const AVClass ilbc_enc_class = {
+ "libilbc", av_default_item_name, ilbc_enc_options, LIBAVUTIL_VERSION_INT
+};
+
+static av_cold int ilbc_encode_init(AVCodecContext *avctx)
+{
+ ILBCEncContext *s = avctx->priv_data;
+ int mode;
+
+ if (avctx->sample_rate != 8000) {
+ av_log(avctx, AV_LOG_ERROR, "Only 8000Hz sample rate supported\n");
+ return AVERROR(EINVAL);
+ }
+
+ if (avctx->channels != 1) {
+ av_log(avctx, AV_LOG_ERROR, "Only mono supported\n");
+ return AVERROR(EINVAL);
+ }
+
+ if ((mode = get_mode(avctx)) > 0)
+ s->mode = mode;
+ else
+ s->mode = s->mode != 30 ? 20 : 30;
+ WebRtcIlbcfix_InitEncode(&s->encoder, s->mode);
+
+ avctx->block_align = s->encoder.no_of_bytes;
+ avctx->frame_size = s->encoder.blockl;
+#if FF_API_OLD_ENCODE_AUDIO
+ avctx->coded_frame = avcodec_alloc_frame();
+ if (!avctx->coded_frame)
+ return AVERROR(ENOMEM);
+#endif
+
+ return 0;
+}
+
+static av_cold int ilbc_encode_close(AVCodecContext *avctx)
+{
+#if FF_API_OLD_ENCODE_AUDIO
+ av_freep(&avctx->coded_frame);
+#endif
+ return 0;
+}
+
+static int ilbc_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
+ const AVFrame *frame, int *got_packet_ptr)
+{
+ ILBCEncContext *s = avctx->priv_data;
+ int ret;
+
+ if ((ret = ff_alloc_packet(avpkt, 50))) {
+ av_log(avctx, AV_LOG_ERROR, "Error getting output packet\n");
+ return ret;
+ }
+
+ WebRtcIlbcfix_EncodeImpl((WebRtc_UWord16*) avpkt->data, (const WebRtc_Word16*) frame->data[0], &s->encoder);
+
+ avpkt->size = s->encoder.no_of_bytes;
+ *got_packet_ptr = 1;
+ return 0;
+}
+
+static const AVCodecDefault ilbc_encode_defaults[] = {
+ { "b", "0" },
+ { NULL }
+};
+
+AVCodec ff_libilbc_encoder = {
+ .name = "libilbc",
+ .type = AVMEDIA_TYPE_AUDIO,
+ .id = AV_CODEC_ID_ILBC,
+ .priv_data_size = sizeof(ILBCEncContext),
+ .init = ilbc_encode_init,
+ .encode2 = ilbc_encode_frame,
+ .close = ilbc_encode_close,
+ .sample_fmts = (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_S16,
+ AV_SAMPLE_FMT_NONE },
+ .long_name = NULL_IF_CONFIG_SMALL("iLBC (Internet Low Bitrate Codec)"),
+ .defaults = ilbc_encode_defaults,
+ .priv_class = &ilbc_enc_class,
+};
diff --git a/gst-libs/ext/libav/libavcodec/libmp3lame.c b/gst-libs/ext/libav/libavcodec/libmp3lame.c
index f3c4528..2e501ca 100644
--- a/gst-libs/ext/libav/libavcodec/libmp3lame.c
+++ b/gst-libs/ext/libav/libavcodec/libmp3lame.c
@@ -24,200 +24,257 @@
* Interface to libmp3lame for mp3 encoding.
*/
+#include <lame/lame.h>
+
+#include "libavutil/channel_layout.h"
+#include "libavutil/common.h"
+#include "libavutil/float_dsp.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/log.h"
#include "libavutil/opt.h"
#include "avcodec.h"
+#include "audio_frame_queue.h"
+#include "internal.h"
#include "mpegaudio.h"
-#include <lame/lame.h>
+#include "mpegaudiodecheader.h"
#define BUFFER_SIZE (7200 + 2 * MPA_FRAME_SIZE + MPA_FRAME_SIZE / 4)
-typedef struct Mp3AudioContext {
+
+typedef struct LAMEContext {
AVClass *class;
+ AVCodecContext *avctx;
lame_global_flags *gfp;
- int stereo;
- uint8_t buffer[BUFFER_SIZE];
+ uint8_t *buffer;
int buffer_index;
+ int buffer_size;
int reservoir;
-} Mp3AudioContext;
+ float *samples_flt[2];
+ AudioFrameQueue afq;
+ AVFloatDSPContext fdsp;
+} LAMEContext;
+
-static av_cold int MP3lame_encode_init(AVCodecContext *avctx)
+static int realloc_buffer(LAMEContext *s)
{
- Mp3AudioContext *s = avctx->priv_data;
+ if (!s->buffer || s->buffer_size - s->buffer_index < BUFFER_SIZE) {
+ uint8_t *tmp;
+ int new_size = s->buffer_index + 2 * BUFFER_SIZE;
+
+ av_dlog(s->avctx, "resizing output buffer: %d -> %d\n", s->buffer_size,
+ new_size);
+ tmp = av_realloc(s->buffer, new_size);
+ if (!tmp) {
+ av_freep(&s->buffer);
+ s->buffer_size = s->buffer_index = 0;
+ return AVERROR(ENOMEM);
+ }
+ s->buffer = tmp;
+ s->buffer_size = new_size;
+ }
+ return 0;
+}
- if (avctx->channels > 2)
- return -1;
+static av_cold int mp3lame_encode_close(AVCodecContext *avctx)
+{
+ LAMEContext *s = avctx->priv_data;
+
+#if FF_API_OLD_ENCODE_AUDIO
+ av_freep(&avctx->coded_frame);
+#endif
+ av_freep(&s->samples_flt[0]);
+ av_freep(&s->samples_flt[1]);
+ av_freep(&s->buffer);
+
+ ff_af_queue_close(&s->afq);
+
+ lame_close(s->gfp);
+ return 0;
+}
- s->stereo = avctx->channels > 1 ? 1 : 0;
+static av_cold int mp3lame_encode_init(AVCodecContext *avctx)
+{
+ LAMEContext *s = avctx->priv_data;
+ int ret;
+
+ s->avctx = avctx;
+ /* initialize LAME and get defaults */
if ((s->gfp = lame_init()) == NULL)
- goto err;
- lame_set_in_samplerate(s->gfp, avctx->sample_rate);
- lame_set_out_samplerate(s->gfp, avctx->sample_rate);
+ return AVERROR(ENOMEM);
+
lame_set_num_channels(s->gfp, avctx->channels);
- if (avctx->compression_level == FF_COMPRESSION_DEFAULT) {
+ lame_set_mode(s->gfp, avctx->channels > 1 ? JOINT_STEREO : MONO);
+
+ /* sample rate */
+ lame_set_in_samplerate (s->gfp, avctx->sample_rate);
+ lame_set_out_samplerate(s->gfp, avctx->sample_rate);
+
+ /* algorithmic quality */
+ if (avctx->compression_level == FF_COMPRESSION_DEFAULT)
lame_set_quality(s->gfp, 5);
- } else {
+ else
lame_set_quality(s->gfp, avctx->compression_level);
- }
- lame_set_mode(s->gfp, s->stereo ? JOINT_STEREO : MONO);
- lame_set_brate(s->gfp, avctx->bit_rate / 1000);
+
+ /* rate control */
if (avctx->flags & CODEC_FLAG_QSCALE) {
- lame_set_brate(s->gfp, 0);
lame_set_VBR(s->gfp, vbr_default);
lame_set_VBR_quality(s->gfp, avctx->global_quality / (float)FF_QP2LAMBDA);
+ } else {
+ if (avctx->bit_rate)
+ lame_set_brate(s->gfp, avctx->bit_rate / 1000);
}
- lame_set_bWriteVbrTag(s->gfp,0);
-#if FF_API_LAME_GLOBAL_OPTS
- s->reservoir = avctx->flags2 & CODEC_FLAG2_BIT_RESERVOIR;
-#endif
- lame_set_disable_reservoir(s->gfp, !s->reservoir);
- if (lame_init_params(s->gfp) < 0)
- goto err_close;
-
- avctx->frame_size = lame_get_framesize(s->gfp);
- avctx->coded_frame = avcodec_alloc_frame();
- avctx->coded_frame->key_frame = 1;
- return 0;
-
-err_close:
- lame_close(s->gfp);
-err:
- return -1;
-}
+ /* do not get a Xing VBR header frame from LAME */
+ lame_set_bWriteVbrTag(s->gfp,0);
-static const int sSampleRates[] = {
- 44100, 48000, 32000, 22050, 24000, 16000, 11025, 12000, 8000, 0
-};
+ /* bit reservoir usage */
+ lame_set_disable_reservoir(s->gfp, !s->reservoir);
-static const int sBitRates[2][3][15] = {
- {
- { 0, 32, 64, 96, 128, 160, 192, 224, 256, 288, 320, 352, 384, 416, 448 },
- { 0, 32, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 384 },
- { 0, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320 }
- },
- {
- { 0, 32, 48, 56, 64, 80, 96, 112, 128, 144, 160, 176, 192, 224, 256 },
- { 0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160 },
- { 0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160 }
- },
-};
+ /* set specified parameters */
+ if (lame_init_params(s->gfp) < 0) {
+ ret = -1;
+ goto error;
+ }
-static const int sSamplesPerFrame[2][3] = {
- { 384, 1152, 1152 },
- { 384, 1152, 576 }
-};
+ /* get encoder delay */
+ avctx->delay = lame_get_encoder_delay(s->gfp) + 528 + 1;
+ ff_af_queue_init(avctx, &s->afq);
-static const int sBitsPerSlot[3] = { 32, 8, 8 };
+ avctx->frame_size = lame_get_framesize(s->gfp);
-static int mp3len(void *data, int *samplesPerFrame, int *sampleRate)
-{
- uint32_t header = AV_RB32(data);
- int layerID = 3 - ((header >> 17) & 0x03);
- int bitRateID = ((header >> 12) & 0x0f);
- int sampleRateID = ((header >> 10) & 0x03);
- int bitsPerSlot = sBitsPerSlot[layerID];
- int isPadded = ((header >> 9) & 0x01);
- static int const mode_tab[4] = { 2, 3, 1, 0 };
- int mode = mode_tab[(header >> 19) & 0x03];
- int mpeg_id = mode > 0;
- int temp0, temp1, bitRate;
-
- if (((header >> 21) & 0x7ff) != 0x7ff || mode == 3 || layerID == 3 ||
- sampleRateID == 3) {
- return -1;
+#if FF_API_OLD_ENCODE_AUDIO
+ avctx->coded_frame = avcodec_alloc_frame();
+ if (!avctx->coded_frame) {
+ ret = AVERROR(ENOMEM);
+ goto error;
}
+#endif
- if (!samplesPerFrame)
- samplesPerFrame = &temp0;
- if (!sampleRate)
- sampleRate = &temp1;
+ /* allocate float sample buffers */
+ if (avctx->sample_fmt == AV_SAMPLE_FMT_FLTP) {
+ int ch;
+ for (ch = 0; ch < avctx->channels; ch++) {
+ s->samples_flt[ch] = av_malloc(avctx->frame_size *
+ sizeof(*s->samples_flt[ch]));
+ if (!s->samples_flt[ch]) {
+ ret = AVERROR(ENOMEM);
+ goto error;
+ }
+ }
+ }
- //*isMono = ((header >> 6) & 0x03) == 0x03;
+ ret = realloc_buffer(s);
+ if (ret < 0)
+ goto error;
- *sampleRate = sSampleRates[sampleRateID] >> mode;
- bitRate = sBitRates[mpeg_id][layerID][bitRateID] * 1000;
- *samplesPerFrame = sSamplesPerFrame[mpeg_id][layerID];
- //av_log(NULL, AV_LOG_DEBUG,
- // "sr:%d br:%d spf:%d l:%d m:%d\n",
- // *sampleRate, bitRate, *samplesPerFrame, layerID, mode);
+ avpriv_float_dsp_init(&s->fdsp, avctx->flags & CODEC_FLAG_BITEXACT);
- return *samplesPerFrame * bitRate / (bitsPerSlot * *sampleRate) + isPadded;
+ return 0;
+error:
+ mp3lame_encode_close(avctx);
+ return ret;
}
-static int MP3lame_encode_frame(AVCodecContext *avctx, unsigned char *frame,
- int buf_size, void *data)
+#define ENCODE_BUFFER(func, buf_type, buf_name) do { \
+ lame_result = func(s->gfp, \
+ (const buf_type *)buf_name[0], \
+ (const buf_type *)buf_name[1], frame->nb_samples, \
+ s->buffer + s->buffer_index, \
+ s->buffer_size - s->buffer_index); \
+} while (0)
+
+static int mp3lame_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
+ const AVFrame *frame, int *got_packet_ptr)
{
- Mp3AudioContext *s = avctx->priv_data;
- int len;
+ LAMEContext *s = avctx->priv_data;
+ MPADecodeHeader hdr;
+ int len, ret, ch;
int lame_result;
- /* lame 3.91 dies on '1-channel interleaved' data */
-
- if (data) {
- if (s->stereo) {
- lame_result = lame_encode_buffer_interleaved(s->gfp, data,
- avctx->frame_size,
- s->buffer + s->buffer_index,
- BUFFER_SIZE - s->buffer_index);
- } else {
- lame_result = lame_encode_buffer(s->gfp, data, data,
- avctx->frame_size, s->buffer +
- s->buffer_index, BUFFER_SIZE -
- s->buffer_index);
+ if (frame) {
+ switch (avctx->sample_fmt) {
+ case AV_SAMPLE_FMT_S16P:
+ ENCODE_BUFFER(lame_encode_buffer, int16_t, frame->data);
+ break;
+ case AV_SAMPLE_FMT_S32P:
+ ENCODE_BUFFER(lame_encode_buffer_int, int32_t, frame->data);
+ break;
+ case AV_SAMPLE_FMT_FLTP:
+ if (frame->linesize[0] < 4 * FFALIGN(frame->nb_samples, 8)) {
+ av_log(avctx, AV_LOG_ERROR, "inadequate AVFrame plane padding\n");
+ return AVERROR(EINVAL);
+ }
+ for (ch = 0; ch < avctx->channels; ch++) {
+ s->fdsp.vector_fmul_scalar(s->samples_flt[ch],
+ (const float *)frame->data[ch],
+ 32768.0f,
+ FFALIGN(frame->nb_samples, 8));
+ }
+ ENCODE_BUFFER(lame_encode_buffer_float, float, s->samples_flt);
+ break;
+ default:
+ return AVERROR_BUG;
}
} else {
lame_result = lame_encode_flush(s->gfp, s->buffer + s->buffer_index,
- BUFFER_SIZE - s->buffer_index);
+ s->buffer_size - s->buffer_index);
}
-
if (lame_result < 0) {
if (lame_result == -1) {
- /* output buffer too small */
av_log(avctx, AV_LOG_ERROR,
"lame: output buffer too small (buffer index: %d, free bytes: %d)\n",
- s->buffer_index, BUFFER_SIZE - s->buffer_index);
+ s->buffer_index, s->buffer_size - s->buffer_index);
}
return -1;
}
-
s->buffer_index += lame_result;
+ ret = realloc_buffer(s);
+ if (ret < 0) {
+ av_log(avctx, AV_LOG_ERROR, "error reallocating output buffer\n");
+ return ret;
+ }
+
+ /* add current frame to the queue */
+ if (frame) {
+ if ((ret = ff_af_queue_add(&s->afq, frame)) < 0)
+ return ret;
+ }
+ /* Move 1 frame from the LAME buffer to the output packet, if available.
+ We have to parse the first frame header in the output buffer to
+ determine the frame size. */
if (s->buffer_index < 4)
return 0;
-
- len = mp3len(s->buffer, NULL, NULL);
- //av_log(avctx, AV_LOG_DEBUG, "in:%d packet-len:%d index:%d\n",
- // avctx->frame_size, len, s->buffer_index);
+ if (avpriv_mpegaudio_decode_header(&hdr, AV_RB32(s->buffer))) {
+ av_log(avctx, AV_LOG_ERROR, "free format output not supported\n");
+ return -1;
+ }
+ len = hdr.frame_size;
+ av_dlog(avctx, "in:%d packet-len:%d index:%d\n", avctx->frame_size, len,
+ s->buffer_index);
if (len <= s->buffer_index) {
- memcpy(frame, s->buffer, len);
+ if ((ret = ff_alloc_packet(avpkt, len))) {
+ av_log(avctx, AV_LOG_ERROR, "Error getting output packet\n");
+ return ret;
+ }
+ memcpy(avpkt->data, s->buffer, len);
s->buffer_index -= len;
-
memmove(s->buffer, s->buffer + len, s->buffer_index);
- // FIXME fix the audio codec API, so we do not need the memcpy()
- /*for(i=0; i<len; i++) {
- av_log(avctx, AV_LOG_DEBUG, "%2X ", frame[i]);
- }*/
- return len;
- } else
- return 0;
-}
-
-static av_cold int MP3lame_encode_close(AVCodecContext *avctx)
-{
- Mp3AudioContext *s = avctx->priv_data;
- av_freep(&avctx->coded_frame);
+ /* Get the next frame pts/duration */
+ ff_af_queue_remove(&s->afq, avctx->frame_size, &avpkt->pts,
+ &avpkt->duration);
- lame_close(s->gfp);
+ avpkt->size = len;
+ *got_packet_ptr = 1;
+ }
return 0;
}
-#define OFFSET(x) offsetof(Mp3AudioContext, x)
+#define OFFSET(x) offsetof(LAMEContext, x)
#define AE AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
static const AVOption options[] = {
- { "reservoir", "Use bit reservoir.", OFFSET(reservoir), AV_OPT_TYPE_INT, { 1 }, 0, 1, AE },
+ { "reservoir", "Use bit reservoir.", OFFSET(reservoir), AV_OPT_TYPE_INT, { .i64 = 1 }, 0, 1, AE },
{ NULL },
};
@@ -228,18 +285,33 @@ static const AVClass libmp3lame_class = {
.version = LIBAVUTIL_VERSION_INT,
};
+static const AVCodecDefault libmp3lame_defaults[] = {
+ { "b", "0" },
+ { NULL },
+};
+
+static const int libmp3lame_sample_rates[] = {
+ 44100, 48000, 32000, 22050, 24000, 16000, 11025, 12000, 8000, 0
+};
+
AVCodec ff_libmp3lame_encoder = {
.name = "libmp3lame",
.type = AVMEDIA_TYPE_AUDIO,
- .id = CODEC_ID_MP3,
- .priv_data_size = sizeof(Mp3AudioContext),
- .init = MP3lame_encode_init,
- .encode = MP3lame_encode_frame,
- .close = MP3lame_encode_close,
- .capabilities = CODEC_CAP_DELAY,
- .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_S16,
+ .id = AV_CODEC_ID_MP3,
+ .priv_data_size = sizeof(LAMEContext),
+ .init = mp3lame_encode_init,
+ .encode2 = mp3lame_encode_frame,
+ .close = mp3lame_encode_close,
+ .capabilities = CODEC_CAP_DELAY | CODEC_CAP_SMALL_LAST_FRAME,
+ .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_S32P,
+ AV_SAMPLE_FMT_FLTP,
+ AV_SAMPLE_FMT_S16P,
AV_SAMPLE_FMT_NONE },
- .supported_samplerates = sSampleRates,
+ .supported_samplerates = libmp3lame_sample_rates,
+ .channel_layouts = (const uint64_t[]) { AV_CH_LAYOUT_MONO,
+ AV_CH_LAYOUT_STEREO,
+ 0 },
.long_name = NULL_IF_CONFIG_SMALL("libmp3lame MP3 (MPEG audio layer 3)"),
.priv_class = &libmp3lame_class,
+ .defaults = libmp3lame_defaults,
};
diff --git a/gst-libs/ext/libav/libavcodec/libopencore-amr.c b/gst-libs/ext/libav/libavcodec/libopencore-amr.c
index ded9217..be98b1f 100644
--- a/gst-libs/ext/libav/libavcodec/libopencore-amr.c
+++ b/gst-libs/ext/libav/libavcodec/libopencore-amr.c
@@ -19,22 +19,29 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "avcodec.h"
#include "libavutil/avstring.h"
+#include "libavutil/channel_layout.h"
+#include "libavutil/common.h"
#include "libavutil/opt.h"
+#include "avcodec.h"
+#include "audio_frame_queue.h"
+#include "internal.h"
-static void amr_decode_fix_avctx(AVCodecContext *avctx)
+static int amr_decode_fix_avctx(AVCodecContext *avctx)
{
- const int is_amr_wb = 1 + (avctx->codec_id == CODEC_ID_AMR_WB);
+ const int is_amr_wb = 1 + (avctx->codec_id == AV_CODEC_ID_AMR_WB);
- if (!avctx->sample_rate)
- avctx->sample_rate = 8000 * is_amr_wb;
+ avctx->sample_rate = 8000 * is_amr_wb;
- if (!avctx->channels)
- avctx->channels = 1;
+ if (avctx->channels > 1) {
+ av_log_missing_feature(avctx, "multi-channel AMR", 0);
+ return AVERROR_PATCHWELCOME;
+ }
- avctx->frame_size = 160 * is_amr_wb;
- avctx->sample_fmt = AV_SAMPLE_FMT_S16;
+ avctx->channels = 1;
+ avctx->channel_layout = AV_CH_LAYOUT_MONO;
+ avctx->sample_fmt = AV_SAMPLE_FMT_S16;
+ return 0;
}
#if CONFIG_LIBOPENCORE_AMRNB
@@ -42,41 +49,6 @@ static void amr_decode_fix_avctx(AVCodecContext *avctx)
#include <opencore-amrnb/interf_dec.h>
#include <opencore-amrnb/interf_enc.h>
-/* Common code for fixed and float version*/
-typedef struct AMR_bitrates {
- int rate;
- enum Mode mode;
-} AMR_bitrates;
-
-/* Match desired bitrate */
-static int get_bitrate_mode(int bitrate, void *log_ctx)
-{
- /* make the correspondance between bitrate and mode */
- static const AMR_bitrates rates[] = {
- { 4750, MR475 }, { 5150, MR515 }, { 5900, MR59 }, { 6700, MR67 },
- { 7400, MR74 }, { 7950, MR795 }, { 10200, MR102 }, { 12200, MR122 }
- };
- int i, best = -1, min_diff = 0;
- char log_buf[200];
-
- for (i = 0; i < 8; i++) {
- if (rates[i].rate == bitrate)
- return rates[i].mode;
- if (best < 0 || abs(rates[i].rate - bitrate) < min_diff) {
- best = i;
- min_diff = abs(rates[i].rate - bitrate);
- }
- }
- /* no bitrate matching exactly, log a warning */
- snprintf(log_buf, sizeof(log_buf), "bitrate not supported: use one of ");
- for (i = 0; i < 8; i++)
- av_strlcatf(log_buf, sizeof(log_buf), "%.2fk, ", rates[i].rate / 1000.f);
- av_strlcatf(log_buf, sizeof(log_buf), "using %.2fk", rates[best].rate / 1000.f);
- av_log(log_ctx, AV_LOG_WARNING, "%s\n", log_buf);
-
- return best;
-}
-
typedef struct AMRContext {
AVClass *av_class;
AVFrame frame;
@@ -85,20 +57,18 @@ typedef struct AMRContext {
int enc_bitrate;
int enc_mode;
int enc_dtx;
+ int enc_last_frame;
+ AudioFrameQueue afq;
} AMRContext;
-static const AVOption options[] = {
- { "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 }
-};
-
-static const AVClass class = {
- "libopencore_amrnb", av_default_item_name, options, LIBAVUTIL_VERSION_INT
-};
-
+#if CONFIG_LIBOPENCORE_AMRNB_DECODER
static av_cold int amr_nb_decode_init(AVCodecContext *avctx)
{
AMRContext *s = avctx->priv_data;
+ int ret;
+
+ if ((ret = amr_decode_fix_avctx(avctx)) < 0)
+ return ret;
s->dec_state = Decoder_Interface_init();
if (!s->dec_state) {
@@ -106,13 +76,6 @@ static av_cold int amr_nb_decode_init(AVCodecContext *avctx)
return -1;
}
- amr_decode_fix_avctx(avctx);
-
- if (avctx->channels > 1) {
- av_log(avctx, AV_LOG_ERROR, "amr_nb: multichannel decoding not supported\n");
- return AVERROR(ENOSYS);
- }
-
avcodec_get_frame_defaults(&s->frame);
avctx->coded_frame = &s->frame;
@@ -143,7 +106,7 @@ static int amr_nb_decode_frame(AVCodecContext *avctx, void *data,
/* get output buffer */
s->frame.nb_samples = 160;
- if ((ret = avctx->get_buffer(avctx, &s->frame)) < 0) {
+ if ((ret = ff_get_buffer(avctx, &s->frame)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return ret;
}
@@ -171,13 +134,59 @@ static int amr_nb_decode_frame(AVCodecContext *avctx, void *data,
AVCodec ff_libopencore_amrnb_decoder = {
.name = "libopencore_amrnb",
.type = AVMEDIA_TYPE_AUDIO,
- .id = CODEC_ID_AMR_NB,
+ .id = AV_CODEC_ID_AMR_NB,
.priv_data_size = sizeof(AMRContext),
.init = amr_nb_decode_init,
.close = amr_nb_decode_close,
.decode = amr_nb_decode_frame,
.capabilities = CODEC_CAP_DR1,
- .long_name = NULL_IF_CONFIG_SMALL("OpenCORE Adaptive Multi-Rate (AMR) Narrow-Band"),
+ .long_name = NULL_IF_CONFIG_SMALL("OpenCORE AMR-NB (Adaptive Multi-Rate Narrow-Band)"),
+};
+#endif /* CONFIG_LIBOPENCORE_AMRNB_DECODER */
+
+#if CONFIG_LIBOPENCORE_AMRNB_ENCODER
+/* Common code for fixed and float version*/
+typedef struct AMR_bitrates {
+ int rate;
+ enum Mode mode;
+} AMR_bitrates;
+
+/* Match desired bitrate */
+static int get_bitrate_mode(int bitrate, void *log_ctx)
+{
+ /* make the correspondance between bitrate and mode */
+ static const AMR_bitrates rates[] = {
+ { 4750, MR475 }, { 5150, MR515 }, { 5900, MR59 }, { 6700, MR67 },
+ { 7400, MR74 }, { 7950, MR795 }, { 10200, MR102 }, { 12200, MR122 }
+ };
+ int i, best = -1, min_diff = 0;
+ char log_buf[200];
+
+ for (i = 0; i < 8; i++) {
+ if (rates[i].rate == bitrate)
+ return rates[i].mode;
+ if (best < 0 || abs(rates[i].rate - bitrate) < min_diff) {
+ best = i;
+ min_diff = abs(rates[i].rate - bitrate);
+ }
+ }
+ /* no bitrate matching exactly, log a warning */
+ snprintf(log_buf, sizeof(log_buf), "bitrate not supported: use one of ");
+ for (i = 0; i < 8; i++)
+ av_strlcatf(log_buf, sizeof(log_buf), "%.2fk, ", rates[i].rate / 1000.f);
+ av_strlcatf(log_buf, sizeof(log_buf), "using %.2fk", rates[best].rate / 1000.f);
+ av_log(log_ctx, AV_LOG_WARNING, "%s\n", log_buf);
+
+ return best;
+}
+
+static const AVOption options[] = {
+ { "dtx", "Allow DTX (generate comfort noise)", offsetof(AMRContext, enc_dtx), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM },
+ { NULL }
+};
+
+static const AVClass class = {
+ "libopencore_amrnb", av_default_item_name, options, LIBAVUTIL_VERSION_INT
};
static av_cold int amr_nb_encode_init(AVCodecContext *avctx)
@@ -195,11 +204,18 @@ static av_cold int amr_nb_encode_init(AVCodecContext *avctx)
}
avctx->frame_size = 160;
+ avctx->delay = 50;
+ ff_af_queue_init(avctx, &s->afq);
+#if FF_API_OLD_ENCODE_AUDIO
avctx->coded_frame = avcodec_alloc_frame();
+ if (!avctx->coded_frame)
+ return AVERROR(ENOMEM);
+#endif
s->enc_state = Encoder_Interface_init(s->enc_dtx);
if (!s->enc_state) {
av_log(avctx, AV_LOG_ERROR, "Encoder_Interface_init error\n");
+ av_freep(&avctx->coded_frame);
return -1;
}
@@ -214,47 +230,90 @@ static av_cold int amr_nb_encode_close(AVCodecContext *avctx)
AMRContext *s = avctx->priv_data;
Encoder_Interface_exit(s->enc_state);
+ ff_af_queue_close(&s->afq);
+#if FF_API_OLD_ENCODE_AUDIO
av_freep(&avctx->coded_frame);
+#endif
return 0;
}
-static int amr_nb_encode_frame(AVCodecContext *avctx,
- unsigned char *frame/*out*/,
- int buf_size, void *data/*in*/)
+static int amr_nb_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
+ const AVFrame *frame, int *got_packet_ptr)
{
AMRContext *s = avctx->priv_data;
- int written;
+ int written, ret;
+ int16_t *flush_buf = NULL;
+ const int16_t *samples = frame ? (const int16_t *)frame->data[0] : NULL;
if (s->enc_bitrate != avctx->bit_rate) {
s->enc_mode = get_bitrate_mode(avctx->bit_rate, avctx);
s->enc_bitrate = avctx->bit_rate;
}
- written = Encoder_Interface_Encode(s->enc_state, s->enc_mode, data,
- frame, 0);
+ if ((ret = ff_alloc_packet(avpkt, 32))) {
+ av_log(avctx, AV_LOG_ERROR, "Error getting output packet\n");
+ return ret;
+ }
+
+ if (frame) {
+ if (frame->nb_samples < avctx->frame_size) {
+ flush_buf = av_mallocz(avctx->frame_size * sizeof(*flush_buf));
+ if (!flush_buf)
+ return AVERROR(ENOMEM);
+ memcpy(flush_buf, samples, frame->nb_samples * sizeof(*flush_buf));
+ samples = flush_buf;
+ if (frame->nb_samples < avctx->frame_size - avctx->delay)
+ s->enc_last_frame = -1;
+ }
+ if ((ret = ff_af_queue_add(&s->afq, frame)) < 0) {
+ av_freep(&flush_buf);
+ return ret;
+ }
+ } else {
+ if (s->enc_last_frame < 0)
+ return 0;
+ flush_buf = av_mallocz(avctx->frame_size * sizeof(*flush_buf));
+ if (!flush_buf)
+ return AVERROR(ENOMEM);
+ samples = flush_buf;
+ s->enc_last_frame = -1;
+ }
+
+ written = Encoder_Interface_Encode(s->enc_state, s->enc_mode, samples,
+ avpkt->data, 0);
av_dlog(avctx, "amr_nb_encode_frame encoded %u bytes, bitrate %u, first byte was %#02x\n",
written, s->enc_mode, frame[0]);
- return written;
+ /* Get the next frame pts/duration */
+ ff_af_queue_remove(&s->afq, avctx->frame_size, &avpkt->pts,
+ &avpkt->duration);
+
+ avpkt->size = written;
+ *got_packet_ptr = 1;
+ av_freep(&flush_buf);
+ return 0;
}
AVCodec ff_libopencore_amrnb_encoder = {
.name = "libopencore_amrnb",
.type = AVMEDIA_TYPE_AUDIO,
- .id = CODEC_ID_AMR_NB,
+ .id = AV_CODEC_ID_AMR_NB,
.priv_data_size = sizeof(AMRContext),
.init = amr_nb_encode_init,
- .encode = amr_nb_encode_frame,
+ .encode2 = amr_nb_encode_frame,
.close = amr_nb_encode_close,
- .sample_fmts = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_NONE},
- .long_name = NULL_IF_CONFIG_SMALL("OpenCORE Adaptive Multi-Rate (AMR) Narrow-Band"),
- .priv_class = &class,
+ .capabilities = CODEC_CAP_DELAY | CODEC_CAP_SMALL_LAST_FRAME,
+ .sample_fmts = (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_S16,
+ AV_SAMPLE_FMT_NONE },
+ .long_name = NULL_IF_CONFIG_SMALL("OpenCORE AMR-NB (Adaptive Multi-Rate Narrow-Band)"),
+ .priv_class = &class,
};
+#endif /* CONFIG_LIBOPENCORE_AMRNB_ENCODER */
-#endif
+#endif /* CONFIG_LIBOPENCORE_AMRNB */
/* -----------AMR wideband ------------*/
-#if CONFIG_LIBOPENCORE_AMRWB
+#if CONFIG_LIBOPENCORE_AMRWB_DECODER
#include <opencore-amrwb/dec_if.h>
#include <opencore-amrwb/if_rom.h>
@@ -267,15 +326,12 @@ typedef struct AMRWBContext {
static av_cold int amr_wb_decode_init(AVCodecContext *avctx)
{
AMRWBContext *s = avctx->priv_data;
+ int ret;
- s->state = D_IF_init();
-
- amr_decode_fix_avctx(avctx);
+ if ((ret = amr_decode_fix_avctx(avctx)) < 0)
+ return ret;
- if (avctx->channels > 1) {
- av_log(avctx, AV_LOG_ERROR, "amr_wb: multichannel decoding not supported\n");
- return AVERROR(ENOSYS);
- }
+ s->state = D_IF_init();
avcodec_get_frame_defaults(&s->frame);
avctx->coded_frame = &s->frame;
@@ -295,7 +351,7 @@ static int amr_wb_decode_frame(AVCodecContext *avctx, void *data,
/* get output buffer */
s->frame.nb_samples = 320;
- if ((ret = avctx->get_buffer(avctx, &s->frame)) < 0) {
+ if ((ret = ff_get_buffer(avctx, &s->frame)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return ret;
}
@@ -328,13 +384,13 @@ static int amr_wb_decode_close(AVCodecContext *avctx)
AVCodec ff_libopencore_amrwb_decoder = {
.name = "libopencore_amrwb",
.type = AVMEDIA_TYPE_AUDIO,
- .id = CODEC_ID_AMR_WB,
+ .id = AV_CODEC_ID_AMR_WB,
.priv_data_size = sizeof(AMRWBContext),
.init = amr_wb_decode_init,
.close = amr_wb_decode_close,
.decode = amr_wb_decode_frame,
.capabilities = CODEC_CAP_DR1,
- .long_name = NULL_IF_CONFIG_SMALL("OpenCORE Adaptive Multi-Rate (AMR) Wide-Band"),
+ .long_name = NULL_IF_CONFIG_SMALL("OpenCORE AMR-WB (Adaptive Multi-Rate Wide-Band)"),
};
-#endif /* CONFIG_LIBOPENCORE_AMRWB */
+#endif /* CONFIG_LIBOPENCORE_AMRWB_DECODER */
diff --git a/gst-libs/ext/libav/libavcodec/libopenjpeg.c b/gst-libs/ext/libav/libavcodec/libopenjpeg.c
deleted file mode 100644
index 1facd21..0000000
--- a/gst-libs/ext/libav/libavcodec/libopenjpeg.c
+++ /dev/null
@@ -1,225 +0,0 @@
-/*
- * JPEG 2000 decoding support via OpenJPEG
- * Copyright (c) 2009 Jaikrishnan Menon <realityman@gmx.net>
- *
- * 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
-* JPEG 2000 decoder using libopenjpeg
-*/
-
-#include "libavutil/imgutils.h"
-#include "avcodec.h"
-#include "libavutil/intreadwrite.h"
-#include "thread.h"
-#define OPJ_STATIC
-#include <openjpeg.h>
-
-#define JP2_SIG_TYPE 0x6A502020
-#define JP2_SIG_VALUE 0x0D0A870A
-
-typedef struct {
- opj_dparameters_t dec_params;
- AVFrame image;
-} LibOpenJPEGContext;
-
-static int check_image_attributes(opj_image_t *image)
-{
- return image->comps[0].dx == image->comps[1].dx &&
- image->comps[1].dx == image->comps[2].dx &&
- image->comps[0].dy == image->comps[1].dy &&
- image->comps[1].dy == image->comps[2].dy &&
- image->comps[0].prec == image->comps[1].prec &&
- image->comps[1].prec == image->comps[2].prec;
-}
-
-static av_cold int libopenjpeg_decode_init(AVCodecContext *avctx)
-{
- LibOpenJPEGContext *ctx = avctx->priv_data;
-
- opj_set_default_decoder_parameters(&ctx->dec_params);
- avctx->coded_frame = &ctx->image;
- return 0;
-}
-
-static av_cold int libopenjpeg_decode_init_thread_copy(AVCodecContext *avctx)
-{
- LibOpenJPEGContext *ctx = avctx->priv_data;
-
- avctx->coded_frame = &ctx->image;
- return 0;
-}
-
-static int libopenjpeg_decode_frame(AVCodecContext *avctx,
- void *data, int *data_size,
- AVPacket *avpkt)
-{
- uint8_t *buf = avpkt->data;
- int buf_size = avpkt->size;
- LibOpenJPEGContext *ctx = avctx->priv_data;
- AVFrame *picture = &ctx->image, *output = data;
- opj_dinfo_t *dec;
- opj_cio_t *stream;
- opj_image_t *image;
- int width, height, has_alpha = 0, ret = -1;
- int x, y, index;
- uint8_t *img_ptr;
- int adjust[4];
-
- *data_size = 0;
-
- // Check if input is a raw jpeg2k codestream or in jp2 wrapping
- if((AV_RB32(buf) == 12) &&
- (AV_RB32(buf + 4) == JP2_SIG_TYPE) &&
- (AV_RB32(buf + 8) == JP2_SIG_VALUE)) {
- dec = opj_create_decompress(CODEC_JP2);
- } else {
- // If the AVPacket contains a jp2c box, then skip to
- // the starting byte of the codestream.
- if (AV_RB32(buf + 4) == AV_RB32("jp2c"))
- buf += 8;
- dec = opj_create_decompress(CODEC_J2K);
- }
-
- if(!dec) {
- av_log(avctx, AV_LOG_ERROR, "Error initializing decoder.\n");
- return -1;
- }
- opj_set_event_mgr((opj_common_ptr)dec, NULL, NULL);
-
- ctx->dec_params.cp_limit_decoding = LIMIT_TO_MAIN_HEADER;
- // Tie decoder with decoding parameters
- opj_setup_decoder(dec, &ctx->dec_params);
- stream = opj_cio_open((opj_common_ptr)dec, buf, buf_size);
- if(!stream) {
- av_log(avctx, AV_LOG_ERROR, "Codestream could not be opened for reading.\n");
- opj_destroy_decompress(dec);
- return -1;
- }
-
- // Decode the header only
- image = opj_decode_with_info(dec, stream, NULL);
- opj_cio_close(stream);
- if(!image) {
- av_log(avctx, AV_LOG_ERROR, "Error decoding codestream.\n");
- opj_destroy_decompress(dec);
- return -1;
- }
- width = image->x1 - image->x0;
- height = image->y1 - image->y0;
- if(av_image_check_size(width, height, 0, avctx) < 0) {
- av_log(avctx, AV_LOG_ERROR, "%dx%d dimension invalid.\n", width, height);
- goto done;
- }
- avcodec_set_dimensions(avctx, width, height);
-
- switch(image->numcomps)
- {
- case 1: avctx->pix_fmt = PIX_FMT_GRAY8;
- break;
- case 3: if(check_image_attributes(image)) {
- avctx->pix_fmt = PIX_FMT_RGB24;
- } else {
- avctx->pix_fmt = PIX_FMT_GRAY8;
- av_log(avctx, AV_LOG_ERROR, "Only first component will be used.\n");
- }
- break;
- case 4: has_alpha = 1;
- avctx->pix_fmt = PIX_FMT_RGBA;
- break;
- default: av_log(avctx, AV_LOG_ERROR, "%d components unsupported.\n", image->numcomps);
- goto done;
- }
-
- if(picture->data[0])
- ff_thread_release_buffer(avctx, picture);
-
- if(ff_thread_get_buffer(avctx, picture) < 0){
- av_log(avctx, AV_LOG_ERROR, "ff_thread_get_buffer() failed\n");
- return -1;
- }
-
- ff_thread_finish_setup(avctx);
-
- ctx->dec_params.cp_limit_decoding = NO_LIMITATION;
- ctx->dec_params.cp_reduce = avctx->lowres;
- // Tie decoder with decoding parameters
- opj_setup_decoder(dec, &ctx->dec_params);
- stream = opj_cio_open((opj_common_ptr)dec, buf, buf_size);
- if(!stream) {
- av_log(avctx, AV_LOG_ERROR, "Codestream could not be opened for reading.\n");
- opj_destroy_decompress(dec);
- return -1;
- }
-
- // Decode the codestream
- image = opj_decode_with_info(dec, stream, NULL);
- opj_cio_close(stream);
-
- for(x = 0; x < image->numcomps; x++) {
- adjust[x] = FFMAX(image->comps[x].prec - 8, 0);
- }
-
- for(y = 0; y < avctx->height; y++) {
- index = y*avctx->width;
- img_ptr = picture->data[0] + y*picture->linesize[0];
- for(x = 0; x < avctx->width; x++, index++) {
- *img_ptr++ = image->comps[0].data[index] >> adjust[0];
- if(image->numcomps > 2 && check_image_attributes(image)) {
- *img_ptr++ = image->comps[1].data[index] >> adjust[1];
- *img_ptr++ = image->comps[2].data[index] >> adjust[2];
- if(has_alpha)
- *img_ptr++ = image->comps[3].data[index] >> adjust[3];
- }
- }
- }
-
- *output = ctx->image;
- *data_size = sizeof(AVPicture);
- ret = buf_size;
-
-done:
- opj_image_destroy(image);
- opj_destroy_decompress(dec);
- return ret;
-}
-
-static av_cold int libopenjpeg_decode_close(AVCodecContext *avctx)
-{
- LibOpenJPEGContext *ctx = avctx->priv_data;
-
- if(ctx->image.data[0])
- ff_thread_release_buffer(avctx, &ctx->image);
- return 0 ;
-}
-
-
-AVCodec ff_libopenjpeg_decoder = {
- .name = "libopenjpeg",
- .type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_JPEG2000,
- .priv_data_size = sizeof(LibOpenJPEGContext),
- .init = libopenjpeg_decode_init,
- .close = libopenjpeg_decode_close,
- .decode = libopenjpeg_decode_frame,
- .capabilities = CODEC_CAP_DR1 | CODEC_CAP_FRAME_THREADS,
- .max_lowres = 5,
- .long_name = NULL_IF_CONFIG_SMALL("OpenJPEG based JPEG 2000 decoder"),
- .init_thread_copy = ONLY_IF_THREADS_ENABLED(libopenjpeg_decode_init_thread_copy)
-};
diff --git a/gst-libs/ext/libav/libavcodec/libopenjpegdec.c b/gst-libs/ext/libav/libavcodec/libopenjpegdec.c
new file mode 100644
index 0000000..8f956f4
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/libopenjpegdec.c
@@ -0,0 +1,461 @@
+/*
+ * JPEG 2000 decoding support via OpenJPEG
+ * Copyright (c) 2009 Jaikrishnan Menon <realityman@gmx.net>
+ *
+ * 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
+ * JPEG 2000 decoder using libopenjpeg
+ */
+
+#define OPJ_STATIC
+#include <openjpeg.h>
+
+#include "libavutil/common.h"
+#include "libavutil/intreadwrite.h"
+#include "libavutil/imgutils.h"
+#include "libavutil/pixfmt.h"
+#include "libavutil/opt.h"
+#include "avcodec.h"
+#include "thread.h"
+
+#define JP2_SIG_TYPE 0x6A502020
+#define JP2_SIG_VALUE 0x0D0A870A
+
+// pix_fmts with lower bpp have to be listed before
+// similar pix_fmts with higher bpp.
+#define RGB_PIXEL_FORMATS AV_PIX_FMT_RGB24, AV_PIX_FMT_RGBA, \
+ AV_PIX_FMT_RGB48
+
+#define GRAY_PIXEL_FORMATS AV_PIX_FMT_GRAY8, AV_PIX_FMT_Y400A, \
+ AV_PIX_FMT_GRAY16
+
+#define YUV_PIXEL_FORMATS AV_PIX_FMT_YUV410P, AV_PIX_FMT_YUV411P, \
+ AV_PIX_FMT_YUVA420P, \
+ AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV422P, \
+ AV_PIX_FMT_YUV440P, AV_PIX_FMT_YUV444P, \
+ AV_PIX_FMT_YUV420P9, AV_PIX_FMT_YUV422P9, \
+ AV_PIX_FMT_YUV444P9, \
+ AV_PIX_FMT_YUV420P10, AV_PIX_FMT_YUV422P10, \
+ AV_PIX_FMT_YUV444P10, \
+ AV_PIX_FMT_YUV420P16, AV_PIX_FMT_YUV422P16, \
+ AV_PIX_FMT_YUV444P16
+
+static const enum AVPixelFormat rgb_pix_fmts[] = {RGB_PIXEL_FORMATS};
+static const enum AVPixelFormat gray_pix_fmts[] = {GRAY_PIXEL_FORMATS};
+static const enum AVPixelFormat yuv_pix_fmts[] = {YUV_PIXEL_FORMATS};
+static const enum AVPixelFormat any_pix_fmts[] = {RGB_PIXEL_FORMATS,
+ GRAY_PIXEL_FORMATS,
+ YUV_PIXEL_FORMATS};
+
+typedef struct {
+ AVClass *class;
+ opj_dparameters_t dec_params;
+ AVFrame image;
+ int lowres;
+ int lowqual;
+} LibOpenJPEGContext;
+
+static int libopenjpeg_matches_pix_fmt(const opj_image_t *img,
+ enum AVPixelFormat pix_fmt)
+{
+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
+ int match = 1;
+
+ if (desc->nb_components != img->numcomps) {
+ return 0;
+ }
+
+ switch (desc->nb_components) {
+ case 4:
+ match = match &&
+ desc->comp[3].depth_minus1 + 1 >= img->comps[3].prec &&
+ 1 == img->comps[3].dx &&
+ 1 == img->comps[3].dy;
+ case 3:
+ match = match &&
+ desc->comp[2].depth_minus1 + 1 >= img->comps[2].prec &&
+ 1 << desc->log2_chroma_w == img->comps[2].dx &&
+ 1 << desc->log2_chroma_h == img->comps[2].dy;
+ case 2:
+ match = match &&
+ desc->comp[1].depth_minus1 + 1 >= img->comps[1].prec &&
+ 1 << desc->log2_chroma_w == img->comps[1].dx &&
+ 1 << desc->log2_chroma_h == img->comps[1].dy;
+ case 1:
+ match = match &&
+ desc->comp[0].depth_minus1 + 1 >= img->comps[0].prec &&
+ 1 == img->comps[0].dx &&
+ 1 == img->comps[0].dy;
+ default:
+ break;
+ }
+
+ return match;
+}
+
+static enum AVPixelFormat libopenjpeg_guess_pix_fmt(const opj_image_t *image)
+{
+ int index;
+ const enum AVPixelFormat *possible_fmts = NULL;
+ int possible_fmts_nb = 0;
+
+ switch (image->color_space) {
+ case CLRSPC_SRGB:
+ possible_fmts = rgb_pix_fmts;
+ possible_fmts_nb = FF_ARRAY_ELEMS(rgb_pix_fmts);
+ break;
+ case CLRSPC_GRAY:
+ possible_fmts = gray_pix_fmts;
+ possible_fmts_nb = FF_ARRAY_ELEMS(gray_pix_fmts);
+ break;
+ case CLRSPC_SYCC:
+ possible_fmts = yuv_pix_fmts;
+ possible_fmts_nb = FF_ARRAY_ELEMS(yuv_pix_fmts);
+ break;
+ default:
+ possible_fmts = any_pix_fmts;
+ possible_fmts_nb = FF_ARRAY_ELEMS(any_pix_fmts);
+ break;
+ }
+
+ for (index = 0; index < possible_fmts_nb; ++index) {
+ if (libopenjpeg_matches_pix_fmt(image, possible_fmts[index])) {
+ return possible_fmts[index];
+ }
+ }
+
+ return AV_PIX_FMT_NONE;
+}
+
+static inline int libopenjpeg_ispacked(enum AVPixelFormat pix_fmt)
+{
+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
+ int i, component_plane;
+
+ if (pix_fmt == AV_PIX_FMT_GRAY16)
+ return 0;
+
+ component_plane = desc->comp[0].plane;
+ for (i = 1; i < desc->nb_components; i++) {
+ if (component_plane != desc->comp[i].plane)
+ return 0;
+ }
+ return 1;
+}
+
+static void libopenjpeg_copy_to_packed8(AVFrame *picture, opj_image_t *image)
+{
+ uint8_t *img_ptr;
+ int index, x, y, c;
+
+ for (y = 0; y < picture->height; y++) {
+ index = y*picture->width;
+ img_ptr = picture->data[0] + y*picture->linesize[0];
+ for (x = 0; x < picture->width; x++, index++) {
+ for (c = 0; c < image->numcomps; c++) {
+ *img_ptr++ = image->comps[c].data[index];
+ }
+ }
+ }
+}
+
+static void libopenjpeg_copy_to_packed16(AVFrame *picture, opj_image_t *image)
+{
+ uint16_t *img_ptr;
+ int index, x, y, c;
+ int adjust[4];
+
+ for (x = 0; x < image->numcomps; x++)
+ adjust[x] = FFMAX(FFMIN(16 - image->comps[x].prec, 8), 0);
+
+ for (y = 0; y < picture->height; y++) {
+ index = y*picture->width;
+ img_ptr = (uint16_t*) (picture->data[0] + y*picture->linesize[0]);
+ for (x = 0; x < picture->width; x++, index++) {
+ for (c = 0; c < image->numcomps; c++) {
+ *img_ptr++ = image->comps[c].data[index] << adjust[c];
+ }
+ }
+ }
+}
+
+static void libopenjpeg_copyto8(AVFrame *picture, opj_image_t *image)
+{
+ int *comp_data;
+ uint8_t *img_ptr;
+ int index, x, y;
+
+ for (index = 0; index < image->numcomps; index++) {
+ comp_data = image->comps[index].data;
+ for (y = 0; y < image->comps[index].h; y++) {
+ img_ptr = picture->data[index] + y * picture->linesize[index];
+ for (x = 0; x < image->comps[index].w; x++) {
+ *img_ptr = (uint8_t) *comp_data;
+ img_ptr++;
+ comp_data++;
+ }
+ }
+ }
+}
+
+static void libopenjpeg_copyto16(AVFrame *p, opj_image_t *image)
+{
+ int *comp_data;
+ uint16_t *img_ptr;
+ int index, x, y;
+
+ for (index = 0; index < image->numcomps; index++) {
+ comp_data = image->comps[index].data;
+ for (y = 0; y < image->comps[index].h; y++) {
+ img_ptr = (uint16_t*) (p->data[index] + y * p->linesize[index]);
+ for (x = 0; x < image->comps[index].w; x++) {
+ *img_ptr = *comp_data;
+ img_ptr++;
+ comp_data++;
+ }
+ }
+ }
+}
+
+static av_cold int libopenjpeg_decode_init(AVCodecContext *avctx)
+{
+ LibOpenJPEGContext *ctx = avctx->priv_data;
+
+ opj_set_default_decoder_parameters(&ctx->dec_params);
+ avcodec_get_frame_defaults(&ctx->image);
+ avctx->coded_frame = &ctx->image;
+ return 0;
+}
+
+static av_cold int libopenjpeg_decode_init_thread_copy(AVCodecContext *avctx)
+{
+ LibOpenJPEGContext *ctx = avctx->priv_data;
+
+ avctx->coded_frame = &ctx->image;
+ return 0;
+}
+
+static int libopenjpeg_decode_frame(AVCodecContext *avctx,
+ void *data, int *got_frame,
+ AVPacket *avpkt)
+{
+ uint8_t *buf = avpkt->data;
+ int buf_size = avpkt->size;
+ LibOpenJPEGContext *ctx = avctx->priv_data;
+ AVFrame *picture = &ctx->image, *output = data;
+ const AVPixFmtDescriptor *desc;
+ opj_dinfo_t *dec;
+ opj_cio_t *stream;
+ opj_image_t *image;
+ int width, height, ret = -1;
+ int pixel_size = 0;
+ int ispacked = 0;
+ int i;
+
+ *got_frame = 0;
+
+ // Check if input is a raw jpeg2k codestream or in jp2 wrapping
+ if ((AV_RB32(buf) == 12) &&
+ (AV_RB32(buf + 4) == JP2_SIG_TYPE) &&
+ (AV_RB32(buf + 8) == JP2_SIG_VALUE)) {
+ dec = opj_create_decompress(CODEC_JP2);
+ } else {
+ /* If the AVPacket contains a jp2c box, then skip to
+ * the starting byte of the codestream. */
+ if (AV_RB32(buf + 4) == AV_RB32("jp2c"))
+ buf += 8;
+ dec = opj_create_decompress(CODEC_J2K);
+ }
+
+ if (!dec) {
+ av_log(avctx, AV_LOG_ERROR, "Error initializing decoder.\n");
+ return -1;
+ }
+ opj_set_event_mgr((opj_common_ptr)dec, NULL, NULL);
+
+ ctx->dec_params.cp_limit_decoding = LIMIT_TO_MAIN_HEADER;
+ ctx->dec_params.cp_reduce = ctx->lowres;
+ ctx->dec_params.cp_layer = ctx->lowqual;
+ // Tie decoder with decoding parameters
+ opj_setup_decoder(dec, &ctx->dec_params);
+ stream = opj_cio_open((opj_common_ptr)dec, buf, buf_size);
+
+ if (!stream) {
+ av_log(avctx, AV_LOG_ERROR,
+ "Codestream could not be opened for reading.\n");
+ opj_destroy_decompress(dec);
+ return -1;
+ }
+
+ // Decode the header only.
+ image = opj_decode_with_info(dec, stream, NULL);
+ opj_cio_close(stream);
+
+ if (!image) {
+ av_log(avctx, AV_LOG_ERROR, "Error decoding codestream.\n");
+ opj_destroy_decompress(dec);
+ return -1;
+ }
+
+ width = image->x1 - image->x0;
+ height = image->y1 - image->y0;
+
+ if (ctx->lowres) {
+ width = (width + (1 << ctx->lowres) - 1) >> ctx->lowres;
+ height = (height + (1 << ctx->lowres) - 1) >> ctx->lowres;
+ }
+
+ if (av_image_check_size(width, height, 0, avctx) < 0) {
+ av_log(avctx, AV_LOG_ERROR,
+ "%dx%d dimension invalid.\n", width, height);
+ goto done;
+ }
+
+ avcodec_set_dimensions(avctx, width, height);
+
+ if (avctx->pix_fmt != AV_PIX_FMT_NONE)
+ if (!libopenjpeg_matches_pix_fmt(image, avctx->pix_fmt))
+ avctx->pix_fmt = AV_PIX_FMT_NONE;
+
+ if (avctx->pix_fmt == AV_PIX_FMT_NONE)
+ avctx->pix_fmt = libopenjpeg_guess_pix_fmt(image);
+
+ if (avctx->pix_fmt == AV_PIX_FMT_NONE) {
+ av_log(avctx, AV_LOG_ERROR, "Unable to determine pixel format\n");
+ ret = AVERROR_INVALIDDATA;
+ goto done;
+ }
+
+ for (i = 0; i < image->numcomps; i++)
+ if (image->comps[i].prec > avctx->bits_per_raw_sample)
+ avctx->bits_per_raw_sample = image->comps[i].prec;
+
+ if (picture->data[0])
+ ff_thread_release_buffer(avctx, picture);
+
+ if (ff_thread_get_buffer(avctx, picture) < 0) {
+ av_log(avctx, AV_LOG_ERROR, "ff_thread_get_buffer() failed\n");
+ goto done;
+ }
+
+ ctx->dec_params.cp_limit_decoding = NO_LIMITATION;
+ // Tie decoder with decoding parameters.
+ opj_setup_decoder(dec, &ctx->dec_params);
+ stream = opj_cio_open((opj_common_ptr)dec, buf, buf_size);
+ if (!stream) {
+ av_log(avctx, AV_LOG_ERROR,
+ "Codestream could not be opened for reading.\n");
+ goto done;
+ }
+
+ opj_image_destroy(image);
+ // Decode the codestream
+ image = opj_decode_with_info(dec, stream, NULL);
+ opj_cio_close(stream);
+
+ if (!image) {
+ av_log(avctx, AV_LOG_ERROR, "Error decoding codestream.\n");
+ goto done;
+ }
+
+ desc = av_pix_fmt_desc_get(avctx->pix_fmt);
+ pixel_size = desc->comp[0].step_minus1 + 1;
+ ispacked = libopenjpeg_ispacked(avctx->pix_fmt);
+
+ switch (pixel_size) {
+ case 1:
+ if (ispacked) {
+ libopenjpeg_copy_to_packed8(picture, image);
+ } else {
+ libopenjpeg_copyto8(picture, image);
+ }
+ break;
+ case 2:
+ if (ispacked) {
+ libopenjpeg_copy_to_packed8(picture, image);
+ } else {
+ libopenjpeg_copyto16(picture, image);
+ }
+ break;
+ case 3:
+ case 4:
+ if (ispacked) {
+ libopenjpeg_copy_to_packed8(picture, image);
+ }
+ break;
+ case 6:
+ case 8:
+ if (ispacked) {
+ libopenjpeg_copy_to_packed16(picture, image);
+ }
+ break;
+ default:
+ av_log(avctx, AV_LOG_ERROR, "unsupported pixel size %d\n", pixel_size);
+ goto done;
+ }
+
+ *output = ctx->image;
+ *got_frame = 1;
+ ret = buf_size;
+
+done:
+ opj_image_destroy(image);
+ opj_destroy_decompress(dec);
+ return ret;
+}
+
+static av_cold int libopenjpeg_decode_close(AVCodecContext *avctx)
+{
+ LibOpenJPEGContext *ctx = avctx->priv_data;
+
+ if (ctx->image.data[0])
+ ff_thread_release_buffer(avctx, &ctx->image);
+ return 0;
+}
+
+#define OFFSET(x) offsetof(LibOpenJPEGContext, x)
+#define VD AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_DECODING_PARAM
+
+static const AVOption options[] = {
+ { "lowqual", "Limit the number of layers used for decoding", OFFSET(lowqual), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, VD },
+ { "lowres", "Lower the decoding resolution by a power of two", OFFSET(lowres), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, VD },
+ { NULL },
+};
+
+static const AVClass class = {
+ .class_name = "libopenjpeg",
+ .item_name = av_default_item_name,
+ .option = options,
+ .version = LIBAVUTIL_VERSION_INT,
+};
+
+AVCodec ff_libopenjpeg_decoder = {
+ .name = "libopenjpeg",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .id = AV_CODEC_ID_JPEG2000,
+ .priv_data_size = sizeof(LibOpenJPEGContext),
+ .init = libopenjpeg_decode_init,
+ .close = libopenjpeg_decode_close,
+ .decode = libopenjpeg_decode_frame,
+ .capabilities = CODEC_CAP_DR1 | CODEC_CAP_FRAME_THREADS,
+ .long_name = NULL_IF_CONFIG_SMALL("OpenJPEG JPEG 2000"),
+ .priv_class = &class,
+ .init_thread_copy = ONLY_IF_THREADS_ENABLED(libopenjpeg_decode_init_thread_copy),
+};
diff --git a/gst-libs/ext/libav/libavcodec/libopenjpegenc.c b/gst-libs/ext/libav/libavcodec/libopenjpegenc.c
new file mode 100644
index 0000000..09b115b
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/libopenjpegenc.c
@@ -0,0 +1,436 @@
+/*
+ * JPEG 2000 encoding support via OpenJPEG
+ * Copyright (c) 2011 Michael Bradshaw <mbradshaw@sorensonmedia.com>
+ *
+ * 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
+ * JPEG 2000 encoder using libopenjpeg
+ */
+
+#define OPJ_STATIC
+#include <openjpeg.h>
+
+#include "libavutil/common.h"
+#include "libavutil/imgutils.h"
+#include "libavutil/intreadwrite.h"
+#include "libavutil/opt.h"
+#include "avcodec.h"
+#include "internal.h"
+
+typedef struct {
+ AVClass *avclass;
+ opj_image_t *image;
+ opj_cparameters_t enc_params;
+ opj_cinfo_t *compress;
+ opj_event_mgr_t event_mgr;
+ int format;
+ int profile;
+ int prog_order;
+ int cinema_mode;
+ int numresolution;
+ int numlayers;
+ int disto_alloc;
+ int fixed_alloc;
+ int fixed_quality;
+} LibOpenJPEGContext;
+
+static void error_callback(const char *msg, void *data)
+{
+ av_log(data, AV_LOG_ERROR, "%s\n", msg);
+}
+
+static void warning_callback(const char *msg, void *data)
+{
+ av_log(data, AV_LOG_WARNING, "%s\n", msg);
+}
+
+static void info_callback(const char *msg, void *data)
+{
+ av_log(data, AV_LOG_DEBUG, "%s\n", msg);
+}
+
+static opj_image_t *libopenjpeg_create_image(AVCodecContext *avctx,
+ opj_cparameters_t *parameters)
+{
+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(avctx->pix_fmt);
+ opj_image_cmptparm_t *cmptparm;
+ OPJ_COLOR_SPACE color_space;
+ opj_image_t *img;
+ int i;
+ int sub_dx[4];
+ int sub_dy[4];
+ int numcomps = desc->nb_components;
+
+ sub_dx[0] =
+ sub_dx[3] = 1;
+ sub_dy[0] =
+ sub_dy[3] = 1;
+ sub_dx[1] =
+ sub_dx[2] = 1 << desc->log2_chroma_w;
+ sub_dy[1] =
+ sub_dy[2] = 1 << desc->log2_chroma_h;
+
+ switch (avctx->pix_fmt) {
+ case AV_PIX_FMT_GRAY8:
+ case AV_PIX_FMT_GRAY16:
+ case AV_PIX_FMT_Y400A:
+ color_space = CLRSPC_GRAY;
+ break;
+ case AV_PIX_FMT_RGB24:
+ case AV_PIX_FMT_RGBA:
+ case AV_PIX_FMT_RGB48:
+ color_space = CLRSPC_SRGB;
+ break;
+ case AV_PIX_FMT_YUV410P:
+ case AV_PIX_FMT_YUV411P:
+ case AV_PIX_FMT_YUV420P:
+ case AV_PIX_FMT_YUV422P:
+ case AV_PIX_FMT_YUV440P:
+ case AV_PIX_FMT_YUV444P:
+ case AV_PIX_FMT_YUVA420P:
+ case AV_PIX_FMT_YUV420P9:
+ case AV_PIX_FMT_YUV422P9:
+ case AV_PIX_FMT_YUV444P9:
+ case AV_PIX_FMT_YUV420P10:
+ case AV_PIX_FMT_YUV422P10:
+ case AV_PIX_FMT_YUV444P10:
+ case AV_PIX_FMT_YUV420P16:
+ case AV_PIX_FMT_YUV422P16:
+ case AV_PIX_FMT_YUV444P16:
+ color_space = CLRSPC_SYCC;
+ break;
+ default:
+ av_log(avctx, AV_LOG_ERROR,
+ "The requested pixel format '%s' is not supported\n",
+ av_get_pix_fmt_name(avctx->pix_fmt));
+ return NULL;
+ }
+
+ cmptparm = av_mallocz(numcomps * sizeof(*cmptparm));
+ if (!cmptparm) {
+ av_log(avctx, AV_LOG_ERROR, "Not enough memory");
+ return NULL;
+ }
+
+ for (i = 0; i < numcomps; i++) {
+ cmptparm[i].prec = desc->comp[i].depth_minus1 + 1;
+ cmptparm[i].bpp = desc->comp[i].depth_minus1 + 1;
+ cmptparm[i].sgnd = 0;
+ cmptparm[i].dx = sub_dx[i];
+ cmptparm[i].dy = sub_dy[i];
+ cmptparm[i].w = avctx->width / sub_dx[i];
+ cmptparm[i].h = avctx->height / sub_dy[i];
+ }
+
+ img = opj_image_create(numcomps, cmptparm, color_space);
+ av_freep(&cmptparm);
+ return img;
+}
+
+static av_cold int libopenjpeg_encode_init(AVCodecContext *avctx)
+{
+ LibOpenJPEGContext *ctx = avctx->priv_data;
+ int err = AVERROR(ENOMEM);
+
+ opj_set_default_encoder_parameters(&ctx->enc_params);
+
+ ctx->enc_params.cp_rsiz = ctx->profile;
+ ctx->enc_params.mode = !!avctx->global_quality;
+ ctx->enc_params.cp_cinema = ctx->cinema_mode;
+ ctx->enc_params.prog_order = ctx->prog_order;
+ ctx->enc_params.numresolution = ctx->numresolution;
+ ctx->enc_params.cp_disto_alloc = ctx->disto_alloc;
+ ctx->enc_params.cp_fixed_alloc = ctx->fixed_alloc;
+ ctx->enc_params.cp_fixed_quality = ctx->fixed_quality;
+ ctx->enc_params.tcp_numlayers = ctx->numlayers;
+ ctx->enc_params.tcp_rates[0] = FFMAX(avctx->compression_level, 0) * 2;
+
+ ctx->compress = opj_create_compress(ctx->format);
+ if (!ctx->compress) {
+ av_log(avctx, AV_LOG_ERROR, "Error creating the compressor\n");
+ return AVERROR(ENOMEM);
+ }
+
+ avctx->coded_frame = avcodec_alloc_frame();
+ if (!avctx->coded_frame) {
+ av_log(avctx, AV_LOG_ERROR, "Error allocating coded frame\n");
+ goto fail;
+ }
+
+ ctx->image = libopenjpeg_create_image(avctx, &ctx->enc_params);
+ if (!ctx->image) {
+ av_log(avctx, AV_LOG_ERROR, "Error creating the mj2 image\n");
+ err = AVERROR(EINVAL);
+ goto fail;
+ }
+
+ ctx->event_mgr.info_handler = info_callback;
+ ctx->event_mgr.error_handler = error_callback;
+ ctx->event_mgr.warning_handler = warning_callback;
+ opj_set_event_mgr((opj_common_ptr)ctx->compress, &ctx->event_mgr, avctx);
+
+ return 0;
+
+fail:
+ av_freep(&ctx->compress);
+ av_freep(&avctx->coded_frame);
+ return err;
+}
+
+static void libopenjpeg_copy_packed8(AVCodecContext *avctx,
+ const AVFrame *frame, opj_image_t *image)
+{
+ int compno;
+ int x, y;
+ int image_index, frame_index;
+ const int numcomps = image->numcomps;
+
+ for (compno = 0; compno < numcomps; ++compno) {
+ for (y = 0; y < avctx->height; ++y) {
+ image_index = y * avctx->width;
+ frame_index = y * frame->linesize[0] + compno;
+ for (x = 0; x < avctx->width; ++x) {
+ image->comps[compno].data[image_index++] =
+ frame->data[0][frame_index];
+ frame_index += numcomps;
+ }
+ }
+ }
+}
+
+static void libopenjpeg_copy_packed16(AVCodecContext *avctx,
+ const AVFrame *frame, opj_image_t *image)
+{
+ int compno;
+ int x, y;
+ int image_index, frame_index;
+ const int numcomps = image->numcomps;
+ uint16_t *frame_ptr = (uint16_t*)frame->data[0];
+
+ for (compno = 0; compno < numcomps; ++compno) {
+ for (y = 0; y < avctx->height; ++y) {
+ image_index = y * avctx->width;
+ frame_index = y * (frame->linesize[0] / 2) + compno;
+ for (x = 0; x < avctx->width; ++x) {
+ image->comps[compno].data[image_index++] =
+ frame_ptr[frame_index];
+ frame_index += numcomps;
+ }
+ }
+ }
+}
+
+static void libopenjpeg_copy_unpacked8(AVCodecContext *avctx,
+ const AVFrame *frame, opj_image_t *image)
+{
+ int compno;
+ int x, y;
+ int width, height;
+ int image_index, frame_index;
+ const int numcomps = image->numcomps;
+
+ for (compno = 0; compno < numcomps; ++compno) {
+ width = avctx->width / image->comps[compno].dx;
+ height = avctx->height / image->comps[compno].dy;
+ for (y = 0; y < height; ++y) {
+ image_index = y * width;
+ frame_index = y * frame->linesize[compno];
+ for (x = 0; x < width; ++x)
+ image->comps[compno].data[image_index++] =
+ frame->data[compno][frame_index++];
+ }
+ }
+}
+
+static void libopenjpeg_copy_unpacked16(AVCodecContext *avctx,
+ const AVFrame *frame,
+ opj_image_t *image)
+{
+ int compno;
+ int x, y;
+ int width, height;
+ int image_index, frame_index;
+ const int numcomps = image->numcomps;
+ uint16_t *frame_ptr;
+
+ for (compno = 0; compno < numcomps; ++compno) {
+ width = avctx->width / image->comps[compno].dx;
+ height = avctx->height / image->comps[compno].dy;
+ frame_ptr = (uint16_t*)frame->data[compno];
+ for (y = 0; y < height; ++y) {
+ image_index = y * width;
+ frame_index = y * (frame->linesize[compno] / 2);
+ for (x = 0; x < width; ++x)
+ image->comps[compno].data[image_index++] =
+ frame_ptr[frame_index++];
+ }
+ }
+}
+
+static int libopenjpeg_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
+ const AVFrame *frame, int *got_packet)
+{
+ LibOpenJPEGContext *ctx = avctx->priv_data;
+ opj_cinfo_t *compress = ctx->compress;
+ opj_image_t *image = ctx->image;
+ opj_cio_t *stream;
+ int ret, len;
+
+ // x0, y0 is the top left corner of the image
+ // x1, y1 is the width, height of the reference grid
+ image->x0 = 0;
+ image->y0 = 0;
+ image->x1 = (avctx->width - 1) * ctx->enc_params.subsampling_dx + 1;
+ image->y1 = (avctx->height - 1) * ctx->enc_params.subsampling_dy + 1;
+
+ switch (avctx->pix_fmt) {
+ case AV_PIX_FMT_RGB24:
+ case AV_PIX_FMT_RGBA:
+ case AV_PIX_FMT_Y400A:
+ libopenjpeg_copy_packed8(avctx, frame, image);
+ break;
+ case AV_PIX_FMT_RGB48:
+ libopenjpeg_copy_packed16(avctx, frame, image);
+ break;
+ case AV_PIX_FMT_GRAY8:
+ case AV_PIX_FMT_YUV410P:
+ case AV_PIX_FMT_YUV411P:
+ case AV_PIX_FMT_YUV420P:
+ case AV_PIX_FMT_YUV422P:
+ case AV_PIX_FMT_YUV440P:
+ case AV_PIX_FMT_YUV444P:
+ case AV_PIX_FMT_YUVA420P:
+ libopenjpeg_copy_unpacked8(avctx, frame, image);
+ break;
+ case AV_PIX_FMT_GRAY16:
+ case AV_PIX_FMT_YUV420P9:
+ case AV_PIX_FMT_YUV422P9:
+ case AV_PIX_FMT_YUV444P9:
+ case AV_PIX_FMT_YUV444P10:
+ case AV_PIX_FMT_YUV422P10:
+ case AV_PIX_FMT_YUV420P10:
+ case AV_PIX_FMT_YUV444P16:
+ case AV_PIX_FMT_YUV422P16:
+ case AV_PIX_FMT_YUV420P16:
+ libopenjpeg_copy_unpacked16(avctx, frame, image);
+ break;
+ default:
+ av_log(avctx, AV_LOG_ERROR,
+ "The frame's pixel format '%s' is not supported\n",
+ av_get_pix_fmt_name(avctx->pix_fmt));
+ return AVERROR(EINVAL);
+ break;
+ }
+
+ opj_setup_encoder(compress, &ctx->enc_params, image);
+ stream = opj_cio_open((opj_common_ptr)compress, NULL, 0);
+ if (!stream) {
+ av_log(avctx, AV_LOG_ERROR, "Error creating the cio stream\n");
+ return AVERROR(ENOMEM);
+ }
+
+ if (!opj_encode(compress, stream, image, NULL)) {
+ opj_cio_close(stream);
+ av_log(avctx, AV_LOG_ERROR, "Error during the opj encode\n");
+ return -1;
+ }
+
+ len = cio_tell(stream);
+ if ((ret = ff_alloc_packet(pkt, len)) < 0) {
+ opj_cio_close(stream);
+ return ret;
+ }
+
+ memcpy(pkt->data, stream->buffer, len);
+ pkt->flags |= AV_PKT_FLAG_KEY;
+ *got_packet = 1;
+ opj_cio_close(stream);
+ return 0;
+}
+
+static av_cold int libopenjpeg_encode_close(AVCodecContext *avctx)
+{
+ LibOpenJPEGContext *ctx = avctx->priv_data;
+
+ opj_destroy_compress(ctx->compress);
+ opj_image_destroy(ctx->image);
+ av_freep(&avctx->coded_frame);
+ return 0;
+}
+
+#define OFFSET(x) offsetof(LibOpenJPEGContext, x)
+#define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
+static const AVOption options[] = {
+ { "format", "Codec Format", OFFSET(format), AV_OPT_TYPE_INT, { .i64 = CODEC_JP2 }, CODEC_J2K, CODEC_JP2, VE, "format" },
+ { "j2k", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CODEC_J2K }, 0, 0, VE, "format" },
+ { "jp2", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CODEC_JP2 }, 0, 0, VE, "format" },
+ { "profile", NULL, OFFSET(profile), AV_OPT_TYPE_INT, { .i64 = STD_RSIZ }, STD_RSIZ, CINEMA4K, VE, "profile" },
+ { "jpeg2000", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = STD_RSIZ }, 0, 0, VE, "profile" },
+ { "cinema2k", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CINEMA2K }, 0, 0, VE, "profile" },
+ { "cinema4k", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CINEMA4K }, 0, 0, VE, "profile" },
+ { "cinema_mode", "Digital Cinema", OFFSET(cinema_mode), AV_OPT_TYPE_INT, { .i64 = OFF }, OFF, CINEMA4K_24, VE, "cinema_mode" },
+ { "off", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = OFF }, 0, 0, VE, "cinema_mode" },
+ { "2k_24", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CINEMA2K_24 }, 0, 0, VE, "cinema_mode" },
+ { "2k_48", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CINEMA2K_48 }, 0, 0, VE, "cinema_mode" },
+ { "4k_24", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CINEMA4K_24 }, 0, 0, VE, "cinema_mode" },
+ { "prog_order", "Progression Order", OFFSET(prog_order), AV_OPT_TYPE_INT, { .i64 = LRCP }, LRCP, CPRL, VE, "prog_order" },
+ { "lrcp", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = LRCP }, 0, 0, VE, "prog_order" },
+ { "rlcp", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = RLCP }, 0, 0, VE, "prog_order" },
+ { "rpcl", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = RPCL }, 0, 0, VE, "prog_order" },
+ { "pcrl", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = PCRL }, 0, 0, VE, "prog_order" },
+ { "cprl", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPRL }, 0, 0, VE, "prog_order" },
+ { "numresolution", NULL, OFFSET(numresolution), AV_OPT_TYPE_INT, { .i64 = 6 }, 1, 10, VE },
+ { "numlayers", NULL, OFFSET(numlayers), AV_OPT_TYPE_INT, { .i64 = 1 }, 1, 10, VE },
+ { "disto_alloc", NULL, OFFSET(disto_alloc), AV_OPT_TYPE_INT, { .i64 = 1 }, 0, 1, VE },
+ { "fixed_alloc", NULL, OFFSET(fixed_alloc), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, VE },
+ { "fixed_quality", NULL, OFFSET(fixed_quality), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, VE },
+ { NULL },
+};
+
+static const AVClass class = {
+ .class_name = "libopenjpeg",
+ .item_name = av_default_item_name,
+ .option = options,
+ .version = LIBAVUTIL_VERSION_INT,
+};
+
+AVCodec ff_libopenjpeg_encoder = {
+ .name = "libopenjpeg",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .id = AV_CODEC_ID_JPEG2000,
+ .priv_data_size = sizeof(LibOpenJPEGContext),
+ .init = libopenjpeg_encode_init,
+ .encode2 = libopenjpeg_encode_frame,
+ .close = libopenjpeg_encode_close,
+ .capabilities = 0,
+ .pix_fmts = (const enum AVPixelFormat[]) {
+ AV_PIX_FMT_RGB24, AV_PIX_FMT_RGBA, AV_PIX_FMT_RGB48,
+ AV_PIX_FMT_GRAY8, AV_PIX_FMT_GRAY16, AV_PIX_FMT_Y400A,
+ AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUVA420P,
+ AV_PIX_FMT_YUV440P, AV_PIX_FMT_YUV444P,
+ AV_PIX_FMT_YUV411P, AV_PIX_FMT_YUV410P,
+ AV_PIX_FMT_YUV420P9, AV_PIX_FMT_YUV422P9, AV_PIX_FMT_YUV444P9,
+ AV_PIX_FMT_YUV420P10, AV_PIX_FMT_YUV422P10, AV_PIX_FMT_YUV444P10,
+ AV_PIX_FMT_YUV420P16, AV_PIX_FMT_YUV422P16, AV_PIX_FMT_YUV444P16,
+ AV_PIX_FMT_NONE
+ },
+ .long_name = NULL_IF_CONFIG_SMALL("OpenJPEG JPEG 2000"),
+ .priv_class = &class,
+};
diff --git a/gst-libs/ext/libav/libavcodec/libopus.c b/gst-libs/ext/libav/libavcodec/libopus.c
new file mode 100644
index 0000000..b511415
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/libopus.c
@@ -0,0 +1,48 @@
+/*
+ * libopus encoder/decoder common code
+ * Copyright (c) 2012 Nicolas George
+ *
+ * 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
+ */
+
+#include <opus_defines.h>
+
+#include "libavutil/common.h"
+#include "libavutil/error.h"
+#include "libopus.h"
+
+int ff_opus_error_to_averror(int err)
+{
+ switch (err) {
+ case OPUS_BAD_ARG:
+ return AVERROR(EINVAL);
+ case OPUS_BUFFER_TOO_SMALL:
+ return AVERROR_UNKNOWN;
+ case OPUS_INTERNAL_ERROR:
+ return AVERROR(EFAULT);
+ case OPUS_INVALID_PACKET:
+ return AVERROR_INVALIDDATA;
+ case OPUS_UNIMPLEMENTED:
+ return AVERROR(ENOSYS);
+ case OPUS_INVALID_STATE:
+ return AVERROR_UNKNOWN;
+ case OPUS_ALLOC_FAIL:
+ return AVERROR(ENOMEM);
+ default:
+ return AVERROR(EINVAL);
+ }
+}
diff --git a/gst-libs/ext/libav/libavcodec/libopus.h b/gst-libs/ext/libav/libavcodec/libopus.h
new file mode 100644
index 0000000..b08257d
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/libopus.h
@@ -0,0 +1,27 @@
+/*
+ * libopus encoder/decoder common code
+ * Copyright (c) 2012 Nicolas George
+ *
+ * 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
+ */
+
+#ifndef AVCODEC_LIBOPUS_H
+#define AVCODEC_LIBOPUS_H
+
+int ff_opus_error_to_averror(int err);
+
+#endif /* AVCODEC_LIBOPUS_H */
diff --git a/gst-libs/ext/libav/libavcodec/libopusdec.c b/gst-libs/ext/libav/libavcodec/libopusdec.c
new file mode 100644
index 0000000..15fa493
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/libopusdec.c
@@ -0,0 +1,168 @@
+/*
+ * Opus decoder using libopus
+ * Copyright (c) 2012 Nicolas George
+ *
+ * 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
+ */
+
+#include <opus.h>
+#include <opus_multistream.h>
+
+#include "libavutil/avassert.h"
+#include "libavutil/intreadwrite.h"
+#include "avcodec.h"
+#include "internal.h"
+#include "vorbis.h"
+#include "mathops.h"
+#include "libopus.h"
+
+struct libopus_context {
+ OpusMSDecoder *dec;
+ AVFrame frame;
+};
+
+#define OPUS_HEAD_SIZE 19
+
+static av_cold int libopus_decode_init(AVCodecContext *avc)
+{
+ struct libopus_context *opus = avc->priv_data;
+ int ret, channel_map = 0, gain_db = 0, nb_streams, nb_coupled;
+ uint8_t mapping_arr[8] = { 0, 1 }, *mapping;
+
+ avc->sample_rate = 48000;
+ avc->sample_fmt = avc->request_sample_fmt == AV_SAMPLE_FMT_FLT ?
+ AV_SAMPLE_FMT_FLT : AV_SAMPLE_FMT_S16;
+ avc->channel_layout = avc->channels > 8 ? 0 :
+ ff_vorbis_channel_layouts[avc->channels - 1];
+
+ if (avc->extradata_size >= OPUS_HEAD_SIZE) {
+ gain_db = sign_extend(AV_RL16(avc->extradata + 16), 16);
+ channel_map = AV_RL8 (avc->extradata + 18);
+ }
+ if (avc->extradata_size >= OPUS_HEAD_SIZE + 2 + avc->channels) {
+ nb_streams = avc->extradata[OPUS_HEAD_SIZE + 0];
+ nb_coupled = avc->extradata[OPUS_HEAD_SIZE + 1];
+ if (nb_streams + nb_coupled != avc->channels)
+ av_log(avc, AV_LOG_WARNING, "Inconsistent channel mapping.\n");
+ mapping = avc->extradata + OPUS_HEAD_SIZE + 2;
+ } else {
+ if (avc->channels > 2 || channel_map) {
+ av_log(avc, AV_LOG_ERROR,
+ "No channel mapping for %d channels.\n", avc->channels);
+ return AVERROR(EINVAL);
+ }
+ nb_streams = 1;
+ nb_coupled = avc->channels > 1;
+ mapping = mapping_arr;
+ }
+
+ if (avc->channels > 2 && avc->channels <= 8) {
+ const uint8_t *vorbis_offset = ff_vorbis_channel_layout_offsets[avc->channels - 1];
+ int ch;
+
+ /* Remap channels from vorbis order to libav order */
+ for (ch = 0; ch < avc->channels; ch++)
+ mapping_arr[ch] = mapping[vorbis_offset[ch]];
+ mapping = mapping_arr;
+ }
+
+ opus->dec = opus_multistream_decoder_create(avc->sample_rate, avc->channels,
+ nb_streams, nb_coupled,
+ mapping, &ret);
+ if (!opus->dec) {
+ av_log(avc, AV_LOG_ERROR, "Unable to create decoder: %s\n",
+ opus_strerror(ret));
+ return ff_opus_error_to_averror(ret);
+ }
+
+ ret = opus_multistream_decoder_ctl(opus->dec, OPUS_SET_GAIN(gain_db));
+ if (ret != OPUS_OK)
+ av_log(avc, AV_LOG_WARNING, "Failed to set gain: %s\n",
+ opus_strerror(ret));
+
+ avc->delay = 3840; /* Decoder delay (in samples) at 48kHz */
+ avcodec_get_frame_defaults(&opus->frame);
+ avc->coded_frame = &opus->frame;
+ return 0;
+}
+
+static av_cold int libopus_decode_close(AVCodecContext *avc)
+{
+ struct libopus_context *opus = avc->priv_data;
+
+ opus_multistream_decoder_destroy(opus->dec);
+ return 0;
+}
+
+#define MAX_FRAME_SIZE (960 * 6)
+
+static int libopus_decode(AVCodecContext *avc, void *frame,
+ int *got_frame_ptr, AVPacket *pkt)
+{
+ struct libopus_context *opus = avc->priv_data;
+ int ret, nb_samples;
+
+ opus->frame.nb_samples = MAX_FRAME_SIZE;
+ ret = ff_get_buffer(avc, &opus->frame);
+ if (ret < 0) {
+ av_log(avc, AV_LOG_ERROR, "get_buffer() failed\n");
+ return ret;
+ }
+
+ if (avc->sample_fmt == AV_SAMPLE_FMT_S16)
+ nb_samples = opus_multistream_decode(opus->dec, pkt->data, pkt->size,
+ (opus_int16 *)opus->frame.data[0],
+ opus->frame.nb_samples, 0);
+ else
+ nb_samples = opus_multistream_decode_float(opus->dec, pkt->data, pkt->size,
+ (float *)opus->frame.data[0],
+ opus->frame.nb_samples, 0);
+
+ if (nb_samples < 0) {
+ av_log(avc, AV_LOG_ERROR, "Decoding error: %s\n",
+ opus_strerror(nb_samples));
+ return ff_opus_error_to_averror(nb_samples);
+ }
+
+ opus->frame.nb_samples = nb_samples;
+ *(AVFrame *)frame = opus->frame;
+ *got_frame_ptr = 1;
+ return pkt->size;
+}
+
+static void libopus_flush(AVCodecContext *avc)
+{
+ struct libopus_context *opus = avc->priv_data;
+
+ opus_multistream_decoder_ctl(opus->dec, OPUS_RESET_STATE);
+}
+
+AVCodec ff_libopus_decoder = {
+ .name = "libopus",
+ .type = AVMEDIA_TYPE_AUDIO,
+ .id = AV_CODEC_ID_OPUS,
+ .priv_data_size = sizeof(struct libopus_context),
+ .init = libopus_decode_init,
+ .close = libopus_decode_close,
+ .decode = libopus_decode,
+ .flush = libopus_flush,
+ .capabilities = CODEC_CAP_DR1,
+ .long_name = NULL_IF_CONFIG_SMALL("libopus Opus"),
+ .sample_fmts = (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_FLT,
+ AV_SAMPLE_FMT_S16,
+ AV_SAMPLE_FMT_NONE },
+};
diff --git a/gst-libs/ext/libav/libavcodec/libopusenc.c b/gst-libs/ext/libav/libavcodec/libopusenc.c
new file mode 100644
index 0000000..f124e19
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/libopusenc.c
@@ -0,0 +1,421 @@
+/*
+ * Opus encoder using libopus
+ * Copyright (c) 2012 Nathan Caldwell
+ *
+ * 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
+ */
+
+#include <opus.h>
+#include <opus_multistream.h>
+
+#include "libavutil/opt.h"
+#include "avcodec.h"
+#include "bytestream.h"
+#include "internal.h"
+#include "libopus.h"
+#include "vorbis.h"
+#include "audio_frame_queue.h"
+
+typedef struct LibopusEncOpts {
+ int vbr;
+ int application;
+ int packet_loss;
+ int complexity;
+ float frame_duration;
+ int packet_size;
+ int max_bandwidth;
+} LibopusEncOpts;
+
+typedef struct LibopusEncContext {
+ AVClass *class;
+ OpusMSEncoder *enc;
+ int stream_count;
+ uint8_t *samples;
+ LibopusEncOpts opts;
+ AudioFrameQueue afq;
+} LibopusEncContext;
+
+static const uint8_t opus_coupled_streams[8] = {
+ 0, 1, 1, 2, 2, 2, 2, 3
+};
+
+/* Opus internal to Vorbis channel order mapping written in the header */
+static const uint8_t opus_vorbis_channel_map[8][8] = {
+ { 0 },
+ { 0, 1 },
+ { 0, 2, 1 },
+ { 0, 1, 2, 3 },
+ { 0, 4, 1, 2, 3 },
+ { 0, 4, 1, 2, 3, 5 },
+ { 0, 4, 1, 2, 3, 5, 6 },
+ { 0, 6, 1, 2, 3, 4, 5, 7 },
+};
+
+/* libav to libopus channel order mapping, passed to libopus */
+static const uint8_t libav_libopus_channel_map[8][8] = {
+ { 0 },
+ { 0, 1 },
+ { 0, 1, 2 },
+ { 0, 1, 2, 3 },
+ { 0, 1, 3, 4, 2 },
+ { 0, 1, 4, 5, 2, 3 },
+ { 0, 1, 5, 6, 2, 4, 3 },
+ { 0, 1, 6, 7, 4, 5, 2, 3 },
+};
+
+static void libopus_write_header(AVCodecContext *avctx, int stream_count,
+ int coupled_stream_count,
+ const uint8_t *channel_mapping)
+{
+ uint8_t *p = avctx->extradata;
+ int channels = avctx->channels;
+
+ bytestream_put_buffer(&p, "OpusHead", 8);
+ bytestream_put_byte(&p, 1); /* Version */
+ bytestream_put_byte(&p, channels);
+ bytestream_put_le16(&p, avctx->delay); /* Lookahead samples at 48kHz */
+ bytestream_put_le32(&p, avctx->sample_rate); /* Original sample rate */
+ bytestream_put_le16(&p, 0); /* Gain of 0dB is recommended. */
+
+ /* Channel mapping */
+ if (channels > 2) {
+ bytestream_put_byte(&p, channels <= 8 ? 1 : 255);
+ bytestream_put_byte(&p, stream_count);
+ bytestream_put_byte(&p, coupled_stream_count);
+ bytestream_put_buffer(&p, channel_mapping, channels);
+ } else {
+ bytestream_put_byte(&p, 0);
+ }
+}
+
+static int libopus_configure_encoder(AVCodecContext *avctx, OpusMSEncoder *enc,
+ LibopusEncOpts *opts)
+{
+ int ret;
+
+ ret = opus_multistream_encoder_ctl(enc, OPUS_SET_BITRATE(avctx->bit_rate));
+ if (ret != OPUS_OK) {
+ av_log(avctx, AV_LOG_ERROR,
+ "Failed to set bitrate: %s\n", opus_strerror(ret));
+ return ret;
+ }
+
+ ret = opus_multistream_encoder_ctl(enc,
+ OPUS_SET_COMPLEXITY(opts->complexity));
+ if (ret != OPUS_OK)
+ av_log(avctx, AV_LOG_WARNING,
+ "Unable to set complexity: %s\n", opus_strerror(ret));
+
+ ret = opus_multistream_encoder_ctl(enc, OPUS_SET_VBR(!!opts->vbr));
+ if (ret != OPUS_OK)
+ av_log(avctx, AV_LOG_WARNING,
+ "Unable to set VBR: %s\n", opus_strerror(ret));
+
+ ret = opus_multistream_encoder_ctl(enc,
+ OPUS_SET_VBR_CONSTRAINT(opts->vbr == 2));
+ if (ret != OPUS_OK)
+ av_log(avctx, AV_LOG_WARNING,
+ "Unable to set constrained VBR: %s\n", opus_strerror(ret));
+
+ ret = opus_multistream_encoder_ctl(enc,
+ OPUS_SET_PACKET_LOSS_PERC(opts->packet_loss));
+ if (ret != OPUS_OK)
+ av_log(avctx, AV_LOG_WARNING,
+ "Unable to set expected packet loss percentage: %s\n",
+ opus_strerror(ret));
+
+ if (avctx->cutoff) {
+ ret = opus_multistream_encoder_ctl(enc,
+ OPUS_SET_MAX_BANDWIDTH(opts->max_bandwidth));
+ if (ret != OPUS_OK)
+ av_log(avctx, AV_LOG_WARNING,
+ "Unable to set maximum bandwidth: %s\n", opus_strerror(ret));
+ }
+
+ return OPUS_OK;
+}
+
+static int av_cold libopus_encode_init(AVCodecContext *avctx)
+{
+ LibopusEncContext *opus = avctx->priv_data;
+ const uint8_t *channel_mapping;
+ OpusMSEncoder *enc;
+ int ret = OPUS_OK;
+ int coupled_stream_count, header_size, frame_size;
+
+ coupled_stream_count = opus_coupled_streams[avctx->channels - 1];
+ opus->stream_count = avctx->channels - coupled_stream_count;
+ channel_mapping = libav_libopus_channel_map[avctx->channels - 1];
+
+ /* FIXME: Opus can handle up to 255 channels. However, the mapping for
+ * anything greater than 8 is undefined. */
+ if (avctx->channels > 8)
+ av_log(avctx, AV_LOG_WARNING,
+ "Channel layout undefined for %d channels.\n", avctx->channels);
+
+ if (!avctx->bit_rate) {
+ /* Sane default copied from opusenc */
+ avctx->bit_rate = 64000 * opus->stream_count +
+ 32000 * coupled_stream_count;
+ av_log(avctx, AV_LOG_WARNING,
+ "No bit rate set. Defaulting to %d bps.\n", avctx->bit_rate);
+ }
+
+ if (avctx->bit_rate < 500 || avctx->bit_rate > 256000 * avctx->channels) {
+ av_log(avctx, AV_LOG_ERROR, "The bit rate %d bps is unsupported. "
+ "Please choose a value between 500 and %d.\n", avctx->bit_rate,
+ 256000 * avctx->channels);
+ return AVERROR(EINVAL);
+ }
+
+ frame_size = opus->opts.frame_duration * 48000 / 1000;
+ switch (frame_size) {
+ case 120:
+ case 240:
+ if (opus->opts.application != OPUS_APPLICATION_RESTRICTED_LOWDELAY)
+ av_log(avctx, AV_LOG_WARNING,
+ "LPC mode cannot be used with a frame duration of less "
+ "than 10ms. Enabling restricted low-delay mode.\n"
+ "Use a longer frame duration if this is not what you want.\n");
+ /* Frame sizes less than 10 ms can only use MDCT mode, so switching to
+ * RESTRICTED_LOWDELAY avoids an unnecessary extra 2.5ms lookahead. */
+ opus->opts.application = OPUS_APPLICATION_RESTRICTED_LOWDELAY;
+ case 480:
+ case 960:
+ case 1920:
+ case 2880:
+ opus->opts.packet_size =
+ avctx->frame_size = frame_size * avctx->sample_rate / 48000;
+ break;
+ default:
+ av_log(avctx, AV_LOG_ERROR, "Invalid frame duration: %g.\n"
+ "Frame duration must be exactly one of: 2.5, 5, 10, 20, 40 or 60.\n",
+ opus->opts.frame_duration);
+ return AVERROR(EINVAL);
+ }
+
+ if (avctx->compression_level < 0 || avctx->compression_level > 10) {
+ av_log(avctx, AV_LOG_WARNING,
+ "Compression level must be in the range 0 to 10. "
+ "Defaulting to 10.\n");
+ opus->opts.complexity = 10;
+ } else {
+ opus->opts.complexity = avctx->compression_level;
+ }
+
+ if (avctx->cutoff) {
+ switch (avctx->cutoff) {
+ case 4000:
+ opus->opts.max_bandwidth = OPUS_BANDWIDTH_NARROWBAND;
+ break;
+ case 6000:
+ opus->opts.max_bandwidth = OPUS_BANDWIDTH_MEDIUMBAND;
+ break;
+ case 8000:
+ opus->opts.max_bandwidth = OPUS_BANDWIDTH_WIDEBAND;
+ break;
+ case 12000:
+ opus->opts.max_bandwidth = OPUS_BANDWIDTH_SUPERWIDEBAND;
+ break;
+ case 20000:
+ opus->opts.max_bandwidth = OPUS_BANDWIDTH_FULLBAND;
+ break;
+ default:
+ av_log(avctx, AV_LOG_WARNING,
+ "Invalid frequency cutoff: %d. Using default maximum bandwidth.\n"
+ "Cutoff frequency must be exactly one of: 4000, 6000, 8000, 12000 or 20000.\n",
+ avctx->cutoff);
+ avctx->cutoff = 0;
+ }
+ }
+
+ enc = opus_multistream_encoder_create(avctx->sample_rate, avctx->channels,
+ opus->stream_count,
+ coupled_stream_count,
+ channel_mapping,
+ opus->opts.application, &ret);
+ if (ret != OPUS_OK) {
+ av_log(avctx, AV_LOG_ERROR,
+ "Failed to create encoder: %s\n", opus_strerror(ret));
+ return ff_opus_error_to_averror(ret);
+ }
+
+ ret = libopus_configure_encoder(avctx, enc, &opus->opts);
+ if (ret != OPUS_OK) {
+ ret = ff_opus_error_to_averror(ret);
+ goto fail;
+ }
+
+ header_size = 19 + (avctx->channels > 2 ? 2 + avctx->channels : 0);
+ avctx->extradata = av_malloc(header_size + FF_INPUT_BUFFER_PADDING_SIZE);
+ if (!avctx->extradata) {
+ av_log(avctx, AV_LOG_ERROR, "Failed to allocate extradata.\n");
+ ret = AVERROR(ENOMEM);
+ goto fail;
+ }
+ avctx->extradata_size = header_size;
+
+ opus->samples = av_mallocz(frame_size * avctx->channels *
+ av_get_bytes_per_sample(avctx->sample_fmt));
+ if (!opus->samples) {
+ av_log(avctx, AV_LOG_ERROR, "Failed to allocate samples buffer.\n");
+ ret = AVERROR(ENOMEM);
+ goto fail;
+ }
+
+ ret = opus_multistream_encoder_ctl(enc, OPUS_GET_LOOKAHEAD(&avctx->delay));
+ if (ret != OPUS_OK)
+ av_log(avctx, AV_LOG_WARNING,
+ "Unable to get number of lookahead samples: %s\n",
+ opus_strerror(ret));
+
+ libopus_write_header(avctx, opus->stream_count, coupled_stream_count,
+ opus_vorbis_channel_map[avctx->channels - 1]);
+
+ ff_af_queue_init(avctx, &opus->afq);
+
+ opus->enc = enc;
+
+ return 0;
+
+fail:
+ opus_multistream_encoder_destroy(enc);
+ av_freep(&avctx->extradata);
+ return ret;
+}
+
+static int libopus_encode(AVCodecContext *avctx, AVPacket *avpkt,
+ const AVFrame *frame, int *got_packet_ptr)
+{
+ LibopusEncContext *opus = avctx->priv_data;
+ const int sample_size = avctx->channels *
+ av_get_bytes_per_sample(avctx->sample_fmt);
+ uint8_t *audio;
+ int ret;
+
+ if (frame) {
+ ff_af_queue_add(&opus->afq, frame);
+ if (frame->nb_samples < opus->opts.packet_size) {
+ audio = opus->samples;
+ memcpy(audio, frame->data[0], frame->nb_samples * sample_size);
+ } else
+ audio = frame->data[0];
+ } else {
+ if (!opus->afq.remaining_samples)
+ return 0;
+ audio = opus->samples;
+ memset(audio, 0, opus->opts.packet_size * sample_size);
+ }
+
+ /* Maximum packet size taken from opusenc in opus-tools. 60ms packets
+ * consist of 3 frames in one packet. The maximum frame size is 1275
+ * bytes along with the largest possible packet header of 7 bytes. */
+ if (ret = ff_alloc_packet(avpkt, (1275 * 3 + 7) * opus->stream_count)) {
+ av_log(avctx, AV_LOG_ERROR, "Error getting output packet\n");
+ return ret;
+ }
+
+ if (avctx->sample_fmt == AV_SAMPLE_FMT_FLT)
+ ret = opus_multistream_encode_float(opus->enc, (float *)audio,
+ opus->opts.packet_size,
+ avpkt->data, avpkt->size);
+ else
+ ret = opus_multistream_encode(opus->enc, (opus_int16 *)audio,
+ opus->opts.packet_size,
+ avpkt->data, avpkt->size);
+
+ if (ret < 0) {
+ av_log(avctx, AV_LOG_ERROR,
+ "Error encoding frame: %s\n", opus_strerror(ret));
+ return ff_opus_error_to_averror(ret);
+ }
+
+ av_shrink_packet(avpkt, ret);
+
+ ff_af_queue_remove(&opus->afq, opus->opts.packet_size,
+ &avpkt->pts, &avpkt->duration);
+
+ *got_packet_ptr = 1;
+
+ return 0;
+}
+
+static int av_cold libopus_encode_close(AVCodecContext *avctx)
+{
+ LibopusEncContext *opus = avctx->priv_data;
+
+ opus_multistream_encoder_destroy(opus->enc);
+
+ ff_af_queue_close(&opus->afq);
+
+ av_freep(&opus->samples);
+ av_freep(&avctx->extradata);
+
+ return 0;
+}
+
+#define OFFSET(x) offsetof(LibopusEncContext, opts.x)
+#define FLAGS AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
+static const AVOption libopus_options[] = {
+ { "application", "Intended application type", OFFSET(application), AV_OPT_TYPE_INT, { .i64 = OPUS_APPLICATION_AUDIO }, OPUS_APPLICATION_VOIP, OPUS_APPLICATION_RESTRICTED_LOWDELAY, FLAGS, "application" },
+ { "voip", "Favor improved speech intelligibility", 0, AV_OPT_TYPE_CONST, { .i64 = OPUS_APPLICATION_VOIP }, 0, 0, FLAGS, "application" },
+ { "audio", "Favor faithfulness to the input", 0, AV_OPT_TYPE_CONST, { .i64 = OPUS_APPLICATION_AUDIO }, 0, 0, FLAGS, "application" },
+ { "lowdelay", "Restrict to only the lowest delay modes", 0, AV_OPT_TYPE_CONST, { .i64 = OPUS_APPLICATION_RESTRICTED_LOWDELAY }, 0, 0, FLAGS, "application" },
+ { "frame_duration", "Duration of a frame in milliseconds", OFFSET(frame_duration), AV_OPT_TYPE_FLOAT, { .dbl = 10.0 }, 2.5, 60.0, FLAGS },
+ { "packet_loss", "Expected packet loss percentage", OFFSET(packet_loss), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 100, FLAGS },
+ { "vbr", "Variable bit rate mode", OFFSET(vbr), AV_OPT_TYPE_INT, { .i64 = 1 }, 0, 2, FLAGS, "vbr" },
+ { "off", "Use constant bit rate", 0, AV_OPT_TYPE_CONST, { .i64 = 0 }, 0, 0, FLAGS, "vbr" },
+ { "on", "Use variable bit rate", 0, AV_OPT_TYPE_CONST, { .i64 = 1 }, 0, 0, FLAGS, "vbr" },
+ { "constrained", "Use constrained VBR", 0, AV_OPT_TYPE_CONST, { .i64 = 2 }, 0, 0, FLAGS, "vbr" },
+ { NULL },
+};
+
+static const AVClass libopus_class = {
+ .class_name = "libopus",
+ .item_name = av_default_item_name,
+ .option = libopus_options,
+ .version = LIBAVUTIL_VERSION_INT,
+};
+
+static const AVCodecDefault libopus_defaults[] = {
+ { "b", "0" },
+ { "compression_level", "10" },
+ { NULL },
+};
+
+static const int libopus_sample_rates[] = {
+ 48000, 24000, 16000, 12000, 8000, 0,
+};
+
+AVCodec ff_libopus_encoder = {
+ .name = "libopus",
+ .type = AVMEDIA_TYPE_AUDIO,
+ .id = AV_CODEC_ID_OPUS,
+ .priv_data_size = sizeof(LibopusEncContext),
+ .init = libopus_encode_init,
+ .encode2 = libopus_encode,
+ .close = libopus_encode_close,
+ .capabilities = CODEC_CAP_DELAY | CODEC_CAP_SMALL_LAST_FRAME,
+ .sample_fmts = (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_S16,
+ AV_SAMPLE_FMT_FLT,
+ AV_SAMPLE_FMT_NONE },
+ .channel_layouts = ff_vorbis_channel_layouts,
+ .supported_samplerates = libopus_sample_rates,
+ .long_name = NULL_IF_CONFIG_SMALL("libopus Opus"),
+ .priv_class = &libopus_class,
+ .defaults = libopus_defaults,
+};
diff --git a/gst-libs/ext/libav/libavcodec/libschroedinger.c b/gst-libs/ext/libav/libavcodec/libschroedinger.c
index 527c492..68e925c 100644
--- a/gst-libs/ext/libav/libavcodec/libschroedinger.c
+++ b/gst-libs/ext/libav/libavcodec/libschroedinger.c
@@ -23,12 +23,98 @@
* function definitions common to libschroedinger decoder and encoder
*/
-#include "libdirac_libschro.h"
#include "libschroedinger.h"
+#include "libavutil/mem.h"
+
+static const SchroVideoFormatInfo ff_schro_video_format_info[] = {
+ { 640, 480, 24000, 1001},
+ { 176, 120, 15000, 1001},
+ { 176, 144, 25, 2 },
+ { 352, 240, 15000, 1001},
+ { 352, 288, 25, 2 },
+ { 704, 480, 15000, 1001},
+ { 704, 576, 25, 2 },
+ { 720, 480, 30000, 1001},
+ { 720, 576, 25, 1 },
+ { 1280, 720, 60000, 1001},
+ { 1280, 720, 50, 1 },
+ { 1920, 1080, 30000, 1001},
+ { 1920, 1080, 25, 1 },
+ { 1920, 1080, 60000, 1001},
+ { 1920, 1080, 50, 1 },
+ { 2048, 1080, 24, 1 },
+ { 4096, 2160, 24, 1 },
+};
+
+static unsigned int get_video_format_idx(AVCodecContext *avccontext)
+{
+ unsigned int ret_idx = 0;
+ unsigned int idx;
+ unsigned int num_formats = sizeof(ff_schro_video_format_info) /
+ sizeof(ff_schro_video_format_info[0]);
+
+ for (idx = 1; idx < num_formats; ++idx) {
+ const SchroVideoFormatInfo *vf = &ff_schro_video_format_info[idx];
+ if (avccontext->width == vf->width &&
+ avccontext->height == vf->height) {
+ ret_idx = idx;
+ if (avccontext->time_base.den == vf->frame_rate_num &&
+ avccontext->time_base.num == vf->frame_rate_denom)
+ return idx;
+ }
+ }
+ return ret_idx;
+}
+
+void ff_schro_queue_init(FFSchroQueue *queue)
+{
+ queue->p_head = queue->p_tail = NULL;
+ queue->size = 0;
+}
+
+void ff_schro_queue_free(FFSchroQueue *queue, void (*free_func)(void *))
+{
+ while (queue->p_head)
+ free_func(ff_schro_queue_pop(queue));
+}
+
+int ff_schro_queue_push_back(FFSchroQueue *queue, void *p_data)
+{
+ FFSchroQueueElement *p_new = av_mallocz(sizeof(FFSchroQueueElement));
+
+ if (!p_new)
+ return -1;
+
+ p_new->data = p_data;
+
+ if (!queue->p_head)
+ queue->p_head = p_new;
+ else
+ queue->p_tail->next = p_new;
+ queue->p_tail = p_new;
+
+ ++queue->size;
+ return 0;
+}
+
+void *ff_schro_queue_pop(FFSchroQueue *queue)
+{
+ FFSchroQueueElement *top = queue->p_head;
+
+ if (top) {
+ void *data = top->data;
+ queue->p_head = queue->p_head->next;
+ --queue->size;
+ av_freep(&top);
+ return data;
+ }
+
+ return NULL;
+}
/**
* Schroedinger video preset table. Ensure that this tables matches up correctly
-* with the ff_dirac_schro_video_format_info table in libdirac_libschro.c.
+* with the ff_schro_video_format_info table.
*/
static const SchroVideoFormatEnum ff_schro_video_formats[]={
SCHRO_VIDEO_FORMAT_CUSTOM ,
@@ -55,7 +141,7 @@ SchroVideoFormatEnum ff_get_schro_video_format_preset(AVCodecContext *avccontext
unsigned int num_formats = sizeof(ff_schro_video_formats) /
sizeof(ff_schro_video_formats[0]);
- unsigned int idx = ff_dirac_schro_get_video_format_idx (avccontext);
+ unsigned int idx = get_video_format_idx(avccontext);
return (idx < num_formats) ? ff_schro_video_formats[idx] :
SCHRO_VIDEO_FORMAT_CUSTOM;
@@ -78,7 +164,7 @@ int ff_get_schro_frame_format (SchroChromaFormat schro_pix_fmt,
return -1;
}
-static void FreeSchroFrame(SchroFrame *frame, void *priv)
+static void free_schro_frame(SchroFrame *frame, void *priv)
{
AVPicture *p_pic = priv;
@@ -110,7 +196,7 @@ SchroFrame *ff_create_schro_frame(AVCodecContext *avccontext,
p_frame->format = schro_frame_fmt;
p_frame->width = y_width;
p_frame->height = y_height;
- schro_frame_set_free_callback(p_frame, FreeSchroFrame, (void *)p_pic);
+ schro_frame_set_free_callback(p_frame, free_schro_frame, (void *)p_pic);
for (i = 0; i < 3; ++i) {
p_frame->components[i].width = i ? uv_width : y_width;
diff --git a/gst-libs/ext/libav/libavcodec/libschroedinger.h b/gst-libs/ext/libav/libavcodec/libschroedinger.h
index 8147821..bf179d2 100644
--- a/gst-libs/ext/libav/libavcodec/libschroedinger.h
+++ b/gst-libs/ext/libav/libavcodec/libschroedinger.h
@@ -28,16 +28,86 @@
#include <schroedinger/schrobitstream.h>
#include <schroedinger/schroframe.h>
+
#include "avcodec.h"
+typedef struct SchroVideoFormatInfo {
+ uint16_t width;
+ uint16_t height;
+ uint16_t frame_rate_num;
+ uint16_t frame_rate_denom;
+} SchroVideoFormatInfo;
+
+/**
+* contains a single encoded frame returned from Dirac or Schroedinger
+*/
+typedef struct FFSchroEncodedFrame {
+ /** encoded frame data */
+ uint8_t *p_encbuf;
+
+ /** encoded frame size */
+ uint32_t size;
+
+ /** encoded frame number. Will be used as pts */
+ uint32_t frame_num;
+
+ /** key frame flag. 1 : is key frame , 0 : in not key frame */
+ uint16_t key_frame;
+} FFSchroEncodedFrame;
+
+/**
+* queue element
+*/
+typedef struct FFSchroQueueElement {
+ /** Data to be stored in queue*/
+ void *data;
+ /** Pointer to next element queue */
+ struct FFSchroQueueElement *next;
+} FFSchroQueueElement;
+
+
+/**
+* A simple queue implementation used in libschroedinger
+*/
+typedef struct FFSchroQueue {
+ /** Pointer to head of queue */
+ FFSchroQueueElement *p_head;
+ /** Pointer to tail of queue */
+ FFSchroQueueElement *p_tail;
+ /** Queue size*/
+ int size;
+} FFSchroQueue;
+
+/**
+* Initialise the queue
+*/
+void ff_schro_queue_init(FFSchroQueue *queue);
+
+/**
+* Add an element to the end of the queue
+*/
+int ff_schro_queue_push_back(FFSchroQueue *queue, void *p_data);
+
+/**
+* Return the first element in the queue
+*/
+void *ff_schro_queue_pop(FFSchroQueue *queue);
+
+/**
+* Free the queue resources. free_func is a function supplied by the caller to
+* free any resources allocated by the caller. The data field of the queue
+* element is passed to it.
+*/
+void ff_schro_queue_free(FFSchroQueue *queue, void (*free_func)(void *));
+
static const struct {
- enum PixelFormat ff_pix_fmt;
+ enum AVPixelFormat ff_pix_fmt;
SchroChromaFormat schro_pix_fmt;
SchroFrameFormat schro_frame_fmt;
} schro_pixel_format_map[] = {
- { PIX_FMT_YUV420P, SCHRO_CHROMA_420, SCHRO_FRAME_FORMAT_U8_420 },
- { PIX_FMT_YUV422P, SCHRO_CHROMA_422, SCHRO_FRAME_FORMAT_U8_422 },
- { PIX_FMT_YUV444P, SCHRO_CHROMA_444, SCHRO_FRAME_FORMAT_U8_444 },
+ { AV_PIX_FMT_YUV420P, SCHRO_CHROMA_420, SCHRO_FRAME_FORMAT_U8_420 },
+ { AV_PIX_FMT_YUV422P, SCHRO_CHROMA_422, SCHRO_FRAME_FORMAT_U8_422 },
+ { AV_PIX_FMT_YUV444P, SCHRO_CHROMA_444, SCHRO_FRAME_FORMAT_U8_444 },
};
/**
diff --git a/gst-libs/ext/libav/libavcodec/libschroedingerdec.c b/gst-libs/ext/libav/libavcodec/libschroedingerdec.c
index 184e8cb..2411fe6 100644
--- a/gst-libs/ext/libav/libavcodec/libschroedingerdec.c
+++ b/gst-libs/ext/libav/libavcodec/libschroedingerdec.c
@@ -27,9 +27,14 @@
* (http://dirac.sourceforge.net/specification.html).
*/
+#include <string.h>
+
#include "libavutil/imgutils.h"
+#include "libavutil/internal.h"
+#include "libavutil/intreadwrite.h"
+#include "libavutil/mem.h"
#include "avcodec.h"
-#include "libdirac_libschro.h"
+#include "internal.h"
#include "libschroedinger.h"
#undef NDEBUG
@@ -40,6 +45,12 @@
#include <schroedinger/schrodebug.h>
#include <schroedinger/schrovideoformat.h>
+/** SchroFrame and Pts relation */
+typedef struct LibSchroFrameContext {
+ SchroFrame *frame;
+ int64_t pts;
+} LibSchroFrameContext;
+
/** libschroedinger decoder private data */
typedef struct SchroDecoderParams {
/** Schroedinger video format */
@@ -52,7 +63,7 @@ typedef struct SchroDecoderParams {
SchroDecoder* decoder;
/** queue storing decoded frames */
- DiracSchroQueue dec_frame_queue;
+ FFSchroQueue dec_frame_queue;
/** end of sequence signalled */
int eos_signalled;
@@ -61,7 +72,7 @@ typedef struct SchroDecoderParams {
int eos_pulled;
/** decoded picture */
- AVPicture dec_pic;
+ AVFrame dec_frame;
} SchroDecoderParams;
typedef struct SchroParseUnitContext {
@@ -71,16 +82,19 @@ typedef struct SchroParseUnitContext {
static void libschroedinger_decode_buffer_free(SchroBuffer *schro_buf,
- void *priv);
+ void *priv)
+{
+ av_freep(&priv);
+}
-static void SchroParseContextInit(SchroParseUnitContext *parse_ctx,
- const uint8_t *buf, int buf_size)
+static void parse_context_init(SchroParseUnitContext *parse_ctx,
+ const uint8_t *buf, int buf_size)
{
parse_ctx->buf = buf;
parse_ctx->buf_size = buf_size;
}
-static SchroBuffer *FindNextSchroParseUnit(SchroParseUnitContext *parse_ctx)
+static SchroBuffer *find_next_parse_unit(SchroParseUnitContext *parse_ctx)
{
SchroBuffer *enc_buf = NULL;
int next_pu_offset = 0;
@@ -106,6 +120,11 @@ static SchroBuffer *FindNextSchroParseUnit(SchroParseUnitContext *parse_ctx)
return NULL;
in_buf = av_malloc(next_pu_offset);
+ if (!in_buf) {
+ av_log(parse_ctx, AV_LOG_ERROR, "Unable to allocate input buffer\n");
+ return NULL;
+ }
+
memcpy(in_buf, parse_ctx->buf, next_pu_offset);
enc_buf = schro_buffer_new_with_data(in_buf, next_pu_offset);
enc_buf->free = libschroedinger_decode_buffer_free;
@@ -120,7 +139,7 @@ static SchroBuffer *FindNextSchroParseUnit(SchroParseUnitContext *parse_ctx)
/**
* Returns Libav chroma format.
*/
-static enum PixelFormat get_chroma_format(SchroChromaFormat schro_pix_fmt)
+static enum AVPixelFormat get_chroma_format(SchroChromaFormat schro_pix_fmt)
{
int num_formats = sizeof(schro_pixel_format_map) /
sizeof(schro_pixel_format_map[0]);
@@ -129,7 +148,7 @@ static enum PixelFormat get_chroma_format(SchroChromaFormat schro_pix_fmt)
for (idx = 0; idx < num_formats; ++idx)
if (schro_pixel_format_map[idx].schro_pix_fmt == schro_pix_fmt)
return schro_pixel_format_map[idx].ff_pix_fmt;
- return PIX_FMT_NONE;
+ return AV_PIX_FMT_NONE;
}
static av_cold int libschroedinger_decode_init(AVCodecContext *avccontext)
@@ -147,16 +166,10 @@ static av_cold int libschroedinger_decode_init(AVCodecContext *avccontext)
return -1;
/* Initialize the decoded frame queue. */
- ff_dirac_schro_queue_init(&p_schro_params->dec_frame_queue);
+ ff_schro_queue_init(&p_schro_params->dec_frame_queue);
return 0;
}
-static void libschroedinger_decode_buffer_free(SchroBuffer *schro_buf,
- void *priv)
-{
- av_freep(&priv);
-}
-
static void libschroedinger_decode_frame_free(void *frame)
{
schro_frame_unref(frame);
@@ -170,8 +183,8 @@ static void libschroedinger_handle_first_access_unit(AVCodecContext *avccontext)
p_schro_params->format = schro_decoder_get_video_format(decoder);
/* Tell Libav about sequence details. */
- if (av_image_check_size(p_schro_params->format->width, p_schro_params->format->height,
- 0, avccontext) < 0) {
+ if (av_image_check_size(p_schro_params->format->width,
+ p_schro_params->format->height, 0, avccontext) < 0) {
av_log(avccontext, AV_LOG_ERROR, "invalid dimensions (%dx%d)\n",
p_schro_params->format->width, p_schro_params->format->height);
avccontext->height = avccontext->width = 0;
@@ -191,34 +204,30 @@ static void libschroedinger_handle_first_access_unit(AVCodecContext *avccontext)
avccontext->time_base.den = p_schro_params->format->frame_rate_numerator;
avccontext->time_base.num = p_schro_params->format->frame_rate_denominator;
-
- if (!p_schro_params->dec_pic.data[0])
- avpicture_alloc(&p_schro_params->dec_pic,
- avccontext->pix_fmt,
- avccontext->width,
- avccontext->height);
}
static int libschroedinger_decode_frame(AVCodecContext *avccontext,
- void *data, int *data_size,
+ void *data, int *got_frame,
AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
+ int64_t pts = avpkt->pts;
+ SchroTag *tag;
SchroDecoderParams *p_schro_params = avccontext->priv_data;
SchroDecoder *decoder = p_schro_params->decoder;
- AVPicture *picture = data;
SchroBuffer *enc_buf;
SchroFrame* frame;
int state;
int go = 1;
int outer = 1;
SchroParseUnitContext parse_ctx;
+ LibSchroFrameContext *framewithpts = NULL;
- *data_size = 0;
+ *got_frame = 0;
- SchroParseContextInit(&parse_ctx, buf, buf_size);
+ parse_context_init(&parse_ctx, buf, buf_size);
if (!buf_size) {
if (!p_schro_params->eos_signalled) {
state = schro_decoder_push_end_of_stream(decoder);
@@ -228,7 +237,14 @@ static int libschroedinger_decode_frame(AVCodecContext *avccontext,
/* Loop through all the individual parse units in the input buffer */
do {
- if ((enc_buf = FindNextSchroParseUnit(&parse_ctx))) {
+ if ((enc_buf = find_next_parse_unit(&parse_ctx))) {
+ /* Set Schrotag with the pts to be recovered after decoding*/
+ enc_buf->tag = schro_tag_new(av_malloc(sizeof(int64_t)), av_free);
+ if (!enc_buf->tag->value) {
+ av_log(avccontext, AV_LOG_ERROR, "Unable to allocate SchroTag\n");
+ return AVERROR(ENOMEM);
+ }
+ AV_WN(64, enc_buf->tag->value, pts);
/* Push buffer into decoder. */
if (SCHRO_PARSE_CODE_IS_PICTURE(enc_buf->data[4]) &&
SCHRO_PARSE_CODE_NUM_REFS(enc_buf->data[4]) > 0)
@@ -262,11 +278,21 @@ static int libschroedinger_decode_frame(AVCodecContext *avccontext,
case SCHRO_DECODER_OK:
/* Pull a frame out of the decoder. */
+ tag = schro_decoder_get_picture_tag(decoder);
frame = schro_decoder_pull(decoder);
- if (frame)
- ff_dirac_schro_queue_push_back(&p_schro_params->dec_frame_queue,
- frame);
+ if (frame) {
+ /* Add relation between schroframe and pts. */
+ framewithpts = av_malloc(sizeof(LibSchroFrameContext));
+ if (!framewithpts) {
+ av_log(avccontext, AV_LOG_ERROR, "Unable to allocate FrameWithPts\n");
+ return AVERROR(ENOMEM);
+ }
+ framewithpts->frame = frame;
+ framewithpts->pts = AV_RN64(tag->value);
+ ff_schro_queue_push_back(&p_schro_params->dec_frame_queue,
+ framewithpts);
+ }
break;
case SCHRO_DECODER_EOS:
go = 0;
@@ -283,30 +309,46 @@ static int libschroedinger_decode_frame(AVCodecContext *avccontext,
} while (outer);
/* Grab next frame to be returned from the top of the queue. */
- frame = ff_dirac_schro_queue_pop(&p_schro_params->dec_frame_queue);
+ framewithpts = ff_schro_queue_pop(&p_schro_params->dec_frame_queue);
+
+ if (framewithpts && framewithpts->frame) {
+ if (p_schro_params->dec_frame.data[0])
+ avccontext->release_buffer(avccontext, &p_schro_params->dec_frame);
+ if (ff_get_buffer(avccontext, &p_schro_params->dec_frame) < 0) {
+ av_log(avccontext, AV_LOG_ERROR, "Unable to allocate buffer\n");
+ return AVERROR(ENOMEM);
+ }
- if (frame) {
- memcpy(p_schro_params->dec_pic.data[0],
- frame->components[0].data,
- frame->components[0].length);
+ memcpy(p_schro_params->dec_frame.data[0],
+ framewithpts->frame->components[0].data,
+ framewithpts->frame->components[0].length);
- memcpy(p_schro_params->dec_pic.data[1],
- frame->components[1].data,
- frame->components[1].length);
+ memcpy(p_schro_params->dec_frame.data[1],
+ framewithpts->frame->components[1].data,
+ framewithpts->frame->components[1].length);
- memcpy(p_schro_params->dec_pic.data[2],
- frame->components[2].data,
- frame->components[2].length);
+ memcpy(p_schro_params->dec_frame.data[2],
+ framewithpts->frame->components[2].data,
+ framewithpts->frame->components[2].length);
- /* Fill picture with current buffer data from Schroedinger. */
- avpicture_fill(picture, p_schro_params->dec_pic.data[0],
- avccontext->pix_fmt,
- avccontext->width, avccontext->height);
+ /* Fill frame with current buffer data from Schroedinger. */
+ p_schro_params->dec_frame.format = -1; /* Unknown -1 */
+ p_schro_params->dec_frame.width = framewithpts->frame->width;
+ p_schro_params->dec_frame.height = framewithpts->frame->height;
+ p_schro_params->dec_frame.pkt_pts = framewithpts->pts;
+ p_schro_params->dec_frame.linesize[0] = framewithpts->frame->components[0].stride;
+ p_schro_params->dec_frame.linesize[1] = framewithpts->frame->components[1].stride;
+ p_schro_params->dec_frame.linesize[2] = framewithpts->frame->components[2].stride;
- *data_size = sizeof(AVPicture);
+ *(AVFrame*)data = p_schro_params->dec_frame;
+ *got_frame = 1;
/* Now free the frame resources. */
- libschroedinger_decode_frame_free(frame);
+ libschroedinger_decode_frame_free(framewithpts->frame);
+ av_free(framewithpts);
+ } else {
+ data = NULL;
+ *got_frame = 0;
}
return buf_size;
}
@@ -319,11 +361,12 @@ static av_cold int libschroedinger_decode_close(AVCodecContext *avccontext)
schro_decoder_free(p_schro_params->decoder);
av_freep(&p_schro_params->format);
- avpicture_free(&p_schro_params->dec_pic);
+ if (p_schro_params->dec_frame.data[0])
+ avccontext->release_buffer(avccontext, &p_schro_params->dec_frame);
/* Free data in the output frame queue. */
- ff_dirac_schro_queue_free(&p_schro_params->dec_frame_queue,
- libschroedinger_decode_frame_free);
+ ff_schro_queue_free(&p_schro_params->dec_frame_queue,
+ libschroedinger_decode_frame_free);
return 0;
}
@@ -335,10 +378,10 @@ static void libschroedinger_flush(AVCodecContext *avccontext)
SchroDecoderParams *p_schro_params = avccontext->priv_data;
/* Free data in the output frame queue. */
- ff_dirac_schro_queue_free(&p_schro_params->dec_frame_queue,
- libschroedinger_decode_frame_free);
+ ff_schro_queue_free(&p_schro_params->dec_frame_queue,
+ libschroedinger_decode_frame_free);
- ff_dirac_schro_queue_init(&p_schro_params->dec_frame_queue);
+ ff_schro_queue_init(&p_schro_params->dec_frame_queue);
schro_decoder_reset(p_schro_params->decoder);
p_schro_params->eos_pulled = 0;
p_schro_params->eos_signalled = 0;
@@ -347,12 +390,12 @@ static void libschroedinger_flush(AVCodecContext *avccontext)
AVCodec ff_libschroedinger_decoder = {
.name = "libschroedinger",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_DIRAC,
+ .id = AV_CODEC_ID_DIRAC,
.priv_data_size = sizeof(SchroDecoderParams),
.init = libschroedinger_decode_init,
.close = libschroedinger_decode_close,
.decode = libschroedinger_decode_frame,
.capabilities = CODEC_CAP_DELAY,
- .flush = libschroedinger_flush,
- .long_name = NULL_IF_CONFIG_SMALL("libschroedinger Dirac 2.2"),
+ .flush = libschroedinger_flush,
+ .long_name = NULL_IF_CONFIG_SMALL("libschroedinger Dirac 2.2"),
};
diff --git a/gst-libs/ext/libav/libavcodec/libschroedingerenc.c b/gst-libs/ext/libav/libavcodec/libschroedingerenc.c
index 2aadd3a..4002286 100644
--- a/gst-libs/ext/libav/libavcodec/libschroedingerenc.c
+++ b/gst-libs/ext/libav/libavcodec/libschroedingerenc.c
@@ -35,7 +35,7 @@
#include <schroedinger/schrovideoformat.h>
#include "avcodec.h"
-#include "libdirac_libschro.h"
+#include "internal.h"
#include "libschroedinger.h"
#include "bytestream.h"
@@ -64,19 +64,22 @@ typedef struct SchroEncoderParams {
int enc_buf_size;
/** queue storing encoded frames */
- DiracSchroQueue enc_frame_queue;
+ FFSchroQueue enc_frame_queue;
/** end of sequence signalled */
int eos_signalled;
/** end of sequence pulled */
int eos_pulled;
+
+ /* counter for frames submitted to encoder, used as dts */
+ int64_t dts;
} SchroEncoderParams;
/**
* Works out Schro-compatible chroma format.
*/
-static int SetSchroChromaFormat(AVCodecContext *avccontext)
+static int set_chroma_format(AVCodecContext *avccontext)
{
int num_formats = sizeof(schro_pixel_format_map) /
sizeof(schro_pixel_format_map[0]);
@@ -125,7 +128,7 @@ static int libschroedinger_encode_init(AVCodecContext *avccontext)
p_schro_params->format->width = avccontext->width;
p_schro_params->format->height = avccontext->height;
- if (SetSchroChromaFormat(avccontext) == -1)
+ if (set_chroma_format(avccontext) == -1)
return -1;
if (avccontext->color_primaries == AVCOL_PRI_BT709) {
@@ -175,6 +178,7 @@ static int libschroedinger_encode_init(AVCodecContext *avccontext)
schro_encoder_setting_set_double(p_schro_params->encoder,
"au_distance", avccontext->gop_size);
avccontext->has_b_frames = 1;
+ p_schro_params->dts = -1;
}
/* FIXME - Need to handle SCHRO_ENCODER_RATE_CONTROL_LOW_DELAY. */
@@ -231,12 +235,12 @@ static int libschroedinger_encode_init(AVCodecContext *avccontext)
schro_encoder_start(p_schro_params->encoder);
/* Initialize the encoded frame queue. */
- ff_dirac_schro_queue_init(&p_schro_params->enc_frame_queue);
+ ff_schro_queue_init(&p_schro_params->enc_frame_queue);
return 0;
}
static SchroFrame *libschroedinger_frame_from_data(AVCodecContext *avccontext,
- void *in_data)
+ const AVFrame *frame)
{
SchroEncoderParams *p_schro_params = avccontext->priv_data;
SchroFrame *in_frame;
@@ -246,7 +250,7 @@ static SchroFrame *libschroedinger_frame_from_data(AVCodecContext *avccontext,
in_frame = ff_create_schro_frame(avccontext, p_schro_params->frame_format);
if (in_frame)
- avpicture_layout((AVPicture *)in_data, avccontext->pix_fmt,
+ avpicture_layout((const AVPicture *)frame, avccontext->pix_fmt,
avccontext->width, avccontext->height,
in_frame->components[0].data,
p_schro_params->frame_size);
@@ -254,29 +258,29 @@ static SchroFrame *libschroedinger_frame_from_data(AVCodecContext *avccontext,
return in_frame;
}
-static void SchroedingerFreeFrame(void *data)
+static void libschroedinger_free_frame(void *data)
{
- DiracSchroEncodedFrame *enc_frame = data;
+ FFSchroEncodedFrame *enc_frame = data;
av_freep(&enc_frame->p_encbuf);
av_free(enc_frame);
}
-static int libschroedinger_encode_frame(AVCodecContext *avccontext,
- unsigned char *frame,
- int buf_size, void *data)
+static int libschroedinger_encode_frame(AVCodecContext *avccontext, AVPacket *pkt,
+ const AVFrame *frame, int *got_packet)
{
int enc_size = 0;
SchroEncoderParams *p_schro_params = avccontext->priv_data;
SchroEncoder *encoder = p_schro_params->encoder;
- struct DiracSchroEncodedFrame *p_frame_output = NULL;
+ struct FFSchroEncodedFrame *p_frame_output = NULL;
int go = 1;
SchroBuffer *enc_buf;
int presentation_frame;
int parse_code;
int last_frame_in_sequence = 0;
+ int pkt_size, ret;
- if (!data) {
+ if (!frame) {
/* Push end of sequence if not already signalled. */
if (!p_schro_params->eos_signalled) {
schro_encoder_end_of_stream(encoder);
@@ -285,7 +289,7 @@ static int libschroedinger_encode_frame(AVCodecContext *avccontext,
} else {
/* Allocate frame data to schro input buffer. */
SchroFrame *in_frame = libschroedinger_frame_from_data(avccontext,
- data);
+ frame);
/* Load next frame. */
schro_encoder_push_frame(encoder, in_frame);
}
@@ -328,7 +332,7 @@ static int libschroedinger_encode_frame(AVCodecContext *avccontext,
}
/* Create output frame. */
- p_frame_output = av_mallocz(sizeof(DiracSchroEncodedFrame));
+ p_frame_output = av_mallocz(sizeof(FFSchroEncodedFrame));
/* Set output data. */
p_frame_output->size = p_schro_params->enc_buf_size;
p_frame_output->p_encbuf = p_schro_params->enc_buf;
@@ -340,8 +344,8 @@ static int libschroedinger_encode_frame(AVCodecContext *avccontext,
* through 17 represesent the frame number. */
p_frame_output->frame_num = AV_RB32(enc_buf->data + 13);
- ff_dirac_schro_queue_push_back(&p_schro_params->enc_frame_queue,
- p_frame_output);
+ ff_schro_queue_push_back(&p_schro_params->enc_frame_queue,
+ p_frame_output);
p_schro_params->enc_buf_size = 0;
p_schro_params->enc_buf = NULL;
@@ -368,33 +372,47 @@ static int libschroedinger_encode_frame(AVCodecContext *avccontext,
p_schro_params->eos_pulled)
last_frame_in_sequence = 1;
- p_frame_output = ff_dirac_schro_queue_pop(&p_schro_params->enc_frame_queue);
+ p_frame_output = ff_schro_queue_pop(&p_schro_params->enc_frame_queue);
if (!p_frame_output)
return 0;
- memcpy(frame, p_frame_output->p_encbuf, p_frame_output->size);
+ pkt_size = p_frame_output->size;
+ if (last_frame_in_sequence && p_schro_params->enc_buf_size > 0)
+ pkt_size += p_schro_params->enc_buf_size;
+ if ((ret = ff_alloc_packet(pkt, pkt_size)) < 0) {
+ av_log(avccontext, AV_LOG_ERROR, "Error getting output packet of size %d.\n", pkt_size);
+ goto error;
+ }
+
+ memcpy(pkt->data, p_frame_output->p_encbuf, p_frame_output->size);
avccontext->coded_frame->key_frame = p_frame_output->key_frame;
/* Use the frame number of the encoded frame as the pts. It is OK to
* do so since Dirac is a constant frame rate codec. It expects input
* to be of constant frame rate. */
+ pkt->pts =
avccontext->coded_frame->pts = p_frame_output->frame_num;
+ pkt->dts = p_schro_params->dts++;
enc_size = p_frame_output->size;
/* Append the end of sequence information to the last frame in the
* sequence. */
if (last_frame_in_sequence && p_schro_params->enc_buf_size > 0) {
- memcpy(frame + enc_size, p_schro_params->enc_buf,
+ memcpy(pkt->data + enc_size, p_schro_params->enc_buf,
p_schro_params->enc_buf_size);
enc_size += p_schro_params->enc_buf_size;
av_freep(&p_schro_params->enc_buf);
p_schro_params->enc_buf_size = 0;
}
- /* free frame */
- SchroedingerFreeFrame(p_frame_output);
+ if (p_frame_output->key_frame)
+ pkt->flags |= AV_PKT_FLAG_KEY;
+ *got_packet = 1;
- return enc_size;
+error:
+ /* free frame */
+ libschroedinger_free_frame(p_frame_output);
+ return ret;
}
@@ -406,8 +424,8 @@ static int libschroedinger_encode_close(AVCodecContext *avccontext)
schro_encoder_free(p_schro_params->encoder);
/* Free data in the output frame queue. */
- ff_dirac_schro_queue_free(&p_schro_params->enc_frame_queue,
- SchroedingerFreeFrame);
+ ff_schro_queue_free(&p_schro_params->enc_frame_queue,
+ libschroedinger_free_frame);
/* Free the encoder buffer. */
@@ -424,12 +442,14 @@ static int libschroedinger_encode_close(AVCodecContext *avccontext)
AVCodec ff_libschroedinger_encoder = {
.name = "libschroedinger",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_DIRAC,
+ .id = AV_CODEC_ID_DIRAC,
.priv_data_size = sizeof(SchroEncoderParams),
.init = libschroedinger_encode_init,
- .encode = libschroedinger_encode_frame,
+ .encode2 = libschroedinger_encode_frame,
.close = libschroedinger_encode_close,
- .capabilities = CODEC_CAP_DELAY,
- .pix_fmts = (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_YUV422P, PIX_FMT_YUV444P, PIX_FMT_NONE},
- .long_name = NULL_IF_CONFIG_SMALL("libschroedinger Dirac 2.2"),
+ .capabilities = CODEC_CAP_DELAY,
+ .pix_fmts = (const enum AVPixelFormat[]){
+ AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUV444P, AV_PIX_FMT_NONE
+ },
+ .long_name = NULL_IF_CONFIG_SMALL("libschroedinger Dirac 2.2"),
};
diff --git a/gst-libs/ext/libav/libavcodec/libspeexdec.c b/gst-libs/ext/libav/libavcodec/libspeexdec.c
index eba2f16..8aa82ca 100644
--- a/gst-libs/ext/libav/libavcodec/libspeexdec.c
+++ b/gst-libs/ext/libav/libavcodec/libspeexdec.c
@@ -22,14 +22,17 @@
#include <speex/speex_header.h>
#include <speex/speex_stereo.h>
#include <speex/speex_callbacks.h>
+
+#include "libavutil/channel_layout.h"
+#include "libavutil/common.h"
#include "avcodec.h"
+#include "internal.h"
typedef struct {
AVFrame frame;
SpeexBits bits;
SpeexStereoState stereo;
void *dec_state;
- SpeexHeader *header;
int frame_size;
} LibSpeexContext;
@@ -38,38 +41,50 @@ static av_cold int libspeex_decode_init(AVCodecContext *avctx)
{
LibSpeexContext *s = avctx->priv_data;
const SpeexMode *mode;
-
- // defaults in the case of a missing header
- if (avctx->sample_rate <= 8000)
- mode = &speex_nb_mode;
- else if (avctx->sample_rate <= 16000)
- mode = &speex_wb_mode;
- else
- mode = &speex_uwb_mode;
-
- if (avctx->extradata_size >= 80)
- s->header = speex_packet_to_header(avctx->extradata, avctx->extradata_size);
+ SpeexHeader *header = NULL;
+ int spx_mode;
avctx->sample_fmt = AV_SAMPLE_FMT_S16;
- if (s->header) {
- avctx->sample_rate = s->header->rate;
- avctx->channels = s->header->nb_channels;
- avctx->frame_size = s->frame_size = s->header->frame_size;
- if (s->header->frames_per_packet)
- avctx->frame_size *= s->header->frames_per_packet;
-
- mode = speex_lib_get_mode(s->header->mode);
- if (!mode) {
- av_log(avctx, AV_LOG_ERROR, "Unknown Speex mode %d", s->header->mode);
- return AVERROR_INVALIDDATA;
+ if (avctx->extradata && avctx->extradata_size >= 80) {
+ header = speex_packet_to_header(avctx->extradata,
+ avctx->extradata_size);
+ if (!header)
+ av_log(avctx, AV_LOG_WARNING, "Invalid Speex header\n");
+ }
+ if (header) {
+ avctx->channels = header->nb_channels;
+ spx_mode = header->mode;
+ speex_header_free(header);
+ } else {
+ switch (avctx->sample_rate) {
+ case 8000: spx_mode = 0; break;
+ case 16000: spx_mode = 1; break;
+ case 32000: spx_mode = 2; break;
+ default:
+ /* libspeex can handle any mode if initialized as ultra-wideband */
+ av_log(avctx, AV_LOG_WARNING, "Invalid sample rate: %d\n"
+ "Decoding as 32kHz ultra-wideband\n",
+ avctx->sample_rate);
+ spx_mode = 2;
}
- } else
- av_log(avctx, AV_LOG_INFO, "Missing Speex header, assuming defaults.\n");
+ }
- if (avctx->channels > 2) {
- av_log(avctx, AV_LOG_ERROR, "Only stereo and mono are supported.\n");
- return AVERROR(EINVAL);
+ mode = speex_lib_get_mode(spx_mode);
+ if (!mode) {
+ av_log(avctx, AV_LOG_ERROR, "Unknown Speex mode %d", spx_mode);
+ return AVERROR_INVALIDDATA;
+ }
+ avctx->sample_rate = 8000 << spx_mode;
+ s->frame_size = 160 << spx_mode;
+
+ if (avctx->channels < 1 || avctx->channels > 2) {
+ /* libspeex can handle mono or stereo if initialized as stereo */
+ av_log(avctx, AV_LOG_ERROR, "Invalid channel count: %d.\n"
+ "Decoding as stereo.\n", avctx->channels);
+ avctx->channels = 2;
}
+ avctx->channel_layout = avctx->channels == 2 ? AV_CH_LAYOUT_STEREO :
+ AV_CH_LAYOUT_MONO;
speex_bits_init(&s->bits);
s->dec_state = speex_decoder_init(mode);
@@ -78,10 +93,6 @@ static av_cold int libspeex_decode_init(AVCodecContext *avctx)
return -1;
}
- if (!s->header) {
- speex_decoder_ctl(s->dec_state, SPEEX_GET_FRAME_SIZE, &s->frame_size);
- }
-
if (avctx->channels == 2) {
SpeexCallback callback;
callback.callback_id = SPEEX_INBAND_STEREO;
@@ -108,16 +119,18 @@ static int libspeex_decode_frame(AVCodecContext *avctx, void *data,
/* get output buffer */
s->frame.nb_samples = s->frame_size;
- if ((ret = avctx->get_buffer(avctx, &s->frame)) < 0) {
+ if ((ret = ff_get_buffer(avctx, &s->frame)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return ret;
}
output = (int16_t *)s->frame.data[0];
- /* if there is not enough data left for the smallest possible frame,
- reset the libspeex buffer using the current packet, otherwise ignore
- the current packet and keep decoding frames from the libspeex buffer. */
- if (speex_bits_remaining(&s->bits) < 43) {
+ /* if there is not enough data left for the smallest possible frame or the
+ next 5 bits are a terminator code, reset the libspeex buffer using the
+ current packet, otherwise ignore the current packet and keep decoding
+ frames from the libspeex buffer. */
+ if (speex_bits_remaining(&s->bits) < 5 ||
+ speex_bits_peek_unsigned(&s->bits, 5) == 0x1F) {
/* check for flush packet */
if (!buf || !buf_size) {
*got_frame_ptr = 0;
@@ -147,7 +160,6 @@ static av_cold int libspeex_decode_close(AVCodecContext *avctx)
{
LibSpeexContext *s = avctx->priv_data;
- speex_header_free(s->header);
speex_bits_destroy(&s->bits);
speex_decoder_destroy(s->dec_state);
@@ -163,12 +175,12 @@ static av_cold void libspeex_decode_flush(AVCodecContext *avctx)
AVCodec ff_libspeex_decoder = {
.name = "libspeex",
.type = AVMEDIA_TYPE_AUDIO,
- .id = CODEC_ID_SPEEX,
+ .id = AV_CODEC_ID_SPEEX,
.priv_data_size = sizeof(LibSpeexContext),
.init = libspeex_decode_init,
.close = libspeex_decode_close,
.decode = libspeex_decode_frame,
.flush = libspeex_decode_flush,
.capabilities = CODEC_CAP_SUBFRAMES | CODEC_CAP_DELAY | CODEC_CAP_DR1,
- .long_name = NULL_IF_CONFIG_SMALL("libspeex Speex"),
+ .long_name = NULL_IF_CONFIG_SMALL("libspeex Speex"),
};
diff --git a/gst-libs/ext/libav/libavcodec/libspeexenc.c b/gst-libs/ext/libav/libavcodec/libspeexenc.c
index 290718c..4277e62 100644
--- a/gst-libs/ext/libav/libavcodec/libspeexenc.c
+++ b/gst-libs/ext/libav/libavcodec/libspeexenc.c
@@ -62,15 +62,35 @@
* sometimes desirable to use multiple frames-per-packet to reduce the
* amount of container overhead. This can be done by setting the
* 'frames_per_packet' option to a value 1 to 8.
+ *
+ *
+ * Optional features
+ * Speex encoder supports several optional features, which can be useful
+ * for some conditions.
+ *
+ * Voice Activity Detection
+ * When enabled, voice activity detection detects whether the audio
+ * being encoded is speech or silence/background noise. VAD is always
+ * implicitly activated when encoding in VBR, so the option is only useful
+ * in non-VBR operation. In this case, Speex detects non-speech periods and
+ * encodes them with just enough bits to reproduce the background noise.
+ *
+ * Discontinuous Transmission (DTX)
+ * DTX is an addition to VAD/VBR operation, that allows to stop transmitting
+ * completely when the background noise is stationary.
+ * In file-based operation only 5 bits are used for such frames.
*/
#include <speex/speex.h>
#include <speex/speex_header.h>
#include <speex/speex_stereo.h>
-#include "libavutil/mathematics.h"
+
+#include "libavutil/channel_layout.h"
+#include "libavutil/common.h"
#include "libavutil/opt.h"
#include "avcodec.h"
#include "internal.h"
+#include "audio_frame_queue.h"
typedef struct {
AVClass *class; ///< AVClass for private options
@@ -81,10 +101,10 @@ typedef struct {
float vbr_quality; ///< VBR quality 0.0 to 10.0
int cbr_quality; ///< CBR quality 0 to 10
int abr; ///< flag to enable ABR
+ int vad; ///< flag to enable VAD
+ int dtx; ///< flag to enable DTX
int pkt_frame_count; ///< frame count for the current packet
- int lookahead; ///< encoder delay
- int64_t next_pts; ///< next pts, in sample_rate time base
- int pkt_sample_count; ///< sample count in the current packet
+ AudioFrameQueue afq; ///< frame queue
} LibSpeexEncContext;
static av_cold void print_enc_params(AVCodecContext *avctx,
@@ -117,6 +137,8 @@ static av_cold void print_enc_params(AVCodecContext *avctx,
s->frames_per_packet);
av_log(avctx, AV_LOG_DEBUG, "packet size: %d\n",
avctx->frame_size * s->frames_per_packet);
+ av_log(avctx, AV_LOG_DEBUG, "voice activity detection: %d\n", s->vad);
+ av_log(avctx, AV_LOG_DEBUG, "discontinuous transmission: %d\n", s->dtx);
}
static av_cold int encode_init(AVCodecContext *avctx)
@@ -157,6 +179,7 @@ static av_cold int encode_init(AVCodecContext *avctx)
if (avctx->flags & CODEC_FLAG_QSCALE) {
/* VBR */
s->header.vbr = 1;
+ s->vad = 1; /* VAD is always implicitly activated for VBR */
speex_encoder_ctl(s->enc_state, SPEEX_SET_VBR, &s->header.vbr);
s->vbr_quality = av_clipf(avctx->global_quality / (float)FF_QP2LAMBDA,
0.0f, 10.0f);
@@ -188,6 +211,17 @@ static av_cold int encode_init(AVCodecContext *avctx)
avctx->bit_rate = s->header.bitrate + (avctx->channels == 2 ? 800 : 0);
}
+ /* VAD is activated with VBR or can be turned on by itself */
+ if (s->vad)
+ speex_encoder_ctl(s->enc_state, SPEEX_SET_VAD, &s->vad);
+
+ /* Activiting Discontinuous Transmission */
+ if (s->dtx) {
+ speex_encoder_ctl(s->enc_state, SPEEX_SET_DTX, &s->dtx);
+ if (!(s->abr || s->vad || s->header.vbr))
+ av_log(avctx, AV_LOG_WARNING, "DTX is not much of use without ABR, VAD or VBR\n");
+ }
+
/* set encoding complexity */
if (avctx->compression_level > FF_COMPRESSION_DEFAULT) {
complexity = av_clip(avctx->compression_level, 0, 10);
@@ -201,8 +235,8 @@ static av_cold int encode_init(AVCodecContext *avctx)
s->header.frames_per_packet = s->frames_per_packet;
/* set encoding delay */
- speex_encoder_ctl(s->enc_state, SPEEX_GET_LOOKAHEAD, &s->lookahead);
- s->next_pts = -s->lookahead;
+ speex_encoder_ctl(s->enc_state, SPEEX_GET_LOOKAHEAD, &avctx->delay);
+ ff_af_queue_init(avctx, &s->afq);
/* create header packet bytes from header struct */
/* note: libspeex allocates the memory for header_data, which is freed
@@ -211,13 +245,22 @@ static av_cold int encode_init(AVCodecContext *avctx)
/* allocate extradata and coded_frame */
avctx->extradata = av_malloc(header_size + FF_INPUT_BUFFER_PADDING_SIZE);
+ if (!avctx->extradata) {
+ speex_header_free(header_data);
+ speex_encoder_destroy(s->enc_state);
+ av_log(avctx, AV_LOG_ERROR, "memory allocation error\n");
+ return AVERROR(ENOMEM);
+ }
+#if FF_API_OLD_ENCODE_AUDIO
avctx->coded_frame = avcodec_alloc_frame();
- if (!avctx->extradata || !avctx->coded_frame) {
+ if (!avctx->coded_frame) {
+ av_freep(&avctx->extradata);
speex_header_free(header_data);
speex_encoder_destroy(s->enc_state);
av_log(avctx, AV_LOG_ERROR, "memory allocation error\n");
return AVERROR(ENOMEM);
}
+#endif
/* copy header packet to extradata */
memcpy(avctx->extradata, header_data, header_size);
@@ -231,19 +274,21 @@ static av_cold int encode_init(AVCodecContext *avctx)
return 0;
}
-static int encode_frame(AVCodecContext *avctx, uint8_t *frame, int buf_size,
- void *data)
+static int encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
+ const AVFrame *frame, int *got_packet_ptr)
{
LibSpeexEncContext *s = avctx->priv_data;
- int16_t *samples = data;
+ int16_t *samples = frame ? (int16_t *)frame->data[0] : NULL;
+ int ret;
- if (data) {
+ if (samples) {
/* encode Speex frame */
if (avctx->channels == 2)
speex_encode_stereo_int(samples, s->header.frame_size, &s->bits);
speex_encode_int(s->enc_state, samples, &s->bits);
s->pkt_frame_count++;
- s->pkt_sample_count += avctx->frame_size;
+ if ((ret = ff_af_queue_add(&s->afq, frame)) < 0)
+ return ret;
} else {
/* handle end-of-stream */
if (!s->pkt_frame_count)
@@ -258,19 +303,20 @@ static int encode_frame(AVCodecContext *avctx, uint8_t *frame, int buf_size,
/* write output if all frames for the packet have been encoded */
if (s->pkt_frame_count == s->frames_per_packet) {
s->pkt_frame_count = 0;
- avctx->coded_frame->pts =
- av_rescale_q(s->next_pts, (AVRational){ 1, avctx->sample_rate },
- avctx->time_base);
- s->next_pts += s->pkt_sample_count;
- s->pkt_sample_count = 0;
- if (buf_size > speex_bits_nbytes(&s->bits)) {
- int ret = speex_bits_write(&s->bits, frame, buf_size);
- speex_bits_reset(&s->bits);
+ if ((ret = ff_alloc_packet(avpkt, speex_bits_nbytes(&s->bits)))) {
+ av_log(avctx, AV_LOG_ERROR, "Error getting output packet\n");
return ret;
- } else {
- av_log(avctx, AV_LOG_ERROR, "output buffer too small");
- return AVERROR(EINVAL);
}
+ ret = speex_bits_write(&s->bits, avpkt->data, avpkt->size);
+ speex_bits_reset(&s->bits);
+
+ /* Get the next frame pts/duration */
+ ff_af_queue_remove(&s->afq, s->frames_per_packet * avctx->frame_size,
+ &avpkt->pts, &avpkt->duration);
+
+ avpkt->size = ret;
+ *got_packet_ptr = 1;
+ return 0;
}
return 0;
}
@@ -282,7 +328,10 @@ static av_cold int encode_close(AVCodecContext *avctx)
speex_bits_destroy(&s->bits);
speex_encoder_destroy(s->enc_state);
+ ff_af_queue_close(&s->afq);
+#if FF_API_OLD_ENCODE_AUDIO
av_freep(&avctx->coded_frame);
+#endif
av_freep(&avctx->extradata);
return 0;
@@ -291,9 +340,11 @@ static av_cold int encode_close(AVCodecContext *avctx)
#define OFFSET(x) offsetof(LibSpeexEncContext, x)
#define AE AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
static const AVOption options[] = {
- { "abr", "Use average bit rate", OFFSET(abr), AV_OPT_TYPE_INT, { 0 }, 0, 1, AE },
- { "cbr_quality", "Set quality value (0 to 10) for CBR", OFFSET(cbr_quality), AV_OPT_TYPE_INT, { 8 }, 0, 10, AE },
- { "frames_per_packet", "Number of frames to encode in each packet", OFFSET(frames_per_packet), AV_OPT_TYPE_INT, { 1 }, 1, 8, AE },
+ { "abr", "Use average bit rate", OFFSET(abr), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, AE },
+ { "cbr_quality", "Set quality value (0 to 10) for CBR", OFFSET(cbr_quality), AV_OPT_TYPE_INT, { .i64 = 8 }, 0, 10, AE },
+ { "frames_per_packet", "Number of frames to encode in each packet", OFFSET(frames_per_packet), AV_OPT_TYPE_INT, { .i64 = 1 }, 1, 8, AE },
+ { "vad", "Voice Activity Detection", OFFSET(vad), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, AE },
+ { "dtx", "Discontinuous Transmission", OFFSET(dtx), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, AE },
{ NULL },
};
@@ -313,13 +364,18 @@ static const AVCodecDefault defaults[] = {
AVCodec ff_libspeex_encoder = {
.name = "libspeex",
.type = AVMEDIA_TYPE_AUDIO,
- .id = CODEC_ID_SPEEX,
+ .id = AV_CODEC_ID_SPEEX,
.priv_data_size = sizeof(LibSpeexEncContext),
.init = encode_init,
- .encode = encode_frame,
+ .encode2 = encode_frame,
.close = encode_close,
.capabilities = CODEC_CAP_DELAY,
- .sample_fmts = (const enum SampleFormat[]){ AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_NONE },
+ .sample_fmts = (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_S16,
+ AV_SAMPLE_FMT_NONE },
+ .channel_layouts = (const uint64_t[]){ AV_CH_LAYOUT_MONO,
+ AV_CH_LAYOUT_STEREO,
+ 0 },
+ .supported_samplerates = (const int[]){ 8000, 16000, 32000, 0 },
.long_name = NULL_IF_CONFIG_SMALL("libspeex Speex"),
.priv_class = &class,
.defaults = defaults,
diff --git a/gst-libs/ext/libav/libavcodec/libtheoraenc.c b/gst-libs/ext/libav/libavcodec/libtheoraenc.c
index eccecea..f20fabb 100644
--- a/gst-libs/ext/libav/libavcodec/libtheoraenc.c
+++ b/gst-libs/ext/libav/libavcodec/libtheoraenc.c
@@ -31,10 +31,13 @@
*/
/* Libav includes */
+#include "libavutil/common.h"
#include "libavutil/intreadwrite.h"
+#include "libavutil/pixdesc.h"
#include "libavutil/log.h"
#include "libavutil/base64.h"
#include "avcodec.h"
+#include "internal.h"
/* libtheora includes */
#include <theora/theoraenc.h>
@@ -185,17 +188,18 @@ static av_cold int encode_init(AVCodecContext* avc_context)
else
t_info.colorspace = TH_CS_UNSPECIFIED;
- if (avc_context->pix_fmt == PIX_FMT_YUV420P)
+ if (avc_context->pix_fmt == AV_PIX_FMT_YUV420P)
t_info.pixel_fmt = TH_PF_420;
- else if (avc_context->pix_fmt == PIX_FMT_YUV422P)
+ else if (avc_context->pix_fmt == AV_PIX_FMT_YUV422P)
t_info.pixel_fmt = TH_PF_422;
- else if (avc_context->pix_fmt == PIX_FMT_YUV444P)
+ else if (avc_context->pix_fmt == AV_PIX_FMT_YUV444P)
t_info.pixel_fmt = TH_PF_444;
else {
av_log(avc_context, AV_LOG_ERROR, "Unsupported pix_fmt\n");
return -1;
}
- avcodec_get_chroma_sub_sample(avc_context->pix_fmt, &h->uv_hshift, &h->uv_vshift);
+ av_pix_fmt_get_chroma_sub_sample(avc_context->pix_fmt,
+ &h->uv_hshift, &h->uv_vshift);
if (avc_context->flags & CODEC_FLAG_QSCALE) {
/* to be constant with the libvorbis implementation, clip global_quality to 0 - 10
@@ -260,14 +264,13 @@ static av_cold int encode_init(AVCodecContext* avc_context)
return 0;
}
-static int encode_frame(AVCodecContext* avc_context, uint8_t *outbuf,
- int buf_size, void *data)
+static int encode_frame(AVCodecContext* avc_context, AVPacket *pkt,
+ const AVFrame *frame, int *got_packet)
{
th_ycbcr_buffer t_yuv_buffer;
TheoraContext *h = avc_context->priv_data;
- AVFrame *frame = data;
ogg_packet o_packet;
- int result, i;
+ int result, i, ret;
// EOS, finish and get 1st pass stats if applicable
if (!frame) {
@@ -328,18 +331,21 @@ static int encode_frame(AVCodecContext* avc_context, uint8_t *outbuf,
}
/* Copy ogg_packet content out to buffer */
- if (buf_size < o_packet.bytes) {
- av_log(avc_context, AV_LOG_ERROR, "encoded frame too large\n");
- return -1;
+ if ((ret = ff_alloc_packet(pkt, o_packet.bytes)) < 0) {
+ av_log(avc_context, AV_LOG_ERROR, "Error getting output packet of size %ld.\n", o_packet.bytes);
+ return ret;
}
- memcpy(outbuf, o_packet.packet, o_packet.bytes);
+ memcpy(pkt->data, o_packet.packet, o_packet.bytes);
// HACK: assumes no encoder delay, this is true until libtheora becomes
- // multithreaded (which will be disabled unless explictly requested)
- avc_context->coded_frame->pts = frame->pts;
+ // multithreaded (which will be disabled unless explicitly requested)
+ pkt->pts = pkt->dts = frame->pts;
avc_context->coded_frame->key_frame = !(o_packet.granulepos & h->keyframe_mask);
+ if (avc_context->coded_frame->key_frame)
+ pkt->flags |= AV_PKT_FLAG_KEY;
+ *got_packet = 1;
- return o_packet.bytes;
+ return 0;
}
static av_cold int encode_close(AVCodecContext* avc_context)
@@ -358,14 +364,16 @@ static av_cold int encode_close(AVCodecContext* avc_context)
/** AVCodec struct exposed to libavcodec */
AVCodec ff_libtheora_encoder = {
- .name = "libtheora",
- .type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_THEORA,
+ .name = "libtheora",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .id = AV_CODEC_ID_THEORA,
.priv_data_size = sizeof(TheoraContext),
- .init = encode_init,
- .close = encode_close,
- .encode = encode_frame,
- .capabilities = CODEC_CAP_DELAY, // needed to get the statsfile summary
- .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_YUV422P, PIX_FMT_YUV444P, PIX_FMT_NONE},
- .long_name = NULL_IF_CONFIG_SMALL("libtheora Theora"),
+ .init = encode_init,
+ .close = encode_close,
+ .encode2 = encode_frame,
+ .capabilities = CODEC_CAP_DELAY, // needed to get the statsfile summary
+ .pix_fmts = (const enum AVPixelFormat[]){
+ AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUV444P, AV_PIX_FMT_NONE
+ },
+ .long_name = NULL_IF_CONFIG_SMALL("libtheora Theora"),
};
diff --git a/gst-libs/ext/libav/libavcodec/libvo-aacenc.c b/gst-libs/ext/libav/libavcodec/libvo-aacenc.c
index 647971a..31822b5 100644
--- a/gst-libs/ext/libav/libavcodec/libvo-aacenc.c
+++ b/gst-libs/ext/libav/libavcodec/libvo-aacenc.c
@@ -23,23 +23,61 @@
#include <vo-aacenc/cmnMemory.h>
#include "avcodec.h"
+#include "audio_frame_queue.h"
+#include "internal.h"
#include "mpeg4audio.h"
+#define FRAME_SIZE 1024
+#define ENC_DELAY 1600
+
typedef struct AACContext {
VO_AUDIO_CODECAPI codec_api;
VO_HANDLE handle;
VO_MEM_OPERATOR mem_operator;
VO_CODEC_INIT_USERDATA user_data;
+ VO_PBYTE end_buffer;
+ AudioFrameQueue afq;
+ int last_frame;
+ int last_samples;
} AACContext;
+
+static int aac_encode_close(AVCodecContext *avctx)
+{
+ AACContext *s = avctx->priv_data;
+
+ s->codec_api.Uninit(s->handle);
+#if FF_API_OLD_ENCODE_AUDIO
+ av_freep(&avctx->coded_frame);
+#endif
+ av_freep(&avctx->extradata);
+ ff_af_queue_close(&s->afq);
+ av_freep(&s->end_buffer);
+
+ return 0;
+}
+
static av_cold int aac_encode_init(AVCodecContext *avctx)
{
AACContext *s = avctx->priv_data;
AACENC_PARAM params = { 0 };
- int index;
+ int index, ret;
+#if FF_API_OLD_ENCODE_AUDIO
avctx->coded_frame = avcodec_alloc_frame();
- avctx->frame_size = 1024;
+ if (!avctx->coded_frame)
+ return AVERROR(ENOMEM);
+#endif
+ avctx->frame_size = FRAME_SIZE;
+ avctx->delay = ENC_DELAY;
+ s->last_frame = 2;
+ ff_af_queue_init(avctx, &s->afq);
+
+ s->end_buffer = av_mallocz(avctx->frame_size * avctx->channels * 2);
+ if (!s->end_buffer) {
+ ret = AVERROR(ENOMEM);
+ goto error;
+ }
voGetAACEncAPI(&s->codec_api);
@@ -59,7 +97,8 @@ static av_cold int aac_encode_init(AVCodecContext *avctx)
if (s->codec_api.SetParam(s->handle, VO_PID_AAC_ENCPARAM, &params)
!= VO_ERR_NONE) {
av_log(avctx, AV_LOG_ERROR, "Unable to set encoding parameters\n");
- return AVERROR(EINVAL);
+ ret = AVERROR(EINVAL);
+ goto error;
}
for (index = 0; index < 16; index++)
@@ -68,43 +107,69 @@ static av_cold int aac_encode_init(AVCodecContext *avctx)
if (index == 16) {
av_log(avctx, AV_LOG_ERROR, "Unsupported sample rate %d\n",
avctx->sample_rate);
- return AVERROR(ENOSYS);
+ ret = AVERROR(ENOSYS);
+ goto error;
}
if (avctx->flags & CODEC_FLAG_GLOBAL_HEADER) {
avctx->extradata_size = 2;
avctx->extradata = av_mallocz(avctx->extradata_size +
FF_INPUT_BUFFER_PADDING_SIZE);
- if (!avctx->extradata)
- return AVERROR(ENOMEM);
+ if (!avctx->extradata) {
+ ret = AVERROR(ENOMEM);
+ goto error;
+ }
avctx->extradata[0] = 0x02 << 3 | index >> 1;
avctx->extradata[1] = (index & 0x01) << 7 | avctx->channels << 3;
}
return 0;
+error:
+ aac_encode_close(avctx);
+ return ret;
}
-static int aac_encode_close(AVCodecContext *avctx)
-{
- AACContext *s = avctx->priv_data;
-
- s->codec_api.Uninit(s->handle);
- av_freep(&avctx->coded_frame);
-
- return 0;
-}
-
-static int aac_encode_frame(AVCodecContext *avctx,
- unsigned char *frame/*out*/,
- int buf_size, void *data/*in*/)
+static int aac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
+ const AVFrame *frame, int *got_packet_ptr)
{
AACContext *s = avctx->priv_data;
VO_CODECBUFFER input = { 0 }, output = { 0 };
VO_AUDIO_OUTPUTINFO output_info = { { 0 } };
+ VO_PBYTE samples;
+ int ret;
+
+ /* handle end-of-stream small frame and flushing */
+ if (!frame) {
+ if (s->last_frame <= 0)
+ return 0;
+ if (s->last_samples > 0 && s->last_samples < ENC_DELAY - FRAME_SIZE) {
+ s->last_samples = 0;
+ s->last_frame--;
+ }
+ s->last_frame--;
+ memset(s->end_buffer, 0, 2 * avctx->channels * avctx->frame_size);
+ samples = s->end_buffer;
+ } else {
+ if (frame->nb_samples < avctx->frame_size) {
+ s->last_samples = frame->nb_samples;
+ memcpy(s->end_buffer, frame->data[0], 2 * avctx->channels * frame->nb_samples);
+ samples = s->end_buffer;
+ } else {
+ samples = (VO_PBYTE)frame->data[0];
+ }
+ /* add current frame to the queue */
+ if ((ret = ff_af_queue_add(&s->afq, frame)) < 0)
+ return ret;
+ }
+
+ if ((ret = ff_alloc_packet(avpkt, FFMAX(8192, 768 * avctx->channels)))) {
+ av_log(avctx, AV_LOG_ERROR, "Error getting output packet\n");
+ return ret;
+ }
- input.Buffer = data;
- input.Length = 2 * avctx->channels * avctx->frame_size;
- output.Buffer = frame;
- output.Length = buf_size;
+ input.Buffer = samples;
+ input.Length = 2 * avctx->channels * avctx->frame_size;
+ output.Buffer = avpkt->data;
+ output.Length = avpkt->size;
s->codec_api.SetInputData(s->handle, &input);
if (s->codec_api.GetOutputData(s->handle, &output, &output_info)
@@ -112,18 +177,26 @@ static int aac_encode_frame(AVCodecContext *avctx,
av_log(avctx, AV_LOG_ERROR, "Unable to encode frame\n");
return AVERROR(EINVAL);
}
- return output.Length;
+
+ /* Get the next frame pts/duration */
+ ff_af_queue_remove(&s->afq, avctx->frame_size, &avpkt->pts,
+ &avpkt->duration);
+
+ avpkt->size = output.Length;
+ *got_packet_ptr = 1;
+ return 0;
}
AVCodec ff_libvo_aacenc_encoder = {
.name = "libvo_aacenc",
.type = AVMEDIA_TYPE_AUDIO,
- .id = CODEC_ID_AAC,
+ .id = AV_CODEC_ID_AAC,
.priv_data_size = sizeof(AACContext),
.init = aac_encode_init,
- .encode = aac_encode_frame,
+ .encode2 = aac_encode_frame,
.close = aac_encode_close,
- .sample_fmts = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_NONE},
- .long_name = NULL_IF_CONFIG_SMALL("Android VisualOn AAC"),
+ .capabilities = CODEC_CAP_SMALL_LAST_FRAME | CODEC_CAP_DELAY,
+ .sample_fmts = (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_S16,
+ AV_SAMPLE_FMT_NONE },
+ .long_name = NULL_IF_CONFIG_SMALL("Android VisualOn AAC (Advanced Audio Coding)"),
};
-
diff --git a/gst-libs/ext/libav/libavcodec/libvo-amrwbenc.c b/gst-libs/ext/libav/libavcodec/libvo-amrwbenc.c
index f39317e..6502456 100644
--- a/gst-libs/ext/libav/libavcodec/libvo-amrwbenc.c
+++ b/gst-libs/ext/libav/libavcodec/libvo-amrwbenc.c
@@ -20,10 +20,17 @@
*/
#include <vo-amrwbenc/enc_if.h>
+#include <stdio.h>
+#include <stdlib.h>
-#include "avcodec.h"
#include "libavutil/avstring.h"
+#include "libavutil/internal.h"
+#include "libavutil/mem.h"
#include "libavutil/opt.h"
+#include "avcodec.h"
+#include "internal.h"
+
+#define MAX_PACKET_SIZE (1 + (477 + 7) / 8)
typedef struct AMRWBContext {
AVClass *av_class;
@@ -34,7 +41,7 @@ typedef struct AMRWBContext {
} AMRWBContext;
static const AVOption options[] = {
- { "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 },
+ { "dtx", "Allow DTX (generate comfort noise)", offsetof(AMRWBContext, allow_dtx), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM },
{ NULL }
};
@@ -86,7 +93,12 @@ static av_cold int amr_wb_encode_init(AVCodecContext *avctx)
s->last_bitrate = avctx->bit_rate;
avctx->frame_size = 320;
+ avctx->delay = 80;
+#if FF_API_OLD_ENCODE_AUDIO
avctx->coded_frame = avcodec_alloc_frame();
+ if (!avctx->coded_frame)
+ return AVERROR(ENOMEM);
+#endif
s->state = E_IF_init();
@@ -102,32 +114,47 @@ static int amr_wb_encode_close(AVCodecContext *avctx)
return 0;
}
-static int amr_wb_encode_frame(AVCodecContext *avctx,
- unsigned char *frame/*out*/,
- int buf_size, void *data/*in*/)
+static int amr_wb_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
+ const AVFrame *frame, int *got_packet_ptr)
{
AMRWBContext *s = avctx->priv_data;
- int size;
+ const int16_t *samples = (const int16_t *)frame->data[0];
+ int size, ret;
+
+ if ((ret = ff_alloc_packet(avpkt, MAX_PACKET_SIZE))) {
+ av_log(avctx, AV_LOG_ERROR, "Error getting output packet\n");
+ return ret;
+ }
if (s->last_bitrate != avctx->bit_rate) {
s->mode = get_wb_bitrate_mode(avctx->bit_rate, avctx);
s->last_bitrate = avctx->bit_rate;
}
- size = E_IF_encode(s->state, s->mode, data, frame, s->allow_dtx);
- return size;
+ size = E_IF_encode(s->state, s->mode, samples, avpkt->data, s->allow_dtx);
+ if (size <= 0 || size > MAX_PACKET_SIZE) {
+ av_log(avctx, AV_LOG_ERROR, "Error encoding frame\n");
+ return AVERROR(EINVAL);
+ }
+
+ if (frame->pts != AV_NOPTS_VALUE)
+ avpkt->pts = frame->pts - ff_samples_to_time_base(avctx, avctx->delay);
+
+ avpkt->size = size;
+ *got_packet_ptr = 1;
+ return 0;
}
AVCodec ff_libvo_amrwbenc_encoder = {
.name = "libvo_amrwbenc",
.type = AVMEDIA_TYPE_AUDIO,
- .id = CODEC_ID_AMR_WB,
+ .id = AV_CODEC_ID_AMR_WB,
.priv_data_size = sizeof(AMRWBContext),
.init = amr_wb_encode_init,
- .encode = amr_wb_encode_frame,
+ .encode2 = amr_wb_encode_frame,
.close = amr_wb_encode_close,
- .sample_fmts = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_NONE},
- .long_name = NULL_IF_CONFIG_SMALL("Android VisualOn Adaptive Multi-Rate "
- "(AMR) Wide-Band"),
- .priv_class = &class,
+ .sample_fmts = (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_S16,
+ AV_SAMPLE_FMT_NONE },
+ .long_name = NULL_IF_CONFIG_SMALL("Android VisualOn AMR-WB "
+ "(Adaptive Multi-Rate Wide-Band)"),
+ .priv_class = &class,
};
-
diff --git a/gst-libs/ext/libav/libavcodec/libvorbis.c b/gst-libs/ext/libav/libavcodec/libvorbis.c
index 60235d7..092cbbc 100644
--- a/gst-libs/ext/libav/libavcodec/libvorbis.c
+++ b/gst-libs/ext/libav/libavcodec/libvorbis.c
@@ -20,40 +20,46 @@
/**
* @file
- * Ogg Vorbis codec support via libvorbisenc.
+ * Vorbis encoding support via libvorbisenc.
* @author Mark Hills <mark@pogo.org.uk>
*/
#include <vorbis/vorbisenc.h>
+#include "libavutil/fifo.h"
#include "libavutil/opt.h"
#include "avcodec.h"
+#include "audio_frame_queue.h"
#include "bytestream.h"
#include "internal.h"
#include "vorbis.h"
-#include "libavutil/mathematics.h"
+#include "vorbis_parser.h"
#undef NDEBUG
#include <assert.h>
+/* Number of samples the user should send in each call.
+ * This value is used because it is the LCD of all possible frame sizes, so
+ * an output packet will always start at the same point as one of the input
+ * packets.
+ */
#define OGGVORBIS_FRAME_SIZE 64
#define BUFFER_SIZE (1024 * 64)
typedef struct OggVorbisContext {
- AVClass *av_class;
- vorbis_info vi;
- vorbis_dsp_state vd;
- vorbis_block vb;
- uint8_t buffer[BUFFER_SIZE];
- int buffer_index;
- int eof;
-
- /* decoder */
- vorbis_comment vc;
- ogg_packet op;
-
- double iblock;
+ AVClass *av_class; /**< class for AVOptions */
+ vorbis_info vi; /**< vorbis_info used during init */
+ vorbis_dsp_state vd; /**< DSP state used for analysis */
+ vorbis_block vb; /**< vorbis_block used for analysis */
+ AVFifoBuffer *pkt_fifo; /**< output packet buffer */
+ int eof; /**< end-of-file flag */
+ int dsp_initialized; /**< vd has been initialized */
+ vorbis_comment vc; /**< VorbisComment info */
+ ogg_packet op; /**< ogg packet */
+ double iblock; /**< impulse block bias option */
+ VorbisParseContext vp; /**< parse context to get durations */
+ AudioFrameQueue afq; /**< frame queue for timestamps */
} OggVorbisContext;
static const AVOption options[] = {
@@ -68,52 +74,72 @@ static const AVCodecDefault defaults[] = {
static const AVClass class = { "libvorbis", av_default_item_name, options, LIBAVUTIL_VERSION_INT };
-static av_cold int oggvorbis_init_encoder(vorbis_info *vi, AVCodecContext *avccontext)
+
+static int vorbis_error_to_averror(int ov_err)
{
- OggVorbisContext *context = avccontext->priv_data;
+ switch (ov_err) {
+ case OV_EFAULT: return AVERROR_BUG;
+ case OV_EINVAL: return AVERROR(EINVAL);
+ case OV_EIMPL: return AVERROR(EINVAL);
+ default: return AVERROR_UNKNOWN;
+ }
+}
+
+static av_cold int oggvorbis_init_encoder(vorbis_info *vi,
+ AVCodecContext *avctx)
+{
+ OggVorbisContext *s = avctx->priv_data;
double cfreq;
+ int ret;
- if (avccontext->flags & CODEC_FLAG_QSCALE || !avccontext->bit_rate) {
+ if (avctx->flags & CODEC_FLAG_QSCALE || !avctx->bit_rate) {
/* variable bitrate
* NOTE: we use the oggenc range of -1 to 10 for global_quality for
* user convenience, but libvorbis uses -0.1 to 1.0.
*/
- float q = avccontext->global_quality / (float)FF_QP2LAMBDA;
+ float q = avctx->global_quality / (float)FF_QP2LAMBDA;
/* default to 3 if the user did not set quality or bitrate */
- if (!(avccontext->flags & CODEC_FLAG_QSCALE))
+ if (!(avctx->flags & CODEC_FLAG_QSCALE))
q = 3.0;
- if (vorbis_encode_setup_vbr(vi, avccontext->channels,
- avccontext->sample_rate,
- q / 10.0))
- return -1;
+ if ((ret = vorbis_encode_setup_vbr(vi, avctx->channels,
+ avctx->sample_rate,
+ q / 10.0)))
+ goto error;
} else {
- int minrate = avccontext->rc_min_rate > 0 ? avccontext->rc_min_rate : -1;
- int maxrate = avccontext->rc_max_rate > 0 ? avccontext->rc_max_rate : -1;
+ int minrate = avctx->rc_min_rate > 0 ? avctx->rc_min_rate : -1;
+ int maxrate = avctx->rc_max_rate > 0 ? avctx->rc_max_rate : -1;
- /* constant bitrate */
- if (vorbis_encode_setup_managed(vi, avccontext->channels,
- avccontext->sample_rate, maxrate,
- avccontext->bit_rate, minrate))
- return -1;
+ /* average bitrate */
+ if ((ret = vorbis_encode_setup_managed(vi, avctx->channels,
+ avctx->sample_rate, maxrate,
+ avctx->bit_rate, minrate)))
+ goto error;
/* variable bitrate by estimate, disable slow rate management */
if (minrate == -1 && maxrate == -1)
- if (vorbis_encode_ctl(vi, OV_ECTL_RATEMANAGE2_SET, NULL))
- return -1;
+ if ((ret = vorbis_encode_ctl(vi, OV_ECTL_RATEMANAGE2_SET, NULL)))
+ goto error;
}
/* cutoff frequency */
- if (avccontext->cutoff > 0) {
- cfreq = avccontext->cutoff / 1000.0;
- if (vorbis_encode_ctl(vi, OV_ECTL_LOWPASS_SET, &cfreq))
- return -1;
+ if (avctx->cutoff > 0) {
+ cfreq = avctx->cutoff / 1000.0;
+ if ((ret = vorbis_encode_ctl(vi, OV_ECTL_LOWPASS_SET, &cfreq)))
+ goto error;
}
- if (context->iblock) {
- vorbis_encode_ctl(vi, OV_ECTL_IBLOCK_SET, &context->iblock);
+ /* impulse block bias */
+ if (s->iblock) {
+ if ((ret = vorbis_encode_ctl(vi, OV_ECTL_IBLOCK_SET, &s->iblock)))
+ goto error;
}
- return vorbis_encode_setup_init(vi);
+ if ((ret = vorbis_encode_setup_init(vi)))
+ goto error;
+
+ return 0;
+error:
+ return vorbis_error_to_averror(ret);
}
/* How many bytes are needed for a buffer of length 'l' */
@@ -122,32 +148,71 @@ static int xiph_len(int l)
return 1 + l / 255 + l;
}
-static av_cold int oggvorbis_encode_init(AVCodecContext *avccontext)
+static av_cold int oggvorbis_encode_close(AVCodecContext *avctx)
+{
+ OggVorbisContext *s = avctx->priv_data;
+
+ /* notify vorbisenc this is EOF */
+ if (s->dsp_initialized)
+ vorbis_analysis_wrote(&s->vd, 0);
+
+ vorbis_block_clear(&s->vb);
+ vorbis_dsp_clear(&s->vd);
+ vorbis_info_clear(&s->vi);
+
+ av_fifo_free(s->pkt_fifo);
+ ff_af_queue_close(&s->afq);
+#if FF_API_OLD_ENCODE_AUDIO
+ av_freep(&avctx->coded_frame);
+#endif
+ av_freep(&avctx->extradata);
+
+ return 0;
+}
+
+static av_cold int oggvorbis_encode_init(AVCodecContext *avctx)
{
- OggVorbisContext *context = avccontext->priv_data;
+ OggVorbisContext *s = avctx->priv_data;
ogg_packet header, header_comm, header_code;
uint8_t *p;
unsigned int offset;
+ int ret;
- vorbis_info_init(&context->vi);
- if (oggvorbis_init_encoder(&context->vi, avccontext) < 0) {
- av_log(avccontext, AV_LOG_ERROR, "oggvorbis_encode_init: init_encoder failed\n");
- return -1;
+ vorbis_info_init(&s->vi);
+ if ((ret = oggvorbis_init_encoder(&s->vi, avctx))) {
+ av_log(avctx, AV_LOG_ERROR, "encoder setup failed\n");
+ goto error;
+ }
+ if ((ret = vorbis_analysis_init(&s->vd, &s->vi))) {
+ av_log(avctx, AV_LOG_ERROR, "analysis init failed\n");
+ ret = vorbis_error_to_averror(ret);
+ goto error;
+ }
+ s->dsp_initialized = 1;
+ if ((ret = vorbis_block_init(&s->vd, &s->vb))) {
+ av_log(avctx, AV_LOG_ERROR, "dsp init failed\n");
+ ret = vorbis_error_to_averror(ret);
+ goto error;
}
- vorbis_analysis_init(&context->vd, &context->vi);
- vorbis_block_init(&context->vd, &context->vb);
- vorbis_comment_init(&context->vc);
- vorbis_comment_add_tag(&context->vc, "encoder", LIBAVCODEC_IDENT);
+ vorbis_comment_init(&s->vc);
+ vorbis_comment_add_tag(&s->vc, "encoder", LIBAVCODEC_IDENT);
- vorbis_analysis_headerout(&context->vd, &context->vc, &header,
- &header_comm, &header_code);
+ if ((ret = vorbis_analysis_headerout(&s->vd, &s->vc, &header, &header_comm,
+ &header_code))) {
+ ret = vorbis_error_to_averror(ret);
+ goto error;
+ }
- avccontext->extradata_size =
- 1 + xiph_len(header.bytes) + xiph_len(header_comm.bytes) +
- header_code.bytes;
- p = avccontext->extradata =
- av_malloc(avccontext->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
+ avctx->extradata_size = 1 + xiph_len(header.bytes) +
+ xiph_len(header_comm.bytes) +
+ header_code.bytes;
+ p = avctx->extradata = av_malloc(avctx->extradata_size +
+ FF_INPUT_BUFFER_PADDING_SIZE);
+ if (!p) {
+ ret = AVERROR(ENOMEM);
+ goto error;
+ }
p[0] = 2;
offset = 1;
offset += av_xiphlacing(&p[offset], header.bytes);
@@ -158,122 +223,140 @@ static av_cold int oggvorbis_encode_init(AVCodecContext *avccontext)
offset += header_comm.bytes;
memcpy(&p[offset], header_code.packet, header_code.bytes);
offset += header_code.bytes;
- assert(offset == avccontext->extradata_size);
+ assert(offset == avctx->extradata_size);
-#if 0
- vorbis_block_clear(&context->vb);
- vorbis_dsp_clear(&context->vd);
- vorbis_info_clear(&context->vi);
-#endif
- vorbis_comment_clear(&context->vc);
+ if ((ret = avpriv_vorbis_parse_extradata(avctx, &s->vp)) < 0) {
+ av_log(avctx, AV_LOG_ERROR, "invalid extradata\n");
+ return ret;
+ }
- avccontext->frame_size = OGGVORBIS_FRAME_SIZE;
+ vorbis_comment_clear(&s->vc);
- avccontext->coded_frame = avcodec_alloc_frame();
- avccontext->coded_frame->key_frame = 1;
+ avctx->frame_size = OGGVORBIS_FRAME_SIZE;
+ ff_af_queue_init(avctx, &s->afq);
+
+ s->pkt_fifo = av_fifo_alloc(BUFFER_SIZE);
+ if (!s->pkt_fifo) {
+ ret = AVERROR(ENOMEM);
+ goto error;
+ }
+
+#if FF_API_OLD_ENCODE_AUDIO
+ avctx->coded_frame = avcodec_alloc_frame();
+ if (!avctx->coded_frame) {
+ ret = AVERROR(ENOMEM);
+ goto error;
+ }
+#endif
return 0;
+error:
+ oggvorbis_encode_close(avctx);
+ return ret;
}
-static int oggvorbis_encode_frame(AVCodecContext *avccontext,
- unsigned char *packets,
- int buf_size, void *data)
+static int oggvorbis_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
+ const AVFrame *frame, int *got_packet_ptr)
{
- OggVorbisContext *context = avccontext->priv_data;
+ OggVorbisContext *s = avctx->priv_data;
ogg_packet op;
- signed short *audio = data;
- int l;
+ int ret, duration;
- if (data) {
- const int samples = avccontext->frame_size;
+ /* send samples to libvorbis */
+ if (frame) {
+ const int samples = frame->nb_samples;
float **buffer;
- int c, channels = context->vi.channels;
+ int c, channels = s->vi.channels;
- buffer = vorbis_analysis_buffer(&context->vd, samples);
+ buffer = vorbis_analysis_buffer(&s->vd, samples);
for (c = 0; c < channels; c++) {
int co = (channels > 8) ? c :
ff_vorbis_encoding_channel_layout_offsets[channels - 1][c];
- for (l = 0; l < samples; l++)
- buffer[c][l] = audio[l * channels + co] / 32768.f;
+ memcpy(buffer[c], frame->extended_data[co],
+ samples * sizeof(*buffer[c]));
+ }
+ if ((ret = vorbis_analysis_wrote(&s->vd, samples)) < 0) {
+ av_log(avctx, AV_LOG_ERROR, "error in vorbis_analysis_wrote()\n");
+ return vorbis_error_to_averror(ret);
}
- vorbis_analysis_wrote(&context->vd, samples);
+ if ((ret = ff_af_queue_add(&s->afq, frame)) < 0)
+ return ret;
} else {
- if (!context->eof)
- vorbis_analysis_wrote(&context->vd, 0);
- context->eof = 1;
+ if (!s->eof)
+ if ((ret = vorbis_analysis_wrote(&s->vd, 0)) < 0) {
+ av_log(avctx, AV_LOG_ERROR, "error in vorbis_analysis_wrote()\n");
+ return vorbis_error_to_averror(ret);
+ }
+ s->eof = 1;
}
- while (vorbis_analysis_blockout(&context->vd, &context->vb) == 1) {
- vorbis_analysis(&context->vb, NULL);
- vorbis_bitrate_addblock(&context->vb);
-
- while (vorbis_bitrate_flushpacket(&context->vd, &op)) {
- /* i'd love to say the following line is a hack, but sadly it's
- * not, apparently the end of stream decision is in libogg. */
- if (op.bytes == 1 && op.e_o_s)
- continue;
- if (context->buffer_index + sizeof(ogg_packet) + op.bytes > BUFFER_SIZE) {
- av_log(avccontext, AV_LOG_ERROR, "libvorbis: buffer overflow.");
- return -1;
+ /* retrieve available packets from libvorbis */
+ while ((ret = vorbis_analysis_blockout(&s->vd, &s->vb)) == 1) {
+ if ((ret = vorbis_analysis(&s->vb, NULL)) < 0)
+ break;
+ if ((ret = vorbis_bitrate_addblock(&s->vb)) < 0)
+ break;
+
+ /* add any available packets to the output packet buffer */
+ while ((ret = vorbis_bitrate_flushpacket(&s->vd, &op)) == 1) {
+ if (av_fifo_space(s->pkt_fifo) < sizeof(ogg_packet) + op.bytes) {
+ av_log(avctx, AV_LOG_ERROR, "packet buffer is too small");
+ return AVERROR_BUG;
}
- memcpy(context->buffer + context->buffer_index, &op, sizeof(ogg_packet));
- context->buffer_index += sizeof(ogg_packet);
- memcpy(context->buffer + context->buffer_index, op.packet, op.bytes);
- context->buffer_index += op.bytes;
-// av_log(avccontext, AV_LOG_DEBUG, "e%d / %d\n", context->buffer_index, op.bytes);
+ av_fifo_generic_write(s->pkt_fifo, &op, sizeof(ogg_packet), NULL);
+ av_fifo_generic_write(s->pkt_fifo, op.packet, op.bytes, NULL);
+ }
+ if (ret < 0) {
+ av_log(avctx, AV_LOG_ERROR, "error getting available packets\n");
+ break;
}
}
+ if (ret < 0) {
+ av_log(avctx, AV_LOG_ERROR, "error getting available packets\n");
+ return vorbis_error_to_averror(ret);
+ }
- l = 0;
- if (context->buffer_index) {
- ogg_packet *op2 = (ogg_packet *)context->buffer;
- op2->packet = context->buffer + sizeof(ogg_packet);
+ /* check for available packets */
+ if (av_fifo_size(s->pkt_fifo) < sizeof(ogg_packet))
+ return 0;
- l = op2->bytes;
- avccontext->coded_frame->pts = av_rescale_q(op2->granulepos, (AVRational) { 1, avccontext->sample_rate }, avccontext->time_base);
- //FIXME we should reorder the user supplied pts and not assume that they are spaced by 1/sample_rate
+ av_fifo_generic_read(s->pkt_fifo, &op, sizeof(ogg_packet), NULL);
- if (l > buf_size) {
- av_log(avccontext, AV_LOG_ERROR, "libvorbis: buffer overflow.");
- return -1;
+ if ((ret = ff_alloc_packet(avpkt, op.bytes))) {
+ av_log(avctx, AV_LOG_ERROR, "Error getting output packet\n");
+ return ret;
+ }
+ av_fifo_generic_read(s->pkt_fifo, avpkt->data, op.bytes, NULL);
+
+ avpkt->pts = ff_samples_to_time_base(avctx, op.granulepos);
+
+ duration = avpriv_vorbis_parse_frame(&s->vp, avpkt->data, avpkt->size);
+ if (duration > 0) {
+ /* we do not know encoder delay until we get the first packet from
+ * libvorbis, so we have to update the AudioFrameQueue counts */
+ if (!avctx->delay) {
+ avctx->delay = duration;
+ s->afq.remaining_delay += duration;
+ s->afq.remaining_samples += duration;
}
-
- memcpy(packets, op2->packet, l);
- context->buffer_index -= l + sizeof(ogg_packet);
- memmove(context->buffer, context->buffer + l + sizeof(ogg_packet), context->buffer_index);
-// av_log(avccontext, AV_LOG_DEBUG, "E%d\n", l);
+ ff_af_queue_remove(&s->afq, duration, &avpkt->pts, &avpkt->duration);
}
- return l;
-}
-
-static av_cold int oggvorbis_encode_close(AVCodecContext *avccontext)
-{
- OggVorbisContext *context = avccontext->priv_data;
-/* ogg_packet op ; */
-
- vorbis_analysis_wrote(&context->vd, 0); /* notify vorbisenc this is EOF */
-
- vorbis_block_clear(&context->vb);
- vorbis_dsp_clear(&context->vd);
- vorbis_info_clear(&context->vi);
-
- av_freep(&avccontext->coded_frame);
- av_freep(&avccontext->extradata);
-
+ *got_packet_ptr = 1;
return 0;
}
AVCodec ff_libvorbis_encoder = {
.name = "libvorbis",
.type = AVMEDIA_TYPE_AUDIO,
- .id = CODEC_ID_VORBIS,
+ .id = AV_CODEC_ID_VORBIS,
.priv_data_size = sizeof(OggVorbisContext),
.init = oggvorbis_encode_init,
- .encode = oggvorbis_encode_frame,
+ .encode2 = oggvorbis_encode_frame,
.close = oggvorbis_encode_close,
.capabilities = CODEC_CAP_DELAY,
- .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_NONE },
+ .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP,
+ AV_SAMPLE_FMT_NONE },
.long_name = NULL_IF_CONFIG_SMALL("libvorbis Vorbis"),
.priv_class = &class,
.defaults = defaults,
diff --git a/gst-libs/ext/libav/libavcodec/libvpxdec.c b/gst-libs/ext/libav/libavcodec/libvpxdec.c
index 917a502..6419e28 100644
--- a/gst-libs/ext/libav/libavcodec/libvpxdec.c
+++ b/gst-libs/ext/libav/libavcodec/libvpxdec.c
@@ -27,6 +27,7 @@
#include <vpx/vpx_decoder.h>
#include <vpx/vp8dx.h>
+#include "libavutil/common.h"
#include "libavutil/imgutils.h"
#include "avcodec.h"
@@ -53,12 +54,12 @@ static av_cold int vp8_init(AVCodecContext *avctx)
return AVERROR(EINVAL);
}
- avctx->pix_fmt = PIX_FMT_YUV420P;
+ avctx->pix_fmt = AV_PIX_FMT_YUV420P;
return 0;
}
static int vp8_decode(AVCodecContext *avctx,
- void *data, int *data_size, AVPacket *avpkt)
+ void *data, int *got_frame, AVPacket *avpkt)
{
VP8Context *ctx = avctx->priv_data;
AVFrame *picture = data;
@@ -99,7 +100,7 @@ static int vp8_decode(AVCodecContext *avctx,
picture->linesize[1] = img->stride[1];
picture->linesize[2] = img->stride[2];
picture->linesize[3] = 0;
- *data_size = sizeof(AVPicture);
+ *got_frame = 1;
}
return avpkt->size;
}
@@ -114,7 +115,7 @@ static av_cold int vp8_free(AVCodecContext *avctx)
AVCodec ff_libvpx_decoder = {
.name = "libvpx",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_VP8,
+ .id = AV_CODEC_ID_VP8,
.priv_data_size = sizeof(VP8Context),
.init = vp8_init,
.close = vp8_free,
diff --git a/gst-libs/ext/libav/libavcodec/libvpxenc.c b/gst-libs/ext/libav/libavcodec/libvpxenc.c
index 64ff2c1..17b9800 100644
--- a/gst-libs/ext/libav/libavcodec/libvpxenc.c
+++ b/gst-libs/ext/libav/libavcodec/libvpxenc.c
@@ -31,6 +31,7 @@
#include "avcodec.h"
#include "internal.h"
#include "libavutil/base64.h"
+#include "libavutil/common.h"
#include "libavutil/mathematics.h"
#include "libavutil/opt.h"
@@ -63,10 +64,11 @@ typedef struct VP8EncoderContext {
int arnr_type;
int lag_in_frames;
int error_resilient;
+ int crf;
} VP8Context;
/** String mappings for enum vp8e_enc_control_id */
-static const char *ctlidstr[] = {
+static const char *const ctlidstr[] = {
[VP8E_UPD_ENTROPY] = "VP8E_UPD_ENTROPY",
[VP8E_UPD_REFERENCE] = "VP8E_UPD_REFERENCE",
[VP8E_USE_REFERENCE] = "VP8E_USE_REFERENCE",
@@ -83,6 +85,7 @@ static const char *ctlidstr[] = {
[VP8E_SET_ARNR_MAXFRAMES] = "VP8E_SET_ARNR_MAXFRAMES",
[VP8E_SET_ARNR_STRENGTH] = "VP8E_SET_ARNR_STRENGTH",
[VP8E_SET_ARNR_TYPE] = "VP8E_SET_ARNR_TYPE",
+ [VP8E_SET_CQ_LEVEL] = "VP8E_SET_CQ_LEVEL",
};
static av_cold void log_encoder_error(AVCodecContext *avctx, const char *desc)
@@ -244,11 +247,18 @@ static av_cold int vp8_init(AVCodecContext *avctx)
else
enccfg.g_pass = VPX_RC_ONE_PASS;
- if (avctx->rc_min_rate == avctx->rc_max_rate &&
- avctx->rc_min_rate == avctx->bit_rate)
- enccfg.rc_end_usage = VPX_CBR;
- enccfg.rc_target_bitrate = av_rescale_rnd(avctx->bit_rate, 1, 1000,
+ if (!avctx->bit_rate)
+ avctx->bit_rate = enccfg.rc_target_bitrate * 1000;
+ else
+ enccfg.rc_target_bitrate = av_rescale_rnd(avctx->bit_rate, 1, 1000,
AV_ROUND_NEAR_INF);
+
+ if (ctx->crf)
+ enccfg.rc_end_usage = VPX_CQ;
+ else if (avctx->rc_min_rate == avctx->rc_max_rate &&
+ avctx->rc_min_rate == avctx->bit_rate)
+ enccfg.rc_end_usage = VPX_CBR;
+
if (avctx->qmin > 0)
enccfg.rc_min_quantizer = avctx->qmin;
if (avctx->qmax > 0)
@@ -337,6 +347,7 @@ static av_cold int vp8_init(AVCodecContext *avctx)
codecctl_int(avctx, VP8E_SET_NOISE_SENSITIVITY, avctx->noise_reduction);
codecctl_int(avctx, VP8E_SET_TOKEN_PARTITIONS, av_log2(avctx->slices));
codecctl_int(avctx, VP8E_SET_STATIC_THRESHOLD, avctx->mb_threshold);
+ codecctl_int(avctx, VP8E_SET_CQ_LEVEL, ctx->crf);
//provide dummy value to initialize wrapper, values will be updated each _encode()
vpx_img_wrap(&ctx->rawimg, VPX_IMG_FMT_I420, avctx->width, avctx->height, 1,
@@ -362,33 +373,33 @@ static inline void cx_pktcpy(struct FrameListData *dst,
}
/**
- * Store coded frame information in format suitable for return from encode().
+ * Store coded frame information in format suitable for return from encode2().
*
- * Write buffer information from @a cx_frame to @a buf & @a buf_size.
- * Timing/frame details to @a coded_frame.
- * @return Frame size written to @a buf on success
- * @return AVERROR(EINVAL) on error
+ * Write information from @a cx_frame to @a pkt
+ * @return packet data size on success
+ * @return a negative AVERROR on error
*/
static int storeframe(AVCodecContext *avctx, struct FrameListData *cx_frame,
- uint8_t *buf, int buf_size, AVFrame *coded_frame)
+ AVPacket *pkt, AVFrame *coded_frame)
{
- if ((int) cx_frame->sz <= buf_size) {
- buf_size = cx_frame->sz;
- memcpy(buf, cx_frame->buf, buf_size);
+ int ret = ff_alloc_packet(pkt, cx_frame->sz);
+ if (ret >= 0) {
+ memcpy(pkt->data, cx_frame->buf, pkt->size);
+ pkt->pts = pkt->dts = cx_frame->pts;
coded_frame->pts = cx_frame->pts;
coded_frame->key_frame = !!(cx_frame->flags & VPX_FRAME_IS_KEY);
- if (coded_frame->key_frame)
+ if (coded_frame->key_frame) {
coded_frame->pict_type = AV_PICTURE_TYPE_I;
- else
+ pkt->flags |= AV_PKT_FLAG_KEY;
+ } else
coded_frame->pict_type = AV_PICTURE_TYPE_P;
} else {
av_log(avctx, AV_LOG_ERROR,
- "Compressed frame larger than storage provided! (%zu/%d)\n",
- cx_frame->sz, buf_size);
- return AVERROR(EINVAL);
+ "Error getting output packet of size %zu.\n", cx_frame->sz);
+ return ret;
}
- return buf_size;
+ return pkt->size;
}
/**
@@ -399,7 +410,7 @@ static int storeframe(AVCodecContext *avctx, struct FrameListData *cx_frame,
* @return AVERROR(EINVAL) on output size error
* @return AVERROR(ENOMEM) on coded frame queue data allocation error
*/
-static int queue_frames(AVCodecContext *avctx, uint8_t *buf, int buf_size,
+static int queue_frames(AVCodecContext *avctx, AVPacket *pkt_out,
AVFrame *coded_frame)
{
VP8Context *ctx = avctx->priv_data;
@@ -410,9 +421,9 @@ static int queue_frames(AVCodecContext *avctx, uint8_t *buf, int buf_size,
if (ctx->coded_frame_list) {
struct FrameListData *cx_frame = ctx->coded_frame_list;
/* return the leading frame if we've already begun queueing */
- size = storeframe(avctx, cx_frame, buf, buf_size, coded_frame);
+ size = storeframe(avctx, cx_frame, pkt_out, coded_frame);
if (size < 0)
- return AVERROR(EINVAL);
+ return size;
ctx->coded_frame_list = cx_frame->next;
free_coded_frame(cx_frame);
}
@@ -429,9 +440,9 @@ static int queue_frames(AVCodecContext *avctx, uint8_t *buf, int buf_size,
provided a frame for output */
assert(!ctx->coded_frame_list);
cx_pktcpy(&cx_frame, pkt);
- size = storeframe(avctx, &cx_frame, buf, buf_size, coded_frame);
+ size = storeframe(avctx, &cx_frame, pkt_out, coded_frame);
if (size < 0)
- return AVERROR(EINVAL);
+ return size;
} else {
struct FrameListData *cx_frame =
av_malloc(sizeof(struct FrameListData));
@@ -477,14 +488,14 @@ static int queue_frames(AVCodecContext *avctx, uint8_t *buf, int buf_size,
return size;
}
-static int vp8_encode(AVCodecContext *avctx, uint8_t *buf, int buf_size,
- void *data)
+static int vp8_encode(AVCodecContext *avctx, AVPacket *pkt,
+ const AVFrame *frame, int *got_packet)
{
VP8Context *ctx = avctx->priv_data;
- AVFrame *frame = data;
struct vpx_image *rawimg = NULL;
int64_t timestamp = 0;
int res, coded_size;
+ vpx_enc_frame_flags_t flags = 0;
if (frame) {
rawimg = &ctx->rawimg;
@@ -495,15 +506,17 @@ static int vp8_encode(AVCodecContext *avctx, uint8_t *buf, int buf_size,
rawimg->stride[VPX_PLANE_U] = frame->linesize[1];
rawimg->stride[VPX_PLANE_V] = frame->linesize[2];
timestamp = frame->pts;
+ if (frame->pict_type == AV_PICTURE_TYPE_I)
+ flags |= VPX_EFLAG_FORCE_KF;
}
res = vpx_codec_encode(&ctx->encoder, rawimg, timestamp,
- avctx->ticks_per_frame, 0, ctx->deadline);
+ avctx->ticks_per_frame, flags, ctx->deadline);
if (res != VPX_CODEC_OK) {
log_encoder_error(avctx, "Error encoding frame");
return AVERROR_INVALIDDATA;
}
- coded_size = queue_frames(avctx, buf, buf_size, avctx->coded_frame);
+ coded_size = queue_frames(avctx, pkt, avctx->coded_frame);
if (!frame && avctx->flags & CODEC_FLAG_PASS1) {
unsigned int b64_size = AV_BASE64_SIZE(ctx->twopass_stats.sz);
@@ -517,35 +530,38 @@ static int vp8_encode(AVCodecContext *avctx, uint8_t *buf, int buf_size,
av_base64_encode(avctx->stats_out, b64_size, ctx->twopass_stats.buf,
ctx->twopass_stats.sz);
}
- return coded_size;
+
+ *got_packet = !!coded_size;
+ return 0;
}
#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), AV_OPT_TYPE_INT, {INT_MIN}, INT_MIN, INT_MAX, VE},
+ { "cpu-used", "Quality/Speed ratio modifier", OFFSET(cpu_used), AV_OPT_TYPE_INT, {.i64 = INT_MIN}, INT_MIN, INT_MAX, VE},
{ "auto-alt-ref", "Enable use of alternate reference "
- "frames (2-pass only)", OFFSET(auto_alt_ref), AV_OPT_TYPE_INT, {-1}, -1, 1, VE},
+ "frames (2-pass only)", OFFSET(auto_alt_ref), AV_OPT_TYPE_INT, {.i64 = -1}, -1, 1, VE},
{ "lag-in-frames", "Number of frames to look ahead for "
- "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"},
+ "alternate reference frame selection", OFFSET(lag_in_frames), AV_OPT_TYPE_INT, {.i64 = -1}, -1, INT_MAX, VE},
+ { "arnr-maxframes", "altref noise reduction max frame count", OFFSET(arnr_max_frames), AV_OPT_TYPE_INT, {.i64 = -1}, -1, INT_MAX, VE},
+ { "arnr-strength", "altref noise reduction filter strength", OFFSET(arnr_strength), AV_OPT_TYPE_INT, {.i64 = -1}, -1, INT_MAX, VE},
+ { "arnr-type", "altref noise reduction filter type", OFFSET(arnr_type), AV_OPT_TYPE_INT, {.i64 = -1}, -1, INT_MAX, VE, "arnr_type"},
+ { "backward", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = 1}, 0, 0, VE, "arnr_type" },
+ { "forward", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = 2}, 0, 0, VE, "arnr_type" },
+ { "centered", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = 3}, 0, 0, VE, "arnr_type" },
+ { "deadline", "Time to spend encoding, in microseconds.", OFFSET(deadline), AV_OPT_TYPE_INT, {.i64 = VPX_DL_GOOD_QUALITY}, INT_MIN, INT_MAX, VE, "quality"},
+ { "best", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = VPX_DL_BEST_QUALITY}, 0, 0, VE, "quality"},
+ { "good", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = VPX_DL_GOOD_QUALITY}, 0, 0, VE, "quality"},
+ { "realtime", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = VPX_DL_REALTIME}, 0, 0, VE, "quality"},
+ { "error-resilient", "Error resilience configuration", OFFSET(error_resilient), AV_OPT_TYPE_FLAGS, {.i64 = 0}, INT_MIN, INT_MAX, VE, "er"},
#ifdef VPX_ERROR_RESILIENT_DEFAULT
- { "default", "Improve resiliency against losses of whole frames", 0, AV_OPT_TYPE_CONST, {VPX_ERROR_RESILIENT_DEFAULT}, 0, 0, VE, "er"},
+ { "default", "Improve resiliency against losses of whole frames", 0, AV_OPT_TYPE_CONST, {.i64 = 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, AV_OPT_TYPE_CONST, {VPX_ERROR_RESILIENT_PARTITIONS}, 0, 0, VE, "er"},
+ " is still done over the partition boundary.", 0, AV_OPT_TYPE_CONST, {.i64 = VPX_ERROR_RESILIENT_PARTITIONS}, 0, 0, VE, "er"},
#endif
+ { "crf", "Select the quality for constant quality mode", offsetof(VP8Context, crf), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 63, VE },
{ NULL }
};
@@ -567,14 +583,14 @@ static const AVCodecDefault defaults[] = {
AVCodec ff_libvpx_encoder = {
.name = "libvpx",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_VP8,
+ .id = AV_CODEC_ID_VP8,
.priv_data_size = sizeof(VP8Context),
.init = vp8_init,
- .encode = vp8_encode,
+ .encode2 = vp8_encode,
.close = vp8_free,
.capabilities = CODEC_CAP_DELAY | CODEC_CAP_AUTO_THREADS,
- .pix_fmts = (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE},
- .long_name = NULL_IF_CONFIG_SMALL("libvpx VP8"),
- .priv_class = &class,
+ .pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_YUV420P, AV_PIX_FMT_NONE },
+ .long_name = NULL_IF_CONFIG_SMALL("libvpx VP8"),
+ .priv_class = &class,
.defaults = defaults,
};
diff --git a/gst-libs/ext/libav/libavcodec/libx264.c b/gst-libs/ext/libav/libavcodec/libx264.c
index ac0f6b6..e9cbbad 100644
--- a/gst-libs/ext/libav/libavcodec/libx264.c
+++ b/gst-libs/ext/libav/libavcodec/libx264.c
@@ -19,7 +19,9 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "libavutil/internal.h"
#include "libavutil/opt.h"
+#include "libavutil/mem.h"
#include "libavutil/pixdesc.h"
#include "avcodec.h"
#include "internal.h"
@@ -67,6 +69,7 @@ typedef struct X264Context {
int direct_pred;
int slice_max_size;
char *stats;
+ int nal_hrd;
} X264Context;
static void X264_log(void *p, int level, const char *fmt, va_list args)
@@ -85,12 +88,23 @@ static void X264_log(void *p, int level, const char *fmt, va_list args)
}
-static int encode_nals(AVCodecContext *ctx, uint8_t *buf, int size,
- x264_nal_t *nals, int nnal, int skip_sei)
+static int encode_nals(AVCodecContext *ctx, AVPacket *pkt,
+ x264_nal_t *nals, int nnal)
{
X264Context *x4 = ctx->priv_data;
- uint8_t *p = buf;
- int i;
+ uint8_t *p;
+ int i, size = x4->sei_size, ret;
+
+ if (!nnal)
+ return 0;
+
+ for (i = 0; i < nnal; i++)
+ size += nals[i].i_payload;
+
+ if ((ret = ff_alloc_packet(pkt, size)) < 0)
+ return ret;
+
+ p = pkt->data;
/* Write the SEI as part of the first frame. */
if (x4->sei_size > 0 && nnal > 0) {
@@ -100,27 +114,19 @@ static int encode_nals(AVCodecContext *ctx, uint8_t *buf, int size,
}
for (i = 0; i < nnal; i++){
- /* Don't put the SEI in extradata. */
- if (skip_sei && nals[i].i_type == NAL_SEI) {
- x4->sei_size = nals[i].i_payload;
- x4->sei = av_malloc(x4->sei_size);
- memcpy(x4->sei, nals[i].p_payload, nals[i].i_payload);
- continue;
- }
memcpy(p, nals[i].p_payload, nals[i].i_payload);
p += nals[i].i_payload;
}
- return p - buf;
+ return 1;
}
-static int X264_frame(AVCodecContext *ctx, uint8_t *buf,
- int bufsize, void *data)
+static int X264_frame(AVCodecContext *ctx, AVPacket *pkt, const AVFrame *frame,
+ int *got_packet)
{
X264Context *x4 = ctx->priv_data;
- AVFrame *frame = data;
x264_nal_t *nal;
- int nnal, i;
+ int nnal, i, ret;
x264_picture_t pic_out;
x264_picture_init( &x4->pic );
@@ -145,19 +151,25 @@ static int X264_frame(AVCodecContext *ctx, uint8_t *buf,
x4->params.b_tff = frame->top_field_first;
x264_encoder_reconfig(x4->enc, &x4->params);
}
+ if (x4->params.vui.i_sar_height != ctx->sample_aspect_ratio.den ||
+ x4->params.vui.i_sar_width != ctx->sample_aspect_ratio.num) {
+ x4->params.vui.i_sar_height = ctx->sample_aspect_ratio.den;
+ x4->params.vui.i_sar_width = ctx->sample_aspect_ratio.num;
+ x264_encoder_reconfig(x4->enc, &x4->params);
+ }
}
do {
- if (x264_encoder_encode(x4->enc, &nal, &nnal, frame? &x4->pic: NULL, &pic_out) < 0)
- return -1;
+ if (x264_encoder_encode(x4->enc, &nal, &nnal, frame? &x4->pic: NULL, &pic_out) < 0)
+ return -1;
- bufsize = encode_nals(ctx, buf, bufsize, nal, nnal, 0);
- if (bufsize < 0)
- return -1;
- } while (!bufsize && !frame && x264_encoder_delayed_frames(x4->enc));
+ ret = encode_nals(ctx, pkt, nal, nnal);
+ if (ret < 0)
+ return -1;
+ } while (!ret && !frame && x264_encoder_delayed_frames(x4->enc));
- /* FIXME: libx264 now provides DTS, but AVFrame doesn't have a field for it. */
- x4->out_pic.pts = pic_out.i_pts;
+ pkt->pts = pic_out.i_pts;
+ pkt->dts = pic_out.i_dts;
switch (pic_out.i_type) {
case X264_TYPE_IDR:
@@ -173,11 +185,12 @@ static int X264_frame(AVCodecContext *ctx, uint8_t *buf,
break;
}
- x4->out_pic.key_frame = pic_out.b_keyframe;
- if (bufsize)
+ pkt->flags |= AV_PKT_FLAG_KEY*pic_out.b_keyframe;
+ if (ret)
x4->out_pic.quality = (pic_out.i_qpplus1 - 1) * FF_QP2LAMBDA;
- return bufsize;
+ *got_packet = ret;
+ return 0;
}
static av_cold int X264_close(AVCodecContext *avctx)
@@ -193,18 +206,18 @@ static av_cold int X264_close(AVCodecContext *avctx)
return 0;
}
-static int convert_pix_fmt(enum PixelFormat pix_fmt)
+static int convert_pix_fmt(enum AVPixelFormat 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;
+ case AV_PIX_FMT_YUV420P:
+ case AV_PIX_FMT_YUVJ420P:
+ case AV_PIX_FMT_YUV420P9:
+ case AV_PIX_FMT_YUV420P10: return X264_CSP_I420;
+ case AV_PIX_FMT_YUV422P:
+ case AV_PIX_FMT_YUV422P10: return X264_CSP_I422;
+ case AV_PIX_FMT_YUV444P:
+ case AV_PIX_FMT_YUV444P9:
+ case AV_PIX_FMT_YUV444P10: return X264_CSP_I444;
};
return 0;
}
@@ -247,17 +260,6 @@ static av_cold int X264_init(AVCodecContext *avctx)
if (avctx->flags & CODEC_FLAG_PASS2) {
x4->params.rc.b_stat_read = 1;
} else {
-#if FF_API_X264_GLOBAL_OPTS
- if (avctx->crf) {
- x4->params.rc.i_rc_method = X264_RC_CRF;
- x4->params.rc.f_rf_constant = avctx->crf;
- x4->params.rc.f_rf_constant_max = avctx->crf_max;
- } else if (avctx->cqp > -1) {
- x4->params.rc.i_rc_method = X264_RC_CQP;
- x4->params.rc.i_qp_constant = avctx->cqp;
- }
-#endif
-
if (x4->crf >= 0) {
x4->params.rc.i_rc_method = X264_RC_CRF;
x4->params.rc.f_rf_constant = x4->crf;
@@ -270,7 +272,7 @@ static av_cold int X264_init(AVCodecContext *avctx)
x4->params.rc.f_rf_constant_max = x4->crf_max;
}
- if (avctx->rc_buffer_size && avctx->rc_initial_buffer_occupancy &&
+ if (avctx->rc_buffer_size && avctx->rc_initial_buffer_occupancy > 0 &&
(avctx->rc_initial_buffer_occupancy <= avctx->rc_buffer_size)) {
x4->params.rc.f_vbv_buffer_init =
(float)avctx->rc_initial_buffer_occupancy / avctx->rc_buffer_size;
@@ -280,53 +282,6 @@ static av_cold int X264_init(AVCodecContext *avctx)
x4->params.rc.f_pb_factor = avctx->b_quant_factor;
x4->params.analyse.i_chroma_qp_offset = avctx->chromaoffset;
-#if FF_API_X264_GLOBAL_OPTS
- if (avctx->aq_mode >= 0)
- x4->params.rc.i_aq_mode = avctx->aq_mode;
- if (avctx->aq_strength >= 0)
- x4->params.rc.f_aq_strength = avctx->aq_strength;
- if (avctx->psy_rd >= 0)
- x4->params.analyse.f_psy_rd = avctx->psy_rd;
- if (avctx->psy_trellis >= 0)
- x4->params.analyse.f_psy_trellis = avctx->psy_trellis;
- if (avctx->rc_lookahead >= 0)
- x4->params.rc.i_lookahead = avctx->rc_lookahead;
- if (avctx->weighted_p_pred >= 0)
- x4->params.analyse.i_weighted_pred = avctx->weighted_p_pred;
- if (avctx->bframebias)
- x4->params.i_bframe_bias = avctx->bframebias;
- if (avctx->deblockalpha)
- x4->params.i_deblocking_filter_alphac0 = avctx->deblockalpha;
- if (avctx->deblockbeta)
- x4->params.i_deblocking_filter_beta = avctx->deblockbeta;
- if (avctx->complexityblur >= 0)
- x4->params.rc.f_complexity_blur = avctx->complexityblur;
- if (avctx->directpred >= 0)
- x4->params.analyse.i_direct_mv_pred = avctx->directpred;
- if (avctx->partitions) {
- if (avctx->partitions & X264_PART_I4X4)
- x4->params.analyse.inter |= X264_ANALYSE_I4x4;
- if (avctx->partitions & X264_PART_I8X8)
- x4->params.analyse.inter |= X264_ANALYSE_I8x8;
- if (avctx->partitions & X264_PART_P8X8)
- x4->params.analyse.inter |= X264_ANALYSE_PSUB16x16;
- if (avctx->partitions & X264_PART_P4X4)
- x4->params.analyse.inter |= X264_ANALYSE_PSUB8x8;
- if (avctx->partitions & X264_PART_B8X8)
- x4->params.analyse.inter |= X264_ANALYSE_BSUB16x16;
- }
- x4->params.analyse.b_ssim = avctx->flags2 & CODEC_FLAG2_SSIM;
- x4->params.b_intra_refresh = avctx->flags2 & CODEC_FLAG2_INTRA_REFRESH;
- x4->params.i_bframe_pyramid = avctx->flags2 & CODEC_FLAG2_BPYRAMID ? X264_B_PYRAMID_NORMAL : X264_B_PYRAMID_NONE;
- x4->params.analyse.b_weighted_bipred = avctx->flags2 & CODEC_FLAG2_WPRED;
- x4->params.analyse.b_mixed_references = avctx->flags2 & CODEC_FLAG2_MIXED_REFS;
- x4->params.analyse.b_transform_8x8 = avctx->flags2 & CODEC_FLAG2_8X8DCT;
- x4->params.analyse.b_fast_pskip = avctx->flags2 & CODEC_FLAG2_FASTPSKIP;
- x4->params.b_aud = avctx->flags2 & CODEC_FLAG2_AUD;
- x4->params.analyse.b_psy = avctx->flags2 & CODEC_FLAG2_PSY;
- x4->params.rc.b_mb_tree = !!(avctx->flags2 & CODEC_FLAG2_MBTREE);
-#endif
-
if (avctx->me_method == ME_EPZS)
x4->params.analyse.i_me_method = X264_ME_DIA;
else if (avctx->me_method == ME_HEX)
@@ -419,6 +374,9 @@ static av_cold int X264_init(AVCodecContext *avctx)
if (x4->fastfirstpass)
x264_param_apply_fastfirstpass(&x4->params);
+ if (x4->nal_hrd >= 0)
+ x4->params.i_nal_hrd = x4->nal_hrd;
+
if (x4->profile)
if (x264_param_apply_profile(&x4->params, x4->profile) < 0) {
av_log(avctx, AV_LOG_ERROR, "Error setting profile %s.\n", x4->profile);
@@ -435,6 +393,8 @@ static av_cold int X264_init(AVCodecContext *avctx)
x4->params.analyse.b_psnr = avctx->flags & CODEC_FLAG_PSNR;
x4->params.i_threads = avctx->thread_count;
+ if (avctx->thread_type)
+ x4->params.b_sliced_threads = avctx->thread_type == FF_THREAD_SLICE;
x4->params.b_interlaced = avctx->flags & CODEC_FLAG_INTERLACED_DCT;
@@ -442,7 +402,7 @@ static av_cold int X264_init(AVCodecContext *avctx)
x4->params.i_slice_count = avctx->slices;
- x4->params.vui.b_fullrange = avctx->pix_fmt == PIX_FMT_YUVJ420P;
+ x4->params.vui.b_fullrange = avctx->pix_fmt == AV_PIX_FMT_YUVJ420P;
if (avctx->flags & CODEC_FLAG_GLOBAL_HEADER)
x4->params.b_repeat_headers = 0;
@@ -454,9 +414,6 @@ static av_cold int X264_init(AVCodecContext *avctx)
avctx->max_b_frames = 0;
avctx->bit_rate = x4->params.rc.i_bitrate*1000;
-#if FF_API_X264_GLOBAL_OPTS
- avctx->crf = x4->params.rc.f_rf_constant;
-#endif
x4->enc = x264_encoder_open(&x4->params);
if (!x4->enc)
@@ -466,38 +423,47 @@ static av_cold int X264_init(AVCodecContext *avctx)
if (avctx->flags & CODEC_FLAG_GLOBAL_HEADER) {
x264_nal_t *nal;
+ uint8_t *p;
int nnal, s, i;
s = x264_encoder_headers(x4->enc, &nal, &nnal);
+ avctx->extradata = p = av_malloc(s);
- for (i = 0; i < nnal; i++)
- if (nal[i].i_type == NAL_SEI)
+ for (i = 0; i < nnal; i++) {
+ /* Don't put the SEI in extradata. */
+ if (nal[i].i_type == NAL_SEI) {
av_log(avctx, AV_LOG_INFO, "%s\n", nal[i].p_payload+25);
-
- avctx->extradata = av_malloc(s);
- avctx->extradata_size = encode_nals(avctx, avctx->extradata, s, nal, nnal, 1);
+ x4->sei_size = nal[i].i_payload;
+ x4->sei = av_malloc(x4->sei_size);
+ memcpy(x4->sei, nal[i].p_payload, nal[i].i_payload);
+ continue;
+ }
+ memcpy(p, nal[i].p_payload, nal[i].i_payload);
+ p += nal[i].i_payload;
+ }
+ avctx->extradata_size = p - avctx->extradata;
}
return 0;
}
-static const enum PixelFormat pix_fmts_8bit[] = {
- PIX_FMT_YUV420P,
- PIX_FMT_YUVJ420P,
- PIX_FMT_YUV422P,
- PIX_FMT_YUV444P,
- PIX_FMT_NONE
+static const enum AVPixelFormat pix_fmts_8bit[] = {
+ AV_PIX_FMT_YUV420P,
+ AV_PIX_FMT_YUVJ420P,
+ AV_PIX_FMT_YUV422P,
+ AV_PIX_FMT_YUV444P,
+ AV_PIX_FMT_NONE
};
-static const enum PixelFormat pix_fmts_9bit[] = {
- PIX_FMT_YUV420P9,
- PIX_FMT_YUV444P9,
- PIX_FMT_NONE
+static const enum AVPixelFormat pix_fmts_9bit[] = {
+ AV_PIX_FMT_YUV420P9,
+ AV_PIX_FMT_YUV444P9,
+ AV_PIX_FMT_NONE
};
-static const enum PixelFormat pix_fmts_10bit[] = {
- PIX_FMT_YUV420P10,
- PIX_FMT_YUV422P10,
- PIX_FMT_YUV444P10,
- PIX_FMT_NONE
+static const enum AVPixelFormat pix_fmts_10bit[] = {
+ AV_PIX_FMT_YUV420P10,
+ AV_PIX_FMT_YUV422P10,
+ AV_PIX_FMT_YUV444P10,
+ AV_PIX_FMT_NONE
};
static av_cold void X264_init_static(AVCodec *codec)
@@ -516,46 +482,51 @@ static const AVOption options[] = {
{ "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},
- { "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 },
+ { "fastfirstpass", "Use fast settings when encoding first pass", OFFSET(fastfirstpass), AV_OPT_TYPE_INT, { .i64 = 1 }, 0, 1, VE},
+ { "crf", "Select the quality for constant quality mode", OFFSET(crf), AV_OPT_TYPE_FLOAT, {.dbl = -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, {.dbl = -1 }, -1, FLT_MAX, VE },
+ { "qp", "Constant quantization parameter rate control method",OFFSET(cqp), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, VE },
+ { "aq-mode", "AQ method", OFFSET(aq_mode), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, VE, "aq_mode"},
+ { "none", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = X264_AQ_NONE}, INT_MIN, INT_MAX, VE, "aq_mode" },
+ { "variance", "Variance AQ (complexity mask)", 0, AV_OPT_TYPE_CONST, {.i64 = X264_AQ_VARIANCE}, INT_MIN, INT_MAX, VE, "aq_mode" },
+ { "autovariance", "Auto-variance AQ (experimental)", 0, AV_OPT_TYPE_CONST, {.i64 = 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, {.dbl = -1}, -1, FLT_MAX, VE},
+ { "psy", "Use psychovisual optimizations.", OFFSET(psy), AV_OPT_TYPE_INT, { .i64 = -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},
+ { "rc-lookahead", "Number of frames to look ahead for frametype and ratecontrol", OFFSET(rc_lookahead), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, VE },
+ { "weightb", "Weighted prediction for B-frames.", OFFSET(weightb), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 1, VE },
+ { "weightp", "Weighted prediction analysis method.", OFFSET(weightp), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, VE, "weightp" },
+ { "none", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = X264_WEIGHTP_NONE}, INT_MIN, INT_MAX, VE, "weightp" },
+ { "simple", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = X264_WEIGHTP_SIMPLE}, INT_MIN, INT_MAX, VE, "weightp" },
+ { "smart", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = X264_WEIGHTP_SMART}, INT_MIN, INT_MAX, VE, "weightp" },
+ { "ssim", "Calculate and print SSIM stats.", OFFSET(ssim), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 1, VE },
+ { "intra-refresh", "Use Periodic Intra Refresh instead of IDR frames.",OFFSET(intra_refresh),AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 1, VE },
+ { "b-bias", "Influences how often B-frames are used", OFFSET(b_bias), AV_OPT_TYPE_INT, { .i64 = INT_MIN}, INT_MIN, INT_MAX, VE },
+ { "b-pyramid", "Keep some B-frames as references.", OFFSET(b_pyramid), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, VE, "b_pyramid" },
+ { "none", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = X264_B_PYRAMID_NONE}, INT_MIN, INT_MAX, VE, "b_pyramid" },
+ { "strict", "Strictly hierarchical pyramid", 0, AV_OPT_TYPE_CONST, {.i64 = X264_B_PYRAMID_STRICT}, INT_MIN, INT_MAX, VE, "b_pyramid" },
+ { "normal", "Non-strict (not Blu-ray compatible)", 0, AV_OPT_TYPE_CONST, {.i64 = 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, { .i64 = -1}, -1, 1, VE },
+ { "8x8dct", "High profile 8x8 transform.", OFFSET(dct8x8), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 1, VE},
+ { "fast-pskip", NULL, OFFSET(fast_pskip), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 1, VE},
+ { "aud", "Use access unit delimiters.", OFFSET(aud), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 1, VE},
+ { "mbtree", "Use macroblock tree ratecontrol.", OFFSET(mbtree), AV_OPT_TYPE_INT, { .i64 = -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},
+ { "cplxblur", "Reduce fluctuations in QP (before curve compression)", OFFSET(cplxblur), AV_OPT_TYPE_FLOAT, {.dbl = -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), 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","Limit the size of each slice in bytes", OFFSET(slice_max_size),AV_OPT_TYPE_INT, {-1 }, -1, INT_MAX, VE },
+ { "direct-pred", "Direct MV prediction mode", OFFSET(direct_pred), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, VE, "direct-pred" },
+ { "none", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = X264_DIRECT_PRED_NONE }, 0, 0, VE, "direct-pred" },
+ { "spatial", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = X264_DIRECT_PRED_SPATIAL }, 0, 0, VE, "direct-pred" },
+ { "temporal", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = X264_DIRECT_PRED_TEMPORAL }, 0, 0, VE, "direct-pred" },
+ { "auto", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = X264_DIRECT_PRED_AUTO }, 0, 0, VE, "direct-pred" },
+ { "slice-max-size","Limit the size of each slice in bytes", OFFSET(slice_max_size),AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, VE },
{ "stats", "Filename for 2 pass stats", OFFSET(stats), AV_OPT_TYPE_STRING, { 0 }, 0, 0, VE },
+ { "nal-hrd", "Signal HRD information (requires vbv-bufsize; "
+ "cbr not allowed in .mp4)", OFFSET(nal_hrd), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, VE, "nal-hrd" },
+ { "none", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = X264_NAL_HRD_NONE}, INT_MIN, INT_MAX, VE, "nal-hrd" },
+ { "vbr", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = X264_NAL_HRD_VBR}, INT_MIN, INT_MAX, VE, "nal-hrd" },
+ { "cbr", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = X264_NAL_HRD_CBR}, INT_MIN, INT_MAX, VE, "nal-hrd" },
{ NULL },
};
@@ -587,20 +558,23 @@ static const AVCodecDefault x264_defaults[] = {
{ "coder", "-1" },
{ "cmp", "-1" },
{ "threads", AV_STRINGIFY(X264_THREADS_AUTO) },
+ { "thread_type", "0" },
+ { "flags", "+cgop" },
+ { "rc_init_occupancy","-1" },
{ NULL },
};
AVCodec ff_libx264_encoder = {
- .name = "libx264",
- .type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_H264,
- .priv_data_size = sizeof(X264Context),
- .init = X264_init,
- .encode = X264_frame,
- .close = X264_close,
- .capabilities = CODEC_CAP_DELAY | CODEC_CAP_AUTO_THREADS,
- .long_name = NULL_IF_CONFIG_SMALL("libx264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10"),
- .priv_class = &class,
- .defaults = x264_defaults,
+ .name = "libx264",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .id = AV_CODEC_ID_H264,
+ .priv_data_size = sizeof(X264Context),
+ .init = X264_init,
+ .encode2 = X264_frame,
+ .close = X264_close,
+ .capabilities = CODEC_CAP_DELAY | CODEC_CAP_AUTO_THREADS,
+ .long_name = NULL_IF_CONFIG_SMALL("libx264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10"),
+ .priv_class = &class,
+ .defaults = x264_defaults,
.init_static_data = X264_init_static,
};
diff --git a/gst-libs/ext/libav/libavcodec/libxavs.c b/gst-libs/ext/libav/libavcodec/libxavs.c
index 1a16bd9..16026ac 100644
--- a/gst-libs/ext/libav/libavcodec/libxavs.c
+++ b/gst-libs/ext/libav/libavcodec/libxavs.c
@@ -28,6 +28,8 @@
#include <xavs.h>
#include "avcodec.h"
#include "internal.h"
+#include "libavutil/internal.h"
+#include "libavutil/mem.h"
#include "libavutil/opt.h"
#define END_OF_STREAM 0x001
@@ -37,6 +39,7 @@
#define XAVS_PART_B8X8 0x100 /* Analyze b16x8, b*/
typedef struct XavsContext {
+ AVClass *class;
xavs_param_t params;
xavs_t *enc;
xavs_picture_t pic;
@@ -53,6 +56,9 @@ typedef struct XavsContext {
int fast_pskip;
int mbtree;
int mixed_refs;
+
+ int64_t *pts_buffer;
+ int out_frame_count;
} XavsContext;
static void XAVS_log(void *p, int level, const char *fmt, va_list args)
@@ -70,13 +76,24 @@ static void XAVS_log(void *p, int level, const char *fmt, va_list args)
av_vlog(p, level_map[level], fmt, args);
}
-static int encode_nals(AVCodecContext *ctx, uint8_t *buf,
- int size, xavs_nal_t *nals,
- int nnal, int skip_sei)
+static int encode_nals(AVCodecContext *ctx, AVPacket *pkt,
+ xavs_nal_t *nals, int nnal)
{
XavsContext *x4 = ctx->priv_data;
- uint8_t *p = buf;
- int i, s;
+ uint8_t *p;
+ int i, s, ret, size = x4->sei_size + FF_MIN_BUFFER_SIZE;
+
+ if (!nnal)
+ return 0;
+
+ for (i = 0; i < nnal; i++)
+ size += nals[i].i_payload;
+
+ if ((ret = ff_alloc_packet(pkt, size)) < 0) {
+ av_log(ctx, AV_LOG_ERROR, "Error getting output packet of size %d.\n", size);
+ return ret;
+ }
+ p = pkt->data;
/* Write the SEI as part of the first frame. */
if (x4->sei_size > 0 && nnal > 0) {
@@ -86,30 +103,22 @@ static int encode_nals(AVCodecContext *ctx, uint8_t *buf,
}
for (i = 0; i < nnal; i++) {
- /* Don't put the SEI in extradata. */
- if (skip_sei && nals[i].i_type == NAL_SEI) {
- x4->sei = av_malloc( 5 + nals[i].i_payload * 4 / 3 );
- if (xavs_nal_encode(x4->sei, &x4->sei_size, 1, nals + i) < 0)
- return -1;
-
- continue;
- }
s = xavs_nal_encode(p, &size, 1, nals + i);
if (s < 0)
return -1;
p += s;
}
+ pkt->size = p - pkt->data;
- return p - buf;
+ return 1;
}
-static int XAVS_frame(AVCodecContext *ctx, uint8_t *buf,
- int bufsize, void *data)
+static int XAVS_frame(AVCodecContext *ctx, AVPacket *pkt,
+ const AVFrame *frame, int *got_packet)
{
XavsContext *x4 = ctx->priv_data;
- AVFrame *frame = data;
xavs_nal_t *nal;
- int nnal, i;
+ int nnal, i, ret;
xavs_picture_t pic_out;
x4->pic.img.i_csp = XAVS_CSP_I420;
@@ -123,29 +132,44 @@ static int XAVS_frame(AVCodecContext *ctx, uint8_t *buf,
x4->pic.i_pts = frame->pts;
x4->pic.i_type = XAVS_TYPE_AUTO;
+ x4->pts_buffer[ctx->frame_number % (ctx->max_b_frames+1)] = frame->pts;
}
if (xavs_encoder_encode(x4->enc, &nal, &nnal,
frame? &x4->pic: NULL, &pic_out) < 0)
return -1;
- bufsize = encode_nals(ctx, buf, bufsize, nal, nnal, 0);
+ ret = encode_nals(ctx, pkt, nal, nnal);
- if (bufsize < 0)
+ if (ret < 0)
return -1;
- if (!bufsize && !frame && !(x4->end_of_stream)){
- buf[bufsize] = 0x0;
- buf[bufsize+1] = 0x0;
- buf[bufsize+2] = 0x01;
- buf[bufsize+3] = 0xb1;
- bufsize += 4;
- x4->end_of_stream = END_OF_STREAM;
- return bufsize;
+ if (!ret) {
+ if (!frame && !(x4->end_of_stream)) {
+ if ((ret = ff_alloc_packet(pkt, 4)) < 0)
+ return ret;
+
+ pkt->data[0] = 0x0;
+ pkt->data[1] = 0x0;
+ pkt->data[2] = 0x01;
+ pkt->data[3] = 0xb1;
+ pkt->dts = 2*x4->pts_buffer[(x4->out_frame_count-1)%(ctx->max_b_frames+1)] -
+ x4->pts_buffer[(x4->out_frame_count-2)%(ctx->max_b_frames+1)];
+ x4->end_of_stream = END_OF_STREAM;
+ *got_packet = 1;
+ }
+ return 0;
}
- /* FIXME: libxavs now provides DTS */
- /* but AVFrame doesn't have a field for it. */
+
x4->out_pic.pts = pic_out.i_pts;
+ pkt->pts = pic_out.i_pts;
+ if (ctx->has_b_frames) {
+ if (!x4->out_frame_count)
+ pkt->dts = pkt->pts - (x4->pts_buffer[1] - x4->pts_buffer[0]);
+ else
+ pkt->dts = x4->pts_buffer[(x4->out_frame_count-1)%(ctx->max_b_frames+1)];
+ } else
+ pkt->dts = pkt->pts;
switch (pic_out.i_type) {
case XAVS_TYPE_IDR:
@@ -163,11 +187,16 @@ static int XAVS_frame(AVCodecContext *ctx, uint8_t *buf,
/* There is no IDR frame in AVS JiZhun */
/* Sequence header is used as a flag */
- x4->out_pic.key_frame = pic_out.i_type == XAVS_TYPE_I;
+ if (pic_out.i_type == XAVS_TYPE_I) {
+ x4->out_pic.key_frame = 1;
+ pkt->flags |= AV_PKT_FLAG_KEY;
+ }
x4->out_pic.quality = (pic_out.i_qpplus1 - 1) * FF_QP2LAMBDA;
- return bufsize;
+ x4->out_frame_count++;
+ *got_packet = ret;
+ return 0;
}
static av_cold int XAVS_close(AVCodecContext *avctx)
@@ -176,6 +205,7 @@ static av_cold int XAVS_close(AVCodecContext *avctx)
av_freep(&avctx->extradata);
av_free(x4->sei);
+ av_freep(&x4->pts_buffer);
if (x4->enc)
xavs_encoder_close(x4->enc);
@@ -203,16 +233,6 @@ static av_cold int XAVS_init(AVCodecContext *avctx)
if (avctx->flags & CODEC_FLAG_PASS2) {
x4->params.rc.b_stat_read = 1;
} else {
-#if FF_API_X264_GLOBAL_OPTS
- if (avctx->crf) {
- x4->params.rc.i_rc_method = XAVS_RC_CRF;
- x4->params.rc.f_rf_constant = avctx->crf;
- } else if (avctx->cqp > -1) {
- x4->params.rc.i_rc_method = XAVS_RC_CQP;
- x4->params.rc.i_qp_constant = avctx->cqp;
- }
-#endif
-
if (x4->crf >= 0) {
x4->params.rc.i_rc_method = XAVS_RC_CRF;
x4->params.rc.f_rf_constant = x4->crf;
@@ -222,32 +242,6 @@ static av_cold int XAVS_init(AVCodecContext *avctx)
}
}
-#if FF_API_X264_GLOBAL_OPTS
- if (avctx->bframebias)
- x4->params.i_bframe_bias = avctx->bframebias;
- if (avctx->deblockalpha)
- x4->params.i_deblocking_filter_alphac0 = avctx->deblockalpha;
- if (avctx->deblockbeta)
- x4->params.i_deblocking_filter_beta = avctx->deblockbeta;
- if (avctx->complexityblur >= 0)
- x4->params.rc.f_complexity_blur = avctx->complexityblur;
- if (avctx->directpred >= 0)
- x4->params.analyse.i_direct_mv_pred = avctx->directpred;
- if (avctx->partitions) {
- if (avctx->partitions & XAVS_PART_I8X8)
- x4->params.analyse.inter |= XAVS_ANALYSE_I8x8;
- if (avctx->partitions & XAVS_PART_P8X8)
- x4->params.analyse.inter |= XAVS_ANALYSE_PSUB16x16;
- if (avctx->partitions & XAVS_PART_B8X8)
- x4->params.analyse.inter |= XAVS_ANALYSE_BSUB16x16;
- }
- x4->params.rc.b_mb_tree = !!(avctx->flags2 & CODEC_FLAG2_MBTREE);
- x4->params.b_aud = avctx->flags2 & CODEC_FLAG2_AUD;
- x4->params.analyse.b_mixed_references = avctx->flags2 & CODEC_FLAG2_MIXED_REFS;
- x4->params.analyse.b_fast_pskip = avctx->flags2 & CODEC_FLAG2_FASTPSKIP;
- x4->params.analyse.b_weighted_bipred = avctx->flags2 & CODEC_FLAG2_WPRED;
-#endif
-
if (x4->aud >= 0)
x4->params.b_aud = x4->aud;
if (x4->mbtree >= 0)
@@ -360,17 +354,35 @@ static av_cold int XAVS_init(AVCodecContext *avctx)
if (!x4->enc)
return -1;
+ if (!(x4->pts_buffer = av_mallocz((avctx->max_b_frames+1) * sizeof(*x4->pts_buffer))))
+ return AVERROR(ENOMEM);
+
avctx->coded_frame = &x4->out_pic;
/* TAG: Do we have GLOBAL HEADER in AVS */
/* We Have PPS and SPS in AVS */
if (avctx->flags & CODEC_FLAG_GLOBAL_HEADER) {
xavs_nal_t *nal;
- int nnal, s;
+ int nnal, s, i, size;
+ uint8_t *p;
s = xavs_encoder_headers(x4->enc, &nal, &nnal);
- avctx->extradata = av_malloc(s);
- avctx->extradata_size = encode_nals(avctx, avctx->extradata, s, nal, nnal, 1);
+ avctx->extradata = p = av_malloc(s);
+ for (i = 0; i < nnal; i++) {
+ /* Don't put the SEI in extradata. */
+ if (nal[i].i_type == NAL_SEI) {
+ x4->sei = av_malloc( 5 + nal[i].i_payload * 4 / 3 );
+ if (xavs_nal_encode(x4->sei, &x4->sei_size, 1, nal + i) < 0)
+ return -1;
+
+ continue;
+ }
+ size = xavs_nal_encode(p, &s, 1, nal + i);
+ if (size < 0)
+ return -1;
+ p += size;
+ }
+ avctx->extradata_size = p - avctx->extradata;
}
return 0;
}
@@ -379,18 +391,18 @@ static av_cold int XAVS_init(AVCodecContext *avctx)
#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), 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 },
+ { "qp", "Constant quantization parameter rate control method",OFFSET(cqp), AV_OPT_TYPE_INT, {.i64 = -1 }, -1, INT_MAX, VE },
+ { "b-bias", "Influences how often B-frames are used", OFFSET(b_bias), AV_OPT_TYPE_INT, {.i64 = 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},
+ { "direct-pred", "Direct MV prediction mode", OFFSET(direct_pred), AV_OPT_TYPE_INT, {.i64 = -1 }, -1, INT_MAX, VE, "direct-pred" },
+ { "none", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = XAVS_DIRECT_PRED_NONE }, 0, 0, VE, "direct-pred" },
+ { "spatial", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = XAVS_DIRECT_PRED_SPATIAL }, 0, 0, VE, "direct-pred" },
+ { "temporal", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = XAVS_DIRECT_PRED_TEMPORAL }, 0, 0, VE, "direct-pred" },
+ { "auto", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = XAVS_DIRECT_PRED_AUTO }, 0, 0, VE, "direct-pred" },
+ { "aud", "Use access unit delimiters.", OFFSET(aud), AV_OPT_TYPE_INT, {.i64 = -1 }, -1, 1, VE},
+ { "mbtree", "Use macroblock tree ratecontrol.", OFFSET(mbtree), AV_OPT_TYPE_INT, {.i64 = -1 }, -1, 1, VE},
+ { "mixed-refs", "One reference per partition, as opposed to one reference per macroblock", OFFSET(mixed_refs), AV_OPT_TYPE_INT, {.i64 = -1}, -1, 1, VE },
+ { "fast-pskip", NULL, OFFSET(fast_pskip), AV_OPT_TYPE_INT, {.i64 = -1 }, -1, 1, VE},
{ NULL },
};
@@ -409,15 +421,14 @@ static const AVCodecDefault xavs_defaults[] = {
AVCodec ff_libxavs_encoder = {
.name = "libxavs",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_CAVS,
+ .id = AV_CODEC_ID_CAVS,
.priv_data_size = sizeof(XavsContext),
.init = XAVS_init,
- .encode = XAVS_frame,
+ .encode2 = XAVS_frame,
.close = XAVS_close,
.capabilities = CODEC_CAP_DELAY | CODEC_CAP_AUTO_THREADS,
- .pix_fmts = (const enum PixelFormat[]) { PIX_FMT_YUV420P, PIX_FMT_NONE },
- .long_name = NULL_IF_CONFIG_SMALL("libxavs - the Chinese Audio Video Standard Encoder"),
+ .pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_YUV420P, AV_PIX_FMT_NONE },
+ .long_name = NULL_IF_CONFIG_SMALL("libxavs Chinese AVS (Audio Video Standard)"),
.priv_class = &class,
.defaults = xavs_defaults,
};
-
diff --git a/gst-libs/ext/libav/libavcodec/libxvid.c b/gst-libs/ext/libav/libavcodec/libxvid.c
new file mode 100644
index 0000000..dd1e3e3
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/libxvid.c
@@ -0,0 +1,761 @@
+/*
+ * Interface to xvidcore for mpeg4 encoding
+ * Copyright (c) 2004 Adam Thayer <krevnik@comcast.net>
+ *
+ * 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
+ * Interface to xvidcore for MPEG-4 compliant encoding.
+ * @author Adam Thayer (krevnik@comcast.net)
+ */
+
+#include <xvid.h>
+#include <unistd.h>
+#include "avcodec.h"
+#include "libavutil/cpu.h"
+#include "libavutil/intreadwrite.h"
+#include "libavutil/mathematics.h"
+#include "libxvid.h"
+#include "mpegvideo.h"
+
+/**
+ * Buffer management macros.
+ */
+#define BUFFER_SIZE 1024
+#define BUFFER_REMAINING(x) (BUFFER_SIZE - strlen(x))
+#define BUFFER_CAT(x) (&((x)[strlen(x)]))
+
+/**
+ * Structure for the private Xvid context.
+ * This stores all the private context for the codec.
+ */
+struct xvid_context {
+ void *encoder_handle; /**< Handle for Xvid encoder */
+ int xsize; /**< Frame x size */
+ int ysize; /**< Frame y size */
+ int vop_flags; /**< VOP flags for Xvid encoder */
+ int vol_flags; /**< VOL flags for Xvid encoder */
+ int me_flags; /**< Motion Estimation flags */
+ int qscale; /**< Do we use constant scale? */
+ int quicktime_format; /**< Are we in a QT-based format? */
+ AVFrame encoded_picture; /**< Encoded frame information */
+ char *twopassbuffer; /**< Character buffer for two-pass */
+ char *old_twopassbuffer; /**< Old character buffer (two-pass) */
+ char *twopassfile; /**< second pass temp file name */
+ unsigned char *intra_matrix; /**< P-Frame Quant Matrix */
+ unsigned char *inter_matrix; /**< I-Frame Quant Matrix */
+};
+
+/**
+ * Structure for the private first-pass plugin.
+ */
+struct xvid_ff_pass1 {
+ int version; /**< Xvid version */
+ struct xvid_context *context; /**< Pointer to private context */
+};
+
+/*
+ * Xvid 2-Pass Kludge Section
+ *
+ * Xvid's default 2-pass doesn't allow us to create data as we need to, so
+ * this section spends time replacing the first pass plugin so we can write
+ * statistic information as libavcodec requests in. We have another kludge
+ * that allows us to pass data to the second pass in Xvid without a custom
+ * rate-control plugin.
+ */
+
+/**
+ * Initialize the two-pass plugin and context.
+ *
+ * @param param Input construction parameter structure
+ * @param handle Private context handle
+ * @return Returns XVID_ERR_xxxx on failure, or 0 on success.
+ */
+static int xvid_ff_2pass_create(xvid_plg_create_t * param,
+ void ** handle) {
+ struct xvid_ff_pass1 *x = (struct xvid_ff_pass1 *)param->param;
+ char *log = x->context->twopassbuffer;
+
+ /* Do a quick bounds check */
+ if( log == NULL )
+ return XVID_ERR_FAIL;
+
+ /* We use snprintf() */
+ /* This is because we can safely prevent a buffer overflow */
+ log[0] = 0;
+ snprintf(log, BUFFER_REMAINING(log),
+ "# avconv 2-pass log file, using xvid codec\n");
+ snprintf(BUFFER_CAT(log), BUFFER_REMAINING(log),
+ "# Do not modify. libxvidcore version: %d.%d.%d\n\n",
+ XVID_VERSION_MAJOR(XVID_VERSION),
+ XVID_VERSION_MINOR(XVID_VERSION),
+ XVID_VERSION_PATCH(XVID_VERSION));
+
+ *handle = x->context;
+ return 0;
+}
+
+/**
+ * Destroy the two-pass plugin context.
+ *
+ * @param ref Context pointer for the plugin
+ * @param param Destrooy context
+ * @return Returns 0, success guaranteed
+ */
+static int xvid_ff_2pass_destroy(struct xvid_context *ref,
+ xvid_plg_destroy_t *param) {
+ /* Currently cannot think of anything to do on destruction */
+ /* Still, the framework should be here for reference/use */
+ if( ref->twopassbuffer != NULL )
+ ref->twopassbuffer[0] = 0;
+ return 0;
+}
+
+/**
+ * Enable fast encode mode during the first pass.
+ *
+ * @param ref Context pointer for the plugin
+ * @param param Frame data
+ * @return Returns 0, success guaranteed
+ */
+static int xvid_ff_2pass_before(struct xvid_context *ref,
+ xvid_plg_data_t *param) {
+ int motion_remove;
+ int motion_replacements;
+ int vop_remove;
+
+ /* Nothing to do here, result is changed too much */
+ if( param->zone && param->zone->mode == XVID_ZONE_QUANT )
+ return 0;
+
+ /* We can implement a 'turbo' first pass mode here */
+ param->quant = 2;
+
+ /* Init values */
+ motion_remove = ~XVID_ME_CHROMA_PVOP &
+ ~XVID_ME_CHROMA_BVOP &
+ ~XVID_ME_EXTSEARCH16 &
+ ~XVID_ME_ADVANCEDDIAMOND16;
+ motion_replacements = XVID_ME_FAST_MODEINTERPOLATE |
+ XVID_ME_SKIP_DELTASEARCH |
+ XVID_ME_FASTREFINE16 |
+ XVID_ME_BFRAME_EARLYSTOP;
+ vop_remove = ~XVID_VOP_MODEDECISION_RD &
+ ~XVID_VOP_FAST_MODEDECISION_RD &
+ ~XVID_VOP_TRELLISQUANT &
+ ~XVID_VOP_INTER4V &
+ ~XVID_VOP_HQACPRED;
+
+ param->vol_flags &= ~XVID_VOL_GMC;
+ param->vop_flags &= vop_remove;
+ param->motion_flags &= motion_remove;
+ param->motion_flags |= motion_replacements;
+
+ return 0;
+}
+
+/**
+ * Capture statistic data and write it during first pass.
+ *
+ * @param ref Context pointer for the plugin
+ * @param param Statistic data
+ * @return Returns XVID_ERR_xxxx on failure, or 0 on success
+ */
+static int xvid_ff_2pass_after(struct xvid_context *ref,
+ xvid_plg_data_t *param) {
+ char *log = ref->twopassbuffer;
+ const char *frame_types = " ipbs";
+ char frame_type;
+
+ /* Quick bounds check */
+ if( log == NULL )
+ return XVID_ERR_FAIL;
+
+ /* Convert the type given to us into a character */
+ if( param->type < 5 && param->type > 0 ) {
+ frame_type = frame_types[param->type];
+ } else {
+ return XVID_ERR_FAIL;
+ }
+
+ snprintf(BUFFER_CAT(log), BUFFER_REMAINING(log),
+ "%c %d %d %d %d %d %d\n",
+ frame_type, param->stats.quant, param->stats.kblks, param->stats.mblks,
+ param->stats.ublks, param->stats.length, param->stats.hlength);
+
+ return 0;
+}
+
+/**
+ * Dispatch function for our custom plugin.
+ * This handles the dispatch for the Xvid plugin. It passes data
+ * on to other functions for actual processing.
+ *
+ * @param ref Context pointer for the plugin
+ * @param cmd The task given for us to complete
+ * @param p1 First parameter (varies)
+ * @param p2 Second parameter (varies)
+ * @return Returns XVID_ERR_xxxx on failure, or 0 on success
+ */
+static int xvid_ff_2pass(void *ref, int cmd, void *p1, void *p2)
+{
+ switch( cmd ) {
+ case XVID_PLG_INFO:
+ case XVID_PLG_FRAME:
+ return 0;
+
+ case XVID_PLG_BEFORE:
+ return xvid_ff_2pass_before(ref, p1);
+
+ case XVID_PLG_CREATE:
+ return xvid_ff_2pass_create(p1, p2);
+
+ case XVID_PLG_AFTER:
+ return xvid_ff_2pass_after(ref, p1);
+
+ case XVID_PLG_DESTROY:
+ return xvid_ff_2pass_destroy(ref, p1);
+
+ default:
+ return XVID_ERR_FAIL;
+ }
+}
+
+/**
+ * Routine to create a global VO/VOL header for MP4 container.
+ * What we do here is extract the header from the Xvid bitstream
+ * as it is encoded. We also strip the repeated headers from the
+ * bitstream when a global header is requested for MPEG-4 ISO
+ * compliance.
+ *
+ * @param avctx AVCodecContext pointer to context
+ * @param frame Pointer to encoded frame data
+ * @param header_len Length of header to search
+ * @param frame_len Length of encoded frame data
+ * @return Returns new length of frame data
+ */
+static int xvid_strip_vol_header(AVCodecContext *avctx,
+ AVPacket *pkt,
+ unsigned int header_len,
+ unsigned int frame_len) {
+ int vo_len = 0, i;
+
+ for( i = 0; i < header_len - 3; i++ ) {
+ if( pkt->data[i] == 0x00 &&
+ pkt->data[i+1] == 0x00 &&
+ pkt->data[i+2] == 0x01 &&
+ pkt->data[i+3] == 0xB6 ) {
+ vo_len = i;
+ break;
+ }
+ }
+
+ if( vo_len > 0 ) {
+ /* We need to store the header, so extract it */
+ if( avctx->extradata == NULL ) {
+ avctx->extradata = av_malloc(vo_len);
+ memcpy(avctx->extradata, pkt->data, vo_len);
+ avctx->extradata_size = vo_len;
+ }
+ /* Less dangerous now, memmove properly copies the two
+ chunks of overlapping data */
+ memmove(pkt->data, &pkt->data[vo_len], frame_len - vo_len);
+ pkt->size = frame_len - vo_len;
+ }
+ return 0;
+}
+
+/**
+ * Routine to correct a possibly erroneous framerate being fed to us.
+ * Xvid currently chokes on framerates where the ticks per frame is
+ * extremely large. This function works to correct problems in this area
+ * by estimating a new framerate and taking the simpler fraction of
+ * the two presented.
+ *
+ * @param avctx Context that contains the framerate to correct.
+ */
+static void xvid_correct_framerate(AVCodecContext *avctx)
+{
+ int frate, fbase;
+ int est_frate, est_fbase;
+ int gcd;
+ float est_fps, fps;
+
+ frate = avctx->time_base.den;
+ fbase = avctx->time_base.num;
+
+ gcd = av_gcd(frate, fbase);
+ if( gcd > 1 ) {
+ frate /= gcd;
+ fbase /= gcd;
+ }
+
+ if( frate <= 65000 && fbase <= 65000 ) {
+ avctx->time_base.den = frate;
+ avctx->time_base.num = fbase;
+ return;
+ }
+
+ fps = (float)frate / (float)fbase;
+ est_fps = roundf(fps * 1000.0) / 1000.0;
+
+ est_frate = (int)est_fps;
+ if( est_fps > (int)est_fps ) {
+ est_frate = (est_frate + 1) * 1000;
+ est_fbase = (int)roundf((float)est_frate / est_fps);
+ } else
+ est_fbase = 1;
+
+ gcd = av_gcd(est_frate, est_fbase);
+ if( gcd > 1 ) {
+ est_frate /= gcd;
+ est_fbase /= gcd;
+ }
+
+ if( fbase > est_fbase ) {
+ avctx->time_base.den = est_frate;
+ avctx->time_base.num = est_fbase;
+ av_log(avctx, AV_LOG_DEBUG,
+ "Xvid: framerate re-estimated: %.2f, %.3f%% correction\n",
+ est_fps, (((est_fps - fps)/fps) * 100.0));
+ } else {
+ avctx->time_base.den = frate;
+ avctx->time_base.num = fbase;
+ }
+}
+
+static av_cold int xvid_encode_init(AVCodecContext *avctx) {
+ int xerr, i;
+ int xvid_flags = avctx->flags;
+ struct xvid_context *x = avctx->priv_data;
+ uint16_t *intra, *inter;
+ int fd;
+
+ xvid_plugin_single_t single = { 0 };
+ struct xvid_ff_pass1 rc2pass1 = { 0 };
+ xvid_plugin_2pass2_t rc2pass2 = { 0 };
+ xvid_gbl_init_t xvid_gbl_init = { 0 };
+ xvid_enc_create_t xvid_enc_create = { 0 };
+ xvid_enc_plugin_t plugins[7];
+
+ /* Bring in VOP flags from avconv command-line */
+ x->vop_flags = XVID_VOP_HALFPEL; /* Bare minimum quality */
+ if( xvid_flags & CODEC_FLAG_4MV )
+ x->vop_flags |= XVID_VOP_INTER4V; /* Level 3 */
+ if( avctx->trellis
+ )
+ x->vop_flags |= XVID_VOP_TRELLISQUANT; /* Level 5 */
+ if( xvid_flags & CODEC_FLAG_AC_PRED )
+ x->vop_flags |= XVID_VOP_HQACPRED; /* Level 6 */
+ if( xvid_flags & CODEC_FLAG_GRAY )
+ x->vop_flags |= XVID_VOP_GREYSCALE;
+
+ /* Decide which ME quality setting to use */
+ x->me_flags = 0;
+ switch( avctx->me_method ) {
+ case ME_FULL: /* Quality 6 */
+ x->me_flags |= XVID_ME_EXTSEARCH16
+ | XVID_ME_EXTSEARCH8;
+
+ case ME_EPZS: /* Quality 4 */
+ x->me_flags |= XVID_ME_ADVANCEDDIAMOND8
+ | XVID_ME_HALFPELREFINE8
+ | XVID_ME_CHROMA_PVOP
+ | XVID_ME_CHROMA_BVOP;
+
+ case ME_LOG: /* Quality 2 */
+ case ME_PHODS:
+ case ME_X1:
+ x->me_flags |= XVID_ME_ADVANCEDDIAMOND16
+ | XVID_ME_HALFPELREFINE16;
+
+ case ME_ZERO: /* Quality 0 */
+ default:
+ break;
+ }
+
+ /* Decide how we should decide blocks */
+ switch( avctx->mb_decision ) {
+ case 2:
+ x->vop_flags |= XVID_VOP_MODEDECISION_RD;
+ x->me_flags |= XVID_ME_HALFPELREFINE8_RD
+ | XVID_ME_QUARTERPELREFINE8_RD
+ | XVID_ME_EXTSEARCH_RD
+ | XVID_ME_CHECKPREDICTION_RD;
+ case 1:
+ if( !(x->vop_flags & XVID_VOP_MODEDECISION_RD) )
+ x->vop_flags |= XVID_VOP_FAST_MODEDECISION_RD;
+ x->me_flags |= XVID_ME_HALFPELREFINE16_RD
+ | XVID_ME_QUARTERPELREFINE16_RD;
+
+ default:
+ break;
+ }
+
+ /* Bring in VOL flags from avconv command-line */
+ x->vol_flags = 0;
+ if( xvid_flags & CODEC_FLAG_GMC ) {
+ x->vol_flags |= XVID_VOL_GMC;
+ x->me_flags |= XVID_ME_GME_REFINE;
+ }
+ if( xvid_flags & CODEC_FLAG_QPEL ) {
+ x->vol_flags |= XVID_VOL_QUARTERPEL;
+ x->me_flags |= XVID_ME_QUARTERPELREFINE16;
+ if( x->vop_flags & XVID_VOP_INTER4V )
+ x->me_flags |= XVID_ME_QUARTERPELREFINE8;
+ }
+
+ xvid_gbl_init.version = XVID_VERSION;
+ xvid_gbl_init.debug = 0;
+
+#if ARCH_PPC
+ /* Xvid's PPC support is borked, use libavcodec to detect */
+#if HAVE_ALTIVEC
+ if (av_get_cpu_flags() & AV_CPU_FLAG_ALTIVEC) {
+ xvid_gbl_init.cpu_flags = XVID_CPU_FORCE | XVID_CPU_ALTIVEC;
+ } else
+#endif
+ xvid_gbl_init.cpu_flags = XVID_CPU_FORCE;
+#else
+ /* Xvid can detect on x86 */
+ xvid_gbl_init.cpu_flags = 0;
+#endif
+
+ /* Initialize */
+ xvid_global(NULL, XVID_GBL_INIT, &xvid_gbl_init, NULL);
+
+ /* Create the encoder reference */
+ xvid_enc_create.version = XVID_VERSION;
+
+ /* Store the desired frame size */
+ xvid_enc_create.width = x->xsize = avctx->width;
+ xvid_enc_create.height = x->ysize = avctx->height;
+
+ /* Xvid can determine the proper profile to use */
+ /* xvid_enc_create.profile = XVID_PROFILE_S_L3; */
+
+ /* We don't use zones */
+ xvid_enc_create.zones = NULL;
+ xvid_enc_create.num_zones = 0;
+
+ xvid_enc_create.num_threads = avctx->thread_count;
+
+ xvid_enc_create.plugins = plugins;
+ xvid_enc_create.num_plugins = 0;
+
+ /* Initialize Buffers */
+ x->twopassbuffer = NULL;
+ x->old_twopassbuffer = NULL;
+ x->twopassfile = NULL;
+
+ if( xvid_flags & CODEC_FLAG_PASS1 ) {
+ rc2pass1.version = XVID_VERSION;
+ rc2pass1.context = x;
+ x->twopassbuffer = av_malloc(BUFFER_SIZE);
+ x->old_twopassbuffer = av_malloc(BUFFER_SIZE);
+ if( x->twopassbuffer == NULL || x->old_twopassbuffer == NULL ) {
+ av_log(avctx, AV_LOG_ERROR,
+ "Xvid: Cannot allocate 2-pass log buffers\n");
+ return -1;
+ }
+ x->twopassbuffer[0] = x->old_twopassbuffer[0] = 0;
+
+ plugins[xvid_enc_create.num_plugins].func = xvid_ff_2pass;
+ plugins[xvid_enc_create.num_plugins].param = &rc2pass1;
+ xvid_enc_create.num_plugins++;
+ } else if( xvid_flags & CODEC_FLAG_PASS2 ) {
+ rc2pass2.version = XVID_VERSION;
+ rc2pass2.bitrate = avctx->bit_rate;
+
+ fd = ff_tempfile("xvidff.", &x->twopassfile);
+ if( fd == -1 ) {
+ av_log(avctx, AV_LOG_ERROR,
+ "Xvid: Cannot write 2-pass pipe\n");
+ return -1;
+ }
+
+ if( avctx->stats_in == NULL ) {
+ av_log(avctx, AV_LOG_ERROR,
+ "Xvid: No 2-pass information loaded for second pass\n");
+ return -1;
+ }
+
+ if( strlen(avctx->stats_in) >
+ write(fd, avctx->stats_in, strlen(avctx->stats_in)) ) {
+ close(fd);
+ av_log(avctx, AV_LOG_ERROR,
+ "Xvid: Cannot write to 2-pass pipe\n");
+ return -1;
+ }
+
+ close(fd);
+ rc2pass2.filename = x->twopassfile;
+ plugins[xvid_enc_create.num_plugins].func = xvid_plugin_2pass2;
+ plugins[xvid_enc_create.num_plugins].param = &rc2pass2;
+ xvid_enc_create.num_plugins++;
+ } else if( !(xvid_flags & CODEC_FLAG_QSCALE) ) {
+ /* Single Pass Bitrate Control! */
+ single.version = XVID_VERSION;
+ single.bitrate = avctx->bit_rate;
+
+ plugins[xvid_enc_create.num_plugins].func = xvid_plugin_single;
+ plugins[xvid_enc_create.num_plugins].param = &single;
+ xvid_enc_create.num_plugins++;
+ }
+
+ /* Luminance Masking */
+ if( 0.0 != avctx->lumi_masking ) {
+ plugins[xvid_enc_create.num_plugins].func = xvid_plugin_lumimasking;
+ plugins[xvid_enc_create.num_plugins].param = NULL;
+ xvid_enc_create.num_plugins++;
+ }
+
+ /* Frame Rate and Key Frames */
+ xvid_correct_framerate(avctx);
+ xvid_enc_create.fincr = avctx->time_base.num;
+ xvid_enc_create.fbase = avctx->time_base.den;
+ if( avctx->gop_size > 0 )
+ xvid_enc_create.max_key_interval = avctx->gop_size;
+ else
+ xvid_enc_create.max_key_interval = 240; /* Xvid's best default */
+
+ /* Quants */
+ if( xvid_flags & CODEC_FLAG_QSCALE ) x->qscale = 1;
+ else x->qscale = 0;
+
+ xvid_enc_create.min_quant[0] = avctx->qmin;
+ xvid_enc_create.min_quant[1] = avctx->qmin;
+ xvid_enc_create.min_quant[2] = avctx->qmin;
+ xvid_enc_create.max_quant[0] = avctx->qmax;
+ xvid_enc_create.max_quant[1] = avctx->qmax;
+ xvid_enc_create.max_quant[2] = avctx->qmax;
+
+ /* Quant Matrices */
+ x->intra_matrix = x->inter_matrix = NULL;
+ if( avctx->mpeg_quant )
+ x->vol_flags |= XVID_VOL_MPEGQUANT;
+ if( (avctx->intra_matrix || avctx->inter_matrix) ) {
+ x->vol_flags |= XVID_VOL_MPEGQUANT;
+
+ if( avctx->intra_matrix ) {
+ intra = avctx->intra_matrix;
+ x->intra_matrix = av_malloc(sizeof(unsigned char) * 64);
+ } else
+ intra = NULL;
+ if( avctx->inter_matrix ) {
+ inter = avctx->inter_matrix;
+ x->inter_matrix = av_malloc(sizeof(unsigned char) * 64);
+ } else
+ inter = NULL;
+
+ for( i = 0; i < 64; i++ ) {
+ if( intra )
+ x->intra_matrix[i] = (unsigned char)intra[i];
+ if( inter )
+ x->inter_matrix[i] = (unsigned char)inter[i];
+ }
+ }
+
+ /* Misc Settings */
+ xvid_enc_create.frame_drop_ratio = 0;
+ xvid_enc_create.global = 0;
+ if( xvid_flags & CODEC_FLAG_CLOSED_GOP )
+ xvid_enc_create.global |= XVID_GLOBAL_CLOSED_GOP;
+
+ /* Determines which codec mode we are operating in */
+ avctx->extradata = NULL;
+ avctx->extradata_size = 0;
+ if( xvid_flags & CODEC_FLAG_GLOBAL_HEADER ) {
+ /* In this case, we are claiming to be MPEG4 */
+ x->quicktime_format = 1;
+ avctx->codec_id = AV_CODEC_ID_MPEG4;
+ } else {
+ /* We are claiming to be Xvid */
+ x->quicktime_format = 0;
+ if(!avctx->codec_tag)
+ avctx->codec_tag = AV_RL32("xvid");
+ }
+
+ /* Bframes */
+ xvid_enc_create.max_bframes = avctx->max_b_frames;
+ xvid_enc_create.bquant_offset = 100 * avctx->b_quant_offset;
+ xvid_enc_create.bquant_ratio = 100 * avctx->b_quant_factor;
+ if( avctx->max_b_frames > 0 && !x->quicktime_format ) xvid_enc_create.global |= XVID_GLOBAL_PACKED;
+
+ /* Create encoder context */
+ xerr = xvid_encore(NULL, XVID_ENC_CREATE, &xvid_enc_create, NULL);
+ if( xerr ) {
+ av_log(avctx, AV_LOG_ERROR, "Xvid: Could not create encoder reference\n");
+ return -1;
+ }
+
+ x->encoder_handle = xvid_enc_create.handle;
+ avctx->coded_frame = &x->encoded_picture;
+
+ return 0;
+}
+
+static int xvid_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
+ const AVFrame *picture, int *got_packet)
+{
+ int xerr, i, ret, user_packet = !!pkt->data;
+ char *tmp;
+ struct xvid_context *x = avctx->priv_data;
+ AVFrame *p = &x->encoded_picture;
+ int mb_width = (avctx->width + 15) / 16;
+ int mb_height = (avctx->height + 15) / 16;
+
+ xvid_enc_frame_t xvid_enc_frame = { 0 };
+ xvid_enc_stats_t xvid_enc_stats = { 0 };
+
+ if (!user_packet &&
+ (ret = av_new_packet(pkt, mb_width*mb_height*MAX_MB_BYTES + FF_MIN_BUFFER_SIZE)) < 0) {
+ av_log(avctx, AV_LOG_ERROR, "Error getting output packet.\n");
+ return ret;
+ }
+
+ /* Start setting up the frame */
+ xvid_enc_frame.version = XVID_VERSION;
+ xvid_enc_stats.version = XVID_VERSION;
+ *p = *picture;
+
+ /* Let Xvid know where to put the frame. */
+ xvid_enc_frame.bitstream = pkt->data;
+ xvid_enc_frame.length = pkt->size;
+
+ /* Initialize input image fields */
+ if( avctx->pix_fmt != AV_PIX_FMT_YUV420P ) {
+ av_log(avctx, AV_LOG_ERROR, "Xvid: Color spaces other than 420p not supported\n");
+ return -1;
+ }
+
+ xvid_enc_frame.input.csp = XVID_CSP_PLANAR; /* YUV420P */
+
+ for( i = 0; i < 4; i++ ) {
+ xvid_enc_frame.input.plane[i] = picture->data[i];
+ xvid_enc_frame.input.stride[i] = picture->linesize[i];
+ }
+
+ /* Encoder Flags */
+ xvid_enc_frame.vop_flags = x->vop_flags;
+ xvid_enc_frame.vol_flags = x->vol_flags;
+ xvid_enc_frame.motion = x->me_flags;
+ xvid_enc_frame.type =
+ picture->pict_type == AV_PICTURE_TYPE_I ? XVID_TYPE_IVOP :
+ picture->pict_type == AV_PICTURE_TYPE_P ? XVID_TYPE_PVOP :
+ picture->pict_type == AV_PICTURE_TYPE_B ? XVID_TYPE_BVOP :
+ XVID_TYPE_AUTO;
+
+ /* Pixel aspect ratio setting */
+ if (avctx->sample_aspect_ratio.num < 1 || avctx->sample_aspect_ratio.num > 255 ||
+ avctx->sample_aspect_ratio.den < 1 || avctx->sample_aspect_ratio.den > 255) {
+ av_log(avctx, AV_LOG_ERROR, "Invalid pixel aspect ratio %i/%i\n",
+ avctx->sample_aspect_ratio.num, avctx->sample_aspect_ratio.den);
+ return -1;
+ }
+ xvid_enc_frame.par = XVID_PAR_EXT;
+ xvid_enc_frame.par_width = avctx->sample_aspect_ratio.num;
+ xvid_enc_frame.par_height = avctx->sample_aspect_ratio.den;
+
+ /* Quant Setting */
+ if( x->qscale ) xvid_enc_frame.quant = picture->quality / FF_QP2LAMBDA;
+ else xvid_enc_frame.quant = 0;
+
+ /* Matrices */
+ xvid_enc_frame.quant_intra_matrix = x->intra_matrix;
+ xvid_enc_frame.quant_inter_matrix = x->inter_matrix;
+
+ /* Encode */
+ xerr = xvid_encore(x->encoder_handle, XVID_ENC_ENCODE,
+ &xvid_enc_frame, &xvid_enc_stats);
+
+ /* Two-pass log buffer swapping */
+ avctx->stats_out = NULL;
+ if( x->twopassbuffer ) {
+ tmp = x->old_twopassbuffer;
+ x->old_twopassbuffer = x->twopassbuffer;
+ x->twopassbuffer = tmp;
+ x->twopassbuffer[0] = 0;
+ if( x->old_twopassbuffer[0] != 0 ) {
+ avctx->stats_out = x->old_twopassbuffer;
+ }
+ }
+
+ if (xerr > 0) {
+ *got_packet = 1;
+
+ p->quality = xvid_enc_stats.quant * FF_QP2LAMBDA;
+ if( xvid_enc_stats.type == XVID_TYPE_PVOP )
+ p->pict_type = AV_PICTURE_TYPE_P;
+ else if( xvid_enc_stats.type == XVID_TYPE_BVOP )
+ p->pict_type = AV_PICTURE_TYPE_B;
+ else if( xvid_enc_stats.type == XVID_TYPE_SVOP )
+ p->pict_type = AV_PICTURE_TYPE_S;
+ else
+ p->pict_type = AV_PICTURE_TYPE_I;
+ if( xvid_enc_frame.out_flags & XVID_KEYFRAME ) {
+ p->key_frame = 1;
+ pkt->flags |= AV_PKT_FLAG_KEY;
+ if( x->quicktime_format )
+ return xvid_strip_vol_header(avctx, pkt,
+ xvid_enc_stats.hlength, xerr);
+ } else
+ p->key_frame = 0;
+
+ pkt->size = xerr;
+
+ return 0;
+ } else {
+ if (!user_packet)
+ av_free_packet(pkt);
+ if (!xerr)
+ return 0;
+ av_log(avctx, AV_LOG_ERROR, "Xvid: Encoding Error Occurred: %i\n", xerr);
+ return -1;
+ }
+}
+
+static av_cold int xvid_encode_close(AVCodecContext *avctx) {
+ struct xvid_context *x = avctx->priv_data;
+
+ xvid_encore(x->encoder_handle, XVID_ENC_DESTROY, NULL, NULL);
+
+ av_freep(&avctx->extradata);
+ if( x->twopassbuffer != NULL ) {
+ av_free(x->twopassbuffer);
+ av_free(x->old_twopassbuffer);
+ }
+ av_free(x->twopassfile);
+ av_free(x->intra_matrix);
+ av_free(x->inter_matrix);
+
+ return 0;
+}
+
+AVCodec ff_libxvid_encoder = {
+ .name = "libxvid",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .id = AV_CODEC_ID_MPEG4,
+ .priv_data_size = sizeof(struct xvid_context),
+ .init = xvid_encode_init,
+ .encode2 = xvid_encode_frame,
+ .close = xvid_encode_close,
+ .pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_YUV420P, AV_PIX_FMT_NONE },
+ .long_name = NULL_IF_CONFIG_SMALL("libxvidcore MPEG-4 part 2"),
+};
diff --git a/gst-libs/ext/libav/libavcodec/libxvid.h b/gst-libs/ext/libav/libavcodec/libxvid.h
new file mode 100644
index 0000000..413d353
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/libxvid.h
@@ -0,0 +1,32 @@
+/*
+ * copyright (C) 2006 Corey Hickey
+ *
+ * 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
+ */
+
+#ifndef AVCODEC_LIBXVID_H
+#define AVCODEC_LIBXVID_H
+
+/**
+ * @file
+ * common functions for use with the Xvid wrappers
+ */
+
+
+int ff_tempfile(const char *prefix, char **filename);
+
+#endif /* AVCODEC_LIBXVID_H */
diff --git a/gst-libs/ext/libav/libavcodec/libxvid_internal.h b/gst-libs/ext/libav/libavcodec/libxvid_internal.h
deleted file mode 100644
index a2dc6ef..0000000
--- a/gst-libs/ext/libav/libavcodec/libxvid_internal.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * copyright (C) 2006 Corey Hickey
- *
- * 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
- */
-
-#ifndef AVCODEC_LIBXVID_INTERNAL_H
-#define AVCODEC_LIBXVID_INTERNAL_H
-
-/**
- * @file
- * common functions for use with the Xvid wrappers
- */
-
-
-int ff_tempfile(const char *prefix, char **filename);
-
-#endif /* AVCODEC_LIBXVID_INTERNAL_H */
diff --git a/gst-libs/ext/libav/libavcodec/libxvid_rc.c b/gst-libs/ext/libav/libavcodec/libxvid_rc.c
index b4bc715..bf9f6f0 100644
--- a/gst-libs/ext/libav/libavcodec/libxvid_rc.c
+++ b/gst-libs/ext/libav/libavcodec/libxvid_rc.c
@@ -20,25 +20,62 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "config.h"
#include <xvid.h>
#include <unistd.h>
+#if !HAVE_MKSTEMP
+#include <fcntl.h>
+#endif
+
#include "avcodec.h"
-#include "libxvid_internal.h"
+#include "libxvid.h"
//#include "dsputil.h"
#include "mpegvideo.h"
#undef NDEBUG
#include <assert.h>
-extern unsigned int xvid_debug;
+/* Wrapper to work around the lack of mkstemp() on mingw.
+ * Also, tries to create file in /tmp first, if possible.
+ * *prefix can be a character constant; *filename will be allocated internally.
+ * @return file descriptor of opened file (or -1 on error)
+ * and opened file name in **filename. */
+int ff_tempfile(const char *prefix, char **filename) {
+ int fd=-1;
+#if !HAVE_MKSTEMP
+ *filename = tempnam(".", prefix);
+#else
+ size_t len = strlen(prefix) + 12; /* room for "/tmp/" and "XXXXXX\0" */
+ *filename = av_malloc(len);
+#endif
+ /* -----common section-----*/
+ if (*filename == NULL) {
+ av_log(NULL, AV_LOG_ERROR, "ff_tempfile: Cannot allocate file name\n");
+ return -1;
+ }
+#if !HAVE_MKSTEMP
+ fd = open(*filename, O_RDWR | O_BINARY | O_CREAT, 0444);
+#else
+ snprintf(*filename, len, "/tmp/%sXXXXXX", prefix);
+ fd = mkstemp(*filename);
+ if (fd < 0) {
+ snprintf(*filename, len, "./%sXXXXXX", prefix);
+ fd = mkstemp(*filename);
+ }
+#endif
+ /* -----common section-----*/
+ if (fd < 0) {
+ av_log(NULL, AV_LOG_ERROR, "ff_tempfile: Cannot open temporary file %s\n", *filename);
+ return -1;
+ }
+ return fd; /* success */
+}
int ff_xvid_rate_control_init(MpegEncContext *s){
char *tmp_name;
int fd, i;
- xvid_plg_create_t xvid_plg_create;
- xvid_plugin_2pass2_t xvid_2pass2;
-
-//xvid_debug=-1;
+ xvid_plg_create_t xvid_plg_create = { 0 };
+ xvid_plugin_2pass2_t xvid_2pass2 = { 0 };
fd=ff_tempfile("xvidrc.", &tmp_name);
if (fd == -1) {
@@ -47,7 +84,7 @@ int ff_xvid_rate_control_init(MpegEncContext *s){
}
for(i=0; i<s->rc_context.num_entries; i++){
- static const char *frame_types = " ipbs";
+ static const char frame_types[] = " ipbs";
char tmp[256];
RateControlEntry *rce;
@@ -57,13 +94,11 @@ int ff_xvid_rate_control_init(MpegEncContext *s){
frame_types[rce->pict_type], (int)lrintf(rce->qscale / FF_QP2LAMBDA), rce->i_count, s->mb_num - rce->i_count - rce->skip_count,
rce->skip_count, (rce->i_tex_bits + rce->p_tex_bits + rce->misc_bits+7)/8, (rce->header_bits+rce->mv_bits+7)/8);
-//av_log(NULL, AV_LOG_ERROR, "%s\n", tmp);
write(fd, tmp, strlen(tmp));
}
close(fd);
- memset(&xvid_2pass2, 0, sizeof(xvid_2pass2));
xvid_2pass2.version= XVID_MAKE_VERSION(1,1,0);
xvid_2pass2.filename= tmp_name;
xvid_2pass2.bitrate= s->avctx->bit_rate;
@@ -71,7 +106,6 @@ int ff_xvid_rate_control_init(MpegEncContext *s){
xvid_2pass2.vbv_maxrate= s->avctx->rc_max_rate;
xvid_2pass2.vbv_initial= s->avctx->rc_initial_buffer_occupancy;
- memset(&xvid_plg_create, 0, sizeof(xvid_plg_create));
xvid_plg_create.version= XVID_MAKE_VERSION(1,1,0);
xvid_plg_create.fbase= s->avctx->time_base.den;
xvid_plg_create.fincr= s->avctx->time_base.num;
@@ -85,9 +119,8 @@ int ff_xvid_rate_control_init(MpegEncContext *s){
}
float ff_xvid_rate_estimate_qscale(MpegEncContext *s, int dry_run){
- xvid_plg_data_t xvid_plg_data;
+ xvid_plg_data_t xvid_plg_data = { 0 };
- memset(&xvid_plg_data, 0, sizeof(xvid_plg_data));
xvid_plg_data.version= XVID_MAKE_VERSION(1,1,0);
xvid_plg_data.width = s->width;
xvid_plg_data.height= s->height;
@@ -104,10 +137,6 @@ float ff_xvid_rate_estimate_qscale(MpegEncContext *s, int dry_run){
xvid_plg_data.bquant_offset = 0; // 100 * s->avctx->b_quant_offset;
xvid_plg_data.bquant_ratio = 100; // * s->avctx->b_quant_factor;
-#if 0
- xvid_plg_data.stats.hlength= X
-#endif
-
if(!s->rc_context.dry_run_qscale){
if(s->picture_number){
xvid_plg_data.length=
@@ -145,4 +174,3 @@ void ff_xvid_rate_control_uninit(MpegEncContext *s){
xvid_plugin_2pass2(s->rc_context.non_lavc_opaque, XVID_PLG_DESTROY, &xvid_plg_destroy, NULL);
}
-
diff --git a/gst-libs/ext/libav/libavcodec/libxvidff.c b/gst-libs/ext/libav/libavcodec/libxvidff.c
deleted file mode 100644
index a11e4ac..0000000
--- a/gst-libs/ext/libav/libavcodec/libxvidff.c
+++ /dev/null
@@ -1,823 +0,0 @@
-/*
- * Interface to xvidcore for mpeg4 encoding
- * Copyright (c) 2004 Adam Thayer <krevnik@comcast.net>
- *
- * 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
- * Interface to xvidcore for MPEG-4 compliant encoding.
- * @author Adam Thayer (krevnik@comcast.net)
- */
-
-#include <xvid.h>
-#include <unistd.h>
-#include "avcodec.h"
-#include "libavutil/cpu.h"
-#include "libavutil/intreadwrite.h"
-#include "libavutil/mathematics.h"
-#include "libxvid_internal.h"
-#if !HAVE_MKSTEMP
-#include <fcntl.h>
-#endif
-
-/**
- * Buffer management macros.
- */
-#define BUFFER_SIZE 1024
-#define BUFFER_REMAINING(x) (BUFFER_SIZE - strlen(x))
-#define BUFFER_CAT(x) (&((x)[strlen(x)]))
-
-/**
- * Structure for the private Xvid context.
- * This stores all the private context for the codec.
- */
-struct xvid_context {
- void *encoder_handle; /**< Handle for Xvid encoder */
- int xsize; /**< Frame x size */
- int ysize; /**< Frame y size */
- int vop_flags; /**< VOP flags for Xvid encoder */
- int vol_flags; /**< VOL flags for Xvid encoder */
- int me_flags; /**< Motion Estimation flags */
- int qscale; /**< Do we use constant scale? */
- int quicktime_format; /**< Are we in a QT-based format? */
- AVFrame encoded_picture; /**< Encoded frame information */
- char *twopassbuffer; /**< Character buffer for two-pass */
- char *old_twopassbuffer; /**< Old character buffer (two-pass) */
- char *twopassfile; /**< second pass temp file name */
- unsigned char *intra_matrix; /**< P-Frame Quant Matrix */
- unsigned char *inter_matrix; /**< I-Frame Quant Matrix */
-};
-
-/**
- * Structure for the private first-pass plugin.
- */
-struct xvid_ff_pass1 {
- int version; /**< Xvid version */
- struct xvid_context *context; /**< Pointer to private context */
-};
-
-/* Prototypes - See function implementation for details */
-int xvid_strip_vol_header(AVCodecContext *avctx, unsigned char *frame, unsigned int header_len, unsigned int frame_len);
-int xvid_ff_2pass(void *ref, int opt, void *p1, void *p2);
-void xvid_correct_framerate(AVCodecContext *avctx);
-
-/* Wrapper to work around the lack of mkstemp() on mingw.
- * Also, tries to create file in /tmp first, if possible.
- * *prefix can be a character constant; *filename will be allocated internally.
- * @return file descriptor of opened file (or -1 on error)
- * and opened file name in **filename. */
-int ff_tempfile(const char *prefix, char **filename) {
- int fd=-1;
-#if !HAVE_MKSTEMP
- *filename = tempnam(".", prefix);
-#else
- size_t len = strlen(prefix) + 12; /* room for "/tmp/" and "XXXXXX\0" */
- *filename = av_malloc(len);
-#endif
- /* -----common section-----*/
- if (*filename == NULL) {
- av_log(NULL, AV_LOG_ERROR, "ff_tempfile: Cannot allocate file name\n");
- return -1;
- }
-#if !HAVE_MKSTEMP
- fd = open(*filename, O_RDWR | O_BINARY | O_CREAT, 0444);
-#else
- snprintf(*filename, len, "/tmp/%sXXXXXX", prefix);
- fd = mkstemp(*filename);
- if (fd < 0) {
- snprintf(*filename, len, "./%sXXXXXX", prefix);
- fd = mkstemp(*filename);
- }
-#endif
- /* -----common section-----*/
- if (fd < 0) {
- av_log(NULL, AV_LOG_ERROR, "ff_tempfile: Cannot open temporary file %s\n", *filename);
- return -1;
- }
- return fd; /* success */
-}
-
-#if CONFIG_LIBXVID_ENCODER
-
-/**
- * Create the private context for the encoder.
- * All buffers are allocated, settings are loaded from the user,
- * and the encoder context created.
- *
- * @param avctx AVCodecContext pointer to context
- * @return Returns 0 on success, -1 on failure
- */
-static av_cold int xvid_encode_init(AVCodecContext *avctx) {
- int xerr, i;
- int xvid_flags = avctx->flags;
- struct xvid_context *x = avctx->priv_data;
- uint16_t *intra, *inter;
- int fd;
-
- xvid_plugin_single_t single;
- struct xvid_ff_pass1 rc2pass1;
- xvid_plugin_2pass2_t rc2pass2;
- xvid_gbl_init_t xvid_gbl_init;
- xvid_enc_create_t xvid_enc_create;
- xvid_enc_plugin_t plugins[7];
-
- /* Bring in VOP flags from avconv command-line */
- x->vop_flags = XVID_VOP_HALFPEL; /* Bare minimum quality */
- if( xvid_flags & CODEC_FLAG_4MV )
- x->vop_flags |= XVID_VOP_INTER4V; /* Level 3 */
- if( avctx->trellis
- )
- x->vop_flags |= XVID_VOP_TRELLISQUANT; /* Level 5 */
- if( xvid_flags & CODEC_FLAG_AC_PRED )
- x->vop_flags |= XVID_VOP_HQACPRED; /* Level 6 */
- if( xvid_flags & CODEC_FLAG_GRAY )
- x->vop_flags |= XVID_VOP_GREYSCALE;
-
- /* Decide which ME quality setting to use */
- x->me_flags = 0;
- switch( avctx->me_method ) {
- case ME_FULL: /* Quality 6 */
- x->me_flags |= XVID_ME_EXTSEARCH16
- | XVID_ME_EXTSEARCH8;
-
- case ME_EPZS: /* Quality 4 */
- x->me_flags |= XVID_ME_ADVANCEDDIAMOND8
- | XVID_ME_HALFPELREFINE8
- | XVID_ME_CHROMA_PVOP
- | XVID_ME_CHROMA_BVOP;
-
- case ME_LOG: /* Quality 2 */
- case ME_PHODS:
- case ME_X1:
- x->me_flags |= XVID_ME_ADVANCEDDIAMOND16
- | XVID_ME_HALFPELREFINE16;
-
- case ME_ZERO: /* Quality 0 */
- default:
- break;
- }
-
- /* Decide how we should decide blocks */
- switch( avctx->mb_decision ) {
- case 2:
- x->vop_flags |= XVID_VOP_MODEDECISION_RD;
- x->me_flags |= XVID_ME_HALFPELREFINE8_RD
- | XVID_ME_QUARTERPELREFINE8_RD
- | XVID_ME_EXTSEARCH_RD
- | XVID_ME_CHECKPREDICTION_RD;
- case 1:
- if( !(x->vop_flags & XVID_VOP_MODEDECISION_RD) )
- x->vop_flags |= XVID_VOP_FAST_MODEDECISION_RD;
- x->me_flags |= XVID_ME_HALFPELREFINE16_RD
- | XVID_ME_QUARTERPELREFINE16_RD;
-
- default:
- break;
- }
-
- /* Bring in VOL flags from avconv command-line */
- x->vol_flags = 0;
- if( xvid_flags & CODEC_FLAG_GMC ) {
- x->vol_flags |= XVID_VOL_GMC;
- x->me_flags |= XVID_ME_GME_REFINE;
- }
- if( xvid_flags & CODEC_FLAG_QPEL ) {
- x->vol_flags |= XVID_VOL_QUARTERPEL;
- x->me_flags |= XVID_ME_QUARTERPELREFINE16;
- if( x->vop_flags & XVID_VOP_INTER4V )
- x->me_flags |= XVID_ME_QUARTERPELREFINE8;
- }
-
- memset(&xvid_gbl_init, 0, sizeof(xvid_gbl_init));
- xvid_gbl_init.version = XVID_VERSION;
- xvid_gbl_init.debug = 0;
-
-#if ARCH_PPC
- /* Xvid's PPC support is borked, use libavcodec to detect */
-#if HAVE_ALTIVEC
- if (av_get_cpu_flags() & AV_CPU_FLAG_ALTIVEC) {
- xvid_gbl_init.cpu_flags = XVID_CPU_FORCE | XVID_CPU_ALTIVEC;
- } else
-#endif
- xvid_gbl_init.cpu_flags = XVID_CPU_FORCE;
-#else
- /* Xvid can detect on x86 */
- xvid_gbl_init.cpu_flags = 0;
-#endif
-
- /* Initialize */
- xvid_global(NULL, XVID_GBL_INIT, &xvid_gbl_init, NULL);
-
- /* Create the encoder reference */
- memset(&xvid_enc_create, 0, sizeof(xvid_enc_create));
- xvid_enc_create.version = XVID_VERSION;
-
- /* Store the desired frame size */
- xvid_enc_create.width = x->xsize = avctx->width;
- xvid_enc_create.height = x->ysize = avctx->height;
-
- /* Xvid can determine the proper profile to use */
- /* xvid_enc_create.profile = XVID_PROFILE_S_L3; */
-
- /* We don't use zones */
- xvid_enc_create.zones = NULL;
- xvid_enc_create.num_zones = 0;
-
- xvid_enc_create.num_threads = avctx->thread_count;
-
- xvid_enc_create.plugins = plugins;
- xvid_enc_create.num_plugins = 0;
-
- /* Initialize Buffers */
- x->twopassbuffer = NULL;
- x->old_twopassbuffer = NULL;
- x->twopassfile = NULL;
-
- if( xvid_flags & CODEC_FLAG_PASS1 ) {
- memset(&rc2pass1, 0, sizeof(struct xvid_ff_pass1));
- rc2pass1.version = XVID_VERSION;
- rc2pass1.context = x;
- x->twopassbuffer = av_malloc(BUFFER_SIZE);
- x->old_twopassbuffer = av_malloc(BUFFER_SIZE);
- if( x->twopassbuffer == NULL || x->old_twopassbuffer == NULL ) {
- av_log(avctx, AV_LOG_ERROR,
- "Xvid: Cannot allocate 2-pass log buffers\n");
- return -1;
- }
- x->twopassbuffer[0] = x->old_twopassbuffer[0] = 0;
-
- plugins[xvid_enc_create.num_plugins].func = xvid_ff_2pass;
- plugins[xvid_enc_create.num_plugins].param = &rc2pass1;
- xvid_enc_create.num_plugins++;
- } else if( xvid_flags & CODEC_FLAG_PASS2 ) {
- memset(&rc2pass2, 0, sizeof(xvid_plugin_2pass2_t));
- rc2pass2.version = XVID_VERSION;
- rc2pass2.bitrate = avctx->bit_rate;
-
- fd = ff_tempfile("xvidff.", &x->twopassfile);
- if( fd == -1 ) {
- av_log(avctx, AV_LOG_ERROR,
- "Xvid: Cannot write 2-pass pipe\n");
- return -1;
- }
-
- if( avctx->stats_in == NULL ) {
- av_log(avctx, AV_LOG_ERROR,
- "Xvid: No 2-pass information loaded for second pass\n");
- return -1;
- }
-
- if( strlen(avctx->stats_in) >
- write(fd, avctx->stats_in, strlen(avctx->stats_in)) ) {
- close(fd);
- av_log(avctx, AV_LOG_ERROR,
- "Xvid: Cannot write to 2-pass pipe\n");
- return -1;
- }
-
- close(fd);
- rc2pass2.filename = x->twopassfile;
- plugins[xvid_enc_create.num_plugins].func = xvid_plugin_2pass2;
- plugins[xvid_enc_create.num_plugins].param = &rc2pass2;
- xvid_enc_create.num_plugins++;
- } else if( !(xvid_flags & CODEC_FLAG_QSCALE) ) {
- /* Single Pass Bitrate Control! */
- memset(&single, 0, sizeof(xvid_plugin_single_t));
- single.version = XVID_VERSION;
- single.bitrate = avctx->bit_rate;
-
- plugins[xvid_enc_create.num_plugins].func = xvid_plugin_single;
- plugins[xvid_enc_create.num_plugins].param = &single;
- xvid_enc_create.num_plugins++;
- }
-
- /* Luminance Masking */
- if( 0.0 != avctx->lumi_masking ) {
- plugins[xvid_enc_create.num_plugins].func = xvid_plugin_lumimasking;
- plugins[xvid_enc_create.num_plugins].param = NULL;
- xvid_enc_create.num_plugins++;
- }
-
- /* Frame Rate and Key Frames */
- xvid_correct_framerate(avctx);
- xvid_enc_create.fincr = avctx->time_base.num;
- xvid_enc_create.fbase = avctx->time_base.den;
- if( avctx->gop_size > 0 )
- xvid_enc_create.max_key_interval = avctx->gop_size;
- else
- xvid_enc_create.max_key_interval = 240; /* Xvid's best default */
-
- /* Quants */
- if( xvid_flags & CODEC_FLAG_QSCALE ) x->qscale = 1;
- else x->qscale = 0;
-
- xvid_enc_create.min_quant[0] = avctx->qmin;
- xvid_enc_create.min_quant[1] = avctx->qmin;
- xvid_enc_create.min_quant[2] = avctx->qmin;
- xvid_enc_create.max_quant[0] = avctx->qmax;
- xvid_enc_create.max_quant[1] = avctx->qmax;
- xvid_enc_create.max_quant[2] = avctx->qmax;
-
- /* Quant Matrices */
- x->intra_matrix = x->inter_matrix = NULL;
- if( avctx->mpeg_quant )
- x->vol_flags |= XVID_VOL_MPEGQUANT;
- if( (avctx->intra_matrix || avctx->inter_matrix) ) {
- x->vol_flags |= XVID_VOL_MPEGQUANT;
-
- if( avctx->intra_matrix ) {
- intra = avctx->intra_matrix;
- x->intra_matrix = av_malloc(sizeof(unsigned char) * 64);
- } else
- intra = NULL;
- if( avctx->inter_matrix ) {
- inter = avctx->inter_matrix;
- x->inter_matrix = av_malloc(sizeof(unsigned char) * 64);
- } else
- inter = NULL;
-
- for( i = 0; i < 64; i++ ) {
- if( intra )
- x->intra_matrix[i] = (unsigned char)intra[i];
- if( inter )
- x->inter_matrix[i] = (unsigned char)inter[i];
- }
- }
-
- /* Misc Settings */
- xvid_enc_create.frame_drop_ratio = 0;
- xvid_enc_create.global = 0;
- if( xvid_flags & CODEC_FLAG_CLOSED_GOP )
- xvid_enc_create.global |= XVID_GLOBAL_CLOSED_GOP;
-
- /* Determines which codec mode we are operating in */
- avctx->extradata = NULL;
- avctx->extradata_size = 0;
- if( xvid_flags & CODEC_FLAG_GLOBAL_HEADER ) {
- /* In this case, we are claiming to be MPEG4 */
- x->quicktime_format = 1;
- avctx->codec_id = CODEC_ID_MPEG4;
- } else {
- /* We are claiming to be Xvid */
- x->quicktime_format = 0;
- if(!avctx->codec_tag)
- avctx->codec_tag = AV_RL32("xvid");
- }
-
- /* Bframes */
- xvid_enc_create.max_bframes = avctx->max_b_frames;
- xvid_enc_create.bquant_offset = 100 * avctx->b_quant_offset;
- xvid_enc_create.bquant_ratio = 100 * avctx->b_quant_factor;
- if( avctx->max_b_frames > 0 && !x->quicktime_format ) xvid_enc_create.global |= XVID_GLOBAL_PACKED;
-
- /* Create encoder context */
- xerr = xvid_encore(NULL, XVID_ENC_CREATE, &xvid_enc_create, NULL);
- if( xerr ) {
- av_log(avctx, AV_LOG_ERROR, "Xvid: Could not create encoder reference\n");
- return -1;
- }
-
- x->encoder_handle = xvid_enc_create.handle;
- avctx->coded_frame = &x->encoded_picture;
-
- return 0;
-}
-
-/**
- * Encode a single frame.
- *
- * @param avctx AVCodecContext pointer to context
- * @param frame Pointer to encoded frame buffer
- * @param buf_size Size of encoded frame buffer
- * @param data Pointer to AVFrame of unencoded frame
- * @return Returns 0 on success, -1 on failure
- */
-static int xvid_encode_frame(AVCodecContext *avctx,
- unsigned char *frame, int buf_size, void *data) {
- int xerr, i;
- char *tmp;
- struct xvid_context *x = avctx->priv_data;
- AVFrame *picture = data;
- AVFrame *p = &x->encoded_picture;
-
- xvid_enc_frame_t xvid_enc_frame;
- xvid_enc_stats_t xvid_enc_stats;
-
- /* Start setting up the frame */
- memset(&xvid_enc_frame, 0, sizeof(xvid_enc_frame));
- xvid_enc_frame.version = XVID_VERSION;
- memset(&xvid_enc_stats, 0, sizeof(xvid_enc_stats));
- xvid_enc_stats.version = XVID_VERSION;
- *p = *picture;
-
- /* Let Xvid know where to put the frame. */
- xvid_enc_frame.bitstream = frame;
- xvid_enc_frame.length = buf_size;
-
- /* Initialize input image fields */
- if( avctx->pix_fmt != PIX_FMT_YUV420P ) {
- av_log(avctx, AV_LOG_ERROR, "Xvid: Color spaces other than 420p not supported\n");
- return -1;
- }
-
- xvid_enc_frame.input.csp = XVID_CSP_PLANAR; /* YUV420P */
-
- for( i = 0; i < 4; i++ ) {
- xvid_enc_frame.input.plane[i] = picture->data[i];
- xvid_enc_frame.input.stride[i] = picture->linesize[i];
- }
-
- /* Encoder Flags */
- xvid_enc_frame.vop_flags = x->vop_flags;
- xvid_enc_frame.vol_flags = x->vol_flags;
- xvid_enc_frame.motion = x->me_flags;
- xvid_enc_frame.type =
- picture->pict_type == AV_PICTURE_TYPE_I ? XVID_TYPE_IVOP :
- picture->pict_type == AV_PICTURE_TYPE_P ? XVID_TYPE_PVOP :
- picture->pict_type == AV_PICTURE_TYPE_B ? XVID_TYPE_BVOP :
- XVID_TYPE_AUTO;
-
- /* Pixel aspect ratio setting */
- if (avctx->sample_aspect_ratio.num < 1 || avctx->sample_aspect_ratio.num > 255 ||
- avctx->sample_aspect_ratio.den < 1 || avctx->sample_aspect_ratio.den > 255) {
- av_log(avctx, AV_LOG_ERROR, "Invalid pixel aspect ratio %i/%i\n",
- avctx->sample_aspect_ratio.num, avctx->sample_aspect_ratio.den);
- return -1;
- }
- xvid_enc_frame.par = XVID_PAR_EXT;
- xvid_enc_frame.par_width = avctx->sample_aspect_ratio.num;
- xvid_enc_frame.par_height = avctx->sample_aspect_ratio.den;
-
- /* Quant Setting */
- if( x->qscale ) xvid_enc_frame.quant = picture->quality / FF_QP2LAMBDA;
- else xvid_enc_frame.quant = 0;
-
- /* Matrices */
- xvid_enc_frame.quant_intra_matrix = x->intra_matrix;
- xvid_enc_frame.quant_inter_matrix = x->inter_matrix;
-
- /* Encode */
- xerr = xvid_encore(x->encoder_handle, XVID_ENC_ENCODE,
- &xvid_enc_frame, &xvid_enc_stats);
-
- /* Two-pass log buffer swapping */
- avctx->stats_out = NULL;
- if( x->twopassbuffer ) {
- tmp = x->old_twopassbuffer;
- x->old_twopassbuffer = x->twopassbuffer;
- x->twopassbuffer = tmp;
- x->twopassbuffer[0] = 0;
- if( x->old_twopassbuffer[0] != 0 ) {
- avctx->stats_out = x->old_twopassbuffer;
- }
- }
-
- if( 0 <= xerr ) {
- p->quality = xvid_enc_stats.quant * FF_QP2LAMBDA;
- if( xvid_enc_stats.type == XVID_TYPE_PVOP )
- p->pict_type = AV_PICTURE_TYPE_P;
- else if( xvid_enc_stats.type == XVID_TYPE_BVOP )
- p->pict_type = AV_PICTURE_TYPE_B;
- else if( xvid_enc_stats.type == XVID_TYPE_SVOP )
- p->pict_type = AV_PICTURE_TYPE_S;
- else
- p->pict_type = AV_PICTURE_TYPE_I;
- if( xvid_enc_frame.out_flags & XVID_KEYFRAME ) {
- p->key_frame = 1;
- if( x->quicktime_format )
- return xvid_strip_vol_header(avctx, frame,
- xvid_enc_stats.hlength, xerr);
- } else
- p->key_frame = 0;
-
- return xerr;
- } else {
- av_log(avctx, AV_LOG_ERROR, "Xvid: Encoding Error Occurred: %i\n", xerr);
- return -1;
- }
-}
-
-/**
- * Destroy the private context for the encoder.
- * All buffers are freed, and the Xvid encoder context is destroyed.
- *
- * @param avctx AVCodecContext pointer to context
- * @return Returns 0, success guaranteed
- */
-static av_cold int xvid_encode_close(AVCodecContext *avctx) {
- struct xvid_context *x = avctx->priv_data;
-
- xvid_encore(x->encoder_handle, XVID_ENC_DESTROY, NULL, NULL);
-
- av_freep(&avctx->extradata);
- if( x->twopassbuffer != NULL ) {
- av_free(x->twopassbuffer);
- av_free(x->old_twopassbuffer);
- }
- av_free(x->twopassfile);
- av_free(x->intra_matrix);
- av_free(x->inter_matrix);
-
- return 0;
-}
-
-/**
- * Routine to create a global VO/VOL header for MP4 container.
- * What we do here is extract the header from the Xvid bitstream
- * as it is encoded. We also strip the repeated headers from the
- * bitstream when a global header is requested for MPEG-4 ISO
- * compliance.
- *
- * @param avctx AVCodecContext pointer to context
- * @param frame Pointer to encoded frame data
- * @param header_len Length of header to search
- * @param frame_len Length of encoded frame data
- * @return Returns new length of frame data
- */
-int xvid_strip_vol_header(AVCodecContext *avctx,
- unsigned char *frame,
- unsigned int header_len,
- unsigned int frame_len) {
- int vo_len = 0, i;
-
- for( i = 0; i < header_len - 3; i++ ) {
- if( frame[i] == 0x00 &&
- frame[i+1] == 0x00 &&
- frame[i+2] == 0x01 &&
- frame[i+3] == 0xB6 ) {
- vo_len = i;
- break;
- }
- }
-
- if( vo_len > 0 ) {
- /* We need to store the header, so extract it */
- if( avctx->extradata == NULL ) {
- avctx->extradata = av_malloc(vo_len);
- memcpy(avctx->extradata, frame, vo_len);
- avctx->extradata_size = vo_len;
- }
- /* Less dangerous now, memmove properly copies the two
- chunks of overlapping data */
- memmove(frame, &frame[vo_len], frame_len - vo_len);
- return frame_len - vo_len;
- } else
- return frame_len;
-}
-
-/**
- * Routine to correct a possibly erroneous framerate being fed to us.
- * Xvid currently chokes on framerates where the ticks per frame is
- * extremely large. This function works to correct problems in this area
- * by estimating a new framerate and taking the simpler fraction of
- * the two presented.
- *
- * @param avctx Context that contains the framerate to correct.
- */
-void xvid_correct_framerate(AVCodecContext *avctx) {
- int frate, fbase;
- int est_frate, est_fbase;
- int gcd;
- float est_fps, fps;
-
- frate = avctx->time_base.den;
- fbase = avctx->time_base.num;
-
- gcd = av_gcd(frate, fbase);
- if( gcd > 1 ) {
- frate /= gcd;
- fbase /= gcd;
- }
-
- if( frate <= 65000 && fbase <= 65000 ) {
- avctx->time_base.den = frate;
- avctx->time_base.num = fbase;
- return;
- }
-
- fps = (float)frate / (float)fbase;
- est_fps = roundf(fps * 1000.0) / 1000.0;
-
- est_frate = (int)est_fps;
- if( est_fps > (int)est_fps ) {
- est_frate = (est_frate + 1) * 1000;
- est_fbase = (int)roundf((float)est_frate / est_fps);
- } else
- est_fbase = 1;
-
- gcd = av_gcd(est_frate, est_fbase);
- if( gcd > 1 ) {
- est_frate /= gcd;
- est_fbase /= gcd;
- }
-
- if( fbase > est_fbase ) {
- avctx->time_base.den = est_frate;
- avctx->time_base.num = est_fbase;
- av_log(avctx, AV_LOG_DEBUG,
- "Xvid: framerate re-estimated: %.2f, %.3f%% correction\n",
- est_fps, (((est_fps - fps)/fps) * 100.0));
- } else {
- avctx->time_base.den = frate;
- avctx->time_base.num = fbase;
- }
-}
-
-/*
- * Xvid 2-Pass Kludge Section
- *
- * Xvid's default 2-pass doesn't allow us to create data as we need to, so
- * this section spends time replacing the first pass plugin so we can write
- * statistic information as libavcodec requests in. We have another kludge
- * that allows us to pass data to the second pass in Xvid without a custom
- * rate-control plugin.
- */
-
-/**
- * Initialize the two-pass plugin and context.
- *
- * @param param Input construction parameter structure
- * @param handle Private context handle
- * @return Returns XVID_ERR_xxxx on failure, or 0 on success.
- */
-static int xvid_ff_2pass_create(xvid_plg_create_t * param,
- void ** handle) {
- struct xvid_ff_pass1 *x = (struct xvid_ff_pass1 *)param->param;
- char *log = x->context->twopassbuffer;
-
- /* Do a quick bounds check */
- if( log == NULL )
- return XVID_ERR_FAIL;
-
- /* We use snprintf() */
- /* This is because we can safely prevent a buffer overflow */
- log[0] = 0;
- snprintf(log, BUFFER_REMAINING(log),
- "# avconv 2-pass log file, using xvid codec\n");
- snprintf(BUFFER_CAT(log), BUFFER_REMAINING(log),
- "# Do not modify. libxvidcore version: %d.%d.%d\n\n",
- XVID_VERSION_MAJOR(XVID_VERSION),
- XVID_VERSION_MINOR(XVID_VERSION),
- XVID_VERSION_PATCH(XVID_VERSION));
-
- *handle = x->context;
- return 0;
-}
-
-/**
- * Destroy the two-pass plugin context.
- *
- * @param ref Context pointer for the plugin
- * @param param Destrooy context
- * @return Returns 0, success guaranteed
- */
-static int xvid_ff_2pass_destroy(struct xvid_context *ref,
- xvid_plg_destroy_t *param) {
- /* Currently cannot think of anything to do on destruction */
- /* Still, the framework should be here for reference/use */
- if( ref->twopassbuffer != NULL )
- ref->twopassbuffer[0] = 0;
- return 0;
-}
-
-/**
- * Enable fast encode mode during the first pass.
- *
- * @param ref Context pointer for the plugin
- * @param param Frame data
- * @return Returns 0, success guaranteed
- */
-static int xvid_ff_2pass_before(struct xvid_context *ref,
- xvid_plg_data_t *param) {
- int motion_remove;
- int motion_replacements;
- int vop_remove;
-
- /* Nothing to do here, result is changed too much */
- if( param->zone && param->zone->mode == XVID_ZONE_QUANT )
- return 0;
-
- /* We can implement a 'turbo' first pass mode here */
- param->quant = 2;
-
- /* Init values */
- motion_remove = ~XVID_ME_CHROMA_PVOP &
- ~XVID_ME_CHROMA_BVOP &
- ~XVID_ME_EXTSEARCH16 &
- ~XVID_ME_ADVANCEDDIAMOND16;
- motion_replacements = XVID_ME_FAST_MODEINTERPOLATE |
- XVID_ME_SKIP_DELTASEARCH |
- XVID_ME_FASTREFINE16 |
- XVID_ME_BFRAME_EARLYSTOP;
- vop_remove = ~XVID_VOP_MODEDECISION_RD &
- ~XVID_VOP_FAST_MODEDECISION_RD &
- ~XVID_VOP_TRELLISQUANT &
- ~XVID_VOP_INTER4V &
- ~XVID_VOP_HQACPRED;
-
- param->vol_flags &= ~XVID_VOL_GMC;
- param->vop_flags &= vop_remove;
- param->motion_flags &= motion_remove;
- param->motion_flags |= motion_replacements;
-
- return 0;
-}
-
-/**
- * Capture statistic data and write it during first pass.
- *
- * @param ref Context pointer for the plugin
- * @param param Statistic data
- * @return Returns XVID_ERR_xxxx on failure, or 0 on success
- */
-static int xvid_ff_2pass_after(struct xvid_context *ref,
- xvid_plg_data_t *param) {
- char *log = ref->twopassbuffer;
- const char *frame_types = " ipbs";
- char frame_type;
-
- /* Quick bounds check */
- if( log == NULL )
- return XVID_ERR_FAIL;
-
- /* Convert the type given to us into a character */
- if( param->type < 5 && param->type > 0 ) {
- frame_type = frame_types[param->type];
- } else {
- return XVID_ERR_FAIL;
- }
-
- snprintf(BUFFER_CAT(log), BUFFER_REMAINING(log),
- "%c %d %d %d %d %d %d\n",
- frame_type, param->stats.quant, param->stats.kblks, param->stats.mblks,
- param->stats.ublks, param->stats.length, param->stats.hlength);
-
- return 0;
-}
-
-/**
- * Dispatch function for our custom plugin.
- * This handles the dispatch for the Xvid plugin. It passes data
- * on to other functions for actual processing.
- *
- * @param ref Context pointer for the plugin
- * @param cmd The task given for us to complete
- * @param p1 First parameter (varies)
- * @param p2 Second parameter (varies)
- * @return Returns XVID_ERR_xxxx on failure, or 0 on success
- */
-int xvid_ff_2pass(void *ref, int cmd, void *p1, void *p2) {
- switch( cmd ) {
- case XVID_PLG_INFO:
- case XVID_PLG_FRAME:
- return 0;
-
- case XVID_PLG_BEFORE:
- return xvid_ff_2pass_before(ref, p1);
-
- case XVID_PLG_CREATE:
- return xvid_ff_2pass_create(p1, p2);
-
- case XVID_PLG_AFTER:
- return xvid_ff_2pass_after(ref, p1);
-
- case XVID_PLG_DESTROY:
- return xvid_ff_2pass_destroy(ref, p1);
-
- default:
- return XVID_ERR_FAIL;
- }
-}
-
-/**
- * Xvid codec definition for libavcodec.
- */
-AVCodec ff_libxvid_encoder = {
- .name = "libxvid",
- .type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_MPEG4,
- .priv_data_size = sizeof(struct xvid_context),
- .init = xvid_encode_init,
- .encode = xvid_encode_frame,
- .close = xvid_encode_close,
- .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE},
- .long_name= NULL_IF_CONFIG_SMALL("libxvidcore MPEG-4 part 2"),
-};
-
-#endif /* CONFIG_LIBXVID_ENCODER */
diff --git a/gst-libs/ext/libav/libavcodec/ljpegenc.c b/gst-libs/ext/libav/libavcodec/ljpegenc.c
index 6a90338..78ba2c9 100644
--- a/gst-libs/ext/libav/libavcodec/ljpegenc.c
+++ b/gst-libs/ext/libav/libavcodec/ljpegenc.c
@@ -32,21 +32,37 @@
#include "avcodec.h"
#include "dsputil.h"
+#include "internal.h"
#include "mpegvideo.h"
#include "mjpeg.h"
#include "mjpegenc.h"
-static int encode_picture_lossless(AVCodecContext *avctx, unsigned char *buf, int buf_size, void *data){
+static int encode_picture_lossless(AVCodecContext *avctx, AVPacket *pkt,
+ const AVFrame *pict, int *got_packet)
+{
MpegEncContext * const s = avctx->priv_data;
MJpegContext * const m = s->mjpeg_ctx;
- AVFrame *pict = data;
const int width= s->width;
const int height= s->height;
- AVFrame * const p= (AVFrame*)&s->current_picture;
+ AVFrame * const p = &s->current_picture.f;
const int predictor= avctx->prediction_method+1;
+ const int mb_width = (width + s->mjpeg_hsample[0] - 1) / s->mjpeg_hsample[0];
+ const int mb_height = (height + s->mjpeg_vsample[0] - 1) / s->mjpeg_vsample[0];
+ int ret, max_pkt_size = FF_MIN_BUFFER_SIZE;
+
+ if (avctx->pix_fmt == AV_PIX_FMT_BGRA)
+ max_pkt_size += width * height * 3 * 4;
+ else {
+ max_pkt_size += mb_width * mb_height * 3 * 4
+ * s->mjpeg_hsample[0] * s->mjpeg_vsample[0];
+ }
+ if ((ret = ff_alloc_packet(pkt, max_pkt_size)) < 0) {
+ av_log(avctx, AV_LOG_ERROR, "Error getting output packet of size %d.\n", max_pkt_size);
+ return ret;
+ }
- init_put_bits(&s->pb, buf, buf_size);
+ init_put_bits(&s->pb, pkt->data, pkt->size);
*p = *pict;
p->pict_type= AV_PICTURE_TYPE_I;
@@ -56,7 +72,7 @@ static int encode_picture_lossless(AVCodecContext *avctx, unsigned char *buf, in
s->header_bits= put_bits_count(&s->pb);
- if(avctx->pix_fmt == PIX_FMT_BGRA){
+ if(avctx->pix_fmt == AV_PIX_FMT_BGRA){
int x, y, i;
const int linesize= p->linesize[0];
uint16_t (*buffer)[4]= (void *) s->rd_scratchpad;
@@ -104,8 +120,6 @@ static int encode_picture_lossless(AVCodecContext *avctx, unsigned char *buf, in
}
}else{
int mb_x, mb_y, i;
- const int mb_width = (width + s->mjpeg_hsample[0] - 1) / s->mjpeg_hsample[0];
- const int mb_height = (height + s->mjpeg_vsample[0] - 1) / s->mjpeg_vsample[0];
for(mb_y = 0; mb_y < mb_height; mb_y++) {
if(s->pb.buf_end - s->pb.buf - (put_bits_count(&s->pb)>>3) < mb_width * 4 * 3 * s->mjpeg_hsample[0] * s->mjpeg_vsample[0]){
@@ -160,7 +174,6 @@ static int encode_picture_lossless(AVCodecContext *avctx, unsigned char *buf, in
int pred;
ptr = p->data[i] + (linesize * (v * mb_y + y)) + (h * mb_x + x); //FIXME optimize this crap
-//printf("%d %d %d %d %8X\n", mb_x, mb_y, x, y, ptr);
PREDICT(pred, ptr[-linesize-1], ptr[-linesize], ptr[-1], predictor);
if(i==0)
@@ -181,7 +194,11 @@ static int encode_picture_lossless(AVCodecContext *avctx, unsigned char *buf, in
s->picture_number++;
flush_put_bits(&s->pb);
- return put_bits_ptr(&s->pb) - s->pb.buf;
+ pkt->size = put_bits_ptr(&s->pb) - s->pb.buf;
+ pkt->flags |= AV_PKT_FLAG_KEY;
+ *got_packet = 1;
+
+ return 0;
// return (put_bits_count(&f->pb)+7)/8;
}
@@ -189,10 +206,10 @@ static int encode_picture_lossless(AVCodecContext *avctx, unsigned char *buf, in
AVCodec ff_ljpeg_encoder = { //FIXME avoid MPV_* lossless JPEG should not need them
.name = "ljpeg",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_LJPEG,
+ .id = AV_CODEC_ID_LJPEG,
.priv_data_size = sizeof(MpegEncContext),
- .init = MPV_encode_init,
- .encode = encode_picture_lossless,
- .close = MPV_encode_end,
+ .init = ff_MPV_encode_init,
+ .encode2 = encode_picture_lossless,
+ .close = ff_MPV_encode_end,
.long_name = NULL_IF_CONFIG_SMALL("Lossless JPEG"),
};
diff --git a/gst-libs/ext/libav/libavcodec/loco.c b/gst-libs/ext/libav/libavcodec/loco.c
index 919a06b..f783636 100644
--- a/gst-libs/ext/libav/libavcodec/loco.c
+++ b/gst-libs/ext/libav/libavcodec/loco.c
@@ -27,6 +27,7 @@
#include "avcodec.h"
#include "get_bits.h"
#include "golomb.h"
+#include "internal.h"
#include "mathops.h"
enum LOCO_MODE {LOCO_UNKN=0, LOCO_CYUY2=-1, LOCO_CRGB=-2, LOCO_CRGBA=-3, LOCO_CYV12=-4,
@@ -157,20 +158,20 @@ static int loco_decode_plane(LOCOContext *l, uint8_t *data, int width, int heigh
}
static int decode_frame(AVCodecContext *avctx,
- void *data, int *data_size,
+ void *data, int *got_frame,
AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
LOCOContext * const l = avctx->priv_data;
- AVFrame * const p= (AVFrame*)&l->pic;
+ AVFrame * const p = &l->pic;
int decoded;
if(p->data[0])
avctx->release_buffer(avctx, p);
p->reference = 0;
- if(avctx->get_buffer(avctx, p) < 0){
+ if(ff_get_buffer(avctx, p) < 0){
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return -1;
}
@@ -180,52 +181,82 @@ static int decode_frame(AVCodecContext *avctx,
case LOCO_CYUY2: case LOCO_YUY2: case LOCO_UYVY:
decoded = loco_decode_plane(l, p->data[0], avctx->width, avctx->height,
p->linesize[0], buf, buf_size, 1);
+ if (decoded >= buf_size)
+ goto buf_too_small;
buf += decoded; buf_size -= decoded;
+
decoded = loco_decode_plane(l, p->data[1], avctx->width / 2, avctx->height,
p->linesize[1], buf, buf_size, 1);
+ if (decoded >= buf_size)
+ goto buf_too_small;
buf += decoded; buf_size -= decoded;
+
decoded = loco_decode_plane(l, p->data[2], avctx->width / 2, avctx->height,
p->linesize[2], buf, buf_size, 1);
break;
case LOCO_CYV12: case LOCO_YV12:
decoded = loco_decode_plane(l, p->data[0], avctx->width, avctx->height,
p->linesize[0], buf, buf_size, 1);
+ if (decoded >= buf_size)
+ goto buf_too_small;
buf += decoded; buf_size -= decoded;
+
decoded = loco_decode_plane(l, p->data[2], avctx->width / 2, avctx->height / 2,
p->linesize[2], buf, buf_size, 1);
+ if (decoded >= buf_size)
+ goto buf_too_small;
buf += decoded; buf_size -= decoded;
+
decoded = loco_decode_plane(l, p->data[1], avctx->width / 2, avctx->height / 2,
p->linesize[1], buf, buf_size, 1);
break;
case LOCO_CRGB: case LOCO_RGB:
decoded = loco_decode_plane(l, p->data[0] + p->linesize[0]*(avctx->height-1), avctx->width, avctx->height,
-p->linesize[0], buf, buf_size, 3);
+ if (decoded >= buf_size)
+ goto buf_too_small;
buf += decoded; buf_size -= decoded;
+
decoded = loco_decode_plane(l, p->data[0] + p->linesize[0]*(avctx->height-1) + 1, avctx->width, avctx->height,
-p->linesize[0], buf, buf_size, 3);
+ if (decoded >= buf_size)
+ goto buf_too_small;
buf += decoded; buf_size -= decoded;
+
decoded = loco_decode_plane(l, p->data[0] + p->linesize[0]*(avctx->height-1) + 2, avctx->width, avctx->height,
-p->linesize[0], buf, buf_size, 3);
break;
case LOCO_RGBA:
decoded = loco_decode_plane(l, p->data[0], avctx->width, avctx->height,
p->linesize[0], buf, buf_size, 4);
+ if (decoded >= buf_size)
+ goto buf_too_small;
buf += decoded; buf_size -= decoded;
+
decoded = loco_decode_plane(l, p->data[0] + 1, avctx->width, avctx->height,
p->linesize[0], buf, buf_size, 4);
+ if (decoded >= buf_size)
+ goto buf_too_small;
buf += decoded; buf_size -= decoded;
+
decoded = loco_decode_plane(l, p->data[0] + 2, avctx->width, avctx->height,
p->linesize[0], buf, buf_size, 4);
+ if (decoded >= buf_size)
+ goto buf_too_small;
buf += decoded; buf_size -= decoded;
+
decoded = loco_decode_plane(l, p->data[0] + 3, avctx->width, avctx->height,
p->linesize[0], buf, buf_size, 4);
break;
}
- *data_size = sizeof(AVFrame);
+ *got_frame = 1;
*(AVFrame*)data = l->pic;
return buf_size;
+buf_too_small:
+ av_log(avctx, AV_LOG_ERROR, "Input data too small.\n");
+ return AVERROR(EINVAL);
}
static av_cold int decode_init(AVCodecContext *avctx){
@@ -254,16 +285,16 @@ static av_cold int decode_init(AVCodecContext *avctx){
l->mode = AV_RL32(avctx->extradata + 4);
switch(l->mode) {
case LOCO_CYUY2: case LOCO_YUY2: case LOCO_UYVY:
- avctx->pix_fmt = PIX_FMT_YUV422P;
+ avctx->pix_fmt = AV_PIX_FMT_YUV422P;
break;
case LOCO_CRGB: case LOCO_RGB:
- avctx->pix_fmt = PIX_FMT_BGR24;
+ avctx->pix_fmt = AV_PIX_FMT_BGR24;
break;
case LOCO_CYV12: case LOCO_YV12:
- avctx->pix_fmt = PIX_FMT_YUV420P;
+ avctx->pix_fmt = AV_PIX_FMT_YUV420P;
break;
case LOCO_CRGBA: case LOCO_RGBA:
- avctx->pix_fmt = PIX_FMT_RGB32;
+ avctx->pix_fmt = AV_PIX_FMT_RGB32;
break;
default:
av_log(avctx, AV_LOG_INFO, "Unknown colorspace, index = %i\n", l->mode);
@@ -288,11 +319,11 @@ static av_cold int decode_end(AVCodecContext *avctx){
AVCodec ff_loco_decoder = {
.name = "loco",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_LOCO,
+ .id = AV_CODEC_ID_LOCO,
.priv_data_size = sizeof(LOCOContext),
.init = decode_init,
.close = decode_end,
.decode = decode_frame,
.capabilities = CODEC_CAP_DR1,
- .long_name = NULL_IF_CONFIG_SMALL("LOCO"),
+ .long_name = NULL_IF_CONFIG_SMALL("LOCO"),
};
diff --git a/gst-libs/ext/libav/libavcodec/log2_tab.c b/gst-libs/ext/libav/libavcodec/log2_tab.c
new file mode 100644
index 0000000..47a1df0
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/log2_tab.c
@@ -0,0 +1 @@
+#include "libavutil/log2_tab.c"
diff --git a/gst-libs/ext/libav/libavcodec/lpc.c b/gst-libs/ext/libav/libavcodec/lpc.c
index d1833cb..2093e7e 100644
--- a/gst-libs/ext/libav/libavcodec/lpc.c
+++ b/gst-libs/ext/libav/libavcodec/lpc.c
@@ -1,4 +1,4 @@
-/**
+/*
* LPC utility code
* Copyright (c) 2006 Justin Ruggles <justin.ruggles@gmail.com>
*
@@ -19,6 +19,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "libavutil/common.h"
#include "libavutil/lls.h"
#define LPC_USE_DOUBLE
@@ -147,6 +148,18 @@ static int estimate_best_order(double *ref, int min_order, int max_order)
return est;
}
+int ff_lpc_calc_ref_coefs(LPCContext *s,
+ const int32_t *samples, int order, double *ref)
+{
+ double autoc[MAX_LPC_ORDER + 1];
+
+ s->lpc_apply_welch_window(samples, s->blocksize, s->windowed_samples);
+ s->lpc_compute_autocorr(s->windowed_samples, s->blocksize, order, autoc);
+ compute_ref_coefs(autoc, order, ref, NULL);
+
+ return order;
+}
+
/**
* Calculate LPC coefficients for multiple orders
*
@@ -177,11 +190,9 @@ int ff_lpc_calc_coefs(LPCContext *s,
}
if (lpc_type == FF_LPC_TYPE_LEVINSON) {
- double *windowed_samples = s->windowed_samples + max_order;
-
- s->lpc_apply_welch_window(samples, blocksize, windowed_samples);
+ s->lpc_apply_welch_window(samples, blocksize, s->windowed_samples);
- s->lpc_compute_autocorr(windowed_samples, blocksize, max_order, autoc);
+ s->lpc_compute_autocorr(s->windowed_samples, blocksize, max_order, autoc);
compute_lpc_coefs(autoc, max_order, &lpc[0][0], MAX_LPC_ORDER, 0, 1);
@@ -247,10 +258,11 @@ av_cold int ff_lpc_init(LPCContext *s, int blocksize, int max_order,
s->lpc_type = lpc_type;
if (lpc_type == FF_LPC_TYPE_LEVINSON) {
- s->windowed_samples = av_mallocz((blocksize + max_order + 2) *
- sizeof(*s->windowed_samples));
- if (!s->windowed_samples)
+ s->windowed_buffer = av_mallocz((blocksize + 2 + FFALIGN(max_order, 4)) *
+ sizeof(*s->windowed_samples));
+ if (!s->windowed_buffer)
return AVERROR(ENOMEM);
+ s->windowed_samples = s->windowed_buffer + FFALIGN(max_order, 4);
} else {
s->windowed_samples = NULL;
}
@@ -258,7 +270,7 @@ av_cold int ff_lpc_init(LPCContext *s, int blocksize, int max_order,
s->lpc_apply_welch_window = lpc_apply_welch_window_c;
s->lpc_compute_autocorr = lpc_compute_autocorr_c;
- if (HAVE_MMX)
+ if (ARCH_X86)
ff_lpc_init_x86(s);
return 0;
@@ -266,5 +278,5 @@ av_cold int ff_lpc_init(LPCContext *s, int blocksize, int max_order,
av_cold void ff_lpc_end(LPCContext *s)
{
- av_freep(&s->windowed_samples);
+ av_freep(&s->windowed_buffer);
}
diff --git a/gst-libs/ext/libav/libavcodec/lpc.h b/gst-libs/ext/libav/libavcodec/lpc.h
index 2a944b6..6590608 100644
--- a/gst-libs/ext/libav/libavcodec/lpc.h
+++ b/gst-libs/ext/libav/libavcodec/lpc.h
@@ -1,4 +1,4 @@
-/**
+/*
* LPC utility code
* Copyright (c) 2006 Justin Ruggles <justin.ruggles@gmail.com>
*
@@ -51,6 +51,7 @@ typedef struct LPCContext {
int blocksize;
int max_order;
enum FFLPCType lpc_type;
+ double *windowed_buffer;
double *windowed_samples;
/**
@@ -91,6 +92,9 @@ int ff_lpc_calc_coefs(LPCContext *s,
enum FFLPCType lpc_type, int lpc_passes,
int omethod, int max_shift, int zero_shift);
+int ff_lpc_calc_ref_coefs(LPCContext *s,
+ const int32_t *samples, int order, double *ref);
+
/**
* Initialize LPCContext.
*/
@@ -110,6 +114,37 @@ void ff_lpc_end(LPCContext *s);
#endif
/**
+ * Schur recursion.
+ * Produces reflection coefficients from autocorrelation data.
+ */
+static inline void compute_ref_coefs(const LPC_TYPE *autoc, int max_order,
+ LPC_TYPE *ref, LPC_TYPE *error)
+{
+ int i, j;
+ LPC_TYPE err;
+ LPC_TYPE gen0[MAX_LPC_ORDER], gen1[MAX_LPC_ORDER];
+
+ for (i = 0; i < max_order; i++)
+ gen0[i] = gen1[i] = autoc[i + 1];
+
+ err = autoc[0];
+ ref[0] = -gen1[0] / err;
+ err += gen1[0] * ref[0];
+ if (error)
+ error[0] = err;
+ for (i = 1; i < max_order; i++) {
+ for (j = 0; j < max_order - i; j++) {
+ gen1[j] = gen1[j + 1] + ref[i - 1] * gen0[j];
+ gen0[j] = gen1[j + 1] * ref[i - 1] + gen0[j];
+ }
+ ref[i] = -gen1[0] / err;
+ err += gen1[0] * ref[i];
+ if (error)
+ error[i] = err;
+ }
+}
+
+/**
* Levinson-Durbin recursion.
* Produce LPC coefficients from autocorrelation data.
*/
diff --git a/gst-libs/ext/libav/libavcodec/lsp.c b/gst-libs/ext/libav/libavcodec/lsp.c
index 2adc9cf..8a05aed 100644
--- a/gst-libs/ext/libav/libavcodec/lsp.c
+++ b/gst-libs/ext/libav/libavcodec/lsp.c
@@ -27,7 +27,6 @@
#define FRAC_BITS 14
#include "mathops.h"
#include "lsp.h"
-#include "celp_math.h"
void ff_acelp_reorder_lsf(int16_t* lsfq, int lsfq_min_distance, int lsfq_min, int lsfq_max, int lp_order)
{
@@ -55,6 +54,30 @@ void ff_set_min_dist_lsf(float *lsf, double min_spacing, int size)
prev = lsf[i] = FFMAX(lsf[i], prev + min_spacing);
}
+
+/* Cosine table: base_cos[i] = (1 << 15) * cos(i * PI / 64) */
+static const int16_t tab_cos[65] =
+{
+ 32767, 32738, 32617, 32421, 32145, 31793, 31364, 30860,
+ 30280, 29629, 28905, 28113, 27252, 26326, 25336, 24285,
+ 23176, 22011, 20793, 19525, 18210, 16851, 15451, 14014,
+ 12543, 11043, 9515, 7965, 6395, 4810, 3214, 1609,
+ 1, -1607, -3211, -4808, -6393, -7962, -9513, -11040,
+ -12541, -14012, -15449, -16848, -18207, -19523, -20791, -22009,
+ -23174, -24283, -25334, -26324, -27250, -28111, -28904, -29627,
+ -30279, -30858, -31363, -31792, -32144, -32419, -32616, -32736, -32768,
+};
+
+static int16_t ff_cos(uint16_t arg)
+{
+ uint8_t offset= arg;
+ uint8_t ind = arg >> 8;
+
+ assert(arg <= 0x3fff);
+
+ return tab_cos[ind] + (offset * (tab_cos[ind+1] - tab_cos[ind]) >> 8);
+}
+
void ff_acelp_lsf2lsp(int16_t *lsp, const int16_t *lsf, int lp_order)
{
int i;
diff --git a/gst-libs/ext/libav/libavcodec/lzw.c b/gst-libs/ext/libav/libavcodec/lzw.c
index b674d4e..2c99014 100644
--- a/gst-libs/ext/libav/libavcodec/lzw.c
+++ b/gst-libs/ext/libav/libavcodec/lzw.c
@@ -29,6 +29,7 @@
#include "avcodec.h"
#include "lzw.h"
+#include "libavutil/mem.h"
#define LZW_MAXBITS 12
#define LZW_SIZTABLE (1<<LZW_MAXBITS)
@@ -102,7 +103,7 @@ void ff_lzw_decode_tail(LZWState *p)
if(s->mode == FF_LZW_GIF) {
while (s->bs > 0) {
- if (s->pbuf + s->bs >= s->ebuf) {
+ if (s->bs >= s->ebuf - s->pbuf) {
s->pbuf = s->ebuf;
break;
} else {
diff --git a/gst-libs/ext/libav/libavcodec/mace.c b/gst-libs/ext/libav/libavcodec/mace.c
index 792d71d..c78a207 100644
--- a/gst-libs/ext/libav/libavcodec/mace.c
+++ b/gst-libs/ext/libav/libavcodec/mace.c
@@ -25,6 +25,8 @@
*/
#include "avcodec.h"
+#include "internal.h"
+#include "libavutil/common.h"
/*
* Adapted to libavcodec by Francois Revol <revol@free.fr>
@@ -186,9 +188,7 @@ static int16_t read_table(ChannelData *chd, uint8_t val, int tab_idx)
return current;
}
-static void chomp3(ChannelData *chd, int16_t *output, uint8_t val,
- int tab_idx,
- uint32_t numChannels)
+static void chomp3(ChannelData *chd, int16_t *output, uint8_t val, int tab_idx)
{
int16_t current = read_table(chd, val, tab_idx);
@@ -199,9 +199,7 @@ static void chomp3(ChannelData *chd, int16_t *output, uint8_t val,
*output = QT_8S_2_16S(current);
}
-static void chomp6(ChannelData *chd, int16_t *output, uint8_t val,
- int tab_idx,
- uint32_t numChannels)
+static void chomp6(ChannelData *chd, int16_t *output, uint8_t val, int tab_idx)
{
int16_t current = read_table(chd, val, tab_idx);
@@ -221,8 +219,8 @@ static void chomp6(ChannelData *chd, int16_t *output, uint8_t val,
output[0] = QT_8S_2_16S(chd->previous + chd->prev2 -
((chd->prev2-current) >> 2));
- output[numChannels] = QT_8S_2_16S(chd->previous + current +
- ((chd->prev2-current) >> 2));
+ output[1] = QT_8S_2_16S(chd->previous + current +
+ ((chd->prev2-current) >> 2));
chd->prev2 = chd->previous;
chd->previous = current;
}
@@ -233,7 +231,7 @@ static av_cold int mace_decode_init(AVCodecContext * avctx)
if (avctx->channels > 2)
return -1;
- avctx->sample_fmt = AV_SAMPLE_FMT_S16;
+ avctx->sample_fmt = AV_SAMPLE_FMT_S16P;
avcodec_get_frame_defaults(&ctx->frame);
avctx->coded_frame = &ctx->frame;
@@ -246,21 +244,21 @@ static int mace_decode_frame(AVCodecContext *avctx, void *data,
{
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
- int16_t *samples;
+ int16_t **samples;
MACEContext *ctx = avctx->priv_data;
int i, j, k, l, ret;
- int is_mace3 = (avctx->codec_id == CODEC_ID_MACE3);
+ int is_mace3 = (avctx->codec_id == AV_CODEC_ID_MACE3);
/* get output buffer */
ctx->frame.nb_samples = 3 * (buf_size << (1 - is_mace3)) / avctx->channels;
- if ((ret = avctx->get_buffer(avctx, &ctx->frame)) < 0) {
+ if ((ret = ff_get_buffer(avctx, &ctx->frame)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return ret;
}
- samples = (int16_t *)ctx->frame.data[0];
+ samples = (int16_t **)ctx->frame.extended_data;
for(i = 0; i < avctx->channels; i++) {
- int16_t *output = samples + i;
+ int16_t *output = samples[i];
for (j=0; j < buf_size / (avctx->channels << is_mace3); j++)
for (k=0; k < (1 << is_mace3); k++) {
@@ -272,13 +270,11 @@ static int mace_decode_frame(AVCodecContext *avctx, void *data,
for (l=0; l < 3; l++) {
if (is_mace3)
- chomp3(&ctx->chd[i], output, val[1][l], l,
- avctx->channels);
+ chomp3(&ctx->chd[i], output, val[1][l], l);
else
- chomp6(&ctx->chd[i], output, val[0][l], l,
- avctx->channels);
+ chomp6(&ctx->chd[i], output, val[0][l], l);
- output += avctx->channels << (1-is_mace3);
+ output += 1 << (1-is_mace3);
}
}
}
@@ -292,22 +288,25 @@ static int mace_decode_frame(AVCodecContext *avctx, void *data,
AVCodec ff_mace3_decoder = {
.name = "mace3",
.type = AVMEDIA_TYPE_AUDIO,
- .id = CODEC_ID_MACE3,
+ .id = AV_CODEC_ID_MACE3,
.priv_data_size = sizeof(MACEContext),
.init = mace_decode_init,
.decode = mace_decode_frame,
.capabilities = CODEC_CAP_DR1,
- .long_name = NULL_IF_CONFIG_SMALL("MACE (Macintosh Audio Compression/Expansion) 3:1"),
+ .long_name = NULL_IF_CONFIG_SMALL("MACE (Macintosh Audio Compression/Expansion) 3:1"),
+ .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_S16P,
+ AV_SAMPLE_FMT_NONE },
};
AVCodec ff_mace6_decoder = {
.name = "mace6",
.type = AVMEDIA_TYPE_AUDIO,
- .id = CODEC_ID_MACE6,
+ .id = AV_CODEC_ID_MACE6,
.priv_data_size = sizeof(MACEContext),
.init = mace_decode_init,
.decode = mace_decode_frame,
.capabilities = CODEC_CAP_DR1,
- .long_name = NULL_IF_CONFIG_SMALL("MACE (Macintosh Audio Compression/Expansion) 6:1"),
+ .long_name = NULL_IF_CONFIG_SMALL("MACE (Macintosh Audio Compression/Expansion) 6:1"),
+ .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_S16P,
+ AV_SAMPLE_FMT_NONE },
};
-
diff --git a/gst-libs/ext/libav/libavcodec/mathops.h b/gst-libs/ext/libav/libavcodec/mathops.h
index 45b1ecf..551017e 100644
--- a/gst-libs/ext/libav/libavcodec/mathops.h
+++ b/gst-libs/ext/libav/libavcodec/mathops.h
@@ -22,9 +22,15 @@
#ifndef AVCODEC_MATHOPS_H
#define AVCODEC_MATHOPS_H
+#include <stdint.h>
+
#include "libavutil/common.h"
#include "config.h"
+extern const uint32_t ff_inverse[257];
+extern const uint8_t ff_reverse[256];
+extern const uint8_t ff_sqrt_tab[256];
+
#if ARCH_ARM
# include "arm/mathops.h"
#elif ARCH_AVR32
@@ -138,6 +144,13 @@ if ((y) < (x)) {\
}
#endif
+#ifndef MASK_ABS
+#define MASK_ABS(mask, level) do { \
+ mask = level >> 31; \
+ level = (level ^ mask) - mask; \
+ } while (0)
+#endif
+
#ifndef NEG_SSR32
# define NEG_SSR32(a,s) ((( int32_t)(a))>>(32-(s)))
#endif
@@ -178,5 +191,28 @@ if ((y) < (x)) {\
# define PACK_2S16(a,b) PACK_2U16((a)&0xffff, (b)&0xffff)
#endif
-#endif /* AVCODEC_MATHOPS_H */
+#ifndef FASTDIV
+# define FASTDIV(a,b) ((uint32_t)((((uint64_t)a) * ff_inverse[b]) >> 32))
+#endif /* FASTDIV */
+static inline av_const unsigned int ff_sqrt(unsigned int a)
+{
+ unsigned int b;
+
+ if (a < 255) return (ff_sqrt_tab[a + 1] - 1) >> 4;
+ else if (a < (1 << 12)) b = ff_sqrt_tab[a >> 4] >> 2;
+#if !CONFIG_SMALL
+ else if (a < (1 << 14)) b = ff_sqrt_tab[a >> 6] >> 1;
+ else if (a < (1 << 16)) b = ff_sqrt_tab[a >> 8] ;
+#endif
+ else {
+ int s = av_log2_16bit(a >> 16) >> 1;
+ unsigned int c = a >> (s + 2);
+ b = ff_sqrt_tab[c >> (s + 8)];
+ b = FASTDIV(c,b) + (b << s);
+ }
+
+ return b - (a < b * b);
+}
+
+#endif /* AVCODEC_MATHOPS_H */
diff --git a/gst-libs/ext/libav/libavcodec/mathtables.c b/gst-libs/ext/libav/libavcodec/mathtables.c
new file mode 100644
index 0000000..141aa78
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/mathtables.c
@@ -0,0 +1,87 @@
+/*
+ * 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
+ */
+
+#include <stdint.h>
+
+/* a*inverse[b]>>32 == a/b for all 0<=a<=16909558 && 2<=b<=256
+ * for a>16909558, is an overestimate by less than 1 part in 1<<24 */
+const uint32_t ff_inverse[257]={
+ 0, 4294967295U,2147483648U,1431655766, 1073741824, 858993460, 715827883, 613566757,
+ 536870912, 477218589, 429496730, 390451573, 357913942, 330382100, 306783379, 286331154,
+ 268435456, 252645136, 238609295, 226050911, 214748365, 204522253, 195225787, 186737709,
+ 178956971, 171798692, 165191050, 159072863, 153391690, 148102321, 143165577, 138547333,
+ 134217728, 130150525, 126322568, 122713352, 119304648, 116080198, 113025456, 110127367,
+ 107374183, 104755300, 102261127, 99882961, 97612894, 95443718, 93368855, 91382283,
+ 89478486, 87652394, 85899346, 84215046, 82595525, 81037119, 79536432, 78090315,
+ 76695845, 75350304, 74051161, 72796056, 71582789, 70409300, 69273667, 68174085,
+ 67108864, 66076420, 65075263, 64103990, 63161284, 62245903, 61356676, 60492498,
+ 59652324, 58835169, 58040099, 57266231, 56512728, 55778797, 55063684, 54366675,
+ 53687092, 53024288, 52377650, 51746594, 51130564, 50529028, 49941481, 49367441,
+ 48806447, 48258060, 47721859, 47197443, 46684428, 46182445, 45691142, 45210183,
+ 44739243, 44278014, 43826197, 43383509, 42949673, 42524429, 42107523, 41698712,
+ 41297763, 40904451, 40518560, 40139882, 39768216, 39403370, 39045158, 38693400,
+ 38347923, 38008561, 37675152, 37347542, 37025581, 36709123, 36398028, 36092163,
+ 35791395, 35495598, 35204650, 34918434, 34636834, 34359739, 34087043, 33818641,
+ 33554432, 33294321, 33038210, 32786010, 32537632, 32292988, 32051995, 31814573,
+ 31580642, 31350127, 31122952, 30899046, 30678338, 30460761, 30246249, 30034737,
+ 29826162, 29620465, 29417585, 29217465, 29020050, 28825284, 28633116, 28443493,
+ 28256364, 28071682, 27889399, 27709467, 27531842, 27356480, 27183338, 27012373,
+ 26843546, 26676816, 26512144, 26349493, 26188825, 26030105, 25873297, 25718368,
+ 25565282, 25414008, 25264514, 25116768, 24970741, 24826401, 24683721, 24542671,
+ 24403224, 24265352, 24129030, 23994231, 23860930, 23729102, 23598722, 23469767,
+ 23342214, 23216040, 23091223, 22967740, 22845571, 22724695, 22605092, 22486740,
+ 22369622, 22253717, 22139007, 22025474, 21913099, 21801865, 21691755, 21582751,
+ 21474837, 21367997, 21262215, 21157475, 21053762, 20951060, 20849356, 20748635,
+ 20648882, 20550083, 20452226, 20355296, 20259280, 20164166, 20069941, 19976593,
+ 19884108, 19792477, 19701685, 19611723, 19522579, 19434242, 19346700, 19259944,
+ 19173962, 19088744, 19004281, 18920561, 18837576, 18755316, 18673771, 18592933,
+ 18512791, 18433337, 18354562, 18276457, 18199014, 18122225, 18046082, 17970575,
+ 17895698, 17821442, 17747799, 17674763, 17602325, 17530479, 17459217, 17388532,
+ 17318417, 17248865, 17179870, 17111424, 17043522, 16976156, 16909321, 16843010,
+ 16777216
+};
+
+const uint8_t ff_sqrt_tab[256]={
+ 0, 16, 23, 28, 32, 36, 40, 43, 46, 48, 51, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 77, 79, 80, 82, 84, 85, 87, 88, 90,
+ 91, 92, 94, 95, 96, 98, 99,100,102,103,104,105,107,108,109,110,111,112,114,115,116,117,118,119,120,121,122,123,124,125,126,127,
+128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,144,145,146,147,148,149,150,151,151,152,153,154,155,156,156,
+157,158,159,160,160,161,162,163,164,164,165,166,167,168,168,169,170,171,171,172,173,174,174,175,176,176,177,178,179,179,180,181,
+182,182,183,184,184,185,186,186,187,188,188,189,190,190,191,192,192,193,194,194,195,196,196,197,198,198,199,200,200,201,202,202,
+203,204,204,205,205,206,207,207,208,208,209,210,210,211,212,212,213,213,214,215,215,216,216,217,218,218,219,219,220,220,221,222,
+222,223,223,224,224,225,226,226,227,227,228,228,229,230,230,231,231,232,232,233,233,234,235,235,236,236,237,237,238,238,239,239,
+240,240,241,242,242,243,243,244,244,245,245,246,246,247,247,248,248,249,249,250,250,251,251,252,252,253,253,254,254,255,255,255
+};
+
+const uint8_t ff_reverse[256] = {
+0x00,0x80,0x40,0xC0,0x20,0xA0,0x60,0xE0,0x10,0x90,0x50,0xD0,0x30,0xB0,0x70,0xF0,
+0x08,0x88,0x48,0xC8,0x28,0xA8,0x68,0xE8,0x18,0x98,0x58,0xD8,0x38,0xB8,0x78,0xF8,
+0x04,0x84,0x44,0xC4,0x24,0xA4,0x64,0xE4,0x14,0x94,0x54,0xD4,0x34,0xB4,0x74,0xF4,
+0x0C,0x8C,0x4C,0xCC,0x2C,0xAC,0x6C,0xEC,0x1C,0x9C,0x5C,0xDC,0x3C,0xBC,0x7C,0xFC,
+0x02,0x82,0x42,0xC2,0x22,0xA2,0x62,0xE2,0x12,0x92,0x52,0xD2,0x32,0xB2,0x72,0xF2,
+0x0A,0x8A,0x4A,0xCA,0x2A,0xAA,0x6A,0xEA,0x1A,0x9A,0x5A,0xDA,0x3A,0xBA,0x7A,0xFA,
+0x06,0x86,0x46,0xC6,0x26,0xA6,0x66,0xE6,0x16,0x96,0x56,0xD6,0x36,0xB6,0x76,0xF6,
+0x0E,0x8E,0x4E,0xCE,0x2E,0xAE,0x6E,0xEE,0x1E,0x9E,0x5E,0xDE,0x3E,0xBE,0x7E,0xFE,
+0x01,0x81,0x41,0xC1,0x21,0xA1,0x61,0xE1,0x11,0x91,0x51,0xD1,0x31,0xB1,0x71,0xF1,
+0x09,0x89,0x49,0xC9,0x29,0xA9,0x69,0xE9,0x19,0x99,0x59,0xD9,0x39,0xB9,0x79,0xF9,
+0x05,0x85,0x45,0xC5,0x25,0xA5,0x65,0xE5,0x15,0x95,0x55,0xD5,0x35,0xB5,0x75,0xF5,
+0x0D,0x8D,0x4D,0xCD,0x2D,0xAD,0x6D,0xED,0x1D,0x9D,0x5D,0xDD,0x3D,0xBD,0x7D,0xFD,
+0x03,0x83,0x43,0xC3,0x23,0xA3,0x63,0xE3,0x13,0x93,0x53,0xD3,0x33,0xB3,0x73,0xF3,
+0x0B,0x8B,0x4B,0xCB,0x2B,0xAB,0x6B,0xEB,0x1B,0x9B,0x5B,0xDB,0x3B,0xBB,0x7B,0xFB,
+0x07,0x87,0x47,0xC7,0x27,0xA7,0x67,0xE7,0x17,0x97,0x57,0xD7,0x37,0xB7,0x77,0xF7,
+0x0F,0x8F,0x4F,0xCF,0x2F,0xAF,0x6F,0xEF,0x1F,0x9F,0x5F,0xDF,0x3F,0xBF,0x7F,0xFF,
+};
diff --git a/gst-libs/ext/libav/libavcodec/mdec.c b/gst-libs/ext/libav/libavcodec/mdec.c
index 3741549..b5a9d57 100644
--- a/gst-libs/ext/libav/libavcodec/mdec.c
+++ b/gst-libs/ext/libav/libavcodec/mdec.c
@@ -153,7 +153,7 @@ static inline void idct_put(MDECContext *a, int mb_x, int mb_y){
}
static int decode_frame(AVCodecContext *avctx,
- void *data, int *data_size,
+ void *data, int *got_frame,
AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
@@ -206,7 +206,7 @@ static int decode_frame(AVCodecContext *avctx,
memset(p->qscale_table, a->qscale, a->mb_width);
*picture = a->picture;
- *data_size = sizeof(AVPicture);
+ *got_frame = 1;
return (get_bits_count(&a->gb)+31)/32*4;
}
@@ -214,7 +214,7 @@ static int decode_frame(AVCodecContext *avctx,
static av_cold void mdec_common_init(AVCodecContext *avctx){
MDECContext * const a = avctx->priv_data;
- dsputil_init(&a->dsp, avctx);
+ ff_dsputil_init(&a->dsp, avctx);
a->mb_width = (avctx->coded_width + 15) / 16;
a->mb_height = (avctx->coded_height + 15) / 16;
@@ -235,14 +235,14 @@ static av_cold int decode_init(AVCodecContext *avctx){
avctx->idct_algo = FF_IDCT_SIMPLE;
p->qstride= 0;
p->qscale_table= av_mallocz(a->mb_width);
- avctx->pix_fmt= PIX_FMT_YUVJ420P;
+ avctx->pix_fmt= AV_PIX_FMT_YUVJ420P;
return 0;
}
static av_cold int decode_init_thread_copy(AVCodecContext *avctx){
MDECContext * const a = avctx->priv_data;
- AVFrame *p = (AVFrame*)&a->picture;
+ AVFrame *p = &a->picture;
avctx->coded_frame = p;
a->avctx= avctx;
@@ -265,15 +265,14 @@ static av_cold int decode_end(AVCodecContext *avctx){
}
AVCodec ff_mdec_decoder = {
- .name = "mdec",
- .type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_MDEC,
- .priv_data_size = sizeof(MDECContext),
- .init = decode_init,
- .close = decode_end,
- .decode = decode_frame,
- .capabilities = CODEC_CAP_DR1 | CODEC_CAP_FRAME_THREADS,
- .long_name= NULL_IF_CONFIG_SMALL("Sony PlayStation MDEC (Motion DECoder)"),
- .init_thread_copy= ONLY_IF_THREADS_ENABLED(decode_init_thread_copy)
+ .name = "mdec",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .id = AV_CODEC_ID_MDEC,
+ .priv_data_size = sizeof(MDECContext),
+ .init = decode_init,
+ .close = decode_end,
+ .decode = decode_frame,
+ .capabilities = CODEC_CAP_DR1 | CODEC_CAP_FRAME_THREADS,
+ .long_name = NULL_IF_CONFIG_SMALL("Sony PlayStation MDEC (Motion DECoder)"),
+ .init_thread_copy = ONLY_IF_THREADS_ENABLED(decode_init_thread_copy)
};
-
diff --git a/gst-libs/ext/libav/libavcodec/mimic.c b/gst-libs/ext/libav/libavcodec/mimic.c
index 013dc2e..95695de 100644
--- a/gst-libs/ext/libav/libavcodec/mimic.c
+++ b/gst-libs/ext/libav/libavcodec/mimic.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2005 Ole André Vadla Ravnås <oleavr@gmail.com>
+ * Copyright (C) 2005 Ole André Vadla Ravnås <oleavr@gmail.com>
* Copyright (C) 2008 Ramiro Polla
*
* This file is part of Libav.
@@ -121,7 +121,7 @@ static av_cold int mimic_decode_init(AVCodecContext *avctx)
av_log(avctx, AV_LOG_ERROR, "error initializing vlc table\n");
return -1;
}
- dsputil_init(&ctx->dsp, avctx);
+ ff_dsputil_init(&ctx->dsp, avctx);
ff_init_scantable(ctx->dsp.idct_permutation, &ctx->scantable, col_zag);
return 0;
@@ -301,30 +301,32 @@ static void prepare_avpic(MimicContext *ctx, AVPicture *dst, AVPicture *src)
}
static int mimic_decode_frame(AVCodecContext *avctx, void *data,
- int *data_size, AVPacket *avpkt)
+ int *got_frame, AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
MimicContext *ctx = avctx->priv_data;
+ GetByteContext gb;
int is_pframe;
int width, height;
int quality, num_coeffs;
int swap_buf_size = buf_size - MIMIC_HEADER_SIZE;
int res;
- if(buf_size < MIMIC_HEADER_SIZE) {
+ if (buf_size <= MIMIC_HEADER_SIZE) {
av_log(avctx, AV_LOG_ERROR, "insufficient data\n");
return -1;
}
- buf += 2; /* some constant (always 256) */
- quality = bytestream_get_le16(&buf);
- width = bytestream_get_le16(&buf);
- height = bytestream_get_le16(&buf);
- buf += 4; /* some constant */
- is_pframe = bytestream_get_le32(&buf);
- num_coeffs = bytestream_get_byte(&buf);
- buf += 3; /* some constant */
+ bytestream2_init(&gb, buf, MIMIC_HEADER_SIZE);
+ bytestream2_skip(&gb, 2); /* some constant (always 256) */
+ quality = bytestream2_get_le16u(&gb);
+ width = bytestream2_get_le16u(&gb);
+ height = bytestream2_get_le16u(&gb);
+ bytestream2_skip(&gb, 4); /* some constant */
+ is_pframe = bytestream2_get_le32u(&gb);
+ num_coeffs = bytestream2_get_byteu(&gb);
+ bytestream2_skip(&gb, 3); /* some constant */
if(!ctx->avctx) {
int i;
@@ -338,7 +340,7 @@ static int mimic_decode_frame(AVCodecContext *avctx, void *data,
ctx->avctx = avctx;
avctx->width = width;
avctx->height = height;
- avctx->pix_fmt = PIX_FMT_YUV420P;
+ avctx->pix_fmt = AV_PIX_FMT_YUV420P;
for(i = 0; i < 3; i++) {
ctx->num_vblocks[i] = -((-height) >> (3 + !!i));
ctx->num_hblocks[i] = width >> (3 + !!i) ;
@@ -368,13 +370,12 @@ static int mimic_decode_frame(AVCodecContext *avctx, void *data,
ff_thread_finish_setup(avctx);
- av_fast_malloc(&ctx->swap_buf, &ctx->swap_buf_size,
- swap_buf_size + FF_INPUT_BUFFER_PADDING_SIZE);
+ av_fast_padded_malloc(&ctx->swap_buf, &ctx->swap_buf_size, swap_buf_size);
if(!ctx->swap_buf)
return AVERROR(ENOMEM);
ctx->dsp.bswap_buf(ctx->swap_buf,
- (const uint32_t*) buf,
+ (const uint32_t*) (buf + MIMIC_HEADER_SIZE),
swap_buf_size>>2);
init_get_bits(&ctx->gb, ctx->swap_buf, swap_buf_size << 3);
@@ -388,7 +389,7 @@ static int mimic_decode_frame(AVCodecContext *avctx, void *data,
}
*(AVFrame*)data = ctx->buf_ptrs[ctx->cur_index];
- *data_size = sizeof(AVFrame);
+ *got_frame = 1;
ctx->prev_index = ctx->next_prev_index;
ctx->cur_index = ctx->next_cur_index;
@@ -419,14 +420,14 @@ static av_cold int mimic_decode_end(AVCodecContext *avctx)
}
AVCodec ff_mimic_decoder = {
- .name = "mimic",
- .type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_MIMIC,
- .priv_data_size = sizeof(MimicContext),
- .init = mimic_decode_init,
- .close = mimic_decode_end,
- .decode = mimic_decode_frame,
- .capabilities = CODEC_CAP_DR1 | CODEC_CAP_FRAME_THREADS,
- .long_name = NULL_IF_CONFIG_SMALL("Mimic"),
+ .name = "mimic",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .id = AV_CODEC_ID_MIMIC,
+ .priv_data_size = sizeof(MimicContext),
+ .init = mimic_decode_init,
+ .close = mimic_decode_end,
+ .decode = mimic_decode_frame,
+ .capabilities = CODEC_CAP_DR1 | CODEC_CAP_FRAME_THREADS,
+ .long_name = NULL_IF_CONFIG_SMALL("Mimic"),
.update_thread_context = ONLY_IF_THREADS_ENABLED(mimic_decode_update_thread_context)
};
diff --git a/gst-libs/ext/libav/libavcodec/mips/Makefile b/gst-libs/ext/libav/libavcodec/mips/Makefile
deleted file mode 100644
index 3f4da68..0000000
--- a/gst-libs/ext/libav/libavcodec/mips/Makefile
+++ /dev/null
@@ -1,3 +0,0 @@
-OBJS-$(HAVE_MMI) += ps2/dsputil_mmi.o \
- ps2/idct_mmi.o \
- ps2/mpegvideo_mmi.o \
diff --git a/gst-libs/ext/libav/libavcodec/mips/mathops.h b/gst-libs/ext/libav/libavcodec/mips/mathops.h
index 573745b..dd80f68 100644
--- a/gst-libs/ext/libav/libavcodec/mips/mathops.h
+++ b/gst-libs/ext/libav/libavcodec/mips/mathops.h
@@ -57,7 +57,8 @@ static inline av_const int64_t MAC64(int64_t d, int a, int b)
__asm__ ("dmult %2, %3 \n\t"
"mflo %1 \n\t"
"daddu %0, %0, %1 \n\t"
- : "+r"(d), "=&r"(m) : "r"(a), "r"(b));
+ : "+r"(d), "=&r"(m) : "r"(a), "r"(b)
+ : "hi", "lo");
return d;
}
#define MAC64(d, a, b) ((d) = MAC64(d, a, b))
@@ -68,7 +69,8 @@ static inline av_const int64_t MLS64(int64_t d, int a, int b)
__asm__ ("dmult %2, %3 \n\t"
"mflo %1 \n\t"
"dsubu %0, %0, %1 \n\t"
- : "+r"(d), "=&r"(m) : "r"(a), "r"(b));
+ : "+r"(d), "=&r"(m) : "r"(a), "r"(b)
+ : "hi", "lo");
return d;
}
#define MLS64(d, a, b) ((d) = MLS64(d, a, b))
diff --git a/gst-libs/ext/libav/libavcodec/mjpeg.c b/gst-libs/ext/libav/libavcodec/mjpeg.c
index 9f2d50f..a353851 100644
--- a/gst-libs/ext/libav/libavcodec/mjpeg.c
+++ b/gst-libs/ext/libav/libavcodec/mjpeg.c
@@ -62,17 +62,17 @@ const unsigned char std_chrominance_quant_tbl[64] = {
/* Set up the standard Huffman tables (cf. JPEG standard section K.3) */
/* IMPORTANT: these are only valid for 8-bit data precision! */
-const uint8_t ff_mjpeg_bits_dc_luminance[17] =
+const uint8_t avpriv_mjpeg_bits_dc_luminance[17] =
{ /* 0-base */ 0, 0, 1, 5, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0 };
-const uint8_t ff_mjpeg_val_dc[12] =
+const uint8_t avpriv_mjpeg_val_dc[12] =
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 };
-const uint8_t ff_mjpeg_bits_dc_chrominance[17] =
+const uint8_t avpriv_mjpeg_bits_dc_chrominance[17] =
{ /* 0-base */ 0, 0, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0 };
-const uint8_t ff_mjpeg_bits_ac_luminance[17] =
+const uint8_t avpriv_mjpeg_bits_ac_luminance[17] =
{ /* 0-base */ 0, 0, 2, 1, 3, 3, 2, 4, 3, 5, 5, 4, 4, 0, 0, 1, 0x7d };
-const uint8_t ff_mjpeg_val_ac_luminance[] =
+const uint8_t avpriv_mjpeg_val_ac_luminance[] =
{ 0x01, 0x02, 0x03, 0x00, 0x04, 0x11, 0x05, 0x12,
0x21, 0x31, 0x41, 0x06, 0x13, 0x51, 0x61, 0x07,
0x22, 0x71, 0x14, 0x32, 0x81, 0x91, 0xa1, 0x08,
@@ -96,10 +96,10 @@ const uint8_t ff_mjpeg_val_ac_luminance[] =
0xf9, 0xfa
};
-const uint8_t ff_mjpeg_bits_ac_chrominance[17] =
+const uint8_t avpriv_mjpeg_bits_ac_chrominance[17] =
{ /* 0-base */ 0, 0, 2, 1, 2, 4, 4, 3, 4, 7, 5, 4, 4, 0, 1, 2, 0x77 };
-const uint8_t ff_mjpeg_val_ac_chrominance[] =
+const uint8_t avpriv_mjpeg_val_ac_chrominance[] =
{ 0x00, 0x01, 0x02, 0x03, 0x11, 0x04, 0x05, 0x21,
0x31, 0x06, 0x12, 0x41, 0x51, 0x07, 0x61, 0x71,
0x13, 0x22, 0x32, 0x81, 0x08, 0x14, 0x42, 0x91,
diff --git a/gst-libs/ext/libav/libavcodec/mjpeg.h b/gst-libs/ext/libav/libavcodec/mjpeg.h
index c3fde44..a69b519 100644
--- a/gst-libs/ext/libav/libavcodec/mjpeg.h
+++ b/gst-libs/ext/libav/libavcodec/mjpeg.h
@@ -137,16 +137,16 @@ static inline void put_marker(PutBitContext *p, int code)
case 7: ret= (left + top)>>1; break;\
}
-extern const uint8_t ff_mjpeg_bits_dc_luminance[];
-extern const uint8_t ff_mjpeg_val_dc[];
+extern av_export const uint8_t avpriv_mjpeg_bits_dc_luminance[];
+extern av_export const uint8_t avpriv_mjpeg_val_dc[];
-extern const uint8_t ff_mjpeg_bits_dc_chrominance[];
+extern av_export const uint8_t avpriv_mjpeg_bits_dc_chrominance[];
-extern const uint8_t ff_mjpeg_bits_ac_luminance[];
-extern const uint8_t ff_mjpeg_val_ac_luminance[];
+extern av_export const uint8_t avpriv_mjpeg_bits_ac_luminance[];
+extern av_export const uint8_t avpriv_mjpeg_val_ac_luminance[];
-extern const uint8_t ff_mjpeg_bits_ac_chrominance[];
-extern const uint8_t ff_mjpeg_val_ac_chrominance[];
+extern av_export const uint8_t avpriv_mjpeg_bits_ac_chrominance[];
+extern av_export const uint8_t avpriv_mjpeg_val_ac_chrominance[];
void ff_mjpeg_build_huffman_codes(uint8_t *huff_size, uint16_t *huff_code,
const uint8_t *bits_table,
diff --git a/gst-libs/ext/libav/libavcodec/mjpeg2jpeg_bsf.c b/gst-libs/ext/libav/libavcodec/mjpeg2jpeg_bsf.c
index a91152d..ec36589 100644
--- a/gst-libs/ext/libav/libavcodec/mjpeg2jpeg_bsf.c
+++ b/gst-libs/ext/libav/libavcodec/mjpeg2jpeg_bsf.c
@@ -59,15 +59,15 @@ static uint8_t *append(uint8_t *buf, const uint8_t *src, int size)
static uint8_t *append_dht_segment(uint8_t *buf)
{
buf = append(buf, dht_segment_head, sizeof(dht_segment_head));
- buf = append(buf, ff_mjpeg_bits_dc_luminance + 1, 16);
+ buf = append(buf, avpriv_mjpeg_bits_dc_luminance + 1, 16);
buf = append(buf, dht_segment_frag, sizeof(dht_segment_frag));
- buf = append(buf, ff_mjpeg_val_dc, 12);
+ buf = append(buf, avpriv_mjpeg_val_dc, 12);
*(buf++) = 0x10;
- buf = append(buf, ff_mjpeg_bits_ac_luminance + 1, 16);
- buf = append(buf, ff_mjpeg_val_ac_luminance, 162);
+ buf = append(buf, avpriv_mjpeg_bits_ac_luminance + 1, 16);
+ buf = append(buf, avpriv_mjpeg_val_ac_luminance, 162);
*(buf++) = 0x11;
- buf = append(buf, ff_mjpeg_bits_ac_chrominance + 1, 16);
- buf = append(buf, ff_mjpeg_val_ac_chrominance, 162);
+ buf = append(buf, avpriv_mjpeg_bits_ac_chrominance + 1, 16);
+ buf = append(buf, avpriv_mjpeg_val_ac_chrominance, 162);
return buf;
}
diff --git a/gst-libs/ext/libav/libavcodec/mjpeg_parser.c b/gst-libs/ext/libav/libavcodec/mjpeg_parser.c
index 5b83e59..ab65461 100644
--- a/gst-libs/ext/libav/libavcodec/mjpeg_parser.c
+++ b/gst-libs/ext/libav/libavcodec/mjpeg_parser.c
@@ -97,7 +97,7 @@ static int jpeg_parse(AVCodecParserContext *s,
AVCodecParser ff_mjpeg_parser = {
- .codec_ids = { CODEC_ID_MJPEG },
+ .codec_ids = { AV_CODEC_ID_MJPEG },
.priv_data_size = sizeof(ParseContext),
.parser_parse = jpeg_parse,
.parser_close = ff_parse_close,
diff --git a/gst-libs/ext/libav/libavcodec/mjpega_dump_header_bsf.c b/gst-libs/ext/libav/libavcodec/mjpega_dump_header_bsf.c
index 2a181fc..ed32d5a 100644
--- a/gst-libs/ext/libav/libavcodec/mjpega_dump_header_bsf.c
+++ b/gst-libs/ext/libav/libavcodec/mjpega_dump_header_bsf.c
@@ -38,7 +38,7 @@ static int mjpega_dump_header(AVBitStreamFilterContext *bsfc, AVCodecContext *av
unsigned dqt = 0, dht = 0, sof0 = 0;
int i;
- if (avctx->codec_id != CODEC_ID_MJPEG) {
+ if (avctx->codec_id != AV_CODEC_ID_MJPEG) {
av_log(avctx, AV_LOG_ERROR, "mjpega bitstream filter only applies to mjpeg codec\n");
return 0;
}
diff --git a/gst-libs/ext/libav/libavcodec/mjpegbdec.c b/gst-libs/ext/libav/libavcodec/mjpegbdec.c
index 10c5add..9d5a8f3 100644
--- a/gst-libs/ext/libav/libavcodec/mjpegbdec.c
+++ b/gst-libs/ext/libav/libavcodec/mjpegbdec.c
@@ -38,7 +38,7 @@ static uint32_t read_offs(AVCodecContext *avctx, GetBitContext *gb, uint32_t siz
}
static int mjpegb_decode_frame(AVCodecContext *avctx,
- void *data, int *data_size,
+ void *data, int *got_frame,
AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
@@ -137,7 +137,7 @@ read_header:
//XXX FIXME factorize, this looks very similar to the EOI code
*picture= *s->picture_ptr;
- *data_size = sizeof(AVFrame);
+ *got_frame = 1;
if(!s->lossless){
picture->quality= FFMAX3(s->qscale[0], s->qscale[1], s->qscale[2]);
@@ -155,12 +155,11 @@ read_header:
AVCodec ff_mjpegb_decoder = {
.name = "mjpegb",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_MJPEGB,
+ .id = AV_CODEC_ID_MJPEGB,
.priv_data_size = sizeof(MJpegDecodeContext),
.init = ff_mjpeg_decode_init,
.close = ff_mjpeg_decode_end,
.decode = mjpegb_decode_frame,
.capabilities = CODEC_CAP_DR1,
- .max_lowres = 3,
- .long_name = NULL_IF_CONFIG_SMALL("Apple MJPEG-B"),
+ .long_name = NULL_IF_CONFIG_SMALL("Apple MJPEG-B"),
};
diff --git a/gst-libs/ext/libav/libavcodec/mjpegdec.c b/gst-libs/ext/libav/libavcodec/mjpegdec.c
index 5256a8e..05f2f02 100644
--- a/gst-libs/ext/libav/libavcodec/mjpegdec.c
+++ b/gst-libs/ext/libav/libavcodec/mjpegdec.c
@@ -37,6 +37,7 @@
#include "libavutil/opt.h"
#include "avcodec.h"
#include "dsputil.h"
+#include "internal.h"
#include "mjpeg.h"
#include "mjpegdec.h"
#include "jpeglsdec.h"
@@ -46,14 +47,13 @@ static int build_vlc(VLC *vlc, const uint8_t *bits_table,
const uint8_t *val_table, int nb_codes,
int use_static, int is_ac)
{
- uint8_t huff_size[256];
+ uint8_t huff_size[256] = { 0 };
uint16_t huff_code[256];
uint16_t huff_sym[256];
int i;
assert(nb_codes <= 256);
- memset(huff_size, 0, sizeof(huff_size));
ff_mjpeg_build_huffman_codes(huff_size, huff_code, bits_table, val_table);
for (i = 0; i < 256; i++)
@@ -68,18 +68,18 @@ static int build_vlc(VLC *vlc, const uint8_t *bits_table,
static void build_basic_mjpeg_vlc(MJpegDecodeContext *s)
{
- build_vlc(&s->vlcs[0][0], ff_mjpeg_bits_dc_luminance,
- ff_mjpeg_val_dc, 12, 0, 0);
- build_vlc(&s->vlcs[0][1], ff_mjpeg_bits_dc_chrominance,
- ff_mjpeg_val_dc, 12, 0, 0);
- build_vlc(&s->vlcs[1][0], ff_mjpeg_bits_ac_luminance,
- ff_mjpeg_val_ac_luminance, 251, 0, 1);
- build_vlc(&s->vlcs[1][1], ff_mjpeg_bits_ac_chrominance,
- ff_mjpeg_val_ac_chrominance, 251, 0, 1);
- build_vlc(&s->vlcs[2][0], ff_mjpeg_bits_ac_luminance,
- ff_mjpeg_val_ac_luminance, 251, 0, 0);
- build_vlc(&s->vlcs[2][1], ff_mjpeg_bits_ac_chrominance,
- ff_mjpeg_val_ac_chrominance, 251, 0, 0);
+ build_vlc(&s->vlcs[0][0], avpriv_mjpeg_bits_dc_luminance,
+ avpriv_mjpeg_val_dc, 12, 0, 0);
+ build_vlc(&s->vlcs[0][1], avpriv_mjpeg_bits_dc_chrominance,
+ avpriv_mjpeg_val_dc, 12, 0, 0);
+ build_vlc(&s->vlcs[1][0], avpriv_mjpeg_bits_ac_luminance,
+ avpriv_mjpeg_val_ac_luminance, 251, 0, 1);
+ build_vlc(&s->vlcs[1][1], avpriv_mjpeg_bits_ac_chrominance,
+ avpriv_mjpeg_val_ac_chrominance, 251, 0, 1);
+ build_vlc(&s->vlcs[2][0], avpriv_mjpeg_bits_ac_luminance,
+ avpriv_mjpeg_val_ac_luminance, 251, 0, 0);
+ build_vlc(&s->vlcs[2][1], avpriv_mjpeg_bits_ac_chrominance,
+ avpriv_mjpeg_val_ac_chrominance, 251, 0, 0);
}
av_cold int ff_mjpeg_decode_init(AVCodecContext *avctx)
@@ -90,7 +90,7 @@ av_cold int ff_mjpeg_decode_init(AVCodecContext *avctx)
s->picture_ptr = &s->picture;
s->avctx = avctx;
- dsputil_init(&s->dsp, avctx);
+ ff_dsputil_init(&s->dsp, avctx);
ff_init_scantable(s->dsp.idct_permutation, &s->scantable, ff_zigzag_direct);
s->buffer_size = 0;
s->buffer = NULL;
@@ -101,24 +101,21 @@ av_cold int ff_mjpeg_decode_init(AVCodecContext *avctx)
build_basic_mjpeg_vlc(s);
-#if FF_API_MJPEG_GLOBAL_OPTS
- if (avctx->flags & CODEC_FLAG_EXTERN_HUFF)
- s->extern_huff = 1;
-#endif
if (s->extern_huff) {
+ int ret;
av_log(avctx, AV_LOG_INFO, "mjpeg: using external huffman table\n");
init_get_bits(&s->gb, avctx->extradata, avctx->extradata_size * 8);
- if (ff_mjpeg_decode_dht(s)) {
+ if ((ret = ff_mjpeg_decode_dht(s))) {
av_log(avctx, AV_LOG_ERROR,
"mjpeg: error using external huffman table\n");
- return AVERROR_INVALIDDATA;
+ return ret;
}
}
if (avctx->field_order == AV_FIELD_BB) { /* quicktime icefloe 019 */
s->interlace_polarity = 1; /* bottom field first */
av_log(avctx, AV_LOG_DEBUG, "mjpeg bottom field first\n");
}
- if (avctx->codec->id == CODEC_ID_AMV)
+ if (avctx->codec->id == AV_CODEC_ID_AMV)
s->flipped = 1;
return 0;
@@ -164,18 +161,19 @@ int ff_mjpeg_decode_dht(MJpegDecodeContext *s)
int len, index, i, class, n, v, code_max;
uint8_t bits_table[17];
uint8_t val_table[256];
+ int ret = 0;
len = get_bits(&s->gb, 16) - 2;
while (len > 0) {
if (len < 17)
- return -1;
+ return AVERROR_INVALIDDATA;
class = get_bits(&s->gb, 4);
if (class >= 2)
- return -1;
+ return AVERROR_INVALIDDATA;
index = get_bits(&s->gb, 4);
if (index >= 4)
- return -1;
+ return AVERROR_INVALIDDATA;
n = 0;
for (i = 1; i <= 16; i++) {
bits_table[i] = get_bits(&s->gb, 8);
@@ -183,7 +181,7 @@ int ff_mjpeg_decode_dht(MJpegDecodeContext *s)
}
len -= 17;
if (len < n || n > 256)
- return -1;
+ return AVERROR_INVALIDDATA;
code_max = 0;
for (i = 0; i < n; i++) {
@@ -198,15 +196,15 @@ int ff_mjpeg_decode_dht(MJpegDecodeContext *s)
ff_free_vlc(&s->vlcs[class][index]);
av_log(s->avctx, AV_LOG_DEBUG, "class=%d index=%d nb_codes=%d\n",
class, index, code_max + 1);
- if (build_vlc(&s->vlcs[class][index], bits_table, val_table,
- code_max + 1, 0, class > 0) < 0)
- return -1;
+ if ((ret = build_vlc(&s->vlcs[class][index], bits_table, val_table,
+ code_max + 1, 0, class > 0)) < 0)
+ return ret;
if (class > 0) {
ff_free_vlc(&s->vlcs[2][index]);
- if (build_vlc(&s->vlcs[2][index], bits_table, val_table,
- code_max + 1, 0, 0) < 0)
- return -1;
+ if ((ret = build_vlc(&s->vlcs[2][index], bits_table, val_table,
+ code_max + 1, 0, 0)) < 0)
+ return ret;
}
}
return 0;
@@ -239,16 +237,17 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
av_log(s->avctx, AV_LOG_DEBUG, "sof0: picture: %dx%d\n", width, height);
if (av_image_check_size(width, height, 0, s->avctx))
- return -1;
+ return AVERROR_INVALIDDATA;
nb_components = get_bits(&s->gb, 8);
if (nb_components <= 0 ||
nb_components > MAX_COMPONENTS)
return -1;
if (s->ls && !(s->bits <= 8 || nb_components == 1)) {
- av_log(s->avctx, AV_LOG_ERROR,
- "only <= 8 bits/component or 16-bit gray accepted for JPEG-LS\n");
- return -1;
+ av_log_missing_feature(s->avctx,
+ "For JPEG-LS anything except <= 8 bits/component"
+ " or 16-bit gray", 0);
+ return AVERROR_PATCHWELCOME;
}
s->nb_components = nb_components;
s->h_max = 1;
@@ -265,7 +264,7 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
s->v_max = s->v_count[i];
s->quant_index[i] = get_bits(&s->gb, 8);
if (s->quant_index[i] >= 4)
- return -1;
+ return AVERROR_INVALIDDATA;
if (!s->h_count[i] || !s->v_count[i]) {
av_log(s->avctx, AV_LOG_ERROR,
"Invalid sampling factor in component %d %d:%d\n",
@@ -279,9 +278,8 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
}
if (s->ls && (s->h_max > 1 || s->v_max > 1)) {
- av_log(s->avctx, AV_LOG_ERROR,
- "Subsampling in JPEG-LS is not supported.\n");
- return -1;
+ av_log_missing_feature(s->avctx, "Subsampling in JPEG-LS", 0);
+ return AVERROR_PATCHWELCOME;
}
if (s->v_max == 1 && s->h_max == 1 && s->lossless == 1)
@@ -330,40 +328,40 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
switch (pix_fmt_id) {
case 0x11111100:
if (s->rgb)
- s->avctx->pix_fmt = PIX_FMT_BGRA;
+ s->avctx->pix_fmt = AV_PIX_FMT_BGRA;
else
- s->avctx->pix_fmt = s->cs_itu601 ? PIX_FMT_YUV444P : PIX_FMT_YUVJ444P;
+ s->avctx->pix_fmt = s->cs_itu601 ? AV_PIX_FMT_YUV444P : AV_PIX_FMT_YUVJ444P;
assert(s->nb_components == 3);
break;
case 0x11000000:
- s->avctx->pix_fmt = PIX_FMT_GRAY8;
+ s->avctx->pix_fmt = AV_PIX_FMT_GRAY8;
break;
case 0x12111100:
- s->avctx->pix_fmt = s->cs_itu601 ? PIX_FMT_YUV440P : PIX_FMT_YUVJ440P;
+ s->avctx->pix_fmt = s->cs_itu601 ? AV_PIX_FMT_YUV440P : AV_PIX_FMT_YUVJ440P;
break;
case 0x21111100:
- s->avctx->pix_fmt = s->cs_itu601 ? PIX_FMT_YUV422P : PIX_FMT_YUVJ422P;
+ s->avctx->pix_fmt = s->cs_itu601 ? AV_PIX_FMT_YUV422P : AV_PIX_FMT_YUVJ422P;
break;
case 0x22111100:
- s->avctx->pix_fmt = s->cs_itu601 ? PIX_FMT_YUV420P : PIX_FMT_YUVJ420P;
+ s->avctx->pix_fmt = s->cs_itu601 ? AV_PIX_FMT_YUV420P : AV_PIX_FMT_YUVJ420P;
break;
default:
av_log(s->avctx, AV_LOG_ERROR, "Unhandled pixel format 0x%x\n", pix_fmt_id);
- return -1;
+ return AVERROR_PATCHWELCOME;
}
if (s->ls) {
if (s->nb_components > 1)
- s->avctx->pix_fmt = PIX_FMT_RGB24;
+ s->avctx->pix_fmt = AV_PIX_FMT_RGB24;
else if (s->bits <= 8)
- s->avctx->pix_fmt = PIX_FMT_GRAY8;
+ s->avctx->pix_fmt = AV_PIX_FMT_GRAY8;
else
- s->avctx->pix_fmt = PIX_FMT_GRAY16;
+ s->avctx->pix_fmt = AV_PIX_FMT_GRAY16;
}
if (s->picture_ptr->data[0])
s->avctx->release_buffer(s->avctx, s->picture_ptr);
- if (s->avctx->get_buffer(s->avctx, s->picture_ptr) < 0) {
+ if (ff_get_buffer(s->avctx, s->picture_ptr) < 0) {
av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return -1;
}
@@ -374,9 +372,9 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
for (i = 0; i < 3; i++)
s->linesize[i] = s->picture_ptr->linesize[i] << s->interlaced;
-// printf("%d %d %d %d %d %d\n",
-// s->width, s->height, s->linesize[0], s->linesize[1],
-// s->interlaced, s->avctx->height);
+ av_dlog(s->avctx, "%d %d %d %d %d %d\n",
+ s->width, s->height, s->linesize[0], s->linesize[1],
+ s->interlaced, s->avctx->height);
if (len != (8 + (3 * nb_components)))
av_log(s->avctx, AV_LOG_DEBUG, "decode_sof0: error, len(%d) mismatch\n", len);
@@ -426,7 +424,7 @@ static int decode_block(MJpegDecodeContext *s, DCTELEM *block, int component,
val = mjpeg_decode_dc(s, dc_index);
if (val == 0xffff) {
av_log(s->avctx, AV_LOG_ERROR, "error dc\n");
- return -1;
+ return AVERROR_INVALIDDATA;
}
val = val * quant_matrix[0] + s->last_dc[component];
s->last_dc[component] = val;
@@ -454,7 +452,7 @@ static int decode_block(MJpegDecodeContext *s, DCTELEM *block, int component,
if (i > 63) {
av_log(s->avctx, AV_LOG_ERROR, "error count: %d\n", i);
- return -1;
+ return AVERROR_INVALIDDATA;
}
j = s->scantable.permutated[i];
block[j] = level * quant_matrix[j];
@@ -474,7 +472,7 @@ static int decode_dc_progressive(MJpegDecodeContext *s, DCTELEM *block,
val = mjpeg_decode_dc(s, dc_index);
if (val == 0xffff) {
av_log(s->avctx, AV_LOG_ERROR, "error dc\n");
- return -1;
+ return AVERROR_INVALIDDATA;
}
val = (val * quant_matrix[0] << Al) + s->last_dc[component];
s->last_dc[component] = val;
@@ -523,7 +521,7 @@ static int decode_block_progressive(MJpegDecodeContext *s, DCTELEM *block,
break;
}
av_log(s->avctx, AV_LOG_ERROR, "error count: %d\n", i);
- return -1;
+ return AVERROR_INVALIDDATA;
}
j = s->scantable.permutated[i];
block[j] = level * quant_matrix[j] << Al;
@@ -532,7 +530,7 @@ static int decode_block_progressive(MJpegDecodeContext *s, DCTELEM *block,
i += 15;
if (i >= se) {
av_log(s->avctx, AV_LOG_ERROR, "ZRL overflow: %d\n", i);
- return -1;
+ return AVERROR_INVALIDDATA;
}
} else {
val = (1 << run);
@@ -806,21 +804,6 @@ static int ljpeg_decode_yuv_scan(MJpegDecodeContext *s, int predictor,
return 0;
}
-static av_always_inline void mjpeg_copy_block(uint8_t *dst, const uint8_t *src,
- int linesize, int lowres)
-{
- switch (lowres) {
- case 0: copy_block8(dst, src, linesize, linesize, 8);
- break;
- case 1: copy_block4(dst, src, linesize, linesize, 4);
- break;
- case 2: copy_block2(dst, src, linesize, linesize, 2);
- break;
- case 3: *dst = *src;
- break;
- }
-}
-
static int mjpeg_decode_scan(MJpegDecodeContext *s, int nb_components, int Ah,
int Al, const uint8_t *mb_bitmask,
const AVFrame *reference)
@@ -866,7 +849,7 @@ static int mjpeg_decode_scan(MJpegDecodeContext *s, int nb_components, int Ah,
if (get_bits_left(&s->gb) < 0) {
av_log(s->avctx, AV_LOG_ERROR, "overread %d\n",
-get_bits_left(&s->gb));
- return -1;
+ return AVERROR_INVALIDDATA;
}
for (i = 0; i < nb_components; i++) {
uint8_t *ptr;
@@ -879,16 +862,16 @@ static int mjpeg_decode_scan(MJpegDecodeContext *s, int nb_components, int Ah,
x = 0;
y = 0;
for (j = 0; j < n; j++) {
- block_offset = (((linesize[c] * (v * mb_y + y) * 8) +
- (h * mb_x + x) * 8) >> s->avctx->lowres);
+ block_offset = ((linesize[c] * (v * mb_y + y) * 8) +
+ (h * mb_x + x) * 8);
if (s->interlaced && s->bottom_field)
block_offset += linesize[c] >> 1;
ptr = data[c] + block_offset;
if (!s->progressive) {
if (copy_mb)
- mjpeg_copy_block(ptr, reference_data[c] + block_offset,
- linesize[c], s->avctx->lowres);
+ copy_block8(ptr, reference_data[c] + block_offset,
+ linesize[c], linesize[c], 8);
else {
s->dsp.clear_block(s->block);
if (decode_block(s, s->block, i,
@@ -896,7 +879,7 @@ static int mjpeg_decode_scan(MJpegDecodeContext *s, int nb_components, int Ah,
s->quant_matrixes[s->quant_index[c]]) < 0) {
av_log(s->avctx, AV_LOG_ERROR,
"error y=%d x=%d\n", mb_y, mb_x);
- return -1;
+ return AVERROR_INVALIDDATA;
}
s->dsp.idct_put(ptr, linesize[c], s->block);
}
@@ -912,14 +895,13 @@ static int mjpeg_decode_scan(MJpegDecodeContext *s, int nb_components, int Ah,
Al) < 0) {
av_log(s->avctx, AV_LOG_ERROR,
"error y=%d x=%d\n", mb_y, mb_x);
- return -1;
+ return AVERROR_INVALIDDATA;
}
}
- // av_log(s->avctx, AV_LOG_DEBUG, "mb: %d %d processed\n",
- // mb_y, mb_x);
- // av_log(NULL, AV_LOG_DEBUG, "%d %d %d %d %d %d %d %d \n",
- // mb_x, mb_y, x, y, c, s->bottom_field,
- // (v * mb_y + y) * 8, (h * mb_x + x) * 8);
+ av_dlog(s->avctx, "mb: %d %d processed\n", mb_y, mb_x);
+ av_dlog(s->avctx, "%d %d %d %d %d %d %d %d \n",
+ mb_x, mb_y, x, y, c, s->bottom_field,
+ (v * mb_y + y) * 8, (h * mb_x + x) * 8);
if (++x == h) {
x = 0;
y++;
@@ -983,7 +965,7 @@ static int mjpeg_decode_scan_progressive_ac(MJpegDecodeContext *s, int ss,
}
for (mb_y = 0; mb_y < s->mb_height; mb_y++) {
- int block_offset = (mb_y * linesize * 8 >> s->avctx->lowres);
+ int block_offset = mb_y * linesize * 8;
uint8_t *ptr = data + block_offset;
int block_idx = mb_y * s->block_stride[c];
DCTELEM (*block)[64] = &s->blocks[c][block_idx];
@@ -1002,17 +984,17 @@ static int mjpeg_decode_scan_progressive_ac(MJpegDecodeContext *s, int ss,
if (ret < 0) {
av_log(s->avctx, AV_LOG_ERROR,
"error y=%d x=%d\n", mb_y, mb_x);
- return -1;
+ return AVERROR_INVALIDDATA;
}
}
if (last_scan) {
if (copy_mb) {
- mjpeg_copy_block(ptr, reference_data + block_offset,
- linesize, s->avctx->lowres);
+ copy_block8(ptr, reference_data + block_offset,
+ linesize, linesize, 8);
} else {
s->dsp.idct_put(ptr, linesize, *block);
- ptr += 8 >> s->avctx->lowres;
+ ptr += 8;
}
}
}
@@ -1024,7 +1006,7 @@ int ff_mjpeg_decode_sos(MJpegDecodeContext *s, const uint8_t *mb_bitmask,
const AVFrame *reference)
{
int len, nb_components, i, h, v, predictor, point_transform;
- int index, id;
+ int index, id, ret;
const int block_size = s->lossless ? 1 : 8;
int ilv, prev_shift;
@@ -1034,11 +1016,11 @@ int ff_mjpeg_decode_sos(MJpegDecodeContext *s, const uint8_t *mb_bitmask,
if (nb_components == 0 || nb_components > MAX_COMPONENTS) {
av_log(s->avctx, AV_LOG_ERROR,
"decode_sos: nb_components (%d) unsupported\n", nb_components);
- return -1;
+ return AVERROR_PATCHWELCOME;
}
if (len != 6 + 2 * nb_components) {
av_log(s->avctx, AV_LOG_ERROR, "decode_sos: invalid len (%d)\n", len);
- return -1;
+ return AVERROR_INVALIDDATA;
}
for (i = 0; i < nb_components; i++) {
id = get_bits(&s->gb, 8) - 1;
@@ -1050,7 +1032,7 @@ int ff_mjpeg_decode_sos(MJpegDecodeContext *s, const uint8_t *mb_bitmask,
if (index == s->nb_components) {
av_log(s->avctx, AV_LOG_ERROR,
"decode_sos: index(%d) out of components\n", index);
- return -1;
+ return AVERROR_INVALIDDATA;
}
/* Metasoft MJPEG codec has Cb and Cr swapped */
if (s->avctx->codec_tag == MKTAG('M', 'T', 'S', 'J')
@@ -1079,9 +1061,6 @@ int ff_mjpeg_decode_sos(MJpegDecodeContext *s, const uint8_t *mb_bitmask,
prev_shift = get_bits(&s->gb, 4); /* Ah */
point_transform = get_bits(&s->gb, 4); /* Al */
- for (i = 0; i < nb_components; i++)
- s->last_dc[i] = 1024;
-
if (nb_components > 1) {
/* interleaved stream */
s->mb_width = (s->width + s->h_max * block_size - 1) / (s->h_max * block_size);
@@ -1107,46 +1086,72 @@ int ff_mjpeg_decode_sos(MJpegDecodeContext *s, const uint8_t *mb_bitmask,
for (i = s->mjpb_skiptosod; i > 0; i--)
skip_bits(&s->gb, 8);
+next_field:
+ for (i = 0; i < nb_components; i++)
+ s->last_dc[i] = 1024;
+
if (s->lossless) {
if (CONFIG_JPEGLS_DECODER && s->ls) {
// for () {
// reset_ls_coding_parameters(s, 0);
- if (ff_jpegls_decode_picture(s, predictor, point_transform, ilv) < 0)
- return -1;
+ if ((ret = ff_jpegls_decode_picture(s, predictor,
+ point_transform, ilv)) < 0)
+ return ret;
} else {
if (s->rgb) {
- if (ljpeg_decode_rgb_scan(s, predictor, point_transform) < 0)
- return -1;
+ if ((ret = ljpeg_decode_rgb_scan(s, predictor,
+ point_transform)) < 0)
+ return ret;
} else {
- if (ljpeg_decode_yuv_scan(s, predictor, point_transform,
- nb_components))
- return -1;
+ if ((ret = ljpeg_decode_yuv_scan(s, predictor,
+ point_transform,
+ nb_components)) < 0)
+ return ret;
}
}
} else {
if (s->progressive && predictor) {
- if (mjpeg_decode_scan_progressive_ac(s, predictor, ilv, prev_shift,
- point_transform,
- mb_bitmask, reference) < 0)
- return -1;
+ if ((ret = mjpeg_decode_scan_progressive_ac(s, predictor,
+ ilv, prev_shift,
+ point_transform,
+ mb_bitmask,
+ reference)) < 0)
+ return ret;
} else {
- if (mjpeg_decode_scan(s, nb_components, prev_shift, point_transform,
- mb_bitmask, reference) < 0)
- return -1;
+ if ((ret = mjpeg_decode_scan(s, nb_components,
+ prev_shift, point_transform,
+ mb_bitmask, reference)) < 0)
+ return ret;
+ }
+ }
+
+ if (s->interlaced &&
+ get_bits_left(&s->gb) > 32 &&
+ show_bits(&s->gb, 8) == 0xFF) {
+ GetBitContext bak = s->gb;
+ align_get_bits(&bak);
+ if (show_bits(&bak, 16) == 0xFFD1) {
+ av_dlog(s->avctx, "AVRn interlaced picture marker found\n");
+ s->gb = bak;
+ skip_bits(&s->gb, 16);
+ s->bottom_field ^= 1;
+
+ goto next_field;
}
}
+
emms_c();
return 0;
out_of_range:
av_log(s->avctx, AV_LOG_ERROR, "decode_sos: ac/dc index out of range\n");
- return -1;
+ return AVERROR_INVALIDDATA;
}
static int mjpeg_decode_dri(MJpegDecodeContext *s)
{
if (get_bits(&s->gb, 16) != 4)
- return -1;
+ return AVERROR_INVALIDDATA;
s->restart_interval = get_bits(&s->gb, 16);
s->restart_count = 0;
av_log(s->avctx, AV_LOG_DEBUG, "restart interval: %d\n",
@@ -1161,9 +1166,9 @@ static int mjpeg_decode_app(MJpegDecodeContext *s)
len = get_bits(&s->gb, 16);
if (len < 5)
- return -1;
+ return AVERROR_INVALIDDATA;
if (8 * len > get_bits_left(&s->gb))
- return -1;
+ return AVERROR_INVALIDDATA;
id = get_bits_long(&s->gb, 32);
id = av_be2ne32(id);
@@ -1184,8 +1189,6 @@ static int mjpeg_decode_app(MJpegDecodeContext *s)
4bytes field_size_less_padding
*/
s->buggy_avid = 1;
-// if (s->first_picture)
-// printf("mjpeg: workarounding buggy AVID\n");
i = get_bits(&s->gb, 8);
if (i == 2)
s->bottom_field = 1;
@@ -1197,8 +1200,6 @@ static int mjpeg_decode_app(MJpegDecodeContext *s)
skip_bits(&s->gb, 32);
len -= 10;
#endif
-// if (s->interlace_polarity)
-// printf("mjpeg: interlace polarity: %d\n", s->interlace_polarity);
goto out;
}
@@ -1320,8 +1321,6 @@ static int mjpeg_decode_com(MJpegDecodeContext *s)
/* buggy avid, it puts EOI only at every 10th frame */
if (!strcmp(cbuf, "AVID")) {
s->buggy_avid = 1;
- // if (s->first_picture)
- // printf("mjpeg: workarounding buggy AVID\n");
} else if (!strcmp(cbuf, "CS=ITU601"))
s->cs_itu601 = 1;
else if ((len > 20 && !strncmp(cbuf, "Intel(R) JPEG Library", 21)) ||
@@ -1373,13 +1372,9 @@ int ff_mjpeg_find_marker(MJpegDecodeContext *s,
int start_code;
start_code = find_marker(buf_ptr, buf_end);
- if ((buf_end - *buf_ptr) > s->buffer_size) {
- av_free(s->buffer);
- s->buffer_size = buf_end - *buf_ptr;
- s->buffer = av_malloc(s->buffer_size + FF_INPUT_BUFFER_PADDING_SIZE);
- av_log(s->avctx, AV_LOG_DEBUG,
- "buffer too small, expanding to %d bytes\n", s->buffer_size);
- }
+ av_fast_padded_malloc(&s->buffer, &s->buffer_size, buf_end - *buf_ptr);
+ if (!s->buffer)
+ return AVERROR(ENOMEM);
/* unescape buffer of SOS, use special treatment for JPEG-LS */
if (start_code == SOS && !s->ls) {
@@ -1390,7 +1385,7 @@ int ff_mjpeg_find_marker(MJpegDecodeContext *s,
uint8_t x = *(src++);
*(dst++) = x;
- if (s->avctx->codec_id != CODEC_ID_THP) {
+ if (s->avctx->codec_id != AV_CODEC_ID_THP) {
if (x == 0xff) {
while (src < buf_end && x == 0xff)
x = *(src++);
@@ -1404,6 +1399,8 @@ int ff_mjpeg_find_marker(MJpegDecodeContext *s,
}
*unescaped_buf_ptr = s->buffer;
*unescaped_buf_size = dst - s->buffer;
+ memset(s->buffer + *unescaped_buf_size, 0,
+ FF_INPUT_BUFFER_PADDING_SIZE);
av_log(s->avctx, AV_LOG_DEBUG, "escaping removed %td bytes\n",
(buf_end - *buf_ptr) - (dst - s->buffer));
@@ -1445,6 +1442,8 @@ int ff_mjpeg_find_marker(MJpegDecodeContext *s,
*unescaped_buf_ptr = dst;
*unescaped_buf_size = (bit_count + 7) >> 3;
+ memset(s->buffer + *unescaped_buf_size, 0,
+ FF_INPUT_BUFFER_PADDING_SIZE);
} else {
*unescaped_buf_ptr = *buf_ptr;
*unescaped_buf_size = buf_end - *buf_ptr;
@@ -1453,7 +1452,7 @@ int ff_mjpeg_find_marker(MJpegDecodeContext *s,
return start_code;
}
-int ff_mjpeg_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
+int ff_mjpeg_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
@@ -1463,6 +1462,7 @@ int ff_mjpeg_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
const uint8_t *unescaped_buf_ptr;
int unescaped_buf_size;
int start_code;
+ int ret = 0;
AVFrame *picture = data;
s->got_picture = 0; // picture from previous image can not be reused
@@ -1476,15 +1476,20 @@ int ff_mjpeg_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
/* EOF */
if (start_code < 0) {
goto the_end;
- } else if (unescaped_buf_size > (1U<<29)) {
- av_log(avctx, AV_LOG_ERROR, "MJPEG packet 0x%x too big (0x%x/0x%x), corrupt data?\n",
- start_code, unescaped_buf_ptr, buf_size);
+ } else if (unescaped_buf_size > INT_MAX / 8) {
+ av_log(avctx, AV_LOG_ERROR,
+ "MJPEG packet 0x%x too big (%d/%d), corrupt data?\n",
+ start_code, unescaped_buf_size, buf_size);
return AVERROR_INVALIDDATA;
} else {
av_log(avctx, AV_LOG_DEBUG, "marker=%x avail_size_in_buf=%td\n",
start_code, buf_end - buf_ptr);
- init_get_bits(&s->gb, unescaped_buf_ptr, unescaped_buf_size * 8);
+ ret = init_get_bits(&s->gb, unescaped_buf_ptr,
+ unescaped_buf_size * 8);
+
+ if (ret < 0)
+ return ret;
s->start_code = start_code;
if (s->avctx->debug & FF_DEBUG_STARTCODE)
@@ -1517,9 +1522,9 @@ int ff_mjpeg_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
ff_mjpeg_decode_dqt(s);
break;
case DHT:
- if (ff_mjpeg_decode_dht(s) < 0) {
+ if ((ret = ff_mjpeg_decode_dht(s)) < 0) {
av_log(avctx, AV_LOG_ERROR, "huffman table decode error\n");
- return -1;
+ return ret;
}
break;
case SOF0:
@@ -1527,33 +1532,34 @@ int ff_mjpeg_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
s->lossless = 0;
s->ls = 0;
s->progressive = 0;
- if (ff_mjpeg_decode_sof(s) < 0)
- return -1;
+ if ((ret = ff_mjpeg_decode_sof(s)) < 0)
+ return ret;
break;
case SOF2:
s->lossless = 0;
s->ls = 0;
s->progressive = 1;
- if (ff_mjpeg_decode_sof(s) < 0)
- return -1;
+ if ((ret = ff_mjpeg_decode_sof(s)) < 0)
+ return ret;
break;
case SOF3:
s->lossless = 1;
s->ls = 0;
s->progressive = 0;
- if (ff_mjpeg_decode_sof(s) < 0)
- return -1;
+ if ((ret = ff_mjpeg_decode_sof(s)) < 0)
+ return ret;
break;
case SOF48:
s->lossless = 1;
s->ls = 1;
s->progressive = 0;
- if (ff_mjpeg_decode_sof(s) < 0)
- return -1;
+ if ((ret = ff_mjpeg_decode_sof(s)) < 0)
+ return ret;
break;
case LSE:
- if (!CONFIG_JPEGLS_DECODER || ff_jpegls_decode_lse(s) < 0)
- return -1;
+ if (!CONFIG_JPEGLS_DECODER ||
+ (ret = ff_jpegls_decode_lse(s)) < 0)
+ return ret;
break;
case EOI:
s->cur_scan = 0;
@@ -1572,7 +1578,7 @@ eoi_parser:
goto not_the_end;
}
*picture = *s->picture_ptr;
- *data_size = sizeof(AVFrame);
+ *got_frame = 1;
if (!s->lossless) {
picture->quality = FFMAX3(s->qscale[0],
@@ -1595,9 +1601,9 @@ eoi_parser:
"Can not process SOS before SOF, skipping\n");
break;
}
- if (ff_mjpeg_decode_sos(s, NULL, NULL) < 0 &&
+ if ((ret = ff_mjpeg_decode_sos(s, NULL, NULL)) < 0 &&
(avctx->err_recognition & AV_EF_EXPLODE))
- return AVERROR_INVALIDDATA;
+ return ret;
/* buggy avid puts EOI every 10-20th frame */
/* if restart period is over process EOI */
if ((s->buggy_avid && !s->interlaced) || s->restart_interval)
@@ -1619,9 +1625,6 @@ eoi_parser:
av_log(avctx, AV_LOG_ERROR,
"mjpeg: unsupported coding type (%x)\n", start_code);
break;
-// default:
-// printf("mjpeg: unsupported marker (%x)\n", start_code);
-// break;
}
not_the_end:
@@ -1637,7 +1640,7 @@ not_the_end:
goto eoi_parser;
}
av_log(avctx, AV_LOG_FATAL, "No JPEG data found in image\n");
- return -1;
+ return AVERROR_INVALIDDATA;
the_end:
av_log(avctx, AV_LOG_DEBUG, "mjpeg decode frame unused %td bytes\n",
buf_end - buf_ptr);
@@ -1673,7 +1676,7 @@ av_cold int ff_mjpeg_decode_end(AVCodecContext *avctx)
#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), AV_OPT_TYPE_INT, { 0 }, 0, 1, VD },
+ OFFSET(extern_huff), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, VD },
{ NULL },
};
@@ -1687,13 +1690,12 @@ static const AVClass mjpegdec_class = {
AVCodec ff_mjpeg_decoder = {
.name = "mjpeg",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_MJPEG,
+ .id = AV_CODEC_ID_MJPEG,
.priv_data_size = sizeof(MJpegDecodeContext),
.init = ff_mjpeg_decode_init,
.close = ff_mjpeg_decode_end,
.decode = ff_mjpeg_decode_frame,
.capabilities = CODEC_CAP_DR1,
- .max_lowres = 3,
.long_name = NULL_IF_CONFIG_SMALL("MJPEG (Motion JPEG)"),
.priv_class = &mjpegdec_class,
};
@@ -1701,12 +1703,11 @@ AVCodec ff_mjpeg_decoder = {
AVCodec ff_thp_decoder = {
.name = "thp",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_THP,
+ .id = AV_CODEC_ID_THP,
.priv_data_size = sizeof(MJpegDecodeContext),
.init = ff_mjpeg_decode_init,
.close = ff_mjpeg_decode_end,
.decode = ff_mjpeg_decode_frame,
.capabilities = CODEC_CAP_DR1,
- .max_lowres = 3,
.long_name = NULL_IF_CONFIG_SMALL("Nintendo Gamecube THP video"),
};
diff --git a/gst-libs/ext/libav/libavcodec/mjpegdec.h b/gst-libs/ext/libav/libavcodec/mjpegdec.h
index bfa987d..89325ba 100644
--- a/gst-libs/ext/libav/libavcodec/mjpegdec.h
+++ b/gst-libs/ext/libav/libavcodec/mjpegdec.h
@@ -116,7 +116,7 @@ typedef struct MJpegDecodeContext {
int ff_mjpeg_decode_init(AVCodecContext *avctx);
int ff_mjpeg_decode_end(AVCodecContext *avctx);
int ff_mjpeg_decode_frame(AVCodecContext *avctx,
- void *data, int *data_size,
+ void *data, int *got_frame,
AVPacket *avpkt);
int ff_mjpeg_decode_dqt(MJpegDecodeContext *s);
int ff_mjpeg_decode_dht(MJpegDecodeContext *s);
diff --git a/gst-libs/ext/libav/libavcodec/mjpegenc.c b/gst-libs/ext/libav/libavcodec/mjpegenc.c
index d1005c8..64e6f25 100644
--- a/gst-libs/ext/libav/libavcodec/mjpegenc.c
+++ b/gst-libs/ext/libav/libavcodec/mjpegenc.c
@@ -58,20 +58,20 @@ av_cold int ff_mjpeg_encode_init(MpegEncContext *s)
/* build all the huffman tables */
ff_mjpeg_build_huffman_codes(m->huff_size_dc_luminance,
m->huff_code_dc_luminance,
- ff_mjpeg_bits_dc_luminance,
- ff_mjpeg_val_dc);
+ avpriv_mjpeg_bits_dc_luminance,
+ avpriv_mjpeg_val_dc);
ff_mjpeg_build_huffman_codes(m->huff_size_dc_chrominance,
m->huff_code_dc_chrominance,
- ff_mjpeg_bits_dc_chrominance,
- ff_mjpeg_val_dc);
+ avpriv_mjpeg_bits_dc_chrominance,
+ avpriv_mjpeg_val_dc);
ff_mjpeg_build_huffman_codes(m->huff_size_ac_luminance,
m->huff_code_ac_luminance,
- ff_mjpeg_bits_ac_luminance,
- ff_mjpeg_val_ac_luminance);
+ avpriv_mjpeg_bits_ac_luminance,
+ avpriv_mjpeg_val_ac_luminance);
ff_mjpeg_build_huffman_codes(m->huff_size_ac_chrominance,
m->huff_code_ac_chrominance,
- ff_mjpeg_bits_ac_chrominance,
- ff_mjpeg_val_ac_chrominance);
+ avpriv_mjpeg_bits_ac_chrominance,
+ avpriv_mjpeg_val_ac_chrominance);
s->mjpeg_ctx = m;
return 0;
@@ -138,15 +138,15 @@ static void jpeg_table_header(MpegEncContext *s)
ptr = put_bits_ptr(p);
put_bits(p, 16, 0); /* patched later */
size = 2;
- size += put_huffman_table(s, 0, 0, ff_mjpeg_bits_dc_luminance,
- ff_mjpeg_val_dc);
- size += put_huffman_table(s, 0, 1, ff_mjpeg_bits_dc_chrominance,
- ff_mjpeg_val_dc);
-
- size += put_huffman_table(s, 1, 0, ff_mjpeg_bits_ac_luminance,
- ff_mjpeg_val_ac_luminance);
- size += put_huffman_table(s, 1, 1, ff_mjpeg_bits_ac_chrominance,
- ff_mjpeg_val_ac_chrominance);
+ size += put_huffman_table(s, 0, 0, avpriv_mjpeg_bits_dc_luminance,
+ avpriv_mjpeg_val_dc);
+ size += put_huffman_table(s, 0, 1, avpriv_mjpeg_bits_dc_chrominance,
+ avpriv_mjpeg_val_dc);
+
+ size += put_huffman_table(s, 1, 0, avpriv_mjpeg_bits_ac_luminance,
+ avpriv_mjpeg_val_ac_luminance);
+ size += put_huffman_table(s, 1, 1, avpriv_mjpeg_bits_ac_chrominance,
+ avpriv_mjpeg_val_ac_chrominance);
AV_WB16(ptr, size);
}
@@ -161,7 +161,7 @@ static void jpeg_put_comments(MpegEncContext *s)
/* JFIF header */
put_marker(p, APP0);
put_bits(p, 16, 16);
- ff_put_string(p, "JFIF", 1); /* this puts the trailing zero-byte too */
+ avpriv_put_string(p, "JFIF", 1); /* this puts the trailing zero-byte too */
put_bits(p, 16, 0x0201); /* v 1.02 */
put_bits(p, 8, 0); /* units type: 0 - aspect ratio */
put_bits(p, 16, s->avctx->sample_aspect_ratio.num);
@@ -176,19 +176,19 @@ static void jpeg_put_comments(MpegEncContext *s)
flush_put_bits(p);
ptr = put_bits_ptr(p);
put_bits(p, 16, 0); /* patched later */
- ff_put_string(p, LIBAVCODEC_IDENT, 1);
+ avpriv_put_string(p, LIBAVCODEC_IDENT, 1);
size = strlen(LIBAVCODEC_IDENT)+3;
AV_WB16(ptr, size);
}
- if( s->avctx->pix_fmt == PIX_FMT_YUV420P
- ||s->avctx->pix_fmt == PIX_FMT_YUV422P
- ||s->avctx->pix_fmt == PIX_FMT_YUV444P){
+ if( s->avctx->pix_fmt == AV_PIX_FMT_YUV420P
+ ||s->avctx->pix_fmt == AV_PIX_FMT_YUV422P
+ ||s->avctx->pix_fmt == AV_PIX_FMT_YUV444P){
put_marker(p, COM);
flush_put_bits(p);
ptr = put_bits_ptr(p);
put_bits(p, 16, 0); /* patched later */
- ff_put_string(p, "CS=ITU601", 1);
+ avpriv_put_string(p, "CS=ITU601", 1);
size = strlen("CS=ITU601")+3;
AV_WB16(ptr, size);
}
@@ -196,7 +196,7 @@ static void jpeg_put_comments(MpegEncContext *s)
void ff_mjpeg_encode_picture_header(MpegEncContext *s)
{
- const int lossless= s->avctx->codec_id != CODEC_ID_MJPEG;
+ const int lossless= s->avctx->codec_id != AV_CODEC_ID_MJPEG;
put_marker(&s->pb, SOI);
@@ -205,13 +205,13 @@ void ff_mjpeg_encode_picture_header(MpegEncContext *s)
jpeg_table_header(s);
switch(s->avctx->codec_id){
- case CODEC_ID_MJPEG: put_marker(&s->pb, SOF0 ); break;
- case CODEC_ID_LJPEG: put_marker(&s->pb, SOF3 ); break;
+ case AV_CODEC_ID_MJPEG: put_marker(&s->pb, SOF0 ); break;
+ case AV_CODEC_ID_LJPEG: put_marker(&s->pb, SOF3 ); break;
default: assert(0);
}
put_bits(&s->pb, 16, 17);
- if(lossless && s->avctx->pix_fmt == PIX_FMT_BGRA)
+ if(lossless && s->avctx->pix_fmt == AV_PIX_FMT_BGRA)
put_bits(&s->pb, 8, 9); /* 9 bits/component RCT */
else
put_bits(&s->pb, 8, 8); /* 8 bits/component */
@@ -268,8 +268,8 @@ void ff_mjpeg_encode_picture_header(MpegEncContext *s)
put_bits(&s->pb, 8, lossless ? s->avctx->prediction_method+1 : 0); /* Ss (not used) */
switch(s->avctx->codec_id){
- case CODEC_ID_MJPEG: put_bits(&s->pb, 8, 63); break; /* Se (not used) */
- case CODEC_ID_LJPEG: put_bits(&s->pb, 8, 0); break; /* not used */
+ case AV_CODEC_ID_MJPEG: put_bits(&s->pb, 8, 63); break; /* Se (not used) */
+ case AV_CODEC_ID_LJPEG: put_bits(&s->pb, 8, 0); break; /* not used */
default: assert(0);
}
@@ -320,7 +320,6 @@ static void escape_FF(MpegEncContext *s, int start)
int v= buf[i];
if(v==0xFF){
-//printf("%d %d\n", i, ff_count);
buf[i+ff_count]= 0;
ff_count--;
}
@@ -448,11 +447,13 @@ void ff_mjpeg_encode_mb(MpegEncContext *s, DCTELEM block[6][64])
AVCodec ff_mjpeg_encoder = {
.name = "mjpeg",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_MJPEG,
+ .id = AV_CODEC_ID_MJPEG,
.priv_data_size = sizeof(MpegEncContext),
- .init = MPV_encode_init,
- .encode = MPV_encode_picture,
- .close = MPV_encode_end,
- .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUVJ420P, PIX_FMT_YUVJ422P, PIX_FMT_NONE},
- .long_name= NULL_IF_CONFIG_SMALL("MJPEG (Motion JPEG)"),
+ .init = ff_MPV_encode_init,
+ .encode2 = ff_MPV_encode_picture,
+ .close = ff_MPV_encode_end,
+ .pix_fmts = (const enum AVPixelFormat[]){
+ AV_PIX_FMT_YUVJ420P, AV_PIX_FMT_YUVJ422P, AV_PIX_FMT_NONE
+ },
+ .long_name = NULL_IF_CONFIG_SMALL("MJPEG (Motion JPEG)"),
};
diff --git a/gst-libs/ext/libav/libavcodec/mlib/dsputil_mlib.c b/gst-libs/ext/libav/libavcodec/mlib/dsputil_mlib.c
deleted file mode 100644
index bfa5153..0000000
--- a/gst-libs/ext/libav/libavcodec/mlib/dsputil_mlib.c
+++ /dev/null
@@ -1,469 +0,0 @@
-/*
- * Sun mediaLib optimized DSP utils
- * Copyright (c) 2001 Fabrice Bellard
- *
- * 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
- */
-
-#include "libavcodec/dsputil.h"
-#include "libavcodec/mpegvideo.h"
-
-#include <mlib_types.h>
-#include <mlib_status.h>
-#include <mlib_sys.h>
-#include <mlib_algebra.h>
-#include <mlib_video.h>
-
-/* misc */
-
-static void get_pixels_mlib(DCTELEM *restrict block, const uint8_t *pixels, int line_size)
-{
- int i;
-
- for (i=0;i<8;i++) {
- mlib_VectorConvert_S16_U8_Mod((mlib_s16 *)block, (mlib_u8 *)pixels, 8);
-
- pixels += line_size;
- block += 8;
- }
-}
-
-static void diff_pixels_mlib(DCTELEM *restrict block, const uint8_t *s1, const uint8_t *s2, int line_size)
-{
- int i;
-
- for (i=0;i<8;i++) {
- mlib_VectorSub_S16_U8_Mod((mlib_s16 *)block, (mlib_u8 *)s1, (mlib_u8 *)s2, 8);
-
- s1 += line_size;
- s2 += line_size;
- block += 8;
- }
-}
-
-static void add_pixels_clamped_mlib(const DCTELEM *block, uint8_t *pixels, int line_size)
-{
- mlib_VideoAddBlock_U8_S16(pixels, (mlib_s16 *)block, line_size);
-}
-
-/* put block, width 16 pixel, height 8/16 */
-
-static void put_pixels16_mlib (uint8_t * dest, const uint8_t * ref,
- int stride, int height)
-{
- switch (height) {
- case 8:
- mlib_VideoCopyRef_U8_U8_16x8(dest, (uint8_t *)ref, stride);
- break;
-
- case 16:
- mlib_VideoCopyRef_U8_U8_16x16(dest, (uint8_t *)ref, stride);
- break;
-
- default:
- assert(0);
- }
-}
-
-static void put_pixels16_x2_mlib (uint8_t * dest, const uint8_t * ref,
- int stride, int height)
-{
- switch (height) {
- case 8:
- mlib_VideoInterpX_U8_U8_16x8(dest, (uint8_t *)ref, stride, stride);
- break;
-
- case 16:
- mlib_VideoInterpX_U8_U8_16x16(dest, (uint8_t *)ref, stride, stride);
- break;
-
- default:
- assert(0);
- }
-}
-
-static void put_pixels16_y2_mlib (uint8_t * dest, const uint8_t * ref,
- int stride, int height)
-{
- switch (height) {
- case 8:
- mlib_VideoInterpY_U8_U8_16x8(dest, (uint8_t *)ref, stride, stride);
- break;
-
- case 16:
- mlib_VideoInterpY_U8_U8_16x16(dest, (uint8_t *)ref, stride, stride);
- break;
-
- default:
- assert(0);
- }
-}
-
-static void put_pixels16_xy2_mlib(uint8_t * dest, const uint8_t * ref,
- int stride, int height)
-{
- switch (height) {
- case 8:
- mlib_VideoInterpXY_U8_U8_16x8(dest, (uint8_t *)ref, stride, stride);
- break;
-
- case 16:
- mlib_VideoInterpXY_U8_U8_16x16(dest, (uint8_t *)ref, stride, stride);
- break;
-
- default:
- assert(0);
- }
-}
-
-/* put block, width 8 pixel, height 4/8/16 */
-
-static void put_pixels8_mlib (uint8_t * dest, const uint8_t * ref,
- int stride, int height)
-{
- switch (height) {
- case 4:
- mlib_VideoCopyRef_U8_U8_8x4(dest, (uint8_t *)ref, stride);
- break;
-
- case 8:
- mlib_VideoCopyRef_U8_U8_8x8(dest, (uint8_t *)ref, stride);
- break;
-
- case 16:
- mlib_VideoCopyRef_U8_U8_8x16(dest, (uint8_t *)ref, stride);
- break;
-
- default:
- assert(0);
- }
-}
-
-static void put_pixels8_x2_mlib (uint8_t * dest, const uint8_t * ref,
- int stride, int height)
-{
- switch (height) {
- case 4:
- mlib_VideoInterpX_U8_U8_8x4(dest, (uint8_t *)ref, stride, stride);
- break;
-
- case 8:
- mlib_VideoInterpX_U8_U8_8x8(dest, (uint8_t *)ref, stride, stride);
- break;
-
- case 16:
- mlib_VideoInterpX_U8_U8_8x16(dest, (uint8_t *)ref, stride, stride);
- break;
-
- default:
- assert(0);
- }
-}
-
-static void put_pixels8_y2_mlib (uint8_t * dest, const uint8_t * ref,
- int stride, int height)
-{
- switch (height) {
- case 4:
- mlib_VideoInterpY_U8_U8_8x4(dest, (uint8_t *)ref, stride, stride);
- break;
-
- case 8:
- mlib_VideoInterpY_U8_U8_8x8(dest, (uint8_t *)ref, stride, stride);
- break;
-
- case 16:
- mlib_VideoInterpY_U8_U8_8x16(dest, (uint8_t *)ref, stride, stride);
- break;
-
- default:
- assert(0);
- }
-}
-
-static void put_pixels8_xy2_mlib(uint8_t * dest, const uint8_t * ref,
- int stride, int height)
-{
- switch (height) {
- case 4:
- mlib_VideoInterpXY_U8_U8_8x4(dest, (uint8_t *)ref, stride, stride);
- break;
-
- case 8:
- mlib_VideoInterpXY_U8_U8_8x8(dest, (uint8_t *)ref, stride, stride);
- break;
-
- case 16:
- mlib_VideoInterpXY_U8_U8_8x16(dest, (uint8_t *)ref, stride, stride);
- break;
-
- default:
- assert(0);
- }
-}
-
-/* average block, width 16 pixel, height 8/16 */
-
-static void avg_pixels16_mlib (uint8_t * dest, const uint8_t * ref,
- int stride, int height)
-{
- switch (height) {
- case 8:
- mlib_VideoCopyRefAve_U8_U8_16x8(dest, (uint8_t *)ref, stride);
- break;
-
- case 16:
- mlib_VideoCopyRefAve_U8_U8_16x16(dest, (uint8_t *)ref, stride);
- break;
-
- default:
- assert(0);
- }
-}
-
-static void avg_pixels16_x2_mlib (uint8_t * dest, const uint8_t * ref,
- int stride, int height)
-{
- switch (height) {
- case 8:
- mlib_VideoInterpAveX_U8_U8_16x8(dest, (uint8_t *)ref, stride, stride);
- break;
-
- case 16:
- mlib_VideoInterpAveX_U8_U8_16x16(dest, (uint8_t *)ref, stride, stride);
- break;
-
- default:
- assert(0);
- }
-}
-
-static void avg_pixels16_y2_mlib (uint8_t * dest, const uint8_t * ref,
- int stride, int height)
-{
- switch (height) {
- case 8:
- mlib_VideoInterpAveY_U8_U8_16x8(dest, (uint8_t *)ref, stride, stride);
- break;
-
- case 16:
- mlib_VideoInterpAveY_U8_U8_16x16(dest, (uint8_t *)ref, stride, stride);
- break;
-
- default:
- assert(0);
- }
-}
-
-static void avg_pixels16_xy2_mlib(uint8_t * dest, const uint8_t * ref,
- int stride, int height)
-{
- switch (height) {
- case 8:
- mlib_VideoInterpAveXY_U8_U8_16x8(dest, (uint8_t *)ref, stride, stride);
- break;
-
- case 16:
- mlib_VideoInterpAveXY_U8_U8_16x16(dest, (uint8_t *)ref, stride, stride);
- break;
-
- default:
- assert(0);
- }
-}
-
-/* average block, width 8 pixel, height 4/8/16 */
-
-static void avg_pixels8_mlib (uint8_t * dest, const uint8_t * ref,
- int stride, int height)
-{
- switch (height) {
- case 4:
- mlib_VideoCopyRefAve_U8_U8_8x4(dest, (uint8_t *)ref, stride);
- break;
-
- case 8:
- mlib_VideoCopyRefAve_U8_U8_8x8(dest, (uint8_t *)ref, stride);
- break;
-
- case 16:
- mlib_VideoCopyRefAve_U8_U8_8x16(dest, (uint8_t *)ref, stride);
- break;
-
- default:
- assert(0);
- }
-}
-
-static void avg_pixels8_x2_mlib (uint8_t * dest, const uint8_t * ref,
- int stride, int height)
-{
- switch (height) {
- case 4:
- mlib_VideoInterpAveX_U8_U8_8x4(dest, (uint8_t *)ref, stride, stride);
- break;
-
- case 8:
- mlib_VideoInterpAveX_U8_U8_8x8(dest, (uint8_t *)ref, stride, stride);
- break;
-
- case 16:
- mlib_VideoInterpAveX_U8_U8_8x16(dest, (uint8_t *)ref, stride, stride);
- break;
-
- default:
- assert(0);
- }
-}
-
-static void avg_pixels8_y2_mlib (uint8_t * dest, const uint8_t * ref,
- int stride, int height)
-{
- switch (height) {
- case 4:
- mlib_VideoInterpAveY_U8_U8_8x4(dest, (uint8_t *)ref, stride, stride);
- break;
-
- case 8:
- mlib_VideoInterpAveY_U8_U8_8x8(dest, (uint8_t *)ref, stride, stride);
- break;
-
- case 16:
- mlib_VideoInterpAveY_U8_U8_8x16(dest, (uint8_t *)ref, stride, stride);
- break;
-
- default:
- assert(0);
- }
-}
-
-static void avg_pixels8_xy2_mlib(uint8_t * dest, const uint8_t * ref,
- int stride, int height)
-{
- switch (height) {
- case 4:
- mlib_VideoInterpAveXY_U8_U8_8x4(dest, (uint8_t *)ref, stride, stride);
- break;
-
- case 8:
- mlib_VideoInterpAveXY_U8_U8_8x8(dest, (uint8_t *)ref, stride, stride);
- break;
-
- case 16:
- mlib_VideoInterpAveXY_U8_U8_8x16(dest, (uint8_t *)ref, stride, stride);
- break;
-
- default:
- assert(0);
- }
-}
-
-/* swap byte order of a buffer */
-
-static void bswap_buf_mlib(uint32_t *dst, const uint32_t *src, int w)
-{
- mlib_VectorReverseByteOrder_U32_U32(dst, src, w);
-}
-
-/* transformations */
-
-static void ff_idct_put_mlib(uint8_t *dest, int line_size, DCTELEM *data)
-{
- int i;
- uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
-
- mlib_VideoIDCT8x8_S16_S16 (data, data);
-
- for(i=0;i<8;i++) {
- dest[0] = cm[data[0]];
- dest[1] = cm[data[1]];
- dest[2] = cm[data[2]];
- dest[3] = cm[data[3]];
- dest[4] = cm[data[4]];
- dest[5] = cm[data[5]];
- dest[6] = cm[data[6]];
- dest[7] = cm[data[7]];
-
- dest += line_size;
- data += 8;
- }
-}
-
-static void ff_idct_add_mlib(uint8_t *dest, int line_size, DCTELEM *data)
-{
- mlib_VideoIDCT8x8_S16_S16 (data, data);
- mlib_VideoAddBlock_U8_S16(dest, (mlib_s16 *)data, line_size);
-}
-
-static void ff_idct_mlib(DCTELEM *data)
-{
- mlib_VideoIDCT8x8_S16_S16 (data, data);
-}
-
-static void ff_fdct_mlib(DCTELEM *data)
-{
- mlib_VideoDCT8x8_S16_S16 (data, data);
-}
-
-void dsputil_init_mlib(DSPContext* c, AVCodecContext *avctx)
-{
- const int high_bit_depth = avctx->bits_per_raw_sample > 8;
-
- c->diff_pixels = diff_pixels_mlib;
- c->add_pixels_clamped = add_pixels_clamped_mlib;
-
- if (!high_bit_depth) {
- c->get_pixels = get_pixels_mlib;
-
- c->put_pixels_tab[0][0] = put_pixels16_mlib;
- c->put_pixels_tab[0][1] = put_pixels16_x2_mlib;
- c->put_pixels_tab[0][2] = put_pixels16_y2_mlib;
- c->put_pixels_tab[0][3] = put_pixels16_xy2_mlib;
- c->put_pixels_tab[1][0] = put_pixels8_mlib;
- c->put_pixels_tab[1][1] = put_pixels8_x2_mlib;
- c->put_pixels_tab[1][2] = put_pixels8_y2_mlib;
- c->put_pixels_tab[1][3] = put_pixels8_xy2_mlib;
-
- c->avg_pixels_tab[0][0] = avg_pixels16_mlib;
- c->avg_pixels_tab[0][1] = avg_pixels16_x2_mlib;
- c->avg_pixels_tab[0][2] = avg_pixels16_y2_mlib;
- c->avg_pixels_tab[0][3] = avg_pixels16_xy2_mlib;
- c->avg_pixels_tab[1][0] = avg_pixels8_mlib;
- c->avg_pixels_tab[1][1] = avg_pixels8_x2_mlib;
- c->avg_pixels_tab[1][2] = avg_pixels8_y2_mlib;
- c->avg_pixels_tab[1][3] = avg_pixels8_xy2_mlib;
-
- c->put_no_rnd_pixels_tab[0][0] = put_pixels16_mlib;
- c->put_no_rnd_pixels_tab[1][0] = put_pixels8_mlib;
- }
-
- c->bswap_buf = bswap_buf_mlib;
-}
-
-void MPV_common_init_mlib(MpegEncContext *s)
-{
- if(s->avctx->dct_algo==FF_DCT_AUTO || s->avctx->dct_algo==FF_DCT_MLIB){
- s->dsp.fdct = ff_fdct_mlib;
- }
-
- if(s->avctx->idct_algo==FF_IDCT_MLIB){
- s->dsp.idct_put= ff_idct_put_mlib;
- s->dsp.idct_add= ff_idct_add_mlib;
- s->dsp.idct = ff_idct_mlib;
- s->dsp.idct_permutation_type= FF_NO_IDCT_PERM;
- }
-}
diff --git a/gst-libs/ext/libav/libavcodec/mlp.h b/gst-libs/ext/libav/libavcodec/mlp.h
index b001ad2..d771112 100644
--- a/gst-libs/ext/libav/libavcodec/mlp.h
+++ b/gst-libs/ext/libav/libavcodec/mlp.h
@@ -71,7 +71,7 @@
#define IIR 1
/** filter data */
-typedef struct {
+typedef struct FilterParams {
uint8_t order; ///< number of taps in filter
uint8_t shift; ///< Right shift to apply to output of filter.
@@ -79,7 +79,7 @@ typedef struct {
} FilterParams;
/** sample data coding information */
-typedef struct {
+typedef struct ChannelParams {
FilterParams filter_params[NUM_FILTERS];
int32_t coeff[NUM_FILTERS][MAX_FIR_ORDER];
diff --git a/gst-libs/ext/libav/libavcodec/mlp_parser.c b/gst-libs/ext/libav/libavcodec/mlp_parser.c
index e0fedeb..31c79c9 100644
--- a/gst-libs/ext/libav/libavcodec/mlp_parser.c
+++ b/gst-libs/ext/libav/libavcodec/mlp_parser.c
@@ -26,8 +26,8 @@
#include <stdint.h>
+#include "libavutil/channel_layout.h"
#include "libavutil/crc.h"
-#include "libavutil/audioconvert.h"
#include "get_bits.h"
#include "parser.h"
#include "mlp_parser.h"
@@ -79,14 +79,14 @@ static const uint64_t thd_layout[13] = {
AV_CH_LOW_FREQUENCY, // LFE
AV_CH_SIDE_LEFT|AV_CH_SIDE_RIGHT, // LRs
AV_CH_TOP_FRONT_LEFT|AV_CH_TOP_FRONT_RIGHT, // LRvh
- AV_CH_SIDE_LEFT|AV_CH_SIDE_RIGHT, // LRc
+ AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER, // LRc
AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT, // LRrs
AV_CH_BACK_CENTER, // Cs
- AV_CH_TOP_BACK_CENTER, // Ts
- AV_CH_SIDE_LEFT|AV_CH_SIDE_RIGHT, // LRsd
- AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER, // LRw
- AV_CH_TOP_BACK_CENTER, // Cvh
- AV_CH_LOW_FREQUENCY // LFE2
+ AV_CH_TOP_CENTER, // Ts
+ AV_CH_SURROUND_DIRECT_LEFT|AV_CH_SURROUND_DIRECT_RIGHT, // LRsd
+ AV_CH_WIDE_LEFT|AV_CH_WIDE_RIGHT, // LRw
+ AV_CH_TOP_FRONT_CENTER, // Cvh
+ AV_CH_LOW_FREQUENCY_2, // LFE2
};
static int mlp_samplerate(int in)
@@ -109,7 +109,8 @@ static int truehd_channels(int chanmap)
static uint64_t truehd_layout(int chanmap)
{
- int layout = 0, i;
+ int i;
+ uint64_t layout = 0;
for (i = 0; i < 13; i++)
layout |= thd_layout[i] * ((chanmap >> i) & 1);
@@ -125,7 +126,7 @@ static uint64_t truehd_layout(int chanmap)
int ff_mlp_read_major_sync(void *log, MLPHeaderInfo *mh, GetBitContext *gb)
{
- int ratebits;
+ int ratebits, channel_arrangement;
uint16_t checksum;
assert(get_bits_count(gb) == 0);
@@ -156,7 +157,9 @@ int ff_mlp_read_major_sync(void *log, MLPHeaderInfo *mh, GetBitContext *gb)
skip_bits(gb, 11);
- mh->channels_mlp = get_bits(gb, 5);
+ channel_arrangement = get_bits(gb, 5);
+ mh->channels_mlp = mlp_channels[channel_arrangement];
+ mh->channel_layout_mlp = mlp_layout[channel_arrangement];
} else if (mh->stream_type == 0xba) {
mh->group1_bits = 24; // TODO: Is this information actually conveyed anywhere?
mh->group2_bits = 0;
@@ -167,11 +170,15 @@ int ff_mlp_read_major_sync(void *log, MLPHeaderInfo *mh, GetBitContext *gb)
skip_bits(gb, 8);
- mh->channels_thd_stream1 = get_bits(gb, 5);
+ channel_arrangement = get_bits(gb, 5);
+ mh->channels_thd_stream1 = truehd_channels(channel_arrangement);
+ mh->channel_layout_thd_stream1 = truehd_layout(channel_arrangement);
skip_bits(gb, 2);
- mh->channels_thd_stream2 = get_bits(gb, 13);
+ channel_arrangement = get_bits(gb, 13);
+ mh->channels_thd_stream2 = truehd_channels(channel_arrangement);
+ mh->channel_layout_thd_stream2 = truehd_layout(channel_arrangement);
} else
return AVERROR_INVALIDDATA;
@@ -311,20 +318,20 @@ static int mlp_parse(AVCodecParserContext *s,
else
avctx->sample_fmt = AV_SAMPLE_FMT_S16;
avctx->sample_rate = mh.group1_samplerate;
- avctx->frame_size = mh.access_unit_size;
+ s->duration = mh.access_unit_size;
if (mh.stream_type == 0xbb) {
/* MLP stream */
- avctx->channels = mlp_channels[mh.channels_mlp];
- avctx->channel_layout = mlp_layout[mh.channels_mlp];
+ avctx->channels = mh.channels_mlp;
+ avctx->channel_layout = mh.channel_layout_mlp;
} else { /* mh.stream_type == 0xba */
/* TrueHD stream */
if (mh.channels_thd_stream2) {
- avctx->channels = truehd_channels(mh.channels_thd_stream2);
- avctx->channel_layout = truehd_layout(mh.channels_thd_stream2);
+ avctx->channels = mh.channels_thd_stream2;
+ avctx->channel_layout = mh.channel_layout_thd_stream2;
} else {
- avctx->channels = truehd_channels(mh.channels_thd_stream1);
- avctx->channel_layout = truehd_layout(mh.channels_thd_stream1);
+ avctx->channels = mh.channels_thd_stream1;
+ avctx->channel_layout = mh.channel_layout_thd_stream1;
}
}
@@ -345,7 +352,7 @@ lost_sync:
}
AVCodecParser ff_mlp_parser = {
- .codec_ids = { CODEC_ID_MLP, CODEC_ID_TRUEHD },
+ .codec_ids = { AV_CODEC_ID_MLP, AV_CODEC_ID_TRUEHD },
.priv_data_size = sizeof(MLPParseContext),
.parser_init = mlp_init,
.parser_parse = mlp_parse,
diff --git a/gst-libs/ext/libav/libavcodec/mlp_parser.h b/gst-libs/ext/libav/libavcodec/mlp_parser.h
index 940ba83..24b4169 100644
--- a/gst-libs/ext/libav/libavcodec/mlp_parser.h
+++ b/gst-libs/ext/libav/libavcodec/mlp_parser.h
@@ -39,9 +39,12 @@ typedef struct MLPHeaderInfo
int group1_samplerate; ///< Sample rate of first substream
int group2_samplerate; ///< Sample rate of second substream (MLP only)
- int channels_mlp; ///< Channel arrangement for MLP streams
- int channels_thd_stream1; ///< Channel arrangement for substream 1 of TrueHD streams (5.1)
- int channels_thd_stream2; ///< Channel arrangement for substream 2 of TrueHD streams (7.1)
+ int channels_mlp; ///< Channel count for MLP streams
+ int channels_thd_stream1; ///< Channel count for substream 1 of TrueHD streams ("6-channel presentation")
+ int channels_thd_stream2; ///< Channel count for substream 2 of TrueHD streams ("8-channel presentation")
+ uint64_t channel_layout_mlp; ///< Channel layout for MLP streams
+ uint64_t channel_layout_thd_stream1; ///< Channel layout for substream 1 of TrueHD streams ("6-channel presentation")
+ uint64_t channel_layout_thd_stream2; ///< Channel layout for substream 2 of TrueHD streams ("8-channel presentation")
int access_unit_size; ///< Number of samples per coded frame
int access_unit_size_pow2; ///< Next power of two above number of samples per frame
@@ -56,4 +59,3 @@ typedef struct MLPHeaderInfo
int ff_mlp_read_major_sync(void *log, MLPHeaderInfo *mh, GetBitContext *gb);
#endif /* AVCODEC_MLP_PARSER_H */
-
diff --git a/gst-libs/ext/libav/libavcodec/mlpdec.c b/gst-libs/ext/libav/libavcodec/mlpdec.c
index 357e287..0eaf2e3 100644
--- a/gst-libs/ext/libav/libavcodec/mlpdec.c
+++ b/gst-libs/ext/libav/libavcodec/mlpdec.c
@@ -27,23 +27,19 @@
#include <stdint.h>
#include "avcodec.h"
-#include "dsputil.h"
#include "libavutil/intreadwrite.h"
+#include "libavutil/channel_layout.h"
#include "get_bits.h"
+#include "internal.h"
#include "libavutil/crc.h"
#include "parser.h"
#include "mlp_parser.h"
+#include "mlpdsp.h"
#include "mlp.h"
/** number of bits used for VLC lookup - longest Huffman code is 9 */
#define VLC_BITS 9
-
-static const char* sample_message =
- "Please file a bug report following the instructions at "
- "http://libav.org/bugreports.html and include "
- "a sample of this file.";
-
typedef struct SubStream {
/// Set if a valid restart header has been read. Otherwise the substream cannot be decoded.
uint8_t restart_seen;
@@ -61,6 +57,8 @@ typedef struct SubStream {
uint8_t max_matrix_channel;
/// For each channel output by the matrix, the output channel to map it to
uint8_t ch_assign[MAX_CHANNELS];
+ /// The channel layout for this substream
+ uint64_t ch_layout;
/// Channel coding parameters for channels in the substream
ChannelParams channel_params[MAX_CHANNELS];
@@ -148,9 +146,39 @@ typedef struct MLPDecodeContext {
int8_t bypassed_lsbs[MAX_BLOCKSIZE][MAX_CHANNELS];
int32_t sample_buffer[MAX_BLOCKSIZE][MAX_CHANNELS];
- DSPContext dsp;
+ MLPDSPContext dsp;
} MLPDecodeContext;
+static const uint64_t thd_channel_order[] = {
+ AV_CH_FRONT_LEFT, AV_CH_FRONT_RIGHT, // LR
+ AV_CH_FRONT_CENTER, // C
+ AV_CH_LOW_FREQUENCY, // LFE
+ AV_CH_SIDE_LEFT, AV_CH_SIDE_RIGHT, // LRs
+ AV_CH_TOP_FRONT_LEFT, AV_CH_TOP_FRONT_RIGHT, // LRvh
+ AV_CH_FRONT_LEFT_OF_CENTER, AV_CH_FRONT_RIGHT_OF_CENTER, // LRc
+ AV_CH_BACK_LEFT, AV_CH_BACK_RIGHT, // LRrs
+ AV_CH_BACK_CENTER, // Cs
+ AV_CH_TOP_CENTER, // Ts
+ AV_CH_SURROUND_DIRECT_LEFT, AV_CH_SURROUND_DIRECT_RIGHT, // LRsd
+ AV_CH_WIDE_LEFT, AV_CH_WIDE_RIGHT, // LRw
+ AV_CH_TOP_FRONT_CENTER, // Cvh
+ AV_CH_LOW_FREQUENCY_2, // LFE2
+};
+
+static uint64_t thd_channel_layout_extract_channel(uint64_t channel_layout,
+ int index)
+{
+ int i;
+
+ if (av_get_channel_layout_nb_channels(channel_layout) <= index)
+ return 0;
+
+ for (i = 0; i < FF_ARRAY_ELEMS(thd_channel_order); i++)
+ if (channel_layout & thd_channel_order[i] && !index--)
+ return thd_channel_order[i];
+ return 0;
+}
+
static VLC huff_vlc[3];
/** Initialize static data, constant between all invocations of the codec. */
@@ -238,7 +266,7 @@ static av_cold int mlp_decode_init(AVCodecContext *avctx)
m->avctx = avctx;
for (substr = 0; substr < MAX_SUBSTREAMS; substr++)
m->substream[substr].lossless_check_data = 0xffffffff;
- dsputil_init(&m->dsp, avctx);
+ ff_mlpdsp_init(&m->dsp);
avcodec_get_frame_defaults(&m->frame);
avctx->coded_frame = &m->frame;
@@ -300,15 +328,15 @@ static int read_major_sync(MLPDecodeContext *m, GetBitContext *gb)
if (mh.num_substreams == 0)
return AVERROR_INVALIDDATA;
- if (m->avctx->codec_id == CODEC_ID_MLP && mh.num_substreams > 2) {
+ if (m->avctx->codec_id == AV_CODEC_ID_MLP && mh.num_substreams > 2) {
av_log(m->avctx, AV_LOG_ERROR, "MLP only supports up to 2 substreams.\n");
return AVERROR_INVALIDDATA;
}
if (mh.num_substreams > MAX_SUBSTREAMS) {
- av_log(m->avctx, AV_LOG_ERROR,
+ av_log_ask_for_sample(m->avctx,
"Number of substreams %d is larger than the maximum supported "
- "by the decoder. %s\n", mh.num_substreams, sample_message);
- return AVERROR_INVALIDDATA;
+ "by the decoder.\n", mh.num_substreams);
+ return AVERROR_PATCHWELCOME;
}
m->access_unit_size = mh.access_unit_size;
@@ -330,6 +358,24 @@ static int read_major_sync(MLPDecodeContext *m, GetBitContext *gb)
for (substr = 0; substr < MAX_SUBSTREAMS; substr++)
m->substream[substr].restart_seen = 0;
+ /* Set the layout for each substream. When there's more than one, the first
+ * substream is Stereo. Subsequent substreams' layouts are indicated in the
+ * major sync. */
+ if (m->avctx->codec_id == AV_CODEC_ID_MLP) {
+ if ((substr = (mh.num_substreams > 1)))
+ m->substream[0].ch_layout = AV_CH_LAYOUT_STEREO;
+ m->substream[substr].ch_layout = mh.channel_layout_mlp;
+ } else {
+ if ((substr = (mh.num_substreams > 1)))
+ m->substream[0].ch_layout = AV_CH_LAYOUT_STEREO;
+ if (mh.num_substreams > 2)
+ if (mh.channel_layout_thd_stream2)
+ m->substream[2].ch_layout = mh.channel_layout_thd_stream2;
+ else
+ m->substream[2].ch_layout = mh.channel_layout_thd_stream1;
+ m->substream[substr].ch_layout = mh.channel_layout_thd_stream1;
+ }
+
return 0;
}
@@ -346,7 +392,7 @@ static int read_restart_header(MLPDecodeContext *m, GetBitContext *gbp,
uint8_t checksum;
uint8_t lossless_check;
int start_count = get_bits_count(gbp);
- const int max_matrix_channel = m->avctx->codec_id == CODEC_ID_MLP
+ const int max_matrix_channel = m->avctx->codec_id == AV_CODEC_ID_MLP
? MAX_MATRIX_CHANNEL_MLP
: MAX_MATRIX_CHANNEL_TRUEHD;
@@ -360,7 +406,7 @@ static int read_restart_header(MLPDecodeContext *m, GetBitContext *gbp,
s->noise_type = get_bits1(gbp);
- if (m->avctx->codec_id == CODEC_ID_MLP && s->noise_type) {
+ if (m->avctx->codec_id == AV_CODEC_ID_MLP && s->noise_type) {
av_log(m->avctx, AV_LOG_ERROR, "MLP must have 0x31ea sync word.\n");
return AVERROR_INVALIDDATA;
}
@@ -387,10 +433,10 @@ static int read_restart_header(MLPDecodeContext *m, GetBitContext *gbp,
/* This should happen for TrueHD streams with >6 channels and MLP's noise
* type. It is not yet known if this is allowed. */
if (s->max_channel > MAX_MATRIX_CHANNEL_MLP && !s->noise_type) {
- av_log(m->avctx, AV_LOG_ERROR,
+ av_log_ask_for_sample(m->avctx,
"Number of channels %d is larger than the maximum supported "
- "by the decoder. %s\n", s->max_channel+2, sample_message);
- return AVERROR_INVALIDDATA;
+ "by the decoder.\n", s->max_channel + 2);
+ return AVERROR_PATCHWELCOME;
}
if (s->min_channel > s->max_channel) {
@@ -431,11 +477,17 @@ static int read_restart_header(MLPDecodeContext *m, GetBitContext *gbp,
for (ch = 0; ch <= s->max_matrix_channel; ch++) {
int ch_assign = get_bits(gbp, 6);
+ if (m->avctx->codec_id == AV_CODEC_ID_TRUEHD) {
+ uint64_t channel = thd_channel_layout_extract_channel(s->ch_layout,
+ ch_assign);
+ ch_assign = av_get_channel_layout_channel_index(s->ch_layout,
+ channel);
+ }
if (ch_assign > s->max_matrix_channel) {
- av_log(m->avctx, AV_LOG_ERROR,
- "Assignment of matrix channel %d to invalid output channel %d. %s\n",
- ch, ch_assign, sample_message);
- return AVERROR_INVALIDDATA;
+ av_log_ask_for_sample(m->avctx,
+ "Assignment of matrix channel %d to invalid output channel %d.\n",
+ ch, ch_assign);
+ return AVERROR_PATCHWELCOME;
}
s->ch_assign[ch_assign] = ch;
}
@@ -468,8 +520,10 @@ static int read_restart_header(MLPDecodeContext *m, GetBitContext *gbp,
cp->huff_lsbs = 24;
}
- if (substr == m->max_decoded_substream)
- m->avctx->channels = s->max_matrix_channel + 1;
+ if (substr == m->max_decoded_substream) {
+ m->avctx->channels = s->max_matrix_channel + 1;
+ m->avctx->channel_layout = s->ch_layout;
+ }
return 0;
}
@@ -555,7 +609,7 @@ static int read_matrix_params(MLPDecodeContext *m, unsigned int substr, GetBitCo
{
SubStream *s = &m->substream[substr];
unsigned int mat, ch;
- const int max_primitive_matrices = m->avctx->codec_id == CODEC_ID_MLP
+ const int max_primitive_matrices = m->avctx->codec_id == AV_CODEC_ID_MLP
? MAX_MATRICES_MLP
: MAX_MATRICES_TRUEHD;
@@ -763,8 +817,8 @@ static int read_block_data(MLPDecodeContext *m, GetBitContext *gbp,
if (s->data_check_present) {
expected_stream_pos = get_bits_count(gbp);
expected_stream_pos += get_bits(gbp, 16);
- av_log(m->avctx, AV_LOG_WARNING, "This file contains some features "
- "we have not tested yet. %s\n", sample_message);
+ av_log_ask_for_sample(m->avctx, "This file contains some features "
+ "we have not tested yet.\n");
}
if (s->blockpos + s->blocksize > m->access_unit_size) {
@@ -924,9 +978,14 @@ static int output_data(MLPDecodeContext *m, unsigned int substr,
return AVERROR_INVALIDDATA;
}
+ if (!s->blockpos) {
+ av_log(avctx, AV_LOG_ERROR, "No samples to output.\n");
+ return AVERROR_INVALIDDATA;
+ }
+
/* get output buffer */
m->frame.nb_samples = s->blockpos;
- if ((ret = avctx->get_buffer(avctx, &m->frame)) < 0) {
+ if ((ret = ff_get_buffer(avctx, &m->frame)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return ret;
}
@@ -1010,7 +1069,7 @@ static int read_access_unit(AVCodecContext *avctx, void* data,
substr_header_size += 2;
if (extraword_present) {
- if (m->avctx->codec_id == CODEC_ID_MLP) {
+ if (m->avctx->codec_id == AV_CODEC_ID_MLP) {
av_log(m->avctx, AV_LOG_ERROR, "There must be no extraword for MLP.\n");
goto error;
}
@@ -1099,9 +1158,9 @@ static int read_access_unit(AVCodecContext *avctx, void* data,
return AVERROR_INVALIDDATA;
shorten_by = get_bits(&gb, 16);
- if (m->avctx->codec_id == CODEC_ID_TRUEHD && shorten_by & 0x2000)
+ if (m->avctx->codec_id == AV_CODEC_ID_TRUEHD && shorten_by & 0x2000)
s->blockpos -= FFMIN(shorten_by & 0x1FFF, s->blockpos);
- else if (m->avctx->codec_id == CODEC_ID_MLP && shorten_by != 0xD234)
+ else if (m->avctx->codec_id == AV_CODEC_ID_MLP && shorten_by != 0xD234)
return AVERROR_INVALIDDATA;
if (substr == m->max_decoded_substream)
@@ -1153,23 +1212,23 @@ error:
AVCodec ff_mlp_decoder = {
.name = "mlp",
.type = AVMEDIA_TYPE_AUDIO,
- .id = CODEC_ID_MLP,
+ .id = AV_CODEC_ID_MLP,
.priv_data_size = sizeof(MLPDecodeContext),
.init = mlp_decode_init,
.decode = read_access_unit,
.capabilities = CODEC_CAP_DR1,
- .long_name = NULL_IF_CONFIG_SMALL("MLP (Meridian Lossless Packing)"),
+ .long_name = NULL_IF_CONFIG_SMALL("MLP (Meridian Lossless Packing)"),
};
#if CONFIG_TRUEHD_DECODER
AVCodec ff_truehd_decoder = {
.name = "truehd",
.type = AVMEDIA_TYPE_AUDIO,
- .id = CODEC_ID_TRUEHD,
+ .id = AV_CODEC_ID_TRUEHD,
.priv_data_size = sizeof(MLPDecodeContext),
.init = mlp_decode_init,
.decode = read_access_unit,
.capabilities = CODEC_CAP_DR1,
- .long_name = NULL_IF_CONFIG_SMALL("TrueHD"),
+ .long_name = NULL_IF_CONFIG_SMALL("TrueHD"),
};
#endif /* CONFIG_TRUEHD_DECODER */
diff --git a/gst-libs/ext/libav/libavcodec/mlpdsp.c b/gst-libs/ext/libav/libavcodec/mlpdsp.c
index 7d01c75..2944ce8 100644
--- a/gst-libs/ext/libav/libavcodec/mlpdsp.c
+++ b/gst-libs/ext/libav/libavcodec/mlpdsp.c
@@ -19,7 +19,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "dsputil.h"
+#include "config.h"
+#include "mlpdsp.h"
#include "mlp.h"
static void ff_mlp_filter_channel(int32_t *state, const int32_t *coeff,
@@ -55,9 +56,9 @@ static void ff_mlp_filter_channel(int32_t *state, const int32_t *coeff,
}
}
-void ff_mlp_init(DSPContext* c, AVCodecContext *avctx)
+void ff_mlpdsp_init(MLPDSPContext *c)
{
c->mlp_filter_channel = ff_mlp_filter_channel;
if (ARCH_X86)
- ff_mlp_init_x86(c, avctx);
+ ff_mlpdsp_init_x86(c);
}
diff --git a/gst-libs/ext/libav/libavcodec/mlpdsp.h b/gst-libs/ext/libav/libavcodec/mlpdsp.h
new file mode 100644
index 0000000..995f72a
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/mlpdsp.h
@@ -0,0 +1,37 @@
+/*
+ * MLP codec common header file
+ * Copyright (c) 2007-2008 Ian Caulfield
+ *
+ * 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
+ */
+
+#ifndef AVCODEC_MLPDSP_H
+#define AVCODEC_MLPDSP_H
+
+#include <stdint.h>
+
+typedef struct MLPDSPContext {
+ void (*mlp_filter_channel)(int32_t *state, const int32_t *coeff,
+ int firorder, int iirorder,
+ unsigned int filter_shift, int32_t mask,
+ int blocksize, int32_t *sample_buffer);
+} MLPDSPContext;
+
+void ff_mlpdsp_init(MLPDSPContext *c);
+void ff_mlpdsp_init_x86(MLPDSPContext *c);
+
+#endif /* AVCODEC_MLPDSP_H */
diff --git a/gst-libs/ext/libav/libavcodec/mmvideo.c b/gst-libs/ext/libav/libavcodec/mmvideo.c
index 501371a..784b939 100644
--- a/gst-libs/ext/libav/libavcodec/mmvideo.c
+++ b/gst-libs/ext/libav/libavcodec/mmvideo.c
@@ -58,7 +58,7 @@ static av_cold int mm_decode_init(AVCodecContext *avctx)
s->avctx = avctx;
- avctx->pix_fmt = PIX_FMT_PAL8;
+ avctx->pix_fmt = AV_PIX_FMT_PAL8;
s->frame.reference = 1;
@@ -84,8 +84,7 @@ static int mm_decode_pal(MmContext *s)
*/
static int mm_decode_intra(MmContext * s, int half_horiz, int half_vert)
{
- int i, x, y;
- i=0; x=0; y=0;
+ int x = 0, y = 0;
while (bytestream2_get_bytes_left(&s->gb) > 0) {
int run_length, color;
@@ -173,7 +172,7 @@ static int mm_decode_inter(MmContext * s, int half_horiz, int half_vert)
}
static int mm_decode_frame(AVCodecContext *avctx,
- void *data, int *data_size,
+ void *data, int *got_frame,
AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
@@ -210,7 +209,7 @@ static int mm_decode_frame(AVCodecContext *avctx,
memcpy(s->frame.data[1], s->palette, AVPALETTE_SIZE);
- *data_size = sizeof(AVFrame);
+ *got_frame = 1;
*(AVFrame*)data = s->frame;
return buf_size;
@@ -229,11 +228,11 @@ static av_cold int mm_decode_end(AVCodecContext *avctx)
AVCodec ff_mmvideo_decoder = {
.name = "mmvideo",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_MMVIDEO,
+ .id = AV_CODEC_ID_MMVIDEO,
.priv_data_size = sizeof(MmContext),
.init = mm_decode_init,
.close = mm_decode_end,
.decode = mm_decode_frame,
.capabilities = CODEC_CAP_DR1,
- .long_name = NULL_IF_CONFIG_SMALL("American Laser Games MM Video"),
+ .long_name = NULL_IF_CONFIG_SMALL("American Laser Games MM Video"),
};
diff --git a/gst-libs/ext/libav/libavcodec/motion-test.c b/gst-libs/ext/libav/libavcodec/motion-test.c
deleted file mode 100644
index 8708636..0000000
--- a/gst-libs/ext/libav/libavcodec/motion-test.c
+++ /dev/null
@@ -1,165 +0,0 @@
-/*
- * (c) 2001 Fabrice Bellard
- *
- * 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
- * motion test.
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <sys/time.h>
-#include <unistd.h>
-
-#include "config.h"
-#include "dsputil.h"
-#include "libavutil/lfg.h"
-
-#undef printf
-
-#define WIDTH 64
-#define HEIGHT 64
-
-static uint8_t img1[WIDTH * HEIGHT];
-static uint8_t img2[WIDTH * HEIGHT];
-
-static void fill_random(uint8_t *tab, int size)
-{
- int i;
- AVLFG prng;
-
- av_lfg_init(&prng, 1);
- for(i=0;i<size;i++) {
-#if 1
- tab[i] = av_lfg_get(&prng) % 256;
-#else
- tab[i] = i;
-#endif
- }
-}
-
-static void help(void)
-{
- printf("motion-test [-h]\n"
- "test motion implementations\n");
-}
-
-static int64_t gettime(void)
-{
- struct timeval tv;
- gettimeofday(&tv,NULL);
- return (int64_t)tv.tv_sec * 1000000 + tv.tv_usec;
-}
-
-#define NB_ITS 500
-
-int dummy;
-
-static void test_motion(const char *name,
- me_cmp_func test_func, me_cmp_func ref_func)
-{
- int x, y, d1, d2, it;
- uint8_t *ptr;
- int64_t ti;
- printf("testing '%s'\n", name);
-
- /* test correctness */
- for(it=0;it<20;it++) {
-
- fill_random(img1, WIDTH * HEIGHT);
- fill_random(img2, WIDTH * HEIGHT);
-
- for(y=0;y<HEIGHT-17;y++) {
- for(x=0;x<WIDTH-17;x++) {
- ptr = img2 + y * WIDTH + x;
- d1 = test_func(NULL, img1, ptr, WIDTH, 1);
- d2 = ref_func(NULL, img1, ptr, WIDTH, 1);
- if (d1 != d2) {
- printf("error: mmx=%d c=%d\n", d1, d2);
- }
- }
- }
- }
- emms_c();
-
- /* speed test */
- ti = gettime();
- d1 = 0;
- for(it=0;it<NB_ITS;it++) {
- for(y=0;y<HEIGHT-17;y++) {
- for(x=0;x<WIDTH-17;x++) {
- ptr = img2 + y * WIDTH + x;
- d1 += test_func(NULL, img1, ptr, WIDTH, 1);
- }
- }
- }
- emms_c();
- dummy = d1; /* avoid optimization */
- ti = gettime() - ti;
-
- printf(" %0.0f kop/s\n",
- (double)NB_ITS * (WIDTH - 16) * (HEIGHT - 16) /
- (double)(ti / 1000.0));
-}
-
-
-int main(int argc, char **argv)
-{
- AVCodecContext *ctx;
- int c;
- DSPContext cctx, mmxctx;
- int flags[2] = { AV_CPU_FLAG_MMX, AV_CPU_FLAG_MMX2 };
- int flags_size = HAVE_MMX2 ? 2 : 1;
-
- for(;;) {
- c = getopt(argc, argv, "h");
- if (c == -1)
- break;
- switch(c) {
- case 'h':
- help();
- return 1;
- }
- }
-
- printf("Libav motion test\n");
-
- ctx = avcodec_alloc_context3(NULL);
- ctx->dsp_mask = AV_CPU_FLAG_FORCE;
- dsputil_init(&cctx, ctx);
- for (c = 0; c < flags_size; c++) {
- int x;
- ctx->dsp_mask = AV_CPU_FLAG_FORCE | flags[c];
- dsputil_init(&mmxctx, ctx);
-
- for (x = 0; x < 2; x++) {
- printf("%s for %dx%d pixels\n", c ? "mmx2" : "mmx",
- x ? 8 : 16, x ? 8 : 16);
- test_motion("mmx", mmxctx.pix_abs[x][0], cctx.pix_abs[x][0]);
- test_motion("mmx_x2", mmxctx.pix_abs[x][1], cctx.pix_abs[x][1]);
- test_motion("mmx_y2", mmxctx.pix_abs[x][2], cctx.pix_abs[x][2]);
- test_motion("mmx_xy2", mmxctx.pix_abs[x][3], cctx.pix_abs[x][3]);
- }
- }
- av_free(ctx);
-
- return 0;
-}
diff --git a/gst-libs/ext/libav/libavcodec/motion_est.c b/gst-libs/ext/libav/libavcodec/motion_est.c
index c4512a9..3577ada 100644
--- a/gst-libs/ext/libav/libavcodec/motion_est.c
+++ b/gst-libs/ext/libav/libavcodec/motion_est.c
@@ -30,7 +30,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <limits.h>
-#include "libavutil/intmath.h"
+
#include "avcodec.h"
#include "dsputil.h"
#include "mathops.h"
@@ -39,15 +39,13 @@
#undef NDEBUG
#include <assert.h>
-#define SQ(a) ((a)*(a))
-
#define P_LEFT P[1]
#define P_TOP P[2]
#define P_TOPRIGHT P[3]
#define P_MEDIAN P[4]
#define P_MV1 P[9]
-static inline int sad_hpel_motion_search(MpegEncContext * s,
+static int sad_hpel_motion_search(MpegEncContext * s,
int *mx_ptr, int *my_ptr, int dmin,
int src_index, int ref_index,
int size, int h);
@@ -305,7 +303,7 @@ int ff_init_me(MpegEncContext *s){
return -1;
}
//special case of snow is needed because snow uses its own iterative ME code
- if(s->me_method!=ME_ZERO && s->me_method!=ME_EPZS && s->me_method!=ME_X1 && s->avctx->codec_id != CODEC_ID_SNOW){
+ if(s->me_method!=ME_ZERO && s->me_method!=ME_EPZS && s->me_method!=ME_X1 && s->avctx->codec_id != AV_CODEC_ID_SNOW){
av_log(s->avctx, AV_LOG_ERROR, "me_method is only allowed to be set to zero and epzs; for hex,umh,full and others see dia_size\n");
return -1;
}
@@ -356,7 +354,7 @@ int ff_init_me(MpegEncContext *s){
/* 8x8 fullpel search would need a 4x4 chroma compare, which we do
* not have yet, and even if we had, the motion estimation code
* does not expect it. */
- if(s->codec_id != CODEC_ID_SNOW){
+ if(s->codec_id != AV_CODEC_ID_SNOW){
if((c->avctx->me_cmp&FF_CMP_CHROMA)/* && !s->dsp.me_cmp[2]*/){
s->dsp.me_cmp[2]= zero_cmp;
}
@@ -367,22 +365,13 @@ int ff_init_me(MpegEncContext *s){
c->hpel_put[2][2]= c->hpel_put[2][3]= zero_hpel;
}
- if(s->codec_id == CODEC_ID_H261){
+ if(s->codec_id == AV_CODEC_ID_H261){
c->sub_motion_search= no_sub_motion_search;
}
return 0;
}
-static inline void no_motion_search(MpegEncContext * s,
- int *mx_ptr, int *my_ptr)
-{
- *mx_ptr = 16 * s->mb_x;
- *my_ptr = 16 * s->mb_y;
-}
-
-#define Z_THRESHOLD 256
-
#define CHECK_SAD_HALF_MV(suffix, x, y) \
{\
d= s->dsp.pix_abs[size][(x?1:0)+(y?2:0)](NULL, pix, ptr+((x)>>1), stride, h);\
@@ -390,7 +379,7 @@ static inline void no_motion_search(MpegEncContext * s,
COPY3_IF_LT(dminh, d, dx, x, dy, y)\
}
-static inline int sad_hpel_motion_search(MpegEncContext * s,
+static int sad_hpel_motion_search(MpegEncContext * s,
int *mx_ptr, int *my_ptr, int dmin,
int src_index, int ref_index,
int size, int h)
@@ -406,12 +395,10 @@ static inline int sad_hpel_motion_search(MpegEncContext * s,
assert(flags == 0);
if(c->skip){
-// printf("S");
*mx_ptr = 0;
*my_ptr = 0;
return dmin;
}
-// printf("N");
pix = c->src[src_index][0];
@@ -1040,9 +1027,8 @@ void ff_estimate_p_frame_motion(MpegEncContext * s,
switch(s->me_method) {
case ME_ZERO:
default:
- no_motion_search(s, &mx, &my);
- mx-= mb_x*16;
- my-= mb_y*16;
+ mx = 0;
+ my = 0;
dmin = 0;
break;
case ME_X1:
@@ -1152,7 +1138,7 @@ void ff_estimate_p_frame_motion(MpegEncContext * s,
dmin= c->sub_motion_search(s, &mx, &my, dmin, 0, 0, 0, 16);
if(c->avctx->me_sub_cmp != c->avctx->mb_cmp && !c->skip)
- dmin= ff_get_mb_score(s, mx, my, 0, 0, 0, 16, 1);
+ dmin= get_mb_score(s, mx, my, 0, 0, 0, 16, 1);
if((s->flags&CODEC_FLAG_4MV)
&& !c->skip && varc>50<<8 && vard>10<<8){
@@ -1283,35 +1269,32 @@ static int ff_estimate_motion_b(MpegEncContext * s,
switch(s->me_method) {
case ME_ZERO:
default:
- no_motion_search(s, &mx, &my);
+ mx = 0;
+ my = 0;
dmin = 0;
- mx-= mb_x*16;
- my-= mb_y*16;
break;
case ME_X1:
case ME_EPZS:
- {
- P_LEFT[0] = mv_table[mot_xy - 1][0];
- P_LEFT[1] = mv_table[mot_xy - 1][1];
-
- if(P_LEFT[0] > (c->xmax<<shift)) P_LEFT[0] = (c->xmax<<shift);
+ P_LEFT[0] = mv_table[mot_xy - 1][0];
+ P_LEFT[1] = mv_table[mot_xy - 1][1];
- /* special case for first line */
- if (!s->first_slice_line) {
- P_TOP[0] = mv_table[mot_xy - mot_stride ][0];
- P_TOP[1] = mv_table[mot_xy - mot_stride ][1];
- P_TOPRIGHT[0] = mv_table[mot_xy - mot_stride + 1 ][0];
- P_TOPRIGHT[1] = mv_table[mot_xy - mot_stride + 1 ][1];
- if(P_TOP[1] > (c->ymax<<shift)) P_TOP[1]= (c->ymax<<shift);
- if(P_TOPRIGHT[0] < (c->xmin<<shift)) P_TOPRIGHT[0]= (c->xmin<<shift);
- if(P_TOPRIGHT[1] > (c->ymax<<shift)) P_TOPRIGHT[1]= (c->ymax<<shift);
+ if (P_LEFT[0] > (c->xmax << shift)) P_LEFT[0] = (c->xmax << shift);
- P_MEDIAN[0]= mid_pred(P_LEFT[0], P_TOP[0], P_TOPRIGHT[0]);
- P_MEDIAN[1]= mid_pred(P_LEFT[1], P_TOP[1], P_TOPRIGHT[1]);
- }
- c->pred_x= P_LEFT[0];
- c->pred_y= P_LEFT[1];
+ /* special case for first line */
+ if (!s->first_slice_line) {
+ P_TOP[0] = mv_table[mot_xy - mot_stride ][0];
+ P_TOP[1] = mv_table[mot_xy - mot_stride ][1];
+ P_TOPRIGHT[0] = mv_table[mot_xy - mot_stride + 1][0];
+ P_TOPRIGHT[1] = mv_table[mot_xy - mot_stride + 1][1];
+ if (P_TOP[1] > (c->ymax << shift)) P_TOP[1] = (c->ymax << shift);
+ if (P_TOPRIGHT[0] < (c->xmin << shift)) P_TOPRIGHT[0] = (c->xmin << shift);
+ if (P_TOPRIGHT[1] > (c->ymax << shift)) P_TOPRIGHT[1] = (c->ymax << shift);
+
+ P_MEDIAN[0] = mid_pred(P_LEFT[0], P_TOP[0], P_TOPRIGHT[0]);
+ P_MEDIAN[1] = mid_pred(P_LEFT[1], P_TOP[1], P_TOPRIGHT[1]);
}
+ c->pred_x = P_LEFT[0];
+ c->pred_y = P_LEFT[1];
if(mv_table == s->b_forw_mv_table){
mv_scale= (s->pb_time<<16) / (s->pp_time<<shift);
@@ -1327,9 +1310,8 @@ static int ff_estimate_motion_b(MpegEncContext * s,
dmin= c->sub_motion_search(s, &mx, &my, dmin, 0, ref_index, 0, 16);
if(c->avctx->me_sub_cmp != c->avctx->mb_cmp && !c->skip)
- dmin= ff_get_mb_score(s, mx, my, 0, ref_index, 0, 16, 1);
+ dmin= get_mb_score(s, mx, my, 0, ref_index, 0, 16, 1);
-//printf("%d %d %d %d//", s->mb_x, s->mb_y, mx, my);
// s->mb_type[mb_y*s->mb_width + mb_x]= mb_type;
mv_table[mot_xy][0]= mx;
mv_table[mot_xy][1]= my;
@@ -1426,9 +1408,8 @@ static inline int bidir_refine(MpegEncContext * s, int mb_x, int mb_y)
#define HASH(fx,fy,bx,by) ((fx)+17*(fy)+63*(bx)+117*(by))
#define HASH8(fx,fy,bx,by) ((uint8_t)HASH(fx,fy,bx,by))
int hashidx= HASH(motion_fx,motion_fy, motion_bx, motion_by);
- uint8_t map[256];
+ uint8_t map[256] = { 0 };
- memset(map,0,sizeof(map));
map[hashidx&255] = 1;
fbmin= check_bidir_mv(s, motion_fx, motion_fy,
@@ -1640,7 +1621,7 @@ static inline int direct_search(MpegEncContext * s, int mb_x, int mb_y)
dmin = hpel_motion_search(s, &mx, &my, dmin, 0, 0, 0, 16);
if(c->avctx->me_sub_cmp != c->avctx->mb_cmp && !c->skip)
- dmin= ff_get_mb_score(s, mx, my, 0, 0, 0, 16, 1);
+ dmin= get_mb_score(s, mx, my, 0, 0, 0, 16, 1);
get_limits(s, 16*mb_x, 16*mb_y); //restore c->?min/max, maybe not needed
@@ -1667,7 +1648,7 @@ void ff_estimate_b_frame_motion(MpegEncContext * s,
c->skip=0;
- if (s->codec_id == CODEC_ID_MPEG4 && s->next_picture.f.mbskip_table[xy]) {
+ if (s->codec_id == AV_CODEC_ID_MPEG4 && s->next_picture.f.mbskip_table[xy]) {
int score= direct_search(s, mb_x, mb_y); //FIXME just check 0,0
score= ((unsigned)(score*score + 128*256))>>16;
@@ -1729,7 +1710,7 @@ void ff_estimate_b_frame_motion(MpegEncContext * s,
}
}
- if (s->codec_id == CODEC_ID_MPEG4)
+ if (s->codec_id == AV_CODEC_ID_MPEG4)
dmin= direct_search(s, mb_x, mb_y);
else
dmin= INT_MAX;
@@ -1739,11 +1720,11 @@ void ff_estimate_b_frame_motion(MpegEncContext * s,
c->skip=0;
bmin= ff_estimate_motion_b(s, mb_x, mb_y, s->b_back_mv_table, 2, s->b_code) + 2*penalty_factor;
-//printf(" %d %d ", s->b_forw_mv_table[xy][0], s->b_forw_mv_table[xy][1]);
+ av_dlog(s, " %d %d ", s->b_forw_mv_table[xy][0], s->b_forw_mv_table[xy][1]);
c->skip=0;
fbmin= bidir_refine(s, mb_x, mb_y) + penalty_factor;
-//printf("%d %d %d %d\n", dmin, fmin, bmin, fbmin);
+ av_dlog(s, "%d %d %d %d\n", dmin, fmin, bmin, fbmin);
if(s->flags & CODEC_FLAG_INTERLACED_ME){
//FIXME mb type penalty
@@ -1800,7 +1781,7 @@ void ff_estimate_b_frame_motion(MpegEncContext * s,
}
//FIXME something smarter
if(dmin>256*256*16) type&= ~CANDIDATE_MB_TYPE_DIRECT; //do not try direct mode if it is invalid for this MB
- if(s->codec_id == CODEC_ID_MPEG4 && type&CANDIDATE_MB_TYPE_DIRECT && s->flags&CODEC_FLAG_MV0 && *(uint32_t*)s->b_direct_mv_table[xy])
+ if(s->codec_id == AV_CODEC_ID_MPEG4 && type&CANDIDATE_MB_TYPE_DIRECT && s->flags&CODEC_FLAG_MV0 && *(uint32_t*)s->b_direct_mv_table[xy])
type |= CANDIDATE_MB_TYPE_DIRECT0;
}
@@ -1819,7 +1800,7 @@ int ff_get_best_fcode(MpegEncContext * s, int16_t (*mv_table)[2], int type)
if(s->msmpeg4_version)
range= FFMIN(range, 16);
- else if(s->codec_id == CODEC_ID_MPEG2VIDEO && s->avctx->strict_std_compliance >= FF_COMPLIANCE_NORMAL)
+ else if(s->codec_id == AV_CODEC_ID_MPEG2VIDEO && s->avctx->strict_std_compliance >= FF_COMPLIANCE_NORMAL)
range= FFMIN(range, 256);
for(i=0; i<8; i++) score[i]= s->mb_num*(8-i);
@@ -1853,15 +1834,9 @@ int ff_get_best_fcode(MpegEncContext * s, int16_t (*mv_table)[2], int type)
best_score= score[i];
best_fcode= i;
}
-// printf("%d %d\n", i, score[i]);
}
-// printf("fcode: %d type: %d\n", i, s->pict_type);
return best_fcode;
-/* for(i=0; i<=MAX_FCODE; i++){
- printf("%d ", mv_num[i]);
- }
- printf("\n");*/
}else{
return 1;
}
@@ -1877,11 +1852,10 @@ void ff_fix_long_p_mvs(MpegEncContext * s)
range = (((s->out_format == FMT_MPEG1 || s->msmpeg4_version) ? 8 : 16) << f_code);
assert(range <= 16 || !s->msmpeg4_version);
- assert(range <=256 || !(s->codec_id == CODEC_ID_MPEG2VIDEO && s->avctx->strict_std_compliance >= FF_COMPLIANCE_NORMAL));
+ assert(range <=256 || !(s->codec_id == AV_CODEC_ID_MPEG2VIDEO && s->avctx->strict_std_compliance >= FF_COMPLIANCE_NORMAL));
if(c->avctx->me_range && range > c->avctx->me_range) range= c->avctx->me_range;
-//printf("%d no:%d %d//\n", clip, noclip, f_code);
if(s->flags&CODEC_FLAG_4MV){
const int wrap= s->b8_stride;
diff --git a/gst-libs/ext/libav/libavcodec/motion_est_template.c b/gst-libs/ext/libav/libavcodec/motion_est_template.c
index d0d4b41..7228744 100644
--- a/gst-libs/ext/libav/libavcodec/motion_est_template.c
+++ b/gst-libs/ext/libav/libavcodec/motion_est_template.c
@@ -160,8 +160,9 @@ static int no_sub_motion_search(MpegEncContext * s,
return dmin;
}
-inline int ff_get_mb_score(MpegEncContext * s, int mx, int my, int src_index,
- int ref_index, int size, int h, int add_rate)
+static inline int get_mb_score(MpegEncContext *s, int mx, int my,
+ int src_index, int ref_index, int size,
+ int h, int add_rate)
{
// const int check_luma= s->dsp.me_sub_cmp != s->dsp.mb_cmp;
MotionEstContext * const c= &s->me;
@@ -190,6 +191,12 @@ inline int ff_get_mb_score(MpegEncContext * s, int mx, int my, int src_index,
return d;
}
+int ff_get_mb_score(MpegEncContext *s, int mx, int my, int src_index,
+ int ref_index, int size, int h, int add_rate)
+{
+ return get_mb_score(s, mx, my, src_index, ref_index, size, h, add_rate);
+}
+
#define CHECK_QUARTER_MV(dx, dy, x, y)\
{\
const int hx= 4*(x)+(dx);\
@@ -360,13 +367,11 @@ static int qpel_motion_search(MpegEncContext * s,
assert((x) <= xmax);\
assert((y) >= ymin);\
assert((y) <= ymax);\
-/*printf("check_mv %d %d\n", x, y);*/\
if(map[index]!=key){\
d= cmp(s, x, y, 0, 0, size, h, ref_index, src_index, cmpf, chroma_cmpf, flags);\
map[index]= key;\
score_map[index]= d;\
d += (mv_penalty[((x)<<shift)-pred_x] + mv_penalty[((y)<<shift)-pred_y])*penalty_factor;\
-/*printf("score:%d\n", d);*/\
COPY3_IF_LT(dmin, d, best[0], x, best[1], y)\
}\
}
@@ -384,13 +389,11 @@ static int qpel_motion_search(MpegEncContext * s,
{\
const unsigned key = ((y)<<ME_MAP_MV_BITS) + (x) + map_generation;\
const int index= (((y)<<ME_MAP_SHIFT) + (x))&(ME_MAP_SIZE-1);\
-/*printf("check_mv_dir %d %d %d\n", x, y, new_dir);*/\
if(map[index]!=key){\
d= cmp(s, x, y, 0, 0, size, h, ref_index, src_index, cmpf, chroma_cmpf, flags);\
map[index]= key;\
score_map[index]= d;\
d += (mv_penalty[((x)<<shift)-pred_x] + mv_penalty[((y)<<shift)-pred_y])*penalty_factor;\
-/*printf("score:%d\n", d);*/\
if(d<dmin){\
best[0]=x;\
best[1]=y;\
@@ -441,7 +444,6 @@ static av_always_inline int small_diamond_search(MpegEncContext * s, int *best,
const int y= best[1];
next_dir=-1;
-//printf("%d", dir);
if(dir!=2 && x>xmin) CHECK_MV_DIR(x-1, y , 0)
if(dir!=3 && y>ymin) CHECK_MV_DIR(x , y-1, 1)
if(dir!=0 && x<xmax) CHECK_MV_DIR(x+1, y , 2)
@@ -653,13 +655,11 @@ static int full_search(MpegEncContext * s, int *best, int dmin,
{\
const unsigned key = ((ay)<<ME_MAP_MV_BITS) + (ax) + map_generation;\
const int index= (((ay)<<ME_MAP_SHIFT) + (ax))&(ME_MAP_SIZE-1);\
-/*printf("sab check %d %d\n", ax, ay);*/\
if(map[index]!=key){\
d= cmp(s, ax, ay, 0, 0, size, h, ref_index, src_index, cmpf, chroma_cmpf, flags);\
map[index]= key;\
score_map[index]= d;\
d += (mv_penalty[((ax)<<shift)-pred_x] + mv_penalty[((ay)<<shift)-pred_y])*penalty_factor;\
-/*printf("score: %d\n", d);*/\
if(d < minima[minima_count-1].height){\
int j=0;\
\
@@ -967,14 +967,14 @@ static av_always_inline int epzs_motion_search_internal(MpegEncContext * s, int
*mx_ptr= best[0];
*my_ptr= best[1];
-// printf("%d %d %d \n", best[0], best[1], dmin);
return dmin;
}
//this function is dedicated to the braindamaged gcc
-inline int ff_epzs_motion_search(MpegEncContext * s, int *mx_ptr, int *my_ptr,
- int P[10][2], int src_index, int ref_index, int16_t (*last_mv)[2],
- int ref_mv_scale, int size, int h)
+int ff_epzs_motion_search(MpegEncContext *s, int *mx_ptr, int *my_ptr,
+ int P[10][2], int src_index, int ref_index,
+ int16_t (*last_mv)[2], int ref_mv_scale,
+ int size, int h)
{
MotionEstContext * const c= &s->me;
//FIXME convert other functions in the same way if faster
@@ -1012,7 +1012,7 @@ static int epzs_motion_search4(MpegEncContext * s,
map_generation= update_map_generation(c);
dmin = 1000000;
-//printf("%d %d %d %d //",xmin, ymin, xmax, ymax);
+
/* first line */
if (s->first_slice_line) {
CHECK_MV(P_LEFT[0]>>shift, P_LEFT[1]>>shift)
@@ -1042,7 +1042,6 @@ static int epzs_motion_search4(MpegEncContext * s,
*mx_ptr= best[0];
*my_ptr= best[1];
-// printf("%d %d %d \n", best[0], best[1], dmin);
return dmin;
}
@@ -1072,7 +1071,7 @@ static int epzs_motion_search2(MpegEncContext * s,
map_generation= update_map_generation(c);
dmin = 1000000;
-//printf("%d %d %d %d //",xmin, ymin, xmax, ymax);
+
/* first line */
if (s->first_slice_line) {
CHECK_MV(P_LEFT[0]>>shift, P_LEFT[1]>>shift)
@@ -1102,6 +1101,5 @@ static int epzs_motion_search2(MpegEncContext * s,
*mx_ptr= best[0];
*my_ptr= best[1];
-// printf("%d %d %d \n", best[0], best[1], dmin);
return dmin;
}
diff --git a/gst-libs/ext/libav/libavcodec/motionpixels.c b/gst-libs/ext/libav/libavcodec/motionpixels.c
index 0e1da3a..c2bd0f4 100644
--- a/gst-libs/ext/libav/libavcodec/motionpixels.c
+++ b/gst-libs/ext/libav/libavcodec/motionpixels.c
@@ -57,12 +57,12 @@ static av_cold int mp_decode_init(AVCodecContext *avctx)
motionpixels_tableinit();
mp->avctx = avctx;
- dsputil_init(&mp->dsp, avctx);
+ ff_dsputil_init(&mp->dsp, avctx);
mp->changes_map = av_mallocz(avctx->width * h4);
mp->offset_bits_len = av_log2(avctx->width * avctx->height) + 1;
mp->vpt = av_mallocz(avctx->height * sizeof(YuvPixel));
mp->hpt = av_mallocz(h4 * w4 / 16 * sizeof(YuvPixel));
- avctx->pix_fmt = PIX_FMT_RGB555;
+ avctx->pix_fmt = AV_PIX_FMT_RGB555;
return 0;
}
@@ -237,7 +237,7 @@ static void mp_decode_frame_helper(MotionPixelsContext *mp, GetBitContext *gb)
}
static int mp_decode_frame(AVCodecContext *avctx,
- void *data, int *data_size,
+ void *data, int *got_frame,
AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
@@ -295,7 +295,7 @@ static int mp_decode_frame(AVCodecContext *avctx,
ff_free_vlc(&mp->vlc);
end:
- *data_size = sizeof(AVFrame);
+ *got_frame = 1;
*(AVFrame *)data = mp->frame;
return buf_size;
}
@@ -317,11 +317,11 @@ static av_cold int mp_decode_end(AVCodecContext *avctx)
AVCodec ff_motionpixels_decoder = {
.name = "motionpixels",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_MOTIONPIXELS,
+ .id = AV_CODEC_ID_MOTIONPIXELS,
.priv_data_size = sizeof(MotionPixelsContext),
.init = mp_decode_init,
.close = mp_decode_end,
.decode = mp_decode_frame,
.capabilities = CODEC_CAP_DR1,
- .long_name = NULL_IF_CONFIG_SMALL("Motion Pixels video"),
+ .long_name = NULL_IF_CONFIG_SMALL("Motion Pixels video"),
};
diff --git a/gst-libs/ext/libav/libavcodec/movsub_bsf.c b/gst-libs/ext/libav/libavcodec/movsub_bsf.c
index 423ebeb..506750f 100644
--- a/gst-libs/ext/libav/libavcodec/movsub_bsf.c
+++ b/gst-libs/ext/libav/libavcodec/movsub_bsf.c
@@ -18,6 +18,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "libavutil/common.h"
#include "libavutil/intreadwrite.h"
#include "avcodec.h"
diff --git a/gst-libs/ext/libav/libavcodec/mp3_header_compress_bsf.c b/gst-libs/ext/libav/libavcodec/mp3_header_compress_bsf.c
index bc3659e..06a7ebe 100644
--- a/gst-libs/ext/libav/libavcodec/mp3_header_compress_bsf.c
+++ b/gst-libs/ext/libav/libavcodec/mp3_header_compress_bsf.c
@@ -18,6 +18,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "libavutil/common.h"
#include "libavutil/intreadwrite.h"
#include "avcodec.h"
#include "mpegaudiodecheader.h"
diff --git a/gst-libs/ext/libav/libavcodec/mp3_header_decompress_bsf.c b/gst-libs/ext/libav/libavcodec/mp3_header_decompress_bsf.c
index 78025cc..8e086a1 100644
--- a/gst-libs/ext/libav/libavcodec/mp3_header_decompress_bsf.c
+++ b/gst-libs/ext/libav/libavcodec/mp3_header_decompress_bsf.c
@@ -18,6 +18,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "libavutil/common.h"
#include "libavutil/intreadwrite.h"
#include "avcodec.h"
#include "mpegaudiodecheader.h"
diff --git a/gst-libs/ext/libav/libavcodec/mpc.c b/gst-libs/ext/libav/libavcodec/mpc.c
index 6b15a33..5a54a9b 100644
--- a/gst-libs/ext/libav/libavcodec/mpc.c
+++ b/gst-libs/ext/libav/libavcodec/mpc.c
@@ -43,28 +43,24 @@ void ff_mpc_init(void)
/**
* Process decoded Musepack data and produce PCM
*/
-static void mpc_synth(MPCContext *c, int16_t *out, int channels)
+static void mpc_synth(MPCContext *c, int16_t **out, int channels)
{
int dither_state = 0;
int i, ch;
- OUT_INT samples[MPA_MAX_CHANNELS * MPA_FRAME_SIZE], *samples_ptr;
for(ch = 0; ch < channels; ch++){
- samples_ptr = samples + ch;
for(i = 0; i < SAMPLES_PER_BAND; i++) {
ff_mpa_synth_filter_fixed(&c->mpadsp,
c->synth_buf[ch], &(c->synth_buf_offset[ch]),
ff_mpa_synth_window_fixed, &dither_state,
- samples_ptr, channels,
+ out[ch] + 32 * i, 1,
c->sb_samples[ch][i]);
- samples_ptr += 32 * channels;
}
}
- for(i = 0; i < MPC_FRAME_SIZE*channels; i++)
- *out++=samples[i];
}
-void ff_mpc_dequantize_and_synth(MPCContext * c, int maxband, void *data, int channels)
+void ff_mpc_dequantize_and_synth(MPCContext * c, int maxband, int16_t **out,
+ int channels)
{
int i, j, ch;
Band *bands = c->bands;
@@ -100,5 +96,5 @@ void ff_mpc_dequantize_and_synth(MPCContext * c, int maxband, void *data, int ch
}
}
- mpc_synth(c, data, channels);
+ mpc_synth(c, out, channels);
}
diff --git a/gst-libs/ext/libav/libavcodec/mpc.h b/gst-libs/ext/libav/libavcodec/mpc.h
index 1a6e794..86d4b6d 100644
--- a/gst-libs/ext/libav/libavcodec/mpc.h
+++ b/gst-libs/ext/libav/libavcodec/mpc.h
@@ -41,7 +41,7 @@
#define MPC_FRAME_SIZE (BANDS * SAMPLES_PER_BAND)
/** Subband structure - hold all variables for each subband */
-typedef struct {
+typedef struct Band {
int msf; ///< mid-stereo flag
int res[2];
int scfi[2];
@@ -49,7 +49,7 @@ typedef struct {
int Q[2];
}Band;
-typedef struct {
+typedef struct MPCContext {
AVFrame frame;
DSPContext dsp;
MPADSPContext mpadsp;
@@ -73,6 +73,6 @@ typedef struct {
} MPCContext;
void ff_mpc_init(void);
-void ff_mpc_dequantize_and_synth(MPCContext *c, int maxband, void *dst, int channels);
+void ff_mpc_dequantize_and_synth(MPCContext *c, int maxband, int16_t **out, int channels);
#endif /* AVCODEC_MPC_H */
diff --git a/gst-libs/ext/libav/libavcodec/mpc7.c b/gst-libs/ext/libav/libavcodec/mpc7.c
index b678afd..ab6fd9f 100644
--- a/gst-libs/ext/libav/libavcodec/mpc7.c
+++ b/gst-libs/ext/libav/libavcodec/mpc7.c
@@ -25,12 +25,13 @@
* divided into 32 subbands.
*/
+#include "libavutil/channel_layout.h"
#include "libavutil/lfg.h"
#include "avcodec.h"
#include "get_bits.h"
#include "dsputil.h"
+#include "internal.h"
#include "mpegaudiodsp.h"
-#include "libavutil/audioconvert.h"
#include "mpc.h"
#include "mpc7data.h"
@@ -53,7 +54,7 @@ static av_cold int mpc7_decode_init(AVCodecContext * avctx)
int i, j;
MPCContext *c = avctx->priv_data;
GetBitContext gb;
- uint8_t buf[16];
+ LOCAL_ALIGNED_16(uint8_t, buf, [16]);
static int vlc_initialized = 0;
static VLC_TYPE scfi_table[1 << MPC7_SCFI_BITS][2];
@@ -74,7 +75,7 @@ static av_cold int mpc7_decode_init(AVCodecContext * avctx)
}
memset(c->oldDSCF, 0, sizeof(c->oldDSCF));
av_lfg_init(&c->rnd, 0xDEADBEEF);
- dsputil_init(&c->dsp, avctx);
+ ff_dsputil_init(&c->dsp, avctx);
ff_mpadsp_init(&c->mpadsp);
c->dsp.bswap_buf((uint32_t*)buf, (const uint32_t*)avctx->extradata, 4);
ff_mpc_init();
@@ -94,7 +95,7 @@ static av_cold int mpc7_decode_init(AVCodecContext * avctx)
c->IS, c->MSS, c->gapless, c->lastframelen, c->maxbands);
c->frames_to_skip = 0;
- avctx->sample_fmt = AV_SAMPLE_FMT_S16;
+ avctx->sample_fmt = AV_SAMPLE_FMT_S16P;
avctx->channel_layout = AV_CH_LAYOUT_STEREO;
if(vlc_initialized) return 0;
@@ -200,33 +201,46 @@ static int mpc7_decode_frame(AVCodecContext * avctx, void *data,
int *got_frame_ptr, AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
- int buf_size = avpkt->size;
+ int buf_size;
MPCContext *c = avctx->priv_data;
GetBitContext gb;
- uint8_t *bits;
int i, ch;
int mb = -1;
Band *bands = c->bands;
- int off, ret;
+ int off, ret, last_frame, skip;
int bits_used, bits_avail;
memset(bands, 0, sizeof(*bands) * (c->maxbands + 1));
- if(buf_size <= 4){
- av_log(avctx, AV_LOG_ERROR, "Too small buffer passed (%i bytes)\n", buf_size);
- return AVERROR(EINVAL);
+
+ buf_size = avpkt->size & ~3;
+ if (buf_size <= 0) {
+ av_log(avctx, AV_LOG_ERROR, "packet size is too small (%i bytes)\n",
+ avpkt->size);
+ return AVERROR_INVALIDDATA;
+ }
+ if (buf_size != avpkt->size) {
+ av_log(avctx, AV_LOG_WARNING, "packet size is not a multiple of 4. "
+ "extra bytes at the end will be skipped.\n");
}
+ skip = buf[0];
+ last_frame = buf[1];
+ buf += 4;
+ buf_size -= 4;
+
/* get output buffer */
- c->frame.nb_samples = buf[1] ? c->lastframelen : MPC_FRAME_SIZE;
- if ((ret = avctx->get_buffer(avctx, &c->frame)) < 0) {
+ c->frame.nb_samples = last_frame ? c->lastframelen : MPC_FRAME_SIZE;
+ if ((ret = ff_get_buffer(avctx, &c->frame)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return ret;
}
- bits = av_malloc(((buf_size - 1) & ~3) + FF_INPUT_BUFFER_PADDING_SIZE);
- c->dsp.bswap_buf((uint32_t*)bits, (const uint32_t*)(buf + 4), (buf_size - 4) >> 2);
- init_get_bits(&gb, bits, (buf_size - 4)* 8);
- skip_bits_long(&gb, buf[0]);
+ av_fast_padded_malloc(&c->bits, &c->buf_size, buf_size);
+ if (!c->bits)
+ return AVERROR(ENOMEM);
+ c->dsp.bswap_buf((uint32_t *)c->bits, (const uint32_t *)buf, buf_size >> 2);
+ init_get_bits(&gb, c->bits, buf_size * 8);
+ skip_bits_long(&gb, skip);
/* read subband indexes */
for(i = 0; i <= c->maxbands; i++){
@@ -280,26 +294,24 @@ static int mpc7_decode_frame(AVCodecContext * avctx, void *data,
for(ch = 0; ch < 2; ch++)
idx_to_quant(c, &gb, bands[i].res[ch], c->Q[ch] + off);
- ff_mpc_dequantize_and_synth(c, mb, c->frame.data[0], 2);
-
- av_free(bits);
+ ff_mpc_dequantize_and_synth(c, mb, (int16_t **)c->frame.extended_data, 2);
bits_used = get_bits_count(&gb);
- bits_avail = (buf_size - 4) * 8;
- if(!buf[1] && ((bits_avail < bits_used) || (bits_used + 32 <= bits_avail))){
- av_log(NULL,0, "Error decoding frame: used %i of %i bits\n", bits_used, bits_avail);
+ bits_avail = buf_size * 8;
+ if (!last_frame && ((bits_avail < bits_used) || (bits_used + 32 <= bits_avail))) {
+ av_log(avctx, AV_LOG_ERROR, "Error decoding frame: used %i of %i bits\n", bits_used, bits_avail);
return -1;
}
if(c->frames_to_skip){
c->frames_to_skip--;
*got_frame_ptr = 0;
- return buf_size;
+ return avpkt->size;
}
*got_frame_ptr = 1;
*(AVFrame *)data = c->frame;
- return buf_size;
+ return avpkt->size;
}
static void mpc7_decode_flush(AVCodecContext *avctx)
@@ -310,14 +322,25 @@ static void mpc7_decode_flush(AVCodecContext *avctx)
c->frames_to_skip = 32;
}
+static av_cold int mpc7_decode_close(AVCodecContext *avctx)
+{
+ MPCContext *c = avctx->priv_data;
+ av_freep(&c->bits);
+ c->buf_size = 0;
+ return 0;
+}
+
AVCodec ff_mpc7_decoder = {
.name = "mpc7",
.type = AVMEDIA_TYPE_AUDIO,
- .id = CODEC_ID_MUSEPACK7,
+ .id = AV_CODEC_ID_MUSEPACK7,
.priv_data_size = sizeof(MPCContext),
.init = mpc7_decode_init,
+ .close = mpc7_decode_close,
.decode = mpc7_decode_frame,
- .flush = mpc7_decode_flush,
+ .flush = mpc7_decode_flush,
.capabilities = CODEC_CAP_DR1,
- .long_name = NULL_IF_CONFIG_SMALL("Musepack SV7"),
+ .long_name = NULL_IF_CONFIG_SMALL("Musepack SV7"),
+ .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_S16P,
+ AV_SAMPLE_FMT_NONE },
};
diff --git a/gst-libs/ext/libav/libavcodec/mpc8.c b/gst-libs/ext/libav/libavcodec/mpc8.c
index f5eb4d6..a270be3 100644
--- a/gst-libs/ext/libav/libavcodec/mpc8.c
+++ b/gst-libs/ext/libav/libavcodec/mpc8.c
@@ -25,12 +25,13 @@
* divided into 32 subbands.
*/
+#include "libavutil/channel_layout.h"
#include "libavutil/lfg.h"
#include "avcodec.h"
#include "get_bits.h"
#include "dsputil.h"
+#include "internal.h"
#include "mpegaudiodsp.h"
-#include "libavutil/audioconvert.h"
#include "mpc.h"
#include "mpc8data.h"
@@ -118,7 +119,7 @@ static av_cold int mpc8_decode_init(AVCodecContext * avctx)
}
memset(c->oldDSCF, 0, sizeof(c->oldDSCF));
av_lfg_init(&c->rnd, 0xDEADBEEF);
- dsputil_init(&c->dsp, avctx);
+ ff_dsputil_init(&c->dsp, avctx);
ff_mpadsp_init(&c->mpadsp);
ff_mpc_init();
@@ -130,12 +131,12 @@ static av_cold int mpc8_decode_init(AVCodecContext * avctx)
channels = get_bits(&gb, 4) + 1;
if (channels > 2) {
av_log_missing_feature(avctx, "Multichannel MPC SV8", 1);
- return -1;
+ return AVERROR_PATCHWELCOME;
}
c->MSS = get_bits1(&gb);
c->frames = 1 << (get_bits(&gb, 3) * 2);
- avctx->sample_fmt = AV_SAMPLE_FMT_S16;
+ avctx->sample_fmt = AV_SAMPLE_FMT_S16P;
avctx->channel_layout = (avctx->channels==2) ? AV_CH_LAYOUT_STEREO : AV_CH_LAYOUT_MONO;
if(vlc_initialized) return 0;
@@ -250,7 +251,7 @@ static int mpc8_decode_frame(AVCodecContext * avctx, void *data,
/* get output buffer */
c->frame.nb_samples = MPC_FRAME_SIZE;
- if ((res = avctx->get_buffer(avctx, &c->frame)) < 0) {
+ if ((res = ff_get_buffer(avctx, &c->frame)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return res;
}
@@ -270,7 +271,7 @@ static int mpc8_decode_frame(AVCodecContext * avctx, void *data,
maxband = c->last_max_band + get_vlc2(gb, band_vlc.table, MPC8_BANDS_BITS, 2);
if(maxband > 32) maxband -= 33;
}
- if(maxband > c->maxbands)
+ if(maxband > c->maxbands + 1)
return AVERROR_INVALIDDATA;
c->last_max_band = maxband;
@@ -405,11 +406,15 @@ static int mpc8_decode_frame(AVCodecContext * avctx, void *data,
}
}
- ff_mpc_dequantize_and_synth(c, maxband, c->frame.data[0], avctx->channels);
+ ff_mpc_dequantize_and_synth(c, maxband - 1,
+ (int16_t **)c->frame.extended_data,
+ avctx->channels);
c->cur_frame++;
c->last_bits_used = get_bits_count(gb);
+ if(get_bits_left(gb) < 8) // we have only padding left
+ c->last_bits_used = buf_size << 3;
if(c->cur_frame >= c->frames)
c->cur_frame = 0;
@@ -419,13 +424,22 @@ static int mpc8_decode_frame(AVCodecContext * avctx, void *data,
return c->cur_frame ? c->last_bits_used >> 3 : buf_size;
}
+static av_cold void mpc8_decode_flush(AVCodecContext *avctx)
+{
+ MPCContext *c = avctx->priv_data;
+ c->cur_frame = 0;
+}
+
AVCodec ff_mpc8_decoder = {
.name = "mpc8",
.type = AVMEDIA_TYPE_AUDIO,
- .id = CODEC_ID_MUSEPACK8,
+ .id = AV_CODEC_ID_MUSEPACK8,
.priv_data_size = sizeof(MPCContext),
.init = mpc8_decode_init,
.decode = mpc8_decode_frame,
+ .flush = mpc8_decode_flush,
.capabilities = CODEC_CAP_DR1,
- .long_name = NULL_IF_CONFIG_SMALL("Musepack SV8"),
+ .long_name = NULL_IF_CONFIG_SMALL("Musepack SV8"),
+ .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_S16P,
+ AV_SAMPLE_FMT_NONE },
};
diff --git a/gst-libs/ext/libav/libavcodec/mpeg12.c b/gst-libs/ext/libav/libavcodec/mpeg12.c
index 436b4cf..7a9b54a 100644
--- a/gst-libs/ext/libav/libavcodec/mpeg12.c
+++ b/gst-libs/ext/libav/libavcodec/mpeg12.c
@@ -837,7 +837,7 @@ static int mpeg_decode_mb(MpegEncContext *s, DCTELEM block[12][64])
}
}
- if (s->codec_id == CODEC_ID_MPEG2VIDEO) {
+ if (s->codec_id == AV_CODEC_ID_MPEG2VIDEO) {
if (s->flags2 & CODEC_FLAG2_FAST) {
for (i = 0; i < 6; i++) {
mpeg2_fast_decode_block_intra(s, *s->pblocks[i], i);
@@ -1050,7 +1050,7 @@ static int mpeg_decode_mb(MpegEncContext *s, DCTELEM block[12][64])
}
}
- if (s->codec_id == CODEC_ID_MPEG2VIDEO) {
+ if (s->codec_id == AV_CODEC_ID_MPEG2VIDEO) {
if (s->flags2 & CODEC_FLAG2_FAST) {
for (i = 0; i < 6; i++) {
if (cbp & 32) {
@@ -1117,7 +1117,7 @@ static av_cold int mpeg_decode_init(AVCodecContext *avctx)
for (i = 0; i < 64; i++)
s2->dsp.idct_permutation[i]=i;
- MPV_decode_defaults(s2);
+ ff_MPV_decode_defaults(s2);
s->mpeg_enc_ctx.avctx = avctx;
s->mpeg_enc_ctx.flags = avctx->flags;
@@ -1130,7 +1130,7 @@ static av_cold int mpeg_decode_init(AVCodecContext *avctx)
s->repeat_field = 0;
s->mpeg_enc_ctx.codec_id = avctx->codec->id;
avctx->color_range = AVCOL_RANGE_MPEG;
- if (avctx->codec->id == CODEC_ID_MPEG1VIDEO)
+ if (avctx->codec->id == AV_CODEC_ID_MPEG1VIDEO)
avctx->chroma_sample_location = AVCHROMA_LOC_CENTER;
else
avctx->chroma_sample_location = AVCHROMA_LOC_LEFT;
@@ -1171,12 +1171,12 @@ static void quant_matrix_rebuild(uint16_t *matrix, const uint8_t *old_perm,
}
}
-static const enum PixelFormat pixfmt_xvmc_mpg2_420[] = {
- PIX_FMT_XVMC_MPEG2_IDCT,
- PIX_FMT_XVMC_MPEG2_MC,
- PIX_FMT_NONE };
+static const enum AVPixelFormat pixfmt_xvmc_mpg2_420[] = {
+ AV_PIX_FMT_XVMC_MPEG2_IDCT,
+ AV_PIX_FMT_XVMC_MPEG2_MC,
+ AV_PIX_FMT_NONE };
-static enum PixelFormat mpeg_get_pixelformat(AVCodecContext *avctx)
+static enum AVPixelFormat mpeg_get_pixelformat(AVCodecContext *avctx)
{
Mpeg1Context *s1 = avctx->priv_data;
MpegEncContext *s = &s1->mpeg_enc_ctx;
@@ -1184,17 +1184,17 @@ static enum PixelFormat mpeg_get_pixelformat(AVCodecContext *avctx)
if (avctx->xvmc_acceleration)
return avctx->get_format(avctx, pixfmt_xvmc_mpg2_420);
else if (avctx->codec->capabilities & CODEC_CAP_HWACCEL_VDPAU) {
- if (avctx->codec_id == CODEC_ID_MPEG1VIDEO)
- return PIX_FMT_VDPAU_MPEG1;
+ if (avctx->codec_id == AV_CODEC_ID_MPEG1VIDEO)
+ return AV_PIX_FMT_VDPAU_MPEG1;
else
- return PIX_FMT_VDPAU_MPEG2;
+ return AV_PIX_FMT_VDPAU_MPEG2;
} else {
if (s->chroma_format < 2)
return avctx->get_format(avctx, ff_hwaccel_pixfmt_list_420);
else if (s->chroma_format == 2)
- return PIX_FMT_YUV422P;
+ return AV_PIX_FMT_YUV422P;
else
- return PIX_FMT_YUV444P;
+ return AV_PIX_FMT_YUV444P;
}
}
@@ -1219,7 +1219,7 @@ static int mpeg_decode_postinit(AVCodecContext *avctx)
if (s1->mpeg_enc_ctx_allocated) {
ParseContext pc = s->parse_context;
s->parse_context.buffer = 0;
- MPV_common_end(s);
+ ff_MPV_common_end(s);
s->parse_context = pc;
}
@@ -1237,11 +1237,10 @@ static int mpeg_decode_postinit(AVCodecContext *avctx)
* that behave like P-frames. */
avctx->has_b_frames = !s->low_delay;
- assert((avctx->sub_id == 1) == (avctx->codec_id == CODEC_ID_MPEG1VIDEO));
- if (avctx->codec_id == CODEC_ID_MPEG1VIDEO) {
+ if (avctx->codec_id == AV_CODEC_ID_MPEG1VIDEO) {
//MPEG-1 fps
- avctx->time_base.den = avpriv_frame_rate_tab[s->frame_rate_index].num;
- avctx->time_base.num = avpriv_frame_rate_tab[s->frame_rate_index].den;
+ avctx->time_base.den = ff_mpeg12_frame_rate_tab[s->frame_rate_index].num;
+ avctx->time_base.num = ff_mpeg12_frame_rate_tab[s->frame_rate_index].den;
//MPEG-1 aspect
avctx->sample_aspect_ratio = av_d2q(1.0/ff_mpeg1_aspect[s->aspect_ratio_info], 255);
avctx->ticks_per_frame=1;
@@ -1249,8 +1248,8 @@ static int mpeg_decode_postinit(AVCodecContext *avctx)
//MPEG-2 fps
av_reduce(&s->avctx->time_base.den,
&s->avctx->time_base.num,
- avpriv_frame_rate_tab[s->frame_rate_index].num * s1->frame_rate_ext.num*2,
- avpriv_frame_rate_tab[s->frame_rate_index].den * s1->frame_rate_ext.den,
+ ff_mpeg12_frame_rate_tab[s->frame_rate_index].num * s1->frame_rate_ext.num*2,
+ ff_mpeg12_frame_rate_tab[s->frame_rate_index].den * s1->frame_rate_ext.den,
1 << 30);
avctx->ticks_per_frame = 2;
//MPEG-2 aspect
@@ -1276,8 +1275,10 @@ static int mpeg_decode_postinit(AVCodecContext *avctx)
//res_change_ffmpeg_aspect.ts 4/3 225/44 ->4/3
//widescreen-issue562.mpg 4/3 16/9 -> 16/9
// s->avctx->sample_aspect_ratio = av_mul_q(s->avctx->sample_aspect_ratio, (AVRational) {s->width, s->height});
-//av_log(NULL, AV_LOG_ERROR, "A %d/%d\n", ff_mpeg2_aspect[s->aspect_ratio_info].num, ff_mpeg2_aspect[s->aspect_ratio_info].den);
-//av_log(NULL, AV_LOG_ERROR, "B %d/%d\n", s->avctx->sample_aspect_ratio.num, s->avctx->sample_aspect_ratio.den);
+ av_dlog(avctx, "A %d/%d\n",
+ ff_mpeg2_aspect[s->aspect_ratio_info].num, ff_mpeg2_aspect[s->aspect_ratio_info].den);
+ av_dlog(avctx, "B %d/%d\n", s->avctx->sample_aspect_ratio.num,
+ s->avctx->sample_aspect_ratio.den);
}
} else {
s->avctx->sample_aspect_ratio =
@@ -1288,7 +1289,7 @@ static int mpeg_decode_postinit(AVCodecContext *avctx)
avctx->pix_fmt = mpeg_get_pixelformat(avctx);
avctx->hwaccel = ff_find_hwaccel(avctx->codec->id, avctx->pix_fmt);
// until then pix_fmt may be changed right after codec init
- if (avctx->pix_fmt == PIX_FMT_XVMC_MPEG2_IDCT ||
+ if (avctx->pix_fmt == AV_PIX_FMT_XVMC_MPEG2_IDCT ||
avctx->hwaccel ||
s->avctx->codec->capabilities & CODEC_CAP_HWACCEL_VDPAU)
if (avctx->idct_algo == FF_IDCT_AUTO)
@@ -1298,7 +1299,7 @@ static int mpeg_decode_postinit(AVCodecContext *avctx)
* if DCT permutation is changed. */
memcpy(old_permutation, s->dsp.idct_permutation, 64 * sizeof(uint8_t));
- if (MPV_common_init(s) < 0)
+ if (ff_MPV_common_init(s) < 0)
return -2;
quant_matrix_rebuild(s->intra_matrix, old_permutation, s->dsp.idct_permutation);
@@ -1381,8 +1382,7 @@ static void mpeg_decode_sequence_extension(Mpeg1Context *s1)
s1->frame_rate_ext.den = get_bits(&s->gb, 5) + 1;
av_dlog(s->avctx, "sequence extension\n");
- s->codec_id = s->avctx->codec_id = CODEC_ID_MPEG2VIDEO;
- s->avctx->sub_id = 2; /* indicates MPEG-2 found */
+ s->codec_id = s->avctx->codec_id = AV_CODEC_ID_MPEG2VIDEO;
if (s->avctx->debug & FF_DEBUG_PICT_INFO)
av_log(s->avctx, AV_LOG_DEBUG, "profile: %d, level: %d vbv buffer: %d, bitrate:%d\n",
@@ -1523,8 +1523,7 @@ static void mpeg_decode_picture_coding_extension(Mpeg1Context *s1)
}
if (s->progressive_sequence && !s->frame_pred_frame_dct) {
- av_log(s->avctx, AV_LOG_ERROR, "invalid frame_pred_frame_dct\n");
- s->frame_pred_frame_dct = 1;
+ av_log(s->avctx, AV_LOG_WARNING, "invalid frame_pred_frame_dct\n");
}
if (s->picture_structure == PICT_FRAME) {
@@ -1563,7 +1562,7 @@ static int mpeg_field_start(MpegEncContext *s, const uint8_t *buf, int buf_size)
/* start frame decoding */
if (s->first_field || s->picture_structure == PICT_FRAME) {
- if (MPV_frame_start(s, avctx) < 0)
+ if (ff_MPV_frame_start(s, avctx) < 0)
return -1;
ff_er_frame_start(s);
@@ -1593,6 +1592,12 @@ static int mpeg_field_start(MpegEncContext *s, const uint8_t *buf, int buf_size)
return -1;
}
+ if (s->avctx->hwaccel &&
+ (s->avctx->slice_flags & SLICE_FLAG_ALLOW_FIELD)) {
+ if (s->avctx->hwaccel->end_frame(s->avctx) < 0)
+ av_log(avctx, AV_LOG_ERROR, "hardware accelerator failed to decode first field\n");
+ }
+
for (i = 0; i < 4; i++) {
s->current_picture.f.data[i] = s->current_picture_ptr->f.data[i];
if (s->picture_structure == PICT_BOTTOM_FIELD) {
@@ -1628,7 +1633,6 @@ static int mpeg_decode_slice(MpegEncContext *s, int mb_y,
const uint8_t **buf, int buf_size)
{
AVCodecContext *avctx = s->avctx;
- const int lowres = s->avctx->lowres;
const int field_pic = s->picture_structure != PICT_FRAME;
s->resync_mb_x =
@@ -1749,17 +1753,17 @@ static int mpeg_decode_slice(MpegEncContext *s, int mb_y,
}
}
- s->dest[0] += 16 >> lowres;
- s->dest[1] +=(16 >> lowres) >> s->chroma_x_shift;
- s->dest[2] +=(16 >> lowres) >> s->chroma_x_shift;
+ s->dest[0] += 16;
+ s->dest[1] += 16 >> s->chroma_x_shift;
+ s->dest[2] += 16 >> s->chroma_x_shift;
- MPV_decode_mb(s, s->block);
+ ff_MPV_decode_mb(s, s->block);
if (++s->mb_x >= s->mb_width) {
- const int mb_size = 16 >> s->avctx->lowres;
+ const int mb_size = 16;
ff_draw_horiz_band(s, mb_size*(s->mb_y >> field_pic), mb_size);
- MPV_report_decode_progress(s);
+ ff_MPV_report_decode_progress(s);
s->mb_x = 0;
s->mb_y += 1 << field_pic;
@@ -1841,7 +1845,7 @@ static int mpeg_decode_slice(MpegEncContext *s, int mb_y,
}
eos: // end of slice
*buf += (get_bits_count(&s->gb)-1)/8;
-//printf("y %d %d %d %d\n", s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y);
+ av_dlog(s, "y %d %d %d %d\n", s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y);
return 0;
}
@@ -1860,8 +1864,9 @@ static int slice_decode_thread(AVCodecContext *c, void *arg)
ret = mpeg_decode_slice(s, mb_y, &buf, s->gb.buffer_end - buf);
emms_c();
-//av_log(c, AV_LOG_DEBUG, "ret:%d resync:%d/%d mb:%d/%d ts:%d/%d ec:%d\n",
-//ret, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y, s->start_mb_y, s->end_mb_y, s->error_count);
+ av_dlog(c, "ret:%d resync:%d/%d mb:%d/%d ts:%d/%d ec:%d\n",
+ ret, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y,
+ s->start_mb_y, s->end_mb_y, s->error_count);
if (ret < 0) {
if (c->err_recognition & AV_EF_EXPLODE)
return ret;
@@ -1912,10 +1917,10 @@ static int slice_end(AVCodecContext *avctx, AVFrame *pict)
ff_er_frame_end(s);
- MPV_frame_end(s);
+ ff_MPV_frame_end(s);
if (s->pict_type == AV_PICTURE_TYPE_B || s->low_delay) {
- *pict = *(AVFrame*)s->current_picture_ptr;
+ *pict = s->current_picture_ptr->f;
ff_print_debug_info(s, pict);
} else {
if (avctx->active_thread_type & FF_THREAD_FRAME)
@@ -1923,7 +1928,7 @@ static int slice_end(AVCodecContext *avctx, AVFrame *pict)
/* latency of 1 frame for I- and P-frames */
/* XXX: use another variable than picture_number */
if (s->last_picture_ptr != NULL) {
- *pict = *(AVFrame*)s->last_picture_ptr;
+ *pict = s->last_picture_ptr->f;
ff_print_debug_info(s, pict);
}
}
@@ -1999,8 +2004,7 @@ static int mpeg1_decode_sequence(AVCodecContext *avctx,
s->picture_structure = PICT_FRAME;
s->frame_pred_frame_dct = 1;
s->chroma_format = 1;
- s->codec_id = s->avctx->codec_id = CODEC_ID_MPEG1VIDEO;
- avctx->sub_id = 1; /* indicates MPEG-1 */
+ s->codec_id = s->avctx->codec_id = AV_CODEC_ID_MPEG1VIDEO;
s->out_format = FMT_MPEG1;
s->swap_uv = 0; // AFAIK VCR2 does not have SEQ_HEADER
if (s->flags & CODEC_FLAG_LOW_DELAY)
@@ -2022,7 +2026,7 @@ static int vcr2_init_sequence(AVCodecContext *avctx)
/* start new MPEG-1 context decoding */
s->out_format = FMT_MPEG1;
if (s1->mpeg_enc_ctx_allocated) {
- MPV_common_end(s);
+ ff_MPV_common_end(s);
}
s->width = avctx->coded_width;
s->height = avctx->coded_height;
@@ -2032,12 +2036,12 @@ static int vcr2_init_sequence(AVCodecContext *avctx)
avctx->pix_fmt = mpeg_get_pixelformat(avctx);
avctx->hwaccel = ff_find_hwaccel(avctx->codec->id, avctx->pix_fmt);
- if (avctx->pix_fmt == PIX_FMT_XVMC_MPEG2_IDCT || avctx->hwaccel ||
+ if (avctx->pix_fmt == AV_PIX_FMT_XVMC_MPEG2_IDCT || avctx->hwaccel ||
s->avctx->codec->capabilities & CODEC_CAP_HWACCEL_VDPAU)
if (avctx->idct_algo == FF_IDCT_AUTO)
avctx->idct_algo = FF_IDCT_SIMPLE;
- if (MPV_common_init(s) < 0)
+ if (ff_MPV_common_init(s) < 0)
return -1;
exchange_uv(s); // common init reset pblocks, so we swap them here
s->swap_uv = 1; // in case of xvmc we need to swap uv for each MB
@@ -2059,8 +2063,7 @@ static int vcr2_init_sequence(AVCodecContext *avctx)
s->picture_structure = PICT_FRAME;
s->frame_pred_frame_dct = 1;
s->chroma_format = 1;
- s->codec_id = s->avctx->codec_id = CODEC_ID_MPEG2VIDEO;
- avctx->sub_id = 2; /* indicates MPEG-2 */
+ s->codec_id = s->avctx->codec_id = AV_CODEC_ID_MPEG2VIDEO;
s1->save_width = s->width;
s1->save_height = s->height;
s1->save_progressive_seq = s->progressive_sequence;
@@ -2161,6 +2164,7 @@ int ff_mpeg1_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size,
pc->frame_start_found = 4;
}
if (state == SEQ_END_CODE) {
+ pc->frame_start_found = 0;
pc->state=-1;
return i+1;
}
@@ -2185,56 +2189,7 @@ int ff_mpeg1_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size,
}
static int decode_chunks(AVCodecContext *avctx,
- AVFrame *picture, int *data_size,
- const uint8_t *buf, int buf_size);
-
-/* handle buffering and image synchronisation */
-static int mpeg_decode_frame(AVCodecContext *avctx,
- void *data, int *data_size,
- AVPacket *avpkt)
-{
- const uint8_t *buf = avpkt->data;
- int buf_size = avpkt->size;
- Mpeg1Context *s = avctx->priv_data;
- AVFrame *picture = data;
- MpegEncContext *s2 = &s->mpeg_enc_ctx;
- av_dlog(avctx, "fill_buffer\n");
-
- if (buf_size == 0 || (buf_size == 4 && AV_RB32(buf) == SEQ_END_CODE)) {
- /* special case for last picture */
- if (s2->low_delay == 0 && s2->next_picture_ptr) {
- *picture = *(AVFrame*)s2->next_picture_ptr;
- s2->next_picture_ptr = NULL;
-
- *data_size = sizeof(AVFrame);
- }
- return buf_size;
- }
-
- if (s2->flags & CODEC_FLAG_TRUNCATED) {
- int next = ff_mpeg1_find_frame_end(&s2->parse_context, buf, buf_size, NULL);
-
- if (ff_combine_frame(&s2->parse_context, next, (const uint8_t **)&buf, &buf_size) < 0)
- return buf_size;
- }
-
- if (s->mpeg_enc_ctx_allocated == 0 && avctx->codec_tag == AV_RL32("VCR2"))
- vcr2_init_sequence(avctx);
-
- s->slice_count = 0;
-
- if (avctx->extradata && !s->extradata_decoded) {
- int ret = decode_chunks(avctx, picture, data_size, avctx->extradata, avctx->extradata_size);
- s->extradata_decoded = 1;
- if (ret < 0 && (avctx->err_recognition & AV_EF_EXPLODE))
- return ret;
- }
-
- return decode_chunks(avctx, picture, data_size, buf, buf_size);
-}
-
-static int decode_chunks(AVCodecContext *avctx,
- AVFrame *picture, int *data_size,
+ AVFrame *picture, int *got_output,
const uint8_t *buf, int buf_size)
{
Mpeg1Context *s = avctx->priv_data;
@@ -2263,7 +2218,7 @@ static int decode_chunks(AVCodecContext *avctx,
if (slice_end(avctx, picture)) {
if (s2->last_picture_ptr || s2->low_delay) //FIXME merge with the stuff in mpeg_decode_slice
- *data_size = sizeof(AVPicture);
+ *got_output = 1;
}
}
s2->pict_type = 0;
@@ -2401,7 +2356,7 @@ static int decode_chunks(AVCodecContext *avctx,
if (!s->mpeg_enc_ctx_allocated)
break;
- if (s2->codec_id == CODEC_ID_MPEG2VIDEO) {
+ if (s2->codec_id == AV_CODEC_ID_MPEG2VIDEO) {
if (mb_y < avctx->skip_top || mb_y >= s2->mb_height - avctx->skip_bottom)
break;
}
@@ -2439,7 +2394,10 @@ static int decode_chunks(AVCodecContext *avctx,
thread_context->end_mb_y = s2->mb_height;
if (s->slice_count) {
s2->thread_context[s->slice_count-1]->end_mb_y = mb_y;
- ff_update_duplicate_context(thread_context, s2);
+ ret = ff_update_duplicate_context(thread_context,
+ s2);
+ if (ret < 0)
+ return ret;
}
init_get_bits(&thread_context->gb, buf_ptr, input_size*8);
s->slice_count++;
@@ -2464,6 +2422,51 @@ static int decode_chunks(AVCodecContext *avctx,
}
}
+static int mpeg_decode_frame(AVCodecContext *avctx,
+ void *data, int *got_output,
+ AVPacket *avpkt)
+{
+ const uint8_t *buf = avpkt->data;
+ int buf_size = avpkt->size;
+ Mpeg1Context *s = avctx->priv_data;
+ AVFrame *picture = data;
+ MpegEncContext *s2 = &s->mpeg_enc_ctx;
+ av_dlog(avctx, "fill_buffer\n");
+
+ if (buf_size == 0 || (buf_size == 4 && AV_RB32(buf) == SEQ_END_CODE)) {
+ /* special case for last picture */
+ if (s2->low_delay == 0 && s2->next_picture_ptr) {
+ *picture = s2->next_picture_ptr->f;
+ s2->next_picture_ptr = NULL;
+
+ *got_output = 1;
+ }
+ return buf_size;
+ }
+
+ if (s2->flags & CODEC_FLAG_TRUNCATED) {
+ int next = ff_mpeg1_find_frame_end(&s2->parse_context, buf, buf_size, NULL);
+
+ if (ff_combine_frame(&s2->parse_context, next, (const uint8_t **)&buf, &buf_size) < 0)
+ return buf_size;
+ }
+
+ if (s->mpeg_enc_ctx_allocated == 0 && avctx->codec_tag == AV_RL32("VCR2"))
+ vcr2_init_sequence(avctx);
+
+ s->slice_count = 0;
+
+ if (avctx->extradata && !s->extradata_decoded) {
+ int ret = decode_chunks(avctx, picture, got_output, avctx->extradata, avctx->extradata_size);
+ s->extradata_decoded = 1;
+ if (ret < 0 && (avctx->err_recognition & AV_EF_EXPLODE))
+ return ret;
+ }
+
+ return decode_chunks(avctx, picture, got_output, buf, buf_size);
+}
+
+
static void flush(AVCodecContext *avctx)
{
Mpeg1Context *s = avctx->priv_data;
@@ -2479,7 +2482,7 @@ static int mpeg_decode_end(AVCodecContext *avctx)
Mpeg1Context *s = avctx->priv_data;
if (s->mpeg_enc_ctx_allocated)
- MPV_common_end(&s->mpeg_enc_ctx);
+ ff_MPV_common_end(&s->mpeg_enc_ctx);
return 0;
}
@@ -2497,31 +2500,33 @@ static const AVProfile mpeg2_video_profiles[] = {
AVCodec ff_mpeg1video_decoder = {
- .name = "mpeg1video",
- .type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_MPEG1VIDEO,
- .priv_data_size = sizeof(Mpeg1Context),
- .init = mpeg_decode_init,
- .close = mpeg_decode_end,
- .decode = mpeg_decode_frame,
- .capabilities = CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1 | CODEC_CAP_TRUNCATED | CODEC_CAP_DELAY | CODEC_CAP_SLICE_THREADS,
- .flush = flush,
- .max_lowres = 3,
- .long_name = NULL_IF_CONFIG_SMALL("MPEG-1 video"),
+ .name = "mpeg1video",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .id = AV_CODEC_ID_MPEG1VIDEO,
+ .priv_data_size = sizeof(Mpeg1Context),
+ .init = mpeg_decode_init,
+ .close = mpeg_decode_end,
+ .decode = mpeg_decode_frame,
+ .capabilities = CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1 |
+ CODEC_CAP_TRUNCATED | CODEC_CAP_DELAY |
+ CODEC_CAP_SLICE_THREADS,
+ .flush = flush,
+ .long_name = NULL_IF_CONFIG_SMALL("MPEG-1 video"),
.update_thread_context = ONLY_IF_THREADS_ENABLED(mpeg_decode_update_thread_context)
};
AVCodec ff_mpeg2video_decoder = {
.name = "mpeg2video",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_MPEG2VIDEO,
+ .id = AV_CODEC_ID_MPEG2VIDEO,
.priv_data_size = sizeof(Mpeg1Context),
.init = mpeg_decode_init,
.close = mpeg_decode_end,
.decode = mpeg_decode_frame,
- .capabilities = CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1 | CODEC_CAP_TRUNCATED | CODEC_CAP_DELAY | CODEC_CAP_SLICE_THREADS,
+ .capabilities = CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1 |
+ CODEC_CAP_TRUNCATED | CODEC_CAP_DELAY |
+ CODEC_CAP_SLICE_THREADS,
.flush = flush,
- .max_lowres = 3,
.long_name = NULL_IF_CONFIG_SMALL("MPEG-2 video"),
.profiles = NULL_IF_CONFIG_SMALL(mpeg2_video_profiles),
};
@@ -2538,7 +2543,7 @@ static av_cold int mpeg_mc_decode_init(AVCodecContext *avctx)
}
mpeg_decode_init(avctx);
- avctx->pix_fmt = PIX_FMT_XVMC_MPEG2_IDCT;
+ avctx->pix_fmt = AV_PIX_FMT_XVMC_MPEG2_IDCT;
avctx->xvmc_acceleration = 2; // 2 - the blocks are packed!
return 0;
@@ -2547,12 +2552,13 @@ static av_cold int mpeg_mc_decode_init(AVCodecContext *avctx)
AVCodec ff_mpeg_xvmc_decoder = {
.name = "mpegvideo_xvmc",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_MPEG2VIDEO_XVMC,
+ .id = AV_CODEC_ID_MPEG2VIDEO_XVMC,
.priv_data_size = sizeof(Mpeg1Context),
.init = mpeg_mc_decode_init,
.close = mpeg_decode_end,
.decode = mpeg_decode_frame,
- .capabilities = CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1 | CODEC_CAP_TRUNCATED| CODEC_CAP_HWACCEL | CODEC_CAP_DELAY,
+ .capabilities = CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1 |
+ CODEC_CAP_TRUNCATED| CODEC_CAP_HWACCEL | CODEC_CAP_DELAY,
.flush = flush,
.long_name = NULL_IF_CONFIG_SMALL("MPEG-1/2 video XvMC (X-Video Motion Compensation)"),
};
@@ -2563,12 +2569,13 @@ AVCodec ff_mpeg_xvmc_decoder = {
AVCodec ff_mpeg_vdpau_decoder = {
.name = "mpegvideo_vdpau",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_MPEG2VIDEO,
+ .id = AV_CODEC_ID_MPEG2VIDEO,
.priv_data_size = sizeof(Mpeg1Context),
.init = mpeg_decode_init,
.close = mpeg_decode_end,
.decode = mpeg_decode_frame,
- .capabilities = CODEC_CAP_DR1 | CODEC_CAP_TRUNCATED | CODEC_CAP_HWACCEL_VDPAU | CODEC_CAP_DELAY,
+ .capabilities = CODEC_CAP_DR1 | CODEC_CAP_TRUNCATED |
+ CODEC_CAP_HWACCEL_VDPAU | CODEC_CAP_DELAY,
.flush = flush,
.long_name = NULL_IF_CONFIG_SMALL("MPEG-1/2 video (VDPAU acceleration)"),
};
@@ -2578,14 +2585,14 @@ AVCodec ff_mpeg_vdpau_decoder = {
AVCodec ff_mpeg1_vdpau_decoder = {
.name = "mpeg1video_vdpau",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_MPEG1VIDEO,
+ .id = AV_CODEC_ID_MPEG1VIDEO,
.priv_data_size = sizeof(Mpeg1Context),
.init = mpeg_decode_init,
.close = mpeg_decode_end,
.decode = mpeg_decode_frame,
- .capabilities = CODEC_CAP_DR1 | CODEC_CAP_TRUNCATED | CODEC_CAP_HWACCEL_VDPAU | CODEC_CAP_DELAY,
+ .capabilities = CODEC_CAP_DR1 | CODEC_CAP_TRUNCATED |
+ CODEC_CAP_HWACCEL_VDPAU | CODEC_CAP_DELAY,
.flush = flush,
.long_name = NULL_IF_CONFIG_SMALL("MPEG-1 video (VDPAU acceleration)"),
};
#endif
-
diff --git a/gst-libs/ext/libav/libavcodec/mpeg12data.c b/gst-libs/ext/libav/libavcodec/mpeg12data.c
index a0dd6e5..ccc3d2d 100644
--- a/gst-libs/ext/libav/libavcodec/mpeg12data.c
+++ b/gst-libs/ext/libav/libavcodec/mpeg12data.c
@@ -305,7 +305,7 @@ const uint8_t ff_mpeg12_mbMotionVectorTable[17][2] = {
{ 0xc, 10 },
};
-const AVRational avpriv_frame_rate_tab[16] = {
+const AVRational ff_mpeg12_frame_rate_tab[16] = {
{ 0, 0},
{24000, 1001},
{ 24, 1},
diff --git a/gst-libs/ext/libav/libavcodec/mpeg12data.h b/gst-libs/ext/libav/libavcodec/mpeg12data.h
index 86ba3ec..633a291 100644
--- a/gst-libs/ext/libav/libavcodec/mpeg12data.h
+++ b/gst-libs/ext/libav/libavcodec/mpeg12data.h
@@ -48,7 +48,7 @@ extern const uint8_t ff_mpeg12_mbPatTable[64][2];
extern const uint8_t ff_mpeg12_mbMotionVectorTable[17][2];
-extern const AVRational avpriv_frame_rate_tab[];
+extern const AVRational ff_mpeg12_frame_rate_tab[];
extern const float ff_mpeg1_aspect[16];
extern const AVRational ff_mpeg2_aspect[16];
diff --git a/gst-libs/ext/libav/libavcodec/mpeg12enc.c b/gst-libs/ext/libav/libavcodec/mpeg12enc.c
index b0950b8..ceb31e0 100644
--- a/gst-libs/ext/libav/libavcodec/mpeg12enc.c
+++ b/gst-libs/ext/libav/libavcodec/mpeg12enc.c
@@ -111,7 +111,7 @@ static int find_frame_rate_index(MpegEncContext *s){
int64_t d;
for(i=1;i<14;i++) {
- int64_t n0= 1001LL/avpriv_frame_rate_tab[i].den*avpriv_frame_rate_tab[i].num*s->avctx->time_base.num;
+ int64_t n0 = 1001LL / ff_mpeg12_frame_rate_tab[i].den * ff_mpeg12_frame_rate_tab[i].num * s->avctx->time_base.num;
int64_t n1= 1001LL*s->avctx->time_base.den;
if(s->avctx->strict_std_compliance > FF_COMPLIANCE_UNOFFICIAL && i>=9) break;
@@ -131,16 +131,9 @@ static av_cold int encode_init(AVCodecContext *avctx)
{
MpegEncContext *s = avctx->priv_data;
- if(MPV_encode_init(avctx) < 0)
+ if(ff_MPV_encode_init(avctx) < 0)
return -1;
-#if FF_API_MPEGVIDEO_GLOBAL_OPTS
- if (avctx->flags2 & CODEC_FLAG2_DROP_FRAME_TIMECODE)
- s->drop_frame_timecode = 1;
- if (avctx->flags & CODEC_FLAG_SVCD_SCAN_OFFSET)
- s->scan_offset = 1;
-#endif
-
if(find_frame_rate_index(s) < 0){
if(s->strict_std_compliance > FF_COMPLIANCE_EXPERIMENTAL){
av_log(avctx, AV_LOG_ERROR, "MPEG1/2 does not support %d/%d fps\n", avctx->time_base.den, avctx->time_base.num);
@@ -202,7 +195,7 @@ static void mpeg1_encode_sequence_header(MpegEncContext *s)
if(aspect_ratio==0.0) aspect_ratio= 1.0; //pixel aspect 1:1 (VGA)
if (s->current_picture.f.key_frame) {
- AVRational framerate= avpriv_frame_rate_tab[s->frame_rate_index];
+ AVRational framerate = ff_mpeg12_frame_rate_tab[s->frame_rate_index];
/* mpeg1 header repeated every gop */
put_header(s, SEQ_START_CODE);
@@ -212,7 +205,7 @@ static void mpeg1_encode_sequence_header(MpegEncContext *s)
for(i=1; i<15; i++){
float error= aspect_ratio;
- if(s->codec_id == CODEC_ID_MPEG1VIDEO || i <=1)
+ if(s->codec_id == AV_CODEC_ID_MPEG1VIDEO || i <=1)
error-= 1.0/ff_mpeg1_aspect[i];
else
error-= av_q2d(ff_mpeg2_aspect[i])*s->height/s->width;
@@ -230,7 +223,7 @@ static void mpeg1_encode_sequence_header(MpegEncContext *s)
if(s->avctx->rc_max_rate){
v = (s->avctx->rc_max_rate + 399) / 400;
- if (v > 0x3ffff && s->codec_id == CODEC_ID_MPEG1VIDEO)
+ if (v > 0x3ffff && s->codec_id == AV_CODEC_ID_MPEG1VIDEO)
v = 0x3ffff;
}else{
v= 0x3FFFF;
@@ -255,14 +248,14 @@ static void mpeg1_encode_sequence_header(MpegEncContext *s)
s->avctx->me_range && s->avctx->me_range < 128 &&
vbv_buffer_size <= 20 &&
v <= 1856000/400 &&
- s->codec_id == CODEC_ID_MPEG1VIDEO;
+ s->codec_id == AV_CODEC_ID_MPEG1VIDEO;
put_bits(&s->pb, 1, constraint_parameter_flag);
ff_write_quant_matrix(&s->pb, s->avctx->intra_matrix);
ff_write_quant_matrix(&s->pb, s->avctx->inter_matrix);
- if(s->codec_id == CODEC_ID_MPEG2VIDEO){
+ if(s->codec_id == AV_CODEC_ID_MPEG2VIDEO){
put_header(s, EXT_START_CODE);
put_bits(&s->pb, 4, 1); //seq ext
@@ -338,7 +331,7 @@ void ff_mpeg1_encode_slice_header(MpegEncContext *s){
put_bits(&s->pb, 1, 0); /* slice extra information */
}
-void mpeg1_encode_picture_header(MpegEncContext *s, int picture_number)
+void ff_mpeg1_encode_picture_header(MpegEncContext *s, int picture_number)
{
mpeg1_encode_sequence_header(s);
@@ -357,7 +350,7 @@ void mpeg1_encode_picture_header(MpegEncContext *s, int picture_number)
// RAL: Forward f_code also needed for B frames
if (s->pict_type == AV_PICTURE_TYPE_P || s->pict_type == AV_PICTURE_TYPE_B) {
put_bits(&s->pb, 1, 0); /* half pel coordinates */
- if(s->codec_id == CODEC_ID_MPEG1VIDEO)
+ if(s->codec_id == AV_CODEC_ID_MPEG1VIDEO)
put_bits(&s->pb, 3, s->f_code); /* forward_f_code */
else
put_bits(&s->pb, 3, 7); /* forward_f_code */
@@ -366,7 +359,7 @@ void mpeg1_encode_picture_header(MpegEncContext *s, int picture_number)
// RAL: Backward f_code necessary for B frames
if (s->pict_type == AV_PICTURE_TYPE_B) {
put_bits(&s->pb, 1, 0); /* half pel coordinates */
- if(s->codec_id == CODEC_ID_MPEG1VIDEO)
+ if(s->codec_id == AV_CODEC_ID_MPEG1VIDEO)
put_bits(&s->pb, 3, s->b_code); /* backward_f_code */
else
put_bits(&s->pb, 3, 7); /* backward_f_code */
@@ -375,7 +368,7 @@ void mpeg1_encode_picture_header(MpegEncContext *s, int picture_number)
put_bits(&s->pb, 1, 0); /* extra bit picture */
s->frame_pred_frame_dct = 1;
- if(s->codec_id == CODEC_ID_MPEG2VIDEO){
+ if(s->codec_id == AV_CODEC_ID_MPEG2VIDEO){
put_header(s, EXT_START_CODE);
put_bits(&s->pb, 4, 8); //pic ext
if (s->pict_type == AV_PICTURE_TYPE_P || s->pict_type == AV_PICTURE_TYPE_B) {
@@ -456,7 +449,7 @@ static av_always_inline void mpeg1_encode_mb_internal(MpegEncContext *s,
}
if (cbp == 0 && !first_mb && s->mv_type == MV_TYPE_16X16 &&
- (mb_x != s->mb_width - 1 || (mb_y != s->mb_height - 1 && s->codec_id == CODEC_ID_MPEG1VIDEO)) &&
+ (mb_x != s->mb_width - 1 || (mb_y != s->mb_height - 1 && s->codec_id == AV_CODEC_ID_MPEG1VIDEO)) &&
((s->pict_type == AV_PICTURE_TYPE_P && (motion_x | motion_y) == 0) ||
(s->pict_type == AV_PICTURE_TYPE_B && s->mv_dir == s->last_mv_dir && (((s->mv_dir & MV_DIR_FORWARD) ? ((s->mv[0][0][0] - s->last_mv[0][0][0])|(s->mv[0][0][1] - s->last_mv[0][0][1])) : 0) |
((s->mv_dir & MV_DIR_BACKWARD) ? ((s->mv[1][0][0] - s->last_mv[1][0][0])|(s->mv[1][0][1] - s->last_mv[1][0][1])) : 0)) == 0))) {
@@ -663,7 +656,7 @@ static av_always_inline void mpeg1_encode_mb_internal(MpegEncContext *s,
}
}
-void mpeg1_encode_mb(MpegEncContext *s, DCTELEM block[6][64], int motion_x, int motion_y)
+void ff_mpeg1_encode_mb(MpegEncContext *s, DCTELEM block[6][64], int motion_x, int motion_y)
{
if (s->chroma_format == CHROMA_420) mpeg1_encode_mb_internal(s, block, motion_x, motion_y, 6);
else mpeg1_encode_mb_internal(s, block, motion_x, motion_y, 8);
@@ -790,7 +783,7 @@ void ff_mpeg1_encode_init(MpegEncContext *s)
}
s->me.mv_penalty= mv_penalty;
s->fcode_tab= fcode_tab;
- if(s->codec_id == CODEC_ID_MPEG1VIDEO){
+ if(s->codec_id == AV_CODEC_ID_MPEG1VIDEO){
s->min_qcoeff=-255;
s->max_qcoeff= 255;
}else{
@@ -892,7 +885,7 @@ static void mpeg1_encode_block(MpegEncContext *s,
run = i - last_non_zero - 1;
alevel= level;
- MASK_ABS(sign, alevel)
+ MASK_ABS(sign, alevel);
sign&=1;
if (alevel <= mpeg1_max_level[0][run]){
@@ -904,7 +897,7 @@ static void mpeg1_encode_block(MpegEncContext *s,
put_bits(&s->pb, table_vlc[111][1], table_vlc[111][0]);
/* escape: only clip in this case */
put_bits(&s->pb, 6, run);
- if(s->codec_id == CODEC_ID_MPEG1VIDEO){
+ if(s->codec_id == AV_CODEC_ID_MPEG1VIDEO){
if (alevel < 128) {
put_sbits(&s->pb, 8, level);
} else {
@@ -928,19 +921,21 @@ static void mpeg1_encode_block(MpegEncContext *s,
#define OFFSET(x) offsetof(MpegEncContext, x)
#define VE AV_OPT_FLAG_ENCODING_PARAM | AV_OPT_FLAG_VIDEO_PARAM
#define COMMON_OPTS\
- { "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 },
+ { "intra_vlc", "Use MPEG-2 intra VLC table.", OFFSET(intra_vlc_format), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, VE },\
+ { "drop_frame_timecode", "Timecode is in drop frame format.", OFFSET(drop_frame_timecode), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, VE}, \
+ { "scan_offset", "Reserve space for SVCD scan offset user data.", OFFSET(scan_offset), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, VE },
static const AVOption mpeg1_options[] = {
COMMON_OPTS
+ FF_MPV_COMMON_OPTS
{ NULL },
};
static const AVOption mpeg2_options[] = {
COMMON_OPTS
- { "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 },
+ { "non_linear_quant", "Use nonlinear quantizer.", OFFSET(q_scale_type), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, VE },
+ { "alternate_scan", "Enable alternate scantable.", OFFSET(alternate_scan), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, VE },
+ FF_MPV_COMMON_OPTS
{ NULL },
};
@@ -956,31 +951,34 @@ mpeg12_class(1)
mpeg12_class(2)
AVCodec ff_mpeg1video_encoder = {
- .name = "mpeg1video",
- .type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_MPEG1VIDEO,
- .priv_data_size = sizeof(MpegEncContext),
- .init = encode_init,
- .encode = MPV_encode_picture,
- .close = MPV_encode_end,
- .supported_framerates= avpriv_frame_rate_tab+1,
- .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE},
- .capabilities= CODEC_CAP_DELAY | CODEC_CAP_SLICE_THREADS,
- .long_name= NULL_IF_CONFIG_SMALL("MPEG-1 video"),
- .priv_class = &mpeg1_class,
+ .name = "mpeg1video",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .id = AV_CODEC_ID_MPEG1VIDEO,
+ .priv_data_size = sizeof(MpegEncContext),
+ .init = encode_init,
+ .encode2 = ff_MPV_encode_picture,
+ .close = ff_MPV_encode_end,
+ .supported_framerates = ff_mpeg12_frame_rate_tab + 1,
+ .pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_YUV420P,
+ AV_PIX_FMT_NONE },
+ .capabilities = CODEC_CAP_DELAY | CODEC_CAP_SLICE_THREADS,
+ .long_name = NULL_IF_CONFIG_SMALL("MPEG-1 video"),
+ .priv_class = &mpeg1_class,
};
AVCodec ff_mpeg2video_encoder = {
- .name = "mpeg2video",
- .type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_MPEG2VIDEO,
- .priv_data_size = sizeof(MpegEncContext),
- .init = encode_init,
- .encode = MPV_encode_picture,
- .close = MPV_encode_end,
- .supported_framerates= avpriv_frame_rate_tab+1,
- .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_YUV422P, PIX_FMT_NONE},
- .capabilities= CODEC_CAP_DELAY | CODEC_CAP_SLICE_THREADS,
- .long_name= NULL_IF_CONFIG_SMALL("MPEG-2 video"),
- .priv_class = &mpeg2_class,
+ .name = "mpeg2video",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .id = AV_CODEC_ID_MPEG2VIDEO,
+ .priv_data_size = sizeof(MpegEncContext),
+ .init = encode_init,
+ .encode2 = ff_MPV_encode_picture,
+ .close = ff_MPV_encode_end,
+ .supported_framerates = ff_mpeg12_frame_rate_tab + 1,
+ .pix_fmts = (const enum AVPixelFormat[]){
+ AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV422P, AV_PIX_FMT_NONE
+ },
+ .capabilities = CODEC_CAP_DELAY | CODEC_CAP_SLICE_THREADS,
+ .long_name = NULL_IF_CONFIG_SMALL("MPEG-2 video"),
+ .priv_class = &mpeg2_class,
};
diff --git a/gst-libs/ext/libav/libavcodec/mpeg4audio.h b/gst-libs/ext/libav/libavcodec/mpeg4audio.h
index 7560f3f..e71122d 100644
--- a/gst-libs/ext/libav/libavcodec/mpeg4audio.h
+++ b/gst-libs/ext/libav/libavcodec/mpeg4audio.h
@@ -26,7 +26,7 @@
#include "get_bits.h"
#include "put_bits.h"
-typedef struct {
+typedef struct MPEG4AudioConfig {
int object_type;
int sampling_index;
int sample_rate;
@@ -40,7 +40,7 @@ typedef struct {
int ps; ///< -1 implicit, 1 presence
} MPEG4AudioConfig;
-extern const int avpriv_mpeg4audio_sample_rates[16];
+extern av_export const int avpriv_mpeg4audio_sample_rates[16];
extern const uint8_t ff_mpeg4audio_channels[8];
/**
diff --git a/gst-libs/ext/libav/libavcodec/mpeg4data.h b/gst-libs/ext/libav/libavcodec/mpeg4data.h
index 07cbeee..87bb539 100644
--- a/gst-libs/ext/libav/libavcodec/mpeg4data.h
+++ b/gst-libs/ext/libav/libavcodec/mpeg4data.h
@@ -211,7 +211,7 @@ static const int8_t inter_rvlc_level[169]={
1, 1,
};
-RLTable rvlc_rl_inter = {
+RLTable ff_rvlc_rl_inter = {
169,
103,
inter_rvlc,
@@ -315,7 +315,7 @@ static const int8_t intra_rvlc_level[169]={
1, 1,
};
-RLTable rvlc_rl_intra = {
+RLTable ff_rvlc_rl_intra = {
169,
103,
intra_rvlc,
@@ -323,13 +323,13 @@ RLTable rvlc_rl_intra = {
intra_rvlc_level,
};
-const uint16_t sprite_trajectory_tab[15][2] = {
+const uint16_t ff_sprite_trajectory_tab[15][2] = {
{0x00, 2}, {0x02, 3}, {0x03, 3}, {0x04, 3}, {0x05, 3}, {0x06, 3},
{0x0E, 4}, {0x1E, 5}, {0x3E, 6}, {0x7E, 7}, {0xFE, 8},
{0x1FE, 9},{0x3FE, 10},{0x7FE, 11},{0xFFE, 12},
};
-const uint8_t mb_type_b_tab[4][2] = {
+const uint8_t ff_mb_type_b_tab[4][2] = {
{1, 1}, {1, 2}, {1, 3}, {1, 4},
};
@@ -369,7 +369,7 @@ const uint16_t ff_mpeg4_resync_prefix[8]={
0x7F00, 0x7E00, 0x7C00, 0x7800, 0x7000, 0x6000, 0x4000, 0x0000
};
-const uint8_t mpeg4_dc_threshold[8]={
+const uint8_t ff_mpeg4_dc_threshold[8]={
99, 13, 15, 17, 19, 21, 23, 0
};
diff --git a/gst-libs/ext/libav/libavcodec/mpeg4video.c b/gst-libs/ext/libav/libavcodec/mpeg4video.c
index 130e9b2..d7c928d 100644
--- a/gst-libs/ext/libav/libavcodec/mpeg4video.c
+++ b/gst-libs/ext/libav/libavcodec/mpeg4video.c
@@ -168,4 +168,3 @@ int ff_mpeg4_set_direct_mv(MpegEncContext *s, int mx, int my){
return MB_TYPE_DIRECT2 | MB_TYPE_16x16 | MB_TYPE_L0L1; //Note see prev line
}
}
-
diff --git a/gst-libs/ext/libav/libavcodec/mpeg4video.h b/gst-libs/ext/libav/libavcodec/mpeg4video.h
index ba67c21..64c0243 100644
--- a/gst-libs/ext/libav/libavcodec/mpeg4video.h
+++ b/gst-libs/ext/libav/libavcodec/mpeg4video.h
@@ -66,11 +66,11 @@ extern const uint16_t ff_mpeg4_intra_vlc[103][2];
extern RLTable ff_mpeg4_rl_intra;
/* Note this is identical to the intra rvlc except that it is reordered. */
-extern RLTable rvlc_rl_inter;
-extern RLTable rvlc_rl_intra;
+extern RLTable ff_rvlc_rl_inter;
+extern RLTable ff_rvlc_rl_intra;
-extern const uint16_t sprite_trajectory_tab[15][2];
-extern const uint8_t mb_type_b_tab[4][2];
+extern const uint16_t ff_sprite_trajectory_tab[15][2];
+extern const uint8_t ff_mb_type_b_tab[4][2];
/* these matrixes will be permuted for the idct */
extern const int16_t ff_mpeg4_default_intra_matrix[64];
@@ -80,15 +80,15 @@ extern const uint8_t ff_mpeg4_y_dc_scale_table[32];
extern const uint8_t ff_mpeg4_c_dc_scale_table[32];
extern const uint16_t ff_mpeg4_resync_prefix[8];
-extern const uint8_t mpeg4_dc_threshold[8];
+extern const uint8_t ff_mpeg4_dc_threshold[8];
-void mpeg4_encode_mb(MpegEncContext *s,
- DCTELEM block[6][64],
- int motion_x, int motion_y);
-void mpeg4_pred_ac(MpegEncContext * s, DCTELEM *block, int n,
- int dir);
+void ff_mpeg4_encode_mb(MpegEncContext *s,
+ DCTELEM block[6][64],
+ int motion_x, int motion_y);
+void ff_mpeg4_pred_ac(MpegEncContext * s, DCTELEM *block, int n,
+ int dir);
void ff_set_mpeg4_time(MpegEncContext * s);
-void mpeg4_encode_picture_header(MpegEncContext *s, int picture_number);
+void ff_mpeg4_encode_picture_header(MpegEncContext *s, int picture_number);
int ff_mpeg4_decode_picture_header(MpegEncContext * s, GetBitContext *gb);
void ff_mpeg4_encode_video_packet_header(MpegEncContext *s);
@@ -99,7 +99,7 @@ void ff_mpeg4_merge_partitions(MpegEncContext *s);
void ff_clean_mpeg4_qscales(MpegEncContext *s);
int ff_mpeg4_decode_partitions(MpegEncContext *s);
int ff_mpeg4_get_video_packet_prefix_length(MpegEncContext *s);
-int mpeg4_decode_video_packet_header(MpegEncContext *s);
+int ff_mpeg4_decode_video_packet_header(MpegEncContext *s);
void ff_mpeg4_init_direct_mv(MpegEncContext *s);
/**
diff --git a/gst-libs/ext/libav/libavcodec/mpeg4video_parser.c b/gst-libs/ext/libav/libavcodec/mpeg4video_parser.c
index 89bbf34..e291262 100644
--- a/gst-libs/ext/libav/libavcodec/mpeg4video_parser.c
+++ b/gst-libs/ext/libav/libavcodec/mpeg4video_parser.c
@@ -25,6 +25,11 @@
#include "mpeg4video.h"
#include "mpeg4video_parser.h"
+struct Mp4vParseContext {
+ ParseContext pc;
+ struct MpegEncContext enc;
+ int first_picture;
+};
int ff_mpeg4_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size){
int vop_found, i;
@@ -68,8 +73,8 @@ static int av_mpeg4_decode_header(AVCodecParserContext *s1,
AVCodecContext *avctx,
const uint8_t *buf, int buf_size)
{
- ParseContext1 *pc = s1->priv_data;
- MpegEncContext *s = pc->enc;
+ struct Mp4vParseContext *pc = s1->priv_data;
+ MpegEncContext *s = &pc->enc;
GetBitContext gb1, *gb = &gb1;
int ret;
@@ -93,13 +98,10 @@ static int av_mpeg4_decode_header(AVCodecParserContext *s1,
static av_cold int mpeg4video_parse_init(AVCodecParserContext *s)
{
- ParseContext1 *pc = s->priv_data;
+ struct Mp4vParseContext *pc = s->priv_data;
- pc->enc = av_mallocz(sizeof(MpegEncContext));
- if (!pc->enc)
- return -1;
pc->first_picture = 1;
- pc->enc->slice_context_count = 1;
+ pc->enc.slice_context_count = 1;
return 0;
}
@@ -131,10 +133,10 @@ static int mpeg4video_parse(AVCodecParserContext *s,
AVCodecParser ff_mpeg4video_parser = {
- .codec_ids = { CODEC_ID_MPEG4 },
- .priv_data_size = sizeof(ParseContext1),
+ .codec_ids = { AV_CODEC_ID_MPEG4 },
+ .priv_data_size = sizeof(struct Mp4vParseContext),
.parser_init = mpeg4video_parse_init,
.parser_parse = mpeg4video_parse,
- .parser_close = ff_parse1_close,
+ .parser_close = ff_parse_close,
.split = ff_mpeg4video_split,
};
diff --git a/gst-libs/ext/libav/libavcodec/mpeg4videodec.c b/gst-libs/ext/libav/libavcodec/mpeg4videodec.c
index b243a23..faa9866 100644
--- a/gst-libs/ext/libav/libavcodec/mpeg4videodec.c
+++ b/gst-libs/ext/libav/libavcodec/mpeg4videodec.c
@@ -50,8 +50,8 @@ static const int mb_type_b_map[4]= {
* @param n block index (0-3 are luma, 4-5 are chroma)
* @param dir the ac prediction direction
*/
-void mpeg4_pred_ac(MpegEncContext * s, DCTELEM *block, int n,
- int dir)
+void ff_mpeg4_pred_ac(MpegEncContext * s, DCTELEM *block, int n,
+ int dir)
{
int i;
int16_t *ac_val, *ac_val1;
@@ -346,7 +346,7 @@ static void mpeg4_decode_sprite_trajectory(MpegEncContext * s, GetBitContext *gb
* Decode the next video packet.
* @return <0 if something went wrong
*/
-int mpeg4_decode_video_packet_header(MpegEncContext *s)
+int ff_mpeg4_decode_video_packet_header(MpegEncContext *s)
{
int mb_num_bits= av_log2(s->mb_num - 1) + 1;
int header_extension=0, mb_num, len;
@@ -377,7 +377,8 @@ int mpeg4_decode_video_packet_header(MpegEncContext *s)
int mb_x = 0, mb_y = 0;
while (s->next_picture.f.mbskip_table[s->mb_index2xy[mb_num]]) {
- if (!mb_x) ff_thread_await_progress((AVFrame*)s->next_picture_ptr, mb_y++, 0);
+ if (!mb_x)
+ ff_thread_await_progress(&s->next_picture_ptr->f, mb_y++, 0);
mb_num++;
if (++mb_x == s->mb_width) mb_x = 0;
}
@@ -875,8 +876,8 @@ static inline int mpeg4_decode_block(MpegEncContext * s, DCTELEM * block,
goto not_coded;
if(rvlc){
- rl = &rvlc_rl_intra;
- rl_vlc = rvlc_rl_intra.rl_vlc[0];
+ rl = &ff_rvlc_rl_intra;
+ rl_vlc = ff_rvlc_rl_intra.rl_vlc[0];
}else{
rl = &ff_mpeg4_rl_intra;
rl_vlc = ff_mpeg4_rl_intra.rl_vlc[0];
@@ -897,7 +898,7 @@ static inline int mpeg4_decode_block(MpegEncContext * s, DCTELEM * block,
s->block_last_index[n] = i;
return 0;
}
- if(rvlc) rl = &rvlc_rl_inter;
+ if(rvlc) rl = &ff_rvlc_rl_inter;
else rl = &ff_h263_rl_inter;
scan_table = s->intra_scantable.permutated;
@@ -906,7 +907,7 @@ static inline int mpeg4_decode_block(MpegEncContext * s, DCTELEM * block,
qmul=1;
qadd=0;
if(rvlc){
- rl_vlc = rvlc_rl_inter.rl_vlc[0];
+ rl_vlc = ff_rvlc_rl_inter.rl_vlc[0];
}else{
rl_vlc = ff_h263_rl_inter.rl_vlc[0];
}
@@ -914,7 +915,7 @@ static inline int mpeg4_decode_block(MpegEncContext * s, DCTELEM * block,
qmul = s->qscale << 1;
qadd = (s->qscale - 1) | 1;
if(rvlc){
- rl_vlc = rvlc_rl_inter.rl_vlc[s->qscale];
+ rl_vlc = ff_rvlc_rl_inter.rl_vlc[s->qscale];
}else{
rl_vlc = ff_h263_rl_inter.rl_vlc[s->qscale];
}
@@ -1051,7 +1052,7 @@ static inline int mpeg4_decode_block(MpegEncContext * s, DCTELEM * block,
i -= i>>31; //if(i == -1) i=0;
}
- mpeg4_pred_ac(s, block, n, dc_pred_dir);
+ ff_mpeg4_pred_ac(s, block, n, dc_pred_dir);
if (s->ac_pred) {
i = 63; /* XXX: not optimal */
}
@@ -1288,7 +1289,7 @@ static int mpeg4_decode_mb(MpegEncContext *s,
s->last_mv[i][1][1]= 0;
}
- ff_thread_await_progress((AVFrame*)s->next_picture_ptr, s->mb_y, 0);
+ ff_thread_await_progress(&s->next_picture_ptr->f, s->mb_y, 0);
}
/* if we skipped it in the future P Frame than skip it now too */
@@ -1465,12 +1466,12 @@ intra:
end:
/* per-MB end of slice check */
- if(s->codec_id==CODEC_ID_MPEG4){
+ if(s->codec_id==AV_CODEC_ID_MPEG4){
if(mpeg4_is_resync(s)){
const int delta= s->mb_x + 1 == s->mb_width ? 2 : 1;
if (s->pict_type == AV_PICTURE_TYPE_B && s->next_picture.f.mbskip_table[xy + delta]) {
- ff_thread_await_progress((AVFrame*)s->next_picture_ptr,
+ ff_thread_await_progress(&s->next_picture_ptr->f,
(s->mb_x + delta >= s->mb_width) ? FFMIN(s->mb_y+1, s->mb_height-1) : s->mb_y, 0);
}
@@ -1599,6 +1600,9 @@ static int decode_vol_header(MpegEncContext *s, GetBitContext *gb){
height = get_bits(gb, 13);
skip_bits1(gb); /* marker */
if(width && height && !(s->width && s->codec_tag == AV_RL32("MP4S"))){ /* they should be non zero but who knows ... */
+ if (s->width && s->height &&
+ (s->width != width || s->height != height))
+ s->context_reinit = 1;
s->width = width;
s->height = height;
}
@@ -2004,7 +2008,7 @@ static int decode_vop_header(MpegEncContext *s, GetBitContext *gb){
if(s->pict_type == AV_PICTURE_TYPE_B)
skip_bits_long(gb, s->cplx_estimation_trash_b);
- s->intra_dc_threshold= mpeg4_dc_threshold[ get_bits(gb, 3) ];
+ s->intra_dc_threshold= ff_mpeg4_dc_threshold[ get_bits(gb, 3) ];
if(!s->progressive_sequence){
s->top_field_first= get_bits1(gb);
s->alternate_scan= get_bits1(gb);
@@ -2206,11 +2210,11 @@ static av_cold int decode_init(AVCodecContext *avctx)
done = 1;
ff_init_rl(&ff_mpeg4_rl_intra, ff_mpeg4_static_rl_table_store[0]);
- ff_init_rl(&rvlc_rl_inter, ff_mpeg4_static_rl_table_store[1]);
- ff_init_rl(&rvlc_rl_intra, ff_mpeg4_static_rl_table_store[2]);
+ ff_init_rl(&ff_rvlc_rl_inter, ff_mpeg4_static_rl_table_store[1]);
+ ff_init_rl(&ff_rvlc_rl_intra, ff_mpeg4_static_rl_table_store[2]);
INIT_VLC_RL(ff_mpeg4_rl_intra, 554);
- INIT_VLC_RL(rvlc_rl_inter, 1072);
- INIT_VLC_RL(rvlc_rl_intra, 1072);
+ INIT_VLC_RL(ff_rvlc_rl_inter, 1072);
+ INIT_VLC_RL(ff_rvlc_rl_intra, 1072);
INIT_VLC_STATIC(&dc_lum, DC_VLC_BITS, 10 /* 13 */,
&ff_mpeg4_DCtab_lum[0][1], 2, 1,
&ff_mpeg4_DCtab_lum[0][0], 2, 1, 512);
@@ -2218,11 +2222,11 @@ static av_cold int decode_init(AVCodecContext *avctx)
&ff_mpeg4_DCtab_chrom[0][1], 2, 1,
&ff_mpeg4_DCtab_chrom[0][0], 2, 1, 512);
INIT_VLC_STATIC(&sprite_trajectory, SPRITE_TRAJ_VLC_BITS, 15,
- &sprite_trajectory_tab[0][1], 4, 2,
- &sprite_trajectory_tab[0][0], 4, 2, 128);
+ &ff_sprite_trajectory_tab[0][1], 4, 2,
+ &ff_sprite_trajectory_tab[0][0], 4, 2, 128);
INIT_VLC_STATIC(&mb_type_b_vlc, MB_TYPE_B_VLC_BITS, 4,
- &mb_type_b_tab[0][1], 2, 1,
- &mb_type_b_tab[0][0], 2, 1, 16);
+ &ff_mb_type_b_tab[0][1], 2, 1,
+ &ff_mb_type_b_tab[0][0], 2, 1, 16);
}
s->h263_pred = 1;
@@ -2254,20 +2258,21 @@ static const AVProfile mpeg4_video_profiles[] = {
};
AVCodec ff_mpeg4_decoder = {
- .name = "mpeg4",
- .type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_MPEG4,
- .priv_data_size = sizeof(MpegEncContext),
- .init = decode_init,
- .close = ff_h263_decode_end,
- .decode = ff_h263_decode_frame,
- .capabilities = CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1 | CODEC_CAP_TRUNCATED | CODEC_CAP_DELAY | CODEC_CAP_FRAME_THREADS,
- .flush= ff_mpeg_flush,
- .max_lowres= 3,
- .long_name= NULL_IF_CONFIG_SMALL("MPEG-4 part 2"),
- .pix_fmts= ff_hwaccel_pixfmt_list_420,
- .profiles = NULL_IF_CONFIG_SMALL(mpeg4_video_profiles),
- .update_thread_context= ONLY_IF_THREADS_ENABLED(ff_mpeg_update_thread_context)
+ .name = "mpeg4",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .id = AV_CODEC_ID_MPEG4,
+ .priv_data_size = sizeof(MpegEncContext),
+ .init = decode_init,
+ .close = ff_h263_decode_end,
+ .decode = ff_h263_decode_frame,
+ .capabilities = CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1 |
+ CODEC_CAP_TRUNCATED | CODEC_CAP_DELAY |
+ CODEC_CAP_FRAME_THREADS,
+ .flush = ff_mpeg_flush,
+ .long_name = NULL_IF_CONFIG_SMALL("MPEG-4 part 2"),
+ .pix_fmts = ff_hwaccel_pixfmt_list_420,
+ .profiles = NULL_IF_CONFIG_SMALL(mpeg4_video_profiles),
+ .update_thread_context = ONLY_IF_THREADS_ENABLED(ff_mpeg_update_thread_context),
};
@@ -2275,13 +2280,15 @@ AVCodec ff_mpeg4_decoder = {
AVCodec ff_mpeg4_vdpau_decoder = {
.name = "mpeg4_vdpau",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_MPEG4,
+ .id = AV_CODEC_ID_MPEG4,
.priv_data_size = sizeof(MpegEncContext),
.init = decode_init,
.close = ff_h263_decode_end,
.decode = ff_h263_decode_frame,
- .capabilities = CODEC_CAP_DR1 | CODEC_CAP_TRUNCATED | CODEC_CAP_DELAY | CODEC_CAP_HWACCEL_VDPAU,
- .long_name= NULL_IF_CONFIG_SMALL("MPEG-4 part 2 (VDPAU)"),
- .pix_fmts= (const enum PixelFormat[]){PIX_FMT_VDPAU_MPEG4, PIX_FMT_NONE},
+ .capabilities = CODEC_CAP_DR1 | CODEC_CAP_TRUNCATED | CODEC_CAP_DELAY |
+ CODEC_CAP_HWACCEL_VDPAU,
+ .long_name = NULL_IF_CONFIG_SMALL("MPEG-4 part 2 (VDPAU)"),
+ .pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_VDPAU_MPEG4,
+ AV_PIX_FMT_NONE },
};
#endif
diff --git a/gst-libs/ext/libav/libavcodec/mpeg4videoenc.c b/gst-libs/ext/libav/libavcodec/mpeg4videoenc.c
index b7c2da7..986cba6 100644
--- a/gst-libs/ext/libav/libavcodec/mpeg4videoenc.c
+++ b/gst-libs/ext/libav/libavcodec/mpeg4videoenc.c
@@ -89,7 +89,7 @@ static inline int get_block_rate(MpegEncContext * s, DCTELEM block[64], int bloc
* @param[in,out] block MB coefficients, these will be restored
* @param[in] dir ac prediction direction for each 8x8 block
* @param[out] st scantable for each 8x8 block
- * @param[in] zigzag_last_index index refering to the last non zero coefficient in zigzag order
+ * @param[in] zigzag_last_index index referring to the last non zero coefficient in zigzag order
*/
static inline void restore_ac_coeffs(MpegEncContext * s, DCTELEM block[6][64], const int dir[6], uint8_t *st[6], const int zigzag_last_index[6])
{
@@ -120,7 +120,7 @@ static inline void restore_ac_coeffs(MpegEncContext * s, DCTELEM block[6][64], c
* @param[in,out] block MB coefficients, these will be updated if 1 is returned
* @param[in] dir ac prediction direction for each 8x8 block
* @param[out] st scantable for each 8x8 block
- * @param[out] zigzag_last_index index refering to the last non zero coefficient in zigzag order
+ * @param[out] zigzag_last_index index referring to the last non zero coefficient in zigzag order
*/
static inline int decide_ac_pred(MpegEncContext * s, DCTELEM block[6][64], const int dir[6], uint8_t *st[6], int zigzag_last_index[6])
{
@@ -430,7 +430,7 @@ static inline int get_b_cbp(MpegEncContext * s, DCTELEM block[6][64],
{
int cbp = 0, i;
- if (s->flags & CODEC_FLAG_CBP_RD) {
+ if (s->mpv_flags & FF_MPV_FLAG_CBP_RD) {
int score = 0;
const int lambda = s->lambda2 >> (FF_LAMBDA_SHIFT - 6);
@@ -468,9 +468,9 @@ static inline int get_b_cbp(MpegEncContext * s, DCTELEM block[6][64],
//FIXME this is duplicated to h263.c
static const int dquant_code[5]= {1,0,9,2,3};
-void mpeg4_encode_mb(MpegEncContext * s,
- DCTELEM block[6][64],
- int motion_x, int motion_y)
+void ff_mpeg4_encode_mb(MpegEncContext * s,
+ DCTELEM block[6][64],
+ int motion_x, int motion_y)
{
int cbpc, cbpy, pred_x, pred_y;
PutBitContext * const pb2 = s->data_partitioning ? &s->pb2 : &s->pb;
@@ -1022,12 +1022,12 @@ static void mpeg4_encode_vol_header(MpegEncContext * s, int vo_number, int vol_n
if(!(s->flags & CODEC_FLAG_BITEXACT)){
put_bits(&s->pb, 16, 0);
put_bits(&s->pb, 16, 0x1B2); /* user_data */
- ff_put_string(&s->pb, LIBAVCODEC_IDENT, 0);
+ avpriv_put_string(&s->pb, LIBAVCODEC_IDENT, 0);
}
}
/* write mpeg4 VOP header */
-void mpeg4_encode_picture_header(MpegEncContext * s, int picture_number)
+void ff_mpeg4_encode_picture_header(MpegEncContext * s, int picture_number)
{
int time_incr;
int time_div, time_mod;
@@ -1222,7 +1222,7 @@ static av_cold int encode_init(AVCodecContext *avctx)
int ret;
static int done = 0;
- if((ret=MPV_encode_init(avctx)) < 0)
+ if((ret=ff_MPV_encode_init(avctx)) < 0)
return ret;
if (!done) {
@@ -1318,8 +1318,9 @@ 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), AV_OPT_TYPE_INT, { 0 }, 0, 1, VE },
- { "alternate_scan", "Enable alternate scantable.", OFFSET(alternate_scan), AV_OPT_TYPE_INT, { 0 }, 0, 1, VE },
+ { "data_partitioning", "Use data partitioning.", OFFSET(data_partitioning), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, VE },
+ { "alternate_scan", "Enable alternate scantable.", OFFSET(alternate_scan), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, VE },
+ FF_MPV_COMMON_OPTS
{ NULL },
};
@@ -1333,13 +1334,13 @@ static const AVClass mpeg4enc_class = {
AVCodec ff_mpeg4_encoder = {
.name = "mpeg4",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_MPEG4,
+ .id = AV_CODEC_ID_MPEG4,
.priv_data_size = sizeof(MpegEncContext),
.init = encode_init,
- .encode = MPV_encode_picture,
- .close = MPV_encode_end,
- .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE},
- .capabilities= CODEC_CAP_DELAY | CODEC_CAP_SLICE_THREADS,
- .long_name= NULL_IF_CONFIG_SMALL("MPEG-4 part 2"),
+ .encode2 = ff_MPV_encode_picture,
+ .close = ff_MPV_encode_end,
+ .pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_YUV420P, AV_PIX_FMT_NONE },
+ .capabilities = CODEC_CAP_DELAY | CODEC_CAP_SLICE_THREADS,
+ .long_name = NULL_IF_CONFIG_SMALL("MPEG-4 part 2"),
.priv_class = &mpeg4enc_class,
};
diff --git a/gst-libs/ext/libav/libavcodec/mpegaudio_parser.c b/gst-libs/ext/libav/libavcodec/mpegaudio_parser.c
index c6d670d..58ea452 100644
--- a/gst-libs/ext/libav/libavcodec/mpegaudio_parser.c
+++ b/gst-libs/ext/libav/libavcodec/mpegaudio_parser.c
@@ -22,6 +22,7 @@
#include "parser.h"
#include "mpegaudiodecheader.h"
+#include "libavutil/common.h"
typedef struct MpegAudioParseContext {
@@ -29,6 +30,7 @@ typedef struct MpegAudioParseContext {
int frame_size;
uint32_t header;
int header_count;
+ int no_bitrate;
} MpegAudioParseContext;
#define MPA_HEADER_SIZE 4
@@ -66,7 +68,8 @@ static int mpegaudio_parse(AVCodecParserContext *s1,
ret = avpriv_mpa_decode_header(avctx, state, &sr, &channels, &frame_size, &bit_rate);
if (ret < 4) {
- s->header_count= -2;
+ if (i > 4)
+ s->header_count = -2;
} else {
if((state&SAME_HEADER_MASK) != (s->header&SAME_HEADER_MASK) && s->header)
s->header_count= -3;
@@ -74,11 +77,14 @@ static int mpegaudio_parse(AVCodecParserContext *s1,
s->header_count++;
s->frame_size = ret-4;
- if(s->header_count > 1){
+ if (s->header_count > 0) {
avctx->sample_rate= sr;
avctx->channels = channels;
- avctx->frame_size = frame_size;
- avctx->bit_rate = bit_rate;
+ s1->duration = frame_size;
+ if (s->no_bitrate || !avctx->bit_rate) {
+ s->no_bitrate = 1;
+ avctx->bit_rate += (bit_rate - avctx->bit_rate) / s->header_count;
+ }
}
break;
}
@@ -100,7 +106,7 @@ static int mpegaudio_parse(AVCodecParserContext *s1,
AVCodecParser ff_mpegaudio_parser = {
- .codec_ids = { CODEC_ID_MP1, CODEC_ID_MP2, CODEC_ID_MP3 },
+ .codec_ids = { AV_CODEC_ID_MP1, AV_CODEC_ID_MP2, AV_CODEC_ID_MP3 },
.priv_data_size = sizeof(MpegAudioParseContext),
.parser_parse = mpegaudio_parse,
.parser_close = ff_parse_close,
diff --git a/gst-libs/ext/libav/libavcodec/mpegaudiodata.c b/gst-libs/ext/libav/libavcodec/mpegaudiodata.c
index 81a4365..009a02a 100644
--- a/gst-libs/ext/libav/libavcodec/mpegaudiodata.c
+++ b/gst-libs/ext/libav/libavcodec/mpegaudiodata.c
@@ -40,44 +40,6 @@ const uint16_t avpriv_mpa_bitrate_tab[2][3][15] = {
const uint16_t avpriv_mpa_freq_tab[3] = { 44100, 48000, 32000 };
/*******************************************************/
-/* half mpeg encoding window (full precision) */
-const int32_t ff_mpa_enwindow[257] = {
- 0, -1, -1, -1, -1, -1, -1, -2,
- -2, -2, -2, -3, -3, -4, -4, -5,
- -5, -6, -7, -7, -8, -9, -10, -11,
- -13, -14, -16, -17, -19, -21, -24, -26,
- -29, -31, -35, -38, -41, -45, -49, -53,
- -58, -63, -68, -73, -79, -85, -91, -97,
- -104, -111, -117, -125, -132, -139, -147, -154,
- -161, -169, -176, -183, -190, -196, -202, -208,
- 213, 218, 222, 225, 227, 228, 228, 227,
- 224, 221, 215, 208, 200, 189, 177, 163,
- 146, 127, 106, 83, 57, 29, -2, -36,
- -72, -111, -153, -197, -244, -294, -347, -401,
- -459, -519, -581, -645, -711, -779, -848, -919,
- -991, -1064, -1137, -1210, -1283, -1356, -1428, -1498,
- -1567, -1634, -1698, -1759, -1817, -1870, -1919, -1962,
- -2001, -2032, -2057, -2075, -2085, -2087, -2080, -2063,
- 2037, 2000, 1952, 1893, 1822, 1739, 1644, 1535,
- 1414, 1280, 1131, 970, 794, 605, 402, 185,
- -45, -288, -545, -814, -1095, -1388, -1692, -2006,
- -2330, -2663, -3004, -3351, -3705, -4063, -4425, -4788,
- -5153, -5517, -5879, -6237, -6589, -6935, -7271, -7597,
- -7910, -8209, -8491, -8755, -8998, -9219, -9416, -9585,
- -9727, -9838, -9916, -9959, -9966, -9935, -9863, -9750,
- -9592, -9389, -9139, -8840, -8492, -8092, -7640, -7134,
- 6574, 5959, 5288, 4561, 3776, 2935, 2037, 1082,
- 70, -998, -2122, -3300, -4533, -5818, -7154, -8540,
- -9975,-11455,-12980,-14548,-16155,-17799,-19478,-21189,
--22929,-24694,-26482,-28289,-30112,-31947,-33791,-35640,
--37489,-39336,-41176,-43006,-44821,-46617,-48390,-50137,
--51853,-53534,-55178,-56778,-58333,-59838,-61289,-62684,
--64019,-65290,-66494,-67629,-68692,-69679,-70590,-71420,
--72169,-72835,-73415,-73908,-74313,-74630,-74856,-74992,
- 75038,
-};
-
-/*******************************************************/
/* layer 2 tables */
const int ff_mpa_sblimit_table[5] = { 27 , 30 , 8, 12 , 30 };
diff --git a/gst-libs/ext/libav/libavcodec/mpegaudiodata.h b/gst-libs/ext/libav/libavcodec/mpegaudiodata.h
index 24ea536..2b8ff65 100644
--- a/gst-libs/ext/libav/libavcodec/mpegaudiodata.h
+++ b/gst-libs/ext/libav/libavcodec/mpegaudiodata.h
@@ -29,12 +29,13 @@
#include <stdint.h>
+#include "libavutil/internal.h"
+
#define MODE_EXT_MS_STEREO 2
#define MODE_EXT_I_STEREO 1
-extern const uint16_t avpriv_mpa_bitrate_tab[2][3][15];
-extern const uint16_t avpriv_mpa_freq_tab[3];
-extern const int32_t ff_mpa_enwindow[257];
+extern av_export const uint16_t avpriv_mpa_bitrate_tab[2][3][15];
+extern av_export const uint16_t avpriv_mpa_freq_tab[3];
extern const int ff_mpa_sblimit_table[5];
extern const int ff_mpa_quant_steps[17];
extern const int ff_mpa_quant_bits[17];
diff --git a/gst-libs/ext/libav/libavcodec/mpegaudiodec.c b/gst-libs/ext/libav/libavcodec/mpegaudiodec.c
index adb25ff..fda0280 100644
--- a/gst-libs/ext/libav/libavcodec/mpegaudiodec.c
+++ b/gst-libs/ext/libav/libavcodec/mpegaudiodec.c
@@ -24,11 +24,13 @@
* MPEG Audio decoder
*/
-#include "libavutil/audioconvert.h"
+#include "libavutil/channel_layout.h"
#include "avcodec.h"
#include "get_bits.h"
+#include "internal.h"
#include "mathops.h"
#include "mpegaudiodsp.h"
+#include "dsputil.h"
/*
* TODO:
@@ -80,6 +82,7 @@ typedef struct MPADecodeContext {
int err_recognition;
AVCodecContext* avctx;
MPADSPContext mpadsp;
+ DSPContext dsp;
AVFrame frame;
} MPADecodeContext;
@@ -91,7 +94,8 @@ typedef struct MPADecodeContext {
# define MULH3(x, y, s) ((s)*(y)*(x))
# define MULLx(x, y, s) ((y)*(x))
# define RENAME(a) a ## _float
-# define OUT_FMT AV_SAMPLE_FMT_FLT
+# define OUT_FMT AV_SAMPLE_FMT_FLT
+# define OUT_FMT_P AV_SAMPLE_FMT_FLTP
#else
# define SHR(a,b) ((a)>>(b))
/* WARNING: only correct for positive numbers */
@@ -101,7 +105,8 @@ typedef struct MPADecodeContext {
# define MULH3(x, y, s) MULH((s)*(x), y)
# define MULLx(x, y, s) MULL(x,y,s)
# define RENAME(a) a ## _fixed
-# define OUT_FMT AV_SAMPLE_FMT_S16
+# define OUT_FMT AV_SAMPLE_FMT_S16
+# define OUT_FMT_P AV_SAMPLE_FMT_S16P
#endif
/****************/
@@ -172,9 +177,12 @@ static void ff_region_offset2size(GranuleDef *g)
static void ff_init_short_region(MPADecodeContext *s, GranuleDef *g)
{
- if (g->block_type == 2)
- g->region_size[0] = (36 / 2);
- else {
+ if (g->block_type == 2) {
+ if (s->sample_rate_index != 8)
+ g->region_size[0] = (36 / 2);
+ else
+ g->region_size[0] = (72 / 2);
+ } else {
if (s->sample_rate_index <= 2)
g->region_size[0] = (36 / 2);
else if (s->sample_rate_index != 8)
@@ -199,14 +207,12 @@ static void ff_compute_band_indexes(MPADecodeContext *s, GranuleDef *g)
if (g->block_type == 2) {
if (g->switch_point) {
/* if switched mode, we handle the 36 first samples as
- long blocks. For 8000Hz, we handle the 48 first
- exponents as long blocks (XXX: check this!) */
+ long blocks. For 8000Hz, we handle the 72 first
+ exponents as long blocks */
if (s->sample_rate_index <= 2)
g->long_end = 8;
- else if (s->sample_rate_index != 8)
- g->long_end = 6;
else
- g->long_end = 4; /* 8000 Hz */
+ g->long_end = 6;
g->short_start = 3;
} else {
@@ -302,11 +308,8 @@ static av_cold void decode_init_static(void)
for (i = 1; i < 16; i++) {
const HuffTable *h = &mpa_huff_tables[i];
int xsize, x, y;
- uint8_t tmp_bits [512];
- uint16_t tmp_codes[512];
-
- memset(tmp_bits , 0, sizeof(tmp_bits ));
- memset(tmp_codes, 0, sizeof(tmp_codes));
+ uint8_t tmp_bits [512] = { 0 };
+ uint16_t tmp_codes[512] = { 0 };
xsize = h->xsize;
@@ -432,11 +435,16 @@ static av_cold int decode_init(AVCodecContext * avctx)
s->avctx = avctx;
ff_mpadsp_init(&s->mpadsp);
+ ff_dsputil_init(&s->dsp, avctx);
- avctx->sample_fmt= OUT_FMT;
+ if (avctx->request_sample_fmt == OUT_FMT &&
+ avctx->codec_id != AV_CODEC_ID_MP3ON4)
+ avctx->sample_fmt = OUT_FMT;
+ else
+ avctx->sample_fmt = OUT_FMT_P;
s->err_recognition = avctx->err_recognition;
- if (avctx->codec_id == CODEC_ID_MP3ADU)
+ if (avctx->codec_id == AV_CODEC_ID_MP3ADU)
s->adu_mode = 1;
avcodec_get_frame_defaults(&s->frame);
@@ -884,9 +892,7 @@ static int huffman_decode(MPADecodeContext *s, GranuleDef *g,
int pos = get_bits_count(&s->gb);
if (pos >= end_pos){
-// av_log(NULL, AV_LOG_ERROR, "pos: %d %d %d %d\n", pos, end_pos, end_pos2, s_index);
switch_buffer(s, &pos, &end_pos, &end_pos2);
-// av_log(NULL, AV_LOG_ERROR, "new pos: %d %d\n", pos, end_pos);
if (pos >= end_pos)
break;
}
@@ -960,9 +966,7 @@ static int huffman_decode(MPADecodeContext *s, GranuleDef *g,
s_index=0;
break;
}
-// av_log(NULL, AV_LOG_ERROR, "pos2: %d %d %d %d\n", pos, end_pos, end_pos2, s_index);
switch_buffer(s, &pos, &end_pos, &end_pos2);
-// av_log(NULL, AV_LOG_ERROR, "new pos2: %d %d %d\n", pos, end_pos, s_index);
if (pos >= end_pos)
break;
}
@@ -985,7 +989,6 @@ static int huffman_decode(MPADecodeContext *s, GranuleDef *g,
}
/* skip extension bits */
bits_left = end_pos2 - get_bits_count(&s->gb);
-//av_log(NULL, AV_LOG_ERROR, "left:%d buf:%p\n", bits_left, s->in_gb.buffer);
if (bits_left < 0 && (s->err_recognition & AV_EF_BUFFER)) {
av_log(s->avctx, AV_LOG_ERROR, "bits_left=%d\n", bits_left);
s_index=0;
@@ -1018,7 +1021,7 @@ static void reorder_block(MPADecodeContext *s, GranuleDef *g)
if (s->sample_rate_index != 8)
ptr = g->sb_hybrid + 36;
else
- ptr = g->sb_hybrid + 48;
+ ptr = g->sb_hybrid + 72;
} else {
ptr = g->sb_hybrid;
}
@@ -1153,6 +1156,9 @@ found2:
/* ms stereo ONLY */
/* NOTE: the 1/sqrt(2) normalization factor is included in the
global gain */
+#if CONFIG_FLOAT
+ s-> dsp.butterflies_float(g0->sb_hybrid, g1->sb_hybrid, 576);
+#else
tab0 = g0->sb_hybrid;
tab1 = g1->sb_hybrid;
for (i = 0; i < 576; i++) {
@@ -1161,6 +1167,7 @@ found2:
tab0[i] = tmp0 + tmp1;
tab1[i] = tmp0 - tmp1;
}
+#endif
}
}
@@ -1383,8 +1390,8 @@ static int mp_decode_layer3(MPADecodeContext *s)
FFMAX(0, LAST_BUF_SIZE - s->last_buf_size));
assert((get_bits_count(&s->gb) & 7) == 0);
/* now we get bits from the main_data_begin offset */
- av_dlog(s->avctx, "seekback: %d\n", main_data_begin);
- //av_log(NULL, AV_LOG_ERROR, "backstep:%d, lastbuf:%d\n", main_data_begin, s->last_buf_size);
+ av_dlog(s->avctx, "seekback:%d, lastbuf:%d\n",
+ main_data_begin, s->last_buf_size);
memcpy(s->last_buf + s->last_buf_size, ptr, extrasize);
s->in_gb = s->gb;
@@ -1398,6 +1405,7 @@ static int mp_decode_layer3(MPADecodeContext *s)
g = &s->granules[ch][gr];
s->last_buf_size += g->part2_3_length;
memset(g->sb_hybrid, 0, sizeof(g->sb_hybrid));
+ compute_imdct(s, g, &s->sb_samples[ch][18 * gr][0], s->mdct_buf[ch]);
}
}
skip = s->last_buf_size - 8 * main_data_begin;
@@ -1529,7 +1537,7 @@ static int mp_decode_layer3(MPADecodeContext *s)
huffman_decode(s, g, exponents, bits_pos + g->part2_3_length);
} /* ch */
- if (s->nb_channels == 2)
+ if (s->mode == MPA_JSTEREO)
compute_stereo(s, &s->granules[0][gr], &s->granules[1][gr]);
for (ch = 0; ch < s->nb_channels; ch++) {
@@ -1545,7 +1553,7 @@ static int mp_decode_layer3(MPADecodeContext *s)
return nb_granules * 18;
}
-static int mp_decode_frame(MPADecodeContext *s, OUT_INT *samples,
+static int mp_decode_frame(MPADecodeContext *s, OUT_INT **samples,
const uint8_t *buf, int buf_size)
{
int i, nb_frames, ch, ret;
@@ -1604,24 +1612,30 @@ static int mp_decode_frame(MPADecodeContext *s, OUT_INT *samples,
/* get output buffer */
if (!samples) {
s->frame.nb_samples = s->avctx->frame_size;
- if ((ret = s->avctx->get_buffer(s->avctx, &s->frame)) < 0) {
+ if ((ret = ff_get_buffer(s->avctx, &s->frame)) < 0) {
av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return ret;
}
- samples = (OUT_INT *)s->frame.data[0];
+ samples = (OUT_INT **)s->frame.extended_data;
}
/* apply the synthesis filter */
for (ch = 0; ch < s->nb_channels; ch++) {
- samples_ptr = samples + ch;
+ int sample_stride;
+ if (s->avctx->sample_fmt == OUT_FMT_P) {
+ samples_ptr = samples[ch];
+ sample_stride = 1;
+ } else {
+ samples_ptr = samples[0] + ch;
+ sample_stride = s->nb_channels;
+ }
for (i = 0; i < nb_frames; i++) {
- RENAME(ff_mpa_synth_filter)(
- &s->mpadsp,
- s->synth_buf[ch], &(s->synth_buf_offset[ch]),
- RENAME(ff_mpa_synth_window), &s->dither_state,
- samples_ptr, s->nb_channels,
- s->sb_samples[ch][i]);
- samples_ptr += 32 * s->nb_channels;
+ RENAME(ff_mpa_synth_filter)(&s->mpadsp, s->synth_buf[ch],
+ &(s->synth_buf_offset[ch]),
+ RENAME(ff_mpa_synth_window),
+ &s->dither_state, samples_ptr,
+ sample_stride, s->sb_samples[ch][i]);
+ samples_ptr += 32 * sample_stride;
}
}
@@ -1656,13 +1670,11 @@ static int decode_frame(AVCodecContext * avctx, void *data, int *got_frame_ptr,
avctx->channel_layout = s->nb_channels == 1 ? AV_CH_LAYOUT_MONO : AV_CH_LAYOUT_STEREO;
if (!avctx->bit_rate)
avctx->bit_rate = s->bit_rate;
- avctx->sub_id = s->layer;
if (s->frame_size <= 0 || s->frame_size > buf_size) {
av_log(avctx, AV_LOG_ERROR, "incomplete frame\n");
return AVERROR_INVALIDDATA;
} else if (s->frame_size < buf_size) {
- av_log(avctx, AV_LOG_ERROR, "incorrect frame size\n");
buf_size= s->frame_size;
}
@@ -1687,11 +1699,15 @@ static int decode_frame(AVCodecContext * avctx, void *data, int *got_frame_ptr,
return buf_size;
}
+static void mp_flush(MPADecodeContext *ctx)
+{
+ memset(ctx->synth_buf, 0, sizeof(ctx->synth_buf));
+ ctx->last_buf_size = 0;
+}
+
static void flush(AVCodecContext *avctx)
{
- MPADecodeContext *s = avctx->priv_data;
- memset(s->synth_buf, 0, sizeof(s->synth_buf));
- s->last_buf_size = 0;
+ mp_flush(avctx->priv_data);
}
#if CONFIG_MP3ADU_DECODER || CONFIG_MP3ADUFLOAT_DECODER
@@ -1702,7 +1718,7 @@ static int decode_frame_adu(AVCodecContext *avctx, void *data,
int buf_size = avpkt->size;
MPADecodeContext *s = avctx->priv_data;
uint32_t header;
- int len, out_size, ret = 0;
+ int len, ret;
len = buf_size;
@@ -1730,15 +1746,9 @@ static int decode_frame_adu(AVCodecContext *avctx, void *data,
avctx->channels = s->nb_channels;
if (!avctx->bit_rate)
avctx->bit_rate = s->bit_rate;
- avctx->sub_id = s->layer;
s->frame_size = len;
-#if FF_API_PARSE_FRAME
- if (avctx->parse_only)
- out_size = buf_size;
- else
-#endif
ret = mp_decode_frame(s, NULL, buf, buf_size);
if (ret < 0) {
av_log(avctx, AV_LOG_ERROR, "Error while decoding MPEG audio frame.\n");
@@ -1763,7 +1773,6 @@ typedef struct MP3On4DecodeContext {
int syncword; ///< syncword patch
const uint8_t *coff; ///< channel offsets in output buffer
MPADecodeContext *mp3decctx[5]; ///< MPADecodeContext for every decoder instance
- OUT_INT *decoded_buf; ///< output buffer for decoded samples
} MP3On4DecodeContext;
#include "mpeg4audio.h"
@@ -1805,8 +1814,6 @@ static av_cold int decode_close_mp3on4(AVCodecContext * avctx)
for (i = 0; i < s->frames; i++)
av_free(s->mp3decctx[i]);
- av_freep(&s->decoded_buf);
-
return 0;
}
@@ -1867,14 +1874,6 @@ static int decode_init_mp3on4(AVCodecContext * avctx)
s->mp3decctx[i]->mpadsp = s->mp3decctx[0]->mpadsp;
}
- /* Allocate buffer for multi-channel output if needed */
- if (s->frames > 1) {
- s->decoded_buf = av_malloc(MPA_FRAME_SIZE * MPA_MAX_CHANNELS *
- sizeof(*s->decoded_buf));
- if (!s->decoded_buf)
- goto alloc_fail;
- }
-
return 0;
alloc_fail:
decode_close_mp3on4(avctx);
@@ -1887,11 +1886,8 @@ static void flush_mp3on4(AVCodecContext *avctx)
int i;
MP3On4DecodeContext *s = avctx->priv_data;
- for (i = 0; i < s->frames; i++) {
- MPADecodeContext *m = s->mp3decctx[i];
- memset(m->synth_buf, 0, sizeof(m->synth_buf));
- m->last_buf_size = 0;
- }
+ for (i = 0; i < s->frames; i++)
+ mp_flush(s->mp3decctx[i]);
}
@@ -1904,25 +1900,22 @@ static int decode_frame_mp3on4(AVCodecContext *avctx, void *data,
MPADecodeContext *m;
int fsize, len = buf_size, out_size = 0;
uint32_t header;
- OUT_INT *out_samples;
- OUT_INT *outptr, *bp;
- int fr, j, n, ch, ret;
+ OUT_INT **out_samples;
+ OUT_INT *outptr[2];
+ int fr, ch, ret;
/* get output buffer */
s->frame->nb_samples = MPA_FRAME_SIZE;
- if ((ret = avctx->get_buffer(avctx, s->frame)) < 0) {
+ if ((ret = ff_get_buffer(avctx, s->frame)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return ret;
}
- out_samples = (OUT_INT *)s->frame->data[0];
+ out_samples = (OUT_INT **)s->frame->extended_data;
// Discard too short frames
if (buf_size < HEADER_SIZE)
return AVERROR_INVALIDDATA;
- // If only one decoder interleave is not needed
- outptr = s->frames == 1 ? out_samples : s->decoded_buf;
-
avctx->bit_rate = 0;
ch = 0;
@@ -1950,6 +1943,10 @@ static int decode_frame_mp3on4(AVCodecContext *avctx, void *data,
}
ch += m->nb_channels;
+ outptr[0] = out_samples[s->coff[fr]];
+ if (m->nb_channels > 1)
+ outptr[1] = out_samples[s->coff[fr] + 1];
+
if ((ret = mp_decode_frame(m, outptr, buf, fsize)) < 0)
return ret;
@@ -1957,23 +1954,6 @@ static int decode_frame_mp3on4(AVCodecContext *avctx, void *data,
buf += fsize;
len -= fsize;
- if (s->frames > 1) {
- n = m->avctx->frame_size*m->nb_channels;
- /* interleave output data */
- bp = out_samples + s->coff[fr];
- if (m->nb_channels == 1) {
- for (j = 0; j < n; j++) {
- *bp = s->decoded_buf[j];
- bp += avctx->channels;
- }
- } else {
- for (j = 0; j < n; j++) {
- bp[0] = s->decoded_buf[j++];
- bp[1] = s->decoded_buf[j];
- bp += avctx->channels;
- }
- }
- }
avctx->bit_rate += m->bit_rate;
}
@@ -1993,75 +1973,71 @@ static int decode_frame_mp3on4(AVCodecContext *avctx, void *data,
AVCodec ff_mp1_decoder = {
.name = "mp1",
.type = AVMEDIA_TYPE_AUDIO,
- .id = CODEC_ID_MP1,
+ .id = AV_CODEC_ID_MP1,
.priv_data_size = sizeof(MPADecodeContext),
.init = decode_init,
.decode = decode_frame,
-#if FF_API_PARSE_FRAME
- .capabilities = CODEC_CAP_PARSE_ONLY | CODEC_CAP_DR1,
-#else
.capabilities = CODEC_CAP_DR1,
-#endif
.flush = flush,
.long_name = NULL_IF_CONFIG_SMALL("MP1 (MPEG audio layer 1)"),
+ .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_S16P,
+ AV_SAMPLE_FMT_S16,
+ AV_SAMPLE_FMT_NONE },
};
#endif
#if CONFIG_MP2_DECODER
AVCodec ff_mp2_decoder = {
.name = "mp2",
.type = AVMEDIA_TYPE_AUDIO,
- .id = CODEC_ID_MP2,
+ .id = AV_CODEC_ID_MP2,
.priv_data_size = sizeof(MPADecodeContext),
.init = decode_init,
.decode = decode_frame,
-#if FF_API_PARSE_FRAME
- .capabilities = CODEC_CAP_PARSE_ONLY | CODEC_CAP_DR1,
-#else
.capabilities = CODEC_CAP_DR1,
-#endif
.flush = flush,
.long_name = NULL_IF_CONFIG_SMALL("MP2 (MPEG audio layer 2)"),
+ .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_S16P,
+ AV_SAMPLE_FMT_S16,
+ AV_SAMPLE_FMT_NONE },
};
#endif
#if CONFIG_MP3_DECODER
AVCodec ff_mp3_decoder = {
.name = "mp3",
.type = AVMEDIA_TYPE_AUDIO,
- .id = CODEC_ID_MP3,
+ .id = AV_CODEC_ID_MP3,
.priv_data_size = sizeof(MPADecodeContext),
.init = decode_init,
.decode = decode_frame,
-#if FF_API_PARSE_FRAME
- .capabilities = CODEC_CAP_PARSE_ONLY | CODEC_CAP_DR1,
-#else
.capabilities = CODEC_CAP_DR1,
-#endif
.flush = flush,
.long_name = NULL_IF_CONFIG_SMALL("MP3 (MPEG audio layer 3)"),
+ .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_S16P,
+ AV_SAMPLE_FMT_S16,
+ AV_SAMPLE_FMT_NONE },
};
#endif
#if CONFIG_MP3ADU_DECODER
AVCodec ff_mp3adu_decoder = {
.name = "mp3adu",
.type = AVMEDIA_TYPE_AUDIO,
- .id = CODEC_ID_MP3ADU,
+ .id = AV_CODEC_ID_MP3ADU,
.priv_data_size = sizeof(MPADecodeContext),
.init = decode_init,
.decode = decode_frame_adu,
-#if FF_API_PARSE_FRAME
- .capabilities = CODEC_CAP_PARSE_ONLY | CODEC_CAP_DR1,
-#else
.capabilities = CODEC_CAP_DR1,
-#endif
.flush = flush,
.long_name = NULL_IF_CONFIG_SMALL("ADU (Application Data Unit) MP3 (MPEG audio layer 3)"),
+ .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_S16P,
+ AV_SAMPLE_FMT_S16,
+ AV_SAMPLE_FMT_NONE },
};
#endif
#if CONFIG_MP3ON4_DECODER
AVCodec ff_mp3on4_decoder = {
.name = "mp3on4",
.type = AVMEDIA_TYPE_AUDIO,
- .id = CODEC_ID_MP3ON4,
+ .id = AV_CODEC_ID_MP3ON4,
.priv_data_size = sizeof(MP3On4DecodeContext),
.init = decode_init_mp3on4,
.close = decode_close_mp3on4,
@@ -2069,6 +2045,8 @@ AVCodec ff_mp3on4_decoder = {
.capabilities = CODEC_CAP_DR1,
.flush = flush_mp3on4,
.long_name = NULL_IF_CONFIG_SMALL("MP3onMP4"),
+ .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_S16P,
+ AV_SAMPLE_FMT_NONE },
};
#endif
#endif
diff --git a/gst-libs/ext/libav/libavcodec/mpegaudiodec_float.c b/gst-libs/ext/libav/libavcodec/mpegaudiodec_float.c
index 02c83af..ac8df32 100644
--- a/gst-libs/ext/libav/libavcodec/mpegaudiodec_float.c
+++ b/gst-libs/ext/libav/libavcodec/mpegaudiodec_float.c
@@ -26,75 +26,71 @@
AVCodec ff_mp1float_decoder = {
.name = "mp1float",
.type = AVMEDIA_TYPE_AUDIO,
- .id = CODEC_ID_MP1,
+ .id = AV_CODEC_ID_MP1,
.priv_data_size = sizeof(MPADecodeContext),
.init = decode_init,
.decode = decode_frame,
-#if FF_API_PARSE_FRAME
- .capabilities = CODEC_CAP_PARSE_ONLY | CODEC_CAP_DR1,
-#else
.capabilities = CODEC_CAP_DR1,
-#endif
.flush = flush,
.long_name = NULL_IF_CONFIG_SMALL("MP1 (MPEG audio layer 1)"),
+ .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP,
+ AV_SAMPLE_FMT_FLT,
+ AV_SAMPLE_FMT_NONE },
};
#endif
#if CONFIG_MP2FLOAT_DECODER
AVCodec ff_mp2float_decoder = {
.name = "mp2float",
.type = AVMEDIA_TYPE_AUDIO,
- .id = CODEC_ID_MP2,
+ .id = AV_CODEC_ID_MP2,
.priv_data_size = sizeof(MPADecodeContext),
.init = decode_init,
.decode = decode_frame,
-#if FF_API_PARSE_FRAME
- .capabilities = CODEC_CAP_PARSE_ONLY | CODEC_CAP_DR1,
-#else
.capabilities = CODEC_CAP_DR1,
-#endif
.flush = flush,
.long_name = NULL_IF_CONFIG_SMALL("MP2 (MPEG audio layer 2)"),
+ .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP,
+ AV_SAMPLE_FMT_FLT,
+ AV_SAMPLE_FMT_NONE },
};
#endif
#if CONFIG_MP3FLOAT_DECODER
AVCodec ff_mp3float_decoder = {
.name = "mp3float",
.type = AVMEDIA_TYPE_AUDIO,
- .id = CODEC_ID_MP3,
+ .id = AV_CODEC_ID_MP3,
.priv_data_size = sizeof(MPADecodeContext),
.init = decode_init,
.decode = decode_frame,
-#if FF_API_PARSE_FRAME
- .capabilities = CODEC_CAP_PARSE_ONLY | CODEC_CAP_DR1,
-#else
.capabilities = CODEC_CAP_DR1,
-#endif
.flush = flush,
.long_name = NULL_IF_CONFIG_SMALL("MP3 (MPEG audio layer 3)"),
+ .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP,
+ AV_SAMPLE_FMT_FLT,
+ AV_SAMPLE_FMT_NONE },
};
#endif
#if CONFIG_MP3ADUFLOAT_DECODER
AVCodec ff_mp3adufloat_decoder = {
.name = "mp3adufloat",
.type = AVMEDIA_TYPE_AUDIO,
- .id = CODEC_ID_MP3ADU,
+ .id = AV_CODEC_ID_MP3ADU,
.priv_data_size = sizeof(MPADecodeContext),
.init = decode_init,
.decode = decode_frame_adu,
-#if FF_API_PARSE_FRAME
- .capabilities = CODEC_CAP_PARSE_ONLY | CODEC_CAP_DR1,
-#else
.capabilities = CODEC_CAP_DR1,
-#endif
.flush = flush,
.long_name = NULL_IF_CONFIG_SMALL("ADU (Application Data Unit) MP3 (MPEG audio layer 3)"),
+ .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP,
+ AV_SAMPLE_FMT_FLT,
+ AV_SAMPLE_FMT_NONE },
};
#endif
#if CONFIG_MP3ON4FLOAT_DECODER
AVCodec ff_mp3on4float_decoder = {
.name = "mp3on4float",
.type = AVMEDIA_TYPE_AUDIO,
- .id = CODEC_ID_MP3ON4,
+ .id = AV_CODEC_ID_MP3ON4,
.priv_data_size = sizeof(MP3On4DecodeContext),
.init = decode_init_mp3on4,
.close = decode_close_mp3on4,
@@ -102,5 +98,7 @@ AVCodec ff_mp3on4float_decoder = {
.capabilities = CODEC_CAP_DR1,
.flush = flush_mp3on4,
.long_name = NULL_IF_CONFIG_SMALL("MP3onMP4"),
+ .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP,
+ AV_SAMPLE_FMT_NONE },
};
#endif
diff --git a/gst-libs/ext/libav/libavcodec/mpegaudiodecheader.c b/gst-libs/ext/libav/libavcodec/mpegaudiodecheader.c
index dbd67ff..f8fc833 100644
--- a/gst-libs/ext/libav/libavcodec/mpegaudiodecheader.c
+++ b/gst-libs/ext/libav/libavcodec/mpegaudiodecheader.c
@@ -122,16 +122,16 @@ int avpriv_mpa_decode_header(AVCodecContext *avctx, uint32_t head, int *sample_r
switch(s->layer) {
case 1:
- avctx->codec_id = CODEC_ID_MP1;
+ avctx->codec_id = AV_CODEC_ID_MP1;
*frame_size = 384;
break;
case 2:
- avctx->codec_id = CODEC_ID_MP2;
+ avctx->codec_id = AV_CODEC_ID_MP2;
*frame_size = 1152;
break;
default:
case 3:
- avctx->codec_id = CODEC_ID_MP3;
+ avctx->codec_id = AV_CODEC_ID_MP3;
if (s->lsf)
*frame_size = 576;
else
@@ -142,6 +142,5 @@ int avpriv_mpa_decode_header(AVCodecContext *avctx, uint32_t head, int *sample_r
*sample_rate = s->sample_rate;
*channels = s->nb_channels;
*bit_rate = s->bit_rate;
- avctx->sub_id = s->layer;
return s->frame_size;
}
diff --git a/gst-libs/ext/libav/libavcodec/mpegaudiodsp.c b/gst-libs/ext/libav/libavcodec/mpegaudiodsp.c
index 431724a..cd9371b 100644
--- a/gst-libs/ext/libav/libavcodec/mpegaudiodsp.c
+++ b/gst-libs/ext/libav/libavcodec/mpegaudiodsp.c
@@ -41,6 +41,6 @@ void ff_mpadsp_init(MPADSPContext *s)
s->imdct36_blocks_fixed = ff_imdct36_blocks_fixed;
if (ARCH_ARM) ff_mpadsp_init_arm(s);
- if (HAVE_MMX) ff_mpadsp_init_mmx(s);
+ if (ARCH_X86) ff_mpadsp_init_x86(s);
if (HAVE_ALTIVEC) ff_mpadsp_init_altivec(s);
}
diff --git a/gst-libs/ext/libav/libavcodec/mpegaudiodsp.h b/gst-libs/ext/libav/libavcodec/mpegaudiodsp.h
index c24ea41..1f85a15 100644
--- a/gst-libs/ext/libav/libavcodec/mpegaudiodsp.h
+++ b/gst-libs/ext/libav/libavcodec/mpegaudiodsp.h
@@ -40,6 +40,8 @@ void ff_mpadsp_init(MPADSPContext *s);
extern int32_t ff_mpa_synth_window_fixed[];
extern float ff_mpa_synth_window_float[];
+extern const int32_t ff_mpa_enwindow[257];
+
void ff_mpa_synth_filter_fixed(MPADSPContext *s,
int32_t *synth_buf_ptr, int *synth_buf_offset,
int32_t *window, int *dither_state,
@@ -53,7 +55,7 @@ void ff_mpa_synth_filter_float(MPADSPContext *s,
float *sb_samples);
void ff_mpadsp_init_arm(MPADSPContext *s);
-void ff_mpadsp_init_mmx(MPADSPContext *s);
+void ff_mpadsp_init_x86(MPADSPContext *s);
void ff_mpadsp_init_altivec(MPADSPContext *s);
void ff_mpa_synth_init_float(float *window);
diff --git a/gst-libs/ext/libav/libavcodec/mpegaudiodsp_data.c b/gst-libs/ext/libav/libavcodec/mpegaudiodsp_data.c
new file mode 100644
index 0000000..5cf86b8
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/mpegaudiodsp_data.c
@@ -0,0 +1,56 @@
+/*
+ * 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
+ */
+
+#include "mpegaudiodsp.h"
+
+/* half mpeg encoding window (full precision) */
+const int32_t ff_mpa_enwindow[257] = {
+ 0, -1, -1, -1, -1, -1, -1, -2,
+ -2, -2, -2, -3, -3, -4, -4, -5,
+ -5, -6, -7, -7, -8, -9, -10, -11,
+ -13, -14, -16, -17, -19, -21, -24, -26,
+ -29, -31, -35, -38, -41, -45, -49, -53,
+ -58, -63, -68, -73, -79, -85, -91, -97,
+ -104, -111, -117, -125, -132, -139, -147, -154,
+ -161, -169, -176, -183, -190, -196, -202, -208,
+ 213, 218, 222, 225, 227, 228, 228, 227,
+ 224, 221, 215, 208, 200, 189, 177, 163,
+ 146, 127, 106, 83, 57, 29, -2, -36,
+ -72, -111, -153, -197, -244, -294, -347, -401,
+ -459, -519, -581, -645, -711, -779, -848, -919,
+ -991, -1064, -1137, -1210, -1283, -1356, -1428, -1498,
+ -1567, -1634, -1698, -1759, -1817, -1870, -1919, -1962,
+ -2001, -2032, -2057, -2075, -2085, -2087, -2080, -2063,
+ 2037, 2000, 1952, 1893, 1822, 1739, 1644, 1535,
+ 1414, 1280, 1131, 970, 794, 605, 402, 185,
+ -45, -288, -545, -814, -1095, -1388, -1692, -2006,
+ -2330, -2663, -3004, -3351, -3705, -4063, -4425, -4788,
+ -5153, -5517, -5879, -6237, -6589, -6935, -7271, -7597,
+ -7910, -8209, -8491, -8755, -8998, -9219, -9416, -9585,
+ -9727, -9838, -9916, -9959, -9966, -9935, -9863, -9750,
+ -9592, -9389, -9139, -8840, -8492, -8092, -7640, -7134,
+ 6574, 5959, 5288, 4561, 3776, 2935, 2037, 1082,
+ 70, -998, -2122, -3300, -4533, -5818, -7154, -8540,
+ -9975,-11455,-12980,-14548,-16155,-17799,-19478,-21189,
+-22929,-24694,-26482,-28289,-30112,-31947,-33791,-35640,
+-37489,-39336,-41176,-43006,-44821,-46617,-48390,-50137,
+-51853,-53534,-55178,-56778,-58333,-59838,-61289,-62684,
+-64019,-65290,-66494,-67629,-68692,-69679,-70590,-71420,
+-72169,-72835,-73415,-73908,-74313,-74630,-74856,-74992,
+ 75038,
+};
diff --git a/gst-libs/ext/libav/libavcodec/mpegaudiodsp_template.c b/gst-libs/ext/libav/libavcodec/mpegaudiodsp_template.c
index d616f8a..e7a7656 100644
--- a/gst-libs/ext/libav/libavcodec/mpegaudiodsp_template.c
+++ b/gst-libs/ext/libav/libavcodec/mpegaudiodsp_template.c
@@ -25,7 +25,6 @@
#include "mathops.h"
#include "mpegaudiodsp.h"
#include "mpegaudio.h"
-#include "mpegaudiodata.h"
#if CONFIG_FLOAT
#define RENAME(n) n##_float
@@ -192,7 +191,7 @@ void RENAME(ff_mpa_synth_filter)(MPADSPContext *s, MPA_INT *synth_buf_ptr,
*synth_buf_offset = offset;
}
-void av_cold RENAME(ff_mpa_synth_init)(MPA_INT *window)
+av_cold void RENAME(ff_mpa_synth_init)(MPA_INT *window)
{
int i, j;
diff --git a/gst-libs/ext/libav/libavcodec/mpegaudioenc.c b/gst-libs/ext/libav/libavcodec/mpegaudioenc.c
index 71ea393..ba0d8cf 100644
--- a/gst-libs/ext/libav/libavcodec/mpegaudioenc.c
+++ b/gst-libs/ext/libav/libavcodec/mpegaudioenc.c
@@ -24,6 +24,8 @@
* The simplest mpeg audio layer 2 encoder.
*/
+#include "libavutil/channel_layout.h"
+
#include "avcodec.h"
#include "internal.h"
#include "put_bits.h"
@@ -32,6 +34,7 @@
#define WFRAC_BITS 14 /* fractional bits for window */
#include "mpegaudio.h"
+#include "mpegaudiodsp.h"
/* currently, cannot change these constants (need to modify
quantization stage) */
@@ -75,11 +78,12 @@ static av_cold int MPA_encode_init(AVCodecContext *avctx)
if (channels <= 0 || channels > 2){
av_log(avctx, AV_LOG_ERROR, "encoding %d channel(s) is not allowed in mp2\n", channels);
- return -1;
+ return AVERROR(EINVAL);
}
bitrate = bitrate / 1000;
s->nb_channels = channels;
avctx->frame_size = MPA_FRAME_SIZE;
+ avctx->delay = 512 - 32 + 1;
/* encoding freq */
s->lsf = 0;
@@ -93,7 +97,7 @@ static av_cold int MPA_encode_init(AVCodecContext *avctx)
}
if (i == 3){
av_log(avctx, AV_LOG_ERROR, "Sampling rate %d is not allowed in mp2\n", freq);
- return -1;
+ return AVERROR(EINVAL);
}
s->freq_index = i;
@@ -104,7 +108,7 @@ static av_cold int MPA_encode_init(AVCodecContext *avctx)
}
if (i == 15){
av_log(avctx, AV_LOG_ERROR, "bitrate %d is not allowed in mp2\n", bitrate);
- return -1;
+ return AVERROR(EINVAL);
}
s->bitrate_index = i;
@@ -180,8 +184,11 @@ static av_cold int MPA_encode_init(AVCodecContext *avctx)
total_quant_bits[i] = 12 * v;
}
+#if FF_API_OLD_ENCODE_AUDIO
avctx->coded_frame= avcodec_alloc_frame();
- avctx->coded_frame->key_frame= 1;
+ if (!avctx->coded_frame)
+ return AVERROR(ENOMEM);
+#endif
return 0;
}
@@ -725,14 +732,14 @@ static void encode_frame(MpegAudioContext *s,
flush_put_bits(p);
}
-static int MPA_encode_frame(AVCodecContext *avctx,
- unsigned char *frame, int buf_size, void *data)
+static int MPA_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
+ const AVFrame *frame, int *got_packet_ptr)
{
MpegAudioContext *s = avctx->priv_data;
- const short *samples = data;
+ const int16_t *samples = (const int16_t *)frame->data[0];
short smr[MPA_MAX_CHANNELS][SBLIMIT];
unsigned char bit_alloc[MPA_MAX_CHANNELS][SBLIMIT];
- int padding, i;
+ int padding, i, ret;
for(i=0;i<s->nb_channels;i++) {
filter(s, i, samples + i, s->nb_channels);
@@ -747,16 +754,28 @@ static int MPA_encode_frame(AVCodecContext *avctx,
}
compute_bit_allocation(s, smr, bit_alloc, &padding);
- init_put_bits(&s->pb, frame, MPA_MAX_CODED_FRAME_SIZE);
+ if ((ret = ff_alloc_packet(avpkt, MPA_MAX_CODED_FRAME_SIZE))) {
+ av_log(avctx, AV_LOG_ERROR, "Error getting output packet\n");
+ return ret;
+ }
+
+ init_put_bits(&s->pb, avpkt->data, avpkt->size);
encode_frame(s, bit_alloc, padding);
- return put_bits_ptr(&s->pb) - s->pb.buf;
+ if (frame->pts != AV_NOPTS_VALUE)
+ avpkt->pts = frame->pts - ff_samples_to_time_base(avctx, avctx->delay);
+
+ avpkt->size = put_bits_count(&s->pb) / 8;
+ *got_packet_ptr = 1;
+ return 0;
}
static av_cold int MPA_encode_close(AVCodecContext *avctx)
{
+#if FF_API_OLD_ENCODE_AUDIO
av_freep(&avctx->coded_frame);
+#endif
return 0;
}
@@ -766,15 +785,21 @@ static const AVCodecDefault mp2_defaults[] = {
};
AVCodec ff_mp2_encoder = {
- .name = "mp2",
- .type = AVMEDIA_TYPE_AUDIO,
- .id = CODEC_ID_MP2,
- .priv_data_size = sizeof(MpegAudioContext),
- .init = MPA_encode_init,
- .encode = MPA_encode_frame,
- .close = MPA_encode_close,
- .sample_fmts = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_NONE},
- .supported_samplerates= (const int[]){44100, 48000, 32000, 22050, 24000, 16000, 0},
- .long_name = NULL_IF_CONFIG_SMALL("MP2 (MPEG audio layer 2)"),
- .defaults = mp2_defaults,
+ .name = "mp2",
+ .type = AVMEDIA_TYPE_AUDIO,
+ .id = AV_CODEC_ID_MP2,
+ .priv_data_size = sizeof(MpegAudioContext),
+ .init = MPA_encode_init,
+ .encode2 = MPA_encode_frame,
+ .close = MPA_encode_close,
+ .sample_fmts = (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_S16,
+ AV_SAMPLE_FMT_NONE },
+ .supported_samplerates = (const int[]){
+ 44100, 48000, 32000, 22050, 24000, 16000, 0
+ },
+ .channel_layouts = (const uint64_t[]){ AV_CH_LAYOUT_MONO,
+ AV_CH_LAYOUT_STEREO,
+ 0 },
+ .long_name = NULL_IF_CONFIG_SMALL("MP2 (MPEG audio layer 2)"),
+ .defaults = mp2_defaults,
};
diff --git a/gst-libs/ext/libav/libavcodec/mpegvideo.c b/gst-libs/ext/libav/libavcodec/mpegvideo.c
index fa89886..77e21d2 100644
--- a/gst-libs/ext/libav/libavcodec/mpegvideo.c
+++ b/gst-libs/ext/libav/libavcodec/mpegvideo.c
@@ -27,16 +27,14 @@
* The simplest mpeg encoder (well, it was the simplest!).
*/
-#include "libavutil/intmath.h"
#include "libavutil/imgutils.h"
#include "avcodec.h"
#include "dsputil.h"
#include "internal.h"
+#include "mathops.h"
#include "mpegvideo.h"
-#include "mpegvideo_common.h"
#include "mjpegenc.h"
#include "msmpeg4.h"
-#include "faandct.h"
#include "xvmc_internal.h"
#include "thread.h"
#include <limits.h>
@@ -127,17 +125,17 @@ const uint8_t *const ff_mpeg2_dc_scale_table[4] = {
mpeg2_dc_scale_table3,
};
-const enum PixelFormat ff_pixfmt_list_420[] = {
- PIX_FMT_YUV420P,
- PIX_FMT_NONE
+const enum AVPixelFormat ff_pixfmt_list_420[] = {
+ AV_PIX_FMT_YUV420P,
+ AV_PIX_FMT_NONE
};
-const enum PixelFormat ff_hwaccel_pixfmt_list_420[] = {
- PIX_FMT_DXVA2_VLD,
- PIX_FMT_VAAPI_VLD,
- PIX_FMT_VDA_VLD,
- PIX_FMT_YUV420P,
- PIX_FMT_NONE
+const enum AVPixelFormat ff_hwaccel_pixfmt_list_420[] = {
+ AV_PIX_FMT_DXVA2_VLD,
+ AV_PIX_FMT_VAAPI_VLD,
+ AV_PIX_FMT_VDA_VLD,
+ AV_PIX_FMT_YUV420P,
+ AV_PIX_FMT_NONE
};
const uint8_t *avpriv_mpv_find_start_code(const uint8_t *restrict p,
@@ -176,7 +174,8 @@ const uint8_t *avpriv_mpv_find_start_code(const uint8_t *restrict p,
/* init common dct for both encoder and decoder */
av_cold int ff_dct_common_init(MpegEncContext *s)
{
- dsputil_init(&s->dsp, s->avctx);
+ ff_dsputil_init(&s->dsp, s->avctx);
+ ff_videodsp_init(&s->vdsp, s->avctx->bits_per_raw_sample);
s->dct_unquantize_h263_intra = dct_unquantize_h263_intra_c;
s->dct_unquantize_h263_inter = dct_unquantize_h263_inter_c;
@@ -187,20 +186,16 @@ av_cold int ff_dct_common_init(MpegEncContext *s)
s->dct_unquantize_mpeg2_intra = dct_unquantize_mpeg2_intra_bitexact;
s->dct_unquantize_mpeg2_inter = dct_unquantize_mpeg2_inter_c;
-#if HAVE_MMX
- MPV_common_init_mmx(s);
+#if ARCH_X86
+ ff_MPV_common_init_x86(s);
#elif ARCH_ALPHA
- MPV_common_init_axp(s);
-#elif CONFIG_MLIB
- MPV_common_init_mlib(s);
-#elif HAVE_MMI
- MPV_common_init_mmi(s);
+ ff_MPV_common_init_axp(s);
#elif ARCH_ARM
- MPV_common_init_arm(s);
+ ff_MPV_common_init_arm(s);
#elif HAVE_ALTIVEC
- MPV_common_init_altivec(s);
+ ff_MPV_common_init_altivec(s);
#elif ARCH_BFIN
- MPV_common_init_bfin(s);
+ ff_MPV_common_init_bfin(s);
#endif
/* load & permutate scantables
@@ -230,22 +225,48 @@ void ff_copy_picture(Picture *dst, Picture *src)
*/
static void free_frame_buffer(MpegEncContext *s, Picture *pic)
{
- /* Windows Media Image codecs allocate internal buffers with different
- * dimensions; ignore user defined callbacks for these
- */
- if (s->codec_id != CODEC_ID_WMV3IMAGE && s->codec_id != CODEC_ID_VC1IMAGE)
- ff_thread_release_buffer(s->avctx, (AVFrame *) pic);
+ /* WM Image / Screen codecs allocate internal buffers with different
+ * dimensions / colorspaces; ignore user-defined callbacks for these. */
+ if (s->codec_id != AV_CODEC_ID_WMV3IMAGE &&
+ s->codec_id != AV_CODEC_ID_VC1IMAGE &&
+ s->codec_id != AV_CODEC_ID_MSS2)
+ ff_thread_release_buffer(s->avctx, &pic->f);
else
- avcodec_default_release_buffer(s->avctx, (AVFrame *) pic);
+ avcodec_default_release_buffer(s->avctx, &pic->f);
av_freep(&pic->f.hwaccel_picture_private);
}
+int ff_mpv_frame_size_alloc(MpegEncContext *s, int linesize)
+{
+ int alloc_size = FFALIGN(FFABS(linesize) + 32, 32);
+
+ // edge emu needs blocksize + filter length - 1
+ // (= 17x17 for halfpel / 21x21 for h264)
+ // VC1 computes luma and chroma simultaneously and needs 19X19 + 9x9
+ // at uvlinesize. It supports only YUV420 so 24x24 is enough
+ // linesize * interlaced * MBsize
+ FF_ALLOCZ_OR_GOTO(s->avctx, s->edge_emu_buffer, alloc_size * 2 * 24,
+ fail);
+
+ FF_ALLOCZ_OR_GOTO(s->avctx, s->me.scratchpad, alloc_size * 2 * 16 * 3,
+ fail)
+ s->me.temp = s->me.scratchpad;
+ s->rd_scratchpad = s->me.scratchpad;
+ s->b_scratchpad = s->me.scratchpad;
+ s->obmc_scratchpad = s->me.scratchpad + 16;
+
+ return 0;
+fail:
+ av_freep(&s->edge_emu_buffer);
+ return AVERROR(ENOMEM);
+}
+
/**
* Allocate a frame buffer
*/
static int alloc_frame_buffer(MpegEncContext *s, Picture *pic)
{
- int r;
+ int r, ret;
if (s->avctx->hwaccel) {
assert(!pic->f.hwaccel_picture_private);
@@ -258,10 +279,12 @@ static int alloc_frame_buffer(MpegEncContext *s, Picture *pic)
}
}
- if (s->codec_id != CODEC_ID_WMV3IMAGE && s->codec_id != CODEC_ID_VC1IMAGE)
- r = ff_thread_get_buffer(s->avctx, (AVFrame *) pic);
+ if (s->codec_id != AV_CODEC_ID_WMV3IMAGE &&
+ s->codec_id != AV_CODEC_ID_VC1IMAGE &&
+ s->codec_id != AV_CODEC_ID_MSS2)
+ r = ff_thread_get_buffer(s->avctx, &pic->f);
else
- r = avcodec_default_get_buffer(s->avctx, (AVFrame *) pic);
+ r = avcodec_default_get_buffer(s->avctx, &pic->f);
if (r < 0 || !pic->f.type || !pic->f.data[0]) {
av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed (%d %d %p)\n",
@@ -285,6 +308,14 @@ static int alloc_frame_buffer(MpegEncContext *s, Picture *pic)
return -1;
}
+ if (!s->edge_emu_buffer &&
+ (ret = ff_mpv_frame_size_alloc(s, pic->f.linesize[0])) < 0) {
+ av_log(s->avctx, AV_LOG_ERROR,
+ "get_buffer() failed to allocate context scratch buffers.\n");
+ free_frame_buffer(s, pic);
+ return ret;
+ }
+
return 0;
}
@@ -394,13 +425,16 @@ static void free_picture(MpegEncContext *s, Picture *pic)
av_freep(&pic->mb_mean);
av_freep(&pic->f.mbskip_table);
av_freep(&pic->qscale_table_base);
+ pic->f.qscale_table = NULL;
av_freep(&pic->mb_type_base);
+ pic->f.mb_type = NULL;
av_freep(&pic->f.dct_coeff);
av_freep(&pic->f.pan_scan);
pic->f.mb_type = NULL;
for (i = 0; i < 2; i++) {
av_freep(&pic->motion_val_base[i]);
av_freep(&pic->f.ref_index[i]);
+ pic->f.motion_val[i] = NULL;
}
if (pic->f.type == FF_BUFFER_TYPE_SHARED) {
@@ -419,19 +453,13 @@ static int init_duplicate_context(MpegEncContext *s, MpegEncContext *base)
int yc_size = y_size + 2 * c_size;
int i;
- // edge emu needs blocksize + filter length - 1
- // (= 17x17 for halfpel / 21x21 for h264)
- FF_ALLOCZ_OR_GOTO(s->avctx, s->edge_emu_buffer,
- (s->width + 64) * 2 * 21 * 2, fail); // (width + edge + align)*interlaced*MBsize*tolerance
+ s->edge_emu_buffer =
+ s->me.scratchpad =
+ s->me.temp =
+ s->rd_scratchpad =
+ s->b_scratchpad =
+ s->obmc_scratchpad = NULL;
- // FIXME should be linesize instead of s->width * 2
- // but that is not known before get_buffer()
- FF_ALLOCZ_OR_GOTO(s->avctx, s->me.scratchpad,
- (s->width + 64) * 4 * 16 * 2 * sizeof(uint8_t), fail)
- s->me.temp = s->me.scratchpad;
- s->rd_scratchpad = s->me.scratchpad;
- s->b_scratchpad = s->me.scratchpad;
- s->obmc_scratchpad = s->me.scratchpad + 16;
if (s->encoding) {
FF_ALLOCZ_OR_GOTO(s->avctx, s->me.map,
ME_MAP_SIZE * sizeof(uint32_t), fail)
@@ -460,7 +488,7 @@ static int init_duplicate_context(MpegEncContext *s, MpegEncContext *base)
return 0;
fail:
- return -1; // free() through MPV_common_end()
+ return -1; // free() through ff_MPV_common_end()
}
static void free_duplicate_context(MpegEncContext *s)
@@ -510,10 +538,10 @@ static void backup_duplicate_context(MpegEncContext *bak, MpegEncContext *src)
#undef COPY
}
-void ff_update_duplicate_context(MpegEncContext *dst, MpegEncContext *src)
+int ff_update_duplicate_context(MpegEncContext *dst, MpegEncContext *src)
{
MpegEncContext bak;
- int i;
+ int i, ret;
// FIXME copy only needed parts
// START_TIMER
backup_duplicate_context(&bak, dst);
@@ -522,13 +550,21 @@ void ff_update_duplicate_context(MpegEncContext *dst, MpegEncContext *src)
for (i = 0; i < 12; i++) {
dst->pblocks[i] = &dst->block[i];
}
+ if (!dst->edge_emu_buffer &&
+ (ret = ff_mpv_frame_size_alloc(dst, dst->linesize)) < 0) {
+ av_log(dst->avctx, AV_LOG_ERROR, "failed to allocate context "
+ "scratch buffers.\n");
+ return ret;
+ }
// STOP_TIMER("update_duplicate_context")
// about 10k cycles / 0.01 sec for 1000frames on 1ghz with 2 threads
+ return 0;
}
int ff_mpeg_update_thread_context(AVCodecContext *dst,
const AVCodecContext *src)
{
+ int i;
MpegEncContext *s = dst->priv_data, *s1 = src->priv_data;
if (dst == src || !s1->context_initialized)
@@ -545,7 +581,16 @@ int ff_mpeg_update_thread_context(AVCodecContext *dst,
s->bitstream_buffer = NULL;
s->bitstream_buffer_size = s->allocated_bitstream_buffer_size = 0;
- MPV_common_init(s);
+ ff_MPV_common_init(s);
+ }
+
+ if (s->height != s1->height || s->width != s1->width || s->context_reinit) {
+ int err;
+ s->context_reinit = 0;
+ s->height = s1->height;
+ s->width = s1->width;
+ if ((err = ff_MPV_common_frame_size_change(s)) < 0)
+ return err;
}
s->avctx->coded_height = s1->avctx->coded_height;
@@ -561,6 +606,10 @@ int ff_mpeg_update_thread_context(AVCodecContext *dst,
memcpy(&s->last_picture, &s1->last_picture,
(char *) &s1->last_picture_ptr - (char *) &s1->last_picture);
+ // reset s->picture[].f.extended_data to s->picture[].f.data
+ for (i = 0; i < s->picture_count; i++)
+ s->picture[i].f.extended_data = s->picture[i].f.data;
+
s->last_picture_ptr = REBASE_PICTURE(s1->last_picture_ptr, s, s1);
s->current_picture_ptr = REBASE_PICTURE(s1->current_picture_ptr, s, s1);
s->next_picture_ptr = REBASE_PICTURE(s1->next_picture_ptr, s, s1);
@@ -576,7 +625,7 @@ int ff_mpeg_update_thread_context(AVCodecContext *dst,
// B-frame info
s->max_b_frames = s1->max_b_frames;
s->low_delay = s1->low_delay;
- s->dropable = s1->dropable;
+ s->droppable = s1->droppable;
// DivX handling (doesn't work)
s->divx_packed = s1->divx_packed;
@@ -594,6 +643,20 @@ int ff_mpeg_update_thread_context(AVCodecContext *dst,
FF_INPUT_BUFFER_PADDING_SIZE);
}
+ // linesize dependend scratch buffer allocation
+ if (!s->edge_emu_buffer)
+ if (s1->linesize) {
+ if (ff_mpv_frame_size_alloc(s, s1->linesize) < 0) {
+ av_log(s->avctx, AV_LOG_ERROR, "Failed to allocate context "
+ "scratch buffers.\n");
+ return AVERROR(ENOMEM);
+ }
+ } else {
+ av_log(s->avctx, AV_LOG_ERROR, "Context scratch buffers could not "
+ "be allocated due to unknown size.\n");
+ return AVERROR_BUG;
+ }
+
// MPEG2/interlacing info
memcpy(&s->progressive_sequence, &s1->progressive_sequence,
(char *) &s1->rtp_mode - (char *) &s1->progressive_sequence);
@@ -617,7 +680,7 @@ int ff_mpeg_update_thread_context(AVCodecContext *dst,
* The changed fields will not depend upon the
* prior state of the MpegEncContext.
*/
-void MPV_common_defaults(MpegEncContext *s)
+void ff_MPV_common_defaults(MpegEncContext *s)
{
s->y_dc_scale_table =
s->c_dc_scale_table = ff_mpeg1_dc_scale_table;
@@ -646,18 +709,173 @@ void MPV_common_defaults(MpegEncContext *s)
* the changed fields will not depend upon
* the prior state of the MpegEncContext.
*/
-void MPV_decode_defaults(MpegEncContext *s)
+void ff_MPV_decode_defaults(MpegEncContext *s)
{
- MPV_common_defaults(s);
+ ff_MPV_common_defaults(s);
+}
+
+/**
+ * Initialize and allocates MpegEncContext fields dependent on the resolution.
+ */
+static int init_context_frame(MpegEncContext *s)
+{
+ int y_size, c_size, yc_size, i, mb_array_size, mv_table_size, x, y;
+
+ s->mb_width = (s->width + 15) / 16;
+ s->mb_stride = s->mb_width + 1;
+ s->b8_stride = s->mb_width * 2 + 1;
+ s->b4_stride = s->mb_width * 4 + 1;
+ mb_array_size = s->mb_height * s->mb_stride;
+ mv_table_size = (s->mb_height + 2) * s->mb_stride + 1;
+
+ /* set default edge pos, will be overriden
+ * in decode_header if needed */
+ s->h_edge_pos = s->mb_width * 16;
+ s->v_edge_pos = s->mb_height * 16;
+
+ s->mb_num = s->mb_width * s->mb_height;
+
+ s->block_wrap[0] =
+ s->block_wrap[1] =
+ s->block_wrap[2] =
+ s->block_wrap[3] = s->b8_stride;
+ s->block_wrap[4] =
+ s->block_wrap[5] = s->mb_stride;
+
+ y_size = s->b8_stride * (2 * s->mb_height + 1);
+ c_size = s->mb_stride * (s->mb_height + 1);
+ yc_size = y_size + 2 * c_size;
+
+ FF_ALLOCZ_OR_GOTO(s->avctx, s->mb_index2xy, (s->mb_num + 1) * sizeof(int),
+ fail); // error ressilience code looks cleaner with this
+ for (y = 0; y < s->mb_height; y++)
+ for (x = 0; x < s->mb_width; x++)
+ s->mb_index2xy[x + y * s->mb_width] = x + y * s->mb_stride;
+
+ s->mb_index2xy[s->mb_height * s->mb_width] =
+ (s->mb_height - 1) * s->mb_stride + s->mb_width; // FIXME really needed?
+
+ if (s->encoding) {
+ /* Allocate MV tables */
+ FF_ALLOCZ_OR_GOTO(s->avctx, s->p_mv_table_base,
+ mv_table_size * 2 * sizeof(int16_t), fail);
+ FF_ALLOCZ_OR_GOTO(s->avctx, s->b_forw_mv_table_base,
+ mv_table_size * 2 * sizeof(int16_t), fail);
+ FF_ALLOCZ_OR_GOTO(s->avctx, s->b_back_mv_table_base,
+ mv_table_size * 2 * sizeof(int16_t), fail);
+ FF_ALLOCZ_OR_GOTO(s->avctx, s->b_bidir_forw_mv_table_base,
+ mv_table_size * 2 * sizeof(int16_t), fail);
+ FF_ALLOCZ_OR_GOTO(s->avctx, s->b_bidir_back_mv_table_base,
+ mv_table_size * 2 * sizeof(int16_t), fail);
+ FF_ALLOCZ_OR_GOTO(s->avctx, s->b_direct_mv_table_base,
+ mv_table_size * 2 * sizeof(int16_t), fail);
+ s->p_mv_table = s->p_mv_table_base + s->mb_stride + 1;
+ s->b_forw_mv_table = s->b_forw_mv_table_base + s->mb_stride + 1;
+ s->b_back_mv_table = s->b_back_mv_table_base + s->mb_stride + 1;
+ s->b_bidir_forw_mv_table = s->b_bidir_forw_mv_table_base +
+ s->mb_stride + 1;
+ s->b_bidir_back_mv_table = s->b_bidir_back_mv_table_base +
+ s->mb_stride + 1;
+ s->b_direct_mv_table = s->b_direct_mv_table_base + s->mb_stride + 1;
+
+ /* Allocate MB type table */
+ FF_ALLOCZ_OR_GOTO(s->avctx, s->mb_type, mb_array_size *
+ sizeof(uint16_t), fail); // needed for encoding
+
+ FF_ALLOCZ_OR_GOTO(s->avctx, s->lambda_table, mb_array_size *
+ sizeof(int), fail);
+
+ FF_ALLOC_OR_GOTO(s->avctx, s->cplx_tab,
+ mb_array_size * sizeof(float), fail);
+ FF_ALLOC_OR_GOTO(s->avctx, s->bits_tab,
+ mb_array_size * sizeof(float), fail);
+
+ }
+
+ FF_ALLOC_OR_GOTO(s->avctx, s->er_temp_buffer,
+ mb_array_size * sizeof(uint8_t), fail);
+ FF_ALLOCZ_OR_GOTO(s->avctx, s->error_status_table,
+ mb_array_size * sizeof(uint8_t), fail);
+
+ if (s->codec_id == AV_CODEC_ID_MPEG4 ||
+ (s->flags & CODEC_FLAG_INTERLACED_ME)) {
+ /* interlaced direct mode decoding tables */
+ for (i = 0; i < 2; i++) {
+ int j, k;
+ for (j = 0; j < 2; j++) {
+ for (k = 0; k < 2; k++) {
+ FF_ALLOCZ_OR_GOTO(s->avctx,
+ s->b_field_mv_table_base[i][j][k],
+ mv_table_size * 2 * sizeof(int16_t),
+ fail);
+ s->b_field_mv_table[i][j][k] = s->b_field_mv_table_base[i][j][k] +
+ s->mb_stride + 1;
+ }
+ FF_ALLOCZ_OR_GOTO(s->avctx, s->b_field_select_table [i][j],
+ mb_array_size * 2 * sizeof(uint8_t), fail);
+ FF_ALLOCZ_OR_GOTO(s->avctx, s->p_field_mv_table_base[i][j],
+ mv_table_size * 2 * sizeof(int16_t), fail);
+ s->p_field_mv_table[i][j] = s->p_field_mv_table_base[i][j]
+ + s->mb_stride + 1;
+ }
+ FF_ALLOCZ_OR_GOTO(s->avctx, s->p_field_select_table[i],
+ mb_array_size * 2 * sizeof(uint8_t), fail);
+ }
+ }
+ if (s->out_format == FMT_H263) {
+ /* cbp values */
+ FF_ALLOCZ_OR_GOTO(s->avctx, s->coded_block_base, y_size, fail);
+ s->coded_block = s->coded_block_base + s->b8_stride + 1;
+
+ /* cbp, ac_pred, pred_dir */
+ FF_ALLOCZ_OR_GOTO(s->avctx, s->cbp_table,
+ mb_array_size * sizeof(uint8_t), fail);
+ FF_ALLOCZ_OR_GOTO(s->avctx, s->pred_dir_table,
+ mb_array_size * sizeof(uint8_t), fail);
+ }
+
+ if (s->h263_pred || s->h263_plus || !s->encoding) {
+ /* dc values */
+ // MN: we need these for error resilience of intra-frames
+ FF_ALLOCZ_OR_GOTO(s->avctx, s->dc_val_base,
+ yc_size * sizeof(int16_t), fail);
+ s->dc_val[0] = s->dc_val_base + s->b8_stride + 1;
+ s->dc_val[1] = s->dc_val_base + y_size + s->mb_stride + 1;
+ s->dc_val[2] = s->dc_val[1] + c_size;
+ for (i = 0; i < yc_size; i++)
+ s->dc_val_base[i] = 1024;
+ }
+
+ /* which mb is a intra block */
+ FF_ALLOCZ_OR_GOTO(s->avctx, s->mbintra_table, mb_array_size, fail);
+ memset(s->mbintra_table, 1, mb_array_size);
+
+ /* init macroblock skip table */
+ FF_ALLOCZ_OR_GOTO(s->avctx, s->mbskip_table, mb_array_size + 2, fail);
+ // Note the + 1 is for a quicker mpeg4 slice_end detection
+
+ if ((s->avctx->debug & (FF_DEBUG_VIS_QP | FF_DEBUG_VIS_MB_TYPE)) ||
+ s->avctx->debug_mv) {
+ s->visualization_buffer[0] = av_malloc((s->mb_width * 16 +
+ 2 * EDGE_WIDTH) * s->mb_height * 16 + 2 * EDGE_WIDTH);
+ s->visualization_buffer[1] = av_malloc((s->mb_width * 16 +
+ 2 * EDGE_WIDTH) * s->mb_height * 16 + 2 * EDGE_WIDTH);
+ s->visualization_buffer[2] = av_malloc((s->mb_width * 16 +
+ 2 * EDGE_WIDTH) * s->mb_height * 16 + 2 * EDGE_WIDTH);
+ }
+
+ return 0;
+fail:
+ return AVERROR(ENOMEM);
}
/**
* init common structure for both encoder and decoder.
* this assumes that some variables like width/height are already set
*/
-av_cold int MPV_common_init(MpegEncContext *s)
+av_cold int ff_MPV_common_init(MpegEncContext *s)
{
- int y_size, c_size, yc_size, i, mb_array_size, mv_table_size, x, y;
+ int i;
int nb_slices = (HAVE_THREADS &&
s->avctx->active_thread_type & FF_THREAD_SLICE) ?
s->avctx->thread_count : 1;
@@ -665,14 +883,14 @@ av_cold int MPV_common_init(MpegEncContext *s)
if (s->encoding && s->avctx->slices)
nb_slices = s->avctx->slices;
- if (s->codec_id == CODEC_ID_MPEG2VIDEO && !s->progressive_sequence)
+ if (s->codec_id == AV_CODEC_ID_MPEG2VIDEO && !s->progressive_sequence)
s->mb_height = (s->height + 31) / 32 * 2;
- else if (s->codec_id != CODEC_ID_H264)
+ else if (s->codec_id != AV_CODEC_ID_H264)
s->mb_height = (s->height + 15) / 16;
- if (s->avctx->pix_fmt == PIX_FMT_NONE) {
+ if (s->avctx->pix_fmt == AV_PIX_FMT_NONE) {
av_log(s->avctx, AV_LOG_ERROR,
- "decoding to PIX_FMT_NONE is not supported.\n");
+ "decoding to AV_PIX_FMT_NONE is not supported.\n");
return -1;
}
@@ -697,78 +915,19 @@ av_cold int MPV_common_init(MpegEncContext *s)
s->flags2 = s->avctx->flags2;
if (s->width && s->height) {
- s->mb_width = (s->width + 15) / 16;
- s->mb_stride = s->mb_width + 1;
- s->b8_stride = s->mb_width * 2 + 1;
- s->b4_stride = s->mb_width * 4 + 1;
- mb_array_size = s->mb_height * s->mb_stride;
- mv_table_size = (s->mb_height + 2) * s->mb_stride + 1;
-
/* set chroma shifts */
- avcodec_get_chroma_sub_sample(s->avctx->pix_fmt, &s->chroma_x_shift,
- &s->chroma_y_shift);
-
- /* set default edge pos, will be overriden
- * in decode_header if needed */
- s->h_edge_pos = s->mb_width * 16;
- s->v_edge_pos = s->mb_height * 16;
-
- s->mb_num = s->mb_width * s->mb_height;
-
- s->block_wrap[0] =
- s->block_wrap[1] =
- s->block_wrap[2] =
- s->block_wrap[3] = s->b8_stride;
- s->block_wrap[4] =
- s->block_wrap[5] = s->mb_stride;
-
- y_size = s->b8_stride * (2 * s->mb_height + 1);
- c_size = s->mb_stride * (s->mb_height + 1);
- yc_size = y_size + 2 * c_size;
+ av_pix_fmt_get_chroma_sub_sample(s->avctx->pix_fmt,
+ &s->chroma_x_shift,
+ &s->chroma_y_shift);
/* convert fourcc to upper case */
s->codec_tag = avpriv_toupper4(s->avctx->codec_tag);
s->stream_codec_tag = avpriv_toupper4(s->avctx->stream_codec_tag);
- s->avctx->coded_frame = (AVFrame *)&s->current_picture;
-
- FF_ALLOCZ_OR_GOTO(s->avctx, s->mb_index2xy, (s->mb_num + 1) * sizeof(int),
- fail); // error ressilience code looks cleaner with this
- for (y = 0; y < s->mb_height; y++)
- for (x = 0; x < s->mb_width; x++)
- s->mb_index2xy[x + y * s->mb_width] = x + y * s->mb_stride;
-
- s->mb_index2xy[s->mb_height * s->mb_width] =
- (s->mb_height - 1) * s->mb_stride + s->mb_width; // FIXME really needed?
+ s->avctx->coded_frame = &s->current_picture.f;
if (s->encoding) {
- /* Allocate MV tables */
- FF_ALLOCZ_OR_GOTO(s->avctx, s->p_mv_table_base,
- mv_table_size * 2 * sizeof(int16_t), fail);
- FF_ALLOCZ_OR_GOTO(s->avctx, s->b_forw_mv_table_base,
- mv_table_size * 2 * sizeof(int16_t), fail);
- FF_ALLOCZ_OR_GOTO(s->avctx, s->b_back_mv_table_base,
- mv_table_size * 2 * sizeof(int16_t), fail);
- FF_ALLOCZ_OR_GOTO(s->avctx, s->b_bidir_forw_mv_table_base,
- mv_table_size * 2 * sizeof(int16_t), fail);
- FF_ALLOCZ_OR_GOTO(s->avctx, s->b_bidir_back_mv_table_base,
- mv_table_size * 2 * sizeof(int16_t), fail);
- FF_ALLOCZ_OR_GOTO(s->avctx, s->b_direct_mv_table_base,
- mv_table_size * 2 * sizeof(int16_t), fail);
- s->p_mv_table = s->p_mv_table_base +
- s->mb_stride + 1;
- s->b_forw_mv_table = s->b_forw_mv_table_base +
- s->mb_stride + 1;
- s->b_back_mv_table = s->b_back_mv_table_base +
- s->mb_stride + 1;
- s->b_bidir_forw_mv_table = s->b_bidir_forw_mv_table_base +
- s->mb_stride + 1;
- s->b_bidir_back_mv_table = s->b_bidir_back_mv_table_base +
- s->mb_stride + 1;
- s->b_direct_mv_table = s->b_direct_mv_table_base +
- s->mb_stride + 1;
-
if (s->msmpeg4_version) {
FF_ALLOCZ_OR_GOTO(s->avctx, s->ac_stats,
2 * 2 * (MAX_LEVEL + 1) *
@@ -776,13 +935,6 @@ av_cold int MPV_common_init(MpegEncContext *s)
}
FF_ALLOCZ_OR_GOTO(s->avctx, s->avctx->stats_out, 256, fail);
- /* Allocate MB type table */
- FF_ALLOCZ_OR_GOTO(s->avctx, s->mb_type, mb_array_size *
- sizeof(uint16_t), fail); // needed for encoding
-
- FF_ALLOCZ_OR_GOTO(s->avctx, s->lambda_table, mb_array_size *
- sizeof(int), fail);
-
FF_ALLOCZ_OR_GOTO(s->avctx, s->q_intra_matrix,
64 * 32 * sizeof(int), fail);
FF_ALLOCZ_OR_GOTO(s->avctx, s->q_inter_matrix,
@@ -807,83 +959,14 @@ av_cold int MPV_common_init(MpegEncContext *s)
FF_ALLOCZ_OR_GOTO(s->avctx, s->picture,
s->picture_count * sizeof(Picture), fail);
for (i = 0; i < s->picture_count; i++) {
- avcodec_get_frame_defaults((AVFrame *) &s->picture[i]);
+ avcodec_get_frame_defaults(&s->picture[i].f);
}
if (s->width && s->height) {
- FF_ALLOCZ_OR_GOTO(s->avctx, s->error_status_table,
- mb_array_size * sizeof(uint8_t), fail);
-
- if (s->codec_id == CODEC_ID_MPEG4 ||
- (s->flags & CODEC_FLAG_INTERLACED_ME)) {
- /* interlaced direct mode decoding tables */
- for (i = 0; i < 2; i++) {
- int j, k;
- for (j = 0; j < 2; j++) {
- for (k = 0; k < 2; k++) {
- FF_ALLOCZ_OR_GOTO(s->avctx,
- s->b_field_mv_table_base[i][j][k],
- mv_table_size * 2 * sizeof(int16_t),
- fail);
- s->b_field_mv_table[i][j][k] = s->b_field_mv_table_base[i][j][k] +
- s->mb_stride + 1;
- }
- FF_ALLOCZ_OR_GOTO(s->avctx, s->b_field_select_table [i][j],
- mb_array_size * 2 * sizeof(uint8_t),
- fail);
- FF_ALLOCZ_OR_GOTO(s->avctx, s->p_field_mv_table_base[i][j],
- mv_table_size * 2 * sizeof(int16_t),
- fail);
- s->p_field_mv_table[i][j] = s->p_field_mv_table_base[i][j]
- + s->mb_stride + 1;
- }
- FF_ALLOCZ_OR_GOTO(s->avctx, s->p_field_select_table[i],
- mb_array_size * 2 * sizeof(uint8_t),
- fail);
- }
- }
- if (s->out_format == FMT_H263) {
- /* cbp values */
- FF_ALLOCZ_OR_GOTO(s->avctx, s->coded_block_base, y_size, fail);
- s->coded_block = s->coded_block_base + s->b8_stride + 1;
-
- /* cbp, ac_pred, pred_dir */
- FF_ALLOCZ_OR_GOTO(s->avctx, s->cbp_table,
- mb_array_size * sizeof(uint8_t), fail);
- FF_ALLOCZ_OR_GOTO(s->avctx, s->pred_dir_table,
- mb_array_size * sizeof(uint8_t), fail);
- }
-
- if (s->h263_pred || s->h263_plus || !s->encoding) {
- /* dc values */
- // MN: we need these for error resilience of intra-frames
- FF_ALLOCZ_OR_GOTO(s->avctx, s->dc_val_base,
- yc_size * sizeof(int16_t), fail);
- s->dc_val[0] = s->dc_val_base + s->b8_stride + 1;
- s->dc_val[1] = s->dc_val_base + y_size + s->mb_stride + 1;
- s->dc_val[2] = s->dc_val[1] + c_size;
- for (i = 0; i < yc_size; i++)
- s->dc_val_base[i] = 1024;
- }
-
- /* which mb is a intra block */
- FF_ALLOCZ_OR_GOTO(s->avctx, s->mbintra_table, mb_array_size, fail);
- memset(s->mbintra_table, 1, mb_array_size);
-
- /* init macroblock skip table */
- FF_ALLOCZ_OR_GOTO(s->avctx, s->mbskip_table, mb_array_size + 2, fail);
- // Note the + 1 is for a quicker mpeg4 slice_end detection
+ if (init_context_frame(s))
+ goto fail;
s->parse_context.state = -1;
- if ((s->avctx->debug & (FF_DEBUG_VIS_QP | FF_DEBUG_VIS_MB_TYPE)) ||
- s->avctx->debug_mv) {
- s->visualization_buffer[0] = av_malloc((s->mb_width * 16 +
- 2 * EDGE_WIDTH) * s->mb_height * 16 + 2 * EDGE_WIDTH);
- s->visualization_buffer[1] = av_malloc((s->mb_width * 16 +
- 2 * EDGE_WIDTH) * s->mb_height * 16 + 2 * EDGE_WIDTH);
- s->visualization_buffer[2] = av_malloc((s->mb_width * 16 +
- 2 * EDGE_WIDTH) * s->mb_height * 16 + 2 * EDGE_WIDTH);
- }
}
s->context_initialized = 1;
@@ -915,28 +998,19 @@ av_cold int MPV_common_init(MpegEncContext *s)
return 0;
fail:
- MPV_common_end(s);
+ ff_MPV_common_end(s);
return -1;
}
-/* init common structure for both encoder and decoder */
-void MPV_common_end(MpegEncContext *s)
+/**
+ * Frees and resets MpegEncContext fields depending on the resolution.
+ * Is used during resolution changes to avoid a full reinitialization of the
+ * codec.
+ */
+static int free_context_frame(MpegEncContext *s)
{
int i, j, k;
- if (s->slice_context_count > 1) {
- for (i = 0; i < s->slice_context_count; i++) {
- free_duplicate_context(s->thread_context[i]);
- }
- for (i = 1; i < s->slice_context_count; i++) {
- av_freep(&s->thread_context[i]);
- }
- s->slice_context_count = 1;
- } else free_duplicate_context(s);
-
- av_freep(&s->parse_context.buffer);
- s->parse_context.buffer_size = 0;
-
av_freep(&s->mb_type);
av_freep(&s->p_mv_table_base);
av_freep(&s->b_forw_mv_table_base);
@@ -970,14 +1044,117 @@ void MPV_common_end(MpegEncContext *s)
av_freep(&s->pred_dir_table);
av_freep(&s->mbskip_table);
+
+ av_freep(&s->error_status_table);
+ av_freep(&s->er_temp_buffer);
+ av_freep(&s->mb_index2xy);
+ av_freep(&s->lambda_table);
+ av_freep(&s->cplx_tab);
+ av_freep(&s->bits_tab);
+
+ s->linesize = s->uvlinesize = 0;
+
+ for (i = 0; i < 3; i++)
+ av_freep(&s->visualization_buffer[i]);
+
+ return 0;
+}
+
+int ff_MPV_common_frame_size_change(MpegEncContext *s)
+{
+ int i, err = 0;
+
+ if (s->slice_context_count > 1) {
+ for (i = 0; i < s->slice_context_count; i++) {
+ free_duplicate_context(s->thread_context[i]);
+ }
+ for (i = 1; i < s->slice_context_count; i++) {
+ av_freep(&s->thread_context[i]);
+ }
+ } else
+ free_duplicate_context(s);
+
+ free_context_frame(s);
+
+ if (s->picture)
+ for (i = 0; i < s->picture_count; i++) {
+ s->picture[i].needs_realloc = 1;
+ }
+
+ s->last_picture_ptr =
+ s->next_picture_ptr =
+ s->current_picture_ptr = NULL;
+
+ // init
+ if (s->codec_id == AV_CODEC_ID_MPEG2VIDEO && !s->progressive_sequence)
+ s->mb_height = (s->height + 31) / 32 * 2;
+ else if (s->codec_id != AV_CODEC_ID_H264)
+ s->mb_height = (s->height + 15) / 16;
+
+ if ((s->width || s->height) &&
+ av_image_check_size(s->width, s->height, 0, s->avctx))
+ return AVERROR_INVALIDDATA;
+
+ if ((err = init_context_frame(s)))
+ goto fail;
+
+ s->thread_context[0] = s;
+
+ if (s->width && s->height) {
+ int nb_slices = s->slice_context_count;
+ if (nb_slices > 1) {
+ for (i = 1; i < nb_slices; i++) {
+ s->thread_context[i] = av_malloc(sizeof(MpegEncContext));
+ memcpy(s->thread_context[i], s, sizeof(MpegEncContext));
+ }
+
+ for (i = 0; i < nb_slices; i++) {
+ if (init_duplicate_context(s->thread_context[i], s) < 0)
+ goto fail;
+ s->thread_context[i]->start_mb_y =
+ (s->mb_height * (i) + nb_slices / 2) / nb_slices;
+ s->thread_context[i]->end_mb_y =
+ (s->mb_height * (i + 1) + nb_slices / 2) / nb_slices;
+ }
+ } else {
+ if (init_duplicate_context(s, s) < 0)
+ goto fail;
+ s->start_mb_y = 0;
+ s->end_mb_y = s->mb_height;
+ }
+ s->slice_context_count = nb_slices;
+ }
+
+ return 0;
+ fail:
+ ff_MPV_common_end(s);
+ return err;
+}
+
+/* init common structure for both encoder and decoder */
+void ff_MPV_common_end(MpegEncContext *s)
+{
+ int i;
+
+ if (s->slice_context_count > 1) {
+ for (i = 0; i < s->slice_context_count; i++) {
+ free_duplicate_context(s->thread_context[i]);
+ }
+ for (i = 1; i < s->slice_context_count; i++) {
+ av_freep(&s->thread_context[i]);
+ }
+ s->slice_context_count = 1;
+ } else free_duplicate_context(s);
+
+ av_freep(&s->parse_context.buffer);
+ s->parse_context.buffer_size = 0;
+
av_freep(&s->bitstream_buffer);
s->allocated_bitstream_buffer_size = 0;
av_freep(&s->avctx->stats_out);
av_freep(&s->ac_stats);
- av_freep(&s->error_status_table);
- av_freep(&s->mb_index2xy);
- av_freep(&s->lambda_table);
+
av_freep(&s->q_intra_matrix);
av_freep(&s->q_inter_matrix);
av_freep(&s->q_intra_matrix16);
@@ -992,17 +1169,17 @@ void MPV_common_end(MpegEncContext *s)
}
}
av_freep(&s->picture);
+
+ free_context_frame(s);
+
+ if (!(s->avctx->active_thread_type & FF_THREAD_FRAME))
+ avcodec_default_free_buffers(s->avctx);
+
s->context_initialized = 0;
s->last_picture_ptr =
s->next_picture_ptr =
s->current_picture_ptr = NULL;
s->linesize = s->uvlinesize = 0;
-
- for (i = 0; i < 3; i++)
- av_freep(&s->visualization_buffer[i]);
-
- if (!(s->avctx->active_thread_type & FF_THREAD_FRAME))
- avcodec_default_free_buffers(s->avctx);
}
void ff_init_rl(RLTable *rl,
@@ -1112,7 +1289,17 @@ void ff_release_unused_pictures(MpegEncContext*s, int remove_current)
}
}
-int ff_find_unused_picture(MpegEncContext *s, int shared)
+static inline int pic_is_unused(MpegEncContext *s, Picture *pic)
+{
+ if (pic->f.data[0] == NULL)
+ return 1;
+ if (pic->needs_realloc && !(pic->f.reference & DELAYED_PIC_REF))
+ if (!pic->owner2 || pic->owner2 == s)
+ return 1;
+ return 0;
+}
+
+static int find_unused_picture(MpegEncContext *s, int shared)
{
int i;
@@ -1123,11 +1310,11 @@ int ff_find_unused_picture(MpegEncContext *s, int shared)
}
} else {
for (i = s->picture_range_start; i < s->picture_range_end; i++) {
- if (s->picture[i].f.data[0] == NULL && s->picture[i].f.type != 0)
+ if (pic_is_unused(s, &s->picture[i]) && s->picture[i].f.type != 0)
return i; // FIXME
}
for (i = s->picture_range_start; i < s->picture_range_end; i++) {
- if (s->picture[i].f.data[0] == NULL)
+ if (pic_is_unused(s, &s->picture[i]))
return i;
}
}
@@ -1135,6 +1322,20 @@ int ff_find_unused_picture(MpegEncContext *s, int shared)
return AVERROR_INVALIDDATA;
}
+int ff_find_unused_picture(MpegEncContext *s, int shared)
+{
+ int ret = find_unused_picture(s, shared);
+
+ if (ret >= 0 && ret < s->picture_range_end) {
+ if (s->picture[ret].needs_realloc) {
+ s->picture[ret].needs_realloc = 0;
+ free_picture(s, &s->picture[ret]);
+ avcodec_get_frame_defaults(&s->picture[ret].f);
+ }
+ }
+ return ret;
+}
+
static void update_noise_reduction(MpegEncContext *s)
{
int intra, i;
@@ -1160,17 +1361,14 @@ static void update_noise_reduction(MpegEncContext *s)
* generic function for encode/decode called after coding/decoding
* the header and before a frame is coded/decoded.
*/
-int MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx)
+int ff_MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx)
{
int i;
Picture *pic;
s->mb_skipped = 0;
- assert(s->last_picture_ptr == NULL || s->out_format != FMT_H264 ||
- s->codec_id == CODEC_ID_SVQ3);
-
/* mark & release old frames */
- if (s->out_format != FMT_H264 || s->codec_id == CODEC_ID_SVQ3) {
+ if (s->out_format != FMT_H264 || s->codec_id == AV_CODEC_ID_SVQ3) {
if (s->pict_type != AV_PICTURE_TYPE_B && s->last_picture_ptr &&
s->last_picture_ptr != s->next_picture_ptr &&
s->last_picture_ptr->f.data[0]) {
@@ -1185,7 +1383,7 @@ int MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx)
if (s->picture[i].owner2 == s && s->picture[i].f.data[0] &&
&s->picture[i] != s->last_picture_ptr &&
&s->picture[i] != s->next_picture_ptr &&
- s->picture[i].f.reference) {
+ s->picture[i].f.reference && !s->picture[i].needs_realloc) {
if (!(avctx->active_thread_type & FF_THREAD_FRAME))
av_log(avctx, AV_LOG_ERROR,
"releasing zombie picture\n");
@@ -1205,12 +1403,16 @@ int MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx)
pic = s->current_picture_ptr;
} else {
i = ff_find_unused_picture(s, 0);
+ if (i < 0) {
+ av_log(s->avctx, AV_LOG_ERROR, "no frame buffer available\n");
+ return i;
+ }
pic = &s->picture[i];
}
pic->f.reference = 0;
- if (!s->dropable) {
- if (s->codec_id == CODEC_ID_H264)
+ if (!s->droppable) {
+ if (s->codec_id == AV_CODEC_ID_H264)
pic->f.reference = s->picture_structure;
else if (s->pict_type != AV_PICTURE_TYPE_B)
pic->f.reference = 3;
@@ -1224,8 +1426,8 @@ int MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx)
s->current_picture_ptr = pic;
// FIXME use only the vars from current_pic
s->current_picture_ptr->f.top_field_first = s->top_field_first;
- if (s->codec_id == CODEC_ID_MPEG1VIDEO ||
- s->codec_id == CODEC_ID_MPEG2VIDEO) {
+ if (s->codec_id == AV_CODEC_ID_MPEG1VIDEO ||
+ s->codec_id == AV_CODEC_ID_MPEG2VIDEO) {
if (s->picture_structure != PICT_FRAME)
s->current_picture_ptr->f.top_field_first =
(s->picture_structure == PICT_TOP_FIELD) == s->first_field;
@@ -1244,17 +1446,17 @@ int MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx)
if (s->pict_type != AV_PICTURE_TYPE_B) {
s->last_picture_ptr = s->next_picture_ptr;
- if (!s->dropable)
+ if (!s->droppable)
s->next_picture_ptr = s->current_picture_ptr;
}
- /* av_log(s->avctx, AV_LOG_DEBUG, "L%p N%p C%p L%p N%p C%p type:%d drop:%d\n",
- s->last_picture_ptr, s->next_picture_ptr,s->current_picture_ptr,
- s->last_picture_ptr ? s->last_picture_ptr->f.data[0] : NULL,
- s->next_picture_ptr ? s->next_picture_ptr->f.data[0] : NULL,
- s->current_picture_ptr ? s->current_picture_ptr->f.data[0] : NULL,
- s->pict_type, s->dropable); */
+ av_dlog(s->avctx, "L%p N%p C%p L%p N%p C%p type:%d drop:%d\n",
+ s->last_picture_ptr, s->next_picture_ptr,s->current_picture_ptr,
+ s->last_picture_ptr ? s->last_picture_ptr->f.data[0] : NULL,
+ s->next_picture_ptr ? s->next_picture_ptr->f.data[0] : NULL,
+ s->current_picture_ptr ? s->current_picture_ptr->f.data[0] : NULL,
+ s->pict_type, s->droppable);
- if (s->codec_id != CODEC_ID_H264) {
+ if (s->codec_id != AV_CODEC_ID_H264) {
if ((s->last_picture_ptr == NULL ||
s->last_picture_ptr->f.data[0] == NULL) &&
(s->pict_type != AV_PICTURE_TYPE_I ||
@@ -1268,26 +1470,36 @@ int MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx)
/* Allocate a dummy frame */
i = ff_find_unused_picture(s, 0);
+ if (i < 0) {
+ av_log(s->avctx, AV_LOG_ERROR, "no frame buffer available\n");
+ return i;
+ }
s->last_picture_ptr = &s->picture[i];
- if (ff_alloc_picture(s, s->last_picture_ptr, 0) < 0)
+ if (ff_alloc_picture(s, s->last_picture_ptr, 0) < 0) {
+ s->last_picture_ptr = NULL;
return -1;
- ff_thread_report_progress((AVFrame *) s->last_picture_ptr,
- INT_MAX, 0);
- ff_thread_report_progress((AVFrame *) s->last_picture_ptr,
- INT_MAX, 1);
+ }
+ ff_thread_report_progress(&s->last_picture_ptr->f, INT_MAX, 0);
+ ff_thread_report_progress(&s->last_picture_ptr->f, INT_MAX, 1);
+ s->last_picture_ptr->f.reference = 3;
}
if ((s->next_picture_ptr == NULL ||
s->next_picture_ptr->f.data[0] == NULL) &&
s->pict_type == AV_PICTURE_TYPE_B) {
/* Allocate a dummy frame */
i = ff_find_unused_picture(s, 0);
+ if (i < 0) {
+ av_log(s->avctx, AV_LOG_ERROR, "no frame buffer available\n");
+ return i;
+ }
s->next_picture_ptr = &s->picture[i];
- if (ff_alloc_picture(s, s->next_picture_ptr, 0) < 0)
+ if (ff_alloc_picture(s, s->next_picture_ptr, 0) < 0) {
+ s->next_picture_ptr = NULL;
return -1;
- ff_thread_report_progress((AVFrame *) s->next_picture_ptr,
- INT_MAX, 0);
- ff_thread_report_progress((AVFrame *) s->next_picture_ptr,
- INT_MAX, 1);
+ }
+ ff_thread_report_progress(&s->next_picture_ptr->f, INT_MAX, 0);
+ ff_thread_report_progress(&s->next_picture_ptr->f, INT_MAX, 1);
+ s->next_picture_ptr->f.reference = 3;
}
}
@@ -1296,8 +1508,7 @@ int MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx)
if (s->next_picture_ptr)
ff_copy_picture(&s->next_picture, s->next_picture_ptr);
- if (HAVE_THREADS && (avctx->active_thread_type & FF_THREAD_FRAME) &&
- (s->out_format != FMT_H264 || s->codec_id == CODEC_ID_SVQ3)) {
+ if (HAVE_THREADS && (avctx->active_thread_type & FF_THREAD_FRAME)) {
if (s->next_picture_ptr)
s->next_picture_ptr->owner2 = s;
if (s->last_picture_ptr)
@@ -1325,7 +1536,7 @@ int MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx)
/* set dequantizer, we can't do it during init as
* it might change for mpeg4 and we can't do it in the header
* decode as init is not called for mpeg4 there yet */
- if (s->mpeg_quant || s->codec_id == CODEC_ID_MPEG2VIDEO) {
+ if (s->mpeg_quant || s->codec_id == AV_CODEC_ID_MPEG2VIDEO) {
s->dct_unquantize_intra = s->dct_unquantize_mpeg2_intra;
s->dct_unquantize_inter = s->dct_unquantize_mpeg2_inter;
} else if (s->out_format == FMT_H263 || s->out_format == FMT_H261) {
@@ -1349,7 +1560,7 @@ int MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx)
/* generic function for encode/decode called after a
* frame has been coded/decoded. */
-void MPV_frame_end(MpegEncContext *s)
+void ff_MPV_frame_end(MpegEncContext *s)
{
int i;
/* redraw edges for the frame if decoding didn't complete */
@@ -1363,20 +1574,21 @@ void MPV_frame_end(MpegEncContext *s)
s->current_picture.f.reference &&
!s->intra_only &&
!(s->flags & CODEC_FLAG_EMU_EDGE)) {
- int hshift = av_pix_fmt_descriptors[s->avctx->pix_fmt].log2_chroma_w;
- int vshift = av_pix_fmt_descriptors[s->avctx->pix_fmt].log2_chroma_h;
- s->dsp.draw_edges(s->current_picture.f.data[0], s->linesize,
- s->h_edge_pos, s->v_edge_pos,
- EDGE_WIDTH, EDGE_WIDTH,
- EDGE_TOP | EDGE_BOTTOM);
- s->dsp.draw_edges(s->current_picture.f.data[1], s->uvlinesize,
- s->h_edge_pos >> hshift, s->v_edge_pos >> vshift,
- EDGE_WIDTH >> hshift, EDGE_WIDTH >> vshift,
- EDGE_TOP | EDGE_BOTTOM);
- s->dsp.draw_edges(s->current_picture.f.data[2], s->uvlinesize,
- s->h_edge_pos >> hshift, s->v_edge_pos >> vshift,
- EDGE_WIDTH >> hshift, EDGE_WIDTH >> vshift,
- EDGE_TOP | EDGE_BOTTOM);
+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(s->avctx->pix_fmt);
+ int hshift = desc->log2_chroma_w;
+ int vshift = desc->log2_chroma_h;
+ s->dsp.draw_edges(s->current_picture.f.data[0], s->linesize,
+ s->h_edge_pos, s->v_edge_pos,
+ EDGE_WIDTH, EDGE_WIDTH,
+ EDGE_TOP | EDGE_BOTTOM);
+ s->dsp.draw_edges(s->current_picture.f.data[1], s->uvlinesize,
+ s->h_edge_pos >> hshift, s->v_edge_pos >> vshift,
+ EDGE_WIDTH >> hshift, EDGE_WIDTH >> vshift,
+ EDGE_TOP | EDGE_BOTTOM);
+ s->dsp.draw_edges(s->current_picture.f.data[2], s->uvlinesize,
+ s->h_edge_pos >> hshift, s->v_edge_pos >> vshift,
+ EDGE_WIDTH >> hshift, EDGE_WIDTH >> vshift,
+ EDGE_TOP | EDGE_BOTTOM);
}
emms_c();
@@ -1412,10 +1624,10 @@ void MPV_frame_end(MpegEncContext *s)
memset(&s->next_picture, 0, sizeof(Picture));
memset(&s->current_picture, 0, sizeof(Picture));
#endif
- s->avctx->coded_frame = (AVFrame *) s->current_picture_ptr;
+ s->avctx->coded_frame = &s->current_picture_ptr->f;
- if (s->codec_id != CODEC_ID_H264 && s->current_picture.f.reference) {
- ff_thread_report_progress((AVFrame *) s->current_picture_ptr, INT_MAX, 0);
+ if (s->codec_id != AV_CODEC_ID_H264 && s->current_picture.f.reference) {
+ ff_thread_report_progress(&s->current_picture_ptr->f, INT_MAX, 0);
}
}
@@ -1446,7 +1658,7 @@ static void draw_line(uint8_t *buf, int sx, int sy, int ex, int ey,
buf += sx + sy * stride;
ex -= sx;
f = ((ey - sy) << 16) / ex;
- for (x = 0; x = ex; x++) {
+ for (x = 0; x <= ex; x++) {
y = (x * f) >> 16;
fr = (x * f) & 0xFFFF;
buf[y * stride + x] += (color * (0x10000 - fr)) >> 16;
@@ -1599,7 +1811,6 @@ void ff_print_debug_info(MpegEncContext *s, AVFrame *pict)
else
av_log(s->avctx, AV_LOG_DEBUG, " ");
}
- // av_log(s->avctx, AV_LOG_DEBUG, " ");
}
av_log(s->avctx, AV_LOG_DEBUG, "\n");
}
@@ -1616,11 +1827,11 @@ void ff_print_debug_info(MpegEncContext *s, AVFrame *pict)
const int height = s->avctx->height;
const int mv_sample_log2 = 4 - pict->motion_subsample_log2;
const int mv_stride = (s->mb_width << mv_sample_log2) +
- (s->codec_id == CODEC_ID_H264 ? 0 : 1);
+ (s->codec_id == AV_CODEC_ID_H264 ? 0 : 1);
s->low_delay = 0; // needed to see the vectors without trashing the buffers
- avcodec_get_chroma_sub_sample(s->avctx->pix_fmt,
- &h_chroma_shift, &v_chroma_shift);
+ av_pix_fmt_get_chroma_sub_sample(s->avctx->pix_fmt,
+ &h_chroma_shift, &v_chroma_shift);
for (i = 0; i < 3; i++) {
memcpy(s->visualization_buffer[i], pict->data[i],
(i == 0) ? pict->linesize[i] * height:
@@ -1805,7 +2016,7 @@ void ff_print_debug_info(MpegEncContext *s, AVFrame *pict)
}
if (IS_INTERLACED(mb_type) &&
- s->codec_id == CODEC_ID_H264) {
+ s->codec_id == AV_CODEC_ID_H264) {
// hmm
}
}
@@ -1815,373 +2026,16 @@ void ff_print_debug_info(MpegEncContext *s, AVFrame *pict)
}
}
-static inline int hpel_motion_lowres(MpegEncContext *s,
- uint8_t *dest, uint8_t *src,
- int field_based, int field_select,
- int src_x, int src_y,
- int width, int height, int stride,
- int h_edge_pos, int v_edge_pos,
- int w, int h, h264_chroma_mc_func *pix_op,
- int motion_x, int motion_y)
-{
- const int lowres = s->avctx->lowres;
- const int op_index = FFMIN(lowres, 2);
- const int s_mask = (2 << lowres) - 1;
- int emu = 0;
- int sx, sy;
-
- if (s->quarter_sample) {
- motion_x /= 2;
- motion_y /= 2;
- }
-
- sx = motion_x & s_mask;
- sy = motion_y & s_mask;
- src_x += motion_x >> lowres + 1;
- src_y += motion_y >> lowres + 1;
-
- src += src_y * stride + src_x;
-
- if ((unsigned)src_x > FFMAX( h_edge_pos - (!!sx) - w, 0) ||
- (unsigned)src_y > FFMAX((v_edge_pos >> field_based) - (!!sy) - h, 0)) {
- s->dsp.emulated_edge_mc(s->edge_emu_buffer, src, s->linesize, w + 1,
- (h + 1) << field_based, src_x,
- src_y << field_based,
- h_edge_pos,
- v_edge_pos);
- src = s->edge_emu_buffer;
- emu = 1;
- }
-
- sx = (sx << 2) >> lowres;
- sy = (sy << 2) >> lowres;
- if (field_select)
- src += s->linesize;
- pix_op[op_index](dest, src, stride, h, sx, sy);
- return emu;
-}
-
-/* apply one mpeg motion vector to the three components */
-static av_always_inline void mpeg_motion_lowres(MpegEncContext *s,
- uint8_t *dest_y,
- uint8_t *dest_cb,
- uint8_t *dest_cr,
- int field_based,
- int bottom_field,
- int field_select,
- uint8_t **ref_picture,
- h264_chroma_mc_func *pix_op,
- int motion_x, int motion_y,
- int h, int mb_y)
-{
- uint8_t *ptr_y, *ptr_cb, *ptr_cr;
- int mx, my, src_x, src_y, uvsrc_x, uvsrc_y, uvlinesize, linesize, sx, sy,
- uvsx, uvsy;
- const int lowres = s->avctx->lowres;
- const int op_index = FFMIN(lowres, 2);
- const int block_s = 8>>lowres;
- const int s_mask = (2 << lowres) - 1;
- const int h_edge_pos = s->h_edge_pos >> lowres;
- const int v_edge_pos = s->v_edge_pos >> lowres;
- linesize = s->current_picture.f.linesize[0] << field_based;
- uvlinesize = s->current_picture.f.linesize[1] << field_based;
-
- // FIXME obviously not perfect but qpel will not work in lowres anyway
- if (s->quarter_sample) {
- motion_x /= 2;
- motion_y /= 2;
- }
-
- if (field_based) {
- motion_y += (bottom_field - field_select) * (1 << lowres - 1);
- }
-
- sx = motion_x & s_mask;
- sy = motion_y & s_mask;
- src_x = s->mb_x * 2 * block_s + (motion_x >> lowres + 1);
- src_y = (mb_y * 2 * block_s >> field_based) + (motion_y >> lowres + 1);
-
- if (s->out_format == FMT_H263) {
- uvsx = ((motion_x >> 1) & s_mask) | (sx & 1);
- uvsy = ((motion_y >> 1) & s_mask) | (sy & 1);
- uvsrc_x = src_x >> 1;
- uvsrc_y = src_y >> 1;
- } else if (s->out_format == FMT_H261) {
- // even chroma mv's are full pel in H261
- mx = motion_x / 4;
- my = motion_y / 4;
- uvsx = (2 * mx) & s_mask;
- uvsy = (2 * my) & s_mask;
- uvsrc_x = s->mb_x * block_s + (mx >> lowres);
- uvsrc_y = mb_y * block_s + (my >> lowres);
- } else {
- mx = motion_x / 2;
- my = motion_y / 2;
- uvsx = mx & s_mask;
- uvsy = my & s_mask;
- uvsrc_x = s->mb_x * block_s + (mx >> lowres + 1);
- uvsrc_y = (mb_y * block_s >> field_based) + (my >> lowres + 1);
- }
-
- ptr_y = ref_picture[0] + src_y * linesize + src_x;
- ptr_cb = ref_picture[1] + uvsrc_y * uvlinesize + uvsrc_x;
- ptr_cr = ref_picture[2] + uvsrc_y * uvlinesize + uvsrc_x;
-
- if ((unsigned) src_x > FFMAX( h_edge_pos - (!!sx) - 2 * block_s, 0) ||
- (unsigned) src_y > FFMAX((v_edge_pos >> field_based) - (!!sy) - h, 0)) {
- s->dsp.emulated_edge_mc(s->edge_emu_buffer, ptr_y,
- s->linesize, 17, 17 + field_based,
- src_x, src_y << field_based, h_edge_pos,
- v_edge_pos);
- ptr_y = s->edge_emu_buffer;
- if (!CONFIG_GRAY || !(s->flags & CODEC_FLAG_GRAY)) {
- uint8_t *uvbuf = s->edge_emu_buffer + 18 * s->linesize;
- s->dsp.emulated_edge_mc(uvbuf , ptr_cb, s->uvlinesize, 9,
- 9 + field_based,
- uvsrc_x, uvsrc_y << field_based,
- h_edge_pos >> 1, v_edge_pos >> 1);
- s->dsp.emulated_edge_mc(uvbuf + 16, ptr_cr, s->uvlinesize, 9,
- 9 + field_based,
- uvsrc_x, uvsrc_y << field_based,
- h_edge_pos >> 1, v_edge_pos >> 1);
- ptr_cb = uvbuf;
- ptr_cr = uvbuf + 16;
- }
- }
-
- // FIXME use this for field pix too instead of the obnoxious hack which changes picture.f.data
- if (bottom_field) {
- dest_y += s->linesize;
- dest_cb += s->uvlinesize;
- dest_cr += s->uvlinesize;
- }
-
- if (field_select) {
- ptr_y += s->linesize;
- ptr_cb += s->uvlinesize;
- ptr_cr += s->uvlinesize;
- }
-
- sx = (sx << 2) >> lowres;
- sy = (sy << 2) >> lowres;
- pix_op[lowres - 1](dest_y, ptr_y, linesize, h, sx, sy);
-
- if (!CONFIG_GRAY || !(s->flags & CODEC_FLAG_GRAY)) {
- uvsx = (uvsx << 2) >> lowres;
- uvsy = (uvsy << 2) >> lowres;
- pix_op[op_index](dest_cb, ptr_cb, uvlinesize, h >> s->chroma_y_shift,
- uvsx, uvsy);
- pix_op[op_index](dest_cr, ptr_cr, uvlinesize, h >> s->chroma_y_shift,
- uvsx, uvsy);
- }
- // FIXME h261 lowres loop filter
-}
-
-static inline void chroma_4mv_motion_lowres(MpegEncContext *s,
- uint8_t *dest_cb, uint8_t *dest_cr,
- uint8_t **ref_picture,
- h264_chroma_mc_func * pix_op,
- int mx, int my)
-{
- const int lowres = s->avctx->lowres;
- const int op_index = FFMIN(lowres, 2);
- const int block_s = 8 >> lowres;
- const int s_mask = (2 << lowres) - 1;
- const int h_edge_pos = s->h_edge_pos >> lowres + 1;
- const int v_edge_pos = s->v_edge_pos >> lowres + 1;
- int emu = 0, src_x, src_y, offset, sx, sy;
- uint8_t *ptr;
-
- if (s->quarter_sample) {
- mx /= 2;
- my /= 2;
- }
-
- /* In case of 8X8, we construct a single chroma motion vector
- with a special rounding */
- mx = ff_h263_round_chroma(mx);
- my = ff_h263_round_chroma(my);
-
- sx = mx & s_mask;
- sy = my & s_mask;
- src_x = s->mb_x * block_s + (mx >> lowres + 1);
- src_y = s->mb_y * block_s + (my >> lowres + 1);
-
- offset = src_y * s->uvlinesize + src_x;
- ptr = ref_picture[1] + offset;
- if (s->flags & CODEC_FLAG_EMU_EDGE) {
- if ((unsigned) src_x > FFMAX(h_edge_pos - (!!sx) - block_s, 0) ||
- (unsigned) src_y > FFMAX(v_edge_pos - (!!sy) - block_s, 0)) {
- s->dsp.emulated_edge_mc(s->edge_emu_buffer, ptr, s->uvlinesize,
- 9, 9, src_x, src_y, h_edge_pos, v_edge_pos);
- ptr = s->edge_emu_buffer;
- emu = 1;
- }
- }
- sx = (sx << 2) >> lowres;
- sy = (sy << 2) >> lowres;
- pix_op[op_index](dest_cb, ptr, s->uvlinesize, block_s, sx, sy);
-
- ptr = ref_picture[2] + offset;
- if (emu) {
- s->dsp.emulated_edge_mc(s->edge_emu_buffer, ptr, s->uvlinesize, 9, 9,
- src_x, src_y, h_edge_pos, v_edge_pos);
- ptr = s->edge_emu_buffer;
- }
- pix_op[op_index](dest_cr, ptr, s->uvlinesize, block_s, sx, sy);
-}
-
-/**
- * motion compensation of a single macroblock
- * @param s context
- * @param dest_y luma destination pointer
- * @param dest_cb chroma cb/u destination pointer
- * @param dest_cr chroma cr/v destination pointer
- * @param dir direction (0->forward, 1->backward)
- * @param ref_picture array[3] of pointers to the 3 planes of the reference picture
- * @param pix_op halfpel motion compensation function (average or put normally)
- * the motion vectors are taken from s->mv and the MV type from s->mv_type
- */
-static inline void MPV_motion_lowres(MpegEncContext *s,
- uint8_t *dest_y, uint8_t *dest_cb,
- uint8_t *dest_cr,
- int dir, uint8_t **ref_picture,
- h264_chroma_mc_func *pix_op)
-{
- int mx, my;
- int mb_x, mb_y, i;
- const int lowres = s->avctx->lowres;
- const int block_s = 8 >>lowres;
-
- mb_x = s->mb_x;
- mb_y = s->mb_y;
-
- switch (s->mv_type) {
- case MV_TYPE_16X16:
- mpeg_motion_lowres(s, dest_y, dest_cb, dest_cr,
- 0, 0, 0,
- ref_picture, pix_op,
- s->mv[dir][0][0], s->mv[dir][0][1],
- 2 * block_s, mb_y);
- break;
- case MV_TYPE_8X8:
- mx = 0;
- my = 0;
- for (i = 0; i < 4; i++) {
- hpel_motion_lowres(s, dest_y + ((i & 1) + (i >> 1) *
- s->linesize) * block_s,
- ref_picture[0], 0, 0,
- (2 * mb_x + (i & 1)) * block_s,
- (2 * mb_y + (i >> 1)) * block_s,
- s->width, s->height, s->linesize,
- s->h_edge_pos >> lowres, s->v_edge_pos >> lowres,
- block_s, block_s, pix_op,
- s->mv[dir][i][0], s->mv[dir][i][1]);
-
- mx += s->mv[dir][i][0];
- my += s->mv[dir][i][1];
- }
-
- if (!CONFIG_GRAY || !(s->flags & CODEC_FLAG_GRAY))
- chroma_4mv_motion_lowres(s, dest_cb, dest_cr, ref_picture,
- pix_op, mx, my);
- break;
- case MV_TYPE_FIELD:
- if (s->picture_structure == PICT_FRAME) {
- /* top field */
- mpeg_motion_lowres(s, dest_y, dest_cb, dest_cr,
- 1, 0, s->field_select[dir][0],
- ref_picture, pix_op,
- s->mv[dir][0][0], s->mv[dir][0][1],
- block_s, mb_y);
- /* bottom field */
- mpeg_motion_lowres(s, dest_y, dest_cb, dest_cr,
- 1, 1, s->field_select[dir][1],
- ref_picture, pix_op,
- s->mv[dir][1][0], s->mv[dir][1][1],
- block_s, mb_y);
- } else {
- if (s->picture_structure != s->field_select[dir][0] + 1 &&
- s->pict_type != AV_PICTURE_TYPE_B && !s->first_field) {
- ref_picture = s->current_picture_ptr->f.data;
-
- }
- mpeg_motion_lowres(s, dest_y, dest_cb, dest_cr,
- 0, 0, s->field_select[dir][0],
- ref_picture, pix_op,
- s->mv[dir][0][0],
- s->mv[dir][0][1], 2 * block_s, mb_y >> 1);
- }
- break;
- case MV_TYPE_16X8:
- for (i = 0; i < 2; i++) {
- uint8_t **ref2picture;
-
- if (s->picture_structure == s->field_select[dir][i] + 1 ||
- s->pict_type == AV_PICTURE_TYPE_B || s->first_field) {
- ref2picture = ref_picture;
- } else {
- ref2picture = s->current_picture_ptr->f.data;
- }
-
- mpeg_motion_lowres(s, dest_y, dest_cb, dest_cr,
- 0, 0, s->field_select[dir][i],
- ref2picture, pix_op,
- s->mv[dir][i][0], s->mv[dir][i][1] +
- 2 * block_s * i, block_s, mb_y >> 1);
-
- dest_y += 2 * block_s * s->linesize;
- dest_cb += (2 * block_s >> s->chroma_y_shift) * s->uvlinesize;
- dest_cr += (2 * block_s >> s->chroma_y_shift) * s->uvlinesize;
- }
- break;
- case MV_TYPE_DMV:
- if (s->picture_structure == PICT_FRAME) {
- for (i = 0; i < 2; i++) {
- int j;
- for (j = 0; j < 2; j++) {
- mpeg_motion_lowres(s, dest_y, dest_cb, dest_cr,
- 1, j, j ^ i,
- ref_picture, pix_op,
- s->mv[dir][2 * i + j][0],
- s->mv[dir][2 * i + j][1],
- block_s, mb_y);
- }
- pix_op = s->dsp.avg_h264_chroma_pixels_tab;
- }
- } else {
- for (i = 0; i < 2; i++) {
- mpeg_motion_lowres(s, dest_y, dest_cb, dest_cr,
- 0, 0, s->picture_structure != i + 1,
- ref_picture, pix_op,
- s->mv[dir][2 * i][0],s->mv[dir][2 * i][1],
- 2 * block_s, mb_y >> 1);
-
- // after put we make avg of the same block
- pix_op = s->dsp.avg_h264_chroma_pixels_tab;
-
- // opposite parity is always in the same
- // frame if this is second field
- if (!s->first_field) {
- ref_picture = s->current_picture_ptr->f.data;
- }
- }
- }
- break;
- default:
- assert(0);
- }
-}
-
/**
* find the lowest MB row referenced in the MVs
*/
-int MPV_lowest_referenced_row(MpegEncContext *s, int dir)
+int ff_MPV_lowest_referenced_row(MpegEncContext *s, int dir)
{
int my_max = INT_MIN, my_min = INT_MAX, qpel_shift = !s->quarter_sample;
int my, off, i, mvs;
- if (s->picture_structure != PICT_FRAME) goto unhandled;
+ if (s->picture_structure != PICT_FRAME || s->mcsel)
+ goto unhandled;
switch (s->mv_type) {
case MV_TYPE_16X16:
@@ -2282,7 +2136,7 @@ void ff_clean_intra_table_entries(MpegEncContext *s)
*/
static av_always_inline
void MPV_decode_mb_internal(MpegEncContext *s, DCTELEM block[12][64],
- int lowres_flag, int is_mpeg12)
+ int is_mpeg12)
{
const int mb_xy = s->mb_y * s->mb_stride + s->mb_x;
if(CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration){
@@ -2327,8 +2181,8 @@ void MPV_decode_mb_internal(MpegEncContext *s, DCTELEM block[12][64],
qpel_mc_func (*op_qpix)[16];
const int linesize = s->current_picture.f.linesize[0]; //not s->linesize as this would be wrong for field pics
const int uvlinesize = s->current_picture.f.linesize[1];
- const int readable= s->pict_type != AV_PICTURE_TYPE_B || s->encoding || s->avctx->draw_horiz_band || lowres_flag;
- const int block_size= lowres_flag ? 8>>s->avctx->lowres : 8;
+ const int readable= s->pict_type != AV_PICTURE_TYPE_B || s->encoding || s->avctx->draw_horiz_band;
+ const int block_size = 8;
/* avoid copy if macroblock skipped in last frame too */
/* skip only during decoding as we might trash the buffers during encoding a bit */
@@ -2366,38 +2220,30 @@ void MPV_decode_mb_internal(MpegEncContext *s, DCTELEM block[12][64],
if(HAVE_THREADS && s->avctx->active_thread_type&FF_THREAD_FRAME) {
if (s->mv_dir & MV_DIR_FORWARD) {
- ff_thread_await_progress((AVFrame*)s->last_picture_ptr, MPV_lowest_referenced_row(s, 0), 0);
+ ff_thread_await_progress(&s->last_picture_ptr->f,
+ ff_MPV_lowest_referenced_row(s, 0),
+ 0);
}
if (s->mv_dir & MV_DIR_BACKWARD) {
- ff_thread_await_progress((AVFrame*)s->next_picture_ptr, MPV_lowest_referenced_row(s, 1), 0);
+ ff_thread_await_progress(&s->next_picture_ptr->f,
+ ff_MPV_lowest_referenced_row(s, 1),
+ 0);
}
}
- if(lowres_flag){
- h264_chroma_mc_func *op_pix = s->dsp.put_h264_chroma_pixels_tab;
-
- if (s->mv_dir & MV_DIR_FORWARD) {
- MPV_motion_lowres(s, dest_y, dest_cb, dest_cr, 0, s->last_picture.f.data, op_pix);
- op_pix = s->dsp.avg_h264_chroma_pixels_tab;
- }
- if (s->mv_dir & MV_DIR_BACKWARD) {
- MPV_motion_lowres(s, dest_y, dest_cb, dest_cr, 1, s->next_picture.f.data, op_pix);
- }
+ op_qpix= s->me.qpel_put;
+ if ((!s->no_rounding) || s->pict_type==AV_PICTURE_TYPE_B){
+ op_pix = s->dsp.put_pixels_tab;
}else{
- op_qpix= s->me.qpel_put;
- if ((!s->no_rounding) || s->pict_type==AV_PICTURE_TYPE_B){
- op_pix = s->dsp.put_pixels_tab;
- }else{
- op_pix = s->dsp.put_no_rnd_pixels_tab;
- }
- if (s->mv_dir & MV_DIR_FORWARD) {
- MPV_motion(s, dest_y, dest_cb, dest_cr, 0, s->last_picture.f.data, op_pix, op_qpix);
- op_pix = s->dsp.avg_pixels_tab;
- op_qpix= s->me.qpel_avg;
- }
- if (s->mv_dir & MV_DIR_BACKWARD) {
- MPV_motion(s, dest_y, dest_cb, dest_cr, 1, s->next_picture.f.data, op_pix, op_qpix);
- }
+ op_pix = s->dsp.put_no_rnd_pixels_tab;
+ }
+ if (s->mv_dir & MV_DIR_FORWARD) {
+ ff_MPV_motion(s, dest_y, dest_cb, dest_cr, 0, s->last_picture.f.data, op_pix, op_qpix);
+ op_pix = s->dsp.avg_pixels_tab;
+ op_qpix= s->me.qpel_avg;
+ }
+ if (s->mv_dir & MV_DIR_BACKWARD) {
+ ff_MPV_motion(s, dest_y, dest_cb, dest_cr, 1, s->next_picture.f.data, op_pix, op_qpix);
}
}
@@ -2410,8 +2256,8 @@ void MPV_decode_mb_internal(MpegEncContext *s, DCTELEM block[12][64],
}
/* add dct residue */
- if(s->encoding || !( s->msmpeg4_version || s->codec_id==CODEC_ID_MPEG1VIDEO || s->codec_id==CODEC_ID_MPEG2VIDEO
- || (s->codec_id==CODEC_ID_MPEG4 && !s->mpeg_quant))){
+ if(s->encoding || !( s->msmpeg4_version || s->codec_id==AV_CODEC_ID_MPEG1VIDEO || s->codec_id==AV_CODEC_ID_MPEG2VIDEO
+ || (s->codec_id==AV_CODEC_ID_MPEG4 && !s->mpeg_quant))){
add_dequant_dct(s, block[0], 0, dest_y , dct_linesize, s->qscale);
add_dequant_dct(s, block[1], 1, dest_y + block_size, dct_linesize, s->qscale);
add_dequant_dct(s, block[2], 2, dest_y + dct_offset , dct_linesize, s->qscale);
@@ -2430,7 +2276,7 @@ void MPV_decode_mb_internal(MpegEncContext *s, DCTELEM block[12][64],
add_dequant_dct(s, block[7], 7, dest_cr + dct_offset, dct_linesize, s->chroma_qscale);
}
}
- } else if(is_mpeg12 || (s->codec_id != CODEC_ID_WMV2)){
+ } else if(is_mpeg12 || (s->codec_id != AV_CODEC_ID_WMV2)){
add_dct(s, block[0], 0, dest_y , dct_linesize);
add_dct(s, block[1], 1, dest_y + block_size, dct_linesize);
add_dct(s, block[2], 2, dest_y + dct_offset , dct_linesize);
@@ -2463,7 +2309,7 @@ void MPV_decode_mb_internal(MpegEncContext *s, DCTELEM block[12][64],
}
} else {
/* dct only in intra block */
- if(s->encoding || !(s->codec_id==CODEC_ID_MPEG1VIDEO || s->codec_id==CODEC_ID_MPEG2VIDEO)){
+ if(s->encoding || !(s->codec_id==AV_CODEC_ID_MPEG1VIDEO || s->codec_id==AV_CODEC_ID_MPEG2VIDEO)){
put_dct(s, block[0], 0, dest_y , dct_linesize, s->qscale);
put_dct(s, block[1], 1, dest_y + block_size, dct_linesize, s->qscale);
put_dct(s, block[2], 2, dest_y + dct_offset , dct_linesize, s->qscale);
@@ -2520,15 +2366,13 @@ skip_idct:
}
}
-void MPV_decode_mb(MpegEncContext *s, DCTELEM block[12][64]){
+void ff_MPV_decode_mb(MpegEncContext *s, DCTELEM block[12][64]){
#if !CONFIG_SMALL
if(s->out_format == FMT_MPEG1) {
- if(s->avctx->lowres) MPV_decode_mb_internal(s, block, 1, 1);
- else MPV_decode_mb_internal(s, block, 0, 1);
+ MPV_decode_mb_internal(s, block, 1);
} else
#endif
- if(s->avctx->lowres) MPV_decode_mb_internal(s, block, 1, 0);
- else MPV_decode_mb_internal(s, block, 0, 0);
+ MPV_decode_mb_internal(s, block, 0);
}
/**
@@ -2547,9 +2391,10 @@ void ff_draw_horiz_band(MpegEncContext *s, int y, int h){
&& s->current_picture.f.reference
&& !s->intra_only
&& !(s->flags&CODEC_FLAG_EMU_EDGE)) {
+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(s->avctx->pix_fmt);
int sides = 0, edge_h;
- int hshift = av_pix_fmt_descriptors[s->avctx->pix_fmt].log2_chroma_w;
- int vshift = av_pix_fmt_descriptors[s->avctx->pix_fmt].log2_chroma_h;
+ int hshift = desc->log2_chroma_w;
+ int vshift = desc->log2_chroma_h;
if (y==0) sides |= EDGE_TOP;
if (y + h >= s->v_edge_pos) sides |= EDGE_BOTTOM;
@@ -2576,9 +2421,9 @@ void ff_draw_horiz_band(MpegEncContext *s, int y, int h){
int i;
if(s->pict_type==AV_PICTURE_TYPE_B || s->low_delay || (s->avctx->slice_flags&SLICE_FLAG_CODED_ORDER))
- src= (AVFrame*)s->current_picture_ptr;
+ src = &s->current_picture_ptr->f;
else if(s->last_picture_ptr)
- src= (AVFrame*)s->last_picture_ptr;
+ src = &s->last_picture_ptr->f;
else
return;
@@ -2603,7 +2448,7 @@ void ff_draw_horiz_band(MpegEncContext *s, int y, int h){
void ff_init_block_index(MpegEncContext *s){ //FIXME maybe rename
const int linesize = s->current_picture.f.linesize[0]; //not s->linesize as this would be wrong for field pics
const int uvlinesize = s->current_picture.f.linesize[1];
- const int mb_size= 4 - s->avctx->lowres;
+ const int mb_size= 4;
s->block_index[0]= s->b8_stride*(s->mb_y*2 ) - 2 + s->mb_x*2;
s->block_index[1]= s->b8_stride*(s->mb_y*2 ) - 1 + s->mb_x*2;
@@ -2894,8 +2739,8 @@ void ff_set_qscale(MpegEncContext * s, int qscale)
s->c_dc_scale= s->c_dc_scale_table[ s->chroma_qscale ];
}
-void MPV_report_decode_progress(MpegEncContext *s)
+void ff_MPV_report_decode_progress(MpegEncContext *s)
{
if (s->pict_type != AV_PICTURE_TYPE_B && !s->partitioned_frame && !s->error_occurred)
- ff_thread_report_progress((AVFrame*)s->current_picture_ptr, s->mb_y, 0);
+ ff_thread_report_progress(&s->current_picture_ptr->f, s->mb_y, 0);
}
diff --git a/gst-libs/ext/libav/libavcodec/mpegvideo.h b/gst-libs/ext/libav/libavcodec/mpegvideo.h
index 06be735..38d9ab6 100644
--- a/gst-libs/ext/libav/libavcodec/mpegvideo.h
+++ b/gst-libs/ext/libav/libavcodec/mpegvideo.h
@@ -36,6 +36,9 @@
#include "parser.h"
#include "mpeg12data.h"
#include "rl.h"
+#include "videodsp.h"
+
+#include "libavutil/opt.h"
#define FRAME_SKIPPED 100 ///< return value for header parsers if frame is not coded
@@ -77,6 +80,12 @@ enum OutputFormat {
#define EXT_START_CODE 0x000001b5
#define USER_START_CODE 0x000001b2
+/**
+ * Value of Picture.reference when Picture is not a reference picture, but
+ * is held for delayed output.
+ */
+#define DELAYED_PIC_REF 4
+
struct MpegEncContext;
/**
@@ -137,6 +146,7 @@ typedef struct Picture{
int32_t *mb_cmp_score; ///< Table for MB cmp scores, for mb decision FIXME remove
int b_frame_score; /* */
struct MpegEncContext *owner2; ///< pointer to the MpegEncContext that allocated this picture
+ int needs_realloc; ///< Picture needs to be reallocated (eg due to a frame size change)
} Picture;
/**
@@ -214,7 +224,7 @@ typedef struct MpegEncContext {
int h263_plus; ///< h263 plus headers
int h263_flv; ///< use flv h263 header
- enum CodecID codec_id; /* see CODEC_ID_xxx */
+ enum AVCodecID codec_id; /* see AV_CODEC_ID_xxx */
int fixed_qscale; ///< fixed qscale if non zero
int encoding; ///< true if we are encoding (vs decoding)
int flags; ///< AVCodecContext.flags (HQ, MV4, ...)
@@ -261,6 +271,14 @@ typedef struct MpegEncContext {
* offsets used in asm. */
int64_t user_specified_pts;///< last non zero pts from AVFrame which was passed into avcodec_encode_video()
+ /**
+ * pts difference between the first and second input frame, used for
+ * calculating dts of the first frame when there's a delay */
+ int64_t dts_delta;
+ /**
+ * reordered pts to be used as dts for the next output frame when there's
+ * a delay */
+ int64_t reordered_pts;
/** bit output */
PutBitContext pb;
@@ -331,7 +349,7 @@ typedef struct MpegEncContext {
int pict_type; ///< AV_PICTURE_TYPE_I, AV_PICTURE_TYPE_P, AV_PICTURE_TYPE_B, ...
int last_pict_type; //FIXME removes
int last_non_b_pict_type; ///< used for mpeg4 gmc b-frames & ratecontrol
- int dropable;
+ int droppable;
int frame_rate_index;
int last_lambda_for[5]; ///< last lambda for a specific pict type
int skipdct; ///< skip dct and code zero residual
@@ -341,6 +359,7 @@ typedef struct MpegEncContext {
int h263_long_vectors; ///< use horrible h263v1 long vector mode
DSPContext dsp; ///< pointers for accelerated dsp functions
+ VideoDSPContext vdsp;
int f_code; ///< forward MV resolution
int b_code; ///< backward MV resolution for B Frames (mpeg4)
int16_t (*p_mv_table_base)[2];
@@ -496,6 +515,10 @@ typedef struct MpegEncContext {
int gob_index;
int obmc; ///< overlapped block motion compensation
int showed_packed_warning; ///< flag for having shown the warning about divxs invalid b frames
+ int mb_info; ///< interval for outputting info about mb offsets as side data
+ int prev_mb_info, last_mb_info;
+ uint8_t *mb_info_ptr;
+ int mb_info_size;
/* H.263+ specific */
int umvplus; ///< == H263+ && unrestricted_mv
@@ -679,29 +702,81 @@ typedef struct MpegEncContext {
int (*dct_quantize)(struct MpegEncContext *s, DCTELEM *block/*align 16*/, int n, int qscale, int *overflow);
int (*fast_dct_quantize)(struct MpegEncContext *s, DCTELEM *block/*align 16*/, int n, int qscale, int *overflow);
void (*denoise_dct)(struct MpegEncContext *s, DCTELEM *block);
+
+ int mpv_flags; ///< flags set by private options
+ int quantizer_noise_shaping;
+
+ /* error resilience stuff */
+ uint8_t *er_temp_buffer;
+
+ /* temp buffers for rate control */
+ float *cplx_tab, *bits_tab;
+
+ /* flag to indicate a reinitialization is required, e.g. after
+ * a frame size change */
+ int context_reinit;
} MpegEncContext;
#define REBASE_PICTURE(pic, new_ctx, old_ctx) (pic ? \
(pic >= old_ctx->picture && pic < old_ctx->picture+old_ctx->picture_count ?\
- &new_ctx->picture[pic - old_ctx->picture] : pic - (Picture*)old_ctx + (Picture*)new_ctx)\
+ &new_ctx->picture[pic - old_ctx->picture] : (Picture*) ((uint8_t*)pic - (uint8_t*)old_ctx + (uint8_t*)new_ctx))\
: NULL)
-void MPV_decode_defaults(MpegEncContext *s);
-int MPV_common_init(MpegEncContext *s);
-void MPV_common_end(MpegEncContext *s);
-void MPV_decode_mb(MpegEncContext *s, DCTELEM block[12][64]);
-int MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx);
-void MPV_frame_end(MpegEncContext *s);
-int MPV_encode_init(AVCodecContext *avctx);
-int MPV_encode_end(AVCodecContext *avctx);
-int MPV_encode_picture(AVCodecContext *avctx, unsigned char *buf, int buf_size, void *data);
-void MPV_common_init_mmx(MpegEncContext *s);
-void MPV_common_init_axp(MpegEncContext *s);
-void MPV_common_init_mlib(MpegEncContext *s);
-void MPV_common_init_mmi(MpegEncContext *s);
-void MPV_common_init_arm(MpegEncContext *s);
-void MPV_common_init_altivec(MpegEncContext *s);
-void MPV_common_init_bfin(MpegEncContext *s);
+/* mpegvideo_enc common options */
+#define FF_MPV_FLAG_SKIP_RD 0x0001
+#define FF_MPV_FLAG_STRICT_GOP 0x0002
+#define FF_MPV_FLAG_QP_RD 0x0004
+#define FF_MPV_FLAG_CBP_RD 0x0008
+
+#define FF_MPV_OFFSET(x) offsetof(MpegEncContext, x)
+#define FF_MPV_OPT_FLAGS (AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM)
+#define FF_MPV_COMMON_OPTS \
+{ "mpv_flags", "Flags common for all mpegvideo-based encoders.", FF_MPV_OFFSET(mpv_flags), AV_OPT_TYPE_FLAGS, { .i64 = 0 }, INT_MIN, INT_MAX, FF_MPV_OPT_FLAGS, "mpv_flags" },\
+{ "skip_rd", "RD optimal MB level residual skipping", 0, AV_OPT_TYPE_CONST, { .i64 = FF_MPV_FLAG_SKIP_RD }, 0, 0, FF_MPV_OPT_FLAGS, "mpv_flags" },\
+{ "strict_gop", "Strictly enforce gop size", 0, AV_OPT_TYPE_CONST, { .i64 = FF_MPV_FLAG_STRICT_GOP }, 0, 0, FF_MPV_OPT_FLAGS, "mpv_flags" },\
+{ "qp_rd", "Use rate distortion optimization for qp selection", 0, AV_OPT_TYPE_CONST, { .i64 = FF_MPV_FLAG_QP_RD }, 0, 0, FF_MPV_OPT_FLAGS, "mpv_flags" },\
+{ "cbp_rd", "use rate distortion optimization for CBP", 0, AV_OPT_TYPE_CONST, { .i64 = FF_MPV_FLAG_CBP_RD }, 0, 0, FF_MPV_OPT_FLAGS, "mpv_flags" },\
+{ "luma_elim_threshold", "single coefficient elimination threshold for luminance (negative values also consider dc coefficient)",\
+ FF_MPV_OFFSET(luma_elim_threshold), AV_OPT_TYPE_INT, { .i64 = 0 }, INT_MIN, INT_MAX, FF_MPV_OPT_FLAGS },\
+{ "chroma_elim_threshold", "single coefficient elimination threshold for chrominance (negative values also consider dc coefficient)",\
+ FF_MPV_OFFSET(chroma_elim_threshold), AV_OPT_TYPE_INT, { .i64 = 0 }, INT_MIN, INT_MAX, FF_MPV_OPT_FLAGS },\
+{ "quantizer_noise_shaping", NULL, FF_MPV_OFFSET(quantizer_noise_shaping), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, FF_MPV_OPT_FLAGS },
+
+extern const AVOption ff_mpv_generic_options[];
+
+#define FF_MPV_GENERIC_CLASS(name) \
+static const AVClass name ## _class = {\
+ .class_name = #name " encoder",\
+ .item_name = av_default_item_name,\
+ .option = ff_mpv_generic_options,\
+ .version = LIBAVUTIL_VERSION_INT,\
+};
+
+/**
+ * Set the given MpegEncContext to common defaults (same for encoding
+ * and decoding). The changed fields will not depend upon the prior
+ * state of the MpegEncContext.
+ */
+void ff_MPV_common_defaults(MpegEncContext *s);
+
+void ff_MPV_decode_defaults(MpegEncContext *s);
+int ff_MPV_common_init(MpegEncContext *s);
+int ff_mpv_frame_size_alloc(MpegEncContext *s, int linesize);
+int ff_MPV_common_frame_size_change(MpegEncContext *s);
+void ff_MPV_common_end(MpegEncContext *s);
+void ff_MPV_decode_mb(MpegEncContext *s, DCTELEM block[12][64]);
+int ff_MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx);
+void ff_MPV_frame_end(MpegEncContext *s);
+int ff_MPV_encode_init(AVCodecContext *avctx);
+int ff_MPV_encode_end(AVCodecContext *avctx);
+int ff_MPV_encode_picture(AVCodecContext *avctx, AVPacket *pkt,
+ const AVFrame *frame, int *got_packet);
+void ff_MPV_encode_init_x86(MpegEncContext *s);
+void ff_MPV_common_init_x86(MpegEncContext *s);
+void ff_MPV_common_init_axp(MpegEncContext *s);
+void ff_MPV_common_init_arm(MpegEncContext *s);
+void ff_MPV_common_init_altivec(MpegEncContext *s);
+void ff_MPV_common_init_bfin(MpegEncContext *s);
void ff_clean_intra_table_entries(MpegEncContext *s);
void ff_draw_horiz_band(MpegEncContext *s, int y, int h);
void ff_mpeg_flush(AVCodecContext *avctx);
@@ -710,9 +785,9 @@ void ff_write_quant_matrix(PutBitContext *pb, uint16_t *matrix);
void ff_release_unused_pictures(MpegEncContext *s, int remove_current);
int ff_find_unused_picture(MpegEncContext *s, int shared);
void ff_denoise_dct(MpegEncContext *s, DCTELEM *block);
-void ff_update_duplicate_context(MpegEncContext *dst, MpegEncContext *src);
-int MPV_lowest_referenced_row(MpegEncContext *s, int dir);
-void MPV_report_decode_progress(MpegEncContext *s);
+int ff_update_duplicate_context(MpegEncContext *dst, MpegEncContext *src);
+int ff_MPV_lowest_referenced_row(MpegEncContext *s, int dir);
+void ff_MPV_report_decode_progress(MpegEncContext *s);
int ff_mpeg_update_thread_context(AVCodecContext *dst, const AVCodecContext *src);
const uint8_t *avpriv_mpv_find_start_code(const uint8_t *p, const uint8_t *end, uint32_t *state);
void ff_set_qscale(MpegEncContext * s, int qscale);
@@ -724,21 +799,29 @@ void ff_er_add_slice(MpegEncContext *s, int startx, int starty, int endx, int en
int ff_dct_common_init(MpegEncContext *s);
void ff_convert_matrix(DSPContext *dsp, int (*qmat)[64], uint16_t (*qmat16)[2][64],
const uint16_t *quant_matrix, int bias, int qmin, int qmax, int intra);
+int ff_dct_quantize_c(MpegEncContext *s, DCTELEM *block, int n, int qscale, int *overflow);
void ff_init_block_index(MpegEncContext *s);
void ff_copy_picture(Picture *dst, Picture *src);
+void ff_MPV_motion(MpegEncContext *s,
+ uint8_t *dest_y, uint8_t *dest_cb,
+ uint8_t *dest_cr, int dir,
+ uint8_t **ref_picture,
+ op_pixels_func (*pix_op)[4],
+ qpel_mc_func (*qpix_op)[16]);
+
/**
* Allocate a Picture.
* The pixels are allocated/set by calling get_buffer() if shared = 0.
*/
int ff_alloc_picture(MpegEncContext *s, Picture *pic, int shared);
-extern const enum PixelFormat ff_pixfmt_list_420[];
-extern const enum PixelFormat ff_hwaccel_pixfmt_list_420[];
+extern const enum AVPixelFormat ff_pixfmt_list_420[];
+extern const enum AVPixelFormat ff_hwaccel_pixfmt_list_420[];
static inline void ff_update_block_index(MpegEncContext *s){
- const int block_size= 8>>s->avctx->lowres;
+ const int block_size = 8;
s->block_index[0]+=2;
s->block_index[1]+=2;
@@ -789,10 +872,10 @@ int ff_get_mb_score(MpegEncContext * s, int mx, int my, int src_index,
extern const uint8_t ff_mpeg1_dc_scale_table[128];
extern const uint8_t * const ff_mpeg2_dc_scale_table[4];
-void mpeg1_encode_picture_header(MpegEncContext *s, int picture_number);
-void mpeg1_encode_mb(MpegEncContext *s,
- DCTELEM block[6][64],
- int motion_x, int motion_y);
+void ff_mpeg1_encode_picture_header(MpegEncContext *s, int picture_number);
+void ff_mpeg1_encode_mb(MpegEncContext *s,
+ DCTELEM block[6][64],
+ int motion_x, int motion_y);
void ff_mpeg1_encode_init(MpegEncContext *s);
void ff_mpeg1_encode_slice_header(MpegEncContext *s);
void ff_mpeg1_clean_buffers(MpegEncContext *s);
@@ -814,19 +897,19 @@ int ff_h261_get_picture_format(int width, int height);
/* rv10.c */
-void rv10_encode_picture_header(MpegEncContext *s, int picture_number);
-int rv_decode_dc(MpegEncContext *s, int n);
-void rv20_encode_picture_header(MpegEncContext *s, int picture_number);
+void ff_rv10_encode_picture_header(MpegEncContext *s, int picture_number);
+int ff_rv_decode_dc(MpegEncContext *s, int n);
+void ff_rv20_encode_picture_header(MpegEncContext *s, int picture_number);
/* msmpeg4.c */
-void msmpeg4_encode_picture_header(MpegEncContext * s, int picture_number);
-void msmpeg4_encode_ext_header(MpegEncContext * s);
-void msmpeg4_encode_mb(MpegEncContext * s,
- DCTELEM block[6][64],
- int motion_x, int motion_y);
-int msmpeg4_decode_picture_header(MpegEncContext * s);
-int msmpeg4_decode_ext_header(MpegEncContext * s, int buf_size);
+void ff_msmpeg4_encode_picture_header(MpegEncContext * s, int picture_number);
+void ff_msmpeg4_encode_ext_header(MpegEncContext * s);
+void ff_msmpeg4_encode_mb(MpegEncContext * s,
+ DCTELEM block[6][64],
+ int motion_x, int motion_y);
+int ff_msmpeg4_decode_picture_header(MpegEncContext * s);
+int ff_msmpeg4_decode_ext_header(MpegEncContext * s, int buf_size);
int ff_msmpeg4_decode_init(AVCodecContext *avctx);
void ff_msmpeg4_encode_init(MpegEncContext *s);
int ff_wmv2_decode_picture_header(MpegEncContext * s);
diff --git a/gst-libs/ext/libav/libavcodec/mpegvideo_common.h b/gst-libs/ext/libav/libavcodec/mpegvideo_common.h
deleted file mode 100644
index e8daf2e..0000000
--- a/gst-libs/ext/libav/libavcodec/mpegvideo_common.h
+++ /dev/null
@@ -1,900 +0,0 @@
-/*
- * The simplest mpeg encoder (well, it was the simplest!)
- * Copyright (c) 2000,2001 Fabrice Bellard
- * Copyright (c) 2002-2004 Michael Niedermayer <michaelni@gmx.at>
- *
- * 4MV & hq & B-frame encoding stuff by Michael Niedermayer <michaelni@gmx.at>
- *
- * 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
- * The simplest mpeg encoder (well, it was the simplest!).
- */
-
-#ifndef AVCODEC_MPEGVIDEO_COMMON_H
-#define AVCODEC_MPEGVIDEO_COMMON_H
-
-#include <string.h>
-#include "avcodec.h"
-#include "dsputil.h"
-#include "mpegvideo.h"
-#include "mjpegenc.h"
-#include "msmpeg4.h"
-#include "faandct.h"
-#include <limits.h>
-
-int dct_quantize_c(MpegEncContext *s, DCTELEM *block, int n, int qscale, int *overflow);
-
-/**
- * Allocate a Picture.
- * The pixels are allocated/set by calling get_buffer() if shared = 0.
- */
-int alloc_picture(MpegEncContext *s, Picture *pic, int shared);
-
-/**
- * Set the given MpegEncContext to common defaults (same for encoding and decoding).
- * The changed fields will not depend upon the prior state of the MpegEncContext.
- */
-void MPV_common_defaults(MpegEncContext *s);
-
-static inline void gmc1_motion(MpegEncContext *s,
- uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr,
- uint8_t **ref_picture)
-{
- uint8_t *ptr;
- int offset, src_x, src_y, linesize, uvlinesize;
- int motion_x, motion_y;
- int emu=0;
-
- motion_x= s->sprite_offset[0][0];
- motion_y= s->sprite_offset[0][1];
- src_x = s->mb_x * 16 + (motion_x >> (s->sprite_warping_accuracy+1));
- src_y = s->mb_y * 16 + (motion_y >> (s->sprite_warping_accuracy+1));
- motion_x<<=(3-s->sprite_warping_accuracy);
- motion_y<<=(3-s->sprite_warping_accuracy);
- src_x = av_clip(src_x, -16, s->width);
- if (src_x == s->width)
- motion_x =0;
- src_y = av_clip(src_y, -16, s->height);
- if (src_y == s->height)
- motion_y =0;
-
- linesize = s->linesize;
- uvlinesize = s->uvlinesize;
-
- ptr = ref_picture[0] + (src_y * linesize) + src_x;
-
- if(s->flags&CODEC_FLAG_EMU_EDGE){
- if( (unsigned)src_x >= FFMAX(s->h_edge_pos - 17, 0)
- || (unsigned)src_y >= FFMAX(s->v_edge_pos - 17, 0)){
- s->dsp.emulated_edge_mc(s->edge_emu_buffer, ptr, linesize, 17, 17, src_x, src_y, s->h_edge_pos, s->v_edge_pos);
- ptr= s->edge_emu_buffer;
- }
- }
-
- if((motion_x|motion_y)&7){
- s->dsp.gmc1(dest_y , ptr , linesize, 16, motion_x&15, motion_y&15, 128 - s->no_rounding);
- s->dsp.gmc1(dest_y+8, ptr+8, linesize, 16, motion_x&15, motion_y&15, 128 - s->no_rounding);
- }else{
- int dxy;
-
- dxy= ((motion_x>>3)&1) | ((motion_y>>2)&2);
- if (s->no_rounding){
- s->dsp.put_no_rnd_pixels_tab[0][dxy](dest_y, ptr, linesize, 16);
- }else{
- s->dsp.put_pixels_tab [0][dxy](dest_y, ptr, linesize, 16);
- }
- }
-
- if(CONFIG_GRAY && s->flags&CODEC_FLAG_GRAY) return;
-
- motion_x= s->sprite_offset[1][0];
- motion_y= s->sprite_offset[1][1];
- src_x = s->mb_x * 8 + (motion_x >> (s->sprite_warping_accuracy+1));
- src_y = s->mb_y * 8 + (motion_y >> (s->sprite_warping_accuracy+1));
- motion_x<<=(3-s->sprite_warping_accuracy);
- motion_y<<=(3-s->sprite_warping_accuracy);
- src_x = av_clip(src_x, -8, s->width>>1);
- if (src_x == s->width>>1)
- motion_x =0;
- src_y = av_clip(src_y, -8, s->height>>1);
- if (src_y == s->height>>1)
- motion_y =0;
-
- offset = (src_y * uvlinesize) + src_x;
- ptr = ref_picture[1] + offset;
- if(s->flags&CODEC_FLAG_EMU_EDGE){
- if( (unsigned)src_x >= FFMAX((s->h_edge_pos>>1) - 9, 0)
- || (unsigned)src_y >= FFMAX((s->v_edge_pos>>1) - 9, 0)){
- s->dsp.emulated_edge_mc(s->edge_emu_buffer, ptr, uvlinesize, 9, 9, src_x, src_y, s->h_edge_pos>>1, s->v_edge_pos>>1);
- ptr= s->edge_emu_buffer;
- emu=1;
- }
- }
- s->dsp.gmc1(dest_cb, ptr, uvlinesize, 8, motion_x&15, motion_y&15, 128 - s->no_rounding);
-
- ptr = ref_picture[2] + offset;
- if(emu){
- s->dsp.emulated_edge_mc(s->edge_emu_buffer, ptr, uvlinesize, 9, 9, src_x, src_y, s->h_edge_pos>>1, s->v_edge_pos>>1);
- ptr= s->edge_emu_buffer;
- }
- s->dsp.gmc1(dest_cr, ptr, uvlinesize, 8, motion_x&15, motion_y&15, 128 - s->no_rounding);
-
- return;
-}
-
-static inline void gmc_motion(MpegEncContext *s,
- uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr,
- uint8_t **ref_picture)
-{
- uint8_t *ptr;
- int linesize, uvlinesize;
- const int a= s->sprite_warping_accuracy;
- int ox, oy;
-
- linesize = s->linesize;
- uvlinesize = s->uvlinesize;
-
- ptr = ref_picture[0];
-
- ox= s->sprite_offset[0][0] + s->sprite_delta[0][0]*s->mb_x*16 + s->sprite_delta[0][1]*s->mb_y*16;
- oy= s->sprite_offset[0][1] + s->sprite_delta[1][0]*s->mb_x*16 + s->sprite_delta[1][1]*s->mb_y*16;
-
- s->dsp.gmc(dest_y, ptr, linesize, 16,
- ox,
- oy,
- s->sprite_delta[0][0], s->sprite_delta[0][1],
- s->sprite_delta[1][0], s->sprite_delta[1][1],
- a+1, (1<<(2*a+1)) - s->no_rounding,
- s->h_edge_pos, s->v_edge_pos);
- s->dsp.gmc(dest_y+8, ptr, linesize, 16,
- ox + s->sprite_delta[0][0]*8,
- oy + s->sprite_delta[1][0]*8,
- s->sprite_delta[0][0], s->sprite_delta[0][1],
- s->sprite_delta[1][0], s->sprite_delta[1][1],
- a+1, (1<<(2*a+1)) - s->no_rounding,
- s->h_edge_pos, s->v_edge_pos);
-
- if(CONFIG_GRAY && s->flags&CODEC_FLAG_GRAY) return;
-
- ox= s->sprite_offset[1][0] + s->sprite_delta[0][0]*s->mb_x*8 + s->sprite_delta[0][1]*s->mb_y*8;
- oy= s->sprite_offset[1][1] + s->sprite_delta[1][0]*s->mb_x*8 + s->sprite_delta[1][1]*s->mb_y*8;
-
- ptr = ref_picture[1];
- s->dsp.gmc(dest_cb, ptr, uvlinesize, 8,
- ox,
- oy,
- s->sprite_delta[0][0], s->sprite_delta[0][1],
- s->sprite_delta[1][0], s->sprite_delta[1][1],
- a+1, (1<<(2*a+1)) - s->no_rounding,
- s->h_edge_pos>>1, s->v_edge_pos>>1);
-
- ptr = ref_picture[2];
- s->dsp.gmc(dest_cr, ptr, uvlinesize, 8,
- ox,
- oy,
- s->sprite_delta[0][0], s->sprite_delta[0][1],
- s->sprite_delta[1][0], s->sprite_delta[1][1],
- a+1, (1<<(2*a+1)) - s->no_rounding,
- s->h_edge_pos>>1, s->v_edge_pos>>1);
-}
-
-static inline int hpel_motion(MpegEncContext *s,
- uint8_t *dest, uint8_t *src,
- int field_based, int field_select,
- int src_x, int src_y,
- int width, int height, int stride,
- int h_edge_pos, int v_edge_pos,
- int w, int h, op_pixels_func *pix_op,
- int motion_x, int motion_y)
-{
- int dxy;
- int emu=0;
-
- dxy = ((motion_y & 1) << 1) | (motion_x & 1);
- src_x += motion_x >> 1;
- src_y += motion_y >> 1;
-
- /* WARNING: do no forget half pels */
- src_x = av_clip(src_x, -16, width); //FIXME unneeded for emu?
- if (src_x == width)
- dxy &= ~1;
- src_y = av_clip(src_y, -16, height);
- if (src_y == height)
- dxy &= ~2;
- src += src_y * stride + src_x;
-
- if(s->unrestricted_mv && (s->flags&CODEC_FLAG_EMU_EDGE)){
- if( (unsigned)src_x > FFMAX(h_edge_pos - (motion_x&1) - w, 0)
- || (unsigned)src_y > FFMAX(v_edge_pos - (motion_y&1) - h, 0)){
- s->dsp.emulated_edge_mc(s->edge_emu_buffer, src, s->linesize, w+1, (h+1)<<field_based,
- src_x, src_y<<field_based, h_edge_pos, s->v_edge_pos);
- src= s->edge_emu_buffer;
- emu=1;
- }
- }
- if(field_select)
- src += s->linesize;
- pix_op[dxy](dest, src, stride, h);
- return emu;
-}
-
-static av_always_inline
-void mpeg_motion_internal(MpegEncContext *s,
- uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr,
- int field_based, int bottom_field, int field_select,
- uint8_t **ref_picture, op_pixels_func (*pix_op)[4],
- int motion_x, int motion_y, int h, int is_mpeg12, int mb_y)
-{
- uint8_t *ptr_y, *ptr_cb, *ptr_cr;
- int dxy, uvdxy, mx, my, src_x, src_y,
- uvsrc_x, uvsrc_y, v_edge_pos, uvlinesize, linesize;
-
-#if 0
-if(s->quarter_sample)
-{
- motion_x>>=1;
- motion_y>>=1;
-}
-#endif
-
- v_edge_pos = s->v_edge_pos >> field_based;
- linesize = s->current_picture.f.linesize[0] << field_based;
- uvlinesize = s->current_picture.f.linesize[1] << field_based;
-
- dxy = ((motion_y & 1) << 1) | (motion_x & 1);
- src_x = s->mb_x* 16 + (motion_x >> 1);
- src_y =( mb_y<<(4-field_based)) + (motion_y >> 1);
-
- if (!is_mpeg12 && s->out_format == FMT_H263) {
- if((s->workaround_bugs & FF_BUG_HPEL_CHROMA) && field_based){
- mx = (motion_x>>1)|(motion_x&1);
- my = motion_y >>1;
- uvdxy = ((my & 1) << 1) | (mx & 1);
- uvsrc_x = s->mb_x* 8 + (mx >> 1);
- uvsrc_y =( mb_y<<(3-field_based))+ (my >> 1);
- }else{
- uvdxy = dxy | (motion_y & 2) | ((motion_x & 2) >> 1);
- uvsrc_x = src_x>>1;
- uvsrc_y = src_y>>1;
- }
- }else if(!is_mpeg12 && s->out_format == FMT_H261){//even chroma mv's are full pel in H261
- mx = motion_x / 4;
- my = motion_y / 4;
- uvdxy = 0;
- uvsrc_x = s->mb_x*8 + mx;
- uvsrc_y = mb_y*8 + my;
- } else {
- if(s->chroma_y_shift){
- mx = motion_x / 2;
- my = motion_y / 2;
- uvdxy = ((my & 1) << 1) | (mx & 1);
- uvsrc_x = s->mb_x* 8 + (mx >> 1);
- uvsrc_y =( mb_y<<(3-field_based))+ (my >> 1);
- } else {
- if(s->chroma_x_shift){
- //Chroma422
- mx = motion_x / 2;
- uvdxy = ((motion_y & 1) << 1) | (mx & 1);
- uvsrc_x = s->mb_x* 8 + (mx >> 1);
- uvsrc_y = src_y;
- } else {
- //Chroma444
- uvdxy = dxy;
- uvsrc_x = src_x;
- uvsrc_y = src_y;
- }
- }
- }
-
- ptr_y = ref_picture[0] + src_y * linesize + src_x;
- ptr_cb = ref_picture[1] + uvsrc_y * uvlinesize + uvsrc_x;
- ptr_cr = ref_picture[2] + uvsrc_y * uvlinesize + uvsrc_x;
-
- if( (unsigned)src_x > FFMAX(s->h_edge_pos - (motion_x&1) - 16, 0)
- || (unsigned)src_y > FFMAX( v_edge_pos - (motion_y&1) - h , 0)){
- if(is_mpeg12 || s->codec_id == CODEC_ID_MPEG2VIDEO ||
- s->codec_id == CODEC_ID_MPEG1VIDEO){
- av_log(s->avctx,AV_LOG_DEBUG,
- "MPEG motion vector out of boundary (%d %d)\n", src_x, src_y);
- return;
- }
- s->dsp.emulated_edge_mc(s->edge_emu_buffer, ptr_y, s->linesize,
- 17, 17+field_based,
- src_x, src_y<<field_based,
- s->h_edge_pos, s->v_edge_pos);
- ptr_y = s->edge_emu_buffer;
- if(!CONFIG_GRAY || !(s->flags&CODEC_FLAG_GRAY)){
- uint8_t *uvbuf= s->edge_emu_buffer+18*s->linesize;
- s->dsp.emulated_edge_mc(uvbuf ,
- ptr_cb, s->uvlinesize,
- 9, 9+field_based,
- uvsrc_x, uvsrc_y<<field_based,
- s->h_edge_pos>>1, s->v_edge_pos>>1);
- s->dsp.emulated_edge_mc(uvbuf+16,
- ptr_cr, s->uvlinesize,
- 9, 9+field_based,
- uvsrc_x, uvsrc_y<<field_based,
- s->h_edge_pos>>1, s->v_edge_pos>>1);
- ptr_cb= uvbuf;
- ptr_cr= uvbuf+16;
- }
- }
-
- if(bottom_field){ //FIXME use this for field pix too instead of the obnoxious hack which changes picture.data
- dest_y += s->linesize;
- dest_cb+= s->uvlinesize;
- dest_cr+= s->uvlinesize;
- }
-
- if(field_select){
- ptr_y += s->linesize;
- ptr_cb+= s->uvlinesize;
- ptr_cr+= s->uvlinesize;
- }
-
- pix_op[0][dxy](dest_y, ptr_y, linesize, h);
-
- if(!CONFIG_GRAY || !(s->flags&CODEC_FLAG_GRAY)){
- pix_op[s->chroma_x_shift][uvdxy]
- (dest_cb, ptr_cb, uvlinesize, h >> s->chroma_y_shift);
- pix_op[s->chroma_x_shift][uvdxy]
- (dest_cr, ptr_cr, uvlinesize, h >> s->chroma_y_shift);
- }
- if(!is_mpeg12 && (CONFIG_H261_ENCODER || CONFIG_H261_DECODER) &&
- s->out_format == FMT_H261){
- ff_h261_loop_filter(s);
- }
-}
-/* apply one mpeg motion vector to the three components */
-static av_always_inline
-void mpeg_motion(MpegEncContext *s,
- uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr,
- int field_based, int bottom_field, int field_select,
- uint8_t **ref_picture, op_pixels_func (*pix_op)[4],
- int motion_x, int motion_y, int h, int mb_y)
-{
-#if !CONFIG_SMALL
- if(s->out_format == FMT_MPEG1)
- mpeg_motion_internal(s, dest_y, dest_cb, dest_cr, field_based,
- bottom_field, field_select, ref_picture, pix_op,
- motion_x, motion_y, h, 1, mb_y);
- else
-#endif
- mpeg_motion_internal(s, dest_y, dest_cb, dest_cr, field_based,
- bottom_field, field_select, ref_picture, pix_op,
- motion_x, motion_y, h, 0, mb_y);
-}
-
-//FIXME move to dsputil, avg variant, 16x16 version
-static inline void put_obmc(uint8_t *dst, uint8_t *src[5], int stride){
- int x;
- uint8_t * const top = src[1];
- uint8_t * const left = src[2];
- uint8_t * const mid = src[0];
- uint8_t * const right = src[3];
- uint8_t * const bottom= src[4];
-#define OBMC_FILTER(x, t, l, m, r, b)\
- dst[x]= (t*top[x] + l*left[x] + m*mid[x] + r*right[x] + b*bottom[x] + 4)>>3
-#define OBMC_FILTER4(x, t, l, m, r, b)\
- OBMC_FILTER(x , t, l, m, r, b);\
- OBMC_FILTER(x+1 , t, l, m, r, b);\
- OBMC_FILTER(x +stride, t, l, m, r, b);\
- OBMC_FILTER(x+1+stride, t, l, m, r, b);
-
- x=0;
- OBMC_FILTER (x , 2, 2, 4, 0, 0);
- OBMC_FILTER (x+1, 2, 1, 5, 0, 0);
- OBMC_FILTER4(x+2, 2, 1, 5, 0, 0);
- OBMC_FILTER4(x+4, 2, 0, 5, 1, 0);
- OBMC_FILTER (x+6, 2, 0, 5, 1, 0);
- OBMC_FILTER (x+7, 2, 0, 4, 2, 0);
- x+= stride;
- OBMC_FILTER (x , 1, 2, 5, 0, 0);
- OBMC_FILTER (x+1, 1, 2, 5, 0, 0);
- OBMC_FILTER (x+6, 1, 0, 5, 2, 0);
- OBMC_FILTER (x+7, 1, 0, 5, 2, 0);
- x+= stride;
- OBMC_FILTER4(x , 1, 2, 5, 0, 0);
- OBMC_FILTER4(x+2, 1, 1, 6, 0, 0);
- OBMC_FILTER4(x+4, 1, 0, 6, 1, 0);
- OBMC_FILTER4(x+6, 1, 0, 5, 2, 0);
- x+= 2*stride;
- OBMC_FILTER4(x , 0, 2, 5, 0, 1);
- OBMC_FILTER4(x+2, 0, 1, 6, 0, 1);
- OBMC_FILTER4(x+4, 0, 0, 6, 1, 1);
- OBMC_FILTER4(x+6, 0, 0, 5, 2, 1);
- x+= 2*stride;
- OBMC_FILTER (x , 0, 2, 5, 0, 1);
- OBMC_FILTER (x+1, 0, 2, 5, 0, 1);
- OBMC_FILTER4(x+2, 0, 1, 5, 0, 2);
- OBMC_FILTER4(x+4, 0, 0, 5, 1, 2);
- OBMC_FILTER (x+6, 0, 0, 5, 2, 1);
- OBMC_FILTER (x+7, 0, 0, 5, 2, 1);
- x+= stride;
- OBMC_FILTER (x , 0, 2, 4, 0, 2);
- OBMC_FILTER (x+1, 0, 1, 5, 0, 2);
- OBMC_FILTER (x+6, 0, 0, 5, 1, 2);
- OBMC_FILTER (x+7, 0, 0, 4, 2, 2);
-}
-
-/* obmc for 1 8x8 luma block */
-static inline void obmc_motion(MpegEncContext *s,
- uint8_t *dest, uint8_t *src,
- int src_x, int src_y,
- op_pixels_func *pix_op,
- int16_t mv[5][2]/* mid top left right bottom*/)
-#define MID 0
-{
- int i;
- uint8_t *ptr[5];
-
- assert(s->quarter_sample==0);
-
- for(i=0; i<5; i++){
- if(i && mv[i][0]==mv[MID][0] && mv[i][1]==mv[MID][1]){
- ptr[i]= ptr[MID];
- }else{
- ptr[i]= s->obmc_scratchpad + 8*(i&1) + s->linesize*8*(i>>1);
- hpel_motion(s, ptr[i], src, 0, 0,
- src_x, src_y,
- s->width, s->height, s->linesize,
- s->h_edge_pos, s->v_edge_pos,
- 8, 8, pix_op,
- mv[i][0], mv[i][1]);
- }
- }
-
- put_obmc(dest, ptr, s->linesize);
-}
-
-static inline void qpel_motion(MpegEncContext *s,
- uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr,
- int field_based, int bottom_field, int field_select,
- uint8_t **ref_picture, op_pixels_func (*pix_op)[4],
- qpel_mc_func (*qpix_op)[16],
- int motion_x, int motion_y, int h)
-{
- uint8_t *ptr_y, *ptr_cb, *ptr_cr;
- int dxy, uvdxy, mx, my, src_x, src_y, uvsrc_x, uvsrc_y, v_edge_pos, linesize, uvlinesize;
-
- dxy = ((motion_y & 3) << 2) | (motion_x & 3);
- src_x = s->mb_x * 16 + (motion_x >> 2);
- src_y = s->mb_y * (16 >> field_based) + (motion_y >> 2);
-
- v_edge_pos = s->v_edge_pos >> field_based;
- linesize = s->linesize << field_based;
- uvlinesize = s->uvlinesize << field_based;
-
- if(field_based){
- mx= motion_x/2;
- my= motion_y>>1;
- }else if(s->workaround_bugs&FF_BUG_QPEL_CHROMA2){
- static const int rtab[8]= {0,0,1,1,0,0,0,1};
- mx= (motion_x>>1) + rtab[motion_x&7];
- my= (motion_y>>1) + rtab[motion_y&7];
- }else if(s->workaround_bugs&FF_BUG_QPEL_CHROMA){
- mx= (motion_x>>1)|(motion_x&1);
- my= (motion_y>>1)|(motion_y&1);
- }else{
- mx= motion_x/2;
- my= motion_y/2;
- }
- mx= (mx>>1)|(mx&1);
- my= (my>>1)|(my&1);
-
- uvdxy= (mx&1) | ((my&1)<<1);
- mx>>=1;
- my>>=1;
-
- uvsrc_x = s->mb_x * 8 + mx;
- uvsrc_y = s->mb_y * (8 >> field_based) + my;
-
- ptr_y = ref_picture[0] + src_y * linesize + src_x;
- ptr_cb = ref_picture[1] + uvsrc_y * uvlinesize + uvsrc_x;
- ptr_cr = ref_picture[2] + uvsrc_y * uvlinesize + uvsrc_x;
-
- if( (unsigned)src_x > FFMAX(s->h_edge_pos - (motion_x&3) - 16, 0)
- || (unsigned)src_y > FFMAX( v_edge_pos - (motion_y&3) - h , 0)){
- s->dsp.emulated_edge_mc(s->edge_emu_buffer, ptr_y, s->linesize,
- 17, 17+field_based, src_x, src_y<<field_based,
- s->h_edge_pos, s->v_edge_pos);
- ptr_y= s->edge_emu_buffer;
- if(!CONFIG_GRAY || !(s->flags&CODEC_FLAG_GRAY)){
- uint8_t *uvbuf= s->edge_emu_buffer + 18*s->linesize;
- s->dsp.emulated_edge_mc(uvbuf, ptr_cb, s->uvlinesize,
- 9, 9 + field_based,
- uvsrc_x, uvsrc_y<<field_based,
- s->h_edge_pos>>1, s->v_edge_pos>>1);
- s->dsp.emulated_edge_mc(uvbuf + 16, ptr_cr, s->uvlinesize,
- 9, 9 + field_based,
- uvsrc_x, uvsrc_y<<field_based,
- s->h_edge_pos>>1, s->v_edge_pos>>1);
- ptr_cb= uvbuf;
- ptr_cr= uvbuf + 16;
- }
- }
-
- if(!field_based)
- qpix_op[0][dxy](dest_y, ptr_y, linesize);
- else{
- if(bottom_field){
- dest_y += s->linesize;
- dest_cb+= s->uvlinesize;
- dest_cr+= s->uvlinesize;
- }
-
- if(field_select){
- ptr_y += s->linesize;
- ptr_cb += s->uvlinesize;
- ptr_cr += s->uvlinesize;
- }
- //damn interlaced mode
- //FIXME boundary mirroring is not exactly correct here
- qpix_op[1][dxy](dest_y , ptr_y , linesize);
- qpix_op[1][dxy](dest_y+8, ptr_y+8, linesize);
- }
- if(!CONFIG_GRAY || !(s->flags&CODEC_FLAG_GRAY)){
- pix_op[1][uvdxy](dest_cr, ptr_cr, uvlinesize, h >> 1);
- pix_op[1][uvdxy](dest_cb, ptr_cb, uvlinesize, h >> 1);
- }
-}
-
-/**
- * h263 chroma 4mv motion compensation.
- */
-static inline void chroma_4mv_motion(MpegEncContext *s,
- uint8_t *dest_cb, uint8_t *dest_cr,
- uint8_t **ref_picture,
- op_pixels_func *pix_op,
- int mx, int my){
- int dxy, emu=0, src_x, src_y, offset;
- uint8_t *ptr;
-
- /* In case of 8X8, we construct a single chroma motion vector
- with a special rounding */
- mx= ff_h263_round_chroma(mx);
- my= ff_h263_round_chroma(my);
-
- dxy = ((my & 1) << 1) | (mx & 1);
- mx >>= 1;
- my >>= 1;
-
- src_x = s->mb_x * 8 + mx;
- src_y = s->mb_y * 8 + my;
- src_x = av_clip(src_x, -8, (s->width >> 1));
- if (src_x == (s->width >> 1))
- dxy &= ~1;
- src_y = av_clip(src_y, -8, (s->height >> 1));
- if (src_y == (s->height >> 1))
- dxy &= ~2;
-
- offset = src_y * s->uvlinesize + src_x;
- ptr = ref_picture[1] + offset;
- if(s->flags&CODEC_FLAG_EMU_EDGE){
- if( (unsigned)src_x > FFMAX((s->h_edge_pos>>1) - (dxy &1) - 8, 0)
- || (unsigned)src_y > FFMAX((s->v_edge_pos>>1) - (dxy>>1) - 8, 0)){
- s->dsp.emulated_edge_mc(s->edge_emu_buffer, ptr, s->uvlinesize,
- 9, 9, src_x, src_y,
- s->h_edge_pos>>1, s->v_edge_pos>>1);
- ptr= s->edge_emu_buffer;
- emu=1;
- }
- }
- pix_op[dxy](dest_cb, ptr, s->uvlinesize, 8);
-
- ptr = ref_picture[2] + offset;
- if(emu){
- s->dsp.emulated_edge_mc(s->edge_emu_buffer, ptr, s->uvlinesize,
- 9, 9, src_x, src_y,
- s->h_edge_pos>>1, s->v_edge_pos>>1);
- ptr= s->edge_emu_buffer;
- }
- pix_op[dxy](dest_cr, ptr, s->uvlinesize, 8);
-}
-
-static inline void prefetch_motion(MpegEncContext *s, uint8_t **pix, int dir){
- /* fetch pixels for estimated mv 4 macroblocks ahead
- * optimized for 64byte cache lines */
- const int shift = s->quarter_sample ? 2 : 1;
- const int mx= (s->mv[dir][0][0]>>shift) + 16*s->mb_x + 8;
- const int my= (s->mv[dir][0][1]>>shift) + 16*s->mb_y;
- int off= mx + (my + (s->mb_x&3)*4)*s->linesize + 64;
- s->dsp.prefetch(pix[0]+off, s->linesize, 4);
- off= (mx>>1) + ((my>>1) + (s->mb_x&7))*s->uvlinesize + 64;
- s->dsp.prefetch(pix[1]+off, pix[2]-pix[1], 2);
-}
-
-/**
- * motion compensation of a single macroblock
- * @param s context
- * @param dest_y luma destination pointer
- * @param dest_cb chroma cb/u destination pointer
- * @param dest_cr chroma cr/v destination pointer
- * @param dir direction (0->forward, 1->backward)
- * @param ref_picture array[3] of pointers to the 3 planes of the reference picture
- * @param pix_op halfpel motion compensation function (average or put normally)
- * @param qpix_op qpel motion compensation function (average or put normally)
- * the motion vectors are taken from s->mv and the MV type from s->mv_type
- */
-static av_always_inline void MPV_motion_internal(MpegEncContext *s,
- uint8_t *dest_y, uint8_t *dest_cb,
- uint8_t *dest_cr, int dir,
- uint8_t **ref_picture,
- op_pixels_func (*pix_op)[4],
- qpel_mc_func (*qpix_op)[16], int is_mpeg12)
-{
- int dxy, mx, my, src_x, src_y, motion_x, motion_y;
- int mb_x, mb_y, i;
- uint8_t *ptr, *dest;
-
- mb_x = s->mb_x;
- mb_y = s->mb_y;
-
- prefetch_motion(s, ref_picture, dir);
-
- if(!is_mpeg12 && s->obmc && s->pict_type != AV_PICTURE_TYPE_B){
- int16_t mv_cache[4][4][2];
- const int xy= s->mb_x + s->mb_y*s->mb_stride;
- const int mot_stride= s->b8_stride;
- const int mot_xy= mb_x*2 + mb_y*2*mot_stride;
-
- assert(!s->mb_skipped);
-
- memcpy(mv_cache[1][1], s->current_picture.f.motion_val[0][mot_xy ], sizeof(int16_t) * 4);
- memcpy(mv_cache[2][1], s->current_picture.f.motion_val[0][mot_xy + mot_stride], sizeof(int16_t) * 4);
- memcpy(mv_cache[3][1], s->current_picture.f.motion_val[0][mot_xy + mot_stride], sizeof(int16_t) * 4);
-
- if (mb_y == 0 || IS_INTRA(s->current_picture.f.mb_type[xy - s->mb_stride])) {
- memcpy(mv_cache[0][1], mv_cache[1][1], sizeof(int16_t)*4);
- }else{
- memcpy(mv_cache[0][1], s->current_picture.f.motion_val[0][mot_xy - mot_stride], sizeof(int16_t) * 4);
- }
-
- if (mb_x == 0 || IS_INTRA(s->current_picture.f.mb_type[xy - 1])) {
- AV_COPY32(mv_cache[1][0], mv_cache[1][1]);
- AV_COPY32(mv_cache[2][0], mv_cache[2][1]);
- }else{
- AV_COPY32(mv_cache[1][0], s->current_picture.f.motion_val[0][mot_xy - 1]);
- AV_COPY32(mv_cache[2][0], s->current_picture.f.motion_val[0][mot_xy - 1 + mot_stride]);
- }
-
- if (mb_x + 1 >= s->mb_width || IS_INTRA(s->current_picture.f.mb_type[xy + 1])) {
- AV_COPY32(mv_cache[1][3], mv_cache[1][2]);
- AV_COPY32(mv_cache[2][3], mv_cache[2][2]);
- }else{
- AV_COPY32(mv_cache[1][3], s->current_picture.f.motion_val[0][mot_xy + 2]);
- AV_COPY32(mv_cache[2][3], s->current_picture.f.motion_val[0][mot_xy + 2 + mot_stride]);
- }
-
- mx = 0;
- my = 0;
- for(i=0;i<4;i++) {
- const int x= (i&1)+1;
- const int y= (i>>1)+1;
- int16_t mv[5][2]= {
- {mv_cache[y][x ][0], mv_cache[y][x ][1]},
- {mv_cache[y-1][x][0], mv_cache[y-1][x][1]},
- {mv_cache[y][x-1][0], mv_cache[y][x-1][1]},
- {mv_cache[y][x+1][0], mv_cache[y][x+1][1]},
- {mv_cache[y+1][x][0], mv_cache[y+1][x][1]}};
- //FIXME cleanup
- obmc_motion(s, dest_y + ((i & 1) * 8) + (i >> 1) * 8 * s->linesize,
- ref_picture[0],
- mb_x * 16 + (i & 1) * 8, mb_y * 16 + (i >>1) * 8,
- pix_op[1],
- mv);
-
- mx += mv[0][0];
- my += mv[0][1];
- }
- if(!CONFIG_GRAY || !(s->flags&CODEC_FLAG_GRAY))
- chroma_4mv_motion(s, dest_cb, dest_cr, ref_picture, pix_op[1], mx, my);
-
- return;
- }
-
- switch(s->mv_type) {
- case MV_TYPE_16X16:
- if(s->mcsel){
- if(s->real_sprite_warping_points==1){
- gmc1_motion(s, dest_y, dest_cb, dest_cr,
- ref_picture);
- }else{
- gmc_motion(s, dest_y, dest_cb, dest_cr,
- ref_picture);
- }
- }else if(!is_mpeg12 && s->quarter_sample){
- qpel_motion(s, dest_y, dest_cb, dest_cr,
- 0, 0, 0,
- ref_picture, pix_op, qpix_op,
- s->mv[dir][0][0], s->mv[dir][0][1], 16);
- } else if (!is_mpeg12 && (CONFIG_WMV2_DECODER || CONFIG_WMV2_ENCODER) &&
- s->mspel && s->codec_id == CODEC_ID_WMV2) {
- ff_mspel_motion(s, dest_y, dest_cb, dest_cr,
- ref_picture, pix_op,
- s->mv[dir][0][0], s->mv[dir][0][1], 16);
- }else
- {
- mpeg_motion(s, dest_y, dest_cb, dest_cr,
- 0, 0, 0,
- ref_picture, pix_op,
- s->mv[dir][0][0], s->mv[dir][0][1], 16, mb_y);
- }
- break;
- case MV_TYPE_8X8:
- if (!is_mpeg12) {
- mx = 0;
- my = 0;
- if(s->quarter_sample){
- for(i=0;i<4;i++) {
- motion_x = s->mv[dir][i][0];
- motion_y = s->mv[dir][i][1];
-
- dxy = ((motion_y & 3) << 2) | (motion_x & 3);
- src_x = mb_x * 16 + (motion_x >> 2) + (i & 1) * 8;
- src_y = mb_y * 16 + (motion_y >> 2) + (i >>1) * 8;
-
- /* WARNING: do no forget half pels */
- src_x = av_clip(src_x, -16, s->width);
- if (src_x == s->width)
- dxy &= ~3;
- src_y = av_clip(src_y, -16, s->height);
- if (src_y == s->height)
- dxy &= ~12;
-
- ptr = ref_picture[0] + (src_y * s->linesize) + (src_x);
- if(s->flags&CODEC_FLAG_EMU_EDGE){
- if( (unsigned)src_x > FFMAX(s->h_edge_pos - (motion_x&3) - 8, 0)
- || (unsigned)src_y > FFMAX(s->v_edge_pos - (motion_y&3) - 8, 0)){
- s->dsp.emulated_edge_mc(s->edge_emu_buffer, ptr,
- s->linesize, 9, 9,
- src_x, src_y,
- s->h_edge_pos, s->v_edge_pos);
- ptr= s->edge_emu_buffer;
- }
- }
- dest = dest_y + ((i & 1) * 8) + (i >> 1) * 8 * s->linesize;
- qpix_op[1][dxy](dest, ptr, s->linesize);
-
- mx += s->mv[dir][i][0]/2;
- my += s->mv[dir][i][1]/2;
- }
- }else{
- for(i=0;i<4;i++) {
- hpel_motion(s, dest_y + ((i & 1) * 8) + (i >> 1) * 8 * s->linesize,
- ref_picture[0], 0, 0,
- mb_x * 16 + (i & 1) * 8, mb_y * 16 + (i >>1) * 8,
- s->width, s->height, s->linesize,
- s->h_edge_pos, s->v_edge_pos,
- 8, 8, pix_op[1],
- s->mv[dir][i][0], s->mv[dir][i][1]);
-
- mx += s->mv[dir][i][0];
- my += s->mv[dir][i][1];
- }
- }
-
- if(!CONFIG_GRAY || !(s->flags&CODEC_FLAG_GRAY))
- chroma_4mv_motion(s, dest_cb, dest_cr, ref_picture, pix_op[1], mx, my);
- }
- break;
- case MV_TYPE_FIELD:
- if (s->picture_structure == PICT_FRAME) {
- if(!is_mpeg12 && s->quarter_sample){
- for(i=0; i<2; i++){
- qpel_motion(s, dest_y, dest_cb, dest_cr,
- 1, i, s->field_select[dir][i],
- ref_picture, pix_op, qpix_op,
- s->mv[dir][i][0], s->mv[dir][i][1], 8);
- }
- }else{
- /* top field */
- mpeg_motion(s, dest_y, dest_cb, dest_cr,
- 1, 0, s->field_select[dir][0],
- ref_picture, pix_op,
- s->mv[dir][0][0], s->mv[dir][0][1], 8, mb_y);
- /* bottom field */
- mpeg_motion(s, dest_y, dest_cb, dest_cr,
- 1, 1, s->field_select[dir][1],
- ref_picture, pix_op,
- s->mv[dir][1][0], s->mv[dir][1][1], 8, mb_y);
- }
- } else {
- if(s->picture_structure != s->field_select[dir][0] + 1 && s->pict_type != AV_PICTURE_TYPE_B && !s->first_field){
- ref_picture = s->current_picture_ptr->f.data;
- }
-
- mpeg_motion(s, dest_y, dest_cb, dest_cr,
- 0, 0, s->field_select[dir][0],
- ref_picture, pix_op,
- s->mv[dir][0][0], s->mv[dir][0][1], 16, mb_y>>1);
- }
- break;
- case MV_TYPE_16X8:
- for(i=0; i<2; i++){
- uint8_t ** ref2picture;
-
- if(s->picture_structure == s->field_select[dir][i] + 1
- || s->pict_type == AV_PICTURE_TYPE_B || s->first_field){
- ref2picture= ref_picture;
- }else{
- ref2picture = s->current_picture_ptr->f.data;
- }
-
- mpeg_motion(s, dest_y, dest_cb, dest_cr,
- 0, 0, s->field_select[dir][i],
- ref2picture, pix_op,
- s->mv[dir][i][0], s->mv[dir][i][1] + 16*i, 8, mb_y>>1);
-
- dest_y += 16*s->linesize;
- dest_cb+= (16>>s->chroma_y_shift)*s->uvlinesize;
- dest_cr+= (16>>s->chroma_y_shift)*s->uvlinesize;
- }
- break;
- case MV_TYPE_DMV:
- if(s->picture_structure == PICT_FRAME){
- for(i=0; i<2; i++){
- int j;
- for(j=0; j<2; j++){
- mpeg_motion(s, dest_y, dest_cb, dest_cr,
- 1, j, j^i,
- ref_picture, pix_op,
- s->mv[dir][2*i + j][0], s->mv[dir][2*i + j][1], 8, mb_y);
- }
- pix_op = s->dsp.avg_pixels_tab;
- }
- }else{
- for(i=0; i<2; i++){
- mpeg_motion(s, dest_y, dest_cb, dest_cr,
- 0, 0, s->picture_structure != i+1,
- ref_picture, pix_op,
- s->mv[dir][2*i][0],s->mv[dir][2*i][1],16, mb_y>>1);
-
- // after put we make avg of the same block
- pix_op=s->dsp.avg_pixels_tab;
-
- //opposite parity is always in the same frame if this is second field
- if(!s->first_field){
- ref_picture = s->current_picture_ptr->f.data;
- }
- }
- }
- break;
- default: assert(0);
- }
-}
-
-static inline void MPV_motion(MpegEncContext *s,
- uint8_t *dest_y, uint8_t *dest_cb,
- uint8_t *dest_cr, int dir,
- uint8_t **ref_picture,
- op_pixels_func (*pix_op)[4],
- qpel_mc_func (*qpix_op)[16])
-{
-#if !CONFIG_SMALL
- if(s->out_format == FMT_MPEG1)
- MPV_motion_internal(s, dest_y, dest_cb, dest_cr, dir,
- ref_picture, pix_op, qpix_op, 1);
- else
-#endif
- MPV_motion_internal(s, dest_y, dest_cb, dest_cr, dir,
- ref_picture, pix_op, qpix_op, 0);
-}
-#endif /* AVCODEC_MPEGVIDEO_COMMON_H */
diff --git a/gst-libs/ext/libav/libavcodec/mpegvideo_enc.c b/gst-libs/ext/libav/libavcodec/mpegvideo_enc.c
index af72806..f783dc7 100644
--- a/gst-libs/ext/libav/libavcodec/mpegvideo_enc.c
+++ b/gst-libs/ext/libav/libavcodec/mpegvideo_enc.c
@@ -29,12 +29,13 @@
#include "libavutil/intmath.h"
#include "libavutil/mathematics.h"
+#include "libavutil/pixdesc.h"
#include "libavutil/opt.h"
#include "avcodec.h"
#include "dsputil.h"
#include "mpegvideo.h"
-#include "mpegvideo_common.h"
#include "h263.h"
+#include "mathops.h"
#include "mjpegenc.h"
#include "msmpeg4.h"
#include "faandct.h"
@@ -43,6 +44,7 @@
#include "flv.h"
#include "mpeg4video.h"
#include "internal.h"
+#include "bytestream.h"
#include <limits.h>
//#undef NDEBUG
@@ -62,6 +64,11 @@ static int dct_quantize_trellis_c(MpegEncContext *s, DCTELEM *block, int n, int
static uint8_t default_mv_penalty[MAX_FCODE + 1][MAX_MV * 2 + 1];
static uint8_t default_fcode_tab[MAX_MV * 2 + 1];
+const AVOption ff_mpv_generic_options[] = {
+ FF_MPV_COMMON_OPTS
+ { NULL },
+};
+
void ff_convert_matrix(DSPContext *dsp, int (*qmat)[64],
uint16_t (*qmat16)[2][64],
const uint16_t *quant_matrix,
@@ -73,11 +80,8 @@ void ff_convert_matrix(DSPContext *dsp, int (*qmat)[64],
for (qscale = qmin; qscale <= qmax; qscale++) {
int i;
if (dsp->fdct == ff_jpeg_fdct_islow_8 ||
- dsp->fdct == ff_jpeg_fdct_islow_10
-#ifdef FAAN_POSTSCALE
- || dsp->fdct == ff_faandct
-#endif
- ) {
+ dsp->fdct == ff_jpeg_fdct_islow_10 ||
+ dsp->fdct == ff_faandct) {
for (i = 0; i < 64; i++) {
const int j = dsp->idct_permutation[i];
/* 16 <= qscale * quant_matrix[i] <= 7905
@@ -89,11 +93,7 @@ void ff_convert_matrix(DSPContext *dsp, int (*qmat)[64],
qmat[qscale][i] = (int)((UINT64_C(1) << QMAT_SHIFT) /
(qscale * quant_matrix[j]));
}
- } else if (dsp->fdct == fdct_ifast
-#ifndef FAAN_POSTSCALE
- || dsp->fdct == ff_faandct
-#endif
- ) {
+ } else if (dsp->fdct == ff_fdct_ifast) {
for (i = 0; i < 64; i++) {
const int j = dsp->idct_permutation[i];
/* 16 <= qscale * quant_matrix[i] <= 7905
@@ -132,11 +132,7 @@ void ff_convert_matrix(DSPContext *dsp, int (*qmat)[64],
for (i = intra; i < 64; i++) {
int64_t max = 8191;
- if (dsp->fdct == fdct_ifast
-#ifndef FAAN_POSTSCALE
- || dsp->fdct == ff_faandct
-#endif
- ) {
+ if (dsp->fdct == ff_fdct_ifast) {
max = (8191LL * ff_aanscales[i]) >> 14;
}
while (((max * qmat[qscale][i]) >> shift) > INT_MAX) {
@@ -264,7 +260,7 @@ static void update_duplicate_context_after_me(MpegEncContext *dst,
static void MPV_encode_defaults(MpegEncContext *s)
{
int i;
- MPV_common_defaults(s);
+ ff_MPV_common_defaults(s);
for (i = -16; i < 16; i++) {
default_fcode_tab[i + MAX_MV] = 1;
@@ -274,7 +270,7 @@ static void MPV_encode_defaults(MpegEncContext *s)
}
/* init video encoder */
-av_cold int MPV_encode_init(AVCodecContext *avctx)
+av_cold int ff_MPV_encode_init(AVCodecContext *avctx)
{
MpegEncContext *s = avctx->priv_data;
int i;
@@ -283,51 +279,51 @@ av_cold int MPV_encode_init(AVCodecContext *avctx)
MPV_encode_defaults(s);
switch (avctx->codec_id) {
- case CODEC_ID_MPEG2VIDEO:
- if (avctx->pix_fmt != PIX_FMT_YUV420P &&
- avctx->pix_fmt != PIX_FMT_YUV422P) {
+ case AV_CODEC_ID_MPEG2VIDEO:
+ if (avctx->pix_fmt != AV_PIX_FMT_YUV420P &&
+ avctx->pix_fmt != AV_PIX_FMT_YUV422P) {
av_log(avctx, AV_LOG_ERROR,
"only YUV420 and YUV422 are supported\n");
return -1;
}
break;
- case CODEC_ID_LJPEG:
- if (avctx->pix_fmt != PIX_FMT_YUVJ420P &&
- avctx->pix_fmt != PIX_FMT_YUVJ422P &&
- avctx->pix_fmt != PIX_FMT_YUVJ444P &&
- avctx->pix_fmt != PIX_FMT_BGRA &&
- ((avctx->pix_fmt != PIX_FMT_YUV420P &&
- avctx->pix_fmt != PIX_FMT_YUV422P &&
- avctx->pix_fmt != PIX_FMT_YUV444P) ||
+ case AV_CODEC_ID_LJPEG:
+ if (avctx->pix_fmt != AV_PIX_FMT_YUVJ420P &&
+ avctx->pix_fmt != AV_PIX_FMT_YUVJ422P &&
+ avctx->pix_fmt != AV_PIX_FMT_YUVJ444P &&
+ avctx->pix_fmt != AV_PIX_FMT_BGRA &&
+ ((avctx->pix_fmt != AV_PIX_FMT_YUV420P &&
+ avctx->pix_fmt != AV_PIX_FMT_YUV422P &&
+ avctx->pix_fmt != AV_PIX_FMT_YUV444P) ||
avctx->strict_std_compliance > FF_COMPLIANCE_UNOFFICIAL)) {
av_log(avctx, AV_LOG_ERROR, "colorspace not supported in LJPEG\n");
return -1;
}
break;
- case CODEC_ID_MJPEG:
- if (avctx->pix_fmt != PIX_FMT_YUVJ420P &&
- avctx->pix_fmt != PIX_FMT_YUVJ422P &&
- ((avctx->pix_fmt != PIX_FMT_YUV420P &&
- avctx->pix_fmt != PIX_FMT_YUV422P) ||
+ case AV_CODEC_ID_MJPEG:
+ if (avctx->pix_fmt != AV_PIX_FMT_YUVJ420P &&
+ avctx->pix_fmt != AV_PIX_FMT_YUVJ422P &&
+ ((avctx->pix_fmt != AV_PIX_FMT_YUV420P &&
+ avctx->pix_fmt != AV_PIX_FMT_YUV422P) ||
avctx->strict_std_compliance > FF_COMPLIANCE_UNOFFICIAL)) {
av_log(avctx, AV_LOG_ERROR, "colorspace not supported in jpeg\n");
return -1;
}
break;
default:
- if (avctx->pix_fmt != PIX_FMT_YUV420P) {
+ if (avctx->pix_fmt != AV_PIX_FMT_YUV420P) {
av_log(avctx, AV_LOG_ERROR, "only YUV420 is supported\n");
return -1;
}
}
switch (avctx->pix_fmt) {
- case PIX_FMT_YUVJ422P:
- case PIX_FMT_YUV422P:
+ case AV_PIX_FMT_YUVJ422P:
+ case AV_PIX_FMT_YUV422P:
s->chroma_format = CHROMA_422;
break;
- case PIX_FMT_YUVJ420P:
- case PIX_FMT_YUV420P:
+ case AV_PIX_FMT_YUVJ420P:
+ case AV_PIX_FMT_YUV420P:
default:
s->chroma_format = CHROMA_420;
break;
@@ -348,13 +344,13 @@ av_cold int MPV_encode_init(AVCodecContext *avctx)
s->flags2 = avctx->flags2;
s->max_b_frames = avctx->max_b_frames;
s->codec_id = avctx->codec->id;
- s->luma_elim_threshold = avctx->luma_elim_threshold;
- s->chroma_elim_threshold = avctx->chroma_elim_threshold;
- s->strict_std_compliance = avctx->strict_std_compliance;
-#if FF_API_MPEGVIDEO_GLOBAL_OPTS
- if (avctx->flags & CODEC_FLAG_PART)
- s->data_partitioning = 1;
+#if FF_API_MPV_GLOBAL_OPTS
+ if (avctx->luma_elim_threshold)
+ s->luma_elim_threshold = avctx->luma_elim_threshold;
+ if (avctx->chroma_elim_threshold)
+ s->chroma_elim_threshold = avctx->chroma_elim_threshold;
#endif
+ s->strict_std_compliance = avctx->strict_std_compliance;
s->quarter_sample = (avctx->flags & CODEC_FLAG_QPEL) != 0;
s->mpeg_quant = avctx->mpeg_quant;
s->rtp_mode = !!avctx->rtp_payload_size;
@@ -373,22 +369,21 @@ av_cold int MPV_encode_init(AVCodecContext *avctx)
/* Fixed QSCALE */
s->fixed_qscale = !!(avctx->flags & CODEC_FLAG_QSCALE);
+#if FF_API_MPV_GLOBAL_OPTS
+ if (s->flags & CODEC_FLAG_QP_RD)
+ s->mpv_flags |= FF_MPV_FLAG_QP_RD;
+#endif
+
s->adaptive_quant = (s->avctx->lumi_masking ||
s->avctx->dark_masking ||
s->avctx->temporal_cplx_masking ||
s->avctx->spatial_cplx_masking ||
s->avctx->p_masking ||
s->avctx->border_masking ||
- (s->flags & CODEC_FLAG_QP_RD)) &&
+ (s->mpv_flags & FF_MPV_FLAG_QP_RD)) &&
!s->fixed_qscale;
s->loop_filter = !!(s->flags & CODEC_FLAG_LOOP_FILTER);
-#if FF_API_MPEGVIDEO_GLOBAL_OPTS
- s->alternate_scan = !!(s->flags & CODEC_FLAG_ALT_SCAN);
- s->intra_vlc_format = !!(s->flags2 & CODEC_FLAG2_INTRA_VLC);
- s->q_scale_type = !!(s->flags2 & CODEC_FLAG2_NON_LINEAR_QUANT);
- s->obmc = !!(s->flags & CODEC_FLAG_OBMC);
-#endif
if (avctx->rc_max_rate && !avctx->rc_buffer_size) {
av_log(avctx, AV_LOG_ERROR,
@@ -436,8 +431,8 @@ av_cold int MPV_encode_init(AVCodecContext *avctx)
if (s->avctx->rc_max_rate &&
s->avctx->rc_min_rate == s->avctx->rc_max_rate &&
- (s->codec_id == CODEC_ID_MPEG1VIDEO ||
- s->codec_id == CODEC_ID_MPEG2VIDEO) &&
+ (s->codec_id == AV_CODEC_ID_MPEG1VIDEO ||
+ s->codec_id == AV_CODEC_ID_MPEG2VIDEO) &&
90000LL * (avctx->rc_buffer_size - 1) >
s->avctx->rc_max_rate * 0xFFFFLL) {
av_log(avctx, AV_LOG_INFO,
@@ -445,9 +440,9 @@ av_cold int MPV_encode_init(AVCodecContext *avctx)
"specified vbv buffer is too large for the given bitrate!\n");
}
- if ((s->flags & CODEC_FLAG_4MV) && s->codec_id != CODEC_ID_MPEG4 &&
- s->codec_id != CODEC_ID_H263 && s->codec_id != CODEC_ID_H263P &&
- s->codec_id != CODEC_ID_FLV1) {
+ if ((s->flags & CODEC_FLAG_4MV) && s->codec_id != AV_CODEC_ID_MPEG4 &&
+ s->codec_id != AV_CODEC_ID_H263 && s->codec_id != AV_CODEC_ID_H263P &&
+ s->codec_id != AV_CODEC_ID_FLV1) {
av_log(avctx, AV_LOG_ERROR, "4MV not supported by codec\n");
return -1;
}
@@ -458,38 +453,22 @@ av_cold int MPV_encode_init(AVCodecContext *avctx)
return -1;
}
-#if FF_API_MPEGVIDEO_GLOBAL_OPTS
- if (s->obmc && s->codec_id != CODEC_ID_H263 &&
- s->codec_id != CODEC_ID_H263P) {
- av_log(avctx, AV_LOG_ERROR, "OBMC is only supported with H263(+)\n");
- return -1;
- }
-#endif
-
- if (s->quarter_sample && s->codec_id != CODEC_ID_MPEG4) {
+ if (s->quarter_sample && s->codec_id != AV_CODEC_ID_MPEG4) {
av_log(avctx, AV_LOG_ERROR, "qpel not supported by codec\n");
return -1;
}
-#if FF_API_MPEGVIDEO_GLOBAL_OPTS
- if (s->data_partitioning && s->codec_id != CODEC_ID_MPEG4) {
- av_log(avctx, AV_LOG_ERROR,
- "data partitioning not supported by codec\n");
- return -1;
- }
-#endif
-
if (s->max_b_frames &&
- s->codec_id != CODEC_ID_MPEG4 &&
- s->codec_id != CODEC_ID_MPEG1VIDEO &&
- s->codec_id != CODEC_ID_MPEG2VIDEO) {
+ s->codec_id != AV_CODEC_ID_MPEG4 &&
+ s->codec_id != AV_CODEC_ID_MPEG1VIDEO &&
+ s->codec_id != AV_CODEC_ID_MPEG2VIDEO) {
av_log(avctx, AV_LOG_ERROR, "b frames not supported by codec\n");
return -1;
}
- if ((s->codec_id == CODEC_ID_MPEG4 ||
- s->codec_id == CODEC_ID_H263 ||
- s->codec_id == CODEC_ID_H263P) &&
+ if ((s->codec_id == AV_CODEC_ID_MPEG4 ||
+ s->codec_id == AV_CODEC_ID_H263 ||
+ s->codec_id == AV_CODEC_ID_H263P) &&
(avctx->sample_aspect_ratio.num > 255 ||
avctx->sample_aspect_ratio.den > 255)) {
av_log(avctx, AV_LOG_ERROR,
@@ -498,29 +477,30 @@ av_cold int MPV_encode_init(AVCodecContext *avctx)
return -1;
}
- if ((s->flags & (CODEC_FLAG_INTERLACED_DCT | CODEC_FLAG_INTERLACED_ME
-#if FF_API_MPEGVIDEO_GLOBAL_OPTS
- | CODEC_FLAG_ALT_SCAN
-#endif
- )) &&
- s->codec_id != CODEC_ID_MPEG4 && s->codec_id != CODEC_ID_MPEG2VIDEO) {
+ if ((s->flags & (CODEC_FLAG_INTERLACED_DCT | CODEC_FLAG_INTERLACED_ME)) &&
+ s->codec_id != AV_CODEC_ID_MPEG4 && s->codec_id != AV_CODEC_ID_MPEG2VIDEO) {
av_log(avctx, AV_LOG_ERROR, "interlacing not supported by codec\n");
return -1;
}
// FIXME mpeg2 uses that too
- if (s->mpeg_quant && s->codec_id != CODEC_ID_MPEG4) {
+ if (s->mpeg_quant && s->codec_id != AV_CODEC_ID_MPEG4) {
av_log(avctx, AV_LOG_ERROR,
"mpeg2 style quantization not supported by codec\n");
return -1;
}
- if ((s->flags & CODEC_FLAG_CBP_RD) && !avctx->trellis) {
+#if FF_API_MPV_GLOBAL_OPTS
+ if (s->flags & CODEC_FLAG_CBP_RD)
+ s->mpv_flags |= FF_MPV_FLAG_CBP_RD;
+#endif
+
+ if ((s->mpv_flags & FF_MPV_FLAG_CBP_RD) && !avctx->trellis) {
av_log(avctx, AV_LOG_ERROR, "CBP RD needs trellis quant\n");
return -1;
}
- if ((s->flags & CODEC_FLAG_QP_RD) &&
+ if ((s->mpv_flags & FF_MPV_FLAG_QP_RD) &&
s->avctx->mb_decision != FF_MB_DECISION_RD) {
av_log(avctx, AV_LOG_ERROR, "QP RD needs mbd=2\n");
return -1;
@@ -534,17 +514,8 @@ av_cold int MPV_encode_init(AVCodecContext *avctx)
return -1;
}
-#if FF_API_MPEGVIDEO_GLOBAL_OPTS
- if ((s->flags2 & CODEC_FLAG2_INTRA_VLC) &&
- s->codec_id != CODEC_ID_MPEG2VIDEO) {
- av_log(avctx, AV_LOG_ERROR,
- "intra vlc table not supported by codec\n");
- return -1;
- }
-#endif
-
if (s->flags & CODEC_FLAG_LOW_DELAY) {
- if (s->codec_id != CODEC_ID_MPEG2VIDEO) {
+ if (s->codec_id != AV_CODEC_ID_MPEG2VIDEO) {
av_log(avctx, AV_LOG_ERROR,
"low delay forcing is only available for mpeg2\n");
return -1;
@@ -557,13 +528,6 @@ av_cold int MPV_encode_init(AVCodecContext *avctx)
}
if (s->q_scale_type == 1) {
-#if FF_API_MPEGVIDEO_GLOBAL_OPTS
- if (s->codec_id != CODEC_ID_MPEG2VIDEO) {
- av_log(avctx, AV_LOG_ERROR,
- "non linear quant is only available for mpeg2\n");
- return -1;
- }
-#endif
if (avctx->qmax > 12) {
av_log(avctx, AV_LOG_ERROR,
"non linear quant only supports qmax <= 12 currently\n");
@@ -572,14 +536,10 @@ av_cold int MPV_encode_init(AVCodecContext *avctx)
}
if (s->avctx->thread_count > 1 &&
- s->codec_id != CODEC_ID_MPEG4 &&
- s->codec_id != CODEC_ID_MPEG1VIDEO &&
- s->codec_id != CODEC_ID_MPEG2VIDEO &&
- (s->codec_id != CODEC_ID_H263P
-#if FF_API_MPEGVIDEO_GLOBAL_OPTS
- || !(s->flags & CODEC_FLAG_H263P_SLICE_STRUCT)
-#endif
- )) {
+ s->codec_id != AV_CODEC_ID_MPEG4 &&
+ s->codec_id != AV_CODEC_ID_MPEG1VIDEO &&
+ s->codec_id != AV_CODEC_ID_MPEG2VIDEO &&
+ (s->codec_id != AV_CODEC_ID_H263P)) {
av_log(avctx, AV_LOG_ERROR,
"multi threaded encoding not supported by codec\n");
return -1;
@@ -626,8 +586,8 @@ av_cold int MPV_encode_init(AVCodecContext *avctx)
//return -1;
}
- if (s->mpeg_quant || s->codec_id == CODEC_ID_MPEG1VIDEO ||
- s->codec_id == CODEC_ID_MPEG2VIDEO || s->codec_id == CODEC_ID_MJPEG) {
+ if (s->mpeg_quant || s->codec_id == AV_CODEC_ID_MPEG1VIDEO ||
+ s->codec_id == AV_CODEC_ID_MPEG2VIDEO || s->codec_id == AV_CODEC_ID_MJPEG) {
// (a + x * 3 / 8) / x
s->intra_quant_bias = 3 << (QUANT_BIAS_SHIFT - 3);
s->inter_quant_bias = 0;
@@ -642,10 +602,10 @@ av_cold int MPV_encode_init(AVCodecContext *avctx)
if (avctx->inter_quant_bias != FF_DEFAULT_QUANT_BIAS)
s->inter_quant_bias = avctx->inter_quant_bias;
- avcodec_get_chroma_sub_sample(avctx->pix_fmt, &chroma_h_shift,
- &chroma_v_shift);
+ av_pix_fmt_get_chroma_sub_sample(avctx->pix_fmt, &chroma_h_shift,
+ &chroma_v_shift);
- if (avctx->codec_id == CODEC_ID_MPEG4 &&
+ if (avctx->codec_id == AV_CODEC_ID_MPEG4 &&
s->avctx->time_base.den > (1 << 16) - 1) {
av_log(avctx, AV_LOG_ERROR,
"timebase %d/%d not supported by MPEG 4 standard, "
@@ -656,24 +616,33 @@ av_cold int MPV_encode_init(AVCodecContext *avctx)
}
s->time_increment_bits = av_log2(s->avctx->time_base.den - 1) + 1;
+#if FF_API_MPV_GLOBAL_OPTS
+ if (avctx->flags2 & CODEC_FLAG2_SKIP_RD)
+ s->mpv_flags |= FF_MPV_FLAG_SKIP_RD;
+ if (avctx->flags2 & CODEC_FLAG2_STRICT_GOP)
+ s->mpv_flags |= FF_MPV_FLAG_STRICT_GOP;
+ if (avctx->quantizer_noise_shaping)
+ s->quantizer_noise_shaping = avctx->quantizer_noise_shaping;
+#endif
+
switch (avctx->codec->id) {
- case CODEC_ID_MPEG1VIDEO:
+ case AV_CODEC_ID_MPEG1VIDEO:
s->out_format = FMT_MPEG1;
s->low_delay = !!(s->flags & CODEC_FLAG_LOW_DELAY);
avctx->delay = s->low_delay ? 0 : (s->max_b_frames + 1);
break;
- case CODEC_ID_MPEG2VIDEO:
+ case AV_CODEC_ID_MPEG2VIDEO:
s->out_format = FMT_MPEG1;
s->low_delay = !!(s->flags & CODEC_FLAG_LOW_DELAY);
avctx->delay = s->low_delay ? 0 : (s->max_b_frames + 1);
s->rtp_mode = 1;
break;
- case CODEC_ID_LJPEG:
- case CODEC_ID_MJPEG:
+ case AV_CODEC_ID_LJPEG:
+ case AV_CODEC_ID_MJPEG:
s->out_format = FMT_MJPEG;
s->intra_only = 1; /* force intra only for jpeg */
- if (avctx->codec->id == CODEC_ID_LJPEG &&
- avctx->pix_fmt == PIX_FMT_BGRA) {
+ if (avctx->codec->id == AV_CODEC_ID_LJPEG &&
+ avctx->pix_fmt == AV_PIX_FMT_BGRA) {
s->mjpeg_vsample[0] = s->mjpeg_hsample[0] =
s->mjpeg_vsample[1] = s->mjpeg_hsample[1] =
s->mjpeg_vsample[2] = s->mjpeg_hsample[2] = 1;
@@ -691,7 +660,7 @@ av_cold int MPV_encode_init(AVCodecContext *avctx)
avctx->delay = 0;
s->low_delay = 1;
break;
- case CODEC_ID_H261:
+ case AV_CODEC_ID_H261:
if (!CONFIG_H261_ENCODER)
return -1;
if (ff_h261_get_picture_format(s->width, s->height) < 0) {
@@ -705,7 +674,7 @@ av_cold int MPV_encode_init(AVCodecContext *avctx)
avctx->delay = 0;
s->low_delay = 1;
break;
- case CODEC_ID_H263:
+ case AV_CODEC_ID_H263:
if (!CONFIG_H263_ENCODER)
return -1;
if (ff_match_2uint16(ff_h263_format, FF_ARRAY_ELEMS(ff_h263_format),
@@ -721,18 +690,10 @@ av_cold int MPV_encode_init(AVCodecContext *avctx)
avctx->delay = 0;
s->low_delay = 1;
break;
- case CODEC_ID_H263P:
+ case AV_CODEC_ID_H263P:
s->out_format = FMT_H263;
s->h263_plus = 1;
/* Fx */
-#if FF_API_MPEGVIDEO_GLOBAL_OPTS
- if (avctx->flags & CODEC_FLAG_H263P_UMV)
- s->umvplus = 1;
- if (avctx->flags & CODEC_FLAG_H263P_AIV)
- s->alt_inter_vlc = 1;
- if (avctx->flags & CODEC_FLAG_H263P_SLICE_STRUCT)
- s->h263_slice_structured = 1;
-#endif
s->h263_aic = (avctx->flags & CODEC_FLAG_AC_PRED) ? 1 : 0;
s->modified_quant = s->h263_aic;
s->loop_filter = (avctx->flags & CODEC_FLAG_LOOP_FILTER) ? 1 : 0;
@@ -743,7 +704,7 @@ av_cold int MPV_encode_init(AVCodecContext *avctx)
avctx->delay = 0;
s->low_delay = 1;
break;
- case CODEC_ID_FLV1:
+ case AV_CODEC_ID_FLV1:
s->out_format = FMT_H263;
s->h263_flv = 2; /* format = 1; 11-bit codes */
s->unrestricted_mv = 1;
@@ -751,12 +712,12 @@ av_cold int MPV_encode_init(AVCodecContext *avctx)
avctx->delay = 0;
s->low_delay = 1;
break;
- case CODEC_ID_RV10:
+ case AV_CODEC_ID_RV10:
s->out_format = FMT_H263;
avctx->delay = 0;
s->low_delay = 1;
break;
- case CODEC_ID_RV20:
+ case AV_CODEC_ID_RV20:
s->out_format = FMT_H263;
avctx->delay = 0;
s->low_delay = 1;
@@ -766,14 +727,14 @@ av_cold int MPV_encode_init(AVCodecContext *avctx)
s->loop_filter = 1;
s->unrestricted_mv = 0;
break;
- case CODEC_ID_MPEG4:
+ case AV_CODEC_ID_MPEG4:
s->out_format = FMT_H263;
s->h263_pred = 1;
s->unrestricted_mv = 1;
s->low_delay = s->max_b_frames ? 0 : 1;
avctx->delay = s->low_delay ? 0 : (s->max_b_frames + 1);
break;
- case CODEC_ID_MSMPEG4V2:
+ case AV_CODEC_ID_MSMPEG4V2:
s->out_format = FMT_H263;
s->h263_pred = 1;
s->unrestricted_mv = 1;
@@ -781,7 +742,7 @@ av_cold int MPV_encode_init(AVCodecContext *avctx)
avctx->delay = 0;
s->low_delay = 1;
break;
- case CODEC_ID_MSMPEG4V3:
+ case AV_CODEC_ID_MSMPEG4V3:
s->out_format = FMT_H263;
s->h263_pred = 1;
s->unrestricted_mv = 1;
@@ -790,7 +751,7 @@ av_cold int MPV_encode_init(AVCodecContext *avctx)
avctx->delay = 0;
s->low_delay = 1;
break;
- case CODEC_ID_WMV1:
+ case AV_CODEC_ID_WMV1:
s->out_format = FMT_H263;
s->h263_pred = 1;
s->unrestricted_mv = 1;
@@ -799,7 +760,7 @@ av_cold int MPV_encode_init(AVCodecContext *avctx)
avctx->delay = 0;
s->low_delay = 1;
break;
- case CODEC_ID_WMV2:
+ case AV_CODEC_ID_WMV2:
s->out_format = FMT_H263;
s->h263_pred = 1;
s->unrestricted_mv = 1;
@@ -822,11 +783,14 @@ av_cold int MPV_encode_init(AVCodecContext *avctx)
s->alternate_scan);
/* init */
- if (MPV_common_init(s) < 0)
+ if (ff_MPV_common_init(s) < 0)
return -1;
+ if (ARCH_X86)
+ ff_MPV_encode_init_x86(s);
+
if (!s->dct_quantize)
- s->dct_quantize = dct_quantize_c;
+ s->dct_quantize = ff_dct_quantize_c;
if (!s->denoise_dct)
s->denoise_dct = denoise_dct_c;
s->fast_dct_quantize = s->dct_quantize;
@@ -854,7 +818,7 @@ av_cold int MPV_encode_init(AVCodecContext *avctx)
/* init q matrix */
for (i = 0; i < 64; i++) {
int j = s->dsp.idct_permutation[i];
- if (CONFIG_MPEG4_ENCODER && s->codec_id == CODEC_ID_MPEG4 &&
+ if (CONFIG_MPEG4_ENCODER && s->codec_id == AV_CODEC_ID_MPEG4 &&
s->mpeg_quant) {
s->intra_matrix[j] = ff_mpeg4_default_intra_matrix[i];
s->inter_matrix[j] = ff_mpeg4_default_non_intra_matrix[i];
@@ -889,13 +853,13 @@ av_cold int MPV_encode_init(AVCodecContext *avctx)
return 0;
}
-av_cold int MPV_encode_end(AVCodecContext *avctx)
+av_cold int ff_MPV_encode_end(AVCodecContext *avctx)
{
MpegEncContext *s = avctx->priv_data;
ff_rate_control_uninit(s);
- MPV_common_end(s);
+ ff_MPV_common_end(s);
if ((CONFIG_MJPEG_ENCODER || CONFIG_LJPEG_ENCODER) &&
s->out_format == FMT_MJPEG)
ff_mjpeg_encode_close(s);
@@ -948,7 +912,8 @@ static int load_input_picture(MpegEncContext *s, AVFrame *pic_arg)
AVFrame *pic = NULL;
int64_t pts;
int i;
- const int encoding_delay = s->max_b_frames;
+ const int encoding_delay = s->max_b_frames ? s->max_b_frames :
+ (s->low_delay ? 0 : 1);
int direct = 1;
if (pic_arg) {
@@ -966,6 +931,9 @@ static int load_input_picture(MpegEncContext *s, AVFrame *pic_arg)
"last=%"PRId64"\n", pts, s->user_specified_pts);
return -1;
}
+
+ if (!s->low_delay && pic_arg->display_picture_number == 1)
+ s->dts_delta = time - last;
}
s->user_specified_pts = pts;
} else {
@@ -991,15 +959,15 @@ static int load_input_picture(MpegEncContext *s, AVFrame *pic_arg)
if (pic_arg->linesize[2] != s->uvlinesize)
direct = 0;
- //av_log(AV_LOG_DEBUG, "%d %d %d %d\n",pic_arg->linesize[0],
- // pic_arg->linesize[1], s->linesize, s->uvlinesize);
+ av_dlog(s->avctx, "%d %d %d %d\n", pic_arg->linesize[0],
+ pic_arg->linesize[1], s->linesize, s->uvlinesize);
if (direct) {
i = ff_find_unused_picture(s, 1);
if (i < 0)
return i;
- pic = (AVFrame *) &s->picture[i];
+ pic = &s->picture[i].f;
pic->reference = 3;
for (i = 0; i < 4; i++) {
@@ -1014,7 +982,7 @@ static int load_input_picture(MpegEncContext *s, AVFrame *pic_arg)
if (i < 0)
return i;
- pic = (AVFrame *) &s->picture[i];
+ pic = &s->picture[i].f;
pic->reference = 3;
if (ff_alloc_picture(s, (Picture *) pic, 0) < 0) {
@@ -1027,8 +995,9 @@ static int load_input_picture(MpegEncContext *s, AVFrame *pic_arg)
// empty
} else {
int h_chroma_shift, v_chroma_shift;
- avcodec_get_chroma_sub_sample(s->avctx->pix_fmt, &h_chroma_shift,
- &v_chroma_shift);
+ av_pix_fmt_get_chroma_sub_sample(s->avctx->pix_fmt,
+ &h_chroma_shift,
+ &v_chroma_shift);
for (i = 0; i < 3; i++) {
int src_stride = pic_arg->linesize[i];
@@ -1105,6 +1074,21 @@ static int skip_check(MpegEncContext *s, Picture *p, Picture *ref)
return 0;
}
+static int encode_frame(AVCodecContext *c, AVFrame *frame)
+{
+ AVPacket pkt = { 0 };
+ int ret, got_output;
+
+ av_init_packet(&pkt);
+ ret = avcodec_encode_video2(c, &pkt, frame, &got_output);
+ if (ret < 0)
+ return ret;
+
+ ret = pkt.size;
+ av_free_packet(&pkt);
+ return ret;
+}
+
static int estimate_best_b_count(MpegEncContext *s)
{
AVCodec *codec = avcodec_find_encoder(s->avctx->codec_id);
@@ -1112,8 +1096,6 @@ static int estimate_best_b_count(MpegEncContext *s)
AVFrame input[FF_MAX_B_FRAMES + 2];
const int scale = s->avctx->brd_scale;
int i, j, out_size, p_lambda, b_lambda, lambda2;
- int outbuf_size = s->width * s->height; // FIXME
- uint8_t *outbuf = av_malloc(outbuf_size);
int64_t best_rd = INT64_MAX;
int best_b_count = -1;
@@ -1138,7 +1120,7 @@ static int estimate_best_b_count(MpegEncContext *s)
c->me_cmp = s->avctx->me_cmp;
c->mb_cmp = s->avctx->mb_cmp;
c->me_sub_cmp = s->avctx->me_sub_cmp;
- c->pix_fmt = PIX_FMT_YUV420P;
+ c->pix_fmt = AV_PIX_FMT_YUV420P;
c->time_base = s->avctx->time_base;
c->max_b_frames = s->max_b_frames;
@@ -1190,8 +1172,9 @@ static int estimate_best_b_count(MpegEncContext *s)
input[0].pict_type = AV_PICTURE_TYPE_I;
input[0].quality = 1 * FF_QP2LAMBDA;
- out_size = avcodec_encode_video(c, outbuf,
- outbuf_size, &input[0]);
+
+ out_size = encode_frame(c, &input[0]);
+
//rd += (out_size * lambda2) >> FF_LAMBDA_SHIFT;
for (i = 0; i < s->max_b_frames + 1; i++) {
@@ -1200,14 +1183,15 @@ static int estimate_best_b_count(MpegEncContext *s)
input[i + 1].pict_type = is_p ?
AV_PICTURE_TYPE_P : AV_PICTURE_TYPE_B;
input[i + 1].quality = is_p ? p_lambda : b_lambda;
- out_size = avcodec_encode_video(c, outbuf, outbuf_size,
- &input[i + 1]);
+
+ out_size = encode_frame(c, &input[i + 1]);
+
rd += (out_size * lambda2) >> (FF_LAMBDA_SHIFT - 3);
}
/* get the delayed frames */
while (out_size) {
- out_size = avcodec_encode_video(c, outbuf, outbuf_size, NULL);
+ out_size = encode_frame(c, NULL);
rd += (out_size * lambda2) >> (FF_LAMBDA_SHIFT - 3);
}
@@ -1219,7 +1203,6 @@ static int estimate_best_b_count(MpegEncContext *s)
}
}
- av_freep(&outbuf);
avcodec_close(c);
av_freep(&c);
@@ -1253,10 +1236,6 @@ static int select_input_picture(MpegEncContext *s)
if (s->picture_in_gop_number < s->gop_size &&
skip_check(s, s->input_picture[0], s->next_picture_ptr)) {
// FIXME check that te gop check above is +-1 correct
- //av_log(NULL, AV_LOG_DEBUG, "skip %p %"PRId64"\n",
- // s->input_picture[0]->f.data[0],
- // s->input_picture[0]->pts);
-
if (s->input_picture[0]->f.type == FF_BUFFER_TYPE_SHARED) {
for (i = 0; i < 4; i++)
s->input_picture[0]->f.data[i] = NULL;
@@ -1266,7 +1245,7 @@ static int select_input_picture(MpegEncContext *s)
s->input_picture[0]->f.type == FF_BUFFER_TYPE_INTERNAL);
s->avctx->release_buffer(s->avctx,
- (AVFrame *) s->input_picture[0]);
+ &s->input_picture[0]->f);
}
emms_c();
@@ -1328,9 +1307,6 @@ static int select_input_picture(MpegEncContext *s)
}
emms_c();
- //static int b_count = 0;
- //b_count += b_frames;
- //av_log(s->avctx, AV_LOG_DEBUG, "b_frames: %d\n", b_count);
for (i = b_frames - 1; i >= 0; i--) {
int type = s->input_picture[i]->f.pict_type;
@@ -1344,7 +1320,7 @@ static int select_input_picture(MpegEncContext *s)
}
if (s->picture_in_gop_number + b_frames >= s->gop_size) {
- if ((s->flags2 & CODEC_FLAG2_STRICT_GOP) &&
+ if ((s->mpv_flags & FF_MPV_FLAG_STRICT_GOP) &&
s->gop_size > s->picture_in_gop_number) {
b_frames = s->gop_size - s->picture_in_gop_number - 1;
} else {
@@ -1399,13 +1375,13 @@ no_output_pic:
/* mark us unused / free shared pic */
if (s->reordered_input_picture[0]->f.type == FF_BUFFER_TYPE_INTERNAL)
s->avctx->release_buffer(s->avctx,
- (AVFrame *) s->reordered_input_picture[0]);
+ &s->reordered_input_picture[0]->f);
for (i = 0; i < 4; i++)
s->reordered_input_picture[0]->f.data[i] = NULL;
s->reordered_input_picture[0]->f.type = 0;
- copy_picture_attributes(s, (AVFrame *) pic,
- (AVFrame *) s->reordered_input_picture[0]);
+ copy_picture_attributes(s, &pic->f,
+ &s->reordered_input_picture[0]->f);
s->current_picture_ptr = pic;
} else {
@@ -1424,31 +1400,19 @@ no_output_pic:
ff_copy_picture(&s->current_picture, s->current_picture_ptr);
s->picture_number = s->new_picture.f.display_picture_number;
- //printf("dpn:%d\n", s->picture_number);
} else {
memset(&s->new_picture, 0, sizeof(Picture));
}
return 0;
}
-int MPV_encode_picture(AVCodecContext *avctx,
- unsigned char *buf, int buf_size, void *data)
+int ff_MPV_encode_picture(AVCodecContext *avctx, AVPacket *pkt,
+ const AVFrame *pic_arg, int *got_packet)
{
MpegEncContext *s = avctx->priv_data;
- AVFrame *pic_arg = data;
- int i, stuffing_count;
+ int i, stuffing_count, ret;
int context_count = s->slice_context_count;
- for (i = 0; i < context_count; i++) {
- int start_y = s->thread_context[i]->start_mb_y;
- int end_y = s->thread_context[i]-> end_mb_y;
- int h = s->mb_height;
- uint8_t *start = buf + (size_t)(((int64_t) buf_size) * start_y / h);
- uint8_t *end = buf + (size_t)(((int64_t) buf_size) * end_y / h);
-
- init_put_bits(&s->thread_context[i]->pb, start, end - start);
- }
-
s->picture_in_gop_number++;
if (load_input_picture(s, pic_arg) < 0)
@@ -1460,11 +1424,29 @@ int MPV_encode_picture(AVCodecContext *avctx,
/* output? */
if (s->new_picture.f.data[0]) {
+ if (!pkt->data &&
+ (ret = ff_alloc_packet(pkt, s->mb_width*s->mb_height*MAX_MB_BYTES)) < 0)
+ return ret;
+ if (s->mb_info) {
+ s->mb_info_ptr = av_packet_new_side_data(pkt,
+ AV_PKT_DATA_H263_MB_INFO,
+ s->mb_width*s->mb_height*12);
+ s->prev_mb_info = s->last_mb_info = s->mb_info_size = 0;
+ }
+
+ for (i = 0; i < context_count; i++) {
+ int start_y = s->thread_context[i]->start_mb_y;
+ int end_y = s->thread_context[i]-> end_mb_y;
+ int h = s->mb_height;
+ uint8_t *start = pkt->data + (size_t)(((int64_t) pkt->size) * start_y / h);
+ uint8_t *end = pkt->data + (size_t)(((int64_t) pkt->size) * end_y / h);
+
+ init_put_bits(&s->thread_context[i]->pb, start, end - start);
+ }
+
s->pict_type = s->new_picture.f.pict_type;
//emms_c();
- //printf("qs:%f %f %d\n", s->new_picture.quality,
- // s->current_picture.quality, s->qscale);
- MPV_frame_start(s, avctx);
+ ff_MPV_frame_start(s, avctx);
vbv_retry:
if (encode_picture(s, s->picture_number) < 0)
return -1;
@@ -1479,7 +1461,7 @@ vbv_retry:
avctx->p_count = s->mb_num - s->i_count - s->skip_count;
avctx->skip_count = s->skip_count;
- MPV_frame_end(s);
+ ff_MPV_frame_end(s);
if (CONFIG_MJPEG_ENCODER && s->out_format == FMT_MJPEG)
ff_mjpeg_encode_picture_trailer(s);
@@ -1504,15 +1486,14 @@ vbv_retry:
// done in encode_picture() so we must undo it
if (s->pict_type == AV_PICTURE_TYPE_P) {
if (s->flipflop_rounding ||
- s->codec_id == CODEC_ID_H263P ||
- s->codec_id == CODEC_ID_MPEG4)
+ s->codec_id == AV_CODEC_ID_H263P ||
+ s->codec_id == AV_CODEC_ID_MPEG4)
s->no_rounding ^= 1;
}
if (s->pict_type != AV_PICTURE_TYPE_B) {
s->time_base = s->last_time_base;
s->last_non_b_time = s->time - s->pp_time;
}
- //av_log(NULL, AV_LOG_ERROR, "R:%d ", s->next_lambda);
for (i = 0; i < context_count; i++) {
PutBitContext *pb = &s->thread_context[i]->pb;
init_put_bits(pb, pb->buf, pb->buf_end - pb->buf);
@@ -1547,13 +1528,13 @@ vbv_retry:
}
switch (s->codec_id) {
- case CODEC_ID_MPEG1VIDEO:
- case CODEC_ID_MPEG2VIDEO:
+ case AV_CODEC_ID_MPEG1VIDEO:
+ case AV_CODEC_ID_MPEG2VIDEO:
while (stuffing_count--) {
put_bits(&s->pb, 8, 0);
}
break;
- case CODEC_ID_MPEG4:
+ case AV_CODEC_ID_MPEG4:
put_bits(&s->pb, 16, 0);
put_bits(&s->pb, 16, 0x1C3);
stuffing_count -= 4;
@@ -1604,13 +1585,28 @@ vbv_retry:
}
s->total_bits += s->frame_bits;
avctx->frame_bits = s->frame_bits;
+
+ pkt->pts = s->current_picture.f.pts;
+ if (!s->low_delay) {
+ if (!s->current_picture.f.coded_picture_number)
+ pkt->dts = pkt->pts - s->dts_delta;
+ else
+ pkt->dts = s->reordered_pts;
+ s->reordered_pts = s->input_picture[0]->f.pts;
+ } else
+ pkt->dts = pkt->pts;
+ if (s->current_picture.f.key_frame)
+ pkt->flags |= AV_PKT_FLAG_KEY;
+ if (s->mb_info)
+ av_packet_shrink_side_data(pkt, AV_PKT_DATA_H263_MB_INFO, s->mb_info_size);
} else {
- assert((put_bits_ptr(&s->pb) == s->pb.buf));
s->frame_bits = 0;
}
assert((s->frame_bits & 7) == 0);
- return s->frame_bits / 8;
+ pkt->size = s->frame_bits / 8;
+ *got_packet = !!pkt->size;
+ return 0;
}
static inline void dct_single_coeff_elimination(MpegEncContext *s,
@@ -1752,14 +1748,14 @@ static av_always_inline void encode_mb_internal(MpegEncContext *s,
s->lambda = s->lambda_table[mb_xy];
update_qscale(s);
- if (!(s->flags & CODEC_FLAG_QP_RD)) {
+ if (!(s->mpv_flags & FF_MPV_FLAG_QP_RD)) {
s->qscale = s->current_picture_ptr->f.qscale_table[mb_xy];
s->dquant = s->qscale - last_qp;
if (s->out_format == FMT_H263) {
s->dquant = av_clip(s->dquant, -2, 2);
- if (s->codec_id == CODEC_ID_MPEG4) {
+ if (s->codec_id == AV_CODEC_ID_MPEG4) {
if (!s->mb_intra) {
if (s->pict_type == AV_PICTURE_TYPE_B) {
if (s->dquant & 1 || s->mv_dir & MV_DIRECT)
@@ -1772,7 +1768,7 @@ static av_always_inline void encode_mb_internal(MpegEncContext *s,
}
}
ff_set_qscale(s, last_qp + s->dquant);
- } else if (s->flags & CODEC_FLAG_QP_RD)
+ } else if (s->mpv_flags & FF_MPV_FLAG_QP_RD)
ff_set_qscale(s, s->qscale + s->dquant);
wrap_y = s->linesize;
@@ -1786,16 +1782,16 @@ static av_always_inline void encode_mb_internal(MpegEncContext *s,
if (mb_x * 16 + 16 > s->width || mb_y * 16 + 16 > s->height) {
uint8_t *ebuf = s->edge_emu_buffer + 32;
- s->dsp.emulated_edge_mc(ebuf, ptr_y, wrap_y, 16, 16, mb_x * 16,
- mb_y * 16, s->width, s->height);
+ s->vdsp.emulated_edge_mc(ebuf, ptr_y, wrap_y, 16, 16, mb_x * 16,
+ mb_y * 16, s->width, s->height);
ptr_y = ebuf;
- s->dsp.emulated_edge_mc(ebuf + 18 * wrap_y, ptr_cb, wrap_c, 8,
- mb_block_height, mb_x * 8, mb_y * 8,
- s->width >> 1, s->height >> 1);
+ s->vdsp.emulated_edge_mc(ebuf + 18 * wrap_y, ptr_cb, wrap_c, 8,
+ mb_block_height, mb_x * 8, mb_y * 8,
+ s->width >> 1, s->height >> 1);
ptr_cb = ebuf + 18 * wrap_y;
- s->dsp.emulated_edge_mc(ebuf + 18 * wrap_y + 8, ptr_cr, wrap_c, 8,
- mb_block_height, mb_x * 8, mb_y * 8,
- s->width >> 1, s->height >> 1);
+ s->vdsp.emulated_edge_mc(ebuf + 18 * wrap_y + 8, ptr_cr, wrap_c, 8,
+ mb_block_height, mb_x * 8, mb_y * 8,
+ s->width >> 1, s->height >> 1);
ptr_cr = ebuf + 18 * wrap_y + 8;
}
@@ -1861,14 +1857,16 @@ static av_always_inline void encode_mb_internal(MpegEncContext *s,
}
if (s->mv_dir & MV_DIR_FORWARD) {
- MPV_motion(s, dest_y, dest_cb, dest_cr, 0, s->last_picture.f.data,
- op_pix, op_qpix);
+ ff_MPV_motion(s, dest_y, dest_cb, dest_cr, 0,
+ s->last_picture.f.data,
+ op_pix, op_qpix);
op_pix = s->dsp.avg_pixels_tab;
op_qpix = s->dsp.avg_qpel_pixels_tab;
}
if (s->mv_dir & MV_DIR_BACKWARD) {
- MPV_motion(s, dest_y, dest_cb, dest_cr, 1, s->next_picture.f.data,
- op_pix, op_qpix);
+ ff_MPV_motion(s, dest_y, dest_cb, dest_cr, 1,
+ s->next_picture.f.data,
+ op_pix, op_qpix);
}
if (s->flags & CODEC_FLAG_INTERLACED_DCT) {
@@ -1960,7 +1958,7 @@ static av_always_inline void encode_mb_internal(MpegEncContext *s,
}
}
- if (s->avctx->quantizer_noise_shaping) {
+ if (s->quantizer_noise_shaping) {
if (!skip_dct[0])
get_visual_weight(weight[0], ptr_y , wrap_y);
if (!skip_dct[1])
@@ -2001,7 +1999,7 @@ static av_always_inline void encode_mb_internal(MpegEncContext *s,
} else
s->block_last_index[i] = -1;
}
- if (s->avctx->quantizer_noise_shaping) {
+ if (s->quantizer_noise_shaping) {
for (i = 0; i < mb_block_count; i++) {
if (!skip_dct[i]) {
s->block_last_index[i] =
@@ -2018,7 +2016,7 @@ static av_always_inline void encode_mb_internal(MpegEncContext *s,
for (i = 4; i < mb_block_count; i++)
dct_single_coeff_elimination(s, i, s->chroma_elim_threshold);
- if (s->flags & CODEC_FLAG_CBP_RD) {
+ if (s->mpv_flags & FF_MPV_FLAG_CBP_RD) {
for (i = 0; i < mb_block_count; i++) {
if (s->block_last_index[i] == -1)
s->coded_score[i] = INT_MAX / 256;
@@ -2034,7 +2032,7 @@ static av_always_inline void encode_mb_internal(MpegEncContext *s,
}
// non c quantize code returns incorrect block_last_index FIXME
- if (s->alternate_scan && s->dct_quantize != dct_quantize_c) {
+ if (s->alternate_scan && s->dct_quantize != ff_dct_quantize_c) {
for (i = 0; i < mb_block_count; i++) {
int j;
if (s->block_last_index[i] > 0) {
@@ -2049,38 +2047,38 @@ static av_always_inline void encode_mb_internal(MpegEncContext *s,
/* huffman encode */
switch(s->codec_id){ //FIXME funct ptr could be slightly faster
- case CODEC_ID_MPEG1VIDEO:
- case CODEC_ID_MPEG2VIDEO:
+ case AV_CODEC_ID_MPEG1VIDEO:
+ case AV_CODEC_ID_MPEG2VIDEO:
if (CONFIG_MPEG1VIDEO_ENCODER || CONFIG_MPEG2VIDEO_ENCODER)
- mpeg1_encode_mb(s, s->block, motion_x, motion_y);
+ ff_mpeg1_encode_mb(s, s->block, motion_x, motion_y);
break;
- case CODEC_ID_MPEG4:
+ case AV_CODEC_ID_MPEG4:
if (CONFIG_MPEG4_ENCODER)
- mpeg4_encode_mb(s, s->block, motion_x, motion_y);
+ ff_mpeg4_encode_mb(s, s->block, motion_x, motion_y);
break;
- case CODEC_ID_MSMPEG4V2:
- case CODEC_ID_MSMPEG4V3:
- case CODEC_ID_WMV1:
+ case AV_CODEC_ID_MSMPEG4V2:
+ case AV_CODEC_ID_MSMPEG4V3:
+ case AV_CODEC_ID_WMV1:
if (CONFIG_MSMPEG4_ENCODER)
- msmpeg4_encode_mb(s, s->block, motion_x, motion_y);
+ ff_msmpeg4_encode_mb(s, s->block, motion_x, motion_y);
break;
- case CODEC_ID_WMV2:
+ case AV_CODEC_ID_WMV2:
if (CONFIG_WMV2_ENCODER)
ff_wmv2_encode_mb(s, s->block, motion_x, motion_y);
break;
- case CODEC_ID_H261:
+ case AV_CODEC_ID_H261:
if (CONFIG_H261_ENCODER)
ff_h261_encode_mb(s, s->block, motion_x, motion_y);
break;
- case CODEC_ID_H263:
- case CODEC_ID_H263P:
- case CODEC_ID_FLV1:
- case CODEC_ID_RV10:
- case CODEC_ID_RV20:
+ case AV_CODEC_ID_H263:
+ case AV_CODEC_ID_H263P:
+ case AV_CODEC_ID_FLV1:
+ case AV_CODEC_ID_RV10:
+ case AV_CODEC_ID_RV20:
if (CONFIG_H263_ENCODER)
ff_h263_encode_mb(s, s->block, motion_x, motion_y);
break;
- case CODEC_ID_MJPEG:
+ case AV_CODEC_ID_MJPEG:
if (CONFIG_MJPEG_ENCODER)
ff_mjpeg_encode_mb(s, s->block);
break;
@@ -2195,7 +2193,7 @@ static inline void encode_mb_hq(MpegEncContext *s, MpegEncContext *backup, MpegE
}
if(s->avctx->mb_decision == FF_MB_DECISION_RD){
- MPV_decode_mb(s, s->block);
+ ff_MPV_decode_mb(s, s->block);
score *= s->lambda2;
score += sse_mb(s) << FF_LAMBDA_SHIFT;
@@ -2328,7 +2326,7 @@ static int mb_var_thread(AVCodecContext *c, void *arg){
}
static void write_slice_end(MpegEncContext *s){
- if(CONFIG_MPEG4_ENCODER && s->codec_id==CODEC_ID_MPEG4){
+ if(CONFIG_MPEG4_ENCODER && s->codec_id==AV_CODEC_ID_MPEG4){
if(s->partitioned_frame){
ff_mpeg4_merge_partitions(s);
}
@@ -2345,6 +2343,49 @@ static void write_slice_end(MpegEncContext *s){
s->misc_bits+= get_bits_diff(s);
}
+static void write_mb_info(MpegEncContext *s)
+{
+ uint8_t *ptr = s->mb_info_ptr + s->mb_info_size - 12;
+ int offset = put_bits_count(&s->pb);
+ int mba = s->mb_x + s->mb_width * (s->mb_y % s->gob_index);
+ int gobn = s->mb_y / s->gob_index;
+ int pred_x, pred_y;
+ if (CONFIG_H263_ENCODER)
+ ff_h263_pred_motion(s, 0, 0, &pred_x, &pred_y);
+ bytestream_put_le32(&ptr, offset);
+ bytestream_put_byte(&ptr, s->qscale);
+ bytestream_put_byte(&ptr, gobn);
+ bytestream_put_le16(&ptr, mba);
+ bytestream_put_byte(&ptr, pred_x); /* hmv1 */
+ bytestream_put_byte(&ptr, pred_y); /* vmv1 */
+ /* 4MV not implemented */
+ bytestream_put_byte(&ptr, 0); /* hmv2 */
+ bytestream_put_byte(&ptr, 0); /* vmv2 */
+}
+
+static void update_mb_info(MpegEncContext *s, int startcode)
+{
+ if (!s->mb_info)
+ return;
+ if (put_bits_count(&s->pb) - s->prev_mb_info*8 >= s->mb_info*8) {
+ s->mb_info_size += 12;
+ s->prev_mb_info = s->last_mb_info;
+ }
+ if (startcode) {
+ s->prev_mb_info = put_bits_count(&s->pb)/8;
+ /* This might have incremented mb_info_size above, and we return without
+ * actually writing any info into that slot yet. But in that case,
+ * this will be called again at the start of the after writing the
+ * start code, actually writing the mb info. */
+ return;
+ }
+
+ s->last_mb_info = put_bits_count(&s->pb)/8;
+ if (!s->mb_info_size)
+ s->mb_info_size += 12;
+ write_mb_info(s);
+}
+
static int encode_thread(AVCodecContext *c, void *arg){
MpegEncContext *s= *(void**)arg;
int mb_x, mb_y, pdif = 0;
@@ -2355,7 +2396,6 @@ static int encode_thread(AVCodecContext *c, void *arg){
uint8_t bit_buf2[2][MAX_MB_BYTES];
uint8_t bit_buf_tex[2][MAX_MB_BYTES];
PutBitContext pb[2], pb2[2], tex_pb[2];
-//printf("%d->%d\n", s->resync_mb_y, s->end_mb_y);
ff_check_alignment();
@@ -2388,13 +2428,13 @@ static int encode_thread(AVCodecContext *c, void *arg){
s->last_mv_dir = 0;
switch(s->codec_id){
- case CODEC_ID_H263:
- case CODEC_ID_H263P:
- case CODEC_ID_FLV1:
+ case AV_CODEC_ID_H263:
+ case AV_CODEC_ID_H263P:
+ case AV_CODEC_ID_FLV1:
if (CONFIG_H263_ENCODER)
s->gob_index = ff_h263_get_gob_height(s);
break;
- case CODEC_ID_MPEG4:
+ case AV_CODEC_ID_MPEG4:
if(CONFIG_MPEG4_ENCODER && s->partitioned_frame)
ff_mpeg4_init_partitions(s);
break;
@@ -2405,7 +2445,6 @@ static int encode_thread(AVCodecContext *c, void *arg){
s->first_slice_line = 1;
s->ptr_lastgob = s->pb.buf;
for(mb_y= s->start_mb_y; mb_y < s->end_mb_y; mb_y++) {
-// printf("row %d at %X\n", s->mb_y, (int)s);
s->mb_x=0;
s->mb_y= mb_y;
@@ -2435,7 +2474,7 @@ static int encode_thread(AVCodecContext *c, void *arg){
s->mb_y = mb_y; // moved into loop, can get changed by H.261
ff_update_block_index(s);
- if(CONFIG_H261_ENCODER && s->codec_id == CODEC_ID_H261){
+ if(CONFIG_H261_ENCODER && s->codec_id == AV_CODEC_ID_H261){
ff_h261_reorder_mb_index(s);
xy= s->mb_y*s->mb_stride + s->mb_x;
mb_type= s->mb_type[xy];
@@ -2452,14 +2491,14 @@ static int encode_thread(AVCodecContext *c, void *arg){
if(s->start_mb_y == mb_y && mb_y > 0 && mb_x==0) is_gob_start=1;
switch(s->codec_id){
- case CODEC_ID_H263:
- case CODEC_ID_H263P:
+ case AV_CODEC_ID_H263:
+ case AV_CODEC_ID_H263P:
if(!s->h263_slice_structured)
if(s->mb_x || s->mb_y%s->gob_index) is_gob_start=0;
break;
- case CODEC_ID_MPEG2VIDEO:
+ case AV_CODEC_ID_MPEG2VIDEO:
if(s->mb_x==0 && s->mb_y!=0) is_gob_start=1;
- case CODEC_ID_MPEG1VIDEO:
+ case AV_CODEC_ID_MPEG1VIDEO:
if(s->mb_skip_run) is_gob_start=0;
break;
}
@@ -2468,7 +2507,7 @@ static int encode_thread(AVCodecContext *c, void *arg){
if(s->start_mb_y != mb_y || mb_x!=0){
write_slice_end(s);
- if(CONFIG_MPEG4_ENCODER && s->codec_id==CODEC_ID_MPEG4 && s->partitioned_frame){
+ if(CONFIG_MPEG4_ENCODER && s->codec_id==AV_CODEC_ID_MPEG4 && s->partitioned_frame){
ff_mpeg4_init_partitions(s);
}
}
@@ -2490,23 +2529,24 @@ static int encode_thread(AVCodecContext *c, void *arg){
int number_mb = (mb_y - s->resync_mb_y)*s->mb_width + mb_x - s->resync_mb_x;
s->avctx->rtp_callback(s->avctx, s->ptr_lastgob, current_packet_size, number_mb);
}
+ update_mb_info(s, 1);
switch(s->codec_id){
- case CODEC_ID_MPEG4:
+ case AV_CODEC_ID_MPEG4:
if (CONFIG_MPEG4_ENCODER) {
ff_mpeg4_encode_video_packet_header(s);
ff_mpeg4_clean_buffers(s);
}
break;
- case CODEC_ID_MPEG1VIDEO:
- case CODEC_ID_MPEG2VIDEO:
+ case AV_CODEC_ID_MPEG1VIDEO:
+ case AV_CODEC_ID_MPEG2VIDEO:
if (CONFIG_MPEG1VIDEO_ENCODER || CONFIG_MPEG2VIDEO_ENCODER) {
ff_mpeg1_encode_slice_header(s);
ff_mpeg1_clean_buffers(s);
}
break;
- case CODEC_ID_H263:
- case CODEC_ID_H263P:
+ case AV_CODEC_ID_H263:
+ case AV_CODEC_ID_H263P:
if (CONFIG_H263_ENCODER)
ff_h263_encode_gob_header(s, mb_y);
break;
@@ -2533,7 +2573,9 @@ static int encode_thread(AVCodecContext *c, void *arg){
s->mb_skipped=0;
s->dquant=0; //only for QP_RD
- if(mb_type & (mb_type-1) || (s->flags & CODEC_FLAG_QP_RD)){ // more than 1 MB type possible or CODEC_FLAG_QP_RD
+ update_mb_info(s, 0);
+
+ if (mb_type & (mb_type-1) || (s->mpv_flags & FF_MPV_FLAG_QP_RD)) { // more than 1 MB type possible or FF_MPV_FLAG_QP_RD
int next_block=0;
int pb_bits_count, pb2_bits_count, tex_pb_bits_count;
@@ -2670,7 +2712,7 @@ static int encode_thread(AVCodecContext *c, void *arg){
}
}
- if((s->flags & CODEC_FLAG_QP_RD) && dmin < INT_MAX){
+ if ((s->mpv_flags & FF_MPV_FLAG_QP_RD) && dmin < INT_MAX) {
if(best_s.mv_type==MV_TYPE_16X16){ //FIXME move 4mv after QPRD
const int last_qp= backup_s.qscale;
int qpi, qp, dc[6];
@@ -2735,7 +2777,7 @@ static int encode_thread(AVCodecContext *c, void *arg){
encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_DIRECT, pb, pb2, tex_pb,
&dmin, &next_block, 0, 0);
}
- if(!best_s.mb_intra && s->flags2&CODEC_FLAG2_SKIP_RD){
+ if (!best_s.mb_intra && s->mpv_flags & FF_MPV_FLAG_SKIP_RD) {
int coded=0;
for(i=0; i<6; i++)
coded |= s->block_last_index[i];
@@ -2801,7 +2843,7 @@ static int encode_thread(AVCodecContext *c, void *arg){
}
if(s->avctx->mb_decision == FF_MB_DECISION_BITS)
- MPV_decode_mb(s, s->block);
+ ff_MPV_decode_mb(s, s->block);
} else {
int motion_x = 0, motion_y = 0;
s->mv_type=MV_TYPE_16X16;
@@ -2874,7 +2916,6 @@ static int encode_thread(AVCodecContext *c, void *arg){
s->mb_intra= 0;
motion_x= s->mv[0][0][0] = s->b_forw_mv_table[xy][0];
motion_y= s->mv[0][0][1] = s->b_forw_mv_table[xy][1];
-// printf(" %d %d ", motion_x, motion_y);
break;
case CANDIDATE_MB_TYPE_FORWARD_I:
s->mv_dir = MV_DIR_FORWARD;
@@ -2921,7 +2962,7 @@ static int encode_thread(AVCodecContext *c, void *arg){
s->out_format == FMT_H263 && s->pict_type!=AV_PICTURE_TYPE_B)
ff_h263_update_motion_val(s);
- MPV_decode_mb(s, s->block);
+ ff_MPV_decode_mb(s, s->block);
}
/* clean the MV table in IPS frames for direct mode in B frames */
@@ -2951,13 +2992,14 @@ static int encode_thread(AVCodecContext *c, void *arg){
if(CONFIG_H263_ENCODER && s->out_format == FMT_H263)
ff_h263_loop_filter(s);
}
-//printf("MB %d %d bits\n", s->mb_x+s->mb_y*s->mb_stride, put_bits_count(&s->pb));
+ av_dlog(s->avctx, "MB %d %d bits\n",
+ s->mb_x + s->mb_y * s->mb_stride, put_bits_count(&s->pb));
}
}
//not beautiful here but we must write it before flushing so it has to be here
if (CONFIG_MSMPEG4_ENCODER && s->msmpeg4_version && s->msmpeg4_version<4 && s->pict_type == AV_PICTURE_TYPE_I)
- msmpeg4_encode_ext_header(s);
+ ff_msmpeg4_encode_ext_header(s);
write_slice_end(s);
@@ -3026,13 +3068,13 @@ static int estimate_qp(MpegEncContext *s, int dry_run){
if(s->adaptive_quant){
switch(s->codec_id){
- case CODEC_ID_MPEG4:
+ case AV_CODEC_ID_MPEG4:
if (CONFIG_MPEG4_ENCODER)
ff_clean_mpeg4_qscales(s);
break;
- case CODEC_ID_H263:
- case CODEC_ID_H263P:
- case CODEC_ID_FLV1:
+ case AV_CODEC_ID_H263:
+ case AV_CODEC_ID_H263P:
+ case AV_CODEC_ID_FLV1:
if (CONFIG_H263_ENCODER)
ff_clean_h263_qscales(s);
break;
@@ -3044,7 +3086,6 @@ static int estimate_qp(MpegEncContext *s, int dry_run){
//FIXME broken
}else
s->lambda = s->current_picture.f.quality;
-//printf("%d %d\n", s->avctx->global_quality, s->current_picture.quality);
update_qscale(s);
return 0;
}
@@ -3066,7 +3107,7 @@ static void set_frame_distances(MpegEncContext * s){
static int encode_picture(MpegEncContext *s, int picture_number)
{
- int i;
+ int i, ret;
int bits;
int context_count = s->slice_context_count;
@@ -3078,9 +3119,9 @@ static int encode_picture(MpegEncContext *s, int picture_number)
/* we need to initialize some time vars before we can encode b-frames */
// RAL: Condition added for MPEG1VIDEO
- if (s->codec_id == CODEC_ID_MPEG1VIDEO || s->codec_id == CODEC_ID_MPEG2VIDEO || (s->h263_pred && !s->msmpeg4_version))
+ if (s->codec_id == AV_CODEC_ID_MPEG1VIDEO || s->codec_id == AV_CODEC_ID_MPEG2VIDEO || (s->h263_pred && !s->msmpeg4_version))
set_frame_distances(s);
- if(CONFIG_MPEG4_ENCODER && s->codec_id == CODEC_ID_MPEG4)
+ if(CONFIG_MPEG4_ENCODER && s->codec_id == AV_CODEC_ID_MPEG4)
ff_set_mpeg4_time(s);
s->me.scene_change_score=0;
@@ -3091,7 +3132,7 @@ static int encode_picture(MpegEncContext *s, int picture_number)
if(s->msmpeg4_version >= 3) s->no_rounding=1;
else s->no_rounding=0;
}else if(s->pict_type!=AV_PICTURE_TYPE_B){
- if(s->flipflop_rounding || s->codec_id == CODEC_ID_H263P || s->codec_id == CODEC_ID_MPEG4)
+ if(s->flipflop_rounding || s->codec_id == AV_CODEC_ID_H263P || s->codec_id == AV_CODEC_ID_MPEG4)
s->no_rounding ^= 1;
}
@@ -3109,7 +3150,9 @@ static int encode_picture(MpegEncContext *s, int picture_number)
s->mb_intra=0; //for the rate distortion & bit compare functions
for(i=1; i<context_count; i++){
- ff_update_duplicate_context(s->thread_context[i], s);
+ ret = ff_update_duplicate_context(s->thread_context[i], s);
+ if (ret < 0)
+ return ret;
}
if(ff_init_me(s)<0)
@@ -3147,7 +3190,8 @@ static int encode_picture(MpegEncContext *s, int picture_number)
s->pict_type= AV_PICTURE_TYPE_I;
for(i=0; i<s->mb_stride*s->mb_height; i++)
s->mb_type[i]= CANDIDATE_MB_TYPE_INTRA;
-//printf("Scene change detected, encoding as I Frame %d %d\n", s->current_picture.mb_var_sum, s->current_picture.mc_mb_var_sum);
+ av_dlog(s, "Scene change detected, encoding as I Frame %d %d\n",
+ s->current_picture.mb_var_sum, s->current_picture.mc_mb_var_sum);
}
if(!s->umvplus){
@@ -3245,24 +3289,24 @@ static int encode_picture(MpegEncContext *s, int picture_number)
ff_h261_encode_picture_header(s, picture_number);
break;
case FMT_H263:
- if (CONFIG_WMV2_ENCODER && s->codec_id == CODEC_ID_WMV2)
+ if (CONFIG_WMV2_ENCODER && s->codec_id == AV_CODEC_ID_WMV2)
ff_wmv2_encode_picture_header(s, picture_number);
else if (CONFIG_MSMPEG4_ENCODER && s->msmpeg4_version)
- msmpeg4_encode_picture_header(s, picture_number);
+ ff_msmpeg4_encode_picture_header(s, picture_number);
else if (CONFIG_MPEG4_ENCODER && s->h263_pred)
- mpeg4_encode_picture_header(s, picture_number);
- else if (CONFIG_RV10_ENCODER && s->codec_id == CODEC_ID_RV10)
- rv10_encode_picture_header(s, picture_number);
- else if (CONFIG_RV20_ENCODER && s->codec_id == CODEC_ID_RV20)
- rv20_encode_picture_header(s, picture_number);
- else if (CONFIG_FLV_ENCODER && s->codec_id == CODEC_ID_FLV1)
+ ff_mpeg4_encode_picture_header(s, picture_number);
+ else if (CONFIG_RV10_ENCODER && s->codec_id == AV_CODEC_ID_RV10)
+ ff_rv10_encode_picture_header(s, picture_number);
+ else if (CONFIG_RV20_ENCODER && s->codec_id == AV_CODEC_ID_RV20)
+ ff_rv20_encode_picture_header(s, picture_number);
+ else if (CONFIG_FLV_ENCODER && s->codec_id == AV_CODEC_ID_FLV1)
ff_flv_encode_picture_header(s, picture_number);
else if (CONFIG_H263_ENCODER)
ff_h263_encode_picture_header(s, picture_number);
break;
case FMT_MPEG1:
if (CONFIG_MPEG1VIDEO_ENCODER || CONFIG_MPEG2VIDEO_ENCODER)
- mpeg1_encode_picture_header(s, picture_number);
+ ff_mpeg1_encode_picture_header(s, picture_number);
break;
case FMT_H264:
break;
@@ -3428,11 +3472,7 @@ static int dct_quantize_trellis_c(MpegEncContext *s,
int dct_coeff= FFABS(block[ scantable[i] ]);
int best_score=256*256*256*120;
- if ( s->dsp.fdct == fdct_ifast
-#ifndef FAAN_POSTSCALE
- || s->dsp.fdct == ff_faandct
-#endif
- )
+ if (s->dsp.fdct == ff_fdct_ifast)
dct_coeff= (dct_coeff*ff_inv_aanscales[ scantable[i] ]) >> 12;
zero_distortion= dct_coeff*dct_coeff;
@@ -3749,7 +3789,7 @@ STOP_TIMER("init rem[]")
#ifdef REFINE_STATS
{START_TIMER
#endif
- analyze_gradient = last_non_zero > 2 || s->avctx->quantizer_noise_shaping >= 3;
+ analyze_gradient = last_non_zero > 2 || s->quantizer_noise_shaping >= 3;
if(analyze_gradient){
#ifdef REFINE_STATS
@@ -3807,7 +3847,7 @@ STOP_TIMER("dct")}
const int level= block[j];
int change, old_coeff;
- if(s->avctx->quantizer_noise_shaping < 3 && i > last_non_zero + 1)
+ if(s->quantizer_noise_shaping < 3 && i > last_non_zero + 1)
break;
if(level){
@@ -3825,7 +3865,7 @@ STOP_TIMER("dct")}
int score, new_coeff, unquant_change;
score=0;
- if(s->avctx->quantizer_noise_shaping < 2 && FFABS(new_level) > FFABS(level))
+ if(s->quantizer_noise_shaping < 2 && FFABS(new_level) > FFABS(level))
continue;
if(new_level){
@@ -3998,7 +4038,7 @@ STOP_TIMER("iterative search")
return last_non_zero;
}
-int dct_quantize_c(MpegEncContext *s,
+int ff_dct_quantize_c(MpegEncContext *s,
DCTELEM *block, int n,
int qscale, int *overflow)
{
@@ -4081,8 +4121,10 @@ 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), 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},
+ { "obmc", "use overlapped block motion compensation.", OFFSET(obmc), AV_OPT_TYPE_INT, { .i64 = 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, { .i64 = 0 }, 0, 1, VE},
+ { "mb_info", "emit macroblock info for RFC 2190 packetization, the parameter value is the maximum payload size", OFFSET(mb_info), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, VE },
+ FF_MPV_COMMON_OPTS
{ NULL },
};
@@ -4096,21 +4138,22 @@ static const AVClass h263_class = {
AVCodec ff_h263_encoder = {
.name = "h263",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_H263,
+ .id = AV_CODEC_ID_H263,
.priv_data_size = sizeof(MpegEncContext),
- .init = MPV_encode_init,
- .encode = MPV_encode_picture,
- .close = MPV_encode_end,
- .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE},
+ .init = ff_MPV_encode_init,
+ .encode2 = ff_MPV_encode_picture,
+ .close = ff_MPV_encode_end,
+ .pix_fmts= (const enum AVPixelFormat[]){AV_PIX_FMT_YUV420P, AV_PIX_FMT_NONE},
.long_name= NULL_IF_CONFIG_SMALL("H.263 / H.263-1996"),
.priv_class = &h263_class,
};
static const AVOption h263p_options[] = {
- { "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},
+ { "umv", "Use unlimited motion vectors.", OFFSET(umvplus), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, VE },
+ { "aiv", "Use alternative inter VLC.", OFFSET(alt_inter_vlc), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, VE },
+ { "obmc", "use overlapped block motion compensation.", OFFSET(obmc), AV_OPT_TYPE_INT, { .i64 = 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, { .i64 = 0 }, 0, 1, VE},
+ FF_MPV_COMMON_OPTS
{ NULL },
};
static const AVClass h263p_class = {
@@ -4123,49 +4166,58 @@ static const AVClass h263p_class = {
AVCodec ff_h263p_encoder = {
.name = "h263p",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_H263P,
+ .id = AV_CODEC_ID_H263P,
.priv_data_size = sizeof(MpegEncContext),
- .init = MPV_encode_init,
- .encode = MPV_encode_picture,
- .close = MPV_encode_end,
- .capabilities = CODEC_CAP_SLICE_THREADS,
- .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE},
- .long_name= NULL_IF_CONFIG_SMALL("H.263+ / H.263-1998 / H.263 version 2"),
+ .init = ff_MPV_encode_init,
+ .encode2 = ff_MPV_encode_picture,
+ .close = ff_MPV_encode_end,
+ .capabilities = CODEC_CAP_SLICE_THREADS,
+ .pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_YUV420P, AV_PIX_FMT_NONE },
+ .long_name = NULL_IF_CONFIG_SMALL("H.263+ / H.263-1998 / H.263 version 2"),
.priv_class = &h263p_class,
};
+FF_MPV_GENERIC_CLASS(msmpeg4v2)
+
AVCodec ff_msmpeg4v2_encoder = {
.name = "msmpeg4v2",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_MSMPEG4V2,
+ .id = AV_CODEC_ID_MSMPEG4V2,
.priv_data_size = sizeof(MpegEncContext),
- .init = MPV_encode_init,
- .encode = MPV_encode_picture,
- .close = MPV_encode_end,
- .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE},
- .long_name= NULL_IF_CONFIG_SMALL("MPEG-4 part 2 Microsoft variant version 2"),
+ .init = ff_MPV_encode_init,
+ .encode2 = ff_MPV_encode_picture,
+ .close = ff_MPV_encode_end,
+ .pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_YUV420P, AV_PIX_FMT_NONE },
+ .long_name = NULL_IF_CONFIG_SMALL("MPEG-4 part 2 Microsoft variant version 2"),
+ .priv_class = &msmpeg4v2_class,
};
+FF_MPV_GENERIC_CLASS(msmpeg4v3)
+
AVCodec ff_msmpeg4v3_encoder = {
.name = "msmpeg4",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_MSMPEG4V3,
+ .id = AV_CODEC_ID_MSMPEG4V3,
.priv_data_size = sizeof(MpegEncContext),
- .init = MPV_encode_init,
- .encode = MPV_encode_picture,
- .close = MPV_encode_end,
- .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE},
- .long_name= NULL_IF_CONFIG_SMALL("MPEG-4 part 2 Microsoft variant version 3"),
+ .init = ff_MPV_encode_init,
+ .encode2 = ff_MPV_encode_picture,
+ .close = ff_MPV_encode_end,
+ .pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_YUV420P, AV_PIX_FMT_NONE },
+ .long_name = NULL_IF_CONFIG_SMALL("MPEG-4 part 2 Microsoft variant version 3"),
+ .priv_class = &msmpeg4v3_class,
};
+FF_MPV_GENERIC_CLASS(wmv1)
+
AVCodec ff_wmv1_encoder = {
.name = "wmv1",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_WMV1,
+ .id = AV_CODEC_ID_WMV1,
.priv_data_size = sizeof(MpegEncContext),
- .init = MPV_encode_init,
- .encode = MPV_encode_picture,
- .close = MPV_encode_end,
- .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE},
- .long_name= NULL_IF_CONFIG_SMALL("Windows Media Video 7"),
+ .init = ff_MPV_encode_init,
+ .encode2 = ff_MPV_encode_picture,
+ .close = ff_MPV_encode_end,
+ .pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_YUV420P, AV_PIX_FMT_NONE },
+ .long_name = NULL_IF_CONFIG_SMALL("Windows Media Video 7"),
+ .priv_class = &wmv1_class,
};
diff --git a/gst-libs/ext/libav/libavcodec/mpegvideo_motion.c b/gst-libs/ext/libav/libavcodec/mpegvideo_motion.c
new file mode 100644
index 0000000..536377a
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/mpegvideo_motion.c
@@ -0,0 +1,891 @@
+/*
+ * Copyright (c) 2000,2001 Fabrice Bellard
+ * Copyright (c) 2002-2004 Michael Niedermayer <michaelni@gmx.at>
+ *
+ * 4MV & hq & B-frame encoding stuff by Michael Niedermayer <michaelni@gmx.at>
+ *
+ * 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
+ */
+
+#include <string.h>
+#include "avcodec.h"
+#include "dsputil.h"
+#include "mpegvideo.h"
+#include "mjpegenc.h"
+#include "msmpeg4.h"
+#include <limits.h>
+
+static void gmc1_motion(MpegEncContext *s,
+ uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr,
+ uint8_t **ref_picture)
+{
+ uint8_t *ptr;
+ int offset, src_x, src_y, linesize, uvlinesize;
+ int motion_x, motion_y;
+ int emu=0;
+
+ motion_x= s->sprite_offset[0][0];
+ motion_y= s->sprite_offset[0][1];
+ src_x = s->mb_x * 16 + (motion_x >> (s->sprite_warping_accuracy+1));
+ src_y = s->mb_y * 16 + (motion_y >> (s->sprite_warping_accuracy+1));
+ motion_x<<=(3-s->sprite_warping_accuracy);
+ motion_y<<=(3-s->sprite_warping_accuracy);
+ src_x = av_clip(src_x, -16, s->width);
+ if (src_x == s->width)
+ motion_x =0;
+ src_y = av_clip(src_y, -16, s->height);
+ if (src_y == s->height)
+ motion_y =0;
+
+ linesize = s->linesize;
+ uvlinesize = s->uvlinesize;
+
+ ptr = ref_picture[0] + (src_y * linesize) + src_x;
+
+ if(s->flags&CODEC_FLAG_EMU_EDGE){
+ if( (unsigned)src_x >= FFMAX(s->h_edge_pos - 17, 0)
+ || (unsigned)src_y >= FFMAX(s->v_edge_pos - 17, 0)){
+ s->vdsp.emulated_edge_mc(s->edge_emu_buffer, ptr, linesize, 17, 17, src_x, src_y, s->h_edge_pos, s->v_edge_pos);
+ ptr= s->edge_emu_buffer;
+ }
+ }
+
+ if((motion_x|motion_y)&7){
+ s->dsp.gmc1(dest_y , ptr , linesize, 16, motion_x&15, motion_y&15, 128 - s->no_rounding);
+ s->dsp.gmc1(dest_y+8, ptr+8, linesize, 16, motion_x&15, motion_y&15, 128 - s->no_rounding);
+ }else{
+ int dxy;
+
+ dxy= ((motion_x>>3)&1) | ((motion_y>>2)&2);
+ if (s->no_rounding){
+ s->dsp.put_no_rnd_pixels_tab[0][dxy](dest_y, ptr, linesize, 16);
+ }else{
+ s->dsp.put_pixels_tab [0][dxy](dest_y, ptr, linesize, 16);
+ }
+ }
+
+ if(CONFIG_GRAY && s->flags&CODEC_FLAG_GRAY) return;
+
+ motion_x= s->sprite_offset[1][0];
+ motion_y= s->sprite_offset[1][1];
+ src_x = s->mb_x * 8 + (motion_x >> (s->sprite_warping_accuracy+1));
+ src_y = s->mb_y * 8 + (motion_y >> (s->sprite_warping_accuracy+1));
+ motion_x<<=(3-s->sprite_warping_accuracy);
+ motion_y<<=(3-s->sprite_warping_accuracy);
+ src_x = av_clip(src_x, -8, s->width>>1);
+ if (src_x == s->width>>1)
+ motion_x =0;
+ src_y = av_clip(src_y, -8, s->height>>1);
+ if (src_y == s->height>>1)
+ motion_y =0;
+
+ offset = (src_y * uvlinesize) + src_x;
+ ptr = ref_picture[1] + offset;
+ if(s->flags&CODEC_FLAG_EMU_EDGE){
+ if( (unsigned)src_x >= FFMAX((s->h_edge_pos>>1) - 9, 0)
+ || (unsigned)src_y >= FFMAX((s->v_edge_pos>>1) - 9, 0)){
+ s->vdsp.emulated_edge_mc(s->edge_emu_buffer, ptr, uvlinesize, 9, 9, src_x, src_y, s->h_edge_pos>>1, s->v_edge_pos>>1);
+ ptr= s->edge_emu_buffer;
+ emu=1;
+ }
+ }
+ s->dsp.gmc1(dest_cb, ptr, uvlinesize, 8, motion_x&15, motion_y&15, 128 - s->no_rounding);
+
+ ptr = ref_picture[2] + offset;
+ if(emu){
+ s->vdsp.emulated_edge_mc(s->edge_emu_buffer, ptr, uvlinesize, 9, 9, src_x, src_y, s->h_edge_pos>>1, s->v_edge_pos>>1);
+ ptr= s->edge_emu_buffer;
+ }
+ s->dsp.gmc1(dest_cr, ptr, uvlinesize, 8, motion_x&15, motion_y&15, 128 - s->no_rounding);
+
+ return;
+}
+
+static void gmc_motion(MpegEncContext *s,
+ uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr,
+ uint8_t **ref_picture)
+{
+ uint8_t *ptr;
+ int linesize, uvlinesize;
+ const int a= s->sprite_warping_accuracy;
+ int ox, oy;
+
+ linesize = s->linesize;
+ uvlinesize = s->uvlinesize;
+
+ ptr = ref_picture[0];
+
+ ox= s->sprite_offset[0][0] + s->sprite_delta[0][0]*s->mb_x*16 + s->sprite_delta[0][1]*s->mb_y*16;
+ oy= s->sprite_offset[0][1] + s->sprite_delta[1][0]*s->mb_x*16 + s->sprite_delta[1][1]*s->mb_y*16;
+
+ s->dsp.gmc(dest_y, ptr, linesize, 16,
+ ox,
+ oy,
+ s->sprite_delta[0][0], s->sprite_delta[0][1],
+ s->sprite_delta[1][0], s->sprite_delta[1][1],
+ a+1, (1<<(2*a+1)) - s->no_rounding,
+ s->h_edge_pos, s->v_edge_pos);
+ s->dsp.gmc(dest_y+8, ptr, linesize, 16,
+ ox + s->sprite_delta[0][0]*8,
+ oy + s->sprite_delta[1][0]*8,
+ s->sprite_delta[0][0], s->sprite_delta[0][1],
+ s->sprite_delta[1][0], s->sprite_delta[1][1],
+ a+1, (1<<(2*a+1)) - s->no_rounding,
+ s->h_edge_pos, s->v_edge_pos);
+
+ if(CONFIG_GRAY && s->flags&CODEC_FLAG_GRAY) return;
+
+ ox= s->sprite_offset[1][0] + s->sprite_delta[0][0]*s->mb_x*8 + s->sprite_delta[0][1]*s->mb_y*8;
+ oy= s->sprite_offset[1][1] + s->sprite_delta[1][0]*s->mb_x*8 + s->sprite_delta[1][1]*s->mb_y*8;
+
+ ptr = ref_picture[1];
+ s->dsp.gmc(dest_cb, ptr, uvlinesize, 8,
+ ox,
+ oy,
+ s->sprite_delta[0][0], s->sprite_delta[0][1],
+ s->sprite_delta[1][0], s->sprite_delta[1][1],
+ a+1, (1<<(2*a+1)) - s->no_rounding,
+ s->h_edge_pos>>1, s->v_edge_pos>>1);
+
+ ptr = ref_picture[2];
+ s->dsp.gmc(dest_cr, ptr, uvlinesize, 8,
+ ox,
+ oy,
+ s->sprite_delta[0][0], s->sprite_delta[0][1],
+ s->sprite_delta[1][0], s->sprite_delta[1][1],
+ a+1, (1<<(2*a+1)) - s->no_rounding,
+ s->h_edge_pos>>1, s->v_edge_pos>>1);
+}
+
+static inline int hpel_motion(MpegEncContext *s,
+ uint8_t *dest, uint8_t *src,
+ int src_x, int src_y,
+ op_pixels_func *pix_op,
+ int motion_x, int motion_y)
+{
+ int dxy = 0;
+ int emu=0;
+
+ src_x += motion_x >> 1;
+ src_y += motion_y >> 1;
+
+ /* WARNING: do no forget half pels */
+ src_x = av_clip(src_x, -16, s->width); //FIXME unneeded for emu?
+ if (src_x != s->width)
+ dxy |= motion_x & 1;
+ src_y = av_clip(src_y, -16, s->height);
+ if (src_y != s->height)
+ dxy |= (motion_y & 1) << 1;
+ src += src_y * s->linesize + src_x;
+
+ if(s->unrestricted_mv && (s->flags&CODEC_FLAG_EMU_EDGE)){
+ if( (unsigned)src_x > FFMAX(s->h_edge_pos - (motion_x&1) - 8, 0)
+ || (unsigned)src_y > FFMAX(s->v_edge_pos - (motion_y&1) - 8, 0)){
+ s->vdsp.emulated_edge_mc(s->edge_emu_buffer, src, s->linesize, 9, 9,
+ src_x, src_y, s->h_edge_pos, s->v_edge_pos);
+ src= s->edge_emu_buffer;
+ emu=1;
+ }
+ }
+ pix_op[dxy](dest, src, s->linesize, 8);
+ return emu;
+}
+
+static av_always_inline
+void mpeg_motion_internal(MpegEncContext *s,
+ uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr,
+ int field_based, int bottom_field, int field_select,
+ uint8_t **ref_picture, op_pixels_func (*pix_op)[4],
+ int motion_x, int motion_y, int h, int is_mpeg12, int mb_y)
+{
+ uint8_t *ptr_y, *ptr_cb, *ptr_cr;
+ int dxy, uvdxy, mx, my, src_x, src_y,
+ uvsrc_x, uvsrc_y, v_edge_pos, uvlinesize, linesize;
+
+#if 0
+if(s->quarter_sample)
+{
+ motion_x>>=1;
+ motion_y>>=1;
+}
+#endif
+
+ v_edge_pos = s->v_edge_pos >> field_based;
+ linesize = s->current_picture.f.linesize[0] << field_based;
+ uvlinesize = s->current_picture.f.linesize[1] << field_based;
+
+ dxy = ((motion_y & 1) << 1) | (motion_x & 1);
+ src_x = s->mb_x* 16 + (motion_x >> 1);
+ src_y =( mb_y<<(4-field_based)) + (motion_y >> 1);
+
+ if (!is_mpeg12 && s->out_format == FMT_H263) {
+ if((s->workaround_bugs & FF_BUG_HPEL_CHROMA) && field_based){
+ mx = (motion_x>>1)|(motion_x&1);
+ my = motion_y >>1;
+ uvdxy = ((my & 1) << 1) | (mx & 1);
+ uvsrc_x = s->mb_x* 8 + (mx >> 1);
+ uvsrc_y =( mb_y<<(3-field_based))+ (my >> 1);
+ }else{
+ uvdxy = dxy | (motion_y & 2) | ((motion_x & 2) >> 1);
+ uvsrc_x = src_x>>1;
+ uvsrc_y = src_y>>1;
+ }
+ }else if(!is_mpeg12 && s->out_format == FMT_H261){//even chroma mv's are full pel in H261
+ mx = motion_x / 4;
+ my = motion_y / 4;
+ uvdxy = 0;
+ uvsrc_x = s->mb_x*8 + mx;
+ uvsrc_y = mb_y*8 + my;
+ } else {
+ if(s->chroma_y_shift){
+ mx = motion_x / 2;
+ my = motion_y / 2;
+ uvdxy = ((my & 1) << 1) | (mx & 1);
+ uvsrc_x = s->mb_x* 8 + (mx >> 1);
+ uvsrc_y =( mb_y<<(3-field_based))+ (my >> 1);
+ } else {
+ if(s->chroma_x_shift){
+ //Chroma422
+ mx = motion_x / 2;
+ uvdxy = ((motion_y & 1) << 1) | (mx & 1);
+ uvsrc_x = s->mb_x* 8 + (mx >> 1);
+ uvsrc_y = src_y;
+ } else {
+ //Chroma444
+ uvdxy = dxy;
+ uvsrc_x = src_x;
+ uvsrc_y = src_y;
+ }
+ }
+ }
+
+ ptr_y = ref_picture[0] + src_y * linesize + src_x;
+ ptr_cb = ref_picture[1] + uvsrc_y * uvlinesize + uvsrc_x;
+ ptr_cr = ref_picture[2] + uvsrc_y * uvlinesize + uvsrc_x;
+
+ if( (unsigned)src_x > FFMAX(s->h_edge_pos - (motion_x&1) - 16, 0)
+ || (unsigned)src_y > FFMAX( v_edge_pos - (motion_y&1) - h , 0)){
+ if(is_mpeg12 || s->codec_id == AV_CODEC_ID_MPEG2VIDEO ||
+ s->codec_id == AV_CODEC_ID_MPEG1VIDEO){
+ av_log(s->avctx,AV_LOG_DEBUG,
+ "MPEG motion vector out of boundary (%d %d)\n", src_x, src_y);
+ return;
+ }
+ s->vdsp.emulated_edge_mc(s->edge_emu_buffer, ptr_y, s->linesize,
+ 17, 17+field_based,
+ src_x, src_y<<field_based,
+ s->h_edge_pos, s->v_edge_pos);
+ ptr_y = s->edge_emu_buffer;
+ if(!CONFIG_GRAY || !(s->flags&CODEC_FLAG_GRAY)){
+ uint8_t *uvbuf= s->edge_emu_buffer+18*s->linesize;
+ s->vdsp.emulated_edge_mc(uvbuf ,
+ ptr_cb, s->uvlinesize,
+ 9, 9+field_based,
+ uvsrc_x, uvsrc_y<<field_based,
+ s->h_edge_pos>>1, s->v_edge_pos>>1);
+ s->vdsp.emulated_edge_mc(uvbuf+16,
+ ptr_cr, s->uvlinesize,
+ 9, 9+field_based,
+ uvsrc_x, uvsrc_y<<field_based,
+ s->h_edge_pos>>1, s->v_edge_pos>>1);
+ ptr_cb= uvbuf;
+ ptr_cr= uvbuf+16;
+ }
+ }
+
+ if(bottom_field){ //FIXME use this for field pix too instead of the obnoxious hack which changes picture.data
+ dest_y += s->linesize;
+ dest_cb+= s->uvlinesize;
+ dest_cr+= s->uvlinesize;
+ }
+
+ if(field_select){
+ ptr_y += s->linesize;
+ ptr_cb+= s->uvlinesize;
+ ptr_cr+= s->uvlinesize;
+ }
+
+ pix_op[0][dxy](dest_y, ptr_y, linesize, h);
+
+ if(!CONFIG_GRAY || !(s->flags&CODEC_FLAG_GRAY)){
+ pix_op[s->chroma_x_shift][uvdxy]
+ (dest_cb, ptr_cb, uvlinesize, h >> s->chroma_y_shift);
+ pix_op[s->chroma_x_shift][uvdxy]
+ (dest_cr, ptr_cr, uvlinesize, h >> s->chroma_y_shift);
+ }
+ if(!is_mpeg12 && (CONFIG_H261_ENCODER || CONFIG_H261_DECODER) &&
+ s->out_format == FMT_H261){
+ ff_h261_loop_filter(s);
+ }
+}
+/* apply one mpeg motion vector to the three components */
+static void mpeg_motion(MpegEncContext *s,
+ uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr,
+ int field_select, uint8_t **ref_picture,
+ op_pixels_func (*pix_op)[4],
+ int motion_x, int motion_y, int h, int mb_y)
+{
+#if !CONFIG_SMALL
+ if(s->out_format == FMT_MPEG1)
+ mpeg_motion_internal(s, dest_y, dest_cb, dest_cr, 0, 0,
+ field_select, ref_picture, pix_op,
+ motion_x, motion_y, h, 1, mb_y);
+ else
+#endif
+ mpeg_motion_internal(s, dest_y, dest_cb, dest_cr, 0, 0,
+ field_select, ref_picture, pix_op,
+ motion_x, motion_y, h, 0, mb_y);
+}
+
+static void mpeg_motion_field(MpegEncContext *s, uint8_t *dest_y,
+ uint8_t *dest_cb, uint8_t *dest_cr,
+ int bottom_field, int field_select,
+ uint8_t **ref_picture,
+ op_pixels_func (*pix_op)[4],
+ int motion_x, int motion_y, int h, int mb_y)
+{
+#if !CONFIG_SMALL
+ if(s->out_format == FMT_MPEG1)
+ mpeg_motion_internal(s, dest_y, dest_cb, dest_cr, 1,
+ bottom_field, field_select, ref_picture, pix_op,
+ motion_x, motion_y, h, 1, mb_y);
+ else
+#endif
+ mpeg_motion_internal(s, dest_y, dest_cb, dest_cr, 1,
+ bottom_field, field_select, ref_picture, pix_op,
+ motion_x, motion_y, h, 0, mb_y);
+}
+
+//FIXME move to dsputil, avg variant, 16x16 version
+static inline void put_obmc(uint8_t *dst, uint8_t *src[5], int stride){
+ int x;
+ uint8_t * const top = src[1];
+ uint8_t * const left = src[2];
+ uint8_t * const mid = src[0];
+ uint8_t * const right = src[3];
+ uint8_t * const bottom= src[4];
+#define OBMC_FILTER(x, t, l, m, r, b)\
+ dst[x]= (t*top[x] + l*left[x] + m*mid[x] + r*right[x] + b*bottom[x] + 4)>>3
+#define OBMC_FILTER4(x, t, l, m, r, b)\
+ OBMC_FILTER(x , t, l, m, r, b);\
+ OBMC_FILTER(x+1 , t, l, m, r, b);\
+ OBMC_FILTER(x +stride, t, l, m, r, b);\
+ OBMC_FILTER(x+1+stride, t, l, m, r, b);
+
+ x=0;
+ OBMC_FILTER (x , 2, 2, 4, 0, 0);
+ OBMC_FILTER (x+1, 2, 1, 5, 0, 0);
+ OBMC_FILTER4(x+2, 2, 1, 5, 0, 0);
+ OBMC_FILTER4(x+4, 2, 0, 5, 1, 0);
+ OBMC_FILTER (x+6, 2, 0, 5, 1, 0);
+ OBMC_FILTER (x+7, 2, 0, 4, 2, 0);
+ x+= stride;
+ OBMC_FILTER (x , 1, 2, 5, 0, 0);
+ OBMC_FILTER (x+1, 1, 2, 5, 0, 0);
+ OBMC_FILTER (x+6, 1, 0, 5, 2, 0);
+ OBMC_FILTER (x+7, 1, 0, 5, 2, 0);
+ x+= stride;
+ OBMC_FILTER4(x , 1, 2, 5, 0, 0);
+ OBMC_FILTER4(x+2, 1, 1, 6, 0, 0);
+ OBMC_FILTER4(x+4, 1, 0, 6, 1, 0);
+ OBMC_FILTER4(x+6, 1, 0, 5, 2, 0);
+ x+= 2*stride;
+ OBMC_FILTER4(x , 0, 2, 5, 0, 1);
+ OBMC_FILTER4(x+2, 0, 1, 6, 0, 1);
+ OBMC_FILTER4(x+4, 0, 0, 6, 1, 1);
+ OBMC_FILTER4(x+6, 0, 0, 5, 2, 1);
+ x+= 2*stride;
+ OBMC_FILTER (x , 0, 2, 5, 0, 1);
+ OBMC_FILTER (x+1, 0, 2, 5, 0, 1);
+ OBMC_FILTER4(x+2, 0, 1, 5, 0, 2);
+ OBMC_FILTER4(x+4, 0, 0, 5, 1, 2);
+ OBMC_FILTER (x+6, 0, 0, 5, 2, 1);
+ OBMC_FILTER (x+7, 0, 0, 5, 2, 1);
+ x+= stride;
+ OBMC_FILTER (x , 0, 2, 4, 0, 2);
+ OBMC_FILTER (x+1, 0, 1, 5, 0, 2);
+ OBMC_FILTER (x+6, 0, 0, 5, 1, 2);
+ OBMC_FILTER (x+7, 0, 0, 4, 2, 2);
+}
+
+/* obmc for 1 8x8 luma block */
+static inline void obmc_motion(MpegEncContext *s,
+ uint8_t *dest, uint8_t *src,
+ int src_x, int src_y,
+ op_pixels_func *pix_op,
+ int16_t mv[5][2]/* mid top left right bottom*/)
+#define MID 0
+{
+ int i;
+ uint8_t *ptr[5];
+
+ assert(s->quarter_sample==0);
+
+ for(i=0; i<5; i++){
+ if(i && mv[i][0]==mv[MID][0] && mv[i][1]==mv[MID][1]){
+ ptr[i]= ptr[MID];
+ }else{
+ ptr[i]= s->obmc_scratchpad + 8*(i&1) + s->linesize*8*(i>>1);
+ hpel_motion(s, ptr[i], src,
+ src_x, src_y,
+ pix_op,
+ mv[i][0], mv[i][1]);
+ }
+ }
+
+ put_obmc(dest, ptr, s->linesize);
+}
+
+static inline void qpel_motion(MpegEncContext *s,
+ uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr,
+ int field_based, int bottom_field, int field_select,
+ uint8_t **ref_picture, op_pixels_func (*pix_op)[4],
+ qpel_mc_func (*qpix_op)[16],
+ int motion_x, int motion_y, int h)
+{
+ uint8_t *ptr_y, *ptr_cb, *ptr_cr;
+ int dxy, uvdxy, mx, my, src_x, src_y, uvsrc_x, uvsrc_y, v_edge_pos, linesize, uvlinesize;
+
+ dxy = ((motion_y & 3) << 2) | (motion_x & 3);
+ src_x = s->mb_x * 16 + (motion_x >> 2);
+ src_y = s->mb_y * (16 >> field_based) + (motion_y >> 2);
+
+ v_edge_pos = s->v_edge_pos >> field_based;
+ linesize = s->linesize << field_based;
+ uvlinesize = s->uvlinesize << field_based;
+
+ if(field_based){
+ mx= motion_x/2;
+ my= motion_y>>1;
+ }else if(s->workaround_bugs&FF_BUG_QPEL_CHROMA2){
+ static const int rtab[8]= {0,0,1,1,0,0,0,1};
+ mx= (motion_x>>1) + rtab[motion_x&7];
+ my= (motion_y>>1) + rtab[motion_y&7];
+ }else if(s->workaround_bugs&FF_BUG_QPEL_CHROMA){
+ mx= (motion_x>>1)|(motion_x&1);
+ my= (motion_y>>1)|(motion_y&1);
+ }else{
+ mx= motion_x/2;
+ my= motion_y/2;
+ }
+ mx= (mx>>1)|(mx&1);
+ my= (my>>1)|(my&1);
+
+ uvdxy= (mx&1) | ((my&1)<<1);
+ mx>>=1;
+ my>>=1;
+
+ uvsrc_x = s->mb_x * 8 + mx;
+ uvsrc_y = s->mb_y * (8 >> field_based) + my;
+
+ ptr_y = ref_picture[0] + src_y * linesize + src_x;
+ ptr_cb = ref_picture[1] + uvsrc_y * uvlinesize + uvsrc_x;
+ ptr_cr = ref_picture[2] + uvsrc_y * uvlinesize + uvsrc_x;
+
+ if( (unsigned)src_x > FFMAX(s->h_edge_pos - (motion_x&3) - 16, 0)
+ || (unsigned)src_y > FFMAX( v_edge_pos - (motion_y&3) - h , 0)){
+ s->vdsp.emulated_edge_mc(s->edge_emu_buffer, ptr_y, s->linesize,
+ 17, 17+field_based, src_x, src_y<<field_based,
+ s->h_edge_pos, s->v_edge_pos);
+ ptr_y= s->edge_emu_buffer;
+ if(!CONFIG_GRAY || !(s->flags&CODEC_FLAG_GRAY)){
+ uint8_t *uvbuf= s->edge_emu_buffer + 18*s->linesize;
+ s->vdsp.emulated_edge_mc(uvbuf, ptr_cb, s->uvlinesize,
+ 9, 9 + field_based,
+ uvsrc_x, uvsrc_y<<field_based,
+ s->h_edge_pos>>1, s->v_edge_pos>>1);
+ s->vdsp.emulated_edge_mc(uvbuf + 16, ptr_cr, s->uvlinesize,
+ 9, 9 + field_based,
+ uvsrc_x, uvsrc_y<<field_based,
+ s->h_edge_pos>>1, s->v_edge_pos>>1);
+ ptr_cb= uvbuf;
+ ptr_cr= uvbuf + 16;
+ }
+ }
+
+ if(!field_based)
+ qpix_op[0][dxy](dest_y, ptr_y, linesize);
+ else{
+ if(bottom_field){
+ dest_y += s->linesize;
+ dest_cb+= s->uvlinesize;
+ dest_cr+= s->uvlinesize;
+ }
+
+ if(field_select){
+ ptr_y += s->linesize;
+ ptr_cb += s->uvlinesize;
+ ptr_cr += s->uvlinesize;
+ }
+ //damn interlaced mode
+ //FIXME boundary mirroring is not exactly correct here
+ qpix_op[1][dxy](dest_y , ptr_y , linesize);
+ qpix_op[1][dxy](dest_y+8, ptr_y+8, linesize);
+ }
+ if(!CONFIG_GRAY || !(s->flags&CODEC_FLAG_GRAY)){
+ pix_op[1][uvdxy](dest_cr, ptr_cr, uvlinesize, h >> 1);
+ pix_op[1][uvdxy](dest_cb, ptr_cb, uvlinesize, h >> 1);
+ }
+}
+
+/**
+ * h263 chroma 4mv motion compensation.
+ */
+static void chroma_4mv_motion(MpegEncContext *s,
+ uint8_t *dest_cb, uint8_t *dest_cr,
+ uint8_t **ref_picture,
+ op_pixels_func *pix_op,
+ int mx, int my)
+{
+ int dxy, emu=0, src_x, src_y, offset;
+ uint8_t *ptr;
+
+ /* In case of 8X8, we construct a single chroma motion vector
+ with a special rounding */
+ mx= ff_h263_round_chroma(mx);
+ my= ff_h263_round_chroma(my);
+
+ dxy = ((my & 1) << 1) | (mx & 1);
+ mx >>= 1;
+ my >>= 1;
+
+ src_x = s->mb_x * 8 + mx;
+ src_y = s->mb_y * 8 + my;
+ src_x = av_clip(src_x, -8, (s->width >> 1));
+ if (src_x == (s->width >> 1))
+ dxy &= ~1;
+ src_y = av_clip(src_y, -8, (s->height >> 1));
+ if (src_y == (s->height >> 1))
+ dxy &= ~2;
+
+ offset = src_y * s->uvlinesize + src_x;
+ ptr = ref_picture[1] + offset;
+ if(s->flags&CODEC_FLAG_EMU_EDGE){
+ if( (unsigned)src_x > FFMAX((s->h_edge_pos>>1) - (dxy &1) - 8, 0)
+ || (unsigned)src_y > FFMAX((s->v_edge_pos>>1) - (dxy>>1) - 8, 0)){
+ s->vdsp.emulated_edge_mc(s->edge_emu_buffer, ptr, s->uvlinesize,
+ 9, 9, src_x, src_y,
+ s->h_edge_pos>>1, s->v_edge_pos>>1);
+ ptr= s->edge_emu_buffer;
+ emu=1;
+ }
+ }
+ pix_op[dxy](dest_cb, ptr, s->uvlinesize, 8);
+
+ ptr = ref_picture[2] + offset;
+ if(emu){
+ s->vdsp.emulated_edge_mc(s->edge_emu_buffer, ptr, s->uvlinesize,
+ 9, 9, src_x, src_y,
+ s->h_edge_pos>>1, s->v_edge_pos>>1);
+ ptr= s->edge_emu_buffer;
+ }
+ pix_op[dxy](dest_cr, ptr, s->uvlinesize, 8);
+}
+
+static inline void prefetch_motion(MpegEncContext *s, uint8_t **pix, int dir){
+ /* fetch pixels for estimated mv 4 macroblocks ahead
+ * optimized for 64byte cache lines */
+ const int shift = s->quarter_sample ? 2 : 1;
+ const int mx= (s->mv[dir][0][0]>>shift) + 16*s->mb_x + 8;
+ const int my= (s->mv[dir][0][1]>>shift) + 16*s->mb_y;
+ int off= mx + (my + (s->mb_x&3)*4)*s->linesize + 64;
+ s->vdsp.prefetch(pix[0]+off, s->linesize, 4);
+ off= (mx>>1) + ((my>>1) + (s->mb_x&7))*s->uvlinesize + 64;
+ s->vdsp.prefetch(pix[1]+off, pix[2]-pix[1], 2);
+}
+
+/**
+ * motion compensation of a single macroblock
+ * @param s context
+ * @param dest_y luma destination pointer
+ * @param dest_cb chroma cb/u destination pointer
+ * @param dest_cr chroma cr/v destination pointer
+ * @param dir direction (0->forward, 1->backward)
+ * @param ref_picture array[3] of pointers to the 3 planes of the reference picture
+ * @param pix_op halfpel motion compensation function (average or put normally)
+ * @param qpix_op qpel motion compensation function (average or put normally)
+ * the motion vectors are taken from s->mv and the MV type from s->mv_type
+ */
+static av_always_inline void MPV_motion_internal(MpegEncContext *s,
+ uint8_t *dest_y, uint8_t *dest_cb,
+ uint8_t *dest_cr, int dir,
+ uint8_t **ref_picture,
+ op_pixels_func (*pix_op)[4],
+ qpel_mc_func (*qpix_op)[16], int is_mpeg12)
+{
+ int dxy, mx, my, src_x, src_y, motion_x, motion_y;
+ int mb_x, mb_y, i;
+ uint8_t *ptr, *dest;
+
+ mb_x = s->mb_x;
+ mb_y = s->mb_y;
+
+ prefetch_motion(s, ref_picture, dir);
+
+ if(!is_mpeg12 && s->obmc && s->pict_type != AV_PICTURE_TYPE_B){
+ LOCAL_ALIGNED_8(int16_t, mv_cache, [4], [4][2]);
+ AVFrame *cur_frame = &s->current_picture.f;
+ const int xy= s->mb_x + s->mb_y*s->mb_stride;
+ const int mot_stride= s->b8_stride;
+ const int mot_xy= mb_x*2 + mb_y*2*mot_stride;
+
+ assert(!s->mb_skipped);
+
+ AV_COPY32(mv_cache[1][1], cur_frame->motion_val[0][mot_xy ]);
+ AV_COPY32(mv_cache[1][2], cur_frame->motion_val[0][mot_xy + 1]);
+
+ AV_COPY32(mv_cache[2][1], cur_frame->motion_val[0][mot_xy + mot_stride ]);
+ AV_COPY32(mv_cache[2][2], cur_frame->motion_val[0][mot_xy + mot_stride + 1]);
+
+ AV_COPY32(mv_cache[3][1], cur_frame->motion_val[0][mot_xy + mot_stride ]);
+ AV_COPY32(mv_cache[3][2], cur_frame->motion_val[0][mot_xy + mot_stride + 1]);
+
+ if (mb_y == 0 || IS_INTRA(cur_frame->mb_type[xy - s->mb_stride])) {
+ AV_COPY32(mv_cache[0][1], mv_cache[1][1]);
+ AV_COPY32(mv_cache[0][2], mv_cache[1][2]);
+ }else{
+ AV_COPY32(mv_cache[0][1], cur_frame->motion_val[0][mot_xy - mot_stride ]);
+ AV_COPY32(mv_cache[0][2], cur_frame->motion_val[0][mot_xy - mot_stride + 1]);
+ }
+
+ if (mb_x == 0 || IS_INTRA(cur_frame->mb_type[xy - 1])) {
+ AV_COPY32(mv_cache[1][0], mv_cache[1][1]);
+ AV_COPY32(mv_cache[2][0], mv_cache[2][1]);
+ }else{
+ AV_COPY32(mv_cache[1][0], cur_frame->motion_val[0][mot_xy - 1]);
+ AV_COPY32(mv_cache[2][0], cur_frame->motion_val[0][mot_xy - 1 + mot_stride]);
+ }
+
+ if (mb_x + 1 >= s->mb_width || IS_INTRA(cur_frame->mb_type[xy + 1])) {
+ AV_COPY32(mv_cache[1][3], mv_cache[1][2]);
+ AV_COPY32(mv_cache[2][3], mv_cache[2][2]);
+ }else{
+ AV_COPY32(mv_cache[1][3], cur_frame->motion_val[0][mot_xy + 2]);
+ AV_COPY32(mv_cache[2][3], cur_frame->motion_val[0][mot_xy + 2 + mot_stride]);
+ }
+
+ mx = 0;
+ my = 0;
+ for(i=0;i<4;i++) {
+ const int x= (i&1)+1;
+ const int y= (i>>1)+1;
+ int16_t mv[5][2]= {
+ {mv_cache[y][x ][0], mv_cache[y][x ][1]},
+ {mv_cache[y-1][x][0], mv_cache[y-1][x][1]},
+ {mv_cache[y][x-1][0], mv_cache[y][x-1][1]},
+ {mv_cache[y][x+1][0], mv_cache[y][x+1][1]},
+ {mv_cache[y+1][x][0], mv_cache[y+1][x][1]}};
+ //FIXME cleanup
+ obmc_motion(s, dest_y + ((i & 1) * 8) + (i >> 1) * 8 * s->linesize,
+ ref_picture[0],
+ mb_x * 16 + (i & 1) * 8, mb_y * 16 + (i >>1) * 8,
+ pix_op[1],
+ mv);
+
+ mx += mv[0][0];
+ my += mv[0][1];
+ }
+ if(!CONFIG_GRAY || !(s->flags&CODEC_FLAG_GRAY))
+ chroma_4mv_motion(s, dest_cb, dest_cr, ref_picture, pix_op[1], mx, my);
+
+ return;
+ }
+
+ switch(s->mv_type) {
+ case MV_TYPE_16X16:
+ if(s->mcsel){
+ if(s->real_sprite_warping_points==1){
+ gmc1_motion(s, dest_y, dest_cb, dest_cr,
+ ref_picture);
+ }else{
+ gmc_motion(s, dest_y, dest_cb, dest_cr,
+ ref_picture);
+ }
+ }else if(!is_mpeg12 && s->quarter_sample){
+ qpel_motion(s, dest_y, dest_cb, dest_cr,
+ 0, 0, 0,
+ ref_picture, pix_op, qpix_op,
+ s->mv[dir][0][0], s->mv[dir][0][1], 16);
+ } else if (!is_mpeg12 && (CONFIG_WMV2_DECODER || CONFIG_WMV2_ENCODER) &&
+ s->mspel && s->codec_id == AV_CODEC_ID_WMV2) {
+ ff_mspel_motion(s, dest_y, dest_cb, dest_cr,
+ ref_picture, pix_op,
+ s->mv[dir][0][0], s->mv[dir][0][1], 16);
+ }else
+ {
+ mpeg_motion(s, dest_y, dest_cb, dest_cr, 0,
+ ref_picture, pix_op,
+ s->mv[dir][0][0], s->mv[dir][0][1], 16, mb_y);
+ }
+ break;
+ case MV_TYPE_8X8:
+ if (!is_mpeg12) {
+ mx = 0;
+ my = 0;
+ if(s->quarter_sample){
+ for(i=0;i<4;i++) {
+ motion_x = s->mv[dir][i][0];
+ motion_y = s->mv[dir][i][1];
+
+ dxy = ((motion_y & 3) << 2) | (motion_x & 3);
+ src_x = mb_x * 16 + (motion_x >> 2) + (i & 1) * 8;
+ src_y = mb_y * 16 + (motion_y >> 2) + (i >>1) * 8;
+
+ /* WARNING: do no forget half pels */
+ src_x = av_clip(src_x, -16, s->width);
+ if (src_x == s->width)
+ dxy &= ~3;
+ src_y = av_clip(src_y, -16, s->height);
+ if (src_y == s->height)
+ dxy &= ~12;
+
+ ptr = ref_picture[0] + (src_y * s->linesize) + (src_x);
+ if(s->flags&CODEC_FLAG_EMU_EDGE){
+ if( (unsigned)src_x > FFMAX(s->h_edge_pos - (motion_x&3) - 8, 0)
+ || (unsigned)src_y > FFMAX(s->v_edge_pos - (motion_y&3) - 8, 0)){
+ s->vdsp.emulated_edge_mc(s->edge_emu_buffer, ptr,
+ s->linesize, 9, 9,
+ src_x, src_y,
+ s->h_edge_pos, s->v_edge_pos);
+ ptr= s->edge_emu_buffer;
+ }
+ }
+ dest = dest_y + ((i & 1) * 8) + (i >> 1) * 8 * s->linesize;
+ qpix_op[1][dxy](dest, ptr, s->linesize);
+
+ mx += s->mv[dir][i][0]/2;
+ my += s->mv[dir][i][1]/2;
+ }
+ }else{
+ for(i=0;i<4;i++) {
+ hpel_motion(s, dest_y + ((i & 1) * 8) + (i >> 1) * 8 * s->linesize,
+ ref_picture[0],
+ mb_x * 16 + (i & 1) * 8, mb_y * 16 + (i >>1) * 8,
+ pix_op[1],
+ s->mv[dir][i][0], s->mv[dir][i][1]);
+
+ mx += s->mv[dir][i][0];
+ my += s->mv[dir][i][1];
+ }
+ }
+
+ if(!CONFIG_GRAY || !(s->flags&CODEC_FLAG_GRAY))
+ chroma_4mv_motion(s, dest_cb, dest_cr, ref_picture, pix_op[1], mx, my);
+ }
+ break;
+ case MV_TYPE_FIELD:
+ if (s->picture_structure == PICT_FRAME) {
+ if(!is_mpeg12 && s->quarter_sample){
+ for(i=0; i<2; i++){
+ qpel_motion(s, dest_y, dest_cb, dest_cr,
+ 1, i, s->field_select[dir][i],
+ ref_picture, pix_op, qpix_op,
+ s->mv[dir][i][0], s->mv[dir][i][1], 8);
+ }
+ }else{
+ /* top field */
+ mpeg_motion_field(s, dest_y, dest_cb, dest_cr,
+ 0, s->field_select[dir][0],
+ ref_picture, pix_op,
+ s->mv[dir][0][0], s->mv[dir][0][1], 8, mb_y);
+ /* bottom field */
+ mpeg_motion_field(s, dest_y, dest_cb, dest_cr,
+ 1, s->field_select[dir][1],
+ ref_picture, pix_op,
+ s->mv[dir][1][0], s->mv[dir][1][1], 8, mb_y);
+ }
+ } else {
+ if(s->picture_structure != s->field_select[dir][0] + 1 && s->pict_type != AV_PICTURE_TYPE_B && !s->first_field){
+ ref_picture = s->current_picture_ptr->f.data;
+ }
+
+ mpeg_motion(s, dest_y, dest_cb, dest_cr,
+ s->field_select[dir][0],
+ ref_picture, pix_op,
+ s->mv[dir][0][0], s->mv[dir][0][1], 16, mb_y>>1);
+ }
+ break;
+ case MV_TYPE_16X8:
+ for(i=0; i<2; i++){
+ uint8_t ** ref2picture;
+
+ if(s->picture_structure == s->field_select[dir][i] + 1
+ || s->pict_type == AV_PICTURE_TYPE_B || s->first_field){
+ ref2picture= ref_picture;
+ }else{
+ ref2picture = s->current_picture_ptr->f.data;
+ }
+
+ mpeg_motion(s, dest_y, dest_cb, dest_cr,
+ s->field_select[dir][i],
+ ref2picture, pix_op,
+ s->mv[dir][i][0], s->mv[dir][i][1] + 16*i, 8, mb_y>>1);
+
+ dest_y += 16*s->linesize;
+ dest_cb+= (16>>s->chroma_y_shift)*s->uvlinesize;
+ dest_cr+= (16>>s->chroma_y_shift)*s->uvlinesize;
+ }
+ break;
+ case MV_TYPE_DMV:
+ if(s->picture_structure == PICT_FRAME){
+ for(i=0; i<2; i++){
+ int j;
+ for(j=0; j<2; j++){
+ mpeg_motion_field(s, dest_y, dest_cb, dest_cr,
+ j, j^i, ref_picture, pix_op,
+ s->mv[dir][2*i + j][0],
+ s->mv[dir][2*i + j][1], 8, mb_y);
+ }
+ pix_op = s->dsp.avg_pixels_tab;
+ }
+ }else{
+ for(i=0; i<2; i++){
+ mpeg_motion(s, dest_y, dest_cb, dest_cr,
+ s->picture_structure != i+1,
+ ref_picture, pix_op,
+ s->mv[dir][2*i][0],s->mv[dir][2*i][1],16, mb_y>>1);
+
+ // after put we make avg of the same block
+ pix_op=s->dsp.avg_pixels_tab;
+
+ //opposite parity is always in the same frame if this is second field
+ if(!s->first_field){
+ ref_picture = s->current_picture_ptr->f.data;
+ }
+ }
+ }
+ break;
+ default: assert(0);
+ }
+}
+
+void ff_MPV_motion(MpegEncContext *s,
+ uint8_t *dest_y, uint8_t *dest_cb,
+ uint8_t *dest_cr, int dir,
+ uint8_t **ref_picture,
+ op_pixels_func (*pix_op)[4],
+ qpel_mc_func (*qpix_op)[16])
+{
+#if !CONFIG_SMALL
+ if(s->out_format == FMT_MPEG1)
+ MPV_motion_internal(s, dest_y, dest_cb, dest_cr, dir,
+ ref_picture, pix_op, qpix_op, 1);
+ else
+#endif
+ MPV_motion_internal(s, dest_y, dest_cb, dest_cr, dir,
+ ref_picture, pix_op, qpix_op, 0);
+}
diff --git a/gst-libs/ext/libav/libavcodec/mpegvideo_parser.c b/gst-libs/ext/libav/libavcodec/mpegvideo_parser.c
index 1798f83..051796e 100644
--- a/gst-libs/ext/libav/libavcodec/mpegvideo_parser.c
+++ b/gst-libs/ext/libav/libavcodec/mpegvideo_parser.c
@@ -23,11 +23,19 @@
#include "parser.h"
#include "mpegvideo.h"
+struct MpvParseContext {
+ ParseContext pc;
+ AVRational frame_rate;
+ int progressive_sequence;
+ int width, height;
+};
+
+
static void mpegvideo_extract_headers(AVCodecParserContext *s,
AVCodecContext *avctx,
const uint8_t *buf, int buf_size)
{
- ParseContext1 *pc = s->priv_data;
+ struct MpvParseContext *pc = s->priv_data;
const uint8_t *buf_end = buf + buf_size;
uint32_t start_code;
int frame_rate_index, ext_type, bytes_left;
@@ -57,11 +65,10 @@ static void mpegvideo_extract_headers(AVCodecParserContext *s,
did_set_size=1;
}
frame_rate_index = buf[3] & 0xf;
- pc->frame_rate.den = avctx->time_base.den = avpriv_frame_rate_tab[frame_rate_index].num;
- pc->frame_rate.num = avctx->time_base.num = avpriv_frame_rate_tab[frame_rate_index].den;
+ pc->frame_rate.den = avctx->time_base.den = ff_mpeg12_frame_rate_tab[frame_rate_index].num;
+ pc->frame_rate.num = avctx->time_base.num = ff_mpeg12_frame_rate_tab[frame_rate_index].den;
avctx->bit_rate = ((buf[4]<<10) | (buf[5]<<2) | (buf[6]>>6))*400;
- avctx->codec_id = CODEC_ID_MPEG1VIDEO;
- avctx->sub_id = 1;
+ avctx->codec_id = AV_CODEC_ID_MPEG1VIDEO;
}
break;
case EXT_START_CODE:
@@ -85,8 +92,7 @@ static void mpegvideo_extract_headers(AVCodecParserContext *s,
avcodec_set_dimensions(avctx, pc->width, pc->height);
avctx->time_base.den = pc->frame_rate.den * (frame_rate_ext_n + 1) * 2;
avctx->time_base.num = pc->frame_rate.num * (frame_rate_ext_d + 1);
- avctx->codec_id = CODEC_ID_MPEG2VIDEO;
- avctx->sub_id = 2; /* forces MPEG2 */
+ avctx->codec_id = AV_CODEC_ID_MPEG2VIDEO;
}
break;
case 0x8: /* picture coding extension */
@@ -131,7 +137,7 @@ static int mpegvideo_parse(AVCodecParserContext *s,
const uint8_t **poutbuf, int *poutbuf_size,
const uint8_t *buf, int buf_size)
{
- ParseContext1 *pc1 = s->priv_data;
+ struct MpvParseContext *pc1 = s->priv_data;
ParseContext *pc= &pc1->pc;
int next;
@@ -174,9 +180,9 @@ static int mpegvideo_split(AVCodecContext *avctx,
}
AVCodecParser ff_mpegvideo_parser = {
- .codec_ids = { CODEC_ID_MPEG1VIDEO, CODEC_ID_MPEG2VIDEO },
- .priv_data_size = sizeof(ParseContext1),
+ .codec_ids = { AV_CODEC_ID_MPEG1VIDEO, AV_CODEC_ID_MPEG2VIDEO },
+ .priv_data_size = sizeof(struct MpvParseContext),
.parser_parse = mpegvideo_parse,
- .parser_close = ff_parse1_close,
+ .parser_close = ff_parse_close,
.split = mpegvideo_split,
};
diff --git a/gst-libs/ext/libav/libavcodec/msmpeg4.c b/gst-libs/ext/libav/libavcodec/msmpeg4.c
index a58d135..5e562d8 100644
--- a/gst-libs/ext/libav/libavcodec/msmpeg4.c
+++ b/gst-libs/ext/libav/libavcodec/msmpeg4.c
@@ -31,9 +31,11 @@
#include "dsputil.h"
#include "mpegvideo.h"
#include "msmpeg4.h"
-#include "libavutil/x86_cpu.h"
+#include "libavutil/x86/asm.h"
#include "h263.h"
#include "mpeg4video.h"
+#include "msmpeg4data.h"
+#include "vc1data.h"
/*
* You can also call this codec : MPEG4 with a twist !
@@ -51,25 +53,8 @@
#define V2_MV_VLC_BITS 9
#define TEX_VLC_BITS 9
-#define II_BITRATE 128*1024
-#define MBAC_BITRATE 50*1024
-
#define DEFAULT_INTER_INDEX 3
-static uint32_t v2_dc_lum_table[512][2];
-static uint32_t v2_dc_chroma_table[512][2];
-
-/* vc1 externs */
-extern const uint8_t wmv3_dc_scale_table[32];
-
-#include "msmpeg4data.h"
-
-#if CONFIG_ENCODERS //strangely gcc includes this even if it is not referenced
-static uint8_t rl_length[NB_RL_TABLES][MAX_LEVEL+1][MAX_RUN+1][2];
-#endif //CONFIG_ENCODERS
-
-static uint8_t static_rl_table_store[NB_RL_TABLES][2][2*MAX_RUN + MAX_LEVEL + 3];
-
/* This table is practically identical to the one from h263
* except that it is inverted. */
static av_cold void init_h263_dc_for_msmpeg4(void)
@@ -104,8 +89,8 @@ static av_cold void init_h263_dc_for_msmpeg4(void)
uni_len++;
}
}
- v2_dc_lum_table[level+256][0]= uni_code;
- v2_dc_lum_table[level+256][1]= uni_len;
+ ff_v2_dc_lum_table[level + 256][0] = uni_code;
+ ff_v2_dc_lum_table[level + 256][1] = uni_len;
/* chrominance h263 */
uni_code= ff_mpeg4_DCtab_chrom[size][0];
@@ -120,13 +105,13 @@ static av_cold void init_h263_dc_for_msmpeg4(void)
uni_len++;
}
}
- v2_dc_chroma_table[level+256][0]= uni_code;
- v2_dc_chroma_table[level+256][1]= uni_len;
+ ff_v2_dc_chroma_table[level + 256][0] = uni_code;
+ ff_v2_dc_chroma_table[level + 256][1] = uni_len;
}
}
-static av_cold void common_init(MpegEncContext * s)
+av_cold void ff_msmpeg4_common_init(MpegEncContext *s)
{
static int initialized=0;
@@ -138,8 +123,8 @@ static av_cold void common_init(MpegEncContext * s)
break;
case 3:
if(s->workaround_bugs){
- s->y_dc_scale_table= old_ff_y_dc_scale_table;
- s->c_dc_scale_table= wmv1_c_dc_scale_table;
+ s->y_dc_scale_table= ff_old_ff_y_dc_scale_table;
+ s->c_dc_scale_table= ff_wmv1_c_dc_scale_table;
} else{
s->y_dc_scale_table= ff_mpeg4_y_dc_scale_table;
s->c_dc_scale_table= ff_mpeg4_c_dc_scale_table;
@@ -147,13 +132,13 @@ static av_cold void common_init(MpegEncContext * s)
break;
case 4:
case 5:
- s->y_dc_scale_table= wmv1_y_dc_scale_table;
- s->c_dc_scale_table= wmv1_c_dc_scale_table;
+ s->y_dc_scale_table= ff_wmv1_y_dc_scale_table;
+ s->c_dc_scale_table= ff_wmv1_c_dc_scale_table;
break;
#if CONFIG_VC1_DECODER
case 6:
- s->y_dc_scale_table= wmv3_dc_scale_table;
- s->c_dc_scale_table= wmv3_dc_scale_table;
+ s->y_dc_scale_table= ff_wmv3_dc_scale_table;
+ s->c_dc_scale_table= ff_wmv3_dc_scale_table;
break;
#endif
@@ -161,10 +146,10 @@ static av_cold void common_init(MpegEncContext * s)
if(s->msmpeg4_version>=4){
- ff_init_scantable(s->dsp.idct_permutation, &s->intra_scantable , wmv1_scantable[1]);
- ff_init_scantable(s->dsp.idct_permutation, &s->intra_h_scantable, wmv1_scantable[2]);
- ff_init_scantable(s->dsp.idct_permutation, &s->intra_v_scantable, wmv1_scantable[3]);
- ff_init_scantable(s->dsp.idct_permutation, &s->inter_scantable , wmv1_scantable[0]);
+ ff_init_scantable(s->dsp.idct_permutation, &s->intra_scantable , ff_wmv1_scantable[1]);
+ ff_init_scantable(s->dsp.idct_permutation, &s->intra_h_scantable, ff_wmv1_scantable[2]);
+ ff_init_scantable(s->dsp.idct_permutation, &s->intra_v_scantable, ff_wmv1_scantable[3]);
+ ff_init_scantable(s->dsp.idct_permutation, &s->inter_scantable , ff_wmv1_scantable[0]);
}
//Note the default tables are set in common_init in mpegvideo.c
@@ -175,251 +160,6 @@ static av_cold void common_init(MpegEncContext * s)
}
}
-#if CONFIG_ENCODERS
-
-/* build the table which associate a (x,y) motion vector to a vlc */
-static void init_mv_table(MVTable *tab)
-{
- int i, x, y;
-
- tab->table_mv_index = av_malloc(sizeof(uint16_t) * 4096);
- /* mark all entries as not used */
- for(i=0;i<4096;i++)
- tab->table_mv_index[i] = tab->n;
-
- for(i=0;i<tab->n;i++) {
- x = tab->table_mvx[i];
- y = tab->table_mvy[i];
- tab->table_mv_index[(x << 6) | y] = i;
- }
-}
-
-void ff_msmpeg4_code012(PutBitContext *pb, int n)
-{
- if (n == 0) {
- put_bits(pb, 1, 0);
- } else {
- put_bits(pb, 1, 1);
- put_bits(pb, 1, (n >= 2));
- }
-}
-
-static int get_size_of_code(MpegEncContext * s, RLTable *rl, int last, int run, int level, int intra){
- int size=0;
- int code;
- int run_diff= intra ? 0 : 1;
-
- code = get_rl_index(rl, last, run, level);
- size+= rl->table_vlc[code][1];
- if (code == rl->n) {
- int level1, run1;
-
- level1 = level - rl->max_level[last][run];
- if (level1 < 1)
- goto esc2;
- code = get_rl_index(rl, last, run, level1);
- if (code == rl->n) {
- esc2:
- size++;
- if (level > MAX_LEVEL)
- goto esc3;
- run1 = run - rl->max_run[last][level] - run_diff;
- if (run1 < 0)
- goto esc3;
- code = get_rl_index(rl, last, run1, level);
- if (code == rl->n) {
- esc3:
- /* third escape */
- size+=1+1+6+8;
- } else {
- /* second escape */
- size+= 1+1+ rl->table_vlc[code][1];
- }
- } else {
- /* first escape */
- size+= 1+1+ rl->table_vlc[code][1];
- }
- } else {
- size++;
- }
- return size;
-}
-
-av_cold void ff_msmpeg4_encode_init(MpegEncContext *s)
-{
- static int init_done=0;
- int i;
-
- common_init(s);
- if(s->msmpeg4_version>=4){
- s->min_qcoeff= -255;
- s->max_qcoeff= 255;
- }
-
- if (!init_done) {
- /* init various encoding tables */
- init_done = 1;
- init_mv_table(&mv_tables[0]);
- init_mv_table(&mv_tables[1]);
- for(i=0;i<NB_RL_TABLES;i++)
- ff_init_rl(&rl_table[i], static_rl_table_store[i]);
-
- for(i=0; i<NB_RL_TABLES; i++){
- int level;
- for (level = 1; level <= MAX_LEVEL; level++) {
- int run;
- for(run=0; run<=MAX_RUN; run++){
- int last;
- for(last=0; last<2; last++){
- rl_length[i][level][run][last]= get_size_of_code(s, &rl_table[ i], last, run, level, 0);
- }
- }
- }
- }
- }
-}
-
-static void find_best_tables(MpegEncContext * s)
-{
- int i;
- int best =-1, best_size =9999999;
- int chroma_best=-1, best_chroma_size=9999999;
-
- for(i=0; i<3; i++){
- int level;
- int chroma_size=0;
- int size=0;
-
- if(i>0){// ;)
- size++;
- chroma_size++;
- }
- for(level=0; level<=MAX_LEVEL; level++){
- int run;
- for(run=0; run<=MAX_RUN; run++){
- int last;
- const int last_size= size + chroma_size;
- for(last=0; last<2; last++){
- int inter_count = s->ac_stats[0][0][level][run][last] + s->ac_stats[0][1][level][run][last];
- int intra_luma_count = s->ac_stats[1][0][level][run][last];
- int intra_chroma_count= s->ac_stats[1][1][level][run][last];
-
- if(s->pict_type==AV_PICTURE_TYPE_I){
- size += intra_luma_count *rl_length[i ][level][run][last];
- chroma_size+= intra_chroma_count*rl_length[i+3][level][run][last];
- }else{
- size+= intra_luma_count *rl_length[i ][level][run][last]
- +intra_chroma_count*rl_length[i+3][level][run][last]
- +inter_count *rl_length[i+3][level][run][last];
- }
- }
- if(last_size == size+chroma_size) break;
- }
- }
- if(size<best_size){
- best_size= size;
- best= i;
- }
- if(chroma_size<best_chroma_size){
- best_chroma_size= chroma_size;
- chroma_best= i;
- }
- }
-
-// printf("type:%d, best:%d, qp:%d, var:%d, mcvar:%d, size:%d //\n",
-// s->pict_type, best, s->qscale, s->mb_var_sum, s->mc_mb_var_sum, best_size);
-
- if(s->pict_type==AV_PICTURE_TYPE_P) chroma_best= best;
-
- memset(s->ac_stats, 0, sizeof(int)*(MAX_LEVEL+1)*(MAX_RUN+1)*2*2*2);
-
- s->rl_table_index = best;
- s->rl_chroma_table_index= chroma_best;
-
- if(s->pict_type != s->last_non_b_pict_type){
- s->rl_table_index= 2;
- if(s->pict_type==AV_PICTURE_TYPE_I)
- s->rl_chroma_table_index= 1;
- else
- s->rl_chroma_table_index= 2;
- }
-
-}
-
-/* write MSMPEG4 compatible frame header */
-void msmpeg4_encode_picture_header(MpegEncContext * s, int picture_number)
-{
- find_best_tables(s);
-
- avpriv_align_put_bits(&s->pb);
- put_bits(&s->pb, 2, s->pict_type - 1);
-
- put_bits(&s->pb, 5, s->qscale);
- if(s->msmpeg4_version<=2){
- s->rl_table_index = 2;
- s->rl_chroma_table_index = 2;
- }
-
- s->dc_table_index = 1;
- s->mv_table_index = 1; /* only if P frame */
- s->use_skip_mb_code = 1; /* only if P frame */
- s->per_mb_rl_table = 0;
- if(s->msmpeg4_version==4)
- s->inter_intra_pred= (s->width*s->height < 320*240 && s->bit_rate<=II_BITRATE && s->pict_type==AV_PICTURE_TYPE_P);
-//printf("%d %d %d %d %d\n", s->pict_type, s->bit_rate, s->inter_intra_pred, s->width, s->height);
-
- if (s->pict_type == AV_PICTURE_TYPE_I) {
- s->slice_height= s->mb_height/1;
- put_bits(&s->pb, 5, 0x16 + s->mb_height/s->slice_height);
-
- if(s->msmpeg4_version==4){
- msmpeg4_encode_ext_header(s);
- if(s->bit_rate>MBAC_BITRATE)
- put_bits(&s->pb, 1, s->per_mb_rl_table);
- }
-
- if(s->msmpeg4_version>2){
- if(!s->per_mb_rl_table){
- ff_msmpeg4_code012(&s->pb, s->rl_chroma_table_index);
- ff_msmpeg4_code012(&s->pb, s->rl_table_index);
- }
-
- put_bits(&s->pb, 1, s->dc_table_index);
- }
- } else {
- put_bits(&s->pb, 1, s->use_skip_mb_code);
-
- if(s->msmpeg4_version==4 && s->bit_rate>MBAC_BITRATE)
- put_bits(&s->pb, 1, s->per_mb_rl_table);
-
- if(s->msmpeg4_version>2){
- if(!s->per_mb_rl_table)
- ff_msmpeg4_code012(&s->pb, s->rl_table_index);
-
- put_bits(&s->pb, 1, s->dc_table_index);
-
- put_bits(&s->pb, 1, s->mv_table_index);
- }
- }
-
- s->esc3_level_length= 0;
- s->esc3_run_length= 0;
-}
-
-void msmpeg4_encode_ext_header(MpegEncContext * s)
-{
- put_bits(&s->pb, 5, s->avctx->time_base.den / s->avctx->time_base.num); //yes 29.97 -> 29
-
- put_bits(&s->pb, 11, FFMIN(s->bit_rate/1024, 2047));
-
- if(s->msmpeg4_version>=3)
- put_bits(&s->pb, 1, s->flipflop_rounding);
- else
- assert(s->flipflop_rounding==0);
-}
-
-#endif //CONFIG_ENCODERS
-
/* predict coded block */
int ff_msmpeg4_coded_block_pred(MpegEncContext * s, int n, uint8_t **coded_block_ptr)
{
@@ -447,217 +187,6 @@ int ff_msmpeg4_coded_block_pred(MpegEncContext * s, int n, uint8_t **coded_block
return pred;
}
-#if CONFIG_ENCODERS
-
-void ff_msmpeg4_encode_motion(MpegEncContext * s,
- int mx, int my)
-{
- int code;
- MVTable *mv;
-
- /* modulo encoding */
- /* WARNING : you cannot reach all the MVs even with the modulo
- encoding. This is a somewhat strange compromise they took !!! */
- if (mx <= -64)
- mx += 64;
- else if (mx >= 64)
- mx -= 64;
- if (my <= -64)
- my += 64;
- else if (my >= 64)
- my -= 64;
-
- mx += 32;
- my += 32;
-#if 0
- if ((unsigned)mx >= 64 ||
- (unsigned)my >= 64)
- av_log(s->avctx, AV_LOG_ERROR, "error mx=%d my=%d\n", mx, my);
-#endif
- mv = &mv_tables[s->mv_table_index];
-
- code = mv->table_mv_index[(mx << 6) | my];
- put_bits(&s->pb,
- mv->table_mv_bits[code],
- mv->table_mv_code[code]);
- if (code == mv->n) {
- /* escape : code literally */
- put_bits(&s->pb, 6, mx);
- put_bits(&s->pb, 6, my);
- }
-}
-
-void ff_msmpeg4_handle_slices(MpegEncContext *s){
- if (s->mb_x == 0) {
- if (s->slice_height && (s->mb_y % s->slice_height) == 0) {
- if(s->msmpeg4_version < 4){
- ff_mpeg4_clean_buffers(s);
- }
- s->first_slice_line = 1;
- } else {
- s->first_slice_line = 0;
- }
- }
-}
-
-static void msmpeg4v2_encode_motion(MpegEncContext * s, int val)
-{
- int range, bit_size, sign, code, bits;
-
- if (val == 0) {
- /* zero vector */
- code = 0;
- put_bits(&s->pb, ff_mvtab[code][1], ff_mvtab[code][0]);
- } else {
- bit_size = s->f_code - 1;
- range = 1 << bit_size;
- if (val <= -64)
- val += 64;
- else if (val >= 64)
- val -= 64;
-
- if (val >= 0) {
- sign = 0;
- } else {
- val = -val;
- sign = 1;
- }
- val--;
- code = (val >> bit_size) + 1;
- bits = val & (range - 1);
-
- put_bits(&s->pb, ff_mvtab[code][1] + 1, (ff_mvtab[code][0] << 1) | sign);
- if (bit_size > 0) {
- put_bits(&s->pb, bit_size, bits);
- }
- }
-}
-
-void msmpeg4_encode_mb(MpegEncContext * s,
- DCTELEM block[6][64],
- int motion_x, int motion_y)
-{
- int cbp, coded_cbp, i;
- int pred_x, pred_y;
- uint8_t *coded_block;
-
- ff_msmpeg4_handle_slices(s);
-
- if (!s->mb_intra) {
- /* compute cbp */
- cbp = 0;
- for (i = 0; i < 6; i++) {
- if (s->block_last_index[i] >= 0)
- cbp |= 1 << (5 - i);
- }
- if (s->use_skip_mb_code && (cbp | motion_x | motion_y) == 0) {
- /* skip macroblock */
- put_bits(&s->pb, 1, 1);
- s->last_bits++;
- s->misc_bits++;
- s->skip_count++;
-
- return;
- }
- if (s->use_skip_mb_code)
- put_bits(&s->pb, 1, 0); /* mb coded */
-
- if(s->msmpeg4_version<=2){
- put_bits(&s->pb,
- v2_mb_type[cbp&3][1],
- v2_mb_type[cbp&3][0]);
- if((cbp&3) != 3) coded_cbp= cbp ^ 0x3C;
- else coded_cbp= cbp;
-
- put_bits(&s->pb,
- ff_h263_cbpy_tab[coded_cbp>>2][1],
- ff_h263_cbpy_tab[coded_cbp>>2][0]);
-
- s->misc_bits += get_bits_diff(s);
-
- ff_h263_pred_motion(s, 0, 0, &pred_x, &pred_y);
- msmpeg4v2_encode_motion(s, motion_x - pred_x);
- msmpeg4v2_encode_motion(s, motion_y - pred_y);
- }else{
- put_bits(&s->pb,
- table_mb_non_intra[cbp + 64][1],
- table_mb_non_intra[cbp + 64][0]);
-
- s->misc_bits += get_bits_diff(s);
-
- /* motion vector */
- ff_h263_pred_motion(s, 0, 0, &pred_x, &pred_y);
- ff_msmpeg4_encode_motion(s, motion_x - pred_x,
- motion_y - pred_y);
- }
-
- s->mv_bits += get_bits_diff(s);
-
- for (i = 0; i < 6; i++) {
- ff_msmpeg4_encode_block(s, block[i], i);
- }
- s->p_tex_bits += get_bits_diff(s);
- } else {
- /* compute cbp */
- cbp = 0;
- coded_cbp = 0;
- for (i = 0; i < 6; i++) {
- int val, pred;
- val = (s->block_last_index[i] >= 1);
- cbp |= val << (5 - i);
- if (i < 4) {
- /* predict value for close blocks only for luma */
- pred = ff_msmpeg4_coded_block_pred(s, i, &coded_block);
- *coded_block = val;
- val = val ^ pred;
- }
- coded_cbp |= val << (5 - i);
- }
-
- if(s->msmpeg4_version<=2){
- if (s->pict_type == AV_PICTURE_TYPE_I) {
- put_bits(&s->pb,
- v2_intra_cbpc[cbp&3][1], v2_intra_cbpc[cbp&3][0]);
- } else {
- if (s->use_skip_mb_code)
- put_bits(&s->pb, 1, 0); /* mb coded */
- put_bits(&s->pb,
- v2_mb_type[(cbp&3) + 4][1],
- v2_mb_type[(cbp&3) + 4][0]);
- }
- put_bits(&s->pb, 1, 0); /* no AC prediction yet */
- put_bits(&s->pb,
- ff_h263_cbpy_tab[cbp>>2][1],
- ff_h263_cbpy_tab[cbp>>2][0]);
- }else{
- if (s->pict_type == AV_PICTURE_TYPE_I) {
- put_bits(&s->pb,
- ff_msmp4_mb_i_table[coded_cbp][1], ff_msmp4_mb_i_table[coded_cbp][0]);
- } else {
- if (s->use_skip_mb_code)
- put_bits(&s->pb, 1, 0); /* mb coded */
- put_bits(&s->pb,
- table_mb_non_intra[cbp][1],
- table_mb_non_intra[cbp][0]);
- }
- put_bits(&s->pb, 1, 0); /* no AC prediction yet */
- if(s->inter_intra_pred){
- s->h263_aic_dir=0;
- put_bits(&s->pb, table_inter_intra[s->h263_aic_dir][1], table_inter_intra[s->h263_aic_dir][0]);
- }
- }
- s->misc_bits += get_bits_diff(s);
-
- for (i = 0; i < 6; i++) {
- ff_msmpeg4_encode_block(s, block[i], i);
- }
- s->i_tex_bits += get_bits_diff(s);
- s->i_count++;
- }
-}
-
-#endif //CONFIG_ENCODERS
-
static inline int msmpeg4v1_pred_dc(MpegEncContext * s, int n,
int32_t **dc_val_ptr)
{
@@ -687,8 +216,8 @@ static int get_dc(uint8_t *src, int stride, int scale)
}
/* dir = 0: left, dir = 1: top prediction */
-static inline int msmpeg4_pred_dc(MpegEncContext * s, int n,
- int16_t **dc_val_ptr, int *dir_ptr)
+int ff_msmpeg4_pred_dc(MpegEncContext *s, int n,
+ int16_t **dc_val_ptr, int *dir_ptr)
{
int a, b, c, wrap, pred, scale;
int16_t *dc_val;
@@ -834,207 +363,6 @@ static inline int msmpeg4_pred_dc(MpegEncContext * s, int n,
return pred;
}
-#define DC_MAX 119
-
-static void msmpeg4_encode_dc(MpegEncContext * s, int level, int n, int *dir_ptr)
-{
- int sign, code;
- int pred, extquant;
- int extrabits = 0;
-
- int16_t *dc_val;
- pred = msmpeg4_pred_dc(s, n, &dc_val, dir_ptr);
-
- /* update predictor */
- if (n < 4) {
- *dc_val = level * s->y_dc_scale;
- } else {
- *dc_val = level * s->c_dc_scale;
- }
-
- /* do the prediction */
- level -= pred;
-
- if(s->msmpeg4_version<=2){
- if (n < 4) {
- put_bits(&s->pb,
- v2_dc_lum_table[level+256][1],
- v2_dc_lum_table[level+256][0]);
- }else{
- put_bits(&s->pb,
- v2_dc_chroma_table[level+256][1],
- v2_dc_chroma_table[level+256][0]);
- }
- }else{
- sign = 0;
- if (level < 0) {
- level = -level;
- sign = 1;
- }
- code = level;
- if (code > DC_MAX)
- code = DC_MAX;
- else if( s->msmpeg4_version>=6 ) {
- if( s->qscale == 1 ) {
- extquant = (level + 3) & 0x3;
- code = ((level+3)>>2);
- } else if( s->qscale == 2 ) {
- extquant = (level + 1) & 0x1;
- code = ((level+1)>>1);
- }
- }
-
- if (s->dc_table_index == 0) {
- if (n < 4) {
- put_bits(&s->pb, ff_table0_dc_lum[code][1], ff_table0_dc_lum[code][0]);
- } else {
- put_bits(&s->pb, ff_table0_dc_chroma[code][1], ff_table0_dc_chroma[code][0]);
- }
- } else {
- if (n < 4) {
- put_bits(&s->pb, ff_table1_dc_lum[code][1], ff_table1_dc_lum[code][0]);
- } else {
- put_bits(&s->pb, ff_table1_dc_chroma[code][1], ff_table1_dc_chroma[code][0]);
- }
- }
-
- if(s->msmpeg4_version>=6 && s->qscale<=2)
- extrabits = 3 - s->qscale;
-
- if (code == DC_MAX)
- put_bits(&s->pb, 8 + extrabits, level);
- else if(extrabits > 0)//== VC1 && s->qscale<=2
- put_bits(&s->pb, extrabits, extquant);
-
- if (level != 0) {
- put_bits(&s->pb, 1, sign);
- }
- }
-}
-
-/* Encoding of a block. Very similar to MPEG4 except for a different
- escape coding (same as H263) and more vlc tables.
- */
-void ff_msmpeg4_encode_block(MpegEncContext * s, DCTELEM * block, int n)
-{
- int level, run, last, i, j, last_index;
- int last_non_zero, sign, slevel;
- int code, run_diff, dc_pred_dir;
- const RLTable *rl;
- const uint8_t *scantable;
-
- if (s->mb_intra) {
- msmpeg4_encode_dc(s, block[0], n, &dc_pred_dir);
- i = 1;
- if (n < 4) {
- rl = &rl_table[s->rl_table_index];
- } else {
- rl = &rl_table[3 + s->rl_chroma_table_index];
- }
- run_diff = s->msmpeg4_version>=4;
- scantable= s->intra_scantable.permutated;
- } else {
- i = 0;
- rl = &rl_table[3 + s->rl_table_index];
- if(s->msmpeg4_version<=2)
- run_diff = 0;
- else
- run_diff = 1;
- scantable= s->inter_scantable.permutated;
- }
-
- /* recalculate block_last_index for M$ wmv1 */
- if(s->msmpeg4_version>=4 && s->msmpeg4_version<6 && s->block_last_index[n]>0){
- for(last_index=63; last_index>=0; last_index--){
- if(block[scantable[last_index]]) break;
- }
- s->block_last_index[n]= last_index;
- }else
- last_index = s->block_last_index[n];
- /* AC coefs */
- last_non_zero = i - 1;
- for (; i <= last_index; i++) {
- j = scantable[i];
- level = block[j];
- if (level) {
- run = i - last_non_zero - 1;
- last = (i == last_index);
- sign = 0;
- slevel = level;
- if (level < 0) {
- sign = 1;
- level = -level;
- }
-
- if(level<=MAX_LEVEL && run<=MAX_RUN){
- s->ac_stats[s->mb_intra][n>3][level][run][last]++;
- }
-
- s->ac_stats[s->mb_intra][n > 3][40][63][0]++; //esc3 like
-
- code = get_rl_index(rl, last, run, level);
- put_bits(&s->pb, rl->table_vlc[code][1], rl->table_vlc[code][0]);
- if (code == rl->n) {
- int level1, run1;
-
- level1 = level - rl->max_level[last][run];
- if (level1 < 1)
- goto esc2;
- code = get_rl_index(rl, last, run, level1);
- if (code == rl->n) {
- esc2:
- put_bits(&s->pb, 1, 0);
- if (level > MAX_LEVEL)
- goto esc3;
- run1 = run - rl->max_run[last][level] - run_diff;
- if (run1 < 0)
- goto esc3;
- code = get_rl_index(rl, last, run1+1, level);
- if (s->msmpeg4_version == 4 && code == rl->n)
- goto esc3;
- code = get_rl_index(rl, last, run1, level);
- if (code == rl->n) {
- esc3:
- /* third escape */
- put_bits(&s->pb, 1, 0);
- put_bits(&s->pb, 1, last);
- if(s->msmpeg4_version>=4){
- if(s->esc3_level_length==0){
- s->esc3_level_length=8;
- s->esc3_run_length= 6;
- //ESCLVLSZ + ESCRUNSZ
- if(s->qscale<8)
- put_bits(&s->pb, 6 + (s->msmpeg4_version>=6), 3);
- else
- put_bits(&s->pb, 8, 3);
- }
- put_bits(&s->pb, s->esc3_run_length, run);
- put_bits(&s->pb, 1, sign);
- put_bits(&s->pb, s->esc3_level_length, level);
- }else{
- put_bits(&s->pb, 6, run);
- put_sbits(&s->pb, 8, slevel);
- }
- } else {
- /* second escape */
- put_bits(&s->pb, 1, 1);
- put_bits(&s->pb, rl->table_vlc[code][1], rl->table_vlc[code][0]);
- put_bits(&s->pb, 1, sign);
- }
- } else {
- /* first escape */
- put_bits(&s->pb, 1, 1);
- put_bits(&s->pb, rl->table_vlc[code][1], rl->table_vlc[code][0]);
- put_bits(&s->pb, 1, sign);
- }
- } else {
- put_bits(&s->pb, 1, sign);
- }
- last_non_zero = i;
- }
- }
-}
-
/****************************************/
/* decoding stuff */
@@ -1052,7 +380,7 @@ static int msmpeg4v2_decode_motion(MpegEncContext * s, int pred, int f_code)
int code, val, sign, shift;
code = get_vlc2(&s->gb, v2_mv_vlc.table, V2_MV_VLC_BITS, 2);
-// printf("MV code %d at %d %d pred: %d\n", code, s->mb_x,s->mb_y, pred);
+ av_dlog(s, "MV code %d at %d %d pred: %d\n", code, s->mb_x,s->mb_y, pred);
if (code < 0)
return 0xffff;
@@ -1215,7 +543,6 @@ static int msmpeg4v34_decode_mb(MpegEncContext *s, DCTELEM block[6][64])
if (!s->mb_intra) {
int mx, my;
-//printf("P at %d %d\n", s->mb_x, s->mb_y);
if(s->per_mb_rl_table && cbp){
s->rl_table_index = decode012(&s->gb);
s->rl_chroma_table_index = s->rl_table_index;
@@ -1229,12 +556,15 @@ static int msmpeg4v34_decode_mb(MpegEncContext *s, DCTELEM block[6][64])
s->mv[0][0][1] = my;
*mb_type_ptr = MB_TYPE_L0 | MB_TYPE_16x16;
} else {
-//printf("I at %d %d %d %06X\n", s->mb_x, s->mb_y, ((cbp&3)? 1 : 0) +((cbp&0x3C)? 2 : 0), show_bits(&s->gb, 24));
+ av_dlog(s, "I at %d %d %d %06X\n", s->mb_x, s->mb_y,
+ ((cbp & 3) ? 1 : 0) +((cbp & 0x3C)? 2 : 0),
+ show_bits(&s->gb, 24));
s->ac_pred = get_bits1(&s->gb);
*mb_type_ptr = MB_TYPE_INTRA;
if(s->inter_intra_pred){
s->h263_aic_dir= get_vlc2(&s->gb, ff_inter_intra_vlc.table, INTER_INTRA_VLC_BITS, 1);
-// printf("%d%d %d %d/", s->ac_pred, s->h263_aic_dir, s->mb_x, s->mb_y);
+ av_dlog(s, "%d%d %d %d/",
+ s->ac_pred, s->h263_aic_dir, s->mb_x, s->mb_y);
}
if(s->per_mb_rl_table && cbp){
s->rl_table_index = decode012(&s->gb);
@@ -1265,26 +595,26 @@ av_cold int ff_msmpeg4_decode_init(AVCodecContext *avctx)
if (ff_h263_decode_init(avctx) < 0)
return -1;
- common_init(s);
+ ff_msmpeg4_common_init(s);
if (!done) {
done = 1;
for(i=0;i<NB_RL_TABLES;i++) {
- ff_init_rl(&rl_table[i], static_rl_table_store[i]);
+ ff_init_rl(&ff_rl_table[i], ff_static_rl_table_store[i]);
}
- INIT_VLC_RL(rl_table[0], 642);
- INIT_VLC_RL(rl_table[1], 1104);
- INIT_VLC_RL(rl_table[2], 554);
- INIT_VLC_RL(rl_table[3], 940);
- INIT_VLC_RL(rl_table[4], 962);
- INIT_VLC_RL(rl_table[5], 554);
-
- mv = &mv_tables[0];
+ INIT_VLC_RL(ff_rl_table[0], 642);
+ INIT_VLC_RL(ff_rl_table[1], 1104);
+ INIT_VLC_RL(ff_rl_table[2], 554);
+ INIT_VLC_RL(ff_rl_table[3], 940);
+ INIT_VLC_RL(ff_rl_table[4], 962);
+ INIT_VLC_RL(ff_rl_table[5], 554);
+
+ mv = &ff_mv_tables[0];
INIT_VLC_STATIC(&mv->vlc, MV_VLC_BITS, mv->n + 1,
mv->table_mv_bits, 1, 1,
mv->table_mv_code, 2, 2, 3714);
- mv = &mv_tables[1];
+ mv = &ff_mv_tables[1];
INIT_VLC_STATIC(&mv->vlc, MV_VLC_BITS, mv->n + 1,
mv->table_mv_bits, 1, 1,
mv->table_mv_code, 2, 2, 2694);
@@ -1303,42 +633,42 @@ av_cold int ff_msmpeg4_decode_init(AVCodecContext *avctx)
&ff_table1_dc_chroma[0][0], 8, 4, 1216);
INIT_VLC_STATIC(&v2_dc_lum_vlc, DC_VLC_BITS, 512,
- &v2_dc_lum_table[0][1], 8, 4,
- &v2_dc_lum_table[0][0], 8, 4, 1472);
+ &ff_v2_dc_lum_table[0][1], 8, 4,
+ &ff_v2_dc_lum_table[0][0], 8, 4, 1472);
INIT_VLC_STATIC(&v2_dc_chroma_vlc, DC_VLC_BITS, 512,
- &v2_dc_chroma_table[0][1], 8, 4,
- &v2_dc_chroma_table[0][0], 8, 4, 1506);
+ &ff_v2_dc_chroma_table[0][1], 8, 4,
+ &ff_v2_dc_chroma_table[0][0], 8, 4, 1506);
INIT_VLC_STATIC(&v2_intra_cbpc_vlc, V2_INTRA_CBPC_VLC_BITS, 4,
- &v2_intra_cbpc[0][1], 2, 1,
- &v2_intra_cbpc[0][0], 2, 1, 8);
+ &ff_v2_intra_cbpc[0][1], 2, 1,
+ &ff_v2_intra_cbpc[0][0], 2, 1, 8);
INIT_VLC_STATIC(&v2_mb_type_vlc, V2_MB_TYPE_VLC_BITS, 8,
- &v2_mb_type[0][1], 2, 1,
- &v2_mb_type[0][0], 2, 1, 128);
+ &ff_v2_mb_type[0][1], 2, 1,
+ &ff_v2_mb_type[0][0], 2, 1, 128);
INIT_VLC_STATIC(&v2_mv_vlc, V2_MV_VLC_BITS, 33,
&ff_mvtab[0][1], 2, 1,
&ff_mvtab[0][0], 2, 1, 538);
INIT_VLC_STATIC(&ff_mb_non_intra_vlc[0], MB_NON_INTRA_VLC_BITS, 128,
- &wmv2_inter_table[0][0][1], 8, 4,
- &wmv2_inter_table[0][0][0], 8, 4, 1636);
+ &ff_wmv2_inter_table[0][0][1], 8, 4,
+ &ff_wmv2_inter_table[0][0][0], 8, 4, 1636);
INIT_VLC_STATIC(&ff_mb_non_intra_vlc[1], MB_NON_INTRA_VLC_BITS, 128,
- &wmv2_inter_table[1][0][1], 8, 4,
- &wmv2_inter_table[1][0][0], 8, 4, 2648);
+ &ff_wmv2_inter_table[1][0][1], 8, 4,
+ &ff_wmv2_inter_table[1][0][0], 8, 4, 2648);
INIT_VLC_STATIC(&ff_mb_non_intra_vlc[2], MB_NON_INTRA_VLC_BITS, 128,
- &wmv2_inter_table[2][0][1], 8, 4,
- &wmv2_inter_table[2][0][0], 8, 4, 1532);
+ &ff_wmv2_inter_table[2][0][1], 8, 4,
+ &ff_wmv2_inter_table[2][0][0], 8, 4, 1532);
INIT_VLC_STATIC(&ff_mb_non_intra_vlc[3], MB_NON_INTRA_VLC_BITS, 128,
- &wmv2_inter_table[3][0][1], 8, 4,
- &wmv2_inter_table[3][0][0], 8, 4, 2488);
+ &ff_wmv2_inter_table[3][0][1], 8, 4,
+ &ff_wmv2_inter_table[3][0][0], 8, 4, 2488);
INIT_VLC_STATIC(&ff_msmp4_mb_i_vlc, MB_INTRA_VLC_BITS, 64,
&ff_msmp4_mb_i_table[0][1], 4, 2,
&ff_msmp4_mb_i_table[0][0], 4, 2, 536);
INIT_VLC_STATIC(&ff_inter_intra_vlc, INTER_INTRA_VLC_BITS, 4,
- &table_inter_intra[0][1], 2, 1,
- &table_inter_intra[0][0], 2, 1, 8);
+ &ff_table_inter_intra[0][1], 2, 1,
+ &ff_table_inter_intra[0][0], 2, 1, 8);
}
switch(s->msmpeg4_version){
@@ -1363,7 +693,7 @@ av_cold int ff_msmpeg4_decode_init(AVCodecContext *avctx)
return 0;
}
-int msmpeg4_decode_picture_header(MpegEncContext * s)
+int ff_msmpeg4_decode_picture_header(MpegEncContext * s)
{
int code;
@@ -1430,7 +760,7 @@ int msmpeg4_decode_picture_header(MpegEncContext * s)
s->dc_table_index = get_bits1(&s->gb);
break;
case 4:
- msmpeg4_decode_ext_header(s, (2+5+5+17+7)/8);
+ ff_msmpeg4_decode_ext_header(s, (2+5+5+17+7)/8);
if(s->bit_rate > MBAC_BITRATE) s->per_mb_rl_table= get_bits1(&s->gb);
else s->per_mb_rl_table= 0;
@@ -1509,7 +839,8 @@ int msmpeg4_decode_picture_header(MpegEncContext * s)
s->no_rounding = 0;
}
}
-//printf("%d %d %d %d %d\n", s->pict_type, s->bit_rate, s->inter_intra_pred, s->width, s->height);
+ av_dlog(s->avctx, "%d %d %d %d %d\n", s->pict_type, s->bit_rate,
+ s->inter_intra_pred, s->width, s->height);
s->esc3_level_length= 0;
s->esc3_run_length= 0;
@@ -1517,7 +848,7 @@ int msmpeg4_decode_picture_header(MpegEncContext * s)
return 0;
}
-int msmpeg4_decode_ext_header(MpegEncContext * s, int buf_size)
+int ff_msmpeg4_decode_ext_header(MpegEncContext * s, int buf_size)
{
int left= buf_size*8 - get_bits_count(&s->gb);
int length= s->msmpeg4_version>=3 ? 17 : 16;
@@ -1530,8 +861,6 @@ int msmpeg4_decode_ext_header(MpegEncContext * s, int buf_size)
s->flipflop_rounding= get_bits1(&s->gb);
else
s->flipflop_rounding= 0;
-
-// printf("fps:%2d bps:%2d roundingType:%1d\n", fps, s->bit_rate/1024, s->flipflop_rounding);
}
else if(left<length+8)
{
@@ -1590,7 +919,7 @@ static int msmpeg4_decode_dc(MpegEncContext * s, int n, int *dir_ptr)
*dc_val= level;
}else{
int16_t *dc_val;
- pred = msmpeg4_pred_dc(s, n, &dc_val, dir_ptr);
+ pred = ff_msmpeg4_pred_dc(s, n, &dc_val, dir_ptr);
level += pred;
/* update predictor */
@@ -1627,13 +956,13 @@ int ff_msmpeg4_decode_block(MpegEncContext * s, DCTELEM * block,
else return -1;
}
if (n < 4) {
- rl = &rl_table[s->rl_table_index];
+ rl = &ff_rl_table[s->rl_table_index];
if(level > 256*s->y_dc_scale){
av_log(s->avctx, AV_LOG_ERROR, "dc overflow+ L qscale: %d//\n", s->qscale);
if(!s->inter_intra_pred) return -1;
}
} else {
- rl = &rl_table[3 + s->rl_chroma_table_index];
+ rl = &ff_rl_table[3 + s->rl_chroma_table_index];
if(level > 256*s->c_dc_scale){
av_log(s->avctx, AV_LOG_ERROR, "dc overflow+ C qscale: %d//\n", s->qscale);
if(!s->inter_intra_pred) return -1;
@@ -1659,7 +988,7 @@ int ff_msmpeg4_decode_block(MpegEncContext * s, DCTELEM * block,
qmul = s->qscale << 1;
qadd = (s->qscale - 1) | 1;
i = -1;
- rl = &rl_table[3 + s->rl_table_index];
+ rl = &ff_rl_table[3 + s->rl_table_index];
if(s->msmpeg4_version==2)
run_diff = 0;
@@ -1698,7 +1027,8 @@ int ff_msmpeg4_decode_block(MpegEncContext * s, DCTELEM * block,
last= SHOW_UBITS(re, &s->gb, 1); SKIP_BITS(re, &s->gb, 1);
if(!s->esc3_level_length){
int ll;
- //printf("ESC-3 %X at %d %d\n", show_bits(&s->gb, 24), s->mb_x, s->mb_y);
+ av_dlog(s->avctx, "ESC-3 %X at %d %d\n",
+ show_bits(&s->gb, 24), s->mb_x, s->mb_y);
if(s->qscale<8){
ll= SHOW_UBITS(re, &s->gb, 3); SKIP_BITS(re, &s->gb, 3);
if(ll==0){
@@ -1715,7 +1045,6 @@ int ff_msmpeg4_decode_block(MpegEncContext * s, DCTELEM * block,
s->esc3_level_length= ll;
s->esc3_run_length= SHOW_UBITS(re, &s->gb, 2) + 3; SKIP_BITS(re, &s->gb, 2);
-//printf("level length:%d, run length: %d\n", ll, s->esc3_run_length);
UPDATE_CACHE(re, &s->gb);
}
run= SHOW_UBITS(re, &s->gb, s->esc3_run_length);
@@ -1728,7 +1057,7 @@ int ff_msmpeg4_decode_block(MpegEncContext * s, DCTELEM * block,
SKIP_BITS(re, &s->gb, s->esc3_level_length);
if(sign) level= -level;
}
-//printf("level: %d, run: %d at %d %d\n", level, run, s->mb_x, s->mb_y);
+
#if 0 // waste of time / this will detect very few errors
{
const int abs_level= FFABS(level);
@@ -1829,7 +1158,7 @@ int ff_msmpeg4_decode_block(MpegEncContext * s, DCTELEM * block,
}
not_coded:
if (s->mb_intra) {
- mpeg4_pred_ac(s, block, n, dc_pred_dir);
+ ff_mpeg4_pred_ac(s, block, n, dc_pred_dir);
if (s->ac_pred) {
i = 63; /* XXX: not optimal */
}
@@ -1846,7 +1175,7 @@ int ff_msmpeg4_decode_motion(MpegEncContext * s,
MVTable *mv;
int code, mx, my;
- mv = &mv_tables[s->mv_table_index];
+ mv = &ff_mv_tables[s->mv_table_index];
code = get_vlc2(&s->gb, mv->vlc.table, MV_VLC_BITS, 2);
if (code < 0){
@@ -1854,7 +1183,6 @@ int ff_msmpeg4_decode_motion(MpegEncContext * s,
return -1;
}
if (code == mv->n) {
-//printf("MV ESC %X at %d %d\n", show_bits(&s->gb, 24), s->mb_x, s->mb_y);
mx = get_bits(&s->gb, 6);
my = get_bits(&s->gb, 6);
} else {
@@ -1882,55 +1210,51 @@ int ff_msmpeg4_decode_motion(MpegEncContext * s,
AVCodec ff_msmpeg4v1_decoder = {
.name = "msmpeg4v1",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_MSMPEG4V1,
+ .id = AV_CODEC_ID_MSMPEG4V1,
.priv_data_size = sizeof(MpegEncContext),
.init = ff_msmpeg4_decode_init,
.close = ff_h263_decode_end,
.decode = ff_h263_decode_frame,
.capabilities = CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1,
- .max_lowres= 3,
- .long_name= NULL_IF_CONFIG_SMALL("MPEG-4 part 2 Microsoft variant version 1"),
- .pix_fmts= ff_pixfmt_list_420,
+ .long_name = NULL_IF_CONFIG_SMALL("MPEG-4 part 2 Microsoft variant version 1"),
+ .pix_fmts = ff_pixfmt_list_420,
};
AVCodec ff_msmpeg4v2_decoder = {
.name = "msmpeg4v2",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_MSMPEG4V2,
+ .id = AV_CODEC_ID_MSMPEG4V2,
.priv_data_size = sizeof(MpegEncContext),
.init = ff_msmpeg4_decode_init,
.close = ff_h263_decode_end,
.decode = ff_h263_decode_frame,
.capabilities = CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1,
- .max_lowres= 3,
- .long_name= NULL_IF_CONFIG_SMALL("MPEG-4 part 2 Microsoft variant version 2"),
- .pix_fmts= ff_pixfmt_list_420,
+ .long_name = NULL_IF_CONFIG_SMALL("MPEG-4 part 2 Microsoft variant version 2"),
+ .pix_fmts = ff_pixfmt_list_420,
};
AVCodec ff_msmpeg4v3_decoder = {
.name = "msmpeg4",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_MSMPEG4V3,
+ .id = AV_CODEC_ID_MSMPEG4V3,
.priv_data_size = sizeof(MpegEncContext),
.init = ff_msmpeg4_decode_init,
.close = ff_h263_decode_end,
.decode = ff_h263_decode_frame,
.capabilities = CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1,
- .max_lowres= 3,
- .long_name= NULL_IF_CONFIG_SMALL("MPEG-4 part 2 Microsoft variant version 3"),
- .pix_fmts= ff_pixfmt_list_420,
+ .long_name = NULL_IF_CONFIG_SMALL("MPEG-4 part 2 Microsoft variant version 3"),
+ .pix_fmts = ff_pixfmt_list_420,
};
AVCodec ff_wmv1_decoder = {
.name = "wmv1",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_WMV1,
+ .id = AV_CODEC_ID_WMV1,
.priv_data_size = sizeof(MpegEncContext),
.init = ff_msmpeg4_decode_init,
.close = ff_h263_decode_end,
.decode = ff_h263_decode_frame,
.capabilities = CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1,
- .max_lowres= 3,
- .long_name= NULL_IF_CONFIG_SMALL("Windows Media Video 7"),
- .pix_fmts= ff_pixfmt_list_420,
+ .long_name = NULL_IF_CONFIG_SMALL("Windows Media Video 7"),
+ .pix_fmts = ff_pixfmt_list_420,
};
diff --git a/gst-libs/ext/libav/libavcodec/msmpeg4.h b/gst-libs/ext/libav/libavcodec/msmpeg4.h
index 77b1944..8fe07f2 100644
--- a/gst-libs/ext/libav/libavcodec/msmpeg4.h
+++ b/gst-libs/ext/libav/libavcodec/msmpeg4.h
@@ -22,19 +22,29 @@
#ifndef AVCODEC_MSMPEG4_H
#define AVCODEC_MSMPEG4_H
+#include <stdint.h>
+
#include "config.h"
#include "avcodec.h"
#include "dsputil.h"
#include "mpegvideo.h"
+#include "msmpeg4data.h"
+#include "put_bits.h"
#define INTER_INTRA_VLC_BITS 3
#define MB_NON_INTRA_VLC_BITS 9
#define MB_INTRA_VLC_BITS 9
+#define II_BITRATE 128*1024
+#define MBAC_BITRATE 50*1024
+
+#define DC_MAX 119
+
extern VLC ff_mb_non_intra_vlc[4];
extern VLC ff_inter_intra_vlc;
void ff_msmpeg4_code012(PutBitContext *pb, int n);
+void ff_msmpeg4_common_init(MpegEncContext *s);
void ff_msmpeg4_encode_block(MpegEncContext * s, DCTELEM * block, int n);
void ff_msmpeg4_handle_slices(MpegEncContext *s);
void ff_msmpeg4_encode_motion(MpegEncContext * s, int mx, int my);
@@ -43,6 +53,8 @@ int ff_msmpeg4_coded_block_pred(MpegEncContext * s, int n,
int ff_msmpeg4_decode_motion(MpegEncContext * s, int *mx_ptr, int *my_ptr);
int ff_msmpeg4_decode_block(MpegEncContext * s, DCTELEM * block,
int n, int coded, const uint8_t *scan_table);
+int ff_msmpeg4_pred_dc(MpegEncContext *s, int n,
+ int16_t **dc_val_ptr, int *dir_ptr);
int ff_wmv2_decode_mb(MpegEncContext *s, DCTELEM block[6][64]);
#define CONFIG_MSMPEG4_DECODER (CONFIG_MSMPEG4V1_DECODER || \
diff --git a/gst-libs/ext/libav/libavcodec/msmpeg4data.c b/gst-libs/ext/libav/libavcodec/msmpeg4data.c
index e51c725..5721d8f 100644
--- a/gst-libs/ext/libav/libavcodec/msmpeg4data.c
+++ b/gst-libs/ext/libav/libavcodec/msmpeg4data.c
@@ -29,6 +29,10 @@
#include "msmpeg4data.h"
+uint32_t ff_v2_dc_lum_table[512][2];
+uint32_t ff_v2_dc_chroma_table[512][2];
+uint8_t ff_static_rl_table_store[NB_RL_TABLES][2][2 * MAX_RUN + MAX_LEVEL + 3];
+
VLC ff_msmp4_mb_i_vlc;
VLC ff_msmp4_dc_luma_vlc[2];
VLC ff_msmp4_dc_chroma_vlc[2];
@@ -54,7 +58,7 @@ const uint16_t ff_msmp4_mb_i_table[64][2] = {
};
/* non intra picture macroblock coded block pattern + mb type */
-const uint32_t table_mb_non_intra[128][2] = {
+const uint32_t ff_table_mb_non_intra[128][2] = {
{ 0x40, 7 },{ 0x13c9, 13 },{ 0x9fd, 12 },{ 0x1fc, 15 },
{ 0x9fc, 12 },{ 0xa83, 18 },{ 0x12d34, 17 },{ 0x83bc, 16 },
{ 0x83a, 12 },{ 0x7f8, 17 },{ 0x3fd, 16 },{ 0x3ff, 16 },
@@ -600,7 +604,7 @@ extern const uint16_t ff_mpeg4_intra_vlc[103][2];
extern const int8_t ff_mpeg4_intra_level[102];
extern const int8_t ff_mpeg4_intra_run[102];
-RLTable rl_table[NB_RL_TABLES] = {
+RLTable ff_rl_table[NB_RL_TABLES] = {
/* intra luminance tables */
/* low motion */
{
@@ -1784,7 +1788,7 @@ static const uint8_t table1_mvy[1099] = {
34, 28, 21,
};
-MVTable mv_tables[2] = {
+MVTable ff_mv_tables[2] = {
{
1099,
table0_mv_code,
@@ -1801,30 +1805,30 @@ MVTable mv_tables[2] = {
}
};
-const uint8_t v2_mb_type[8][2] = {
+const uint8_t ff_v2_mb_type[8][2] = {
{1, 1}, {0 , 2}, {3 , 3}, {9 , 5},
{5, 4}, {0x21, 7}, {0x20, 7}, {0x11, 6},
};
-const uint8_t v2_intra_cbpc[4][2] = {
+const uint8_t ff_v2_intra_cbpc[4][2] = {
{1, 1}, {0, 3}, {1, 3}, {1, 2},
};
-const uint8_t wmv1_y_dc_scale_table[32]={
+const uint8_t ff_wmv1_y_dc_scale_table[32]={
// 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
0, 8, 8, 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
};
-const uint8_t wmv1_c_dc_scale_table[32]={
+const uint8_t ff_wmv1_c_dc_scale_table[32]={
// 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
0, 8, 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,22
};
-const uint8_t old_ff_y_dc_scale_table[32]={
+const uint8_t ff_old_ff_y_dc_scale_table[32]={
// 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
0, 8, 8, 8, 8,10,12,14,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39
};
-const uint8_t wmv1_scantable[WMV1_SCANTABLE_COUNT][64]={
+const uint8_t ff_wmv1_scantable[WMV1_SCANTABLE_COUNT][64]={
{
0x00, 0x08, 0x01, 0x02, 0x09, 0x10, 0x18, 0x11,
0x0A, 0x03, 0x04, 0x0B, 0x12, 0x19, 0x20, 0x28,
@@ -1867,7 +1871,7 @@ const uint8_t wmv1_scantable[WMV1_SCANTABLE_COUNT][64]={
}
};
-const uint8_t table_inter_intra[4][2]={
+const uint8_t ff_table_inter_intra[4][2]={
{0,1} /*Luma-Left Chroma-Left*/,
{2,2} /*Luma-Top Chroma-Left*/,
{6,3} /*luma-Left Chroma-Top */,
@@ -1979,21 +1983,21 @@ static const uint32_t table_mb_non_intra4[128][2] = {
{0x000011, 5}, {0x0001AC, 9}, {0x0000F3, 8}, {0x000439, 11},
};
-const uint32_t (* const wmv2_inter_table[WMV2_INTER_CBP_TABLE_COUNT])[2]={
+const uint32_t (* const ff_wmv2_inter_table[WMV2_INTER_CBP_TABLE_COUNT])[2]={
table_mb_non_intra2,
table_mb_non_intra3,
table_mb_non_intra4,
- table_mb_non_intra,
+ ff_table_mb_non_intra,
};
-const uint8_t wmv2_scantableA[64]={
+const uint8_t ff_wmv2_scantableA[64]={
0x00, 0x01, 0x02, 0x08, 0x03, 0x09, 0x0A, 0x10,
0x04, 0x0B, 0x11, 0x18, 0x12, 0x0C, 0x05, 0x13,
0x19, 0x0D, 0x14, 0x1A, 0x1B, 0x06, 0x15, 0x1C,
0x0E, 0x16, 0x1D, 0x07, 0x1E, 0x0F, 0x17, 0x1F,
};
-const uint8_t wmv2_scantableB[64]={
+const uint8_t ff_wmv2_scantableB[64]={
0x00, 0x08, 0x01, 0x10, 0x09, 0x18, 0x11, 0x02,
0x20, 0x0A, 0x19, 0x28, 0x12, 0x30, 0x21, 0x1A,
0x38, 0x29, 0x22, 0x03, 0x31, 0x39, 0x0B, 0x2A,
diff --git a/gst-libs/ext/libav/libavcodec/msmpeg4data.h b/gst-libs/ext/libav/libavcodec/msmpeg4data.h
index 0907c7a..ca2dac1 100644
--- a/gst-libs/ext/libav/libavcodec/msmpeg4data.h
+++ b/gst-libs/ext/libav/libavcodec/msmpeg4data.h
@@ -54,23 +54,27 @@ extern const uint16_t ff_msmp4_mb_i_table[64][2];
#define WMV1_SCANTABLE_COUNT 4
-extern const uint8_t wmv1_scantable[WMV1_SCANTABLE_COUNT][64];
+extern const uint8_t ff_wmv1_scantable[WMV1_SCANTABLE_COUNT][64];
#define NB_RL_TABLES 6
-extern RLTable rl_table[NB_RL_TABLES];
+extern RLTable ff_rl_table[NB_RL_TABLES];
+extern uint8_t ff_static_rl_table_store[NB_RL_TABLES][2][2 * MAX_RUN + MAX_LEVEL + 3];
-extern const uint8_t wmv1_y_dc_scale_table[32];
-extern const uint8_t wmv1_c_dc_scale_table[32];
-extern const uint8_t old_ff_y_dc_scale_table[32];
+extern uint32_t ff_v2_dc_lum_table[512][2];
+extern uint32_t ff_v2_dc_chroma_table[512][2];
-extern MVTable mv_tables[2];
+extern const uint8_t ff_wmv1_y_dc_scale_table[32];
+extern const uint8_t ff_wmv1_c_dc_scale_table[32];
+extern const uint8_t ff_old_ff_y_dc_scale_table[32];
-extern const uint8_t v2_mb_type[8][2];
-extern const uint8_t v2_intra_cbpc[4][2];
+extern MVTable ff_mv_tables[2];
-extern const uint32_t table_mb_non_intra[128][2];
-extern const uint8_t table_inter_intra[4][2];
+extern const uint8_t ff_v2_mb_type[8][2];
+extern const uint8_t ff_v2_intra_cbpc[4][2];
+
+extern const uint32_t ff_table_mb_non_intra[128][2];
+extern const uint8_t ff_table_inter_intra[4][2];
extern const uint32_t ff_table0_dc_lum[120][2];
extern const uint32_t ff_table1_dc_lum[120][2];
@@ -78,9 +82,9 @@ extern const uint32_t ff_table0_dc_chroma[120][2];
extern const uint32_t ff_table1_dc_chroma[120][2];
#define WMV2_INTER_CBP_TABLE_COUNT 4
-extern const uint32_t (* const wmv2_inter_table[WMV2_INTER_CBP_TABLE_COUNT])[2];
+extern const uint32_t (* const ff_wmv2_inter_table[WMV2_INTER_CBP_TABLE_COUNT])[2];
-extern const uint8_t wmv2_scantableA[64];
-extern const uint8_t wmv2_scantableB[64];
+extern const uint8_t ff_wmv2_scantableA[64];
+extern const uint8_t ff_wmv2_scantableB[64];
#endif /* AVCODEC_MSMPEG4DATA_H */
diff --git a/gst-libs/ext/libav/libavcodec/msmpeg4enc.c b/gst-libs/ext/libav/libavcodec/msmpeg4enc.c
new file mode 100644
index 0000000..4a362c3
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/msmpeg4enc.c
@@ -0,0 +1,690 @@
+/*
+ * MSMPEG4 encoder backend
+ * Copyright (c) 2001 Fabrice Bellard
+ * Copyright (c) 2002-2004 Michael Niedermayer <michaelni@gmx.at>
+ *
+ * msmpeg4v1 & v2 stuff by Michael Niedermayer <michaelni@gmx.at>
+ *
+ * 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
+ * MSMPEG4 encoder backend
+ */
+
+#include <stdint.h>
+#include <string.h>
+
+#include "libavutil/avutil.h"
+#include "libavutil/mem.h"
+#include "mpegvideo.h"
+#include "msmpeg4.h"
+#include "h263.h"
+#include "mpeg4video.h"
+#include "msmpeg4.h"
+#include "msmpeg4data.h"
+#include "put_bits.h"
+#include "rl.h"
+#include "vc1data.h"
+
+static uint8_t rl_length[NB_RL_TABLES][MAX_LEVEL+1][MAX_RUN+1][2];
+
+/* build the table which associate a (x,y) motion vector to a vlc */
+static void init_mv_table(MVTable *tab)
+{
+ int i, x, y;
+
+ tab->table_mv_index = av_malloc(sizeof(uint16_t) * 4096);
+ /* mark all entries as not used */
+ for(i=0;i<4096;i++)
+ tab->table_mv_index[i] = tab->n;
+
+ for(i=0;i<tab->n;i++) {
+ x = tab->table_mvx[i];
+ y = tab->table_mvy[i];
+ tab->table_mv_index[(x << 6) | y] = i;
+ }
+}
+
+void ff_msmpeg4_code012(PutBitContext *pb, int n)
+{
+ if (n == 0) {
+ put_bits(pb, 1, 0);
+ } else {
+ put_bits(pb, 1, 1);
+ put_bits(pb, 1, (n >= 2));
+ }
+}
+
+static int get_size_of_code(MpegEncContext * s, RLTable *rl, int last, int run, int level, int intra){
+ int size=0;
+ int code;
+ int run_diff= intra ? 0 : 1;
+
+ code = get_rl_index(rl, last, run, level);
+ size+= rl->table_vlc[code][1];
+ if (code == rl->n) {
+ int level1, run1;
+
+ level1 = level - rl->max_level[last][run];
+ if (level1 < 1)
+ goto esc2;
+ code = get_rl_index(rl, last, run, level1);
+ if (code == rl->n) {
+ esc2:
+ size++;
+ if (level > MAX_LEVEL)
+ goto esc3;
+ run1 = run - rl->max_run[last][level] - run_diff;
+ if (run1 < 0)
+ goto esc3;
+ code = get_rl_index(rl, last, run1, level);
+ if (code == rl->n) {
+ esc3:
+ /* third escape */
+ size+=1+1+6+8;
+ } else {
+ /* second escape */
+ size+= 1+1+ rl->table_vlc[code][1];
+ }
+ } else {
+ /* first escape */
+ size+= 1+1+ rl->table_vlc[code][1];
+ }
+ } else {
+ size++;
+ }
+ return size;
+}
+
+av_cold void ff_msmpeg4_encode_init(MpegEncContext *s)
+{
+ static int init_done=0;
+ int i;
+
+ ff_msmpeg4_common_init(s);
+ if(s->msmpeg4_version>=4){
+ s->min_qcoeff= -255;
+ s->max_qcoeff= 255;
+ }
+
+ if (!init_done) {
+ /* init various encoding tables */
+ init_done = 1;
+ init_mv_table(&ff_mv_tables[0]);
+ init_mv_table(&ff_mv_tables[1]);
+ for(i=0;i<NB_RL_TABLES;i++)
+ ff_init_rl(&ff_rl_table[i], ff_static_rl_table_store[i]);
+
+ for(i=0; i<NB_RL_TABLES; i++){
+ int level;
+ for (level = 1; level <= MAX_LEVEL; level++) {
+ int run;
+ for(run=0; run<=MAX_RUN; run++){
+ int last;
+ for(last=0; last<2; last++){
+ rl_length[i][level][run][last]= get_size_of_code(s, &ff_rl_table[ i], last, run, level, 0);
+ }
+ }
+ }
+ }
+ }
+}
+
+static void find_best_tables(MpegEncContext * s)
+{
+ int i;
+ int best =-1, best_size =9999999;
+ int chroma_best=-1, best_chroma_size=9999999;
+
+ for(i=0; i<3; i++){
+ int level;
+ int chroma_size=0;
+ int size=0;
+
+ if(i>0){// ;)
+ size++;
+ chroma_size++;
+ }
+ for(level=0; level<=MAX_LEVEL; level++){
+ int run;
+ for(run=0; run<=MAX_RUN; run++){
+ int last;
+ const int last_size= size + chroma_size;
+ for(last=0; last<2; last++){
+ int inter_count = s->ac_stats[0][0][level][run][last] + s->ac_stats[0][1][level][run][last];
+ int intra_luma_count = s->ac_stats[1][0][level][run][last];
+ int intra_chroma_count= s->ac_stats[1][1][level][run][last];
+
+ if(s->pict_type==AV_PICTURE_TYPE_I){
+ size += intra_luma_count *rl_length[i ][level][run][last];
+ chroma_size+= intra_chroma_count*rl_length[i+3][level][run][last];
+ }else{
+ size+= intra_luma_count *rl_length[i ][level][run][last]
+ +intra_chroma_count*rl_length[i+3][level][run][last]
+ +inter_count *rl_length[i+3][level][run][last];
+ }
+ }
+ if(last_size == size+chroma_size) break;
+ }
+ }
+ if(size<best_size){
+ best_size= size;
+ best= i;
+ }
+ if(chroma_size<best_chroma_size){
+ best_chroma_size= chroma_size;
+ chroma_best= i;
+ }
+ }
+
+ if(s->pict_type==AV_PICTURE_TYPE_P) chroma_best= best;
+
+ memset(s->ac_stats, 0, sizeof(int)*(MAX_LEVEL+1)*(MAX_RUN+1)*2*2*2);
+
+ s->rl_table_index = best;
+ s->rl_chroma_table_index= chroma_best;
+
+ if(s->pict_type != s->last_non_b_pict_type){
+ s->rl_table_index= 2;
+ if(s->pict_type==AV_PICTURE_TYPE_I)
+ s->rl_chroma_table_index= 1;
+ else
+ s->rl_chroma_table_index= 2;
+ }
+
+}
+
+/* write MSMPEG4 compatible frame header */
+void ff_msmpeg4_encode_picture_header(MpegEncContext * s, int picture_number)
+{
+ find_best_tables(s);
+
+ avpriv_align_put_bits(&s->pb);
+ put_bits(&s->pb, 2, s->pict_type - 1);
+
+ put_bits(&s->pb, 5, s->qscale);
+ if(s->msmpeg4_version<=2){
+ s->rl_table_index = 2;
+ s->rl_chroma_table_index = 2;
+ }
+
+ s->dc_table_index = 1;
+ s->mv_table_index = 1; /* only if P frame */
+ s->use_skip_mb_code = 1; /* only if P frame */
+ s->per_mb_rl_table = 0;
+ if(s->msmpeg4_version==4)
+ s->inter_intra_pred= (s->width*s->height < 320*240 && s->bit_rate<=II_BITRATE && s->pict_type==AV_PICTURE_TYPE_P);
+ av_dlog(s, "%d %d %d %d %d\n", s->pict_type, s->bit_rate,
+ s->inter_intra_pred, s->width, s->height);
+
+ if (s->pict_type == AV_PICTURE_TYPE_I) {
+ s->slice_height= s->mb_height/1;
+ put_bits(&s->pb, 5, 0x16 + s->mb_height/s->slice_height);
+
+ if(s->msmpeg4_version==4){
+ ff_msmpeg4_encode_ext_header(s);
+ if(s->bit_rate>MBAC_BITRATE)
+ put_bits(&s->pb, 1, s->per_mb_rl_table);
+ }
+
+ if(s->msmpeg4_version>2){
+ if(!s->per_mb_rl_table){
+ ff_msmpeg4_code012(&s->pb, s->rl_chroma_table_index);
+ ff_msmpeg4_code012(&s->pb, s->rl_table_index);
+ }
+
+ put_bits(&s->pb, 1, s->dc_table_index);
+ }
+ } else {
+ put_bits(&s->pb, 1, s->use_skip_mb_code);
+
+ if(s->msmpeg4_version==4 && s->bit_rate>MBAC_BITRATE)
+ put_bits(&s->pb, 1, s->per_mb_rl_table);
+
+ if(s->msmpeg4_version>2){
+ if(!s->per_mb_rl_table)
+ ff_msmpeg4_code012(&s->pb, s->rl_table_index);
+
+ put_bits(&s->pb, 1, s->dc_table_index);
+
+ put_bits(&s->pb, 1, s->mv_table_index);
+ }
+ }
+
+ s->esc3_level_length= 0;
+ s->esc3_run_length= 0;
+}
+
+void ff_msmpeg4_encode_ext_header(MpegEncContext * s)
+{
+ put_bits(&s->pb, 5, s->avctx->time_base.den / s->avctx->time_base.num); //yes 29.97 -> 29
+
+ put_bits(&s->pb, 11, FFMIN(s->bit_rate/1024, 2047));
+
+ if(s->msmpeg4_version>=3)
+ put_bits(&s->pb, 1, s->flipflop_rounding);
+ else
+ assert(s->flipflop_rounding==0);
+}
+
+void ff_msmpeg4_encode_motion(MpegEncContext * s,
+ int mx, int my)
+{
+ int code;
+ MVTable *mv;
+
+ /* modulo encoding */
+ /* WARNING : you cannot reach all the MVs even with the modulo
+ encoding. This is a somewhat strange compromise they took !!! */
+ if (mx <= -64)
+ mx += 64;
+ else if (mx >= 64)
+ mx -= 64;
+ if (my <= -64)
+ my += 64;
+ else if (my >= 64)
+ my -= 64;
+
+ mx += 32;
+ my += 32;
+#if 0
+ if ((unsigned)mx >= 64 ||
+ (unsigned)my >= 64)
+ av_log(s->avctx, AV_LOG_ERROR, "error mx=%d my=%d\n", mx, my);
+#endif
+ mv = &ff_mv_tables[s->mv_table_index];
+
+ code = mv->table_mv_index[(mx << 6) | my];
+ put_bits(&s->pb,
+ mv->table_mv_bits[code],
+ mv->table_mv_code[code]);
+ if (code == mv->n) {
+ /* escape : code literally */
+ put_bits(&s->pb, 6, mx);
+ put_bits(&s->pb, 6, my);
+ }
+}
+
+void ff_msmpeg4_handle_slices(MpegEncContext *s){
+ if (s->mb_x == 0) {
+ if (s->slice_height && (s->mb_y % s->slice_height) == 0) {
+ if(s->msmpeg4_version < 4){
+ ff_mpeg4_clean_buffers(s);
+ }
+ s->first_slice_line = 1;
+ } else {
+ s->first_slice_line = 0;
+ }
+ }
+}
+
+static void msmpeg4v2_encode_motion(MpegEncContext * s, int val)
+{
+ int range, bit_size, sign, code, bits;
+
+ if (val == 0) {
+ /* zero vector */
+ code = 0;
+ put_bits(&s->pb, ff_mvtab[code][1], ff_mvtab[code][0]);
+ } else {
+ bit_size = s->f_code - 1;
+ range = 1 << bit_size;
+ if (val <= -64)
+ val += 64;
+ else if (val >= 64)
+ val -= 64;
+
+ if (val >= 0) {
+ sign = 0;
+ } else {
+ val = -val;
+ sign = 1;
+ }
+ val--;
+ code = (val >> bit_size) + 1;
+ bits = val & (range - 1);
+
+ put_bits(&s->pb, ff_mvtab[code][1] + 1, (ff_mvtab[code][0] << 1) | sign);
+ if (bit_size > 0) {
+ put_bits(&s->pb, bit_size, bits);
+ }
+ }
+}
+
+void ff_msmpeg4_encode_mb(MpegEncContext * s,
+ DCTELEM block[6][64],
+ int motion_x, int motion_y)
+{
+ int cbp, coded_cbp, i;
+ int pred_x, pred_y;
+ uint8_t *coded_block;
+
+ ff_msmpeg4_handle_slices(s);
+
+ if (!s->mb_intra) {
+ /* compute cbp */
+ cbp = 0;
+ for (i = 0; i < 6; i++) {
+ if (s->block_last_index[i] >= 0)
+ cbp |= 1 << (5 - i);
+ }
+ if (s->use_skip_mb_code && (cbp | motion_x | motion_y) == 0) {
+ /* skip macroblock */
+ put_bits(&s->pb, 1, 1);
+ s->last_bits++;
+ s->misc_bits++;
+ s->skip_count++;
+
+ return;
+ }
+ if (s->use_skip_mb_code)
+ put_bits(&s->pb, 1, 0); /* mb coded */
+
+ if(s->msmpeg4_version<=2){
+ put_bits(&s->pb,
+ ff_v2_mb_type[cbp&3][1],
+ ff_v2_mb_type[cbp&3][0]);
+ if((cbp&3) != 3) coded_cbp= cbp ^ 0x3C;
+ else coded_cbp= cbp;
+
+ put_bits(&s->pb,
+ ff_h263_cbpy_tab[coded_cbp>>2][1],
+ ff_h263_cbpy_tab[coded_cbp>>2][0]);
+
+ s->misc_bits += get_bits_diff(s);
+
+ ff_h263_pred_motion(s, 0, 0, &pred_x, &pred_y);
+ msmpeg4v2_encode_motion(s, motion_x - pred_x);
+ msmpeg4v2_encode_motion(s, motion_y - pred_y);
+ }else{
+ put_bits(&s->pb,
+ ff_table_mb_non_intra[cbp + 64][1],
+ ff_table_mb_non_intra[cbp + 64][0]);
+
+ s->misc_bits += get_bits_diff(s);
+
+ /* motion vector */
+ ff_h263_pred_motion(s, 0, 0, &pred_x, &pred_y);
+ ff_msmpeg4_encode_motion(s, motion_x - pred_x,
+ motion_y - pred_y);
+ }
+
+ s->mv_bits += get_bits_diff(s);
+
+ for (i = 0; i < 6; i++) {
+ ff_msmpeg4_encode_block(s, block[i], i);
+ }
+ s->p_tex_bits += get_bits_diff(s);
+ } else {
+ /* compute cbp */
+ cbp = 0;
+ coded_cbp = 0;
+ for (i = 0; i < 6; i++) {
+ int val, pred;
+ val = (s->block_last_index[i] >= 1);
+ cbp |= val << (5 - i);
+ if (i < 4) {
+ /* predict value for close blocks only for luma */
+ pred = ff_msmpeg4_coded_block_pred(s, i, &coded_block);
+ *coded_block = val;
+ val = val ^ pred;
+ }
+ coded_cbp |= val << (5 - i);
+ }
+
+ if(s->msmpeg4_version<=2){
+ if (s->pict_type == AV_PICTURE_TYPE_I) {
+ put_bits(&s->pb,
+ ff_v2_intra_cbpc[cbp&3][1], ff_v2_intra_cbpc[cbp&3][0]);
+ } else {
+ if (s->use_skip_mb_code)
+ put_bits(&s->pb, 1, 0); /* mb coded */
+ put_bits(&s->pb,
+ ff_v2_mb_type[(cbp&3) + 4][1],
+ ff_v2_mb_type[(cbp&3) + 4][0]);
+ }
+ put_bits(&s->pb, 1, 0); /* no AC prediction yet */
+ put_bits(&s->pb,
+ ff_h263_cbpy_tab[cbp>>2][1],
+ ff_h263_cbpy_tab[cbp>>2][0]);
+ }else{
+ if (s->pict_type == AV_PICTURE_TYPE_I) {
+ put_bits(&s->pb,
+ ff_msmp4_mb_i_table[coded_cbp][1], ff_msmp4_mb_i_table[coded_cbp][0]);
+ } else {
+ if (s->use_skip_mb_code)
+ put_bits(&s->pb, 1, 0); /* mb coded */
+ put_bits(&s->pb,
+ ff_table_mb_non_intra[cbp][1],
+ ff_table_mb_non_intra[cbp][0]);
+ }
+ put_bits(&s->pb, 1, 0); /* no AC prediction yet */
+ if(s->inter_intra_pred){
+ s->h263_aic_dir=0;
+ put_bits(&s->pb, ff_table_inter_intra[s->h263_aic_dir][1], ff_table_inter_intra[s->h263_aic_dir][0]);
+ }
+ }
+ s->misc_bits += get_bits_diff(s);
+
+ for (i = 0; i < 6; i++) {
+ ff_msmpeg4_encode_block(s, block[i], i);
+ }
+ s->i_tex_bits += get_bits_diff(s);
+ s->i_count++;
+ }
+}
+
+static void msmpeg4_encode_dc(MpegEncContext * s, int level, int n, int *dir_ptr)
+{
+ int sign, code;
+ int pred, extquant;
+ int extrabits = 0;
+
+ int16_t *dc_val;
+ pred = ff_msmpeg4_pred_dc(s, n, &dc_val, dir_ptr);
+
+ /* update predictor */
+ if (n < 4) {
+ *dc_val = level * s->y_dc_scale;
+ } else {
+ *dc_val = level * s->c_dc_scale;
+ }
+
+ /* do the prediction */
+ level -= pred;
+
+ if(s->msmpeg4_version<=2){
+ if (n < 4) {
+ put_bits(&s->pb,
+ ff_v2_dc_lum_table[level + 256][1],
+ ff_v2_dc_lum_table[level + 256][0]);
+ }else{
+ put_bits(&s->pb,
+ ff_v2_dc_chroma_table[level + 256][1],
+ ff_v2_dc_chroma_table[level + 256][0]);
+ }
+ }else{
+ sign = 0;
+ if (level < 0) {
+ level = -level;
+ sign = 1;
+ }
+ code = level;
+ if (code > DC_MAX)
+ code = DC_MAX;
+ else if( s->msmpeg4_version>=6 ) {
+ if( s->qscale == 1 ) {
+ extquant = (level + 3) & 0x3;
+ code = ((level+3)>>2);
+ } else if( s->qscale == 2 ) {
+ extquant = (level + 1) & 0x1;
+ code = ((level+1)>>1);
+ }
+ }
+
+ if (s->dc_table_index == 0) {
+ if (n < 4) {
+ put_bits(&s->pb, ff_table0_dc_lum[code][1], ff_table0_dc_lum[code][0]);
+ } else {
+ put_bits(&s->pb, ff_table0_dc_chroma[code][1], ff_table0_dc_chroma[code][0]);
+ }
+ } else {
+ if (n < 4) {
+ put_bits(&s->pb, ff_table1_dc_lum[code][1], ff_table1_dc_lum[code][0]);
+ } else {
+ put_bits(&s->pb, ff_table1_dc_chroma[code][1], ff_table1_dc_chroma[code][0]);
+ }
+ }
+
+ if(s->msmpeg4_version>=6 && s->qscale<=2)
+ extrabits = 3 - s->qscale;
+
+ if (code == DC_MAX)
+ put_bits(&s->pb, 8 + extrabits, level);
+ else if(extrabits > 0)//== VC1 && s->qscale<=2
+ put_bits(&s->pb, extrabits, extquant);
+
+ if (level != 0) {
+ put_bits(&s->pb, 1, sign);
+ }
+ }
+}
+
+/* Encoding of a block. Very similar to MPEG4 except for a different
+ escape coding (same as H263) and more vlc tables.
+ */
+void ff_msmpeg4_encode_block(MpegEncContext * s, DCTELEM * block, int n)
+{
+ int level, run, last, i, j, last_index;
+ int last_non_zero, sign, slevel;
+ int code, run_diff, dc_pred_dir;
+ const RLTable *rl;
+ const uint8_t *scantable;
+
+ if (s->mb_intra) {
+ msmpeg4_encode_dc(s, block[0], n, &dc_pred_dir);
+ i = 1;
+ if (n < 4) {
+ rl = &ff_rl_table[s->rl_table_index];
+ } else {
+ rl = &ff_rl_table[3 + s->rl_chroma_table_index];
+ }
+ run_diff = s->msmpeg4_version>=4;
+ scantable= s->intra_scantable.permutated;
+ } else {
+ i = 0;
+ rl = &ff_rl_table[3 + s->rl_table_index];
+ if(s->msmpeg4_version<=2)
+ run_diff = 0;
+ else
+ run_diff = 1;
+ scantable= s->inter_scantable.permutated;
+ }
+
+ /* recalculate block_last_index for M$ wmv1 */
+ if(s->msmpeg4_version>=4 && s->msmpeg4_version<6 && s->block_last_index[n]>0){
+ for(last_index=63; last_index>=0; last_index--){
+ if(block[scantable[last_index]]) break;
+ }
+ s->block_last_index[n]= last_index;
+ }else
+ last_index = s->block_last_index[n];
+ /* AC coefs */
+ last_non_zero = i - 1;
+ for (; i <= last_index; i++) {
+ j = scantable[i];
+ level = block[j];
+ if (level) {
+ run = i - last_non_zero - 1;
+ last = (i == last_index);
+ sign = 0;
+ slevel = level;
+ if (level < 0) {
+ sign = 1;
+ level = -level;
+ }
+
+ if(level<=MAX_LEVEL && run<=MAX_RUN){
+ s->ac_stats[s->mb_intra][n>3][level][run][last]++;
+ }
+
+ s->ac_stats[s->mb_intra][n > 3][40][63][0]++; //esc3 like
+
+ code = get_rl_index(rl, last, run, level);
+ put_bits(&s->pb, rl->table_vlc[code][1], rl->table_vlc[code][0]);
+ if (code == rl->n) {
+ int level1, run1;
+
+ level1 = level - rl->max_level[last][run];
+ if (level1 < 1)
+ goto esc2;
+ code = get_rl_index(rl, last, run, level1);
+ if (code == rl->n) {
+ esc2:
+ put_bits(&s->pb, 1, 0);
+ if (level > MAX_LEVEL)
+ goto esc3;
+ run1 = run - rl->max_run[last][level] - run_diff;
+ if (run1 < 0)
+ goto esc3;
+ code = get_rl_index(rl, last, run1+1, level);
+ if (s->msmpeg4_version == 4 && code == rl->n)
+ goto esc3;
+ code = get_rl_index(rl, last, run1, level);
+ if (code == rl->n) {
+ esc3:
+ /* third escape */
+ put_bits(&s->pb, 1, 0);
+ put_bits(&s->pb, 1, last);
+ if(s->msmpeg4_version>=4){
+ if(s->esc3_level_length==0){
+ s->esc3_level_length=8;
+ s->esc3_run_length= 6;
+ //ESCLVLSZ + ESCRUNSZ
+ if(s->qscale<8)
+ put_bits(&s->pb, 6 + (s->msmpeg4_version>=6), 3);
+ else
+ put_bits(&s->pb, 8, 3);
+ }
+ put_bits(&s->pb, s->esc3_run_length, run);
+ put_bits(&s->pb, 1, sign);
+ put_bits(&s->pb, s->esc3_level_length, level);
+ }else{
+ put_bits(&s->pb, 6, run);
+ put_sbits(&s->pb, 8, slevel);
+ }
+ } else {
+ /* second escape */
+ put_bits(&s->pb, 1, 1);
+ put_bits(&s->pb, rl->table_vlc[code][1], rl->table_vlc[code][0]);
+ put_bits(&s->pb, 1, sign);
+ }
+ } else {
+ /* first escape */
+ put_bits(&s->pb, 1, 1);
+ put_bits(&s->pb, rl->table_vlc[code][1], rl->table_vlc[code][0]);
+ put_bits(&s->pb, 1, sign);
+ }
+ } else {
+ put_bits(&s->pb, 1, sign);
+ }
+ last_non_zero = i;
+ }
+ }
+}
diff --git a/gst-libs/ext/libav/libavcodec/msrle.c b/gst-libs/ext/libav/libavcodec/msrle.c
index f964392..7cd8823 100644
--- a/gst-libs/ext/libav/libavcodec/msrle.c
+++ b/gst-libs/ext/libav/libavcodec/msrle.c
@@ -56,10 +56,10 @@ static av_cold int msrle_decode_init(AVCodecContext *avctx)
switch (avctx->bits_per_coded_sample) {
case 4:
case 8:
- avctx->pix_fmt = PIX_FMT_PAL8;
+ avctx->pix_fmt = AV_PIX_FMT_PAL8;
break;
case 24:
- avctx->pix_fmt = PIX_FMT_BGR24;
+ avctx->pix_fmt = AV_PIX_FMT_BGR24;
break;
default:
av_log(avctx, AV_LOG_ERROR, "unsupported bits per sample\n");
@@ -72,7 +72,7 @@ static av_cold int msrle_decode_init(AVCodecContext *avctx)
}
static int msrle_decode_frame(AVCodecContext *avctx,
- void *data, int *data_size,
+ void *data, int *got_frame,
AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
@@ -128,7 +128,7 @@ static int msrle_decode_frame(AVCodecContext *avctx,
ff_msrle_decode(avctx, (AVPicture*)&s->frame, avctx->bits_per_coded_sample, &s->gb);
}
- *data_size = sizeof(AVFrame);
+ *got_frame = 1;
*(AVFrame*)data = s->frame;
/* report that the buffer was completely consumed */
@@ -149,11 +149,11 @@ static av_cold int msrle_decode_end(AVCodecContext *avctx)
AVCodec ff_msrle_decoder = {
.name = "msrle",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_MSRLE,
+ .id = AV_CODEC_ID_MSRLE,
.priv_data_size = sizeof(MsrleContext),
.init = msrle_decode_init,
.close = msrle_decode_end,
.decode = msrle_decode_frame,
.capabilities = CODEC_CAP_DR1,
- .long_name= NULL_IF_CONFIG_SMALL("Microsoft RLE"),
+ .long_name = NULL_IF_CONFIG_SMALL("Microsoft RLE"),
};
diff --git a/gst-libs/ext/libav/libavcodec/msrledec.c b/gst-libs/ext/libav/libavcodec/msrledec.c
index 821311b..af2a247 100644
--- a/gst-libs/ext/libav/libavcodec/msrledec.c
+++ b/gst-libs/ext/libav/libavcodec/msrledec.c
@@ -133,8 +133,8 @@ static int msrle_decode_8_16_24_32(AVCodecContext *avctx, AVPicture *pic,
{
uint8_t *output, *output_end;
int p1, p2, line=avctx->height - 1, pos=0, i;
- uint16_t av_uninit(pix16);
- uint32_t av_uninit(pix32);
+ uint16_t pix16;
+ uint32_t pix32;
unsigned int width= FFABS(pic->linesize[0]) / (depth >> 3);
output = pic->data[0] + (avctx->height - 1) * pic->linesize[0];
@@ -259,4 +259,3 @@ int ff_msrle_decode(AVCodecContext *avctx, AVPicture *pic,
return -1;
}
}
-
diff --git a/gst-libs/ext/libav/libavcodec/msrledec.h b/gst-libs/ext/libav/libavcodec/msrledec.h
index c167843..a594de3 100644
--- a/gst-libs/ext/libav/libavcodec/msrledec.h
+++ b/gst-libs/ext/libav/libavcodec/msrledec.h
@@ -37,4 +37,3 @@ int ff_msrle_decode(AVCodecContext *avctx, AVPicture *pic,
int depth, GetByteContext *gb);
#endif /* AVCODEC_MSRLEDEC_H */
-
diff --git a/gst-libs/ext/libav/libavcodec/mss1.c b/gst-libs/ext/libav/libavcodec/mss1.c
new file mode 100644
index 0000000..c9edb2e
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/mss1.c
@@ -0,0 +1,226 @@
+/*
+ * Microsoft Screen 1 (aka Windows Media Video V7 Screen) decoder
+ * Copyright (c) 2012 Konstantin Shishkov
+ *
+ * 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
+ * Microsoft Screen 1 (aka Windows Media Video V7 Screen) decoder
+ */
+
+#include "avcodec.h"
+#include "mss12.h"
+
+typedef struct MSS1Context {
+ MSS12Context ctx;
+ AVFrame pic;
+ SliceContext sc;
+} MSS1Context;
+
+static void arith_normalise(ArithCoder *c)
+{
+ for (;;) {
+ if (c->high >= 0x8000) {
+ if (c->low < 0x8000) {
+ if (c->low >= 0x4000 && c->high < 0xC000) {
+ c->value -= 0x4000;
+ c->low -= 0x4000;
+ c->high -= 0x4000;
+ } else {
+ return;
+ }
+ } else {
+ c->value -= 0x8000;
+ c->low -= 0x8000;
+ c->high -= 0x8000;
+ }
+ }
+ c->value <<= 1;
+ c->low <<= 1;
+ c->high <<= 1;
+ c->high |= 1;
+ c->value |= get_bits1(c->gbc.gb);
+ }
+}
+
+ARITH_GET_BIT()
+
+static int arith_get_bits(ArithCoder *c, int bits)
+{
+ int range = c->high - c->low + 1;
+ int val = (((c->value - c->low + 1) << bits) - 1) / range;
+ int prob = range * val;
+
+ c->high = ((prob + range) >> bits) + c->low - 1;
+ c->low += prob >> bits;
+
+ arith_normalise(c);
+
+ return val;
+}
+
+static int arith_get_number(ArithCoder *c, int mod_val)
+{
+ int range = c->high - c->low + 1;
+ int val = ((c->value - c->low + 1) * mod_val - 1) / range;
+ int prob = range * val;
+
+ c->high = (prob + range) / mod_val + c->low - 1;
+ c->low += prob / mod_val;
+
+ arith_normalise(c);
+
+ return val;
+}
+
+static int arith_get_prob(ArithCoder *c, int16_t *probs)
+{
+ int range = c->high - c->low + 1;
+ int val = ((c->value - c->low + 1) * probs[0] - 1) / range;
+ int sym = 1;
+
+ while (probs[sym] > val)
+ sym++;
+
+ c->high = range * probs[sym - 1] / probs[0] + c->low - 1;
+ c->low += range * probs[sym] / probs[0];
+
+ return sym;
+}
+
+ARITH_GET_MODEL_SYM()
+
+static void arith_init(ArithCoder *c, GetBitContext *gb)
+{
+ c->low = 0;
+ c->high = 0xFFFF;
+ c->value = get_bits(gb, 16);
+ c->gbc.gb = gb;
+ c->get_model_sym = arith_get_model_sym;
+ c->get_number = arith_get_number;
+}
+
+static int decode_pal(MSS12Context *ctx, ArithCoder *acoder)
+{
+ int i, ncol, r, g, b;
+ uint32_t *pal = ctx->pal + 256 - ctx->free_colours;
+
+ if (!ctx->free_colours)
+ return 0;
+
+ ncol = arith_get_number(acoder, ctx->free_colours + 1);
+ for (i = 0; i < ncol; i++) {
+ r = arith_get_bits(acoder, 8);
+ g = arith_get_bits(acoder, 8);
+ b = arith_get_bits(acoder, 8);
+ *pal++ = (r << 16) | (g << 8) | b;
+ }
+
+ return !!ncol;
+}
+
+static int mss1_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
+ AVPacket *avpkt)
+{
+ const uint8_t *buf = avpkt->data;
+ int buf_size = avpkt->size;
+ MSS1Context *ctx = avctx->priv_data;
+ MSS12Context *c = &ctx->ctx;
+ GetBitContext gb;
+ ArithCoder acoder;
+ int pal_changed = 0;
+ int ret;
+
+ init_get_bits(&gb, buf, buf_size * 8);
+ arith_init(&acoder, &gb);
+
+ ctx->pic.reference = 3;
+ ctx->pic.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_READABLE |
+ FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE;
+ if ((ret = avctx->reget_buffer(avctx, &ctx->pic)) < 0) {
+ av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n");
+ return ret;
+ }
+
+ c->pal_pic = ctx->pic.data[0] + ctx->pic.linesize[0] * (avctx->height - 1);
+ c->pal_stride = -ctx->pic.linesize[0];
+ c->keyframe = !arith_get_bit(&acoder);
+ if (c->keyframe) {
+ c->corrupted = 0;
+ ff_mss12_slicecontext_reset(&ctx->sc);
+ pal_changed = decode_pal(c, &acoder);
+ ctx->pic.key_frame = 1;
+ ctx->pic.pict_type = AV_PICTURE_TYPE_I;
+ } else {
+ if (c->corrupted)
+ return AVERROR_INVALIDDATA;
+ ctx->pic.key_frame = 0;
+ ctx->pic.pict_type = AV_PICTURE_TYPE_P;
+ }
+ c->corrupted = ff_mss12_decode_rect(&ctx->sc, &acoder, 0, 0,
+ avctx->width, avctx->height);
+ if (c->corrupted)
+ return AVERROR_INVALIDDATA;
+ memcpy(ctx->pic.data[1], c->pal, AVPALETTE_SIZE);
+ ctx->pic.palette_has_changed = pal_changed;
+
+ *got_frame = 1;
+ *(AVFrame*)data = ctx->pic;
+
+ /* always report that the buffer was completely consumed */
+ return buf_size;
+}
+
+static av_cold int mss1_decode_init(AVCodecContext *avctx)
+{
+ MSS1Context * const c = avctx->priv_data;
+ int ret;
+
+ c->ctx.avctx = avctx;
+ avctx->coded_frame = &c->pic;
+
+ ret = ff_mss12_decode_init(&c->ctx, 0, &c->sc, NULL);
+
+ avctx->pix_fmt = AV_PIX_FMT_PAL8;
+
+ return ret;
+}
+
+static av_cold int mss1_decode_end(AVCodecContext *avctx)
+{
+ MSS1Context * const ctx = avctx->priv_data;
+
+ if (ctx->pic.data[0])
+ avctx->release_buffer(avctx, &ctx->pic);
+ ff_mss12_decode_end(&ctx->ctx);
+
+ return 0;
+}
+
+AVCodec ff_mss1_decoder = {
+ .name = "mss1",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .id = AV_CODEC_ID_MSS1,
+ .priv_data_size = sizeof(MSS1Context),
+ .init = mss1_decode_init,
+ .close = mss1_decode_end,
+ .decode = mss1_decode_frame,
+ .capabilities = CODEC_CAP_DR1,
+ .long_name = NULL_IF_CONFIG_SMALL("MS Screen 1"),
+};
diff --git a/gst-libs/ext/libav/libavcodec/mss12.c b/gst-libs/ext/libav/libavcodec/mss12.c
new file mode 100644
index 0000000..3601978
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/mss12.c
@@ -0,0 +1,674 @@
+/*
+ * Copyright (c) 2012 Konstantin Shishkov
+ *
+ * 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
+ * Common functions for Microsoft Screen 1 and 2
+ */
+
+#include "libavutil/intfloat.h"
+#include "libavutil/intreadwrite.h"
+#include "avcodec.h"
+#include "mss12.h"
+
+enum SplitMode {
+ SPLIT_VERT = 0,
+ SPLIT_HOR,
+ SPLIT_NONE
+};
+
+static const int sec_order_sizes[4] = { 1, 7, 6, 1 };
+
+enum ContextDirection {
+ TOP_LEFT = 0,
+ TOP,
+ TOP_RIGHT,
+ LEFT
+};
+
+static int model_calc_threshold(Model *m)
+{
+ int thr;
+
+ thr = 2 * m->weights[m->num_syms] - 1;
+ thr = ((thr >> 1) + 4 * m->cum_prob[0]) / thr;
+
+ return FFMIN(thr, 0x3FFF);
+}
+
+static void model_reset(Model *m)
+{
+ int i;
+
+ for (i = 0; i <= m->num_syms; i++) {
+ m->weights[i] = 1;
+ m->cum_prob[i] = m->num_syms - i;
+ }
+ m->weights[0] = 0;
+ for (i = 0; i < m->num_syms; i++)
+ m->idx2sym[i + 1] = i;
+}
+
+static av_cold void model_init(Model *m, int num_syms, int thr_weight)
+{
+ m->num_syms = num_syms;
+ m->thr_weight = thr_weight;
+ m->threshold = num_syms * thr_weight;
+}
+
+static void model_rescale_weights(Model *m)
+{
+ int i;
+ int cum_prob;
+
+ if (m->thr_weight == THRESH_ADAPTIVE)
+ m->threshold = model_calc_threshold(m);
+ while (m->cum_prob[0] > m->threshold) {
+ cum_prob = 0;
+ for (i = m->num_syms; i >= 0; i--) {
+ m->cum_prob[i] = cum_prob;
+ m->weights[i] = (m->weights[i] + 1) >> 1;
+ cum_prob += m->weights[i];
+ }
+ }
+}
+
+void ff_mss12_model_update(Model *m, int val)
+{
+ int i;
+
+ if (m->weights[val] == m->weights[val - 1]) {
+ for (i = val; m->weights[i - 1] == m->weights[val]; i--);
+ if (i != val) {
+ int sym1, sym2;
+
+ sym1 = m->idx2sym[val];
+ sym2 = m->idx2sym[i];
+
+ m->idx2sym[val] = sym2;
+ m->idx2sym[i] = sym1;
+
+ val = i;
+ }
+ }
+ m->weights[val]++;
+ for (i = val - 1; i >= 0; i--)
+ m->cum_prob[i]++;
+ model_rescale_weights(m);
+}
+
+static void pixctx_reset(PixContext *ctx)
+{
+ int i, j;
+
+ if (!ctx->special_initial_cache)
+ for (i = 0; i < ctx->cache_size; i++)
+ ctx->cache[i] = i;
+ else {
+ ctx->cache[0] = 1;
+ ctx->cache[1] = 2;
+ ctx->cache[2] = 4;
+ }
+
+ model_reset(&ctx->cache_model);
+ model_reset(&ctx->full_model);
+
+ for (i = 0; i < 15; i++)
+ for (j = 0; j < 4; j++)
+ model_reset(&ctx->sec_models[i][j]);
+}
+
+static av_cold void pixctx_init(PixContext *ctx, int cache_size,
+ int full_model_syms, int special_initial_cache)
+{
+ int i, j, k, idx;
+
+ ctx->cache_size = cache_size + 4;
+ ctx->num_syms = cache_size;
+ ctx->special_initial_cache = special_initial_cache;
+
+ model_init(&ctx->cache_model, ctx->num_syms + 1, THRESH_LOW);
+ model_init(&ctx->full_model, full_model_syms, THRESH_HIGH);
+
+ for (i = 0, idx = 0; i < 4; i++)
+ for (j = 0; j < sec_order_sizes[i]; j++, idx++)
+ for (k = 0; k < 4; k++)
+ model_init(&ctx->sec_models[idx][k], 2 + i,
+ i ? THRESH_LOW : THRESH_ADAPTIVE);
+}
+
+static av_always_inline int decode_pixel(ArithCoder *acoder, PixContext *pctx,
+ uint8_t *ngb, int num_ngb, int any_ngb)
+{
+ int i, val, pix;
+
+ val = acoder->get_model_sym(acoder, &pctx->cache_model);
+ if (val < pctx->num_syms) {
+ if (any_ngb) {
+ int idx, j;
+
+ idx = 0;
+ for (i = 0; i < pctx->cache_size; i++) {
+ for (j = 0; j < num_ngb; j++)
+ if (pctx->cache[i] == ngb[j])
+ break;
+ if (j == num_ngb) {
+ if (idx == val)
+ break;
+ idx++;
+ }
+ }
+ val = FFMIN(i, pctx->cache_size - 1);
+ }
+ pix = pctx->cache[val];
+ } else {
+ pix = acoder->get_model_sym(acoder, &pctx->full_model);
+ for (i = 0; i < pctx->cache_size - 1; i++)
+ if (pctx->cache[i] == pix)
+ break;
+ val = i;
+ }
+ if (val) {
+ for (i = val; i > 0; i--)
+ pctx->cache[i] = pctx->cache[i - 1];
+ pctx->cache[0] = pix;
+ }
+
+ return pix;
+}
+
+static int decode_pixel_in_context(ArithCoder *acoder, PixContext *pctx,
+ uint8_t *src, int stride, int x, int y,
+ int has_right)
+{
+ uint8_t neighbours[4];
+ uint8_t ref_pix[4];
+ int nlen;
+ int layer = 0, sub;
+ int pix;
+ int i, j;
+
+ if (!y) {
+ memset(neighbours, src[-1], 4);
+ } else {
+ neighbours[TOP] = src[-stride];
+ if (!x) {
+ neighbours[TOP_LEFT] = neighbours[LEFT] = neighbours[TOP];
+ } else {
+ neighbours[TOP_LEFT] = src[-stride - 1];
+ neighbours[ LEFT] = src[-1];
+ }
+ if (has_right)
+ neighbours[TOP_RIGHT] = src[-stride + 1];
+ else
+ neighbours[TOP_RIGHT] = neighbours[TOP];
+ }
+
+ sub = 0;
+ if (x >= 2 && src[-2] == neighbours[LEFT])
+ sub = 1;
+ if (y >= 2 && src[-2 * stride] == neighbours[TOP])
+ sub |= 2;
+
+ nlen = 1;
+ ref_pix[0] = neighbours[0];
+ for (i = 1; i < 4; i++) {
+ for (j = 0; j < nlen; j++)
+ if (ref_pix[j] == neighbours[i])
+ break;
+ if (j == nlen)
+ ref_pix[nlen++] = neighbours[i];
+ }
+
+ switch (nlen) {
+ case 1:
+ layer = 0;
+ break;
+ case 2:
+ if (neighbours[TOP] == neighbours[TOP_LEFT]) {
+ if (neighbours[TOP_RIGHT] == neighbours[TOP_LEFT])
+ layer = 1;
+ else if (neighbours[LEFT] == neighbours[TOP_LEFT])
+ layer = 2;
+ else
+ layer = 3;
+ } else if (neighbours[TOP_RIGHT] == neighbours[TOP_LEFT]) {
+ if (neighbours[LEFT] == neighbours[TOP_LEFT])
+ layer = 4;
+ else
+ layer = 5;
+ } else if (neighbours[LEFT] == neighbours[TOP_LEFT]) {
+ layer = 6;
+ } else {
+ layer = 7;
+ }
+ break;
+ case 3:
+ if (neighbours[TOP] == neighbours[TOP_LEFT])
+ layer = 8;
+ else if (neighbours[TOP_RIGHT] == neighbours[TOP_LEFT])
+ layer = 9;
+ else if (neighbours[LEFT] == neighbours[TOP_LEFT])
+ layer = 10;
+ else if (neighbours[TOP_RIGHT] == neighbours[TOP])
+ layer = 11;
+ else if (neighbours[TOP] == neighbours[LEFT])
+ layer = 12;
+ else
+ layer = 13;
+ break;
+ case 4:
+ layer = 14;
+ break;
+ }
+
+ pix = acoder->get_model_sym(acoder,
+ &pctx->sec_models[layer][sub]);
+ if (pix < nlen)
+ return ref_pix[pix];
+ else
+ return decode_pixel(acoder, pctx, ref_pix, nlen, 1);
+}
+
+static int decode_region(ArithCoder *acoder, uint8_t *dst, uint8_t *rgb_pic,
+ int x, int y, int width, int height, int stride,
+ int rgb_stride, PixContext *pctx, const uint32_t *pal)
+{
+ int i, j, p;
+ uint8_t *rgb_dst = rgb_pic + x * 3 + y * rgb_stride;
+
+ dst += x + y * stride;
+
+ for (j = 0; j < height; j++) {
+ for (i = 0; i < width; i++) {
+ if (!i && !j)
+ p = decode_pixel(acoder, pctx, NULL, 0, 0);
+ else
+ p = decode_pixel_in_context(acoder, pctx, dst + i, stride,
+ i, j, width - i - 1);
+ dst[i] = p;
+
+ if (rgb_pic)
+ AV_WB24(rgb_dst + i * 3, pal[p]);
+ }
+ dst += stride;
+ rgb_dst += rgb_stride;
+ }
+
+ return 0;
+}
+
+static void copy_rectangles(MSS12Context const *c,
+ int x, int y, int width, int height)
+{
+ int j;
+
+ if (c->last_rgb_pic)
+ for (j = y; j < y + height; j++) {
+ memcpy(c->rgb_pic + j * c->rgb_stride + x * 3,
+ c->last_rgb_pic + j * c->rgb_stride + x * 3,
+ width * 3);
+ memcpy(c->pal_pic + j * c->pal_stride + x,
+ c->last_pal_pic + j * c->pal_stride + x,
+ width);
+ }
+}
+
+static int motion_compensation(MSS12Context const *c,
+ int x, int y, int width, int height)
+{
+ if (x + c->mvX < 0 || x + c->mvX + width > c->avctx->width ||
+ y + c->mvY < 0 || y + c->mvY + height > c->avctx->height ||
+ !c->rgb_pic)
+ return -1;
+ else {
+ uint8_t *dst = c->pal_pic + x + y * c->pal_stride;
+ uint8_t *rgb_dst = c->rgb_pic + x * 3 + y * c->rgb_stride;
+ uint8_t *src;
+ uint8_t *rgb_src;
+ int j;
+ x += c->mvX;
+ y += c->mvY;
+ if (c->last_rgb_pic) {
+ src = c->last_pal_pic + x + y * c->pal_stride;
+ rgb_src = c->last_rgb_pic + x * 3 + y * c->rgb_stride;
+ } else {
+ src = c->pal_pic + x + y * c->pal_stride;
+ rgb_src = c->rgb_pic + x * 3 + y * c->rgb_stride;
+ }
+ for (j = 0; j < height; j++) {
+ memmove(dst, src, width);
+ memmove(rgb_dst, rgb_src, width * 3);
+ dst += c->pal_stride;
+ src += c->pal_stride;
+ rgb_dst += c->rgb_stride;
+ rgb_src += c->rgb_stride;
+ }
+ }
+ return 0;
+}
+
+static int decode_region_masked(MSS12Context const *c, ArithCoder *acoder,
+ uint8_t *dst, int stride, uint8_t *mask,
+ int mask_stride, int x, int y,
+ int width, int height,
+ PixContext *pctx)
+{
+ int i, j, p;
+ uint8_t *rgb_dst = c->rgb_pic + x * 3 + y * c->rgb_stride;
+
+ dst += x + y * stride;
+ mask += x + y * mask_stride;
+
+ for (j = 0; j < height; j++) {
+ for (i = 0; i < width; i++) {
+ if (c->avctx->err_recognition & AV_EF_EXPLODE &&
+ ( c->rgb_pic && mask[i] != 0x01 && mask[i] != 0x02 && mask[i] != 0x04 ||
+ !c->rgb_pic && mask[i] != 0x80 && mask[i] != 0xFF))
+ return -1;
+
+ if (mask[i] == 0x02) {
+ copy_rectangles(c, x + i, y + j, 1, 1);
+ } else if (mask[i] == 0x04) {
+ if (motion_compensation(c, x + i, y + j, 1, 1))
+ return -1;
+ } else if (mask[i] != 0x80) {
+ if (!i && !j)
+ p = decode_pixel(acoder, pctx, NULL, 0, 0);
+ else
+ p = decode_pixel_in_context(acoder, pctx, dst + i, stride,
+ i, j, width - i - 1);
+ dst[i] = p;
+ if (c->rgb_pic)
+ AV_WB24(rgb_dst + i * 3, c->pal[p]);
+ }
+ }
+ dst += stride;
+ mask += mask_stride;
+ rgb_dst += c->rgb_stride;
+ }
+
+ return 0;
+}
+
+static av_cold void slicecontext_init(SliceContext *sc,
+ int version, int full_model_syms)
+{
+ model_init(&sc->intra_region, 2, THRESH_ADAPTIVE);
+ model_init(&sc->inter_region, 2, THRESH_ADAPTIVE);
+ model_init(&sc->split_mode, 3, THRESH_HIGH);
+ model_init(&sc->edge_mode, 2, THRESH_HIGH);
+ model_init(&sc->pivot, 3, THRESH_LOW);
+
+ pixctx_init(&sc->intra_pix_ctx, 8, full_model_syms, 0);
+
+ pixctx_init(&sc->inter_pix_ctx, version ? 3 : 2,
+ full_model_syms, version ? 1 : 0);
+}
+
+void ff_mss12_slicecontext_reset(SliceContext *sc)
+{
+ model_reset(&sc->intra_region);
+ model_reset(&sc->inter_region);
+ model_reset(&sc->split_mode);
+ model_reset(&sc->edge_mode);
+ model_reset(&sc->pivot);
+ pixctx_reset(&sc->intra_pix_ctx);
+ pixctx_reset(&sc->inter_pix_ctx);
+}
+
+static int decode_pivot(SliceContext *sc, ArithCoder *acoder, int base)
+{
+ int val, inv;
+
+ inv = acoder->get_model_sym(acoder, &sc->edge_mode);
+ val = acoder->get_model_sym(acoder, &sc->pivot) + 1;
+
+ if (val > 2) {
+ if ((base + 1) / 2 - 2 <= 0)
+ return -1;
+
+ val = acoder->get_number(acoder, (base + 1) / 2 - 2) + 3;
+ }
+
+ if (val >= base)
+ return -1;
+
+ return inv ? base - val : val;
+}
+
+static int decode_region_intra(SliceContext *sc, ArithCoder *acoder,
+ int x, int y, int width, int height)
+{
+ MSS12Context const *c = sc->c;
+ int mode;
+
+ mode = acoder->get_model_sym(acoder, &sc->intra_region);
+
+ if (!mode) {
+ int i, j, pix, rgb_pix;
+ int stride = c->pal_stride;
+ int rgb_stride = c->rgb_stride;
+ uint8_t *dst = c->pal_pic + x + y * stride;
+ uint8_t *rgb_dst = c->rgb_pic + x * 3 + y * rgb_stride;
+
+ pix = decode_pixel(acoder, &sc->intra_pix_ctx, NULL, 0, 0);
+ rgb_pix = c->pal[pix];
+ for (i = 0; i < height; i++, dst += stride, rgb_dst += rgb_stride) {
+ memset(dst, pix, width);
+ if (c->rgb_pic)
+ for (j = 0; j < width * 3; j += 3)
+ AV_WB24(rgb_dst + j, rgb_pix);
+ }
+ } else {
+ return decode_region(acoder, c->pal_pic, c->rgb_pic,
+ x, y, width, height, c->pal_stride, c->rgb_stride,
+ &sc->intra_pix_ctx, &c->pal[0]);
+ }
+
+ return 0;
+}
+
+static int decode_region_inter(SliceContext *sc, ArithCoder *acoder,
+ int x, int y, int width, int height)
+{
+ MSS12Context const *c = sc->c;
+ int mode;
+
+ mode = acoder->get_model_sym(acoder, &sc->inter_region);
+
+ if (!mode) {
+ mode = decode_pixel(acoder, &sc->inter_pix_ctx, NULL, 0, 0);
+
+ if (c->avctx->err_recognition & AV_EF_EXPLODE &&
+ ( c->rgb_pic && mode != 0x01 && mode != 0x02 && mode != 0x04 ||
+ !c->rgb_pic && mode != 0x80 && mode != 0xFF))
+ return -1;
+
+ if (mode == 0x02)
+ copy_rectangles(c, x, y, width, height);
+ else if (mode == 0x04)
+ return motion_compensation(c, x, y, width, height);
+ else if (mode != 0x80)
+ return decode_region_intra(sc, acoder, x, y, width, height);
+ } else {
+ if (decode_region(acoder, c->mask, NULL,
+ x, y, width, height, c->mask_stride, 0,
+ &sc->inter_pix_ctx, &c->pal[0]) < 0)
+ return -1;
+ return decode_region_masked(c, acoder, c->pal_pic,
+ c->pal_stride, c->mask,
+ c->mask_stride,
+ x, y, width, height,
+ &sc->intra_pix_ctx);
+ }
+
+ return 0;
+}
+
+int ff_mss12_decode_rect(SliceContext *sc, ArithCoder *acoder,
+ int x, int y, int width, int height)
+{
+ int mode, pivot;
+
+ mode = acoder->get_model_sym(acoder, &sc->split_mode);
+
+ switch (mode) {
+ case SPLIT_VERT:
+ if ((pivot = decode_pivot(sc, acoder, height)) < 1)
+ return -1;
+ if (ff_mss12_decode_rect(sc, acoder, x, y, width, pivot))
+ return -1;
+ if (ff_mss12_decode_rect(sc, acoder, x, y + pivot, width, height - pivot))
+ return -1;
+ break;
+ case SPLIT_HOR:
+ if ((pivot = decode_pivot(sc, acoder, width)) < 1)
+ return -1;
+ if (ff_mss12_decode_rect(sc, acoder, x, y, pivot, height))
+ return -1;
+ if (ff_mss12_decode_rect(sc, acoder, x + pivot, y, width - pivot, height))
+ return -1;
+ break;
+ case SPLIT_NONE:
+ if (sc->c->keyframe)
+ return decode_region_intra(sc, acoder, x, y, width, height);
+ else
+ return decode_region_inter(sc, acoder, x, y, width, height);
+ default:
+ return -1;
+ }
+
+ return 0;
+}
+
+av_cold int ff_mss12_decode_init(MSS12Context *c, int version,
+ SliceContext* sc1, SliceContext *sc2)
+{
+ AVCodecContext *avctx = c->avctx;
+ int i;
+
+ if (avctx->extradata_size < 52 + 256 * 3) {
+ av_log(avctx, AV_LOG_ERROR, "Insufficient extradata size %d\n",
+ avctx->extradata_size);
+ return AVERROR_INVALIDDATA;
+ }
+
+ if (AV_RB32(avctx->extradata) < avctx->extradata_size) {
+ av_log(avctx, AV_LOG_ERROR,
+ "Insufficient extradata size: expected %d got %d\n",
+ AV_RB32(avctx->extradata),
+ avctx->extradata_size);
+ return AVERROR_INVALIDDATA;
+ }
+
+ avctx->coded_width = AV_RB32(avctx->extradata + 20);
+ avctx->coded_height = AV_RB32(avctx->extradata + 24);
+ if (avctx->coded_width > 4096 || avctx->coded_height > 4096) {
+ av_log(avctx, AV_LOG_ERROR, "Frame dimensions %dx%d too large",
+ avctx->coded_width, avctx->coded_height);
+ return AVERROR_INVALIDDATA;
+ }
+
+ av_log(avctx, AV_LOG_DEBUG, "Encoder version %d.%d\n",
+ AV_RB32(avctx->extradata + 4), AV_RB32(avctx->extradata + 8));
+ if (version != AV_RB32(avctx->extradata + 4) > 1) {
+ av_log(avctx, AV_LOG_ERROR,
+ "Header version doesn't match codec tag\n");
+ return -1;
+ }
+
+ c->free_colours = AV_RB32(avctx->extradata + 48);
+ if ((unsigned)c->free_colours > 256) {
+ av_log(avctx, AV_LOG_ERROR,
+ "Incorrect number of changeable palette entries: %d\n",
+ c->free_colours);
+ return AVERROR_INVALIDDATA;
+ }
+ av_log(avctx, AV_LOG_DEBUG, "%d free colour(s)\n", c->free_colours);
+
+ av_log(avctx, AV_LOG_DEBUG, "Display dimensions %dx%d\n",
+ AV_RB32(avctx->extradata + 12), AV_RB32(avctx->extradata + 16));
+ av_log(avctx, AV_LOG_DEBUG, "Coded dimensions %dx%d\n",
+ avctx->coded_width, avctx->coded_height);
+ av_log(avctx, AV_LOG_DEBUG, "%g frames per second\n",
+ av_int2float(AV_RB32(avctx->extradata + 28)));
+ av_log(avctx, AV_LOG_DEBUG, "Bitrate %d bps\n",
+ AV_RB32(avctx->extradata + 32));
+ av_log(avctx, AV_LOG_DEBUG, "Max. lead time %g ms\n",
+ av_int2float(AV_RB32(avctx->extradata + 36)));
+ av_log(avctx, AV_LOG_DEBUG, "Max. lag time %g ms\n",
+ av_int2float(AV_RB32(avctx->extradata + 40)));
+ av_log(avctx, AV_LOG_DEBUG, "Max. seek time %g ms\n",
+ av_int2float(AV_RB32(avctx->extradata + 44)));
+
+ if (version) {
+ if (avctx->extradata_size < 60 + 256 * 3) {
+ av_log(avctx, AV_LOG_ERROR,
+ "Insufficient extradata size %d for v2\n",
+ avctx->extradata_size);
+ return AVERROR_INVALIDDATA;
+ }
+
+ c->slice_split = AV_RB32(avctx->extradata + 52);
+ av_log(avctx, AV_LOG_DEBUG, "Slice split %d\n", c->slice_split);
+
+ c->full_model_syms = AV_RB32(avctx->extradata + 56);
+ if (c->full_model_syms < 2 || c->full_model_syms > 256) {
+ av_log(avctx, AV_LOG_ERROR,
+ "Incorrect number of used colours %d\n",
+ c->full_model_syms);
+ return AVERROR_INVALIDDATA;
+ }
+ av_log(avctx, AV_LOG_DEBUG, "Used colours %d\n",
+ c->full_model_syms);
+ } else {
+ c->slice_split = 0;
+ c->full_model_syms = 256;
+ }
+
+ for (i = 0; i < 256; i++)
+ c->pal[i] = AV_RB24(avctx->extradata + 52 +
+ (version ? 8 : 0) + i * 3);
+
+ c->mask_stride = FFALIGN(avctx->width, 16);
+ c->mask = av_malloc(c->mask_stride * avctx->height);
+ if (!c->mask) {
+ av_log(avctx, AV_LOG_ERROR, "Cannot allocate mask plane\n");
+ return AVERROR(ENOMEM);
+ }
+
+ sc1->c = c;
+ slicecontext_init(sc1, version, c->full_model_syms);
+ if (c->slice_split) {
+ sc2->c = c;
+ slicecontext_init(sc2, version, c->full_model_syms);
+ }
+ c->corrupted = 1;
+
+ return 0;
+}
+
+av_cold int ff_mss12_decode_end(MSS12Context *c)
+{
+ av_freep(&c->mask);
+
+ return 0;
+}
diff --git a/gst-libs/ext/libav/libavcodec/mss12.h b/gst-libs/ext/libav/libavcodec/mss12.h
new file mode 100644
index 0000000..f5d0366
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/mss12.h
@@ -0,0 +1,133 @@
+/*
+ * Copyright (c) 2012 Konstantin Shishkov
+ *
+ * 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
+ * Common header for Microsoft Screen 1 and 2
+ */
+
+#ifndef AVCODEC_MSS12_H
+#define AVCODEC_MSS12_H
+
+#include "libavutil/intreadwrite.h"
+#include "avcodec.h"
+#include "get_bits.h"
+#include "bytestream.h"
+
+#define MODEL_MIN_SYMS 2
+#define MODEL_MAX_SYMS 256
+#define THRESH_ADAPTIVE -1
+#define THRESH_LOW 15
+#define THRESH_HIGH 50
+
+typedef struct Model {
+ int16_t cum_prob[MODEL_MAX_SYMS + 1];
+ int16_t weights[MODEL_MAX_SYMS + 1];
+ uint8_t idx2sym[MODEL_MAX_SYMS + 1];
+ int num_syms;
+ int thr_weight, threshold;
+} Model;
+
+typedef struct ArithCoder {
+ int low, high, value;
+ union {
+ GetBitContext *gb;
+ GetByteContext *gB;
+ } gbc;
+ int (*get_model_sym)(struct ArithCoder *c, Model *m);
+ int (*get_number) (struct ArithCoder *c, int n);
+} ArithCoder;
+
+typedef struct PixContext {
+ int cache_size, num_syms;
+ uint8_t cache[12];
+ Model cache_model, full_model;
+ Model sec_models[15][4];
+ int special_initial_cache;
+} PixContext;
+
+struct MSS12Context;
+
+typedef struct SliceContext {
+ struct MSS12Context *c;
+ Model intra_region, inter_region;
+ Model pivot, edge_mode, split_mode;
+ PixContext intra_pix_ctx, inter_pix_ctx;
+} SliceContext;
+
+typedef struct MSS12Context {
+ AVCodecContext *avctx;
+ uint32_t pal[256];
+ uint8_t *pal_pic;
+ uint8_t *last_pal_pic;
+ int pal_stride;
+ uint8_t *mask;
+ int mask_stride;
+ uint8_t *rgb_pic;
+ uint8_t *last_rgb_pic;
+ int rgb_stride;
+ int free_colours;
+ int keyframe;
+ int mvX, mvY;
+ int corrupted;
+ int slice_split;
+ int full_model_syms;
+} MSS12Context;
+
+int ff_mss12_decode_rect(SliceContext *ctx, ArithCoder *acoder,
+ int x, int y, int width, int height);
+void ff_mss12_model_update(Model *m, int val);
+void ff_mss12_slicecontext_reset(SliceContext *sc);
+av_cold int ff_mss12_decode_init(MSS12Context *c, int version,
+ SliceContext* sc1, SliceContext *sc2);
+av_cold int ff_mss12_decode_end(MSS12Context *ctx);
+
+#define ARITH_GET_BIT(VERSION) \
+static int arith ## VERSION ## _get_bit(ArithCoder *c) \
+{ \
+ int range = c->high - c->low + 1; \
+ int bit = 2 * c->value - c->low >= c->high; \
+ \
+ if (bit) \
+ c->low += range >> 1; \
+ else \
+ c->high = c->low + (range >> 1) - 1; \
+ \
+ arith ## VERSION ## _normalise(c); \
+ \
+ return bit; \
+}
+
+#define ARITH_GET_MODEL_SYM(VERSION) \
+static int arith ## VERSION ## _get_model_sym(ArithCoder *c, Model *m) \
+{ \
+ int idx, val; \
+ \
+ idx = arith ## VERSION ## _get_prob(c, m->cum_prob); \
+ \
+ val = m->idx2sym[idx]; \
+ ff_mss12_model_update(m, idx); \
+ \
+ arith ## VERSION ## _normalise(c); \
+ \
+ return val; \
+}
+
+#endif /* AVCODEC_MSS12_H */
diff --git a/gst-libs/ext/libav/libavcodec/mss2.c b/gst-libs/ext/libav/libavcodec/mss2.c
new file mode 100644
index 0000000..9746335
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/mss2.c
@@ -0,0 +1,871 @@
+/*
+ * Microsoft Screen 2 (aka Windows Media Video V9 Screen) decoder
+ *
+ * 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
+ * Microsoft Screen 2 (aka Windows Media Video V9 Screen) decoder
+ */
+
+#include "libavutil/avassert.h"
+#include "internal.h"
+#include "msmpeg4data.h"
+#include "vc1.h"
+#include "mss12.h"
+#include "mss2dsp.h"
+
+typedef struct MSS2Context {
+ VC1Context v;
+ int split_position;
+ AVFrame pic;
+ AVFrame last_pic;
+ MSS12Context c;
+ MSS2DSPContext dsp;
+ SliceContext sc[2];
+} MSS2Context;
+
+static void arith2_normalise(ArithCoder *c)
+{
+ while ((c->high >> 15) - (c->low >> 15) < 2) {
+ if ((c->low ^ c->high) & 0x10000) {
+ c->high ^= 0x8000;
+ c->value ^= 0x8000;
+ c->low ^= 0x8000;
+ }
+ c->high = c->high << 8 & 0xFFFFFF | 0xFF;
+ c->value = c->value << 8 & 0xFFFFFF | bytestream2_get_byte(c->gbc.gB);
+ c->low = c->low << 8 & 0xFFFFFF;
+ }
+}
+
+ARITH_GET_BIT(2)
+
+/* L. Stuiver and A. Moffat: "Piecewise Integer Mapping for Arithmetic Coding."
+ * In Proc. 8th Data Compression Conference (DCC '98), pp. 3-12, Mar. 1998 */
+
+static int arith2_get_scaled_value(int value, int n, int range)
+{
+ int split = (n << 1) - range;
+
+ if (value > split)
+ return split + (value - split >> 1);
+ else
+ return value;
+}
+
+static void arith2_rescale_interval(ArithCoder *c, int range,
+ int low, int high, int n)
+{
+ int split = (n << 1) - range;
+
+ if (high > split)
+ c->high = split + (high - split << 1);
+ else
+ c->high = high;
+
+ c->high += c->low - 1;
+
+ if (low > split)
+ c->low += split + (low - split << 1);
+ else
+ c->low += low;
+}
+
+static int arith2_get_number(ArithCoder *c, int n)
+{
+ int range = c->high - c->low + 1;
+ int scale = av_log2(range) - av_log2(n);
+ int val;
+
+ if (n << scale > range)
+ scale--;
+
+ n <<= scale;
+
+ val = arith2_get_scaled_value(c->value - c->low, n, range) >> scale;
+
+ arith2_rescale_interval(c, range, val << scale, (val + 1) << scale, n);
+
+ arith2_normalise(c);
+
+ return val;
+}
+
+static int arith2_get_prob(ArithCoder *c, int16_t *probs)
+{
+ int range = c->high - c->low + 1, n = *probs;
+ int scale = av_log2(range) - av_log2(n);
+ int i = 0, val;
+
+ if (n << scale > range)
+ scale--;
+
+ n <<= scale;
+
+ val = arith2_get_scaled_value(c->value - c->low, n, range) >> scale;
+ while (probs[++i] > val) ;
+
+ arith2_rescale_interval(c, range,
+ probs[i] << scale, probs[i - 1] << scale, n);
+
+ return i;
+}
+
+ARITH_GET_MODEL_SYM(2)
+
+static int arith2_get_consumed_bytes(ArithCoder *c)
+{
+ int diff = (c->high >> 16) - (c->low >> 16);
+ int bp = bytestream2_tell(c->gbc.gB) - 3 << 3;
+ int bits = 1;
+
+ while (!(diff & 0x80)) {
+ bits++;
+ diff <<= 1;
+ }
+
+ return (bits + bp + 7 >> 3) + ((c->low >> 16) + 1 == c->high >> 16);
+}
+
+static void arith2_init(ArithCoder *c, GetByteContext *gB)
+{
+ c->low = 0;
+ c->high = 0xFFFFFF;
+ c->value = bytestream2_get_be24(gB);
+ c->gbc.gB = gB;
+ c->get_model_sym = arith2_get_model_sym;
+ c->get_number = arith2_get_number;
+}
+
+static int decode_pal_v2(MSS12Context *ctx, const uint8_t *buf, int buf_size)
+{
+ int i, ncol;
+ uint32_t *pal = ctx->pal + 256 - ctx->free_colours;
+
+ if (!ctx->free_colours)
+ return 0;
+
+ ncol = *buf++;
+ if (ncol > ctx->free_colours || buf_size < 2 + ncol * 3)
+ return -1;
+ for (i = 0; i < ncol; i++)
+ *pal++ = AV_RB24(buf + 3 * i);
+
+ return 1 + ncol * 3;
+}
+
+static int decode_555(GetByteContext *gB, uint16_t *dst, int stride,
+ int keyframe, int w, int h)
+{
+ int last_symbol = 0, repeat = 0, prev_avail = 0;
+
+ if (!keyframe) {
+ int x, y, endx, endy, t;
+
+#define READ_PAIR(a, b) \
+ a = bytestream2_get_byte(gB) << 4; \
+ t = bytestream2_get_byte(gB); \
+ a |= t >> 4; \
+ b = (t & 0xF) << 8; \
+ b |= bytestream2_get_byte(gB); \
+
+ READ_PAIR(x, endx)
+ READ_PAIR(y, endy)
+
+ if (endx >= w || endy >= h || x > endx || y > endy)
+ return -1;
+ dst += x + stride * y;
+ w = endx - x + 1;
+ h = endy - y + 1;
+ if (y)
+ prev_avail = 1;
+ }
+
+ do {
+ uint16_t *p = dst;
+ do {
+ if (repeat-- < 1) {
+ int b = bytestream2_get_byte(gB);
+ if (b < 128)
+ last_symbol = b << 8 | bytestream2_get_byte(gB);
+ else if (b > 129) {
+ repeat = 0;
+ while (b-- > 130)
+ repeat = (repeat << 8) + bytestream2_get_byte(gB) + 1;
+ if (last_symbol == -2) {
+ int skip = FFMIN((unsigned)repeat, dst + w - p);
+ repeat -= skip;
+ p += skip;
+ }
+ } else
+ last_symbol = 127 - b;
+ }
+ if (last_symbol >= 0)
+ *p = last_symbol;
+ else if (last_symbol == -1 && prev_avail)
+ *p = *(p - stride);
+ } while (++p < dst + w);
+ dst += stride;
+ prev_avail = 1;
+ } while (--h);
+
+ return 0;
+}
+
+static int decode_rle(GetBitContext *gb, uint8_t *pal_dst, int pal_stride,
+ uint8_t *rgb_dst, int rgb_stride, uint32_t *pal,
+ int keyframe, int kf_slipt, int slice, int w, int h)
+{
+ uint8_t bits[270] = { 0 };
+ uint32_t codes[270];
+ VLC vlc;
+
+ int current_length = 0, read_codes = 0, next_code = 0, current_codes = 0;
+ int remaining_codes, surplus_codes, i;
+
+ const int alphabet_size = 270 - keyframe;
+
+ int last_symbol = 0, repeat = 0, prev_avail = 0;
+
+ if (!keyframe) {
+ int x, y, clipw, cliph;
+
+ x = get_bits(gb, 12);
+ y = get_bits(gb, 12);
+ clipw = get_bits(gb, 12) + 1;
+ cliph = get_bits(gb, 12) + 1;
+
+ if (x + clipw > w || y + cliph > h)
+ return AVERROR_INVALIDDATA;
+ pal_dst += pal_stride * y + x;
+ rgb_dst += rgb_stride * y + x * 3;
+ w = clipw;
+ h = cliph;
+ if (y)
+ prev_avail = 1;
+ } else {
+ if (slice > 0) {
+ pal_dst += pal_stride * kf_slipt;
+ rgb_dst += rgb_stride * kf_slipt;
+ prev_avail = 1;
+ h -= kf_slipt;
+ } else
+ h = kf_slipt;
+ }
+
+ /* read explicit codes */
+ do {
+ while (current_codes--) {
+ int symbol = get_bits(gb, 8);
+ if (symbol >= 204 - keyframe)
+ symbol += 14 - keyframe;
+ else if (symbol > 189)
+ symbol = get_bits1(gb) + (symbol << 1) - 190;
+ if (bits[symbol])
+ return AVERROR_INVALIDDATA;
+ bits[symbol] = current_length;
+ codes[symbol] = next_code++;
+ read_codes++;
+ }
+ current_length++;
+ next_code <<= 1;
+ remaining_codes = (1 << current_length) - next_code;
+ current_codes = get_bits(gb, av_ceil_log2(remaining_codes + 1));
+ if (current_length > 22 || current_codes > remaining_codes)
+ return AVERROR_INVALIDDATA;
+ } while (current_codes != remaining_codes);
+
+ remaining_codes = alphabet_size - read_codes;
+
+ /* determine the minimum length to fit the rest of the alphabet */
+ while ((surplus_codes = (2 << current_length) -
+ (next_code << 1) - remaining_codes) < 0) {
+ current_length++;
+ next_code <<= 1;
+ }
+
+ /* add the rest of the symbols lexicographically */
+ for (i = 0; i < alphabet_size; i++)
+ if (!bits[i]) {
+ if (surplus_codes-- == 0) {
+ current_length++;
+ next_code <<= 1;
+ }
+ bits[i] = current_length;
+ codes[i] = next_code++;
+ }
+
+ if (next_code != 1 << current_length)
+ return AVERROR_INVALIDDATA;
+
+ if (i = init_vlc(&vlc, 9, alphabet_size, bits, 1, 1, codes, 4, 4, 0))
+ return i;
+
+ /* frame decode */
+ do {
+ uint8_t *pp = pal_dst;
+ uint8_t *rp = rgb_dst;
+ do {
+ if (repeat-- < 1) {
+ int b = get_vlc2(gb, vlc.table, 9, 3);
+ if (b < 256)
+ last_symbol = b;
+ else if (b < 268) {
+ b -= 256;
+ if (b == 11)
+ b = get_bits(gb, 4) + 10;
+
+ if (!b)
+ repeat = 0;
+ else
+ repeat = get_bits(gb, b);
+
+ repeat += (1 << b) - 1;
+
+ if (last_symbol == -2) {
+ int skip = FFMIN(repeat, pal_dst + w - pp);
+ repeat -= skip;
+ pp += skip;
+ rp += skip * 3;
+ }
+ } else
+ last_symbol = 267 - b;
+ }
+ if (last_symbol >= 0) {
+ *pp = last_symbol;
+ AV_WB24(rp, pal[last_symbol]);
+ } else if (last_symbol == -1 && prev_avail) {
+ *pp = *(pp - pal_stride);
+ memcpy(rp, rp - rgb_stride, 3);
+ }
+ rp += 3;
+ } while (++pp < pal_dst + w);
+ pal_dst += pal_stride;
+ rgb_dst += rgb_stride;
+ prev_avail = 1;
+ } while (--h);
+
+ ff_free_vlc(&vlc);
+ return 0;
+}
+
+static int decode_wmv9(AVCodecContext *avctx, const uint8_t *buf, int buf_size,
+ int x, int y, int w, int h, int wmv9_mask)
+{
+ MSS2Context *ctx = avctx->priv_data;
+ MSS12Context *c = &ctx->c;
+ VC1Context *v = avctx->priv_data;
+ MpegEncContext *s = &v->s;
+ AVFrame *f;
+
+ ff_mpeg_flush(avctx);
+
+ if (s->current_picture_ptr == NULL || s->current_picture_ptr->f.data[0]) {
+ int i = ff_find_unused_picture(s, 0);
+ if (i < 0)
+ return -1;
+ s->current_picture_ptr = &s->picture[i];
+ }
+
+ init_get_bits(&s->gb, buf, buf_size * 8);
+
+ s->loop_filter = avctx->skip_loop_filter < AVDISCARD_ALL;
+
+ if (ff_vc1_parse_frame_header(v, &s->gb) == -1) {
+ av_log(v->s.avctx, AV_LOG_ERROR, "header error\n");
+ return AVERROR_INVALIDDATA;
+ }
+
+ if (s->pict_type != AV_PICTURE_TYPE_I) {
+ av_log(v->s.avctx, AV_LOG_ERROR, "expected I-frame\n");
+ return AVERROR_INVALIDDATA;
+ }
+
+ avctx->pix_fmt = AV_PIX_FMT_YUV420P;
+
+ if (ff_MPV_frame_start(s, avctx) < 0) {
+ av_log(v->s.avctx, AV_LOG_ERROR, "ff_MPV_frame_start error\n");
+ avctx->pix_fmt = AV_PIX_FMT_RGB24;
+ return -1;
+ }
+
+ ff_er_frame_start(s);
+
+ v->bits = buf_size * 8;
+
+ v->end_mb_x = (w + 15) >> 4;
+ s->end_mb_y = (h + 15) >> 4;
+ if (v->respic & 1)
+ v->end_mb_x = v->end_mb_x + 1 >> 1;
+ if (v->respic & 2)
+ s->end_mb_y = s->end_mb_y + 1 >> 1;
+
+ ff_vc1_decode_blocks(v);
+
+ ff_er_frame_end(s);
+
+ ff_MPV_frame_end(s);
+
+ f = &s->current_picture.f;
+
+ if (v->respic == 3) {
+ ctx->dsp.upsample_plane(f->data[0], f->linesize[0], w, h);
+ ctx->dsp.upsample_plane(f->data[1], f->linesize[1], w >> 1, h >> 1);
+ ctx->dsp.upsample_plane(f->data[2], f->linesize[2], w >> 1, h >> 1);
+ } else if (v->respic)
+ av_log_ask_for_sample(v->s.avctx,
+ "Asymmetric WMV9 rectangle subsampling\n");
+
+ av_assert0(f->linesize[1] == f->linesize[2]);
+
+ if (wmv9_mask != -1)
+ ctx->dsp.mss2_blit_wmv9_masked(c->rgb_pic + y * c->rgb_stride + x * 3,
+ c->rgb_stride, wmv9_mask,
+ c->pal_pic + y * c->pal_stride + x,
+ c->pal_stride,
+ f->data[0], f->linesize[0],
+ f->data[1], f->data[2], f->linesize[1],
+ w, h);
+ else
+ ctx->dsp.mss2_blit_wmv9(c->rgb_pic + y * c->rgb_stride + x * 3,
+ c->rgb_stride,
+ f->data[0], f->linesize[0],
+ f->data[1], f->data[2], f->linesize[1],
+ w, h);
+
+ avctx->pix_fmt = AV_PIX_FMT_RGB24;
+
+ return 0;
+}
+
+typedef struct Rectangle {
+ int coded, x, y, w, h;
+} Rectangle;
+
+#define MAX_WMV9_RECTANGLES 20
+#define ARITH2_PADDING 2
+
+static int mss2_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
+ AVPacket *avpkt)
+{
+ const uint8_t *buf = avpkt->data;
+ int buf_size = avpkt->size;
+ MSS2Context *ctx = avctx->priv_data;
+ MSS12Context *c = &ctx->c;
+ GetBitContext gb;
+ GetByteContext gB;
+ ArithCoder acoder;
+
+ int keyframe, has_wmv9, has_mv, is_rle, is_555, ret;
+
+ Rectangle wmv9rects[MAX_WMV9_RECTANGLES], *r;
+ int used_rects = 0, i, implicit_rect = 0, av_uninit(wmv9_mask);
+
+ av_assert0(FF_INPUT_BUFFER_PADDING_SIZE >=
+ ARITH2_PADDING + (MIN_CACHE_BITS + 7) / 8);
+
+ init_get_bits(&gb, buf, buf_size * 8);
+
+ if (keyframe = get_bits1(&gb))
+ skip_bits(&gb, 7);
+ has_wmv9 = get_bits1(&gb);
+ has_mv = keyframe ? 0 : get_bits1(&gb);
+ is_rle = get_bits1(&gb);
+ is_555 = is_rle && get_bits1(&gb);
+ if (c->slice_split > 0)
+ ctx->split_position = c->slice_split;
+ else if (c->slice_split < 0) {
+ if (get_bits1(&gb)) {
+ if (get_bits1(&gb)) {
+ if (get_bits1(&gb))
+ ctx->split_position = get_bits(&gb, 16);
+ else
+ ctx->split_position = get_bits(&gb, 12);
+ } else
+ ctx->split_position = get_bits(&gb, 8) << 4;
+ } else {
+ if (keyframe)
+ ctx->split_position = avctx->height / 2;
+ }
+ } else
+ ctx->split_position = avctx->height;
+
+ if (c->slice_split && (ctx->split_position < 1 - is_555 ||
+ ctx->split_position > avctx->height - 1))
+ return AVERROR_INVALIDDATA;
+
+ align_get_bits(&gb);
+ buf += get_bits_count(&gb) >> 3;
+ buf_size -= get_bits_count(&gb) >> 3;
+
+ if (buf_size < 1)
+ return AVERROR_INVALIDDATA;
+
+ if (is_555 && (has_wmv9 || has_mv || c->slice_split && ctx->split_position))
+ return AVERROR_INVALIDDATA;
+
+ avctx->pix_fmt = is_555 ? AV_PIX_FMT_RGB555 : AV_PIX_FMT_RGB24;
+ if (ctx->pic.data[0] && ctx->pic.format != avctx->pix_fmt)
+ avctx->release_buffer(avctx, &ctx->pic);
+
+ if (has_wmv9) {
+ bytestream2_init(&gB, buf, buf_size + ARITH2_PADDING);
+ arith2_init(&acoder, &gB);
+
+ implicit_rect = !arith2_get_bit(&acoder);
+
+ while (arith2_get_bit(&acoder)) {
+ if (used_rects == MAX_WMV9_RECTANGLES)
+ return AVERROR_INVALIDDATA;
+ r = &wmv9rects[used_rects];
+ if (!used_rects)
+ r->x = arith2_get_number(&acoder, avctx->width);
+ else
+ r->x = arith2_get_number(&acoder, avctx->width -
+ wmv9rects[used_rects - 1].x) +
+ wmv9rects[used_rects - 1].x;
+ r->y = arith2_get_number(&acoder, avctx->height);
+ r->w = arith2_get_number(&acoder, avctx->width - r->x) + 1;
+ r->h = arith2_get_number(&acoder, avctx->height - r->y) + 1;
+ used_rects++;
+ }
+
+ if (implicit_rect && used_rects) {
+ av_log(avctx, AV_LOG_ERROR, "implicit_rect && used_rects > 0\n");
+ return AVERROR_INVALIDDATA;
+ }
+
+ if (implicit_rect) {
+ wmv9rects[0].x = 0;
+ wmv9rects[0].y = 0;
+ wmv9rects[0].w = avctx->width;
+ wmv9rects[0].h = avctx->height;
+
+ used_rects = 1;
+ }
+ for (i = 0; i < used_rects; i++) {
+ if (!implicit_rect && arith2_get_bit(&acoder)) {
+ av_log(avctx, AV_LOG_ERROR, "Unexpected grandchildren\n");
+ return AVERROR_INVALIDDATA;
+ }
+ if (!i) {
+ wmv9_mask = arith2_get_bit(&acoder) - 1;
+ if (!wmv9_mask)
+ wmv9_mask = arith2_get_number(&acoder, 256);
+ }
+ wmv9rects[i].coded = arith2_get_number(&acoder, 2);
+ }
+
+ buf += arith2_get_consumed_bytes(&acoder);
+ buf_size -= arith2_get_consumed_bytes(&acoder);
+ if (buf_size < 1)
+ return AVERROR_INVALIDDATA;
+ }
+
+ c->mvX = c->mvY = 0;
+ if (keyframe && !is_555) {
+ if ((i = decode_pal_v2(c, buf, buf_size)) < 0)
+ return AVERROR_INVALIDDATA;
+ buf += i;
+ buf_size -= i;
+ } else if (has_mv) {
+ buf += 4;
+ buf_size -= 4;
+ if (buf_size < 1)
+ return AVERROR_INVALIDDATA;
+ c->mvX = AV_RB16(buf - 4) - avctx->width;
+ c->mvY = AV_RB16(buf - 2) - avctx->height;
+ }
+
+ if (c->mvX < 0 || c->mvY < 0) {
+ FFSWAP(AVFrame, ctx->pic, ctx->last_pic);
+ FFSWAP(uint8_t *, c->pal_pic, c->last_pal_pic);
+
+ if (ctx->pic.data[0])
+ avctx->release_buffer(avctx, &ctx->pic);
+
+ ctx->pic.reference = 3;
+ ctx->pic.buffer_hints = FF_BUFFER_HINTS_VALID |
+ FF_BUFFER_HINTS_READABLE |
+ FF_BUFFER_HINTS_PRESERVE |
+ FF_BUFFER_HINTS_REUSABLE;
+
+ if ((ret = ff_get_buffer(avctx, &ctx->pic)) < 0) {
+ av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
+ return ret;
+ }
+
+ if (ctx->last_pic.data[0]) {
+ av_assert0(ctx->pic.linesize[0] == ctx->last_pic.linesize[0]);
+ c->last_rgb_pic = ctx->last_pic.data[0] +
+ ctx->last_pic.linesize[0] * (avctx->height - 1);
+ } else {
+ av_log(avctx, AV_LOG_ERROR, "Missing keyframe\n");
+ return -1;
+ }
+ } else {
+ if (ctx->last_pic.data[0])
+ avctx->release_buffer(avctx, &ctx->last_pic);
+
+ ctx->pic.reference = 3;
+ ctx->pic.buffer_hints = FF_BUFFER_HINTS_VALID |
+ FF_BUFFER_HINTS_READABLE |
+ FF_BUFFER_HINTS_PRESERVE |
+ FF_BUFFER_HINTS_REUSABLE;
+
+ if ((ret = avctx->reget_buffer(avctx, &ctx->pic)) < 0) {
+ av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n");
+ return ret;
+ }
+
+ c->last_rgb_pic = NULL;
+ }
+ c->rgb_pic = ctx->pic.data[0] +
+ ctx->pic.linesize[0] * (avctx->height - 1);
+ c->rgb_stride = -ctx->pic.linesize[0];
+
+ ctx->pic.key_frame = keyframe;
+ ctx->pic.pict_type = keyframe ? AV_PICTURE_TYPE_I : AV_PICTURE_TYPE_P;
+
+ if (is_555) {
+ bytestream2_init(&gB, buf, buf_size);
+
+ if (decode_555(&gB, (uint16_t *)c->rgb_pic, c->rgb_stride >> 1,
+ keyframe, avctx->width, avctx->height))
+ return AVERROR_INVALIDDATA;
+
+ buf_size -= bytestream2_tell(&gB);
+ } else {
+ if (keyframe) {
+ c->corrupted = 0;
+ ff_mss12_slicecontext_reset(&ctx->sc[0]);
+ if (c->slice_split)
+ ff_mss12_slicecontext_reset(&ctx->sc[1]);
+ }
+ if (is_rle) {
+ init_get_bits(&gb, buf, buf_size * 8);
+ if (ret = decode_rle(&gb, c->pal_pic, c->pal_stride,
+ c->rgb_pic, c->rgb_stride, c->pal, keyframe,
+ ctx->split_position, 0,
+ avctx->width, avctx->height))
+ return ret;
+ align_get_bits(&gb);
+
+ if (c->slice_split)
+ if (ret = decode_rle(&gb, c->pal_pic, c->pal_stride,
+ c->rgb_pic, c->rgb_stride, c->pal, keyframe,
+ ctx->split_position, 1,
+ avctx->width, avctx->height))
+ return ret;
+
+ align_get_bits(&gb);
+ buf += get_bits_count(&gb) >> 3;
+ buf_size -= get_bits_count(&gb) >> 3;
+ } else if (!implicit_rect || wmv9_mask != -1) {
+ if (c->corrupted)
+ return AVERROR_INVALIDDATA;
+ bytestream2_init(&gB, buf, buf_size + ARITH2_PADDING);
+ arith2_init(&acoder, &gB);
+ c->keyframe = keyframe;
+ if (c->corrupted = ff_mss12_decode_rect(&ctx->sc[0], &acoder, 0, 0,
+ avctx->width,
+ ctx->split_position))
+ return AVERROR_INVALIDDATA;
+
+ buf += arith2_get_consumed_bytes(&acoder);
+ buf_size -= arith2_get_consumed_bytes(&acoder);
+ if (c->slice_split) {
+ if (buf_size < 1)
+ return AVERROR_INVALIDDATA;
+ bytestream2_init(&gB, buf, buf_size + ARITH2_PADDING);
+ arith2_init(&acoder, &gB);
+ if (c->corrupted = ff_mss12_decode_rect(&ctx->sc[1], &acoder, 0,
+ ctx->split_position,
+ avctx->width,
+ avctx->height - ctx->split_position))
+ return AVERROR_INVALIDDATA;
+
+ buf += arith2_get_consumed_bytes(&acoder);
+ buf_size -= arith2_get_consumed_bytes(&acoder);
+ }
+ } else
+ memset(c->pal_pic, 0, c->pal_stride * avctx->height);
+ }
+
+ if (has_wmv9) {
+ for (i = 0; i < used_rects; i++) {
+ int x = wmv9rects[i].x;
+ int y = wmv9rects[i].y;
+ int w = wmv9rects[i].w;
+ int h = wmv9rects[i].h;
+ if (wmv9rects[i].coded) {
+ int WMV9codedFrameSize;
+ if (buf_size < 4 || !(WMV9codedFrameSize = AV_RL24(buf)))
+ return AVERROR_INVALIDDATA;
+ if (ret = decode_wmv9(avctx, buf + 3, buf_size - 3,
+ x, y, w, h, wmv9_mask))
+ return ret;
+ buf += WMV9codedFrameSize + 3;
+ buf_size -= WMV9codedFrameSize + 3;
+ } else {
+ uint8_t *dst = c->rgb_pic + y * c->rgb_stride + x * 3;
+ if (wmv9_mask != -1) {
+ ctx->dsp.mss2_gray_fill_masked(dst, c->rgb_stride,
+ wmv9_mask,
+ c->pal_pic + y * c->pal_stride + x,
+ c->pal_stride,
+ w, h);
+ } else {
+ do {
+ memset(dst, 0x80, w * 3);
+ dst += c->rgb_stride;
+ } while (--h);
+ }
+ }
+ }
+ }
+
+ if (buf_size)
+ av_log(avctx, AV_LOG_WARNING, "buffer not fully consumed\n");
+
+ *got_frame = 1;
+ *(AVFrame *)data = ctx->pic;
+
+ return avpkt->size;
+}
+
+static av_cold int wmv9_init(AVCodecContext *avctx)
+{
+ VC1Context *v = avctx->priv_data;
+
+ v->s.avctx = avctx;
+ avctx->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 (ff_vc1_init_common(v) < 0)
+ return -1;
+ ff_vc1dsp_init(&v->vc1dsp);
+
+ v->profile = PROFILE_MAIN;
+
+ v->zz_8x4 = ff_wmv2_scantableA;
+ v->zz_4x8 = ff_wmv2_scantableB;
+ v->res_y411 = 0;
+ v->res_sprite = 0;
+
+ v->frmrtq_postproc = 7;
+ v->bitrtq_postproc = 31;
+
+ v->res_x8 = 0;
+ v->multires = 0;
+ v->res_fasttx = 1;
+
+ v->fastuvmc = 0;
+
+ v->extended_mv = 0;
+
+ v->dquant = 1;
+ v->vstransform = 1;
+
+ v->res_transtab = 0;
+
+ v->overlap = 0;
+
+ v->s.resync_marker = 0;
+ v->rangered = 0;
+
+ v->s.max_b_frames = avctx->max_b_frames = 0;
+ v->quantizer_mode = 0;
+
+ v->finterpflag = 0;
+
+ v->res_rtm_flag = 1;
+
+ ff_vc1_init_transposed_scantables(v);
+
+ if (ff_msmpeg4_decode_init(avctx) < 0 ||
+ ff_vc1_decode_init_alloc_tables(v) < 0)
+ return -1;
+
+ /* error concealment */
+ v->s.me.qpel_put = v->s.dsp.put_qpel_pixels_tab;
+ v->s.me.qpel_avg = v->s.dsp.avg_qpel_pixels_tab;
+
+ return 0;
+}
+
+static av_cold int mss2_decode_end(AVCodecContext *avctx)
+{
+ MSS2Context *const ctx = avctx->priv_data;
+
+ if (ctx->pic.data[0])
+ avctx->release_buffer(avctx, &ctx->pic);
+ if (ctx->last_pic.data[0])
+ avctx->release_buffer(avctx, &ctx->last_pic);
+
+ ff_mss12_decode_end(&ctx->c);
+ av_freep(&ctx->c.pal_pic);
+ av_freep(&ctx->c.last_pal_pic);
+ ff_vc1_decode_end(avctx);
+
+ return 0;
+}
+
+static av_cold int mss2_decode_init(AVCodecContext *avctx)
+{
+ MSS2Context * const ctx = avctx->priv_data;
+ MSS12Context *c = &ctx->c;
+ int ret;
+ c->avctx = avctx;
+ avctx->coded_frame = &ctx->pic;
+ if (ret = ff_mss12_decode_init(c, 1, &ctx->sc[0], &ctx->sc[1]))
+ return ret;
+ c->pal_stride = c->mask_stride;
+ c->pal_pic = av_mallocz(c->pal_stride * avctx->height);
+ c->last_pal_pic = av_mallocz(c->pal_stride * avctx->height);
+ if (!c->pal_pic || !c->last_pal_pic) {
+ mss2_decode_end(avctx);
+ return AVERROR(ENOMEM);
+ }
+ if (ret = wmv9_init(avctx)) {
+ mss2_decode_end(avctx);
+ return ret;
+ }
+ ff_mss2dsp_init(&ctx->dsp);
+
+ avctx->pix_fmt = c->free_colours == 127 ? AV_PIX_FMT_RGB555
+ : AV_PIX_FMT_RGB24;
+
+ return 0;
+}
+
+AVCodec ff_mss2_decoder = {
+ .name = "mss2",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .id = AV_CODEC_ID_MSS2,
+ .priv_data_size = sizeof(MSS2Context),
+ .init = mss2_decode_init,
+ .close = mss2_decode_end,
+ .decode = mss2_decode_frame,
+ .capabilities = CODEC_CAP_DR1,
+ .long_name = NULL_IF_CONFIG_SMALL("MS Windows Media Video V9 Screen"),
+};
diff --git a/gst-libs/ext/libav/libavcodec/mss2dsp.c b/gst-libs/ext/libav/libavcodec/mss2dsp.c
new file mode 100644
index 0000000..aa13577
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/mss2dsp.c
@@ -0,0 +1,153 @@
+/*
+ * Microsoft Screen 2 (aka Windows Media Video V9 Screen) decoder
+ *
+ * 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
+ * Microsoft Screen 2 (aka Windows Media Video V9 Screen) decoder DSP routines
+ */
+
+#include "mss2dsp.h"
+#include "libavutil/common.h"
+
+static av_always_inline void mss2_blit_wmv9_template(uint8_t *dst,
+ int dst_stride,
+ int gray,
+ int use_mask,
+ int maskcolor,
+ const uint8_t *mask,
+ int mask_stride,
+ const uint8_t *srcy,
+ int srcy_stride,
+ const uint8_t *srcu,
+ const uint8_t *srcv,
+ int srcuv_stride,
+ int w, int h)
+{
+ int i, j, k, r = -1;
+ while (++r < h) {
+ for (i = 0, j = 0, k = 0; i < w; j += (i & 1), i++, k += 3) {
+ if (!use_mask || mask[i] == maskcolor) {
+ if (gray) {
+ dst[k] = dst[k + 1] = dst[k + 2] = 0x80;
+ } else {
+ int y = srcy[i];
+ int u = srcu[j] - 128;
+ int v = srcv[j] - 128;
+ dst[k] = av_clip_uint8(y + ( 91881 * v + 32768 >> 16));
+ dst[k + 1] = av_clip_uint8(y + (-22554 * u - 46802 * v + 32768 >> 16));
+ dst[k + 2] = av_clip_uint8(y + (116130 * u + 32768 >> 16));
+ }
+ }
+ }
+ mask += mask_stride;
+ dst += dst_stride;
+ srcy += srcy_stride;
+ srcu += srcuv_stride * (r & 1);
+ srcv += srcuv_stride * (r & 1);
+ }
+}
+
+static void mss2_blit_wmv9_c(uint8_t *dst, int dst_stride,
+ const uint8_t *srcy, int srcy_stride,
+ const uint8_t *srcu, const uint8_t *srcv,
+ int srcuv_stride, int w, int h)
+{
+ mss2_blit_wmv9_template(dst, dst_stride, 0, 0,
+ 0, NULL, 0,
+ srcy, srcy_stride,
+ srcu, srcv, srcuv_stride,
+ w, h);
+}
+
+static void mss2_blit_wmv9_masked_c(uint8_t *dst, int dst_stride,
+ int maskcolor, const uint8_t *mask,
+ int mask_stride,
+ const uint8_t *srcy, int srcy_stride,
+ const uint8_t *srcu, const uint8_t *srcv,
+ int srcuv_stride, int w, int h)
+{
+ mss2_blit_wmv9_template(dst, dst_stride, 0, 1,
+ maskcolor, mask, mask_stride,
+ srcy, srcy_stride,
+ srcu, srcv, srcuv_stride,
+ w, h);
+}
+
+static void mss2_gray_fill_masked_c(uint8_t *dst, int dst_stride,
+ int maskcolor, const uint8_t *mask,
+ int mask_stride, int w, int h)
+{
+ mss2_blit_wmv9_template(dst, dst_stride, 1, 1,
+ maskcolor, mask, mask_stride,
+ NULL, 0,
+ NULL, NULL, 0,
+ w, h);
+}
+
+static void upsample_plane_c(uint8_t *plane, int plane_stride, int w, int h)
+{
+ uint8_t *src1, *src2, *dst1, *dst2, *p, a, b;
+ int i, j;
+
+ w += (w & 1);
+ h += (h & 1);
+
+ j = h - 1;
+
+ memcpy(plane + plane_stride * j,
+ plane + plane_stride * (j >> 1),
+ w);
+
+ while ((j -= 2) > 0) {
+ dst1 = plane + plane_stride * (j + 1);
+ dst2 = plane + plane_stride * j;
+ src1 = plane + plane_stride * ((j + 1) >> 1);
+ src2 = plane + plane_stride * ( j >> 1);
+
+ for (i = (w - 1) >> 1; i >= 0; i--) {
+ a = src1[i];
+ b = src2[i];
+ dst1[i] = (3 * a + b + 2) >> 2;
+ dst2[i] = (a + 3 * b + 2) >> 2;
+ }
+ }
+
+ for (j = h - 1; j >= 0; j--) {
+ p = plane + plane_stride * j;
+ i = w - 1;
+
+ p[i] = p[i >> 1];
+
+ while ((i -= 2) > 0) {
+ a = p[ i >> 1];
+ b = p[(i + 1) >> 1];
+ p[i] = (3 * a + b + 1) >> 2;
+ p[i + 1] = (a + 3 * b + 1) >> 2;
+ }
+ }
+}
+
+av_cold void ff_mss2dsp_init(MSS2DSPContext* dsp)
+{
+ dsp->mss2_blit_wmv9 = mss2_blit_wmv9_c;
+ dsp->mss2_blit_wmv9_masked = mss2_blit_wmv9_masked_c;
+ dsp->mss2_gray_fill_masked = mss2_gray_fill_masked_c;
+ dsp->upsample_plane = upsample_plane_c;
+}
diff --git a/gst-libs/ext/libav/libavcodec/mss2dsp.h b/gst-libs/ext/libav/libavcodec/mss2dsp.h
new file mode 100644
index 0000000..b3d67a1
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/mss2dsp.h
@@ -0,0 +1,50 @@
+/*
+ * Microsoft Screen 2 (aka Windows Media Video V9 Screen) decoder
+ *
+ * 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
+ * Microsoft Screen 2 (aka Windows Media Video V9 Screen) decoder DSP routines
+ */
+
+#ifndef AVCODEC_MSS2DSP_H
+#define AVCODEC_MSS2DSP_H
+
+#include "dsputil.h"
+
+typedef struct MSS2DSPContext {
+ void (*mss2_blit_wmv9)(uint8_t *dst, int dst_stride,
+ const uint8_t *srcy, int srcy_stride,
+ const uint8_t *srcu, const uint8_t *srcv,
+ int srcuv_stride, int w, int h);
+ void (*mss2_blit_wmv9_masked)(uint8_t *dst, int dst_stride,
+ int maskcolor, const uint8_t *mask,
+ int mask_stride,
+ const uint8_t *srcy, int srcy_stride,
+ const uint8_t *srcu, const uint8_t *srcv,
+ int srcuv_stride, int w, int h);
+ void (*mss2_gray_fill_masked)(uint8_t *dst, int dst_stride,
+ int maskcolor, const uint8_t *mask,
+ int mask_stride, int w, int h);
+ void (*upsample_plane)(uint8_t *plane, int plane_stride, int w, int h);
+} MSS2DSPContext;
+
+av_cold void ff_mss2dsp_init(MSS2DSPContext* dsp);
+
+#endif /* AVCODEC_MSS2DSP_H */
diff --git a/gst-libs/ext/libav/libavcodec/mss3.c b/gst-libs/ext/libav/libavcodec/mss3.c
new file mode 100644
index 0000000..689daee
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/mss3.c
@@ -0,0 +1,869 @@
+/*
+ * Microsoft Screen 3 (aka Microsoft ATC Screen) decoder
+ * Copyright (c) 2012 Konstantin Shishkov
+ *
+ * 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
+ * Microsoft Screen 3 (aka Microsoft ATC Screen) decoder
+ */
+
+#include "avcodec.h"
+#include "bytestream.h"
+#include "dsputil.h"
+#include "mss34dsp.h"
+
+#define HEADER_SIZE 27
+
+#define MODEL2_SCALE 13
+#define MODEL_SCALE 15
+#define MODEL256_SEC_SCALE 9
+
+typedef struct Model2 {
+ int upd_val, till_rescale;
+ unsigned zero_freq, zero_weight;
+ unsigned total_freq, total_weight;
+} Model2;
+
+typedef struct Model {
+ int weights[16], freqs[16];
+ int num_syms;
+ int tot_weight;
+ int upd_val, max_upd_val, till_rescale;
+} Model;
+
+typedef struct Model256 {
+ int weights[256], freqs[256];
+ int tot_weight;
+ int secondary[68];
+ int sec_size;
+ int upd_val, max_upd_val, till_rescale;
+} Model256;
+
+#define RAC_BOTTOM 0x01000000
+typedef struct RangeCoder {
+ const uint8_t *src, *src_end;
+
+ uint32_t range, low;
+ int got_error;
+} RangeCoder;
+
+enum BlockType {
+ FILL_BLOCK = 0,
+ IMAGE_BLOCK,
+ DCT_BLOCK,
+ HAAR_BLOCK,
+ SKIP_BLOCK
+};
+
+typedef struct BlockTypeContext {
+ int last_type;
+ Model bt_model[5];
+} BlockTypeContext;
+
+typedef struct FillBlockCoder {
+ int fill_val;
+ Model coef_model;
+} FillBlockCoder;
+
+typedef struct ImageBlockCoder {
+ Model256 esc_model, vec_entry_model;
+ Model vec_size_model;
+ Model vq_model[125];
+} ImageBlockCoder;
+
+typedef struct DCTBlockCoder {
+ int *prev_dc;
+ int prev_dc_stride;
+ int prev_dc_height;
+ int quality;
+ uint16_t qmat[64];
+ Model dc_model;
+ Model2 sign_model;
+ Model256 ac_model;
+} DCTBlockCoder;
+
+typedef struct HaarBlockCoder {
+ int quality, scale;
+ Model256 coef_model;
+ Model coef_hi_model;
+} HaarBlockCoder;
+
+typedef struct MSS3Context {
+ AVCodecContext *avctx;
+ AVFrame pic;
+
+ int got_error;
+ RangeCoder coder;
+ BlockTypeContext btype[3];
+ FillBlockCoder fill_coder[3];
+ ImageBlockCoder image_coder[3];
+ DCTBlockCoder dct_coder[3];
+ HaarBlockCoder haar_coder[3];
+
+ int dctblock[64];
+ int hblock[16 * 16];
+} MSS3Context;
+
+
+static void model2_reset(Model2 *m)
+{
+ m->zero_weight = 1;
+ m->total_weight = 2;
+ m->zero_freq = 0x1000;
+ m->total_freq = 0x2000;
+ m->upd_val = 4;
+ m->till_rescale = 4;
+}
+
+static void model2_update(Model2 *m, int bit)
+{
+ unsigned scale;
+
+ if (!bit)
+ m->zero_weight++;
+ m->till_rescale--;
+ if (m->till_rescale)
+ return;
+
+ m->total_weight += m->upd_val;
+ if (m->total_weight > 0x2000) {
+ m->total_weight = (m->total_weight + 1) >> 1;
+ m->zero_weight = (m->zero_weight + 1) >> 1;
+ if (m->total_weight == m->zero_weight)
+ m->total_weight = m->zero_weight + 1;
+ }
+ m->upd_val = m->upd_val * 5 >> 2;
+ if (m->upd_val > 64)
+ m->upd_val = 64;
+ scale = 0x80000000u / m->total_weight;
+ m->zero_freq = m->zero_weight * scale >> 18;
+ m->total_freq = m->total_weight * scale >> 18;
+ m->till_rescale = m->upd_val;
+}
+
+static void model_update(Model *m, int val)
+{
+ int i, sum = 0;
+ unsigned scale;
+
+ m->weights[val]++;
+ m->till_rescale--;
+ if (m->till_rescale)
+ return;
+ m->tot_weight += m->upd_val;
+
+ if (m->tot_weight > 0x8000) {
+ m->tot_weight = 0;
+ for (i = 0; i < m->num_syms; i++) {
+ m->weights[i] = (m->weights[i] + 1) >> 1;
+ m->tot_weight += m->weights[i];
+ }
+ }
+ scale = 0x80000000u / m->tot_weight;
+ for (i = 0; i < m->num_syms; i++) {
+ m->freqs[i] = sum * scale >> 16;
+ sum += m->weights[i];
+ }
+
+ m->upd_val = m->upd_val * 5 >> 2;
+ if (m->upd_val > m->max_upd_val)
+ m->upd_val = m->max_upd_val;
+ m->till_rescale = m->upd_val;
+}
+
+static void model_reset(Model *m)
+{
+ int i;
+
+ m->tot_weight = 0;
+ for (i = 0; i < m->num_syms - 1; i++)
+ m->weights[i] = 1;
+ m->weights[m->num_syms - 1] = 0;
+
+ m->upd_val = m->num_syms;
+ m->till_rescale = 1;
+ model_update(m, m->num_syms - 1);
+ m->till_rescale =
+ m->upd_val = (m->num_syms + 6) >> 1;
+}
+
+static av_cold void model_init(Model *m, int num_syms)
+{
+ m->num_syms = num_syms;
+ m->max_upd_val = 8 * num_syms + 48;
+
+ model_reset(m);
+}
+
+static void model256_update(Model256 *m, int val)
+{
+ int i, sum = 0;
+ unsigned scale;
+ int send, sidx = 1;
+
+ m->weights[val]++;
+ m->till_rescale--;
+ if (m->till_rescale)
+ return;
+ m->tot_weight += m->upd_val;
+
+ if (m->tot_weight > 0x8000) {
+ m->tot_weight = 0;
+ for (i = 0; i < 256; i++) {
+ m->weights[i] = (m->weights[i] + 1) >> 1;
+ m->tot_weight += m->weights[i];
+ }
+ }
+ scale = 0x80000000u / m->tot_weight;
+ m->secondary[0] = 0;
+ for (i = 0; i < 256; i++) {
+ m->freqs[i] = sum * scale >> 16;
+ sum += m->weights[i];
+ send = m->freqs[i] >> MODEL256_SEC_SCALE;
+ while (sidx <= send)
+ m->secondary[sidx++] = i - 1;
+ }
+ while (sidx < m->sec_size)
+ m->secondary[sidx++] = 255;
+
+ m->upd_val = m->upd_val * 5 >> 2;
+ if (m->upd_val > m->max_upd_val)
+ m->upd_val = m->max_upd_val;
+ m->till_rescale = m->upd_val;
+}
+
+static void model256_reset(Model256 *m)
+{
+ int i;
+
+ for (i = 0; i < 255; i++)
+ m->weights[i] = 1;
+ m->weights[255] = 0;
+
+ m->tot_weight = 0;
+ m->upd_val = 256;
+ m->till_rescale = 1;
+ model256_update(m, 255);
+ m->till_rescale =
+ m->upd_val = (256 + 6) >> 1;
+}
+
+static av_cold void model256_init(Model256 *m)
+{
+ m->max_upd_val = 8 * 256 + 48;
+ m->sec_size = (1 << 6) + 2;
+
+ model256_reset(m);
+}
+
+static void rac_init(RangeCoder *c, const uint8_t *src, int size)
+{
+ int i;
+
+ c->src = src;
+ c->src_end = src + size;
+ c->low = 0;
+ for (i = 0; i < FFMIN(size, 4); i++)
+ c->low = (c->low << 8) | *c->src++;
+ c->range = 0xFFFFFFFF;
+ c->got_error = 0;
+}
+
+static void rac_normalise(RangeCoder *c)
+{
+ for (;;) {
+ c->range <<= 8;
+ c->low <<= 8;
+ if (c->src < c->src_end) {
+ c->low |= *c->src++;
+ } else if (!c->low) {
+ c->got_error = 1;
+ return;
+ }
+ if (c->range >= RAC_BOTTOM)
+ return;
+ }
+}
+
+static int rac_get_bit(RangeCoder *c)
+{
+ int bit;
+
+ c->range >>= 1;
+
+ bit = (c->range <= c->low);
+ if (bit)
+ c->low -= c->range;
+
+ if (c->range < RAC_BOTTOM)
+ rac_normalise(c);
+
+ return bit;
+}
+
+static int rac_get_bits(RangeCoder *c, int nbits)
+{
+ int val;
+
+ c->range >>= nbits;
+ val = c->low / c->range;
+ c->low -= c->range * val;
+
+ if (c->range < RAC_BOTTOM)
+ rac_normalise(c);
+
+ return val;
+}
+
+static int rac_get_model2_sym(RangeCoder *c, Model2 *m)
+{
+ int bit, helper;
+
+ helper = m->zero_freq * (c->range >> MODEL2_SCALE);
+ bit = (c->low >= helper);
+ if (bit) {
+ c->low -= helper;
+ c->range -= helper;
+ } else {
+ c->range = helper;
+ }
+
+ if (c->range < RAC_BOTTOM)
+ rac_normalise(c);
+
+ model2_update(m, bit);
+
+ return bit;
+}
+
+static int rac_get_model_sym(RangeCoder *c, Model *m)
+{
+ int prob, prob2, helper, val;
+ int end, end2;
+
+ prob = 0;
+ prob2 = c->range;
+ c->range >>= MODEL_SCALE;
+ val = 0;
+ end = m->num_syms >> 1;
+ end2 = m->num_syms;
+ do {
+ helper = m->freqs[end] * c->range;
+ if (helper <= c->low) {
+ val = end;
+ prob = helper;
+ } else {
+ end2 = end;
+ prob2 = helper;
+ }
+ end = (end2 + val) >> 1;
+ } while (end != val);
+ c->low -= prob;
+ c->range = prob2 - prob;
+ if (c->range < RAC_BOTTOM)
+ rac_normalise(c);
+
+ model_update(m, val);
+
+ return val;
+}
+
+static int rac_get_model256_sym(RangeCoder *c, Model256 *m)
+{
+ int prob, prob2, helper, val;
+ int start, end;
+ int ssym;
+
+ prob2 = c->range;
+ c->range >>= MODEL_SCALE;
+
+ helper = c->low / c->range;
+ ssym = helper >> MODEL256_SEC_SCALE;
+ val = m->secondary[ssym];
+
+ end = start = m->secondary[ssym + 1] + 1;
+ while (end > val + 1) {
+ ssym = (end + val) >> 1;
+ if (m->freqs[ssym] <= helper) {
+ end = start;
+ val = ssym;
+ } else {
+ end = (end + val) >> 1;
+ start = ssym;
+ }
+ }
+ prob = m->freqs[val] * c->range;
+ if (val != 255)
+ prob2 = m->freqs[val + 1] * c->range;
+
+ c->low -= prob;
+ c->range = prob2 - prob;
+ if (c->range < RAC_BOTTOM)
+ rac_normalise(c);
+
+ model256_update(m, val);
+
+ return val;
+}
+
+static int decode_block_type(RangeCoder *c, BlockTypeContext *bt)
+{
+ bt->last_type = rac_get_model_sym(c, &bt->bt_model[bt->last_type]);
+
+ return bt->last_type;
+}
+
+static int decode_coeff(RangeCoder *c, Model *m)
+{
+ int val, sign;
+
+ val = rac_get_model_sym(c, m);
+ if (val) {
+ sign = rac_get_bit(c);
+ if (val > 1) {
+ val--;
+ val = (1 << val) + rac_get_bits(c, val);
+ }
+ if (!sign)
+ val = -val;
+ }
+
+ return val;
+}
+
+static void decode_fill_block(RangeCoder *c, FillBlockCoder *fc,
+ uint8_t *dst, int stride, int block_size)
+{
+ int i;
+
+ fc->fill_val += decode_coeff(c, &fc->coef_model);
+
+ for (i = 0; i < block_size; i++, dst += stride)
+ memset(dst, fc->fill_val, block_size);
+}
+
+static void decode_image_block(RangeCoder *c, ImageBlockCoder *ic,
+ uint8_t *dst, int stride, int block_size)
+{
+ int i, j;
+ int vec_size;
+ int vec[4];
+ int prev_line[16];
+ int A, B, C;
+
+ vec_size = rac_get_model_sym(c, &ic->vec_size_model) + 2;
+ for (i = 0; i < vec_size; i++)
+ vec[i] = rac_get_model256_sym(c, &ic->vec_entry_model);
+ for (; i < 4; i++)
+ vec[i] = 0;
+ memset(prev_line, 0, sizeof(prev_line));
+
+ for (j = 0; j < block_size; j++) {
+ A = 0;
+ B = 0;
+ for (i = 0; i < block_size; i++) {
+ C = B;
+ B = prev_line[i];
+ A = rac_get_model_sym(c, &ic->vq_model[A + B * 5 + C * 25]);
+
+ prev_line[i] = A;
+ if (A < 4)
+ dst[i] = vec[A];
+ else
+ dst[i] = rac_get_model256_sym(c, &ic->esc_model);
+ }
+ dst += stride;
+ }
+}
+
+static int decode_dct(RangeCoder *c, DCTBlockCoder *bc, int *block,
+ int bx, int by)
+{
+ int skip, val, sign, pos = 1, zz_pos, dc;
+ int blk_pos = bx + by * bc->prev_dc_stride;
+
+ memset(block, 0, sizeof(*block) * 64);
+
+ dc = decode_coeff(c, &bc->dc_model);
+ if (by) {
+ if (bx) {
+ int l, tl, t;
+
+ l = bc->prev_dc[blk_pos - 1];
+ tl = bc->prev_dc[blk_pos - 1 - bc->prev_dc_stride];
+ t = bc->prev_dc[blk_pos - bc->prev_dc_stride];
+
+ if (FFABS(t - tl) <= FFABS(l - tl))
+ dc += l;
+ else
+ dc += t;
+ } else {
+ dc += bc->prev_dc[blk_pos - bc->prev_dc_stride];
+ }
+ } else if (bx) {
+ dc += bc->prev_dc[bx - 1];
+ }
+ bc->prev_dc[blk_pos] = dc;
+ block[0] = dc * bc->qmat[0];
+
+ while (pos < 64) {
+ val = rac_get_model256_sym(c, &bc->ac_model);
+ if (!val)
+ return 0;
+ if (val == 0xF0) {
+ pos += 16;
+ continue;
+ }
+ skip = val >> 4;
+ val = val & 0xF;
+ if (!val)
+ return -1;
+ pos += skip;
+ if (pos >= 64)
+ return -1;
+
+ sign = rac_get_model2_sym(c, &bc->sign_model);
+ if (val > 1) {
+ val--;
+ val = (1 << val) + rac_get_bits(c, val);
+ }
+ if (!sign)
+ val = -val;
+
+ zz_pos = ff_zigzag_direct[pos];
+ block[zz_pos] = val * bc->qmat[zz_pos];
+ pos++;
+ }
+
+ return pos == 64 ? 0 : -1;
+}
+
+static void decode_dct_block(RangeCoder *c, DCTBlockCoder *bc,
+ uint8_t *dst, int stride, int block_size,
+ int *block, int mb_x, int mb_y)
+{
+ int i, j;
+ int bx, by;
+ int nblocks = block_size >> 3;
+
+ bx = mb_x * nblocks;
+ by = mb_y * nblocks;
+
+ for (j = 0; j < nblocks; j++) {
+ for (i = 0; i < nblocks; i++) {
+ if (decode_dct(c, bc, block, bx + i, by + j)) {
+ c->got_error = 1;
+ return;
+ }
+ ff_mss34_dct_put(dst + i * 8, stride, block);
+ }
+ dst += 8 * stride;
+ }
+}
+
+static void decode_haar_block(RangeCoder *c, HaarBlockCoder *hc,
+ uint8_t *dst, int stride, int block_size,
+ int *block)
+{
+ const int hsize = block_size >> 1;
+ int A, B, C, D, t1, t2, t3, t4;
+ int i, j;
+
+ for (j = 0; j < block_size; j++) {
+ for (i = 0; i < block_size; i++) {
+ if (i < hsize && j < hsize)
+ block[i] = rac_get_model256_sym(c, &hc->coef_model);
+ else
+ block[i] = decode_coeff(c, &hc->coef_hi_model);
+ block[i] *= hc->scale;
+ }
+ block += block_size;
+ }
+ block -= block_size * block_size;
+
+ for (j = 0; j < hsize; j++) {
+ for (i = 0; i < hsize; i++) {
+ A = block[i];
+ B = block[i + hsize];
+ C = block[i + hsize * block_size];
+ D = block[i + hsize * block_size + hsize];
+
+ t1 = A - B;
+ t2 = C - D;
+ t3 = A + B;
+ t4 = C + D;
+ dst[i * 2] = av_clip_uint8(t1 - t2);
+ dst[i * 2 + stride] = av_clip_uint8(t1 + t2);
+ dst[i * 2 + 1] = av_clip_uint8(t3 - t4);
+ dst[i * 2 + 1 + stride] = av_clip_uint8(t3 + t4);
+ }
+ block += block_size;
+ dst += stride * 2;
+ }
+}
+
+static void reset_coders(MSS3Context *ctx, int quality)
+{
+ int i, j;
+
+ for (i = 0; i < 3; i++) {
+ ctx->btype[i].last_type = SKIP_BLOCK;
+ for (j = 0; j < 5; j++)
+ model_reset(&ctx->btype[i].bt_model[j]);
+ ctx->fill_coder[i].fill_val = 0;
+ model_reset(&ctx->fill_coder[i].coef_model);
+ model256_reset(&ctx->image_coder[i].esc_model);
+ model256_reset(&ctx->image_coder[i].vec_entry_model);
+ model_reset(&ctx->image_coder[i].vec_size_model);
+ for (j = 0; j < 125; j++)
+ model_reset(&ctx->image_coder[i].vq_model[j]);
+ if (ctx->dct_coder[i].quality != quality) {
+ ctx->dct_coder[i].quality = quality;
+ ff_mss34_gen_quant_mat(ctx->dct_coder[i].qmat, quality, !i);
+ }
+ memset(ctx->dct_coder[i].prev_dc, 0,
+ sizeof(*ctx->dct_coder[i].prev_dc) *
+ ctx->dct_coder[i].prev_dc_stride *
+ ctx->dct_coder[i].prev_dc_height);
+ model_reset(&ctx->dct_coder[i].dc_model);
+ model2_reset(&ctx->dct_coder[i].sign_model);
+ model256_reset(&ctx->dct_coder[i].ac_model);
+ if (ctx->haar_coder[i].quality != quality) {
+ ctx->haar_coder[i].quality = quality;
+ ctx->haar_coder[i].scale = 17 - 7 * quality / 50;
+ }
+ model_reset(&ctx->haar_coder[i].coef_hi_model);
+ model256_reset(&ctx->haar_coder[i].coef_model);
+ }
+}
+
+static av_cold void init_coders(MSS3Context *ctx)
+{
+ int i, j;
+
+ for (i = 0; i < 3; i++) {
+ for (j = 0; j < 5; j++)
+ model_init(&ctx->btype[i].bt_model[j], 5);
+ model_init(&ctx->fill_coder[i].coef_model, 12);
+ model256_init(&ctx->image_coder[i].esc_model);
+ model256_init(&ctx->image_coder[i].vec_entry_model);
+ model_init(&ctx->image_coder[i].vec_size_model, 3);
+ for (j = 0; j < 125; j++)
+ model_init(&ctx->image_coder[i].vq_model[j], 5);
+ model_init(&ctx->dct_coder[i].dc_model, 12);
+ model256_init(&ctx->dct_coder[i].ac_model);
+ model_init(&ctx->haar_coder[i].coef_hi_model, 12);
+ model256_init(&ctx->haar_coder[i].coef_model);
+ }
+}
+
+static int mss3_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
+ AVPacket *avpkt)
+{
+ const uint8_t *buf = avpkt->data;
+ int buf_size = avpkt->size;
+ MSS3Context *c = avctx->priv_data;
+ RangeCoder *acoder = &c->coder;
+ GetByteContext gb;
+ uint8_t *dst[3];
+ int dec_width, dec_height, dec_x, dec_y, quality, keyframe;
+ int x, y, i, mb_width, mb_height, blk_size, btype;
+ int ret;
+
+ if (buf_size < HEADER_SIZE) {
+ av_log(avctx, AV_LOG_ERROR,
+ "Frame should have at least %d bytes, got %d instead\n",
+ HEADER_SIZE, buf_size);
+ return AVERROR_INVALIDDATA;
+ }
+
+ bytestream2_init(&gb, buf, buf_size);
+ keyframe = bytestream2_get_be32(&gb);
+ if (keyframe & ~0x301) {
+ av_log(avctx, AV_LOG_ERROR, "Invalid frame type %X\n", keyframe);
+ return AVERROR_INVALIDDATA;
+ }
+ keyframe = !(keyframe & 1);
+ bytestream2_skip(&gb, 6);
+ dec_x = bytestream2_get_be16(&gb);
+ dec_y = bytestream2_get_be16(&gb);
+ dec_width = bytestream2_get_be16(&gb);
+ dec_height = bytestream2_get_be16(&gb);
+
+ if (dec_x + dec_width > avctx->width ||
+ dec_y + dec_height > avctx->height ||
+ (dec_width | dec_height) & 0xF) {
+ av_log(avctx, AV_LOG_ERROR, "Invalid frame dimensions %dx%d +%d,%d\n",
+ dec_width, dec_height, dec_x, dec_y);
+ return AVERROR_INVALIDDATA;
+ }
+ bytestream2_skip(&gb, 4);
+ quality = bytestream2_get_byte(&gb);
+ if (quality < 1 || quality > 100) {
+ av_log(avctx, AV_LOG_ERROR, "Invalid quality setting %d\n", quality);
+ return AVERROR_INVALIDDATA;
+ }
+ bytestream2_skip(&gb, 4);
+
+ if (keyframe && !bytestream2_get_bytes_left(&gb)) {
+ av_log(avctx, AV_LOG_ERROR, "Keyframe without data found\n");
+ return AVERROR_INVALIDDATA;
+ }
+ if (!keyframe && c->got_error)
+ return buf_size;
+ c->got_error = 0;
+
+ c->pic.reference = 3;
+ c->pic.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE |
+ FF_BUFFER_HINTS_REUSABLE;
+ if ((ret = avctx->reget_buffer(avctx, &c->pic)) < 0) {
+ av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n");
+ return ret;
+ }
+ c->pic.key_frame = keyframe;
+ c->pic.pict_type = keyframe ? AV_PICTURE_TYPE_I : AV_PICTURE_TYPE_P;
+ if (!bytestream2_get_bytes_left(&gb)) {
+ *got_frame = 1;
+ *(AVFrame*)data = c->pic;
+
+ return buf_size;
+ }
+
+ reset_coders(c, quality);
+
+ rac_init(acoder, buf + HEADER_SIZE, buf_size - HEADER_SIZE);
+
+ mb_width = dec_width >> 4;
+ mb_height = dec_height >> 4;
+ dst[0] = c->pic.data[0] + dec_x + dec_y * c->pic.linesize[0];
+ dst[1] = c->pic.data[1] + dec_x / 2 + (dec_y / 2) * c->pic.linesize[1];
+ dst[2] = c->pic.data[2] + dec_x / 2 + (dec_y / 2) * c->pic.linesize[2];
+ for (y = 0; y < mb_height; y++) {
+ for (x = 0; x < mb_width; x++) {
+ for (i = 0; i < 3; i++) {
+ blk_size = 8 << !i;
+
+ btype = decode_block_type(acoder, c->btype + i);
+ switch (btype) {
+ case FILL_BLOCK:
+ decode_fill_block(acoder, c->fill_coder + i,
+ dst[i] + x * blk_size,
+ c->pic.linesize[i], blk_size);
+ break;
+ case IMAGE_BLOCK:
+ decode_image_block(acoder, c->image_coder + i,
+ dst[i] + x * blk_size,
+ c->pic.linesize[i], blk_size);
+ break;
+ case DCT_BLOCK:
+ decode_dct_block(acoder, c->dct_coder + i,
+ dst[i] + x * blk_size,
+ c->pic.linesize[i], blk_size,
+ c->dctblock, x, y);
+ break;
+ case HAAR_BLOCK:
+ decode_haar_block(acoder, c->haar_coder + i,
+ dst[i] + x * blk_size,
+ c->pic.linesize[i], blk_size,
+ c->hblock);
+ break;
+ }
+ if (c->got_error || acoder->got_error) {
+ av_log(avctx, AV_LOG_ERROR, "Error decoding block %d,%d\n",
+ x, y);
+ c->got_error = 1;
+ return AVERROR_INVALIDDATA;
+ }
+ }
+ }
+ dst[0] += c->pic.linesize[0] * 16;
+ dst[1] += c->pic.linesize[1] * 8;
+ dst[2] += c->pic.linesize[2] * 8;
+ }
+
+ *got_frame = 1;
+ *(AVFrame*)data = c->pic;
+
+ return buf_size;
+}
+
+static av_cold int mss3_decode_init(AVCodecContext *avctx)
+{
+ MSS3Context * const c = avctx->priv_data;
+ int i;
+
+ c->avctx = avctx;
+
+ if ((avctx->width & 0xF) || (avctx->height & 0xF)) {
+ av_log(avctx, AV_LOG_ERROR,
+ "Image dimensions should be a multiple of 16.\n");
+ return AVERROR_INVALIDDATA;
+ }
+
+ c->got_error = 0;
+ for (i = 0; i < 3; i++) {
+ int b_width = avctx->width >> (2 + !!i);
+ int b_height = avctx->height >> (2 + !!i);
+ c->dct_coder[i].prev_dc_stride = b_width;
+ c->dct_coder[i].prev_dc_height = b_height;
+ c->dct_coder[i].prev_dc = av_malloc(sizeof(*c->dct_coder[i].prev_dc) *
+ b_width * b_height);
+ if (!c->dct_coder[i].prev_dc) {
+ av_log(avctx, AV_LOG_ERROR, "Cannot allocate buffer\n");
+ while (i >= 0) {
+ av_freep(&c->dct_coder[i].prev_dc);
+ i--;
+ }
+ return AVERROR(ENOMEM);
+ }
+ }
+
+ avctx->pix_fmt = AV_PIX_FMT_YUV420P;
+ avctx->coded_frame = &c->pic;
+
+ init_coders(c);
+
+ return 0;
+}
+
+static av_cold int mss3_decode_end(AVCodecContext *avctx)
+{
+ MSS3Context * const c = avctx->priv_data;
+ int i;
+
+ if (c->pic.data[0])
+ avctx->release_buffer(avctx, &c->pic);
+ for (i = 0; i < 3; i++)
+ av_freep(&c->dct_coder[i].prev_dc);
+
+ return 0;
+}
+
+AVCodec ff_msa1_decoder = {
+ .name = "msa1",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .id = AV_CODEC_ID_MSA1,
+ .priv_data_size = sizeof(MSS3Context),
+ .init = mss3_decode_init,
+ .close = mss3_decode_end,
+ .decode = mss3_decode_frame,
+ .capabilities = CODEC_CAP_DR1,
+ .long_name = NULL_IF_CONFIG_SMALL("MS ATC Screen"),
+};
diff --git a/gst-libs/ext/libav/libavcodec/mss34dsp.c b/gst-libs/ext/libav/libavcodec/mss34dsp.c
new file mode 100644
index 0000000..11abb2d
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/mss34dsp.c
@@ -0,0 +1,114 @@
+/*
+ * Common stuff for some Microsoft Screen codecs
+ * Copyright (C) 2012 Konstantin Shishkov
+ *
+ * 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
+ */
+
+#include <stdint.h>
+#include "libavutil/common.h"
+#include "mss34dsp.h"
+
+static const uint8_t luma_quant[64] = {
+ 16, 11, 10, 16, 24, 40, 51, 61,
+ 12, 12, 14, 19, 26, 58, 60, 55,
+ 14, 13, 16, 24, 40, 57, 69, 56,
+ 14, 17, 22, 29, 51, 87, 80, 62,
+ 18, 22, 37, 56, 68, 109, 103, 77,
+ 24, 35, 55, 64, 81, 104, 113, 92,
+ 49, 64, 78, 87, 103, 121, 120, 101,
+ 72, 92, 95, 98, 112, 100, 103, 99
+};
+
+static const uint8_t chroma_quant[64] = {
+ 17, 18, 24, 47, 99, 99, 99, 99,
+ 18, 21, 26, 66, 99, 99, 99, 99,
+ 24, 26, 56, 99, 99, 99, 99, 99,
+ 47, 66, 99, 99, 99, 99, 99, 99,
+ 99, 99, 99, 99, 99, 99, 99, 99,
+ 99, 99, 99, 99, 99, 99, 99, 99,
+ 99, 99, 99, 99, 99, 99, 99, 99,
+ 99, 99, 99, 99, 99, 99, 99, 99
+};
+
+void ff_mss34_gen_quant_mat(uint16_t *qmat, int quality, int luma)
+{
+ int i;
+ const uint8_t *qsrc = luma ? luma_quant : chroma_quant;
+
+ if (quality >= 50) {
+ int scale = 200 - 2 * quality;
+
+ for (i = 0; i < 64; i++)
+ qmat[i] = (qsrc[i] * scale + 50) / 100;
+ } else {
+ for (i = 0; i < 64; i++)
+ qmat[i] = (5000 * qsrc[i] / quality + 50) / 100;
+ }
+}
+
+#define DCT_TEMPLATE(blk, step, SOP, shift) \
+ const int t0 = -39409 * blk[7 * step] - 58980 * blk[1 * step]; \
+ const int t1 = 39410 * blk[1 * step] - 58980 * blk[7 * step]; \
+ const int t2 = -33410 * blk[5 * step] - 167963 * blk[3 * step]; \
+ const int t3 = 33410 * blk[3 * step] - 167963 * blk[5 * step]; \
+ const int t4 = blk[3 * step] + blk[7 * step]; \
+ const int t5 = blk[1 * step] + blk[5 * step]; \
+ const int t6 = 77062 * t4 + 51491 * t5; \
+ const int t7 = 77062 * t5 - 51491 * t4; \
+ const int t8 = 35470 * blk[2 * step] - 85623 * blk[6 * step]; \
+ const int t9 = 35470 * blk[6 * step] + 85623 * blk[2 * step]; \
+ const int tA = SOP(blk[0 * step] - blk[4 * step]); \
+ const int tB = SOP(blk[0 * step] + blk[4 * step]); \
+ \
+ blk[0 * step] = ( t1 + t6 + t9 + tB) >> shift; \
+ blk[1 * step] = ( t3 + t7 + t8 + tA) >> shift; \
+ blk[2 * step] = ( t2 + t6 - t8 + tA) >> shift; \
+ blk[3 * step] = ( t0 + t7 - t9 + tB) >> shift; \
+ blk[4 * step] = (-(t0 + t7) - t9 + tB) >> shift; \
+ blk[5 * step] = (-(t2 + t6) - t8 + tA) >> shift; \
+ blk[6 * step] = (-(t3 + t7) + t8 + tA) >> shift; \
+ blk[7 * step] = (-(t1 + t6) + t9 + tB) >> shift; \
+
+#define SOP_ROW(a) ((a) << 16) + 0x2000
+#define SOP_COL(a) ((a + 32) << 16)
+
+void ff_mss34_dct_put(uint8_t *dst, int stride, int *block)
+{
+ int i, j;
+ int *ptr;
+
+ ptr = block;
+ for (i = 0; i < 8; i++) {
+ DCT_TEMPLATE(ptr, 1, SOP_ROW, 13);
+ ptr += 8;
+ }
+
+ ptr = block;
+ for (i = 0; i < 8; i++) {
+ DCT_TEMPLATE(ptr, 8, SOP_COL, 22);
+ ptr++;
+ }
+
+ ptr = block;
+ for (j = 0; j < 8; j++) {
+ for (i = 0; i < 8; i++)
+ dst[i] = av_clip_uint8(ptr[i] + 128);
+ dst += stride;
+ ptr += 8;
+ }
+}
diff --git a/gst-libs/ext/libav/libavcodec/mss34dsp.h b/gst-libs/ext/libav/libavcodec/mss34dsp.h
new file mode 100644
index 0000000..b2cc550
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/mss34dsp.h
@@ -0,0 +1,45 @@
+/*
+ * Common stuff for some Microsoft Screen codecs
+ * Copyright (C) 2012 Konstantin Shishkov
+ *
+ * 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
+ */
+
+#ifndef AVCODEC_MSS34DSP_H
+#define AVCODEC_MSS34DSP_H
+
+#include <stdint.h>
+
+/**
+ * Generate quantisation matrix for given quality.
+ *
+ * @param qmat destination matrix
+ * @param quality quality setting (1-100)
+ * @param luma generate quantisation matrix for luma or chroma
+ */
+void ff_mss34_gen_quant_mat(uint16_t *qmat, int quality, int luma);
+
+/**
+ * Transform and output DCT block.
+ *
+ * @param dst output plane
+ * @param stride output plane stride
+ * @param block block to transform and output
+ */
+void ff_mss34_dct_put(uint8_t *dst, int stride, int *block);
+
+#endif /* AVCODEC_MSS34DSP_H */
diff --git a/gst-libs/ext/libav/libavcodec/mss4.c b/gst-libs/ext/libav/libavcodec/mss4.c
new file mode 100644
index 0000000..7c714cb
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/mss4.c
@@ -0,0 +1,682 @@
+/*
+ * Microsoft Screen 4 (aka Microsoft Expression Encoder Screen) decoder
+ * Copyright (c) 2012 Konstantin Shishkov
+ *
+ * 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
+ * Microsoft Screen 4 (aka Microsoft Titanium Screen 2,
+ * aka Microsoft Expression Encoder Screen) decoder
+ */
+
+#include "avcodec.h"
+#include "bytestream.h"
+#include "dsputil.h"
+#include "get_bits.h"
+#include "mss34dsp.h"
+#include "unary.h"
+
+#define HEADER_SIZE 8
+
+enum FrameType {
+ INTRA_FRAME = 0,
+ INTER_FRAME,
+ SKIP_FRAME
+};
+
+enum BlockType {
+ SKIP_BLOCK = 0,
+ DCT_BLOCK,
+ IMAGE_BLOCK,
+};
+
+enum CachePos {
+ LEFT = 0,
+ TOP_LEFT,
+ TOP,
+};
+
+static const uint8_t mss4_dc_vlc_lens[2][16] = {
+ { 0, 1, 5, 1, 1, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 0, 3, 1, 1, 1, 1, 1, 1, 1, 2, 0, 0, 0, 0, 0, 0 }
+};
+
+static const uint8_t mss4_ac_vlc_lens[2][16] = {
+ { 0, 2, 1, 3, 3, 2, 4, 3, 5, 5, 4, 4, 0, 0, 1, 125 },
+ { 0, 2, 1, 2, 4, 4, 3, 4, 7, 5, 4, 4, 0, 1, 2, 119 }
+};
+
+static const uint8_t mss4_ac_vlc_syms[2][162] = {
+ { 0x01, 0x02, 0x03, 0x00, 0x04, 0x11, 0x05, 0x12,
+ 0x21, 0x31, 0x41, 0x06, 0x13, 0x51, 0x61, 0x07,
+ 0x22, 0x71, 0x14, 0x32, 0x81, 0x91, 0xA1, 0x08,
+ 0x23, 0x42, 0xB1, 0xC1, 0x15, 0x52, 0xD1, 0xF0,
+ 0x24, 0x33, 0x62, 0x72, 0x82, 0x09, 0x0A, 0x16,
+ 0x17, 0x18, 0x19, 0x1A, 0x25, 0x26, 0x27, 0x28,
+ 0x29, 0x2A, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39,
+ 0x3A, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49,
+ 0x4A, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59,
+ 0x5A, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69,
+ 0x6A, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79,
+ 0x7A, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89,
+ 0x8A, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98,
+ 0x99, 0x9A, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7,
+ 0xA8, 0xA9, 0xAA, 0xB2, 0xB3, 0xB4, 0xB5, 0xB6,
+ 0xB7, 0xB8, 0xB9, 0xBA, 0xC2, 0xC3, 0xC4, 0xC5,
+ 0xC6, 0xC7, 0xC8, 0xC9, 0xCA, 0xD2, 0xD3, 0xD4,
+ 0xD5, 0xD6, 0xD7, 0xD8, 0xD9, 0xDA, 0xE1, 0xE2,
+ 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, 0xE8, 0xE9, 0xEA,
+ 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, 0xF8,
+ 0xF9, 0xFA },
+ { 0x00, 0x01, 0x02, 0x03, 0x11, 0x04, 0x05, 0x21,
+ 0x31, 0x06, 0x12, 0x41, 0x51, 0x07, 0x61, 0x71,
+ 0x13, 0x22, 0x32, 0x81, 0x08, 0x14, 0x42, 0x91,
+ 0xA1, 0xB1, 0xC1, 0x09, 0x23, 0x33, 0x52, 0xF0,
+ 0x15, 0x62, 0x72, 0xD1, 0x0A, 0x16, 0x24, 0x34,
+ 0xE1, 0x25, 0xF1, 0x17, 0x18, 0x19, 0x1A, 0x26,
+ 0x27, 0x28, 0x29, 0x2A, 0x35, 0x36, 0x37, 0x38,
+ 0x39, 0x3A, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48,
+ 0x49, 0x4A, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58,
+ 0x59, 0x5A, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68,
+ 0x69, 0x6A, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78,
+ 0x79, 0x7A, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
+ 0x88, 0x89, 0x8A, 0x92, 0x93, 0x94, 0x95, 0x96,
+ 0x97, 0x98, 0x99, 0x9A, 0xA2, 0xA3, 0xA4, 0xA5,
+ 0xA6, 0xA7, 0xA8, 0xA9, 0xAA, 0xB2, 0xB3, 0xB4,
+ 0xB5, 0xB6, 0xB7, 0xB8, 0xB9, 0xBA, 0xC2, 0xC3,
+ 0xC4, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9, 0xCA, 0xD2,
+ 0xD3, 0xD4, 0xD5, 0xD6, 0xD7, 0xD8, 0xD9, 0xDA,
+ 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, 0xE8, 0xE9,
+ 0xEA, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, 0xF8,
+ 0xF9, 0xFA }
+};
+
+static const uint8_t vec_len_syms[2][4] = {
+ { 4, 2, 3, 1 },
+ { 4, 1, 2, 3 }
+};
+
+static const uint8_t mss4_vec_entry_vlc_lens[2][16] = {
+ { 0, 2, 2, 3, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 0, 1, 5, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
+};
+
+static const uint8_t mss4_vec_entry_vlc_syms[2][9] = {
+ { 0, 7, 6, 5, 8, 4, 3, 1, 2 },
+ { 0, 2, 3, 4, 5, 6, 7, 1, 8 }
+};
+
+#define MAX_ENTRIES 162
+
+typedef struct MSS4Context {
+ AVFrame pic;
+ DSPContext dsp;
+
+ VLC dc_vlc[2], ac_vlc[2];
+ VLC vec_entry_vlc[2];
+ int block[64];
+ uint8_t imgbuf[3][16 * 16];
+
+ int quality;
+ uint16_t quant_mat[2][64];
+
+ int *prev_dc[3];
+ int dc_stride[3];
+ int dc_cache[4][4];
+
+ int prev_vec[3][4];
+} MSS4Context;
+
+static av_cold int mss4_init_vlc(VLC *vlc, const uint8_t *lens,
+ const uint8_t *syms, int num_syms)
+{
+ uint8_t bits[MAX_ENTRIES];
+ uint16_t codes[MAX_ENTRIES];
+ int i, j;
+ int prefix = 0, max_bits = 0, idx = 0;
+
+ for (i = 0; i < 16; i++) {
+ for (j = 0; j < lens[i]; j++) {
+ bits[idx] = i + 1;
+ codes[idx] = prefix++;
+ max_bits = i + 1;
+ idx++;
+ }
+ prefix <<= 1;
+ }
+
+ return ff_init_vlc_sparse(vlc, FFMIN(max_bits, 9), num_syms, bits, 1, 1,
+ codes, 2, 2, syms, 1, 1, 0);
+}
+
+static av_cold int mss4_init_vlcs(MSS4Context *ctx)
+{
+ int ret, i;
+
+ for (i = 0; i < 2; i++) {
+ ret = mss4_init_vlc(&ctx->dc_vlc[i], mss4_dc_vlc_lens[i], NULL, 12);
+ if (ret)
+ return ret;
+ ret = mss4_init_vlc(&ctx->ac_vlc[i], mss4_ac_vlc_lens[i],
+ mss4_ac_vlc_syms[i], 162);
+ if (ret)
+ return ret;
+ ret = mss4_init_vlc(&ctx->vec_entry_vlc[i], mss4_vec_entry_vlc_lens[i],
+ mss4_vec_entry_vlc_syms[i], 9);
+ if (ret)
+ return ret;
+ }
+ return 0;
+}
+
+static av_cold void mss4_free_vlcs(MSS4Context *ctx)
+{
+ int i;
+
+ for (i = 0; i < 2; i++) {
+ ff_free_vlc(&ctx->dc_vlc[i]);
+ ff_free_vlc(&ctx->ac_vlc[i]);
+ ff_free_vlc(&ctx->vec_entry_vlc[i]);
+ }
+}
+
+/* This function returns values in the range
+ * (-range + 1; -range/2] U [range/2; range - 1)
+ * i.e.
+ * nbits = 0 -> 0
+ * nbits = 1 -> -1, 1
+ * nbits = 2 -> -3, -2, 2, 3
+ */
+static av_always_inline int get_coeff_bits(GetBitContext *gb, int nbits)
+{
+ int val;
+
+ if (!nbits)
+ return 0;
+
+ val = get_bits(gb, nbits);
+ if (val < (1 << (nbits - 1)))
+ val -= (1 << nbits) - 1;
+
+ return val;
+}
+
+static inline int get_coeff(GetBitContext *gb, VLC *vlc)
+{
+ int val = get_vlc2(gb, vlc->table, vlc->bits, 2);
+
+ return get_coeff_bits(gb, val);
+}
+
+static int mss4_decode_dct(GetBitContext *gb, VLC *dc_vlc, VLC *ac_vlc,
+ int *block, int *dc_cache,
+ int bx, int by, uint16_t *quant_mat)
+{
+ int skip, val, pos = 1, zz_pos, dc;
+
+ memset(block, 0, sizeof(*block) * 64);
+
+ dc = get_coeff(gb, dc_vlc);
+ // DC prediction is the same as in MSS3
+ if (by) {
+ if (bx) {
+ int l, tl, t;
+
+ l = dc_cache[LEFT];
+ tl = dc_cache[TOP_LEFT];
+ t = dc_cache[TOP];
+
+ if (FFABS(t - tl) <= FFABS(l - tl))
+ dc += l;
+ else
+ dc += t;
+ } else {
+ dc += dc_cache[TOP];
+ }
+ } else if (bx) {
+ dc += dc_cache[LEFT];
+ }
+ dc_cache[LEFT] = dc;
+ block[0] = dc * quant_mat[0];
+
+ while (pos < 64) {
+ val = get_vlc2(gb, ac_vlc->table, 9, 2);
+ if (!val)
+ return 0;
+ if (val == -1)
+ return -1;
+ if (val == 0xF0) {
+ pos += 16;
+ continue;
+ }
+ skip = val >> 4;
+ val = get_coeff_bits(gb, val & 0xF);
+ pos += skip;
+ if (pos >= 64)
+ return -1;
+
+ zz_pos = ff_zigzag_direct[pos];
+ block[zz_pos] = val * quant_mat[zz_pos];
+ pos++;
+ }
+
+ return pos == 64 ? 0 : -1;
+}
+
+static int mss4_decode_dct_block(MSS4Context *c, GetBitContext *gb,
+ uint8_t *dst[3], int mb_x, int mb_y)
+{
+ int i, j, k, ret;
+ uint8_t *out = dst[0];
+
+ for (j = 0; j < 2; j++) {
+ for (i = 0; i < 2; i++) {
+ int xpos = mb_x * 2 + i;
+ c->dc_cache[j][TOP_LEFT] = c->dc_cache[j][TOP];
+ c->dc_cache[j][TOP] = c->prev_dc[0][mb_x * 2 + i];
+ ret = mss4_decode_dct(gb, c->dc_vlc, c->ac_vlc, c->block,
+ c->dc_cache[j],
+ xpos, mb_y * 2 + j, c->quant_mat[0]);
+ if (ret)
+ return ret;
+ c->prev_dc[0][mb_x * 2 + i] = c->dc_cache[j][LEFT];
+
+ ff_mss34_dct_put(out + xpos * 8, c->pic.linesize[0],
+ c->block);
+ }
+ out += 8 * c->pic.linesize[0];
+ }
+
+ for (i = 1; i < 3; i++) {
+ c->dc_cache[i + 1][TOP_LEFT] = c->dc_cache[i + 1][TOP];
+ c->dc_cache[i + 1][TOP] = c->prev_dc[i][mb_x];
+ ret = mss4_decode_dct(gb, c->dc_vlc + 1, c->ac_vlc + 1,
+ c->block, c->dc_cache[i + 1], mb_x, mb_y,
+ c->quant_mat[1]);
+ if (ret)
+ return ret;
+ c->prev_dc[i][mb_x] = c->dc_cache[i + 1][LEFT];
+
+ ff_mss34_dct_put(c->imgbuf[i], 8, c->block);
+ out = dst[i] + mb_x * 16;
+ // Since the DCT block is coded as YUV420 and the whole frame as YUV444,
+ // we need to scale chroma.
+ for (j = 0; j < 16; j++) {
+ for (k = 0; k < 8; k++)
+ AV_WN16A(out + k * 2, c->imgbuf[i][k + (j & ~1) * 4] * 0x101);
+ out += c->pic.linesize[i];
+ }
+ }
+
+ return 0;
+}
+
+static void read_vec_pos(GetBitContext *gb, int *vec_pos, int *sel_flag,
+ int *sel_len, int *prev)
+{
+ int i, y_flag = 0;
+
+ for (i = 2; i >= 0; i--) {
+ if (!sel_flag[i]) {
+ vec_pos[i] = 0;
+ continue;
+ }
+ if ((!i && !y_flag) || get_bits1(gb)) {
+ if (sel_len[i] > 0) {
+ int pval = prev[i];
+ vec_pos[i] = get_bits(gb, sel_len[i]);
+ if (vec_pos[i] >= pval)
+ vec_pos[i]++;
+ } else {
+ vec_pos[i] = !prev[i];
+ }
+ y_flag = 1;
+ } else {
+ vec_pos[i] = prev[i];
+ }
+ }
+}
+
+static int get_value_cached(GetBitContext *gb, int vec_pos, uint8_t *vec,
+ int vec_size, int component, int shift, int *prev)
+{
+ if (vec_pos < vec_size)
+ return vec[vec_pos];
+ if (!get_bits1(gb))
+ return prev[component];
+ prev[component] = get_bits(gb, 8 - shift) << shift;
+ return prev[component];
+}
+
+#define MKVAL(vals) (vals[0] | (vals[1] << 3) | (vals[2] << 6))
+
+/* Image mode - the hardest to comprehend MSS4 coding mode.
+ *
+ * In this mode all three 16x16 blocks are coded together with a method
+ * remotely similar to the methods employed in MSS1-MSS3.
+ * The idea is that every component has a vector of 1-4 most common symbols
+ * and an escape mode for reading new value from the bitstream. Decoding
+ * consists of retrieving pixel values from the vector or reading new ones
+ * from the bitstream; depending on flags read from the bitstream, these vector
+ * positions can be updated or reused from the state of the previous line
+ * or previous pixel.
+ */
+static int mss4_decode_image_block(MSS4Context *ctx, GetBitContext *gb,
+ uint8_t *picdst[3], int mb_x, int mb_y)
+{
+ uint8_t vec[3][4];
+ int vec_len[3];
+ int sel_len[3], sel_flag[3];
+ int i, j, k, mode, split;
+ int prev_vec1 = 0, prev_split = 0;
+ int vals[3] = { 0 };
+ int prev_pix[3] = { 0 };
+ int prev_mode[16] = { 0 };
+ uint8_t *dst[3];
+
+ const int val_shift = ctx->quality == 100 ? 0 : 2;
+
+ for (i = 0; i < 3; i++)
+ dst[i] = ctx->imgbuf[i];
+
+ for (i = 0; i < 3; i++) {
+ vec_len[i] = vec_len_syms[!!i][get_unary(gb, 0, 3)];
+ for (j = 0; j < vec_len[i]; j++) {
+ vec[i][j] = get_coeff(gb, &ctx->vec_entry_vlc[!!i]);
+ vec[i][j] += ctx->prev_vec[i][j];
+ ctx->prev_vec[i][j] = vec[i][j];
+ }
+ sel_flag[i] = vec_len[i] > 1;
+ sel_len[i] = vec_len[i] > 2 ? vec_len[i] - 2 : 0;
+ }
+
+ for (j = 0; j < 16; j++) {
+ if (get_bits1(gb)) {
+ split = 0;
+ if (get_bits1(gb)) {
+ prev_mode[0] = 0;
+ vals[0] = vals[1] = vals[2] = 0;
+ mode = 2;
+ } else {
+ mode = get_bits1(gb);
+ if (mode)
+ split = get_bits(gb, 4);
+ }
+ for (i = 0; i < 16; i++) {
+ if (mode <= 1) {
+ vals[0] = prev_mode[i] & 7;
+ vals[1] = (prev_mode[i] >> 3) & 7;
+ vals[2] = prev_mode[i] >> 6;
+ if (mode == 1 && i == split) {
+ read_vec_pos(gb, vals, sel_flag, sel_len, vals);
+ }
+ } else if (mode == 2) {
+ if (get_bits1(gb))
+ read_vec_pos(gb, vals, sel_flag, sel_len, vals);
+ }
+ for (k = 0; k < 3; k++)
+ *dst[k]++ = get_value_cached(gb, vals[k], vec[k],
+ vec_len[k], k,
+ val_shift, prev_pix);
+ prev_mode[i] = MKVAL(vals);
+ }
+ } else {
+ if (get_bits1(gb)) {
+ split = get_bits(gb, 4);
+ if (split >= prev_split)
+ split++;
+ prev_split = split;
+ } else {
+ split = prev_split;
+ }
+ if (split) {
+ vals[0] = prev_mode[0] & 7;
+ vals[1] = (prev_mode[0] >> 3) & 7;
+ vals[2] = prev_mode[0] >> 6;
+ for (i = 0; i < 3; i++) {
+ for (k = 0; k < split; k++) {
+ *dst[i]++ = get_value_cached(gb, vals[i], vec[i],
+ vec_len[i], i, val_shift,
+ prev_pix);
+ prev_mode[k] = MKVAL(vals);
+ }
+ }
+ }
+
+ if (split != 16) {
+ vals[0] = prev_vec1 & 7;
+ vals[1] = (prev_vec1 >> 3) & 7;
+ vals[2] = prev_vec1 >> 6;
+ if (get_bits1(gb)) {
+ read_vec_pos(gb, vals, sel_flag, sel_len, vals);
+ prev_vec1 = MKVAL(vals);
+ }
+ for (i = 0; i < 3; i++) {
+ for (k = 0; k < 16 - split; k++) {
+ *dst[i]++ = get_value_cached(gb, vals[i], vec[i],
+ vec_len[i], i, val_shift,
+ prev_pix);
+ prev_mode[split + k] = MKVAL(vals);
+ }
+ }
+ }
+ }
+ }
+
+ for (i = 0; i < 3; i++)
+ for (j = 0; j < 16; j++)
+ memcpy(picdst[i] + mb_x * 16 + j * ctx->pic.linesize[i],
+ ctx->imgbuf[i] + j * 16, 16);
+
+ return 0;
+}
+
+static inline void mss4_update_dc_cache(MSS4Context *c, int mb_x)
+{
+ int i;
+
+ c->dc_cache[0][TOP] = c->prev_dc[0][mb_x * 2 + 1];
+ c->dc_cache[0][LEFT] = 0;
+ c->dc_cache[1][TOP] = 0;
+ c->dc_cache[1][LEFT] = 0;
+
+ for (i = 0; i < 2; i++)
+ c->prev_dc[0][mb_x * 2 + i] = 0;
+
+ for (i = 1; i < 3; i++) {
+ c->dc_cache[i + 1][TOP] = c->prev_dc[i][mb_x];
+ c->dc_cache[i + 1][LEFT] = 0;
+ c->prev_dc[i][mb_x] = 0;
+ }
+}
+
+static int mss4_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
+ AVPacket *avpkt)
+{
+ const uint8_t *buf = avpkt->data;
+ int buf_size = avpkt->size;
+ MSS4Context *c = avctx->priv_data;
+ GetBitContext gb;
+ GetByteContext bc;
+ uint8_t *dst[3];
+ int width, height, quality, frame_type;
+ int x, y, i, mb_width, mb_height, blk_type;
+ int ret;
+
+ if (buf_size < HEADER_SIZE) {
+ av_log(avctx, AV_LOG_ERROR,
+ "Frame should have at least %d bytes, got %d instead\n",
+ HEADER_SIZE, buf_size);
+ return AVERROR_INVALIDDATA;
+ }
+
+ bytestream2_init(&bc, buf, buf_size);
+ width = bytestream2_get_be16(&bc);
+ height = bytestream2_get_be16(&bc);
+ bytestream2_skip(&bc, 2);
+ quality = bytestream2_get_byte(&bc);
+ frame_type = bytestream2_get_byte(&bc);
+
+ if (width > avctx->width ||
+ height != avctx->height) {
+ av_log(avctx, AV_LOG_ERROR, "Invalid frame dimensions %dx%d\n",
+ width, height);
+ return AVERROR_INVALIDDATA;
+ }
+ if (quality < 1 || quality > 100) {
+ av_log(avctx, AV_LOG_ERROR, "Invalid quality setting %d\n", quality);
+ return AVERROR_INVALIDDATA;
+ }
+ if ((frame_type & ~3) || frame_type == 3) {
+ av_log(avctx, AV_LOG_ERROR, "Invalid frame type %d\n", frame_type);
+ return AVERROR_INVALIDDATA;
+ }
+
+ if (frame_type != SKIP_FRAME && !bytestream2_get_bytes_left(&bc)) {
+ av_log(avctx, AV_LOG_ERROR,
+ "Empty frame found but it is not a skip frame.\n");
+ return AVERROR_INVALIDDATA;
+ }
+
+ c->pic.reference = 3;
+ c->pic.buffer_hints = FF_BUFFER_HINTS_VALID |
+ FF_BUFFER_HINTS_PRESERVE |
+ FF_BUFFER_HINTS_REUSABLE;
+ if ((ret = avctx->reget_buffer(avctx, &c->pic)) < 0) {
+ av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n");
+ return ret;
+ }
+ c->pic.key_frame = (frame_type == INTRA_FRAME);
+ c->pic.pict_type = (frame_type == INTRA_FRAME) ? AV_PICTURE_TYPE_I
+ : AV_PICTURE_TYPE_P;
+ if (frame_type == SKIP_FRAME) {
+ *got_frame = 1;
+ *(AVFrame*)data = c->pic;
+
+ return buf_size;
+ }
+
+ if (c->quality != quality) {
+ c->quality = quality;
+ for (i = 0; i < 2; i++)
+ ff_mss34_gen_quant_mat(c->quant_mat[i], quality, !i);
+ }
+
+ init_get_bits(&gb, buf + HEADER_SIZE, (buf_size - HEADER_SIZE) * 8);
+
+ mb_width = FFALIGN(width, 16) >> 4;
+ mb_height = FFALIGN(height, 16) >> 4;
+ dst[0] = c->pic.data[0];
+ dst[1] = c->pic.data[1];
+ dst[2] = c->pic.data[2];
+
+ memset(c->prev_vec, 0, sizeof(c->prev_vec));
+ for (y = 0; y < mb_height; y++) {
+ memset(c->dc_cache, 0, sizeof(c->dc_cache));
+ for (x = 0; x < mb_width; x++) {
+ blk_type = decode012(&gb);
+ switch (blk_type) {
+ case DCT_BLOCK:
+ if (mss4_decode_dct_block(c, &gb, dst, x, y) < 0) {
+ av_log(avctx, AV_LOG_ERROR,
+ "Error decoding DCT block %d,%d\n",
+ x, y);
+ return AVERROR_INVALIDDATA;
+ }
+ break;
+ case IMAGE_BLOCK:
+ if (mss4_decode_image_block(c, &gb, dst, x, y) < 0) {
+ av_log(avctx, AV_LOG_ERROR,
+ "Error decoding VQ block %d,%d\n",
+ x, y);
+ return AVERROR_INVALIDDATA;
+ }
+ break;
+ case SKIP_BLOCK:
+ if (frame_type == INTRA_FRAME) {
+ av_log(avctx, AV_LOG_ERROR, "Skip block in intra frame\n");
+ return AVERROR_INVALIDDATA;
+ }
+ break;
+ }
+ if (blk_type != DCT_BLOCK)
+ mss4_update_dc_cache(c, x);
+ }
+ dst[0] += c->pic.linesize[0] * 16;
+ dst[1] += c->pic.linesize[1] * 16;
+ dst[2] += c->pic.linesize[2] * 16;
+ }
+
+ *got_frame = 1;
+ *(AVFrame*)data = c->pic;
+
+ return buf_size;
+}
+
+static av_cold int mss4_decode_init(AVCodecContext *avctx)
+{
+ MSS4Context * const c = avctx->priv_data;
+ int i;
+
+ if (mss4_init_vlcs(c)) {
+ av_log(avctx, AV_LOG_ERROR, "Cannot initialise VLCs\n");
+ mss4_free_vlcs(c);
+ return AVERROR(ENOMEM);
+ }
+ for (i = 0; i < 3; i++) {
+ c->dc_stride[i] = FFALIGN(avctx->width, 16) >> (2 + !!i);
+ c->prev_dc[i] = av_malloc(sizeof(**c->prev_dc) * c->dc_stride[i]);
+ if (!c->prev_dc[i]) {
+ av_log(avctx, AV_LOG_ERROR, "Cannot allocate buffer\n");
+ mss4_free_vlcs(c);
+ return AVERROR(ENOMEM);
+ }
+ }
+
+ avctx->pix_fmt = AV_PIX_FMT_YUV444P;
+ avctx->coded_frame = &c->pic;
+
+ return 0;
+}
+
+static av_cold int mss4_decode_end(AVCodecContext *avctx)
+{
+ MSS4Context * const c = avctx->priv_data;
+ int i;
+
+ if (c->pic.data[0])
+ avctx->release_buffer(avctx, &c->pic);
+ for (i = 0; i < 3; i++)
+ av_freep(&c->prev_dc[i]);
+ mss4_free_vlcs(c);
+
+ return 0;
+}
+
+AVCodec ff_mts2_decoder = {
+ .name = "mts2",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .id = AV_CODEC_ID_MTS2,
+ .priv_data_size = sizeof(MSS4Context),
+ .init = mss4_decode_init,
+ .close = mss4_decode_end,
+ .decode = mss4_decode_frame,
+ .capabilities = CODEC_CAP_DR1,
+ .long_name = NULL_IF_CONFIG_SMALL("MS Expression Encoder Screen"),
+};
diff --git a/gst-libs/ext/libav/libavcodec/msvideo1.c b/gst-libs/ext/libav/libavcodec/msvideo1.c
index a5fef4d..860a893 100644
--- a/gst-libs/ext/libav/libavcodec/msvideo1.c
+++ b/gst-libs/ext/libav/libavcodec/msvideo1.c
@@ -31,6 +31,7 @@
#include <stdlib.h>
#include <string.h>
+#include "libavutil/internal.h"
#include "libavutil/intreadwrite.h"
#include "avcodec.h"
@@ -64,10 +65,10 @@ static av_cold int msvideo1_decode_init(AVCodecContext *avctx)
/* figure out the colorspace based on the presence of a palette */
if (s->avctx->bits_per_coded_sample == 8) {
s->mode_8bit = 1;
- avctx->pix_fmt = PIX_FMT_PAL8;
+ avctx->pix_fmt = AV_PIX_FMT_PAL8;
} else {
s->mode_8bit = 0;
- avctx->pix_fmt = PIX_FMT_RGB555;
+ avctx->pix_fmt = AV_PIX_FMT_RGB555;
}
s->frame.data[0] = NULL;
@@ -171,7 +172,7 @@ static void msvideo1_decode_8bit(Msvideo1Context *s)
}
/* make the palette available on the way out */
- if (s->avctx->pix_fmt == PIX_FMT_PAL8)
+ if (s->avctx->pix_fmt == AV_PIX_FMT_PAL8)
memcpy(s->frame.data[1], s->pal, AVPALETTE_SIZE);
}
@@ -285,7 +286,7 @@ static void msvideo1_decode_16bit(Msvideo1Context *s)
}
static int msvideo1_decode_frame(AVCodecContext *avctx,
- void *data, int *data_size,
+ void *data, int *got_frame,
AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
@@ -316,7 +317,7 @@ static int msvideo1_decode_frame(AVCodecContext *avctx,
else
msvideo1_decode_16bit(s);
- *data_size = sizeof(AVFrame);
+ *got_frame = 1;
*(AVFrame*)data = s->frame;
/* report that the buffer was completely consumed */
@@ -336,11 +337,11 @@ static av_cold int msvideo1_decode_end(AVCodecContext *avctx)
AVCodec ff_msvideo1_decoder = {
.name = "msvideo1",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_MSVIDEO1,
+ .id = AV_CODEC_ID_MSVIDEO1,
.priv_data_size = sizeof(Msvideo1Context),
.init = msvideo1_decode_init,
.close = msvideo1_decode_end,
.decode = msvideo1_decode_frame,
.capabilities = CODEC_CAP_DR1,
- .long_name= NULL_IF_CONFIG_SMALL("Microsoft Video 1"),
+ .long_name = NULL_IF_CONFIG_SMALL("Microsoft Video 1"),
};
diff --git a/gst-libs/ext/libav/libavcodec/mxpegdec.c b/gst-libs/ext/libav/libavcodec/mxpegdec.c
index 6f0d045..d81e9fc 100644
--- a/gst-libs/ext/libav/libavcodec/mxpegdec.c
+++ b/gst-libs/ext/libav/libavcodec/mxpegdec.c
@@ -25,6 +25,7 @@
* MxPEG decoder
*/
+#include "internal.h"
#include "mjpeg.h"
#include "mjpegdec.h"
@@ -155,7 +156,7 @@ static int mxpeg_check_dimensions(MXpegDecodeContext *s, MJpegDecodeContext *jpg
}
static int mxpeg_decode_frame(AVCodecContext *avctx,
- void *data, int *data_size,
+ void *data, int *got_frame,
AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
@@ -249,7 +250,7 @@ static int mxpeg_decode_frame(AVCodecContext *avctx,
/* use stored SOF data to allocate current picture */
if (jpg->picture_ptr->data[0])
avctx->release_buffer(avctx, jpg->picture_ptr);
- if (avctx->get_buffer(avctx, jpg->picture_ptr) < 0) {
+ if (ff_get_buffer(avctx, jpg->picture_ptr) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return AVERROR(ENOMEM);
}
@@ -268,7 +269,7 @@ static int mxpeg_decode_frame(AVCodecContext *avctx,
/* allocate dummy reference picture if needed */
if (!reference_ptr->data[0] &&
- avctx->get_buffer(avctx, reference_ptr) < 0) {
+ ff_get_buffer(avctx, reference_ptr) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return AVERROR(ENOMEM);
}
@@ -292,7 +293,7 @@ static int mxpeg_decode_frame(AVCodecContext *avctx,
the_end:
if (jpg->got_picture) {
- *data_size = sizeof(AVFrame);
+ *got_frame = 1;
*picture = *jpg->picture_ptr;
s->picture_index ^= 1;
jpg->picture_ptr = &s->picture[s->picture_index];
@@ -301,7 +302,7 @@ the_end:
if (!s->got_mxm_bitmask)
s->has_complete_frame = 1;
else
- *data_size = 0;
+ *got_frame = 0;
}
}
@@ -332,11 +333,10 @@ AVCodec ff_mxpeg_decoder = {
.name = "mxpeg",
.long_name = NULL_IF_CONFIG_SMALL("Mobotix MxPEG video"),
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_MXPEG,
+ .id = AV_CODEC_ID_MXPEG,
.priv_data_size = sizeof(MXpegDecodeContext),
.init = mxpeg_decode_init,
.close = mxpeg_decode_end,
.decode = mxpeg_decode_frame,
.capabilities = CODEC_CAP_DR1,
- .max_lowres = 3
};
diff --git a/gst-libs/ext/libav/libavcodec/nellymoser.c b/gst-libs/ext/libav/libavcodec/nellymoser.c
index cbcc4f9..195e2e8 100644
--- a/gst-libs/ext/libav/libavcodec/nellymoser.c
+++ b/gst-libs/ext/libav/libavcodec/nellymoser.c
@@ -223,4 +223,3 @@ void ff_nelly_get_sample_bits(const float *buf, int *bits)
bits[i] = 0;
}
}
-
diff --git a/gst-libs/ext/libav/libavcodec/nellymoserdec.c b/gst-libs/ext/libav/libavcodec/nellymoserdec.c
index 69c1b86..b6aa6f5 100644
--- a/gst-libs/ext/libav/libavcodec/nellymoserdec.c
+++ b/gst-libs/ext/libav/libavcodec/nellymoserdec.c
@@ -31,14 +31,15 @@
* implementors. The original code is available from http://code.google.com/p/nelly2pcm/
*/
-#include "nellymoser.h"
+#include "libavutil/channel_layout.h"
#include "libavutil/lfg.h"
#include "libavutil/random_seed.h"
-#include "libavutil/audioconvert.h"
#include "avcodec.h"
#include "dsputil.h"
#include "fft.h"
#include "fmtconvert.h"
+#include "internal.h"
+#include "nellymoser.h"
#include "sinewin.h"
#define BITSTREAM_READER_LE
@@ -48,15 +49,14 @@
typedef struct NellyMoserDecodeContext {
AVCodecContext* avctx;
AVFrame frame;
- float *float_buf;
- DECLARE_ALIGNED(16, float, state)[NELLY_BUF_LEN];
AVLFG random_state;
GetBitContext gb;
float scale_bias;
DSPContext dsp;
FFTContext imdct_ctx;
- FmtConvertContext fmt_conv;
- DECLARE_ALIGNED(32, float, imdct_out)[NELLY_BUF_LEN * 2];
+ DECLARE_ALIGNED(32, float, imdct_buf)[2][NELLY_BUF_LEN];
+ float *imdct_out;
+ float *imdct_prev;
} NellyMoserDecodeContext;
static void nelly_decode_block(NellyMoserDecodeContext *s,
@@ -106,12 +106,9 @@ static void nelly_decode_block(NellyMoserDecodeContext *s,
memset(&aptr[NELLY_FILL_LEN], 0,
(NELLY_BUF_LEN - NELLY_FILL_LEN) * sizeof(float));
- s->imdct_ctx.imdct_calc(&s->imdct_ctx, s->imdct_out, aptr);
- /* XXX: overlapping and windowing should be part of a more
- generic imdct function */
- s->dsp.vector_fmul_reverse(s->state, s->state, ff_sine_128, NELLY_BUF_LEN);
- s->dsp.vector_fmul_add(aptr, s->imdct_out, ff_sine_128, s->state, NELLY_BUF_LEN);
- memcpy(s->state, s->imdct_out + NELLY_BUF_LEN, sizeof(float)*NELLY_BUF_LEN);
+ s->imdct_ctx.imdct_half(&s->imdct_ctx, s->imdct_out, aptr);
+ s->dsp.vector_fmul_window(aptr, s->imdct_prev + NELLY_BUF_LEN/2, s->imdct_out, ff_sine_128, NELLY_BUF_LEN/2);
+ FFSWAP(float *, s->imdct_out, s->imdct_prev);
}
}
@@ -119,29 +116,21 @@ static av_cold int decode_init(AVCodecContext * avctx) {
NellyMoserDecodeContext *s = avctx->priv_data;
s->avctx = avctx;
+ s->imdct_out = s->imdct_buf[0];
+ s->imdct_prev = s->imdct_buf[1];
av_lfg_init(&s->random_state, 0);
ff_mdct_init(&s->imdct_ctx, 8, 1, 1.0);
- dsputil_init(&s->dsp, avctx);
-
- if (avctx->request_sample_fmt == AV_SAMPLE_FMT_FLT) {
- s->scale_bias = 1.0/(32768*8);
- avctx->sample_fmt = AV_SAMPLE_FMT_FLT;
- } else {
- s->scale_bias = 1.0/(1*8);
- avctx->sample_fmt = AV_SAMPLE_FMT_S16;
- ff_fmt_convert_init(&s->fmt_conv, avctx);
- s->float_buf = av_mallocz(NELLY_SAMPLES * sizeof(*s->float_buf));
- if (!s->float_buf) {
- av_log(avctx, AV_LOG_ERROR, "error allocating float buffer\n");
- return AVERROR(ENOMEM);
- }
- }
+ ff_dsputil_init(&s->dsp, avctx);
+
+ s->scale_bias = 1.0/(32768*8);
+ avctx->sample_fmt = AV_SAMPLE_FMT_FLT;
/* Generate overlap window */
if (!ff_sine_128[127])
ff_init_ff_sine_windows(7);
+ avctx->channels = 1;
avctx->channel_layout = AV_CH_LAYOUT_MONO;
avcodec_get_frame_defaults(&s->frame);
@@ -157,7 +146,6 @@ static int decode_tag(AVCodecContext *avctx, void *data,
int buf_size = avpkt->size;
NellyMoserDecodeContext *s = avctx->priv_data;
int blocks, i, ret;
- int16_t *samples_s16;
float *samples_flt;
blocks = buf_size / NELLY_BLOCK_LEN;
@@ -179,22 +167,15 @@ static int decode_tag(AVCodecContext *avctx, void *data,
/* get output buffer */
s->frame.nb_samples = NELLY_SAMPLES * blocks;
- if ((ret = avctx->get_buffer(avctx, &s->frame)) < 0) {
+ if ((ret = ff_get_buffer(avctx, &s->frame)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return ret;
}
- samples_s16 = (int16_t *)s->frame.data[0];
samples_flt = (float *)s->frame.data[0];
for (i=0 ; i<blocks ; i++) {
- if (avctx->sample_fmt == AV_SAMPLE_FMT_FLT) {
- nelly_decode_block(s, buf, samples_flt);
- samples_flt += NELLY_SAMPLES;
- } else {
- nelly_decode_block(s, buf, s->float_buf);
- s->fmt_conv.float_to_int16(samples_s16, s->float_buf, NELLY_SAMPLES);
- samples_s16 += NELLY_SAMPLES;
- }
+ nelly_decode_block(s, buf, samples_flt);
+ samples_flt += NELLY_SAMPLES;
buf += NELLY_BLOCK_LEN;
}
@@ -207,7 +188,6 @@ static int decode_tag(AVCodecContext *avctx, void *data,
static av_cold int decode_end(AVCodecContext * avctx) {
NellyMoserDecodeContext *s = avctx->priv_data;
- av_freep(&s->float_buf);
ff_mdct_end(&s->imdct_ctx);
return 0;
@@ -216,15 +196,13 @@ static av_cold int decode_end(AVCodecContext * avctx) {
AVCodec ff_nellymoser_decoder = {
.name = "nellymoser",
.type = AVMEDIA_TYPE_AUDIO,
- .id = CODEC_ID_NELLYMOSER,
+ .id = AV_CODEC_ID_NELLYMOSER,
.priv_data_size = sizeof(NellyMoserDecodeContext),
.init = decode_init,
.close = decode_end,
.decode = decode_tag,
.capabilities = CODEC_CAP_DR1 | CODEC_CAP_PARAM_CHANGE,
- .long_name = NULL_IF_CONFIG_SMALL("Nellymoser Asao"),
+ .long_name = NULL_IF_CONFIG_SMALL("Nellymoser Asao"),
.sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLT,
- AV_SAMPLE_FMT_S16,
AV_SAMPLE_FMT_NONE },
};
-
diff --git a/gst-libs/ext/libav/libavcodec/nellymoserenc.c b/gst-libs/ext/libav/libavcodec/nellymoserenc.c
index d3715ac..1222826 100644
--- a/gst-libs/ext/libav/libavcodec/nellymoserenc.c
+++ b/gst-libs/ext/libav/libavcodec/nellymoserenc.c
@@ -35,11 +35,14 @@
* http://wiki.multimedia.cx/index.php?title=Nellymoser
*/
+#include "libavutil/float_dsp.h"
#include "libavutil/mathematics.h"
#include "nellymoser.h"
#include "avcodec.h"
+#include "audio_frame_queue.h"
#include "dsputil.h"
#include "fft.h"
+#include "internal.h"
#include "sinewin.h"
#define BITSTREAM_WRITER_LE
@@ -52,13 +55,13 @@
typedef struct NellyMoserEncodeContext {
AVCodecContext *avctx;
int last_frame;
- int bufsel;
- int have_saved;
DSPContext dsp;
+ AVFloatDSPContext fdsp;
FFTContext mdct_ctx;
+ AudioFrameQueue afq;
DECLARE_ALIGNED(32, float, mdct_out)[NELLY_SAMPLES];
DECLARE_ALIGNED(32, float, in_buff)[NELLY_SAMPLES];
- DECLARE_ALIGNED(32, float, buf)[2][3 * NELLY_BUF_LEN]; ///< sample buffer
+ DECLARE_ALIGNED(32, float, buf)[3 * NELLY_BUF_LEN]; ///< sample buffer
float (*opt )[NELLY_BANDS];
uint8_t (*path)[NELLY_BANDS];
} NellyMoserEncodeContext;
@@ -115,26 +118,45 @@ static const uint8_t quant_lut_offset[8] = { 0, 0, 1, 4, 11, 32, 81, 230 };
static void apply_mdct(NellyMoserEncodeContext *s)
{
- s->dsp.vector_fmul(s->in_buff, s->buf[s->bufsel], ff_sine_128, NELLY_BUF_LEN);
- s->dsp.vector_fmul_reverse(s->in_buff + NELLY_BUF_LEN, s->buf[s->bufsel] + NELLY_BUF_LEN, ff_sine_128,
- NELLY_BUF_LEN);
+ float *in0 = s->buf;
+ float *in1 = s->buf + NELLY_BUF_LEN;
+ float *in2 = s->buf + 2 * NELLY_BUF_LEN;
+
+ s->fdsp.vector_fmul (s->in_buff, in0, ff_sine_128, NELLY_BUF_LEN);
+ s->dsp.vector_fmul_reverse(s->in_buff + NELLY_BUF_LEN, in1, ff_sine_128, NELLY_BUF_LEN);
s->mdct_ctx.mdct_calc(&s->mdct_ctx, s->mdct_out, s->in_buff);
- s->dsp.vector_fmul(s->buf[s->bufsel] + NELLY_BUF_LEN, s->buf[s->bufsel] + NELLY_BUF_LEN,
- ff_sine_128, NELLY_BUF_LEN);
- s->dsp.vector_fmul_reverse(s->buf[s->bufsel] + 2 * NELLY_BUF_LEN, s->buf[1 - s->bufsel], ff_sine_128,
- NELLY_BUF_LEN);
- s->mdct_ctx.mdct_calc(&s->mdct_ctx, s->mdct_out + NELLY_BUF_LEN, s->buf[s->bufsel] + NELLY_BUF_LEN);
+ s->fdsp.vector_fmul (s->in_buff, in1, ff_sine_128, NELLY_BUF_LEN);
+ s->dsp.vector_fmul_reverse(s->in_buff + NELLY_BUF_LEN, in2, ff_sine_128, NELLY_BUF_LEN);
+ s->mdct_ctx.mdct_calc(&s->mdct_ctx, s->mdct_out + NELLY_BUF_LEN, s->in_buff);
+}
+
+static av_cold int encode_end(AVCodecContext *avctx)
+{
+ NellyMoserEncodeContext *s = avctx->priv_data;
+
+ ff_mdct_end(&s->mdct_ctx);
+
+ if (s->avctx->trellis) {
+ av_free(s->opt);
+ av_free(s->path);
+ }
+ ff_af_queue_close(&s->afq);
+#if FF_API_OLD_ENCODE_AUDIO
+ av_freep(&avctx->coded_frame);
+#endif
+
+ return 0;
}
static av_cold int encode_init(AVCodecContext *avctx)
{
NellyMoserEncodeContext *s = avctx->priv_data;
- int i;
+ int i, ret;
if (avctx->channels != 1) {
av_log(avctx, AV_LOG_ERROR, "Nellymoser supports only 1 channel\n");
- return -1;
+ return AVERROR(EINVAL);
}
if (avctx->sample_rate != 8000 && avctx->sample_rate != 16000 &&
@@ -142,13 +164,17 @@ static av_cold int encode_init(AVCodecContext *avctx)
avctx->sample_rate != 22050 && avctx->sample_rate != 44100 &&
avctx->strict_std_compliance >= FF_COMPLIANCE_NORMAL) {
av_log(avctx, AV_LOG_ERROR, "Nellymoser works only with 8000, 16000, 11025, 22050 and 44100 sample rate\n");
- return -1;
+ return AVERROR(EINVAL);
}
avctx->frame_size = NELLY_SAMPLES;
+ avctx->delay = NELLY_BUF_LEN;
+ ff_af_queue_init(avctx, &s->afq);
s->avctx = avctx;
- ff_mdct_init(&s->mdct_ctx, 8, 0, 32768.0);
- dsputil_init(&s->dsp, avctx);
+ if ((ret = ff_mdct_init(&s->mdct_ctx, 8, 0, 32768.0)) < 0)
+ goto error;
+ ff_dsputil_init(&s->dsp, avctx);
+ avpriv_float_dsp_init(&s->fdsp, avctx->flags & CODEC_FLAG_BITEXACT);
/* Generate overlap window */
ff_sine_window_init(ff_sine_128, 128);
@@ -158,23 +184,24 @@ static av_cold int encode_init(AVCodecContext *avctx)
if (s->avctx->trellis) {
s->opt = av_malloc(NELLY_BANDS * OPT_SIZE * sizeof(float ));
s->path = av_malloc(NELLY_BANDS * OPT_SIZE * sizeof(uint8_t));
+ if (!s->opt || !s->path) {
+ ret = AVERROR(ENOMEM);
+ goto error;
+ }
}
- return 0;
-}
-
-static av_cold int encode_end(AVCodecContext *avctx)
-{
- NellyMoserEncodeContext *s = avctx->priv_data;
-
- ff_mdct_end(&s->mdct_ctx);
-
- if (s->avctx->trellis) {
- av_free(s->opt);
- av_free(s->path);
+#if FF_API_OLD_ENCODE_AUDIO
+ avctx->coded_frame = avcodec_alloc_frame();
+ if (!avctx->coded_frame) {
+ ret = AVERROR(ENOMEM);
+ goto error;
}
+#endif
return 0;
+error:
+ encode_end(avctx);
+ return ret;
}
#define find_best(val, table, LUT, LUT_add, LUT_size) \
@@ -348,49 +375,59 @@ static void encode_block(NellyMoserEncodeContext *s, unsigned char *output, int
}
flush_put_bits(&pb);
+ memset(put_bits_ptr(&pb), 0, output + output_size - put_bits_ptr(&pb));
}
-static int encode_frame(AVCodecContext *avctx, uint8_t *frame, int buf_size, void *data)
+static int encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
+ const AVFrame *frame, int *got_packet_ptr)
{
NellyMoserEncodeContext *s = avctx->priv_data;
- const float *samples = data;
- int i;
+ int ret;
if (s->last_frame)
return 0;
- if (data) {
- memcpy(s->buf[s->bufsel], samples, avctx->frame_size * sizeof(*samples));
- for (i = avctx->frame_size; i < NELLY_SAMPLES; i++) {
- s->buf[s->bufsel][i] = 0;
- }
- s->bufsel = 1 - s->bufsel;
- if (!s->have_saved) {
- s->have_saved = 1;
- return 0;
+ memcpy(s->buf, s->buf + NELLY_SAMPLES, NELLY_BUF_LEN * sizeof(*s->buf));
+ if (frame) {
+ memcpy(s->buf + NELLY_BUF_LEN, frame->data[0],
+ frame->nb_samples * sizeof(*s->buf));
+ if (frame->nb_samples < NELLY_SAMPLES) {
+ memset(s->buf + NELLY_BUF_LEN + frame->nb_samples, 0,
+ (NELLY_SAMPLES - frame->nb_samples) * sizeof(*s->buf));
+ if (frame->nb_samples >= NELLY_BUF_LEN)
+ s->last_frame = 1;
}
+ if ((ret = ff_af_queue_add(&s->afq, frame)) < 0)
+ return ret;
} else {
- memset(s->buf[s->bufsel], 0, sizeof(s->buf[0][0]) * NELLY_BUF_LEN);
- s->bufsel = 1 - s->bufsel;
+ memset(s->buf + NELLY_BUF_LEN, 0, NELLY_SAMPLES * sizeof(*s->buf));
s->last_frame = 1;
}
- if (s->have_saved) {
- encode_block(s, frame, buf_size);
- return NELLY_BLOCK_LEN;
+ if ((ret = ff_alloc_packet(avpkt, NELLY_BLOCK_LEN))) {
+ av_log(avctx, AV_LOG_ERROR, "Error getting output packet\n");
+ return ret;
}
+ encode_block(s, avpkt->data, avpkt->size);
+
+ /* Get the next frame pts/duration */
+ ff_af_queue_remove(&s->afq, avctx->frame_size, &avpkt->pts,
+ &avpkt->duration);
+
+ *got_packet_ptr = 1;
return 0;
}
AVCodec ff_nellymoser_encoder = {
- .name = "nellymoser",
- .type = AVMEDIA_TYPE_AUDIO,
- .id = CODEC_ID_NELLYMOSER,
+ .name = "nellymoser",
+ .type = AVMEDIA_TYPE_AUDIO,
+ .id = AV_CODEC_ID_NELLYMOSER,
.priv_data_size = sizeof(NellyMoserEncodeContext),
- .init = encode_init,
- .encode = encode_frame,
- .close = encode_end,
- .capabilities = CODEC_CAP_SMALL_LAST_FRAME | CODEC_CAP_DELAY,
- .long_name = NULL_IF_CONFIG_SMALL("Nellymoser Asao"),
- .sample_fmts = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_FLT,AV_SAMPLE_FMT_NONE},
+ .init = encode_init,
+ .encode2 = encode_frame,
+ .close = encode_end,
+ .capabilities = CODEC_CAP_SMALL_LAST_FRAME | CODEC_CAP_DELAY,
+ .long_name = NULL_IF_CONFIG_SMALL("Nellymoser Asao"),
+ .sample_fmts = (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_FLT,
+ AV_SAMPLE_FMT_NONE },
};
diff --git a/gst-libs/ext/libav/libavcodec/noise_bsf.c b/gst-libs/ext/libav/libavcodec/noise_bsf.c
index 489e3c7..3e552e2 100644
--- a/gst-libs/ext/libav/libavcodec/noise_bsf.c
+++ b/gst-libs/ext/libav/libavcodec/noise_bsf.c
@@ -18,7 +18,11 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <stdlib.h>
+#include <string.h>
+
#include "avcodec.h"
+#include "libavutil/mem.h"
static int noise(AVBitStreamFilterContext *bsfc, AVCodecContext *avctx, const char *args,
diff --git a/gst-libs/ext/libav/libavcodec/nuv.c b/gst-libs/ext/libav/libavcodec/nuv.c
index 519b550..0b47e97 100644
--- a/gst-libs/ext/libav/libavcodec/nuv.c
+++ b/gst-libs/ext/libav/libavcodec/nuv.c
@@ -18,10 +18,12 @@
* License along with Libav; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+
#include <stdio.h>
#include <stdlib.h>
#include "libavutil/bswap.h"
+#include "libavutil/common.h"
#include "libavutil/lzo.h"
#include "libavutil/imgutils.h"
#include "avcodec.h"
@@ -34,7 +36,7 @@ typedef struct {
int quality;
int width, height;
unsigned int decomp_size;
- unsigned char* decomp_buf;
+ unsigned char *decomp_buf;
uint32_t lq[64], cq[64];
RTJpegContext rtj;
DSPContext dsp;
@@ -69,18 +71,19 @@ static const uint8_t fallback_cquant[] = {
* @param width width of the video frame
* @param height height of the video frame
*/
-static void copy_frame(AVFrame *f, const uint8_t *src,
- int width, int height) {
+static void copy_frame(AVFrame *f, const uint8_t *src, int width, int height)
+{
AVPicture pic;
- avpicture_fill(&pic, src, PIX_FMT_YUV420P, width, height);
- av_picture_copy((AVPicture *)f, &pic, PIX_FMT_YUV420P, width, height);
+ avpicture_fill(&pic, src, AV_PIX_FMT_YUV420P, width, height);
+ av_picture_copy((AVPicture *)f, &pic, AV_PIX_FMT_YUV420P, width, height);
}
/**
* @brief extract quantization tables from codec data into our context
*/
-static int get_quant(AVCodecContext *avctx, NuvContext *c,
- const uint8_t *buf, int size) {
+static int get_quant(AVCodecContext *avctx, NuvContext *c, const uint8_t *buf,
+ int size)
+{
int i;
if (size < 2 * 64 * 4) {
av_log(avctx, AV_LOG_ERROR, "insufficient rtjpeg quant data\n");
@@ -96,7 +99,8 @@ static int get_quant(AVCodecContext *avctx, NuvContext *c,
/**
* @brief set quantization tables from a quality value
*/
-static void get_quant_quality(NuvContext *c, int quality) {
+static void get_quant_quality(NuvContext *c, int quality)
+{
int i;
quality = FFMAX(quality, 1);
for (i = 0; i < 64; i++) {
@@ -105,7 +109,9 @@ static void get_quant_quality(NuvContext *c, int quality) {
}
}
-static int codec_reinit(AVCodecContext *avctx, int width, int height, int quality) {
+static int codec_reinit(AVCodecContext *avctx, int width, int height,
+ int quality)
+{
NuvContext *c = avctx->priv_data;
width = FFALIGN(width, 2);
height = FFALIGN(height, 2);
@@ -114,31 +120,42 @@ static int codec_reinit(AVCodecContext *avctx, int width, int height, int qualit
if (width != c->width || height != c->height) {
if (av_image_check_size(height, width, 0, avctx) < 0)
return 0;
- avctx->width = c->width = width;
+ avctx->width = c->width = width;
avctx->height = c->height = height;
- av_fast_malloc(&c->decomp_buf, &c->decomp_size, c->height * c->width * 3 / 2);
+ av_fast_malloc(&c->decomp_buf, &c->decomp_size,
+ c->height * c->width * 3 / 2);
if (!c->decomp_buf) {
- av_log(avctx, AV_LOG_ERROR, "Can't allocate decompression buffer.\n");
+ av_log(avctx, AV_LOG_ERROR,
+ "Can't allocate decompression buffer.\n");
return 0;
}
- rtjpeg_decode_init(&c->rtj, &c->dsp, c->width, c->height, c->lq, c->cq);
+ ff_rtjpeg_decode_init(&c->rtj, &c->dsp, c->width, c->height,
+ c->lq, c->cq);
} else if (quality != c->quality)
- rtjpeg_decode_init(&c->rtj, &c->dsp, c->width, c->height, c->lq, c->cq);
+ ff_rtjpeg_decode_init(&c->rtj, &c->dsp, c->width, c->height,
+ c->lq, c->cq);
+
return 1;
}
-static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
- AVPacket *avpkt) {
+static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
+ AVPacket *avpkt)
+{
const uint8_t *buf = avpkt->data;
- int buf_size = avpkt->size;
- NuvContext *c = avctx->priv_data;
- AVFrame *picture = data;
- int orig_size = buf_size;
+ int buf_size = avpkt->size;
+ NuvContext *c = avctx->priv_data;
+ AVFrame *picture = data;
+ int orig_size = buf_size;
int keyframe;
int result;
- enum {NUV_UNCOMPRESSED = '0', NUV_RTJPEG = '1',
- NUV_RTJPEG_IN_LZO = '2', NUV_LZO = '3',
- NUV_BLACK = 'N', NUV_COPY_LAST = 'L'} comptype;
+ enum {
+ NUV_UNCOMPRESSED = '0',
+ NUV_RTJPEG = '1',
+ NUV_RTJPEG_IN_LZO = '2',
+ NUV_LZO = '3',
+ NUV_BLACK = 'N',
+ NUV_COPY_LAST = 'L'
+ } comptype;
if (buf_size < 12) {
av_log(avctx, AV_LOG_ERROR, "coded frame too small\n");
@@ -149,12 +166,13 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
if (buf[0] == 'D' && buf[1] == 'R') {
int ret;
// skip rest of the frameheader.
- buf = &buf[12];
+ buf = &buf[12];
buf_size -= 12;
- ret = get_quant(avctx, c, buf, buf_size);
+ ret = get_quant(avctx, c, buf, buf_size);
if (ret < 0)
return ret;
- rtjpeg_decode_init(&c->rtj, &c->dsp, c->width, c->height, c->lq, c->cq);
+ ff_rtjpeg_decode_init(&c->rtj, &c->dsp, c->width, c->height, c->lq,
+ c->cq);
return orig_size;
}
@@ -164,22 +182,25 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
}
comptype = buf[1];
switch (comptype) {
- case NUV_RTJPEG_IN_LZO:
- case NUV_RTJPEG:
- keyframe = !buf[2]; break;
- case NUV_COPY_LAST:
- keyframe = 0; break;
- default:
- keyframe = 1; break;
+ case NUV_RTJPEG_IN_LZO:
+ case NUV_RTJPEG:
+ keyframe = !buf[2];
+ break;
+ case NUV_COPY_LAST:
+ keyframe = 0;
+ break;
+ default:
+ keyframe = 1;
+ break;
}
// skip rest of the frameheader.
- buf = &buf[12];
+ buf = &buf[12];
buf_size -= 12;
if (comptype == NUV_RTJPEG_IN_LZO || comptype == NUV_LZO) {
int outlen = c->decomp_size, inlen = buf_size;
if (av_lzo1x_decode(c->decomp_buf, &outlen, buf, &inlen))
av_log(avctx, AV_LOG_ERROR, "error during lzo decompression\n");
- buf = c->decomp_buf;
+ buf = c->decomp_buf;
buf_size = c->decomp_size;
}
if (c->codec_frameheader) {
@@ -194,14 +215,14 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
q = buf[10];
if (!codec_reinit(avctx, w, h, q))
return -1;
- buf = &buf[RTJPEG_HEADER_SIZE];
+ buf = &buf[RTJPEG_HEADER_SIZE];
buf_size -= RTJPEG_HEADER_SIZE;
}
if (keyframe && c->pic.data[0])
avctx->release_buffer(avctx, &c->pic);
- c->pic.reference = 3;
- c->pic.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_READABLE |
+ c->pic.reference = 3;
+ c->pic.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_READABLE |
FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE;
result = avctx->reget_buffer(avctx, &c->pic);
if (result < 0) {
@@ -213,75 +234,80 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
c->pic.key_frame = keyframe;
// decompress/copy/whatever data
switch (comptype) {
- case NUV_LZO:
- case NUV_UNCOMPRESSED: {
- int height = c->height;
- if (buf_size < c->width * height * 3 / 2) {
- av_log(avctx, AV_LOG_ERROR, "uncompressed frame too short\n");
- height = buf_size / c->width / 3 * 2;
- }
- copy_frame(&c->pic, buf, c->width, height);
- break;
- }
- case NUV_RTJPEG_IN_LZO:
- case NUV_RTJPEG: {
- rtjpeg_decode_frame_yuv420(&c->rtj, &c->pic, buf, buf_size);
- break;
- }
- case NUV_BLACK: {
- memset(c->pic.data[0], 0, c->width * c->height);
- memset(c->pic.data[1], 128, c->width * c->height / 4);
- memset(c->pic.data[2], 128, c->width * c->height / 4);
- break;
+ case NUV_LZO:
+ case NUV_UNCOMPRESSED: {
+ int height = c->height;
+ if (buf_size < c->width * height * 3 / 2) {
+ av_log(avctx, AV_LOG_ERROR, "uncompressed frame too short\n");
+ height = buf_size / c->width / 3 * 2;
}
- case NUV_COPY_LAST: {
- /* nothing more to do here */
- break;
- }
- default:
- av_log(avctx, AV_LOG_ERROR, "unknown compression\n");
- return -1;
+ copy_frame(&c->pic, buf, c->width, height);
+ break;
+ }
+ case NUV_RTJPEG_IN_LZO:
+ case NUV_RTJPEG:
+ ff_rtjpeg_decode_frame_yuv420(&c->rtj, &c->pic, buf, buf_size);
+ break;
+ case NUV_BLACK:
+ memset(c->pic.data[0], 0, c->width * c->height);
+ memset(c->pic.data[1], 128, c->width * c->height / 4);
+ memset(c->pic.data[2], 128, c->width * c->height / 4);
+ break;
+ case NUV_COPY_LAST:
+ /* nothing more to do here */
+ break;
+ default:
+ av_log(avctx, AV_LOG_ERROR, "unknown compression\n");
+ return -1;
}
- *picture = c->pic;
- *data_size = sizeof(AVFrame);
+ *picture = c->pic;
+ *got_frame = 1;
return orig_size;
}
-static av_cold int decode_init(AVCodecContext *avctx) {
- NuvContext *c = avctx->priv_data;
- avctx->pix_fmt = PIX_FMT_YUV420P;
+static av_cold int decode_init(AVCodecContext *avctx)
+{
+ NuvContext *c = avctx->priv_data;
+ avctx->pix_fmt = AV_PIX_FMT_YUV420P;
c->pic.data[0] = NULL;
- c->decomp_buf = NULL;
- c->quality = -1;
- c->width = 0;
- c->height = 0;
+ c->decomp_buf = NULL;
+ c->quality = -1;
+ c->width = 0;
+ c->height = 0;
+
c->codec_frameheader = avctx->codec_tag == MKTAG('R', 'J', 'P', 'G');
+
if (avctx->extradata_size)
get_quant(avctx, c, avctx->extradata, avctx->extradata_size);
- dsputil_init(&c->dsp, avctx);
+
+ ff_dsputil_init(&c->dsp, avctx);
+
if (!codec_reinit(avctx, avctx->width, avctx->height, -1))
return 1;
+
return 0;
}
-static av_cold int decode_end(AVCodecContext *avctx) {
+static av_cold int decode_end(AVCodecContext *avctx)
+{
NuvContext *c = avctx->priv_data;
+
av_freep(&c->decomp_buf);
if (c->pic.data[0])
avctx->release_buffer(avctx, &c->pic);
+
return 0;
}
AVCodec ff_nuv_decoder = {
.name = "nuv",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_NUV,
+ .id = AV_CODEC_ID_NUV,
.priv_data_size = sizeof(NuvContext),
.init = decode_init,
.close = decode_end,
.decode = decode_frame,
.capabilities = CODEC_CAP_DR1,
- .long_name = NULL_IF_CONFIG_SMALL("NuppelVideo/RTJPEG"),
+ .long_name = NULL_IF_CONFIG_SMALL("NuppelVideo/RTJPEG"),
};
-
diff --git a/gst-libs/ext/libav/libavcodec/old_codec_ids.h b/gst-libs/ext/libav/libavcodec/old_codec_ids.h
new file mode 100644
index 0000000..2b72e38
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/old_codec_ids.h
@@ -0,0 +1,366 @@
+/*
+ * 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
+ */
+
+#ifndef AVCODEC_OLD_CODEC_IDS_H
+#define AVCODEC_OLD_CODEC_IDS_H
+
+/*
+ * This header exists to prevent new codec IDs from being accidentally added to
+ * the deprecated list.
+ * Do not include it directly. It will be removed on next major bump
+ *
+ * Do not add new items to this list. Use the AVCodecID enum instead.
+ */
+
+ CODEC_ID_NONE = AV_CODEC_ID_NONE,
+
+ /* video codecs */
+ CODEC_ID_MPEG1VIDEO,
+ CODEC_ID_MPEG2VIDEO, ///< preferred ID for MPEG-1/2 video decoding
+ CODEC_ID_MPEG2VIDEO_XVMC,
+ CODEC_ID_H261,
+ CODEC_ID_H263,
+ CODEC_ID_RV10,
+ CODEC_ID_RV20,
+ CODEC_ID_MJPEG,
+ CODEC_ID_MJPEGB,
+ CODEC_ID_LJPEG,
+ CODEC_ID_SP5X,
+ CODEC_ID_JPEGLS,
+ CODEC_ID_MPEG4,
+ CODEC_ID_RAWVIDEO,
+ CODEC_ID_MSMPEG4V1,
+ CODEC_ID_MSMPEG4V2,
+ CODEC_ID_MSMPEG4V3,
+ CODEC_ID_WMV1,
+ CODEC_ID_WMV2,
+ CODEC_ID_H263P,
+ CODEC_ID_H263I,
+ CODEC_ID_FLV1,
+ CODEC_ID_SVQ1,
+ CODEC_ID_SVQ3,
+ CODEC_ID_DVVIDEO,
+ CODEC_ID_HUFFYUV,
+ CODEC_ID_CYUV,
+ CODEC_ID_H264,
+ CODEC_ID_INDEO3,
+ CODEC_ID_VP3,
+ CODEC_ID_THEORA,
+ CODEC_ID_ASV1,
+ CODEC_ID_ASV2,
+ CODEC_ID_FFV1,
+ CODEC_ID_4XM,
+ CODEC_ID_VCR1,
+ CODEC_ID_CLJR,
+ CODEC_ID_MDEC,
+ CODEC_ID_ROQ,
+ CODEC_ID_INTERPLAY_VIDEO,
+ CODEC_ID_XAN_WC3,
+ CODEC_ID_XAN_WC4,
+ CODEC_ID_RPZA,
+ CODEC_ID_CINEPAK,
+ CODEC_ID_WS_VQA,
+ CODEC_ID_MSRLE,
+ CODEC_ID_MSVIDEO1,
+ CODEC_ID_IDCIN,
+ CODEC_ID_8BPS,
+ CODEC_ID_SMC,
+ CODEC_ID_FLIC,
+ CODEC_ID_TRUEMOTION1,
+ CODEC_ID_VMDVIDEO,
+ CODEC_ID_MSZH,
+ CODEC_ID_ZLIB,
+ CODEC_ID_QTRLE,
+ CODEC_ID_SNOW,
+ CODEC_ID_TSCC,
+ CODEC_ID_ULTI,
+ CODEC_ID_QDRAW,
+ CODEC_ID_VIXL,
+ CODEC_ID_QPEG,
+ CODEC_ID_PNG,
+ CODEC_ID_PPM,
+ CODEC_ID_PBM,
+ CODEC_ID_PGM,
+ CODEC_ID_PGMYUV,
+ CODEC_ID_PAM,
+ CODEC_ID_FFVHUFF,
+ CODEC_ID_RV30,
+ CODEC_ID_RV40,
+ CODEC_ID_VC1,
+ CODEC_ID_WMV3,
+ CODEC_ID_LOCO,
+ CODEC_ID_WNV1,
+ CODEC_ID_AASC,
+ CODEC_ID_INDEO2,
+ CODEC_ID_FRAPS,
+ CODEC_ID_TRUEMOTION2,
+ CODEC_ID_BMP,
+ CODEC_ID_CSCD,
+ CODEC_ID_MMVIDEO,
+ CODEC_ID_ZMBV,
+ CODEC_ID_AVS,
+ CODEC_ID_SMACKVIDEO,
+ CODEC_ID_NUV,
+ CODEC_ID_KMVC,
+ CODEC_ID_FLASHSV,
+ CODEC_ID_CAVS,
+ CODEC_ID_JPEG2000,
+ CODEC_ID_VMNC,
+ CODEC_ID_VP5,
+ CODEC_ID_VP6,
+ CODEC_ID_VP6F,
+ CODEC_ID_TARGA,
+ CODEC_ID_DSICINVIDEO,
+ CODEC_ID_TIERTEXSEQVIDEO,
+ CODEC_ID_TIFF,
+ CODEC_ID_GIF,
+ CODEC_ID_DXA,
+ CODEC_ID_DNXHD,
+ CODEC_ID_THP,
+ CODEC_ID_SGI,
+ CODEC_ID_C93,
+ CODEC_ID_BETHSOFTVID,
+ CODEC_ID_PTX,
+ CODEC_ID_TXD,
+ CODEC_ID_VP6A,
+ CODEC_ID_AMV,
+ CODEC_ID_VB,
+ CODEC_ID_PCX,
+ CODEC_ID_SUNRAST,
+ CODEC_ID_INDEO4,
+ CODEC_ID_INDEO5,
+ CODEC_ID_MIMIC,
+ CODEC_ID_RL2,
+ CODEC_ID_ESCAPE124,
+ CODEC_ID_DIRAC,
+ CODEC_ID_BFI,
+ CODEC_ID_CMV,
+ CODEC_ID_MOTIONPIXELS,
+ CODEC_ID_TGV,
+ CODEC_ID_TGQ,
+ CODEC_ID_TQI,
+ CODEC_ID_AURA,
+ CODEC_ID_AURA2,
+ CODEC_ID_V210X,
+ CODEC_ID_TMV,
+ CODEC_ID_V210,
+ CODEC_ID_DPX,
+ CODEC_ID_MAD,
+ CODEC_ID_FRWU,
+ CODEC_ID_FLASHSV2,
+ CODEC_ID_CDGRAPHICS,
+ CODEC_ID_R210,
+ CODEC_ID_ANM,
+ CODEC_ID_BINKVIDEO,
+ CODEC_ID_IFF_ILBM,
+ CODEC_ID_IFF_BYTERUN1,
+ CODEC_ID_KGV1,
+ CODEC_ID_YOP,
+ CODEC_ID_VP8,
+ CODEC_ID_PICTOR,
+ CODEC_ID_ANSI,
+ CODEC_ID_A64_MULTI,
+ CODEC_ID_A64_MULTI5,
+ CODEC_ID_R10K,
+ CODEC_ID_MXPEG,
+ CODEC_ID_LAGARITH,
+ CODEC_ID_PRORES,
+ CODEC_ID_JV,
+ CODEC_ID_DFA,
+ CODEC_ID_WMV3IMAGE,
+ CODEC_ID_VC1IMAGE,
+ CODEC_ID_UTVIDEO,
+ CODEC_ID_BMV_VIDEO,
+ CODEC_ID_VBLE,
+ CODEC_ID_DXTORY,
+ CODEC_ID_V410,
+ CODEC_ID_XWD,
+ CODEC_ID_CDXL,
+ CODEC_ID_XBM,
+ CODEC_ID_ZEROCODEC,
+ CODEC_ID_MSS1,
+ CODEC_ID_MSA1,
+ CODEC_ID_TSCC2,
+ CODEC_ID_MTS2,
+ CODEC_ID_CLLC,
+
+ /* various PCM "codecs" */
+ CODEC_ID_FIRST_AUDIO = 0x10000, ///< A dummy id pointing at the start of audio codecs
+ CODEC_ID_PCM_S16LE = 0x10000,
+ CODEC_ID_PCM_S16BE,
+ CODEC_ID_PCM_U16LE,
+ CODEC_ID_PCM_U16BE,
+ CODEC_ID_PCM_S8,
+ CODEC_ID_PCM_U8,
+ CODEC_ID_PCM_MULAW,
+ CODEC_ID_PCM_ALAW,
+ CODEC_ID_PCM_S32LE,
+ CODEC_ID_PCM_S32BE,
+ CODEC_ID_PCM_U32LE,
+ CODEC_ID_PCM_U32BE,
+ CODEC_ID_PCM_S24LE,
+ CODEC_ID_PCM_S24BE,
+ CODEC_ID_PCM_U24LE,
+ CODEC_ID_PCM_U24BE,
+ CODEC_ID_PCM_S24DAUD,
+ CODEC_ID_PCM_ZORK,
+ CODEC_ID_PCM_S16LE_PLANAR,
+ CODEC_ID_PCM_DVD,
+ CODEC_ID_PCM_F32BE,
+ CODEC_ID_PCM_F32LE,
+ CODEC_ID_PCM_F64BE,
+ CODEC_ID_PCM_F64LE,
+ CODEC_ID_PCM_BLURAY,
+ CODEC_ID_PCM_LXF,
+ CODEC_ID_S302M,
+ CODEC_ID_PCM_S8_PLANAR,
+
+ /* various ADPCM codecs */
+ CODEC_ID_ADPCM_IMA_QT = 0x11000,
+ CODEC_ID_ADPCM_IMA_WAV,
+ CODEC_ID_ADPCM_IMA_DK3,
+ CODEC_ID_ADPCM_IMA_DK4,
+ CODEC_ID_ADPCM_IMA_WS,
+ CODEC_ID_ADPCM_IMA_SMJPEG,
+ CODEC_ID_ADPCM_MS,
+ CODEC_ID_ADPCM_4XM,
+ CODEC_ID_ADPCM_XA,
+ CODEC_ID_ADPCM_ADX,
+ CODEC_ID_ADPCM_EA,
+ CODEC_ID_ADPCM_G726,
+ CODEC_ID_ADPCM_CT,
+ CODEC_ID_ADPCM_SWF,
+ CODEC_ID_ADPCM_YAMAHA,
+ CODEC_ID_ADPCM_SBPRO_4,
+ CODEC_ID_ADPCM_SBPRO_3,
+ CODEC_ID_ADPCM_SBPRO_2,
+ CODEC_ID_ADPCM_THP,
+ CODEC_ID_ADPCM_IMA_AMV,
+ CODEC_ID_ADPCM_EA_R1,
+ CODEC_ID_ADPCM_EA_R3,
+ CODEC_ID_ADPCM_EA_R2,
+ CODEC_ID_ADPCM_IMA_EA_SEAD,
+ CODEC_ID_ADPCM_IMA_EA_EACS,
+ CODEC_ID_ADPCM_EA_XAS,
+ CODEC_ID_ADPCM_EA_MAXIS_XA,
+ CODEC_ID_ADPCM_IMA_ISS,
+ CODEC_ID_ADPCM_G722,
+ CODEC_ID_ADPCM_IMA_APC,
+
+ /* AMR */
+ CODEC_ID_AMR_NB = 0x12000,
+ CODEC_ID_AMR_WB,
+
+ /* RealAudio codecs*/
+ CODEC_ID_RA_144 = 0x13000,
+ CODEC_ID_RA_288,
+
+ /* various DPCM codecs */
+ CODEC_ID_ROQ_DPCM = 0x14000,
+ CODEC_ID_INTERPLAY_DPCM,
+ CODEC_ID_XAN_DPCM,
+ CODEC_ID_SOL_DPCM,
+
+ /* audio codecs */
+ CODEC_ID_MP2 = 0x15000,
+ CODEC_ID_MP3, ///< preferred ID for decoding MPEG audio layer 1, 2 or 3
+ CODEC_ID_AAC,
+ CODEC_ID_AC3,
+ CODEC_ID_DTS,
+ CODEC_ID_VORBIS,
+ CODEC_ID_DVAUDIO,
+ CODEC_ID_WMAV1,
+ CODEC_ID_WMAV2,
+ CODEC_ID_MACE3,
+ CODEC_ID_MACE6,
+ CODEC_ID_VMDAUDIO,
+ CODEC_ID_FLAC,
+ CODEC_ID_MP3ADU,
+ CODEC_ID_MP3ON4,
+ CODEC_ID_SHORTEN,
+ CODEC_ID_ALAC,
+ CODEC_ID_WESTWOOD_SND1,
+ CODEC_ID_GSM, ///< as in Berlin toast format
+ CODEC_ID_QDM2,
+ CODEC_ID_COOK,
+ CODEC_ID_TRUESPEECH,
+ CODEC_ID_TTA,
+ CODEC_ID_SMACKAUDIO,
+ CODEC_ID_QCELP,
+ CODEC_ID_WAVPACK,
+ CODEC_ID_DSICINAUDIO,
+ CODEC_ID_IMC,
+ CODEC_ID_MUSEPACK7,
+ CODEC_ID_MLP,
+ CODEC_ID_GSM_MS, /* as found in WAV */
+ CODEC_ID_ATRAC3,
+ CODEC_ID_VOXWARE,
+ CODEC_ID_APE,
+ CODEC_ID_NELLYMOSER,
+ CODEC_ID_MUSEPACK8,
+ CODEC_ID_SPEEX,
+ CODEC_ID_WMAVOICE,
+ CODEC_ID_WMAPRO,
+ CODEC_ID_WMALOSSLESS,
+ CODEC_ID_ATRAC3P,
+ CODEC_ID_EAC3,
+ CODEC_ID_SIPR,
+ CODEC_ID_MP1,
+ CODEC_ID_TWINVQ,
+ CODEC_ID_TRUEHD,
+ CODEC_ID_MP4ALS,
+ CODEC_ID_ATRAC1,
+ CODEC_ID_BINKAUDIO_RDFT,
+ CODEC_ID_BINKAUDIO_DCT,
+ CODEC_ID_AAC_LATM,
+ CODEC_ID_QDMC,
+ CODEC_ID_CELT,
+ CODEC_ID_G723_1,
+ CODEC_ID_G729,
+ CODEC_ID_8SVX_EXP,
+ CODEC_ID_8SVX_FIB,
+ CODEC_ID_BMV_AUDIO,
+ CODEC_ID_RALF,
+ CODEC_ID_IAC,
+ CODEC_ID_ILBC,
+
+ /* subtitle codecs */
+ CODEC_ID_FIRST_SUBTITLE = 0x17000, ///< A dummy ID pointing at the start of subtitle codecs.
+ CODEC_ID_DVD_SUBTITLE = 0x17000,
+ CODEC_ID_DVB_SUBTITLE,
+ CODEC_ID_TEXT, ///< raw UTF-8 text
+ CODEC_ID_XSUB,
+ CODEC_ID_SSA,
+ CODEC_ID_MOV_TEXT,
+ CODEC_ID_HDMV_PGS_SUBTITLE,
+ CODEC_ID_DVB_TELETEXT,
+ CODEC_ID_SRT,
+
+ /* other specific kind of codecs (generally used for attachments) */
+ CODEC_ID_FIRST_UNKNOWN = 0x18000, ///< A dummy ID pointing at the start of various fake codecs.
+ CODEC_ID_TTF = 0x18000,
+
+ CODEC_ID_PROBE = 0x19000, ///< codec_id is not known (like CODEC_ID_NONE) but lavf should attempt to identify it
+
+ CODEC_ID_MPEG2TS = 0x20000, /**< _FAKE_ codec to indicate a raw MPEG-2 TS
+ * stream (only used by libavformat) */
+ CODEC_ID_MPEG4SYSTEMS = 0x20001, /**< _FAKE_ codec to indicate a MPEG-4 Systems
+ * stream (only used by libavformat) */
+ CODEC_ID_FFMETADATA = 0x21000, ///< Dummy codec for streams containing only metadata information.
+
+#endif /* AVCODEC_OLD_CODEC_IDS_H */
diff --git a/gst-libs/ext/libav/libavcodec/opt.h b/gst-libs/ext/libav/libavcodec/opt.h
deleted file mode 100644
index 2380e74..0000000
--- a/gst-libs/ext/libav/libavcodec/opt.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * 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
- * This header is provided for compatibility only and will be removed
- * on next major bump
- */
-
-#ifndef AVCODEC_OPT_H
-#define AVCODEC_OPT_H
-
-#include "libavcodec/version.h"
-
-#if FF_API_OPT_H
-#include "libavutil/opt.h"
-#endif
-
-#endif /* AVCODEC_OPT_H */
diff --git a/gst-libs/ext/libav/libavcodec/options.c b/gst-libs/ext/libav/libavcodec/options.c
index d6e36cb..fc2a184 100644
--- a/gst-libs/ext/libav/libavcodec/options.c
+++ b/gst-libs/ext/libav/libavcodec/options.c
@@ -27,8 +27,12 @@
#include "avcodec.h"
#include "internal.h"
#include "libavutil/avassert.h"
+#include "libavutil/mem.h"
#include "libavutil/opt.h"
#include <float.h> /* FLT_MIN, FLT_MAX */
+#include <string.h>
+
+#include "options_table.h"
static const char* context_to_name(void* ptr) {
AVCodecContext *avc= ptr;
@@ -63,497 +67,18 @@ static const AVClass *codec_child_class_next(const AVClass *prev)
return NULL;
}
-#define OFFSET(x) offsetof(AVCodecContext,x)
-#define DEFAULT 0 //should be NAN but it does not work as it is not a constant in glibc as required by ANSI/ISO C
-//these names are too long to be readable
-#define V AV_OPT_FLAG_VIDEO_PARAM
-#define A AV_OPT_FLAG_AUDIO_PARAM
-#define S AV_OPT_FLAG_SUBTITLE_PARAM
-#define E AV_OPT_FLAG_ENCODING_PARAM
-#define D AV_OPT_FLAG_DECODING_PARAM
-
-#define AV_CODEC_DEFAULT_BITRATE 200*1000
-
-static const AVOption options[]={
-{"b", "set bitrate (in bits/s)", OFFSET(bit_rate), AV_OPT_TYPE_INT, {.dbl = AV_CODEC_DEFAULT_BITRATE }, INT_MIN, INT_MAX, V|A|E},
-{"ab", "this option is deprecated, use b", OFFSET(bit_rate), AV_OPT_TYPE_INT, {.dbl = AV_CODEC_DEFAULT_BITRATE }, 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, AV_OPT_TYPE_CONST, {.dbl = CODEC_FLAG_OBMC }, INT_MIN, INT_MAX, V|E, "flags"},
-#endif
-{"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, AV_OPT_TYPE_CONST, {.dbl = CODEC_FLAG_PART }, INT_MIN, INT_MAX, V|E, "flags"},
-#endif
-{"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, AV_OPT_TYPE_CONST, {.dbl = CODEC_FLAG_EXTERN_HUFF }, INT_MIN, INT_MAX, 0, "flags"},
-#endif
-{"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, 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, 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, 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, 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, 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, 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, AV_OPT_TYPE_CONST, {.dbl = CODEC_FLAG_SVCD_SCAN_OFFSET }, INT_MIN, INT_MAX, V|E, "flags"},
-#endif
-{"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"},
-{"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), AV_OPT_TYPE_INT, {.dbl = -1 }, INT_MIN, INT_MAX, V|E},
-#endif
-{"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},
-#if FF_API_ER
-{"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"},
-{"very_aggressive", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_ER_VERY_AGGRESSIVE }, INT_MIN, INT_MAX, V|D, "er"},
-{"explode", "abort decoding on error recognition", 0, AV_OPT_TYPE_CONST, {.dbl = FF_ER_EXPLODE }, INT_MIN, INT_MAX, V|D, "er"},
-#endif /* FF_API_ER */
-{"err_detect", "set error detection flags", OFFSET(err_recognition), AV_OPT_TYPE_FLAGS, {.dbl = AV_EF_CRCCHECK }, INT_MIN, INT_MAX, A|V|D, "err_detect"},
-{"crccheck", "verify embedded CRCs", 0, AV_OPT_TYPE_CONST, {.dbl = AV_EF_CRCCHECK }, INT_MIN, INT_MAX, V|D, "err_detect"},
-{"bitstream", "detect bitstream specification deviations", 0, AV_OPT_TYPE_CONST, {.dbl = AV_EF_BITSTREAM }, INT_MIN, INT_MAX, V|D, "err_detect"},
-{"buffer", "detect improper bitstream length", 0, AV_OPT_TYPE_CONST, {.dbl = AV_EF_BUFFER }, INT_MIN, INT_MAX, V|D, "err_detect"},
-{"explode", "abort decoding on minor error detection", 0, AV_OPT_TYPE_CONST, {.dbl = AV_EF_EXPLODE }, INT_MIN, INT_MAX, V|D, "err_detect"},
-{"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},
-#if FF_API_PARSE_FRAME
-{"parse_only", NULL, OFFSET(parse_only), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX},
-#endif
-{"mpeg_quant", "use MPEG quantizers instead of H.263", OFFSET(mpeg_quant), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E},
-{"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 bitrate tolerance (in bits/s)", OFFSET(rc_max_rate), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|A|E},
-{"minrate", "set min bitrate tolerance (in bits/s)", OFFSET(rc_min_rate), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|A|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, 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, 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},
-{"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},
-#if FF_API_X264_GLOBAL_OPTS
-#define X264_DEFAULTS CODEC_FLAG2_FASTPSKIP|CODEC_FLAG2_PSY|CODEC_FLAG2_MBTREE
-#else
-#define X264_DEFAULTS 0
-#endif
-#if FF_API_LAME_GLOBAL_OPTS
-#define LAME_DEFAULTS CODEC_FLAG2_BIT_RESERVOIR
-#else
-#define LAME_DEFAULTS 0
-#endif
-{"flags2", NULL, OFFSET(flags2), AV_OPT_TYPE_FLAGS, {.dbl = X264_DEFAULTS|LAME_DEFAULTS }, 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), 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), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E},
-{"threads", NULL, OFFSET(thread_count), AV_OPT_TYPE_INT, {.dbl = 1 }, 0, INT_MAX, V|E|D, "threads"},
-{"auto", "detect a good number of threads", 0, AV_OPT_TYPE_CONST, {.dbl = 0 }, INT_MIN, INT_MAX, V|E|D, "threads"},
-{"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)", OFFSET(crf), AV_OPT_TYPE_FLOAT, {.dbl = DEFAULT }, 0, 51, 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 (x264)", OFFSET(keyint_min), AV_OPT_TYPE_INT, {.dbl = 25 }, INT_MIN, INT_MAX, V|E},
-{"refs", "reference frames to consider for motion compensation (Snow)", 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), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E},
-#endif
-{"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), 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, 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), 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), 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, 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), 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), 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), AV_OPT_TYPE_INT64, {.dbl = 0 }, 0, INT64_MAX, V|E},
-#if FF_API_MPEGVIDEO_GLOBAL_OPTS
-{"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), 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), 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, 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, 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), 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, 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 = -1 }, -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), 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), 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 encoding", 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", NULL, 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},
-};
-
-#undef A
-#undef V
-#undef S
-#undef E
-#undef D
-#undef DEFAULT
-
static const AVClass av_codec_context_class = {
.class_name = "AVCodecContext",
.item_name = context_to_name,
.option = options,
.version = LIBAVUTIL_VERSION_INT,
- .log_level_offset_offset = OFFSET(log_level_offset),
+ .log_level_offset_offset = offsetof(AVCodecContext, log_level_offset),
.child_next = codec_child_next,
.child_class_next = codec_child_class_next,
};
-#if FF_API_ALLOC_CONTEXT
-void avcodec_get_context_defaults2(AVCodecContext *s, enum AVMediaType codec_type){
- avcodec_get_context_defaults3(s, NULL);
- s->codec_type = codec_type;
-}
-#endif
-
-int avcodec_get_context_defaults3(AVCodecContext *s, AVCodec *codec){
+int avcodec_get_context_defaults3(AVCodecContext *s, const AVCodec *codec)
+{
memset(s, 0, sizeof(AVCodecContext));
s->av_class = &av_codec_context_class;
@@ -569,7 +94,7 @@ int avcodec_get_context_defaults3(AVCodecContext *s, AVCodec *codec){
s->execute = avcodec_default_execute;
s->execute2 = avcodec_default_execute2;
s->sample_aspect_ratio = (AVRational){0,1};
- s->pix_fmt = PIX_FMT_NONE;
+ s->pix_fmt = AV_PIX_FMT_NONE;
s->sample_fmt = AV_SAMPLE_FMT_NONE;
s->reget_buffer = avcodec_default_reget_buffer;
@@ -598,7 +123,8 @@ int avcodec_get_context_defaults3(AVCodecContext *s, AVCodec *codec){
return 0;
}
-AVCodecContext *avcodec_alloc_context3(AVCodec *codec){
+AVCodecContext *avcodec_alloc_context3(const AVCodec *codec)
+{
AVCodecContext *avctx= av_malloc(sizeof(AVCodecContext));
if(avctx==NULL) return NULL;
@@ -611,26 +137,6 @@ AVCodecContext *avcodec_alloc_context3(AVCodec *codec){
return avctx;
}
-#if FF_API_ALLOC_CONTEXT
-AVCodecContext *avcodec_alloc_context2(enum AVMediaType codec_type){
- AVCodecContext *avctx= av_malloc(sizeof(AVCodecContext));
-
- if(avctx==NULL) return NULL;
-
- avcodec_get_context_defaults2(avctx, codec_type);
-
- return avctx;
-}
-
-void avcodec_get_context_defaults(AVCodecContext *s){
- avcodec_get_context_defaults2(s, AVMEDIA_TYPE_UNKNOWN);
-}
-
-AVCodecContext *avcodec_alloc_context(void){
- return avcodec_alloc_context2(AVMEDIA_TYPE_UNKNOWN);
-}
-#endif
-
int avcodec_copy_context(AVCodecContext *dest, const AVCodecContext *src)
{
if (avcodec_is_open(dest)) { // check that the dest context is uninitialized
diff --git a/gst-libs/ext/libav/libavcodec/options_table.h b/gst-libs/ext/libav/libavcodec/options_table.h
new file mode 100644
index 0000000..57c80dd
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/options_table.h
@@ -0,0 +1,416 @@
+/*
+ *
+ * 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
+ */
+
+#ifndef AVCODEC_OPTIONS_TABLE_H
+#define AVCODEC_OPTIONS_TABLE_H
+
+#include <float.h>
+#include <limits.h>
+
+#include "libavutil/opt.h"
+#include "avcodec.h"
+#include "version.h"
+#include "config.h"
+
+#define OFFSET(x) offsetof(AVCodecContext,x)
+#define DEFAULT 0 //should be NAN but it does not work as it is not a constant in glibc as required by ANSI/ISO C
+//these names are too long to be readable
+#define V AV_OPT_FLAG_VIDEO_PARAM
+#define A AV_OPT_FLAG_AUDIO_PARAM
+#define S AV_OPT_FLAG_SUBTITLE_PARAM
+#define E AV_OPT_FLAG_ENCODING_PARAM
+#define D AV_OPT_FLAG_DECODING_PARAM
+
+#define AV_CODEC_DEFAULT_BITRATE 200*1000
+
+static const AVOption options[]={
+{"b", "set bitrate (in bits/s)", OFFSET(bit_rate), AV_OPT_TYPE_INT, {.i64 = AV_CODEC_DEFAULT_BITRATE }, INT_MIN, INT_MAX, V|A|E},
+{"bt", "Set video bitrate tolerance (in bits/s). In 1-pass mode, bitrate tolerance specifies how far "
+ "ratecontrol is willing to deviate from the target average bitrate value. This is not related "
+ "to minimum/maximum bitrate. Lowering tolerance too much has an adverse effect on quality.",
+ OFFSET(bit_rate_tolerance), AV_OPT_TYPE_INT, {.i64 = AV_CODEC_DEFAULT_BITRATE*20 }, 1, INT_MAX, V|E},
+{"flags", NULL, OFFSET(flags), AV_OPT_TYPE_FLAGS, {.i64 = DEFAULT }, 0, UINT_MAX, V|A|E|D, "flags"},
+{"mv4", "use four motion vectors per macroblock (MPEG-4)", 0, AV_OPT_TYPE_CONST, {.i64 = CODEC_FLAG_4MV }, INT_MIN, INT_MAX, V|E, "flags"},
+{"qpel", "use 1/4-pel motion compensation", 0, AV_OPT_TYPE_CONST, {.i64 = CODEC_FLAG_QPEL }, INT_MIN, INT_MAX, V|E, "flags"},
+{"loop", "use loop filter", 0, AV_OPT_TYPE_CONST, {.i64 = CODEC_FLAG_LOOP_FILTER }, INT_MIN, INT_MAX, V|E, "flags"},
+{"qscale", "use fixed qscale", 0, AV_OPT_TYPE_CONST, {.i64 = CODEC_FLAG_QSCALE }, INT_MIN, INT_MAX, 0, "flags"},
+{"gmc", "use gmc", 0, AV_OPT_TYPE_CONST, {.i64 = CODEC_FLAG_GMC }, INT_MIN, INT_MAX, V|E, "flags"},
+{"mv0", "always try a mb with mv=<0,0>", 0, AV_OPT_TYPE_CONST, {.i64 = CODEC_FLAG_MV0 }, INT_MIN, INT_MAX, V|E, "flags"},
+{"input_preserved", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = CODEC_FLAG_INPUT_PRESERVED }, INT_MIN, INT_MAX, 0, "flags"},
+{"pass1", "use internal 2-pass ratecontrol in first pass mode", 0, AV_OPT_TYPE_CONST, {.i64 = CODEC_FLAG_PASS1 }, INT_MIN, INT_MAX, 0, "flags"},
+{"pass2", "use internal 2-pass ratecontrol in second pass mode", 0, AV_OPT_TYPE_CONST, {.i64 = CODEC_FLAG_PASS2 }, INT_MIN, INT_MAX, 0, "flags"},
+{"gray", "only decode/encode grayscale", 0, AV_OPT_TYPE_CONST, {.i64 = CODEC_FLAG_GRAY }, INT_MIN, INT_MAX, V|E|D, "flags"},
+{"emu_edge", "do not draw edges", 0, AV_OPT_TYPE_CONST, {.i64 = CODEC_FLAG_EMU_EDGE }, INT_MIN, INT_MAX, 0, "flags"},
+{"psnr", "error[?] variables will be set during encoding", 0, AV_OPT_TYPE_CONST, {.i64 = CODEC_FLAG_PSNR }, INT_MIN, INT_MAX, V|E, "flags"},
+{"truncated", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = CODEC_FLAG_TRUNCATED }, INT_MIN, INT_MAX, 0, "flags"},
+{"naq", "normalize adaptive quantization", 0, AV_OPT_TYPE_CONST, {.i64 = CODEC_FLAG_NORMALIZE_AQP }, INT_MIN, INT_MAX, V|E, "flags"},
+{"ildct", "use interlaced DCT", 0, AV_OPT_TYPE_CONST, {.i64 = CODEC_FLAG_INTERLACED_DCT }, INT_MIN, INT_MAX, V|E, "flags"},
+{"low_delay", "force low delay", 0, AV_OPT_TYPE_CONST, {.i64 = CODEC_FLAG_LOW_DELAY }, INT_MIN, INT_MAX, V|D|E, "flags"},
+{"global_header", "place global headers in extradata instead of every keyframe", 0, AV_OPT_TYPE_CONST, {.i64 = CODEC_FLAG_GLOBAL_HEADER }, INT_MIN, INT_MAX, V|A|E, "flags"},
+{"bitexact", "use only bitexact functions (except (I)DCT)", 0, AV_OPT_TYPE_CONST, {.i64 = CODEC_FLAG_BITEXACT }, INT_MIN, INT_MAX, A|V|S|D|E, "flags"},
+{"aic", "H.263 advanced intra coding / MPEG-4 AC prediction", 0, AV_OPT_TYPE_CONST, {.i64 = CODEC_FLAG_AC_PRED }, INT_MIN, INT_MAX, V|E, "flags"},
+#if FF_API_MPV_GLOBAL_OPTS
+{"cbp", "Deprecated, use mpegvideo private options instead", 0, AV_OPT_TYPE_CONST, {.i64 = CODEC_FLAG_CBP_RD }, INT_MIN, INT_MAX, V|E, "flags"},
+{"qprd", "Deprecated, use mpegvideo private options instead", 0, AV_OPT_TYPE_CONST, {.i64 = CODEC_FLAG_QP_RD }, INT_MIN, INT_MAX, V|E, "flags"},
+#endif
+{"ilme", "interlaced motion estimation", 0, AV_OPT_TYPE_CONST, {.i64 = CODEC_FLAG_INTERLACED_ME }, INT_MIN, INT_MAX, V|E, "flags"},
+{"cgop", "closed GOP", 0, AV_OPT_TYPE_CONST, {.i64 = CODEC_FLAG_CLOSED_GOP }, INT_MIN, INT_MAX, V|E, "flags"},
+{"fast", "allow non-spec-compliant speedup tricks", 0, AV_OPT_TYPE_CONST, {.i64 = CODEC_FLAG2_FAST }, INT_MIN, INT_MAX, V|E, "flags2"},
+#if FF_API_MPV_GLOBAL_OPTS
+{"sgop", "Deprecated, use mpegvideo private options instead", 0, AV_OPT_TYPE_CONST, {.i64 = CODEC_FLAG2_STRICT_GOP }, INT_MIN, INT_MAX, V|E, "flags2"},
+#endif
+{"noout", "skip bitstream encoding", 0, AV_OPT_TYPE_CONST, {.i64 = 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, {.i64 = CODEC_FLAG2_LOCAL_HEADER }, INT_MIN, INT_MAX, V|E, "flags2"},
+#if FF_API_SUB_ID
+{"sub_id", NULL, OFFSET(sub_id), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX},
+#endif
+{"me_method", "set motion estimation method", OFFSET(me_method), AV_OPT_TYPE_INT, {.i64 = ME_EPZS }, INT_MIN, INT_MAX, V|E, "me_method"},
+{"zero", "zero motion estimation (fastest)", 0, AV_OPT_TYPE_CONST, {.i64 = ME_ZERO }, INT_MIN, INT_MAX, V|E, "me_method" },
+{"full", "full motion estimation (slowest)", 0, AV_OPT_TYPE_CONST, {.i64 = ME_FULL }, INT_MIN, INT_MAX, V|E, "me_method" },
+{"epzs", "EPZS motion estimation (default)", 0, AV_OPT_TYPE_CONST, {.i64 = ME_EPZS }, INT_MIN, INT_MAX, V|E, "me_method" },
+{"esa", "esa motion estimation (alias for full)", 0, AV_OPT_TYPE_CONST, {.i64 = ME_FULL }, INT_MIN, INT_MAX, V|E, "me_method" },
+{"tesa", "tesa motion estimation", 0, AV_OPT_TYPE_CONST, {.i64 = ME_TESA }, INT_MIN, INT_MAX, V|E, "me_method" },
+{"dia", "diamond motion estimation (alias for EPZS)", 0, AV_OPT_TYPE_CONST, {.i64 = ME_EPZS }, INT_MIN, INT_MAX, V|E, "me_method" },
+{"log", "log motion estimation", 0, AV_OPT_TYPE_CONST, {.i64 = ME_LOG }, INT_MIN, INT_MAX, V|E, "me_method" },
+{"phods", "phods motion estimation", 0, AV_OPT_TYPE_CONST, {.i64 = ME_PHODS }, INT_MIN, INT_MAX, V|E, "me_method" },
+{"x1", "X1 motion estimation", 0, AV_OPT_TYPE_CONST, {.i64 = ME_X1 }, INT_MIN, INT_MAX, V|E, "me_method" },
+{"hex", "hex motion estimation", 0, AV_OPT_TYPE_CONST, {.i64 = ME_HEX }, INT_MIN, INT_MAX, V|E, "me_method" },
+{"umh", "umh motion estimation", 0, AV_OPT_TYPE_CONST, {.i64 = ME_UMH }, INT_MIN, INT_MAX, V|E, "me_method" },
+{"iter", "iter motion estimation", 0, AV_OPT_TYPE_CONST, {.i64 = ME_ITER }, INT_MIN, INT_MAX, V|E, "me_method" },
+{"extradata_size", NULL, OFFSET(extradata_size), AV_OPT_TYPE_INT, {.i64 = 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 (GOP) size", OFFSET(gop_size), AV_OPT_TYPE_INT, {.i64 = 12 }, INT_MIN, INT_MAX, V|E},
+{"ar", "set audio sampling rate (in Hz)", OFFSET(sample_rate), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, A|D|E},
+{"ac", "set number of audio channels", OFFSET(channels), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, A|D|E},
+{"cutoff", "set cutoff bandwidth", OFFSET(cutoff), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, A|E},
+{"frame_size", NULL, OFFSET(frame_size), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, A|E},
+{"frame_number", NULL, OFFSET(frame_number), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX},
+{"delay", NULL, OFFSET(delay), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX},
+{"qcomp", "video quantizer scale compression (VBR). Constant of ratecontrol equation. "
+ "Recommended range for default rc_eq: 0.0-1.0",
+ 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", "minimum video quantizer scale (VBR)", OFFSET(qmin), AV_OPT_TYPE_INT, {.i64 = 2 }, -1, 69, V|E},
+{"qmax", "maximum video quantizer scale (VBR)", OFFSET(qmax), AV_OPT_TYPE_INT, {.i64 = 31 }, -1, 69, V|E},
+{"qdiff", "maximum difference between the quantizer scales (VBR)", OFFSET(max_qdiff), AV_OPT_TYPE_INT, {.i64 = 3 }, INT_MIN, INT_MAX, V|E},
+{"bf", "use 'frames' B frames", OFFSET(max_b_frames), AV_OPT_TYPE_INT, {.i64 = 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, {.i64 = 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, {.i64 = 0 }, INT_MIN, INT_MAX, V|E},
+{"ps", "RTP payload size in bytes", OFFSET(rtp_payload_size), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E},
+{"mv_bits", NULL, OFFSET(mv_bits), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX},
+{"header_bits", NULL, OFFSET(header_bits), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX},
+{"i_tex_bits", NULL, OFFSET(i_tex_bits), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX},
+{"p_tex_bits", NULL, OFFSET(p_tex_bits), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX},
+{"i_count", NULL, OFFSET(i_count), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX},
+{"p_count", NULL, OFFSET(p_count), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX},
+{"skip_count", NULL, OFFSET(skip_count), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX},
+{"misc_bits", NULL, OFFSET(misc_bits), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX},
+{"frame_bits", NULL, OFFSET(frame_bits), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX},
+{"codec_tag", NULL, OFFSET(codec_tag), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX},
+{"bug", "work around not autodetected encoder bugs", OFFSET(workaround_bugs), AV_OPT_TYPE_FLAGS, {.i64 = FF_BUG_AUTODETECT }, INT_MIN, INT_MAX, V|D, "bug"},
+{"autodetect", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = 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, {.i64 = 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, {.i64 = FF_BUG_XVID_ILACE }, INT_MIN, INT_MAX, V|D, "bug"},
+{"ump4", "(autodetected if FOURCC == UMP4)", 0, AV_OPT_TYPE_CONST, {.i64 = FF_BUG_UMP4 }, INT_MIN, INT_MAX, V|D, "bug"},
+{"no_padding", "padding bug (autodetected)", 0, AV_OPT_TYPE_CONST, {.i64 = FF_BUG_NO_PADDING }, INT_MIN, INT_MAX, V|D, "bug"},
+{"amv", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_BUG_AMV }, INT_MIN, INT_MAX, V|D, "bug"},
+{"ac_vlc", "illegal VLC bug (autodetected per FOURCC)", 0, AV_OPT_TYPE_CONST, {.i64 = FF_BUG_AC_VLC }, INT_MIN, INT_MAX, V|D, "bug"},
+{"qpel_chroma", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = 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, {.i64 = FF_BUG_STD_QPEL }, INT_MIN, INT_MAX, V|D, "bug"},
+{"qpel_chroma2", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = 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, {.i64 = FF_BUG_DIRECT_BLOCKSIZE }, INT_MIN, INT_MAX, V|D, "bug"},
+{"edge", "edge padding bug (autodetected per FOURCC/version)", 0, AV_OPT_TYPE_CONST, {.i64 = FF_BUG_EDGE }, INT_MIN, INT_MAX, V|D, "bug"},
+{"hpel_chroma", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_BUG_HPEL_CHROMA }, INT_MIN, INT_MAX, V|D, "bug"},
+{"dc_clip", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_BUG_DC_CLIP }, INT_MIN, INT_MAX, V|D, "bug"},
+{"ms", "work around various bugs in Microsoft's broken decoders", 0, AV_OPT_TYPE_CONST, {.i64 = FF_BUG_MS }, INT_MIN, INT_MAX, V|D, "bug"},
+{"trunc", "truncated frames", 0, AV_OPT_TYPE_CONST, {.i64 = FF_BUG_TRUNCATED}, INT_MIN, INT_MAX, V|D, "bug"},
+#if FF_API_MPV_GLOBAL_OPTS
+{"lelim", "single coefficient elimination threshold for luminance (negative values also consider DC coefficient)", OFFSET(luma_elim_threshold), AV_OPT_TYPE_INT, {.i64 = 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, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E},
+#endif
+{"strict", "how strictly to follow the standards", OFFSET(strict_std_compliance), AV_OPT_TYPE_INT, {.i64 = 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, {.i64 = 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 the consequences", 0, AV_OPT_TYPE_CONST, {.i64 = FF_COMPLIANCE_STRICT }, INT_MIN, INT_MAX, V|D|E, "strict"},
+{"normal", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_COMPLIANCE_NORMAL }, INT_MIN, INT_MAX, V|D|E, "strict"},
+{"unofficial", "allow unofficial extensions", 0, AV_OPT_TYPE_CONST, {.i64 = FF_COMPLIANCE_UNOFFICIAL }, INT_MIN, INT_MAX, V|D|E, "strict"},
+{"experimental", "allow non-standardized experimental things", 0, AV_OPT_TYPE_CONST, {.i64 = 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},
+{"err_detect", "set error detection flags", OFFSET(err_recognition), AV_OPT_TYPE_FLAGS, {.i64 = AV_EF_CRCCHECK }, INT_MIN, INT_MAX, A|V|D, "err_detect"},
+{"crccheck", "verify embedded CRCs", 0, AV_OPT_TYPE_CONST, {.i64 = AV_EF_CRCCHECK }, INT_MIN, INT_MAX, V|D, "err_detect"},
+{"bitstream", "detect bitstream specification deviations", 0, AV_OPT_TYPE_CONST, {.i64 = AV_EF_BITSTREAM }, INT_MIN, INT_MAX, V|D, "err_detect"},
+{"buffer", "detect improper bitstream length", 0, AV_OPT_TYPE_CONST, {.i64 = AV_EF_BUFFER }, INT_MIN, INT_MAX, V|D, "err_detect"},
+{"explode", "abort decoding on minor error detection", 0, AV_OPT_TYPE_CONST, {.i64 = AV_EF_EXPLODE }, INT_MIN, INT_MAX, V|D, "err_detect"},
+{"has_b_frames", NULL, OFFSET(has_b_frames), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX},
+{"block_align", NULL, OFFSET(block_align), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX},
+{"mpeg_quant", "use MPEG quantizers instead of H.263", OFFSET(mpeg_quant), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E},
+{"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, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E},
+{"rc_override_count", NULL, OFFSET(rc_override_count), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX},
+{"rc_eq", "Set rate control equation. When computing the expression, besides the standard functions "
+ "defined in the section 'Expression Evaluation', the following functions are available: "
+ "bits2qp(bits), qp2bits(qp). Also the following constants are available: iTex pTex tex mv "
+ "fCode iCount mcVar var isI isP isB avgQP qComp avgIITex avgPITex avgPPTex avgBPTex avgTex.",
+ OFFSET(rc_eq), AV_OPT_TYPE_STRING, {.str = NULL}, CHAR_MIN, CHAR_MAX, V|E},
+{"maxrate", "Set maximum bitrate tolerance (in bits/s). Requires bufsize to be set.", OFFSET(rc_max_rate), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|A|E},
+{"minrate", "Set minimum bitrate tolerance (in bits/s). Most useful in setting up a CBR encode. It is of little use otherwise.",
+ OFFSET(rc_min_rate), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|A|E},
+{"bufsize", "set ratecontrol buffer size (in bits)", OFFSET(rc_buffer_size), AV_OPT_TYPE_INT, {.i64 = 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, {.i64 = DEFAULT }, 0, INT_MAX, V|E, "dct"},
+{"auto", "autoselect a good one (default)", 0, AV_OPT_TYPE_CONST, {.i64 = FF_DCT_AUTO }, INT_MIN, INT_MAX, V|E, "dct"},
+{"fastint", "fast integer", 0, AV_OPT_TYPE_CONST, {.i64 = FF_DCT_FASTINT }, INT_MIN, INT_MAX, V|E, "dct"},
+{"int", "accurate integer", 0, AV_OPT_TYPE_CONST, {.i64 = FF_DCT_INT }, INT_MIN, INT_MAX, V|E, "dct"},
+{"mmx", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_DCT_MMX }, INT_MIN, INT_MAX, V|E, "dct"},
+{"altivec", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_DCT_ALTIVEC }, INT_MIN, INT_MAX, V|E, "dct"},
+{"faan", "floating point AAN DCT", 0, AV_OPT_TYPE_CONST, {.i64 = 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, {.i64 = DEFAULT }, 0, INT_MAX, V|E|D, "idct"},
+{"auto", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_IDCT_AUTO }, INT_MIN, INT_MAX, V|E|D, "idct"},
+{"int", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_IDCT_INT }, INT_MIN, INT_MAX, V|E|D, "idct"},
+{"simple", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_IDCT_SIMPLE }, INT_MIN, INT_MAX, V|E|D, "idct"},
+{"simplemmx", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_IDCT_SIMPLEMMX }, INT_MIN, INT_MAX, V|E|D, "idct"},
+#if FF_API_MMI
+{"mmi", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_IDCT_MMI }, INT_MIN, INT_MAX, V|E|D, "idct"},
+#endif
+{"arm", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_IDCT_ARM }, INT_MIN, INT_MAX, V|E|D, "idct"},
+{"altivec", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_IDCT_ALTIVEC }, INT_MIN, INT_MAX, V|E|D, "idct"},
+{"sh4", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_IDCT_SH4 }, INT_MIN, INT_MAX, V|E|D, "idct"},
+{"simplearm", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_IDCT_SIMPLEARM }, INT_MIN, INT_MAX, V|E|D, "idct"},
+{"simplearmv5te", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_IDCT_SIMPLEARMV5TE }, INT_MIN, INT_MAX, V|E|D, "idct"},
+{"simplearmv6", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_IDCT_SIMPLEARMV6 }, INT_MIN, INT_MAX, V|E|D, "idct"},
+{"simpleneon", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_IDCT_SIMPLENEON }, INT_MIN, INT_MAX, V|E|D, "idct"},
+{"simplealpha", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_IDCT_SIMPLEALPHA }, INT_MIN, INT_MAX, V|E|D, "idct"},
+{"h264", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_IDCT_H264 }, INT_MIN, INT_MAX, V|E|D, "idct"},
+{"vp3", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_IDCT_VP3 }, INT_MIN, INT_MAX, V|E|D, "idct"},
+{"ipp", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_IDCT_IPP }, INT_MIN, INT_MAX, V|E|D, "idct"},
+{"xvidmmx", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_IDCT_XVIDMMX }, INT_MIN, INT_MAX, V|E|D, "idct"},
+{"faani", "floating point AAN IDCT", 0, AV_OPT_TYPE_CONST, {.i64 = FF_IDCT_FAAN }, INT_MIN, INT_MAX, V|D|E, "idct"},
+{"slice_count", NULL, OFFSET(slice_count), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX},
+{"ec", "set error concealment strategy", OFFSET(error_concealment), AV_OPT_TYPE_FLAGS, {.i64 = 3 }, INT_MIN, INT_MAX, V|D, "ec"},
+{"guess_mvs", "iterative motion vector (MV) search (slow)", 0, AV_OPT_TYPE_CONST, {.i64 = FF_EC_GUESS_MVS }, INT_MIN, INT_MAX, V|D, "ec"},
+{"deblock", "use strong deblock filter for damaged MBs", 0, AV_OPT_TYPE_CONST, {.i64 = FF_EC_DEBLOCK }, INT_MIN, INT_MAX, V|D, "ec"},
+{"bits_per_coded_sample", NULL, OFFSET(bits_per_coded_sample), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX},
+{"pred", "prediction method", OFFSET(prediction_method), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E, "pred"},
+{"left", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_PRED_LEFT }, INT_MIN, INT_MAX, V|E, "pred"},
+{"plane", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_PRED_PLANE }, INT_MIN, INT_MAX, V|E, "pred"},
+{"median", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = 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, {.i64 = DEFAULT }, 0, INT_MAX, V|A|S|E|D, "debug"},
+{"pict", "picture info", 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_PICT_INFO }, INT_MIN, INT_MAX, V|D, "debug"},
+{"rc", "rate control", 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_RC }, INT_MIN, INT_MAX, V|E, "debug"},
+{"bitstream", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_BITSTREAM }, INT_MIN, INT_MAX, V|D, "debug"},
+{"mb_type", "macroblock (MB) type", 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_MB_TYPE }, INT_MIN, INT_MAX, V|D, "debug"},
+{"qp", "per-block quantization parameter (QP)", 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_QP }, INT_MIN, INT_MAX, V|D, "debug"},
+{"mv", "motion vector", 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_MV }, INT_MIN, INT_MAX, V|D, "debug"},
+{"dct_coeff", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_DCT_COEFF }, INT_MIN, INT_MAX, V|D, "debug"},
+{"skip", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_SKIP }, INT_MIN, INT_MAX, V|D, "debug"},
+{"startcode", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_STARTCODE }, INT_MIN, INT_MAX, V|D, "debug"},
+{"pts", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_PTS }, INT_MIN, INT_MAX, V|D, "debug"},
+{"er", "error recognition", 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_ER }, INT_MIN, INT_MAX, V|D, "debug"},
+{"mmco", "memory management control operations (H.264)", 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_MMCO }, INT_MIN, INT_MAX, V|D, "debug"},
+{"bugs", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = 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, {.i64 = FF_DEBUG_VIS_QP }, INT_MIN, INT_MAX, V|D, "debug"},
+{"vis_mb_type", "visualize block types", 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_VIS_MB_TYPE }, INT_MIN, INT_MAX, V|D, "debug"},
+{"buffers", "picture buffer allocations", 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_BUFFERS }, INT_MIN, INT_MAX, V|D, "debug"},
+{"thread_ops", "threading operations", 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_THREADS }, INT_MIN, INT_MAX, V|D, "debug"},
+{"vismv", "visualize motion vectors (MVs)", OFFSET(debug_mv), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, 0, INT_MAX, V|D, "debug_mv"},
+{"pf", "forward predicted MVs of P-frames", 0, AV_OPT_TYPE_CONST, {.i64 = 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, {.i64 = 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, {.i64 = 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, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E, "cmp_func"},
+{"subcmp", "sub-pel ME compare function", OFFSET(me_sub_cmp), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E, "cmp_func"},
+{"mbcmp", "macroblock compare function", OFFSET(mb_cmp), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E, "cmp_func"},
+{"ildctcmp", "interlaced DCT compare function", OFFSET(ildct_cmp), AV_OPT_TYPE_INT, {.i64 = 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, {.i64 = 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, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E},
+{"preme", "pre motion estimation", OFFSET(pre_me), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E},
+{"precmp", "pre motion estimation compare function", OFFSET(me_pre_cmp), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E, "cmp_func"},
+{"sad", "sum of absolute differences, fast (default)", 0, AV_OPT_TYPE_CONST, {.i64 = FF_CMP_SAD }, INT_MIN, INT_MAX, V|E, "cmp_func"},
+{"sse", "sum of squared errors", 0, AV_OPT_TYPE_CONST, {.i64 = FF_CMP_SSE }, INT_MIN, INT_MAX, V|E, "cmp_func"},
+{"satd", "sum of absolute Hadamard transformed differences", 0, AV_OPT_TYPE_CONST, {.i64 = FF_CMP_SATD }, INT_MIN, INT_MAX, V|E, "cmp_func"},
+{"dct", "sum of absolute DCT transformed differences", 0, AV_OPT_TYPE_CONST, {.i64 = 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, {.i64 = FF_CMP_PSNR }, INT_MIN, INT_MAX, V|E, "cmp_func"},
+{"bit", "number of bits needed for the block", 0, AV_OPT_TYPE_CONST, {.i64 = FF_CMP_BIT }, INT_MIN, INT_MAX, V|E, "cmp_func"},
+{"rd", "rate distortion optimal, slow", 0, AV_OPT_TYPE_CONST, {.i64 = FF_CMP_RD }, INT_MIN, INT_MAX, V|E, "cmp_func"},
+{"zero", "0", 0, AV_OPT_TYPE_CONST, {.i64 = FF_CMP_ZERO }, INT_MIN, INT_MAX, V|E, "cmp_func"},
+{"vsad", "sum of absolute vertical differences", 0, AV_OPT_TYPE_CONST, {.i64 = FF_CMP_VSAD }, INT_MIN, INT_MAX, V|E, "cmp_func"},
+{"vsse", "sum of squared vertical differences", 0, AV_OPT_TYPE_CONST, {.i64 = FF_CMP_VSSE }, INT_MIN, INT_MAX, V|E, "cmp_func"},
+{"nsse", "noise preserving sum of squared differences", 0, AV_OPT_TYPE_CONST, {.i64 = FF_CMP_NSSE }, INT_MIN, INT_MAX, V|E, "cmp_func"},
+#if CONFIG_SNOW_ENCODER
+{"w53", "5/3 wavelet, only used in snow", 0, AV_OPT_TYPE_CONST, {.i64 = FF_CMP_W53 }, INT_MIN, INT_MAX, V|E, "cmp_func"},
+{"w97", "9/7 wavelet, only used in snow", 0, AV_OPT_TYPE_CONST, {.i64 = FF_CMP_W97 }, INT_MIN, INT_MAX, V|E, "cmp_func"},
+#endif
+{"dctmax", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_CMP_DCTMAX }, INT_MIN, INT_MAX, V|E, "cmp_func"},
+{"chroma", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = 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, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E},
+{"subq", "sub-pel motion estimation quality", OFFSET(me_subpel_quality), AV_OPT_TYPE_INT, {.i64 = 8 }, INT_MIN, INT_MAX, V|E},
+{"dtg_active_format", NULL, OFFSET(dtg_active_format), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX},
+{"me_range", "limit motion vectors range (1023 for DivX player)", OFFSET(me_range), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E},
+{"ibias", "intra quant bias", OFFSET(intra_quant_bias), AV_OPT_TYPE_INT, {.i64 = FF_DEFAULT_QUANT_BIAS }, INT_MIN, INT_MAX, V|E},
+{"pbias", "inter quant bias", OFFSET(inter_quant_bias), AV_OPT_TYPE_INT, {.i64 = FF_DEFAULT_QUANT_BIAS }, INT_MIN, INT_MAX, V|E},
+#if FF_API_COLOR_TABLE_ID
+{"color_table_id", NULL, OFFSET(color_table_id), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX},
+#endif
+{"global_quality", NULL, OFFSET(global_quality), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|A|E},
+{"coder", NULL, OFFSET(coder_type), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E, "coder"},
+{"vlc", "variable length coder / Huffman coder", 0, AV_OPT_TYPE_CONST, {.i64 = FF_CODER_TYPE_VLC }, INT_MIN, INT_MAX, V|E, "coder"},
+{"ac", "arithmetic coder", 0, AV_OPT_TYPE_CONST, {.i64 = FF_CODER_TYPE_AC }, INT_MIN, INT_MAX, V|E, "coder"},
+{"raw", "raw (no encoding)", 0, AV_OPT_TYPE_CONST, {.i64 = FF_CODER_TYPE_RAW }, INT_MIN, INT_MAX, V|E, "coder"},
+{"rle", "run-length coder", 0, AV_OPT_TYPE_CONST, {.i64 = FF_CODER_TYPE_RLE }, INT_MIN, INT_MAX, V|E, "coder"},
+{"deflate", "deflate-based coder", 0, AV_OPT_TYPE_CONST, {.i64 = FF_CODER_TYPE_DEFLATE }, INT_MIN, INT_MAX, V|E, "coder"},
+{"context", "context model", OFFSET(context_model), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E},
+{"slice_flags", NULL, OFFSET(slice_flags), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX},
+{"xvmc_acceleration", NULL, OFFSET(xvmc_acceleration), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX},
+{"mbd", "macroblock decision algorithm (high quality mode)", OFFSET(mb_decision), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E, "mbd"},
+{"simple", "use mbcmp (default)", 0, AV_OPT_TYPE_CONST, {.i64 = FF_MB_DECISION_SIMPLE }, INT_MIN, INT_MAX, V|E, "mbd"},
+{"bits", "use fewest bits", 0, AV_OPT_TYPE_CONST, {.i64 = FF_MB_DECISION_BITS }, INT_MIN, INT_MAX, V|E, "mbd"},
+{"rd", "use best rate distortion", 0, AV_OPT_TYPE_CONST, {.i64 = FF_MB_DECISION_RD }, INT_MIN, INT_MAX, V|E, "mbd"},
+{"stream_codec_tag", NULL, OFFSET(stream_codec_tag), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX},
+{"sc_threshold", "scene change threshold", OFFSET(scenechange_threshold), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E},
+{"lmin", "minimum Lagrange factor (VBR)", OFFSET(lmin), AV_OPT_TYPE_INT, {.i64 = 2*FF_QP2LAMBDA }, 0, INT_MAX, V|E},
+{"lmax", "maximum Lagrange factor (VBR)", OFFSET(lmax), AV_OPT_TYPE_INT, {.i64 = 31*FF_QP2LAMBDA }, 0, INT_MAX, V|E},
+{"nr", "noise reduction", OFFSET(noise_reduction), AV_OPT_TYPE_INT, {.i64 = 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, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E},
+#if FF_API_INTER_THRESHOLD
+{"inter_threshold", NULL, OFFSET(inter_threshold), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E},
+#endif
+{"flags2", NULL, OFFSET(flags2), AV_OPT_TYPE_FLAGS, {.i64 = DEFAULT}, 0, UINT_MAX, V|A|E|D, "flags2"},
+{"error", NULL, OFFSET(error_rate), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E},
+#if FF_API_MPV_GLOBAL_OPTS
+{"qns", "deprecated, use mpegvideo private options instead", OFFSET(quantizer_noise_shaping), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E},
+#endif
+{"threads", NULL, OFFSET(thread_count), AV_OPT_TYPE_INT, {.i64 = 1 }, 0, INT_MAX, V|E|D, "threads"},
+{"auto", "autodetect a suitable number of threads to use", 0, AV_OPT_TYPE_CONST, {.i64 = 0 }, INT_MIN, INT_MAX, V|E|D, "threads"},
+{"me_threshold", "motion estimation threshold", OFFSET(me_threshold), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E},
+{"mb_threshold", "macroblock threshold", OFFSET(mb_threshold), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E},
+{"dc", "intra_dc_precision", OFFSET(intra_dc_precision), AV_OPT_TYPE_INT, {.i64 = 0 }, INT_MIN, INT_MAX, V|E},
+{"nssew", "nsse weight", OFFSET(nsse_weight), AV_OPT_TYPE_INT, {.i64 = 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, {.i64 = 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, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|D},
+{"profile", NULL, OFFSET(profile), AV_OPT_TYPE_INT, {.i64 = FF_PROFILE_UNKNOWN }, INT_MIN, INT_MAX, V|A|E, "profile"},
+{"unknown", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_PROFILE_UNKNOWN }, INT_MIN, INT_MAX, V|A|E, "profile"},
+{"aac_main", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_PROFILE_AAC_MAIN }, INT_MIN, INT_MAX, A|E, "profile"},
+{"aac_low", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_PROFILE_AAC_LOW }, INT_MIN, INT_MAX, A|E, "profile"},
+{"aac_ssr", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_PROFILE_AAC_SSR }, INT_MIN, INT_MAX, A|E, "profile"},
+{"aac_ltp", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_PROFILE_AAC_LTP }, INT_MIN, INT_MAX, A|E, "profile"},
+{"aac_he", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_PROFILE_AAC_HE }, INT_MIN, INT_MAX, A|E, "profile"},
+{"aac_he_v2", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_PROFILE_AAC_HE_V2 }, INT_MIN, INT_MAX, A|E, "profile"},
+{"aac_ld", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_PROFILE_AAC_LD }, INT_MIN, INT_MAX, A|E, "profile"},
+{"aac_eld", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_PROFILE_AAC_ELD }, INT_MIN, INT_MAX, A|E, "profile"},
+{"dts", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_PROFILE_DTS }, INT_MIN, INT_MAX, A|E, "profile"},
+{"dts_es", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_PROFILE_DTS_ES }, INT_MIN, INT_MAX, A|E, "profile"},
+{"dts_96_24", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_PROFILE_DTS_96_24 }, INT_MIN, INT_MAX, A|E, "profile"},
+{"dts_hd_hra", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_PROFILE_DTS_HD_HRA }, INT_MIN, INT_MAX, A|E, "profile"},
+{"dts_hd_ma", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_PROFILE_DTS_HD_MA }, INT_MIN, INT_MAX, A|E, "profile"},
+{"level", NULL, OFFSET(level), AV_OPT_TYPE_INT, {.i64 = FF_LEVEL_UNKNOWN }, INT_MIN, INT_MAX, V|A|E, "level"},
+{"unknown", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_LEVEL_UNKNOWN }, INT_MIN, INT_MAX, V|A|E, "level"},
+{"skip_threshold", "frame skip threshold", OFFSET(frame_skip_threshold), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E},
+{"skip_factor", "frame skip factor", OFFSET(frame_skip_factor), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E},
+{"skip_exp", "frame skip exponent", OFFSET(frame_skip_exp), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E},
+{"skipcmp", "frame skip compare function", OFFSET(frame_skip_cmp), AV_OPT_TYPE_INT, {.i64 = FF_CMP_DCTMAX }, INT_MIN, INT_MAX, V|E, "cmp_func"},
+{"border_mask", "increase the quantizer for macroblocks close to borders", OFFSET(border_masking), AV_OPT_TYPE_FLOAT, {.dbl = DEFAULT }, -FLT_MAX, FLT_MAX, V|E},
+{"mblmin", "minimum macroblock Lagrange factor (VBR)", OFFSET(mb_lmin), AV_OPT_TYPE_INT, {.i64 = FF_QP2LAMBDA * 2 }, 1, FF_LAMBDA_MAX, V|E},
+{"mblmax", "maximum macroblock Lagrange factor (VBR)", OFFSET(mb_lmax), AV_OPT_TYPE_INT, {.i64 = 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, {.i64 = 256 }, INT_MIN, INT_MAX, V|E},
+{"skip_loop_filter", NULL, OFFSET(skip_loop_filter), AV_OPT_TYPE_INT, {.i64 = AVDISCARD_DEFAULT }, INT_MIN, INT_MAX, V|D, "avdiscard"},
+{"skip_idct" , NULL, OFFSET(skip_idct) , AV_OPT_TYPE_INT, {.i64 = AVDISCARD_DEFAULT }, INT_MIN, INT_MAX, V|D, "avdiscard"},
+{"skip_frame" , NULL, OFFSET(skip_frame) , AV_OPT_TYPE_INT, {.i64 = AVDISCARD_DEFAULT }, INT_MIN, INT_MAX, V|D, "avdiscard"},
+{"none" , NULL, 0, AV_OPT_TYPE_CONST, {.i64 = AVDISCARD_NONE }, INT_MIN, INT_MAX, V|D, "avdiscard"},
+{"default" , NULL, 0, AV_OPT_TYPE_CONST, {.i64 = AVDISCARD_DEFAULT }, INT_MIN, INT_MAX, V|D, "avdiscard"},
+{"noref" , NULL, 0, AV_OPT_TYPE_CONST, {.i64 = AVDISCARD_NONREF }, INT_MIN, INT_MAX, V|D, "avdiscard"},
+{"bidir" , NULL, 0, AV_OPT_TYPE_CONST, {.i64 = AVDISCARD_BIDIR }, INT_MIN, INT_MAX, V|D, "avdiscard"},
+{"nokey" , NULL, 0, AV_OPT_TYPE_CONST, {.i64 = AVDISCARD_NONKEY }, INT_MIN, INT_MAX, V|D, "avdiscard"},
+{"all" , NULL, 0, AV_OPT_TYPE_CONST, {.i64 = 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, {.i64 = 1 }, 0, 4, V|E},
+{"brd_scale", "downscale frames for dynamic B-frame decision", OFFSET(brd_scale), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, 0, 10, V|E},
+{"keyint_min", "minimum interval between IDR-frames (x264)", OFFSET(keyint_min), AV_OPT_TYPE_INT, {.i64 = 25 }, INT_MIN, INT_MAX, V|E},
+{"refs", "reference frames to consider for motion compensation", OFFSET(refs), AV_OPT_TYPE_INT, {.i64 = 1 }, INT_MIN, INT_MAX, V|E},
+{"chromaoffset", "chroma QP offset from luma", OFFSET(chromaoffset), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E},
+{"trellis", "rate-distortion optimal quantization", OFFSET(trellis), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|A|E},
+#if FF_API_MPV_GLOBAL_OPTS
+{"skiprd", "Deprecated, use mpegvideo private options instead", 0, AV_OPT_TYPE_CONST, {.i64 = CODEC_FLAG2_SKIP_RD }, INT_MIN, INT_MAX, V|E, "flags2"},
+#endif
+{"sc_factor", "multiplied by qscale for each frame and added to scene_change_score", OFFSET(scenechange_factor), AV_OPT_TYPE_INT, {.i64 = 6 }, 0, INT_MAX, V|E},
+{"mv0_threshold", NULL, OFFSET(mv0_threshold), AV_OPT_TYPE_INT, {.i64 = 256 }, 0, INT_MAX, V|E},
+{"b_sensitivity", "adjust sensitivity of b_frame_strategy 1", OFFSET(b_sensitivity), AV_OPT_TYPE_INT, {.i64 = 40 }, 1, INT_MAX, V|E},
+{"compression_level", NULL, OFFSET(compression_level), AV_OPT_TYPE_INT, {.i64 = FF_COMPRESSION_DEFAULT }, INT_MIN, INT_MAX, V|A|E},
+{"min_prediction_order", NULL, OFFSET(min_prediction_order), AV_OPT_TYPE_INT, {.i64 = -1 }, INT_MIN, INT_MAX, A|E},
+{"max_prediction_order", NULL, OFFSET(max_prediction_order), AV_OPT_TYPE_INT, {.i64 = -1 }, INT_MIN, INT_MAX, A|E},
+{"timecode_frame_start", "GOP timecode frame start number, in non-drop-frame format", OFFSET(timecode_frame_start), AV_OPT_TYPE_INT64, {.i64 = 0 }, 0, INT64_MAX, V|E},
+#if FF_API_REQUEST_CHANNELS
+{"request_channels", "set desired number of audio channels", OFFSET(request_channels), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, 0, INT_MAX, A|D},
+#endif
+{"bits_per_raw_sample", NULL, OFFSET(bits_per_raw_sample), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX},
+{"channel_layout", NULL, OFFSET(channel_layout), AV_OPT_TYPE_INT64, {.i64 = DEFAULT }, 0, INT64_MAX, A|E|D, "channel_layout"},
+{"request_channel_layout", NULL, OFFSET(request_channel_layout), AV_OPT_TYPE_INT64, {.i64 = 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, {.i64 = 1 }, 1, INT_MAX, A|V|E|D},
+{"color_primaries", NULL, OFFSET(color_primaries), AV_OPT_TYPE_INT, {.i64 = AVCOL_PRI_UNSPECIFIED }, 1, AVCOL_PRI_NB-1, V|E|D},
+{"color_trc", NULL, OFFSET(color_trc), AV_OPT_TYPE_INT, {.i64 = AVCOL_TRC_UNSPECIFIED }, 1, AVCOL_TRC_NB-1, V|E|D},
+{"colorspace", NULL, OFFSET(colorspace), AV_OPT_TYPE_INT, {.i64 = AVCOL_SPC_UNSPECIFIED }, 1, AVCOL_SPC_NB-1, V|E|D},
+{"color_range", NULL, OFFSET(color_range), AV_OPT_TYPE_INT, {.i64 = AVCOL_RANGE_UNSPECIFIED }, 0, AVCOL_RANGE_NB-1, V|E|D},
+{"chroma_sample_location", NULL, OFFSET(chroma_sample_location), AV_OPT_TYPE_INT, {.i64 = AVCHROMA_LOC_UNSPECIFIED }, 0, AVCHROMA_LOC_NB-1, V|E|D},
+{"log_level_offset", "set the log level offset", OFFSET(log_level_offset), AV_OPT_TYPE_INT, {.i64 = 0 }, INT_MIN, INT_MAX },
+{"slices", "number of slices, used in parallelized encoding", OFFSET(slices), AV_OPT_TYPE_INT, {.i64 = 0 }, 0, INT_MAX, V|E},
+{"thread_type", "select multithreading type", OFFSET(thread_type), AV_OPT_TYPE_FLAGS, {.i64 = FF_THREAD_SLICE|FF_THREAD_FRAME }, 0, INT_MAX, V|E|D, "thread_type"},
+{"slice", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_THREAD_SLICE }, INT_MIN, INT_MAX, V|E|D, "thread_type"},
+{"frame", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = 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, {.i64 = 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, {.i64 = AV_AUDIO_SERVICE_TYPE_MAIN }, INT_MIN, INT_MAX, A|E, "audio_service_type"},
+{"ef", "Effects", 0, AV_OPT_TYPE_CONST, {.i64 = AV_AUDIO_SERVICE_TYPE_EFFECTS }, INT_MIN, INT_MAX, A|E, "audio_service_type"},
+{"vi", "Visually Impaired", 0, AV_OPT_TYPE_CONST, {.i64 = AV_AUDIO_SERVICE_TYPE_VISUALLY_IMPAIRED }, INT_MIN, INT_MAX, A|E, "audio_service_type"},
+{"hi", "Hearing Impaired", 0, AV_OPT_TYPE_CONST, {.i64 = AV_AUDIO_SERVICE_TYPE_HEARING_IMPAIRED }, INT_MIN, INT_MAX, A|E, "audio_service_type"},
+{"di", "Dialogue", 0, AV_OPT_TYPE_CONST, {.i64 = AV_AUDIO_SERVICE_TYPE_DIALOGUE }, INT_MIN, INT_MAX, A|E, "audio_service_type"},
+{"co", "Commentary", 0, AV_OPT_TYPE_CONST, {.i64 = AV_AUDIO_SERVICE_TYPE_COMMENTARY }, INT_MIN, INT_MAX, A|E, "audio_service_type"},
+{"em", "Emergency", 0, AV_OPT_TYPE_CONST, {.i64 = AV_AUDIO_SERVICE_TYPE_EMERGENCY }, INT_MIN, INT_MAX, A|E, "audio_service_type"},
+{"vo", "Voice Over", 0, AV_OPT_TYPE_CONST, {.i64 = AV_AUDIO_SERVICE_TYPE_VOICE_OVER }, INT_MIN, INT_MAX, A|E, "audio_service_type"},
+{"ka", "Karaoke", 0, AV_OPT_TYPE_CONST, {.i64 = AV_AUDIO_SERVICE_TYPE_KARAOKE }, INT_MIN, INT_MAX, A|E, "audio_service_type"},
+{"request_sample_fmt", NULL, OFFSET(request_sample_fmt), AV_OPT_TYPE_INT, {.i64 = 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, {.i64 = AV_SAMPLE_FMT_U8 }, INT_MIN, INT_MAX, A|D, "request_sample_fmt"},
+{"s16", "16-bit signed integer", 0, AV_OPT_TYPE_CONST, {.i64 = AV_SAMPLE_FMT_S16 }, INT_MIN, INT_MAX, A|D, "request_sample_fmt"},
+{"s32", "32-bit signed integer", 0, AV_OPT_TYPE_CONST, {.i64 = AV_SAMPLE_FMT_S32 }, INT_MIN, INT_MAX, A|D, "request_sample_fmt"},
+{"flt", "32-bit float", 0, AV_OPT_TYPE_CONST, {.i64 = AV_SAMPLE_FMT_FLT }, INT_MIN, INT_MAX, A|D, "request_sample_fmt"},
+{"dbl", "64-bit double", 0, AV_OPT_TYPE_CONST, {.i64 = AV_SAMPLE_FMT_DBL }, INT_MIN, INT_MAX, A|D, "request_sample_fmt"},
+{"u8p" , "8-bit unsigned integer planar", 0, AV_OPT_TYPE_CONST, {.i64 = AV_SAMPLE_FMT_U8P }, INT_MIN, INT_MAX, A|D, "request_sample_fmt"},
+{"s16p", "16-bit signed integer planar", 0, AV_OPT_TYPE_CONST, {.i64 = AV_SAMPLE_FMT_S16P }, INT_MIN, INT_MAX, A|D, "request_sample_fmt"},
+{"s32p", "32-bit signed integer planar", 0, AV_OPT_TYPE_CONST, {.i64 = AV_SAMPLE_FMT_S32P }, INT_MIN, INT_MAX, A|D, "request_sample_fmt"},
+{"fltp", "32-bit float planar", 0, AV_OPT_TYPE_CONST, {.i64 = AV_SAMPLE_FMT_FLTP }, INT_MIN, INT_MAX, A|D, "request_sample_fmt"},
+{"dblp", "64-bit double planar", 0, AV_OPT_TYPE_CONST, {.i64 = AV_SAMPLE_FMT_DBLP }, INT_MIN, INT_MAX, A|D, "request_sample_fmt"},
+{NULL},
+};
+
+#undef A
+#undef V
+#undef S
+#undef E
+#undef D
+#undef DEFAULT
+#undef OFFSET
+
+#endif /* AVCODEC_OPTIONS_TABLE_H */
diff --git a/gst-libs/ext/libav/libavcodec/pamenc.c b/gst-libs/ext/libav/libavcodec/pamenc.c
index 10960d5..dba4771 100644
--- a/gst-libs/ext/libav/libavcodec/pamenc.c
+++ b/gst-libs/ext/libav/libavcodec/pamenc.c
@@ -21,22 +21,24 @@
#include "avcodec.h"
#include "bytestream.h"
+#include "internal.h"
#include "pnm.h"
-static int pam_encode_frame(AVCodecContext *avctx, unsigned char *outbuf,
- int buf_size, void *data)
+static int pam_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
+ const AVFrame *pict, int *got_packet)
{
PNMContext *s = avctx->priv_data;
- AVFrame *pict = data;
- AVFrame * const p = (AVFrame*)&s->picture;
- int i, h, w, n, linesize, depth, maxval;
+ AVFrame * const p = &s->picture;
+ int i, h, w, n, linesize, depth, maxval, ret;
const char *tuple_type;
uint8_t *ptr;
- if (buf_size < avpicture_get_size(avctx->pix_fmt, avctx->width, avctx->height) + 200) {
+ if ((ret = ff_alloc_packet(pkt, avpicture_get_size(avctx->pix_fmt,
+ avctx->width,
+ avctx->height) + 200)) < 0) {
av_log(avctx, AV_LOG_ERROR, "encoded frame too large\n");
- return -1;
+ return ret;
}
*p = *pict;
@@ -44,31 +46,31 @@ static int pam_encode_frame(AVCodecContext *avctx, unsigned char *outbuf,
p->key_frame = 1;
s->bytestream_start =
- s->bytestream = outbuf;
- s->bytestream_end = outbuf+buf_size;
+ s->bytestream = pkt->data;
+ s->bytestream_end = pkt->data + pkt->size;
h = avctx->height;
w = avctx->width;
switch (avctx->pix_fmt) {
- case PIX_FMT_MONOWHITE:
+ case AV_PIX_FMT_MONOWHITE:
n = (w + 7) >> 3;
depth = 1;
maxval = 1;
tuple_type = "BLACKANDWHITE";
break;
- case PIX_FMT_GRAY8:
+ case AV_PIX_FMT_GRAY8:
n = w;
depth = 1;
maxval = 255;
tuple_type = "GRAYSCALE";
break;
- case PIX_FMT_RGB24:
+ case AV_PIX_FMT_RGB24:
n = w * 3;
depth = 3;
maxval = 255;
tuple_type = "RGB";
break;
- case PIX_FMT_RGB32:
+ case AV_PIX_FMT_RGB32:
n = w * 4;
depth = 4;
maxval = 255;
@@ -78,14 +80,14 @@ static int pam_encode_frame(AVCodecContext *avctx, unsigned char *outbuf,
return -1;
}
snprintf(s->bytestream, s->bytestream_end - s->bytestream,
- "P7\nWIDTH %d\nHEIGHT %d\nDEPTH %d\nMAXVAL %d\nTUPLETYPE %s\nENDHDR\n",
+ "P7\nWIDTH %d\nHEIGHT %d\nDEPTH %d\nMAXVAL %d\nTUPLTYPE %s\nENDHDR\n",
w, h, depth, maxval, tuple_type);
s->bytestream += strlen(s->bytestream);
ptr = p->data[0];
linesize = p->linesize[0];
- if (avctx->pix_fmt == PIX_FMT_RGB32) {
+ if (avctx->pix_fmt == AV_PIX_FMT_RGB32) {
int j;
unsigned int v;
@@ -104,17 +106,24 @@ static int pam_encode_frame(AVCodecContext *avctx, unsigned char *outbuf,
ptr += linesize;
}
}
- return s->bytestream - s->bytestream_start;
+
+ pkt->size = s->bytestream - s->bytestream_start;
+ pkt->flags |= AV_PKT_FLAG_KEY;
+ *got_packet = 1;
+ return 0;
}
AVCodec ff_pam_encoder = {
.name = "pam",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_PAM,
+ .id = AV_CODEC_ID_PAM,
.priv_data_size = sizeof(PNMContext),
.init = ff_pnm_init,
- .encode = pam_encode_frame,
- .pix_fmts = (const enum PixelFormat[]){PIX_FMT_RGB24, PIX_FMT_RGB32, PIX_FMT_GRAY8, PIX_FMT_MONOWHITE, PIX_FMT_NONE},
- .long_name = NULL_IF_CONFIG_SMALL("PAM (Portable AnyMap) image"),
+ .encode2 = pam_encode_frame,
+ .pix_fmts = (const enum AVPixelFormat[]){
+ AV_PIX_FMT_RGB24, AV_PIX_FMT_RGB32, AV_PIX_FMT_GRAY8, AV_PIX_FMT_MONOWHITE,
+ AV_PIX_FMT_NONE
+ },
+ .long_name = NULL_IF_CONFIG_SMALL("PAM (Portable AnyMap) image"),
};
diff --git a/gst-libs/ext/libav/libavcodec/parser.c b/gst-libs/ext/libav/libavcodec/parser.c
index 1bb5f8c..6e755f6 100644
--- a/gst-libs/ext/libav/libavcodec/parser.c
+++ b/gst-libs/ext/libav/libavcodec/parser.c
@@ -20,7 +20,10 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <string.h>
+
#include "parser.h"
+#include "libavutil/mem.h"
static AVCodecParser *av_first_parser = NULL;
@@ -41,7 +44,7 @@ AVCodecParserContext *av_parser_init(int codec_id)
AVCodecParser *parser;
int ret;
- if(codec_id == CODEC_ID_NONE)
+ if(codec_id == AV_CODEC_ID_NONE)
return NULL;
for(parser = av_first_parser; parser != NULL; parser = parser->next) {
@@ -93,7 +96,7 @@ void ff_fetch_timestamp(AVCodecParserContext *s, int off, int remove){
if ( s->cur_offset + off >= s->cur_frame_offset[i]
&& (s->frame_offset < s->cur_frame_offset[i] ||
(!s->frame_offset && !s->next_frame_offset)) // first field/frame
- //check is disabled because mpeg-ts doesnt send complete PES packets
+ // check disabled since MPEG-TS does not send complete PES packets
&& /*s->next_frame_offset + off <*/ s->cur_frame_end[i]){
s->dts= s->cur_frame_dts[i];
s->pts= s->cur_frame_pts[i];
@@ -149,7 +152,6 @@ int av_parser_parse2(AVCodecParserContext *s,
/* WARNING: the returned index can be negative */
index = s->parser->parser_parse(s, avctx, (const uint8_t **)poutbuf, poutbuf_size, buf, buf_size);
-//av_log(NULL, AV_LOG_DEBUG, "parser: in:%"PRId64", %"PRId64", out:%"PRId64", %"PRId64", in:%d out:%d id:%d\n", pts, dts, s->last_pts, s->last_dts, buf_size, *poutbuf_size, avctx->codec_id);
/* update the file pointer */
if (*poutbuf_size) {
/* fill the data for the current frame */
@@ -165,11 +167,6 @@ int av_parser_parse2(AVCodecParserContext *s,
return index;
}
-/**
- *
- * @return 0 if the output buffer is a subset of the input, 1 if it is allocated and must be freed
- * @deprecated use AVBitstreamFilter
- */
int av_parser_change(AVCodecParserContext *s,
AVCodecContext *avctx,
uint8_t **poutbuf, int *poutbuf_size,
@@ -215,16 +212,12 @@ void av_parser_close(AVCodecParserContext *s)
/*****************************************************/
-/**
- * Combine the (truncated) bitstream to a complete frame.
- * @return -1 if no complete frame could be created, AVERROR(ENOMEM) if there was a memory allocation error
- */
int ff_combine_frame(ParseContext *pc, int next, const uint8_t **buf, int *buf_size)
{
if(pc->overread){
- av_dlog(pc, "overread %d, state:%X next:%d index:%d o_index:%d\n",
+ av_dlog(NULL, "overread %d, state:%X next:%d index:%d o_index:%d\n",
pc->overread, pc->state, next, pc->index, pc->overread_index);
- av_dlog(pc, "%X %X %X %X\n", (*buf)[0], (*buf)[1], (*buf)[2], (*buf)[3]);
+ av_dlog(NULL, "%X %X %X %X\n", (*buf)[0], (*buf)[1], (*buf)[2], (*buf)[3]);
}
/* Copy overread bytes from last frame into buffer. */
@@ -276,9 +269,9 @@ int ff_combine_frame(ParseContext *pc, int next, const uint8_t **buf, int *buf_s
}
if(pc->overread){
- av_dlog(pc, "overread %d, state:%X next:%d index:%d o_index:%d\n",
+ av_dlog(NULL, "overread %d, state:%X next:%d index:%d o_index:%d\n",
pc->overread, pc->state, next, pc->index, pc->overread_index);
- av_dlog(pc, "%X %X %X %X\n", (*buf)[0], (*buf)[1],(*buf)[2],(*buf)[3]);
+ av_dlog(NULL, "%X %X %X %X\n", (*buf)[0], (*buf)[1],(*buf)[2],(*buf)[3]);
}
return 0;
@@ -291,14 +284,6 @@ void ff_parse_close(AVCodecParserContext *s)
av_freep(&pc->buffer);
}
-void ff_parse1_close(AVCodecParserContext *s)
-{
- ParseContext1 *pc1 = s->priv_data;
-
- av_free(pc1->pc.buffer);
- av_free(pc1->enc);
-}
-
/*************************/
int ff_mpeg4video_split(AVCodecContext *avctx,
diff --git a/gst-libs/ext/libav/libavcodec/parser.h b/gst-libs/ext/libav/libavcodec/parser.h
index 1e85ae4..ea1cae2 100644
--- a/gst-libs/ext/libav/libavcodec/parser.h
+++ b/gst-libs/ext/libav/libavcodec/parser.h
@@ -37,28 +37,17 @@ typedef struct ParseContext{
uint64_t state64; ///< contains the last 8 bytes in MSB order
} ParseContext;
-struct MpegEncContext;
-
-typedef struct ParseContext1{
- ParseContext pc;
-/* XXX/FIXME PC1 vs. PC */
- /* MPEG-2-specific */
- AVRational frame_rate;
- int progressive_sequence;
- int width, height;
-
- /* XXX: suppress that, needed by MPEG-4 */
- struct MpegEncContext *enc;
- int first_picture;
-} ParseContext1;
-
#define END_NOT_FOUND (-100)
+/**
+ * Combine the (truncated) bitstream to a complete frame.
+ * @return -1 if no complete frame could be created,
+ * AVERROR(ENOMEM) if there was a memory allocation error
+ */
int ff_combine_frame(ParseContext *pc, int next, const uint8_t **buf, int *buf_size);
int ff_mpeg4video_split(AVCodecContext *avctx, const uint8_t *buf,
int buf_size);
void ff_parse_close(AVCodecParserContext *s);
-void ff_parse1_close(AVCodecParserContext *s);
/**
* Fetch timestamps for a specific byte within the current access unit.
diff --git a/gst-libs/ext/libav/libavcodec/pcm-mpeg.c b/gst-libs/ext/libav/libavcodec/pcm-mpeg.c
index f010b97..c8c683d 100644
--- a/gst-libs/ext/libav/libavcodec/pcm-mpeg.c
+++ b/gst-libs/ext/libav/libavcodec/pcm-mpeg.c
@@ -24,9 +24,10 @@
* PCM codecs for encodings found in MPEG streams (DVD/Blu-ray)
*/
-#include "libavutil/audioconvert.h"
+#include "libavutil/channel_layout.h"
#include "avcodec.h"
#include "bytestream.h"
+#include "internal.h"
/*
* Channel Mapping according to
@@ -70,13 +71,14 @@ static int pcm_bluray_parse_header(AVCodecContext *avctx,
/* get the sample depth and derive the sample format from it */
avctx->bits_per_coded_sample = bits_per_samples[header[3] >> 6];
if (!avctx->bits_per_coded_sample) {
- av_log(avctx, AV_LOG_ERROR, "unsupported sample depth (0)\n");
+ av_log(avctx, AV_LOG_ERROR, "reserved sample depth (0)\n");
return -1;
}
avctx->sample_fmt = avctx->bits_per_coded_sample == 16 ? AV_SAMPLE_FMT_S16 :
AV_SAMPLE_FMT_S32;
+ avctx->bits_per_raw_sample = avctx->bits_per_coded_sample;
- /* get the sample rate. Not all values are known or exist. */
+ /* get the sample rate. Not all values are used. */
switch (header[2] & 0x0f) {
case 1:
avctx->sample_rate = 48000;
@@ -89,13 +91,13 @@ static int pcm_bluray_parse_header(AVCodecContext *avctx,
break;
default:
avctx->sample_rate = 0;
- av_log(avctx, AV_LOG_ERROR, "unsupported sample rate (%d)\n",
+ av_log(avctx, AV_LOG_ERROR, "reserved sample rate (%d)\n",
header[2] & 0x0f);
return -1;
}
/*
- * get the channel number (and mapping). Not all values are known or exist.
+ * get the channel number (and mapping). Not all values are used.
* It must be noted that the number of channels in the MPEG stream can
* differ from the actual meaningful number, e.g. mono audio still has two
* channels, one being empty.
@@ -103,17 +105,17 @@ static int pcm_bluray_parse_header(AVCodecContext *avctx,
avctx->channel_layout = channel_layouts[channel_layout];
avctx->channels = channels[channel_layout];
if (!avctx->channels) {
- av_log(avctx, AV_LOG_ERROR, "unsupported channel configuration (%d)\n",
+ av_log(avctx, AV_LOG_ERROR, "reserved channel configuration (%d)\n",
channel_layout);
return -1;
}
- avctx->bit_rate = avctx->channels * avctx->sample_rate *
+ avctx->bit_rate = FFALIGN(avctx->channels, 2) * avctx->sample_rate *
avctx->bits_per_coded_sample;
if (avctx->debug & FF_DEBUG_PICT_INFO)
av_dlog(avctx,
- "pcm_bluray_parse_header: %d channels, %d bits per sample, %d kHz, %d kbit\n",
+ "pcm_bluray_parse_header: %d channels, %d bits per sample, %d Hz, %d bit/s\n",
avctx->channels, avctx->bits_per_coded_sample,
avctx->sample_rate, avctx->bit_rate);
return 0;
@@ -139,6 +141,7 @@ static int pcm_bluray_decode_frame(AVCodecContext *avctx, void *data,
const uint8_t *src = avpkt->data;
int buf_size = avpkt->size;
PCMBRDecode *s = avctx->priv_data;
+ GetByteContext gb;
int num_source_channels, channel, retval;
int sample_size, samples;
int16_t *dst16;
@@ -154,6 +157,8 @@ static int pcm_bluray_decode_frame(AVCodecContext *avctx, void *data,
src += 4;
buf_size -= 4;
+ bytestream2_init(&gb, src, buf_size);
+
/* There's always an even number of channels in the source */
num_source_channels = FFALIGN(avctx->channels, 2);
sample_size = (num_source_channels * (avctx->sample_fmt == AV_SAMPLE_FMT_S16 ? 16 : 24)) >> 3;
@@ -161,7 +166,7 @@ static int pcm_bluray_decode_frame(AVCodecContext *avctx, void *data,
/* get output buffer */
s->frame.nb_samples = samples;
- if ((retval = avctx->get_buffer(avctx, &s->frame)) < 0) {
+ if ((retval = ff_get_buffer(avctx, &s->frame)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return retval;
}
@@ -177,15 +182,15 @@ static int pcm_bluray_decode_frame(AVCodecContext *avctx, void *data,
samples *= num_source_channels;
if (AV_SAMPLE_FMT_S16 == avctx->sample_fmt) {
#if HAVE_BIGENDIAN
- memcpy(dst16, src, buf_size);
+ bytestream2_get_buffer(&gb, dst16, buf_size);
#else
do {
- *dst16++ = bytestream_get_be16(&src);
+ *dst16++ = bytestream2_get_be16u(&gb);
} while (--samples);
#endif
} else {
do {
- *dst32++ = bytestream_get_be24(&src) << 8;
+ *dst32++ = bytestream2_get_be24u(&gb) << 8;
} while (--samples);
}
break;
@@ -197,24 +202,23 @@ static int pcm_bluray_decode_frame(AVCodecContext *avctx, void *data,
if (AV_SAMPLE_FMT_S16 == avctx->sample_fmt) {
do {
#if HAVE_BIGENDIAN
- memcpy(dst16, src, avctx->channels * 2);
+ bytestream2_get_buffer(&gb, dst16, avctx->channels * 2);
dst16 += avctx->channels;
- src += sample_size;
#else
channel = avctx->channels;
do {
- *dst16++ = bytestream_get_be16(&src);
+ *dst16++ = bytestream2_get_be16u(&gb);
} while (--channel);
- src += 2;
#endif
+ bytestream2_skip(&gb, 2);
} while (--samples);
} else {
do {
channel = avctx->channels;
do {
- *dst32++ = bytestream_get_be24(&src) << 8;
+ *dst32++ = bytestream2_get_be24u(&gb) << 8;
} while (--channel);
- src += 3;
+ bytestream2_skip(&gb, 3);
} while (--samples);
}
break;
@@ -222,22 +226,22 @@ static int pcm_bluray_decode_frame(AVCodecContext *avctx, void *data,
case AV_CH_LAYOUT_5POINT1:
if (AV_SAMPLE_FMT_S16 == avctx->sample_fmt) {
do {
- dst16[0] = bytestream_get_be16(&src);
- dst16[1] = bytestream_get_be16(&src);
- dst16[2] = bytestream_get_be16(&src);
- dst16[4] = bytestream_get_be16(&src);
- dst16[5] = bytestream_get_be16(&src);
- dst16[3] = bytestream_get_be16(&src);
+ dst16[0] = bytestream2_get_be16u(&gb);
+ dst16[1] = bytestream2_get_be16u(&gb);
+ dst16[2] = bytestream2_get_be16u(&gb);
+ dst16[4] = bytestream2_get_be16u(&gb);
+ dst16[5] = bytestream2_get_be16u(&gb);
+ dst16[3] = bytestream2_get_be16u(&gb);
dst16 += 6;
} while (--samples);
} else {
do {
- dst32[0] = bytestream_get_be24(&src) << 8;
- dst32[1] = bytestream_get_be24(&src) << 8;
- dst32[2] = bytestream_get_be24(&src) << 8;
- dst32[4] = bytestream_get_be24(&src) << 8;
- dst32[5] = bytestream_get_be24(&src) << 8;
- dst32[3] = bytestream_get_be24(&src) << 8;
+ dst32[0] = bytestream2_get_be24u(&gb) << 8;
+ dst32[1] = bytestream2_get_be24u(&gb) << 8;
+ dst32[2] = bytestream2_get_be24u(&gb) << 8;
+ dst32[4] = bytestream2_get_be24u(&gb) << 8;
+ dst32[5] = bytestream2_get_be24u(&gb) << 8;
+ dst32[3] = bytestream2_get_be24u(&gb) << 8;
dst32 += 6;
} while (--samples);
}
@@ -246,27 +250,27 @@ static int pcm_bluray_decode_frame(AVCodecContext *avctx, void *data,
case AV_CH_LAYOUT_7POINT0:
if (AV_SAMPLE_FMT_S16 == avctx->sample_fmt) {
do {
- dst16[0] = bytestream_get_be16(&src);
- dst16[1] = bytestream_get_be16(&src);
- dst16[2] = bytestream_get_be16(&src);
- dst16[5] = bytestream_get_be16(&src);
- dst16[3] = bytestream_get_be16(&src);
- dst16[4] = bytestream_get_be16(&src);
- dst16[6] = bytestream_get_be16(&src);
+ dst16[0] = bytestream2_get_be16u(&gb);
+ dst16[1] = bytestream2_get_be16u(&gb);
+ dst16[2] = bytestream2_get_be16u(&gb);
+ dst16[5] = bytestream2_get_be16u(&gb);
+ dst16[3] = bytestream2_get_be16u(&gb);
+ dst16[4] = bytestream2_get_be16u(&gb);
+ dst16[6] = bytestream2_get_be16u(&gb);
dst16 += 7;
- src += 2;
+ bytestream2_skip(&gb, 2);
} while (--samples);
} else {
do {
- dst32[0] = bytestream_get_be24(&src) << 8;
- dst32[1] = bytestream_get_be24(&src) << 8;
- dst32[2] = bytestream_get_be24(&src) << 8;
- dst32[5] = bytestream_get_be24(&src) << 8;
- dst32[3] = bytestream_get_be24(&src) << 8;
- dst32[4] = bytestream_get_be24(&src) << 8;
- dst32[6] = bytestream_get_be24(&src) << 8;
+ dst32[0] = bytestream2_get_be24u(&gb) << 8;
+ dst32[1] = bytestream2_get_be24u(&gb) << 8;
+ dst32[2] = bytestream2_get_be24u(&gb) << 8;
+ dst32[5] = bytestream2_get_be24u(&gb) << 8;
+ dst32[3] = bytestream2_get_be24u(&gb) << 8;
+ dst32[4] = bytestream2_get_be24u(&gb) << 8;
+ dst32[6] = bytestream2_get_be24u(&gb) << 8;
dst32 += 7;
- src += 3;
+ bytestream2_skip(&gb, 3);
} while (--samples);
}
break;
@@ -274,26 +278,26 @@ static int pcm_bluray_decode_frame(AVCodecContext *avctx, void *data,
case AV_CH_LAYOUT_7POINT1:
if (AV_SAMPLE_FMT_S16 == avctx->sample_fmt) {
do {
- dst16[0] = bytestream_get_be16(&src);
- dst16[1] = bytestream_get_be16(&src);
- dst16[2] = bytestream_get_be16(&src);
- dst16[6] = bytestream_get_be16(&src);
- dst16[4] = bytestream_get_be16(&src);
- dst16[5] = bytestream_get_be16(&src);
- dst16[7] = bytestream_get_be16(&src);
- dst16[3] = bytestream_get_be16(&src);
+ dst16[0] = bytestream2_get_be16u(&gb);
+ dst16[1] = bytestream2_get_be16u(&gb);
+ dst16[2] = bytestream2_get_be16u(&gb);
+ dst16[6] = bytestream2_get_be16u(&gb);
+ dst16[4] = bytestream2_get_be16u(&gb);
+ dst16[5] = bytestream2_get_be16u(&gb);
+ dst16[7] = bytestream2_get_be16u(&gb);
+ dst16[3] = bytestream2_get_be16u(&gb);
dst16 += 8;
} while (--samples);
} else {
do {
- dst32[0] = bytestream_get_be24(&src) << 8;
- dst32[1] = bytestream_get_be24(&src) << 8;
- dst32[2] = bytestream_get_be24(&src) << 8;
- dst32[6] = bytestream_get_be24(&src) << 8;
- dst32[4] = bytestream_get_be24(&src) << 8;
- dst32[5] = bytestream_get_be24(&src) << 8;
- dst32[7] = bytestream_get_be24(&src) << 8;
- dst32[3] = bytestream_get_be24(&src) << 8;
+ dst32[0] = bytestream2_get_be24u(&gb) << 8;
+ dst32[1] = bytestream2_get_be24u(&gb) << 8;
+ dst32[2] = bytestream2_get_be24u(&gb) << 8;
+ dst32[6] = bytestream2_get_be24u(&gb) << 8;
+ dst32[4] = bytestream2_get_be24u(&gb) << 8;
+ dst32[5] = bytestream2_get_be24u(&gb) << 8;
+ dst32[7] = bytestream2_get_be24u(&gb) << 8;
+ dst32[3] = bytestream2_get_be24u(&gb) << 8;
dst32 += 8;
} while (--samples);
}
@@ -304,22 +308,23 @@ static int pcm_bluray_decode_frame(AVCodecContext *avctx, void *data,
*got_frame_ptr = 1;
*(AVFrame *)data = s->frame;
- retval = src - avpkt->data;
+ retval = bytestream2_tell(&gb);
if (avctx->debug & FF_DEBUG_BITSTREAM)
av_dlog(avctx, "pcm_bluray_decode_frame: decoded %d -> %d bytes\n",
retval, buf_size);
- return retval;
+ return retval + 4;
}
AVCodec ff_pcm_bluray_decoder = {
.name = "pcm_bluray",
.type = AVMEDIA_TYPE_AUDIO,
- .id = CODEC_ID_PCM_BLURAY,
+ .id = AV_CODEC_ID_PCM_BLURAY,
.priv_data_size = sizeof(PCMBRDecode),
.init = pcm_bluray_decode_init,
.decode = pcm_bluray_decode_frame,
.capabilities = CODEC_CAP_DR1,
- .sample_fmts = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S32,
- AV_SAMPLE_FMT_NONE},
- .long_name = NULL_IF_CONFIG_SMALL("PCM signed 16|20|24-bit big-endian for Blu-ray media"),
+ .sample_fmts = (const enum AVSampleFormat[]){
+ AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_NONE
+ },
+ .long_name = NULL_IF_CONFIG_SMALL("PCM signed 16|20|24-bit big-endian for Blu-ray media"),
};
diff --git a/gst-libs/ext/libav/libavcodec/pcm.c b/gst-libs/ext/libav/libavcodec/pcm.c
index 1adaf70..d6899cf 100644
--- a/gst-libs/ext/libav/libavcodec/pcm.c
+++ b/gst-libs/ext/libav/libavcodec/pcm.c
@@ -24,22 +24,21 @@
* PCM codecs
*/
+#include "libavutil/attributes.h"
#include "avcodec.h"
-#include "libavutil/common.h" /* for av_reverse */
#include "bytestream.h"
#include "internal.h"
+#include "mathops.h"
#include "pcm_tablegen.h"
-#define MAX_CHANNELS 64
-
static av_cold int pcm_encode_init(AVCodecContext *avctx)
{
avctx->frame_size = 0;
- switch(avctx->codec->id) {
- case CODEC_ID_PCM_ALAW:
+ switch (avctx->codec->id) {
+ case AV_CODEC_ID_PCM_ALAW:
pcm_alaw_tableinit();
break;
- case CODEC_ID_PCM_MULAW:
+ case AV_CODEC_ID_PCM_MULAW:
pcm_ulaw_tableinit();
break;
default:
@@ -47,9 +46,11 @@ static av_cold int pcm_encode_init(AVCodecContext *avctx)
}
avctx->bits_per_coded_sample = av_get_bits_per_sample(avctx->codec->id);
- avctx->block_align = avctx->channels * avctx->bits_per_coded_sample/8;
- avctx->coded_frame= avcodec_alloc_frame();
- avctx->coded_frame->key_frame= 1;
+ avctx->block_align = avctx->channels * avctx->bits_per_coded_sample / 8;
+ avctx->bit_rate = avctx->block_align * avctx->sample_rate * 8;
+ avctx->coded_frame = avcodec_alloc_frame();
+ if (!avctx->coded_frame)
+ return AVERROR(ENOMEM);
return 0;
}
@@ -63,19 +64,19 @@ static av_cold int pcm_encode_close(AVCodecContext *avctx)
/**
* Write PCM samples macro
- * @param type Datatype of native machine format
+ * @param type Datatype of native machine format
* @param endian bytestream_put_xxx() suffix
- * @param src Source pointer (variable name)
- * @param dst Destination pointer (variable name)
- * @param n Total number of samples (variable name)
- * @param shift Bitshift (bits)
+ * @param src Source pointer (variable name)
+ * @param dst Destination pointer (variable name)
+ * @param n Total number of samples (variable name)
+ * @param shift Bitshift (bits)
* @param offset Sample value offset
*/
-#define ENCODE(type, endian, src, dst, n, shift, offset) \
- samples_##type = (const type*) src; \
- for(;n>0;n--) { \
- register type v = (*samples_##type++ >> shift) + offset; \
- bytestream_put_##endian(&dst, v); \
+#define ENCODE(type, endian, src, dst, n, shift, offset) \
+ samples_ ## type = (const type *) src; \
+ for (; n > 0; n--) { \
+ register type v = (*samples_ ## type++ >> shift) + offset; \
+ bytestream_put_ ## endian(&dst, v); \
}
static int pcm_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
@@ -91,7 +92,7 @@ static int pcm_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
const uint16_t *samples_uint16_t;
const uint32_t *samples_uint32_t;
- sample_size = av_get_bits_per_sample(avctx->codec->id)/8;
+ sample_size = av_get_bits_per_sample(avctx->codec->id) / 8;
n = frame->nb_samples * avctx->channels;
samples = (const short *)frame->data[0];
@@ -101,91 +102,91 @@ static int pcm_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
}
dst = avpkt->data;
- switch(avctx->codec->id) {
- case CODEC_ID_PCM_U32LE:
+ switch (avctx->codec->id) {
+ case AV_CODEC_ID_PCM_U32LE:
ENCODE(uint32_t, le32, samples, dst, n, 0, 0x80000000)
break;
- case CODEC_ID_PCM_U32BE:
+ case AV_CODEC_ID_PCM_U32BE:
ENCODE(uint32_t, be32, samples, dst, n, 0, 0x80000000)
break;
- case CODEC_ID_PCM_S24LE:
+ case AV_CODEC_ID_PCM_S24LE:
ENCODE(int32_t, le24, samples, dst, n, 8, 0)
break;
- case CODEC_ID_PCM_S24BE:
+ case AV_CODEC_ID_PCM_S24BE:
ENCODE(int32_t, be24, samples, dst, n, 8, 0)
break;
- case CODEC_ID_PCM_U24LE:
+ case AV_CODEC_ID_PCM_U24LE:
ENCODE(uint32_t, le24, samples, dst, n, 8, 0x800000)
break;
- case CODEC_ID_PCM_U24BE:
+ case AV_CODEC_ID_PCM_U24BE:
ENCODE(uint32_t, be24, samples, dst, n, 8, 0x800000)
break;
- case CODEC_ID_PCM_S24DAUD:
- for(;n>0;n--) {
- uint32_t tmp = av_reverse[(*samples >> 8) & 0xff] +
- (av_reverse[*samples & 0xff] << 8);
+ case AV_CODEC_ID_PCM_S24DAUD:
+ for (; n > 0; n--) {
+ uint32_t tmp = ff_reverse[(*samples >> 8) & 0xff] +
+ (ff_reverse[*samples & 0xff] << 8);
tmp <<= 4; // sync flags would go here
bytestream_put_be24(&dst, tmp);
samples++;
}
break;
- case CODEC_ID_PCM_U16LE:
+ case AV_CODEC_ID_PCM_U16LE:
ENCODE(uint16_t, le16, samples, dst, n, 0, 0x8000)
break;
- case CODEC_ID_PCM_U16BE:
+ case AV_CODEC_ID_PCM_U16BE:
ENCODE(uint16_t, be16, samples, dst, n, 0, 0x8000)
break;
- case CODEC_ID_PCM_S8:
+ case AV_CODEC_ID_PCM_S8:
srcu8 = frame->data[0];
- for(;n>0;n--) {
- v = *srcu8++;
+ for (; n > 0; n--) {
+ v = *srcu8++;
*dst++ = v - 128;
}
break;
#if HAVE_BIGENDIAN
- case CODEC_ID_PCM_F64LE:
+ case AV_CODEC_ID_PCM_F64LE:
ENCODE(int64_t, le64, samples, dst, n, 0, 0)
break;
- case CODEC_ID_PCM_S32LE:
- case CODEC_ID_PCM_F32LE:
+ case AV_CODEC_ID_PCM_S32LE:
+ case AV_CODEC_ID_PCM_F32LE:
ENCODE(int32_t, le32, samples, dst, n, 0, 0)
break;
- case CODEC_ID_PCM_S16LE:
+ case AV_CODEC_ID_PCM_S16LE:
ENCODE(int16_t, le16, samples, dst, n, 0, 0)
break;
- case CODEC_ID_PCM_F64BE:
- case CODEC_ID_PCM_F32BE:
- case CODEC_ID_PCM_S32BE:
- case CODEC_ID_PCM_S16BE:
+ case AV_CODEC_ID_PCM_F64BE:
+ case AV_CODEC_ID_PCM_F32BE:
+ case AV_CODEC_ID_PCM_S32BE:
+ case AV_CODEC_ID_PCM_S16BE:
#else
- case CODEC_ID_PCM_F64BE:
+ case AV_CODEC_ID_PCM_F64BE:
ENCODE(int64_t, be64, samples, dst, n, 0, 0)
break;
- case CODEC_ID_PCM_F32BE:
- case CODEC_ID_PCM_S32BE:
+ case AV_CODEC_ID_PCM_F32BE:
+ case AV_CODEC_ID_PCM_S32BE:
ENCODE(int32_t, be32, samples, dst, n, 0, 0)
break;
- case CODEC_ID_PCM_S16BE:
+ case AV_CODEC_ID_PCM_S16BE:
ENCODE(int16_t, be16, samples, dst, n, 0, 0)
break;
- case CODEC_ID_PCM_F64LE:
- case CODEC_ID_PCM_F32LE:
- case CODEC_ID_PCM_S32LE:
- case CODEC_ID_PCM_S16LE:
+ case AV_CODEC_ID_PCM_F64LE:
+ case AV_CODEC_ID_PCM_F32LE:
+ case AV_CODEC_ID_PCM_S32LE:
+ case AV_CODEC_ID_PCM_S16LE:
#endif /* HAVE_BIGENDIAN */
- case CODEC_ID_PCM_U8:
- memcpy(dst, samples, n*sample_size);
- dst += n*sample_size;
+ case AV_CODEC_ID_PCM_U8:
+ memcpy(dst, samples, n * sample_size);
+ dst += n * sample_size;
break;
- case CODEC_ID_PCM_ALAW:
- for(;n>0;n--) {
- v = *samples++;
+ case AV_CODEC_ID_PCM_ALAW:
+ for (; n > 0; n--) {
+ v = *samples++;
*dst++ = linear_to_alaw[(v + 32768) >> 2];
}
break;
- case CODEC_ID_PCM_MULAW:
- for(;n>0;n--) {
- v = *samples++;
+ case AV_CODEC_ID_PCM_MULAW:
+ for (; n > 0; n--) {
+ v = *samples++;
*dst++ = linear_to_ulaw[(v + 32768) >> 2];
}
break;
@@ -193,33 +194,32 @@ static int pcm_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
return -1;
}
- avpkt->size = frame->nb_samples * avctx->channels * sample_size;
*got_packet_ptr = 1;
return 0;
}
typedef struct PCMDecode {
AVFrame frame;
- short table[256];
+ short table[256];
} PCMDecode;
-static av_cold int pcm_decode_init(AVCodecContext * avctx)
+static av_cold int pcm_decode_init(AVCodecContext *avctx)
{
PCMDecode *s = avctx->priv_data;
int i;
- if (avctx->channels <= 0 || avctx->channels > MAX_CHANNELS) {
+ if (avctx->channels <= 0) {
av_log(avctx, AV_LOG_ERROR, "PCM channels out of bounds\n");
return AVERROR(EINVAL);
}
- switch(avctx->codec->id) {
- case CODEC_ID_PCM_ALAW:
- for(i=0;i<256;i++)
+ switch (avctx->codec->id) {
+ case AV_CODEC_ID_PCM_ALAW:
+ for (i = 0; i < 256; i++)
s->table[i] = alaw2linear(i);
break;
- case CODEC_ID_PCM_MULAW:
- for(i=0;i<256;i++)
+ case AV_CODEC_ID_PCM_MULAW:
+ for (i = 0; i < 256; i++)
s->table[i] = ulaw2linear(i);
break;
default:
@@ -239,36 +239,36 @@ static av_cold int pcm_decode_init(AVCodecContext * avctx)
/**
* Read PCM samples macro
- * @param size Data size of native machine format
+ * @param size Data size of native machine format
* @param endian bytestream_get_xxx() endian suffix
- * @param src Source pointer (variable name)
- * @param dst Destination pointer (variable name)
- * @param n Total number of samples (variable name)
- * @param shift Bitshift (bits)
+ * @param src Source pointer (variable name)
+ * @param dst Destination pointer (variable name)
+ * @param n Total number of samples (variable name)
+ * @param shift Bitshift (bits)
* @param offset Sample value offset
*/
-#define DECODE(size, endian, src, dst, n, shift, offset) \
- for(;n>0;n--) { \
- uint##size##_t v = bytestream_get_##endian(&src); \
- AV_WN##size##A(dst, (v - offset) << shift); \
- dst += size / 8; \
+#define DECODE(size, endian, src, dst, n, shift, offset) \
+ for (; n > 0; n--) { \
+ uint ## size ## _t v = bytestream_get_ ## endian(&src); \
+ AV_WN ## size ## A(dst, (v - offset) << shift); \
+ dst += size / 8; \
}
static int pcm_decode_frame(AVCodecContext *avctx, void *data,
int *got_frame_ptr, AVPacket *avpkt)
{
const uint8_t *src = avpkt->data;
- int buf_size = avpkt->size;
- PCMDecode *s = avctx->priv_data;
+ int buf_size = avpkt->size;
+ PCMDecode *s = avctx->priv_data;
int sample_size, c, n, ret, samples_per_block;
uint8_t *samples;
int32_t *dst_int32_t;
- sample_size = av_get_bits_per_sample(avctx->codec_id)/8;
+ sample_size = av_get_bits_per_sample(avctx->codec_id) / 8;
- /* av_get_bits_per_sample returns 0 for CODEC_ID_PCM_DVD */
+ /* av_get_bits_per_sample returns 0 for AV_CODEC_ID_PCM_DVD */
samples_per_block = 1;
- if (CODEC_ID_PCM_DVD == avctx->codec_id) {
+ if (AV_CODEC_ID_PCM_DVD == avctx->codec_id) {
if (avctx->bits_per_coded_sample != 20 &&
avctx->bits_per_coded_sample != 24) {
av_log(avctx, AV_LOG_ERROR, "PCM DVD unsupported sample depth\n");
@@ -276,11 +276,11 @@ static int pcm_decode_frame(AVCodecContext *avctx, void *data,
}
/* 2 samples are interleaved per block in PCM_DVD */
samples_per_block = 2;
- sample_size = avctx->bits_per_coded_sample * 2 / 8;
- } else if (avctx->codec_id == CODEC_ID_PCM_LXF) {
+ sample_size = avctx->bits_per_coded_sample * 2 / 8;
+ } else if (avctx->codec_id == AV_CODEC_ID_PCM_LXF) {
/* we process 40-bit blocks per channel for LXF */
samples_per_block = 2;
- sample_size = 5;
+ sample_size = 5;
}
if (sample_size == 0) {
@@ -290,111 +290,113 @@ static int pcm_decode_frame(AVCodecContext *avctx, void *data,
n = avctx->channels * sample_size;
- if(n && buf_size % n){
+ if (n && buf_size % n) {
if (buf_size < n) {
av_log(avctx, AV_LOG_ERROR, "invalid PCM packet\n");
return -1;
- }else
+ } else
buf_size -= buf_size % n;
}
- n = buf_size/sample_size;
+ n = buf_size / sample_size;
/* get output buffer */
s->frame.nb_samples = n * samples_per_block / avctx->channels;
- if ((ret = avctx->get_buffer(avctx, &s->frame)) < 0) {
+ if ((ret = ff_get_buffer(avctx, &s->frame)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return ret;
}
samples = s->frame.data[0];
- switch(avctx->codec->id) {
- case CODEC_ID_PCM_U32LE:
+ switch (avctx->codec->id) {
+ case AV_CODEC_ID_PCM_U32LE:
DECODE(32, le32, src, samples, n, 0, 0x80000000)
break;
- case CODEC_ID_PCM_U32BE:
+ case AV_CODEC_ID_PCM_U32BE:
DECODE(32, be32, src, samples, n, 0, 0x80000000)
break;
- case CODEC_ID_PCM_S24LE:
+ case AV_CODEC_ID_PCM_S24LE:
DECODE(32, le24, src, samples, n, 8, 0)
break;
- case CODEC_ID_PCM_S24BE:
+ case AV_CODEC_ID_PCM_S24BE:
DECODE(32, be24, src, samples, n, 8, 0)
break;
- case CODEC_ID_PCM_U24LE:
+ case AV_CODEC_ID_PCM_U24LE:
DECODE(32, le24, src, samples, n, 8, 0x800000)
break;
- case CODEC_ID_PCM_U24BE:
+ case AV_CODEC_ID_PCM_U24BE:
DECODE(32, be24, src, samples, n, 8, 0x800000)
break;
- case CODEC_ID_PCM_S24DAUD:
- for(;n>0;n--) {
- uint32_t v = bytestream_get_be24(&src);
- v >>= 4; // sync flags are here
- AV_WN16A(samples, av_reverse[(v >> 8) & 0xff] +
- (av_reverse[v & 0xff] << 8));
- samples += 2;
+ case AV_CODEC_ID_PCM_S24DAUD:
+ for (; n > 0; n--) {
+ uint32_t v = bytestream_get_be24(&src);
+ v >>= 4; // sync flags are here
+ AV_WN16A(samples, ff_reverse[(v >> 8) & 0xff] +
+ (ff_reverse[v & 0xff] << 8));
+ samples += 2;
}
break;
- case CODEC_ID_PCM_S16LE_PLANAR:
+ case AV_CODEC_ID_PCM_S16LE_PLANAR:
{
- const uint8_t *src2[MAX_CHANNELS];
+ int av_unused n2;
n /= avctx->channels;
- for(c=0;c<avctx->channels;c++)
- src2[c] = &src[c*n*2];
- for(;n>0;n--)
- for(c=0;c<avctx->channels;c++) {
- AV_WN16A(samples, bytestream_get_le16(&src2[c]));
- samples += 2;
- }
+ for (c = 0; c < avctx->channels; c++) {
+ samples = s->frame.extended_data[c];
+#if HAVE_BIGENDIAN
+ n2 = n;
+ DECODE(16, le16, src, samples, n2, 0, 0)
+#else
+ memcpy(samples, src, n * 2);
+ src += n * 2;
+#endif
+ }
break;
}
- case CODEC_ID_PCM_U16LE:
+ case AV_CODEC_ID_PCM_U16LE:
DECODE(16, le16, src, samples, n, 0, 0x8000)
break;
- case CODEC_ID_PCM_U16BE:
+ case AV_CODEC_ID_PCM_U16BE:
DECODE(16, be16, src, samples, n, 0, 0x8000)
break;
- case CODEC_ID_PCM_S8:
- for(;n>0;n--) {
+ case AV_CODEC_ID_PCM_S8:
+ for (; n > 0; n--)
*samples++ = *src++ + 128;
- }
break;
#if HAVE_BIGENDIAN
- case CODEC_ID_PCM_F64LE:
+ case AV_CODEC_ID_PCM_F64LE:
DECODE(64, le64, src, samples, n, 0, 0)
break;
- case CODEC_ID_PCM_S32LE:
- case CODEC_ID_PCM_F32LE:
+ case AV_CODEC_ID_PCM_S32LE:
+ case AV_CODEC_ID_PCM_F32LE:
DECODE(32, le32, src, samples, n, 0, 0)
break;
- case CODEC_ID_PCM_S16LE:
+ case AV_CODEC_ID_PCM_S16LE:
DECODE(16, le16, src, samples, n, 0, 0)
break;
- case CODEC_ID_PCM_F64BE:
- case CODEC_ID_PCM_F32BE:
- case CODEC_ID_PCM_S32BE:
- case CODEC_ID_PCM_S16BE:
+ case AV_CODEC_ID_PCM_F64BE:
+ case AV_CODEC_ID_PCM_F32BE:
+ case AV_CODEC_ID_PCM_S32BE:
+ case AV_CODEC_ID_PCM_S16BE:
#else
- case CODEC_ID_PCM_F64BE:
+ case AV_CODEC_ID_PCM_F64BE:
DECODE(64, be64, src, samples, n, 0, 0)
break;
- case CODEC_ID_PCM_F32BE:
- case CODEC_ID_PCM_S32BE:
+ case AV_CODEC_ID_PCM_F32BE:
+ case AV_CODEC_ID_PCM_S32BE:
DECODE(32, be32, src, samples, n, 0, 0)
break;
- case CODEC_ID_PCM_S16BE:
+ case AV_CODEC_ID_PCM_S16BE:
DECODE(16, be16, src, samples, n, 0, 0)
break;
- case CODEC_ID_PCM_F64LE:
- case CODEC_ID_PCM_F32LE:
- case CODEC_ID_PCM_S32LE:
- case CODEC_ID_PCM_S16LE:
+ case AV_CODEC_ID_PCM_F64LE:
+ case AV_CODEC_ID_PCM_F32LE:
+ case AV_CODEC_ID_PCM_S32LE:
+ case AV_CODEC_ID_PCM_S16LE:
#endif /* HAVE_BIGENDIAN */
- case CODEC_ID_PCM_U8:
- memcpy(samples, src, n*sample_size);
+ case AV_CODEC_ID_PCM_U8:
+ memcpy(samples, src, n * sample_size);
break;
- case CODEC_ID_PCM_ZORK:
+ case AV_CODEC_ID_PCM_ZORK:
for (; n > 0; n--) {
int v = *src++;
if (v < 128)
@@ -402,14 +404,14 @@ static int pcm_decode_frame(AVCodecContext *avctx, void *data,
*samples++ = v;
}
break;
- case CODEC_ID_PCM_ALAW:
- case CODEC_ID_PCM_MULAW:
- for(;n>0;n--) {
+ case AV_CODEC_ID_PCM_ALAW:
+ case AV_CODEC_ID_PCM_MULAW:
+ for (; n > 0; n--) {
AV_WN16A(samples, s->table[*src++]);
samples += 2;
}
break;
- case CODEC_ID_PCM_DVD:
+ case AV_CODEC_ID_PCM_DVD:
{
const uint8_t *src8;
dst_int32_t = (int32_t *)s->frame.data[0];
@@ -417,19 +419,19 @@ static int pcm_decode_frame(AVCodecContext *avctx, void *data,
switch (avctx->bits_per_coded_sample) {
case 20:
while (n--) {
- c = avctx->channels;
- src8 = src + 4*c;
+ c = avctx->channels;
+ src8 = src + 4 * c;
while (c--) {
- *dst_int32_t++ = (bytestream_get_be16(&src) << 16) + ((*src8 &0xf0) << 8);
- *dst_int32_t++ = (bytestream_get_be16(&src) << 16) + ((*src8++ &0x0f) << 12);
+ *dst_int32_t++ = (bytestream_get_be16(&src) << 16) + ((*src8 & 0xf0) << 8);
+ *dst_int32_t++ = (bytestream_get_be16(&src) << 16) + ((*src8++ & 0x0f) << 12);
}
src = src8;
}
break;
case 24:
while (n--) {
- c = avctx->channels;
- src8 = src + 4*c;
+ c = avctx->channels;
+ src8 = src + 4 * c;
while (c--) {
*dst_int32_t++ = (bytestream_get_be16(&src) << 16) + ((*src8++) << 8);
*dst_int32_t++ = (bytestream_get_be16(&src) << 16) + ((*src8++) << 8);
@@ -440,24 +442,26 @@ static int pcm_decode_frame(AVCodecContext *avctx, void *data,
}
break;
}
- case CODEC_ID_PCM_LXF:
+ case AV_CODEC_ID_PCM_LXF:
{
int i;
- const uint8_t *src8;
- dst_int32_t = (int32_t *)s->frame.data[0];
n /= avctx->channels;
- //unpack and de-planerize
- for (i = 0; i < n; i++) {
- for (c = 0, src8 = src + i*5; c < avctx->channels; c++, src8 += n*5) {
- //extract low 20 bits and expand to 32 bits
- *dst_int32_t++ = (src8[2] << 28) | (src8[1] << 20) | (src8[0] << 12) |
- ((src8[2] & 0xF) << 8) | src8[1];
- }
-
- for (c = 0, src8 = src + i*5; c < avctx->channels; c++, src8 += n*5) {
- //extract high 20 bits and expand to 32 bits
- *dst_int32_t++ = (src8[4] << 24) | (src8[3] << 16) |
- ((src8[2] & 0xF0) << 8) | (src8[4] << 4) | (src8[3] >> 4);
+ for (c = 0; c < avctx->channels; c++) {
+ dst_int32_t = (int32_t *)s->frame.extended_data[c];
+ for (i = 0; i < n; i++) {
+ // extract low 20 bits and expand to 32 bits
+ *dst_int32_t++ = (src[2] << 28) |
+ (src[1] << 20) |
+ (src[0] << 12) |
+ ((src[2] & 0x0F) << 8) |
+ src[1];
+ // extract high 20 bits and expand to 32 bits
+ *dst_int32_t++ = (src[4] << 24) |
+ (src[3] << 16) |
+ ((src[2] & 0xF0) << 8) |
+ (src[4] << 4) |
+ (src[3] >> 4);
+ src += 5;
}
}
break;
@@ -472,66 +476,77 @@ static int pcm_decode_frame(AVCodecContext *avctx, void *data,
return buf_size;
}
-#if CONFIG_ENCODERS
-#define PCM_ENCODER(id_,sample_fmt_,name_,long_name_) \
-AVCodec ff_ ## name_ ## _encoder = { \
- .name = #name_, \
- .type = AVMEDIA_TYPE_AUDIO, \
- .id = id_, \
- .init = pcm_encode_init, \
- .encode2 = pcm_encode_frame, \
- .close = pcm_encode_close, \
- .capabilities = CODEC_CAP_VARIABLE_FRAME_SIZE, \
- .sample_fmts = (const enum AVSampleFormat[]){sample_fmt_,AV_SAMPLE_FMT_NONE}, \
- .long_name = NULL_IF_CONFIG_SMALL(long_name_), \
+#define PCM_ENCODER_0(id_, sample_fmt_, name_, long_name_)
+#define PCM_ENCODER_1(id_, sample_fmt_, name_, long_name_) \
+AVCodec ff_ ## name_ ## _encoder = { \
+ .name = #name_, \
+ .type = AVMEDIA_TYPE_AUDIO, \
+ .id = AV_CODEC_ID_ ## id_, \
+ .init = pcm_encode_init, \
+ .encode2 = pcm_encode_frame, \
+ .close = pcm_encode_close, \
+ .capabilities = CODEC_CAP_VARIABLE_FRAME_SIZE, \
+ .sample_fmts = (const enum AVSampleFormat[]){ sample_fmt_, \
+ AV_SAMPLE_FMT_NONE }, \
+ .long_name = NULL_IF_CONFIG_SMALL(long_name_), \
}
-#else
-#define PCM_ENCODER(id,sample_fmt_,name,long_name_)
-#endif
-#if CONFIG_DECODERS
-#define PCM_DECODER(id_,sample_fmt_,name_,long_name_) \
-AVCodec ff_ ## name_ ## _decoder = { \
- .name = #name_, \
- .type = AVMEDIA_TYPE_AUDIO, \
- .id = id_, \
- .priv_data_size = sizeof(PCMDecode), \
- .init = pcm_decode_init, \
- .decode = pcm_decode_frame, \
- .capabilities = CODEC_CAP_DR1, \
- .sample_fmts = (const enum AVSampleFormat[]){sample_fmt_,AV_SAMPLE_FMT_NONE}, \
- .long_name = NULL_IF_CONFIG_SMALL(long_name_), \
+#define PCM_ENCODER_2(cf, id, sample_fmt, name, long_name) \
+ PCM_ENCODER_ ## cf(id, sample_fmt, name, long_name)
+#define PCM_ENCODER_3(cf, id, sample_fmt, name, long_name) \
+ PCM_ENCODER_2(cf, id, sample_fmt, name, long_name)
+#define PCM_ENCODER(id, sample_fmt, name, long_name) \
+ PCM_ENCODER_3(CONFIG_ ## id ## _ENCODER, id, sample_fmt, name, long_name)
+
+#define PCM_DECODER_0(id, sample_fmt, name, long_name)
+#define PCM_DECODER_1(id_, sample_fmt_, name_, long_name_) \
+AVCodec ff_ ## name_ ## _decoder = { \
+ .name = #name_, \
+ .type = AVMEDIA_TYPE_AUDIO, \
+ .id = AV_CODEC_ID_ ## id_, \
+ .priv_data_size = sizeof(PCMDecode), \
+ .init = pcm_decode_init, \
+ .decode = pcm_decode_frame, \
+ .capabilities = CODEC_CAP_DR1, \
+ .sample_fmts = (const enum AVSampleFormat[]){ sample_fmt_, \
+ AV_SAMPLE_FMT_NONE }, \
+ .long_name = NULL_IF_CONFIG_SMALL(long_name_), \
}
-#else
-#define PCM_DECODER(id,sample_fmt_,name,long_name_)
-#endif
-#define PCM_CODEC(id, sample_fmt_, name, long_name_) \
- PCM_ENCODER(id,sample_fmt_,name,long_name_); PCM_DECODER(id,sample_fmt_,name,long_name_)
+#define PCM_DECODER_2(cf, id, sample_fmt, name, long_name) \
+ PCM_DECODER_ ## cf(id, sample_fmt, name, long_name)
+#define PCM_DECODER_3(cf, id, sample_fmt, name, long_name) \
+ PCM_DECODER_2(cf, id, sample_fmt, name, long_name)
+#define PCM_DECODER(id, sample_fmt, name, long_name) \
+ PCM_DECODER_3(CONFIG_ ## id ## _DECODER, id, sample_fmt, name, long_name)
+
+#define PCM_CODEC(id, sample_fmt_, name, long_name_) \
+ PCM_ENCODER(id, sample_fmt_, name, long_name_); \
+ PCM_DECODER(id, sample_fmt_, name, long_name_)
/* Note: Do not forget to add new entries to the Makefile as well. */
-PCM_CODEC (CODEC_ID_PCM_ALAW, AV_SAMPLE_FMT_S16, pcm_alaw, "PCM A-law");
-PCM_DECODER(CODEC_ID_PCM_DVD, AV_SAMPLE_FMT_S32, pcm_dvd, "PCM signed 20|24-bit big-endian");
-PCM_CODEC (CODEC_ID_PCM_F32BE, AV_SAMPLE_FMT_FLT, pcm_f32be, "PCM 32-bit floating point big-endian");
-PCM_CODEC (CODEC_ID_PCM_F32LE, AV_SAMPLE_FMT_FLT, pcm_f32le, "PCM 32-bit floating point little-endian");
-PCM_CODEC (CODEC_ID_PCM_F64BE, AV_SAMPLE_FMT_DBL, pcm_f64be, "PCM 64-bit floating point big-endian");
-PCM_CODEC (CODEC_ID_PCM_F64LE, AV_SAMPLE_FMT_DBL, pcm_f64le, "PCM 64-bit floating point little-endian");
-PCM_DECODER(CODEC_ID_PCM_LXF, AV_SAMPLE_FMT_S32, pcm_lxf, "PCM signed 20-bit little-endian planar");
-PCM_CODEC (CODEC_ID_PCM_MULAW, AV_SAMPLE_FMT_S16, pcm_mulaw, "PCM mu-law");
-PCM_CODEC (CODEC_ID_PCM_S8, AV_SAMPLE_FMT_U8, pcm_s8, "PCM signed 8-bit");
-PCM_CODEC (CODEC_ID_PCM_S16BE, AV_SAMPLE_FMT_S16, pcm_s16be, "PCM signed 16-bit big-endian");
-PCM_CODEC (CODEC_ID_PCM_S16LE, AV_SAMPLE_FMT_S16, pcm_s16le, "PCM signed 16-bit little-endian");
-PCM_DECODER(CODEC_ID_PCM_S16LE_PLANAR, AV_SAMPLE_FMT_S16, pcm_s16le_planar, "PCM 16-bit little-endian planar");
-PCM_CODEC (CODEC_ID_PCM_S24BE, AV_SAMPLE_FMT_S32, pcm_s24be, "PCM signed 24-bit big-endian");
-PCM_CODEC (CODEC_ID_PCM_S24DAUD, AV_SAMPLE_FMT_S16, pcm_s24daud, "PCM D-Cinema audio signed 24-bit");
-PCM_CODEC (CODEC_ID_PCM_S24LE, AV_SAMPLE_FMT_S32, pcm_s24le, "PCM signed 24-bit little-endian");
-PCM_CODEC (CODEC_ID_PCM_S32BE, AV_SAMPLE_FMT_S32, pcm_s32be, "PCM signed 32-bit big-endian");
-PCM_CODEC (CODEC_ID_PCM_S32LE, AV_SAMPLE_FMT_S32, pcm_s32le, "PCM signed 32-bit little-endian");
-PCM_CODEC (CODEC_ID_PCM_U8, AV_SAMPLE_FMT_U8, pcm_u8, "PCM unsigned 8-bit");
-PCM_CODEC (CODEC_ID_PCM_U16BE, AV_SAMPLE_FMT_S16, pcm_u16be, "PCM unsigned 16-bit big-endian");
-PCM_CODEC (CODEC_ID_PCM_U16LE, AV_SAMPLE_FMT_S16, pcm_u16le, "PCM unsigned 16-bit little-endian");
-PCM_CODEC (CODEC_ID_PCM_U24BE, AV_SAMPLE_FMT_S32, pcm_u24be, "PCM unsigned 24-bit big-endian");
-PCM_CODEC (CODEC_ID_PCM_U24LE, AV_SAMPLE_FMT_S32, pcm_u24le, "PCM unsigned 24-bit little-endian");
-PCM_CODEC (CODEC_ID_PCM_U32BE, AV_SAMPLE_FMT_S32, pcm_u32be, "PCM unsigned 32-bit big-endian");
-PCM_CODEC (CODEC_ID_PCM_U32LE, AV_SAMPLE_FMT_S32, pcm_u32le, "PCM unsigned 32-bit little-endian");
-PCM_DECODER(CODEC_ID_PCM_ZORK, AV_SAMPLE_FMT_U8, pcm_zork, "PCM Zork");
+PCM_CODEC (PCM_ALAW, AV_SAMPLE_FMT_S16, pcm_alaw, "PCM A-law");
+PCM_DECODER(PCM_DVD, AV_SAMPLE_FMT_S32, pcm_dvd, "PCM signed 20|24-bit big-endian");
+PCM_CODEC (PCM_F32BE, AV_SAMPLE_FMT_FLT, pcm_f32be, "PCM 32-bit floating point big-endian");
+PCM_CODEC (PCM_F32LE, AV_SAMPLE_FMT_FLT, pcm_f32le, "PCM 32-bit floating point little-endian");
+PCM_CODEC (PCM_F64BE, AV_SAMPLE_FMT_DBL, pcm_f64be, "PCM 64-bit floating point big-endian");
+PCM_CODEC (PCM_F64LE, AV_SAMPLE_FMT_DBL, pcm_f64le, "PCM 64-bit floating point little-endian");
+PCM_DECODER(PCM_LXF, AV_SAMPLE_FMT_S32P, pcm_lxf, "PCM signed 20-bit little-endian planar");
+PCM_CODEC (PCM_MULAW, AV_SAMPLE_FMT_S16, pcm_mulaw, "PCM mu-law");
+PCM_CODEC (PCM_S8, AV_SAMPLE_FMT_U8, pcm_s8, "PCM signed 8-bit");
+PCM_CODEC (PCM_S16BE, AV_SAMPLE_FMT_S16, pcm_s16be, "PCM signed 16-bit big-endian");
+PCM_CODEC (PCM_S16LE, AV_SAMPLE_FMT_S16, pcm_s16le, "PCM signed 16-bit little-endian");
+PCM_DECODER(PCM_S16LE_PLANAR, AV_SAMPLE_FMT_S16P, pcm_s16le_planar, "PCM 16-bit little-endian planar");
+PCM_CODEC (PCM_S24BE, AV_SAMPLE_FMT_S32, pcm_s24be, "PCM signed 24-bit big-endian");
+PCM_CODEC (PCM_S24DAUD, AV_SAMPLE_FMT_S16, pcm_s24daud, "PCM D-Cinema audio signed 24-bit");
+PCM_CODEC (PCM_S24LE, AV_SAMPLE_FMT_S32, pcm_s24le, "PCM signed 24-bit little-endian");
+PCM_CODEC (PCM_S32BE, AV_SAMPLE_FMT_S32, pcm_s32be, "PCM signed 32-bit big-endian");
+PCM_CODEC (PCM_S32LE, AV_SAMPLE_FMT_S32, pcm_s32le, "PCM signed 32-bit little-endian");
+PCM_CODEC (PCM_U8, AV_SAMPLE_FMT_U8, pcm_u8, "PCM unsigned 8-bit");
+PCM_CODEC (PCM_U16BE, AV_SAMPLE_FMT_S16, pcm_u16be, "PCM unsigned 16-bit big-endian");
+PCM_CODEC (PCM_U16LE, AV_SAMPLE_FMT_S16, pcm_u16le, "PCM unsigned 16-bit little-endian");
+PCM_CODEC (PCM_U24BE, AV_SAMPLE_FMT_S32, pcm_u24be, "PCM unsigned 24-bit big-endian");
+PCM_CODEC (PCM_U24LE, AV_SAMPLE_FMT_S32, pcm_u24le, "PCM unsigned 24-bit little-endian");
+PCM_CODEC (PCM_U32BE, AV_SAMPLE_FMT_S32, pcm_u32be, "PCM unsigned 32-bit big-endian");
+PCM_CODEC (PCM_U32LE, AV_SAMPLE_FMT_S32, pcm_u32le, "PCM unsigned 32-bit little-endian");
+PCM_DECODER(PCM_ZORK, AV_SAMPLE_FMT_U8, pcm_zork, "PCM Zork");
diff --git a/gst-libs/ext/libav/libavcodec/pcm_tablegen.c b/gst-libs/ext/libav/libavcodec/pcm_tablegen.c
index 8a9bcb6..7b4bc8c 100644
--- a/gst-libs/ext/libav/libavcodec/pcm_tablegen.c
+++ b/gst-libs/ext/libav/libavcodec/pcm_tablegen.c
@@ -37,4 +37,3 @@ int main(void)
return 0;
}
-
diff --git a/gst-libs/ext/libav/libavcodec/pcx.c b/gst-libs/ext/libav/libavcodec/pcx.c
index 7eb1daa..1bd8612 100644
--- a/gst-libs/ext/libav/libavcodec/pcx.c
+++ b/gst-libs/ext/libav/libavcodec/pcx.c
@@ -26,6 +26,7 @@
#include "avcodec.h"
#include "bytestream.h"
#include "get_bits.h"
+#include "internal.h"
typedef struct PCXContext {
AVFrame picture;
@@ -76,7 +77,7 @@ static void pcx_palette(const uint8_t **src, uint32_t *dst, unsigned int pallen)
memset(dst, 0, (256 - pallen) * sizeof(*dst));
}
-static int pcx_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
+static int pcx_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
AVPacket *avpkt) {
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
@@ -122,7 +123,7 @@ static int pcx_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
switch ((nplanes<<8) + bits_per_pixel) {
case 0x0308:
- avctx->pix_fmt = PIX_FMT_RGB24;
+ avctx->pix_fmt = AV_PIX_FMT_RGB24;
break;
case 0x0108:
case 0x0104:
@@ -131,7 +132,7 @@ static int pcx_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
case 0x0401:
case 0x0301:
case 0x0201:
- avctx->pix_fmt = PIX_FMT_PAL8;
+ avctx->pix_fmt = AV_PIX_FMT_PAL8;
break;
default:
av_log(avctx, AV_LOG_ERROR, "invalid PCX file\n");
@@ -147,7 +148,7 @@ static int pcx_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
return -1;
if (w != avctx->width || h != avctx->height)
avcodec_set_dimensions(avctx, w, h);
- if (avctx->get_buffer(avctx, p) < 0) {
+ if (ff_get_buffer(avctx, p) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return -1;
}
@@ -230,7 +231,7 @@ static int pcx_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
}
*picture = s->picture;
- *data_size = sizeof(AVFrame);
+ *got_frame = 1;
ret = buf - bufstart;
end:
@@ -250,11 +251,11 @@ static av_cold int pcx_end(AVCodecContext *avctx) {
AVCodec ff_pcx_decoder = {
.name = "pcx",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_PCX,
+ .id = AV_CODEC_ID_PCX,
.priv_data_size = sizeof(PCXContext),
.init = pcx_init,
.close = pcx_end,
.decode = pcx_decode_frame,
.capabilities = CODEC_CAP_DR1,
- .long_name = NULL_IF_CONFIG_SMALL("PC Paintbrush PCX image"),
+ .long_name = NULL_IF_CONFIG_SMALL("PC Paintbrush PCX image"),
};
diff --git a/gst-libs/ext/libav/libavcodec/pcxenc.c b/gst-libs/ext/libav/libavcodec/pcxenc.c
index 3084568..e0ee20a 100644
--- a/gst-libs/ext/libav/libavcodec/pcxenc.c
+++ b/gst-libs/ext/libav/libavcodec/pcxenc.c
@@ -28,6 +28,7 @@
#include "avcodec.h"
#include "bytestream.h"
+#include "internal.h"
typedef struct PCXContext {
AVFrame picture;
@@ -95,19 +96,19 @@ static int pcx_rle_encode( uint8_t *dst, int dst_size,
return dst - dst_start;
}
-static int pcx_encode_frame(AVCodecContext *avctx,
- unsigned char *buf, int buf_size, void *data)
+static int pcx_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
+ const AVFrame *frame, int *got_packet)
{
PCXContext *s = avctx->priv_data;
AVFrame *const pict = &s->picture;
- const uint8_t *buf_start = buf;
- const uint8_t *buf_end = buf + buf_size;
+ const uint8_t *buf_end;
+ uint8_t *buf;
- int bpp, nplanes, i, y, line_bytes, written;
+ int bpp, nplanes, i, y, line_bytes, written, ret, max_pkt_size;
const uint32_t *pal = NULL;
const uint8_t *src;
- *pict = *(AVFrame *)data;
+ *pict = *frame;
pict->pict_type = AV_PICTURE_TYPE_I;
pict->key_frame = 1;
@@ -117,21 +118,21 @@ static int pcx_encode_frame(AVCodecContext *avctx,
}
switch (avctx->pix_fmt) {
- case PIX_FMT_RGB24:
+ case AV_PIX_FMT_RGB24:
bpp = 8;
nplanes = 3;
break;
- case PIX_FMT_RGB8:
- case PIX_FMT_BGR8:
- case PIX_FMT_RGB4_BYTE:
- case PIX_FMT_BGR4_BYTE:
- case PIX_FMT_GRAY8:
- case PIX_FMT_PAL8:
+ case AV_PIX_FMT_RGB8:
+ case AV_PIX_FMT_BGR8:
+ case AV_PIX_FMT_RGB4_BYTE:
+ case AV_PIX_FMT_BGR4_BYTE:
+ case AV_PIX_FMT_GRAY8:
+ case AV_PIX_FMT_PAL8:
bpp = 8;
nplanes = 1;
pal = (uint32_t *)pict->data[1];
break;
- case PIX_FMT_MONOBLACK:
+ case AV_PIX_FMT_MONOBLACK:
bpp = 1;
nplanes = 1;
pal = monoblack_pal;
@@ -144,6 +145,14 @@ static int pcx_encode_frame(AVCodecContext *avctx,
line_bytes = (avctx->width * bpp + 7) >> 3;
line_bytes = (line_bytes + 1) & ~1;
+ max_pkt_size = 128 + avctx->height * 2 * line_bytes * nplanes + (pal ? 256*3 + 1 : 0);
+ if ((ret = ff_alloc_packet(pkt, max_pkt_size)) < 0) {
+ av_log(avctx, AV_LOG_ERROR, "Error getting output packet of size %d.\n", max_pkt_size);
+ return ret;
+ }
+ buf = pkt->data;
+ buf_end = pkt->data + pkt->size;
+
bytestream_put_byte(&buf, 10); // manufacturer
bytestream_put_byte(&buf, 5); // version
bytestream_put_byte(&buf, 1); // encoding
@@ -160,7 +169,7 @@ static int pcx_encode_frame(AVCodecContext *avctx,
bytestream_put_byte(&buf, nplanes); // number of planes
bytestream_put_le16(&buf, line_bytes); // scanline plane size in bytes
- while (buf - buf_start < 128)
+ while (buf - pkt->data < 128)
*buf++= 0;
src = pict->data[0];
@@ -186,20 +195,26 @@ static int pcx_encode_frame(AVCodecContext *avctx,
}
}
- return buf - buf_start;
+ pkt->size = buf - pkt->data;
+ pkt->flags |= AV_PKT_FLAG_KEY;
+ *got_packet = 1;
+
+ return 0;
}
AVCodec ff_pcx_encoder = {
.name = "pcx",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_PCX,
+ .id = AV_CODEC_ID_PCX,
.priv_data_size = sizeof(PCXContext),
.init = pcx_encode_init,
- .encode = pcx_encode_frame,
- .pix_fmts = (const enum PixelFormat[]){
- PIX_FMT_RGB24,
- PIX_FMT_RGB8, PIX_FMT_BGR8, PIX_FMT_RGB4_BYTE, PIX_FMT_BGR4_BYTE, PIX_FMT_GRAY8, PIX_FMT_PAL8,
- PIX_FMT_MONOBLACK,
- PIX_FMT_NONE},
- .long_name = NULL_IF_CONFIG_SMALL("PC Paintbrush PCX image"),
+ .encode2 = pcx_encode_frame,
+ .pix_fmts = (const enum AVPixelFormat[]){
+ AV_PIX_FMT_RGB24,
+ AV_PIX_FMT_RGB8, AV_PIX_FMT_BGR8, AV_PIX_FMT_RGB4_BYTE, AV_PIX_FMT_BGR4_BYTE,
+ AV_PIX_FMT_GRAY8, AV_PIX_FMT_PAL8,
+ AV_PIX_FMT_MONOBLACK,
+ AV_PIX_FMT_NONE
+ },
+ .long_name = NULL_IF_CONFIG_SMALL("PC Paintbrush PCX image"),
};
diff --git a/gst-libs/ext/libav/libavcodec/pgssubdec.c b/gst-libs/ext/libav/libavcodec/pgssubdec.c
index bcc47f3..f22088a 100644
--- a/gst-libs/ext/libav/libavcodec/pgssubdec.c
+++ b/gst-libs/ext/libav/libavcodec/pgssubdec.c
@@ -45,6 +45,8 @@ typedef struct PGSSubPresentation {
int y;
int id_number;
int object_number;
+ uint8_t composition_flag;
+ int64_t pts;
} PGSSubPresentation;
typedef struct PGSSubPicture {
@@ -63,7 +65,7 @@ typedef struct PGSSubContext {
static av_cold int init_decoder(AVCodecContext *avctx)
{
- avctx->pix_fmt = PIX_FMT_PAL8;
+ avctx->pix_fmt = AV_PIX_FMT_PAL8;
return 0;
}
@@ -271,7 +273,8 @@ static void parse_palette_segment(AVCodecContext *avctx,
* @todo TODO: Implement forcing of subtitles
*/
static void parse_presentation_segment(AVCodecContext *avctx,
- const uint8_t *buf, int buf_size)
+ const uint8_t *buf, int buf_size,
+ int64_t pts)
{
PGSSubContext *ctx = avctx->priv_data;
@@ -280,6 +283,8 @@ static void parse_presentation_segment(AVCodecContext *avctx,
int w = bytestream_get_be16(&buf);
int h = bytestream_get_be16(&buf);
+ ctx->presentation.pts = pts;
+
av_dlog(avctx, "Video Dimensions %dx%d\n",
w, h);
if (av_image_check_size(w, h, 0, avctx) >= 0)
@@ -299,16 +304,17 @@ static void parse_presentation_segment(AVCodecContext *avctx,
buf += 3;
ctx->presentation.object_number = bytestream_get_byte(&buf);
+ ctx->presentation.composition_flag = 0;
if (!ctx->presentation.object_number)
return;
/*
- * Skip 4 bytes of unknown:
+ * Skip 3 bytes of unknown:
* object_id_ref (2 bytes),
* window_id_ref,
- * composition_flag (0x80 - object cropped, 0x40 - object forced)
*/
- buf += 4;
+ buf += 3;
+ ctx->presentation.composition_flag = bytestream_get_byte(&buf);
x = bytestream_get_be16(&buf);
y = bytestream_get_be16(&buf);
@@ -356,6 +362,8 @@ static int display_end_segment(AVCodecContext *avctx, void *data,
*/
memset(sub, 0, sizeof(*sub));
+ sub->pts = ctx->presentation.pts;
+
// Blank if last object_number was 0.
// Note that this may be wrong for more complex subtitles.
if (!ctx->presentation.object_number)
@@ -368,6 +376,9 @@ static int display_end_segment(AVCodecContext *avctx, void *data,
sub->rects[0] = av_mallocz(sizeof(*sub->rects[0]));
sub->num_rects = 1;
+ if (ctx->presentation.composition_flag & 0x40)
+ sub->rects[0]->flags |= AV_SUBTITLE_FLAG_FORCED;
+
sub->rects[0]->x = ctx->presentation.x;
sub->rects[0]->y = ctx->presentation.y;
sub->rects[0]->w = ctx->picture.w;
@@ -441,12 +452,12 @@ static int decode(AVCodecContext *avctx, void *data, int *data_size,
parse_picture_segment(avctx, buf, segment_length);
break;
case PRESENTATION_SEGMENT:
- parse_presentation_segment(avctx, buf, segment_length);
+ parse_presentation_segment(avctx, buf, segment_length, avpkt->pts);
break;
case WINDOW_SEGMENT:
/*
* Window Segment Structure (No new information provided):
- * 2 bytes: Unkown,
+ * 2 bytes: Unknown,
* 2 bytes: X position of subtitle,
* 2 bytes: Y position of subtitle,
* 2 bytes: Width of subtitle,
@@ -471,10 +482,10 @@ static int decode(AVCodecContext *avctx, void *data, int *data_size,
AVCodec ff_pgssub_decoder = {
.name = "pgssub",
.type = AVMEDIA_TYPE_SUBTITLE,
- .id = CODEC_ID_HDMV_PGS_SUBTITLE,
+ .id = AV_CODEC_ID_HDMV_PGS_SUBTITLE,
.priv_data_size = sizeof(PGSSubContext),
.init = init_decoder,
.close = close_decoder,
.decode = decode,
- .long_name = NULL_IF_CONFIG_SMALL("HDMV Presentation Graphic Stream subtitles"),
+ .long_name = NULL_IF_CONFIG_SMALL("HDMV Presentation Graphic Stream subtitles"),
};
diff --git a/gst-libs/ext/libav/libavcodec/pictordec.c b/gst-libs/ext/libav/libavcodec/pictordec.c
index e0bc899..16f9307 100644
--- a/gst-libs/ext/libav/libavcodec/pictordec.c
+++ b/gst-libs/ext/libav/libavcodec/pictordec.c
@@ -28,6 +28,7 @@
#include "avcodec.h"
#include "bytestream.h"
#include "cga_data.h"
+#include "internal.h"
typedef struct PicContext {
AVFrame frame;
@@ -97,7 +98,7 @@ static const uint8_t cga_mode45_index[6][4] = {
};
static int decode_frame(AVCodecContext *avctx,
- void *data, int *data_size,
+ void *data, int *got_frame,
AVPacket *avpkt)
{
PicContext *s = avctx->priv_data;
@@ -122,7 +123,7 @@ static int decode_frame(AVCodecContext *avctx,
bpp = bits_per_plane * s->nb_planes;
if (bits_per_plane > 8 || bpp < 1 || bpp > 32) {
av_log_ask_for_sample(s, "unsupported bit depth\n");
- return AVERROR_INVALIDDATA;
+ return AVERROR_PATCHWELCOME;
}
if (bytestream2_peek_byte(&s->g) == 0xFF) {
@@ -136,7 +137,7 @@ static int decode_frame(AVCodecContext *avctx,
esize = 0;
}
- avctx->pix_fmt = PIX_FMT_PAL8;
+ avctx->pix_fmt = AV_PIX_FMT_PAL8;
if (s->width != avctx->width && s->height != avctx->height) {
if (av_image_check_size(s->width, s->height, 0, avctx) < 0)
@@ -146,7 +147,7 @@ static int decode_frame(AVCodecContext *avctx,
avctx->release_buffer(avctx, &s->frame);
}
- if (avctx->get_buffer(avctx, &s->frame) < 0){
+ if (ff_get_buffer(avctx, &s->frame) < 0){
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return -1;
}
@@ -237,7 +238,7 @@ static int decode_frame(AVCodecContext *avctx,
return avpkt->size;
}
- *data_size = sizeof(AVFrame);
+ *got_frame = 1;
*(AVFrame*)data = s->frame;
return avpkt->size;
}
@@ -253,10 +254,10 @@ static av_cold int decode_end(AVCodecContext *avctx)
AVCodec ff_pictor_decoder = {
.name = "pictor",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_PICTOR,
+ .id = AV_CODEC_ID_PICTOR,
.priv_data_size = sizeof(PicContext),
.close = decode_end,
.decode = decode_frame,
.capabilities = CODEC_CAP_DR1,
- .long_name = NULL_IF_CONFIG_SMALL("Pictor/PC Paint"),
+ .long_name = NULL_IF_CONFIG_SMALL("Pictor/PC Paint"),
};
diff --git a/gst-libs/ext/libav/libavcodec/png.c b/gst-libs/ext/libav/libavcodec/png.c
index 70a080e..65d6964 100644
--- a/gst-libs/ext/libav/libavcodec/png.c
+++ b/gst-libs/ext/libav/libavcodec/png.c
@@ -47,9 +47,7 @@ const uint8_t ff_png_pass_mask[NB_PASSES] = {
void *ff_png_zalloc(void *opaque, unsigned int items, unsigned int size)
{
- if(items >= UINT_MAX / size)
- return NULL;
- return av_malloc(items * size);
+ return av_mallocz_array(items, size);
}
void ff_png_zfree(void *opaque, void *ptr)
diff --git a/gst-libs/ext/libav/libavcodec/pngdec.c b/gst-libs/ext/libav/libavcodec/pngdec.c
index ac98f70..9c340ea 100644
--- a/gst-libs/ext/libav/libavcodec/pngdec.c
+++ b/gst-libs/ext/libav/libavcodec/pngdec.c
@@ -21,8 +21,9 @@
#include "libavutil/imgutils.h"
#include "avcodec.h"
#include "bytestream.h"
+#include "internal.h"
#include "png.h"
-#include "dsputil.h"
+#include "pngdsp.h"
/* TODO:
* - add 2, 4 and 16 bit depth support
@@ -33,7 +34,7 @@
//#define DEBUG
typedef struct PNGDecContext {
- DSPContext dsp;
+ PNGDSPContext dsp;
GetByteContext gb;
AVFrame picture1, picture2;
@@ -189,7 +190,7 @@ void ff_add_png_paeth_prediction(uint8_t *dst, uint8_t *src, uint8_t *top, int w
}
/* NOTE: 'dst' can be equal to 'last' */
-static void png_filter_row(DSPContext *dsp, uint8_t *dst, int filter_type,
+static void png_filter_row(PNGDSPContext *dsp, uint8_t *dst, int filter_type,
uint8_t *src, uint8_t *last, int size, int bpp)
{
int i, p, r, g, b, a;
@@ -233,7 +234,7 @@ static void png_filter_row(DSPContext *dsp, uint8_t *dst, int filter_type,
if(bpp > 1 && size > 4) {
// would write off the end of the array if we let it process the last pixel with bpp=3
int w = bpp==4 ? size : size-3;
- dsp->add_png_paeth_prediction(dst+i, src+i, last+i, w-i, bpp);
+ dsp->add_paeth_prediction(dst+i, src+i, last+i, w-i, bpp);
i = w;
}
ff_add_png_paeth_prediction(dst+i, src+i, last+i, size-i, bpp);
@@ -382,7 +383,7 @@ static int png_decode_idat(PNGDecContext *s, int length)
}
static int decode_frame(AVCodecContext *avctx,
- void *data, int *data_size,
+ void *data, int *got_frame,
AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
@@ -463,28 +464,28 @@ static int decode_frame(AVCodecContext *avctx,
if (s->bit_depth == 8 &&
s->color_type == PNG_COLOR_TYPE_RGB) {
- avctx->pix_fmt = PIX_FMT_RGB24;
+ avctx->pix_fmt = AV_PIX_FMT_RGB24;
} else if (s->bit_depth == 8 &&
s->color_type == PNG_COLOR_TYPE_RGB_ALPHA) {
- avctx->pix_fmt = PIX_FMT_RGB32;
+ avctx->pix_fmt = AV_PIX_FMT_RGB32;
} else if (s->bit_depth == 8 &&
s->color_type == PNG_COLOR_TYPE_GRAY) {
- avctx->pix_fmt = PIX_FMT_GRAY8;
+ avctx->pix_fmt = AV_PIX_FMT_GRAY8;
} else if (s->bit_depth == 16 &&
s->color_type == PNG_COLOR_TYPE_GRAY) {
- avctx->pix_fmt = PIX_FMT_GRAY16BE;
+ avctx->pix_fmt = AV_PIX_FMT_GRAY16BE;
} else if (s->bit_depth == 16 &&
s->color_type == PNG_COLOR_TYPE_RGB) {
- avctx->pix_fmt = PIX_FMT_RGB48BE;
+ avctx->pix_fmt = AV_PIX_FMT_RGB48BE;
} else if (s->bit_depth == 1 &&
s->color_type == PNG_COLOR_TYPE_GRAY) {
- avctx->pix_fmt = PIX_FMT_MONOBLACK;
+ avctx->pix_fmt = AV_PIX_FMT_MONOBLACK;
} else if (s->bit_depth == 8 &&
s->color_type == PNG_COLOR_TYPE_PALETTE) {
- avctx->pix_fmt = PIX_FMT_PAL8;
+ avctx->pix_fmt = AV_PIX_FMT_PAL8;
} else if (s->bit_depth == 8 &&
s->color_type == PNG_COLOR_TYPE_GRAY_ALPHA) {
- avctx->pix_fmt = PIX_FMT_Y400A;
+ avctx->pix_fmt = AV_PIX_FMT_Y400A;
} else {
goto fail;
}
@@ -492,7 +493,7 @@ static int decode_frame(AVCodecContext *avctx,
avctx->release_buffer(avctx, p);
p->reference= 0;
- if(avctx->get_buffer(avctx, p) < 0){
+ if(ff_get_buffer(avctx, p) < 0){
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
goto fail;
}
@@ -610,7 +611,7 @@ static int decode_frame(AVCodecContext *avctx,
}
*picture= *s->current_picture;
- *data_size = sizeof(AVFrame);
+ *got_frame = 1;
ret = bytestream2_tell(&s->gb);
the_end:
@@ -632,7 +633,7 @@ static av_cold int png_dec_init(AVCodecContext *avctx){
s->last_picture = &s->picture2;
avcodec_get_frame_defaults(&s->picture1);
avcodec_get_frame_defaults(&s->picture2);
- dsputil_init(&s->dsp, avctx);
+ ff_pngdsp_init(&s->dsp);
return 0;
}
@@ -652,11 +653,11 @@ static av_cold int png_dec_end(AVCodecContext *avctx)
AVCodec ff_png_decoder = {
.name = "png",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_PNG,
+ .id = AV_CODEC_ID_PNG,
.priv_data_size = sizeof(PNGDecContext),
.init = png_dec_init,
.close = png_dec_end,
.decode = decode_frame,
.capabilities = CODEC_CAP_DR1 /*| CODEC_CAP_DRAW_HORIZ_BAND*/,
- .long_name = NULL_IF_CONFIG_SMALL("PNG image"),
+ .long_name = NULL_IF_CONFIG_SMALL("PNG (Portable Network Graphics) image"),
};
diff --git a/gst-libs/ext/libav/libavcodec/pngdsp.c b/gst-libs/ext/libav/libavcodec/pngdsp.c
new file mode 100644
index 0000000..00734d7
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/pngdsp.c
@@ -0,0 +1,48 @@
+/*
+ * PNG image format
+ * Copyright (c) 2008 Loren Merrit <lorenm@u.washington.edu>
+ *
+ * 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
+ */
+
+#include "libavutil/common.h"
+#include "png.h"
+#include "pngdsp.h"
+
+// 0x7f7f7f7f or 0x7f7f7f7f7f7f7f7f or whatever, depending on the cpu's native arithmetic size
+#define pb_7f (~0UL/255 * 0x7f)
+#define pb_80 (~0UL/255 * 0x80)
+
+static void add_bytes_l2_c(uint8_t *dst, uint8_t *src1, uint8_t *src2, int w)
+{
+ long i;
+ for (i = 0; i <= w - sizeof(long); i += sizeof(long)) {
+ long a = *(long *)(src1 + i);
+ long b = *(long *)(src2 + i);
+ *(long *)(dst + i) = ((a & pb_7f) + (b & pb_7f)) ^ ((a ^ b) & pb_80);
+ }
+ for (; i < w; i++)
+ dst[i] = src1[i] + src2[i];
+}
+
+void ff_pngdsp_init(PNGDSPContext *dsp)
+{
+ dsp->add_bytes_l2 = add_bytes_l2_c;
+ dsp->add_paeth_prediction = ff_add_png_paeth_prediction;
+
+ if (ARCH_X86) ff_pngdsp_init_x86(dsp);
+}
diff --git a/gst-libs/ext/libav/libavcodec/pngdsp.h b/gst-libs/ext/libav/libavcodec/pngdsp.h
new file mode 100644
index 0000000..98d29a8
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/pngdsp.h
@@ -0,0 +1,40 @@
+/*
+ * PNG image format
+ * Copyright (c) 2008 Loren Merrit <lorenm@u.washington.edu>
+ *
+ * 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
+ */
+
+#ifndef AVCODEC_PNGDSP_H
+#define AVCODEC_PNGDSP_H
+
+#include <stdint.h>
+
+typedef struct PNGDSPContext {
+ void (*add_bytes_l2)(uint8_t *dst /* align 16 */,
+ uint8_t *src1 /* align 16 */,
+ uint8_t *src2 /* align 16 */, int w);
+
+ /* this might write to dst[w] */
+ void (*add_paeth_prediction)(uint8_t *dst, uint8_t *src,
+ uint8_t *top, int w, int bpp);
+} PNGDSPContext;
+
+void ff_pngdsp_init(PNGDSPContext *dsp);
+void ff_pngdsp_init_x86(PNGDSPContext *dsp);
+
+#endif /* AVCDODEC_PNGDSP_H */
diff --git a/gst-libs/ext/libav/libavcodec/pngenc.c b/gst-libs/ext/libav/libavcodec/pngenc.c
index 9325348..b20a6d6 100644
--- a/gst-libs/ext/libav/libavcodec/pngenc.c
+++ b/gst-libs/ext/libav/libavcodec/pngenc.c
@@ -229,12 +229,13 @@ static int png_write_row(PNGEncContext *s, const uint8_t *data, int size)
return 0;
}
-static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size, void *data){
+static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
+ const AVFrame *pict, int *got_packet)
+{
PNGEncContext *s = avctx->priv_data;
- AVFrame *pict = data;
AVFrame * const p= &s->picture;
int bit_depth, color_type, y, len, row_size, ret, is_progressive;
- int bits_per_pixel, pass_row_size;
+ int bits_per_pixel, pass_row_size, enc_row_size, max_packet_size;
int compression_level;
uint8_t *ptr, *top;
uint8_t *crow_base = NULL, *crow_buf, *crow;
@@ -246,29 +247,25 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size,
p->pict_type= AV_PICTURE_TYPE_I;
p->key_frame= 1;
- s->bytestream_start=
- s->bytestream= buf;
- s->bytestream_end= buf+buf_size;
-
is_progressive = !!(avctx->flags & CODEC_FLAG_INTERLACED_DCT);
switch(avctx->pix_fmt) {
- case PIX_FMT_RGB32:
+ case AV_PIX_FMT_RGB32:
bit_depth = 8;
color_type = PNG_COLOR_TYPE_RGB_ALPHA;
break;
- case PIX_FMT_RGB24:
+ case AV_PIX_FMT_RGB24:
bit_depth = 8;
color_type = PNG_COLOR_TYPE_RGB;
break;
- case PIX_FMT_GRAY8:
+ case AV_PIX_FMT_GRAY8:
bit_depth = 8;
color_type = PNG_COLOR_TYPE_GRAY;
break;
- case PIX_FMT_MONOBLACK:
+ case AV_PIX_FMT_MONOBLACK:
bit_depth = 1;
color_type = PNG_COLOR_TYPE_GRAY;
break;
- case PIX_FMT_PAL8:
+ case AV_PIX_FMT_PAL8:
bit_depth = 8;
color_type = PNG_COLOR_TYPE_PALETTE;
break;
@@ -288,6 +285,22 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size,
Z_DEFLATED, 15, 8, Z_DEFAULT_STRATEGY);
if (ret != Z_OK)
return -1;
+
+ enc_row_size = deflateBound(&s->zstream, row_size);
+ max_packet_size = avctx->height * (enc_row_size +
+ ((enc_row_size + IOBUF_SIZE - 1) / IOBUF_SIZE) * 12)
+ + FF_MIN_BUFFER_SIZE;
+ if (!pkt->data &&
+ (ret = av_new_packet(pkt, max_packet_size)) < 0) {
+ av_log(avctx, AV_LOG_ERROR, "Could not allocate output packet of size %d.\n",
+ max_packet_size);
+ return ret;
+ }
+
+ s->bytestream_start =
+ s->bytestream = pkt->data;
+ s->bytestream_end = pkt->data + pkt->size;
+
crow_base = av_malloc((row_size + 32) << (s->filter_type == PNG_FILTER_VALUE_MIXED));
if (!crow_base)
goto fail;
@@ -354,7 +367,7 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size,
int pass;
for(pass = 0; pass < NB_PASSES; pass++) {
- /* NOTE: a pass is completely omited if no pixels would be
+ /* NOTE: a pass is completely omitted if no pixels would be
output */
pass_row_size = ff_png_pass_row_size(pass, bits_per_pixel, avctx->width);
if (pass_row_size > 0) {
@@ -409,7 +422,11 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size,
}
png_write_chunk(&s->bytestream, MKTAG('I', 'E', 'N', 'D'), NULL, 0);
- ret = s->bytestream - s->bytestream_start;
+ pkt->size = s->bytestream - s->bytestream_start;
+ pkt->flags |= AV_PKT_FLAG_KEY;
+ *got_packet = 1;
+ ret = 0;
+
the_end:
av_free(crow_base);
av_free(progressive_buf);
@@ -427,10 +444,10 @@ static av_cold int png_enc_init(AVCodecContext *avctx){
avcodec_get_frame_defaults(&s->picture);
avctx->coded_frame= &s->picture;
- dsputil_init(&s->dsp, avctx);
+ ff_dsputil_init(&s->dsp, avctx);
s->filter_type = av_clip(avctx->prediction_method, PNG_FILTER_VALUE_NONE, PNG_FILTER_VALUE_MIXED);
- if(avctx->pix_fmt == PIX_FMT_MONOBLACK)
+ if(avctx->pix_fmt == AV_PIX_FMT_MONOBLACK)
s->filter_type = PNG_FILTER_VALUE_NONE;
return 0;
@@ -439,10 +456,13 @@ static av_cold int png_enc_init(AVCodecContext *avctx){
AVCodec ff_png_encoder = {
.name = "png",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_PNG,
+ .id = AV_CODEC_ID_PNG,
.priv_data_size = sizeof(PNGEncContext),
.init = png_enc_init,
- .encode = encode_frame,
- .pix_fmts= (const enum PixelFormat[]){PIX_FMT_RGB24, PIX_FMT_RGB32, PIX_FMT_PAL8, PIX_FMT_GRAY8, PIX_FMT_MONOBLACK, PIX_FMT_NONE},
- .long_name= NULL_IF_CONFIG_SMALL("PNG image"),
+ .encode2 = encode_frame,
+ .pix_fmts = (const enum AVPixelFormat[]){
+ AV_PIX_FMT_RGB24, AV_PIX_FMT_RGB32, AV_PIX_FMT_PAL8, AV_PIX_FMT_GRAY8,
+ AV_PIX_FMT_MONOBLACK, AV_PIX_FMT_NONE
+ },
+ .long_name = NULL_IF_CONFIG_SMALL("PNG (Portable Network Graphics) image"),
};
diff --git a/gst-libs/ext/libav/libavcodec/pnm.c b/gst-libs/ext/libav/libavcodec/pnm.c
index 54b55cf..2a89a72 100644
--- a/gst-libs/ext/libav/libavcodec/pnm.c
+++ b/gst-libs/ext/libav/libavcodec/pnm.c
@@ -19,6 +19,9 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <stdlib.h>
+#include <string.h>
+
#include "libavutil/imgutils.h"
#include "avcodec.h"
#include "pnm.h"
@@ -65,14 +68,14 @@ int ff_pnm_decode_header(AVCodecContext *avctx, PNMContext * const s)
return -1;
if (s->type==1 || s->type==4) {
- avctx->pix_fmt = PIX_FMT_MONOWHITE;
+ avctx->pix_fmt = AV_PIX_FMT_MONOWHITE;
} else if (s->type==2 || s->type==5) {
- if (avctx->codec_id == CODEC_ID_PGMYUV)
- avctx->pix_fmt = PIX_FMT_YUV420P;
+ if (avctx->codec_id == AV_CODEC_ID_PGMYUV)
+ avctx->pix_fmt = AV_PIX_FMT_YUV420P;
else
- avctx->pix_fmt = PIX_FMT_GRAY8;
+ avctx->pix_fmt = AV_PIX_FMT_GRAY8;
} else if (s->type==3 || s->type==6) {
- avctx->pix_fmt = PIX_FMT_RGB24;
+ avctx->pix_fmt = AV_PIX_FMT_RGB24;
} else if (s->type==7) {
w = -1;
h = -1;
@@ -93,7 +96,9 @@ int ff_pnm_decode_header(AVCodecContext *avctx, PNMContext * const s)
} else if (!strcmp(buf1, "MAXVAL")) {
pnm_get(s, buf1, sizeof(buf1));
maxval = strtol(buf1, NULL, 10);
- } else if (!strcmp(buf1, "TUPLETYPE")) {
+ } else if (!strcmp(buf1, "TUPLTYPE") ||
+ /* libavcodec used to write invalid files */
+ !strcmp(buf1, "TUPLETYPE")) {
pnm_get(s, tuple_type, sizeof(tuple_type));
} else if (!strcmp(buf1, "ENDHDR")) {
break;
@@ -109,19 +114,19 @@ int ff_pnm_decode_header(AVCodecContext *avctx, PNMContext * const s)
avctx->height = h;
if (depth == 1) {
if (maxval == 1)
- avctx->pix_fmt = PIX_FMT_MONOWHITE;
+ avctx->pix_fmt = AV_PIX_FMT_MONOWHITE;
else
- avctx->pix_fmt = PIX_FMT_GRAY8;
+ avctx->pix_fmt = AV_PIX_FMT_GRAY8;
} else if (depth == 3) {
if (maxval < 256) {
- avctx->pix_fmt = PIX_FMT_RGB24;
+ avctx->pix_fmt = AV_PIX_FMT_RGB24;
} else {
av_log(avctx, AV_LOG_ERROR, "16-bit components are only supported for grayscale\n");
- avctx->pix_fmt = PIX_FMT_NONE;
+ avctx->pix_fmt = AV_PIX_FMT_NONE;
return -1;
}
} else if (depth == 4) {
- avctx->pix_fmt = PIX_FMT_RGB32;
+ avctx->pix_fmt = AV_PIX_FMT_RGB32;
} else {
return -1;
}
@@ -137,7 +142,7 @@ int ff_pnm_decode_header(AVCodecContext *avctx, PNMContext * const s)
avctx->height = atoi(buf1);
if(av_image_check_size(avctx->width, avctx->height, 0, avctx))
return -1;
- if (avctx->pix_fmt != PIX_FMT_MONOWHITE) {
+ if (avctx->pix_fmt != AV_PIX_FMT_MONOWHITE) {
pnm_get(s, buf1, sizeof(buf1));
s->maxval = atoi(buf1);
if (s->maxval <= 0) {
@@ -145,23 +150,23 @@ int ff_pnm_decode_header(AVCodecContext *avctx, PNMContext * const s)
s->maxval = 255;
}
if (s->maxval >= 256) {
- if (avctx->pix_fmt == PIX_FMT_GRAY8) {
- avctx->pix_fmt = PIX_FMT_GRAY16BE;
+ if (avctx->pix_fmt == AV_PIX_FMT_GRAY8) {
+ avctx->pix_fmt = AV_PIX_FMT_GRAY16BE;
if (s->maxval != 65535)
- avctx->pix_fmt = PIX_FMT_GRAY16;
- } else if (avctx->pix_fmt == PIX_FMT_RGB24) {
+ avctx->pix_fmt = AV_PIX_FMT_GRAY16;
+ } else if (avctx->pix_fmt == AV_PIX_FMT_RGB24) {
if (s->maxval > 255)
- avctx->pix_fmt = PIX_FMT_RGB48BE;
+ avctx->pix_fmt = AV_PIX_FMT_RGB48BE;
} else {
av_log(avctx, AV_LOG_ERROR, "Unsupported pixel format\n");
- avctx->pix_fmt = PIX_FMT_NONE;
+ avctx->pix_fmt = AV_PIX_FMT_NONE;
return -1;
}
}
}else
s->maxval=1;
/* more check if YUV420 */
- if (avctx->pix_fmt == PIX_FMT_YUV420P) {
+ if (avctx->pix_fmt == AV_PIX_FMT_YUV420P) {
if ((avctx->width & 1) != 0)
return -1;
h = (avctx->height * 2);
@@ -187,8 +192,8 @@ av_cold int ff_pnm_init(AVCodecContext *avctx)
{
PNMContext *s = avctx->priv_data;
- avcodec_get_frame_defaults((AVFrame*)&s->picture);
- avctx->coded_frame = (AVFrame*)&s->picture;
+ avcodec_get_frame_defaults(&s->picture);
+ avctx->coded_frame = &s->picture;
return 0;
}
diff --git a/gst-libs/ext/libav/libavcodec/pnm_parser.c b/gst-libs/ext/libav/libavcodec/pnm_parser.c
index 89f9871..2e00c0a 100644
--- a/gst-libs/ext/libav/libavcodec/pnm_parser.c
+++ b/gst-libs/ext/libav/libavcodec/pnm_parser.c
@@ -84,8 +84,8 @@ retry:
}
AVCodecParser ff_pnm_parser = {
- .codec_ids = { CODEC_ID_PGM, CODEC_ID_PGMYUV, CODEC_ID_PPM,
- CODEC_ID_PBM, CODEC_ID_PAM },
+ .codec_ids = { AV_CODEC_ID_PGM, AV_CODEC_ID_PGMYUV, AV_CODEC_ID_PPM,
+ AV_CODEC_ID_PBM, AV_CODEC_ID_PAM },
.priv_data_size = sizeof(ParseContext),
.parser_parse = pnm_parse,
.parser_close = ff_parse_close,
diff --git a/gst-libs/ext/libav/libavcodec/pnmdec.c b/gst-libs/ext/libav/libavcodec/pnmdec.c
index e0e9f66..b4b042c 100644
--- a/gst-libs/ext/libav/libavcodec/pnmdec.c
+++ b/gst-libs/ext/libav/libavcodec/pnmdec.c
@@ -21,18 +21,19 @@
#include "avcodec.h"
#include "bytestream.h"
+#include "internal.h"
#include "put_bits.h"
#include "pnm.h"
static int pnm_decode_frame(AVCodecContext *avctx, void *data,
- int *data_size, AVPacket *avpkt)
+ int *got_frame, AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
PNMContext * const s = avctx->priv_data;
AVFrame *picture = data;
- AVFrame * const p = (AVFrame*)&s->picture;
+ AVFrame * const p = &s->picture;
int i, j, n, linesize, h, upgrade = 0;
unsigned char *ptr;
int components, sample_len;
@@ -48,7 +49,7 @@ static int pnm_decode_frame(AVCodecContext *avctx, void *data,
avctx->release_buffer(avctx, p);
p->reference = 0;
- if (avctx->get_buffer(avctx, p) < 0) {
+ if (ff_get_buffer(avctx, p) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return -1;
}
@@ -58,33 +59,33 @@ static int pnm_decode_frame(AVCodecContext *avctx, void *data,
switch (avctx->pix_fmt) {
default:
return -1;
- case PIX_FMT_RGB48BE:
+ case AV_PIX_FMT_RGB48BE:
n = avctx->width * 6;
components=3;
sample_len=16;
goto do_read;
- case PIX_FMT_RGB24:
+ case AV_PIX_FMT_RGB24:
n = avctx->width * 3;
components=3;
sample_len=8;
goto do_read;
- case PIX_FMT_GRAY8:
+ case AV_PIX_FMT_GRAY8:
n = avctx->width;
components=1;
sample_len=8;
if (s->maxval < 255)
upgrade = 1;
goto do_read;
- case PIX_FMT_GRAY16BE:
- case PIX_FMT_GRAY16LE:
+ case AV_PIX_FMT_GRAY16BE:
+ case AV_PIX_FMT_GRAY16LE:
n = avctx->width * 2;
components=1;
sample_len=16;
if (s->maxval < 65535)
upgrade = 2;
goto do_read;
- case PIX_FMT_MONOWHITE:
- case PIX_FMT_MONOBLACK:
+ case AV_PIX_FMT_MONOWHITE:
+ case AV_PIX_FMT_MONOBLACK:
n = (avctx->width + 7) >> 3;
components=1;
sample_len=1;
@@ -133,7 +134,7 @@ static int pnm_decode_frame(AVCodecContext *avctx, void *data,
}
}
break;
- case PIX_FMT_YUV420P:
+ case AV_PIX_FMT_YUV420P:
{
unsigned char *ptr1, *ptr2;
@@ -161,7 +162,7 @@ static int pnm_decode_frame(AVCodecContext *avctx, void *data,
}
}
break;
- case PIX_FMT_RGB32:
+ case AV_PIX_FMT_RGB32:
ptr = p->data[0];
linesize = p->linesize[0];
if (s->bytestream + avctx->width * avctx->height * 4 > s->bytestream_end)
@@ -180,8 +181,8 @@ static int pnm_decode_frame(AVCodecContext *avctx, void *data,
}
break;
}
- *picture = *(AVFrame*)&s->picture;
- *data_size = sizeof(AVPicture);
+ *picture = s->picture;
+ *got_frame = 1;
return s->bytestream - s->bytestream_start;
}
@@ -191,14 +192,13 @@ static int pnm_decode_frame(AVCodecContext *avctx, void *data,
AVCodec ff_pgm_decoder = {
.name = "pgm",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_PGM,
+ .id = AV_CODEC_ID_PGM,
.priv_data_size = sizeof(PNMContext),
.init = ff_pnm_init,
.close = ff_pnm_end,
.decode = pnm_decode_frame,
.capabilities = CODEC_CAP_DR1,
- .pix_fmts = (const enum PixelFormat[]){PIX_FMT_GRAY8, PIX_FMT_GRAY16BE, PIX_FMT_NONE},
- .long_name = NULL_IF_CONFIG_SMALL("PGM (Portable GrayMap) image"),
+ .long_name = NULL_IF_CONFIG_SMALL("PGM (Portable GrayMap) image"),
};
#endif
@@ -206,14 +206,13 @@ AVCodec ff_pgm_decoder = {
AVCodec ff_pgmyuv_decoder = {
.name = "pgmyuv",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_PGMYUV,
+ .id = AV_CODEC_ID_PGMYUV,
.priv_data_size = sizeof(PNMContext),
.init = ff_pnm_init,
.close = ff_pnm_end,
.decode = pnm_decode_frame,
.capabilities = CODEC_CAP_DR1,
- .pix_fmts = (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE},
- .long_name = NULL_IF_CONFIG_SMALL("PGMYUV (Portable GrayMap YUV) image"),
+ .long_name = NULL_IF_CONFIG_SMALL("PGMYUV (Portable GrayMap YUV) image"),
};
#endif
@@ -221,14 +220,13 @@ AVCodec ff_pgmyuv_decoder = {
AVCodec ff_ppm_decoder = {
.name = "ppm",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_PPM,
+ .id = AV_CODEC_ID_PPM,
.priv_data_size = sizeof(PNMContext),
.init = ff_pnm_init,
.close = ff_pnm_end,
.decode = pnm_decode_frame,
.capabilities = CODEC_CAP_DR1,
- .pix_fmts = (const enum PixelFormat[]){PIX_FMT_RGB24, PIX_FMT_RGB48BE, PIX_FMT_NONE},
- .long_name = NULL_IF_CONFIG_SMALL("PPM (Portable PixelMap) image"),
+ .long_name = NULL_IF_CONFIG_SMALL("PPM (Portable PixelMap) image"),
};
#endif
@@ -236,14 +234,13 @@ AVCodec ff_ppm_decoder = {
AVCodec ff_pbm_decoder = {
.name = "pbm",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_PBM,
+ .id = AV_CODEC_ID_PBM,
.priv_data_size = sizeof(PNMContext),
.init = ff_pnm_init,
.close = ff_pnm_end,
.decode = pnm_decode_frame,
.capabilities = CODEC_CAP_DR1,
- .pix_fmts = (const enum PixelFormat[]){PIX_FMT_MONOWHITE, PIX_FMT_NONE},
- .long_name = NULL_IF_CONFIG_SMALL("PBM (Portable BitMap) image"),
+ .long_name = NULL_IF_CONFIG_SMALL("PBM (Portable BitMap) image"),
};
#endif
@@ -251,13 +248,12 @@ AVCodec ff_pbm_decoder = {
AVCodec ff_pam_decoder = {
.name = "pam",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_PAM,
+ .id = AV_CODEC_ID_PAM,
.priv_data_size = sizeof(PNMContext),
.init = ff_pnm_init,
.close = ff_pnm_end,
.decode = pnm_decode_frame,
.capabilities = CODEC_CAP_DR1,
- .pix_fmts = (const enum PixelFormat[]){PIX_FMT_RGB24, PIX_FMT_RGB32, PIX_FMT_GRAY8, PIX_FMT_MONOWHITE, PIX_FMT_NONE},
- .long_name = NULL_IF_CONFIG_SMALL("PAM (Portable AnyMap) image"),
+ .long_name = NULL_IF_CONFIG_SMALL("PAM (Portable AnyMap) image"),
};
#endif
diff --git a/gst-libs/ext/libav/libavcodec/pnmenc.c b/gst-libs/ext/libav/libavcodec/pnmenc.c
index a27a278..2863db7 100644
--- a/gst-libs/ext/libav/libavcodec/pnmenc.c
+++ b/gst-libs/ext/libav/libavcodec/pnmenc.c
@@ -21,21 +21,23 @@
#include "avcodec.h"
#include "bytestream.h"
+#include "internal.h"
#include "pnm.h"
-static int pnm_encode_frame(AVCodecContext *avctx, unsigned char *outbuf,
- int buf_size, void *data)
+static int pnm_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
+ const AVFrame *pict, int *got_packet)
{
PNMContext *s = avctx->priv_data;
- AVFrame *pict = data;
- AVFrame * const p = (AVFrame*)&s->picture;
- int i, h, h1, c, n, linesize;
+ AVFrame * const p = &s->picture;
+ int i, h, h1, c, n, linesize, ret;
uint8_t *ptr, *ptr1, *ptr2;
- if (buf_size < avpicture_get_size(avctx->pix_fmt, avctx->width, avctx->height) + 200) {
+ if ((ret = ff_alloc_packet(pkt, avpicture_get_size(avctx->pix_fmt,
+ avctx->width,
+ avctx->height) + 200)) < 0) {
av_log(avctx, AV_LOG_ERROR, "encoded frame too large\n");
- return -1;
+ return ret;
}
*p = *pict;
@@ -43,33 +45,33 @@ static int pnm_encode_frame(AVCodecContext *avctx, unsigned char *outbuf,
p->key_frame = 1;
s->bytestream_start =
- s->bytestream = outbuf;
- s->bytestream_end = outbuf + buf_size;
+ s->bytestream = pkt->data;
+ s->bytestream_end = pkt->data + pkt->size;
h = avctx->height;
h1 = h;
switch (avctx->pix_fmt) {
- case PIX_FMT_MONOWHITE:
+ case AV_PIX_FMT_MONOWHITE:
c = '4';
n = (avctx->width + 7) >> 3;
break;
- case PIX_FMT_GRAY8:
+ case AV_PIX_FMT_GRAY8:
c = '5';
n = avctx->width;
break;
- case PIX_FMT_GRAY16BE:
+ case AV_PIX_FMT_GRAY16BE:
c = '5';
n = avctx->width * 2;
break;
- case PIX_FMT_RGB24:
+ case AV_PIX_FMT_RGB24:
c = '6';
n = avctx->width * 3;
break;
- case PIX_FMT_RGB48BE:
+ case AV_PIX_FMT_RGB48BE:
c = '6';
n = avctx->width * 6;
break;
- case PIX_FMT_YUV420P:
+ case AV_PIX_FMT_YUV420P:
c = '5';
n = avctx->width;
h1 = (h * 3) / 2;
@@ -80,9 +82,9 @@ static int pnm_encode_frame(AVCodecContext *avctx, unsigned char *outbuf,
snprintf(s->bytestream, s->bytestream_end - s->bytestream,
"P%c\n%d %d\n", c, avctx->width, h1);
s->bytestream += strlen(s->bytestream);
- if (avctx->pix_fmt != PIX_FMT_MONOWHITE) {
+ if (avctx->pix_fmt != AV_PIX_FMT_MONOWHITE) {
snprintf(s->bytestream, s->bytestream_end - s->bytestream,
- "%d\n", (avctx->pix_fmt != PIX_FMT_GRAY16BE && avctx->pix_fmt != PIX_FMT_RGB48BE) ? 255 : 65535);
+ "%d\n", (avctx->pix_fmt != AV_PIX_FMT_GRAY16BE && avctx->pix_fmt != AV_PIX_FMT_RGB48BE) ? 255 : 65535);
s->bytestream += strlen(s->bytestream);
}
@@ -94,7 +96,7 @@ static int pnm_encode_frame(AVCodecContext *avctx, unsigned char *outbuf,
ptr += linesize;
}
- if (avctx->pix_fmt == PIX_FMT_YUV420P) {
+ if (avctx->pix_fmt == AV_PIX_FMT_YUV420P) {
h >>= 1;
n >>= 1;
ptr1 = p->data[1];
@@ -108,7 +110,11 @@ static int pnm_encode_frame(AVCodecContext *avctx, unsigned char *outbuf,
ptr2 += p->linesize[2];
}
}
- return s->bytestream - s->bytestream_start;
+ pkt->size = s->bytestream - s->bytestream_start;
+ pkt->flags |= AV_PKT_FLAG_KEY;
+ *got_packet = 1;
+
+ return 0;
}
@@ -116,12 +122,14 @@ static int pnm_encode_frame(AVCodecContext *avctx, unsigned char *outbuf,
AVCodec ff_pgm_encoder = {
.name = "pgm",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_PGM,
+ .id = AV_CODEC_ID_PGM,
.priv_data_size = sizeof(PNMContext),
.init = ff_pnm_init,
- .encode = pnm_encode_frame,
- .pix_fmts = (const enum PixelFormat[]){PIX_FMT_GRAY8, PIX_FMT_GRAY16BE, PIX_FMT_NONE},
- .long_name = NULL_IF_CONFIG_SMALL("PGM (Portable GrayMap) image"),
+ .encode2 = pnm_encode_frame,
+ .pix_fmts = (const enum AVPixelFormat[]){
+ AV_PIX_FMT_GRAY8, AV_PIX_FMT_GRAY16BE, AV_PIX_FMT_NONE
+ },
+ .long_name = NULL_IF_CONFIG_SMALL("PGM (Portable GrayMap) image"),
};
#endif
@@ -129,12 +137,12 @@ AVCodec ff_pgm_encoder = {
AVCodec ff_pgmyuv_encoder = {
.name = "pgmyuv",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_PGMYUV,
+ .id = AV_CODEC_ID_PGMYUV,
.priv_data_size = sizeof(PNMContext),
.init = ff_pnm_init,
- .encode = pnm_encode_frame,
- .pix_fmts = (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE},
- .long_name = NULL_IF_CONFIG_SMALL("PGMYUV (Portable GrayMap YUV) image"),
+ .encode2 = pnm_encode_frame,
+ .pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_YUV420P, AV_PIX_FMT_NONE },
+ .long_name = NULL_IF_CONFIG_SMALL("PGMYUV (Portable GrayMap YUV) image"),
};
#endif
@@ -142,12 +150,14 @@ AVCodec ff_pgmyuv_encoder = {
AVCodec ff_ppm_encoder = {
.name = "ppm",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_PPM,
+ .id = AV_CODEC_ID_PPM,
.priv_data_size = sizeof(PNMContext),
.init = ff_pnm_init,
- .encode = pnm_encode_frame,
- .pix_fmts = (const enum PixelFormat[]){PIX_FMT_RGB24, PIX_FMT_RGB48BE, PIX_FMT_NONE},
- .long_name = NULL_IF_CONFIG_SMALL("PPM (Portable PixelMap) image"),
+ .encode2 = pnm_encode_frame,
+ .pix_fmts = (const enum AVPixelFormat[]){
+ AV_PIX_FMT_RGB24, AV_PIX_FMT_RGB48BE, AV_PIX_FMT_NONE
+ },
+ .long_name = NULL_IF_CONFIG_SMALL("PPM (Portable PixelMap) image"),
};
#endif
@@ -155,11 +165,12 @@ AVCodec ff_ppm_encoder = {
AVCodec ff_pbm_encoder = {
.name = "pbm",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_PBM,
+ .id = AV_CODEC_ID_PBM,
.priv_data_size = sizeof(PNMContext),
.init = ff_pnm_init,
- .encode = pnm_encode_frame,
- .pix_fmts = (const enum PixelFormat[]){PIX_FMT_MONOWHITE, PIX_FMT_NONE},
- .long_name = NULL_IF_CONFIG_SMALL("PBM (Portable BitMap) image"),
+ .encode2 = pnm_encode_frame,
+ .pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_MONOWHITE,
+ AV_PIX_FMT_NONE },
+ .long_name = NULL_IF_CONFIG_SMALL("PBM (Portable BitMap) image"),
};
#endif
diff --git a/gst-libs/ext/libav/libavcodec/ppc/Makefile b/gst-libs/ext/libav/libavcodec/ppc/Makefile
index 8e37fc7..c8c3025 100644
--- a/gst-libs/ext/libav/libavcodec/ppc/Makefile
+++ b/gst-libs/ext/libav/libavcodec/ppc/Makefile
@@ -1,25 +1,21 @@
OBJS += ppc/dsputil_ppc.o \
+ ppc/videodsp_ppc.o \
-ALTIVEC-OBJS-$(CONFIG_H264DSP) += ppc/h264_altivec.o
-ALTIVEC-OBJS-$(CONFIG_VC1_DECODER) += ppc/vc1dsp_altivec.o
-ALTIVEC-OBJS-$(CONFIG_VP3_DECODER) += ppc/vp3dsp_altivec.o
-ALTIVEC-OBJS-$(CONFIG_VP5_DECODER) += ppc/vp3dsp_altivec.o
-ALTIVEC-OBJS-$(CONFIG_VP6_DECODER) += ppc/vp3dsp_altivec.o
-ALTIVEC-OBJS-$(CONFIG_VP8_DECODER) += ppc/vp8dsp_altivec.o
-
-ALTIVEC-OBJS-$(CONFIG_MPEGAUDIODSP) += ppc/mpegaudiodec_altivec.o
-
-FFT-OBJS-$(HAVE_GNU_AS) += ppc/fft_altivec_s.o \
+OBJS-$(CONFIG_VP3DSP) += ppc/vp3dsp_altivec.o
+FFT-OBJS-$(HAVE_GNU_AS) += ppc/fft_altivec_s.o
ALTIVEC-OBJS-$(CONFIG_FFT) += ppc/fft_altivec.o \
$(FFT-OBJS-yes)
+ALTIVEC-OBJS-$(CONFIG_H264DSP) += ppc/h264_altivec.o
+ALTIVEC-OBJS-$(CONFIG_MPEGAUDIODSP) += ppc/mpegaudiodec_altivec.o
+ALTIVEC-OBJS-$(CONFIG_MPEGVIDEO) += ppc/mpegvideo_altivec.o
+ALTIVEC-OBJS-$(CONFIG_VC1_DECODER) += ppc/vc1dsp_altivec.o
+ALTIVEC-OBJS-$(CONFIG_VP8_DECODER) += ppc/vp8dsp_altivec.o
-OBJS-$(HAVE_ALTIVEC) += ppc/dsputil_altivec.o \
+ALTIVEC-OBJS += ppc/dsputil_altivec.o \
ppc/fdct_altivec.o \
ppc/float_altivec.o \
ppc/fmtconvert_altivec.o \
ppc/gmc_altivec.o \
ppc/idct_altivec.o \
ppc/int_altivec.o \
- ppc/mpegvideo_altivec.o \
- $(ALTIVEC-OBJS-yes)
diff --git a/gst-libs/ext/libav/libavcodec/ppc/dsputil_altivec.c b/gst-libs/ext/libav/libavcodec/ppc/dsputil_altivec.c
index 7ab5336..9ad73ef 100644
--- a/gst-libs/ext/libav/libavcodec/ppc/dsputil_altivec.c
+++ b/gst-libs/ext/libav/libavcodec/ppc/dsputil_altivec.c
@@ -24,9 +24,9 @@
#if HAVE_ALTIVEC_H
#include <altivec.h>
#endif
+#include "libavutil/ppc/types_altivec.h"
+#include "libavutil/ppc/util_altivec.h"
#include "libavcodec/dsputil.h"
-#include "util_altivec.h"
-#include "types_altivec.h"
#include "dsputil_altivec.h"
static int sad16_x2_altivec(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h)
@@ -34,7 +34,9 @@ static int sad16_x2_altivec(void *v, uint8_t *pix1, uint8_t *pix2, int line_size
int i;
int s;
const vector unsigned char zero = (const vector unsigned char)vec_splat_u8(0);
- vector unsigned char *tv;
+ vector unsigned char perm1 = vec_lvsl(0, pix2);
+ vector unsigned char perm2 = vec_add(perm1, vec_splat_u8(1));
+ vector unsigned char pix2l, pix2r;
vector unsigned char pix1v, pix2v, pix2iv, avgv, t5;
vector unsigned int sad;
vector signed int sumdiffs;
@@ -45,14 +47,11 @@ static int sad16_x2_altivec(void *v, uint8_t *pix1, uint8_t *pix2, int line_size
/* Read unaligned pixels into our vectors. The vectors are as follows:
pix1v: pix1[0]-pix1[15]
pix2v: pix2[0]-pix2[15] pix2iv: pix2[1]-pix2[16] */
- tv = (vector unsigned char *) pix1;
- pix1v = vec_perm(tv[0], tv[1], vec_lvsl(0, pix1));
-
- tv = (vector unsigned char *) &pix2[0];
- pix2v = vec_perm(tv[0], tv[1], vec_lvsl(0, &pix2[0]));
-
- tv = (vector unsigned char *) &pix2[1];
- pix2iv = vec_perm(tv[0], tv[1], vec_lvsl(0, &pix2[1]));
+ pix1v = vec_ld( 0, pix1);
+ pix2l = vec_ld( 0, pix2);
+ pix2r = vec_ld(16, pix2);
+ pix2v = vec_perm(pix2l, pix2r, perm1);
+ pix2iv = vec_perm(pix2l, pix2r, perm2);
/* Calculate the average vector */
avgv = vec_avg(pix2v, pix2iv);
@@ -79,7 +78,8 @@ static int sad16_y2_altivec(void *v, uint8_t *pix1, uint8_t *pix2, int line_size
int i;
int s;
const vector unsigned char zero = (const vector unsigned char)vec_splat_u8(0);
- vector unsigned char *tv;
+ vector unsigned char perm = vec_lvsl(0, pix2);
+ vector unsigned char pix2l, pix2r;
vector unsigned char pix1v, pix2v, pix3v, avgv, t5;
vector unsigned int sad;
vector signed int sumdiffs;
@@ -95,18 +95,19 @@ static int sad16_y2_altivec(void *v, uint8_t *pix1, uint8_t *pix2, int line_size
Read unaligned pixels into our vectors. The vectors are as follows:
pix2v: pix2[0]-pix2[15]
Split the pixel vectors into shorts */
- tv = (vector unsigned char *) &pix2[0];
- pix2v = vec_perm(tv[0], tv[1], vec_lvsl(0, &pix2[0]));
+ pix2l = vec_ld( 0, pix2);
+ pix2r = vec_ld(15, pix2);
+ pix2v = vec_perm(pix2l, pix2r, perm);
for (i = 0; i < h; i++) {
/* Read unaligned pixels into our vectors. The vectors are as follows:
pix1v: pix1[0]-pix1[15]
pix3v: pix3[0]-pix3[15] */
- tv = (vector unsigned char *) pix1;
- pix1v = vec_perm(tv[0], tv[1], vec_lvsl(0, pix1));
+ pix1v = vec_ld(0, pix1);
- tv = (vector unsigned char *) &pix3[0];
- pix3v = vec_perm(tv[0], tv[1], vec_lvsl(0, &pix3[0]));
+ pix2l = vec_ld( 0, pix3);
+ pix2r = vec_ld(15, pix3);
+ pix3v = vec_perm(pix2l, pix2r, perm);
/* Calculate the average vector */
avgv = vec_avg(pix2v, pix3v);
@@ -137,7 +138,10 @@ static int sad16_xy2_altivec(void *v, uint8_t *pix1, uint8_t *pix2, int line_siz
uint8_t *pix3 = pix2 + line_size;
const vector unsigned char zero = (const vector unsigned char)vec_splat_u8(0);
const vector unsigned short two = (const vector unsigned short)vec_splat_u16(2);
- vector unsigned char *tv, avgv, t5;
+ vector unsigned char avgv, t5;
+ vector unsigned char perm1 = vec_lvsl(0, pix2);
+ vector unsigned char perm2 = vec_add(perm1, vec_splat_u8(1));
+ vector unsigned char pix2l, pix2r;
vector unsigned char pix1v, pix2v, pix3v, pix2iv, pix3iv;
vector unsigned short pix2lv, pix2hv, pix2ilv, pix2ihv;
vector unsigned short pix3lv, pix3hv, pix3ilv, pix3ihv;
@@ -157,11 +161,10 @@ static int sad16_xy2_altivec(void *v, uint8_t *pix1, uint8_t *pix2, int line_siz
Read unaligned pixels into our vectors. The vectors are as follows:
pix2v: pix2[0]-pix2[15] pix2iv: pix2[1]-pix2[16]
Split the pixel vectors into shorts */
- tv = (vector unsigned char *) &pix2[0];
- pix2v = vec_perm(tv[0], tv[1], vec_lvsl(0, &pix2[0]));
-
- tv = (vector unsigned char *) &pix2[1];
- pix2iv = vec_perm(tv[0], tv[1], vec_lvsl(0, &pix2[1]));
+ pix2l = vec_ld( 0, pix2);
+ pix2r = vec_ld(16, pix2);
+ pix2v = vec_perm(pix2l, pix2r, perm1);
+ pix2iv = vec_perm(pix2l, pix2r, perm2);
pix2hv = (vector unsigned short) vec_mergeh(zero, pix2v);
pix2lv = (vector unsigned short) vec_mergel(zero, pix2v);
@@ -174,14 +177,12 @@ static int sad16_xy2_altivec(void *v, uint8_t *pix1, uint8_t *pix2, int line_siz
/* Read unaligned pixels into our vectors. The vectors are as follows:
pix1v: pix1[0]-pix1[15]
pix3v: pix3[0]-pix3[15] pix3iv: pix3[1]-pix3[16] */
- tv = (vector unsigned char *) pix1;
- pix1v = vec_perm(tv[0], tv[1], vec_lvsl(0, pix1));
-
- tv = (vector unsigned char *) &pix3[0];
- pix3v = vec_perm(tv[0], tv[1], vec_lvsl(0, &pix3[0]));
+ pix1v = vec_ld(0, pix1);
- tv = (vector unsigned char *) &pix3[1];
- pix3iv = vec_perm(tv[0], tv[1], vec_lvsl(0, &pix3[1]));
+ pix2l = vec_ld( 0, pix3);
+ pix2r = vec_ld(16, pix3);
+ pix3v = vec_perm(pix2l, pix2r, perm1);
+ pix3iv = vec_perm(pix2l, pix2r, perm2);
/* Note that AltiVec does have vec_avg, but this works on vector pairs
and rounds up. We could do avg(avg(a,b),avg(c,d)), but the rounding
@@ -230,7 +231,7 @@ static int sad16_altivec(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, i
int i;
int s;
const vector unsigned int zero = (const vector unsigned int)vec_splat_u32(0);
- vector unsigned char perm1, perm2, pix1v_low, pix1v_high, pix2v_low, pix2v_high;
+ vector unsigned char perm = vec_lvsl(0, pix2);
vector unsigned char t1, t2, t3,t4, t5;
vector unsigned int sad;
vector signed int sumdiffs;
@@ -240,14 +241,10 @@ static int sad16_altivec(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, i
for (i = 0; i < h; i++) {
/* Read potentially unaligned pixels into t1 and t2 */
- perm1 = vec_lvsl(0, pix1);
- pix1v_high = vec_ld( 0, pix1);
- pix1v_low = vec_ld(15, pix1);
- perm2 = vec_lvsl(0, pix2);
- pix2v_high = vec_ld( 0, pix2);
- pix2v_low = vec_ld(15, pix2);
- t1 = vec_perm(pix1v_high, pix1v_low, perm1);
- t2 = vec_perm(pix2v_high, pix2v_low, perm2);
+ vector unsigned char pix2l = vec_ld( 0, pix2);
+ vector unsigned char pix2r = vec_ld(15, pix2);
+ t1 = vec_ld(0, pix1);
+ t2 = vec_perm(pix2l, pix2r, perm);
/* Calculate a sum of abs differences vector */
t3 = vec_max(t1, t2);
@@ -274,25 +271,25 @@ static int sad8_altivec(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, in
int i;
int s;
const vector unsigned int zero = (const vector unsigned int)vec_splat_u32(0);
- vector unsigned char perm1, perm2, permclear, *pix1v, *pix2v;
+ const vector unsigned char permclear = (vector unsigned char){255,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0};
+ vector unsigned char perm1 = vec_lvsl(0, pix1);
+ vector unsigned char perm2 = vec_lvsl(0, pix2);
vector unsigned char t1, t2, t3,t4, t5;
vector unsigned int sad;
vector signed int sumdiffs;
sad = (vector unsigned int)vec_splat_u32(0);
- permclear = (vector unsigned char){255,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0};
-
for (i = 0; i < h; i++) {
/* Read potentially unaligned pixels into t1 and t2
Since we're reading 16 pixels, and actually only want 8,
mask out the last 8 pixels. The 0s don't change the sum. */
- perm1 = vec_lvsl(0, pix1);
- pix1v = (vector unsigned char *) pix1;
- perm2 = vec_lvsl(0, pix2);
- pix2v = (vector unsigned char *) pix2;
- t1 = vec_and(vec_perm(pix1v[0], pix1v[1], perm1), permclear);
- t2 = vec_and(vec_perm(pix2v[0], pix2v[1], perm2), permclear);
+ vector unsigned char pix1l = vec_ld( 0, pix1);
+ vector unsigned char pix1r = vec_ld(15, pix1);
+ vector unsigned char pix2l = vec_ld( 0, pix2);
+ vector unsigned char pix2r = vec_ld(15, pix2);
+ t1 = vec_and(vec_perm(pix1l, pix1r, perm1), permclear);
+ t2 = vec_and(vec_perm(pix2l, pix2r, perm2), permclear);
/* Calculate a sum of abs differences vector */
t3 = vec_max(t1, t2);
@@ -319,7 +316,7 @@ static int pix_norm1_altivec(uint8_t *pix, int line_size)
int i;
int s;
const vector unsigned int zero = (const vector unsigned int)vec_splat_u32(0);
- vector unsigned char *tv;
+ vector unsigned char perm = vec_lvsl(0, pix);
vector unsigned char pixv;
vector unsigned int sv;
vector signed int sum;
@@ -329,8 +326,9 @@ static int pix_norm1_altivec(uint8_t *pix, int line_size)
s = 0;
for (i = 0; i < 16; i++) {
/* Read in the potentially unaligned pixels */
- tv = (vector unsigned char *) pix;
- pixv = vec_perm(tv[0], tv[1], vec_lvsl(0, pix));
+ vector unsigned char pixl = vec_ld( 0, pix);
+ vector unsigned char pixr = vec_ld(15, pix);
+ pixv = vec_perm(pixl, pixr, perm);
/* Square the values, and add them to our sum */
sv = vec_msum(pixv, pixv, sv);
@@ -355,26 +353,25 @@ static int sse8_altivec(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, in
int i;
int s;
const vector unsigned int zero = (const vector unsigned int)vec_splat_u32(0);
- vector unsigned char perm1, perm2, permclear, *pix1v, *pix2v;
+ const vector unsigned char permclear = (vector unsigned char){255,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0};
+ vector unsigned char perm1 = vec_lvsl(0, pix1);
+ vector unsigned char perm2 = vec_lvsl(0, pix2);
vector unsigned char t1, t2, t3,t4, t5;
vector unsigned int sum;
vector signed int sumsqr;
sum = (vector unsigned int)vec_splat_u32(0);
- permclear = (vector unsigned char){255,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0};
-
-
for (i = 0; i < h; i++) {
/* Read potentially unaligned pixels into t1 and t2
Since we're reading 16 pixels, and actually only want 8,
mask out the last 8 pixels. The 0s don't change the sum. */
- perm1 = vec_lvsl(0, pix1);
- pix1v = (vector unsigned char *) pix1;
- perm2 = vec_lvsl(0, pix2);
- pix2v = (vector unsigned char *) pix2;
- t1 = vec_and(vec_perm(pix1v[0], pix1v[1], perm1), permclear);
- t2 = vec_and(vec_perm(pix2v[0], pix2v[1], perm2), permclear);
+ vector unsigned char pix1l = vec_ld( 0, pix1);
+ vector unsigned char pix1r = vec_ld(15, pix1);
+ vector unsigned char pix2l = vec_ld( 0, pix2);
+ vector unsigned char pix2r = vec_ld(15, pix2);
+ t1 = vec_and(vec_perm(pix1l, pix1r, perm1), permclear);
+ t2 = vec_and(vec_perm(pix2l, pix2r, perm2), permclear);
/* Since we want to use unsigned chars, we can take advantage
of the fact that abs(a-b)^2 = (a-b)^2. */
@@ -409,7 +406,7 @@ static int sse16_altivec(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, i
int i;
int s;
const vector unsigned int zero = (const vector unsigned int)vec_splat_u32(0);
- vector unsigned char perm1, perm2, *pix1v, *pix2v;
+ vector unsigned char perm = vec_lvsl(0, pix2);
vector unsigned char t1, t2, t3,t4, t5;
vector unsigned int sum;
vector signed int sumsqr;
@@ -418,12 +415,10 @@ static int sse16_altivec(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, i
for (i = 0; i < h; i++) {
/* Read potentially unaligned pixels into t1 and t2 */
- perm1 = vec_lvsl(0, pix1);
- pix1v = (vector unsigned char *) pix1;
- perm2 = vec_lvsl(0, pix2);
- pix2v = (vector unsigned char *) pix2;
- t1 = vec_perm(pix1v[0], pix1v[1], perm1);
- t2 = vec_perm(pix2v[0], pix2v[1], perm2);
+ vector unsigned char pix2l = vec_ld( 0, pix2);
+ vector unsigned char pix2r = vec_ld(15, pix2);
+ t1 = vec_ld(0, pix1);
+ t2 = vec_perm(pix2l, pix2r, perm);
/* Since we want to use unsigned chars, we can take advantage
of the fact that abs(a-b)^2 = (a-b)^2. */
@@ -451,7 +446,7 @@ static int sse16_altivec(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, i
static int pix_sum_altivec(uint8_t * pix, int line_size)
{
const vector unsigned int zero = (const vector unsigned int)vec_splat_u32(0);
- vector unsigned char perm, *pixv;
+ vector unsigned char perm = vec_lvsl(0, pix);
vector unsigned char t1;
vector unsigned int sad;
vector signed int sumdiffs;
@@ -463,9 +458,9 @@ static int pix_sum_altivec(uint8_t * pix, int line_size)
for (i = 0; i < 16; i++) {
/* Read the potentially unaligned 16 pixels into t1 */
- perm = vec_lvsl(0, pix);
- pixv = (vector unsigned char *) pix;
- t1 = vec_perm(pixv[0], pixv[1], perm);
+ vector unsigned char pixl = vec_ld( 0, pix);
+ vector unsigned char pixr = vec_ld(15, pix);
+ t1 = vec_perm(pixl, pixr, perm);
/* Add each 4 pixel group together and put 4 results into sad */
sad = vec_sum4s(t1, sad);
@@ -484,7 +479,8 @@ static int pix_sum_altivec(uint8_t * pix, int line_size)
static void get_pixels_altivec(DCTELEM *restrict block, const uint8_t *pixels, int line_size)
{
int i;
- vector unsigned char perm, bytes, *pixv;
+ vector unsigned char perm = vec_lvsl(0, pixels);
+ vector unsigned char bytes;
const vector unsigned char zero = (const vector unsigned char)vec_splat_u8(0);
vector signed short shorts;
@@ -492,9 +488,9 @@ static void get_pixels_altivec(DCTELEM *restrict block, const uint8_t *pixels, i
// Read potentially unaligned pixels.
// We're reading 16 pixels, and actually only want 8,
// but we simply ignore the extras.
- perm = vec_lvsl(0, pixels);
- pixv = (vector unsigned char *) pixels;
- bytes = vec_perm(pixv[0], pixv[1], perm);
+ vector unsigned char pixl = vec_ld( 0, pixels);
+ vector unsigned char pixr = vec_ld(15, pixels);
+ bytes = vec_perm(pixl, pixr, perm);
// convert the bytes into shorts
shorts = (vector signed short)vec_mergeh(zero, bytes);
@@ -510,7 +506,9 @@ static void diff_pixels_altivec(DCTELEM *restrict block, const uint8_t *s1,
const uint8_t *s2, int stride)
{
int i;
- vector unsigned char perm, bytes, *pixv;
+ vector unsigned char perm1 = vec_lvsl(0, s1);
+ vector unsigned char perm2 = vec_lvsl(0, s2);
+ vector unsigned char bytes, pixl, pixr;
const vector unsigned char zero = (const vector unsigned char)vec_splat_u8(0);
vector signed short shorts1, shorts2;
@@ -518,17 +516,17 @@ static void diff_pixels_altivec(DCTELEM *restrict block, const uint8_t *s1,
// Read potentially unaligned pixels
// We're reading 16 pixels, and actually only want 8,
// but we simply ignore the extras.
- perm = vec_lvsl(0, s1);
- pixv = (vector unsigned char *) s1;
- bytes = vec_perm(pixv[0], pixv[1], perm);
+ pixl = vec_ld( 0, s1);
+ pixr = vec_ld(15, s1);
+ bytes = vec_perm(pixl, pixr, perm1);
// convert the bytes into shorts
shorts1 = (vector signed short)vec_mergeh(zero, bytes);
// Do the same for the second block of pixels
- perm = vec_lvsl(0, s2);
- pixv = (vector unsigned char *) s2;
- bytes = vec_perm(pixv[0], pixv[1], perm);
+ pixl = vec_ld( 0, s2);
+ pixr = vec_ld(15, s2);
+ bytes = vec_perm(pixl, pixr, perm2);
// convert the bytes into shorts
shorts2 = (vector signed short)vec_mergeh(zero, bytes);
@@ -550,17 +548,17 @@ static void diff_pixels_altivec(DCTELEM *restrict block, const uint8_t *s1,
// Read potentially unaligned pixels
// We're reading 16 pixels, and actually only want 8,
// but we simply ignore the extras.
- perm = vec_lvsl(0, s1);
- pixv = (vector unsigned char *) s1;
- bytes = vec_perm(pixv[0], pixv[1], perm);
+ pixl = vec_ld( 0, s1);
+ pixr = vec_ld(15, s1);
+ bytes = vec_perm(pixl, pixr, perm1);
// convert the bytes into shorts
shorts1 = (vector signed short)vec_mergeh(zero, bytes);
// Do the same for the second block of pixels
- perm = vec_lvsl(0, s2);
- pixv = (vector unsigned char *) s2;
- bytes = vec_perm(pixv[0], pixv[1], perm);
+ pixl = vec_ld( 0, s2);
+ pixr = vec_ld(15, s2);
+ bytes = vec_perm(pixl, pixr, perm2);
// convert the bytes into shorts
shorts2 = (vector signed short)vec_mergeh(zero, bytes);
@@ -609,7 +607,7 @@ static void add_bytes_altivec(uint8_t *dst, uint8_t *src, int w) {
}
/* next one assumes that ((line_size % 16) == 0) */
-void put_pixels16_altivec(uint8_t *block, const uint8_t *pixels, int line_size, int h)
+void ff_put_pixels16_altivec(uint8_t *block, const uint8_t *pixels, int line_size, int h)
{
register vector unsigned char pixelsv1, pixelsv2;
register vector unsigned char pixelsv1B, pixelsv2B;
@@ -651,7 +649,7 @@ void put_pixels16_altivec(uint8_t *block, const uint8_t *pixels, int line_size,
/* next one assumes that ((line_size % 16) == 0) */
#define op_avg(a,b) a = ( ((a)|(b)) - ((((a)^(b))&0xFEFEFEFEUL)>>1) )
-void avg_pixels16_altivec(uint8_t *block, const uint8_t *pixels, int line_size, int h)
+void ff_avg_pixels16_altivec(uint8_t *block, const uint8_t *pixels, int line_size, int h)
{
register vector unsigned char pixelsv1, pixelsv2, pixelsv, blockv;
register vector unsigned char perm = vec_lvsl(0, pixels);
@@ -1371,7 +1369,7 @@ static void avg_pixels8_xy2_altivec(uint8_t *block, const uint8_t *pixels, int l
}
}
-void dsputil_init_altivec(DSPContext* c, AVCodecContext *avctx)
+void ff_dsputil_init_altivec(DSPContext* c, AVCodecContext *avctx)
{
const int high_bit_depth = avctx->bits_per_raw_sample > 8;
@@ -1391,10 +1389,10 @@ void dsputil_init_altivec(DSPContext* c, AVCodecContext *avctx)
if (!high_bit_depth) {
c->get_pixels = get_pixels_altivec;
c->clear_block = clear_block_altivec;
- c->put_pixels_tab[0][0] = put_pixels16_altivec;
+ c->put_pixels_tab[0][0] = ff_put_pixels16_altivec;
/* the two functions do the same thing, so use the same code */
- c->put_no_rnd_pixels_tab[0][0] = put_pixels16_altivec;
- c->avg_pixels_tab[0][0] = avg_pixels16_altivec;
+ c->put_no_rnd_pixels_tab[0][0] = ff_put_pixels16_altivec;
+ c->avg_pixels_tab[0][0] = ff_avg_pixels16_altivec;
c->avg_pixels_tab[1][0] = avg_pixels8_altivec;
c->avg_pixels_tab[1][3] = avg_pixels8_xy2_altivec;
c->put_pixels_tab[1][3] = put_pixels8_xy2_altivec;
diff --git a/gst-libs/ext/libav/libavcodec/ppc/dsputil_altivec.h b/gst-libs/ext/libav/libavcodec/ppc/dsputil_altivec.h
index abf2dd3..7cbda36 100644
--- a/gst-libs/ext/libav/libavcodec/ppc/dsputil_altivec.h
+++ b/gst-libs/ext/libav/libavcodec/ppc/dsputil_altivec.h
@@ -26,24 +26,20 @@
#include <stdint.h>
#include "libavcodec/dsputil.h"
-void put_pixels16_altivec(uint8_t *block, const uint8_t *pixels, int line_size, int h);
+void ff_put_pixels16_altivec(uint8_t *block, const uint8_t *pixels, int line_size, int h);
-void avg_pixels16_altivec(uint8_t *block, const uint8_t *pixels, int line_size, int h);
+void ff_avg_pixels16_altivec(uint8_t *block, const uint8_t *pixels, int line_size, int h);
-void fdct_altivec(int16_t *block);
-void gmc1_altivec(uint8_t *dst, uint8_t *src, int stride, int h,
- int x16, int y16, int rounder);
-void idct_put_altivec(uint8_t *dest, int line_size, int16_t *block);
-void idct_add_altivec(uint8_t *dest, int line_size, int16_t *block);
+void ff_fdct_altivec(int16_t *block);
+void ff_gmc1_altivec(uint8_t *dst, uint8_t *src, int stride, int h,
+ int x16, int y16, int rounder);
+void ff_idct_put_altivec(uint8_t *dest, int line_size, int16_t *block);
+void ff_idct_add_altivec(uint8_t *dest, int line_size, int16_t *block);
-void ff_vp3_idct_altivec(DCTELEM *block);
-void ff_vp3_idct_put_altivec(uint8_t *dest, int line_size, DCTELEM *block);
-void ff_vp3_idct_add_altivec(uint8_t *dest, int line_size, DCTELEM *block);
+void ff_dsputil_h264_init_ppc(DSPContext* c, AVCodecContext *avctx);
-void dsputil_h264_init_ppc(DSPContext* c, AVCodecContext *avctx);
-
-void dsputil_init_altivec(DSPContext* c, AVCodecContext *avctx);
-void float_init_altivec(DSPContext* c, AVCodecContext *avctx);
-void int_init_altivec(DSPContext* c, AVCodecContext *avctx);
+void ff_dsputil_init_altivec(DSPContext* c, AVCodecContext *avctx);
+void ff_float_init_altivec(DSPContext* c, AVCodecContext *avctx);
+void ff_int_init_altivec(DSPContext* c, AVCodecContext *avctx);
#endif /* AVCODEC_PPC_DSPUTIL_ALTIVEC_H */
diff --git a/gst-libs/ext/libav/libavcodec/ppc/dsputil_ppc.c b/gst-libs/ext/libav/libavcodec/ppc/dsputil_ppc.c
index 24b12ee..a306940 100644
--- a/gst-libs/ext/libav/libavcodec/ppc/dsputil_ppc.c
+++ b/gst-libs/ext/libav/libavcodec/ppc/dsputil_ppc.c
@@ -20,7 +20,10 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <string.h>
+
#include "libavutil/cpu.h"
+#include "libavutil/mem.h"
#include "libavcodec/dsputil.h"
#include "dsputil_altivec.h"
@@ -134,21 +137,11 @@ static long check_dcbzl_effect(void)
}
#endif
-static void prefetch_ppc(void *mem, int stride, int h)
-{
- register const uint8_t *p = mem;
- do {
- __asm__ volatile ("dcbt 0,%0" : : "r" (p));
- p+= stride;
- } while(--h);
-}
-
-void dsputil_init_ppc(DSPContext* c, AVCodecContext *avctx)
+void ff_dsputil_init_ppc(DSPContext* c, AVCodecContext *avctx)
{
const int high_bit_depth = avctx->bits_per_raw_sample > 8;
// Common optimizations whether AltiVec is available or not
- c->prefetch = prefetch_ppc;
if (!high_bit_depth) {
switch (check_dcbzl_effect()) {
case 32:
@@ -163,33 +156,27 @@ void dsputil_init_ppc(DSPContext* c, AVCodecContext *avctx)
}
#if HAVE_ALTIVEC
- if(CONFIG_H264_DECODER) dsputil_h264_init_ppc(c, avctx);
+ if(CONFIG_H264_DECODER) ff_dsputil_h264_init_ppc(c, avctx);
if (av_get_cpu_flags() & AV_CPU_FLAG_ALTIVEC) {
- dsputil_init_altivec(c, avctx);
- float_init_altivec(c, avctx);
- int_init_altivec(c, avctx);
- c->gmc1 = gmc1_altivec;
+ ff_dsputil_init_altivec(c, avctx);
+ ff_float_init_altivec(c, avctx);
+ ff_int_init_altivec(c, avctx);
+ c->gmc1 = ff_gmc1_altivec;
#if CONFIG_ENCODERS
if (avctx->bits_per_raw_sample <= 8 &&
(avctx->dct_algo == FF_DCT_AUTO ||
avctx->dct_algo == FF_DCT_ALTIVEC)) {
- c->fdct = fdct_altivec;
+ c->fdct = ff_fdct_altivec;
}
#endif //CONFIG_ENCODERS
- if (avctx->lowres == 0 && avctx->bits_per_raw_sample <= 8) {
+ if (avctx->bits_per_raw_sample <= 8) {
if ((avctx->idct_algo == FF_IDCT_AUTO) ||
(avctx->idct_algo == FF_IDCT_ALTIVEC)) {
- c->idct_put = idct_put_altivec;
- c->idct_add = idct_add_altivec;
- c->idct_permutation_type = FF_TRANSPOSE_IDCT_PERM;
- }else if((CONFIG_VP3_DECODER || CONFIG_VP5_DECODER || CONFIG_VP6_DECODER) &&
- avctx->idct_algo==FF_IDCT_VP3){
- c->idct_put = ff_vp3_idct_put_altivec;
- c->idct_add = ff_vp3_idct_add_altivec;
- c->idct = ff_vp3_idct_altivec;
+ c->idct_put = ff_idct_put_altivec;
+ c->idct_add = ff_idct_add_altivec;
c->idct_permutation_type = FF_TRANSPOSE_IDCT_PERM;
}
}
diff --git a/gst-libs/ext/libav/libavcodec/ppc/fdct_altivec.c b/gst-libs/ext/libav/libavcodec/ppc/fdct_altivec.c
index 2644c96..0e3658d 100644
--- a/gst-libs/ext/libav/libavcodec/ppc/fdct_altivec.c
+++ b/gst-libs/ext/libav/libavcodec/ppc/fdct_altivec.c
@@ -195,7 +195,7 @@ static vector float fdctconsts[3] = {
/* two dimensional discrete cosine transform */
-void fdct_altivec(int16_t *block)
+void ff_fdct_altivec(int16_t *block)
{
vector signed short *bp;
vector float *cp;
diff --git a/gst-libs/ext/libav/libavcodec/ppc/fft_altivec.c b/gst-libs/ext/libav/libavcodec/ppc/fft_altivec.c
index 39830b2..c85d04f 100644
--- a/gst-libs/ext/libav/libavcodec/ppc/fft_altivec.c
+++ b/gst-libs/ext/libav/libavcodec/ppc/fft_altivec.c
@@ -19,9 +19,10 @@
* License along with Libav; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+
+#include "libavutil/ppc/types_altivec.h"
+#include "libavutil/ppc/util_altivec.h"
#include "libavcodec/fft.h"
-#include "util_altivec.h"
-#include "types_altivec.h"
/**
* Do a complex FFT with the parameters defined in ff_fft_init(). The
diff --git a/gst-libs/ext/libav/libavcodec/ppc/float_altivec.c b/gst-libs/ext/libav/libavcodec/ppc/float_altivec.c
index e401069..5068fd4 100644
--- a/gst-libs/ext/libav/libavcodec/ppc/float_altivec.c
+++ b/gst-libs/ext/libav/libavcodec/ppc/float_altivec.c
@@ -18,25 +18,10 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "libavutil/ppc/util_altivec.h"
#include "libavcodec/dsputil.h"
#include "dsputil_altivec.h"
-#include "util_altivec.h"
-
-static void vector_fmul_altivec(float *dst, const float *src0, const float *src1, int len)
-{
- int i;
- vector float d0, d1, s, zero = (vector float)vec_splat_u32(0);
- for(i=0; i<len-7; i+=8) {
- d0 = vec_ld(0, src0+i);
- s = vec_ld(0, src1+i);
- d1 = vec_ld(16, src0+i);
- d0 = vec_madd(d0, s, zero);
- d1 = vec_madd(d1, vec_ld(16,src1+i), zero);
- vec_st(d0, 0, dst+i);
- vec_st(d1, 16, dst+i);
- }
-}
static void vector_fmul_reverse_altivec(float *dst, const float *src0,
const float *src1, int len)
@@ -122,9 +107,8 @@ static void vector_fmul_window_altivec(float *dst, const float *src0, const floa
}
}
-void float_init_altivec(DSPContext* c, AVCodecContext *avctx)
+void ff_float_init_altivec(DSPContext* c, AVCodecContext *avctx)
{
- c->vector_fmul = vector_fmul_altivec;
c->vector_fmul_reverse = vector_fmul_reverse_altivec;
c->vector_fmul_add = vector_fmul_add_altivec;
if(!(avctx->flags & CODEC_FLAG_BITEXACT)) {
diff --git a/gst-libs/ext/libav/libavcodec/ppc/fmtconvert_altivec.c b/gst-libs/ext/libav/libavcodec/ppc/fmtconvert_altivec.c
index b1eaf9b..68e5e00 100644
--- a/gst-libs/ext/libav/libavcodec/ppc/fmtconvert_altivec.c
+++ b/gst-libs/ext/libav/libavcodec/ppc/fmtconvert_altivec.c
@@ -20,10 +20,12 @@
#include "libavcodec/fmtconvert.h"
+#include "libavutil/ppc/util_altivec.h"
+#include "libavutil/mem.h"
#include "dsputil_altivec.h"
-#include "util_altivec.h"
-static void int32_to_float_fmul_scalar_altivec(float *dst, const int *src, float mul, int len)
+static void int32_to_float_fmul_scalar_altivec(float *dst, const int *src,
+ float mul, int len)
{
union {
vector float v;
@@ -36,7 +38,7 @@ static void int32_to_float_fmul_scalar_altivec(float *dst, const int *src, float
mul_u.s[0] = mul;
mul_v = vec_splat(mul_u.v, 0);
- for(i=0; i<len; i+=8) {
+ for (i = 0; i < len; i += 8) {
src1 = vec_ctf(vec_ld(0, src+i), 0);
src2 = vec_ctf(vec_ld(16, src+i), 0);
dst1 = vec_madd(src1, mul_v, zero);
@@ -47,8 +49,7 @@ static void int32_to_float_fmul_scalar_altivec(float *dst, const int *src, float
}
-static vector signed short
-float_to_int16_one_altivec(const float *src)
+static vector signed short float_to_int16_one_altivec(const float *src)
{
vector float s0 = vec_ld(0, src);
vector float s1 = vec_ld(16, src);
@@ -62,80 +63,102 @@ static void float_to_int16_altivec(int16_t *dst, const float *src, long len)
int i;
vector signed short d0, d1, d;
vector unsigned char align;
- if(((long)dst)&15) //FIXME
- for(i=0; i<len-7; i+=8) {
- d0 = vec_ld(0, dst+i);
- d = float_to_int16_one_altivec(src+i);
- d1 = vec_ld(15, dst+i);
- d1 = vec_perm(d1, d0, vec_lvsl(0,dst+i));
- align = vec_lvsr(0, dst+i);
- d0 = vec_perm(d1, d, align);
- d1 = vec_perm(d, d1, align);
- vec_st(d0, 0, dst+i);
- vec_st(d1,15, dst+i);
+ if (((long)dst) & 15) { //FIXME
+ for (i = 0; i < len - 7; i += 8) {
+ d0 = vec_ld(0, dst+i);
+ d = float_to_int16_one_altivec(src + i);
+ d1 = vec_ld(15, dst+i);
+ d1 = vec_perm(d1, d0, vec_lvsl(0, dst + i));
+ align = vec_lvsr(0, dst + i);
+ d0 = vec_perm(d1, d, align);
+ d1 = vec_perm(d, d1, align);
+ vec_st(d0, 0, dst + i);
+ vec_st(d1, 15, dst + i);
+ }
+ } else {
+ for (i = 0; i < len - 7; i += 8) {
+ d = float_to_int16_one_altivec(src + i);
+ vec_st(d, 0, dst + i);
+ }
}
- else
- for(i=0; i<len-7; i+=8) {
- d = float_to_int16_one_altivec(src+i);
- vec_st(d, 0, dst+i);
+}
+
+#define VSTE_INC(dst, v, elem, inc) do { \
+ vector signed short s = vec_splat(v, elem); \
+ vec_ste(s, 0, dst); \
+ dst += inc; \
+ } while (0)
+
+static void float_to_int16_stride_altivec(int16_t *dst, const float *src,
+ long len, int stride)
+{
+ int i, j;
+ vector signed short d, s;
+
+ for (i = 0; i < len - 7; i += 8) {
+ d = float_to_int16_one_altivec(src + i);
+ VSTE_INC(dst, d, 0, stride);
+ VSTE_INC(dst, d, 1, stride);
+ VSTE_INC(dst, d, 2, stride);
+ VSTE_INC(dst, d, 3, stride);
+ VSTE_INC(dst, d, 4, stride);
+ VSTE_INC(dst, d, 5, stride);
+ VSTE_INC(dst, d, 6, stride);
+ VSTE_INC(dst, d, 7, stride);
}
}
-static void
-float_to_int16_interleave_altivec(int16_t *dst, const float **src,
- long len, int channels)
+static void float_to_int16_interleave_altivec(int16_t *dst, const float **src,
+ long len, int channels)
{
int i;
vector signed short d0, d1, d2, c0, c1, t0, t1;
vector unsigned char align;
- if(channels == 1)
+
+ if (channels == 1)
float_to_int16_altivec(dst, src[0], len);
- else
+ else {
if (channels == 2) {
- if(((long)dst)&15)
- for(i=0; i<len-7; i+=8) {
- d0 = vec_ld(0, dst + i);
- t0 = float_to_int16_one_altivec(src[0] + i);
- d1 = vec_ld(31, dst + i);
- t1 = float_to_int16_one_altivec(src[1] + i);
- c0 = vec_mergeh(t0, t1);
- c1 = vec_mergel(t0, t1);
- d2 = vec_perm(d1, d0, vec_lvsl(0, dst + i));
- align = vec_lvsr(0, dst + i);
- d0 = vec_perm(d2, c0, align);
- d1 = vec_perm(c0, c1, align);
- vec_st(d0, 0, dst + i);
- d0 = vec_perm(c1, d2, align);
- vec_st(d1, 15, dst + i);
- vec_st(d0, 31, dst + i);
- dst+=8;
- }
- else
- for(i=0; i<len-7; i+=8) {
- t0 = float_to_int16_one_altivec(src[0] + i);
- t1 = float_to_int16_one_altivec(src[1] + i);
- d0 = vec_mergeh(t0, t1);
- d1 = vec_mergel(t0, t1);
- vec_st(d0, 0, dst + i);
- vec_st(d1, 16, dst + i);
- dst+=8;
- }
- } else {
- DECLARE_ALIGNED(16, int16_t, tmp)[len];
- int c, j;
- for (c = 0; c < channels; c++) {
- float_to_int16_altivec(tmp, src[c], len);
- for (i = 0, j = c; i < len; i++, j+=channels) {
- dst[j] = tmp[i];
+ if (((long)dst) & 15) {
+ for (i = 0; i < len - 7; i += 8) {
+ d0 = vec_ld(0, dst + i);
+ t0 = float_to_int16_one_altivec(src[0] + i);
+ d1 = vec_ld(31, dst + i);
+ t1 = float_to_int16_one_altivec(src[1] + i);
+ c0 = vec_mergeh(t0, t1);
+ c1 = vec_mergel(t0, t1);
+ d2 = vec_perm(d1, d0, vec_lvsl(0, dst + i));
+ align = vec_lvsr(0, dst + i);
+ d0 = vec_perm(d2, c0, align);
+ d1 = vec_perm(c0, c1, align);
+ vec_st(d0, 0, dst + i);
+ d0 = vec_perm(c1, d2, align);
+ vec_st(d1, 15, dst + i);
+ vec_st(d0, 31, dst + i);
+ dst += 8;
+ }
+ } else {
+ for (i = 0; i < len - 7; i += 8) {
+ t0 = float_to_int16_one_altivec(src[0] + i);
+ t1 = float_to_int16_one_altivec(src[1] + i);
+ d0 = vec_mergeh(t0, t1);
+ d1 = vec_mergel(t0, t1);
+ vec_st(d0, 0, dst + i);
+ vec_st(d1, 16, dst + i);
+ dst += 8;
+ }
}
+ } else {
+ for (i = 0; i < channels; i++)
+ float_to_int16_stride_altivec(dst + i, src[i], len, channels);
}
- }
+ }
}
void ff_fmt_convert_init_altivec(FmtConvertContext *c, AVCodecContext *avctx)
{
c->int32_to_float_fmul_scalar = int32_to_float_fmul_scalar_altivec;
- if(!(avctx->flags & CODEC_FLAG_BITEXACT)) {
+ if (!(avctx->flags & CODEC_FLAG_BITEXACT)) {
c->float_to_int16 = float_to_int16_altivec;
c->float_to_int16_interleave = float_to_int16_interleave_altivec;
}
diff --git a/gst-libs/ext/libav/libavcodec/ppc/gmc_altivec.c b/gst-libs/ext/libav/libavcodec/ppc/gmc_altivec.c
index 0ed70ab..f86964b 100644
--- a/gst-libs/ext/libav/libavcodec/ppc/gmc_altivec.c
+++ b/gst-libs/ext/libav/libavcodec/ppc/gmc_altivec.c
@@ -20,16 +20,17 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "libavutil/mem.h"
+#include "libavutil/ppc/types_altivec.h"
+#include "libavutil/ppc/util_altivec.h"
#include "libavcodec/dsputil.h"
-#include "util_altivec.h"
-#include "types_altivec.h"
#include "dsputil_altivec.h"
/*
altivec-enhanced gmc1. ATM this code assume stride is a multiple of 8,
to preserve proper dst alignment.
*/
-void gmc1_altivec(uint8_t *dst /* align 8 */, uint8_t *src /* align1 */, int stride, int h, int x16, int y16, int rounder)
+void ff_gmc1_altivec(uint8_t *dst /* align 8 */, uint8_t *src /* align1 */, int stride, int h, int x16, int y16, int rounder)
{
const DECLARE_ALIGNED(16, unsigned short, rounder_a) = rounder;
const DECLARE_ALIGNED(16, unsigned short, ABCD)[8] =
@@ -48,7 +49,7 @@ void gmc1_altivec(uint8_t *dst /* align 8 */, uint8_t *src /* align1 */, int str
unsigned long dst_odd = (unsigned long)dst & 0x0000000F;
unsigned long src_really_odd = (unsigned long)src & 0x0000000F;
- tempA = vec_ld(0, (unsigned short*)ABCD);
+ tempA = vec_ld(0, (const unsigned short*)ABCD);
Av = vec_splat(tempA, 0);
Bv = vec_splat(tempA, 1);
Cv = vec_splat(tempA, 2);
diff --git a/gst-libs/ext/libav/libavcodec/ppc/h264_altivec.c b/gst-libs/ext/libav/libavcodec/ppc/h264_altivec.c
index c8baee4..73e2adb 100644
--- a/gst-libs/ext/libav/libavcodec/ppc/h264_altivec.c
+++ b/gst-libs/ext/libav/libavcodec/ppc/h264_altivec.c
@@ -19,13 +19,14 @@
*/
#include "libavutil/cpu.h"
+#include "libavutil/intreadwrite.h"
+#include "libavutil/ppc/types_altivec.h"
+#include "libavutil/ppc/util_altivec.h"
#include "libavcodec/dsputil.h"
#include "libavcodec/h264data.h"
#include "libavcodec/h264dsp.h"
#include "dsputil_altivec.h"
-#include "util_altivec.h"
-#include "types_altivec.h"
#define PUT_OP_U8_ALTIVEC(d, s, dst) d = s
#define AVG_OP_U8_ALTIVEC(d, s, dst) d = vec_avg(dst, s)
@@ -39,7 +40,7 @@
#define PREFIX_h264_qpel16_v_lowpass_num altivec_put_h264_qpel16_v_lowpass_num
#define PREFIX_h264_qpel16_hv_lowpass_altivec put_h264_qpel16_hv_lowpass_altivec
#define PREFIX_h264_qpel16_hv_lowpass_num altivec_put_h264_qpel16_hv_lowpass_num
-#include "h264_template_altivec.c"
+#include "h264_altivec_template.c"
#undef OP_U8_ALTIVEC
#undef PREFIX_h264_chroma_mc8_altivec
#undef PREFIX_h264_chroma_mc8_num
@@ -59,7 +60,7 @@
#define PREFIX_h264_qpel16_v_lowpass_num altivec_avg_h264_qpel16_v_lowpass_num
#define PREFIX_h264_qpel16_hv_lowpass_altivec avg_h264_qpel16_hv_lowpass_altivec
#define PREFIX_h264_qpel16_hv_lowpass_num altivec_avg_h264_qpel16_hv_lowpass_num
-#include "h264_template_altivec.c"
+#include "h264_altivec_template.c"
#undef OP_U8_ALTIVEC
#undef PREFIX_h264_chroma_mc8_altivec
#undef PREFIX_h264_chroma_mc8_num
@@ -72,7 +73,7 @@
#define H264_MC(OPNAME, SIZE, CODETYPE) \
static void OPNAME ## h264_qpel ## SIZE ## _mc00_ ## CODETYPE (uint8_t *dst, uint8_t *src, int stride){\
- OPNAME ## pixels ## SIZE ## _ ## CODETYPE(dst, src, stride, SIZE);\
+ ff_ ## OPNAME ## pixels ## SIZE ## _ ## CODETYPE(dst, src, stride, SIZE);\
}\
\
static void OPNAME ## h264_qpel ## SIZE ## _mc10_ ## CODETYPE(uint8_t *dst, uint8_t *src, int stride){ \
@@ -788,7 +789,7 @@ static inline vec_u8 h264_deblock_q1(register vec_u8 p0,
alphavec = vec_splat(alphavec, 0x0); \
mask = h264_deblock_mask(p0, p1, q0, q1, alphavec, betavec); /*if in block */ \
\
- *((int *)temp) = *((int *)tc0); \
+ AV_COPY32(temp, tc0); \
tc0vec = vec_ld(0, (signed char*)temp); \
tc0vec = vec_mergeh(tc0vec, tc0vec); \
tc0vec = vec_mergeh(tc0vec, tc0vec); \
@@ -966,7 +967,7 @@ static void ff_biweight_h264_pixels ## W ## _altivec(uint8_t *dst, uint8_t *src,
H264_WEIGHT(16)
H264_WEIGHT( 8)
-void dsputil_h264_init_ppc(DSPContext* c, AVCodecContext *avctx) {
+void ff_dsputil_h264_init_ppc(DSPContext* c, AVCodecContext *avctx) {
const int high_bit_depth = avctx->bits_per_raw_sample > 8;
if (av_get_cpu_flags() & AV_CPU_FLAG_ALTIVEC) {
diff --git a/gst-libs/ext/libav/libavcodec/ppc/h264_altivec_template.c b/gst-libs/ext/libav/libavcodec/ppc/h264_altivec_template.c
new file mode 100644
index 0000000..b445f92
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/ppc/h264_altivec_template.c
@@ -0,0 +1,775 @@
+/*
+ * Copyright (c) 2004 Romain Dolbeau <romain@dolbeau.org>
+ *
+ * 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
+ */
+
+#include "libavutil/mem.h"
+
+#ifdef DEBUG
+#define ASSERT_ALIGNED(ptr) assert(((unsigned long)ptr&0x0000000F));
+#else
+#define ASSERT_ALIGNED(ptr) ;
+#endif
+
+/* this code assume that stride % 16 == 0 */
+
+#define CHROMA_MC8_ALTIVEC_CORE(BIAS1, BIAS2) \
+ vsrc2ssH = (vec_s16)vec_mergeh(zero_u8v,(vec_u8)vsrc2uc);\
+ vsrc3ssH = (vec_s16)vec_mergeh(zero_u8v,(vec_u8)vsrc3uc);\
+\
+ psum = vec_mladd(vA, vsrc0ssH, BIAS1);\
+ psum = vec_mladd(vB, vsrc1ssH, psum);\
+ psum = vec_mladd(vC, vsrc2ssH, psum);\
+ psum = vec_mladd(vD, vsrc3ssH, psum);\
+ psum = BIAS2(psum);\
+ psum = vec_sr(psum, v6us);\
+\
+ vdst = vec_ld(0, dst);\
+ ppsum = (vec_u8)vec_pack(psum, psum);\
+ vfdst = vec_perm(vdst, ppsum, fperm);\
+\
+ OP_U8_ALTIVEC(fsum, vfdst, vdst);\
+\
+ vec_st(fsum, 0, dst);\
+\
+ vsrc0ssH = vsrc2ssH;\
+ vsrc1ssH = vsrc3ssH;\
+\
+ dst += stride;\
+ src += stride;
+
+#define CHROMA_MC8_ALTIVEC_CORE_SIMPLE \
+\
+ vsrc0ssH = (vec_s16)vec_mergeh(zero_u8v,(vec_u8)vsrc0uc);\
+ vsrc1ssH = (vec_s16)vec_mergeh(zero_u8v,(vec_u8)vsrc1uc);\
+\
+ psum = vec_mladd(vA, vsrc0ssH, v32ss);\
+ psum = vec_mladd(vE, vsrc1ssH, psum);\
+ psum = vec_sr(psum, v6us);\
+\
+ vdst = vec_ld(0, dst);\
+ ppsum = (vec_u8)vec_pack(psum, psum);\
+ vfdst = vec_perm(vdst, ppsum, fperm);\
+\
+ OP_U8_ALTIVEC(fsum, vfdst, vdst);\
+\
+ vec_st(fsum, 0, dst);\
+\
+ dst += stride;\
+ src += stride;
+
+#define noop(a) a
+#define add28(a) vec_add(v28ss, a)
+
+#ifdef PREFIX_h264_chroma_mc8_altivec
+static void PREFIX_h264_chroma_mc8_altivec(uint8_t * dst, uint8_t * src,
+ int stride, int h, int x, int y) {
+ DECLARE_ALIGNED(16, signed int, ABCD)[4] =
+ {((8 - x) * (8 - y)),
+ (( x) * (8 - y)),
+ ((8 - x) * ( y)),
+ (( x) * ( y))};
+ register int i;
+ vec_u8 fperm;
+ const vec_s32 vABCD = vec_ld(0, ABCD);
+ const vec_s16 vA = vec_splat((vec_s16)vABCD, 1);
+ const vec_s16 vB = vec_splat((vec_s16)vABCD, 3);
+ const vec_s16 vC = vec_splat((vec_s16)vABCD, 5);
+ const vec_s16 vD = vec_splat((vec_s16)vABCD, 7);
+ LOAD_ZERO;
+ const vec_s16 v32ss = vec_sl(vec_splat_s16(1),vec_splat_u16(5));
+ const vec_u16 v6us = vec_splat_u16(6);
+ register int loadSecond = (((unsigned long)src) % 16) <= 7 ? 0 : 1;
+ register int reallyBadAlign = (((unsigned long)src) % 16) == 15 ? 1 : 0;
+
+ vec_u8 vsrcAuc, av_uninit(vsrcBuc), vsrcperm0, vsrcperm1;
+ vec_u8 vsrc0uc, vsrc1uc;
+ vec_s16 vsrc0ssH, vsrc1ssH;
+ vec_u8 vsrcCuc, vsrc2uc, vsrc3uc;
+ vec_s16 vsrc2ssH, vsrc3ssH, psum;
+ vec_u8 vdst, ppsum, vfdst, fsum;
+
+ if (((unsigned long)dst) % 16 == 0) {
+ fperm = (vec_u8){0x10, 0x11, 0x12, 0x13,
+ 0x14, 0x15, 0x16, 0x17,
+ 0x08, 0x09, 0x0A, 0x0B,
+ 0x0C, 0x0D, 0x0E, 0x0F};
+ } else {
+ fperm = (vec_u8){0x00, 0x01, 0x02, 0x03,
+ 0x04, 0x05, 0x06, 0x07,
+ 0x18, 0x19, 0x1A, 0x1B,
+ 0x1C, 0x1D, 0x1E, 0x1F};
+ }
+
+ vsrcAuc = vec_ld(0, src);
+
+ if (loadSecond)
+ vsrcBuc = vec_ld(16, src);
+ vsrcperm0 = vec_lvsl(0, src);
+ vsrcperm1 = vec_lvsl(1, src);
+
+ vsrc0uc = vec_perm(vsrcAuc, vsrcBuc, vsrcperm0);
+ if (reallyBadAlign)
+ vsrc1uc = vsrcBuc;
+ else
+ vsrc1uc = vec_perm(vsrcAuc, vsrcBuc, vsrcperm1);
+
+ vsrc0ssH = (vec_s16)vec_mergeh(zero_u8v,(vec_u8)vsrc0uc);
+ vsrc1ssH = (vec_s16)vec_mergeh(zero_u8v,(vec_u8)vsrc1uc);
+
+ if (ABCD[3]) {
+ if (!loadSecond) {// -> !reallyBadAlign
+ for (i = 0 ; i < h ; i++) {
+ vsrcCuc = vec_ld(stride + 0, src);
+ vsrc2uc = vec_perm(vsrcCuc, vsrcCuc, vsrcperm0);
+ vsrc3uc = vec_perm(vsrcCuc, vsrcCuc, vsrcperm1);
+
+ CHROMA_MC8_ALTIVEC_CORE(v32ss, noop)
+ }
+ } else {
+ vec_u8 vsrcDuc;
+ for (i = 0 ; i < h ; i++) {
+ vsrcCuc = vec_ld(stride + 0, src);
+ vsrcDuc = vec_ld(stride + 16, src);
+ vsrc2uc = vec_perm(vsrcCuc, vsrcDuc, vsrcperm0);
+ if (reallyBadAlign)
+ vsrc3uc = vsrcDuc;
+ else
+ vsrc3uc = vec_perm(vsrcCuc, vsrcDuc, vsrcperm1);
+
+ CHROMA_MC8_ALTIVEC_CORE(v32ss, noop)
+ }
+ }
+ } else {
+ const vec_s16 vE = vec_add(vB, vC);
+ if (ABCD[2]) { // x == 0 B == 0
+ if (!loadSecond) {// -> !reallyBadAlign
+ for (i = 0 ; i < h ; i++) {
+ vsrcCuc = vec_ld(stride + 0, src);
+ vsrc1uc = vec_perm(vsrcCuc, vsrcCuc, vsrcperm0);
+ CHROMA_MC8_ALTIVEC_CORE_SIMPLE
+
+ vsrc0uc = vsrc1uc;
+ }
+ } else {
+ vec_u8 vsrcDuc;
+ for (i = 0 ; i < h ; i++) {
+ vsrcCuc = vec_ld(stride + 0, src);
+ vsrcDuc = vec_ld(stride + 15, src);
+ vsrc1uc = vec_perm(vsrcCuc, vsrcDuc, vsrcperm0);
+ CHROMA_MC8_ALTIVEC_CORE_SIMPLE
+
+ vsrc0uc = vsrc1uc;
+ }
+ }
+ } else { // y == 0 C == 0
+ if (!loadSecond) {// -> !reallyBadAlign
+ for (i = 0 ; i < h ; i++) {
+ vsrcCuc = vec_ld(0, src);
+ vsrc0uc = vec_perm(vsrcCuc, vsrcCuc, vsrcperm0);
+ vsrc1uc = vec_perm(vsrcCuc, vsrcCuc, vsrcperm1);
+
+ CHROMA_MC8_ALTIVEC_CORE_SIMPLE
+ }
+ } else {
+ vec_u8 vsrcDuc;
+ for (i = 0 ; i < h ; i++) {
+ vsrcCuc = vec_ld(0, src);
+ vsrcDuc = vec_ld(15, src);
+ vsrc0uc = vec_perm(vsrcCuc, vsrcDuc, vsrcperm0);
+ if (reallyBadAlign)
+ vsrc1uc = vsrcDuc;
+ else
+ vsrc1uc = vec_perm(vsrcCuc, vsrcDuc, vsrcperm1);
+
+ CHROMA_MC8_ALTIVEC_CORE_SIMPLE
+ }
+ }
+ }
+ }
+}
+#endif
+
+/* this code assume that stride % 16 == 0 */
+#ifdef PREFIX_no_rnd_vc1_chroma_mc8_altivec
+static void PREFIX_no_rnd_vc1_chroma_mc8_altivec(uint8_t * dst, uint8_t * src, int stride, int h, int x, int y) {
+ DECLARE_ALIGNED(16, signed int, ABCD)[4] =
+ {((8 - x) * (8 - y)),
+ (( x) * (8 - y)),
+ ((8 - x) * ( y)),
+ (( x) * ( y))};
+ register int i;
+ vec_u8 fperm;
+ const vec_s32 vABCD = vec_ld(0, ABCD);
+ const vec_s16 vA = vec_splat((vec_s16)vABCD, 1);
+ const vec_s16 vB = vec_splat((vec_s16)vABCD, 3);
+ const vec_s16 vC = vec_splat((vec_s16)vABCD, 5);
+ const vec_s16 vD = vec_splat((vec_s16)vABCD, 7);
+ LOAD_ZERO;
+ const vec_s16 v28ss = vec_sub(vec_sl(vec_splat_s16(1),vec_splat_u16(5)),vec_splat_s16(4));
+ const vec_u16 v6us = vec_splat_u16(6);
+ register int loadSecond = (((unsigned long)src) % 16) <= 7 ? 0 : 1;
+ register int reallyBadAlign = (((unsigned long)src) % 16) == 15 ? 1 : 0;
+
+ vec_u8 vsrcAuc, av_uninit(vsrcBuc), vsrcperm0, vsrcperm1;
+ vec_u8 vsrc0uc, vsrc1uc;
+ vec_s16 vsrc0ssH, vsrc1ssH;
+ vec_u8 vsrcCuc, vsrc2uc, vsrc3uc;
+ vec_s16 vsrc2ssH, vsrc3ssH, psum;
+ vec_u8 vdst, ppsum, vfdst, fsum;
+
+ if (((unsigned long)dst) % 16 == 0) {
+ fperm = (vec_u8){0x10, 0x11, 0x12, 0x13,
+ 0x14, 0x15, 0x16, 0x17,
+ 0x08, 0x09, 0x0A, 0x0B,
+ 0x0C, 0x0D, 0x0E, 0x0F};
+ } else {
+ fperm = (vec_u8){0x00, 0x01, 0x02, 0x03,
+ 0x04, 0x05, 0x06, 0x07,
+ 0x18, 0x19, 0x1A, 0x1B,
+ 0x1C, 0x1D, 0x1E, 0x1F};
+ }
+
+ vsrcAuc = vec_ld(0, src);
+
+ if (loadSecond)
+ vsrcBuc = vec_ld(16, src);
+ vsrcperm0 = vec_lvsl(0, src);
+ vsrcperm1 = vec_lvsl(1, src);
+
+ vsrc0uc = vec_perm(vsrcAuc, vsrcBuc, vsrcperm0);
+ if (reallyBadAlign)
+ vsrc1uc = vsrcBuc;
+ else
+ vsrc1uc = vec_perm(vsrcAuc, vsrcBuc, vsrcperm1);
+
+ vsrc0ssH = (vec_s16)vec_mergeh(zero_u8v, (vec_u8)vsrc0uc);
+ vsrc1ssH = (vec_s16)vec_mergeh(zero_u8v, (vec_u8)vsrc1uc);
+
+ if (!loadSecond) {// -> !reallyBadAlign
+ for (i = 0 ; i < h ; i++) {
+
+
+ vsrcCuc = vec_ld(stride + 0, src);
+
+ vsrc2uc = vec_perm(vsrcCuc, vsrcCuc, vsrcperm0);
+ vsrc3uc = vec_perm(vsrcCuc, vsrcCuc, vsrcperm1);
+
+ CHROMA_MC8_ALTIVEC_CORE(vec_splat_s16(0), add28)
+ }
+ } else {
+ vec_u8 vsrcDuc;
+ for (i = 0 ; i < h ; i++) {
+ vsrcCuc = vec_ld(stride + 0, src);
+ vsrcDuc = vec_ld(stride + 16, src);
+
+ vsrc2uc = vec_perm(vsrcCuc, vsrcDuc, vsrcperm0);
+ if (reallyBadAlign)
+ vsrc3uc = vsrcDuc;
+ else
+ vsrc3uc = vec_perm(vsrcCuc, vsrcDuc, vsrcperm1);
+
+ CHROMA_MC8_ALTIVEC_CORE(vec_splat_s16(0), add28)
+ }
+ }
+}
+#endif
+
+#undef noop
+#undef add28
+#undef CHROMA_MC8_ALTIVEC_CORE
+
+/* this code assume stride % 16 == 0 */
+#ifdef PREFIX_h264_qpel16_h_lowpass_altivec
+static void PREFIX_h264_qpel16_h_lowpass_altivec(uint8_t * dst, uint8_t * src, int dstStride, int srcStride) {
+ register int i;
+
+ LOAD_ZERO;
+ const vec_u8 permM2 = vec_lvsl(-2, src);
+ const vec_u8 permM1 = vec_lvsl(-1, src);
+ const vec_u8 permP0 = vec_lvsl(+0, src);
+ const vec_u8 permP1 = vec_lvsl(+1, src);
+ const vec_u8 permP2 = vec_lvsl(+2, src);
+ const vec_u8 permP3 = vec_lvsl(+3, src);
+ const vec_s16 v5ss = vec_splat_s16(5);
+ const vec_u16 v5us = vec_splat_u16(5);
+ const vec_s16 v20ss = vec_sl(vec_splat_s16(5),vec_splat_u16(2));
+ const vec_s16 v16ss = vec_sl(vec_splat_s16(1),vec_splat_u16(4));
+
+ vec_u8 srcM2, srcM1, srcP0, srcP1, srcP2, srcP3;
+
+ register int align = ((((unsigned long)src) - 2) % 16);
+
+ vec_s16 srcP0A, srcP0B, srcP1A, srcP1B,
+ srcP2A, srcP2B, srcP3A, srcP3B,
+ srcM1A, srcM1B, srcM2A, srcM2B,
+ sum1A, sum1B, sum2A, sum2B, sum3A, sum3B,
+ pp1A, pp1B, pp2A, pp2B, pp3A, pp3B,
+ psumA, psumB, sumA, sumB;
+
+ vec_u8 sum, fsum;
+
+ for (i = 0 ; i < 16 ; i ++) {
+ vec_u8 srcR1 = vec_ld(-2, src);
+ vec_u8 srcR2 = vec_ld(14, src);
+
+ switch (align) {
+ default: {
+ srcM2 = vec_perm(srcR1, srcR2, permM2);
+ srcM1 = vec_perm(srcR1, srcR2, permM1);
+ srcP0 = vec_perm(srcR1, srcR2, permP0);
+ srcP1 = vec_perm(srcR1, srcR2, permP1);
+ srcP2 = vec_perm(srcR1, srcR2, permP2);
+ srcP3 = vec_perm(srcR1, srcR2, permP3);
+ } break;
+ case 11: {
+ srcM2 = vec_perm(srcR1, srcR2, permM2);
+ srcM1 = vec_perm(srcR1, srcR2, permM1);
+ srcP0 = vec_perm(srcR1, srcR2, permP0);
+ srcP1 = vec_perm(srcR1, srcR2, permP1);
+ srcP2 = vec_perm(srcR1, srcR2, permP2);
+ srcP3 = srcR2;
+ } break;
+ case 12: {
+ vec_u8 srcR3 = vec_ld(30, src);
+ srcM2 = vec_perm(srcR1, srcR2, permM2);
+ srcM1 = vec_perm(srcR1, srcR2, permM1);
+ srcP0 = vec_perm(srcR1, srcR2, permP0);
+ srcP1 = vec_perm(srcR1, srcR2, permP1);
+ srcP2 = srcR2;
+ srcP3 = vec_perm(srcR2, srcR3, permP3);
+ } break;
+ case 13: {
+ vec_u8 srcR3 = vec_ld(30, src);
+ srcM2 = vec_perm(srcR1, srcR2, permM2);
+ srcM1 = vec_perm(srcR1, srcR2, permM1);
+ srcP0 = vec_perm(srcR1, srcR2, permP0);
+ srcP1 = srcR2;
+ srcP2 = vec_perm(srcR2, srcR3, permP2);
+ srcP3 = vec_perm(srcR2, srcR3, permP3);
+ } break;
+ case 14: {
+ vec_u8 srcR3 = vec_ld(30, src);
+ srcM2 = vec_perm(srcR1, srcR2, permM2);
+ srcM1 = vec_perm(srcR1, srcR2, permM1);
+ srcP0 = srcR2;
+ srcP1 = vec_perm(srcR2, srcR3, permP1);
+ srcP2 = vec_perm(srcR2, srcR3, permP2);
+ srcP3 = vec_perm(srcR2, srcR3, permP3);
+ } break;
+ case 15: {
+ vec_u8 srcR3 = vec_ld(30, src);
+ srcM2 = vec_perm(srcR1, srcR2, permM2);
+ srcM1 = srcR2;
+ srcP0 = vec_perm(srcR2, srcR3, permP0);
+ srcP1 = vec_perm(srcR2, srcR3, permP1);
+ srcP2 = vec_perm(srcR2, srcR3, permP2);
+ srcP3 = vec_perm(srcR2, srcR3, permP3);
+ } break;
+ }
+
+ srcP0A = (vec_s16) vec_mergeh(zero_u8v, srcP0);
+ srcP0B = (vec_s16) vec_mergel(zero_u8v, srcP0);
+ srcP1A = (vec_s16) vec_mergeh(zero_u8v, srcP1);
+ srcP1B = (vec_s16) vec_mergel(zero_u8v, srcP1);
+
+ srcP2A = (vec_s16) vec_mergeh(zero_u8v, srcP2);
+ srcP2B = (vec_s16) vec_mergel(zero_u8v, srcP2);
+ srcP3A = (vec_s16) vec_mergeh(zero_u8v, srcP3);
+ srcP3B = (vec_s16) vec_mergel(zero_u8v, srcP3);
+
+ srcM1A = (vec_s16) vec_mergeh(zero_u8v, srcM1);
+ srcM1B = (vec_s16) vec_mergel(zero_u8v, srcM1);
+ srcM2A = (vec_s16) vec_mergeh(zero_u8v, srcM2);
+ srcM2B = (vec_s16) vec_mergel(zero_u8v, srcM2);
+
+ sum1A = vec_adds(srcP0A, srcP1A);
+ sum1B = vec_adds(srcP0B, srcP1B);
+ sum2A = vec_adds(srcM1A, srcP2A);
+ sum2B = vec_adds(srcM1B, srcP2B);
+ sum3A = vec_adds(srcM2A, srcP3A);
+ sum3B = vec_adds(srcM2B, srcP3B);
+
+ pp1A = vec_mladd(sum1A, v20ss, v16ss);
+ pp1B = vec_mladd(sum1B, v20ss, v16ss);
+
+ pp2A = vec_mladd(sum2A, v5ss, zero_s16v);
+ pp2B = vec_mladd(sum2B, v5ss, zero_s16v);
+
+ pp3A = vec_add(sum3A, pp1A);
+ pp3B = vec_add(sum3B, pp1B);
+
+ psumA = vec_sub(pp3A, pp2A);
+ psumB = vec_sub(pp3B, pp2B);
+
+ sumA = vec_sra(psumA, v5us);
+ sumB = vec_sra(psumB, v5us);
+
+ sum = vec_packsu(sumA, sumB);
+
+ ASSERT_ALIGNED(dst);
+
+ OP_U8_ALTIVEC(fsum, sum, vec_ld(0, dst));
+
+ vec_st(fsum, 0, dst);
+
+ src += srcStride;
+ dst += dstStride;
+ }
+}
+#endif
+
+/* this code assume stride % 16 == 0 */
+#ifdef PREFIX_h264_qpel16_v_lowpass_altivec
+static void PREFIX_h264_qpel16_v_lowpass_altivec(uint8_t * dst, uint8_t * src, int dstStride, int srcStride) {
+ register int i;
+
+ LOAD_ZERO;
+ const vec_u8 perm = vec_lvsl(0, src);
+ const vec_s16 v20ss = vec_sl(vec_splat_s16(5),vec_splat_u16(2));
+ const vec_u16 v5us = vec_splat_u16(5);
+ const vec_s16 v5ss = vec_splat_s16(5);
+ const vec_s16 v16ss = vec_sl(vec_splat_s16(1),vec_splat_u16(4));
+
+ uint8_t *srcbis = src - (srcStride * 2);
+
+ const vec_u8 srcM2a = vec_ld(0, srcbis);
+ const vec_u8 srcM2b = vec_ld(16, srcbis);
+ const vec_u8 srcM2 = vec_perm(srcM2a, srcM2b, perm);
+ //srcbis += srcStride;
+ const vec_u8 srcM1a = vec_ld(0, srcbis += srcStride);
+ const vec_u8 srcM1b = vec_ld(16, srcbis);
+ const vec_u8 srcM1 = vec_perm(srcM1a, srcM1b, perm);
+ //srcbis += srcStride;
+ const vec_u8 srcP0a = vec_ld(0, srcbis += srcStride);
+ const vec_u8 srcP0b = vec_ld(16, srcbis);
+ const vec_u8 srcP0 = vec_perm(srcP0a, srcP0b, perm);
+ //srcbis += srcStride;
+ const vec_u8 srcP1a = vec_ld(0, srcbis += srcStride);
+ const vec_u8 srcP1b = vec_ld(16, srcbis);
+ const vec_u8 srcP1 = vec_perm(srcP1a, srcP1b, perm);
+ //srcbis += srcStride;
+ const vec_u8 srcP2a = vec_ld(0, srcbis += srcStride);
+ const vec_u8 srcP2b = vec_ld(16, srcbis);
+ const vec_u8 srcP2 = vec_perm(srcP2a, srcP2b, perm);
+ //srcbis += srcStride;
+
+ vec_s16 srcM2ssA = (vec_s16) vec_mergeh(zero_u8v, srcM2);
+ vec_s16 srcM2ssB = (vec_s16) vec_mergel(zero_u8v, srcM2);
+ vec_s16 srcM1ssA = (vec_s16) vec_mergeh(zero_u8v, srcM1);
+ vec_s16 srcM1ssB = (vec_s16) vec_mergel(zero_u8v, srcM1);
+ vec_s16 srcP0ssA = (vec_s16) vec_mergeh(zero_u8v, srcP0);
+ vec_s16 srcP0ssB = (vec_s16) vec_mergel(zero_u8v, srcP0);
+ vec_s16 srcP1ssA = (vec_s16) vec_mergeh(zero_u8v, srcP1);
+ vec_s16 srcP1ssB = (vec_s16) vec_mergel(zero_u8v, srcP1);
+ vec_s16 srcP2ssA = (vec_s16) vec_mergeh(zero_u8v, srcP2);
+ vec_s16 srcP2ssB = (vec_s16) vec_mergel(zero_u8v, srcP2);
+
+ vec_s16 pp1A, pp1B, pp2A, pp2B, pp3A, pp3B,
+ psumA, psumB, sumA, sumB,
+ srcP3ssA, srcP3ssB,
+ sum1A, sum1B, sum2A, sum2B, sum3A, sum3B;
+
+ vec_u8 sum, fsum, srcP3a, srcP3b, srcP3;
+
+ for (i = 0 ; i < 16 ; i++) {
+ srcP3a = vec_ld(0, srcbis += srcStride);
+ srcP3b = vec_ld(16, srcbis);
+ srcP3 = vec_perm(srcP3a, srcP3b, perm);
+ srcP3ssA = (vec_s16) vec_mergeh(zero_u8v, srcP3);
+ srcP3ssB = (vec_s16) vec_mergel(zero_u8v, srcP3);
+ //srcbis += srcStride;
+
+ sum1A = vec_adds(srcP0ssA, srcP1ssA);
+ sum1B = vec_adds(srcP0ssB, srcP1ssB);
+ sum2A = vec_adds(srcM1ssA, srcP2ssA);
+ sum2B = vec_adds(srcM1ssB, srcP2ssB);
+ sum3A = vec_adds(srcM2ssA, srcP3ssA);
+ sum3B = vec_adds(srcM2ssB, srcP3ssB);
+
+ srcM2ssA = srcM1ssA;
+ srcM2ssB = srcM1ssB;
+ srcM1ssA = srcP0ssA;
+ srcM1ssB = srcP0ssB;
+ srcP0ssA = srcP1ssA;
+ srcP0ssB = srcP1ssB;
+ srcP1ssA = srcP2ssA;
+ srcP1ssB = srcP2ssB;
+ srcP2ssA = srcP3ssA;
+ srcP2ssB = srcP3ssB;
+
+ pp1A = vec_mladd(sum1A, v20ss, v16ss);
+ pp1B = vec_mladd(sum1B, v20ss, v16ss);
+
+ pp2A = vec_mladd(sum2A, v5ss, zero_s16v);
+ pp2B = vec_mladd(sum2B, v5ss, zero_s16v);
+
+ pp3A = vec_add(sum3A, pp1A);
+ pp3B = vec_add(sum3B, pp1B);
+
+ psumA = vec_sub(pp3A, pp2A);
+ psumB = vec_sub(pp3B, pp2B);
+
+ sumA = vec_sra(psumA, v5us);
+ sumB = vec_sra(psumB, v5us);
+
+ sum = vec_packsu(sumA, sumB);
+
+ ASSERT_ALIGNED(dst);
+
+ OP_U8_ALTIVEC(fsum, sum, vec_ld(0, dst));
+
+ vec_st(fsum, 0, dst);
+
+ dst += dstStride;
+ }
+}
+#endif
+
+/* this code assume stride % 16 == 0 *and* tmp is properly aligned */
+#ifdef PREFIX_h264_qpel16_hv_lowpass_altivec
+static void PREFIX_h264_qpel16_hv_lowpass_altivec(uint8_t * dst, int16_t * tmp, uint8_t * src, int dstStride, int tmpStride, int srcStride) {
+ register int i;
+ LOAD_ZERO;
+ const vec_u8 permM2 = vec_lvsl(-2, src);
+ const vec_u8 permM1 = vec_lvsl(-1, src);
+ const vec_u8 permP0 = vec_lvsl(+0, src);
+ const vec_u8 permP1 = vec_lvsl(+1, src);
+ const vec_u8 permP2 = vec_lvsl(+2, src);
+ const vec_u8 permP3 = vec_lvsl(+3, src);
+ const vec_s16 v20ss = vec_sl(vec_splat_s16(5),vec_splat_u16(2));
+ const vec_u32 v10ui = vec_splat_u32(10);
+ const vec_s16 v5ss = vec_splat_s16(5);
+ const vec_s16 v1ss = vec_splat_s16(1);
+ const vec_s32 v512si = vec_sl(vec_splat_s32(1),vec_splat_u32(9));
+ const vec_u32 v16ui = vec_sl(vec_splat_u32(1),vec_splat_u32(4));
+
+ register int align = ((((unsigned long)src) - 2) % 16);
+
+ vec_s16 srcP0A, srcP0B, srcP1A, srcP1B,
+ srcP2A, srcP2B, srcP3A, srcP3B,
+ srcM1A, srcM1B, srcM2A, srcM2B,
+ sum1A, sum1B, sum2A, sum2B, sum3A, sum3B,
+ pp1A, pp1B, pp2A, pp2B, psumA, psumB;
+
+ const vec_u8 mperm = (const vec_u8)
+ {0x00, 0x08, 0x01, 0x09, 0x02, 0x0A, 0x03, 0x0B,
+ 0x04, 0x0C, 0x05, 0x0D, 0x06, 0x0E, 0x07, 0x0F};
+ int16_t *tmpbis = tmp;
+
+ vec_s16 tmpM1ssA, tmpM1ssB, tmpM2ssA, tmpM2ssB,
+ tmpP0ssA, tmpP0ssB, tmpP1ssA, tmpP1ssB,
+ tmpP2ssA, tmpP2ssB;
+
+ vec_s32 pp1Ae, pp1Ao, pp1Be, pp1Bo, pp2Ae, pp2Ao, pp2Be, pp2Bo,
+ pp3Ae, pp3Ao, pp3Be, pp3Bo, pp1cAe, pp1cAo, pp1cBe, pp1cBo,
+ pp32Ae, pp32Ao, pp32Be, pp32Bo, sumAe, sumAo, sumBe, sumBo,
+ ssumAe, ssumAo, ssumBe, ssumBo;
+ vec_u8 fsum, sumv, sum;
+ vec_s16 ssume, ssumo;
+
+ src -= (2 * srcStride);
+ for (i = 0 ; i < 21 ; i ++) {
+ vec_u8 srcM2, srcM1, srcP0, srcP1, srcP2, srcP3;
+ vec_u8 srcR1 = vec_ld(-2, src);
+ vec_u8 srcR2 = vec_ld(14, src);
+
+ switch (align) {
+ default: {
+ srcM2 = vec_perm(srcR1, srcR2, permM2);
+ srcM1 = vec_perm(srcR1, srcR2, permM1);
+ srcP0 = vec_perm(srcR1, srcR2, permP0);
+ srcP1 = vec_perm(srcR1, srcR2, permP1);
+ srcP2 = vec_perm(srcR1, srcR2, permP2);
+ srcP3 = vec_perm(srcR1, srcR2, permP3);
+ } break;
+ case 11: {
+ srcM2 = vec_perm(srcR1, srcR2, permM2);
+ srcM1 = vec_perm(srcR1, srcR2, permM1);
+ srcP0 = vec_perm(srcR1, srcR2, permP0);
+ srcP1 = vec_perm(srcR1, srcR2, permP1);
+ srcP2 = vec_perm(srcR1, srcR2, permP2);
+ srcP3 = srcR2;
+ } break;
+ case 12: {
+ vec_u8 srcR3 = vec_ld(30, src);
+ srcM2 = vec_perm(srcR1, srcR2, permM2);
+ srcM1 = vec_perm(srcR1, srcR2, permM1);
+ srcP0 = vec_perm(srcR1, srcR2, permP0);
+ srcP1 = vec_perm(srcR1, srcR2, permP1);
+ srcP2 = srcR2;
+ srcP3 = vec_perm(srcR2, srcR3, permP3);
+ } break;
+ case 13: {
+ vec_u8 srcR3 = vec_ld(30, src);
+ srcM2 = vec_perm(srcR1, srcR2, permM2);
+ srcM1 = vec_perm(srcR1, srcR2, permM1);
+ srcP0 = vec_perm(srcR1, srcR2, permP0);
+ srcP1 = srcR2;
+ srcP2 = vec_perm(srcR2, srcR3, permP2);
+ srcP3 = vec_perm(srcR2, srcR3, permP3);
+ } break;
+ case 14: {
+ vec_u8 srcR3 = vec_ld(30, src);
+ srcM2 = vec_perm(srcR1, srcR2, permM2);
+ srcM1 = vec_perm(srcR1, srcR2, permM1);
+ srcP0 = srcR2;
+ srcP1 = vec_perm(srcR2, srcR3, permP1);
+ srcP2 = vec_perm(srcR2, srcR3, permP2);
+ srcP3 = vec_perm(srcR2, srcR3, permP3);
+ } break;
+ case 15: {
+ vec_u8 srcR3 = vec_ld(30, src);
+ srcM2 = vec_perm(srcR1, srcR2, permM2);
+ srcM1 = srcR2;
+ srcP0 = vec_perm(srcR2, srcR3, permP0);
+ srcP1 = vec_perm(srcR2, srcR3, permP1);
+ srcP2 = vec_perm(srcR2, srcR3, permP2);
+ srcP3 = vec_perm(srcR2, srcR3, permP3);
+ } break;
+ }
+
+ srcP0A = (vec_s16) vec_mergeh(zero_u8v, srcP0);
+ srcP0B = (vec_s16) vec_mergel(zero_u8v, srcP0);
+ srcP1A = (vec_s16) vec_mergeh(zero_u8v, srcP1);
+ srcP1B = (vec_s16) vec_mergel(zero_u8v, srcP1);
+
+ srcP2A = (vec_s16) vec_mergeh(zero_u8v, srcP2);
+ srcP2B = (vec_s16) vec_mergel(zero_u8v, srcP2);
+ srcP3A = (vec_s16) vec_mergeh(zero_u8v, srcP3);
+ srcP3B = (vec_s16) vec_mergel(zero_u8v, srcP3);
+
+ srcM1A = (vec_s16) vec_mergeh(zero_u8v, srcM1);
+ srcM1B = (vec_s16) vec_mergel(zero_u8v, srcM1);
+ srcM2A = (vec_s16) vec_mergeh(zero_u8v, srcM2);
+ srcM2B = (vec_s16) vec_mergel(zero_u8v, srcM2);
+
+ sum1A = vec_adds(srcP0A, srcP1A);
+ sum1B = vec_adds(srcP0B, srcP1B);
+ sum2A = vec_adds(srcM1A, srcP2A);
+ sum2B = vec_adds(srcM1B, srcP2B);
+ sum3A = vec_adds(srcM2A, srcP3A);
+ sum3B = vec_adds(srcM2B, srcP3B);
+
+ pp1A = vec_mladd(sum1A, v20ss, sum3A);
+ pp1B = vec_mladd(sum1B, v20ss, sum3B);
+
+ pp2A = vec_mladd(sum2A, v5ss, zero_s16v);
+ pp2B = vec_mladd(sum2B, v5ss, zero_s16v);
+
+ psumA = vec_sub(pp1A, pp2A);
+ psumB = vec_sub(pp1B, pp2B);
+
+ vec_st(psumA, 0, tmp);
+ vec_st(psumB, 16, tmp);
+
+ src += srcStride;
+ tmp += tmpStride; /* int16_t*, and stride is 16, so it's OK here */
+ }
+
+ tmpM2ssA = vec_ld(0, tmpbis);
+ tmpM2ssB = vec_ld(16, tmpbis);
+ tmpbis += tmpStride;
+ tmpM1ssA = vec_ld(0, tmpbis);
+ tmpM1ssB = vec_ld(16, tmpbis);
+ tmpbis += tmpStride;
+ tmpP0ssA = vec_ld(0, tmpbis);
+ tmpP0ssB = vec_ld(16, tmpbis);
+ tmpbis += tmpStride;
+ tmpP1ssA = vec_ld(0, tmpbis);
+ tmpP1ssB = vec_ld(16, tmpbis);
+ tmpbis += tmpStride;
+ tmpP2ssA = vec_ld(0, tmpbis);
+ tmpP2ssB = vec_ld(16, tmpbis);
+ tmpbis += tmpStride;
+
+ for (i = 0 ; i < 16 ; i++) {
+ const vec_s16 tmpP3ssA = vec_ld(0, tmpbis);
+ const vec_s16 tmpP3ssB = vec_ld(16, tmpbis);
+
+ const vec_s16 sum1A = vec_adds(tmpP0ssA, tmpP1ssA);
+ const vec_s16 sum1B = vec_adds(tmpP0ssB, tmpP1ssB);
+ const vec_s16 sum2A = vec_adds(tmpM1ssA, tmpP2ssA);
+ const vec_s16 sum2B = vec_adds(tmpM1ssB, tmpP2ssB);
+ const vec_s16 sum3A = vec_adds(tmpM2ssA, tmpP3ssA);
+ const vec_s16 sum3B = vec_adds(tmpM2ssB, tmpP3ssB);
+
+ tmpbis += tmpStride;
+
+ tmpM2ssA = tmpM1ssA;
+ tmpM2ssB = tmpM1ssB;
+ tmpM1ssA = tmpP0ssA;
+ tmpM1ssB = tmpP0ssB;
+ tmpP0ssA = tmpP1ssA;
+ tmpP0ssB = tmpP1ssB;
+ tmpP1ssA = tmpP2ssA;
+ tmpP1ssB = tmpP2ssB;
+ tmpP2ssA = tmpP3ssA;
+ tmpP2ssB = tmpP3ssB;
+
+ pp1Ae = vec_mule(sum1A, v20ss);
+ pp1Ao = vec_mulo(sum1A, v20ss);
+ pp1Be = vec_mule(sum1B, v20ss);
+ pp1Bo = vec_mulo(sum1B, v20ss);
+
+ pp2Ae = vec_mule(sum2A, v5ss);
+ pp2Ao = vec_mulo(sum2A, v5ss);
+ pp2Be = vec_mule(sum2B, v5ss);
+ pp2Bo = vec_mulo(sum2B, v5ss);
+
+ pp3Ae = vec_sra((vec_s32)sum3A, v16ui);
+ pp3Ao = vec_mulo(sum3A, v1ss);
+ pp3Be = vec_sra((vec_s32)sum3B, v16ui);
+ pp3Bo = vec_mulo(sum3B, v1ss);
+
+ pp1cAe = vec_add(pp1Ae, v512si);
+ pp1cAo = vec_add(pp1Ao, v512si);
+ pp1cBe = vec_add(pp1Be, v512si);
+ pp1cBo = vec_add(pp1Bo, v512si);
+
+ pp32Ae = vec_sub(pp3Ae, pp2Ae);
+ pp32Ao = vec_sub(pp3Ao, pp2Ao);
+ pp32Be = vec_sub(pp3Be, pp2Be);
+ pp32Bo = vec_sub(pp3Bo, pp2Bo);
+
+ sumAe = vec_add(pp1cAe, pp32Ae);
+ sumAo = vec_add(pp1cAo, pp32Ao);
+ sumBe = vec_add(pp1cBe, pp32Be);
+ sumBo = vec_add(pp1cBo, pp32Bo);
+
+ ssumAe = vec_sra(sumAe, v10ui);
+ ssumAo = vec_sra(sumAo, v10ui);
+ ssumBe = vec_sra(sumBe, v10ui);
+ ssumBo = vec_sra(sumBo, v10ui);
+
+ ssume = vec_packs(ssumAe, ssumBe);
+ ssumo = vec_packs(ssumAo, ssumBo);
+
+ sumv = vec_packsu(ssume, ssumo);
+ sum = vec_perm(sumv, sumv, mperm);
+
+ ASSERT_ALIGNED(dst);
+
+ OP_U8_ALTIVEC(fsum, sum, vec_ld(0, dst));
+
+ vec_st(fsum, 0, dst);
+
+ dst += dstStride;
+ }
+}
+#endif
diff --git a/gst-libs/ext/libav/libavcodec/ppc/h264_template_altivec.c b/gst-libs/ext/libav/libavcodec/ppc/h264_template_altivec.c
deleted file mode 100644
index 2a8f4bf..0000000
--- a/gst-libs/ext/libav/libavcodec/ppc/h264_template_altivec.c
+++ /dev/null
@@ -1,776 +0,0 @@
-/*
- * Copyright (c) 2004 Romain Dolbeau <romain@dolbeau.org>
- *
- * 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
- */
-
-#ifdef DEBUG
-#define ASSERT_ALIGNED(ptr) assert(((unsigned long)ptr&0x0000000F));
-#else
-#define ASSERT_ALIGNED(ptr) ;
-#endif
-
-/* this code assume that stride % 16 == 0 */
-
-#define CHROMA_MC8_ALTIVEC_CORE(BIAS1, BIAS2) \
- vsrc2ssH = (vec_s16)vec_mergeh(zero_u8v,(vec_u8)vsrc2uc);\
- vsrc3ssH = (vec_s16)vec_mergeh(zero_u8v,(vec_u8)vsrc3uc);\
-\
- psum = vec_mladd(vA, vsrc0ssH, BIAS1);\
- psum = vec_mladd(vB, vsrc1ssH, psum);\
- psum = vec_mladd(vC, vsrc2ssH, psum);\
- psum = vec_mladd(vD, vsrc3ssH, psum);\
- psum = BIAS2(psum);\
- psum = vec_sr(psum, v6us);\
-\
- vdst = vec_ld(0, dst);\
- ppsum = (vec_u8)vec_pack(psum, psum);\
- vfdst = vec_perm(vdst, ppsum, fperm);\
-\
- OP_U8_ALTIVEC(fsum, vfdst, vdst);\
-\
- vec_st(fsum, 0, dst);\
-\
- vsrc0ssH = vsrc2ssH;\
- vsrc1ssH = vsrc3ssH;\
-\
- dst += stride;\
- src += stride;
-
-#define CHROMA_MC8_ALTIVEC_CORE_SIMPLE \
-\
- vsrc0ssH = (vec_s16)vec_mergeh(zero_u8v,(vec_u8)vsrc0uc);\
- vsrc1ssH = (vec_s16)vec_mergeh(zero_u8v,(vec_u8)vsrc1uc);\
-\
- psum = vec_mladd(vA, vsrc0ssH, v32ss);\
- psum = vec_mladd(vE, vsrc1ssH, psum);\
- psum = vec_sr(psum, v6us);\
-\
- vdst = vec_ld(0, dst);\
- ppsum = (vec_u8)vec_pack(psum, psum);\
- vfdst = vec_perm(vdst, ppsum, fperm);\
-\
- OP_U8_ALTIVEC(fsum, vfdst, vdst);\
-\
- vec_st(fsum, 0, dst);\
-\
- dst += stride;\
- src += stride;
-
-#define noop(a) a
-#define add28(a) vec_add(v28ss, a)
-
-#ifdef PREFIX_h264_chroma_mc8_altivec
-static void PREFIX_h264_chroma_mc8_altivec(uint8_t * dst, uint8_t * src,
- int stride, int h, int x, int y) {
- DECLARE_ALIGNED(16, signed int, ABCD)[4] =
- {((8 - x) * (8 - y)),
- (( x) * (8 - y)),
- ((8 - x) * ( y)),
- (( x) * ( y))};
- register int i;
- vec_u8 fperm;
- const vec_s32 vABCD = vec_ld(0, ABCD);
- const vec_s16 vA = vec_splat((vec_s16)vABCD, 1);
- const vec_s16 vB = vec_splat((vec_s16)vABCD, 3);
- const vec_s16 vC = vec_splat((vec_s16)vABCD, 5);
- const vec_s16 vD = vec_splat((vec_s16)vABCD, 7);
- LOAD_ZERO;
- const vec_s16 v32ss = vec_sl(vec_splat_s16(1),vec_splat_u16(5));
- const vec_u16 v6us = vec_splat_u16(6);
- register int loadSecond = (((unsigned long)src) % 16) <= 7 ? 0 : 1;
- register int reallyBadAlign = (((unsigned long)src) % 16) == 15 ? 1 : 0;
-
- vec_u8 vsrcAuc, av_uninit(vsrcBuc), vsrcperm0, vsrcperm1;
- vec_u8 vsrc0uc, vsrc1uc;
- vec_s16 vsrc0ssH, vsrc1ssH;
- vec_u8 vsrcCuc, vsrc2uc, vsrc3uc;
- vec_s16 vsrc2ssH, vsrc3ssH, psum;
- vec_u8 vdst, ppsum, vfdst, fsum;
-
- if (((unsigned long)dst) % 16 == 0) {
- fperm = (vec_u8){0x10, 0x11, 0x12, 0x13,
- 0x14, 0x15, 0x16, 0x17,
- 0x08, 0x09, 0x0A, 0x0B,
- 0x0C, 0x0D, 0x0E, 0x0F};
- } else {
- fperm = (vec_u8){0x00, 0x01, 0x02, 0x03,
- 0x04, 0x05, 0x06, 0x07,
- 0x18, 0x19, 0x1A, 0x1B,
- 0x1C, 0x1D, 0x1E, 0x1F};
- }
-
- vsrcAuc = vec_ld(0, src);
-
- if (loadSecond)
- vsrcBuc = vec_ld(16, src);
- vsrcperm0 = vec_lvsl(0, src);
- vsrcperm1 = vec_lvsl(1, src);
-
- vsrc0uc = vec_perm(vsrcAuc, vsrcBuc, vsrcperm0);
- if (reallyBadAlign)
- vsrc1uc = vsrcBuc;
- else
- vsrc1uc = vec_perm(vsrcAuc, vsrcBuc, vsrcperm1);
-
- vsrc0ssH = (vec_s16)vec_mergeh(zero_u8v,(vec_u8)vsrc0uc);
- vsrc1ssH = (vec_s16)vec_mergeh(zero_u8v,(vec_u8)vsrc1uc);
-
- if (ABCD[3]) {
- if (!loadSecond) {// -> !reallyBadAlign
- for (i = 0 ; i < h ; i++) {
- vsrcCuc = vec_ld(stride + 0, src);
- vsrc2uc = vec_perm(vsrcCuc, vsrcCuc, vsrcperm0);
- vsrc3uc = vec_perm(vsrcCuc, vsrcCuc, vsrcperm1);
-
- CHROMA_MC8_ALTIVEC_CORE(v32ss, noop)
- }
- } else {
- vec_u8 vsrcDuc;
- for (i = 0 ; i < h ; i++) {
- vsrcCuc = vec_ld(stride + 0, src);
- vsrcDuc = vec_ld(stride + 16, src);
- vsrc2uc = vec_perm(vsrcCuc, vsrcDuc, vsrcperm0);
- if (reallyBadAlign)
- vsrc3uc = vsrcDuc;
- else
- vsrc3uc = vec_perm(vsrcCuc, vsrcDuc, vsrcperm1);
-
- CHROMA_MC8_ALTIVEC_CORE(v32ss, noop)
- }
- }
- } else {
- const vec_s16 vE = vec_add(vB, vC);
- if (ABCD[2]) { // x == 0 B == 0
- if (!loadSecond) {// -> !reallyBadAlign
- for (i = 0 ; i < h ; i++) {
- vsrcCuc = vec_ld(stride + 0, src);
- vsrc1uc = vec_perm(vsrcCuc, vsrcCuc, vsrcperm0);
- CHROMA_MC8_ALTIVEC_CORE_SIMPLE
-
- vsrc0uc = vsrc1uc;
- }
- } else {
- vec_u8 vsrcDuc;
- for (i = 0 ; i < h ; i++) {
- vsrcCuc = vec_ld(stride + 0, src);
- vsrcDuc = vec_ld(stride + 15, src);
- vsrc1uc = vec_perm(vsrcCuc, vsrcDuc, vsrcperm0);
- CHROMA_MC8_ALTIVEC_CORE_SIMPLE
-
- vsrc0uc = vsrc1uc;
- }
- }
- } else { // y == 0 C == 0
- if (!loadSecond) {// -> !reallyBadAlign
- for (i = 0 ; i < h ; i++) {
- vsrcCuc = vec_ld(0, src);
- vsrc0uc = vec_perm(vsrcCuc, vsrcCuc, vsrcperm0);
- vsrc1uc = vec_perm(vsrcCuc, vsrcCuc, vsrcperm1);
-
- CHROMA_MC8_ALTIVEC_CORE_SIMPLE
- }
- } else {
- vec_u8 vsrcDuc;
- for (i = 0 ; i < h ; i++) {
- vsrcCuc = vec_ld(0, src);
- vsrcDuc = vec_ld(15, src);
- vsrc0uc = vec_perm(vsrcCuc, vsrcDuc, vsrcperm0);
- if (reallyBadAlign)
- vsrc1uc = vsrcDuc;
- else
- vsrc1uc = vec_perm(vsrcCuc, vsrcDuc, vsrcperm1);
-
- CHROMA_MC8_ALTIVEC_CORE_SIMPLE
- }
- }
- }
- }
-}
-#endif
-
-/* this code assume that stride % 16 == 0 */
-#ifdef PREFIX_no_rnd_vc1_chroma_mc8_altivec
-static void PREFIX_no_rnd_vc1_chroma_mc8_altivec(uint8_t * dst, uint8_t * src, int stride, int h, int x, int y) {
- DECLARE_ALIGNED(16, signed int, ABCD)[4] =
- {((8 - x) * (8 - y)),
- (( x) * (8 - y)),
- ((8 - x) * ( y)),
- (( x) * ( y))};
- register int i;
- vec_u8 fperm;
- const vec_s32 vABCD = vec_ld(0, ABCD);
- const vec_s16 vA = vec_splat((vec_s16)vABCD, 1);
- const vec_s16 vB = vec_splat((vec_s16)vABCD, 3);
- const vec_s16 vC = vec_splat((vec_s16)vABCD, 5);
- const vec_s16 vD = vec_splat((vec_s16)vABCD, 7);
- LOAD_ZERO;
- const vec_s16 v28ss = vec_sub(vec_sl(vec_splat_s16(1),vec_splat_u16(5)),vec_splat_s16(4));
- const vec_u16 v6us = vec_splat_u16(6);
- register int loadSecond = (((unsigned long)src) % 16) <= 7 ? 0 : 1;
- register int reallyBadAlign = (((unsigned long)src) % 16) == 15 ? 1 : 0;
-
- vec_u8 vsrcAuc, av_uninit(vsrcBuc), vsrcperm0, vsrcperm1;
- vec_u8 vsrc0uc, vsrc1uc;
- vec_s16 vsrc0ssH, vsrc1ssH;
- vec_u8 vsrcCuc, vsrc2uc, vsrc3uc;
- vec_s16 vsrc2ssH, vsrc3ssH, psum;
- vec_u8 vdst, ppsum, vfdst, fsum;
-
- if (((unsigned long)dst) % 16 == 0) {
- fperm = (vec_u8){0x10, 0x11, 0x12, 0x13,
- 0x14, 0x15, 0x16, 0x17,
- 0x08, 0x09, 0x0A, 0x0B,
- 0x0C, 0x0D, 0x0E, 0x0F};
- } else {
- fperm = (vec_u8){0x00, 0x01, 0x02, 0x03,
- 0x04, 0x05, 0x06, 0x07,
- 0x18, 0x19, 0x1A, 0x1B,
- 0x1C, 0x1D, 0x1E, 0x1F};
- }
-
- vsrcAuc = vec_ld(0, src);
-
- if (loadSecond)
- vsrcBuc = vec_ld(16, src);
- vsrcperm0 = vec_lvsl(0, src);
- vsrcperm1 = vec_lvsl(1, src);
-
- vsrc0uc = vec_perm(vsrcAuc, vsrcBuc, vsrcperm0);
- if (reallyBadAlign)
- vsrc1uc = vsrcBuc;
- else
- vsrc1uc = vec_perm(vsrcAuc, vsrcBuc, vsrcperm1);
-
- vsrc0ssH = (vec_s16)vec_mergeh(zero_u8v, (vec_u8)vsrc0uc);
- vsrc1ssH = (vec_s16)vec_mergeh(zero_u8v, (vec_u8)vsrc1uc);
-
- if (!loadSecond) {// -> !reallyBadAlign
- for (i = 0 ; i < h ; i++) {
-
-
- vsrcCuc = vec_ld(stride + 0, src);
-
- vsrc2uc = vec_perm(vsrcCuc, vsrcCuc, vsrcperm0);
- vsrc3uc = vec_perm(vsrcCuc, vsrcCuc, vsrcperm1);
-
- CHROMA_MC8_ALTIVEC_CORE(vec_splat_s16(0), add28)
- }
- } else {
- vec_u8 vsrcDuc;
- for (i = 0 ; i < h ; i++) {
- vsrcCuc = vec_ld(stride + 0, src);
- vsrcDuc = vec_ld(stride + 16, src);
-
- vsrc2uc = vec_perm(vsrcCuc, vsrcDuc, vsrcperm0);
- if (reallyBadAlign)
- vsrc3uc = vsrcDuc;
- else
- vsrc3uc = vec_perm(vsrcCuc, vsrcDuc, vsrcperm1);
-
- CHROMA_MC8_ALTIVEC_CORE(vec_splat_s16(0), add28)
- }
- }
-}
-#endif
-
-#undef noop
-#undef add28
-#undef CHROMA_MC8_ALTIVEC_CORE
-
-/* this code assume stride % 16 == 0 */
-#ifdef PREFIX_h264_qpel16_h_lowpass_altivec
-static void PREFIX_h264_qpel16_h_lowpass_altivec(uint8_t * dst, uint8_t * src, int dstStride, int srcStride) {
- register int i;
-
- LOAD_ZERO;
- const vec_u8 permM2 = vec_lvsl(-2, src);
- const vec_u8 permM1 = vec_lvsl(-1, src);
- const vec_u8 permP0 = vec_lvsl(+0, src);
- const vec_u8 permP1 = vec_lvsl(+1, src);
- const vec_u8 permP2 = vec_lvsl(+2, src);
- const vec_u8 permP3 = vec_lvsl(+3, src);
- const vec_s16 v5ss = vec_splat_s16(5);
- const vec_u16 v5us = vec_splat_u16(5);
- const vec_s16 v20ss = vec_sl(vec_splat_s16(5),vec_splat_u16(2));
- const vec_s16 v16ss = vec_sl(vec_splat_s16(1),vec_splat_u16(4));
-
- vec_u8 srcM2, srcM1, srcP0, srcP1, srcP2, srcP3;
-
- register int align = ((((unsigned long)src) - 2) % 16);
-
- vec_s16 srcP0A, srcP0B, srcP1A, srcP1B,
- srcP2A, srcP2B, srcP3A, srcP3B,
- srcM1A, srcM1B, srcM2A, srcM2B,
- sum1A, sum1B, sum2A, sum2B, sum3A, sum3B,
- pp1A, pp1B, pp2A, pp2B, pp3A, pp3B,
- psumA, psumB, sumA, sumB;
-
- vec_u8 sum, vdst, fsum;
-
- for (i = 0 ; i < 16 ; i ++) {
- vec_u8 srcR1 = vec_ld(-2, src);
- vec_u8 srcR2 = vec_ld(14, src);
-
- switch (align) {
- default: {
- srcM2 = vec_perm(srcR1, srcR2, permM2);
- srcM1 = vec_perm(srcR1, srcR2, permM1);
- srcP0 = vec_perm(srcR1, srcR2, permP0);
- srcP1 = vec_perm(srcR1, srcR2, permP1);
- srcP2 = vec_perm(srcR1, srcR2, permP2);
- srcP3 = vec_perm(srcR1, srcR2, permP3);
- } break;
- case 11: {
- srcM2 = vec_perm(srcR1, srcR2, permM2);
- srcM1 = vec_perm(srcR1, srcR2, permM1);
- srcP0 = vec_perm(srcR1, srcR2, permP0);
- srcP1 = vec_perm(srcR1, srcR2, permP1);
- srcP2 = vec_perm(srcR1, srcR2, permP2);
- srcP3 = srcR2;
- } break;
- case 12: {
- vec_u8 srcR3 = vec_ld(30, src);
- srcM2 = vec_perm(srcR1, srcR2, permM2);
- srcM1 = vec_perm(srcR1, srcR2, permM1);
- srcP0 = vec_perm(srcR1, srcR2, permP0);
- srcP1 = vec_perm(srcR1, srcR2, permP1);
- srcP2 = srcR2;
- srcP3 = vec_perm(srcR2, srcR3, permP3);
- } break;
- case 13: {
- vec_u8 srcR3 = vec_ld(30, src);
- srcM2 = vec_perm(srcR1, srcR2, permM2);
- srcM1 = vec_perm(srcR1, srcR2, permM1);
- srcP0 = vec_perm(srcR1, srcR2, permP0);
- srcP1 = srcR2;
- srcP2 = vec_perm(srcR2, srcR3, permP2);
- srcP3 = vec_perm(srcR2, srcR3, permP3);
- } break;
- case 14: {
- vec_u8 srcR3 = vec_ld(30, src);
- srcM2 = vec_perm(srcR1, srcR2, permM2);
- srcM1 = vec_perm(srcR1, srcR2, permM1);
- srcP0 = srcR2;
- srcP1 = vec_perm(srcR2, srcR3, permP1);
- srcP2 = vec_perm(srcR2, srcR3, permP2);
- srcP3 = vec_perm(srcR2, srcR3, permP3);
- } break;
- case 15: {
- vec_u8 srcR3 = vec_ld(30, src);
- srcM2 = vec_perm(srcR1, srcR2, permM2);
- srcM1 = srcR2;
- srcP0 = vec_perm(srcR2, srcR3, permP0);
- srcP1 = vec_perm(srcR2, srcR3, permP1);
- srcP2 = vec_perm(srcR2, srcR3, permP2);
- srcP3 = vec_perm(srcR2, srcR3, permP3);
- } break;
- }
-
- srcP0A = (vec_s16) vec_mergeh(zero_u8v, srcP0);
- srcP0B = (vec_s16) vec_mergel(zero_u8v, srcP0);
- srcP1A = (vec_s16) vec_mergeh(zero_u8v, srcP1);
- srcP1B = (vec_s16) vec_mergel(zero_u8v, srcP1);
-
- srcP2A = (vec_s16) vec_mergeh(zero_u8v, srcP2);
- srcP2B = (vec_s16) vec_mergel(zero_u8v, srcP2);
- srcP3A = (vec_s16) vec_mergeh(zero_u8v, srcP3);
- srcP3B = (vec_s16) vec_mergel(zero_u8v, srcP3);
-
- srcM1A = (vec_s16) vec_mergeh(zero_u8v, srcM1);
- srcM1B = (vec_s16) vec_mergel(zero_u8v, srcM1);
- srcM2A = (vec_s16) vec_mergeh(zero_u8v, srcM2);
- srcM2B = (vec_s16) vec_mergel(zero_u8v, srcM2);
-
- sum1A = vec_adds(srcP0A, srcP1A);
- sum1B = vec_adds(srcP0B, srcP1B);
- sum2A = vec_adds(srcM1A, srcP2A);
- sum2B = vec_adds(srcM1B, srcP2B);
- sum3A = vec_adds(srcM2A, srcP3A);
- sum3B = vec_adds(srcM2B, srcP3B);
-
- pp1A = vec_mladd(sum1A, v20ss, v16ss);
- pp1B = vec_mladd(sum1B, v20ss, v16ss);
-
- pp2A = vec_mladd(sum2A, v5ss, zero_s16v);
- pp2B = vec_mladd(sum2B, v5ss, zero_s16v);
-
- pp3A = vec_add(sum3A, pp1A);
- pp3B = vec_add(sum3B, pp1B);
-
- psumA = vec_sub(pp3A, pp2A);
- psumB = vec_sub(pp3B, pp2B);
-
- sumA = vec_sra(psumA, v5us);
- sumB = vec_sra(psumB, v5us);
-
- sum = vec_packsu(sumA, sumB);
-
- ASSERT_ALIGNED(dst);
- vdst = vec_ld(0, dst);
-
- OP_U8_ALTIVEC(fsum, sum, vdst);
-
- vec_st(fsum, 0, dst);
-
- src += srcStride;
- dst += dstStride;
- }
-}
-#endif
-
-/* this code assume stride % 16 == 0 */
-#ifdef PREFIX_h264_qpel16_v_lowpass_altivec
-static void PREFIX_h264_qpel16_v_lowpass_altivec(uint8_t * dst, uint8_t * src, int dstStride, int srcStride) {
- register int i;
-
- LOAD_ZERO;
- const vec_u8 perm = vec_lvsl(0, src);
- const vec_s16 v20ss = vec_sl(vec_splat_s16(5),vec_splat_u16(2));
- const vec_u16 v5us = vec_splat_u16(5);
- const vec_s16 v5ss = vec_splat_s16(5);
- const vec_s16 v16ss = vec_sl(vec_splat_s16(1),vec_splat_u16(4));
-
- uint8_t *srcbis = src - (srcStride * 2);
-
- const vec_u8 srcM2a = vec_ld(0, srcbis);
- const vec_u8 srcM2b = vec_ld(16, srcbis);
- const vec_u8 srcM2 = vec_perm(srcM2a, srcM2b, perm);
- //srcbis += srcStride;
- const vec_u8 srcM1a = vec_ld(0, srcbis += srcStride);
- const vec_u8 srcM1b = vec_ld(16, srcbis);
- const vec_u8 srcM1 = vec_perm(srcM1a, srcM1b, perm);
- //srcbis += srcStride;
- const vec_u8 srcP0a = vec_ld(0, srcbis += srcStride);
- const vec_u8 srcP0b = vec_ld(16, srcbis);
- const vec_u8 srcP0 = vec_perm(srcP0a, srcP0b, perm);
- //srcbis += srcStride;
- const vec_u8 srcP1a = vec_ld(0, srcbis += srcStride);
- const vec_u8 srcP1b = vec_ld(16, srcbis);
- const vec_u8 srcP1 = vec_perm(srcP1a, srcP1b, perm);
- //srcbis += srcStride;
- const vec_u8 srcP2a = vec_ld(0, srcbis += srcStride);
- const vec_u8 srcP2b = vec_ld(16, srcbis);
- const vec_u8 srcP2 = vec_perm(srcP2a, srcP2b, perm);
- //srcbis += srcStride;
-
- vec_s16 srcM2ssA = (vec_s16) vec_mergeh(zero_u8v, srcM2);
- vec_s16 srcM2ssB = (vec_s16) vec_mergel(zero_u8v, srcM2);
- vec_s16 srcM1ssA = (vec_s16) vec_mergeh(zero_u8v, srcM1);
- vec_s16 srcM1ssB = (vec_s16) vec_mergel(zero_u8v, srcM1);
- vec_s16 srcP0ssA = (vec_s16) vec_mergeh(zero_u8v, srcP0);
- vec_s16 srcP0ssB = (vec_s16) vec_mergel(zero_u8v, srcP0);
- vec_s16 srcP1ssA = (vec_s16) vec_mergeh(zero_u8v, srcP1);
- vec_s16 srcP1ssB = (vec_s16) vec_mergel(zero_u8v, srcP1);
- vec_s16 srcP2ssA = (vec_s16) vec_mergeh(zero_u8v, srcP2);
- vec_s16 srcP2ssB = (vec_s16) vec_mergel(zero_u8v, srcP2);
-
- vec_s16 pp1A, pp1B, pp2A, pp2B, pp3A, pp3B,
- psumA, psumB, sumA, sumB,
- srcP3ssA, srcP3ssB,
- sum1A, sum1B, sum2A, sum2B, sum3A, sum3B;
-
- vec_u8 sum, vdst, fsum, srcP3a, srcP3b, srcP3;
-
- for (i = 0 ; i < 16 ; i++) {
- srcP3a = vec_ld(0, srcbis += srcStride);
- srcP3b = vec_ld(16, srcbis);
- srcP3 = vec_perm(srcP3a, srcP3b, perm);
- srcP3ssA = (vec_s16) vec_mergeh(zero_u8v, srcP3);
- srcP3ssB = (vec_s16) vec_mergel(zero_u8v, srcP3);
- //srcbis += srcStride;
-
- sum1A = vec_adds(srcP0ssA, srcP1ssA);
- sum1B = vec_adds(srcP0ssB, srcP1ssB);
- sum2A = vec_adds(srcM1ssA, srcP2ssA);
- sum2B = vec_adds(srcM1ssB, srcP2ssB);
- sum3A = vec_adds(srcM2ssA, srcP3ssA);
- sum3B = vec_adds(srcM2ssB, srcP3ssB);
-
- srcM2ssA = srcM1ssA;
- srcM2ssB = srcM1ssB;
- srcM1ssA = srcP0ssA;
- srcM1ssB = srcP0ssB;
- srcP0ssA = srcP1ssA;
- srcP0ssB = srcP1ssB;
- srcP1ssA = srcP2ssA;
- srcP1ssB = srcP2ssB;
- srcP2ssA = srcP3ssA;
- srcP2ssB = srcP3ssB;
-
- pp1A = vec_mladd(sum1A, v20ss, v16ss);
- pp1B = vec_mladd(sum1B, v20ss, v16ss);
-
- pp2A = vec_mladd(sum2A, v5ss, zero_s16v);
- pp2B = vec_mladd(sum2B, v5ss, zero_s16v);
-
- pp3A = vec_add(sum3A, pp1A);
- pp3B = vec_add(sum3B, pp1B);
-
- psumA = vec_sub(pp3A, pp2A);
- psumB = vec_sub(pp3B, pp2B);
-
- sumA = vec_sra(psumA, v5us);
- sumB = vec_sra(psumB, v5us);
-
- sum = vec_packsu(sumA, sumB);
-
- ASSERT_ALIGNED(dst);
- vdst = vec_ld(0, dst);
-
- OP_U8_ALTIVEC(fsum, sum, vdst);
-
- vec_st(fsum, 0, dst);
-
- dst += dstStride;
- }
-}
-#endif
-
-/* this code assume stride % 16 == 0 *and* tmp is properly aligned */
-#ifdef PREFIX_h264_qpel16_hv_lowpass_altivec
-static void PREFIX_h264_qpel16_hv_lowpass_altivec(uint8_t * dst, int16_t * tmp, uint8_t * src, int dstStride, int tmpStride, int srcStride) {
- register int i;
- LOAD_ZERO;
- const vec_u8 permM2 = vec_lvsl(-2, src);
- const vec_u8 permM1 = vec_lvsl(-1, src);
- const vec_u8 permP0 = vec_lvsl(+0, src);
- const vec_u8 permP1 = vec_lvsl(+1, src);
- const vec_u8 permP2 = vec_lvsl(+2, src);
- const vec_u8 permP3 = vec_lvsl(+3, src);
- const vec_s16 v20ss = vec_sl(vec_splat_s16(5),vec_splat_u16(2));
- const vec_u32 v10ui = vec_splat_u32(10);
- const vec_s16 v5ss = vec_splat_s16(5);
- const vec_s16 v1ss = vec_splat_s16(1);
- const vec_s32 v512si = vec_sl(vec_splat_s32(1),vec_splat_u32(9));
- const vec_u32 v16ui = vec_sl(vec_splat_u32(1),vec_splat_u32(4));
-
- register int align = ((((unsigned long)src) - 2) % 16);
-
- vec_s16 srcP0A, srcP0B, srcP1A, srcP1B,
- srcP2A, srcP2B, srcP3A, srcP3B,
- srcM1A, srcM1B, srcM2A, srcM2B,
- sum1A, sum1B, sum2A, sum2B, sum3A, sum3B,
- pp1A, pp1B, pp2A, pp2B, psumA, psumB;
-
- const vec_u8 mperm = (const vec_u8)
- {0x00, 0x08, 0x01, 0x09, 0x02, 0x0A, 0x03, 0x0B,
- 0x04, 0x0C, 0x05, 0x0D, 0x06, 0x0E, 0x07, 0x0F};
- int16_t *tmpbis = tmp;
-
- vec_s16 tmpM1ssA, tmpM1ssB, tmpM2ssA, tmpM2ssB,
- tmpP0ssA, tmpP0ssB, tmpP1ssA, tmpP1ssB,
- tmpP2ssA, tmpP2ssB;
-
- vec_s32 pp1Ae, pp1Ao, pp1Be, pp1Bo, pp2Ae, pp2Ao, pp2Be, pp2Bo,
- pp3Ae, pp3Ao, pp3Be, pp3Bo, pp1cAe, pp1cAo, pp1cBe, pp1cBo,
- pp32Ae, pp32Ao, pp32Be, pp32Bo, sumAe, sumAo, sumBe, sumBo,
- ssumAe, ssumAo, ssumBe, ssumBo;
- vec_u8 fsum, sumv, sum, vdst;
- vec_s16 ssume, ssumo;
-
- src -= (2 * srcStride);
- for (i = 0 ; i < 21 ; i ++) {
- vec_u8 srcM2, srcM1, srcP0, srcP1, srcP2, srcP3;
- vec_u8 srcR1 = vec_ld(-2, src);
- vec_u8 srcR2 = vec_ld(14, src);
-
- switch (align) {
- default: {
- srcM2 = vec_perm(srcR1, srcR2, permM2);
- srcM1 = vec_perm(srcR1, srcR2, permM1);
- srcP0 = vec_perm(srcR1, srcR2, permP0);
- srcP1 = vec_perm(srcR1, srcR2, permP1);
- srcP2 = vec_perm(srcR1, srcR2, permP2);
- srcP3 = vec_perm(srcR1, srcR2, permP3);
- } break;
- case 11: {
- srcM2 = vec_perm(srcR1, srcR2, permM2);
- srcM1 = vec_perm(srcR1, srcR2, permM1);
- srcP0 = vec_perm(srcR1, srcR2, permP0);
- srcP1 = vec_perm(srcR1, srcR2, permP1);
- srcP2 = vec_perm(srcR1, srcR2, permP2);
- srcP3 = srcR2;
- } break;
- case 12: {
- vec_u8 srcR3 = vec_ld(30, src);
- srcM2 = vec_perm(srcR1, srcR2, permM2);
- srcM1 = vec_perm(srcR1, srcR2, permM1);
- srcP0 = vec_perm(srcR1, srcR2, permP0);
- srcP1 = vec_perm(srcR1, srcR2, permP1);
- srcP2 = srcR2;
- srcP3 = vec_perm(srcR2, srcR3, permP3);
- } break;
- case 13: {
- vec_u8 srcR3 = vec_ld(30, src);
- srcM2 = vec_perm(srcR1, srcR2, permM2);
- srcM1 = vec_perm(srcR1, srcR2, permM1);
- srcP0 = vec_perm(srcR1, srcR2, permP0);
- srcP1 = srcR2;
- srcP2 = vec_perm(srcR2, srcR3, permP2);
- srcP3 = vec_perm(srcR2, srcR3, permP3);
- } break;
- case 14: {
- vec_u8 srcR3 = vec_ld(30, src);
- srcM2 = vec_perm(srcR1, srcR2, permM2);
- srcM1 = vec_perm(srcR1, srcR2, permM1);
- srcP0 = srcR2;
- srcP1 = vec_perm(srcR2, srcR3, permP1);
- srcP2 = vec_perm(srcR2, srcR3, permP2);
- srcP3 = vec_perm(srcR2, srcR3, permP3);
- } break;
- case 15: {
- vec_u8 srcR3 = vec_ld(30, src);
- srcM2 = vec_perm(srcR1, srcR2, permM2);
- srcM1 = srcR2;
- srcP0 = vec_perm(srcR2, srcR3, permP0);
- srcP1 = vec_perm(srcR2, srcR3, permP1);
- srcP2 = vec_perm(srcR2, srcR3, permP2);
- srcP3 = vec_perm(srcR2, srcR3, permP3);
- } break;
- }
-
- srcP0A = (vec_s16) vec_mergeh(zero_u8v, srcP0);
- srcP0B = (vec_s16) vec_mergel(zero_u8v, srcP0);
- srcP1A = (vec_s16) vec_mergeh(zero_u8v, srcP1);
- srcP1B = (vec_s16) vec_mergel(zero_u8v, srcP1);
-
- srcP2A = (vec_s16) vec_mergeh(zero_u8v, srcP2);
- srcP2B = (vec_s16) vec_mergel(zero_u8v, srcP2);
- srcP3A = (vec_s16) vec_mergeh(zero_u8v, srcP3);
- srcP3B = (vec_s16) vec_mergel(zero_u8v, srcP3);
-
- srcM1A = (vec_s16) vec_mergeh(zero_u8v, srcM1);
- srcM1B = (vec_s16) vec_mergel(zero_u8v, srcM1);
- srcM2A = (vec_s16) vec_mergeh(zero_u8v, srcM2);
- srcM2B = (vec_s16) vec_mergel(zero_u8v, srcM2);
-
- sum1A = vec_adds(srcP0A, srcP1A);
- sum1B = vec_adds(srcP0B, srcP1B);
- sum2A = vec_adds(srcM1A, srcP2A);
- sum2B = vec_adds(srcM1B, srcP2B);
- sum3A = vec_adds(srcM2A, srcP3A);
- sum3B = vec_adds(srcM2B, srcP3B);
-
- pp1A = vec_mladd(sum1A, v20ss, sum3A);
- pp1B = vec_mladd(sum1B, v20ss, sum3B);
-
- pp2A = vec_mladd(sum2A, v5ss, zero_s16v);
- pp2B = vec_mladd(sum2B, v5ss, zero_s16v);
-
- psumA = vec_sub(pp1A, pp2A);
- psumB = vec_sub(pp1B, pp2B);
-
- vec_st(psumA, 0, tmp);
- vec_st(psumB, 16, tmp);
-
- src += srcStride;
- tmp += tmpStride; /* int16_t*, and stride is 16, so it's OK here */
- }
-
- tmpM2ssA = vec_ld(0, tmpbis);
- tmpM2ssB = vec_ld(16, tmpbis);
- tmpbis += tmpStride;
- tmpM1ssA = vec_ld(0, tmpbis);
- tmpM1ssB = vec_ld(16, tmpbis);
- tmpbis += tmpStride;
- tmpP0ssA = vec_ld(0, tmpbis);
- tmpP0ssB = vec_ld(16, tmpbis);
- tmpbis += tmpStride;
- tmpP1ssA = vec_ld(0, tmpbis);
- tmpP1ssB = vec_ld(16, tmpbis);
- tmpbis += tmpStride;
- tmpP2ssA = vec_ld(0, tmpbis);
- tmpP2ssB = vec_ld(16, tmpbis);
- tmpbis += tmpStride;
-
- for (i = 0 ; i < 16 ; i++) {
- const vec_s16 tmpP3ssA = vec_ld(0, tmpbis);
- const vec_s16 tmpP3ssB = vec_ld(16, tmpbis);
-
- const vec_s16 sum1A = vec_adds(tmpP0ssA, tmpP1ssA);
- const vec_s16 sum1B = vec_adds(tmpP0ssB, tmpP1ssB);
- const vec_s16 sum2A = vec_adds(tmpM1ssA, tmpP2ssA);
- const vec_s16 sum2B = vec_adds(tmpM1ssB, tmpP2ssB);
- const vec_s16 sum3A = vec_adds(tmpM2ssA, tmpP3ssA);
- const vec_s16 sum3B = vec_adds(tmpM2ssB, tmpP3ssB);
-
- tmpbis += tmpStride;
-
- tmpM2ssA = tmpM1ssA;
- tmpM2ssB = tmpM1ssB;
- tmpM1ssA = tmpP0ssA;
- tmpM1ssB = tmpP0ssB;
- tmpP0ssA = tmpP1ssA;
- tmpP0ssB = tmpP1ssB;
- tmpP1ssA = tmpP2ssA;
- tmpP1ssB = tmpP2ssB;
- tmpP2ssA = tmpP3ssA;
- tmpP2ssB = tmpP3ssB;
-
- pp1Ae = vec_mule(sum1A, v20ss);
- pp1Ao = vec_mulo(sum1A, v20ss);
- pp1Be = vec_mule(sum1B, v20ss);
- pp1Bo = vec_mulo(sum1B, v20ss);
-
- pp2Ae = vec_mule(sum2A, v5ss);
- pp2Ao = vec_mulo(sum2A, v5ss);
- pp2Be = vec_mule(sum2B, v5ss);
- pp2Bo = vec_mulo(sum2B, v5ss);
-
- pp3Ae = vec_sra((vec_s32)sum3A, v16ui);
- pp3Ao = vec_mulo(sum3A, v1ss);
- pp3Be = vec_sra((vec_s32)sum3B, v16ui);
- pp3Bo = vec_mulo(sum3B, v1ss);
-
- pp1cAe = vec_add(pp1Ae, v512si);
- pp1cAo = vec_add(pp1Ao, v512si);
- pp1cBe = vec_add(pp1Be, v512si);
- pp1cBo = vec_add(pp1Bo, v512si);
-
- pp32Ae = vec_sub(pp3Ae, pp2Ae);
- pp32Ao = vec_sub(pp3Ao, pp2Ao);
- pp32Be = vec_sub(pp3Be, pp2Be);
- pp32Bo = vec_sub(pp3Bo, pp2Bo);
-
- sumAe = vec_add(pp1cAe, pp32Ae);
- sumAo = vec_add(pp1cAo, pp32Ao);
- sumBe = vec_add(pp1cBe, pp32Be);
- sumBo = vec_add(pp1cBo, pp32Bo);
-
- ssumAe = vec_sra(sumAe, v10ui);
- ssumAo = vec_sra(sumAo, v10ui);
- ssumBe = vec_sra(sumBe, v10ui);
- ssumBo = vec_sra(sumBo, v10ui);
-
- ssume = vec_packs(ssumAe, ssumBe);
- ssumo = vec_packs(ssumAo, ssumBo);
-
- sumv = vec_packsu(ssume, ssumo);
- sum = vec_perm(sumv, sumv, mperm);
-
- ASSERT_ALIGNED(dst);
- vdst = vec_ld(0, dst);
-
- OP_U8_ALTIVEC(fsum, sum, vdst);
-
- vec_st(fsum, 0, dst);
-
- dst += dstStride;
- }
-}
-#endif
diff --git a/gst-libs/ext/libav/libavcodec/ppc/idct_altivec.c b/gst-libs/ext/libav/libavcodec/ppc/idct_altivec.c
index cc3adcb..e599491 100644
--- a/gst-libs/ext/libav/libavcodec/ppc/idct_altivec.c
+++ b/gst-libs/ext/libav/libavcodec/ppc/idct_altivec.c
@@ -41,8 +41,8 @@
#if HAVE_ALTIVEC_H
#include <altivec.h>
#endif
+#include "libavutil/ppc/types_altivec.h"
#include "libavcodec/dsputil.h"
-#include "types_altivec.h"
#include "dsputil_altivec.h"
#define IDCT_HALF \
@@ -158,7 +158,7 @@ static const vec_s16 constants[5] = {
{19266, 26722, 25172, 22654, 19266, 22654, 25172, 26722}
};
-void idct_put_altivec(uint8_t* dest, int stride, int16_t *blk)
+void ff_idct_put_altivec(uint8_t* dest, int stride, int16_t *blk)
{
vec_s16 *block = (vec_s16*)blk;
vec_u8 tmp;
@@ -180,7 +180,7 @@ void idct_put_altivec(uint8_t* dest, int stride, int16_t *blk)
COPY (dest, vx7)
}
-void idct_add_altivec(uint8_t* dest, int stride, int16_t *blk)
+void ff_idct_add_altivec(uint8_t* dest, int stride, int16_t *blk)
{
vec_s16 *block = (vec_s16*)blk;
vec_u8 tmp;
@@ -215,4 +215,3 @@ void idct_add_altivec(uint8_t* dest, int stride, int16_t *blk)
ADD (dest, vx6, perm0) dest += stride;
ADD (dest, vx7, perm1)
}
-
diff --git a/gst-libs/ext/libav/libavcodec/ppc/int_altivec.c b/gst-libs/ext/libav/libavcodec/ppc/int_altivec.c
index 25cbb8f..4fcdf77 100644
--- a/gst-libs/ext/libav/libavcodec/ppc/int_altivec.c
+++ b/gst-libs/ext/libav/libavcodec/ppc/int_altivec.c
@@ -28,12 +28,11 @@
#include <altivec.h>
#endif
+#include "libavutil/ppc/types_altivec.h"
#include "libavcodec/dsputil.h"
#include "dsputil_altivec.h"
-#include "types_altivec.h"
-
static int ssd_int8_vs_int16_altivec(const int8_t *pix1, const int16_t *pix2,
int size) {
int i, size16;
@@ -79,27 +78,20 @@ static int ssd_int8_vs_int16_altivec(const int8_t *pix1, const int16_t *pix2,
return u.score[3];
}
-static int32_t scalarproduct_int16_altivec(const int16_t * v1, const int16_t * v2, int order, const int shift)
+static int32_t scalarproduct_int16_altivec(const int16_t *v1, const int16_t *v2,
+ int order)
{
int i;
LOAD_ZERO;
- register vec_s16 vec1, *pv;
+ const vec_s16 *pv;
+ register vec_s16 vec1;
register vec_s32 res = vec_splat_s32(0), t;
- register vec_u32 shifts;
int32_t ires;
- shifts = zero_u32v;
- if(shift & 0x10) shifts = vec_add(shifts, vec_sl(vec_splat_u32(0x08), vec_splat_u32(0x1)));
- if(shift & 0x08) shifts = vec_add(shifts, vec_splat_u32(0x08));
- if(shift & 0x04) shifts = vec_add(shifts, vec_splat_u32(0x04));
- if(shift & 0x02) shifts = vec_add(shifts, vec_splat_u32(0x02));
- if(shift & 0x01) shifts = vec_add(shifts, vec_splat_u32(0x01));
-
for(i = 0; i < order; i += 8){
- pv = (vec_s16*)v1;
+ pv = (const vec_s16*)v1;
vec1 = vec_perm(pv[0], pv[1], vec_lvsl(0, v1));
t = vec_msum(vec1, vec_ld(0, v2), zero_s32v);
- t = vec_sr(t, shifts);
res = vec_sums(t, res);
v1 += 8;
v2 += 8;
@@ -113,38 +105,38 @@ static int32_t scalarproduct_and_madd_int16_altivec(int16_t *v1, const int16_t *
{
LOAD_ZERO;
vec_s16 *pv1 = (vec_s16*)v1;
- vec_s16 *pv2 = (vec_s16*)v2;
- vec_s16 *pv3 = (vec_s16*)v3;
register vec_s16 muls = {mul,mul,mul,mul,mul,mul,mul,mul};
- register vec_s16 t0, t1, i0, i1;
- register vec_s16 i2 = pv2[0], i3 = pv3[0];
+ register vec_s16 t0, t1, i0, i1, i4;
+ register vec_s16 i2 = vec_ld(0, v2), i3 = vec_ld(0, v3);
register vec_s32 res = zero_s32v;
register vec_u8 align = vec_lvsl(0, v2);
int32_t ires;
order >>= 4;
do {
- t0 = vec_perm(i2, pv2[1], align);
- i2 = pv2[2];
- t1 = vec_perm(pv2[1], i2, align);
+ i1 = vec_ld(16, v2);
+ t0 = vec_perm(i2, i1, align);
+ i2 = vec_ld(32, v2);
+ t1 = vec_perm(i1, i2, align);
i0 = pv1[0];
i1 = pv1[1];
res = vec_msum(t0, i0, res);
res = vec_msum(t1, i1, res);
- t0 = vec_perm(i3, pv3[1], align);
- i3 = pv3[2];
- t1 = vec_perm(pv3[1], i3, align);
+ i4 = vec_ld(16, v3);
+ t0 = vec_perm(i3, i4, align);
+ i3 = vec_ld(32, v3);
+ t1 = vec_perm(i4, i3, align);
pv1[0] = vec_mladd(t0, muls, i0);
pv1[1] = vec_mladd(t1, muls, i1);
pv1 += 2;
- pv2 += 2;
- pv3 += 2;
+ v2 += 8;
+ v3 += 8;
} while(--order);
res = vec_splat(vec_sums(res, zero_s32v), 3);
vec_ste(res, 0, &ires);
return ires;
}
-void int_init_altivec(DSPContext* c, AVCodecContext *avctx)
+void ff_int_init_altivec(DSPContext* c, AVCodecContext *avctx)
{
c->ssd_int8_vs_int16 = ssd_int8_vs_int16_altivec;
c->scalarproduct_int16 = scalarproduct_int16_altivec;
diff --git a/gst-libs/ext/libav/libavcodec/ppc/mpegaudiodec_altivec.c b/gst-libs/ext/libav/libavcodec/ppc/mpegaudiodec_altivec.c
index 5df0fda..fabde6a 100644
--- a/gst-libs/ext/libav/libavcodec/ppc/mpegaudiodec_altivec.c
+++ b/gst-libs/ext/libav/libavcodec/ppc/mpegaudiodec_altivec.c
@@ -20,7 +20,7 @@
*/
#include "dsputil_altivec.h"
-#include "util_altivec.h"
+#include "libavutil/ppc/util_altivec.h"
#include "libavcodec/dsputil.h"
#include "libavcodec/mpegaudiodsp.h"
diff --git a/gst-libs/ext/libav/libavcodec/ppc/mpegvideo_altivec.c b/gst-libs/ext/libav/libavcodec/ppc/mpegvideo_altivec.c
index a033cd7..df111e9 100644
--- a/gst-libs/ext/libav/libavcodec/ppc/mpegvideo_altivec.c
+++ b/gst-libs/ext/libav/libavcodec/ppc/mpegvideo_altivec.c
@@ -23,457 +23,15 @@
#include <stdlib.h>
#include <stdio.h>
+
#include "libavutil/cpu.h"
+#include "libavutil/ppc/types_altivec.h"
+#include "libavutil/ppc/util_altivec.h"
#include "libavcodec/dsputil.h"
#include "libavcodec/mpegvideo.h"
-#include "util_altivec.h"
-#include "types_altivec.h"
#include "dsputil_altivec.h"
-// Swaps two variables (used for altivec registers)
-#define SWAP(a,b) \
-do { \
- __typeof__(a) swap_temp=a; \
- a=b; \
- b=swap_temp; \
-} while (0)
-
-// transposes a matrix consisting of four vectors with four elements each
-#define TRANSPOSE4(a,b,c,d) \
-do { \
- __typeof__(a) _trans_ach = vec_mergeh(a, c); \
- __typeof__(a) _trans_acl = vec_mergel(a, c); \
- __typeof__(a) _trans_bdh = vec_mergeh(b, d); \
- __typeof__(a) _trans_bdl = vec_mergel(b, d); \
- \
- a = vec_mergeh(_trans_ach, _trans_bdh); \
- b = vec_mergel(_trans_ach, _trans_bdh); \
- c = vec_mergeh(_trans_acl, _trans_bdl); \
- d = vec_mergel(_trans_acl, _trans_bdl); \
-} while (0)
-
-
-// Loads a four-byte value (int or float) from the target address
-// into every element in the target vector. Only works if the
-// target address is four-byte aligned (which should be always).
-#define LOAD4(vec, address) \
-{ \
- __typeof__(vec)* _load_addr = (__typeof__(vec)*)(address); \
- vector unsigned char _perm_vec = vec_lvsl(0,(address)); \
- vec = vec_ld(0, _load_addr); \
- vec = vec_perm(vec, vec, _perm_vec); \
- vec = vec_splat(vec, 0); \
-}
-
-
-#define FOUROF(a) {a,a,a,a}
-
-static int dct_quantize_altivec(MpegEncContext* s,
- DCTELEM* data, int n,
- int qscale, int* overflow)
-{
- int lastNonZero;
- vector float row0, row1, row2, row3, row4, row5, row6, row7;
- vector float alt0, alt1, alt2, alt3, alt4, alt5, alt6, alt7;
- const vector float zero = (const vector float)FOUROF(0.);
- // used after quantize step
- int oldBaseValue = 0;
-
- // Load the data into the row/alt vectors
- {
- vector signed short data0, data1, data2, data3, data4, data5, data6, data7;
-
- data0 = vec_ld(0, data);
- data1 = vec_ld(16, data);
- data2 = vec_ld(32, data);
- data3 = vec_ld(48, data);
- data4 = vec_ld(64, data);
- data5 = vec_ld(80, data);
- data6 = vec_ld(96, data);
- data7 = vec_ld(112, data);
-
- // Transpose the data before we start
- TRANSPOSE8(data0, data1, data2, data3, data4, data5, data6, data7);
-
- // load the data into floating point vectors. We load
- // the high half of each row into the main row vectors
- // and the low half into the alt vectors.
- row0 = vec_ctf(vec_unpackh(data0), 0);
- alt0 = vec_ctf(vec_unpackl(data0), 0);
- row1 = vec_ctf(vec_unpackh(data1), 0);
- alt1 = vec_ctf(vec_unpackl(data1), 0);
- row2 = vec_ctf(vec_unpackh(data2), 0);
- alt2 = vec_ctf(vec_unpackl(data2), 0);
- row3 = vec_ctf(vec_unpackh(data3), 0);
- alt3 = vec_ctf(vec_unpackl(data3), 0);
- row4 = vec_ctf(vec_unpackh(data4), 0);
- alt4 = vec_ctf(vec_unpackl(data4), 0);
- row5 = vec_ctf(vec_unpackh(data5), 0);
- alt5 = vec_ctf(vec_unpackl(data5), 0);
- row6 = vec_ctf(vec_unpackh(data6), 0);
- alt6 = vec_ctf(vec_unpackl(data6), 0);
- row7 = vec_ctf(vec_unpackh(data7), 0);
- alt7 = vec_ctf(vec_unpackl(data7), 0);
- }
-
- // The following block could exist as a separate an altivec dct
- // function. However, if we put it inline, the DCT data can remain
- // in the vector local variables, as floats, which we'll use during the
- // quantize step...
- {
- const vector float vec_0_298631336 = (vector float)FOUROF(0.298631336f);
- const vector float vec_0_390180644 = (vector float)FOUROF(-0.390180644f);
- const vector float vec_0_541196100 = (vector float)FOUROF(0.541196100f);
- const vector float vec_0_765366865 = (vector float)FOUROF(0.765366865f);
- const vector float vec_0_899976223 = (vector float)FOUROF(-0.899976223f);
- const vector float vec_1_175875602 = (vector float)FOUROF(1.175875602f);
- const vector float vec_1_501321110 = (vector float)FOUROF(1.501321110f);
- const vector float vec_1_847759065 = (vector float)FOUROF(-1.847759065f);
- const vector float vec_1_961570560 = (vector float)FOUROF(-1.961570560f);
- const vector float vec_2_053119869 = (vector float)FOUROF(2.053119869f);
- const vector float vec_2_562915447 = (vector float)FOUROF(-2.562915447f);
- const vector float vec_3_072711026 = (vector float)FOUROF(3.072711026f);
-
-
- int whichPass, whichHalf;
-
- for(whichPass = 1; whichPass<=2; whichPass++) {
- for(whichHalf = 1; whichHalf<=2; whichHalf++) {
- vector float tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
- vector float tmp10, tmp11, tmp12, tmp13;
- vector float z1, z2, z3, z4, z5;
-
- tmp0 = vec_add(row0, row7); // tmp0 = dataptr[0] + dataptr[7];
- tmp7 = vec_sub(row0, row7); // tmp7 = dataptr[0] - dataptr[7];
- tmp3 = vec_add(row3, row4); // tmp3 = dataptr[3] + dataptr[4];
- tmp4 = vec_sub(row3, row4); // tmp4 = dataptr[3] - dataptr[4];
- tmp1 = vec_add(row1, row6); // tmp1 = dataptr[1] + dataptr[6];
- tmp6 = vec_sub(row1, row6); // tmp6 = dataptr[1] - dataptr[6];
- tmp2 = vec_add(row2, row5); // tmp2 = dataptr[2] + dataptr[5];
- tmp5 = vec_sub(row2, row5); // tmp5 = dataptr[2] - dataptr[5];
-
- tmp10 = vec_add(tmp0, tmp3); // tmp10 = tmp0 + tmp3;
- tmp13 = vec_sub(tmp0, tmp3); // tmp13 = tmp0 - tmp3;
- tmp11 = vec_add(tmp1, tmp2); // tmp11 = tmp1 + tmp2;
- tmp12 = vec_sub(tmp1, tmp2); // tmp12 = tmp1 - tmp2;
-
-
- // dataptr[0] = (DCTELEM) ((tmp10 + tmp11) << PASS1_BITS);
- row0 = vec_add(tmp10, tmp11);
-
- // dataptr[4] = (DCTELEM) ((tmp10 - tmp11) << PASS1_BITS);
- row4 = vec_sub(tmp10, tmp11);
-
-
- // z1 = MULTIPLY(tmp12 + tmp13, FIX_0_541196100);
- z1 = vec_madd(vec_add(tmp12, tmp13), vec_0_541196100, (vector float)zero);
-
- // dataptr[2] = (DCTELEM) DESCALE(z1 + MULTIPLY(tmp13, FIX_0_765366865),
- // CONST_BITS-PASS1_BITS);
- row2 = vec_madd(tmp13, vec_0_765366865, z1);
-
- // dataptr[6] = (DCTELEM) DESCALE(z1 + MULTIPLY(tmp12, - FIX_1_847759065),
- // CONST_BITS-PASS1_BITS);
- row6 = vec_madd(tmp12, vec_1_847759065, z1);
-
- z1 = vec_add(tmp4, tmp7); // z1 = tmp4 + tmp7;
- z2 = vec_add(tmp5, tmp6); // z2 = tmp5 + tmp6;
- z3 = vec_add(tmp4, tmp6); // z3 = tmp4 + tmp6;
- z4 = vec_add(tmp5, tmp7); // z4 = tmp5 + tmp7;
-
- // z5 = MULTIPLY(z3 + z4, FIX_1_175875602); /* sqrt(2) * c3 */
- z5 = vec_madd(vec_add(z3, z4), vec_1_175875602, (vector float)zero);
-
- // z3 = MULTIPLY(z3, - FIX_1_961570560); /* sqrt(2) * (-c3-c5) */
- z3 = vec_madd(z3, vec_1_961570560, z5);
-
- // z4 = MULTIPLY(z4, - FIX_0_390180644); /* sqrt(2) * (c5-c3) */
- z4 = vec_madd(z4, vec_0_390180644, z5);
-
- // The following adds are rolled into the multiplies above
- // z3 = vec_add(z3, z5); // z3 += z5;
- // z4 = vec_add(z4, z5); // z4 += z5;
-
- // z2 = MULTIPLY(z2, - FIX_2_562915447); /* sqrt(2) * (-c1-c3) */
- // Wow! It's actually more efficient to roll this multiply
- // into the adds below, even thought the multiply gets done twice!
- // z2 = vec_madd(z2, vec_2_562915447, (vector float)zero);
-
- // z1 = MULTIPLY(z1, - FIX_0_899976223); /* sqrt(2) * (c7-c3) */
- // Same with this one...
- // z1 = vec_madd(z1, vec_0_899976223, (vector float)zero);
-
- // tmp4 = MULTIPLY(tmp4, FIX_0_298631336); /* sqrt(2) * (-c1+c3+c5-c7) */
- // dataptr[7] = (DCTELEM) DESCALE(tmp4 + z1 + z3, CONST_BITS-PASS1_BITS);
- row7 = vec_madd(tmp4, vec_0_298631336, vec_madd(z1, vec_0_899976223, z3));
-
- // tmp5 = MULTIPLY(tmp5, FIX_2_053119869); /* sqrt(2) * ( c1+c3-c5+c7) */
- // dataptr[5] = (DCTELEM) DESCALE(tmp5 + z2 + z4, CONST_BITS-PASS1_BITS);
- row5 = vec_madd(tmp5, vec_2_053119869, vec_madd(z2, vec_2_562915447, z4));
-
- // tmp6 = MULTIPLY(tmp6, FIX_3_072711026); /* sqrt(2) * ( c1+c3+c5-c7) */
- // dataptr[3] = (DCTELEM) DESCALE(tmp6 + z2 + z3, CONST_BITS-PASS1_BITS);
- row3 = vec_madd(tmp6, vec_3_072711026, vec_madd(z2, vec_2_562915447, z3));
-
- // tmp7 = MULTIPLY(tmp7, FIX_1_501321110); /* sqrt(2) * ( c1+c3-c5-c7) */
- // dataptr[1] = (DCTELEM) DESCALE(tmp7 + z1 + z4, CONST_BITS-PASS1_BITS);
- row1 = vec_madd(z1, vec_0_899976223, vec_madd(tmp7, vec_1_501321110, z4));
-
- // Swap the row values with the alts. If this is the first half,
- // this sets up the low values to be acted on in the second half.
- // If this is the second half, it puts the high values back in
- // the row values where they are expected to be when we're done.
- SWAP(row0, alt0);
- SWAP(row1, alt1);
- SWAP(row2, alt2);
- SWAP(row3, alt3);
- SWAP(row4, alt4);
- SWAP(row5, alt5);
- SWAP(row6, alt6);
- SWAP(row7, alt7);
- }
-
- if (whichPass == 1) {
- // transpose the data for the second pass
-
- // First, block transpose the upper right with lower left.
- SWAP(row4, alt0);
- SWAP(row5, alt1);
- SWAP(row6, alt2);
- SWAP(row7, alt3);
-
- // Now, transpose each block of four
- TRANSPOSE4(row0, row1, row2, row3);
- TRANSPOSE4(row4, row5, row6, row7);
- TRANSPOSE4(alt0, alt1, alt2, alt3);
- TRANSPOSE4(alt4, alt5, alt6, alt7);
- }
- }
- }
-
- // perform the quantize step, using the floating point data
- // still in the row/alt registers
- {
- const int* biasAddr;
- const vector signed int* qmat;
- vector float bias, negBias;
-
- if (s->mb_intra) {
- vector signed int baseVector;
-
- // We must cache element 0 in the intra case
- // (it needs special handling).
- baseVector = vec_cts(vec_splat(row0, 0), 0);
- vec_ste(baseVector, 0, &oldBaseValue);
-
- qmat = (vector signed int*)s->q_intra_matrix[qscale];
- biasAddr = &s->intra_quant_bias;
- } else {
- qmat = (vector signed int*)s->q_inter_matrix[qscale];
- biasAddr = &s->inter_quant_bias;
- }
-
- // Load the bias vector (We add 0.5 to the bias so that we're
- // rounding when we convert to int, instead of flooring.)
- {
- vector signed int biasInt;
- const vector float negOneFloat = (vector float)FOUROF(-1.0f);
- LOAD4(biasInt, biasAddr);
- bias = vec_ctf(biasInt, QUANT_BIAS_SHIFT);
- negBias = vec_madd(bias, negOneFloat, zero);
- }
-
- {
- vector float q0, q1, q2, q3, q4, q5, q6, q7;
-
- q0 = vec_ctf(qmat[0], QMAT_SHIFT);
- q1 = vec_ctf(qmat[2], QMAT_SHIFT);
- q2 = vec_ctf(qmat[4], QMAT_SHIFT);
- q3 = vec_ctf(qmat[6], QMAT_SHIFT);
- q4 = vec_ctf(qmat[8], QMAT_SHIFT);
- q5 = vec_ctf(qmat[10], QMAT_SHIFT);
- q6 = vec_ctf(qmat[12], QMAT_SHIFT);
- q7 = vec_ctf(qmat[14], QMAT_SHIFT);
-
- row0 = vec_sel(vec_madd(row0, q0, negBias), vec_madd(row0, q0, bias),
- vec_cmpgt(row0, zero));
- row1 = vec_sel(vec_madd(row1, q1, negBias), vec_madd(row1, q1, bias),
- vec_cmpgt(row1, zero));
- row2 = vec_sel(vec_madd(row2, q2, negBias), vec_madd(row2, q2, bias),
- vec_cmpgt(row2, zero));
- row3 = vec_sel(vec_madd(row3, q3, negBias), vec_madd(row3, q3, bias),
- vec_cmpgt(row3, zero));
- row4 = vec_sel(vec_madd(row4, q4, negBias), vec_madd(row4, q4, bias),
- vec_cmpgt(row4, zero));
- row5 = vec_sel(vec_madd(row5, q5, negBias), vec_madd(row5, q5, bias),
- vec_cmpgt(row5, zero));
- row6 = vec_sel(vec_madd(row6, q6, negBias), vec_madd(row6, q6, bias),
- vec_cmpgt(row6, zero));
- row7 = vec_sel(vec_madd(row7, q7, negBias), vec_madd(row7, q7, bias),
- vec_cmpgt(row7, zero));
-
- q0 = vec_ctf(qmat[1], QMAT_SHIFT);
- q1 = vec_ctf(qmat[3], QMAT_SHIFT);
- q2 = vec_ctf(qmat[5], QMAT_SHIFT);
- q3 = vec_ctf(qmat[7], QMAT_SHIFT);
- q4 = vec_ctf(qmat[9], QMAT_SHIFT);
- q5 = vec_ctf(qmat[11], QMAT_SHIFT);
- q6 = vec_ctf(qmat[13], QMAT_SHIFT);
- q7 = vec_ctf(qmat[15], QMAT_SHIFT);
-
- alt0 = vec_sel(vec_madd(alt0, q0, negBias), vec_madd(alt0, q0, bias),
- vec_cmpgt(alt0, zero));
- alt1 = vec_sel(vec_madd(alt1, q1, negBias), vec_madd(alt1, q1, bias),
- vec_cmpgt(alt1, zero));
- alt2 = vec_sel(vec_madd(alt2, q2, negBias), vec_madd(alt2, q2, bias),
- vec_cmpgt(alt2, zero));
- alt3 = vec_sel(vec_madd(alt3, q3, negBias), vec_madd(alt3, q3, bias),
- vec_cmpgt(alt3, zero));
- alt4 = vec_sel(vec_madd(alt4, q4, negBias), vec_madd(alt4, q4, bias),
- vec_cmpgt(alt4, zero));
- alt5 = vec_sel(vec_madd(alt5, q5, negBias), vec_madd(alt5, q5, bias),
- vec_cmpgt(alt5, zero));
- alt6 = vec_sel(vec_madd(alt6, q6, negBias), vec_madd(alt6, q6, bias),
- vec_cmpgt(alt6, zero));
- alt7 = vec_sel(vec_madd(alt7, q7, negBias), vec_madd(alt7, q7, bias),
- vec_cmpgt(alt7, zero));
- }
-
-
- }
-
- // Store the data back into the original block
- {
- vector signed short data0, data1, data2, data3, data4, data5, data6, data7;
-
- data0 = vec_pack(vec_cts(row0, 0), vec_cts(alt0, 0));
- data1 = vec_pack(vec_cts(row1, 0), vec_cts(alt1, 0));
- data2 = vec_pack(vec_cts(row2, 0), vec_cts(alt2, 0));
- data3 = vec_pack(vec_cts(row3, 0), vec_cts(alt3, 0));
- data4 = vec_pack(vec_cts(row4, 0), vec_cts(alt4, 0));
- data5 = vec_pack(vec_cts(row5, 0), vec_cts(alt5, 0));
- data6 = vec_pack(vec_cts(row6, 0), vec_cts(alt6, 0));
- data7 = vec_pack(vec_cts(row7, 0), vec_cts(alt7, 0));
-
- {
- // Clamp for overflow
- vector signed int max_q_int, min_q_int;
- vector signed short max_q, min_q;
-
- LOAD4(max_q_int, &s->max_qcoeff);
- LOAD4(min_q_int, &s->min_qcoeff);
-
- max_q = vec_pack(max_q_int, max_q_int);
- min_q = vec_pack(min_q_int, min_q_int);
-
- data0 = vec_max(vec_min(data0, max_q), min_q);
- data1 = vec_max(vec_min(data1, max_q), min_q);
- data2 = vec_max(vec_min(data2, max_q), min_q);
- data4 = vec_max(vec_min(data4, max_q), min_q);
- data5 = vec_max(vec_min(data5, max_q), min_q);
- data6 = vec_max(vec_min(data6, max_q), min_q);
- data7 = vec_max(vec_min(data7, max_q), min_q);
- }
-
- {
- vector bool char zero_01, zero_23, zero_45, zero_67;
- vector signed char scanIndexes_01, scanIndexes_23, scanIndexes_45, scanIndexes_67;
- vector signed char negOne = vec_splat_s8(-1);
- vector signed char* scanPtr =
- (vector signed char*)(s->intra_scantable.inverse);
- signed char lastNonZeroChar;
-
- // Determine the largest non-zero index.
- zero_01 = vec_pack(vec_cmpeq(data0, (vector signed short)zero),
- vec_cmpeq(data1, (vector signed short)zero));
- zero_23 = vec_pack(vec_cmpeq(data2, (vector signed short)zero),
- vec_cmpeq(data3, (vector signed short)zero));
- zero_45 = vec_pack(vec_cmpeq(data4, (vector signed short)zero),
- vec_cmpeq(data5, (vector signed short)zero));
- zero_67 = vec_pack(vec_cmpeq(data6, (vector signed short)zero),
- vec_cmpeq(data7, (vector signed short)zero));
-
- // 64 biggest values
- scanIndexes_01 = vec_sel(scanPtr[0], negOne, zero_01);
- scanIndexes_23 = vec_sel(scanPtr[1], negOne, zero_23);
- scanIndexes_45 = vec_sel(scanPtr[2], negOne, zero_45);
- scanIndexes_67 = vec_sel(scanPtr[3], negOne, zero_67);
-
- // 32 largest values
- scanIndexes_01 = vec_max(scanIndexes_01, scanIndexes_23);
- scanIndexes_45 = vec_max(scanIndexes_45, scanIndexes_67);
-
- // 16 largest values
- scanIndexes_01 = vec_max(scanIndexes_01, scanIndexes_45);
-
- // 8 largest values
- scanIndexes_01 = vec_max(vec_mergeh(scanIndexes_01, negOne),
- vec_mergel(scanIndexes_01, negOne));
-
- // 4 largest values
- scanIndexes_01 = vec_max(vec_mergeh(scanIndexes_01, negOne),
- vec_mergel(scanIndexes_01, negOne));
-
- // 2 largest values
- scanIndexes_01 = vec_max(vec_mergeh(scanIndexes_01, negOne),
- vec_mergel(scanIndexes_01, negOne));
-
- // largest value
- scanIndexes_01 = vec_max(vec_mergeh(scanIndexes_01, negOne),
- vec_mergel(scanIndexes_01, negOne));
-
- scanIndexes_01 = vec_splat(scanIndexes_01, 0);
-
-
- vec_ste(scanIndexes_01, 0, &lastNonZeroChar);
-
- lastNonZero = lastNonZeroChar;
-
- // While the data is still in vectors we check for the transpose IDCT permute
- // and handle it using the vector unit if we can. This is the permute used
- // by the altivec idct, so it is common when using the altivec dct.
-
- if ((lastNonZero > 0) && (s->dsp.idct_permutation_type == FF_TRANSPOSE_IDCT_PERM)) {
- TRANSPOSE8(data0, data1, data2, data3, data4, data5, data6, data7);
- }
-
- vec_st(data0, 0, data);
- vec_st(data1, 16, data);
- vec_st(data2, 32, data);
- vec_st(data3, 48, data);
- vec_st(data4, 64, data);
- vec_st(data5, 80, data);
- vec_st(data6, 96, data);
- vec_st(data7, 112, data);
- }
- }
-
- // special handling of block[0]
- if (s->mb_intra) {
- if (!s->h263_aic) {
- if (n < 4)
- oldBaseValue /= s->y_dc_scale;
- else
- oldBaseValue /= s->c_dc_scale;
- }
-
- // Divide by 8, rounding the result
- data[0] = (oldBaseValue + 4) >> 3;
- }
-
- // We handled the transpose permutation above and we don't
- // need to permute the "no" permutation case.
- if ((lastNonZero > 0) &&
- (s->dsp.idct_permutation_type != FF_TRANSPOSE_IDCT_PERM) &&
- (s->dsp.idct_permutation_type != FF_NO_IDCT_PERM)) {
- ff_block_permute(data, s->dsp.idct_permutation,
- s->intra_scantable.scantable, lastNonZero);
- }
-
- return lastNonZero;
-}
-
/* AltiVec version of dct_unquantize_h263
this code assumes `block' is 16 bytes-aligned */
static void dct_unquantize_h263_altivec(MpegEncContext *s,
@@ -554,25 +112,10 @@ static void dct_unquantize_h263_altivec(MpegEncContext *s,
}
-void MPV_common_init_altivec(MpegEncContext *s)
+void ff_MPV_common_init_altivec(MpegEncContext *s)
{
if (!(av_get_cpu_flags() & AV_CPU_FLAG_ALTIVEC)) return;
- // Test to make sure that the dct required alignments are met.
- if ((((long)(s->q_intra_matrix) & 0x0f) != 0) ||
- (((long)(s->q_inter_matrix) & 0x0f) != 0)) {
- av_log(s->avctx, AV_LOG_INFO, "Internal Error: q-matrix blocks must be 16-byte aligned "
- "to use AltiVec DCT. Reverting to non-AltiVec version.\n");
- return;
- }
-
- if (((long)(s->intra_scantable.inverse) & 0x0f) != 0) {
- av_log(s->avctx, AV_LOG_INFO, "Internal Error: scan table blocks must be 16-byte aligned "
- "to use AltiVec DCT. Reverting to non-AltiVec version.\n");
- return;
- }
-
-
if ((s->avctx->dct_algo == FF_DCT_AUTO) ||
(s->avctx->dct_algo == FF_DCT_ALTIVEC)) {
s->dct_unquantize_h263_intra = dct_unquantize_h263_altivec;
diff --git a/gst-libs/ext/libav/libavcodec/ppc/regs.h b/gst-libs/ext/libav/libavcodec/ppc/regs.h
deleted file mode 100644
index 2edd639..0000000
--- a/gst-libs/ext/libav/libavcodec/ppc/regs.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (c) 2010 Mans Rullgard
- *
- * 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
- */
-
-#ifndef AVCODEC_PPC_REGS_H
-#define AVCODEC_PPC_REGS_H
-
-#include "libavutil/avutil.h"
-#include "config.h"
-
-#if HAVE_IBM_ASM
-# define r(n) AV_TOSTRING(n)
-# define f(n) AV_TOSTRING(n)
-# define v(n) AV_TOSTRING(n)
-#else
-# define r(n) AV_TOSTRING(r ## n)
-# define f(n) AV_TOSTRING(f ## n)
-# define v(n) AV_TOSTRING(v ## n)
-#endif
-
-#endif /* AVCODEC_PPC_REGS_H */
diff --git a/gst-libs/ext/libav/libavcodec/ppc/types_altivec.h b/gst-libs/ext/libav/libavcodec/ppc/types_altivec.h
deleted file mode 100644
index defa20e..0000000
--- a/gst-libs/ext/libav/libavcodec/ppc/types_altivec.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2006 Guillaume Poirier <gpoirier@mplayerhq.hu>
- *
- * 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
- */
-
-#ifndef AVCODEC_PPC_TYPES_ALTIVEC_H
-#define AVCODEC_PPC_TYPES_ALTIVEC_H
-
-/***********************************************************************
- * Vector types
- **********************************************************************/
-#define vec_u8 vector unsigned char
-#define vec_s8 vector signed char
-#define vec_u16 vector unsigned short
-#define vec_s16 vector signed short
-#define vec_u32 vector unsigned int
-#define vec_s32 vector signed int
-#define vec_f vector float
-
-/***********************************************************************
- * Null vector
- **********************************************************************/
-#define LOAD_ZERO const vec_u8 zerov = vec_splat_u8( 0 )
-
-#define zero_u8v (vec_u8) zerov
-#define zero_s8v (vec_s8) zerov
-#define zero_u16v (vec_u16) zerov
-#define zero_s16v (vec_s16) zerov
-#define zero_u32v (vec_u32) zerov
-#define zero_s32v (vec_s32) zerov
-
-#endif /* AVCODEC_PPC_TYPES_ALTIVEC_H */
diff --git a/gst-libs/ext/libav/libavcodec/ppc/util_altivec.h b/gst-libs/ext/libav/libavcodec/ppc/util_altivec.h
deleted file mode 100644
index 19ea962..0000000
--- a/gst-libs/ext/libav/libavcodec/ppc/util_altivec.h
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * 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
- * Contains misc utility macros and inline functions
- */
-
-#ifndef AVCODEC_PPC_UTIL_ALTIVEC_H
-#define AVCODEC_PPC_UTIL_ALTIVEC_H
-
-#include <stdint.h>
-
-#include "config.h"
-
-#if HAVE_ALTIVEC_H
-#include <altivec.h>
-#endif
-
-#include "types_altivec.h"
-
-// used to build registers permutation vectors (vcprm)
-// the 's' are for words in the _s_econd vector
-#define WORD_0 0x00,0x01,0x02,0x03
-#define WORD_1 0x04,0x05,0x06,0x07
-#define WORD_2 0x08,0x09,0x0a,0x0b
-#define WORD_3 0x0c,0x0d,0x0e,0x0f
-#define WORD_s0 0x10,0x11,0x12,0x13
-#define WORD_s1 0x14,0x15,0x16,0x17
-#define WORD_s2 0x18,0x19,0x1a,0x1b
-#define WORD_s3 0x1c,0x1d,0x1e,0x1f
-
-#define vcprm(a,b,c,d) (const vector unsigned char){WORD_ ## a, WORD_ ## b, WORD_ ## c, WORD_ ## d}
-#define vcii(a,b,c,d) (const vector float){FLOAT_ ## a, FLOAT_ ## b, FLOAT_ ## c, FLOAT_ ## d}
-
-// vcprmle is used to keep the same index as in the SSE version.
-// it's the same as vcprm, with the index inversed
-// ('le' is Little Endian)
-#define vcprmle(a,b,c,d) vcprm(d,c,b,a)
-
-// used to build inverse/identity vectors (vcii)
-// n is _n_egative, p is _p_ositive
-#define FLOAT_n -1.
-#define FLOAT_p 1.
-
-
-// Transpose 8x8 matrix of 16-bit elements (in-place)
-#define TRANSPOSE8(a,b,c,d,e,f,g,h) \
-do { \
- vector signed short A1, B1, C1, D1, E1, F1, G1, H1; \
- vector signed short A2, B2, C2, D2, E2, F2, G2, H2; \
- \
- A1 = vec_mergeh (a, e); \
- B1 = vec_mergel (a, e); \
- C1 = vec_mergeh (b, f); \
- D1 = vec_mergel (b, f); \
- E1 = vec_mergeh (c, g); \
- F1 = vec_mergel (c, g); \
- G1 = vec_mergeh (d, h); \
- H1 = vec_mergel (d, h); \
- \
- A2 = vec_mergeh (A1, E1); \
- B2 = vec_mergel (A1, E1); \
- C2 = vec_mergeh (B1, F1); \
- D2 = vec_mergel (B1, F1); \
- E2 = vec_mergeh (C1, G1); \
- F2 = vec_mergel (C1, G1); \
- G2 = vec_mergeh (D1, H1); \
- H2 = vec_mergel (D1, H1); \
- \
- a = vec_mergeh (A2, E2); \
- b = vec_mergel (A2, E2); \
- c = vec_mergeh (B2, F2); \
- d = vec_mergel (B2, F2); \
- e = vec_mergeh (C2, G2); \
- f = vec_mergel (C2, G2); \
- g = vec_mergeh (D2, H2); \
- h = vec_mergel (D2, H2); \
-} while (0)
-
-
-/** @brief loads unaligned vector @a *src with offset @a offset
- and returns it */
-static inline vector unsigned char unaligned_load(int offset, uint8_t *src)
-{
- register vector unsigned char first = vec_ld(offset, src);
- register vector unsigned char second = vec_ld(offset+15, src);
- register vector unsigned char mask = vec_lvsl(offset, src);
- return vec_perm(first, second, mask);
-}
-
-/**
- * loads vector known misalignment
- * @param perm_vec the align permute vector to combine the two loads from lvsl
- */
-static inline vec_u8 load_with_perm_vec(int offset, uint8_t *src, vec_u8 perm_vec)
-{
- vec_u8 a = vec_ld(offset, src);
- vec_u8 b = vec_ld(offset+15, src);
- return vec_perm(a, b, perm_vec);
-}
-
-#endif /* AVCODEC_PPC_UTIL_ALTIVEC_H */
diff --git a/gst-libs/ext/libav/libavcodec/ppc/vc1dsp_altivec.c b/gst-libs/ext/libav/libavcodec/ppc/vc1dsp_altivec.c
index 307e0e9..6c110db 100644
--- a/gst-libs/ext/libav/libavcodec/ppc/vc1dsp_altivec.c
+++ b/gst-libs/ext/libav/libavcodec/ppc/vc1dsp_altivec.c
@@ -19,12 +19,11 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "libavutil/ppc/types_altivec.h"
+#include "libavutil/ppc/util_altivec.h"
#include "libavcodec/dsputil.h"
#include "libavcodec/vc1dsp.h"
-#include "util_altivec.h"
-#include "dsputil_altivec.h"
-
// main steps of 8x8 transform
#define STEP8(s0, s1, s2, s3, s4, s5, s6, s7, vec_rnd) \
do { \
@@ -326,13 +325,13 @@ static void vc1_inv_trans_8x4_altivec(uint8_t *dest, int stride, DCTELEM *block)
#define OP_U8_ALTIVEC PUT_OP_U8_ALTIVEC
#define PREFIX_no_rnd_vc1_chroma_mc8_altivec put_no_rnd_vc1_chroma_mc8_altivec
-#include "h264_template_altivec.c"
+#include "h264_altivec_template.c"
#undef OP_U8_ALTIVEC
#undef PREFIX_no_rnd_vc1_chroma_mc8_altivec
#define OP_U8_ALTIVEC AVG_OP_U8_ALTIVEC
#define PREFIX_no_rnd_vc1_chroma_mc8_altivec avg_no_rnd_vc1_chroma_mc8_altivec
-#include "h264_template_altivec.c"
+#include "h264_altivec_template.c"
#undef OP_U8_ALTIVEC
#undef PREFIX_no_rnd_vc1_chroma_mc8_altivec
diff --git a/gst-libs/ext/libav/libavcodec/ppc/videodsp_ppc.c b/gst-libs/ext/libav/libavcodec/ppc/videodsp_ppc.c
new file mode 100644
index 0000000..1865b19
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/ppc/videodsp_ppc.c
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2003-2004 Romain Dolbeau
+ *
+ * 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
+ */
+
+#include "libavcodec/videodsp.h"
+
+static void prefetch_ppc(uint8_t *mem, ptrdiff_t stride, int h)
+{
+ register const uint8_t *p = mem;
+ do {
+ __asm__ volatile ("dcbt 0,%0" : : "r" (p));
+ p += stride;
+ } while(--h);
+}
+
+void ff_videodsp_init_ppc(VideoDSPContext *ctx, int bpc)
+{
+ ctx->prefetch = prefetch_ppc;
+}
diff --git a/gst-libs/ext/libav/libavcodec/ppc/vp3dsp_altivec.c b/gst-libs/ext/libav/libavcodec/ppc/vp3dsp_altivec.c
index bbe9170..75a3677 100644
--- a/gst-libs/ext/libav/libavcodec/ppc/vp3dsp_altivec.c
+++ b/gst-libs/ext/libav/libavcodec/ppc/vp3dsp_altivec.c
@@ -18,9 +18,16 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "config.h"
+#include "libavutil/attributes.h"
+#include "libavutil/cpu.h"
+#include "libavcodec/vp3dsp.h"
+
+#if HAVE_ALTIVEC
+
+#include "libavutil/ppc/types_altivec.h"
+#include "libavutil/ppc/util_altivec.h"
#include "libavcodec/dsputil.h"
-#include "util_altivec.h"
-#include "types_altivec.h"
#include "dsputil_altivec.h"
static const vec_s16 constants =
@@ -107,25 +114,7 @@ static inline vec_s16 M16(vec_s16 a, vec_s16 C)
#define ADD8(a) vec_add(a, eight)
#define SHIFT4(a) vec_sra(a, four)
-void ff_vp3_idct_altivec(DCTELEM block[64])
-{
- IDCT_START
-
- IDCT_1D(NOP, NOP)
- TRANSPOSE8(b0, b1, b2, b3, b4, b5, b6, b7);
- IDCT_1D(ADD8, SHIFT4)
-
- vec_st(b0, 0x00, block);
- vec_st(b1, 0x10, block);
- vec_st(b2, 0x20, block);
- vec_st(b3, 0x30, block);
- vec_st(b4, 0x40, block);
- vec_st(b5, 0x50, block);
- vec_st(b6, 0x60, block);
- vec_st(b7, 0x70, block);
-}
-
-void ff_vp3_idct_put_altivec(uint8_t *dst, int stride, DCTELEM block[64])
+static void vp3_idct_put_altivec(uint8_t *dst, int stride, DCTELEM block[64])
{
vec_u8 t;
IDCT_START
@@ -153,7 +142,7 @@ void ff_vp3_idct_put_altivec(uint8_t *dst, int stride, DCTELEM block[64])
PUT(b7)
}
-void ff_vp3_idct_add_altivec(uint8_t *dst, int stride, DCTELEM block[64])
+static void vp3_idct_add_altivec(uint8_t *dst, int stride, DCTELEM block[64])
{
LOAD_ZERO;
vec_u8 t, vdst;
@@ -183,3 +172,16 @@ void ff_vp3_idct_add_altivec(uint8_t *dst, int stride, DCTELEM block[64])
ADD(b6) dst += stride;
ADD(b7)
}
+
+#endif /* HAVE_ALTIVEC */
+
+av_cold void ff_vp3dsp_init_ppc(VP3DSPContext *c, int flags)
+{
+#if HAVE_ALTIVEC
+ if (av_get_cpu_flags() & AV_CPU_FLAG_ALTIVEC) {
+ c->idct_put = vp3_idct_put_altivec;
+ c->idct_add = vp3_idct_add_altivec;
+ c->idct_perm = FF_TRANSPOSE_IDCT_PERM;
+ }
+#endif
+}
diff --git a/gst-libs/ext/libav/libavcodec/ppc/vp8dsp_altivec.c b/gst-libs/ext/libav/libavcodec/ppc/vp8dsp_altivec.c
index 06874b8..4336453 100644
--- a/gst-libs/ext/libav/libavcodec/ppc/vp8dsp_altivec.c
+++ b/gst-libs/ext/libav/libavcodec/ppc/vp8dsp_altivec.c
@@ -1,4 +1,4 @@
-/**
+/*
* VP8 compatible video decoder
*
* Copyright (C) 2010 David Conrad
@@ -21,10 +21,11 @@
*/
#include "libavutil/cpu.h"
+#include "libavutil/mem.h"
+#include "libavutil/ppc/types_altivec.h"
+#include "libavutil/ppc/util_altivec.h"
#include "libavcodec/vp8dsp.h"
#include "dsputil_altivec.h"
-#include "types_altivec.h"
-#include "util_altivec.h"
#define REPT4(...) { __VA_ARGS__, __VA_ARGS__, __VA_ARGS__, __VA_ARGS__ }
@@ -75,8 +76,8 @@ static const vec_s8 h_subpel_filters_outer[3] =
dstv = vec_sra(dstv, c7)
static av_always_inline
-void put_vp8_epel_h_altivec_core(uint8_t *dst, int dst_stride,
- uint8_t *src, int src_stride,
+void put_vp8_epel_h_altivec_core(uint8_t *dst, ptrdiff_t dst_stride,
+ uint8_t *src, ptrdiff_t src_stride,
int h, int mx, int w, int is6tap)
{
LOAD_H_SUBPEL_FILTER(mx-1);
@@ -161,8 +162,8 @@ static const vec_u8 v_subpel_filters[7] =
dstv = vec_sra(dstv, c7)
static av_always_inline
-void put_vp8_epel_v_altivec_core(uint8_t *dst, int dst_stride,
- uint8_t *src, int src_stride,
+void put_vp8_epel_v_altivec_core(uint8_t *dst, ptrdiff_t dst_stride,
+ uint8_t *src, ptrdiff_t src_stride,
int h, int my, int w, int is6tap)
{
LOAD_V_SUBPEL_FILTER(my-1);
@@ -226,19 +227,19 @@ void put_vp8_epel_v_altivec_core(uint8_t *dst, int dst_stride,
#define EPEL_FUNCS(WIDTH, TAPS) \
static av_noinline \
-void put_vp8_epel ## WIDTH ## _h ## TAPS ## _altivec(uint8_t *dst, int dst_stride, uint8_t *src, int src_stride, int h, int mx, int my) \
+void put_vp8_epel ## WIDTH ## _h ## TAPS ## _altivec(uint8_t *dst, ptrdiff_t dst_stride, uint8_t *src, ptrdiff_t src_stride, int h, int mx, int my) \
{ \
put_vp8_epel_h_altivec_core(dst, dst_stride, src, src_stride, h, mx, WIDTH, TAPS == 6); \
} \
\
static av_noinline \
-void put_vp8_epel ## WIDTH ## _v ## TAPS ## _altivec(uint8_t *dst, int dst_stride, uint8_t *src, int src_stride, int h, int mx, int my) \
+void put_vp8_epel ## WIDTH ## _v ## TAPS ## _altivec(uint8_t *dst, ptrdiff_t dst_stride, uint8_t *src, ptrdiff_t src_stride, int h, int mx, int my) \
{ \
put_vp8_epel_v_altivec_core(dst, dst_stride, src, src_stride, h, my, WIDTH, TAPS == 6); \
}
#define EPEL_HV(WIDTH, HTAPS, VTAPS) \
-static void put_vp8_epel ## WIDTH ## _h ## HTAPS ## v ## VTAPS ## _altivec(uint8_t *dst, int stride, uint8_t *src, int s, int h, int mx, int my) \
+static void put_vp8_epel ## WIDTH ## _h ## HTAPS ## v ## VTAPS ## _altivec(uint8_t *dst, ptrdiff_t stride, uint8_t *src, ptrdiff_t s, int h, int mx, int my) \
{ \
DECLARE_ALIGNED(16, uint8_t, tmp)[(2*WIDTH+5)*16]; \
if (VTAPS == 6) { \
@@ -266,9 +267,9 @@ EPEL_HV(4, 4,6)
EPEL_HV(4, 6,4)
EPEL_HV(4, 4,4)
-static void put_vp8_pixels16_altivec(uint8_t *dst, int stride, uint8_t *src, int s, int h, int mx, int my)
+static void put_vp8_pixels16_altivec(uint8_t *dst, ptrdiff_t stride, uint8_t *src, ptrdiff_t s, int h, int mx, int my)
{
- put_pixels16_altivec(dst, src, stride, h);
+ ff_put_pixels16_altivec(dst, src, stride, h);
}
av_cold void ff_vp8dsp_init_altivec(VP8DSPContext *c)
diff --git a/gst-libs/ext/libav/libavcodec/proresdata.c b/gst-libs/ext/libav/libavcodec/proresdata.c
new file mode 100644
index 0000000..fcaf32a
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/proresdata.c
@@ -0,0 +1,72 @@
+/*
+ * Apple ProRes compatible decoder
+ *
+ * Copyright (c) 2010-2011 Maxim Poliakovski
+ *
+ * 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
+ */
+
+#include "proresdata.h"
+
+const uint8_t ff_prores_progressive_scan[64] = {
+ 0, 1, 8, 9, 2, 3, 10, 11,
+ 16, 17, 24, 25, 18, 19, 26, 27,
+ 4, 5, 12, 20, 13, 6, 7, 14,
+ 21, 28, 29, 22, 15, 23, 30, 31,
+ 32, 33, 40, 48, 41, 34, 35, 42,
+ 49, 56, 57, 50, 43, 36, 37, 44,
+ 51, 58, 59, 52, 45, 38, 39, 46,
+ 53, 60, 61, 54, 47, 55, 62, 63
+};
+
+const uint8_t ff_prores_interlaced_scan[64] = {
+ 0, 8, 1, 9, 16, 24, 17, 25,
+ 2, 10, 3, 11, 18, 26, 19, 27,
+ 32, 40, 33, 34, 41, 48, 56, 49,
+ 42, 35, 43, 50, 57, 58, 51, 59,
+ 4, 12, 5, 6, 13, 20, 28, 21,
+ 14, 7, 15, 22, 29, 36, 44, 37,
+ 30, 23, 31, 38, 45, 52, 60, 53,
+ 46, 39, 47, 54, 61, 62, 55, 63
+};
+
+
+const uint8_t ff_prores_dc_codebook[4] = {
+ 0x04, // rice_order = 0, exp_golomb_order = 1, switch_bits = 0
+ 0x28, // rice_order = 1, exp_golomb_order = 2, switch_bits = 0
+ 0x4D, // rice_order = 2, exp_golomb_order = 3, switch_bits = 1
+ 0x70 // rice_order = 3, exp_golomb_order = 4, switch_bits = 0
+};
+
+const uint8_t ff_prores_ac_codebook[7] = {
+ 0x04, // rice_order = 0, exp_golomb_order = 1, switch_bits = 0
+ 0x28, // rice_order = 1, exp_golomb_order = 2, switch_bits = 0
+ 0x4C, // rice_order = 2, exp_golomb_order = 3, switch_bits = 0
+ 0x05, // rice_order = 0, exp_golomb_order = 1, switch_bits = 1
+ 0x29, // rice_order = 1, exp_golomb_order = 2, switch_bits = 1
+ 0x06, // rice_order = 0, exp_golomb_order = 1, switch_bits = 2
+ 0x0A, // rice_order = 0, exp_golomb_order = 2, switch_bits = 2
+};
+
+/**
+ * Lookup tables for adaptive switching between codebooks
+ * according with previous run/level value.
+ */
+const uint8_t ff_prores_run_to_cb_index[16] =
+ { 5, 5, 3, 3, 0, 4, 4, 4, 4, 1, 1, 1, 1, 1, 1, 2 };
+
+const uint8_t ff_prores_lev_to_cb_index[10] = { 0, 6, 3, 5, 0, 1, 1, 1, 1, 2 };
diff --git a/gst-libs/ext/libav/libavcodec/proresdata.h b/gst-libs/ext/libav/libavcodec/proresdata.h
new file mode 100644
index 0000000..1e5d05e
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/proresdata.h
@@ -0,0 +1,39 @@
+/*
+ * Apple ProRes compatible decoder
+ *
+ * Copyright (c) 2010-2011 Maxim Poliakovski
+ *
+ * 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
+ */
+
+#ifndef AVCODEC_PRORESDATA_H
+#define AVCODEC_PRORESDATA_H
+
+#include <stdint.h>
+
+#define FRAME_ID MKBETAG('i', 'c', 'p', 'f')
+
+extern const uint8_t ff_prores_progressive_scan[64];
+extern const uint8_t ff_prores_interlaced_scan[64];
+
+#define FIRST_DC_CB 0xB8 // rice_order = 5, exp_golomb_order = 6, switch_bits = 0
+extern const uint8_t ff_prores_dc_codebook[4];
+extern const uint8_t ff_prores_ac_codebook[7];
+extern const uint8_t ff_prores_run_to_cb_index[16];
+extern const uint8_t ff_prores_lev_to_cb_index[10];
+
+#endif /* AVCODEC_PRORESDATA_H */
diff --git a/gst-libs/ext/libav/libavcodec/proresdec.c b/gst-libs/ext/libav/libavcodec/proresdec.c
index bc99665..4b196f6 100644
--- a/gst-libs/ext/libav/libavcodec/proresdec.c
+++ b/gst-libs/ext/libav/libavcodec/proresdec.c
@@ -34,6 +34,8 @@
#include "libavutil/intmath.h"
#include "avcodec.h"
+#include "internal.h"
+#include "proresdata.h"
#include "proresdsp.h"
#include "get_bits.h"
@@ -42,7 +44,10 @@ typedef struct {
int slice_num;
int x_pos, y_pos;
int slice_width;
- DECLARE_ALIGNED(16, DCTELEM, blocks[8 * 4 * 64]);
+ int prev_slice_sf; ///< scalefactor of the previous decoded slice
+ DECLARE_ALIGNED(16, DCTELEM, blocks)[8 * 4 * 64];
+ DECLARE_ALIGNED(16, int16_t, qmat_luma_scaled)[64];
+ DECLARE_ALIGNED(16, int16_t, qmat_chroma_scaled)[64];
} ProresThreadData;
typedef struct {
@@ -56,9 +61,6 @@ typedef struct {
uint8_t qmat_luma[64]; ///< dequantization matrix for luma
uint8_t qmat_chroma[64]; ///< dequantization matrix for chroma
int qmat_changed; ///< 1 - global quantization matrices changed
- int prev_slice_sf; ///< scalefactor of the previous decoded slice
- DECLARE_ALIGNED(16, int16_t, qmat_luma_scaled[64]);
- DECLARE_ALIGNED(16, int16_t, qmat_chroma_scaled[64]);
int total_slices; ///< total number of slices in a picture
ProresThreadData *slice_data;
int pic_num;
@@ -75,29 +77,6 @@ typedef struct {
} ProresContext;
-static const uint8_t progressive_scan[64] = {
- 0, 1, 8, 9, 2, 3, 10, 11,
- 16, 17, 24, 25, 18, 19, 26, 27,
- 4, 5, 12, 20, 13, 6, 7, 14,
- 21, 28, 29, 22, 15, 23, 30, 31,
- 32, 33, 40, 48, 41, 34, 35, 42,
- 49, 56, 57, 50, 43, 36, 37, 44,
- 51, 58, 59, 52, 45, 38, 39, 46,
- 53, 60, 61, 54, 47, 55, 62, 63
-};
-
-static const uint8_t interlaced_scan[64] = {
- 0, 8, 1, 9, 16, 24, 17, 25,
- 2, 10, 3, 11, 18, 26, 19, 27,
- 32, 40, 33, 34, 41, 48, 56, 49,
- 42, 35, 43, 50, 57, 58, 51, 59,
- 4, 12, 5, 6, 13, 20, 28, 21,
- 14, 7, 15, 22, 29, 36, 44, 37,
- 30, 23, 31, 38, 45, 52, 60, 53,
- 46, 39, 47, 54, 61, 62, 55, 63
-};
-
-
static av_cold int decode_init(AVCodecContext *avctx)
{
ProresContext *ctx = avctx->priv_data;
@@ -116,7 +95,6 @@ static av_cold int decode_init(AVCodecContext *avctx)
ctx->scantable_type = -1; // set scantable type to uninitialized
memset(ctx->qmat_luma, 4, 64);
memset(ctx->qmat_chroma, 4, 64);
- ctx->prev_slice_sf = 0;
return 0;
}
@@ -162,10 +140,10 @@ static int decode_frame_header(ProresContext *ctx, const uint8_t *buf,
ctx->num_chroma_blocks = (1 << ctx->chroma_factor) >> 1;
switch (ctx->chroma_factor) {
case 2:
- avctx->pix_fmt = PIX_FMT_YUV422P10;
+ avctx->pix_fmt = AV_PIX_FMT_YUV422P10;
break;
case 3:
- avctx->pix_fmt = PIX_FMT_YUV444P10;
+ avctx->pix_fmt = AV_PIX_FMT_YUV444P10;
break;
default:
av_log(avctx, AV_LOG_ERROR,
@@ -176,10 +154,10 @@ static int decode_frame_header(ProresContext *ctx, const uint8_t *buf,
if (ctx->scantable_type != ctx->frame_type) {
if (!ctx->frame_type)
ff_init_scantable(ctx->dsp.idct_permutation, &ctx->scantable,
- progressive_scan);
+ ff_prores_progressive_scan);
else
ff_init_scantable(ctx->dsp.idct_permutation, &ctx->scantable,
- interlaced_scan);
+ ff_prores_interlaced_scan);
ctx->scantable_type = ctx->frame_type;
}
@@ -190,9 +168,13 @@ static int decode_frame_header(ProresContext *ctx, const uint8_t *buf,
ctx->picture.interlaced_frame = 0;
}
+ avctx->color_primaries = buf[14];
+ avctx->color_trc = buf[15];
+ avctx->colorspace = buf[16];
+
ctx->alpha_info = buf[17] & 0xf;
if (ctx->alpha_info)
- av_log_missing_feature(avctx, "alpha channel", 0);
+ av_log_missing_feature(avctx, "Alpha channel", 0);
ctx->qmat_changed = 0;
ptr = buf + 20;
@@ -296,9 +278,11 @@ static int decode_picture_header(ProresContext *ctx, const uint8_t *buf,
for (i = 0; i < num_slices; i++) {
ctx->slice_data[i].index = data_ptr;
+ ctx->slice_data[i].prev_slice_sf = 0;
data_ptr += AV_RB16(index_ptr + i * 2);
}
ctx->slice_data[i].index = data_ptr;
+ ctx->slice_data[i].prev_slice_sf = 0;
if (data_ptr > buf + data_size) {
av_log(avctx, AV_LOG_ERROR, "out of slice data\n");
@@ -312,7 +296,7 @@ static int decode_picture_header(ProresContext *ctx, const uint8_t *buf,
/**
* Read an unsigned rice/exp golomb codeword.
*/
-static inline int decode_vlc_codeword(GetBitContext *gb, uint8_t codebook)
+static inline int decode_vlc_codeword(GetBitContext *gb, unsigned codebook)
{
unsigned int rice_order, exp_order, switch_bits;
unsigned int buf, code;
@@ -353,16 +337,6 @@ static inline int decode_vlc_codeword(GetBitContext *gb, uint8_t codebook)
#define LSB2SIGN(x) (-((x) & 1))
#define TOSIGNED(x) (((x) >> 1) ^ LSB2SIGN(x))
-#define FIRST_DC_CB 0xB8 // rice_order = 5, exp_golomb_order = 6, switch_bits = 0
-
-static uint8_t dc_codebook[4] = {
- 0x04, // rice_order = 0, exp_golomb_order = 1, switch_bits = 0
- 0x28, // rice_order = 1, exp_golomb_order = 2, switch_bits = 0
- 0x4D, // rice_order = 2, exp_golomb_order = 3, switch_bits = 1
- 0x70 // rice_order = 3, exp_golomb_order = 4, switch_bits = 0
-};
-
-
/**
* Decode DC coefficients for all blocks in a slice.
*/
@@ -381,7 +355,7 @@ static inline void decode_dc_coeffs(GetBitContext *gb, DCTELEM *out,
delta = 3;
for (i = 1; i < nblocks; i++, out += 64) {
- code = decode_vlc_codeword(gb, dc_codebook[FFMIN(FFABS(delta), 3)]);
+ code = decode_vlc_codeword(gb, ff_prores_dc_codebook[FFMIN(FFABS(delta), 3)]);
sign = -(((delta >> 15) & 1) ^ (code & 1));
delta = (((code + 1) >> 1) ^ sign) - sign;
@@ -391,26 +365,6 @@ static inline void decode_dc_coeffs(GetBitContext *gb, DCTELEM *out,
}
-static uint8_t ac_codebook[7] = {
- 0x04, // rice_order = 0, exp_golomb_order = 1, switch_bits = 0
- 0x28, // rice_order = 1, exp_golomb_order = 2, switch_bits = 0
- 0x4C, // rice_order = 2, exp_golomb_order = 3, switch_bits = 0
- 0x05, // rice_order = 0, exp_golomb_order = 1, switch_bits = 1
- 0x29, // rice_order = 1, exp_golomb_order = 2, switch_bits = 1
- 0x06, // rice_order = 0, exp_golomb_order = 1, switch_bits = 2
- 0x0A, // rice_order = 0, exp_golomb_order = 2, switch_bits = 2
-};
-
-/**
- * Lookup tables for adaptive switching between codebooks
- * according with previous run/level value.
- */
-static uint8_t run_to_cb_index[16] =
- { 5, 5, 3, 3, 0, 4, 4, 4, 4, 1, 1, 1, 1, 1, 1, 2 };
-
-static uint8_t lev_to_cb_index[10] = { 0, 6, 3, 5, 0, 1, 1, 1, 1, 2 };
-
-
/**
* Decode AC coefficients for all blocks in a slice.
*/
@@ -430,20 +384,20 @@ static inline void decode_ac_coeffs(GetBitContext *gb, DCTELEM *out,
block_mask = blocks_per_slice - 1;
for (pos = blocks_per_slice - 1; pos < max_coeffs;) {
- run_cb_index = run_to_cb_index[FFMIN(run, 15)];
- lev_cb_index = lev_to_cb_index[FFMIN(level, 9)];
+ run_cb_index = ff_prores_run_to_cb_index[FFMIN(run, 15)];
+ lev_cb_index = ff_prores_lev_to_cb_index[FFMIN(level, 9)];
bits_left = get_bits_left(gb);
if (bits_left <= 0 || (bits_left <= 8 && !show_bits(gb, bits_left)))
return;
- run = decode_vlc_codeword(gb, ac_codebook[run_cb_index]);
+ run = decode_vlc_codeword(gb, ff_prores_ac_codebook[run_cb_index]);
bits_left = get_bits_left(gb);
if (bits_left <= 0 || (bits_left <= 8 && !show_bits(gb, bits_left)))
return;
- level = decode_vlc_codeword(gb, ac_codebook[lev_cb_index]) + 1;
+ level = decode_vlc_codeword(gb, ff_prores_ac_codebook[lev_cb_index]) + 1;
pos += run + 1;
if (pos >= max_coeffs)
@@ -464,7 +418,7 @@ static void decode_slice_plane(ProresContext *ctx, ProresThreadData *td,
int data_size, uint16_t *out_ptr,
int linesize, int mbs_per_slice,
int blocks_per_mb, int plane_size_factor,
- const int16_t *qmat)
+ const int16_t *qmat, int is_chroma)
{
GetBitContext gb;
DCTELEM *block_ptr;
@@ -484,18 +438,33 @@ static void decode_slice_plane(ProresContext *ctx, ProresThreadData *td,
/* inverse quantization, inverse transform and output */
block_ptr = td->blocks;
- for (mb_num = 0; mb_num < mbs_per_slice; mb_num++, out_ptr += blocks_per_mb * 4) {
- ctx->dsp.idct_put(out_ptr, linesize, block_ptr, qmat);
- block_ptr += 64;
- if (blocks_per_mb > 2) {
- ctx->dsp.idct_put(out_ptr + 8, linesize, block_ptr, qmat);
+ if (!is_chroma) {
+ for (mb_num = 0; mb_num < mbs_per_slice; mb_num++, out_ptr += blocks_per_mb * 4) {
+ ctx->dsp.idct_put(out_ptr, linesize, block_ptr, qmat);
+ block_ptr += 64;
+ if (blocks_per_mb > 2) {
+ ctx->dsp.idct_put(out_ptr + 8, linesize, block_ptr, qmat);
+ block_ptr += 64;
+ }
+ ctx->dsp.idct_put(out_ptr + linesize * 4, linesize, block_ptr, qmat);
block_ptr += 64;
+ if (blocks_per_mb > 2) {
+ ctx->dsp.idct_put(out_ptr + linesize * 4 + 8, linesize, block_ptr, qmat);
+ block_ptr += 64;
+ }
}
- ctx->dsp.idct_put(out_ptr + linesize * 4, linesize, block_ptr, qmat);
- block_ptr += 64;
- if (blocks_per_mb > 2) {
- ctx->dsp.idct_put(out_ptr + linesize * 4 + 8, linesize, block_ptr, qmat);
+ } else {
+ for (mb_num = 0; mb_num < mbs_per_slice; mb_num++, out_ptr += blocks_per_mb * 4) {
+ ctx->dsp.idct_put(out_ptr, linesize, block_ptr, qmat);
+ block_ptr += 64;
+ ctx->dsp.idct_put(out_ptr + linesize * 4, linesize, block_ptr, qmat);
block_ptr += 64;
+ if (blocks_per_mb > 2) {
+ ctx->dsp.idct_put(out_ptr + 8, linesize, block_ptr, qmat);
+ block_ptr += 64;
+ ctx->dsp.idct_put(out_ptr + linesize * 4 + 8, linesize, block_ptr, qmat);
+ block_ptr += 64;
+ }
}
}
}
@@ -563,11 +532,11 @@ static int decode_slice(AVCodecContext *avctx, void *tdata)
/* scale quantization matrixes according with slice's scale factor */
/* TODO: this can be SIMD-optimized a lot */
- if (ctx->qmat_changed || sf != ctx->prev_slice_sf) {
- ctx->prev_slice_sf = sf;
+ if (ctx->qmat_changed || sf != td->prev_slice_sf) {
+ td->prev_slice_sf = sf;
for (i = 0; i < 64; i++) {
- ctx->qmat_luma_scaled[ctx->dsp.idct_permutation[i]] = ctx->qmat_luma[i] * sf;
- ctx->qmat_chroma_scaled[ctx->dsp.idct_permutation[i]] = ctx->qmat_chroma[i] * sf;
+ td->qmat_luma_scaled[ctx->dsp.idct_permutation[i]] = ctx->qmat_luma[i] * sf;
+ td->qmat_chroma_scaled[ctx->dsp.idct_permutation[i]] = ctx->qmat_chroma[i] * sf;
}
}
@@ -576,7 +545,7 @@ static int decode_slice(AVCodecContext *avctx, void *tdata)
(uint16_t*) (y_data + (mb_y_pos << 4) * y_linesize +
(mb_x_pos << 5)), y_linesize,
mbs_per_slice, 4, slice_width_factor + 2,
- ctx->qmat_luma_scaled);
+ td->qmat_luma_scaled, 0);
/* decode U chroma plane */
decode_slice_plane(ctx, td, buf + hdr_size + y_data_size, u_data_size,
@@ -584,7 +553,7 @@ static int decode_slice(AVCodecContext *avctx, void *tdata)
(mb_x_pos << ctx->mb_chroma_factor)),
u_linesize, mbs_per_slice, ctx->num_chroma_blocks,
slice_width_factor + ctx->chroma_factor - 1,
- ctx->qmat_chroma_scaled);
+ td->qmat_chroma_scaled, 1);
/* decode V chroma plane */
decode_slice_plane(ctx, td, buf + hdr_size + y_data_size + u_data_size,
@@ -593,7 +562,7 @@ static int decode_slice(AVCodecContext *avctx, void *tdata)
(mb_x_pos << ctx->mb_chroma_factor)),
v_linesize, mbs_per_slice, ctx->num_chroma_blocks,
slice_width_factor + ctx->chroma_factor - 1,
- ctx->qmat_chroma_scaled);
+ td->qmat_chroma_scaled, 1);
return 0;
}
@@ -630,10 +599,9 @@ static int decode_picture(ProresContext *ctx, int pic_num,
}
-#define FRAME_ID MKBETAG('i', 'c', 'p', 'f')
#define MOVE_DATA_PTR(nbytes) buf += (nbytes); buf_size -= (nbytes)
-static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
+static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
AVPacket *avpkt)
{
ProresContext *ctx = avctx->priv_data;
@@ -661,7 +629,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
avctx->release_buffer(avctx, picture);
picture->reference = 0;
- if (avctx->get_buffer(avctx, picture) < 0)
+ if (ff_get_buffer(avctx, picture) < 0)
return -1;
for (pic_num = 0; ctx->picture.interlaced_frame - pic_num + 1; pic_num++) {
@@ -675,7 +643,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
MOVE_DATA_PTR(pic_data_size);
}
- *data_size = sizeof(AVPicture);
+ *got_frame = 1;
*(AVFrame*) data = *avctx->coded_frame;
return avpkt->size;
@@ -698,7 +666,7 @@ static av_cold int decode_close(AVCodecContext *avctx)
AVCodec ff_prores_decoder = {
.name = "prores",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_PRORES,
+ .id = AV_CODEC_ID_PRORES,
.priv_data_size = sizeof(ProresContext),
.init = decode_init,
.close = decode_close,
diff --git a/gst-libs/ext/libav/libavcodec/proresdsp.c b/gst-libs/ext/libav/libavcodec/proresdsp.c
index 7e753e9..5996904 100644
--- a/gst-libs/ext/libav/libavcodec/proresdsp.c
+++ b/gst-libs/ext/libav/libavcodec/proresdsp.c
@@ -22,6 +22,7 @@
#include "proresdsp.h"
#include "simple_idct.h"
+#include "libavutil/common.h"
#define BIAS (1 << (PRORES_BITS_PER_SAMPLE - 1)) ///< bias value for converting signed pixels into unsigned ones
#define CLIP_MIN (1 << (PRORES_BITS_PER_SAMPLE - 8)) ///< minimum value for clipping resulting pixels
@@ -29,6 +30,7 @@
#define CLIP_AND_BIAS(x) (av_clip((x) + BIAS, CLIP_MIN, CLIP_MAX))
+#if CONFIG_PRORES_DECODER
/**
* Add bias value, clamp and output pixels of a slice
*/
@@ -50,14 +52,38 @@ static void prores_idct_put_c(uint16_t *out, int linesize, DCTELEM *block, const
ff_prores_idct(block, qmat);
put_pixels(out, linesize >> 1, block);
}
+#endif
+
+#if CONFIG_PRORES_ENCODER
+static void prores_fdct_c(const uint16_t *src, int linesize, DCTELEM *block)
+{
+ int x, y;
+ const uint16_t *tsrc = src;
+
+ for (y = 0; y < 8; y++) {
+ for (x = 0; x < 8; x++)
+ block[y * 8 + x] = tsrc[x];
+ tsrc += linesize >> 1;
+ }
+ ff_jpeg_fdct_islow_10(block);
+}
+#endif
void ff_proresdsp_init(ProresDSPContext *dsp)
{
+#if CONFIG_PRORES_DECODER
dsp->idct_put = prores_idct_put_c;
dsp->idct_permutation_type = FF_NO_IDCT_PERM;
- if (HAVE_MMX) ff_proresdsp_x86_init(dsp);
+ if (ARCH_X86) ff_proresdsp_x86_init(dsp);
ff_init_scantable_permutation(dsp->idct_permutation,
dsp->idct_permutation_type);
+#endif
+#if CONFIG_PRORES_ENCODER
+ dsp->fdct = prores_fdct_c;
+ dsp->dct_permutation_type = FF_NO_IDCT_PERM;
+ ff_init_scantable_permutation(dsp->dct_permutation,
+ dsp->dct_permutation_type);
+#endif
}
diff --git a/gst-libs/ext/libav/libavcodec/proresdsp.h b/gst-libs/ext/libav/libavcodec/proresdsp.h
index 8b864fa..ba22259 100644
--- a/gst-libs/ext/libav/libavcodec/proresdsp.h
+++ b/gst-libs/ext/libav/libavcodec/proresdsp.h
@@ -27,10 +27,13 @@
#define PRORES_BITS_PER_SAMPLE 10 ///< output precision of prores decoder
-typedef struct {
+typedef struct ProresDSPContext {
int idct_permutation_type;
uint8_t idct_permutation[64];
+ int dct_permutation_type;
+ uint8_t dct_permutation[64];
void (* idct_put) (uint16_t *out, int linesize, DCTELEM *block, const int16_t *qmat);
+ void (* fdct) (const uint16_t *src, int linesize, DCTELEM *block);
} ProresDSPContext;
void ff_proresdsp_init(ProresDSPContext *dsp);
diff --git a/gst-libs/ext/libav/libavcodec/proresenc.c b/gst-libs/ext/libav/libavcodec/proresenc.c
new file mode 100644
index 0000000..c4716d6
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/proresenc.c
@@ -0,0 +1,1078 @@
+/*
+ * Apple ProRes encoder
+ *
+ * Copyright (c) 2012 Konstantin Shishkov
+ *
+ * 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
+ */
+
+#include "libavutil/opt.h"
+#include "avcodec.h"
+#include "put_bits.h"
+#include "bytestream.h"
+#include "internal.h"
+#include "proresdsp.h"
+#include "proresdata.h"
+
+#define CFACTOR_Y422 2
+#define CFACTOR_Y444 3
+
+#define MAX_MBS_PER_SLICE 8
+
+#define MAX_PLANES 3 // should be increased to 4 when there's AV_PIX_FMT_YUV444AP10
+
+enum {
+ PRORES_PROFILE_PROXY = 0,
+ PRORES_PROFILE_LT,
+ PRORES_PROFILE_STANDARD,
+ PRORES_PROFILE_HQ,
+};
+
+enum {
+ QUANT_MAT_PROXY = 0,
+ QUANT_MAT_LT,
+ QUANT_MAT_STANDARD,
+ QUANT_MAT_HQ,
+ QUANT_MAT_DEFAULT,
+};
+
+static const uint8_t prores_quant_matrices[][64] = {
+ { // proxy
+ 4, 7, 9, 11, 13, 14, 15, 63,
+ 7, 7, 11, 12, 14, 15, 63, 63,
+ 9, 11, 13, 14, 15, 63, 63, 63,
+ 11, 11, 13, 14, 63, 63, 63, 63,
+ 11, 13, 14, 63, 63, 63, 63, 63,
+ 13, 14, 63, 63, 63, 63, 63, 63,
+ 13, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63,
+ },
+ { // LT
+ 4, 5, 6, 7, 9, 11, 13, 15,
+ 5, 5, 7, 8, 11, 13, 15, 17,
+ 6, 7, 9, 11, 13, 15, 15, 17,
+ 7, 7, 9, 11, 13, 15, 17, 19,
+ 7, 9, 11, 13, 14, 16, 19, 23,
+ 9, 11, 13, 14, 16, 19, 23, 29,
+ 9, 11, 13, 15, 17, 21, 28, 35,
+ 11, 13, 16, 17, 21, 28, 35, 41,
+ },
+ { // standard
+ 4, 4, 5, 5, 6, 7, 7, 9,
+ 4, 4, 5, 6, 7, 7, 9, 9,
+ 5, 5, 6, 7, 7, 9, 9, 10,
+ 5, 5, 6, 7, 7, 9, 9, 10,
+ 5, 6, 7, 7, 8, 9, 10, 12,
+ 6, 7, 7, 8, 9, 10, 12, 15,
+ 6, 7, 7, 9, 10, 11, 14, 17,
+ 7, 7, 9, 10, 11, 14, 17, 21,
+ },
+ { // high quality
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 5,
+ 4, 4, 4, 4, 4, 4, 5, 5,
+ 4, 4, 4, 4, 4, 5, 5, 6,
+ 4, 4, 4, 4, 5, 5, 6, 7,
+ 4, 4, 4, 4, 5, 6, 7, 7,
+ },
+ { // codec default
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ },
+};
+
+#define NUM_MB_LIMITS 4
+static const int prores_mb_limits[NUM_MB_LIMITS] = {
+ 1620, // up to 720x576
+ 2700, // up to 960x720
+ 6075, // up to 1440x1080
+ 9216, // up to 2048x1152
+};
+
+static const struct prores_profile {
+ const char *full_name;
+ uint32_t tag;
+ int min_quant;
+ int max_quant;
+ int br_tab[NUM_MB_LIMITS];
+ int quant;
+} prores_profile_info[4] = {
+ {
+ .full_name = "proxy",
+ .tag = MKTAG('a', 'p', 'c', 'o'),
+ .min_quant = 4,
+ .max_quant = 8,
+ .br_tab = { 300, 242, 220, 194 },
+ .quant = QUANT_MAT_PROXY,
+ },
+ {
+ .full_name = "LT",
+ .tag = MKTAG('a', 'p', 'c', 's'),
+ .min_quant = 1,
+ .max_quant = 9,
+ .br_tab = { 720, 560, 490, 440 },
+ .quant = QUANT_MAT_LT,
+ },
+ {
+ .full_name = "standard",
+ .tag = MKTAG('a', 'p', 'c', 'n'),
+ .min_quant = 1,
+ .max_quant = 6,
+ .br_tab = { 1050, 808, 710, 632 },
+ .quant = QUANT_MAT_STANDARD,
+ },
+ {
+ .full_name = "high quality",
+ .tag = MKTAG('a', 'p', 'c', 'h'),
+ .min_quant = 1,
+ .max_quant = 6,
+ .br_tab = { 1566, 1216, 1070, 950 },
+ .quant = QUANT_MAT_HQ,
+ }
+// for 4444 profile bitrate numbers are { 2350, 1828, 1600, 1425 }
+};
+
+#define TRELLIS_WIDTH 16
+#define SCORE_LIMIT INT_MAX / 2
+
+struct TrellisNode {
+ int prev_node;
+ int quant;
+ int bits;
+ int score;
+};
+
+#define MAX_STORED_Q 16
+
+typedef struct ProresThreadData {
+ DECLARE_ALIGNED(16, DCTELEM, blocks)[MAX_PLANES][64 * 4 * MAX_MBS_PER_SLICE];
+ DECLARE_ALIGNED(16, uint16_t, emu_buf)[16 * 16];
+ int16_t custom_q[64];
+ struct TrellisNode *nodes;
+} ProresThreadData;
+
+typedef struct ProresContext {
+ AVClass *class;
+ DECLARE_ALIGNED(16, DCTELEM, blocks)[MAX_PLANES][64 * 4 * MAX_MBS_PER_SLICE];
+ DECLARE_ALIGNED(16, uint16_t, emu_buf)[16*16];
+ int16_t quants[MAX_STORED_Q][64];
+ int16_t custom_q[64];
+ const uint8_t *quant_mat;
+
+ ProresDSPContext dsp;
+ ScanTable scantable;
+
+ int mb_width, mb_height;
+ int mbs_per_slice;
+ int num_chroma_blocks, chroma_factor;
+ int slices_width;
+ int slices_per_picture;
+ int pictures_per_frame; // 1 for progressive, 2 for interlaced
+ int cur_picture_idx;
+ int num_planes;
+ int bits_per_mb;
+ int force_quant;
+
+ char *vendor;
+ int quant_sel;
+
+ int frame_size_upper_bound;
+
+ int profile;
+ const struct prores_profile *profile_info;
+
+ int *slice_q;
+
+ ProresThreadData *tdata;
+} ProresContext;
+
+static void get_slice_data(ProresContext *ctx, const uint16_t *src,
+ int linesize, int x, int y, int w, int h,
+ DCTELEM *blocks, uint16_t *emu_buf,
+ int mbs_per_slice, int blocks_per_mb, int is_chroma)
+{
+ const uint16_t *esrc;
+ const int mb_width = 4 * blocks_per_mb;
+ int elinesize;
+ int i, j, k;
+
+ for (i = 0; i < mbs_per_slice; i++, src += mb_width) {
+ if (x >= w) {
+ memset(blocks, 0, 64 * (mbs_per_slice - i) * blocks_per_mb
+ * sizeof(*blocks));
+ return;
+ }
+ if (x + mb_width <= w && y + 16 <= h) {
+ esrc = src;
+ elinesize = linesize;
+ } else {
+ int bw, bh, pix;
+
+ esrc = emu_buf;
+ elinesize = 16 * sizeof(*emu_buf);
+
+ bw = FFMIN(w - x, mb_width);
+ bh = FFMIN(h - y, 16);
+
+ for (j = 0; j < bh; j++) {
+ memcpy(emu_buf + j * 16,
+ (const uint8_t*)src + j * linesize,
+ bw * sizeof(*src));
+ pix = emu_buf[j * 16 + bw - 1];
+ for (k = bw; k < mb_width; k++)
+ emu_buf[j * 16 + k] = pix;
+ }
+ for (; j < 16; j++)
+ memcpy(emu_buf + j * 16,
+ emu_buf + (bh - 1) * 16,
+ mb_width * sizeof(*emu_buf));
+ }
+ if (!is_chroma) {
+ ctx->dsp.fdct(esrc, elinesize, blocks);
+ blocks += 64;
+ if (blocks_per_mb > 2) {
+ ctx->dsp.fdct(esrc + 8, elinesize, blocks);
+ blocks += 64;
+ }
+ ctx->dsp.fdct(esrc + elinesize * 4, elinesize, blocks);
+ blocks += 64;
+ if (blocks_per_mb > 2) {
+ ctx->dsp.fdct(esrc + elinesize * 4 + 8, elinesize, blocks);
+ blocks += 64;
+ }
+ } else {
+ ctx->dsp.fdct(esrc, elinesize, blocks);
+ blocks += 64;
+ ctx->dsp.fdct(esrc + elinesize * 4, elinesize, blocks);
+ blocks += 64;
+ if (blocks_per_mb > 2) {
+ ctx->dsp.fdct(esrc + 8, elinesize, blocks);
+ blocks += 64;
+ ctx->dsp.fdct(esrc + elinesize * 4 + 8, elinesize, blocks);
+ blocks += 64;
+ }
+ }
+
+ x += mb_width;
+ }
+}
+
+/**
+ * Write an unsigned rice/exp golomb codeword.
+ */
+static inline void encode_vlc_codeword(PutBitContext *pb, unsigned codebook, int val)
+{
+ unsigned int rice_order, exp_order, switch_bits, switch_val;
+ int exponent;
+
+ /* number of prefix bits to switch between Rice and expGolomb */
+ switch_bits = (codebook & 3) + 1;
+ rice_order = codebook >> 5; /* rice code order */
+ exp_order = (codebook >> 2) & 7; /* exp golomb code order */
+
+ switch_val = switch_bits << rice_order;
+
+ if (val >= switch_val) {
+ val -= switch_val - (1 << exp_order);
+ exponent = av_log2(val);
+
+ put_bits(pb, exponent - exp_order + switch_bits, 0);
+ put_bits(pb, exponent + 1, val);
+ } else {
+ exponent = val >> rice_order;
+
+ if (exponent)
+ put_bits(pb, exponent, 0);
+ put_bits(pb, 1, 1);
+ if (rice_order)
+ put_sbits(pb, rice_order, val);
+ }
+}
+
+#define GET_SIGN(x) ((x) >> 31)
+#define MAKE_CODE(x) (((x) << 1) ^ GET_SIGN(x))
+
+static void encode_dcs(PutBitContext *pb, DCTELEM *blocks,
+ int blocks_per_slice, int scale)
+{
+ int i;
+ int codebook = 3, code, dc, prev_dc, delta, sign, new_sign;
+
+ prev_dc = (blocks[0] - 0x4000) / scale;
+ encode_vlc_codeword(pb, FIRST_DC_CB, MAKE_CODE(prev_dc));
+ sign = 0;
+ codebook = 3;
+ blocks += 64;
+
+ for (i = 1; i < blocks_per_slice; i++, blocks += 64) {
+ dc = (blocks[0] - 0x4000) / scale;
+ delta = dc - prev_dc;
+ new_sign = GET_SIGN(delta);
+ delta = (delta ^ sign) - sign;
+ code = MAKE_CODE(delta);
+ encode_vlc_codeword(pb, ff_prores_dc_codebook[codebook], code);
+ codebook = (code + (code & 1)) >> 1;
+ codebook = FFMIN(codebook, 3);
+ sign = new_sign;
+ prev_dc = dc;
+ }
+}
+
+static void encode_acs(PutBitContext *pb, DCTELEM *blocks,
+ int blocks_per_slice,
+ int plane_size_factor,
+ const uint8_t *scan, const int16_t *qmat)
+{
+ int idx, i;
+ int run, level, run_cb, lev_cb;
+ int max_coeffs, abs_level;
+
+ max_coeffs = blocks_per_slice << 6;
+ run_cb = ff_prores_run_to_cb_index[4];
+ lev_cb = ff_prores_lev_to_cb_index[2];
+ run = 0;
+
+ for (i = 1; i < 64; i++) {
+ for (idx = scan[i]; idx < max_coeffs; idx += 64) {
+ level = blocks[idx] / qmat[scan[i]];
+ if (level) {
+ abs_level = FFABS(level);
+ encode_vlc_codeword(pb, ff_prores_ac_codebook[run_cb], run);
+ encode_vlc_codeword(pb, ff_prores_ac_codebook[lev_cb],
+ abs_level - 1);
+ put_sbits(pb, 1, GET_SIGN(level));
+
+ run_cb = ff_prores_run_to_cb_index[FFMIN(run, 15)];
+ lev_cb = ff_prores_lev_to_cb_index[FFMIN(abs_level, 9)];
+ run = 0;
+ } else {
+ run++;
+ }
+ }
+ }
+}
+
+static int encode_slice_plane(ProresContext *ctx, PutBitContext *pb,
+ const uint16_t *src, int linesize,
+ int mbs_per_slice, DCTELEM *blocks,
+ int blocks_per_mb, int plane_size_factor,
+ const int16_t *qmat)
+{
+ int blocks_per_slice, saved_pos;
+
+ saved_pos = put_bits_count(pb);
+ blocks_per_slice = mbs_per_slice * blocks_per_mb;
+
+ encode_dcs(pb, blocks, blocks_per_slice, qmat[0]);
+ encode_acs(pb, blocks, blocks_per_slice, plane_size_factor,
+ ctx->scantable.permutated, qmat);
+ flush_put_bits(pb);
+
+ return (put_bits_count(pb) - saved_pos) >> 3;
+}
+
+static int encode_slice(AVCodecContext *avctx, const AVFrame *pic,
+ PutBitContext *pb,
+ int sizes[4], int x, int y, int quant,
+ int mbs_per_slice)
+{
+ ProresContext *ctx = avctx->priv_data;
+ int i, xp, yp;
+ int total_size = 0;
+ const uint16_t *src;
+ int slice_width_factor = av_log2(mbs_per_slice);
+ int num_cblocks, pwidth, linesize, line_add;
+ int plane_factor, is_chroma;
+ uint16_t *qmat;
+
+ if (ctx->pictures_per_frame == 1)
+ line_add = 0;
+ else
+ line_add = ctx->cur_picture_idx ^ !pic->top_field_first;
+
+ if (ctx->force_quant) {
+ qmat = ctx->quants[0];
+ } else if (quant < MAX_STORED_Q) {
+ qmat = ctx->quants[quant];
+ } else {
+ qmat = ctx->custom_q;
+ for (i = 0; i < 64; i++)
+ qmat[i] = ctx->quant_mat[i] * quant;
+ }
+
+ for (i = 0; i < ctx->num_planes; i++) {
+ is_chroma = (i == 1 || i == 2);
+ plane_factor = slice_width_factor + 2;
+ if (is_chroma)
+ plane_factor += ctx->chroma_factor - 3;
+ if (!is_chroma || ctx->chroma_factor == CFACTOR_Y444) {
+ xp = x << 4;
+ yp = y << 4;
+ num_cblocks = 4;
+ pwidth = avctx->width;
+ } else {
+ xp = x << 3;
+ yp = y << 4;
+ num_cblocks = 2;
+ pwidth = avctx->width >> 1;
+ }
+
+ linesize = pic->linesize[i] * ctx->pictures_per_frame;
+ src = (const uint16_t*)(pic->data[i] + yp * linesize +
+ line_add * pic->linesize[i]) + xp;
+
+ get_slice_data(ctx, src, linesize, xp, yp,
+ pwidth, avctx->height / ctx->pictures_per_frame,
+ ctx->blocks[0], ctx->emu_buf,
+ mbs_per_slice, num_cblocks, is_chroma);
+ sizes[i] = encode_slice_plane(ctx, pb, src, linesize,
+ mbs_per_slice, ctx->blocks[0],
+ num_cblocks, plane_factor,
+ qmat);
+ total_size += sizes[i];
+ }
+ return total_size;
+}
+
+static inline int estimate_vlc(unsigned codebook, int val)
+{
+ unsigned int rice_order, exp_order, switch_bits, switch_val;
+ int exponent;
+
+ /* number of prefix bits to switch between Rice and expGolomb */
+ switch_bits = (codebook & 3) + 1;
+ rice_order = codebook >> 5; /* rice code order */
+ exp_order = (codebook >> 2) & 7; /* exp golomb code order */
+
+ switch_val = switch_bits << rice_order;
+
+ if (val >= switch_val) {
+ val -= switch_val - (1 << exp_order);
+ exponent = av_log2(val);
+
+ return exponent * 2 - exp_order + switch_bits + 1;
+ } else {
+ return (val >> rice_order) + rice_order + 1;
+ }
+}
+
+static int estimate_dcs(int *error, DCTELEM *blocks, int blocks_per_slice,
+ int scale)
+{
+ int i;
+ int codebook = 3, code, dc, prev_dc, delta, sign, new_sign;
+ int bits;
+
+ prev_dc = (blocks[0] - 0x4000) / scale;
+ bits = estimate_vlc(FIRST_DC_CB, MAKE_CODE(prev_dc));
+ sign = 0;
+ codebook = 3;
+ blocks += 64;
+ *error += FFABS(blocks[0] - 0x4000) % scale;
+
+ for (i = 1; i < blocks_per_slice; i++, blocks += 64) {
+ dc = (blocks[0] - 0x4000) / scale;
+ *error += FFABS(blocks[0] - 0x4000) % scale;
+ delta = dc - prev_dc;
+ new_sign = GET_SIGN(delta);
+ delta = (delta ^ sign) - sign;
+ code = MAKE_CODE(delta);
+ bits += estimate_vlc(ff_prores_dc_codebook[codebook], code);
+ codebook = (code + (code & 1)) >> 1;
+ codebook = FFMIN(codebook, 3);
+ sign = new_sign;
+ prev_dc = dc;
+ }
+
+ return bits;
+}
+
+static int estimate_acs(int *error, DCTELEM *blocks, int blocks_per_slice,
+ int plane_size_factor,
+ const uint8_t *scan, const int16_t *qmat)
+{
+ int idx, i;
+ int run, level, run_cb, lev_cb;
+ int max_coeffs, abs_level;
+ int bits = 0;
+
+ max_coeffs = blocks_per_slice << 6;
+ run_cb = ff_prores_run_to_cb_index[4];
+ lev_cb = ff_prores_lev_to_cb_index[2];
+ run = 0;
+
+ for (i = 1; i < 64; i++) {
+ for (idx = scan[i]; idx < max_coeffs; idx += 64) {
+ level = blocks[idx] / qmat[scan[i]];
+ *error += FFABS(blocks[idx]) % qmat[scan[i]];
+ if (level) {
+ abs_level = FFABS(level);
+ bits += estimate_vlc(ff_prores_ac_codebook[run_cb], run);
+ bits += estimate_vlc(ff_prores_ac_codebook[lev_cb],
+ abs_level - 1) + 1;
+
+ run_cb = ff_prores_run_to_cb_index[FFMIN(run, 15)];
+ lev_cb = ff_prores_lev_to_cb_index[FFMIN(abs_level, 9)];
+ run = 0;
+ } else {
+ run++;
+ }
+ }
+ }
+
+ return bits;
+}
+
+static int estimate_slice_plane(ProresContext *ctx, int *error, int plane,
+ const uint16_t *src, int linesize,
+ int mbs_per_slice,
+ int blocks_per_mb, int plane_size_factor,
+ const int16_t *qmat, ProresThreadData *td)
+{
+ int blocks_per_slice;
+ int bits;
+
+ blocks_per_slice = mbs_per_slice * blocks_per_mb;
+
+ bits = estimate_dcs(error, td->blocks[plane], blocks_per_slice, qmat[0]);
+ bits += estimate_acs(error, td->blocks[plane], blocks_per_slice,
+ plane_size_factor, ctx->scantable.permutated, qmat);
+
+ return FFALIGN(bits, 8);
+}
+
+static int find_slice_quant(AVCodecContext *avctx, const AVFrame *pic,
+ int trellis_node, int x, int y, int mbs_per_slice,
+ ProresThreadData *td)
+{
+ ProresContext *ctx = avctx->priv_data;
+ int i, q, pq, xp, yp;
+ const uint16_t *src;
+ int slice_width_factor = av_log2(mbs_per_slice);
+ int num_cblocks[MAX_PLANES], pwidth;
+ int plane_factor[MAX_PLANES], is_chroma[MAX_PLANES];
+ const int min_quant = ctx->profile_info->min_quant;
+ const int max_quant = ctx->profile_info->max_quant;
+ int error, bits, bits_limit;
+ int mbs, prev, cur, new_score;
+ int slice_bits[TRELLIS_WIDTH], slice_score[TRELLIS_WIDTH];
+ int overquant;
+ uint16_t *qmat;
+ int linesize[4], line_add;
+
+ if (ctx->pictures_per_frame == 1)
+ line_add = 0;
+ else
+ line_add = ctx->cur_picture_idx ^ !pic->top_field_first;
+ mbs = x + mbs_per_slice;
+
+ for (i = 0; i < ctx->num_planes; i++) {
+ is_chroma[i] = (i == 1 || i == 2);
+ plane_factor[i] = slice_width_factor + 2;
+ if (is_chroma[i])
+ plane_factor[i] += ctx->chroma_factor - 3;
+ if (!is_chroma[i] || ctx->chroma_factor == CFACTOR_Y444) {
+ xp = x << 4;
+ yp = y << 4;
+ num_cblocks[i] = 4;
+ pwidth = avctx->width;
+ } else {
+ xp = x << 3;
+ yp = y << 4;
+ num_cblocks[i] = 2;
+ pwidth = avctx->width >> 1;
+ }
+
+ linesize[i] = pic->linesize[i] * ctx->pictures_per_frame;
+ src = (const uint16_t*)(pic->data[i] + yp * linesize[i] +
+ line_add * pic->linesize[i]) + xp;
+
+ get_slice_data(ctx, src, linesize[i], xp, yp,
+ pwidth, avctx->height / ctx->pictures_per_frame,
+ td->blocks[i], td->emu_buf,
+ mbs_per_slice, num_cblocks[i], is_chroma[i]);
+ }
+
+ for (q = min_quant; q < max_quant + 2; q++) {
+ td->nodes[trellis_node + q].prev_node = -1;
+ td->nodes[trellis_node + q].quant = q;
+ }
+
+ // todo: maybe perform coarser quantising to fit into frame size when needed
+ for (q = min_quant; q <= max_quant; q++) {
+ bits = 0;
+ error = 0;
+ for (i = 0; i < ctx->num_planes; i++) {
+ bits += estimate_slice_plane(ctx, &error, i,
+ src, linesize[i],
+ mbs_per_slice,
+ num_cblocks[i], plane_factor[i],
+ ctx->quants[q], td);
+ }
+ if (bits > 65000 * 8) {
+ error = SCORE_LIMIT;
+ break;
+ }
+ slice_bits[q] = bits;
+ slice_score[q] = error;
+ }
+ if (slice_bits[max_quant] <= ctx->bits_per_mb * mbs_per_slice) {
+ slice_bits[max_quant + 1] = slice_bits[max_quant];
+ slice_score[max_quant + 1] = slice_score[max_quant] + 1;
+ overquant = max_quant;
+ } else {
+ for (q = max_quant + 1; q < 128; q++) {
+ bits = 0;
+ error = 0;
+ if (q < MAX_STORED_Q) {
+ qmat = ctx->quants[q];
+ } else {
+ qmat = td->custom_q;
+ for (i = 0; i < 64; i++)
+ qmat[i] = ctx->quant_mat[i] * q;
+ }
+ for (i = 0; i < ctx->num_planes; i++) {
+ bits += estimate_slice_plane(ctx, &error, i,
+ src, linesize[i],
+ mbs_per_slice,
+ num_cblocks[i], plane_factor[i],
+ qmat, td);
+ }
+ if (bits <= ctx->bits_per_mb * mbs_per_slice)
+ break;
+ }
+
+ slice_bits[max_quant + 1] = bits;
+ slice_score[max_quant + 1] = error;
+ overquant = q;
+ }
+ td->nodes[trellis_node + max_quant + 1].quant = overquant;
+
+ bits_limit = mbs * ctx->bits_per_mb;
+ for (pq = min_quant; pq < max_quant + 2; pq++) {
+ prev = trellis_node - TRELLIS_WIDTH + pq;
+
+ for (q = min_quant; q < max_quant + 2; q++) {
+ cur = trellis_node + q;
+
+ bits = td->nodes[prev].bits + slice_bits[q];
+ error = slice_score[q];
+ if (bits > bits_limit)
+ error = SCORE_LIMIT;
+
+ if (td->nodes[prev].score < SCORE_LIMIT && error < SCORE_LIMIT)
+ new_score = td->nodes[prev].score + error;
+ else
+ new_score = SCORE_LIMIT;
+ if (td->nodes[cur].prev_node == -1 ||
+ td->nodes[cur].score >= new_score) {
+
+ td->nodes[cur].bits = bits;
+ td->nodes[cur].score = new_score;
+ td->nodes[cur].prev_node = prev;
+ }
+ }
+ }
+
+ error = td->nodes[trellis_node + min_quant].score;
+ pq = trellis_node + min_quant;
+ for (q = min_quant + 1; q < max_quant + 2; q++) {
+ if (td->nodes[trellis_node + q].score <= error) {
+ error = td->nodes[trellis_node + q].score;
+ pq = trellis_node + q;
+ }
+ }
+
+ return pq;
+}
+
+static int find_quant_thread(AVCodecContext *avctx, void *arg,
+ int jobnr, int threadnr)
+{
+ ProresContext *ctx = avctx->priv_data;
+ ProresThreadData *td = ctx->tdata + threadnr;
+ int mbs_per_slice = ctx->mbs_per_slice;
+ int x, y = jobnr, mb, q = 0;
+
+ for (x = mb = 0; x < ctx->mb_width; x += mbs_per_slice, mb++) {
+ while (ctx->mb_width - x < mbs_per_slice)
+ mbs_per_slice >>= 1;
+ q = find_slice_quant(avctx, avctx->coded_frame,
+ (mb + 1) * TRELLIS_WIDTH, x, y,
+ mbs_per_slice, td);
+ }
+
+ for (x = ctx->slices_width - 1; x >= 0; x--) {
+ ctx->slice_q[x + y * ctx->slices_width] = td->nodes[q].quant;
+ q = td->nodes[q].prev_node;
+ }
+
+ return 0;
+}
+
+static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
+ const AVFrame *pic, int *got_packet)
+{
+ ProresContext *ctx = avctx->priv_data;
+ uint8_t *orig_buf, *buf, *slice_hdr, *slice_sizes, *tmp;
+ uint8_t *picture_size_pos;
+ PutBitContext pb;
+ int x, y, i, mb, q = 0;
+ int sizes[4] = { 0 };
+ int slice_hdr_size = 2 + 2 * (ctx->num_planes - 1);
+ int frame_size, picture_size, slice_size;
+ int pkt_size, ret;
+ uint8_t frame_flags;
+
+ *avctx->coded_frame = *pic;
+ avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I;
+ avctx->coded_frame->key_frame = 1;
+
+ pkt_size = ctx->frame_size_upper_bound + FF_MIN_BUFFER_SIZE;
+
+ if ((ret = ff_alloc_packet(pkt, pkt_size)) < 0) {
+ av_log(avctx, AV_LOG_ERROR, "Error getting output packet.\n");
+ return ret;
+ }
+
+ orig_buf = pkt->data;
+
+ // frame atom
+ orig_buf += 4; // frame size
+ bytestream_put_be32 (&orig_buf, FRAME_ID); // frame container ID
+ buf = orig_buf;
+
+ // frame header
+ tmp = buf;
+ buf += 2; // frame header size will be stored here
+ bytestream_put_be16 (&buf, 0); // version 1
+ bytestream_put_buffer(&buf, ctx->vendor, 4);
+ bytestream_put_be16 (&buf, avctx->width);
+ bytestream_put_be16 (&buf, avctx->height);
+
+ frame_flags = ctx->chroma_factor << 6;
+ if (avctx->flags & CODEC_FLAG_INTERLACED_DCT)
+ frame_flags |= pic->top_field_first ? 0x04 : 0x08;
+ bytestream_put_byte (&buf, frame_flags);
+
+ bytestream_put_byte (&buf, 0); // reserved
+ bytestream_put_byte (&buf, avctx->color_primaries);
+ bytestream_put_byte (&buf, avctx->color_trc);
+ bytestream_put_byte (&buf, avctx->colorspace);
+ bytestream_put_byte (&buf, 0x40); // source format and alpha information
+ bytestream_put_byte (&buf, 0); // reserved
+ if (ctx->quant_sel != QUANT_MAT_DEFAULT) {
+ bytestream_put_byte (&buf, 0x03); // matrix flags - both matrices are present
+ // luma quantisation matrix
+ for (i = 0; i < 64; i++)
+ bytestream_put_byte(&buf, ctx->quant_mat[i]);
+ // chroma quantisation matrix
+ for (i = 0; i < 64; i++)
+ bytestream_put_byte(&buf, ctx->quant_mat[i]);
+ } else {
+ bytestream_put_byte (&buf, 0x00); // matrix flags - default matrices are used
+ }
+ bytestream_put_be16 (&tmp, buf - orig_buf); // write back frame header size
+
+ for (ctx->cur_picture_idx = 0;
+ ctx->cur_picture_idx < ctx->pictures_per_frame;
+ ctx->cur_picture_idx++) {
+ // picture header
+ picture_size_pos = buf + 1;
+ bytestream_put_byte (&buf, 0x40); // picture header size (in bits)
+ buf += 4; // picture data size will be stored here
+ bytestream_put_be16 (&buf, ctx->slices_per_picture);
+ bytestream_put_byte (&buf, av_log2(ctx->mbs_per_slice) << 4); // slice width and height in MBs
+
+ // seek table - will be filled during slice encoding
+ slice_sizes = buf;
+ buf += ctx->slices_per_picture * 2;
+
+ // slices
+ if (!ctx->force_quant) {
+ ret = avctx->execute2(avctx, find_quant_thread, NULL, NULL,
+ ctx->mb_height);
+ if (ret)
+ return ret;
+ }
+
+ for (y = 0; y < ctx->mb_height; y++) {
+ int mbs_per_slice = ctx->mbs_per_slice;
+ for (x = mb = 0; x < ctx->mb_width; x += mbs_per_slice, mb++) {
+ q = ctx->force_quant ? ctx->force_quant
+ : ctx->slice_q[mb + y * ctx->slices_width];
+
+ while (ctx->mb_width - x < mbs_per_slice)
+ mbs_per_slice >>= 1;
+
+ bytestream_put_byte(&buf, slice_hdr_size << 3);
+ slice_hdr = buf;
+ buf += slice_hdr_size - 1;
+ init_put_bits(&pb, buf, (pkt_size - (buf - orig_buf)) * 8);
+ encode_slice(avctx, pic, &pb, sizes, x, y, q, mbs_per_slice);
+
+ bytestream_put_byte(&slice_hdr, q);
+ slice_size = slice_hdr_size + sizes[ctx->num_planes - 1];
+ for (i = 0; i < ctx->num_planes - 1; i++) {
+ bytestream_put_be16(&slice_hdr, sizes[i]);
+ slice_size += sizes[i];
+ }
+ bytestream_put_be16(&slice_sizes, slice_size);
+ buf += slice_size - slice_hdr_size;
+ }
+ }
+
+ if (ctx->pictures_per_frame == 1)
+ picture_size = buf - picture_size_pos - 6;
+ else
+ picture_size = buf - picture_size_pos + 1;
+ bytestream_put_be32(&picture_size_pos, picture_size);
+ }
+
+ orig_buf -= 8;
+ frame_size = buf - orig_buf;
+ bytestream_put_be32(&orig_buf, frame_size);
+
+ pkt->size = frame_size;
+ pkt->flags |= AV_PKT_FLAG_KEY;
+ *got_packet = 1;
+
+ return 0;
+}
+
+static av_cold int encode_close(AVCodecContext *avctx)
+{
+ ProresContext *ctx = avctx->priv_data;
+ int i;
+
+ av_freep(&avctx->coded_frame);
+
+ if (ctx->tdata) {
+ for (i = 0; i < avctx->thread_count; i++)
+ av_free(ctx->tdata[i].nodes);
+ }
+ av_freep(&ctx->tdata);
+ av_freep(&ctx->slice_q);
+
+ return 0;
+}
+
+static av_cold int encode_init(AVCodecContext *avctx)
+{
+ ProresContext *ctx = avctx->priv_data;
+ int mps;
+ int i, j;
+ int min_quant, max_quant;
+ int interlaced = !!(avctx->flags & CODEC_FLAG_INTERLACED_DCT);
+
+ avctx->bits_per_raw_sample = 10;
+ avctx->coded_frame = avcodec_alloc_frame();
+ if (!avctx->coded_frame)
+ return AVERROR(ENOMEM);
+
+ ff_proresdsp_init(&ctx->dsp);
+ ff_init_scantable(ctx->dsp.dct_permutation, &ctx->scantable,
+ interlaced ? ff_prores_interlaced_scan
+ : ff_prores_progressive_scan);
+
+ mps = ctx->mbs_per_slice;
+ if (mps & (mps - 1)) {
+ av_log(avctx, AV_LOG_ERROR,
+ "there should be an integer power of two MBs per slice\n");
+ return AVERROR(EINVAL);
+ }
+
+ ctx->chroma_factor = avctx->pix_fmt == AV_PIX_FMT_YUV422P10
+ ? CFACTOR_Y422
+ : CFACTOR_Y444;
+ ctx->profile_info = prores_profile_info + ctx->profile;
+ ctx->num_planes = 3;
+
+ ctx->mb_width = FFALIGN(avctx->width, 16) >> 4;
+
+ if (interlaced)
+ ctx->mb_height = FFALIGN(avctx->height, 32) >> 5;
+ else
+ ctx->mb_height = FFALIGN(avctx->height, 16) >> 4;
+
+ ctx->slices_width = ctx->mb_width / mps;
+ ctx->slices_width += av_popcount(ctx->mb_width - ctx->slices_width * mps);
+ ctx->slices_per_picture = ctx->mb_height * ctx->slices_width;
+ ctx->pictures_per_frame = 1 + interlaced;
+
+ if (ctx->quant_sel == -1)
+ ctx->quant_mat = prores_quant_matrices[ctx->profile_info->quant];
+ else
+ ctx->quant_mat = prores_quant_matrices[ctx->quant_sel];
+
+ if (strlen(ctx->vendor) != 4) {
+ av_log(avctx, AV_LOG_ERROR, "vendor ID should be 4 bytes\n");
+ return AVERROR_INVALIDDATA;
+ }
+
+ ctx->force_quant = avctx->global_quality / FF_QP2LAMBDA;
+ if (!ctx->force_quant) {
+ if (!ctx->bits_per_mb) {
+ for (i = 0; i < NUM_MB_LIMITS - 1; i++)
+ if (prores_mb_limits[i] >= ctx->mb_width * ctx->mb_height *
+ ctx->pictures_per_frame)
+ break;
+ ctx->bits_per_mb = ctx->profile_info->br_tab[i];
+ } else if (ctx->bits_per_mb < 128) {
+ av_log(avctx, AV_LOG_ERROR, "too few bits per MB, please set at least 128\n");
+ return AVERROR_INVALIDDATA;
+ }
+
+ min_quant = ctx->profile_info->min_quant;
+ max_quant = ctx->profile_info->max_quant;
+ for (i = min_quant; i < MAX_STORED_Q; i++) {
+ for (j = 0; j < 64; j++)
+ ctx->quants[i][j] = ctx->quant_mat[j] * i;
+ }
+
+ ctx->slice_q = av_malloc(ctx->slices_per_picture * sizeof(*ctx->slice_q));
+ if (!ctx->slice_q) {
+ encode_close(avctx);
+ return AVERROR(ENOMEM);
+ }
+
+ ctx->tdata = av_mallocz(avctx->thread_count * sizeof(*ctx->tdata));
+ if (!ctx->tdata) {
+ encode_close(avctx);
+ return AVERROR(ENOMEM);
+ }
+
+ for (j = 0; j < avctx->thread_count; j++) {
+ ctx->tdata[j].nodes = av_malloc((ctx->slices_width + 1)
+ * TRELLIS_WIDTH
+ * sizeof(*ctx->tdata->nodes));
+ if (!ctx->tdata[j].nodes) {
+ encode_close(avctx);
+ return AVERROR(ENOMEM);
+ }
+ for (i = min_quant; i < max_quant + 2; i++) {
+ ctx->tdata[j].nodes[i].prev_node = -1;
+ ctx->tdata[j].nodes[i].bits = 0;
+ ctx->tdata[j].nodes[i].score = 0;
+ }
+ }
+ } else {
+ int ls = 0;
+
+ if (ctx->force_quant > 64) {
+ av_log(avctx, AV_LOG_ERROR, "too large quantiser, maximum is 64\n");
+ return AVERROR_INVALIDDATA;
+ }
+
+ for (j = 0; j < 64; j++) {
+ ctx->quants[0][j] = ctx->quant_mat[j] * ctx->force_quant;
+ ls += av_log2((1 << 11) / ctx->quants[0][j]) * 2 + 1;
+ }
+
+ ctx->bits_per_mb = ls * 8;
+ if (ctx->chroma_factor == CFACTOR_Y444)
+ ctx->bits_per_mb += ls * 4;
+ if (ctx->num_planes == 4)
+ ctx->bits_per_mb += ls * 4;
+ }
+
+ ctx->frame_size_upper_bound = ctx->pictures_per_frame *
+ ctx->slices_per_picture *
+ (2 + 2 * ctx->num_planes +
+ (mps * ctx->bits_per_mb) / 8)
+ + 200;
+
+ avctx->codec_tag = ctx->profile_info->tag;
+
+ av_log(avctx, AV_LOG_DEBUG,
+ "profile %d, %d slices, interlacing: %s, %d bits per MB\n",
+ ctx->profile, ctx->slices_per_picture * ctx->pictures_per_frame,
+ interlaced ? "yes" : "no", ctx->bits_per_mb);
+ av_log(avctx, AV_LOG_DEBUG, "frame size upper bound: %d\n",
+ ctx->frame_size_upper_bound);
+
+ return 0;
+}
+
+#define OFFSET(x) offsetof(ProresContext, x)
+#define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
+
+static const AVOption options[] = {
+ { "mbs_per_slice", "macroblocks per slice", OFFSET(mbs_per_slice),
+ AV_OPT_TYPE_INT, { .i64 = 8 }, 1, MAX_MBS_PER_SLICE, VE },
+ { "profile", NULL, OFFSET(profile), AV_OPT_TYPE_INT,
+ { .i64 = PRORES_PROFILE_STANDARD },
+ PRORES_PROFILE_PROXY, PRORES_PROFILE_HQ, VE, "profile" },
+ { "proxy", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = PRORES_PROFILE_PROXY },
+ 0, 0, VE, "profile" },
+ { "lt", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = PRORES_PROFILE_LT },
+ 0, 0, VE, "profile" },
+ { "standard", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = PRORES_PROFILE_STANDARD },
+ 0, 0, VE, "profile" },
+ { "hq", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = PRORES_PROFILE_HQ },
+ 0, 0, VE, "profile" },
+ { "vendor", "vendor ID", OFFSET(vendor),
+ AV_OPT_TYPE_STRING, { .str = "Lavc" }, CHAR_MIN, CHAR_MAX, VE },
+ { "bits_per_mb", "desired bits per macroblock", OFFSET(bits_per_mb),
+ AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 8192, VE },
+ { "quant_mat", "quantiser matrix", OFFSET(quant_sel), AV_OPT_TYPE_INT,
+ { .i64 = -1 }, -1, QUANT_MAT_DEFAULT, VE, "quant_mat" },
+ { "auto", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = -1 },
+ 0, 0, VE, "quant_mat" },
+ { "proxy", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = QUANT_MAT_PROXY },
+ 0, 0, VE, "quant_mat" },
+ { "lt", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = QUANT_MAT_LT },
+ 0, 0, VE, "quant_mat" },
+ { "standard", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = QUANT_MAT_STANDARD },
+ 0, 0, VE, "quant_mat" },
+ { "hq", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = QUANT_MAT_HQ },
+ 0, 0, VE, "quant_mat" },
+ { "default", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = QUANT_MAT_DEFAULT },
+ 0, 0, VE, "quant_mat" },
+ { NULL }
+};
+
+static const AVClass proresenc_class = {
+ .class_name = "ProRes encoder",
+ .item_name = av_default_item_name,
+ .option = options,
+ .version = LIBAVUTIL_VERSION_INT,
+};
+
+AVCodec ff_prores_encoder = {
+ .name = "prores",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .id = AV_CODEC_ID_PRORES,
+ .priv_data_size = sizeof(ProresContext),
+ .init = encode_init,
+ .close = encode_close,
+ .encode2 = encode_frame,
+ .capabilities = CODEC_CAP_SLICE_THREADS,
+ .long_name = NULL_IF_CONFIG_SMALL("Apple ProRes (iCodec Pro)"),
+ .pix_fmts = (const enum AVPixelFormat[]) {
+ AV_PIX_FMT_YUV422P10, AV_PIX_FMT_YUV444P10, AV_PIX_FMT_NONE
+ },
+ .priv_class = &proresenc_class,
+};
diff --git a/gst-libs/ext/libav/libavcodec/ps2/dsputil_mmi.c b/gst-libs/ext/libav/libavcodec/ps2/dsputil_mmi.c
deleted file mode 100644
index 77755b0..0000000
--- a/gst-libs/ext/libav/libavcodec/ps2/dsputil_mmi.c
+++ /dev/null
@@ -1,167 +0,0 @@
-/*
- * MMI optimized DSP utils
- * Copyright (c) 2000, 2001 Fabrice Bellard
- *
- * MMI optimization by Leon van Stuivenberg
- * clear_blocks_mmi() by BroadQ
- *
- * 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
- */
-
-#include "libavcodec/dsputil.h"
-#include "mmi.h"
-
-void ff_mmi_idct_put(uint8_t *dest, int line_size, DCTELEM *block);
-void ff_mmi_idct_add(uint8_t *dest, int line_size, DCTELEM *block);
-void ff_mmi_idct(DCTELEM *block);
-
-static void clear_blocks_mmi(DCTELEM * blocks)
-{
- __asm__ volatile(
- ".set noreorder \n"
- "addiu $9, %0, 768 \n"
- "nop \n"
- "1: \n"
- "sq $0, 0(%0) \n"
- "move $8, %0 \n"
- "addi %0, %0, 64 \n"
- "sq $0, 16($8) \n"
- "slt $10, %0, $9 \n"
- "sq $0, 32($8) \n"
- "bnez $10, 1b \n"
- "sq $0, 48($8) \n"
- ".set reorder \n"
- : "+r" (blocks) :: "$8", "$9", "memory" );
-}
-
-
-static void get_pixels_mmi(DCTELEM *block, const uint8_t *pixels, int line_size)
-{
- __asm__ volatile(
- ".set push \n\t"
- ".set mips3 \n\t"
- "ld $8, 0(%0) \n\t"
- "add %0, %0, %2 \n\t"
- "ld $9, 0(%0) \n\t"
- "add %0, %0, %2 \n\t"
- "ld $10, 0(%0) \n\t"
- "pextlb $8, $0, $8 \n\t"
- "sq $8, 0(%1) \n\t"
- "add %0, %0, %2 \n\t"
- "ld $8, 0(%0) \n\t"
- "pextlb $9, $0, $9 \n\t"
- "sq $9, 16(%1) \n\t"
- "add %0, %0, %2 \n\t"
- "ld $9, 0(%0) \n\t"
- "pextlb $10, $0, $10 \n\t"
- "sq $10, 32(%1) \n\t"
- "add %0, %0, %2 \n\t"
- "ld $10, 0(%0) \n\t"
- "pextlb $8, $0, $8 \n\t"
- "sq $8, 48(%1) \n\t"
- "add %0, %0, %2 \n\t"
- "ld $8, 0(%0) \n\t"
- "pextlb $9, $0, $9 \n\t"
- "sq $9, 64(%1) \n\t"
- "add %0, %0, %2 \n\t"
- "ld $9, 0(%0) \n\t"
- "pextlb $10, $0, $10 \n\t"
- "sq $10, 80(%1) \n\t"
- "pextlb $8, $0, $8 \n\t"
- "sq $8, 96(%1) \n\t"
- "pextlb $9, $0, $9 \n\t"
- "sq $9, 112(%1) \n\t"
- ".set pop \n\t"
- : "+r" (pixels) : "r" (block), "r" (line_size) : "$8", "$9", "$10", "memory" );
-}
-
-
-static void put_pixels8_mmi(uint8_t *block, const uint8_t *pixels, int line_size, int h)
-{
- __asm__ volatile(
- ".set push \n\t"
- ".set mips3 \n\t"
- "1: \n\t"
- "ldr $8, 0(%1) \n\t"
- "addiu %2, %2, -1 \n\t"
- "ldl $8, 7(%1) \n\t"
- "add %1, %1, %3 \n\t"
- "sd $8, 0(%0) \n\t"
- "add %0, %0, %3 \n\t"
- "bgtz %2, 1b \n\t"
- ".set pop \n\t"
- : "+r" (block), "+r" (pixels), "+r" (h) : "r" (line_size)
- : "$8", "memory" );
-}
-
-
-static void put_pixels16_mmi(uint8_t *block, const uint8_t *pixels, int line_size, int h)
-{
- __asm__ volatile (
- ".set push \n\t"
- ".set mips3 \n\t"
- "1: \n\t"
- "ldr $8, 0(%1) \n\t"
- "add $11, %1, %3 \n\t"
- "ldl $8, 7(%1) \n\t"
- "add $10, %0, %3 \n\t"
- "ldr $9, 8(%1) \n\t"
- "ldl $9, 15(%1) \n\t"
- "ldr $12, 0($11) \n\t"
- "add %1, $11, %3 \n\t"
- "ldl $12, 7($11) \n\t"
- "pcpyld $8, $9, $8 \n\t"
- "sq $8, 0(%0) \n\t"
- "ldr $13, 8($11) \n\t"
- "addiu %2, %2, -2 \n\t"
- "ldl $13, 15($11) \n\t"
- "add %0, $10, %3 \n\t"
- "pcpyld $12, $13, $12 \n\t"
- "sq $12, 0($10) \n\t"
- "bgtz %2, 1b \n\t"
- ".set pop \n\t"
- : "+r" (block), "+r" (pixels), "+r" (h) : "r" (line_size)
- : "$8", "$9", "$10", "$11", "$12", "$13", "memory" );
-}
-
-
-void dsputil_init_mmi(DSPContext* c, AVCodecContext *avctx)
-{
- const int idct_algo= avctx->idct_algo;
- const int high_bit_depth = avctx->bits_per_raw_sample > 8;
-
- if (!high_bit_depth) {
- c->clear_blocks = clear_blocks_mmi;
-
- c->put_pixels_tab[1][0] = put_pixels8_mmi;
- c->put_no_rnd_pixels_tab[1][0] = put_pixels8_mmi;
-
- c->put_pixels_tab[0][0] = put_pixels16_mmi;
- c->put_no_rnd_pixels_tab[0][0] = put_pixels16_mmi;
-
- c->get_pixels = get_pixels_mmi;
- }
-
- if (avctx->bits_per_raw_sample <= 8 &&
- (idct_algo==FF_IDCT_AUTO || idct_algo==FF_IDCT_PS2)) {
- c->idct_put= ff_mmi_idct_put;
- c->idct_add= ff_mmi_idct_add;
- c->idct = ff_mmi_idct;
- c->idct_permutation_type= FF_LIBMPEG2_IDCT_PERM;
- }
-}
-
diff --git a/gst-libs/ext/libav/libavcodec/ps2/idct_mmi.c b/gst-libs/ext/libav/libavcodec/ps2/idct_mmi.c
deleted file mode 100644
index 86df092..0000000
--- a/gst-libs/ext/libav/libavcodec/ps2/idct_mmi.c
+++ /dev/null
@@ -1,362 +0,0 @@
-/*
- * Originally provided by Intel at Application Note AP-922.
- *
- * Column code adapted from Peter Gubanov.
- * Copyright (c) 2000-2001 Peter Gubanov <peter@elecard.net.ru>
- * http://www.elecard.com/peter/idct.shtml
- * rounding trick copyright (c) 2000 Michel Lespinasse <walken@zoy.org>
- *
- * MMI port and (c) 2002 by Leon van Stuivenberg
- *
- * 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
- */
-
-#include "libavutil/common.h"
-#include "libavcodec/dsputil.h"
-#include "mmi.h"
-
-#define BITS_INV_ACC 5 // 4 or 5 for IEEE
-#define SHIFT_INV_ROW (16 - BITS_INV_ACC)
-#define SHIFT_INV_COL (1 + BITS_INV_ACC)
-
-#define TG1 6518
-#define TG2 13573
-#define TG3 21895
-#define CS4 23170
-
-#define ROUNDER_0 0
-#define ROUNDER_1 16
-
-#define TAB_i_04 (32+0)
-#define TAB_i_17 (32+64)
-#define TAB_i_26 (32+128)
-#define TAB_i_35 (32+192)
-
-#define TG_1_16 (32+256+0)
-#define TG_2_16 (32+256+16)
-#define TG_3_16 (32+256+32)
-#define COS_4_16 (32+256+48)
-
-#define CLIPMAX (32+256+64+0)
-
-static short consttable[] align16 = {
-/* rounder 0*/ // assume SHIFT_INV_ROW == 11
- 0x3ff, 1, 0x3ff, 1, 0x3ff, 1, 0x3ff, 1,
-/* rounder 1*/
- 0x3ff, 0, 0x3ff, 0, 0x3ff, 0, 0x3ff, 0,
-/* row 0/4*/
- 16384, 21407, -16384, -21407, 22725, 19266, -22725, -12873,
- 8867, 16384, 8867, 16384, 4520, 12873, -4520, 19266,
- 16384, -8867, 16384, -8867, 12873, -22725, 19266, -22725,
- 21407, -16384, -21407, 16384, 19266, 4520, -12873, 4520,
-/* row 1/7*/
- 22725, 29692, -22725, -29692, 31521, 26722, -31521, -17855,
- 12299, 22725, 12299, 22725, 6270, 17855, -6270, 26722,
- 22725, -12299, 22725, -12299, 17855, -31521, 26722, -31521,
- 29692, -22725, -29692, 22725, 26722, 6270, -17855, 6270,
-/* row 2/6*/
- 21407, 27969, -21407, -27969, 29692, 25172, -29692, -16819,
- 11585, 21407, 11585, 21407, 5906, 16819, -5906, 25172,
- 21407, -11585, 21407, -11585, 16819, -29692, 25172, -29692,
- 27969, -21407, -27969, 21407, 25172, 5906, -16819, 5906,
-/*row 3/5*/
- 19266, 25172, -19266, -25172, 26722, 22654, -26722, -15137,
- 10426, 19266, 10426, 19266, 5315, 15137, -5315, 22654,
- 19266, -10426, 19266, -10426, 15137, -26722, 22654, -26722,
- 25172, -19266, -25172, 19266, 22654, 5315, -15137, 5315,
-/*column constants*/
- TG1, TG1, TG1, TG1, TG1, TG1, TG1, TG1,
- TG2, TG2, TG2, TG2, TG2, TG2, TG2, TG2,
- TG3, TG3, TG3, TG3, TG3, TG3, TG3, TG3,
- CS4, CS4, CS4, CS4, CS4, CS4, CS4, CS4,
-/* clamp */
- 255, 255, 255, 255, 255, 255, 255, 255
-};
-
-
-#define DCT_8_INV_ROW1(blk, rowoff, taboff, rnd, outreg) { \
- lq(blk, rowoff, $16); /* r16 = x7 x5 x3 x1 x6 x4 x2 x0 */ \
- /*slot*/ \
- lq($24, 0+taboff, $17); /* r17 = w */ \
- /*delay slot $16*/ \
- lq($24, 16+taboff, $18);/* r18 = w */ \
- prevh($16, $2); /* r2 = x1 x3 x5 x7 x0 x2 x4 x6 */ \
- lq($24, 32+taboff, $19);/* r19 = w */ \
- phmadh($17, $16, $17); /* r17 = b1"b0'a1"a0' */ \
- lq($24, 48+taboff, $20);/* r20 = w */ \
- phmadh($18, $2, $18); /* r18 = b1'b0"a1'a0" */ \
- phmadh($19, $16, $19); /* r19 = b3"b2'a3"a2' */ \
- phmadh($20, $2, $20); /* r20 = b3'b2"a3'a2" */ \
- paddw($17, $18, $17); /* r17 = (b1)(b0)(a1)(a0) */ \
- paddw($19, $20, $19); /* r19 = (b3)(b2)(a3)(a2) */ \
- pcpyld($19, $17, $18); /* r18 = (a3)(a2)(a1)(a0) */ \
- pcpyud($17, $19, $20); /* r20 = (b3)(b2)(b1)(b0) */ \
- paddw($18, rnd, $18); /* r18 = (a3)(a2)(a1)(a0) */\
- paddw($18, $20, $17); /* r17 = ()()()(a0+b0) */ \
- psubw($18, $20, $20); /* r20 = ()()()(a0-b0) */ \
- psraw($17, SHIFT_INV_ROW, $17); /* r17 = (y3 y2 y1 y0) */ \
- psraw($20, SHIFT_INV_ROW, $20); /* r20 = (y4 y5 y6 y7) */ \
- ppach($20, $17, outreg);/* out = y4 y5 y6 y7 y3 y2 y1 y0 Note order */ \
-\
- prevh(outreg, $2); \
- pcpyud($2, $2, $2); \
- pcpyld($2, outreg, outreg); \
-}
-
-
-#define DCT_8_INV_COL8() \
-\
- lq($24, TG_3_16, $2); /* r2 = tn3 */ \
-\
- pmulth($11, $2, $17); /* r17 = x3 * tn3 (6420) */ \
- psraw($17, 15, $17); \
- pmfhl_uw($3); /* r3 = 7531 */ \
- psraw($3, 15, $3); \
- pinteh($3, $17, $17); /* r17 = x3 * tn3 */ \
- psubh($17, $13, $17); /* r17 = tm35 */ \
-\
- pmulth($13, $2, $18); /* r18 = x5 * tn3 (6420) */ \
- psraw($18, 15, $18); \
- pmfhl_uw($3); /* r3 = 7531 */ \
- psraw($3, 15, $3); \
- pinteh($3, $18, $18); /* r18 = x5 * tn3 */ \
- paddh($18, $11, $18); /* r18 = tp35 */ \
-\
- lq($24, TG_1_16, $2); /* r2 = tn1 */ \
-\
- pmulth($15, $2, $19); /* r19 = x7 * tn1 (6420) */ \
- psraw($19, 15, $19); \
- pmfhl_uw($3); /* r3 = 7531 */ \
- psraw($3, 15, $3); \
- pinteh($3, $19, $19); /* r19 = x7 * tn1 */ \
- paddh($19, $9, $19); /* r19 = tp17 */ \
-\
- pmulth($9, $2, $20); /* r20 = x1 * tn1 (6420) */ \
- psraw($20, 15, $20); \
- pmfhl_uw($3); /* r3 = 7531 */ \
- psraw($3, 15, $3); \
- pinteh($3, $20, $20); /* r20 = x1 * tn1 */ \
- psubh($20, $15, $20); /* r20 = tm17 */ \
-\
- psubh($19, $18, $3); /* r3 = t1 */ \
- paddh($20, $17, $16); /* r16 = t2 */ \
- psubh($20, $17, $23); /* r23 = b3 */ \
- paddh($19, $18, $20); /* r20 = b0 */ \
-\
- lq($24, COS_4_16, $2); /* r2 = cs4 */ \
-\
- paddh($3, $16, $21); /* r21 = t1+t2 */ \
- psubh($3, $16, $22); /* r22 = t1-t2 */ \
-\
- pmulth($21, $2, $21); /* r21 = cs4 * (t1+t2) 6420 */ \
- psraw($21, 15, $21); \
- pmfhl_uw($3); /* r3 = 7531 */ \
- psraw($3, 15, $3); \
- pinteh($3, $21, $21); /* r21 = b1 */ \
-\
- pmulth($22, $2, $22); /* r22 = cs4 * (t1-t2) 6420 */ \
- psraw($22, 15, $22); \
- pmfhl_uw($3); /* r3 = 7531 */ \
- psraw($3, 15, $3); \
- pinteh($3, $22, $22); /* r22 = b2 */ \
-\
- lq($24, TG_2_16, $2); /* r2 = tn2 */ \
-\
- pmulth($10, $2, $17); /* r17 = x2 * tn2 (6420) */ \
- psraw($17, 15, $17); \
- pmfhl_uw($3); /* r3 = 7531 */ \
- psraw($3, 15, $3); \
- pinteh($3, $17, $17); /* r17 = x3 * tn3 */ \
- psubh($17, $14, $17); /* r17 = tm26 */ \
-\
- pmulth($14, $2, $18); /* r18 = x6 * tn2 (6420) */ \
- psraw($18, 15, $18); \
- pmfhl_uw($3); /* r3 = 7531 */ \
- psraw($3, 15, $3); \
- pinteh($3, $18, $18); /* r18 = x6 * tn2 */ \
- paddh($18, $10, $18); /* r18 = tp26 */ \
-\
- paddh($8, $12, $2); /* r2 = tp04 */ \
- psubh($8, $12, $3); /* r3 = tm04 */ \
-\
- paddh($2, $18, $16); /* r16 = a0 */ \
- psubh($2, $18, $19); /* r19 = a3 */ \
- psubh($3, $17, $18); /* r18 = a2 */ \
- paddh($3, $17, $17); /* r17 = a1 */
-
-
-#define DCT_8_INV_COL8_STORE(blk) \
-\
- paddh($16, $20, $2); /* y0 a0+b0 */ \
- psubh($16, $20, $16); /* y7 a0-b0 */ \
- psrah($2, SHIFT_INV_COL, $2); \
- psrah($16, SHIFT_INV_COL, $16); \
- sq($2, 0, blk); \
- sq($16, 112, blk); \
-\
- paddh($17, $21, $3); /* y1 a1+b1 */ \
- psubh($17, $21, $17); /* y6 a1-b1 */ \
- psrah($3, SHIFT_INV_COL, $3); \
- psrah($17, SHIFT_INV_COL, $17); \
- sq($3, 16, blk); \
- sq($17, 96, blk); \
-\
- paddh($18, $22, $2); /* y2 a2+b2 */ \
- psubh($18, $22, $18); /* y5 a2-b2 */ \
- psrah($2, SHIFT_INV_COL, $2); \
- psrah($18, SHIFT_INV_COL, $18); \
- sq($2, 32, blk); \
- sq($18, 80, blk); \
-\
- paddh($19, $23, $3); /* y3 a3+b3 */ \
- psubh($19, $23, $19); /* y4 a3-b3 */ \
- psrah($3, SHIFT_INV_COL, $3); \
- psrah($19, SHIFT_INV_COL, $19); \
- sq($3, 48, blk); \
- sq($19, 64, blk);
-
-
-
-#define DCT_8_INV_COL8_PMS() \
- paddh($16, $20, $2); /* y0 a0+b0 */ \
- psubh($16, $20, $20); /* y7 a0-b0 */ \
- psrah($2, SHIFT_INV_COL, $16); \
- psrah($20, SHIFT_INV_COL, $20); \
-\
- paddh($17, $21, $3); /* y1 a1+b1 */ \
- psubh($17, $21, $21); /* y6 a1-b1 */ \
- psrah($3, SHIFT_INV_COL, $17); \
- psrah($21, SHIFT_INV_COL, $21); \
-\
- paddh($18, $22, $2); /* y2 a2+b2 */ \
- psubh($18, $22, $22); /* y5 a2-b2 */ \
- psrah($2, SHIFT_INV_COL, $18); \
- psrah($22, SHIFT_INV_COL, $22); \
-\
- paddh($19, $23, $3); /* y3 a3+b3 */ \
- psubh($19, $23, $23); /* y4 a3-b3 */ \
- psrah($3, SHIFT_INV_COL, $19); \
- psrah($23, SHIFT_INV_COL, $23);
-
-#define PUT(rs) \
- pminh(rs, $11, $2); \
- pmaxh($2, $0, $2); \
- ppacb($0, $2, $2); \
- sd3(2, 0, 4); \
- __asm__ volatile ("add $4, $5, $4");
-
-#define DCT_8_INV_COL8_PUT() \
- PUT($16); \
- PUT($17); \
- PUT($18); \
- PUT($19); \
- PUT($23); \
- PUT($22); \
- PUT($21); \
- PUT($20);
-
-#define ADD(rs) \
- ld3(4, 0, 2); \
- pextlb($0, $2, $2); \
- paddh($2, rs, $2); \
- pminh($2, $11, $2); \
- pmaxh($2, $0, $2); \
- ppacb($0, $2, $2); \
- sd3(2, 0, 4); \
- __asm__ volatile ("add $4, $5, $4");
-
-/*fixme: schedule*/
-#define DCT_8_INV_COL8_ADD() \
- ADD($16); \
- ADD($17); \
- ADD($18); \
- ADD($19); \
- ADD($23); \
- ADD($22); \
- ADD($21); \
- ADD($20);
-
-
-void ff_mmi_idct(int16_t * block)
-{
- /* $4 = block */
- __asm__ volatile("la $24, %0"::"m"(consttable[0]));
- lq($24, ROUNDER_0, $8);
- lq($24, ROUNDER_1, $7);
- DCT_8_INV_ROW1($4, 0, TAB_i_04, $8, $8);
- DCT_8_INV_ROW1($4, 16, TAB_i_17, $7, $9);
- DCT_8_INV_ROW1($4, 32, TAB_i_26, $7, $10);
- DCT_8_INV_ROW1($4, 48, TAB_i_35, $7, $11);
- DCT_8_INV_ROW1($4, 64, TAB_i_04, $7, $12);
- DCT_8_INV_ROW1($4, 80, TAB_i_35, $7, $13);
- DCT_8_INV_ROW1($4, 96, TAB_i_26, $7, $14);
- DCT_8_INV_ROW1($4, 112, TAB_i_17, $7, $15);
- DCT_8_INV_COL8();
- DCT_8_INV_COL8_STORE($4);
-
- //let savedtemp regs be saved
- __asm__ volatile(" ":::"$16", "$17", "$18", "$19", "$20", "$21", "$22", "$23");
-}
-
-
-void ff_mmi_idct_put(uint8_t *dest, int line_size, DCTELEM *block)
-{
- /* $4 = dest, $5 = line_size, $6 = block */
- __asm__ volatile("la $24, %0"::"m"(consttable[0]));
- lq($24, ROUNDER_0, $8);
- lq($24, ROUNDER_1, $7);
- DCT_8_INV_ROW1($6, 0, TAB_i_04, $8, $8);
- DCT_8_INV_ROW1($6, 16, TAB_i_17, $7, $9);
- DCT_8_INV_ROW1($6, 32, TAB_i_26, $7, $10);
- DCT_8_INV_ROW1($6, 48, TAB_i_35, $7, $11);
- DCT_8_INV_ROW1($6, 64, TAB_i_04, $7, $12);
- DCT_8_INV_ROW1($6, 80, TAB_i_35, $7, $13);
- DCT_8_INV_ROW1($6, 96, TAB_i_26, $7, $14);
- DCT_8_INV_ROW1($6, 112, TAB_i_17, $7, $15);
- DCT_8_INV_COL8();
- lq($24, CLIPMAX, $11);
- DCT_8_INV_COL8_PMS();
- DCT_8_INV_COL8_PUT();
-
- //let savedtemp regs be saved
- __asm__ volatile(" ":::"$16", "$17", "$18", "$19", "$20", "$21", "$22", "$23");
-}
-
-
-void ff_mmi_idct_add(uint8_t *dest, int line_size, DCTELEM *block)
-{
- /* $4 = dest, $5 = line_size, $6 = block */
- __asm__ volatile("la $24, %0"::"m"(consttable[0]));
- lq($24, ROUNDER_0, $8);
- lq($24, ROUNDER_1, $7);
- DCT_8_INV_ROW1($6, 0, TAB_i_04, $8, $8);
- DCT_8_INV_ROW1($6, 16, TAB_i_17, $7, $9);
- DCT_8_INV_ROW1($6, 32, TAB_i_26, $7, $10);
- DCT_8_INV_ROW1($6, 48, TAB_i_35, $7, $11);
- DCT_8_INV_ROW1($6, 64, TAB_i_04, $7, $12);
- DCT_8_INV_ROW1($6, 80, TAB_i_35, $7, $13);
- DCT_8_INV_ROW1($6, 96, TAB_i_26, $7, $14);
- DCT_8_INV_ROW1($6, 112, TAB_i_17, $7, $15);
- DCT_8_INV_COL8();
- lq($24, CLIPMAX, $11);
- DCT_8_INV_COL8_PMS();
- DCT_8_INV_COL8_ADD();
-
- //let savedtemp regs be saved
- __asm__ volatile(" ":::"$16", "$17", "$18", "$19", "$20", "$21", "$22", "$23");
-}
-
diff --git a/gst-libs/ext/libav/libavcodec/ps2/mmi.h b/gst-libs/ext/libav/libavcodec/ps2/mmi.h
deleted file mode 100644
index fc8d328..0000000
--- a/gst-libs/ext/libav/libavcodec/ps2/mmi.h
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
- * copyright (c) 2002 Leon van Stuivenberg
- *
- * 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
- */
-
-#ifndef AVCODEC_PS2_MMI_H
-#define AVCODEC_PS2_MMI_H
-
-#define align16 __attribute__ ((aligned (16)))
-
-/*
-#define r0 $zero
-#define r1 $at //assembler!
-#define r2 $v0 //return
-#define r3 $v1 //return
-#define r4 $a0 //arg
-#define r5 $a1 //arg
-#define r6 $a2 //arg
-#define r7 $a3 //arg
-#define r8 $t0 //temp
-#define r9 $t1 //temp
-#define r10 $t2 //temp
-#define r11 $t3 //temp
-#define r12 $t4 //temp
-#define r13 $t5 //temp
-#define r14 $t6 //temp
-#define r15 $t7 //temp
-#define r16 $s0 //saved temp
-#define r17 $s1 //saved temp
-#define r18 $s2 //saved temp
-#define r19 $s3 //saved temp
-#define r20 $s4 //saved temp
-#define r21 $s5 //saved temp
-#define r22 $s6 //saved temp
-#define r23 $s7 //saved temp
-#define r24 $t8 //temp
-#define r25 $t9 //temp
-#define r26 $k0 //kernel
-#define r27 $k1 //kernel
-#define r28 $gp //global ptr
-#define r29 $sp //stack ptr
-#define r30 $fp //frame ptr
-#define r31 $ra //return addr
-*/
-
-
-#define lq(base, off, reg) \
- __asm__ volatile ("lq " #reg ", %0("#base ")" : : "i" (off) )
-
-#define lq2(mem, reg) \
- __asm__ volatile ("lq " #reg ", %0" : : "r" (mem))
-
-#define sq(reg, off, base) \
- __asm__ volatile ("sq " #reg ", %0("#base ")" : : "i" (off) )
-
-/*
-#define ld(base, off, reg) \
- __asm__ volatile ("ld " #reg ", " #off "("#base ")")
-*/
-
-#define ld3(base, off, reg) \
- __asm__ volatile (".word %0" : : "i" ( 0xdc000000 | (base<<21) | (reg<<16) | (off)))
-
-#define ldr3(base, off, reg) \
- __asm__ volatile (".word %0" : : "i" ( 0x6c000000 | (base<<21) | (reg<<16) | (off)))
-
-#define ldl3(base, off, reg) \
- __asm__ volatile (".word %0" : : "i" ( 0x68000000 | (base<<21) | (reg<<16) | (off)))
-
-/*
-#define sd(reg, off, base) \
- __asm__ volatile ("sd " #reg ", " #off "("#base ")")
-*/
-//seems assembler has bug encoding mnemonic 'sd', so DIY
-#define sd3(reg, off, base) \
- __asm__ volatile (".word %0" : : "i" ( 0xfc000000 | (base<<21) | (reg<<16) | (off)))
-
-#define sw(reg, off, base) \
- __asm__ volatile ("sw " #reg ", " #off "("#base ")")
-
-#define sq2(reg, mem) \
- __asm__ volatile ("sq " #reg ", %0" : : "m" (*(mem)))
-
-#define pinth(rs, rt, rd) \
- __asm__ volatile ("pinth " #rd ", " #rs ", " #rt )
-
-#define phmadh(rs, rt, rd) \
- __asm__ volatile ("phmadh " #rd ", " #rs ", " #rt )
-
-#define pcpyud(rs, rt, rd) \
- __asm__ volatile ("pcpyud " #rd ", " #rs ", " #rt )
-
-#define pcpyld(rs, rt, rd) \
- __asm__ volatile ("pcpyld " #rd ", " #rs ", " #rt )
-
-#define pcpyh(rt, rd) \
- __asm__ volatile ("pcpyh " #rd ", " #rt )
-
-#define paddw(rs, rt, rd) \
- __asm__ volatile ("paddw " #rd ", " #rs ", " #rt )
-
-#define pextlw(rs, rt, rd) \
- __asm__ volatile ("pextlw " #rd ", " #rs ", " #rt )
-
-#define pextuw(rs, rt, rd) \
- __asm__ volatile ("pextuw " #rd ", " #rs ", " #rt )
-
-#define pextlh(rs, rt, rd) \
- __asm__ volatile ("pextlh " #rd ", " #rs ", " #rt )
-
-#define pextuh(rs, rt, rd) \
- __asm__ volatile ("pextuh " #rd ", " #rs ", " #rt )
-
-#define psubw(rs, rt, rd) \
- __asm__ volatile ("psubw " #rd ", " #rs ", " #rt )
-
-#define psraw(rt, sa, rd) \
- __asm__ volatile ("psraw " #rd ", " #rt ", %0" : : "i"(sa) )
-
-#define ppach(rs, rt, rd) \
- __asm__ volatile ("ppach " #rd ", " #rs ", " #rt )
-
-#define ppacb(rs, rt, rd) \
- __asm__ volatile ("ppacb " #rd ", " #rs ", " #rt )
-
-#define prevh(rt, rd) \
- __asm__ volatile ("prevh " #rd ", " #rt )
-
-#define pmulth(rs, rt, rd) \
- __asm__ volatile ("pmulth " #rd ", " #rs ", " #rt )
-
-#define pmaxh(rs, rt, rd) \
- __asm__ volatile ("pmaxh " #rd ", " #rs ", " #rt )
-
-#define pminh(rs, rt, rd) \
- __asm__ volatile ("pminh " #rd ", " #rs ", " #rt )
-
-#define pinteh(rs, rt, rd) \
- __asm__ volatile ("pinteh " #rd ", " #rs ", " #rt )
-
-#define paddh(rs, rt, rd) \
- __asm__ volatile ("paddh " #rd ", " #rs ", " #rt )
-
-#define psubh(rs, rt, rd) \
- __asm__ volatile ("psubh " #rd ", " #rs ", " #rt )
-
-#define psrah(rt, sa, rd) \
- __asm__ volatile ("psrah " #rd ", " #rt ", %0" : : "i"(sa) )
-
-#define pmfhl_uw(rd) \
- __asm__ volatile ("pmfhl.uw " #rd)
-
-#define pextlb(rs, rt, rd) \
- __asm__ volatile ("pextlb " #rd ", " #rs ", " #rt )
-
-#endif /* AVCODEC_PS2_MMI_H */
diff --git a/gst-libs/ext/libav/libavcodec/ps2/mpegvideo_mmi.c b/gst-libs/ext/libav/libavcodec/ps2/mpegvideo_mmi.c
deleted file mode 100644
index ed56893..0000000
--- a/gst-libs/ext/libav/libavcodec/ps2/mpegvideo_mmi.c
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Copyright (c) 2000,2001 Fabrice Bellard
- *
- * MMI optimization by Leon van Stuivenberg
- *
- * 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
- */
-
-#include "libavcodec/avcodec.h"
-#include "libavcodec/dsputil.h"
-#include "libavcodec/mpegvideo.h"
-
-static void dct_unquantize_h263_mmi(MpegEncContext *s,
- DCTELEM *block, int n, int qscale)
-{
- int level=0, qmul, qadd;
- int nCoeffs;
-
- assert(s->block_last_index[n]>=0);
-
- qadd = (qscale - 1) | 1;
- qmul = qscale << 1;
-
- if (s->mb_intra) {
- if (!s->h263_aic) {
- if (n < 4)
- level = block[0] * s->y_dc_scale;
- else
- level = block[0] * s->c_dc_scale;
- }else {
- qadd = 0;
- level = block[0];
- }
- nCoeffs= 63; //does not always use zigzag table
- } else {
- nCoeffs= s->intra_scantable.raster_end[ s->block_last_index[n] ];
- }
-
- __asm__ volatile(
- "add $14, $0, %3 \n\t"
- "pcpyld $8, %0, %0 \n\t"
- "pcpyh $8, $8 \n\t" //r8 = qmul
- "pcpyld $9, %1, %1 \n\t"
- "pcpyh $9, $9 \n\t" //r9 = qadd
- ".p2align 2 \n\t"
- "1: \n\t"
- "lq $10, 0($14) \n\t" //r10 = level
- "addi $14, $14, 16 \n\t" //block+=8
- "addi %2, %2, -8 \n\t"
- "pcgth $11, $0, $10 \n\t" //r11 = level < 0 ? -1 : 0
- "pcgth $12, $10, $0 \n\t" //r12 = level > 0 ? -1 : 0
- "por $12, $11, $12 \n\t"
- "pmulth $10, $10, $8 \n\t"
- "paddh $13, $9, $11 \n\t"
- "pxor $13, $13, $11 \n\t" //r13 = level < 0 ? -qadd : qadd
- "pmfhl.uw $11 \n\t"
- "pinteh $10, $11, $10 \n\t" //r10 = level * qmul
- "paddh $10, $10, $13 \n\t"
- "pand $10, $10, $12 \n\t"
- "sq $10, -16($14) \n\t"
- "bgez %2, 1b \n\t"
- :: "r"(qmul), "r" (qadd), "r" (nCoeffs), "r" (block) : "$8", "$9", "$10", "$11", "$12", "$13", "$14", "memory" );
-
- if(s->mb_intra)
- block[0]= level;
-}
-
-
-void MPV_common_init_mmi(MpegEncContext *s)
-{
- s->dct_unquantize_h263_intra =
- s->dct_unquantize_h263_inter = dct_unquantize_h263_mmi;
-}
-
-
diff --git a/gst-libs/ext/libav/libavcodec/psymodel.c b/gst-libs/ext/libav/libavcodec/psymodel.c
index 740d859..a2af611 100644
--- a/gst-libs/ext/libav/libavcodec/psymodel.c
+++ b/gst-libs/ext/libav/libavcodec/psymodel.c
@@ -19,9 +19,12 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <string.h>
+
#include "avcodec.h"
#include "psymodel.h"
#include "iirfilter.h"
+#include "libavutil/mem.h"
extern const FFPsyModel ff_aac_psy_model;
@@ -51,7 +54,7 @@ av_cold int ff_psy_init(FFPsyContext *ctx, AVCodecContext *avctx, int num_lens,
}
switch (ctx->avctx->codec_id) {
- case CODEC_ID_AAC:
+ case AV_CODEC_ID_AAC:
ctx->model = &ff_aac_psy_model;
break;
}
@@ -112,20 +115,15 @@ av_cold struct FFPsyPreprocessContext* ff_psy_preprocess_init(AVCodecContext *av
return ctx;
}
-void ff_psy_preprocess(struct FFPsyPreprocessContext *ctx,
- const int16_t *audio, int16_t *dest,
- int tag, int channels)
+void ff_psy_preprocess(struct FFPsyPreprocessContext *ctx, float **audio, int channels)
{
- int ch, i;
+ int ch;
+ int frame_size = ctx->avctx->frame_size;
+
if (ctx->fstate) {
for (ch = 0; ch < channels; ch++)
- ff_iir_filter(ctx->fcoeffs, ctx->fstate[tag+ch], ctx->avctx->frame_size,
- audio + ch, ctx->avctx->channels,
- dest + ch, ctx->avctx->channels);
- } else {
- for (ch = 0; ch < channels; ch++)
- for (i = 0; i < ctx->avctx->frame_size; i++)
- dest[i*ctx->avctx->channels + ch] = audio[i*ctx->avctx->channels + ch];
+ ff_iir_filter_flt(ctx->fcoeffs, ctx->fstate[ch], frame_size,
+ &audio[ch][frame_size], 1, &audio[ch][frame_size], 1);
}
}
@@ -139,4 +137,3 @@ av_cold void ff_psy_preprocess_end(struct FFPsyPreprocessContext *ctx)
av_freep(&ctx->fstate);
av_free(ctx);
}
-
diff --git a/gst-libs/ext/libav/libavcodec/psymodel.h b/gst-libs/ext/libav/libavcodec/psymodel.h
index 3e866e4..34b20d7 100644
--- a/gst-libs/ext/libav/libavcodec/psymodel.h
+++ b/gst-libs/ext/libav/libavcodec/psymodel.h
@@ -109,7 +109,7 @@ typedef struct FFPsyModel {
*
* @return suggested window information in a structure
*/
- FFPsyWindowInfo (*window)(FFPsyContext *ctx, const int16_t *audio, const int16_t *la, int channel, int prev_type);
+ FFPsyWindowInfo (*window)(FFPsyContext *ctx, const float *audio, const float *la, int channel, int prev_type);
/**
* Perform psychoacoustic analysis and set band info (threshold, energy) for a group of channels.
@@ -174,14 +174,10 @@ av_cold struct FFPsyPreprocessContext* ff_psy_preprocess_init(AVCodecContext *av
* Preprocess several channel in audio frame in order to compress it better.
*
* @param ctx preprocessing context
- * @param audio samples to preprocess
- * @param dest place to put filtered samples
- * @param tag channel number
- * @param channels number of channel to preprocess (some additional work may be done on stereo pair)
+ * @param audio samples to be filtered (in place)
+ * @param channels number of channel to preprocess
*/
-void ff_psy_preprocess(struct FFPsyPreprocessContext *ctx,
- const int16_t *audio, int16_t *dest,
- int tag, int channels);
+void ff_psy_preprocess(struct FFPsyPreprocessContext *ctx, float **audio, int channels);
/**
* Cleanup audio preprocessing module.
diff --git a/gst-libs/ext/libav/libavcodec/pthread.c b/gst-libs/ext/libav/libavcodec/pthread.c
index 64cff43..73d9da3 100644
--- a/gst-libs/ext/libav/libavcodec/pthread.c
+++ b/gst-libs/ext/libav/libavcodec/pthread.c
@@ -52,6 +52,7 @@
#include "avcodec.h"
#include "internal.h"
#include "thread.h"
+#include "libavutil/common.h"
#if HAVE_PTHREADS
#include <pthread.h>
@@ -356,7 +357,7 @@ static attribute_align_arg void *frame_worker_thread(void *arg)
PerThreadContext *p = arg;
FrameThreadContext *fctx = p->parent;
AVCodecContext *avctx = p->avctx;
- AVCodec *codec = avctx->codec;
+ const AVCodec *codec = avctx->codec;
while (1) {
if (p->state == STATE_INPUT_READY && !fctx->die) {
@@ -376,6 +377,10 @@ static attribute_align_arg void *frame_worker_thread(void *arg)
p->got_frame = 0;
p->result = codec->decode(avctx, &p->frame, &p->got_frame, &p->avpkt);
+ /* many decoders assign whole AVFrames, thus overwriting extended_data;
+ * make sure it's set correctly */
+ p->frame.extended_data = p->frame.data;
+
if (p->state == STATE_SETTING_UP) ff_thread_finish_setup(avctx);
p->state = STATE_INPUT_READY;
@@ -402,7 +407,6 @@ static int update_context_from_thread(AVCodecContext *dst, AVCodecContext *src,
int err = 0;
if (dst != src) {
- dst->sub_id = src->sub_id;
dst->time_base = src->time_base;
dst->width = src->width;
dst->height = src->height;
@@ -458,14 +462,13 @@ static int update_context_from_user(AVCodecContext *dst, AVCodecContext *src)
dst->release_buffer = src->release_buffer;
dst->opaque = src->opaque;
- dst->dsp_mask = src->dsp_mask;
dst->debug = src->debug;
dst->debug_mv = src->debug_mv;
dst->slice_flags = src->slice_flags;
dst->flags2 = src->flags2;
- copy_fields(skip_loop_filter, bidir_refine);
+ copy_fields(skip_loop_filter, subtitle_header);
dst->frame_number = src->frame_number;
dst->reordered_opaque = src->reordered_opaque;
@@ -518,7 +521,7 @@ static int submit_packet(PerThreadContext *p, AVPacket *avpkt)
{
FrameThreadContext *fctx = p->parent;
PerThreadContext *prev_thread = fctx->prev_thread;
- AVCodec *codec = p->avctx->codec;
+ const AVCodec *codec = p->avctx->codec;
uint8_t *buf = p->avpkt.data;
if (!avpkt->size && !(codec->capabilities & CODEC_CAP_DELAY)) return 0;
@@ -567,7 +570,7 @@ static int submit_packet(PerThreadContext *p, AVPacket *avpkt)
pthread_cond_wait(&p->progress_cond, &p->progress_mutex);
if (p->state == STATE_GET_BUFFER) {
- p->result = p->avctx->get_buffer(p->avctx, p->requested_frame);
+ p->result = ff_get_buffer(p->avctx, p->requested_frame);
p->state = STATE_SETTING_UP;
pthread_cond_signal(&p->progress_cond);
}
@@ -604,11 +607,12 @@ int ff_thread_decode_frame(AVCodecContext *avctx,
* If we're still receiving the initial packets, don't return a frame.
*/
- if (fctx->delaying && avpkt->size) {
+ if (fctx->delaying) {
if (fctx->next_decoding >= (avctx->thread_count-1)) fctx->delaying = 0;
*got_picture_ptr=0;
- return avpkt->size;
+ if (avpkt->size)
+ return avpkt->size;
}
/*
@@ -631,10 +635,6 @@ int ff_thread_decode_frame(AVCodecContext *avctx,
*picture = p->frame;
*got_picture_ptr = p->got_frame;
picture->pkt_dts = p->avpkt.dts;
- picture->sample_aspect_ratio = p->avctx->sample_aspect_ratio;
- picture->width = p->avctx->width;
- picture->height = p->avctx->height;
- picture->format = p->avctx->pix_fmt;
/*
* A later call with avkpt->size == 0 may loop over all threads,
@@ -724,7 +724,7 @@ static void park_frame_worker_threads(FrameThreadContext *fctx, int thread_count
static void frame_thread_free(AVCodecContext *avctx, int thread_count)
{
FrameThreadContext *fctx = avctx->thread_opaque;
- AVCodec *codec = avctx->codec;
+ const AVCodec *codec = avctx->codec;
int i;
park_frame_worker_threads(fctx, thread_count);
@@ -781,7 +781,7 @@ static void frame_thread_free(AVCodecContext *avctx, int thread_count)
static int frame_thread_init(AVCodecContext *avctx)
{
int thread_count = avctx->thread_count;
- AVCodec *codec = avctx->codec;
+ const AVCodec *codec = avctx->codec;
AVCodecContext *src = avctx;
FrameThreadContext *fctx;
int i, err = 0;
@@ -870,6 +870,7 @@ error:
void ff_thread_flush(AVCodecContext *avctx)
{
+ int i;
FrameThreadContext *fctx = avctx->thread_opaque;
if (!avctx->thread_opaque) return;
@@ -885,6 +886,13 @@ void ff_thread_flush(AVCodecContext *avctx)
fctx->next_decoding = fctx->next_finished = 0;
fctx->delaying = 1;
fctx->prev_thread = NULL;
+ for (i = 0; i < avctx->thread_count; i++) {
+ PerThreadContext *p = &fctx->threads[i];
+ // Make sure decode flush calls with size=0 won't return old frames
+ p->got_frame = 0;
+
+ release_delayed_buffers(p);
+ }
}
static int *allocate_progress(PerThreadContext *p)
@@ -913,7 +921,7 @@ int ff_thread_get_buffer(AVCodecContext *avctx, AVFrame *f)
if (!(avctx->active_thread_type&FF_THREAD_FRAME)) {
f->thread_opaque = NULL;
- return avctx->get_buffer(avctx, f);
+ return ff_get_buffer(avctx, f);
}
if (p->state != STATE_SETTING_UP &&
@@ -935,7 +943,7 @@ int ff_thread_get_buffer(AVCodecContext *avctx, AVFrame *f)
if (avctx->thread_safe_callbacks ||
avctx->get_buffer == avcodec_default_get_buffer) {
- err = avctx->get_buffer(avctx, f);
+ err = ff_get_buffer(avctx, f);
} else {
p->requested_frame = f;
p->state = STATE_GET_BUFFER;
@@ -953,6 +961,10 @@ int ff_thread_get_buffer(AVCodecContext *avctx, AVFrame *f)
ff_thread_finish_setup(avctx);
}
+ if (err) {
+ free_progress(f);
+ f->thread_opaque = NULL;
+ }
pthread_mutex_unlock(&p->parent->buffer_mutex);
return err;
@@ -1009,6 +1021,11 @@ static void validate_thread_parameters(AVCodecContext *avctx)
avctx->thread_count = 1;
avctx->active_thread_type = 0;
}
+
+ if (avctx->thread_count > MAX_AUTO_THREADS)
+ av_log(avctx, AV_LOG_WARNING,
+ "Application has requested %d threads. Using a thread count greater than %d is not recommended.\n",
+ avctx->thread_count, MAX_AUTO_THREADS);
}
int ff_thread_init(AVCodecContext *avctx)
diff --git a/gst-libs/ext/libav/libavcodec/ptx.c b/gst-libs/ext/libav/libavcodec/ptx.c
index fd4933c..d4cd963 100644
--- a/gst-libs/ext/libav/libavcodec/ptx.c
+++ b/gst-libs/ext/libav/libavcodec/ptx.c
@@ -19,9 +19,11 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "libavutil/common.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/imgutils.h"
#include "avcodec.h"
+#include "internal.h"
typedef struct PTXContext {
AVFrame picture;
@@ -36,7 +38,7 @@ static av_cold int ptx_init(AVCodecContext *avctx) {
return 0;
}
-static int ptx_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
+static int ptx_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
AVPacket *avpkt) {
const uint8_t *buf = avpkt->data;
const uint8_t *buf_end = avpkt->data + avpkt->size;
@@ -55,10 +57,10 @@ static int ptx_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
if (bytes_per_pixel != 2) {
av_log_ask_for_sample(avctx, "Image format is not RGB15.\n");
- return -1;
+ return AVERROR_PATCHWELCOME;
}
- avctx->pix_fmt = PIX_FMT_RGB555;
+ avctx->pix_fmt = AV_PIX_FMT_RGB555;
if (buf_end - buf < offset)
return AVERROR_INVALIDDATA;
@@ -74,7 +76,7 @@ static int ptx_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
return -1;
if (w != avctx->width || h != avctx->height)
avcodec_set_dimensions(avctx, w, h);
- if (avctx->get_buffer(avctx, p) < 0) {
+ if (ff_get_buffer(avctx, p) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return -1;
}
@@ -97,7 +99,7 @@ static int ptx_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
}
*picture = s->picture;
- *data_size = sizeof(AVPicture);
+ *got_frame = 1;
if (y < h) {
av_log(avctx, AV_LOG_WARNING, "incomplete packet\n");
@@ -119,11 +121,11 @@ static av_cold int ptx_end(AVCodecContext *avctx) {
AVCodec ff_ptx_decoder = {
.name = "ptx",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_PTX,
+ .id = AV_CODEC_ID_PTX,
.priv_data_size = sizeof(PTXContext),
.init = ptx_init,
.close = ptx_end,
.decode = ptx_decode_frame,
.capabilities = CODEC_CAP_DR1,
- .long_name = NULL_IF_CONFIG_SMALL("V.Flash PTX image"),
+ .long_name = NULL_IF_CONFIG_SMALL("V.Flash PTX image"),
};
diff --git a/gst-libs/ext/libav/libavcodec/put_bits.h b/gst-libs/ext/libav/libavcodec/put_bits.h
index 905461a..d13a744 100644
--- a/gst-libs/ext/libav/libavcodec/put_bits.h
+++ b/gst-libs/ext/libav/libavcodec/put_bits.h
@@ -106,7 +106,7 @@ static inline void flush_put_bits(PutBitContext *s)
#ifdef BITSTREAM_WRITER_LE
#define avpriv_align_put_bits align_put_bits_unsupported_here
-#define ff_put_string ff_put_string_unsupported_here
+#define avpriv_put_string ff_put_string_unsupported_here
#define avpriv_copy_bits avpriv_copy_bits_unsupported_here
#else
/**
@@ -119,7 +119,7 @@ void avpriv_align_put_bits(PutBitContext *s);
*
* @param terminate_string 0-terminates the written string if value is 1
*/
-void ff_put_string(PutBitContext *pb, const char *string, int terminate_string);
+void avpriv_put_string(PutBitContext *pb, const char *string, int terminate_string);
/**
* Copy the content of src to the bitstream.
@@ -138,13 +138,11 @@ static inline void put_bits(PutBitContext *s, int n, unsigned int value)
unsigned int bit_buf;
int bit_left;
- // printf("put_bits=%d %x\n", n, value);
assert(n <= 31 && value < (1U << n));
bit_buf = s->bit_buf;
bit_left = s->bit_left;
- // printf("n=%d value=%x cnt=%d buf=%x\n", n, value, bit_cnt, bit_buf);
/* XXX: optimize */
#ifdef BITSTREAM_WRITER_LE
bit_buf |= value << (32 - bit_left);
@@ -163,7 +161,6 @@ static inline void put_bits(PutBitContext *s, int n, unsigned int value)
bit_buf<<=bit_left;
bit_buf |= value >> (n - bit_left);
AV_WB32(s->buf_ptr, bit_buf);
- //printf("bitbuf = %08x\n", bit_buf);
s->buf_ptr+=4;
bit_left+=32 - n;
bit_buf = value;
diff --git a/gst-libs/ext/libav/libavcodec/qcelpdata.h b/gst-libs/ext/libav/libavcodec/qcelpdata.h
index 4c6cf15..319833e 100644
--- a/gst-libs/ext/libav/libavcodec/qcelpdata.h
+++ b/gst-libs/ext/libav/libavcodec/qcelpdata.h
@@ -37,7 +37,7 @@
/**
* QCELP unpacked data frame
*/
-typedef struct {
+typedef struct QCELPFrame {
/// @name QCELP excitation codebook parameters
/// @{
uint8_t cbsign[16]; ///< sign of the codebook gain for each codebook subframe
@@ -73,7 +73,7 @@ typedef struct {
*/
static const float qcelp_hammsinc_table[4] = { -0.006822, 0.041249, -0.143459, 0.588863};
-typedef struct {
+typedef struct QCELPBitmap {
uint8_t index; /**< index into the QCELPContext structure */
uint8_t bitpos; /**< position of the lowest bit in the value's byte */
uint8_t bitlen; /**< number of bits to read */
diff --git a/gst-libs/ext/libav/libavcodec/qcelpdec.c b/gst-libs/ext/libav/libavcodec/qcelpdec.c
index a3af237..b702175 100644
--- a/gst-libs/ext/libav/libavcodec/qcelpdec.c
+++ b/gst-libs/ext/libav/libavcodec/qcelpdec.c
@@ -29,13 +29,12 @@
#include <stddef.h>
+#include "libavutil/channel_layout.h"
#include "avcodec.h"
#include "internal.h"
#include "get_bits.h"
-
+#include "dsputil.h"
#include "qcelpdata.h"
-
-#include "celp_math.h"
#include "celp_filters.h"
#include "acelp_filters.h"
#include "acelp_vectors.h"
@@ -91,7 +90,9 @@ static av_cold int qcelp_decode_init(AVCodecContext *avctx)
QCELPContext *q = avctx->priv_data;
int i;
- avctx->sample_fmt = AV_SAMPLE_FMT_FLT;
+ avctx->channels = 1;
+ avctx->channel_layout = AV_CH_LAYOUT_MONO;
+ avctx->sample_fmt = AV_SAMPLE_FMT_FLT;
for (i = 0; i < 10; i++)
q->prev_lspf[i] = (i + 1) / 11.;
@@ -401,8 +402,9 @@ static void apply_gain_ctrl(float *v_out, const float *v_ref, const float *v_in)
for (i = 0; i < 160; i += 40)
ff_scale_vector_to_given_sum_of_squares(v_out + i, v_in + i,
- ff_dot_productf(v_ref + i,
- v_ref + i, 40),
+ ff_scalarproduct_float_c(v_ref + i,
+ v_ref + i,
+ 40),
40);
}
@@ -678,8 +680,8 @@ static void postfilter(QCELPContext *q, float *samples, float *lpc)
ff_tilt_compensation(&q->postfilter_tilt_mem, 0.3, pole_out + 10, 160);
ff_adaptive_gain_control(samples, pole_out + 10,
- ff_dot_productf(q->formant_mem + 10,
- q->formant_mem + 10, 160),
+ ff_scalarproduct_float_c(q->formant_mem + 10,
+ q->formant_mem + 10, 160),
160, 0.9375, &q->postfilter_agc_mem);
}
@@ -697,7 +699,7 @@ static int qcelp_decode_frame(AVCodecContext *avctx, void *data,
/* get output buffer */
q->avframe.nb_samples = 160;
- if ((ret = avctx->get_buffer(avctx, &q->avframe)) < 0) {
+ if ((ret = ff_get_buffer(avctx, &q->avframe)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return ret;
}
@@ -793,7 +795,7 @@ erasure:
AVCodec ff_qcelp_decoder = {
.name = "qcelp",
.type = AVMEDIA_TYPE_AUDIO,
- .id = CODEC_ID_QCELP,
+ .id = AV_CODEC_ID_QCELP,
.init = qcelp_decode_init,
.decode = qcelp_decode_frame,
.capabilities = CODEC_CAP_DR1,
diff --git a/gst-libs/ext/libav/libavcodec/qdm2.c b/gst-libs/ext/libav/libavcodec/qdm2.c
index 59bce40..17729d1 100644
--- a/gst-libs/ext/libav/libavcodec/qdm2.c
+++ b/gst-libs/ext/libav/libavcodec/qdm2.c
@@ -36,9 +36,11 @@
#include <stdio.h>
#define BITSTREAM_READER_LE
+#include "libavutil/channel_layout.h"
#include "avcodec.h"
#include "get_bits.h"
#include "dsputil.h"
+#include "internal.h"
#include "rdft.h"
#include "mpegaudiodsp.h"
#include "mpegaudio.h"
@@ -69,8 +71,6 @@ do { \
#define SB_DITHERING_NOISE(sb,noise_idx) (noise_table[(noise_idx)++] * sb_noise_attenuation[(sb)])
-#define BITS_LEFT(length,gb) ((length) - get_bits_count ((gb)))
-
#define SAMPLES_NEEDED \
av_log (NULL,AV_LOG_INFO,"This file triggers some untested code. Please contact the developers.\n");
@@ -142,7 +142,6 @@ typedef struct {
/// Parameters built from header parameters, do not change during playback
int group_order; ///< order of frame group
int fft_order; ///< order of FFT (actually fftorder+1)
- int fft_frame_size; ///< size of fft frame, in components (1 comples = re + im)
int frame_size; ///< size of data frame
int frequency_range;
int sub_sampling; ///< subsampling: 0=25%, 1=50%, 2=100% */
@@ -202,8 +201,6 @@ typedef struct {
} QDM2Context;
-static uint8_t empty_buffer[FF_INPUT_BUFFER_PADDING_SIZE];
-
static VLC vlc_tab_level;
static VLC vlc_tab_diff;
static VLC vlc_tab_run;
@@ -503,7 +500,7 @@ static void fix_coding_method_array (int sb, int channels, sb_int8_array coding_
int j,k;
int ch;
int run, case_val;
- int switchtable[23] = {0,5,1,5,5,5,5,5,2,5,5,5,5,5,5,5,3,5,5,5,5,5,4};
+ static const int switchtable[23] = {0,5,1,5,5,5,5,5,2,5,5,5,5,5,5,5,3,5,5,5,5,5,4};
for (ch = 0; ch < channels; ch++) {
for (j = 0; j < 64; ) {
@@ -548,10 +545,6 @@ static void fill_tone_level_array (QDM2Context *q, int flag)
int i, sb, ch, sb_used;
int tmp, tab;
- // This should never happen
- if (q->nb_channels <= 0)
- return;
-
for (ch = 0; ch < q->nb_channels; ch++)
for (sb = 0; sb < 30; sb++)
for (i = 0; i < 8; i++) {
@@ -647,10 +640,6 @@ static void fill_coding_method_array (sb_int8_array tone_level_idx, sb_int8_arra
int add1, add2, add3, add4;
int64_t multres;
- // This should never happen
- if (nb_channels <= 0)
- return;
-
if (!superblocktype_2_3) {
/* This case is untested, no samples available */
SAMPLES_NEEDED
@@ -793,10 +782,10 @@ static void synthfilt_build_sb_samples (QDM2Context *q, GetBitContext *gb, int l
else if (sb >= 24)
joined_stereo = 1;
else
- joined_stereo = (BITS_LEFT(length,gb) >= 1) ? get_bits1 (gb) : 0;
+ joined_stereo = (get_bits_left(gb) >= 1) ? get_bits1 (gb) : 0;
if (joined_stereo) {
- if (BITS_LEFT(length,gb) >= 16)
+ if (get_bits_left(gb) >= 16)
for (j = 0; j < 16; j++)
sign_bits[j] = get_bits1 (gb);
@@ -809,14 +798,14 @@ static void synthfilt_build_sb_samples (QDM2Context *q, GetBitContext *gb, int l
}
for (ch = 0; ch < channels; ch++) {
- zero_encoding = (BITS_LEFT(length,gb) >= 1) ? get_bits1(gb) : 0;
+ zero_encoding = (get_bits_left(gb) >= 1) ? get_bits1(gb) : 0;
type34_predictor = 0.0;
type34_first = 1;
for (j = 0; j < 128; ) {
switch (q->coding_method[ch][sb][j / 2]) {
case 8:
- if (BITS_LEFT(length,gb) >= 10) {
+ if (get_bits_left(gb) >= 10) {
if (zero_encoding) {
for (k = 0; k < 5; k++) {
if ((j + 2 * k) >= 128)
@@ -838,7 +827,7 @@ static void synthfilt_build_sb_samples (QDM2Context *q, GetBitContext *gb, int l
break;
case 10:
- if (BITS_LEFT(length,gb) >= 1) {
+ if (get_bits_left(gb) >= 1) {
float f = 0.81;
if (get_bits1(gb))
@@ -852,7 +841,7 @@ static void synthfilt_build_sb_samples (QDM2Context *q, GetBitContext *gb, int l
break;
case 16:
- if (BITS_LEFT(length,gb) >= 10) {
+ if (get_bits_left(gb) >= 10) {
if (zero_encoding) {
for (k = 0; k < 5; k++) {
if ((j + k) >= 128)
@@ -872,7 +861,7 @@ static void synthfilt_build_sb_samples (QDM2Context *q, GetBitContext *gb, int l
break;
case 24:
- if (BITS_LEFT(length,gb) >= 7) {
+ if (get_bits_left(gb) >= 7) {
n = get_bits(gb, 7);
for (k = 0; k < 3; k++)
samples[k] = (random_dequant_type24[n][k] - 2.0) * 0.5;
@@ -884,7 +873,7 @@ static void synthfilt_build_sb_samples (QDM2Context *q, GetBitContext *gb, int l
break;
case 30:
- if (BITS_LEFT(length,gb) >= 4) {
+ if (get_bits_left(gb) >= 4) {
unsigned index = qdm2_get_vlc(gb, &vlc_tab_type30, 0, 1);
if (index < FF_ARRAY_ELEMS(type30_dequant)) {
samples[0] = type30_dequant[index];
@@ -897,7 +886,7 @@ static void synthfilt_build_sb_samples (QDM2Context *q, GetBitContext *gb, int l
break;
case 34:
- if (BITS_LEFT(length,gb) >= 7) {
+ if (get_bits_left(gb) >= 7) {
if (type34_first) {
type34_div = (float)(1 << get_bits(gb, 2));
samples[0] = ((float)get_bits(gb, 5) - 16.0) / 15.0;
@@ -954,24 +943,23 @@ static void synthfilt_build_sb_samples (QDM2Context *q, GetBitContext *gb, int l
*
* @param quantized_coeffs pointer to quantized_coeffs[ch][0]
* @param gb bitreader context
- * @param length packet length in bits
*/
-static void init_quantized_coeffs_elem0 (int8_t *quantized_coeffs, GetBitContext *gb, int length)
+static void init_quantized_coeffs_elem0 (int8_t *quantized_coeffs, GetBitContext *gb)
{
int i, k, run, level, diff;
- if (BITS_LEFT(length,gb) < 16)
+ if (get_bits_left(gb) < 16)
return;
level = qdm2_get_vlc(gb, &vlc_tab_level, 0, 2);
quantized_coeffs[0] = level;
for (i = 0; i < 7; ) {
- if (BITS_LEFT(length,gb) < 16)
+ if (get_bits_left(gb) < 16)
break;
run = qdm2_get_vlc(gb, &vlc_tab_run, 0, 1) + 1;
- if (BITS_LEFT(length,gb) < 16)
+ if (get_bits_left(gb) < 16)
break;
diff = qdm2_get_se_vlc(&vlc_tab_diff, gb, 2);
@@ -991,16 +979,15 @@ static void init_quantized_coeffs_elem0 (int8_t *quantized_coeffs, GetBitContext
*
* @param q context
* @param gb bitreader context
- * @param length packet length in bits
*/
-static void init_tone_level_dequantization (QDM2Context *q, GetBitContext *gb, int length)
+static void init_tone_level_dequantization (QDM2Context *q, GetBitContext *gb)
{
int sb, j, k, n, ch;
for (ch = 0; ch < q->nb_channels; ch++) {
- init_quantized_coeffs_elem0(q->quantized_coeffs[ch][0], gb, length);
+ init_quantized_coeffs_elem0(q->quantized_coeffs[ch][0], gb);
- if (BITS_LEFT(length,gb) < 16) {
+ if (get_bits_left(gb) < 16) {
memset(q->quantized_coeffs[ch][0], 0, 8);
break;
}
@@ -1011,11 +998,11 @@ static void init_tone_level_dequantization (QDM2Context *q, GetBitContext *gb, i
for (sb = 0; sb < n; sb++)
for (ch = 0; ch < q->nb_channels; ch++)
for (j = 0; j < 8; j++) {
- if (BITS_LEFT(length,gb) < 1)
+ if (get_bits_left(gb) < 1)
break;
if (get_bits1(gb)) {
for (k=0; k < 8; k++) {
- if (BITS_LEFT(length,gb) < 16)
+ if (get_bits_left(gb) < 16)
break;
q->tone_level_idx_hi1[ch][sb][j][k] = qdm2_get_vlc(gb, &vlc_tab_tone_level_idx_hi1, 0, 2);
}
@@ -1029,7 +1016,7 @@ static void init_tone_level_dequantization (QDM2Context *q, GetBitContext *gb, i
for (sb = 0; sb < n; sb++)
for (ch = 0; ch < q->nb_channels; ch++) {
- if (BITS_LEFT(length,gb) < 16)
+ if (get_bits_left(gb) < 16)
break;
q->tone_level_idx_hi2[ch][sb] = qdm2_get_vlc(gb, &vlc_tab_tone_level_idx_hi2, 0, 2);
if (sb > 19)
@@ -1044,7 +1031,7 @@ static void init_tone_level_dequantization (QDM2Context *q, GetBitContext *gb, i
for (sb = 0; sb < n; sb++)
for (ch = 0; ch < q->nb_channels; ch++)
for (j = 0; j < 8; j++) {
- if (BITS_LEFT(length,gb) < 16)
+ if (get_bits_left(gb) < 16)
break;
q->tone_level_idx_mid[ch][sb][j] = qdm2_get_vlc(gb, &vlc_tab_tone_level_idx_mid, 0, 2) - 32;
}
@@ -1093,16 +1080,14 @@ static void process_subpacket_9 (QDM2Context *q, QDM2SubPNode *node)
*
* @param q context
* @param node pointer to node with packet
- * @param length packet length in bits
*/
-static void process_subpacket_10 (QDM2Context *q, QDM2SubPNode *node, int length)
+static void process_subpacket_10 (QDM2Context *q, QDM2SubPNode *node)
{
GetBitContext gb;
- init_get_bits(&gb, ((node == NULL) ? empty_buffer : node->packet->data), ((node == NULL) ? 0 : node->packet->size*8));
-
- if (length != 0) {
- init_tone_level_dequantization(q, &gb, length);
+ if (node) {
+ init_get_bits(&gb, node->packet->data, node->packet->size * 8);
+ init_tone_level_dequantization(q, &gb);
fill_tone_level_array(q, 1);
} else {
fill_tone_level_array(q, 0);
@@ -1115,13 +1100,17 @@ static void process_subpacket_10 (QDM2Context *q, QDM2SubPNode *node, int length
*
* @param q context
* @param node pointer to node with packet
- * @param length packet length in bit
*/
-static void process_subpacket_11 (QDM2Context *q, QDM2SubPNode *node, int length)
+static void process_subpacket_11 (QDM2Context *q, QDM2SubPNode *node)
{
GetBitContext gb;
+ int length = 0;
+
+ if (node) {
+ length = node->packet->size * 8;
+ init_get_bits(&gb, node->packet->data, length);
+ }
- init_get_bits(&gb, ((node == NULL) ? empty_buffer : node->packet->data), ((node == NULL) ? 0 : node->packet->size*8));
if (length >= 32) {
int c = get_bits (&gb, 13);
@@ -1139,13 +1128,17 @@ static void process_subpacket_11 (QDM2Context *q, QDM2SubPNode *node, int length
*
* @param q context
* @param node pointer to node with packet
- * @param length packet length in bits
*/
-static void process_subpacket_12 (QDM2Context *q, QDM2SubPNode *node, int length)
+static void process_subpacket_12 (QDM2Context *q, QDM2SubPNode *node)
{
GetBitContext gb;
+ int length = 0;
+
+ if (node) {
+ length = node->packet->size * 8;
+ init_get_bits(&gb, node->packet->data, length);
+ }
- init_get_bits(&gb, ((node == NULL) ? empty_buffer : node->packet->data), ((node == NULL) ? 0 : node->packet->size*8));
synthfilt_build_sb_samples(q, &gb, length, 8, QDM2_SB_USED(q->sub_sampling));
}
@@ -1165,21 +1158,21 @@ static void process_synthesis_subpackets (QDM2Context *q, QDM2SubPNode *list)
nodes[1] = qdm2_search_subpacket_type_in_list(list, 10);
if (nodes[1] != NULL)
- process_subpacket_10(q, nodes[1], nodes[1]->packet->size << 3);
+ process_subpacket_10(q, nodes[1]);
else
- process_subpacket_10(q, NULL, 0);
+ process_subpacket_10(q, NULL);
nodes[2] = qdm2_search_subpacket_type_in_list(list, 11);
if (nodes[0] != NULL && nodes[1] != NULL && nodes[2] != NULL)
- process_subpacket_11(q, nodes[2], (nodes[2]->packet->size << 3));
+ process_subpacket_11(q, nodes[2]);
else
- process_subpacket_11(q, NULL, 0);
+ process_subpacket_11(q, NULL);
nodes[3] = qdm2_search_subpacket_type_in_list(list, 12);
if (nodes[0] != NULL && nodes[1] != NULL && nodes[3] != NULL)
- process_subpacket_12(q, nodes[3], (nodes[3]->packet->size << 3));
+ process_subpacket_12(q, nodes[3]);
else
- process_subpacket_12(q, NULL, 0);
+ process_subpacket_12(q, NULL);
}
@@ -1241,6 +1234,11 @@ static void qdm2_decode_super_block (QDM2Context *q)
for (i = 0; packet_bytes > 0; i++) {
int j;
+ if (i >= FF_ARRAY_ELEMS(q->sub_packet_list_A)) {
+ SAMPLES_NEEDED_2("too many packet bytes");
+ return;
+ }
+
q->sub_packet_list_A[i].next = NULL;
if (i > 0) {
@@ -1301,9 +1299,9 @@ static void qdm2_decode_super_block (QDM2Context *q)
process_synthesis_subpackets(q, q->sub_packet_list_D);
q->do_synth_filter = 1;
} else if (q->do_synth_filter) {
- process_subpacket_10(q, NULL, 0);
- process_subpacket_11(q, NULL, 0);
- process_subpacket_12(q, NULL, 0);
+ process_subpacket_10(q, NULL);
+ process_subpacket_11(q, NULL);
+ process_subpacket_12(q, NULL);
}
/* **************************************************************** */
}
@@ -1597,13 +1595,17 @@ static void qdm2_fft_tone_synthesizer (QDM2Context *q, int sub_packet)
static void qdm2_calculate_fft (QDM2Context *q, int channel, int sub_packet)
{
const float gain = (q->channels == 1 && q->nb_channels == 2) ? 0.5f : 1.0f;
+ float *out = q->output_buffer + channel;
int i;
q->fft.complex[channel][0].re *= 2.0f;
q->fft.complex[channel][0].im = 0.0f;
q->rdft_ctx.rdft_calc(&q->rdft_ctx, (FFTSample *)q->fft.complex[channel]);
/* add samples to output buffer */
- for (i = 0; i < ((q->fft_frame_size + 15) & ~15); i++)
- q->output_buffer[q->channels * i + channel] += ((float *) q->fft.complex[channel])[i] * gain;
+ for (i = 0; i < FFALIGN(q->fft_size, 8); i++) {
+ out[0] += q->fft.complex[channel][i].re * gain;
+ out[q->channels] += q->fft.complex[channel][i].im * gain;
+ out += 2 * q->channels;
+ }
}
@@ -1667,52 +1669,6 @@ static av_cold void qdm2_init(QDM2Context *q) {
}
-#if 0
-static void dump_context(QDM2Context *q)
-{
- int i;
-#define PRINT(a,b) av_log(NULL,AV_LOG_DEBUG," %s = %d\n", a, b);
- PRINT("compressed_data",q->compressed_data);
- PRINT("compressed_size",q->compressed_size);
- PRINT("frame_size",q->frame_size);
- PRINT("checksum_size",q->checksum_size);
- PRINT("channels",q->channels);
- PRINT("nb_channels",q->nb_channels);
- PRINT("fft_frame_size",q->fft_frame_size);
- PRINT("fft_size",q->fft_size);
- PRINT("sub_sampling",q->sub_sampling);
- PRINT("fft_order",q->fft_order);
- PRINT("group_order",q->group_order);
- PRINT("group_size",q->group_size);
- PRINT("sub_packet",q->sub_packet);
- PRINT("frequency_range",q->frequency_range);
- PRINT("has_errors",q->has_errors);
- PRINT("fft_tone_end",q->fft_tone_end);
- PRINT("fft_tone_start",q->fft_tone_start);
- PRINT("fft_coefs_index",q->fft_coefs_index);
- PRINT("coeff_per_sb_select",q->coeff_per_sb_select);
- PRINT("cm_table_select",q->cm_table_select);
- PRINT("noise_idx",q->noise_idx);
-
- for (i = q->fft_tone_start; i < q->fft_tone_end; i++)
- {
- FFTTone *t = &q->fft_tones[i];
-
- av_log(NULL,AV_LOG_DEBUG,"Tone (%d) dump:\n", i);
- av_log(NULL,AV_LOG_DEBUG," level = %f\n", t->level);
-// PRINT(" level", t->level);
- PRINT(" phase", t->phase);
- PRINT(" phase_shift", t->phase_shift);
- PRINT(" duration", t->duration);
- PRINT(" samples_im", t->samples_im);
- PRINT(" samples_re", t->samples_re);
- PRINT(" table", t->table);
- }
-
-}
-#endif
-
-
/**
* Init parameters from codec extradata
*/
@@ -1811,8 +1767,10 @@ static av_cold int qdm2_decode_init(AVCodecContext *avctx)
avctx->channels = s->nb_channels = s->channels = AV_RB32(extradata);
extradata += 4;
- if (s->channels > MPA_MAX_CHANNELS)
+ if (s->channels <= 0 || s->channels > MPA_MAX_CHANNELS)
return AVERROR_INVALIDDATA;
+ avctx->channel_layout = avctx->channels == 2 ? AV_CH_LAYOUT_STEREO :
+ AV_CH_LAYOUT_MONO;
avctx->sample_rate = AV_RB32(extradata);
extradata += 4;
@@ -1833,7 +1791,6 @@ static av_cold int qdm2_decode_init(AVCodecContext *avctx)
}
s->fft_order = av_log2(s->fft_size) + 1;
- s->fft_frame_size = 2 * s->fft_size; // complex has two floats
// something like max decodable tones
s->group_order = av_log2(s->group_size) + 1;
@@ -1896,7 +1853,6 @@ static av_cold int qdm2_decode_init(AVCodecContext *avctx)
avcodec_get_frame_defaults(&s->frame);
avctx->coded_frame = &s->frame;
-// dump_context(s);
return 0;
}
@@ -1920,8 +1876,6 @@ static int qdm2_decode (QDM2Context *q, const uint8_t *in, int16_t *out)
q->compressed_data = in;
q->compressed_size = q->checksum_size;
-// dump_context(q);
-
/* copy old block, clear new block of output samples */
memmove(q->output_buffer, &q->output_buffer[frame_size], frame_size * sizeof(float));
memset(&q->output_buffer[frame_size], 0, frame_size * sizeof(float));
@@ -1989,7 +1943,7 @@ static int qdm2_decode_frame(AVCodecContext *avctx, void *data,
/* get output buffer */
s->frame.nb_samples = 16 * s->frame_size;
- if ((ret = avctx->get_buffer(avctx, &s->frame)) < 0) {
+ if ((ret = ff_get_buffer(avctx, &s->frame)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return ret;
}
@@ -2009,13 +1963,13 @@ static int qdm2_decode_frame(AVCodecContext *avctx, void *data,
AVCodec ff_qdm2_decoder =
{
- .name = "qdm2",
- .type = AVMEDIA_TYPE_AUDIO,
- .id = CODEC_ID_QDM2,
+ .name = "qdm2",
+ .type = AVMEDIA_TYPE_AUDIO,
+ .id = AV_CODEC_ID_QDM2,
.priv_data_size = sizeof(QDM2Context),
- .init = qdm2_decode_init,
- .close = qdm2_decode_close,
- .decode = qdm2_decode_frame,
- .capabilities = CODEC_CAP_DR1,
- .long_name = NULL_IF_CONFIG_SMALL("QDesign Music Codec 2"),
+ .init = qdm2_decode_init,
+ .close = qdm2_decode_close,
+ .decode = qdm2_decode_frame,
+ .capabilities = CODEC_CAP_DR1,
+ .long_name = NULL_IF_CONFIG_SMALL("QDesign Music Codec 2"),
};
diff --git a/gst-libs/ext/libav/libavcodec/qdrw.c b/gst-libs/ext/libav/libavcodec/qdrw.c
index 7410f6e..ca982f3 100644
--- a/gst-libs/ext/libav/libavcodec/qdrw.c
+++ b/gst-libs/ext/libav/libavcodec/qdrw.c
@@ -24,8 +24,10 @@
* Apple QuickDraw codec.
*/
+#include "libavutil/common.h"
#include "libavutil/intreadwrite.h"
#include "avcodec.h"
+#include "internal.h"
typedef struct QdrawContext{
AVCodecContext *avctx;
@@ -33,14 +35,14 @@ typedef struct QdrawContext{
} QdrawContext;
static int decode_frame(AVCodecContext *avctx,
- void *data, int *data_size,
+ void *data, int *got_frame,
AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
const uint8_t *buf_end = avpkt->data + avpkt->size;
int buf_size = avpkt->size;
QdrawContext * const a = avctx->priv_data;
- AVFrame * const p= (AVFrame*)&a->pic;
+ AVFrame * const p = &a->pic;
uint8_t* outdata;
int colors;
int i;
@@ -51,7 +53,7 @@ static int decode_frame(AVCodecContext *avctx,
avctx->release_buffer(avctx, p);
p->reference= 0;
- if(avctx->get_buffer(avctx, p) < 0){
+ if(ff_get_buffer(avctx, p) < 0){
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return -1;
}
@@ -138,7 +140,7 @@ static int decode_frame(AVCodecContext *avctx,
outdata += a->pic.linesize[0];
}
- *data_size = sizeof(AVFrame);
+ *got_frame = 1;
*(AVFrame*)data = a->pic;
return buf_size;
@@ -147,7 +149,7 @@ static int decode_frame(AVCodecContext *avctx,
static av_cold int decode_init(AVCodecContext *avctx){
// QdrawContext * const a = avctx->priv_data;
- avctx->pix_fmt= PIX_FMT_PAL8;
+ avctx->pix_fmt= AV_PIX_FMT_PAL8;
return 0;
}
@@ -165,11 +167,11 @@ static av_cold int decode_end(AVCodecContext *avctx){
AVCodec ff_qdraw_decoder = {
.name = "qdraw",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_QDRAW,
+ .id = AV_CODEC_ID_QDRAW,
.priv_data_size = sizeof(QdrawContext),
.init = decode_init,
.close = decode_end,
.decode = decode_frame,
.capabilities = CODEC_CAP_DR1,
- .long_name = NULL_IF_CONFIG_SMALL("Apple QuickDraw"),
+ .long_name = NULL_IF_CONFIG_SMALL("Apple QuickDraw"),
};
diff --git a/gst-libs/ext/libav/libavcodec/qpeg.c b/gst-libs/ext/libav/libavcodec/qpeg.c
index 9513dd0..4a918e7 100644
--- a/gst-libs/ext/libav/libavcodec/qpeg.c
+++ b/gst-libs/ext/libav/libavcodec/qpeg.c
@@ -25,16 +25,18 @@
*/
#include "avcodec.h"
+#include "bytestream.h"
typedef struct QpegContext{
AVCodecContext *avctx;
AVFrame pic;
uint8_t *refdata;
uint32_t pal[256];
+ GetByteContext buffer;
} QpegContext;
-static void qpeg_decode_intra(const uint8_t *src, uint8_t *dst, int size,
- int stride, int width, int height)
+static void qpeg_decode_intra(QpegContext *qctx, uint8_t *dst,
+ int stride, int width, int height)
{
int i;
int code;
@@ -47,31 +49,26 @@ static void qpeg_decode_intra(const uint8_t *src, uint8_t *dst, int size,
height--;
dst = dst + height * stride;
- while((size > 0) && (rows_to_go > 0)) {
- code = *src++;
- size--;
+ while ((bytestream2_get_bytes_left(&qctx->buffer) > 0) && (rows_to_go > 0)) {
+ code = bytestream2_get_byte(&qctx->buffer);
run = copy = 0;
if(code == 0xFC) /* end-of-picture code */
break;
if(code >= 0xF8) { /* very long run */
- c0 = *src++;
- c1 = *src++;
- size -= 2;
+ c0 = bytestream2_get_byte(&qctx->buffer);
+ c1 = bytestream2_get_byte(&qctx->buffer);
run = ((code & 0x7) << 16) + (c0 << 8) + c1 + 2;
} else if (code >= 0xF0) { /* long run */
- c0 = *src++;
- size--;
+ c0 = bytestream2_get_byte(&qctx->buffer);
run = ((code & 0xF) << 8) + c0 + 2;
} else if (code >= 0xE0) { /* short run */
run = (code & 0x1F) + 2;
} else if (code >= 0xC0) { /* very long copy */
- c0 = *src++;
- c1 = *src++;
- size -= 2;
+ c0 = bytestream2_get_byte(&qctx->buffer);
+ c1 = bytestream2_get_byte(&qctx->buffer);
copy = ((code & 0x3F) << 16) + (c0 << 8) + c1 + 1;
} else if (code >= 0x80) { /* long copy */
- c0 = *src++;
- size--;
+ c0 = bytestream2_get_byte(&qctx->buffer);
copy = ((code & 0x7F) << 8) + c0 + 1;
} else { /* short copy */
copy = code + 1;
@@ -81,8 +78,7 @@ static void qpeg_decode_intra(const uint8_t *src, uint8_t *dst, int size,
if(run) {
int p;
- p = *src++;
- size--;
+ p = bytestream2_get_byte(&qctx->buffer);
for(i = 0; i < run; i++) {
dst[filled++] = p;
if (filled >= width) {
@@ -94,9 +90,8 @@ static void qpeg_decode_intra(const uint8_t *src, uint8_t *dst, int size,
}
}
} else {
- size -= copy;
for(i = 0; i < copy; i++) {
- dst[filled++] = *src++;
+ dst[filled++] = bytestream2_get_byte(&qctx->buffer);
if (filled >= width) {
filled = 0;
dst -= stride;
@@ -115,9 +110,10 @@ static const int qpeg_table_w[16] =
{ 0x00, 0x20, 0x18, 0x08, 0x18, 0x10, 0x20, 0x10, 0x08, 0x10, 0x20, 0x20, 0x08, 0x10, 0x18, 0x04};
/* Decodes delta frames */
-static void qpeg_decode_inter(const uint8_t *src, uint8_t *dst, int size,
- int stride, int width, int height,
- int delta, const uint8_t *ctable, uint8_t *refdata)
+static void qpeg_decode_inter(QpegContext *qctx, uint8_t *dst,
+ int stride, int width, int height,
+ int delta, const uint8_t *ctable,
+ uint8_t *refdata)
{
int i, j;
int code;
@@ -132,9 +128,8 @@ static void qpeg_decode_inter(const uint8_t *src, uint8_t *dst, int size,
height--;
dst = dst + height * stride;
- while((size > 0) && (height >= 0)) {
- code = *src++;
- size--;
+ while ((bytestream2_get_bytes_left(&qctx->buffer) > 0) && (height >= 0)) {
+ code = bytestream2_get_byte(&qctx->buffer);
if(delta) {
/* motion compensation */
@@ -151,8 +146,7 @@ static void qpeg_decode_inter(const uint8_t *src, uint8_t *dst, int size,
me_h = qpeg_table_h[me_idx];
/* extract motion vector */
- corr = *src++;
- size--;
+ corr = bytestream2_get_byte(&qctx->buffer);
val = corr >> 4;
if(val > 7)
@@ -179,8 +173,7 @@ static void qpeg_decode_inter(const uint8_t *src, uint8_t *dst, int size,
}
}
}
- code = *src++;
- size--;
+ code = bytestream2_get_byte(&qctx->buffer);
}
}
@@ -190,8 +183,7 @@ static void qpeg_decode_inter(const uint8_t *src, uint8_t *dst, int size,
int p;
code &= 0x1F;
- p = *src++;
- size--;
+ p = bytestream2_get_byte(&qctx->buffer);
for(i = 0; i <= code; i++) {
dst[filled++] = p;
if(filled >= width) {
@@ -204,14 +196,13 @@ static void qpeg_decode_inter(const uint8_t *src, uint8_t *dst, int size,
code &= 0x1F;
for(i = 0; i <= code; i++) {
- dst[filled++] = *src++;
+ dst[filled++] = bytestream2_get_byte(&qctx->buffer);
if(filled >= width) {
filled = 0;
dst -= stride;
height--;
}
}
- size -= code + 1;
} else if(code >= 0x80) { /* skip code: 0x80..0xBF */
int skip;
@@ -219,9 +210,9 @@ static void qpeg_decode_inter(const uint8_t *src, uint8_t *dst, int size,
/* codes 0x80 and 0x81 are actually escape codes,
skip value minus constant is in the next byte */
if(!code)
- skip = (*src++) + 64;
+ skip = bytestream2_get_byte(&qctx->buffer) + 64;
else if(code == 1)
- skip = (*src++) + 320;
+ skip = bytestream2_get_byte(&qctx->buffer) + 320;
else
skip = code;
filled += skip;
@@ -234,8 +225,9 @@ static void qpeg_decode_inter(const uint8_t *src, uint8_t *dst, int size,
}
} else {
/* zero code treated as one-pixel skip */
- if(code)
+ if(code) {
dst[filled++] = ctable[code & 0x7F];
+ }
else
filled++;
if(filled >= width) {
@@ -248,28 +240,37 @@ static void qpeg_decode_inter(const uint8_t *src, uint8_t *dst, int size,
}
static int decode_frame(AVCodecContext *avctx,
- void *data, int *data_size,
+ void *data, int *got_frame,
AVPacket *avpkt)
{
- const uint8_t *buf = avpkt->data;
- int buf_size = avpkt->size;
+ uint8_t ctable[128];
QpegContext * const a = avctx->priv_data;
- AVFrame * const p= (AVFrame*)&a->pic;
+ AVFrame * const p = &a->pic;
uint8_t* outdata;
int delta;
const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, NULL);
+ if (avpkt->size < 0x86) {
+ av_log(avctx, AV_LOG_ERROR, "Packet is too small\n");
+ return AVERROR_INVALIDDATA;
+ }
+
+ bytestream2_init(&a->buffer, avpkt->data, avpkt->size);
p->reference = 3;
if (avctx->reget_buffer(avctx, p) < 0) {
av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n");
return -1;
}
outdata = a->pic.data[0];
- if(buf[0x85] == 0x10) {
- qpeg_decode_intra(buf+0x86, outdata, buf_size - 0x86, a->pic.linesize[0], avctx->width, avctx->height);
+ bytestream2_skip(&a->buffer, 4);
+ bytestream2_get_buffer(&a->buffer, ctable, 128);
+ bytestream2_skip(&a->buffer, 1);
+
+ delta = bytestream2_get_byte(&a->buffer);
+ if(delta == 0x10) {
+ qpeg_decode_intra(a, outdata, a->pic.linesize[0], avctx->width, avctx->height);
} else {
- delta = buf[0x85];
- qpeg_decode_inter(buf+0x86, outdata, buf_size - 0x86, a->pic.linesize[0], avctx->width, avctx->height, delta, buf + 4, a->refdata);
+ qpeg_decode_inter(a, outdata, a->pic.linesize[0], avctx->width, avctx->height, delta, ctable, a->refdata);
}
/* make the palette available on the way out */
@@ -279,17 +280,17 @@ static int decode_frame(AVCodecContext *avctx,
}
memcpy(a->pic.data[1], a->pal, AVPALETTE_SIZE);
- *data_size = sizeof(AVFrame);
+ *got_frame = 1;
*(AVFrame*)data = a->pic;
- return buf_size;
+ return avpkt->size;
}
static av_cold int decode_init(AVCodecContext *avctx){
QpegContext * const a = avctx->priv_data;
a->avctx = avctx;
- avctx->pix_fmt= PIX_FMT_PAL8;
+ avctx->pix_fmt= AV_PIX_FMT_PAL8;
a->refdata = av_malloc(avctx->width * avctx->height);
return 0;
@@ -297,7 +298,7 @@ static av_cold int decode_init(AVCodecContext *avctx){
static av_cold int decode_end(AVCodecContext *avctx){
QpegContext * const a = avctx->priv_data;
- AVFrame * const p= (AVFrame*)&a->pic;
+ AVFrame * const p = &a->pic;
if(p->data[0])
avctx->release_buffer(avctx, p);
@@ -309,11 +310,11 @@ static av_cold int decode_end(AVCodecContext *avctx){
AVCodec ff_qpeg_decoder = {
.name = "qpeg",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_QPEG,
+ .id = AV_CODEC_ID_QPEG,
.priv_data_size = sizeof(QpegContext),
.init = decode_init,
.close = decode_end,
.decode = decode_frame,
.capabilities = CODEC_CAP_DR1,
- .long_name = NULL_IF_CONFIG_SMALL("Q-team QPEG"),
+ .long_name = NULL_IF_CONFIG_SMALL("Q-team QPEG"),
};
diff --git a/gst-libs/ext/libav/libavcodec/qtrle.c b/gst-libs/ext/libav/libavcodec/qtrle.c
index 6e7b3c2..23b2a61 100644
--- a/gst-libs/ext/libav/libavcodec/qtrle.c
+++ b/gst-libs/ext/libav/libavcodec/qtrle.c
@@ -35,27 +35,17 @@
#include <stdlib.h>
#include <string.h>
-#include "libavutil/intreadwrite.h"
#include "avcodec.h"
+#include "bytestream.h"
typedef struct QtrleContext {
-
AVCodecContext *avctx;
AVFrame frame;
- const unsigned char *buf;
- int size;
-
+ GetByteContext g;
uint32_t pal[256];
} QtrleContext;
-#define CHECK_STREAM_PTR(n) \
- if ((stream_ptr + n) > s->size) { \
- av_log (s->avctx, AV_LOG_INFO, "Problem: stream_ptr out of bounds (%d >= %d)\n", \
- stream_ptr + n, s->size); \
- return; \
- }
-
#define CHECK_PIXEL_PTR(n) \
if ((pixel_ptr + n > pixel_limit) || (pixel_ptr + n < 0)) { \
av_log (s->avctx, AV_LOG_INFO, "Problem: pixel_ptr = %d, pixel_limit = %d\n", \
@@ -63,20 +53,22 @@ typedef struct QtrleContext {
return; \
} \
-static void qtrle_decode_1bpp(QtrleContext *s, int stream_ptr, int row_ptr, int lines_to_change)
+static void qtrle_decode_1bpp(QtrleContext *s, int row_ptr, int lines_to_change)
{
int rle_code;
- int pixel_ptr = 0;
+ int pixel_ptr;
int row_inc = s->frame.linesize[0];
unsigned char pi0, pi1; /* 2 8-pixel values */
unsigned char *rgb = s->frame.data[0];
int pixel_limit = s->frame.linesize[0] * s->avctx->height;
int skip;
+ row_ptr -= row_inc;
+ pixel_ptr = row_ptr;
+ lines_to_change++;
while (lines_to_change) {
- CHECK_STREAM_PTR(2);
- skip = s->buf[stream_ptr++];
- rle_code = (signed char)s->buf[stream_ptr++];
+ skip = bytestream2_get_byte(&s->g);
+ rle_code = (signed char)bytestream2_get_byte(&s->g);
if (rle_code == 0)
break;
if(skip & 0x80) {
@@ -92,9 +84,9 @@ static void qtrle_decode_1bpp(QtrleContext *s, int stream_ptr, int row_ptr, int
rle_code = -rle_code;
/* get the next 2 bytes from the stream, treat them as groups
* of 8 pixels, and output them rle_code times */
- CHECK_STREAM_PTR(2);
- pi0 = s->buf[stream_ptr++];
- pi1 = s->buf[stream_ptr++];
+
+ pi0 = bytestream2_get_byte(&s->g);
+ pi1 = bytestream2_get_byte(&s->g);
CHECK_PIXEL_PTR(rle_code * 2);
while (rle_code--) {
@@ -104,17 +96,16 @@ static void qtrle_decode_1bpp(QtrleContext *s, int stream_ptr, int row_ptr, int
} else {
/* copy the same pixel directly to output 2 times */
rle_code *= 2;
- CHECK_STREAM_PTR(rle_code);
CHECK_PIXEL_PTR(rle_code);
while (rle_code--)
- rgb[pixel_ptr++] = s->buf[stream_ptr++];
+ rgb[pixel_ptr++] = bytestream2_get_byte(&s->g);
}
}
}
-static inline void qtrle_decode_2n4bpp(QtrleContext *s, int stream_ptr,
- int row_ptr, int lines_to_change, int bpp)
+static inline void qtrle_decode_2n4bpp(QtrleContext *s, int row_ptr,
+ int lines_to_change, int bpp)
{
int rle_code, i;
int pixel_ptr;
@@ -125,24 +116,22 @@ static inline void qtrle_decode_2n4bpp(QtrleContext *s, int stream_ptr,
int num_pixels = (bpp == 4) ? 8 : 16;
while (lines_to_change--) {
- CHECK_STREAM_PTR(2);
- pixel_ptr = row_ptr + (num_pixels * (s->buf[stream_ptr++] - 1));
+ pixel_ptr = row_ptr + (num_pixels * (bytestream2_get_byte(&s->g) - 1));
+ CHECK_PIXEL_PTR(0);
- while ((rle_code = (signed char)s->buf[stream_ptr++]) != -1) {
+ while ((rle_code = (signed char)bytestream2_get_byte(&s->g)) != -1) {
if (rle_code == 0) {
/* there's another skip code in the stream */
- CHECK_STREAM_PTR(1);
- pixel_ptr += (num_pixels * (s->buf[stream_ptr++] - 1));
+ pixel_ptr += (num_pixels * (bytestream2_get_byte(&s->g) - 1));
CHECK_PIXEL_PTR(0); /* make sure pixel_ptr is positive */
} else if (rle_code < 0) {
/* decode the run length code */
rle_code = -rle_code;
/* get the next 4 bytes from the stream, treat them as palette
* indexes, and output them rle_code times */
- CHECK_STREAM_PTR(4);
for (i = num_pixels-1; i >= 0; i--) {
- pi[num_pixels-1-i] = (s->buf[stream_ptr] >> ((i*bpp) & 0x07)) & ((1<<bpp)-1);
- stream_ptr+= ((i & ((num_pixels>>2)-1)) == 0);
+ pi[num_pixels-1-i] = (bytestream2_peek_byte(&s->g) >> ((i*bpp) & 0x07)) & ((1<<bpp)-1);
+ bytestream2_skip(&s->g, ((i & ((num_pixels>>2)-1)) == 0));
}
CHECK_PIXEL_PTR(rle_code * num_pixels);
while (rle_code--) {
@@ -152,17 +141,18 @@ static inline void qtrle_decode_2n4bpp(QtrleContext *s, int stream_ptr,
} else {
/* copy the same pixel directly to output 4 times */
rle_code *= 4;
- CHECK_STREAM_PTR(rle_code);
CHECK_PIXEL_PTR(rle_code*(num_pixels>>2));
while (rle_code--) {
if(bpp == 4) {
- rgb[pixel_ptr++] = ((s->buf[stream_ptr]) >> 4) & 0x0f;
- rgb[pixel_ptr++] = (s->buf[stream_ptr++]) & 0x0f;
+ int x = bytestream2_get_byte(&s->g);
+ rgb[pixel_ptr++] = (x >> 4) & 0x0f;
+ rgb[pixel_ptr++] = x & 0x0f;
} else {
- rgb[pixel_ptr++] = ((s->buf[stream_ptr]) >> 6) & 0x03;
- rgb[pixel_ptr++] = ((s->buf[stream_ptr]) >> 4) & 0x03;
- rgb[pixel_ptr++] = ((s->buf[stream_ptr]) >> 2) & 0x03;
- rgb[pixel_ptr++] = (s->buf[stream_ptr++]) & 0x03;
+ int x = bytestream2_get_byte(&s->g);
+ rgb[pixel_ptr++] = (x >> 6) & 0x03;
+ rgb[pixel_ptr++] = (x >> 4) & 0x03;
+ rgb[pixel_ptr++] = (x >> 2) & 0x03;
+ rgb[pixel_ptr++] = x & 0x03;
}
}
}
@@ -171,7 +161,7 @@ static inline void qtrle_decode_2n4bpp(QtrleContext *s, int stream_ptr,
}
}
-static void qtrle_decode_8bpp(QtrleContext *s, int stream_ptr, int row_ptr, int lines_to_change)
+static void qtrle_decode_8bpp(QtrleContext *s, int row_ptr, int lines_to_change)
{
int rle_code;
int pixel_ptr;
@@ -181,25 +171,23 @@ static void qtrle_decode_8bpp(QtrleContext *s, int stream_ptr, int row_ptr, int
int pixel_limit = s->frame.linesize[0] * s->avctx->height;
while (lines_to_change--) {
- CHECK_STREAM_PTR(2);
- pixel_ptr = row_ptr + (4 * (s->buf[stream_ptr++] - 1));
+ pixel_ptr = row_ptr + (4 * (bytestream2_get_byte(&s->g) - 1));
+ CHECK_PIXEL_PTR(0);
- while ((rle_code = (signed char)s->buf[stream_ptr++]) != -1) {
+ while ((rle_code = (signed char)bytestream2_get_byte(&s->g)) != -1) {
if (rle_code == 0) {
/* there's another skip code in the stream */
- CHECK_STREAM_PTR(1);
- pixel_ptr += (4 * (s->buf[stream_ptr++] - 1));
+ pixel_ptr += (4 * (bytestream2_get_byte(&s->g) - 1));
CHECK_PIXEL_PTR(0); /* make sure pixel_ptr is positive */
} else if (rle_code < 0) {
/* decode the run length code */
rle_code = -rle_code;
/* get the next 4 bytes from the stream, treat them as palette
* indexes, and output them rle_code times */
- CHECK_STREAM_PTR(4);
- pi1 = s->buf[stream_ptr++];
- pi2 = s->buf[stream_ptr++];
- pi3 = s->buf[stream_ptr++];
- pi4 = s->buf[stream_ptr++];
+ pi1 = bytestream2_get_byte(&s->g);
+ pi2 = bytestream2_get_byte(&s->g);
+ pi3 = bytestream2_get_byte(&s->g);
+ pi4 = bytestream2_get_byte(&s->g);
CHECK_PIXEL_PTR(rle_code * 4);
@@ -212,11 +200,10 @@ static void qtrle_decode_8bpp(QtrleContext *s, int stream_ptr, int row_ptr, int
} else {
/* copy the same pixel directly to output 4 times */
rle_code *= 4;
- CHECK_STREAM_PTR(rle_code);
CHECK_PIXEL_PTR(rle_code);
while (rle_code--) {
- rgb[pixel_ptr++] = s->buf[stream_ptr++];
+ rgb[pixel_ptr++] = bytestream2_get_byte(&s->g);
}
}
}
@@ -224,7 +211,7 @@ static void qtrle_decode_8bpp(QtrleContext *s, int stream_ptr, int row_ptr, int
}
}
-static void qtrle_decode_16bpp(QtrleContext *s, int stream_ptr, int row_ptr, int lines_to_change)
+static void qtrle_decode_16bpp(QtrleContext *s, int row_ptr, int lines_to_change)
{
int rle_code;
int pixel_ptr;
@@ -234,21 +221,18 @@ static void qtrle_decode_16bpp(QtrleContext *s, int stream_ptr, int row_ptr, int
int pixel_limit = s->frame.linesize[0] * s->avctx->height;
while (lines_to_change--) {
- CHECK_STREAM_PTR(2);
- pixel_ptr = row_ptr + (s->buf[stream_ptr++] - 1) * 2;
+ pixel_ptr = row_ptr + (bytestream2_get_byte(&s->g) - 1) * 2;
+ CHECK_PIXEL_PTR(0);
- while ((rle_code = (signed char)s->buf[stream_ptr++]) != -1) {
+ while ((rle_code = (signed char)bytestream2_get_byte(&s->g)) != -1) {
if (rle_code == 0) {
/* there's another skip code in the stream */
- CHECK_STREAM_PTR(1);
- pixel_ptr += (s->buf[stream_ptr++] - 1) * 2;
+ pixel_ptr += (bytestream2_get_byte(&s->g) - 1) * 2;
CHECK_PIXEL_PTR(0); /* make sure pixel_ptr is positive */
} else if (rle_code < 0) {
/* decode the run length code */
rle_code = -rle_code;
- CHECK_STREAM_PTR(2);
- rgb16 = AV_RB16(&s->buf[stream_ptr]);
- stream_ptr += 2;
+ rgb16 = bytestream2_get_be16(&s->g);
CHECK_PIXEL_PTR(rle_code * 2);
@@ -257,13 +241,11 @@ static void qtrle_decode_16bpp(QtrleContext *s, int stream_ptr, int row_ptr, int
pixel_ptr += 2;
}
} else {
- CHECK_STREAM_PTR(rle_code * 2);
CHECK_PIXEL_PTR(rle_code * 2);
/* copy pixels directly to output */
while (rle_code--) {
- rgb16 = AV_RB16(&s->buf[stream_ptr]);
- stream_ptr += 2;
+ rgb16 = bytestream2_get_be16(&s->g);
*(unsigned short *)(&rgb[pixel_ptr]) = rgb16;
pixel_ptr += 2;
}
@@ -273,7 +255,7 @@ static void qtrle_decode_16bpp(QtrleContext *s, int stream_ptr, int row_ptr, int
}
}
-static void qtrle_decode_24bpp(QtrleContext *s, int stream_ptr, int row_ptr, int lines_to_change)
+static void qtrle_decode_24bpp(QtrleContext *s, int row_ptr, int lines_to_change)
{
int rle_code;
int pixel_ptr;
@@ -283,22 +265,20 @@ static void qtrle_decode_24bpp(QtrleContext *s, int stream_ptr, int row_ptr, int
int pixel_limit = s->frame.linesize[0] * s->avctx->height;
while (lines_to_change--) {
- CHECK_STREAM_PTR(2);
- pixel_ptr = row_ptr + (s->buf[stream_ptr++] - 1) * 3;
+ pixel_ptr = row_ptr + (bytestream2_get_byte(&s->g) - 1) * 3;
+ CHECK_PIXEL_PTR(0);
- while ((rle_code = (signed char)s->buf[stream_ptr++]) != -1) {
+ while ((rle_code = (signed char)bytestream2_get_byte(&s->g)) != -1) {
if (rle_code == 0) {
/* there's another skip code in the stream */
- CHECK_STREAM_PTR(1);
- pixel_ptr += (s->buf[stream_ptr++] - 1) * 3;
+ pixel_ptr += (bytestream2_get_byte(&s->g) - 1) * 3;
CHECK_PIXEL_PTR(0); /* make sure pixel_ptr is positive */
} else if (rle_code < 0) {
/* decode the run length code */
rle_code = -rle_code;
- CHECK_STREAM_PTR(3);
- r = s->buf[stream_ptr++];
- g = s->buf[stream_ptr++];
- b = s->buf[stream_ptr++];
+ r = bytestream2_get_byte(&s->g);
+ g = bytestream2_get_byte(&s->g);
+ b = bytestream2_get_byte(&s->g);
CHECK_PIXEL_PTR(rle_code * 3);
@@ -308,14 +288,13 @@ static void qtrle_decode_24bpp(QtrleContext *s, int stream_ptr, int row_ptr, int
rgb[pixel_ptr++] = b;
}
} else {
- CHECK_STREAM_PTR(rle_code * 3);
CHECK_PIXEL_PTR(rle_code * 3);
/* copy pixels directly to output */
while (rle_code--) {
- rgb[pixel_ptr++] = s->buf[stream_ptr++];
- rgb[pixel_ptr++] = s->buf[stream_ptr++];
- rgb[pixel_ptr++] = s->buf[stream_ptr++];
+ rgb[pixel_ptr++] = bytestream2_get_byte(&s->g);
+ rgb[pixel_ptr++] = bytestream2_get_byte(&s->g);
+ rgb[pixel_ptr++] = bytestream2_get_byte(&s->g);
}
}
}
@@ -323,7 +302,7 @@ static void qtrle_decode_24bpp(QtrleContext *s, int stream_ptr, int row_ptr, int
}
}
-static void qtrle_decode_32bpp(QtrleContext *s, int stream_ptr, int row_ptr, int lines_to_change)
+static void qtrle_decode_32bpp(QtrleContext *s, int row_ptr, int lines_to_change)
{
int rle_code;
int pixel_ptr;
@@ -333,21 +312,18 @@ static void qtrle_decode_32bpp(QtrleContext *s, int stream_ptr, int row_ptr, int
int pixel_limit = s->frame.linesize[0] * s->avctx->height;
while (lines_to_change--) {
- CHECK_STREAM_PTR(2);
- pixel_ptr = row_ptr + (s->buf[stream_ptr++] - 1) * 4;
+ pixel_ptr = row_ptr + (bytestream2_get_byte(&s->g) - 1) * 4;
+ CHECK_PIXEL_PTR(0);
- while ((rle_code = (signed char)s->buf[stream_ptr++]) != -1) {
+ while ((rle_code = (signed char)bytestream2_get_byte(&s->g)) != -1) {
if (rle_code == 0) {
/* there's another skip code in the stream */
- CHECK_STREAM_PTR(1);
- pixel_ptr += (s->buf[stream_ptr++] - 1) * 4;
+ pixel_ptr += (bytestream2_get_byte(&s->g) - 1) * 4;
CHECK_PIXEL_PTR(0); /* make sure pixel_ptr is positive */
} else if (rle_code < 0) {
/* decode the run length code */
rle_code = -rle_code;
- CHECK_STREAM_PTR(4);
- argb = AV_RB32(s->buf + stream_ptr);
- stream_ptr += 4;
+ argb = bytestream2_get_be32(&s->g);
CHECK_PIXEL_PTR(rle_code * 4);
@@ -356,14 +332,12 @@ static void qtrle_decode_32bpp(QtrleContext *s, int stream_ptr, int row_ptr, int
pixel_ptr += 4;
}
} else {
- CHECK_STREAM_PTR(rle_code * 4);
CHECK_PIXEL_PTR(rle_code * 4);
/* copy pixels directly to output */
while (rle_code--) {
- argb = AV_RB32(s->buf + stream_ptr);
+ argb = bytestream2_get_be32(&s->g);
AV_WN32A(rgb + pixel_ptr, argb);
- stream_ptr += 4;
pixel_ptr += 4;
}
}
@@ -380,7 +354,7 @@ static av_cold int qtrle_decode_init(AVCodecContext *avctx)
switch (avctx->bits_per_coded_sample) {
case 1:
case 33:
- avctx->pix_fmt = PIX_FMT_MONOWHITE;
+ avctx->pix_fmt = AV_PIX_FMT_MONOWHITE;
break;
case 2:
@@ -389,19 +363,19 @@ static av_cold int qtrle_decode_init(AVCodecContext *avctx)
case 34:
case 36:
case 40:
- avctx->pix_fmt = PIX_FMT_PAL8;
+ avctx->pix_fmt = AV_PIX_FMT_PAL8;
break;
case 16:
- avctx->pix_fmt = PIX_FMT_RGB555;
+ avctx->pix_fmt = AV_PIX_FMT_RGB555;
break;
case 24:
- avctx->pix_fmt = PIX_FMT_RGB24;
+ avctx->pix_fmt = AV_PIX_FMT_RGB24;
break;
case 32:
- avctx->pix_fmt = PIX_FMT_RGB32;
+ avctx->pix_fmt = AV_PIX_FMT_RGB32;
break;
default:
@@ -416,19 +390,15 @@ static av_cold int qtrle_decode_init(AVCodecContext *avctx)
}
static int qtrle_decode_frame(AVCodecContext *avctx,
- void *data, int *data_size,
+ void *data, int *got_frame,
AVPacket *avpkt)
{
- const uint8_t *buf = avpkt->data;
- int buf_size = avpkt->size;
QtrleContext *s = avctx->priv_data;
int header, start_line;
- int stream_ptr, height, row_ptr;
+ int height, row_ptr;
int has_palette = 0;
- s->buf = buf;
- s->size = buf_size;
-
+ bytestream2_init(&s->g, avpkt->data, avpkt->size);
s->frame.reference = 1;
s->frame.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE |
FF_BUFFER_HINTS_REUSABLE | FF_BUFFER_HINTS_READABLE;
@@ -438,64 +408,63 @@ static int qtrle_decode_frame(AVCodecContext *avctx,
}
/* check if this frame is even supposed to change */
- if (s->size < 8)
+ if (avpkt->size < 8)
goto done;
/* start after the chunk size */
- stream_ptr = 4;
+ bytestream2_seek(&s->g, 4, SEEK_SET);
/* fetch the header */
- header = AV_RB16(&s->buf[stream_ptr]);
- stream_ptr += 2;
+ header = bytestream2_get_be16(&s->g);
/* if a header is present, fetch additional decoding parameters */
if (header & 0x0008) {
- if(s->size < 14)
+ if (avpkt->size < 14)
goto done;
- start_line = AV_RB16(&s->buf[stream_ptr]);
- stream_ptr += 4;
- height = AV_RB16(&s->buf[stream_ptr]);
- stream_ptr += 4;
+ start_line = bytestream2_get_be16(&s->g);
+ bytestream2_skip(&s->g, 2);
+ height = bytestream2_get_be16(&s->g);
+ bytestream2_skip(&s->g, 2);
} else {
start_line = 0;
- height = s->avctx->height;
+ height = s->avctx->height;
}
row_ptr = s->frame.linesize[0] * start_line;
switch (avctx->bits_per_coded_sample) {
case 1:
case 33:
- qtrle_decode_1bpp(s, stream_ptr, row_ptr, height);
+ qtrle_decode_1bpp(s, row_ptr, height);
break;
case 2:
case 34:
- qtrle_decode_2n4bpp(s, stream_ptr, row_ptr, height, 2);
+ qtrle_decode_2n4bpp(s, row_ptr, height, 2);
has_palette = 1;
break;
case 4:
case 36:
- qtrle_decode_2n4bpp(s, stream_ptr, row_ptr, height, 4);
+ qtrle_decode_2n4bpp(s, row_ptr, height, 4);
has_palette = 1;
break;
case 8:
case 40:
- qtrle_decode_8bpp(s, stream_ptr, row_ptr, height);
+ qtrle_decode_8bpp(s, row_ptr, height);
has_palette = 1;
break;
case 16:
- qtrle_decode_16bpp(s, stream_ptr, row_ptr, height);
+ qtrle_decode_16bpp(s, row_ptr, height);
break;
case 24:
- qtrle_decode_24bpp(s, stream_ptr, row_ptr, height);
+ qtrle_decode_24bpp(s, row_ptr, height);
break;
case 32:
- qtrle_decode_32bpp(s, stream_ptr, row_ptr, height);
+ qtrle_decode_32bpp(s, row_ptr, height);
break;
default:
@@ -517,11 +486,11 @@ static int qtrle_decode_frame(AVCodecContext *avctx,
}
done:
- *data_size = sizeof(AVFrame);
+ *got_frame = 1;
*(AVFrame*)data = s->frame;
/* always report that the buffer was completely consumed */
- return buf_size;
+ return avpkt->size;
}
static av_cold int qtrle_decode_end(AVCodecContext *avctx)
@@ -537,12 +506,11 @@ static av_cold int qtrle_decode_end(AVCodecContext *avctx)
AVCodec ff_qtrle_decoder = {
.name = "qtrle",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_QTRLE,
+ .id = AV_CODEC_ID_QTRLE,
.priv_data_size = sizeof(QtrleContext),
.init = qtrle_decode_init,
.close = qtrle_decode_end,
.decode = qtrle_decode_frame,
.capabilities = CODEC_CAP_DR1,
- .long_name = NULL_IF_CONFIG_SMALL("QuickTime Animation (RLE) video"),
+ .long_name = NULL_IF_CONFIG_SMALL("QuickTime Animation (RLE) video"),
};
-
diff --git a/gst-libs/ext/libav/libavcodec/qtrleenc.c b/gst-libs/ext/libav/libavcodec/qtrleenc.c
index ede03d2..bb686f5 100644
--- a/gst-libs/ext/libav/libavcodec/qtrleenc.c
+++ b/gst-libs/ext/libav/libavcodec/qtrleenc.c
@@ -25,6 +25,7 @@
#include "libavutil/imgutils.h"
#include "avcodec.h"
#include "bytestream.h"
+#include "internal.h"
/** Maximum RLE code for bulk copy */
#define MAX_RLE_BULK 127
@@ -69,13 +70,13 @@ static av_cold int qtrle_encode_init(AVCodecContext *avctx)
s->avctx=avctx;
switch (avctx->pix_fmt) {
- case PIX_FMT_RGB555BE:
+ case AV_PIX_FMT_RGB555BE:
s->pixel_size = 2;
break;
- case PIX_FMT_RGB24:
+ case AV_PIX_FMT_RGB24:
s->pixel_size = 3;
break;
- case PIX_FMT_ARGB:
+ case AV_PIX_FMT_ARGB:
s->pixel_size = 4;
break;
default:
@@ -96,7 +97,7 @@ static av_cold int qtrle_encode_init(AVCodecContext *avctx)
return -1;
}
- s->max_buf_size = s->avctx->width*s->avctx->height*s->pixel_size /* image base material */
+ s->max_buf_size = s->avctx->width*s->avctx->height*s->pixel_size*2 /* image base material */
+ 15 /* header + footer */
+ s->avctx->height*2 /* skip code+rle end */
+ s->avctx->width/MAX_RLE_BULK + 1 /* rle codes */;
@@ -107,7 +108,7 @@ static av_cold int qtrle_encode_init(AVCodecContext *avctx)
/**
* Compute the best RLE sequence for a line
*/
-static void qtrle_encode_line(QtrleEncContext *s, AVFrame *p, int line, uint8_t **buf)
+static void qtrle_encode_line(QtrleEncContext *s, const AVFrame *p, int line, uint8_t **buf)
{
int width=s->avctx->width;
int i;
@@ -120,7 +121,7 @@ static void qtrle_encode_line(QtrleEncContext *s, AVFrame *p, int line, uint8_t
unsigned int skipcount;
/* This will be the number of consecutive equal pixels in the current
* frame, starting from the ith one also */
- unsigned int av_uninit(repeatcount);
+ unsigned int repeatcount;
/* The cost of the three different possibilities */
int total_bulk_cost;
@@ -237,7 +238,7 @@ static void qtrle_encode_line(QtrleEncContext *s, AVFrame *p, int line, uint8_t
}
/** Encode frame including header */
-static int encode_frame(QtrleEncContext *s, AVFrame *p, uint8_t *buf)
+static int encode_frame(QtrleEncContext *s, const AVFrame *p, uint8_t *buf)
{
int i;
int start_line = 0;
@@ -278,19 +279,19 @@ static int encode_frame(QtrleEncContext *s, AVFrame *p, uint8_t *buf)
return buf - orig_buf;
}
-static int qtrle_encode_frame(AVCodecContext *avctx, uint8_t *buf, int buf_size, void *data)
+static int qtrle_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
+ const AVFrame *pict, int *got_packet)
{
QtrleEncContext * const s = avctx->priv_data;
- AVFrame *pict = data;
AVFrame * const p = &s->frame;
- int chunksize;
+ int ret;
*p = *pict;
- if (buf_size < s->max_buf_size) {
+ if ((ret = ff_alloc_packet(pkt, s->max_buf_size)) < 0) {
/* Upper bound check for compressed data */
- av_log(avctx, AV_LOG_ERROR, "buf_size %d < %d\n", buf_size, s->max_buf_size);
- return -1;
+ av_log(avctx, AV_LOG_ERROR, "Error getting output packet of size %d.\n", s->max_buf_size);
+ return ret;
}
if (avctx->gop_size == 0 || (s->avctx->frame_number % avctx->gop_size) == 0) {
@@ -303,11 +304,16 @@ static int qtrle_encode_frame(AVCodecContext *avctx, uint8_t *buf, int buf_size,
p->key_frame = 0;
}
- chunksize = encode_frame(s, pict, buf);
+ pkt->size = encode_frame(s, pict, pkt->data);
/* save the current frame */
av_picture_copy(&s->previous_frame, (AVPicture *)p, avctx->pix_fmt, avctx->width, avctx->height);
- return chunksize;
+
+ if (p->key_frame)
+ pkt->flags |= AV_PKT_FLAG_KEY;
+ *got_packet = 1;
+
+ return 0;
}
static av_cold int qtrle_encode_end(AVCodecContext *avctx)
@@ -324,11 +330,13 @@ static av_cold int qtrle_encode_end(AVCodecContext *avctx)
AVCodec ff_qtrle_encoder = {
.name = "qtrle",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_QTRLE,
+ .id = AV_CODEC_ID_QTRLE,
.priv_data_size = sizeof(QtrleEncContext),
.init = qtrle_encode_init,
- .encode = qtrle_encode_frame,
+ .encode2 = qtrle_encode_frame,
.close = qtrle_encode_end,
- .pix_fmts = (const enum PixelFormat[]){PIX_FMT_RGB24, PIX_FMT_RGB555BE, PIX_FMT_ARGB, PIX_FMT_NONE},
- .long_name = NULL_IF_CONFIG_SMALL("QuickTime Animation (RLE) video"),
+ .pix_fmts = (const enum AVPixelFormat[]){
+ AV_PIX_FMT_RGB24, AV_PIX_FMT_RGB555BE, AV_PIX_FMT_ARGB, AV_PIX_FMT_NONE
+ },
+ .long_name = NULL_IF_CONFIG_SMALL("QuickTime Animation (RLE) video"),
};
diff --git a/gst-libs/ext/libav/libavcodec/r210dec.c b/gst-libs/ext/libav/libavcodec/r210dec.c
index 0f85f58..fd6d521 100644
--- a/gst-libs/ext/libav/libavcodec/r210dec.c
+++ b/gst-libs/ext/libav/libavcodec/r210dec.c
@@ -21,11 +21,13 @@
*/
#include "avcodec.h"
+#include "internal.h"
#include "libavutil/bswap.h"
+#include "libavutil/common.h"
static av_cold int decode_init(AVCodecContext *avctx)
{
- avctx->pix_fmt = PIX_FMT_RGB48;
+ avctx->pix_fmt = AV_PIX_FMT_RGB48;
avctx->bits_per_raw_sample = 10;
avctx->coded_frame = avcodec_alloc_frame();
@@ -33,7 +35,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
return 0;
}
-static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
+static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
AVPacket *avpkt)
{
int h, w;
@@ -51,7 +53,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
}
pic->reference = 0;
- if (avctx->get_buffer(avctx, pic) < 0)
+ if (ff_get_buffer(avctx, pic) < 0)
return -1;
pic->pict_type = AV_PICTURE_TYPE_I;
@@ -63,7 +65,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
for (w = 0; w < avctx->width; w++) {
uint32_t pixel = av_be2ne32(*src++);
uint16_t r, g, b;
- if (avctx->codec_id==CODEC_ID_R210) {
+ if (avctx->codec_id==AV_CODEC_ID_R210) {
b = pixel << 6;
g = (pixel >> 4) & 0xffc0;
r = (pixel >> 14) & 0xffc0;
@@ -80,7 +82,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
dst_line += pic->linesize[0];
}
- *data_size = sizeof(AVFrame);
+ *got_frame = 1;
*(AVFrame*)data = *avctx->coded_frame;
return avpkt->size;
@@ -100,23 +102,23 @@ static av_cold int decode_close(AVCodecContext *avctx)
AVCodec ff_r210_decoder = {
.name = "r210",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_R210,
+ .id = AV_CODEC_ID_R210,
.init = decode_init,
.close = decode_close,
.decode = decode_frame,
.capabilities = CODEC_CAP_DR1,
- .long_name = NULL_IF_CONFIG_SMALL("Uncompressed RGB 10-bit"),
+ .long_name = NULL_IF_CONFIG_SMALL("Uncompressed RGB 10-bit"),
};
#endif
#if CONFIG_R10K_DECODER
AVCodec ff_r10k_decoder = {
.name = "r10k",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_R10K,
+ .id = AV_CODEC_ID_R10K,
.init = decode_init,
.close = decode_close,
.decode = decode_frame,
.capabilities = CODEC_CAP_DR1,
- .long_name = NULL_IF_CONFIG_SMALL("AJA Kona 10-bit RGB Codec"),
+ .long_name = NULL_IF_CONFIG_SMALL("AJA Kona 10-bit RGB Codec"),
};
#endif
diff --git a/gst-libs/ext/libav/libavcodec/ra144.c b/gst-libs/ext/libav/libavcodec/ra144.c
index e6442d6..3705610 100644
--- a/gst-libs/ext/libav/libavcodec/ra144.c
+++ b/gst-libs/ext/libav/libavcodec/ra144.c
@@ -22,6 +22,7 @@
#include <stdint.h>
#include "avcodec.h"
#include "celp_filters.h"
+#include "mathops.h"
#include "ra144.h"
const int16_t ff_gain_val_tab[256][3] = {
@@ -1715,6 +1716,6 @@ void ff_subblock_synthesis(RA144Context *ractx, const uint16_t *lpc_coefs,
LPC_ORDER*sizeof(*ractx->curr_sblock));
if (ff_celp_lp_synthesis_filter(ractx->curr_sblock + LPC_ORDER, lpc_coefs,
- block, BLOCKSIZE, LPC_ORDER, 1, 0xfff))
+ block, BLOCKSIZE, LPC_ORDER, 1, 0, 0xfff))
memset(ractx->curr_sblock, 0, (LPC_ORDER+BLOCKSIZE)*sizeof(*ractx->curr_sblock));
}
diff --git a/gst-libs/ext/libav/libavcodec/ra144.h b/gst-libs/ext/libav/libavcodec/ra144.h
index f6475d4..73f83f0 100644
--- a/gst-libs/ext/libav/libavcodec/ra144.h
+++ b/gst-libs/ext/libav/libavcodec/ra144.h
@@ -24,6 +24,7 @@
#include <stdint.h>
#include "lpc.h"
+#include "audio_frame_queue.h"
#define NBLOCKS 4 ///< number of subblocks within a block
#define BLOCKSIZE 40 ///< subblock size in 16-bit words
@@ -32,10 +33,12 @@
#define FRAMESIZE 20 ///< size of encoded frame
#define LPC_ORDER 10 ///< order of LPC filter
-typedef struct {
+typedef struct RA144Context {
AVCodecContext *avctx;
AVFrame frame;
LPCContext lpc_ctx;
+ AudioFrameQueue afq;
+ int last_frame;
unsigned int old_energy; ///< previous frame energy
diff --git a/gst-libs/ext/libav/libavcodec/ra144dec.c b/gst-libs/ext/libav/libavcodec/ra144dec.c
index dd8838c..1a987fc 100644
--- a/gst-libs/ext/libav/libavcodec/ra144dec.c
+++ b/gst-libs/ext/libav/libavcodec/ra144dec.c
@@ -22,9 +22,11 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "libavutil/channel_layout.h"
#include "libavutil/intmath.h"
#include "avcodec.h"
#include "get_bits.h"
+#include "internal.h"
#include "ra144.h"
@@ -37,7 +39,9 @@ static av_cold int ra144_decode_init(AVCodecContext * avctx)
ractx->lpc_coef[0] = ractx->lpc_tables[0];
ractx->lpc_coef[1] = ractx->lpc_tables[1];
- avctx->sample_fmt = AV_SAMPLE_FMT_S16;
+ avctx->channels = 1;
+ avctx->channel_layout = AV_CH_LAYOUT_MONO;
+ avctx->sample_fmt = AV_SAMPLE_FMT_S16;
avcodec_get_frame_defaults(&ractx->frame);
avctx->coded_frame = &ractx->frame;
@@ -77,7 +81,7 @@ static int ra144_decode_frame(AVCodecContext * avctx, void *data,
/* get output buffer */
ractx->frame.nb_samples = NBLOCKS * BLOCKSIZE;
- if ((ret = avctx->get_buffer(avctx, &ractx->frame)) < 0) {
+ if ((ret = ff_get_buffer(avctx, &ractx->frame)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return ret;
}
@@ -129,7 +133,7 @@ static int ra144_decode_frame(AVCodecContext * avctx, void *data,
AVCodec ff_ra_144_decoder = {
.name = "real_144",
.type = AVMEDIA_TYPE_AUDIO,
- .id = CODEC_ID_RA_144,
+ .id = AV_CODEC_ID_RA_144,
.priv_data_size = sizeof(RA144Context),
.init = ra144_decode_init,
.decode = ra144_decode_frame,
diff --git a/gst-libs/ext/libav/libavcodec/ra144enc.c b/gst-libs/ext/libav/libavcodec/ra144enc.c
index c970a26..b9473ac 100644
--- a/gst-libs/ext/libav/libavcodec/ra144enc.c
+++ b/gst-libs/ext/libav/libavcodec/ra144enc.c
@@ -28,26 +28,37 @@
#include <float.h>
#include "avcodec.h"
+#include "audio_frame_queue.h"
+#include "internal.h"
#include "put_bits.h"
#include "celp_filters.h"
#include "ra144.h"
+static av_cold int ra144_encode_close(AVCodecContext *avctx)
+{
+ RA144Context *ractx = avctx->priv_data;
+ ff_lpc_end(&ractx->lpc_ctx);
+ ff_af_queue_close(&ractx->afq);
+#if FF_API_OLD_ENCODE_AUDIO
+ av_freep(&avctx->coded_frame);
+#endif
+ return 0;
+}
+
+
static av_cold int ra144_encode_init(AVCodecContext * avctx)
{
RA144Context *ractx;
int ret;
- if (avctx->sample_fmt != AV_SAMPLE_FMT_S16) {
- av_log(avctx, AV_LOG_ERROR, "invalid sample format\n");
- return -1;
- }
if (avctx->channels != 1) {
av_log(avctx, AV_LOG_ERROR, "invalid number of channels: %d\n",
avctx->channels);
return -1;
}
avctx->frame_size = NBLOCKS * BLOCKSIZE;
+ avctx->delay = avctx->frame_size;
avctx->bit_rate = 8000;
ractx = avctx->priv_data;
ractx->lpc_coef[0] = ractx->lpc_tables[0];
@@ -55,15 +66,23 @@ static av_cold int ra144_encode_init(AVCodecContext * avctx)
ractx->avctx = avctx;
ret = ff_lpc_init(&ractx->lpc_ctx, avctx->frame_size, LPC_ORDER,
FF_LPC_TYPE_LEVINSON);
- return ret;
-}
+ if (ret < 0)
+ goto error;
+ ff_af_queue_init(avctx, &ractx->afq);
+
+#if FF_API_OLD_ENCODE_AUDIO
+ avctx->coded_frame = avcodec_alloc_frame();
+ if (!avctx->coded_frame) {
+ ret = AVERROR(ENOMEM);
+ goto error;
+ }
+#endif
-static av_cold int ra144_encode_close(AVCodecContext *avctx)
-{
- RA144Context *ractx = avctx->priv_data;
- ff_lpc_end(&ractx->lpc_ctx);
return 0;
+error:
+ ra144_encode_close(avctx);
+ return ret;
}
@@ -323,7 +342,7 @@ static void ra144_encode_subblock(RA144Context *ractx,
const int16_t *lpc_coefs, unsigned int rms,
PutBitContext *pb)
{
- float data[BLOCKSIZE], work[LPC_ORDER + BLOCKSIZE];
+ float data[BLOCKSIZE] = { 0 }, work[LPC_ORDER + BLOCKSIZE];
float coefs[LPC_ORDER];
float zero[BLOCKSIZE], cba[BLOCKSIZE], cb1[BLOCKSIZE], cb2[BLOCKSIZE];
int16_t cba_vect[BLOCKSIZE];
@@ -341,7 +360,6 @@ static void ra144_encode_subblock(RA144Context *ractx,
* Calculate the zero-input response of the LPC filter and subtract it from
* input data.
*/
- memset(data, 0, sizeof(data));
ff_celp_lp_synthesis_filterf(work + LPC_ORDER, coefs, data, BLOCKSIZE,
LPC_ORDER);
for (i = 0; i < BLOCKSIZE; i++) {
@@ -419,12 +437,12 @@ static void ra144_encode_subblock(RA144Context *ractx,
}
-static int ra144_encode_frame(AVCodecContext *avctx, uint8_t *frame,
- int buf_size, void *data)
+static int ra144_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
+ const AVFrame *frame, int *got_packet_ptr)
{
static const uint8_t sizes[LPC_ORDER] = {64, 32, 32, 16, 16, 8, 8, 8, 8, 4};
static const uint8_t bit_sizes[LPC_ORDER] = {6, 5, 5, 4, 4, 3, 3, 3, 3, 2};
- RA144Context *ractx;
+ RA144Context *ractx = avctx->priv_data;
PutBitContext pb;
int32_t lpc_data[NBLOCKS * BLOCKSIZE];
int32_t lpc_coefs[LPC_ORDER][MAX_LPC_ORDER];
@@ -432,14 +450,17 @@ static int ra144_encode_frame(AVCodecContext *avctx, uint8_t *frame,
int16_t block_coefs[NBLOCKS][LPC_ORDER];
int lpc_refl[LPC_ORDER]; /**< reflection coefficients of the frame */
unsigned int refl_rms[NBLOCKS]; /**< RMS of the reflection coefficients */
+ const int16_t *samples = frame ? (const int16_t *)frame->data[0] : NULL;
int energy = 0;
- int i, idx;
+ int i, idx, ret;
- if (buf_size < FRAMESIZE) {
- av_log(avctx, AV_LOG_ERROR, "output buffer too small\n");
+ if (ractx->last_frame)
return 0;
+
+ if ((ret = ff_alloc_packet(avpkt, FRAMESIZE))) {
+ av_log(avctx, AV_LOG_ERROR, "Error getting output packet\n");
+ return ret;
}
- ractx = avctx->priv_data;
/**
* Since the LPC coefficients are calculated on a frame centered over the
@@ -452,11 +473,15 @@ static int ra144_encode_frame(AVCodecContext *avctx, uint8_t *frame,
lpc_data[i] = ractx->curr_block[BLOCKSIZE + BLOCKSIZE / 2 + i];
energy += (lpc_data[i] * lpc_data[i]) >> 4;
}
- for (i = 2 * BLOCKSIZE + BLOCKSIZE / 2; i < NBLOCKS * BLOCKSIZE; i++) {
- lpc_data[i] = *((int16_t *)data + i - 2 * BLOCKSIZE - BLOCKSIZE / 2) >>
- 2;
- energy += (lpc_data[i] * lpc_data[i]) >> 4;
+ if (frame) {
+ int j;
+ for (j = 0; j < frame->nb_samples && i < NBLOCKS * BLOCKSIZE; i++, j++) {
+ lpc_data[i] = samples[j] >> 2;
+ energy += (lpc_data[i] * lpc_data[i]) >> 4;
+ }
}
+ if (i < NBLOCKS * BLOCKSIZE)
+ memset(&lpc_data[i], 0, (NBLOCKS * BLOCKSIZE - i) * sizeof(*lpc_data));
energy = ff_energy_tab[quantize(ff_t_sqrt(energy >> 5) >> 10, ff_energy_tab,
32)];
@@ -482,7 +507,7 @@ static int ra144_encode_frame(AVCodecContext *avctx, uint8_t *frame,
memset(lpc_refl, 0, sizeof(lpc_refl));
}
}
- init_put_bits(&pb, frame, buf_size);
+ init_put_bits(&pb, avpkt->data, avpkt->size);
for (i = 0; i < LPC_ORDER; i++) {
idx = quantize(lpc_refl[i], ff_lpc_refl_cb[i], sizes[i]);
put_bits(&pb, bit_sizes[i], idx);
@@ -505,21 +530,40 @@ static int ra144_encode_frame(AVCodecContext *avctx, uint8_t *frame,
ractx->old_energy = energy;
ractx->lpc_refl_rms[1] = ractx->lpc_refl_rms[0];
FFSWAP(unsigned int *, ractx->lpc_coef[0], ractx->lpc_coef[1]);
- for (i = 0; i < NBLOCKS * BLOCKSIZE; i++)
- ractx->curr_block[i] = *((int16_t *)data + i) >> 2;
- return FRAMESIZE;
+
+ /* copy input samples to current block for processing in next call */
+ i = 0;
+ if (frame) {
+ for (; i < frame->nb_samples; i++)
+ ractx->curr_block[i] = samples[i] >> 2;
+
+ if ((ret = ff_af_queue_add(&ractx->afq, frame)) < 0)
+ return ret;
+ } else
+ ractx->last_frame = 1;
+ memset(&ractx->curr_block[i], 0,
+ (NBLOCKS * BLOCKSIZE - i) * sizeof(*ractx->curr_block));
+
+ /* Get the next frame pts/duration */
+ ff_af_queue_remove(&ractx->afq, avctx->frame_size, &avpkt->pts,
+ &avpkt->duration);
+
+ avpkt->size = FRAMESIZE;
+ *got_packet_ptr = 1;
+ return 0;
}
AVCodec ff_ra_144_encoder = {
.name = "real_144",
.type = AVMEDIA_TYPE_AUDIO,
- .id = CODEC_ID_RA_144,
+ .id = AV_CODEC_ID_RA_144,
.priv_data_size = sizeof(RA144Context),
.init = ra144_encode_init,
- .encode = ra144_encode_frame,
+ .encode2 = ra144_encode_frame,
.close = ra144_encode_close,
+ .capabilities = CODEC_CAP_DELAY | CODEC_CAP_SMALL_LAST_FRAME,
.sample_fmts = (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_S16,
AV_SAMPLE_FMT_NONE },
- .long_name = NULL_IF_CONFIG_SMALL("RealAudio 1.0 (14.4K) encoder"),
+ .long_name = NULL_IF_CONFIG_SMALL("RealAudio 1.0 (14.4K)"),
};
diff --git a/gst-libs/ext/libav/libavcodec/ra288.c b/gst-libs/ext/libav/libavcodec/ra288.c
index 4cb2493..8266673 100644
--- a/gst-libs/ext/libav/libavcodec/ra288.c
+++ b/gst-libs/ext/libav/libavcodec/ra288.c
@@ -19,14 +19,15 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "libavutil/channel_layout.h"
+#include "libavutil/float_dsp.h"
#include "avcodec.h"
+#include "internal.h"
#define BITSTREAM_READER_LE
#include "get_bits.h"
#include "ra288.h"
#include "lpc.h"
-#include "celp_math.h"
#include "celp_filters.h"
-#include "dsputil.h"
#define MAX_BACKWARD_FILTER_ORDER 36
#define MAX_BACKWARD_FILTER_LEN 40
@@ -38,8 +39,9 @@
typedef struct {
AVFrame frame;
DSPContext dsp;
- DECLARE_ALIGNED(16, float, sp_lpc)[FFALIGN(36, 8)]; ///< LPC coefficients for speech data (spec: A)
- DECLARE_ALIGNED(16, float, gain_lpc)[FFALIGN(10, 8)]; ///< LPC coefficients for gain (spec: GB)
+ AVFloatDSPContext fdsp;
+ DECLARE_ALIGNED(32, float, sp_lpc)[FFALIGN(36, 16)]; ///< LPC coefficients for speech data (spec: A)
+ DECLARE_ALIGNED(32, float, gain_lpc)[FFALIGN(10, 16)]; ///< LPC coefficients for gain (spec: GB)
/** speech data history (spec: SB).
* Its first 70 coefficients are updated only at backward filtering.
@@ -61,8 +63,12 @@ typedef struct {
static av_cold int ra288_decode_init(AVCodecContext *avctx)
{
RA288Context *ractx = avctx->priv_data;
- avctx->sample_fmt = AV_SAMPLE_FMT_FLT;
- dsputil_init(&ractx->dsp, avctx);
+
+ avctx->channels = 1;
+ avctx->channel_layout = AV_CH_LAYOUT_MONO;
+ avctx->sample_fmt = AV_SAMPLE_FMT_FLT;
+
+ avpriv_float_dsp_init(&ractx->fdsp, avctx->flags & CODEC_FLAG_BITEXACT);
avcodec_get_frame_defaults(&ractx->frame);
avctx->coded_frame = &ractx->frame;
@@ -73,7 +79,7 @@ static av_cold int ra288_decode_init(AVCodecContext *avctx)
static void convolve(float *tgt, const float *src, int len, int n)
{
for (; n >= 0; n--)
- tgt[n] = ff_dot_productf(src, src - n, len);
+ tgt[n] = ff_scalarproduct_float_c(src, src - n, len);
}
@@ -102,7 +108,7 @@ static void decode(RA288Context *ractx, float gain, int cb_coef)
for (i=0; i < 5; i++)
buffer[i] = codetable[cb_coef][i] * sumsum;
- sum = ff_dot_productf(buffer, buffer, 5) * ((1<<24)/5.);
+ sum = ff_scalarproduct_float_c(buffer, buffer, 5) * ((1 << 24) / 5.);
sum = FFMAX(sum, 1);
@@ -133,11 +139,11 @@ static void do_hybrid_window(RA288Context *ractx,
int i;
float buffer1[MAX_BACKWARD_FILTER_ORDER + 1];
float buffer2[MAX_BACKWARD_FILTER_ORDER + 1];
- LOCAL_ALIGNED_16(float, work, [FFALIGN(MAX_BACKWARD_FILTER_ORDER +
- MAX_BACKWARD_FILTER_LEN +
- MAX_BACKWARD_FILTER_NONREC, 8)]);
+ LOCAL_ALIGNED(32, float, work, [FFALIGN(MAX_BACKWARD_FILTER_ORDER +
+ MAX_BACKWARD_FILTER_LEN +
+ MAX_BACKWARD_FILTER_NONREC, 16)]);
- ractx->dsp.vector_fmul(work, window, hist, FFALIGN(order + n + non_rec, 8));
+ ractx->fdsp.vector_fmul(work, window, hist, FFALIGN(order + n + non_rec, 16));
convolve(buffer1, work + order , n , order);
convolve(buffer2, work + order + n, non_rec, order);
@@ -164,7 +170,7 @@ static void backward_filter(RA288Context *ractx,
do_hybrid_window(ractx, order, n, non_rec, temp, hist, rec, window);
if (!compute_lpc_coefs(temp, order, lpc, 0, 1, 1))
- ractx->dsp.vector_fmul(lpc, lpc, tab, FFALIGN(order, 8));
+ ractx->fdsp.vector_fmul(lpc, lpc, tab, FFALIGN(order, 16));
memmove(hist, hist + n, move_size*sizeof(*hist));
}
@@ -188,7 +194,7 @@ static int ra288_decode_frame(AVCodecContext * avctx, void *data,
/* get output buffer */
ractx->frame.nb_samples = RA288_BLOCK_SIZE * RA288_BLOCKS_PER_FRAME;
- if ((ret = avctx->get_buffer(avctx, &ractx->frame)) < 0) {
+ if ((ret = ff_get_buffer(avctx, &ractx->frame)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return ret;
}
@@ -223,7 +229,7 @@ static int ra288_decode_frame(AVCodecContext * avctx, void *data,
AVCodec ff_ra_288_decoder = {
.name = "real_288",
.type = AVMEDIA_TYPE_AUDIO,
- .id = CODEC_ID_RA_288,
+ .id = AV_CODEC_ID_RA_288,
.priv_data_size = sizeof(RA288Context),
.init = ra288_decode_init,
.decode = ra288_decode_frame,
diff --git a/gst-libs/ext/libav/libavcodec/ra288.h b/gst-libs/ext/libav/libavcodec/ra288.h
index 1c98c16..8083580 100644
--- a/gst-libs/ext/libav/libavcodec/ra288.h
+++ b/gst-libs/ext/libav/libavcodec/ra288.h
@@ -24,6 +24,7 @@
#include <stdint.h>
#include "dsputil.h"
+#include "libavutil/common.h"
static const float amptable[8]={
0.515625, 0.90234375, 1.57910156, 2.76342773,
@@ -97,7 +98,7 @@ static const int16_t codetable[128][5]={
{ 3746, -606, 53, -269, -3301}, { 606, 2018, -1316, 4064, 398}
};
-DECLARE_ALIGNED(16, static const float, syn_window)[FFALIGN(111, 8)]={
+DECLARE_ALIGNED(32, static const float, syn_window)[FFALIGN(111, 16)]={
0.576690972, 0.580838025, 0.585013986, 0.589219987, 0.59345597, 0.597723007,
0.602020264, 0.606384277, 0.610748291, 0.615142822, 0.619598389, 0.624084473,
0.628570557, 0.633117676, 0.637695313, 0.642272949, 0.646911621, 0.651580811,
@@ -119,7 +120,7 @@ DECLARE_ALIGNED(16, static const float, syn_window)[FFALIGN(111, 8)]={
0.142852783, 0.0954284668,0.0477600098
};
-DECLARE_ALIGNED(16, static const float, gain_window)[FFALIGN(38, 8)]={
+DECLARE_ALIGNED(32, static const float, gain_window)[FFALIGN(38, 16)]={
0.505699992, 0.524200022, 0.54339999, 0.563300014, 0.583953857, 0.60534668,
0.627502441, 0.650482178, 0.674316406, 0.699005127, 0.724578857, 0.75112915,
0.778625488, 0.807128906, 0.836669922, 0.86730957, 0.899078369, 0.932006836,
@@ -130,7 +131,7 @@ DECLARE_ALIGNED(16, static const float, gain_window)[FFALIGN(38, 8)]={
};
/** synthesis bandwidth broadening table */
-DECLARE_ALIGNED(16, static const float, syn_bw_tab)[FFALIGN(36, 8)] = {
+DECLARE_ALIGNED(32, static const float, syn_bw_tab)[FFALIGN(36, 16)] = {
0.98828125, 0.976699829, 0.965254128, 0.953942537, 0.942763507, 0.931715488,
0.920796931, 0.910006344, 0.899342179, 0.888803005, 0.878387332, 0.868093729,
0.857920766, 0.847867012, 0.837931097, 0.828111589, 0.818407178, 0.808816493,
@@ -140,7 +141,7 @@ DECLARE_ALIGNED(16, static const float, syn_bw_tab)[FFALIGN(36, 8)] = {
};
/** gain bandwidth broadening table */
-DECLARE_ALIGNED(16, static const float, gain_bw_tab)[FFALIGN(10, 8)] = {
+DECLARE_ALIGNED(32, static const float, gain_bw_tab)[FFALIGN(10, 16)] = {
0.90625, 0.821289063, 0.74432373, 0.674499512, 0.61126709,
0.553955078, 0.50201416, 0.454956055, 0.41229248, 0.373657227
};
diff --git a/gst-libs/ext/libav/libavcodec/ralf.c b/gst-libs/ext/libav/libavcodec/ralf.c
new file mode 100644
index 0000000..580def3
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/ralf.c
@@ -0,0 +1,542 @@
+/*
+ * RealAudio Lossless decoder
+ *
+ * Copyright (c) 2012 Konstantin Shishkov
+ *
+ * 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
+ * This is a decoder for Real Audio Lossless format.
+ * Dedicated to the mastermind behind it, Ralph Wiggum.
+ */
+
+#include "libavutil/channel_layout.h"
+#include "avcodec.h"
+#include "get_bits.h"
+#include "golomb.h"
+#include "internal.h"
+#include "unary.h"
+#include "ralfdata.h"
+
+#define FILTER_NONE 0
+#define FILTER_RAW 642
+
+typedef struct VLCSet {
+ VLC filter_params;
+ VLC bias;
+ VLC coding_mode;
+ VLC filter_coeffs[10][11];
+ VLC short_codes[15];
+ VLC long_codes[125];
+} VLCSet;
+
+#define RALF_MAX_PKT_SIZE 8192
+
+typedef struct RALFContext {
+ AVFrame frame;
+
+ int version;
+ int max_frame_size;
+ VLCSet sets[3];
+ int32_t channel_data[2][4096];
+
+ int filter_params; ///< combined filter parameters for the current channel data
+ int filter_length; ///< length of the filter for the current channel data
+ int filter_bits; ///< filter precision for the current channel data
+ int32_t filter[64];
+
+ int bias[2]; ///< a constant value added to channel data after filtering
+
+ int num_blocks; ///< number of blocks inside the frame
+ int sample_offset;
+ int block_size[1 << 12]; ///< size of the blocks
+ int block_pts[1 << 12]; ///< block start time (in milliseconds)
+
+ uint8_t pkt[16384];
+ int has_pkt;
+} RALFContext;
+
+#define MAX_ELEMS 644 // no RALF table uses more than that
+
+static int init_ralf_vlc(VLC *vlc, const uint8_t *data, int elems)
+{
+ uint8_t lens[MAX_ELEMS];
+ uint16_t codes[MAX_ELEMS];
+ int counts[17], prefixes[18];
+ int i, cur_len;
+ int max_bits = 0;
+ int nb = 0;
+
+ for (i = 0; i <= 16; i++)
+ counts[i] = 0;
+ for (i = 0; i < elems; i++) {
+ cur_len = (nb ? *data & 0xF : *data >> 4) + 1;
+ counts[cur_len]++;
+ max_bits = FFMAX(max_bits, cur_len);
+ lens[i] = cur_len;
+ data += nb;
+ nb ^= 1;
+ }
+ prefixes[1] = 0;
+ for (i = 1; i <= 16; i++)
+ prefixes[i + 1] = (prefixes[i] + counts[i]) << 1;
+
+ for (i = 0; i < elems; i++)
+ codes[i] = prefixes[lens[i]]++;
+
+ return ff_init_vlc_sparse(vlc, FFMIN(max_bits, 9), elems,
+ lens, 1, 1, codes, 2, 2, NULL, 0, 0, 0);
+}
+
+static av_cold int decode_close(AVCodecContext *avctx)
+{
+ RALFContext *ctx = avctx->priv_data;
+ int i, j, k;
+
+ for (i = 0; i < 3; i++) {
+ ff_free_vlc(&ctx->sets[i].filter_params);
+ ff_free_vlc(&ctx->sets[i].bias);
+ ff_free_vlc(&ctx->sets[i].coding_mode);
+ for (j = 0; j < 10; j++)
+ for (k = 0; k < 11; k++)
+ ff_free_vlc(&ctx->sets[i].filter_coeffs[j][k]);
+ for (j = 0; j < 15; j++)
+ ff_free_vlc(&ctx->sets[i].short_codes[j]);
+ for (j = 0; j < 125; j++)
+ ff_free_vlc(&ctx->sets[i].long_codes[j]);
+ }
+
+ return 0;
+}
+
+static av_cold int decode_init(AVCodecContext *avctx)
+{
+ RALFContext *ctx = avctx->priv_data;
+ int i, j, k;
+ int ret;
+
+ if (avctx->extradata_size < 24 || memcmp(avctx->extradata, "LSD:", 4)) {
+ av_log(avctx, AV_LOG_ERROR, "Extradata is not groovy, dude\n");
+ return AVERROR_INVALIDDATA;
+ }
+
+ ctx->version = AV_RB16(avctx->extradata + 4);
+ if (ctx->version != 0x103) {
+ av_log_ask_for_sample(avctx, "unknown version %X\n", ctx->version);
+ return AVERROR_PATCHWELCOME;
+ }
+
+ avctx->channels = AV_RB16(avctx->extradata + 8);
+ avctx->sample_rate = AV_RB32(avctx->extradata + 12);
+ if (avctx->channels < 1 || avctx->channels > 2
+ || avctx->sample_rate < 8000 || avctx->sample_rate > 96000) {
+ av_log(avctx, AV_LOG_ERROR, "Invalid coding parameters %d Hz %d ch\n",
+ avctx->sample_rate, avctx->channels);
+ return AVERROR_INVALIDDATA;
+ }
+ avctx->sample_fmt = AV_SAMPLE_FMT_S16P;
+ avctx->channel_layout = (avctx->channels == 2) ? AV_CH_LAYOUT_STEREO
+ : AV_CH_LAYOUT_MONO;
+
+ avcodec_get_frame_defaults(&ctx->frame);
+ avctx->coded_frame = &ctx->frame;
+
+ ctx->max_frame_size = AV_RB32(avctx->extradata + 16);
+ if (ctx->max_frame_size > (1 << 20) || !ctx->max_frame_size) {
+ av_log(avctx, AV_LOG_ERROR, "invalid frame size %d\n",
+ ctx->max_frame_size);
+ }
+ ctx->max_frame_size = FFMAX(ctx->max_frame_size, avctx->sample_rate);
+
+ for (i = 0; i < 3; i++) {
+ ret = init_ralf_vlc(&ctx->sets[i].filter_params, filter_param_def[i],
+ FILTERPARAM_ELEMENTS);
+ if (ret < 0) {
+ decode_close(avctx);
+ return ret;
+ }
+ ret = init_ralf_vlc(&ctx->sets[i].bias, bias_def[i], BIAS_ELEMENTS);
+ if (ret < 0) {
+ decode_close(avctx);
+ return ret;
+ }
+ ret = init_ralf_vlc(&ctx->sets[i].coding_mode, coding_mode_def[i],
+ CODING_MODE_ELEMENTS);
+ if (ret < 0) {
+ decode_close(avctx);
+ return ret;
+ }
+ for (j = 0; j < 10; j++) {
+ for (k = 0; k < 11; k++) {
+ ret = init_ralf_vlc(&ctx->sets[i].filter_coeffs[j][k],
+ filter_coeffs_def[i][j][k],
+ FILTER_COEFFS_ELEMENTS);
+ if (ret < 0) {
+ decode_close(avctx);
+ return ret;
+ }
+ }
+ }
+ for (j = 0; j < 15; j++) {
+ ret = init_ralf_vlc(&ctx->sets[i].short_codes[j],
+ short_codes_def[i][j], SHORT_CODES_ELEMENTS);
+ if (ret < 0) {
+ decode_close(avctx);
+ return ret;
+ }
+ }
+ for (j = 0; j < 125; j++) {
+ ret = init_ralf_vlc(&ctx->sets[i].long_codes[j],
+ long_codes_def[i][j], LONG_CODES_ELEMENTS);
+ if (ret < 0) {
+ decode_close(avctx);
+ return ret;
+ }
+ }
+ }
+
+ return 0;
+}
+
+static inline int extend_code(GetBitContext *gb, int val, int range, int bits)
+{
+ if (val == 0) {
+ val = -range - get_ue_golomb(gb);
+ } else if (val == range * 2) {
+ val = range + get_ue_golomb(gb);
+ } else {
+ val -= range;
+ }
+ if (bits)
+ val = (val << bits) | get_bits(gb, bits);
+ return val;
+}
+
+static int decode_channel(RALFContext *ctx, GetBitContext *gb, int ch,
+ int length, int mode, int bits)
+{
+ int i, t;
+ int code_params;
+ VLCSet *set = ctx->sets + mode;
+ VLC *code_vlc; int range, range2, add_bits;
+ int *dst = ctx->channel_data[ch];
+
+ ctx->filter_params = get_vlc2(gb, set->filter_params.table, 9, 2);
+ ctx->filter_bits = (ctx->filter_params - 2) >> 6;
+ ctx->filter_length = ctx->filter_params - (ctx->filter_bits << 6) - 1;
+
+ if (ctx->filter_params == FILTER_RAW) {
+ for (i = 0; i < length; i++)
+ dst[i] = get_bits(gb, bits);
+ ctx->bias[ch] = 0;
+ return 0;
+ }
+
+ ctx->bias[ch] = get_vlc2(gb, set->bias.table, 9, 2);
+ ctx->bias[ch] = extend_code(gb, ctx->bias[ch], 127, 4);
+
+ if (ctx->filter_params == FILTER_NONE) {
+ memset(dst, 0, sizeof(*dst) * length);
+ return 0;
+ }
+
+ if (ctx->filter_params > 1) {
+ int cmode = 0, coeff = 0;
+ VLC *vlc = set->filter_coeffs[ctx->filter_bits] + 5;
+
+ add_bits = ctx->filter_bits;
+
+ for (i = 0; i < ctx->filter_length; i++) {
+ t = get_vlc2(gb, vlc[cmode].table, vlc[cmode].bits, 2);
+ t = extend_code(gb, t, 21, add_bits);
+ if (!cmode)
+ coeff -= 12 << add_bits;
+ coeff = t - coeff;
+ ctx->filter[i] = coeff;
+
+ cmode = coeff >> add_bits;
+ if (cmode < 0) {
+ cmode = -1 - av_log2(-cmode);
+ if (cmode < -5)
+ cmode = -5;
+ } else if (cmode > 0) {
+ cmode = 1 + av_log2(cmode);
+ if (cmode > 5)
+ cmode = 5;
+ }
+ }
+ }
+
+ code_params = get_vlc2(gb, set->coding_mode.table, set->coding_mode.bits, 2);
+ if (code_params >= 15) {
+ add_bits = av_clip((code_params / 5 - 3) / 2, 0, 10);
+ if (add_bits > 9 && (code_params % 5) != 2)
+ add_bits--;
+ range = 10;
+ range2 = 21;
+ code_vlc = set->long_codes + code_params - 15;
+ } else {
+ add_bits = 0;
+ range = 6;
+ range2 = 13;
+ code_vlc = set->short_codes + code_params;
+ }
+
+ for (i = 0; i < length; i += 2) {
+ int code1, code2;
+
+ t = get_vlc2(gb, code_vlc->table, code_vlc->bits, 2);
+ code1 = t / range2;
+ code2 = t % range2;
+ dst[i] = extend_code(gb, code1, range, 0) << add_bits;
+ dst[i + 1] = extend_code(gb, code2, range, 0) << add_bits;
+ if (add_bits) {
+ dst[i] |= get_bits(gb, add_bits);
+ dst[i + 1] |= get_bits(gb, add_bits);
+ }
+ }
+
+ return 0;
+}
+
+static void apply_lpc(RALFContext *ctx, int ch, int length, int bits)
+{
+ int i, j, acc;
+ int *audio = ctx->channel_data[ch];
+ int bias = 1 << (ctx->filter_bits - 1);
+ int max_clip = (1 << bits) - 1, min_clip = -max_clip - 1;
+
+ for (i = 1; i < length; i++) {
+ int flen = FFMIN(ctx->filter_length, i);
+
+ acc = 0;
+ for (j = 0; j < flen; j++)
+ acc += ctx->filter[j] * audio[i - j - 1];
+ if (acc < 0) {
+ acc = (acc + bias - 1) >> ctx->filter_bits;
+ acc = FFMAX(acc, min_clip);
+ } else {
+ acc = (acc + bias) >> ctx->filter_bits;
+ acc = FFMIN(acc, max_clip);
+ }
+ audio[i] += acc;
+ }
+}
+
+static int decode_block(AVCodecContext *avctx, GetBitContext *gb,
+ int16_t *dst0, int16_t *dst1)
+{
+ RALFContext *ctx = avctx->priv_data;
+ int len, ch, ret;
+ int dmode, mode[2], bits[2];
+ int *ch0, *ch1;
+ int i, t, t2;
+
+ len = 12 - get_unary(gb, 0, 6);
+
+ if (len <= 7) len ^= 1; // codes for length = 6 and 7 are swapped
+ len = 1 << len;
+
+ if (ctx->sample_offset + len > ctx->max_frame_size) {
+ av_log(avctx, AV_LOG_ERROR,
+ "Decoder's stomach is crying, it ate too many samples\n");
+ return AVERROR_INVALIDDATA;
+ }
+
+ if (avctx->channels > 1)
+ dmode = get_bits(gb, 2) + 1;
+ else
+ dmode = 0;
+
+ mode[0] = (dmode == 4) ? 1 : 0;
+ mode[1] = (dmode >= 2) ? 2 : 0;
+ bits[0] = 16;
+ bits[1] = (mode[1] == 2) ? 17 : 16;
+
+ for (ch = 0; ch < avctx->channels; ch++) {
+ if ((ret = decode_channel(ctx, gb, ch, len, mode[ch], bits[ch])) < 0)
+ return ret;
+ if (ctx->filter_params > 1 && ctx->filter_params != FILTER_RAW) {
+ ctx->filter_bits += 3;
+ apply_lpc(ctx, ch, len, bits[ch]);
+ }
+ if (get_bits_left(gb) < 0)
+ return AVERROR_INVALIDDATA;
+ }
+ ch0 = ctx->channel_data[0];
+ ch1 = ctx->channel_data[1];
+ switch (dmode) {
+ case 0:
+ for (i = 0; i < len; i++)
+ dst0[i] = ch0[i] + ctx->bias[0];
+ break;
+ case 1:
+ for (i = 0; i < len; i++) {
+ dst0[i] = ch0[i] + ctx->bias[0];
+ dst1[i] = ch1[i] + ctx->bias[1];
+ }
+ break;
+ case 2:
+ for (i = 0; i < len; i++) {
+ ch0[i] += ctx->bias[0];
+ dst0[i] = ch0[i];
+ dst1[i] = ch0[i] - (ch1[i] + ctx->bias[1]);
+ }
+ break;
+ case 3:
+ for (i = 0; i < len; i++) {
+ t = ch0[i] + ctx->bias[0];
+ t2 = ch1[i] + ctx->bias[1];
+ dst0[i] = t + t2;
+ dst1[i] = t;
+ }
+ break;
+ case 4:
+ for (i = 0; i < len; i++) {
+ t = ch1[i] + ctx->bias[1];
+ t2 = ((ch0[i] + ctx->bias[0]) << 1) | (t & 1);
+ dst0[i] = (t2 + t) / 2;
+ dst1[i] = (t2 - t) / 2;
+ }
+ break;
+ }
+
+ ctx->sample_offset += len;
+
+ return 0;
+}
+
+static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr,
+ AVPacket *avpkt)
+{
+ RALFContext *ctx = avctx->priv_data;
+ int16_t *samples0;
+ int16_t *samples1;
+ int ret;
+ GetBitContext gb;
+ int table_size, table_bytes, i;
+ const uint8_t *src, *block_pointer;
+ int src_size;
+ int bytes_left;
+
+ if (ctx->has_pkt) {
+ ctx->has_pkt = 0;
+ table_bytes = (AV_RB16(avpkt->data) + 7) >> 3;
+ if (table_bytes + 3 > avpkt->size || avpkt->size > RALF_MAX_PKT_SIZE) {
+ av_log(avctx, AV_LOG_ERROR, "Wrong packet's breath smells of wrong data!\n");
+ return AVERROR_INVALIDDATA;
+ }
+ if (memcmp(ctx->pkt, avpkt->data, 2 + table_bytes)) {
+ av_log(avctx, AV_LOG_ERROR, "Wrong packet tails are wrong!\n");
+ return AVERROR_INVALIDDATA;
+ }
+
+ src = ctx->pkt;
+ src_size = RALF_MAX_PKT_SIZE + avpkt->size;
+ memcpy(ctx->pkt + RALF_MAX_PKT_SIZE, avpkt->data + 2 + table_bytes,
+ avpkt->size - 2 - table_bytes);
+ } else {
+ if (avpkt->size == RALF_MAX_PKT_SIZE) {
+ memcpy(ctx->pkt, avpkt->data, avpkt->size);
+ ctx->has_pkt = 1;
+ *got_frame_ptr = 0;
+
+ return avpkt->size;
+ }
+ src = avpkt->data;
+ src_size = avpkt->size;
+ }
+
+ ctx->frame.nb_samples = ctx->max_frame_size;
+ if ((ret = ff_get_buffer(avctx, &ctx->frame)) < 0) {
+ av_log(avctx, AV_LOG_ERROR, "Me fail get_buffer()? That's unpossible!\n");
+ return ret;
+ }
+ samples0 = (int16_t *)ctx->frame.data[0];
+ samples1 = (int16_t *)ctx->frame.data[1];
+
+ if (src_size < 5) {
+ av_log(avctx, AV_LOG_ERROR, "too short packets are too short!\n");
+ return AVERROR_INVALIDDATA;
+ }
+ table_size = AV_RB16(src);
+ table_bytes = (table_size + 7) >> 3;
+ if (src_size < table_bytes + 3) {
+ av_log(avctx, AV_LOG_ERROR, "short packets are short!\n");
+ return AVERROR_INVALIDDATA;
+ }
+ init_get_bits(&gb, src + 2, table_size);
+ ctx->num_blocks = 0;
+ while (get_bits_left(&gb) > 0) {
+ ctx->block_size[ctx->num_blocks] = get_bits(&gb, 15);
+ if (get_bits1(&gb)) {
+ ctx->block_pts[ctx->num_blocks] = get_bits(&gb, 9);
+ } else {
+ ctx->block_pts[ctx->num_blocks] = 0;
+ }
+ ctx->num_blocks++;
+ }
+
+ block_pointer = src + table_bytes + 2;
+ bytes_left = src_size - table_bytes - 2;
+ ctx->sample_offset = 0;
+ for (i = 0; i < ctx->num_blocks; i++) {
+ if (bytes_left < ctx->block_size[i]) {
+ av_log(avctx, AV_LOG_ERROR, "I'm pedaling backwards\n");
+ break;
+ }
+ init_get_bits(&gb, block_pointer, ctx->block_size[i] * 8);
+ if (decode_block(avctx, &gb, samples0 + ctx->sample_offset,
+ samples1 + ctx->sample_offset) < 0) {
+ av_log(avctx, AV_LOG_ERROR, "Sir, I got carsick in your office. Not decoding the rest of packet.\n");
+ break;
+ }
+ block_pointer += ctx->block_size[i];
+ bytes_left -= ctx->block_size[i];
+ }
+
+ ctx->frame.nb_samples = ctx->sample_offset;
+ *got_frame_ptr = ctx->sample_offset > 0;
+ *(AVFrame*)data = ctx->frame;
+
+ return avpkt->size;
+}
+
+static void decode_flush(AVCodecContext *avctx)
+{
+ RALFContext *ctx = avctx->priv_data;
+
+ ctx->has_pkt = 0;
+}
+
+
+AVCodec ff_ralf_decoder = {
+ .name = "ralf",
+ .type = AVMEDIA_TYPE_AUDIO,
+ .id = AV_CODEC_ID_RALF,
+ .priv_data_size = sizeof(RALFContext),
+ .init = decode_init,
+ .close = decode_close,
+ .decode = decode_frame,
+ .flush = decode_flush,
+ .capabilities = CODEC_CAP_DR1,
+ .long_name = NULL_IF_CONFIG_SMALL("RealAudio Lossless"),
+ .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_S16P,
+ AV_SAMPLE_FMT_NONE },
+};
diff --git a/gst-libs/ext/libav/libavcodec/ralfdata.h b/gst-libs/ext/libav/libavcodec/ralfdata.h
new file mode 100644
index 0000000..83eb970
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/ralfdata.h
@@ -0,0 +1,9920 @@
+/*
+ * RealAudio Lossless decoder
+ *
+ * Copyright (c) 2012 Konstantin Shishkov
+ *
+ * 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
+ */
+
+#ifndef AVCODEC_RALFDATA_H
+#define AVCODEC_RALFDATA_H
+
+#include <stdint.h>
+
+#define FILTERPARAM_ELEMENTS 643
+#define BIAS_ELEMENTS 255
+#define CODING_MODE_ELEMENTS 140
+#define FILTER_COEFFS_ELEMENTS 43
+#define SHORT_CODES_ELEMENTS 169
+#define LONG_CODES_ELEMENTS 441
+
+static const uint8_t filter_param_def[3][324] = {
+ {
+ 0x48, 0x86, 0x66, 0x8A, 0xBB, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xB4, 0x54, 0x45,
+ 0x66, 0x88, 0xAA, 0xAB, 0xCF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF8, 0x65, 0x45, 0x55, 0x66, 0x77, 0x78,
+ 0x99, 0x99, 0xAA, 0xAB, 0xBB, 0xBC, 0xCB, 0xBF, 0xFF, 0xCF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xF9, 0x86, 0x55, 0x55, 0x55, 0x66, 0x67, 0x77, 0x88, 0x88, 0x99,
+ 0x99, 0x99, 0x99, 0x99, 0x9A, 0xAA, 0x9B, 0xBB, 0xCB, 0xBB, 0xCC, 0xCC,
+ 0xCF, 0xFF, 0xCC, 0xCF, 0xFC, 0xBC, 0xCC, 0xFB, 0xB9, 0xFC, 0xA8, 0x76,
+ 0x66, 0x56, 0x66, 0x67, 0x67, 0x77, 0x78, 0x88, 0x88, 0x89, 0x88, 0x89,
+ 0x99, 0x99, 0x9A, 0x9A, 0x9A, 0x9A, 0xAA, 0xAA, 0xAA, 0xAA, 0x9A, 0xA9,
+ 0xAB, 0xA9, 0xA9, 0x98, 0x86, 0xFF, 0xCA, 0x88, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x88, 0x88, 0x88, 0x88, 0x99, 0x99, 0x99, 0x98, 0x99, 0x99, 0x9A,
+ 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x98, 0x88, 0x87,
+ 0x65, 0xFF, 0xFB, 0xAA, 0xA9, 0x88, 0x88, 0x89, 0x99, 0x98, 0x99, 0x9A,
+ 0xA9, 0x9A, 0xA9, 0xAA, 0xA9, 0x9A, 0xAA, 0xA9, 0xAA, 0xA9, 0x99, 0x99,
+ 0xA9, 0x9A, 0x99, 0x99, 0x99, 0x98, 0x88, 0x77, 0x64, 0xFF, 0xFF, 0xFC,
+ 0xBB, 0xBA, 0xB9, 0xAA, 0xAB, 0xAA, 0xAA, 0xBA, 0xAB, 0xAB, 0xAB, 0xCB,
+ 0xBA, 0xAB, 0xBB, 0xBB, 0xAA, 0xBA, 0xAA, 0xAA, 0xAA, 0xA9, 0xAA, 0x99,
+ 0x99, 0x99, 0x88, 0x87, 0x64, 0xFF, 0xFF, 0xFF, 0xFF, 0xCB, 0xBB, 0xBB,
+ 0xBB, 0xBB, 0xBB, 0xCB, 0xBB, 0xBC, 0xBB, 0xCC, 0xFB, 0xCC, 0xCF, 0xCF,
+ 0xCC, 0xFC, 0xFC, 0xCF, 0xCB, 0xCC, 0xBB, 0xBB, 0xCB, 0xBB, 0xAA, 0x99,
+ 0x86, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFC, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFC, 0xB8, 0xA0, 0x00, 0x00,
+ }, {
+ 0xFB, 0x95, 0x67, 0x8B, 0xFB, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF7, 0x55, 0x56,
+ 0x77, 0x89, 0xBA, 0xBB, 0xCF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xB8, 0x65, 0x55, 0x55, 0x56, 0x77, 0x78,
+ 0x89, 0x9A, 0xAA, 0xAA, 0xBC, 0xBC, 0xCB, 0xBC, 0xCF, 0xCF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFB, 0x86, 0x55, 0x55, 0x55, 0x55, 0x56, 0x67, 0x77, 0x77, 0x88,
+ 0x89, 0x9A, 0x99, 0x99, 0xAA, 0xBB, 0xBB, 0xAB, 0xBF, 0xCB, 0xFA, 0xCC,
+ 0xFC, 0xEC, 0xEF, 0xFB, 0xBC, 0xFF, 0xBC, 0xBB, 0xA9, 0xFF, 0x98, 0x76,
+ 0x66, 0x66, 0x65, 0x66, 0x66, 0x76, 0x77, 0x77, 0x77, 0x88, 0x88, 0x88,
+ 0x89, 0x99, 0x99, 0x99, 0x99, 0xA9, 0x99, 0x99, 0x9A, 0x99, 0x99, 0xAA,
+ 0xAA, 0xA9, 0x99, 0x98, 0x76, 0xFF, 0xF9, 0x87, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x78, 0x88, 0x88, 0x88, 0x88, 0x99, 0x99, 0x89, 0x99,
+ 0x99, 0x99, 0x99, 0x89, 0x99, 0x99, 0x99, 0x98, 0x99, 0x98, 0x77, 0x77,
+ 0x65, 0xFF, 0xCA, 0xA9, 0x99, 0x89, 0x88, 0x88, 0x98, 0x89, 0x99, 0x98,
+ 0x99, 0x99, 0x99, 0x99, 0x9A, 0x99, 0x99, 0xA9, 0x9A, 0xA9, 0x99, 0x99,
+ 0x99, 0x99, 0xA9, 0x99, 0x99, 0x98, 0x88, 0x77, 0x64, 0xFF, 0xCB, 0xA9,
+ 0xA9, 0xAA, 0xAA, 0xAA, 0x9A, 0xAB, 0xAA, 0x9A, 0xBB, 0xAB, 0xAB, 0xBB,
+ 0xAB, 0xBA, 0xBB, 0xBA, 0xAA, 0xBA, 0xBA, 0xAA, 0xAA, 0xA9, 0xA9, 0x99,
+ 0x99, 0x99, 0x88, 0x77, 0x64, 0xFF, 0xFF, 0xFF, 0xBC, 0xFB, 0xCB, 0xBB,
+ 0xBB, 0xBB, 0xBA, 0xBA, 0xAB, 0xBF, 0xCB, 0xBB, 0xBB, 0xBC, 0xBF, 0xCC,
+ 0xCB, 0xCB, 0xCC, 0xBB, 0xBB, 0xFB, 0xCB, 0xBC, 0xCA, 0xBC, 0xAA, 0xA9,
+ 0x86, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xCF, 0xFF, 0xFC, 0xFF, 0xFF, 0xCF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFA, 0xF0, 0x00, 0x00,
+ }, {
+ 0x9B, 0x65, 0x67, 0xAB, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xB5, 0x54, 0x56,
+ 0x67, 0x88, 0xA9, 0xAB, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xA8, 0x65, 0x44, 0x45, 0x56, 0x67, 0x78,
+ 0x89, 0x99, 0xA9, 0xAA, 0xBB, 0xBB, 0xAB, 0xBC, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xF9, 0x76, 0x55, 0x54, 0x55, 0x55, 0x56, 0x67, 0x77, 0x77, 0x88,
+ 0x89, 0x99, 0x98, 0x99, 0x8A, 0x99, 0xBB, 0xAB, 0xBC, 0xAB, 0xBA, 0xAA,
+ 0xBB, 0xCB, 0xCC, 0xBB, 0xCC, 0xBB, 0xAC, 0xBA, 0x97, 0xFB, 0x97, 0x76,
+ 0x66, 0x66, 0x66, 0x66, 0x67, 0x77, 0x77, 0x77, 0x88, 0x88, 0x88, 0x88,
+ 0x99, 0x89, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x9A, 0x98, 0x99, 0x99,
+ 0xA9, 0x99, 0x88, 0x87, 0x65, 0xFF, 0xCA, 0x98, 0x87, 0x77, 0x77, 0x87,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99,
+ 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x88, 0x87, 0x77,
+ 0x64, 0xFF, 0xFC, 0xCA, 0xAA, 0x99, 0x99, 0x99, 0x99, 0x99, 0xAA, 0x9A,
+ 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA,
+ 0xAA, 0xAA, 0x99, 0x99, 0x99, 0x89, 0x88, 0x87, 0x64, 0xFF, 0xFF, 0xFB,
+ 0xFF, 0xBC, 0xFC, 0xBB, 0xCB, 0xBB, 0xCA, 0xCB, 0xBC, 0xCC, 0xBF, 0xBC,
+ 0xBB, 0xBB, 0xBE, 0xBC, 0xCB, 0xCC, 0xBB, 0xFC, 0xBC, 0xCC, 0xAB, 0xCB,
+ 0xAB, 0xBB, 0xAA, 0xA9, 0x97, 0xFF, 0xFF, 0xFF, 0xFF, 0xBB, 0xCF, 0xFB,
+ 0xCC, 0xFC, 0xCF, 0xFC, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFB, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00,
+ }
+};
+
+static const uint8_t bias_def[3][128] = {
+ {
+ 0x4A, 0xAA, 0xAA, 0xAA, 0xBA, 0xBA, 0xBA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA,
+ 0xAA, 0xAA, 0xAA, 0xAB, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0x9A, 0xA9, 0xA9,
+ 0x99, 0xA9, 0x99, 0x99, 0xA9, 0xA9, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99,
+ 0x99, 0x99, 0x88, 0x98, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x77, 0x78, 0x77, 0x77, 0x77, 0x77, 0x66, 0x66, 0x66, 0x55, 0x55, 0x55,
+ 0x55, 0x54, 0x44, 0x32, 0x44, 0x55, 0x55, 0x66, 0x66, 0x66, 0x66, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x87, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x89, 0x88, 0x89, 0x89, 0x99, 0x99, 0x98, 0x99, 0x9A,
+ 0x99, 0x99, 0x99, 0x99, 0x9A, 0xA9, 0x9A, 0x99, 0x9A, 0xA9, 0xA9, 0xA9,
+ 0xAA, 0xAA, 0xA9, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xBB, 0xAA, 0xAA, 0xAA,
+ 0xAA, 0xBA, 0xAA, 0xAA, 0xAA, 0xAA, 0xBA, 0x40,
+ }, {
+ 0x4C, 0xBC, 0xAC, 0xBC, 0xBA, 0xAB, 0xAB, 0xBB, 0xBA, 0xAA, 0xAB, 0xAA,
+ 0xBB, 0xAA, 0xBB, 0xAA, 0xAB, 0xBA, 0xBA, 0xAA, 0xBB, 0xAA, 0xA9, 0xAA,
+ 0xBB, 0xAA, 0xAA, 0x9A, 0x9A, 0xAA, 0xA9, 0xAA, 0x99, 0x99, 0x99, 0x99,
+ 0x99, 0x99, 0x99, 0x99, 0x98, 0x98, 0x98, 0x89, 0x88, 0x88, 0x88, 0x88,
+ 0x87, 0x78, 0x77, 0x77, 0x77, 0x77, 0x67, 0x66, 0x66, 0x55, 0x44, 0x45,
+ 0x54, 0x44, 0x44, 0x33, 0x44, 0x45, 0x55, 0x56, 0x66, 0x66, 0x66, 0x67,
+ 0x77, 0x77, 0x77, 0x77, 0x87, 0x87, 0x78, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x99, 0x88, 0x99, 0x99, 0x89, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0xA9,
+ 0xA9, 0xAA, 0x9A, 0xA9, 0xAA, 0x9A, 0xAA, 0x9A, 0xAA, 0xAB, 0xAA, 0xAA,
+ 0xAA, 0xAA, 0xAA, 0xAA, 0xBB, 0xBC, 0xBB, 0xBA, 0xAA, 0xAB, 0xAB, 0xAA,
+ 0xAB, 0xAB, 0xAC, 0xBB, 0xAA, 0xBB, 0xBB, 0x40,
+ }, {
+ 0x5B, 0xBB, 0xBC, 0xBB, 0xCB, 0xCC, 0xBB, 0xBB, 0xBC, 0xCC, 0xBB, 0xCB,
+ 0xBA, 0xCB, 0xBC, 0xBB, 0xAA, 0xBB, 0xAB, 0xBA, 0xBB, 0xBB, 0xAB, 0xBB,
+ 0xAA, 0xBA, 0xBA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xA9, 0x9A,
+ 0x9A, 0x99, 0x9A, 0x99, 0x99, 0x99, 0x99, 0x99, 0x98, 0x98, 0x89, 0x99,
+ 0x88, 0x88, 0x88, 0x88, 0x77, 0x77, 0x77, 0x77, 0x77, 0x66, 0x66, 0x55,
+ 0x54, 0x44, 0x43, 0x22, 0x34, 0x44, 0x55, 0x56, 0x66, 0x66, 0x67, 0x77,
+ 0x77, 0x77, 0x87, 0x88, 0x88, 0x88, 0x88, 0x88, 0x99, 0x89, 0x99, 0x99,
+ 0x99, 0x99, 0x99, 0x9A, 0x9A, 0xA9, 0xA9, 0x9A, 0x9A, 0xAA, 0x9A, 0xAA,
+ 0xAA, 0xAA, 0xBA, 0xAA, 0xAA, 0xAA, 0xBA, 0xAA, 0xAA, 0xAB, 0xBA, 0xBB,
+ 0xAA, 0xBB, 0xAB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBC,
+ 0xBB, 0xBC, 0xBB, 0xBB, 0xCC, 0xBC, 0xCB, 0x50,
+ }
+};
+
+static const uint8_t coding_mode_def[3][72] = {
+ {
+ 0xAA, 0x99, 0xAC, 0xB9, 0xBD, 0xAA, 0x7A, 0xA8, 0xA8, 0xA8, 0x79, 0x79,
+ 0x77, 0xA8, 0x97, 0x79, 0x89, 0x77, 0x87, 0x87, 0x68, 0x78, 0x66, 0x86,
+ 0x87, 0x67, 0x68, 0x66, 0x76, 0x76, 0x57, 0x67, 0x55, 0x75, 0x65, 0x56,
+ 0x56, 0x55, 0x65, 0x65, 0x56, 0x45, 0x55, 0x54, 0x55, 0x55, 0x45, 0x55,
+ 0x54, 0x55, 0x55, 0x45, 0x56, 0x64, 0x66, 0x76, 0x57, 0x67, 0x77, 0x77,
+ 0x98, 0x88, 0x9D, 0xBF, 0xBA, 0xEC, 0xFC, 0xBA, 0xEF, 0xFC, 0x00, 0x00,
+ }, {
+ 0xCF, 0x9B, 0xAF, 0xFF, 0xFF, 0xAB, 0x8A, 0x98, 0xB8, 0xF9, 0x78, 0x89,
+ 0x77, 0xF9, 0xF7, 0x79, 0x89, 0x77, 0x97, 0x97, 0x68, 0x68, 0x66, 0xA6,
+ 0x87, 0x77, 0x68, 0x66, 0x75, 0x76, 0x67, 0x56, 0x65, 0x75, 0x75, 0x56,
+ 0x56, 0x55, 0x65, 0x65, 0x56, 0x56, 0x55, 0x54, 0x55, 0x55, 0x45, 0x55,
+ 0x53, 0x55, 0x65, 0x35, 0x67, 0x64, 0x66, 0x66, 0x56, 0x78, 0x86, 0x88,
+ 0xA8, 0xFB, 0xAF, 0xFF, 0xAF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00,
+ }, {
+ 0xDC, 0xAD, 0xCC, 0xCA, 0xCF, 0xFE, 0xDF, 0xFF, 0xE9, 0xFF, 0x99, 0x79,
+ 0x97, 0x97, 0x97, 0x79, 0x79, 0x77, 0x97, 0x97, 0x79, 0x79, 0x77, 0x86,
+ 0x87, 0x68, 0x68, 0x76, 0x76, 0x76, 0x67, 0x57, 0x66, 0x65, 0x76, 0x66,
+ 0x56, 0x55, 0x64, 0x65, 0x55, 0x45, 0x55, 0x54, 0x55, 0x55, 0x35, 0x55,
+ 0x53, 0x55, 0x65, 0x35, 0x67, 0x64, 0x67, 0x87, 0x57, 0x8A, 0x86, 0x8B,
+ 0xBA, 0x9A, 0xCD, 0xAA, 0xAF, 0xFC, 0xFF, 0xFF, 0xDF, 0xFF, 0x00, 0x00,
+ }
+};
+
+static const uint8_t filter_coeffs_def[3][10][11][24] = {
+ {
+ {
+ {
+ 0x47, 0x88, 0x76, 0x52, 0x12, 0x35, 0x44, 0x43, 0x34, 0x45, 0x77, 0x67,
+ 0x66, 0x87, 0x87, 0x7D, 0x8A, 0x89, 0x9D, 0xDD, 0x9C, 0xC0, 0x00, 0x00,
+ },
+ {
+ 0x7C, 0xCC, 0xC7, 0x65, 0xCC, 0x22, 0x23, 0x46, 0x32, 0x22, 0x46, 0x7B,
+ 0xB6, 0xBB, 0xBB, 0xBC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xC0, 0x00, 0x00,
+ },
+ {
+ 0xBB, 0xBB, 0xB4, 0x43, 0x25, 0x5B, 0x5A, 0xAB, 0x5B, 0x22, 0x22, 0x2B,
+ 0xBA, 0xAA, 0x46, 0x5B, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xB0, 0x00, 0x00,
+ },
+ {
+ 0x99, 0x89, 0x88, 0x89, 0x31, 0x88, 0x88, 0x89, 0x88, 0x38, 0x88, 0x13,
+ 0x28, 0x88, 0x88, 0x28, 0x88, 0x88, 0x88, 0x88, 0x99, 0x90, 0x00, 0x00,
+ },
+ {
+ 0x99, 0x89, 0x88, 0x89, 0x88, 0x88, 0x88, 0x39, 0x98, 0x88, 0x88, 0x88,
+ 0x08, 0x88, 0x88, 0x81, 0x99, 0x88, 0x99, 0x99, 0x99, 0x20, 0x00, 0x00,
+ },
+ {
+ 0xAA, 0xD9, 0x86, 0xCD, 0xDD, 0xDD, 0x98, 0x76, 0x43, 0x65, 0x35, 0x63,
+ 0x23, 0x44, 0x33, 0x24, 0x45, 0x44, 0x45, 0x59, 0xA8, 0x90, 0x00, 0x00,
+ },
+ {
+ 0x99, 0x89, 0x88, 0x89, 0x98, 0x88, 0x88, 0x89, 0x98, 0x08, 0x88, 0x88,
+ 0x28, 0x88, 0x88, 0x83, 0x19, 0x98, 0x88, 0x99, 0x99, 0x90, 0x00, 0x00,
+ },
+ {
+ 0xBA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xA5, 0xA4, 0x01, 0x4A, 0xAA,
+ 0x53, 0x4A, 0xA4, 0xAA, 0x5A, 0xAA, 0xAA, 0xAA, 0xAA, 0xB0, 0x00, 0x00,
+ },
+ {
+ 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0x9A, 0xAA, 0xA3, 0x31, 0x31,
+ 0x34, 0x34, 0xA9, 0xA5, 0x44, 0x4A, 0xAA, 0xAA, 0xAA, 0xA0, 0x00, 0x00,
+ },
+ {
+ 0xEE, 0xDE, 0xED, 0xDE, 0xEE, 0xED, 0xDD, 0xDE, 0xE8, 0xEE, 0xE7, 0x64,
+ 0x47, 0x43, 0x30, 0x43, 0x43, 0x36, 0x7E, 0xEE, 0xEE, 0x90, 0x00, 0x00,
+ },
+ {
+ 0x67, 0x87, 0x87, 0x66, 0x65, 0x55, 0x44, 0x45, 0x65, 0x54, 0x54, 0x32,
+ 0x34, 0x66, 0x63, 0x55, 0x44, 0x54, 0x34, 0x45, 0x56, 0x60, 0x00, 0x00,
+ },
+ },
+ {
+ {
+ 0x56, 0x66, 0x65, 0x54, 0x33, 0x34, 0x33, 0x33, 0x33, 0x34, 0x44, 0x45,
+ 0x56, 0x66, 0x67, 0x77, 0x77, 0x77, 0x78, 0x89, 0x89, 0x60, 0x00, 0x00,
+ },
+ {
+ 0x78, 0x89, 0x98, 0x65, 0x65, 0x32, 0x22, 0x32, 0x33, 0x33, 0x45, 0x77,
+ 0x77, 0x8B, 0x9A, 0xEF, 0xFF, 0xFF, 0xFF, 0xFF, 0xEE, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0x9D, 0xD8, 0x8D, 0x57, 0x56, 0x55, 0x44, 0x45, 0x22, 0x22, 0x23, 0x34,
+ 0x57, 0x78, 0x88, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xD0, 0x00, 0x00,
+ },
+ {
+ 0xDC, 0xCC, 0x8C, 0xCC, 0x87, 0x65, 0x55, 0x54, 0x23, 0x44, 0x21, 0x23,
+ 0x46, 0x56, 0x87, 0x7C, 0x8C, 0x8C, 0xCC, 0xCC, 0xCC, 0xD0, 0x00, 0x00,
+ },
+ {
+ 0xDD, 0xCD, 0xCC, 0xCD, 0xDC, 0xC7, 0x64, 0x58, 0x31, 0x25, 0x33, 0x22,
+ 0x44, 0x56, 0x66, 0x6D, 0xDD, 0xDD, 0xDC, 0xDC, 0xDC, 0xD0, 0x00, 0x00,
+ },
+ {
+ 0xB9, 0x99, 0xA6, 0x67, 0x78, 0x76, 0x78, 0x88, 0x66, 0x55, 0x44, 0x43,
+ 0x23, 0x33, 0x33, 0x33, 0x34, 0x45, 0x56, 0x66, 0x88, 0xB0, 0x00, 0x00,
+ },
+ {
+ 0xDD, 0xCD, 0xDC, 0xCD, 0xDC, 0xCC, 0x77, 0xC5, 0x53, 0x12, 0x23, 0x33,
+ 0x33, 0x46, 0x65, 0x75, 0x8D, 0xDD, 0xDD, 0xDC, 0xDC, 0xD0, 0x00, 0x00,
+ },
+ {
+ 0xDD, 0xCD, 0xCC, 0xCD, 0xDC, 0xCC, 0x8C, 0x85, 0x55, 0x33, 0x21, 0x23,
+ 0x33, 0x44, 0x56, 0x56, 0x56, 0x8D, 0xDD, 0xCC, 0xDC, 0xD0, 0x00, 0x00,
+ },
+ {
+ 0xEE, 0xDE, 0xDD, 0xDE, 0xDD, 0xDD, 0xDD, 0x87, 0x75, 0x55, 0x43, 0x22,
+ 0x21, 0x25, 0x65, 0x55, 0x66, 0x77, 0xD8, 0x8D, 0xDD, 0x90, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFC, 0xAA, 0x98, 0x77, 0x55, 0x43,
+ 0x33, 0x33, 0x21, 0x33, 0x34, 0x66, 0x89, 0xAF, 0xFF, 0xC0, 0x00, 0x00,
+ },
+ {
+ 0x57, 0x77, 0x76, 0x66, 0x65, 0x55, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44,
+ 0x33, 0x44, 0x43, 0x44, 0x44, 0x45, 0x56, 0x66, 0x77, 0x50, 0x00, 0x00,
+ },
+ },
+ {
+ {
+ 0x57, 0x76, 0x66, 0x65, 0x44, 0x44, 0x43, 0x33, 0x33, 0x33, 0x33, 0x34,
+ 0x45, 0x56, 0x67, 0x77, 0x77, 0x89, 0x88, 0x89, 0x99, 0x60, 0x00, 0x00,
+ },
+ {
+ 0x8A, 0x99, 0x88, 0x77, 0x66, 0x44, 0x43, 0x32, 0x32, 0x22, 0x33, 0x45,
+ 0x67, 0x89, 0xEB, 0xEF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFB, 0xBA, 0xA7, 0x78, 0x66, 0x65, 0x54, 0x22, 0x21, 0x23, 0x44,
+ 0x56, 0x8A, 0x9E, 0xAF, 0xFB, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xAF, 0xFD, 0xDF, 0xAC, 0x98, 0x77, 0x66, 0x44, 0x31, 0x11, 0x35,
+ 0x67, 0x88, 0x8A, 0xAA, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xEF, 0xEE, 0xEF, 0xA8, 0x8E, 0x97, 0x66, 0x43, 0x22, 0x21, 0x23,
+ 0x45, 0x67, 0x97, 0x7F, 0xFF, 0xEE, 0xE9, 0xEE, 0xEE, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xAA, 0xA9, 0x97, 0x65, 0x45, 0x45, 0x67, 0x66, 0x55, 0x54, 0x44, 0x44,
+ 0x33, 0x33, 0x33, 0x33, 0x44, 0x45, 0x56, 0x68, 0x8B, 0xB0, 0x00, 0x00,
+ },
+ {
+ 0xEE, 0xDE, 0xED, 0xDE, 0xED, 0xDD, 0xD8, 0x77, 0x65, 0x43, 0x11, 0x22,
+ 0x34, 0x66, 0x78, 0x87, 0xEE, 0xEE, 0xEE, 0x9D, 0xED, 0xE0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xDC, 0xFF, 0xAE, 0xEA, 0x98, 0x76, 0x54, 0x31, 0x11,
+ 0x34, 0x56, 0x88, 0x99, 0x9B, 0xFF, 0xFF, 0xBF, 0xFF, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xCF, 0xDF, 0xFF, 0xFD, 0x9A, 0x76, 0x65, 0x43, 0x21,
+ 0x12, 0x35, 0x56, 0x67, 0x89, 0x99, 0xAF, 0xAF, 0xFF, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFE, 0xEF, 0xDB, 0xBA, 0xAA, 0x99, 0x76, 0x55, 0x43, 0x22,
+ 0x22, 0x33, 0x33, 0x44, 0x55, 0x67, 0x8A, 0xFA, 0xFB, 0xA0, 0x00, 0x00,
+ },
+ {
+ 0x57, 0x77, 0x77, 0x66, 0x65, 0x55, 0x54, 0x44, 0x44, 0x44, 0x43, 0x33,
+ 0x33, 0x34, 0x44, 0x44, 0x55, 0x55, 0x66, 0x77, 0x88, 0x60, 0x00, 0x00,
+ },
+ },
+ {
+ {
+ 0x58, 0x77, 0x76, 0x66, 0x55, 0x54, 0x44, 0x33, 0x33, 0x23, 0x33, 0x33,
+ 0x45, 0x56, 0x66, 0x77, 0x88, 0x88, 0x88, 0x88, 0x99, 0x60, 0x00, 0x00,
+ },
+ {
+ 0x9A, 0xA9, 0xA9, 0x88, 0x76, 0x55, 0x44, 0x33, 0x22, 0x22, 0x23, 0x45,
+ 0x56, 0x99, 0x9D, 0xBF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xFD, 0xBB, 0xAA, 0xBA, 0xA9, 0x87, 0x77, 0x54, 0x33, 0x21, 0x12, 0x45,
+ 0x68, 0x8A, 0xAA, 0xCB, 0xFF, 0xCF, 0xFF, 0xFF, 0xFE, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xEF, 0xFE, 0xA9, 0x98, 0x87, 0x65, 0x41, 0x02, 0x45,
+ 0x77, 0x88, 0xAC, 0xAF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xBF, 0xFC, 0xAB, 0xFB, 0xBA, 0xAB, 0xB8, 0x88, 0x76, 0x52, 0x01, 0x35,
+ 0x78, 0x99, 0xAB, 0xAA, 0xCF, 0xBB, 0xCF, 0xFC, 0xFC, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xBA, 0xCA, 0x98, 0x75, 0x21, 0x35, 0x77, 0x77, 0x76, 0x65, 0x54, 0x44,
+ 0x44, 0x34, 0x44, 0x44, 0x45, 0x56, 0x78, 0x88, 0x9A, 0xC0, 0x00, 0x00,
+ },
+ {
+ 0xDF, 0xCF, 0xCC, 0xFF, 0xAB, 0xC9, 0xB9, 0x98, 0x97, 0x75, 0x20, 0x13,
+ 0x56, 0x89, 0x89, 0xAA, 0xFC, 0xBC, 0xAF, 0xCC, 0xFF, 0xD0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xBB, 0xFB, 0xFF, 0xFB, 0xBA, 0xA8, 0x77, 0x54, 0x21, 0x11,
+ 0x45, 0x67, 0x88, 0x8A, 0xEF, 0xBB, 0xFF, 0xBB, 0xFF, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFC, 0xFB, 0xCB, 0xB9, 0x88, 0x65, 0x31, 0x12,
+ 0x23, 0x35, 0x67, 0x88, 0xAA, 0xAC, 0xFC, 0xFF, 0xFF, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFC, 0xEF, 0xFF, 0xBB, 0xAA, 0xA9, 0x76, 0x55, 0x32, 0x22,
+ 0x22, 0x33, 0x34, 0x56, 0x67, 0x68, 0x9A, 0xAA, 0xCD, 0xE0, 0x00, 0x00,
+ },
+ {
+ 0x58, 0x77, 0x77, 0x66, 0x66, 0x55, 0x54, 0x44, 0x44, 0x43, 0x33, 0x33,
+ 0x33, 0x34, 0x44, 0x55, 0x55, 0x66, 0x67, 0x78, 0x88, 0x60, 0x00, 0x00,
+ },
+ },
+ {
+ {
+ 0x57, 0x77, 0x76, 0x66, 0x55, 0x55, 0x54, 0x43, 0x33, 0x22, 0x33, 0x34,
+ 0x45, 0x55, 0x66, 0x67, 0x77, 0x77, 0x78, 0x88, 0x99, 0x50, 0x00, 0x00,
+ },
+ {
+ 0xAC, 0x99, 0x98, 0x87, 0x76, 0x66, 0x54, 0x43, 0x32, 0x21, 0x23, 0x45,
+ 0x66, 0x89, 0x99, 0x99, 0xAA, 0xBF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xB9, 0xAA, 0x98, 0x77, 0x65, 0x42, 0x21, 0x12, 0x45,
+ 0x78, 0x8A, 0xBA, 0xAA, 0xFB, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFD, 0xBC, 0xBB, 0xB9, 0x98, 0x76, 0x32, 0x01, 0x46,
+ 0x79, 0xAB, 0xBB, 0xBE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xCF, 0xAA, 0xAA, 0x99, 0x76, 0x42, 0x01, 0x36,
+ 0x79, 0x9A, 0xAB, 0xBF, 0xFD, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xCC, 0xDC, 0xB9, 0x75, 0x10, 0x47, 0x89, 0x99, 0x98, 0x87, 0x76, 0x66,
+ 0x55, 0x55, 0x55, 0x56, 0x66, 0x67, 0x78, 0x99, 0xBE, 0xE0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFC, 0xCC, 0xFF, 0xFB, 0xAB, 0x87, 0x64, 0x10, 0x23,
+ 0x67, 0x99, 0x9A, 0xAD, 0xCE, 0xFF, 0xFC, 0xFF, 0xFF, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFB, 0xFF, 0xFD, 0xFA, 0xB9, 0x97, 0x65, 0x20, 0x13,
+ 0x56, 0x78, 0xAA, 0x9B, 0xFB, 0xFC, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xCF, 0xFC, 0xC9, 0xAC, 0x98, 0x87, 0x54, 0x31, 0x12,
+ 0x23, 0x45, 0x67, 0x78, 0x9A, 0xAA, 0xEB, 0xFF, 0xFF, 0xE0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFE, 0xCA, 0xFA, 0x99, 0x98, 0x88, 0x65, 0x44, 0x32, 0x22,
+ 0x22, 0x33, 0x45, 0x56, 0x67, 0x78, 0x99, 0xBB, 0xAB, 0xA0, 0x00, 0x00,
+ },
+ {
+ 0x48, 0x77, 0x76, 0x66, 0x65, 0x55, 0x55, 0x44, 0x44, 0x43, 0x33, 0x33,
+ 0x33, 0x34, 0x45, 0x55, 0x55, 0x66, 0x67, 0x77, 0x78, 0x60, 0x00, 0x00,
+ },
+ },
+ {
+ {
+ 0x68, 0x87, 0x77, 0x77, 0x66, 0x55, 0x54, 0x43, 0x33, 0x22, 0x23, 0x34,
+ 0x45, 0x55, 0x66, 0x78, 0x88, 0x98, 0x88, 0x88, 0x89, 0x60, 0x00, 0x00,
+ },
+ {
+ 0xAB, 0xBA, 0xAA, 0xBA, 0x99, 0x87, 0x76, 0x54, 0x33, 0x21, 0x12, 0x46,
+ 0x67, 0x89, 0x9A, 0xDF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFD, 0xCA, 0x98, 0x87, 0x76, 0x54, 0x21, 0x11, 0x45,
+ 0x78, 0x8A, 0x9A, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xBC, 0xAA, 0x99, 0x76, 0x32, 0x01, 0x46,
+ 0x78, 0x9A, 0xAB, 0xEF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xCA, 0xE9, 0x89, 0x76, 0x52, 0x01, 0x35,
+ 0x68, 0x98, 0x9A, 0xAF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xAD, 0xCB, 0xA9, 0x74, 0x10, 0x46, 0x89, 0x9A, 0xA9, 0x98, 0x77, 0x76,
+ 0x66, 0x55, 0x55, 0x56, 0x66, 0x66, 0x78, 0x88, 0x8A, 0xD0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFD, 0xAA, 0xAA, 0x87, 0x63, 0x10, 0x24,
+ 0x67, 0x89, 0xAF, 0xDF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xBB, 0x9A, 0x97, 0x64, 0x20, 0x13,
+ 0x67, 0x89, 0x9A, 0xCF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x99, 0x87, 0x76, 0x43, 0x21, 0x12,
+ 0x34, 0x56, 0x67, 0x88, 0x89, 0xAE, 0xCF, 0xFD, 0xEF, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFD, 0xAA, 0x87, 0x66, 0x54, 0x31, 0x12,
+ 0x33, 0x44, 0x55, 0x67, 0x77, 0x89, 0xAB, 0xAB, 0xCF, 0xC0, 0x00, 0x00,
+ },
+ {
+ 0x58, 0x87, 0x87, 0x77, 0x76, 0x66, 0x55, 0x55, 0x44, 0x43, 0x32, 0x22,
+ 0x33, 0x44, 0x55, 0x56, 0x67, 0x77, 0x78, 0x88, 0x88, 0x70, 0x00, 0x00,
+ },
+ },
+ {
+ {
+ 0x67, 0x76, 0x66, 0x76, 0x66, 0x55, 0x44, 0x44, 0x33, 0x22, 0x22, 0x34,
+ 0x56, 0x67, 0x77, 0x89, 0x88, 0x99, 0xAB, 0x9A, 0xAB, 0x70, 0x00, 0x00,
+ },
+ {
+ 0x9B, 0xA9, 0x88, 0x88, 0x87, 0x77, 0x65, 0x54, 0x43, 0x21, 0x12, 0x45,
+ 0x67, 0x9A, 0x9A, 0xEF, 0xFF, 0xFF, 0xFF, 0xFF, 0xEE, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFC, 0xCB, 0xBA, 0xAA, 0x98, 0x87, 0x65, 0x31, 0x02, 0x56,
+ 0x89, 0xAB, 0xCB, 0xBC, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFA, 0xAA, 0x9A, 0x98, 0x76, 0x42, 0x01, 0x36,
+ 0x79, 0xAF, 0xCF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFA, 0x78, 0xA9, 0x98, 0x76, 0x52, 0x01, 0x35,
+ 0x78, 0x8E, 0xCB, 0xBF, 0xEF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0x8C, 0xBA, 0x99, 0x74, 0x10, 0x36, 0x89, 0x9A, 0xA9, 0x99, 0x88, 0x87,
+ 0x76, 0x66, 0x66, 0x66, 0x66, 0x56, 0x66, 0x78, 0x89, 0xC0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF9, 0x8A, 0xA9, 0x88, 0x63, 0x10, 0x24,
+ 0x67, 0x8B, 0xBC, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xC9, 0x99, 0x76, 0x54, 0x10, 0x24,
+ 0x56, 0x78, 0x9A, 0xAA, 0xFF, 0xFF, 0xFF, 0xFF, 0xEF, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xD9, 0x87, 0x54, 0x20, 0x22,
+ 0x45, 0x67, 0x77, 0x89, 0xAC, 0xAB, 0xFB, 0xFF, 0xFF, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xAD, 0xAB, 0x86, 0x54, 0x21, 0x12,
+ 0x34, 0x45, 0x66, 0x77, 0x67, 0x77, 0x88, 0x99, 0x9A, 0x90, 0x00, 0x00,
+ },
+ {
+ 0x57, 0x77, 0x76, 0x66, 0x65, 0x55, 0x55, 0x55, 0x54, 0x43, 0x32, 0x23,
+ 0x33, 0x44, 0x55, 0x55, 0x66, 0x67, 0x88, 0x77, 0x77, 0x50, 0x00, 0x00,
+ },
+ },
+ {
+ {
+ 0x35, 0x44, 0x45, 0x55, 0x54, 0x44, 0x44, 0x43, 0x33, 0x33, 0x23, 0x44,
+ 0x68, 0x99, 0xAA, 0xAA, 0xCB, 0xAB, 0xAF, 0xFE, 0xEB, 0xE0, 0x00, 0x00,
+ },
+ {
+ 0x77, 0x66, 0x67, 0x66, 0x66, 0x66, 0x54, 0x44, 0x33, 0x22, 0x12, 0x45,
+ 0x68, 0xAA, 0xBE, 0xAF, 0xFF, 0xFF, 0xFF, 0xFF, 0xEE, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xEA, 0x98, 0x88, 0x87, 0x77, 0x65, 0x55, 0x44, 0x32, 0x02, 0x46,
+ 0x78, 0x89, 0xAA, 0xBF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xAB, 0xAB, 0x99, 0x76, 0x65, 0x42, 0x01, 0x45,
+ 0x78, 0xAA, 0xAD, 0xAC, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFC, 0xEB, 0xBA, 0xA9, 0x86, 0x42, 0x01, 0x36,
+ 0x77, 0x8A, 0xBB, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xAC, 0xBB, 0x98, 0x74, 0x10, 0x36, 0x77, 0x89, 0x99, 0x99, 0x88, 0x77,
+ 0x76, 0x66, 0x66, 0x55, 0x56, 0x67, 0x89, 0xAA, 0xAB, 0xC0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xDF, 0xC9, 0x99, 0x99, 0x88, 0x64, 0x10, 0x24,
+ 0x55, 0x68, 0x89, 0xBB, 0xAD, 0xBF, 0xBF, 0xFF, 0xFF, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x97, 0x65, 0x65, 0x54, 0x20, 0x23,
+ 0x45, 0x56, 0x77, 0x77, 0x8E, 0xCB, 0xBE, 0xDF, 0xFF, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xBA, 0x76, 0x53, 0x21, 0x13,
+ 0x34, 0x55, 0x45, 0x55, 0x67, 0x79, 0xAB, 0xFA, 0xFB, 0xA0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xBF, 0xFE, 0x87, 0x54, 0x21, 0x23,
+ 0x33, 0x44, 0x55, 0x55, 0x44, 0x45, 0x57, 0x8A, 0xAA, 0x80, 0x00, 0x00,
+ },
+ {
+ 0x79, 0x99, 0x99, 0x97, 0x77, 0x76, 0x54, 0x44, 0x44, 0x44, 0x32, 0x33,
+ 0x33, 0x33, 0x44, 0x45, 0x56, 0x67, 0x88, 0x77, 0x78, 0x60, 0x00, 0x00,
+ },
+ },
+ {
+ {
+ 0x34, 0x54, 0x45, 0x55, 0x54, 0x44, 0x44, 0x33, 0x32, 0x43, 0x34, 0x44,
+ 0x56, 0x77, 0xBB, 0xB6, 0xCC, 0xCC, 0xCC, 0xC8, 0xCB, 0x70, 0x00, 0x00,
+ },
+ {
+ 0x7E, 0x67, 0x55, 0x65, 0x44, 0x55, 0x44, 0x33, 0x22, 0x23, 0x23, 0x57,
+ 0x98, 0xDD, 0xDD, 0xDE, 0xED, 0xDD, 0xDD, 0xDD, 0xDD, 0xE0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xEF, 0xEE, 0x97, 0x75, 0x54, 0x43, 0x33, 0x33, 0x32, 0x12, 0x58,
+ 0x88, 0xEE, 0xAE, 0xEF, 0xFF, 0xFF, 0xFF, 0xFE, 0xEE, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFA, 0x88, 0x87, 0x66, 0x53, 0x22, 0x02, 0x57,
+ 0x9D, 0xFF, 0xFF, 0xEF, 0xEF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFA, 0xA9, 0x78, 0x76, 0x42, 0x01, 0x36,
+ 0x99, 0x9A, 0xFF, 0xDF, 0xFF, 0xFD, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xAB, 0xAA, 0xA8, 0x75, 0x10, 0x26, 0x79, 0x88, 0x77, 0x77, 0x66, 0x66,
+ 0x57, 0x78, 0x88, 0x89, 0x98, 0x9A, 0xBB, 0xBB, 0xDD, 0xC0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFE, 0xEF, 0xFF, 0xFE, 0xA8, 0x78, 0x76, 0x54, 0x20, 0x22,
+ 0x45, 0x6E, 0x8E, 0xEF, 0xFF, 0xF9, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xEF, 0xFF, 0xFF, 0xFA, 0xE7, 0x66, 0x64, 0x20, 0x23,
+ 0x34, 0x56, 0x78, 0x88, 0xAF, 0xFC, 0xFF, 0xFF, 0xAF, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xEE, 0xDE, 0xED, 0xDE, 0xED, 0x8D, 0xDD, 0xD9, 0xE6, 0x63, 0x21, 0x23,
+ 0x43, 0x34, 0x35, 0x55, 0x65, 0x47, 0xEE, 0xED, 0xED, 0xE0, 0x00, 0x00,
+ },
+ {
+ 0xDD, 0xCD, 0xDC, 0xCD, 0xDD, 0xCC, 0xCC, 0xCD, 0xDD, 0x76, 0x43, 0x44,
+ 0x44, 0x43, 0x34, 0x33, 0x22, 0x33, 0x35, 0xD8, 0xCC, 0xD0, 0x00, 0x00,
+ },
+ {
+ 0x6B, 0x77, 0xBB, 0xB6, 0x96, 0x55, 0x55, 0x54, 0x44, 0x44, 0x33, 0x43,
+ 0x33, 0x33, 0x45, 0x34, 0x44, 0x68, 0x57, 0x78, 0x86, 0x50, 0x00, 0x00,
+ },
+ },
+ {
+ {
+ 0x4A, 0xAA, 0xAA, 0x9A, 0x44, 0x44, 0x45, 0x23, 0x24, 0x22, 0xA3, 0x3A,
+ 0x44, 0x99, 0x99, 0x9A, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xA0, 0x00, 0x00,
+ },
+ {
+ 0xAA, 0x45, 0x34, 0x94, 0x4A, 0x4A, 0x32, 0x23, 0x32, 0x24, 0x4A, 0xAA,
+ 0xAA, 0xA9, 0x99, 0x9A, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xA0, 0x00, 0x00,
+ },
+ {
+ 0xAA, 0xAA, 0xAA, 0xAA, 0x4A, 0xA4, 0x44, 0x21, 0x43, 0x32, 0x23, 0x5A,
+ 0xAA, 0xAA, 0x99, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xA0, 0x00, 0x00,
+ },
+ {
+ 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0x7D, 0x8D, 0x74, 0x21, 0x11, 0x35, 0x7D,
+ 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xD0, 0x00, 0x00,
+ },
+ {
+ 0xFE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xE9, 0x64, 0x32, 0x01, 0x57,
+ 0xE8, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xEE, 0xDE, 0xE9, 0x55, 0x10, 0x27, 0x98, 0x65, 0x48, 0xAE, 0x99, 0x88,
+ 0x77, 0x87, 0x79, 0x89, 0xEA, 0xEE, 0xAE, 0xEE, 0xEE, 0xE0, 0x00, 0x00,
+ },
+ {
+ 0xCB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xB6, 0x45, 0x11, 0x13,
+ 0x44, 0x3B, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xC0, 0x00, 0x00,
+ },
+ {
+ 0xBB, 0xAB, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0x5A, 0x31, 0x12,
+ 0x23, 0x34, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xB0, 0x00, 0x00,
+ },
+ {
+ 0xBB, 0xBB, 0xBB, 0xAB, 0xBB, 0xBB, 0xAA, 0xAB, 0xBB, 0xBB, 0xB5, 0x55,
+ 0x64, 0x22, 0x24, 0x55, 0x32, 0x14, 0xBB, 0xBB, 0xBB, 0xB0, 0x00, 0x00,
+ },
+ {
+ 0xAA, 0xAA, 0xA9, 0x9A, 0xAA, 0xA9, 0x99, 0x9A, 0x4A, 0xAA, 0xA3, 0x33,
+ 0x32, 0x34, 0x35, 0x44, 0x42, 0x24, 0xA4, 0xAA, 0xAA, 0xA0, 0x00, 0x00,
+ },
+ {
+ 0xAA, 0x9A, 0x99, 0x9A, 0xA9, 0x54, 0x94, 0x95, 0x44, 0x53, 0x34, 0x53,
+ 0x23, 0x34, 0x34, 0x45, 0x33, 0x4A, 0x99, 0x99, 0xA9, 0xA0, 0x00, 0x00,
+ },
+ },
+ },
+ {
+ {
+ {
+ 0x57, 0xAB, 0x66, 0x52, 0x12, 0x44, 0x45, 0x43, 0x33, 0x45, 0x77, 0xA6,
+ 0x77, 0xA7, 0xA7, 0x65, 0x77, 0xBB, 0xB7, 0xBB, 0x7B, 0xB0, 0x00, 0x00,
+ },
+ {
+ 0xBB, 0x5B, 0xBB, 0x5B, 0xBB, 0x21, 0x22, 0x45, 0x62, 0x26, 0x56, 0xBB,
+ 0xBB, 0xBA, 0xAA, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xB0, 0x00, 0x00,
+ },
+ {
+ 0xAA, 0x3A, 0x99, 0x93, 0x19, 0x99, 0x99, 0x99, 0x99, 0x24, 0x19, 0x33,
+ 0x99, 0x93, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0xA0, 0x00, 0x00,
+ },
+ {
+ 0x77, 0x67, 0x66, 0x67, 0x76, 0x66, 0x66, 0x67, 0x77, 0x66, 0x66, 0x66,
+ 0x66, 0x66, 0x66, 0x10, 0x77, 0x76, 0x77, 0x77, 0x77, 0x70, 0x00, 0x00,
+ },
+ {
+ 0x77, 0x67, 0x66, 0x67, 0x76, 0x66, 0x66, 0x67, 0x77, 0x66, 0x66, 0x66,
+ 0x61, 0x66, 0x66, 0x67, 0x07, 0x76, 0x77, 0x77, 0x77, 0x70, 0x00, 0x00,
+ },
+ {
+ 0xDD, 0xDD, 0xD6, 0xCD, 0xDD, 0xD9, 0x88, 0xC9, 0x64, 0x76, 0x34, 0x42,
+ 0x12, 0x54, 0x53, 0x34, 0x54, 0x56, 0x66, 0x79, 0xDD, 0xD0, 0x00, 0x00,
+ },
+ {
+ 0x88, 0x78, 0x77, 0x78, 0x77, 0x77, 0x77, 0x78, 0x87, 0x07, 0x77, 0x77,
+ 0x21, 0x77, 0x77, 0x78, 0x88, 0x87, 0x87, 0x88, 0x88, 0x80, 0x00, 0x00,
+ },
+ {
+ 0xAA, 0x9A, 0x99, 0x9A, 0x99, 0x99, 0x99, 0x9A, 0x99, 0x01, 0x99, 0x99,
+ 0x43, 0x99, 0x34, 0x99, 0x94, 0x99, 0x99, 0x99, 0xAA, 0xA0, 0x00, 0x00,
+ },
+ {
+ 0x99, 0x89, 0x88, 0x89, 0x88, 0x88, 0x88, 0x89, 0x88, 0x82, 0x88, 0x21,
+ 0x82, 0x82, 0x83, 0x88, 0x82, 0x88, 0x88, 0x88, 0x99, 0x90, 0x00, 0x00,
+ },
+ {
+ 0xDD, 0xDD, 0xDD, 0xCD, 0xDD, 0xDD, 0xCC, 0xCD, 0xDD, 0xDD, 0xD6, 0x74,
+ 0x56, 0x64, 0x20, 0x54, 0x42, 0x38, 0xDD, 0xDD, 0xDD, 0xD0, 0x00, 0x00,
+ },
+ {
+ 0x79, 0x87, 0x96, 0x76, 0x76, 0x55, 0x66, 0x44, 0x55, 0x44, 0x55, 0x32,
+ 0x24, 0x88, 0x62, 0x55, 0x45, 0x43, 0x47, 0x66, 0x76, 0x60, 0x00, 0x00,
+ },
+ },
+ {
+ {
+ 0x57, 0x66, 0x65, 0x54, 0x43, 0x34, 0x33, 0x33, 0x33, 0x33, 0x44, 0x45,
+ 0x55, 0x66, 0x77, 0x77, 0x77, 0x77, 0x98, 0x88, 0x79, 0x60, 0x00, 0x00,
+ },
+ {
+ 0x88, 0x98, 0x8D, 0x65, 0x66, 0x32, 0x33, 0x22, 0x23, 0x33, 0x45, 0x67,
+ 0x78, 0x68, 0x8D, 0xCD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xD0, 0x00, 0x00,
+ },
+ {
+ 0x8D, 0xCD, 0xDC, 0xC5, 0x56, 0x46, 0x45, 0x54, 0x22, 0x22, 0x22, 0x45,
+ 0x57, 0x6C, 0xCC, 0xCD, 0xDD, 0xDD, 0xDD, 0xDC, 0xCC, 0xD0, 0x00, 0x00,
+ },
+ {
+ 0xCC, 0xCC, 0xCB, 0xBC, 0xCC, 0xC7, 0xB5, 0x54, 0x12, 0x33, 0x22, 0x25,
+ 0x56, 0xB6, 0x7B, 0xB7, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xC0, 0x00, 0x00,
+ },
+ {
+ 0xBB, 0xAB, 0xBA, 0xAB, 0xBB, 0xA5, 0xA5, 0x55, 0x21, 0x2B, 0x33, 0x23,
+ 0x44, 0x55, 0xA6, 0x5B, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xB0, 0x00, 0x00,
+ },
+ {
+ 0xAC, 0xAB, 0xC6, 0x66, 0x87, 0x87, 0x77, 0x98, 0x66, 0x54, 0x43, 0x43,
+ 0x33, 0x32, 0x33, 0x33, 0x44, 0x45, 0x66, 0x68, 0x79, 0xA0, 0x00, 0x00,
+ },
+ {
+ 0xBB, 0xBB, 0xBB, 0xAB, 0xBB, 0xBB, 0xBA, 0x4B, 0x43, 0x22, 0x22, 0x32,
+ 0x44, 0x34, 0xA5, 0xA6, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xB0, 0x00, 0x00,
+ },
+ {
+ 0xBB, 0xAB, 0xAA, 0xAB, 0xBA, 0xAA, 0xA6, 0x65, 0x54, 0x43, 0x21, 0x23,
+ 0x34, 0x34, 0x55, 0x56, 0x6B, 0xBB, 0xB6, 0xBA, 0xBA, 0xB0, 0x00, 0x00,
+ },
+ {
+ 0xDD, 0xCD, 0xDC, 0xCD, 0xDD, 0xCC, 0xCC, 0xC6, 0x66, 0x44, 0x43, 0x32,
+ 0x21, 0x25, 0x65, 0x46, 0x54, 0x8D, 0xDD, 0xDC, 0xD7, 0xC0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xEF, 0xEE, 0xEF, 0xEE, 0xEE, 0xEE, 0x9A, 0xF7, 0x66, 0x55, 0x43,
+ 0x33, 0x22, 0x22, 0x33, 0x34, 0x78, 0x98, 0xEE, 0xFE, 0x90, 0x00, 0x00,
+ },
+ {
+ 0x57, 0x67, 0x66, 0x76, 0x65, 0x55, 0x44, 0x54, 0x44, 0x43, 0x43, 0x34,
+ 0x43, 0x44, 0x44, 0x44, 0x45, 0x45, 0x55, 0x67, 0x77, 0x60, 0x00, 0x00,
+ },
+ },
+ {
+ {
+ 0x78, 0x88, 0x76, 0x66, 0x55, 0x54, 0x44, 0x33, 0x22, 0x23, 0x33, 0x44,
+ 0x55, 0x67, 0x67, 0x78, 0x98, 0x98, 0x99, 0x9A, 0xA9, 0x90, 0x00, 0x00,
+ },
+ {
+ 0x99, 0xAA, 0xAB, 0x97, 0x65, 0x55, 0x44, 0x32, 0x22, 0x22, 0x33, 0x45,
+ 0x67, 0x89, 0xFF, 0xEF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFC, 0xBB, 0xA8, 0x88, 0x77, 0x76, 0x54, 0x32, 0x11, 0x23, 0x46,
+ 0x77, 0x8A, 0xF8, 0xCF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xEE, 0xDE, 0xED, 0xDE, 0xE9, 0xDD, 0x77, 0x65, 0x43, 0x21, 0x12, 0x34,
+ 0x57, 0x7D, 0x78, 0xDE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xE0, 0x00, 0x00,
+ },
+ {
+ 0xEE, 0xEE, 0xEE, 0xDE, 0xEE, 0xE7, 0x7D, 0x96, 0x54, 0x22, 0x11, 0x24,
+ 0x56, 0x87, 0xDD, 0xDE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xE0, 0x00, 0x00,
+ },
+ {
+ 0xCB, 0xAA, 0x97, 0x65, 0x44, 0x45, 0x77, 0x76, 0x66, 0x55, 0x44, 0x33,
+ 0x33, 0x33, 0x33, 0x33, 0x44, 0x55, 0x68, 0x99, 0x9A, 0xC0, 0x00, 0x00,
+ },
+ {
+ 0xDD, 0xDD, 0xDD, 0x7D, 0xDD, 0xDC, 0xCC, 0x66, 0x66, 0x43, 0x11, 0x22,
+ 0x34, 0x56, 0x8C, 0xCD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xD0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xEF, 0xFE, 0xEF, 0xFF, 0xEE, 0xE9, 0x88, 0x76, 0x54, 0x31, 0x11,
+ 0x34, 0x57, 0x77, 0x8F, 0xAF, 0xFF, 0xFF, 0xFE, 0xFE, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xFE, 0xEE, 0xEE, 0xEA, 0xAE, 0xEE, 0xA9, 0xE9, 0x87, 0x65, 0x43, 0x11,
+ 0x22, 0x35, 0x56, 0x66, 0x88, 0x9A, 0xEE, 0xEA, 0xEE, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xEA, 0xFF, 0xFB, 0xEA, 0x98, 0x76, 0x55, 0x43, 0x22,
+ 0x22, 0x33, 0x33, 0x44, 0x46, 0x78, 0xAA, 0xFF, 0xFB, 0xB0, 0x00, 0x00,
+ },
+ {
+ 0x79, 0x99, 0x77, 0x77, 0x66, 0x55, 0x54, 0x44, 0x43, 0x43, 0x33, 0x33,
+ 0x33, 0x34, 0x44, 0x55, 0x55, 0x66, 0x66, 0x79, 0x99, 0x80, 0x00, 0x00,
+ },
+ },
+ {
+ {
+ 0x68, 0x87, 0x77, 0x66, 0x55, 0x55, 0x54, 0x43, 0x32, 0x22, 0x33, 0x34,
+ 0x45, 0x66, 0x77, 0x78, 0x88, 0x89, 0x98, 0x88, 0x88, 0x60, 0x00, 0x00,
+ },
+ {
+ 0xAA, 0xAB, 0xAB, 0xA9, 0x88, 0x66, 0x65, 0x43, 0x22, 0x21, 0x23, 0x46,
+ 0x78, 0xA9, 0xBF, 0xEF, 0xFF, 0xFF, 0xFF, 0xEF, 0xFF, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xFD, 0xFF, 0xFF, 0xBC, 0x99, 0x98, 0x76, 0x65, 0x42, 0x21, 0x12, 0x46,
+ 0x67, 0x99, 0xFF, 0xEF, 0xFF, 0xFF, 0xBF, 0xFF, 0xFF, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xBE, 0xFA, 0xB9, 0x87, 0x65, 0x31, 0x02, 0x56,
+ 0x79, 0x9A, 0xAF, 0xEA, 0xFF, 0xFF, 0xFF, 0xCF, 0xFF, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0x9B, 0xAE, 0xBE, 0x9B, 0xBB, 0xAB, 0xAA, 0x98, 0x76, 0x52, 0x01, 0x35,
+ 0x88, 0x99, 0x9A, 0xAC, 0xBA, 0xBB, 0xEA, 0xBA, 0xEA, 0xB0, 0x00, 0x00,
+ },
+ {
+ 0xCC, 0xBC, 0xA7, 0x65, 0x21, 0x46, 0x88, 0x87, 0x77, 0x65, 0x44, 0x44,
+ 0x43, 0x33, 0x44, 0x45, 0x55, 0x56, 0x78, 0x9A, 0x9B, 0xC0, 0x00, 0x00,
+ },
+ {
+ 0x9E, 0x9E, 0xA9, 0xAB, 0xAA, 0xA9, 0x9D, 0x99, 0x87, 0x65, 0x10, 0x23,
+ 0x68, 0x88, 0x98, 0x9A, 0xA9, 0xAA, 0xDA, 0xAD, 0xAA, 0x90, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFE, 0xEF, 0xFF, 0xFC, 0xBB, 0xA9, 0xA7, 0x65, 0x30, 0x12,
+ 0x56, 0x78, 0x9A, 0x9A, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xCC, 0xBA, 0x98, 0x76, 0x41, 0x11,
+ 0x24, 0x47, 0x77, 0x89, 0xBB, 0xED, 0xCF, 0xFF, 0xFF, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xCF, 0xFF, 0xEF, 0xCF, 0xCE, 0x9B, 0xA9, 0x87, 0x65, 0x42, 0x11,
+ 0x23, 0x44, 0x55, 0x66, 0x67, 0x9A, 0xAB, 0xCF, 0xCC, 0xD0, 0x00, 0x00,
+ },
+ {
+ 0x68, 0x78, 0x77, 0x76, 0x66, 0x55, 0x55, 0x54, 0x44, 0x33, 0x33, 0x32,
+ 0x33, 0x34, 0x55, 0x55, 0x66, 0x66, 0x77, 0x77, 0x88, 0x60, 0x00, 0x00,
+ },
+ },
+ {
+ {
+ 0x68, 0x77, 0x76, 0x66, 0x55, 0x55, 0x54, 0x44, 0x32, 0x22, 0x33, 0x34,
+ 0x55, 0x56, 0x66, 0x66, 0x67, 0x78, 0x88, 0x99, 0x99, 0x50, 0x00, 0x00,
+ },
+ {
+ 0xCB, 0xCA, 0xAA, 0xA9, 0x97, 0x77, 0x66, 0x54, 0x32, 0x21, 0x13, 0x46,
+ 0x79, 0xAA, 0xAB, 0xBF, 0xCD, 0xFD, 0xCF, 0xFF, 0xFF, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFC, 0xFF, 0xBB, 0xA9, 0xA8, 0x87, 0x65, 0x31, 0x02, 0x56,
+ 0x89, 0xAB, 0xBB, 0xBB, 0xBC, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFB, 0xFF, 0xCD, 0xCF, 0x99, 0x87, 0x65, 0x42, 0x01, 0x45,
+ 0x67, 0x9A, 0xBB, 0xAF, 0xBD, 0xBF, 0xFC, 0xFF, 0xFF, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xCF, 0xF9, 0xA8, 0x86, 0x42, 0x01, 0x36,
+ 0x78, 0x8A, 0xBF, 0x9F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xB0, 0x00, 0x00,
+ },
+ {
+ 0xCF, 0xDB, 0xBA, 0x85, 0x10, 0x47, 0x89, 0x99, 0x99, 0x87, 0x66, 0x65,
+ 0x55, 0x55, 0x55, 0x56, 0x66, 0x77, 0x89, 0xAC, 0xCE, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xCF, 0xFF, 0xBF, 0xBB, 0xFF, 0x98, 0x63, 0x10, 0x24,
+ 0x59, 0x99, 0xBF, 0xFB, 0xBF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xCB, 0xBB, 0xAF, 0x97, 0x65, 0x20, 0x13,
+ 0x56, 0x78, 0x99, 0xAB, 0xFD, 0xAF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xCC, 0xBB, 0xAA, 0x97, 0x65, 0x30, 0x13,
+ 0x44, 0x56, 0x88, 0x89, 0xA9, 0xBF, 0xFF, 0xCF, 0xFC, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFD, 0xFF, 0xFA, 0xBA, 0xBA, 0xB9, 0x87, 0x65, 0x32, 0x11,
+ 0x23, 0x45, 0x56, 0x67, 0x77, 0x9A, 0xBA, 0xBF, 0xFF, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0x57, 0x78, 0x77, 0x66, 0x66, 0x55, 0x55, 0x44, 0x44, 0x43, 0x33, 0x23,
+ 0x33, 0x44, 0x45, 0x55, 0x56, 0x66, 0x66, 0x77, 0x78, 0x60, 0x00, 0x00,
+ },
+ },
+ {
+ {
+ 0x68, 0x87, 0x87, 0x77, 0x66, 0x55, 0x54, 0x44, 0x32, 0x22, 0x23, 0x44,
+ 0x45, 0x56, 0x66, 0x78, 0x88, 0x88, 0x88, 0x88, 0x88, 0x50, 0x00, 0x00,
+ },
+ {
+ 0x9A, 0xB9, 0xA9, 0xA8, 0x87, 0x76, 0x65, 0x54, 0x43, 0x21, 0x12, 0x45,
+ 0x68, 0x88, 0xAA, 0xDF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFC, 0xCF, 0xBA, 0x98, 0x77, 0x65, 0x31, 0x02, 0x56,
+ 0x89, 0xAC, 0xEF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xB9, 0x87, 0x76, 0x42, 0x01, 0x36,
+ 0x89, 0xAA, 0xBD, 0xFF, 0xDF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xBF, 0xFF, 0xEF, 0xBF, 0xAC, 0x99, 0x87, 0x42, 0x01, 0x35,
+ 0x79, 0xAA, 0xBB, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xCD, 0xCC, 0xB9, 0x74, 0x10, 0x46, 0x8A, 0xA9, 0x99, 0x98, 0x77, 0x66,
+ 0x66, 0x55, 0x55, 0x55, 0x66, 0x67, 0x89, 0x9A, 0xAB, 0xD0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xBB, 0xDA, 0xA8, 0x53, 0x10, 0x24,
+ 0x68, 0x9A, 0xAE, 0xFF, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFC, 0xFB, 0x98, 0x74, 0x10, 0x23,
+ 0x57, 0x89, 0xAB, 0xBC, 0xFF, 0xFF, 0xCF, 0xFF, 0xFF, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xBB, 0xBA, 0x98, 0x65, 0x20, 0x13,
+ 0x56, 0x78, 0x89, 0x9A, 0xAC, 0xEF, 0xFB, 0xFF, 0xDF, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xBB, 0x99, 0x86, 0x54, 0x21, 0x12,
+ 0x34, 0x45, 0x56, 0x67, 0x67, 0x99, 0xAB, 0xEB, 0xFF, 0xB0, 0x00, 0x00,
+ },
+ {
+ 0x57, 0x87, 0x77, 0x77, 0x66, 0x66, 0x65, 0x55, 0x44, 0x43, 0x32, 0x22,
+ 0x33, 0x44, 0x55, 0x56, 0x67, 0x77, 0x77, 0x88, 0x99, 0x70, 0x00, 0x00,
+ },
+ },
+ {
+ {
+ 0x78, 0x88, 0x88, 0x77, 0x76, 0x65, 0x54, 0x44, 0x33, 0x32, 0x12, 0x34,
+ 0x46, 0x78, 0x99, 0x9A, 0xBA, 0xAC, 0xAB, 0xCB, 0xAA, 0x90, 0x00, 0x00,
+ },
+ {
+ 0x9A, 0x98, 0x88, 0x98, 0x87, 0x77, 0x65, 0x54, 0x43, 0x21, 0x12, 0x45,
+ 0x67, 0x8B, 0xFF, 0xEF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xBD, 0xA9, 0x99, 0x87, 0x77, 0x55, 0x41, 0x02, 0x46,
+ 0x79, 0xAB, 0xFC, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFE, 0xFF, 0xFF, 0xDB, 0x9A, 0xBA, 0x98, 0x76, 0x42, 0x01, 0x36,
+ 0x79, 0xBB, 0xCB, 0xFC, 0xFF, 0xFC, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFE, 0xFF, 0xFA, 0x9A, 0xAA, 0x87, 0x42, 0x01, 0x35,
+ 0x78, 0xDA, 0xFF, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xBC, 0xCC, 0xA9, 0x74, 0x10, 0x36, 0x8A, 0xAA, 0xA9, 0x99, 0x88, 0x77,
+ 0x76, 0x66, 0x65, 0x66, 0x55, 0x66, 0x78, 0x88, 0xAB, 0xC0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xBF, 0xAA, 0x97, 0x63, 0x10, 0x24,
+ 0x67, 0x88, 0x9B, 0xFD, 0xFD, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFB, 0xFF, 0xFC, 0xBB, 0x97, 0x64, 0x10, 0x23,
+ 0x67, 0x88, 0xAA, 0xAB, 0xFF, 0xFF, 0xEF, 0xFF, 0xFF, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xCF, 0xFF, 0xBD, 0xA7, 0x64, 0x20, 0x14,
+ 0x55, 0x77, 0x78, 0x8A, 0xAA, 0xAB, 0xFD, 0xCC, 0xBF, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xEA, 0x76, 0x54, 0x21, 0x12,
+ 0x34, 0x45, 0x56, 0x67, 0x77, 0x8A, 0xAA, 0x99, 0xBA, 0x90, 0x00, 0x00,
+ },
+ {
+ 0x68, 0x88, 0x77, 0x66, 0x66, 0x55, 0x55, 0x55, 0x54, 0x43, 0x22, 0x23,
+ 0x34, 0x44, 0x44, 0x56, 0x77, 0x77, 0x78, 0x99, 0x99, 0x60, 0x00, 0x00,
+ },
+ },
+ {
+ {
+ 0x45, 0x56, 0x66, 0x65, 0x55, 0x54, 0x44, 0x44, 0x44, 0x42, 0x12, 0x35,
+ 0x68, 0x8E, 0x9A, 0xBC, 0xEB, 0xBB, 0xEB, 0xBB, 0xBE, 0xB0, 0x00, 0x00,
+ },
+ {
+ 0x87, 0x77, 0x76, 0x76, 0x66, 0x66, 0x55, 0x54, 0x43, 0x31, 0x12, 0x45,
+ 0x56, 0xA9, 0xEE, 0xDE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xE0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xAF, 0x98, 0x97, 0x78, 0x75, 0x55, 0x44, 0x32, 0x02, 0x45,
+ 0x68, 0x8E, 0x9C, 0xEF, 0xDF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFB, 0xBA, 0x98, 0x77, 0x65, 0x42, 0x01, 0x45,
+ 0x69, 0x9C, 0x9B, 0xDF, 0xBF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFB, 0xFF, 0xFF, 0xCA, 0xAA, 0xA8, 0x76, 0x52, 0x01, 0x35,
+ 0x67, 0x8A, 0xEA, 0xBF, 0xFF, 0xFF, 0xFE, 0xFF, 0xFF, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xA9, 0xAB, 0x98, 0x74, 0x10, 0x36, 0x89, 0x99, 0x99, 0x88, 0x87, 0x87,
+ 0x76, 0x66, 0x66, 0x55, 0x56, 0x67, 0x79, 0x9B, 0x9B, 0xB0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xB8, 0x88, 0x87, 0x54, 0x10, 0x24,
+ 0x56, 0x77, 0x89, 0xBF, 0xFF, 0xEC, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xDC, 0xFF, 0xFB, 0xDB, 0xB9, 0x86, 0x53, 0x20, 0x23,
+ 0x44, 0x56, 0x88, 0x78, 0xAA, 0xFF, 0xAB, 0xFF, 0xFF, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xAF, 0xBF, 0xFA, 0x97, 0x64, 0x20, 0x23,
+ 0x44, 0x55, 0x56, 0x67, 0x77, 0x89, 0x9B, 0xB9, 0xFF, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xD9, 0x75, 0x43, 0x21, 0x23,
+ 0x34, 0x44, 0x44, 0x55, 0x55, 0x66, 0x66, 0x78, 0x8A, 0x80, 0x00, 0x00,
+ },
+ {
+ 0x79, 0x89, 0x98, 0x88, 0x77, 0x77, 0x54, 0x44, 0x44, 0x43, 0x22, 0x33,
+ 0x33, 0x44, 0x45, 0x45, 0x66, 0x68, 0x77, 0x98, 0x88, 0x60, 0x00, 0x00,
+ },
+ },
+ {
+ {
+ 0x25, 0x45, 0x57, 0x45, 0x45, 0x55, 0x43, 0x33, 0x33, 0x33, 0x34, 0x44,
+ 0x55, 0xBB, 0xBB, 0x6B, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xB0, 0x00, 0x00,
+ },
+ {
+ 0x86, 0x76, 0x75, 0x55, 0x55, 0x65, 0x74, 0x44, 0x33, 0x32, 0x12, 0x35,
+ 0x6C, 0xCC, 0xCC, 0xCD, 0xDD, 0xCC, 0xCC, 0xCC, 0xCC, 0xD0, 0x00, 0x00,
+ },
+ {
+ 0xEE, 0xDE, 0xDD, 0x8E, 0x76, 0x55, 0x43, 0x44, 0x32, 0x32, 0x12, 0x46,
+ 0x87, 0x99, 0x9D, 0xDE, 0xEE, 0xEE, 0xDD, 0xDD, 0xDD, 0xE0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFE, 0xEF, 0xFF, 0xA9, 0x96, 0x55, 0x43, 0x32, 0x02, 0x45,
+ 0x88, 0xEE, 0xE9, 0xEF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFA, 0xAF, 0x89, 0x66, 0x42, 0x01, 0x36,
+ 0xD9, 0x8A, 0xFF, 0xEF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xAA, 0xEA, 0xF9, 0x74, 0x10, 0x35, 0x79, 0x98, 0x87, 0x66, 0x66, 0x55,
+ 0x56, 0x67, 0x77, 0x77, 0x88, 0x99, 0xAA, 0xFC, 0xEE, 0xB0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xEF, 0xFF, 0xFF, 0xE9, 0x97, 0xF7, 0x65, 0x20, 0x13,
+ 0x56, 0x79, 0xEA, 0xEF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xEE, 0xEE, 0xED, 0xDE, 0xEE, 0xED, 0xDD, 0xDE, 0x75, 0x63, 0x11, 0x22,
+ 0x34, 0x45, 0x67, 0x78, 0x9E, 0xEE, 0xEE, 0xEE, 0xEE, 0xE0, 0x00, 0x00,
+ },
+ {
+ 0xEE, 0xDE, 0xDD, 0xDE, 0xED, 0xD8, 0xDD, 0xDE, 0x87, 0x54, 0x20, 0x23,
+ 0x46, 0x46, 0x56, 0x67, 0x76, 0x79, 0x8E, 0xED, 0xED, 0xE0, 0x00, 0x00,
+ },
+ {
+ 0xEE, 0xDE, 0xDD, 0xDE, 0xDD, 0xDD, 0xDD, 0xD9, 0x98, 0x54, 0x32, 0x23,
+ 0x45, 0x44, 0x34, 0x43, 0x23, 0x66, 0x36, 0xD8, 0xDD, 0x90, 0x00, 0x00,
+ },
+ {
+ 0x7B, 0x7B, 0xA7, 0x77, 0x6A, 0x57, 0x56, 0x55, 0x45, 0x43, 0x33, 0x33,
+ 0x33, 0x33, 0x44, 0x43, 0x35, 0xBB, 0xBA, 0xAA, 0xB7, 0x50, 0x00, 0x00,
+ },
+ },
+ {
+ {
+ 0x24, 0xA3, 0x44, 0x44, 0xAA, 0x49, 0x34, 0x43, 0x24, 0x42, 0x35, 0xA9,
+ 0x99, 0x49, 0x99, 0x9A, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xA0, 0x00, 0x00,
+ },
+ {
+ 0x99, 0x39, 0x94, 0x94, 0x39, 0x43, 0x92, 0x33, 0x29, 0x22, 0x39, 0x99,
+ 0x99, 0x99, 0x88, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x90, 0x00, 0x00,
+ },
+ {
+ 0x99, 0x99, 0x99, 0x99, 0x49, 0x49, 0x33, 0x34, 0x33, 0x21, 0x23, 0x99,
+ 0x99, 0x99, 0x98, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x90, 0x00, 0x00,
+ },
+ {
+ 0xDC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xC6, 0x32, 0x21, 0x12, 0x45,
+ 0xC7, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xD0, 0x00, 0x00,
+ },
+ {
+ 0xED, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xD7, 0xDD, 0x75, 0x42, 0x01, 0x38,
+ 0xDD, 0x7D, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xE0, 0x00, 0x00,
+ },
+ {
+ 0xCC, 0x8C, 0x87, 0x64, 0x10, 0x37, 0x86, 0x66, 0x67, 0x69, 0x78, 0x77,
+ 0x76, 0x66, 0x66, 0x67, 0x68, 0x77, 0x88, 0xCC, 0xCC, 0xC0, 0x00, 0x00,
+ },
+ {
+ 0xBB, 0xAB, 0xAA, 0xAB, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xA4, 0x20, 0x22,
+ 0x44, 0xA5, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xBA, 0xB0, 0x00, 0x00,
+ },
+ {
+ 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0x4B, 0x33, 0x03,
+ 0x23, 0x46, 0x4B, 0x5B, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xB0, 0x00, 0x00,
+ },
+ {
+ 0xBB, 0xBB, 0xBB, 0xAB, 0xBB, 0xBB, 0xAA, 0xAB, 0xBB, 0xBB, 0xB2, 0x43,
+ 0x44, 0x32, 0x13, 0x46, 0x34, 0x35, 0xBB, 0xBB, 0xBB, 0xB0, 0x00, 0x00,
+ },
+ {
+ 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xA9, 0x9A, 0xAA, 0xAA, 0xA4, 0x23,
+ 0x32, 0xA5, 0x32, 0xA2, 0x24, 0xA3, 0xAA, 0x4A, 0xAA, 0xA0, 0x00, 0x00,
+ },
+ {
+ 0xA9, 0x59, 0x99, 0x99, 0x99, 0x54, 0x49, 0x45, 0x55, 0x45, 0x43, 0x39,
+ 0x52, 0x33, 0x43, 0x44, 0x25, 0x59, 0x59, 0x99, 0x59, 0xA0, 0x00, 0x00,
+ },
+ },
+ },
+ {
+ {
+ {
+ 0x58, 0x76, 0x5B, 0x53, 0x21, 0x25, 0x54, 0x43, 0x33, 0x48, 0x88, 0x56,
+ 0x67, 0x6B, 0x87, 0xBC, 0x7C, 0x8C, 0xCC, 0xCC, 0x8C, 0xB0, 0x00, 0x00,
+ },
+ {
+ 0xCC, 0xCC, 0x6C, 0x4C, 0xCC, 0x12, 0x12, 0x45, 0x53, 0x35, 0x7C, 0xCC,
+ 0xCC, 0xCC, 0xBB, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xC0, 0x00, 0x00,
+ },
+ {
+ 0xAA, 0xAA, 0xA4, 0xA1, 0x44, 0x55, 0xA9, 0x9A, 0xAA, 0xA2, 0x22, 0x24,
+ 0xA5, 0xA4, 0x49, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xA0, 0x00, 0x00,
+ },
+ {
+ 0x99, 0x88, 0x33, 0x88, 0x88, 0x88, 0x88, 0x28, 0x88, 0x88, 0x88, 0x21,
+ 0x33, 0x88, 0x83, 0x82, 0x88, 0x88, 0x88, 0x88, 0x89, 0x90, 0x00, 0x00,
+ },
+ {
+ 0x66, 0x56, 0x55, 0x56, 0x65, 0x55, 0x55, 0x56, 0x06, 0x65, 0x55, 0x55,
+ 0x55, 0x55, 0x55, 0x56, 0x66, 0x66, 0x66, 0x66, 0x66, 0x60, 0x00, 0x00,
+ },
+ {
+ 0xEE, 0x9D, 0xA6, 0x9D, 0xDA, 0xD9, 0x97, 0x55, 0x42, 0x64, 0x43, 0x32,
+ 0x24, 0x44, 0x33, 0x44, 0x66, 0x55, 0x58, 0x7D, 0xDD, 0xA0, 0x00, 0x00,
+ },
+ {
+ 0x88, 0x78, 0x77, 0x78, 0x77, 0x77, 0x77, 0x78, 0x82, 0x07, 0x77, 0x77,
+ 0x72, 0x27, 0x77, 0x78, 0x87, 0x77, 0x87, 0x88, 0x88, 0x80, 0x00, 0x00,
+ },
+ {
+ 0xBB, 0xAB, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0x44, 0x01, 0x3A, 0xAA,
+ 0x4A, 0x4A, 0x45, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xB0, 0x00, 0x00,
+ },
+ {
+ 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x89, 0x99, 0x92, 0x39, 0x21,
+ 0x49, 0x43, 0x33, 0x99, 0x34, 0x39, 0x99, 0x99, 0x99, 0x90, 0x00, 0x00,
+ },
+ {
+ 0xEE, 0xEE, 0xED, 0xDE, 0xEE, 0xED, 0xDD, 0xDE, 0xEE, 0xEE, 0x97, 0x75,
+ 0x55, 0x75, 0x20, 0x34, 0x63, 0x26, 0x8E, 0xEE, 0xEE, 0xE0, 0x00, 0x00,
+ },
+ {
+ 0x69, 0xB8, 0x77, 0x8B, 0x85, 0x56, 0x55, 0x44, 0x65, 0x44, 0x33, 0x32,
+ 0x23, 0x67, 0xA4, 0x74, 0x45, 0x44, 0x45, 0x68, 0x86, 0x70, 0x00, 0x00,
+ },
+ },
+ {
+ {
+ 0x67, 0x76, 0x66, 0x54, 0x43, 0x43, 0x33, 0x33, 0x33, 0x33, 0x44, 0x44,
+ 0x55, 0x66, 0x67, 0x67, 0x77, 0x77, 0x89, 0x89, 0x99, 0x60, 0x00, 0x00,
+ },
+ {
+ 0xA9, 0x99, 0x99, 0x66, 0x66, 0x43, 0x33, 0x22, 0x22, 0x33, 0x34, 0x57,
+ 0x78, 0xFF, 0xBF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xFE, 0xE9, 0xE9, 0x87, 0x65, 0x55, 0x44, 0x44, 0x32, 0x22, 0x22, 0x34,
+ 0x56, 0x79, 0x8E, 0xEA, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xEE, 0xDE, 0xDD, 0xD8, 0xDD, 0x75, 0x54, 0x54, 0x33, 0x44, 0x31, 0x13,
+ 0x45, 0x66, 0x88, 0x89, 0x8E, 0xDD, 0xDD, 0xDD, 0xED, 0xE0, 0x00, 0x00,
+ },
+ {
+ 0xCC, 0xBC, 0xBB, 0xBC, 0xCB, 0x75, 0x65, 0x45, 0x32, 0x24, 0x43, 0x12,
+ 0x46, 0x54, 0x77, 0xBC, 0xCC, 0xCC, 0xCB, 0xCB, 0xCB, 0xC0, 0x00, 0x00,
+ },
+ {
+ 0xA9, 0x8B, 0x97, 0x56, 0x88, 0x76, 0x77, 0x66, 0x55, 0x44, 0x33, 0x33,
+ 0x33, 0x33, 0x33, 0x33, 0x45, 0x56, 0x67, 0x8A, 0xCA, 0xC0, 0x00, 0x00,
+ },
+ {
+ 0xDD, 0xCD, 0xCC, 0xCD, 0xDC, 0xCC, 0x68, 0x55, 0x53, 0x21, 0x23, 0x33,
+ 0x33, 0x45, 0x77, 0x67, 0xDD, 0xDD, 0xDD, 0xDC, 0xDC, 0xD0, 0x00, 0x00,
+ },
+ {
+ 0xEE, 0xDE, 0xDD, 0xDE, 0xE9, 0x8D, 0xD8, 0x67, 0x44, 0x32, 0x22, 0x22,
+ 0x33, 0x44, 0x46, 0x87, 0xEE, 0xEE, 0xEE, 0xDD, 0xDD, 0xE0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xEF, 0xEE, 0xEF, 0xFE, 0xEE, 0xE9, 0x78, 0x67, 0x54, 0x43, 0x22,
+ 0x12, 0x35, 0x53, 0x55, 0x56, 0x7A, 0xFE, 0xEE, 0xFE, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xBA, 0xFB, 0x87, 0x66, 0x54, 0x33,
+ 0x33, 0x22, 0x22, 0x33, 0x46, 0x67, 0x7A, 0xCF, 0xCF, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0x67, 0x77, 0x77, 0x66, 0x66, 0x55, 0x55, 0x44, 0x43, 0x44, 0x33, 0x34,
+ 0x43, 0x44, 0x43, 0x44, 0x44, 0x55, 0x66, 0x76, 0x88, 0x70, 0x00, 0x00,
+ },
+ },
+ {
+ {
+ 0x78, 0x77, 0x76, 0x66, 0x55, 0x44, 0x44, 0x33, 0x33, 0x22, 0x33, 0x34,
+ 0x45, 0x67, 0x78, 0x88, 0x88, 0x99, 0x89, 0xA9, 0xA9, 0x70, 0x00, 0x00,
+ },
+ {
+ 0xA9, 0x9B, 0x99, 0x87, 0x77, 0x54, 0x44, 0x33, 0x22, 0x22, 0x23, 0x45,
+ 0x67, 0x9F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFD, 0xAA, 0x98, 0x87, 0x77, 0x65, 0x32, 0x11, 0x23, 0x44,
+ 0x57, 0x9A, 0xCE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFA, 0x88, 0x77, 0x65, 0x54, 0x31, 0x11, 0x35,
+ 0x57, 0x88, 0x8F, 0xDF, 0xFC, 0x9F, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xEF, 0xEE, 0xEF, 0xFE, 0x99, 0x87, 0x77, 0x54, 0x22, 0x11, 0x24,
+ 0x66, 0x77, 0x78, 0xEA, 0xF9, 0xFF, 0xEE, 0xEE, 0xFE, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xAB, 0xAA, 0x97, 0x65, 0x44, 0x45, 0x66, 0x65, 0x54, 0x44, 0x43, 0x33,
+ 0x33, 0x33, 0x33, 0x44, 0x55, 0x66, 0x78, 0x8B, 0xAB, 0xB0, 0x00, 0x00,
+ },
+ {
+ 0xEE, 0xDE, 0xED, 0xDE, 0x98, 0x8D, 0xDD, 0x67, 0x66, 0x43, 0x11, 0x22,
+ 0x34, 0x57, 0x77, 0x8E, 0xEE, 0xEE, 0xEE, 0xED, 0xDD, 0xE0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xEF, 0xFB, 0xFF, 0xBB, 0x98, 0x66, 0x54, 0x31, 0x11,
+ 0x34, 0x56, 0x98, 0xBF, 0xDC, 0xBF, 0xBF, 0xFF, 0xFF, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xCB, 0xAA, 0x88, 0x66, 0x32, 0x11,
+ 0x23, 0x35, 0x66, 0x77, 0x99, 0xCE, 0xFE, 0xCD, 0xFF, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xCA, 0xA9, 0x76, 0x54, 0x42, 0x22,
+ 0x22, 0x33, 0x34, 0x55, 0x56, 0x77, 0x9B, 0xBF, 0xFF, 0xC0, 0x00, 0x00,
+ },
+ {
+ 0x69, 0x88, 0x77, 0x77, 0x76, 0x65, 0x55, 0x44, 0x43, 0x43, 0x33, 0x33,
+ 0x33, 0x34, 0x44, 0x44, 0x55, 0x67, 0x77, 0x88, 0x89, 0x70, 0x00, 0x00,
+ },
+ },
+ {
+ {
+ 0x79, 0x98, 0x87, 0x77, 0x66, 0x55, 0x44, 0x43, 0x33, 0x22, 0x23, 0x33,
+ 0x45, 0x66, 0x77, 0x88, 0x89, 0x99, 0x9A, 0xA9, 0x99, 0x70, 0x00, 0x00,
+ },
+ {
+ 0xBB, 0xFB, 0xBA, 0xA9, 0x98, 0x76, 0x65, 0x44, 0x32, 0x21, 0x22, 0x35,
+ 0x79, 0xAE, 0xCC, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xCF, 0xFA, 0xAA, 0x99, 0x88, 0x77, 0x65, 0x33, 0x21, 0x12, 0x44,
+ 0x57, 0x89, 0xAB, 0xBE, 0xCF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xBF, 0xDB, 0xA9, 0x99, 0x86, 0x65, 0x41, 0x02, 0x45,
+ 0x78, 0x89, 0xCA, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xAB, 0xA9, 0x98, 0x76, 0x52, 0x01, 0x35,
+ 0x68, 0x89, 0x9E, 0xEF, 0xBF, 0xFF, 0xFF, 0xFF, 0xFF, 0xC0, 0x00, 0x00,
+ },
+ {
+ 0xDB, 0xCA, 0x98, 0x75, 0x21, 0x46, 0x77, 0x76, 0x66, 0x54, 0x44, 0x44,
+ 0x33, 0x34, 0x44, 0x45, 0x66, 0x77, 0x89, 0xAC, 0xCB, 0xD0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xBB, 0x98, 0x77, 0x65, 0x10, 0x23,
+ 0x56, 0x89, 0xAA, 0xFF, 0xFC, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFC, 0xBB, 0xCA, 0x87, 0x65, 0x30, 0x12,
+ 0x56, 0x78, 0xA9, 0xBA, 0xFD, 0xCF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xED, 0xAA, 0xA9, 0x97, 0x64, 0x31, 0x12,
+ 0x23, 0x45, 0x56, 0x78, 0xA9, 0xAC, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xFC, 0xCB, 0xA8, 0x65, 0x54, 0x32, 0x12,
+ 0x23, 0x34, 0x45, 0x56, 0x77, 0x88, 0xAC, 0xDF, 0xDF, 0xE0, 0x00, 0x00,
+ },
+ {
+ 0x68, 0x98, 0x88, 0x77, 0x77, 0x66, 0x55, 0x54, 0x44, 0x43, 0x32, 0x22,
+ 0x33, 0x44, 0x55, 0x56, 0x66, 0x77, 0x78, 0x89, 0x99, 0x70, 0x00, 0x00,
+ },
+ },
+ {
+ {
+ 0x8A, 0xA9, 0x88, 0x87, 0x66, 0x65, 0x54, 0x43, 0x33, 0x22, 0x23, 0x33,
+ 0x45, 0x55, 0x67, 0x78, 0x88, 0x88, 0x88, 0x99, 0x99, 0x60, 0x00, 0x00,
+ },
+ {
+ 0xCF, 0xBF, 0xCA, 0xAA, 0x98, 0x87, 0x76, 0x54, 0x33, 0x21, 0x12, 0x45,
+ 0x78, 0x8A, 0xBF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xEF, 0xBE, 0xBA, 0x99, 0x77, 0x65, 0x31, 0x02, 0x56,
+ 0x89, 0x9B, 0xBC, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFC, 0xBB, 0x97, 0x76, 0x32, 0x01, 0x46,
+ 0x88, 0x9B, 0xAB, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFD, 0xFC, 0xA8, 0x97, 0x42, 0x01, 0x35,
+ 0x78, 0x9A, 0xBC, 0xDF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xDC, 0xCB, 0xB9, 0x75, 0x10, 0x47, 0x89, 0x89, 0x88, 0x76, 0x66, 0x55,
+ 0x55, 0x55, 0x55, 0x66, 0x77, 0x78, 0x9A, 0xAC, 0xFE, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFB, 0xCA, 0xA9, 0x87, 0x63, 0x10, 0x24,
+ 0x67, 0x8A, 0xCA, 0xFF, 0xFE, 0xCF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFD, 0xAA, 0x98, 0x74, 0x20, 0x13,
+ 0x57, 0x8A, 0x9E, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xBC, 0xA9, 0x87, 0x65, 0x30, 0x13,
+ 0x44, 0x56, 0x78, 0x9A, 0xBE, 0xEF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xBB, 0x98, 0x65, 0x54, 0x31, 0x12,
+ 0x33, 0x44, 0x55, 0x67, 0x78, 0x9A, 0xAC, 0xFC, 0xFF, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0x68, 0x88, 0x87, 0x77, 0x77, 0x76, 0x55, 0x54, 0x44, 0x43, 0x32, 0x22,
+ 0x33, 0x44, 0x45, 0x56, 0x67, 0x78, 0x89, 0x9A, 0xBB, 0x90, 0x00, 0x00,
+ },
+ },
+ {
+ {
+ 0x8A, 0x99, 0x88, 0x77, 0x76, 0x66, 0x55, 0x43, 0x33, 0x22, 0x22, 0x33,
+ 0x45, 0x67, 0x77, 0x88, 0x88, 0x99, 0xAA, 0x9A, 0xAA, 0x80, 0x00, 0x00,
+ },
+ {
+ 0xBC, 0xAA, 0xAB, 0xA9, 0x98, 0x87, 0x66, 0x54, 0x33, 0x21, 0x12, 0x45,
+ 0x89, 0xCF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xEF, 0xFC, 0xCC, 0xBA, 0x98, 0x87, 0x65, 0x31, 0x02, 0x56,
+ 0x79, 0xBB, 0xEF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xDF, 0xFF, 0xFD, 0xBA, 0x98, 0x76, 0x42, 0x01, 0x36,
+ 0x78, 0x9A, 0xFB, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFA, 0xBB, 0xA9, 0x87, 0x42, 0x01, 0x35,
+ 0x78, 0xAB, 0xFB, 0xCF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xDD, 0xEC, 0xC9, 0x74, 0x10, 0x47, 0x89, 0x99, 0x99, 0x87, 0x76, 0x66,
+ 0x55, 0x55, 0x55, 0x56, 0x67, 0x78, 0x89, 0xBC, 0xCD, 0xE0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xDA, 0x98, 0x63, 0x10, 0x24,
+ 0x58, 0x9A, 0xBF, 0xEF, 0xFF, 0xBF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xDB, 0x97, 0x74, 0x10, 0x23,
+ 0x57, 0x9A, 0xAB, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xCA, 0xA8, 0x65, 0x20, 0x13,
+ 0x56, 0x77, 0x89, 0x9B, 0xCE, 0xCF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xCB, 0x9A, 0xAA, 0x76, 0x54, 0x21, 0x12,
+ 0x34, 0x45, 0x56, 0x66, 0x78, 0x99, 0xAF, 0xEC, 0xEF, 0xB0, 0x00, 0x00,
+ },
+ {
+ 0x78, 0x88, 0x87, 0x77, 0x66, 0x66, 0x65, 0x55, 0x54, 0x43, 0x22, 0x22,
+ 0x33, 0x44, 0x55, 0x67, 0x77, 0x88, 0x98, 0x99, 0xAA, 0x80, 0x00, 0x00,
+ },
+ },
+ {
+ {
+ 0x67, 0x77, 0x86, 0x66, 0x66, 0x65, 0x54, 0x44, 0x33, 0x32, 0x12, 0x34,
+ 0x57, 0x99, 0xAC, 0x9A, 0xAC, 0xFB, 0xCF, 0xEE, 0xEB, 0xA0, 0x00, 0x00,
+ },
+ {
+ 0xAA, 0x99, 0x88, 0x87, 0x77, 0x77, 0x66, 0x55, 0x43, 0x21, 0x12, 0x35,
+ 0x8A, 0xFB, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFA, 0xDA, 0x99, 0x98, 0x77, 0x76, 0x65, 0x53, 0x32, 0x02, 0x45,
+ 0x67, 0x9A, 0xCF, 0xDF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xCF, 0xFB, 0xBB, 0xE9, 0x87, 0x76, 0x42, 0x01, 0x36,
+ 0x89, 0xBB, 0xBF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xAA, 0xA9, 0x76, 0x52, 0x01, 0x35,
+ 0x67, 0x8A, 0x9A, 0xC9, 0xFF, 0xFE, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xEC, 0xCC, 0xA9, 0x74, 0x10, 0x37, 0x88, 0x89, 0x99, 0x88, 0x87, 0x76,
+ 0x66, 0x55, 0x55, 0x56, 0x77, 0x78, 0xAA, 0xFE, 0xFF, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xED, 0xBA, 0x87, 0x64, 0x10, 0x24,
+ 0x46, 0x77, 0xAB, 0xFF, 0xFF, 0xFF, 0xEF, 0xFF, 0xFF, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xCF, 0xFF, 0x88, 0x64, 0x10, 0x24,
+ 0x46, 0x78, 0x88, 0xAA, 0xBF, 0xCC, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xDC, 0xA7, 0x65, 0x20, 0x14,
+ 0x55, 0x57, 0x77, 0x88, 0x9A, 0xAA, 0xBB, 0xFF, 0xFF, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFC, 0xF9, 0x97, 0x76, 0x53, 0x21, 0x13,
+ 0x34, 0x45, 0x55, 0x66, 0x66, 0x77, 0x88, 0xAA, 0xDC, 0xA0, 0x00, 0x00,
+ },
+ {
+ 0x9D, 0xAC, 0xBA, 0x98, 0x88, 0x77, 0x65, 0x54, 0x54, 0x43, 0x21, 0x23,
+ 0x34, 0x45, 0x55, 0x66, 0x67, 0x79, 0x99, 0x9D, 0xBB, 0x80, 0x00, 0x00,
+ },
+ },
+ {
+ {
+ 0x47, 0x7C, 0x65, 0x45, 0x45, 0x45, 0x45, 0x33, 0x43, 0x22, 0x23, 0x44,
+ 0x57, 0x77, 0xCC, 0xB8, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xC0, 0x00, 0x00,
+ },
+ {
+ 0x89, 0x88, 0x67, 0x68, 0x67, 0x76, 0x55, 0x55, 0x43, 0x21, 0x12, 0x46,
+ 0x8E, 0xEA, 0xEE, 0xEF, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xEE, 0xDE, 0xD9, 0xD8, 0x87, 0x66, 0x64, 0x55, 0x44, 0x42, 0x02, 0x45,
+ 0x67, 0x8D, 0xDD, 0xDE, 0xEE, 0xEE, 0xEE, 0xED, 0xDD, 0xE0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFA, 0xFF, 0xCF, 0xB7, 0x98, 0x66, 0x54, 0x42, 0x01, 0x57,
+ 0x89, 0xFA, 0xFF, 0xEF, 0xFB, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFD, 0xAA, 0x88, 0x76, 0x42, 0x01, 0x36,
+ 0x78, 0xFF, 0xFF, 0xEA, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xBC, 0xAA, 0xB8, 0x75, 0x10, 0x35, 0x78, 0x88, 0x87, 0x66, 0x66, 0x55,
+ 0x55, 0x66, 0x77, 0x77, 0x88, 0x99, 0x9A, 0xDB, 0xBB, 0xD0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xEF, 0xFF, 0xFF, 0xFD, 0x99, 0x87, 0x65, 0x10, 0x23,
+ 0x56, 0x78, 0x9E, 0xAF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xEF, 0xFE, 0xEF, 0xFF, 0xEE, 0xE9, 0xE8, 0x65, 0x54, 0x20, 0x23,
+ 0x34, 0x67, 0x7A, 0x99, 0x9F, 0xF9, 0xFF, 0xFE, 0xFE, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xEF, 0xEE, 0xEF, 0xFE, 0xEE, 0xE9, 0xEF, 0x87, 0x53, 0x20, 0x23,
+ 0x55, 0x55, 0x56, 0x68, 0x98, 0x8A, 0x9F, 0xFE, 0xFE, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFA, 0x8A, 0x77, 0x54, 0x31, 0x23,
+ 0x44, 0x34, 0x44, 0x44, 0x43, 0x45, 0x57, 0xFA, 0xFB, 0xF0, 0x00, 0x00,
+ },
+ {
+ 0x7C, 0xB7, 0x8B, 0x76, 0x76, 0x66, 0x55, 0x54, 0x44, 0x43, 0x33, 0x32,
+ 0x33, 0x44, 0x54, 0x44, 0x44, 0x57, 0x98, 0x87, 0xCB, 0x50, 0x00, 0x00,
+ },
+ },
+ {
+ {
+ 0x46, 0xAB, 0x6A, 0x6B, 0x65, 0x54, 0x54, 0x32, 0x22, 0x32, 0x43, 0x44,
+ 0xA4, 0x6A, 0xAA, 0xAB, 0xBB, 0xBB, 0xBB, 0xAA, 0xAA, 0xB0, 0x00, 0x00,
+ },
+ {
+ 0x67, 0x66, 0x6B, 0x6C, 0x56, 0xB5, 0x55, 0x34, 0x32, 0x21, 0x23, 0x64,
+ 0xBB, 0xBB, 0xBB, 0xBC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCB, 0xC0, 0x00, 0x00,
+ },
+ {
+ 0xCC, 0xCC, 0xCC, 0xBC, 0x76, 0x57, 0x55, 0x54, 0x43, 0x21, 0x12, 0x46,
+ 0x7C, 0xBB, 0xBB, 0xBC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xC0, 0x00, 0x00,
+ },
+ {
+ 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0x77, 0x43, 0x22, 0x02, 0x57,
+ 0x8D, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xD0, 0x00, 0x00,
+ },
+ {
+ 0xDD, 0xCD, 0xCC, 0xCD, 0xCC, 0xCC, 0xCC, 0xCC, 0x65, 0x42, 0x01, 0x3C,
+ 0x7C, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xDC, 0xD0, 0x00, 0x00,
+ },
+ {
+ 0xEE, 0x8E, 0xD9, 0x75, 0x10, 0x35, 0x77, 0x66, 0x68, 0x77, 0x66, 0x65,
+ 0x66, 0x65, 0x66, 0x68, 0x88, 0xEE, 0xAE, 0xED, 0xDD, 0xE0, 0x00, 0x00,
+ },
+ {
+ 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xD8, 0xDD, 0x55, 0x20, 0x14,
+ 0x56, 0x4D, 0x7D, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xD0, 0x00, 0x00,
+ },
+ {
+ 0xCC, 0xCC, 0xCC, 0xBC, 0xCC, 0xCC, 0xCB, 0xBC, 0xC7, 0x63, 0x20, 0x23,
+ 0x44, 0x55, 0x76, 0x7C, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xC0, 0x00, 0x00,
+ },
+ {
+ 0xBB, 0xBB, 0xBA, 0xAB, 0xBB, 0xBA, 0xAA, 0xAB, 0xB5, 0xB6, 0x31, 0x22,
+ 0x34, 0x43, 0x34, 0x54, 0x45, 0x4B, 0xBB, 0xBB, 0xBB, 0xB0, 0x00, 0x00,
+ },
+ {
+ 0xCC, 0xBC, 0xCB, 0xBC, 0xCB, 0xBB, 0xBB, 0xB7, 0x66, 0x55, 0x42, 0x22,
+ 0x23, 0x34, 0x43, 0x35, 0x54, 0x55, 0x6C, 0xCB, 0xCB, 0xC0, 0x00, 0x00,
+ },
+ {
+ 0xCB, 0xBB, 0x6B, 0xB7, 0xBB, 0x6B, 0x65, 0x55, 0x34, 0x33, 0x43, 0x32,
+ 0x23, 0x34, 0x55, 0x44, 0x46, 0xBB, 0xBB, 0xB6, 0xBB, 0xC0, 0x00, 0x00,
+ },
+ },
+ {
+ {
+ 0x88, 0x78, 0x71, 0x78, 0x77, 0x77, 0x77, 0x78, 0x27, 0x71, 0x77, 0x17,
+ 0x77, 0x77, 0x77, 0x78, 0x88, 0x77, 0x88, 0x87, 0x88, 0x80, 0x00, 0x00,
+ },
+ {
+ 0x99, 0x89, 0x88, 0x89, 0x88, 0x82, 0x88, 0x83, 0x83, 0x12, 0x22, 0x38,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x98, 0x90, 0x00, 0x00,
+ },
+ {
+ 0x99, 0x89, 0x88, 0x89, 0x88, 0x88, 0x38, 0x89, 0x22, 0x11, 0x28, 0x88,
+ 0x88, 0x88, 0x88, 0x89, 0x98, 0x88, 0x88, 0x98, 0x98, 0x90, 0x00, 0x00,
+ },
+ {
+ 0xAA, 0x9A, 0x99, 0x9A, 0x39, 0x99, 0x99, 0x33, 0x99, 0x42, 0x02, 0x99,
+ 0x99, 0x99, 0x99, 0x9A, 0xA9, 0x99, 0x99, 0x99, 0xA9, 0xA0, 0x00, 0x00,
+ },
+ {
+ 0xAA, 0x9A, 0x99, 0x9A, 0x99, 0x99, 0x99, 0x9A, 0xA9, 0x92, 0x01, 0x34,
+ 0x99, 0x99, 0x99, 0x9A, 0xA9, 0x99, 0x9A, 0xA9, 0xA9, 0xA0, 0x00, 0x00,
+ },
+ {
+ 0xAA, 0xAA, 0xAA, 0xAA, 0x30, 0x4A, 0xAA, 0x9A, 0xAA, 0xA4, 0x43, 0x43,
+ 0x35, 0x4A, 0x3A, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xA0, 0x00, 0x00,
+ },
+ {
+ 0xAA, 0x9A, 0x99, 0x9A, 0x99, 0x99, 0x99, 0x9A, 0x99, 0x93, 0x11, 0x13,
+ 0x34, 0x99, 0x99, 0x9A, 0x99, 0x99, 0x99, 0x99, 0xA9, 0xA0, 0x00, 0x00,
+ },
+ {
+ 0x99, 0x89, 0x88, 0x89, 0x88, 0x88, 0x88, 0x89, 0x88, 0x88, 0x31, 0x12,
+ 0x88, 0x18, 0x88, 0x89, 0x98, 0x88, 0x89, 0x99, 0x98, 0x90, 0x00, 0x00,
+ },
+ {
+ 0x88, 0x78, 0x77, 0x78, 0x77, 0x77, 0x77, 0x78, 0x77, 0x77, 0x71, 0x11,
+ 0x72, 0x77, 0x77, 0x78, 0x87, 0x77, 0x88, 0x88, 0x88, 0x80, 0x00, 0x00,
+ },
+ {
+ 0xAA, 0x9A, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x39, 0x92, 0x21,
+ 0x19, 0x39, 0x99, 0x94, 0x93, 0x99, 0x99, 0x99, 0xAA, 0xA0, 0x00, 0x00,
+ },
+ {
+ 0x88, 0x78, 0x77, 0x78, 0x77, 0x77, 0x77, 0x78, 0x77, 0x72, 0x77, 0x72,
+ 0x17, 0x27, 0x77, 0x78, 0x87, 0x71, 0x78, 0x87, 0x88, 0x80, 0x00, 0x00,
+ },
+ },
+ },
+};
+
+static const uint8_t short_codes_def[3][15][88] = {
+ {
+ {
+ 0xDF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFD, 0xCF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xDD, 0xFC, 0xCD, 0xFF, 0xFF, 0xFF, 0xCC, 0xCB, 0xBC,
+ 0xDF, 0xFF, 0xFD, 0xDB, 0xC9, 0x69, 0xBC, 0xFF, 0xFC, 0xFF, 0xB9, 0x42,
+ 0x5A, 0xCD, 0xFF, 0xFD, 0xDC, 0x62, 0x03, 0x9B, 0xCF, 0xFF, 0xFD, 0xC9,
+ 0x53, 0x4A, 0xCC, 0xFF, 0xFF, 0xFF, 0xBA, 0x9A, 0xBC, 0xFF, 0xFF, 0xFC,
+ 0xDC, 0xBC, 0xBC, 0xFF, 0xFF, 0xFF, 0xFE, 0xCC, 0xCD, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFD, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xF0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xDF, 0xFD, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFD, 0xCD, 0xFF,
+ 0xFF, 0xFF, 0xFC, 0xFC, 0xCC, 0xCF, 0xDF, 0xFF, 0xFF, 0xDB, 0xA9, 0x9B,
+ 0xCF, 0xDF, 0xFF, 0xCB, 0x97, 0x67, 0x9B, 0xFF, 0xFF, 0xDC, 0xA7, 0x42,
+ 0x47, 0xAD, 0xFF, 0xFF, 0xC9, 0x63, 0x03, 0x69, 0xBF, 0xFF, 0xFC, 0xA7,
+ 0x53, 0x47, 0xAC, 0xDF, 0xFD, 0xDC, 0x97, 0x77, 0x8C, 0xBD, 0xFF, 0xFF,
+ 0xCC, 0xAA, 0xAB, 0xCF, 0xFF, 0xFF, 0xFF, 0xCC, 0xCC, 0xCF, 0xFF, 0xFF,
+ 0xFF, 0xFE, 0xFF, 0xEF, 0xFF, 0xFF, 0xFF, 0xFD, 0xFF, 0xDC, 0xFF, 0xDF,
+ 0xF0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xB9, 0xAF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0x96, 0x56, 0x9F, 0xFF, 0xFF, 0xFF, 0xA6, 0x43,
+ 0x47, 0xEF, 0xFF, 0xFF, 0xF9, 0x53, 0x03, 0x6A, 0xFF, 0xFF, 0xFF, 0xA6,
+ 0x43, 0x46, 0xAF, 0xFF, 0xFF, 0xFF, 0x96, 0x56, 0x9F, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xC9, 0xEF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xF0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xEF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFD, 0xDD, 0xFF, 0xFF, 0xFD, 0xFF, 0xFD, 0xFD, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xDD, 0xDB, 0xBC, 0xDF, 0xFF, 0xFF, 0xFF, 0xFA, 0x43,
+ 0x6B, 0xFF, 0xDF, 0xFF, 0xFD, 0xA3, 0x02, 0xAD, 0xFF, 0xFF, 0xFD, 0xFB,
+ 0x52, 0x3A, 0xDF, 0xFF, 0xFF, 0xFF, 0xCB, 0xAA, 0xCE, 0xFF, 0xDF, 0xFF,
+ 0xFE, 0xDD, 0xDF, 0xFF, 0xFF, 0xFF, 0xFF, 0xED, 0xFD, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xDF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xF0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xCF, 0xCC, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xBF, 0xFF, 0xCC, 0xCA,
+ 0xFF, 0xCF, 0xFB, 0xAA, 0xAA, 0xCF, 0xCB, 0xFC, 0xFF, 0xAA, 0xA9, 0x99,
+ 0xAC, 0xBF, 0xFC, 0xA9, 0x98, 0x88, 0x99, 0xAA, 0xCF, 0xCA, 0xA8, 0x53,
+ 0x58, 0x9F, 0xCC, 0xCC, 0xB9, 0x73, 0x02, 0x68, 0xAC, 0xCF, 0xCA, 0x98,
+ 0x53, 0x37, 0x9B, 0xAC, 0xFB, 0xAA, 0x97, 0x78, 0x8A, 0xFB, 0xFF, 0xFA,
+ 0xBB, 0x99, 0x9A, 0xAB, 0xFF, 0xFF, 0xEB, 0xBA, 0xAA, 0xAC, 0xCB, 0xFF,
+ 0xBF, 0xBC, 0xBC, 0xCF, 0xFF, 0xFF, 0xCF, 0xFC, 0xFC, 0xFF, 0xFF, 0xCF,
+ 0xA0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xAF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xFD, 0xFC, 0xFF,
+ 0xFF, 0xFF, 0xFC, 0xAB, 0xBA, 0xFC, 0xFF, 0xFF, 0xFF, 0xA9, 0x77, 0x78,
+ 0xAF, 0xFF, 0xFF, 0xA8, 0x65, 0x45, 0x68, 0xFF, 0xFC, 0xFB, 0x74, 0x33,
+ 0x35, 0x7B, 0xFF, 0xFF, 0xB7, 0x43, 0x23, 0x46, 0xAF, 0xFF, 0xCB, 0x75,
+ 0x33, 0x35, 0x7A, 0xCC, 0xFF, 0xF8, 0x65, 0x45, 0x68, 0xAC, 0xCF, 0xCC,
+ 0xA8, 0x77, 0x78, 0xBF, 0xFF, 0xFF, 0xFF, 0xB9, 0x99, 0xFC, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xF0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xDA, 0xFC, 0xFF,
+ 0xFF, 0xFC, 0xFB, 0x9A, 0x99, 0xBA, 0xFF, 0xFF, 0xFB, 0x97, 0x77, 0x77,
+ 0x9C, 0xCF, 0xFC, 0x98, 0x65, 0x45, 0x68, 0xAF, 0xFF, 0xC9, 0x75, 0x33,
+ 0x35, 0x79, 0xFF, 0xFB, 0x86, 0x43, 0x23, 0x47, 0x9F, 0xFF, 0xC9, 0x75,
+ 0x33, 0x35, 0x7B, 0xBF, 0xFF, 0xA8, 0x65, 0x45, 0x68, 0xAF, 0xFF, 0xFA,
+ 0xA8, 0x77, 0x78, 0x9B, 0xFF, 0xFF, 0xFF, 0xFB, 0x99, 0xBB, 0xFF, 0xFF,
+ 0xFF, 0xFE, 0xCE, 0xFF, 0xCF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xF0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFD, 0xDE, 0xFF, 0xFF, 0xFF, 0xFF, 0xDC, 0xBB, 0xBC, 0xEF,
+ 0xFF, 0xFF, 0xDB, 0x99, 0x89, 0xAC, 0xDF, 0xFF, 0xDB, 0x97, 0x66, 0x67,
+ 0x9C, 0xFF, 0xEC, 0x97, 0x65, 0x45, 0x67, 0xAC, 0xFF, 0xB9, 0x65, 0x33,
+ 0x35, 0x69, 0xBF, 0xFB, 0x86, 0x43, 0x33, 0x46, 0x9B, 0xEE, 0xB9, 0x65,
+ 0x33, 0x35, 0x69, 0xBE, 0xFD, 0xA7, 0x65, 0x45, 0x67, 0xAC, 0xDF, 0xDB,
+ 0x97, 0x66, 0x67, 0x9B, 0xDF, 0xFF, 0xDC, 0xA9, 0x89, 0x9B, 0xCF, 0xFF,
+ 0xFF, 0xDC, 0xBB, 0xBC, 0xDE, 0xFF, 0xFF, 0xFF, 0xFF, 0xEF, 0xEF, 0xFF,
+ 0xF0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFC, 0xFF, 0xFF, 0xFF, 0xFF, 0xFB, 0xBB, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xAA, 0x99, 0xAB, 0xFF, 0xFF, 0xFA, 0x98, 0x76, 0x67,
+ 0xAC, 0xCF, 0xFA, 0xA7, 0x64, 0x45, 0x67, 0x9B, 0xFF, 0xF8, 0x74, 0x33,
+ 0x34, 0x68, 0xAF, 0xFB, 0x96, 0x43, 0x33, 0x46, 0x8B, 0xFF, 0xF9, 0x75,
+ 0x43, 0x35, 0x69, 0xBF, 0xCC, 0x98, 0x65, 0x45, 0x67, 0x9A, 0xBF, 0xFF,
+ 0x98, 0x66, 0x68, 0x8F, 0xFF, 0xFF, 0xFF, 0x98, 0x88, 0xAF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xBA, 0xBA, 0xBE, 0xFF, 0xFF, 0xFF, 0xDF, 0xFF, 0xFF, 0xFF,
+ 0xC0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFA, 0xFF,
+ 0xFF, 0xAA, 0xFF, 0xF9, 0xAF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFA, 0x88, 0x7F,
+ 0xAF, 0xFA, 0xFF, 0xF8, 0x75, 0x55, 0x79, 0xFF, 0xFF, 0xF9, 0x75, 0x32,
+ 0x34, 0x8A, 0xFF, 0xFF, 0xB8, 0x43, 0x22, 0x58, 0xFF, 0xFF, 0xCF, 0x95,
+ 0x33, 0x46, 0x7A, 0xFF, 0xFA, 0xFF, 0x75, 0x46, 0x79, 0xFA, 0xFF, 0xAF,
+ 0xF9, 0x89, 0x8A, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0xAF, 0xAA, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFA, 0xFF, 0xFF, 0xFF, 0xAF, 0xFF, 0xFF, 0xFA, 0xFF, 0xFA,
+ 0x90, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xBC, 0xBA, 0xAA, 0x99, 0xAA, 0xBD, 0xBB, 0xBA, 0x99, 0x88, 0x89, 0x9B,
+ 0xCC, 0xBA, 0x98, 0x77, 0x77, 0x78, 0x9A, 0xBA, 0x98, 0x76, 0x65, 0x66,
+ 0x78, 0xAB, 0xA8, 0x76, 0x55, 0x45, 0x56, 0x79, 0xA9, 0x87, 0x55, 0x44,
+ 0x44, 0x67, 0x8A, 0x98, 0x75, 0x44, 0x44, 0x45, 0x68, 0x9A, 0x87, 0x65,
+ 0x44, 0x45, 0x67, 0x8A, 0xA9, 0x76, 0x55, 0x45, 0x56, 0x79, 0xAB, 0x98,
+ 0x76, 0x55, 0x56, 0x78, 0x9A, 0xBA, 0x98, 0x77, 0x77, 0x78, 0x9A, 0xCD,
+ 0xCB, 0xA9, 0x88, 0x89, 0xAA, 0xBB, 0xDD, 0xCA, 0xA9, 0x9A, 0xAB, 0xCC,
+ 0xB0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xBD, 0xCA, 0xAA, 0xAA, 0xAB, 0xCE, 0xDC, 0xCB, 0xA9, 0x88, 0x89, 0x9B,
+ 0xCD, 0xBB, 0x98, 0x87, 0x77, 0x78, 0xAB, 0xDA, 0xA8, 0x76, 0x65, 0x66,
+ 0x78, 0xAC, 0xA9, 0x76, 0x55, 0x44, 0x56, 0x79, 0xAA, 0x97, 0x65, 0x44,
+ 0x44, 0x67, 0x9A, 0xA8, 0x75, 0x44, 0x34, 0x45, 0x79, 0x9A, 0x87, 0x65,
+ 0x44, 0x45, 0x67, 0x9A, 0xB9, 0x76, 0x55, 0x45, 0x56, 0x79, 0xAB, 0xA8,
+ 0x76, 0x65, 0x66, 0x78, 0xBB, 0xCB, 0xA8, 0x77, 0x77, 0x78, 0xAB, 0xBD,
+ 0xCB, 0xA9, 0x98, 0x99, 0xAA, 0xCD, 0xFD, 0xFB, 0xAA, 0xAB, 0xAB, 0xCC,
+ 0xC0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xCD, 0xCB, 0xAA, 0xAA, 0xAB, 0xCE, 0xED, 0xCB, 0xA9, 0x88, 0x89, 0xAB,
+ 0xCE, 0xCB, 0x98, 0x77, 0x77, 0x78, 0x9B, 0xCB, 0xA8, 0x76, 0x65, 0x56,
+ 0x78, 0xAB, 0xA9, 0x76, 0x55, 0x45, 0x56, 0x79, 0xBA, 0x87, 0x55, 0x44,
+ 0x45, 0x57, 0x8A, 0xA8, 0x75, 0x44, 0x34, 0x45, 0x78, 0xAA, 0x87, 0x65,
+ 0x44, 0x45, 0x67, 0x8A, 0xA9, 0x76, 0x55, 0x45, 0x56, 0x79, 0xAB, 0xA8,
+ 0x76, 0x65, 0x66, 0x78, 0xAB, 0xCB, 0x98, 0x77, 0x77, 0x78, 0x9B, 0xCD,
+ 0xCB, 0xA9, 0x88, 0x89, 0xAB, 0xCD, 0xED, 0xCB, 0xAA, 0xAA, 0xAB, 0xCD,
+ 0xC0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xCD, 0xCB, 0xB9, 0xAA, 0xBB, 0xFF, 0xDD, 0xCB, 0xA9, 0x89, 0x89, 0x9B,
+ 0xEF, 0xBB, 0xA8, 0x77, 0x77, 0x78, 0x9B, 0xFC, 0xA8, 0x76, 0x55, 0x56,
+ 0x78, 0xAB, 0xB9, 0x76, 0x55, 0x45, 0x56, 0x79, 0xBB, 0x97, 0x65, 0x44,
+ 0x44, 0x57, 0x8A, 0xA8, 0x75, 0x44, 0x44, 0x45, 0x68, 0xAA, 0x87, 0x65,
+ 0x44, 0x45, 0x57, 0x9A, 0xB9, 0x76, 0x55, 0x45, 0x56, 0x79, 0xBB, 0x98,
+ 0x76, 0x55, 0x66, 0x78, 0xAB, 0xFB, 0xA8, 0x77, 0x77, 0x78, 0xAB, 0xBD,
+ 0xFB, 0xA9, 0x88, 0x89, 0xAC, 0xCC, 0xBC, 0xCB, 0xBA, 0xAA, 0xAA, 0xBB,
+ 0xA0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xAC, 0xAB, 0xA9, 0xAA, 0xAB, 0xCC, 0xDC, 0xBA, 0x98, 0x88, 0x88, 0x9A,
+ 0xBD, 0xBA, 0x98, 0x77, 0x77, 0x78, 0x9B, 0xCA, 0xA8, 0x76, 0x65, 0x56,
+ 0x78, 0xAB, 0xA9, 0x76, 0x55, 0x45, 0x56, 0x79, 0xBA, 0x87, 0x55, 0x44,
+ 0x45, 0x57, 0x89, 0x98, 0x75, 0x44, 0x44, 0x45, 0x68, 0x9A, 0x87, 0x55,
+ 0x44, 0x45, 0x57, 0x89, 0xA8, 0x76, 0x55, 0x55, 0x56, 0x79, 0xAB, 0xA8,
+ 0x76, 0x55, 0x56, 0x78, 0x9A, 0xCB, 0xA8, 0x77, 0x77, 0x78, 0x9B, 0xDC,
+ 0xCB, 0xA9, 0x88, 0x89, 0x9A, 0xBD, 0xCB, 0xCB, 0xA9, 0xA9, 0xAA, 0xBB,
+ 0xB0, 0x00, 0x00, 0x00,
+ },
+ },
+ {
+ {
+ 0xAF, 0xFF, 0xBF, 0xFF, 0xFF, 0xFF, 0xFF, 0xBF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFB, 0xBF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xA9, 0xAF,
+ 0xFF, 0xFF, 0xFF, 0xFB, 0x96, 0x56, 0x9F, 0xFF, 0xFF, 0xFF, 0xA6, 0x32,
+ 0x36, 0xAF, 0xFF, 0xFF, 0xF9, 0x63, 0x12, 0x6A, 0xFF, 0xFF, 0xFF, 0x96,
+ 0x33, 0x36, 0xBF, 0xFF, 0xFF, 0xFF, 0x96, 0x56, 0x9A, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xDA, 0x9A, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xF0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xF7, 0x56, 0xFC, 0xCF, 0xFF, 0xFF, 0xF6, 0x32,
+ 0x39, 0xFF, 0xFF, 0xFF, 0xF8, 0x62, 0x12, 0x6F, 0xFF, 0xFF, 0xFF, 0xF6,
+ 0x43, 0x37, 0xFF, 0xFF, 0xFF, 0xFF, 0xA6, 0x58, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xF0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xEA, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0x96, 0x56, 0x9F, 0xFF, 0xFF, 0xFF, 0xB6, 0x43,
+ 0x36, 0xFF, 0xFF, 0xFF, 0xFB, 0x62, 0x12, 0x5B, 0xFF, 0xFF, 0xFF, 0xD6,
+ 0x42, 0x36, 0xFF, 0xFF, 0xFF, 0xFF, 0x96, 0x56, 0x9F, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFA, 0xEF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xF0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xF8, 0x8F, 0xFF, 0xFF, 0xFF, 0xFF, 0xF9, 0x43,
+ 0x5F, 0xFF, 0xFF, 0xFF, 0xFF, 0xA3, 0x11, 0xDF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0x61, 0x3E, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xF0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xF9, 0x8A, 0xFF, 0xFF, 0xFF, 0xFF, 0xF8, 0x53,
+ 0x5E, 0xFF, 0xFF, 0xFF, 0xFF, 0x93, 0x11, 0x8F, 0xFF, 0xFF, 0xFF, 0xFE,
+ 0x51, 0x39, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x88, 0xCF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xF0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0x77, 0x67, 0x76, 0x67, 0x77, 0x66, 0x66, 0x67, 0x77, 0x77, 0x66, 0x66,
+ 0x66, 0x66, 0x66, 0x67, 0x77, 0x77, 0x77, 0x77, 0x76, 0x66, 0x66, 0x66,
+ 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x67, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x76, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66,
+ 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66,
+ 0x66, 0x66, 0x66, 0x67, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x70, 0x00, 0x00, 0x00,
+ },
+ {
+ 0x77, 0x67, 0x76, 0x67, 0x77, 0x66, 0x66, 0x67, 0x77, 0x77, 0x66, 0x66,
+ 0x66, 0x66, 0x66, 0x67, 0x77, 0x77, 0x77, 0x77, 0x76, 0x66, 0x66, 0x66,
+ 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x67, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x76, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66,
+ 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66,
+ 0x66, 0x66, 0x66, 0x67, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x70, 0x00, 0x00, 0x00,
+ },
+ {
+ 0x77, 0x67, 0x76, 0x67, 0x77, 0x66, 0x66, 0x67, 0x77, 0x77, 0x66, 0x66,
+ 0x66, 0x66, 0x66, 0x67, 0x77, 0x77, 0x77, 0x77, 0x76, 0x66, 0x66, 0x66,
+ 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x67, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x76, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66,
+ 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66,
+ 0x66, 0x66, 0x66, 0x67, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x70, 0x00, 0x00, 0x00,
+ },
+ {
+ 0x77, 0x67, 0x76, 0x67, 0x77, 0x66, 0x66, 0x67, 0x77, 0x77, 0x66, 0x66,
+ 0x66, 0x66, 0x66, 0x67, 0x77, 0x77, 0x77, 0x77, 0x76, 0x66, 0x66, 0x66,
+ 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x67, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x76, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66,
+ 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66,
+ 0x66, 0x66, 0x66, 0x67, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x70, 0x00, 0x00, 0x00,
+ },
+ {
+ 0x77, 0x67, 0x76, 0x67, 0x77, 0x66, 0x66, 0x67, 0x77, 0x77, 0x66, 0x66,
+ 0x66, 0x66, 0x66, 0x67, 0x77, 0x77, 0x77, 0x77, 0x76, 0x66, 0x66, 0x66,
+ 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x67, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x76, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66,
+ 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66,
+ 0x66, 0x66, 0x66, 0x67, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x70, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xAC, 0xBB, 0xAA, 0xAA, 0xAC, 0xDE, 0xCB, 0xBA, 0xA9, 0x98, 0x99, 0xAB,
+ 0xDE, 0xBA, 0x98, 0x77, 0x77, 0x78, 0xAB, 0xEA, 0xA8, 0x76, 0x65, 0x66,
+ 0x79, 0xAC, 0xA9, 0x86, 0x54, 0x44, 0x56, 0x79, 0xAA, 0x87, 0x65, 0x44,
+ 0x45, 0x57, 0x9A, 0xA9, 0x75, 0x44, 0x34, 0x45, 0x78, 0x9A, 0x87, 0x65,
+ 0x44, 0x45, 0x67, 0x9A, 0xB9, 0x86, 0x55, 0x45, 0x56, 0x89, 0xAC, 0xA8,
+ 0x76, 0x65, 0x66, 0x78, 0x9A, 0xCC, 0xA8, 0x87, 0x77, 0x89, 0x9B, 0xBF,
+ 0xDB, 0xA9, 0x98, 0x99, 0x9B, 0xBC, 0xDF, 0xCB, 0xAA, 0xB9, 0xAB, 0xBB,
+ 0xA0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xBC, 0xCB, 0xAA, 0x9A, 0xAB, 0xCE, 0xCD, 0xCB, 0x99, 0x88, 0x89, 0x9B,
+ 0xCD, 0xCA, 0x98, 0x77, 0x67, 0x78, 0x9B, 0xCB, 0xA8, 0x76, 0x65, 0x56,
+ 0x78, 0xAB, 0xA9, 0x76, 0x55, 0x45, 0x56, 0x79, 0xAA, 0x87, 0x65, 0x44,
+ 0x45, 0x57, 0x8A, 0x98, 0x65, 0x44, 0x44, 0x45, 0x78, 0xAA, 0x87, 0x55,
+ 0x44, 0x45, 0x57, 0x8A, 0xA9, 0x76, 0x55, 0x45, 0x56, 0x79, 0xAB, 0xA8,
+ 0x76, 0x55, 0x66, 0x78, 0x9B, 0xCB, 0xA8, 0x77, 0x67, 0x78, 0x9B, 0xCD,
+ 0xDB, 0xA9, 0x88, 0x89, 0x9B, 0xCD, 0xDC, 0xDB, 0xAA, 0xA9, 0xAB, 0xBE,
+ 0xB0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xBC, 0xBB, 0xAA, 0xAA, 0xAB, 0xCD, 0xDC, 0xCB, 0x99, 0x88, 0x89, 0xAB,
+ 0xCD, 0xBB, 0x98, 0x77, 0x77, 0x78, 0x9B, 0xCB, 0xA8, 0x76, 0x55, 0x56,
+ 0x78, 0xAB, 0xA9, 0x76, 0x55, 0x44, 0x56, 0x79, 0xAA, 0x87, 0x65, 0x44,
+ 0x45, 0x57, 0x8A, 0xA8, 0x75, 0x44, 0x44, 0x45, 0x68, 0xAA, 0x87, 0x55,
+ 0x44, 0x45, 0x67, 0x89, 0xA9, 0x76, 0x55, 0x45, 0x56, 0x79, 0xAB, 0xA8,
+ 0x76, 0x65, 0x66, 0x78, 0xAA, 0xCB, 0x98, 0x77, 0x77, 0x78, 0x9A, 0xBD,
+ 0xCB, 0xA9, 0x88, 0x89, 0xAB, 0xBB, 0xDD, 0xCB, 0xAA, 0x9A, 0xAA, 0xBB,
+ 0xB0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xDF, 0xEC, 0xBA, 0xAA, 0xBD, 0xEF, 0xDD, 0xCB, 0xA9, 0x99, 0x9A, 0xBD,
+ 0xCF, 0xDB, 0x98, 0x77, 0x77, 0x88, 0xAC, 0xDE, 0xA9, 0x76, 0x55, 0x66,
+ 0x79, 0x9F, 0xB9, 0x86, 0x55, 0x45, 0x56, 0x89, 0xBB, 0x97, 0x65, 0x44,
+ 0x45, 0x67, 0x9B, 0xB8, 0x75, 0x44, 0x34, 0x45, 0x79, 0xAA, 0x97, 0x64,
+ 0x44, 0x45, 0x57, 0x9B, 0xC9, 0x86, 0x55, 0x44, 0x56, 0x79, 0xBC, 0xA8,
+ 0x76, 0x55, 0x66, 0x79, 0xBF, 0xFC, 0xA8, 0x87, 0x77, 0x78, 0xAA, 0xFF,
+ 0xFC, 0xAA, 0x99, 0x99, 0xAC, 0xCF, 0xFF, 0xCB, 0xBA, 0xAB, 0xBC, 0xBE,
+ 0xB0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xBC, 0xBB, 0xBB, 0x9B, 0xBB, 0xFE, 0xCD, 0xCC, 0xA9, 0x99, 0x99, 0xAC,
+ 0xED, 0xCC, 0xA8, 0x87, 0x77, 0x88, 0xAB, 0xCB, 0xA8, 0x76, 0x56, 0x66,
+ 0x79, 0xBC, 0xA9, 0x86, 0x55, 0x44, 0x56, 0x79, 0xCA, 0x97, 0x65, 0x44,
+ 0x44, 0x67, 0x8A, 0xA9, 0x75, 0x44, 0x34, 0x45, 0x79, 0xBB, 0x97, 0x64,
+ 0x44, 0x45, 0x67, 0x9A, 0xB9, 0x86, 0x54, 0x45, 0x56, 0x89, 0xBC, 0xA9,
+ 0x76, 0x66, 0x66, 0x79, 0xAC, 0xFC, 0xA8, 0x87, 0x77, 0x79, 0x9B, 0xDE,
+ 0xDC, 0xA9, 0x99, 0x9A, 0xAB, 0xBD, 0xBD, 0xDB, 0xBA, 0xAA, 0xBB, 0xCD,
+ 0xB0, 0x00, 0x00, 0x00,
+ },
+ },
+ {
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xF7, 0x7F, 0xFC, 0xAF, 0xFF, 0xFF, 0xF6, 0x32,
+ 0x6F, 0xFF, 0xFF, 0xFF, 0xFF, 0x62, 0x03, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0x63, 0x5F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0x9F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xF0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xBF, 0xBF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xBF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xCC, 0xCF, 0xBF, 0xFF, 0xFF, 0xFF, 0xFF, 0xBA, 0x99, 0xBB,
+ 0xFF, 0xFF, 0xFC, 0xBB, 0x86, 0x56, 0x9B, 0xFF, 0xFF, 0xFB, 0xA7, 0x42,
+ 0x36, 0xAF, 0xFF, 0xFF, 0xF9, 0x62, 0x13, 0x59, 0xFF, 0xFF, 0xFF, 0xA6,
+ 0x32, 0x47, 0xAF, 0xEF, 0xFF, 0xFF, 0x96, 0x57, 0x9A, 0xCC, 0xFF, 0xFF,
+ 0xFB, 0xAA, 0xAA, 0xEF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFB, 0xBF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xF0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFB, 0x99, 0x9B,
+ 0xFF, 0xFF, 0xFF, 0xFA, 0x86, 0x56, 0x8B, 0xFF, 0xFF, 0xFF, 0xA6, 0x42,
+ 0x36, 0xAF, 0xFF, 0xFF, 0xF9, 0x52, 0x13, 0x58, 0xFF, 0xFF, 0xFF, 0xA5,
+ 0x33, 0x36, 0x9F, 0xFF, 0xFF, 0xFE, 0x86, 0x56, 0x8B, 0xFF, 0xFF, 0xFF,
+ 0xFE, 0xA8, 0x9A, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xF0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x77, 0x7F,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0x75, 0x45, 0x68, 0xCF, 0xFF, 0xFF, 0xB5, 0x43,
+ 0x35, 0x8F, 0xFF, 0xFF, 0xF8, 0x43, 0x23, 0x57, 0xCF, 0xFF, 0xFF, 0xA5,
+ 0x32, 0x34, 0x8F, 0xFF, 0xFF, 0xFF, 0x64, 0x44, 0x6F, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0x87, 0x98, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xF0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF8, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xEF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xED, 0xAF, 0xFF, 0xFF, 0xFF, 0xF3,
+ 0x3F, 0xFF, 0xFF, 0xFF, 0xFF, 0xF4, 0x02, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0x52, 0x37, 0xFF, 0xFF, 0xFF, 0xFF, 0xF9, 0x7F, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x8F, 0xFF, 0xFF,
+ 0xF0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0x8F, 0xF8, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xEF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0x88, 0xEE, 0xEF, 0xFF, 0xFF, 0xFF, 0xFF, 0x8F, 0xF8, 0x67, 0x87,
+ 0xFF, 0xFF, 0xFF, 0xF8, 0x76, 0x54, 0x77, 0xEF, 0xFF, 0xFF, 0x84, 0x33,
+ 0x35, 0x7F, 0xFF, 0xF8, 0x86, 0x53, 0x23, 0x57, 0xFF, 0xFF, 0xFF, 0x65,
+ 0x33, 0x35, 0x78, 0xFF, 0xFF, 0xF8, 0x55, 0x44, 0x58, 0xEE, 0xEE, 0xFE,
+ 0xFE, 0x67, 0x88, 0x8F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xF0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFC, 0xCC, 0xFC, 0xFF, 0xFF, 0xFF, 0xBC, 0xA9, 0xA9, 0xCF,
+ 0xFF, 0xFC, 0xBA, 0x98, 0x77, 0x89, 0xBF, 0xFF, 0xB9, 0x87, 0x66, 0x67,
+ 0x8A, 0xCF, 0xBA, 0x87, 0x65, 0x44, 0x67, 0x9F, 0xFB, 0xA8, 0x65, 0x43,
+ 0x45, 0x69, 0xCF, 0xEA, 0x76, 0x43, 0x33, 0x46, 0x8F, 0xFC, 0xA8, 0x65,
+ 0x43, 0x34, 0x68, 0xAF, 0xF9, 0x97, 0x64, 0x44, 0x57, 0xAF, 0xFF, 0xFA,
+ 0x97, 0x66, 0x67, 0x9C, 0xFF, 0xFF, 0xFB, 0xA9, 0x99, 0x9B, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xCB, 0xCC, 0xEF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xF0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFD, 0xDF, 0xFF, 0xFF, 0xFF, 0xFF, 0xED, 0xDC, 0xCD, 0xCF, 0xFF,
+ 0xFF, 0xCC, 0xCB, 0xA9, 0x9A, 0xBC, 0xFF, 0xFD, 0xDB, 0xA8, 0x76, 0x78,
+ 0xAD, 0xFF, 0xDC, 0xA8, 0x65, 0x45, 0x68, 0xBF, 0xFE, 0xCA, 0x75, 0x33,
+ 0x35, 0x7A, 0xCF, 0xFC, 0xA6, 0x43, 0x23, 0x47, 0x9C, 0xFF, 0xC9, 0x75,
+ 0x33, 0x35, 0x79, 0xCE, 0xFD, 0xB8, 0x65, 0x45, 0x68, 0xAC, 0xDF, 0xFC,
+ 0xA8, 0x76, 0x78, 0xAB, 0xDF, 0xFF, 0xFD, 0xBA, 0x99, 0xAB, 0xCF, 0xFF,
+ 0xFF, 0xFD, 0xDD, 0xCD, 0xDF, 0xDF, 0xFF, 0xFF, 0xFF, 0xFD, 0xFF, 0xFF,
+ 0xD0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0x9D, 0xFF, 0xAF, 0xFF, 0xFF, 0xFF, 0xAF, 0x77, 0x8A,
+ 0xFF, 0xFF, 0xFF, 0xF9, 0x75, 0x45, 0x68, 0xFF, 0xFF, 0xFF, 0x84, 0x33,
+ 0x35, 0x9A, 0xFF, 0xFF, 0xF6, 0x43, 0x23, 0x47, 0xFF, 0xFF, 0xFF, 0x75,
+ 0x33, 0x35, 0x7A, 0xFF, 0xFF, 0xF8, 0x64, 0x45, 0x69, 0xFF, 0xFF, 0xFF,
+ 0x97, 0x86, 0x78, 0x9F, 0xFF, 0xFF, 0xAF, 0xFF, 0xAF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xDF, 0xFF, 0xFC, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xAF,
+ 0xF0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0x77, 0x67, 0x76, 0x67, 0x77, 0x66, 0x66, 0x67, 0x77, 0x77, 0x66, 0x66,
+ 0x66, 0x66, 0x66, 0x67, 0x77, 0x77, 0x77, 0x77, 0x76, 0x66, 0x66, 0x66,
+ 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x67, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x76, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66,
+ 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66,
+ 0x66, 0x66, 0x66, 0x67, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x70, 0x00, 0x00, 0x00,
+ },
+ {
+ 0x77, 0x67, 0x76, 0x67, 0x77, 0x66, 0x66, 0x67, 0x77, 0x77, 0x66, 0x66,
+ 0x66, 0x66, 0x66, 0x67, 0x77, 0x77, 0x77, 0x77, 0x76, 0x66, 0x66, 0x66,
+ 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x67, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x76, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66,
+ 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66,
+ 0x66, 0x66, 0x66, 0x67, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x70, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xEE, 0xDD, 0xDD, 0xDD, 0x5D, 0xDD, 0x4D, 0xDD, 0xDD, 0xD6, 0xDD, 0xD5,
+ 0xDD, 0xDD, 0x5D, 0xDD, 0x6D, 0xDD, 0xDD, 0xD5, 0xDD, 0xDD, 0xD6, 0xDD,
+ 0xDD, 0x6D, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xD6, 0xDD, 0xDD, 0xD6,
+ 0xD5, 0xDD, 0x5D, 0x6D, 0x55, 0xDD, 0x0D, 0x55, 0x65, 0xDD, 0x5D, 0xDD,
+ 0x66, 0xDD, 0xDD, 0xDD, 0xDD, 0xD5, 0xD5, 0x5D, 0x5D, 0xD6, 0xDD, 0xDD,
+ 0xDD, 0xDD, 0xD6, 0xD5, 0x6D, 0x6D, 0x6D, 0xD4, 0x6D, 0xDD, 0xDD, 0xDD,
+ 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0x55, 0xD6, 0xDD, 0xDE,
+ 0xE0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0x9B, 0x9B, 0xA9, 0x9B, 0xAC, 0xCC, 0xFA, 0xBA, 0xBB, 0xA9, 0xAA, 0xBF,
+ 0xFF, 0xAA, 0xAA, 0x98, 0x88, 0x88, 0xAD, 0xF9, 0x99, 0x88, 0x76, 0x66,
+ 0x79, 0xAA, 0x99, 0x98, 0x75, 0x54, 0x56, 0x8F, 0xFA, 0xA9, 0x75, 0x43,
+ 0x34, 0x68, 0xAB, 0xBA, 0x86, 0x53, 0x33, 0x56, 0x8A, 0xBC, 0xB8, 0x64,
+ 0x33, 0x45, 0x79, 0xAC, 0xCB, 0x86, 0x54, 0x55, 0x67, 0x8A, 0xAC, 0xCA,
+ 0x76, 0x67, 0x78, 0x89, 0xBB, 0xFF, 0xB9, 0x78, 0x88, 0x9A, 0xBB, 0x9F,
+ 0xFD, 0xF9, 0xAB, 0x9A, 0xAB, 0xAA, 0xFF, 0xFC, 0xFA, 0xAB, 0x99, 0xAA,
+ 0x80, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xCC, 0xBC, 0xBB, 0xBC, 0xBB, 0xBB, 0xBB, 0xBC, 0xCB, 0xBB, 0xBB, 0xBB,
+ 0xBB, 0xBB, 0xBB, 0xBC, 0xCB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xB4, 0xBB,
+ 0xBB, 0xBB, 0xBB, 0xB4, 0x44, 0xB4, 0x2B, 0xBC, 0xCC, 0xCB, 0xBB, 0x33,
+ 0x4B, 0xBB, 0xBB, 0xBB, 0xB4, 0xBB, 0x44, 0x3B, 0xBB, 0xBB, 0xBB, 0xBB,
+ 0xB3, 0xB4, 0xBB, 0xBB, 0xBB, 0xBB, 0xB4, 0x44, 0x3B, 0xBB, 0xBB, 0xBB,
+ 0xB4, 0xB3, 0xBB, 0xBC, 0xCC, 0xCC, 0xCC, 0xCB, 0xB4, 0xBB, 0xBB, 0xBB,
+ 0xBB, 0xBB, 0xBB, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCB, 0xCC, 0xCC,
+ 0xC0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0x77, 0x67, 0x76, 0x67, 0x77, 0x66, 0x66, 0x67, 0x77, 0x77, 0x66, 0x66,
+ 0x66, 0x66, 0x66, 0x67, 0x77, 0x77, 0x77, 0x77, 0x76, 0x66, 0x66, 0x66,
+ 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x67, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x76, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66,
+ 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66,
+ 0x66, 0x66, 0x66, 0x67, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x70, 0x00, 0x00, 0x00,
+ },
+ },
+};
+
+static const uint8_t long_codes_def[3][125][224] = {
+ {
+ {
+ 0xBE, 0xED, 0xDD, 0xDD, 0xDD, 0xDD, 0xFF, 0xFF, 0xFF, 0xFF, 0xBF, 0xFF,
+ 0xFE, 0xED, 0xDD, 0xCC, 0xDE, 0xEF, 0xFF, 0xFF, 0xFF, 0xFE, 0xED, 0xDC,
+ 0xCB, 0xCB, 0xBB, 0xCC, 0xDE, 0xEF, 0xFF, 0xFE, 0xED, 0xDC, 0xBB, 0xAA,
+ 0xAA, 0xAA, 0xBB, 0xDD, 0xFF, 0xFF, 0xFE, 0xDC, 0xBB, 0xA9, 0x99, 0x99,
+ 0x99, 0xAB, 0xCD, 0xEF, 0xFE, 0xEC, 0xCB, 0xA9, 0x88, 0x87, 0x78, 0x89,
+ 0xAB, 0xCD, 0xFF, 0xFE, 0xCB, 0xA9, 0x87, 0x77, 0x66, 0x77, 0x89, 0xAB,
+ 0xDE, 0xFD, 0xDC, 0xAA, 0x87, 0x76, 0x65, 0x66, 0x67, 0x89, 0xBC, 0xEF,
+ 0xDD, 0xBA, 0x98, 0x76, 0x55, 0x55, 0x56, 0x78, 0x9A, 0xCD, 0xED, 0xDC,
+ 0xA9, 0x87, 0x65, 0x54, 0x45, 0x56, 0x79, 0xAC, 0xDD, 0xDD, 0xCA, 0x98,
+ 0x65, 0x54, 0x44, 0x55, 0x67, 0x9A, 0xBD, 0xDE, 0xEB, 0xA9, 0x87, 0x65,
+ 0x44, 0x55, 0x66, 0x89, 0xAB, 0xDD, 0xED, 0xCA, 0x98, 0x76, 0x55, 0x55,
+ 0x56, 0x78, 0x9A, 0xCC, 0xDE, 0xFC, 0xBA, 0x87, 0x76, 0x65, 0x66, 0x77,
+ 0x89, 0xBB, 0xDD, 0xFE, 0xDB, 0xA9, 0x87, 0x76, 0x67, 0x77, 0x89, 0xAB,
+ 0xCD, 0xDF, 0xEF, 0xCB, 0xA9, 0x88, 0x87, 0x88, 0x89, 0xAB, 0xCC, 0xED,
+ 0xFF, 0xED, 0xCB, 0xA9, 0x99, 0x99, 0x99, 0xAA, 0xBC, 0xDE, 0xEF, 0xFF,
+ 0xFD, 0xDB, 0xBA, 0xAA, 0xAA, 0xAB, 0xCC, 0xDE, 0xFD, 0xFF, 0xFF, 0xFD,
+ 0xDC, 0xCC, 0xBC, 0xCC, 0xDC, 0xDE, 0xEF, 0xEF, 0xFF, 0xFF, 0xFF, 0xDE,
+ 0xDD, 0xCD, 0xDD, 0xEE, 0xFF, 0xFE, 0xDF, 0xFF, 0xFF, 0xEF, 0xDD, 0xDD,
+ 0xDD, 0xDD, 0xDD, 0xFD, 0xB0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xBD, 0xCD, 0xCC, 0xCC, 0xCC, 0xCC, 0xCD, 0xEF, 0xFF, 0xFF, 0xCF, 0xFE,
+ 0xDC, 0xDC, 0xCC, 0xBB, 0xCC, 0xCC, 0xDE, 0xEF, 0xFF, 0xEE, 0xDD, 0xCC,
+ 0xCB, 0xBA, 0xAA, 0xBB, 0xBC, 0xDD, 0xFF, 0xDC, 0xDD, 0xCB, 0xBA, 0xA9,
+ 0x99, 0x9A, 0x9A, 0xBC, 0xDF, 0xFF, 0xBD, 0xDB, 0xBA, 0x99, 0x88, 0x88,
+ 0x88, 0x9A, 0xBC, 0xEF, 0xDD, 0xCC, 0xBA, 0x98, 0x87, 0x77, 0x77, 0x89,
+ 0x9A, 0xBC, 0xDD, 0xCC, 0xBA, 0x98, 0x87, 0x76, 0x66, 0x67, 0x78, 0x9A,
+ 0xCC, 0xDC, 0xCB, 0xA9, 0x87, 0x66, 0x65, 0x66, 0x67, 0x88, 0xAB, 0xCC,
+ 0xCC, 0xA9, 0x87, 0x66, 0x55, 0x55, 0x56, 0x67, 0x89, 0xBC, 0xCC, 0xCA,
+ 0x98, 0x76, 0x65, 0x55, 0x55, 0x66, 0x78, 0x9A, 0xCC, 0xBB, 0xA9, 0x87,
+ 0x66, 0x55, 0x55, 0x56, 0x67, 0x89, 0xAC, 0xBC, 0xCA, 0x98, 0x76, 0x65,
+ 0x55, 0x55, 0x66, 0x78, 0x9A, 0xBC, 0xCC, 0xB9, 0x87, 0x66, 0x55, 0x55,
+ 0x56, 0x77, 0x89, 0xAB, 0xCD, 0xCB, 0xA9, 0x87, 0x66, 0x66, 0x66, 0x67,
+ 0x89, 0xAB, 0xBD, 0xDF, 0xCA, 0x98, 0x87, 0x76, 0x66, 0x77, 0x89, 0x9A,
+ 0xBC, 0xCF, 0xDD, 0xAA, 0x98, 0x87, 0x77, 0x77, 0x88, 0x9A, 0xBC, 0xDD,
+ 0xFF, 0xDC, 0xBA, 0x99, 0x88, 0x88, 0x89, 0x9A, 0xAB, 0xBC, 0xDF, 0xFF,
+ 0xDC, 0xBA, 0xAA, 0x99, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xFF, 0xFF, 0xEC,
+ 0xBB, 0xBA, 0xAA, 0xAB, 0xBB, 0xDC, 0xDF, 0xDF, 0xFF, 0xFD, 0xEE, 0xCC,
+ 0xBC, 0xBB, 0xCC, 0xDD, 0xCE, 0xFE, 0xCF, 0xFF, 0xDD, 0xDD, 0xCD, 0xDC,
+ 0xCB, 0xBD, 0xCD, 0xDD, 0xB0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xBD, 0xDD, 0xCC, 0xCC, 0xCC, 0xCC, 0xCD, 0xDD, 0xEF, 0xFF, 0xDD, 0xEE,
+ 0xDD, 0xCD, 0xCC, 0xCC, 0xCC, 0xCD, 0xDF, 0xFF, 0xFF, 0xDE, 0xDD, 0xCC,
+ 0xBB, 0xBB, 0xBA, 0xBB, 0xCD, 0xDE, 0xFF, 0xFD, 0xDD, 0xCC, 0xBA, 0xAA,
+ 0x99, 0x9A, 0xAA, 0xBC, 0xDE, 0xFF, 0xCD, 0xCB, 0xBA, 0x99, 0x98, 0x88,
+ 0x89, 0x9A, 0xBC, 0xDF, 0xED, 0xCC, 0xBA, 0x98, 0x88, 0x77, 0x77, 0x88,
+ 0x9A, 0xBC, 0xDE, 0xCC, 0xBA, 0x99, 0x87, 0x76, 0x66, 0x67, 0x78, 0x9A,
+ 0xCD, 0xDC, 0xCB, 0xA9, 0x87, 0x76, 0x65, 0x56, 0x67, 0x89, 0xAB, 0xCC,
+ 0xCC, 0xBA, 0x98, 0x76, 0x55, 0x55, 0x56, 0x67, 0x89, 0xBC, 0xCC, 0xCA,
+ 0x98, 0x76, 0x65, 0x55, 0x55, 0x56, 0x78, 0x9A, 0xCC, 0xCC, 0xB9, 0x87,
+ 0x65, 0x55, 0x45, 0x56, 0x67, 0x89, 0xAC, 0xCC, 0xCB, 0x98, 0x76, 0x65,
+ 0x55, 0x55, 0x66, 0x78, 0x9B, 0xCC, 0xCC, 0xBA, 0x87, 0x76, 0x55, 0x55,
+ 0x56, 0x78, 0x99, 0xBC, 0xCD, 0xCB, 0xA9, 0x87, 0x66, 0x66, 0x66, 0x77,
+ 0x89, 0xAB, 0xCC, 0xDD, 0xCB, 0x98, 0x87, 0x76, 0x66, 0x77, 0x89, 0x9B,
+ 0xBC, 0xCE, 0xED, 0xBA, 0x98, 0x87, 0x77, 0x78, 0x89, 0x9A, 0xBC, 0xDC,
+ 0xEE, 0xDC, 0xBA, 0x99, 0x88, 0x88, 0x99, 0x9A, 0xBC, 0xCD, 0xCF, 0xFE,
+ 0xDD, 0xBB, 0xAA, 0x99, 0x9A, 0xAA, 0xBC, 0xCC, 0xDC, 0xFF, 0xFE, 0xDC,
+ 0xCB, 0xBB, 0xBB, 0xBB, 0xBC, 0xCD, 0xDE, 0xDF, 0xFF, 0xFF, 0xED, 0xCC,
+ 0xCC, 0xCC, 0xCC, 0xDD, 0xDE, 0xFD, 0xDF, 0xFF, 0xED, 0xDD, 0xDC, 0xCC,
+ 0xCC, 0xCC, 0xCC, 0xDD, 0xB0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xBD, 0xCD, 0xDC, 0xCC, 0xCC, 0xCC, 0xCD, 0xDF, 0xFF, 0xFF, 0xDD, 0xFF,
+ 0xDF, 0xEC, 0xCC, 0xDC, 0xCD, 0xDD, 0xDF, 0xFF, 0xFF, 0xEE, 0xCC, 0xCC,
+ 0xBB, 0xBB, 0xBB, 0xAC, 0xCC, 0xEF, 0xEF, 0xFD, 0xDD, 0xCC, 0xBB, 0xAA,
+ 0x99, 0x9A, 0xAB, 0xBC, 0xDF, 0xFF, 0xDD, 0xCB, 0xBA, 0x99, 0x98, 0x88,
+ 0x89, 0x9A, 0xBC, 0xDD, 0xFC, 0xDB, 0xBA, 0xA9, 0x88, 0x77, 0x77, 0x88,
+ 0x9A, 0xBC, 0xED, 0xBC, 0xBA, 0xA9, 0x87, 0x76, 0x66, 0x67, 0x88, 0x9A,
+ 0xBD, 0xDD, 0xCB, 0xA9, 0x87, 0x66, 0x65, 0x56, 0x67, 0x89, 0xAC, 0xCE,
+ 0xCC, 0xBA, 0x98, 0x76, 0x55, 0x55, 0x56, 0x67, 0x8A, 0xBC, 0xDC, 0xDB,
+ 0xA9, 0x76, 0x65, 0x55, 0x55, 0x56, 0x78, 0xAA, 0xCC, 0xCC, 0xB9, 0x87,
+ 0x66, 0x55, 0x45, 0x55, 0x67, 0x89, 0xBC, 0xCC, 0xDB, 0xA8, 0x76, 0x65,
+ 0x55, 0x55, 0x66, 0x78, 0x9B, 0xCC, 0xCC, 0xBA, 0x97, 0x66, 0x55, 0x55,
+ 0x56, 0x78, 0x9A, 0xBC, 0xCF, 0xDC, 0xA9, 0x87, 0x66, 0x65, 0x66, 0x77,
+ 0x89, 0xAB, 0xCC, 0xFD, 0xCB, 0xA8, 0x87, 0x76, 0x66, 0x77, 0x89, 0xAB,
+ 0xBC, 0xCF, 0xFD, 0xCB, 0x99, 0x87, 0x77, 0x78, 0x89, 0xAA, 0xCC, 0xCC,
+ 0xFF, 0xDC, 0xBA, 0xA9, 0x98, 0x88, 0x99, 0x9A, 0xBC, 0xDD, 0xCF, 0xFE,
+ 0xDD, 0xBB, 0xAA, 0xA9, 0xAA, 0xAA, 0xBB, 0xBD, 0xDC, 0xFF, 0xFF, 0xDD,
+ 0xBC, 0xBB, 0xBB, 0xBB, 0xCC, 0xCD, 0xFE, 0xCF, 0xFF, 0xFD, 0xFD, 0xDD,
+ 0xDC, 0xCC, 0xCC, 0xDD, 0xDE, 0xFE, 0xCF, 0xFF, 0xDD, 0xCD, 0xDD, 0xCC,
+ 0xCD, 0xCC, 0xCD, 0xCD, 0xB0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xBF, 0xEE, 0xDD, 0xDD, 0xCD, 0xDD, 0xDD, 0xEF, 0xFF, 0xFF, 0xDE, 0xFF,
+ 0xFD, 0xED, 0xDD, 0xCC, 0xDD, 0xEF, 0xFF, 0xFF, 0xFF, 0xFE, 0xEF, 0xDD,
+ 0xCC, 0xCB, 0xBB, 0xCC, 0xDE, 0xFF, 0xFF, 0xFE, 0xFD, 0xDC, 0xBB, 0xAA,
+ 0xAA, 0xAA, 0xBB, 0xCD, 0xDF, 0xFF, 0xFF, 0xDC, 0xBA, 0xA9, 0x99, 0x89,
+ 0x99, 0xAB, 0xCD, 0xFF, 0xFD, 0xDD, 0xCA, 0xA9, 0x88, 0x87, 0x78, 0x89,
+ 0xAB, 0xCD, 0xFF, 0xDE, 0xCB, 0xA9, 0x87, 0x76, 0x66, 0x77, 0x89, 0xAB,
+ 0xDF, 0xFE, 0xDC, 0xA9, 0x87, 0x76, 0x65, 0x56, 0x67, 0x89, 0xAC, 0xEF,
+ 0xED, 0xCA, 0x98, 0x76, 0x55, 0x55, 0x56, 0x78, 0x9A, 0xCD, 0xED, 0xDB,
+ 0xA9, 0x76, 0x65, 0x54, 0x55, 0x56, 0x79, 0xAB, 0xCE, 0xDD, 0xBA, 0x87,
+ 0x66, 0x54, 0x44, 0x55, 0x67, 0x9A, 0xBD, 0xDD, 0xDB, 0xA9, 0x86, 0x65,
+ 0x54, 0x55, 0x66, 0x79, 0xAB, 0xCD, 0xDD, 0xCA, 0x98, 0x76, 0x55, 0x55,
+ 0x56, 0x78, 0x9A, 0xCD, 0xDF, 0xFC, 0xB9, 0x87, 0x66, 0x65, 0x66, 0x77,
+ 0x89, 0xBC, 0xDD, 0xFF, 0xDC, 0xA9, 0x87, 0x76, 0x66, 0x77, 0x89, 0xAB,
+ 0xCD, 0xDF, 0xFF, 0xCB, 0xA9, 0x88, 0x87, 0x78, 0x89, 0xAB, 0xBC, 0xED,
+ 0xFF, 0xFD, 0xCB, 0xA9, 0x99, 0x99, 0x99, 0xAB, 0xBC, 0xDF, 0xEF, 0xFF,
+ 0xED, 0xCB, 0xBA, 0xAA, 0xAA, 0xAB, 0xCC, 0xCD, 0xED, 0xFF, 0xFF, 0xFD,
+ 0xDC, 0xCB, 0xBC, 0xCC, 0xCD, 0xDE, 0xEF, 0xEF, 0xFF, 0xFF, 0xFF, 0xED,
+ 0xDE, 0xDD, 0xDE, 0xDD, 0xDF, 0xFF, 0xBF, 0xFF, 0xEF, 0xDF, 0xED, 0xDC,
+ 0xDD, 0xDD, 0xDE, 0xED, 0xB0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xAC, 0xCB, 0xBA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAB, 0xBC, 0xCD, 0xBC, 0xDC,
+ 0xCC, 0xBB, 0xAA, 0xAA, 0xAA, 0xAB, 0xBB, 0xCD, 0xDD, 0xBC, 0xCB, 0xBA,
+ 0xA9, 0x99, 0x99, 0x99, 0xAA, 0xAB, 0xCD, 0xDB, 0xCB, 0xAA, 0xA9, 0x98,
+ 0x88, 0x88, 0x99, 0x9A, 0xBB, 0xCC, 0xBB, 0xBA, 0x99, 0x88, 0x88, 0x88,
+ 0x88, 0x89, 0x9A, 0xBB, 0xBA, 0xBA, 0x99, 0x88, 0x77, 0x77, 0x77, 0x78,
+ 0x89, 0x9A, 0xBB, 0xAB, 0xA9, 0x88, 0x77, 0x76, 0x66, 0x67, 0x78, 0x89,
+ 0xAB, 0xAA, 0xA9, 0x98, 0x77, 0x76, 0x66, 0x66, 0x67, 0x78, 0x99, 0xAA,
+ 0xAA, 0x98, 0x87, 0x76, 0x66, 0x66, 0x66, 0x67, 0x88, 0x9A, 0xAA, 0xA9,
+ 0x88, 0x76, 0x66, 0x55, 0x56, 0x66, 0x78, 0x89, 0xAA, 0xAA, 0x98, 0x87,
+ 0x66, 0x65, 0x55, 0x56, 0x67, 0x88, 0x9A, 0xAA, 0xA9, 0x88, 0x76, 0x66,
+ 0x55, 0x56, 0x66, 0x78, 0x89, 0xAA, 0xAA, 0x98, 0x87, 0x76, 0x66, 0x66,
+ 0x66, 0x77, 0x88, 0x9A, 0xAA, 0xA9, 0x98, 0x77, 0x66, 0x66, 0x66, 0x77,
+ 0x78, 0x99, 0xAA, 0xBA, 0xA9, 0x88, 0x77, 0x76, 0x66, 0x77, 0x78, 0x89,
+ 0xAB, 0xAB, 0xBA, 0x99, 0x88, 0x77, 0x77, 0x77, 0x88, 0x89, 0xAA, 0xBA,
+ 0xBC, 0xBA, 0x99, 0x88, 0x88, 0x88, 0x88, 0x89, 0x9A, 0xAB, 0xBC, 0xCB,
+ 0xBA, 0x99, 0x98, 0x88, 0x89, 0x99, 0x9A, 0xAB, 0xCB, 0xCC, 0xCB, 0xBA,
+ 0xA9, 0x99, 0x99, 0x99, 0xAA, 0xBB, 0xCC, 0xBD, 0xDD, 0xCB, 0xBB, 0xAA,
+ 0xAA, 0xAA, 0xAB, 0xBB, 0xCC, 0xDC, 0xBD, 0xCC, 0xBB, 0xAA, 0xAA, 0xAA,
+ 0xAA, 0xAB, 0xBB, 0xCC, 0xA0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0x9B, 0xBB, 0xAA, 0xAA, 0x9A, 0x9A, 0xAA, 0xAB, 0xBB, 0xCD, 0xBB, 0xCC,
+ 0xBB, 0xBA, 0xAA, 0xAA, 0xAA, 0xAA, 0xBB, 0xCD, 0xDC, 0xBC, 0xBB, 0xAA,
+ 0x99, 0x99, 0x99, 0x99, 0x9A, 0xBB, 0xCD, 0xCA, 0xBB, 0xAA, 0x99, 0x98,
+ 0x88, 0x88, 0x99, 0x9A, 0xAB, 0xCB, 0xAB, 0xAA, 0x99, 0x88, 0x88, 0x77,
+ 0x88, 0x89, 0x9A, 0xAB, 0xBA, 0xBA, 0x99, 0x88, 0x77, 0x77, 0x77, 0x78,
+ 0x89, 0x9A, 0xBA, 0xAA, 0xA9, 0x88, 0x77, 0x76, 0x66, 0x67, 0x78, 0x89,
+ 0xAA, 0xAA, 0xA9, 0x98, 0x77, 0x76, 0x66, 0x66, 0x67, 0x78, 0x89, 0xAA,
+ 0xAA, 0x98, 0x87, 0x76, 0x66, 0x66, 0x66, 0x67, 0x88, 0x9A, 0xA9, 0xA9,
+ 0x88, 0x76, 0x66, 0x65, 0x66, 0x66, 0x77, 0x89, 0xAA, 0xAA, 0x98, 0x77,
+ 0x66, 0x65, 0x55, 0x66, 0x67, 0x78, 0x9A, 0x99, 0xA9, 0x88, 0x76, 0x66,
+ 0x65, 0x66, 0x66, 0x78, 0x89, 0xA9, 0xAA, 0x98, 0x87, 0x76, 0x66, 0x66,
+ 0x66, 0x77, 0x88, 0x9A, 0xAA, 0xA9, 0x88, 0x77, 0x66, 0x66, 0x66, 0x77,
+ 0x78, 0x89, 0xAA, 0xAB, 0xA9, 0x88, 0x77, 0x66, 0x66, 0x77, 0x78, 0x89,
+ 0xAA, 0xAB, 0xBA, 0x99, 0x88, 0x77, 0x77, 0x77, 0x78, 0x89, 0x9A, 0xAA,
+ 0xBB, 0xBA, 0x99, 0x88, 0x87, 0x78, 0x88, 0x89, 0x9A, 0xAB, 0xAB, 0xCB,
+ 0xAA, 0x99, 0x98, 0x88, 0x88, 0x99, 0x9A, 0xAB, 0xBA, 0xCC, 0xCB, 0xAA,
+ 0xA9, 0x99, 0x99, 0x99, 0x9A, 0xAB, 0xBC, 0xBD, 0xDC, 0xCC, 0xBA, 0xAA,
+ 0xAA, 0xAA, 0xAA, 0xBB, 0xBC, 0xDB, 0xBD, 0xCC, 0xBA, 0xAA, 0xA9, 0x99,
+ 0xAA, 0xAA, 0xAB, 0xBB, 0x90, 0x00, 0x00, 0x00,
+ },
+ {
+ 0x9B, 0xBB, 0xAA, 0xA9, 0x99, 0x99, 0x9A, 0xAA, 0xBB, 0xCC, 0xBB, 0xDC,
+ 0xBB, 0xAA, 0xAA, 0x99, 0x9A, 0xAA, 0xBB, 0xBC, 0xDD, 0xBC, 0xBB, 0xAA,
+ 0x99, 0x99, 0x99, 0x99, 0x9A, 0xAB, 0xBC, 0xCB, 0xBB, 0xAA, 0x99, 0x88,
+ 0x88, 0x88, 0x89, 0x99, 0xAB, 0xBB, 0xAB, 0xAA, 0x99, 0x88, 0x87, 0x77,
+ 0x78, 0x88, 0x99, 0xAB, 0xBA, 0xAA, 0x99, 0x88, 0x77, 0x77, 0x77, 0x77,
+ 0x88, 0x9A, 0xAA, 0xAA, 0x99, 0x88, 0x77, 0x76, 0x66, 0x67, 0x77, 0x89,
+ 0x9A, 0xAA, 0xA9, 0x88, 0x77, 0x76, 0x66, 0x66, 0x67, 0x78, 0x89, 0xAA,
+ 0x9A, 0x98, 0x87, 0x76, 0x66, 0x66, 0x66, 0x77, 0x78, 0x99, 0x99, 0x99,
+ 0x87, 0x76, 0x66, 0x66, 0x66, 0x66, 0x77, 0x89, 0x99, 0x99, 0x98, 0x77,
+ 0x66, 0x66, 0x66, 0x66, 0x67, 0x78, 0x99, 0x99, 0xA9, 0x87, 0x76, 0x66,
+ 0x66, 0x66, 0x66, 0x77, 0x89, 0x99, 0x9A, 0x98, 0x87, 0x76, 0x66, 0x66,
+ 0x66, 0x77, 0x88, 0x9A, 0x9A, 0xA9, 0x88, 0x77, 0x66, 0x66, 0x66, 0x77,
+ 0x78, 0x89, 0xA9, 0xAA, 0x99, 0x88, 0x77, 0x76, 0x66, 0x77, 0x78, 0x89,
+ 0x9A, 0xAA, 0xAA, 0x98, 0x87, 0x77, 0x77, 0x77, 0x78, 0x89, 0x9A, 0xBA,
+ 0xBB, 0xAA, 0x98, 0x88, 0x87, 0x77, 0x88, 0x89, 0x9A, 0xAB, 0xAB, 0xBB,
+ 0xA9, 0x99, 0x88, 0x88, 0x88, 0x89, 0x9A, 0xAB, 0xBB, 0xCC, 0xBB, 0xAA,
+ 0x99, 0x99, 0x99, 0x99, 0x9A, 0xAB, 0xBC, 0xBC, 0xDC, 0xBB, 0xBA, 0xAA,
+ 0x99, 0xAA, 0xAA, 0xBB, 0xBC, 0xCB, 0xBC, 0xCB, 0xBA, 0xAA, 0x99, 0x99,
+ 0x99, 0xAA, 0xAA, 0xBB, 0xA0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0x9B, 0xBB, 0xAA, 0xA9, 0x99, 0x99, 0xAA, 0xAB, 0xBB, 0xCD, 0xBB, 0xCC,
+ 0xCB, 0xBA, 0xAA, 0xAA, 0xAA, 0xAA, 0xBB, 0xBC, 0xDC, 0xBC, 0xBB, 0xAA,
+ 0xA9, 0x99, 0x99, 0x99, 0x9A, 0xBB, 0xBC, 0xCB, 0xBB, 0xAA, 0x99, 0x98,
+ 0x88, 0x88, 0x89, 0x9A, 0xAB, 0xCB, 0xAB, 0xAA, 0x99, 0x88, 0x88, 0x78,
+ 0x88, 0x88, 0x9A, 0xAB, 0xBA, 0xBA, 0x99, 0x88, 0x77, 0x77, 0x77, 0x78,
+ 0x89, 0x9A, 0xBB, 0xAA, 0xA9, 0x88, 0x77, 0x77, 0x66, 0x77, 0x78, 0x89,
+ 0x9A, 0xAA, 0xA9, 0x98, 0x77, 0x76, 0x66, 0x66, 0x67, 0x78, 0x89, 0xAA,
+ 0xAA, 0x98, 0x87, 0x76, 0x66, 0x66, 0x66, 0x67, 0x88, 0x9A, 0x99, 0xA9,
+ 0x88, 0x76, 0x66, 0x65, 0x66, 0x66, 0x77, 0x89, 0xA9, 0x9A, 0x98, 0x77,
+ 0x66, 0x65, 0x55, 0x66, 0x67, 0x88, 0x9A, 0x99, 0xA9, 0x88, 0x76, 0x66,
+ 0x55, 0x66, 0x66, 0x78, 0x89, 0xA9, 0xAA, 0x98, 0x87, 0x76, 0x66, 0x66,
+ 0x66, 0x77, 0x88, 0x9A, 0x9A, 0xA9, 0x88, 0x77, 0x66, 0x66, 0x66, 0x77,
+ 0x78, 0x99, 0xAA, 0xAA, 0xA9, 0x88, 0x77, 0x76, 0x66, 0x77, 0x78, 0x89,
+ 0xAA, 0xAA, 0xBA, 0x99, 0x88, 0x77, 0x77, 0x77, 0x78, 0x89, 0x9A, 0xBA,
+ 0xBB, 0xAA, 0x99, 0x88, 0x87, 0x77, 0x88, 0x89, 0x9A, 0xAB, 0xAB, 0xBB,
+ 0xAA, 0x99, 0x98, 0x88, 0x88, 0x99, 0x9A, 0xAB, 0xCB, 0xCD, 0xCB, 0xAA,
+ 0xA9, 0x99, 0x99, 0x99, 0x9A, 0xAB, 0xBC, 0xBD, 0xDC, 0xCB, 0xBA, 0xAA,
+ 0xAA, 0xAA, 0xAA, 0xBB, 0xBC, 0xDB, 0xBC, 0xCB, 0xBA, 0xAA, 0x9A, 0x99,
+ 0x99, 0xAA, 0xAA, 0xBB, 0x90, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xAC, 0xBB, 0xBA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAB, 0xBC, 0xDD, 0xCC, 0xDC,
+ 0xCB, 0xBA, 0xAA, 0xAA, 0xAA, 0xAA, 0xBB, 0xCD, 0xED, 0xBC, 0xCB, 0xAA,
+ 0xA9, 0x99, 0x99, 0x99, 0xAA, 0xBB, 0xCD, 0xCB, 0xCB, 0xAA, 0x99, 0x98,
+ 0x88, 0x88, 0x99, 0x9A, 0xBB, 0xCC, 0xBB, 0xAA, 0x99, 0x88, 0x88, 0x78,
+ 0x88, 0x89, 0x9A, 0xBC, 0xBA, 0xBA, 0x99, 0x88, 0x77, 0x77, 0x77, 0x78,
+ 0x89, 0xAA, 0xBB, 0xAA, 0xA9, 0x88, 0x77, 0x76, 0x66, 0x77, 0x78, 0x89,
+ 0xAA, 0xBA, 0xA9, 0x98, 0x77, 0x66, 0x66, 0x66, 0x67, 0x78, 0x99, 0xAA,
+ 0xAA, 0x98, 0x87, 0x76, 0x66, 0x66, 0x66, 0x77, 0x88, 0x9A, 0xAA, 0xA9,
+ 0x88, 0x76, 0x66, 0x55, 0x56, 0x66, 0x78, 0x89, 0xAA, 0xAA, 0x98, 0x87,
+ 0x66, 0x65, 0x55, 0x66, 0x67, 0x88, 0x9A, 0xAA, 0xA9, 0x88, 0x76, 0x66,
+ 0x55, 0x56, 0x66, 0x78, 0x89, 0xAA, 0xAA, 0x98, 0x87, 0x76, 0x66, 0x66,
+ 0x66, 0x77, 0x88, 0x9A, 0xAA, 0xA9, 0x98, 0x77, 0x66, 0x66, 0x66, 0x67,
+ 0x78, 0x99, 0xAA, 0xAB, 0xA9, 0x88, 0x77, 0x76, 0x66, 0x77, 0x78, 0x89,
+ 0xAA, 0xAB, 0xBA, 0x99, 0x88, 0x77, 0x77, 0x77, 0x78, 0x89, 0x9A, 0xBA,
+ 0xBC, 0xBA, 0x99, 0x88, 0x88, 0x78, 0x88, 0x89, 0x9A, 0xBB, 0xBC, 0xCB,
+ 0xBA, 0xA9, 0x98, 0x88, 0x88, 0x99, 0x9A, 0xAB, 0xCB, 0xDD, 0xCB, 0xBA,
+ 0xA9, 0x99, 0x99, 0x99, 0xAA, 0xBB, 0xCC, 0xCD, 0xED, 0xCB, 0xBB, 0xAA,
+ 0xAA, 0xAA, 0xAB, 0xBB, 0xCC, 0xDC, 0xBD, 0xDC, 0xBB, 0xAA, 0xAA, 0xAA,
+ 0xAA, 0xAA, 0xBB, 0xBC, 0xA0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xBF, 0xEE, 0xDD, 0xDD, 0xDD, 0xDE, 0xEE, 0xFF, 0xFF, 0xFF, 0xBF, 0xFF,
+ 0xFE, 0xED, 0xDD, 0xDD, 0xDE, 0xFF, 0xFF, 0xFF, 0xFF, 0xEF, 0xFE, 0xDD,
+ 0xCC, 0xCB, 0xBC, 0xCD, 0xDE, 0xFF, 0xFF, 0xFE, 0xFE, 0xDC, 0xCB, 0xBA,
+ 0xAA, 0xAB, 0xBC, 0xDD, 0xFF, 0xFF, 0xEE, 0xDD, 0xBB, 0xA9, 0x99, 0x99,
+ 0x9A, 0xBC, 0xDE, 0xFF, 0xFD, 0xDC, 0xBB, 0xA9, 0x88, 0x77, 0x88, 0x99,
+ 0xAC, 0xDF, 0xFF, 0xDD, 0xCB, 0xA9, 0x87, 0x76, 0x66, 0x78, 0x8A, 0xBC,
+ 0xEF, 0xFD, 0xDC, 0xB9, 0x87, 0x66, 0x55, 0x56, 0x78, 0x9A, 0xCD, 0xFF,
+ 0xDD, 0xBA, 0x98, 0x76, 0x55, 0x45, 0x56, 0x78, 0xAB, 0xDE, 0xFD, 0xDB,
+ 0xA9, 0x76, 0x55, 0x44, 0x45, 0x67, 0x89, 0xBC, 0xEF, 0xED, 0xBA, 0x97,
+ 0x65, 0x44, 0x44, 0x56, 0x78, 0x9B, 0xCD, 0xEE, 0xDC, 0xA9, 0x86, 0x55,
+ 0x44, 0x55, 0x67, 0x89, 0xBC, 0xDD, 0xEE, 0xCB, 0x98, 0x76, 0x55, 0x55,
+ 0x66, 0x78, 0xAB, 0xCE, 0xEF, 0xFD, 0xBA, 0x98, 0x76, 0x66, 0x66, 0x78,
+ 0x9A, 0xCD, 0xEE, 0xFF, 0xDC, 0xBA, 0x88, 0x77, 0x77, 0x78, 0x9A, 0xBC,
+ 0xDF, 0xEF, 0xFF, 0xDC, 0xBA, 0x98, 0x88, 0x89, 0x9A, 0xBC, 0xCD, 0xEF,
+ 0xFF, 0xFE, 0xDC, 0xBA, 0xA9, 0x99, 0xAA, 0xBB, 0xCD, 0xEF, 0xEF, 0xFF,
+ 0xFE, 0xDC, 0xCB, 0xBB, 0xBB, 0xBC, 0xDD, 0xEF, 0xFE, 0xFF, 0xFF, 0xFE,
+ 0xDD, 0xDC, 0xCC, 0xCD, 0xDD, 0xDF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE,
+ 0xEF, 0xEE, 0xEE, 0xFF, 0xFF, 0xFF, 0xCF, 0xFF, 0xFF, 0xFF, 0xFE, 0xED,
+ 0xDE, 0xEE, 0xEF, 0xEF, 0xB0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xAD, 0xCD, 0xCB, 0xBC, 0xCB, 0xCC, 0xCD, 0xDD, 0xDE, 0xEF, 0xBD, 0xDE,
+ 0xDD, 0xCC, 0xCC, 0xCC, 0xDC, 0xDD, 0xFF, 0xFF, 0xFF, 0xDD, 0xDD, 0xCB,
+ 0xBB, 0xBB, 0xBB, 0xBB, 0xDD, 0xEF, 0xEF, 0xDD, 0xDC, 0xCC, 0xBB, 0xAA,
+ 0xA9, 0xAA, 0xBB, 0xCC, 0xFF, 0xFE, 0xCD, 0xCC, 0xAA, 0x99, 0x98, 0x88,
+ 0x99, 0xAB, 0xCE, 0xFE, 0xCC, 0xCB, 0xBA, 0x98, 0x88, 0x77, 0x77, 0x89,
+ 0xAB, 0xCD, 0xFE, 0xCD, 0xBB, 0x99, 0x87, 0x76, 0x66, 0x77, 0x89, 0xAC,
+ 0xDE, 0xDC, 0xDB, 0xA9, 0x87, 0x66, 0x55, 0x56, 0x67, 0x8A, 0xBC, 0xFD,
+ 0xCC, 0xBA, 0x98, 0x76, 0x55, 0x55, 0x56, 0x78, 0x9B, 0xCD, 0xDC, 0xCB,
+ 0x99, 0x76, 0x55, 0x44, 0x45, 0x67, 0x89, 0xAB, 0xDD, 0xCC, 0xBA, 0x87,
+ 0x65, 0x54, 0x44, 0x56, 0x78, 0x9A, 0xCD, 0xDC, 0xCB, 0xA8, 0x76, 0x65,
+ 0x54, 0x55, 0x67, 0x89, 0xAB, 0xDC, 0xCD, 0xBA, 0x98, 0x76, 0x55, 0x55,
+ 0x66, 0x78, 0x9A, 0xBD, 0xCD, 0xEC, 0xB9, 0x87, 0x76, 0x66, 0x66, 0x78,
+ 0x9A, 0xBB, 0xDC, 0xDE, 0xCB, 0xA9, 0x87, 0x77, 0x77, 0x78, 0x89, 0xAB,
+ 0xCD, 0xCE, 0xFD, 0xCB, 0xA9, 0x98, 0x88, 0x88, 0x99, 0xAB, 0xCC, 0xDD,
+ 0xEF, 0xFD, 0xDB, 0xAA, 0x99, 0x99, 0x9A, 0xAB, 0xCC, 0xDD, 0xDF, 0xFD,
+ 0xFD, 0xCC, 0xBB, 0xAA, 0xAA, 0xBB, 0xBC, 0xDD, 0xFC, 0xEF, 0xEF, 0xED,
+ 0xDD, 0xCC, 0xBC, 0xBC, 0xCC, 0xED, 0xEE, 0xDF, 0xFF, 0xFF, 0xFD, 0xED,
+ 0xDC, 0xDC, 0xDD, 0xDD, 0xDD, 0xED, 0xBE, 0xDD, 0xDD, 0xDD, 0xDC, 0xDC,
+ 0xCD, 0xCC, 0xCC, 0xDD, 0xB0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xBD, 0xDD, 0xDC, 0xCC, 0xCC, 0xCC, 0xCD, 0xDD, 0xEF, 0xFF, 0xDD, 0xFE,
+ 0xDD, 0xCC, 0xCC, 0xCB, 0xCC, 0xDD, 0xDE, 0xFF, 0xFF, 0xDE, 0xDD, 0xCB,
+ 0xBA, 0xAA, 0xAA, 0xBB, 0xCD, 0xDE, 0xFF, 0xFD, 0xDD, 0xCB, 0xAA, 0xA9,
+ 0x99, 0x99, 0xAB, 0xBC, 0xEF, 0xFF, 0xCD, 0xCB, 0xAA, 0x98, 0x88, 0x88,
+ 0x89, 0x9A, 0xBC, 0xDE, 0xEC, 0xCB, 0xAA, 0x98, 0x87, 0x77, 0x77, 0x88,
+ 0x9A, 0xBC, 0xEE, 0xCC, 0xBA, 0x98, 0x77, 0x66, 0x66, 0x67, 0x89, 0xAB,
+ 0xCD, 0xEC, 0xCA, 0x99, 0x87, 0x66, 0x55, 0x56, 0x67, 0x89, 0xAB, 0xDD,
+ 0xCB, 0xA9, 0x87, 0x66, 0x55, 0x55, 0x56, 0x78, 0x9A, 0xBD, 0xDC, 0xBA,
+ 0x98, 0x76, 0x55, 0x55, 0x55, 0x66, 0x78, 0xAB, 0xCD, 0xCB, 0xA9, 0x87,
+ 0x65, 0x55, 0x45, 0x56, 0x67, 0x8A, 0xBC, 0xCC, 0xCA, 0x98, 0x76, 0x55,
+ 0x55, 0x55, 0x67, 0x79, 0xAB, 0xCC, 0xCC, 0xB9, 0x87, 0x76, 0x55, 0x55,
+ 0x66, 0x78, 0x9A, 0xBC, 0xDD, 0xCB, 0xA9, 0x87, 0x66, 0x66, 0x66, 0x77,
+ 0x89, 0xAB, 0xCC, 0xDD, 0xCB, 0x99, 0x87, 0x76, 0x67, 0x77, 0x89, 0xAB,
+ 0xCD, 0xDE, 0xDD, 0xBA, 0x99, 0x88, 0x77, 0x88, 0x89, 0xAA, 0xBC, 0xDD,
+ 0xEF, 0xDC, 0xBA, 0xA9, 0x98, 0x88, 0x99, 0xAA, 0xBC, 0xDD, 0xDF, 0xFF,
+ 0xDC, 0xCB, 0xAA, 0xAA, 0xAA, 0xAB, 0xBC, 0xCD, 0xED, 0xFF, 0xFE, 0xDC,
+ 0xCC, 0xBB, 0xBB, 0xBB, 0xCC, 0xCD, 0xEF, 0xEF, 0xFF, 0xFF, 0xED, 0xDC,
+ 0xCC, 0xCC, 0xCD, 0xDE, 0xEE, 0xFE, 0xDF, 0xFF, 0xFE, 0xED, 0xDD, 0xDC,
+ 0xCD, 0xDD, 0xDD, 0xEE, 0xC0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xBE, 0xDD, 0xCC, 0xCC, 0xCC, 0xCC, 0xCD, 0xDD, 0xEF, 0xEF, 0xCD, 0xFD,
+ 0xED, 0xCC, 0xCC, 0xCC, 0xCC, 0xDD, 0xEE, 0xFF, 0xFF, 0xDE, 0xDC, 0xCB,
+ 0xBB, 0xBA, 0xAB, 0xBB, 0xCC, 0xDD, 0xFF, 0xFD, 0xDD, 0xCB, 0xAA, 0xA9,
+ 0x99, 0x9A, 0xAB, 0xBC, 0xDE, 0xFE, 0xCD, 0xCB, 0xBA, 0x99, 0x88, 0x88,
+ 0x89, 0xAA, 0xBD, 0xEF, 0xDC, 0xDC, 0xAA, 0x98, 0x87, 0x77, 0x77, 0x89,
+ 0x9A, 0xCD, 0xFD, 0xCC, 0xBA, 0x98, 0x77, 0x66, 0x66, 0x77, 0x89, 0xAB,
+ 0xCD, 0xDC, 0xCB, 0xA9, 0x87, 0x66, 0x55, 0x56, 0x67, 0x89, 0xAC, 0xDD,
+ 0xCC, 0xB9, 0x87, 0x66, 0x55, 0x55, 0x56, 0x78, 0x9A, 0xBD, 0xCC, 0xCA,
+ 0x98, 0x76, 0x55, 0x54, 0x55, 0x67, 0x79, 0xAB, 0xDD, 0xCB, 0xA9, 0x87,
+ 0x65, 0x54, 0x45, 0x56, 0x67, 0x8A, 0xBC, 0xCC, 0xCB, 0x98, 0x76, 0x55,
+ 0x55, 0x55, 0x67, 0x89, 0xAB, 0xCC, 0xCC, 0xBA, 0x97, 0x76, 0x55, 0x55,
+ 0x66, 0x78, 0x9A, 0xBC, 0xCD, 0xDB, 0xA9, 0x87, 0x66, 0x66, 0x66, 0x77,
+ 0x89, 0xAB, 0xDC, 0xDD, 0xCB, 0xA9, 0x87, 0x77, 0x77, 0x78, 0x89, 0xAB,
+ 0xCD, 0xDD, 0xED, 0xBA, 0xA9, 0x88, 0x77, 0x88, 0x89, 0x9B, 0xBC, 0xDD,
+ 0xDE, 0xDC, 0xBB, 0xA9, 0x99, 0x99, 0x99, 0xAB, 0xBC, 0xCE, 0xCF, 0xFE,
+ 0xDC, 0xCB, 0xAA, 0xAA, 0xAA, 0xAB, 0xBC, 0xDD, 0xED, 0xFF, 0xEE, 0xED,
+ 0xCB, 0xBB, 0xBB, 0xBB, 0xCC, 0xCE, 0xEE, 0xDF, 0xFF, 0xFF, 0xED, 0xDD,
+ 0xDC, 0xCC, 0xCD, 0xDD, 0xFE, 0xFE, 0xBF, 0xFE, 0xDD, 0xDD, 0xCD, 0xCC,
+ 0xDD, 0xCC, 0xDD, 0xEE, 0xB0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xBF, 0xFF, 0xFE, 0xEE, 0xEE, 0xDE, 0xFF, 0xFF, 0xFF, 0xFF, 0xCF, 0xFF,
+ 0xFF, 0xEE, 0xDD, 0xDD, 0xEE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xED,
+ 0xCC, 0xCB, 0xCC, 0xCD, 0xDF, 0xFF, 0xFF, 0xFF, 0xFE, 0xDC, 0xCB, 0xBA,
+ 0xAA, 0xAB, 0xBC, 0xDF, 0xFF, 0xFF, 0xEE, 0xDC, 0xBB, 0xA9, 0x99, 0x99,
+ 0x9A, 0xBC, 0xDF, 0xFF, 0xFE, 0xED, 0xCB, 0xA9, 0x88, 0x77, 0x88, 0x9A,
+ 0xBC, 0xDF, 0xFF, 0xEE, 0xCB, 0xA9, 0x87, 0x76, 0x66, 0x78, 0x8A, 0xBC,
+ 0xEF, 0xFD, 0xDC, 0xB9, 0x87, 0x66, 0x55, 0x56, 0x78, 0x9A, 0xCD, 0xFF,
+ 0xDD, 0xCA, 0x98, 0x76, 0x55, 0x45, 0x56, 0x78, 0xAB, 0xDF, 0xFE, 0xDC,
+ 0xA9, 0x76, 0x55, 0x44, 0x45, 0x67, 0x89, 0xBC, 0xEF, 0xED, 0xCA, 0x97,
+ 0x65, 0x44, 0x44, 0x56, 0x78, 0x9B, 0xCE, 0xEE, 0xDC, 0xA9, 0x76, 0x55,
+ 0x44, 0x55, 0x67, 0x89, 0xBC, 0xEE, 0xEE, 0xCB, 0x98, 0x76, 0x55, 0x55,
+ 0x66, 0x78, 0xAB, 0xCE, 0xEF, 0xFD, 0xBA, 0x98, 0x76, 0x66, 0x66, 0x78,
+ 0x9A, 0xBD, 0xEF, 0xFF, 0xEC, 0xB9, 0x98, 0x77, 0x77, 0x78, 0x9A, 0xBC,
+ 0xDF, 0xFF, 0xFF, 0xDC, 0xBA, 0x98, 0x88, 0x88, 0x9A, 0xBB, 0xDE, 0xFF,
+ 0xFF, 0xFE, 0xDC, 0xBA, 0xA9, 0x99, 0xAA, 0xBB, 0xCD, 0xFF, 0xFF, 0xFF,
+ 0xFE, 0xEC, 0xCB, 0xBB, 0xBB, 0xBC, 0xCD, 0xEF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xED, 0xDC, 0xCC, 0xCD, 0xDE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE,
+ 0xEE, 0xEE, 0xFF, 0xFF, 0xFF, 0xFF, 0xBF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xEE, 0xFF, 0xFF, 0xFF, 0xC0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xAC, 0xBB, 0xBB, 0xAA, 0xAA, 0xAA, 0xBB, 0xBC, 0xCD, 0xDE, 0xBC, 0xDD,
+ 0xCB, 0xBB, 0xBA, 0xAA, 0xBB, 0xBB, 0xCC, 0xDD, 0xED, 0xCC, 0xCB, 0xBA,
+ 0xAA, 0xA9, 0x99, 0xAA, 0xBB, 0xCC, 0xDE, 0xDB, 0xCB, 0xBA, 0xA9, 0x99,
+ 0x99, 0x99, 0x9A, 0xAB, 0xCD, 0xDC, 0xBC, 0xBA, 0xA9, 0x98, 0x88, 0x88,
+ 0x88, 0x99, 0xAB, 0xCD, 0xCB, 0xBA, 0xA9, 0x88, 0x77, 0x77, 0x77, 0x88,
+ 0x9A, 0xAB, 0xCC, 0xAB, 0xA9, 0x88, 0x77, 0x66, 0x66, 0x67, 0x78, 0x9A,
+ 0xBC, 0xCA, 0xBA, 0x98, 0x77, 0x66, 0x66, 0x66, 0x67, 0x89, 0x9A, 0xBB,
+ 0xAA, 0xA9, 0x87, 0x66, 0x55, 0x55, 0x66, 0x77, 0x89, 0xAB, 0xBA, 0xA9,
+ 0x98, 0x76, 0x65, 0x55, 0x55, 0x66, 0x78, 0x9A, 0xBB, 0xAA, 0x99, 0x87,
+ 0x66, 0x55, 0x55, 0x56, 0x67, 0x89, 0xAB, 0xBB, 0xA9, 0x98, 0x76, 0x65,
+ 0x55, 0x55, 0x67, 0x78, 0x9A, 0xBB, 0xBB, 0xA9, 0x87, 0x66, 0x65, 0x55,
+ 0x66, 0x78, 0x89, 0xAB, 0xBB, 0xBA, 0x98, 0x87, 0x66, 0x66, 0x66, 0x77,
+ 0x89, 0xAA, 0xBB, 0xBB, 0xAA, 0x98, 0x87, 0x77, 0x67, 0x77, 0x88, 0x9A,
+ 0xBB, 0xBC, 0xCB, 0xA9, 0x98, 0x87, 0x77, 0x78, 0x88, 0x9A, 0xAB, 0xCB,
+ 0xCC, 0xCB, 0xAA, 0x99, 0x88, 0x88, 0x89, 0x9A, 0xAB, 0xBC, 0xBD, 0xDC,
+ 0xCB, 0xAA, 0x99, 0x99, 0x99, 0x9A, 0xAB, 0xBC, 0xDC, 0xDE, 0xED, 0xCB,
+ 0xBA, 0xAA, 0xAA, 0xAA, 0xBB, 0xBC, 0xCD, 0xCD, 0xEE, 0xDD, 0xCC, 0xBB,
+ 0xBB, 0xBB, 0xBB, 0xCC, 0xDD, 0xDC, 0xAE, 0xDD, 0xCC, 0xBB, 0xBB, 0xBB,
+ 0xBB, 0xBB, 0xBC, 0xCC, 0xA0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0x9B, 0xBA, 0xAA, 0xAA, 0xA9, 0xAA, 0xAA, 0xBB, 0xBC, 0xDC, 0xAB, 0xCB,
+ 0xBB, 0xAA, 0xAA, 0xAA, 0xAA, 0xAB, 0xBC, 0xCD, 0xED, 0xBB, 0xBB, 0xAA,
+ 0x99, 0x99, 0x99, 0x99, 0xAA, 0xBC, 0xCD, 0xDA, 0xBA, 0xAA, 0x99, 0x98,
+ 0x88, 0x88, 0x99, 0xAA, 0xBC, 0xCC, 0xAB, 0xAA, 0x99, 0x88, 0x87, 0x77,
+ 0x88, 0x89, 0xAA, 0xBC, 0xCA, 0xBA, 0x99, 0x88, 0x77, 0x77, 0x77, 0x88,
+ 0x89, 0xAB, 0xBB, 0xAA, 0x99, 0x88, 0x77, 0x66, 0x66, 0x77, 0x78, 0x89,
+ 0xAB, 0xBA, 0xA9, 0x98, 0x77, 0x66, 0x66, 0x66, 0x67, 0x88, 0x9A, 0xBA,
+ 0x9A, 0x98, 0x87, 0x66, 0x66, 0x56, 0x66, 0x77, 0x89, 0xAB, 0xAA, 0xA9,
+ 0x87, 0x76, 0x65, 0x55, 0x56, 0x66, 0x78, 0x99, 0xAA, 0xAA, 0x98, 0x77,
+ 0x66, 0x55, 0x55, 0x66, 0x67, 0x89, 0x9A, 0xAA, 0xA9, 0x88, 0x76, 0x66,
+ 0x55, 0x56, 0x67, 0x78, 0x9A, 0xAA, 0xAA, 0x99, 0x87, 0x66, 0x66, 0x66,
+ 0x66, 0x77, 0x89, 0x9A, 0xAA, 0xA9, 0x98, 0x77, 0x66, 0x66, 0x66, 0x77,
+ 0x88, 0x9A, 0xBA, 0xBB, 0xA9, 0x88, 0x77, 0x76, 0x67, 0x77, 0x88, 0x99,
+ 0xAB, 0xAB, 0xBA, 0xA9, 0x88, 0x87, 0x77, 0x77, 0x88, 0x89, 0xAA, 0xBA,
+ 0xBB, 0xBA, 0xA9, 0x88, 0x88, 0x88, 0x88, 0x99, 0xAA, 0xBB, 0xAC, 0xDB,
+ 0xBA, 0xA9, 0x99, 0x99, 0x99, 0x99, 0xAA, 0xBB, 0xCB, 0xCD, 0xCC, 0xBB,
+ 0xAA, 0xA9, 0x99, 0x9A, 0xAA, 0xBB, 0xCC, 0xBC, 0xED, 0xDC, 0xBB, 0xBA,
+ 0xAA, 0xAA, 0xBA, 0xBB, 0xCC, 0xCC, 0xAC, 0xCC, 0xCB, 0xBB, 0xAA, 0xAA,
+ 0xAA, 0xAA, 0xBB, 0xBB, 0xA0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0x9B, 0xBA, 0xAA, 0x99, 0x99, 0x99, 0x99, 0xAA, 0xBB, 0xCC, 0xBB, 0xCC,
+ 0xBA, 0xAA, 0xA9, 0x99, 0x9A, 0xAA, 0xBB, 0xCC, 0xDC, 0xBB, 0xBA, 0xAA,
+ 0x99, 0x99, 0x99, 0x99, 0x9A, 0xAB, 0xCC, 0xCA, 0xBA, 0xA9, 0x99, 0x88,
+ 0x88, 0x88, 0x89, 0x9A, 0xAB, 0xCB, 0xAB, 0xA9, 0x98, 0x88, 0x77, 0x77,
+ 0x88, 0x89, 0x9A, 0xAB, 0xBA, 0xAA, 0x98, 0x88, 0x77, 0x77, 0x77, 0x78,
+ 0x89, 0x9A, 0xBA, 0x9A, 0x99, 0x87, 0x77, 0x66, 0x66, 0x67, 0x78, 0x89,
+ 0xAA, 0xA9, 0xA9, 0x88, 0x77, 0x66, 0x66, 0x66, 0x67, 0x78, 0x99, 0xAA,
+ 0x99, 0x98, 0x77, 0x66, 0x66, 0x66, 0x66, 0x77, 0x88, 0x9A, 0xA9, 0x99,
+ 0x87, 0x76, 0x66, 0x55, 0x66, 0x66, 0x78, 0x89, 0xA9, 0x99, 0x98, 0x77,
+ 0x66, 0x65, 0x56, 0x66, 0x77, 0x88, 0x9A, 0x99, 0x99, 0x87, 0x76, 0x66,
+ 0x66, 0x66, 0x67, 0x78, 0x89, 0xA9, 0x99, 0x98, 0x77, 0x76, 0x66, 0x66,
+ 0x66, 0x77, 0x88, 0x9A, 0xAA, 0xA9, 0x88, 0x77, 0x66, 0x66, 0x66, 0x77,
+ 0x88, 0x99, 0xAA, 0xAA, 0x99, 0x88, 0x77, 0x77, 0x67, 0x77, 0x78, 0x89,
+ 0xAA, 0xAA, 0xBA, 0x99, 0x88, 0x77, 0x77, 0x77, 0x88, 0x89, 0x9A, 0xBA,
+ 0xAB, 0xAA, 0x99, 0x88, 0x88, 0x88, 0x88, 0x89, 0x9A, 0xAB, 0xAB, 0xBB,
+ 0xAA, 0x99, 0x98, 0x88, 0x88, 0x99, 0x9A, 0xAB, 0xBB, 0xCC, 0xCB, 0xAA,
+ 0xA9, 0x99, 0x99, 0x99, 0xAA, 0xAB, 0xBC, 0xBC, 0xDC, 0xCB, 0xBA, 0xAA,
+ 0xAA, 0xAA, 0xAA, 0xBB, 0xCC, 0xCB, 0xBC, 0xCB, 0xBB, 0xAA, 0xAA, 0x99,
+ 0x9A, 0xAA, 0xAB, 0xBB, 0x90, 0x00, 0x00, 0x00,
+ },
+ {
+ 0x9B, 0xBB, 0xAA, 0xAA, 0xA9, 0xAA, 0xAA, 0xAB, 0xBB, 0xCC, 0xAB, 0xDC,
+ 0xBB, 0xBA, 0xAA, 0xAA, 0xAA, 0xAB, 0xBB, 0xCC, 0xEC, 0xBC, 0xBB, 0xAA,
+ 0xA9, 0x99, 0x99, 0x99, 0xAB, 0xBC, 0xCD, 0xCB, 0xBB, 0xAA, 0x99, 0x88,
+ 0x88, 0x88, 0x99, 0xAA, 0xBC, 0xCC, 0xAB, 0xAA, 0x99, 0x88, 0x88, 0x78,
+ 0x88, 0x89, 0xAA, 0xBC, 0xBA, 0xBA, 0x99, 0x88, 0x77, 0x77, 0x77, 0x78,
+ 0x89, 0xAA, 0xBB, 0xAA, 0xA9, 0x88, 0x77, 0x66, 0x66, 0x77, 0x78, 0x99,
+ 0xAB, 0xAA, 0xA9, 0x88, 0x77, 0x66, 0x66, 0x66, 0x67, 0x88, 0x9A, 0xBA,
+ 0x9A, 0x98, 0x87, 0x66, 0x65, 0x55, 0x66, 0x77, 0x89, 0xAA, 0xA9, 0xA9,
+ 0x87, 0x76, 0x65, 0x55, 0x56, 0x66, 0x78, 0x99, 0xAA, 0xAA, 0x98, 0x77,
+ 0x66, 0x55, 0x55, 0x66, 0x67, 0x89, 0x9A, 0xAA, 0xA9, 0x88, 0x76, 0x66,
+ 0x55, 0x56, 0x67, 0x78, 0x99, 0xAA, 0xAA, 0x99, 0x87, 0x66, 0x66, 0x66,
+ 0x66, 0x77, 0x89, 0xAB, 0xAA, 0xAA, 0x98, 0x77, 0x76, 0x66, 0x66, 0x77,
+ 0x88, 0x9A, 0xBA, 0xAB, 0xA9, 0x88, 0x77, 0x77, 0x77, 0x77, 0x88, 0x99,
+ 0xAB, 0xAB, 0xBA, 0xA9, 0x88, 0x87, 0x77, 0x77, 0x88, 0x99, 0xAB, 0xBA,
+ 0xBC, 0xBA, 0xA9, 0x98, 0x88, 0x88, 0x88, 0x99, 0xAA, 0xBB, 0xBB, 0xCB,
+ 0xBA, 0xA9, 0x99, 0x98, 0x99, 0x99, 0xAA, 0xBB, 0xCB, 0xCD, 0xCB, 0xBA,
+ 0xAA, 0xAA, 0x99, 0x9A, 0xAA, 0xBB, 0xCD, 0xCD, 0xED, 0xDC, 0xBB, 0xBB,
+ 0xAA, 0xAA, 0xAB, 0xBC, 0xCD, 0xDC, 0xAC, 0xCC, 0xBB, 0xBA, 0xAA, 0xAA,
+ 0xAA, 0xAA, 0xBB, 0xBC, 0xA0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xAC, 0xBB, 0xBB, 0xAA, 0xAA, 0xAA, 0xBB, 0xBB, 0xCC, 0xCE, 0xAC, 0xDD,
+ 0xCB, 0xBB, 0xAA, 0xAA, 0xAB, 0xBB, 0xCC, 0xDE, 0xFE, 0xBC, 0xCB, 0xBA,
+ 0xAA, 0x99, 0x9A, 0xAA, 0xAB, 0xCC, 0xDE, 0xDB, 0xCB, 0xBA, 0xA9, 0x99,
+ 0x98, 0x99, 0x9A, 0xAB, 0xCC, 0xDD, 0xBB, 0xBA, 0x99, 0x88, 0x88, 0x88,
+ 0x88, 0x99, 0xAB, 0xCD, 0xCB, 0xBA, 0xA9, 0x88, 0x77, 0x77, 0x77, 0x88,
+ 0x99, 0xAB, 0xCC, 0xAB, 0xA9, 0x88, 0x77, 0x66, 0x66, 0x67, 0x78, 0x9A,
+ 0xBC, 0xCA, 0xAA, 0x98, 0x77, 0x66, 0x65, 0x66, 0x67, 0x88, 0x9A, 0xBB,
+ 0xAA, 0xA9, 0x87, 0x66, 0x55, 0x55, 0x66, 0x77, 0x89, 0xAB, 0xBA, 0xA9,
+ 0x88, 0x76, 0x65, 0x55, 0x55, 0x67, 0x78, 0x9A, 0xBB, 0xAA, 0x99, 0x87,
+ 0x66, 0x55, 0x55, 0x56, 0x77, 0x89, 0xAB, 0xBA, 0xAA, 0x98, 0x76, 0x65,
+ 0x55, 0x55, 0x67, 0x78, 0x9A, 0xBB, 0xBB, 0xA9, 0x87, 0x76, 0x65, 0x55,
+ 0x66, 0x78, 0x89, 0xAB, 0xBB, 0xBA, 0x98, 0x87, 0x66, 0x66, 0x66, 0x77,
+ 0x89, 0x9A, 0xBB, 0xBB, 0xAA, 0x98, 0x87, 0x77, 0x77, 0x77, 0x88, 0x9A,
+ 0xBB, 0xBC, 0xCB, 0xA9, 0x98, 0x87, 0x77, 0x78, 0x88, 0x9A, 0xAB, 0xCB,
+ 0xCC, 0xCB, 0xA9, 0x99, 0x88, 0x88, 0x89, 0x99, 0xAB, 0xBC, 0xBD, 0xDC,
+ 0xCB, 0xAA, 0x99, 0x99, 0x99, 0x9A, 0xAB, 0xBC, 0xDC, 0xDE, 0xDC, 0xCB,
+ 0xBA, 0xAA, 0xAA, 0xAA, 0xAB, 0xBC, 0xCD, 0xCE, 0xFE, 0xDC, 0xCC, 0xBB,
+ 0xBB, 0xBB, 0xBB, 0xCC, 0xCD, 0xEC, 0xBE, 0xDC, 0xCC, 0xCB, 0xBB, 0xBB,
+ 0xBB, 0xBB, 0xBC, 0xCC, 0xA0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xCE, 0xED, 0xDE, 0xDD, 0xDD, 0xEE, 0xEF, 0xFF, 0xFF, 0xFF, 0xBE, 0xFF,
+ 0xEE, 0xDD, 0xDD, 0xDD, 0xDE, 0xFF, 0xFF, 0xFF, 0xFF, 0xEF, 0xED, 0xDC,
+ 0xCC, 0xBC, 0xCC, 0xCD, 0xEE, 0xFF, 0xFF, 0xFD, 0xED, 0xCC, 0xBB, 0xAA,
+ 0xAA, 0xAB, 0xBC, 0xDF, 0xFF, 0xFF, 0xDD, 0xDC, 0xBA, 0x99, 0x98, 0x99,
+ 0x9A, 0xBC, 0xDF, 0xFF, 0xFD, 0xDC, 0xBA, 0x98, 0x87, 0x77, 0x88, 0x9A,
+ 0xBC, 0xEF, 0xFF, 0xDD, 0xCB, 0x98, 0x87, 0x66, 0x66, 0x78, 0x9A, 0xBD,
+ 0xEF, 0xFD, 0xDC, 0xA9, 0x87, 0x66, 0x55, 0x66, 0x78, 0x9B, 0xCD, 0xFF,
+ 0xDD, 0xBA, 0x97, 0x66, 0x54, 0x45, 0x56, 0x79, 0xAC, 0xDE, 0xFE, 0xDB,
+ 0xA9, 0x76, 0x55, 0x44, 0x45, 0x67, 0x8A, 0xBD, 0xFF, 0xDD, 0xCA, 0x97,
+ 0x65, 0x44, 0x44, 0x56, 0x78, 0xAB, 0xCE, 0xEE, 0xDC, 0xA9, 0x87, 0x65,
+ 0x44, 0x55, 0x67, 0x8A, 0xBD, 0xEF, 0xEE, 0xCB, 0x98, 0x76, 0x55, 0x55,
+ 0x66, 0x79, 0xAB, 0xDE, 0xEF, 0xED, 0xBA, 0x98, 0x76, 0x66, 0x67, 0x78,
+ 0x9A, 0xBD, 0xFE, 0xEF, 0xEC, 0xBA, 0x98, 0x77, 0x77, 0x78, 0x9A, 0xBC,
+ 0xDE, 0xEF, 0xFF, 0xDC, 0xBA, 0x99, 0x88, 0x89, 0x9A, 0xAB, 0xCD, 0xEE,
+ 0xFF, 0xFE, 0xDC, 0xBB, 0xAA, 0xAA, 0xAA, 0xBB, 0xCD, 0xEF, 0xEF, 0xFF,
+ 0xFF, 0xDC, 0xCC, 0xBB, 0xBB, 0xBC, 0xCD, 0xDE, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xED, 0xDD, 0xCD, 0xCD, 0xDD, 0xDF, 0xFF, 0xEF, 0xFF, 0xFF, 0xFF, 0xFE,
+ 0xFE, 0xEE, 0xEF, 0xFF, 0xFF, 0xFF, 0xBF, 0xFF, 0xFF, 0xFF, 0xEE, 0xEE,
+ 0xEE, 0xEF, 0xEF, 0xFF, 0xC0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xCE, 0xDD, 0xDD, 0xCC, 0xCC, 0xCD, 0xDD, 0xEE, 0xEF, 0xFF, 0xCE, 0xFE,
+ 0xDD, 0xDC, 0xCC, 0xCC, 0xCC, 0xCD, 0xEE, 0xFF, 0xFF, 0xDF, 0xED, 0xCB,
+ 0xBA, 0xAA, 0xAA, 0xBB, 0xCC, 0xDF, 0xFF, 0xFE, 0xED, 0xCB, 0xAA, 0x99,
+ 0x99, 0x99, 0xAB, 0xCD, 0xDF, 0xFF, 0xDD, 0xCB, 0xA9, 0x98, 0x88, 0x88,
+ 0x89, 0x9A, 0xBC, 0xEF, 0xFD, 0xDB, 0xB9, 0x98, 0x77, 0x77, 0x77, 0x89,
+ 0xAB, 0xCD, 0xFE, 0xDC, 0xBA, 0x98, 0x77, 0x66, 0x66, 0x67, 0x89, 0xAB,
+ 0xCD, 0xFC, 0xCB, 0x98, 0x77, 0x66, 0x55, 0x56, 0x67, 0x89, 0xAC, 0xDE,
+ 0xCB, 0xA9, 0x87, 0x66, 0x55, 0x55, 0x56, 0x78, 0x9A, 0xBD, 0xDC, 0xCA,
+ 0x98, 0x76, 0x55, 0x54, 0x55, 0x67, 0x79, 0xAB, 0xCD, 0xDC, 0xA9, 0x87,
+ 0x65, 0x54, 0x45, 0x56, 0x78, 0x9A, 0xBD, 0xDC, 0xCA, 0x98, 0x76, 0x55,
+ 0x55, 0x55, 0x67, 0x89, 0xAB, 0xCD, 0xDC, 0xBA, 0x87, 0x66, 0x55, 0x55,
+ 0x66, 0x78, 0x9A, 0xCC, 0xDD, 0xDB, 0xA9, 0x87, 0x66, 0x66, 0x66, 0x78,
+ 0x89, 0xBC, 0xDD, 0xED, 0xCB, 0xA9, 0x87, 0x77, 0x77, 0x78, 0x89, 0xAB,
+ 0xCE, 0xDE, 0xEC, 0xBA, 0xA9, 0x88, 0x88, 0x88, 0x89, 0xAB, 0xCD, 0xEE,
+ 0xFF, 0xEC, 0xBB, 0xA9, 0x99, 0x99, 0x99, 0xAB, 0xCC, 0xDF, 0xEF, 0xFF,
+ 0xDC, 0xCB, 0xBA, 0xAA, 0xAA, 0xAB, 0xBD, 0xDE, 0xFF, 0xFF, 0xFF, 0xED,
+ 0xCC, 0xCB, 0xBB, 0xCC, 0xCC, 0xDF, 0xFF, 0xFF, 0xFF, 0xFF, 0xEE, 0xDD,
+ 0xDC, 0xDD, 0xDD, 0xEE, 0xFF, 0xFF, 0xBF, 0xFF, 0xFF, 0xEF, 0xED, 0xDD,
+ 0xDD, 0xDF, 0xFF, 0xFF, 0xD0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xCE, 0xED, 0xDC, 0xCC, 0xCC, 0xCC, 0xCD, 0xDD, 0xEF, 0xFF, 0xCE, 0xFE,
+ 0xDD, 0xCC, 0xBB, 0xBB, 0xBC, 0xCD, 0xDE, 0xFF, 0xFF, 0xEE, 0xDD, 0xCB,
+ 0xBA, 0xAA, 0xAA, 0xAB, 0xCC, 0xDE, 0xFF, 0xFD, 0xDC, 0xCB, 0xAA, 0x99,
+ 0x99, 0x99, 0xAA, 0xBC, 0xDE, 0xFF, 0xDD, 0xCB, 0xA9, 0x98, 0x88, 0x88,
+ 0x89, 0x9A, 0xBC, 0xDF, 0xED, 0xCB, 0xA9, 0x88, 0x77, 0x77, 0x77, 0x88,
+ 0x9A, 0xBC, 0xEE, 0xCC, 0xBA, 0x98, 0x76, 0x66, 0x66, 0x67, 0x89, 0x9B,
+ 0xCD, 0xEC, 0xBA, 0x98, 0x76, 0x66, 0x55, 0x56, 0x67, 0x89, 0xAB, 0xDD,
+ 0xCB, 0xA9, 0x87, 0x66, 0x55, 0x55, 0x56, 0x78, 0x9A, 0xBC, 0xDC, 0xBA,
+ 0x98, 0x76, 0x55, 0x55, 0x55, 0x67, 0x78, 0xAB, 0xCD, 0xCB, 0xA9, 0x87,
+ 0x65, 0x55, 0x55, 0x56, 0x67, 0x8A, 0xBC, 0xDC, 0xBA, 0x98, 0x76, 0x55,
+ 0x55, 0x55, 0x67, 0x78, 0xAB, 0xCD, 0xCC, 0xA9, 0x87, 0x66, 0x55, 0x55,
+ 0x66, 0x78, 0x9A, 0xBC, 0xDD, 0xCB, 0xA9, 0x87, 0x66, 0x66, 0x66, 0x77,
+ 0x89, 0xAB, 0xCD, 0xDD, 0xCA, 0x98, 0x87, 0x77, 0x67, 0x77, 0x89, 0xAB,
+ 0xCD, 0xDE, 0xEC, 0xBA, 0x99, 0x88, 0x77, 0x78, 0x89, 0xAA, 0xBC, 0xDD,
+ 0xEE, 0xDC, 0xBA, 0xA9, 0x98, 0x89, 0x99, 0xAA, 0xBC, 0xDE, 0xEF, 0xFE,
+ 0xDC, 0xBB, 0xAA, 0xAA, 0xAA, 0xAB, 0xCC, 0xDE, 0xFE, 0xFF, 0xFE, 0xED,
+ 0xCB, 0xBB, 0xBB, 0xBB, 0xCC, 0xDE, 0xFF, 0xEF, 0xFF, 0xFF, 0xED, 0xDC,
+ 0xCC, 0xCC, 0xDD, 0xDE, 0xFF, 0xFF, 0xDF, 0xFF, 0xEE, 0xDD, 0xDD, 0xCD,
+ 0xDD, 0xDE, 0xEE, 0xFF, 0xD0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xBD, 0xDC, 0xDC, 0xCC, 0xBC, 0xCC, 0xCD, 0xDD, 0xDE, 0xEE, 0xBE, 0xFE,
+ 0xDD, 0xCC, 0xCB, 0xBB, 0xCC, 0xCD, 0xEE, 0xFF, 0xFF, 0xDE, 0xDC, 0xCB,
+ 0xBA, 0xAA, 0xAA, 0xBB, 0xCC, 0xEF, 0xFF, 0xFD, 0xDD, 0xCB, 0xAA, 0x99,
+ 0x99, 0x9A, 0xAB, 0xCC, 0xDE, 0xFE, 0xCD, 0xCB, 0xAA, 0x98, 0x88, 0x88,
+ 0x89, 0xAA, 0xCC, 0xEE, 0xEC, 0xCB, 0xA9, 0x98, 0x77, 0x77, 0x77, 0x89,
+ 0xAB, 0xCD, 0xED, 0xCC, 0xBA, 0x98, 0x77, 0x66, 0x66, 0x77, 0x89, 0xAB,
+ 0xCE, 0xDC, 0xBA, 0x98, 0x77, 0x66, 0x55, 0x56, 0x77, 0x8A, 0xAC, 0xDD,
+ 0xCB, 0xA9, 0x87, 0x66, 0x55, 0x55, 0x56, 0x78, 0x9A, 0xBD, 0xDC, 0xBA,
+ 0x98, 0x76, 0x55, 0x44, 0x55, 0x67, 0x89, 0xAB, 0xCC, 0xCB, 0xA9, 0x87,
+ 0x65, 0x54, 0x45, 0x56, 0x78, 0x9A, 0xBC, 0xDC, 0xCA, 0x98, 0x76, 0x55,
+ 0x55, 0x55, 0x67, 0x89, 0xAB, 0xDC, 0xCC, 0xBA, 0x87, 0x76, 0x55, 0x55,
+ 0x66, 0x78, 0x9A, 0xBC, 0xDC, 0xCB, 0xA9, 0x87, 0x76, 0x66, 0x66, 0x78,
+ 0x99, 0xAC, 0xDC, 0xDD, 0xCB, 0xA9, 0x87, 0x77, 0x77, 0x78, 0x89, 0xAB,
+ 0xCD, 0xDD, 0xEC, 0xCA, 0xA9, 0x88, 0x88, 0x88, 0x89, 0xAB, 0xBC, 0xDD,
+ 0xDE, 0xDC, 0xCB, 0xA9, 0x99, 0x99, 0x99, 0xAB, 0xBC, 0xDE, 0xDE, 0xFE,
+ 0xDD, 0xCB, 0xBA, 0xAA, 0xAA, 0xAB, 0xBC, 0xDE, 0xDD, 0xEF, 0xEE, 0xDD,
+ 0xCC, 0xBB, 0xBB, 0xBC, 0xCC, 0xDE, 0xEF, 0xEF, 0xFF, 0xFE, 0xEE, 0xDD,
+ 0xCD, 0xCD, 0xCD, 0xDD, 0xFF, 0xFE, 0xCE, 0xED, 0xEE, 0xDD, 0xDD, 0xCC,
+ 0xDD, 0xCD, 0xDE, 0xDE, 0xC0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xBE, 0xEE, 0xED, 0xDD, 0xDD, 0xDD, 0xDD, 0xEE, 0xEF, 0xFF, 0xBE, 0xFF,
+ 0xFE, 0xDD, 0xDC, 0xCD, 0xDD, 0xEE, 0xFF, 0xFF, 0xFF, 0xEF, 0xED, 0xDC,
+ 0xCB, 0xBB, 0xBB, 0xCC, 0xDD, 0xFF, 0xFF, 0xFD, 0xEE, 0xCC, 0xBB, 0xAA,
+ 0xAA, 0xAA, 0xBC, 0xDE, 0xFF, 0xFF, 0xDD, 0xDC, 0xBA, 0x99, 0x98, 0x89,
+ 0x9A, 0xAB, 0xDD, 0xFF, 0xFD, 0xDC, 0xBA, 0x98, 0x87, 0x77, 0x78, 0x99,
+ 0xAC, 0xDE, 0xFF, 0xDD, 0xCB, 0x98, 0x87, 0x66, 0x66, 0x78, 0x9A, 0xBC,
+ 0xDF, 0xED, 0xDC, 0xA9, 0x87, 0x66, 0x55, 0x56, 0x78, 0x9A, 0xBD, 0xEE,
+ 0xDC, 0xBA, 0x97, 0x66, 0x55, 0x45, 0x56, 0x78, 0xAB, 0xCE, 0xED, 0xDB,
+ 0xA8, 0x76, 0x55, 0x44, 0x45, 0x67, 0x89, 0xBC, 0xDE, 0xDC, 0xBA, 0x87,
+ 0x65, 0x54, 0x44, 0x56, 0x78, 0x9B, 0xCE, 0xDD, 0xDB, 0xA9, 0x76, 0x65,
+ 0x44, 0x55, 0x67, 0x89, 0xBC, 0xDE, 0xDD, 0xCA, 0x98, 0x76, 0x55, 0x55,
+ 0x66, 0x78, 0xAB, 0xDD, 0xEE, 0xEC, 0xBA, 0x98, 0x76, 0x66, 0x67, 0x78,
+ 0x9A, 0xBD, 0xEE, 0xEF, 0xDC, 0xB9, 0x98, 0x77, 0x77, 0x78, 0x9A, 0xBC,
+ 0xDE, 0xEE, 0xFE, 0xDB, 0xAA, 0x98, 0x88, 0x88, 0x9A, 0xAB, 0xCE, 0xFE,
+ 0xFF, 0xED, 0xDB, 0xBA, 0xAA, 0x99, 0xAA, 0xBB, 0xCD, 0xEF, 0xEF, 0xFF,
+ 0xFE, 0xDC, 0xBB, 0xBB, 0xBB, 0xBC, 0xCD, 0xEF, 0xFE, 0xFF, 0xFF, 0xFE,
+ 0xED, 0xCC, 0xCC, 0xCC, 0xDD, 0xEF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xEE,
+ 0xDE, 0xDE, 0xEE, 0xEF, 0xFF, 0xFF, 0xBF, 0xFF, 0xFE, 0xEE, 0xED, 0xDE,
+ 0xED, 0xDE, 0xEE, 0xFE, 0xC0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xAC, 0xCC, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xCC, 0xDD, 0xEE, 0xBC, 0xDD,
+ 0xCC, 0xBB, 0xBB, 0xBB, 0xBB, 0xBC, 0xCD, 0xEE, 0xFE, 0xCD, 0xCB, 0xBA,
+ 0xAA, 0xAA, 0xAA, 0xAA, 0xBB, 0xCD, 0xEE, 0xEC, 0xCB, 0xBA, 0xA9, 0x99,
+ 0x99, 0x99, 0x9A, 0xBB, 0xCD, 0xED, 0xBC, 0xBA, 0x99, 0x88, 0x88, 0x88,
+ 0x89, 0x9A, 0xBB, 0xCD, 0xDB, 0xBA, 0xA9, 0x88, 0x77, 0x77, 0x77, 0x88,
+ 0x9A, 0xBC, 0xDD, 0xBB, 0xA9, 0x88, 0x77, 0x66, 0x66, 0x77, 0x88, 0x9A,
+ 0xBC, 0xCB, 0xBA, 0x98, 0x77, 0x66, 0x55, 0x66, 0x77, 0x89, 0xAB, 0xCC,
+ 0xBB, 0xA9, 0x87, 0x66, 0x55, 0x55, 0x66, 0x78, 0x9A, 0xBC, 0xCB, 0xA9,
+ 0x98, 0x76, 0x65, 0x44, 0x55, 0x67, 0x78, 0x9A, 0xBB, 0xBB, 0xA9, 0x87,
+ 0x66, 0x54, 0x45, 0x56, 0x77, 0x89, 0xAB, 0xBB, 0xBA, 0x98, 0x76, 0x65,
+ 0x55, 0x56, 0x67, 0x78, 0x9A, 0xBB, 0xBB, 0xA9, 0x87, 0x76, 0x65, 0x56,
+ 0x66, 0x78, 0x99, 0xAB, 0xBB, 0xBA, 0x99, 0x87, 0x76, 0x66, 0x66, 0x77,
+ 0x89, 0xAB, 0xCC, 0xCC, 0xBA, 0x98, 0x87, 0x77, 0x77, 0x77, 0x89, 0x9A,
+ 0xBC, 0xCC, 0xCB, 0xBA, 0x99, 0x88, 0x87, 0x88, 0x88, 0x9A, 0xAB, 0xCC,
+ 0xDD, 0xCB, 0xBA, 0x99, 0x98, 0x88, 0x99, 0x9A, 0xAB, 0xCD, 0xCD, 0xED,
+ 0xCB, 0xBA, 0xAA, 0x99, 0x99, 0xAA, 0xAB, 0xCC, 0xDC, 0xDF, 0xED, 0xCC,
+ 0xBB, 0xBA, 0xAA, 0xAB, 0xBB, 0xCC, 0xDD, 0xDE, 0xFE, 0xED, 0xDC, 0xCB,
+ 0xBB, 0xBB, 0xCC, 0xCD, 0xDE, 0xFD, 0xAE, 0xDD, 0xDD, 0xCC, 0xCB, 0xBB,
+ 0xBB, 0xCC, 0xCC, 0xDD, 0xB0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xAB, 0xBA, 0xAA, 0x99, 0x99, 0x99, 0x9A, 0xAA, 0xBB, 0xCC, 0xBB, 0xCC,
+ 0xBA, 0xAA, 0xA9, 0x99, 0x9A, 0xAA, 0xBB, 0xCC, 0xDD, 0xBC, 0xBA, 0xA9,
+ 0x99, 0x99, 0x99, 0x99, 0xAA, 0xBB, 0xCC, 0xCA, 0xBA, 0xA9, 0x98, 0x88,
+ 0x88, 0x88, 0x89, 0x9A, 0xBB, 0xCB, 0xAB, 0xA9, 0x98, 0x88, 0x77, 0x77,
+ 0x88, 0x89, 0x9A, 0xBB, 0xBA, 0xA9, 0x98, 0x87, 0x77, 0x77, 0x77, 0x78,
+ 0x89, 0x9A, 0xBB, 0x9A, 0x98, 0x87, 0x77, 0x66, 0x66, 0x77, 0x78, 0x89,
+ 0xAA, 0xA9, 0xA9, 0x88, 0x77, 0x66, 0x66, 0x66, 0x67, 0x78, 0x9A, 0xAA,
+ 0x99, 0x98, 0x77, 0x66, 0x66, 0x66, 0x66, 0x77, 0x89, 0x9A, 0xA9, 0x99,
+ 0x87, 0x76, 0x66, 0x55, 0x56, 0x67, 0x78, 0x89, 0xAA, 0x99, 0x98, 0x77,
+ 0x66, 0x65, 0x56, 0x66, 0x77, 0x88, 0x9A, 0xA9, 0x99, 0x87, 0x76, 0x66,
+ 0x55, 0x66, 0x67, 0x78, 0x89, 0xAA, 0x9A, 0x98, 0x77, 0x66, 0x66, 0x66,
+ 0x66, 0x77, 0x89, 0x9A, 0xAA, 0xA9, 0x88, 0x77, 0x66, 0x66, 0x66, 0x77,
+ 0x88, 0x9A, 0xAA, 0xAA, 0x99, 0x88, 0x77, 0x77, 0x77, 0x77, 0x88, 0x99,
+ 0xAB, 0xAA, 0xBA, 0x99, 0x88, 0x77, 0x77, 0x77, 0x88, 0x89, 0xAA, 0xBB,
+ 0xBB, 0xAA, 0x99, 0x88, 0x88, 0x88, 0x88, 0x99, 0xAA, 0xBB, 0xBB, 0xCB,
+ 0xAA, 0x99, 0x99, 0x88, 0x89, 0x99, 0xAA, 0xBB, 0xCB, 0xCC, 0xCB, 0xBA,
+ 0xA9, 0x99, 0x99, 0x99, 0xAA, 0xBB, 0xCC, 0xCC, 0xDC, 0xCB, 0xBB, 0xAA,
+ 0xAA, 0xAA, 0xAB, 0xBB, 0xCD, 0xDC, 0xAD, 0xCC, 0xBB, 0xAA, 0xAA, 0xAA,
+ 0xAA, 0xAA, 0xBB, 0xBC, 0xB0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0x9B, 0xAA, 0xA9, 0x99, 0x99, 0x99, 0x99, 0xAA, 0xAB, 0xBC, 0xAB, 0xCB,
+ 0xBA, 0xA9, 0x99, 0x99, 0x99, 0xAA, 0xAB, 0xBC, 0xDC, 0xAB, 0xAA, 0xA9,
+ 0x99, 0x88, 0x88, 0x99, 0x9A, 0xAB, 0xBC, 0xCA, 0xBA, 0x99, 0x98, 0x88,
+ 0x88, 0x88, 0x89, 0x9A, 0xAB, 0xBB, 0xAA, 0xA9, 0x88, 0x87, 0x77, 0x77,
+ 0x78, 0x88, 0x9A, 0xAB, 0xB9, 0xA9, 0x98, 0x87, 0x77, 0x77, 0x77, 0x78,
+ 0x89, 0x9A, 0xBA, 0x9A, 0x98, 0x87, 0x77, 0x66, 0x66, 0x77, 0x78, 0x89,
+ 0xAA, 0xA9, 0x99, 0x87, 0x77, 0x66, 0x66, 0x66, 0x67, 0x78, 0x99, 0xAA,
+ 0x99, 0x88, 0x77, 0x66, 0x66, 0x66, 0x66, 0x77, 0x88, 0x9A, 0xA9, 0x98,
+ 0x87, 0x76, 0x66, 0x66, 0x66, 0x67, 0x78, 0x89, 0xA9, 0x99, 0x88, 0x77,
+ 0x66, 0x66, 0x56, 0x66, 0x77, 0x88, 0x9A, 0x99, 0x98, 0x87, 0x76, 0x66,
+ 0x66, 0x66, 0x67, 0x78, 0x89, 0xA9, 0x99, 0x98, 0x77, 0x66, 0x66, 0x66,
+ 0x66, 0x77, 0x88, 0x9A, 0x99, 0xA9, 0x88, 0x77, 0x66, 0x66, 0x66, 0x77,
+ 0x78, 0x99, 0xAA, 0xAA, 0x99, 0x88, 0x77, 0x77, 0x77, 0x77, 0x78, 0x89,
+ 0xAA, 0xAA, 0xAA, 0x98, 0x88, 0x77, 0x77, 0x77, 0x88, 0x89, 0x9A, 0xBA,
+ 0xAB, 0xAA, 0x99, 0x88, 0x88, 0x88, 0x88, 0x89, 0x9A, 0xAB, 0xAB, 0xBB,
+ 0xAA, 0x99, 0x98, 0x88, 0x88, 0x99, 0x9A, 0xAB, 0xCB, 0xBC, 0xBB, 0xAA,
+ 0x99, 0x99, 0x99, 0x99, 0xAA, 0xAB, 0xBC, 0xBC, 0xDC, 0xCB, 0xBA, 0xAA,
+ 0xAA, 0xAA, 0xAA, 0xBB, 0xCC, 0xCC, 0xBC, 0xCB, 0xBA, 0xAA, 0x99, 0x99,
+ 0x9A, 0xAA, 0xBB, 0xBC, 0xA0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0x9B, 0xBB, 0xAA, 0xA9, 0x99, 0x99, 0xAA, 0xAB, 0xBB, 0xBC, 0xAB, 0xDC,
+ 0xBB, 0xAA, 0xAA, 0x9A, 0xAA, 0xAA, 0xBB, 0xCD, 0xDC, 0xBC, 0xBB, 0xAA,
+ 0x99, 0x99, 0x99, 0x99, 0xAA, 0xBB, 0xCD, 0xCA, 0xBB, 0xA9, 0x98, 0x88,
+ 0x88, 0x88, 0x99, 0x9A, 0xAB, 0xCC, 0xAB, 0xA9, 0x98, 0x88, 0x77, 0x77,
+ 0x88, 0x89, 0x9A, 0xBB, 0xBA, 0xA9, 0x98, 0x87, 0x77, 0x77, 0x77, 0x78,
+ 0x89, 0xAA, 0xBB, 0xAA, 0x99, 0x87, 0x77, 0x66, 0x66, 0x77, 0x78, 0x89,
+ 0xAB, 0xAA, 0xA9, 0x88, 0x77, 0x66, 0x66, 0x66, 0x67, 0x88, 0x9A, 0xAA,
+ 0x9A, 0x98, 0x87, 0x66, 0x66, 0x56, 0x66, 0x77, 0x88, 0x9A, 0xA9, 0xA9,
+ 0x87, 0x76, 0x66, 0x55, 0x56, 0x67, 0x78, 0x89, 0xAA, 0x9A, 0x98, 0x77,
+ 0x66, 0x55, 0x55, 0x66, 0x77, 0x89, 0x9A, 0xA9, 0xA9, 0x87, 0x76, 0x66,
+ 0x55, 0x66, 0x67, 0x78, 0x99, 0xAA, 0xAA, 0x98, 0x87, 0x66, 0x66, 0x66,
+ 0x66, 0x77, 0x89, 0x9A, 0xAA, 0xA9, 0x98, 0x77, 0x66, 0x66, 0x66, 0x77,
+ 0x88, 0x9A, 0xAA, 0xAA, 0xA9, 0x88, 0x77, 0x77, 0x77, 0x77, 0x88, 0x99,
+ 0xAB, 0xAA, 0xBA, 0x99, 0x88, 0x77, 0x77, 0x77, 0x88, 0x99, 0xAB, 0xBB,
+ 0xBB, 0xBA, 0x99, 0x88, 0x88, 0x88, 0x88, 0x99, 0xAA, 0xBB, 0xBB, 0xCB,
+ 0xAA, 0xA9, 0x99, 0x89, 0x99, 0x99, 0xAA, 0xBB, 0xCB, 0xCC, 0xCB, 0xBA,
+ 0xAA, 0x99, 0x99, 0xAA, 0xAA, 0xBB, 0xCC, 0xCD, 0xDD, 0xCC, 0xBB, 0xAA,
+ 0xAA, 0xAA, 0xBB, 0xBC, 0xCD, 0xDC, 0xAD, 0xCB, 0xBB, 0xAA, 0xAA, 0xAA,
+ 0xAA, 0xAA, 0xBB, 0xCC, 0xA0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xAC, 0xCC, 0xBB, 0xBB, 0xAB, 0xAB, 0xBB, 0xBC, 0xCC, 0xDD, 0xAC, 0xDD,
+ 0xCC, 0xBB, 0xBB, 0xBA, 0xBB, 0xBC, 0xCD, 0xDE, 0xFD, 0xCD, 0xCB, 0xBA,
+ 0xAA, 0xA9, 0xAA, 0xAA, 0xBC, 0xCD, 0xDE, 0xDB, 0xCC, 0xBA, 0xA9, 0x99,
+ 0x99, 0x99, 0x9A, 0xBB, 0xCD, 0xED, 0xBC, 0xBA, 0x99, 0x88, 0x88, 0x88,
+ 0x89, 0x9A, 0xAB, 0xCD, 0xCB, 0xBA, 0xA9, 0x88, 0x77, 0x77, 0x77, 0x88,
+ 0x9A, 0xBB, 0xDC, 0xBB, 0xA9, 0x88, 0x77, 0x66, 0x66, 0x77, 0x88, 0x9A,
+ 0xBC, 0xCB, 0xBA, 0x98, 0x77, 0x66, 0x55, 0x66, 0x77, 0x89, 0xAB, 0xCC,
+ 0xAA, 0xA9, 0x87, 0x66, 0x55, 0x55, 0x66, 0x78, 0x99, 0xAB, 0xBA, 0xAA,
+ 0x98, 0x76, 0x65, 0x44, 0x55, 0x67, 0x88, 0x9A, 0xBB, 0xBB, 0xA9, 0x87,
+ 0x66, 0x54, 0x45, 0x56, 0x77, 0x89, 0xAB, 0xBB, 0xBA, 0x98, 0x76, 0x65,
+ 0x55, 0x56, 0x67, 0x88, 0x9A, 0xBB, 0xBB, 0xA9, 0x87, 0x76, 0x65, 0x56,
+ 0x66, 0x78, 0x99, 0xAB, 0xBB, 0xBA, 0x99, 0x87, 0x76, 0x66, 0x66, 0x77,
+ 0x89, 0xAB, 0xCB, 0xCC, 0xBA, 0x98, 0x87, 0x77, 0x77, 0x77, 0x89, 0x9A,
+ 0xBC, 0xCC, 0xCB, 0xBA, 0x98, 0x88, 0x87, 0x88, 0x89, 0x9A, 0xAC, 0xCC,
+ 0xCD, 0xCB, 0xBA, 0x99, 0x98, 0x88, 0x99, 0x9A, 0xAB, 0xCD, 0xCD, 0xDD,
+ 0xCB, 0xBA, 0xAA, 0x99, 0x99, 0xAA, 0xBB, 0xCC, 0xDC, 0xDE, 0xDD, 0xCC,
+ 0xBB, 0xAA, 0xAA, 0xAA, 0xBB, 0xCC, 0xDE, 0xDD, 0xFE, 0xED, 0xDC, 0xCB,
+ 0xBB, 0xBB, 0xCC, 0xCC, 0xDD, 0xED, 0xBD, 0xED, 0xDC, 0xCC, 0xBB, 0xBB,
+ 0xBB, 0xCC, 0xCC, 0xDD, 0xB0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xCF, 0xFF, 0xFF, 0xEF, 0xEE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xCF, 0xFF,
+ 0xFF, 0xFE, 0xEE, 0xEE, 0xEF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xEE,
+ 0xDD, 0xDC, 0xCD, 0xDE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xED, 0xCC, 0xBB,
+ 0xBB, 0xBC, 0xCE, 0xEF, 0xFF, 0xFF, 0xFF, 0xFD, 0xCB, 0xAA, 0x99, 0x9A,
+ 0xAB, 0xCD, 0xFF, 0xFF, 0xFF, 0xFE, 0xCB, 0xA9, 0x88, 0x88, 0x89, 0xAB,
+ 0xCD, 0xFF, 0xFF, 0xEF, 0xDC, 0xA9, 0x87, 0x77, 0x77, 0x88, 0xAB, 0xCE,
+ 0xFF, 0xFE, 0xED, 0xBA, 0x87, 0x66, 0x55, 0x66, 0x79, 0xAC, 0xDF, 0xFF,
+ 0xFF, 0xCB, 0x98, 0x76, 0x54, 0x45, 0x67, 0x8A, 0xBC, 0xFF, 0xFF, 0xEC,
+ 0xB9, 0x86, 0x54, 0x33, 0x45, 0x68, 0x9B, 0xDE, 0xFF, 0xFE, 0xDB, 0x98,
+ 0x75, 0x43, 0x34, 0x56, 0x89, 0xBC, 0xEF, 0xFF, 0xED, 0xBA, 0x87, 0x65,
+ 0x44, 0x55, 0x78, 0x9B, 0xCE, 0xFF, 0xFF, 0xDC, 0xA9, 0x86, 0x65, 0x55,
+ 0x67, 0x8A, 0xBC, 0xEF, 0xFF, 0xFE, 0xDB, 0xA8, 0x87, 0x66, 0x77, 0x89,
+ 0xAC, 0xDF, 0xFF, 0xFF, 0xED, 0xCB, 0xA9, 0x88, 0x88, 0x89, 0xAB, 0xCD,
+ 0xFF, 0xFF, 0xFF, 0xED, 0xCB, 0xA9, 0x99, 0x9A, 0xAB, 0xCD, 0xEF, 0xFF,
+ 0xFF, 0xFF, 0xED, 0xCC, 0xBB, 0xBB, 0xBB, 0xCD, 0xDF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFE, 0xDD, 0xCC, 0xCC, 0xDD, 0xEF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFD, 0xEE, 0xEE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xAF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xC0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xCE, 0xDD, 0xCC, 0xCC, 0xCC, 0xBC, 0xDC, 0xDD, 0xEE, 0xFF, 0xBD, 0xFD,
+ 0xDC, 0xCC, 0xBB, 0xBB, 0xBC, 0xCD, 0xDE, 0xFF, 0xFF, 0xDE, 0xDC, 0xCB,
+ 0xBA, 0xAA, 0xAB, 0xBB, 0xCC, 0xDE, 0xFF, 0xED, 0xDC, 0xBB, 0xAA, 0x99,
+ 0x99, 0x99, 0xAB, 0xBC, 0xDD, 0xEE, 0xCC, 0xCB, 0xA9, 0x98, 0x88, 0x88,
+ 0x89, 0x9A, 0xBC, 0xDF, 0xEC, 0xCB, 0xA9, 0x98, 0x77, 0x77, 0x77, 0x89,
+ 0x9B, 0xCD, 0xFD, 0xCC, 0xBA, 0x98, 0x77, 0x66, 0x66, 0x77, 0x89, 0xAB,
+ 0xCD, 0xDC, 0xCB, 0x98, 0x77, 0x66, 0x55, 0x56, 0x67, 0x89, 0xBC, 0xDD,
+ 0xCB, 0xA9, 0x87, 0x66, 0x55, 0x55, 0x56, 0x78, 0x9A, 0xCD, 0xDC, 0xCA,
+ 0x98, 0x76, 0x55, 0x44, 0x55, 0x67, 0x89, 0xAB, 0xDC, 0xCB, 0xA9, 0x87,
+ 0x65, 0x54, 0x45, 0x56, 0x78, 0x9A, 0xBD, 0xCC, 0xCA, 0x98, 0x76, 0x55,
+ 0x55, 0x55, 0x67, 0x89, 0xAB, 0xCD, 0xCC, 0xB9, 0x87, 0x76, 0x55, 0x55,
+ 0x66, 0x78, 0x9A, 0xBD, 0xDD, 0xDB, 0xA9, 0x87, 0x76, 0x66, 0x67, 0x78,
+ 0x9A, 0xBB, 0xDD, 0xDD, 0xCB, 0xA9, 0x87, 0x77, 0x77, 0x78, 0x89, 0xAB,
+ 0xCD, 0xDD, 0xEC, 0xBA, 0xA9, 0x88, 0x88, 0x88, 0x99, 0xAA, 0xCC, 0xEE,
+ 0xEE, 0xDC, 0xBB, 0xA9, 0x99, 0x99, 0x9A, 0xAB, 0xCC, 0xDE, 0xEE, 0xFE,
+ 0xDC, 0xBB, 0xBA, 0xAA, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, 0xFE, 0xDD,
+ 0xCC, 0xBC, 0xBB, 0xBC, 0xCD, 0xDE, 0xEF, 0xEF, 0xFF, 0xFE, 0xED, 0xDD,
+ 0xCD, 0xCC, 0xCE, 0xDE, 0xFE, 0xFE, 0xAF, 0xFE, 0xEE, 0xDD, 0xDD, 0xCD,
+ 0xDD, 0xDE, 0xEE, 0xFF, 0xD0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xDE, 0xED, 0xDC, 0xCC, 0xCC, 0xCC, 0xCC, 0xDD, 0xEF, 0xFF, 0xCE, 0xFE,
+ 0xDD, 0xCC, 0xBB, 0xBB, 0xBC, 0xCD, 0xDE, 0xFF, 0xFF, 0xEE, 0xDC, 0xCB,
+ 0xAA, 0xAA, 0xAA, 0xAB, 0xBC, 0xDE, 0xFF, 0xFD, 0xDC, 0xBB, 0xA9, 0x99,
+ 0x99, 0x99, 0xAA, 0xBC, 0xDE, 0xFF, 0xDD, 0xCB, 0xA9, 0x98, 0x88, 0x88,
+ 0x89, 0x9A, 0xBC, 0xDE, 0xEC, 0xCB, 0xA9, 0x88, 0x77, 0x77, 0x77, 0x88,
+ 0x9A, 0xBC, 0xDE, 0xCC, 0xA9, 0x88, 0x76, 0x66, 0x66, 0x67, 0x89, 0xAB,
+ 0xCD, 0xDC, 0xBA, 0x98, 0x76, 0x65, 0x55, 0x56, 0x67, 0x89, 0xAB, 0xDD,
+ 0xCB, 0xA9, 0x87, 0x65, 0x55, 0x55, 0x56, 0x78, 0x9A, 0xBC, 0xDC, 0xBA,
+ 0x98, 0x76, 0x55, 0x55, 0x55, 0x67, 0x79, 0xAB, 0xCD, 0xCB, 0xA9, 0x87,
+ 0x65, 0x55, 0x55, 0x56, 0x77, 0x8A, 0xBC, 0xDC, 0xBA, 0x98, 0x76, 0x55,
+ 0x55, 0x55, 0x67, 0x89, 0xAB, 0xCD, 0xCC, 0xA9, 0x87, 0x66, 0x55, 0x55,
+ 0x66, 0x78, 0x9A, 0xBC, 0xDC, 0xCB, 0xA9, 0x87, 0x66, 0x66, 0x66, 0x78,
+ 0x89, 0xAB, 0xDD, 0xDD, 0xBA, 0x98, 0x87, 0x77, 0x77, 0x78, 0x89, 0xAB,
+ 0xCD, 0xDD, 0xDC, 0xBA, 0x99, 0x88, 0x77, 0x88, 0x89, 0xAB, 0xCD, 0xEE,
+ 0xEE, 0xDC, 0xBA, 0xA9, 0x98, 0x89, 0x99, 0xAA, 0xBC, 0xDE, 0xEE, 0xFE,
+ 0xDC, 0xBB, 0xAA, 0xAA, 0xAA, 0xAB, 0xCC, 0xDE, 0xFF, 0xFF, 0xFE, 0xDD,
+ 0xCB, 0xBB, 0xBB, 0xBB, 0xCD, 0xDE, 0xEF, 0xFF, 0xFF, 0xFF, 0xED, 0xDC,
+ 0xCC, 0xCD, 0xDD, 0xEE, 0xFF, 0xFF, 0xCF, 0xFF, 0xFE, 0xDD, 0xDD, 0xDD,
+ 0xDD, 0xDE, 0xEE, 0xFF, 0xD0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xDF, 0xFD, 0xDD, 0xCC, 0xCC, 0xCC, 0xCD, 0xEE, 0xFF, 0xFF, 0xBF, 0xFE,
+ 0xED, 0xCC, 0xCC, 0xBB, 0xCC, 0xDD, 0xDF, 0xFF, 0xFF, 0xFE, 0xED, 0xCB,
+ 0xBA, 0xAA, 0xAA, 0xBB, 0xCC, 0xEF, 0xFF, 0xFD, 0xED, 0xCB, 0xAA, 0x99,
+ 0x99, 0x99, 0xAB, 0xBC, 0xDE, 0xFF, 0xDD, 0xCB, 0xA9, 0x98, 0x88, 0x88,
+ 0x89, 0xAA, 0xBD, 0xDF, 0xFD, 0xDB, 0xA9, 0x98, 0x77, 0x77, 0x77, 0x89,
+ 0x9B, 0xCD, 0xFF, 0xCC, 0xBA, 0x98, 0x76, 0x66, 0x66, 0x77, 0x89, 0xAB,
+ 0xCD, 0xEC, 0xBB, 0x98, 0x77, 0x65, 0x55, 0x56, 0x67, 0x89, 0xBC, 0xDE,
+ 0xCB, 0xA9, 0x87, 0x65, 0x55, 0x55, 0x56, 0x78, 0x9A, 0xBD, 0xDC, 0xCA,
+ 0x98, 0x76, 0x55, 0x54, 0x55, 0x67, 0x89, 0xAB, 0xCD, 0xCB, 0xA9, 0x87,
+ 0x65, 0x55, 0x45, 0x56, 0x78, 0x9A, 0xBD, 0xDC, 0xCA, 0x98, 0x76, 0x55,
+ 0x55, 0x55, 0x67, 0x89, 0xAB, 0xDD, 0xDC, 0xA9, 0x87, 0x66, 0x55, 0x55,
+ 0x66, 0x78, 0x9A, 0xBD, 0xDD, 0xCB, 0xA9, 0x87, 0x66, 0x66, 0x66, 0x78,
+ 0x99, 0xBC, 0xDD, 0xDD, 0xCA, 0x99, 0x87, 0x77, 0x77, 0x78, 0x89, 0xAB,
+ 0xCD, 0xEE, 0xEC, 0xBA, 0x99, 0x88, 0x88, 0x88, 0x89, 0xAB, 0xCD, 0xDD,
+ 0xFF, 0xDC, 0xBA, 0xA9, 0x99, 0x99, 0x99, 0xAB, 0xBC, 0xDE, 0xFF, 0xFF,
+ 0xDD, 0xCB, 0xBA, 0xAA, 0xAA, 0xBB, 0xCD, 0xDE, 0xFF, 0xFF, 0xFE, 0xED,
+ 0xCC, 0xCB, 0xBB, 0xBC, 0xCD, 0xEE, 0xEF, 0xFF, 0xFF, 0xFF, 0xFE, 0xDD,
+ 0xDC, 0xDD, 0xDD, 0xEE, 0xFF, 0xFF, 0xCF, 0xFF, 0xFE, 0xEE, 0xDD, 0xDD,
+ 0xDD, 0xDE, 0xEF, 0xFF, 0xD0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xCF, 0xEE, 0xEE, 0xDD, 0xDE, 0xDE, 0xEE, 0xEE, 0xFE, 0xEF, 0xAF, 0xFF,
+ 0xFE, 0xED, 0xDD, 0xDD, 0xDE, 0xEF, 0xFF, 0xFF, 0xFF, 0xEF, 0xFE, 0xDC,
+ 0xCC, 0xCB, 0xBC, 0xCD, 0xDE, 0xFF, 0xFF, 0xFE, 0xFE, 0xDC, 0xBB, 0xAA,
+ 0xAA, 0xAB, 0xCC, 0xDE, 0xFF, 0xFF, 0xEE, 0xDC, 0xBA, 0xA9, 0x99, 0x99,
+ 0x9A, 0xBC, 0xDE, 0xFF, 0xFE, 0xEC, 0xBA, 0x99, 0x87, 0x77, 0x88, 0x9A,
+ 0xBC, 0xDF, 0xFF, 0xED, 0xCB, 0xA9, 0x87, 0x66, 0x66, 0x78, 0x9A, 0xBD,
+ 0xEF, 0xFD, 0xDC, 0xA9, 0x87, 0x65, 0x55, 0x66, 0x78, 0x9B, 0xCD, 0xFF,
+ 0xDD, 0xBA, 0x98, 0x66, 0x54, 0x45, 0x56, 0x89, 0xAC, 0xDE, 0xED, 0xDB,
+ 0xA9, 0x76, 0x54, 0x44, 0x45, 0x67, 0x9A, 0xBD, 0xEE, 0xED, 0xBA, 0x97,
+ 0x65, 0x44, 0x44, 0x56, 0x78, 0xAB, 0xDE, 0xFE, 0xDC, 0xA9, 0x87, 0x65,
+ 0x44, 0x55, 0x67, 0x9A, 0xBD, 0xEE, 0xED, 0xCB, 0x98, 0x76, 0x55, 0x55,
+ 0x67, 0x89, 0xAC, 0xDE, 0xEE, 0xED, 0xBA, 0x98, 0x76, 0x66, 0x67, 0x78,
+ 0x9B, 0xCD, 0xFE, 0xFF, 0xDC, 0xBA, 0x98, 0x87, 0x77, 0x88, 0x9A, 0xBC,
+ 0xDF, 0xFF, 0xFE, 0xDC, 0xBA, 0x99, 0x98, 0x99, 0x9A, 0xBC, 0xDF, 0xFF,
+ 0xFF, 0xFE, 0xDC, 0xBB, 0xAA, 0xAA, 0xAB, 0xBC, 0xDE, 0xFF, 0xFF, 0xFF,
+ 0xFE, 0xDD, 0xCC, 0xBB, 0xBB, 0xCC, 0xDD, 0xEF, 0xFF, 0xFF, 0xFF, 0xFE,
+ 0xEE, 0xDD, 0xDC, 0xDD, 0xDE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xEE,
+ 0xEE, 0xEE, 0xEF, 0xFF, 0xFF, 0xFF, 0xCF, 0xFF, 0xFF, 0xFF, 0xFE, 0xEE,
+ 0xEE, 0xFF, 0xFF, 0xFF, 0xC0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xBC, 0xCC, 0xBB, 0xBA, 0xAA, 0xAA, 0xBB, 0xBC, 0xCD, 0xDE, 0xBC, 0xDC,
+ 0xCB, 0xBB, 0xAA, 0xAA, 0xAB, 0xBB, 0xCD, 0xDE, 0xFE, 0xCC, 0xCB, 0xBA,
+ 0xAA, 0x99, 0x99, 0xAA, 0xBB, 0xCC, 0xDE, 0xEB, 0xCB, 0xAA, 0x99, 0x98,
+ 0x88, 0x99, 0x9A, 0xAB, 0xCD, 0xDD, 0xBB, 0xBA, 0x99, 0x88, 0x88, 0x88,
+ 0x88, 0x9A, 0xAB, 0xCD, 0xDB, 0xBA, 0x99, 0x88, 0x77, 0x77, 0x77, 0x88,
+ 0x9A, 0xAB, 0xCC, 0xAB, 0xA9, 0x88, 0x77, 0x66, 0x66, 0x77, 0x88, 0x9A,
+ 0xBC, 0xCA, 0xAA, 0x98, 0x77, 0x66, 0x66, 0x66, 0x77, 0x89, 0xAB, 0xCC,
+ 0xAA, 0x99, 0x87, 0x66, 0x55, 0x55, 0x66, 0x78, 0x89, 0xAB, 0xBA, 0xA9,
+ 0x88, 0x76, 0x65, 0x44, 0x55, 0x67, 0x88, 0x9A, 0xBB, 0xAA, 0x98, 0x87,
+ 0x66, 0x54, 0x45, 0x56, 0x77, 0x89, 0xAB, 0xBB, 0xA9, 0x98, 0x76, 0x65,
+ 0x55, 0x56, 0x67, 0x88, 0x9A, 0xBB, 0xBB, 0xA9, 0x87, 0x76, 0x65, 0x56,
+ 0x66, 0x78, 0x99, 0xAB, 0xBB, 0xBA, 0x98, 0x87, 0x76, 0x66, 0x67, 0x77,
+ 0x89, 0xAA, 0xBB, 0xBB, 0xBA, 0x98, 0x87, 0x77, 0x77, 0x77, 0x89, 0x9A,
+ 0xBC, 0xCC, 0xCB, 0xAA, 0x98, 0x88, 0x87, 0x88, 0x89, 0x9A, 0xBB, 0xCC,
+ 0xCD, 0xCB, 0xAA, 0x99, 0x88, 0x88, 0x99, 0x9A, 0xAB, 0xCC, 0xCD, 0xDD,
+ 0xCB, 0xAA, 0xA9, 0x99, 0x99, 0xAA, 0xAB, 0xCC, 0xDD, 0xDE, 0xDC, 0xCB,
+ 0xBB, 0xAA, 0xAA, 0xAB, 0xBB, 0xCC, 0xDE, 0xDE, 0xFE, 0xED, 0xCC, 0xBB,
+ 0xBB, 0xBB, 0xBC, 0xCD, 0xDE, 0xED, 0xAE, 0xDD, 0xDC, 0xCC, 0xBB, 0xBB,
+ 0xBB, 0xCC, 0xCD, 0xDD, 0xB0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xAB, 0xBA, 0xAA, 0x99, 0x99, 0x99, 0x9A, 0xAA, 0xBB, 0xCC, 0xAB, 0xCB,
+ 0xBA, 0xAA, 0x99, 0x99, 0x9A, 0xAA, 0xBB, 0xCC, 0xDD, 0xBB, 0xBA, 0xA9,
+ 0x99, 0x98, 0x89, 0x99, 0xAA, 0xBB, 0xCD, 0xCA, 0xBA, 0xA9, 0x98, 0x88,
+ 0x88, 0x88, 0x89, 0x9A, 0xBB, 0xCC, 0xAB, 0xA9, 0x98, 0x87, 0x77, 0x77,
+ 0x88, 0x89, 0x9A, 0xBB, 0xBA, 0xA9, 0x98, 0x87, 0x77, 0x77, 0x77, 0x78,
+ 0x89, 0x9A, 0xBB, 0x9A, 0x98, 0x87, 0x77, 0x66, 0x66, 0x67, 0x78, 0x89,
+ 0xAB, 0xA9, 0x99, 0x87, 0x77, 0x66, 0x66, 0x66, 0x67, 0x88, 0x9A, 0xAA,
+ 0x99, 0x98, 0x77, 0x66, 0x66, 0x66, 0x66, 0x77, 0x89, 0x9A, 0xA9, 0x99,
+ 0x87, 0x76, 0x66, 0x55, 0x56, 0x67, 0x78, 0x89, 0xAA, 0x99, 0x98, 0x77,
+ 0x66, 0x65, 0x55, 0x66, 0x77, 0x88, 0x9A, 0xA9, 0x99, 0x87, 0x76, 0x66,
+ 0x65, 0x66, 0x67, 0x78, 0x99, 0xAA, 0x9A, 0x98, 0x87, 0x76, 0x66, 0x66,
+ 0x66, 0x77, 0x89, 0x9A, 0xAA, 0xA9, 0x88, 0x77, 0x66, 0x66, 0x66, 0x77,
+ 0x88, 0x9A, 0xAA, 0xAA, 0xA9, 0x88, 0x77, 0x77, 0x77, 0x77, 0x88, 0x99,
+ 0xAB, 0xAA, 0xBA, 0x99, 0x88, 0x77, 0x77, 0x77, 0x88, 0x89, 0xAA, 0xBB,
+ 0xBB, 0xBA, 0x99, 0x88, 0x88, 0x88, 0x88, 0x99, 0xAA, 0xBB, 0xBB, 0xCB,
+ 0xAA, 0xA9, 0x99, 0x88, 0x89, 0x99, 0xAA, 0xBB, 0xCB, 0xCD, 0xCB, 0xAA,
+ 0xA9, 0x99, 0x99, 0x9A, 0xAA, 0xBB, 0xCC, 0xCD, 0xDC, 0xCB, 0xBB, 0xAA,
+ 0xAA, 0xAA, 0xAB, 0xBC, 0xCD, 0xDC, 0xAC, 0xCC, 0xBB, 0xAA, 0xAA, 0xAA,
+ 0xAA, 0xAB, 0xBB, 0xCC, 0xB0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xAB, 0xBA, 0xA9, 0x99, 0x99, 0x99, 0x99, 0xAA, 0xAB, 0xCC, 0xAB, 0xCB,
+ 0xBA, 0xAA, 0x99, 0x99, 0x99, 0xAA, 0xAB, 0xCC, 0xDC, 0xBB, 0xBA, 0xA9,
+ 0x99, 0x88, 0x88, 0x99, 0x9A, 0xAB, 0xCC, 0xCA, 0xBA, 0x99, 0x98, 0x88,
+ 0x88, 0x88, 0x89, 0x9A, 0xAB, 0xBB, 0xAA, 0xA9, 0x88, 0x87, 0x77, 0x77,
+ 0x78, 0x89, 0x9A, 0xAB, 0xB9, 0xA9, 0x98, 0x87, 0x77, 0x77, 0x77, 0x78,
+ 0x89, 0x9A, 0xBB, 0x9A, 0x98, 0x87, 0x76, 0x66, 0x66, 0x77, 0x78, 0x89,
+ 0xAA, 0xA9, 0x99, 0x87, 0x76, 0x66, 0x66, 0x66, 0x67, 0x78, 0x99, 0xAA,
+ 0x99, 0x88, 0x77, 0x66, 0x66, 0x66, 0x66, 0x77, 0x88, 0x9A, 0xA9, 0x98,
+ 0x87, 0x76, 0x66, 0x65, 0x66, 0x67, 0x78, 0x89, 0xAA, 0x99, 0x88, 0x77,
+ 0x66, 0x65, 0x56, 0x66, 0x77, 0x88, 0x9A, 0xA9, 0x99, 0x87, 0x76, 0x66,
+ 0x66, 0x66, 0x67, 0x78, 0x89, 0xAA, 0x99, 0x98, 0x77, 0x76, 0x66, 0x66,
+ 0x66, 0x77, 0x89, 0x9A, 0xA9, 0xA9, 0x88, 0x77, 0x76, 0x66, 0x66, 0x77,
+ 0x88, 0x99, 0xAA, 0xAA, 0x99, 0x88, 0x77, 0x77, 0x77, 0x77, 0x78, 0x89,
+ 0xAB, 0xAA, 0xAA, 0x99, 0x88, 0x77, 0x77, 0x77, 0x88, 0x89, 0x9A, 0xBA,
+ 0xBB, 0xAA, 0x99, 0x88, 0x88, 0x88, 0x88, 0x89, 0x9A, 0xBB, 0xBB, 0xCB,
+ 0xAA, 0x99, 0x98, 0x88, 0x88, 0x99, 0x9A, 0xBB, 0xCB, 0xCC, 0xCB, 0xAA,
+ 0xA9, 0x99, 0x99, 0x99, 0xAA, 0xBB, 0xCC, 0xCC, 0xDC, 0xCB, 0xBA, 0xAA,
+ 0xAA, 0xAA, 0xAA, 0xBB, 0xCD, 0xDC, 0xBC, 0xCB, 0xBA, 0xAA, 0xAA, 0xAA,
+ 0xAA, 0xAA, 0xBB, 0xCC, 0xB0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xAB, 0xBB, 0xAA, 0x99, 0x99, 0x99, 0x9A, 0xAA, 0xBB, 0xCC, 0xAB, 0xCC,
+ 0xBB, 0xAA, 0x99, 0x99, 0xAA, 0xAA, 0xBB, 0xCD, 0xDC, 0xBC, 0xBB, 0xA9,
+ 0x99, 0x99, 0x99, 0x99, 0xAA, 0xBB, 0xCD, 0xCA, 0xBA, 0xA9, 0x98, 0x88,
+ 0x88, 0x88, 0x89, 0x9A, 0xBB, 0xCC, 0xAB, 0xA9, 0x98, 0x87, 0x77, 0x77,
+ 0x88, 0x89, 0x9A, 0xBB, 0xBA, 0xAA, 0x98, 0x87, 0x77, 0x77, 0x77, 0x78,
+ 0x89, 0xAA, 0xBB, 0x9A, 0x98, 0x87, 0x77, 0x66, 0x66, 0x67, 0x78, 0x89,
+ 0xAB, 0xA9, 0xA9, 0x88, 0x77, 0x66, 0x66, 0x66, 0x67, 0x88, 0x9A, 0xAA,
+ 0x99, 0x98, 0x77, 0x66, 0x66, 0x56, 0x66, 0x77, 0x89, 0x9A, 0xA9, 0x99,
+ 0x87, 0x76, 0x66, 0x55, 0x56, 0x67, 0x78, 0x99, 0xAA, 0x99, 0x98, 0x77,
+ 0x66, 0x65, 0x55, 0x66, 0x77, 0x88, 0x9A, 0xA9, 0xA9, 0x87, 0x76, 0x66,
+ 0x56, 0x66, 0x67, 0x78, 0x99, 0xAA, 0x9A, 0x98, 0x87, 0x66, 0x66, 0x66,
+ 0x66, 0x77, 0x89, 0x9A, 0xAA, 0xA9, 0x88, 0x77, 0x66, 0x66, 0x66, 0x77,
+ 0x88, 0x9A, 0xAA, 0xAA, 0xA9, 0x88, 0x77, 0x77, 0x77, 0x77, 0x88, 0x99,
+ 0xAB, 0xAA, 0xBA, 0x99, 0x88, 0x77, 0x77, 0x77, 0x88, 0x99, 0xAA, 0xBB,
+ 0xBB, 0xBA, 0x99, 0x88, 0x88, 0x88, 0x88, 0x99, 0xAA, 0xBC, 0xBB, 0xCB,
+ 0xAA, 0xA9, 0x99, 0x88, 0x99, 0x99, 0xAA, 0xBB, 0xCB, 0xCD, 0xCC, 0xBA,
+ 0xAA, 0xA9, 0x99, 0x9A, 0xAA, 0xBB, 0xCD, 0xCC, 0xDC, 0xCC, 0xBB, 0xAA,
+ 0xAA, 0xAA, 0xAB, 0xBB, 0xCC, 0xDC, 0xAD, 0xCC, 0xBB, 0xAA, 0xAA, 0xAA,
+ 0xAA, 0xAB, 0xBB, 0xCC, 0xB0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xBC, 0xCB, 0xBB, 0xAA, 0xAA, 0xAA, 0xAB, 0xBC, 0xCC, 0xDD, 0xAC, 0xDC,
+ 0xCB, 0xBA, 0xAA, 0xAA, 0xAA, 0xBB, 0xCC, 0xDE, 0xEE, 0xCC, 0xCB, 0xAA,
+ 0xA9, 0x99, 0x99, 0xAA, 0xAB, 0xBC, 0xDE, 0xEB, 0xCB, 0xAA, 0x99, 0x98,
+ 0x88, 0x89, 0x9A, 0xAB, 0xBC, 0xDD, 0xBB, 0xAA, 0x99, 0x88, 0x87, 0x78,
+ 0x88, 0x99, 0xAB, 0xCD, 0xCB, 0xBA, 0x99, 0x87, 0x77, 0x77, 0x77, 0x88,
+ 0x99, 0xAB, 0xCC, 0xAB, 0xA9, 0x87, 0x77, 0x66, 0x66, 0x77, 0x88, 0x9A,
+ 0xBC, 0xCA, 0xA9, 0x98, 0x77, 0x66, 0x56, 0x66, 0x77, 0x89, 0x9A, 0xBB,
+ 0xAA, 0x98, 0x87, 0x66, 0x55, 0x55, 0x66, 0x78, 0x89, 0xAB, 0xBA, 0xA9,
+ 0x87, 0x76, 0x55, 0x55, 0x55, 0x67, 0x78, 0x9A, 0xBB, 0xAA, 0x98, 0x77,
+ 0x65, 0x55, 0x55, 0x56, 0x77, 0x89, 0xAB, 0xBA, 0xA9, 0x88, 0x76, 0x65,
+ 0x55, 0x56, 0x67, 0x78, 0x9A, 0xBB, 0xAA, 0xA9, 0x87, 0x76, 0x65, 0x56,
+ 0x66, 0x78, 0x89, 0xAB, 0xBB, 0xBA, 0x98, 0x87, 0x76, 0x66, 0x66, 0x77,
+ 0x89, 0xAA, 0xBB, 0xBB, 0xAA, 0x98, 0x87, 0x77, 0x77, 0x77, 0x88, 0x9A,
+ 0xBC, 0xBC, 0xCB, 0xA9, 0x98, 0x88, 0x77, 0x78, 0x89, 0x9A, 0xAB, 0xCC,
+ 0xCC, 0xCB, 0xA9, 0x99, 0x88, 0x88, 0x89, 0x9A, 0xAB, 0xCC, 0xCD, 0xDC,
+ 0xBB, 0xAA, 0x99, 0x99, 0x99, 0x9A, 0xAB, 0xBC, 0xDD, 0xDE, 0xDC, 0xCB,
+ 0xBA, 0xAA, 0xAA, 0xAA, 0xBB, 0xCC, 0xDE, 0xDE, 0xEE, 0xDD, 0xCC, 0xBB,
+ 0xBB, 0xBB, 0xBC, 0xCC, 0xDE, 0xED, 0xBE, 0xDD, 0xCC, 0xCB, 0xBB, 0xBB,
+ 0xBB, 0xBC, 0xCC, 0xDE, 0xC0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xDF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xBF, 0xFF,
+ 0xFF, 0xFE, 0xED, 0xDE, 0xEF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xED,
+ 0xCC, 0xCC, 0xCC, 0xDD, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xEC, 0xCB, 0xBA,
+ 0xAA, 0xBB, 0xCD, 0xEF, 0xFF, 0xFF, 0xFF, 0xDD, 0xBB, 0xA9, 0x99, 0x99,
+ 0xAA, 0xBD, 0xEF, 0xFF, 0xFF, 0xFD, 0xCB, 0xA9, 0x88, 0x77, 0x88, 0x9A,
+ 0xCD, 0xFF, 0xFF, 0xFE, 0xDB, 0xA9, 0x87, 0x66, 0x67, 0x78, 0x9A, 0xCD,
+ 0xFF, 0xFF, 0xDC, 0xB9, 0x87, 0x65, 0x55, 0x56, 0x78, 0xAB, 0xDF, 0xFF,
+ 0xFD, 0xCA, 0x98, 0x65, 0x54, 0x45, 0x56, 0x89, 0xBC, 0xEF, 0xFE, 0xDC,
+ 0xA9, 0x76, 0x54, 0x44, 0x45, 0x67, 0x9A, 0xCD, 0xFF, 0xFE, 0xCA, 0x97,
+ 0x65, 0x44, 0x44, 0x56, 0x79, 0xAC, 0xDF, 0xFF, 0xEC, 0xB9, 0x87, 0x55,
+ 0x44, 0x55, 0x67, 0x9A, 0xCD, 0xFF, 0xFF, 0xDB, 0xA8, 0x76, 0x55, 0x55,
+ 0x67, 0x89, 0xAC, 0xDF, 0xFF, 0xFD, 0xCB, 0x98, 0x76, 0x66, 0x67, 0x89,
+ 0xAB, 0xCF, 0xFF, 0xFF, 0xFD, 0xCA, 0x98, 0x87, 0x77, 0x89, 0x9A, 0xCD,
+ 0xFF, 0xFF, 0xFF, 0xEC, 0xBB, 0xA9, 0x99, 0x99, 0xAA, 0xBC, 0xDF, 0xFF,
+ 0xFF, 0xFF, 0xDD, 0xCB, 0xBA, 0xAA, 0xAB, 0xCC, 0xDF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFE, 0xDC, 0xCC, 0xCC, 0xCD, 0xEF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFD, 0xDD, 0xDE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xAF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xE0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xCE, 0xED, 0xDD, 0xDC, 0xCC, 0xCC, 0xCD, 0xDE, 0xEE, 0xDE, 0xAF, 0xFE,
+ 0xDD, 0xDC, 0xCC, 0xCC, 0xCC, 0xDD, 0xEF, 0xFF, 0xFF, 0xEF, 0xDD, 0xCB,
+ 0xBB, 0xAA, 0xAB, 0xBB, 0xCD, 0xEE, 0xFF, 0xEE, 0xED, 0xCB, 0xAA, 0x99,
+ 0x99, 0x9A, 0xAB, 0xCD, 0xEE, 0xFF, 0xDD, 0xCB, 0xA9, 0x98, 0x88, 0x88,
+ 0x99, 0xAB, 0xCD, 0xEF, 0xED, 0xDC, 0xA9, 0x98, 0x77, 0x77, 0x77, 0x89,
+ 0xAB, 0xCE, 0xEE, 0xCC, 0xBA, 0x98, 0x77, 0x66, 0x66, 0x77, 0x89, 0xAB,
+ 0xDE, 0xEC, 0xCB, 0x98, 0x76, 0x65, 0x55, 0x56, 0x78, 0x9A, 0xBC, 0xDD,
+ 0xCC, 0xA9, 0x87, 0x65, 0x55, 0x55, 0x56, 0x78, 0x9B, 0xCD, 0xDC, 0xCA,
+ 0x98, 0x76, 0x55, 0x44, 0x55, 0x67, 0x89, 0xAC, 0xDD, 0xCC, 0xA9, 0x87,
+ 0x65, 0x54, 0x45, 0x56, 0x78, 0x9A, 0xCD, 0xDC, 0xCB, 0x98, 0x76, 0x55,
+ 0x55, 0x55, 0x67, 0x89, 0xAC, 0xDE, 0xDC, 0xBA, 0x98, 0x76, 0x55, 0x55,
+ 0x66, 0x78, 0x9B, 0xCD, 0xDD, 0xDB, 0xA9, 0x87, 0x76, 0x66, 0x66, 0x78,
+ 0x9A, 0xBC, 0xDD, 0xDD, 0xCB, 0xA9, 0x87, 0x77, 0x77, 0x78, 0x99, 0xAB,
+ 0xDE, 0xED, 0xED, 0xCB, 0xA9, 0x98, 0x88, 0x88, 0x99, 0xAB, 0xCD, 0xEE,
+ 0xDE, 0xEC, 0xCB, 0xAA, 0x99, 0x99, 0x9A, 0xAB, 0xCC, 0xEF, 0xEE, 0xFE,
+ 0xED, 0xCB, 0xBB, 0xAA, 0xAB, 0xBB, 0xCD, 0xEF, 0xFF, 0xFF, 0xFF, 0xED,
+ 0xDC, 0xCC, 0xCC, 0xCC, 0xCD, 0xEF, 0xFF, 0xFE, 0xFF, 0xFF, 0xEE, 0xED,
+ 0xDD, 0xDD, 0xDE, 0xEE, 0xFF, 0xFF, 0xAF, 0xEE, 0xEE, 0xED, 0xDD, 0xDD,
+ 0xDD, 0xED, 0xEF, 0xFF, 0xD0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xCE, 0xDD, 0xCC, 0xCC, 0xCC, 0xBC, 0xCC, 0xDD, 0xDD, 0xEE, 0xBE, 0xFE,
+ 0xDD, 0xCC, 0xBB, 0xBB, 0xBC, 0xCD, 0xEE, 0xFF, 0xFE, 0xDE, 0xDC, 0xCB,
+ 0xBA, 0xAA, 0xAA, 0xBB, 0xCC, 0xDE, 0xFF, 0xED, 0xDC, 0xCB, 0xAA, 0x99,
+ 0x99, 0x99, 0xAB, 0xBC, 0xDE, 0xFE, 0xDD, 0xCB, 0xA9, 0x98, 0x88, 0x88,
+ 0x89, 0xAB, 0xCC, 0xDE, 0xDC, 0xCB, 0xA9, 0x88, 0x77, 0x77, 0x77, 0x89,
+ 0xAB, 0xCD, 0xED, 0xCC, 0xBA, 0x98, 0x77, 0x66, 0x66, 0x77, 0x89, 0xAB,
+ 0xCD, 0xDC, 0xBA, 0x98, 0x77, 0x65, 0x55, 0x66, 0x77, 0x8A, 0xBC, 0xDD,
+ 0xBC, 0xA9, 0x87, 0x65, 0x55, 0x55, 0x56, 0x78, 0x9A, 0xBD, 0xDC, 0xBA,
+ 0x98, 0x76, 0x55, 0x44, 0x55, 0x67, 0x89, 0xAB, 0xCD, 0xCB, 0xA9, 0x87,
+ 0x65, 0x54, 0x45, 0x56, 0x78, 0x9A, 0xBC, 0xCC, 0xBA, 0x98, 0x76, 0x65,
+ 0x55, 0x55, 0x67, 0x89, 0xAB, 0xCC, 0xCC, 0xB9, 0x87, 0x76, 0x55, 0x55,
+ 0x66, 0x78, 0x9A, 0xBD, 0xDC, 0xCB, 0xA9, 0x87, 0x76, 0x66, 0x66, 0x78,
+ 0x9A, 0xBC, 0xDD, 0xDD, 0xCB, 0xA9, 0x87, 0x77, 0x77, 0x78, 0x89, 0xAB,
+ 0xCD, 0xDD, 0xDD, 0xBA, 0xA9, 0x88, 0x88, 0x88, 0x99, 0xAB, 0xCD, 0xDD,
+ 0xDE, 0xDC, 0xBB, 0xA9, 0x99, 0x99, 0x9A, 0xAB, 0xBC, 0xDE, 0xED, 0xEE,
+ 0xDC, 0xCB, 0xBA, 0xAA, 0xAA, 0xAB, 0xCC, 0xDE, 0xFE, 0xEF, 0xFE, 0xDD,
+ 0xCC, 0xCB, 0xBB, 0xBC, 0xCC, 0xDE, 0xEF, 0xEE, 0xFF, 0xEE, 0xED, 0xDC,
+ 0xCC, 0xDD, 0xDD, 0xDE, 0xFF, 0xFF, 0xBE, 0xEE, 0xED, 0xDD, 0xDD, 0xCD,
+ 0xCD, 0xDD, 0xEE, 0xEF, 0xD0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xCE, 0xED, 0xDD, 0xCC, 0xCC, 0xDC, 0xDD, 0xDE, 0xEF, 0xEF, 0xAE, 0xFE,
+ 0xED, 0xDC, 0xCC, 0xCC, 0xCC, 0xDE, 0xEF, 0xFF, 0xFE, 0xEE, 0xDD, 0xDB,
+ 0xBB, 0xBA, 0xAB, 0xBC, 0xCD, 0xEE, 0xFF, 0xED, 0xED, 0xCB, 0xAA, 0x99,
+ 0x99, 0x9A, 0xBB, 0xCD, 0xEF, 0xFE, 0xDD, 0xCB, 0xAA, 0x98, 0x88, 0x88,
+ 0x99, 0xAB, 0xCD, 0xEF, 0xED, 0xDB, 0xB9, 0x98, 0x77, 0x77, 0x78, 0x89,
+ 0xAB, 0xCD, 0xEE, 0xCC, 0xBA, 0x98, 0x76, 0x66, 0x66, 0x77, 0x89, 0xAC,
+ 0xDE, 0xDC, 0xCB, 0x98, 0x76, 0x65, 0x55, 0x56, 0x77, 0x9A, 0xBC, 0xED,
+ 0xCC, 0xB9, 0x87, 0x65, 0x55, 0x55, 0x56, 0x78, 0x9B, 0xCD, 0xDC, 0xCA,
+ 0x98, 0x76, 0x55, 0x44, 0x55, 0x67, 0x89, 0xBC, 0xDD, 0xCC, 0xA9, 0x87,
+ 0x65, 0x54, 0x45, 0x56, 0x78, 0x9A, 0xBD, 0xDC, 0xCB, 0x98, 0x76, 0x55,
+ 0x55, 0x55, 0x67, 0x89, 0xAC, 0xDD, 0xDC, 0xBA, 0x98, 0x76, 0x55, 0x55,
+ 0x66, 0x78, 0x9A, 0xCD, 0xDD, 0xDC, 0xB9, 0x87, 0x76, 0x66, 0x66, 0x78,
+ 0x9A, 0xBC, 0xDD, 0xDE, 0xDB, 0xA9, 0x88, 0x77, 0x77, 0x78, 0x99, 0xAB,
+ 0xDD, 0xEE, 0xED, 0xCB, 0xA9, 0x98, 0x88, 0x88, 0x99, 0xAB, 0xCD, 0xEE,
+ 0xFF, 0xED, 0xCB, 0xAA, 0x99, 0x99, 0x9A, 0xAB, 0xCD, 0xDE, 0xEE, 0xFF,
+ 0xDD, 0xCC, 0xBB, 0xAA, 0xAB, 0xBB, 0xCC, 0xDE, 0xEE, 0xFF, 0xFE, 0xED,
+ 0xDC, 0xCB, 0xCC, 0xCC, 0xCD, 0xEE, 0xFF, 0xEE, 0xFF, 0xFF, 0xFE, 0xED,
+ 0xDD, 0xDD, 0xDE, 0xEE, 0xEF, 0xFF, 0xAE, 0xEE, 0xEE, 0xED, 0xED, 0xDD,
+ 0xDD, 0xDE, 0xEE, 0xFE, 0xD0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xAF, 0xFF,
+ 0xFF, 0xFF, 0xED, 0xDF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFD,
+ 0xCC, 0xCC, 0xCC, 0xDD, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xDD, 0xCB, 0xBA,
+ 0xAA, 0xBB, 0xCD, 0xFF, 0xFF, 0xFF, 0xFF, 0xFC, 0xBB, 0xA9, 0x99, 0x99,
+ 0xAB, 0xBD, 0xFF, 0xFF, 0xFF, 0xFD, 0xCA, 0xA9, 0x87, 0x77, 0x88, 0x9A,
+ 0xBD, 0xFF, 0xFF, 0xFD, 0xCB, 0xA9, 0x87, 0x66, 0x67, 0x78, 0x9A, 0xCD,
+ 0xFF, 0xFF, 0xFC, 0xB9, 0x87, 0x65, 0x55, 0x56, 0x78, 0xAB, 0xDF, 0xFF,
+ 0xFD, 0xCA, 0x97, 0x65, 0x54, 0x45, 0x56, 0x89, 0xAC, 0xFF, 0xFF, 0xDC,
+ 0xA9, 0x76, 0x54, 0x44, 0x45, 0x67, 0x9A, 0xCF, 0xFF, 0xFD, 0xCA, 0x97,
+ 0x65, 0x44, 0x44, 0x56, 0x79, 0xAC, 0xDF, 0xFF, 0xFC, 0xB9, 0x86, 0x65,
+ 0x44, 0x55, 0x67, 0x9A, 0xCD, 0xFF, 0xFF, 0xDB, 0xA8, 0x76, 0x55, 0x55,
+ 0x67, 0x89, 0xAC, 0xEF, 0xFF, 0xFF, 0xCA, 0x98, 0x76, 0x66, 0x67, 0x89,
+ 0xAB, 0xCF, 0xFF, 0xFF, 0xFD, 0xBA, 0x98, 0x87, 0x77, 0x89, 0x9B, 0xCD,
+ 0xFF, 0xFF, 0xFF, 0xFC, 0xBA, 0xA9, 0x99, 0x99, 0xAB, 0xBC, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xED, 0xCB, 0xBA, 0xAA, 0xAB, 0xCD, 0xEF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFD, 0xDC, 0xCC, 0xCC, 0xCD, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFD, 0xDD, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xBF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xCE, 0xDD, 0xCC, 0xCC, 0xBC, 0xBC, 0xCC, 0xDD, 0xDE, 0xEE, 0xAE, 0xEE,
+ 0xDD, 0xCC, 0xBB, 0xBB, 0xCC, 0xCD, 0xDE, 0xFF, 0xFE, 0xDE, 0xDC, 0xCB,
+ 0xBA, 0xAA, 0xAA, 0xBB, 0xCD, 0xDE, 0xEF, 0xED, 0xDC, 0xBB, 0xAA, 0x99,
+ 0x99, 0x9A, 0xAB, 0xBC, 0xDE, 0xFE, 0xCD, 0xCB, 0xA9, 0x98, 0x88, 0x88,
+ 0x99, 0xAB, 0xCD, 0xDF, 0xEC, 0xCB, 0xA9, 0x88, 0x77, 0x77, 0x78, 0x89,
+ 0xAB, 0xCD, 0xEE, 0xCC, 0xBA, 0x98, 0x77, 0x66, 0x66, 0x77, 0x89, 0xAB,
+ 0xCD, 0xDB, 0xBA, 0x98, 0x77, 0x65, 0x55, 0x66, 0x78, 0x9A, 0xBC, 0xDD,
+ 0xBB, 0xA9, 0x87, 0x65, 0x55, 0x55, 0x66, 0x78, 0x9A, 0xBD, 0xDB, 0xBA,
+ 0x98, 0x76, 0x55, 0x44, 0x55, 0x67, 0x89, 0xAB, 0xCC, 0xCB, 0xA9, 0x87,
+ 0x65, 0x54, 0x44, 0x56, 0x78, 0x9A, 0xBC, 0xDC, 0xBA, 0x98, 0x76, 0x65,
+ 0x54, 0x55, 0x67, 0x89, 0xAB, 0xCC, 0xCC, 0xBA, 0x98, 0x76, 0x65, 0x55,
+ 0x67, 0x78, 0x9A, 0xBC, 0xCC, 0xCB, 0xA9, 0x87, 0x76, 0x66, 0x66, 0x78,
+ 0x9A, 0xAC, 0xDD, 0xDD, 0xCB, 0xA9, 0x88, 0x77, 0x77, 0x78, 0x89, 0xAB,
+ 0xCD, 0xDD, 0xDD, 0xCB, 0xA9, 0x98, 0x88, 0x88, 0x99, 0xAB, 0xBC, 0xED,
+ 0xEE, 0xDC, 0xCB, 0xAA, 0x99, 0x99, 0x9A, 0xAB, 0xBC, 0xDE, 0xEE, 0xFE,
+ 0xDC, 0xCB, 0xBA, 0xAA, 0xAA, 0xBB, 0xBC, 0xDD, 0xEE, 0xEF, 0xFE, 0xDD,
+ 0xCC, 0xCB, 0xBB, 0xBC, 0xCD, 0xDD, 0xEF, 0xEE, 0xFF, 0xFE, 0xED, 0xDD,
+ 0xCC, 0xCC, 0xDD, 0xEE, 0xEF, 0xFE, 0x9E, 0xED, 0xDD, 0xDD, 0xDC, 0xCC,
+ 0xDD, 0xDD, 0xDE, 0xEF, 0xC0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xAC, 0xBB, 0xBA, 0xAA, 0xAA, 0xAA, 0xAA, 0xBB, 0xCC, 0xCD, 0x9C, 0xDC,
+ 0xBB, 0xBB, 0xAA, 0xAA, 0xAA, 0xBB, 0xCC, 0xDE, 0xED, 0xBC, 0xCB, 0xAA,
+ 0xA9, 0x99, 0x99, 0x9A, 0xAB, 0xBC, 0xDD, 0xDB, 0xBB, 0xAA, 0x99, 0x98,
+ 0x88, 0x89, 0x99, 0xAB, 0xBC, 0xDC, 0xBB, 0xAA, 0x99, 0x88, 0x87, 0x78,
+ 0x88, 0x99, 0xAB, 0xBC, 0xCA, 0xBA, 0x99, 0x87, 0x77, 0x77, 0x77, 0x88,
+ 0x99, 0xAB, 0xCC, 0xAB, 0xA9, 0x87, 0x76, 0x66, 0x66, 0x67, 0x78, 0x9A,
+ 0xAC, 0xCA, 0xA9, 0x98, 0x76, 0x66, 0x66, 0x66, 0x77, 0x89, 0x9A, 0xBB,
+ 0xAA, 0x98, 0x77, 0x66, 0x55, 0x55, 0x66, 0x78, 0x89, 0xAB, 0xBA, 0xA9,
+ 0x87, 0x76, 0x65, 0x55, 0x55, 0x67, 0x78, 0x9A, 0xBB, 0xAA, 0x98, 0x77,
+ 0x66, 0x55, 0x55, 0x56, 0x77, 0x89, 0xAB, 0xBA, 0xA9, 0x88, 0x76, 0x65,
+ 0x55, 0x56, 0x67, 0x78, 0x9A, 0xBB, 0xAA, 0x99, 0x87, 0x76, 0x65, 0x56,
+ 0x66, 0x78, 0x89, 0xAB, 0xBA, 0xBA, 0x98, 0x87, 0x76, 0x66, 0x66, 0x77,
+ 0x89, 0xAA, 0xBB, 0xBB, 0xA9, 0x98, 0x87, 0x77, 0x77, 0x77, 0x88, 0x9A,
+ 0xBC, 0xBB, 0xBB, 0xA9, 0x98, 0x88, 0x77, 0x78, 0x88, 0x9A, 0xAB, 0xCB,
+ 0xBC, 0xBB, 0xAA, 0x99, 0x88, 0x88, 0x89, 0x9A, 0xAB, 0xCC, 0xCC, 0xCC,
+ 0xBB, 0xAA, 0x99, 0x99, 0x99, 0x9A, 0xAB, 0xBD, 0xDC, 0xCD, 0xCC, 0xBB,
+ 0xBA, 0xAA, 0xAA, 0xAA, 0xBB, 0xCC, 0xDE, 0xCC, 0xEE, 0xDC, 0xCB, 0xBB,
+ 0xBB, 0xBB, 0xBB, 0xCC, 0xDD, 0xED, 0x9D, 0xCC, 0xCB, 0xBB, 0xBB, 0xBB,
+ 0xBB, 0xBC, 0xCC, 0xDD, 0xC0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xAB, 0xBA, 0xAA, 0x99, 0x99, 0x99, 0x9A, 0xAA, 0xBB, 0xBC, 0x9B, 0xCB,
+ 0xBA, 0xAA, 0xA9, 0x99, 0xAA, 0xAA, 0xBB, 0xCC, 0xDC, 0xBB, 0xBA, 0xA9,
+ 0x99, 0x99, 0x99, 0x99, 0xAA, 0xBB, 0xCD, 0xBA, 0xBA, 0xA9, 0x98, 0x88,
+ 0x88, 0x88, 0x99, 0x9A, 0xBB, 0xCB, 0xAA, 0xA9, 0x98, 0x88, 0x77, 0x77,
+ 0x88, 0x89, 0x9A, 0xBC, 0xBA, 0xA9, 0x98, 0x87, 0x77, 0x77, 0x77, 0x78,
+ 0x89, 0xAA, 0xBB, 0x9A, 0x98, 0x87, 0x77, 0x66, 0x66, 0x77, 0x78, 0x99,
+ 0xAB, 0xA9, 0xA9, 0x88, 0x77, 0x66, 0x66, 0x66, 0x77, 0x88, 0x9A, 0xAA,
+ 0x99, 0x98, 0x77, 0x66, 0x65, 0x56, 0x66, 0x77, 0x89, 0xAA, 0xA9, 0x99,
+ 0x87, 0x76, 0x65, 0x55, 0x56, 0x67, 0x78, 0x99, 0xAA, 0x99, 0x98, 0x77,
+ 0x66, 0x55, 0x55, 0x66, 0x77, 0x89, 0x9A, 0xA9, 0x99, 0x87, 0x76, 0x66,
+ 0x55, 0x66, 0x67, 0x78, 0x99, 0xAA, 0x9A, 0x98, 0x87, 0x76, 0x66, 0x66,
+ 0x66, 0x78, 0x89, 0xAA, 0xAA, 0xA9, 0x98, 0x77, 0x76, 0x66, 0x67, 0x77,
+ 0x88, 0x9A, 0xAA, 0xAA, 0xA9, 0x88, 0x77, 0x77, 0x77, 0x77, 0x88, 0x99,
+ 0xAB, 0xAA, 0xBA, 0x99, 0x88, 0x87, 0x77, 0x78, 0x88, 0x99, 0xAA, 0xBA,
+ 0xAB, 0xBA, 0x99, 0x98, 0x88, 0x88, 0x88, 0x99, 0xAA, 0xBB, 0xBB, 0xCB,
+ 0xBA, 0xA9, 0x99, 0x99, 0x99, 0x99, 0xAA, 0xBB, 0xCB, 0xBC, 0xCB, 0xBA,
+ 0xAA, 0xA9, 0x99, 0xAA, 0xAA, 0xBB, 0xCC, 0xBC, 0xDC, 0xCC, 0xBB, 0xAA,
+ 0xAA, 0xAA, 0xAB, 0xBC, 0xCC, 0xDC, 0x9C, 0xCB, 0xBA, 0xAA, 0xAA, 0xAA,
+ 0xAA, 0xAB, 0xBB, 0xCC, 0xA0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xAB, 0xBB, 0xAA, 0xAA, 0xA9, 0xAA, 0xAA, 0xAB, 0xBB, 0xCC, 0x9B, 0xCC,
+ 0xBB, 0xBA, 0xAA, 0xAA, 0xAA, 0xAB, 0xBC, 0xCD, 0xDC, 0xBC, 0xBB, 0xAA,
+ 0x99, 0x99, 0x99, 0x9A, 0xAB, 0xBC, 0xCD, 0xCA, 0xBB, 0xAA, 0x99, 0x88,
+ 0x88, 0x88, 0x99, 0xAA, 0xBC, 0xCB, 0xAB, 0xA9, 0x98, 0x88, 0x77, 0x77,
+ 0x88, 0x99, 0xAA, 0xCC, 0xBA, 0xAA, 0x98, 0x87, 0x77, 0x77, 0x77, 0x78,
+ 0x99, 0xAB, 0xBB, 0xAA, 0x99, 0x87, 0x76, 0x66, 0x66, 0x77, 0x78, 0x9A,
+ 0xAC, 0xBA, 0xA9, 0x88, 0x76, 0x66, 0x66, 0x66, 0x77, 0x88, 0x9A, 0xBB,
+ 0x9A, 0x98, 0x77, 0x66, 0x55, 0x55, 0x66, 0x77, 0x89, 0xAB, 0xB9, 0xA9,
+ 0x87, 0x76, 0x65, 0x55, 0x56, 0x67, 0x78, 0x9A, 0xBA, 0x9A, 0x98, 0x77,
+ 0x66, 0x55, 0x55, 0x66, 0x77, 0x89, 0xAB, 0xAA, 0xA9, 0x87, 0x76, 0x65,
+ 0x55, 0x56, 0x67, 0x78, 0x9A, 0xBA, 0xAA, 0x98, 0x87, 0x76, 0x66, 0x66,
+ 0x66, 0x78, 0x89, 0xAB, 0xAA, 0xBA, 0x98, 0x77, 0x76, 0x66, 0x66, 0x77,
+ 0x89, 0x9A, 0xBA, 0xAB, 0xA9, 0x98, 0x87, 0x77, 0x77, 0x77, 0x88, 0x9A,
+ 0xAB, 0xBB, 0xBB, 0xA9, 0x98, 0x88, 0x77, 0x78, 0x88, 0x9A, 0xAB, 0xCB,
+ 0xBC, 0xBA, 0xA9, 0x98, 0x88, 0x88, 0x89, 0x99, 0xAB, 0xBC, 0xBB, 0xCC,
+ 0xBB, 0xAA, 0x99, 0x99, 0x99, 0x9A, 0xAB, 0xBC, 0xCB, 0xCD, 0xCC, 0xBB,
+ 0xAA, 0xAA, 0xAA, 0xAA, 0xBB, 0xBC, 0xCD, 0xCC, 0xDC, 0xCC, 0xCB, 0xBB,
+ 0xBB, 0xAB, 0xBB, 0xCC, 0xCD, 0xDC, 0x9C, 0xCB, 0xBB, 0xBA, 0xAA, 0xAA,
+ 0xAA, 0xBB, 0xBB, 0xCC, 0xA0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xCE, 0xDD, 0xCC, 0xCC, 0xCC, 0xCC, 0xCD, 0xDE, 0xEE, 0xEF, 0x9E, 0xFE,
+ 0xDD, 0xCC, 0xCB, 0xBB, 0xCC, 0xDD, 0xEF, 0xFF, 0xFF, 0xDE, 0xDC, 0xCB,
+ 0xBA, 0xAA, 0xAB, 0xBB, 0xCD, 0xEE, 0xFF, 0xFD, 0xDC, 0xCB, 0xAA, 0x99,
+ 0x99, 0x9A, 0xAB, 0xCD, 0xEF, 0xFF, 0xDD, 0xCB, 0xA9, 0x98, 0x88, 0x88,
+ 0x99, 0xAB, 0xCD, 0xEF, 0xEC, 0xCB, 0xA9, 0x98, 0x77, 0x77, 0x78, 0x89,
+ 0xAB, 0xCD, 0xEE, 0xCC, 0xBA, 0x98, 0x77, 0x66, 0x66, 0x78, 0x89, 0xAB,
+ 0xDE, 0xEC, 0xCA, 0x98, 0x77, 0x65, 0x55, 0x66, 0x78, 0x9A, 0xBC, 0xDD,
+ 0xCB, 0xA9, 0x87, 0x65, 0x55, 0x55, 0x66, 0x78, 0x9B, 0xCD, 0xDC, 0xBA,
+ 0x98, 0x76, 0x55, 0x44, 0x55, 0x67, 0x89, 0xAC, 0xDD, 0xCC, 0xA9, 0x87,
+ 0x65, 0x54, 0x44, 0x56, 0x78, 0x9A, 0xBD, 0xDC, 0xCB, 0x98, 0x76, 0x65,
+ 0x44, 0x55, 0x67, 0x89, 0xAB, 0xDD, 0xCC, 0xBA, 0x98, 0x76, 0x65, 0x55,
+ 0x67, 0x78, 0x9B, 0xBD, 0xDD, 0xDB, 0xB9, 0x88, 0x76, 0x66, 0x67, 0x78,
+ 0x9A, 0xBC, 0xDD, 0xDD, 0xCB, 0xA9, 0x88, 0x77, 0x77, 0x78, 0x99, 0xAB,
+ 0xCD, 0xDD, 0xED, 0xCB, 0xA9, 0x98, 0x88, 0x88, 0x99, 0xAB, 0xCD, 0xED,
+ 0xEE, 0xED, 0xCB, 0xAA, 0x99, 0x99, 0x9A, 0xAB, 0xCC, 0xDE, 0xEE, 0xFE,
+ 0xDD, 0xCB, 0xBA, 0xAA, 0xAA, 0xBB, 0xCC, 0xDE, 0xFE, 0xEF, 0xFE, 0xDD,
+ 0xDC, 0xCB, 0xBB, 0xCC, 0xCD, 0xEE, 0xFF, 0xFE, 0xFF, 0xFF, 0xEE, 0xDD,
+ 0xDC, 0xDD, 0xDD, 0xEE, 0xFF, 0xFF, 0xAE, 0xFE, 0xEE, 0xED, 0xDD, 0xDD,
+ 0xDD, 0xDE, 0xEE, 0xFF, 0xC0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xDF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xAF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xED, 0xDD, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xDD, 0xCC,
+ 0xCC, 0xCD, 0xDE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xDC, 0xBB, 0xAA, 0xAB,
+ 0xBC, 0xDD, 0xFF, 0xFF, 0xFF, 0xFF, 0xEC, 0xBA, 0x99, 0x89, 0x9A, 0xBB,
+ 0xDF, 0xFF, 0xFF, 0xFF, 0xFD, 0xBA, 0x98, 0x77, 0x77, 0x89, 0xBC, 0xEF,
+ 0xFF, 0xFF, 0xFF, 0xCB, 0x98, 0x65, 0x55, 0x67, 0x8A, 0xBC, 0xFF, 0xFF,
+ 0xFF, 0xDC, 0xA9, 0x75, 0x44, 0x44, 0x67, 0x9B, 0xCF, 0xFF, 0xFF, 0xFE,
+ 0xCA, 0x87, 0x54, 0x33, 0x45, 0x79, 0xAC, 0xDF, 0xFF, 0xFF, 0xDC, 0xA9,
+ 0x75, 0x43, 0x34, 0x57, 0x8A, 0xCE, 0xFF, 0xFF, 0xFF, 0xCB, 0x97, 0x64,
+ 0x44, 0x45, 0x79, 0xAC, 0xDF, 0xFF, 0xFF, 0xFD, 0xBA, 0x87, 0x65, 0x55,
+ 0x68, 0x9B, 0xCD, 0xFF, 0xFF, 0xFF, 0xDC, 0xB9, 0x87, 0x77, 0x78, 0x9A,
+ 0xBD, 0xFF, 0xFF, 0xFF, 0xFF, 0xDC, 0xBA, 0x98, 0x89, 0x9A, 0xBC, 0xDF,
+ 0xFF, 0xFF, 0xFF, 0xFE, 0xDC, 0xBB, 0xAA, 0xAB, 0xBC, 0xDF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xDD, 0xCC, 0xCC, 0xCD, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFE, 0xDD, 0xEF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x9F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xD0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xBD, 0xDD, 0xDC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xDD, 0xCD, 0x9E, 0xFE,
+ 0xDD, 0xDD, 0xCC, 0xCC, 0xCD, 0xDD, 0xEE, 0xFE, 0xFD, 0xDE, 0xED, 0xDC,
+ 0xBB, 0xBB, 0xBB, 0xBC, 0xCD, 0xDE, 0xEF, 0xEC, 0xDD, 0xCC, 0xBA, 0xAA,
+ 0xAA, 0xAA, 0xBB, 0xCD, 0xED, 0xED, 0xCD, 0xCC, 0xBA, 0xA9, 0x99, 0x99,
+ 0x9A, 0xBB, 0xCD, 0xDF, 0xDC, 0xDC, 0xBA, 0x99, 0x88, 0x77, 0x88, 0x9A,
+ 0xBC, 0xCD, 0xED, 0xCD, 0xCB, 0xA9, 0x87, 0x66, 0x66, 0x78, 0x9A, 0xBC,
+ 0xDE, 0xDC, 0xCB, 0xA9, 0x87, 0x65, 0x55, 0x66, 0x78, 0x9B, 0xBD, 0xED,
+ 0xCC, 0xBA, 0x97, 0x65, 0x54, 0x45, 0x66, 0x89, 0xAB, 0xCD, 0xDC, 0xCB,
+ 0xA8, 0x76, 0x54, 0x44, 0x45, 0x67, 0x8A, 0xBC, 0xDD, 0xCC, 0xBA, 0x87,
+ 0x65, 0x44, 0x44, 0x56, 0x78, 0xAB, 0xCD, 0xDC, 0xCB, 0xA9, 0x87, 0x65,
+ 0x44, 0x55, 0x67, 0x9A, 0xBC, 0xED, 0xCD, 0xCA, 0x98, 0x76, 0x65, 0x55,
+ 0x67, 0x89, 0xAB, 0xCD, 0xDC, 0xDC, 0xBA, 0x98, 0x77, 0x66, 0x67, 0x88,
+ 0x9B, 0xCC, 0xED, 0xCD, 0xCB, 0xAA, 0x98, 0x87, 0x77, 0x89, 0x9A, 0xBC,
+ 0xDD, 0xDC, 0xDC, 0xCC, 0xAA, 0x99, 0x99, 0x99, 0xAA, 0xBC, 0xDE, 0xED,
+ 0xDE, 0xDD, 0xCC, 0xBA, 0xAA, 0xAA, 0xAB, 0xBC, 0xDD, 0xEE, 0xDC, 0xFE,
+ 0xDD, 0xCC, 0xCB, 0xBB, 0xBB, 0xBC, 0xCD, 0xEE, 0xFE, 0xDF, 0xEE, 0xDD,
+ 0xDD, 0xCC, 0xCC, 0xCC, 0xDD, 0xEE, 0xEF, 0xED, 0xFF, 0xEE, 0xED, 0xDD,
+ 0xDD, 0xDE, 0xEF, 0xEF, 0xFF, 0xEE, 0x9D, 0xDD, 0xCD, 0xDD, 0xDD, 0xDD,
+ 0xDD, 0xDE, 0xEE, 0xFE, 0xC0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xCE, 0xDD, 0xCC, 0xCB, 0xBB, 0xBC, 0xCC, 0xCD, 0xDD, 0xDE, 0xAE, 0xEE,
+ 0xDC, 0xCC, 0xBB, 0xBB, 0xBC, 0xCD, 0xDD, 0xEF, 0xFE, 0xDE, 0xDC, 0xCB,
+ 0xBA, 0xAA, 0xAA, 0xBB, 0xCC, 0xDD, 0xEF, 0xED, 0xDC, 0xCB, 0xAA, 0x99,
+ 0x99, 0x9A, 0xAB, 0xBC, 0xDE, 0xEE, 0xCC, 0xCB, 0xA9, 0x98, 0x88, 0x88,
+ 0x99, 0xAA, 0xBC, 0xDE, 0xDC, 0xCB, 0xA9, 0x98, 0x77, 0x77, 0x78, 0x89,
+ 0xAB, 0xCC, 0xDD, 0xCC, 0xBA, 0x98, 0x77, 0x66, 0x66, 0x77, 0x89, 0xAB,
+ 0xCD, 0xDB, 0xBA, 0x98, 0x77, 0x65, 0x55, 0x56, 0x77, 0x9A, 0xBC, 0xDD,
+ 0xBB, 0xA9, 0x87, 0x65, 0x55, 0x55, 0x56, 0x78, 0x9A, 0xCD, 0xDB, 0xBA,
+ 0x98, 0x76, 0x55, 0x44, 0x55, 0x67, 0x89, 0xAB, 0xCC, 0xBB, 0xA9, 0x87,
+ 0x65, 0x54, 0x45, 0x56, 0x78, 0x9A, 0xBC, 0xCB, 0xBA, 0x98, 0x76, 0x55,
+ 0x55, 0x55, 0x67, 0x89, 0xAB, 0xCC, 0xCC, 0xBA, 0x88, 0x76, 0x55, 0x55,
+ 0x67, 0x78, 0x9A, 0xBD, 0xCC, 0xCB, 0xA9, 0x87, 0x76, 0x66, 0x67, 0x78,
+ 0x9A, 0xBC, 0xDD, 0xCD, 0xCB, 0xA9, 0x88, 0x77, 0x77, 0x78, 0x99, 0xAB,
+ 0xCD, 0xDC, 0xDC, 0xBA, 0xA9, 0x88, 0x88, 0x88, 0x99, 0xAB, 0xCD, 0xDD,
+ 0xDD, 0xDC, 0xBB, 0xA9, 0x99, 0x99, 0x9A, 0xAB, 0xCC, 0xDE, 0xDD, 0xED,
+ 0xDC, 0xBB, 0xBA, 0xAA, 0xAA, 0xBB, 0xCC, 0xDE, 0xFE, 0xDF, 0xEE, 0xDC,
+ 0xCC, 0xBB, 0xBB, 0xBC, 0xCC, 0xDE, 0xFF, 0xFE, 0xFE, 0xFE, 0xDD, 0xDD,
+ 0xCC, 0xCC, 0xDD, 0xDE, 0xFF, 0xFE, 0xAE, 0xED, 0xDD, 0xDD, 0xCC, 0xCC,
+ 0xCD, 0xDD, 0xEE, 0xEF, 0xD0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xDE, 0xED, 0xDD, 0xCC, 0xCC, 0xCC, 0xCC, 0xDD, 0xDD, 0xDE, 0x9F, 0xFF,
+ 0xED, 0xDD, 0xDD, 0xCC, 0xCD, 0xDD, 0xEE, 0xEF, 0xFE, 0xEF, 0xED, 0xDC,
+ 0xBB, 0xBB, 0xBB, 0xCC, 0xCE, 0xEE, 0xFF, 0xED, 0xED, 0xDC, 0xBA, 0xAA,
+ 0xAA, 0xAA, 0xBB, 0xCD, 0xEE, 0xFD, 0xDE, 0xDC, 0xBA, 0x99, 0x98, 0x89,
+ 0x9A, 0xAB, 0xCD, 0xEF, 0xDD, 0xDC, 0xBA, 0x98, 0x87, 0x77, 0x78, 0x9A,
+ 0xBB, 0xCD, 0xED, 0xCD, 0xCB, 0xA8, 0x87, 0x66, 0x66, 0x78, 0x9A, 0xBC,
+ 0xDE, 0xDC, 0xDB, 0xA9, 0x87, 0x65, 0x55, 0x66, 0x78, 0x9A, 0xBC, 0xED,
+ 0xCD, 0xBA, 0x97, 0x65, 0x54, 0x45, 0x66, 0x79, 0xAB, 0xCD, 0xDC, 0xCB,
+ 0xA8, 0x76, 0x54, 0x44, 0x45, 0x67, 0x8A, 0xBC, 0xDD, 0xCC, 0xBA, 0x87,
+ 0x65, 0x44, 0x44, 0x56, 0x78, 0xAB, 0xCD, 0xDC, 0xCB, 0xA9, 0x76, 0x65,
+ 0x45, 0x56, 0x67, 0x9A, 0xBC, 0xDD, 0xDD, 0xCA, 0x98, 0x76, 0x65, 0x55,
+ 0x67, 0x89, 0xAB, 0xCD, 0xDD, 0xDC, 0xBA, 0x98, 0x76, 0x66, 0x67, 0x88,
+ 0x9A, 0xBD, 0xDD, 0xDD, 0xCB, 0xAA, 0x98, 0x87, 0x77, 0x88, 0x9A, 0xBC,
+ 0xCE, 0xDE, 0xED, 0xCB, 0xAA, 0x99, 0x88, 0x89, 0x9A, 0xBC, 0xCD, 0xED,
+ 0xEF, 0xED, 0xCB, 0xBA, 0xAA, 0xAA, 0xAA, 0xBC, 0xCD, 0xEE, 0xDE, 0xFE,
+ 0xDD, 0xCC, 0xBB, 0xBB, 0xBB, 0xCC, 0xCD, 0xDE, 0xFE, 0xDF, 0xFE, 0xDD,
+ 0xDC, 0xCC, 0xCC, 0xCC, 0xDE, 0xEE, 0xEF, 0xEE, 0xFF, 0xEF, 0xEE, 0xDE,
+ 0xDD, 0xDD, 0xDE, 0xEF, 0xFF, 0xFF, 0xAE, 0xDD, 0xDD, 0xED, 0xDD, 0xDD,
+ 0xDD, 0xDE, 0xEE, 0xEE, 0xC0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xDF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x9F, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFE, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xDD, 0xCC,
+ 0xCC, 0xCD, 0xDD, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xDC, 0xCB, 0xAA, 0xAB,
+ 0xBC, 0xDF, 0xFF, 0xFF, 0xFF, 0xFF, 0xDC, 0xBA, 0x99, 0x89, 0x9A, 0xBC,
+ 0xDF, 0xFF, 0xFF, 0xFF, 0xFD, 0xBA, 0x98, 0x77, 0x77, 0x89, 0xBC, 0xDF,
+ 0xFF, 0xFF, 0xFF, 0xCB, 0x98, 0x66, 0x55, 0x67, 0x8A, 0xBD, 0xFF, 0xFF,
+ 0xFF, 0xFC, 0xA9, 0x76, 0x44, 0x45, 0x67, 0x9B, 0xCD, 0xFF, 0xFF, 0xFF,
+ 0xCA, 0x87, 0x54, 0x33, 0x45, 0x78, 0xAC, 0xFF, 0xFF, 0xFF, 0xFC, 0xA9,
+ 0x75, 0x43, 0x24, 0x57, 0x8A, 0xCE, 0xFF, 0xFF, 0xFF, 0xCB, 0x97, 0x65,
+ 0x44, 0x46, 0x79, 0xAC, 0xDF, 0xFF, 0xFF, 0xFD, 0xBA, 0x87, 0x65, 0x56,
+ 0x68, 0x9B, 0xCD, 0xFF, 0xFF, 0xFF, 0xDC, 0xB9, 0x87, 0x77, 0x78, 0x9A,
+ 0xBD, 0xFF, 0xFF, 0xFF, 0xFF, 0xDC, 0xBA, 0x99, 0x89, 0x9A, 0xBC, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xDC, 0xBB, 0xAA, 0xAB, 0xBC, 0xDF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xDD, 0xCC, 0xCC, 0xCD, 0xDF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xDD, 0xDF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x9F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xD0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xCE, 0xED, 0xCD, 0xCC, 0xCC, 0xCC, 0xCC, 0xCD, 0xDD, 0xDD, 0x9E, 0xFE,
+ 0xDD, 0xDC, 0xCC, 0xBC, 0xCC, 0xDD, 0xEE, 0xEF, 0xFE, 0xDE, 0xDD, 0xCC,
+ 0xBB, 0xBB, 0xBB, 0xBC, 0xCC, 0xDE, 0xEF, 0xED, 0xED, 0xCB, 0xBA, 0xAA,
+ 0xAA, 0xAA, 0xBB, 0xCD, 0xDE, 0xEE, 0xDD, 0xCC, 0xBA, 0x99, 0x98, 0x99,
+ 0x9A, 0xAB, 0xCC, 0xDE, 0xDC, 0xDC, 0xBA, 0x98, 0x88, 0x77, 0x88, 0x99,
+ 0xAB, 0xCD, 0xED, 0xCC, 0xBA, 0x99, 0x87, 0x76, 0x67, 0x78, 0x9A, 0xBC,
+ 0xDD, 0xDC, 0xCB, 0xA9, 0x87, 0x66, 0x55, 0x66, 0x78, 0x9A, 0xBC, 0xDD,
+ 0xCC, 0xBA, 0x98, 0x76, 0x54, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xDC, 0xCB,
+ 0xA8, 0x76, 0x54, 0x34, 0x55, 0x67, 0x9A, 0xBC, 0xDC, 0xCC, 0xBA, 0x97,
+ 0x65, 0x44, 0x34, 0x56, 0x78, 0x9B, 0xCD, 0xDC, 0xCB, 0xA9, 0x87, 0x65,
+ 0x44, 0x56, 0x68, 0x9A, 0xBC, 0xDD, 0xCC, 0xBA, 0x98, 0x76, 0x65, 0x56,
+ 0x67, 0x89, 0xAB, 0xCD, 0xDC, 0xCB, 0xBA, 0x98, 0x77, 0x66, 0x77, 0x88,
+ 0x9A, 0xBC, 0xDD, 0xCD, 0xCB, 0xA9, 0x98, 0x87, 0x78, 0x89, 0x9A, 0xBC,
+ 0xDE, 0xDD, 0xEC, 0xCB, 0xAA, 0x99, 0x88, 0x99, 0x9A, 0xBB, 0xCD, 0xED,
+ 0xDE, 0xDC, 0xCB, 0xBA, 0xAA, 0xAA, 0xAA, 0xBB, 0xCD, 0xEF, 0xED, 0xEE,
+ 0xDC, 0xCB, 0xBB, 0xBB, 0xBB, 0xBC, 0xCD, 0xEF, 0xEE, 0xEF, 0xFE, 0xDD,
+ 0xCC, 0xCC, 0xCC, 0xCC, 0xDD, 0xDE, 0xFF, 0xED, 0xFF, 0xEE, 0xED, 0xDD,
+ 0xCD, 0xDD, 0xDD, 0xEE, 0xFF, 0xFF, 0x8E, 0xDD, 0xDD, 0xCC, 0xCC, 0xCD,
+ 0xDD, 0xDD, 0xDE, 0xEE, 0xC0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0x9B, 0xBB, 0xAA, 0xAA, 0xA9, 0xAA, 0xAA, 0xAA, 0xBB, 0xBB, 0x9B, 0xCC,
+ 0xBB, 0xBA, 0xAA, 0xAA, 0xAA, 0xBB, 0xBC, 0xCC, 0xEC, 0xBC, 0xBB, 0xAA,
+ 0xA9, 0x99, 0x99, 0xAA, 0xAA, 0xBC, 0xCD, 0xBB, 0xBB, 0xAA, 0x99, 0x98,
+ 0x88, 0x89, 0x9A, 0xAB, 0xBC, 0xCB, 0xAB, 0xAA, 0x99, 0x88, 0x88, 0x88,
+ 0x88, 0x99, 0xAB, 0xBC, 0xBA, 0xBA, 0x99, 0x88, 0x77, 0x77, 0x77, 0x88,
+ 0x99, 0xAB, 0xCB, 0xAA, 0xA9, 0x88, 0x77, 0x66, 0x66, 0x77, 0x88, 0x9A,
+ 0xAB, 0xBA, 0xA9, 0x98, 0x77, 0x66, 0x55, 0x66, 0x77, 0x89, 0xAA, 0xBB,
+ 0x9A, 0x98, 0x87, 0x66, 0x55, 0x55, 0x66, 0x78, 0x99, 0xAB, 0xA9, 0xA9,
+ 0x87, 0x76, 0x55, 0x55, 0x55, 0x67, 0x78, 0x9A, 0xBA, 0x9A, 0x98, 0x87,
+ 0x65, 0x55, 0x55, 0x56, 0x77, 0x89, 0xAB, 0xAA, 0xA9, 0x88, 0x76, 0x65,
+ 0x55, 0x56, 0x67, 0x88, 0x9A, 0xBA, 0xAA, 0xA9, 0x87, 0x76, 0x65, 0x56,
+ 0x66, 0x78, 0x99, 0xAB, 0xAA, 0xAA, 0x98, 0x87, 0x76, 0x66, 0x66, 0x78,
+ 0x89, 0xAA, 0xBA, 0xAB, 0xA9, 0x98, 0x87, 0x77, 0x77, 0x78, 0x89, 0x9A,
+ 0xBB, 0xBA, 0xBB, 0xA9, 0x98, 0x88, 0x88, 0x88, 0x89, 0x9A, 0xAB, 0xCB,
+ 0xBC, 0xBB, 0xA9, 0x99, 0x88, 0x88, 0x99, 0x9A, 0xAB, 0xBC, 0xBB, 0xCC,
+ 0xBB, 0xAA, 0xA9, 0x99, 0x99, 0xAA, 0xAB, 0xBC, 0xCC, 0xBC, 0xCC, 0xBB,
+ 0xBA, 0xAA, 0xAA, 0xAB, 0xBB, 0xBC, 0xDD, 0xCC, 0xDD, 0xDC, 0xCB, 0xBB,
+ 0xBB, 0xBB, 0xBC, 0xCC, 0xCD, 0xEC, 0x8C, 0xBB, 0xBB, 0xBA, 0xAA, 0xAA,
+ 0xAA, 0xBB, 0xBC, 0xCC, 0xA0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0x9B, 0xAA, 0xA9, 0x99, 0x99, 0x99, 0x99, 0xAA, 0xAB, 0xBB, 0x9B, 0xCB,
+ 0xBA, 0xAA, 0xA9, 0x99, 0xAA, 0xAA, 0xBB, 0xCC, 0xCB, 0xAB, 0xBA, 0xA9,
+ 0x99, 0x99, 0x99, 0x99, 0xAA, 0xAB, 0xCC, 0xBA, 0xBA, 0xA9, 0x98, 0x88,
+ 0x88, 0x88, 0x99, 0x9A, 0xBB, 0xCB, 0xAA, 0xA9, 0x98, 0x88, 0x77, 0x77,
+ 0x88, 0x89, 0x9A, 0xBB, 0xB9, 0xA9, 0x98, 0x87, 0x77, 0x77, 0x77, 0x78,
+ 0x89, 0xAA, 0xBA, 0x9A, 0x99, 0x87, 0x77, 0x66, 0x66, 0x77, 0x78, 0x99,
+ 0xAB, 0xA9, 0xA9, 0x88, 0x77, 0x66, 0x66, 0x66, 0x77, 0x88, 0x9A, 0xAA,
+ 0x99, 0x98, 0x77, 0x66, 0x65, 0x56, 0x66, 0x77, 0x89, 0xAA, 0xA9, 0x99,
+ 0x87, 0x76, 0x65, 0x55, 0x56, 0x67, 0x78, 0x99, 0xAA, 0x99, 0x98, 0x77,
+ 0x66, 0x55, 0x55, 0x66, 0x77, 0x89, 0x9A, 0xA9, 0xA9, 0x87, 0x76, 0x66,
+ 0x55, 0x66, 0x67, 0x78, 0x99, 0xAA, 0x9A, 0x98, 0x87, 0x76, 0x66, 0x66,
+ 0x67, 0x78, 0x89, 0xAA, 0xA9, 0xA9, 0x98, 0x77, 0x76, 0x66, 0x67, 0x77,
+ 0x88, 0x9A, 0xAA, 0xAA, 0xA9, 0x88, 0x77, 0x77, 0x77, 0x77, 0x88, 0x99,
+ 0xAB, 0xAA, 0xBA, 0x99, 0x88, 0x87, 0x77, 0x78, 0x88, 0x99, 0xAA, 0xBA,
+ 0xAB, 0xBA, 0x99, 0x98, 0x88, 0x88, 0x88, 0x99, 0xAA, 0xBB, 0xBB, 0xCB,
+ 0xAA, 0xA9, 0x99, 0x99, 0x99, 0x99, 0xAA, 0xBB, 0xCB, 0xBC, 0xCB, 0xBA,
+ 0xAA, 0xA9, 0x99, 0xAA, 0xAA, 0xBB, 0xCC, 0xBB, 0xDC, 0xCB, 0xBB, 0xAA,
+ 0xAA, 0xAA, 0xBB, 0xBB, 0xCC, 0xDC, 0x9B, 0xBB, 0xAA, 0xAA, 0xAA, 0xAA,
+ 0xAA, 0xAA, 0xBB, 0xBC, 0xA0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0x9B, 0xBB, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xBB, 0xBC, 0x8B, 0xDC,
+ 0xCB, 0xBB, 0xAA, 0xAA, 0xAB, 0xBB, 0xBC, 0xDD, 0xDC, 0xBC, 0xCB, 0xBA,
+ 0xA9, 0x99, 0x99, 0xAA, 0xAB, 0xBC, 0xCD, 0xCB, 0xCB, 0xBA, 0x99, 0x98,
+ 0x88, 0x99, 0x9A, 0xAB, 0xBC, 0xCB, 0xAB, 0xAA, 0x99, 0x88, 0x87, 0x88,
+ 0x88, 0x9A, 0xAB, 0xBC, 0xBA, 0xBA, 0x99, 0x88, 0x77, 0x77, 0x77, 0x88,
+ 0x9A, 0xAB, 0xCB, 0xAA, 0xA9, 0x88, 0x76, 0x66, 0x66, 0x77, 0x88, 0x9A,
+ 0xBB, 0xBA, 0xA9, 0x98, 0x76, 0x66, 0x55, 0x66, 0x77, 0x89, 0x9A, 0xBA,
+ 0xAA, 0x98, 0x87, 0x66, 0x55, 0x55, 0x66, 0x78, 0x89, 0xAB, 0xBA, 0xA9,
+ 0x88, 0x76, 0x55, 0x55, 0x55, 0x67, 0x88, 0x9A, 0xBA, 0xAA, 0x98, 0x87,
+ 0x65, 0x55, 0x55, 0x56, 0x77, 0x89, 0xAB, 0xAA, 0xA9, 0x98, 0x76, 0x65,
+ 0x55, 0x56, 0x67, 0x88, 0x9A, 0xBA, 0xAA, 0xA9, 0x87, 0x76, 0x65, 0x56,
+ 0x66, 0x78, 0x99, 0xAB, 0xAA, 0xBA, 0x98, 0x87, 0x76, 0x66, 0x66, 0x77,
+ 0x89, 0xAB, 0xBB, 0xAB, 0xAA, 0x98, 0x87, 0x77, 0x77, 0x78, 0x89, 0x9A,
+ 0xBC, 0xBB, 0xCB, 0xAA, 0x98, 0x88, 0x87, 0x88, 0x89, 0x9A, 0xAB, 0xCB,
+ 0xBC, 0xBB, 0xAA, 0x99, 0x98, 0x88, 0x99, 0x9A, 0xAB, 0xCC, 0xBB, 0xCC,
+ 0xBB, 0xAA, 0xA9, 0x99, 0x9A, 0xAA, 0xAB, 0xCC, 0xCC, 0xBD, 0xCC, 0xBB,
+ 0xBA, 0xAA, 0xAA, 0xAB, 0xBB, 0xCC, 0xCD, 0xCC, 0xDD, 0xCC, 0xCB, 0xBB,
+ 0xBB, 0xBB, 0xBC, 0xCC, 0xDD, 0xDC, 0x8C, 0xBB, 0xBB, 0xBB, 0xAA, 0xAA,
+ 0xBB, 0xBB, 0xBB, 0xCC, 0xA0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xBD, 0xDD, 0xDD, 0xCC, 0xCC, 0xCC, 0xCC, 0xCD, 0xCD, 0xDD, 0x8E, 0xFE,
+ 0xED, 0xDD, 0xCC, 0xCC, 0xCD, 0xDD, 0xEF, 0xFF, 0xFD, 0xDE, 0xED, 0xCC,
+ 0xCB, 0xBB, 0xBB, 0xCC, 0xCD, 0xEE, 0xEF, 0xED, 0xDD, 0xCC, 0xBB, 0xAA,
+ 0xAA, 0xAA, 0xBB, 0xCD, 0xEE, 0xFD, 0xDD, 0xDC, 0xBA, 0xA9, 0x99, 0x99,
+ 0x9A, 0xBB, 0xCD, 0xEE, 0xEC, 0xDC, 0xBA, 0xA9, 0x88, 0x77, 0x88, 0x9A,
+ 0xBC, 0xCE, 0xED, 0xCD, 0xCB, 0xA9, 0x87, 0x76, 0x67, 0x78, 0x9A, 0xBC,
+ 0xDE, 0xDC, 0xCB, 0xA9, 0x87, 0x66, 0x55, 0x66, 0x78, 0x9A, 0xBC, 0xED,
+ 0xCC, 0xBA, 0x98, 0x76, 0x54, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xDC, 0xCB,
+ 0xA9, 0x76, 0x54, 0x34, 0x45, 0x68, 0x9A, 0xBC, 0xDD, 0xCC, 0xBA, 0x98,
+ 0x65, 0x44, 0x34, 0x56, 0x79, 0xAB, 0xCD, 0xDC, 0xDB, 0xA9, 0x87, 0x65,
+ 0x44, 0x56, 0x78, 0x9A, 0xBC, 0xDD, 0xDD, 0xBA, 0x98, 0x76, 0x65, 0x55,
+ 0x67, 0x89, 0xAB, 0xCE, 0xDC, 0xDC, 0xBA, 0x98, 0x77, 0x66, 0x77, 0x89,
+ 0xAB, 0xCC, 0xDD, 0xDD, 0xDB, 0xAA, 0x98, 0x87, 0x78, 0x89, 0x9A, 0xBC,
+ 0xDE, 0xDD, 0xED, 0xCB, 0xAA, 0x99, 0x99, 0x99, 0xAA, 0xBC, 0xCD, 0xED,
+ 0xDE, 0xDD, 0xCB, 0xBA, 0xAA, 0xAA, 0xAB, 0xBC, 0xCD, 0xEF, 0xED, 0xFF,
+ 0xED, 0xDC, 0xCB, 0xBB, 0xBB, 0xBC, 0xDD, 0xEE, 0xFE, 0xDF, 0xFE, 0xDD,
+ 0xDC, 0xCC, 0xCC, 0xDD, 0xDD, 0xEE, 0xFF, 0xFD, 0xFF, 0xFE, 0xEE, 0xED,
+ 0xDD, 0xDD, 0xEE, 0xEE, 0xFF, 0xFF, 0x9D, 0xDD, 0xDE, 0xDD, 0xDD, 0xCD,
+ 0xDD, 0xEE, 0xDE, 0xEF, 0xC0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xCF, 0xFE, 0xEE, 0xDE, 0xDD, 0xDD, 0xDD, 0xED, 0xDD, 0xDD, 0x9F, 0xFF,
+ 0xFF, 0xFF, 0xEE, 0xEE, 0xEE, 0xEF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xEE,
+ 0xDD, 0xDD, 0xCD, 0xDD, 0xDE, 0xEF, 0xFF, 0xEE, 0xFF, 0xED, 0xDC, 0xCB,
+ 0xBB, 0xCC, 0xCD, 0xEE, 0xFF, 0xFE, 0xEF, 0xED, 0xCC, 0xBA, 0xAA, 0xAA,
+ 0xBB, 0xCD, 0xEE, 0xFF, 0xFE, 0xEE, 0xDC, 0xBA, 0x98, 0x88, 0x99, 0xAB,
+ 0xCD, 0xDE, 0xFE, 0xEF, 0xDC, 0xBA, 0x98, 0x77, 0x77, 0x89, 0xAB, 0xCD,
+ 0xFF, 0xEE, 0xED, 0xCA, 0x98, 0x76, 0x55, 0x67, 0x89, 0xAC, 0xDE, 0xFF,
+ 0xEE, 0xCB, 0xA8, 0x76, 0x54, 0x45, 0x67, 0x8A, 0xBD, 0xDF, 0xEE, 0xED,
+ 0xBA, 0x87, 0x54, 0x33, 0x45, 0x78, 0xAB, 0xDE, 0xFF, 0xDE, 0xCB, 0xA8,
+ 0x75, 0x43, 0x24, 0x57, 0x8A, 0xBD, 0xEF, 0xED, 0xED, 0xBA, 0x97, 0x65,
+ 0x44, 0x46, 0x78, 0xAB, 0xDD, 0xFE, 0xDF, 0xDC, 0xA9, 0x87, 0x65, 0x56,
+ 0x78, 0x9A, 0xCD, 0xEF, 0xEE, 0xED, 0xDB, 0xA9, 0x87, 0x77, 0x78, 0x9A,
+ 0xBC, 0xDF, 0xFE, 0xDF, 0xED, 0xCB, 0xA9, 0x98, 0x88, 0x9A, 0xBB, 0xDD,
+ 0xFF, 0xFD, 0xFE, 0xDD, 0xCB, 0xAA, 0xAA, 0xAA, 0xBC, 0xDD, 0xFE, 0xFE,
+ 0xDF, 0xEE, 0xDD, 0xCC, 0xCB, 0xBB, 0xBC, 0xCD, 0xEF, 0xFF, 0xFD, 0xFE,
+ 0xFE, 0xDD, 0xDC, 0xCC, 0xDD, 0xDE, 0xFF, 0xFF, 0xFF, 0xDF, 0xFE, 0xFF,
+ 0xEE, 0xED, 0xEE, 0xEF, 0xFF, 0xFF, 0xFF, 0xFD, 0xFF, 0xFF, 0xFF, 0xEF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x8C, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD,
+ 0xED, 0xFE, 0xEF, 0xFF, 0xC0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xCD, 0xDD, 0xDC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xDD, 0xDD, 0x9E, 0xFE,
+ 0xDD, 0xDC, 0xCC, 0xCC, 0xCC, 0xDD, 0xDD, 0xEE, 0xEE, 0xDE, 0xDD, 0xCC,
+ 0xBB, 0xBB, 0xBB, 0xBB, 0xCD, 0xDD, 0xEF, 0xED, 0xDD, 0xCB, 0xBA, 0xAA,
+ 0xAA, 0xAA, 0xAB, 0xCC, 0xDE, 0xED, 0xCD, 0xCB, 0xBA, 0x99, 0x98, 0x89,
+ 0x9A, 0xAB, 0xCC, 0xDE, 0xDC, 0xDC, 0xBA, 0x98, 0x87, 0x77, 0x88, 0x99,
+ 0xAB, 0xCD, 0xED, 0xCC, 0xBA, 0x98, 0x87, 0x66, 0x66, 0x78, 0x99, 0xAB,
+ 0xCD, 0xDC, 0xCB, 0xA9, 0x87, 0x66, 0x55, 0x66, 0x78, 0x9A, 0xBC, 0xDD,
+ 0xCC, 0xBA, 0x97, 0x66, 0x54, 0x45, 0x66, 0x89, 0xAB, 0xCD, 0xDC, 0xCB,
+ 0xA8, 0x76, 0x54, 0x44, 0x45, 0x67, 0x89, 0xBC, 0xDD, 0xCC, 0xBA, 0x87,
+ 0x65, 0x44, 0x44, 0x56, 0x78, 0xAB, 0xCD, 0xDC, 0xCB, 0xA9, 0x86, 0x65,
+ 0x44, 0x55, 0x67, 0x9A, 0xBC, 0xDD, 0xCC, 0xBA, 0x98, 0x76, 0x65, 0x56,
+ 0x67, 0x89, 0xAB, 0xCD, 0xDC, 0xDC, 0xAA, 0x98, 0x77, 0x66, 0x67, 0x88,
+ 0x9A, 0xBD, 0xED, 0xCD, 0xCB, 0xA9, 0x98, 0x77, 0x77, 0x88, 0x9A, 0xBC,
+ 0xDE, 0xDD, 0xDC, 0xCB, 0xAA, 0x99, 0x88, 0x89, 0x9A, 0xBC, 0xCD, 0xEE,
+ 0xDD, 0xDC, 0xCB, 0xAA, 0xAA, 0xAA, 0xAA, 0xBC, 0xCD, 0xEF, 0xED, 0xEE,
+ 0xDC, 0xCB, 0xBB, 0xBB, 0xBB, 0xBC, 0xCD, 0xEE, 0xFE, 0xDE, 0xEE, 0xDD,
+ 0xDC, 0xCC, 0xCC, 0xCC, 0xDD, 0xEE, 0xFF, 0xED, 0xFF, 0xEE, 0xEE, 0xDD,
+ 0xDD, 0xDD, 0xDE, 0xEE, 0xFF, 0xFF, 0x9D, 0xED, 0xDD, 0xDD, 0xDD, 0xDD,
+ 0xDD, 0xDE, 0xEE, 0xFF, 0xD0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xCE, 0xDD, 0xCC, 0xCB, 0xBB, 0xBB, 0xBC, 0xCC, 0xCD, 0xDD, 0xAE, 0xEE,
+ 0xDC, 0xCC, 0xBB, 0xBB, 0xBC, 0xCC, 0xDD, 0xDE, 0xED, 0xDE, 0xDC, 0xCB,
+ 0xBA, 0xAA, 0xAA, 0xAB, 0xBC, 0xCD, 0xDE, 0xDD, 0xDC, 0xCB, 0xAA, 0x99,
+ 0x99, 0x99, 0xAA, 0xBC, 0xCD, 0xED, 0xCD, 0xCB, 0xA9, 0x98, 0x88, 0x88,
+ 0x89, 0xAA, 0xBC, 0xDD, 0xDC, 0xCB, 0xA9, 0x98, 0x77, 0x77, 0x77, 0x89,
+ 0xAA, 0xBC, 0xDD, 0xCC, 0xBA, 0x98, 0x77, 0x66, 0x66, 0x77, 0x89, 0xAB,
+ 0xCD, 0xCB, 0xBA, 0x98, 0x77, 0x65, 0x55, 0x56, 0x78, 0x89, 0xAB, 0xDC,
+ 0xBB, 0xA9, 0x87, 0x65, 0x55, 0x55, 0x56, 0x78, 0x9A, 0xBC, 0xCB, 0xBA,
+ 0x98, 0x76, 0x55, 0x44, 0x55, 0x67, 0x89, 0xAB, 0xCC, 0xBB, 0xA9, 0x87,
+ 0x65, 0x54, 0x45, 0x56, 0x78, 0x9A, 0xBC, 0xCB, 0xBA, 0x98, 0x76, 0x55,
+ 0x55, 0x55, 0x67, 0x89, 0xAB, 0xCC, 0xBC, 0xAA, 0x88, 0x76, 0x65, 0x55,
+ 0x67, 0x78, 0x9A, 0xBC, 0xCC, 0xCB, 0xA9, 0x87, 0x76, 0x66, 0x67, 0x78,
+ 0x9A, 0xBC, 0xDC, 0xCC, 0xBA, 0xA9, 0x88, 0x77, 0x77, 0x78, 0x99, 0xAB,
+ 0xCD, 0xDC, 0xCC, 0xBA, 0xA9, 0x88, 0x88, 0x88, 0x99, 0xAB, 0xCC, 0xDD,
+ 0xCD, 0xCC, 0xBA, 0xA9, 0x99, 0x99, 0x9A, 0xAB, 0xCC, 0xDE, 0xDD, 0xED,
+ 0xCC, 0xBB, 0xAA, 0xAA, 0xAA, 0xBB, 0xCC, 0xDE, 0xEE, 0xDE, 0xDD, 0xDC,
+ 0xCB, 0xBB, 0xBB, 0xBC, 0xCC, 0xDE, 0xEF, 0xED, 0xFE, 0xED, 0xDD, 0xCC,
+ 0xCC, 0xCC, 0xDD, 0xDE, 0xEF, 0xFE, 0xAD, 0xDD, 0xDD, 0xCC, 0xCC, 0xCC,
+ 0xCD, 0xDD, 0xDE, 0xEE, 0xD0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xBD, 0xDD, 0xDC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xDD, 0xDD, 0x9E, 0xFE,
+ 0xED, 0xDC, 0xCC, 0xCC, 0xCC, 0xCD, 0xDE, 0xEE, 0xED, 0xDE, 0xED, 0xCC,
+ 0xCB, 0xBB, 0xBB, 0xBB, 0xCC, 0xDD, 0xEF, 0xDD, 0xED, 0xCB, 0xBB, 0xAA,
+ 0xAA, 0xAA, 0xBB, 0xCC, 0xDD, 0xED, 0xDD, 0xCC, 0xBA, 0x99, 0x98, 0x99,
+ 0x9A, 0xAB, 0xCD, 0xDE, 0xDC, 0xDC, 0xBA, 0x99, 0x88, 0x77, 0x88, 0x99,
+ 0xAB, 0xCD, 0xED, 0xCC, 0xBA, 0xA9, 0x87, 0x66, 0x67, 0x78, 0x9A, 0xBC,
+ 0xCD, 0xCC, 0xCB, 0xA9, 0x87, 0x65, 0x55, 0x66, 0x78, 0x9A, 0xBC, 0xDC,
+ 0xCC, 0xBA, 0x98, 0x65, 0x54, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xCC, 0xCB,
+ 0xA8, 0x76, 0x54, 0x44, 0x45, 0x67, 0x8A, 0xBC, 0xDC, 0xCC, 0xBA, 0x97,
+ 0x65, 0x44, 0x44, 0x56, 0x78, 0xAB, 0xCD, 0xCC, 0xCB, 0xA9, 0x87, 0x65,
+ 0x44, 0x55, 0x67, 0x9A, 0xBC, 0xDC, 0xCC, 0xBA, 0x98, 0x76, 0x65, 0x55,
+ 0x67, 0x89, 0xAB, 0xCD, 0xCC, 0xCC, 0xBA, 0x98, 0x77, 0x66, 0x67, 0x88,
+ 0x9A, 0xBC, 0xDC, 0xCD, 0xCB, 0xA9, 0x98, 0x87, 0x77, 0x88, 0x9A, 0xBC,
+ 0xDD, 0xDC, 0xDC, 0xCB, 0xAA, 0x99, 0x88, 0x99, 0x9A, 0xBB, 0xCD, 0xED,
+ 0xDE, 0xDC, 0xCB, 0xBA, 0xAA, 0xAA, 0xAB, 0xBB, 0xCD, 0xDE, 0xDD, 0xED,
+ 0xDC, 0xCB, 0xBB, 0xBB, 0xBB, 0xCC, 0xCD, 0xDE, 0xED, 0xDF, 0xED, 0xDD,
+ 0xCC, 0xCC, 0xCC, 0xCC, 0xDD, 0xDE, 0xEF, 0xDD, 0xEE, 0xEE, 0xDD, 0xDD,
+ 0xDD, 0xDD, 0xDE, 0xEE, 0xEF, 0xFE, 0x9D, 0xDD, 0xCC, 0xCC, 0xCC, 0xCC,
+ 0xCD, 0xDD, 0xDD, 0xDE, 0xB0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xDF, 0xFF, 0xFF, 0xFE, 0xFD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0x8F, 0xFF,
+ 0xFF, 0xFF, 0xFE, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xEE, 0xFE, 0xFF, 0xFF, 0xFF, 0xEF, 0xFF, 0xFF, 0xEE, 0xDD,
+ 0xDD, 0xDD, 0xFE, 0xFF, 0xEF, 0xFF, 0xFF, 0xFE, 0xFD, 0xCC, 0xBB, 0xBC,
+ 0xCC, 0xDF, 0xFF, 0xFF, 0xFF, 0xFF, 0xED, 0xCB, 0xBA, 0xAA, 0xAB, 0xCD,
+ 0xDE, 0xFF, 0xFF, 0xFF, 0xFD, 0xCB, 0xA9, 0x88, 0x88, 0x9A, 0xCD, 0xEF,
+ 0xFF, 0xFF, 0xFF, 0xEC, 0xA9, 0x86, 0x66, 0x78, 0x9B, 0xCE, 0xFF, 0xFF,
+ 0xFF, 0xED, 0xCA, 0x86, 0x54, 0x45, 0x78, 0xAC, 0xDE, 0xFF, 0xFF, 0xFF,
+ 0xCB, 0xA8, 0x64, 0x22, 0x46, 0x8A, 0xBD, 0xFF, 0xFF, 0xEF, 0xFE, 0xBA,
+ 0x86, 0x42, 0x24, 0x68, 0xAC, 0xDE, 0xFF, 0xFF, 0xFE, 0xDC, 0xA8, 0x75,
+ 0x44, 0x56, 0x8A, 0xBD, 0xFF, 0xFF, 0xFF, 0xED, 0xCB, 0x98, 0x76, 0x66,
+ 0x79, 0xAC, 0xDF, 0xFF, 0xFF, 0xFF, 0xED, 0xCA, 0x98, 0x88, 0x89, 0xAB,
+ 0xDD, 0xFF, 0xFF, 0xFF, 0xFF, 0xDD, 0xBB, 0xAA, 0xAA, 0xAB, 0xCD, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xDD, 0xCC, 0xBB, 0xCC, 0xDD, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFE, 0xED, 0xDD, 0xDD, 0xDE, 0xEF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x9E, 0xFE, 0xFF, 0xEF, 0xFF, 0xFE,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xE0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xBD, 0xDD, 0xCC, 0xCB, 0xBB, 0xBB, 0xCC, 0xCC, 0xCD, 0xDD, 0x9D, 0xFE,
+ 0xDD, 0xCC, 0xCB, 0xBB, 0xBC, 0xCC, 0xDD, 0xEE, 0xFE, 0xDE, 0xDD, 0xCC,
+ 0xBB, 0xAA, 0xAB, 0xBB, 0xBC, 0xDD, 0xEE, 0xED, 0xDD, 0xCB, 0xAA, 0xA9,
+ 0x99, 0x9A, 0xAB, 0xCC, 0xDD, 0xED, 0xCD, 0xCB, 0xAA, 0x98, 0x88, 0x88,
+ 0x99, 0xAB, 0xBC, 0xDE, 0xDC, 0xCB, 0xBA, 0x98, 0x87, 0x77, 0x78, 0x89,
+ 0xAB, 0xCD, 0xED, 0xCC, 0xBA, 0x98, 0x77, 0x66, 0x66, 0x78, 0x89, 0xAB,
+ 0xCD, 0xCC, 0xCB, 0xA9, 0x87, 0x66, 0x55, 0x66, 0x78, 0x9A, 0xBC, 0xDD,
+ 0xBB, 0xA9, 0x87, 0x66, 0x54, 0x55, 0x66, 0x78, 0x9A, 0xCD, 0xCB, 0xBA,
+ 0x98, 0x76, 0x54, 0x44, 0x45, 0x67, 0x89, 0xAB, 0xCC, 0xBC, 0xA9, 0x87,
+ 0x65, 0x54, 0x44, 0x56, 0x78, 0x9A, 0xBC, 0xCB, 0xCA, 0x98, 0x76, 0x65,
+ 0x54, 0x55, 0x67, 0x89, 0xAB, 0xCC, 0xCC, 0xBA, 0x98, 0x76, 0x65, 0x56,
+ 0x67, 0x89, 0xAB, 0xCD, 0xCC, 0xCB, 0xA9, 0x88, 0x76, 0x66, 0x67, 0x78,
+ 0x9A, 0xBC, 0xDC, 0xCC, 0xCA, 0xA9, 0x88, 0x77, 0x77, 0x88, 0x9A, 0xBB,
+ 0xCD, 0xDC, 0xDC, 0xBA, 0xA9, 0x98, 0x88, 0x89, 0x9A, 0xAB, 0xCD, 0xDD,
+ 0xDE, 0xDC, 0xBB, 0xAA, 0x99, 0x99, 0xAA, 0xBB, 0xCD, 0xDE, 0xDD, 0xED,
+ 0xDC, 0xCB, 0xBA, 0xAA, 0xAB, 0xBB, 0xCD, 0xDE, 0xFE, 0xDE, 0xED, 0xDC,
+ 0xCC, 0xCB, 0xBB, 0xCC, 0xDD, 0xDE, 0xEF, 0xED, 0xEF, 0xEE, 0xDD, 0xDD,
+ 0xDC, 0xDD, 0xDD, 0xEE, 0xFF, 0xFE, 0x8D, 0xDC, 0xCC, 0xCC, 0xCC, 0xCC,
+ 0xCC, 0xCD, 0xDE, 0xEE, 0xC0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xAC, 0xCB, 0xBA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAB, 0xBB, 0xBC, 0x9C, 0xDC,
+ 0xCB, 0xBB, 0xAA, 0xAA, 0xAA, 0xBB, 0xBC, 0xCD, 0xDC, 0xBC, 0xCB, 0xAA,
+ 0xA9, 0x99, 0x99, 0xAA, 0xAB, 0xBC, 0xCD, 0xCB, 0xCB, 0xAA, 0x99, 0x98,
+ 0x88, 0x99, 0x99, 0xAB, 0xBC, 0xDC, 0xBB, 0xBA, 0x99, 0x88, 0x88, 0x88,
+ 0x88, 0x99, 0xAB, 0xBC, 0xBA, 0xBA, 0x99, 0x88, 0x77, 0x77, 0x77, 0x88,
+ 0x9A, 0xAB, 0xCB, 0xAB, 0xA9, 0x87, 0x76, 0x66, 0x66, 0x77, 0x88, 0x9A,
+ 0xBB, 0xBA, 0xA9, 0x98, 0x76, 0x66, 0x55, 0x66, 0x77, 0x89, 0xAB, 0xBB,
+ 0xAA, 0x98, 0x87, 0x66, 0x55, 0x55, 0x66, 0x78, 0x89, 0xAB, 0xBA, 0xA9,
+ 0x88, 0x76, 0x55, 0x55, 0x55, 0x67, 0x78, 0x9A, 0xBB, 0xAA, 0x98, 0x87,
+ 0x65, 0x55, 0x55, 0x56, 0x77, 0x89, 0xAB, 0xBA, 0xA9, 0x98, 0x76, 0x65,
+ 0x55, 0x56, 0x67, 0x88, 0x9A, 0xBB, 0xAA, 0x99, 0x87, 0x76, 0x65, 0x56,
+ 0x66, 0x78, 0x99, 0xAB, 0xBA, 0xBA, 0x98, 0x87, 0x76, 0x66, 0x66, 0x77,
+ 0x89, 0xAA, 0xBB, 0xAB, 0xAA, 0x98, 0x87, 0x77, 0x77, 0x77, 0x89, 0x9A,
+ 0xBC, 0xBB, 0xBB, 0xA9, 0x98, 0x88, 0x87, 0x88, 0x89, 0x9A, 0xBB, 0xCB,
+ 0xBC, 0xBB, 0xAA, 0x99, 0x88, 0x88, 0x99, 0x9A, 0xAB, 0xCD, 0xCB, 0xDC,
+ 0xBB, 0xAA, 0xA9, 0x99, 0x99, 0xAA, 0xBB, 0xCC, 0xDC, 0xBD, 0xCC, 0xBB,
+ 0xBA, 0xAA, 0xAA, 0xBB, 0xBB, 0xCC, 0xDE, 0xCC, 0xED, 0xCC, 0xCB, 0xBB,
+ 0xBB, 0xBB, 0xBC, 0xCD, 0xDE, 0xED, 0x8C, 0xCC, 0xBB, 0xBB, 0xBB, 0xBB,
+ 0xBB, 0xBC, 0xCC, 0xDD, 0xB0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xAB, 0xBA, 0xAA, 0x99, 0x99, 0x99, 0x99, 0xAA, 0xAB, 0xBB, 0x9B, 0xCB,
+ 0xBB, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xBB, 0xCC, 0xDB, 0xBB, 0xBA, 0xAA,
+ 0x99, 0x99, 0x99, 0x99, 0xAA, 0xBB, 0xCC, 0xBA, 0xBA, 0xA9, 0x99, 0x88,
+ 0x88, 0x88, 0x99, 0xAA, 0xBB, 0xCB, 0xAB, 0xA9, 0x98, 0x88, 0x77, 0x78,
+ 0x88, 0x89, 0xAA, 0xBB, 0xBA, 0xAA, 0x98, 0x87, 0x77, 0x77, 0x77, 0x88,
+ 0x99, 0xAA, 0xBA, 0x9A, 0x99, 0x87, 0x77, 0x66, 0x66, 0x77, 0x88, 0x99,
+ 0xAB, 0xA9, 0xA9, 0x88, 0x77, 0x66, 0x66, 0x66, 0x77, 0x88, 0x9A, 0xBA,
+ 0x9A, 0x98, 0x77, 0x66, 0x55, 0x55, 0x66, 0x78, 0x89, 0xAA, 0xA9, 0xA9,
+ 0x87, 0x76, 0x65, 0x55, 0x56, 0x67, 0x78, 0x9A, 0xAA, 0x9A, 0x98, 0x77,
+ 0x66, 0x55, 0x55, 0x66, 0x77, 0x89, 0xAA, 0xA9, 0xA9, 0x88, 0x76, 0x65,
+ 0x55, 0x56, 0x67, 0x78, 0x9A, 0xAA, 0x9A, 0x98, 0x87, 0x76, 0x66, 0x66,
+ 0x66, 0x78, 0x89, 0xAA, 0xA9, 0xA9, 0x98, 0x87, 0x76, 0x66, 0x67, 0x77,
+ 0x89, 0x9A, 0xBA, 0xAA, 0xA9, 0x88, 0x87, 0x77, 0x77, 0x77, 0x88, 0x9A,
+ 0xAB, 0xAA, 0xBA, 0xA9, 0x98, 0x88, 0x77, 0x78, 0x88, 0x99, 0xAB, 0xBB,
+ 0xAB, 0xBA, 0xA9, 0x98, 0x88, 0x88, 0x89, 0x99, 0xAA, 0xBC, 0xBA, 0xCB,
+ 0xAA, 0xA9, 0x99, 0x99, 0x99, 0x9A, 0xAA, 0xBB, 0xCB, 0xBC, 0xCB, 0xBA,
+ 0xAA, 0xAA, 0xAA, 0xAA, 0xAB, 0xBB, 0xCD, 0xBB, 0xCC, 0xCB, 0xBB, 0xBA,
+ 0xAA, 0xAA, 0xBB, 0xBC, 0xCD, 0xDC, 0x9B, 0xBB, 0xBA, 0xAA, 0xAA, 0xAA,
+ 0xAA, 0xAB, 0xBB, 0xCC, 0xA0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xAC, 0xBB, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xBB, 0xBC, 0x9C, 0xDC,
+ 0xCB, 0xBB, 0xAA, 0xAA, 0xAA, 0xBB, 0xBC, 0xCD, 0xDC, 0xBC, 0xBB, 0xAA,
+ 0xA9, 0x99, 0x99, 0xAA, 0xAB, 0xBC, 0xCD, 0xBB, 0xCB, 0xAA, 0x99, 0x98,
+ 0x88, 0x89, 0x99, 0xAB, 0xBC, 0xCB, 0xAB, 0xAA, 0x99, 0x88, 0x88, 0x78,
+ 0x88, 0x99, 0xAB, 0xBC, 0xBA, 0xBA, 0x99, 0x87, 0x77, 0x77, 0x77, 0x88,
+ 0x9A, 0xAB, 0xCB, 0xAA, 0xA9, 0x88, 0x76, 0x66, 0x66, 0x77, 0x88, 0x9A,
+ 0xBB, 0xBA, 0xA9, 0x98, 0x76, 0x66, 0x55, 0x66, 0x77, 0x89, 0x9A, 0xBB,
+ 0xAA, 0x98, 0x87, 0x66, 0x55, 0x55, 0x66, 0x78, 0x89, 0xAB, 0xAA, 0xA9,
+ 0x87, 0x76, 0x55, 0x55, 0x55, 0x67, 0x88, 0x9A, 0xBA, 0xAA, 0x98, 0x87,
+ 0x65, 0x55, 0x55, 0x56, 0x77, 0x89, 0xAB, 0xAA, 0xA9, 0x88, 0x76, 0x65,
+ 0x55, 0x56, 0x67, 0x88, 0x9A, 0xBA, 0xAA, 0x99, 0x87, 0x76, 0x65, 0x56,
+ 0x67, 0x78, 0x99, 0xAB, 0xAA, 0xBA, 0x98, 0x87, 0x76, 0x66, 0x67, 0x78,
+ 0x89, 0xAA, 0xBB, 0xAB, 0xAA, 0x98, 0x87, 0x77, 0x77, 0x78, 0x89, 0x9A,
+ 0xBC, 0xBA, 0xBB, 0xA9, 0x98, 0x88, 0x87, 0x88, 0x89, 0x9A, 0xAB, 0xCB,
+ 0xBC, 0xBB, 0xAA, 0x99, 0x88, 0x88, 0x99, 0x9A, 0xAB, 0xBC, 0xBB, 0xCC,
+ 0xBB, 0xAA, 0xA9, 0x99, 0x99, 0xAA, 0xAB, 0xBC, 0xDB, 0xBD, 0xCC, 0xBB,
+ 0xBA, 0xAA, 0xAA, 0xAA, 0xBB, 0xCC, 0xDD, 0xCC, 0xDD, 0xCC, 0xCB, 0xBB,
+ 0xBB, 0xBB, 0xBC, 0xCC, 0xCD, 0xDC, 0x8C, 0xCB, 0xBB, 0xBA, 0xAA, 0xAA,
+ 0xBB, 0xBB, 0xBC, 0xCC, 0xA0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xBD, 0xDC, 0xCC, 0xCB, 0xBB, 0xBB, 0xBB, 0xCC, 0xCC, 0xCD, 0x8D, 0xEE,
+ 0xDD, 0xCC, 0xCB, 0xBB, 0xCC, 0xCC, 0xDD, 0xEE, 0xFD, 0xDD, 0xDC, 0xCB,
+ 0xBA, 0xAA, 0xAB, 0xBB, 0xBC, 0xDD, 0xEF, 0xDD, 0xDC, 0xCB, 0xAA, 0xA9,
+ 0x99, 0x9A, 0xAB, 0xBC, 0xDD, 0xED, 0xCC, 0xCB, 0xAA, 0x98, 0x88, 0x88,
+ 0x99, 0xAB, 0xBC, 0xDD, 0xDC, 0xCB, 0xA9, 0x98, 0x87, 0x77, 0x78, 0x89,
+ 0xAB, 0xCC, 0xDC, 0xCC, 0xBA, 0x98, 0x77, 0x66, 0x66, 0x77, 0x89, 0xAB,
+ 0xCD, 0xCB, 0xBB, 0xA9, 0x87, 0x66, 0x55, 0x66, 0x78, 0x9A, 0xBC, 0xDC,
+ 0xBB, 0xA9, 0x87, 0x66, 0x54, 0x55, 0x66, 0x78, 0x9A, 0xBC, 0xCB, 0xBA,
+ 0x98, 0x76, 0x54, 0x44, 0x45, 0x67, 0x89, 0xAB, 0xCC, 0xBB, 0xA9, 0x87,
+ 0x65, 0x54, 0x44, 0x56, 0x78, 0x9A, 0xBC, 0xCB, 0xBA, 0x98, 0x76, 0x65,
+ 0x54, 0x56, 0x67, 0x89, 0xAB, 0xCC, 0xBC, 0xBA, 0x98, 0x76, 0x65, 0x56,
+ 0x67, 0x88, 0x9B, 0xBD, 0xCC, 0xCB, 0xA9, 0x88, 0x76, 0x66, 0x67, 0x78,
+ 0x9A, 0xBC, 0xDD, 0xCD, 0xBB, 0xA9, 0x88, 0x77, 0x77, 0x88, 0x9A, 0xAB,
+ 0xCD, 0xCC, 0xDC, 0xBB, 0xA9, 0x98, 0x88, 0x89, 0x99, 0xAB, 0xCD, 0xDD,
+ 0xDD, 0xCC, 0xBA, 0xAA, 0x99, 0x99, 0xAA, 0xAB, 0xCC, 0xDE, 0xDD, 0xED,
+ 0xDC, 0xCB, 0xBA, 0xAA, 0xAB, 0xBB, 0xCD, 0xDE, 0xEE, 0xDE, 0xDD, 0xDC,
+ 0xCB, 0xBB, 0xBB, 0xBC, 0xCD, 0xDE, 0xFF, 0xED, 0xFF, 0xDE, 0xDD, 0xDC,
+ 0xCC, 0xCD, 0xDD, 0xEE, 0xEF, 0xFE, 0x9D, 0xDD, 0xCC, 0xCC, 0xCC, 0xCC,
+ 0xCD, 0xDD, 0xDE, 0xEE, 0xC0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xEF, 0xFF, 0xFF, 0xFE, 0xEF, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0x9F, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xEE, 0xDE, 0xFF, 0xEF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFD,
+ 0xDD, 0xDD, 0xDD, 0xDD, 0xEE, 0xFF, 0xFF, 0xEF, 0xFF, 0xFD, 0xDC, 0xCC,
+ 0xBB, 0xBC, 0xCD, 0xDE, 0xFF, 0xFE, 0xFF, 0xFE, 0xDC, 0xBA, 0xAA, 0xAA,
+ 0xAB, 0xCD, 0xEF, 0xFF, 0xFF, 0xFF, 0xDC, 0xBA, 0x98, 0x88, 0x89, 0xAB,
+ 0xCD, 0xEF, 0xFF, 0xEF, 0xDC, 0xBA, 0x98, 0x76, 0x77, 0x89, 0xAB, 0xCD,
+ 0xFF, 0xEE, 0xED, 0xCA, 0x98, 0x66, 0x55, 0x66, 0x89, 0xAB, 0xDE, 0xFF,
+ 0xEE, 0xDB, 0xA8, 0x76, 0x44, 0x45, 0x67, 0x8A, 0xCD, 0xFF, 0xFE, 0xFD,
+ 0xBA, 0x86, 0x54, 0x33, 0x45, 0x78, 0xAB, 0xDE, 0xFF, 0xDE, 0xDB, 0xA8,
+ 0x75, 0x43, 0x34, 0x56, 0x8A, 0xBD, 0xEF, 0xFE, 0xFD, 0xBA, 0x87, 0x65,
+ 0x44, 0x45, 0x78, 0xAB, 0xDE, 0xFF, 0xEE, 0xDC, 0xA9, 0x87, 0x65, 0x55,
+ 0x68, 0x9A, 0xCD, 0xFF, 0xFE, 0xFD, 0xCB, 0xA9, 0x87, 0x76, 0x77, 0x9A,
+ 0xBC, 0xEF, 0xFF, 0xEF, 0xFD, 0xCB, 0xA9, 0x88, 0x88, 0x9A, 0xBC, 0xDF,
+ 0xFF, 0xFD, 0xFE, 0xDC, 0xCB, 0xAA, 0x9A, 0xAA, 0xBC, 0xDF, 0xFF, 0xFF,
+ 0xDF, 0xFE, 0xDD, 0xCC, 0xBB, 0xBB, 0xCD, 0xDD, 0xFF, 0xFF, 0xFD, 0xFF,
+ 0xFE, 0xED, 0xDC, 0xDC, 0xDD, 0xEE, 0xFF, 0xFF, 0xFF, 0xDF, 0xFF, 0xEE,
+ 0xEF, 0xED, 0xEE, 0xEF, 0xFF, 0xFF, 0xFF, 0xFD, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x8D, 0xDD, 0xCD, 0xDE, 0xDD, 0xDF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xE0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xDE, 0xDD, 0xDD, 0xDC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCD, 0xDD, 0x9E, 0xFE,
+ 0xED, 0xDD, 0xCC, 0xCC, 0xCC, 0xDD, 0xDE, 0xEF, 0xFD, 0xEE, 0xED, 0xDC,
+ 0xCB, 0xBB, 0xBB, 0xBC, 0xCD, 0xDE, 0xEF, 0xED, 0xED, 0xCC, 0xBA, 0xAA,
+ 0xAA, 0xAA, 0xBB, 0xCC, 0xDE, 0xFD, 0xDE, 0xCC, 0xBA, 0x99, 0x98, 0x99,
+ 0x9A, 0xAB, 0xCD, 0xDE, 0xDD, 0xDC, 0xBA, 0x98, 0x87, 0x77, 0x88, 0x9A,
+ 0xAB, 0xCD, 0xED, 0xCD, 0xCB, 0xA8, 0x87, 0x66, 0x67, 0x78, 0x9A, 0xBC,
+ 0xDD, 0xDC, 0xCB, 0xA9, 0x87, 0x65, 0x55, 0x66, 0x78, 0x9A, 0xBC, 0xDD,
+ 0xCC, 0xBA, 0x97, 0x65, 0x54, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xDC, 0xCB,
+ 0xA9, 0x76, 0x54, 0x44, 0x45, 0x67, 0x9A, 0xBC, 0xDD, 0xCC, 0xBA, 0x87,
+ 0x65, 0x44, 0x44, 0x56, 0x79, 0xAB, 0xCD, 0xDC, 0xCB, 0xA9, 0x87, 0x65,
+ 0x44, 0x55, 0x67, 0x9A, 0xBC, 0xDD, 0xCD, 0xBA, 0x98, 0x76, 0x65, 0x55,
+ 0x67, 0x89, 0xAC, 0xCE, 0xDC, 0xCC, 0xBA, 0x98, 0x76, 0x66, 0x67, 0x89,
+ 0xAB, 0xCD, 0xED, 0xCD, 0xCB, 0xA9, 0x98, 0x87, 0x77, 0x88, 0x9A, 0xBC,
+ 0xDE, 0xEC, 0xDD, 0xCB, 0xAA, 0x99, 0x89, 0x99, 0xAA, 0xBC, 0xDE, 0xEE,
+ 0xDD, 0xDC, 0xCB, 0xBA, 0xAA, 0xAA, 0xAB, 0xBC, 0xDD, 0xEF, 0xEC, 0xED,
+ 0xDC, 0xCB, 0xBB, 0xBB, 0xBB, 0xCC, 0xDD, 0xEF, 0xFE, 0xDF, 0xEE, 0xDD,
+ 0xCC, 0xCC, 0xCC, 0xCD, 0xED, 0xFE, 0xFF, 0xFC, 0xFF, 0xFE, 0xED, 0xDD,
+ 0xDD, 0xDD, 0xEE, 0xFE, 0xFF, 0xFF, 0x9D, 0xED, 0xDD, 0xDD, 0xDD, 0xDD,
+ 0xED, 0xDE, 0xEF, 0xFF, 0xD0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xCE, 0xDD, 0xDC, 0xCC, 0xBB, 0xBB, 0xBC, 0xCC, 0xCD, 0xDD, 0xAE, 0xEE,
+ 0xDD, 0xCC, 0xCB, 0xBB, 0xBC, 0xCC, 0xDD, 0xEE, 0xEE, 0xDE, 0xDD, 0xCB,
+ 0xBA, 0xAA, 0xAA, 0xBB, 0xBC, 0xCD, 0xDE, 0xDD, 0xDC, 0xCB, 0xAA, 0x99,
+ 0x99, 0x9A, 0xAA, 0xBC, 0xCD, 0xED, 0xDD, 0xCB, 0xA9, 0x98, 0x88, 0x88,
+ 0x89, 0xAA, 0xBC, 0xCD, 0xDC, 0xCB, 0xA9, 0x98, 0x77, 0x77, 0x78, 0x89,
+ 0xAA, 0xBC, 0xDD, 0xCC, 0xBA, 0x98, 0x77, 0x66, 0x66, 0x77, 0x89, 0xAB,
+ 0xCD, 0xDC, 0xCA, 0x98, 0x77, 0x65, 0x55, 0x66, 0x78, 0x99, 0xAB, 0xDC,
+ 0xBB, 0xA9, 0x87, 0x65, 0x55, 0x55, 0x66, 0x78, 0x9A, 0xBC, 0xCB, 0xBA,
+ 0x98, 0x76, 0x54, 0x44, 0x55, 0x67, 0x89, 0xAB, 0xCC, 0xBB, 0xA9, 0x87,
+ 0x65, 0x54, 0x45, 0x56, 0x78, 0x9A, 0xBC, 0xCB, 0xBA, 0x98, 0x76, 0x65,
+ 0x54, 0x55, 0x67, 0x89, 0xAB, 0xCC, 0xBC, 0xAA, 0x98, 0x76, 0x65, 0x55,
+ 0x67, 0x78, 0x9A, 0xCD, 0xDC, 0xCB, 0xA9, 0x87, 0x76, 0x66, 0x67, 0x78,
+ 0x9A, 0xBC, 0xDD, 0xCC, 0xBA, 0xA9, 0x88, 0x77, 0x77, 0x78, 0x99, 0xAB,
+ 0xCD, 0xDC, 0xDC, 0xBA, 0xA9, 0x98, 0x88, 0x88, 0x99, 0xAB, 0xCD, 0xED,
+ 0xCD, 0xCC, 0xBA, 0xAA, 0x99, 0x99, 0x9A, 0xAB, 0xCC, 0xDE, 0xED, 0xED,
+ 0xCC, 0xBB, 0xAA, 0xAA, 0xAA, 0xBB, 0xCD, 0xDE, 0xFE, 0xDE, 0xDD, 0xCC,
+ 0xCC, 0xBB, 0xBB, 0xCC, 0xCD, 0xDE, 0xFF, 0xED, 0xFE, 0xED, 0xDD, 0xCC,
+ 0xCC, 0xCD, 0xDD, 0xEE, 0xEF, 0xFF, 0xAD, 0xDD, 0xDC, 0xCC, 0xCC, 0xCC,
+ 0xCD, 0xDD, 0xEE, 0xEF, 0xD0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xCE, 0xED, 0xDD, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xDD, 0x9E, 0xFF,
+ 0xEE, 0xDD, 0xCC, 0xCC, 0xCC, 0xCD, 0xDE, 0xEF, 0xFD, 0xEF, 0xED, 0xDC,
+ 0xCB, 0xBB, 0xBB, 0xBB, 0xCC, 0xDD, 0xEF, 0xDD, 0xED, 0xCC, 0xBB, 0xAA,
+ 0xAA, 0xAA, 0xAB, 0xCC, 0xDD, 0xED, 0xDE, 0xDC, 0xBA, 0xA9, 0x98, 0x89,
+ 0x9A, 0xAB, 0xCC, 0xDE, 0xDD, 0xDC, 0xBA, 0x98, 0x87, 0x77, 0x88, 0x99,
+ 0xAB, 0xCD, 0xED, 0xCD, 0xCB, 0xA8, 0x87, 0x66, 0x67, 0x78, 0x9A, 0xBB,
+ 0xCD, 0xDC, 0xDB, 0xA9, 0x87, 0x65, 0x55, 0x66, 0x78, 0x9A, 0xBC, 0xDD,
+ 0xCC, 0xBA, 0x97, 0x65, 0x54, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xDC, 0xCB,
+ 0xA8, 0x76, 0x54, 0x44, 0x45, 0x67, 0x9A, 0xBC, 0xDD, 0xCC, 0xBA, 0x97,
+ 0x65, 0x44, 0x44, 0x56, 0x78, 0xAB, 0xCD, 0xDC, 0xCB, 0xA9, 0x87, 0x65,
+ 0x44, 0x55, 0x67, 0x9A, 0xBC, 0xDD, 0xCC, 0xBA, 0x98, 0x76, 0x65, 0x55,
+ 0x67, 0x89, 0xAB, 0xCD, 0xDC, 0xCC, 0xBA, 0x98, 0x77, 0x66, 0x67, 0x88,
+ 0x9A, 0xBC, 0xDD, 0xCD, 0xCB, 0xA9, 0x98, 0x87, 0x78, 0x89, 0x9A, 0xBC,
+ 0xCD, 0xDD, 0xDC, 0xCB, 0xAA, 0x99, 0x98, 0x99, 0x9A, 0xBB, 0xCD, 0xDD,
+ 0xDE, 0xDC, 0xCB, 0xBA, 0xAA, 0xAA, 0xAB, 0xBB, 0xCD, 0xDD, 0xDD, 0xED,
+ 0xDC, 0xCB, 0xBB, 0xBB, 0xBB, 0xBC, 0xCC, 0xDE, 0xED, 0xDE, 0xED, 0xDD,
+ 0xCC, 0xCC, 0xCC, 0xCC, 0xCD, 0xDE, 0xEF, 0xDD, 0xFE, 0xEE, 0xDD, 0xDD,
+ 0xDD, 0xDD, 0xDE, 0xEE, 0xEF, 0xFE, 0x9D, 0xDD, 0xDD, 0xDD, 0xDD, 0xCC,
+ 0xDD, 0xDD, 0xDE, 0xDE, 0xC0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xDF, 0xFF, 0xFE, 0xEE, 0xDD, 0xDD, 0xDC, 0xCC, 0xDD, 0xCD, 0x8F, 0xFF,
+ 0xFF, 0xFF, 0xFE, 0xDE, 0xEE, 0xDF, 0xEF, 0xFF, 0xFE, 0xEF, 0xFF, 0xFF,
+ 0xDD, 0xDC, 0xCC, 0xDD, 0xDE, 0xEE, 0xFF, 0xDF, 0xFF, 0xEE, 0xDC, 0xCB,
+ 0xBB, 0xBC, 0xCD, 0xDD, 0xFF, 0xFE, 0xFF, 0xFD, 0xDC, 0xBA, 0xAA, 0xAA,
+ 0xAB, 0xCD, 0xEE, 0xFF, 0xEE, 0xEE, 0xCC, 0xBA, 0x98, 0x88, 0x89, 0xAB,
+ 0xCC, 0xEF, 0xFF, 0xFF, 0xDC, 0xBA, 0x88, 0x77, 0x77, 0x89, 0xAB, 0xCD,
+ 0xEF, 0xFE, 0xED, 0xCA, 0x97, 0x65, 0x55, 0x67, 0x89, 0xAC, 0xDE, 0xFE,
+ 0xEE, 0xDB, 0xA8, 0x75, 0x44, 0x45, 0x67, 0x8A, 0xBD, 0xEE, 0xED, 0xFC,
+ 0xBA, 0x87, 0x54, 0x33, 0x45, 0x78, 0x9B, 0xDE, 0xFF, 0xDD, 0xCB, 0xA8,
+ 0x75, 0x43, 0x34, 0x57, 0x8A, 0xBC, 0xEF, 0xFD, 0xDC, 0xBA, 0x87, 0x65,
+ 0x44, 0x45, 0x78, 0xAB, 0xDE, 0xFF, 0xDE, 0xDC, 0xA9, 0x87, 0x65, 0x55,
+ 0x68, 0x9A, 0xCD, 0xEF, 0xFD, 0xED, 0xCB, 0xA9, 0x87, 0x77, 0x78, 0x9A,
+ 0xBC, 0xEF, 0xFF, 0xDE, 0xEC, 0xCB, 0xA9, 0x88, 0x88, 0x9A, 0xBC, 0xDD,
+ 0xFF, 0xFF, 0xFF, 0xDC, 0xBB, 0xAA, 0xAA, 0xAA, 0xBC, 0xDD, 0xEF, 0xFF,
+ 0xEF, 0xFE, 0xDD, 0xCC, 0xBB, 0xBB, 0xCC, 0xDD, 0xFF, 0xFF, 0xFE, 0xFE,
+ 0xEE, 0xDD, 0xDC, 0xCC, 0xCD, 0xDF, 0xEF, 0xFF, 0xFF, 0xEF, 0xFF, 0xFF,
+ 0xEE, 0xED, 0xEE, 0xEE, 0xFF, 0xFF, 0xFF, 0xFD, 0xFF, 0xFF, 0xFF, 0xEF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x8D, 0xDD, 0xDE, 0xED, 0xDE, 0xFF,
+ 0xEF, 0xFF, 0xFF, 0xFF, 0xD0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xCF, 0xDD, 0xDC, 0xCC, 0xCC, 0xCB, 0xCC, 0xCC, 0xCC, 0xCD, 0x8E, 0xFE,
+ 0xED, 0xDD, 0xCC, 0xCC, 0xCC, 0xCC, 0xEE, 0xEF, 0xFD, 0xDE, 0xED, 0xCC,
+ 0xBB, 0xBB, 0xBB, 0xBC, 0xCD, 0xDE, 0xEF, 0xED, 0xED, 0xCB, 0xBA, 0xAA,
+ 0xAA, 0xAA, 0xBB, 0xCC, 0xDE, 0xFD, 0xDD, 0xCC, 0xBA, 0x99, 0x99, 0x99,
+ 0x9A, 0xAB, 0xCD, 0xEE, 0xDC, 0xDC, 0xBA, 0x98, 0x88, 0x77, 0x88, 0x99,
+ 0xAB, 0xCD, 0xED, 0xCC, 0xCA, 0x98, 0x87, 0x66, 0x67, 0x78, 0x9A, 0xBB,
+ 0xDD, 0xDC, 0xCB, 0xA9, 0x87, 0x66, 0x55, 0x66, 0x78, 0x9A, 0xBC, 0xDD,
+ 0xCC, 0xBA, 0x98, 0x66, 0x54, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xDC, 0xCB,
+ 0xA8, 0x76, 0x54, 0x44, 0x45, 0x67, 0x9A, 0xBC, 0xDD, 0xCC, 0xBA, 0x97,
+ 0x65, 0x44, 0x34, 0x56, 0x79, 0xAB, 0xCD, 0xDC, 0xCB, 0xA9, 0x87, 0x65,
+ 0x44, 0x56, 0x68, 0x9A, 0xBC, 0xDD, 0xCC, 0xBA, 0x98, 0x76, 0x65, 0x56,
+ 0x67, 0x89, 0xAB, 0xCD, 0xDC, 0xCC, 0xBA, 0x98, 0x77, 0x66, 0x67, 0x88,
+ 0x9A, 0xBC, 0xED, 0xCD, 0xCB, 0xAA, 0x98, 0x87, 0x77, 0x88, 0x9A, 0xBC,
+ 0xDE, 0xDC, 0xDC, 0xCB, 0xAA, 0x99, 0x88, 0x99, 0x9A, 0xBC, 0xCD, 0xEE,
+ 0xDE, 0xDC, 0xCB, 0xBA, 0xAA, 0xAA, 0xAA, 0xBC, 0xCD, 0xDF, 0xED, 0xED,
+ 0xDC, 0xCB, 0xBB, 0xBB, 0xBB, 0xBC, 0xCD, 0xEE, 0xFE, 0xDE, 0xED, 0xDD,
+ 0xCC, 0xCC, 0xCC, 0xCC, 0xDD, 0xEF, 0xFF, 0xED, 0xFE, 0xEE, 0xED, 0xDD,
+ 0xCD, 0xDD, 0xDE, 0xFF, 0xFF, 0xFF, 0x7C, 0xCC, 0xCC, 0xCC, 0xDC, 0xCD,
+ 0xDD, 0xDE, 0xEE, 0xFF, 0xD0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xBC, 0xCB, 0xBA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAB, 0xBB, 0xBC, 0x8C, 0xDD,
+ 0xCB, 0xBB, 0xBA, 0xAA, 0xAB, 0xBB, 0xBC, 0xCD, 0xDC, 0xCC, 0xCB, 0xBA,
+ 0xAA, 0x99, 0x9A, 0xAA, 0xAB, 0xBC, 0xDD, 0xCB, 0xCB, 0xBA, 0xA9, 0x99,
+ 0x89, 0x99, 0x9A, 0xAB, 0xBC, 0xDC, 0xBB, 0xBA, 0x99, 0x88, 0x88, 0x88,
+ 0x89, 0x9A, 0xAB, 0xCC, 0xBB, 0xBA, 0xA9, 0x88, 0x77, 0x77, 0x77, 0x88,
+ 0x9A, 0xAB, 0xCB, 0xAB, 0xA9, 0x88, 0x77, 0x66, 0x66, 0x77, 0x89, 0x9A,
+ 0xBC, 0xBA, 0xAA, 0x98, 0x77, 0x66, 0x55, 0x66, 0x78, 0x89, 0xAB, 0xCB,
+ 0xAA, 0xA9, 0x87, 0x66, 0x55, 0x55, 0x66, 0x78, 0x9A, 0xAB, 0xBA, 0xA9,
+ 0x98, 0x76, 0x55, 0x44, 0x55, 0x67, 0x89, 0x9A, 0xBB, 0xAA, 0x99, 0x87,
+ 0x66, 0x54, 0x45, 0x56, 0x78, 0x99, 0xAB, 0xBA, 0xAA, 0x98, 0x76, 0x65,
+ 0x55, 0x56, 0x67, 0x89, 0xAA, 0xBB, 0xAA, 0xA9, 0x88, 0x76, 0x65, 0x56,
+ 0x66, 0x78, 0x9A, 0xAB, 0xBA, 0xBA, 0x99, 0x87, 0x76, 0x66, 0x67, 0x78,
+ 0x89, 0xAB, 0xCB, 0xBB, 0xAA, 0x99, 0x87, 0x77, 0x77, 0x78, 0x89, 0x9A,
+ 0xBC, 0xBB, 0xCB, 0xAA, 0x99, 0x88, 0x88, 0x88, 0x89, 0x9A, 0xBB, 0xCC,
+ 0xBC, 0xBB, 0xAA, 0x99, 0x99, 0x89, 0x99, 0xAA, 0xBB, 0xCD, 0xCB, 0xCC,
+ 0xCB, 0xAA, 0xA9, 0x99, 0xAA, 0xAA, 0xBB, 0xCC, 0xDC, 0xBD, 0xDC, 0xBB,
+ 0xBA, 0xAA, 0xAA, 0xBB, 0xBB, 0xCC, 0xDE, 0xCC, 0xDD, 0xDC, 0xCC, 0xBB,
+ 0xBB, 0xBB, 0xCC, 0xCD, 0xDD, 0xED, 0x8C, 0xCB, 0xBB, 0xBB, 0xBB, 0xBB,
+ 0xBB, 0xBC, 0xCC, 0xDD, 0xB0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xAB, 0xBA, 0xAA, 0xA9, 0x99, 0x99, 0x99, 0xAA, 0xAA, 0xBB, 0x9B, 0xCC,
+ 0xBB, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xBB, 0xCC, 0xCB, 0xBC, 0xBA, 0xAA,
+ 0x99, 0x99, 0x99, 0x99, 0xAA, 0xBB, 0xCC, 0xBA, 0xBB, 0xA9, 0x99, 0x88,
+ 0x88, 0x88, 0x99, 0xAA, 0xBB, 0xCB, 0xAB, 0xA9, 0x98, 0x88, 0x77, 0x78,
+ 0x88, 0x99, 0xAA, 0xBB, 0xBA, 0xAA, 0x98, 0x87, 0x77, 0x77, 0x77, 0x88,
+ 0x99, 0xAA, 0xBA, 0xAA, 0x99, 0x87, 0x76, 0x66, 0x66, 0x77, 0x88, 0x99,
+ 0xAB, 0xA9, 0xA9, 0x88, 0x76, 0x66, 0x66, 0x66, 0x77, 0x88, 0x9A, 0xBA,
+ 0x9A, 0x98, 0x77, 0x66, 0x55, 0x56, 0x66, 0x78, 0x89, 0xAA, 0xA9, 0xA9,
+ 0x87, 0x76, 0x65, 0x55, 0x56, 0x67, 0x78, 0x9A, 0xAA, 0x9A, 0x98, 0x77,
+ 0x66, 0x55, 0x55, 0x66, 0x77, 0x89, 0xAA, 0xA9, 0xA9, 0x88, 0x76, 0x65,
+ 0x55, 0x56, 0x67, 0x78, 0x9A, 0xAA, 0x9A, 0x98, 0x87, 0x76, 0x66, 0x66,
+ 0x66, 0x78, 0x89, 0xAA, 0xA9, 0xA9, 0x98, 0x87, 0x76, 0x66, 0x66, 0x77,
+ 0x88, 0x9A, 0xBA, 0xAA, 0xA9, 0x98, 0x87, 0x77, 0x77, 0x77, 0x88, 0x9A,
+ 0xAB, 0xAA, 0xBA, 0xA9, 0x98, 0x88, 0x77, 0x78, 0x88, 0x99, 0xAB, 0xBB,
+ 0xAB, 0xBA, 0xA9, 0x98, 0x88, 0x88, 0x89, 0x99, 0xAA, 0xBC, 0xBB, 0xCB,
+ 0xBA, 0xA9, 0x99, 0x99, 0x99, 0x9A, 0xAA, 0xBC, 0xCB, 0xBC, 0xCB, 0xBA,
+ 0xAA, 0xAA, 0xAA, 0xAA, 0xAB, 0xBC, 0xCD, 0xCB, 0xDC, 0xCB, 0xBB, 0xBA,
+ 0xAA, 0xAB, 0xBB, 0xBC, 0xCD, 0xDC, 0x9B, 0xBB, 0xBA, 0xAA, 0xAA, 0xAA,
+ 0xAA, 0xBB, 0xBC, 0xCC, 0xB0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xAC, 0xCB, 0xBB, 0xAA, 0xAA, 0xAA, 0xAA, 0xAB, 0xBB, 0xBC, 0x8C, 0xDC,
+ 0xCB, 0xBB, 0xAA, 0xAA, 0xBB, 0xBB, 0xCC, 0xCD, 0xDC, 0xBD, 0xCB, 0xBA,
+ 0xAA, 0x99, 0xAA, 0xAA, 0xBB, 0xCC, 0xDD, 0xCB, 0xCB, 0xBA, 0xA9, 0x99,
+ 0x99, 0x99, 0x9A, 0xAB, 0xBC, 0xDB, 0xBB, 0xBA, 0x99, 0x88, 0x88, 0x88,
+ 0x89, 0x9A, 0xAB, 0xBC, 0xBB, 0xBA, 0xA9, 0x88, 0x77, 0x77, 0x78, 0x88,
+ 0x9A, 0xBB, 0xCB, 0xAB, 0xA9, 0x88, 0x77, 0x66, 0x66, 0x77, 0x89, 0x9A,
+ 0xBB, 0xBA, 0xBA, 0x98, 0x77, 0x66, 0x55, 0x66, 0x78, 0x89, 0xAB, 0xBB,
+ 0xAA, 0x99, 0x87, 0x66, 0x55, 0x55, 0x66, 0x78, 0x99, 0xBB, 0xBA, 0xA9,
+ 0x98, 0x76, 0x55, 0x44, 0x55, 0x67, 0x89, 0xAA, 0xBB, 0xAA, 0x99, 0x87,
+ 0x65, 0x54, 0x45, 0x56, 0x78, 0x99, 0xAB, 0xBA, 0xAA, 0x98, 0x76, 0x65,
+ 0x55, 0x56, 0x67, 0x89, 0x9A, 0xBB, 0xAB, 0xA9, 0x88, 0x76, 0x65, 0x56,
+ 0x67, 0x78, 0x9A, 0xAB, 0xBA, 0xBA, 0x99, 0x87, 0x76, 0x66, 0x67, 0x78,
+ 0x89, 0xAB, 0xBB, 0xBB, 0xBA, 0x98, 0x88, 0x77, 0x77, 0x78, 0x89, 0x9A,
+ 0xBC, 0xBB, 0xBB, 0xAA, 0x99, 0x88, 0x88, 0x88, 0x89, 0x9A, 0xAB, 0xCB,
+ 0xBC, 0xBB, 0xAA, 0x99, 0x99, 0x99, 0x99, 0x9A, 0xAB, 0xCC, 0xCB, 0xDC,
+ 0xBB, 0xAA, 0xAA, 0x99, 0x9A, 0xAA, 0xBB, 0xCC, 0xDC, 0xCD, 0xCC, 0xCB,
+ 0xBB, 0xAA, 0xAA, 0xAB, 0xBB, 0xCC, 0xDD, 0xCC, 0xDD, 0xCC, 0xCC, 0xBB,
+ 0xBB, 0xBB, 0xCC, 0xCC, 0xDE, 0xED, 0x8C, 0xCB, 0xBB, 0xBB, 0xBB, 0xBB,
+ 0xBB, 0xBB, 0xCC, 0xCD, 0xB0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xDF, 0xEE, 0xED, 0xDC, 0xCC, 0xBC, 0xCC, 0xCC, 0xDC, 0xCD, 0x7E, 0xFF,
+ 0xEE, 0xDD, 0xCC, 0xCC, 0xCD, 0xDE, 0xEE, 0xEF, 0xFD, 0xEF, 0xED, 0xDC,
+ 0xCC, 0xBB, 0xBB, 0xBB, 0xCC, 0xEE, 0xFF, 0xED, 0xEE, 0xDC, 0xBB, 0xAA,
+ 0xAA, 0xAA, 0xBB, 0xCD, 0xDF, 0xFE, 0xDE, 0xDC, 0xBA, 0xA9, 0x99, 0x99,
+ 0x9A, 0xAB, 0xCD, 0xEF, 0xED, 0xEC, 0xBA, 0x99, 0x88, 0x77, 0x88, 0x9A,
+ 0xBB, 0xDD, 0xED, 0xDD, 0xCB, 0x99, 0x87, 0x76, 0x67, 0x78, 0x9A, 0xBC,
+ 0xCE, 0xDD, 0xDB, 0xA9, 0x87, 0x66, 0x55, 0x66, 0x78, 0x9A, 0xCD, 0xED,
+ 0xCC, 0xBA, 0x98, 0x76, 0x54, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xDC, 0xCB,
+ 0xA9, 0x76, 0x54, 0x34, 0x45, 0x67, 0x9A, 0xBC, 0xDD, 0xCC, 0xBA, 0x97,
+ 0x65, 0x44, 0x34, 0x56, 0x79, 0xAB, 0xCD, 0xEC, 0xCB, 0xA9, 0x87, 0x65,
+ 0x44, 0x56, 0x78, 0x9A, 0xBC, 0xDD, 0xCC, 0xBA, 0x98, 0x76, 0x65, 0x56,
+ 0x67, 0x89, 0xAB, 0xCE, 0xDD, 0xDC, 0xBA, 0x98, 0x77, 0x66, 0x77, 0x89,
+ 0xAB, 0xCD, 0xED, 0xDD, 0xCB, 0xAA, 0x98, 0x87, 0x78, 0x89, 0x9A, 0xBC,
+ 0xDF, 0xED, 0xED, 0xCB, 0xAA, 0x99, 0x89, 0x99, 0xAA, 0xBC, 0xDE, 0xEF,
+ 0xDE, 0xDD, 0xCC, 0xBA, 0xAA, 0xAA, 0xAB, 0xBC, 0xDE, 0xFE, 0xFD, 0xFE,
+ 0xDD, 0xCC, 0xBB, 0xBB, 0xBB, 0xCC, 0xDD, 0xFF, 0xFF, 0xDF, 0xEF, 0xED,
+ 0xDD, 0xCC, 0xCC, 0xCD, 0xEE, 0xFE, 0xFF, 0xFD, 0xEF, 0xEE, 0xFE, 0xDD,
+ 0xDD, 0xED, 0xEE, 0xFF, 0xFF, 0xFF, 0x8D, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD,
+ 0xED, 0xFE, 0xEF, 0xFF, 0xD0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xED, 0xDD, 0xDD, 0xDD, 0xCC, 0x8F, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFD, 0xFE, 0xEF, 0xFF, 0xFF, 0xFD, 0xFF, 0xFF, 0xFF,
+ 0xFE, 0xCD, 0xDC, 0xDD, 0xDD, 0xFF, 0xFF, 0xEF, 0xFF, 0xFF, 0xDC, 0xCC,
+ 0xBC, 0xBC, 0xDD, 0xDD, 0xFF, 0xFF, 0xFF, 0xFE, 0xDD, 0xBB, 0xAA, 0xAA,
+ 0xBB, 0xCC, 0xDF, 0xFF, 0xFF, 0xFF, 0xDC, 0xBA, 0x98, 0x88, 0x89, 0xAB,
+ 0xCC, 0xDE, 0xFF, 0xFF, 0xFD, 0xBA, 0x98, 0x77, 0x77, 0x89, 0xAB, 0xDD,
+ 0xFF, 0xFF, 0xFE, 0xCB, 0x98, 0x65, 0x55, 0x67, 0x89, 0xAC, 0xDF, 0xFF,
+ 0xFF, 0xDB, 0xA8, 0x75, 0x44, 0x45, 0x67, 0x8A, 0xCD, 0xFF, 0xFF, 0xFD,
+ 0xBA, 0x87, 0x54, 0x33, 0x45, 0x78, 0xAB, 0xCE, 0xFF, 0xEF, 0xCB, 0xA8,
+ 0x75, 0x43, 0x34, 0x57, 0x8A, 0xBD, 0xFF, 0xFE, 0xFD, 0xCA, 0x97, 0x65,
+ 0x44, 0x45, 0x78, 0xAB, 0xDD, 0xFF, 0xEF, 0xDC, 0xA9, 0x87, 0x65, 0x55,
+ 0x67, 0x9A, 0xCE, 0xFF, 0xFE, 0xFF, 0xDB, 0xA9, 0x87, 0x76, 0x77, 0x9A,
+ 0xBC, 0xFF, 0xFF, 0xEF, 0xFC, 0xCB, 0xA9, 0x88, 0x88, 0x9A, 0xBC, 0xDF,
+ 0xFF, 0xFE, 0xFE, 0xDC, 0xCB, 0xAA, 0xAA, 0xAA, 0xBC, 0xDE, 0xFF, 0xFF,
+ 0xDF, 0xFE, 0xDC, 0xDC, 0xBB, 0xBB, 0xCC, 0xDF, 0xFF, 0xFF, 0xFD, 0xFF,
+ 0xFE, 0xED, 0xDD, 0xDC, 0xDE, 0xFE, 0xFF, 0xFF, 0xFF, 0xDF, 0xFF, 0xFF,
+ 0xEF, 0xEE, 0xEF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFD, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x8C, 0xDC, 0xDC, 0xDE, 0xFE, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xDE, 0xEE, 0xDD, 0xDC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0x8F, 0xFF,
+ 0xEE, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xFE, 0xED, 0xFF, 0xFE, 0xDD,
+ 0xCC, 0xCC, 0xCC, 0xCC, 0xCD, 0xDD, 0xEF, 0xDD, 0xEE, 0xDC, 0xCB, 0xBB,
+ 0xAB, 0xBB, 0xBC, 0xCD, 0xDE, 0xED, 0xDE, 0xDD, 0xCB, 0xAA, 0x99, 0x99,
+ 0xAA, 0xBC, 0xCD, 0xEE, 0xDD, 0xDD, 0xCB, 0xA9, 0x88, 0x88, 0x89, 0x9A,
+ 0xBC, 0xDD, 0xED, 0xCD, 0xCB, 0xA9, 0x87, 0x77, 0x77, 0x88, 0x9A, 0xBC,
+ 0xDE, 0xDD, 0xDC, 0xBA, 0x87, 0x66, 0x55, 0x67, 0x89, 0xAB, 0xCD, 0xDD,
+ 0xCD, 0xCA, 0x98, 0x76, 0x54, 0x45, 0x67, 0x8A, 0xAC, 0xDE, 0xDC, 0xDB,
+ 0xA9, 0x87, 0x54, 0x33, 0x45, 0x78, 0x9A, 0xCD, 0xDD, 0xCD, 0xCA, 0x98,
+ 0x75, 0x43, 0x34, 0x56, 0x89, 0xAC, 0xCE, 0xDC, 0xDC, 0xBA, 0x87, 0x65,
+ 0x44, 0x55, 0x78, 0x9A, 0xCD, 0xED, 0xCD, 0xCB, 0xA9, 0x87, 0x65, 0x55,
+ 0x67, 0x8A, 0xBC, 0xDE, 0xDC, 0xDC, 0xBA, 0x98, 0x87, 0x76, 0x77, 0x89,
+ 0xAB, 0xCD, 0xEE, 0xCD, 0xDC, 0xBA, 0x99, 0x88, 0x88, 0x89, 0xAB, 0xCD,
+ 0xDF, 0xDC, 0xED, 0xCB, 0xBA, 0xA9, 0x99, 0x9A, 0xAB, 0xBC, 0xEF, 0xFE,
+ 0xCE, 0xDD, 0xCC, 0xBB, 0xAA, 0xBB, 0xBB, 0xCC, 0xDE, 0xFF, 0xED, 0xED,
+ 0xED, 0xDC, 0xCC, 0xCC, 0xCC, 0xDD, 0xDE, 0xFF, 0xFF, 0xDE, 0xEE, 0xDD,
+ 0xDD, 0xDD, 0xDD, 0xDE, 0xEE, 0xFF, 0xFF, 0xFD, 0xEE, 0xEE, 0xEE, 0xEE,
+ 0xDE, 0xEE, 0xEF, 0xFF, 0xFF, 0xFF, 0x8D, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD,
+ 0xED, 0xEE, 0xEF, 0xFF, 0xE0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xDF, 0xED, 0xDC, 0xCC, 0xBB, 0xBB, 0xBB, 0xBC, 0xCC, 0xCC, 0xAE, 0xFE,
+ 0xED, 0xCC, 0xBB, 0xBB, 0xBB, 0xCC, 0xCD, 0xDE, 0xED, 0xEE, 0xDD, 0xCB,
+ 0xBA, 0xAA, 0xAA, 0xAB, 0xBC, 0xCD, 0xDE, 0xDD, 0xDC, 0xCB, 0xAA, 0x99,
+ 0x99, 0x99, 0xAA, 0xBB, 0xCD, 0xDC, 0xDD, 0xCB, 0xA9, 0x98, 0x88, 0x88,
+ 0x89, 0x9A, 0xBC, 0xCD, 0xCC, 0xCB, 0xA9, 0x88, 0x77, 0x77, 0x77, 0x89,
+ 0x9A, 0xBC, 0xDC, 0xCC, 0xBA, 0x98, 0x76, 0x66, 0x66, 0x77, 0x89, 0xAB,
+ 0xBC, 0xCC, 0xBA, 0x98, 0x76, 0x65, 0x55, 0x66, 0x77, 0x89, 0xAB, 0xCC,
+ 0xBB, 0xA9, 0x87, 0x65, 0x55, 0x55, 0x66, 0x78, 0x9A, 0xBC, 0xCB, 0xBA,
+ 0x98, 0x76, 0x55, 0x44, 0x55, 0x67, 0x89, 0xAB, 0xCC, 0xBB, 0xA9, 0x87,
+ 0x65, 0x54, 0x45, 0x56, 0x78, 0x9A, 0xBC, 0xCB, 0xBA, 0x98, 0x76, 0x65,
+ 0x55, 0x55, 0x67, 0x89, 0xAB, 0xCC, 0xBB, 0xA9, 0x88, 0x76, 0x65, 0x55,
+ 0x66, 0x78, 0x9A, 0xBD, 0xDB, 0xCB, 0xA9, 0x87, 0x76, 0x66, 0x66, 0x78,
+ 0x9A, 0xBC, 0xDD, 0xCC, 0xBA, 0x99, 0x88, 0x77, 0x77, 0x78, 0x89, 0xAB,
+ 0xCD, 0xDC, 0xCB, 0xBA, 0x99, 0x88, 0x88, 0x88, 0x99, 0xAB, 0xCD, 0xED,
+ 0xCD, 0xCB, 0xBA, 0xA9, 0x99, 0x99, 0x9A, 0xAB, 0xCC, 0xDE, 0xEC, 0xDD,
+ 0xCC, 0xBB, 0xAA, 0xAA, 0xAA, 0xBB, 0xCD, 0xDE, 0xFE, 0xCE, 0xDD, 0xCC,
+ 0xCB, 0xBB, 0xBB, 0xBC, 0xCD, 0xDE, 0xFF, 0xFC, 0xEE, 0xDD, 0xDC, 0xCC,
+ 0xCC, 0xCC, 0xDD, 0xEE, 0xFF, 0xFF, 0x9D, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC,
+ 0xDD, 0xDE, 0xEE, 0xFF, 0xE0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xEF, 0xFF, 0xED, 0xDD, 0xDC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0x8F, 0xFF,
+ 0xEE, 0xDD, 0xDC, 0xCC, 0xCC, 0xDD, 0xDD, 0xEE, 0xED, 0xFF, 0xFD, 0xDC,
+ 0xCB, 0xBB, 0xBB, 0xBC, 0xCC, 0xDD, 0xEE, 0xDF, 0xFE, 0xDC, 0xBB, 0xAA,
+ 0xAA, 0xAA, 0xBB, 0xCC, 0xDE, 0xFD, 0xEF, 0xDC, 0xBA, 0x99, 0x98, 0x99,
+ 0x9A, 0xAB, 0xCC, 0xDE, 0xDE, 0xEC, 0xBA, 0x98, 0x87, 0x77, 0x88, 0x9A,
+ 0xAB, 0xCD, 0xED, 0xDD, 0xCB, 0xA8, 0x77, 0x66, 0x67, 0x78, 0x9A, 0xBC,
+ 0xDD, 0xDD, 0xDB, 0xA9, 0x87, 0x65, 0x55, 0x66, 0x78, 0x9A, 0xBD, 0xDD,
+ 0xDD, 0xBA, 0x97, 0x65, 0x54, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xDC, 0xCB,
+ 0xA9, 0x76, 0x54, 0x44, 0x45, 0x67, 0x9A, 0xBC, 0xDD, 0xCC, 0xBA, 0x97,
+ 0x65, 0x44, 0x44, 0x56, 0x78, 0xAB, 0xCD, 0xDC, 0xCB, 0xA9, 0x87, 0x65,
+ 0x44, 0x55, 0x67, 0x9A, 0xBC, 0xED, 0xCD, 0xBA, 0x98, 0x76, 0x65, 0x55,
+ 0x67, 0x89, 0xAB, 0xDE, 0xEC, 0xDC, 0xBA, 0x98, 0x77, 0x66, 0x67, 0x88,
+ 0xAB, 0xCD, 0xEE, 0xDD, 0xCB, 0xA9, 0x98, 0x87, 0x77, 0x88, 0x9A, 0xBC,
+ 0xEF, 0xED, 0xDD, 0xCB, 0xAA, 0x99, 0x98, 0x99, 0x9A, 0xBC, 0xDE, 0xFE,
+ 0xDD, 0xDC, 0xCB, 0xBA, 0xAA, 0xAA, 0xAB, 0xBC, 0xDE, 0xFF, 0xFD, 0xFE,
+ 0xDC, 0xCB, 0xBB, 0xBB, 0xBB, 0xCC, 0xDE, 0xFF, 0xFF, 0xDE, 0xDD, 0xDD,
+ 0xDC, 0xCC, 0xCC, 0xCD, 0xDE, 0xFF, 0xFF, 0xFD, 0xFE, 0xED, 0xDD, 0xED,
+ 0xDD, 0xEE, 0xFF, 0xFF, 0xFF, 0xFF, 0x8C, 0xDC, 0xDD, 0xCD, 0xDD, 0xDE,
+ 0xDE, 0xEF, 0xFF, 0xFF, 0xE0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFD, 0xDD, 0xDC, 0xDD, 0xCC, 0xCC, 0x7F, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFD, 0xFF, 0xFF, 0xFF, 0xFF, 0xFD, 0xFF, 0xFF, 0xFF,
+ 0xFD, 0xDD, 0xDD, 0xDD, 0xDF, 0xFF, 0xFF, 0xDF, 0xFF, 0xFF, 0xDD, 0xCB,
+ 0xBB, 0xBC, 0xCC, 0xDF, 0xFF, 0xFF, 0xFF, 0xFD, 0xDC, 0xBA, 0xAA, 0xAA,
+ 0xBB, 0xCC, 0xDF, 0xFF, 0xFF, 0xFF, 0xFB, 0xBA, 0x98, 0x88, 0x89, 0xAB,
+ 0xCC, 0xDF, 0xFF, 0xFF, 0xDC, 0xBA, 0x97, 0x77, 0x77, 0x89, 0xAB, 0xCD,
+ 0xFF, 0xFF, 0xFD, 0xCB, 0x98, 0x65, 0x55, 0x67, 0x89, 0xBC, 0xDF, 0xFF,
+ 0xFF, 0xDC, 0xA8, 0x75, 0x44, 0x45, 0x67, 0x8A, 0xBD, 0xFF, 0xFF, 0xFD,
+ 0xBA, 0x87, 0x54, 0x33, 0x45, 0x78, 0xAB, 0xDF, 0xFF, 0xFF, 0xDC, 0x98,
+ 0x75, 0x43, 0x34, 0x56, 0x8A, 0xCD, 0xFF, 0xFF, 0xFD, 0xCA, 0x97, 0x65,
+ 0x44, 0x45, 0x78, 0xAC, 0xDF, 0xFF, 0xEF, 0xDC, 0xA9, 0x87, 0x65, 0x55,
+ 0x68, 0x9A, 0xCE, 0xFF, 0xFF, 0xFE, 0xCB, 0xA9, 0x87, 0x77, 0x78, 0x9A,
+ 0xBC, 0xDF, 0xFF, 0xFF, 0xFD, 0xCB, 0xA9, 0x98, 0x88, 0x9A, 0xBC, 0xDF,
+ 0xFF, 0xFD, 0xFF, 0xDD, 0xBB, 0xAA, 0xAA, 0xAA, 0xBC, 0xDE, 0xFF, 0xFF,
+ 0xDF, 0xFD, 0xDD, 0xCB, 0xBB, 0xBB, 0xCD, 0xDF, 0xFF, 0xFF, 0xFD, 0xFF,
+ 0xDF, 0xDD, 0xDC, 0xDC, 0xDD, 0xDF, 0xFF, 0xFF, 0xFF, 0xDF, 0xFF, 0xFE,
+ 0xEF, 0xEF, 0xDF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFD, 0xFF, 0xFF, 0xFE, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x8C, 0xCD, 0xDD, 0xED, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xEF, 0xFF, 0xEF, 0xEE, 0xDD, 0xDD, 0xDD, 0xDD, 0xDC, 0xDD, 0x7F, 0xFF,
+ 0xFF, 0xFE, 0xED, 0xEE, 0xDE, 0xEF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE,
+ 0xDC, 0xCC, 0xCD, 0xDD, 0xEE, 0xEF, 0xFF, 0xEF, 0xFF, 0xFD, 0xDC, 0xCB,
+ 0xBB, 0xBC, 0xCD, 0xCF, 0xFF, 0xFE, 0xFF, 0xFD, 0xDB, 0xBA, 0xAA, 0xAA,
+ 0xAB, 0xCC, 0xDE, 0xFF, 0xFF, 0xFD, 0xDC, 0xAA, 0x99, 0x89, 0x99, 0xAB,
+ 0xBC, 0xDF, 0xFF, 0xFD, 0xDC, 0xBA, 0x98, 0x77, 0x78, 0x89, 0xAB, 0xCD,
+ 0xFF, 0xEF, 0xED, 0xCA, 0x98, 0x76, 0x56, 0x67, 0x89, 0xBC, 0xDE, 0xFE,
+ 0xDE, 0xCB, 0xA9, 0x76, 0x54, 0x45, 0x68, 0x9A, 0xBC, 0xEF, 0xEE, 0xED,
+ 0xBA, 0x87, 0x64, 0x23, 0x46, 0x78, 0xAB, 0xDD, 0xFE, 0xFE, 0xDB, 0xA9,
+ 0x76, 0x43, 0x24, 0x57, 0x8A, 0xBD, 0xDE, 0xED, 0xFD, 0xBA, 0x98, 0x65,
+ 0x44, 0x56, 0x79, 0xAB, 0xCD, 0xFF, 0xDD, 0xDC, 0xB9, 0x87, 0x66, 0x56,
+ 0x78, 0x9A, 0xBD, 0xEF, 0xFD, 0xFD, 0xCB, 0xA9, 0x88, 0x77, 0x78, 0x9A,
+ 0xBC, 0xDE, 0xFF, 0xDE, 0xDC, 0xBB, 0xA9, 0x98, 0x89, 0x9A, 0xAC, 0xDE,
+ 0xFF, 0xFE, 0xFE, 0xDD, 0xCB, 0xAA, 0xAA, 0xAA, 0xBB, 0xCD, 0xEF, 0xFF,
+ 0xDF, 0xED, 0xDC, 0xCC, 0xBB, 0xBB, 0xBC, 0xDD, 0xFF, 0xFF, 0xFD, 0xFF,
+ 0xEF, 0xDD, 0xDC, 0xCC, 0xDD, 0xDD, 0xEF, 0xFF, 0xFF, 0xDF, 0xFF, 0xEE,
+ 0xEE, 0xDD, 0xDE, 0xEE, 0xFF, 0xFF, 0xFF, 0xFD, 0xFF, 0xFF, 0xFF, 0xED,
+ 0xDD, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7C, 0xCC, 0xCC, 0xDD, 0xDC, 0xCE,
+ 0xEF, 0xFF, 0xFF, 0xFF, 0xE0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xBC, 0xCC, 0xBB, 0xBB, 0xAA, 0xAA, 0xAA, 0xBA, 0xBB, 0xBB, 0x8D, 0xED,
+ 0xDC, 0xCB, 0xBB, 0xBB, 0xBB, 0xBB, 0xCC, 0xCD, 0xEC, 0xCD, 0xCC, 0xBB,
+ 0xAA, 0xAA, 0xAA, 0xAA, 0xBB, 0xCC, 0xDD, 0xCC, 0xDC, 0xBA, 0xA9, 0x99,
+ 0x99, 0x99, 0xAA, 0xBB, 0xCC, 0xDC, 0xBC, 0xBA, 0xA9, 0x88, 0x88, 0x88,
+ 0x89, 0x9A, 0xAB, 0xCD, 0xBB, 0xBB, 0xA9, 0x88, 0x77, 0x77, 0x78, 0x89,
+ 0x9A, 0xBC, 0xCC, 0xBB, 0xA9, 0x88, 0x77, 0x66, 0x67, 0x78, 0x89, 0x9A,
+ 0xBC, 0xBB, 0xBA, 0x98, 0x77, 0x65, 0x55, 0x66, 0x78, 0x89, 0xAB, 0xCB,
+ 0xAB, 0xA9, 0x87, 0x65, 0x55, 0x55, 0x66, 0x78, 0x9A, 0xBC, 0xBA, 0xBA,
+ 0x98, 0x76, 0x55, 0x44, 0x55, 0x67, 0x89, 0xAB, 0xCB, 0xAB, 0xA9, 0x87,
+ 0x65, 0x54, 0x45, 0x56, 0x78, 0x9A, 0xBC, 0xBA, 0xBA, 0x98, 0x77, 0x65,
+ 0x55, 0x55, 0x67, 0x89, 0xAB, 0xCB, 0xAB, 0xA9, 0x88, 0x76, 0x65, 0x55,
+ 0x66, 0x78, 0x9A, 0xBC, 0xCB, 0xBA, 0xA9, 0x87, 0x77, 0x66, 0x66, 0x78,
+ 0x89, 0xAB, 0xCC, 0xBB, 0xBA, 0x99, 0x88, 0x77, 0x77, 0x78, 0x89, 0xAB,
+ 0xBC, 0xCB, 0xCB, 0xBA, 0x99, 0x88, 0x88, 0x88, 0x89, 0xAA, 0xBC, 0xDC,
+ 0xBC, 0xCB, 0xBA, 0xA9, 0x99, 0x99, 0x99, 0xAA, 0xBB, 0xDD, 0xDB, 0xCC,
+ 0xBB, 0xBA, 0xAA, 0xAA, 0xAA, 0xAA, 0xBC, 0xCD, 0xED, 0xCD, 0xCC, 0xCC,
+ 0xBB, 0xBB, 0xBB, 0xBB, 0xCC, 0xCD, 0xEF, 0xEC, 0xDD, 0xDD, 0xCC, 0xCC,
+ 0xCB, 0xCC, 0xCD, 0xDE, 0xEE, 0xFE, 0x8C, 0xCC, 0xCB, 0xBB, 0xBB, 0xBB,
+ 0xCC, 0xCC, 0xDE, 0xDE, 0xC0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xAC, 0xBA, 0xAA, 0x99, 0x99, 0x99, 0x99, 0xAA, 0xAA, 0xBB, 0x9B, 0xCC,
+ 0xBB, 0xAA, 0xAA, 0xA9, 0xAA, 0xAA, 0xBB, 0xCC, 0xCB, 0xBC, 0xBA, 0xA9,
+ 0x99, 0x99, 0x99, 0x99, 0xAA, 0xBB, 0xBC, 0xBB, 0xBA, 0xA9, 0x98, 0x88,
+ 0x88, 0x88, 0x99, 0xAA, 0xAB, 0xCB, 0xAB, 0xA9, 0x98, 0x88, 0x77, 0x78,
+ 0x88, 0x99, 0x9A, 0xBB, 0xAA, 0xA9, 0x98, 0x87, 0x77, 0x77, 0x77, 0x88,
+ 0x99, 0xAA, 0xBA, 0xAA, 0x98, 0x87, 0x76, 0x66, 0x66, 0x77, 0x88, 0x99,
+ 0xAB, 0xA9, 0xA9, 0x88, 0x76, 0x66, 0x66, 0x66, 0x77, 0x88, 0x9A, 0xBA,
+ 0x9A, 0x98, 0x77, 0x66, 0x55, 0x56, 0x66, 0x78, 0x89, 0xAA, 0xA9, 0xA9,
+ 0x87, 0x76, 0x65, 0x55, 0x56, 0x67, 0x78, 0x9A, 0xAA, 0x9A, 0x98, 0x77,
+ 0x66, 0x55, 0x55, 0x66, 0x77, 0x89, 0xAA, 0xA9, 0xA9, 0x88, 0x76, 0x66,
+ 0x55, 0x56, 0x67, 0x78, 0x9A, 0xAA, 0x9A, 0x98, 0x87, 0x76, 0x66, 0x66,
+ 0x66, 0x78, 0x89, 0xAA, 0xA9, 0xA9, 0x98, 0x87, 0x76, 0x66, 0x66, 0x77,
+ 0x88, 0x9A, 0xBA, 0xAA, 0xA9, 0x98, 0x87, 0x77, 0x77, 0x77, 0x88, 0x99,
+ 0xAB, 0xBA, 0xBA, 0x99, 0x98, 0x88, 0x77, 0x78, 0x88, 0x99, 0xAB, 0xBB,
+ 0xAB, 0xBA, 0xA9, 0x98, 0x88, 0x88, 0x88, 0x99, 0xAA, 0xBC, 0xBA, 0xBB,
+ 0xAA, 0xA9, 0x99, 0x99, 0x99, 0x99, 0xAA, 0xBC, 0xCC, 0xBC, 0xCB, 0xBA,
+ 0xAA, 0xAA, 0xAA, 0xAA, 0xAB, 0xBC, 0xCD, 0xCB, 0xCC, 0xCB, 0xBB, 0xBA,
+ 0xAA, 0xAB, 0xBB, 0xBC, 0xCD, 0xDC, 0x9B, 0xBB, 0xAA, 0xAA, 0xAA, 0xAA,
+ 0xAA, 0xBB, 0xBC, 0xCD, 0xB0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xBC, 0xCC, 0xBB, 0xBB, 0xAA, 0xAA, 0xAB, 0xAB, 0xBB, 0xBC, 0x8D, 0xED,
+ 0xCC, 0xCB, 0xBA, 0xBA, 0xBB, 0xBB, 0xCC, 0xCD, 0xDC, 0xCD, 0xCC, 0xBB,
+ 0xAA, 0xAA, 0xAA, 0xAA, 0xBB, 0xBC, 0xCD, 0xCC, 0xCB, 0xBA, 0xA9, 0x99,
+ 0x99, 0x99, 0xAA, 0xAB, 0xBC, 0xDC, 0xBC, 0xBA, 0x99, 0x88, 0x88, 0x88,
+ 0x89, 0x9A, 0xAB, 0xBC, 0xBB, 0xBA, 0xA9, 0x88, 0x77, 0x77, 0x78, 0x89,
+ 0x9A, 0xAB, 0xCB, 0xBB, 0xA9, 0x88, 0x76, 0x66, 0x66, 0x77, 0x89, 0x9A,
+ 0xBC, 0xBA, 0xBA, 0x98, 0x76, 0x65, 0x55, 0x66, 0x78, 0x89, 0xAB, 0xCB,
+ 0xAB, 0xA9, 0x87, 0x66, 0x55, 0x55, 0x67, 0x78, 0x9A, 0xBB, 0xBA, 0xBA,
+ 0x98, 0x76, 0x55, 0x44, 0x55, 0x67, 0x89, 0xAB, 0xBB, 0xAA, 0xA9, 0x87,
+ 0x65, 0x54, 0x45, 0x56, 0x78, 0x9A, 0xAB, 0xBA, 0xBA, 0x98, 0x77, 0x65,
+ 0x55, 0x56, 0x67, 0x89, 0xAB, 0xBB, 0xAB, 0xA9, 0x88, 0x76, 0x65, 0x55,
+ 0x67, 0x78, 0x9A, 0xBC, 0xBA, 0xBA, 0x99, 0x87, 0x77, 0x66, 0x66, 0x78,
+ 0x89, 0xAB, 0xCB, 0xBB, 0xAA, 0x99, 0x88, 0x77, 0x77, 0x78, 0x89, 0xAA,
+ 0xBC, 0xCB, 0xCB, 0xAA, 0x99, 0x88, 0x88, 0x88, 0x89, 0x9A, 0xBC, 0xDC,
+ 0xBC, 0xCB, 0xAA, 0x99, 0x99, 0x99, 0x99, 0xAA, 0xBC, 0xCD, 0xCB, 0xCC,
+ 0xBB, 0xAA, 0xAA, 0xA9, 0xAA, 0xAA, 0xBB, 0xCC, 0xDD, 0xBD, 0xCC, 0xCC,
+ 0xBB, 0xBA, 0xAB, 0xBB, 0xBC, 0xCD, 0xDE, 0xDC, 0xED, 0xCC, 0xCB, 0xBB,
+ 0xBB, 0xCC, 0xCC, 0xCD, 0xDE, 0xEE, 0x8C, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB,
+ 0xBB, 0xCC, 0xCD, 0xDD, 0xC0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xEF, 0xFF, 0xEF, 0xED, 0xDC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0x7F, 0xFF,
+ 0xFF, 0xFF, 0xDD, 0xDC, 0xDE, 0xDE, 0xFF, 0xFF, 0xFD, 0xFF, 0xFF, 0xFE,
+ 0xDD, 0xCC, 0xBC, 0xCC, 0xDE, 0xEE, 0xFF, 0xEF, 0xFE, 0xED, 0xCB, 0xBB,
+ 0xAB, 0xBB, 0xBC, 0xDD, 0xEF, 0xFE, 0xEF, 0xED, 0xCB, 0xAA, 0x99, 0x9A,
+ 0xAB, 0xBC, 0xDE, 0xEF, 0xED, 0xED, 0xCB, 0xA9, 0x98, 0x88, 0x89, 0x9A,
+ 0xBC, 0xDE, 0xFD, 0xEE, 0xDB, 0xA9, 0x87, 0x77, 0x77, 0x89, 0xAB, 0xCD,
+ 0xEF, 0xED, 0xEC, 0xBA, 0x87, 0x66, 0x55, 0x67, 0x89, 0xAB, 0xCD, 0xEE,
+ 0xDE, 0xCB, 0x98, 0x76, 0x44, 0x45, 0x67, 0x8A, 0xBC, 0xDF, 0xED, 0xDC,
+ 0xB9, 0x86, 0x54, 0x33, 0x45, 0x78, 0x9B, 0xCD, 0xED, 0xDD, 0xCB, 0x98,
+ 0x75, 0x43, 0x34, 0x57, 0x89, 0xBC, 0xDE, 0xFD, 0xDD, 0xBA, 0x87, 0x65,
+ 0x44, 0x46, 0x78, 0x9B, 0xCD, 0xEF, 0xEE, 0xCB, 0xA9, 0x87, 0x65, 0x56,
+ 0x67, 0x8A, 0xBC, 0xDF, 0xFE, 0xDD, 0xCB, 0xA9, 0x87, 0x77, 0x77, 0x89,
+ 0xAC, 0xCE, 0xEF, 0xDE, 0xDC, 0xBA, 0xA9, 0x88, 0x88, 0x89, 0xAB, 0xCD,
+ 0xEF, 0xFD, 0xED, 0xDC, 0xBB, 0xA9, 0xA9, 0x9A, 0xBB, 0xCD, 0xEF, 0xFF,
+ 0xEF, 0xED, 0xCC, 0xCB, 0xBB, 0xBB, 0xBC, 0xCD, 0xDE, 0xFF, 0xED, 0xFF,
+ 0xED, 0xDC, 0xCC, 0xCC, 0xCC, 0xDE, 0xEF, 0xFF, 0xFF, 0xDF, 0xFF, 0xDD,
+ 0xDD, 0xDD, 0xDE, 0xDE, 0xEF, 0xFF, 0xFF, 0xFD, 0xFF, 0xFF, 0xFE, 0xEE,
+ 0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x8D, 0xDE, 0xDC, 0xED, 0xDD, 0xDE,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFD, 0xDC, 0xCC, 0x7F, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFD, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFC, 0xCB,
+ 0xCE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFC, 0xBB, 0xAA, 0xAB, 0xBC,
+ 0xDF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFC, 0xBA, 0x98, 0x89, 0xAB, 0xCD, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFD, 0xBA, 0x87, 0x66, 0x78, 0xAB, 0xCD, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xDB, 0x97, 0x54, 0x45, 0x79, 0xAC, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFC, 0xA8, 0x64, 0x22, 0x46, 0x8A, 0xCF, 0xFF, 0xFF, 0xFF, 0xFF, 0xCA,
+ 0x96, 0x42, 0x24, 0x68, 0xAC, 0xFF, 0xFF, 0xFF, 0xFF, 0xFC, 0xA9, 0x75,
+ 0x43, 0x57, 0x9A, 0xCF, 0xFF, 0xFF, 0xFF, 0xFF, 0xCB, 0xA8, 0x76, 0x67,
+ 0x89, 0xBD, 0xFF, 0xFF, 0xFF, 0xFF, 0xFD, 0xCB, 0xA9, 0x88, 0x9A, 0xBC,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFC, 0xCB, 0xAA, 0xAB, 0xBD, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFD, 0xCC, 0xBB, 0xCD, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFC, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, 0xDC, 0xDD, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xDF, 0xFF, 0xDF, 0xDD, 0xDD, 0xCC, 0xDB, 0xCC, 0xCC, 0xCC, 0x8F, 0xFF,
+ 0xFE, 0xFD, 0xDD, 0xCC, 0xCC, 0xDD, 0xDD, 0xDE, 0xFD, 0xFF, 0xFF, 0xDD,
+ 0xCC, 0xBB, 0xBB, 0xBC, 0xDD, 0xDD, 0xFF, 0xDF, 0xFD, 0xDD, 0xCB, 0xBA,
+ 0xAA, 0xAA, 0xAC, 0xCC, 0xFF, 0xFD, 0xFF, 0xDD, 0xCA, 0xA9, 0x99, 0x99,
+ 0x9A, 0xAB, 0xCD, 0xEF, 0xDF, 0xDD, 0xCB, 0xA9, 0x88, 0x88, 0x88, 0x99,
+ 0xAC, 0xCD, 0xFD, 0xDE, 0xCB, 0xA9, 0x87, 0x76, 0x77, 0x78, 0x9A, 0xBC,
+ 0xDF, 0xED, 0xEC, 0xA9, 0x87, 0x66, 0x55, 0x67, 0x78, 0x9B, 0xBE, 0xFF,
+ 0xDD, 0xCA, 0x98, 0x76, 0x54, 0x45, 0x67, 0x89, 0xAC, 0xDF, 0xFD, 0xCB,
+ 0xA9, 0x86, 0x54, 0x34, 0x45, 0x78, 0x9A, 0xBD, 0xEF, 0xDC, 0xBA, 0x98,
+ 0x65, 0x43, 0x34, 0x56, 0x89, 0xAC, 0xDE, 0xFC, 0xDB, 0xA9, 0x87, 0x65,
+ 0x44, 0x55, 0x78, 0x9A, 0xBD, 0xDF, 0xDD, 0xBB, 0xA8, 0x77, 0x65, 0x55,
+ 0x67, 0x8A, 0xAC, 0xDF, 0xFC, 0xDC, 0xBA, 0x98, 0x77, 0x76, 0x77, 0x89,
+ 0xAB, 0xCE, 0xEF, 0xCD, 0xCB, 0xAA, 0x98, 0x88, 0x88, 0x89, 0xAB, 0xCD,
+ 0xDF, 0xFD, 0xED, 0xCB, 0xBA, 0xA9, 0x99, 0x9A, 0xAA, 0xCD, 0xFF, 0xFF,
+ 0xDE, 0xDC, 0xCB, 0xBA, 0xAA, 0xAA, 0xBB, 0xCD, 0xDE, 0xFF, 0xFD, 0xFD,
+ 0xDD, 0xCC, 0xCB, 0xBB, 0xCC, 0xDD, 0xFE, 0xFF, 0xFF, 0xCE, 0xED, 0xED,
+ 0xDC, 0xCC, 0xDD, 0xDF, 0xFF, 0xFF, 0xFF, 0xFC, 0xFF, 0xFF, 0xEF, 0xEF,
+ 0xEF, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0x8D, 0xDD, 0xDE, 0xEF, 0xDF, 0xDF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xED, 0xDC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xDD, 0xAF, 0xFF,
+ 0xED, 0xDC, 0xCC, 0xBB, 0xBC, 0xCC, 0xCD, 0xDE, 0xED, 0xFF, 0xED, 0xCC,
+ 0xBB, 0xAA, 0xAA, 0xAB, 0xBC, 0xCD, 0xDE, 0xEF, 0xFD, 0xCB, 0xAA, 0x99,
+ 0x99, 0x99, 0xAA, 0xBC, 0xCD, 0xDD, 0xEE, 0xDB, 0xA9, 0x98, 0x88, 0x88,
+ 0x89, 0x9A, 0xBC, 0xCD, 0xDD, 0xDC, 0xA9, 0x98, 0x77, 0x77, 0x77, 0x89,
+ 0x9A, 0xBC, 0xDD, 0xDC, 0xBA, 0x98, 0x76, 0x66, 0x66, 0x77, 0x89, 0xAB,
+ 0xCD, 0xDC, 0xCB, 0x98, 0x76, 0x65, 0x55, 0x66, 0x77, 0x89, 0xAC, 0xCD,
+ 0xCC, 0xA9, 0x87, 0x65, 0x55, 0x55, 0x66, 0x78, 0x9A, 0xBD, 0xDC, 0xBA,
+ 0x98, 0x76, 0x55, 0x44, 0x55, 0x67, 0x89, 0xAB, 0xCD, 0xCB, 0xA9, 0x87,
+ 0x65, 0x54, 0x45, 0x56, 0x78, 0x9A, 0xBD, 0xDC, 0xBA, 0x98, 0x76, 0x65,
+ 0x55, 0x55, 0x67, 0x89, 0xAC, 0xDD, 0xCC, 0xA9, 0x87, 0x76, 0x55, 0x55,
+ 0x66, 0x78, 0x9B, 0xCD, 0xEC, 0xCB, 0xA9, 0x87, 0x76, 0x66, 0x66, 0x78,
+ 0x9A, 0xBC, 0xEE, 0xCC, 0xBA, 0x99, 0x87, 0x77, 0x77, 0x78, 0x99, 0xAC,
+ 0xDE, 0xFC, 0xCC, 0xBA, 0x99, 0x88, 0x88, 0x88, 0x9A, 0xAB, 0xCE, 0xFF,
+ 0xDD, 0xCC, 0xBA, 0xA9, 0x99, 0x99, 0x9A, 0xAB, 0xCD, 0xEF, 0xFD, 0xED,
+ 0xCC, 0xBB, 0xAA, 0xAA, 0xAB, 0xBB, 0xCD, 0xEF, 0xFF, 0xDE, 0xED, 0xDC,
+ 0xCB, 0xBB, 0xBC, 0xCC, 0xDD, 0xEF, 0xFF, 0xFD, 0xFE, 0xED, 0xDD, 0xDC,
+ 0xDD, 0xDD, 0xDE, 0xFF, 0xFF, 0xFF, 0xAD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD,
+ 0xEE, 0xEF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xEF, 0xDD, 0xDD, 0xDD, 0xDC, 0xCC, 0x8F, 0xFF,
+ 0xFF, 0xFF, 0xDD, 0xDE, 0xED, 0xDD, 0xDD, 0xFF, 0xFD, 0xFF, 0xFF, 0xFD,
+ 0xCC, 0xCC, 0xCC, 0xCB, 0xCD, 0xDE, 0xEF, 0xDF, 0xFF, 0xEC, 0xDB, 0xBB,
+ 0xAA, 0xAB, 0xBB, 0xCC, 0xDF, 0xFD, 0xFF, 0xFD, 0xCB, 0xA9, 0x99, 0x99,
+ 0xAA, 0xBC, 0xDD, 0xEF, 0xDF, 0xED, 0xCB, 0xA9, 0x88, 0x88, 0x88, 0x9A,
+ 0xBC, 0xCC, 0xFD, 0xFE, 0xDB, 0xA9, 0x87, 0x76, 0x77, 0x78, 0x9A, 0xBC,
+ 0xDE, 0xDF, 0xFC, 0xBA, 0x87, 0x66, 0x55, 0x67, 0x78, 0x9B, 0xBD, 0xFE,
+ 0xEF, 0xCA, 0x98, 0x76, 0x54, 0x45, 0x67, 0x89, 0xAB, 0xCE, 0xED, 0xDC,
+ 0xA9, 0x86, 0x54, 0x33, 0x45, 0x68, 0x9A, 0xBC, 0xED, 0xED, 0xBA, 0x98,
+ 0x75, 0x43, 0x34, 0x57, 0x89, 0xAC, 0xDD, 0xED, 0xDC, 0xA9, 0x87, 0x65,
+ 0x44, 0x56, 0x78, 0x9A, 0xBD, 0xFF, 0xFF, 0xCB, 0xA9, 0x87, 0x65, 0x56,
+ 0x67, 0x89, 0xBC, 0xDF, 0xED, 0xDC, 0xBA, 0x98, 0x87, 0x76, 0x77, 0x89,
+ 0xAB, 0xCE, 0xFF, 0xCE, 0xCB, 0xBA, 0x99, 0x88, 0x88, 0x89, 0xAB, 0xDD,
+ 0xFF, 0xFF, 0xFD, 0xCB, 0xBA, 0xA9, 0x99, 0x9A, 0xAB, 0xCD, 0xDF, 0xFF,
+ 0xDF, 0xEE, 0xCC, 0xBA, 0xAA, 0xAB, 0xBB, 0xCC, 0xDF, 0xFF, 0xFE, 0xFD,
+ 0xDD, 0xCC, 0xBB, 0xCC, 0xCC, 0xCD, 0xFF, 0xFF, 0xFF, 0xDD, 0xDE, 0xDD,
+ 0xDC, 0xCD, 0xCC, 0xDD, 0xEF, 0xFF, 0xFF, 0xFC, 0xFF, 0xED, 0xDD, 0xDD,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x8C, 0xCD, 0xCD, 0xDD, 0xEE, 0xDE,
+ 0xFE, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFD, 0xDF, 0x8F, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFC, 0xCF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xCB, 0xBB, 0xBC, 0xCD,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xCA, 0x99, 0x99, 0xAB, 0xCF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xCA, 0x97, 0x77, 0x89, 0xBC, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xDC, 0x97, 0x54, 0x46, 0x8A, 0xBF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFD, 0xB9, 0x74, 0x12, 0x57, 0x9B, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xCB,
+ 0x97, 0x42, 0x24, 0x79, 0xBD, 0xFF, 0xFF, 0xFF, 0xFF, 0xFD, 0xB9, 0x86,
+ 0x44, 0x57, 0x9B, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFC, 0xA9, 0x87, 0x77,
+ 0x8A, 0xCF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xDC, 0xAA, 0x99, 0x9A, 0xCF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xCC, 0xBB, 0xBB, 0xCF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xCC, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x8F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xDF, 0xFD, 0xDC, 0xDD, 0xCD, 0x7F, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFC,
+ 0xCC, 0xCF, 0xDF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xCC, 0xBB, 0xBC,
+ 0xCF, 0xDF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFD, 0xCC, 0xBA, 0xA9, 0xAA, 0xBC,
+ 0xDF, 0xFF, 0xFF, 0xFF, 0xFF, 0xCC, 0xA9, 0x88, 0x88, 0x9A, 0xBD, 0xDF,
+ 0xFF, 0xFF, 0xFF, 0xFB, 0xB9, 0x87, 0x66, 0x78, 0x9A, 0xCD, 0xFF, 0xFF,
+ 0xFF, 0xFD, 0xCA, 0x87, 0x54, 0x45, 0x78, 0xAB, 0xDF, 0xFF, 0xFF, 0xFF,
+ 0xDB, 0xA8, 0x64, 0x22, 0x46, 0x8A, 0xBD, 0xFF, 0xFF, 0xFF, 0xFC, 0xBA,
+ 0x86, 0x42, 0x24, 0x68, 0xAB, 0xCD, 0xFF, 0xFF, 0xFF, 0xDB, 0xA8, 0x75,
+ 0x44, 0x56, 0x8A, 0xBD, 0xFF, 0xFF, 0xFF, 0xFF, 0xCA, 0x98, 0x76, 0x66,
+ 0x79, 0xAC, 0xFF, 0xFF, 0xFF, 0xFF, 0xFC, 0xBA, 0x98, 0x88, 0x89, 0xAB,
+ 0xCF, 0xFF, 0xFF, 0xFF, 0xFD, 0xFC, 0xBA, 0xAA, 0x9A, 0xAC, 0xCC, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xDC, 0xCB, 0xBB, 0xCC, 0xDF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xDD, 0xDF, 0xDC, 0xCC, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xCF, 0xDF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFD, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7D, 0xDC, 0xDC, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xCB, 0xCC, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFB, 0xA9, 0x9A, 0xBC, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xCB, 0x98, 0x77, 0x89, 0xBF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFC, 0xA8, 0x54, 0x46, 0x8A, 0xCF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xCA, 0x74, 0x12, 0x47, 0xAB, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFC,
+ 0xA7, 0x42, 0x24, 0x7A, 0xCF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xCA, 0x86,
+ 0x44, 0x58, 0xAC, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xBA, 0x87, 0x78,
+ 0x9B, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFC, 0xBA, 0x99, 0xAB, 0xCF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFC, 0xCC, 0xCC, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xCC, 0xCB, 0xBA, 0xAA, 0xA9, 0x99, 0x9A, 0xAA, 0xAB, 0xBC, 0x9C, 0xCC,
+ 0xBB, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xBB, 0xBC, 0xDC, 0xCC, 0xBB, 0xAA,
+ 0x99, 0x99, 0x99, 0x99, 0xAA, 0xBB, 0xCC, 0xBB, 0xBB, 0xA9, 0x98, 0x88,
+ 0x88, 0x88, 0x99, 0x9A, 0xBB, 0xCB, 0xBB, 0xA9, 0x98, 0x88, 0x77, 0x77,
+ 0x88, 0x89, 0xAA, 0xBB, 0xBA, 0xBA, 0x98, 0x87, 0x77, 0x77, 0x77, 0x78,
+ 0x89, 0xAB, 0xBB, 0xAA, 0x99, 0x87, 0x76, 0x66, 0x66, 0x77, 0x88, 0x99,
+ 0xAB, 0xBA, 0xA9, 0x88, 0x76, 0x66, 0x66, 0x66, 0x77, 0x88, 0x9A, 0xAA,
+ 0x9A, 0x98, 0x77, 0x66, 0x55, 0x56, 0x66, 0x77, 0x89, 0xAB, 0xA9, 0xA9,
+ 0x87, 0x76, 0x65, 0x55, 0x56, 0x67, 0x78, 0x9A, 0xAA, 0x9A, 0x98, 0x77,
+ 0x66, 0x55, 0x55, 0x66, 0x77, 0x89, 0xAB, 0xA9, 0xA9, 0x87, 0x76, 0x66,
+ 0x55, 0x56, 0x67, 0x78, 0x9A, 0xAA, 0x9A, 0x98, 0x87, 0x76, 0x66, 0x66,
+ 0x66, 0x78, 0x89, 0xAB, 0xBA, 0xA9, 0x98, 0x77, 0x76, 0x66, 0x66, 0x77,
+ 0x88, 0x9A, 0xBB, 0xAA, 0xA9, 0x88, 0x87, 0x77, 0x77, 0x77, 0x88, 0x9A,
+ 0xBB, 0xBA, 0xBA, 0x99, 0x88, 0x87, 0x77, 0x78, 0x88, 0x99, 0xAB, 0xCC,
+ 0xBB, 0xBA, 0x99, 0x98, 0x88, 0x88, 0x88, 0x99, 0xAB, 0xBC, 0xCB, 0xCB,
+ 0xBA, 0xA9, 0x99, 0x99, 0x99, 0x9A, 0xAA, 0xBC, 0xCC, 0xBC, 0xCB, 0xBA,
+ 0xAA, 0xAA, 0xAA, 0xAA, 0xAB, 0xBC, 0xCD, 0xDC, 0xDC, 0xCB, 0xBB, 0xBB,
+ 0xBA, 0xBB, 0xBB, 0xCC, 0xDD, 0xEE, 0x9C, 0xCB, 0xBB, 0xBA, 0xAA, 0xAA,
+ 0xBB, 0xBB, 0xCC, 0xDD, 0xD0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xDF, 0xFF, 0xFF, 0xED, 0xEE, 0xED, 0xDD, 0xDC, 0xCD, 0xDC, 0x7F, 0xFF,
+ 0xFF, 0xFE, 0xED, 0xDD, 0xDD, 0xFD, 0xFF, 0xEE, 0xFD, 0xFF, 0xFF, 0xDE,
+ 0xDD, 0xCC, 0xCC, 0xDD, 0xDD, 0xFF, 0xFF, 0xEF, 0xFF, 0xDD, 0xDC, 0xCC,
+ 0xBB, 0xCC, 0xBD, 0xDD, 0xEF, 0xFE, 0xFF, 0xFD, 0xDC, 0xBB, 0xAA, 0xAA,
+ 0xBB, 0xCD, 0xDE, 0xEF, 0xDF, 0xFE, 0xDC, 0xBA, 0x99, 0x99, 0x99, 0xAB,
+ 0xCC, 0xDE, 0xFD, 0xFD, 0xEC, 0xCA, 0x98, 0x87, 0x78, 0x89, 0xAB, 0xCD,
+ 0xFF, 0xDE, 0xFD, 0xCA, 0x98, 0x76, 0x66, 0x78, 0x9A, 0xBC, 0xDD, 0xFE,
+ 0xDD, 0xCB, 0xA9, 0x86, 0x54, 0x45, 0x78, 0x9A, 0xCE, 0xDF, 0xEE, 0xDC,
+ 0xBA, 0x97, 0x64, 0x23, 0x46, 0x79, 0xAB, 0xDD, 0xFD, 0xEE, 0xDB, 0xA9,
+ 0x76, 0x42, 0x24, 0x67, 0x9A, 0xBC, 0xDE, 0xEF, 0xEE, 0xCA, 0x98, 0x75,
+ 0x44, 0x56, 0x89, 0xAB, 0xDE, 0xFE, 0xEE, 0xDC, 0xBA, 0x88, 0x76, 0x66,
+ 0x78, 0x9B, 0xCD, 0xEF, 0xDD, 0xFD, 0xCB, 0xA9, 0x98, 0x77, 0x88, 0x9A,
+ 0xBC, 0xDF, 0xFF, 0xDF, 0xDD, 0xCB, 0xA9, 0x99, 0x99, 0x9A, 0xBC, 0xDE,
+ 0xFF, 0xFD, 0xEE, 0xDD, 0xCB, 0xAA, 0xAA, 0xAB, 0xCC, 0xDE, 0xFF, 0xFF,
+ 0xDF, 0xFD, 0xDC, 0xCC, 0xBC, 0xCB, 0xCC, 0xCE, 0xFF, 0xFF, 0xFD, 0xEF,
+ 0xFE, 0xDD, 0xDC, 0xCD, 0xCD, 0xDD, 0xFF, 0xFF, 0xFF, 0xCF, 0xEE, 0xDD,
+ 0xEE, 0xDE, 0xDE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFC, 0xFF, 0xFF, 0xDF, 0xFF,
+ 0xFE, 0xEF, 0xEF, 0xFF, 0xFF, 0xFF, 0x7C, 0xCD, 0xCC, 0xDD, 0xEE, 0xEF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFC, 0xCF, 0xDF, 0xDC, 0xCB, 0xCD, 0x7F, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFD, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFD, 0xDF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFD,
+ 0xCC, 0xDD, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xDC, 0xCC, 0xBC,
+ 0xCD, 0xDF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xDC, 0xBB, 0xAA, 0xBB, 0xBC,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFC, 0xA9, 0x98, 0x89, 0xAB, 0xCD, 0xDF,
+ 0xFF, 0xFF, 0xFF, 0xFD, 0xBA, 0x87, 0x66, 0x78, 0xAB, 0xCF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xCB, 0x97, 0x54, 0x45, 0x79, 0xBC, 0xDF, 0xFF, 0xFF, 0xFF,
+ 0xFC, 0xB9, 0x64, 0x22, 0x46, 0x9A, 0xCF, 0xFF, 0xFF, 0xFF, 0xFD, 0xBA,
+ 0x86, 0x42, 0x23, 0x68, 0xAC, 0xDF, 0xFF, 0xFF, 0xFF, 0xDC, 0xA9, 0x75,
+ 0x44, 0x57, 0x9B, 0xCF, 0xDF, 0xFF, 0xFF, 0xFD, 0xCB, 0xA8, 0x76, 0x67,
+ 0x8A, 0xBC, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xBB, 0xA9, 0x88, 0x9A, 0xBC,
+ 0xCF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFC, 0xCB, 0xBB, 0xAB, 0xBC, 0xCF, 0xFF,
+ 0xFF, 0xFD, 0xFF, 0xFD, 0xDF, 0xCC, 0xCC, 0xCD, 0xDD, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFD, 0xFF, 0xCD, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFD, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7D, 0xDD, 0xDF, 0xFD, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xDF, 0xFF, 0xFD, 0x7F, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xCD, 0xDD,
+ 0xCC, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFD, 0xDC, 0xBB, 0xBB, 0xCF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFC, 0xCB, 0xA9, 0xAA, 0xBC, 0xDD, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xCB, 0x97, 0x77, 0x89, 0xAC, 0xDF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFC, 0xA8, 0x64, 0x46, 0x8A, 0xBD, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xB9, 0x74, 0x12, 0x47, 0x9B, 0xCF, 0xFF, 0xFF, 0xFF, 0xFF, 0xCB,
+ 0x97, 0x42, 0x24, 0x79, 0xBD, 0xFF, 0xFF, 0xFF, 0xFF, 0xDD, 0xBA, 0x86,
+ 0x44, 0x58, 0x9C, 0xCF, 0xFF, 0xFF, 0xFF, 0xFF, 0xDB, 0xA9, 0x87, 0x78,
+ 0x9A, 0xDF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xBC, 0xBA, 0x99, 0xAB, 0xBD,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xDF, 0xCC, 0xBB, 0xBC, 0xCE, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xEF, 0xDC, 0xCC, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x8D, 0xFF, 0xFF, 0xFF, 0xDF, 0xDF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xCF, 0xED, 0xCC, 0xED, 0xBB, 0xCB, 0xBB, 0xCC, 0xBC, 0xCC, 0x6D, 0xFF,
+ 0xED, 0xDC, 0xCC, 0xBD, 0xCC, 0xDC, 0xEE, 0xFF, 0xFC, 0xED, 0xDF, 0xCD,
+ 0xCC, 0xCB, 0xCC, 0xCD, 0xCD, 0xDE, 0xFF, 0xCF, 0xED, 0xEC, 0xCB, 0xBA,
+ 0xBB, 0xBB, 0xCC, 0xCC, 0xDD, 0xFC, 0xDD, 0xDC, 0xBA, 0xBA, 0xA9, 0x9A,
+ 0xAA, 0xBB, 0xCD, 0xEF, 0xDC, 0xDC, 0xCB, 0xA9, 0x98, 0x88, 0x99, 0x9B,
+ 0xBC, 0xCD, 0xFD, 0xBC, 0xCB, 0xAA, 0x98, 0x77, 0x77, 0x89, 0xAA, 0xBD,
+ 0xCD, 0xDC, 0xCC, 0xBA, 0x98, 0x76, 0x56, 0x67, 0x89, 0xAB, 0xCC, 0xDC,
+ 0xBC, 0xBB, 0xA8, 0x76, 0x44, 0x45, 0x67, 0x9A, 0xBC, 0xCE, 0xDC, 0xDB,
+ 0xB9, 0x87, 0x64, 0x23, 0x46, 0x78, 0xAB, 0xBC, 0xEC, 0xCC, 0xBA, 0x98,
+ 0x76, 0x43, 0x34, 0x57, 0x89, 0xBB, 0xCD, 0xDB, 0xCB, 0xBA, 0x97, 0x65,
+ 0x44, 0x56, 0x78, 0x9B, 0xBD, 0xDD, 0xCD, 0xCB, 0xA9, 0x87, 0x66, 0x56,
+ 0x78, 0x9A, 0xBB, 0xDF, 0xEB, 0xDC, 0xBA, 0xA9, 0x87, 0x77, 0x78, 0x8A,
+ 0xBB, 0xCD, 0xFD, 0xCC, 0xDB, 0xBB, 0x99, 0x98, 0x88, 0x9A, 0xAA, 0xBC,
+ 0xDF, 0xDC, 0xDD, 0xBC, 0xBB, 0xAA, 0x99, 0xAA, 0xAB, 0xBC, 0xCE, 0xFE,
+ 0xDF, 0xFD, 0xCC, 0xBB, 0xAA, 0xBB, 0xBB, 0xCC, 0xDC, 0xFF, 0xEC, 0xFF,
+ 0xDC, 0xDC, 0xCC, 0xBB, 0xBC, 0xCD, 0xED, 0xED, 0xFE, 0xDE, 0xEE, 0xED,
+ 0xCD, 0xCC, 0xCC, 0xDD, 0xDD, 0xEF, 0xEF, 0xEC, 0xEF, 0xFE, 0xED, 0xED,
+ 0xDE, 0xED, 0xEE, 0xFE, 0xFF, 0xFF, 0x6C, 0xCC, 0xDD, 0xDD, 0xDD, 0xBC,
+ 0xCC, 0xED, 0xDD, 0xEF, 0xC0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xED, 0xDD, 0xDD, 0xDE, 0xEF, 0xFF, 0xCF, 0xFF,
+ 0xFF, 0xDD, 0xDC, 0xCC, 0xCD, 0xDE, 0xDD, 0xFF, 0xFF, 0xFF, 0xFF, 0xEC,
+ 0xCB, 0xBA, 0xAA, 0xBB, 0xCC, 0xDF, 0xFF, 0xFF, 0xFF, 0xDC, 0xBA, 0xA9,
+ 0x99, 0x9A, 0xAA, 0xBC, 0xEF, 0xFF, 0xFD, 0xDC, 0xBA, 0x98, 0x88, 0x88,
+ 0x99, 0xAA, 0xBC, 0xDF, 0xFF, 0xDD, 0xBA, 0x98, 0x77, 0x77, 0x77, 0x89,
+ 0xAB, 0xBC, 0xFF, 0xFD, 0xCA, 0x98, 0x76, 0x66, 0x66, 0x77, 0x89, 0xAB,
+ 0xCD, 0xED, 0xDB, 0xA8, 0x76, 0x65, 0x55, 0x56, 0x78, 0x89, 0xBC, 0xDF,
+ 0xDC, 0xB9, 0x87, 0x65, 0x55, 0x55, 0x56, 0x78, 0x9B, 0xCD, 0xED, 0xCA,
+ 0x98, 0x76, 0x55, 0x44, 0x55, 0x67, 0x89, 0xAC, 0xEF, 0xDC, 0xA9, 0x87,
+ 0x65, 0x54, 0x45, 0x56, 0x78, 0x9A, 0xCD, 0xFD, 0xDA, 0x98, 0x76, 0x55,
+ 0x55, 0x55, 0x67, 0x89, 0xAC, 0xDF, 0xDC, 0xB9, 0x87, 0x76, 0x55, 0x55,
+ 0x66, 0x78, 0xAB, 0xDF, 0xFD, 0xCB, 0xA9, 0x87, 0x76, 0x66, 0x66, 0x78,
+ 0x9A, 0xBE, 0xEF, 0xDE, 0xCB, 0xA9, 0x87, 0x77, 0x77, 0x78, 0x9A, 0xBC,
+ 0xDF, 0xFE, 0xDC, 0xBA, 0xA9, 0x98, 0x88, 0x88, 0x9A, 0xBC, 0xFE, 0xFF,
+ 0xFE, 0xDC, 0xBA, 0xA9, 0x99, 0x99, 0xAA, 0xBC, 0xDF, 0xFF, 0xFF, 0xFD,
+ 0xDC, 0xBB, 0xBB, 0xAA, 0xBB, 0xBC, 0xDF, 0xFF, 0xFF, 0xFF, 0xFF, 0xDE,
+ 0xDC, 0xCC, 0xCD, 0xCE, 0xEF, 0xFF, 0xFF, 0xFE, 0xFF, 0xFF, 0xDF, 0xDD,
+ 0xED, 0xDE, 0xFF, 0xFF, 0xFF, 0xFF, 0xBE, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xEF, 0xFE, 0xFF, 0xFD, 0xEC, 0xDD, 0xCC, 0xCC, 0xCC, 0xDD, 0x6F, 0xFF,
+ 0xFF, 0xFF, 0xFD, 0xDD, 0xFF, 0xDF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFD,
+ 0xED, 0xCC, 0xCD, 0xFF, 0xED, 0xFF, 0xDF, 0xFF, 0xFF, 0xFF, 0xDD, 0xCC,
+ 0xCC, 0xCC, 0xDD, 0xEF, 0xFF, 0xFE, 0xFF, 0xFE, 0xFD, 0xCC, 0xCB, 0xBB,
+ 0xBD, 0xFD, 0xEF, 0xFF, 0xDF, 0xEE, 0xFD, 0xCB, 0xBA, 0xA9, 0xAB, 0xBC,
+ 0xDD, 0xDF, 0xFF, 0xFF, 0xDC, 0xCB, 0xA9, 0x88, 0x88, 0x9A, 0xBC, 0xDF,
+ 0xFF, 0xFF, 0xFE, 0xDC, 0xA9, 0x87, 0x66, 0x78, 0x9B, 0xCC, 0xDD, 0xFE,
+ 0xED, 0xDC, 0xBA, 0x97, 0x54, 0x45, 0x79, 0xAB, 0xDD, 0xFF, 0xFD, 0xDD,
+ 0xCB, 0xA8, 0x64, 0x22, 0x46, 0x8A, 0xBC, 0xDF, 0xFE, 0xDD, 0xDC, 0xBA,
+ 0x86, 0x42, 0x24, 0x68, 0xAB, 0xCD, 0xFF, 0xED, 0xDD, 0xCB, 0xA9, 0x75,
+ 0x44, 0x57, 0x8A, 0xBD, 0xDF, 0xFF, 0xDF, 0xDD, 0xCB, 0x98, 0x76, 0x67,
+ 0x89, 0xBC, 0xCD, 0xFF, 0xFF, 0xFF, 0xDC, 0xBA, 0x98, 0x88, 0x89, 0xAB,
+ 0xCD, 0xDE, 0xFE, 0xDF, 0xFD, 0xED, 0xBB, 0xA9, 0xAA, 0xBC, 0xCD, 0xDF,
+ 0xFF, 0xEF, 0xFF, 0xFF, 0xDC, 0xCA, 0xBB, 0xBC, 0xCD, 0xDF, 0xFF, 0xFF,
+ 0xDF, 0xFF, 0xDC, 0xDD, 0xCC, 0xCC, 0xDD, 0xEF, 0xFF, 0xFF, 0xFD, 0xFF,
+ 0xFF, 0xEF, 0xDD, 0xDC, 0xDF, 0xFF, 0xFF, 0xFF, 0xFF, 0xCF, 0xFF, 0xFF,
+ 0xDF, 0xDD, 0xFD, 0xFD, 0xFF, 0xFF, 0xFF, 0xFD, 0xED, 0xFF, 0xFE, 0xDF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x6C, 0xDD, 0xDC, 0xCC, 0xFD, 0xFD,
+ 0xDD, 0xDF, 0xFF, 0xFF, 0xE0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xDF, 0xFD, 0xCD, 0xDC, 0xFD, 0xDD, 0xDD, 0x8F, 0xFF,
+ 0xFF, 0xFF, 0xDF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xCD, 0xFF, 0xDD, 0xDF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFD, 0xCC,
+ 0xCC, 0xCD, 0xDE, 0xDF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFC, 0xCB, 0xBB, 0xCB,
+ 0xCC, 0xCF, 0xFD, 0xFF, 0xFF, 0xFD, 0xFD, 0xCB, 0xAA, 0xA9, 0xAA, 0xBC,
+ 0xCD, 0xFF, 0xFF, 0xFF, 0xDF, 0xBB, 0xA9, 0x88, 0x88, 0x9A, 0xBC, 0xDF,
+ 0xFF, 0xFF, 0xFF, 0xDC, 0xA9, 0x87, 0x66, 0x78, 0x9A, 0xCC, 0xFF, 0xFD,
+ 0xFF, 0xDC, 0xBA, 0x87, 0x54, 0x45, 0x79, 0xAB, 0xDC, 0xDF, 0xFF, 0xFD,
+ 0xCA, 0x98, 0x64, 0x22, 0x46, 0x8A, 0xBD, 0xFF, 0xFF, 0xDF, 0xDC, 0xB9,
+ 0x86, 0x42, 0x24, 0x68, 0x9C, 0xCF, 0xDF, 0xFF, 0xFF, 0xCB, 0xA9, 0x75,
+ 0x44, 0x56, 0x8A, 0xBD, 0xFF, 0xFF, 0xFF, 0xDD, 0xBB, 0x98, 0x76, 0x66,
+ 0x79, 0xAB, 0xDF, 0xFF, 0xFF, 0xFF, 0xCC, 0xBA, 0x99, 0x88, 0x89, 0xAB,
+ 0xDD, 0xFF, 0xFF, 0xEF, 0xFF, 0xCC, 0xBA, 0xAA, 0xAA, 0xAB, 0xCD, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xDC, 0xBB, 0xBB, 0xBC, 0xCD, 0xFF, 0xFF, 0xFF,
+ 0xDF, 0xFF, 0xDD, 0xDC, 0xDD, 0xCD, 0xDD, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFD, 0xFF, 0xDD, 0xDF, 0xDF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFD, 0xFF, 0xFF,
+ 0xFD, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7D, 0xDD, 0xDF, 0xFD, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x6F, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xBB, 0xBC, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xCB, 0xA9, 0x9A, 0xBF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFA, 0x98, 0x77, 0x89, 0xAF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFB, 0xA8, 0x64, 0x46, 0x8A, 0xCF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xB9, 0x74, 0x12, 0x47, 0x9A, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFB,
+ 0x97, 0x42, 0x24, 0x79, 0xBF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xEA, 0x86,
+ 0x44, 0x57, 0x9B, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xB9, 0x87, 0x78,
+ 0x9B, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xAA, 0x99, 0xAA, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFD, 0xFB, 0xBB, 0xEF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xCF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x9F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFD, 0xCD, 0xCC, 0xCF, 0xBB, 0x6F, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFD, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xFE,
+ 0xFC, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xBC, 0xBC,
+ 0xCC, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFC, 0xBA, 0x99, 0xAA, 0xBC,
+ 0xDF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xB9, 0x98, 0x88, 0xAA, 0xBF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xCD, 0xB9, 0x87, 0x66, 0x78, 0x9A, 0xCF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xCA, 0x87, 0x54, 0x45, 0x79, 0xAB, 0xDF, 0xFF, 0xFF, 0xFD,
+ 0xFB, 0xA8, 0x64, 0x22, 0x46, 0x8A, 0xBD, 0xFF, 0xFF, 0xFF, 0xFF, 0xB9,
+ 0x86, 0x42, 0x24, 0x68, 0xAB, 0xFF, 0xFF, 0xFF, 0xFF, 0xFC, 0xA8, 0x75,
+ 0x44, 0x56, 0x9B, 0xCD, 0xFF, 0xFF, 0xFF, 0xFF, 0xCA, 0x98, 0x76, 0x66,
+ 0x89, 0xCC, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xBA, 0x98, 0x88, 0x89, 0xBB,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xDF, 0xFB, 0xCB, 0xAA, 0xAA, 0xBC, 0xDF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xDC, 0xCC, 0xAB, 0xBC, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFC, 0xCD, 0xFC, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xDF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xDF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x6C, 0xBC, 0xCF, 0xFF, 0xCD, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xDC, 0xDB, 0xBA, 0xAA, 0xA9, 0xAA, 0xA9, 0xAB, 0xBB, 0xCC, 0xAF, 0xFD,
+ 0xBB, 0xBA, 0xA9, 0xAA, 0x9A, 0xAB, 0xBB, 0xCD, 0xDC, 0xCB, 0xBB, 0xAA,
+ 0x99, 0x99, 0x89, 0x9A, 0xAA, 0xBB, 0xCC, 0xCC, 0xBB, 0xAA, 0x99, 0x88,
+ 0x88, 0x88, 0x99, 0xAA, 0xAB, 0xCB, 0xBB, 0xB9, 0x88, 0x87, 0x77, 0x77,
+ 0x88, 0x89, 0xAA, 0xBB, 0xCA, 0xAA, 0x98, 0x87, 0x77, 0x77, 0x77, 0x78,
+ 0x89, 0xAB, 0xCA, 0xAA, 0x98, 0x87, 0x66, 0x66, 0x66, 0x67, 0x78, 0x9A,
+ 0xAB, 0xBB, 0xAA, 0x88, 0x77, 0x66, 0x66, 0x66, 0x67, 0x78, 0x9A, 0xBB,
+ 0xAA, 0x98, 0x77, 0x66, 0x55, 0x56, 0x66, 0x77, 0x89, 0x9B, 0xAA, 0xA9,
+ 0x87, 0x76, 0x65, 0x55, 0x56, 0x66, 0x78, 0x99, 0xAB, 0xAA, 0x98, 0x77,
+ 0x66, 0x55, 0x55, 0x66, 0x77, 0x89, 0x9C, 0xA9, 0xA9, 0x87, 0x76, 0x66,
+ 0x55, 0x66, 0x67, 0x78, 0x9A, 0xBB, 0x9A, 0x98, 0x87, 0x76, 0x66, 0x66,
+ 0x66, 0x78, 0x89, 0x9A, 0xBA, 0xA9, 0x98, 0x87, 0x76, 0x66, 0x67, 0x77,
+ 0x88, 0x9B, 0xBC, 0xAA, 0x99, 0x98, 0x77, 0x77, 0x77, 0x77, 0x89, 0x9A,
+ 0xBC, 0xCA, 0xAA, 0x99, 0x88, 0x87, 0x77, 0x77, 0x89, 0x99, 0xAB, 0xDD,
+ 0xCB, 0xCB, 0xA9, 0x89, 0x88, 0x88, 0x88, 0x99, 0xAA, 0xBC, 0xCB, 0xDC,
+ 0xBA, 0xA9, 0x99, 0x98, 0x99, 0x9A, 0xBA, 0xBC, 0xDC, 0xEC, 0xCC, 0xAB,
+ 0xBA, 0x9A, 0x9A, 0xAA, 0xAB, 0xBC, 0xEF, 0xEC, 0xEC, 0xCB, 0xBB, 0xBB,
+ 0xBA, 0xBB, 0xBB, 0xCC, 0xDC, 0xEE, 0xAC, 0xBC, 0xCB, 0xBA, 0xCA, 0xBA,
+ 0xBC, 0xBB, 0xDD, 0xDD, 0xF0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xBF, 0xDF, 0xCC, 0xED, 0xBA, 0xBC, 0xCB, 0xBB, 0xBB, 0xCF, 0x6F, 0xFF,
+ 0xDC, 0xFF, 0xEF, 0xED, 0xFD, 0xFF, 0xFF, 0xFF, 0xFD, 0xDF, 0xFF, 0xFD,
+ 0xFF, 0xDC, 0xDF, 0xFD, 0xFD, 0xFD, 0xFF, 0xEF, 0xFF, 0xFF, 0xFF, 0xDC,
+ 0xBB, 0xCB, 0xFC, 0xFF, 0xFF, 0xFC, 0xCF, 0xFC, 0xFF, 0xCB, 0xBB, 0xAB,
+ 0xCC, 0xBF, 0xFD, 0xFF, 0xFF, 0xFF, 0xCB, 0xBB, 0xA9, 0xA9, 0xAC, 0xBE,
+ 0xEE, 0xFE, 0xED, 0xCF, 0xFF, 0xDA, 0xA9, 0x88, 0x88, 0xAA, 0xCD, 0xCD,
+ 0xFF, 0xDC, 0xFF, 0xFB, 0xA9, 0x86, 0x66, 0x78, 0xAB, 0xCC, 0xFD, 0xFC,
+ 0xCF, 0xDD, 0xDA, 0x86, 0x54, 0x46, 0x79, 0xAD, 0xCF, 0xFF, 0xCC, 0xFF,
+ 0xCB, 0xA9, 0x64, 0x22, 0x47, 0x8A, 0xCB, 0xFF, 0xFF, 0xCF, 0xFD, 0xB9,
+ 0x86, 0x42, 0x24, 0x68, 0x9B, 0xCE, 0xFD, 0xCC, 0xFD, 0xBB, 0xA9, 0x76,
+ 0x44, 0x57, 0x8A, 0xBC, 0xEE, 0xDE, 0xED, 0xFF, 0xDB, 0xA8, 0x76, 0x66,
+ 0x78, 0xAC, 0xCD, 0xDF, 0xFD, 0xFF, 0xFB, 0xCB, 0xA9, 0x88, 0x89, 0x9B,
+ 0xCF, 0xCF, 0xFF, 0xDF, 0xFC, 0xDF, 0xCA, 0xA9, 0xAA, 0xAA, 0xCF, 0xDD,
+ 0xFF, 0xFC, 0xFF, 0xFD, 0xCC, 0xCC, 0xBB, 0xAB, 0xCC, 0xCF, 0xFF, 0xFC,
+ 0xCF, 0xDD, 0xFC, 0xFF, 0xCB, 0xCD, 0xFF, 0xDF, 0xFF, 0xFF, 0xFC, 0xFF,
+ 0xDF, 0xDF, 0xCF, 0xFC, 0xCF, 0xFF, 0xFF, 0xDF, 0xFD, 0xCF, 0xFF, 0xCF,
+ 0xFF, 0xFC, 0xDF, 0xFF, 0xFF, 0xFF, 0xFF, 0xCC, 0xFF, 0xFF, 0xFF, 0xCF,
+ 0xFD, 0xFC, 0xFF, 0xFF, 0xFF, 0xFF, 0x6D, 0xCC, 0xCD, 0xBD, 0xDC, 0xFD,
+ 0xCD, 0xCF, 0xFF, 0xFF, 0xB0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x9F, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFC,
+ 0xCC, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xCC, 0xCB, 0xCC,
+ 0xCC, 0xCF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xBC, 0xBA, 0xA9, 0xAA, 0xCF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFB, 0xA9, 0x88, 0x88, 0x9A, 0xBF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFB, 0xB9, 0x86, 0x66, 0x78, 0x9A, 0xCF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xB9, 0x87, 0x54, 0x45, 0x78, 0xAC, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFB, 0xA8, 0x64, 0x22, 0x46, 0x8A, 0xBC, 0xFF, 0xFF, 0xFF, 0xFC, 0xCA,
+ 0x86, 0x42, 0x24, 0x68, 0x9C, 0xFF, 0xFF, 0xFF, 0xFF, 0xFC, 0xA8, 0x75,
+ 0x44, 0x56, 0x8A, 0xCC, 0xFF, 0xFF, 0xFF, 0xFF, 0xBA, 0x98, 0x76, 0x66,
+ 0x89, 0xBC, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xBA, 0x98, 0x88, 0x89, 0xAC,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFB, 0xCB, 0xAA, 0xA9, 0xBB, 0xCF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xBC, 0xBB, 0xCF, 0xEF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xDE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x6F, 0xFF, 0xCF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF9, 0xFF, 0xFF, 0x9F, 0x6F, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0x9F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xAF, 0x9C, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x78, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0x65, 0x47, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0x94, 0x12, 0x58, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xF8, 0x52, 0x14, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF8,
+ 0x54, 0x78, 0x9F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xDF, 0x87,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x99, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xF9, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF9, 0x6F, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x98, 0x98, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xF9, 0x74, 0x57, 0x9F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFA, 0x85, 0x12, 0x59, 0x9F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xF9, 0x52, 0x14, 0x89, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x97,
+ 0x54, 0x67, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF8, 0x89,
+ 0x9F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFC, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x9F, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x5F, 0xFF, 0xFC, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF6, 0xFF, 0xFF, 0xFF, 0xFF, 0x5F, 0xFF,
+ 0xFF, 0xFF, 0xF6, 0xF6, 0x6F, 0x68, 0xF5, 0xFF, 0xFF, 0xFF, 0xFF, 0xF6,
+ 0x66, 0xF6, 0xFF, 0x6F, 0xFF, 0xFF, 0xFF, 0xF6, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xF6, 0x6F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x66, 0xF6, 0x6F,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0x6F, 0xFF, 0x6F, 0x66, 0x66, 0xFF, 0x6F, 0xF6,
+ 0xFF, 0xFF, 0x6F, 0xCF, 0xFF, 0x6F, 0xFF, 0xF6, 0x6F, 0x6F, 0xFF, 0x6F,
+ 0xFF, 0xF6, 0x56, 0xF6, 0xF6, 0x56, 0xFF, 0xFF, 0x66, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0x65, 0x56, 0x6F, 0xFF, 0xF6, 0xFF, 0x6F, 0xFF, 0xFF,
+ 0xF6, 0x66, 0xF6, 0xFF, 0x66, 0x6F, 0xFF, 0x6F, 0xFF, 0x6F, 0xF6, 0xFF,
+ 0x66, 0x6F, 0x56, 0xF6, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF6, 0x6F,
+ 0x46, 0xF5, 0x6F, 0x6F, 0xFF, 0xF5, 0x6B, 0xAF, 0xFF, 0x5F, 0xFF, 0xFF,
+ 0x6F, 0x6F, 0xF6, 0xFF, 0xFF, 0xFF, 0xFF, 0x6F, 0xF6, 0x66, 0xF5, 0xFF,
+ 0x5F, 0xFF, 0xFF, 0x6F, 0xFF, 0xFF, 0xFF, 0xF5, 0x55, 0xF6, 0xF6, 0xFF,
+ 0xFF, 0x6F, 0xFF, 0xFF, 0x6F, 0xF6, 0xFF, 0xF6, 0xF6, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0x6F, 0xFF, 0xFF, 0xFF, 0xF6, 0x6F, 0x6F, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0x6F, 0xF6, 0xFF, 0x6F, 0xFF, 0xFF, 0xFF, 0x6F,
+ 0xF6, 0xFF, 0xF6, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xF6, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF6, 0xFF, 0xFF, 0xFF, 0x6F, 0x6F,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0x9F, 0xFF, 0xFF, 0xFF, 0xF9, 0xFF, 0x9F, 0x4F, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFC, 0xFF, 0xFF, 0xF9,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x98, 0x98, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xF9, 0xF8, 0x67, 0x8F, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xF8, 0x97, 0x54, 0x47, 0x9F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0x8F, 0x74, 0x12, 0x57, 0x8F, 0xF9, 0xFF, 0xFF, 0x9F, 0xFF, 0x9F,
+ 0x98, 0x52, 0x24, 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF7,
+ 0x54, 0x58, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF7, 0xF8,
+ 0x9F, 0x9F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF9, 0xFF, 0x89, 0xFF,
+ 0x9F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF9, 0xF9, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF9, 0xF9, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x9F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0x9F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x5F, 0xF9, 0x99, 0xFF, 0x9F, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x9F, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFB,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xBA, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xAA, 0xBA, 0xFF, 0xFF, 0xBF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xA8, 0x77, 0x9A, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xF8, 0x54, 0x45, 0x9A, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFA, 0x84, 0x22, 0x47, 0xAF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xA8, 0x42, 0x14, 0x7A, 0xDF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x96,
+ 0x44, 0x59, 0xAF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFB, 0x97, 0x78,
+ 0xAB, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xBF, 0xFA, 0xBF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFB, 0xBF, 0xFB, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x5F, 0xFF, 0xFB, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFB, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF8, 0xFF, 0xFF, 0x5F, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0x7F, 0xFF, 0xF7, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xF7, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF6, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF7, 0x76, 0xF7, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xEF, 0xFF, 0xFF, 0x6F, 0x67, 0x6F, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xF7, 0xF7, 0x55, 0x5F, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xF7, 0x55, 0x44, 0x46, 0x7F, 0x7F, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xF7, 0xF5, 0x54, 0x44, 0x57, 0x66, 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xF6,
+ 0x75, 0x44, 0x34, 0x46, 0x6F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, 0x55,
+ 0x45, 0x45, 0x56, 0xFF, 0xFF, 0xFF, 0xFD, 0xCF, 0x6F, 0x7F, 0x75, 0x57,
+ 0x56, 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x76, 0x66, 0x7F,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF7, 0x7F, 0xF7, 0x7F, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF7, 0xFF, 0xFF, 0xF7, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0x6F, 0x7F, 0xFF, 0xF7, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x6F, 0xFF, 0x7F, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x8F, 0xFF, 0xFF, 0x5F, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xF9, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF9, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xA7, 0x78, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFC, 0x44, 0x45, 0x8F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0x73, 0x22, 0x48, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xF7, 0x42, 0x24, 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x86,
+ 0x43, 0x4C, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF8, 0x77,
+ 0x8F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF8, 0xF9, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x9F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x4F, 0xF9, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0x88, 0x88, 0x88, 0x78, 0x88, 0x88, 0x87, 0x78, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x87, 0x77, 0x78, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x77, 0x77, 0x77, 0x77, 0x78, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x87, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x78, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x78, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x80, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x8F, 0xFF, 0xFF, 0xFF, 0xFF, 0x6F, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF8, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xCF, 0xFF, 0xFF, 0xFF, 0xF7, 0x7F, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xF8, 0x75, 0x67, 0x78, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xF9, 0x76, 0x43, 0x46, 0x8F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xF6, 0x63, 0x23, 0x58, 0x8F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xAF, 0x43, 0x23, 0x57, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFC, 0xFF, 0x85,
+ 0x54, 0x45, 0x8F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x8F, 0xF7, 0x55,
+ 0x68, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF8, 0xBF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF8, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xF8, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x4F, 0xF8, 0xF8, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFB, 0xFF, 0xFF, 0xFB, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xBF, 0xBF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFA, 0xAF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF9, 0x87, 0x88, 0x9F, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xAA, 0x87, 0x66, 0x78, 0xAF, 0xBF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xBF, 0xA7, 0x54, 0x45, 0x6A, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xF7, 0x64, 0x22, 0x46, 0x89, 0xDF, 0xFF, 0xFF, 0xFF, 0xFB, 0xFF,
+ 0x76, 0x42, 0x24, 0x68, 0xBF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF9, 0x75,
+ 0x44, 0x57, 0xA9, 0xFF, 0xFF, 0xFA, 0xFF, 0xFF, 0xFF, 0x97, 0x76, 0x67,
+ 0x8F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xAF, 0xBA, 0x98, 0x8A, 0xBB,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xAF, 0xFA, 0xAF, 0xBF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xBF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFA, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xCF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x4F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xF9, 0x9F, 0xFF, 0xCF, 0x99, 0xFF, 0x3F, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFD, 0x9F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF8, 0x78, 0x8F, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0x64, 0x47, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFA, 0x84, 0x22, 0x48, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xF7, 0x42, 0x14, 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF7,
+ 0x44, 0x6F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x99, 0x88,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xEF, 0xFF, 0xFF, 0xEE, 0xEF, 0xFF, 0xFF, 0x3F, 0xFF,
+ 0xFE, 0xEE, 0xEE, 0xEF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x6F,
+ 0xFF, 0xFF, 0xFF, 0xFE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE,
+ 0xEE, 0xEE, 0xEE, 0xEF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF6, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0x64, 0x56, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xF3, 0x12, 0x46, 0xFF, 0xFE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE,
+ 0xEE, 0x52, 0x24, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE,
+ 0x44, 0x6E, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0x6F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFE, 0xFE, 0xF0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0x88, 0x88, 0x88, 0x78, 0x88, 0x88, 0x87, 0x78, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x87, 0x77, 0x78, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x77, 0x77, 0x77, 0x77, 0x78, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x87, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x78, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x78, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x80, 0x00, 0x00, 0x00,
+ },
+ {
+ 0x88, 0x88, 0x88, 0x78, 0x88, 0x88, 0x87, 0x78, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x87, 0x77, 0x78, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x77, 0x77, 0x77, 0x77, 0x78, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x87, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x78, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x78, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x80, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFD, 0x83, 0x47, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xF4, 0x12, 0x4F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xF7, 0x42, 0x24, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF7,
+ 0x44, 0x77, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFD, 0x8F,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xBF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0x9C, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x3F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00,
+ },
+ },
+ {
+ {
+ 0xBE, 0xDD, 0xEC, 0xDD, 0xDD, 0xDC, 0xDE, 0xEE, 0xFF, 0xFF, 0xCD, 0xFE,
+ 0xFD, 0xDD, 0xDC, 0xCD, 0xDD, 0xEE, 0xEF, 0xFF, 0xFF, 0xDE, 0xFD, 0xCC,
+ 0xCC, 0xBB, 0xBB, 0xCC, 0xCD, 0xFF, 0xFF, 0xFD, 0xED, 0xDC, 0xBB, 0xAA,
+ 0xAA, 0xAA, 0xBB, 0xCD, 0xFF, 0xFF, 0xDF, 0xEC, 0xBB, 0xA9, 0x99, 0x99,
+ 0x99, 0xAB, 0xCD, 0xFF, 0xFD, 0xEC, 0xBB, 0xA9, 0x88, 0x77, 0x78, 0x89,
+ 0xAB, 0xCD, 0xFE, 0xED, 0xCB, 0xA9, 0x87, 0x76, 0x66, 0x77, 0x89, 0xAB,
+ 0xCD, 0xFC, 0xDC, 0xA9, 0x87, 0x76, 0x65, 0x66, 0x67, 0x89, 0xBC, 0xDF,
+ 0xDC, 0xCA, 0x98, 0x76, 0x55, 0x55, 0x56, 0x78, 0x9A, 0xCD, 0xDD, 0xDB,
+ 0xA9, 0x87, 0x65, 0x54, 0x55, 0x56, 0x79, 0xAC, 0xDD, 0xDC, 0xBA, 0x97,
+ 0x65, 0x54, 0x44, 0x55, 0x67, 0x8A, 0xBD, 0xDE, 0xCB, 0xA9, 0x76, 0x65,
+ 0x54, 0x55, 0x66, 0x79, 0xAB, 0xCD, 0xED, 0xCA, 0x98, 0x76, 0x55, 0x55,
+ 0x56, 0x78, 0x9A, 0xBD, 0xDE, 0xDC, 0xB9, 0x87, 0x66, 0x65, 0x66, 0x77,
+ 0x89, 0xAC, 0xDC, 0xEF, 0xCB, 0xA9, 0x87, 0x76, 0x66, 0x77, 0x89, 0xAB,
+ 0xCD, 0xDF, 0xFE, 0xCB, 0xA9, 0x88, 0x77, 0x78, 0x89, 0xAB, 0xCC, 0xED,
+ 0xFF, 0xED, 0xCB, 0xA9, 0x99, 0x99, 0x99, 0xAB, 0xBC, 0xDF, 0xDF, 0xFF,
+ 0xED, 0xCC, 0xBA, 0xAA, 0xAA, 0xAB, 0xBC, 0xDE, 0xFD, 0xFF, 0xFF, 0xFE,
+ 0xDC, 0xCB, 0xBB, 0xBC, 0xCC, 0xEE, 0xEF, 0xEF, 0xFF, 0xFF, 0xFE, 0xEE,
+ 0xCC, 0xDD, 0xDD, 0xDF, 0xEF, 0xFF, 0xDF, 0xFF, 0xFE, 0xFF, 0xDD, 0xDD,
+ 0xDD, 0xDD, 0xDE, 0xDE, 0xB0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xAD, 0xCB, 0xBB, 0xBC, 0xCB, 0xFC, 0xDB, 0xCD, 0xFF, 0xFF, 0xCF, 0xFF,
+ 0xBD, 0xCC, 0xDC, 0xDB, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xCF, 0xCC, 0xDC,
+ 0xBB, 0xAB, 0xBA, 0xBC, 0xCD, 0xDD, 0xDD, 0xFB, 0xDD, 0xFB, 0xAB, 0xAA,
+ 0x9A, 0xAA, 0xAA, 0xBC, 0xFF, 0xFF, 0xCF, 0xFC, 0xCB, 0xBA, 0x99, 0x99,
+ 0x99, 0xAB, 0xBC, 0xCF, 0xFB, 0xDB, 0xBA, 0xA9, 0x98, 0x87, 0x78, 0x88,
+ 0xAA, 0xBC, 0xDF, 0xCF, 0xFB, 0xA9, 0x88, 0x77, 0x77, 0x77, 0x89, 0xAA,
+ 0xBF, 0xCF, 0xCC, 0xA9, 0x98, 0x76, 0x65, 0x56, 0x67, 0x89, 0xAB, 0xFC,
+ 0xCB, 0xDA, 0xA8, 0x76, 0x65, 0x55, 0x56, 0x78, 0x9A, 0xBC, 0xCB, 0xFB,
+ 0xA9, 0x87, 0x65, 0x44, 0x45, 0x56, 0x79, 0x9B, 0xCC, 0xBF, 0xBA, 0x97,
+ 0x75, 0x54, 0x44, 0x56, 0x68, 0x9A, 0xBE, 0xFB, 0xDB, 0xA9, 0x86, 0x65,
+ 0x44, 0x45, 0x67, 0x89, 0xAA, 0xCC, 0xDF, 0xBB, 0x98, 0x76, 0x55, 0x55,
+ 0x66, 0x78, 0x9A, 0xAC, 0xDC, 0xFC, 0xA9, 0x87, 0x66, 0x66, 0x66, 0x78,
+ 0x8A, 0xAB, 0xBB, 0xFC, 0xBC, 0xB9, 0x87, 0x76, 0x77, 0x77, 0x89, 0xAB,
+ 0xDC, 0xBC, 0xFC, 0xBB, 0xA9, 0x98, 0x88, 0x88, 0x99, 0x9A, 0xCB, 0xCB,
+ 0xFF, 0xFC, 0xCA, 0xAA, 0x99, 0x99, 0xA9, 0x9B, 0xBC, 0xCD, 0xDF, 0xFF,
+ 0xCF, 0xBB, 0xBA, 0xAA, 0xAA, 0xBB, 0xBC, 0xCF, 0xDD, 0xFF, 0xFF, 0xFD,
+ 0xCC, 0xCB, 0xBB, 0xCC, 0xBB, 0xDB, 0xFF, 0xCF, 0xFF, 0xFF, 0xDD, 0xFD,
+ 0xBF, 0xDC, 0xCB, 0xBF, 0xDF, 0xFC, 0xFF, 0xFF, 0xFE, 0xED, 0xFF, 0xCB,
+ 0xBC, 0xDC, 0xBC, 0xBC, 0xA0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xCD, 0xDF, 0xDD, 0xDD, 0xDC, 0xDD, 0xDD, 0xDE, 0xFF, 0xFF, 0xDF, 0xFF,
+ 0xFE, 0xDD, 0xDC, 0xCC, 0xCD, 0xDE, 0xEF, 0xFF, 0xFF, 0xEF, 0xFD, 0xDC,
+ 0xBB, 0xBB, 0xBB, 0xBB, 0xCD, 0xDF, 0xFF, 0xFD, 0xFE, 0xDC, 0xBB, 0xAA,
+ 0x9A, 0xAA, 0xAB, 0xCD, 0xEF, 0xFF, 0xDF, 0xDC, 0xBA, 0xA9, 0x98, 0x88,
+ 0x89, 0xAA, 0xBD, 0xDF, 0xFD, 0xEC, 0xBA, 0x99, 0x88, 0x77, 0x77, 0x89,
+ 0x9A, 0xBC, 0xEF, 0xDD, 0xCB, 0x99, 0x87, 0x76, 0x66, 0x67, 0x88, 0xAB,
+ 0xCD, 0xFD, 0xDB, 0xA9, 0x87, 0x66, 0x65, 0x56, 0x67, 0x89, 0xAB, 0xED,
+ 0xDC, 0xBA, 0x98, 0x76, 0x55, 0x55, 0x56, 0x77, 0x8A, 0xBD, 0xDD, 0xCB,
+ 0xA8, 0x76, 0x65, 0x55, 0x55, 0x66, 0x78, 0xAB, 0xCD, 0xDC, 0xB9, 0x87,
+ 0x65, 0x55, 0x44, 0x55, 0x67, 0x89, 0xBD, 0xDD, 0xCB, 0xA8, 0x76, 0x65,
+ 0x55, 0x55, 0x66, 0x78, 0x9B, 0xCD, 0xDC, 0xBA, 0x98, 0x76, 0x55, 0x55,
+ 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0xDB, 0xA9, 0x87, 0x66, 0x65, 0x66, 0x67,
+ 0x89, 0xAB, 0xDD, 0xED, 0xCB, 0xA9, 0x87, 0x76, 0x66, 0x77, 0x89, 0x9B,
+ 0xCC, 0xDE, 0xEC, 0xCB, 0xA9, 0x88, 0x77, 0x78, 0x89, 0x9A, 0xBC, 0xED,
+ 0xFF, 0xDD, 0xBA, 0xA9, 0x98, 0x88, 0x89, 0xAA, 0xBC, 0xDD, 0xDF, 0xFF,
+ 0xFD, 0xBB, 0xAA, 0xAA, 0xAA, 0xAB, 0xBC, 0xDD, 0xED, 0xFF, 0xFE, 0xFD,
+ 0xCB, 0xBB, 0xBB, 0xBC, 0xBC, 0xDD, 0xEF, 0xEF, 0xFF, 0xFF, 0xFE, 0xDC,
+ 0xCC, 0xCC, 0xCC, 0xDE, 0xDF, 0xFE, 0xDF, 0xFF, 0xFF, 0xFE, 0xDD, 0xDC,
+ 0xCD, 0xDD, 0xDE, 0xDE, 0xC0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xEE, 0xEE, 0xEE, 0xDE, 0xEE, 0xEE, 0xDD, 0xDE, 0xEE, 0xEE, 0xEE, 0xEE,
+ 0xED, 0xDD, 0xDD, 0xDE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE,
+ 0xEE, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDE, 0xEE, 0xEE, 0xEE, 0xEE,
+ 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE,
+ 0xEE, 0xEE, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0x4D, 0xDD,
+ 0xDD, 0xDD, 0xDD, 0xDE, 0xEE, 0xEE, 0xE3, 0xEE, 0xE4, 0xEE, 0xEE, 0xEE,
+ 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0x5E, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE,
+ 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0x3E, 0x4E, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE,
+ 0xEE, 0xEE, 0x44, 0x44, 0x4D, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD,
+ 0x44, 0x4D, 0xDD, 0xD4, 0x4D, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xD4, 0xD3,
+ 0x3D, 0x4D, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDE, 0xEE, 0xE4, 0xE4, 0xEE,
+ 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0x4E, 0xEE, 0x44, 0xEE,
+ 0xE4, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE,
+ 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE,
+ 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xE4, 0xEE, 0xEE, 0xEE, 0xEE,
+ 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE,
+ 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xED, 0xED, 0xEE, 0xEE, 0xEE,
+ 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0x4E, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE,
+ 0xED, 0xED, 0xED, 0xEE, 0xE0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xAD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDC, 0xFD, 0xFF, 0xFF, 0xFF, 0xDD, 0xFF,
+ 0xDF, 0xDD, 0xCC, 0xCC, 0xCC, 0xDF, 0xFF, 0xFF, 0xFF, 0xEF, 0xDD, 0xDC,
+ 0xCC, 0xBB, 0xBB, 0xBC, 0xCC, 0xDF, 0xFF, 0xFE, 0xFD, 0xEC, 0xBB, 0xAA,
+ 0x9A, 0xAA, 0xAB, 0xCD, 0xDF, 0xFF, 0xCD, 0xCD, 0xBA, 0xA9, 0x98, 0x88,
+ 0x99, 0x9A, 0xCD, 0xDF, 0xFD, 0xDC, 0xBA, 0xA9, 0x88, 0x77, 0x78, 0x89,
+ 0x9A, 0xBD, 0xFF, 0xCC, 0xCB, 0xA9, 0x87, 0x76, 0x66, 0x77, 0x89, 0x9A,
+ 0xDF, 0xFC, 0xDB, 0xB9, 0x87, 0x66, 0x65, 0x66, 0x67, 0x89, 0xAC, 0xDD,
+ 0xDD, 0xBA, 0x98, 0x76, 0x55, 0x55, 0x56, 0x78, 0x8A, 0xCD, 0xED, 0xCB,
+ 0xA8, 0x76, 0x65, 0x55, 0x55, 0x66, 0x78, 0x9B, 0xDE, 0xDC, 0xBA, 0x87,
+ 0x65, 0x55, 0x45, 0x55, 0x67, 0x8A, 0xBD, 0xCD, 0xCB, 0xA8, 0x76, 0x55,
+ 0x54, 0x55, 0x56, 0x78, 0xAB, 0xCD, 0xED, 0xBA, 0x98, 0x76, 0x55, 0x55,
+ 0x56, 0x78, 0x9A, 0xBC, 0xCD, 0xFB, 0xA9, 0x87, 0x66, 0x65, 0x66, 0x67,
+ 0x89, 0xAB, 0xCD, 0xFF, 0xDB, 0xA8, 0x87, 0x76, 0x66, 0x77, 0x89, 0xAB,
+ 0xCC, 0xDF, 0xFD, 0xCA, 0x98, 0x88, 0x77, 0x77, 0x89, 0x9A, 0xBC, 0xED,
+ 0xFF, 0xFD, 0xCB, 0xA9, 0x98, 0x88, 0x99, 0xAA, 0xBC, 0xDD, 0xDF, 0xFF,
+ 0xDC, 0xCB, 0xAA, 0xAA, 0x9A, 0xAB, 0xBC, 0xCE, 0xED, 0xFF, 0xFF, 0xFD,
+ 0xCC, 0xBB, 0xBC, 0xBB, 0xCC, 0xDD, 0xFF, 0xEF, 0xFF, 0xFF, 0xFF, 0xDC,
+ 0xCC, 0xCD, 0xDC, 0xDF, 0xFF, 0xEF, 0xDF, 0xFF, 0xFE, 0xFC, 0xEC, 0xCD,
+ 0xCC, 0xDD, 0xCD, 0xDD, 0xB0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xAC, 0xCB, 0xBB, 0xBB, 0xBA, 0xAB, 0xBB, 0xCC, 0xCC, 0xEF, 0xBC, 0xDD,
+ 0xCC, 0xCB, 0xBB, 0xBB, 0xBB, 0xBC, 0xCC, 0xEE, 0xFE, 0xCC, 0xCC, 0xBB,
+ 0xAA, 0xAA, 0xAA, 0xAA, 0xAB, 0xCC, 0xDE, 0xEC, 0xCC, 0xBA, 0xAA, 0x99,
+ 0x98, 0x99, 0x9A, 0xAB, 0xBC, 0xDD, 0xBC, 0xBA, 0xA9, 0x98, 0x88, 0x88,
+ 0x88, 0x99, 0xAB, 0xBC, 0xDB, 0xBB, 0xA9, 0x98, 0x87, 0x77, 0x77, 0x78,
+ 0x99, 0xAB, 0xCC, 0xBB, 0xAA, 0x98, 0x77, 0x76, 0x66, 0x77, 0x78, 0x9A,
+ 0xAC, 0xCB, 0xBA, 0x98, 0x87, 0x66, 0x66, 0x66, 0x67, 0x78, 0x9A, 0xBB,
+ 0xBB, 0xA9, 0x87, 0x76, 0x65, 0x55, 0x66, 0x77, 0x89, 0xAB, 0xBB, 0xBA,
+ 0x98, 0x76, 0x65, 0x55, 0x55, 0x66, 0x78, 0x9A, 0xAB, 0xBB, 0x99, 0x87,
+ 0x66, 0x55, 0x55, 0x56, 0x67, 0x89, 0xAA, 0xAB, 0xBA, 0x98, 0x76, 0x65,
+ 0x55, 0x55, 0x66, 0x78, 0x9A, 0xBB, 0xBB, 0xA9, 0x87, 0x76, 0x65, 0x55,
+ 0x66, 0x77, 0x89, 0xAB, 0xBB, 0xBA, 0x98, 0x87, 0x66, 0x66, 0x66, 0x67,
+ 0x88, 0x9A, 0xBB, 0xCC, 0xAA, 0x98, 0x77, 0x76, 0x66, 0x77, 0x78, 0x99,
+ 0xAB, 0xBC, 0xCB, 0xA9, 0x98, 0x87, 0x77, 0x77, 0x88, 0x99, 0xAB, 0xBB,
+ 0xCC, 0xCB, 0xA9, 0x98, 0x88, 0x88, 0x88, 0x99, 0xAA, 0xBC, 0xBD, 0xDD,
+ 0xBB, 0xAA, 0x99, 0x99, 0x99, 0x99, 0xAA, 0xBB, 0xCC, 0xEE, 0xDC, 0xCB,
+ 0xBA, 0xAA, 0xAA, 0xAA, 0xAB, 0xBC, 0xCD, 0xCF, 0xFE, 0xDD, 0xCC, 0xBB,
+ 0xBA, 0xBB, 0xBB, 0xBC, 0xCD, 0xDC, 0xCE, 0xDD, 0xDC, 0xCB, 0xBB, 0xBB,
+ 0xBB, 0xBB, 0xBB, 0xCC, 0xA0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0x9B, 0xBB, 0xBA, 0xAA, 0xAA, 0xAA, 0xAB, 0xBB, 0xCC, 0xDD, 0xBC, 0xDC,
+ 0xCC, 0xBB, 0xBA, 0xAA, 0xAA, 0xAB, 0xCB, 0xCD, 0xEE, 0xBD, 0xCC, 0xBB,
+ 0xAA, 0x99, 0x99, 0x9A, 0xAA, 0xBC, 0xCD, 0xDB, 0xCC, 0xAA, 0xA9, 0x99,
+ 0x88, 0x89, 0x99, 0x9A, 0xBC, 0xDC, 0xBC, 0xBA, 0x99, 0x98, 0x88, 0x77,
+ 0x88, 0x89, 0x9A, 0xBC, 0xCB, 0xBA, 0xA9, 0x88, 0x87, 0x77, 0x77, 0x78,
+ 0x89, 0x9A, 0xBB, 0xAB, 0xA9, 0x88, 0x77, 0x76, 0x66, 0x67, 0x78, 0x89,
+ 0xAB, 0xBA, 0xAA, 0x98, 0x77, 0x66, 0x66, 0x66, 0x67, 0x78, 0x9A, 0xBA,
+ 0xAA, 0x99, 0x87, 0x76, 0x66, 0x66, 0x66, 0x67, 0x89, 0xAA, 0xAA, 0xA9,
+ 0x88, 0x76, 0x66, 0x55, 0x56, 0x66, 0x78, 0x89, 0xAA, 0xAA, 0x98, 0x77,
+ 0x66, 0x55, 0x55, 0x66, 0x67, 0x88, 0x9A, 0xAA, 0xA9, 0x88, 0x76, 0x66,
+ 0x55, 0x56, 0x66, 0x78, 0x89, 0xAA, 0xBA, 0x98, 0x87, 0x66, 0x66, 0x66,
+ 0x66, 0x77, 0x88, 0x9A, 0xAB, 0xBA, 0x98, 0x77, 0x66, 0x66, 0x66, 0x67,
+ 0x88, 0x9A, 0xAA, 0xBA, 0xA9, 0x88, 0x77, 0x66, 0x66, 0x77, 0x78, 0x99,
+ 0xAB, 0xAB, 0xBB, 0xA9, 0x88, 0x77, 0x77, 0x77, 0x78, 0x89, 0xAB, 0xBB,
+ 0xCC, 0xBA, 0xA9, 0x88, 0x88, 0x88, 0x88, 0x89, 0x9A, 0xBC, 0xBC, 0xCB,
+ 0xBA, 0x99, 0x99, 0x88, 0x89, 0x99, 0xAA, 0xBB, 0xCB, 0xDD, 0xDC, 0xBA,
+ 0xA9, 0x99, 0x99, 0xAA, 0xAA, 0xBB, 0xCD, 0xBE, 0xEE, 0xCC, 0xCB, 0xBA,
+ 0xAA, 0xAA, 0xBB, 0xBC, 0xCD, 0xDB, 0xCD, 0xEC, 0xBB, 0xBB, 0xBA, 0xAA,
+ 0xAA, 0xAB, 0xBB, 0xBC, 0x90, 0x00, 0x00, 0x00,
+ },
+ {
+ 0x9B, 0xBA, 0xAA, 0xAA, 0x99, 0x99, 0xAA, 0xAA, 0xBB, 0xCC, 0xBB, 0xCB,
+ 0xBB, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xBB, 0xCC, 0xDC, 0xBC, 0xBB, 0xAA,
+ 0x99, 0x99, 0x99, 0x99, 0xAA, 0xAB, 0xCC, 0xCA, 0xBB, 0xAA, 0x99, 0x98,
+ 0x88, 0x88, 0x89, 0x9A, 0xAB, 0xCB, 0xAB, 0xAA, 0x99, 0x88, 0x87, 0x77,
+ 0x88, 0x88, 0x9A, 0xAB, 0xBA, 0xAA, 0x99, 0x88, 0x77, 0x77, 0x77, 0x78,
+ 0x89, 0x9A, 0xAA, 0xAA, 0xA9, 0x88, 0x77, 0x76, 0x66, 0x77, 0x77, 0x89,
+ 0x9A, 0xAA, 0xA9, 0x98, 0x77, 0x76, 0x66, 0x66, 0x67, 0x78, 0x89, 0xAA,
+ 0x9A, 0x98, 0x87, 0x76, 0x66, 0x66, 0x66, 0x77, 0x88, 0x9A, 0x99, 0xA9,
+ 0x88, 0x76, 0x66, 0x66, 0x66, 0x66, 0x77, 0x89, 0xA9, 0x9A, 0x98, 0x77,
+ 0x66, 0x65, 0x56, 0x66, 0x67, 0x78, 0x9A, 0x99, 0xA9, 0x87, 0x76, 0x66,
+ 0x65, 0x66, 0x66, 0x77, 0x89, 0xA9, 0xAA, 0x98, 0x87, 0x66, 0x66, 0x66,
+ 0x66, 0x77, 0x88, 0x9A, 0x9A, 0xA9, 0x88, 0x77, 0x66, 0x66, 0x66, 0x77,
+ 0x78, 0x99, 0xAA, 0xAA, 0x99, 0x88, 0x77, 0x66, 0x66, 0x77, 0x78, 0x89,
+ 0x9A, 0xAA, 0xBA, 0x99, 0x88, 0x77, 0x77, 0x77, 0x78, 0x89, 0x9A, 0xAA,
+ 0xBB, 0xAA, 0x99, 0x88, 0x87, 0x78, 0x88, 0x89, 0x9A, 0xAB, 0xAB, 0xCB,
+ 0xAA, 0x99, 0x88, 0x88, 0x88, 0x89, 0x9A, 0xAB, 0xBA, 0xCD, 0xCB, 0xAA,
+ 0xA9, 0x99, 0x99, 0x99, 0x9A, 0xAB, 0xBC, 0xBD, 0xDC, 0xCB, 0xBA, 0xAA,
+ 0xAA, 0xAA, 0xAA, 0xBB, 0xBC, 0xCB, 0xCC, 0xCB, 0xBA, 0xAA, 0x99, 0x99,
+ 0x99, 0xAA, 0xAA, 0xBB, 0x90, 0x00, 0x00, 0x00,
+ },
+ {
+ 0x9B, 0xBB, 0xBA, 0xAA, 0xAA, 0xAA, 0xAA, 0xBB, 0xBC, 0xDD, 0xCC, 0xCB,
+ 0xBC, 0xBA, 0xAA, 0xAA, 0xAA, 0xAB, 0xAC, 0xCD, 0xDE, 0xBD, 0xCB, 0xAA,
+ 0x99, 0x99, 0x99, 0x99, 0xAA, 0xBB, 0xCC, 0xCA, 0xBC, 0xBA, 0x99, 0x98,
+ 0x88, 0x89, 0x89, 0x9A, 0xBB, 0xCC, 0xAB, 0xAA, 0x99, 0x88, 0x87, 0x77,
+ 0x88, 0x89, 0x9A, 0xBB, 0xBA, 0xBA, 0x99, 0x88, 0x77, 0x77, 0x77, 0x78,
+ 0x89, 0xAA, 0xCC, 0xAA, 0xA9, 0x88, 0x87, 0x76, 0x66, 0x77, 0x78, 0x89,
+ 0xAB, 0xBA, 0xB9, 0x98, 0x77, 0x66, 0x66, 0x66, 0x77, 0x78, 0x99, 0xAA,
+ 0xAA, 0x99, 0x87, 0x76, 0x66, 0x66, 0x66, 0x67, 0x88, 0x9A, 0xAA, 0xA9,
+ 0x87, 0x76, 0x66, 0x65, 0x56, 0x66, 0x78, 0x89, 0xAA, 0xAA, 0x98, 0x87,
+ 0x66, 0x65, 0x55, 0x66, 0x67, 0x88, 0x9A, 0xAA, 0xA9, 0x88, 0x76, 0x66,
+ 0x55, 0x56, 0x66, 0x78, 0x89, 0xAA, 0xAA, 0x99, 0x87, 0x76, 0x66, 0x66,
+ 0x66, 0x77, 0x88, 0x9A, 0xAA, 0xA9, 0x98, 0x77, 0x66, 0x66, 0x66, 0x67,
+ 0x78, 0x9A, 0xBA, 0xAB, 0xA9, 0x87, 0x77, 0x66, 0x66, 0x77, 0x78, 0x99,
+ 0xAA, 0xBB, 0xBA, 0x99, 0x88, 0x77, 0x77, 0x77, 0x78, 0x89, 0xAB, 0xBA,
+ 0xBB, 0xAA, 0x99, 0x88, 0x87, 0x88, 0x88, 0x89, 0x9A, 0xAB, 0xBD, 0xBB,
+ 0xBA, 0xA9, 0x98, 0x88, 0x88, 0x99, 0x9A, 0xAB, 0xBB, 0xDD, 0xCB, 0xAB,
+ 0xA9, 0x99, 0x99, 0x9A, 0xAA, 0xBC, 0xBC, 0xBD, 0xDC, 0xBB, 0xBB, 0xAA,
+ 0xA9, 0xAA, 0xAA, 0xBB, 0xDC, 0xDC, 0xBE, 0xDC, 0xBB, 0xAA, 0xAA, 0xAA,
+ 0xAA, 0xAA, 0xAB, 0xBB, 0x90, 0x00, 0x00, 0x00,
+ },
+ {
+ 0x9C, 0xBB, 0xBB, 0xAA, 0xAA, 0xAA, 0xAB, 0xBB, 0xCC, 0xDE, 0xCB, 0xEC,
+ 0xCC, 0xBB, 0xAA, 0xAA, 0xAB, 0xBB, 0xBC, 0xDD, 0xEE, 0xBD, 0xCB, 0xBA,
+ 0xAA, 0x99, 0x99, 0xAA, 0xAB, 0xBC, 0xCE, 0xDB, 0xCB, 0xBA, 0xA9, 0x99,
+ 0x88, 0x89, 0x99, 0xAA, 0xBC, 0xDC, 0xBC, 0xBA, 0xA9, 0x98, 0x88, 0x88,
+ 0x88, 0x99, 0xAA, 0xBC, 0xCB, 0xBB, 0xA9, 0x88, 0x87, 0x77, 0x77, 0x78,
+ 0x89, 0xAB, 0xBC, 0xAB, 0xA9, 0x98, 0x77, 0x76, 0x66, 0x77, 0x78, 0x99,
+ 0xAB, 0xBA, 0xBA, 0x98, 0x87, 0x76, 0x66, 0x66, 0x67, 0x78, 0x9A, 0xBB,
+ 0xAA, 0x99, 0x87, 0x76, 0x66, 0x55, 0x66, 0x67, 0x89, 0x9A, 0xAA, 0xA9,
+ 0x88, 0x76, 0x66, 0x55, 0x55, 0x66, 0x78, 0x99, 0xAA, 0xAA, 0x98, 0x87,
+ 0x66, 0x55, 0x55, 0x56, 0x67, 0x88, 0x9A, 0xAA, 0xA9, 0x88, 0x76, 0x65,
+ 0x55, 0x56, 0x66, 0x78, 0x99, 0xAA, 0xAB, 0x99, 0x87, 0x76, 0x66, 0x56,
+ 0x66, 0x77, 0x89, 0x9A, 0xAB, 0xBA, 0x98, 0x77, 0x66, 0x66, 0x66, 0x77,
+ 0x88, 0x9A, 0xAA, 0xBB, 0xA9, 0x98, 0x77, 0x76, 0x66, 0x77, 0x78, 0x99,
+ 0xAB, 0xBB, 0xCB, 0xA9, 0x88, 0x77, 0x77, 0x77, 0x88, 0x99, 0xAA, 0xBB,
+ 0xCC, 0xBA, 0xA9, 0x98, 0x88, 0x88, 0x88, 0x99, 0xAA, 0xBC, 0xBC, 0xDC,
+ 0xBA, 0xA9, 0x99, 0x88, 0x99, 0x99, 0xAA, 0xBB, 0xCB, 0xCD, 0xDC, 0xBB,
+ 0xAA, 0x99, 0x99, 0xAA, 0xAA, 0xBB, 0xCD, 0xBD, 0xED, 0xCC, 0xBB, 0xBB,
+ 0xAA, 0xAA, 0xAB, 0xBC, 0xCC, 0xDC, 0xBD, 0xDC, 0xCB, 0xBB, 0xAA, 0xAA,
+ 0xAA, 0xBB, 0xBB, 0xBC, 0x90, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xBD, 0xED, 0xDD, 0xDD, 0xDD, 0xDE, 0xEE, 0xFF, 0xFF, 0xEF, 0xBF, 0xFF,
+ 0xFD, 0xDD, 0xDD, 0xDD, 0xEE, 0xFF, 0xFF, 0xFF, 0xFF, 0xEF, 0xED, 0xDC,
+ 0xCC, 0xCC, 0xCC, 0xDD, 0xFF, 0xFF, 0xFF, 0xFD, 0xFE, 0xDC, 0xCB, 0xBB,
+ 0xBB, 0xBB, 0xCC, 0xEF, 0xFF, 0xFF, 0xDE, 0xDC, 0xBB, 0xAA, 0x99, 0x99,
+ 0xAA, 0xBC, 0xDF, 0xFF, 0xED, 0xEC, 0xCB, 0xA9, 0x98, 0x88, 0x88, 0x9A,
+ 0xBD, 0xEF, 0xFF, 0xDD, 0xCB, 0xA9, 0x88, 0x76, 0x67, 0x78, 0x9A, 0xCD,
+ 0xEF, 0xFD, 0xDC, 0xBA, 0x98, 0x76, 0x55, 0x56, 0x78, 0x9B, 0xCD, 0xEE,
+ 0xDE, 0xCB, 0x98, 0x76, 0x54, 0x44, 0x56, 0x79, 0xAC, 0xDE, 0xED, 0xDC,
+ 0xB9, 0x87, 0x54, 0x44, 0x45, 0x67, 0x9A, 0xCD, 0xED, 0xDE, 0xCB, 0x98,
+ 0x65, 0x44, 0x44, 0x56, 0x78, 0xAB, 0xDE, 0xDE, 0xFC, 0xB9, 0x87, 0x55,
+ 0x44, 0x45, 0x67, 0x9A, 0xBC, 0xED, 0xEE, 0xDB, 0xA8, 0x76, 0x55, 0x55,
+ 0x67, 0x89, 0xAB, 0xCE, 0xEF, 0xFD, 0xCA, 0x98, 0x76, 0x66, 0x67, 0x78,
+ 0x9B, 0xBD, 0xED, 0xFF, 0xFD, 0xBA, 0x98, 0x87, 0x77, 0x88, 0x9A, 0xBC,
+ 0xDE, 0xDF, 0xFE, 0xDC, 0xBA, 0x99, 0x99, 0x99, 0x9A, 0xBB, 0xCD, 0xED,
+ 0xFF, 0xFF, 0xEC, 0xBB, 0xAA, 0xAA, 0xAA, 0xBB, 0xCD, 0xFE, 0xEF, 0xFF,
+ 0xFF, 0xEC, 0xDC, 0xBB, 0xBB, 0xCC, 0xCC, 0xDE, 0xFD, 0xFF, 0xFF, 0xFF,
+ 0xFE, 0xED, 0xDC, 0xCD, 0xDD, 0xDE, 0xEF, 0xEF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xEE, 0xFE, 0xDE, 0xEE, 0xFF, 0xFF, 0xCF, 0xFF, 0xFF, 0xEE, 0xDD, 0xDE,
+ 0xFE, 0xDD, 0xDE, 0xEE, 0xB0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0x88, 0x88, 0x88, 0x78, 0x88, 0x88, 0x87, 0x78, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x87, 0x77, 0x78, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x77, 0x77, 0x77, 0x77, 0x78, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x87, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x78, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x78, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x80, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xBF, 0xDD, 0xDC, 0xCC, 0xBC, 0xCD, 0xDD, 0xDF, 0xFF, 0xFF, 0xCD, 0xDF,
+ 0xDC, 0xCB, 0xCB, 0xCB, 0xCC, 0xCD, 0xFF, 0xFF, 0xFF, 0xDE, 0xDC, 0xCC,
+ 0xBB, 0xBA, 0xAB, 0xBB, 0xCD, 0xFF, 0xFF, 0xFC, 0xDD, 0xBB, 0xAA, 0x99,
+ 0x99, 0x9A, 0xAB, 0xCD, 0xDF, 0xFF, 0xDC, 0xBB, 0xA9, 0x98, 0x88, 0x88,
+ 0x89, 0xAB, 0xBC, 0xDF, 0xFC, 0xCC, 0xA9, 0x98, 0x87, 0x77, 0x77, 0x89,
+ 0xAB, 0xBD, 0xFF, 0xCC, 0xBA, 0x98, 0x77, 0x66, 0x66, 0x77, 0x89, 0xAB,
+ 0xDD, 0xFC, 0xCA, 0x99, 0x87, 0x66, 0x55, 0x56, 0x67, 0x89, 0xAB, 0xFF,
+ 0xCC, 0xA9, 0x87, 0x66, 0x55, 0x55, 0x56, 0x78, 0x9A, 0xBE, 0xEC, 0xBA,
+ 0x98, 0x76, 0x55, 0x54, 0x55, 0x67, 0x89, 0xAB, 0xCD, 0xCC, 0xA9, 0x87,
+ 0x65, 0x54, 0x45, 0x56, 0x78, 0x9A, 0xBC, 0xDD, 0xCB, 0x98, 0x76, 0x55,
+ 0x55, 0x55, 0x67, 0x78, 0xAB, 0xCC, 0xCC, 0xBA, 0x97, 0x76, 0x55, 0x55,
+ 0x66, 0x78, 0x9A, 0xBC, 0xDF, 0xDB, 0xA9, 0x87, 0x76, 0x66, 0x66, 0x77,
+ 0x89, 0xAB, 0xCD, 0xDD, 0xDB, 0xA8, 0x87, 0x77, 0x67, 0x77, 0x89, 0xAA,
+ 0xBD, 0xFF, 0xDD, 0xCA, 0xA9, 0x88, 0x77, 0x88, 0x89, 0x9A, 0xBC, 0xDC,
+ 0xFF, 0xFD, 0xCB, 0xAA, 0x99, 0x89, 0x99, 0xAA, 0xBC, 0xCF, 0xCF, 0xFF,
+ 0xFD, 0xCB, 0xBA, 0xAA, 0xAA, 0xAB, 0xBC, 0xDC, 0xFF, 0xFF, 0xFF, 0xFD,
+ 0xCB, 0xBB, 0xBB, 0xBB, 0xCC, 0xCD, 0xDF, 0xFF, 0xFF, 0xFF, 0xFE, 0xDC,
+ 0xCC, 0xCC, 0xDD, 0xCC, 0xFE, 0xDF, 0xDF, 0xFF, 0xFF, 0xDD, 0xCC, 0xCD,
+ 0xCC, 0xCF, 0xDD, 0xDD, 0xC0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0x88, 0x88, 0x88, 0x78, 0x88, 0x88, 0x87, 0x78, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x87, 0x77, 0x78, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x77, 0x77, 0x77, 0x77, 0x78, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x87, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x78, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x78, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x80, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xBF, 0xDD, 0xED, 0xED, 0xDD, 0xDE, 0xEE, 0xFF, 0xFF, 0xFF, 0xCE, 0xFF,
+ 0xFF, 0xFE, 0xDE, 0xEE, 0xEF, 0xFF, 0xFF, 0xFF, 0xFF, 0xEF, 0xFE, 0xDD,
+ 0xCC, 0xCC, 0xCC, 0xDD, 0xDE, 0xFF, 0xFF, 0xFE, 0xFE, 0xED, 0xCC, 0xBB,
+ 0xBB, 0xBB, 0xCD, 0xEF, 0xFF, 0xFF, 0xDE, 0xDD, 0xBB, 0xAA, 0x99, 0x99,
+ 0xAB, 0xCD, 0xED, 0xFF, 0xFE, 0xFD, 0xCB, 0xA9, 0x98, 0x88, 0x88, 0x9A,
+ 0xBD, 0xEF, 0xFF, 0xDF, 0xDC, 0xB9, 0x87, 0x76, 0x67, 0x78, 0x9A, 0xCE,
+ 0xFF, 0xFE, 0xDD, 0xBA, 0x97, 0x76, 0x55, 0x56, 0x78, 0x9B, 0xCE, 0xFF,
+ 0xED, 0xDB, 0xA8, 0x76, 0x54, 0x44, 0x56, 0x79, 0xAC, 0xEF, 0xEE, 0xEC,
+ 0xB9, 0x86, 0x54, 0x44, 0x45, 0x67, 0x9A, 0xCD, 0xFE, 0xEE, 0xCB, 0x98,
+ 0x65, 0x44, 0x44, 0x56, 0x79, 0xAC, 0xEF, 0xFD, 0xEC, 0xB9, 0x87, 0x55,
+ 0x44, 0x45, 0x67, 0x9A, 0xCD, 0xFD, 0xEF, 0xDB, 0xA8, 0x76, 0x55, 0x55,
+ 0x67, 0x89, 0xAC, 0xDF, 0xEE, 0xFD, 0xCB, 0x98, 0x76, 0x66, 0x67, 0x78,
+ 0xAB, 0xCD, 0xEE, 0xFF, 0xFD, 0xBA, 0x98, 0x87, 0x77, 0x88, 0x9A, 0xBC,
+ 0xDF, 0xEF, 0xFF, 0xED, 0xBA, 0xA9, 0x99, 0x99, 0xAA, 0xBC, 0xDD, 0xEE,
+ 0xFF, 0xFF, 0xDC, 0xCB, 0xAA, 0xAA, 0xAB, 0xBC, 0xCD, 0xEE, 0xEF, 0xFF,
+ 0xFF, 0xED, 0xCC, 0xCC, 0xCC, 0xCC, 0xCD, 0xEF, 0xFE, 0xFF, 0xFF, 0xFF,
+ 0xED, 0xDD, 0xDD, 0xDD, 0xDD, 0xEF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xEE, 0xFE, 0xEF, 0xFF, 0xFF, 0xFF, 0xBF, 0xEF, 0xFF, 0xEE, 0xED, 0xEE,
+ 0xED, 0xFE, 0xFE, 0xEE, 0xB0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xAC, 0xCB, 0xBB, 0xBB, 0xBB, 0xAB, 0xBB, 0xCC, 0xCD, 0xDE, 0xBC, 0xDD,
+ 0xCC, 0xBB, 0xBB, 0xBB, 0xBB, 0xBC, 0xCD, 0xDF, 0xFD, 0xBC, 0xCB, 0xBA,
+ 0xAA, 0xAA, 0xAA, 0xAA, 0xBB, 0xCD, 0xEE, 0xEB, 0xCB, 0xBA, 0xA9, 0x99,
+ 0x99, 0x99, 0xAA, 0xAB, 0xCD, 0xDD, 0xBC, 0xBA, 0x99, 0x88, 0x88, 0x88,
+ 0x89, 0x9A, 0xAB, 0xCD, 0xCB, 0xBA, 0xA9, 0x88, 0x77, 0x77, 0x77, 0x88,
+ 0x9A, 0xBC, 0xCC, 0xBB, 0xA9, 0x98, 0x77, 0x66, 0x66, 0x77, 0x88, 0x9A,
+ 0xBC, 0xCB, 0xBA, 0x98, 0x77, 0x66, 0x65, 0x66, 0x77, 0x89, 0xAB, 0xBB,
+ 0xBB, 0xA9, 0x87, 0x66, 0x55, 0x55, 0x66, 0x78, 0x99, 0xAB, 0xBA, 0xBA,
+ 0x98, 0x76, 0x65, 0x54, 0x55, 0x67, 0x78, 0x9A, 0xBB, 0xBB, 0xA9, 0x87,
+ 0x66, 0x54, 0x45, 0x56, 0x77, 0x89, 0xAB, 0xBB, 0xBA, 0x98, 0x76, 0x65,
+ 0x55, 0x55, 0x67, 0x78, 0x9A, 0xBB, 0xBB, 0xA9, 0x87, 0x76, 0x65, 0x55,
+ 0x66, 0x78, 0x89, 0xAB, 0xBB, 0xBA, 0x99, 0x87, 0x76, 0x66, 0x66, 0x77,
+ 0x89, 0xAA, 0xBB, 0xCC, 0xBA, 0x98, 0x87, 0x77, 0x77, 0x77, 0x88, 0x9A,
+ 0xAB, 0xBC, 0xCB, 0xBA, 0x99, 0x88, 0x87, 0x78, 0x88, 0x9A, 0xAB, 0xCB,
+ 0xCD, 0xCB, 0xBA, 0x99, 0x98, 0x88, 0x99, 0x9A, 0xAB, 0xBC, 0xCD, 0xDD,
+ 0xCB, 0xBA, 0xAA, 0x99, 0x99, 0xAA, 0xAB, 0xBC, 0xDC, 0xDE, 0xDD, 0xCB,
+ 0xBB, 0xBA, 0xAA, 0xAA, 0xBB, 0xCC, 0xDD, 0xCE, 0xEE, 0xDD, 0xCC, 0xCB,
+ 0xBB, 0xBB, 0xBB, 0xCC, 0xDD, 0xEC, 0xBD, 0xDD, 0xCC, 0xCC, 0xBB, 0xBB,
+ 0xBB, 0xBB, 0xCC, 0xCC, 0xA0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0x9B, 0xBA, 0xA9, 0x99, 0x99, 0x99, 0x9A, 0xAB, 0xBC, 0xCC, 0xBB, 0xCC,
+ 0xBB, 0xAA, 0xAA, 0x99, 0xA9, 0xAA, 0xBB, 0xBD, 0xDC, 0xAB, 0xBA, 0xA9,
+ 0x99, 0x99, 0x99, 0x99, 0x9A, 0xBB, 0xCD, 0xCA, 0xBA, 0xA9, 0x99, 0x88,
+ 0x88, 0x88, 0x89, 0x9A, 0xBB, 0xCB, 0xAB, 0xA9, 0x98, 0x88, 0x88, 0x77,
+ 0x88, 0x89, 0x9A, 0xBB, 0xB9, 0xA9, 0x98, 0x87, 0x77, 0x77, 0x77, 0x78,
+ 0x89, 0xAA, 0xBB, 0x9A, 0x98, 0x87, 0x77, 0x66, 0x66, 0x77, 0x78, 0x89,
+ 0xAA, 0xA9, 0xA9, 0x88, 0x77, 0x66, 0x66, 0x66, 0x67, 0x78, 0x99, 0xAA,
+ 0x99, 0x98, 0x77, 0x66, 0x66, 0x66, 0x66, 0x77, 0x88, 0x9A, 0xA9, 0x99,
+ 0x87, 0x76, 0x66, 0x55, 0x56, 0x67, 0x78, 0x89, 0xAA, 0x9A, 0x98, 0x77,
+ 0x66, 0x65, 0x55, 0x66, 0x77, 0x88, 0x9A, 0x99, 0xA9, 0x88, 0x76, 0x66,
+ 0x65, 0x66, 0x67, 0x78, 0x89, 0xA9, 0x99, 0x98, 0x87, 0x76, 0x66, 0x66,
+ 0x66, 0x77, 0x88, 0x9A, 0x9A, 0xA9, 0x98, 0x77, 0x66, 0x66, 0x66, 0x77,
+ 0x88, 0x99, 0xAA, 0xAA, 0xA9, 0x88, 0x77, 0x77, 0x77, 0x77, 0x78, 0x89,
+ 0xAA, 0xAA, 0xBA, 0x99, 0x88, 0x77, 0x77, 0x77, 0x88, 0x89, 0x9A, 0xAA,
+ 0xBB, 0xBA, 0x99, 0x88, 0x88, 0x88, 0x88, 0x89, 0x9A, 0xAB, 0xBB, 0xCB,
+ 0xAA, 0xA9, 0x98, 0x88, 0x89, 0x99, 0x9A, 0xAB, 0xBB, 0xCC, 0xBB, 0xAA,
+ 0xA9, 0x99, 0x99, 0x99, 0x9A, 0xAB, 0xBC, 0xBD, 0xDD, 0xCB, 0xBB, 0xAA,
+ 0xAA, 0xAA, 0xAA, 0xBB, 0xBC, 0xDB, 0xBD, 0xCB, 0xBA, 0xAA, 0xAA, 0xAA,
+ 0xAA, 0xAA, 0xAB, 0xBB, 0xA0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0x9B, 0xAA, 0xA9, 0x99, 0x99, 0x99, 0x9A, 0xAA, 0xBB, 0xCC, 0xBB, 0xCB,
+ 0xBA, 0xAA, 0xA9, 0x99, 0x9A, 0xAA, 0xAB, 0xCC, 0xDC, 0xAB, 0xAA, 0xA9,
+ 0x99, 0x99, 0x99, 0x99, 0x9A, 0xAB, 0xBC, 0xCA, 0xBA, 0x99, 0x98, 0x88,
+ 0x88, 0x88, 0x89, 0x9A, 0xAB, 0xCB, 0xAA, 0xA9, 0x88, 0x88, 0x77, 0x77,
+ 0x78, 0x89, 0x9A, 0xAB, 0xB9, 0xA9, 0x98, 0x87, 0x77, 0x77, 0x77, 0x78,
+ 0x89, 0x9A, 0xBA, 0x9A, 0x98, 0x87, 0x77, 0x66, 0x66, 0x77, 0x78, 0x89,
+ 0xAA, 0xA9, 0x99, 0x87, 0x77, 0x66, 0x66, 0x66, 0x67, 0x78, 0x89, 0xAA,
+ 0x99, 0x98, 0x77, 0x66, 0x66, 0x66, 0x66, 0x77, 0x88, 0x9A, 0xA9, 0x99,
+ 0x87, 0x76, 0x66, 0x66, 0x66, 0x66, 0x78, 0x89, 0xAA, 0x99, 0x98, 0x77,
+ 0x66, 0x65, 0x56, 0x66, 0x67, 0x88, 0x9A, 0x99, 0x99, 0x87, 0x76, 0x66,
+ 0x66, 0x66, 0x67, 0x78, 0x89, 0xA9, 0x9A, 0x98, 0x77, 0x76, 0x66, 0x66,
+ 0x66, 0x77, 0x88, 0x9A, 0xAA, 0xA9, 0x88, 0x77, 0x76, 0x66, 0x66, 0x77,
+ 0x78, 0x89, 0xAA, 0xAA, 0x99, 0x88, 0x77, 0x77, 0x67, 0x77, 0x78, 0x89,
+ 0x9A, 0xAA, 0xAA, 0x99, 0x88, 0x77, 0x77, 0x77, 0x78, 0x89, 0x9A, 0xAA,
+ 0xBB, 0xAA, 0x99, 0x88, 0x88, 0x88, 0x88, 0x88, 0x99, 0xAB, 0xAB, 0xBB,
+ 0xAA, 0x99, 0x98, 0x88, 0x88, 0x99, 0x99, 0xAA, 0xBB, 0xCC, 0xCB, 0xBA,
+ 0xA9, 0x99, 0x99, 0x99, 0x9A, 0xAB, 0xBB, 0xBD, 0xDC, 0xCB, 0xBB, 0xAA,
+ 0xAA, 0xAA, 0xAA, 0xBB, 0xBC, 0xCB, 0xCD, 0xCB, 0xBB, 0xAA, 0xAA, 0x99,
+ 0xAA, 0xAA, 0xAB, 0xBB, 0xA0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0x9B, 0xBA, 0xAA, 0xA9, 0xAA, 0xAA, 0xAB, 0xBB, 0xBC, 0xCD, 0xAB, 0xCC,
+ 0xBB, 0xBB, 0xAA, 0xAA, 0xBA, 0xBC, 0xCD, 0xED, 0xEC, 0xBC, 0xBB, 0xBA,
+ 0xA9, 0xA9, 0xA9, 0xAA, 0xAB, 0xBC, 0xDE, 0xDB, 0xBB, 0xBA, 0x99, 0x99,
+ 0x99, 0x99, 0x9A, 0xAB, 0xBC, 0xDC, 0xAB, 0xAA, 0x99, 0x88, 0x88, 0x88,
+ 0x88, 0x99, 0xAB, 0xCC, 0xBA, 0xBA, 0x99, 0x88, 0x87, 0x77, 0x77, 0x78,
+ 0x89, 0xAB, 0xCC, 0xAA, 0xA9, 0x88, 0x77, 0x66, 0x66, 0x77, 0x78, 0x9A,
+ 0xBB, 0xBA, 0xAA, 0x98, 0x77, 0x66, 0x66, 0x66, 0x67, 0x89, 0x9A, 0xBA,
+ 0xAA, 0x99, 0x87, 0x66, 0x55, 0x55, 0x66, 0x77, 0x89, 0xAB, 0xAA, 0xAA,
+ 0x98, 0x76, 0x65, 0x55, 0x55, 0x67, 0x78, 0x9A, 0xBA, 0xAA, 0x99, 0x87,
+ 0x66, 0x55, 0x55, 0x56, 0x67, 0x89, 0xAA, 0xBA, 0xA9, 0x98, 0x76, 0x65,
+ 0x55, 0x56, 0x67, 0x78, 0x9A, 0xBA, 0xAB, 0xA9, 0x87, 0x76, 0x65, 0x55,
+ 0x66, 0x78, 0x89, 0xAA, 0xAB, 0xBA, 0x98, 0x87, 0x66, 0x66, 0x66, 0x77,
+ 0x89, 0x9A, 0xAA, 0xBB, 0xA9, 0x98, 0x87, 0x77, 0x67, 0x77, 0x88, 0x9A,
+ 0xAB, 0xAC, 0xCB, 0xAA, 0x98, 0x87, 0x77, 0x78, 0x89, 0x99, 0xAA, 0xBA,
+ 0xCC, 0xCB, 0xA9, 0x99, 0x88, 0x88, 0x89, 0x99, 0xAA, 0xBB, 0xAC, 0xCC,
+ 0xBB, 0xAA, 0x99, 0x99, 0x99, 0x9A, 0xAB, 0xBB, 0xCB, 0xCE, 0xDC, 0xCB,
+ 0xBA, 0xAA, 0xAA, 0xAA, 0xAA, 0xBB, 0xCC, 0xBE, 0xED, 0xDC, 0xCC, 0xBB,
+ 0xBB, 0xBB, 0xAA, 0xBC, 0xCC, 0xDB, 0xAD, 0xDD, 0xBB, 0xBB, 0xBB, 0xBA,
+ 0xAA, 0xBB, 0xBB, 0xBC, 0x90, 0x00, 0x00, 0x00,
+ },
+ {
+ 0x9B, 0xBB, 0xAA, 0xAA, 0xAA, 0xAA, 0xBB, 0xBC, 0xCD, 0xCD, 0xAB, 0xCC,
+ 0xCB, 0xBB, 0xAA, 0xAA, 0xBB, 0xBC, 0xCD, 0xDE, 0xFD, 0xBC, 0xBB, 0xAA,
+ 0xAA, 0x9A, 0xAA, 0xAA, 0xBB, 0xCD, 0xDE, 0xDB, 0xBB, 0xAA, 0x99, 0x99,
+ 0x89, 0x99, 0x9A, 0xAB, 0xCD, 0xDC, 0xBB, 0xAA, 0x99, 0x88, 0x88, 0x88,
+ 0x89, 0x9A, 0xBB, 0xCC, 0xCA, 0xBA, 0x99, 0x88, 0x77, 0x77, 0x77, 0x88,
+ 0x9A, 0xBB, 0xCC, 0xAB, 0xA9, 0x88, 0x77, 0x66, 0x66, 0x77, 0x88, 0x9A,
+ 0xBC, 0xCA, 0xAA, 0x98, 0x77, 0x66, 0x65, 0x66, 0x67, 0x89, 0xAA, 0xCB,
+ 0xAA, 0x99, 0x87, 0x66, 0x55, 0x55, 0x66, 0x77, 0x89, 0xAB, 0xBA, 0xAA,
+ 0x98, 0x76, 0x65, 0x55, 0x55, 0x67, 0x78, 0x9A, 0xBB, 0xAA, 0xA9, 0x87,
+ 0x66, 0x55, 0x45, 0x56, 0x67, 0x89, 0xAB, 0xBB, 0xBA, 0x98, 0x76, 0x65,
+ 0x55, 0x55, 0x67, 0x78, 0x9A, 0xBB, 0xBB, 0xA9, 0x87, 0x76, 0x65, 0x55,
+ 0x66, 0x78, 0x89, 0xAB, 0xBB, 0xBA, 0x99, 0x87, 0x76, 0x66, 0x66, 0x77,
+ 0x89, 0x9A, 0xBB, 0xBC, 0xBA, 0x98, 0x87, 0x77, 0x77, 0x77, 0x88, 0x9A,
+ 0xAB, 0xBC, 0xCB, 0xBA, 0x99, 0x88, 0x77, 0x78, 0x88, 0x99, 0xAB, 0xBB,
+ 0xCD, 0xCB, 0xAA, 0x99, 0x98, 0x88, 0x89, 0x99, 0xAA, 0xBB, 0xBD, 0xED,
+ 0xCB, 0xBA, 0xA9, 0x99, 0x99, 0xAA, 0xAA, 0xBC, 0xCB, 0xDE, 0xED, 0xCC,
+ 0xBB, 0xAA, 0xAA, 0xAA, 0xBB, 0xBB, 0xCD, 0xBD, 0xFE, 0xED, 0xCC, 0xCC,
+ 0xBB, 0xBB, 0xBB, 0xBC, 0xCC, 0xDB, 0xAD, 0xDD, 0xCC, 0xCC, 0xBB, 0xBB,
+ 0xAB, 0xBB, 0xBB, 0xBC, 0x90, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xAF, 0xDF, 0xDF, 0xFD, 0xDD, 0xCD, 0xDF, 0xFD, 0xFF, 0xDD, 0x9F, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xDF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xDF, 0xDF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xDF, 0xDF, 0xCD, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFD, 0xDF, 0xCC, 0xCD, 0xFD, 0xFF, 0xFF,
+ 0xFF, 0xFD, 0xFF, 0xFF, 0xFD, 0xBA, 0x88, 0xAC, 0xDF, 0xFD, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xCA, 0x74, 0x46, 0x9C, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xDF, 0xFC, 0x85, 0x22, 0x47, 0xDF, 0xFF, 0xFF, 0xFD, 0xFF, 0xFF, 0xFF,
+ 0xD8, 0x42, 0x13, 0x7B, 0xDF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xDC, 0xA6,
+ 0x43, 0x58, 0xCF, 0xFD, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFD, 0xA8, 0x78,
+ 0xAB, 0xDF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFC, 0xDB, 0xBC, 0xDF,
+ 0xDF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFC, 0xFF, 0xDD, 0xFD, 0xDF, 0xDF,
+ 0xFF, 0xFD, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xDF, 0xFF, 0xFF, 0xFD,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xDF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xDF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xAF, 0xFF, 0xFF, 0xFF, 0xFD, 0xDF,
+ 0xDD, 0xFD, 0xFF, 0xDD, 0xA0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xDF, 0xFF, 0xFD, 0xDD, 0xCD, 0xDE, 0xDD, 0xFF, 0xFF, 0xFF, 0xCF, 0xFF,
+ 0xFF, 0xED, 0xDC, 0xCC, 0xCD, 0xEF, 0xFF, 0xFF, 0xFF, 0xFF, 0xEE, 0xDD,
+ 0xBB, 0xBA, 0xBB, 0xBD, 0xDD, 0xFF, 0xFF, 0xFF, 0xFD, 0xCC, 0xBA, 0xAA,
+ 0x99, 0xAA, 0xBB, 0xCE, 0xFF, 0xFF, 0xFF, 0xEC, 0xBA, 0x99, 0x88, 0x89,
+ 0x9A, 0xAB, 0xCE, 0xFF, 0xFE, 0xFC, 0xCA, 0x98, 0x87, 0x77, 0x78, 0x99,
+ 0xAB, 0xDD, 0xFF, 0xDD, 0xBB, 0x98, 0x77, 0x66, 0x66, 0x77, 0x99, 0xBC,
+ 0xDF, 0xED, 0xCB, 0xA9, 0x87, 0x66, 0x55, 0x56, 0x78, 0x9A, 0xBC, 0xFF,
+ 0xFC, 0xB9, 0x87, 0x65, 0x55, 0x55, 0x56, 0x78, 0xAB, 0xCF, 0xFC, 0xDB,
+ 0xA8, 0x76, 0x55, 0x44, 0x45, 0x67, 0x8A, 0xBC, 0xED, 0xDC, 0xCA, 0x87,
+ 0x65, 0x54, 0x45, 0x56, 0x78, 0x9B, 0xCE, 0xFE, 0xDB, 0xA9, 0x76, 0x55,
+ 0x44, 0x55, 0x67, 0x89, 0xBC, 0xDD, 0xDC, 0xCA, 0x98, 0x76, 0x55, 0x55,
+ 0x66, 0x78, 0xAB, 0xCF, 0xED, 0xFD, 0xBA, 0x87, 0x76, 0x66, 0x66, 0x78,
+ 0x9A, 0xBE, 0xEF, 0xDF, 0xCB, 0xA9, 0x88, 0x77, 0x77, 0x78, 0x9A, 0xBC,
+ 0xCF, 0xFE, 0xFF, 0xDC, 0xA9, 0x98, 0x88, 0x88, 0x9A, 0xBC, 0xDF, 0xEF,
+ 0xFF, 0xFE, 0xCB, 0xBA, 0x99, 0x9A, 0xAA, 0xBC, 0xCD, 0xFF, 0xFF, 0xFF,
+ 0xFD, 0xCD, 0xCB, 0xBB, 0xBB, 0xBC, 0xEF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE,
+ 0xED, 0xDC, 0xDC, 0xDD, 0xCF, 0xFF, 0xFF, 0xFE, 0xFF, 0xFF, 0xDF, 0xEF,
+ 0xDD, 0xEE, 0xFF, 0xDE, 0xFF, 0xFF, 0xBF, 0xFF, 0xFD, 0xFF, 0xFE, 0xED,
+ 0xFE, 0xFF, 0xFF, 0xFF, 0xC0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xDF, 0xEE, 0xED, 0xDD, 0xCC, 0xCC, 0xDD, 0xEE, 0xEF, 0xFF, 0xDE, 0xFF,
+ 0xED, 0xCC, 0xCC, 0xBC, 0xCC, 0xDD, 0xEE, 0xFF, 0xFF, 0xEF, 0xED, 0xCC,
+ 0xBB, 0xAA, 0xAA, 0xBB, 0xCD, 0xDE, 0xFF, 0xFE, 0xFD, 0xCB, 0xAA, 0xA9,
+ 0x99, 0x99, 0xAB, 0xBC, 0xEF, 0xFF, 0xDD, 0xCB, 0xAA, 0x98, 0x88, 0x88,
+ 0x89, 0xAA, 0xBC, 0xEF, 0xFD, 0xDB, 0xA9, 0x98, 0x77, 0x77, 0x77, 0x89,
+ 0x9B, 0xCD, 0xEE, 0xDD, 0xBA, 0x98, 0x77, 0x66, 0x66, 0x67, 0x89, 0xAB,
+ 0xCE, 0xEC, 0xCB, 0x98, 0x77, 0x66, 0x55, 0x56, 0x67, 0x89, 0xBC, 0xDE,
+ 0xCC, 0xA9, 0x87, 0x66, 0x55, 0x55, 0x56, 0x78, 0x9A, 0xCD, 0xDC, 0xBA,
+ 0x98, 0x76, 0x55, 0x54, 0x55, 0x67, 0x89, 0xAB, 0xCD, 0xCB, 0xA9, 0x87,
+ 0x65, 0x54, 0x45, 0x56, 0x77, 0x9A, 0xBD, 0xDC, 0xCA, 0x98, 0x76, 0x55,
+ 0x55, 0x55, 0x67, 0x89, 0xAB, 0xDD, 0xDC, 0xB9, 0x87, 0x66, 0x55, 0x55,
+ 0x66, 0x78, 0x9A, 0xCD, 0xDD, 0xCB, 0xA9, 0x87, 0x66, 0x66, 0x66, 0x78,
+ 0x9A, 0xBC, 0xED, 0xED, 0xCB, 0x99, 0x87, 0x77, 0x77, 0x78, 0x89, 0xAB,
+ 0xCD, 0xDE, 0xEC, 0xBA, 0x99, 0x88, 0x87, 0x88, 0x89, 0xAB, 0xCD, 0xEF,
+ 0xFF, 0xDD, 0xBB, 0xA9, 0x99, 0x99, 0x99, 0xAB, 0xCC, 0xEF, 0xFF, 0xFF,
+ 0xDC, 0xCB, 0xBA, 0xAA, 0xAA, 0xBB, 0xCD, 0xEF, 0xFF, 0xFF, 0xFF, 0xED,
+ 0xCC, 0xBB, 0xBB, 0xBC, 0xDC, 0xDE, 0xFF, 0xEF, 0xFF, 0xFF, 0xEE, 0xED,
+ 0xDC, 0xDD, 0xED, 0xEF, 0xFF, 0xFF, 0xDF, 0xFF, 0xFE, 0xED, 0xDD, 0xDD,
+ 0xDD, 0xDD, 0xEF, 0xFF, 0xD0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xCD, 0xCD, 0xDC, 0xCC, 0xCD, 0xDE, 0xDD, 0xFF, 0xFF, 0xFF, 0xDD, 0xFE,
+ 0xDC, 0xCC, 0xCB, 0xCC, 0xCD, 0xDD, 0xFF, 0xFF, 0xFF, 0xDF, 0xDD, 0xCB,
+ 0xBB, 0xBA, 0xBB, 0xBC, 0xCD, 0xEF, 0xEF, 0xFD, 0xFC, 0xCB, 0xA9, 0xA9,
+ 0x99, 0x9A, 0xAB, 0xCD, 0xDF, 0xFE, 0xCE, 0xCB, 0xA9, 0x98, 0x88, 0x88,
+ 0x99, 0xAB, 0xCD, 0xEF, 0xFC, 0xCB, 0xAA, 0x98, 0x77, 0x77, 0x77, 0x89,
+ 0xAB, 0xCE, 0xFE, 0xCC, 0xBA, 0x98, 0x77, 0x66, 0x66, 0x77, 0x89, 0xAC,
+ 0xDE, 0xEC, 0xCA, 0x98, 0x77, 0x65, 0x55, 0x56, 0x77, 0x9A, 0xBC, 0xDD,
+ 0xCC, 0xA9, 0x87, 0x65, 0x55, 0x55, 0x56, 0x78, 0x9A, 0xCD, 0xEC, 0xBA,
+ 0x98, 0x76, 0x55, 0x44, 0x55, 0x67, 0x89, 0xAB, 0xDD, 0xCC, 0xB9, 0x87,
+ 0x65, 0x54, 0x45, 0x56, 0x78, 0x9A, 0xBD, 0xDC, 0xCB, 0x98, 0x76, 0x55,
+ 0x55, 0x55, 0x67, 0x89, 0xAB, 0xDD, 0xDC, 0xBA, 0x98, 0x76, 0x55, 0x55,
+ 0x66, 0x78, 0x9A, 0xCD, 0xDD, 0xDC, 0xB9, 0x87, 0x76, 0x66, 0x66, 0x78,
+ 0x99, 0xBB, 0xDF, 0xDE, 0xCB, 0xA9, 0x88, 0x77, 0x77, 0x78, 0x89, 0xAB,
+ 0xCD, 0xDD, 0xED, 0xBB, 0xA9, 0x98, 0x88, 0x88, 0x89, 0xAA, 0xBD, 0xDD,
+ 0xFF, 0xED, 0xCB, 0xAA, 0x99, 0x99, 0x9A, 0xAB, 0xBC, 0xDE, 0xEF, 0xFF,
+ 0xFD, 0xCC, 0xBA, 0xAA, 0xAA, 0xAB, 0xBC, 0xDD, 0xEE, 0xFF, 0xFF, 0xED,
+ 0xDC, 0xCB, 0xBC, 0xCB, 0xCD, 0xCD, 0xFF, 0xEF, 0xFF, 0xFF, 0xFF, 0xDD,
+ 0xEC, 0xDC, 0xCC, 0xEF, 0xEF, 0xFF, 0xCF, 0xFF, 0xFF, 0xFD, 0xED, 0xDD,
+ 0xDC, 0xDD, 0xDD, 0xDF, 0xD0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xBF, 0xEE, 0xED, 0xEF, 0xED, 0xEE, 0xFE, 0xEF, 0xFE, 0xFF, 0xAE, 0xFF,
+ 0xFE, 0xEE, 0xEE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFD, 0xDD,
+ 0xDD, 0xDD, 0xDD, 0xEE, 0xFF, 0xFF, 0xFF, 0xFE, 0xFE, 0xED, 0xCC, 0xCB,
+ 0xBB, 0xCC, 0xDE, 0xEF, 0xFF, 0xFF, 0xFF, 0xDD, 0xCB, 0xAA, 0xAA, 0xAA,
+ 0xBB, 0xCD, 0xEF, 0xFF, 0xFE, 0xFE, 0xCB, 0xA9, 0x98, 0x88, 0x89, 0xAB,
+ 0xCD, 0xFF, 0xFF, 0xEE, 0xDC, 0xA9, 0x88, 0x77, 0x77, 0x89, 0xAB, 0xDE,
+ 0xFF, 0xFF, 0xFD, 0xBA, 0x97, 0x76, 0x55, 0x66, 0x89, 0xAC, 0xDF, 0xFE,
+ 0xEE, 0xDB, 0xA8, 0x76, 0x54, 0x45, 0x67, 0x8A, 0xBD, 0xFF, 0xEE, 0xED,
+ 0xBA, 0x87, 0x54, 0x33, 0x45, 0x68, 0x9B, 0xDF, 0xFE, 0xFF, 0xDB, 0xA8,
+ 0x75, 0x43, 0x34, 0x56, 0x89, 0xBC, 0xEF, 0xEE, 0xFD, 0xCA, 0x87, 0x65,
+ 0x44, 0x45, 0x68, 0x9B, 0xCE, 0xFF, 0xFF, 0xEC, 0xB9, 0x86, 0x65, 0x55,
+ 0x67, 0x8A, 0xBD, 0xEF, 0xFF, 0xFF, 0xDC, 0xA9, 0x87, 0x66, 0x77, 0x89,
+ 0xAB, 0xCF, 0xFF, 0xFF, 0xFE, 0xCB, 0xA9, 0x88, 0x88, 0x89, 0xAB, 0xCD,
+ 0xEF, 0xFF, 0xFF, 0xFE, 0xCB, 0xAA, 0x99, 0x9A, 0xAA, 0xBC, 0xDE, 0xFF,
+ 0xFF, 0xFF, 0xFE, 0xDC, 0xBB, 0xBB, 0xBB, 0xCC, 0xDE, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xED, 0xDD, 0xCD, 0xDD, 0xDE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xEF, 0xEF, 0xEF, 0xEF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xBF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xEF, 0xFF, 0xC0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xAE, 0xDD, 0xED, 0xDD, 0xDD, 0xDD, 0xDD, 0xFE, 0xEE, 0xFF, 0xBD, 0xFF,
+ 0xEE, 0xED, 0xED, 0xEE, 0xEF, 0xFE, 0xFF, 0xFF, 0xFE, 0xEE, 0xED, 0xDD,
+ 0xCC, 0xCC, 0xDD, 0xDE, 0xEE, 0xFF, 0xFF, 0xEE, 0xEE, 0xDC, 0xCB, 0xBB,
+ 0xBB, 0xBC, 0xDD, 0xEE, 0xFF, 0xFE, 0xDE, 0xDC, 0xBB, 0xAA, 0x99, 0xAA,
+ 0xBB, 0xCD, 0xEF, 0xFF, 0xED, 0xDD, 0xCB, 0xA9, 0x98, 0x88, 0x89, 0xAB,
+ 0xCD, 0xEF, 0xFE, 0xDD, 0xDB, 0xA9, 0x87, 0x77, 0x77, 0x89, 0xAB, 0xCE,
+ 0xFF, 0xED, 0xDC, 0xBA, 0x97, 0x76, 0x55, 0x67, 0x89, 0xAC, 0xDE, 0xFE,
+ 0xDD, 0xCB, 0xA8, 0x76, 0x54, 0x45, 0x67, 0x8A, 0xBC, 0xEF, 0xDD, 0xDC,
+ 0xB9, 0x87, 0x54, 0x33, 0x45, 0x68, 0x9B, 0xCD, 0xEE, 0xDE, 0xCB, 0xA8,
+ 0x75, 0x43, 0x34, 0x56, 0x89, 0xBC, 0xDF, 0xDD, 0xED, 0xBA, 0x97, 0x65,
+ 0x44, 0x45, 0x78, 0x9A, 0xCD, 0xEE, 0xDE, 0xDC, 0xB9, 0x87, 0x65, 0x55,
+ 0x67, 0x89, 0xBC, 0xDE, 0xDD, 0xEE, 0xDB, 0xA9, 0x87, 0x66, 0x77, 0x89,
+ 0xAB, 0xCD, 0xFD, 0xDE, 0xED, 0xCB, 0xA9, 0x88, 0x88, 0x89, 0x9A, 0xBC,
+ 0xDF, 0xDD, 0xFE, 0xED, 0xCB, 0xAA, 0x99, 0x99, 0xAA, 0xBC, 0xDE, 0xFE,
+ 0xDF, 0xFF, 0xED, 0xCC, 0xBB, 0xAB, 0xBB, 0xBC, 0xDE, 0xEF, 0xDD, 0xFF,
+ 0xFF, 0xEE, 0xDC, 0xCC, 0xCC, 0xCD, 0xDD, 0xEE, 0xFE, 0xDF, 0xFF, 0xFF,
+ 0xEE, 0xED, 0xDD, 0xDD, 0xDD, 0xDE, 0xFE, 0xED, 0xFF, 0xFF, 0xFF, 0xEF,
+ 0xEE, 0xEE, 0xFE, 0xFF, 0xFF, 0xFE, 0x9D, 0xEE, 0xDD, 0xDE, 0xDD, 0xDD,
+ 0xDD, 0xDD, 0xFE, 0xED, 0xB0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xAB, 0xAA, 0xA9, 0x99, 0x99, 0x99, 0x99, 0x9A, 0xAB, 0xCC, 0xBB, 0xCB,
+ 0xBA, 0xA9, 0x99, 0x99, 0x99, 0xAA, 0xAB, 0xBC, 0xDC, 0xAB, 0xBA, 0xA9,
+ 0x99, 0x88, 0x99, 0x99, 0x9A, 0xAB, 0xCC, 0xCA, 0xBA, 0xA9, 0x98, 0x88,
+ 0x88, 0x88, 0x89, 0x9A, 0xAB, 0xBB, 0xAA, 0xA9, 0x98, 0x87, 0x77, 0x77,
+ 0x88, 0x89, 0x99, 0xAB, 0xBA, 0xA9, 0x98, 0x87, 0x77, 0x77, 0x77, 0x78,
+ 0x89, 0x9A, 0xAA, 0x9A, 0x98, 0x87, 0x77, 0x66, 0x66, 0x77, 0x78, 0x89,
+ 0xAA, 0xA9, 0x99, 0x87, 0x77, 0x66, 0x66, 0x66, 0x67, 0x78, 0x99, 0xAA,
+ 0x99, 0x98, 0x77, 0x66, 0x66, 0x66, 0x66, 0x77, 0x88, 0x9A, 0xA9, 0x98,
+ 0x87, 0x76, 0x66, 0x55, 0x66, 0x67, 0x78, 0x89, 0xA9, 0x99, 0x98, 0x77,
+ 0x66, 0x65, 0x56, 0x66, 0x77, 0x88, 0x9A, 0x99, 0x99, 0x87, 0x76, 0x66,
+ 0x65, 0x66, 0x67, 0x78, 0x89, 0xAA, 0x99, 0x98, 0x87, 0x76, 0x66, 0x66,
+ 0x66, 0x77, 0x89, 0x9A, 0xA9, 0xA9, 0x88, 0x77, 0x76, 0x66, 0x67, 0x77,
+ 0x88, 0x9A, 0xAA, 0xAA, 0x99, 0x88, 0x77, 0x77, 0x77, 0x77, 0x78, 0x89,
+ 0xAA, 0xAA, 0xA9, 0x99, 0x88, 0x77, 0x77, 0x77, 0x88, 0x89, 0x9A, 0xBA,
+ 0xAB, 0xAA, 0x99, 0x88, 0x88, 0x88, 0x88, 0x99, 0x9A, 0xAB, 0xAB, 0xCB,
+ 0xA9, 0x99, 0x98, 0x88, 0x89, 0x99, 0xAA, 0xAB, 0xCB, 0xBC, 0xBA, 0xAA,
+ 0xA9, 0x99, 0x99, 0x99, 0xAA, 0xBB, 0xCC, 0xBC, 0xCC, 0xCB, 0xBA, 0xAA,
+ 0xAA, 0xAA, 0xAB, 0xBB, 0xCC, 0xDC, 0xAC, 0xBB, 0xBA, 0xAA, 0x99, 0x99,
+ 0xAA, 0xAA, 0xAB, 0xCC, 0xA0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0x9B, 0xAA, 0xA9, 0x99, 0x99, 0x99, 0x99, 0x9A, 0xAB, 0xBC, 0xAB, 0xCB,
+ 0xBA, 0xAA, 0x99, 0x99, 0x99, 0xAA, 0xAB, 0xBB, 0xCC, 0xAB, 0xBA, 0xA9,
+ 0x99, 0x88, 0x89, 0x99, 0x9A, 0xAB, 0xBC, 0xBA, 0xBA, 0xA9, 0x98, 0x88,
+ 0x88, 0x88, 0x89, 0x99, 0xAB, 0xBB, 0xAA, 0xA9, 0x98, 0x88, 0x77, 0x77,
+ 0x78, 0x89, 0x99, 0xAB, 0xA9, 0xA9, 0x98, 0x87, 0x77, 0x77, 0x77, 0x78,
+ 0x89, 0x9A, 0xBA, 0x9A, 0x98, 0x87, 0x77, 0x66, 0x66, 0x77, 0x78, 0x89,
+ 0x9A, 0xA9, 0xA9, 0x88, 0x77, 0x66, 0x66, 0x66, 0x67, 0x78, 0x89, 0xAA,
+ 0x99, 0x98, 0x77, 0x66, 0x66, 0x66, 0x66, 0x77, 0x88, 0x9A, 0xA9, 0x98,
+ 0x87, 0x76, 0x66, 0x56, 0x66, 0x67, 0x78, 0x89, 0xA9, 0x99, 0x88, 0x77,
+ 0x66, 0x65, 0x56, 0x66, 0x77, 0x88, 0x9A, 0x99, 0x98, 0x87, 0x76, 0x66,
+ 0x66, 0x66, 0x67, 0x78, 0x89, 0xA9, 0x99, 0x98, 0x77, 0x76, 0x66, 0x66,
+ 0x66, 0x77, 0x89, 0x9A, 0xA9, 0xA9, 0x88, 0x77, 0x66, 0x66, 0x66, 0x77,
+ 0x88, 0x99, 0xAA, 0x9A, 0x99, 0x88, 0x77, 0x77, 0x77, 0x77, 0x88, 0x89,
+ 0xAA, 0xAA, 0xAA, 0x98, 0x88, 0x77, 0x77, 0x77, 0x88, 0x89, 0x9A, 0xBA,
+ 0xAB, 0xA9, 0x99, 0x88, 0x88, 0x88, 0x88, 0x89, 0x9A, 0xAB, 0xAB, 0xBB,
+ 0xAA, 0x99, 0x98, 0x88, 0x88, 0x99, 0x9A, 0xAB, 0xCB, 0xBC, 0xBB, 0xAA,
+ 0xA9, 0x99, 0x99, 0x9A, 0xAA, 0xAB, 0xBC, 0xBC, 0xDC, 0xBB, 0xBA, 0xAA,
+ 0xAA, 0xAA, 0xAA, 0xBB, 0xCC, 0xDC, 0xAC, 0xBB, 0xBA, 0xAA, 0xA9, 0x99,
+ 0xAA, 0xAA, 0xAB, 0xBC, 0xA0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xAB, 0xBA, 0xA9, 0x99, 0x99, 0x99, 0x99, 0xAA, 0xBB, 0xBD, 0xAB, 0xCB,
+ 0xBA, 0xAA, 0x99, 0x99, 0x9A, 0xAA, 0xBB, 0xBC, 0xDC, 0xBC, 0xBA, 0xA9,
+ 0x99, 0x89, 0x88, 0x99, 0x9A, 0xAB, 0xCD, 0xBA, 0xBA, 0xA9, 0x98, 0x88,
+ 0x88, 0x88, 0x89, 0x9A, 0xBB, 0xBC, 0xAB, 0xA9, 0x98, 0x87, 0x77, 0x77,
+ 0x78, 0x89, 0x9A, 0xBC, 0xB9, 0xA9, 0x98, 0x87, 0x77, 0x77, 0x77, 0x78,
+ 0x89, 0x9A, 0xBA, 0x9A, 0x99, 0x87, 0x77, 0x66, 0x66, 0x77, 0x78, 0x89,
+ 0xAB, 0xA9, 0x99, 0x87, 0x77, 0x66, 0x66, 0x66, 0x67, 0x78, 0x9A, 0xAA,
+ 0x99, 0x98, 0x77, 0x66, 0x66, 0x66, 0x66, 0x77, 0x88, 0x9A, 0xA9, 0x98,
+ 0x87, 0x76, 0x66, 0x65, 0x66, 0x66, 0x78, 0x89, 0xAA, 0x99, 0x98, 0x77,
+ 0x66, 0x65, 0x56, 0x66, 0x67, 0x88, 0x9A, 0x99, 0x99, 0x87, 0x76, 0x66,
+ 0x66, 0x66, 0x67, 0x78, 0x89, 0xAA, 0x9A, 0x98, 0x87, 0x66, 0x66, 0x66,
+ 0x66, 0x77, 0x88, 0x9A, 0xA9, 0xA9, 0x88, 0x77, 0x66, 0x66, 0x66, 0x77,
+ 0x88, 0x99, 0xAA, 0x9A, 0x99, 0x88, 0x77, 0x77, 0x77, 0x77, 0x78, 0x89,
+ 0xAA, 0xAA, 0xAA, 0x99, 0x88, 0x77, 0x77, 0x77, 0x88, 0x89, 0x9A, 0xBA,
+ 0xAB, 0xAA, 0x99, 0x88, 0x88, 0x88, 0x88, 0x99, 0x9A, 0xBB, 0xBB, 0xCB,
+ 0xAA, 0x99, 0x98, 0x88, 0x88, 0x99, 0xAA, 0xBB, 0xCB, 0xCC, 0xCB, 0xAA,
+ 0x99, 0x99, 0x99, 0x99, 0xAA, 0xBB, 0xCC, 0xBC, 0xDC, 0xBC, 0xBA, 0xAA,
+ 0xAA, 0xAA, 0xAB, 0xBB, 0xCC, 0xDC, 0xAD, 0xCB, 0xBA, 0xAA, 0xAA, 0x9A,
+ 0xAA, 0xAA, 0xBB, 0xCC, 0xA0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xAC, 0xCC, 0xCC, 0xBC, 0xCB, 0xCB, 0xCC, 0xCC, 0xCD, 0xDD, 0x9C, 0xED,
+ 0xCD, 0xCC, 0xCB, 0xCC, 0xCC, 0xCD, 0xEE, 0xEF, 0xFD, 0xCD, 0xCC, 0xCB,
+ 0xBB, 0xBB, 0xBB, 0xBC, 0xCD, 0xDE, 0xEF, 0xDC, 0xCC, 0xBA, 0xAA, 0x99,
+ 0x9A, 0xAA, 0xBB, 0xBC, 0xDE, 0xFD, 0xCD, 0xBB, 0xA9, 0x98, 0x88, 0x89,
+ 0x9A, 0xAB, 0xCC, 0xEE, 0xDC, 0xCB, 0xA9, 0x98, 0x87, 0x77, 0x88, 0x99,
+ 0xAB, 0xCD, 0xED, 0xBC, 0xBA, 0x98, 0x77, 0x66, 0x67, 0x78, 0x89, 0xBB,
+ 0xCE, 0xDC, 0xCB, 0xA8, 0x87, 0x66, 0x55, 0x66, 0x78, 0x9A, 0xBC, 0xDC,
+ 0xBC, 0xBA, 0x87, 0x66, 0x55, 0x45, 0x66, 0x78, 0x9A, 0xCD, 0xCC, 0xCB,
+ 0xA8, 0x76, 0x55, 0x44, 0x45, 0x67, 0x89, 0xAC, 0xCC, 0xCC, 0xBA, 0x87,
+ 0x65, 0x54, 0x44, 0x56, 0x78, 0x9A, 0xBD, 0xCC, 0xCB, 0xA9, 0x87, 0x65,
+ 0x44, 0x55, 0x67, 0x89, 0xAB, 0xDC, 0xCC, 0xBA, 0x98, 0x76, 0x65, 0x55,
+ 0x66, 0x78, 0x9A, 0xBD, 0xCD, 0xCC, 0xAA, 0x98, 0x76, 0x66, 0x66, 0x78,
+ 0x9A, 0xBC, 0xDC, 0xDD, 0xCB, 0xA9, 0x98, 0x87, 0x77, 0x78, 0x89, 0xAB,
+ 0xCD, 0xDD, 0xED, 0xCB, 0xAA, 0x99, 0x88, 0x88, 0x99, 0xAA, 0xBC, 0xDC,
+ 0xDE, 0xDD, 0xCB, 0xBA, 0xA9, 0x99, 0x99, 0xAA, 0xBC, 0xDD, 0xDD, 0xEE,
+ 0xDD, 0xCC, 0xBB, 0xAA, 0xAA, 0xAB, 0xBC, 0xCD, 0xDD, 0xDF, 0xFE, 0xEE,
+ 0xDC, 0xCC, 0xCB, 0xCC, 0xCC, 0xCD, 0xDE, 0xDE, 0xFF, 0xFF, 0xEE, 0xDD,
+ 0xDC, 0xCD, 0xDD, 0xDD, 0xED, 0xED, 0xAE, 0xDD, 0xDD, 0xCD, 0xCC, 0xCC,
+ 0xCC, 0xCD, 0xDD, 0xDD, 0xA0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xDF, 0xFE, 0xEE, 0xDD, 0xDD, 0xDD, 0xEE, 0xEF, 0xEF, 0xFF, 0xBF, 0xFF,
+ 0xFF, 0xDD, 0xDD, 0xDD, 0xDD, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xDD,
+ 0xCC, 0xBB, 0xBC, 0xCD, 0xDE, 0xEF, 0xFF, 0xFF, 0xFE, 0xDC, 0xCB, 0xAA,
+ 0xAA, 0xAB, 0xBC, 0xDE, 0xFF, 0xFF, 0xEF, 0xDC, 0xBB, 0xA9, 0x99, 0x99,
+ 0x9A, 0xBC, 0xDE, 0xFF, 0xFE, 0xED, 0xBA, 0x99, 0x88, 0x77, 0x78, 0x9A,
+ 0xBC, 0xDF, 0xFF, 0xED, 0xCB, 0xA9, 0x87, 0x66, 0x66, 0x78, 0x9A, 0xBC,
+ 0xEF, 0xFD, 0xDC, 0xA9, 0x87, 0x66, 0x55, 0x56, 0x78, 0x9A, 0xCE, 0xFF,
+ 0xED, 0xBA, 0x97, 0x65, 0x55, 0x45, 0x56, 0x79, 0xAB, 0xDE, 0xFD, 0xCB,
+ 0xA9, 0x76, 0x55, 0x44, 0x45, 0x67, 0x8A, 0xBC, 0xEF, 0xDD, 0xBA, 0x87,
+ 0x65, 0x44, 0x44, 0x56, 0x78, 0xAB, 0xDE, 0xEE, 0xDC, 0xA9, 0x76, 0x55,
+ 0x44, 0x55, 0x67, 0x9A, 0xBD, 0xEF, 0xEE, 0xCA, 0x98, 0x76, 0x55, 0x55,
+ 0x67, 0x89, 0xAC, 0xDF, 0xFE, 0xED, 0xBA, 0x98, 0x76, 0x66, 0x67, 0x78,
+ 0x9B, 0xCD, 0xEE, 0xFF, 0xDC, 0xBA, 0x98, 0x77, 0x77, 0x88, 0x9A, 0xBC,
+ 0xEF, 0xFF, 0xFE, 0xDC, 0xBA, 0x99, 0x88, 0x89, 0xAA, 0xBC, 0xDE, 0xFF,
+ 0xFF, 0xFF, 0xDC, 0xBA, 0xAA, 0xAA, 0xAB, 0xBC, 0xDE, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xDC, 0xCB, 0xBB, 0xBB, 0xCC, 0xDD, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xED, 0xDD, 0xCD, 0xDD, 0xDE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0xBF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xC0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFA, 0xAF, 0xFA, 0x7F, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xAF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFA,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFA, 0xFF, 0x9F, 0xAA, 0xBA, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFA, 0xFF, 0xFF, 0x98, 0x89, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFA, 0x76, 0x78, 0x78, 0x8F, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xF7, 0x64, 0x56, 0x78, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xA9, 0x74, 0x22, 0x57, 0x9F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0x97, 0x52, 0x14, 0x69, 0xAF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF9, 0x86,
+ 0x44, 0x57, 0x8A, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x99, 0x76, 0x77,
+ 0x89, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xC9, 0x89, 0x99, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x9F, 0xAF, 0xFA, 0xFF, 0xFF,
+ 0xFF, 0xFA, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFA, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xAF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFA,
+ 0xFF, 0xFA, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFA, 0xFF, 0xFF, 0xAF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x79, 0xFA, 0xCF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xAF, 0xA0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xCD, 0xDD, 0xCC, 0xCB, 0xBB, 0xCC, 0xCC, 0xDD, 0xEE, 0xEE, 0xCD, 0xEE,
+ 0xDD, 0xCC, 0xBB, 0xBB, 0xBC, 0xCD, 0xDE, 0xEF, 0xFF, 0xDE, 0xDC, 0xCB,
+ 0xBA, 0xAA, 0xAA, 0xAB, 0xBC, 0xDE, 0xFF, 0xFD, 0xDC, 0xBB, 0xAA, 0x99,
+ 0x99, 0x99, 0xAA, 0xBC, 0xDE, 0xFE, 0xCC, 0xCB, 0xA9, 0x98, 0x88, 0x88,
+ 0x89, 0x9A, 0xBC, 0xDE, 0xEC, 0xCB, 0xA9, 0x88, 0x77, 0x77, 0x77, 0x88,
+ 0x9A, 0xBC, 0xDD, 0xCC, 0xBA, 0x98, 0x77, 0x66, 0x66, 0x67, 0x88, 0xAB,
+ 0xCD, 0xDC, 0xCA, 0x98, 0x77, 0x65, 0x55, 0x56, 0x67, 0x89, 0xAB, 0xDD,
+ 0xBB, 0xA9, 0x87, 0x65, 0x55, 0x55, 0x56, 0x78, 0x9A, 0xBC, 0xDC, 0xBA,
+ 0x98, 0x76, 0x55, 0x55, 0x55, 0x67, 0x89, 0xAB, 0xCD, 0xBB, 0xA9, 0x87,
+ 0x65, 0x55, 0x45, 0x56, 0x77, 0x9A, 0xBC, 0xDC, 0xBA, 0x98, 0x76, 0x55,
+ 0x55, 0x55, 0x67, 0x89, 0xAB, 0xCC, 0xCC, 0xA9, 0x87, 0x66, 0x55, 0x55,
+ 0x66, 0x78, 0x9A, 0xBD, 0xDC, 0xCB, 0xA9, 0x87, 0x66, 0x66, 0x66, 0x78,
+ 0x99, 0xAC, 0xDD, 0xDD, 0xBA, 0x98, 0x87, 0x77, 0x77, 0x78, 0x89, 0xAB,
+ 0xCD, 0xDD, 0xDC, 0xBA, 0x99, 0x88, 0x78, 0x88, 0x89, 0xAA, 0xBC, 0xDD,
+ 0xEE, 0xDC, 0xBA, 0xA9, 0x99, 0x99, 0x99, 0xAB, 0xBC, 0xDE, 0xDE, 0xFE,
+ 0xDC, 0xBB, 0xAA, 0xAA, 0xAA, 0xAB, 0xCC, 0xDD, 0xED, 0xFF, 0xFE, 0xDC,
+ 0xCB, 0xBB, 0xBB, 0xBC, 0xCC, 0xDE, 0xEF, 0xEF, 0xFF, 0xFF, 0xED, 0xDD,
+ 0xCC, 0xCC, 0xDD, 0xEE, 0xEF, 0xFE, 0xCF, 0xFF, 0xEE, 0xDD, 0xDD, 0xDD,
+ 0xDD, 0xDD, 0xDD, 0xEE, 0xC0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xCE, 0xDE, 0xDC, 0xCC, 0xCC, 0xCC, 0xDD, 0xDD, 0xEF, 0xFF, 0xBF, 0xEF,
+ 0xED, 0xDC, 0xCC, 0xCC, 0xCD, 0xDD, 0xFF, 0xFF, 0xFF, 0xFE, 0xDD, 0xCB,
+ 0xBB, 0xBA, 0xBB, 0xBC, 0xCD, 0xEF, 0xFF, 0xFD, 0xED, 0xCB, 0xBA, 0xA9,
+ 0x99, 0x9A, 0xBB, 0xCD, 0xEF, 0xFF, 0xDD, 0xCC, 0xBA, 0x99, 0x88, 0x88,
+ 0x89, 0xAB, 0xCD, 0xEF, 0xED, 0xCC, 0xBA, 0x98, 0x87, 0x77, 0x77, 0x89,
+ 0xAB, 0xDE, 0xFF, 0xCC, 0xBA, 0x98, 0x77, 0x66, 0x66, 0x67, 0x89, 0xAC,
+ 0xDE, 0xED, 0xCB, 0xA9, 0x77, 0x66, 0x55, 0x56, 0x67, 0x8A, 0xBC, 0xDE,
+ 0xDC, 0xBA, 0x87, 0x65, 0x55, 0x55, 0x56, 0x78, 0x9A, 0xCE, 0xED, 0xCB,
+ 0x98, 0x76, 0x55, 0x44, 0x55, 0x67, 0x89, 0xAC, 0xDD, 0xDC, 0xB9, 0x87,
+ 0x65, 0x54, 0x45, 0x56, 0x78, 0x9A, 0xBD, 0xEC, 0xCB, 0x98, 0x76, 0x55,
+ 0x55, 0x55, 0x67, 0x89, 0xAC, 0xDF, 0xDD, 0xBA, 0x97, 0x66, 0x55, 0x55,
+ 0x66, 0x78, 0xAB, 0xCD, 0xDD, 0xDB, 0xA9, 0x87, 0x66, 0x66, 0x66, 0x78,
+ 0x9A, 0xBD, 0xDF, 0xDE, 0xCB, 0xA9, 0x87, 0x77, 0x77, 0x78, 0x9A, 0xAC,
+ 0xDF, 0xDF, 0xFD, 0xCB, 0xA9, 0x88, 0x88, 0x88, 0x99, 0xBB, 0xCD, 0xEE,
+ 0xFF, 0xFC, 0xCB, 0xAA, 0x99, 0x99, 0x9A, 0xBB, 0xCD, 0xEF, 0xFF, 0xFE,
+ 0xEC, 0xCB, 0xBA, 0xAA, 0xAA, 0xBB, 0xCD, 0xEF, 0xED, 0xEF, 0xFF, 0xED,
+ 0xDD, 0xCB, 0xCB, 0xCC, 0xDD, 0xDE, 0xFF, 0xEF, 0xFF, 0xFF, 0xEE, 0xED,
+ 0xDD, 0xDE, 0xEE, 0xEE, 0xFF, 0xFE, 0xAE, 0xFF, 0xEE, 0xEE, 0xEE, 0xED,
+ 0xFD, 0xED, 0xFE, 0xFF, 0xD0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xCF, 0xFE, 0xFF, 0xEE, 0xEF, 0xEF, 0xDF, 0xFF, 0xFF, 0xFF, 0xBF, 0xFF,
+ 0xFF, 0xFE, 0xEE, 0xDD, 0xDF, 0xEF, 0xFF, 0xFF, 0xFF, 0xEF, 0xFF, 0xFD,
+ 0xDD, 0xCB, 0xBC, 0xCD, 0xDF, 0xFF, 0xFF, 0xFF, 0xFF, 0xDD, 0xCB, 0xBA,
+ 0xAA, 0xBB, 0xBC, 0xDF, 0xFF, 0xFF, 0xEF, 0xDD, 0xCB, 0xA9, 0x99, 0x99,
+ 0x9A, 0xBC, 0xDF, 0xFF, 0xFF, 0xFD, 0xCB, 0xA9, 0x88, 0x77, 0x88, 0x9A,
+ 0xBC, 0xDF, 0xFF, 0xFE, 0xCB, 0xA9, 0x87, 0x66, 0x66, 0x78, 0x9A, 0xBD,
+ 0xFF, 0xFE, 0xDC, 0xB9, 0x87, 0x66, 0x55, 0x56, 0x78, 0x9B, 0xDE, 0xFF,
+ 0xEE, 0xCA, 0x98, 0x65, 0x54, 0x45, 0x56, 0x79, 0xAC, 0xEF, 0xFF, 0xDC,
+ 0xA9, 0x76, 0x54, 0x44, 0x45, 0x67, 0x8A, 0xCD, 0xFF, 0xED, 0xCA, 0x97,
+ 0x65, 0x44, 0x44, 0x56, 0x79, 0xAC, 0xDF, 0xFE, 0xEC, 0xA9, 0x86, 0x65,
+ 0x44, 0x55, 0x67, 0x9A, 0xCD, 0xFF, 0xEE, 0xCB, 0x98, 0x76, 0x55, 0x55,
+ 0x67, 0x89, 0xAC, 0xDF, 0xFF, 0xFD, 0xCA, 0x98, 0x76, 0x66, 0x67, 0x89,
+ 0xAB, 0xCE, 0xEF, 0xFF, 0xEC, 0xBA, 0x98, 0x87, 0x77, 0x89, 0x9B, 0xCD,
+ 0xEF, 0xFF, 0xFF, 0xEC, 0xBA, 0x99, 0x99, 0x99, 0xAA, 0xBC, 0xDF, 0xFF,
+ 0xFF, 0xFE, 0xDC, 0xBB, 0xAA, 0xAA, 0xAB, 0xCC, 0xDF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xDD, 0xCB, 0xCB, 0xCC, 0xCD, 0xDF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFE, 0xDD, 0xDD, 0xDF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xBF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xC0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xAB, 0xBB, 0xAA, 0xAA, 0x99, 0xAA, 0xAA, 0xAB, 0xCC, 0xCD, 0xBB, 0xCC,
+ 0xBB, 0xAA, 0xAA, 0xAA, 0xAA, 0xBB, 0xBC, 0xDD, 0xEE, 0xBC, 0xBB, 0xA9,
+ 0x99, 0x99, 0x99, 0x99, 0xAA, 0xBB, 0xCD, 0xDA, 0xBA, 0xA9, 0x99, 0x88,
+ 0x88, 0x88, 0x99, 0xAA, 0xBC, 0xCC, 0xAB, 0xA9, 0x98, 0x88, 0x77, 0x77,
+ 0x88, 0x89, 0x9A, 0xBC, 0xCA, 0xA9, 0x98, 0x87, 0x77, 0x77, 0x77, 0x78,
+ 0x89, 0xAB, 0xBB, 0xAA, 0x99, 0x87, 0x76, 0x66, 0x66, 0x67, 0x78, 0x99,
+ 0xAB, 0xBA, 0xA9, 0x88, 0x76, 0x66, 0x66, 0x66, 0x67, 0x88, 0x9A, 0xBB,
+ 0x9A, 0x98, 0x77, 0x66, 0x65, 0x56, 0x66, 0x77, 0x89, 0xAA, 0xB9, 0xA9,
+ 0x87, 0x76, 0x65, 0x55, 0x56, 0x67, 0x78, 0x9A, 0xAB, 0x9A, 0x98, 0x77,
+ 0x66, 0x55, 0x55, 0x66, 0x77, 0x89, 0xAA, 0xAA, 0xA9, 0x87, 0x76, 0x66,
+ 0x55, 0x66, 0x67, 0x78, 0x9A, 0xAA, 0xAA, 0x98, 0x87, 0x76, 0x66, 0x66,
+ 0x66, 0x77, 0x89, 0xAA, 0xAA, 0xA9, 0x98, 0x77, 0x66, 0x66, 0x66, 0x77,
+ 0x88, 0x9A, 0xBB, 0xBB, 0xA9, 0x88, 0x77, 0x77, 0x77, 0x77, 0x88, 0x99,
+ 0xAB, 0xBB, 0xBA, 0xA9, 0x88, 0x87, 0x77, 0x77, 0x88, 0x99, 0xAA, 0xBB,
+ 0xBC, 0xBA, 0xA9, 0x98, 0x88, 0x88, 0x88, 0x99, 0xAA, 0xBC, 0xBC, 0xCC,
+ 0xBB, 0xA9, 0x99, 0x99, 0x99, 0x9A, 0xAA, 0xBB, 0xCC, 0xDD, 0xCC, 0xBB,
+ 0xAA, 0xAA, 0xA9, 0xAA, 0xAB, 0xBB, 0xCD, 0xCD, 0xDD, 0xDC, 0xCB, 0xBB,
+ 0xAA, 0xAA, 0xBB, 0xBC, 0xCD, 0xEC, 0xAE, 0xDD, 0xCC, 0xBB, 0xAA, 0xAA,
+ 0xAB, 0xBB, 0xBC, 0xCD, 0xB0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0x9B, 0xBA, 0xAA, 0xA9, 0x99, 0x99, 0xAA, 0xAA, 0xBB, 0xCB, 0x9B, 0xCB,
+ 0xBA, 0xAA, 0xAA, 0xA9, 0xAA, 0xAA, 0xBB, 0xCD, 0xDC, 0xBC, 0xBB, 0xAA,
+ 0x99, 0x99, 0x99, 0x99, 0xAA, 0xBB, 0xCD, 0xCA, 0xBB, 0xAA, 0x99, 0x88,
+ 0x88, 0x88, 0x99, 0x9A, 0xBC, 0xCC, 0xAB, 0xA9, 0x98, 0x88, 0x87, 0x77,
+ 0x88, 0x89, 0x9A, 0xBC, 0xBA, 0xAA, 0x99, 0x87, 0x77, 0x77, 0x77, 0x78,
+ 0x89, 0xAA, 0xBB, 0xAA, 0x99, 0x88, 0x77, 0x66, 0x66, 0x67, 0x78, 0x89,
+ 0xAB, 0xB9, 0xA9, 0x88, 0x77, 0x66, 0x66, 0x66, 0x67, 0x88, 0x9A, 0xBB,
+ 0x9A, 0x98, 0x87, 0x66, 0x65, 0x56, 0x66, 0x77, 0x89, 0xAB, 0xA9, 0xA9,
+ 0x87, 0x76, 0x65, 0x55, 0x56, 0x67, 0x78, 0x99, 0xAA, 0x9A, 0x98, 0x77,
+ 0x66, 0x55, 0x55, 0x66, 0x77, 0x89, 0xAA, 0xA9, 0xA9, 0x87, 0x76, 0x65,
+ 0x55, 0x66, 0x67, 0x78, 0x9A, 0xBA, 0xAA, 0x98, 0x87, 0x66, 0x66, 0x66,
+ 0x67, 0x78, 0x89, 0xAA, 0xAA, 0xA9, 0x98, 0x77, 0x66, 0x66, 0x67, 0x77,
+ 0x88, 0x9A, 0xBA, 0xAA, 0xA9, 0x88, 0x77, 0x77, 0x77, 0x77, 0x88, 0x9A,
+ 0xAB, 0xAA, 0xBA, 0x99, 0x88, 0x77, 0x77, 0x78, 0x88, 0x99, 0xAA, 0xBB,
+ 0xBB, 0xBA, 0x99, 0x98, 0x88, 0x88, 0x89, 0x99, 0xAA, 0xBC, 0xBB, 0xCB,
+ 0xBA, 0xA9, 0x99, 0x99, 0x99, 0x99, 0xAA, 0xBB, 0xCB, 0xCD, 0xCC, 0xBB,
+ 0xAA, 0xA9, 0x99, 0xAA, 0xAB, 0xBB, 0xDD, 0xBC, 0xDC, 0xCC, 0xCB, 0xBA,
+ 0xAA, 0xBA, 0xBB, 0xBC, 0xCC, 0xDC, 0x9C, 0xCC, 0xBB, 0xBA, 0xAA, 0xAA,
+ 0xAA, 0xAA, 0xBB, 0xBC, 0xA0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0x9B, 0xAA, 0xA9, 0x99, 0x99, 0x99, 0x99, 0xAA, 0xAB, 0xBC, 0xAB, 0xCB,
+ 0xBA, 0xAA, 0x99, 0x99, 0x99, 0xAA, 0xAB, 0xCC, 0xDC, 0xAB, 0xBA, 0xA9,
+ 0x99, 0x98, 0x99, 0x99, 0x9A, 0xAB, 0xBC, 0xCA, 0xBA, 0xA9, 0x98, 0x88,
+ 0x88, 0x88, 0x89, 0x9A, 0xAB, 0xCB, 0xAA, 0xA9, 0x98, 0x88, 0x77, 0x77,
+ 0x78, 0x89, 0x9A, 0xAB, 0xB9, 0xA9, 0x98, 0x87, 0x77, 0x77, 0x77, 0x78,
+ 0x89, 0x9A, 0xBA, 0x9A, 0x98, 0x87, 0x77, 0x66, 0x66, 0x67, 0x78, 0x89,
+ 0xAB, 0xA9, 0xA9, 0x88, 0x77, 0x66, 0x66, 0x66, 0x67, 0x78, 0x99, 0xAA,
+ 0x99, 0x98, 0x77, 0x66, 0x66, 0x66, 0x66, 0x77, 0x88, 0x9A, 0xA9, 0x98,
+ 0x87, 0x76, 0x66, 0x55, 0x66, 0x67, 0x78, 0x89, 0xAA, 0x99, 0x88, 0x77,
+ 0x66, 0x65, 0x55, 0x66, 0x77, 0x88, 0x9A, 0xA9, 0x99, 0x87, 0x76, 0x66,
+ 0x66, 0x66, 0x67, 0x78, 0x89, 0xAA, 0x99, 0x98, 0x77, 0x66, 0x66, 0x66,
+ 0x66, 0x77, 0x89, 0x9A, 0xA9, 0xA9, 0x88, 0x77, 0x66, 0x66, 0x67, 0x77,
+ 0x88, 0x9A, 0xAA, 0xAA, 0x99, 0x88, 0x77, 0x77, 0x77, 0x77, 0x88, 0x99,
+ 0xAB, 0xAA, 0xBA, 0x99, 0x88, 0x77, 0x77, 0x77, 0x88, 0x99, 0xAA, 0xBA,
+ 0xAB, 0xAA, 0x99, 0x88, 0x88, 0x88, 0x88, 0x99, 0x9A, 0xBB, 0xAB, 0xBB,
+ 0xAA, 0x99, 0x99, 0x88, 0x89, 0x99, 0xAA, 0xBB, 0xCB, 0xBC, 0xCB, 0xAA,
+ 0xA9, 0x99, 0x99, 0x9A, 0xAA, 0xBB, 0xBC, 0xBC, 0xDC, 0xCB, 0xBA, 0xAA,
+ 0xAA, 0xAA, 0xAB, 0xBB, 0xCC, 0xCB, 0xAC, 0xBB, 0xBA, 0xAA, 0xAA, 0xAA,
+ 0xAA, 0xAA, 0xAB, 0xBB, 0xA0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xAC, 0xCB, 0xBB, 0xAA, 0xAA, 0xAA, 0xAA, 0xBB, 0xBC, 0xCC, 0x9C, 0xDC,
+ 0xCB, 0xBA, 0xAA, 0xAA, 0xAA, 0xAB, 0xBC, 0xDD, 0xEC, 0xBC, 0xCB, 0xAA,
+ 0xA9, 0x99, 0x99, 0x9A, 0xAB, 0xBC, 0xCE, 0xCB, 0xCB, 0xBA, 0x99, 0x98,
+ 0x88, 0x89, 0x99, 0xAB, 0xBC, 0xDC, 0xBB, 0xBA, 0x98, 0x88, 0x77, 0x77,
+ 0x88, 0x89, 0xAA, 0xBC, 0xCB, 0xBA, 0x98, 0x87, 0x77, 0x77, 0x77, 0x78,
+ 0x99, 0xAB, 0xCB, 0xAB, 0xA9, 0x88, 0x77, 0x66, 0x66, 0x67, 0x78, 0x99,
+ 0xBC, 0xBA, 0xA9, 0x88, 0x77, 0x66, 0x66, 0x66, 0x67, 0x89, 0x9A, 0xBB,
+ 0xAA, 0x98, 0x87, 0x66, 0x55, 0x55, 0x66, 0x77, 0x89, 0xAB, 0xBA, 0xA9,
+ 0x87, 0x76, 0x65, 0x55, 0x55, 0x67, 0x78, 0x9A, 0xBB, 0xAA, 0x98, 0x77,
+ 0x66, 0x55, 0x55, 0x66, 0x77, 0x89, 0xAB, 0xBA, 0xA9, 0x88, 0x76, 0x65,
+ 0x55, 0x56, 0x67, 0x78, 0x9A, 0xBB, 0xAA, 0x98, 0x87, 0x76, 0x65, 0x66,
+ 0x66, 0x78, 0x89, 0xAB, 0xBB, 0xAA, 0x98, 0x77, 0x66, 0x66, 0x66, 0x77,
+ 0x89, 0xAA, 0xCB, 0xBB, 0xA9, 0x98, 0x77, 0x77, 0x77, 0x77, 0x89, 0x9A,
+ 0xBC, 0xBB, 0xBA, 0xA9, 0x98, 0x87, 0x77, 0x78, 0x88, 0x99, 0xAB, 0xCC,
+ 0xBC, 0xBB, 0x99, 0x98, 0x88, 0x88, 0x89, 0x9A, 0xAB, 0xCD, 0xCC, 0xDC,
+ 0xBB, 0xAA, 0x99, 0x99, 0x99, 0xAA, 0xAB, 0xCC, 0xDC, 0xDD, 0xDC, 0xBB,
+ 0xAA, 0xAA, 0xAA, 0xAA, 0xBC, 0xCC, 0xCD, 0xDD, 0xDE, 0xCD, 0xCB, 0xBB,
+ 0xBB, 0xBB, 0xBC, 0xCD, 0xDD, 0xED, 0x9D, 0xCC, 0xCC, 0xBB, 0xBB, 0xBB,
+ 0xBB, 0xBC, 0xCC, 0xDD, 0xB0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xAE, 0xDE, 0xDD, 0xED, 0xDC, 0xCC, 0xDC, 0xDD, 0xDD, 0xDD, 0x9E, 0xFF,
+ 0xFF, 0xFD, 0xEE, 0xEE, 0xEE, 0xDE, 0xEE, 0xEF, 0xFD, 0xEF, 0xEE, 0xED,
+ 0xDD, 0xDD, 0xDD, 0xDE, 0xEF, 0xEE, 0xEF, 0xDE, 0xEF, 0xDD, 0xDC, 0xCC,
+ 0xCC, 0xCC, 0xDD, 0xEE, 0xEF, 0xFD, 0xDF, 0xED, 0xCC, 0xBB, 0xBB, 0xBB,
+ 0xBC, 0xCD, 0xDD, 0xFF, 0xDE, 0xEE, 0xDC, 0xBA, 0x99, 0x99, 0x9A, 0xBC,
+ 0xCE, 0xFE, 0xFD, 0xDF, 0xDC, 0xBA, 0x98, 0x87, 0x88, 0x9A, 0xBC, 0xDE,
+ 0xFE, 0xDD, 0xEE, 0xCB, 0xA8, 0x76, 0x66, 0x67, 0x9A, 0xBC, 0xEE, 0xFD,
+ 0xDE, 0xDC, 0xA9, 0x86, 0x54, 0x45, 0x68, 0x9B, 0xCD, 0xEF, 0xED, 0xED,
+ 0xCB, 0x97, 0x64, 0x32, 0x46, 0x79, 0xBC, 0xDE, 0xFE, 0xDE, 0xEC, 0xB9,
+ 0x86, 0x42, 0x24, 0x57, 0x9A, 0xCD, 0xEF, 0xDD, 0xED, 0xCB, 0x98, 0x75,
+ 0x44, 0x56, 0x79, 0xAC, 0xDE, 0xEE, 0xDF, 0xED, 0xCA, 0x98, 0x76, 0x66,
+ 0x78, 0x9B, 0xCD, 0xFF, 0xED, 0xEF, 0xDC, 0xBA, 0x98, 0x77, 0x78, 0x9A,
+ 0xBC, 0xDE, 0xFE, 0xDF, 0xED, 0xDC, 0xBA, 0x99, 0x99, 0x9A, 0xBC, 0xDD,
+ 0xEF, 0xEE, 0xFF, 0xED, 0xCC, 0xBB, 0xAA, 0xBB, 0xBC, 0xDD, 0xEF, 0xFE,
+ 0xDF, 0xFE, 0xEE, 0xDC, 0xCC, 0xCC, 0xCC, 0xDE, 0xEF, 0xFF, 0xEE, 0xFE,
+ 0xFE, 0xEE, 0xEE, 0xDD, 0xDD, 0xED, 0xEE, 0xEE, 0xFE, 0xEE, 0xEF, 0xFF,
+ 0xEE, 0xEE, 0xDE, 0xEE, 0xFE, 0xFF, 0xFF, 0xEE, 0xFF, 0xFF, 0xFE, 0xEF,
+ 0xEF, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0xAE, 0xDD, 0xDD, 0xEE, 0xDD, 0xDD,
+ 0xEE, 0xDE, 0xEE, 0xFE, 0xB0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xCF, 0xFF, 0xFF, 0xFF, 0xFE, 0xEF, 0xFE, 0xEF, 0xFF, 0xEF, 0xAF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xEF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xEE, 0xDE, 0xDE, 0xFF, 0xFF, 0xFF, 0xFF, 0xEF, 0xFF, 0xFF, 0xEC, 0xCC,
+ 0xCC, 0xCC, 0xDF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xEC, 0xBA, 0xAA, 0xAA,
+ 0xBC, 0xDF, 0xFF, 0xFF, 0xFF, 0xFF, 0xEC, 0xBA, 0x98, 0x88, 0x89, 0xAB,
+ 0xDE, 0xFF, 0xFF, 0xFF, 0xFD, 0xBA, 0x98, 0x77, 0x77, 0x89, 0xAC, 0xDF,
+ 0xFF, 0xFF, 0xFE, 0xCB, 0x98, 0x66, 0x55, 0x66, 0x89, 0xBC, 0xDF, 0xFF,
+ 0xFF, 0xDC, 0xA8, 0x76, 0x44, 0x45, 0x67, 0x8A, 0xCD, 0xFF, 0xFF, 0xFD,
+ 0xCA, 0x86, 0x54, 0x33, 0x45, 0x68, 0xAC, 0xDF, 0xFF, 0xFF, 0xDC, 0xA8,
+ 0x75, 0x43, 0x34, 0x56, 0x8A, 0xBD, 0xEF, 0xFE, 0xFE, 0xCA, 0x87, 0x65,
+ 0x44, 0x45, 0x78, 0xAC, 0xDF, 0xFF, 0xFF, 0xED, 0xB9, 0x86, 0x65, 0x55,
+ 0x67, 0x9B, 0xCE, 0xFF, 0xFF, 0xFF, 0xDB, 0xA9, 0x87, 0x66, 0x77, 0x8A,
+ 0xBD, 0xEF, 0xFF, 0xFF, 0xFF, 0xDB, 0xA9, 0x98, 0x88, 0x9A, 0xBC, 0xEF,
+ 0xFF, 0xFF, 0xFF, 0xFE, 0xDC, 0xBA, 0xAA, 0xAB, 0xBC, 0xDE, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFE, 0xDD, 0xCC, 0xBC, 0xCD, 0xDE, 0xEF, 0xFF, 0xFE, 0xFF,
+ 0xFF, 0xFF, 0xED, 0xDD, 0xDD, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xAF, 0xFF, 0xFF, 0xFE, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xC0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xCE, 0xDE, 0xDD, 0xDD, 0xCC, 0xDD, 0xDD, 0xEE, 0xDE, 0xEF, 0xAE, 0xFE,
+ 0xEE, 0xDD, 0xCC, 0xCC, 0xDD, 0xEE, 0xFF, 0xFF, 0xFF, 0xDF, 0xDE, 0xDC,
+ 0xCC, 0xBB, 0xBB, 0xCC, 0xDD, 0xFE, 0xEF, 0xEE, 0xFD, 0xDC, 0xBA, 0xAA,
+ 0x9A, 0xAA, 0xBC, 0xDD, 0xEF, 0xFF, 0xDD, 0xDC, 0xBA, 0xA9, 0x88, 0x88,
+ 0x99, 0xAB, 0xCD, 0xFF, 0xFC, 0xDC, 0xBA, 0x98, 0x87, 0x77, 0x78, 0x89,
+ 0xAC, 0xDD, 0xFE, 0xDD, 0xCA, 0x98, 0x77, 0x66, 0x66, 0x77, 0x89, 0xBC,
+ 0xDE, 0xFC, 0xDB, 0xA9, 0x87, 0x66, 0x55, 0x56, 0x78, 0x9A, 0xCD, 0xEF,
+ 0xDD, 0xBA, 0x87, 0x66, 0x55, 0x55, 0x56, 0x78, 0xAB, 0xDE, 0xEC, 0xCB,
+ 0xA8, 0x76, 0x55, 0x44, 0x45, 0x67, 0x89, 0xBD, 0xEF, 0xCC, 0xBA, 0x87,
+ 0x65, 0x54, 0x44, 0x56, 0x78, 0x9B, 0xCD, 0xDD, 0xDB, 0xA8, 0x76, 0x55,
+ 0x44, 0x55, 0x67, 0x89, 0xBC, 0xEE, 0xDD, 0xCA, 0x98, 0x76, 0x55, 0x55,
+ 0x67, 0x89, 0xAB, 0xCE, 0xED, 0xDC, 0xB9, 0x87, 0x76, 0x66, 0x67, 0x78,
+ 0x9A, 0xBC, 0xFE, 0xED, 0xCB, 0xA9, 0x88, 0x77, 0x77, 0x88, 0x9A, 0xBC,
+ 0xDE, 0xED, 0xEE, 0xCB, 0xAA, 0x98, 0x88, 0x89, 0x9A, 0xBC, 0xDD, 0xEE,
+ 0xEF, 0xED, 0xCC, 0xBA, 0xA9, 0x99, 0xAA, 0xBB, 0xCD, 0xEF, 0xED, 0xFE,
+ 0xED, 0xDC, 0xBB, 0xBB, 0xBB, 0xCC, 0xCD, 0xEF, 0xFE, 0xFF, 0xFF, 0xED,
+ 0xDD, 0xDC, 0xCD, 0xCD, 0xDD, 0xEE, 0xFF, 0xEE, 0xFF, 0xFF, 0xFE, 0xEE,
+ 0xDE, 0xDD, 0xEE, 0xEF, 0xFF, 0xFF, 0x9F, 0xEE, 0xED, 0xFE, 0xEF, 0xEE,
+ 0xDF, 0xEE, 0xEE, 0xFF, 0xD0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xCE, 0xDD, 0xDC, 0xCC, 0xCB, 0xCC, 0xCC, 0xDD, 0xEE, 0xEE, 0xBE, 0xFE,
+ 0xDD, 0xCC, 0xCB, 0xBB, 0xBC, 0xCD, 0xDE, 0xFF, 0xFF, 0xDE, 0xDC, 0xCB,
+ 0xBA, 0xAA, 0xAA, 0xBB, 0xCC, 0xDE, 0xFF, 0xFD, 0xDC, 0xCB, 0xAA, 0x99,
+ 0x99, 0x9A, 0xAB, 0xBC, 0xDE, 0xEE, 0xCD, 0xCB, 0xA9, 0x98, 0x88, 0x88,
+ 0x89, 0xAA, 0xBC, 0xDE, 0xEC, 0xCB, 0xAA, 0x98, 0x87, 0x77, 0x77, 0x89,
+ 0xAB, 0xCD, 0xEE, 0xCC, 0xBA, 0x98, 0x77, 0x66, 0x66, 0x67, 0x89, 0xAB,
+ 0xCD, 0xEC, 0xCA, 0x98, 0x87, 0x66, 0x55, 0x56, 0x67, 0x89, 0xBC, 0xDD,
+ 0xCB, 0xA9, 0x87, 0x66, 0x55, 0x55, 0x56, 0x78, 0x9A, 0xCD, 0xDC, 0xBA,
+ 0x98, 0x76, 0x55, 0x44, 0x55, 0x67, 0x89, 0xAB, 0xCD, 0xCC, 0xA9, 0x87,
+ 0x65, 0x54, 0x45, 0x56, 0x78, 0x9A, 0xCC, 0xDC, 0xBA, 0x98, 0x76, 0x55,
+ 0x55, 0x55, 0x67, 0x89, 0xAB, 0xCD, 0xCC, 0xBA, 0x87, 0x66, 0x55, 0x55,
+ 0x67, 0x78, 0x9A, 0xCD, 0xDD, 0xCB, 0xA9, 0x87, 0x66, 0x66, 0x67, 0x78,
+ 0x9A, 0xBC, 0xDD, 0xDD, 0xCA, 0xA9, 0x87, 0x77, 0x77, 0x78, 0x99, 0xAB,
+ 0xCD, 0xDD, 0xEC, 0xBA, 0xA9, 0x88, 0x88, 0x88, 0x99, 0xAB, 0xCD, 0xDD,
+ 0xDE, 0xDC, 0xBB, 0xA9, 0x99, 0x99, 0x9A, 0xAB, 0xCC, 0xDE, 0xEE, 0xEE,
+ 0xDC, 0xCB, 0xBA, 0xAA, 0xAA, 0xBB, 0xCC, 0xDE, 0xEE, 0xEF, 0xFE, 0xDD,
+ 0xCC, 0xBB, 0xBB, 0xBC, 0xCD, 0xDE, 0xEF, 0xEE, 0xFF, 0xFF, 0xED, 0xDD,
+ 0xDC, 0xCD, 0xDD, 0xDE, 0xEF, 0xFE, 0xBE, 0xFE, 0xEE, 0xED, 0xDD, 0xDD,
+ 0xDD, 0xDD, 0xEE, 0xEE, 0xD0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xCE, 0xED, 0xDC, 0xCC, 0xCC, 0xCC, 0xCD, 0xDD, 0xDD, 0xDD, 0x9D, 0xFF,
+ 0xDD, 0xCC, 0xCC, 0xCC, 0xCC, 0xCD, 0xEE, 0xEF, 0xFD, 0xEE, 0xDD, 0xCC,
+ 0xBB, 0xAA, 0xAA, 0xBB, 0xCC, 0xDE, 0xEF, 0xDE, 0xED, 0xCB, 0xBA, 0xA9,
+ 0x99, 0x9A, 0xAB, 0xCD, 0xDE, 0xFE, 0xDD, 0xCB, 0xAA, 0x99, 0x88, 0x88,
+ 0x99, 0xAB, 0xCD, 0xEF, 0xDC, 0xCB, 0xBA, 0x98, 0x87, 0x77, 0x77, 0x89,
+ 0xAB, 0xCD, 0xFD, 0xDC, 0xBA, 0x98, 0x77, 0x66, 0x66, 0x67, 0x89, 0xAB,
+ 0xCE, 0xEC, 0xDB, 0xA9, 0x87, 0x65, 0x55, 0x56, 0x77, 0x8A, 0xBD, 0xED,
+ 0xCC, 0xB9, 0x87, 0x65, 0x55, 0x55, 0x56, 0x78, 0x9B, 0xCD, 0xDC, 0xCB,
+ 0x98, 0x76, 0x55, 0x44, 0x55, 0x67, 0x89, 0xBB, 0xDD, 0xCC, 0xB9, 0x87,
+ 0x65, 0x54, 0x45, 0x56, 0x78, 0x9A, 0xCD, 0xDC, 0xDB, 0x98, 0x76, 0x55,
+ 0x45, 0x55, 0x67, 0x89, 0xAB, 0xDD, 0xCC, 0xBA, 0x97, 0x76, 0x55, 0x55,
+ 0x67, 0x88, 0xAA, 0xCD, 0xDC, 0xDB, 0xA9, 0x87, 0x76, 0x66, 0x67, 0x78,
+ 0x9A, 0xBC, 0xDD, 0xCC, 0xCB, 0xA9, 0x87, 0x77, 0x77, 0x88, 0x9A, 0xAB,
+ 0xCD, 0xDE, 0xED, 0xCB, 0xA9, 0x98, 0x88, 0x89, 0x9A, 0xAB, 0xCC, 0xDD,
+ 0xEE, 0xDC, 0xCB, 0xAA, 0x99, 0x99, 0xAA, 0xAB, 0xCC, 0xEE, 0xDE, 0xFD,
+ 0xDD, 0xCB, 0xBA, 0xBA, 0xAB, 0xBB, 0xCC, 0xDD, 0xFD, 0xFF, 0xFE, 0xDD,
+ 0xDC, 0xCC, 0xCC, 0xCC, 0xDC, 0xDD, 0xFE, 0xEF, 0xFF, 0xEF, 0xEE, 0xDD,
+ 0xDD, 0xDD, 0xDD, 0xDF, 0xFF, 0xEF, 0xAD, 0xDD, 0xDD, 0xDE, 0xDC, 0xDD,
+ 0xDD, 0xDC, 0xDD, 0xDE, 0xC0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xCF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x9F, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFD, 0xDD, 0xFD, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xDD, 0xCC,
+ 0xBC, 0xCC, 0xDF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xDC, 0xBA, 0xAA, 0xAA,
+ 0xBC, 0xDF, 0xFF, 0xFF, 0xFF, 0xFF, 0xDC, 0xBA, 0x98, 0x88, 0x89, 0xAC,
+ 0xDF, 0xFF, 0xFF, 0xFF, 0xFC, 0xBA, 0x88, 0x76, 0x77, 0x89, 0xAC, 0xDF,
+ 0xFF, 0xFF, 0xFD, 0xCA, 0x98, 0x66, 0x55, 0x67, 0x89, 0xBC, 0xFF, 0xFF,
+ 0xFF, 0xFC, 0xA8, 0x76, 0x44, 0x45, 0x67, 0x8A, 0xCF, 0xFF, 0xFF, 0xFD,
+ 0xBA, 0x87, 0x54, 0x33, 0x45, 0x68, 0xAB, 0xDF, 0xFF, 0xFF, 0xDC, 0xA8,
+ 0x75, 0x43, 0x34, 0x56, 0x8A, 0xBD, 0xFF, 0xFF, 0xFF, 0xCA, 0x87, 0x65,
+ 0x44, 0x45, 0x78, 0xAB, 0xDF, 0xFF, 0xFF, 0xFC, 0xB9, 0x86, 0x65, 0x55,
+ 0x67, 0x9A, 0xCD, 0xFF, 0xFF, 0xFF, 0xDC, 0xA9, 0x87, 0x66, 0x77, 0x8A,
+ 0xBC, 0xDF, 0xFF, 0xFF, 0xFF, 0xDC, 0xA9, 0x88, 0x88, 0x99, 0xBC, 0xDF,
+ 0xFF, 0xFF, 0xFF, 0xFD, 0xCC, 0xBA, 0xAA, 0xAA, 0xBC, 0xCF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xEC, 0xCC, 0xBC, 0xCC, 0xDE, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFD, 0xDD, 0xDD, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xAF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xD0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xCE, 0xED, 0xDD, 0xCD, 0xCC, 0xCC, 0xDD, 0xDE, 0xDE, 0xEE, 0x9E, 0xFF,
+ 0xED, 0xDD, 0xDC, 0xCC, 0xCD, 0xDE, 0xFE, 0xFF, 0xFF, 0xDF, 0xED, 0xCC,
+ 0xCB, 0xBB, 0xBB, 0xBC, 0xDD, 0xEF, 0xFF, 0xFE, 0xEE, 0xDC, 0xBA, 0xAA,
+ 0x9A, 0xAA, 0xBB, 0xCD, 0xDF, 0xFE, 0xDD, 0xDC, 0xBA, 0xA9, 0x98, 0x89,
+ 0x9A, 0xAB, 0xCD, 0xEF, 0xED, 0xDC, 0xBA, 0x99, 0x88, 0x77, 0x88, 0x99,
+ 0xAB, 0xCD, 0xEE, 0xCC, 0xCB, 0xA8, 0x87, 0x66, 0x67, 0x78, 0x9A, 0xBC,
+ 0xDE, 0xEC, 0xDB, 0xA9, 0x87, 0x66, 0x55, 0x66, 0x78, 0x9A, 0xBD, 0xED,
+ 0xCC, 0xBA, 0x98, 0x76, 0x54, 0x55, 0x66, 0x79, 0xAB, 0xCE, 0xDC, 0xCB,
+ 0xA8, 0x76, 0x54, 0x34, 0x45, 0x67, 0x8A, 0xBC, 0xED, 0xDC, 0xBA, 0x87,
+ 0x65, 0x54, 0x34, 0x56, 0x78, 0xAB, 0xCD, 0xDC, 0xDB, 0xA9, 0x87, 0x65,
+ 0x44, 0x56, 0x67, 0x9A, 0xBC, 0xDD, 0xCD, 0xCA, 0x98, 0x76, 0x65, 0x56,
+ 0x67, 0x89, 0xAB, 0xCD, 0xDD, 0xDC, 0xBA, 0x98, 0x77, 0x66, 0x67, 0x88,
+ 0x9A, 0xBC, 0xED, 0xDE, 0xDC, 0xA9, 0x98, 0x77, 0x77, 0x89, 0x9A, 0xBC,
+ 0xDD, 0xDD, 0xFD, 0xCB, 0xAA, 0x99, 0x88, 0x99, 0x9A, 0xBC, 0xCD, 0xFE,
+ 0xEF, 0xED, 0xCB, 0xBA, 0xAA, 0xAA, 0xAA, 0xBC, 0xCD, 0xEF, 0xED, 0xFF,
+ 0xED, 0xCC, 0xBB, 0xBB, 0xBB, 0xCC, 0xDD, 0xEE, 0xFE, 0xEF, 0xFF, 0xED,
+ 0xDD, 0xCC, 0xCC, 0xCC, 0xDD, 0xDF, 0xFF, 0xED, 0xFF, 0xFF, 0xEE, 0xED,
+ 0xDD, 0xDD, 0xEE, 0xEF, 0xFF, 0xFE, 0x9E, 0xDD, 0xED, 0xDD, 0xDD, 0xDD,
+ 0xED, 0xDD, 0xDE, 0xEE, 0xB0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xAB, 0xBB, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAB, 0xBC, 0xCD, 0x9B, 0xDC,
+ 0xCB, 0xBA, 0xAA, 0xAA, 0xAA, 0xAB, 0xBC, 0xDD, 0xED, 0xBC, 0xBB, 0xAA,
+ 0x99, 0x99, 0x99, 0x9A, 0xAA, 0xBC, 0xCD, 0xCB, 0xBB, 0xAA, 0x99, 0x88,
+ 0x88, 0x88, 0x99, 0xAA, 0xBC, 0xDC, 0xAB, 0xAA, 0x99, 0x88, 0x77, 0x77,
+ 0x88, 0x89, 0xAA, 0xCC, 0xCA, 0xBA, 0x99, 0x87, 0x77, 0x77, 0x77, 0x78,
+ 0x89, 0xAB, 0xCB, 0xAA, 0x99, 0x87, 0x77, 0x66, 0x66, 0x67, 0x78, 0x9A,
+ 0xAB, 0xBA, 0xA9, 0x88, 0x77, 0x66, 0x66, 0x66, 0x67, 0x88, 0x9A, 0xBB,
+ 0xAA, 0x98, 0x87, 0x66, 0x55, 0x55, 0x66, 0x77, 0x89, 0xAB, 0xBA, 0xA9,
+ 0x87, 0x76, 0x65, 0x55, 0x56, 0x67, 0x78, 0x9A, 0xBA, 0xAA, 0x98, 0x77,
+ 0x66, 0x55, 0x55, 0x66, 0x77, 0x89, 0xAB, 0xAA, 0xA9, 0x87, 0x76, 0x65,
+ 0x55, 0x56, 0x67, 0x78, 0x9A, 0xBA, 0xAA, 0x98, 0x87, 0x66, 0x66, 0x66,
+ 0x67, 0x78, 0x89, 0xAB, 0xBA, 0xBA, 0x98, 0x77, 0x66, 0x66, 0x66, 0x77,
+ 0x89, 0x9A, 0xBB, 0xBB, 0xA9, 0x88, 0x77, 0x77, 0x77, 0x77, 0x89, 0x9A,
+ 0xBC, 0xBB, 0xBB, 0xA9, 0x88, 0x87, 0x77, 0x78, 0x88, 0x9A, 0xAB, 0xCB,
+ 0xBC, 0xBB, 0xA9, 0x98, 0x88, 0x88, 0x89, 0x9A, 0xAB, 0xBC, 0xCC, 0xDC,
+ 0xBB, 0xAA, 0x99, 0x99, 0x99, 0x9A, 0xAB, 0xBC, 0xDC, 0xCD, 0xDC, 0xBB,
+ 0xAA, 0xAA, 0xAA, 0xAA, 0xAB, 0xBC, 0xDD, 0xCC, 0xDD, 0xCC, 0xBB, 0xBB,
+ 0xBB, 0xBB, 0xBC, 0xCC, 0xDD, 0xEC, 0x8D, 0xCC, 0xCB, 0xBB, 0xBA, 0xAA,
+ 0xBB, 0xBB, 0xBC, 0xCD, 0xB0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0x9B, 0xBA, 0xA9, 0x99, 0x99, 0x99, 0x9A, 0xAA, 0xBB, 0xBC, 0x9B, 0xCC,
+ 0xBB, 0xAA, 0xAA, 0x99, 0xAA, 0xAA, 0xBB, 0xCD, 0xDC, 0xAB, 0xBA, 0xAA,
+ 0x99, 0x99, 0x99, 0x99, 0x9A, 0xBB, 0xCC, 0xCA, 0xBA, 0xA9, 0x99, 0x88,
+ 0x88, 0x88, 0x99, 0x9A, 0xBB, 0xCB, 0xAB, 0xA9, 0x98, 0x88, 0x77, 0x77,
+ 0x88, 0x89, 0x9A, 0xBB, 0xBA, 0xA9, 0x98, 0x88, 0x77, 0x77, 0x77, 0x78,
+ 0x89, 0xAA, 0xBB, 0x9A, 0x99, 0x87, 0x77, 0x66, 0x66, 0x67, 0x78, 0x89,
+ 0xAB, 0xA9, 0xA9, 0x88, 0x77, 0x66, 0x66, 0x66, 0x67, 0x78, 0x9A, 0xBA,
+ 0x9A, 0x98, 0x77, 0x66, 0x65, 0x56, 0x66, 0x77, 0x89, 0x9A, 0xA9, 0x99,
+ 0x87, 0x76, 0x66, 0x55, 0x56, 0x67, 0x78, 0x99, 0xAA, 0x9A, 0x98, 0x77,
+ 0x66, 0x55, 0x55, 0x66, 0x77, 0x89, 0x9A, 0xA9, 0xA9, 0x87, 0x76, 0x66,
+ 0x55, 0x66, 0x67, 0x78, 0x99, 0xAA, 0x9A, 0x98, 0x87, 0x66, 0x66, 0x66,
+ 0x67, 0x78, 0x89, 0xAA, 0xAA, 0xA9, 0x88, 0x77, 0x66, 0x66, 0x67, 0x77,
+ 0x89, 0x9A, 0xAA, 0xAA, 0xA9, 0x88, 0x77, 0x77, 0x77, 0x77, 0x88, 0x9A,
+ 0xAB, 0xAA, 0xBA, 0x99, 0x88, 0x87, 0x77, 0x78, 0x88, 0x99, 0xAA, 0xBB,
+ 0xBB, 0xBA, 0x99, 0x88, 0x88, 0x88, 0x89, 0x99, 0xAA, 0xBB, 0xBB, 0xCB,
+ 0xBA, 0xA9, 0x99, 0x99, 0x99, 0x99, 0xAA, 0xBB, 0xCB, 0xBC, 0xCB, 0xBA,
+ 0xAA, 0xA9, 0x9A, 0xAA, 0xAB, 0xBB, 0xCC, 0xBC, 0xDC, 0xCC, 0xBB, 0xAA,
+ 0xAA, 0xAA, 0xBB, 0xBC, 0xCC, 0xDC, 0x9C, 0xCB, 0xBB, 0xAA, 0xAA, 0xAA,
+ 0xAA, 0xAA, 0xBB, 0xBC, 0xA0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xAB, 0xBA, 0xAA, 0xAA, 0x99, 0x9A, 0xAA, 0xAB, 0xBB, 0xCC, 0x8B, 0xCC,
+ 0xBB, 0xAA, 0xAA, 0xAA, 0xAA, 0xAB, 0xBC, 0xCD, 0xDC, 0xBC, 0xBB, 0xAA,
+ 0x99, 0x99, 0x99, 0x99, 0xAA, 0xBC, 0xCD, 0xCB, 0xBB, 0xAA, 0x99, 0x88,
+ 0x88, 0x88, 0x99, 0xAA, 0xBC, 0xCC, 0xAB, 0xAA, 0x99, 0x88, 0x87, 0x77,
+ 0x88, 0x89, 0x9A, 0xBC, 0xBA, 0xAA, 0x99, 0x87, 0x77, 0x77, 0x77, 0x78,
+ 0x89, 0xAB, 0xBB, 0xAA, 0xA9, 0x88, 0x77, 0x66, 0x66, 0x67, 0x78, 0x9A,
+ 0xAB, 0xBA, 0xA9, 0x88, 0x77, 0x66, 0x66, 0x66, 0x67, 0x88, 0x9A, 0xBA,
+ 0x9A, 0x98, 0x77, 0x66, 0x55, 0x55, 0x66, 0x77, 0x89, 0xAB, 0xAA, 0xA9,
+ 0x87, 0x76, 0x65, 0x55, 0x56, 0x67, 0x78, 0x9A, 0xAA, 0x9A, 0x98, 0x77,
+ 0x66, 0x55, 0x55, 0x66, 0x77, 0x89, 0xAB, 0xA9, 0xA9, 0x87, 0x76, 0x65,
+ 0x55, 0x56, 0x67, 0x78, 0x9A, 0xBA, 0xAA, 0x98, 0x87, 0x66, 0x66, 0x66,
+ 0x67, 0x78, 0x89, 0xAB, 0xAA, 0xA9, 0x98, 0x77, 0x66, 0x66, 0x67, 0x77,
+ 0x89, 0xAA, 0xBA, 0xAB, 0xA9, 0x98, 0x77, 0x77, 0x77, 0x78, 0x89, 0x9A,
+ 0xAB, 0xBB, 0xBA, 0xA9, 0x88, 0x87, 0x77, 0x88, 0x89, 0x9A, 0xAB, 0xBB,
+ 0xBC, 0xBA, 0xA9, 0x98, 0x88, 0x88, 0x89, 0x9A, 0xAB, 0xBC, 0xBB, 0xCC,
+ 0xBA, 0xA9, 0x99, 0x99, 0x99, 0x9A, 0xAB, 0xBC, 0xCB, 0xCD, 0xCC, 0xBB,
+ 0xAA, 0xAA, 0xAA, 0xAA, 0xAB, 0xBB, 0xCD, 0xCD, 0xDD, 0xCC, 0xCB, 0xBB,
+ 0xBA, 0xBB, 0xBB, 0xBC, 0xCD, 0xDC, 0x9C, 0xCB, 0xBB, 0xBA, 0xAA, 0xAA,
+ 0xAA, 0xAB, 0xBB, 0xBC, 0xA0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xBD, 0xDC, 0xCC, 0xCC, 0xBB, 0xBB, 0xCC, 0xCC, 0xDD, 0xDD, 0x8D, 0xEE,
+ 0xDD, 0xCC, 0xCC, 0xCB, 0xCC, 0xDD, 0xEF, 0xEE, 0xFE, 0xDE, 0xDC, 0xCC,
+ 0xBB, 0xAB, 0xBB, 0xBB, 0xCC, 0xDD, 0xFF, 0xED, 0xDD, 0xCB, 0xBA, 0xA9,
+ 0x99, 0xAA, 0xAB, 0xBC, 0xDD, 0xFD, 0xCD, 0xCB, 0xAA, 0x99, 0x88, 0x88,
+ 0x99, 0xAA, 0xBC, 0xDE, 0xDC, 0xCB, 0xAA, 0x98, 0x87, 0x77, 0x78, 0x89,
+ 0xAA, 0xCD, 0xDD, 0xCC, 0xBA, 0x98, 0x87, 0x66, 0x66, 0x77, 0x89, 0xAB,
+ 0xCE, 0xDC, 0xCB, 0xA9, 0x87, 0x66, 0x55, 0x66, 0x78, 0x8A, 0xBC, 0xDD,
+ 0xCC, 0xA9, 0x87, 0x66, 0x55, 0x55, 0x66, 0x78, 0x9B, 0xBC, 0xDB, 0xBA,
+ 0x98, 0x76, 0x55, 0x44, 0x45, 0x67, 0x89, 0xAC, 0xCC, 0xCB, 0xB9, 0x87,
+ 0x65, 0x54, 0x34, 0x56, 0x78, 0x9A, 0xCC, 0xCC, 0xCA, 0x98, 0x76, 0x55,
+ 0x54, 0x56, 0x67, 0x89, 0xAB, 0xDC, 0xCC, 0xBA, 0x98, 0x76, 0x65, 0x56,
+ 0x67, 0x89, 0x9A, 0xCC, 0xCC, 0xCB, 0xA9, 0x87, 0x76, 0x66, 0x67, 0x78,
+ 0x9A, 0xBC, 0xDC, 0xCC, 0xBB, 0xA9, 0x88, 0x77, 0x77, 0x88, 0x9A, 0xBB,
+ 0xCD, 0xDD, 0xEC, 0xCB, 0xA9, 0x98, 0x88, 0x89, 0x9A, 0xAB, 0xCC, 0xDD,
+ 0xDD, 0xEC, 0xBB, 0xAA, 0x99, 0x99, 0xAA, 0xAB, 0xCC, 0xDD, 0xDD, 0xFE,
+ 0xDC, 0xCB, 0xBB, 0xAA, 0xAB, 0xBB, 0xBC, 0xDD, 0xED, 0xEF, 0xEE, 0xDD,
+ 0xCC, 0xCB, 0xBB, 0xCC, 0xCC, 0xDD, 0xDE, 0xEE, 0xFF, 0xEE, 0xDE, 0xDD,
+ 0xCD, 0xDC, 0xDD, 0xED, 0xEF, 0xEE, 0x9E, 0xEE, 0xDD, 0xDD, 0xDC, 0xCC,
+ 0xCC, 0xCD, 0xDD, 0xDE, 0xC0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xEF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xAF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xEF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xED, 0xDD, 0xDD, 0xDF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFD, 0xDC, 0xCB,
+ 0xBB, 0xCC, 0xDD, 0xFF, 0xFF, 0xFF, 0xFF, 0xED, 0xDC, 0xBA, 0xAA, 0xAA,
+ 0xBB, 0xCD, 0xFF, 0xFF, 0xFF, 0xFF, 0xDC, 0xBA, 0x98, 0x88, 0x89, 0xAB,
+ 0xCD, 0xFF, 0xFF, 0xFF, 0xEC, 0xBA, 0x98, 0x76, 0x67, 0x89, 0xAB, 0xDD,
+ 0xFF, 0xFF, 0xED, 0xCA, 0x98, 0x66, 0x55, 0x66, 0x89, 0xBC, 0xDF, 0xFF,
+ 0xFF, 0xDB, 0xA8, 0x76, 0x54, 0x44, 0x67, 0x8A, 0xBC, 0xFF, 0xFF, 0xFD,
+ 0xBA, 0x87, 0x54, 0x33, 0x45, 0x68, 0xAB, 0xEF, 0xFF, 0xFF, 0xDB, 0xA8,
+ 0x65, 0x43, 0x34, 0x56, 0x8A, 0xBD, 0xEF, 0xFE, 0xFD, 0xCA, 0x87, 0x64,
+ 0x44, 0x56, 0x78, 0xAB, 0xDE, 0xFF, 0xEF, 0xDC, 0xB9, 0x86, 0x65, 0x56,
+ 0x67, 0x9A, 0xCD, 0xFF, 0xFE, 0xFF, 0xDC, 0xA9, 0x87, 0x66, 0x77, 0x8A,
+ 0xBC, 0xDF, 0xFF, 0xEF, 0xFD, 0xCB, 0xA9, 0x88, 0x88, 0x9A, 0xBB, 0xDE,
+ 0xFF, 0xFF, 0xFF, 0xED, 0xCB, 0xAA, 0xA9, 0xAA, 0xBB, 0xCD, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xDD, 0xDC, 0xCB, 0xBB, 0xBC, 0xCE, 0xFF, 0xFF, 0xFD, 0xFF,
+ 0xFF, 0xFF, 0xDD, 0xDD, 0xDD, 0xDF, 0xFF, 0xFF, 0xFF, 0xEF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xEE, 0xEF, 0xFF, 0xFF, 0xFF, 0xFD, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x8D, 0xDD, 0xDD, 0xDF, 0xEE, 0xEF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xD0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xEF, 0xED, 0xED, 0xDD, 0xCC, 0xCD, 0xDD, 0xDD, 0xED, 0xDE, 0x9E, 0xFF,
+ 0xFE, 0xDD, 0xDC, 0xCC, 0xDD, 0xDE, 0xEE, 0xFE, 0xFE, 0xFE, 0xED, 0xDD,
+ 0xCC, 0xBB, 0xBB, 0xCC, 0xDD, 0xEE, 0xEF, 0xED, 0xFE, 0xDC, 0xBB, 0xAA,
+ 0xAA, 0xAA, 0xBC, 0xCD, 0xEF, 0xFF, 0xDE, 0xDC, 0xBA, 0xA9, 0x99, 0x99,
+ 0x9A, 0xBC, 0xCD, 0xEF, 0xEC, 0xDC, 0xBB, 0xA9, 0x88, 0x77, 0x88, 0x9A,
+ 0xBC, 0xCE, 0xEE, 0xDD, 0xCB, 0xA9, 0x87, 0x66, 0x66, 0x78, 0x9A, 0xBC,
+ 0xEF, 0xDD, 0xCB, 0xA9, 0x87, 0x66, 0x55, 0x66, 0x78, 0x9A, 0xCD, 0xEE,
+ 0xDC, 0xBA, 0x98, 0x66, 0x54, 0x45, 0x56, 0x89, 0xAC, 0xCD, 0xDC, 0xCB,
+ 0xA9, 0x76, 0x54, 0x44, 0x45, 0x67, 0x9A, 0xBC, 0xED, 0xCC, 0xBA, 0x97,
+ 0x65, 0x44, 0x44, 0x56, 0x79, 0xAB, 0xDD, 0xDD, 0xDB, 0xA9, 0x86, 0x55,
+ 0x44, 0x55, 0x67, 0x9A, 0xBD, 0xDD, 0xDE, 0xCB, 0x98, 0x76, 0x55, 0x55,
+ 0x67, 0x89, 0xAB, 0xDE, 0xED, 0xDC, 0xBA, 0x98, 0x76, 0x66, 0x67, 0x89,
+ 0xAB, 0xCD, 0xEE, 0xDE, 0xDC, 0xAA, 0x98, 0x87, 0x78, 0x89, 0x9A, 0xBC,
+ 0xDE, 0xED, 0xED, 0xDB, 0xBA, 0x99, 0x99, 0x99, 0x9A, 0xBC, 0xDD, 0xEF,
+ 0xEE, 0xED, 0xCB, 0xBA, 0xAA, 0xAA, 0xBB, 0xBC, 0xCD, 0xEF, 0xFD, 0xEF,
+ 0xDD, 0xDC, 0xCB, 0xBB, 0xBB, 0xCC, 0xDE, 0xEE, 0xFF, 0xDF, 0xFF, 0xED,
+ 0xDD, 0xCC, 0xDD, 0xCD, 0xDE, 0xEF, 0xFF, 0xFD, 0xFF, 0xFF, 0xEE, 0xEE,
+ 0xDF, 0xDE, 0xEE, 0xEF, 0xFF, 0xFF, 0x9D, 0xED, 0xDE, 0xDE, 0xDE, 0xED,
+ 0xEE, 0xEE, 0xFF, 0xEF, 0xE0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xDE, 0xED, 0xDC, 0xCC, 0xBC, 0xCC, 0xCC, 0xDD, 0xDD, 0xDD, 0xAE, 0xFE,
+ 0xDD, 0xCC, 0xCB, 0xBB, 0xCC, 0xCC, 0xDE, 0xEF, 0xFE, 0xDE, 0xDC, 0xCB,
+ 0xBA, 0xAA, 0xAA, 0xBB, 0xCC, 0xDE, 0xEF, 0xED, 0xDC, 0xCB, 0xAA, 0x99,
+ 0x99, 0x99, 0xAB, 0xBC, 0xDE, 0xEE, 0xCD, 0xCB, 0xA9, 0x98, 0x88, 0x88,
+ 0x89, 0xAA, 0xBC, 0xDE, 0xEC, 0xCB, 0xA9, 0x98, 0x87, 0x77, 0x77, 0x89,
+ 0xAA, 0xCC, 0xED, 0xCC, 0xBA, 0x98, 0x77, 0x66, 0x66, 0x77, 0x89, 0xAB,
+ 0xCD, 0xDC, 0xBA, 0x98, 0x87, 0x65, 0x55, 0x56, 0x77, 0x89, 0xBC, 0xDD,
+ 0xCB, 0xA9, 0x87, 0x65, 0x55, 0x55, 0x56, 0x78, 0x9A, 0xBD, 0xDB, 0xBA,
+ 0x98, 0x76, 0x55, 0x44, 0x55, 0x67, 0x89, 0xAB, 0xCD, 0xCB, 0xA9, 0x87,
+ 0x65, 0x54, 0x45, 0x56, 0x78, 0x9A, 0xBC, 0xCC, 0xBA, 0x98, 0x76, 0x55,
+ 0x55, 0x55, 0x67, 0x89, 0xAB, 0xDD, 0xCC, 0xBA, 0x87, 0x76, 0x55, 0x55,
+ 0x67, 0x78, 0x9A, 0xBD, 0xDC, 0xCB, 0xA9, 0x87, 0x76, 0x66, 0x67, 0x78,
+ 0x9A, 0xBC, 0xDD, 0xDD, 0xCB, 0xA9, 0x87, 0x77, 0x77, 0x88, 0x99, 0xAB,
+ 0xCD, 0xDD, 0xDC, 0xBA, 0xA9, 0x88, 0x88, 0x88, 0x99, 0xAB, 0xCD, 0xDE,
+ 0xDE, 0xDC, 0xBB, 0xAA, 0x99, 0x99, 0x9A, 0xAB, 0xCC, 0xDE, 0xEE, 0xEE,
+ 0xDC, 0xCB, 0xBA, 0xAA, 0xAA, 0xBB, 0xCC, 0xDE, 0xFE, 0xDF, 0xED, 0xDD,
+ 0xCC, 0xCB, 0xBB, 0xBC, 0xCC, 0xDE, 0xEF, 0xED, 0xFF, 0xEE, 0xED, 0xDD,
+ 0xCD, 0xCD, 0xDD, 0xEE, 0xFF, 0xFF, 0xAE, 0xEE, 0xDD, 0xDD, 0xDD, 0xDD,
+ 0xDD, 0xDE, 0xEE, 0xEF, 0xE0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xCF, 0xED, 0xDD, 0xDC, 0xDC, 0xDC, 0xCC, 0xCD, 0xDD, 0xDD, 0x8E, 0xFE,
+ 0xEE, 0xDD, 0xDC, 0xCC, 0xCD, 0xDD, 0xEE, 0xEE, 0xFE, 0xEF, 0xEE, 0xDC,
+ 0xCC, 0xBB, 0xBB, 0xCC, 0xCD, 0xDE, 0xEF, 0xDE, 0xFE, 0xDC, 0xBB, 0xAA,
+ 0xAA, 0xAB, 0xBC, 0xCD, 0xDD, 0xED, 0xDE, 0xDC, 0xBB, 0xA9, 0x99, 0x99,
+ 0x9A, 0xBB, 0xCD, 0xDF, 0xDD, 0xEC, 0xBA, 0x99, 0x88, 0x77, 0x88, 0x9A,
+ 0xBB, 0xDD, 0xFD, 0xDD, 0xCB, 0xA9, 0x87, 0x66, 0x66, 0x78, 0x9A, 0xBC,
+ 0xDD, 0xEC, 0xDC, 0xA9, 0x87, 0x66, 0x55, 0x56, 0x78, 0x9A, 0xBD, 0xEC,
+ 0xCC, 0xBA, 0x98, 0x75, 0x54, 0x45, 0x56, 0x89, 0xAB, 0xCE, 0xDC, 0xCB,
+ 0xA8, 0x76, 0x54, 0x44, 0x45, 0x67, 0x9A, 0xBC, 0xDD, 0xCC, 0xBA, 0x97,
+ 0x65, 0x44, 0x44, 0x56, 0x79, 0xAB, 0xCD, 0xDC, 0xDC, 0xA9, 0x86, 0x55,
+ 0x44, 0x55, 0x78, 0x9A, 0xBC, 0xDD, 0xDD, 0xCA, 0x98, 0x76, 0x55, 0x56,
+ 0x67, 0x89, 0xAC, 0xDD, 0xDD, 0xDC, 0xBA, 0x98, 0x76, 0x66, 0x77, 0x89,
+ 0xAB, 0xBD, 0xED, 0xCD, 0xDC, 0xB9, 0x98, 0x87, 0x78, 0x89, 0x9A, 0xBC,
+ 0xDE, 0xED, 0xDE, 0xCB, 0xBA, 0x99, 0x98, 0x99, 0xAB, 0xBB, 0xCD, 0xEE,
+ 0xDE, 0xED, 0xDC, 0xBA, 0xAA, 0xAA, 0xAB, 0xBC, 0xCD, 0xEE, 0xDD, 0xEE,
+ 0xDC, 0xDC, 0xBC, 0xBC, 0xBB, 0xCC, 0xCD, 0xDD, 0xFD, 0xDF, 0xEE, 0xDE,
+ 0xDC, 0xCD, 0xCD, 0xDD, 0xDD, 0xDE, 0xEE, 0xED, 0xEF, 0xEF, 0xFF, 0xEE,
+ 0xED, 0xDE, 0xED, 0xDD, 0xFF, 0xFD, 0x9D, 0xDD, 0xDE, 0xCD, 0xDC, 0xDD,
+ 0xDD, 0xED, 0xDE, 0xEF, 0xC0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xDF, 0xFF, 0xFF, 0xFF, 0xFE, 0xFF, 0xFF, 0xFD, 0xDF, 0xDD, 0x8F, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFD, 0xDC,
+ 0xCD, 0xDF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFD, 0xCC, 0xBB, 0xBB,
+ 0xCC, 0xDF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFD, 0xBB, 0xA9, 0x99, 0x9A, 0xBC,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xCB, 0x98, 0x87, 0x78, 0x8A, 0xBC, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xCB, 0xA8, 0x76, 0x55, 0x67, 0x9A, 0xCD, 0xFF, 0xFF,
+ 0xFF, 0xFD, 0xB9, 0x76, 0x54, 0x45, 0x68, 0x9B, 0xCF, 0xFF, 0xFF, 0xFF,
+ 0xCB, 0x97, 0x54, 0x23, 0x45, 0x79, 0xBC, 0xFF, 0xFF, 0xFF, 0xFC, 0xA9,
+ 0x75, 0x43, 0x24, 0x57, 0x9B, 0xCF, 0xFF, 0xFF, 0xFF, 0xDB, 0x98, 0x65,
+ 0x44, 0x56, 0x79, 0xBC, 0xFF, 0xFF, 0xFF, 0xFD, 0xCA, 0x87, 0x65, 0x56,
+ 0x78, 0xAB, 0xCF, 0xFF, 0xFF, 0xFF, 0xDC, 0xBA, 0x88, 0x77, 0x78, 0x9A,
+ 0xCF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFC, 0xBA, 0x99, 0x99, 0xAA, 0xCD, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xDC, 0xBB, 0xBA, 0xBB, 0xCD, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xDD, 0xFC, 0xCC, 0xCF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xAF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xCE, 0xDD, 0xDD, 0xCC, 0xCC, 0xCC, 0xCC, 0xCD, 0xDD, 0xDD, 0x9E, 0xEF,
+ 0xDD, 0xCC, 0xCB, 0xCC, 0xCC, 0xCD, 0xDE, 0xFF, 0xFE, 0xDE, 0xED, 0xCC,
+ 0xCB, 0xBA, 0xBA, 0xBB, 0xCD, 0xCD, 0xEE, 0xEE, 0xED, 0xCC, 0xBA, 0xA9,
+ 0x99, 0x9A, 0xBB, 0xBD, 0xDD, 0xFE, 0xDE, 0xCB, 0xBA, 0x99, 0x88, 0x88,
+ 0x99, 0xAB, 0xBC, 0xDE, 0xDC, 0xCC, 0xBA, 0x98, 0x87, 0x77, 0x78, 0x89,
+ 0xAB, 0xCD, 0xEE, 0xCD, 0xBA, 0x98, 0x87, 0x66, 0x66, 0x78, 0x89, 0xBB,
+ 0xCE, 0xDC, 0xCB, 0xA9, 0x87, 0x66, 0x55, 0x66, 0x78, 0x9A, 0xBC, 0xDD,
+ 0xCC, 0xBA, 0x87, 0x66, 0x54, 0x45, 0x56, 0x78, 0x9B, 0xCD, 0xCB, 0xCB,
+ 0x98, 0x76, 0x55, 0x44, 0x45, 0x67, 0x89, 0xBC, 0xCD, 0xCC, 0xB9, 0x87,
+ 0x65, 0x54, 0x44, 0x56, 0x78, 0x9A, 0xBD, 0xDC, 0xCB, 0xA8, 0x76, 0x65,
+ 0x44, 0x56, 0x67, 0x89, 0xAC, 0xDD, 0xCC, 0xBA, 0x98, 0x76, 0x65, 0x56,
+ 0x67, 0x89, 0xAB, 0xCD, 0xDC, 0xCC, 0xA9, 0x88, 0x76, 0x66, 0x67, 0x88,
+ 0x9A, 0xBC, 0xDD, 0xCD, 0xCB, 0xA9, 0x88, 0x77, 0x77, 0x88, 0x9A, 0xBC,
+ 0xDD, 0xDC, 0xEC, 0xBB, 0xA9, 0x98, 0x88, 0x99, 0x99, 0xBB, 0xCD, 0xDD,
+ 0xCE, 0xDC, 0xCB, 0xAA, 0xA9, 0x99, 0xAA, 0xBB, 0xBD, 0xDF, 0xDD, 0xEE,
+ 0xDD, 0xCB, 0xBB, 0xBA, 0xAB, 0xBC, 0xCD, 0xDE, 0xFE, 0xDE, 0xEE, 0xDD,
+ 0xCC, 0xCC, 0xCC, 0xCC, 0xDD, 0xDE, 0xEF, 0xED, 0xFF, 0xEE, 0xDD, 0xDD,
+ 0xDC, 0xDE, 0xDD, 0xEE, 0xEF, 0xFD, 0x8D, 0xDD, 0xDC, 0xCC, 0xCC, 0xCC,
+ 0xDC, 0xDD, 0xDE, 0xDE, 0xC0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xAC, 0xBB, 0xBA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xBB, 0xBC, 0x8C, 0xDC,
+ 0xCB, 0xBB, 0xBA, 0xAA, 0xAA, 0xBB, 0xBC, 0xCD, 0xDC, 0xBC, 0xCB, 0xBA,
+ 0xAA, 0x99, 0x99, 0x9A, 0xAB, 0xBC, 0xDC, 0xCB, 0xCB, 0xBA, 0xA9, 0x98,
+ 0x88, 0x99, 0x99, 0xAB, 0xBC, 0xDC, 0xBC, 0xBA, 0x99, 0x88, 0x88, 0x88,
+ 0x88, 0x99, 0xAB, 0xCC, 0xBA, 0xBA, 0x99, 0x88, 0x77, 0x77, 0x77, 0x88,
+ 0x99, 0xAB, 0xCB, 0xAB, 0xA9, 0x88, 0x77, 0x66, 0x66, 0x77, 0x88, 0x9A,
+ 0xBC, 0xBA, 0xA9, 0x98, 0x77, 0x66, 0x55, 0x66, 0x77, 0x89, 0x9A, 0xBB,
+ 0xAA, 0x99, 0x87, 0x66, 0x55, 0x55, 0x66, 0x78, 0x89, 0xAB, 0xBA, 0xA9,
+ 0x87, 0x76, 0x55, 0x55, 0x55, 0x67, 0x78, 0x9A, 0xBB, 0xAA, 0x98, 0x77,
+ 0x65, 0x55, 0x55, 0x56, 0x77, 0x89, 0xAB, 0xBA, 0xA9, 0x88, 0x76, 0x65,
+ 0x55, 0x56, 0x67, 0x88, 0x9A, 0xBB, 0xAA, 0xA9, 0x87, 0x66, 0x65, 0x56,
+ 0x66, 0x78, 0x99, 0xAB, 0xBA, 0xBA, 0x98, 0x87, 0x76, 0x66, 0x66, 0x78,
+ 0x89, 0xAB, 0xBB, 0xAB, 0xA9, 0x98, 0x87, 0x77, 0x77, 0x77, 0x89, 0x9A,
+ 0xBC, 0xBB, 0xBB, 0xA9, 0x98, 0x88, 0x77, 0x88, 0x89, 0x9A, 0xAB, 0xCB,
+ 0xBC, 0xBB, 0xA9, 0x99, 0x88, 0x88, 0x99, 0x9A, 0xAB, 0xCD, 0xCC, 0xCC,
+ 0xBA, 0xAA, 0x99, 0x99, 0x99, 0xAA, 0xBB, 0xCD, 0xEC, 0xCD, 0xDC, 0xBB,
+ 0xBA, 0xAA, 0xAA, 0xAB, 0xBC, 0xCC, 0xDE, 0xCC, 0xED, 0xCC, 0xCC, 0xCB,
+ 0xBB, 0xBB, 0xBC, 0xCC, 0xDE, 0xDD, 0x8C, 0xCB, 0xCB, 0xBB, 0xBB, 0xBB,
+ 0xBB, 0xCB, 0xCC, 0xCC, 0xB0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0x9B, 0xAA, 0xA9, 0x99, 0x99, 0x99, 0x99, 0xAA, 0xAB, 0xBB, 0x9B, 0xCB,
+ 0xBA, 0xAA, 0xA9, 0x99, 0xAA, 0xAA, 0xBB, 0xCC, 0xDC, 0xAB, 0xBA, 0xA9,
+ 0x99, 0x99, 0x99, 0x99, 0xAA, 0xAB, 0xCC, 0xBA, 0xBA, 0xA9, 0x98, 0x88,
+ 0x88, 0x88, 0x99, 0x9A, 0xAB, 0xCB, 0xAA, 0xA9, 0x98, 0x88, 0x77, 0x77,
+ 0x88, 0x89, 0xAA, 0xBB, 0xA9, 0xAA, 0x98, 0x87, 0x77, 0x77, 0x77, 0x78,
+ 0x89, 0xAA, 0xBA, 0x9A, 0x98, 0x87, 0x77, 0x66, 0x66, 0x77, 0x78, 0x99,
+ 0xAA, 0xA9, 0xA9, 0x88, 0x77, 0x66, 0x66, 0x66, 0x77, 0x88, 0x9A, 0xAA,
+ 0x99, 0x98, 0x77, 0x66, 0x65, 0x56, 0x66, 0x77, 0x89, 0xAA, 0xA9, 0x99,
+ 0x87, 0x76, 0x65, 0x55, 0x56, 0x67, 0x78, 0x99, 0xAA, 0x9A, 0x98, 0x77,
+ 0x66, 0x55, 0x55, 0x66, 0x77, 0x89, 0x9A, 0xA9, 0xA9, 0x87, 0x76, 0x66,
+ 0x55, 0x66, 0x67, 0x78, 0x99, 0xAA, 0x9A, 0x98, 0x87, 0x76, 0x66, 0x66,
+ 0x67, 0x78, 0x89, 0xAA, 0xA9, 0xA9, 0x98, 0x77, 0x76, 0x66, 0x67, 0x77,
+ 0x88, 0x9A, 0xBA, 0xAA, 0xA9, 0x88, 0x77, 0x77, 0x77, 0x77, 0x88, 0x99,
+ 0xAB, 0xAA, 0xBA, 0x99, 0x88, 0x87, 0x77, 0x78, 0x88, 0x99, 0xAA, 0xBA,
+ 0xAB, 0xBA, 0x99, 0x98, 0x88, 0x88, 0x88, 0x99, 0xAA, 0xBB, 0xBB, 0xBB,
+ 0xAA, 0xA9, 0x99, 0x99, 0x99, 0x99, 0xAA, 0xBB, 0xCB, 0xBC, 0xCB, 0xBA,
+ 0xAA, 0xA9, 0x99, 0xAA, 0xAA, 0xBB, 0xCC, 0xBB, 0xCC, 0xCB, 0xBB, 0xBA,
+ 0xAA, 0xAA, 0xAB, 0xBB, 0xCC, 0xDC, 0x9B, 0xBB, 0xAA, 0xAA, 0xAA, 0xAA,
+ 0xAA, 0xAA, 0xBB, 0xBC, 0xA0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xAC, 0xBB, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xBB, 0xBB, 0x8B, 0xDC,
+ 0xCB, 0xBA, 0xAA, 0xAA, 0xAA, 0xBB, 0xBC, 0xCC, 0xDB, 0xBC, 0xCB, 0xAA,
+ 0xA9, 0x99, 0x99, 0xAA, 0xAB, 0xBC, 0xCD, 0xBB, 0xBB, 0xAA, 0x99, 0x98,
+ 0x88, 0x99, 0x9A, 0xAB, 0xBB, 0xDB, 0xBB, 0xAA, 0x99, 0x88, 0x88, 0x88,
+ 0x88, 0x99, 0xAB, 0xBC, 0xBA, 0xBA, 0x99, 0x88, 0x77, 0x77, 0x77, 0x88,
+ 0x9A, 0xAB, 0xCB, 0xAA, 0xA9, 0x88, 0x77, 0x66, 0x66, 0x77, 0x88, 0x9A,
+ 0xBB, 0xBA, 0xA9, 0x98, 0x77, 0x66, 0x55, 0x66, 0x77, 0x89, 0xAA, 0xBA,
+ 0xAA, 0x98, 0x87, 0x66, 0x55, 0x55, 0x66, 0x78, 0x89, 0xAB, 0xAA, 0xA9,
+ 0x88, 0x76, 0x55, 0x55, 0x55, 0x67, 0x88, 0x9A, 0xBA, 0xAA, 0x98, 0x87,
+ 0x65, 0x54, 0x55, 0x56, 0x78, 0x89, 0xAB, 0xAA, 0xAA, 0x98, 0x76, 0x65,
+ 0x55, 0x56, 0x67, 0x88, 0x9A, 0xBA, 0xAB, 0xA9, 0x87, 0x76, 0x65, 0x56,
+ 0x67, 0x78, 0x99, 0xAB, 0xAA, 0xBA, 0x98, 0x87, 0x76, 0x66, 0x66, 0x78,
+ 0x89, 0xAA, 0xBA, 0xAB, 0xAA, 0x98, 0x87, 0x77, 0x77, 0x78, 0x89, 0x9A,
+ 0xBB, 0xBA, 0xBB, 0xAA, 0x98, 0x88, 0x88, 0x88, 0x89, 0x9A, 0xAB, 0xCB,
+ 0xBC, 0xBB, 0xAA, 0x99, 0x98, 0x88, 0x99, 0x9A, 0xAB, 0xCC, 0xBB, 0xCC,
+ 0xBB, 0xAA, 0xA9, 0x99, 0x99, 0xAA, 0xAB, 0xCC, 0xCB, 0xBC, 0xCC, 0xBB,
+ 0xAB, 0xAA, 0xAA, 0xAA, 0xAB, 0xBC, 0xCD, 0xBC, 0xDC, 0xCC, 0xCB, 0xBB,
+ 0xBB, 0xBB, 0xBB, 0xCC, 0xCD, 0xDC, 0x8B, 0xBB, 0xBB, 0xAA, 0xAA, 0xAA,
+ 0xAA, 0xBB, 0xBC, 0xCC, 0xA0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xBE, 0xDD, 0xCC, 0xCC, 0xCC, 0xBC, 0xCC, 0xCC, 0xCC, 0xDC, 0x8E, 0xEE,
+ 0xDD, 0xDC, 0xCC, 0xCC, 0xCC, 0xCD, 0xDD, 0xEF, 0xFD, 0xEE, 0xED, 0xCC,
+ 0xBB, 0xBB, 0xBB, 0xBC, 0xCC, 0xDD, 0xEE, 0xDD, 0xED, 0xCC, 0xBA, 0xAA,
+ 0xA9, 0xAA, 0xAB, 0xCC, 0xDE, 0xFD, 0xCD, 0xDC, 0xBA, 0x99, 0x98, 0x89,
+ 0x9A, 0xAB, 0xCC, 0xDE, 0xDC, 0xDC, 0xBA, 0x98, 0x87, 0x77, 0x78, 0x99,
+ 0xAB, 0xCD, 0xED, 0xCD, 0xBB, 0x99, 0x87, 0x66, 0x66, 0x78, 0x8A, 0xBB,
+ 0xCD, 0xDD, 0xCB, 0xA9, 0x87, 0x66, 0x55, 0x66, 0x78, 0x9A, 0xBC, 0xDD,
+ 0xBC, 0xBA, 0x97, 0x66, 0x54, 0x45, 0x66, 0x89, 0xAB, 0xCD, 0xCC, 0xCB,
+ 0x98, 0x76, 0x54, 0x44, 0x45, 0x67, 0x89, 0xBC, 0xDD, 0xBC, 0xBA, 0x87,
+ 0x65, 0x44, 0x44, 0x56, 0x78, 0x9A, 0xCD, 0xCC, 0xCB, 0xA9, 0x86, 0x65,
+ 0x44, 0x56, 0x67, 0x9A, 0xAC, 0xDD, 0xCC, 0xBA, 0x98, 0x76, 0x65, 0x56,
+ 0x67, 0x89, 0xAB, 0xCD, 0xDC, 0xCC, 0xA9, 0x98, 0x76, 0x66, 0x67, 0x88,
+ 0x9A, 0xBC, 0xDD, 0xCD, 0xCB, 0xA9, 0x98, 0x87, 0x77, 0x88, 0x9A, 0xBC,
+ 0xDD, 0xDC, 0xDD, 0xCB, 0xA9, 0x99, 0x88, 0x99, 0x9A, 0xAB, 0xCD, 0xDD,
+ 0xCD, 0xDD, 0xCB, 0xBA, 0xAA, 0xAA, 0xAA, 0xBC, 0xCD, 0xEF, 0xDD, 0xEE,
+ 0xDC, 0xCB, 0xBB, 0xBA, 0xBB, 0xBC, 0xCC, 0xDE, 0xEE, 0xEE, 0xFE, 0xDD,
+ 0xCC, 0xBC, 0xCC, 0xCC, 0xDD, 0xDE, 0xFF, 0xED, 0xFE, 0xEE, 0xDD, 0xDD,
+ 0xDD, 0xDD, 0xDD, 0xEE, 0xEF, 0xFD, 0x9D, 0xED, 0xCC, 0xDC, 0xCC, 0xDC,
+ 0xDD, 0xDD, 0xEE, 0xED, 0xC0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xDF, 0xFF, 0xFF, 0xFF, 0xFE, 0xFF, 0xFE, 0xFF, 0xEE, 0xFE, 0x9F, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFD, 0xEE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xDC,
+ 0xDC, 0xDD, 0xEE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFD, 0xDC, 0xBB, 0xBB,
+ 0xCD, 0xDF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFD, 0xDB, 0xAA, 0x9A, 0xAB, 0xCC,
+ 0xDF, 0xFF, 0xFF, 0xFF, 0xFD, 0xCB, 0xA9, 0x88, 0x88, 0x9A, 0xBD, 0xEF,
+ 0xFF, 0xFF, 0xFF, 0xDC, 0xA9, 0x87, 0x66, 0x78, 0x9B, 0xCD, 0xFF, 0xFF,
+ 0xFF, 0xFD, 0xBA, 0x86, 0x54, 0x45, 0x78, 0xAC, 0xDE, 0xFF, 0xFF, 0xFF,
+ 0xDB, 0x98, 0x64, 0x22, 0x46, 0x89, 0xBC, 0xFF, 0xFF, 0xFF, 0xFD, 0xBA,
+ 0x86, 0x42, 0x24, 0x68, 0x9B, 0xDE, 0xFF, 0xFD, 0xFF, 0xCC, 0xA8, 0x75,
+ 0x44, 0x56, 0x8A, 0xBD, 0xFF, 0xFF, 0xFF, 0xED, 0xCB, 0x98, 0x76, 0x66,
+ 0x79, 0xAC, 0xDF, 0xFF, 0xFF, 0xFF, 0xFC, 0xCA, 0x98, 0x88, 0x89, 0xAB,
+ 0xDF, 0xFF, 0xFF, 0xFF, 0xFF, 0xDC, 0xBB, 0xAA, 0x9A, 0xAB, 0xCD, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFE, 0xDD, 0xCB, 0xBB, 0xBC, 0xCD, 0xEF, 0xFF, 0xFF,
+ 0xEF, 0xFE, 0xFE, 0xDD, 0xDC, 0xCD, 0xDE, 0xFF, 0xFF, 0xFF, 0xFE, 0xFF,
+ 0xFF, 0xFF, 0xEF, 0xDE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xEF, 0xFF, 0xFF,
+ 0xEF, 0xFD, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x8D, 0xDD, 0xDD, 0xDE, 0xDE, 0xDE,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xD0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xCE, 0xED, 0xDC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCD, 0xCC, 0xDD, 0x9E, 0xEE,
+ 0xEE, 0xED, 0xDC, 0xCD, 0xCD, 0xDD, 0xDD, 0xEF, 0xED, 0xEE, 0xDD, 0xCC,
+ 0xCC, 0xBB, 0xCB, 0xCC, 0xDD, 0xDE, 0xEF, 0xDD, 0xEE, 0xCC, 0xBB, 0xAA,
+ 0xAA, 0xAB, 0xBC, 0xCC, 0xDE, 0xEE, 0xDE, 0xDC, 0xBA, 0xA9, 0x99, 0x99,
+ 0xAA, 0xBC, 0xCC, 0xDE, 0xDC, 0xDC, 0xBA, 0x99, 0x88, 0x78, 0x88, 0x9A,
+ 0xBC, 0xCD, 0xDD, 0xCD, 0xCB, 0xA9, 0x87, 0x66, 0x67, 0x78, 0x9A, 0xBC,
+ 0xDE, 0xDC, 0xDB, 0xA9, 0x87, 0x65, 0x55, 0x56, 0x78, 0xAB, 0xCD, 0xED,
+ 0xCD, 0xBA, 0x98, 0x65, 0x54, 0x45, 0x57, 0x89, 0xBB, 0xCD, 0xDC, 0xDB,
+ 0xA9, 0x76, 0x54, 0x44, 0x45, 0x68, 0x9A, 0xBC, 0xDD, 0xDD, 0xBA, 0x98,
+ 0x65, 0x44, 0x44, 0x56, 0x79, 0xAB, 0xCD, 0xDC, 0xDB, 0xA9, 0x87, 0x55,
+ 0x44, 0x55, 0x68, 0x9A, 0xCC, 0xED, 0xCC, 0xCB, 0xA8, 0x76, 0x55, 0x55,
+ 0x67, 0x89, 0xAB, 0xDD, 0xDC, 0xDC, 0xBA, 0x98, 0x77, 0x66, 0x67, 0x89,
+ 0xAB, 0xCD, 0xED, 0xCD, 0xCC, 0xBA, 0x98, 0x88, 0x78, 0x89, 0x9A, 0xCC,
+ 0xDE, 0xEC, 0xDC, 0xCB, 0xBA, 0x99, 0x99, 0x99, 0xAA, 0xBC, 0xDD, 0xEE,
+ 0xDD, 0xDD, 0xCB, 0xBA, 0xAA, 0xAA, 0xBB, 0xBC, 0xDE, 0xEE, 0xED, 0xED,
+ 0xDD, 0xDC, 0xCB, 0xBB, 0xBB, 0xBD, 0xCD, 0xFE, 0xEE, 0xCE, 0xEE, 0xDD,
+ 0xDD, 0xDC, 0xDD, 0xDD, 0xDE, 0xEE, 0xEE, 0xEC, 0xFE, 0xEE, 0xFE, 0xFD,
+ 0xDD, 0xDD, 0xEE, 0xEF, 0xEF, 0xFE, 0x8D, 0xDC, 0xDD, 0xDD, 0xCD, 0xDD,
+ 0xDD, 0xDD, 0xDE, 0xFE, 0xD0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xCE, 0xDD, 0xCC, 0xCB, 0xBB, 0xBB, 0xBB, 0xCC, 0xCD, 0xDD, 0xAD, 0xEE,
+ 0xDD, 0xCC, 0xBB, 0xBB, 0xBB, 0xCC, 0xDD, 0xDE, 0xFD, 0xDE, 0xDC, 0xCB,
+ 0xBA, 0xAA, 0xAA, 0xAB, 0xBC, 0xCD, 0xEE, 0xDD, 0xDC, 0xCB, 0xAA, 0x99,
+ 0x99, 0x99, 0xAA, 0xBC, 0xCD, 0xDD, 0xCD, 0xCB, 0xA9, 0x98, 0x88, 0x88,
+ 0x89, 0xAA, 0xBC, 0xDD, 0xCC, 0xCB, 0xA9, 0x88, 0x77, 0x77, 0x77, 0x89,
+ 0x9A, 0xBC, 0xDC, 0xCC, 0xAA, 0x98, 0x77, 0x66, 0x66, 0x77, 0x89, 0xAB,
+ 0xCD, 0xCB, 0xBA, 0x98, 0x77, 0x65, 0x55, 0x66, 0x78, 0x89, 0xAC, 0xCC,
+ 0xBB, 0xA9, 0x87, 0x65, 0x55, 0x55, 0x56, 0x78, 0x9A, 0xBC, 0xCB, 0xBA,
+ 0x98, 0x76, 0x55, 0x44, 0x55, 0x67, 0x89, 0xAB, 0xCC, 0xBB, 0xA9, 0x87,
+ 0x65, 0x54, 0x45, 0x56, 0x78, 0x9A, 0xBC, 0xCB, 0xBA, 0x98, 0x76, 0x65,
+ 0x55, 0x55, 0x67, 0x89, 0xAB, 0xDC, 0xBB, 0xB9, 0x88, 0x76, 0x55, 0x55,
+ 0x66, 0x78, 0x9A, 0xBC, 0xCB, 0xCB, 0xA9, 0x87, 0x76, 0x66, 0x67, 0x78,
+ 0x9A, 0xBC, 0xDC, 0xCC, 0xBA, 0xA9, 0x88, 0x77, 0x77, 0x78, 0x89, 0xAB,
+ 0xCD, 0xDC, 0xDC, 0xBA, 0x99, 0x88, 0x88, 0x88, 0x99, 0xAB, 0xCC, 0xED,
+ 0xCD, 0xCC, 0xBA, 0xA9, 0x99, 0x99, 0x9A, 0xAB, 0xBC, 0xDE, 0xDD, 0xDD,
+ 0xDC, 0xBB, 0xAA, 0xAA, 0xAA, 0xBB, 0xCC, 0xDE, 0xFE, 0xDE, 0xDD, 0xCC,
+ 0xCB, 0xBB, 0xBB, 0xBC, 0xCD, 0xDE, 0xEF, 0xED, 0xEE, 0xED, 0xDD, 0xCC,
+ 0xCC, 0xCC, 0xDD, 0xDE, 0xEF, 0xFF, 0xAD, 0xDD, 0xCD, 0xCC, 0xCC, 0xCC,
+ 0xCD, 0xDD, 0xDE, 0xEE, 0xD0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xCD, 0xDD, 0xDC, 0xCC, 0xCC, 0xCB, 0xCC, 0xCC, 0xCC, 0xDC, 0x9D, 0xFE,
+ 0xED, 0xDC, 0xCC, 0xCC, 0xCC, 0xCD, 0xDD, 0xDE, 0xED, 0xDE, 0xED, 0xCC,
+ 0xBB, 0xBB, 0xBB, 0xBB, 0xCC, 0xCD, 0xDE, 0xDD, 0xEC, 0xCB, 0xBA, 0xAA,
+ 0xAA, 0xAA, 0xAB, 0xBC, 0xDE, 0xDC, 0xCD, 0xDC, 0xBA, 0x99, 0x98, 0x99,
+ 0x9A, 0xAB, 0xBC, 0xDE, 0xCC, 0xDC, 0xBA, 0x98, 0x87, 0x77, 0x88, 0x9A,
+ 0xAB, 0xCC, 0xDC, 0xCC, 0xBA, 0xA8, 0x87, 0x66, 0x67, 0x78, 0x9A, 0xBB,
+ 0xCD, 0xCC, 0xCB, 0xA9, 0x87, 0x65, 0x55, 0x66, 0x78, 0x9A, 0xBC, 0xDC,
+ 0xCC, 0xBA, 0x98, 0x65, 0x54, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xCC, 0xCB,
+ 0xA8, 0x76, 0x54, 0x44, 0x45, 0x67, 0x9A, 0xBC, 0xDC, 0xCC, 0xBA, 0x97,
+ 0x65, 0x44, 0x44, 0x56, 0x79, 0xAB, 0xCD, 0xCC, 0xCB, 0xA9, 0x87, 0x65,
+ 0x44, 0x55, 0x68, 0x9A, 0xBC, 0xDC, 0xCC, 0xBA, 0x98, 0x76, 0x65, 0x55,
+ 0x67, 0x89, 0xAB, 0xCD, 0xCC, 0xCB, 0xBA, 0x98, 0x77, 0x66, 0x67, 0x88,
+ 0xAA, 0xBC, 0xDC, 0xCD, 0xCB, 0xA9, 0x98, 0x87, 0x77, 0x89, 0x9A, 0xBC,
+ 0xDE, 0xDC, 0xDC, 0xBB, 0xAA, 0x99, 0x98, 0x99, 0x9A, 0xBB, 0xCD, 0xED,
+ 0xCD, 0xDC, 0xCB, 0xAA, 0xAA, 0xAA, 0xAA, 0xBB, 0xCD, 0xEE, 0xDC, 0xED,
+ 0xCC, 0xCB, 0xBB, 0xBB, 0xBB, 0xBC, 0xCD, 0xDE, 0xED, 0xDE, 0xDD, 0xDC,
+ 0xCC, 0xCC, 0xCC, 0xCC, 0xDD, 0xDE, 0xEF, 0xDD, 0xEE, 0xED, 0xDD, 0xDD,
+ 0xDC, 0xDD, 0xDD, 0xEE, 0xEF, 0xFE, 0x9D, 0xDC, 0xDC, 0xCC, 0xCC, 0xCC,
+ 0xCC, 0xDD, 0xDD, 0xDE, 0xC0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xDF, 0xFF, 0xFE, 0xEE, 0xDD, 0xDD, 0xDD, 0xDC, 0xDD, 0xDD, 0x8F, 0xFF,
+ 0xFF, 0xFF, 0xEE, 0xED, 0xDF, 0xDE, 0xFF, 0xFF, 0xFE, 0xFF, 0xFF, 0xED,
+ 0xDC, 0xDD, 0xDC, 0xDD, 0xDE, 0xFF, 0xFF, 0xEE, 0xFF, 0xDD, 0xDC, 0xCB,
+ 0xBB, 0xBB, 0xCC, 0xDE, 0xFF, 0xFE, 0xFF, 0xED, 0xDC, 0xBA, 0xAA, 0xAA,
+ 0xAB, 0xCD, 0xDE, 0xFF, 0xED, 0xFE, 0xDC, 0xBA, 0x98, 0x88, 0x89, 0xAB,
+ 0xCD, 0xEF, 0xFF, 0xDF, 0xDC, 0xBA, 0x98, 0x76, 0x77, 0x89, 0xAB, 0xCD,
+ 0xFF, 0xFE, 0xED, 0xCA, 0x98, 0x66, 0x55, 0x67, 0x89, 0xBC, 0xDE, 0xFE,
+ 0xED, 0xDB, 0xA8, 0x76, 0x44, 0x44, 0x67, 0x8A, 0xBD, 0xDF, 0xFD, 0xFC,
+ 0xBA, 0x86, 0x54, 0x33, 0x45, 0x78, 0xAB, 0xCE, 0xFE, 0xEE, 0xCB, 0xA8,
+ 0x75, 0x43, 0x34, 0x57, 0x89, 0xBC, 0xFF, 0xFE, 0xED, 0xBA, 0x87, 0x65,
+ 0x44, 0x45, 0x78, 0xAB, 0xDE, 0xFF, 0xDF, 0xDC, 0xA9, 0x87, 0x65, 0x56,
+ 0x68, 0x9A, 0xCD, 0xEF, 0xFE, 0xEE, 0xCB, 0xA9, 0x87, 0x76, 0x78, 0x8A,
+ 0xBC, 0xDF, 0xFF, 0xDE, 0xED, 0xCB, 0xA9, 0x98, 0x88, 0x9A, 0xBC, 0xDE,
+ 0xFF, 0xFE, 0xEE, 0xDD, 0xCB, 0xAA, 0x99, 0xAA, 0xBC, 0xCE, 0xFF, 0xFF,
+ 0xEF, 0xFF, 0xDD, 0xCC, 0xBB, 0xBB, 0xCC, 0xDE, 0xEF, 0xFF, 0xFE, 0xFE,
+ 0xEF, 0xDD, 0xDC, 0xCD, 0xCD, 0xDE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xFF,
+ 0xEE, 0xED, 0xDE, 0xEE, 0xEF, 0xFF, 0xFF, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x9E, 0xDF, 0xFF, 0xFF, 0xFD, 0xFE,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xE0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xCE, 0xED, 0xDD, 0xDC, 0xCC, 0xCC, 0xCC, 0xCC, 0xDD, 0xDD, 0x9E, 0xFF,
+ 0xEE, 0xDE, 0xDC, 0xCC, 0xCD, 0xDD, 0xEE, 0xEF, 0xFE, 0xFF, 0xED, 0xDC,
+ 0xCB, 0xBB, 0xBB, 0xCC, 0xCD, 0xEE, 0xFF, 0xDD, 0xFE, 0xCC, 0xBB, 0xAA,
+ 0xAA, 0xAA, 0xBB, 0xCD, 0xDD, 0xEE, 0xDE, 0xDC, 0xBA, 0xA9, 0x99, 0x99,
+ 0x9A, 0xAB, 0xDE, 0xDE, 0xDD, 0xEC, 0xCA, 0x99, 0x88, 0x77, 0x88, 0x9A,
+ 0xBB, 0xCD, 0xED, 0xCD, 0xCB, 0xA9, 0x87, 0x66, 0x67, 0x78, 0x9A, 0xBC,
+ 0xDD, 0xDC, 0xDB, 0xA9, 0x87, 0x65, 0x55, 0x66, 0x78, 0x9A, 0xBC, 0xED,
+ 0xCC, 0xCA, 0x98, 0x65, 0x54, 0x45, 0x66, 0x89, 0xAB, 0xDD, 0xDC, 0xCB,
+ 0xA8, 0x76, 0x54, 0x44, 0x45, 0x67, 0x9A, 0xBD, 0xDC, 0xCC, 0xBA, 0x87,
+ 0x65, 0x44, 0x44, 0x56, 0x78, 0xAB, 0xCD, 0xEC, 0xCB, 0xA9, 0x86, 0x65,
+ 0x44, 0x55, 0x68, 0x9A, 0xBD, 0xDD, 0xCD, 0xCB, 0x98, 0x76, 0x55, 0x55,
+ 0x67, 0x89, 0xAC, 0xDE, 0xDC, 0xDC, 0xBA, 0x98, 0x77, 0x66, 0x67, 0x89,
+ 0xAB, 0xCD, 0xFD, 0xCE, 0xCB, 0xBA, 0x98, 0x87, 0x77, 0x89, 0x9A, 0xBC,
+ 0xEE, 0xDC, 0xDD, 0xCB, 0xAA, 0x99, 0x99, 0x99, 0xAA, 0xBC, 0xDE, 0xFE,
+ 0xDE, 0xDD, 0xCC, 0xAA, 0xAA, 0xAA, 0xAB, 0xBC, 0xDE, 0xFF, 0xED, 0xEE,
+ 0xDD, 0xCC, 0xBB, 0xBB, 0xBB, 0xCD, 0xDE, 0xEF, 0xFF, 0xDE, 0xEE, 0xDE,
+ 0xDD, 0xCC, 0xCD, 0xDE, 0xEE, 0xEF, 0xFF, 0xED, 0xFF, 0xFE, 0xEE, 0xDD,
+ 0xDD, 0xEE, 0xEE, 0xFF, 0xFF, 0xFF, 0x8D, 0xCD, 0xCD, 0xDD, 0xDC, 0xCD,
+ 0xED, 0xEE, 0xEE, 0xFF, 0xB0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0x9B, 0xBB, 0xBA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xBB, 0xBB, 0x8B, 0xCC,
+ 0xCB, 0xBB, 0xAA, 0xAA, 0xAA, 0xBB, 0xBC, 0xCD, 0xDC, 0xBC, 0xCB, 0xAA,
+ 0xAA, 0x99, 0x99, 0xAA, 0xAB, 0xBC, 0xCD, 0xBB, 0xBB, 0xAA, 0x99, 0x98,
+ 0x88, 0x99, 0x9A, 0xAB, 0xBC, 0xCB, 0xBB, 0xAA, 0x99, 0x88, 0x87, 0x88,
+ 0x89, 0x99, 0xAB, 0xBC, 0xBA, 0xBA, 0x99, 0x87, 0x77, 0x77, 0x77, 0x88,
+ 0x99, 0xAB, 0xCB, 0xAB, 0xA9, 0x88, 0x76, 0x66, 0x66, 0x77, 0x88, 0x9A,
+ 0xBB, 0xBA, 0xAA, 0x98, 0x76, 0x66, 0x55, 0x66, 0x77, 0x89, 0xAA, 0xBB,
+ 0xAA, 0x98, 0x87, 0x66, 0x55, 0x55, 0x66, 0x78, 0x99, 0xAB, 0xBA, 0xA9,
+ 0x88, 0x76, 0x55, 0x55, 0x55, 0x67, 0x88, 0x9A, 0xBA, 0xAA, 0x98, 0x87,
+ 0x65, 0x55, 0x55, 0x56, 0x77, 0x89, 0xAB, 0xBA, 0xA9, 0x98, 0x76, 0x65,
+ 0x55, 0x56, 0x67, 0x88, 0x9A, 0xBB, 0xAA, 0xA9, 0x87, 0x76, 0x65, 0x56,
+ 0x66, 0x78, 0x99, 0xAB, 0xBA, 0xBA, 0x98, 0x87, 0x76, 0x66, 0x66, 0x77,
+ 0x89, 0xAA, 0xBB, 0xAB, 0xAA, 0x98, 0x87, 0x77, 0x77, 0x77, 0x89, 0x9A,
+ 0xBC, 0xBA, 0xCB, 0xAA, 0x98, 0x88, 0x88, 0x88, 0x89, 0x9A, 0xAB, 0xCB,
+ 0xBC, 0xBB, 0xAA, 0x99, 0x98, 0x88, 0x89, 0x9A, 0xAB, 0xCC, 0xCB, 0xCC,
+ 0xBB, 0xAA, 0xA9, 0x99, 0x99, 0xAA, 0xAB, 0xCC, 0xDC, 0xBC, 0xCC, 0xBB,
+ 0xBA, 0xAA, 0xAA, 0xAA, 0xBB, 0xCC, 0xDE, 0xCC, 0xDD, 0xCC, 0xCB, 0xBB,
+ 0xBB, 0xBB, 0xBC, 0xCC, 0xDD, 0xED, 0x8C, 0xBB, 0xBB, 0xBB, 0xAB, 0xAB,
+ 0xBB, 0xBC, 0xCC, 0xCD, 0xA0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0x9B, 0xBA, 0xAA, 0x99, 0x99, 0x99, 0x99, 0xAA, 0xAA, 0xBB, 0x8B, 0xCC,
+ 0xBB, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xBB, 0xCC, 0xCB, 0xBB, 0xBA, 0xAA,
+ 0x99, 0x99, 0x99, 0x99, 0xAA, 0xBB, 0xCC, 0xBA, 0xBA, 0xA9, 0x99, 0x88,
+ 0x88, 0x89, 0x99, 0xAA, 0xBB, 0xCB, 0xAB, 0xA9, 0x98, 0x88, 0x77, 0x88,
+ 0x88, 0x99, 0xAA, 0xBB, 0xAA, 0xAA, 0x98, 0x87, 0x77, 0x77, 0x77, 0x88,
+ 0x99, 0xAA, 0xBA, 0x9A, 0x99, 0x87, 0x76, 0x66, 0x66, 0x77, 0x88, 0x99,
+ 0xAB, 0xA9, 0xA9, 0x88, 0x76, 0x66, 0x66, 0x66, 0x77, 0x89, 0x9A, 0xBA,
+ 0x9A, 0x98, 0x77, 0x66, 0x55, 0x55, 0x66, 0x78, 0x89, 0xAB, 0xA9, 0xA9,
+ 0x87, 0x76, 0x65, 0x55, 0x56, 0x67, 0x88, 0x9A, 0xAA, 0x9A, 0x98, 0x87,
+ 0x66, 0x55, 0x55, 0x66, 0x77, 0x89, 0xAA, 0xA9, 0xA9, 0x88, 0x76, 0x65,
+ 0x55, 0x56, 0x67, 0x78, 0x9A, 0xAA, 0x9A, 0x99, 0x87, 0x76, 0x66, 0x66,
+ 0x66, 0x78, 0x89, 0xAB, 0xA9, 0xA9, 0x98, 0x87, 0x76, 0x66, 0x66, 0x77,
+ 0x89, 0x9A, 0xBA, 0xAB, 0xA9, 0x98, 0x87, 0x77, 0x77, 0x77, 0x88, 0x9A,
+ 0xAB, 0xAA, 0xBA, 0xA9, 0x98, 0x88, 0x77, 0x78, 0x88, 0x99, 0xAB, 0xBB,
+ 0xAB, 0xBA, 0xA9, 0x99, 0x88, 0x88, 0x89, 0x99, 0xAA, 0xBC, 0xBA, 0xCB,
+ 0xBA, 0xAA, 0x99, 0x99, 0x99, 0x9A, 0xAA, 0xBB, 0xCB, 0xBC, 0xCB, 0xBB,
+ 0xAA, 0xAA, 0xAA, 0xAA, 0xAB, 0xBB, 0xCD, 0xBB, 0xDC, 0xCB, 0xBB, 0xBA,
+ 0xAA, 0xBB, 0xBB, 0xBC, 0xCD, 0xDC, 0x9B, 0xBB, 0xAA, 0xAA, 0xAA, 0xAA,
+ 0xAA, 0xAB, 0xBB, 0xBC, 0xA0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0x9B, 0xBB, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xBB, 0xBB, 0x8B, 0xCC,
+ 0xCB, 0xBB, 0xAA, 0xAA, 0xAA, 0xBB, 0xBC, 0xCD, 0xDB, 0xBC, 0xBB, 0xAA,
+ 0xA9, 0x99, 0x99, 0xAA, 0xAB, 0xBB, 0xCD, 0xBB, 0xCB, 0xAA, 0x99, 0x98,
+ 0x88, 0x99, 0x99, 0xAB, 0xBC, 0xCB, 0xAB, 0xAA, 0x99, 0x88, 0x88, 0x88,
+ 0x88, 0x9A, 0xAB, 0xBC, 0xBA, 0xBA, 0x99, 0x87, 0x77, 0x77, 0x77, 0x88,
+ 0x9A, 0xAB, 0xBB, 0xAB, 0xA9, 0x87, 0x76, 0x66, 0x66, 0x77, 0x88, 0x9A,
+ 0xBB, 0xBA, 0xAA, 0x98, 0x76, 0x66, 0x55, 0x66, 0x77, 0x89, 0xAA, 0xBB,
+ 0xAA, 0xA8, 0x87, 0x66, 0x55, 0x55, 0x66, 0x78, 0x99, 0xAB, 0xAA, 0xA9,
+ 0x88, 0x76, 0x55, 0x55, 0x55, 0x67, 0x88, 0x9A, 0xBA, 0xAA, 0x98, 0x87,
+ 0x65, 0x55, 0x55, 0x56, 0x78, 0x89, 0xAB, 0xAA, 0xA9, 0x98, 0x76, 0x65,
+ 0x55, 0x56, 0x67, 0x88, 0x9A, 0xBA, 0xAA, 0xA9, 0x87, 0x76, 0x65, 0x56,
+ 0x66, 0x78, 0x99, 0xAB, 0xAA, 0xBA, 0x98, 0x87, 0x76, 0x66, 0x66, 0x77,
+ 0x89, 0xAA, 0xBB, 0xAB, 0xAA, 0x98, 0x87, 0x77, 0x77, 0x77, 0x89, 0x9A,
+ 0xBB, 0xBA, 0xBB, 0xA9, 0x99, 0x88, 0x88, 0x88, 0x89, 0x9A, 0xBB, 0xCB,
+ 0xBC, 0xBB, 0xAA, 0x99, 0x98, 0x88, 0x99, 0x9A, 0xAB, 0xCD, 0xBB, 0xCC,
+ 0xBB, 0xAA, 0xA9, 0x99, 0x9A, 0xAA, 0xAB, 0xBC, 0xDC, 0xBC, 0xCC, 0xBB,
+ 0xBA, 0xAA, 0xAA, 0xAA, 0xBB, 0xCC, 0xDD, 0xCB, 0xDD, 0xCC, 0xCB, 0xBB,
+ 0xBB, 0xBB, 0xCC, 0xCC, 0xDD, 0xDC, 0x8B, 0xBB, 0xBB, 0xBB, 0xAA, 0xAA,
+ 0xAB, 0xBB, 0xBB, 0xCC, 0xA0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xBD, 0xEC, 0xCC, 0xCB, 0xCB, 0xBB, 0xCC, 0xCC, 0xCC, 0xCD, 0x8D, 0xED,
+ 0xED, 0xDC, 0xCB, 0xBB, 0xBC, 0xCD, 0xCD, 0xEF, 0xFD, 0xDE, 0xED, 0xCB,
+ 0xBB, 0xAA, 0xAA, 0xBB, 0xCC, 0xCE, 0xEE, 0xDD, 0xDD, 0xCB, 0xBA, 0x99,
+ 0x99, 0x9A, 0xAA, 0xBC, 0xDE, 0xED, 0xDD, 0xCB, 0xBA, 0x99, 0x88, 0x88,
+ 0x99, 0xAA, 0xBC, 0xDD, 0xDC, 0xDB, 0xAA, 0x98, 0x87, 0x77, 0x78, 0x89,
+ 0xAB, 0xBC, 0xDC, 0xCD, 0xBA, 0x98, 0x77, 0x66, 0x66, 0x78, 0x89, 0xAB,
+ 0xCD, 0xCB, 0xCA, 0xA9, 0x87, 0x65, 0x55, 0x66, 0x78, 0x99, 0xBC, 0xDC,
+ 0xBB, 0xA9, 0x87, 0x66, 0x54, 0x55, 0x66, 0x78, 0x9A, 0xBC, 0xCB, 0xBA,
+ 0x98, 0x76, 0x54, 0x44, 0x55, 0x67, 0x89, 0xAC, 0xCC, 0xCC, 0xA9, 0x87,
+ 0x65, 0x54, 0x44, 0x56, 0x78, 0x9A, 0xBC, 0xDB, 0xCB, 0x98, 0x76, 0x65,
+ 0x54, 0x55, 0x67, 0x89, 0xAC, 0xDC, 0xCC, 0xBA, 0x98, 0x76, 0x65, 0x55,
+ 0x67, 0x89, 0xAB, 0xCD, 0xDC, 0xCB, 0xA9, 0x88, 0x76, 0x66, 0x67, 0x78,
+ 0x9A, 0xBC, 0xDC, 0xCC, 0xBB, 0xA9, 0x88, 0x77, 0x77, 0x88, 0x9A, 0xBC,
+ 0xDD, 0xDC, 0xDC, 0xBA, 0xA9, 0x98, 0x88, 0x89, 0x9A, 0xAB, 0xCD, 0xDD,
+ 0xCD, 0xDC, 0xBB, 0xAA, 0x99, 0x99, 0xAA, 0xBB, 0xCD, 0xDE, 0xEC, 0xED,
+ 0xDC, 0xCB, 0xBA, 0xAA, 0xAB, 0xBB, 0xCC, 0xDE, 0xED, 0xDE, 0xED, 0xDC,
+ 0xCC, 0xBC, 0xBC, 0xCC, 0xDD, 0xDE, 0xFF, 0xED, 0xFF, 0xDD, 0xDD, 0xDD,
+ 0xCD, 0xDD, 0xDD, 0xEE, 0xEF, 0xFE, 0x9D, 0xDD, 0xDD, 0xDD, 0xCC, 0xCC,
+ 0xCC, 0xDD, 0xEE, 0xEE, 0xC0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xDF, 0xFE, 0xED, 0xDE, 0xDD, 0xDD, 0xDD, 0xDD, 0xCC, 0xDD, 0x9F, 0xFF,
+ 0xFF, 0xEE, 0xDE, 0xDD, 0xDD, 0xDE, 0xEE, 0xEF, 0xFD, 0xEF, 0xEF, 0xEE,
+ 0xDD, 0xCC, 0xCC, 0xCD, 0xCD, 0xEE, 0xFF, 0xDF, 0xFF, 0xED, 0xCC, 0xCB,
+ 0xBB, 0xBB, 0xCC, 0xDD, 0xDE, 0xFE, 0xDE, 0xDD, 0xCC, 0xAA, 0xAA, 0xAA,
+ 0xAB, 0xBC, 0xDD, 0xFF, 0xEE, 0xFD, 0xCB, 0xBA, 0x98, 0x88, 0x89, 0xAA,
+ 0xBC, 0xDF, 0xFF, 0xEE, 0xDC, 0xB9, 0x87, 0x77, 0x77, 0x89, 0xAB, 0xCD,
+ 0xEF, 0xEE, 0xEC, 0xBA, 0x97, 0x66, 0x55, 0x67, 0x89, 0xAB, 0xCE, 0xFE,
+ 0xDE, 0xCB, 0xA8, 0x76, 0x44, 0x45, 0x67, 0x8A, 0xBC, 0xDE, 0xED, 0xEC,
+ 0xB9, 0x87, 0x54, 0x33, 0x45, 0x78, 0x9B, 0xCE, 0xEE, 0xDD, 0xCB, 0x98,
+ 0x75, 0x43, 0x34, 0x56, 0x8A, 0xBC, 0xDF, 0xED, 0xEC, 0xCA, 0x87, 0x65,
+ 0x44, 0x45, 0x78, 0xAB, 0xDE, 0xEE, 0xDD, 0xDB, 0xA9, 0x87, 0x65, 0x55,
+ 0x67, 0x9A, 0xCD, 0xFF, 0xED, 0xDE, 0xCB, 0xA9, 0x87, 0x77, 0x77, 0x8A,
+ 0xBC, 0xEF, 0xFF, 0xDF, 0xDC, 0xBA, 0xA9, 0x88, 0x88, 0x9A, 0xBB, 0xCE,
+ 0xEF, 0xFD, 0xED, 0xDC, 0xCB, 0xAA, 0xAA, 0xAA, 0xBB, 0xCD, 0xEF, 0xFF,
+ 0xDF, 0xED, 0xDC, 0xCB, 0xBB, 0xBB, 0xBC, 0xCD, 0xEF, 0xFF, 0xFD, 0xEE,
+ 0xDD, 0xDD, 0xCC, 0xCD, 0xCD, 0xDD, 0xFF, 0xFF, 0xFF, 0xDF, 0xEF, 0xEF,
+ 0xDD, 0xEE, 0xDE, 0xEE, 0xEF, 0xFF, 0xFF, 0xFD, 0xFF, 0xFF, 0xFE, 0xFE,
+ 0xFF, 0xEF, 0xFF, 0xFF, 0xFF, 0xFF, 0x8C, 0xDD, 0xDE, 0xDE, 0xED, 0xDD,
+ 0xEE, 0xFF, 0xFF, 0xFF, 0xE0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xCD, 0xDD, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCD, 0x9D, 0xFE,
+ 0xED, 0xDC, 0xCC, 0xCC, 0xCC, 0xCD, 0xDE, 0xEF, 0xED, 0xDE, 0xDD, 0xCC,
+ 0xCB, 0xBB, 0xBB, 0xBB, 0xBC, 0xDD, 0xEF, 0xDD, 0xDD, 0xCC, 0xBB, 0xAA,
+ 0xAA, 0xAA, 0xBB, 0xBC, 0xDD, 0xED, 0xCD, 0xDB, 0xBA, 0x99, 0x98, 0x89,
+ 0x9A, 0xAB, 0xCC, 0xEE, 0xDC, 0xDC, 0xBA, 0x98, 0x88, 0x77, 0x88, 0x99,
+ 0xAB, 0xCD, 0xDD, 0xCC, 0xBA, 0x98, 0x87, 0x66, 0x67, 0x78, 0x9A, 0xAB,
+ 0xDD, 0xDC, 0xCB, 0xA9, 0x87, 0x65, 0x55, 0x66, 0x78, 0x9A, 0xBD, 0xDD,
+ 0xCC, 0xBA, 0x98, 0x65, 0x54, 0x45, 0x67, 0x89, 0xAB, 0xCE, 0xDB, 0xCB,
+ 0xA9, 0x76, 0x54, 0x44, 0x45, 0x67, 0x8A, 0xBC, 0xDC, 0xCC, 0xBA, 0x97,
+ 0x65, 0x44, 0x44, 0x56, 0x79, 0xAB, 0xCD, 0xDC, 0xCB, 0xA9, 0x87, 0x65,
+ 0x44, 0x55, 0x67, 0x9A, 0xBC, 0xDD, 0xCC, 0xBA, 0x98, 0x76, 0x65, 0x55,
+ 0x67, 0x89, 0xAB, 0xCE, 0xDC, 0xCC, 0xAA, 0x98, 0x77, 0x66, 0x67, 0x88,
+ 0x9B, 0xBD, 0xED, 0xCD, 0xCB, 0xA9, 0x98, 0x87, 0x77, 0x88, 0x9A, 0xBC,
+ 0xEE, 0xDC, 0xDD, 0xCB, 0xAA, 0x99, 0x98, 0x99, 0xAA, 0xBC, 0xDE, 0xEE,
+ 0xCD, 0xDC, 0xBB, 0xAA, 0xAA, 0xAA, 0xAB, 0xBC, 0xDD, 0xFF, 0xEC, 0xDD,
+ 0xDC, 0xCB, 0xBB, 0xBB, 0xBB, 0xCC, 0xDD, 0xEF, 0xFE, 0xCF, 0xEE, 0xDD,
+ 0xCC, 0xCC, 0xCC, 0xCD, 0xDE, 0xEF, 0xFF, 0xED, 0xEE, 0xED, 0xDD, 0xDD,
+ 0xDD, 0xDD, 0xEE, 0xFE, 0xFF, 0xFE, 0x8C, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD,
+ 0xDD, 0xEE, 0xEE, 0xEF, 0xD0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xDE, 0xDD, 0xCC, 0xCC, 0xBB, 0xBB, 0xBB, 0xCC, 0xCC, 0xCC, 0x9E, 0xEE,
+ 0xDD, 0xCC, 0xCB, 0xBB, 0xBC, 0xCC, 0xDD, 0xDE, 0xED, 0xDE, 0xDC, 0xCB,
+ 0xBB, 0xAA, 0xAA, 0xBB, 0xBC, 0xCD, 0xDE, 0xDD, 0xDD, 0xCB, 0xAA, 0xA9,
+ 0x99, 0x9A, 0xAA, 0xBC, 0xCD, 0xED, 0xCD, 0xCB, 0xAA, 0x98, 0x88, 0x88,
+ 0x99, 0xAA, 0xBC, 0xDD, 0xDC, 0xCB, 0xA9, 0x98, 0x77, 0x77, 0x78, 0x89,
+ 0xAB, 0xBC, 0xDC, 0xCC, 0xBA, 0x98, 0x77, 0x66, 0x67, 0x78, 0x89, 0xAB,
+ 0xCC, 0xCC, 0xCB, 0x99, 0x87, 0x65, 0x55, 0x66, 0x78, 0x9A, 0xBC, 0xDC,
+ 0xCB, 0xA9, 0x87, 0x65, 0x54, 0x55, 0x67, 0x78, 0x9A, 0xBC, 0xCB, 0xBA,
+ 0x98, 0x76, 0x54, 0x44, 0x55, 0x67, 0x89, 0xAB, 0xCC, 0xBB, 0xA9, 0x87,
+ 0x65, 0x54, 0x44, 0x56, 0x78, 0x9A, 0xBC, 0xCB, 0xBA, 0x98, 0x87, 0x65,
+ 0x54, 0x55, 0x67, 0x89, 0xAC, 0xDC, 0xBC, 0xBA, 0x98, 0x76, 0x65, 0x55,
+ 0x67, 0x89, 0x9B, 0xCD, 0xCB, 0xCB, 0xA9, 0x88, 0x77, 0x66, 0x67, 0x78,
+ 0x9A, 0xBC, 0xDD, 0xCC, 0xBB, 0xA9, 0x88, 0x77, 0x77, 0x78, 0x99, 0xAB,
+ 0xCD, 0xDC, 0xCC, 0xBA, 0xA9, 0x98, 0x88, 0x88, 0x99, 0xAB, 0xCD, 0xDD,
+ 0xCD, 0xCC, 0xBB, 0xAA, 0x99, 0x99, 0xAA, 0xAB, 0xBC, 0xDE, 0xEC, 0xDD,
+ 0xCC, 0xBB, 0xBA, 0xAA, 0xAB, 0xBB, 0xCC, 0xDE, 0xEE, 0xDE, 0xDD, 0xCC,
+ 0xCB, 0xBB, 0xBB, 0xCC, 0xCD, 0xDE, 0xEF, 0xED, 0xEE, 0xDD, 0xDD, 0xCC,
+ 0xCC, 0xCD, 0xDD, 0xEE, 0xEF, 0xFE, 0xAD, 0xDD, 0xCC, 0xCC, 0xCC, 0xCC,
+ 0xCD, 0xDD, 0xDE, 0xEF, 0xD0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xCE, 0xDD, 0xDD, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0x9D, 0xFF,
+ 0xED, 0xDD, 0xCC, 0xCC, 0xCC, 0xDD, 0xDE, 0xEE, 0xFD, 0xDE, 0xED, 0xCC,
+ 0xCB, 0xBB, 0xBB, 0xBC, 0xCC, 0xDD, 0xEF, 0xDD, 0xDD, 0xCC, 0xBA, 0xAA,
+ 0xAA, 0xAA, 0xBB, 0xCC, 0xDE, 0xEC, 0xDD, 0xDC, 0xBA, 0x99, 0x99, 0x99,
+ 0x9A, 0xAB, 0xCD, 0xDE, 0xDC, 0xDC, 0xBA, 0x98, 0x87, 0x77, 0x88, 0x9A,
+ 0xAB, 0xCD, 0xED, 0xCC, 0xBA, 0x98, 0x77, 0x66, 0x67, 0x78, 0x9A, 0xAC,
+ 0xCD, 0xDC, 0xCB, 0xA9, 0x87, 0x65, 0x55, 0x66, 0x78, 0x9A, 0xBC, 0xDD,
+ 0xCC, 0xBA, 0x97, 0x65, 0x54, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xDC, 0xCB,
+ 0xA9, 0x76, 0x54, 0x44, 0x45, 0x67, 0x9A, 0xBC, 0xDD, 0xCC, 0xBA, 0x97,
+ 0x65, 0x44, 0x44, 0x56, 0x79, 0xAB, 0xCD, 0xDC, 0xCB, 0xA9, 0x87, 0x65,
+ 0x44, 0x55, 0x67, 0x9A, 0xBC, 0xDD, 0xCC, 0xBA, 0x98, 0x76, 0x65, 0x55,
+ 0x67, 0x89, 0xAB, 0xCD, 0xDC, 0xDC, 0xBA, 0x98, 0x77, 0x66, 0x67, 0x88,
+ 0x9A, 0xCC, 0xDD, 0xCD, 0xCB, 0xBA, 0x98, 0x87, 0x77, 0x88, 0x9A, 0xBC,
+ 0xDD, 0xDC, 0xDD, 0xCB, 0xAA, 0x99, 0x99, 0x99, 0x9A, 0xBB, 0xCD, 0xED,
+ 0xCD, 0xDC, 0xCB, 0xBA, 0xAA, 0xAA, 0xAB, 0xBC, 0xCD, 0xEE, 0xDC, 0xED,
+ 0xDC, 0xCC, 0xBB, 0xBB, 0xBB, 0xBC, 0xCD, 0xDE, 0xFD, 0xCE, 0xED, 0xDD,
+ 0xCC, 0xCC, 0xCC, 0xCD, 0xDD, 0xEE, 0xFF, 0xED, 0xEE, 0xEE, 0xDE, 0xDD,
+ 0xDD, 0xDE, 0xDE, 0xEE, 0xFF, 0xFE, 0x9D, 0xDC, 0xCD, 0xDD, 0xCC, 0xCD,
+ 0xDD, 0xDD, 0xDE, 0xEE, 0xD0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xCF, 0xFF, 0xEE, 0xDD, 0xCD, 0xCC, 0xDC, 0xCC, 0xDD, 0xCD, 0x8F, 0xFF,
+ 0xFF, 0xFE, 0xED, 0xEE, 0xDD, 0xDE, 0xEE, 0xFF, 0xFD, 0xEF, 0xFF, 0xEE,
+ 0xDD, 0xCC, 0xCD, 0xDD, 0xDE, 0xEE, 0xEF, 0xDE, 0xFE, 0xED, 0xDC, 0xCB,
+ 0xBB, 0xBC, 0xCC, 0xDE, 0xEF, 0xFE, 0xEE, 0xEE, 0xCC, 0xBA, 0xAA, 0xAA,
+ 0xAB, 0xCC, 0xCE, 0xEF, 0xED, 0xED, 0xDC, 0xBA, 0x98, 0x88, 0x89, 0xAA,
+ 0xCD, 0xDE, 0xFE, 0xDE, 0xDC, 0xBA, 0x88, 0x77, 0x77, 0x89, 0xAB, 0xCD,
+ 0xEF, 0xEE, 0xED, 0xCB, 0x98, 0x65, 0x55, 0x67, 0x89, 0xAC, 0xDE, 0xFE,
+ 0xEE, 0xDB, 0xA9, 0x75, 0x44, 0x45, 0x67, 0x8A, 0xBD, 0xEF, 0xED, 0xEC,
+ 0xCA, 0x87, 0x54, 0x33, 0x45, 0x78, 0xAB, 0xCE, 0xFE, 0xDD, 0xCB, 0xA8,
+ 0x75, 0x43, 0x34, 0x57, 0x8A, 0xBD, 0xEF, 0xED, 0xDC, 0xBA, 0x97, 0x65,
+ 0x44, 0x45, 0x78, 0xAB, 0xDE, 0xEE, 0xDE, 0xCB, 0xA9, 0x87, 0x65, 0x55,
+ 0x68, 0x9A, 0xCD, 0xEF, 0xFD, 0xED, 0xCB, 0xA9, 0x87, 0x76, 0x78, 0x9A,
+ 0xBC, 0xEE, 0xFF, 0xDF, 0xDC, 0xBA, 0xA9, 0x88, 0x88, 0x9A, 0xBC, 0xDE,
+ 0xEF, 0xED, 0xFE, 0xDD, 0xCB, 0xBA, 0xAA, 0xAA, 0xBC, 0xDE, 0xDE, 0xFE,
+ 0xDF, 0xED, 0xDC, 0xCC, 0xBB, 0xBB, 0xCC, 0xDE, 0xEE, 0xFF, 0xED, 0xEF,
+ 0xED, 0xDD, 0xCD, 0xDD, 0xDD, 0xEE, 0xFF, 0xFE, 0xFE, 0xDF, 0xFE, 0xDE,
+ 0xEE, 0xEE, 0xDE, 0xEE, 0xFF, 0xEF, 0xFE, 0xFE, 0xFF, 0xEE, 0xEE, 0xEF,
+ 0xFF, 0xEF, 0xFF, 0xFF, 0xFF, 0xFF, 0x9D, 0xDD, 0xDD, 0xDD, 0xDD, 0xEE,
+ 0xEE, 0xFE, 0xFF, 0xFF, 0xE0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xBD, 0xDC, 0xCC, 0xBB, 0xBB, 0xCC, 0xCC, 0xBC, 0xBC, 0xCD, 0x8D, 0xEE,
+ 0xDD, 0xDC, 0xCC, 0xCC, 0xCC, 0xCD, 0xDD, 0xEE, 0xED, 0xDE, 0xED, 0xDC,
+ 0xBB, 0xBB, 0xBB, 0xBC, 0xCC, 0xCD, 0xDF, 0xDC, 0xDC, 0xCC, 0xBA, 0xAA,
+ 0xAA, 0xAA, 0xBB, 0xCC, 0xDD, 0xED, 0xCD, 0xCC, 0xBA, 0x99, 0x99, 0x99,
+ 0x9A, 0xAB, 0xCC, 0xDE, 0xDC, 0xDC, 0xBA, 0x99, 0x88, 0x77, 0x88, 0x99,
+ 0xAB, 0xCD, 0xED, 0xCD, 0xCB, 0x98, 0x87, 0x66, 0x67, 0x78, 0x9A, 0xBC,
+ 0xCD, 0xCC, 0xCB, 0xA9, 0x87, 0x65, 0x55, 0x66, 0x78, 0x9A, 0xBD, 0xDC,
+ 0xCD, 0xBA, 0x97, 0x65, 0x54, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xCC, 0xCB,
+ 0xA8, 0x76, 0x54, 0x44, 0x45, 0x67, 0x9A, 0xBC, 0xED, 0xCC, 0xBA, 0x97,
+ 0x65, 0x44, 0x44, 0x56, 0x79, 0xAB, 0xCD, 0xDC, 0xCB, 0xA9, 0x87, 0x65,
+ 0x44, 0x55, 0x67, 0x9A, 0xBC, 0xDD, 0xCD, 0xBA, 0x98, 0x76, 0x65, 0x55,
+ 0x67, 0x89, 0xAC, 0xCE, 0xCC, 0xDC, 0xBA, 0x98, 0x77, 0x66, 0x67, 0x89,
+ 0x9A, 0xBC, 0xED, 0xCC, 0xCB, 0xA9, 0x98, 0x87, 0x77, 0x89, 0x9A, 0xBC,
+ 0xDF, 0xDC, 0xDC, 0xCB, 0xAA, 0x99, 0x99, 0x99, 0xAA, 0xBC, 0xDD, 0xED,
+ 0xCE, 0xDC, 0xCB, 0xBA, 0xAA, 0xAA, 0xAA, 0xBB, 0xCD, 0xDF, 0xDC, 0xED,
+ 0xDD, 0xCC, 0xBB, 0xBB, 0xBB, 0xCC, 0xDD, 0xEE, 0xEE, 0xDE, 0xED, 0xDD,
+ 0xCC, 0xCC, 0xCC, 0xCD, 0xDD, 0xDF, 0xEF, 0xED, 0xFF, 0xEE, 0xED, 0xDC,
+ 0xDD, 0xDD, 0xEE, 0xEE, 0xFF, 0xFE, 0x7C, 0xCD, 0xCC, 0xCC, 0xCC, 0xCD,
+ 0xDD, 0xDD, 0xED, 0xEE, 0xC0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xAB, 0xBB, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xBB, 0x8B, 0xDC,
+ 0xCB, 0xBA, 0xAA, 0xAA, 0xAA, 0xAB, 0xBC, 0xCC, 0xDC, 0xBC, 0xBB, 0xAA,
+ 0xA9, 0x99, 0x99, 0x9A, 0xAA, 0xBC, 0xCD, 0xBB, 0xCB, 0xAA, 0x99, 0x98,
+ 0x88, 0x99, 0x9A, 0xAB, 0xBC, 0xCB, 0xAB, 0xAA, 0x98, 0x88, 0x88, 0x88,
+ 0x88, 0x99, 0xAB, 0xBC, 0xBA, 0xBA, 0x99, 0x88, 0x77, 0x77, 0x77, 0x88,
+ 0x99, 0xAB, 0xCB, 0xAA, 0xA9, 0x87, 0x76, 0x66, 0x66, 0x77, 0x88, 0x9A,
+ 0xBB, 0xBA, 0xA9, 0x98, 0x76, 0x66, 0x55, 0x66, 0x77, 0x89, 0x9A, 0xBB,
+ 0xAA, 0x98, 0x87, 0x66, 0x55, 0x55, 0x66, 0x78, 0x99, 0xAB, 0xA9, 0xA9,
+ 0x88, 0x76, 0x55, 0x55, 0x55, 0x67, 0x88, 0x9A, 0xBB, 0xAA, 0x98, 0x87,
+ 0x66, 0x55, 0x55, 0x56, 0x77, 0x89, 0xAB, 0xAA, 0xA9, 0x98, 0x76, 0x65,
+ 0x55, 0x56, 0x67, 0x88, 0x9A, 0xBB, 0xAA, 0xA9, 0x87, 0x76, 0x65, 0x56,
+ 0x66, 0x78, 0x99, 0xAB, 0xBA, 0xBA, 0x98, 0x87, 0x76, 0x66, 0x66, 0x77,
+ 0x89, 0x9A, 0xBB, 0xAB, 0xAA, 0x98, 0x87, 0x77, 0x77, 0x77, 0x89, 0x9A,
+ 0xBB, 0xBA, 0xBB, 0xA9, 0x98, 0x88, 0x87, 0x88, 0x89, 0x9A, 0xAB, 0xCB,
+ 0xAB, 0xBB, 0xAA, 0x99, 0x98, 0x88, 0x99, 0x9A, 0xAB, 0xBC, 0xCB, 0xCB,
+ 0xBB, 0xAA, 0xA9, 0x99, 0x99, 0xAA, 0xAB, 0xBC, 0xDC, 0xBC, 0xCC, 0xBB,
+ 0xAA, 0xAA, 0xAA, 0xAA, 0xBB, 0xCC, 0xDD, 0xCB, 0xDD, 0xCC, 0xBB, 0xBB,
+ 0xBB, 0xBB, 0xBC, 0xCC, 0xDE, 0xED, 0x8B, 0xBB, 0xBB, 0xBB, 0xBA, 0xAA,
+ 0xBB, 0xBB, 0xCC, 0xCD, 0xB0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xAB, 0xBA, 0xAA, 0x99, 0x99, 0x99, 0x99, 0xAA, 0xAA, 0xBB, 0x8B, 0xCC,
+ 0xBB, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xBB, 0xCC, 0xCB, 0xBB, 0xBA, 0xA9,
+ 0x99, 0x99, 0x99, 0x99, 0xAA, 0xAB, 0xBC, 0xBA, 0xBA, 0xA9, 0x98, 0x88,
+ 0x88, 0x88, 0x99, 0xAA, 0xAB, 0xCB, 0xAB, 0xA9, 0x98, 0x88, 0x77, 0x78,
+ 0x88, 0x99, 0xAA, 0xBB, 0xAA, 0xA9, 0x98, 0x87, 0x77, 0x77, 0x77, 0x88,
+ 0x99, 0xAA, 0xBA, 0x9A, 0x98, 0x87, 0x76, 0x66, 0x66, 0x77, 0x88, 0x99,
+ 0xAB, 0xA9, 0xA9, 0x88, 0x76, 0x66, 0x66, 0x66, 0x77, 0x88, 0x9A, 0xBA,
+ 0x9A, 0x98, 0x77, 0x66, 0x55, 0x56, 0x66, 0x78, 0x89, 0xAA, 0xA9, 0x99,
+ 0x87, 0x76, 0x65, 0x55, 0x56, 0x67, 0x78, 0x9A, 0xAA, 0x9A, 0x98, 0x77,
+ 0x66, 0x55, 0x55, 0x66, 0x77, 0x89, 0xAA, 0xA9, 0xA9, 0x88, 0x76, 0x66,
+ 0x55, 0x56, 0x67, 0x78, 0x9A, 0xAA, 0x9A, 0x98, 0x87, 0x76, 0x66, 0x66,
+ 0x66, 0x78, 0x89, 0xAA, 0xA9, 0xA9, 0x98, 0x87, 0x76, 0x66, 0x66, 0x77,
+ 0x89, 0x9A, 0xBA, 0xAA, 0xA9, 0x98, 0x87, 0x77, 0x77, 0x77, 0x88, 0x9A,
+ 0xAB, 0xAA, 0xBA, 0xA9, 0x98, 0x88, 0x77, 0x78, 0x88, 0x99, 0xAB, 0xBB,
+ 0xAB, 0xBA, 0xA9, 0x99, 0x88, 0x88, 0x88, 0x99, 0xAA, 0xBC, 0xBA, 0xBB,
+ 0xBA, 0xA9, 0x99, 0x99, 0x99, 0x9A, 0xAA, 0xBC, 0xCB, 0xBC, 0xBB, 0xBA,
+ 0xAA, 0xAA, 0xAA, 0xAA, 0xAB, 0xBC, 0xCD, 0xCB, 0xCC, 0xCB, 0xBB, 0xBA,
+ 0xAA, 0xAB, 0xBB, 0xBC, 0xCC, 0xDC, 0x8B, 0xBB, 0xAA, 0xAA, 0xAA, 0xAA,
+ 0xAA, 0xAB, 0xBB, 0xCC, 0xB0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xAC, 0xBB, 0xBA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xBB, 0xBB, 0x8C, 0xDC,
+ 0xBB, 0xBB, 0xAA, 0xAA, 0xAA, 0xBB, 0xBC, 0xCD, 0xDC, 0xBC, 0xBB, 0xAA,
+ 0xA9, 0x99, 0x99, 0xAA, 0xAB, 0xBB, 0xCC, 0xBB, 0xBB, 0xAA, 0x99, 0x98,
+ 0x88, 0x89, 0x9A, 0xAB, 0xBB, 0xCB, 0xBB, 0xAA, 0x99, 0x88, 0x87, 0x88,
+ 0x89, 0x99, 0xAB, 0xBC, 0xBA, 0xBA, 0x99, 0x87, 0x77, 0x77, 0x77, 0x88,
+ 0x9A, 0xAB, 0xBB, 0xAA, 0xA9, 0x87, 0x76, 0x66, 0x66, 0x77, 0x89, 0x9A,
+ 0xBB, 0xBA, 0xA9, 0x98, 0x76, 0x66, 0x55, 0x66, 0x77, 0x89, 0xAA, 0xBB,
+ 0xAA, 0x98, 0x87, 0x65, 0x55, 0x55, 0x66, 0x78, 0x99, 0xAB, 0xAA, 0xA9,
+ 0x88, 0x76, 0x55, 0x55, 0x56, 0x67, 0x78, 0x9A, 0xBA, 0xAA, 0x98, 0x87,
+ 0x65, 0x55, 0x55, 0x56, 0x78, 0x89, 0xAB, 0xAA, 0xA9, 0x98, 0x76, 0x65,
+ 0x55, 0x56, 0x67, 0x88, 0x9A, 0xBA, 0xAA, 0xA9, 0x87, 0x76, 0x66, 0x56,
+ 0x66, 0x78, 0x89, 0xAB, 0xAA, 0xBA, 0x98, 0x87, 0x76, 0x66, 0x66, 0x77,
+ 0x89, 0xAA, 0xBB, 0xAB, 0xA9, 0x98, 0x87, 0x77, 0x77, 0x77, 0x89, 0x9A,
+ 0xBB, 0xBA, 0xBB, 0xA9, 0x98, 0x88, 0x88, 0x88, 0x89, 0x9A, 0xAB, 0xCB,
+ 0xBC, 0xBB, 0xAA, 0x99, 0x98, 0x88, 0x89, 0x9A, 0xAB, 0xCC, 0xBB, 0xCC,
+ 0xBB, 0xAA, 0xA9, 0x99, 0x99, 0xAA, 0xAB, 0xBC, 0xDB, 0xBD, 0xCC, 0xBB,
+ 0xAA, 0xAA, 0xAA, 0xAB, 0xBB, 0xBC, 0xCD, 0xCB, 0xDC, 0xCC, 0xBB, 0xBB,
+ 0xBB, 0xBB, 0xBB, 0xCC, 0xDD, 0xDC, 0x8C, 0xBB, 0xBB, 0xBA, 0xAA, 0xAA,
+ 0xBB, 0xBB, 0xBC, 0xCC, 0xA0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xBD, 0xDD, 0xCD, 0xCB, 0xCB, 0xBB, 0xCB, 0xCB, 0xCC, 0xCC, 0x7D, 0xFF,
+ 0xDD, 0xCC, 0xCB, 0xBB, 0xCC, 0xCD, 0xDD, 0xDE, 0xED, 0xDD, 0xDC, 0xCC,
+ 0xBB, 0xAB, 0xAB, 0xBB, 0xCC, 0xDD, 0xEE, 0xDD, 0xDD, 0xCB, 0xBA, 0xA9,
+ 0x99, 0xAA, 0xAB, 0xBC, 0xCD, 0xEC, 0xCD, 0xCB, 0xAA, 0x99, 0x88, 0x89,
+ 0x99, 0xAA, 0xBC, 0xDD, 0xDC, 0xDB, 0xBA, 0x98, 0x87, 0x77, 0x78, 0x99,
+ 0xAB, 0xBC, 0xDD, 0xCC, 0xBA, 0x98, 0x77, 0x66, 0x67, 0x78, 0x89, 0xAB,
+ 0xCD, 0xCC, 0xCB, 0xA9, 0x87, 0x65, 0x55, 0x66, 0x78, 0x9A, 0xBC, 0xDC,
+ 0xBC, 0xB9, 0x87, 0x65, 0x54, 0x55, 0x67, 0x79, 0x9B, 0xBC, 0xCC, 0xBA,
+ 0x98, 0x76, 0x54, 0x44, 0x45, 0x67, 0x89, 0xAC, 0xCD, 0xCC, 0xA9, 0x87,
+ 0x65, 0x54, 0x44, 0x56, 0x78, 0x9B, 0xBD, 0xDB, 0xCA, 0xA8, 0x87, 0x65,
+ 0x54, 0x55, 0x67, 0x89, 0xBB, 0xCD, 0xBB, 0xBA, 0x98, 0x76, 0x65, 0x55,
+ 0x67, 0x89, 0xAA, 0xCD, 0xDC, 0xCB, 0xA9, 0x88, 0x77, 0x66, 0x67, 0x78,
+ 0x9A, 0xBC, 0xDD, 0xCC, 0xBB, 0xA9, 0x98, 0x77, 0x77, 0x88, 0x9A, 0xBB,
+ 0xDE, 0xDC, 0xDC, 0xBA, 0xA9, 0x98, 0x88, 0x89, 0x9A, 0xBB, 0xDD, 0xED,
+ 0xDD, 0xDC, 0xBB, 0xAA, 0xA9, 0x99, 0xAA, 0xBC, 0xCD, 0xEF, 0xDC, 0xED,
+ 0xDC, 0xBB, 0xBB, 0xAA, 0xBB, 0xBC, 0xCC, 0xEE, 0xEE, 0xDE, 0xED, 0xDD,
+ 0xCC, 0xCC, 0xCC, 0xCC, 0xCD, 0xEE, 0xEF, 0xFD, 0xFE, 0xDD, 0xDD, 0xDC,
+ 0xDD, 0xDD, 0xDE, 0xED, 0xFF, 0xFE, 0x8D, 0xCD, 0xCD, 0xCC, 0xCC, 0xCC,
+ 0xCD, 0xDD, 0xEE, 0xEF, 0xC0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xDF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xED, 0xDD, 0xDD, 0xDC, 0x8F, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xEF, 0xFF, 0xFD, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xEE, 0xED, 0xDD, 0xEF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xDD, 0xDC,
+ 0xCC, 0xCC, 0xCD, 0xDF, 0xFF, 0xFF, 0xFF, 0xFF, 0xEC, 0xCB, 0xBB, 0xAB,
+ 0xBC, 0xDD, 0xFF, 0xFF, 0xFF, 0xFF, 0xED, 0xBB, 0xA9, 0x99, 0x9A, 0xAB,
+ 0xCD, 0xFF, 0xFF, 0xEF, 0xFD, 0xCA, 0x98, 0x77, 0x77, 0x89, 0xAC, 0xDF,
+ 0xFF, 0xFF, 0xFE, 0xDB, 0xA8, 0x76, 0x56, 0x67, 0x8A, 0xBD, 0xDF, 0xFF,
+ 0xFF, 0xFC, 0xB9, 0x76, 0x54, 0x45, 0x68, 0x9B, 0xCD, 0xFF, 0xFF, 0xFD,
+ 0xCB, 0x97, 0x54, 0x23, 0x46, 0x79, 0xAC, 0xEF, 0xFF, 0xFF, 0xEC, 0xA9,
+ 0x76, 0x43, 0x24, 0x57, 0x9B, 0xCD, 0xFF, 0xFF, 0xFD, 0xCB, 0x98, 0x65,
+ 0x44, 0x46, 0x79, 0xBC, 0xEF, 0xFF, 0xEF, 0xDD, 0xBA, 0x87, 0x66, 0x56,
+ 0x78, 0xAB, 0xDF, 0xFF, 0xFF, 0xFE, 0xDC, 0xA9, 0x88, 0x77, 0x78, 0x9A,
+ 0xCD, 0xFF, 0xFF, 0xDF, 0xFD, 0xCB, 0xAA, 0x99, 0x99, 0xAB, 0xBD, 0xDF,
+ 0xFF, 0xFD, 0xFF, 0xDD, 0xCB, 0xBB, 0xAA, 0xBB, 0xCC, 0xFE, 0xFF, 0xFF,
+ 0xEF, 0xFD, 0xED, 0xDC, 0xCC, 0xCC, 0xCD, 0xEF, 0xFF, 0xFF, 0xFD, 0xFF,
+ 0xEF, 0xDD, 0xDD, 0xDE, 0xEE, 0xFF, 0xFF, 0xFF, 0xFF, 0xCF, 0xFF, 0xFF,
+ 0xEF, 0xEE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFD, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7C, 0xCD, 0xDD, 0xDD, 0xFD, 0xEF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xDE, 0xEE, 0xDD, 0xDC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0x9E, 0xFF,
+ 0xEE, 0xED, 0xCC, 0xCC, 0xCC, 0xCD, 0xDD, 0xEE, 0xFD, 0xEF, 0xED, 0xDC,
+ 0xCB, 0xBB, 0xBB, 0xBC, 0xCC, 0xDD, 0xEF, 0xDD, 0xED, 0xDC, 0xBB, 0xAA,
+ 0xAA, 0xAA, 0xBB, 0xCC, 0xDD, 0xFE, 0xDE, 0xDC, 0xBA, 0x99, 0x99, 0x99,
+ 0x9A, 0xAB, 0xCC, 0xDE, 0xDD, 0xDC, 0xBA, 0x98, 0x88, 0x77, 0x88, 0x99,
+ 0xAB, 0xCD, 0xED, 0xDD, 0xCA, 0x98, 0x77, 0x66, 0x67, 0x78, 0x9A, 0xBC,
+ 0xDD, 0xDC, 0xDB, 0xA9, 0x87, 0x65, 0x55, 0x66, 0x78, 0x9A, 0xCD, 0xED,
+ 0xCC, 0xBA, 0x97, 0x65, 0x54, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xDC, 0xCB,
+ 0xA8, 0x76, 0x54, 0x44, 0x45, 0x67, 0x9A, 0xBC, 0xED, 0xCC, 0xBA, 0x97,
+ 0x65, 0x44, 0x44, 0x56, 0x78, 0xAB, 0xCD, 0xDC, 0xCB, 0xA9, 0x87, 0x65,
+ 0x44, 0x55, 0x67, 0x9A, 0xBC, 0xED, 0xCC, 0xBA, 0x98, 0x76, 0x65, 0x55,
+ 0x67, 0x89, 0xAC, 0xDE, 0xEC, 0xDC, 0xBA, 0x98, 0x77, 0x66, 0x67, 0x78,
+ 0x9B, 0xCD, 0xED, 0xCD, 0xCB, 0xA9, 0x98, 0x87, 0x77, 0x88, 0x9A, 0xBC,
+ 0xEF, 0xEC, 0xDC, 0xCB, 0xAA, 0x99, 0x99, 0x99, 0xAA, 0xBC, 0xDE, 0xFE,
+ 0xCE, 0xDC, 0xCB, 0xBA, 0xAA, 0xAA, 0xAB, 0xBC, 0xDE, 0xFF, 0xEC, 0xED,
+ 0xDC, 0xCC, 0xBB, 0xBB, 0xBB, 0xCD, 0xDE, 0xEF, 0xFF, 0xCF, 0xED, 0xDD,
+ 0xDC, 0xCC, 0xCC, 0xCD, 0xDE, 0xEF, 0xFF, 0xFC, 0xFE, 0xFE, 0xDD, 0xDD,
+ 0xDE, 0xEE, 0xEE, 0xFF, 0xFF, 0xFF, 0x8D, 0xDD, 0xCD, 0xDD, 0xDD, 0xDD,
+ 0xDD, 0xEE, 0xFF, 0xFF, 0xD0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xDE, 0xED, 0xDC, 0xCC, 0xBB, 0xBB, 0xBB, 0xBC, 0xCC, 0xCC, 0x9E, 0xFE,
+ 0xED, 0xCC, 0xCB, 0xBB, 0xBB, 0xCC, 0xCD, 0xDE, 0xED, 0xEE, 0xDD, 0xCB,
+ 0xBA, 0xAA, 0xAA, 0xAB, 0xBB, 0xCC, 0xDE, 0xDD, 0xDC, 0xCB, 0xAA, 0x99,
+ 0x99, 0x99, 0xAA, 0xBB, 0xCD, 0xDD, 0xDD, 0xCB, 0xA9, 0x98, 0x88, 0x88,
+ 0x89, 0x9A, 0xBB, 0xCD, 0xCC, 0xCB, 0xA9, 0x88, 0x77, 0x77, 0x77, 0x89,
+ 0x9A, 0xBC, 0xDC, 0xCC, 0xBA, 0x98, 0x76, 0x66, 0x66, 0x77, 0x89, 0xAB,
+ 0xCD, 0xCC, 0xBA, 0x98, 0x76, 0x65, 0x55, 0x66, 0x78, 0x89, 0xAB, 0xCC,
+ 0xBB, 0xA9, 0x87, 0x65, 0x55, 0x55, 0x66, 0x78, 0x9A, 0xBC, 0xCB, 0xBA,
+ 0x98, 0x76, 0x55, 0x44, 0x55, 0x67, 0x89, 0xAB, 0xCC, 0xBB, 0xA9, 0x87,
+ 0x65, 0x54, 0x45, 0x56, 0x78, 0x9A, 0xBC, 0xCB, 0xBA, 0x98, 0x76, 0x65,
+ 0x55, 0x55, 0x67, 0x89, 0xAB, 0xCC, 0xBB, 0xA9, 0x87, 0x76, 0x65, 0x55,
+ 0x66, 0x78, 0x9A, 0xBD, 0xCB, 0xCB, 0xA9, 0x87, 0x76, 0x66, 0x66, 0x78,
+ 0x9A, 0xBC, 0xDD, 0xCC, 0xBA, 0x99, 0x88, 0x77, 0x77, 0x78, 0x89, 0xAB,
+ 0xCD, 0xDC, 0xCB, 0xBA, 0x99, 0x88, 0x88, 0x88, 0x99, 0xAB, 0xCD, 0xEE,
+ 0xCD, 0xCB, 0xBA, 0xA9, 0x99, 0x99, 0x9A, 0xAB, 0xCC, 0xDE, 0xEC, 0xDD,
+ 0xCC, 0xBB, 0xAA, 0xAA, 0xAA, 0xBB, 0xCC, 0xDE, 0xFF, 0xCE, 0xDD, 0xCC,
+ 0xBB, 0xBB, 0xBB, 0xBC, 0xCD, 0xDE, 0xFF, 0xFD, 0xEE, 0xDD, 0xCD, 0xCC,
+ 0xCC, 0xCC, 0xDD, 0xEF, 0xFF, 0xFF, 0xAD, 0xDC, 0xCC, 0xCC, 0xCC, 0xCC,
+ 0xDD, 0xDE, 0xEF, 0xFF, 0xE0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xDF, 0xED, 0xEE, 0xDD, 0xDC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0x9F, 0xFF,
+ 0xFE, 0xED, 0xDC, 0xCC, 0xCC, 0xCD, 0xDD, 0xEE, 0xED, 0xEF, 0xEE, 0xDC,
+ 0xCC, 0xBB, 0xBB, 0xBC, 0xCC, 0xDD, 0xEE, 0xDE, 0xEE, 0xDC, 0xBB, 0xAA,
+ 0xAA, 0xAA, 0xBB, 0xBC, 0xDD, 0xED, 0xDE, 0xDC, 0xBA, 0x99, 0x98, 0x99,
+ 0x9A, 0xAB, 0xCC, 0xDE, 0xDD, 0xDC, 0xBA, 0x98, 0x87, 0x77, 0x88, 0x99,
+ 0xAB, 0xCD, 0xDD, 0xDD, 0xCB, 0xA8, 0x77, 0x66, 0x67, 0x78, 0x9A, 0xBC,
+ 0xDD, 0xCC, 0xDB, 0xA9, 0x87, 0x65, 0x55, 0x66, 0x78, 0x9A, 0xBC, 0xDC,
+ 0xCC, 0xBA, 0x97, 0x65, 0x54, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xCC, 0xCB,
+ 0xA8, 0x76, 0x54, 0x44, 0x45, 0x67, 0x9A, 0xBC, 0xDC, 0xCC, 0xBA, 0x97,
+ 0x65, 0x44, 0x44, 0x56, 0x79, 0xAB, 0xCD, 0xDC, 0xCB, 0xA9, 0x87, 0x65,
+ 0x44, 0x55, 0x67, 0x9A, 0xBC, 0xDD, 0xCC, 0xBA, 0x98, 0x76, 0x65, 0x55,
+ 0x67, 0x89, 0xAC, 0xCD, 0xDC, 0xDC, 0xBA, 0x98, 0x77, 0x66, 0x67, 0x88,
+ 0x9B, 0xCD, 0xDD, 0xCD, 0xCB, 0xAA, 0x98, 0x87, 0x77, 0x88, 0x9A, 0xBC,
+ 0xDF, 0xDD, 0xDC, 0xCB, 0xAA, 0x99, 0x89, 0x99, 0xAA, 0xBC, 0xDD, 0xED,
+ 0xCD, 0xDC, 0xCB, 0xBA, 0xAA, 0xAA, 0xAB, 0xBC, 0xDD, 0xEF, 0xED, 0xED,
+ 0xDC, 0xCC, 0xBB, 0xBB, 0xBB, 0xCC, 0xDD, 0xEE, 0xFE, 0xCD, 0xED, 0xDD,
+ 0xCC, 0xCC, 0xCC, 0xCD, 0xDE, 0xFF, 0xFF, 0xFD, 0xFE, 0xEE, 0xED, 0xDD,
+ 0xDD, 0xEE, 0xDE, 0xFE, 0xFF, 0xFE, 0x9C, 0xCD, 0xCC, 0xCC, 0xCC, 0xDD,
+ 0xDD, 0xDE, 0xEF, 0xFF, 0xD0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xEF, 0xFF, 0xFF, 0xFF, 0xEE, 0xDD, 0xDD, 0xDD, 0xCC, 0xCD, 0x7F, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xEF, 0xEE, 0xFE, 0xFF, 0xFD, 0xFF, 0xFF, 0xFF,
+ 0xEF, 0xDC, 0xDD, 0xDD, 0xFF, 0xEF, 0xFF, 0xDF, 0xFF, 0xFE, 0xDD, 0xCC,
+ 0xBB, 0xBC, 0xCD, 0xDD, 0xDF, 0xFE, 0xFF, 0xFF, 0xDC, 0xBA, 0xAA, 0xAA,
+ 0xAB, 0xCC, 0xDF, 0xFF, 0xEF, 0xFF, 0xDC, 0xBA, 0x98, 0x88, 0x99, 0xAB,
+ 0xCD, 0xDF, 0xFE, 0xFF, 0xFC, 0xBA, 0x98, 0x77, 0x77, 0x89, 0xAB, 0xCD,
+ 0xFF, 0xFF, 0xFD, 0xCB, 0x97, 0x65, 0x55, 0x67, 0x89, 0xBB, 0xDF, 0xFF,
+ 0xFF, 0xDC, 0xA8, 0x75, 0x44, 0x45, 0x67, 0x9A, 0xCD, 0xFF, 0xFF, 0xFD,
+ 0xBA, 0x87, 0x54, 0x33, 0x45, 0x78, 0xAB, 0xDF, 0xFF, 0xFE, 0xDB, 0xA8,
+ 0x75, 0x43, 0x34, 0x57, 0x8A, 0xBD, 0xFF, 0xFF, 0xED, 0xBA, 0x87, 0x65,
+ 0x44, 0x45, 0x78, 0xAB, 0xDF, 0xFF, 0xFF, 0xDC, 0xA9, 0x87, 0x65, 0x55,
+ 0x67, 0x9B, 0xCF, 0xFF, 0xFF, 0xFD, 0xCB, 0xA9, 0x87, 0x76, 0x78, 0x9A,
+ 0xBC, 0xDF, 0xFF, 0xEF, 0xEC, 0xCB, 0xA9, 0x98, 0x88, 0x9A, 0xBC, 0xDF,
+ 0xFF, 0xFE, 0xFF, 0xCD, 0xCB, 0xAA, 0xAA, 0xAB, 0xBC, 0xDF, 0xFF, 0xFF,
+ 0xEF, 0xFF, 0xDD, 0xCB, 0xBB, 0xBB, 0xDC, 0xEE, 0xFF, 0xFF, 0xFD, 0xFE,
+ 0xEF, 0xDD, 0xDC, 0xDD, 0xDD, 0xEE, 0xFF, 0xFF, 0xFF, 0xEF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFD, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x8D, 0xDC, 0xDD, 0xDE, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xCF, 0xDE, 0xDD, 0xDC, 0xCC, 0xCC, 0xCC, 0xDC, 0xCC, 0xCD, 0x8F, 0xFF,
+ 0xEE, 0xDC, 0xDC, 0xBC, 0xCD, 0xDE, 0xDD, 0xEF, 0xED, 0xEE, 0xEE, 0xDC,
+ 0xBB, 0xBB, 0xBB, 0xBB, 0xCD, 0xED, 0xEE, 0xED, 0xFE, 0xDC, 0xBA, 0xAA,
+ 0xAA, 0xAA, 0xAB, 0xCC, 0xDD, 0xED, 0xDE, 0xCC, 0xBA, 0x99, 0x88, 0x89,
+ 0x99, 0xAB, 0xBC, 0xDE, 0xDD, 0xDC, 0xBA, 0x98, 0x87, 0x77, 0x88, 0x99,
+ 0xAB, 0xCE, 0xDD, 0xDD, 0xCA, 0x98, 0x77, 0x66, 0x67, 0x78, 0x99, 0xAB,
+ 0xCE, 0xDD, 0xCB, 0xA9, 0x87, 0x65, 0x55, 0x66, 0x78, 0x9B, 0xBD, 0xDD,
+ 0xCC, 0xBA, 0x87, 0x65, 0x54, 0x45, 0x67, 0x89, 0xAB, 0xCE, 0xDC, 0xCB,
+ 0xA9, 0x76, 0x54, 0x44, 0x45, 0x67, 0x8A, 0xBC, 0xCD, 0xCC, 0xBA, 0x87,
+ 0x65, 0x54, 0x44, 0x56, 0x78, 0x9B, 0xCD, 0xEC, 0xCB, 0xA9, 0x87, 0x65,
+ 0x44, 0x55, 0x67, 0x8A, 0xBC, 0xDD, 0xCD, 0xBA, 0x98, 0x76, 0x65, 0x55,
+ 0x67, 0x89, 0xAB, 0xCD, 0xDC, 0xCC, 0xBA, 0x98, 0x77, 0x66, 0x67, 0x78,
+ 0x9A, 0xBD, 0xED, 0xCD, 0xCB, 0xA9, 0x98, 0x87, 0x77, 0x88, 0x9A, 0xBC,
+ 0xDE, 0xDC, 0xDC, 0xCB, 0xAA, 0x99, 0x88, 0x99, 0x9A, 0xBC, 0xDD, 0xEE,
+ 0xCE, 0xDC, 0xBB, 0xAA, 0xAA, 0xAA, 0xAA, 0xBC, 0xCD, 0xEF, 0xED, 0xEE,
+ 0xDC, 0xCC, 0xBB, 0xBB, 0xBB, 0xBC, 0xDD, 0xEE, 0xFE, 0xDE, 0xEE, 0xDD,
+ 0xCC, 0xCC, 0xCC, 0xCD, 0xDF, 0xEE, 0xFF, 0xEC, 0xEF, 0xEE, 0xDD, 0xDD,
+ 0xDD, 0xDD, 0xEF, 0xFF, 0xFF, 0xFE, 0x8D, 0xDD, 0xDC, 0xDC, 0xDD, 0xDD,
+ 0xDD, 0xDE, 0xEF, 0xEF, 0xD0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xAC, 0xBB, 0xAA, 0xAA, 0xAA, 0x9A, 0xAA, 0xAA, 0xAB, 0xBB, 0x8B, 0xDC,
+ 0xCB, 0xBB, 0xAA, 0xAA, 0xAA, 0xAB, 0xBB, 0xCC, 0xDB, 0xBC, 0xBB, 0xAA,
+ 0xA9, 0x99, 0x99, 0x9A, 0xAA, 0xBC, 0xCD, 0xBB, 0xCB, 0xAA, 0x99, 0x88,
+ 0x88, 0x99, 0x99, 0xAA, 0xBC, 0xCB, 0xAB, 0xAA, 0x99, 0x88, 0x87, 0x88,
+ 0x88, 0x99, 0xAB, 0xBC, 0xBA, 0xBA, 0x99, 0x87, 0x77, 0x77, 0x77, 0x88,
+ 0x99, 0xAB, 0xCB, 0xAB, 0xA9, 0x87, 0x76, 0x66, 0x66, 0x77, 0x88, 0x9A,
+ 0xBB, 0xAA, 0xA9, 0x98, 0x76, 0x66, 0x56, 0x66, 0x77, 0x89, 0xAA, 0xBA,
+ 0xAA, 0x98, 0x87, 0x66, 0x55, 0x55, 0x66, 0x78, 0x99, 0xAB, 0xAA, 0xA9,
+ 0x88, 0x76, 0x55, 0x55, 0x55, 0x67, 0x88, 0x9A, 0xBA, 0xAA, 0x98, 0x87,
+ 0x66, 0x55, 0x55, 0x56, 0x77, 0x89, 0xAB, 0xAA, 0xA9, 0x98, 0x76, 0x65,
+ 0x55, 0x56, 0x67, 0x78, 0x9A, 0xBB, 0xAA, 0x99, 0x87, 0x76, 0x66, 0x56,
+ 0x66, 0x78, 0x89, 0xAB, 0xBA, 0xAA, 0x98, 0x87, 0x76, 0x66, 0x66, 0x77,
+ 0x89, 0xAA, 0xBB, 0xAB, 0xA9, 0x98, 0x87, 0x77, 0x77, 0x77, 0x88, 0x9A,
+ 0xBB, 0xBA, 0xBA, 0xA9, 0x98, 0x88, 0x77, 0x78, 0x89, 0x9A, 0xAB, 0xCB,
+ 0xAC, 0xBA, 0xA9, 0x99, 0x88, 0x88, 0x99, 0x9A, 0xAB, 0xCC, 0xCB, 0xCB,
+ 0xBA, 0xAA, 0x99, 0x99, 0x99, 0xAA, 0xAB, 0xBC, 0xDC, 0xBC, 0xCB, 0xBB,
+ 0xAA, 0xAA, 0xAA, 0xAA, 0xBB, 0xCC, 0xDE, 0xDB, 0xDC, 0xCC, 0xBB, 0xBB,
+ 0xBB, 0xBB, 0xBC, 0xCD, 0xDD, 0xEC, 0x8B, 0xBB, 0xBB, 0xBB, 0xAA, 0xAA,
+ 0xBB, 0xBB, 0xCC, 0xCD, 0xB0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xAB, 0xBA, 0xAA, 0x99, 0x99, 0x99, 0x99, 0x9A, 0xAA, 0xBB, 0x9B, 0xCC,
+ 0xBB, 0xAA, 0xAA, 0x99, 0xAA, 0xAA, 0xBB, 0xBC, 0xCB, 0xBC, 0xBA, 0xA9,
+ 0x99, 0x99, 0x99, 0x99, 0xAA, 0xAB, 0xBC, 0xBA, 0xBA, 0xA9, 0x98, 0x88,
+ 0x88, 0x88, 0x99, 0x9A, 0xAB, 0xCB, 0xAB, 0xA9, 0x98, 0x88, 0x77, 0x77,
+ 0x88, 0x99, 0x9A, 0xBB, 0xAA, 0xA9, 0x98, 0x87, 0x77, 0x77, 0x77, 0x88,
+ 0x99, 0xAA, 0xBA, 0x9A, 0x98, 0x87, 0x76, 0x66, 0x66, 0x77, 0x88, 0x99,
+ 0xAB, 0xA9, 0xA9, 0x88, 0x76, 0x66, 0x66, 0x66, 0x77, 0x88, 0x9A, 0xAA,
+ 0x99, 0x98, 0x77, 0x66, 0x65, 0x56, 0x66, 0x78, 0x89, 0xAA, 0xA9, 0x99,
+ 0x87, 0x76, 0x65, 0x55, 0x56, 0x67, 0x78, 0x99, 0xAA, 0x99, 0x98, 0x77,
+ 0x66, 0x55, 0x55, 0x66, 0x77, 0x89, 0x9A, 0xA9, 0xA9, 0x88, 0x76, 0x66,
+ 0x55, 0x66, 0x67, 0x78, 0x99, 0xAA, 0x9A, 0x98, 0x87, 0x76, 0x66, 0x66,
+ 0x66, 0x77, 0x89, 0xAA, 0xA9, 0xA9, 0x98, 0x87, 0x76, 0x66, 0x66, 0x77,
+ 0x88, 0x9A, 0xBA, 0x9A, 0xA9, 0x88, 0x87, 0x77, 0x77, 0x77, 0x88, 0x99,
+ 0xAB, 0xAA, 0xBA, 0x99, 0x88, 0x88, 0x77, 0x78, 0x88, 0x99, 0xAA, 0xBB,
+ 0xAB, 0xAA, 0x99, 0x98, 0x88, 0x88, 0x88, 0x99, 0xAA, 0xBC, 0xBA, 0xBB,
+ 0xAA, 0xA9, 0x99, 0x99, 0x99, 0x99, 0xAA, 0xBC, 0xCB, 0xBC, 0xBB, 0xBA,
+ 0xAA, 0xA9, 0x9A, 0xAA, 0xAB, 0xBB, 0xCD, 0xCB, 0xDC, 0xCB, 0xBB, 0xAA,
+ 0xAA, 0xAA, 0xBB, 0xBC, 0xCD, 0xDC, 0x9B, 0xBB, 0xAA, 0xAA, 0xAA, 0xAA,
+ 0xAA, 0xAB, 0xBB, 0xCC, 0xB0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xBC, 0xCB, 0xBB, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xBB, 0xBB, 0x8C, 0xDD,
+ 0xCB, 0xBA, 0xAA, 0xAA, 0xAA, 0xBB, 0xBC, 0xCC, 0xDC, 0xCD, 0xCB, 0xAA,
+ 0xA9, 0x99, 0x99, 0x9A, 0xAA, 0xBC, 0xCD, 0xCB, 0xCB, 0xAA, 0x99, 0x98,
+ 0x88, 0x89, 0x99, 0xAA, 0xBC, 0xCB, 0xBC, 0xAA, 0x98, 0x88, 0x77, 0x78,
+ 0x88, 0x99, 0xAB, 0xBC, 0xBB, 0xBA, 0x98, 0x87, 0x77, 0x77, 0x77, 0x88,
+ 0x99, 0xAB, 0xCB, 0xAB, 0xA9, 0x87, 0x76, 0x66, 0x66, 0x77, 0x88, 0x9A,
+ 0xAB, 0xBA, 0xA9, 0x88, 0x76, 0x66, 0x56, 0x66, 0x77, 0x89, 0xAA, 0xBB,
+ 0xAA, 0x98, 0x77, 0x66, 0x55, 0x55, 0x66, 0x78, 0x89, 0xAB, 0xBA, 0xA9,
+ 0x87, 0x76, 0x55, 0x55, 0x56, 0x67, 0x78, 0x9A, 0xBA, 0xAA, 0x98, 0x77,
+ 0x66, 0x55, 0x55, 0x56, 0x77, 0x89, 0xAB, 0xBA, 0xA9, 0x88, 0x76, 0x65,
+ 0x55, 0x56, 0x67, 0x88, 0x9A, 0xBB, 0xAA, 0xA9, 0x87, 0x76, 0x66, 0x56,
+ 0x66, 0x78, 0x89, 0xAB, 0xBA, 0xBA, 0x98, 0x87, 0x76, 0x66, 0x66, 0x77,
+ 0x89, 0xAA, 0xBB, 0xAB, 0xA9, 0x98, 0x87, 0x77, 0x77, 0x77, 0x88, 0x9A,
+ 0xBC, 0xBB, 0xBB, 0xA9, 0x98, 0x88, 0x77, 0x78, 0x89, 0x9A, 0xAB, 0xCC,
+ 0xBC, 0xBB, 0xA9, 0x99, 0x88, 0x88, 0x99, 0x9A, 0xAB, 0xCC, 0xCB, 0xCC,
+ 0xBB, 0xAA, 0x99, 0x99, 0x99, 0x9A, 0xAB, 0xCC, 0xDC, 0xBD, 0xCC, 0xBB,
+ 0xBA, 0xAA, 0xAA, 0xAB, 0xBB, 0xBC, 0xDD, 0xCC, 0xDC, 0xCC, 0xCB, 0xBB,
+ 0xBB, 0xBB, 0xBC, 0xCC, 0xDE, 0xED, 0x8B, 0xBB, 0xBB, 0xBA, 0xAA, 0xBB,
+ 0xBB, 0xBC, 0xCC, 0xCD, 0xB0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xCF, 0xED, 0xED, 0xDC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0x7E, 0xFF,
+ 0xFE, 0xDD, 0xDC, 0xCD, 0xDD, 0xCE, 0xEE, 0xFF, 0xFD, 0xDF, 0xDD, 0xDC,
+ 0xDC, 0xCC, 0xBC, 0xCC, 0xCD, 0xDD, 0xFE, 0xDD, 0xEE, 0xDC, 0xBB, 0xBB,
+ 0xAA, 0xBB, 0xBB, 0xDD, 0xDE, 0xED, 0xDE, 0xDD, 0xBA, 0xA9, 0x99, 0x99,
+ 0xAA, 0xBB, 0xCD, 0xDD, 0xDD, 0xDC, 0xBB, 0xA9, 0x88, 0x88, 0x89, 0x9A,
+ 0xBC, 0xDE, 0xED, 0xCD, 0xCB, 0xA9, 0x87, 0x76, 0x77, 0x88, 0x9A, 0xBC,
+ 0xDE, 0xDD, 0xDC, 0xBA, 0x87, 0x65, 0x55, 0x67, 0x89, 0xAB, 0xCD, 0xDC,
+ 0xDD, 0xBA, 0x98, 0x76, 0x54, 0x45, 0x67, 0x89, 0xBC, 0xCE, 0xDC, 0xDB,
+ 0xA9, 0x86, 0x54, 0x33, 0x45, 0x78, 0x9A, 0xCD, 0xDD, 0xCD, 0xCA, 0x98,
+ 0x75, 0x43, 0x34, 0x57, 0x89, 0xAC, 0xCE, 0xCC, 0xDB, 0xB9, 0x87, 0x65,
+ 0x44, 0x56, 0x78, 0x9A, 0xBD, 0xFD, 0xCD, 0xCB, 0xA9, 0x87, 0x65, 0x56,
+ 0x67, 0x89, 0xBC, 0xDD, 0xDC, 0xDD, 0xBA, 0x98, 0x87, 0x77, 0x77, 0x89,
+ 0xAB, 0xCD, 0xED, 0xCD, 0xCB, 0xBA, 0x99, 0x88, 0x88, 0x89, 0xAB, 0xCD,
+ 0xDF, 0xEC, 0xED, 0xDB, 0xBA, 0xA9, 0x99, 0x9A, 0xAB, 0xBC, 0xDE, 0xDE,
+ 0xCF, 0xDD, 0xCB, 0xBB, 0xAA, 0xAA, 0xAB, 0xBC, 0xDE, 0xDF, 0xED, 0xFE,
+ 0xDD, 0xCC, 0xCB, 0xCB, 0xCC, 0xCD, 0xDE, 0xEE, 0xFD, 0xDF, 0xEF, 0xFD,
+ 0xDD, 0xDD, 0xDC, 0xED, 0xED, 0xEE, 0xFF, 0xFD, 0xFF, 0xFD, 0xEE, 0xED,
+ 0xDD, 0xDF, 0xEE, 0xFE, 0xFF, 0xFF, 0x8D, 0xDD, 0xDC, 0xCD, 0xDD, 0xCD,
+ 0xCD, 0xDD, 0xED, 0xEE, 0xD0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFD, 0xFE, 0xCF, 0xCD, 0xCC, 0xCC, 0x8F, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFC, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xDD,
+ 0xFF, 0xCD, 0xDD, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xDB, 0xCC, 0xBB,
+ 0xCC, 0xCF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xCC, 0xBA, 0xAA, 0xAB, 0xBC,
+ 0xDF, 0xFF, 0xFF, 0xFF, 0xFF, 0xCB, 0xA9, 0x88, 0x88, 0x9A, 0xBD, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFD, 0xA9, 0x87, 0x66, 0x78, 0x9B, 0xCD, 0xFF, 0xFF,
+ 0xFF, 0xDC, 0xBA, 0x86, 0x54, 0x45, 0x78, 0xAC, 0xDF, 0xFF, 0xFF, 0xFF,
+ 0xFB, 0xA8, 0x64, 0x22, 0x46, 0x89, 0xBD, 0xFF, 0xFF, 0xDF, 0xDC, 0xB9,
+ 0x86, 0x42, 0x24, 0x68, 0x9B, 0xDD, 0xFF, 0xFF, 0xFF, 0xCC, 0xA8, 0x75,
+ 0x44, 0x56, 0x8A, 0xBF, 0xFF, 0xFF, 0xFF, 0xCF, 0xCA, 0x98, 0x76, 0x66,
+ 0x79, 0xAD, 0xFF, 0xFF, 0xFF, 0xFD, 0xFD, 0xBA, 0x98, 0x88, 0x89, 0xAB,
+ 0xDC, 0xFF, 0xFF, 0xDF, 0xFF, 0xDC, 0xCA, 0xAA, 0xAA, 0xAB, 0xCF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xDB, 0xCC, 0xBB, 0xCC, 0xFD, 0xDF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xDD, 0xCF, 0xDF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFD, 0xFF, 0xCD, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xEF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFD, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x8D, 0xFF, 0xDF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xDF, 0xFD, 0xDD, 0xDC, 0xCC, 0xCB, 0xCC, 0xCC, 0xCC, 0xCC, 0x8F, 0xFF,
+ 0xEE, 0xDD, 0xDC, 0xCC, 0xCD, 0xDC, 0xED, 0xDF, 0xFC, 0xFF, 0xEE, 0xDC,
+ 0xCC, 0xCB, 0xBB, 0xBC, 0xCC, 0xDE, 0xEF, 0xDF, 0xFD, 0xCC, 0xBB, 0xAB,
+ 0xAA, 0xAB, 0xBB, 0xCC, 0xDE, 0xED, 0xDD, 0xDC, 0xBB, 0xAA, 0x99, 0x99,
+ 0x9A, 0xBC, 0xCD, 0xDD, 0xDD, 0xFD, 0xCB, 0xA9, 0x88, 0x88, 0x89, 0x9A,
+ 0xBB, 0xCD, 0xDD, 0xDC, 0xCB, 0xA9, 0x87, 0x77, 0x77, 0x88, 0x9A, 0xBC,
+ 0xDE, 0xDD, 0xDC, 0xA9, 0x87, 0x66, 0x55, 0x67, 0x89, 0xAB, 0xCD, 0xED,
+ 0xCC, 0xCA, 0x98, 0x76, 0x54, 0x45, 0x67, 0x89, 0xAC, 0xDE, 0xDC, 0xCB,
+ 0xA9, 0x87, 0x54, 0x33, 0x45, 0x78, 0x9A, 0xBC, 0xDD, 0xDC, 0xBA, 0x98,
+ 0x75, 0x43, 0x34, 0x56, 0x89, 0xAB, 0xCD, 0xDC, 0xCB, 0xA9, 0x87, 0x65,
+ 0x44, 0x56, 0x78, 0x9A, 0xBD, 0xDD, 0xDD, 0xCB, 0xA9, 0x87, 0x65, 0x55,
+ 0x67, 0x89, 0xBC, 0xDE, 0xDC, 0xCC, 0xBA, 0x98, 0x87, 0x76, 0x77, 0x89,
+ 0xAB, 0xCD, 0xEE, 0xCD, 0xCB, 0xBA, 0x99, 0x88, 0x88, 0x89, 0xAB, 0xCD,
+ 0xDE, 0xFC, 0xED, 0xBB, 0xBA, 0xA9, 0x99, 0x9A, 0xAB, 0xBD, 0xDF, 0xFE,
+ 0xCD, 0xED, 0xCB, 0xBB, 0xBA, 0xAA, 0xBB, 0xCC, 0xED, 0xFF, 0xEC, 0xEE,
+ 0xDC, 0xCC, 0xCC, 0xBC, 0xCC, 0xDD, 0xDF, 0xEF, 0xFF, 0xCD, 0xED, 0xDD,
+ 0xCD, 0xCD, 0xDC, 0xDD, 0xDF, 0xEF, 0xFF, 0xFC, 0xFF, 0xFD, 0xEE, 0xED,
+ 0xEE, 0xEE, 0xEF, 0xFF, 0xFF, 0xFF, 0x8D, 0xDC, 0xCD, 0xCD, 0xDD, 0xED,
+ 0xEE, 0xFE, 0xFF, 0xFF, 0xE0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xED, 0xDC, 0xCC, 0xCC, 0xCC, 0xCC, 0xDD, 0xDD, 0xAF, 0xFF,
+ 0xFD, 0xDC, 0xCB, 0xBB, 0xBC, 0xCC, 0xDD, 0xEF, 0xFE, 0xFF, 0xED, 0xCB,
+ 0xBB, 0xAA, 0xAA, 0xAB, 0xBC, 0xCD, 0xEF, 0xEE, 0xED, 0xCB, 0xAA, 0x99,
+ 0x99, 0x99, 0xAA, 0xBC, 0xCD, 0xFE, 0xED, 0xCB, 0xA9, 0x98, 0x88, 0x88,
+ 0x89, 0x9A, 0xBC, 0xDD, 0xDD, 0xDB, 0xA9, 0x98, 0x77, 0x77, 0x77, 0x89,
+ 0x9A, 0xBC, 0xDD, 0xCC, 0xBA, 0x98, 0x76, 0x66, 0x66, 0x77, 0x89, 0xAB,
+ 0xCD, 0xDC, 0xCA, 0x98, 0x76, 0x65, 0x55, 0x66, 0x77, 0x89, 0xAB, 0xDD,
+ 0xCB, 0xA9, 0x87, 0x65, 0x55, 0x55, 0x56, 0x78, 0x9A, 0xBC, 0xDC, 0xBA,
+ 0x98, 0x76, 0x55, 0x44, 0x55, 0x67, 0x89, 0xAB, 0xCD, 0xCB, 0xA9, 0x87,
+ 0x65, 0x54, 0x45, 0x56, 0x78, 0x9A, 0xBD, 0xDC, 0xBA, 0x98, 0x76, 0x65,
+ 0x55, 0x55, 0x67, 0x89, 0xAB, 0xDD, 0xCB, 0xA9, 0x87, 0x76, 0x65, 0x55,
+ 0x66, 0x78, 0x9B, 0xCD, 0xEC, 0xCB, 0xA9, 0x87, 0x76, 0x66, 0x66, 0x78,
+ 0x9A, 0xBC, 0xDE, 0xCC, 0xBA, 0xA9, 0x87, 0x77, 0x77, 0x78, 0x99, 0xAB,
+ 0xDF, 0xED, 0xDC, 0xBA, 0x99, 0x88, 0x88, 0x88, 0x9A, 0xAB, 0xCD, 0xFF,
+ 0xDD, 0xCC, 0xBA, 0xA9, 0x99, 0x99, 0x9A, 0xAB, 0xCD, 0xFF, 0xFD, 0xED,
+ 0xCC, 0xBB, 0xBA, 0xAA, 0xAB, 0xBC, 0xCD, 0xEF, 0xFF, 0xDF, 0xED, 0xDC,
+ 0xCC, 0xBB, 0xBB, 0xCC, 0xDD, 0xEF, 0xFF, 0xFD, 0xFF, 0xED, 0xDD, 0xDD,
+ 0xDD, 0xDD, 0xDE, 0xFF, 0xFF, 0xFF, 0xAD, 0xDD, 0xDD, 0xDD, 0xDC, 0xDD,
+ 0xDE, 0xEF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xEF, 0xFF, 0xED, 0xDC, 0xDC, 0xCC, 0xCC, 0xCC, 0xCD, 0xDD, 0x9F, 0xFF,
+ 0xFE, 0xDD, 0xCC, 0xCC, 0xCC, 0xCD, 0xDD, 0xEE, 0xFD, 0xFE, 0xEE, 0xCC,
+ 0xCB, 0xBB, 0xBB, 0xBB, 0xBC, 0xDE, 0xEE, 0xDE, 0xFF, 0xDC, 0xBB, 0xAA,
+ 0x99, 0xAA, 0xAB, 0xCC, 0xCE, 0xDD, 0xED, 0xEC, 0xBA, 0x99, 0x88, 0x88,
+ 0x9A, 0xAB, 0xBC, 0xEE, 0xCD, 0xDC, 0xBA, 0x98, 0x87, 0x77, 0x78, 0x89,
+ 0xAB, 0xCC, 0xED, 0xDD, 0xCA, 0x98, 0x77, 0x66, 0x66, 0x78, 0x89, 0xAB,
+ 0xCD, 0xDD, 0xDB, 0xA9, 0x87, 0x65, 0x55, 0x66, 0x78, 0x9A, 0xBC, 0xDD,
+ 0xDC, 0xBA, 0x97, 0x65, 0x54, 0x55, 0x66, 0x78, 0xAB, 0xBD, 0xCC, 0xCB,
+ 0xA8, 0x76, 0x54, 0x44, 0x55, 0x67, 0x89, 0xAC, 0xDE, 0xCC, 0xA9, 0x87,
+ 0x65, 0x44, 0x44, 0x56, 0x78, 0x9B, 0xCD, 0xDC, 0xCB, 0xA8, 0x76, 0x65,
+ 0x54, 0x55, 0x67, 0x9A, 0xBC, 0xDD, 0xCC, 0xBA, 0x98, 0x76, 0x65, 0x55,
+ 0x67, 0x89, 0xAB, 0xCD, 0xDC, 0xDC, 0xA9, 0x88, 0x76, 0x66, 0x67, 0x78,
+ 0x9A, 0xBD, 0xDD, 0xDD, 0xCB, 0xA9, 0x88, 0x87, 0x77, 0x88, 0x9A, 0xBC,
+ 0xDF, 0xDD, 0xDC, 0xCB, 0xA9, 0x98, 0x88, 0x89, 0x9A, 0xBC, 0xCE, 0xFE,
+ 0xDD, 0xDC, 0xBB, 0xBA, 0xA9, 0xAA, 0xAA, 0xBC, 0xDE, 0xDF, 0xFD, 0xFD,
+ 0xCC, 0xCB, 0xBB, 0xBA, 0xBB, 0xBC, 0xDD, 0xEF, 0xFF, 0xDF, 0xDD, 0xDC,
+ 0xCC, 0xCC, 0xCC, 0xCC, 0xDD, 0xEE, 0xFF, 0xFD, 0xEE, 0xDE, 0xDD, 0xDD,
+ 0xDD, 0xDD, 0xEF, 0xEF, 0xFF, 0xFF, 0x9C, 0xCC, 0xCC, 0xCD, 0xDC, 0xED,
+ 0xEE, 0xEF, 0xFF, 0xFE, 0xF0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xDD, 0xED, 0xDD, 0xCC, 0xDD, 0x8F, 0xFF,
+ 0xFF, 0xFE, 0xFE, 0xDD, 0xDD, 0xDF, 0xFF, 0xFF, 0xFE, 0xFF, 0xFF, 0xFF,
+ 0xFE, 0xDD, 0xDD, 0xDC, 0xEE, 0xEF, 0xFF, 0xFF, 0xFF, 0xFE, 0xDD, 0xCC,
+ 0xBB, 0xBB, 0xCD, 0xDF, 0xFF, 0xFD, 0xFF, 0xDE, 0xDC, 0xBB, 0xAA, 0xAA,
+ 0xAA, 0xCC, 0xCF, 0xFF, 0xDF, 0xFF, 0xCC, 0xBA, 0x98, 0x88, 0x99, 0xAB,
+ 0xCD, 0xFD, 0xFF, 0xED, 0xED, 0xBA, 0x87, 0x77, 0x77, 0x89, 0xAB, 0xCD,
+ 0xFF, 0xDD, 0xED, 0xCB, 0x97, 0x65, 0x55, 0x67, 0x89, 0xBC, 0xFF, 0xEF,
+ 0xEF, 0xDB, 0xA8, 0x75, 0x44, 0x45, 0x67, 0x9A, 0xCD, 0xEF, 0xED, 0xEC,
+ 0xCA, 0x87, 0x54, 0x33, 0x45, 0x78, 0xAB, 0xDF, 0xFE, 0xDE, 0xCB, 0xA8,
+ 0x75, 0x43, 0x34, 0x57, 0x89, 0xCD, 0xEF, 0xFD, 0xEC, 0xCA, 0x97, 0x65,
+ 0x44, 0x45, 0x79, 0xAB, 0xDE, 0xDF, 0xFE, 0xDC, 0xA9, 0x87, 0x65, 0x55,
+ 0x67, 0x9A, 0xCD, 0xFF, 0xFE, 0xDE, 0xCB, 0xA9, 0x87, 0x77, 0x78, 0x9A,
+ 0xBC, 0xEF, 0xFF, 0xFF, 0xFD, 0xCB, 0xA9, 0x98, 0x88, 0x9A, 0xBC, 0xDE,
+ 0xFF, 0xFF, 0xDF, 0xCC, 0xBB, 0xAA, 0xA9, 0xAB, 0xBC, 0xDD, 0xFE, 0xFF,
+ 0xDF, 0xEE, 0xEC, 0xCC, 0xBB, 0xBC, 0xBD, 0xED, 0xFF, 0xFF, 0xFF, 0xEF,
+ 0xFD, 0xDD, 0xCC, 0xDC, 0xCD, 0xDF, 0xFF, 0xFF, 0xFF, 0xCF, 0xDE, 0xEF,
+ 0xDE, 0xFD, 0xEF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFD, 0xFF, 0xFD, 0xFF, 0xEE,
+ 0xEE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7C, 0xCB, 0xCD, 0xDE, 0xFF, 0xEE,
+ 0xDF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xCD, 0xED, 0xDB, 0xCC, 0xBA, 0xAB, 0xBB, 0xBB, 0xBB, 0xBB, 0x7F, 0xFD,
+ 0xCD, 0xCB, 0xBA, 0xBB, 0xBB, 0xBF, 0xDC, 0xDC, 0xFD, 0xDD, 0xDC, 0xBB,
+ 0xAA, 0xAA, 0xAA, 0xBB, 0xBB, 0xED, 0xCF, 0xEC, 0xDC, 0xBA, 0xAA, 0x99,
+ 0x98, 0x99, 0xAA, 0xBB, 0xCD, 0xDF, 0xDC, 0xBA, 0xA9, 0x88, 0x88, 0x88,
+ 0x99, 0x9A, 0xBC, 0xCE, 0xDC, 0xDB, 0xA9, 0x88, 0x77, 0x77, 0x77, 0x89,
+ 0x9A, 0xCD, 0xCF, 0xCC, 0xB9, 0x98, 0x77, 0x66, 0x66, 0x77, 0x89, 0xAA,
+ 0xCC, 0xDC, 0xCA, 0x98, 0x77, 0x65, 0x55, 0x66, 0x77, 0x89, 0xAC, 0xCC,
+ 0xBB, 0xA9, 0x87, 0x65, 0x55, 0x55, 0x66, 0x78, 0x9A, 0xBC, 0xDB, 0xCA,
+ 0x98, 0x76, 0x55, 0x44, 0x55, 0x67, 0x89, 0xAA, 0xCC, 0xCB, 0xA9, 0x87,
+ 0x65, 0x54, 0x45, 0x56, 0x78, 0x9A, 0xBC, 0xDB, 0xBA, 0x98, 0x76, 0x65,
+ 0x55, 0x55, 0x67, 0x89, 0xAB, 0xCD, 0xBB, 0xA9, 0x88, 0x76, 0x65, 0x55,
+ 0x67, 0x78, 0x9A, 0xBD, 0xCB, 0xCB, 0xA9, 0x87, 0x76, 0x66, 0x66, 0x78,
+ 0x89, 0xAC, 0xCF, 0xCC, 0xBA, 0x99, 0x88, 0x77, 0x77, 0x78, 0x89, 0xAB,
+ 0xCD, 0xCC, 0xDB, 0xAA, 0x99, 0x88, 0x88, 0x88, 0x99, 0xAB, 0xCC, 0xDD,
+ 0xDF, 0xCB, 0xAA, 0xA9, 0x98, 0x99, 0x9A, 0xAB, 0xBD, 0xDF, 0xFC, 0xEE,
+ 0xDB, 0xBA, 0xAA, 0xAA, 0xAA, 0xBB, 0xBD, 0xDE, 0xFF, 0xCF, 0xDD, 0xDD,
+ 0xBC, 0xBB, 0xBB, 0xBC, 0xCC, 0xDE, 0xFF, 0xDD, 0xDD, 0xED, 0xCD, 0xCD,
+ 0xDC, 0xCC, 0xCE, 0xDF, 0xFF, 0xFF, 0x8D, 0xBB, 0xED, 0xCC, 0xCB, 0xCD,
+ 0xCF, 0xDD, 0xDF, 0xFF, 0xF0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xBD, 0xCB, 0xBA, 0xAA, 0x99, 0x99, 0x9A, 0xAA, 0xAA, 0xBB, 0x7C, 0xDC,
+ 0xCB, 0xBA, 0xAA, 0xAA, 0xAA, 0xAB, 0xBB, 0xBC, 0xDC, 0xCC, 0xBB, 0xAA,
+ 0x99, 0x99, 0x99, 0x9A, 0xAA, 0xBB, 0xCC, 0xCB, 0xBA, 0xA9, 0x99, 0x88,
+ 0x88, 0x88, 0x99, 0x9A, 0xBC, 0xDC, 0xBB, 0xAA, 0x98, 0x88, 0x77, 0x77,
+ 0x88, 0x99, 0xAA, 0xBB, 0xBA, 0xAA, 0x98, 0x87, 0x77, 0x77, 0x77, 0x88,
+ 0x99, 0xAB, 0xBB, 0xAA, 0x99, 0x87, 0x76, 0x66, 0x66, 0x77, 0x88, 0x9A,
+ 0xAB, 0xB9, 0xA9, 0x88, 0x76, 0x66, 0x66, 0x66, 0x77, 0x88, 0x9A, 0xAB,
+ 0x9A, 0x98, 0x77, 0x66, 0x55, 0x55, 0x66, 0x78, 0x89, 0xAB, 0xB9, 0xA9,
+ 0x87, 0x76, 0x65, 0x55, 0x56, 0x67, 0x78, 0x9A, 0xAA, 0x9A, 0x98, 0x77,
+ 0x66, 0x55, 0x55, 0x66, 0x77, 0x89, 0x9A, 0xB9, 0xA9, 0x88, 0x76, 0x65,
+ 0x55, 0x56, 0x67, 0x78, 0x9A, 0xBA, 0x9A, 0x98, 0x87, 0x76, 0x66, 0x66,
+ 0x66, 0x78, 0x89, 0xAB, 0xBA, 0xAA, 0x98, 0x87, 0x76, 0x66, 0x66, 0x77,
+ 0x88, 0x9A, 0xBB, 0xAB, 0xA9, 0x98, 0x87, 0x77, 0x77, 0x77, 0x88, 0x9A,
+ 0xAC, 0xBA, 0xBA, 0xA9, 0x88, 0x87, 0x77, 0x78, 0x88, 0x9A, 0xAB, 0xCC,
+ 0xBB, 0xBA, 0xA9, 0x98, 0x88, 0x88, 0x89, 0x99, 0xAB, 0xCD, 0xCB, 0xCB,
+ 0xBA, 0xA9, 0x99, 0x99, 0x99, 0x9A, 0xBB, 0xCC, 0xDE, 0xBC, 0xCC, 0xBB,
+ 0xAA, 0xAA, 0xAA, 0xAB, 0xBB, 0xCD, 0xCE, 0xDB, 0xDE, 0xCC, 0xCB, 0xBB,
+ 0xBB, 0xBB, 0xBC, 0xCC, 0xDD, 0xED, 0x9C, 0xCB, 0xBB, 0xAB, 0xAA, 0xBA,
+ 0xBB, 0xBB, 0xCD, 0xDD, 0xD0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xBC, 0xBB, 0xAA, 0x99, 0x99, 0x99, 0x99, 0xAA, 0xAB, 0xBB, 0x9C, 0xCC,
+ 0xBB, 0xAA, 0x99, 0x99, 0x9A, 0xAA, 0xAB, 0xBC, 0xDC, 0xBC, 0xBA, 0xA9,
+ 0x99, 0x99, 0x99, 0x99, 0x9A, 0xAB, 0xBC, 0xBB, 0xBA, 0xA9, 0x98, 0x88,
+ 0x88, 0x88, 0x99, 0x9A, 0xAB, 0xBB, 0xAA, 0xA9, 0x98, 0x87, 0x77, 0x77,
+ 0x88, 0x89, 0x9A, 0xAB, 0xBA, 0xA9, 0x98, 0x87, 0x77, 0x77, 0x77, 0x78,
+ 0x89, 0x9A, 0xBA, 0xAA, 0x98, 0x87, 0x76, 0x66, 0x66, 0x77, 0x78, 0x89,
+ 0xAB, 0xA9, 0xA9, 0x88, 0x76, 0x66, 0x66, 0x66, 0x77, 0x88, 0x9A, 0xAA,
+ 0x99, 0x98, 0x77, 0x66, 0x65, 0x66, 0x66, 0x77, 0x89, 0x9A, 0xA9, 0x99,
+ 0x87, 0x76, 0x65, 0x55, 0x66, 0x67, 0x78, 0x99, 0xAA, 0x99, 0x98, 0x77,
+ 0x66, 0x65, 0x55, 0x66, 0x77, 0x89, 0x9A, 0xA9, 0x99, 0x87, 0x76, 0x66,
+ 0x55, 0x66, 0x67, 0x78, 0x9A, 0xAA, 0x9A, 0x98, 0x87, 0x76, 0x66, 0x66,
+ 0x66, 0x77, 0x89, 0xAA, 0xA9, 0xA9, 0x88, 0x77, 0x76, 0x66, 0x66, 0x77,
+ 0x88, 0x9A, 0xBB, 0xAA, 0x99, 0x88, 0x77, 0x77, 0x77, 0x77, 0x88, 0x99,
+ 0xAB, 0xBA, 0xBA, 0x99, 0x88, 0x87, 0x77, 0x77, 0x88, 0x99, 0xAB, 0xBB,
+ 0xAB, 0xAA, 0x99, 0x88, 0x88, 0x88, 0x88, 0x99, 0xAA, 0xBC, 0xBB, 0xBB,
+ 0xAA, 0x99, 0x99, 0x99, 0x99, 0x99, 0xAA, 0xBB, 0xDC, 0xBC, 0xBB, 0xAA,
+ 0xAA, 0x99, 0x99, 0xAA, 0xAA, 0xBC, 0xCD, 0xDB, 0xCD, 0xCB, 0xBB, 0xAA,
+ 0xAA, 0xAA, 0xAB, 0xBC, 0xCD, 0xDD, 0x9C, 0xBB, 0xBA, 0xAA, 0xAA, 0xAA,
+ 0xAA, 0xBB, 0xCC, 0xDD, 0xC0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xCC, 0xCB, 0xBA, 0xAA, 0xAA, 0x9A, 0xAA, 0xAA, 0xBB, 0xBB, 0x8C, 0xCD,
+ 0xBB, 0xBA, 0xAA, 0xAA, 0xAA, 0xAB, 0xBC, 0xCC, 0xDC, 0xCC, 0xBA, 0xBA,
+ 0xA9, 0x99, 0x99, 0x9A, 0xAA, 0xAB, 0xCC, 0xCC, 0xCB, 0xA9, 0x99, 0x88,
+ 0x88, 0x89, 0x99, 0x9A, 0xBB, 0xCB, 0xBB, 0xAA, 0x98, 0x88, 0x77, 0x78,
+ 0x88, 0x99, 0xAA, 0xBC, 0xBB, 0xAA, 0x98, 0x87, 0x77, 0x77, 0x77, 0x88,
+ 0x99, 0xAB, 0xBB, 0xAA, 0xA9, 0x87, 0x76, 0x66, 0x66, 0x77, 0x88, 0x99,
+ 0xAB, 0xAA, 0xA9, 0x88, 0x76, 0x66, 0x56, 0x66, 0x77, 0x89, 0x9A, 0xBB,
+ 0x9A, 0x98, 0x77, 0x66, 0x55, 0x55, 0x66, 0x78, 0x89, 0xAB, 0xAA, 0xA9,
+ 0x87, 0x76, 0x55, 0x55, 0x56, 0x67, 0x79, 0x9A, 0xBB, 0xAA, 0x98, 0x77,
+ 0x66, 0x55, 0x55, 0x66, 0x77, 0x89, 0xAA, 0xA9, 0xA9, 0x88, 0x76, 0x65,
+ 0x55, 0x56, 0x67, 0x78, 0x9A, 0xAA, 0xAA, 0x98, 0x87, 0x76, 0x66, 0x66,
+ 0x66, 0x78, 0x99, 0xAB, 0xBA, 0xBA, 0x98, 0x87, 0x76, 0x66, 0x66, 0x77,
+ 0x89, 0xAA, 0xBC, 0xAB, 0xAA, 0x98, 0x87, 0x77, 0x77, 0x77, 0x88, 0x9A,
+ 0xBC, 0xBA, 0xBA, 0xA9, 0x98, 0x88, 0x77, 0x78, 0x88, 0x9A, 0xBB, 0xCB,
+ 0xAB, 0xBA, 0xA9, 0x99, 0x88, 0x88, 0x89, 0x9A, 0xAB, 0xCC, 0xCB, 0xDB,
+ 0xAA, 0xAA, 0x99, 0x99, 0x99, 0x9A, 0xBB, 0xCD, 0xDC, 0xBC, 0xBB, 0xBA,
+ 0xAA, 0xAA, 0xAA, 0xAB, 0xBB, 0xCC, 0xDE, 0xDB, 0xCC, 0xCC, 0xBB, 0xBB,
+ 0xBB, 0xBB, 0xBC, 0xCC, 0xCE, 0xDD, 0x7B, 0xBB, 0xBA, 0xAA, 0xAA, 0xAA,
+ 0xBB, 0xCB, 0xCC, 0xCC, 0xC0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xDF, 0xDC, 0xFE, 0xCD, 0xCC, 0xDD, 0x7F, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xDF, 0xFF, 0xFF, 0xDF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFD, 0xFF, 0xDF, 0xFF, 0xDD, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFC, 0xDC,
+ 0xBD, 0xDF, 0xFD, 0xDF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFC, 0xDC, 0xCC, 0xBB,
+ 0xCC, 0xFF, 0xDF, 0xFF, 0xFD, 0xFF, 0xFD, 0xCB, 0xAA, 0xAA, 0xAC, 0xBB,
+ 0xBE, 0xDF, 0xFF, 0xEF, 0xDF, 0xDC, 0xA9, 0x98, 0x89, 0xAA, 0xCB, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xCC, 0xA9, 0x86, 0x66, 0x78, 0xAB, 0xCD, 0xFF, 0xFD,
+ 0xFF, 0xFD, 0xBA, 0x86, 0x54, 0x45, 0x79, 0xAC, 0xCF, 0xDF, 0xFF, 0xFF,
+ 0xCC, 0xA8, 0x64, 0x22, 0x46, 0x8A, 0xBE, 0xDF, 0xFF, 0xFF, 0xFD, 0xCA,
+ 0x86, 0x42, 0x24, 0x68, 0xAB, 0xCF, 0xFF, 0xFF, 0xFF, 0xDC, 0xA9, 0x75,
+ 0x44, 0x56, 0x8A, 0xCD, 0xDF, 0xFE, 0xFF, 0xFD, 0xDB, 0x98, 0x76, 0x66,
+ 0x89, 0xBC, 0xDF, 0xFF, 0xFF, 0xFF, 0xFC, 0xBA, 0x99, 0x88, 0x89, 0xBB,
+ 0xDD, 0xFF, 0xFF, 0xFF, 0xFD, 0xCC, 0xBA, 0xA9, 0x9A, 0xBC, 0xDD, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xDC, 0xBC, 0xBB, 0xCC, 0xCC, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xDC, 0xFD, 0xDD, 0xDD, 0xDF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xDC, 0xFD, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFD, 0xDF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFD, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, 0xCD, 0xDF, 0xFD, 0xEE, 0xDF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xDF, 0xFF, 0xFD, 0xFF, 0xFC, 0xFF, 0xFC, 0xFF, 0x7F, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xDF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFD,
+ 0xFF, 0xDF, 0xFF, 0xDF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFC, 0xFC, 0xCC, 0xCF,
+ 0xDD, 0xFF, 0xFC, 0xFF, 0xFF, 0xFF, 0xCF, 0xDD, 0xBB, 0xBA, 0xAC, 0xCB,
+ 0xFD, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xAA, 0x99, 0x89, 0xAA, 0xAF, 0xFF,
+ 0xFF, 0xFF, 0xCF, 0xFC, 0xBA, 0x87, 0x66, 0x79, 0xAB, 0xDD, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xCB, 0x97, 0x54, 0x45, 0x79, 0xBC, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xB9, 0x64, 0x22, 0x46, 0x8A, 0xDD, 0xDD, 0xFF, 0xFF, 0xFD, 0xDC,
+ 0x96, 0x42, 0x23, 0x69, 0xBB, 0xCF, 0xFF, 0xFF, 0xFF, 0xFC, 0xB9, 0x75,
+ 0x44, 0x57, 0x9B, 0xBF, 0xFF, 0xFF, 0xCF, 0xFF, 0xFF, 0xA9, 0x76, 0x66,
+ 0x89, 0xFB, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xCB, 0xA9, 0x88, 0x99, 0xAD,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xDC, 0xAA, 0xAB, 0xCC, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xDF, 0xFF, 0xDB, 0xBB, 0xBF, 0xCF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xDD, 0xFD, 0xFD, 0xFC, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xDC, 0xDC, 0xDF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xDD, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, 0xDF, 0xFD, 0xFF, 0xFA, 0xBD,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0x89, 0x99, 0x98, 0x88, 0x88, 0x88, 0x88, 0x98, 0x98, 0x9A, 0x6A, 0xCB,
+ 0x9A, 0xA9, 0x99, 0x99, 0xAA, 0x9A, 0xAB, 0xAA, 0xDA, 0x9A, 0xA9, 0x89,
+ 0x99, 0x89, 0x99, 0x89, 0x8A, 0x99, 0xAA, 0x9A, 0xAA, 0x99, 0x88, 0x88,
+ 0x88, 0x88, 0x89, 0xA9, 0xAA, 0xAA, 0x89, 0xA9, 0x98, 0x88, 0x88, 0x88,
+ 0x88, 0x89, 0x9A, 0xB9, 0xA9, 0xA9, 0x98, 0x78, 0x77, 0x77, 0x77, 0x88,
+ 0x89, 0x9A, 0xA9, 0x89, 0x98, 0x87, 0x76, 0x76, 0x77, 0x77, 0x88, 0x99,
+ 0x9A, 0xA8, 0x98, 0x88, 0x76, 0x66, 0x66, 0x77, 0x77, 0x88, 0x89, 0x98,
+ 0x89, 0x98, 0x87, 0x76, 0x66, 0x66, 0x67, 0x78, 0x88, 0x9B, 0xA8, 0x99,
+ 0x87, 0x76, 0x65, 0x55, 0x66, 0x77, 0x88, 0x98, 0xA8, 0x89, 0x88, 0x87,
+ 0x76, 0x65, 0x56, 0x67, 0x77, 0x88, 0x99, 0x98, 0x99, 0x78, 0x77, 0x66,
+ 0x65, 0x66, 0x67, 0x78, 0x8A, 0x99, 0x89, 0x98, 0x78, 0x77, 0x66, 0x66,
+ 0x67, 0x77, 0x88, 0xAB, 0x98, 0x99, 0x89, 0x87, 0x77, 0x76, 0x67, 0x77,
+ 0x88, 0x89, 0xA9, 0x9A, 0x9A, 0x98, 0x77, 0x77, 0x77, 0x77, 0x78, 0x89,
+ 0x9B, 0x98, 0xA9, 0x99, 0x88, 0x88, 0x87, 0x78, 0x88, 0x88, 0x9A, 0xA9,
+ 0x8A, 0x99, 0x99, 0x89, 0x88, 0x88, 0x88, 0x99, 0x8A, 0xAA, 0xA9, 0xAB,
+ 0xAA, 0x98, 0x88, 0x89, 0x88, 0x89, 0x9A, 0xBA, 0xA9, 0xAC, 0xBA, 0xB9,
+ 0xAA, 0x99, 0x99, 0x9A, 0x99, 0xAA, 0xAD, 0xA9, 0xBA, 0xAB, 0xAB, 0xA9,
+ 0x9A, 0x9A, 0xBA, 0xAA, 0x9C, 0xBB, 0x8B, 0xA9, 0xA8, 0x99, 0x98, 0x88,
+ 0x99, 0x9A, 0xAA, 0xAB, 0xA0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFE, 0xDD, 0xCC, 0xCC, 0xDC, 0xDD, 0xED, 0xEF, 0xDF, 0xFF,
+ 0xED, 0xDC, 0xBB, 0xBB, 0xBC, 0xCC, 0xDE, 0xFF, 0xFF, 0xFF, 0xFE, 0xCB,
+ 0xBA, 0xAA, 0xAA, 0xAB, 0xBC, 0xDE, 0xFF, 0xFF, 0xFD, 0xCB, 0xAA, 0x99,
+ 0x99, 0x99, 0xAA, 0xBC, 0xDD, 0xFF, 0xFD, 0xCB, 0xA9, 0x98, 0x87, 0x88,
+ 0x89, 0x9A, 0xBC, 0xFF, 0xFE, 0xDC, 0xA9, 0x88, 0x77, 0x77, 0x77, 0x88,
+ 0x9A, 0xBC, 0xDF, 0xDC, 0xBA, 0x98, 0x76, 0x66, 0x66, 0x67, 0x89, 0xAB,
+ 0xCD, 0xEE, 0xBB, 0x98, 0x76, 0x65, 0x55, 0x56, 0x67, 0x89, 0xAB, 0xDF,
+ 0xCB, 0xA9, 0x87, 0x65, 0x55, 0x55, 0x56, 0x78, 0x9A, 0xBD, 0xDC, 0xBA,
+ 0x98, 0x76, 0x55, 0x45, 0x55, 0x67, 0x89, 0xAB, 0xDD, 0xCB, 0xA9, 0x87,
+ 0x65, 0x55, 0x45, 0x56, 0x78, 0x9A, 0xBC, 0xDC, 0xBA, 0x98, 0x76, 0x65,
+ 0x55, 0x55, 0x67, 0x89, 0xAC, 0xDD, 0xCC, 0xA9, 0x87, 0x76, 0x55, 0x55,
+ 0x66, 0x78, 0x9B, 0xCD, 0xEC, 0xCA, 0xA9, 0x87, 0x66, 0x66, 0x66, 0x78,
+ 0x9A, 0xBC, 0xDF, 0xDC, 0xBA, 0x99, 0x87, 0x77, 0x77, 0x78, 0x89, 0xAB,
+ 0xDF, 0xFF, 0xDC, 0xBA, 0x99, 0x88, 0x88, 0x88, 0x99, 0xAB, 0xCD, 0xFF,
+ 0xFE, 0xCB, 0xBA, 0x99, 0x99, 0x99, 0x9A, 0xAB, 0xCD, 0xFF, 0xFF, 0xFD,
+ 0xDC, 0xCB, 0xAA, 0xAA, 0xAA, 0xBC, 0xCD, 0xFF, 0xFF, 0xFF, 0xEF, 0xDD,
+ 0xCB, 0xBB, 0xBB, 0xCC, 0xDD, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFD, 0xDD,
+ 0xDD, 0xDE, 0xDE, 0xFF, 0xFF, 0xFF, 0xCF, 0xFE, 0xFE, 0xFE, 0xEF, 0xDD,
+ 0xDF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0x9B, 0xAA, 0x99, 0xA9, 0x89, 0x89, 0x99, 0x98, 0x99, 0xBB, 0x6B, 0xAB,
+ 0xBA, 0xAA, 0x99, 0x99, 0x99, 0xBA, 0xAB, 0xBE, 0xFB, 0x9B, 0xAA, 0x99,
+ 0x99, 0x99, 0x99, 0xA9, 0xAC, 0x9B, 0xBA, 0xC9, 0xB9, 0xA9, 0x99, 0x88,
+ 0x89, 0x88, 0x89, 0xAA, 0xAA, 0xBA, 0x99, 0x99, 0x88, 0x88, 0x77, 0x87,
+ 0x88, 0x89, 0xAA, 0xAA, 0xA9, 0x9A, 0x88, 0x87, 0x77, 0x77, 0x78, 0x88,
+ 0x99, 0xAA, 0xA9, 0x9A, 0x99, 0x87, 0x76, 0x66, 0x67, 0x77, 0x88, 0x99,
+ 0xBB, 0xA9, 0x99, 0x88, 0x77, 0x66, 0x66, 0x66, 0x78, 0x88, 0x99, 0xB9,
+ 0x9A, 0x98, 0x87, 0x66, 0x55, 0x56, 0x67, 0x78, 0x89, 0xAA, 0x99, 0x99,
+ 0x87, 0x76, 0x65, 0x55, 0x56, 0x77, 0x78, 0x8A, 0xA9, 0x99, 0x99, 0x87,
+ 0x66, 0x55, 0x55, 0x66, 0x78, 0x99, 0xAB, 0xA8, 0x99, 0x98, 0x76, 0x66,
+ 0x55, 0x56, 0x67, 0x78, 0x99, 0xA9, 0x99, 0x98, 0x98, 0x77, 0x66, 0x66,
+ 0x67, 0x78, 0x98, 0x9B, 0xA9, 0x99, 0x98, 0x87, 0x77, 0x66, 0x77, 0x77,
+ 0x89, 0x99, 0xCA, 0x9A, 0xA9, 0x88, 0x87, 0x77, 0x77, 0x77, 0x88, 0x9A,
+ 0xAB, 0x99, 0xBA, 0x99, 0x88, 0x88, 0x87, 0x88, 0x88, 0x89, 0x9B, 0xB9,
+ 0xAB, 0xA9, 0xAA, 0x88, 0x88, 0x88, 0x88, 0x9A, 0xBA, 0xAB, 0xA9, 0xEA,
+ 0xAA, 0x9A, 0xA9, 0x9A, 0x89, 0x99, 0x9A, 0xAC, 0xAB, 0xAC, 0xDA, 0xBA,
+ 0xAA, 0x9A, 0x99, 0xAA, 0xAB, 0xBA, 0xCC, 0xAA, 0xFB, 0xDB, 0xBA, 0xAA,
+ 0xAA, 0xBA, 0xBB, 0xBB, 0xFC, 0xFB, 0x7A, 0x99, 0x99, 0x99, 0x99, 0x99,
+ 0x99, 0x9A, 0xAA, 0xAB, 0xA0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x9F, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFC, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFB, 0xA9, 0xAA, 0xBB, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFB, 0x98, 0x77, 0x89, 0xAF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xA8, 0x54, 0x46, 0x8A, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xDA, 0x74, 0x12, 0x47, 0xAB, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xA7, 0x42, 0x24, 0x79, 0xBF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xBA, 0x86,
+ 0x44, 0x57, 0xAF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xB9, 0x87, 0x77,
+ 0x9B, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFB, 0xBA, 0x9A, 0xAB, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0x8A, 0x98, 0x88, 0x87, 0x77, 0xF7, 0x6F, 0x88, 0x8F, 0xAA, 0x59, 0xFA,
+ 0xAF, 0xAF, 0x8A, 0x87, 0x8A, 0xA8, 0xFA, 0xA9, 0xF9, 0x9A, 0xAF, 0x98,
+ 0x9A, 0x79, 0x89, 0x78, 0x9A, 0xFA, 0xFF, 0xAC, 0x88, 0x8F, 0x87, 0x88,
+ 0xA8, 0x89, 0x9A, 0x87, 0xAF, 0xFA, 0x7A, 0xA9, 0x87, 0x78, 0x77, 0x98,
+ 0x78, 0x89, 0xAA, 0xFA, 0xA8, 0x98, 0x99, 0x87, 0x78, 0x87, 0x77, 0x87,
+ 0x87, 0xFA, 0xE8, 0x8B, 0x97, 0x76, 0x88, 0x77, 0x67, 0x77, 0x78, 0x78,
+ 0x8A, 0x87, 0xA9, 0x8F, 0x77, 0x77, 0x67, 0x97, 0x88, 0x78, 0x99, 0xA8,
+ 0x79, 0x89, 0x77, 0x76, 0x66, 0x76, 0x77, 0x77, 0x8F, 0x89, 0x98, 0xF9,
+ 0x88, 0x97, 0x66, 0x57, 0x67, 0x78, 0x77, 0xA9, 0x88, 0x78, 0x87, 0x87,
+ 0x66, 0x66, 0x66, 0x67, 0x68, 0x97, 0xF9, 0x88, 0xA8, 0x78, 0x87, 0x76,
+ 0x66, 0x77, 0x68, 0x77, 0x88, 0x89, 0x99, 0xA8, 0x78, 0x77, 0x77, 0x76,
+ 0x67, 0x76, 0x77, 0x89, 0xA9, 0x8A, 0x87, 0x87, 0x77, 0x68, 0x76, 0x76,
+ 0x88, 0x9A, 0x9A, 0xAA, 0xA7, 0x97, 0x87, 0x87, 0x87, 0x77, 0x99, 0x77,
+ 0x9A, 0x87, 0x9A, 0x99, 0x79, 0x79, 0x76, 0x87, 0x98, 0x99, 0xA8, 0x88,
+ 0x98, 0x9A, 0xA9, 0x99, 0x97, 0x98, 0x8A, 0x98, 0x9A, 0xFF, 0xA8, 0xFA,
+ 0x7F, 0x8A, 0x8F, 0x98, 0x8A, 0xA8, 0xFF, 0xF9, 0xA8, 0xAF, 0x99, 0x99,
+ 0x88, 0x99, 0xAA, 0x98, 0x9A, 0xAA, 0xAF, 0xAA, 0xFA, 0xF9, 0x9A, 0xFA,
+ 0xF9, 0x8A, 0xA8, 0x98, 0xAF, 0xA9, 0x9F, 0xFA, 0x89, 0x87, 0x78, 0x98,
+ 0x87, 0x8A, 0x87, 0x99, 0x90, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFB, 0xFF, 0xBF, 0xFF, 0xFF, 0x6F, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFA, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFA, 0xBF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xBA, 0x88, 0xAB, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xF8, 0x65, 0x57, 0x9F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0x84, 0x12, 0x58, 0xAF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xF8, 0x52, 0x14, 0x8F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFB, 0x96,
+ 0x54, 0x68, 0xAF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFA, 0xA8, 0x89,
+ 0xAF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xEB, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFC, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x6F, 0xFB, 0xFF, 0xFF, 0xFF, 0xBF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xEF, 0xFE, 0xEF, 0xFF, 0xFE, 0xEE, 0xE5, 0xFF, 0xFF, 0xFF, 0xFE,
+ 0xEE, 0xEE, 0xEE, 0xEF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xEE,
+ 0xEE, 0xEE, 0x4E, 0xEE, 0xEE, 0xEE, 0xEE, 0xEF, 0xFF, 0xFF, 0x5F, 0xFF,
+ 0xFF, 0xF5, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xEE, 0x5E,
+ 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xE5, 0xE5,
+ 0xEE, 0xEE, 0xEE, 0xEF, 0xFF, 0x55, 0xF5, 0x5F, 0xF5, 0xFF, 0x5F, 0x5F,
+ 0xFF, 0xFF, 0xF4, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x55, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xF5, 0xFF, 0xF5, 0xFF, 0x5F, 0x4F, 0xFE, 0xEE, 0xEE, 0xEE, 0xEE,
+ 0xEE, 0xEE, 0xEE, 0xE3, 0xE5, 0xEE, 0x5E, 0xEE, 0xEE, 0xEE, 0xE5, 0x4E,
+ 0xEE, 0x5E, 0x5E, 0xE5, 0x5E, 0x5E, 0x55, 0xEE, 0xEE, 0x54, 0xEE, 0xE5,
+ 0x5E, 0xE5, 0xE6, 0x5E, 0xEE, 0xEE, 0xEE, 0xEF, 0xF5, 0xFF, 0xF5, 0xFF,
+ 0xF5, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x5F, 0xF5, 0xFF, 0x5F, 0xFF,
+ 0xF5, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF5, 0xFF, 0x5F, 0xF5, 0x5F, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xF4, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF5, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0x5F, 0xFF, 0xFF, 0xFF, 0xFE, 0xFF, 0xFE, 0xFF, 0x5F,
+ 0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xFF, 0xFE, 0xFE, 0xFF,
+ 0xFF, 0xFF, 0xFE, 0xFF, 0xF0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0x78, 0xF6, 0x66, 0x68, 0x76, 0x67, 0x67, 0x98, 0x78, 0x7F, 0x68, 0x98,
+ 0x9F, 0xF8, 0xF7, 0xFE, 0x8F, 0xFF, 0x9F, 0xFF, 0x9F, 0x88, 0x7F, 0x88,
+ 0x9F, 0x79, 0x9F, 0xFF, 0x8F, 0x9F, 0xF9, 0x96, 0x99, 0x97, 0x78, 0x67,
+ 0xF7, 0x98, 0xFF, 0x79, 0x99, 0xF8, 0x77, 0xF8, 0x89, 0x97, 0x78, 0x89,
+ 0xF7, 0x8F, 0xFF, 0xFF, 0x78, 0x99, 0x79, 0x97, 0x97, 0x77, 0x99, 0x7F,
+ 0x79, 0x99, 0x98, 0x77, 0x9F, 0x67, 0x67, 0x67, 0x78, 0x98, 0x9F, 0x99,
+ 0x89, 0xF6, 0x9F, 0x79, 0x78, 0x76, 0x66, 0xF8, 0x78, 0x89, 0x78, 0xF8,
+ 0x87, 0x88, 0x99, 0x87, 0x77, 0x69, 0x79, 0x78, 0xF7, 0x9F, 0x77, 0xF9,
+ 0x99, 0x76, 0x77, 0x77, 0x68, 0x87, 0x78, 0x9F, 0x97, 0x88, 0x78, 0x89,
+ 0x97, 0x76, 0x77, 0x77, 0x89, 0x8F, 0x8F, 0x67, 0x89, 0x98, 0x89, 0x78,
+ 0x77, 0x87, 0x78, 0x79, 0x78, 0x96, 0x68, 0x9F, 0xA8, 0x97, 0x78, 0x78,
+ 0x8F, 0x89, 0x79, 0x8F, 0x67, 0xFF, 0x8F, 0x99, 0x77, 0x66, 0x66, 0x76,
+ 0x86, 0xF8, 0xF6, 0x99, 0x9F, 0x7F, 0x89, 0x97, 0x79, 0x88, 0x6F, 0x88,
+ 0x89, 0x68, 0xFF, 0xFF, 0xF9, 0x98, 0x89, 0xF8, 0xFF, 0x98, 0x9F, 0xF7,
+ 0x78, 0x79, 0xF9, 0x77, 0x89, 0xF8, 0x97, 0x89, 0xF9, 0x98, 0x77, 0x9F,
+ 0x9F, 0x89, 0x9F, 0x99, 0x98, 0x9F, 0x99, 0x9F, 0x98, 0x89, 0x98, 0xFF,
+ 0x9F, 0xF8, 0xF9, 0x88, 0x9F, 0x7F, 0xF9, 0x67, 0xFF, 0x99, 0x98, 0xF9,
+ 0xFF, 0x89, 0x9F, 0xFF, 0x9F, 0xF9, 0x59, 0x77, 0x98, 0x68, 0x96, 0x77,
+ 0x68, 0x89, 0xF7, 0x6F, 0x60, 0x00, 0x00, 0x00,
+ },
+ {
+ 0x68, 0x89, 0x78, 0x77, 0x67, 0x88, 0x88, 0xFF, 0x79, 0x99, 0x69, 0xF9,
+ 0xF9, 0x88, 0x87, 0x79, 0x8F, 0xF9, 0xF8, 0xF9, 0xF7, 0x8F, 0x98, 0x78,
+ 0x79, 0xF9, 0xF8, 0x88, 0x79, 0x7F, 0xF9, 0x97, 0xFF, 0x8F, 0x98, 0x78,
+ 0x77, 0x67, 0xF8, 0xF9, 0xFF, 0xF9, 0x78, 0xF8, 0x88, 0x87, 0x88, 0x77,
+ 0x98, 0xF7, 0x98, 0xFF, 0x98, 0x9F, 0xF8, 0x98, 0x87, 0x76, 0x79, 0x97,
+ 0x78, 0x89, 0x8C, 0x77, 0x88, 0x78, 0x77, 0x77, 0x88, 0x77, 0x78, 0x79,
+ 0x9F, 0x88, 0x79, 0x77, 0x77, 0x77, 0x67, 0x77, 0x77, 0x8F, 0x99, 0x97,
+ 0x87, 0x77, 0x78, 0x87, 0x78, 0x76, 0x77, 0x78, 0x9F, 0x99, 0xF7, 0x77,
+ 0x98, 0x76, 0x76, 0x77, 0x68, 0x7F, 0x78, 0xFF, 0xF9, 0x78, 0x88, 0x87,
+ 0x88, 0x76, 0x67, 0x88, 0x79, 0x78, 0xF9, 0x87, 0x89, 0x97, 0x77, 0x68,
+ 0x67, 0x77, 0x77, 0x77, 0x8E, 0x78, 0x78, 0x8A, 0x88, 0x77, 0x87, 0x77,
+ 0x67, 0x88, 0x88, 0x8F, 0x87, 0x89, 0x88, 0x77, 0x76, 0x77, 0x79, 0x77,
+ 0x77, 0x8F, 0x88, 0x79, 0xF8, 0x77, 0x78, 0x77, 0x88, 0x77, 0x78, 0x98,
+ 0x89, 0x89, 0xFF, 0xF8, 0x88, 0x99, 0x77, 0x98, 0x78, 0x87, 0x99, 0x99,
+ 0x98, 0xF8, 0x98, 0xFF, 0xFF, 0x79, 0x88, 0x77, 0x79, 0x8F, 0x88, 0xF8,
+ 0x88, 0xFF, 0x88, 0x78, 0x99, 0x9F, 0x88, 0xF9, 0xF8, 0x88, 0x99, 0xB9,
+ 0xF7, 0x88, 0x99, 0xF9, 0x99, 0x9F, 0xFF, 0x99, 0xFF, 0x8F, 0x98, 0x8F,
+ 0x89, 0x99, 0xF8, 0x99, 0x8F, 0xF9, 0x5F, 0x89, 0x77, 0x87, 0x99, 0x78,
+ 0x88, 0x77, 0xF8, 0x8F, 0x80, 0x00, 0x00, 0x00,
+ },
+ {
+ 0x5E, 0xDE, 0xE5, 0xDE, 0xEE, 0xED, 0xDD, 0xDE, 0xEE, 0xEE, 0x4E, 0xED,
+ 0xDD, 0xDD, 0xDD, 0xDE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xED,
+ 0xDD, 0x4D, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDE, 0xEE, 0xEE, 0xEE, 0xEE,
+ 0xEE, 0x5E, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xDD,
+ 0x5D, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xD5, 0x45, 0xDD,
+ 0xDD, 0xDD, 0xDD, 0xDE, 0xEE, 0xEE, 0xE5, 0xEE, 0xEE, 0xE5, 0xEE, 0xEE,
+ 0x5E, 0xEE, 0xEE, 0xEE, 0xE5, 0xE5, 0xEE, 0xE5, 0x54, 0xEE, 0xEE, 0xEE,
+ 0xEE, 0xEE, 0x45, 0xEE, 0xEE, 0x55, 0xEE, 0xEE, 0xE5, 0xED, 0xDD, 0xDD,
+ 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0x5D, 0xDD, 0xDD, 0xDD, 0x55, 0xDD, 0xDD,
+ 0x55, 0x5D, 0x4D, 0xDD, 0xDD, 0x45, 0xDD, 0x5D, 0xDD, 0xDD, 0xDD, 0xDD,
+ 0x54, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDE, 0x5E, 0xEE, 0x5E, 0xEE,
+ 0xEE, 0x5E, 0xEE, 0xEE, 0xE5, 0xEE, 0xEE, 0xEE, 0x4E, 0xEE, 0x4E, 0xEE,
+ 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0x5E, 0xEE, 0xE4, 0xE5, 0xEE, 0xEE, 0xEE,
+ 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xE5, 0xEE, 0xEE, 0xEE, 0x5E, 0xEE,
+ 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0x55, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE,
+ 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xE5, 0x5E, 0xEE, 0xEE, 0xEE, 0xEE, 0xED,
+ 0xEE, 0xED, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xE5, 0xED, 0xED,
+ 0xEE, 0xEE, 0xEE, 0x5E, 0xEE, 0xEE, 0xED, 0xED, 0xEE, 0xE5, 0xEE, 0xEE,
+ 0xED, 0xED, 0xED, 0xEE, 0xE0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0x88, 0x88, 0x88, 0x78, 0x88, 0x88, 0x87, 0x78, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x87, 0x77, 0x78, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x77, 0x77, 0x77, 0x77, 0x78, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x87, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x78, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x78, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x80, 0x00, 0x00, 0x00,
+ },
+ {
+ 0x88, 0x88, 0x88, 0x78, 0x88, 0x88, 0x87, 0x78, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x87, 0x77, 0x78, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x77, 0x77, 0x77, 0x77, 0x78, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x87, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x78, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x78, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x80, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x9F, 0xFF, 0xF9, 0xF8, 0xF9, 0x4F, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF9, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xF8, 0x64, 0x68, 0x9F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0x85, 0x12, 0x6F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0x52, 0x14, 0xDF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF9,
+ 0x54, 0x5F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF8, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x59, 0xFF, 0xFF, 0xFF, 0xFA, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xF7, 0xFF, 0xFF, 0xFF, 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xF7, 0x7F, 0xFF, 0xFF, 0xFF, 0x6F, 0xFF, 0xF6,
+ 0xF6, 0xFF, 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xF6, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xF7, 0xF6, 0xFF, 0xF6, 0xFF, 0xFF, 0xFF, 0xF6, 0xFF, 0xFF, 0x66, 0xF6,
+ 0xFF, 0xF6, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x57, 0x67, 0x6F, 0xFF,
+ 0xFF, 0xFF, 0xFD, 0xBF, 0xF7, 0xF7, 0x6F, 0x66, 0x6F, 0x66, 0xF6, 0xFF,
+ 0xFF, 0xF6, 0xF6, 0xFF, 0x75, 0x76, 0xF5, 0x66, 0x66, 0x66, 0xFF, 0xFF,
+ 0xF6, 0xFF, 0xFF, 0xF5, 0x57, 0x66, 0xFF, 0xFF, 0x7F, 0xFF, 0xFF, 0xF6,
+ 0xFF, 0x56, 0x56, 0x75, 0x77, 0xFF, 0x6F, 0xFF, 0xFF, 0xFF, 0xF7, 0xF6,
+ 0xF6, 0xF6, 0x44, 0xF5, 0xF6, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x66,
+ 0x56, 0x75, 0x56, 0xF6, 0xFF, 0xFD, 0xC6, 0xAF, 0xF6, 0x6F, 0xFF, 0x55,
+ 0x57, 0x5F, 0x7F, 0xFF, 0xFF, 0xF7, 0xFF, 0xFF, 0x65, 0x6F, 0xFF, 0x68,
+ 0x7F, 0xFF, 0xFF, 0x6F, 0xFF, 0xF6, 0xF6, 0x5F, 0x65, 0x6F, 0x6F, 0xFF,
+ 0xFF, 0xFF, 0xF6, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, 0xF6, 0x6F, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0x6F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x6F, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0x6F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF6, 0xFF, 0xFF,
+ 0x6F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x5F, 0x7F, 0x7F, 0xFF, 0xFF, 0x7F,
+ 0xFF, 0x7F, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0x88, 0x88, 0x88, 0x78, 0x88, 0x88, 0x87, 0x78, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x87, 0x77, 0x78, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x77, 0x77, 0x77, 0x77, 0x78, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x87, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x78, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x78, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x80, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFD, 0xBF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xF6, 0x6F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0x12, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0x61, 0x15, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xF5, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x3F, 0x9F, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0x88, 0x88, 0x88, 0x78, 0x88, 0x88, 0x87, 0x78, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x87, 0x77, 0x78, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x77, 0x77, 0x77, 0x77, 0x78, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x87, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x78, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x78, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x80, 0x00, 0x00, 0x00,
+ },
+ {
+ 0x88, 0x88, 0x88, 0x78, 0x88, 0x88, 0x87, 0x78, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x87, 0x77, 0x78, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x77, 0x77, 0x77, 0x77, 0x78, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x87, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x78, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x78, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x80, 0x00, 0x00, 0x00,
+ },
+ {
+ 0x88, 0x88, 0x88, 0x78, 0x88, 0x88, 0x87, 0x78, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x87, 0x77, 0x78, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x77, 0x77, 0x77, 0x77, 0x78, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x87, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x78, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x78, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x80, 0x00, 0x00, 0x00,
+ },
+ {
+ 0x88, 0x88, 0x88, 0x78, 0x88, 0x88, 0x87, 0x78, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x87, 0x77, 0x78, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x77, 0x77, 0x77, 0x77, 0x78, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x87, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x78, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x78, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x80, 0x00, 0x00, 0x00,
+ },
+ {
+ 0x88, 0x88, 0x88, 0x78, 0x88, 0x88, 0x87, 0x78, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x87, 0x77, 0x78, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x77, 0x77, 0x77, 0x77, 0x78, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x87, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x78, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x78, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x80, 0x00, 0x00, 0x00,
+ },
+ {
+ 0x88, 0x88, 0x88, 0x78, 0x88, 0x88, 0x87, 0x78, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x87, 0x77, 0x78, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x77, 0x77, 0x77, 0x77, 0x78, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x87, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x78, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x78, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x80, 0x00, 0x00, 0x00,
+ },
+ {
+ 0x88, 0x88, 0x88, 0x78, 0x88, 0x88, 0x87, 0x78, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x87, 0x77, 0x78, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x77, 0x77, 0x77, 0x77, 0x78, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x87, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x78, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x78, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x80, 0x00, 0x00, 0x00,
+ },
+ {
+ 0x88, 0x88, 0x88, 0x78, 0x88, 0x88, 0x87, 0x78, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x87, 0x77, 0x78, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x77, 0x77, 0x77, 0x77, 0x78, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x87, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x78, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x78, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x80, 0x00, 0x00, 0x00,
+ },
+ },
+ {
+ {
+ 0x88, 0x88, 0x88, 0x78, 0x88, 0x88, 0x87, 0x78, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x87, 0x77, 0x78, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x77, 0x77, 0x77, 0x77, 0x78, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x87, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x78, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x78, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x80, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xEE, 0xEE, 0xEE, 0xDE, 0xEE, 0xEE, 0xDD, 0xDE, 0xEE, 0xEE, 0xEE, 0xED,
+ 0xDD, 0xDD, 0xDD, 0xDE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xED,
+ 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDE, 0xEE, 0xEE, 0xEE, 0xEE,
+ 0x5E, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0x5E, 0xED,
+ 0xD5, 0x55, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD,
+ 0xDD, 0xDD, 0xDD, 0xDE, 0xEE, 0xEE, 0xE5, 0xE5, 0xEE, 0xEE, 0xEE, 0xEE,
+ 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xE5, 0xEE, 0xE5, 0xEE, 0xEE, 0xEE, 0xEE,
+ 0xEE, 0xEE, 0x5E, 0x5E, 0xEE, 0x55, 0x54, 0xEE, 0xEE, 0xEE, 0xEE, 0xED,
+ 0xDD, 0xDD, 0xD5, 0x5D, 0x44, 0x5D, 0xDD, 0xDD, 0xDD, 0xDD, 0x5D, 0xD5,
+ 0xD5, 0x5D, 0xDD, 0xD3, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0x5D,
+ 0xD4, 0x35, 0x5D, 0xDD, 0xDD, 0xDD, 0xDD, 0xD5, 0x5E, 0xE4, 0x54, 0x53,
+ 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xE5, 0xEE, 0xEE, 0x5E, 0xEE,
+ 0xEE, 0xEE, 0xEE, 0xEE, 0xE5, 0xEE, 0x5E, 0xEE, 0xE5, 0x5E, 0xEE, 0x5E,
+ 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE,
+ 0xEE, 0xEE, 0xEE, 0xEE, 0x5E, 0xEE, 0xE4, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE,
+ 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE,
+ 0xE5, 0xEE, 0xEE, 0xED, 0xEE, 0xED, 0xDD, 0xED, 0xED, 0xED, 0xED, 0xEE,
+ 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xED, 0xEE, 0xEE, 0xED,
+ 0xEE, 0xED, 0xED, 0xEE, 0xE0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xBD, 0xDC, 0xCD, 0xCC, 0xCC, 0xDC, 0xDD, 0xFF, 0xFF, 0xFF, 0xDD, 0xEF,
+ 0xED, 0xDC, 0xCC, 0xCC, 0xCC, 0xDF, 0xEF, 0xFF, 0xFF, 0xDF, 0xFD, 0xDC,
+ 0xBB, 0xBB, 0xAA, 0xBB, 0xCD, 0xDF, 0xFF, 0xFD, 0xED, 0xCC, 0xBB, 0xA9,
+ 0x99, 0x99, 0xAA, 0xBC, 0xDF, 0xFF, 0xCD, 0xCC, 0xBA, 0x99, 0x88, 0x88,
+ 0x89, 0x9A, 0xBC, 0xDF, 0xEC, 0xDC, 0xBA, 0x98, 0x87, 0x77, 0x77, 0x88,
+ 0x9A, 0xBC, 0xEE, 0xDD, 0xBA, 0xA8, 0x87, 0x76, 0x66, 0x67, 0x88, 0x9A,
+ 0xCD, 0xDD, 0xDB, 0xA9, 0x87, 0x66, 0x66, 0x66, 0x67, 0x89, 0xAB, 0xCD,
+ 0xCC, 0xA9, 0x87, 0x76, 0x55, 0x55, 0x56, 0x77, 0x89, 0xBD, 0xDC, 0xCB,
+ 0x98, 0x76, 0x65, 0x55, 0x55, 0x66, 0x78, 0x9A, 0xBD, 0xCC, 0xA9, 0x87,
+ 0x65, 0x55, 0x55, 0x56, 0x67, 0x89, 0xAD, 0xCD, 0xCA, 0x98, 0x76, 0x65,
+ 0x55, 0x55, 0x66, 0x78, 0x9A, 0xCC, 0xDC, 0xB9, 0x87, 0x66, 0x55, 0x55,
+ 0x56, 0x77, 0x8A, 0xBC, 0xDD, 0xDB, 0xA9, 0x87, 0x66, 0x55, 0x66, 0x67,
+ 0x89, 0xAB, 0xCD, 0xEC, 0xCA, 0x98, 0x87, 0x66, 0x66, 0x77, 0x88, 0x9A,
+ 0xBC, 0xDE, 0xDC, 0xBA, 0x99, 0x87, 0x77, 0x77, 0x89, 0x9A, 0xBC, 0xDC,
+ 0xFE, 0xEC, 0xBA, 0x99, 0x88, 0x88, 0x89, 0x9A, 0xBC, 0xCD, 0xDF, 0xFE,
+ 0xDC, 0xBB, 0xA9, 0x99, 0x9A, 0xAA, 0xBC, 0xCD, 0xEE, 0xFF, 0xFF, 0xDC,
+ 0xCB, 0xBA, 0xAB, 0xBB, 0xCC, 0xDD, 0xDE, 0xDF, 0xFF, 0xFF, 0xED, 0xCC,
+ 0xCC, 0xCC, 0xCC, 0xDD, 0xEF, 0xED, 0xDF, 0xFF, 0xDF, 0xDD, 0xDD, 0xDC,
+ 0xCC, 0xCD, 0xED, 0xCE, 0xB0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xEE, 0xEE, 0xEE, 0xDE, 0xEE, 0xEE, 0xDD, 0xDE, 0xEE, 0xEE, 0xEE, 0xEE,
+ 0xED, 0xDD, 0xDD, 0xDE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE,
+ 0xEE, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDE, 0xEE, 0xEE, 0xEE, 0xEE,
+ 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0x4E,
+ 0xEE, 0xED, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xD4, 0xDD,
+ 0xDD, 0xDD, 0xDD, 0xDE, 0xEE, 0xEE, 0xEE, 0x4E, 0x4E, 0x4E, 0xEE, 0xEE,
+ 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0x4E, 0xEE, 0xEE, 0xEE,
+ 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE,
+ 0xEE, 0xEE, 0xE4, 0xE3, 0x4D, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD,
+ 0xDD, 0xDD, 0xDD, 0x4D, 0x4D, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD,
+ 0x44, 0x4D, 0x4D, 0xDD, 0xDD, 0xDD, 0xDD, 0x4E, 0xE4, 0xEE, 0x3E, 0x4E,
+ 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xE3, 0xEE, 0xE5, 0xEE, 0xEE,
+ 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xE4, 0xEE, 0xEE, 0xEE, 0x4E, 0xEE,
+ 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0x4E, 0x3E, 0xEE, 0xEE, 0xEE,
+ 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xE4, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE,
+ 0xEE, 0xEE, 0xEE, 0x4E, 0xEE, 0x4E, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE,
+ 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xED, 0xED, 0xEE, 0xEE, 0xEE,
+ 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE,
+ 0xEE, 0xEE, 0xEE, 0xEE, 0xE0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0x88, 0x88, 0x88, 0x78, 0x88, 0x88, 0x87, 0x78, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x87, 0x77, 0x78, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x77, 0x77, 0x77, 0x77, 0x78, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x87, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x78, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x78, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x80, 0x00, 0x00, 0x00,
+ },
+ {
+ 0x9C, 0xBB, 0xAA, 0xAA, 0xAA, 0x9A, 0xAA, 0xAB, 0xBC, 0xCD, 0xBB, 0xCC,
+ 0xBB, 0xBB, 0xAA, 0xAA, 0xAA, 0xAB, 0xBC, 0xCD, 0xDC, 0xBC, 0xCB, 0xAA,
+ 0xA9, 0x99, 0x99, 0xAA, 0xAB, 0xAB, 0xCD, 0xDB, 0xCB, 0xAA, 0x99, 0x99,
+ 0x88, 0x88, 0x89, 0x9A, 0xBB, 0xCC, 0xAB, 0xAA, 0xA9, 0x98, 0x88, 0x88,
+ 0x88, 0x89, 0x9A, 0xBB, 0xBA, 0xBA, 0x99, 0x88, 0x77, 0x77, 0x77, 0x78,
+ 0x89, 0x9A, 0xBB, 0xAA, 0xA9, 0x88, 0x77, 0x76, 0x66, 0x77, 0x78, 0x89,
+ 0xAB, 0xBA, 0xAA, 0x98, 0x77, 0x66, 0x66, 0x66, 0x67, 0x78, 0x99, 0xAA,
+ 0xAA, 0x99, 0x87, 0x76, 0x66, 0x66, 0x66, 0x77, 0x88, 0x9A, 0xAA, 0xA9,
+ 0x88, 0x76, 0x66, 0x55, 0x56, 0x66, 0x78, 0x89, 0xAA, 0xAA, 0x98, 0x87,
+ 0x66, 0x65, 0x55, 0x56, 0x67, 0x88, 0x9A, 0xAA, 0xA9, 0x88, 0x76, 0x66,
+ 0x55, 0x56, 0x66, 0x78, 0x99, 0xAA, 0xAA, 0x99, 0x87, 0x76, 0x66, 0x56,
+ 0x66, 0x77, 0x89, 0x9A, 0xAA, 0xA9, 0x98, 0x77, 0x66, 0x66, 0x66, 0x77,
+ 0x88, 0x99, 0xAA, 0xAB, 0xA9, 0x88, 0x77, 0x76, 0x66, 0x77, 0x78, 0x89,
+ 0xAB, 0xAB, 0xBA, 0x99, 0x88, 0x77, 0x77, 0x77, 0x88, 0x89, 0xAA, 0xBA,
+ 0xBB, 0xBA, 0x99, 0x98, 0x88, 0x88, 0x88, 0x89, 0x9A, 0xAB, 0xBC, 0xCC,
+ 0xBA, 0x99, 0x98, 0x88, 0x88, 0x99, 0xAA, 0xBB, 0xBB, 0xDD, 0xCC, 0xBA,
+ 0xA9, 0x99, 0x99, 0x99, 0xAA, 0xBB, 0xCC, 0xBD, 0xDD, 0xCB, 0xBB, 0xAA,
+ 0xAA, 0xAA, 0xAA, 0xBB, 0xBC, 0xCB, 0xBC, 0xCB, 0xBA, 0xAA, 0xA9, 0x9A,
+ 0xAA, 0xAA, 0xBA, 0xBC, 0x90, 0x00, 0x00, 0x00,
+ },
+ {
+ 0x9B, 0xBA, 0xA9, 0x99, 0x99, 0x99, 0x99, 0x9A, 0xBB, 0xCC, 0xBB, 0xCC,
+ 0xCA, 0xAA, 0xAA, 0x9A, 0xA9, 0xAA, 0xBB, 0xBD, 0xDC, 0xBC, 0xBB, 0xAA,
+ 0xA9, 0x99, 0x98, 0x99, 0xA9, 0xAB, 0xBB, 0xCB, 0xBA, 0xAA, 0x99, 0x88,
+ 0x88, 0x88, 0x89, 0x99, 0xAB, 0xBB, 0xAA, 0xA9, 0x98, 0x88, 0x88, 0x77,
+ 0x88, 0x88, 0x9A, 0xAB, 0xAA, 0xAA, 0x98, 0x88, 0x77, 0x77, 0x77, 0x78,
+ 0x88, 0x99, 0xBA, 0x9A, 0x99, 0x88, 0x77, 0x76, 0x66, 0x77, 0x77, 0x89,
+ 0x9A, 0xA9, 0x99, 0x98, 0x77, 0x66, 0x66, 0x66, 0x77, 0x78, 0x89, 0xAA,
+ 0x99, 0x98, 0x87, 0x76, 0x66, 0x66, 0x66, 0x77, 0x88, 0x9A, 0x99, 0x99,
+ 0x88, 0x76, 0x66, 0x66, 0x66, 0x67, 0x77, 0x89, 0x99, 0x99, 0x98, 0x77,
+ 0x66, 0x66, 0x56, 0x66, 0x67, 0x78, 0x99, 0x99, 0xA9, 0x87, 0x76, 0x66,
+ 0x66, 0x66, 0x66, 0x77, 0x89, 0xA9, 0x99, 0x98, 0x87, 0x76, 0x66, 0x66,
+ 0x66, 0x77, 0x88, 0x99, 0x99, 0xA9, 0x88, 0x77, 0x66, 0x66, 0x66, 0x77,
+ 0x78, 0x89, 0xA9, 0xAA, 0x99, 0x88, 0x77, 0x76, 0x67, 0x77, 0x78, 0x89,
+ 0x9A, 0x9A, 0xA9, 0x98, 0x87, 0x77, 0x77, 0x77, 0x78, 0x88, 0x9A, 0xB9,
+ 0xAB, 0xAA, 0x99, 0x88, 0x87, 0x77, 0x88, 0x89, 0x99, 0xAB, 0xAB, 0xCA,
+ 0xAA, 0x99, 0x88, 0x88, 0x88, 0x89, 0x99, 0xAB, 0xBB, 0xBB, 0xBB, 0xAA,
+ 0x99, 0x99, 0x99, 0x99, 0x99, 0xAA, 0xBC, 0xBC, 0xCC, 0xCB, 0xAA, 0x9A,
+ 0x99, 0x9A, 0x9A, 0xAB, 0xBC, 0xCC, 0xBC, 0xCA, 0xAA, 0xA9, 0x99, 0x99,
+ 0x99, 0x9A, 0xAA, 0xAB, 0xA0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xAB, 0xBA, 0xAA, 0x99, 0x99, 0x99, 0x99, 0x9A, 0xAB, 0xBC, 0xBB, 0xCC,
+ 0xBB, 0xAA, 0x99, 0x99, 0x99, 0xAA, 0xAB, 0xBB, 0xCC, 0xBC, 0xBA, 0xAA,
+ 0x99, 0x99, 0x89, 0x99, 0x99, 0xAA, 0xBC, 0xBA, 0xBA, 0xA9, 0x99, 0x88,
+ 0x88, 0x88, 0x88, 0x99, 0xAA, 0xBB, 0xAA, 0xA9, 0x98, 0x88, 0x87, 0x77,
+ 0x88, 0x88, 0x99, 0xAA, 0xAA, 0xA9, 0x98, 0x88, 0x77, 0x77, 0x77, 0x77,
+ 0x88, 0x99, 0xAA, 0x9A, 0x99, 0x88, 0x77, 0x77, 0x67, 0x77, 0x77, 0x89,
+ 0x9A, 0x99, 0xA9, 0x88, 0x77, 0x76, 0x66, 0x66, 0x77, 0x78, 0x89, 0xA9,
+ 0x99, 0x98, 0x87, 0x76, 0x66, 0x66, 0x66, 0x77, 0x78, 0x99, 0x99, 0x98,
+ 0x87, 0x77, 0x66, 0x66, 0x66, 0x66, 0x77, 0x89, 0x99, 0x99, 0x88, 0x77,
+ 0x76, 0x66, 0x66, 0x66, 0x67, 0x78, 0x99, 0x99, 0x99, 0x87, 0x77, 0x66,
+ 0x66, 0x66, 0x67, 0x77, 0x89, 0x99, 0x99, 0x98, 0x77, 0x76, 0x66, 0x66,
+ 0x66, 0x77, 0x88, 0x99, 0x99, 0x99, 0x88, 0x77, 0x66, 0x66, 0x66, 0x77,
+ 0x78, 0x89, 0xA9, 0x9A, 0x98, 0x87, 0x77, 0x77, 0x67, 0x77, 0x78, 0x89,
+ 0x9A, 0x9A, 0xA9, 0x98, 0x87, 0x77, 0x77, 0x77, 0x78, 0x88, 0x99, 0xA9,
+ 0xAB, 0xA9, 0x98, 0x88, 0x77, 0x77, 0x88, 0x88, 0x99, 0xAB, 0xAA, 0xBA,
+ 0xA9, 0x98, 0x88, 0x88, 0x88, 0x89, 0x99, 0xAA, 0xBA, 0xBB, 0xBA, 0xA9,
+ 0x99, 0x99, 0x89, 0x99, 0x99, 0xAA, 0xBB, 0xBC, 0xCB, 0xBB, 0xAA, 0xA9,
+ 0x99, 0x99, 0xAA, 0xAA, 0xBC, 0xCB, 0xBC, 0xBB, 0xAA, 0x99, 0x99, 0x99,
+ 0x99, 0x9A, 0xAA, 0xBB, 0xA0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0x9C, 0xBA, 0xAA, 0x9A, 0x99, 0x99, 0x99, 0x9A, 0xAB, 0xCB, 0xAB, 0xCC,
+ 0xBA, 0xAA, 0xA9, 0x99, 0xA9, 0xAA, 0xAA, 0xBC, 0xCC, 0xAC, 0xBA, 0xAA,
+ 0x99, 0x99, 0x99, 0x99, 0x9A, 0xAA, 0xBC, 0xBB, 0xCB, 0xA9, 0x99, 0x88,
+ 0x88, 0x88, 0x89, 0x9A, 0xAB, 0xCC, 0xAA, 0xAA, 0x99, 0x88, 0x77, 0x77,
+ 0x78, 0x88, 0x99, 0xAA, 0xAA, 0xBA, 0x98, 0x88, 0x77, 0x77, 0x77, 0x78,
+ 0x89, 0x9A, 0xAA, 0x9A, 0x99, 0x88, 0x77, 0x76, 0x67, 0x77, 0x77, 0x88,
+ 0x9A, 0x99, 0x99, 0x88, 0x77, 0x66, 0x66, 0x66, 0x67, 0x78, 0x89, 0xA9,
+ 0x99, 0x98, 0x77, 0x76, 0x66, 0x66, 0x66, 0x67, 0x88, 0x89, 0x99, 0x98,
+ 0x87, 0x77, 0x66, 0x66, 0x66, 0x66, 0x77, 0x88, 0xA9, 0x99, 0x98, 0x87,
+ 0x66, 0x66, 0x66, 0x66, 0x67, 0x78, 0x89, 0x99, 0x99, 0x87, 0x76, 0x66,
+ 0x66, 0x66, 0x67, 0x77, 0x89, 0x99, 0x9A, 0x88, 0x87, 0x76, 0x66, 0x66,
+ 0x66, 0x77, 0x88, 0x9A, 0x99, 0xA9, 0x88, 0x77, 0x76, 0x66, 0x66, 0x77,
+ 0x78, 0x89, 0xA9, 0xAA, 0x99, 0x87, 0x77, 0x77, 0x67, 0x77, 0x77, 0x89,
+ 0x9A, 0xAA, 0xBA, 0x98, 0x88, 0x77, 0x77, 0x77, 0x78, 0x89, 0x99, 0xAA,
+ 0xAB, 0xAA, 0x98, 0x88, 0x87, 0x77, 0x88, 0x89, 0x9A, 0xAB, 0xAA, 0xBA,
+ 0xAA, 0x99, 0x88, 0x88, 0x88, 0x89, 0x9A, 0xAA, 0xBB, 0xCC, 0xBA, 0xA9,
+ 0xA9, 0x99, 0x98, 0x99, 0x99, 0xAB, 0xAB, 0xAC, 0xCC, 0xBA, 0xAA, 0xA9,
+ 0x99, 0x9A, 0x9A, 0xBB, 0xBC, 0xCB, 0xBC, 0xBB, 0xAA, 0xA9, 0x99, 0x99,
+ 0x9A, 0x9A, 0xAA, 0xBB, 0xA0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0x9B, 0xBB, 0xAA, 0xAA, 0xA9, 0xAA, 0xAA, 0xBB, 0xBC, 0xDD, 0xCB, 0xDC,
+ 0xBB, 0xBA, 0xAA, 0xAA, 0xAA, 0xAB, 0xBB, 0xCD, 0xDD, 0xCC, 0xBB, 0xAA,
+ 0xA9, 0x99, 0x99, 0x9A, 0xAA, 0xBC, 0xCD, 0xDB, 0xBB, 0xAA, 0x99, 0x88,
+ 0x88, 0x88, 0x99, 0x9A, 0xBC, 0xCC, 0xAB, 0xAA, 0x99, 0x88, 0x88, 0x88,
+ 0x88, 0x89, 0x9A, 0xAB, 0xBA, 0xAA, 0x99, 0x88, 0x77, 0x77, 0x77, 0x78,
+ 0x89, 0x9A, 0xBB, 0xAA, 0x99, 0x88, 0x77, 0x77, 0x66, 0x77, 0x78, 0x89,
+ 0xAB, 0xAA, 0xA9, 0x98, 0x77, 0x66, 0x66, 0x66, 0x67, 0x78, 0x99, 0xAA,
+ 0xAA, 0x98, 0x87, 0x76, 0x66, 0x66, 0x66, 0x77, 0x88, 0x9A, 0xA9, 0xA9,
+ 0x88, 0x76, 0x66, 0x55, 0x56, 0x66, 0x78, 0x89, 0xAA, 0xAA, 0x98, 0x87,
+ 0x66, 0x65, 0x55, 0x66, 0x67, 0x88, 0x9A, 0xA9, 0xA9, 0x88, 0x76, 0x66,
+ 0x55, 0x56, 0x66, 0x78, 0x89, 0xAA, 0xAA, 0x99, 0x87, 0x76, 0x66, 0x66,
+ 0x66, 0x77, 0x88, 0x9A, 0xAA, 0xB9, 0x98, 0x77, 0x66, 0x66, 0x66, 0x67,
+ 0x78, 0x99, 0xAA, 0xAA, 0xA9, 0x88, 0x77, 0x76, 0x66, 0x77, 0x78, 0x89,
+ 0x9A, 0xAA, 0xBA, 0xA9, 0x88, 0x77, 0x77, 0x77, 0x78, 0x89, 0x9A, 0xBA,
+ 0xBC, 0xBA, 0x99, 0x88, 0x88, 0x88, 0x88, 0x89, 0x9A, 0xAB, 0xAC, 0xCB,
+ 0xBA, 0x99, 0x98, 0x88, 0x88, 0x89, 0x9A, 0xAB, 0xBB, 0xDC, 0xCB, 0xBA,
+ 0xA9, 0x99, 0x99, 0x99, 0xAA, 0xAB, 0xBC, 0xCD, 0xDD, 0xCB, 0xBA, 0xAA,
+ 0xAA, 0xAA, 0xAA, 0xBB, 0xBC, 0xDB, 0xBD, 0xCC, 0xBB, 0xAA, 0xAA, 0xAA,
+ 0x9A, 0xAA, 0xBB, 0xBC, 0x90, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xBD, 0xDC, 0xDD, 0xCC, 0xCC, 0xCD, 0xDE, 0xED, 0xFF, 0xFF, 0xCF, 0xFF,
+ 0xEE, 0xDD, 0xDC, 0xCD, 0xCD, 0xDE, 0xFF, 0xFF, 0xFF, 0xFF, 0xED, 0xDC,
+ 0xCB, 0xBB, 0xBB, 0xBC, 0xCD, 0xEF, 0xFF, 0xFF, 0xFE, 0xDC, 0xBB, 0xAA,
+ 0xA9, 0xAA, 0xAB, 0xCD, 0xEF, 0xFF, 0xDD, 0xCC, 0xBA, 0x99, 0x88, 0x88,
+ 0x99, 0xAB, 0xCD, 0xEF, 0xFD, 0xDC, 0xBA, 0x99, 0x88, 0x77, 0x78, 0x89,
+ 0xAB, 0xCE, 0xFE, 0xDD, 0xCA, 0x98, 0x87, 0x76, 0x66, 0x77, 0x89, 0xAB,
+ 0xDF, 0xFD, 0xCB, 0xA9, 0x87, 0x66, 0x55, 0x56, 0x77, 0x9A, 0xBC, 0xEE,
+ 0xDC, 0xBA, 0x97, 0x76, 0x55, 0x55, 0x56, 0x78, 0x9A, 0xCD, 0xED, 0xCB,
+ 0x98, 0x76, 0x55, 0x44, 0x55, 0x67, 0x89, 0xAC, 0xDD, 0xDC, 0xB9, 0x87,
+ 0x65, 0x54, 0x44, 0x56, 0x78, 0x9A, 0xBC, 0xDD, 0xCB, 0xA8, 0x76, 0x55,
+ 0x44, 0x55, 0x67, 0x89, 0xAB, 0xCD, 0xDD, 0xBA, 0x98, 0x76, 0x55, 0x55,
+ 0x66, 0x78, 0x9A, 0xCD, 0xDE, 0xDC, 0xA9, 0x87, 0x76, 0x66, 0x66, 0x78,
+ 0x9A, 0xBC, 0xDD, 0xFD, 0xDB, 0xA9, 0x87, 0x77, 0x77, 0x78, 0x99, 0xAC,
+ 0xCD, 0xDF, 0xFD, 0xCB, 0xA9, 0x88, 0x88, 0x88, 0x99, 0xAB, 0xCD, 0xEF,
+ 0xFF, 0xFD, 0xCB, 0xAA, 0x99, 0x99, 0x9A, 0xAB, 0xCD, 0xEF, 0xDF, 0xFE,
+ 0xED, 0xCB, 0xBA, 0xAA, 0xAB, 0xBC, 0xCC, 0xDE, 0xFF, 0xFF, 0xFF, 0xFD,
+ 0xDC, 0xBC, 0xCB, 0xCC, 0xCD, 0xDE, 0xFF, 0xEF, 0xFF, 0xFF, 0xFE, 0xEE,
+ 0xDD, 0xDE, 0xDE, 0xEF, 0xFF, 0xFF, 0xDF, 0xFF, 0xFF, 0xEE, 0xED, 0xDD,
+ 0xEE, 0xDF, 0xEE, 0xFE, 0xB0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xBD, 0xDC, 0xCC, 0xCC, 0xCB, 0xCC, 0xCC, 0xEF, 0xFF, 0xDF, 0xCD, 0xFF,
+ 0xCD, 0xCC, 0xCC, 0xCC, 0xBD, 0xDF, 0xFF, 0xFF, 0xFF, 0xFD, 0xDC, 0xBB,
+ 0xBB, 0xAB, 0xBA, 0xBC, 0xDC, 0xDF, 0xFF, 0xFD, 0xDC, 0xCB, 0xAA, 0xA9,
+ 0x99, 0x9A, 0xBB, 0xBC, 0xFF, 0xFF, 0xCC, 0xDB, 0xA9, 0x99, 0x88, 0x88,
+ 0x89, 0xAB, 0xCC, 0xDF, 0xFC, 0xDC, 0xA9, 0x98, 0x87, 0x77, 0x78, 0x89,
+ 0xAB, 0xCD, 0xFF, 0xBC, 0xBA, 0x98, 0x77, 0x66, 0x66, 0x77, 0x89, 0xAB,
+ 0xCF, 0xFC, 0xBB, 0xA9, 0x87, 0x66, 0x55, 0x56, 0x77, 0x89, 0xAB, 0xCF,
+ 0xCC, 0xA9, 0x87, 0x66, 0x55, 0x55, 0x56, 0x78, 0x9A, 0xBD, 0xFC, 0xBB,
+ 0x98, 0x76, 0x55, 0x44, 0x55, 0x67, 0x89, 0xAB, 0xCD, 0xCB, 0xA9, 0x87,
+ 0x65, 0x54, 0x45, 0x56, 0x78, 0x9A, 0xBD, 0xDC, 0xCB, 0xA8, 0x76, 0x55,
+ 0x55, 0x55, 0x67, 0x89, 0xAB, 0xCD, 0xEC, 0xBA, 0x87, 0x76, 0x55, 0x55,
+ 0x66, 0x78, 0x9A, 0xBD, 0xCD, 0xCB, 0xA9, 0x87, 0x66, 0x66, 0x66, 0x77,
+ 0x89, 0xAB, 0xCC, 0xDD, 0xDB, 0x99, 0x87, 0x77, 0x77, 0x77, 0x89, 0xAB,
+ 0xBC, 0xCF, 0xFD, 0xBB, 0xA9, 0x88, 0x88, 0x88, 0x89, 0x9B, 0xCC, 0xFC,
+ 0xFF, 0xDD, 0xBA, 0x9A, 0x99, 0x99, 0x99, 0xAA, 0xBC, 0xFD, 0xDF, 0xFD,
+ 0xFD, 0xCB, 0xAA, 0xAA, 0xAA, 0xAA, 0xBC, 0xCF, 0xFD, 0xFF, 0xFF, 0xDC,
+ 0xCB, 0xBB, 0xBB, 0xBB, 0xCD, 0xDD, 0xDF, 0xDF, 0xFF, 0xFF, 0xFD, 0xFD,
+ 0xCC, 0xCC, 0xFC, 0xCD, 0xFE, 0xFE, 0xDF, 0xFF, 0xFD, 0xDD, 0xFC, 0xDC,
+ 0xDD, 0xCC, 0xCE, 0xFD, 0xB0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xCF, 0xDD, 0xDC, 0xCC, 0xCC, 0xCD, 0xDD, 0xEF, 0xFF, 0xFF, 0xFD, 0xFE,
+ 0xDD, 0xCC, 0xCC, 0xCC, 0xCC, 0xCE, 0xFF, 0xFF, 0xFF, 0xEF, 0xDD, 0xCB,
+ 0xBB, 0xAA, 0xAA, 0xBB, 0xCC, 0xDF, 0xFF, 0xFD, 0xED, 0xCB, 0xAA, 0xA9,
+ 0x99, 0x99, 0xAA, 0xBC, 0xDF, 0xFF, 0xDD, 0xCB, 0xAA, 0x99, 0x88, 0x88,
+ 0x89, 0x9A, 0xBD, 0xEF, 0xFC, 0xDB, 0xBA, 0x98, 0x87, 0x77, 0x77, 0x88,
+ 0x9A, 0xBD, 0xFF, 0xCC, 0xBA, 0x98, 0x77, 0x66, 0x66, 0x67, 0x89, 0xAB,
+ 0xCD, 0xFC, 0xCB, 0xA9, 0x87, 0x66, 0x55, 0x56, 0x67, 0x89, 0xAB, 0xDF,
+ 0xCC, 0xA9, 0x87, 0x66, 0x55, 0x55, 0x56, 0x78, 0x9A, 0xBD, 0xDC, 0xCA,
+ 0x98, 0x76, 0x55, 0x55, 0x55, 0x66, 0x78, 0xAB, 0xCD, 0xCC, 0xA9, 0x87,
+ 0x65, 0x55, 0x45, 0x56, 0x67, 0x8A, 0xBD, 0xDC, 0xCA, 0x98, 0x76, 0x55,
+ 0x55, 0x55, 0x67, 0x79, 0xAB, 0xCD, 0xDC, 0xB9, 0x87, 0x66, 0x55, 0x55,
+ 0x66, 0x78, 0x9A, 0xBD, 0xDE, 0xDB, 0xA9, 0x87, 0x66, 0x66, 0x66, 0x77,
+ 0x89, 0xAC, 0xCD, 0xFD, 0xCB, 0x98, 0x87, 0x76, 0x67, 0x77, 0x89, 0xAB,
+ 0xCD, 0xDF, 0xFD, 0xBA, 0x99, 0x88, 0x77, 0x78, 0x89, 0xAA, 0xBC, 0xDD,
+ 0xFF, 0xFD, 0xBA, 0xA9, 0x99, 0x89, 0x99, 0xAA, 0xBC, 0xDD, 0xEF, 0xFF,
+ 0xED, 0xCB, 0xAA, 0xAA, 0xAA, 0xAB, 0xBC, 0xDD, 0xFF, 0xFF, 0xFF, 0xED,
+ 0xCB, 0xBB, 0xBB, 0xBB, 0xCC, 0xDD, 0xEF, 0xEF, 0xFF, 0xFF, 0xFE, 0xDD,
+ 0xCC, 0xCC, 0xDD, 0xEE, 0xFF, 0xFE, 0xFF, 0xFF, 0xFF, 0xFD, 0xED, 0xDD,
+ 0xDD, 0xDD, 0xED, 0xEE, 0xC0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xAE, 0xCD, 0xCC, 0xEC, 0xCD, 0xCC, 0xCD, 0xEF, 0xFF, 0xFF, 0xDD, 0xFD,
+ 0xDC, 0xDC, 0xCD, 0xCC, 0xDD, 0xED, 0xDF, 0xFF, 0xFF, 0xCF, 0xDF, 0xCC,
+ 0xBB, 0xBB, 0xBB, 0xBC, 0xCC, 0xDF, 0xFF, 0xFD, 0xFD, 0xCB, 0xBB, 0xAA,
+ 0x99, 0xA9, 0xAB, 0xCD, 0xFF, 0xFF, 0xDE, 0xCB, 0xBA, 0x99, 0x88, 0x88,
+ 0x89, 0xAA, 0xCD, 0xFF, 0xFD, 0xDC, 0xAA, 0x98, 0x87, 0x77, 0x77, 0x88,
+ 0x9A, 0xBD, 0xFD, 0xCC, 0xBA, 0x99, 0x87, 0x66, 0x66, 0x67, 0x88, 0xAC,
+ 0xCF, 0xEC, 0xCB, 0xA9, 0x87, 0x66, 0x55, 0x56, 0x67, 0x89, 0xAC, 0xDD,
+ 0xDD, 0xBA, 0x97, 0x66, 0x55, 0x55, 0x56, 0x78, 0x9A, 0xBC, 0xDC, 0xCB,
+ 0x98, 0x76, 0x55, 0x54, 0x55, 0x67, 0x79, 0xAB, 0xDD, 0xDC, 0xB9, 0x87,
+ 0x65, 0x54, 0x45, 0x56, 0x77, 0x9A, 0xBC, 0xDD, 0xCB, 0x98, 0x76, 0x55,
+ 0x55, 0x55, 0x67, 0x89, 0xAC, 0xBD, 0xDC, 0xB9, 0x97, 0x66, 0x55, 0x55,
+ 0x66, 0x78, 0x9A, 0xCD, 0xCD, 0xDB, 0xA9, 0x87, 0x66, 0x66, 0x66, 0x78,
+ 0x99, 0xAC, 0xDC, 0xFE, 0xCA, 0x98, 0x87, 0x76, 0x67, 0x78, 0x99, 0xAC,
+ 0xCD, 0xCD, 0xED, 0xBA, 0x99, 0x88, 0x78, 0x88, 0x99, 0xAB, 0xCD, 0xDC,
+ 0xFF, 0xFC, 0xBA, 0xA9, 0x99, 0x89, 0x99, 0xAB, 0xBC, 0xDD, 0xCF, 0xFF,
+ 0xFD, 0xBB, 0xAA, 0xAA, 0xAA, 0xAB, 0xCB, 0xCD, 0xDC, 0xFF, 0xFF, 0xDD,
+ 0xCC, 0xBB, 0xBB, 0xBC, 0xCC, 0xDD, 0xFF, 0xDF, 0xFF, 0xFF, 0xEE, 0xDE,
+ 0xDC, 0xCD, 0xDF, 0xEE, 0xFF, 0xFD, 0xDF, 0xFF, 0xEE, 0xDC, 0xDD, 0xCC,
+ 0xCC, 0xCC, 0xCC, 0xFD, 0xB0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xAE, 0xED, 0xDE, 0xDD, 0xDD, 0xDE, 0xDF, 0xFF, 0xFF, 0xFF, 0xCD, 0xFE,
+ 0xFF, 0xEE, 0xDD, 0xDD, 0xCE, 0xFF, 0xFF, 0xFF, 0xFF, 0xEF, 0xEE, 0xDC,
+ 0xCB, 0xCB, 0xBB, 0xCC, 0xDE, 0xEF, 0xFF, 0xFD, 0xFE, 0xDC, 0xCB, 0xAA,
+ 0xAA, 0xAA, 0xBC, 0xCD, 0xEF, 0xFF, 0xDF, 0xDC, 0xBB, 0xA9, 0x99, 0x99,
+ 0x9A, 0xAB, 0xDF, 0xFF, 0xFD, 0xDD, 0xBA, 0xA9, 0x88, 0x77, 0x78, 0x89,
+ 0xAB, 0xDE, 0xFF, 0xDD, 0xDB, 0xA9, 0x87, 0x76, 0x66, 0x77, 0x89, 0xBC,
+ 0xFE, 0xFD, 0xDB, 0xB9, 0x87, 0x66, 0x55, 0x56, 0x77, 0x9A, 0xBD, 0xFF,
+ 0xDD, 0xCA, 0x98, 0x66, 0x55, 0x55, 0x56, 0x78, 0x9B, 0xCE, 0xFD, 0xEB,
+ 0xA9, 0x76, 0x55, 0x44, 0x45, 0x67, 0x89, 0xBD, 0xFF, 0xDD, 0xBA, 0x97,
+ 0x65, 0x54, 0x44, 0x56, 0x78, 0x9B, 0xCD, 0xED, 0xDB, 0xA9, 0x76, 0x55,
+ 0x44, 0x55, 0x67, 0x89, 0xBC, 0xFD, 0xED, 0xCB, 0x98, 0x76, 0x55, 0x55,
+ 0x66, 0x78, 0xAB, 0xDF, 0xFD, 0xEC, 0xB9, 0x87, 0x66, 0x66, 0x66, 0x78,
+ 0x9A, 0xBC, 0xED, 0xDF, 0xFC, 0xA9, 0x87, 0x77, 0x77, 0x78, 0x9A, 0xAC,
+ 0xDE, 0xEF, 0xFF, 0xCB, 0xA9, 0x88, 0x88, 0x88, 0x9A, 0xBB, 0xCE, 0xFE,
+ 0xFF, 0xFE, 0xCB, 0xBA, 0x99, 0x99, 0xAA, 0xAB, 0xCD, 0xEF, 0xEF, 0xFF,
+ 0xED, 0xDC, 0xCB, 0xBB, 0xBB, 0xBC, 0xCD, 0xEE, 0xFF, 0xFF, 0xFF, 0xFE,
+ 0xDC, 0xCC, 0xCC, 0xCC, 0xDD, 0xDF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xEF,
+ 0xDE, 0xDE, 0xEF, 0xFF, 0xFF, 0xFF, 0xBF, 0xFF, 0xFF, 0xDD, 0xED, 0xCD,
+ 0xDD, 0xCC, 0xDD, 0xDE, 0xB0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xAC, 0xBB, 0xBB, 0xAA, 0xAA, 0xAA, 0xAB, 0xBB, 0xCC, 0xDE, 0xAC, 0xDC,
+ 0xCB, 0xBB, 0xBA, 0xAA, 0xAA, 0xBB, 0xCD, 0xDD, 0xFE, 0xCC, 0xCB, 0xBA,
+ 0xAA, 0x99, 0x99, 0xAA, 0xAB, 0xBC, 0xDE, 0xDB, 0xCB, 0xAA, 0xA9, 0x99,
+ 0x88, 0x89, 0x99, 0xAB, 0xBC, 0xED, 0xBB, 0xBA, 0x99, 0x88, 0x88, 0x88,
+ 0x88, 0x99, 0xAB, 0xCC, 0xCB, 0xBA, 0xA9, 0x88, 0x77, 0x77, 0x77, 0x78,
+ 0x99, 0xAB, 0xCC, 0xAB, 0xA9, 0x88, 0x77, 0x66, 0x66, 0x77, 0x78, 0x99,
+ 0xBC, 0xBA, 0xAA, 0x98, 0x77, 0x66, 0x66, 0x66, 0x67, 0x88, 0x9A, 0xBB,
+ 0xAA, 0x98, 0x87, 0x66, 0x55, 0x55, 0x66, 0x77, 0x89, 0xAB, 0xBA, 0xA9,
+ 0x88, 0x76, 0x65, 0x55, 0x55, 0x67, 0x78, 0x9A, 0xBB, 0xAA, 0x98, 0x87,
+ 0x66, 0x55, 0x55, 0x56, 0x77, 0x89, 0xAB, 0xBA, 0xA9, 0x88, 0x76, 0x65,
+ 0x55, 0x56, 0x67, 0x78, 0x9A, 0xBB, 0xBB, 0xA9, 0x87, 0x66, 0x65, 0x56,
+ 0x66, 0x77, 0x89, 0xAB, 0xBB, 0xBA, 0x98, 0x77, 0x66, 0x66, 0x66, 0x77,
+ 0x89, 0x9A, 0xBB, 0xBB, 0xA9, 0x98, 0x77, 0x77, 0x67, 0x77, 0x88, 0x9A,
+ 0xBB, 0xBC, 0xCB, 0xA9, 0x98, 0x87, 0x77, 0x77, 0x88, 0x99, 0xAB, 0xCB,
+ 0xCC, 0xCB, 0xA9, 0x98, 0x88, 0x88, 0x89, 0x9A, 0xAB, 0xBC, 0xBD, 0xDC,
+ 0xBB, 0xAA, 0x99, 0x99, 0x99, 0x9A, 0xAB, 0xBC, 0xCC, 0xEE, 0xDC, 0xCB,
+ 0xAA, 0xAA, 0xAA, 0xAA, 0xBB, 0xBC, 0xCD, 0xCD, 0xFD, 0xDC, 0xCB, 0xBB,
+ 0xBB, 0xBB, 0xBB, 0xCC, 0xDD, 0xEC, 0xBD, 0xDD, 0xCC, 0xCB, 0xBB, 0xBB,
+ 0xBB, 0xBB, 0xCB, 0xCC, 0xA0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0x8A, 0xA9, 0x99, 0x99, 0x98, 0x99, 0x99, 0x9A, 0xAB, 0xBC, 0xAA, 0xBB,
+ 0xBA, 0xA9, 0x99, 0x99, 0x99, 0x9A, 0xBB, 0xCD, 0xDC, 0xAB, 0xBA, 0xA9,
+ 0x99, 0x99, 0x88, 0x99, 0x9A, 0xAA, 0xBC, 0xC9, 0xAA, 0xA9, 0x98, 0x88,
+ 0x88, 0x88, 0x89, 0x99, 0xAB, 0xCB, 0xAB, 0xA9, 0x98, 0x88, 0x77, 0x77,
+ 0x78, 0x88, 0x99, 0xAB, 0xB9, 0xA9, 0x88, 0x87, 0x77, 0x77, 0x77, 0x77,
+ 0x88, 0x9A, 0xAA, 0x9A, 0x98, 0x87, 0x77, 0x76, 0x66, 0x77, 0x78, 0x89,
+ 0xAA, 0xA9, 0x99, 0x88, 0x77, 0x66, 0x66, 0x66, 0x77, 0x78, 0x89, 0xA9,
+ 0x99, 0x98, 0x87, 0x66, 0x66, 0x66, 0x66, 0x77, 0x88, 0x9A, 0x99, 0x99,
+ 0x87, 0x76, 0x66, 0x66, 0x66, 0x67, 0x78, 0x89, 0x99, 0x89, 0x88, 0x77,
+ 0x66, 0x66, 0x66, 0x66, 0x77, 0x78, 0x9A, 0x99, 0x98, 0x87, 0x76, 0x66,
+ 0x66, 0x66, 0x67, 0x78, 0x89, 0x99, 0x99, 0x98, 0x87, 0x76, 0x66, 0x66,
+ 0x66, 0x77, 0x88, 0x99, 0x99, 0xA9, 0x88, 0x77, 0x76, 0x66, 0x66, 0x77,
+ 0x78, 0x89, 0xA9, 0x9A, 0x99, 0x87, 0x77, 0x77, 0x67, 0x77, 0x78, 0x89,
+ 0x9A, 0x9A, 0xAA, 0x99, 0x88, 0x77, 0x77, 0x77, 0x78, 0x89, 0x9A, 0xBA,
+ 0xAB, 0xA9, 0x98, 0x88, 0x88, 0x88, 0x88, 0x99, 0x99, 0xAB, 0xAB, 0xBB,
+ 0xAA, 0x99, 0x88, 0x88, 0x88, 0x89, 0x99, 0xAA, 0xBA, 0xBC, 0xBB, 0xAA,
+ 0x99, 0x99, 0x99, 0x99, 0x9A, 0xAA, 0xAB, 0xAD, 0xDD, 0xBB, 0xAA, 0xA9,
+ 0xA9, 0x9A, 0xAA, 0xAB, 0xBB, 0xDB, 0xAC, 0xCB, 0xAA, 0xA9, 0x99, 0x99,
+ 0x99, 0x9A, 0xAA, 0xAB, 0x90, 0x00, 0x00, 0x00,
+ },
+ {
+ 0x9B, 0xAA, 0xAA, 0x99, 0x99, 0x99, 0x9A, 0xAA, 0xBB, 0xCC, 0xBA, 0xCB,
+ 0xBB, 0xAA, 0xAA, 0xA9, 0xAA, 0xAA, 0xBB, 0xCC, 0xDC, 0xAB, 0xBB, 0xAA,
+ 0x99, 0x99, 0x99, 0x99, 0xAA, 0xAB, 0xCC, 0xCA, 0xBA, 0xA9, 0x99, 0x88,
+ 0x88, 0x88, 0x89, 0x9A, 0xAB, 0xCB, 0xAB, 0xA9, 0x98, 0x88, 0x77, 0x77,
+ 0x88, 0x89, 0x9A, 0xBB, 0xBA, 0xAA, 0x98, 0x88, 0x77, 0x77, 0x77, 0x78,
+ 0x89, 0x9A, 0xBB, 0x9A, 0x99, 0x88, 0x77, 0x66, 0x66, 0x67, 0x78, 0x89,
+ 0xAB, 0xA9, 0xA9, 0x88, 0x77, 0x66, 0x66, 0x66, 0x67, 0x78, 0x99, 0xAA,
+ 0x9A, 0x98, 0x87, 0x66, 0x66, 0x66, 0x66, 0x77, 0x88, 0x9A, 0xA9, 0x99,
+ 0x87, 0x76, 0x66, 0x55, 0x66, 0x66, 0x78, 0x89, 0xAA, 0x9A, 0x98, 0x77,
+ 0x66, 0x65, 0x55, 0x66, 0x77, 0x88, 0x9A, 0xA9, 0xA9, 0x87, 0x76, 0x66,
+ 0x56, 0x66, 0x67, 0x78, 0x89, 0xAA, 0xAA, 0x98, 0x77, 0x66, 0x66, 0x66,
+ 0x66, 0x77, 0x89, 0x9A, 0xAA, 0xA9, 0x88, 0x77, 0x66, 0x66, 0x66, 0x77,
+ 0x88, 0x9A, 0xAA, 0xAA, 0xA9, 0x88, 0x77, 0x77, 0x67, 0x77, 0x88, 0x89,
+ 0xAB, 0xAB, 0xBA, 0x99, 0x88, 0x77, 0x77, 0x77, 0x88, 0x89, 0xAA, 0xBA,
+ 0xBB, 0xAA, 0x99, 0x88, 0x88, 0x88, 0x88, 0x99, 0x9A, 0xAB, 0xAB, 0xCB,
+ 0xAA, 0x99, 0x98, 0x88, 0x89, 0x99, 0x9A, 0xAB, 0xBB, 0xCC, 0xCB, 0xBA,
+ 0xA9, 0x99, 0x99, 0x9A, 0xAA, 0xAB, 0xBC, 0xBD, 0xDC, 0xCB, 0xBB, 0xAA,
+ 0xAA, 0xAA, 0xAA, 0xBB, 0xBC, 0xDB, 0xBC, 0xCB, 0xBB, 0xAA, 0xAA, 0x9A,
+ 0xAA, 0xAA, 0xAA, 0xBB, 0x90, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xAB, 0xBA, 0xAA, 0xA9, 0x99, 0x9A, 0xAA, 0xAA, 0xBC, 0xBD, 0xBB, 0xCC,
+ 0xBB, 0xBA, 0xAA, 0xA9, 0xA9, 0xAA, 0xBB, 0xCD, 0xDD, 0xBC, 0xBA, 0xAA,
+ 0x99, 0x99, 0x99, 0x99, 0xAA, 0xAB, 0xBD, 0xCB, 0xBB, 0xA9, 0x99, 0x88,
+ 0x88, 0x88, 0x89, 0x9A, 0xAB, 0xCC, 0xAB, 0xAA, 0x99, 0x88, 0x77, 0x77,
+ 0x88, 0x89, 0x9A, 0xAB, 0xBA, 0xAA, 0x98, 0x88, 0x77, 0x77, 0x77, 0x78,
+ 0x89, 0x9A, 0xBB, 0xAA, 0x99, 0x87, 0x77, 0x66, 0x66, 0x67, 0x78, 0x89,
+ 0xAB, 0xAA, 0xA9, 0x88, 0x77, 0x66, 0x66, 0x66, 0x67, 0x78, 0x99, 0xAA,
+ 0x9A, 0x98, 0x77, 0x66, 0x66, 0x66, 0x66, 0x77, 0x88, 0x9A, 0xAA, 0x99,
+ 0x87, 0x76, 0x66, 0x55, 0x56, 0x66, 0x78, 0x89, 0xAA, 0x99, 0x98, 0x77,
+ 0x66, 0x65, 0x56, 0x66, 0x67, 0x88, 0x9A, 0xA9, 0xA9, 0x87, 0x76, 0x66,
+ 0x65, 0x66, 0x67, 0x78, 0x99, 0xAA, 0x9A, 0x98, 0x77, 0x76, 0x66, 0x66,
+ 0x66, 0x77, 0x88, 0x9A, 0xAA, 0xA9, 0x88, 0x77, 0x66, 0x66, 0x66, 0x77,
+ 0x88, 0x9A, 0xAA, 0xAA, 0xA9, 0x88, 0x77, 0x76, 0x67, 0x77, 0x78, 0x99,
+ 0xAB, 0xAB, 0xBA, 0x99, 0x88, 0x77, 0x77, 0x77, 0x88, 0x99, 0xAA, 0xBB,
+ 0xBC, 0xBA, 0x99, 0x88, 0x88, 0x88, 0x88, 0x89, 0xAA, 0xBB, 0xBC, 0xCC,
+ 0xAA, 0x99, 0x98, 0x88, 0x89, 0x99, 0x9A, 0xBB, 0xCB, 0xCD, 0xCB, 0xAA,
+ 0xA9, 0x99, 0x99, 0x99, 0xAA, 0xAB, 0xCC, 0xBD, 0xDC, 0xCB, 0xBB, 0xAA,
+ 0xAA, 0xAA, 0xBB, 0xBB, 0xCC, 0xDB, 0xAD, 0xCB, 0xBB, 0xBA, 0xAA, 0xAA,
+ 0xAA, 0xAA, 0xBB, 0xBC, 0xA0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xAC, 0xBB, 0xBA, 0xAA, 0xAA, 0xAA, 0xAB, 0xBB, 0xCD, 0xDE, 0xBC, 0xDC,
+ 0xCB, 0xBB, 0xAA, 0xAA, 0xAA, 0xBB, 0xCC, 0xDD, 0xFD, 0xBC, 0xCB, 0xBA,
+ 0xA9, 0x99, 0x99, 0xAA, 0xAB, 0xBC, 0xCE, 0xDB, 0xBB, 0xAA, 0x99, 0x98,
+ 0x88, 0x89, 0x99, 0xAB, 0xBC, 0xDD, 0xBB, 0xBA, 0x99, 0x88, 0x88, 0x88,
+ 0x88, 0x99, 0xAB, 0xBC, 0xCB, 0xBA, 0x99, 0x88, 0x77, 0x77, 0x77, 0x88,
+ 0x89, 0xAB, 0xCC, 0xAB, 0xA9, 0x88, 0x77, 0x66, 0x66, 0x77, 0x78, 0x9A,
+ 0xAB, 0xBA, 0xA9, 0x98, 0x77, 0x66, 0x66, 0x66, 0x67, 0x88, 0x9A, 0xBB,
+ 0xAA, 0x99, 0x87, 0x66, 0x65, 0x55, 0x66, 0x77, 0x89, 0xAB, 0xBA, 0xA9,
+ 0x88, 0x76, 0x65, 0x55, 0x55, 0x67, 0x78, 0x99, 0xBB, 0xAA, 0x98, 0x77,
+ 0x66, 0x55, 0x55, 0x56, 0x77, 0x89, 0xAB, 0xBA, 0xA9, 0x88, 0x76, 0x65,
+ 0x55, 0x56, 0x67, 0x78, 0x9A, 0xBB, 0xAA, 0x99, 0x87, 0x76, 0x65, 0x56,
+ 0x66, 0x77, 0x89, 0xAB, 0xBB, 0xBA, 0x98, 0x77, 0x66, 0x66, 0x66, 0x77,
+ 0x89, 0x9A, 0xBB, 0xBB, 0xAA, 0x98, 0x77, 0x76, 0x67, 0x77, 0x88, 0x9A,
+ 0xAB, 0xBB, 0xCB, 0xA9, 0x98, 0x87, 0x77, 0x77, 0x88, 0x99, 0xAB, 0xBB,
+ 0xCC, 0xBA, 0xA9, 0x98, 0x88, 0x88, 0x89, 0x99, 0xAA, 0xBC, 0xBC, 0xCC,
+ 0xBB, 0xAA, 0x99, 0x99, 0x99, 0x9A, 0xAB, 0xBC, 0xDC, 0xDD, 0xDC, 0xBB,
+ 0xAA, 0xAA, 0xAA, 0xAA, 0xAB, 0xBC, 0xCD, 0xCE, 0xFD, 0xDC, 0xCB, 0xBB,
+ 0xAB, 0xBB, 0xBB, 0xCC, 0xCD, 0xDC, 0xBD, 0xDC, 0xCC, 0xBB, 0xBB, 0xAA,
+ 0xAB, 0xBB, 0xBC, 0xCC, 0xA0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xBE, 0xED, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xEF, 0xFF, 0xFF, 0xBE, 0xFF,
+ 0xED, 0xDD, 0xCD, 0xDD, 0xDE, 0xFF, 0xFF, 0xFF, 0xFF, 0xEF, 0xED, 0xDC,
+ 0xCC, 0xBC, 0xBC, 0xDD, 0xDE, 0xFF, 0xFF, 0xFD, 0xDD, 0xDC, 0xBB, 0xAA,
+ 0xAA, 0xBB, 0xCC, 0xDE, 0xFF, 0xFF, 0xDE, 0xDC, 0xBA, 0xA9, 0x99, 0x99,
+ 0x9A, 0xBC, 0xDE, 0xFF, 0xFD, 0xDC, 0xBA, 0x99, 0x88, 0x88, 0x88, 0x9A,
+ 0xBC, 0xDF, 0xFF, 0xDD, 0xCB, 0xA9, 0x87, 0x76, 0x67, 0x78, 0x9A, 0xBD,
+ 0xFF, 0xFD, 0xDC, 0xA9, 0x87, 0x66, 0x55, 0x66, 0x78, 0x9B, 0xCD, 0xFE,
+ 0xDD, 0xBA, 0x98, 0x76, 0x54, 0x45, 0x56, 0x89, 0xAB, 0xEE, 0xFD, 0xDB,
+ 0xA9, 0x76, 0x54, 0x44, 0x45, 0x67, 0x9A, 0xBD, 0xEE, 0xDD, 0xBA, 0x98,
+ 0x65, 0x44, 0x44, 0x56, 0x78, 0xAB, 0xDE, 0xED, 0xEC, 0xA9, 0x87, 0x55,
+ 0x44, 0x45, 0x67, 0x9A, 0xBC, 0xED, 0xED, 0xCB, 0x98, 0x76, 0x55, 0x55,
+ 0x67, 0x89, 0xAB, 0xCE, 0xEE, 0xFD, 0xBA, 0x98, 0x76, 0x66, 0x67, 0x78,
+ 0x9A, 0xBD, 0xEE, 0xFF, 0xDC, 0xBA, 0x98, 0x87, 0x77, 0x88, 0x9A, 0xBC,
+ 0xDE, 0xEF, 0xFE, 0xDC, 0xBA, 0x99, 0x88, 0x99, 0x9A, 0xBB, 0xCD, 0xFE,
+ 0xEF, 0xFE, 0xDC, 0xBA, 0xAA, 0xAA, 0xAA, 0xBB, 0xCD, 0xDF, 0xEF, 0xFF,
+ 0xFE, 0xDC, 0xCC, 0xCB, 0xBB, 0xBC, 0xCD, 0xDF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xED, 0xDD, 0xCC, 0xCD, 0xDD, 0xDE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xDE, 0xED, 0xEE, 0xEF, 0xFF, 0xFF, 0xBE, 0xFF, 0xFF, 0xEE, 0xEE, 0xDE,
+ 0xED, 0xDD, 0xEE, 0xFE, 0xB0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xAC, 0xDC, 0xCC, 0xCC, 0xCC, 0xCC, 0xDD, 0xDF, 0xFE, 0xFF, 0xBC, 0xED,
+ 0xDD, 0xCC, 0xCC, 0xCC, 0xCC, 0xDE, 0xFF, 0xFF, 0xFF, 0xCD, 0xDC, 0xCC,
+ 0xBB, 0xAB, 0xAB, 0xBC, 0xCD, 0xEF, 0xFF, 0xFC, 0xDC, 0xCB, 0xAA, 0xA9,
+ 0x99, 0x9A, 0xAB, 0xCC, 0xFF, 0xFE, 0xCD, 0xCB, 0xAA, 0x99, 0x88, 0x88,
+ 0x99, 0xAB, 0xCD, 0xEF, 0xFC, 0xCB, 0xBA, 0x98, 0x87, 0x77, 0x77, 0x89,
+ 0xAB, 0xCE, 0xFE, 0xCC, 0xBA, 0x98, 0x77, 0x66, 0x66, 0x77, 0x89, 0xAB,
+ 0xDE, 0xDC, 0xCB, 0xA9, 0x87, 0x66, 0x55, 0x56, 0x77, 0x8A, 0xBC, 0xDE,
+ 0xCC, 0xB9, 0x87, 0x66, 0x55, 0x55, 0x56, 0x78, 0x9B, 0xCD, 0xDC, 0xBA,
+ 0x98, 0x76, 0x55, 0x44, 0x45, 0x67, 0x89, 0xAC, 0xDD, 0xCC, 0xB9, 0x87,
+ 0x65, 0x54, 0x45, 0x56, 0x78, 0x9A, 0xCD, 0xDD, 0xCB, 0x98, 0x76, 0x55,
+ 0x55, 0x55, 0x67, 0x89, 0xAC, 0xCD, 0xCC, 0xBA, 0x98, 0x76, 0x55, 0x55,
+ 0x66, 0x78, 0x9A, 0xCC, 0xCD, 0xDB, 0xA9, 0x87, 0x66, 0x66, 0x66, 0x78,
+ 0x9A, 0xBC, 0xDD, 0xDD, 0xCB, 0xA9, 0x87, 0x77, 0x77, 0x78, 0x89, 0xAB,
+ 0xDD, 0xDE, 0xED, 0xBB, 0xA9, 0x88, 0x88, 0x88, 0x99, 0xAB, 0xCC, 0xDD,
+ 0xFF, 0xEC, 0xCB, 0xAA, 0x99, 0x99, 0x9A, 0xAA, 0xBC, 0xDD, 0xDF, 0xFF,
+ 0xFE, 0xCB, 0xBA, 0xAA, 0xAA, 0xBB, 0xCC, 0xED, 0xDD, 0xFF, 0xFF, 0xEE,
+ 0xCC, 0xCB, 0xBB, 0xCC, 0xCC, 0xDD, 0xEE, 0xDF, 0xFF, 0xFF, 0xFE, 0xED,
+ 0xDC, 0xCD, 0xCD, 0xDD, 0xDE, 0xED, 0xCF, 0xFF, 0xFE, 0xEE, 0xDD, 0xDD,
+ 0xCD, 0xCC, 0xDD, 0xDD, 0xB0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xCD, 0xDD, 0xDC, 0xCC, 0xCC, 0xCC, 0xCD, 0xDE, 0xFF, 0xFF, 0xDD, 0xED,
+ 0xDC, 0xCC, 0xCB, 0xBB, 0xCC, 0xCD, 0xEE, 0xFF, 0xFF, 0xDE, 0xDD, 0xCB,
+ 0xBB, 0xAA, 0xAA, 0xBB, 0xCD, 0xDF, 0xFF, 0xFD, 0xDC, 0xBB, 0xAA, 0x99,
+ 0x99, 0x99, 0xAB, 0xBC, 0xDE, 0xFF, 0xCD, 0xCB, 0xA9, 0x98, 0x88, 0x88,
+ 0x89, 0xAA, 0xBC, 0xEF, 0xFC, 0xCB, 0xA9, 0x98, 0x77, 0x77, 0x77, 0x89,
+ 0x9B, 0xCD, 0xEE, 0xCC, 0xBA, 0x98, 0x77, 0x66, 0x66, 0x67, 0x89, 0xAB,
+ 0xCD, 0xEC, 0xCA, 0x98, 0x87, 0x66, 0x55, 0x56, 0x67, 0x89, 0xAC, 0xDE,
+ 0xCB, 0xA9, 0x87, 0x66, 0x55, 0x55, 0x56, 0x78, 0x9A, 0xCD, 0xDC, 0xBA,
+ 0x98, 0x76, 0x55, 0x54, 0x55, 0x67, 0x89, 0xAB, 0xCD, 0xCC, 0xA9, 0x87,
+ 0x65, 0x54, 0x45, 0x56, 0x78, 0x9A, 0xBC, 0xDC, 0xCA, 0x98, 0x76, 0x55,
+ 0x55, 0x55, 0x67, 0x89, 0xAB, 0xCC, 0xCC, 0xBA, 0x87, 0x66, 0x55, 0x55,
+ 0x66, 0x78, 0x9A, 0xBC, 0xDD, 0xCB, 0xA9, 0x87, 0x66, 0x66, 0x66, 0x78,
+ 0x99, 0xAB, 0xDD, 0xDD, 0xCA, 0xA9, 0x87, 0x77, 0x77, 0x78, 0x89, 0xAB,
+ 0xCD, 0xDE, 0xDC, 0xBA, 0xA9, 0x88, 0x88, 0x88, 0x89, 0xAA, 0xBC, 0xDD,
+ 0xEE, 0xDC, 0xBB, 0xA9, 0x99, 0x99, 0x99, 0xAA, 0xBC, 0xDE, 0xDF, 0xFF,
+ 0xDD, 0xCB, 0xBA, 0xAA, 0xAA, 0xAB, 0xBC, 0xDD, 0xFD, 0xFF, 0xFF, 0xED,
+ 0xCC, 0xBB, 0xBB, 0xBB, 0xCC, 0xDD, 0xEF, 0xDF, 0xFF, 0xFE, 0xED, 0xDD,
+ 0xCC, 0xCC, 0xCD, 0xDE, 0xEF, 0xFE, 0xCF, 0xFF, 0xFF, 0xDE, 0xDD, 0xDD,
+ 0xCD, 0xDD, 0xDE, 0xEE, 0xC0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xBE, 0xDD, 0xCC, 0xCC, 0xCC, 0xCD, 0xDF, 0xEE, 0xFF, 0xFF, 0xCD, 0xDE,
+ 0xCC, 0xCC, 0xCC, 0xCC, 0xCD, 0xDE, 0xFF, 0xFF, 0xFF, 0xDD, 0xCC, 0xBB,
+ 0xBB, 0xBB, 0xBB, 0xBB, 0xCD, 0xDF, 0xFF, 0xFD, 0xDC, 0xCB, 0xBA, 0xA9,
+ 0x99, 0xAA, 0xAB, 0xCD, 0xFF, 0xFF, 0xCC, 0xBB, 0xA9, 0x98, 0x88, 0x88,
+ 0x99, 0xAB, 0xCF, 0xFF, 0xFC, 0xCB, 0xA9, 0x98, 0x77, 0x77, 0x77, 0x89,
+ 0xAB, 0xCE, 0xFF, 0xCD, 0xBA, 0x98, 0x77, 0x66, 0x66, 0x77, 0x89, 0xAB,
+ 0xDD, 0xFC, 0xCB, 0x98, 0x87, 0x65, 0x55, 0x56, 0x77, 0x8A, 0xBD, 0xFF,
+ 0xCC, 0xB9, 0x87, 0x65, 0x55, 0x55, 0x56, 0x78, 0x9A, 0xCD, 0xED, 0xCB,
+ 0x98, 0x76, 0x55, 0x44, 0x55, 0x67, 0x89, 0xAB, 0xDD, 0xCC, 0xB9, 0x87,
+ 0x65, 0x54, 0x45, 0x56, 0x78, 0x9A, 0xBD, 0xDD, 0xCB, 0xA8, 0x76, 0x55,
+ 0x55, 0x55, 0x67, 0x89, 0xAB, 0xCD, 0xED, 0xBA, 0x98, 0x76, 0x55, 0x55,
+ 0x66, 0x78, 0x9A, 0xBD, 0xCD, 0xFC, 0xB9, 0x87, 0x76, 0x66, 0x66, 0x78,
+ 0x99, 0xAB, 0xFD, 0xFF, 0xCB, 0xA9, 0x87, 0x77, 0x77, 0x78, 0x89, 0xAB,
+ 0xCD, 0xDF, 0xFD, 0xBB, 0xA9, 0x98, 0x88, 0x88, 0x89, 0xAB, 0xCC, 0xDD,
+ 0xFF, 0xDE, 0xCC, 0xAA, 0x99, 0x99, 0x99, 0xAA, 0xBC, 0xDD, 0xCF, 0xFF,
+ 0xDD, 0xCB, 0xBB, 0xBA, 0xAA, 0xBB, 0xBC, 0xCD, 0xED, 0xFF, 0xFF, 0xDD,
+ 0xDD, 0xCC, 0xBB, 0xCC, 0xCC, 0xCD, 0xDD, 0xDF, 0xFF, 0xFF, 0xFE, 0xED,
+ 0xDC, 0xCD, 0xED, 0xDE, 0xDF, 0xEE, 0xBF, 0xFF, 0xFF, 0xFE, 0xED, 0xDC,
+ 0xDD, 0xCC, 0xCC, 0xDD, 0xB0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xBD, 0xDD, 0xDC, 0xCC, 0xDC, 0xCD, 0xDD, 0xDE, 0xFF, 0xEF, 0xBE, 0xEE,
+ 0xDD, 0xDC, 0xCC, 0xCD, 0xDD, 0xDE, 0xFF, 0xFF, 0xFE, 0xDE, 0xDD, 0xCB,
+ 0xBB, 0xBB, 0xBB, 0xCC, 0xDE, 0xEF, 0xFF, 0xFD, 0xDD, 0xCB, 0xBA, 0xAA,
+ 0xAA, 0xAB, 0xBC, 0xCE, 0xFF, 0xFE, 0xCD, 0xDB, 0xBA, 0x99, 0x98, 0x99,
+ 0x9A, 0xAC, 0xDD, 0xFF, 0xFD, 0xDC, 0xBA, 0x99, 0x87, 0x77, 0x78, 0x99,
+ 0xBC, 0xDE, 0xEE, 0xDC, 0xBA, 0x98, 0x87, 0x76, 0x66, 0x78, 0x9A, 0xBC,
+ 0xDF, 0xFC, 0xDB, 0xA9, 0x87, 0x66, 0x55, 0x66, 0x78, 0x9A, 0xBD, 0xFE,
+ 0xCC, 0xBA, 0x98, 0x66, 0x55, 0x45, 0x56, 0x78, 0xAB, 0xCE, 0xDD, 0xCB,
+ 0xA8, 0x76, 0x55, 0x44, 0x45, 0x67, 0x8A, 0xBC, 0xDE, 0xDD, 0xBA, 0x87,
+ 0x65, 0x44, 0x44, 0x56, 0x78, 0x9B, 0xCD, 0xDD, 0xDB, 0xA9, 0x86, 0x55,
+ 0x44, 0x55, 0x67, 0x89, 0xBC, 0xDE, 0xDD, 0xCB, 0x98, 0x76, 0x55, 0x55,
+ 0x67, 0x89, 0xAB, 0xCD, 0xDE, 0xFC, 0xBA, 0x98, 0x76, 0x66, 0x67, 0x78,
+ 0x9A, 0xBC, 0xDD, 0xFF, 0xDC, 0xAA, 0x98, 0x77, 0x77, 0x88, 0x99, 0xAB,
+ 0xCD, 0xDE, 0xFE, 0xDB, 0xBA, 0x98, 0x88, 0x89, 0x9A, 0xAB, 0xCD, 0xDE,
+ 0xEF, 0xEE, 0xCC, 0xBA, 0xA9, 0x99, 0x9A, 0xAB, 0xCC, 0xED, 0xEF, 0xFF,
+ 0xFD, 0xDC, 0xBB, 0xBB, 0xBB, 0xBB, 0xCD, 0xDE, 0xEF, 0xFF, 0xFF, 0xFE,
+ 0xDD, 0xCD, 0xCC, 0xCC, 0xCC, 0xDE, 0xEF, 0xEF, 0xFF, 0xFF, 0xFE, 0xED,
+ 0xDD, 0xDD, 0xDD, 0xEE, 0xFF, 0xFE, 0xBF, 0xEE, 0xEE, 0xFE, 0xED, 0xDD,
+ 0xDD, 0xDD, 0xDE, 0xEE, 0xC0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0x9C, 0xCB, 0xBB, 0xBA, 0xBA, 0xBB, 0xBB, 0xCC, 0xCD, 0xDE, 0xAC, 0xDD,
+ 0xCC, 0xBB, 0xBB, 0xBB, 0xBB, 0xBC, 0xCD, 0xEF, 0xFE, 0xCD, 0xCB, 0xBB,
+ 0xAA, 0xAA, 0xAA, 0xAA, 0xBB, 0xCD, 0xEF, 0xDB, 0xCB, 0xBA, 0xA9, 0x99,
+ 0x99, 0x99, 0x9A, 0xBB, 0xCD, 0xED, 0xBC, 0xBA, 0xA9, 0x88, 0x88, 0x88,
+ 0x89, 0x9A, 0xBB, 0xCD, 0xDB, 0xBA, 0xA9, 0x88, 0x77, 0x77, 0x77, 0x88,
+ 0x9A, 0xBC, 0xDC, 0xBB, 0xA9, 0x98, 0x77, 0x66, 0x66, 0x77, 0x89, 0x9A,
+ 0xBC, 0xCB, 0xBA, 0x98, 0x77, 0x66, 0x55, 0x66, 0x77, 0x89, 0xAB, 0xCC,
+ 0xBB, 0xA9, 0x87, 0x66, 0x55, 0x55, 0x66, 0x78, 0x9A, 0xBC, 0xBB, 0xBA,
+ 0x98, 0x76, 0x55, 0x54, 0x55, 0x67, 0x88, 0x9A, 0xBB, 0xBB, 0xA9, 0x87,
+ 0x65, 0x54, 0x45, 0x56, 0x78, 0x89, 0xAB, 0xBB, 0xBA, 0x98, 0x76, 0x65,
+ 0x55, 0x55, 0x67, 0x88, 0xAA, 0xBB, 0xBB, 0xA9, 0x87, 0x76, 0x65, 0x55,
+ 0x66, 0x78, 0x9A, 0xBC, 0xBB, 0xBA, 0xA9, 0x87, 0x76, 0x66, 0x66, 0x77,
+ 0x89, 0xAB, 0xCB, 0xCC, 0xBA, 0x98, 0x87, 0x77, 0x77, 0x78, 0x89, 0x9A,
+ 0xBC, 0xBC, 0xCB, 0xBA, 0x99, 0x88, 0x88, 0x88, 0x89, 0x9A, 0xBB, 0xCC,
+ 0xCD, 0xCB, 0xAA, 0x99, 0x98, 0x89, 0x99, 0x9A, 0xBB, 0xCD, 0xCC, 0xDD,
+ 0xCB, 0xBA, 0xAA, 0xA9, 0x9A, 0xAA, 0xBC, 0xCC, 0xDC, 0xDE, 0xED, 0xCC,
+ 0xBB, 0xBA, 0xAA, 0xAB, 0xBB, 0xCC, 0xCD, 0xCD, 0xFE, 0xED, 0xDC, 0xCC,
+ 0xBB, 0xCB, 0xCC, 0xCD, 0xDD, 0xEC, 0xAD, 0xDD, 0xCC, 0xCC, 0xBB, 0xBB,
+ 0xBB, 0xCB, 0xCC, 0xCC, 0xA0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0x9B, 0xBA, 0xAA, 0xA9, 0xA9, 0x9A, 0xAA, 0xAB, 0xBB, 0xCC, 0xAB, 0xDC,
+ 0xBB, 0xAA, 0xAA, 0xAA, 0xAA, 0xAB, 0xBB, 0xCD, 0xED, 0xBB, 0xBB, 0xAA,
+ 0x99, 0x99, 0x99, 0x99, 0xAA, 0xBB, 0xCD, 0xCA, 0xBB, 0xA9, 0x99, 0x88,
+ 0x88, 0x88, 0x99, 0x9A, 0xBB, 0xDC, 0xAB, 0xAA, 0x98, 0x88, 0x77, 0x77,
+ 0x88, 0x89, 0x9A, 0xBB, 0xBA, 0xAA, 0x98, 0x88, 0x77, 0x77, 0x77, 0x78,
+ 0x89, 0xAB, 0xBB, 0xAA, 0x99, 0x87, 0x77, 0x66, 0x66, 0x67, 0x78, 0x89,
+ 0xAB, 0xBA, 0xA9, 0x88, 0x77, 0x66, 0x66, 0x66, 0x67, 0x78, 0x9A, 0xBB,
+ 0x9A, 0x98, 0x87, 0x66, 0x65, 0x56, 0x66, 0x77, 0x89, 0x9A, 0xA9, 0xA9,
+ 0x87, 0x76, 0x65, 0x55, 0x56, 0x67, 0x78, 0x99, 0xAA, 0xAA, 0x98, 0x77,
+ 0x66, 0x55, 0x55, 0x66, 0x77, 0x89, 0x9A, 0xAA, 0xA9, 0x87, 0x76, 0x66,
+ 0x55, 0x66, 0x67, 0x78, 0x99, 0xAA, 0xAA, 0x98, 0x87, 0x76, 0x66, 0x66,
+ 0x66, 0x78, 0x89, 0xAB, 0xAA, 0xA9, 0x98, 0x77, 0x66, 0x66, 0x66, 0x77,
+ 0x88, 0x9A, 0xBA, 0xAA, 0xA9, 0x88, 0x77, 0x77, 0x77, 0x77, 0x88, 0x99,
+ 0xAB, 0xBB, 0xBA, 0x99, 0x88, 0x77, 0x77, 0x77, 0x88, 0x99, 0xAB, 0xBB,
+ 0xBC, 0xBA, 0x99, 0x98, 0x88, 0x88, 0x88, 0x99, 0xAA, 0xBC, 0xBC, 0xCB,
+ 0xBA, 0xA9, 0x99, 0x99, 0x99, 0x99, 0xAA, 0xBB, 0xCB, 0xCD, 0xCB, 0xBB,
+ 0xAA, 0xA9, 0x99, 0xAA, 0xAA, 0xBB, 0xCC, 0xCD, 0xEC, 0xDC, 0xBB, 0xBB,
+ 0xAA, 0xAA, 0xBB, 0xBC, 0xCD, 0xDC, 0xAD, 0xCC, 0xCB, 0xBA, 0xAA, 0xAA,
+ 0xAA, 0xAB, 0xBB, 0xBC, 0xA0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xAB, 0xBA, 0xAA, 0x99, 0x99, 0x99, 0x99, 0xAA, 0xBB, 0xCC, 0xAB, 0xCB,
+ 0xBA, 0xAA, 0xA9, 0x99, 0x9A, 0xAA, 0xBB, 0xCC, 0xDC, 0xBC, 0xBA, 0xA9,
+ 0x99, 0x99, 0x89, 0x99, 0x9A, 0xAB, 0xCC, 0xCA, 0xBA, 0xA9, 0x98, 0x88,
+ 0x88, 0x88, 0x89, 0x9A, 0xAB, 0xCB, 0xAA, 0xA9, 0x98, 0x88, 0x77, 0x77,
+ 0x78, 0x89, 0x9A, 0xBB, 0xBA, 0xA9, 0x98, 0x87, 0x77, 0x77, 0x77, 0x78,
+ 0x89, 0x9A, 0xBA, 0x9A, 0x98, 0x87, 0x77, 0x66, 0x66, 0x67, 0x78, 0x89,
+ 0xAB, 0xA9, 0xA9, 0x88, 0x77, 0x66, 0x66, 0x66, 0x67, 0x78, 0x99, 0xAA,
+ 0x99, 0x98, 0x77, 0x66, 0x66, 0x66, 0x66, 0x77, 0x88, 0x9A, 0xA9, 0x99,
+ 0x87, 0x76, 0x66, 0x55, 0x56, 0x67, 0x78, 0x89, 0xAA, 0x99, 0x88, 0x77,
+ 0x66, 0x65, 0x56, 0x66, 0x77, 0x88, 0x9A, 0xA9, 0x99, 0x87, 0x76, 0x66,
+ 0x66, 0x66, 0x67, 0x78, 0x89, 0xAA, 0x9A, 0x98, 0x77, 0x66, 0x66, 0x66,
+ 0x66, 0x77, 0x89, 0x9A, 0xA9, 0xA9, 0x88, 0x77, 0x66, 0x66, 0x66, 0x77,
+ 0x88, 0x99, 0xAA, 0xAA, 0x99, 0x88, 0x77, 0x77, 0x77, 0x77, 0x88, 0x99,
+ 0xAB, 0xAA, 0xBA, 0x99, 0x88, 0x77, 0x77, 0x77, 0x88, 0x89, 0xAA, 0xBA,
+ 0xBB, 0xAA, 0x99, 0x88, 0x88, 0x88, 0x88, 0x99, 0x9A, 0xBB, 0xBB, 0xCB,
+ 0xAA, 0x99, 0x98, 0x88, 0x89, 0x99, 0xAA, 0xAB, 0xCB, 0xBC, 0xCB, 0xBA,
+ 0xA9, 0x99, 0x99, 0x99, 0xAA, 0xBB, 0xCD, 0xBC, 0xDC, 0xCB, 0xBA, 0xAA,
+ 0xAA, 0xAA, 0xAA, 0xBB, 0xCC, 0xDC, 0xAC, 0xCB, 0xBA, 0xAA, 0xAA, 0xAA,
+ 0xAA, 0xAA, 0xBB, 0xCC, 0xA0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0x9B, 0xBA, 0xAA, 0xA9, 0x99, 0x99, 0x9A, 0xAA, 0xBB, 0xCC, 0xAB, 0xCC,
+ 0xBA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xBB, 0xCC, 0xDD, 0xAB, 0xBA, 0xAA,
+ 0x99, 0x99, 0x99, 0x99, 0xAA, 0xAB, 0xCD, 0xCA, 0xBA, 0xA9, 0x98, 0x88,
+ 0x88, 0x88, 0x99, 0x9A, 0xBB, 0xCB, 0xAB, 0xA9, 0x98, 0x88, 0x77, 0x77,
+ 0x88, 0x89, 0x9A, 0xBC, 0xBA, 0xBA, 0x98, 0x88, 0x77, 0x77, 0x77, 0x78,
+ 0x89, 0x9A, 0xBB, 0x9A, 0x99, 0x87, 0x77, 0x66, 0x66, 0x77, 0x78, 0x89,
+ 0xAB, 0xA9, 0xA9, 0x88, 0x77, 0x66, 0x66, 0x66, 0x67, 0x88, 0x9A, 0xAA,
+ 0x9A, 0x98, 0x77, 0x66, 0x66, 0x56, 0x66, 0x77, 0x89, 0xAA, 0xA9, 0xA9,
+ 0x87, 0x76, 0x65, 0x55, 0x56, 0x67, 0x78, 0x9A, 0xAA, 0x99, 0x98, 0x77,
+ 0x66, 0x55, 0x55, 0x66, 0x77, 0x89, 0x9A, 0xA9, 0xA9, 0x87, 0x76, 0x66,
+ 0x55, 0x66, 0x67, 0x78, 0x89, 0xAA, 0x9A, 0x98, 0x87, 0x76, 0x66, 0x66,
+ 0x67, 0x77, 0x89, 0xAA, 0xAA, 0xA9, 0x88, 0x77, 0x66, 0x66, 0x67, 0x77,
+ 0x88, 0x9A, 0xAA, 0xAA, 0xA9, 0x88, 0x77, 0x77, 0x77, 0x77, 0x88, 0x99,
+ 0xAB, 0xAB, 0xAA, 0x99, 0x88, 0x77, 0x77, 0x77, 0x88, 0x89, 0xAA, 0xBA,
+ 0xBB, 0xAA, 0x99, 0x88, 0x88, 0x88, 0x88, 0x99, 0xAA, 0xAC, 0xBB, 0xCB,
+ 0xAA, 0xA9, 0x99, 0x99, 0x99, 0x99, 0xAA, 0xBB, 0xCB, 0xBD, 0xCB, 0xBA,
+ 0xAA, 0x99, 0x99, 0x9A, 0xAA, 0xAB, 0xCD, 0xCD, 0xDC, 0xCB, 0xBB, 0xAA,
+ 0xAA, 0xAA, 0xBB, 0xBB, 0xCC, 0xDC, 0xAC, 0xCC, 0xBB, 0xAA, 0xAA, 0xAA,
+ 0xAA, 0xAA, 0xAB, 0xCC, 0xA0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0x9B, 0xBB, 0xAA, 0xAA, 0xAA, 0xAA, 0xAB, 0xBB, 0xBC, 0xCC, 0x9B, 0xCC,
+ 0xCB, 0xBB, 0xAA, 0xAA, 0xAB, 0xBB, 0xCD, 0xDD, 0xED, 0xBC, 0xCB, 0xBA,
+ 0xAA, 0x99, 0x9A, 0xAA, 0xBB, 0xCC, 0xDD, 0xCB, 0xCB, 0xAA, 0x99, 0x99,
+ 0x89, 0x99, 0x9A, 0xAB, 0xCC, 0xDC, 0xBB, 0xBA, 0x99, 0x88, 0x88, 0x88,
+ 0x88, 0x9A, 0xAB, 0xCD, 0xCA, 0xBA, 0x99, 0x88, 0x77, 0x77, 0x77, 0x88,
+ 0x9A, 0xBB, 0xCC, 0xAB, 0xA9, 0x88, 0x77, 0x66, 0x66, 0x77, 0x88, 0x9A,
+ 0xBC, 0xBA, 0xAA, 0x98, 0x77, 0x66, 0x55, 0x66, 0x77, 0x89, 0xAB, 0xBB,
+ 0xAA, 0x99, 0x87, 0x66, 0x55, 0x55, 0x66, 0x78, 0x9A, 0xAB, 0xBA, 0xA9,
+ 0x98, 0x76, 0x55, 0x55, 0x55, 0x67, 0x88, 0x9A, 0xBB, 0xAA, 0x99, 0x87,
+ 0x65, 0x54, 0x45, 0x56, 0x78, 0x89, 0xAB, 0xBA, 0xBA, 0x98, 0x76, 0x65,
+ 0x55, 0x56, 0x67, 0x88, 0x9A, 0xBB, 0xAB, 0xA9, 0x87, 0x76, 0x65, 0x56,
+ 0x66, 0x78, 0x99, 0xAB, 0xBB, 0xBA, 0x99, 0x87, 0x76, 0x66, 0x66, 0x77,
+ 0x89, 0xAA, 0xBB, 0xBC, 0xBA, 0x98, 0x87, 0x77, 0x77, 0x77, 0x89, 0x9A,
+ 0xAB, 0xBB, 0xCB, 0xAA, 0x98, 0x88, 0x88, 0x88, 0x89, 0x9A, 0xAB, 0xCB,
+ 0xCC, 0xCB, 0xAA, 0x99, 0x98, 0x88, 0x99, 0x9A, 0xAB, 0xBC, 0xBC, 0xDC,
+ 0xCB, 0xAA, 0xA9, 0x99, 0x99, 0xAA, 0xAB, 0xBC, 0xDC, 0xCE, 0xDC, 0xCB,
+ 0xBB, 0xAA, 0xAA, 0xAA, 0xBB, 0xBC, 0xCD, 0xCD, 0xED, 0xDD, 0xCC, 0xCB,
+ 0xBB, 0xBB, 0xBB, 0xCC, 0xCD, 0xEC, 0xAD, 0xCC, 0xCC, 0xBB, 0xBB, 0xBB,
+ 0xBB, 0xBB, 0xBB, 0xCC, 0xA0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xCE, 0xFE, 0xED, 0xDD, 0xDD, 0xDD, 0xDD, 0xDE, 0xEE, 0xEE, 0xBF, 0xFF,
+ 0xFE, 0xFD, 0xDD, 0xDD, 0xDE, 0xEE, 0xFF, 0xFF, 0xFE, 0xFF, 0xFE, 0xED,
+ 0xCC, 0xCB, 0xCC, 0xCC, 0xDE, 0xEF, 0xFF, 0xEE, 0xFF, 0xEC, 0xCB, 0xBA,
+ 0xAA, 0xAB, 0xBC, 0xDD, 0xFF, 0xFE, 0xEF, 0xED, 0xCB, 0xAA, 0x99, 0x99,
+ 0xAA, 0xBC, 0xDE, 0xFF, 0xEE, 0xFD, 0xCB, 0xA9, 0x88, 0x88, 0x89, 0x9A,
+ 0xBC, 0xDE, 0xFF, 0xDE, 0xCB, 0xA9, 0x87, 0x76, 0x77, 0x78, 0x9A, 0xBD,
+ 0xEF, 0xED, 0xEC, 0xB9, 0x87, 0x66, 0x55, 0x66, 0x79, 0xAB, 0xCE, 0xFE,
+ 0xDD, 0xCA, 0x98, 0x76, 0x54, 0x45, 0x67, 0x89, 0xAC, 0xDE, 0xED, 0xDB,
+ 0xA9, 0x86, 0x54, 0x43, 0x45, 0x68, 0x9A, 0xCD, 0xEE, 0xDD, 0xBA, 0x98,
+ 0x75, 0x43, 0x34, 0x56, 0x79, 0xAB, 0xDE, 0xED, 0xDC, 0xB9, 0x87, 0x65,
+ 0x44, 0x55, 0x78, 0x9A, 0xCD, 0xEE, 0xDD, 0xCB, 0xA9, 0x76, 0x65, 0x55,
+ 0x67, 0x89, 0xBC, 0xDF, 0xED, 0xED, 0xBA, 0x98, 0x77, 0x66, 0x77, 0x89,
+ 0xAB, 0xCD, 0xFE, 0xDE, 0xEC, 0xBA, 0x99, 0x88, 0x78, 0x89, 0xAB, 0xBD,
+ 0xEF, 0xED, 0xFE, 0xDC, 0xBA, 0xA9, 0x99, 0x99, 0xAB, 0xBC, 0xDF, 0xFE,
+ 0xEF, 0xFE, 0xDC, 0xBB, 0xBA, 0xAA, 0xBB, 0xCD, 0xDE, 0xEF, 0xFD, 0xFE,
+ 0xEE, 0xDD, 0xCC, 0xCC, 0xCC, 0xDD, 0xDE, 0xFF, 0xFF, 0xEF, 0xFF, 0xEE,
+ 0xEE, 0xDD, 0xDD, 0xDD, 0xEE, 0xEF, 0xFF, 0xFE, 0xFF, 0xFF, 0xFF, 0xEE,
+ 0xFE, 0xEE, 0xEF, 0xFF, 0xFF, 0xFF, 0xAE, 0xEE, 0xEE, 0xEE, 0xDD, 0xDE,
+ 0xEF, 0xFE, 0xEE, 0xFF, 0xC0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xBE, 0xDC, 0xDC, 0xCC, 0xCB, 0xCB, 0xCC, 0xCC, 0xDD, 0xCD, 0xAD, 0xED,
+ 0xDD, 0xCC, 0xCC, 0xCC, 0xBC, 0xCD, 0xCE, 0xEF, 0xFE, 0xEE, 0xDC, 0xCB,
+ 0xBB, 0xBA, 0xAB, 0xBB, 0xCC, 0xDE, 0xDF, 0xDC, 0xDC, 0xCB, 0xAA, 0x99,
+ 0x99, 0x9A, 0xAB, 0xCD, 0xDE, 0xFD, 0xCD, 0xCB, 0xA9, 0x99, 0x88, 0x88,
+ 0x99, 0xAA, 0xBC, 0xEF, 0xDC, 0xDB, 0xAA, 0x98, 0x77, 0x77, 0x77, 0x89,
+ 0xAB, 0xCD, 0xDD, 0xCC, 0xBA, 0x98, 0x77, 0x66, 0x66, 0x77, 0x89, 0xAB,
+ 0xDE, 0xDC, 0xCB, 0x98, 0x77, 0x65, 0x55, 0x56, 0x77, 0x89, 0xBC, 0xDD,
+ 0xCC, 0xA9, 0x87, 0x65, 0x55, 0x55, 0x56, 0x78, 0x9B, 0xBC, 0xDB, 0xCA,
+ 0x98, 0x76, 0x55, 0x44, 0x55, 0x67, 0x89, 0xAC, 0xDD, 0xCB, 0xA9, 0x87,
+ 0x65, 0x54, 0x45, 0x56, 0x78, 0x9A, 0xBC, 0xDC, 0xBA, 0x98, 0x76, 0x65,
+ 0x55, 0x55, 0x67, 0x89, 0xAC, 0xDD, 0xCC, 0xBA, 0x88, 0x76, 0x55, 0x55,
+ 0x66, 0x78, 0x9A, 0xBD, 0xCC, 0xCB, 0xA9, 0x87, 0x76, 0x66, 0x66, 0x78,
+ 0x9A, 0xBC, 0xDC, 0xCD, 0xCB, 0xA9, 0x87, 0x77, 0x77, 0x78, 0x89, 0xAC,
+ 0xCE, 0xDC, 0xDD, 0xCA, 0xA9, 0x88, 0x88, 0x88, 0x99, 0xAB, 0xCD, 0xED,
+ 0xDD, 0xDC, 0xCB, 0xAA, 0x99, 0x99, 0x9A, 0xAC, 0xCD, 0xEE, 0xDD, 0xEF,
+ 0xDC, 0xCB, 0xBA, 0xAA, 0xAA, 0xBB, 0xCC, 0xED, 0xFD, 0xEE, 0xEE, 0xDD,
+ 0xDC, 0xCB, 0xBB, 0xBC, 0xCD, 0xDE, 0xEF, 0xED, 0xFF, 0xED, 0xED, 0xDD,
+ 0xDC, 0xCD, 0xDD, 0xEE, 0xEF, 0xFE, 0xAD, 0xED, 0xDD, 0xDD, 0xCD, 0xDC,
+ 0xDD, 0xDE, 0xED, 0xED, 0xB0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xCD, 0xDD, 0xCC, 0xCC, 0xBB, 0xBC, 0xCC, 0xCD, 0xDE, 0xEF, 0xCE, 0xFE,
+ 0xDD, 0xCC, 0xBB, 0xBB, 0xBB, 0xCC, 0xDE, 0xFF, 0xFF, 0xDE, 0xDC, 0xCB,
+ 0xBA, 0xAA, 0xAA, 0xAB, 0xBC, 0xCE, 0xFF, 0xED, 0xDC, 0xBB, 0xAA, 0x99,
+ 0x99, 0x99, 0xAA, 0xBC, 0xDE, 0xFE, 0xDD, 0xCB, 0xA9, 0x98, 0x88, 0x88,
+ 0x88, 0x9A, 0xBC, 0xDE, 0xEC, 0xCB, 0xA9, 0x88, 0x77, 0x77, 0x77, 0x88,
+ 0x9A, 0xBC, 0xDE, 0xCC, 0xB9, 0x98, 0x77, 0x66, 0x66, 0x67, 0x88, 0x9B,
+ 0xCD, 0xDC, 0xBA, 0x98, 0x76, 0x65, 0x55, 0x56, 0x67, 0x89, 0xAB, 0xDD,
+ 0xBB, 0xA9, 0x87, 0x65, 0x55, 0x55, 0x56, 0x78, 0x9A, 0xBC, 0xDB, 0xBA,
+ 0x98, 0x76, 0x55, 0x55, 0x55, 0x67, 0x78, 0xAB, 0xCC, 0xCB, 0xA9, 0x87,
+ 0x65, 0x55, 0x55, 0x56, 0x77, 0x8A, 0xBC, 0xCC, 0xBA, 0x98, 0x76, 0x55,
+ 0x55, 0x55, 0x67, 0x89, 0xAB, 0xCC, 0xCB, 0xA9, 0x87, 0x66, 0x55, 0x55,
+ 0x66, 0x78, 0x9A, 0xBC, 0xDC, 0xCB, 0xA9, 0x87, 0x66, 0x66, 0x66, 0x78,
+ 0x89, 0xAC, 0xDD, 0xDD, 0xBA, 0x98, 0x87, 0x77, 0x77, 0x78, 0x89, 0xAB,
+ 0xCD, 0xDD, 0xDC, 0xBA, 0x99, 0x88, 0x77, 0x88, 0x89, 0xAB, 0xBD, 0xDD,
+ 0xDE, 0xDC, 0xBA, 0x99, 0x98, 0x89, 0x99, 0xAB, 0xBC, 0xDE, 0xED, 0xFD,
+ 0xDC, 0xBB, 0xAA, 0xAA, 0xAA, 0xAB, 0xCC, 0xDE, 0xFE, 0xEF, 0xEE, 0xDC,
+ 0xCB, 0xBB, 0xBB, 0xBC, 0xCD, 0xDE, 0xFF, 0xFE, 0xFF, 0xEE, 0xDD, 0xDC,
+ 0xCC, 0xCC, 0xDD, 0xEE, 0xEF, 0xFF, 0xCF, 0xEE, 0xED, 0xDD, 0xDD, 0xCC,
+ 0xCD, 0xDD, 0xDF, 0xEE, 0xC0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xBD, 0xCC, 0xCC, 0xBB, 0xBB, 0xBC, 0xBC, 0xCC, 0xCC, 0xDD, 0xAC, 0xDD,
+ 0xDD, 0xCC, 0xCC, 0xBC, 0xBC, 0xCC, 0xDD, 0xDF, 0xFD, 0xDE, 0xEC, 0xCB,
+ 0xBB, 0xAA, 0xAA, 0xBB, 0xCC, 0xCD, 0xDE, 0xCC, 0xDD, 0xCB, 0xAA, 0xA9,
+ 0x99, 0x9A, 0xAB, 0xCC, 0xDD, 0xED, 0xCD, 0xBB, 0xAA, 0x99, 0x88, 0x88,
+ 0x99, 0xAA, 0xBC, 0xDD, 0xDB, 0xCB, 0xAA, 0x98, 0x87, 0x77, 0x78, 0x89,
+ 0xAB, 0xCC, 0xED, 0xBC, 0xBA, 0x98, 0x77, 0x66, 0x67, 0x77, 0x89, 0xAB,
+ 0xCD, 0xCB, 0xCB, 0xA9, 0x87, 0x66, 0x55, 0x66, 0x78, 0x9A, 0xBC, 0xDC,
+ 0xBC, 0xA9, 0x87, 0x66, 0x55, 0x55, 0x66, 0x78, 0x9A, 0xBC, 0xCB, 0xCA,
+ 0x98, 0x76, 0x55, 0x44, 0x45, 0x67, 0x89, 0xAB, 0xCC, 0xBB, 0xB9, 0x87,
+ 0x65, 0x44, 0x44, 0x56, 0x78, 0x9A, 0xBC, 0xCB, 0xCA, 0xA8, 0x76, 0x65,
+ 0x44, 0x56, 0x67, 0x89, 0xAB, 0xCC, 0xCC, 0xBA, 0x98, 0x76, 0x65, 0x56,
+ 0x67, 0x78, 0x9A, 0xBD, 0xCC, 0xCB, 0xA9, 0x87, 0x76, 0x66, 0x67, 0x78,
+ 0x9A, 0xBC, 0xDC, 0xCD, 0xBB, 0xA9, 0x88, 0x77, 0x77, 0x78, 0x9A, 0xAB,
+ 0xCD, 0xCC, 0xDC, 0xBB, 0xA9, 0x98, 0x88, 0x88, 0x99, 0xAB, 0xCD, 0xDC,
+ 0xCD, 0xDC, 0xBB, 0xAA, 0x99, 0x99, 0x9A, 0xAB, 0xBC, 0xCD, 0xCC, 0xED,
+ 0xDC, 0xCB, 0xBB, 0xAA, 0xAA, 0xBB, 0xCC, 0xDD, 0xDD, 0xDE, 0xDD, 0xDD,
+ 0xCC, 0xBB, 0xBB, 0xCC, 0xCC, 0xCD, 0xDF, 0xDD, 0xFF, 0xED, 0xDD, 0xDC,
+ 0xCC, 0xCD, 0xDD, 0xEE, 0xEE, 0xFD, 0xAD, 0xDC, 0xDC, 0xCC, 0xCC, 0xBC,
+ 0xCC, 0xCC, 0xDC, 0xDE, 0xB0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xAE, 0xED, 0xDD, 0xDD, 0xDD, 0xDC, 0xDD, 0xDD, 0xDD, 0xDD, 0x9E, 0xFF,
+ 0xFF, 0xED, 0xED, 0xDD, 0xEE, 0xEF, 0xFE, 0xFF, 0xFD, 0xDF, 0xEE, 0xDD,
+ 0xDD, 0xDD, 0xDD, 0xDD, 0xEF, 0xFE, 0xFF, 0xED, 0xFE, 0xDD, 0xCC, 0xCB,
+ 0xBC, 0xCC, 0xDE, 0xEE, 0xEE, 0xFE, 0xDF, 0xDD, 0xCB, 0xBA, 0xAA, 0xAB,
+ 0xBC, 0xDD, 0xDF, 0xEF, 0xED, 0xED, 0xDB, 0xBA, 0x99, 0x88, 0x99, 0xAB,
+ 0xCD, 0xEF, 0xFD, 0xDE, 0xDC, 0xBA, 0x98, 0x77, 0x77, 0x89, 0xAB, 0xDD,
+ 0xFF, 0xDD, 0xED, 0xBA, 0x98, 0x76, 0x55, 0x67, 0x89, 0xBC, 0xDD, 0xFE,
+ 0xDE, 0xCB, 0xA9, 0x76, 0x54, 0x45, 0x67, 0x9A, 0xCD, 0xEF, 0xED, 0xED,
+ 0xCA, 0x87, 0x54, 0x33, 0x45, 0x78, 0xAB, 0xCE, 0xED, 0xDE, 0xDB, 0xA8,
+ 0x75, 0x43, 0x24, 0x57, 0x8A, 0xBC, 0xDE, 0xED, 0xED, 0xCA, 0x97, 0x65,
+ 0x44, 0x46, 0x78, 0xAC, 0xCD, 0xED, 0xDE, 0xDD, 0xBA, 0x87, 0x65, 0x56,
+ 0x68, 0x9A, 0xBD, 0xEF, 0xDD, 0xFE, 0xDC, 0xA9, 0x87, 0x77, 0x78, 0x8A,
+ 0xBC, 0xDE, 0xEE, 0xEF, 0xFD, 0xDB, 0xAA, 0x98, 0x88, 0x9A, 0xAB, 0xCD,
+ 0xFF, 0xDD, 0xFE, 0xED, 0xCB, 0xBA, 0xAA, 0xAA, 0xBB, 0xCD, 0xDF, 0xFE,
+ 0xDF, 0xFE, 0xED, 0xDC, 0xCB, 0xBB, 0xBC, 0xCC, 0xDE, 0xFF, 0xEE, 0xFF,
+ 0xFF, 0xFE, 0xDD, 0xCD, 0xDD, 0xDD, 0xEF, 0xEF, 0xFE, 0xFF, 0xFF, 0xFE,
+ 0xFE, 0xEE, 0xED, 0xEE, 0xEE, 0xFF, 0xFF, 0xEF, 0xFF, 0xFF, 0xFF, 0xEF,
+ 0xFE, 0xEF, 0xFE, 0xFF, 0xFF, 0xFE, 0xAD, 0xDD, 0xDD, 0xDD, 0xED, 0xDE,
+ 0xDE, 0xEE, 0xDD, 0xEE, 0xB0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xBD, 0xDC, 0xCB, 0xBB, 0xAA, 0xAB, 0xBB, 0xBC, 0xCD, 0xCD, 0xAD, 0xED,
+ 0xCC, 0xBB, 0xAA, 0xBA, 0xAB, 0xBC, 0xCD, 0xDF, 0xFD, 0xDD, 0xCC, 0xBB,
+ 0xAA, 0xA9, 0x9A, 0xAA, 0xBB, 0xCD, 0xEE, 0xDC, 0xDB, 0xBA, 0xA9, 0x99,
+ 0x99, 0x99, 0x9A, 0xAB, 0xCD, 0xDD, 0xBC, 0xBA, 0xA9, 0x88, 0x88, 0x88,
+ 0x89, 0x9A, 0xBB, 0xCD, 0xCB, 0xBA, 0xA9, 0x88, 0x77, 0x77, 0x77, 0x88,
+ 0x9A, 0xBB, 0xCC, 0xBB, 0xA9, 0x88, 0x77, 0x66, 0x66, 0x77, 0x89, 0x9A,
+ 0xBC, 0xCB, 0xBA, 0x98, 0x77, 0x66, 0x55, 0x66, 0x77, 0x89, 0xAB, 0xCC,
+ 0xBB, 0xA9, 0x87, 0x66, 0x55, 0x55, 0x66, 0x78, 0x9A, 0xAC, 0xCA, 0xA9,
+ 0x98, 0x76, 0x55, 0x44, 0x55, 0x67, 0x88, 0x9A, 0xBB, 0xAB, 0xA9, 0x87,
+ 0x65, 0x54, 0x45, 0x56, 0x78, 0x99, 0xAB, 0xBB, 0xBA, 0x98, 0x76, 0x65,
+ 0x55, 0x56, 0x67, 0x89, 0x9A, 0xBB, 0xBB, 0xA9, 0x87, 0x76, 0x65, 0x55,
+ 0x67, 0x78, 0x9A, 0xAC, 0xBB, 0xBA, 0x98, 0x87, 0x76, 0x66, 0x67, 0x78,
+ 0x89, 0xAB, 0xCC, 0xBC, 0xBA, 0x98, 0x87, 0x77, 0x77, 0x78, 0x89, 0x9A,
+ 0xBC, 0xCC, 0xCB, 0xAA, 0x99, 0x88, 0x88, 0x88, 0x89, 0x9A, 0xBB, 0xCC,
+ 0xCD, 0xCB, 0xAA, 0x99, 0x98, 0x99, 0x99, 0xAA, 0xBC, 0xCD, 0xCC, 0xDD,
+ 0xCB, 0xBA, 0xAA, 0x99, 0x9A, 0xAA, 0xBB, 0xCD, 0xDD, 0xCE, 0xDD, 0xCC,
+ 0xBB, 0xBA, 0xAA, 0xBB, 0xBC, 0xCD, 0xEE, 0xDD, 0xFD, 0xED, 0xCC, 0xCC,
+ 0xBC, 0xBC, 0xCC, 0xDD, 0xEE, 0xFE, 0x9D, 0xDD, 0xCC, 0xCC, 0xBB, 0xBB,
+ 0xBC, 0xCC, 0xDD, 0xEE, 0xB0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0x9B, 0xBA, 0xAA, 0xAA, 0x99, 0x99, 0xAA, 0xAA, 0xBB, 0xCC, 0x9B, 0xDC,
+ 0xBB, 0xAA, 0xAA, 0xAA, 0xAA, 0xAB, 0xBC, 0xCC, 0xDC, 0xBB, 0xBB, 0xAA,
+ 0x99, 0x99, 0x99, 0x9A, 0xAA, 0xBB, 0xCD, 0xCA, 0xBB, 0xA9, 0x99, 0x88,
+ 0x88, 0x88, 0x99, 0xAA, 0xBC, 0xDC, 0xAB, 0xA9, 0x98, 0x88, 0x77, 0x78,
+ 0x88, 0x89, 0xAA, 0xBC, 0xBA, 0xBA, 0x98, 0x87, 0x77, 0x77, 0x77, 0x78,
+ 0x99, 0xAB, 0xBB, 0x9A, 0x99, 0x87, 0x77, 0x66, 0x66, 0x77, 0x78, 0x9A,
+ 0xAB, 0xBA, 0xA9, 0x88, 0x77, 0x66, 0x66, 0x66, 0x77, 0x88, 0x9A, 0xBA,
+ 0x9A, 0x98, 0x77, 0x66, 0x65, 0x56, 0x66, 0x77, 0x89, 0xAB, 0xAA, 0xA9,
+ 0x87, 0x76, 0x65, 0x55, 0x56, 0x67, 0x78, 0x9A, 0xAA, 0x9A, 0x98, 0x77,
+ 0x66, 0x55, 0x45, 0x66, 0x77, 0x89, 0xAB, 0xA9, 0xA9, 0x87, 0x76, 0x66,
+ 0x55, 0x56, 0x67, 0x78, 0x9A, 0xAA, 0xAA, 0x98, 0x87, 0x76, 0x66, 0x66,
+ 0x66, 0x77, 0x89, 0xAB, 0xAA, 0xA9, 0x98, 0x77, 0x76, 0x66, 0x66, 0x77,
+ 0x89, 0x9A, 0xBA, 0xAB, 0xA9, 0x98, 0x77, 0x77, 0x77, 0x77, 0x88, 0x9A,
+ 0xAB, 0xBB, 0xBA, 0xA9, 0x88, 0x87, 0x77, 0x78, 0x88, 0x99, 0xAB, 0xBB,
+ 0xBB, 0xBA, 0xA9, 0x98, 0x88, 0x88, 0x88, 0x99, 0xAB, 0xBC, 0xBB, 0xCC,
+ 0xBA, 0xA9, 0x99, 0x99, 0x99, 0x99, 0xAA, 0xBC, 0xCC, 0xCC, 0xCC, 0xBB,
+ 0xAA, 0xAA, 0xAA, 0xAA, 0xAB, 0xBC, 0xCD, 0xCC, 0xDD, 0xDC, 0xCB, 0xBB,
+ 0xAA, 0xAB, 0xBB, 0xBC, 0xCC, 0xDD, 0x9C, 0xCB, 0xBB, 0xBA, 0xAA, 0xAA,
+ 0xAA, 0xBB, 0xBB, 0xCC, 0xA0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0x9B, 0xAA, 0xA9, 0x99, 0x99, 0x99, 0x99, 0xAA, 0xAB, 0xBC, 0xAB, 0xCB,
+ 0xBA, 0xAA, 0x99, 0x99, 0x99, 0xAA, 0xAB, 0xCC, 0xCC, 0xAB, 0xBA, 0xA9,
+ 0x99, 0x88, 0x89, 0x99, 0x9A, 0xAB, 0xBC, 0xBA, 0xBA, 0xA9, 0x98, 0x88,
+ 0x88, 0x88, 0x89, 0x9A, 0xAB, 0xCB, 0xAA, 0xA9, 0x98, 0x87, 0x77, 0x77,
+ 0x78, 0x89, 0x9A, 0xAB, 0xB9, 0xA9, 0x98, 0x87, 0x77, 0x77, 0x77, 0x78,
+ 0x89, 0x9A, 0xBA, 0x9A, 0x98, 0x87, 0x77, 0x66, 0x66, 0x67, 0x78, 0x89,
+ 0xAA, 0xA9, 0x99, 0x87, 0x77, 0x66, 0x66, 0x66, 0x77, 0x78, 0x99, 0xAA,
+ 0x99, 0x98, 0x77, 0x66, 0x66, 0x66, 0x66, 0x77, 0x88, 0x9A, 0xA9, 0x98,
+ 0x87, 0x76, 0x66, 0x55, 0x66, 0x67, 0x78, 0x89, 0xAA, 0x99, 0x88, 0x77,
+ 0x66, 0x65, 0x56, 0x66, 0x77, 0x88, 0x9A, 0xA9, 0x99, 0x87, 0x76, 0x66,
+ 0x66, 0x66, 0x67, 0x78, 0x89, 0xAA, 0x99, 0x98, 0x77, 0x66, 0x66, 0x66,
+ 0x66, 0x77, 0x89, 0x9A, 0xA9, 0xA9, 0x88, 0x77, 0x66, 0x66, 0x66, 0x77,
+ 0x88, 0x9A, 0xAA, 0xAA, 0x99, 0x88, 0x77, 0x77, 0x77, 0x77, 0x88, 0x99,
+ 0xAB, 0xAA, 0xBA, 0x99, 0x88, 0x77, 0x77, 0x77, 0x88, 0x89, 0xAA, 0xBA,
+ 0xAB, 0xAA, 0x99, 0x88, 0x88, 0x88, 0x88, 0x99, 0xAA, 0xBB, 0xBB, 0xBB,
+ 0xAA, 0x99, 0x98, 0x88, 0x89, 0x99, 0xAA, 0xBB, 0xCB, 0xBC, 0xCB, 0xAA,
+ 0xA9, 0x99, 0x99, 0x9A, 0xAA, 0xBB, 0xCC, 0xBC, 0xDC, 0xCB, 0xBA, 0xAA,
+ 0xAA, 0xAA, 0xAB, 0xBB, 0xCC, 0xDC, 0xAC, 0xBB, 0xBA, 0xAA, 0xAA, 0x9A,
+ 0xAA, 0xAA, 0xBB, 0xBC, 0xA0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0x9B, 0xBA, 0xA9, 0xA9, 0x99, 0x99, 0x99, 0xAA, 0xAB, 0xBB, 0x9B, 0xCC,
+ 0xBB, 0xAA, 0xA9, 0x99, 0xAA, 0xAA, 0xBB, 0xBC, 0xDC, 0xBC, 0xBA, 0xAA,
+ 0x99, 0x99, 0x99, 0x99, 0xAA, 0xAB, 0xCC, 0xBA, 0xBA, 0xA9, 0x99, 0x88,
+ 0x88, 0x88, 0x89, 0x9A, 0xAB, 0xCB, 0xAB, 0xA9, 0x98, 0x88, 0x77, 0x77,
+ 0x88, 0x89, 0x9A, 0xBB, 0xBA, 0xAA, 0x98, 0x87, 0x77, 0x77, 0x77, 0x78,
+ 0x89, 0x9A, 0xBA, 0x9A, 0x98, 0x87, 0x77, 0x66, 0x66, 0x77, 0x78, 0x89,
+ 0xAB, 0xA9, 0xA9, 0x88, 0x77, 0x66, 0x66, 0x66, 0x77, 0x88, 0x9A, 0xAA,
+ 0x9A, 0x98, 0x77, 0x66, 0x66, 0x56, 0x66, 0x77, 0x89, 0x9A, 0xA9, 0x99,
+ 0x87, 0x76, 0x65, 0x55, 0x56, 0x67, 0x78, 0x99, 0xAA, 0x99, 0x98, 0x77,
+ 0x66, 0x55, 0x55, 0x66, 0x77, 0x89, 0x9A, 0xA9, 0x99, 0x87, 0x76, 0x66,
+ 0x55, 0x66, 0x67, 0x78, 0x99, 0xAA, 0x9A, 0x98, 0x87, 0x76, 0x66, 0x66,
+ 0x67, 0x78, 0x89, 0xAA, 0xA9, 0xA9, 0x88, 0x77, 0x66, 0x66, 0x67, 0x77,
+ 0x88, 0x9A, 0xAA, 0xAA, 0xA9, 0x88, 0x77, 0x77, 0x77, 0x77, 0x88, 0x99,
+ 0xAB, 0xBA, 0xBA, 0x99, 0x88, 0x87, 0x77, 0x77, 0x88, 0x99, 0xAA, 0xBB,
+ 0xAB, 0xAA, 0x99, 0x88, 0x88, 0x88, 0x88, 0x99, 0xAA, 0xBB, 0xBB, 0xCB,
+ 0xBA, 0xA9, 0x99, 0x99, 0x99, 0x99, 0xAA, 0xBB, 0xCB, 0xBC, 0xCB, 0xAA,
+ 0xAA, 0x99, 0x99, 0xAA, 0xAA, 0xBB, 0xCC, 0xBB, 0xCC, 0xCB, 0xBB, 0xAA,
+ 0xAA, 0xAA, 0xAB, 0xBC, 0xCC, 0xDC, 0x9C, 0xBB, 0xBA, 0xAA, 0xAA, 0xAA,
+ 0xAA, 0xAA, 0xBB, 0xBC, 0xA0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xAD, 0xCC, 0xCC, 0xCC, 0xCB, 0xBB, 0xBC, 0xBC, 0xCC, 0xDC, 0x9D, 0xED,
+ 0xED, 0xCC, 0xCC, 0xCC, 0xCC, 0xCD, 0xDD, 0xEE, 0xED, 0xDF, 0xDD, 0xCC,
+ 0xBB, 0xBB, 0xBB, 0xBB, 0xCD, 0xDD, 0xEE, 0xDC, 0xDD, 0xCB, 0xBA, 0xAA,
+ 0xAA, 0xAA, 0xBB, 0xCC, 0xDE, 0xEC, 0xCC, 0xCB, 0xBA, 0x99, 0x99, 0x99,
+ 0x9A, 0xAB, 0xCC, 0xDE, 0xCC, 0xCC, 0xBA, 0x99, 0x88, 0x88, 0x88, 0x9A,
+ 0xAB, 0xCD, 0xDC, 0xCC, 0xBA, 0x99, 0x87, 0x77, 0x77, 0x88, 0x9A, 0xBB,
+ 0xCD, 0xCC, 0xCB, 0xA9, 0x87, 0x66, 0x56, 0x67, 0x88, 0xAA, 0xBC, 0xDC,
+ 0xBC, 0xBA, 0x98, 0x76, 0x54, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xCB, 0xCB,
+ 0xA9, 0x87, 0x54, 0x33, 0x45, 0x78, 0x9A, 0xBC, 0xDC, 0xBC, 0xBA, 0x98,
+ 0x76, 0x43, 0x34, 0x56, 0x89, 0xAB, 0xCD, 0xCC, 0xCB, 0xA9, 0x87, 0x65,
+ 0x44, 0x56, 0x78, 0x9A, 0xBC, 0xCC, 0xCD, 0xBA, 0x99, 0x87, 0x65, 0x56,
+ 0x67, 0x89, 0xAB, 0xCD, 0xCC, 0xCC, 0xBA, 0x98, 0x87, 0x76, 0x77, 0x88,
+ 0x9A, 0xBC, 0xDC, 0xCD, 0xCC, 0xAA, 0x98, 0x88, 0x88, 0x88, 0x9A, 0xBB,
+ 0xCD, 0xDC, 0xDC, 0xBB, 0xAA, 0x99, 0x99, 0x99, 0x9A, 0xAB, 0xCD, 0xDC,
+ 0xCE, 0xDD, 0xCB, 0xBA, 0xAA, 0xAA, 0xAA, 0xBB, 0xCD, 0xDE, 0xDD, 0xDD,
+ 0xDD, 0xCC, 0xBB, 0xBB, 0xBB, 0xBC, 0xCD, 0xDD, 0xED, 0xDF, 0xEE, 0xDD,
+ 0xDC, 0xCB, 0xCC, 0xCC, 0xCC, 0xEE, 0xEF, 0xDD, 0xEE, 0xEE, 0xED, 0xDD,
+ 0xCD, 0xCD, 0xDE, 0xEE, 0xEE, 0xFE, 0x9D, 0xCD, 0xCD, 0xCC, 0xCC, 0xCC,
+ 0xCC, 0xDD, 0xDD, 0xDE, 0xB0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xCF, 0xFF, 0xFE, 0xFF, 0xEE, 0xDE, 0xDE, 0xEF, 0xEE, 0xEE, 0xAF, 0xFF,
+ 0xFF, 0xFE, 0xEE, 0xED, 0xEF, 0xEF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE,
+ 0xDD, 0xCD, 0xCC, 0xDE, 0xEF, 0xFF, 0xFF, 0xEF, 0xFF, 0xEE, 0xDC, 0xBB,
+ 0xBB, 0xBB, 0xCD, 0xDE, 0xFF, 0xFF, 0xFF, 0xFD, 0xCB, 0xBA, 0x99, 0x9A,
+ 0xAB, 0xCD, 0xFE, 0xFF, 0xFF, 0xFE, 0xCB, 0xA9, 0x98, 0x88, 0x89, 0x9B,
+ 0xCD, 0xEF, 0xFE, 0xFF, 0xDC, 0xB9, 0x87, 0x76, 0x77, 0x78, 0xAB, 0xCD,
+ 0xEF, 0xFE, 0xED, 0xBA, 0x97, 0x66, 0x55, 0x67, 0x79, 0xAB, 0xDE, 0xFF,
+ 0xEF, 0xCB, 0x98, 0x76, 0x54, 0x45, 0x67, 0x89, 0xBC, 0xEF, 0xFE, 0xEC,
+ 0xB9, 0x86, 0x54, 0x33, 0x45, 0x68, 0x9B, 0xCE, 0xFF, 0xFE, 0xCB, 0x98,
+ 0x75, 0x43, 0x34, 0x56, 0x89, 0xBC, 0xEF, 0xFE, 0xED, 0xB9, 0x87, 0x65,
+ 0x44, 0x55, 0x78, 0x9B, 0xCE, 0xFF, 0xFF, 0xDB, 0xA9, 0x87, 0x65, 0x55,
+ 0x67, 0x8A, 0xBD, 0xFF, 0xFF, 0xED, 0xCB, 0x98, 0x87, 0x66, 0x77, 0x89,
+ 0xAC, 0xEF, 0xFF, 0xFF, 0xED, 0xCB, 0x99, 0x88, 0x88, 0x89, 0xAB, 0xCE,
+ 0xEF, 0xFE, 0xFF, 0xDD, 0xCB, 0xA9, 0x99, 0x9A, 0xAB, 0xCD, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xED, 0xCB, 0xBB, 0xBB, 0xBC, 0xDD, 0xEF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xEE, 0xDC, 0xCC, 0xCC, 0xDD, 0xFF, 0xFF, 0xFF, 0xEF, 0xFF, 0xFF,
+ 0xEE, 0xEE, 0xDE, 0xDE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xEF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x9F, 0xFF, 0xFF, 0xEE, 0xFE, 0xEF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xC0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xCE, 0xDD, 0xDD, 0xCC, 0xCC, 0xCC, 0xCC, 0xCD, 0xDD, 0xDD, 0x9E, 0xEE,
+ 0xDD, 0xCC, 0xCC, 0xBB, 0xBC, 0xCD, 0xDE, 0xFF, 0xFE, 0xEF, 0xDD, 0xCC,
+ 0xBA, 0xAA, 0xAA, 0xBB, 0xCC, 0xDE, 0xFF, 0xDD, 0xEC, 0xCB, 0xAA, 0x99,
+ 0x99, 0x9A, 0xAB, 0xCC, 0xDE, 0xED, 0xDD, 0xCB, 0xAA, 0x98, 0x88, 0x88,
+ 0x89, 0xAB, 0xBC, 0xDF, 0xEC, 0xDB, 0xA9, 0x98, 0x77, 0x77, 0x77, 0x89,
+ 0xAB, 0xCD, 0xED, 0xCC, 0xBA, 0x98, 0x77, 0x66, 0x66, 0x77, 0x89, 0xAB,
+ 0xCE, 0xEC, 0xCA, 0x98, 0x77, 0x65, 0x55, 0x66, 0x77, 0x8A, 0xBC, 0xDD,
+ 0xCC, 0xA9, 0x87, 0x65, 0x55, 0x55, 0x56, 0x78, 0x9A, 0xCD, 0xDC, 0xBA,
+ 0x98, 0x76, 0x55, 0x44, 0x55, 0x67, 0x89, 0xAC, 0xDD, 0xBB, 0xA9, 0x87,
+ 0x65, 0x54, 0x45, 0x56, 0x78, 0x9A, 0xBD, 0xDC, 0xCA, 0x98, 0x76, 0x55,
+ 0x55, 0x55, 0x67, 0x89, 0xAC, 0xDD, 0xCC, 0xBA, 0x88, 0x76, 0x55, 0x55,
+ 0x66, 0x78, 0x9B, 0xCD, 0xDC, 0xDB, 0xA9, 0x87, 0x76, 0x66, 0x66, 0x78,
+ 0x9A, 0xBC, 0xDD, 0xDD, 0xCB, 0xA9, 0x87, 0x77, 0x77, 0x78, 0x89, 0xBC,
+ 0xDE, 0xED, 0xED, 0xCA, 0xA9, 0x88, 0x88, 0x88, 0x99, 0xAB, 0xCD, 0xDD,
+ 0xDE, 0xDC, 0xCB, 0xA9, 0x99, 0x99, 0x9A, 0xAB, 0xCC, 0xDE, 0xFD, 0xFE,
+ 0xDC, 0xBB, 0xBB, 0xAA, 0xAA, 0xBC, 0xCC, 0xDE, 0xFE, 0xDF, 0xEE, 0xDD,
+ 0xDC, 0xCC, 0xCC, 0xCC, 0xCD, 0xEE, 0xFF, 0xED, 0xFE, 0xFE, 0xED, 0xDD,
+ 0xCD, 0xDD, 0xDE, 0xFE, 0xFF, 0xFF, 0xAE, 0xEE, 0xED, 0xDD, 0xDD, 0xDD,
+ 0xDD, 0xEE, 0xFE, 0xEF, 0xD0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xDE, 0xDD, 0xDC, 0xCC, 0xBB, 0xBB, 0xCC, 0xCD, 0xDE, 0xEE, 0xBE, 0xEE,
+ 0xDD, 0xCC, 0xBB, 0xBB, 0xBB, 0xCD, 0xDE, 0xEF, 0xFE, 0xDE, 0xDC, 0xCB,
+ 0xBA, 0xAA, 0xAA, 0xAB, 0xBC, 0xDD, 0xEF, 0xED, 0xDC, 0xCB, 0xAA, 0x99,
+ 0x99, 0x99, 0xAA, 0xBC, 0xDE, 0xEE, 0xDC, 0xCB, 0xA9, 0x98, 0x88, 0x88,
+ 0x89, 0x9A, 0xBC, 0xDE, 0xEC, 0xCB, 0xA9, 0x88, 0x77, 0x77, 0x77, 0x89,
+ 0x9A, 0xBC, 0xDD, 0xCC, 0xBA, 0x98, 0x76, 0x66, 0x66, 0x67, 0x89, 0xAB,
+ 0xCD, 0xDC, 0xBA, 0x98, 0x76, 0x65, 0x55, 0x56, 0x67, 0x89, 0xAB, 0xDD,
+ 0xCB, 0xA9, 0x87, 0x65, 0x55, 0x55, 0x56, 0x78, 0x9A, 0xBC, 0xDB, 0xBA,
+ 0x98, 0x76, 0x55, 0x55, 0x55, 0x67, 0x89, 0xAB, 0xDC, 0xCB, 0xA9, 0x87,
+ 0x65, 0x55, 0x45, 0x56, 0x78, 0x9A, 0xBC, 0xCC, 0xBA, 0x98, 0x76, 0x55,
+ 0x55, 0x55, 0x67, 0x89, 0xAB, 0xCD, 0xCC, 0xA9, 0x87, 0x66, 0x55, 0x55,
+ 0x66, 0x78, 0x9A, 0xBD, 0xDC, 0xCB, 0xA9, 0x87, 0x66, 0x66, 0x66, 0x78,
+ 0x99, 0xAC, 0xDD, 0xDC, 0xBA, 0x99, 0x87, 0x77, 0x77, 0x78, 0x89, 0xAB,
+ 0xCD, 0xDD, 0xDC, 0xBA, 0x99, 0x88, 0x88, 0x88, 0x99, 0xAB, 0xCD, 0xEE,
+ 0xDE, 0xDC, 0xBA, 0xA9, 0x99, 0x99, 0x99, 0xAB, 0xBC, 0xDE, 0xEE, 0xED,
+ 0xDC, 0xBB, 0xAA, 0xAA, 0xAA, 0xAB, 0xBC, 0xDE, 0xFE, 0xDF, 0xEE, 0xDC,
+ 0xCB, 0xBB, 0xBB, 0xBC, 0xCC, 0xDE, 0xFF, 0xFE, 0xFF, 0xEE, 0xED, 0xDC,
+ 0xCC, 0xCC, 0xDD, 0xEE, 0xFF, 0xFF, 0xBF, 0xEE, 0xDD, 0xDD, 0xDC, 0xDD,
+ 0xDD, 0xDE, 0xEF, 0xFF, 0xE0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xDF, 0xEE, 0xDD, 0xDD, 0xCC, 0xDD, 0xCD, 0xDE, 0xEF, 0xFE, 0xAF, 0xFF,
+ 0xFD, 0xDC, 0xCC, 0xCC, 0xCC, 0xED, 0xEE, 0xFF, 0xFF, 0xFF, 0xDD, 0xCC,
+ 0xBB, 0xAA, 0xBB, 0xBB, 0xCD, 0xEE, 0xFF, 0xFE, 0xED, 0xCB, 0xAA, 0xA9,
+ 0x99, 0x9A, 0xAB, 0xCD, 0xEE, 0xFE, 0xDD, 0xCB, 0xA9, 0x98, 0x88, 0x88,
+ 0x99, 0xAB, 0xCD, 0xEF, 0xED, 0xDC, 0xAA, 0x98, 0x77, 0x77, 0x77, 0x89,
+ 0xAB, 0xCD, 0xFD, 0xDD, 0xBA, 0x98, 0x77, 0x66, 0x66, 0x77, 0x89, 0xAB,
+ 0xCF, 0xEC, 0xCB, 0xA8, 0x77, 0x65, 0x55, 0x56, 0x77, 0x8A, 0xBC, 0xDE,
+ 0xCC, 0xA9, 0x87, 0x65, 0x55, 0x55, 0x56, 0x78, 0x9A, 0xCE, 0xDC, 0xCA,
+ 0x98, 0x76, 0x55, 0x44, 0x55, 0x67, 0x89, 0xAC, 0xDD, 0xCC, 0xA9, 0x87,
+ 0x65, 0x54, 0x45, 0x56, 0x78, 0x9A, 0xCD, 0xDC, 0xCA, 0x98, 0x76, 0x55,
+ 0x55, 0x55, 0x67, 0x89, 0xAC, 0xDD, 0xDC, 0xBA, 0x87, 0x76, 0x55, 0x55,
+ 0x66, 0x78, 0x9B, 0xCD, 0xDD, 0xDC, 0xA9, 0x87, 0x76, 0x66, 0x66, 0x78,
+ 0x9A, 0xBC, 0xDE, 0xDE, 0xCB, 0xA9, 0x87, 0x77, 0x77, 0x78, 0x99, 0xBB,
+ 0xCD, 0xED, 0xED, 0xCB, 0xA9, 0x98, 0x88, 0x88, 0x99, 0xAB, 0xCD, 0xEE,
+ 0xEE, 0xED, 0xCB, 0xAA, 0x99, 0x99, 0x9A, 0xAB, 0xCD, 0xEF, 0xED, 0xFF,
+ 0xDD, 0xCB, 0xBB, 0xAA, 0xAA, 0xBC, 0xCD, 0xDE, 0xFF, 0xEF, 0xFF, 0xFD,
+ 0xDC, 0xCB, 0xBC, 0xCC, 0xDD, 0xEF, 0xFF, 0xFE, 0xFF, 0xFF, 0xEE, 0xDD,
+ 0xDD, 0xDD, 0xDE, 0xFF, 0xFF, 0xFF, 0xAE, 0xEE, 0xED, 0xED, 0xDD, 0xDD,
+ 0xDE, 0xEE, 0xEF, 0xFF, 0xD0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xDF, 0xFF, 0xFF, 0xEE, 0xFE, 0xDE, 0xEE, 0xFF, 0xDE, 0xFF, 0x9F, 0xFF,
+ 0xFF, 0xFF, 0xDD, 0xDE, 0xEF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE,
+ 0xDC, 0xCC, 0xCC, 0xDD, 0xEF, 0xFF, 0xFF, 0xFF, 0xFF, 0xEC, 0xCB, 0xBA,
+ 0xAA, 0xAB, 0xCD, 0xEF, 0xFF, 0xFF, 0xFF, 0xFD, 0xCB, 0xA9, 0x99, 0x99,
+ 0x9A, 0xBC, 0xDF, 0xFF, 0xFF, 0xFD, 0xCB, 0xA9, 0x87, 0x77, 0x88, 0x9A,
+ 0xBD, 0xFF, 0xFF, 0xEF, 0xDB, 0xA9, 0x87, 0x66, 0x66, 0x78, 0x9A, 0xCD,
+ 0xFF, 0xFF, 0xFC, 0xB9, 0x87, 0x65, 0x55, 0x66, 0x78, 0x9B, 0xCE, 0xFF,
+ 0xEE, 0xCA, 0x98, 0x65, 0x54, 0x45, 0x56, 0x89, 0xAC, 0xDF, 0xFE, 0xDC,
+ 0xA9, 0x76, 0x54, 0x44, 0x45, 0x67, 0x9A, 0xCD, 0xFF, 0xED, 0xCA, 0x97,
+ 0x65, 0x44, 0x44, 0x56, 0x79, 0xAC, 0xDF, 0xFE, 0xDC, 0xA9, 0x86, 0x65,
+ 0x44, 0x55, 0x67, 0x9A, 0xCD, 0xFF, 0xEE, 0xCB, 0x98, 0x76, 0x55, 0x55,
+ 0x67, 0x89, 0xAC, 0xFF, 0xFF, 0xFD, 0xCA, 0x98, 0x76, 0x66, 0x67, 0x88,
+ 0xAB, 0xCE, 0xFF, 0xFF, 0xFC, 0xBA, 0x98, 0x87, 0x77, 0x89, 0x9B, 0xCD,
+ 0xFF, 0xFE, 0xFF, 0xDC, 0xBA, 0x99, 0x98, 0x99, 0xAB, 0xCD, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xED, 0xCB, 0xBA, 0xAA, 0xAB, 0xCD, 0xEF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xDD, 0xCC, 0xCC, 0xCC, 0xCE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFE, 0xED, 0xDD, 0xDF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xAF, 0xFF, 0xFF, 0xEE, 0xDE, 0xFE,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xD0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xBE, 0xEE, 0xDD, 0xDD, 0xCC, 0xCC, 0xDD, 0xDD, 0xDD, 0xED, 0x9F, 0xFF,
+ 0xFE, 0xDD, 0xDD, 0xCD, 0xDD, 0xEF, 0xEE, 0xFF, 0xFE, 0xEF, 0xED, 0xDC,
+ 0xCC, 0xBB, 0xBC, 0xCC, 0xDD, 0xEE, 0xFF, 0xEE, 0xEE, 0xDC, 0xBB, 0xAA,
+ 0xAA, 0xAB, 0xBC, 0xDD, 0xEF, 0xFE, 0xDD, 0xCC, 0xCA, 0xA9, 0x99, 0x99,
+ 0x9A, 0xBC, 0xCD, 0xEF, 0xDE, 0xDC, 0xBA, 0x99, 0x88, 0x88, 0x88, 0x9A,
+ 0xBC, 0xDE, 0xFE, 0xDE, 0xCB, 0xA9, 0x87, 0x77, 0x77, 0x78, 0x9A, 0xBC,
+ 0xDE, 0xED, 0xDC, 0xA9, 0x87, 0x66, 0x55, 0x67, 0x89, 0xAB, 0xCD, 0xEE,
+ 0xDD, 0xBA, 0x98, 0x76, 0x54, 0x45, 0x67, 0x89, 0xAC, 0xDF, 0xED, 0xDB,
+ 0xA9, 0x87, 0x54, 0x33, 0x45, 0x78, 0x9A, 0xCC, 0xFD, 0xDC, 0xCA, 0x98,
+ 0x75, 0x43, 0x34, 0x56, 0x89, 0xAB, 0xCE, 0xDD, 0xDC, 0xA9, 0x87, 0x65,
+ 0x44, 0x56, 0x78, 0x9A, 0xBD, 0xEE, 0xDD, 0xCA, 0xA9, 0x77, 0x65, 0x56,
+ 0x67, 0x89, 0xAC, 0xDE, 0xED, 0xED, 0xCA, 0x98, 0x77, 0x76, 0x77, 0x89,
+ 0xAB, 0xCD, 0xFE, 0xEE, 0xDC, 0xBA, 0x98, 0x88, 0x78, 0x89, 0x9A, 0xBC,
+ 0xDE, 0xED, 0xFE, 0xCC, 0xBA, 0xA9, 0x99, 0x99, 0xAA, 0xBC, 0xDE, 0xEE,
+ 0xEF, 0xFD, 0xDC, 0xBB, 0xAA, 0xAA, 0xAB, 0xBC, 0xDE, 0xFF, 0xEE, 0xFF,
+ 0xED, 0xDC, 0xCC, 0xBB, 0xBB, 0xCD, 0xDD, 0xEF, 0xFF, 0xEF, 0xFF, 0xFE,
+ 0xED, 0xDD, 0xDC, 0xDD, 0xDE, 0xFF, 0xFF, 0xFE, 0xFF, 0xFF, 0xFE, 0xEE,
+ 0xEE, 0xEE, 0xFF, 0xFF, 0xFF, 0xFF, 0x9E, 0xDE, 0xDD, 0xDE, 0xDD, 0xCD,
+ 0xDD, 0xFE, 0xEF, 0xFF, 0xB0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xAB, 0xBA, 0xAA, 0xA9, 0x99, 0x99, 0x9A, 0xAA, 0xBB, 0xCC, 0x8B, 0xCB,
+ 0xBB, 0xAA, 0xAA, 0xAA, 0xAA, 0xAB, 0xBC, 0xCD, 0xDC, 0xBC, 0xBB, 0xAA,
+ 0x99, 0x99, 0x99, 0x99, 0xAA, 0xBC, 0xCD, 0xCA, 0xBB, 0xA9, 0x99, 0x88,
+ 0x88, 0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xAB, 0xA9, 0x98, 0x88, 0x77, 0x77,
+ 0x88, 0x89, 0xAA, 0xBC, 0xBA, 0xAA, 0x98, 0x87, 0x77, 0x77, 0x77, 0x78,
+ 0x89, 0xAB, 0xCB, 0xAA, 0x99, 0x87, 0x77, 0x66, 0x66, 0x77, 0x78, 0x99,
+ 0xAB, 0xB9, 0xA9, 0x88, 0x77, 0x66, 0x66, 0x66, 0x77, 0x88, 0x9A, 0xBA,
+ 0x9A, 0x98, 0x77, 0x66, 0x65, 0x56, 0x66, 0x77, 0x89, 0xAB, 0xA9, 0xA9,
+ 0x87, 0x76, 0x65, 0x55, 0x56, 0x67, 0x78, 0x9A, 0xAA, 0x9A, 0x98, 0x77,
+ 0x66, 0x55, 0x55, 0x66, 0x77, 0x89, 0xAA, 0xA9, 0xA9, 0x87, 0x76, 0x65,
+ 0x55, 0x56, 0x67, 0x78, 0x9A, 0xBA, 0x9A, 0x98, 0x87, 0x76, 0x66, 0x66,
+ 0x66, 0x78, 0x89, 0xAB, 0xAA, 0xA9, 0x98, 0x77, 0x76, 0x66, 0x66, 0x77,
+ 0x88, 0x9A, 0xBA, 0xAB, 0xA9, 0x88, 0x77, 0x77, 0x77, 0x77, 0x88, 0x99,
+ 0xAB, 0xAA, 0xBA, 0xA9, 0x88, 0x87, 0x77, 0x78, 0x88, 0x99, 0xAA, 0xBB,
+ 0xBC, 0xBA, 0xA9, 0x98, 0x88, 0x88, 0x88, 0x99, 0xAA, 0xBC, 0xBB, 0xCB,
+ 0xBA, 0xA9, 0x99, 0x99, 0x99, 0x9A, 0xAA, 0xBC, 0xCB, 0xBD, 0xCB, 0xBB,
+ 0xAA, 0xAA, 0xAA, 0xAA, 0xAB, 0xBC, 0xCD, 0xCC, 0xDD, 0xCC, 0xBB, 0xBA,
+ 0xAA, 0xBB, 0xBB, 0xBB, 0xCC, 0xDC, 0x9C, 0xCC, 0xBB, 0xBA, 0xAA, 0xAA,
+ 0xAA, 0xBB, 0xBB, 0xCC, 0xB0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xAB, 0xAA, 0xA9, 0x99, 0x99, 0x99, 0x99, 0xAA, 0xAB, 0xBC, 0xAB, 0xCB,
+ 0xBA, 0xAA, 0xA9, 0x99, 0x99, 0xAA, 0xBB, 0xCC, 0xDC, 0xBB, 0xBA, 0xA9,
+ 0x99, 0x99, 0x99, 0x99, 0x9A, 0xAB, 0xCC, 0xCA, 0xBA, 0xA9, 0x98, 0x88,
+ 0x88, 0x88, 0x89, 0x9A, 0xAB, 0xCB, 0xAA, 0xA9, 0x98, 0x87, 0x77, 0x77,
+ 0x78, 0x89, 0x9A, 0xBB, 0xB9, 0xA9, 0x98, 0x87, 0x77, 0x77, 0x77, 0x78,
+ 0x89, 0x9A, 0xBB, 0x9A, 0x98, 0x87, 0x76, 0x66, 0x66, 0x67, 0x78, 0x89,
+ 0xAB, 0xA9, 0x99, 0x87, 0x77, 0x66, 0x66, 0x66, 0x67, 0x78, 0x9A, 0xAA,
+ 0x99, 0x98, 0x77, 0x66, 0x66, 0x66, 0x66, 0x77, 0x89, 0x9A, 0xA9, 0x99,
+ 0x87, 0x76, 0x66, 0x55, 0x56, 0x67, 0x78, 0x89, 0xAA, 0x99, 0x98, 0x77,
+ 0x66, 0x65, 0x56, 0x66, 0x77, 0x88, 0x9A, 0xA9, 0x99, 0x87, 0x76, 0x66,
+ 0x66, 0x66, 0x67, 0x78, 0x99, 0xAA, 0x9A, 0x98, 0x77, 0x66, 0x66, 0x66,
+ 0x66, 0x77, 0x89, 0xAA, 0xA9, 0xA9, 0x88, 0x77, 0x66, 0x66, 0x66, 0x77,
+ 0x88, 0x9A, 0xAA, 0xAA, 0x99, 0x88, 0x77, 0x77, 0x77, 0x77, 0x88, 0x99,
+ 0xAB, 0xAA, 0xBA, 0x99, 0x88, 0x77, 0x77, 0x77, 0x88, 0x99, 0xAA, 0xBA,
+ 0xAB, 0xAA, 0x99, 0x88, 0x88, 0x88, 0x88, 0x99, 0xAA, 0xBC, 0xBB, 0xCB,
+ 0xAA, 0x99, 0x99, 0x88, 0x99, 0x99, 0xAA, 0xBB, 0xCB, 0xBC, 0xCB, 0xBA,
+ 0xAA, 0x99, 0x99, 0xAA, 0xAA, 0xBB, 0xCC, 0xBC, 0xDC, 0xCB, 0xBB, 0xAA,
+ 0xAA, 0xAA, 0xAB, 0xBB, 0xCD, 0xDC, 0x9C, 0xCB, 0xBA, 0xAA, 0xAA, 0xAA,
+ 0xAA, 0xAA, 0xBB, 0xBC, 0xA0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xAC, 0xBB, 0xAA, 0xAA, 0x99, 0x99, 0xAA, 0xAA, 0xBC, 0xCC, 0x9C, 0xCC,
+ 0xBB, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xBB, 0xDD, 0xED, 0xBC, 0xBA, 0xAA,
+ 0x99, 0x99, 0x99, 0x99, 0xAA, 0xBB, 0xCD, 0xCB, 0xBB, 0xA9, 0x99, 0x88,
+ 0x88, 0x88, 0x99, 0xAA, 0xBC, 0xCB, 0xAB, 0xA9, 0x98, 0x88, 0x77, 0x77,
+ 0x88, 0x89, 0xAA, 0xBC, 0xBA, 0xBA, 0x98, 0x87, 0x77, 0x77, 0x77, 0x78,
+ 0x99, 0xAB, 0xBB, 0xAA, 0x99, 0x87, 0x76, 0x66, 0x66, 0x77, 0x78, 0x99,
+ 0xAB, 0xBA, 0xA9, 0x88, 0x76, 0x66, 0x66, 0x66, 0x77, 0x88, 0x9A, 0xBA,
+ 0x9A, 0x98, 0x77, 0x66, 0x55, 0x56, 0x66, 0x77, 0x89, 0xAA, 0xA9, 0x99,
+ 0x87, 0x76, 0x65, 0x55, 0x56, 0x67, 0x78, 0x9A, 0xAA, 0x99, 0x98, 0x77,
+ 0x66, 0x55, 0x55, 0x66, 0x77, 0x89, 0xAA, 0xAA, 0xA9, 0x87, 0x76, 0x66,
+ 0x55, 0x56, 0x67, 0x78, 0x9A, 0xAA, 0xAA, 0x98, 0x87, 0x76, 0x66, 0x66,
+ 0x66, 0x78, 0x89, 0xAB, 0xAA, 0xA9, 0x98, 0x77, 0x76, 0x66, 0x66, 0x77,
+ 0x88, 0x9A, 0xBB, 0xAB, 0xA9, 0x98, 0x77, 0x77, 0x77, 0x77, 0x88, 0x9A,
+ 0xAB, 0xBB, 0xBA, 0xA9, 0x88, 0x87, 0x77, 0x78, 0x88, 0x99, 0xAB, 0xCB,
+ 0xBC, 0xBA, 0xA9, 0x98, 0x88, 0x88, 0x89, 0x99, 0xAA, 0xBC, 0xBB, 0xCB,
+ 0xBA, 0xA9, 0x99, 0x99, 0x99, 0x99, 0xAB, 0xBC, 0xCC, 0xCD, 0xCB, 0xBA,
+ 0xAA, 0xAA, 0xAA, 0xAA, 0xAB, 0xBC, 0xCD, 0xCC, 0xED, 0xCC, 0xBB, 0xBB,
+ 0xBB, 0xAB, 0xBB, 0xBC, 0xDC, 0xDD, 0x9C, 0xCB, 0xBB, 0xBB, 0xAA, 0xAA,
+ 0xAA, 0xBB, 0xBC, 0xCD, 0xB0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xBC, 0xDC, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xCC, 0xCD, 0xDE, 0x9D, 0xED,
+ 0xCC, 0xBB, 0xBA, 0xAB, 0xBB, 0xBC, 0xDD, 0xEF, 0xFE, 0xDD, 0xCC, 0xBA,
+ 0xAA, 0xAA, 0x9A, 0xAA, 0xBC, 0xCD, 0xDF, 0xEC, 0xDC, 0xAA, 0x99, 0x99,
+ 0x89, 0x99, 0x9A, 0xBB, 0xCD, 0xDD, 0xCC, 0xBA, 0x99, 0x88, 0x88, 0x88,
+ 0x89, 0x9A, 0xBB, 0xCD, 0xDB, 0xBA, 0xA9, 0x88, 0x77, 0x77, 0x77, 0x89,
+ 0x9A, 0xBC, 0xDD, 0xBB, 0xA9, 0x88, 0x76, 0x66, 0x66, 0x77, 0x89, 0x9B,
+ 0xBC, 0xCB, 0xBA, 0x98, 0x76, 0x66, 0x55, 0x66, 0x77, 0x89, 0xAB, 0xCC,
+ 0xBB, 0x99, 0x87, 0x66, 0x55, 0x55, 0x66, 0x78, 0x9A, 0xBC, 0xDB, 0xA9,
+ 0x88, 0x76, 0x55, 0x44, 0x55, 0x67, 0x89, 0x9B, 0xCC, 0xBB, 0xA9, 0x87,
+ 0x66, 0x54, 0x45, 0x56, 0x77, 0x89, 0xAC, 0xCB, 0xBA, 0x98, 0x76, 0x65,
+ 0x55, 0x56, 0x67, 0x88, 0xAA, 0xCC, 0xBB, 0xA9, 0x87, 0x76, 0x65, 0x56,
+ 0x66, 0x78, 0x9A, 0xBC, 0xCB, 0xBB, 0x99, 0x87, 0x76, 0x66, 0x66, 0x77,
+ 0x89, 0xAB, 0xCC, 0xCC, 0xBA, 0x98, 0x87, 0x77, 0x77, 0x78, 0x89, 0xAA,
+ 0xBC, 0xDC, 0xDC, 0xAA, 0x99, 0x88, 0x88, 0x88, 0x89, 0x9A, 0xBB, 0xDD,
+ 0xCD, 0xCC, 0xBA, 0x99, 0x98, 0x89, 0x99, 0xAA, 0xBC, 0xCD, 0xCD, 0xED,
+ 0xCB, 0xBA, 0xAA, 0x99, 0x9A, 0xAA, 0xBC, 0xCD, 0xED, 0xDF, 0xED, 0xCC,
+ 0xBB, 0xBB, 0xAB, 0xBB, 0xBB, 0xCD, 0xDE, 0xED, 0xEE, 0xDD, 0xDC, 0xCC,
+ 0xBB, 0xCC, 0xCC, 0xDD, 0xEE, 0xEE, 0x9D, 0xCD, 0xCC, 0xCC, 0xCB, 0xBC,
+ 0xCC, 0xCC, 0xCD, 0xDD, 0xC0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFE, 0xFF, 0xFD, 0xDD, 0xDC, 0xED, 0xDD, 0xDD, 0x9F, 0xFF,
+ 0xFF, 0xFF, 0xFE, 0xEF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xFF, 0xFF, 0xFE,
+ 0xED, 0xDD, 0xCD, 0xDD, 0xEF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xCD, 0xBB,
+ 0xBB, 0xBC, 0xDD, 0xEF, 0xFF, 0xFE, 0xFF, 0xFF, 0xDC, 0xBA, 0xAA, 0xAA,
+ 0xAB, 0xCD, 0xDE, 0xFF, 0xEF, 0xFD, 0xDC, 0xBA, 0x98, 0x88, 0x89, 0xAB,
+ 0xCD, 0xEF, 0xFF, 0xFF, 0xED, 0xBA, 0x88, 0x77, 0x77, 0x89, 0xAB, 0xCD,
+ 0xFF, 0xFF, 0xFD, 0xCA, 0x98, 0x66, 0x55, 0x67, 0x89, 0xAC, 0xDF, 0xFF,
+ 0xEF, 0xCB, 0xA8, 0x75, 0x44, 0x45, 0x67, 0x8A, 0xBD, 0xFF, 0xFF, 0xFC,
+ 0xBA, 0x87, 0x54, 0x33, 0x45, 0x68, 0xAB, 0xDF, 0xFF, 0xFF, 0xDB, 0xA8,
+ 0x75, 0x43, 0x34, 0x56, 0x8A, 0xBD, 0xEF, 0xFF, 0xFD, 0xBA, 0x87, 0x65,
+ 0x44, 0x45, 0x78, 0xAB, 0xDF, 0xFF, 0xFF, 0xEC, 0xA9, 0x87, 0x65, 0x55,
+ 0x68, 0x9A, 0xCD, 0xFF, 0xFF, 0xFF, 0xCC, 0xA9, 0x87, 0x76, 0x77, 0x8A,
+ 0xBC, 0xFF, 0xFF, 0xFF, 0xFE, 0xCB, 0xA9, 0x98, 0x88, 0x9A, 0xBC, 0xDF,
+ 0xFF, 0xFF, 0xFF, 0xDE, 0xCB, 0xBA, 0xA9, 0xAA, 0xBC, 0xCD, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xDD, 0xDC, 0xBB, 0xBB, 0xCC, 0xDE, 0xFF, 0xFF, 0xFE, 0xFF,
+ 0xFF, 0xFE, 0xDD, 0xCC, 0xDC, 0xDF, 0xFF, 0xFF, 0xFF, 0xEF, 0xFF, 0xFF,
+ 0xFF, 0xED, 0xEF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x8D, 0xDD, 0xDD, 0xFE, 0xED, 0xDF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xD0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xCE, 0xDD, 0xDC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xDC, 0x9D, 0xEE,
+ 0xEE, 0xDC, 0xCC, 0xCC, 0xCC, 0xDD, 0xDE, 0xEE, 0xEE, 0xEE, 0xED, 0xDC,
+ 0xCB, 0xBB, 0xBB, 0xBC, 0xCD, 0xDE, 0xEF, 0xDD, 0xED, 0xCB, 0xBB, 0xAA,
+ 0xAA, 0xAA, 0xBB, 0xCC, 0xDE, 0xEE, 0xDD, 0xCB, 0xBA, 0x99, 0x99, 0x89,
+ 0x9A, 0xAB, 0xCD, 0xEE, 0xDC, 0xCC, 0xBA, 0x99, 0x88, 0x77, 0x88, 0x99,
+ 0xAB, 0xCD, 0xDD, 0xCD, 0xBA, 0x99, 0x87, 0x66, 0x66, 0x78, 0x9A, 0xBC,
+ 0xDD, 0xDC, 0xCB, 0xA9, 0x87, 0x66, 0x55, 0x66, 0x78, 0x9A, 0xBC, 0xDD,
+ 0xCC, 0xBA, 0x97, 0x66, 0x54, 0x45, 0x66, 0x79, 0xAB, 0xCD, 0xDC, 0xCB,
+ 0xA8, 0x76, 0x54, 0x44, 0x45, 0x67, 0x8A, 0xBC, 0xDD, 0xCC, 0xBA, 0x87,
+ 0x65, 0x44, 0x44, 0x56, 0x78, 0xAB, 0xCD, 0xDC, 0xCB, 0xA9, 0x87, 0x65,
+ 0x44, 0x55, 0x67, 0x8A, 0xBC, 0xDD, 0xCC, 0xBA, 0x98, 0x76, 0x65, 0x55,
+ 0x67, 0x89, 0xAB, 0xCD, 0xDC, 0xDC, 0xBA, 0x98, 0x76, 0x66, 0x67, 0x88,
+ 0x9A, 0xBD, 0xED, 0xCD, 0xCB, 0xA9, 0x98, 0x87, 0x77, 0x88, 0x9A, 0xBC,
+ 0xDE, 0xDC, 0xDD, 0xCB, 0xAA, 0x99, 0x98, 0x89, 0x9A, 0xBB, 0xCD, 0xEE,
+ 0xDE, 0xDD, 0xCB, 0xBA, 0xAA, 0xAA, 0xAA, 0xBC, 0xDD, 0xDF, 0xED, 0xED,
+ 0xDC, 0xCC, 0xBB, 0xBB, 0xBB, 0xBC, 0xCD, 0xFF, 0xFE, 0xCE, 0xFF, 0xDD,
+ 0xCC, 0xCC, 0xCC, 0xCD, 0xDD, 0xEF, 0xFF, 0xFD, 0xFE, 0xFF, 0xDE, 0xDD,
+ 0xDD, 0xDD, 0xDE, 0xEF, 0xFF, 0xFE, 0x9D, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD,
+ 0xDD, 0xEE, 0xEF, 0xEF, 0xD0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xCE, 0xDD, 0xCC, 0xCC, 0xBB, 0xBC, 0xCC, 0xCC, 0xDD, 0xDD, 0xAE, 0xFE,
+ 0xDD, 0xCC, 0xCB, 0xBB, 0xBC, 0xCC, 0xDE, 0xEF, 0xFE, 0xDE, 0xDD, 0xCB,
+ 0xBA, 0xAA, 0xAA, 0xBB, 0xCC, 0xDE, 0xEE, 0xED, 0xDD, 0xCB, 0xAA, 0x99,
+ 0x99, 0x99, 0xAB, 0xBC, 0xDE, 0xED, 0xCD, 0xCB, 0xA9, 0x98, 0x88, 0x88,
+ 0x89, 0xAA, 0xBC, 0xDE, 0xDC, 0xCB, 0xA9, 0x98, 0x77, 0x77, 0x77, 0x89,
+ 0xAB, 0xCC, 0xDD, 0xCC, 0xBA, 0x98, 0x77, 0x66, 0x66, 0x77, 0x89, 0xAB,
+ 0xCD, 0xDC, 0xCA, 0x98, 0x77, 0x66, 0x55, 0x56, 0x77, 0x89, 0xBC, 0xDD,
+ 0xCB, 0xA9, 0x87, 0x65, 0x55, 0x55, 0x56, 0x78, 0x9A, 0xBD, 0xDB, 0xBA,
+ 0x98, 0x76, 0x55, 0x44, 0x55, 0x67, 0x89, 0xAB, 0xDC, 0xBB, 0xA9, 0x87,
+ 0x65, 0x54, 0x45, 0x56, 0x78, 0x9A, 0xBC, 0xCC, 0xBA, 0x98, 0x76, 0x55,
+ 0x55, 0x55, 0x67, 0x89, 0xAB, 0xCD, 0xCC, 0xB9, 0x87, 0x76, 0x55, 0x55,
+ 0x67, 0x78, 0x9A, 0xBD, 0xCC, 0xCB, 0xA9, 0x87, 0x76, 0x66, 0x67, 0x78,
+ 0x9A, 0xBC, 0xDD, 0xCD, 0xCB, 0xA9, 0x87, 0x77, 0x77, 0x78, 0x99, 0xAB,
+ 0xCD, 0xDD, 0xDC, 0xBA, 0xA9, 0x88, 0x88, 0x88, 0x99, 0xAB, 0xCD, 0xED,
+ 0xDE, 0xDC, 0xBB, 0xA9, 0x99, 0x99, 0x9A, 0xAB, 0xCD, 0xDE, 0xED, 0xED,
+ 0xDC, 0xBB, 0xBA, 0xAA, 0xAA, 0xBB, 0xCC, 0xDE, 0xFE, 0xDF, 0xEE, 0xDD,
+ 0xCC, 0xBB, 0xBB, 0xBC, 0xCD, 0xDE, 0xFF, 0xED, 0xFF, 0xEE, 0xDD, 0xDD,
+ 0xCC, 0xDD, 0xDD, 0xEE, 0xFF, 0xFF, 0xAE, 0xDD, 0xDD, 0xDD, 0xDD, 0xCC,
+ 0xDD, 0xDD, 0xEE, 0xEF, 0xD0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xCE, 0xED, 0xDD, 0xDC, 0xCC, 0xCC, 0xCC, 0xDD, 0xDD, 0xDD, 0x9F, 0xFE,
+ 0xED, 0xDD, 0xCD, 0xDC, 0xCC, 0xDD, 0xDE, 0xEF, 0xFD, 0xEF, 0xDE, 0xCC,
+ 0xCB, 0xBB, 0xBB, 0xCC, 0xCD, 0xDE, 0xEF, 0xDD, 0xED, 0xDC, 0xBB, 0xAA,
+ 0xAA, 0xAA, 0xAB, 0xCD, 0xEF, 0xFD, 0xDD, 0xDB, 0xBA, 0x99, 0x98, 0x89,
+ 0x9A, 0xAB, 0xCD, 0xEE, 0xDD, 0xDC, 0xBA, 0x98, 0x87, 0x77, 0x78, 0x99,
+ 0xAB, 0xCD, 0xFD, 0xDD, 0xCB, 0x98, 0x77, 0x66, 0x66, 0x78, 0x9A, 0xBC,
+ 0xDD, 0xDC, 0xCB, 0xA9, 0x87, 0x65, 0x55, 0x56, 0x78, 0x9A, 0xBD, 0xDD,
+ 0xCC, 0xBA, 0x97, 0x65, 0x54, 0x55, 0x56, 0x79, 0xAB, 0xCD, 0xDC, 0xCB,
+ 0xA8, 0x76, 0x55, 0x44, 0x55, 0x67, 0x8A, 0xBC, 0xED, 0xCC, 0xBA, 0x87,
+ 0x65, 0x54, 0x44, 0x56, 0x78, 0xAB, 0xCD, 0xDC, 0xCB, 0xA9, 0x76, 0x55,
+ 0x44, 0x55, 0x67, 0x8A, 0xBC, 0xDC, 0xCD, 0xCA, 0x98, 0x76, 0x55, 0x55,
+ 0x67, 0x89, 0xAB, 0xCD, 0xDC, 0xDC, 0xBA, 0x98, 0x76, 0x66, 0x67, 0x88,
+ 0x9A, 0xCC, 0xDD, 0xDD, 0xCC, 0xAA, 0x98, 0x77, 0x77, 0x88, 0x9A, 0xBC,
+ 0xDD, 0xDC, 0xED, 0xCB, 0xA9, 0x99, 0x88, 0x89, 0x9A, 0xBC, 0xCE, 0xED,
+ 0xDF, 0xDC, 0xCB, 0xBA, 0xA9, 0xAA, 0xAA, 0xBC, 0xDD, 0xEF, 0xED, 0xEE,
+ 0xDD, 0xCC, 0xCC, 0xBB, 0xBB, 0xBC, 0xDD, 0xEE, 0xEE, 0xEF, 0xFE, 0xED,
+ 0xDC, 0xDC, 0xCC, 0xCD, 0xDD, 0xEF, 0xFF, 0xFE, 0xFF, 0xEE, 0xFD, 0xDD,
+ 0xDD, 0xDD, 0xED, 0xDF, 0xFF, 0xFF, 0x9D, 0xDD, 0xCD, 0xDD, 0xDD, 0xDD,
+ 0xDD, 0xDE, 0xDE, 0xEF, 0xD0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xDF, 0xFF, 0xFE, 0xFE, 0xDE, 0xCD, 0xDD, 0xED, 0xDD, 0xDE, 0x8F, 0xFF,
+ 0xFF, 0xEF, 0xED, 0xEE, 0xEE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE,
+ 0xDD, 0xDC, 0xDD, 0xDD, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xCC, 0xBB,
+ 0xBB, 0xBB, 0xCD, 0xDF, 0xFF, 0xFF, 0xFF, 0xFD, 0xCC, 0xBA, 0xA9, 0x9A,
+ 0xAB, 0xCD, 0xEF, 0xFF, 0xFF, 0xFE, 0xDC, 0xA9, 0x88, 0x88, 0x89, 0xAA,
+ 0xCD, 0xFF, 0xFF, 0xEF, 0xEC, 0xB9, 0x87, 0x76, 0x77, 0x88, 0xAB, 0xCE,
+ 0xFF, 0xFF, 0xFD, 0xBA, 0x97, 0x66, 0x55, 0x66, 0x89, 0xAC, 0xDF, 0xFF,
+ 0xEE, 0xDB, 0xA8, 0x76, 0x54, 0x45, 0x67, 0x8A, 0xBD, 0xFF, 0xFD, 0xDD,
+ 0xB9, 0x86, 0x54, 0x33, 0x45, 0x68, 0x9B, 0xCF, 0xFF, 0xEF, 0xCB, 0x98,
+ 0x65, 0x43, 0x34, 0x56, 0x89, 0xBC, 0xFF, 0xFD, 0xED, 0xBA, 0x87, 0x65,
+ 0x44, 0x55, 0x78, 0x9B, 0xDD, 0xFE, 0xEF, 0xDC, 0xA9, 0x87, 0x65, 0x55,
+ 0x67, 0x9A, 0xBD, 0xFF, 0xFF, 0xFD, 0xCB, 0xA8, 0x87, 0x66, 0x77, 0x89,
+ 0xBC, 0xDF, 0xFF, 0xFF, 0xDD, 0xBB, 0xA9, 0x88, 0x88, 0x89, 0xAB, 0xCF,
+ 0xFF, 0xFF, 0xFF, 0xEC, 0xCB, 0xAA, 0xA9, 0x9A, 0xBB, 0xDD, 0xFF, 0xFF,
+ 0xFF, 0xFD, 0xED, 0xCB, 0xBB, 0xBB, 0xCC, 0xCD, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xED, 0xDC, 0xCD, 0xCD, 0xDD, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xEF, 0xEE, 0xED, 0xEF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x9D, 0xDE, 0xEF, 0xFE, 0xED, 0xEF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xBC, 0xCC, 0xCB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xCC, 0xDD, 0x9D, 0xED,
+ 0xDC, 0xBB, 0xBB, 0xBB, 0xBB, 0xBC, 0xCD, 0xDF, 0xED, 0xDD, 0xDC, 0xBB,
+ 0xAA, 0xAA, 0xAA, 0xAA, 0xBB, 0xCD, 0xDF, 0xDC, 0xCC, 0xBB, 0xA9, 0x99,
+ 0x99, 0x99, 0xAA, 0xBB, 0xCD, 0xDD, 0xCC, 0xBA, 0xA9, 0x98, 0x88, 0x88,
+ 0x89, 0x9A, 0xBC, 0xCD, 0xDB, 0xCB, 0xA9, 0x88, 0x77, 0x77, 0x77, 0x88,
+ 0x9A, 0xBC, 0xCC, 0xBB, 0xAA, 0x98, 0x77, 0x66, 0x66, 0x77, 0x89, 0xAA,
+ 0xBC, 0xCB, 0xBA, 0x98, 0x77, 0x65, 0x55, 0x66, 0x77, 0x89, 0xAB, 0xCB,
+ 0xBB, 0xA9, 0x87, 0x65, 0x55, 0x55, 0x66, 0x78, 0x9A, 0xBC, 0xCB, 0xBA,
+ 0x98, 0x76, 0x55, 0x44, 0x55, 0x67, 0x89, 0xAB, 0xCC, 0xAA, 0xA9, 0x87,
+ 0x65, 0x54, 0x45, 0x56, 0x78, 0x9A, 0xBC, 0xCB, 0xBA, 0x98, 0x76, 0x65,
+ 0x55, 0x56, 0x67, 0x89, 0xAB, 0xCC, 0xBB, 0xA9, 0x87, 0x76, 0x65, 0x55,
+ 0x67, 0x78, 0x9A, 0xBC, 0xBB, 0xBA, 0xA9, 0x87, 0x76, 0x66, 0x66, 0x78,
+ 0x89, 0xAB, 0xCC, 0xBC, 0xBA, 0x99, 0x87, 0x77, 0x77, 0x78, 0x89, 0xAB,
+ 0xBC, 0xDC, 0xCB, 0xBA, 0x99, 0x88, 0x88, 0x88, 0x99, 0xAA, 0xBC, 0xCC,
+ 0xCD, 0xCB, 0xBA, 0x99, 0x98, 0x99, 0x9A, 0xAB, 0xBB, 0xDD, 0xCC, 0xDC,
+ 0xCC, 0xBB, 0xAA, 0xAA, 0xAA, 0xAB, 0xBC, 0xCD, 0xDE, 0xCD, 0xDD, 0xCC,
+ 0xBB, 0xBB, 0xBB, 0xBB, 0xBD, 0xDD, 0xEF, 0xDD, 0xED, 0xDD, 0xCC, 0xCC,
+ 0xBC, 0xCC, 0xCD, 0xDD, 0xEE, 0xFD, 0x8D, 0xCC, 0xCC, 0xBB, 0xBB, 0xBB,
+ 0xCB, 0xCC, 0xDD, 0xDE, 0xB0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xAB, 0xBA, 0xAA, 0xAA, 0x99, 0x99, 0x9A, 0xAA, 0xAB, 0xBB, 0x8B, 0xCC,
+ 0xBB, 0xBA, 0xAA, 0xAA, 0xAA, 0xAB, 0xBC, 0xCC, 0xDC, 0xBC, 0xBB, 0xAA,
+ 0xA9, 0x99, 0x99, 0x9A, 0xAA, 0xBB, 0xCD, 0xCA, 0xBB, 0xAA, 0x99, 0x98,
+ 0x88, 0x89, 0x99, 0xAA, 0xBB, 0xCB, 0xAB, 0xAA, 0x99, 0x88, 0x77, 0x78,
+ 0x88, 0x99, 0xAA, 0xBC, 0xBA, 0xBA, 0x99, 0x88, 0x77, 0x77, 0x77, 0x78,
+ 0x99, 0xAB, 0xBB, 0xAA, 0x99, 0x87, 0x76, 0x66, 0x66, 0x77, 0x78, 0x9A,
+ 0xAB, 0xBA, 0xA9, 0x88, 0x77, 0x66, 0x66, 0x66, 0x77, 0x89, 0x9A, 0xBA,
+ 0x9A, 0x98, 0x87, 0x66, 0x55, 0x55, 0x66, 0x78, 0x89, 0xAB, 0xA9, 0xA9,
+ 0x87, 0x76, 0x65, 0x55, 0x56, 0x67, 0x78, 0x9A, 0xBA, 0x9A, 0x98, 0x77,
+ 0x66, 0x55, 0x55, 0x66, 0x77, 0x89, 0xAB, 0xA9, 0xA9, 0x88, 0x76, 0x65,
+ 0x55, 0x56, 0x67, 0x78, 0x9A, 0xBA, 0x9A, 0x98, 0x87, 0x76, 0x65, 0x56,
+ 0x66, 0x78, 0x89, 0xAB, 0xAA, 0xAA, 0x98, 0x87, 0x76, 0x66, 0x66, 0x77,
+ 0x89, 0xAA, 0xBA, 0xAB, 0xA9, 0x98, 0x77, 0x77, 0x77, 0x77, 0x88, 0x9A,
+ 0xBB, 0xBA, 0xBA, 0xA9, 0x98, 0x88, 0x77, 0x88, 0x88, 0x9A, 0xAB, 0xCB,
+ 0xBB, 0xBA, 0xA9, 0x99, 0x88, 0x88, 0x89, 0x9A, 0xAB, 0xBC, 0xBB, 0xCB,
+ 0xBA, 0xAA, 0x99, 0x99, 0x99, 0x9A, 0xAB, 0xBC, 0xCC, 0xBC, 0xCB, 0xBB,
+ 0xAA, 0xAA, 0xAA, 0xAA, 0xBB, 0xCC, 0xCD, 0xCB, 0xDC, 0xCC, 0xBB, 0xBB,
+ 0xBB, 0xBB, 0xBB, 0xCC, 0xCD, 0xDC, 0x8C, 0xBB, 0xBA, 0xAB, 0xAA, 0xAA,
+ 0xAB, 0xBB, 0xBB, 0xCC, 0xB0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0x9B, 0xBA, 0xAA, 0x99, 0x99, 0x99, 0x99, 0xAA, 0xAB, 0xBB, 0x9B, 0xCB,
+ 0xBB, 0xAA, 0xAA, 0x9A, 0xAA, 0xAA, 0xBB, 0xCC, 0xDC, 0xBC, 0xBA, 0xA9,
+ 0x99, 0x99, 0x99, 0x99, 0xAA, 0xBB, 0xCC, 0xBA, 0xBA, 0xA9, 0x99, 0x88,
+ 0x88, 0x88, 0x99, 0x9A, 0xBB, 0xCB, 0xAA, 0xA9, 0x98, 0x88, 0x77, 0x77,
+ 0x88, 0x89, 0x9A, 0xBB, 0xBA, 0xA9, 0x98, 0x87, 0x77, 0x77, 0x77, 0x78,
+ 0x89, 0xAA, 0xBA, 0x9A, 0x99, 0x87, 0x77, 0x66, 0x66, 0x77, 0x78, 0x99,
+ 0xAB, 0xA9, 0xA9, 0x88, 0x77, 0x66, 0x66, 0x66, 0x77, 0x88, 0x9A, 0xAA,
+ 0x9A, 0x98, 0x77, 0x66, 0x65, 0x56, 0x66, 0x77, 0x89, 0xAA, 0xA9, 0x99,
+ 0x87, 0x76, 0x65, 0x55, 0x56, 0x67, 0x78, 0x99, 0xAA, 0x99, 0x98, 0x77,
+ 0x66, 0x55, 0x55, 0x66, 0x77, 0x89, 0x9A, 0xA9, 0xA9, 0x87, 0x76, 0x66,
+ 0x55, 0x66, 0x67, 0x78, 0x99, 0xAA, 0x9A, 0x98, 0x87, 0x76, 0x66, 0x66,
+ 0x66, 0x78, 0x89, 0xAA, 0xA9, 0xA9, 0x98, 0x77, 0x76, 0x66, 0x66, 0x77,
+ 0x89, 0x9A, 0xBA, 0xAA, 0xA9, 0x88, 0x77, 0x77, 0x77, 0x77, 0x88, 0x99,
+ 0xAB, 0xAA, 0xBA, 0x99, 0x88, 0x87, 0x77, 0x78, 0x88, 0x99, 0xAB, 0xBB,
+ 0xAB, 0xBA, 0x99, 0x98, 0x88, 0x88, 0x88, 0x99, 0xAA, 0xBC, 0xBB, 0xCB,
+ 0xBA, 0xA9, 0x99, 0x99, 0x99, 0x99, 0xAA, 0xBB, 0xCB, 0xBC, 0xCB, 0xBA,
+ 0xAA, 0xA9, 0x99, 0xAA, 0xAB, 0xBB, 0xCC, 0xCB, 0xDC, 0xCB, 0xBB, 0xAA,
+ 0xAA, 0xAA, 0xBB, 0xBC, 0xCD, 0xDC, 0x9B, 0xBB, 0xBA, 0xAA, 0xAA, 0xAA,
+ 0xAA, 0xAB, 0xBB, 0xBC, 0xA0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xAC, 0xBB, 0xBA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAB, 0xBB, 0xBC, 0x8C, 0xCC,
+ 0xBB, 0xBA, 0xAA, 0xAA, 0xAA, 0xAB, 0xBC, 0xCC, 0xDC, 0xBC, 0xBB, 0xAA,
+ 0xA9, 0x99, 0x99, 0xAA, 0xAB, 0xBC, 0xCD, 0xCB, 0xBB, 0xAA, 0x99, 0x88,
+ 0x88, 0x89, 0x99, 0xAA, 0xBC, 0xCB, 0xBB, 0xBA, 0x99, 0x88, 0x77, 0x78,
+ 0x88, 0x99, 0xAB, 0xBC, 0xBA, 0xBA, 0x99, 0x87, 0x77, 0x77, 0x77, 0x88,
+ 0x99, 0xAB, 0xCB, 0xAA, 0xA9, 0x87, 0x76, 0x66, 0x66, 0x67, 0x88, 0x9A,
+ 0xBC, 0xBA, 0xA9, 0x88, 0x76, 0x66, 0x56, 0x66, 0x77, 0x88, 0x9A, 0xBB,
+ 0xAA, 0x98, 0x87, 0x66, 0x55, 0x55, 0x66, 0x78, 0x89, 0xAB, 0xAA, 0xA9,
+ 0x87, 0x76, 0x55, 0x55, 0x56, 0x67, 0x78, 0x9A, 0xBA, 0xAA, 0x98, 0x77,
+ 0x65, 0x55, 0x55, 0x66, 0x77, 0x89, 0xAB, 0xAA, 0xA9, 0x88, 0x76, 0x65,
+ 0x55, 0x56, 0x67, 0x88, 0x9A, 0xBA, 0xAA, 0x99, 0x87, 0x76, 0x65, 0x66,
+ 0x67, 0x78, 0x99, 0xAB, 0xAA, 0xBA, 0x98, 0x87, 0x66, 0x66, 0x66, 0x77,
+ 0x89, 0xAA, 0xBB, 0xBB, 0xA9, 0x98, 0x87, 0x77, 0x77, 0x78, 0x88, 0x9A,
+ 0xBB, 0xBB, 0xBB, 0xA9, 0x98, 0x88, 0x77, 0x88, 0x89, 0x9A, 0xAB, 0xCB,
+ 0xBC, 0xBB, 0xA9, 0x99, 0x88, 0x88, 0x89, 0x9A, 0xAB, 0xCC, 0xBB, 0xCC,
+ 0xBB, 0xAA, 0xA9, 0x99, 0x99, 0xAA, 0xAB, 0xBC, 0xCC, 0xCD, 0xCC, 0xBB,
+ 0xAA, 0xAA, 0xAA, 0xAA, 0xBB, 0xCC, 0xDD, 0xCC, 0xDD, 0xCC, 0xCB, 0xBB,
+ 0xBB, 0xBB, 0xBB, 0xCC, 0xCE, 0xEC, 0x9C, 0xCB, 0xBB, 0xBA, 0xAA, 0xAA,
+ 0xAB, 0xBB, 0xBC, 0xCC, 0xB0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xBF, 0xDC, 0xCC, 0xCB, 0xBB, 0xBB, 0xBB, 0xCC, 0xCC, 0xCD, 0x7D, 0xFD,
+ 0xDD, 0xCC, 0xCB, 0xBB, 0xBC, 0xCC, 0xDD, 0xEF, 0xFD, 0xDE, 0xDC, 0xCB,
+ 0xBB, 0xAA, 0xAA, 0xBB, 0xCC, 0xCE, 0xEE, 0xDC, 0xDC, 0xCB, 0xAA, 0x99,
+ 0x99, 0x9A, 0xAB, 0xCC, 0xCD, 0xED, 0xCD, 0xCB, 0xA9, 0x99, 0x88, 0x88,
+ 0x99, 0xAB, 0xBC, 0xDE, 0xCC, 0xCB, 0xA9, 0x98, 0x77, 0x77, 0x78, 0x89,
+ 0xAA, 0xBD, 0xDD, 0xCC, 0xBA, 0x98, 0x77, 0x66, 0x66, 0x78, 0x89, 0xAB,
+ 0xCD, 0xCC, 0xCA, 0xA8, 0x77, 0x66, 0x55, 0x66, 0x78, 0x9A, 0xBC, 0xDC,
+ 0xBC, 0xA9, 0x87, 0x65, 0x54, 0x55, 0x66, 0x78, 0x9A, 0xBD, 0xCB, 0xBA,
+ 0x98, 0x76, 0x54, 0x44, 0x55, 0x67, 0x89, 0xAB, 0xCC, 0xBB, 0xA9, 0x87,
+ 0x65, 0x54, 0x44, 0x56, 0x78, 0x9A, 0xBC, 0xCC, 0xCA, 0x98, 0x76, 0x65,
+ 0x54, 0x56, 0x67, 0x89, 0xAC, 0xCC, 0xCC, 0xBA, 0x98, 0x76, 0x65, 0x56,
+ 0x67, 0x88, 0x9A, 0xBD, 0xDC, 0xCB, 0xA9, 0x88, 0x76, 0x66, 0x67, 0x78,
+ 0x9A, 0xBC, 0xDC, 0xCD, 0xBB, 0xA9, 0x88, 0x77, 0x77, 0x88, 0x99, 0xAB,
+ 0xCD, 0xDC, 0xDC, 0xBA, 0xA9, 0x98, 0x88, 0x88, 0x99, 0xAB, 0xCD, 0xFD,
+ 0xDD, 0xDC, 0xBB, 0xAA, 0x99, 0x99, 0x9A, 0xAB, 0xBC, 0xDD, 0xED, 0xED,
+ 0xDC, 0xCB, 0xBA, 0xAA, 0xAA, 0xBB, 0xCC, 0xDE, 0xEE, 0xDF, 0xEE, 0xDC,
+ 0xCC, 0xBB, 0xBB, 0xBC, 0xCD, 0xDE, 0xEF, 0xED, 0xEE, 0xFD, 0xDD, 0xCC,
+ 0xCC, 0xCC, 0xDD, 0xEE, 0xFF, 0xEE, 0x8D, 0xDC, 0xDC, 0xCC, 0xCC, 0xCC,
+ 0xCD, 0xDD, 0xDD, 0xEE, 0xC0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xCE, 0xEF, 0xFD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDC, 0xDD, 0x8F, 0xFF,
+ 0xFF, 0xFE, 0xFD, 0xDE, 0xFE, 0xFE, 0xEF, 0xFF, 0xFD, 0xFF, 0xFF, 0xEE,
+ 0xDC, 0xCD, 0xDC, 0xDD, 0xEE, 0xFF, 0xFF, 0xDF, 0xFF, 0xED, 0xDC, 0xCB,
+ 0xBB, 0xBC, 0xCD, 0xDE, 0xEF, 0xFE, 0xEF, 0xEE, 0xCC, 0xBA, 0xA9, 0x9A,
+ 0xAB, 0xCC, 0xDE, 0xFF, 0xEE, 0xFE, 0xDC, 0xBA, 0x98, 0x88, 0x89, 0x9B,
+ 0xCD, 0xDE, 0xFF, 0xDE, 0xDC, 0xBA, 0x97, 0x76, 0x77, 0x89, 0xAB, 0xCD,
+ 0xFF, 0xDD, 0xED, 0xBA, 0x97, 0x66, 0x55, 0x66, 0x89, 0xAC, 0xCD, 0xFE,
+ 0xDE, 0xDB, 0xA8, 0x76, 0x54, 0x45, 0x67, 0x8A, 0xBC, 0xEE, 0xED, 0xEC,
+ 0xB9, 0x86, 0x54, 0x33, 0x45, 0x68, 0x9B, 0xCE, 0xFE, 0xDD, 0xCB, 0xA8,
+ 0x75, 0x43, 0x34, 0x56, 0x8A, 0xBC, 0xEF, 0xEE, 0xEC, 0xBA, 0x87, 0x65,
+ 0x44, 0x46, 0x78, 0xAB, 0xCD, 0xFE, 0xED, 0xDB, 0xA9, 0x87, 0x65, 0x55,
+ 0x67, 0x9A, 0xBD, 0xDF, 0xFD, 0xED, 0xCB, 0xA9, 0x87, 0x66, 0x77, 0x8A,
+ 0xBC, 0xDE, 0xFF, 0xDE, 0xDD, 0xBA, 0xA9, 0x88, 0x88, 0x99, 0xAB, 0xDD,
+ 0xEF, 0xFD, 0xFE, 0xDC, 0xCB, 0xAA, 0x99, 0xAA, 0xBC, 0xCD, 0xFF, 0xFF,
+ 0xDF, 0xFE, 0xDD, 0xCC, 0xBB, 0xBB, 0xCC, 0xDD, 0xEF, 0xFF, 0xED, 0xFF,
+ 0xEE, 0xDD, 0xDC, 0xCC, 0xCD, 0xDD, 0xEF, 0xFF, 0xFF, 0xDF, 0xFE, 0xEE,
+ 0xEE, 0xED, 0xEE, 0xDF, 0xFE, 0xFF, 0xFF, 0xFC, 0xFF, 0xEF, 0xEF, 0xFE,
+ 0xEE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x8C, 0xCC, 0xDD, 0xDD, 0xDD, 0xDD,
+ 0xDE, 0xFF, 0xEF, 0xFF, 0xD0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xCE, 0xED, 0xDD, 0xCD, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xDD, 0x9E, 0xFE,
+ 0xED, 0xDD, 0xCC, 0xCC, 0xCC, 0xDD, 0xDE, 0xEF, 0xFD, 0xEF, 0xED, 0xDC,
+ 0xCB, 0xBB, 0xBB, 0xBB, 0xCC, 0xDD, 0xDF, 0xDD, 0xED, 0xCC, 0xBA, 0xAA,
+ 0xAA, 0xAA, 0xBB, 0xCC, 0xDE, 0xED, 0xDD, 0xDC, 0xBA, 0x99, 0x98, 0x89,
+ 0x9A, 0xAB, 0xCD, 0xDD, 0xDD, 0xDC, 0xBA, 0x98, 0x87, 0x77, 0x88, 0x99,
+ 0xAB, 0xCD, 0xED, 0xCC, 0xCA, 0x98, 0x87, 0x66, 0x67, 0x78, 0x9A, 0xAC,
+ 0xDD, 0xDC, 0xCB, 0xA9, 0x87, 0x66, 0x55, 0x66, 0x78, 0x9A, 0xBC, 0xDD,
+ 0xCC, 0xBA, 0x97, 0x65, 0x54, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xDC, 0xCB,
+ 0xA8, 0x76, 0x54, 0x44, 0x45, 0x67, 0x8A, 0xBC, 0xDD, 0xCC, 0xBA, 0x87,
+ 0x65, 0x44, 0x44, 0x56, 0x78, 0xAB, 0xCD, 0xDC, 0xCB, 0xA9, 0x87, 0x65,
+ 0x44, 0x55, 0x67, 0x9A, 0xBC, 0xDD, 0xCC, 0xBA, 0x98, 0x76, 0x65, 0x55,
+ 0x67, 0x89, 0xAB, 0xCD, 0xDC, 0xCC, 0xBA, 0x98, 0x77, 0x66, 0x67, 0x78,
+ 0x9B, 0xBC, 0xDD, 0xCC, 0xCB, 0xA9, 0x98, 0x87, 0x77, 0x88, 0x9A, 0xBC,
+ 0xDE, 0xDC, 0xEC, 0xCB, 0xAA, 0x99, 0x88, 0x99, 0x9A, 0xBC, 0xDD, 0xFE,
+ 0xCE, 0xDC, 0xCB, 0xBA, 0xAA, 0xAA, 0xAA, 0xBC, 0xCE, 0xEF, 0xFC, 0xED,
+ 0xDC, 0xCB, 0xBB, 0xBB, 0xBB, 0xCC, 0xDD, 0xEF, 0xFF, 0xDE, 0xED, 0xDD,
+ 0xCC, 0xCC, 0xCC, 0xCD, 0xDD, 0xEE, 0xFF, 0xFD, 0xFE, 0xEE, 0xED, 0xED,
+ 0xDD, 0xDD, 0xDF, 0xFF, 0xFF, 0xFF, 0x9D, 0xDD, 0xDC, 0xDC, 0xDD, 0xDD,
+ 0xDD, 0xEE, 0xEF, 0xEF, 0xD0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xCE, 0xDD, 0xDC, 0xCC, 0xBB, 0xBB, 0xBB, 0xCC, 0xCC, 0xDD, 0xAE, 0xEE,
+ 0xDD, 0xCC, 0xCB, 0xBB, 0xBB, 0xCC, 0xDD, 0xEE, 0xED, 0xDE, 0xDC, 0xCB,
+ 0xBA, 0xAA, 0xAA, 0xBB, 0xBC, 0xCD, 0xDE, 0xDD, 0xDC, 0xCB, 0xAA, 0x99,
+ 0x99, 0x99, 0xAA, 0xBC, 0xDD, 0xED, 0xCD, 0xCB, 0xA9, 0x98, 0x88, 0x88,
+ 0x99, 0xAA, 0xBC, 0xDD, 0xDC, 0xCB, 0xA9, 0x98, 0x77, 0x77, 0x78, 0x89,
+ 0xAB, 0xBC, 0xDD, 0xCC, 0xBA, 0x98, 0x77, 0x66, 0x66, 0x77, 0x89, 0xAB,
+ 0xCD, 0xCB, 0xCA, 0x98, 0x77, 0x65, 0x55, 0x66, 0x78, 0x9A, 0xAC, 0xDC,
+ 0xBB, 0xA9, 0x87, 0x65, 0x54, 0x55, 0x66, 0x78, 0x9A, 0xBC, 0xCB, 0xBA,
+ 0x98, 0x76, 0x55, 0x44, 0x55, 0x67, 0x89, 0xAB, 0xCC, 0xBB, 0xA9, 0x87,
+ 0x65, 0x54, 0x44, 0x56, 0x78, 0x9A, 0xBC, 0xCB, 0xBA, 0x98, 0x76, 0x65,
+ 0x55, 0x55, 0x67, 0x89, 0xAB, 0xCC, 0xBB, 0xBA, 0x98, 0x76, 0x65, 0x55,
+ 0x67, 0x78, 0x9A, 0xBD, 0xCC, 0xCB, 0xA9, 0x87, 0x76, 0x66, 0x67, 0x78,
+ 0x9A, 0xBC, 0xDD, 0xCC, 0xBA, 0xA9, 0x88, 0x77, 0x77, 0x78, 0x99, 0xAB,
+ 0xCD, 0xDC, 0xDC, 0xBA, 0xA9, 0x98, 0x88, 0x88, 0x99, 0xAB, 0xCD, 0xED,
+ 0xCD, 0xCC, 0xBA, 0xAA, 0x99, 0x99, 0x9A, 0xAB, 0xCC, 0xDE, 0xDC, 0xED,
+ 0xCC, 0xBB, 0xAA, 0xAA, 0xAA, 0xBB, 0xCC, 0xDE, 0xEE, 0xDE, 0xDD, 0xDC,
+ 0xCB, 0xBB, 0xBB, 0xBC, 0xCD, 0xDE, 0xFF, 0xFD, 0xEE, 0xED, 0xDD, 0xCC,
+ 0xCC, 0xCC, 0xDD, 0xEE, 0xFF, 0xFF, 0x9D, 0xDD, 0xDD, 0xCC, 0xCC, 0xCC,
+ 0xCD, 0xDE, 0xEE, 0xEF, 0xE0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xDE, 0xEE, 0xDD, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xDC, 0x9E, 0xFE,
+ 0xED, 0xDD, 0xCC, 0xCC, 0xCC, 0xDD, 0xDD, 0xEF, 0xFD, 0xDF, 0xED, 0xDC,
+ 0xCB, 0xBB, 0xBB, 0xBC, 0xCC, 0xDD, 0xDE, 0xDE, 0xED, 0xCC, 0xBB, 0xAA,
+ 0xAA, 0xAA, 0xBB, 0xCC, 0xCD, 0xED, 0xDE, 0xDC, 0xBA, 0x99, 0x99, 0x99,
+ 0x9A, 0xAB, 0xCC, 0xDE, 0xDC, 0xDC, 0xBA, 0x98, 0x87, 0x77, 0x88, 0x99,
+ 0xAB, 0xCD, 0xDD, 0xCD, 0xBA, 0xA8, 0x77, 0x66, 0x67, 0x78, 0x9A, 0xBB,
+ 0xDD, 0xCC, 0xCB, 0xA9, 0x87, 0x65, 0x55, 0x66, 0x78, 0x9A, 0xBC, 0xDC,
+ 0xCD, 0xBA, 0x97, 0x65, 0x54, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xCC, 0xCB,
+ 0xA8, 0x76, 0x54, 0x44, 0x45, 0x67, 0x9A, 0xBC, 0xDC, 0xCC, 0xBA, 0x97,
+ 0x65, 0x44, 0x44, 0x56, 0x78, 0xAB, 0xCD, 0xDC, 0xCB, 0xA9, 0x87, 0x65,
+ 0x44, 0x55, 0x67, 0x9A, 0xBC, 0xDD, 0xCC, 0xBA, 0x98, 0x76, 0x65, 0x55,
+ 0x67, 0x89, 0xAB, 0xCD, 0xDC, 0xCC, 0xBA, 0x98, 0x77, 0x66, 0x67, 0x88,
+ 0x9B, 0xCC, 0xED, 0xCD, 0xCB, 0xAA, 0x98, 0x87, 0x78, 0x89, 0x9A, 0xBC,
+ 0xDE, 0xDD, 0xDC, 0xCB, 0xAA, 0x99, 0x88, 0x99, 0xAA, 0xBC, 0xCD, 0xED,
+ 0xDE, 0xDC, 0xCB, 0xBA, 0xAA, 0xAA, 0xAA, 0xBC, 0xDD, 0xDE, 0xEC, 0xDD,
+ 0xDC, 0xCB, 0xBB, 0xBB, 0xBB, 0xCC, 0xDD, 0xEF, 0xFE, 0xDE, 0xEE, 0xDD,
+ 0xCC, 0xCC, 0xCC, 0xCC, 0xDD, 0xEE, 0xFF, 0xFD, 0xEE, 0xEE, 0xDD, 0xDC,
+ 0xDD, 0xDD, 0xDD, 0xEF, 0xFF, 0xFF, 0x9D, 0xDC, 0xDC, 0xCC, 0xCC, 0xCD,
+ 0xDD, 0xED, 0xEE, 0xEE, 0xD0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xDF, 0xFF, 0xEF, 0xED, 0xDD, 0xCD, 0xDC, 0xCC, 0xCD, 0xDD, 0x8F, 0xFF,
+ 0xFF, 0xFF, 0xEE, 0xDD, 0xDE, 0xEF, 0xEF, 0xFF, 0xFE, 0xFF, 0xFF, 0xEE,
+ 0xDD, 0xCC, 0xCC, 0xDD, 0xEE, 0xEF, 0xFF, 0xDF, 0xFF, 0xED, 0xCC, 0xBB,
+ 0xBB, 0xBB, 0xCD, 0xDE, 0xFF, 0xFE, 0xEF, 0xFD, 0xCB, 0xAA, 0x99, 0x9A,
+ 0xAB, 0xBC, 0xDE, 0xFF, 0xEE, 0xFD, 0xCB, 0xA9, 0x98, 0x88, 0x89, 0x9B,
+ 0xCC, 0xEE, 0xFD, 0xEF, 0xDB, 0xA9, 0x87, 0x76, 0x67, 0x88, 0x9B, 0xCD,
+ 0xFF, 0xFD, 0xDD, 0xBA, 0x97, 0x66, 0x55, 0x66, 0x89, 0xAB, 0xDE, 0xFF,
+ 0xDD, 0xCB, 0x98, 0x76, 0x54, 0x45, 0x67, 0x8A, 0xBC, 0xDF, 0xFE, 0xEC,
+ 0xA9, 0x86, 0x54, 0x33, 0x45, 0x68, 0x9B, 0xCD, 0xFE, 0xDD, 0xCB, 0x98,
+ 0x65, 0x43, 0x34, 0x56, 0x89, 0xBC, 0xDF, 0xED, 0xDC, 0xBA, 0x87, 0x65,
+ 0x44, 0x56, 0x78, 0xAB, 0xCD, 0xEE, 0xDE, 0xCB, 0xA9, 0x76, 0x65, 0x56,
+ 0x67, 0x8A, 0xBD, 0xDF, 0xFD, 0xFD, 0xCB, 0x98, 0x87, 0x66, 0x77, 0x89,
+ 0xAC, 0xEF, 0xFF, 0xDF, 0xDD, 0xBB, 0xA9, 0x88, 0x88, 0x99, 0xAB, 0xCE,
+ 0xFF, 0xFD, 0xEF, 0xDD, 0xCB, 0xAA, 0x99, 0x9A, 0xBB, 0xCD, 0xEF, 0xFF,
+ 0xEF, 0xFE, 0xDD, 0xCC, 0xBB, 0xBB, 0xBC, 0xCD, 0xEF, 0xFF, 0xFE, 0xFF,
+ 0xDE, 0xDD, 0xCC, 0xCC, 0xCC, 0xDE, 0xEF, 0xFF, 0xFF, 0xDF, 0xFF, 0xFF,
+ 0xEE, 0xED, 0xEE, 0xEF, 0xFF, 0xFF, 0xFF, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFE, 0xEF, 0xFF, 0xFF, 0xFF, 0x9D, 0xDD, 0xDD, 0xEE, 0xDD, 0xDF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xE0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xBD, 0xCC, 0xCB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xCC, 0xCC, 0x8D, 0xEE,
+ 0xCC, 0xCC, 0xBB, 0xBB, 0xBB, 0xCC, 0xCD, 0xEF, 0xED, 0xCD, 0xDC, 0xCB,
+ 0xAA, 0xAA, 0xAA, 0xAB, 0xBC, 0xCD, 0xDD, 0xCC, 0xDC, 0xBB, 0xAA, 0x99,
+ 0x99, 0x99, 0xAA, 0xBC, 0xCC, 0xED, 0xCD, 0xCB, 0xA9, 0x98, 0x88, 0x88,
+ 0x89, 0x9A, 0xBC, 0xCD, 0xCC, 0xCB, 0xA9, 0x88, 0x77, 0x77, 0x78, 0x89,
+ 0x9A, 0xBC, 0xDC, 0xBB, 0xBA, 0x98, 0x77, 0x66, 0x66, 0x77, 0x89, 0xAB,
+ 0xBC, 0xCB, 0xBA, 0x98, 0x77, 0x65, 0x55, 0x66, 0x78, 0x89, 0xAB, 0xDC,
+ 0xBB, 0xA9, 0x87, 0x66, 0x55, 0x55, 0x66, 0x78, 0x9A, 0xBC, 0xCB, 0xBA,
+ 0x98, 0x76, 0x55, 0x44, 0x55, 0x67, 0x89, 0xAB, 0xCC, 0xBB, 0xA9, 0x87,
+ 0x65, 0x54, 0x44, 0x56, 0x78, 0x9A, 0xBC, 0xBB, 0xBA, 0x98, 0x76, 0x65,
+ 0x55, 0x55, 0x67, 0x89, 0xAB, 0xCC, 0xBB, 0xA9, 0x88, 0x76, 0x65, 0x55,
+ 0x66, 0x78, 0x9A, 0xBC, 0xCB, 0xCB, 0xA9, 0x87, 0x76, 0x66, 0x67, 0x78,
+ 0x9A, 0xAB, 0xCC, 0xBC, 0xBA, 0xA9, 0x88, 0x77, 0x77, 0x78, 0x99, 0xAB,
+ 0xCD, 0xCC, 0xCC, 0xBA, 0x99, 0x98, 0x88, 0x88, 0x99, 0xAB, 0xBC, 0xDC,
+ 0xCD, 0xCC, 0xBA, 0xA9, 0x99, 0x99, 0x99, 0xAA, 0xCC, 0xDD, 0xDC, 0xED,
+ 0xCC, 0xBB, 0xAA, 0xAA, 0xAA, 0xAB, 0xBC, 0xDD, 0xED, 0xCE, 0xED, 0xCC,
+ 0xBB, 0xBB, 0xBB, 0xBB, 0xCC, 0xCD, 0xEE, 0xDC, 0xEE, 0xED, 0xDC, 0xCC,
+ 0xCC, 0xCC, 0xCC, 0xDD, 0xEE, 0xFE, 0x7C, 0xCC, 0xCC, 0xCB, 0xCB, 0xBB,
+ 0xCC, 0xCC, 0xDE, 0xDE, 0xC0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xAC, 0xBB, 0xBA, 0xAA, 0xAA, 0x9A, 0xAA, 0xAA, 0xAB, 0xBB, 0x8C, 0xDC,
+ 0xCB, 0xBB, 0xAA, 0xAA, 0xAA, 0xBB, 0xBB, 0xCC, 0xDC, 0xBC, 0xCB, 0xBA,
+ 0xA9, 0x99, 0x99, 0xAA, 0xAB, 0xBC, 0xCD, 0xBB, 0xBB, 0xAA, 0x99, 0x99,
+ 0x88, 0x99, 0x9A, 0xAB, 0xBC, 0xCB, 0xAB, 0xAA, 0x99, 0x88, 0x88, 0x88,
+ 0x88, 0x9A, 0xAB, 0xBC, 0xBA, 0xBA, 0x99, 0x88, 0x77, 0x77, 0x77, 0x88,
+ 0x9A, 0xAB, 0xCB, 0xAA, 0xA9, 0x88, 0x76, 0x66, 0x66, 0x77, 0x89, 0x9A,
+ 0xBB, 0xBA, 0xAA, 0x98, 0x76, 0x66, 0x56, 0x66, 0x77, 0x89, 0xAA, 0xBB,
+ 0xAA, 0x98, 0x87, 0x66, 0x55, 0x55, 0x66, 0x78, 0x99, 0xAB, 0xAA, 0xA9,
+ 0x98, 0x76, 0x55, 0x45, 0x56, 0x67, 0x88, 0x9A, 0xBA, 0xAA, 0x98, 0x87,
+ 0x66, 0x54, 0x45, 0x56, 0x78, 0x89, 0xAB, 0xAA, 0xA9, 0x98, 0x76, 0x65,
+ 0x55, 0x56, 0x67, 0x88, 0x9A, 0xBA, 0xAA, 0xA9, 0x87, 0x76, 0x66, 0x56,
+ 0x66, 0x78, 0x99, 0xAB, 0xAA, 0xBA, 0x99, 0x87, 0x76, 0x66, 0x67, 0x78,
+ 0x89, 0xAA, 0xBB, 0xAB, 0xAA, 0x98, 0x87, 0x77, 0x77, 0x78, 0x89, 0x9A,
+ 0xBC, 0xBA, 0xBB, 0xA9, 0x98, 0x88, 0x88, 0x88, 0x89, 0x9A, 0xBB, 0xCB,
+ 0xBC, 0xBA, 0xAA, 0x99, 0x98, 0x89, 0x99, 0x9A, 0xAB, 0xCC, 0xBB, 0xCB,
+ 0xBB, 0xAA, 0xA9, 0x99, 0x99, 0xAA, 0xAB, 0xCC, 0xDC, 0xBD, 0xCC, 0xBB,
+ 0xAA, 0xAA, 0xAA, 0xAB, 0xBB, 0xCC, 0xDD, 0xCB, 0xDD, 0xCC, 0xCB, 0xBB,
+ 0xBB, 0xBB, 0xBC, 0xCC, 0xDE, 0xED, 0x8B, 0xBB, 0xBB, 0xBA, 0xAA, 0xAA,
+ 0xBB, 0xBB, 0xBC, 0xCC, 0xA0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0x9B, 0xBA, 0xAA, 0x99, 0x99, 0x99, 0x99, 0xAA, 0xAA, 0xBB, 0x9B, 0xCB,
+ 0xBB, 0xAA, 0xAA, 0x9A, 0xAA, 0xAA, 0xBB, 0xBC, 0xDB, 0xBB, 0xBA, 0xA9,
+ 0x99, 0x99, 0x99, 0x99, 0xAA, 0xBB, 0xCC, 0xBA, 0xBA, 0xA9, 0x98, 0x88,
+ 0x88, 0x88, 0x99, 0xAA, 0xBB, 0xCB, 0xAB, 0xA9, 0x98, 0x88, 0x77, 0x78,
+ 0x88, 0x99, 0xAA, 0xBB, 0xAA, 0xAA, 0x98, 0x87, 0x77, 0x77, 0x77, 0x88,
+ 0x99, 0xAA, 0xBA, 0x9A, 0x98, 0x87, 0x76, 0x66, 0x66, 0x77, 0x88, 0x99,
+ 0xAB, 0xA9, 0xA9, 0x88, 0x77, 0x66, 0x66, 0x66, 0x77, 0x88, 0x9A, 0xBA,
+ 0x9A, 0x98, 0x77, 0x66, 0x55, 0x56, 0x66, 0x78, 0x89, 0xAA, 0xA9, 0xA9,
+ 0x87, 0x76, 0x65, 0x55, 0x56, 0x67, 0x78, 0x9A, 0xAA, 0x99, 0x98, 0x77,
+ 0x66, 0x55, 0x55, 0x66, 0x77, 0x89, 0x9A, 0xA9, 0xA9, 0x88, 0x76, 0x66,
+ 0x55, 0x56, 0x67, 0x78, 0x9A, 0xAA, 0x9A, 0x98, 0x87, 0x76, 0x66, 0x66,
+ 0x66, 0x78, 0x89, 0xAA, 0xA9, 0xA9, 0x98, 0x87, 0x76, 0x66, 0x66, 0x77,
+ 0x88, 0x9A, 0xBA, 0xAA, 0xA9, 0x98, 0x87, 0x77, 0x77, 0x77, 0x88, 0x99,
+ 0xAB, 0xAA, 0xBA, 0xA9, 0x98, 0x88, 0x77, 0x78, 0x88, 0x99, 0xAA, 0xBA,
+ 0xAB, 0xBA, 0xA9, 0x98, 0x88, 0x88, 0x88, 0x99, 0xAA, 0xBC, 0xBA, 0xCB,
+ 0xAA, 0xA9, 0x99, 0x99, 0x99, 0x9A, 0xAA, 0xBB, 0xCB, 0xBC, 0xCB, 0xBA,
+ 0xAA, 0xAA, 0x99, 0xAA, 0xAA, 0xBB, 0xCC, 0xCB, 0xCC, 0xCB, 0xBB, 0xBA,
+ 0xAA, 0xAA, 0xBB, 0xBC, 0xCC, 0xDC, 0x9B, 0xBB, 0xAA, 0xAA, 0xAA, 0xAA,
+ 0xAA, 0xAA, 0xBB, 0xBC, 0xA0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xAB, 0xBB, 0xAA, 0xAA, 0x99, 0x99, 0xAA, 0xAA, 0xBB, 0xBB, 0x8B, 0xCC,
+ 0xBB, 0xBA, 0xAA, 0xAA, 0xAA, 0xAB, 0xBB, 0xCC, 0xDB, 0xBC, 0xBB, 0xAA,
+ 0xA9, 0x99, 0x99, 0x9A, 0xAA, 0xBB, 0xCC, 0xBB, 0xBB, 0xAA, 0x99, 0x88,
+ 0x88, 0x89, 0x99, 0xAA, 0xBC, 0xCB, 0xAB, 0xAA, 0x98, 0x88, 0x87, 0x88,
+ 0x88, 0x99, 0xAB, 0xBC, 0xBA, 0xBA, 0x98, 0x87, 0x77, 0x77, 0x77, 0x88,
+ 0x99, 0xAB, 0xBA, 0xAA, 0xA9, 0x87, 0x76, 0x66, 0x66, 0x77, 0x88, 0x9A,
+ 0xAB, 0xAA, 0xA9, 0x98, 0x76, 0x66, 0x56, 0x66, 0x77, 0x89, 0x9A, 0xBA,
+ 0x9A, 0x98, 0x87, 0x66, 0x55, 0x55, 0x66, 0x78, 0x99, 0xAB, 0xA9, 0xA9,
+ 0x87, 0x76, 0x55, 0x55, 0x56, 0x67, 0x88, 0x9A, 0xBA, 0x9A, 0x98, 0x87,
+ 0x66, 0x55, 0x55, 0x56, 0x77, 0x89, 0xAB, 0xA9, 0xA9, 0x88, 0x76, 0x65,
+ 0x55, 0x56, 0x67, 0x88, 0x9A, 0xBA, 0xAA, 0x99, 0x87, 0x76, 0x66, 0x56,
+ 0x66, 0x78, 0x89, 0xAB, 0xAA, 0xBA, 0x98, 0x87, 0x76, 0x66, 0x66, 0x77,
+ 0x89, 0xAA, 0xBA, 0xAB, 0xA9, 0x98, 0x87, 0x77, 0x77, 0x77, 0x88, 0x9A,
+ 0xBB, 0xBA, 0xBA, 0xA9, 0x98, 0x88, 0x88, 0x88, 0x88, 0x9A, 0xAB, 0xCB,
+ 0xAC, 0xBA, 0xA9, 0x99, 0x88, 0x88, 0x99, 0x9A, 0xAB, 0xBC, 0xBB, 0xCB,
+ 0xBA, 0xAA, 0x99, 0x99, 0x99, 0xAA, 0xAB, 0xBC, 0xCB, 0xBC, 0xCB, 0xBB,
+ 0xAA, 0xAA, 0xAA, 0xAA, 0xBB, 0xBC, 0xCD, 0xCB, 0xDD, 0xCC, 0xBB, 0xBB,
+ 0xBB, 0xBB, 0xBB, 0xCC, 0xDC, 0xDC, 0x8B, 0xBB, 0xAA, 0xAA, 0xAA, 0xAA,
+ 0xAA, 0xBB, 0xBB, 0xCC, 0xA0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xBD, 0xCC, 0xCC, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xCC, 0x7D, 0xFE,
+ 0xDC, 0xCB, 0xBB, 0xBB, 0xBB, 0xBC, 0xCD, 0xEE, 0xED, 0xDD, 0xDC, 0xBB,
+ 0xBA, 0xAA, 0xAA, 0xAB, 0xBC, 0xCD, 0xDE, 0xDC, 0xDC, 0xCB, 0xA9, 0x99,
+ 0x99, 0x99, 0xAA, 0xBB, 0xCD, 0xED, 0xCD, 0xBA, 0xA9, 0x98, 0x88, 0x88,
+ 0x89, 0x9A, 0xAC, 0xCD, 0xCC, 0xBB, 0xA9, 0x88, 0x77, 0x77, 0x77, 0x89,
+ 0x9A, 0xBC, 0xDD, 0xBC, 0xA9, 0x98, 0x77, 0x66, 0x66, 0x77, 0x89, 0xAB,
+ 0xCC, 0xCB, 0xBA, 0x98, 0x77, 0x65, 0x55, 0x66, 0x78, 0x89, 0xAB, 0xCC,
+ 0xBB, 0xA9, 0x87, 0x65, 0x54, 0x55, 0x66, 0x78, 0x9A, 0xBC, 0xCB, 0xBA,
+ 0x98, 0x76, 0x55, 0x44, 0x55, 0x67, 0x89, 0xAB, 0xCC, 0xBB, 0xA9, 0x87,
+ 0x65, 0x54, 0x45, 0x56, 0x78, 0x9A, 0xBC, 0xCB, 0xBA, 0x98, 0x76, 0x65,
+ 0x55, 0x56, 0x67, 0x89, 0xAB, 0xCC, 0xBB, 0xA9, 0x88, 0x76, 0x65, 0x55,
+ 0x67, 0x78, 0x9A, 0xBC, 0xCB, 0xCB, 0xA9, 0x87, 0x76, 0x66, 0x67, 0x78,
+ 0x99, 0xBB, 0xCC, 0xCC, 0xBA, 0x99, 0x88, 0x77, 0x77, 0x78, 0x89, 0xAB,
+ 0xCC, 0xCC, 0xDC, 0xBA, 0x99, 0x88, 0x88, 0x88, 0x99, 0xAB, 0xBC, 0xDD,
+ 0xCC, 0xCC, 0xBA, 0xA9, 0x99, 0x99, 0x9A, 0xAB, 0xBC, 0xDE, 0xDC, 0xDD,
+ 0xCC, 0xBB, 0xBA, 0xAA, 0xAA, 0xAB, 0xCC, 0xDE, 0xED, 0xDE, 0xDD, 0xCC,
+ 0xCB, 0xBB, 0xBB, 0xBB, 0xCC, 0xDD, 0xEF, 0xED, 0xED, 0xEE, 0xEC, 0xCC,
+ 0xCC, 0xCC, 0xDD, 0xDE, 0xFF, 0xFE, 0x8D, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC,
+ 0xCC, 0xCC, 0xDD, 0xEF, 0xD0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xDF, 0xFF, 0xFF, 0xED, 0xDC, 0xDD, 0xDD, 0xCD, 0xCC, 0xCC, 0x8F, 0xFF,
+ 0xFF, 0xEE, 0xEE, 0xED, 0xEE, 0xEF, 0xFF, 0xFF, 0xFD, 0xFF, 0xFF, 0xFE,
+ 0xDD, 0xDD, 0xCD, 0xCD, 0xEE, 0xEF, 0xEF, 0xEE, 0xFF, 0xED, 0xDD, 0xCB,
+ 0xBB, 0xBC, 0xCD, 0xDD, 0xEF, 0xFD, 0xEF, 0xDE, 0xDC, 0xBA, 0xAA, 0xAA,
+ 0xAB, 0xCD, 0xDE, 0xFF, 0xDE, 0xFE, 0xDC, 0xA9, 0x98, 0x88, 0x99, 0xAB,
+ 0xCC, 0xEF, 0xFD, 0xEF, 0xDC, 0xB9, 0x87, 0x77, 0x77, 0x89, 0xAB, 0xCD,
+ 0xEF, 0xEE, 0xDD, 0xCA, 0x98, 0x66, 0x55, 0x67, 0x89, 0xAC, 0xDE, 0xFE,
+ 0xED, 0xDB, 0xA8, 0x76, 0x44, 0x45, 0x67, 0x8A, 0xBD, 0xEF, 0xDD, 0xED,
+ 0xBA, 0x87, 0x54, 0x33, 0x45, 0x78, 0xAB, 0xCE, 0xFE, 0xDE, 0xCB, 0xA8,
+ 0x75, 0x43, 0x34, 0x56, 0x89, 0xBC, 0xEF, 0xED, 0xED, 0xCA, 0x87, 0x65,
+ 0x44, 0x45, 0x78, 0xAB, 0xCE, 0xEE, 0xDD, 0xDC, 0xA9, 0x87, 0x65, 0x55,
+ 0x68, 0x9A, 0xCD, 0xDF, 0xFD, 0xFD, 0xCB, 0xA9, 0x87, 0x76, 0x77, 0x89,
+ 0xBC, 0xDE, 0xEF, 0xCE, 0xDC, 0xCB, 0xA9, 0x98, 0x88, 0x99, 0xBB, 0xDD,
+ 0xFF, 0xED, 0xEF, 0xEC, 0xCB, 0xAA, 0xA9, 0xAA, 0xBB, 0xDD, 0xEF, 0xFF,
+ 0xCD, 0xED, 0xDC, 0xCC, 0xBB, 0xBB, 0xBC, 0xDD, 0xFF, 0xFF, 0xFC, 0xFE,
+ 0xDD, 0xDD, 0xDC, 0xCD, 0xCD, 0xDD, 0xFF, 0xFF, 0xFF, 0xCE, 0xDE, 0xED,
+ 0xDD, 0xEE, 0xDE, 0xEE, 0xEF, 0xFF, 0xFF, 0xFC, 0xFE, 0xFE, 0xDE, 0xEE,
+ 0xDE, 0xFF, 0xEF, 0xFF, 0xFF, 0xFF, 0x7C, 0xCC, 0xCC, 0xCD, 0xDD, 0xDE,
+ 0xEE, 0xDE, 0xFF, 0xFF, 0xC0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xCE, 0xDD, 0xDD, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0x9E, 0xFE,
+ 0xED, 0xDC, 0xCC, 0xCC, 0xCC, 0xCD, 0xDE, 0xEE, 0xFD, 0xDF, 0xED, 0xCC,
+ 0xCB, 0xBB, 0xBB, 0xBC, 0xCC, 0xDD, 0xEE, 0xDD, 0xED, 0xDC, 0xBA, 0xAA,
+ 0xAA, 0xAA, 0xBB, 0xCC, 0xDE, 0xED, 0xDD, 0xDC, 0xBA, 0x99, 0x98, 0x99,
+ 0x9A, 0xAB, 0xCD, 0xDE, 0xDC, 0xDC, 0xBA, 0x98, 0x87, 0x77, 0x88, 0x99,
+ 0xAB, 0xCD, 0xED, 0xCC, 0xCB, 0x99, 0x87, 0x66, 0x67, 0x78, 0x9A, 0xBC,
+ 0xCD, 0xDC, 0xCB, 0xA9, 0x87, 0x65, 0x55, 0x66, 0x78, 0x9A, 0xBC, 0xDD,
+ 0xCC, 0xBA, 0x97, 0x65, 0x54, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xDC, 0xCB,
+ 0xA9, 0x76, 0x54, 0x44, 0x45, 0x67, 0x9A, 0xBC, 0xDD, 0xCC, 0xBA, 0x97,
+ 0x65, 0x44, 0x44, 0x56, 0x79, 0xAB, 0xCD, 0xCC, 0xCB, 0xA9, 0x87, 0x65,
+ 0x44, 0x55, 0x67, 0x9A, 0xBC, 0xDC, 0xCC, 0xBA, 0x98, 0x76, 0x65, 0x55,
+ 0x67, 0x89, 0xAB, 0xCD, 0xDC, 0xCC, 0xBA, 0x98, 0x77, 0x66, 0x67, 0x88,
+ 0x9A, 0xCD, 0xED, 0xCD, 0xCB, 0xA9, 0x98, 0x87, 0x77, 0x88, 0x9A, 0xBC,
+ 0xDE, 0xDC, 0xDC, 0xCB, 0xAA, 0x99, 0x98, 0x99, 0x9A, 0xBC, 0xDE, 0xED,
+ 0xCD, 0xDC, 0xCB, 0xBA, 0xAA, 0xAA, 0xAB, 0xBC, 0xCD, 0xEF, 0xDC, 0xED,
+ 0xDC, 0xCC, 0xBB, 0xBB, 0xBB, 0xCC, 0xCD, 0xDE, 0xFE, 0xCE, 0xED, 0xDD,
+ 0xDC, 0xCC, 0xCC, 0xCD, 0xDD, 0xEE, 0xFF, 0xEC, 0xFE, 0xEE, 0xED, 0xDD,
+ 0xDD, 0xDD, 0xEE, 0xEE, 0xFF, 0xFF, 0x8D, 0xDD, 0xDC, 0xDD, 0xDD, 0xDD,
+ 0xDD, 0xDD, 0xEE, 0xEE, 0xD0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xCD, 0xDD, 0xCC, 0xCB, 0xBB, 0xBB, 0xBB, 0xBC, 0xCC, 0xCC, 0xAE, 0xEE,
+ 0xDD, 0xCC, 0xBB, 0xBB, 0xBB, 0xCC, 0xCD, 0xDE, 0xED, 0xDE, 0xDC, 0xCB,
+ 0xBA, 0xAA, 0xAA, 0xAB, 0xBC, 0xCD, 0xDE, 0xDD, 0xDC, 0xCB, 0xAA, 0x99,
+ 0x99, 0x99, 0xAA, 0xBC, 0xCD, 0xDD, 0xCD, 0xCB, 0xA9, 0x98, 0x88, 0x88,
+ 0x89, 0x9A, 0xBC, 0xCD, 0xCC, 0xCB, 0xA9, 0x88, 0x77, 0x77, 0x77, 0x89,
+ 0x9A, 0xBC, 0xDC, 0xCC, 0xBA, 0x98, 0x76, 0x66, 0x66, 0x77, 0x89, 0xAB,
+ 0xCD, 0xCB, 0xBA, 0x98, 0x76, 0x65, 0x55, 0x66, 0x78, 0x89, 0xAB, 0xCC,
+ 0xBB, 0xA9, 0x87, 0x65, 0x55, 0x55, 0x66, 0x78, 0x9A, 0xBC, 0xCB, 0xBA,
+ 0x98, 0x76, 0x55, 0x44, 0x55, 0x67, 0x89, 0xAB, 0xCC, 0xBB, 0xA9, 0x87,
+ 0x65, 0x54, 0x45, 0x56, 0x78, 0x9A, 0xBC, 0xCB, 0xBA, 0x98, 0x76, 0x65,
+ 0x55, 0x55, 0x67, 0x89, 0xAB, 0xCC, 0xBB, 0xA9, 0x88, 0x76, 0x65, 0x55,
+ 0x66, 0x78, 0x9A, 0xBC, 0xCB, 0xCB, 0xA9, 0x87, 0x76, 0x66, 0x66, 0x78,
+ 0x9A, 0xBC, 0xDD, 0xCC, 0xBA, 0x99, 0x87, 0x77, 0x77, 0x78, 0x89, 0xAB,
+ 0xCD, 0xDC, 0xCC, 0xBA, 0x99, 0x88, 0x88, 0x88, 0x99, 0xAB, 0xCD, 0xED,
+ 0xCD, 0xCB, 0xBA, 0xA9, 0x99, 0x99, 0x9A, 0xAB, 0xCC, 0xDE, 0xDC, 0xDD,
+ 0xCC, 0xBB, 0xAA, 0xAA, 0xAA, 0xBB, 0xCC, 0xDE, 0xFE, 0xCE, 0xDD, 0xCC,
+ 0xCB, 0xBB, 0xBB, 0xBC, 0xCD, 0xDE, 0xFF, 0xED, 0xEE, 0xDD, 0xDC, 0xCC,
+ 0xCC, 0xCC, 0xDD, 0xEE, 0xEF, 0xFE, 0xAD, 0xDC, 0xCC, 0xCC, 0xCC, 0xCC,
+ 0xCC, 0xDD, 0xEE, 0xEF, 0xD0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xCE, 0xDD, 0xDD, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCD, 0x9E, 0xFF,
+ 0xED, 0xDD, 0xCC, 0xCC, 0xCC, 0xDD, 0xDD, 0xDE, 0xFD, 0xEE, 0xED, 0xCC,
+ 0xCB, 0xBB, 0xBB, 0xBB, 0xCD, 0xDD, 0xEE, 0xDD, 0xED, 0xCC, 0xBA, 0xAA,
+ 0xAA, 0xAA, 0xBB, 0xBC, 0xDD, 0xED, 0xDD, 0xCC, 0xBA, 0x99, 0x98, 0x99,
+ 0x9A, 0xAB, 0xCD, 0xDE, 0xDD, 0xDC, 0xBA, 0x98, 0x87, 0x77, 0x88, 0x9A,
+ 0xAB, 0xCD, 0xDD, 0xCD, 0xCB, 0x98, 0x87, 0x66, 0x67, 0x78, 0x9A, 0xBB,
+ 0xCD, 0xDC, 0xCB, 0xA9, 0x87, 0x65, 0x55, 0x66, 0x78, 0x9A, 0xBC, 0xDC,
+ 0xCC, 0xBA, 0x98, 0x65, 0x54, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xCC, 0xCB,
+ 0xA8, 0x76, 0x54, 0x44, 0x45, 0x67, 0x9A, 0xBC, 0xDC, 0xCC, 0xBA, 0x97,
+ 0x65, 0x44, 0x44, 0x56, 0x78, 0xAB, 0xCD, 0xCC, 0xCB, 0xA9, 0x87, 0x65,
+ 0x44, 0x55, 0x67, 0x9A, 0xBC, 0xDD, 0xCC, 0xBA, 0x98, 0x76, 0x65, 0x55,
+ 0x67, 0x89, 0xAB, 0xCD, 0xDC, 0xDB, 0xBA, 0x98, 0x77, 0x66, 0x67, 0x88,
+ 0x9A, 0xCD, 0xED, 0xCD, 0xCB, 0xA9, 0x98, 0x87, 0x77, 0x88, 0x9A, 0xBC,
+ 0xDE, 0xDC, 0xDC, 0xCB, 0xAA, 0x99, 0x99, 0x99, 0x9A, 0xBC, 0xCD, 0xED,
+ 0xCE, 0xDC, 0xBB, 0xBA, 0xAA, 0xAA, 0xAA, 0xBC, 0xCD, 0xEF, 0xEC, 0xED,
+ 0xDC, 0xCB, 0xBB, 0xBB, 0xBB, 0xBC, 0xCD, 0xEE, 0xFE, 0xCE, 0xED, 0xDD,
+ 0xCC, 0xCC, 0xCC, 0xCC, 0xDD, 0xEF, 0xFF, 0xFD, 0xEE, 0xEE, 0xDD, 0xDD,
+ 0xDD, 0xDD, 0xDE, 0xEF, 0xEF, 0xFF, 0x9C, 0xCD, 0xDC, 0xDC, 0xCC, 0xCD,
+ 0xDD, 0xDD, 0xEE, 0xFE, 0xD0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xCF, 0xFE, 0xED, 0xED, 0xDC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0x7E, 0xFF,
+ 0xFF, 0xFE, 0xEE, 0xDD, 0xDD, 0xDE, 0xEE, 0xEF, 0xFD, 0xDF, 0xFE, 0xFE,
+ 0xDC, 0xCC, 0xCC, 0xCC, 0xDD, 0xEE, 0xEF, 0xDE, 0xFE, 0xEE, 0xCC, 0xBB,
+ 0xBB, 0xBB, 0xCC, 0xCD, 0xEF, 0xFD, 0xEF, 0xED, 0xCB, 0xBA, 0xA9, 0x9A,
+ 0xAB, 0xBC, 0xDD, 0xEE, 0xDE, 0xED, 0xCB, 0xA9, 0x98, 0x88, 0x89, 0xAA,
+ 0xCC, 0xDE, 0xED, 0xDE, 0xDB, 0xB9, 0x87, 0x76, 0x77, 0x89, 0xAB, 0xCD,
+ 0xEF, 0xDE, 0xDC, 0xBA, 0x97, 0x66, 0x55, 0x67, 0x89, 0xAC, 0xCE, 0xFD,
+ 0xDD, 0xCB, 0xA8, 0x75, 0x54, 0x45, 0x67, 0x8A, 0xBD, 0xDF, 0xED, 0xEC,
+ 0xB9, 0x87, 0x54, 0x33, 0x45, 0x78, 0xAB, 0xCD, 0xED, 0xDD, 0xCB, 0xA8,
+ 0x75, 0x43, 0x34, 0x56, 0x89, 0xBC, 0xEF, 0xED, 0xDC, 0xBA, 0x87, 0x65,
+ 0x44, 0x46, 0x78, 0xAB, 0xCD, 0xED, 0xDD, 0xDB, 0xA9, 0x87, 0x65, 0x55,
+ 0x67, 0x9A, 0xBC, 0xEF, 0xDD, 0xED, 0xCB, 0xA9, 0x87, 0x76, 0x77, 0x89,
+ 0xBC, 0xDE, 0xFE, 0xDF, 0xDC, 0xCB, 0xA9, 0x88, 0x88, 0x99, 0xAB, 0xCD,
+ 0xFF, 0xED, 0xEE, 0xDD, 0xBB, 0xAA, 0x99, 0xAA, 0xAB, 0xCD, 0xEF, 0xFF,
+ 0xDE, 0xED, 0xCC, 0xCB, 0xBB, 0xBB, 0xBC, 0xDD, 0xEF, 0xFF, 0xFE, 0xFF,
+ 0xED, 0xDD, 0xCC, 0xCC, 0xCD, 0xDE, 0xFE, 0xFF, 0xFF, 0xDF, 0xFE, 0xEE,
+ 0xDE, 0xDE, 0xDE, 0xEE, 0xFF, 0xFF, 0xFF, 0xFD, 0xFF, 0xEF, 0xEE, 0xFE,
+ 0xEE, 0xEF, 0xFF, 0xFF, 0xFF, 0xFF, 0x8C, 0xDD, 0xDC, 0xDE, 0xDE, 0xED,
+ 0xED, 0xFF, 0xEE, 0xFF, 0xD0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xCF, 0xEE, 0xDD, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xDD, 0x8E, 0xFF,
+ 0xED, 0xDC, 0xCC, 0xCC, 0xCC, 0xDD, 0xDE, 0xEF, 0xFE, 0xEF, 0xED, 0xCC,
+ 0xBB, 0xBB, 0xBB, 0xBC, 0xCD, 0xEE, 0xEE, 0xDE, 0xED, 0xCB, 0xBA, 0xAA,
+ 0xA9, 0xAA, 0xAB, 0xCD, 0xDE, 0xFD, 0xED, 0xDC, 0xBA, 0x99, 0x98, 0x99,
+ 0x9A, 0xAB, 0xCC, 0xDF, 0xDC, 0xCC, 0xBA, 0x98, 0x87, 0x77, 0x88, 0x9A,
+ 0xAB, 0xCD, 0xED, 0xDC, 0xBA, 0x98, 0x87, 0x66, 0x67, 0x78, 0x9A, 0xBC,
+ 0xCE, 0xDC, 0xDB, 0xA9, 0x87, 0x66, 0x55, 0x66, 0x78, 0x9A, 0xBC, 0xDC,
+ 0xCC, 0xBA, 0x98, 0x66, 0x54, 0x55, 0x67, 0x89, 0xAB, 0xCD, 0xDC, 0xCB,
+ 0xA8, 0x76, 0x54, 0x34, 0x55, 0x67, 0x9A, 0xBC, 0xDC, 0xCC, 0xBA, 0x98,
+ 0x65, 0x53, 0x34, 0x56, 0x78, 0x9A, 0xCD, 0xDC, 0xCB, 0xA9, 0x87, 0x65,
+ 0x54, 0x56, 0x67, 0x99, 0xBC, 0xDD, 0xCC, 0xCA, 0x98, 0x77, 0x65, 0x56,
+ 0x67, 0x89, 0xAB, 0xCD, 0xDC, 0xDC, 0xBA, 0x98, 0x77, 0x66, 0x67, 0x88,
+ 0x9A, 0xBD, 0xED, 0xCD, 0xCB, 0xA9, 0x98, 0x87, 0x77, 0x88, 0x9A, 0xBC,
+ 0xDE, 0xEC, 0xDD, 0xCB, 0xAA, 0x99, 0x99, 0x99, 0x9A, 0xBB, 0xCD, 0xEE,
+ 0xDE, 0xDC, 0xCB, 0xAA, 0xAA, 0x9A, 0xAA, 0xBB, 0xCE, 0xEF, 0xFD, 0xEE,
+ 0xDD, 0xCC, 0xBB, 0xBB, 0xBB, 0xBC, 0xCD, 0xDE, 0xFF, 0xDE, 0xED, 0xDD,
+ 0xDC, 0xCC, 0xCC, 0xCC, 0xDD, 0xEF, 0xFF, 0xFD, 0xFF, 0xFD, 0xED, 0xDD,
+ 0xDD, 0xDD, 0xDE, 0xEF, 0xFF, 0xFE, 0x7C, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC,
+ 0xDD, 0xDD, 0xEE, 0xFE, 0xD0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xAB, 0xBB, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAB, 0xBB, 0x8B, 0xDC,
+ 0xCB, 0xBA, 0xAA, 0xAA, 0xAA, 0xBB, 0xCC, 0xCD, 0xEB, 0xBC, 0xBB, 0xAA,
+ 0xA9, 0x99, 0x99, 0xAA, 0xAB, 0xBC, 0xCD, 0xBB, 0xCB, 0xAA, 0x99, 0x98,
+ 0x88, 0x99, 0x9A, 0xAB, 0xBC, 0xCB, 0xAB, 0xAA, 0x98, 0x88, 0x88, 0x88,
+ 0x89, 0x9A, 0xAB, 0xBC, 0xBA, 0xBA, 0x99, 0x87, 0x77, 0x77, 0x77, 0x88,
+ 0x9A, 0xAB, 0xCB, 0xAA, 0xA9, 0x87, 0x76, 0x66, 0x66, 0x77, 0x89, 0x9A,
+ 0xBB, 0xBA, 0xA9, 0x98, 0x76, 0x66, 0x56, 0x66, 0x77, 0x89, 0xAA, 0xBB,
+ 0xAA, 0x98, 0x87, 0x66, 0x55, 0x55, 0x66, 0x78, 0x9A, 0xAB, 0xAA, 0xA9,
+ 0x88, 0x76, 0x55, 0x45, 0x56, 0x67, 0x88, 0x9A, 0xBA, 0xAA, 0x98, 0x87,
+ 0x66, 0x55, 0x45, 0x56, 0x78, 0x89, 0xAB, 0xAA, 0xA9, 0x98, 0x76, 0x65,
+ 0x55, 0x56, 0x67, 0x88, 0x9A, 0xBA, 0xAA, 0xA9, 0x87, 0x76, 0x66, 0x56,
+ 0x66, 0x78, 0x99, 0xAB, 0xBA, 0xBA, 0x99, 0x87, 0x76, 0x66, 0x66, 0x77,
+ 0x89, 0xAA, 0xBB, 0xAB, 0xAA, 0x98, 0x87, 0x77, 0x77, 0x77, 0x88, 0x9A,
+ 0xBC, 0xBA, 0xBB, 0xAA, 0x99, 0x88, 0x88, 0x88, 0x88, 0x9A, 0xAB, 0xCB,
+ 0xBC, 0xBB, 0xAA, 0x99, 0x98, 0x88, 0x99, 0x9A, 0xAB, 0xCC, 0xBB, 0xCC,
+ 0xBB, 0xAA, 0xA9, 0x99, 0x99, 0xAA, 0xAB, 0xBC, 0xDC, 0xBD, 0xCC, 0xBB,
+ 0xBB, 0xAA, 0xAA, 0xAA, 0xBB, 0xBC, 0xDD, 0xCB, 0xDC, 0xCC, 0xCB, 0xBB,
+ 0xBB, 0xBB, 0xBB, 0xCC, 0xCD, 0xEC, 0x8B, 0xBB, 0xBB, 0xBA, 0xAA, 0xAA,
+ 0xAB, 0xBB, 0xBC, 0xCC, 0xA0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xAB, 0xBA, 0xAA, 0x99, 0x99, 0x99, 0x99, 0xAA, 0xAA, 0xBB, 0x8B, 0xCB,
+ 0xBB, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xBB, 0xBC, 0xCB, 0xBB, 0xBA, 0xAA,
+ 0x99, 0x99, 0x99, 0x99, 0xAA, 0xBB, 0xCC, 0xBA, 0xBA, 0xA9, 0x98, 0x88,
+ 0x88, 0x89, 0x99, 0xAA, 0xBB, 0xCB, 0xAB, 0xA9, 0x98, 0x88, 0x77, 0x78,
+ 0x88, 0x99, 0xAA, 0xBB, 0xAA, 0xA9, 0x98, 0x87, 0x77, 0x77, 0x77, 0x88,
+ 0x99, 0xAA, 0xBA, 0x9A, 0x98, 0x87, 0x76, 0x66, 0x66, 0x77, 0x88, 0x99,
+ 0xAB, 0xA9, 0xA9, 0x88, 0x76, 0x66, 0x66, 0x66, 0x77, 0x88, 0x9A, 0xBA,
+ 0x9A, 0x98, 0x77, 0x66, 0x55, 0x56, 0x66, 0x78, 0x89, 0xAA, 0xA9, 0xA9,
+ 0x87, 0x76, 0x65, 0x55, 0x56, 0x67, 0x78, 0x9A, 0xAA, 0x9A, 0x98, 0x77,
+ 0x66, 0x55, 0x55, 0x66, 0x77, 0x89, 0xAA, 0xA9, 0xA9, 0x88, 0x76, 0x66,
+ 0x55, 0x56, 0x67, 0x78, 0x9A, 0xAA, 0x9A, 0x98, 0x87, 0x76, 0x66, 0x66,
+ 0x66, 0x78, 0x89, 0xAB, 0xA9, 0xA9, 0x98, 0x87, 0x76, 0x66, 0x66, 0x77,
+ 0x88, 0x9A, 0xBA, 0xAA, 0xA9, 0x98, 0x87, 0x77, 0x77, 0x77, 0x88, 0x99,
+ 0xAB, 0xAA, 0xBA, 0xA9, 0x98, 0x88, 0x77, 0x78, 0x88, 0x99, 0xAB, 0xBB,
+ 0xAB, 0xBA, 0xA9, 0x98, 0x88, 0x88, 0x88, 0x99, 0xAA, 0xBC, 0xBA, 0xCB,
+ 0xBA, 0xA9, 0x99, 0x99, 0x99, 0x9A, 0xAA, 0xBC, 0xCB, 0xBC, 0xCB, 0xBA,
+ 0xAA, 0xAA, 0xAA, 0xAA, 0xAB, 0xBB, 0xCD, 0xCB, 0xCC, 0xCB, 0xBB, 0xBA,
+ 0xAA, 0xAB, 0xBB, 0xBC, 0xCC, 0xDC, 0x8B, 0xBB, 0xAA, 0xAA, 0xAA, 0xAA,
+ 0xAA, 0xAB, 0xBB, 0xCC, 0xA0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xAC, 0xCB, 0xBA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xBB, 0xBB, 0x8C, 0xDC,
+ 0xCB, 0xBB, 0xAA, 0xAA, 0xAB, 0xBB, 0xBC, 0xCD, 0xDC, 0xBC, 0xCB, 0xBA,
+ 0xA9, 0x99, 0x9A, 0xAA, 0xAB, 0xBC, 0xCD, 0xCB, 0xCB, 0xAA, 0x99, 0x98,
+ 0x89, 0x99, 0x9A, 0xAB, 0xBC, 0xCB, 0xBB, 0xBA, 0x99, 0x88, 0x88, 0x88,
+ 0x89, 0x9A, 0xAB, 0xBC, 0xBB, 0xBA, 0x99, 0x87, 0x77, 0x77, 0x78, 0x88,
+ 0x9A, 0xAB, 0xCB, 0xAA, 0xA9, 0x87, 0x76, 0x66, 0x66, 0x77, 0x89, 0x9A,
+ 0xBC, 0xBA, 0xA9, 0x98, 0x76, 0x66, 0x56, 0x66, 0x77, 0x89, 0xAA, 0xBB,
+ 0xAA, 0x98, 0x87, 0x66, 0x55, 0x55, 0x66, 0x78, 0x99, 0xAB, 0xBA, 0xA9,
+ 0x88, 0x76, 0x55, 0x45, 0x56, 0x67, 0x88, 0x9A, 0xBB, 0xAA, 0x98, 0x87,
+ 0x66, 0x54, 0x45, 0x56, 0x78, 0x89, 0xAB, 0xBA, 0xA9, 0x98, 0x76, 0x65,
+ 0x55, 0x56, 0x67, 0x88, 0x9A, 0xBB, 0xAA, 0xA9, 0x87, 0x76, 0x66, 0x56,
+ 0x66, 0x78, 0x99, 0xAB, 0xBA, 0xBA, 0x99, 0x87, 0x76, 0x66, 0x66, 0x77,
+ 0x89, 0xAA, 0xCB, 0xAB, 0xAA, 0x99, 0x88, 0x77, 0x77, 0x77, 0x89, 0x9A,
+ 0xBC, 0xBB, 0xBB, 0xAA, 0x99, 0x88, 0x88, 0x88, 0x89, 0x9A, 0xAB, 0xCB,
+ 0xBC, 0xBB, 0xAA, 0x99, 0x98, 0x88, 0x99, 0x9A, 0xAB, 0xCC, 0xCB, 0xCC,
+ 0xBB, 0xAA, 0xA9, 0x99, 0x99, 0xAA, 0xAB, 0xCC, 0xDC, 0xBD, 0xCC, 0xBB,
+ 0xBA, 0xAA, 0xAA, 0xAB, 0xBB, 0xCD, 0xDD, 0xDC, 0xDD, 0xCC, 0xCB, 0xBB,
+ 0xBB, 0xBB, 0xBC, 0xCC, 0xDE, 0xED, 0x8C, 0xBB, 0xBB, 0xBB, 0xBB, 0xAB,
+ 0xBB, 0xBC, 0xCC, 0xCD, 0xB0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xCE, 0xDC, 0xCC, 0xCB, 0xBB, 0xBB, 0xBB, 0xCC, 0xBC, 0xCC, 0x7D, 0xFE,
+ 0xDD, 0xCC, 0xCB, 0xBB, 0xBC, 0xCC, 0xDD, 0xEE, 0xFD, 0xDE, 0xDC, 0xCB,
+ 0xBB, 0xAA, 0xAA, 0xBB, 0xCC, 0xCD, 0xDE, 0xDD, 0xDD, 0xCB, 0xAA, 0x99,
+ 0x99, 0x9A, 0xAB, 0xCC, 0xDD, 0xFD, 0xCD, 0xCB, 0xA9, 0x98, 0x88, 0x88,
+ 0x99, 0xAB, 0xBC, 0xDD, 0xCC, 0xCB, 0xA9, 0x98, 0x87, 0x77, 0x78, 0x89,
+ 0xAB, 0xBD, 0xDC, 0xCC, 0xBA, 0x98, 0x77, 0x66, 0x67, 0x78, 0x89, 0xAB,
+ 0xCD, 0xDB, 0xCB, 0xA9, 0x87, 0x65, 0x55, 0x66, 0x78, 0x9A, 0xBC, 0xDC,
+ 0xCB, 0xA9, 0x87, 0x65, 0x54, 0x55, 0x67, 0x78, 0x9B, 0xBC, 0xCB, 0xBA,
+ 0x98, 0x76, 0x54, 0x44, 0x55, 0x67, 0x89, 0xAB, 0xCC, 0xBB, 0xA9, 0x87,
+ 0x65, 0x54, 0x44, 0x56, 0x78, 0x9A, 0xBC, 0xCB, 0xCB, 0x98, 0x77, 0x65,
+ 0x54, 0x55, 0x67, 0x89, 0xAC, 0xCC, 0xBC, 0xBA, 0x98, 0x76, 0x65, 0x55,
+ 0x67, 0x89, 0x9A, 0xBD, 0xCC, 0xCB, 0xA9, 0x88, 0x77, 0x66, 0x67, 0x78,
+ 0x9A, 0xBC, 0xDD, 0xCC, 0xBB, 0xA9, 0x88, 0x77, 0x77, 0x88, 0x99, 0xBB,
+ 0xCD, 0xDC, 0xDC, 0xBA, 0xA9, 0x98, 0x88, 0x89, 0x99, 0xAB, 0xCD, 0xDD,
+ 0xDE, 0xDC, 0xBB, 0xAA, 0x99, 0x99, 0xAA, 0xAB, 0xCC, 0xDE, 0xFC, 0xDD,
+ 0xDC, 0xBB, 0xBA, 0xAA, 0xAB, 0xBC, 0xCD, 0xDF, 0xEE, 0xDE, 0xDE, 0xDC,
+ 0xCC, 0xCB, 0xBC, 0xBC, 0xCD, 0xDE, 0xFF, 0xED, 0xFE, 0xED, 0xDD, 0xCC,
+ 0xCD, 0xCC, 0xDE, 0xDE, 0xFF, 0xFF, 0x8C, 0xCC, 0xDC, 0xCC, 0xCC, 0xCC,
+ 0xDD, 0xCD, 0xDE, 0xFF, 0xD0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xEF, 0xFF, 0xEE, 0xED, 0xED, 0xDD, 0xDC, 0xCC, 0xCC, 0xCC, 0x8F, 0xFF,
+ 0xFF, 0xFF, 0xFE, 0xED, 0xED, 0xDD, 0xFF, 0xFF, 0xFD, 0xFF, 0xFF, 0xEE,
+ 0xDD, 0xDC, 0xCD, 0xDD, 0xDD, 0xFF, 0xFF, 0xDE, 0xFF, 0xED, 0xDC, 0xCB,
+ 0xBB, 0xCC, 0xCC, 0xDD, 0xFF, 0xFD, 0xEF, 0xEE, 0xDC, 0xBB, 0xAA, 0xAA,
+ 0xBB, 0xCD, 0xDE, 0xFF, 0xEF, 0xFE, 0xDB, 0xBA, 0x98, 0x88, 0x99, 0xAB,
+ 0xCC, 0xDE, 0xFF, 0xEF, 0xDD, 0xB9, 0x87, 0x77, 0x77, 0x89, 0xAB, 0xCE,
+ 0xEF, 0xED, 0xED, 0xCA, 0x97, 0x66, 0x55, 0x67, 0x89, 0xAC, 0xDD, 0xFF,
+ 0xDD, 0xDB, 0xA8, 0x75, 0x44, 0x45, 0x67, 0x8A, 0xBD, 0xFF, 0xED, 0xEC,
+ 0xBA, 0x87, 0x54, 0x33, 0x45, 0x78, 0xAB, 0xDE, 0xFE, 0xDD, 0xCB, 0xA8,
+ 0x75, 0x43, 0x34, 0x57, 0x8A, 0xBD, 0xFE, 0xFD, 0xEC, 0xCA, 0x87, 0x65,
+ 0x44, 0x45, 0x78, 0xAC, 0xDF, 0xFF, 0xDE, 0xDC, 0xA9, 0x87, 0x65, 0x55,
+ 0x67, 0x9A, 0xCD, 0xFF, 0xFD, 0xFD, 0xCB, 0xA9, 0x87, 0x77, 0x77, 0x8A,
+ 0xBD, 0xEF, 0xFF, 0xCF, 0xDD, 0xCB, 0xA9, 0x88, 0x88, 0x9A, 0xBC, 0xDE,
+ 0xFF, 0xED, 0xFD, 0xED, 0xCB, 0xAA, 0xAA, 0xAA, 0xBC, 0xDE, 0xEE, 0xFF,
+ 0xDE, 0xFD, 0xDD, 0xCB, 0xBB, 0xBB, 0xCC, 0xEE, 0xFF, 0xFF, 0xFD, 0xFE,
+ 0xEE, 0xDD, 0xDD, 0xCD, 0xDD, 0xEE, 0xFE, 0xFF, 0xFF, 0xDF, 0xEE, 0xEE,
+ 0xDD, 0xED, 0xDD, 0xEF, 0xEF, 0xFF, 0xFF, 0xFD, 0xEE, 0xEE, 0xEF, 0xEF,
+ 0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7C, 0xCC, 0xCC, 0xDD, 0xDD, 0xDE,
+ 0xFE, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xEF, 0xEF, 0xED, 0xDD, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0x8F, 0xFF,
+ 0xEF, 0xDD, 0xDC, 0xCC, 0xCC, 0xDD, 0xDE, 0xEE, 0xED, 0xEF, 0xED, 0xDC,
+ 0xCB, 0xBB, 0xBB, 0xBC, 0xCC, 0xDD, 0xEE, 0xDE, 0xFE, 0xDC, 0xBB, 0xAA,
+ 0xAA, 0xAA, 0xBB, 0xCC, 0xDD, 0xFD, 0xEE, 0xDC, 0xBA, 0x99, 0x99, 0x99,
+ 0x9A, 0xAB, 0xCD, 0xDE, 0xDD, 0xDD, 0xBA, 0x98, 0x87, 0x77, 0x88, 0x9A,
+ 0xAB, 0xCD, 0xED, 0xDD, 0xCA, 0x98, 0x87, 0x66, 0x67, 0x78, 0x9A, 0xBC,
+ 0xDE, 0xDC, 0xCB, 0xA9, 0x87, 0x65, 0x55, 0x66, 0x78, 0x9A, 0xBC, 0xEE,
+ 0xCC, 0xBA, 0x97, 0x65, 0x54, 0x45, 0x67, 0x89, 0xAB, 0xCE, 0xDC, 0xCB,
+ 0xA9, 0x76, 0x54, 0x44, 0x45, 0x67, 0x9A, 0xBC, 0xED, 0xCC, 0xBA, 0x97,
+ 0x65, 0x44, 0x44, 0x56, 0x78, 0xAB, 0xCD, 0xDC, 0xCB, 0xA9, 0x87, 0x65,
+ 0x44, 0x55, 0x67, 0x9A, 0xBC, 0xEE, 0xCC, 0xBA, 0x98, 0x76, 0x65, 0x55,
+ 0x67, 0x89, 0xAC, 0xDE, 0xEC, 0xCC, 0xBA, 0x98, 0x77, 0x66, 0x67, 0x78,
+ 0x9B, 0xCD, 0xEE, 0xCD, 0xCB, 0xA9, 0x98, 0x87, 0x77, 0x88, 0x9A, 0xBD,
+ 0xEF, 0xFC, 0xDC, 0xCB, 0xAA, 0x99, 0x98, 0x99, 0x9A, 0xBC, 0xDF, 0xFF,
+ 0xCE, 0xDC, 0xCB, 0xBA, 0xAA, 0xAA, 0xAB, 0xBC, 0xDE, 0xFF, 0xFC, 0xED,
+ 0xDD, 0xCC, 0xBB, 0xBB, 0xBB, 0xCD, 0xDE, 0xEF, 0xFF, 0xCE, 0xED, 0xDD,
+ 0xDC, 0xCC, 0xCD, 0xDD, 0xDF, 0xFF, 0xFF, 0xFC, 0xFE, 0xEE, 0xEE, 0xEE,
+ 0xDD, 0xEE, 0xFF, 0xFF, 0xFF, 0xFF, 0x8D, 0xDD, 0xDD, 0xDD, 0xDD, 0xDE,
+ 0xEF, 0xEF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xDF, 0xEE, 0xDD, 0xCC, 0xCB, 0xBB, 0xBB, 0xCC, 0xCC, 0xCC, 0xAF, 0xFE,
+ 0xED, 0xCC, 0xBB, 0xBB, 0xBB, 0xCC, 0xCD, 0xDE, 0xED, 0xEF, 0xDD, 0xCB,
+ 0xBA, 0xAA, 0xAA, 0xAB, 0xBC, 0xCD, 0xDE, 0xDD, 0xED, 0xCB, 0xAA, 0x99,
+ 0x99, 0x99, 0xAA, 0xBB, 0xCD, 0xED, 0xDD, 0xCB, 0xA9, 0x98, 0x88, 0x88,
+ 0x89, 0x9A, 0xBC, 0xCD, 0xDC, 0xCB, 0xA9, 0x88, 0x77, 0x77, 0x78, 0x89,
+ 0x9A, 0xBC, 0xDC, 0xCC, 0xBA, 0x98, 0x76, 0x66, 0x66, 0x77, 0x89, 0xAB,
+ 0xCC, 0xCC, 0xBA, 0x98, 0x76, 0x65, 0x55, 0x66, 0x77, 0x89, 0xAB, 0xCC,
+ 0xBB, 0xA9, 0x87, 0x65, 0x55, 0x55, 0x66, 0x78, 0x9A, 0xBC, 0xCB, 0xBA,
+ 0x98, 0x76, 0x55, 0x44, 0x55, 0x67, 0x89, 0xAB, 0xCC, 0xBB, 0xA9, 0x87,
+ 0x65, 0x54, 0x45, 0x56, 0x78, 0x9A, 0xBC, 0xCB, 0xBA, 0x98, 0x76, 0x65,
+ 0x55, 0x55, 0x67, 0x89, 0xAB, 0xDD, 0xBB, 0xA9, 0x87, 0x76, 0x65, 0x55,
+ 0x66, 0x78, 0x9A, 0xBD, 0xDB, 0xCB, 0xA9, 0x87, 0x76, 0x66, 0x66, 0x78,
+ 0x9A, 0xBC, 0xDD, 0xCC, 0xBA, 0x99, 0x87, 0x77, 0x77, 0x78, 0x89, 0xAB,
+ 0xCD, 0xEC, 0xCC, 0xBA, 0x99, 0x88, 0x88, 0x88, 0x99, 0xAB, 0xCD, 0xEE,
+ 0xCD, 0xCB, 0xBA, 0xA9, 0x99, 0x99, 0x9A, 0xAB, 0xCD, 0xEF, 0xEC, 0xDD,
+ 0xCB, 0xBB, 0xAA, 0xAA, 0xAA, 0xBB, 0xCD, 0xDF, 0xFF, 0xCE, 0xDD, 0xCC,
+ 0xCB, 0xBB, 0xBB, 0xBC, 0xCD, 0xEF, 0xFF, 0xFC, 0xEE, 0xDD, 0xDD, 0xCC,
+ 0xCC, 0xCD, 0xDD, 0xEF, 0xFF, 0xFF, 0xAD, 0xDD, 0xCC, 0xCC, 0xCC, 0xCD,
+ 0xDD, 0xEE, 0xEF, 0xFF, 0xE0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xDF, 0xFE, 0xED, 0xDD, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0x8F, 0xFF,
+ 0xFE, 0xDD, 0xDC, 0xCC, 0xDD, 0xDD, 0xDD, 0xEE, 0xEC, 0xEF, 0xEE, 0xDC,
+ 0xCB, 0xBB, 0xBB, 0xBC, 0xCC, 0xDD, 0xEF, 0xDE, 0xEE, 0xDC, 0xBB, 0xAA,
+ 0xAA, 0xAA, 0xBB, 0xCC, 0xDD, 0xED, 0xEE, 0xDC, 0xBA, 0x99, 0x99, 0x99,
+ 0x9A, 0xAB, 0xCC, 0xDE, 0xDD, 0xEC, 0xBA, 0x98, 0x87, 0x77, 0x88, 0x9A,
+ 0xAB, 0xCD, 0xDD, 0xDD, 0xCB, 0xA8, 0x77, 0x66, 0x67, 0x78, 0x9A, 0xBC,
+ 0xCD, 0xDD, 0xDC, 0xA9, 0x87, 0x65, 0x55, 0x66, 0x78, 0x9A, 0xCC, 0xDD,
+ 0xCC, 0xBA, 0x97, 0x65, 0x54, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xDC, 0xCB,
+ 0xA9, 0x76, 0x54, 0x44, 0x45, 0x67, 0x9A, 0xBC, 0xDD, 0xCC, 0xBA, 0x97,
+ 0x65, 0x44, 0x44, 0x56, 0x78, 0xAB, 0xCD, 0xDC, 0xCB, 0xA9, 0x87, 0x65,
+ 0x44, 0x55, 0x67, 0x9A, 0xBC, 0xEE, 0xCC, 0xCA, 0x98, 0x76, 0x65, 0x55,
+ 0x67, 0x89, 0xAB, 0xDE, 0xDD, 0xDC, 0xBA, 0x98, 0x77, 0x66, 0x67, 0x78,
+ 0x9B, 0xCD, 0xEE, 0xCD, 0xCB, 0xAA, 0x98, 0x87, 0x77, 0x88, 0x9A, 0xBC,
+ 0xEF, 0xEC, 0xDD, 0xCB, 0xAA, 0x99, 0x99, 0x99, 0xAA, 0xBC, 0xDE, 0xFE,
+ 0xCE, 0xDC, 0xCB, 0xBA, 0xAA, 0xAA, 0xAB, 0xBC, 0xDE, 0xEF, 0xFC, 0xED,
+ 0xDC, 0xCC, 0xBB, 0xBB, 0xBB, 0xCC, 0xDE, 0xEF, 0xFF, 0xCE, 0xED, 0xDD,
+ 0xDC, 0xCC, 0xCC, 0xDD, 0xDE, 0xFF, 0xFF, 0xFD, 0xFE, 0xEE, 0xDD, 0xDD,
+ 0xDD, 0xDD, 0xEF, 0xFF, 0xFF, 0xFF, 0x8C, 0xCC, 0xCC, 0xDC, 0xDD, 0xDD,
+ 0xDE, 0xEE, 0xFF, 0xFF, 0xE0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xEF, 0xFF, 0xFF, 0xFD, 0xED, 0xDD, 0xDC, 0xCC, 0xCC, 0xCC, 0x7F, 0xFF,
+ 0xFF, 0xFF, 0xFE, 0xDE, 0xDF, 0xDE, 0xEF, 0xFF, 0xFD, 0xFF, 0xFF, 0xFF,
+ 0xED, 0xDD, 0xCC, 0xCD, 0xEE, 0xEE, 0xFF, 0xDF, 0xFF, 0xFF, 0xED, 0xCC,
+ 0xBC, 0xBB, 0xCD, 0xDD, 0xEF, 0xFD, 0xFF, 0xFE, 0xEC, 0xBA, 0xAA, 0xAA,
+ 0xBB, 0xCC, 0xDF, 0xEF, 0xDF, 0xFF, 0xDC, 0xBA, 0x98, 0x88, 0x99, 0xAB,
+ 0xCC, 0xEF, 0xFF, 0xFF, 0xED, 0xBA, 0x87, 0x77, 0x77, 0x89, 0xAB, 0xDD,
+ 0xEF, 0xDF, 0xFF, 0xCA, 0x97, 0x65, 0x55, 0x67, 0x89, 0xBC, 0xDF, 0xFE,
+ 0xEF, 0xDC, 0xA8, 0x75, 0x44, 0x45, 0x67, 0x9A, 0xBD, 0xEF, 0xFE, 0xFD,
+ 0xCA, 0x87, 0x54, 0x33, 0x45, 0x78, 0xAB, 0xCF, 0xFF, 0xDF, 0xDC, 0xA8,
+ 0x75, 0x43, 0x34, 0x57, 0x8A, 0xCD, 0xEF, 0xED, 0xFD, 0xCA, 0x97, 0x65,
+ 0x44, 0x45, 0x78, 0xAB, 0xDF, 0xFF, 0xEF, 0xDC, 0xB9, 0x87, 0x65, 0x55,
+ 0x68, 0x9B, 0xCF, 0xFF, 0xFD, 0xEE, 0xCB, 0xA9, 0x87, 0x76, 0x78, 0x9A,
+ 0xCD, 0xFF, 0xFF, 0xDF, 0xED, 0xCB, 0xA9, 0x98, 0x88, 0x9A, 0xBC, 0xDF,
+ 0xFF, 0xFD, 0xFD, 0xDC, 0xCB, 0xAA, 0xAA, 0xAA, 0xCD, 0xDF, 0xFF, 0xFF,
+ 0xDF, 0xFD, 0xDD, 0xCC, 0xCB, 0xCC, 0xCD, 0xDE, 0xFF, 0xFF, 0xFD, 0xFE,
+ 0xFE, 0xDD, 0xDC, 0xDD, 0xDD, 0xEF, 0xFF, 0xFF, 0xFF, 0xDF, 0xFE, 0xEE,
+ 0xEE, 0xDE, 0xEE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFC, 0xEF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x8D, 0xCC, 0xCD, 0xDE, 0xEF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xEF, 0xFF, 0xDF, 0xDE, 0xDD, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0x7F, 0xFF,
+ 0xEF, 0xFF, 0xFD, 0xEE, 0xFE, 0xDD, 0xEF, 0xFF, 0xFD, 0xFF, 0xFF, 0xEE,
+ 0xDD, 0xDD, 0xDD, 0xCD, 0xDF, 0xFF, 0xFF, 0xDF, 0xFE, 0xED, 0xDC, 0xCB,
+ 0xBB, 0xBC, 0xCC, 0xDD, 0xFF, 0xFD, 0xFF, 0xFD, 0xDB, 0xBA, 0xAA, 0xAA,
+ 0xBB, 0xCC, 0xDD, 0xFF, 0xFF, 0xFE, 0xDB, 0xAA, 0x98, 0x89, 0x99, 0xAB,
+ 0xCC, 0xFF, 0xFF, 0xFE, 0xDC, 0xBA, 0x98, 0x77, 0x78, 0x89, 0xAC, 0xCC,
+ 0xFF, 0xFD, 0xFD, 0xCA, 0x98, 0x76, 0x66, 0x67, 0x89, 0xAC, 0xCD, 0xFE,
+ 0xDD, 0xCB, 0xA9, 0x76, 0x54, 0x45, 0x67, 0x9A, 0xCC, 0xDF, 0xDD, 0xED,
+ 0xBA, 0x97, 0x64, 0x23, 0x46, 0x78, 0xAB, 0xDD, 0xFF, 0xDD, 0xCB, 0xA9,
+ 0x76, 0x43, 0x24, 0x57, 0x9A, 0xCD, 0xFF, 0xFE, 0xDC, 0xCA, 0x98, 0x65,
+ 0x44, 0x56, 0x78, 0xAC, 0xDE, 0xFD, 0xDD, 0xDC, 0xAA, 0x87, 0x66, 0x56,
+ 0x78, 0x9A, 0xBD, 0xFF, 0xFE, 0xDD, 0xCB, 0xA9, 0x87, 0x77, 0x78, 0x99,
+ 0xBC, 0xEF, 0xFF, 0xDF, 0xED, 0xCB, 0xA9, 0x98, 0x89, 0x9A, 0xBC, 0xDD,
+ 0xFF, 0xFD, 0xFF, 0xEC, 0xCB, 0xBA, 0xAA, 0xAA, 0xAC, 0xDE, 0xEF, 0xFF,
+ 0xDF, 0xFE, 0xCC, 0xDC, 0xBB, 0xBB, 0xBC, 0xDD, 0xEF, 0xFF, 0xFE, 0xFF,
+ 0xDE, 0xED, 0xDD, 0xCC, 0xDD, 0xDF, 0xFF, 0xFF, 0xFF, 0xDF, 0xFE, 0xFF,
+ 0xFF, 0xEC, 0xED, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xFF, 0xFF, 0xED, 0xFE,
+ 0xED, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x6C, 0xCB, 0xBC, 0xCD, 0xDC, 0xCF,
+ 0xDF, 0xEF, 0xFF, 0xFF, 0xE0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xBD, 0xCC, 0xBB, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAB, 0xBB, 0x8D, 0xDC,
+ 0xCB, 0xBB, 0xAA, 0xAA, 0xAA, 0xBB, 0xBC, 0xCD, 0xDC, 0xCD, 0xCB, 0xAA,
+ 0xA9, 0x99, 0x99, 0xAA, 0xAB, 0xBC, 0xCD, 0xCB, 0xCB, 0xBA, 0x99, 0x99,
+ 0x89, 0x99, 0x9A, 0xAB, 0xBC, 0xDB, 0xBC, 0xAA, 0x99, 0x88, 0x88, 0x88,
+ 0x89, 0x9A, 0xAB, 0xCD, 0xBB, 0xBA, 0x99, 0x88, 0x77, 0x77, 0x78, 0x89,
+ 0x9A, 0xAB, 0xCB, 0xAB, 0xA9, 0x88, 0x76, 0x66, 0x66, 0x77, 0x89, 0x9A,
+ 0xBC, 0xBA, 0xBA, 0x98, 0x76, 0x66, 0x56, 0x66, 0x78, 0x89, 0xAB, 0xBB,
+ 0xAA, 0x99, 0x87, 0x66, 0x55, 0x55, 0x66, 0x78, 0x9A, 0xBB, 0xBA, 0xA9,
+ 0x98, 0x76, 0x55, 0x44, 0x56, 0x67, 0x88, 0x9A, 0xBB, 0xAA, 0x99, 0x87,
+ 0x66, 0x54, 0x45, 0x56, 0x78, 0x89, 0xAB, 0xBA, 0xA9, 0x98, 0x76, 0x65,
+ 0x55, 0x56, 0x67, 0x89, 0x9A, 0xBB, 0xAA, 0xA9, 0x87, 0x76, 0x66, 0x56,
+ 0x66, 0x78, 0x9A, 0xAB, 0xBA, 0xBA, 0x99, 0x87, 0x76, 0x66, 0x66, 0x77,
+ 0x89, 0xAB, 0xCC, 0xAB, 0xAA, 0x98, 0x87, 0x77, 0x77, 0x77, 0x89, 0x9A,
+ 0xBC, 0xCA, 0xCB, 0xAA, 0x99, 0x88, 0x88, 0x88, 0x89, 0x9A, 0xBC, 0xCC,
+ 0xBC, 0xBB, 0xAA, 0x99, 0x99, 0x88, 0x99, 0x9A, 0xBB, 0xCD, 0xDB, 0xDC,
+ 0xCB, 0xAA, 0xAA, 0x99, 0x9A, 0xAA, 0xBB, 0xCD, 0xDD, 0xBD, 0xCC, 0xBB,
+ 0xBA, 0xAA, 0xAA, 0xAB, 0xBB, 0xCC, 0xDE, 0xDB, 0xDD, 0xCC, 0xCB, 0xBB,
+ 0xBB, 0xBB, 0xCC, 0xCD, 0xDE, 0xED, 0x8C, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB,
+ 0xBB, 0xBC, 0xDD, 0xDE, 0xC0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xBC, 0xBB, 0xAA, 0x99, 0x99, 0x99, 0x99, 0x9A, 0xAA, 0xBB, 0x9B, 0xCB,
+ 0xBA, 0xAA, 0xA9, 0x99, 0x9A, 0xAA, 0xBB, 0xBC, 0xDB, 0xBC, 0xBA, 0xA9,
+ 0x99, 0x99, 0x99, 0x99, 0xAA, 0xAB, 0xBC, 0xBA, 0xBA, 0xA9, 0x98, 0x88,
+ 0x88, 0x88, 0x99, 0x9A, 0xAB, 0xCB, 0xAB, 0xA9, 0x98, 0x87, 0x77, 0x77,
+ 0x88, 0x89, 0x9A, 0xBB, 0xBA, 0xA9, 0x98, 0x87, 0x77, 0x77, 0x77, 0x78,
+ 0x89, 0xAA, 0xBA, 0x9A, 0x98, 0x87, 0x76, 0x66, 0x66, 0x77, 0x78, 0x99,
+ 0xAB, 0xA9, 0xA9, 0x87, 0x76, 0x66, 0x66, 0x66, 0x77, 0x88, 0x9A, 0xAA,
+ 0x99, 0x98, 0x77, 0x66, 0x65, 0x56, 0x66, 0x77, 0x89, 0x9A, 0xA9, 0x99,
+ 0x87, 0x76, 0x65, 0x55, 0x66, 0x67, 0x78, 0x99, 0xAA, 0x99, 0x98, 0x77,
+ 0x66, 0x65, 0x55, 0x66, 0x77, 0x89, 0x9A, 0xA9, 0x99, 0x87, 0x76, 0x66,
+ 0x65, 0x66, 0x67, 0x78, 0x99, 0xAA, 0x9A, 0x98, 0x87, 0x76, 0x66, 0x66,
+ 0x66, 0x77, 0x89, 0xAA, 0xA9, 0xA9, 0x98, 0x77, 0x76, 0x66, 0x66, 0x77,
+ 0x88, 0x9A, 0xBA, 0x9A, 0xA9, 0x88, 0x77, 0x77, 0x77, 0x77, 0x88, 0x99,
+ 0xAB, 0xBA, 0xBA, 0x99, 0x88, 0x87, 0x77, 0x77, 0x88, 0x99, 0xAA, 0xBB,
+ 0xAB, 0xAA, 0x99, 0x98, 0x88, 0x88, 0x88, 0x99, 0xAA, 0xBC, 0xBA, 0xBB,
+ 0xAA, 0xA9, 0x99, 0x99, 0x99, 0x99, 0xAA, 0xBC, 0xCC, 0xBC, 0xBB, 0xAA,
+ 0xAA, 0x99, 0x99, 0xAA, 0xAA, 0xBB, 0xCD, 0xCB, 0xCC, 0xCB, 0xBB, 0xAA,
+ 0xAA, 0xAA, 0xBB, 0xBC, 0xCD, 0xDD, 0x9B, 0xBB, 0xAA, 0xAA, 0xAA, 0xAA,
+ 0xAA, 0xBB, 0xBC, 0xCD, 0xC0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xBD, 0xCB, 0xBB, 0xAA, 0xAA, 0xAA, 0xAA, 0xAB, 0xBB, 0xBB, 0x8D, 0xDC,
+ 0xCB, 0xBB, 0xBA, 0xAA, 0xAB, 0xBB, 0xCC, 0xCD, 0xDB, 0xCC, 0xCB, 0xAA,
+ 0xAA, 0x99, 0x9A, 0xAA, 0xAB, 0xBB, 0xCD, 0xBC, 0xCB, 0xAA, 0x99, 0x98,
+ 0x99, 0x99, 0x9A, 0xAB, 0xBC, 0xDB, 0xBB, 0xBA, 0x98, 0x88, 0x88, 0x88,
+ 0x89, 0x9A, 0xAB, 0xBC, 0xBB, 0xBA, 0x98, 0x87, 0x77, 0x77, 0x78, 0x88,
+ 0x9A, 0xBB, 0xCB, 0xAB, 0xA9, 0x87, 0x76, 0x66, 0x67, 0x77, 0x89, 0x9A,
+ 0xBB, 0xBA, 0xB9, 0x98, 0x76, 0x66, 0x56, 0x66, 0x78, 0x89, 0xAB, 0xBB,
+ 0xAA, 0x99, 0x87, 0x65, 0x55, 0x55, 0x67, 0x78, 0x9A, 0xAB, 0xBA, 0xA9,
+ 0x88, 0x76, 0x55, 0x44, 0x56, 0x67, 0x89, 0x9A, 0xBB, 0xAA, 0x99, 0x87,
+ 0x66, 0x54, 0x45, 0x56, 0x78, 0x89, 0xAB, 0xBA, 0xAA, 0x98, 0x77, 0x65,
+ 0x55, 0x56, 0x67, 0x88, 0x9A, 0xBB, 0xAA, 0xA9, 0x88, 0x76, 0x66, 0x56,
+ 0x66, 0x78, 0x99, 0xBB, 0xBA, 0xBA, 0x99, 0x87, 0x76, 0x66, 0x66, 0x77,
+ 0x89, 0xAB, 0xCB, 0xAB, 0xAA, 0x98, 0x88, 0x77, 0x77, 0x77, 0x89, 0x9A,
+ 0xBC, 0xCB, 0xBB, 0xAA, 0x99, 0x88, 0x88, 0x88, 0x89, 0x9A, 0xBC, 0xCC,
+ 0xBC, 0xBB, 0xAA, 0x99, 0x99, 0x88, 0x99, 0x9A, 0xAB, 0xCD, 0xCB, 0xCB,
+ 0xBB, 0xAA, 0xA9, 0x99, 0x9A, 0xAA, 0xBB, 0xCC, 0xDD, 0xBD, 0xDC, 0xBB,
+ 0xBB, 0xAA, 0xAA, 0xAB, 0xBB, 0xCC, 0xDE, 0xDB, 0xDD, 0xCC, 0xCB, 0xBB,
+ 0xBB, 0xBC, 0xCC, 0xCD, 0xDD, 0xED, 0x8B, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB,
+ 0xBB, 0xBC, 0xCD, 0xDD, 0xC0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xEE, 0xFF, 0xDF, 0xDD, 0xCC, 0xCC, 0xDD, 0xCC, 0xCC, 0xCC, 0x7F, 0xFF,
+ 0xFF, 0xFD, 0xDE, 0xDD, 0xDE, 0xDE, 0xEF, 0xFF, 0xFE, 0xFF, 0xFF, 0xED,
+ 0xCD, 0xCC, 0xCC, 0xDC, 0xDD, 0xEE, 0xFF, 0xDF, 0xFF, 0xDE, 0xCC, 0xBB,
+ 0xBB, 0xBB, 0xBC, 0xDD, 0xFE, 0xFE, 0xFF, 0xED, 0xCB, 0xAA, 0x99, 0xAA,
+ 0xAA, 0xBC, 0xCE, 0xEF, 0xEE, 0xED, 0xCB, 0xA9, 0x88, 0x88, 0x89, 0xAB,
+ 0xCC, 0xDE, 0xFF, 0xDF, 0xDB, 0xA9, 0x87, 0x77, 0x77, 0x89, 0xAB, 0xCD,
+ 0xDE, 0xED, 0xFC, 0xBA, 0x97, 0x66, 0x55, 0x67, 0x89, 0xAB, 0xCE, 0xED,
+ 0xDE, 0xCB, 0xA8, 0x75, 0x44, 0x45, 0x67, 0x8A, 0xBC, 0xDE, 0xED, 0xEC,
+ 0xB9, 0x87, 0x54, 0x33, 0x45, 0x78, 0xAB, 0xCE, 0xFF, 0xDE, 0xCB, 0x98,
+ 0x75, 0x43, 0x34, 0x57, 0x89, 0xBC, 0xDE, 0xFD, 0xDC, 0xBA, 0x97, 0x65,
+ 0x44, 0x46, 0x78, 0xAB, 0xCD, 0xFE, 0xDE, 0xCB, 0xA9, 0x87, 0x65, 0x56,
+ 0x67, 0x9A, 0xBC, 0xDF, 0xDD, 0xED, 0xCB, 0xA9, 0x87, 0x77, 0x77, 0x89,
+ 0xAC, 0xDF, 0xFF, 0xEF, 0xDC, 0xBB, 0xA9, 0x88, 0x88, 0x99, 0xAB, 0xCD,
+ 0xFF, 0xFF, 0xFD, 0xDC, 0xBB, 0xAA, 0x99, 0x9A, 0xAB, 0xCE, 0xDF, 0xFF,
+ 0xDF, 0xFD, 0xDC, 0xBB, 0xBB, 0xBB, 0xBC, 0xCD, 0xEF, 0xFF, 0xFD, 0xFF,
+ 0xDE, 0xCC, 0xCC, 0xCC, 0xCD, 0xDD, 0xEE, 0xFF, 0xFF, 0xDF, 0xEF, 0xEE,
+ 0xED, 0xDD, 0xDD, 0xDD, 0xFF, 0xFF, 0xFF, 0xFD, 0xFE, 0xEF, 0xFE, 0xEE,
+ 0xEF, 0xEF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7C, 0xCC, 0xDD, 0xDD, 0xED, 0xDE,
+ 0xEE, 0xEF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xDC, 0xCC, 0xCB, 0xBB, 0x7F, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xDD, 0xFF, 0xFF, 0xFC, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xDD, 0xFD, 0xDF, 0xFF, 0xDF, 0xDF, 0xFF, 0xFF, 0xFF, 0xFF, 0xCC,
+ 0xCC, 0xCD, 0xFF, 0xFD, 0xFF, 0xFD, 0xFF, 0xFF, 0xFC, 0xDB, 0xBA, 0xBB,
+ 0xCB, 0xDD, 0xFD, 0xFF, 0xFF, 0xFF, 0xFD, 0xCB, 0xA9, 0x99, 0x9A, 0xBC,
+ 0xDD, 0xFF, 0xFF, 0xFF, 0xFF, 0xCB, 0x98, 0x77, 0x78, 0x9A, 0xBC, 0xDD,
+ 0xFD, 0xFF, 0xFF, 0xDD, 0xA8, 0x76, 0x55, 0x68, 0x9A, 0xBC, 0xFF, 0xFF,
+ 0xFF, 0xFC, 0xC9, 0x76, 0x54, 0x45, 0x68, 0xAB, 0xCC, 0xFF, 0xFF, 0xFD,
+ 0xCA, 0x97, 0x54, 0x23, 0x45, 0x79, 0xBC, 0xFF, 0xFF, 0xFF, 0xDC, 0xB9,
+ 0x76, 0x43, 0x24, 0x57, 0x9A, 0xCF, 0xFF, 0xFF, 0xFD, 0xDB, 0xA8, 0x65,
+ 0x44, 0x56, 0x79, 0xBD, 0xFF, 0xFF, 0xFF, 0xDC, 0xBA, 0x87, 0x65, 0x56,
+ 0x78, 0xAC, 0xDF, 0xFF, 0xFD, 0xFC, 0xFD, 0xBA, 0x88, 0x77, 0x78, 0x9A,
+ 0xCD, 0xFF, 0xFF, 0xDF, 0xFF, 0xDC, 0xBA, 0x99, 0x99, 0xAB, 0xCD, 0xFF,
+ 0xFF, 0xFD, 0xFF, 0xFD, 0xDC, 0xBB, 0xBA, 0xBB, 0xDD, 0xFF, 0xFF, 0xFF,
+ 0xDF, 0xFD, 0xFF, 0xDD, 0xDC, 0xCB, 0xDC, 0xFF, 0xFF, 0xFF, 0xFC, 0xFF,
+ 0xDF, 0xDD, 0xFD, 0xFD, 0xDD, 0xFF, 0xFF, 0xFF, 0xFF, 0xCF, 0xFF, 0xFD,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFC, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFD, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7C, 0xCB, 0xDD, 0xCF, 0xFF, 0xDF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xEF, 0xEF, 0xFD, 0xDC, 0xDC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0x9F, 0xFF,
+ 0xFE, 0xDD, 0xDC, 0xCC, 0xCC, 0xCC, 0xDD, 0xDF, 0xFD, 0xFF, 0xFF, 0xCC,
+ 0xCB, 0xBB, 0xBB, 0xBB, 0xBC, 0xDC, 0xEF, 0xEF, 0xFD, 0xDC, 0xBA, 0xAA,
+ 0x99, 0xAA, 0xAB, 0xCC, 0xDE, 0xFD, 0xFE, 0xDC, 0xBA, 0x99, 0x88, 0x89,
+ 0x9A, 0xAA, 0xCC, 0xDD, 0xED, 0xDC, 0xBA, 0x98, 0x87, 0x77, 0x78, 0x89,
+ 0xAB, 0xCD, 0xEE, 0xDD, 0xBA, 0x98, 0x77, 0x66, 0x66, 0x78, 0x89, 0xAC,
+ 0xCD, 0xDD, 0xCB, 0xA9, 0x87, 0x65, 0x55, 0x66, 0x78, 0x9A, 0xBC, 0xED,
+ 0xDC, 0xBA, 0x87, 0x65, 0x54, 0x45, 0x66, 0x79, 0xAB, 0xCD, 0xEC, 0xCB,
+ 0xA8, 0x76, 0x54, 0x44, 0x55, 0x67, 0x89, 0xBD, 0xEE, 0xCC, 0xBA, 0x87,
+ 0x65, 0x54, 0x44, 0x56, 0x78, 0xAB, 0xDE, 0xEC, 0xCB, 0x98, 0x76, 0x65,
+ 0x54, 0x55, 0x67, 0x8A, 0xBC, 0xFE, 0xCC, 0xBA, 0x98, 0x76, 0x65, 0x55,
+ 0x67, 0x89, 0xAB, 0xDF, 0xFC, 0xCB, 0xA9, 0x88, 0x76, 0x66, 0x67, 0x78,
+ 0x9A, 0xBE, 0xFF, 0xCC, 0xCB, 0xA9, 0x88, 0x77, 0x77, 0x78, 0x9A, 0xBC,
+ 0xFF, 0xFC, 0xDD, 0xBB, 0xAA, 0x99, 0x88, 0x89, 0x9A, 0xBC, 0xDF, 0xFF,
+ 0xDD, 0xDC, 0xBB, 0xBA, 0xA9, 0x9A, 0xAA, 0xBC, 0xDE, 0xFF, 0xFC, 0xED,
+ 0xCC, 0xCC, 0xBB, 0xBB, 0xBC, 0xCC, 0xDE, 0xFF, 0xFF, 0xDD, 0xDD, 0xED,
+ 0xDC, 0xDC, 0xDD, 0xDD, 0xFF, 0xFF, 0xFF, 0xFC, 0xFF, 0xFE, 0xDE, 0xDD,
+ 0xDD, 0xDE, 0xFF, 0xFF, 0xFF, 0xFF, 0x9C, 0xDD, 0xDD, 0xDF, 0xDE, 0xEE,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFE, 0xDC, 0xCC, 0xCC, 0xCC, 0xCD, 0xDD, 0xDE, 0xBF, 0xFF,
+ 0xFE, 0xDC, 0xCC, 0xBB, 0xBC, 0xCC, 0xDD, 0xEF, 0xFF, 0xFF, 0xFD, 0xCC,
+ 0xBB, 0xAA, 0xAA, 0xAB, 0xBC, 0xCD, 0xEF, 0xEF, 0xFD, 0xCB, 0xAA, 0x99,
+ 0x99, 0x99, 0xAA, 0xBC, 0xDD, 0xFE, 0xFE, 0xCB, 0xA9, 0x98, 0x88, 0x88,
+ 0x89, 0x9A, 0xBC, 0xDF, 0xDD, 0xDC, 0xA9, 0x88, 0x77, 0x77, 0x77, 0x89,
+ 0x9A, 0xBC, 0xDD, 0xDC, 0xBA, 0x98, 0x76, 0x66, 0x66, 0x77, 0x89, 0xAB,
+ 0xCD, 0xDC, 0xCB, 0x98, 0x76, 0x65, 0x55, 0x56, 0x77, 0x89, 0xAC, 0xDD,
+ 0xCC, 0xA9, 0x87, 0x65, 0x55, 0x55, 0x66, 0x78, 0x9A, 0xBD, 0xDC, 0xBA,
+ 0x98, 0x76, 0x55, 0x44, 0x55, 0x67, 0x89, 0xAB, 0xDD, 0xCB, 0xA9, 0x87,
+ 0x65, 0x54, 0x45, 0x56, 0x78, 0x9A, 0xBD, 0xDC, 0xBA, 0x98, 0x76, 0x65,
+ 0x55, 0x55, 0x67, 0x89, 0xAC, 0xDE, 0xCC, 0xA9, 0x87, 0x76, 0x65, 0x55,
+ 0x66, 0x78, 0x9B, 0xCD, 0xEC, 0xCB, 0xA9, 0x87, 0x76, 0x66, 0x66, 0x78,
+ 0x9A, 0xBC, 0xEF, 0xCC, 0xBA, 0x99, 0x87, 0x77, 0x77, 0x78, 0x89, 0xAC,
+ 0xDF, 0xFD, 0xDC, 0xBA, 0x99, 0x88, 0x88, 0x88, 0x99, 0xAB, 0xCE, 0xFF,
+ 0xDD, 0xDC, 0xBA, 0xA9, 0x99, 0x99, 0x9A, 0xBB, 0xCD, 0xFF, 0xFD, 0xED,
+ 0xCC, 0xBB, 0xAA, 0xAA, 0xAB, 0xBC, 0xDD, 0xFF, 0xFF, 0xDF, 0xED, 0xDC,
+ 0xCC, 0xBB, 0xBC, 0xCC, 0xDE, 0xFF, 0xFF, 0xFE, 0xFF, 0xEE, 0xDD, 0xDC,
+ 0xDD, 0xDD, 0xEF, 0xFF, 0xFF, 0xFF, 0xBE, 0xED, 0xDD, 0xDD, 0xDD, 0xDD,
+ 0xEF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFE, 0xDD, 0xFD, 0xEC, 0xDC, 0xCD, 0xCE, 0x9F, 0xFF,
+ 0xFF, 0xFD, 0xDD, 0xCC, 0xDC, 0xDD, 0xDE, 0xEF, 0xFD, 0xFF, 0xFF, 0xED,
+ 0xDC, 0xCB, 0xBB, 0xCC, 0xCC, 0xDD, 0xEF, 0xDF, 0xFE, 0xDD, 0xCB, 0xAA,
+ 0xAA, 0xAA, 0xBC, 0xCD, 0xDD, 0xFD, 0xFF, 0xDC, 0xBA, 0x99, 0x98, 0x99,
+ 0x9A, 0xAB, 0xCC, 0xDD, 0xDF, 0xED, 0xBA, 0x98, 0x87, 0x77, 0x88, 0x9A,
+ 0xAB, 0xCD, 0xFD, 0xED, 0xCB, 0x98, 0x77, 0x66, 0x67, 0x78, 0x9A, 0xAC,
+ 0xDD, 0xDD, 0xEB, 0xA9, 0x87, 0x65, 0x55, 0x66, 0x78, 0x9A, 0xBC, 0xDD,
+ 0xDD, 0xBA, 0x97, 0x65, 0x54, 0x45, 0x67, 0x89, 0xAB, 0xDE, 0xDD, 0xCB,
+ 0xA9, 0x76, 0x54, 0x44, 0x45, 0x67, 0x8A, 0xBC, 0xFD, 0xDD, 0xBA, 0x97,
+ 0x65, 0x44, 0x44, 0x56, 0x78, 0xAB, 0xCD, 0xDD, 0xDC, 0xA9, 0x87, 0x65,
+ 0x44, 0x55, 0x67, 0x9A, 0xBD, 0xEE, 0xDD, 0xBA, 0x98, 0x76, 0x65, 0x55,
+ 0x67, 0x89, 0xAC, 0xDD, 0xED, 0xDC, 0xBA, 0x98, 0x77, 0x66, 0x67, 0x78,
+ 0x9B, 0xCF, 0xFE, 0xDD, 0xDB, 0xAA, 0x98, 0x87, 0x77, 0x88, 0x9A, 0xBD,
+ 0xDF, 0xFD, 0xDD, 0xBB, 0xA9, 0x99, 0x89, 0x89, 0xAA, 0xBD, 0xEE, 0xFF,
+ 0xDE, 0xDC, 0xBB, 0xAA, 0xAA, 0xAA, 0xAB, 0xBD, 0xDF, 0xFF, 0xFD, 0xDD,
+ 0xDC, 0xCB, 0xBB, 0xBB, 0xBC, 0xCD, 0xDF, 0xFF, 0xFF, 0xDE, 0xDD, 0xDC,
+ 0xCC, 0xCC, 0xCC, 0xDD, 0xFE, 0xFF, 0xFF, 0xFC, 0xFF, 0xDF, 0xFE, 0xDE,
+ 0xDD, 0xDF, 0xFF, 0xFF, 0xFF, 0xFF, 0x9C, 0xCC, 0xDC, 0xDC, 0xDD, 0xDD,
+ 0xDD, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFC, 0xBB, 0xBB, 0xCB, 0x7F, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFC, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFD, 0xFF, 0xCF, 0xFF, 0xFF, 0xFF, 0xDF, 0xFF, 0xFF, 0xFD, 0xFF,
+ 0xCD, 0xDC, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFC, 0xBB, 0xCC,
+ 0xCC, 0xCD, 0xFF, 0xFF, 0xDF, 0xFF, 0xFF, 0xCB, 0xAA, 0xA9, 0xAB, 0xBD,
+ 0xCF, 0xFF, 0xFF, 0xFF, 0xFF, 0xCC, 0xA9, 0x88, 0x88, 0x9A, 0xBC, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFC, 0xB9, 0x76, 0x66, 0x78, 0x9B, 0xCD, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xCA, 0x86, 0x54, 0x45, 0x79, 0xAB, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFB, 0xA8, 0x64, 0x22, 0x46, 0x8A, 0xCF, 0xFF, 0xFF, 0xFF, 0xFD, 0xBA,
+ 0x86, 0x42, 0x24, 0x68, 0xAB, 0xDF, 0xFF, 0xFF, 0xFF, 0xDC, 0xB8, 0x75,
+ 0x44, 0x56, 0x8A, 0xCF, 0xFF, 0xFF, 0xDF, 0xFD, 0xCB, 0x98, 0x76, 0x67,
+ 0x89, 0xBC, 0xFF, 0xFF, 0xFF, 0xFF, 0xFD, 0xBA, 0xA9, 0x88, 0x89, 0xBB,
+ 0xCF, 0xFF, 0xFF, 0xDF, 0xFF, 0xCC, 0xBB, 0xAA, 0xAA, 0xBC, 0xDF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFD, 0xCC, 0xCC, 0xBC, 0xCC, 0xCF, 0xFF, 0xFF, 0xFF,
+ 0xCF, 0xFD, 0xFF, 0xCC, 0xDD, 0xFD, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xDD, 0xDF, 0xDF, 0xFF, 0xFF, 0xFF, 0xFF, 0xDF, 0xFF, 0xFF,
+ 0xDF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFC, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7B, 0xCD, 0xDC, 0xCD, 0xDF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xDF, 0xFD, 0xCB, 0xBF, 0xBC, 0xDC, 0xBA, 0xCB, 0xCB, 0x7F, 0xDF,
+ 0xDD, 0xDF, 0xCC, 0xBC, 0xFC, 0xFC, 0xFF, 0xFF, 0xFC, 0xDD, 0xFF, 0xDD,
+ 0xDC, 0xFB, 0xDB, 0xCB, 0xCF, 0xDC, 0xFF, 0xBC, 0xFF, 0xFA, 0xFB, 0xFB,
+ 0xAB, 0xCC, 0xCC, 0xFF, 0xFF, 0xFF, 0xFD, 0xFC, 0xBB, 0xAA, 0xA9, 0x9A,
+ 0xBB, 0xCC, 0xCC, 0xFF, 0xCC, 0xFD, 0xCB, 0x9B, 0x89, 0x88, 0x99, 0xAB,
+ 0xAD, 0xCD, 0xFF, 0xFC, 0xBA, 0xAA, 0x97, 0x77, 0x78, 0x89, 0xAA, 0xBF,
+ 0xFF, 0xCB, 0xFC, 0xB9, 0x97, 0x76, 0x66, 0x77, 0x89, 0xAA, 0xFC, 0xFB,
+ 0xBC, 0xBB, 0xA9, 0x76, 0x54, 0x55, 0x67, 0x8A, 0xAC, 0xDC, 0xDD, 0xCC,
+ 0xB9, 0x97, 0x64, 0x23, 0x46, 0x78, 0x9C, 0xCB, 0xFC, 0xCF, 0xBB, 0xA8,
+ 0x76, 0x43, 0x24, 0x67, 0x99, 0xAC, 0xCF, 0xCF, 0xBC, 0xC9, 0x97, 0x65,
+ 0x44, 0x56, 0x78, 0x9A, 0xCD, 0xFF, 0xDC, 0xCA, 0xA9, 0x87, 0x66, 0x66,
+ 0x78, 0x9A, 0xBB, 0xFF, 0xFF, 0xFF, 0xCB, 0xA9, 0x87, 0x77, 0x77, 0x8A,
+ 0xBC, 0xBC, 0xFC, 0xFC, 0xCF, 0xCC, 0x99, 0x98, 0x88, 0x99, 0x9A, 0xCF,
+ 0xCF, 0xFF, 0xFF, 0xFC, 0xCB, 0xAA, 0x9A, 0xA9, 0xAA, 0xCF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFE, 0xEC, 0xAA, 0xAB, 0xAC, 0xCC, 0xDF, 0xFF, 0xFC, 0xDF,
+ 0xCD, 0xCD, 0xBC, 0xCB, 0xCF, 0xFB, 0xDC, 0xFD, 0xFF, 0xDF, 0xFF, 0xDC,
+ 0xFD, 0xDC, 0xFC, 0xDF, 0xDD, 0xCF, 0xFF, 0xFA, 0xDC, 0xDF, 0xFD, 0xFD,
+ 0xCD, 0xDF, 0xDF, 0xDD, 0xDF, 0xFF, 0x6C, 0xBB, 0xCC, 0xCC, 0xDB, 0xFD,
+ 0xCF, 0xFF, 0xDD, 0xFF, 0xD0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xBC, 0xCB, 0xAA, 0xAA, 0x99, 0x99, 0xA9, 0xAA, 0xAA, 0xAB, 0x8C, 0xCC,
+ 0xBB, 0xBA, 0xAA, 0xAA, 0xAA, 0xAB, 0xCB, 0xCD, 0xDB, 0xBC, 0xCA, 0xBA,
+ 0x9A, 0x99, 0x99, 0x9A, 0xAA, 0xBB, 0xCE, 0xCB, 0xBB, 0xAA, 0x99, 0x98,
+ 0x88, 0x89, 0x9A, 0xAB, 0xBC, 0xCB, 0xBB, 0xA9, 0x98, 0x88, 0x88, 0x88,
+ 0x89, 0x99, 0xAB, 0xBC, 0xBA, 0xBA, 0x98, 0x87, 0x77, 0x77, 0x78, 0x89,
+ 0x9A, 0xAB, 0xCB, 0xAB, 0xA9, 0x87, 0x77, 0x66, 0x67, 0x77, 0x89, 0x9A,
+ 0xBC, 0xBA, 0xA9, 0x98, 0x76, 0x66, 0x66, 0x66, 0x77, 0x89, 0x9A, 0xBB,
+ 0xAA, 0x98, 0x87, 0x66, 0x55, 0x56, 0x67, 0x78, 0x89, 0xAB, 0xBA, 0xA9,
+ 0x88, 0x76, 0x65, 0x44, 0x56, 0x67, 0x88, 0x9A, 0xBB, 0x9A, 0x98, 0x87,
+ 0x66, 0x54, 0x45, 0x56, 0x78, 0x89, 0xAA, 0xB9, 0xA9, 0x88, 0x77, 0x65,
+ 0x55, 0x56, 0x67, 0x88, 0x9A, 0xBB, 0x9A, 0xA9, 0x87, 0x76, 0x66, 0x56,
+ 0x66, 0x78, 0x99, 0xAB, 0xBA, 0xBA, 0x99, 0x87, 0x76, 0x66, 0x66, 0x77,
+ 0x89, 0xAB, 0xCB, 0xAB, 0xA9, 0x98, 0x88, 0x77, 0x77, 0x77, 0x88, 0x9A,
+ 0xBC, 0xDA, 0xBB, 0xA9, 0x98, 0x88, 0x87, 0x88, 0x88, 0x9A, 0xAB, 0xCB,
+ 0xAC, 0xBA, 0xAA, 0x99, 0x98, 0x88, 0x89, 0x99, 0xAB, 0xCD, 0xCA, 0xCB,
+ 0xBA, 0xBA, 0xA9, 0x99, 0x99, 0xAA, 0xAB, 0xCC, 0xDC, 0xBD, 0xCC, 0xBB,
+ 0xBA, 0xAA, 0xBA, 0xAA, 0xBB, 0xBE, 0xED, 0xCB, 0xCC, 0xDD, 0xCB, 0xBB,
+ 0xBB, 0xBB, 0xBB, 0xCD, 0xFE, 0xFE, 0x8C, 0xBB, 0xBB, 0xAA, 0xAB, 0xBB,
+ 0xBB, 0xCC, 0xCD, 0xDD, 0xC0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xBC, 0xBB, 0xAA, 0xA9, 0x99, 0x99, 0x99, 0xAA, 0xAB, 0xBC, 0xAC, 0xCC,
+ 0xBA, 0xAA, 0x99, 0x99, 0x9A, 0xAA, 0xBB, 0xBC, 0xDC, 0xBC, 0xBA, 0xA9,
+ 0x99, 0x98, 0x99, 0x99, 0x9A, 0xAB, 0xBC, 0xBB, 0xBA, 0xA9, 0x98, 0x88,
+ 0x88, 0x88, 0x89, 0x9A, 0xAB, 0xCB, 0xAB, 0xA9, 0x98, 0x87, 0x77, 0x77,
+ 0x88, 0x89, 0x9A, 0xBB, 0xBA, 0xA9, 0x98, 0x77, 0x77, 0x77, 0x77, 0x78,
+ 0x89, 0x9A, 0xBA, 0xAA, 0x98, 0x87, 0x76, 0x66, 0x66, 0x77, 0x78, 0x89,
+ 0xAB, 0xA9, 0xA9, 0x87, 0x76, 0x66, 0x66, 0x66, 0x77, 0x88, 0x9A, 0xAA,
+ 0x99, 0x98, 0x77, 0x66, 0x65, 0x66, 0x66, 0x77, 0x89, 0x9A, 0xA9, 0x99,
+ 0x87, 0x76, 0x65, 0x55, 0x66, 0x67, 0x78, 0x99, 0xAA, 0x99, 0x88, 0x77,
+ 0x66, 0x65, 0x55, 0x66, 0x77, 0x88, 0x9A, 0xA9, 0x99, 0x87, 0x76, 0x66,
+ 0x65, 0x66, 0x67, 0x78, 0x99, 0xAA, 0x99, 0x98, 0x87, 0x76, 0x66, 0x66,
+ 0x66, 0x77, 0x89, 0xAA, 0xA9, 0xA9, 0x88, 0x77, 0x76, 0x66, 0x66, 0x77,
+ 0x88, 0x9A, 0xBA, 0xAA, 0x99, 0x88, 0x77, 0x77, 0x77, 0x77, 0x88, 0x99,
+ 0xAB, 0xBA, 0xAA, 0x99, 0x88, 0x87, 0x77, 0x77, 0x88, 0x99, 0xAB, 0xBB,
+ 0xAB, 0xAA, 0x99, 0x88, 0x88, 0x88, 0x88, 0x99, 0xAA, 0xBC, 0xCB, 0xBB,
+ 0xAA, 0x99, 0x99, 0x98, 0x99, 0x99, 0xAA, 0xBC, 0xDC, 0xBC, 0xBB, 0xBA,
+ 0xAA, 0x99, 0x99, 0x9A, 0xAB, 0xBC, 0xCD, 0xDC, 0xDC, 0xCB, 0xBA, 0xAA,
+ 0xAA, 0xAA, 0xAB, 0xBC, 0xCD, 0xED, 0xAC, 0xBB, 0xBA, 0xAA, 0xAA, 0xAA,
+ 0xAA, 0xBB, 0xCC, 0xDE, 0xD0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xBC, 0xBA, 0xBA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xBB, 0x8C, 0xCC,
+ 0xBB, 0xBA, 0xAA, 0xAA, 0xBB, 0xBB, 0xCD, 0xDC, 0xDB, 0xBC, 0xBC, 0xA9,
+ 0x99, 0x99, 0x99, 0x9A, 0xAA, 0xBB, 0xCC, 0xAB, 0xCA, 0xAA, 0x98, 0x88,
+ 0x88, 0x89, 0x99, 0xAA, 0xCC, 0xBA, 0xBB, 0xA9, 0x98, 0x88, 0x78, 0x88,
+ 0x88, 0x99, 0xAA, 0xBB, 0xAA, 0xAA, 0x98, 0x87, 0x77, 0x77, 0x77, 0x88,
+ 0x99, 0xAA, 0xBA, 0xBA, 0x98, 0x87, 0x76, 0x66, 0x67, 0x77, 0x88, 0x9A,
+ 0xBA, 0xAA, 0xA9, 0x88, 0x76, 0x66, 0x66, 0x66, 0x77, 0x88, 0xAA, 0xAA,
+ 0xAA, 0x98, 0x87, 0x66, 0x55, 0x56, 0x67, 0x78, 0x99, 0xAA, 0xAA, 0xA9,
+ 0x88, 0x76, 0x65, 0x44, 0x56, 0x67, 0x88, 0x9A, 0xAA, 0x9A, 0x98, 0x87,
+ 0x66, 0x54, 0x45, 0x66, 0x78, 0x89, 0xAB, 0xAA, 0xB9, 0x98, 0x76, 0x66,
+ 0x55, 0x56, 0x67, 0x88, 0x9A, 0xBA, 0xAA, 0x99, 0x88, 0x77, 0x66, 0x66,
+ 0x66, 0x78, 0x99, 0xAB, 0xBA, 0xAA, 0x98, 0x87, 0x77, 0x66, 0x66, 0x77,
+ 0x89, 0x9A, 0xBB, 0xAB, 0xA9, 0x98, 0x87, 0x77, 0x77, 0x77, 0x89, 0x9A,
+ 0xBB, 0xAB, 0xDA, 0xA9, 0x98, 0x88, 0x77, 0x88, 0x88, 0x9A, 0xAC, 0xBB,
+ 0xBC, 0xAB, 0xA9, 0x99, 0x98, 0x88, 0x89, 0x9A, 0xAA, 0xBD, 0xCB, 0xBB,
+ 0xBB, 0xA9, 0xA9, 0x99, 0x99, 0xAA, 0xAC, 0xBC, 0xCC, 0xBC, 0xCC, 0xBA,
+ 0xAA, 0xAA, 0xAA, 0xAA, 0xAB, 0xBC, 0xCD, 0xCB, 0xCD, 0xBB, 0xCB, 0xBA,
+ 0xBB, 0xBB, 0xAC, 0xBB, 0xDD, 0xDD, 0x7A, 0xAA, 0xAA, 0xBA, 0xAA, 0xAA,
+ 0xAB, 0xBB, 0xBB, 0xCD, 0xB0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFC, 0xBF, 0xDF, 0xBB, 0xAB, 0xBF, 0x6F, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xDF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFD, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xCC, 0xFD, 0xFF, 0xDF, 0xFF, 0xFF, 0xDF, 0xFF, 0xFF, 0xFF, 0xFC,
+ 0xBB, 0xDF, 0xFC, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xBC, 0xBF,
+ 0xCF, 0xBF, 0xFF, 0xFF, 0xFD, 0xFF, 0xFD, 0xFF, 0xBB, 0xBA, 0xAB, 0xFC,
+ 0xFC, 0xFF, 0xFF, 0xFF, 0xFF, 0xDC, 0xCA, 0x99, 0x99, 0xAC, 0xDF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xCD, 0xBA, 0x87, 0x77, 0x89, 0x9B, 0xBF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xCB, 0x97, 0x54, 0x46, 0x8A, 0xDB, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xCD, 0xA9, 0x64, 0x12, 0x57, 0x9B, 0xBF, 0xDF, 0xFF, 0xFF, 0xFF, 0xBA,
+ 0x97, 0x52, 0x24, 0x79, 0xAB, 0xCF, 0xFF, 0xFF, 0xFF, 0xFC, 0xA9, 0x86,
+ 0x54, 0x57, 0x9B, 0xFD, 0xFF, 0xFD, 0xFF, 0xFC, 0xCC, 0xA9, 0x87, 0x77,
+ 0x8A, 0xAC, 0xDF, 0xFF, 0xFF, 0xFF, 0xFF, 0xBB, 0x99, 0x99, 0x9A, 0xAF,
+ 0xCF, 0xFF, 0xFF, 0xDF, 0xFF, 0xBF, 0xAC, 0xBA, 0xAA, 0xCC, 0xBF, 0xFF,
+ 0xFF, 0xFD, 0xFF, 0xFF, 0xCB, 0xBC, 0xBB, 0xDF, 0xDD, 0xFF, 0xFF, 0xFF,
+ 0xDF, 0xFF, 0xDF, 0xFC, 0xCD, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFD, 0xFD, 0xDF, 0xFC, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xCF, 0xFF, 0xFD,
+ 0xDF, 0xFC, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFD, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x6B, 0xCF, 0xDF, 0xDF, 0xFF, 0xCF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xAF, 0xFF, 0xBF, 0xAB, 0xFB, 0x9F, 0xBB, 0xAB, 0x6B, 0xFF,
+ 0xFB, 0xFF, 0xAF, 0xAA, 0xFB, 0xFA, 0xBB, 0xFF, 0xFF, 0xFF, 0xFB, 0xBF,
+ 0xB9, 0xFB, 0xBA, 0xBB, 0xBF, 0xFF, 0xFF, 0xFA, 0xFF, 0xFA, 0xFB, 0xBB,
+ 0xAA, 0xFF, 0xFA, 0xBF, 0xBF, 0xFF, 0xBF, 0xFA, 0xAF, 0xBB, 0x99, 0x9A,
+ 0xA9, 0xBF, 0xFB, 0xFB, 0xAB, 0xFB, 0xBA, 0xA9, 0x98, 0x9A, 0x99, 0xAA,
+ 0xFB, 0xBB, 0xFF, 0xAF, 0xFA, 0xAA, 0x98, 0x78, 0x78, 0x89, 0xAF, 0xBF,
+ 0xAF, 0xFB, 0xBF, 0xBA, 0x99, 0x76, 0x66, 0x88, 0x99, 0xBF, 0xFF, 0xBF,
+ 0xFF, 0xFA, 0x98, 0x77, 0x54, 0x56, 0x79, 0x9B, 0xBF, 0xBB, 0xBB, 0xAF,
+ 0xAB, 0xA8, 0x64, 0x22, 0x57, 0x88, 0x9A, 0xFF, 0xAB, 0xAF, 0x99, 0xB8,
+ 0x77, 0x52, 0x25, 0x79, 0xA9, 0xAA, 0xFF, 0xFA, 0xBB, 0xBA, 0x98, 0x76,
+ 0x54, 0x66, 0x78, 0x99, 0xBF, 0xFB, 0x9F, 0xFA, 0x9A, 0x98, 0x76, 0x66,
+ 0x78, 0x8A, 0xFA, 0xAB, 0xAF, 0xFB, 0xBA, 0xB8, 0x98, 0x88, 0x78, 0x9A,
+ 0xAB, 0xFF, 0xFB, 0xAF, 0xBF, 0xBA, 0xAA, 0x99, 0xA9, 0x9F, 0x8A, 0xFA,
+ 0xFF, 0xAA, 0xFF, 0xBB, 0xAF, 0xA9, 0xA8, 0x89, 0xAB, 0xFA, 0xBB, 0xFF,
+ 0xFB, 0xFF, 0xFF, 0xFB, 0xA9, 0xAB, 0xAF, 0xBF, 0xBB, 0xBB, 0xBB, 0xFF,
+ 0xBF, 0xFB, 0xFF, 0xFA, 0xBF, 0xAF, 0xAF, 0xFB, 0xFF, 0xAF, 0xBF, 0xFF,
+ 0xFF, 0xBB, 0xFF, 0xFF, 0xBF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFB, 0xFF, 0xFB, 0xFF, 0xFF, 0xFB, 0x6F, 0xAA, 0xAB, 0xAB, 0xBA, 0xFA,
+ 0xFA, 0xBB, 0xFF, 0xFB, 0xF0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xDE, 0xFF, 0xFF, 0xFF, 0xDC, 0xCC, 0xCF, 0xCD, 0xCF, 0x6F, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xDF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xDC, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFD, 0xCD, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xCF, 0xDC,
+ 0xFC, 0xDF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xDD, 0xCC, 0xDC, 0xDD,
+ 0xDF, 0xFF, 0xFF, 0xFF, 0xFF, 0xCF, 0xEB, 0xBA, 0xBB, 0xBC, 0xDD, 0xFD,
+ 0xDF, 0xFC, 0xFF, 0xDD, 0xCB, 0x98, 0x78, 0x9A, 0xCC, 0xFF, 0xFF, 0xFF,
+ 0xDF, 0xFF, 0xFD, 0xB8, 0x54, 0x46, 0x9B, 0xCD, 0xDF, 0xFF, 0xFF, 0xFF,
+ 0xCD, 0xDA, 0x74, 0x22, 0x48, 0xAC, 0xFC, 0xFF, 0xFF, 0xFF, 0xFF, 0xFC,
+ 0xA7, 0x42, 0x14, 0x7A, 0xDF, 0xFF, 0xFF, 0xDD, 0xFF, 0xFD, 0xDA, 0x96,
+ 0x44, 0x58, 0xBC, 0xFD, 0xFF, 0xFF, 0xFF, 0xDF, 0xFC, 0xDA, 0x97, 0x78,
+ 0xAC, 0xDD, 0xFF, 0xFF, 0xFF, 0xFF, 0xFC, 0xFC, 0xCA, 0xAA, 0xAB, 0xCF,
+ 0xFF, 0xFD, 0xFF, 0xDF, 0xFF, 0xFD, 0xFC, 0xDC, 0xBC, 0xCD, 0xDF, 0xDF,
+ 0xFF, 0xFC, 0xFF, 0xFD, 0xFF, 0xDF, 0xCC, 0xFD, 0xFD, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFC, 0xDF, 0xFF, 0xFD, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xDD, 0xFF, 0xFF, 0xCF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xDF, 0xFF, 0xFF, 0xDF, 0xFF, 0xFF, 0xFF, 0xFC, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x6B, 0xDD, 0xCD, 0xDD, 0xFF, 0xDF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xDD, 0xDD, 0xCD, 0xDD, 0xDE, 0xDF, 0xFF, 0xCF, 0xFF,
+ 0xFF, 0xDC, 0xCC, 0xCB, 0xCC, 0xBD, 0xEE, 0xEF, 0xFF, 0xFF, 0xFF, 0xDC,
+ 0xBB, 0xBA, 0xAA, 0xBB, 0xCC, 0xDF, 0xEF, 0xFF, 0xFD, 0xCC, 0xBA, 0x99,
+ 0x99, 0x99, 0xAA, 0xBC, 0xDF, 0xFF, 0xFE, 0xDC, 0xAA, 0x98, 0x88, 0x88,
+ 0x89, 0xAB, 0xBC, 0xDE, 0xFF, 0xDC, 0xB9, 0x98, 0x77, 0x77, 0x77, 0x89,
+ 0xAA, 0xCC, 0xFF, 0xFC, 0xCA, 0x98, 0x76, 0x66, 0x66, 0x77, 0x89, 0xAB,
+ 0xCD, 0xFE, 0xCB, 0xA8, 0x76, 0x65, 0x55, 0x56, 0x77, 0x99, 0xBC, 0xDE,
+ 0xDC, 0xB9, 0x87, 0x65, 0x55, 0x55, 0x66, 0x78, 0x9A, 0xCD, 0xDC, 0xCA,
+ 0x98, 0x76, 0x55, 0x44, 0x55, 0x67, 0x89, 0xAB, 0xDD, 0xCC, 0xA9, 0x87,
+ 0x65, 0x54, 0x45, 0x56, 0x78, 0x9A, 0xCD, 0xEC, 0xCA, 0x98, 0x76, 0x55,
+ 0x55, 0x55, 0x67, 0x89, 0xAB, 0xDF, 0xCC, 0xB9, 0x87, 0x76, 0x55, 0x55,
+ 0x66, 0x78, 0xAB, 0xCF, 0xFD, 0xCB, 0xA9, 0x87, 0x76, 0x66, 0x66, 0x78,
+ 0x9A, 0xBC, 0xFF, 0xDD, 0xCA, 0xA9, 0x87, 0x77, 0x77, 0x78, 0x9A, 0xBC,
+ 0xDF, 0xFD, 0xDC, 0xBA, 0xA9, 0x88, 0x88, 0x88, 0x9A, 0xAC, 0xDF, 0xFF,
+ 0xFF, 0xDC, 0xBA, 0xA9, 0x99, 0x99, 0xAA, 0xBB, 0xDF, 0xFF, 0xFF, 0xFF,
+ 0xDD, 0xCB, 0xBA, 0xAA, 0xAB, 0xBC, 0xDF, 0xFF, 0xFF, 0xFF, 0xFF, 0xDC,
+ 0xDC, 0xCC, 0xCC, 0xCD, 0xDE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xEE, 0xDD,
+ 0xDD, 0xDE, 0xEF, 0xFF, 0xFF, 0xFF, 0xDF, 0xFF, 0xFE, 0xFE, 0xDD, 0xEF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xCF, 0xFE, 0xFD, 0xDC, 0xCF, 0xFD, 0xED, 0xCC, 0xBC, 0xEC, 0x7F, 0xEF,
+ 0xFF, 0xEF, 0xEF, 0xEE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFD, 0xDF, 0xDD, 0xFF,
+ 0xDD, 0xFD, 0xEF, 0xEF, 0xEE, 0xEF, 0xFF, 0xCF, 0xEF, 0xFF, 0xDF, 0xEF,
+ 0xDF, 0xDE, 0xEF, 0xEF, 0xFF, 0xFD, 0xEE, 0xFD, 0xFD, 0xDD, 0xDD, 0xCC,
+ 0xDD, 0xEE, 0xFE, 0xFD, 0xED, 0xFF, 0xEE, 0xDC, 0xCC, 0xBC, 0xBC, 0xCE,
+ 0xED, 0xFF, 0xFE, 0xEF, 0xCD, 0xFF, 0xBB, 0xAA, 0xAA, 0xBC, 0xDD, 0xEE,
+ 0xFF, 0xFF, 0xFF, 0xFC, 0xCB, 0x98, 0x77, 0x89, 0xBC, 0xDE, 0xFF, 0xFD,
+ 0xDE, 0xDF, 0xDC, 0xA8, 0x54, 0x46, 0x8A, 0xCF, 0xEF, 0xEF, 0xDC, 0xFF,
+ 0xDC, 0xCA, 0x74, 0x12, 0x47, 0xAC, 0xED, 0xEE, 0xFE, 0xEE, 0xEF, 0xFB,
+ 0xA7, 0x42, 0x24, 0x7A, 0xBD, 0xEE, 0xEF, 0xDE, 0xED, 0xDE, 0xCA, 0x86,
+ 0x44, 0x68, 0xAD, 0xDD, 0xEE, 0xFD, 0xDE, 0xEE, 0xFC, 0xB9, 0x87, 0x78,
+ 0xAB, 0xCF, 0xDD, 0xFF, 0xFD, 0xFF, 0xFC, 0xCC, 0xBA, 0x9A, 0xAB, 0xBE,
+ 0xEF, 0xEF, 0xFD, 0xDF, 0xFF, 0xFD, 0xCC, 0xCC, 0xCC, 0xDC, 0xCD, 0xFF,
+ 0xFF, 0xEF, 0xFF, 0xFE, 0xDE, 0xDD, 0xCC, 0xFD, 0xEF, 0xDF, 0xFF, 0xFE,
+ 0xFF, 0xFF, 0xED, 0xDD, 0xDD, 0xEF, 0xEF, 0xFF, 0xFF, 0xFF, 0xDE, 0xFF,
+ 0xFE, 0xFF, 0xED, 0xFE, 0xFE, 0xFF, 0xEF, 0xFF, 0xFF, 0xCE, 0xEF, 0xFF,
+ 0xFF, 0xFD, 0xDE, 0xFF, 0xEF, 0xFF, 0xFF, 0xFD, 0xFF, 0xEF, 0xFE, 0xEE,
+ 0xFF, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0x7E, 0xDD, 0xCC, 0xCC, 0xCE, 0xCE,
+ 0xCE, 0xED, 0xFF, 0xFF, 0xC0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xF8, 0xFF, 0x8F, 0xF8, 0xF8, 0xF9, 0xF8, 0x5F, 0xFF,
+ 0xF9, 0xF8, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x8F, 0xFF, 0xFF,
+ 0xF8, 0x99, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF9, 0xFF,
+ 0x88, 0x9F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF8, 0xFE, 0x8F, 0x8F,
+ 0x8F, 0xF8, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x88, 0x78, 0xFF, 0xFF,
+ 0xF8, 0x8F, 0xFF, 0xFF, 0xFF, 0xF9, 0x8F, 0xF8, 0xF9, 0xF9, 0x8F, 0xFF,
+ 0x8F, 0x8F, 0xF8, 0x89, 0x8F, 0x68, 0x68, 0x88, 0x88, 0xF8, 0xFF, 0xFF,
+ 0xFF, 0xF8, 0x88, 0x78, 0x64, 0x56, 0xFF, 0x8F, 0xF8, 0xFF, 0xFF, 0xF8,
+ 0xFF, 0x88, 0x64, 0x22, 0x48, 0x88, 0x8F, 0xFF, 0xFF, 0xE9, 0x8F, 0xFF,
+ 0xF7, 0x52, 0x25, 0x78, 0x8F, 0xF8, 0xFF, 0xFF, 0x9F, 0xFF, 0xF8, 0x87,
+ 0x44, 0x58, 0x8F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF9, 0x8F, 0xF7, 0x76,
+ 0x88, 0xF9, 0xFF, 0xFF, 0x9F, 0xFF, 0xFF, 0xFF, 0x79, 0x88, 0xF9, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF8, 0xFF, 0xF8, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xF8, 0xFF, 0xFF, 0x98, 0xFF, 0xFF, 0x8F, 0xF9, 0xFF, 0x8F, 0xFF, 0xFF,
+ 0x8F, 0xFF, 0xFF, 0xF8, 0xFF, 0x98, 0xF8, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0x8F, 0xFF, 0xFF, 0xFF, 0x9F, 0xFF, 0x8F, 0xFF, 0xFF,
+ 0xFF, 0x8F, 0xFF, 0x8F, 0xFF, 0xF8, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0x8F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x6F, 0x99, 0xFF, 0xCF, 0xF8, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0x7F, 0x87, 0x87, 0x66, 0x68, 0x87, 0x77, 0x77, 0x68, 0xFF, 0x57, 0xFF,
+ 0x88, 0xFF, 0x88, 0x88, 0x8F, 0x88, 0xFF, 0xFF, 0xF8, 0x6F, 0xF7, 0x78,
+ 0xF8, 0x8F, 0x87, 0x78, 0x87, 0xFF, 0xF7, 0x87, 0xF7, 0xF8, 0x7F, 0xF8,
+ 0x88, 0x88, 0x87, 0x88, 0x8F, 0x87, 0xF8, 0x88, 0xF7, 0xF7, 0xFF, 0x8F,
+ 0x88, 0x7F, 0x8F, 0xF8, 0xF7, 0x8F, 0x8F, 0xF7, 0x77, 0xF7, 0x68, 0x8F,
+ 0x8F, 0xFF, 0xF7, 0x69, 0x8F, 0x88, 0x76, 0x78, 0x6F, 0x77, 0x6F, 0xFF,
+ 0x7F, 0x88, 0xF8, 0x8F, 0xF7, 0x87, 0x88, 0xF7, 0x7F, 0xF8, 0x8F, 0x77,
+ 0x68, 0x87, 0xF7, 0x86, 0x87, 0x67, 0x67, 0x7F, 0x78, 0xF8, 0x77, 0x77,
+ 0x88, 0x67, 0xF7, 0x76, 0x88, 0x78, 0x77, 0xFF, 0x8F, 0x7F, 0x88, 0x87,
+ 0x67, 0x67, 0x77, 0x77, 0x78, 0x8F, 0x7F, 0x77, 0x7F, 0x87, 0x76, 0x68,
+ 0x87, 0x77, 0x67, 0x7F, 0x7E, 0xE8, 0xCB, 0x88, 0x7F, 0xF7, 0x77, 0x87,
+ 0x6F, 0x8F, 0x87, 0x7F, 0x68, 0x88, 0xF7, 0x88, 0xF7, 0xF6, 0x87, 0xF8,
+ 0x87, 0xFF, 0xF7, 0x88, 0xF8, 0x8F, 0x8F, 0xF7, 0x88, 0x7F, 0xFF, 0x8F,
+ 0xFF, 0x77, 0xF8, 0x88, 0x78, 0x8F, 0xF7, 0x78, 0x77, 0x88, 0x8F, 0xF7,
+ 0x8F, 0xF8, 0xFF, 0xF8, 0x8F, 0x88, 0x78, 0x77, 0x7F, 0xF8, 0x78, 0xF8,
+ 0x88, 0x88, 0x7F, 0x8F, 0x7F, 0x8F, 0xA7, 0x78, 0x7F, 0xFF, 0xFF, 0x87,
+ 0x8F, 0x78, 0x87, 0x8F, 0x8F, 0x87, 0x8F, 0x77, 0xF8, 0xF7, 0x88, 0x8F,
+ 0x8F, 0xFF, 0xF8, 0x87, 0x7F, 0xF8, 0x8F, 0x87, 0x8F, 0x87, 0x78, 0x7F,
+ 0xF7, 0x77, 0x78, 0xF8, 0x70, 0x00, 0x00, 0x00,
+ },
+ {
+ 0x57, 0x78, 0x66, 0x77, 0x66, 0x76, 0x77, 0x76, 0x87, 0x79, 0x68, 0xAD,
+ 0x98, 0x89, 0x98, 0xDA, 0xB9, 0x99, 0x99, 0x9D, 0x98, 0x79, 0xAA, 0x89,
+ 0x98, 0x88, 0x88, 0x98, 0xAA, 0x88, 0x9A, 0x87, 0x89, 0xA9, 0x99, 0x89,
+ 0x98, 0x98, 0x99, 0x89, 0xA9, 0x99, 0x7A, 0x88, 0x79, 0x98, 0x88, 0x87,
+ 0x87, 0x98, 0x88, 0x9A, 0x76, 0x98, 0x77, 0x88, 0x87, 0x97, 0x88, 0x98,
+ 0x98, 0x99, 0x88, 0x79, 0x89, 0x99, 0x78, 0x87, 0x88, 0x88, 0x89, 0xA9,
+ 0x98, 0x87, 0x99, 0x87, 0x78, 0x78, 0x87, 0x87, 0x87, 0x97, 0x99, 0x97,
+ 0x79, 0x98, 0x98, 0x78, 0x87, 0x98, 0x87, 0x78, 0x88, 0x9A, 0x76, 0x99,
+ 0x77, 0x78, 0x78, 0x77, 0x87, 0x78, 0x88, 0x99, 0xA7, 0x79, 0x88, 0x89,
+ 0x87, 0x77, 0x87, 0x88, 0x78, 0x88, 0x89, 0x77, 0x88, 0x97, 0x88, 0x87,
+ 0x87, 0x67, 0x88, 0x89, 0x89, 0x88, 0x79, 0x89, 0x88, 0x78, 0x87, 0x77,
+ 0x77, 0x78, 0x89, 0x8A, 0x76, 0x89, 0x97, 0x77, 0x97, 0x87, 0x77, 0x99,
+ 0x89, 0x99, 0x96, 0x6A, 0xA8, 0x88, 0x88, 0x88, 0x89, 0x87, 0x88, 0x88,
+ 0x99, 0x87, 0x9A, 0xA8, 0x88, 0x98, 0x78, 0x88, 0x88, 0x88, 0x99, 0x98,
+ 0x79, 0x99, 0x88, 0x88, 0x98, 0x88, 0x87, 0x88, 0x88, 0xA9, 0x78, 0xAA,
+ 0x98, 0x98, 0xA8, 0x88, 0x88, 0x88, 0x88, 0x88, 0xA7, 0x8A, 0x98, 0x89,
+ 0x8A, 0x88, 0x88, 0x9A, 0x89, 0x89, 0x99, 0x78, 0xA9, 0x99, 0xD8, 0x89,
+ 0x98, 0x8A, 0x89, 0x98, 0xAA, 0x87, 0x69, 0x88, 0x87, 0x87, 0x78, 0x77,
+ 0x67, 0x87, 0x77, 0x79, 0x50, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x6F, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xAB, 0xBF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0x85, 0x68, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xF5, 0x12, 0x6F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0x61, 0x15, 0xBF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF8,
+ 0x65, 0x9F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xBB, 0xAF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xBF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x6F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFB, 0xBB, 0xFF, 0x6F, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xEF, 0xFF, 0xFB,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xA9, 0x99, 0xBF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x97, 0x66, 0x88, 0xBF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFB, 0xB7, 0x53, 0x45, 0x7A, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xF9, 0x63, 0x22, 0x46, 0xAF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0x96, 0x42, 0x24, 0x79, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xBA, 0x85,
+ 0x44, 0x57, 0xAF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFA, 0x86, 0x67,
+ 0x9F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFC, 0xF9, 0x99, 0xBF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFB, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFB, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xBF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x6F, 0xBB, 0xBF, 0xFD, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x8F, 0xFF, 0x5F, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFE, 0xEF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, 0x88, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xF6, 0x12, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xF3, 0x07, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF8,
+ 0xBC, 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF8, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0x8F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xF9, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x6F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xEF, 0xFF, 0xFF, 0xE5, 0xEF, 0xFF, 0xFF, 0x3F, 0xFF,
+ 0xEE, 0xEE, 0xE5, 0xEF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE,
+ 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x5F, 0x5E,
+ 0x5E, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE,
+ 0xEE, 0xEE, 0xEE, 0xEF, 0xFF, 0xFF, 0xFF, 0xF4, 0x5F, 0x5F, 0xFF, 0xF5,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x54, 0x55, 0x5F, 0x5F, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0x5F, 0x4F, 0xFF, 0x54, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE,
+ 0xEE, 0xEE, 0x4E, 0xE5, 0xE6, 0xEE, 0x5E, 0xEE, 0xEE, 0xEE, 0xEE, 0xE5,
+ 0xE5, 0xE5, 0xEE, 0x5E, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0x5E,
+ 0xEE, 0x44, 0xEE, 0xEE, 0xEE, 0xEE, 0x5E, 0xEF, 0xFF, 0xF5, 0x45, 0x3F,
+ 0x3F, 0xFF, 0xFF, 0xFF, 0xFF, 0xF5, 0xFF, 0xFF, 0xFF, 0x4F, 0x4F, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x5F, 0x5F, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF5, 0xFF, 0x5F, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x5F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFE, 0xFF, 0xFF, 0xFE, 0xFF, 0xFF, 0xFE, 0xFF, 0xFE, 0xFF, 0xFF,
+ 0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE,
+ 0xFF, 0xFE, 0xFF, 0xFE, 0xF0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x9F, 0xAF, 0x5F, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFB, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFA, 0xFF, 0xAF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x9F, 0xFF, 0xFF,
+ 0xFB, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xAF, 0x99, 0x9B, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xA7, 0x67, 0x7F, 0xAB, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xA7, 0x54, 0x45, 0x79, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0x64, 0x22, 0x47, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xA6, 0x42, 0x23, 0x69, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFA, 0x75,
+ 0x43, 0x57, 0x9F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF9, 0x77, 0x67,
+ 0x9A, 0xBE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFA, 0xF9, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFB, 0xFF, 0xEF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, 0xFF, 0xDF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xBF, 0xBA, 0xAA, 0xAF, 0x5F, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFA, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xBF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFA, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xAF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFA, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFA, 0x99, 0xAA, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFC, 0x65, 0x56, 0xFF, 0xFF, 0xFF, 0xFF, 0xEF, 0xFF,
+ 0xFF, 0xFF, 0x94, 0x12, 0x59, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xF9, 0x52, 0x14, 0x9D, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x97,
+ 0x54, 0x6F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xAA, 0xAA,
+ 0xAF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFA, 0xFA, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0x9F, 0xFF, 0xBF, 0xFB, 0xAF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x9F, 0xFF, 0xFE,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF9, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x6F, 0xF9, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xAA, 0xAF, 0xFF, 0xA9, 0xAA, 0xFF, 0x5F, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xAF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xAF, 0xFF, 0xFB, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x9F,
+ 0xAF, 0xFF, 0xFF, 0xFF, 0xAF, 0xFA, 0xFF, 0xAF, 0xFF, 0xAF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x9F, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xA8, 0xA7, 0x67, 0x7F, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xD7, 0x53, 0x45, 0x7A, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFA, 0x64, 0x22, 0x47, 0xAF, 0xFF, 0xFF, 0xFF, 0xFF, 0xAF, 0xF9,
+ 0x97, 0x42, 0x24, 0x68, 0xAF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFA, 0x76,
+ 0x44, 0x58, 0x9F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x76, 0x67,
+ 0xFF, 0xFA, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF9, 0xA9, 0xAF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xAF, 0xFF, 0xFF, 0xAF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xAF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xCA, 0xAF, 0xFF, 0xFA, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFA, 0xFA, 0xAF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x4F, 0xA9, 0xAF, 0xFF, 0xFA, 0x9F,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0x5F, 0xEF, 0x56, 0x6F, 0xF6, 0x66, 0xEE, 0xEF, 0x6F, 0xFF, 0x56, 0xE6,
+ 0xE6, 0xEE, 0xEE, 0xEF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xEE, 0xE6, 0xEE,
+ 0xEE, 0xEE, 0xE6, 0xEE, 0xEE, 0xEE, 0xEE, 0xEF, 0xFF, 0xFF, 0x6F, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xEE, 0xEE, 0xE6, 0xEE, 0xEE, 0x6E,
+ 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0x6E, 0x4E, 0x6E, 0xEE, 0xEE, 0xEE,
+ 0xE6, 0xEE, 0xEE, 0xEF, 0xF6, 0xF5, 0x6F, 0x56, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xF5, 0xFF, 0xFF, 0xFF, 0xF4, 0x6F, 0x6F, 0xFF, 0xFF, 0xFF, 0xFE,
+ 0xEE, 0xE5, 0xE6, 0x66, 0x65, 0x6E, 0xE5, 0xEE, 0xE6, 0xEE, 0xEE, 0xEE,
+ 0xEE, 0xE5, 0x56, 0x45, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE,
+ 0xE6, 0xE6, 0x65, 0x65, 0xEE, 0xEE, 0xEE, 0xE6, 0xEE, 0xEE, 0xE6, 0x66,
+ 0x6E, 0x6E, 0xEE, 0xEE, 0xE6, 0xEE, 0x6E, 0xEF, 0xF6, 0xF6, 0xFF, 0x56,
+ 0xFF, 0x6F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x55, 0x6F,
+ 0x66, 0xF5, 0xF6, 0xFF, 0xF6, 0xFF, 0xFF, 0xFF, 0xFF, 0x6F, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF6, 0xF5, 0xF6, 0xFF, 0x6F, 0xFE,
+ 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xE6, 0xEE, 0xEE, 0xFE, 0x6E, 0xFE,
+ 0xFF, 0xFE, 0xFF, 0x6E, 0xF6, 0xFE, 0xFF, 0x66, 0xFF, 0xFE, 0xFF, 0xFE,
+ 0xEF, 0xFF, 0xFF, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0x5F, 0xFF, 0xFE, 0xFF, 0xFF, 0x5F, 0xFF, 0x65, 0x6F, 0xF6, 0xFE,
+ 0x66, 0xFE, 0x66, 0x5E, 0x50, 0x00, 0x00, 0x00,
+ },
+ {
+ 0x88, 0x88, 0x88, 0x78, 0x88, 0x88, 0x87, 0x78, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x87, 0x77, 0x78, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x77, 0x77, 0x77, 0x77, 0x78, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x87, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x78, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x78, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x80, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, 0xA8, 0xFF, 0xFF, 0xF7, 0xFF, 0x3F, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xEF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0x8F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFE, 0xDF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF8, 0x76, 0x77, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0x86, 0x54, 0x45, 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xF9, 0x64, 0x22, 0x48, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xF6, 0x42, 0x24, 0x5F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, 0xF5,
+ 0x44, 0x5B, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF7, 0xF6,
+ 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x87, 0x7F, 0x8F,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0x8F,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xEE, 0xEE, 0xEE, 0xDE, 0xEE, 0xEE, 0xED, 0xD5, 0xEE, 0xEE, 0x3E, 0xEE,
+ 0xEE, 0xDD, 0xDD, 0xDE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE,
+ 0xEE, 0xEE, 0xED, 0xDD, 0xDD, 0xDD, 0xDD, 0xDE, 0xEE, 0xEE, 0xEE, 0xEE,
+ 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE,
+ 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xED, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD,
+ 0xDD, 0xDD, 0xDD, 0xDE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE,
+ 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE,
+ 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE,
+ 0xEE, 0xEE, 0xE4, 0x21, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xDD,
+ 0xDD, 0xD1, 0x1D, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD,
+ 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDE, 0xEE, 0xEE, 0xEE, 0xEE,
+ 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE,
+ 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE,
+ 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE,
+ 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE,
+ 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE,
+ 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE,
+ 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE,
+ 0xEE, 0xEE, 0xEE, 0xED, 0xE0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0x88, 0x88, 0x88, 0x78, 0x88, 0x88, 0x87, 0x78, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x87, 0x77, 0x78, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x77, 0x77, 0x77, 0x77, 0x78, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x87, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x78, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x78, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x80, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFE, 0xCF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0x75, 0x4F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xF4, 0x12, 0x47, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0x42, 0x14, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0x54, 0xBF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF9, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x5F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0x88, 0x88, 0x88, 0x78, 0x88, 0x88, 0x87, 0x78, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x87, 0x77, 0x78, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x77, 0x77, 0x77, 0x77, 0x78, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x87, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x78, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x78, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x80, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x4F, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFC, 0xCF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x77, 0x67, 0xAF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xF6, 0x44, 0x45, 0xF7, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xF6, 0x54, 0x22, 0x46, 0x9F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xF5, 0x42, 0x34, 0x5F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x75,
+ 0x43, 0x4F, 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF7, 0x56,
+ 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x6F, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xEE, 0xEE, 0xEE, 0xDE, 0xEE, 0xEE, 0xED, 0xDE, 0xEE, 0xEE, 0xEE, 0xEE,
+ 0xEE, 0xDD, 0xDD, 0xDE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE,
+ 0xEE, 0xEE, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDE, 0xEE, 0xEE, 0xEE, 0xEE,
+ 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE,
+ 0xEE, 0xEE, 0xEE, 0xEE, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD,
+ 0xDD, 0xDD, 0xDD, 0xDE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE,
+ 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE,
+ 0xEE, 0xEE, 0xEE, 0xEE, 0x53, 0x4E, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE,
+ 0xEE, 0xEE, 0xE5, 0x12, 0xEE, 0xEE, 0xEE, 0xEE, 0xED, 0xDD, 0xDD, 0xDD,
+ 0xDD, 0xD2, 0x24, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD,
+ 0xD3, 0x3D, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDE, 0xEE, 0xEE, 0xEE, 0xEE,
+ 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE,
+ 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE,
+ 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE,
+ 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE,
+ 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE,
+ 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE,
+ 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0x3E, 0xE5, 0xEE, 0xEE, 0xEE, 0xEE,
+ 0xEE, 0xEE, 0xEE, 0xED, 0xE0, 0x00, 0x00, 0x00,
+ },
+ {
+ 0x88, 0x88, 0x88, 0x78, 0x88, 0x88, 0x87, 0x78, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x87, 0x77, 0x78, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x77, 0x77, 0x77, 0x77, 0x78, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x87, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x78, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x78, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x80, 0x00, 0x00, 0x00,
+ },
+ {
+ 0x88, 0x88, 0x88, 0x78, 0x88, 0x88, 0x87, 0x78, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x87, 0x77, 0x78, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x77, 0x77, 0x77, 0x77, 0x78, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x87, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x78, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x78, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
+ 0x88, 0x88, 0x88, 0x88, 0x80, 0x00, 0x00, 0x00,
+ },
+ },
+};
+
+#endif /* AVCODEC_RALFDATA_H */
diff --git a/gst-libs/ext/libav/libavcodec/rangecoder.c b/gst-libs/ext/libav/libavcodec/rangecoder.c
index 1cd6762..fcadfe4 100644
--- a/gst-libs/ext/libav/libavcodec/rangecoder.c
+++ b/gst-libs/ext/libav/libavcodec/rangecoder.c
@@ -37,73 +37,75 @@
#include "rangecoder.h"
#include "bytestream.h"
-
-void ff_init_range_encoder(RangeCoder *c, uint8_t *buf, int buf_size){
- c->bytestream_start=
- c->bytestream= buf;
- c->bytestream_end= buf + buf_size;
-
- c->low= 0;
- c->range= 0xFF00;
- c->outstanding_count= 0;
- c->outstanding_byte= -1;
+void ff_init_range_encoder(RangeCoder *c, uint8_t *buf, int buf_size)
+{
+ c->bytestream_start =
+ c->bytestream = buf;
+ c->bytestream_end = buf + buf_size;
+ c->low = 0;
+ c->range = 0xFF00;
+ c->outstanding_count = 0;
+ c->outstanding_byte = -1;
}
-void ff_init_range_decoder(RangeCoder *c, const uint8_t *buf, int buf_size){
+void ff_init_range_decoder(RangeCoder *c, const uint8_t *buf, int buf_size)
+{
/* cast to avoid compiler warning */
- ff_init_range_encoder(c, (uint8_t *) buf, buf_size);
+ ff_init_range_encoder(c, (uint8_t *)buf, buf_size);
c->low = bytestream_get_be16(&c->bytestream);
}
-void ff_build_rac_states(RangeCoder *c, int factor, int max_p){
- const int64_t one= 1LL<<32;
+void ff_build_rac_states(RangeCoder *c, int factor, int max_p)
+{
+ const int64_t one = 1LL << 32;
int64_t p;
int last_p8, p8, i;
memset(c->zero_state, 0, sizeof(c->zero_state));
- memset(c-> one_state, 0, sizeof(c-> one_state));
-
- last_p8= 0;
- p= one/2;
- for(i=0; i<128; i++){
- p8= (256*p + one/2) >> 32; //FIXME try without the one
- if(p8 <= last_p8) p8= last_p8+1;
- if(last_p8 && last_p8<256 && p8<=max_p)
- c->one_state[last_p8]= p8;
-
- p+= ((one-p)*factor + one/2) >> 32;
- last_p8= p8;
+ memset(c->one_state, 0, sizeof(c->one_state));
+
+ last_p8 = 0;
+ p = one / 2;
+ for (i = 0; i < 128; i++) {
+ p8 = (256 * p + one / 2) >> 32; // FIXME: try without the one
+ if (p8 <= last_p8)
+ p8 = last_p8 + 1;
+ if (last_p8 && last_p8 < 256 && p8 <= max_p)
+ c->one_state[last_p8] = p8;
+
+ p += ((one - p) * factor + one / 2) >> 32;
+ last_p8 = p8;
}
- for(i=256-max_p; i<=max_p; i++){
- if(c->one_state[i])
+ for (i = 256 - max_p; i <= max_p; i++) {
+ if (c->one_state[i])
continue;
- p= (i*one + 128) >> 8;
- p+= ((one-p)*factor + one/2) >> 32;
- p8= (256*p + one/2) >> 32; //FIXME try without the one
- if(p8 <= i) p8= i+1;
- if(p8 > max_p) p8= max_p;
- c->one_state[ i]= p8;
+ p = (i * one + 128) >> 8;
+ p += ((one - p) * factor + one / 2) >> 32;
+ p8 = (256 * p + one / 2) >> 32; // FIXME: try without the one
+ if (p8 <= i)
+ p8 = i + 1;
+ if (p8 > max_p)
+ p8 = max_p;
+ c->one_state[i] = p8;
}
- for(i=1; i<255; i++)
- c->zero_state[i]= 256-c->one_state[256-i];
+ for (i = 1; i < 255; i++)
+ c->zero_state[i] = 256 - c->one_state[256 - i];
}
-/**
- *
- * @return the number of bytes written
- */
-int ff_rac_terminate(RangeCoder *c){
- c->range=0xFF;
- c->low +=0xFF;
+/* Return the number of bytes written. */
+int ff_rac_terminate(RangeCoder *c)
+{
+ c->range = 0xFF;
+ c->low += 0xFF;
renorm_encoder(c);
- c->range=0xFF;
+ c->range = 0xFF;
renorm_encoder(c);
- assert(c->low == 0);
+ assert(c->low == 0);
assert(c->range >= 0x100);
return c->bytestream - c->bytestream_start;
@@ -113,31 +115,29 @@ int ff_rac_terminate(RangeCoder *c){
#define SIZE 10240
#include "libavutil/lfg.h"
+#include "libavutil/log.h"
-int main(void){
+int main(void)
+{
RangeCoder c;
- uint8_t b[9*SIZE];
- uint8_t r[9*SIZE];
+ uint8_t b[9 * SIZE];
+ uint8_t r[9 * SIZE];
int i;
- uint8_t state[10]= {0};
+ uint8_t state[10];
AVLFG prng;
av_lfg_init(&prng, 1);
ff_init_range_encoder(&c, b, SIZE);
- ff_build_rac_states(&c, 0.05*(1LL<<32), 128+64+32+16);
+ ff_build_rac_states(&c, 0.05 * (1LL << 32), 128 + 64 + 32 + 16);
memset(state, 128, sizeof(state));
- for(i=0; i<SIZE; i++){
+ for (i = 0; i < SIZE; i++)
r[i] = av_lfg_get(&prng) % 7;
- }
- for(i=0; i<SIZE; i++){
-START_TIMER
- put_rac(&c, state, r[i]&1);
-STOP_TIMER("put_rac")
- }
+ for (i = 0; i < SIZE; i++)
+ put_rac(&c, state, r[i] & 1);
ff_rac_terminate(&c);
@@ -145,12 +145,11 @@ STOP_TIMER("put_rac")
memset(state, 128, sizeof(state));
- for(i=0; i<SIZE; i++){
-START_TIMER
- if( (r[i]&1) != get_rac(&c, state) )
- av_log(NULL, AV_LOG_DEBUG, "rac failure at %d\n", i);
-STOP_TIMER("get_rac")
- }
+ for (i = 0; i < SIZE; i++)
+ if ((r[i] & 1) != get_rac(&c, state)) {
+ av_log(NULL, AV_LOG_ERROR, "rac failure at %d\n", i);
+ return 1;
+ }
return 0;
}
diff --git a/gst-libs/ext/libav/libavcodec/rangecoder.h b/gst-libs/ext/libav/libavcodec/rangecoder.h
index 7ad1bd2..ad9c81f 100644
--- a/gst-libs/ext/libav/libavcodec/rangecoder.h
+++ b/gst-libs/ext/libav/libavcodec/rangecoder.h
@@ -29,112 +29,118 @@
#include <stdint.h>
#include <assert.h>
+
#include "libavutil/common.h"
-typedef struct RangeCoder{
+typedef struct RangeCoder {
int low;
int range;
int outstanding_count;
int outstanding_byte;
uint8_t zero_state[256];
- uint8_t one_state[256];
+ uint8_t one_state[256];
uint8_t *bytestream_start;
uint8_t *bytestream;
uint8_t *bytestream_end;
-}RangeCoder;
+} RangeCoder;
void ff_init_range_encoder(RangeCoder *c, uint8_t *buf, int buf_size);
void ff_init_range_decoder(RangeCoder *c, const uint8_t *buf, int buf_size);
int ff_rac_terminate(RangeCoder *c);
void ff_build_rac_states(RangeCoder *c, int factor, int max_p);
-static inline void renorm_encoder(RangeCoder *c){
- //FIXME optimize
- while(c->range < 0x100){
- if(c->outstanding_byte < 0){
- c->outstanding_byte= c->low>>8;
- }else if(c->low <= 0xFF00){
+static inline void renorm_encoder(RangeCoder *c)
+{
+ // FIXME: optimize
+ while (c->range < 0x100) {
+ if (c->outstanding_byte < 0) {
+ c->outstanding_byte = c->low >> 8;
+ } else if (c->low <= 0xFF00) {
*c->bytestream++ = c->outstanding_byte;
- for(;c->outstanding_count; c->outstanding_count--)
+ for (; c->outstanding_count; c->outstanding_count--)
*c->bytestream++ = 0xFF;
- c->outstanding_byte= c->low>>8;
- }else if(c->low >= 0x10000){
+ c->outstanding_byte = c->low >> 8;
+ } else if (c->low >= 0x10000) {
*c->bytestream++ = c->outstanding_byte + 1;
- for(;c->outstanding_count; c->outstanding_count--)
+ for (; c->outstanding_count; c->outstanding_count--)
*c->bytestream++ = 0x00;
- c->outstanding_byte= (c->low>>8) & 0xFF;
- }else{
+ c->outstanding_byte = (c->low >> 8) & 0xFF;
+ } else {
c->outstanding_count++;
}
- c->low = (c->low & 0xFF)<<8;
+ c->low = (c->low & 0xFF) << 8;
c->range <<= 8;
}
}
-static inline int get_rac_count(RangeCoder *c){
- int x= c->bytestream - c->bytestream_start + c->outstanding_count;
- if(c->outstanding_byte >= 0)
+static inline int get_rac_count(RangeCoder *c)
+{
+ int x = c->bytestream - c->bytestream_start + c->outstanding_count;
+ if (c->outstanding_byte >= 0)
x++;
- return 8*x - av_log2(c->range);
+ return 8 * x - av_log2(c->range);
}
-static inline void put_rac(RangeCoder *c, uint8_t * const state, int bit){
- int range1= (c->range * (*state)) >> 8;
+static inline void put_rac(RangeCoder *c, uint8_t *const state, int bit)
+{
+ int range1 = (c->range * (*state)) >> 8;
assert(*state);
assert(range1 < c->range);
assert(range1 > 0);
- if(!bit){
+ if (!bit) {
c->range -= range1;
- *state= c->zero_state[*state];
- }else{
- c->low += c->range - range1;
+ *state = c->zero_state[*state];
+ } else {
+ c->low += c->range - range1;
c->range = range1;
- *state= c->one_state[*state];
+ *state = c->one_state[*state];
}
renorm_encoder(c);
}
-static inline void refill(RangeCoder *c){
- if(c->range < 0x100){
+static inline void refill(RangeCoder *c)
+{
+ if (c->range < 0x100) {
c->range <<= 8;
- c->low <<= 8;
- if(c->bytestream < c->bytestream_end)
- c->low+= c->bytestream[0];
+ c->low <<= 8;
+ if (c->bytestream < c->bytestream_end)
+ c->low += c->bytestream[0];
c->bytestream++;
}
}
-static inline int get_rac(RangeCoder *c, uint8_t * const state){
- int range1= (c->range * (*state)) >> 8;
+static inline int get_rac(RangeCoder *c, uint8_t *const state)
+{
+ int range1 = (c->range * (*state)) >> 8;
int av_unused one_mask;
c->range -= range1;
#if 1
- if(c->low < c->range){
- *state= c->zero_state[*state];
+ if (c->low < c->range) {
+ *state = c->zero_state[*state];
refill(c);
return 0;
- }else{
- c->low -= c->range;
- *state= c->one_state[*state];
+ } else {
+ c->low -= c->range;
+ *state = c->one_state[*state];
c->range = range1;
refill(c);
return 1;
}
#else
- one_mask= (c->range - c->low-1)>>31;
+ one_mask = (c->range - c->low - 1) >> 31;
- c->low -= c->range & one_mask;
+ c->low -= c->range & one_mask;
c->range += (range1 - c->range) & one_mask;
- *state= c->zero_state[(*state) + (256&one_mask)];
+ *state = c->zero_state[(*state) + (256 & one_mask)];
refill(c);
- return one_mask&1;
+ return one_mask & 1;
#endif
}
diff --git a/gst-libs/ext/libav/libavcodec/ratecontrol.c b/gst-libs/ext/libav/libavcodec/ratecontrol.c
index 5e4b49a..e0b6e9b 100644
--- a/gst-libs/ext/libav/libavcodec/ratecontrol.c
+++ b/gst-libs/ext/libav/libavcodec/ratecontrol.c
@@ -270,7 +270,8 @@ int ff_vbv_update(MpegEncContext *s, int frame_size){
const double min_rate= s->avctx->rc_min_rate/fps;
const double max_rate= s->avctx->rc_max_rate/fps;
-//printf("%d %f %d %f %f\n", buffer_size, rcc->buffer_index, frame_size, min_rate, max_rate);
+ av_dlog(s, "%d %f %d %f %f\n",
+ buffer_size, rcc->buffer_index, frame_size, min_rate, max_rate);
if(buffer_size){
int left;
@@ -286,7 +287,7 @@ int ff_vbv_update(MpegEncContext *s, int frame_size){
if(rcc->buffer_index > buffer_size){
int stuffing= ceil((rcc->buffer_index - buffer_size)/8);
- if(stuffing < 4 && s->codec_id == CODEC_ID_MPEG4)
+ if(stuffing < 4 && s->codec_id == AV_CODEC_ID_MPEG4)
stuffing=4;
rcc->buffer_index -= 8*stuffing;
@@ -444,7 +445,6 @@ static double modify_qscale(MpegEncContext *s, RateControlEntry *rce, double q,
if(s->avctx->rc_qmod_freq && frame_num%s->avctx->rc_qmod_freq==0 && pict_type==AV_PICTURE_TYPE_P)
q*= s->avctx->rc_qmod_amp;
-//printf("q:%f\n", q);
/* buffer overflow/underflow protection */
if(buffer_size){
double expected_size= rcc->buffer_index;
@@ -480,7 +480,9 @@ static double modify_qscale(MpegEncContext *s, RateControlEntry *rce, double q,
}
}
}
-//printf("q:%f max:%f min:%f size:%f index:%d bits:%f agr:%f\n", q,max_rate, min_rate, buffer_size, rcc->buffer_index, bits, s->avctx->rc_buffer_aggressivity);
+ av_dlog(s, "q:%f max:%f min:%f size:%f index:%f agr:%f\n",
+ q, max_rate, min_rate, buffer_size, rcc->buffer_index,
+ s->avctx->rc_buffer_aggressivity);
if(s->avctx->rc_qsquish==0.0 || qmin==qmax){
if (q<qmin) q=qmin;
else if(q>qmax) q=qmax;
@@ -508,14 +510,6 @@ static double predict_size(Predictor *p, double q, double var)
return p->coeff*var / (q*p->count);
}
-/*
-static double predict_qp(Predictor *p, double size, double var)
-{
-//printf("coeff:%f, count:%f, var:%f, size:%f//\n", p->coeff, p->count, var, size);
- return p->coeff*var / (size*p->count);
-}
-*/
-
static void update_predictor(Predictor *p, double q, double var, double size)
{
double new_coeff= size*q / (var + 1);
@@ -537,8 +531,8 @@ static void adaptive_quantization(MpegEncContext *s, double q){
const float border_masking = s->avctx->border_masking;
float bits_sum= 0.0;
float cplx_sum= 0.0;
- float cplx_tab[s->mb_num];
- float bits_tab[s->mb_num];
+ float *cplx_tab = s->cplx_tab;
+ float *bits_tab = s->bits_tab;
const int qmin= s->avctx->mb_lmin;
const int qmax= s->avctx->mb_lmax;
Picture * const pic= &s->current_picture;
@@ -555,10 +549,6 @@ static void adaptive_quantization(MpegEncContext *s, double q){
int mb_y = mb_xy / s->mb_stride;
int mb_distance;
float mb_factor = 0.0;
-#if 0
- if(spat_cplx < q/3) spat_cplx= q/3; //FIXME finetune
- if(temp_cplx < q/3) temp_cplx= q/3; //FIXME finetune
-#endif
if(spat_cplx < 4) spat_cplx= 4; //FIXME finetune
if(temp_cplx < 4) temp_cplx= 4; //FIXME finetune
@@ -635,8 +625,6 @@ static void adaptive_quantization(MpegEncContext *s, double q){
if (intq > qmax) intq= qmax;
else if(intq < qmin) intq= qmin;
-//if(i%s->mb_width==0) printf("\n");
-//printf("%2d%3d ", intq, ff_sqrt(s->mc_mb_var[i]));
s->lambda_table[mb_xy]= intq;
}
}
@@ -681,7 +669,6 @@ float ff_rate_estimate_qscale(MpegEncContext *s, int dry_run)
get_qminmax(&qmin, &qmax, s, pict_type);
fps= 1/av_q2d(s->avctx->time_base);
-//printf("input_pic_num:%d pic_num:%d frame_rate:%d\n", s->input_picture_number, s->picture_number, s->frame_rate);
/* update predictors */
if(picture_number>2 && !dry_run){
const int last_var= s->last_pict_type == AV_PICTURE_TYPE_I ? rcc->last_mb_var_sum : rcc->last_mc_mb_var_sum;
@@ -704,9 +691,6 @@ float ff_rate_estimate_qscale(MpegEncContext *s, int dry_run)
else
dts_pic= s->last_picture_ptr;
-//if(dts_pic)
-// av_log(NULL, AV_LOG_ERROR, "%Ld %Ld %Ld %d\n", s->current_picture_ptr->pts, s->user_specified_pts, dts_pic->pts, picture_number);
-
if (!dts_pic || dts_pic->f.pts == AV_NOPTS_VALUE)
wanted_bits= (uint64_t)(s->bit_rate*(double)picture_number/fps);
else
@@ -725,7 +709,8 @@ float ff_rate_estimate_qscale(MpegEncContext *s, int dry_run)
assert(pict_type == rce->new_pict_type);
q= rce->new_qscale / br_compensation;
-//printf("%f %f %f last:%d var:%d type:%d//\n", q, rce->new_qscale, br_compensation, s->frame_bits, var, pict_type);
+ av_dlog(s, "%f %f %f last:%d var:%d type:%d//\n", q, rce->new_qscale,
+ br_compensation, s->frame_bits, var, pict_type);
}else{
rce->pict_type=
rce->new_pict_type= pict_type;
@@ -762,9 +747,7 @@ float ff_rate_estimate_qscale(MpegEncContext *s, int dry_run)
return -1;
assert(q>0.0);
-//printf("%f ", q);
q= get_diff_limited_q(s, rce, q);
-//printf("%f ", q);
assert(q>0.0);
if(pict_type==AV_PICTURE_TYPE_P || s->intra_only){ //FIXME type dependent blur like in 2-pass
@@ -773,9 +756,7 @@ float ff_rate_estimate_qscale(MpegEncContext *s, int dry_run)
rcc->short_term_qsum+= q;
rcc->short_term_qcount++;
-//printf("%f ", q);
q= short_term_q= rcc->short_term_qsum/rcc->short_term_qcount;
-//printf("%f ", q);
}
assert(q>0.0);
@@ -818,7 +799,7 @@ static int init_pass2(MpegEncContext *s)
AVCodecContext *a= s->avctx;
int i, toobig;
double fps= 1/av_q2d(s->avctx->time_base);
- double complexity[5]={0,0,0,0,0}; // aproximate bits at quant=1
+ double complexity[5]={0,0,0,0,0}; // approximate bits at quant=1
uint64_t const_bits[5]={0,0,0,0,0}; // quantizer independent bits
uint64_t all_const_bits;
uint64_t all_available_bits= (uint64_t)(s->bit_rate*(double)rcc->num_entries/fps);
@@ -900,18 +881,15 @@ static int init_pass2(MpegEncContext *s)
double bits;
rce->new_qscale= modify_qscale(s, rce, blurred_qscale[i], i);
bits= qp2bits(rce, rce->new_qscale) + rce->mv_bits + rce->misc_bits;
-//printf("%d %f\n", rce->new_bits, blurred_qscale[i]);
bits += 8*ff_vbv_update(s, bits);
rce->expected_bits= expected_bits;
expected_bits += bits;
}
- /*
- av_log(s->avctx, AV_LOG_INFO,
- "expected_bits: %f all_available_bits: %d rate_factor: %f\n",
- expected_bits, (int)all_available_bits, rate_factor);
- */
+ av_dlog(s->avctx,
+ "expected_bits: %f all_available_bits: %d rate_factor: %f\n",
+ expected_bits, (int)all_available_bits, rate_factor);
if(expected_bits > all_available_bits) {
rate_factor-= step;
++toobig;
@@ -923,8 +901,10 @@ static int init_pass2(MpegEncContext *s)
/* check bitrate calculations and print info */
qscale_sum = 0.0;
for(i=0; i<rcc->num_entries; i++){
- /* av_log(s->avctx, AV_LOG_DEBUG, "[lavc rc] entry[%d].new_qscale = %.3f qp = %.3f\n",
- i, rcc->entry[i].new_qscale, rcc->entry[i].new_qscale / FF_QP2LAMBDA); */
+ av_dlog(s, "[lavc rc] entry[%d].new_qscale = %.3f qp = %.3f\n",
+ i,
+ rcc->entry[i].new_qscale,
+ rcc->entry[i].new_qscale / FF_QP2LAMBDA);
qscale_sum += av_clip(rcc->entry[i].new_qscale / FF_QP2LAMBDA, s->avctx->qmin, s->avctx->qmax);
}
assert(toobig <= 40);
diff --git a/gst-libs/ext/libav/libavcodec/ratecontrol.h b/gst-libs/ext/libav/libavcodec/ratecontrol.h
index 6cd4a18..c0e05cc 100644
--- a/gst-libs/ext/libav/libavcodec/ratecontrol.h
+++ b/gst-libs/ext/libav/libavcodec/ratecontrol.h
@@ -102,4 +102,3 @@ void ff_xvid_rate_control_uninit(struct MpegEncContext *s);
float ff_xvid_rate_estimate_qscale(struct MpegEncContext *s, int dry_run);
#endif /* AVCODEC_RATECONTROL_H */
-
diff --git a/gst-libs/ext/libav/libavcodec/raw.c b/gst-libs/ext/libav/libavcodec/raw.c
index c41f756..4ccc6cc 100644
--- a/gst-libs/ext/libav/libavcodec/raw.c
+++ b/gst-libs/ext/libav/libavcodec/raw.c
@@ -26,128 +26,148 @@
#include "avcodec.h"
#include "raw.h"
+#include "libavutil/common.h"
const PixelFormatTag ff_raw_pix_fmt_tags[] = {
- { PIX_FMT_YUV420P, MKTAG('I', '4', '2', '0') }, /* Planar formats */
- { PIX_FMT_YUV420P, MKTAG('I', 'Y', 'U', 'V') },
- { PIX_FMT_YUV420P, MKTAG('Y', 'V', '1', '2') },
- { PIX_FMT_YUV410P, MKTAG('Y', 'U', 'V', '9') },
- { PIX_FMT_YUV410P, MKTAG('Y', 'V', 'U', '9') },
- { PIX_FMT_YUV411P, MKTAG('Y', '4', '1', 'B') },
- { PIX_FMT_YUV422P, MKTAG('Y', '4', '2', 'B') },
- { PIX_FMT_YUV422P, MKTAG('P', '4', '2', '2') },
- { PIX_FMT_YUV422P, MKTAG('Y', 'V', '1', '6') },
+ { AV_PIX_FMT_YUV420P, MKTAG('I', '4', '2', '0') }, /* Planar formats */
+ { AV_PIX_FMT_YUV420P, MKTAG('I', 'Y', 'U', 'V') },
+ { AV_PIX_FMT_YUV420P, MKTAG('Y', 'V', '1', '2') },
+ { AV_PIX_FMT_YUV410P, MKTAG('Y', 'U', 'V', '9') },
+ { AV_PIX_FMT_YUV410P, MKTAG('Y', 'V', 'U', '9') },
+ { AV_PIX_FMT_YUV411P, MKTAG('Y', '4', '1', 'B') },
+ { AV_PIX_FMT_YUV422P, MKTAG('Y', '4', '2', 'B') },
+ { AV_PIX_FMT_YUV422P, MKTAG('P', '4', '2', '2') },
+ { AV_PIX_FMT_YUV422P, MKTAG('Y', 'V', '1', '6') },
/* yuvjXXX formats are deprecated hacks specific to libav*,
they are identical to yuvXXX */
- { PIX_FMT_YUVJ420P, MKTAG('I', '4', '2', '0') }, /* Planar formats */
- { PIX_FMT_YUVJ420P, MKTAG('I', 'Y', 'U', 'V') },
- { PIX_FMT_YUVJ420P, MKTAG('Y', 'V', '1', '2') },
- { PIX_FMT_YUVJ422P, MKTAG('Y', '4', '2', 'B') },
- { PIX_FMT_YUVJ422P, MKTAG('P', '4', '2', '2') },
- { PIX_FMT_GRAY8, MKTAG('Y', '8', '0', '0') },
- { PIX_FMT_GRAY8, MKTAG('Y', '8', ' ', ' ') },
+ { AV_PIX_FMT_YUVJ420P, MKTAG('I', '4', '2', '0') }, /* Planar formats */
+ { AV_PIX_FMT_YUVJ420P, MKTAG('I', 'Y', 'U', 'V') },
+ { AV_PIX_FMT_YUVJ420P, MKTAG('Y', 'V', '1', '2') },
+ { AV_PIX_FMT_YUVJ422P, MKTAG('Y', '4', '2', 'B') },
+ { AV_PIX_FMT_YUVJ422P, MKTAG('P', '4', '2', '2') },
+ { AV_PIX_FMT_GRAY8, MKTAG('Y', '8', '0', '0') },
+ { AV_PIX_FMT_GRAY8, MKTAG('Y', '8', ' ', ' ') },
- { PIX_FMT_YUYV422, MKTAG('Y', 'U', 'Y', '2') }, /* Packed formats */
- { PIX_FMT_YUYV422, MKTAG('Y', '4', '2', '2') },
- { PIX_FMT_YUYV422, MKTAG('V', '4', '2', '2') },
- { PIX_FMT_YUYV422, MKTAG('V', 'Y', 'U', 'Y') },
- { PIX_FMT_YUYV422, MKTAG('Y', 'U', 'N', 'V') },
- { PIX_FMT_UYVY422, MKTAG('U', 'Y', 'V', 'Y') },
- { PIX_FMT_UYVY422, MKTAG('H', 'D', 'Y', 'C') },
- { PIX_FMT_UYVY422, MKTAG('U', 'Y', 'N', 'V') },
- { PIX_FMT_UYVY422, MKTAG('U', 'Y', 'N', 'Y') },
- { PIX_FMT_UYVY422, MKTAG('u', 'y', 'v', '1') },
- { PIX_FMT_UYVY422, MKTAG('2', 'V', 'u', '1') },
- { PIX_FMT_UYVY422, MKTAG('A', 'V', 'R', 'n') }, /* Avid AVI Codec 1:1 */
- { PIX_FMT_UYVY422, MKTAG('A', 'V', '1', 'x') }, /* Avid 1:1x */
- { PIX_FMT_UYVY422, MKTAG('A', 'V', 'u', 'p') },
- { PIX_FMT_UYVY422, MKTAG('V', 'D', 'T', 'Z') }, /* SoftLab-NSK VideoTizer */
- { PIX_FMT_UYVY422, MKTAG('a', 'u', 'v', '2') },
- { PIX_FMT_UYYVYY411, MKTAG('Y', '4', '1', '1') },
- { PIX_FMT_GRAY8, MKTAG('G', 'R', 'E', 'Y') },
- { PIX_FMT_NV12, MKTAG('N', 'V', '1', '2') },
- { PIX_FMT_NV21, MKTAG('N', 'V', '2', '1') },
+ { AV_PIX_FMT_YUYV422, MKTAG('Y', 'U', 'Y', '2') }, /* Packed formats */
+ { AV_PIX_FMT_YUYV422, MKTAG('Y', '4', '2', '2') },
+ { AV_PIX_FMT_YUYV422, MKTAG('V', '4', '2', '2') },
+ { AV_PIX_FMT_YUYV422, MKTAG('V', 'Y', 'U', 'Y') },
+ { AV_PIX_FMT_YUYV422, MKTAG('Y', 'U', 'N', 'V') },
+ { AV_PIX_FMT_UYVY422, MKTAG('U', 'Y', 'V', 'Y') },
+ { AV_PIX_FMT_UYVY422, MKTAG('H', 'D', 'Y', 'C') },
+ { AV_PIX_FMT_UYVY422, MKTAG('U', 'Y', 'N', 'V') },
+ { AV_PIX_FMT_UYVY422, MKTAG('U', 'Y', 'N', 'Y') },
+ { AV_PIX_FMT_UYVY422, MKTAG('u', 'y', 'v', '1') },
+ { AV_PIX_FMT_UYVY422, MKTAG('2', 'V', 'u', '1') },
+ { AV_PIX_FMT_UYVY422, MKTAG('A', 'V', 'R', 'n') }, /* Avid AVI Codec 1:1 */
+ { AV_PIX_FMT_UYVY422, MKTAG('A', 'V', '1', 'x') }, /* Avid 1:1x */
+ { AV_PIX_FMT_UYVY422, MKTAG('A', 'V', 'u', 'p') },
+ { AV_PIX_FMT_UYVY422, MKTAG('V', 'D', 'T', 'Z') }, /* SoftLab-NSK VideoTizer */
+ { AV_PIX_FMT_UYVY422, MKTAG('a', 'u', 'v', '2') },
+ { AV_PIX_FMT_UYYVYY411, MKTAG('Y', '4', '1', '1') },
+ { AV_PIX_FMT_GRAY8, MKTAG('G', 'R', 'E', 'Y') },
+ { AV_PIX_FMT_NV12, MKTAG('N', 'V', '1', '2') },
+ { AV_PIX_FMT_NV21, MKTAG('N', 'V', '2', '1') },
/* nut */
- { PIX_FMT_RGB555LE, MKTAG('R', 'G', 'B', 15) },
- { PIX_FMT_BGR555LE, MKTAG('B', 'G', 'R', 15) },
- { PIX_FMT_RGB565LE, MKTAG('R', 'G', 'B', 16) },
- { PIX_FMT_BGR565LE, MKTAG('B', 'G', 'R', 16) },
- { PIX_FMT_RGB555BE, MKTAG(15 , 'B', 'G', 'R') },
- { PIX_FMT_BGR555BE, MKTAG(15 , 'R', 'G', 'B') },
- { PIX_FMT_RGB565BE, MKTAG(16 , 'B', 'G', 'R') },
- { PIX_FMT_BGR565BE, MKTAG(16 , 'R', 'G', 'B') },
- { PIX_FMT_RGB444LE, MKTAG('R', 'G', 'B', 12) },
- { PIX_FMT_BGR444LE, MKTAG('B', 'G', 'R', 12) },
- { PIX_FMT_RGB444BE, MKTAG(12 , 'B', 'G', 'R') },
- { PIX_FMT_BGR444BE, MKTAG(12 , 'R', 'G', 'B') },
- { PIX_FMT_RGBA, MKTAG('R', 'G', 'B', 'A') },
- { PIX_FMT_BGRA, MKTAG('B', 'G', 'R', 'A') },
- { PIX_FMT_ABGR, MKTAG('A', 'B', 'G', 'R') },
- { PIX_FMT_ARGB, MKTAG('A', 'R', 'G', 'B') },
- { PIX_FMT_RGB24, MKTAG('R', 'G', 'B', 24 ) },
- { PIX_FMT_BGR24, MKTAG('B', 'G', 'R', 24 ) },
- { PIX_FMT_YUV411P, MKTAG('4', '1', '1', 'P') },
- { PIX_FMT_YUV422P, MKTAG('4', '2', '2', 'P') },
- { PIX_FMT_YUVJ422P, MKTAG('4', '2', '2', 'P') },
- { PIX_FMT_YUV440P, MKTAG('4', '4', '0', 'P') },
- { PIX_FMT_YUVJ440P, MKTAG('4', '4', '0', 'P') },
- { PIX_FMT_YUV444P, MKTAG('4', '4', '4', 'P') },
- { PIX_FMT_YUVJ444P, MKTAG('4', '4', '4', 'P') },
- { PIX_FMT_MONOWHITE,MKTAG('B', '1', 'W', '0') },
- { PIX_FMT_MONOBLACK,MKTAG('B', '0', 'W', '1') },
- { PIX_FMT_BGR8, MKTAG('B', 'G', 'R', 8 ) },
- { PIX_FMT_RGB8, MKTAG('R', 'G', 'B', 8 ) },
- { PIX_FMT_BGR4, MKTAG('B', 'G', 'R', 4 ) },
- { PIX_FMT_RGB4, MKTAG('R', 'G', 'B', 4 ) },
- { PIX_FMT_RGB4_BYTE,MKTAG('B', '4', 'B', 'Y') },
- { PIX_FMT_BGR4_BYTE,MKTAG('R', '4', 'B', 'Y') },
- { PIX_FMT_RGB48LE, MKTAG('R', 'G', 'B', 48 ) },
- { PIX_FMT_RGB48BE, MKTAG( 48, 'R', 'G', 'B') },
- { PIX_FMT_BGR48LE, MKTAG('B', 'G', 'R', 48 ) },
- { PIX_FMT_BGR48BE, MKTAG( 48, 'B', 'G', 'R') },
- { PIX_FMT_GRAY16LE, MKTAG('Y', '1', 0 , 16 ) },
- { PIX_FMT_GRAY16BE, MKTAG(16 , 0 , '1', 'Y') },
- { PIX_FMT_YUV420P10LE, MKTAG('Y', '3', 11 , 10 ) },
- { PIX_FMT_YUV420P10BE, MKTAG(10 , 11 , '3', 'Y') },
- { PIX_FMT_YUV422P10LE, MKTAG('Y', '3', 10 , 10 ) },
- { PIX_FMT_YUV422P10BE, MKTAG(10 , 10 , '3', 'Y') },
- { PIX_FMT_YUV444P10LE, MKTAG('Y', '3', 0 , 10 ) },
- { PIX_FMT_YUV444P10BE, MKTAG(10 , 0 , '3', 'Y') },
- { PIX_FMT_YUV420P16LE, MKTAG('Y', '3', 11 , 16 ) },
- { PIX_FMT_YUV420P16BE, MKTAG(16 , 11 , '3', 'Y') },
- { PIX_FMT_YUV422P16LE, MKTAG('Y', '3', 10 , 16 ) },
- { PIX_FMT_YUV422P16BE, MKTAG(16 , 10 , '3', 'Y') },
- { PIX_FMT_YUV444P16LE, MKTAG('Y', '3', 0 , 16 ) },
- { PIX_FMT_YUV444P16BE, MKTAG(16 , 0 , '3', 'Y') },
- { PIX_FMT_YUVA420P, MKTAG('Y', '4', 11 , 8 ) },
- { PIX_FMT_Y400A, MKTAG('Y', '2', 0 , 8 ) },
+ { AV_PIX_FMT_RGB555LE, MKTAG('R', 'G', 'B', 15) },
+ { AV_PIX_FMT_BGR555LE, MKTAG('B', 'G', 'R', 15) },
+ { AV_PIX_FMT_RGB565LE, MKTAG('R', 'G', 'B', 16) },
+ { AV_PIX_FMT_BGR565LE, MKTAG('B', 'G', 'R', 16) },
+ { AV_PIX_FMT_RGB555BE, MKTAG(15 , 'B', 'G', 'R') },
+ { AV_PIX_FMT_BGR555BE, MKTAG(15 , 'R', 'G', 'B') },
+ { AV_PIX_FMT_RGB565BE, MKTAG(16 , 'B', 'G', 'R') },
+ { AV_PIX_FMT_BGR565BE, MKTAG(16 , 'R', 'G', 'B') },
+ { AV_PIX_FMT_RGB444LE, MKTAG('R', 'G', 'B', 12) },
+ { AV_PIX_FMT_BGR444LE, MKTAG('B', 'G', 'R', 12) },
+ { AV_PIX_FMT_RGB444BE, MKTAG(12 , 'B', 'G', 'R') },
+ { AV_PIX_FMT_BGR444BE, MKTAG(12 , 'R', 'G', 'B') },
+ { AV_PIX_FMT_RGBA, MKTAG('R', 'G', 'B', 'A') },
+ { AV_PIX_FMT_BGRA, MKTAG('B', 'G', 'R', 'A') },
+ { AV_PIX_FMT_ABGR, MKTAG('A', 'B', 'G', 'R') },
+ { AV_PIX_FMT_ARGB, MKTAG('A', 'R', 'G', 'B') },
+ { AV_PIX_FMT_RGB24, MKTAG('R', 'G', 'B', 24 ) },
+ { AV_PIX_FMT_BGR24, MKTAG('B', 'G', 'R', 24 ) },
+ { AV_PIX_FMT_YUV411P, MKTAG('4', '1', '1', 'P') },
+ { AV_PIX_FMT_YUV422P, MKTAG('4', '2', '2', 'P') },
+ { AV_PIX_FMT_YUVJ422P, MKTAG('4', '2', '2', 'P') },
+ { AV_PIX_FMT_YUV440P, MKTAG('4', '4', '0', 'P') },
+ { AV_PIX_FMT_YUVJ440P, MKTAG('4', '4', '0', 'P') },
+ { AV_PIX_FMT_YUV444P, MKTAG('4', '4', '4', 'P') },
+ { AV_PIX_FMT_YUVJ444P, MKTAG('4', '4', '4', 'P') },
+ { AV_PIX_FMT_MONOWHITE,MKTAG('B', '1', 'W', '0') },
+ { AV_PIX_FMT_MONOBLACK,MKTAG('B', '0', 'W', '1') },
+ { AV_PIX_FMT_BGR8, MKTAG('B', 'G', 'R', 8 ) },
+ { AV_PIX_FMT_RGB8, MKTAG('R', 'G', 'B', 8 ) },
+ { AV_PIX_FMT_BGR4, MKTAG('B', 'G', 'R', 4 ) },
+ { AV_PIX_FMT_RGB4, MKTAG('R', 'G', 'B', 4 ) },
+ { AV_PIX_FMT_RGB4_BYTE,MKTAG('B', '4', 'B', 'Y') },
+ { AV_PIX_FMT_BGR4_BYTE,MKTAG('R', '4', 'B', 'Y') },
+ { AV_PIX_FMT_RGB48LE, MKTAG('R', 'G', 'B', 48 ) },
+ { AV_PIX_FMT_RGB48BE, MKTAG( 48, 'R', 'G', 'B') },
+ { AV_PIX_FMT_BGR48LE, MKTAG('B', 'G', 'R', 48 ) },
+ { AV_PIX_FMT_BGR48BE, MKTAG( 48, 'B', 'G', 'R') },
+ { AV_PIX_FMT_GRAY16LE, MKTAG('Y', '1', 0 , 16 ) },
+ { AV_PIX_FMT_GRAY16BE, MKTAG(16 , 0 , '1', 'Y') },
+ { AV_PIX_FMT_YUV420P10LE, MKTAG('Y', '3', 11 , 10 ) },
+ { AV_PIX_FMT_YUV420P10BE, MKTAG(10 , 11 , '3', 'Y') },
+ { AV_PIX_FMT_YUV422P10LE, MKTAG('Y', '3', 10 , 10 ) },
+ { AV_PIX_FMT_YUV422P10BE, MKTAG(10 , 10 , '3', 'Y') },
+ { AV_PIX_FMT_YUV444P10LE, MKTAG('Y', '3', 0 , 10 ) },
+ { AV_PIX_FMT_YUV444P10BE, MKTAG(10 , 0 , '3', 'Y') },
+ { AV_PIX_FMT_YUV420P16LE, MKTAG('Y', '3', 11 , 16 ) },
+ { AV_PIX_FMT_YUV420P16BE, MKTAG(16 , 11 , '3', 'Y') },
+ { AV_PIX_FMT_YUV422P16LE, MKTAG('Y', '3', 10 , 16 ) },
+ { AV_PIX_FMT_YUV422P16BE, MKTAG(16 , 10 , '3', 'Y') },
+ { AV_PIX_FMT_YUV444P16LE, MKTAG('Y', '3', 0 , 16 ) },
+ { AV_PIX_FMT_YUV444P16BE, MKTAG(16 , 0 , '3', 'Y') },
+ { AV_PIX_FMT_YUVA420P, MKTAG('Y', '4', 11 , 8 ) },
+ { AV_PIX_FMT_Y400A, MKTAG('Y', '2', 0 , 8 ) },
+
+ { AV_PIX_FMT_YUVA420P9LE, MKTAG('Y', '4', 11 , 9 ) },
+ { AV_PIX_FMT_YUVA420P9BE, MKTAG( 9 , 11 , '4', 'Y') },
+ { AV_PIX_FMT_YUVA422P9LE, MKTAG('Y', '4', 10 , 9 ) },
+ { AV_PIX_FMT_YUVA422P9BE, MKTAG( 9 , 10 , '4', 'Y') },
+ { AV_PIX_FMT_YUVA444P9LE, MKTAG('Y', '4', 0 , 9 ) },
+ { AV_PIX_FMT_YUVA444P9BE, MKTAG( 9 , 0 , '4', 'Y') },
+ { AV_PIX_FMT_YUVA420P10LE, MKTAG('Y', '4', 11 , 10 ) },
+ { AV_PIX_FMT_YUVA420P10BE, MKTAG(10 , 11 , '4', 'Y') },
+ { AV_PIX_FMT_YUVA422P10LE, MKTAG('Y', '4', 10 , 10 ) },
+ { AV_PIX_FMT_YUVA422P10BE, MKTAG(10 , 10 , '4', 'Y') },
+ { AV_PIX_FMT_YUVA444P10LE, MKTAG('Y', '4', 0 , 10 ) },
+ { AV_PIX_FMT_YUVA444P10BE, MKTAG(10 , 0 , '4', 'Y') },
+ { AV_PIX_FMT_YUVA420P16LE, MKTAG('Y', '4', 11 , 16 ) },
+ { AV_PIX_FMT_YUVA420P16BE, MKTAG(16 , 11 , '4', 'Y') },
+ { AV_PIX_FMT_YUVA422P16LE, MKTAG('Y', '4', 10 , 16 ) },
+ { AV_PIX_FMT_YUVA422P16BE, MKTAG(16 , 10 , '4', 'Y') },
+ { AV_PIX_FMT_YUVA444P16LE, MKTAG('Y', '4', 0 , 16 ) },
+ { AV_PIX_FMT_YUVA444P16BE, MKTAG(16 , 0 , '4', 'Y') },
/* quicktime */
- { PIX_FMT_UYVY422, MKTAG('2', 'v', 'u', 'y') },
- { PIX_FMT_UYVY422, MKTAG('2', 'V', 'u', 'y') },
- { PIX_FMT_UYVY422, MKTAG('A', 'V', 'U', 'I') }, /* FIXME merge both fields */
- { PIX_FMT_YUYV422, MKTAG('y', 'u', 'v', '2') },
- { PIX_FMT_YUYV422, MKTAG('y', 'u', 'v', 's') },
- { PIX_FMT_YUYV422, MKTAG('D', 'V', 'O', 'O') }, /* Digital Voodoo SD 8 Bit */
- { PIX_FMT_RGB555LE,MKTAG('L', '5', '5', '5') },
- { PIX_FMT_RGB565LE,MKTAG('L', '5', '6', '5') },
- { PIX_FMT_RGB565BE,MKTAG('B', '5', '6', '5') },
- { PIX_FMT_BGR24, MKTAG('2', '4', 'B', 'G') },
- { PIX_FMT_BGRA, MKTAG('B', 'G', 'R', 'A') },
- { PIX_FMT_RGBA, MKTAG('R', 'G', 'B', 'A') },
- { PIX_FMT_ABGR, MKTAG('A', 'B', 'G', 'R') },
- { PIX_FMT_GRAY16BE,MKTAG('b', '1', '6', 'g') },
- { PIX_FMT_RGB48BE, MKTAG('b', '4', '8', 'r') },
+ { AV_PIX_FMT_UYVY422, MKTAG('2', 'v', 'u', 'y') },
+ { AV_PIX_FMT_UYVY422, MKTAG('2', 'V', 'u', 'y') },
+ { AV_PIX_FMT_UYVY422, MKTAG('A', 'V', 'U', 'I') }, /* FIXME merge both fields */
+ { AV_PIX_FMT_YUYV422, MKTAG('y', 'u', 'v', '2') },
+ { AV_PIX_FMT_YUYV422, MKTAG('y', 'u', 'v', 's') },
+ { AV_PIX_FMT_YUYV422, MKTAG('D', 'V', 'O', 'O') }, /* Digital Voodoo SD 8 Bit */
+ { AV_PIX_FMT_RGB555LE,MKTAG('L', '5', '5', '5') },
+ { AV_PIX_FMT_RGB565LE,MKTAG('L', '5', '6', '5') },
+ { AV_PIX_FMT_RGB565BE,MKTAG('B', '5', '6', '5') },
+ { AV_PIX_FMT_BGR24, MKTAG('2', '4', 'B', 'G') },
+ { AV_PIX_FMT_BGRA, MKTAG('B', 'G', 'R', 'A') },
+ { AV_PIX_FMT_RGBA, MKTAG('R', 'G', 'B', 'A') },
+ { AV_PIX_FMT_ABGR, MKTAG('A', 'B', 'G', 'R') },
+ { AV_PIX_FMT_GRAY16BE,MKTAG('b', '1', '6', 'g') },
+ { AV_PIX_FMT_RGB48BE, MKTAG('b', '4', '8', 'r') },
/* special */
- { PIX_FMT_RGB565LE,MKTAG( 3 , 0 , 0 , 0 ) }, /* flipped RGB565LE */
- { PIX_FMT_YUV444P, MKTAG('Y', 'V', '2', '4') }, /* YUV444P, swapped UV */
+ { AV_PIX_FMT_RGB565LE,MKTAG( 3 , 0 , 0 , 0 ) }, /* flipped RGB565LE */
+ { AV_PIX_FMT_YUV444P, MKTAG('Y', 'V', '2', '4') }, /* YUV444P, swapped UV */
- { PIX_FMT_NONE, 0 },
+ { AV_PIX_FMT_NONE, 0 },
};
-unsigned int avcodec_pix_fmt_to_codec_tag(enum PixelFormat fmt)
+unsigned int avcodec_pix_fmt_to_codec_tag(enum AVPixelFormat fmt)
{
const PixelFormatTag *tags = ff_raw_pix_fmt_tags;
while (tags->pix_fmt >= 0) {
diff --git a/gst-libs/ext/libav/libavcodec/raw.h b/gst-libs/ext/libav/libavcodec/raw.h
index 2caa3fa..bf66671 100644
--- a/gst-libs/ext/libav/libavcodec/raw.h
+++ b/gst-libs/ext/libav/libavcodec/raw.h
@@ -30,7 +30,7 @@
#include "avcodec.h"
typedef struct PixelFormatTag {
- enum PixelFormat pix_fmt;
+ enum AVPixelFormat pix_fmt;
unsigned int fourcc;
} PixelFormatTag;
diff --git a/gst-libs/ext/libav/libavcodec/rawdec.c b/gst-libs/ext/libav/libavcodec/rawdec.c
index c0508d8..16ee64e 100644
--- a/gst-libs/ext/libav/libavcodec/rawdec.c
+++ b/gst-libs/ext/libav/libavcodec/rawdec.c
@@ -25,8 +25,8 @@
*/
#include "avcodec.h"
-#include "imgconvert.h"
#include "raw.h"
+#include "libavutil/common.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/imgutils.h"
@@ -39,38 +39,38 @@ typedef struct RawVideoContext {
} RawVideoContext;
static const PixelFormatTag pix_fmt_bps_avi[] = {
- { PIX_FMT_PAL8, 4 },
- { PIX_FMT_PAL8, 8 },
- { PIX_FMT_RGB444, 12 },
- { PIX_FMT_RGB555, 15 },
- { PIX_FMT_RGB555, 16 },
- { PIX_FMT_BGR24, 24 },
- { PIX_FMT_RGB32, 32 },
- { PIX_FMT_NONE, 0 },
+ { AV_PIX_FMT_PAL8, 4 },
+ { AV_PIX_FMT_PAL8, 8 },
+ { AV_PIX_FMT_RGB444, 12 },
+ { AV_PIX_FMT_RGB555, 15 },
+ { AV_PIX_FMT_RGB555, 16 },
+ { AV_PIX_FMT_BGR24, 24 },
+ { AV_PIX_FMT_RGB32, 32 },
+ { AV_PIX_FMT_NONE, 0 },
};
static const PixelFormatTag pix_fmt_bps_mov[] = {
- { PIX_FMT_MONOWHITE, 1 },
- { PIX_FMT_PAL8, 2 },
- { PIX_FMT_PAL8, 4 },
- { PIX_FMT_PAL8, 8 },
+ { AV_PIX_FMT_MONOWHITE, 1 },
+ { AV_PIX_FMT_PAL8, 2 },
+ { AV_PIX_FMT_PAL8, 4 },
+ { AV_PIX_FMT_PAL8, 8 },
// FIXME swscale does not support 16 bit in .mov, sample 16bit.mov
// http://developer.apple.com/documentation/QuickTime/QTFF/QTFFChap3/qtff3.html
- { PIX_FMT_RGB555BE, 16 },
- { PIX_FMT_RGB24, 24 },
- { PIX_FMT_ARGB, 32 },
- { PIX_FMT_MONOWHITE,33 },
- { PIX_FMT_NONE, 0 },
+ { AV_PIX_FMT_RGB555BE, 16 },
+ { AV_PIX_FMT_RGB24, 24 },
+ { AV_PIX_FMT_ARGB, 32 },
+ { AV_PIX_FMT_MONOWHITE,33 },
+ { AV_PIX_FMT_NONE, 0 },
};
-static enum PixelFormat find_pix_fmt(const PixelFormatTag *tags, unsigned int fourcc)
+static enum AVPixelFormat find_pix_fmt(const PixelFormatTag *tags, unsigned int fourcc)
{
while (tags->pix_fmt >= 0) {
if (tags->fourcc == fourcc)
return tags->pix_fmt;
tags++;
}
- return PIX_FMT_YUV420P;
+ return AV_PIX_FMT_YUV420P;
}
static av_cold int raw_init_decoder(AVCodecContext *avctx)
@@ -83,13 +83,13 @@ static av_cold int raw_init_decoder(AVCodecContext *avctx)
avctx->pix_fmt = find_pix_fmt(pix_fmt_bps_avi, avctx->bits_per_coded_sample);
else if (avctx->codec_tag)
avctx->pix_fmt = find_pix_fmt(ff_raw_pix_fmt_tags, avctx->codec_tag);
- else if (avctx->pix_fmt == PIX_FMT_NONE && avctx->bits_per_coded_sample)
+ else if (avctx->pix_fmt == AV_PIX_FMT_NONE && avctx->bits_per_coded_sample)
avctx->pix_fmt = find_pix_fmt(pix_fmt_bps_avi, avctx->bits_per_coded_sample);
- ff_set_systematic_pal2(context->palette, avctx->pix_fmt);
+ avpriv_set_systematic_pal2(context->palette, avctx->pix_fmt);
context->length = avpicture_get_size(avctx->pix_fmt, avctx->width, avctx->height);
if((avctx->bits_per_coded_sample == 4 || avctx->bits_per_coded_sample == 2) &&
- avctx->pix_fmt==PIX_FMT_PAL8 &&
+ avctx->pix_fmt==AV_PIX_FMT_PAL8 &&
(!avctx->codec_tag || avctx->codec_tag == MKTAG('r','a','w',' '))){
context->buffer = av_malloc(context->length);
if (!context->buffer)
@@ -113,16 +113,17 @@ static void flip(AVCodecContext *avctx, AVPicture * picture){
}
static int raw_decode(AVCodecContext *avctx,
- void *data, int *data_size,
+ void *data, int *got_frame,
AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
RawVideoContext *context = avctx->priv_data;
+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(avctx->pix_fmt);
int res;
- AVFrame * frame = (AVFrame *) data;
- AVPicture * picture = (AVPicture *) data;
+ AVFrame *frame = data;
+ AVPicture *picture = data;
frame->pict_type = avctx->coded_frame->pict_type;
frame->interlaced_frame = avctx->coded_frame->interlaced_frame;
@@ -130,7 +131,7 @@ static int raw_decode(AVCodecContext *avctx,
frame->reordered_opaque = avctx->reordered_opaque;
frame->pkt_pts = avctx->pkt->pts;
- if(buf_size < context->length - (avctx->pix_fmt==PIX_FMT_PAL8 ? 256*4 : 0))
+ if(buf_size < context->length - (avctx->pix_fmt==AV_PIX_FMT_PAL8 ? 256*4 : 0))
return -1;
//2bpp and 4bpp raw in avi and mov (yes this is ugly ...)
@@ -160,12 +161,11 @@ static int raw_decode(AVCodecContext *avctx,
if ((res = avpicture_fill(picture, buf, avctx->pix_fmt,
avctx->width, avctx->height)) < 0)
return res;
- if((avctx->pix_fmt==PIX_FMT_PAL8 && buf_size < context->length) ||
- (avctx->pix_fmt!=PIX_FMT_PAL8 &&
- (av_pix_fmt_descriptors[avctx->pix_fmt].flags & PIX_FMT_PAL))){
+ if((avctx->pix_fmt==AV_PIX_FMT_PAL8 && buf_size < context->length) ||
+ (desc->flags & PIX_FMT_PSEUDOPAL)) {
frame->data[1]= context->palette;
}
- if (avctx->pix_fmt == PIX_FMT_PAL8) {
+ if (avctx->pix_fmt == AV_PIX_FMT_PAL8) {
const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, NULL);
if (pal) {
@@ -173,18 +173,20 @@ static int raw_decode(AVCodecContext *avctx,
frame->palette_has_changed = 1;
}
}
- if(avctx->pix_fmt==PIX_FMT_BGR24 && ((frame->linesize[0]+3)&~3)*avctx->height <= buf_size)
+ if(avctx->pix_fmt==AV_PIX_FMT_BGR24 && ((frame->linesize[0]+3)&~3)*avctx->height <= buf_size)
frame->linesize[0] = (frame->linesize[0]+3)&~3;
if(context->flip)
flip(avctx, picture);
if ( avctx->codec_tag == MKTAG('Y', 'V', '1', '2')
+ || avctx->codec_tag == MKTAG('Y', 'V', '1', '6')
+ || avctx->codec_tag == MKTAG('Y', 'V', '2', '4')
|| avctx->codec_tag == MKTAG('Y', 'V', 'U', '9'))
FFSWAP(uint8_t *, picture->data[1], picture->data[2]);
if(avctx->codec_tag == AV_RL32("yuv2") &&
- avctx->pix_fmt == PIX_FMT_YUYV422) {
+ avctx->pix_fmt == AV_PIX_FMT_YUYV422) {
int x, y;
uint8_t *line = picture->data[0];
for(y = 0; y < avctx->height; y++) {
@@ -194,7 +196,7 @@ static int raw_decode(AVCodecContext *avctx,
}
}
- *data_size = sizeof(AVPicture);
+ *got_frame = 1;
return buf_size;
}
@@ -209,10 +211,10 @@ static av_cold int raw_close_decoder(AVCodecContext *avctx)
AVCodec ff_rawvideo_decoder = {
.name = "rawvideo",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_RAWVIDEO,
+ .id = AV_CODEC_ID_RAWVIDEO,
.priv_data_size = sizeof(RawVideoContext),
.init = raw_init_decoder,
.close = raw_close_decoder,
.decode = raw_decode,
- .long_name = NULL_IF_CONFIG_SMALL("raw video"),
+ .long_name = NULL_IF_CONFIG_SMALL("raw video"),
};
diff --git a/gst-libs/ext/libav/libavcodec/rawenc.c b/gst-libs/ext/libav/libavcodec/rawenc.c
index 6640db0..3e607af 100644
--- a/gst-libs/ext/libav/libavcodec/rawenc.c
+++ b/gst-libs/ext/libav/libavcodec/rawenc.c
@@ -26,41 +26,55 @@
#include "avcodec.h"
#include "raw.h"
+#include "internal.h"
#include "libavutil/pixdesc.h"
#include "libavutil/intreadwrite.h"
+#include "libavutil/internal.h"
static av_cold int raw_init_encoder(AVCodecContext *avctx)
{
- avctx->coded_frame = (AVFrame *)avctx->priv_data;
+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(avctx->pix_fmt);
+
+ avctx->coded_frame = avctx->priv_data;
avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I;
avctx->coded_frame->key_frame = 1;
- avctx->bits_per_coded_sample = av_get_bits_per_pixel(&av_pix_fmt_descriptors[avctx->pix_fmt]);
+ avctx->bits_per_coded_sample = av_get_bits_per_pixel(desc);
if(!avctx->codec_tag)
avctx->codec_tag = avcodec_pix_fmt_to_codec_tag(avctx->pix_fmt);
return 0;
}
-static int raw_encode(AVCodecContext *avctx,
- unsigned char *frame, int buf_size, void *data)
+static int raw_encode(AVCodecContext *avctx, AVPacket *pkt,
+ const AVFrame *frame, int *got_packet)
{
- int ret = avpicture_layout((AVPicture *)data, avctx->pix_fmt, avctx->width,
- avctx->height, frame, buf_size);
+ int ret = avpicture_get_size(avctx->pix_fmt, avctx->width, avctx->height);
+
+ if (ret < 0)
+ return ret;
+
+ if ((ret = ff_alloc_packet(pkt, ret)) < 0)
+ return ret;
+ if ((ret = avpicture_layout((const AVPicture *)frame, avctx->pix_fmt, avctx->width,
+ avctx->height, pkt->data, pkt->size)) < 0)
+ return ret;
if(avctx->codec_tag == AV_RL32("yuv2") && ret > 0 &&
- avctx->pix_fmt == PIX_FMT_YUYV422) {
+ avctx->pix_fmt == AV_PIX_FMT_YUYV422) {
int x;
for(x = 1; x < avctx->height*avctx->width*2; x += 2)
- frame[x] ^= 0x80;
+ pkt->data[x] ^= 0x80;
}
- return ret;
+ pkt->flags |= AV_PKT_FLAG_KEY;
+ *got_packet = 1;
+ return 0;
}
AVCodec ff_rawvideo_encoder = {
.name = "rawvideo",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_RAWVIDEO,
+ .id = AV_CODEC_ID_RAWVIDEO,
.priv_data_size = sizeof(AVFrame),
.init = raw_init_encoder,
- .encode = raw_encode,
- .long_name = NULL_IF_CONFIG_SMALL("raw video"),
+ .encode2 = raw_encode,
+ .long_name = NULL_IF_CONFIG_SMALL("raw video"),
};
diff --git a/gst-libs/ext/libav/libavcodec/resample.c b/gst-libs/ext/libav/libavcodec/resample.c
index ba8ce89..1b3bb83 100644
--- a/gst-libs/ext/libav/libavcodec/resample.c
+++ b/gst-libs/ext/libav/libavcodec/resample.c
@@ -24,11 +24,16 @@
* samplerate conversion for both audio and video
*/
+#include <string.h>
+
#include "avcodec.h"
#include "audioconvert.h"
#include "libavutil/opt.h"
+#include "libavutil/mem.h"
#include "libavutil/samplefmt.h"
+#if FF_API_AVCODEC_RESAMPLE
+
#define MAX_CHANNELS 8
struct AVResampleContext;
@@ -272,11 +277,13 @@ int audio_resample(ReSampleContext *s, short *output, short *input, int nb_sampl
lenout = 4 * nb_samples * s->ratio + 16;
if (s->sample_fmt[1] != AV_SAMPLE_FMT_S16) {
+ int out_size = lenout * av_get_bytes_per_sample(s->sample_fmt[1]) *
+ s->output_channels;
output_bak = output;
- if (!s->buffer_size[1] || s->buffer_size[1] < lenout) {
+ if (!s->buffer_size[1] || s->buffer_size[1] < out_size) {
av_free(s->buffer[1]);
- s->buffer_size[1] = lenout;
+ s->buffer_size[1] = out_size;
s->buffer[1] = av_malloc(s->buffer_size[1]);
if (!s->buffer[1]) {
av_log(s->resample_context, AV_LOG_ERROR, "Could not allocate buffer\n");
@@ -343,7 +350,7 @@ int audio_resample(ReSampleContext *s, short *output, short *input, int nb_sampl
if (av_audio_convert(s->convert_ctx[1], obuf, ostride,
ibuf, istride, nb_samples1 * s->output_channels) < 0) {
av_log(s->resample_context, AV_LOG_ERROR,
- "Audio sample format convertion failed\n");
+ "Audio sample format conversion failed\n");
return 0;
}
}
@@ -368,3 +375,5 @@ void audio_resample_close(ReSampleContext *s)
av_audio_convert_free(s->convert_ctx[1]);
av_free(s);
}
+
+#endif
diff --git a/gst-libs/ext/libav/libavcodec/resample2.c b/gst-libs/ext/libav/libavcodec/resample2.c
index 48c20c2..c6e5c48 100644
--- a/gst-libs/ext/libav/libavcodec/resample2.c
+++ b/gst-libs/ext/libav/libavcodec/resample2.c
@@ -27,6 +27,9 @@
#include "avcodec.h"
#include "dsputil.h"
+#include "libavutil/common.h"
+
+#if FF_API_AVCODEC_RESAMPLE
#ifndef CONFIG_RESAMPLE_HP
#define FILTER_SHIFT 15
@@ -318,3 +321,5 @@ av_log(NULL, AV_LOG_DEBUG, "%d %d %d\n", c->dst_incr, c->ideal_dst_incr, c->comp
return dst_index;
}
+
+#endif
diff --git a/gst-libs/ext/libav/libavcodec/rl2.c b/gst-libs/ext/libav/libavcodec/rl2.c
index 7e3bd9c..c9eb93e 100644
--- a/gst-libs/ext/libav/libavcodec/rl2.c
+++ b/gst-libs/ext/libav/libavcodec/rl2.c
@@ -30,8 +30,11 @@
#include <stdlib.h>
#include <string.h>
+#include "libavutil/internal.h"
#include "libavutil/intreadwrite.h"
+#include "libavutil/mem.h"
#include "avcodec.h"
+#include "internal.h"
#define EXTRADATA1_SIZE (6 + 256 * 3) ///< video base, clr count, palette
@@ -64,7 +67,7 @@ static void rl2_rle_decode(Rl2Context *s,const unsigned char* in,int size,
const unsigned char* back_frame = s->back_frame;
const unsigned char* in_end = in + size;
const unsigned char* out_end = out + stride * s->avctx->height;
- unsigned char* line_end = out + s->avctx->width;
+ unsigned char* line_end;
/** copy start of the background frame */
for(i=0;i<=base_y;i++){
@@ -132,7 +135,7 @@ static av_cold int rl2_decode_init(AVCodecContext *avctx)
int back_size;
int i;
s->avctx = avctx;
- avctx->pix_fmt = PIX_FMT_PAL8;
+ avctx->pix_fmt = AV_PIX_FMT_PAL8;
/** parse extra data */
if(!avctx->extradata || avctx->extradata_size < EXTRADATA1_SIZE){
@@ -169,7 +172,7 @@ static av_cold int rl2_decode_init(AVCodecContext *avctx)
static int rl2_decode_frame(AVCodecContext *avctx,
- void *data, int *data_size,
+ void *data, int *got_frame,
AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
@@ -181,7 +184,7 @@ static int rl2_decode_frame(AVCodecContext *avctx,
/** get buffer */
s->frame.reference= 0;
- if(avctx->get_buffer(avctx, &s->frame)) {
+ if(ff_get_buffer(avctx, &s->frame)) {
av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return -1;
}
@@ -192,7 +195,7 @@ static int rl2_decode_frame(AVCodecContext *avctx,
/** make the palette available on the way out */
memcpy(s->frame.data[1], s->palette, AVPALETTE_SIZE);
- *data_size = sizeof(AVFrame);
+ *got_frame = 1;
*(AVFrame*)data = s->frame;
/** report that the buffer was completely consumed */
@@ -221,12 +224,11 @@ static av_cold int rl2_decode_end(AVCodecContext *avctx)
AVCodec ff_rl2_decoder = {
.name = "rl2",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_RL2,
+ .id = AV_CODEC_ID_RL2,
.priv_data_size = sizeof(Rl2Context),
.init = rl2_decode_init,
.close = rl2_decode_end,
.decode = rl2_decode_frame,
.capabilities = CODEC_CAP_DR1,
- .long_name = NULL_IF_CONFIG_SMALL("RL2 video"),
+ .long_name = NULL_IF_CONFIG_SMALL("RL2 video"),
};
-
diff --git a/gst-libs/ext/libav/libavcodec/rle.c b/gst-libs/ext/libav/libavcodec/rle.c
index 8a009e7..cbbde93 100644
--- a/gst-libs/ext/libav/libavcodec/rle.c
+++ b/gst-libs/ext/libav/libavcodec/rle.c
@@ -20,6 +20,7 @@
*/
#include "avcodec.h"
#include "rle.h"
+#include "libavutil/common.h"
/**
* Count up to 127 consecutive pixels which are either all the same or
diff --git a/gst-libs/ext/libav/libavcodec/roqaudioenc.c b/gst-libs/ext/libav/libavcodec/roqaudioenc.c
index e540e14..3cc9931 100644
--- a/gst-libs/ext/libav/libavcodec/roqaudioenc.c
+++ b/gst-libs/ext/libav/libavcodec/roqaudioenc.c
@@ -21,13 +21,13 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "libavutil/intmath.h"
#include "avcodec.h"
#include "bytestream.h"
+#include "internal.h"
+#include "mathops.h"
-#define ROQ_FIRST_FRAME_SIZE (735*8)
#define ROQ_FRAME_SIZE 735
-
+#define ROQ_HEADER_SIZE 8
#define MAX_DPCM (127*127)
@@ -35,33 +35,64 @@
typedef struct
{
short lastSample[2];
+ int input_frames;
+ int buffered_samples;
+ int16_t *frame_buffer;
+ int64_t first_pts;
} ROQDPCMContext;
+
+static av_cold int roq_dpcm_encode_close(AVCodecContext *avctx)
+{
+ ROQDPCMContext *context = avctx->priv_data;
+
+#if FF_API_OLD_ENCODE_AUDIO
+ av_freep(&avctx->coded_frame);
+#endif
+ av_freep(&context->frame_buffer);
+
+ return 0;
+}
+
static av_cold int roq_dpcm_encode_init(AVCodecContext *avctx)
{
ROQDPCMContext *context = avctx->priv_data;
+ int ret;
if (avctx->channels > 2) {
av_log(avctx, AV_LOG_ERROR, "Audio must be mono or stereo\n");
- return -1;
+ return AVERROR(EINVAL);
}
if (avctx->sample_rate != 22050) {
av_log(avctx, AV_LOG_ERROR, "Audio must be 22050 Hz\n");
- return -1;
- }
- if (avctx->sample_fmt != AV_SAMPLE_FMT_S16) {
- av_log(avctx, AV_LOG_ERROR, "Audio must be signed 16-bit\n");
- return -1;
+ return AVERROR(EINVAL);
}
- avctx->frame_size = ROQ_FIRST_FRAME_SIZE;
+ avctx->frame_size = ROQ_FRAME_SIZE;
+ avctx->bit_rate = (ROQ_HEADER_SIZE + ROQ_FRAME_SIZE * avctx->channels) *
+ (22050 / ROQ_FRAME_SIZE) * 8;
+
+ context->frame_buffer = av_malloc(8 * ROQ_FRAME_SIZE * avctx->channels *
+ sizeof(*context->frame_buffer));
+ if (!context->frame_buffer) {
+ ret = AVERROR(ENOMEM);
+ goto error;
+ }
context->lastSample[0] = context->lastSample[1] = 0;
+#if FF_API_OLD_ENCODE_AUDIO
avctx->coded_frame= avcodec_alloc_frame();
- avctx->coded_frame->key_frame= 1;
+ if (!avctx->coded_frame) {
+ ret = AVERROR(ENOMEM);
+ goto error;
+ }
+#endif
return 0;
+error:
+ roq_dpcm_encode_close(avctx);
+ return ret;
}
static unsigned char dpcm_predict(short *previous, short current)
@@ -104,28 +135,51 @@ static unsigned char dpcm_predict(short *previous, short current)
return result;
}
-static int roq_dpcm_encode_frame(AVCodecContext *avctx,
- unsigned char *frame, int buf_size, void *data)
+static int roq_dpcm_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
+ const AVFrame *frame, int *got_packet_ptr)
{
- int i, samples, stereo, ch;
- const short *in;
- unsigned char *out;
-
+ int i, stereo, data_size, ret;
+ const int16_t *in = frame ? (const int16_t *)frame->data[0] : NULL;
+ uint8_t *out;
ROQDPCMContext *context = avctx->priv_data;
stereo = (avctx->channels == 2);
+ if (!in && context->input_frames >= 8)
+ return 0;
+
+ if (in && context->input_frames < 8) {
+ memcpy(&context->frame_buffer[context->buffered_samples * avctx->channels],
+ in, avctx->frame_size * avctx->channels * sizeof(*in));
+ context->buffered_samples += avctx->frame_size;
+ if (context->input_frames == 0)
+ context->first_pts = frame->pts;
+ if (context->input_frames < 7) {
+ context->input_frames++;
+ return 0;
+ }
+ in = context->frame_buffer;
+ }
+
if (stereo) {
context->lastSample[0] &= 0xFF00;
context->lastSample[1] &= 0xFF00;
}
- out = frame;
- in = data;
+ if (context->input_frames == 7 || !in)
+ data_size = avctx->channels * context->buffered_samples;
+ else
+ data_size = avctx->channels * avctx->frame_size;
+
+ if ((ret = ff_alloc_packet(avpkt, ROQ_HEADER_SIZE + data_size))) {
+ av_log(avctx, AV_LOG_ERROR, "Error getting output packet\n");
+ return ret;
+ }
+ out = avpkt->data;
bytestream_put_byte(&out, stereo ? 0x21 : 0x20);
bytestream_put_byte(&out, 0x10);
- bytestream_put_le32(&out, avctx->frame_size*avctx->channels);
+ bytestream_put_le32(&out, data_size);
if (stereo) {
bytestream_put_byte(&out, (context->lastSample[1])>>8);
@@ -134,33 +188,30 @@ static int roq_dpcm_encode_frame(AVCodecContext *avctx,
bytestream_put_le16(&out, context->lastSample[0]);
/* Write the actual samples */
- samples = avctx->frame_size;
- for (i=0; i<samples; i++)
- for (ch=0; ch<avctx->channels; ch++)
- *out++ = dpcm_predict(&context->lastSample[ch], *in++);
+ for (i = 0; i < data_size; i++)
+ *out++ = dpcm_predict(&context->lastSample[i & 1], *in++);
- /* Use smaller frames from now on */
- avctx->frame_size = ROQ_FRAME_SIZE;
-
- /* Return the result size */
- return out - frame;
-}
+ avpkt->pts = context->input_frames <= 7 ? context->first_pts : frame->pts;
+ avpkt->duration = data_size / avctx->channels;
-static av_cold int roq_dpcm_encode_close(AVCodecContext *avctx)
-{
- av_freep(&avctx->coded_frame);
+ context->input_frames++;
+ if (!in)
+ context->input_frames = FFMAX(context->input_frames, 8);
+ *got_packet_ptr = 1;
return 0;
}
AVCodec ff_roq_dpcm_encoder = {
.name = "roq_dpcm",
.type = AVMEDIA_TYPE_AUDIO,
- .id = CODEC_ID_ROQ_DPCM,
+ .id = AV_CODEC_ID_ROQ_DPCM,
.priv_data_size = sizeof(ROQDPCMContext),
.init = roq_dpcm_encode_init,
- .encode = roq_dpcm_encode_frame,
+ .encode2 = roq_dpcm_encode_frame,
.close = roq_dpcm_encode_close,
- .sample_fmts = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_NONE},
- .long_name = NULL_IF_CONFIG_SMALL("id RoQ DPCM"),
+ .capabilities = CODEC_CAP_DELAY,
+ .sample_fmts = (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_S16,
+ AV_SAMPLE_FMT_NONE },
+ .long_name = NULL_IF_CONFIG_SMALL("id RoQ DPCM"),
};
diff --git a/gst-libs/ext/libav/libavcodec/roqvideo.h b/gst-libs/ext/libav/libavcodec/roqvideo.h
index 4e6e5bb..33d77ed 100644
--- a/gst-libs/ext/libav/libavcodec/roqvideo.h
+++ b/gst-libs/ext/libav/libavcodec/roqvideo.h
@@ -27,16 +27,16 @@
#include "bytestream.h"
#include "dsputil.h"
-typedef struct {
+typedef struct roq_cell {
unsigned char y[4];
unsigned char u, v;
} roq_cell;
-typedef struct {
+typedef struct roq_qcell {
int idx[4];
} roq_qcell;
-typedef struct {
+typedef struct motion_vect {
int d[2];
} motion_vect;
@@ -45,7 +45,6 @@ struct RoqTempData;
typedef struct RoqContext {
AVCodecContext *avctx;
- DSPContext dsp;
AVFrame frames[2];
AVFrame *last_frame;
AVFrame *current_frame;
@@ -69,7 +68,7 @@ typedef struct RoqContext {
unsigned int framesSinceKeyframe;
- AVFrame *frame_to_enc;
+ const AVFrame *frame_to_enc;
uint8_t *out_buf;
struct RoqTempData *tmpData;
} RoqContext;
diff --git a/gst-libs/ext/libav/libavcodec/roqvideodec.c b/gst-libs/ext/libav/libavcodec/roqvideodec.c
index fe7863f..d156a84 100644
--- a/gst-libs/ext/libav/libavcodec/roqvideodec.c
+++ b/gst-libs/ext/libav/libavcodec/roqvideodec.c
@@ -44,9 +44,9 @@ static void roqvideo_decode_frame(RoqContext *ri)
int64_t chunk_start;
while (bytestream2_get_bytes_left(&ri->gb) >= 8) {
- chunk_id = bytestream2_get_le16(&ri->gb);
+ chunk_id = bytestream2_get_le16(&ri->gb);
chunk_size = bytestream2_get_le32(&ri->gb);
- chunk_arg = bytestream2_get_le16(&ri->gb);
+ chunk_arg = bytestream2_get_le16(&ri->gb);
if(chunk_id == RoQ_QUAD_VQ)
break;
@@ -60,8 +60,8 @@ static void roqvideo_decode_frame(RoqContext *ri)
ri->cb2x2[i].y[1] = bytestream2_get_byte(&ri->gb);
ri->cb2x2[i].y[2] = bytestream2_get_byte(&ri->gb);
ri->cb2x2[i].y[3] = bytestream2_get_byte(&ri->gb);
- ri->cb2x2[i].u = bytestream2_get_byte(&ri->gb);
- ri->cb2x2[i].v = bytestream2_get_byte(&ri->gb);
+ ri->cb2x2[i].u = bytestream2_get_byte(&ri->gb);
+ ri->cb2x2[i].v = bytestream2_get_byte(&ri->gb);
}
for(i = 0; i < nv2; i++)
for(j = 0; j < 4; j++)
@@ -94,10 +94,10 @@ static void roqvideo_decode_frame(RoqContext *ri)
}
case RoQ_ID_SLD:
qcell = ri->cb4x4 + bytestream2_get_byte(&ri->gb);
- ff_apply_vector_4x4(ri, xp, yp, ri->cb2x2 + qcell->idx[0]);
- ff_apply_vector_4x4(ri, xp+4, yp, ri->cb2x2 + qcell->idx[1]);
- ff_apply_vector_4x4(ri, xp, yp+4, ri->cb2x2 + qcell->idx[2]);
- ff_apply_vector_4x4(ri, xp+4, yp+4, ri->cb2x2 + qcell->idx[3]);
+ ff_apply_vector_4x4(ri, xp, yp, ri->cb2x2 + qcell->idx[0]);
+ ff_apply_vector_4x4(ri, xp + 4, yp, ri->cb2x2 + qcell->idx[1]);
+ ff_apply_vector_4x4(ri, xp, yp + 4, ri->cb2x2 + qcell->idx[2]);
+ ff_apply_vector_4x4(ri, xp + 4, yp + 4, ri->cb2x2 + qcell->idx[3]);
break;
case RoQ_ID_CCC:
for (k = 0; k < 4; k++) {
@@ -124,16 +124,16 @@ static void roqvideo_decode_frame(RoqContext *ri)
}
case RoQ_ID_SLD:
qcell = ri->cb4x4 + bytestream2_get_byte(&ri->gb);
- ff_apply_vector_2x2(ri, x, y, ri->cb2x2 + qcell->idx[0]);
- ff_apply_vector_2x2(ri, x+2, y, ri->cb2x2 + qcell->idx[1]);
- ff_apply_vector_2x2(ri, x, y+2, ri->cb2x2 + qcell->idx[2]);
- ff_apply_vector_2x2(ri, x+2, y+2, ri->cb2x2 + qcell->idx[3]);
+ ff_apply_vector_2x2(ri, x, y, ri->cb2x2 + qcell->idx[0]);
+ ff_apply_vector_2x2(ri, x + 2, y, ri->cb2x2 + qcell->idx[1]);
+ ff_apply_vector_2x2(ri, x, y + 2, ri->cb2x2 + qcell->idx[2]);
+ ff_apply_vector_2x2(ri, x + 2, y + 2, ri->cb2x2 + qcell->idx[3]);
break;
case RoQ_ID_CCC:
- ff_apply_vector_2x2(ri, x, y, ri->cb2x2 + bytestream2_get_byte(&ri->gb));
- ff_apply_vector_2x2(ri, x+2, y, ri->cb2x2 + bytestream2_get_byte(&ri->gb));
- ff_apply_vector_2x2(ri, x, y+2, ri->cb2x2 + bytestream2_get_byte(&ri->gb));
- ff_apply_vector_2x2(ri, x+2, y+2, ri->cb2x2 + bytestream2_get_byte(&ri->gb));
+ ff_apply_vector_2x2(ri, x, y, ri->cb2x2 + bytestream2_get_byte(&ri->gb));
+ ff_apply_vector_2x2(ri, x + 2, y, ri->cb2x2 + bytestream2_get_byte(&ri->gb));
+ ff_apply_vector_2x2(ri, x, y + 2, ri->cb2x2 + bytestream2_get_byte(&ri->gb));
+ ff_apply_vector_2x2(ri, x + 2, y + 2, ri->cb2x2 + bytestream2_get_byte(&ri->gb));
break;
}
}
@@ -159,17 +159,24 @@ static av_cold int roq_decode_init(AVCodecContext *avctx)
RoqContext *s = avctx->priv_data;
s->avctx = avctx;
+
+ if (avctx->width % 16 || avctx->height % 16) {
+ av_log(avctx, AV_LOG_ERROR,
+ "Dimensions must be a multiple of 16\n");
+ return AVERROR_PATCHWELCOME;
+ }
+
s->width = avctx->width;
s->height = avctx->height;
s->last_frame = &s->frames[0];
s->current_frame = &s->frames[1];
- avctx->pix_fmt = PIX_FMT_YUV444P;
+ avctx->pix_fmt = AV_PIX_FMT_YUV444P;
return 0;
}
static int roq_decode_frame(AVCodecContext *avctx,
- void *data, int *data_size,
+ void *data, int *got_frame,
AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
@@ -190,7 +197,7 @@ static int roq_decode_frame(AVCodecContext *avctx,
bytestream2_init(&s->gb, buf, buf_size);
roqvideo_decode_frame(s);
- *data_size = sizeof(AVFrame);
+ *got_frame = 1;
*(AVFrame*)data = *s->current_frame;
/* shuffle frames */
@@ -215,11 +222,11 @@ static av_cold int roq_decode_end(AVCodecContext *avctx)
AVCodec ff_roq_decoder = {
.name = "roqvideo",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_ROQ,
+ .id = AV_CODEC_ID_ROQ,
.priv_data_size = sizeof(RoqContext),
.init = roq_decode_init,
.close = roq_decode_end,
.decode = roq_decode_frame,
.capabilities = CODEC_CAP_DR1,
- .long_name = NULL_IF_CONFIG_SMALL("id RoQ video"),
+ .long_name = NULL_IF_CONFIG_SMALL("id RoQ video"),
};
diff --git a/gst-libs/ext/libav/libavcodec/roqvideoenc.c b/gst-libs/ext/libav/libavcodec/roqvideoenc.c
index 2a62d55..192f1eb 100644
--- a/gst-libs/ext/libav/libavcodec/roqvideoenc.c
+++ b/gst-libs/ext/libav/libavcodec/roqvideoenc.c
@@ -59,6 +59,7 @@
#include "roqvideo.h"
#include "bytestream.h"
#include "elbg.h"
+#include "internal.h"
#include "mathops.h"
#define CHROMA_BIAS 1
@@ -112,7 +113,7 @@ static inline int square(int x)
return x*x;
}
-static inline int eval_sse(uint8_t *a, uint8_t *b, int count)
+static inline int eval_sse(const uint8_t *a, const uint8_t *b, int count)
{
int diff=0;
@@ -124,8 +125,8 @@ static inline int eval_sse(uint8_t *a, uint8_t *b, int count)
// FIXME Could use DSPContext.sse, but it is not so speed critical (used
// just for motion estimation).
-static int block_sse(uint8_t **buf1, uint8_t **buf2, int x1, int y1, int x2,
- int y2, int *stride1, int *stride2, int size)
+static int block_sse(uint8_t * const *buf1, uint8_t * const *buf2, int x1, int y1,
+ int x2, int y2, const int *stride1, const int *stride2, int size)
{
int i, k;
int sse=0;
@@ -260,7 +261,7 @@ static void create_cel_evals(RoqContext *enc, RoqTempdata *tempData)
/**
* Get macroblocks from parts of the image
*/
-static void get_frame_mb(AVFrame *frame, int x, int y, uint8_t mb[], int dim)
+static void get_frame_mb(const AVFrame *frame, int x, int y, uint8_t mb[], int dim)
{
int i, j, cp;
@@ -754,8 +755,8 @@ static void reconstruct_and_encode_image(RoqContext *enc, RoqTempdata *tempData,
/**
* Create a single YUV cell from a 2x2 section of the image
*/
-static inline void frame_block_to_cell(uint8_t *block, uint8_t **data,
- int top, int left, int *stride)
+static inline void frame_block_to_cell(uint8_t *block, uint8_t * const *data,
+ int top, int left, const int *stride)
{
int i, j, u=0, v=0;
@@ -775,7 +776,7 @@ static inline void frame_block_to_cell(uint8_t *block, uint8_t **data,
/**
* Create YUV clusters for the entire image
*/
-static void create_clusters(AVFrame *frame, int w, int h, uint8_t *yuvClusters)
+static void create_clusters(const AVFrame *frame, int w, int h, uint8_t *yuvClusters)
{
int i, j, k, l;
@@ -1001,13 +1002,12 @@ static void roq_write_video_info_chunk(RoqContext *enc)
bytestream_put_byte(&enc->out_buf, 0x00);
}
-static int roq_encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size, void *data)
+static int roq_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
+ const AVFrame *frame, int *got_packet)
{
RoqContext *enc = avctx->priv_data;
- AVFrame *frame= data;
- uint8_t *buf_start = buf;
+ int size, ret;
- enc->out_buf = buf;
enc->avctx = avctx;
enc->frame_to_enc = frame;
@@ -1019,10 +1019,12 @@ static int roq_encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_s
/* 138 bits max per 8x8 block +
* 256 codebooks*(6 bytes 2x2 + 4 bytes 4x4) + 8 bytes frame header */
- if (((enc->width*enc->height/64)*138+7)/8 + 256*(6+4) + 8 > buf_size) {
- av_log(avctx, AV_LOG_ERROR, " RoQ: Output buffer too small!\n");
- return -1;
+ size = ((enc->width * enc->height / 64) * 138 + 7) / 8 + 256 * (6 + 4) + 8;
+ if ((ret = ff_alloc_packet(pkt, size)) < 0) {
+ av_log(avctx, AV_LOG_ERROR, "Error getting output packet with size %d.\n", size);
+ return ret;
}
+ enc->out_buf = pkt->data;
/* Check for I frame */
if (enc->framesSinceKeyframe == avctx->gop_size)
@@ -1031,8 +1033,8 @@ static int roq_encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_s
if (enc->first_frame) {
/* Alloc memory for the reconstruction data (we must know the stride
for that) */
- if (avctx->get_buffer(avctx, enc->current_frame) ||
- avctx->get_buffer(avctx, enc->last_frame)) {
+ if (ff_get_buffer(avctx, enc->current_frame) ||
+ ff_get_buffer(avctx, enc->last_frame)) {
av_log(avctx, AV_LOG_ERROR, " RoQ: get_buffer() failed\n");
return -1;
}
@@ -1046,7 +1048,12 @@ static int roq_encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_s
/* Encode the actual frame */
roq_encode_video(enc);
- return enc->out_buf - buf_start;
+ pkt->size = enc->out_buf - pkt->data;
+ if (enc->framesSinceKeyframe == 1)
+ pkt->flags |= AV_PKT_FLAG_KEY;
+ *got_packet = 1;
+
+ return 0;
}
static int roq_encode_end(AVCodecContext *avctx)
@@ -1068,12 +1075,13 @@ static int roq_encode_end(AVCodecContext *avctx)
AVCodec ff_roq_encoder = {
.name = "roqvideo",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_ROQ,
+ .id = AV_CODEC_ID_ROQ,
.priv_data_size = sizeof(RoqContext),
.init = roq_encode_init,
- .encode = roq_encode_frame,
+ .encode2 = roq_encode_frame,
.close = roq_encode_end,
- .supported_framerates = (const AVRational[]){{30,1}, {0,0}},
- .pix_fmts = (const enum PixelFormat[]){PIX_FMT_YUV444P, PIX_FMT_NONE},
+ .supported_framerates = (const AVRational[]){ {30,1}, {0,0} },
+ .pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_YUV444P,
+ AV_PIX_FMT_NONE },
.long_name = NULL_IF_CONFIG_SMALL("id RoQ video"),
};
diff --git a/gst-libs/ext/libav/libavcodec/rpza.c b/gst-libs/ext/libav/libavcodec/rpza.c
index 59c3a7b..57d4d2d 100644
--- a/gst-libs/ext/libav/libavcodec/rpza.c
+++ b/gst-libs/ext/libav/libavcodec/rpza.c
@@ -38,6 +38,7 @@
#include <stdlib.h>
#include <string.h>
+#include "libavutil/internal.h"
#include "libavutil/intreadwrite.h"
#include "avcodec.h"
@@ -235,7 +236,7 @@ static av_cold int rpza_decode_init(AVCodecContext *avctx)
RpzaContext *s = avctx->priv_data;
s->avctx = avctx;
- avctx->pix_fmt = PIX_FMT_RGB555;
+ avctx->pix_fmt = AV_PIX_FMT_RGB555;
s->frame.data[0] = NULL;
@@ -243,7 +244,7 @@ static av_cold int rpza_decode_init(AVCodecContext *avctx)
}
static int rpza_decode_frame(AVCodecContext *avctx,
- void *data, int *data_size,
+ void *data, int *got_frame,
AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
@@ -262,7 +263,7 @@ static int rpza_decode_frame(AVCodecContext *avctx,
rpza_decode_stream(s);
- *data_size = sizeof(AVFrame);
+ *got_frame = 1;
*(AVFrame*)data = s->frame;
/* always report that the buffer was completely consumed */
@@ -282,11 +283,11 @@ static av_cold int rpza_decode_end(AVCodecContext *avctx)
AVCodec ff_rpza_decoder = {
.name = "rpza",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_RPZA,
+ .id = AV_CODEC_ID_RPZA,
.priv_data_size = sizeof(RpzaContext),
.init = rpza_decode_init,
.close = rpza_decode_end,
.decode = rpza_decode_frame,
.capabilities = CODEC_CAP_DR1,
- .long_name = NULL_IF_CONFIG_SMALL("QuickTime video (RPZA)"),
+ .long_name = NULL_IF_CONFIG_SMALL("QuickTime video (RPZA)"),
};
diff --git a/gst-libs/ext/libav/libavcodec/rtjpeg.c b/gst-libs/ext/libav/libavcodec/rtjpeg.c
index 2c5ef0a..3604585 100644
--- a/gst-libs/ext/libav/libavcodec/rtjpeg.c
+++ b/gst-libs/ext/libav/libavcodec/rtjpeg.c
@@ -97,15 +97,15 @@ static inline int get_block(GetBitContext *gb, DCTELEM *block, const uint8_t *sc
/**
* @brief decode one rtjpeg YUV420 frame
- * @param c context, must be initialized via rtjpeg_decode_init
+ * @param c context, must be initialized via ff_rtjpeg_decode_init
* @param f AVFrame to place decoded frame into. If parts of the frame
* are not coded they are left unchanged, so consider initializing it
* @param buf buffer containing input data
* @param buf_size length of input data in bytes
* @return number of bytes consumed from the input buffer
*/
-int rtjpeg_decode_frame_yuv420(RTJpegContext *c, AVFrame *f,
- const uint8_t *buf, int buf_size) {
+int ff_rtjpeg_decode_frame_yuv420(RTJpegContext *c, AVFrame *f,
+ const uint8_t *buf, int buf_size) {
GetBitContext gb;
int w = c->w / 16, h = c->h / 16;
int x, y;
@@ -154,9 +154,9 @@ int rtjpeg_decode_frame_yuv420(RTJpegContext *c, AVFrame *f,
* @param lquant luma quantization table to use
* @param cquant chroma quantization table to use
*/
-void rtjpeg_decode_init(RTJpegContext *c, DSPContext *dsp,
- int width, int height,
- const uint32_t *lquant, const uint32_t *cquant) {
+void ff_rtjpeg_decode_init(RTJpegContext *c, DSPContext *dsp,
+ int width, int height,
+ const uint32_t *lquant, const uint32_t *cquant) {
int i;
c->dsp = dsp;
for (i = 0; i < 64; i++) {
diff --git a/gst-libs/ext/libav/libavcodec/rtjpeg.h b/gst-libs/ext/libav/libavcodec/rtjpeg.h
index 4b46689..9fbfb34 100644
--- a/gst-libs/ext/libav/libavcodec/rtjpeg.h
+++ b/gst-libs/ext/libav/libavcodec/rtjpeg.h
@@ -24,11 +24,12 @@
#include <stdint.h>
#include "dsputil.h"
+#include "libavutil/mem.h"
#define RTJPEG_FILE_VERSION 0
#define RTJPEG_HEADER_SIZE 12
-typedef struct {
+typedef struct RTJpegContext {
int w, h;
DSPContext *dsp;
uint8_t scan[64];
@@ -37,10 +38,10 @@ typedef struct {
DECLARE_ALIGNED(16, DCTELEM, block)[64];
} RTJpegContext;
-void rtjpeg_decode_init(RTJpegContext *c, DSPContext *dsp,
+void ff_rtjpeg_decode_init(RTJpegContext *c, DSPContext *dsp,
int width, int height,
const uint32_t *lquant, const uint32_t *cquant);
-int rtjpeg_decode_frame_yuv420(RTJpegContext *c, AVFrame *f,
+int ff_rtjpeg_decode_frame_yuv420(RTJpegContext *c, AVFrame *f,
const uint8_t *buf, int buf_size);
#endif /* AVCODEC_RTJPEG_H */
diff --git a/gst-libs/ext/libav/libavcodec/rv10.c b/gst-libs/ext/libav/libavcodec/rv10.c
index 4f64ec2..26af29f 100644
--- a/gst-libs/ext/libav/libavcodec/rv10.c
+++ b/gst-libs/ext/libav/libavcodec/rv10.c
@@ -40,6 +40,11 @@
#define DC_VLC_BITS 14 //FIXME find a better solution
+typedef struct RVDecContext {
+ MpegEncContext m;
+ int sub_id;
+} RVDecContext;
+
static const uint16_t rv_lum_code[256] =
{
0x3e7f, 0x0f00, 0x0f01, 0x0f02, 0x0f03, 0x0f04, 0x0f05, 0x0f06,
@@ -186,7 +191,7 @@ static const uint8_t rv_chrom_bits[256] =
static VLC rv_dc_lum, rv_dc_chrom;
-int rv_decode_dc(MpegEncContext *s, int n)
+int ff_rv_decode_dc(MpegEncContext *s, int n)
{
int code;
@@ -293,8 +298,9 @@ static int rv10_decode_picture_header(MpegEncContext *s)
return mb_count;
}
-static int rv20_decode_picture_header(MpegEncContext *s)
+static int rv20_decode_picture_header(RVDecContext *rv)
{
+ MpegEncContext *s = &rv->m;
int seq, mb_pos, i;
int rpr_bits;
@@ -325,10 +331,10 @@ static int rv20_decode_picture_header(MpegEncContext *s)
return -1;
}
- if(RV_GET_MINOR_VER(s->avctx->sub_id) >= 2)
+ if(RV_GET_MINOR_VER(rv->sub_id) >= 2)
s->loop_filter = get_bits1(&s->gb);
- if(RV_GET_MINOR_VER(s->avctx->sub_id) <= 1)
+ if(RV_GET_MINOR_VER(rv->sub_id) <= 1)
seq = get_bits(&s->gb, 8) << 7;
else
seq = get_bits(&s->gb, 13) << 2;
@@ -356,11 +362,11 @@ static int rv20_decode_picture_header(MpegEncContext *s)
av_log(s->avctx, AV_LOG_DEBUG, "attempting to change resolution to %dx%d\n", new_w, new_h);
if (av_image_check_size(new_w, new_h, 0, s->avctx) < 0)
return -1;
- MPV_common_end(s);
+ ff_MPV_common_end(s);
avcodec_set_dimensions(s->avctx, new_w, new_h);
s->width = new_w;
s->height = new_h;
- if (MPV_common_init(s) < 0)
+ if (ff_MPV_common_init(s) < 0)
return -1;
}
@@ -372,7 +378,6 @@ static int rv20_decode_picture_header(MpegEncContext *s)
mb_pos = ff_h263_decode_mba(s);
-//av_log(s->avctx, AV_LOG_DEBUG, "%d\n", seq);
seq |= s->time &~0x7FFF;
if(seq - s->time > 0x4000) seq -= 0x8000;
if(seq - s->time < -0x4000) seq += 0x8000;
@@ -391,14 +396,10 @@ static int rv20_decode_picture_header(MpegEncContext *s)
ff_mpeg4_init_direct_mv(s);
}
}
-// printf("%d %d %d %d %d\n", seq, (int)s->time, (int)s->last_non_b_time, s->pp_time, s->pb_time);
-/*for(i=0; i<32; i++){
- av_log(s->avctx, AV_LOG_DEBUG, "%d", get_bits1(&s->gb));
-}
-av_log(s->avctx, AV_LOG_DEBUG, "\n");*/
+
s->no_rounding= get_bits1(&s->gb);
- if(RV_GET_MINOR_VER(s->avctx->sub_id) <= 1 && s->pict_type == AV_PICTURE_TYPE_B)
+ if(RV_GET_MINOR_VER(rv->sub_id) <= 1 && s->pict_type == AV_PICTURE_TYPE_B)
skip_bits(&s->gb, 5); // binary decoder reads 3+2 bits here but they don't seem to be used
s->f_code = 1;
@@ -408,8 +409,7 @@ av_log(s->avctx, AV_LOG_DEBUG, "\n");*/
// s->obmc=1;
// s->umvplus=1;
s->modified_quant=1;
- if(!s->avctx->lowres)
- s->loop_filter=1;
+ s->loop_filter=1;
if(s->avctx->debug & FF_DEBUG_PICT_INFO){
av_log(s->avctx, AV_LOG_INFO, "num:%5d x:%2d y:%2d type:%d qscale:%2d rnd:%d\n",
@@ -423,7 +423,8 @@ av_log(s->avctx, AV_LOG_DEBUG, "\n");*/
static av_cold int rv10_decode_init(AVCodecContext *avctx)
{
- MpegEncContext *s = avctx->priv_data;
+ RVDecContext *rv = avctx->priv_data;
+ MpegEncContext *s = &rv->m;
static int done=0;
int major_ver, minor_ver, micro_ver;
@@ -432,7 +433,7 @@ static av_cold int rv10_decode_init(AVCodecContext *avctx)
return -1;
}
- MPV_decode_defaults(s);
+ ff_MPV_decode_defaults(s);
s->avctx= avctx;
s->out_format = FMT_H263;
@@ -443,11 +444,11 @@ static av_cold int rv10_decode_init(AVCodecContext *avctx)
s->orig_height= s->height = avctx->coded_height;
s->h263_long_vectors= ((uint8_t*)avctx->extradata)[3] & 1;
- avctx->sub_id= AV_RB32((uint8_t*)avctx->extradata + 4);
+ rv->sub_id = AV_RB32((uint8_t*)avctx->extradata + 4);
- major_ver = RV_GET_MAJOR_VER(avctx->sub_id);
- minor_ver = RV_GET_MINOR_VER(avctx->sub_id);
- micro_ver = RV_GET_MICRO_VER(avctx->sub_id);
+ major_ver = RV_GET_MAJOR_VER(rv->sub_id);
+ minor_ver = RV_GET_MINOR_VER(rv->sub_id);
+ micro_ver = RV_GET_MICRO_VER(rv->sub_id);
s->low_delay = 1;
switch (major_ver) {
@@ -462,18 +463,18 @@ static av_cold int rv10_decode_init(AVCodecContext *avctx)
}
break;
default:
- av_log(s->avctx, AV_LOG_ERROR, "unknown header %X\n", avctx->sub_id);
+ av_log(s->avctx, AV_LOG_ERROR, "unknown header %X\n", rv->sub_id);
av_log_missing_feature(avctx, "RV1/2 version", 1);
return AVERROR_PATCHWELCOME;
}
if(avctx->debug & FF_DEBUG_PICT_INFO){
- av_log(avctx, AV_LOG_DEBUG, "ver:%X ver0:%X\n", avctx->sub_id, avctx->extradata_size >= 4 ? ((uint32_t*)avctx->extradata)[0] : -1);
+ av_log(avctx, AV_LOG_DEBUG, "ver:%X ver0:%X\n", rv->sub_id, avctx->extradata_size >= 4 ? ((uint32_t*)avctx->extradata)[0] : -1);
}
- avctx->pix_fmt = PIX_FMT_YUV420P;
+ avctx->pix_fmt = AV_PIX_FMT_YUV420P;
- if (MPV_common_init(s) < 0)
+ if (ff_MPV_common_init(s) < 0)
return -1;
ff_h263_decode_init_vlc(s);
@@ -496,22 +497,23 @@ static av_cold int rv10_decode_end(AVCodecContext *avctx)
{
MpegEncContext *s = avctx->priv_data;
- MPV_common_end(s);
+ ff_MPV_common_end(s);
return 0;
}
static int rv10_decode_packet(AVCodecContext *avctx,
const uint8_t *buf, int buf_size, int buf_size2)
{
- MpegEncContext *s = avctx->priv_data;
+ RVDecContext *rv = avctx->priv_data;
+ MpegEncContext *s = &rv->m;
int mb_count, mb_pos, left, start_mb_x, active_bits_size;
active_bits_size = buf_size * 8;
init_get_bits(&s->gb, buf, FFMAX(buf_size, buf_size2) * 8);
- if(s->codec_id ==CODEC_ID_RV10)
+ if(s->codec_id ==AV_CODEC_ID_RV10)
mb_count = rv10_decode_picture_header(s);
else
- mb_count = rv20_decode_picture_header(s);
+ mb_count = rv20_decode_picture_header(rv);
if (mb_count < 0) {
av_log(s->avctx, AV_LOG_ERROR, "HEADER ERROR\n");
return -1;
@@ -532,10 +534,10 @@ static int rv10_decode_packet(AVCodecContext *avctx,
if ((s->mb_x == 0 && s->mb_y == 0) || s->current_picture_ptr==NULL) {
if(s->current_picture_ptr){ //FIXME write parser so we always have complete frames?
ff_er_frame_end(s);
- MPV_frame_end(s);
+ ff_MPV_frame_end(s);
s->mb_x= s->mb_y = s->resync_mb_x = s->resync_mb_y= 0;
}
- if(MPV_frame_start(s, avctx) < 0)
+ if(ff_MPV_frame_start(s, avctx) < 0)
return -1;
ff_er_frame_start(s);
} else {
@@ -548,7 +550,7 @@ static int rv10_decode_packet(AVCodecContext *avctx,
av_dlog(avctx, "qscale=%d\n", s->qscale);
/* default quantization values */
- if(s->codec_id== CODEC_ID_RV10){
+ if(s->codec_id== AV_CODEC_ID_RV10){
if(s->mb_y==0) s->first_slice_line=1;
}else{
s->first_slice_line=1;
@@ -615,7 +617,7 @@ static int rv10_decode_packet(AVCodecContext *avctx,
}
if(s->pict_type != AV_PICTURE_TYPE_B)
ff_h263_update_motion_val(s);
- MPV_decode_mb(s, s->block);
+ ff_MPV_decode_mb(s, s->block);
if(s->loop_filter)
ff_h263_loop_filter(s);
@@ -641,7 +643,7 @@ static int get_slice_offset(AVCodecContext *avctx, const uint8_t *buf, int n)
}
static int rv10_decode_frame(AVCodecContext *avctx,
- void *data, int *data_size,
+ void *data, int *got_frame,
AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
@@ -671,9 +673,12 @@ static int rv10_decode_frame(AVCodecContext *avctx,
slice_count = avctx->slice_count;
for(i=0; i<slice_count; i++){
- int offset= get_slice_offset(avctx, slices_hdr, i);
+ unsigned offset = get_slice_offset(avctx, slices_hdr, i);
int size, size2;
+ if (offset >= buf_size)
+ return AVERROR_INVALIDDATA;
+
if(i+1 == slice_count)
size= buf_size - offset;
else
@@ -684,25 +689,29 @@ static int rv10_decode_frame(AVCodecContext *avctx,
else
size2= get_slice_offset(avctx, slices_hdr, i+2) - offset;
+ if (size <= 0 || size2 <= 0 ||
+ offset + FFMAX(size, size2) > buf_size)
+ return AVERROR_INVALIDDATA;
+
if(rv10_decode_packet(avctx, buf+offset, size, size2) > 8*size)
i++;
}
if(s->current_picture_ptr != NULL && s->mb_y>=s->mb_height){
ff_er_frame_end(s);
- MPV_frame_end(s);
+ ff_MPV_frame_end(s);
if (s->pict_type == AV_PICTURE_TYPE_B || s->low_delay) {
- *pict= *(AVFrame*)s->current_picture_ptr;
+ *pict = s->current_picture_ptr->f;
} else if (s->last_picture_ptr != NULL) {
- *pict= *(AVFrame*)s->last_picture_ptr;
+ *pict = s->last_picture_ptr->f;
}
if(s->last_picture_ptr || s->low_delay){
- *data_size = sizeof(AVFrame);
+ *got_frame = 1;
ff_print_debug_info(s, pict);
}
- s->current_picture_ptr= NULL; //so we can detect if frame_end wasnt called (find some nicer solution...)
+ s->current_picture_ptr= NULL; // so we can detect if frame_end was not called (find some nicer solution...)
}
return avpkt->size;
@@ -711,28 +720,26 @@ static int rv10_decode_frame(AVCodecContext *avctx,
AVCodec ff_rv10_decoder = {
.name = "rv10",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_RV10,
- .priv_data_size = sizeof(MpegEncContext),
+ .id = AV_CODEC_ID_RV10,
+ .priv_data_size = sizeof(RVDecContext),
.init = rv10_decode_init,
.close = rv10_decode_end,
.decode = rv10_decode_frame,
.capabilities = CODEC_CAP_DR1,
- .max_lowres = 3,
- .long_name = NULL_IF_CONFIG_SMALL("RealVideo 1.0"),
- .pix_fmts= ff_pixfmt_list_420,
+ .long_name = NULL_IF_CONFIG_SMALL("RealVideo 1.0"),
+ .pix_fmts = ff_pixfmt_list_420,
};
AVCodec ff_rv20_decoder = {
.name = "rv20",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_RV20,
- .priv_data_size = sizeof(MpegEncContext),
+ .id = AV_CODEC_ID_RV20,
+ .priv_data_size = sizeof(RVDecContext),
.init = rv10_decode_init,
.close = rv10_decode_end,
.decode = rv10_decode_frame,
.capabilities = CODEC_CAP_DR1 | CODEC_CAP_DELAY,
- .flush= ff_mpeg_flush,
- .max_lowres = 3,
- .long_name = NULL_IF_CONFIG_SMALL("RealVideo 2.0"),
- .pix_fmts= ff_pixfmt_list_420,
+ .flush = ff_mpeg_flush,
+ .long_name = NULL_IF_CONFIG_SMALL("RealVideo 2.0"),
+ .pix_fmts = ff_pixfmt_list_420,
};
diff --git a/gst-libs/ext/libav/libavcodec/rv10enc.c b/gst-libs/ext/libav/libavcodec/rv10enc.c
index e96e473..d3cd12c 100644
--- a/gst-libs/ext/libav/libavcodec/rv10enc.c
+++ b/gst-libs/ext/libav/libavcodec/rv10enc.c
@@ -28,7 +28,7 @@
#include "mpegvideo.h"
#include "put_bits.h"
-void rv10_encode_picture_header(MpegEncContext *s, int picture_number)
+void ff_rv10_encode_picture_header(MpegEncContext *s, int picture_number)
{
int full_frame= 0;
@@ -56,14 +56,17 @@ void rv10_encode_picture_header(MpegEncContext *s, int picture_number)
put_bits(&s->pb, 3, 0); /* ignored */
}
+FF_MPV_GENERIC_CLASS(rv10)
+
AVCodec ff_rv10_encoder = {
.name = "rv10",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_RV10,
+ .id = AV_CODEC_ID_RV10,
.priv_data_size = sizeof(MpegEncContext),
- .init = MPV_encode_init,
- .encode = MPV_encode_picture,
- .close = MPV_encode_end,
- .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE},
- .long_name= NULL_IF_CONFIG_SMALL("RealVideo 1.0"),
+ .init = ff_MPV_encode_init,
+ .encode2 = ff_MPV_encode_picture,
+ .close = ff_MPV_encode_end,
+ .pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_YUV420P, AV_PIX_FMT_NONE },
+ .long_name = NULL_IF_CONFIG_SMALL("RealVideo 1.0"),
+ .priv_class = &rv10_class,
};
diff --git a/gst-libs/ext/libav/libavcodec/rv20enc.c b/gst-libs/ext/libav/libavcodec/rv20enc.c
index bf09d8a..c392b53 100644
--- a/gst-libs/ext/libav/libavcodec/rv20enc.c
+++ b/gst-libs/ext/libav/libavcodec/rv20enc.c
@@ -29,7 +29,7 @@
#include "h263.h"
#include "put_bits.h"
-void rv20_encode_picture_header(MpegEncContext *s, int picture_number){
+void ff_rv20_encode_picture_header(MpegEncContext *s, int picture_number){
put_bits(&s->pb, 2, s->pict_type); //I 0 vs. 1 ?
put_bits(&s->pb, 1, 0); /* unknown bit */
put_bits(&s->pb, 5, s->qscale);
@@ -57,14 +57,17 @@ void rv20_encode_picture_header(MpegEncContext *s, int picture_number){
}
}
+FF_MPV_GENERIC_CLASS(rv20)
+
AVCodec ff_rv20_encoder = {
.name = "rv20",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_RV20,
+ .id = AV_CODEC_ID_RV20,
.priv_data_size = sizeof(MpegEncContext),
- .init = MPV_encode_init,
- .encode = MPV_encode_picture,
- .close = MPV_encode_end,
- .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE},
- .long_name= NULL_IF_CONFIG_SMALL("RealVideo 2.0"),
+ .init = ff_MPV_encode_init,
+ .encode2 = ff_MPV_encode_picture,
+ .close = ff_MPV_encode_end,
+ .pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_YUV420P, AV_PIX_FMT_NONE },
+ .long_name = NULL_IF_CONFIG_SMALL("RealVideo 2.0"),
+ .priv_class = &rv20_class,
};
diff --git a/gst-libs/ext/libav/libavcodec/rv30.c b/gst-libs/ext/libav/libavcodec/rv30.c
index 4828e98..3c3579b 100644
--- a/gst-libs/ext/libav/libavcodec/rv30.c
+++ b/gst-libs/ext/libav/libavcodec/rv30.c
@@ -73,7 +73,7 @@ static int rv30_decode_intra_types(RV34DecContext *r, GetBitContext *gb, int8_t
for(i = 0; i < 4; i++, dst += r->intra_types_stride - 4){
for(j = 0; j < 4; j+= 2){
- int code = svq3_get_ue_golomb(gb) << 1;
+ unsigned code = svq3_get_ue_golomb(gb) << 1;
if(code >= 81*2){
av_log(r->s.avctx, AV_LOG_ERROR, "Incorrect intra prediction code\n");
return -1;
@@ -101,9 +101,9 @@ static int rv30_decode_mb_info(RV34DecContext *r)
static const int rv30_b_types[6] = { RV34_MB_SKIP, RV34_MB_B_DIRECT, RV34_MB_B_FORWARD, RV34_MB_B_BACKWARD, RV34_MB_TYPE_INTRA, RV34_MB_TYPE_INTRA16x16 };
MpegEncContext *s = &r->s;
GetBitContext *gb = &s->gb;
- int code = svq3_get_ue_golomb(gb);
+ unsigned code = svq3_get_ue_golomb(gb);
- if(code > 11){
+ if (code > 11) {
av_log(s->avctx, AV_LOG_ERROR, "Incorrect MB type code\n");
return -1;
}
@@ -182,7 +182,7 @@ static void rv30_loop_filter(RV34DecContext *r, int row)
for(i = !mb_x; i < 2; i++, C += 4){
int ij = i + (j >> 1);
loc_lim = 0;
- if(cur_cbp && (1 << ij))
+ if (cur_cbp & (1 << ij))
loc_lim = cur_lim;
else if(!i && left_cbp & (1 << (ij + 1)))
loc_lim = left_lim;
@@ -224,7 +224,7 @@ static void rv30_loop_filter(RV34DecContext *r, int row)
for(i = 0; i < 2; i++, C += 4){
int ij = i + (j >> 1);
loc_lim = 0;
- if(r->cbp_chroma[mb_pos] && (1 << ij))
+ if (r->cbp_chroma[mb_pos] & (1 << ij))
loc_lim = cur_lim;
else if(!j && top_cbp & (1 << (ij + 2)))
loc_lim = top_lim;
@@ -268,17 +268,18 @@ static av_cold int rv30_decode_init(AVCodecContext *avctx)
}
AVCodec ff_rv30_decoder = {
- .name = "rv30",
- .type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_RV30,
- .priv_data_size = sizeof(RV34DecContext),
- .init = rv30_decode_init,
- .close = ff_rv34_decode_end,
- .decode = ff_rv34_decode_frame,
- .capabilities = CODEC_CAP_DR1 | CODEC_CAP_DELAY | CODEC_CAP_FRAME_THREADS,
- .flush = ff_mpeg_flush,
- .long_name = NULL_IF_CONFIG_SMALL("RealVideo 3.0"),
- .pix_fmts = ff_pixfmt_list_420,
+ .name = "rv30",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .id = AV_CODEC_ID_RV30,
+ .priv_data_size = sizeof(RV34DecContext),
+ .init = rv30_decode_init,
+ .close = ff_rv34_decode_end,
+ .decode = ff_rv34_decode_frame,
+ .capabilities = CODEC_CAP_DR1 | CODEC_CAP_DELAY |
+ CODEC_CAP_FRAME_THREADS,
+ .flush = ff_mpeg_flush,
+ .long_name = NULL_IF_CONFIG_SMALL("RealVideo 3.0"),
+ .pix_fmts = ff_pixfmt_list_420,
.init_thread_copy = ONLY_IF_THREADS_ENABLED(ff_rv34_decode_init_thread_copy),
.update_thread_context = ONLY_IF_THREADS_ENABLED(ff_rv34_decode_update_thread_context),
};
diff --git a/gst-libs/ext/libav/libavcodec/rv34.c b/gst-libs/ext/libav/libavcodec/rv34.c
index c05b71b..3106bfb 100644
--- a/gst-libs/ext/libav/libavcodec/rv34.c
+++ b/gst-libs/ext/libav/libavcodec/rv34.c
@@ -260,20 +260,15 @@ static inline void decode_subblock1(DCTELEM *dst, int code, GetBitContext *gb, V
decode_coeff(dst, coeff, 3, gb, vlc, q);
}
-static inline void decode_subblock3(DCTELEM *dst, int code, const int is_block2, GetBitContext *gb, VLC *vlc,
+static inline void decode_subblock3(DCTELEM *dst, int code, GetBitContext *gb, VLC *vlc,
int q_dc, int q_ac1, int q_ac2)
{
int flags = modulo_three_table[code];
- decode_coeff( dst+0*4+0, (flags >> 6) , 3, gb, vlc, q_dc);
- if(is_block2){
- decode_coeff(dst+1*4+0, (flags >> 4) & 3, 2, gb, vlc, q_ac1);
- decode_coeff(dst+0*4+1, (flags >> 2) & 3, 2, gb, vlc, q_ac1);
- }else{
- decode_coeff(dst+0*4+1, (flags >> 4) & 3, 2, gb, vlc, q_ac1);
- decode_coeff(dst+1*4+0, (flags >> 2) & 3, 2, gb, vlc, q_ac1);
- }
- decode_coeff( dst+1*4+1, (flags >> 0) & 3, 2, gb, vlc, q_ac2);
+ decode_coeff(dst+0*4+0, (flags >> 6) , 3, gb, vlc, q_dc);
+ decode_coeff(dst+0*4+1, (flags >> 4) & 3, 2, gb, vlc, q_ac1);
+ decode_coeff(dst+1*4+0, (flags >> 2) & 3, 2, gb, vlc, q_ac1);
+ decode_coeff(dst+1*4+1, (flags >> 0) & 3, 2, gb, vlc, q_ac2);
}
/**
@@ -287,7 +282,7 @@ static inline void decode_subblock3(DCTELEM *dst, int code, const int is_block2,
* o--o
*/
-static inline int rv34_decode_block(DCTELEM *dst, GetBitContext *gb, RV34VLC *rvlc, int fc, int sc, int q_dc, int q_ac1, int q_ac2)
+static int rv34_decode_block(DCTELEM *dst, GetBitContext *gb, RV34VLC *rvlc, int fc, int sc, int q_dc, int q_ac1, int q_ac2)
{
int code, pattern, has_ac = 1;
@@ -298,7 +293,7 @@ static inline int rv34_decode_block(DCTELEM *dst, GetBitContext *gb, RV34VLC *rv
code >>= 3;
if (modulo_three_table[code] & 0x3F) {
- decode_subblock3(dst, code, 0, gb, &rvlc->coefficient, q_dc, q_ac1, q_ac2);
+ decode_subblock3(dst, code, gb, &rvlc->coefficient, q_dc, q_ac1, q_ac2);
} else {
decode_subblock1(dst, code, gb, &rvlc->coefficient, q_dc);
if (!pattern)
@@ -318,7 +313,7 @@ static inline int rv34_decode_block(DCTELEM *dst, GetBitContext *gb, RV34VLC *rv
code = get_vlc2(gb, rvlc->third_pattern[sc].table, 9, 2);
decode_subblock(dst + 4*2+2, code, 0, gb, &rvlc->coefficient, q_ac2);
}
- return has_ac || pattern;
+ return has_ac | pattern;
}
/**
@@ -472,26 +467,26 @@ static void rv34_pred_mv(RV34DecContext *r, int block_type, int subblock_no, int
int A[2] = {0}, B[2], C[2];
int i, j;
int mx, my;
- int avail_index = avail_indexes[subblock_no];
+ int* avail = r->avail_cache + avail_indexes[subblock_no];
int c_off = part_sizes_w[block_type];
mv_pos += (subblock_no & 1) + (subblock_no >> 1)*s->b8_stride;
if(subblock_no == 3)
c_off = -1;
- if(r->avail_cache[avail_index - 1]){
+ if(avail[-1]){
A[0] = s->current_picture_ptr->f.motion_val[0][mv_pos-1][0];
A[1] = s->current_picture_ptr->f.motion_val[0][mv_pos-1][1];
}
- if(r->avail_cache[avail_index - 4]){
+ if(avail[-4]){
B[0] = s->current_picture_ptr->f.motion_val[0][mv_pos-s->b8_stride][0];
B[1] = s->current_picture_ptr->f.motion_val[0][mv_pos-s->b8_stride][1];
}else{
B[0] = A[0];
B[1] = A[1];
}
- if(!r->avail_cache[avail_index - 4 + c_off]){
- if(r->avail_cache[avail_index - 4] && (r->avail_cache[avail_index - 1] || r->rv30)){
+ if(!avail[c_off-4]){
+ if(avail[-4] && (avail[-1] || r->rv30)){
C[0] = s->current_picture_ptr->f.motion_val[0][mv_pos-s->b8_stride-1][0];
C[1] = s->current_picture_ptr->f.motion_val[0][mv_pos-s->b8_stride-1][1];
}else{
@@ -521,7 +516,7 @@ static void rv34_pred_mv(RV34DecContext *r, int block_type, int subblock_no, int
*/
static int calc_add_mv(RV34DecContext *r, int dir, int val)
{
- int mul = dir ? -r->weight2 : r->weight1;
+ int mul = dir ? -r->mv_weight2 : r->mv_weight1;
return (val * mul + 0x2000) >> 14;
}
@@ -554,7 +549,7 @@ static void rv34_pred_mv_b(RV34DecContext *r, int block_type, int dir)
MpegEncContext *s = &r->s;
int mb_pos = s->mb_x + s->mb_y * s->mb_stride;
int mv_pos = s->mb_x * 2 + s->mb_y * 2 * s->b8_stride;
- int A[2], B[2], C[2];
+ int A[2] = { 0 }, B[2] = { 0 }, C[2] = { 0 };
int has_A = 0, has_B = 0, has_C = 0;
int mx, my;
int i, j;
@@ -562,9 +557,6 @@ static void rv34_pred_mv_b(RV34DecContext *r, int block_type, int dir)
const int mask = dir ? MB_TYPE_L1 : MB_TYPE_L0;
int type = cur_pic->f.mb_type[mb_pos];
- memset(A, 0, sizeof(A));
- memset(B, 0, sizeof(B));
- memset(C, 0, sizeof(C));
if((r->avail_cache[6-1] & type) & mask){
A[0] = cur_pic->f.motion_val[dir][mv_pos - 1][0];
A[1] = cur_pic->f.motion_val[dir][mv_pos - 1][1];
@@ -611,21 +603,21 @@ static void rv34_pred_mv_rv3(RV34DecContext *r, int block_type, int dir)
int A[2] = {0}, B[2], C[2];
int i, j, k;
int mx, my;
- int avail_index = avail_indexes[0];
+ int* avail = r->avail_cache + avail_indexes[0];
- if(r->avail_cache[avail_index - 1]){
+ if(avail[-1]){
A[0] = s->current_picture_ptr->f.motion_val[0][mv_pos - 1][0];
A[1] = s->current_picture_ptr->f.motion_val[0][mv_pos - 1][1];
}
- if(r->avail_cache[avail_index - 4]){
+ if(avail[-4]){
B[0] = s->current_picture_ptr->f.motion_val[0][mv_pos - s->b8_stride][0];
B[1] = s->current_picture_ptr->f.motion_val[0][mv_pos - s->b8_stride][1];
}else{
B[0] = A[0];
B[1] = A[1];
}
- if(!r->avail_cache[avail_index - 4 + 2]){
- if(r->avail_cache[avail_index - 4] && (r->avail_cache[avail_index - 1])){
+ if(!avail[-4 + 2]){
+ if(avail[-4] && (avail[-1])){
C[0] = s->current_picture_ptr->f.motion_val[0][mv_pos - s->b8_stride - 1][0];
C[1] = s->current_picture_ptr->f.motion_val[0][mv_pos - s->b8_stride - 1][1];
}else{
@@ -733,12 +725,12 @@ static inline void rv34_mc(RV34DecContext *r, const int block_type,
uint8_t *uvbuf = s->edge_emu_buffer + 22 * s->linesize;
srcY -= 2 + 2*s->linesize;
- s->dsp.emulated_edge_mc(s->edge_emu_buffer, srcY, s->linesize, (width<<3)+6, (height<<3)+6,
+ s->vdsp.emulated_edge_mc(s->edge_emu_buffer, srcY, s->linesize, (width<<3)+6, (height<<3)+6,
src_x - 2, src_y - 2, s->h_edge_pos, s->v_edge_pos);
srcY = s->edge_emu_buffer + 2 + 2*s->linesize;
- s->dsp.emulated_edge_mc(uvbuf , srcU, s->uvlinesize, (width<<2)+1, (height<<2)+1,
+ s->vdsp.emulated_edge_mc(uvbuf , srcU, s->uvlinesize, (width<<2)+1, (height<<2)+1,
uvsrc_x, uvsrc_y, s->h_edge_pos >> 1, s->v_edge_pos >> 1);
- s->dsp.emulated_edge_mc(uvbuf + 16, srcV, s->uvlinesize, (width<<2)+1, (height<<2)+1,
+ s->vdsp.emulated_edge_mc(uvbuf + 16, srcV, s->uvlinesize, (width<<2)+1, (height<<2)+1,
uvsrc_x, uvsrc_y, s->h_edge_pos >> 1, s->v_edge_pos >> 1);
srcU = uvbuf;
srcV = uvbuf + 16;
@@ -779,24 +771,24 @@ static void rv34_mc_1mv(RV34DecContext *r, const int block_type,
static void rv4_weight(RV34DecContext *r)
{
- r->rdsp.rv40_weight_pixels_tab[0](r->s.dest[0],
- r->tmp_b_block_y[0],
- r->tmp_b_block_y[1],
- r->weight1,
- r->weight2,
- r->s.linesize);
- r->rdsp.rv40_weight_pixels_tab[1](r->s.dest[1],
- r->tmp_b_block_uv[0],
- r->tmp_b_block_uv[2],
- r->weight1,
- r->weight2,
- r->s.uvlinesize);
- r->rdsp.rv40_weight_pixels_tab[1](r->s.dest[2],
- r->tmp_b_block_uv[1],
- r->tmp_b_block_uv[3],
- r->weight1,
- r->weight2,
- r->s.uvlinesize);
+ r->rdsp.rv40_weight_pixels_tab[r->scaled_weight][0](r->s.dest[0],
+ r->tmp_b_block_y[0],
+ r->tmp_b_block_y[1],
+ r->weight1,
+ r->weight2,
+ r->s.linesize);
+ r->rdsp.rv40_weight_pixels_tab[r->scaled_weight][1](r->s.dest[1],
+ r->tmp_b_block_uv[0],
+ r->tmp_b_block_uv[2],
+ r->weight1,
+ r->weight2,
+ r->s.uvlinesize);
+ r->rdsp.rv40_weight_pixels_tab[r->scaled_weight][1](r->s.dest[2],
+ r->tmp_b_block_uv[1],
+ r->tmp_b_block_uv[3],
+ r->weight1,
+ r->weight2,
+ r->s.uvlinesize);
}
static void rv34_mc_2mv(RV34DecContext *r, const int block_type)
@@ -1022,25 +1014,10 @@ static void rv34_output_i16x16(RV34DecContext *r, int8_t *intra_types, int cbp)
q_ac = rv34_qscale_tab[s->qscale];
uint8_t *dst = s->dest[0];
DCTELEM *ptr = s->block[0];
- int avail[6*8] = {0};
int i, j, itype, has_ac;
memset(block16, 0, 16 * sizeof(*block16));
- // Set neighbour information.
- if(r->avail_cache[1])
- avail[0] = 1;
- if(r->avail_cache[2])
- avail[1] = avail[2] = 1;
- if(r->avail_cache[3])
- avail[3] = avail[4] = 1;
- if(r->avail_cache[4])
- avail[5] = 1;
- if(r->avail_cache[5])
- avail[8] = avail[16] = 1;
- if(r->avail_cache[9])
- avail[24] = avail[32] = 1;
-
has_ac = rv34_decode_block(block16, gb, r->cur_vlcs, 3, 0, q_dc, q_dc, q_ac);
if(has_ac)
r->rdsp.rv34_inv_transform(block16);
@@ -1491,7 +1468,7 @@ av_cold int ff_rv34_decode_init(AVCodecContext *avctx)
MpegEncContext *s = &r->s;
int ret;
- MPV_decode_defaults(s);
+ ff_MPV_decode_defaults(s);
s->avctx = avctx;
s->out_format = FMT_H263;
s->codec_id = avctx->codec_id;
@@ -1502,21 +1479,21 @@ av_cold int ff_rv34_decode_init(AVCodecContext *avctx)
r->s.avctx = avctx;
avctx->flags |= CODEC_FLAG_EMU_EDGE;
r->s.flags |= CODEC_FLAG_EMU_EDGE;
- avctx->pix_fmt = PIX_FMT_YUV420P;
+ avctx->pix_fmt = AV_PIX_FMT_YUV420P;
avctx->has_b_frames = 1;
s->low_delay = 0;
- if ((ret = MPV_common_init(s)) < 0)
+ if ((ret = ff_MPV_common_init(s)) < 0)
return ret;
- ff_h264_pred_init(&r->h, CODEC_ID_RV40, 8, 1);
+ ff_h264_pred_init(&r->h, AV_CODEC_ID_RV40, 8, 1);
#if CONFIG_RV30_DECODER
- if (avctx->codec_id == CODEC_ID_RV30)
+ if (avctx->codec_id == AV_CODEC_ID_RV30)
ff_rv30dsp_init(&r->rdsp, &r->s.dsp);
#endif
#if CONFIG_RV40_DECODER
- if (avctx->codec_id == CODEC_ID_RV40)
+ if (avctx->codec_id == AV_CODEC_ID_RV40)
ff_rv40dsp_init(&r->rdsp, &r->s.dsp);
#endif
@@ -1538,7 +1515,7 @@ int ff_rv34_decode_init_thread_copy(AVCodecContext *avctx)
if (avctx->internal->is_copy) {
r->tmp_b_block_base = NULL;
- if ((err = MPV_common_init(&r->s)) < 0)
+ if ((err = ff_MPV_common_init(&r->s)) < 0)
return err;
if ((err = rv34_decoder_alloc(r)) < 0)
return err;
@@ -1556,10 +1533,9 @@ int ff_rv34_decode_update_thread_context(AVCodecContext *dst, const AVCodecConte
return 0;
if (s->height != s1->height || s->width != s1->width) {
- MPV_common_end(s);
s->height = s1->height;
s->width = s1->width;
- if ((err = MPV_common_init(s)) < 0)
+ if ((err = ff_MPV_common_frame_size_change(s)) < 0)
return err;
if ((err = rv34_decoder_realloc(r)) < 0)
return err;
@@ -1590,7 +1566,8 @@ static int finish_frame(AVCodecContext *avctx, AVFrame *pict)
int got_picture = 0;
ff_er_frame_end(s);
- MPV_frame_end(s);
+ ff_MPV_frame_end(s);
+ s->mb_num_left = 0;
if (HAVE_THREADS && (s->avctx->active_thread_type & FF_THREAD_FRAME))
ff_thread_report_progress(&s->current_picture_ptr->f, INT_MAX, 0);
@@ -1671,32 +1648,25 @@ int ff_rv34_decode_frame(AVCodecContext *avctx,
av_log(avctx, AV_LOG_ERROR, "New frame but still %d MB left.",
s->mb_num_left);
ff_er_frame_end(s);
- MPV_frame_end(s);
+ ff_MPV_frame_end(s);
}
if (s->width != si.width || s->height != si.height) {
int err;
- if (HAVE_THREADS &&
- (s->avctx->active_thread_type & FF_THREAD_FRAME)) {
- av_log_missing_feature(s->avctx, "Width/height changing with "
- "frame threading is", 0);
- return AVERROR_PATCHWELCOME;
- }
-
av_log(s->avctx, AV_LOG_WARNING, "Changing dimensions to %dx%d\n",
si.width, si.height);
- MPV_common_end(s);
+
s->width = si.width;
s->height = si.height;
avcodec_set_dimensions(s->avctx, s->width, s->height);
- if ((err = MPV_common_init(s)) < 0)
+ if ((err = ff_MPV_common_frame_size_change(s)) < 0)
return err;
if ((err = rv34_decoder_realloc(r)) < 0)
return err;
}
s->pict_type = si.type ? si.type : AV_PICTURE_TYPE_I;
- if (MPV_frame_start(s, s->avctx) < 0)
+ if (ff_MPV_frame_start(s, s->avctx) < 0)
return -1;
ff_er_frame_start(s);
if (!r->tmp_b_block_base) {
@@ -1720,11 +1690,21 @@ int ff_rv34_decode_frame(AVCodecContext *avctx,
int dist0 = GET_PTS_DIFF(r->cur_pts, r->last_pts);
int dist1 = GET_PTS_DIFF(r->next_pts, r->cur_pts);
- if (!refdist) {
- r->weight1 = r->weight2 = 8192;
- } else {
- r->weight1 = (dist0 << 14) / refdist;
- r->weight2 = (dist1 << 14) / refdist;
+ if(!refdist){
+ r->mv_weight1 = r->mv_weight2 = r->weight1 = r->weight2 = 8192;
+ r->scaled_weight = 0;
+ }else{
+ r->mv_weight1 = (dist0 << 14) / refdist;
+ r->mv_weight2 = (dist1 << 14) / refdist;
+ if((r->mv_weight1|r->mv_weight2) & 511){
+ r->weight1 = r->mv_weight1;
+ r->weight2 = r->mv_weight2;
+ r->scaled_weight = 0;
+ }else{
+ r->weight1 = r->mv_weight1 >> 9;
+ r->weight2 = r->mv_weight2 >> 9;
+ r->scaled_weight = 1;
+ }
}
}
s->mb_x = s->mb_y = 0;
@@ -1788,7 +1768,8 @@ int ff_rv34_decode_frame(AVCodecContext *avctx,
/* always mark the current frame as finished, frame-mt supports
* only complete frames */
ff_er_frame_end(s);
- MPV_frame_end(s);
+ ff_MPV_frame_end(s);
+ s->mb_num_left = 0;
ff_thread_report_progress(&s->current_picture_ptr->f, INT_MAX, 0);
return AVERROR_INVALIDDATA;
}
@@ -1801,7 +1782,7 @@ av_cold int ff_rv34_decode_end(AVCodecContext *avctx)
{
RV34DecContext *r = avctx->priv_data;
- MPV_common_end(&r->s);
+ ff_MPV_common_end(&r->s);
rv34_decoder_free(r);
return 0;
diff --git a/gst-libs/ext/libav/libavcodec/rv34.h b/gst-libs/ext/libav/libavcodec/rv34.h
index d86b009..f40e282 100644
--- a/gst-libs/ext/libav/libavcodec/rv34.h
+++ b/gst-libs/ext/libav/libavcodec/rv34.h
@@ -106,11 +106,13 @@ typedef struct RV34DecContext{
int rpr; ///< one field size in RV30 slice header
int cur_pts, last_pts, next_pts;
+ int scaled_weight;
int weight1, weight2; ///< B frame distance fractions (0.14) used in motion compensation
+ int mv_weight1, mv_weight2;
uint16_t *cbp_luma; ///< CBP values for luma subblocks
uint8_t *cbp_chroma; ///< CBP values for chroma subblocks
- int *deblock_coefs; ///< deblock coefficients for each macroblock
+ uint16_t *deblock_coefs; ///< deblock coefficients for each macroblock
/** 8x8 block available flags (for MV prediction) */
DECLARE_ALIGNED(8, uint32_t, avail_cache)[3*4];
@@ -131,7 +133,7 @@ typedef struct RV34DecContext{
*/
int ff_rv34_get_start_offset(GetBitContext *gb, int blocks);
int ff_rv34_decode_init(AVCodecContext *avctx);
-int ff_rv34_decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt);
+int ff_rv34_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt);
int ff_rv34_decode_end(AVCodecContext *avctx);
int ff_rv34_decode_init_thread_copy(AVCodecContext *avctx);
int ff_rv34_decode_update_thread_context(AVCodecContext *dst, const AVCodecContext *src);
diff --git a/gst-libs/ext/libav/libavcodec/rv34_parser.c b/gst-libs/ext/libav/libavcodec/rv34_parser.c
index 4c1d2e3..ccb4314 100644
--- a/gst-libs/ext/libav/libavcodec/rv34_parser.c
+++ b/gst-libs/ext/libav/libavcodec/rv34_parser.c
@@ -52,7 +52,7 @@ static int rv34_parse(AVCodecParserContext *s,
}
hdr = AV_RB32(buf + 9 + *buf * 8);
- if (avctx->codec_id == CODEC_ID_RV30) {
+ if (avctx->codec_id == AV_CODEC_ID_RV30) {
type = (hdr >> 27) & 3;
pts = (hdr >> 7) & 0x1FFF;
} else {
@@ -78,7 +78,7 @@ static int rv34_parse(AVCodecParserContext *s,
#ifdef CONFIG_RV30_PARSER
AVCodecParser ff_rv30_parser = {
- .codec_ids = { CODEC_ID_RV30 },
+ .codec_ids = { AV_CODEC_ID_RV30 },
.priv_data_size = sizeof(RV34ParseContext),
.parser_parse = rv34_parse,
};
@@ -86,7 +86,7 @@ AVCodecParser ff_rv30_parser = {
#ifdef CONFIG_RV40_PARSER
AVCodecParser ff_rv40_parser = {
- .codec_ids = { CODEC_ID_RV40 },
+ .codec_ids = { AV_CODEC_ID_RV40 },
.priv_data_size = sizeof(RV34ParseContext),
.parser_parse = rv34_parse,
};
diff --git a/gst-libs/ext/libav/libavcodec/rv34dsp.c b/gst-libs/ext/libav/libavcodec/rv34dsp.c
index 919703d..86a2ffd 100644
--- a/gst-libs/ext/libav/libavcodec/rv34dsp.c
+++ b/gst-libs/ext/libav/libavcodec/rv34dsp.c
@@ -26,6 +26,7 @@
*/
#include "dsputil.h"
#include "rv34dsp.h"
+#include "libavutil/common.h"
/**
* @name RV30/40 inverse transform functions
@@ -53,7 +54,7 @@ static av_always_inline void rv34_row_transform(int temp[16], DCTELEM *block)
* Real Video 3.0/4.0 inverse transform + sample reconstruction
* Code is almost the same as in SVQ3, only scaling is different.
*/
-static void rv34_idct_add_c(uint8_t *dst, int stride, DCTELEM *block){
+static void rv34_idct_add_c(uint8_t *dst, ptrdiff_t stride, DCTELEM *block){
int temp[16];
int i;
@@ -88,19 +89,19 @@ static void rv34_inv_transform_noround_c(DCTELEM *block){
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*4+0] = ((z0 + z3) * 3) >> 11;
- block[i*4+1] = ((z1 + z2) * 3) >> 11;
- block[i*4+2] = ((z1 - z2) * 3) >> 11;
- block[i*4+3] = ((z0 - z3) * 3) >> 11;
+ const int z0 = 39*(temp[4*0+i] + temp[4*2+i]);
+ const int z1 = 39*(temp[4*0+i] - temp[4*2+i]);
+ const int z2 = 21* temp[4*1+i] - 51*temp[4*3+i];
+ const int z3 = 51* temp[4*1+i] + 21*temp[4*3+i];
+
+ block[i*4+0] = (z0 + z3) >> 11;
+ block[i*4+1] = (z1 + z2) >> 11;
+ block[i*4+2] = (z1 - z2) >> 11;
+ block[i*4+3] = (z0 - z3) >> 11;
}
}
-static void rv34_idct_dc_add_c(uint8_t *dst, int stride, int dc)
+static void rv34_idct_dc_add_c(uint8_t *dst, ptrdiff_t stride, int dc)
{
int i, j;
@@ -134,8 +135,8 @@ av_cold void ff_rv34dsp_init(RV34DSPContext *c, DSPContext* dsp) {
c->rv34_idct_add = rv34_idct_add_c;
c->rv34_idct_dc_add = rv34_idct_dc_add_c;
- if (HAVE_NEON)
- ff_rv34dsp_init_neon(c, dsp);
- if (HAVE_MMX)
+ if (ARCH_ARM)
+ ff_rv34dsp_init_arm(c, dsp);
+ if (ARCH_X86)
ff_rv34dsp_init_x86(c, dsp);
}
diff --git a/gst-libs/ext/libav/libavcodec/rv34dsp.h b/gst-libs/ext/libav/libavcodec/rv34dsp.h
index fe8fcaa..f0263b1 100644
--- a/gst-libs/ext/libav/libavcodec/rv34dsp.h
+++ b/gst-libs/ext/libav/libavcodec/rv34dsp.h
@@ -32,24 +32,24 @@
typedef void (*rv40_weight_func)(uint8_t *dst/*align width (8 or 16)*/,
uint8_t *src1/*align width (8 or 16)*/,
uint8_t *src2/*align width (8 or 16)*/,
- int w1, int w2, int stride);
+ int w1, int w2, ptrdiff_t stride);
typedef void (*rv34_inv_transform_func)(DCTELEM *block);
-typedef void (*rv34_idct_add_func)(uint8_t *dst, int stride, DCTELEM *block);
-typedef void (*rv34_idct_dc_add_func)(uint8_t *dst, int stride,
+typedef void (*rv34_idct_add_func)(uint8_t *dst, ptrdiff_t stride, DCTELEM *block);
+typedef void (*rv34_idct_dc_add_func)(uint8_t *dst, ptrdiff_t stride,
int dc);
-typedef void (*rv40_weak_loop_filter_func)(uint8_t *src, int stride,
+typedef void (*rv40_weak_loop_filter_func)(uint8_t *src, ptrdiff_t stride,
int filter_p1, int filter_q1,
int alpha, int beta,
int lims, int lim_q1, int lim_p1);
-typedef void (*rv40_strong_loop_filter_func)(uint8_t *src, int stride,
+typedef void (*rv40_strong_loop_filter_func)(uint8_t *src, ptrdiff_t stride,
int alpha, int lims,
int dmode, int chroma);
-typedef int (*rv40_loop_filter_strength_func)(uint8_t *src, int stride,
+typedef int (*rv40_loop_filter_strength_func)(uint8_t *src, ptrdiff_t stride,
int beta, int beta2, int edge,
int *p1, int *q1);
@@ -58,7 +58,12 @@ typedef struct RV34DSPContext {
qpel_mc_func avg_pixels_tab[4][16];
h264_chroma_mc_func put_chroma_pixels_tab[3];
h264_chroma_mc_func avg_chroma_pixels_tab[3];
- rv40_weight_func rv40_weight_pixels_tab[2];
+ /**
+ * Biweight functions, first dimension is transform size (16/8),
+ * second is whether the weight is prescaled by 1/512 to skip
+ * the intermediate shifting.
+ */
+ rv40_weight_func rv40_weight_pixels_tab[2][2];
rv34_inv_transform_func rv34_inv_transform;
rv34_inv_transform_func rv34_inv_transform_dc;
rv34_idct_add_func rv34_idct_add;
@@ -72,10 +77,10 @@ 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_rv34dsp_init_neon(RV34DSPContext *c, DSPContext *dsp);
+void ff_rv34dsp_init_arm(RV34DSPContext *c, DSPContext *dsp);
void ff_rv34dsp_init_x86(RV34DSPContext *c, DSPContext *dsp);
void ff_rv40dsp_init_x86(RV34DSPContext *c, DSPContext *dsp);
-void ff_rv40dsp_init_neon(RV34DSPContext *c, DSPContext *dsp);
+void ff_rv40dsp_init_arm(RV34DSPContext *c, DSPContext *dsp);
#endif /* AVCODEC_RV34DSP_H */
diff --git a/gst-libs/ext/libav/libavcodec/rv40.c b/gst-libs/ext/libav/libavcodec/rv40.c
index 3f2a824..f95622a 100644
--- a/gst-libs/ext/libav/libavcodec/rv40.c
+++ b/gst-libs/ext/libav/libavcodec/rv40.c
@@ -228,8 +228,6 @@ static int rv40_decode_mb_info(RV34DecContext *r)
int q, i;
int prev_type = 0;
int mb_pos = s->mb_x + s->mb_y * s->mb_stride;
- int blocks[RV34_MB_TYPES] = {0};
- int count = 0;
if(!r->s.mb_skip_run)
r->s.mb_skip_run = svq3_get_ue_golomb(gb) + 1;
@@ -237,22 +235,27 @@ static int rv40_decode_mb_info(RV34DecContext *r)
if(--r->s.mb_skip_run)
return RV34_MB_SKIP;
- if(r->avail_cache[6-1])
- blocks[r->mb_type[mb_pos - 1]]++;
if(r->avail_cache[6-4]){
+ int blocks[RV34_MB_TYPES] = {0};
+ int count = 0;
+ if(r->avail_cache[6-1])
+ blocks[r->mb_type[mb_pos - 1]]++;
blocks[r->mb_type[mb_pos - s->mb_stride]]++;
if(r->avail_cache[6-2])
blocks[r->mb_type[mb_pos - s->mb_stride + 1]]++;
if(r->avail_cache[6-5])
blocks[r->mb_type[mb_pos - s->mb_stride - 1]]++;
- }
-
- for(i = 0; i < RV34_MB_TYPES; i++){
- if(blocks[i] > count){
- count = blocks[i];
- prev_type = i;
+ for(i = 0; i < RV34_MB_TYPES; i++){
+ if(blocks[i] > count){
+ count = blocks[i];
+ prev_type = i;
+ if(count>1)
+ break;
+ }
}
- }
+ } else if (r->avail_cache[6-1])
+ prev_type = r->mb_type[mb_pos - 1];
+
if(s->pict_type == AV_PICTURE_TYPE_P){
prev_type = block_num_to_ptype_vlc_num[prev_type];
q = get_vlc2(gb, ptype_vlc[prev_type].table, PTYPE_VLC_BITS, 1);
@@ -357,7 +360,7 @@ static void rv40_loop_filter(RV34DecContext *r, int row)
* in addition to the coded ones because because they lie at the edge of
* 8x8 block with different enough motion vectors
*/
- int mvmasks[4];
+ unsigned mvmasks[4];
mb_pos = row * s->mb_stride;
for(mb_x = 0; mb_x < s->mb_width; mb_x++, mb_pos++){
@@ -373,7 +376,8 @@ static void rv40_loop_filter(RV34DecContext *r, int row)
int c_v_deblock[2], c_h_deblock[2];
int clip_left;
int avail[4];
- int y_to_deblock, c_to_deblock[2];
+ unsigned y_to_deblock;
+ int c_to_deblock[2];
q = s->current_picture_ptr->f.qscale_table[mb_pos];
alpha = rv40_alpha_tab[q];
@@ -427,7 +431,7 @@ static void rv40_loop_filter(RV34DecContext *r, int row)
y_v_deblock &= ~MASK_Y_LEFT_COL;
if(!row)
y_h_deblock &= ~MASK_Y_TOP_ROW;
- if(row == s->mb_height - 1 || (mb_strong[POS_CUR] || mb_strong[POS_BOTTOM]))
+ if(row == s->mb_height - 1 || (mb_strong[POS_CUR] | mb_strong[POS_BOTTOM]))
y_h_deblock &= ~(MASK_Y_TOP_ROW << 16);
/* Calculating chroma patterns is similar and easier since there is
* no motion vector pattern for them.
@@ -444,7 +448,7 @@ static void rv40_loop_filter(RV34DecContext *r, int row)
c_v_deblock[i] &= ~MASK_C_LEFT_COL;
if(!row)
c_h_deblock[i] &= ~MASK_C_TOP_ROW;
- if(row == s->mb_height - 1 || mb_strong[POS_CUR] || mb_strong[POS_BOTTOM])
+ if(row == s->mb_height - 1 || (mb_strong[POS_CUR] | mb_strong[POS_BOTTOM]))
c_h_deblock[i] &= ~(MASK_C_TOP_ROW << 4);
}
@@ -465,7 +469,7 @@ static void rv40_loop_filter(RV34DecContext *r, int row)
0, 0, 0);
}
// filter left block edge in ordinary mode (with low filtering strength)
- if(y_v_deblock & (MASK_CUR << ij) && (i || !(mb_strong[POS_CUR] || mb_strong[POS_LEFT]))){
+ if(y_v_deblock & (MASK_CUR << ij) && (i || !(mb_strong[POS_CUR] | mb_strong[POS_LEFT]))){
if(!i)
clip_left = mvmasks[POS_LEFT] & (MASK_RIGHT << j) ? clip[POS_LEFT] : 0;
else
@@ -476,14 +480,14 @@ static void rv40_loop_filter(RV34DecContext *r, int row)
alpha, beta, betaY, 0, 0, 1);
}
// filter top edge of the current macroblock when filtering strength is high
- if(!j && y_h_deblock & (MASK_CUR << i) && (mb_strong[POS_CUR] || mb_strong[POS_TOP])){
+ if(!j && y_h_deblock & (MASK_CUR << i) && (mb_strong[POS_CUR] | mb_strong[POS_TOP])){
rv40_adaptive_loop_filter(&r->rdsp, Y, s->linesize, dither,
clip_cur,
mvmasks[POS_TOP] & (MASK_TOP << i) ? clip[POS_TOP] : 0,
alpha, beta, betaY, 0, 1, 0);
}
// filter left block edge in edge mode (with high filtering strength)
- if(y_v_deblock & (MASK_CUR << ij) && !i && (mb_strong[POS_CUR] || mb_strong[POS_LEFT])){
+ if(y_v_deblock & (MASK_CUR << ij) && !i && (mb_strong[POS_CUR] | mb_strong[POS_LEFT])){
clip_left = mvmasks[POS_LEFT] & (MASK_RIGHT << j) ? clip[POS_LEFT] : 0;
rv40_adaptive_loop_filter(&r->rdsp, Y, s->linesize, dither,
clip_cur,
@@ -505,7 +509,7 @@ static void rv40_loop_filter(RV34DecContext *r, int row)
clip_cur,
alpha, beta, betaC, 1, 0, 0);
}
- if((c_v_deblock[k] & (MASK_CUR << ij)) && (i || !(mb_strong[POS_CUR] || mb_strong[POS_LEFT]))){
+ if((c_v_deblock[k] & (MASK_CUR << ij)) && (i || !(mb_strong[POS_CUR] | mb_strong[POS_LEFT]))){
if(!i)
clip_left = uvcbp[POS_LEFT][k] & (MASK_CUR << (2*j+1)) ? clip[POS_LEFT] : 0;
else
@@ -515,14 +519,14 @@ static void rv40_loop_filter(RV34DecContext *r, int row)
clip_left,
alpha, beta, betaC, 1, 0, 1);
}
- if(!j && c_h_deblock[k] & (MASK_CUR << ij) && (mb_strong[POS_CUR] || mb_strong[POS_TOP])){
+ if(!j && c_h_deblock[k] & (MASK_CUR << ij) && (mb_strong[POS_CUR] | mb_strong[POS_TOP])){
int clip_top = uvcbp[POS_TOP][k] & (MASK_CUR << (ij+2)) ? clip[POS_TOP] : 0;
rv40_adaptive_loop_filter(&r->rdsp, C, s->uvlinesize, i*8,
clip_cur,
clip_top,
alpha, beta, betaC, 1, 1, 0);
}
- if(c_v_deblock[k] & (MASK_CUR << ij) && !i && (mb_strong[POS_CUR] || mb_strong[POS_LEFT])){
+ if(c_v_deblock[k] & (MASK_CUR << ij) && !i && (mb_strong[POS_CUR] | mb_strong[POS_LEFT])){
clip_left = uvcbp[POS_LEFT][k] & (MASK_CUR << (2*j+1)) ? clip[POS_LEFT] : 0;
rv40_adaptive_loop_filter(&r->rdsp, C, s->uvlinesize, j*8,
clip_cur,
@@ -556,17 +560,18 @@ static av_cold int rv40_decode_init(AVCodecContext *avctx)
}
AVCodec ff_rv40_decoder = {
- .name = "rv40",
- .type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_RV40,
- .priv_data_size = sizeof(RV34DecContext),
- .init = rv40_decode_init,
- .close = ff_rv34_decode_end,
- .decode = ff_rv34_decode_frame,
- .capabilities = CODEC_CAP_DR1 | CODEC_CAP_DELAY | CODEC_CAP_FRAME_THREADS,
- .flush = ff_mpeg_flush,
- .long_name = NULL_IF_CONFIG_SMALL("RealVideo 4.0"),
- .pix_fmts = ff_pixfmt_list_420,
+ .name = "rv40",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .id = AV_CODEC_ID_RV40,
+ .priv_data_size = sizeof(RV34DecContext),
+ .init = rv40_decode_init,
+ .close = ff_rv34_decode_end,
+ .decode = ff_rv34_decode_frame,
+ .capabilities = CODEC_CAP_DR1 | CODEC_CAP_DELAY |
+ CODEC_CAP_FRAME_THREADS,
+ .flush = ff_mpeg_flush,
+ .long_name = NULL_IF_CONFIG_SMALL("RealVideo 4.0"),
+ .pix_fmts = ff_pixfmt_list_420,
.init_thread_copy = ONLY_IF_THREADS_ENABLED(ff_rv34_decode_init_thread_copy),
.update_thread_context = ONLY_IF_THREADS_ENABLED(ff_rv34_decode_update_thread_context),
};
diff --git a/gst-libs/ext/libav/libavcodec/rv40dsp.c b/gst-libs/ext/libav/libavcodec/rv40dsp.c
index 909ccd1..c6968d9 100644
--- a/gst-libs/ext/libav/libavcodec/rv40dsp.c
+++ b/gst-libs/ext/libav/libavcodec/rv40dsp.c
@@ -27,6 +27,7 @@
#include "avcodec.h"
#include "dsputil.h"
#include "rv34dsp.h"
+#include "libavutil/common.h"
#define RV40_LOWPASS(OPNAME, OP) \
static av_unused void OPNAME ## rv40_qpel8_h_lowpass(uint8_t *dst, uint8_t *src, int dstStride, int srcStride,\
@@ -278,7 +279,7 @@ RV40_CHROMA_MC(put_, op_put)
RV40_CHROMA_MC(avg_, op_avg)
#define RV40_WEIGHT_FUNC(size) \
-static void rv40_weight_func_ ## size (uint8_t *dst, uint8_t *src1, uint8_t *src2, int w1, int w2, int stride)\
+static void rv40_weight_func_rnd_ ## size (uint8_t *dst, uint8_t *src1, uint8_t *src2, int w1, int w2, ptrdiff_t stride)\
{\
int i, j;\
\
@@ -289,6 +290,18 @@ static void rv40_weight_func_ ## size (uint8_t *dst, uint8_t *src1, uint8_t *src
src2 += stride;\
dst += stride;\
}\
+}\
+static void rv40_weight_func_nornd_ ## size (uint8_t *dst, uint8_t *src1, uint8_t *src2, int w1, int w2, ptrdiff_t stride)\
+{\
+ int i, j;\
+\
+ for (j = 0; j < size; j++) {\
+ for (i = 0; i < size; i++)\
+ dst[i] = (w2 * src1[i] + w1 * src2[i] + 0x10) >> 5;\
+ src1 += stride;\
+ src2 += stride;\
+ dst += stride;\
+ }\
}
RV40_WEIGHT_FUNC(16)
@@ -316,7 +329,7 @@ static const uint8_t rv40_dither_r[16] = {
*/
static av_always_inline void rv40_weak_loop_filter(uint8_t *src,
const int step,
- const int stride,
+ const ptrdiff_t stride,
const int filter_p1,
const int filter_q1,
const int alpha,
@@ -362,7 +375,7 @@ static av_always_inline void rv40_weak_loop_filter(uint8_t *src,
}
}
-static void rv40_h_weak_loop_filter(uint8_t *src, const int stride,
+static void rv40_h_weak_loop_filter(uint8_t *src, const ptrdiff_t stride,
const int filter_p1, const int filter_q1,
const int alpha, const int beta,
const int lim_p0q0, const int lim_q1,
@@ -372,7 +385,7 @@ static void rv40_h_weak_loop_filter(uint8_t *src, const int stride,
alpha, beta, lim_p0q0, lim_q1, lim_p1);
}
-static void rv40_v_weak_loop_filter(uint8_t *src, const int stride,
+static void rv40_v_weak_loop_filter(uint8_t *src, const ptrdiff_t stride,
const int filter_p1, const int filter_q1,
const int alpha, const int beta,
const int lim_p0q0, const int lim_q1,
@@ -384,7 +397,7 @@ static void rv40_v_weak_loop_filter(uint8_t *src, const int stride,
static av_always_inline void rv40_strong_loop_filter(uint8_t *src,
const int step,
- const int stride,
+ const ptrdiff_t stride,
const int alpha,
const int lims,
const int dmode,
@@ -440,14 +453,14 @@ static av_always_inline void rv40_strong_loop_filter(uint8_t *src,
}
}
-static void rv40_h_strong_loop_filter(uint8_t *src, const int stride,
+static void rv40_h_strong_loop_filter(uint8_t *src, const ptrdiff_t stride,
const int alpha, const int lims,
const int dmode, const int chroma)
{
rv40_strong_loop_filter(src, stride, 1, alpha, lims, dmode, chroma);
}
-static void rv40_v_strong_loop_filter(uint8_t *src, const int stride,
+static void rv40_v_strong_loop_filter(uint8_t *src, const ptrdiff_t stride,
const int alpha, const int lims,
const int dmode, const int chroma)
{
@@ -455,7 +468,7 @@ static void rv40_v_strong_loop_filter(uint8_t *src, const int stride,
}
static av_always_inline int rv40_loop_filter_strength(uint8_t *src,
- int step, int stride,
+ int step, ptrdiff_t stride,
int beta, int beta2,
int edge,
int *p1, int *q1)
@@ -490,14 +503,14 @@ static av_always_inline int rv40_loop_filter_strength(uint8_t *src,
return strong0 && strong1;
}
-static int rv40_h_loop_filter_strength(uint8_t *src, int stride,
+static int rv40_h_loop_filter_strength(uint8_t *src, ptrdiff_t stride,
int beta, int beta2, int edge,
int *p1, int *q1)
{
return rv40_loop_filter_strength(src, stride, 1, beta, beta2, edge, p1, q1);
}
-static int rv40_v_loop_filter_strength(uint8_t *src, int stride,
+static int rv40_v_loop_filter_strength(uint8_t *src, ptrdiff_t stride,
int beta, int beta2, int edge,
int *p1, int *q1)
{
@@ -578,8 +591,10 @@ av_cold void ff_rv40dsp_init(RV34DSPContext *c, DSPContext* dsp) {
c->avg_chroma_pixels_tab[0] = avg_rv40_chroma_mc8_c;
c->avg_chroma_pixels_tab[1] = avg_rv40_chroma_mc4_c;
- c->rv40_weight_pixels_tab[0] = rv40_weight_func_16;
- c->rv40_weight_pixels_tab[1] = rv40_weight_func_8;
+ c->rv40_weight_pixels_tab[0][0] = rv40_weight_func_rnd_16;
+ c->rv40_weight_pixels_tab[0][1] = rv40_weight_func_rnd_8;
+ c->rv40_weight_pixels_tab[1][0] = rv40_weight_func_nornd_16;
+ c->rv40_weight_pixels_tab[1][1] = rv40_weight_func_nornd_8;
c->rv40_weak_loop_filter[0] = rv40_h_weak_loop_filter;
c->rv40_weak_loop_filter[1] = rv40_v_weak_loop_filter;
@@ -588,8 +603,8 @@ av_cold void ff_rv40dsp_init(RV34DSPContext *c, DSPContext* dsp) {
c->rv40_loop_filter_strength[0] = rv40_h_loop_filter_strength;
c->rv40_loop_filter_strength[1] = rv40_v_loop_filter_strength;
- if (HAVE_MMX)
+ if (ARCH_X86)
ff_rv40dsp_init_x86(c, dsp);
- if (HAVE_NEON)
- ff_rv40dsp_init_neon(c, dsp);
+ if (ARCH_ARM)
+ ff_rv40dsp_init_arm(c, dsp);
}
diff --git a/gst-libs/ext/libav/libavcodec/s302m.c b/gst-libs/ext/libav/libavcodec/s302m.c
index 34018ae..76fab59 100644
--- a/gst-libs/ext/libav/libavcodec/s302m.c
+++ b/gst-libs/ext/libav/libavcodec/s302m.c
@@ -21,7 +21,10 @@
*/
#include "libavutil/intreadwrite.h"
+#include "libavutil/log.h"
#include "avcodec.h"
+#include "internal.h"
+#include "mathops.h"
#define AES3_HEADER_LEN 4
@@ -94,7 +97,7 @@ static int s302m_decode_frame(AVCodecContext *avctx, void *data,
/* get output buffer */
block_size = (avctx->bits_per_coded_sample + 4) / 4;
s->frame.nb_samples = 2 * (buf_size / block_size) / avctx->channels;
- if ((ret = avctx->get_buffer(avctx, &s->frame)) < 0) {
+ if ((ret = ff_get_buffer(avctx, &s->frame)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return ret;
}
@@ -104,34 +107,34 @@ static int s302m_decode_frame(AVCodecContext *avctx, void *data,
if (avctx->bits_per_coded_sample == 24) {
uint32_t *o = (uint32_t *)s->frame.data[0];
for (; buf_size > 6; buf_size -= 7) {
- *o++ = (av_reverse[buf[2]] << 24) |
- (av_reverse[buf[1]] << 16) |
- (av_reverse[buf[0]] << 8);
- *o++ = (av_reverse[buf[6] & 0xf0] << 28) |
- (av_reverse[buf[5]] << 20) |
- (av_reverse[buf[4]] << 12) |
- (av_reverse[buf[3] & 0x0f] << 4);
+ *o++ = (ff_reverse[buf[2]] << 24) |
+ (ff_reverse[buf[1]] << 16) |
+ (ff_reverse[buf[0]] << 8);
+ *o++ = (ff_reverse[buf[6] & 0xf0] << 28) |
+ (ff_reverse[buf[5]] << 20) |
+ (ff_reverse[buf[4]] << 12) |
+ (ff_reverse[buf[3] & 0x0f] << 4);
buf += 7;
}
} else if (avctx->bits_per_coded_sample == 20) {
uint32_t *o = (uint32_t *)s->frame.data[0];
for (; buf_size > 5; buf_size -= 6) {
- *o++ = (av_reverse[buf[2] & 0xf0] << 28) |
- (av_reverse[buf[1]] << 20) |
- (av_reverse[buf[0]] << 12);
- *o++ = (av_reverse[buf[5] & 0xf0] << 28) |
- (av_reverse[buf[4]] << 20) |
- (av_reverse[buf[3]] << 12);
+ *o++ = (ff_reverse[buf[2] & 0xf0] << 28) |
+ (ff_reverse[buf[1]] << 20) |
+ (ff_reverse[buf[0]] << 12);
+ *o++ = (ff_reverse[buf[5] & 0xf0] << 28) |
+ (ff_reverse[buf[4]] << 20) |
+ (ff_reverse[buf[3]] << 12);
buf += 6;
}
} else {
uint16_t *o = (uint16_t *)s->frame.data[0];
for (; buf_size > 4; buf_size -= 5) {
- *o++ = (av_reverse[buf[1]] << 8) |
- av_reverse[buf[0]];
- *o++ = (av_reverse[buf[4] & 0xf0] << 12) |
- (av_reverse[buf[3]] << 4) |
- (av_reverse[buf[2]] >> 4);
+ *o++ = (ff_reverse[buf[1]] << 8) |
+ ff_reverse[buf[0]];
+ *o++ = (ff_reverse[buf[4] & 0xf0] << 12) |
+ (ff_reverse[buf[3]] << 4) |
+ (ff_reverse[buf[2]] >> 4);
buf += 5;
}
}
@@ -156,7 +159,7 @@ static int s302m_decode_init(AVCodecContext *avctx)
AVCodec ff_s302m_decoder = {
.name = "s302m",
.type = AVMEDIA_TYPE_AUDIO,
- .id = CODEC_ID_S302M,
+ .id = AV_CODEC_ID_S302M,
.priv_data_size = sizeof(S302MDecodeContext),
.init = s302m_decode_init,
.decode = s302m_decode_frame,
diff --git a/gst-libs/ext/libav/libavcodec/s3tc.c b/gst-libs/ext/libav/libavcodec/s3tc.c
index d0c4eb8..62dc356 100644
--- a/gst-libs/ext/libav/libavcodec/s3tc.c
+++ b/gst-libs/ext/libav/libavcodec/s3tc.c
@@ -21,19 +21,19 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "libavutil/intreadwrite.h"
+#include "libavcodec/bytestream.h"
#include "avcodec.h"
#include "s3tc.h"
-static inline void dxt1_decode_pixels(const uint8_t *s, uint32_t *d,
+static inline void dxt1_decode_pixels(GetByteContext *gb, uint32_t *d,
unsigned int qstride, unsigned int flag,
uint64_t alpha) {
unsigned int x, y, c0, c1, a = (!flag * 255u) << 24;
unsigned int rb0, rb1, rb2, rb3, g0, g1, g2, g3;
uint32_t colors[4], pixels;
- c0 = AV_RL16(s);
- c1 = AV_RL16(s+2);
+ c0 = bytestream2_get_le16(gb);
+ c1 = bytestream2_get_le16(gb);
rb0 = (c0<<3 | c0<<8) & 0xf800f8;
rb1 = (c1<<3 | c1<<8) & 0xf800f8;
@@ -61,7 +61,7 @@ static inline void dxt1_decode_pixels(const uint8_t *s, uint32_t *d,
colors[2] = rb2 + g2 + a;
- pixels = AV_RL32(s+4);
+ pixels = bytestream2_get_le32(gb);
for (y=0; y<4; y++) {
for (x=0; x<4; x++) {
a = (alpha & 0x0f) << 28;
@@ -74,24 +74,24 @@ static inline void dxt1_decode_pixels(const uint8_t *s, uint32_t *d,
}
}
-void ff_decode_dxt1(const uint8_t *s, uint8_t *dst,
+void ff_decode_dxt1(GetByteContext *gb, uint8_t *dst,
const unsigned int w, const unsigned int h,
const unsigned int stride) {
unsigned int bx, by, qstride = stride/4;
uint32_t *d = (uint32_t *) dst;
for (by=0; by < h/4; by++, d += stride-w)
- for (bx=0; bx < w/4; bx++, s+=8, d+=4)
- dxt1_decode_pixels(s, d, qstride, 0, 0LL);
+ for (bx = 0; bx < w / 4; bx++, d += 4)
+ dxt1_decode_pixels(gb, d, qstride, 0, 0LL);
}
-void ff_decode_dxt3(const uint8_t *s, uint8_t *dst,
+void ff_decode_dxt3(GetByteContext *gb, uint8_t *dst,
const unsigned int w, const unsigned int h,
const unsigned int stride) {
unsigned int bx, by, qstride = stride/4;
uint32_t *d = (uint32_t *) dst;
for (by=0; by < h/4; by++, d += stride-w)
- for (bx=0; bx < w/4; bx++, s+=16, d+=4)
- dxt1_decode_pixels(s+8, d, qstride, 1, AV_RL64(s));
+ for (bx = 0; bx < w / 4; bx++, d += 4)
+ dxt1_decode_pixels(gb, d, qstride, 1, bytestream2_get_le64(gb));
}
diff --git a/gst-libs/ext/libav/libavcodec/s3tc.h b/gst-libs/ext/libav/libavcodec/s3tc.h
index 6e10f43..25237b9 100644
--- a/gst-libs/ext/libav/libavcodec/s3tc.h
+++ b/gst-libs/ext/libav/libavcodec/s3tc.h
@@ -24,29 +24,31 @@
#include <stdint.h>
+#include "bytestream.h"
+
#define FF_S3TC_DXT1 0x31545844
#define FF_S3TC_DXT3 0x33545844
/**
* Decode DXT1 encoded data to RGB32
- * @param src source buffer, has to be aligned on a 4-byte boundary
+ * @param gb GetByteContext
* @param dst destination buffer
* @param w width of output image
* @param h height of output image
* @param stride line size of output image
*/
-void ff_decode_dxt1(const uint8_t *src, uint8_t *dst,
+void ff_decode_dxt1(GetByteContext *gb, uint8_t *dst,
const unsigned int w, const unsigned int h,
const unsigned int stride);
/**
* Decode DXT3 encoded data to RGB32
- * @param src source buffer, has to be aligned on a 4-byte boundary
+ * @param gb GetByteContext
* @param dst destination buffer
* @param w width of output image
* @param h height of output image
* @param stride line size of output image
*/
-void ff_decode_dxt3(const uint8_t *src, uint8_t *dst,
+void ff_decode_dxt3(GetByteContext *gb, uint8_t *dst,
const unsigned int w, const unsigned int h,
const unsigned int stride);
diff --git a/gst-libs/ext/libav/libavcodec/sbr.h b/gst-libs/ext/libav/libavcodec/sbr.h
index 5b0f334..a47ad6e 100644
--- a/gst-libs/ext/libav/libavcodec/sbr.h
+++ b/gst-libs/ext/libav/libavcodec/sbr.h
@@ -32,11 +32,12 @@
#include <stdint.h>
#include "fft.h"
#include "aacps.h"
+#include "sbrdsp.h"
/**
* Spectral Band Replication header - spectrum parameters that invoke a reset if they differ from the previous header.
*/
-typedef struct {
+typedef struct SpectrumParameters {
uint8_t bs_start_freq;
uint8_t bs_stop_freq;
uint8_t bs_xover_band;
@@ -56,7 +57,7 @@ typedef struct {
/**
* Spectral Band Replication per channel data
*/
-typedef struct {
+typedef struct SBRData {
/**
* @name Main bitstream data variables
* @{
@@ -77,8 +78,8 @@ typedef struct {
* @name State variables
* @{
*/
- DECLARE_ALIGNED(16, float, synthesis_filterbank_samples)[SBR_SYNTHESIS_BUF_SIZE];
- DECLARE_ALIGNED(16, float, analysis_filterbank_samples) [1312];
+ DECLARE_ALIGNED(32, float, synthesis_filterbank_samples)[SBR_SYNTHESIS_BUF_SIZE];
+ DECLARE_ALIGNED(32, float, analysis_filterbank_samples) [1312];
int synthesis_filterbank_samples_offset;
///l_APrev and l_A
int e_a[2];
@@ -87,8 +88,9 @@ typedef struct {
///QMF values of the original signal
float W[2][32][32][2];
///QMF output of the HF adjustor
- float Y[2][38][64][2];
- float g_temp[42][48];
+ int Ypos;
+ DECLARE_ALIGNED(16, float, Y)[2][38][64][2];
+ DECLARE_ALIGNED(16, float, g_temp)[42][48];
float q_temp[42][48];
uint8_t s_indexmapped[8][48];
///Envelope scalefactors
@@ -109,7 +111,7 @@ typedef struct {
/**
* Spectral Band Replication
*/
-typedef struct {
+typedef struct SpectralBandReplication {
int sample_rate;
int start;
int reset;
@@ -131,6 +133,7 @@ typedef struct {
unsigned kx[2];
///M' and M respectively, M is the number of QMF subbands that use SBR.
unsigned m[2];
+ unsigned kx_and_m_pushed;
///The number of frequency bands in f_master
unsigned n_master;
SBRData data[2];
@@ -155,15 +158,15 @@ typedef struct {
uint8_t patch_num_subbands[6];
uint8_t patch_start_subband[6];
///QMF low frequency input to the HF generator
- float X_low[32][40][2];
+ DECLARE_ALIGNED(16, float, X_low)[32][40][2];
///QMF output of the HF generator
- float X_high[64][40][2];
+ DECLARE_ALIGNED(16, float, X_high)[64][40][2];
///QMF values of the reconstructed signal
DECLARE_ALIGNED(16, float, X)[2][2][38][64];
///Zeroth coefficient used to filter the subband signals
- float alpha0[64][2];
+ DECLARE_ALIGNED(16, float, alpha0)[64][2];
///First coefficient used to filter the subband signals
- float alpha1[64][2];
+ DECLARE_ALIGNED(16, float, alpha1)[64][2];
///Dequantized envelope scalefactors, remapped
float e_origmapped[7][48];
///Dequantized noise scalefactors, remapped
@@ -177,9 +180,10 @@ typedef struct {
///Sinusoidal levels
float s_m[7][48];
float gain[7][48];
- DECLARE_ALIGNED(16, float, qmf_filter_scratch)[5][64];
+ DECLARE_ALIGNED(32, float, qmf_filter_scratch)[5][64];
FFTContext mdct_ana;
FFTContext mdct;
+ SBRDSPContext dsp;
} SpectralBandReplication;
#endif /* AVCODEC_SBR_H */
diff --git a/gst-libs/ext/libav/libavcodec/sbrdsp.c b/gst-libs/ext/libav/libavcodec/sbrdsp.c
new file mode 100644
index 0000000..781ec83
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/sbrdsp.c
@@ -0,0 +1,248 @@
+/*
+ * AAC Spectral Band Replication decoding functions
+ * Copyright (c) 2008-2009 Robert Swain ( rob opendot cl )
+ * Copyright (c) 2009-2010 Alex Converse <alex.converse@gmail.com>
+ *
+ * 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
+ */
+
+#include "config.h"
+#include "libavutil/attributes.h"
+#include "sbrdsp.h"
+
+static void sbr_sum64x5_c(float *z)
+{
+ int k;
+ for (k = 0; k < 64; k++) {
+ float f = z[k] + z[k + 64] + z[k + 128] + z[k + 192] + z[k + 256];
+ z[k] = f;
+ }
+}
+
+static float sbr_sum_square_c(float (*x)[2], int n)
+{
+ float sum0 = 0.0f, sum1 = 0.0f;
+ int i;
+
+ for (i = 0; i < n; i += 2)
+ {
+ sum0 += x[i + 0][0] * x[i + 0][0];
+ sum1 += x[i + 0][1] * x[i + 0][1];
+ sum0 += x[i + 1][0] * x[i + 1][0];
+ sum1 += x[i + 1][1] * x[i + 1][1];
+ }
+
+ return sum0 + sum1;
+}
+
+static void sbr_neg_odd_64_c(float *x)
+{
+ int i;
+ for (i = 1; i < 64; i += 2)
+ x[i] = -x[i];
+}
+
+static void sbr_qmf_pre_shuffle_c(float *z)
+{
+ int k;
+ z[64] = z[0];
+ z[65] = z[1];
+ for (k = 1; k < 32; k++) {
+ z[64+2*k ] = -z[64 - k];
+ z[64+2*k+1] = z[ k + 1];
+ }
+}
+
+static void sbr_qmf_post_shuffle_c(float W[32][2], const float *z)
+{
+ int k;
+ for (k = 0; k < 32; k++) {
+ W[k][0] = -z[63-k];
+ W[k][1] = z[k];
+ }
+}
+
+static void sbr_qmf_deint_neg_c(float *v, const float *src)
+{
+ int i;
+ for (i = 0; i < 32; i++) {
+ v[ i] = src[63 - 2*i ];
+ v[63 - i] = -src[63 - 2*i - 1];
+ }
+}
+
+static void sbr_qmf_deint_bfly_c(float *v, const float *src0, const float *src1)
+{
+ int i;
+ for (i = 0; i < 64; i++) {
+ v[ i] = src0[i] - src1[63 - i];
+ v[127 - i] = src0[i] + src1[63 - i];
+ }
+}
+
+static av_always_inline void autocorrelate(const float x[40][2],
+ float phi[3][2][2], int lag)
+{
+ int i;
+ float real_sum = 0.0f;
+ float imag_sum = 0.0f;
+ if (lag) {
+ for (i = 1; i < 38; i++) {
+ real_sum += x[i][0] * x[i+lag][0] + x[i][1] * x[i+lag][1];
+ imag_sum += x[i][0] * x[i+lag][1] - x[i][1] * x[i+lag][0];
+ }
+ phi[2-lag][1][0] = real_sum + x[ 0][0] * x[lag][0] + x[ 0][1] * x[lag][1];
+ phi[2-lag][1][1] = imag_sum + x[ 0][0] * x[lag][1] - x[ 0][1] * x[lag][0];
+ if (lag == 1) {
+ phi[0][0][0] = real_sum + x[38][0] * x[39][0] + x[38][1] * x[39][1];
+ phi[0][0][1] = imag_sum + x[38][0] * x[39][1] - x[38][1] * x[39][0];
+ }
+ } else {
+ for (i = 1; i < 38; i++) {
+ real_sum += x[i][0] * x[i][0] + x[i][1] * x[i][1];
+ }
+ phi[2][1][0] = real_sum + x[ 0][0] * x[ 0][0] + x[ 0][1] * x[ 0][1];
+ phi[1][0][0] = real_sum + x[38][0] * x[38][0] + x[38][1] * x[38][1];
+ }
+}
+
+static void sbr_autocorrelate_c(const float x[40][2], float phi[3][2][2])
+{
+ autocorrelate(x, phi, 0);
+ autocorrelate(x, phi, 1);
+ autocorrelate(x, phi, 2);
+}
+
+static void sbr_hf_gen_c(float (*X_high)[2], const float (*X_low)[2],
+ const float alpha0[2], const float alpha1[2],
+ float bw, int start, int end)
+{
+ float alpha[4];
+ int i;
+
+ alpha[0] = alpha1[0] * bw * bw;
+ alpha[1] = alpha1[1] * bw * bw;
+ alpha[2] = alpha0[0] * bw;
+ alpha[3] = alpha0[1] * bw;
+
+ for (i = start; i < end; i++) {
+ X_high[i][0] =
+ X_low[i - 2][0] * alpha[0] -
+ X_low[i - 2][1] * alpha[1] +
+ X_low[i - 1][0] * alpha[2] -
+ X_low[i - 1][1] * alpha[3] +
+ X_low[i][0];
+ X_high[i][1] =
+ X_low[i - 2][1] * alpha[0] +
+ X_low[i - 2][0] * alpha[1] +
+ X_low[i - 1][1] * alpha[2] +
+ X_low[i - 1][0] * alpha[3] +
+ X_low[i][1];
+ }
+}
+
+static void sbr_hf_g_filt_c(float (*Y)[2], const float (*X_high)[40][2],
+ const float *g_filt, int m_max, intptr_t ixh)
+{
+ int m;
+
+ for (m = 0; m < m_max; m++) {
+ Y[m][0] = X_high[m][ixh][0] * g_filt[m];
+ Y[m][1] = X_high[m][ixh][1] * g_filt[m];
+ }
+}
+
+static av_always_inline void sbr_hf_apply_noise(float (*Y)[2],
+ const float *s_m,
+ const float *q_filt,
+ int noise,
+ float phi_sign0,
+ float phi_sign1,
+ int m_max)
+{
+ int m;
+
+ for (m = 0; m < m_max; m++) {
+ float y0 = Y[m][0];
+ float y1 = Y[m][1];
+ noise = (noise + 1) & 0x1ff;
+ if (s_m[m]) {
+ y0 += s_m[m] * phi_sign0;
+ y1 += s_m[m] * phi_sign1;
+ } else {
+ y0 += q_filt[m] * ff_sbr_noise_table[noise][0];
+ y1 += q_filt[m] * ff_sbr_noise_table[noise][1];
+ }
+ Y[m][0] = y0;
+ Y[m][1] = y1;
+ phi_sign1 = -phi_sign1;
+ }
+}
+
+static void sbr_hf_apply_noise_0(float (*Y)[2], const float *s_m,
+ const float *q_filt, int noise,
+ int kx, int m_max)
+{
+ sbr_hf_apply_noise(Y, s_m, q_filt, noise, 1.0, 0.0, m_max);
+}
+
+static void sbr_hf_apply_noise_1(float (*Y)[2], const float *s_m,
+ const float *q_filt, int noise,
+ int kx, int m_max)
+{
+ float phi_sign = 1 - 2 * (kx & 1);
+ sbr_hf_apply_noise(Y, s_m, q_filt, noise, 0.0, phi_sign, m_max);
+}
+
+static void sbr_hf_apply_noise_2(float (*Y)[2], const float *s_m,
+ const float *q_filt, int noise,
+ int kx, int m_max)
+{
+ sbr_hf_apply_noise(Y, s_m, q_filt, noise, -1.0, 0.0, m_max);
+}
+
+static void sbr_hf_apply_noise_3(float (*Y)[2], const float *s_m,
+ const float *q_filt, int noise,
+ int kx, int m_max)
+{
+ float phi_sign = 1 - 2 * (kx & 1);
+ sbr_hf_apply_noise(Y, s_m, q_filt, noise, 0.0, -phi_sign, m_max);
+}
+
+av_cold void ff_sbrdsp_init(SBRDSPContext *s)
+{
+ s->sum64x5 = sbr_sum64x5_c;
+ s->sum_square = sbr_sum_square_c;
+ s->neg_odd_64 = sbr_neg_odd_64_c;
+ s->qmf_pre_shuffle = sbr_qmf_pre_shuffle_c;
+ s->qmf_post_shuffle = sbr_qmf_post_shuffle_c;
+ s->qmf_deint_neg = sbr_qmf_deint_neg_c;
+ s->qmf_deint_bfly = sbr_qmf_deint_bfly_c;
+ s->autocorrelate = sbr_autocorrelate_c;
+ s->hf_gen = sbr_hf_gen_c;
+ s->hf_g_filt = sbr_hf_g_filt_c;
+
+ s->hf_apply_noise[0] = sbr_hf_apply_noise_0;
+ s->hf_apply_noise[1] = sbr_hf_apply_noise_1;
+ s->hf_apply_noise[2] = sbr_hf_apply_noise_2;
+ s->hf_apply_noise[3] = sbr_hf_apply_noise_3;
+
+ if (ARCH_ARM)
+ ff_sbrdsp_init_arm(s);
+ if (ARCH_X86)
+ ff_sbrdsp_init_x86(s);
+}
diff --git a/gst-libs/ext/libav/libavcodec/sbrdsp.h b/gst-libs/ext/libav/libavcodec/sbrdsp.h
new file mode 100644
index 0000000..07235c6
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/sbrdsp.h
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2012 Mans Rullgard
+ *
+ * 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
+ */
+
+#ifndef AVCODEC_SBRDSP_H
+#define AVCODEC_SBRDSP_H
+
+#include <stdint.h>
+
+typedef struct SBRDSPContext {
+ void (*sum64x5)(float *z);
+ float (*sum_square)(float (*x)[2], int n);
+ void (*neg_odd_64)(float *x);
+ void (*qmf_pre_shuffle)(float *z);
+ void (*qmf_post_shuffle)(float W[32][2], const float *z);
+ void (*qmf_deint_neg)(float *v, const float *src);
+ void (*qmf_deint_bfly)(float *v, const float *src0, const float *src1);
+ void (*autocorrelate)(const float x[40][2], float phi[3][2][2]);
+ void (*hf_gen)(float (*X_high)[2], const float (*X_low)[2],
+ const float alpha0[2], const float alpha1[2],
+ float bw, int start, int end);
+ void (*hf_g_filt)(float (*Y)[2], const float (*X_high)[40][2],
+ const float *g_filt, int m_max, intptr_t ixh);
+ void (*hf_apply_noise[4])(float (*Y)[2], const float *s_m,
+ const float *q_filt, int noise,
+ int kx, int m_max);
+} SBRDSPContext;
+
+extern const float ff_sbr_noise_table[][2];
+
+void ff_sbrdsp_init(SBRDSPContext *s);
+void ff_sbrdsp_init_arm(SBRDSPContext *s);
+void ff_sbrdsp_init_x86(SBRDSPContext *s);
+
+#endif /* AVCODEC_SBRDSP_H */
diff --git a/gst-libs/ext/libav/libavcodec/sgidec.c b/gst-libs/ext/libav/libavcodec/sgidec.c
index dfa00ed..0e72751 100644
--- a/gst-libs/ext/libav/libavcodec/sgidec.c
+++ b/gst-libs/ext/libav/libavcodec/sgidec.c
@@ -22,6 +22,7 @@
#include "libavutil/imgutils.h"
#include "avcodec.h"
#include "bytestream.h"
+#include "internal.h"
#include "sgi.h"
typedef struct SgiState {
@@ -150,7 +151,7 @@ static int read_uncompressed_sgi(unsigned char* out_buf, uint8_t* out_end,
}
static int decode_frame(AVCodecContext *avctx,
- void *data, int *data_size,
+ void *data, int *got_frame,
AVPacket *avpkt)
{
SgiState *s = avctx->priv_data;
@@ -191,11 +192,11 @@ static int decode_frame(AVCodecContext *avctx,
}
if (s->depth == SGI_GRAYSCALE) {
- avctx->pix_fmt = s->bytes_per_channel == 2 ? PIX_FMT_GRAY16BE : PIX_FMT_GRAY8;
+ avctx->pix_fmt = s->bytes_per_channel == 2 ? AV_PIX_FMT_GRAY16BE : AV_PIX_FMT_GRAY8;
} else if (s->depth == SGI_RGB) {
- avctx->pix_fmt = s->bytes_per_channel == 2 ? PIX_FMT_RGB48BE : PIX_FMT_RGB24;
+ avctx->pix_fmt = s->bytes_per_channel == 2 ? AV_PIX_FMT_RGB48BE : AV_PIX_FMT_RGB24;
} else if (s->depth == SGI_RGBA && s->bytes_per_channel == 1) {
- avctx->pix_fmt = PIX_FMT_RGBA;
+ avctx->pix_fmt = AV_PIX_FMT_RGBA;
} else {
av_log(avctx, AV_LOG_ERROR, "wrong picture format\n");
return -1;
@@ -209,7 +210,7 @@ static int decode_frame(AVCodecContext *avctx,
avctx->release_buffer(avctx, p);
p->reference = 0;
- if (avctx->get_buffer(avctx, p) < 0) {
+ if (ff_get_buffer(avctx, p) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed.\n");
return -1;
}
@@ -232,7 +233,7 @@ static int decode_frame(AVCodecContext *avctx,
if (ret == 0) {
*picture = s->picture;
- *data_size = sizeof(AVPicture);
+ *got_frame = 1;
return avpkt->size;
} else {
return ret;
@@ -261,11 +262,11 @@ static av_cold int sgi_end(AVCodecContext *avctx)
AVCodec ff_sgi_decoder = {
.name = "sgi",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_SGI,
+ .id = AV_CODEC_ID_SGI,
.priv_data_size = sizeof(SgiState),
.init = sgi_init,
.close = sgi_end,
.decode = decode_frame,
- .long_name = NULL_IF_CONFIG_SMALL("SGI image"),
+ .long_name = NULL_IF_CONFIG_SMALL("SGI image"),
+ .capabilities = CODEC_CAP_DR1,
};
-
diff --git a/gst-libs/ext/libav/libavcodec/sgienc.c b/gst-libs/ext/libav/libavcodec/sgienc.c
index 9d02eea..2aecc59 100644
--- a/gst-libs/ext/libav/libavcodec/sgienc.c
+++ b/gst-libs/ext/libav/libavcodec/sgienc.c
@@ -21,6 +21,7 @@
#include "avcodec.h"
#include "bytestream.h"
+#include "internal.h"
#include "sgi.h"
#include "rle.h"
@@ -41,17 +42,17 @@ static av_cold int encode_init(AVCodecContext *avctx)
return 0;
}
-static int encode_frame(AVCodecContext *avctx, unsigned char *buf,
- int buf_size, void *data)
+static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
+ const AVFrame *frame, int *got_packet)
{
SgiContext *s = avctx->priv_data;
AVFrame * const p = &s->picture;
- uint8_t *offsettab, *lengthtab, *in_buf, *encode_buf;
- int x, y, z, length, tablesize;
+ uint8_t *offsettab, *lengthtab, *in_buf, *encode_buf, *buf;
+ int x, y, z, length, tablesize, ret;
unsigned int width, height, depth, dimension;
- unsigned char *orig_buf = buf, *end_buf = buf + buf_size;
+ unsigned char *end_buf;
- *p = *(AVFrame*)data;
+ *p = *frame;
p->pict_type = AV_PICTURE_TYPE_I;
p->key_frame = 1;
@@ -59,15 +60,15 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf,
height = avctx->height;
switch (avctx->pix_fmt) {
- case PIX_FMT_GRAY8:
+ case AV_PIX_FMT_GRAY8:
dimension = SGI_SINGLE_CHAN;
depth = SGI_GRAYSCALE;
break;
- case PIX_FMT_RGB24:
+ case AV_PIX_FMT_RGB24:
dimension = SGI_MULTI_CHAN;
depth = SGI_RGB;
break;
- case PIX_FMT_RGBA:
+ case AV_PIX_FMT_RGBA:
dimension = SGI_MULTI_CHAN;
depth = SGI_RGBA;
break;
@@ -76,12 +77,18 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf,
}
tablesize = depth * height * 4;
- length = tablesize * 2 + SGI_HEADER_SIZE;
-
- if (buf_size < length) {
- av_log(avctx, AV_LOG_ERROR, "buf_size too small(need %d, got %d)\n", length, buf_size);
- return -1;
+ length = SGI_HEADER_SIZE;
+ if (avctx->coder_type == FF_CODER_TYPE_RAW)
+ length += depth * height * width;
+ else // assume ff_rl_encode() produces at most 2x size of input
+ length += tablesize * 2 + depth * height * (2 * width + 1);
+
+ if ((ret = ff_alloc_packet(pkt, length)) < 0) {
+ av_log(avctx, AV_LOG_ERROR, "Error getting output packet of size %d.\n", length);
+ return ret;
}
+ buf = pkt->data;
+ end_buf = pkt->data + pkt->size;
/* Encode header. */
bytestream_put_be16(&buf, SGI_MAGIC);
@@ -124,7 +131,7 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf,
in_buf = p->data[0] + p->linesize[0] * (height - 1) + z;
for (y = 0; y < height; y++) {
- bytestream_put_be32(&offsettab, buf - orig_buf);
+ bytestream_put_be32(&offsettab, buf - pkt->data);
for (x = 0; x < width; x++)
encode_buf[x] = in_buf[depth * x];
@@ -156,16 +163,22 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf,
}
/* total length */
- return buf - orig_buf;
+ pkt->size = buf - pkt->data;
+ pkt->flags |= AV_PKT_FLAG_KEY;
+ *got_packet = 1;
+
+ return 0;
}
AVCodec ff_sgi_encoder = {
.name = "sgi",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_SGI,
+ .id = AV_CODEC_ID_SGI,
.priv_data_size = sizeof(SgiContext),
.init = encode_init,
- .encode = encode_frame,
- .pix_fmts= (const enum PixelFormat[]){PIX_FMT_RGB24, PIX_FMT_RGBA, PIX_FMT_GRAY8, PIX_FMT_NONE},
- .long_name= NULL_IF_CONFIG_SMALL("SGI image"),
+ .encode2 = encode_frame,
+ .pix_fmts = (const enum AVPixelFormat[]){
+ AV_PIX_FMT_RGB24, AV_PIX_FMT_RGBA, AV_PIX_FMT_GRAY8, AV_PIX_FMT_NONE
+ },
+ .long_name = NULL_IF_CONFIG_SMALL("SGI image"),
};
diff --git a/gst-libs/ext/libav/libavcodec/sh4/Makefile b/gst-libs/ext/libav/libavcodec/sh4/Makefile
index 142cba4..aa17eab 100644
--- a/gst-libs/ext/libav/libavcodec/sh4/Makefile
+++ b/gst-libs/ext/libav/libavcodec/sh4/Makefile
@@ -1,3 +1,3 @@
-OBJS += sh4/dsputil_align.o \
- sh4/dsputil_sh4.o \
- sh4/idct_sh4.o \
+OBJS += sh4/dsputil_align.o \
+ sh4/dsputil_sh4.o \
+ sh4/idct_sh4.o \
diff --git a/gst-libs/ext/libav/libavcodec/sh4/dsputil_align.c b/gst-libs/ext/libav/libavcodec/sh4/dsputil_align.c
index 0c293a1..333e563 100644
--- a/gst-libs/ext/libav/libavcodec/sh4/dsputil_align.c
+++ b/gst-libs/ext/libav/libavcodec/sh4/dsputil_align.c
@@ -38,7 +38,7 @@
#define rnd_PACK(ph,pl,nph,npl) ph + nph + (((pl + npl + BYTE_VEC32(0x02))>>2) & BYTE_VEC32(0x03))
#define no_rnd_PACK(ph,pl,nph,npl) ph + nph + (((pl + npl + BYTE_VEC32(0x01))>>2) & BYTE_VEC32(0x03))
-/* little endian */
+/* little-endian */
#define MERGE1(a,b,ofs) (ofs==0)?a:( ((a)>>(8*ofs))|((b)<<(32-8*ofs)) )
#define MERGE2(a,b,ofs) (ofs==3)?b:( ((a)>>(8*(ofs+1)))|((b)<<(32-8*(ofs+1))) )
/* big
@@ -331,7 +331,7 @@ DEFFUNC(avg,no_rnd,xy,16,OP_XY,PACK)
#endif
-void dsputil_init_align(DSPContext* c, AVCodecContext *avctx)
+void ff_dsputil_init_align(DSPContext* c, AVCodecContext *avctx)
{
const int high_bit_depth = avctx->bits_per_raw_sample > 8;
@@ -434,7 +434,6 @@ void dsputil_init_align(DSPContext* c, AVCodecContext *avctx)
c->put_mspel_pixels_tab[7]= put_mspel8_mc32_sh4;
c->gmc1 = gmc1_c;
- c->gmc = gmc_c;
#endif
}
diff --git a/gst-libs/ext/libav/libavcodec/sh4/dsputil_sh4.c b/gst-libs/ext/libav/libavcodec/sh4/dsputil_sh4.c
index 51c1a53..74c8670 100644
--- a/gst-libs/ext/libav/libavcodec/sh4/dsputil_sh4.c
+++ b/gst-libs/ext/libav/libavcodec/sh4/dsputil_sh4.c
@@ -56,7 +56,7 @@ static void idct_put(uint8_t *dest, int line_size, DCTELEM *block)
{
int i;
uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
- idct_sh4(block);
+ ff_idct_sh4(block);
for(i=0;i<8;i++) {
dest[0] = cm[block[0]];
dest[1] = cm[block[1]];
@@ -74,7 +74,7 @@ static void idct_add(uint8_t *dest, int line_size, DCTELEM *block)
{
int i;
uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
- idct_sh4(block);
+ ff_idct_sh4(block);
for(i=0;i<8;i++) {
dest[0] = cm[dest[0]+block[0]];
dest[1] = cm[dest[1]+block[1]];
@@ -89,11 +89,11 @@ static void idct_add(uint8_t *dest, int line_size, DCTELEM *block)
}
}
-void dsputil_init_sh4(DSPContext* c, AVCodecContext *avctx)
+void ff_dsputil_init_sh4(DSPContext* c, AVCodecContext *avctx)
{
const int idct_algo= avctx->idct_algo;
const int high_bit_depth = avctx->bits_per_raw_sample > 8;
- dsputil_init_align(c,avctx);
+ ff_dsputil_init_align(c,avctx);
if (!high_bit_depth)
c->clear_blocks = clear_blocks_sh4;
@@ -101,7 +101,7 @@ void dsputil_init_sh4(DSPContext* c, AVCodecContext *avctx)
(idct_algo==FF_IDCT_AUTO || idct_algo==FF_IDCT_SH4)) {
c->idct_put = idct_put;
c->idct_add = idct_add;
- c->idct = idct_sh4;
+ c->idct = ff_idct_sh4;
c->idct_permutation_type= FF_NO_IDCT_PERM;
}
}
diff --git a/gst-libs/ext/libav/libavcodec/sh4/dsputil_sh4.h b/gst-libs/ext/libav/libavcodec/sh4/dsputil_sh4.h
index 5abe345..7e8ebbc 100644
--- a/gst-libs/ext/libav/libavcodec/sh4/dsputil_sh4.h
+++ b/gst-libs/ext/libav/libavcodec/sh4/dsputil_sh4.h
@@ -22,7 +22,7 @@
#include "libavcodec/avcodec.h"
#include "libavcodec/dsputil.h"
-void idct_sh4(DCTELEM *block);
-void dsputil_init_align(DSPContext* c, AVCodecContext *avctx);
+void ff_idct_sh4(DCTELEM *block);
+void ff_dsputil_init_align(DSPContext* c, AVCodecContext *avctx);
#endif /* AVCODEC_SH4_DSPUTIL_SH4_H */
diff --git a/gst-libs/ext/libav/libavcodec/sh4/idct_sh4.c b/gst-libs/ext/libav/libavcodec/sh4/idct_sh4.c
index 0baff39..9da6ffc 100644
--- a/gst-libs/ext/libav/libavcodec/sh4/idct_sh4.c
+++ b/gst-libs/ext/libav/libavcodec/sh4/idct_sh4.c
@@ -89,7 +89,7 @@ static const float odd_table[] __attribute__ ((aligned(8))) = {
//optimized
-void idct_sh4(DCTELEM *block)
+void ff_idct_sh4(DCTELEM *block)
{
DEFREG;
diff --git a/gst-libs/ext/libav/libavcodec/sh4/qpel.c b/gst-libs/ext/libav/libavcodec/sh4/qpel.c
index 3242872..20540f7 100644
--- a/gst-libs/ext/libav/libavcodec/sh4/qpel.c
+++ b/gst-libs/ext/libav/libavcodec/sh4/qpel.c
@@ -21,6 +21,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "libavutil/common.h"
+
#define PIXOP2(OPNAME, OP) \
\
static inline void OPNAME ## _pixels4_l2_aligned(uint8_t *dst, const uint8_t *src1, const uint8_t *src2, int dst_stride, int src_stride1, int src_stride2, int h) \
@@ -357,63 +359,6 @@ static void gmc1_c(uint8_t *dst, uint8_t *src, int stride, int h, int x16, int y
}while(--h);
}
-static void gmc_c(uint8_t *dst, uint8_t *src, int stride, int h, int ox, int oy,
- int dxx, int dxy, int dyx, int dyy, int shift, int r, int width, int height)
-{
- int y, vx, vy;
- const int s= 1<<shift;
-
- width--;
- height--;
-
- for(y=0; y<h; y++){
- int x;
-
- vx= ox;
- vy= oy;
- for(x=0; x<8; x++){ //XXX FIXME optimize
- int src_x, src_y, frac_x, frac_y, index;
-
- src_x= vx>>16;
- src_y= vy>>16;
- frac_x= src_x&(s-1);
- frac_y= src_y&(s-1);
- src_x>>=shift;
- src_y>>=shift;
-
- if((unsigned)src_x < width){
- if((unsigned)src_y < height){
- index= src_x + src_y*stride;
- dst[y*stride + x]= ( ( src[index ]*(s-frac_x)
- + src[index +1]* frac_x )*(s-frac_y)
- + ( src[index+stride ]*(s-frac_x)
- + src[index+stride+1]* frac_x )* frac_y
- + r)>>(shift*2);
- }else{
- index= src_x + av_clip(src_y, 0, height)*stride;
- dst[y*stride + x]= ( ( src[index ]*(s-frac_x)
- + src[index +1]* frac_x )*s
- + r)>>(shift*2);
- }
- }else{
- if((unsigned)src_y < height){
- index= av_clip(src_x, 0, width) + src_y*stride;
- dst[y*stride + x]= ( ( src[index ]*(s-frac_y)
- + src[index+stride ]* frac_y )*s
- + r)>>(shift*2);
- }else{
- index= av_clip(src_x, 0, width) + av_clip(src_y, 0, height)*stride;
- dst[y*stride + x]= src[index ];
- }
- }
-
- vx+= dxx;
- vy+= dyx;
- }
- ox += dxy;
- oy += dyy;
- }
-}
#define H264_CHROMA_MC(OPNAME, OP)\
static void OPNAME ## h264_chroma_mc2_sh4(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y){\
const int A=(8-x)*(8-y);\
diff --git a/gst-libs/ext/libav/libavcodec/shorten.c b/gst-libs/ext/libav/libavcodec/shorten.c
index 256beaf..0b4a473 100644
--- a/gst-libs/ext/libav/libavcodec/shorten.c
+++ b/gst-libs/ext/libav/libavcodec/shorten.c
@@ -31,6 +31,7 @@
#include "bytestream.h"
#include "get_bits.h"
#include "golomb.h"
+#include "internal.h"
#define MAX_CHANNELS 8
#define MAX_BLOCKSIZE 65535
@@ -112,7 +113,7 @@ static av_cold int shorten_decode_init(AVCodecContext *avctx)
{
ShortenContext *s = avctx->priv_data;
s->avctx = avctx;
- avctx->sample_fmt = AV_SAMPLE_FMT_S16;
+ avctx->sample_fmt = AV_SAMPLE_FMT_S16P;
avcodec_get_frame_defaults(&s->frame);
avctx->coded_frame = &s->frame;
@@ -257,13 +258,16 @@ static int decode_wave_header(AVCodecContext *avctx, const uint8_t *header,
return 0;
}
-static void interleave_buffer(int16_t *samples, int nchan, int blocksize,
- int32_t **buffer)
+static void output_buffer(int16_t **samples, int nchan, int blocksize,
+ int32_t **buffer)
{
- int i, chan;
- for (i=0; i<blocksize; i++)
- for (chan=0; chan < nchan; chan++)
- *samples++ = av_clip_int16(buffer[chan][i]);
+ int i, ch;
+ for (ch = 0; ch < nchan; ch++) {
+ int32_t *in = buffer[ch];
+ int16_t *out = samples[ch];
+ for (i = 0; i < blocksize; i++)
+ out[i] = av_clip_int16(in[i]);
+ }
}
static const int fixed_coeffs[3][3] = {
@@ -536,7 +540,8 @@ static int shorten_decode_frame(AVCodecContext *avctx, void *data,
/* get Rice code for residual decoding */
if (cmd != FN_ZERO) {
residual_size = get_ur_golomb_shorten(&s->gb, ENERGYSIZE);
- /* this is a hack as version 0 differed in defintion of get_sr_golomb_shorten */
+ /* This is a hack as version 0 differed in the definition
+ * of get_sr_golomb_shorten(). */
if (s->version == 0)
residual_size--;
}
@@ -591,13 +596,13 @@ static int shorten_decode_frame(AVCodecContext *avctx, void *data,
if (s->cur_chan == s->channels) {
/* get output buffer */
s->frame.nb_samples = s->blocksize;
- if ((ret = avctx->get_buffer(avctx, &s->frame)) < 0) {
+ if ((ret = ff_get_buffer(avctx, &s->frame)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return ret;
}
/* interleave output */
- interleave_buffer((int16_t *)s->frame.data[0], s->channels,
- s->blocksize, s->decoded);
+ output_buffer((int16_t **)s->frame.extended_data, s->channels,
+ s->blocksize, s->decoded);
*got_frame_ptr = 1;
*(AVFrame *)data = s->frame;
@@ -643,11 +648,13 @@ static av_cold int shorten_decode_close(AVCodecContext *avctx)
AVCodec ff_shorten_decoder = {
.name = "shorten",
.type = AVMEDIA_TYPE_AUDIO,
- .id = CODEC_ID_SHORTEN,
+ .id = AV_CODEC_ID_SHORTEN,
.priv_data_size = sizeof(ShortenContext),
.init = shorten_decode_init,
.close = shorten_decode_close,
.decode = shorten_decode_frame,
.capabilities = CODEC_CAP_DELAY | CODEC_CAP_DR1,
- .long_name= NULL_IF_CONFIG_SMALL("Shorten"),
+ .long_name = NULL_IF_CONFIG_SMALL("Shorten"),
+ .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_S16P,
+ AV_SAMPLE_FMT_NONE },
};
diff --git a/gst-libs/ext/libav/libavcodec/sinewin.h b/gst-libs/ext/libav/libavcodec/sinewin.h
index eefe5bf..478036d 100644
--- a/gst-libs/ext/libav/libavcodec/sinewin.h
+++ b/gst-libs/ext/libav/libavcodec/sinewin.h
@@ -31,7 +31,7 @@
#endif
#define SINETABLE(size) \
- SINETABLE_CONST DECLARE_ALIGNED(16, float, ff_sine_##size)[size]
+ SINETABLE_CONST DECLARE_ALIGNED(32, float, ff_sine_##size)[size]
/**
* Generate a sine window.
@@ -53,7 +53,8 @@ extern SINETABLE( 512);
extern SINETABLE(1024);
extern SINETABLE(2048);
extern SINETABLE(4096);
+extern SINETABLE(8192);
-extern SINETABLE_CONST float * const ff_sine_windows[13];
+extern SINETABLE_CONST float * const ff_sine_windows[14];
#endif /* AVCODEC_SINEWIN_H */
diff --git a/gst-libs/ext/libav/libavcodec/sinewin_tablegen.c b/gst-libs/ext/libav/libavcodec/sinewin_tablegen.c
index 2f4d1aa..90a75c2 100644
--- a/gst-libs/ext/libav/libavcodec/sinewin_tablegen.c
+++ b/gst-libs/ext/libav/libavcodec/sinewin_tablegen.c
@@ -26,9 +26,6 @@
#define SINETABLE(size) \
float ff_sine_##size[size]
#define FF_ARRAY_ELEMS(a) (sizeof(a) / sizeof((a)[0]))
-#ifndef M_PI
-#define M_PI 3.14159265358979323846
-#endif
#include "sinewin_tablegen.h"
#include "tableprint.h"
@@ -38,7 +35,7 @@ int main(void)
write_fileheader();
- for (i = 5; i <= 12; i++) {
+ for (i = 5; i <= 13; i++) {
ff_init_ff_sine_windows(i);
printf("SINETABLE(%4i) = {\n", 1 << i);
write_float_array(ff_sine_windows[i], 1 << i);
diff --git a/gst-libs/ext/libav/libavcodec/sinewin_tablegen.h b/gst-libs/ext/libav/libavcodec/sinewin_tablegen.h
index 720f1ab..1ee225b 100644
--- a/gst-libs/ext/libav/libavcodec/sinewin_tablegen.h
+++ b/gst-libs/ext/libav/libavcodec/sinewin_tablegen.h
@@ -28,6 +28,7 @@
// for the host and the target and config.h is only valid for the target
#include <math.h>
#include "libavutil/attributes.h"
+#include "libavutil/common.h"
#if !CONFIG_HARDCODED_TABLES
SINETABLE( 32);
@@ -38,6 +39,7 @@ SINETABLE( 512);
SINETABLE(1024);
SINETABLE(2048);
SINETABLE(4096);
+SINETABLE(8192);
#else
#include "libavcodec/sinewin_tables.h"
#endif
@@ -45,7 +47,7 @@ SINETABLE(4096);
SINETABLE_CONST float * const ff_sine_windows[] = {
NULL, NULL, NULL, NULL, NULL, // unused
ff_sine_32 , ff_sine_64 ,
- ff_sine_128, ff_sine_256, ff_sine_512, ff_sine_1024, ff_sine_2048, ff_sine_4096
+ ff_sine_128, ff_sine_256, ff_sine_512, ff_sine_1024, ff_sine_2048, ff_sine_4096, ff_sine_8192
};
// Generate a sine window.
diff --git a/gst-libs/ext/libav/libavcodec/sipr.c b/gst-libs/ext/libav/libavcodec/sipr.c
index 818524c..d482b0f 100644
--- a/gst-libs/ext/libav/libavcodec/sipr.c
+++ b/gst-libs/ext/libav/libavcodec/sipr.c
@@ -25,14 +25,15 @@
#include <stdint.h>
#include <string.h>
+#include "libavutil/channel_layout.h"
#include "libavutil/mathematics.h"
#include "avcodec.h"
#define BITSTREAM_READER_LE
#include "get_bits.h"
#include "dsputil.h"
+#include "internal.h"
#include "lsp.h"
-#include "celp_math.h"
#include "acelp_vectors.h"
#include "acelp_pitch_delay.h"
#include "acelp_filters.h"
@@ -411,7 +412,7 @@ static void decode_frame(SiprContext *ctx, SiprParameters *params,
SUBFR_SIZE);
avg_energy =
- (0.01 + ff_dot_productf(fixed_vector, fixed_vector, SUBFR_SIZE))/
+ (0.01 + ff_scalarproduct_float_c(fixed_vector, fixed_vector, SUBFR_SIZE)) /
SUBFR_SIZE;
ctx->past_pitch_gain = pitch_gain = gain_cb[params->gc_index[i]][0];
@@ -453,9 +454,9 @@ static void decode_frame(SiprContext *ctx, SiprParameters *params,
if (ctx->mode == MODE_5k0) {
for (i = 0; i < subframe_count; i++) {
- float energy = ff_dot_productf(ctx->postfilter_syn5k0 + LP_FILTER_ORDER + i*SUBFR_SIZE,
- ctx->postfilter_syn5k0 + LP_FILTER_ORDER + i*SUBFR_SIZE,
- SUBFR_SIZE);
+ float energy = ff_scalarproduct_float_c(ctx->postfilter_syn5k0 + LP_FILTER_ORDER + i * SUBFR_SIZE,
+ ctx->postfilter_syn5k0 + LP_FILTER_ORDER + i * SUBFR_SIZE,
+ SUBFR_SIZE);
ff_adaptive_gain_control(&synth[i * SUBFR_SIZE],
&synth[i * SUBFR_SIZE], energy,
SUBFR_SIZE, 0.9, &ctx->postfilter_agc);
@@ -510,7 +511,9 @@ static av_cold int sipr_decoder_init(AVCodecContext * avctx)
for (i = 0; i < 4; i++)
ctx->energy_history[i] = -14;
- avctx->sample_fmt = AV_SAMPLE_FMT_FLT;
+ avctx->channels = 1;
+ avctx->channel_layout = AV_CH_LAYOUT_MONO;
+ avctx->sample_fmt = AV_SAMPLE_FMT_FLT;
avcodec_get_frame_defaults(&ctx->frame);
avctx->coded_frame = &ctx->frame;
@@ -541,7 +544,7 @@ static int sipr_decode_frame(AVCodecContext *avctx, void *data,
/* get output buffer */
ctx->frame.nb_samples = mode_par->frames_per_packet * subframe_size *
mode_par->subframe_count;
- if ((ret = avctx->get_buffer(avctx, &ctx->frame)) < 0) {
+ if ((ret = ff_get_buffer(avctx, &ctx->frame)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return ret;
}
@@ -566,10 +569,10 @@ static int sipr_decode_frame(AVCodecContext *avctx, void *data,
AVCodec ff_sipr_decoder = {
.name = "sipr",
.type = AVMEDIA_TYPE_AUDIO,
- .id = CODEC_ID_SIPR,
+ .id = AV_CODEC_ID_SIPR,
.priv_data_size = sizeof(SiprContext),
.init = sipr_decoder_init,
.decode = sipr_decode_frame,
.capabilities = CODEC_CAP_DR1,
- .long_name = NULL_IF_CONFIG_SMALL("RealAudio SIPR / ACELP.NET"),
+ .long_name = NULL_IF_CONFIG_SMALL("RealAudio SIPR / ACELP.NET"),
};
diff --git a/gst-libs/ext/libav/libavcodec/sipr.h b/gst-libs/ext/libav/libavcodec/sipr.h
index 9515321..5007c75 100644
--- a/gst-libs/ext/libav/libavcodec/sipr.h
+++ b/gst-libs/ext/libav/libavcodec/sipr.h
@@ -27,6 +27,7 @@
#include "avcodec.h"
#include "dsputil.h"
#include "acelp_pitch_delay.h"
+#include "libavutil/mem.h"
#define LP_FILTER_ORDER_16k 16
#define L_SUBFR_16k 80
diff --git a/gst-libs/ext/libav/libavcodec/sipr16k.c b/gst-libs/ext/libav/libavcodec/sipr16k.c
index ca10cd9..bff739e 100644
--- a/gst-libs/ext/libav/libavcodec/sipr16k.c
+++ b/gst-libs/ext/libav/libavcodec/sipr16k.c
@@ -24,9 +24,11 @@
#include <math.h>
#include "sipr.h"
+#include "libavutil/common.h"
#include "libavutil/mathematics.h"
+#include "dsputil.h"
#include "lsp.h"
-#include "celp_math.h"
+#include "celp_filters.h"
#include "acelp_vectors.h"
#include "acelp_pitch_delay.h"
#include "acelp_filters.h"
@@ -162,10 +164,10 @@ static float acelp_decode_gain_codef(float gain_corr_factor, const float *fc_v,
int subframe_size, int ma_pred_order)
{
mr_energy +=
- ff_dot_productf(quant_energy, ma_prediction_coeff, ma_pred_order);
+ ff_scalarproduct_float_c(quant_energy, ma_prediction_coeff, ma_pred_order);
mr_energy = gain_corr_factor * exp(M_LN10 / 20. * mr_energy) /
- sqrt((0.01 + ff_dot_productf(fc_v, fc_v, subframe_size)));
+ sqrt((0.01 + ff_scalarproduct_float_c(fc_v, fc_v, subframe_size)));
return mr_energy;
}
diff --git a/gst-libs/ext/libav/libavcodec/smacker.c b/gst-libs/ext/libav/libavcodec/smacker.c
index e9192ff..a72d7c5 100644
--- a/gst-libs/ext/libav/libavcodec/smacker.c
+++ b/gst-libs/ext/libav/libavcodec/smacker.c
@@ -31,8 +31,9 @@
#include <stdio.h>
#include <stdlib.h>
+#include "libavutil/channel_layout.h"
#include "avcodec.h"
-#include "libavutil/audioconvert.h"
+#include "internal.h"
#include "mathops.h"
#define BITSTREAM_READER_LE
@@ -133,13 +134,9 @@ static int smacker_decode_bigtree(GetBitContext *gb, HuffContext *hc, DBCtx *ctx
return -1;
}
if(!get_bits1(gb)){ //Leaf
- int val, i1, i2, b1, b2;
- b1 = get_bits_count(gb);
+ int val, i1, i2;
i1 = ctx->v1->table ? get_vlc2(gb, ctx->v1->table, SMKTREE_BITS, 3) : 0;
- b1 = get_bits_count(gb) - b1;
- b2 = get_bits_count(gb);
i2 = ctx->v2->table ? get_vlc2(gb, ctx->v2->table, SMKTREE_BITS, 3) : 0;
- b2 = get_bits_count(gb) - b2;
if (i1 < 0 || i2 < 0)
return -1;
val = ctx->recode1[i1] | (ctx->recode2[i2] << 8);
@@ -180,7 +177,7 @@ static int smacker_decode_header_tree(SmackVContext *smk, GetBitContext *gb, int
int res;
HuffContext huff;
HuffContext tmp1, tmp2;
- VLC vlc[2];
+ VLC vlc[2] = { { 0 } };
int escapes[3];
DBCtx ctx;
int err = 0;
@@ -204,9 +201,6 @@ static int smacker_decode_header_tree(SmackVContext *smk, GetBitContext *gb, int
tmp2.lengths = av_mallocz(256 * sizeof(int));
tmp2.values = av_mallocz(256 * sizeof(int));
- memset(&vlc[0], 0, sizeof(VLC));
- memset(&vlc[1], 0, sizeof(VLC));
-
if(get_bits1(gb)) {
smacker_decode_tree(gb, &tmp1, 0, 0);
skip_bits1(gb);
@@ -338,16 +332,14 @@ static av_always_inline void last_reset(int *recode, int *last) {
/* get code and update history */
static av_always_inline int smk_get_code(GetBitContext *gb, int *recode, int *last) {
register int *table = recode;
- int v, b;
+ int v;
- b = get_bits_count(gb);
while(*table & SMK_NODE) {
if(get_bits1(gb))
table += (*table) & (~SMK_NODE);
table++;
}
v = *table;
- b = get_bits_count(gb) - b;
if(v != recode[last[0]]) {
recode[last[2]] = recode[last[1]];
@@ -357,19 +349,20 @@ static av_always_inline int smk_get_code(GetBitContext *gb, int *recode, int *la
return v;
}
-static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt)
+static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
+ AVPacket *avpkt)
{
- const uint8_t *buf = avpkt->data;
- int buf_size = avpkt->size;
SmackVContext * const smk = avctx->priv_data;
uint8_t *out;
uint32_t *pal;
+ GetByteContext gb2;
GetBitContext gb;
int blocks, blk, bw, bh;
int i;
int stride;
+ int flags;
- if(buf_size <= 769)
+ if (avpkt->size <= 769)
return 0;
smk->pic.reference = 1;
@@ -381,23 +374,23 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
/* make the palette available on the way out */
pal = (uint32_t*)smk->pic.data[1];
- smk->pic.palette_has_changed = buf[0] & 1;
- smk->pic.key_frame = !!(buf[0] & 2);
+ bytestream2_init(&gb2, avpkt->data, avpkt->size);
+ flags = bytestream2_get_byteu(&gb2);
+ smk->pic.palette_has_changed = flags & 1;
+ smk->pic.key_frame = !!(flags & 2);
if(smk->pic.key_frame)
smk->pic.pict_type = AV_PICTURE_TYPE_I;
else
smk->pic.pict_type = AV_PICTURE_TYPE_P;
- buf++;
for(i = 0; i < 256; i++)
- *pal++ = bytestream_get_be24(&buf);
- buf_size -= 769;
+ *pal++ = bytestream2_get_be24u(&gb2);
last_reset(smk->mmap_tbl, smk->mmap_last);
last_reset(smk->mclr_tbl, smk->mclr_last);
last_reset(smk->full_tbl, smk->full_last);
last_reset(smk->type_tbl, smk->type_last);
- init_get_bits(&gb, buf, buf_size * 8);
+ init_get_bits(&gb, avpkt->data + 769, (avpkt->size - 769) * 8);
blk = 0;
bw = avctx->width >> 2;
@@ -504,11 +497,11 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
}
- *data_size = sizeof(AVFrame);
+ *got_frame = 1;
*(AVFrame*)data = smk->pic;
/* always report that the buffer was completely consumed */
- return buf_size;
+ return avpkt->size;
}
@@ -524,7 +517,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
c->avctx = avctx;
- avctx->pix_fmt = PIX_FMT_PAL8;
+ avctx->pix_fmt = AV_PIX_FMT_PAL8;
/* decode huffman trees from extradata */
@@ -593,8 +586,8 @@ static int smka_decode_frame(AVCodecContext *avctx, void *data,
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
GetBitContext gb;
- HuffContext h[4];
- VLC vlc[4];
+ HuffContext h[4] = { { 0 } };
+ VLC vlc[4] = { { 0 } };
int16_t *samples;
uint8_t *samples8;
int val;
@@ -630,15 +623,13 @@ static int smka_decode_frame(AVCodecContext *avctx, void *data,
/* get output buffer */
s->frame.nb_samples = unp_size / (avctx->channels * (bits + 1));
- if ((ret = avctx->get_buffer(avctx, &s->frame)) < 0) {
+ if ((ret = ff_get_buffer(avctx, &s->frame)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return ret;
}
samples = (int16_t *)s->frame.data[0];
samples8 = s->frame.data[0];
- memset(vlc, 0, sizeof(VLC) * 4);
- memset(h, 0, sizeof(HuffContext) * 4);
// Initialize
for(i = 0; i < (1 << (bits + stereo)); i++) {
h[i].length = 256;
@@ -744,23 +735,22 @@ static int smka_decode_frame(AVCodecContext *avctx, void *data,
AVCodec ff_smacker_decoder = {
.name = "smackvid",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_SMACKVIDEO,
+ .id = AV_CODEC_ID_SMACKVIDEO,
.priv_data_size = sizeof(SmackVContext),
.init = decode_init,
.close = decode_end,
.decode = decode_frame,
.capabilities = CODEC_CAP_DR1,
- .long_name = NULL_IF_CONFIG_SMALL("Smacker video"),
+ .long_name = NULL_IF_CONFIG_SMALL("Smacker video"),
};
AVCodec ff_smackaud_decoder = {
.name = "smackaud",
.type = AVMEDIA_TYPE_AUDIO,
- .id = CODEC_ID_SMACKAUDIO,
+ .id = AV_CODEC_ID_SMACKAUDIO,
.priv_data_size = sizeof(SmackerAudioContext),
.init = smka_decode_init,
.decode = smka_decode_frame,
.capabilities = CODEC_CAP_DR1,
- .long_name = NULL_IF_CONFIG_SMALL("Smacker audio"),
+ .long_name = NULL_IF_CONFIG_SMALL("Smacker audio"),
};
-
diff --git a/gst-libs/ext/libav/libavcodec/smc.c b/gst-libs/ext/libav/libavcodec/smc.c
index 2bd3176..1834003 100644
--- a/gst-libs/ext/libav/libavcodec/smc.c
+++ b/gst-libs/ext/libav/libavcodec/smc.c
@@ -414,7 +414,7 @@ static av_cold int smc_decode_init(AVCodecContext *avctx)
SmcContext *s = avctx->priv_data;
s->avctx = avctx;
- avctx->pix_fmt = PIX_FMT_PAL8;
+ avctx->pix_fmt = AV_PIX_FMT_PAL8;
s->frame.data[0] = NULL;
@@ -422,7 +422,7 @@ static av_cold int smc_decode_init(AVCodecContext *avctx)
}
static int smc_decode_frame(AVCodecContext *avctx,
- void *data, int *data_size,
+ void *data, int *got_frame,
AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
@@ -447,7 +447,7 @@ static int smc_decode_frame(AVCodecContext *avctx,
smc_decode_stream(s);
- *data_size = sizeof(AVFrame);
+ *got_frame = 1;
*(AVFrame*)data = s->frame;
/* always report that the buffer was completely consumed */
@@ -467,11 +467,11 @@ static av_cold int smc_decode_end(AVCodecContext *avctx)
AVCodec ff_smc_decoder = {
.name = "smc",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_SMC,
+ .id = AV_CODEC_ID_SMC,
.priv_data_size = sizeof(SmcContext),
.init = smc_decode_init,
.close = smc_decode_end,
.decode = smc_decode_frame,
.capabilities = CODEC_CAP_DR1,
- .long_name = NULL_IF_CONFIG_SMALL("QuickTime Graphics (SMC)"),
+ .long_name = NULL_IF_CONFIG_SMALL("QuickTime Graphics (SMC)"),
};
diff --git a/gst-libs/ext/libav/libavcodec/snow.c b/gst-libs/ext/libav/libavcodec/snow.c
index 612f56a..153e5b2 100644
--- a/gst-libs/ext/libav/libavcodec/snow.c
+++ b/gst-libs/ext/libav/libavcodec/snow.c
@@ -24,6 +24,7 @@
#include "avcodec.h"
#include "dsputil.h"
#include "dwt.h"
+#include "internal.h"
#include "snow.h"
#include "snowdata.h"
@@ -99,7 +100,7 @@ static void init_qexp(void){
double v=128;
for(i=0; i<QROOT; i++){
- qexp[i]= lrintf(v);
+ ff_qexp[i]= lrintf(v);
v *= pow(2, 1.0 / QROOT);
}
}
@@ -143,7 +144,7 @@ static void mc_block(Plane *p, uint8_t *dst, const uint8_t *src, int stride, int
int x, y, b, r, l;
int16_t tmpIt [64*(32+HTAPS_MAX)];
- uint8_t tmp2t[3][stride*(32+HTAPS_MAX)];
+ uint8_t tmp2t[3][64*(32+HTAPS_MAX)];
int16_t *tmpI= tmpIt;
uint8_t *tmp2= tmp2t[0];
const uint8_t *hpel[11];
@@ -181,7 +182,7 @@ static void mc_block(Plane *p, uint8_t *dst, const uint8_t *src, int stride, int
tmp2[x]= am;
}
tmpI+= 64;
- tmp2+= stride;
+ tmp2+= 64;
src += stride;
}
src -= stride*y;
@@ -210,7 +211,7 @@ static void mc_block(Plane *p, uint8_t *dst, const uint8_t *src, int stride, int
tmp2[x]= am;
}
src += stride;
- tmp2+= stride;
+ tmp2+= 64;
}
src -= stride*y;
}
@@ -237,12 +238,12 @@ static void mc_block(Plane *p, uint8_t *dst, const uint8_t *src, int stride, int
tmp2[x]= am;
}
tmpI+= 64;
- tmp2+= stride;
+ tmp2+= 64;
}
}
hpel[ 0]= src;
- hpel[ 1]= tmp2t[0] + stride*(HTAPS_MAX/2-1);
+ hpel[ 1]= tmp2t[0] + 64*(HTAPS_MAX/2-1);
hpel[ 2]= src + 1;
hpel[ 4]= tmp2t[1];
@@ -250,14 +251,21 @@ static void mc_block(Plane *p, uint8_t *dst, const uint8_t *src, int stride, int
hpel[ 6]= tmp2t[1] + 1;
hpel[ 8]= src + stride;
- hpel[ 9]= hpel[1] + stride;
+ hpel[ 9]= hpel[1] + 64;
hpel[10]= hpel[8] + 1;
+#define MC_STRIDE(x) (needs[x] ? 64 : stride)
+
if(b==15){
- const uint8_t *src1= hpel[dx/8 + dy/8*4 ];
- const uint8_t *src2= hpel[dx/8 + dy/8*4+1];
- const uint8_t *src3= hpel[dx/8 + dy/8*4+4];
- const uint8_t *src4= hpel[dx/8 + dy/8*4+5];
+ int dxy = dx / 8 + dy / 8 * 4;
+ const uint8_t *src1 = hpel[dxy ];
+ const uint8_t *src2 = hpel[dxy + 1];
+ const uint8_t *src3 = hpel[dxy + 4];
+ const uint8_t *src4 = hpel[dxy + 5];
+ int stride1 = MC_STRIDE(dxy);
+ int stride2 = MC_STRIDE(dxy + 1);
+ int stride3 = MC_STRIDE(dxy + 4);
+ int stride4 = MC_STRIDE(dxy + 5);
dx&=7;
dy&=7;
for(y=0; y < b_h; y++){
@@ -265,23 +273,25 @@ static void mc_block(Plane *p, uint8_t *dst, const uint8_t *src, int stride, int
dst[x]= ((8-dx)*(8-dy)*src1[x] + dx*(8-dy)*src2[x]+
(8-dx)* dy *src3[x] + dx* dy *src4[x]+32)>>6;
}
- src1+=stride;
- src2+=stride;
- src3+=stride;
- src4+=stride;
+ src1+=stride1;
+ src2+=stride2;
+ src3+=stride3;
+ src4+=stride4;
dst +=stride;
}
}else{
const uint8_t *src1= hpel[l];
const uint8_t *src2= hpel[r];
+ int stride1 = MC_STRIDE(l);
+ int stride2 = MC_STRIDE(r);
int a= weight[((dx&7) + (8*(dy&7)))];
int b= 8-a;
for(y=0; y < b_h; y++){
for(x=0; x < b_w; x++){
dst[x]= (a*src1[x] + b*src2[x] + 4)>>3;
}
- src1+=stride;
- src2+=stride;
+ src1+=stride1;
+ src2+=stride2;
dst +=stride;
}
}
@@ -339,7 +349,7 @@ void ff_snow_pred_block(SnowContext *s, uint8_t *dst, uint8_t *tmp, int stride,
src += sx + sy*stride;
if( (unsigned)sx >= w - b_w - (HTAPS_MAX-2)
|| (unsigned)sy >= h - b_h - (HTAPS_MAX-2)){
- s->dsp.emulated_edge_mc(tmp + MB_SIZE, src, stride, b_w+HTAPS_MAX-1, b_h+HTAPS_MAX-1, sx, sy, w, h);
+ s->vdsp.emulated_edge_mc(tmp + MB_SIZE, src, stride, b_w+HTAPS_MAX-1, b_h+HTAPS_MAX-1, sx, sy, w, h);
src= tmp + MB_SIZE;
}
// assert(b_w == b_h || 2*b_w == b_h || b_w == 2*b_h);
@@ -386,11 +396,13 @@ av_cold int ff_snow_common_init(AVCodecContext *avctx){
SnowContext *s = avctx->priv_data;
int width, height;
int i, j, ret;
+ int emu_buf_size;
s->avctx= avctx;
s->max_ref_frames=1; //just make sure its not an invalid value in case of no initial keyframe
- dsputil_init(&s->dsp, avctx);
+ ff_dsputil_init(&s->dsp, avctx);
+ ff_videodsp_init(&s->vdsp, 8);
ff_dwt_init(&s->dwt);
#define mcf(dx,dy)\
@@ -440,16 +452,21 @@ av_cold int ff_snow_common_init(AVCodecContext *avctx){
FF_ALLOCZ_OR_GOTO(avctx, s->spatial_idwt_buffer, width * height * sizeof(IDWTELEM), fail);
FF_ALLOCZ_OR_GOTO(avctx, s->spatial_dwt_buffer, width * height * sizeof(DWTELEM), fail); //FIXME this does not belong here
+ FF_ALLOCZ_OR_GOTO(avctx, s->temp_dwt_buffer, width * sizeof(DWTELEM), fail);
+ FF_ALLOCZ_OR_GOTO(avctx, s->temp_idwt_buffer, width * sizeof(IDWTELEM), fail);
+ FF_ALLOC_OR_GOTO(avctx, s->run_buffer, ((width + 1) >> 1) * ((height + 1) >> 1) * sizeof(*s->run_buffer), fail);
for(i=0; i<MAX_REF_FRAMES; i++)
for(j=0; j<MAX_REF_FRAMES; j++)
- scale_mv_ref[i][j] = 256*(i+1)/(j+1);
+ ff_scale_mv_ref[i][j] = 256*(i+1)/(j+1);
- if ((ret = s->avctx->get_buffer(s->avctx, &s->mconly_picture)) < 0) {
+ if ((ret = ff_get_buffer(s->avctx, &s->mconly_picture)) < 0) {
av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return ret;
}
FF_ALLOC_OR_GOTO(avctx, s->scratchbuf, s->mconly_picture.linesize[0]*7*MB_SIZE, fail);
+ emu_buf_size = s->mconly_picture.linesize[0] * (2 * MB_SIZE + HTAPS_MAX - 1);
+ FF_ALLOC_OR_GOTO(avctx, s->emu_edge_buffer, emu_buf_size, fail);
return 0;
fail:
@@ -608,7 +625,7 @@ int ff_snow_frame_start(SnowContext *s){
}
s->current_picture.reference= 1;
- if(s->avctx->get_buffer(s->avctx, &s->current_picture) < 0){
+ if(ff_get_buffer(s->avctx, &s->current_picture) < 0){
av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return -1;
}
@@ -623,7 +640,10 @@ av_cold void ff_snow_common_end(SnowContext *s)
int plane_index, level, orientation, i;
av_freep(&s->spatial_dwt_buffer);
+ av_freep(&s->temp_dwt_buffer);
av_freep(&s->spatial_idwt_buffer);
+ av_freep(&s->temp_idwt_buffer);
+ av_freep(&s->run_buffer);
s->m.me.temp= NULL;
av_freep(&s->m.me.scratchpad);
@@ -633,6 +653,7 @@ av_cold void ff_snow_common_end(SnowContext *s)
av_freep(&s->block);
av_freep(&s->scratchbuf);
+ av_freep(&s->emu_edge_buffer);
for(i=0; i<MAX_REF_FRAMES; i++){
av_freep(&s->ref_mvs[i]);
@@ -655,4 +676,3 @@ av_cold void ff_snow_common_end(SnowContext *s)
if (s->current_picture.data[0])
s->avctx->release_buffer(s->avctx, &s->current_picture);
}
-
diff --git a/gst-libs/ext/libav/libavcodec/snow.h b/gst-libs/ext/libav/libavcodec/snow.h
index bd54994..b988115 100644
--- a/gst-libs/ext/libav/libavcodec/snow.h
+++ b/gst-libs/ext/libav/libavcodec/snow.h
@@ -108,6 +108,7 @@ typedef struct SnowContext{
AVCodecContext *avctx;
RangeCoder c;
DSPContext dsp;
+ VideoDSPContext vdsp;
DWTContext dwt;
AVFrame new_picture;
AVFrame input_picture; ///< new_picture with the internal linesizes
@@ -132,7 +133,10 @@ typedef struct SnowContext{
int16_t (*ref_mvs[MAX_REF_FRAMES])[2];
uint32_t *ref_scores[MAX_REF_FRAMES];
DWTELEM *spatial_dwt_buffer;
+ DWTELEM *temp_dwt_buffer;
IDWTELEM *spatial_idwt_buffer;
+ IDWTELEM *temp_idwt_buffer;
+ int *run_buffer;
int colorspace_type;
int chroma_h_shift;
int chroma_v_shift;
@@ -162,16 +166,13 @@ typedef struct SnowContext{
MpegEncContext m; // needed for motion estimation, should not be used for anything else, the idea is to eventually make the motion estimation independent of MpegEncContext, so this will be removed then (FIXME/XXX)
uint8_t *scratchbuf;
+ uint8_t *emu_edge_buffer;
}SnowContext;
/* Tables */
-extern const uint8_t * const obmc_tab[4];
-#ifdef __sgi
-// Avoid a name clash on SGI IRIX
-#undef qexp
-#endif
-extern uint8_t qexp[QROOT];
-extern int scale_mv_ref[MAX_REF_FRAMES][MAX_REF_FRAMES];
+extern const uint8_t * const ff_obmc_tab[4];
+extern uint8_t ff_qexp[QROOT];
+extern int ff_scale_mv_ref[MAX_REF_FRAMES][MAX_REF_FRAMES];
/* C bits used by mmx/sse2/altivec */
@@ -256,7 +257,7 @@ static inline void pred_mv(SnowContext *s, int *mx, int *my, int ref,
*mx = mid_pred(left->mx, top->mx, tr->mx);
*my = mid_pred(left->my, top->my, tr->my);
}else{
- const int *scale = scale_mv_ref[ref];
+ const int *scale = ff_scale_mv_ref[ref];
*mx = mid_pred((left->mx * scale[left->ref] + 128) >>8,
(top ->mx * scale[top ->ref] + 128) >>8,
(tr ->mx * scale[tr ->ref] + 128) >>8);
@@ -405,7 +406,7 @@ static av_always_inline void predict_slice(SnowContext *s, IDWTELEM *buf, int pl
int x, y, mb_x;
int block_size = MB_SIZE >> s->block_max_depth;
int block_w = plane_index ? block_size/2 : block_size;
- const uint8_t *obmc = plane_index ? obmc_tab[s->block_max_depth+1] : obmc_tab[s->block_max_depth];
+ const uint8_t *obmc = plane_index ? ff_obmc_tab[s->block_max_depth+1] : ff_obmc_tab[s->block_max_depth];
const int obmc_stride= plane_index ? block_size : 2*block_size;
int ref_stride= s->current_picture.linesize[plane_index];
uint8_t *dst8= s->current_picture.data[plane_index];
@@ -496,7 +497,7 @@ static inline void init_ref(MotionEstContext *c, uint8_t *src[3], uint8_t *ref[3
/* bitstream functions */
-extern const int8_t quant3bA[256];
+extern const int8_t ff_quant3bA[256];
#define QEXPSHIFT (7-FRAC_BITS+8) //FIXME try to change this to 0
@@ -642,7 +643,7 @@ static inline void unpack_coeffs(SnowContext *s, SubBand *b, SubBand * parent, i
v=get_rac(&s->c, &b->state[0][context]);
if(v){
v= 2*(get_symbol2(&s->c, b->state[context + 2], context-4) + 1);
- v+=get_rac(&s->c, &b->state[0][16 + 1 + 3 + quant3bA[l&0xFF] + 3*quant3bA[t&0xFF]]);
+ v+=get_rac(&s->c, &b->state[0][16 + 1 + 3 + ff_quant3bA[l&0xFF] + 3*ff_quant3bA[t&0xFF]]);
xc->x=x;
(xc++)->coeff= v;
diff --git a/gst-libs/ext/libav/libavcodec/snowdata.h b/gst-libs/ext/libav/libavcodec/snowdata.h
index ca2468c..4a91858 100644
--- a/gst-libs/ext/libav/libavcodec/snowdata.h
+++ b/gst-libs/ext/libav/libavcodec/snowdata.h
@@ -101,7 +101,7 @@ static const uint8_t obmc4[16]={
//error:0.000000
};
-const int8_t quant3bA[256]={
+const int8_t ff_quant3bA[256]={
0, 0, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1,
1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1,
1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1,
@@ -120,13 +120,13 @@ const int8_t quant3bA[256]={
1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1,
};
-const uint8_t * const obmc_tab[4]= {
+const uint8_t * const ff_obmc_tab[4]= {
obmc32, obmc16, obmc8, obmc4
};
/* runtime generated tables */
-uint8_t qexp[QROOT];
-int scale_mv_ref[MAX_REF_FRAMES][MAX_REF_FRAMES];
+uint8_t ff_qexp[QROOT];
+int ff_scale_mv_ref[MAX_REF_FRAMES][MAX_REF_FRAMES];
#endif /* AVCODEC_SNOW_H */
diff --git a/gst-libs/ext/libav/libavcodec/snowdec.c b/gst-libs/ext/libav/libavcodec/snowdec.c
index 049d4a6..603cef0 100644
--- a/gst-libs/ext/libav/libavcodec/snowdec.c
+++ b/gst-libs/ext/libav/libavcodec/snowdec.c
@@ -24,6 +24,7 @@
#include "avcodec.h"
#include "dsputil.h"
#include "dwt.h"
+#include "internal.h"
#include "snow.h"
#include "rangecoder.h"
@@ -42,7 +43,7 @@ static av_always_inline void predict_slice_buffered(SnowContext *s, slice_buffer
int x, y, mb_x;
int block_size = MB_SIZE >> s->block_max_depth;
int block_w = plane_index ? block_size/2 : block_size;
- const uint8_t *obmc = plane_index ? obmc_tab[s->block_max_depth+1] : obmc_tab[s->block_max_depth];
+ const uint8_t *obmc = plane_index ? ff_obmc_tab[s->block_max_depth+1] : ff_obmc_tab[s->block_max_depth];
int obmc_stride= plane_index ? block_size : 2*block_size;
int ref_stride= s->current_picture.linesize[plane_index];
uint8_t *dst8= s->current_picture.data[plane_index];
@@ -95,7 +96,7 @@ static inline void decode_subband_slice_buffered(SnowContext *s, SubBand *b, sli
const int w= b->width;
int y;
const int qlog= av_clip(s->qlog + b->qlog, 0, QROOT*16);
- int qmul= qexp[qlog&(QROOT-1)]<<(qlog>>QSHIFT);
+ int qmul= ff_qexp[qlog&(QROOT-1)]<<(qlog>>QSHIFT);
int qadd= (s->qbias*qmul)>>QBIAS_SHIFT;
int new_index = 0;
@@ -191,7 +192,7 @@ static int decode_q_branch(SnowContext *s, int level, int x, int y){
static void dequantize_slice_buffered(SnowContext *s, slice_buffer * sb, SubBand *b, IDWTELEM *src, int stride, int start_y, int end_y){
const int w= b->width;
const int qlog= av_clip(s->qlog + b->qlog, 0, QROOT*16);
- const int qmul= qexp[qlog&(QROOT-1)]<<(qlog>>QSHIFT);
+ const int qmul= ff_qexp[qlog&(QROOT-1)]<<(qlog>>QSHIFT);
const int qadd= (s->qbias*qmul)>>QBIAS_SHIFT;
int x,y;
@@ -356,7 +357,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
{
int ret;
- avctx->pix_fmt= PIX_FMT_YUV420P;
+ avctx->pix_fmt= AV_PIX_FMT_YUV420P;
if ((ret = ff_snow_common_init(avctx)) < 0) {
ff_snow_common_end(avctx->priv_data);
@@ -381,7 +382,9 @@ static int decode_blocks(SnowContext *s){
return 0;
}
-static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt){
+static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
+ AVPacket *avpkt)
+{
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
SnowContext *s = avctx->priv_data;
@@ -401,7 +404,12 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
// realloc slice buffer for the case that spatial_decomposition_count changed
ff_slice_buffer_destroy(&s->sb);
- ff_slice_buffer_init(&s->sb, s->plane[0].height, (MB_SIZE >> s->block_max_depth) + s->spatial_decomposition_count * 8 + 1, s->plane[0].width, s->spatial_idwt_buffer);
+ if ((res = ff_slice_buffer_init(&s->sb, s->plane[0].height,
+ (MB_SIZE >> s->block_max_depth) +
+ s->spatial_decomposition_count * 8 + 1,
+ s->plane[0].width,
+ s->spatial_idwt_buffer)) < 0)
+ return res;
for(plane_index=0; plane_index<3; plane_index++){
Plane *p= &s->plane[plane_index];
@@ -502,7 +510,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
}
for(; yd<slice_h; yd+=4){
- ff_spatial_idwt_buffered_slice(&s->dwt, cs, &s->sb, w, h, 1, s->spatial_decomposition_type, s->spatial_decomposition_count, yd);
+ ff_spatial_idwt_buffered_slice(&s->dwt, cs, &s->sb, s->temp_idwt_buffer, w, h, 1, s->spatial_decomposition_type, s->spatial_decomposition_count, yd);
}
if(s->qlog == LOSSLESS_QLOG){
@@ -536,7 +544,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
else
*picture= s->mconly_picture;
- *data_size = sizeof(AVFrame);
+ *got_frame = 1;
bytes_read= c->bytestream - c->bytestream_start;
if(bytes_read ==0) av_log(s->avctx, AV_LOG_ERROR, "error at end of frame\n"); //FIXME
@@ -558,11 +566,11 @@ static av_cold int decode_end(AVCodecContext *avctx)
AVCodec ff_snow_decoder = {
.name = "snow",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_SNOW,
+ .id = AV_CODEC_ID_SNOW,
.priv_data_size = sizeof(SnowContext),
.init = decode_init,
.close = decode_end,
.decode = decode_frame,
.capabilities = CODEC_CAP_DR1 /*| CODEC_CAP_DRAW_HORIZ_BAND*/,
- .long_name = NULL_IF_CONFIG_SMALL("Snow"),
+ .long_name = NULL_IF_CONFIG_SMALL("Snow"),
};
diff --git a/gst-libs/ext/libav/libavcodec/snowenc.c b/gst-libs/ext/libav/libavcodec/snowenc.c
index d9fba96..f93c53f 100644
--- a/gst-libs/ext/libav/libavcodec/snowenc.c
+++ b/gst-libs/ext/libav/libavcodec/snowenc.c
@@ -23,6 +23,7 @@
#include "libavutil/opt.h"
#include "avcodec.h"
#include "dsputil.h"
+#include "internal.h"
#include "dwt.h"
#include "snow.h"
@@ -93,7 +94,7 @@ static void dwt_quantize(SnowContext *s, Plane *p, DWTELEM *buffer, int width, i
//FIXME pass the copy cleanly ?
// memcpy(dwt_buffer, buffer, height * stride * sizeof(DWTELEM));
- ff_spatial_dwt(buffer, width, height, stride, type, s->spatial_decomposition_count);
+ ff_spatial_dwt(buffer, s->temp_dwt_buffer, width, height, stride, type, s->spatial_decomposition_count);
for(level=0; level<s->spatial_decomposition_count; level++){
for(orientation=level ? 1 : 0; orientation<4; orientation++){
@@ -118,7 +119,7 @@ static void dwt_quantize(SnowContext *s, Plane *p, DWTELEM *buffer, int width, i
for(xs= 0; xs<Q2_STEP; xs++){
memcpy(idwt2_buffer, best_dequant, height * stride * sizeof(IDWTELEM));
dequantize_all(s, p, idwt2_buffer, width, height);
- ff_spatial_idwt(idwt2_buffer, width, height, stride, type, s->spatial_decomposition_count);
+ ff_spatial_idwt(idwt2_buffer, s->temp_idwt_buffer, width, height, stride, type, s->spatial_decomposition_count);
find_sse(s, p, best_score, score_stride, idwt2_buffer, s->spatial_idwt_buffer, level, orientation);
memcpy(idwt2_buffer, best_dequant, height * stride * sizeof(IDWTELEM));
for(y=ys; y<b->height; y+= Q2_STEP){
@@ -129,7 +130,7 @@ static void dwt_quantize(SnowContext *s, Plane *p, DWTELEM *buffer, int width, i
}
}
dequantize_all(s, p, idwt2_buffer, width, height);
- ff_spatial_idwt(idwt2_buffer, width, height, stride, type, s->spatial_decomposition_count);
+ ff_spatial_idwt(idwt2_buffer, s->temp_idwt_buffer, width, height, stride, type, s->spatial_decomposition_count);
find_sse(s, p, score, score_stride, idwt2_buffer, s->spatial_idwt_buffer, level, orientation);
for(y=ys; y<b->height; y+= Q2_STEP){
for(x=xs; x<b->width; x+= Q2_STEP){
@@ -152,7 +153,6 @@ static void dwt_quantize(SnowContext *s, Plane *p, DWTELEM *buffer, int width, i
#endif /* QUANTIZE2==1 */
-#if CONFIG_SNOW_ENCODER
static av_cold int encode_init(AVCodecContext *avctx)
{
SnowContext *s = avctx->priv_data;
@@ -218,15 +218,15 @@ static av_cold int encode_init(AVCodecContext *avctx)
avctx->coded_frame= &s->current_picture;
switch(avctx->pix_fmt){
-// case PIX_FMT_YUV444P:
-// case PIX_FMT_YUV422P:
- case PIX_FMT_YUV420P:
- case PIX_FMT_GRAY8:
-// case PIX_FMT_YUV411P:
-// case PIX_FMT_YUV410P:
+// case AV_PIX_FMT_YUV444P:
+// case AV_PIX_FMT_YUV422P:
+ case AV_PIX_FMT_YUV420P:
+ case AV_PIX_FMT_GRAY8:
+// case AV_PIX_FMT_YUV411P:
+// case AV_PIX_FMT_YUV410P:
s->colorspace_type= 0;
break;
-/* case PIX_FMT_RGB32:
+/* case AV_PIX_FMT_RGB32:
s->colorspace= 1;
break;*/
default:
@@ -240,7 +240,7 @@ static av_cold int encode_init(AVCodecContext *avctx)
ff_set_cmp(&s->dsp, s->dsp.me_cmp, s->avctx->me_cmp);
ff_set_cmp(&s->dsp, s->dsp.me_sub_cmp, s->avctx->me_sub_cmp);
- s->avctx->get_buffer(s->avctx, &s->input_picture);
+ ff_get_buffer(s->avctx, &s->input_picture);
if(s->avctx->me_method == ME_ITER){
int i;
@@ -578,7 +578,7 @@ static int get_dc(SnowContext *s, int mb_x, int mb_y, int plane_index){
Plane *p= &s->plane[plane_index];
const int block_size = MB_SIZE >> s->block_max_depth;
const int block_w = plane_index ? block_size/2 : block_size;
- const uint8_t *obmc = plane_index ? obmc_tab[s->block_max_depth+1] : obmc_tab[s->block_max_depth];
+ const uint8_t *obmc = plane_index ? ff_obmc_tab[s->block_max_depth+1] : ff_obmc_tab[s->block_max_depth];
const int obmc_stride= plane_index ? block_size : 2*block_size;
const int ref_stride= s->current_picture.linesize[plane_index];
uint8_t *src= s-> input_picture.data[plane_index];
@@ -666,7 +666,7 @@ static inline int get_block_bits(SnowContext *s, int x, int y, int w){
}
}
-static int get_block_rd(SnowContext *s, int mb_x, int mb_y, int plane_index, const uint8_t *obmc_edged){
+static int get_block_rd(SnowContext *s, int mb_x, int mb_y, int plane_index, uint8_t (*obmc_edged)[MB_SIZE * 2]){
Plane *p= &s->plane[plane_index];
const int block_size = MB_SIZE >> s->block_max_depth;
const int block_w = plane_index ? block_size/2 : block_size;
@@ -676,7 +676,7 @@ static int get_block_rd(SnowContext *s, int mb_x, int mb_y, int plane_index, con
uint8_t *src= s-> input_picture.data[plane_index];
IDWTELEM *pred= (IDWTELEM*)s->m.obmc_scratchpad + plane_index*block_size*block_size*4;
uint8_t *cur = s->scratchbuf;
- uint8_t tmp[ref_stride*(2*MB_SIZE+HTAPS_MAX-1)];
+ uint8_t *tmp = s->emu_edge_buffer;
const int b_stride = s->b_width << s->block_max_depth;
const int b_height = s->b_height<< s->block_max_depth;
const int w= p->width;
@@ -695,7 +695,7 @@ static int get_block_rd(SnowContext *s, int mb_x, int mb_y, int plane_index, con
ff_snow_pred_block(s, cur, tmp, ref_stride, sx, sy, block_w*2, block_w*2, &s->block[mb_x + mb_y*b_stride], plane_index, w, h);
for(y=y0; y<y1; y++){
- const uint8_t *obmc1= obmc_edged + y*obmc_stride;
+ const uint8_t *obmc1= obmc_edged[y];
const IDWTELEM *pred1 = pred + y*obmc_stride;
uint8_t *cur1 = cur + y*ref_stride;
uint8_t *dst1 = dst + sx + (sy+y)*ref_stride;
@@ -769,7 +769,7 @@ static int get_4block_rd(SnowContext *s, int mb_x, int mb_y, int plane_index){
Plane *p= &s->plane[plane_index];
const int block_size = MB_SIZE >> s->block_max_depth;
const int block_w = plane_index ? block_size/2 : block_size;
- const uint8_t *obmc = plane_index ? obmc_tab[s->block_max_depth+1] : obmc_tab[s->block_max_depth];
+ const uint8_t *obmc = plane_index ? ff_obmc_tab[s->block_max_depth+1] : ff_obmc_tab[s->block_max_depth];
const int obmc_stride= plane_index ? block_size : 2*block_size;
const int ref_stride= s->current_picture.linesize[plane_index];
uint8_t *dst= s->current_picture.data[plane_index];
@@ -837,7 +837,7 @@ static int encode_subband_c0run(SnowContext *s, SubBand *b, IDWTELEM *src, IDWTE
if(1){
int run=0;
- int runs[w*h];
+ int *runs = s->run_buffer;
int run_index=0;
int max_index;
@@ -942,7 +942,7 @@ static int encode_subband_c0run(SnowContext *s, SubBand *b, IDWTELEM *src, IDWTE
int t2= 2*FFABS(t) + (t<0);
put_symbol2(&s->c, b->state[context + 2], FFABS(v)-1, context-4);
- put_rac(&s->c, &b->state[0][16 + 1 + 3 + quant3bA[l2&0xFF] + 3*quant3bA[t2&0xFF]], v<0);
+ put_rac(&s->c, &b->state[0][16 + 1 + 3 + ff_quant3bA[l2&0xFF] + 3*ff_quant3bA[t2&0xFF]], v<0);
}
}
}
@@ -957,7 +957,7 @@ static int encode_subband(SnowContext *s, SubBand *b, IDWTELEM *src, IDWTELEM *p
// encode_subband_dzr(s, b, src, parent, stride, orientation);
}
-static av_always_inline int check_block(SnowContext *s, int mb_x, int mb_y, int p[3], int intra, const uint8_t *obmc_edged, int *best_rd){
+static av_always_inline int check_block(SnowContext *s, int mb_x, int mb_y, int p[3], int intra, uint8_t (*obmc_edged)[MB_SIZE * 2], int *best_rd){
const int b_stride= s->b_width << s->block_max_depth;
BlockNode *block= &s->block[mb_x + mb_y * b_stride];
BlockNode backup= *block;
@@ -998,7 +998,7 @@ static av_always_inline int check_block(SnowContext *s, int mb_x, int mb_y, int
/* special case for int[2] args we discard afterwards,
* fixes compilation problem with gcc 2.95 */
-static av_always_inline int check_block_inter(SnowContext *s, int mb_x, int mb_y, int p0, int p1, const uint8_t *obmc_edged, int *best_rd){
+static av_always_inline int check_block_inter(SnowContext *s, int mb_x, int mb_y, int p0, int p1, uint8_t (*obmc_edged)[MB_SIZE * 2], int *best_rd){
int p[2] = {p0, p1};
return check_block(s, mb_x, mb_y, p, 0, obmc_edged, best_rd);
}
@@ -1006,10 +1006,18 @@ static av_always_inline int check_block_inter(SnowContext *s, int mb_x, int mb_y
static av_always_inline int check_4block_inter(SnowContext *s, int mb_x, int mb_y, int p0, int p1, int ref, int *best_rd){
const int b_stride= s->b_width << s->block_max_depth;
BlockNode *block= &s->block[mb_x + mb_y * b_stride];
- BlockNode backup[4]= {block[0], block[1], block[b_stride], block[b_stride+1]};
+ BlockNode backup[4];
unsigned value;
int rd, index;
+ /* We don't initialize backup[] during variable declaration, because
+ * that fails to compile on MSVC: "cannot convert from 'BlockNode' to
+ * 'int16_t'". */
+ backup[0] = block[0];
+ backup[1] = block[1];
+ backup[2] = block[b_stride];
+ backup[3] = block[b_stride + 1];
+
assert(mb_x>=0 && mb_y>=0);
assert(mb_x<b_stride);
assert(((mb_x|mb_y)&1) == 0);
@@ -1078,7 +1086,7 @@ static void iterative_me(SnowContext *s){
BlockNode *blb= mb_x && mb_y+1<b_height ? &s->block[index+b_stride-1] : NULL;
BlockNode *brb= mb_x+1<b_width && mb_y+1<b_height ? &s->block[index+b_stride+1] : NULL;
const int b_w= (MB_SIZE >> s->block_max_depth);
- uint8_t obmc_edged[b_w*2][b_w*2];
+ uint8_t obmc_edged[MB_SIZE * 2][MB_SIZE * 2];
if(pass && (block->type & BLOCK_OPT))
continue;
@@ -1093,7 +1101,8 @@ static void iterative_me(SnowContext *s){
//FIXME precalculate
{
int x, y;
- memcpy(obmc_edged, obmc_tab[s->block_max_depth], b_w*b_w*4);
+ for (y = 0; y < b_w * 2; y++)
+ memcpy(obmc_edged[y], ff_obmc_tab[s->block_max_depth] + y * b_w * 2, b_w * 2);
if(mb_x==0)
for(y=0; y<b_w*2; y++)
memset(obmc_edged[y], obmc_edged[y][0] + obmc_edged[y][b_w-1], b_w);
@@ -1147,9 +1156,9 @@ static void iterative_me(SnowContext *s){
// get previous score (cannot be cached due to OBMC)
if(pass > 0 && (block->type&BLOCK_INTRA)){
int color0[3]= {block->color[0], block->color[1], block->color[2]};
- check_block(s, mb_x, mb_y, color0, 1, *obmc_edged, &best_rd);
+ check_block(s, mb_x, mb_y, color0, 1, obmc_edged, &best_rd);
}else
- check_block_inter(s, mb_x, mb_y, block->mx, block->my, *obmc_edged, &best_rd);
+ check_block_inter(s, mb_x, mb_y, block->mx, block->my, obmc_edged, &best_rd);
ref_b= *block;
ref_rd= best_rd;
@@ -1160,16 +1169,16 @@ static void iterative_me(SnowContext *s){
block->ref= ref;
best_rd= INT_MAX;
- check_block_inter(s, mb_x, mb_y, mvr[0][0], mvr[0][1], *obmc_edged, &best_rd);
- check_block_inter(s, mb_x, mb_y, 0, 0, *obmc_edged, &best_rd);
+ check_block_inter(s, mb_x, mb_y, mvr[0][0], mvr[0][1], obmc_edged, &best_rd);
+ check_block_inter(s, mb_x, mb_y, 0, 0, obmc_edged, &best_rd);
if(tb)
- check_block_inter(s, mb_x, mb_y, mvr[-b_stride][0], mvr[-b_stride][1], *obmc_edged, &best_rd);
+ check_block_inter(s, mb_x, mb_y, mvr[-b_stride][0], mvr[-b_stride][1], obmc_edged, &best_rd);
if(lb)
- check_block_inter(s, mb_x, mb_y, mvr[-1][0], mvr[-1][1], *obmc_edged, &best_rd);
+ check_block_inter(s, mb_x, mb_y, mvr[-1][0], mvr[-1][1], obmc_edged, &best_rd);
if(rb)
- check_block_inter(s, mb_x, mb_y, mvr[1][0], mvr[1][1], *obmc_edged, &best_rd);
+ check_block_inter(s, mb_x, mb_y, mvr[1][0], mvr[1][1], obmc_edged, &best_rd);
if(bb)
- check_block_inter(s, mb_x, mb_y, mvr[b_stride][0], mvr[b_stride][1], *obmc_edged, &best_rd);
+ check_block_inter(s, mb_x, mb_y, mvr[b_stride][0], mvr[b_stride][1], obmc_edged, &best_rd);
/* fullpel ME */
//FIXME avoid subpel interpolation / round to nearest integer
@@ -1177,10 +1186,10 @@ static void iterative_me(SnowContext *s){
dia_change=0;
for(i=0; i<FFMAX(s->avctx->dia_size, 1); i++){
for(j=0; j<i; j++){
- dia_change |= check_block_inter(s, mb_x, mb_y, block->mx+4*(i-j), block->my+(4*j), *obmc_edged, &best_rd);
- dia_change |= check_block_inter(s, mb_x, mb_y, block->mx-4*(i-j), block->my-(4*j), *obmc_edged, &best_rd);
- dia_change |= check_block_inter(s, mb_x, mb_y, block->mx+4*(i-j), block->my-(4*j), *obmc_edged, &best_rd);
- dia_change |= check_block_inter(s, mb_x, mb_y, block->mx-4*(i-j), block->my+(4*j), *obmc_edged, &best_rd);
+ dia_change |= check_block_inter(s, mb_x, mb_y, block->mx+4*(i-j), block->my+(4*j), obmc_edged, &best_rd);
+ dia_change |= check_block_inter(s, mb_x, mb_y, block->mx-4*(i-j), block->my-(4*j), obmc_edged, &best_rd);
+ dia_change |= check_block_inter(s, mb_x, mb_y, block->mx+4*(i-j), block->my-(4*j), obmc_edged, &best_rd);
+ dia_change |= check_block_inter(s, mb_x, mb_y, block->mx-4*(i-j), block->my+(4*j), obmc_edged, &best_rd);
}
}
}while(dia_change);
@@ -1189,7 +1198,7 @@ static void iterative_me(SnowContext *s){
static const int square[8][2]= {{+1, 0},{-1, 0},{ 0,+1},{ 0,-1},{+1,+1},{-1,-1},{+1,-1},{-1,+1},};
dia_change=0;
for(i=0; i<8; i++)
- dia_change |= check_block_inter(s, mb_x, mb_y, block->mx+square[i][0], block->my+square[i][1], *obmc_edged, &best_rd);
+ dia_change |= check_block_inter(s, mb_x, mb_y, block->mx+square[i][0], block->my+square[i][1], obmc_edged, &best_rd);
}while(dia_change);
//FIXME or try the standard 2 pass qpel or similar
@@ -1202,7 +1211,7 @@ static void iterative_me(SnowContext *s){
}
best_rd= ref_rd;
*block= ref_b;
- check_block(s, mb_x, mb_y, color, 1, *obmc_edged, &best_rd);
+ check_block(s, mb_x, mb_y, color, 1, obmc_edged, &best_rd);
//FIXME RD style color selection
if(!same_block(block, &backup)){
if(tb ) tb ->type &= ~BLOCK_OPT;
@@ -1289,7 +1298,7 @@ static void quantize(SnowContext *s, SubBand *b, IDWTELEM *dst, DWTELEM *src, in
const int w= b->width;
const int h= b->height;
const int qlog= av_clip(s->qlog + b->qlog, 0, QROOT*16);
- const int qmul= qexp[qlog&(QROOT-1)]<<((qlog>>QSHIFT) + ENCODER_EXTRA_BITS);
+ const int qmul= ff_qexp[qlog&(QROOT-1)]<<((qlog>>QSHIFT) + ENCODER_EXTRA_BITS);
int x,y, thres1, thres2;
if(s->qlog == LOSSLESS_QLOG){
@@ -1350,7 +1359,7 @@ static void dequantize(SnowContext *s, SubBand *b, IDWTELEM *src, int stride){
const int w= b->width;
const int h= b->height;
const int qlog= av_clip(s->qlog + b->qlog, 0, QROOT*16);
- const int qmul= qexp[qlog&(QROOT-1)]<<(qlog>>QSHIFT);
+ const int qmul= ff_qexp[qlog&(QROOT-1)]<<(qlog>>QSHIFT);
const int qadd= (s->qbias*qmul)>>QBIAS_SHIFT;
int x,y;
@@ -1521,7 +1530,7 @@ static void update_last_header_values(SnowContext *s){
}
static int qscale2qlog(int qscale){
- return rint(QROOT*log(qscale / (float)FF_QP2LAMBDA)/log(2))
+ return rint(QROOT*log2(qscale / (float)FF_QP2LAMBDA))
+ 61*QROOT/8; ///< 64 > 60
}
@@ -1541,7 +1550,7 @@ static int ratecontrol_1pass(SnowContext *s, AVFrame *pict)
const int h= b->height;
const int stride= b->stride;
const int qlog= av_clip(2*QROOT + b->qlog, 0, QROOT*16);
- const int qmul= qexp[qlog&(QROOT-1)]<<(qlog>>QSHIFT);
+ const int qmul= ff_qexp[qlog&(QROOT-1)]<<(qlog>>QSHIFT);
const int qdiv= (1<<16)/qmul;
int x, y;
//FIXME this is ugly
@@ -1590,7 +1599,7 @@ static void calculate_visual_weight(SnowContext *s, Plane *p){
memset(s->spatial_idwt_buffer, 0, sizeof(*s->spatial_idwt_buffer)*width*height);
ibuf[b->width/2 + b->height/2*b->stride]= 256*16;
- ff_spatial_idwt(s->spatial_idwt_buffer, width, height, width, s->spatial_decomposition_type, s->spatial_decomposition_count);
+ ff_spatial_idwt(s->spatial_idwt_buffer, s->temp_idwt_buffer, width, height, width, s->spatial_decomposition_type, s->spatial_decomposition_count);
for(y=0; y<height; y++){
for(x=0; x<width; x++){
int64_t d= s->spatial_idwt_buffer[x + y*width]*16;
@@ -1603,17 +1612,25 @@ static void calculate_visual_weight(SnowContext *s, Plane *p){
}
}
-static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size, void *data){
+static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
+ const AVFrame *pict, int *got_packet)
+{
SnowContext *s = avctx->priv_data;
RangeCoder * const c= &s->c;
- AVFrame *pict = data;
+ AVFrame *pic = &s->new_picture;
const int width= s->avctx->width;
const int height= s->avctx->height;
- int level, orientation, plane_index, i, y;
+ int level, orientation, plane_index, i, y, ret;
uint8_t rc_header_bak[sizeof(s->header_state)];
uint8_t rc_block_bak[sizeof(s->block_state)];
- ff_init_range_encoder(c, buf, buf_size);
+ if (!pkt->data &&
+ (ret = av_new_packet(pkt, s->b_width*s->b_height*MB_SIZE*MB_SIZE*3 + FF_MIN_BUFFER_SIZE)) < 0) {
+ av_log(avctx, AV_LOG_ERROR, "Error getting output packet.\n");
+ return ret;
+ }
+
+ ff_init_range_encoder(c, pkt->data, pkt->size);
ff_build_rac_states(c, 0.05*(1LL<<32), 256-8);
for(i=0; i<3; i++){
@@ -1627,27 +1644,25 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size,
s->m.picture_number= avctx->frame_number;
if(avctx->flags&CODEC_FLAG_PASS2){
- s->m.pict_type =
- pict->pict_type= s->m.rc_context.entry[avctx->frame_number].new_pict_type;
- s->keyframe= pict->pict_type==AV_PICTURE_TYPE_I;
+ s->m.pict_type = pic->pict_type = s->m.rc_context.entry[avctx->frame_number].new_pict_type;
+ s->keyframe = pic->pict_type == AV_PICTURE_TYPE_I;
if(!(avctx->flags&CODEC_FLAG_QSCALE)) {
- pict->quality= ff_rate_estimate_qscale(&s->m, 0);
- if (pict->quality < 0)
+ pic->quality = ff_rate_estimate_qscale(&s->m, 0);
+ if (pic->quality < 0)
return -1;
}
}else{
s->keyframe= avctx->gop_size==0 || avctx->frame_number % avctx->gop_size == 0;
- s->m.pict_type=
- pict->pict_type= s->keyframe ? AV_PICTURE_TYPE_I : AV_PICTURE_TYPE_P;
+ s->m.pict_type = pic->pict_type = s->keyframe ? AV_PICTURE_TYPE_I : AV_PICTURE_TYPE_P;
}
if(s->pass1_rc && avctx->frame_number == 0)
- pict->quality= 2*FF_QP2LAMBDA;
- if(pict->quality){
- s->qlog= qscale2qlog(pict->quality);
- s->lambda = pict->quality * 3/2;
+ pic->quality = 2*FF_QP2LAMBDA;
+ if (pic->quality) {
+ s->qlog = qscale2qlog(pic->quality);
+ s->lambda = pic->quality * 3/2;
}
- if(s->qlog < 0 || (!pict->quality && (avctx->flags & CODEC_FLAG_QSCALE))){
+ if (s->qlog < 0 || (!pic->quality && (avctx->flags & CODEC_FLAG_QSCALE))) {
s->qlog= LOSSLESS_QLOG;
s->lambda = 0;
}//else keep previous frame's qlog until after motion estimation
@@ -1657,7 +1672,7 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size,
s->m.current_picture_ptr= &s->m.current_picture;
s->m.last_picture.f.pts = s->m.current_picture.f.pts;
s->m.current_picture.f.pts = pict->pts;
- if(pict->pict_type == AV_PICTURE_TYPE_P){
+ if(pic->pict_type == AV_PICTURE_TYPE_P){
int block_width = (width +15)>>4;
int block_height= (height+15)>>4;
int stride= s->current_picture.linesize[0];
@@ -1682,7 +1697,7 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size,
s->m.mb_stride= s->m.mb_width+1;
s->m.b8_stride= 2*s->m.mb_width+1;
s->m.f_code=1;
- s->m.pict_type= pict->pict_type;
+ s->m.pict_type = pic->pict_type;
s->m.me_method= s->avctx->me_method;
s->m.me.scene_change_score=0;
s->m.flags= s->avctx->flags;
@@ -1706,13 +1721,13 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size,
redo_frame:
- if(pict->pict_type == AV_PICTURE_TYPE_I)
+ if (pic->pict_type == AV_PICTURE_TYPE_I)
s->spatial_decomposition_count= 5;
else
s->spatial_decomposition_count= 5;
- s->m.pict_type = pict->pict_type;
- s->qbias= pict->pict_type == AV_PICTURE_TYPE_P ? 2 : 0;
+ s->m.pict_type = pic->pict_type;
+ s->qbias = pic->pict_type == AV_PICTURE_TYPE_P ? 2 : 0;
ff_snow_common_init_after_header(avctx);
@@ -1745,12 +1760,12 @@ redo_frame:
predict_plane(s, s->spatial_idwt_buffer, plane_index, 0);
if( plane_index==0
- && pict->pict_type == AV_PICTURE_TYPE_P
+ && pic->pict_type == AV_PICTURE_TYPE_P
&& !(avctx->flags&CODEC_FLAG_PASS2)
&& s->m.me.scene_change_score > s->avctx->scenechange_threshold){
- ff_init_range_encoder(c, buf, buf_size);
+ ff_init_range_encoder(c, pkt->data, pkt->size);
ff_build_rac_states(c, 0.05*(1LL<<32), 256-8);
- pict->pict_type= AV_PICTURE_TYPE_I;
+ pic->pict_type= AV_PICTURE_TYPE_I;
s->keyframe=1;
s->current_picture.key_frame=1;
goto redo_frame;
@@ -1773,15 +1788,15 @@ redo_frame:
/* if(QUANTIZE2)
dwt_quantize(s, p, s->spatial_dwt_buffer, w, h, w, s->spatial_decomposition_type);
else*/
- ff_spatial_dwt(s->spatial_dwt_buffer, w, h, w, s->spatial_decomposition_type, s->spatial_decomposition_count);
+ ff_spatial_dwt(s->spatial_dwt_buffer, s->temp_dwt_buffer, w, h, w, s->spatial_decomposition_type, s->spatial_decomposition_count);
if(s->pass1_rc && plane_index==0){
- int delta_qlog = ratecontrol_1pass(s, pict);
+ int delta_qlog = ratecontrol_1pass(s, pic);
if (delta_qlog <= INT_MIN)
return -1;
if(delta_qlog){
//reordering qlog in the bitstream would eliminate this reset
- ff_init_range_encoder(c, buf, buf_size);
+ ff_init_range_encoder(c, pkt->data, pkt->size);
memcpy(s->header_state, rc_header_bak, sizeof(s->header_state));
memcpy(s->block_state, rc_block_bak, sizeof(s->block_state));
encode_header(s);
@@ -1796,7 +1811,7 @@ redo_frame:
if(!QUANTIZE2)
quantize(s, b, b->ibuf, b->buf, b->stride, s->qbias);
if(orientation==0)
- decorrelate(s, b, b->ibuf, b->stride, pict->pict_type == AV_PICTURE_TYPE_P, 0);
+ decorrelate(s, b, b->ibuf, b->stride, pic->pict_type == AV_PICTURE_TYPE_P, 0);
encode_subband(s, b, b->ibuf, b->parent ? b->parent->ibuf : NULL, b->stride, orientation);
assert(b->parent==NULL || b->parent->stride == b->stride*2);
if(orientation==0)
@@ -1812,7 +1827,7 @@ redo_frame:
}
}
- ff_spatial_idwt(s->spatial_idwt_buffer, w, h, w, s->spatial_decomposition_type, s->spatial_decomposition_count);
+ ff_spatial_idwt(s->spatial_idwt_buffer, s->temp_idwt_buffer, w, h, w, s->spatial_decomposition_type, s->spatial_decomposition_count);
if(s->qlog == LOSSLESS_QLOG){
for(y=0; y<h; y++){
for(x=0; x<w; x++){
@@ -1823,7 +1838,7 @@ redo_frame:
predict_plane(s, s->spatial_idwt_buffer, plane_index, 1);
}else{
//ME/MC only
- if(pict->pict_type == AV_PICTURE_TYPE_I){
+ if(pic->pict_type == AV_PICTURE_TYPE_I){
for(y=0; y<h; y++){
for(x=0; x<w; x++){
s->current_picture.data[plane_index][y*s->current_picture.linesize[plane_index] + x]=
@@ -1862,7 +1877,7 @@ redo_frame:
s->m.p_tex_bits = s->m.frame_bits - s->m.misc_bits - s->m.mv_bits;
s->m.current_picture.f.display_picture_number =
s->m.current_picture.f.coded_picture_number = avctx->frame_number;
- s->m.current_picture.f.quality = pict->quality;
+ s->m.current_picture.f.quality = pic->quality;
s->m.total_bits += 8*(s->c.bytestream - s->c.bytestream_start);
if(s->pass1_rc)
if (ff_rate_estimate_qscale(&s->m, 0) < 0)
@@ -1877,7 +1892,12 @@ redo_frame:
emms_c();
- return ff_rac_terminate(c);
+ pkt->size = ff_rac_terminate(c);
+ if (avctx->coded_frame->key_frame)
+ pkt->flags |= AV_PKT_FLAG_KEY;
+ *got_packet = 1;
+
+ return 0;
}
static av_cold int encode_end(AVCodecContext *avctx)
@@ -1895,7 +1915,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), AV_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, { .i64 = 0 }, 0, 1, VE },
{ NULL },
};
@@ -1909,12 +1929,11 @@ static const AVClass snowenc_class = {
AVCodec ff_snow_encoder = {
.name = "snow",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_SNOW,
+ .id = AV_CODEC_ID_SNOW,
.priv_data_size = sizeof(SnowContext),
.init = encode_init,
- .encode = encode_frame,
+ .encode2 = encode_frame,
.close = encode_end,
- .long_name = NULL_IF_CONFIG_SMALL("Snow"),
+ .long_name = NULL_IF_CONFIG_SMALL("Snow"),
.priv_class = &snowenc_class,
};
-#endif
diff --git a/gst-libs/ext/libav/libavcodec/sp5xdec.c b/gst-libs/ext/libav/libavcodec/sp5xdec.c
index 4c42ab1..90c3491 100644
--- a/gst-libs/ext/libav/libavcodec/sp5xdec.c
+++ b/gst-libs/ext/libav/libavcodec/sp5xdec.c
@@ -31,7 +31,7 @@
static int sp5x_decode_frame(AVCodecContext *avctx,
- void *data, int *data_size,
+ void *data, int *got_frame,
AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
@@ -68,7 +68,7 @@ static int sp5x_decode_frame(AVCodecContext *avctx,
memcpy(recoded+j, &sp5x_data_sos[0], sizeof(sp5x_data_sos));
j += sizeof(sp5x_data_sos);
- if(avctx->codec_id==CODEC_ID_AMV)
+ if(avctx->codec_id==AV_CODEC_ID_AMV)
for (i = 2; i < buf_size-2 && j < buf_size+1024-2; i++)
recoded[j++] = buf[i];
else
@@ -86,7 +86,7 @@ static int sp5x_decode_frame(AVCodecContext *avctx,
av_init_packet(&avpkt_recoded);
avpkt_recoded.data = recoded;
avpkt_recoded.size = j;
- i = ff_mjpeg_decode_frame(avctx, data, data_size, &avpkt_recoded);
+ i = ff_mjpeg_decode_frame(avctx, data, got_frame, &avpkt_recoded);
av_free(recoded);
@@ -96,23 +96,22 @@ static int sp5x_decode_frame(AVCodecContext *avctx,
AVCodec ff_sp5x_decoder = {
.name = "sp5x",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_SP5X,
+ .id = AV_CODEC_ID_SP5X,
.priv_data_size = sizeof(MJpegDecodeContext),
.init = ff_mjpeg_decode_init,
.close = ff_mjpeg_decode_end,
.decode = sp5x_decode_frame,
.capabilities = CODEC_CAP_DR1,
- .max_lowres = 3,
- .long_name = NULL_IF_CONFIG_SMALL("Sunplus JPEG (SP5X)"),
+ .long_name = NULL_IF_CONFIG_SMALL("Sunplus JPEG (SP5X)"),
};
AVCodec ff_amv_decoder = {
.name = "amv",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_AMV,
+ .id = AV_CODEC_ID_AMV,
.priv_data_size = sizeof(MJpegDecodeContext),
.init = ff_mjpeg_decode_init,
.close = ff_mjpeg_decode_end,
.decode = sp5x_decode_frame,
- .long_name = NULL_IF_CONFIG_SMALL("AMV Video"),
+ .long_name = NULL_IF_CONFIG_SMALL("AMV Video"),
};
diff --git a/gst-libs/ext/libav/libavcodec/sparc/Makefile b/gst-libs/ext/libav/libavcodec/sparc/Makefile
index 4b38746..1b6ac81 100644
--- a/gst-libs/ext/libav/libavcodec/sparc/Makefile
+++ b/gst-libs/ext/libav/libavcodec/sparc/Makefile
@@ -1,2 +1,2 @@
-OBJS-$(HAVE_VIS) += sparc/dsputil_vis.o \
- sparc/simple_idct_vis.o \
+VIS-OBJS += sparc/dsputil_vis.o \
+ sparc/simple_idct_vis.o \
diff --git a/gst-libs/ext/libav/libavcodec/sparc/dsputil_vis.c b/gst-libs/ext/libav/libavcodec/sparc/dsputil_vis.c
index 5a9fbc2..5bac83e 100644
--- a/gst-libs/ext/libav/libavcodec/sparc/dsputil_vis.c
+++ b/gst-libs/ext/libav/libavcodec/sparc/dsputil_vis.c
@@ -27,6 +27,7 @@
#include <inttypes.h>
#include "libavcodec/dsputil.h"
+#include "libavutil/mem.h"
#include "dsputil_vis.h"
#include "vis.h"
@@ -3949,7 +3950,7 @@ static int vis_level(void)
}
/* libavcodec initialization code */
-void dsputil_init_vis(DSPContext* c, AVCodecContext *avctx)
+void ff_dsputil_init_vis(DSPContext* c, AVCodecContext *avctx)
{
/* VIS-specific optimizations */
int accel = vis_level ();
diff --git a/gst-libs/ext/libav/libavcodec/sparc/simple_idct_vis.c b/gst-libs/ext/libav/libavcodec/sparc/simple_idct_vis.c
index f9fcf80..43a898a 100644
--- a/gst-libs/ext/libav/libavcodec/sparc/simple_idct_vis.c
+++ b/gst-libs/ext/libav/libavcodec/sparc/simple_idct_vis.c
@@ -22,8 +22,11 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <stdint.h>
+
#include "libavcodec/dsputil.h"
#include "dsputil_vis.h"
+#include "libavutil/mem.h"
static const DECLARE_ALIGNED(8, int16_t, coeffs)[28] = {
- 1259,- 1259,- 1259,- 1259,
diff --git a/gst-libs/ext/libav/libavcodec/srtdec.c b/gst-libs/ext/libav/libavcodec/srtdec.c
index 99cbd94..bbc8061 100644
--- a/gst-libs/ext/libav/libavcodec/srtdec.c
+++ b/gst-libs/ext/libav/libavcodec/srtdec.c
@@ -20,6 +20,7 @@
*/
#include "libavutil/avstring.h"
+#include "libavutil/common.h"
#include "libavutil/parseutils.h"
#include "avcodec.h"
#include "ass.h"
@@ -235,7 +236,7 @@ AVCodec ff_srt_decoder = {
.name = "srt",
.long_name = NULL_IF_CONFIG_SMALL("SubRip subtitle"),
.type = AVMEDIA_TYPE_SUBTITLE,
- .id = CODEC_ID_SRT,
+ .id = AV_CODEC_ID_SRT,
.init = ff_ass_subtitle_header_default,
.decode = srt_decode_frame,
};
diff --git a/gst-libs/ext/libav/libavcodec/sunrast.c b/gst-libs/ext/libav/libavcodec/sunrast.c
index 455619e..a44cdf0 100644
--- a/gst-libs/ext/libav/libavcodec/sunrast.c
+++ b/gst-libs/ext/libav/libavcodec/sunrast.c
@@ -19,16 +19,12 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "libavutil/common.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/imgutils.h"
#include "avcodec.h"
-
-#define RT_OLD 0
-#define RT_STANDARD 1
-#define RT_BYTE_ENCODED 2
-#define RT_FORMAT_RGB 3
-#define RT_FORMAT_TIFF 4
-#define RT_FORMAT_IFF 5
+#include "internal.h"
+#include "sunrast.h"
typedef struct SUNRASTContext {
AVFrame picture;
@@ -38,69 +34,75 @@ static av_cold int sunrast_init(AVCodecContext *avctx) {
SUNRASTContext *s = avctx->priv_data;
avcodec_get_frame_defaults(&s->picture);
- avctx->coded_frame= &s->picture;
+ avctx->coded_frame = &s->picture;
return 0;
}
static int sunrast_decode_frame(AVCodecContext *avctx, void *data,
- int *data_size, AVPacket *avpkt) {
- const uint8_t *buf = avpkt->data;
- const uint8_t *buf_end = avpkt->data + avpkt->size;
+ int *got_frame, AVPacket *avpkt)
+{
+ const uint8_t *buf = avpkt->data;
+ const uint8_t *buf_end = avpkt->data + avpkt->size;
SUNRASTContext * const s = avctx->priv_data;
- AVFrame *picture = data;
- AVFrame * const p = &s->picture;
+ AVFrame *picture = data;
+ AVFrame * const p = &s->picture;
unsigned int w, h, depth, type, maptype, maplength, stride, x, y, len, alen;
uint8_t *ptr;
const uint8_t *bufstart = buf;
+ int ret;
if (avpkt->size < 32)
return AVERROR_INVALIDDATA;
- if (AV_RB32(buf) != 0x59a66a95) {
+ if (AV_RB32(buf) != RAS_MAGIC) {
av_log(avctx, AV_LOG_ERROR, "this is not sunras encoded data\n");
- return -1;
+ return AVERROR_INVALIDDATA;
}
- w = AV_RB32(buf+4);
- h = AV_RB32(buf+8);
- depth = AV_RB32(buf+12);
- type = AV_RB32(buf+20);
- maptype = AV_RB32(buf+24);
- maplength = AV_RB32(buf+28);
+ w = AV_RB32(buf + 4);
+ h = AV_RB32(buf + 8);
+ depth = AV_RB32(buf + 12);
+ type = AV_RB32(buf + 20);
+ maptype = AV_RB32(buf + 24);
+ maplength = AV_RB32(buf + 28);
buf += 32;
- if (type == RT_FORMAT_TIFF || type == RT_FORMAT_IFF) {
- av_log(avctx, AV_LOG_ERROR, "unsupported (compression) type\n");
- return -1;
+ if (type == RT_FORMAT_TIFF || type == RT_FORMAT_IFF || type == RT_EXPERIMENTAL) {
+ av_log_ask_for_sample(avctx, "unsupported (compression) type\n");
+ return AVERROR_PATCHWELCOME;
}
- if (type < RT_OLD || type > RT_FORMAT_IFF) {
+ if (type > RT_FORMAT_IFF) {
av_log(avctx, AV_LOG_ERROR, "invalid (compression) type\n");
- return -1;
+ return AVERROR_INVALIDDATA;
}
if (av_image_check_size(w, h, 0, avctx)) {
av_log(avctx, AV_LOG_ERROR, "invalid image size\n");
- return -1;
+ return AVERROR_INVALIDDATA;
}
- if (maptype & ~1) {
+ if (maptype == RMT_RAW) {
+ av_log_ask_for_sample(avctx, "unsupported colormap type\n");
+ return AVERROR_PATCHWELCOME;
+ }
+ if (maptype > RMT_RAW) {
av_log(avctx, AV_LOG_ERROR, "invalid colormap type\n");
- return -1;
+ return AVERROR_INVALIDDATA;
}
switch (depth) {
case 1:
- avctx->pix_fmt = PIX_FMT_MONOWHITE;
+ avctx->pix_fmt = AV_PIX_FMT_MONOWHITE;
break;
case 8:
- avctx->pix_fmt = PIX_FMT_PAL8;
+ avctx->pix_fmt = maplength ? AV_PIX_FMT_PAL8 : AV_PIX_FMT_GRAY8;
break;
case 24:
- avctx->pix_fmt = (type == RT_FORMAT_RGB) ? PIX_FMT_RGB24 : PIX_FMT_BGR24;
+ avctx->pix_fmt = (type == RT_FORMAT_RGB) ? AV_PIX_FMT_RGB24 : AV_PIX_FMT_BGR24;
break;
default:
av_log(avctx, AV_LOG_ERROR, "invalid depth\n");
- return -1;
+ return AVERROR_INVALIDDATA;
}
if (p->data[0])
@@ -108,9 +110,9 @@ static int sunrast_decode_frame(AVCodecContext *avctx, void *data,
if (w != avctx->width || h != avctx->height)
avcodec_set_dimensions(avctx, w, h);
- if (avctx->get_buffer(avctx, p) < 0) {
+ if ((ret = ff_get_buffer(avctx, p)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
- return -1;
+ return ret;
}
p->pict_type = AV_PICTURE_TYPE_I;
@@ -121,21 +123,17 @@ static int sunrast_decode_frame(AVCodecContext *avctx, void *data,
if (depth != 8 && maplength) {
av_log(avctx, AV_LOG_WARNING, "useless colormap found or file is corrupted, trying to recover\n");
- } else if (depth == 8) {
+ } else if (maplength) {
unsigned int len = maplength / 3;
- if (!maplength) {
- av_log(avctx, AV_LOG_ERROR, "colormap expected\n");
- return -1;
- }
if (maplength % 3 || maplength > 768) {
av_log(avctx, AV_LOG_WARNING, "invalid colormap length\n");
- return -1;
+ return AVERROR_INVALIDDATA;
}
ptr = p->data[1];
- for (x=0; x<len; x++, ptr+=4)
- *(uint32_t *)ptr = (buf[x]<<16) + (buf[len+x]<<8) + buf[len+len+x];
+ for (x = 0; x < len; x++, ptr += 4)
+ *(uint32_t *)ptr = (buf[x] << 16) + (buf[len + x] << 8) + buf[len + len + x];
}
buf += maplength;
@@ -145,11 +143,11 @@ static int sunrast_decode_frame(AVCodecContext *avctx, void *data,
/* scanlines are aligned on 16 bit boundaries */
len = (depth * w + 7) >> 3;
- alen = len + (len&1);
+ alen = len + (len & 1);
if (type == RT_BYTE_ENCODED) {
int value, run;
- uint8_t *end = ptr + h*stride;
+ uint8_t *end = ptr + h * stride;
x = 0;
while (ptr != end && buf < buf_end) {
@@ -157,7 +155,7 @@ static int sunrast_decode_frame(AVCodecContext *avctx, void *data,
if (buf_end - buf < 1)
return AVERROR_INVALIDDATA;
- if ((value = *buf++) == 0x80) {
+ if ((value = *buf++) == RLE_TRIGGER) {
run = *buf++ + 1;
if (run != 1)
value = *buf++;
@@ -174,7 +172,7 @@ static int sunrast_decode_frame(AVCodecContext *avctx, void *data,
}
}
} else {
- for (y=0; y<h; y++) {
+ for (y = 0; y < h; y++) {
if (buf_end - buf < len)
break;
memcpy(ptr, buf, len);
@@ -183,8 +181,8 @@ static int sunrast_decode_frame(AVCodecContext *avctx, void *data,
}
}
- *picture = s->picture;
- *data_size = sizeof(AVFrame);
+ *picture = s->picture;
+ *got_frame = 1;
return buf - bufstart;
}
@@ -201,11 +199,11 @@ static av_cold int sunrast_end(AVCodecContext *avctx) {
AVCodec ff_sunrast_decoder = {
.name = "sunrast",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_SUNRAST,
+ .id = AV_CODEC_ID_SUNRAST,
.priv_data_size = sizeof(SUNRASTContext),
.init = sunrast_init,
.close = sunrast_end,
.decode = sunrast_decode_frame,
.capabilities = CODEC_CAP_DR1,
- .long_name = NULL_IF_CONFIG_SMALL("Sun Rasterfile image"),
+ .long_name = NULL_IF_CONFIG_SMALL("Sun Rasterfile image"),
};
diff --git a/gst-libs/ext/libav/libavcodec/sunrast.h b/gst-libs/ext/libav/libavcodec/sunrast.h
new file mode 100644
index 0000000..d9fe307
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/sunrast.h
@@ -0,0 +1,56 @@
+/*
+ * Sun Rasterfile Image Format
+ * Copyright (c) 2007, 2008 Ivo van Poorten
+ *
+ * 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
+ */
+
+#ifndef AVCODEC_SUNRAST_H
+#define AVCODEC_SUNRAST_H
+
+#define RAS_MAGIC 0x59a66a95
+
+#define RMT_NONE 0
+#define RMT_EQUAL_RGB 1
+#define RMT_RAW 2 ///< the data layout of this map type is unknown
+
+/* The Old and Standard format types indicate that the image data is
+ * uncompressed. There is no difference between the two formats. */
+#define RT_OLD 0
+#define RT_STANDARD 1
+
+/* The Byte-Encoded format type indicates that the image data is compressed
+ * using a run-length encoding scheme. */
+#define RT_BYTE_ENCODED 2
+#define RLE_TRIGGER 0x80
+
+/* The RGB format type indicates that the image is uncompressed with reverse
+ * component order from Old and Standard (RGB vs BGR). */
+#define RT_FORMAT_RGB 3
+
+/* The TIFF and IFF format types indicate that the raster file was originally
+ * converted from either of these file formats. We do not have any samples or
+ * documentation of the format details. */
+#define RT_FORMAT_TIFF 4
+#define RT_FORMAT_IFF 5
+
+/* The Experimental format type is implementation-specific and is generally an
+ * indication that the image file does not conform to the Sun Raster file
+ * format specification. */
+#define RT_EXPERIMENTAL 0xffff
+
+#endif /* AVCODEC_SUNRAST_H */
diff --git a/gst-libs/ext/libav/libavcodec/sunrastenc.c b/gst-libs/ext/libav/libavcodec/sunrastenc.c
new file mode 100644
index 0000000..e1b5211
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/sunrastenc.c
@@ -0,0 +1,229 @@
+/*
+ * Sun Rasterfile (.sun/.ras/im{1,8,24}/.sunras) image encoder
+ * Copyright (c) 2012 Aneesh Dogra (lionaneesh) <lionaneesh@gmail.com>
+ *
+ * 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
+ */
+
+#include "avcodec.h"
+#include "bytestream.h"
+#include "internal.h"
+#include "sunrast.h"
+
+typedef struct SUNRASTContext {
+ AVFrame picture;
+ PutByteContext p;
+ int depth; ///< depth of pixel
+ int length; ///< length (bytes) of image
+ int type; ///< type of file
+ int maptype; ///< type of colormap
+ int maplength; ///< length (bytes) of colormap
+ int size;
+} SUNRASTContext;
+
+static void sunrast_image_write_header(AVCodecContext *avctx)
+{
+ SUNRASTContext *s = avctx->priv_data;
+
+ bytestream2_put_be32u(&s->p, RAS_MAGIC);
+ bytestream2_put_be32u(&s->p, avctx->width);
+ bytestream2_put_be32u(&s->p, avctx->height);
+ bytestream2_put_be32u(&s->p, s->depth);
+ bytestream2_put_be32u(&s->p, s->length);
+ bytestream2_put_be32u(&s->p, s->type);
+ bytestream2_put_be32u(&s->p, s->maptype);
+ bytestream2_put_be32u(&s->p, s->maplength);
+}
+
+static void sunrast_image_write_image(AVCodecContext *avctx,
+ const uint8_t *pixels,
+ const uint32_t *palette_data,
+ int linesize)
+{
+ SUNRASTContext *s = avctx->priv_data;
+ const uint8_t *ptr;
+ int len, alen, x;
+
+ if (s->maplength) { // palettized
+ PutByteContext pb_r, pb_g;
+ int len = s->maplength / 3;
+
+ pb_r = s->p;
+ bytestream2_skip_p(&s->p, len);
+ pb_g = s->p;
+ bytestream2_skip_p(&s->p, len);
+
+ for (x = 0; x < len; x++) {
+ uint32_t pixel = palette_data[x];
+
+ bytestream2_put_byteu(&pb_r, (pixel >> 16) & 0xFF);
+ bytestream2_put_byteu(&pb_g, (pixel >> 8) & 0xFF);
+ bytestream2_put_byteu(&s->p, pixel & 0xFF);
+ }
+ }
+
+ len = (s->depth * avctx->width + 7) >> 3;
+ alen = len + (len & 1);
+ ptr = pixels;
+
+ if (s->type == RT_BYTE_ENCODED) {
+ uint8_t value, value2;
+ int run;
+ const uint8_t *start = linesize < 0 ? pixels + (avctx->height - 1) * linesize
+ : pixels;
+ const uint8_t *end = linesize < 0 ? pixels - linesize
+ : pixels + avctx->height * linesize;
+
+ ptr = pixels;
+
+#define GET_VALUE ptr >= end || ptr < start ? 0 : x >= len ? ptr[len-1] : ptr[x]
+
+ x = 0;
+ value2 = GET_VALUE;
+ while (ptr < end && ptr >= start) {
+ run = 1;
+ value = value2;
+ x++;
+ if (x >= alen) {
+ x = 0;
+ ptr += linesize;
+ }
+
+ value2 = GET_VALUE;
+ while (value2 == value && run < 256 && ptr < end && ptr >= start) {
+ x++;
+ run++;
+ if (x >= alen) {
+ x = 0;
+ ptr += linesize;
+ }
+ value2 = GET_VALUE;
+ }
+
+ if (run > 2 || value == RLE_TRIGGER) {
+ bytestream2_put_byteu(&s->p, RLE_TRIGGER);
+ bytestream2_put_byteu(&s->p, run - 1);
+ if (run > 1)
+ bytestream2_put_byteu(&s->p, value);
+ } else if (run == 1) {
+ bytestream2_put_byteu(&s->p, value);
+ } else
+ bytestream2_put_be16u(&s->p, (value << 8) | value);
+ }
+
+ // update data length for header
+ s->length = bytestream2_tell_p(&s->p) - 32 - s->maplength;
+ } else {
+ int y;
+ for (y = 0; y < avctx->height; y++) {
+ bytestream2_put_buffer(&s->p, ptr, len);
+ if (len < alen)
+ bytestream2_put_byteu(&s->p, 0);
+ ptr += linesize;
+ }
+ }
+}
+
+static av_cold int sunrast_encode_init(AVCodecContext *avctx)
+{
+ SUNRASTContext *s = avctx->priv_data;
+
+ switch (avctx->coder_type) {
+ case FF_CODER_TYPE_RLE:
+ s->type = RT_BYTE_ENCODED;
+ break;
+ case FF_CODER_TYPE_RAW:
+ s->type = RT_STANDARD;
+ break;
+ default:
+ av_log(avctx, AV_LOG_ERROR, "invalid coder_type\n");
+ return AVERROR(EINVAL);
+ }
+
+ avctx->coded_frame = &s->picture;
+ avctx->coded_frame->key_frame = 1;
+ avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I;
+ s->maptype = RMT_NONE;
+ s->maplength = 0;
+
+ switch (avctx->pix_fmt) {
+ case AV_PIX_FMT_MONOWHITE:
+ s->depth = 1;
+ break;
+ case AV_PIX_FMT_PAL8 :
+ s->maptype = RMT_EQUAL_RGB;
+ s->maplength = 3 * 256;
+ case AV_PIX_FMT_GRAY8:
+ s->depth = 8;
+ break;
+ case AV_PIX_FMT_BGR24:
+ s->depth = 24;
+ break;
+ default:
+ return AVERROR_BUG;
+ }
+ s->length = avctx->height * (FFALIGN(avctx->width * s->depth, 16) >> 3);
+ s->size = 32 + s->maplength +
+ s->length * (s->type == RT_BYTE_ENCODED ? 2 : 1);
+
+ return 0;
+}
+
+static int sunrast_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
+ const AVFrame *frame, int *got_packet_ptr)
+{
+ SUNRASTContext *s = avctx->priv_data;
+ int ret;
+
+ if ((ret = ff_alloc_packet(avpkt, s->size)) < 0)
+ return ret;
+
+ bytestream2_init_writer(&s->p, avpkt->data, avpkt->size);
+ sunrast_image_write_header(avctx);
+ sunrast_image_write_image(avctx, frame->data[0],
+ (const uint32_t *)frame->data[1],
+ frame->linesize[0]);
+ // update data length in header after RLE
+ if (s->type == RT_BYTE_ENCODED)
+ AV_WB32(&avpkt->data[16], s->length);
+
+ *got_packet_ptr = 1;
+ avpkt->flags |= AV_PKT_FLAG_KEY;
+ avpkt->size = bytestream2_tell_p(&s->p);
+ return 0;
+}
+
+static const AVCodecDefault sunrast_defaults[] = {
+ { "coder", "rle" },
+ { NULL },
+};
+
+AVCodec ff_sunrast_encoder = {
+ .name = "sunrast",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .id = AV_CODEC_ID_SUNRAST,
+ .priv_data_size = sizeof(SUNRASTContext),
+ .init = sunrast_encode_init,
+ .encode2 = sunrast_encode_frame,
+ .defaults = sunrast_defaults,
+ .pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_BGR24,
+ AV_PIX_FMT_PAL8,
+ AV_PIX_FMT_GRAY8,
+ AV_PIX_FMT_MONOWHITE,
+ AV_PIX_FMT_NONE },
+ .long_name = NULL_IF_CONFIG_SMALL("Sun Rasterfile image"),
+};
diff --git a/gst-libs/ext/libav/libavcodec/svq1.c b/gst-libs/ext/libav/libavcodec/svq1.c
index b7e3af0..e20fa43 100644
--- a/gst-libs/ext/libav/libavcodec/svq1.c
+++ b/gst-libs/ext/libav/libavcodec/svq1.c
@@ -38,6 +38,6 @@
/* standard video sizes */
const struct svq1_frame_size ff_svq1_frame_size_table[7] = {
- { 160, 120 }, { 128, 96 }, { 176, 144 }, { 352, 288 },
- { 704, 576 }, { 240, 180 }, { 320, 240 }
+ { 160, 120 }, { 128, 96 }, { 176, 144 }, { 352, 288 },
+ { 704, 576 }, { 240, 180 }, { 320, 240 }
};
diff --git a/gst-libs/ext/libav/libavcodec/svq1.h b/gst-libs/ext/libav/libavcodec/svq1.h
index 066ea47..b2055fa 100644
--- a/gst-libs/ext/libav/libavcodec/svq1.h
+++ b/gst-libs/ext/libav/libavcodec/svq1.h
@@ -47,11 +47,11 @@ struct svq1_frame_size {
uint16_t height;
};
-uint16_t ff_svq1_packet_checksum (const uint8_t *data, const int length,
- int value);
+uint16_t ff_svq1_packet_checksum(const uint8_t *data,
+ const int length, int value);
-extern const int8_t* const ff_svq1_inter_codebooks[6];
-extern const int8_t* const ff_svq1_intra_codebooks[6];
+extern const int8_t *const ff_svq1_inter_codebooks[6];
+extern const int8_t *const ff_svq1_intra_codebooks[6];
extern const uint8_t ff_svq1_block_type_vlc[4][2];
extern const uint8_t ff_svq1_intra_multistage_vlc[6][8][2];
diff --git a/gst-libs/ext/libav/libavcodec/svq13.c b/gst-libs/ext/libav/libavcodec/svq13.c
new file mode 100644
index 0000000..e0d2154
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/svq13.c
@@ -0,0 +1,69 @@
+/*
+ * SVQ1/SVQ3 decoder common code
+ *
+ * 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
+ */
+
+#include <stdint.h>
+
+#include "svq1.h"
+
+static const uint16_t checksum_table[256] = {
+ 0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50A5, 0x60C6, 0x70E7,
+ 0x8108, 0x9129, 0xA14A, 0xB16B, 0xC18C, 0xD1AD, 0xE1CE, 0xF1EF,
+ 0x1231, 0x0210, 0x3273, 0x2252, 0x52B5, 0x4294, 0x72F7, 0x62D6,
+ 0x9339, 0x8318, 0xB37B, 0xA35A, 0xD3BD, 0xC39C, 0xF3FF, 0xE3DE,
+ 0x2462, 0x3443, 0x0420, 0x1401, 0x64E6, 0x74C7, 0x44A4, 0x5485,
+ 0xA56A, 0xB54B, 0x8528, 0x9509, 0xE5EE, 0xF5CF, 0xC5AC, 0xD58D,
+ 0x3653, 0x2672, 0x1611, 0x0630, 0x76D7, 0x66F6, 0x5695, 0x46B4,
+ 0xB75B, 0xA77A, 0x9719, 0x8738, 0xF7DF, 0xE7FE, 0xD79D, 0xC7BC,
+ 0x48C4, 0x58E5, 0x6886, 0x78A7, 0x0840, 0x1861, 0x2802, 0x3823,
+ 0xC9CC, 0xD9ED, 0xE98E, 0xF9AF, 0x8948, 0x9969, 0xA90A, 0xB92B,
+ 0x5AF5, 0x4AD4, 0x7AB7, 0x6A96, 0x1A71, 0x0A50, 0x3A33, 0x2A12,
+ 0xDBFD, 0xCBDC, 0xFBBF, 0xEB9E, 0x9B79, 0x8B58, 0xBB3B, 0xAB1A,
+ 0x6CA6, 0x7C87, 0x4CE4, 0x5CC5, 0x2C22, 0x3C03, 0x0C60, 0x1C41,
+ 0xEDAE, 0xFD8F, 0xCDEC, 0xDDCD, 0xAD2A, 0xBD0B, 0x8D68, 0x9D49,
+ 0x7E97, 0x6EB6, 0x5ED5, 0x4EF4, 0x3E13, 0x2E32, 0x1E51, 0x0E70,
+ 0xFF9F, 0xEFBE, 0xDFDD, 0xCFFC, 0xBF1B, 0xAF3A, 0x9F59, 0x8F78,
+ 0x9188, 0x81A9, 0xB1CA, 0xA1EB, 0xD10C, 0xC12D, 0xF14E, 0xE16F,
+ 0x1080, 0x00A1, 0x30C2, 0x20E3, 0x5004, 0x4025, 0x7046, 0x6067,
+ 0x83B9, 0x9398, 0xA3FB, 0xB3DA, 0xC33D, 0xD31C, 0xE37F, 0xF35E,
+ 0x02B1, 0x1290, 0x22F3, 0x32D2, 0x4235, 0x5214, 0x6277, 0x7256,
+ 0xB5EA, 0xA5CB, 0x95A8, 0x8589, 0xF56E, 0xE54F, 0xD52C, 0xC50D,
+ 0x34E2, 0x24C3, 0x14A0, 0x0481, 0x7466, 0x6447, 0x5424, 0x4405,
+ 0xA7DB, 0xB7FA, 0x8799, 0x97B8, 0xE75F, 0xF77E, 0xC71D, 0xD73C,
+ 0x26D3, 0x36F2, 0x0691, 0x16B0, 0x6657, 0x7676, 0x4615, 0x5634,
+ 0xD94C, 0xC96D, 0xF90E, 0xE92F, 0x99C8, 0x89E9, 0xB98A, 0xA9AB,
+ 0x5844, 0x4865, 0x7806, 0x6827, 0x18C0, 0x08E1, 0x3882, 0x28A3,
+ 0xCB7D, 0xDB5C, 0xEB3F, 0xFB1E, 0x8BF9, 0x9BD8, 0xABBB, 0xBB9A,
+ 0x4A75, 0x5A54, 0x6A37, 0x7A16, 0x0AF1, 0x1AD0, 0x2AB3, 0x3A92,
+ 0xFD2E, 0xED0F, 0xDD6C, 0xCD4D, 0xBDAA, 0xAD8B, 0x9DE8, 0x8DC9,
+ 0x7C26, 0x6C07, 0x5C64, 0x4C45, 0x3CA2, 0x2C83, 0x1CE0, 0x0CC1,
+ 0xEF1F, 0xFF3E, 0xCF5D, 0xDF7C, 0xAF9B, 0xBFBA, 0x8FD9, 0x9FF8,
+ 0x6E17, 0x7E36, 0x4E55, 0x5E74, 0x2E93, 0x3EB2, 0x0ED1, 0x1EF0
+};
+
+uint16_t ff_svq1_packet_checksum (const uint8_t *data,
+ const int length, int value)
+{
+ int i;
+
+ for (i = 0; i < length; i++)
+ value = checksum_table[data[i] ^ (value >> 8)] ^ ((value & 0xFF) << 8);
+
+ return value;
+}
diff --git a/gst-libs/ext/libav/libavcodec/svq1_vlc.h b/gst-libs/ext/libav/libavcodec/svq1_vlc.h
index 4d03b08..834279d 100644
--- a/gst-libs/ext/libav/libavcodec/svq1_vlc.h
+++ b/gst-libs/ext/libav/libavcodec/svq1_vlc.h
@@ -25,131 +25,116 @@
/* values in this table range from 0..3; adjust retrieved value by +0 */
const uint8_t ff_svq1_block_type_vlc[4][2] = {
- /* { code, length } */
+ /* { code, length } */
{ 0x1, 1 }, { 0x1, 2 }, { 0x1, 3 }, { 0x0, 3 }
-
};
/* values in this table range from -1..6; adjust retrieved value by -1 */
const uint8_t ff_svq1_intra_multistage_vlc[6][8][2] = {
- /* { code, length } */
-{
- { 0x1, 5 }, { 0x1, 1 }, { 0x3, 3 }, { 0x2, 3 },
- { 0x3, 4 }, { 0x2, 4 }, { 0x0, 5 }, { 0x1, 4 }
-},{
- { 0x1, 4 }, { 0x3, 2 }, { 0x5, 3 }, { 0x4, 3 },
- { 0x3, 3 }, { 0x2, 3 }, { 0x0, 4 }, { 0x1, 3 }
-},{
- { 0x1, 5 }, { 0x1, 1 }, { 0x3, 3 }, { 0x0, 5 },
- { 0x3, 4 }, { 0x2, 3 }, { 0x2, 4 }, { 0x1, 4 }
-},{
- { 0x1, 6 }, { 0x1, 1 }, { 0x1, 2 }, { 0x0, 6 },
- { 0x3, 4 }, { 0x2, 4 }, { 0x1, 5 }, { 0x1, 4 }
-},{
- { 0x1, 6 }, { 0x1, 1 }, { 0x1, 2 }, { 0x3, 5 },
- { 0x2, 5 }, { 0x0, 6 }, { 0x1, 5 }, { 0x1, 3 }
-},{
- { 0x1, 7 }, { 0x1, 1 }, { 0x1, 2 }, { 0x1, 3 },
- { 0x1, 4 }, { 0x1, 6 }, { 0x0, 7 }, { 0x1, 5 }
-}
+ /* { code, length } */
+ { { 0x1, 5 }, { 0x1, 1 }, { 0x3, 3 }, { 0x2, 3 },
+ { 0x3, 4 }, { 0x2, 4 }, { 0x0, 5 }, { 0x1, 4 } },
+ { { 0x1, 4 }, { 0x3, 2 }, { 0x5, 3 }, { 0x4, 3 },
+ { 0x3, 3 }, { 0x2, 3 }, { 0x0, 4 }, { 0x1, 3 } },
+ { { 0x1, 5 }, { 0x1, 1 }, { 0x3, 3 }, { 0x0, 5 },
+ { 0x3, 4 }, { 0x2, 3 }, { 0x2, 4 }, { 0x1, 4 } },
+ { { 0x1, 6 }, { 0x1, 1 }, { 0x1, 2 }, { 0x0, 6 },
+ { 0x3, 4 }, { 0x2, 4 }, { 0x1, 5 }, { 0x1, 4 } },
+ { { 0x1, 6 }, { 0x1, 1 }, { 0x1, 2 }, { 0x3, 5 },
+ { 0x2, 5 }, { 0x0, 6 }, { 0x1, 5 }, { 0x1, 3 } },
+ { { 0x1, 7 }, { 0x1, 1 }, { 0x1, 2 }, { 0x1, 3 },
+ { 0x1, 4 }, { 0x1, 6 }, { 0x0, 7 }, { 0x1, 5 } }
};
/* values in this table range from -1..6; adjust retrieved value by -1 */
const uint8_t ff_svq1_inter_multistage_vlc[6][8][2] = {
- /* { code, length } */
-{
- { 0x3, 2 }, { 0x5, 3 }, { 0x4, 3 }, { 0x3, 3 },
- { 0x2, 3 }, { 0x1, 3 }, { 0x1, 4 }, { 0x0, 4 }
-},{
- { 0x3, 2 }, { 0x5, 3 }, { 0x4, 3 }, { 0x3, 3 },
- { 0x2, 3 }, { 0x1, 3 }, { 0x1, 4 }, { 0x0, 4 }
-},{
- { 0x1, 1 }, { 0x3, 3 }, { 0x2, 3 }, { 0x3, 4 },
- { 0x2, 4 }, { 0x1, 4 }, { 0x1, 5 }, { 0x0, 5 }
-},{
- { 0x1, 1 }, { 0x3, 3 }, { 0x2, 3 }, { 0x3, 4 },
- { 0x2, 4 }, { 0x1, 4 }, { 0x1, 5 }, { 0x0, 5 }
-},{
- { 0x1, 1 }, { 0x3, 3 }, { 0x2, 3 }, { 0x3, 4 },
- { 0x2, 4 }, { 0x1, 4 }, { 0x1, 5 }, { 0x0, 5 }
-},{
- { 0x1, 1 }, { 0x1, 2 }, { 0x1, 3 }, { 0x3, 5 },
- { 0x2, 5 }, { 0x1, 5 }, { 0x1, 6 }, { 0x0, 6 }
-}
+ /* { code, length } */
+ { { 0x3, 2 }, { 0x5, 3 }, { 0x4, 3 }, { 0x3, 3 },
+ { 0x2, 3 }, { 0x1, 3 }, { 0x1, 4 }, { 0x0, 4 } },
+ { { 0x3, 2 }, { 0x5, 3 }, { 0x4, 3 }, { 0x3, 3 },
+ { 0x2, 3 }, { 0x1, 3 }, { 0x1, 4 }, { 0x0, 4 } },
+ { { 0x1, 1 }, { 0x3, 3 }, { 0x2, 3 }, { 0x3, 4 },
+ { 0x2, 4 }, { 0x1, 4 }, { 0x1, 5 }, { 0x0, 5 } },
+ { { 0x1, 1 }, { 0x3, 3 }, { 0x2, 3 }, { 0x3, 4 },
+ { 0x2, 4 }, { 0x1, 4 }, { 0x1, 5 }, { 0x0, 5 } },
+ { { 0x1, 1 }, { 0x3, 3 }, { 0x2, 3 }, { 0x3, 4 },
+ { 0x2, 4 }, { 0x1, 4 }, { 0x1, 5 }, { 0x0, 5 } },
+ { { 0x1, 1 }, { 0x1, 2 }, { 0x1, 3 }, { 0x3, 5 },
+ { 0x2, 5 }, { 0x1, 5 }, { 0x1, 6 }, { 0x0, 6 } }
};
/* values in this table range from 0..255; adjust retrieved value by +0 */
const uint16_t ff_svq1_intra_mean_vlc[256][2] = {
- /* { code, length } */
- { 0x37, 6 }, { 0x56, 7 }, { 0x1, 17 }, { 0x1, 20 },
- { 0x2, 20 }, { 0x3, 20 }, { 0x0, 20 }, { 0x4, 20 },
- { 0x5, 20 }, { 0x3, 19 }, { 0x15, 11 }, { 0x42, 9 },
- { 0x14, 11 }, { 0x3, 14 }, { 0x2, 14 }, { 0x1, 15 },
- { 0x1, 16 }, { 0x1, 12 }, { 0x2B, 10 }, { 0x18, 11 },
- { 0xC, 11 }, { 0x41, 9 }, { 0x78, 8 }, { 0x6C, 8 },
- { 0x55, 7 }, { 0xF, 4 }, { 0xE, 4 }, { 0x34, 6 },
- { 0x51, 7 }, { 0x72, 8 }, { 0x6E, 8 }, { 0x40, 9 },
- { 0x3F, 9 }, { 0x3E, 9 }, { 0x3D, 9 }, { 0x3C, 9 },
- { 0x3B, 9 }, { 0x3A, 9 }, { 0x39, 9 }, { 0x38, 9 },
- { 0x37, 9 }, { 0x43, 9 }, { 0x46, 9 }, { 0x47, 9 },
- { 0x45, 9 }, { 0x44, 9 }, { 0x49, 9 }, { 0x48, 9 },
- { 0x4A, 8 }, { 0x79, 8 }, { 0x76, 8 }, { 0x77, 8 },
- { 0x71, 8 }, { 0x75, 8 }, { 0x74, 8 }, { 0x73, 8 },
- { 0x6A, 8 }, { 0x55, 8 }, { 0x70, 8 }, { 0x6F, 8 },
- { 0x52, 8 }, { 0x6D, 8 }, { 0x4C, 8 }, { 0x6B, 8 },
- { 0x40, 7 }, { 0x69, 8 }, { 0x68, 8 }, { 0x67, 8 },
- { 0x66, 8 }, { 0x65, 8 }, { 0x64, 8 }, { 0x63, 8 },
- { 0x62, 8 }, { 0x61, 8 }, { 0x60, 8 }, { 0x5F, 8 },
- { 0x5E, 8 }, { 0x5D, 8 }, { 0x5C, 8 }, { 0x5B, 8 },
- { 0x5A, 8 }, { 0x59, 8 }, { 0x58, 8 }, { 0x57, 8 },
- { 0x56, 8 }, { 0x3D, 7 }, { 0x54, 8 }, { 0x53, 8 },
- { 0x3F, 7 }, { 0x51, 8 }, { 0x50, 8 }, { 0x4F, 8 },
- { 0x4E, 8 }, { 0x4D, 8 }, { 0x41, 7 }, { 0x4B, 8 },
- { 0x53, 7 }, { 0x3E, 7 }, { 0x48, 8 }, { 0x4F, 7 },
- { 0x52, 7 }, { 0x45, 8 }, { 0x50, 7 }, { 0x43, 8 },
- { 0x42, 8 }, { 0x41, 8 }, { 0x42, 7 }, { 0x43, 7 },
- { 0x3E, 8 }, { 0x44, 7 }, { 0x3C, 8 }, { 0x45, 7 },
- { 0x46, 7 }, { 0x47, 7 }, { 0x48, 7 }, { 0x49, 7 },
- { 0x4A, 7 }, { 0x4B, 7 }, { 0x4C, 7 }, { 0x4D, 7 },
- { 0x4E, 7 }, { 0x58, 7 }, { 0x59, 7 }, { 0x5A, 7 },
- { 0x5B, 7 }, { 0x5C, 7 }, { 0x5D, 7 }, { 0x44, 8 },
- { 0x49, 8 }, { 0x29, 8 }, { 0x3F, 8 }, { 0x3D, 8 },
- { 0x3B, 8 }, { 0x2C, 8 }, { 0x28, 8 }, { 0x25, 8 },
- { 0x26, 8 }, { 0x5E, 7 }, { 0x57, 7 }, { 0x54, 7 },
- { 0x5F, 7 }, { 0x62, 7 }, { 0x63, 7 }, { 0x64, 7 },
- { 0x61, 7 }, { 0x65, 7 }, { 0x67, 7 }, { 0x66, 7 },
- { 0x35, 6 }, { 0x36, 6 }, { 0x60, 7 }, { 0x39, 8 },
- { 0x3A, 8 }, { 0x38, 8 }, { 0x37, 8 }, { 0x36, 8 },
- { 0x35, 8 }, { 0x34, 8 }, { 0x33, 8 }, { 0x32, 8 },
- { 0x31, 8 }, { 0x30, 8 }, { 0x2D, 8 }, { 0x2B, 8 },
- { 0x2A, 8 }, { 0x27, 8 }, { 0x40, 8 }, { 0x46, 8 },
- { 0x47, 8 }, { 0x26, 9 }, { 0x25, 9 }, { 0x24, 9 },
- { 0x23, 9 }, { 0x22, 9 }, { 0x2E, 8 }, { 0x2F, 8 },
- { 0x1F, 9 }, { 0x36, 9 }, { 0x1D, 9 }, { 0x21, 9 },
- { 0x1B, 9 }, { 0x1C, 9 }, { 0x19, 9 }, { 0x1A, 9 },
- { 0x18, 9 }, { 0x17, 9 }, { 0x16, 9 }, { 0x1E, 9 },
- { 0x20, 9 }, { 0x27, 9 }, { 0x28, 9 }, { 0x29, 9 },
- { 0x2A, 9 }, { 0x2B, 9 }, { 0x2C, 9 }, { 0x2D, 9 },
- { 0x2E, 9 }, { 0x2F, 9 }, { 0x30, 9 }, { 0x35, 9 },
- { 0x31, 9 }, { 0x32, 9 }, { 0x33, 9 }, { 0x34, 9 },
+ /* { code, length } */
+ { 0x37, 6 }, { 0x56, 7 }, { 0x01, 17 }, { 0x01, 20 },
+ { 0x02, 20 }, { 0x03, 20 }, { 0x00, 20 }, { 0x04, 20 },
+ { 0x05, 20 }, { 0x03, 19 }, { 0x15, 11 }, { 0x42, 9 },
+ { 0x14, 11 }, { 0x03, 14 }, { 0x02, 14 }, { 0x01, 15 },
+ { 0x01, 16 }, { 0x01, 12 }, { 0x2B, 10 }, { 0x18, 11 },
+ { 0x0C, 11 }, { 0x41, 9 }, { 0x78, 8 }, { 0x6C, 8 },
+ { 0x55, 7 }, { 0x0F, 4 }, { 0x0E, 4 }, { 0x34, 6 },
+ { 0x51, 7 }, { 0x72, 8 }, { 0x6E, 8 }, { 0x40, 9 },
+ { 0x3F, 9 }, { 0x3E, 9 }, { 0x3D, 9 }, { 0x3C, 9 },
+ { 0x3B, 9 }, { 0x3A, 9 }, { 0x39, 9 }, { 0x38, 9 },
+ { 0x37, 9 }, { 0x43, 9 }, { 0x46, 9 }, { 0x47, 9 },
+ { 0x45, 9 }, { 0x44, 9 }, { 0x49, 9 }, { 0x48, 9 },
+ { 0x4A, 8 }, { 0x79, 8 }, { 0x76, 8 }, { 0x77, 8 },
+ { 0x71, 8 }, { 0x75, 8 }, { 0x74, 8 }, { 0x73, 8 },
+ { 0x6A, 8 }, { 0x55, 8 }, { 0x70, 8 }, { 0x6F, 8 },
+ { 0x52, 8 }, { 0x6D, 8 }, { 0x4C, 8 }, { 0x6B, 8 },
+ { 0x40, 7 }, { 0x69, 8 }, { 0x68, 8 }, { 0x67, 8 },
+ { 0x66, 8 }, { 0x65, 8 }, { 0x64, 8 }, { 0x63, 8 },
+ { 0x62, 8 }, { 0x61, 8 }, { 0x60, 8 }, { 0x5F, 8 },
+ { 0x5E, 8 }, { 0x5D, 8 }, { 0x5C, 8 }, { 0x5B, 8 },
+ { 0x5A, 8 }, { 0x59, 8 }, { 0x58, 8 }, { 0x57, 8 },
+ { 0x56, 8 }, { 0x3D, 7 }, { 0x54, 8 }, { 0x53, 8 },
+ { 0x3F, 7 }, { 0x51, 8 }, { 0x50, 8 }, { 0x4F, 8 },
+ { 0x4E, 8 }, { 0x4D, 8 }, { 0x41, 7 }, { 0x4B, 8 },
+ { 0x53, 7 }, { 0x3E, 7 }, { 0x48, 8 }, { 0x4F, 7 },
+ { 0x52, 7 }, { 0x45, 8 }, { 0x50, 7 }, { 0x43, 8 },
+ { 0x42, 8 }, { 0x41, 8 }, { 0x42, 7 }, { 0x43, 7 },
+ { 0x3E, 8 }, { 0x44, 7 }, { 0x3C, 8 }, { 0x45, 7 },
+ { 0x46, 7 }, { 0x47, 7 }, { 0x48, 7 }, { 0x49, 7 },
+ { 0x4A, 7 }, { 0x4B, 7 }, { 0x4C, 7 }, { 0x4D, 7 },
+ { 0x4E, 7 }, { 0x58, 7 }, { 0x59, 7 }, { 0x5A, 7 },
+ { 0x5B, 7 }, { 0x5C, 7 }, { 0x5D, 7 }, { 0x44, 8 },
+ { 0x49, 8 }, { 0x29, 8 }, { 0x3F, 8 }, { 0x3D, 8 },
+ { 0x3B, 8 }, { 0x2C, 8 }, { 0x28, 8 }, { 0x25, 8 },
+ { 0x26, 8 }, { 0x5E, 7 }, { 0x57, 7 }, { 0x54, 7 },
+ { 0x5F, 7 }, { 0x62, 7 }, { 0x63, 7 }, { 0x64, 7 },
+ { 0x61, 7 }, { 0x65, 7 }, { 0x67, 7 }, { 0x66, 7 },
+ { 0x35, 6 }, { 0x36, 6 }, { 0x60, 7 }, { 0x39, 8 },
+ { 0x3A, 8 }, { 0x38, 8 }, { 0x37, 8 }, { 0x36, 8 },
+ { 0x35, 8 }, { 0x34, 8 }, { 0x33, 8 }, { 0x32, 8 },
+ { 0x31, 8 }, { 0x30, 8 }, { 0x2D, 8 }, { 0x2B, 8 },
+ { 0x2A, 8 }, { 0x27, 8 }, { 0x40, 8 }, { 0x46, 8 },
+ { 0x47, 8 }, { 0x26, 9 }, { 0x25, 9 }, { 0x24, 9 },
+ { 0x23, 9 }, { 0x22, 9 }, { 0x2E, 8 }, { 0x2F, 8 },
+ { 0x1F, 9 }, { 0x36, 9 }, { 0x1D, 9 }, { 0x21, 9 },
+ { 0x1B, 9 }, { 0x1C, 9 }, { 0x19, 9 }, { 0x1A, 9 },
+ { 0x18, 9 }, { 0x17, 9 }, { 0x16, 9 }, { 0x1E, 9 },
+ { 0x20, 9 }, { 0x27, 9 }, { 0x28, 9 }, { 0x29, 9 },
+ { 0x2A, 9 }, { 0x2B, 9 }, { 0x2C, 9 }, { 0x2D, 9 },
+ { 0x2E, 9 }, { 0x2F, 9 }, { 0x30, 9 }, { 0x35, 9 },
+ { 0x31, 9 }, { 0x32, 9 }, { 0x33, 9 }, { 0x34, 9 },
{ 0x19, 10 }, { 0x2A, 10 }, { 0x17, 10 }, { 0x16, 10 },
{ 0x15, 10 }, { 0x28, 10 }, { 0x26, 10 }, { 0x25, 10 },
{ 0x22, 10 }, { 0x21, 10 }, { 0x18, 10 }, { 0x14, 10 },
- { 0x29, 10 }, { 0x12, 10 }, { 0xD, 10 }, { 0xE, 10 },
- { 0xF, 10 }, { 0x10, 10 }, { 0x11, 10 }, { 0x1A, 10 },
+ { 0x29, 10 }, { 0x12, 10 }, { 0x0D, 10 }, { 0x0E, 10 },
+ { 0x0F, 10 }, { 0x10, 10 }, { 0x11, 10 }, { 0x1A, 10 },
{ 0x1B, 10 }, { 0x1C, 10 }, { 0x1D, 10 }, { 0x1E, 10 },
{ 0x1F, 10 }, { 0x20, 10 }, { 0x13, 10 }, { 0x23, 10 },
- { 0x24, 10 }, { 0x9, 11 }, { 0x8, 11 }, { 0x7, 11 },
- { 0x27, 10 }, { 0x5, 11 }, { 0xB, 11 }, { 0x6, 11 },
- { 0x4, 11 }, { 0x3, 11 }, { 0x2, 11 }, { 0x1, 11 },
- { 0xA, 11 }, { 0x16, 11 }, { 0x19, 11 }, { 0x17, 11 },
- { 0xD, 11 }, { 0xE, 11 }, { 0xF, 11 }, { 0x10, 11 },
- { 0x11, 11 }, { 0x12, 11 }, { 0x13, 11 }, { 0x1, 14 }
+ { 0x24, 10 }, { 0x09, 11 }, { 0x08, 11 }, { 0x07, 11 },
+ { 0x27, 10 }, { 0x05, 11 }, { 0x0B, 11 }, { 0x06, 11 },
+ { 0x04, 11 }, { 0x03, 11 }, { 0x02, 11 }, { 0x01, 11 },
+ { 0x0A, 11 }, { 0x16, 11 }, { 0x19, 11 }, { 0x17, 11 },
+ { 0x0D, 11 }, { 0x0E, 11 }, { 0x0F, 11 }, { 0x10, 11 },
+ { 0x11, 11 }, { 0x12, 11 }, { 0x13, 11 }, { 0x01, 14 }
};
/* values in this table range from -256..255; adjust retrieved value by -256 */
const uint16_t ff_svq1_inter_mean_vlc[512][2] = {
- /* { code, length } */
+ /* { code, length } */
{ 0x5A, 22 }, { 0xD4, 22 }, { 0xD5, 22 }, { 0xD6, 22 },
{ 0xD7, 22 }, { 0xD8, 22 }, { 0xD9, 22 }, { 0xDA, 22 },
{ 0xDB, 22 }, { 0xDC, 22 }, { 0xDD, 22 }, { 0xDE, 22 },
@@ -159,12 +144,12 @@ const uint16_t ff_svq1_inter_mean_vlc[512][2] = {
{ 0xE7, 22 }, { 0xEC, 22 }, { 0xED, 22 }, { 0xEE, 22 },
{ 0xEF, 22 }, { 0xF0, 22 }, { 0xF1, 22 }, { 0xF2, 22 },
{ 0xF3, 22 }, { 0xF4, 22 }, { 0xF5, 22 }, { 0xF6, 22 },
- { 0xF7, 22 }, { 0xF8, 22 }, { 0x102, 22 }, { 0xEB, 22 },
+ { 0xF7, 22 }, { 0xF8, 22 }, { 0x102,22 }, { 0xEB, 22 },
{ 0xF9, 22 }, { 0xFC, 22 }, { 0xFD, 22 }, { 0xFE, 22 },
- { 0x100, 22 }, { 0x5C, 22 }, { 0x60, 22 }, { 0x101, 22 },
- { 0x71, 22 }, { 0x104, 22 }, { 0x105, 22 }, { 0xFB, 22 },
+ { 0x100,22 }, { 0x5C, 22 }, { 0x60, 22 }, { 0x101,22 },
+ { 0x71, 22 }, { 0x104,22 }, { 0x105,22 }, { 0xFB, 22 },
{ 0xFF, 22 }, { 0x86, 21 }, { 0xFA, 22 }, { 0x7C, 22 },
- { 0x75, 22 }, { 0x103, 22 }, { 0x78, 22 }, { 0xD3, 22 },
+ { 0x75, 22 }, { 0x103,22 }, { 0x78, 22 }, { 0xD3, 22 },
{ 0x7B, 22 }, { 0x82, 22 }, { 0xD2, 22 }, { 0xD1, 22 },
{ 0xD0, 22 }, { 0xCF, 22 }, { 0xCE, 22 }, { 0xCD, 22 },
{ 0xCC, 22 }, { 0xC3, 22 }, { 0xCA, 22 }, { 0xC9, 22 },
@@ -206,19 +191,19 @@ const uint16_t ff_svq1_inter_mean_vlc[512][2] = {
{ 0x21, 14 }, { 0x13, 13 }, { 0x14, 13 }, { 0x15, 13 },
{ 0x16, 13 }, { 0x17, 13 }, { 0x18, 13 }, { 0x19, 13 },
{ 0x1A, 13 }, { 0x18, 12 }, { 0x17, 12 }, { 0x15, 12 },
- { 0x14, 12 }, { 0x13, 12 }, { 0x12, 12 }, { 0xF, 11 },
+ { 0x14, 12 }, { 0x13, 12 }, { 0x12, 12 }, { 0x0F, 11 },
{ 0x10, 11 }, { 0x12, 11 }, { 0x13, 11 }, { 0x1B, 11 },
- { 0x1A, 11 }, { 0xE, 10 }, { 0x13, 10 }, { 0xF, 10 },
- { 0x10, 10 }, { 0x11, 10 }, { 0x12, 10 }, { 0xD, 9 },
- { 0x14, 9 }, { 0x15, 9 }, { 0xC, 9 }, { 0x13, 9 },
- { 0xF, 8 }, { 0xE, 8 }, { 0x10, 8 }, { 0x11, 8 },
- { 0xC, 7 }, { 0x9, 7 }, { 0xA, 7 }, { 0x8, 6 },
- { 0x9, 6 }, { 0x9, 5 }, { 0x8, 5 }, { 0x5, 4 },
- { 0x1, 1 }, { 0x3, 3 }, { 0x7, 5 }, { 0x6, 5 },
- { 0xB, 6 }, { 0xA, 6 }, { 0xE, 7 }, { 0xF, 7 },
- { 0xB, 7 }, { 0xD, 7 }, { 0xB, 8 }, { 0xD, 8 },
- { 0xC, 8 }, { 0xF, 9 }, { 0x10, 9 }, { 0x11, 9 },
- { 0xE, 9 }, { 0x12, 9 }, { 0x17, 10 }, { 0x14, 10 },
+ { 0x1A, 11 }, { 0x0E, 10 }, { 0x13, 10 }, { 0x0F, 10 },
+ { 0x10, 10 }, { 0x11, 10 }, { 0x12, 10 }, { 0x0D, 9 },
+ { 0x14, 9 }, { 0x15, 9 }, { 0x0C, 9 }, { 0x13, 9 },
+ { 0x0F, 8 }, { 0x0E, 8 }, { 0x10, 8 }, { 0x11, 8 },
+ { 0x0C, 7 }, { 0x09, 7 }, { 0x0A, 7 }, { 0x08, 6 },
+ { 0x09, 6 }, { 0x09, 5 }, { 0x08, 5 }, { 0x05, 4 },
+ { 0x01, 1 }, { 0x03, 3 }, { 0x07, 5 }, { 0x06, 5 },
+ { 0x0B, 6 }, { 0x0A, 6 }, { 0x0E, 7 }, { 0x0F, 7 },
+ { 0x0B, 7 }, { 0x0D, 7 }, { 0x0B, 8 }, { 0x0D, 8 },
+ { 0x0C, 8 }, { 0x0F, 9 }, { 0x10, 9 }, { 0x11, 9 },
+ { 0x0E, 9 }, { 0x12, 9 }, { 0x17, 10 }, { 0x14, 10 },
{ 0x16, 10 }, { 0x15, 10 }, { 0x19, 11 }, { 0x18, 11 },
{ 0x17, 11 }, { 0x16, 11 }, { 0x15, 11 }, { 0x14, 11 },
{ 0x11, 11 }, { 0x19, 12 }, { 0x1A, 12 }, { 0x16, 12 },
@@ -274,10 +259,10 @@ const uint16_t ff_svq1_inter_mean_vlc[512][2] = {
{ 0x1B, 22 }, { 0x1A, 22 }, { 0x19, 22 }, { 0x18, 22 },
{ 0x17, 22 }, { 0x16, 22 }, { 0x15, 22 }, { 0x14, 22 },
{ 0x13, 22 }, { 0x12, 22 }, { 0x11, 22 }, { 0x10, 22 },
- { 0xF, 22 }, { 0xE, 22 }, { 0xD, 22 }, { 0xC, 22 },
- { 0xB, 22 }, { 0xA, 22 }, { 0x9, 22 }, { 0x8, 22 },
- { 0x7, 22 }, { 0x6, 22 }, { 0x5, 22 }, { 0x4, 22 },
- { 0x3, 22 }, { 0x2, 22 }, { 0x1, 22 }, { 0x0, 22 }
+ { 0x0F, 22 }, { 0x0E, 22 }, { 0x0D, 22 }, { 0x0C, 22 },
+ { 0x0B, 22 }, { 0x0A, 22 }, { 0x09, 22 }, { 0x08, 22 },
+ { 0x07, 22 }, { 0x06, 22 }, { 0x05, 22 }, { 0x04, 22 },
+ { 0x03, 22 }, { 0x02, 22 }, { 0x01, 22 }, { 0x00, 22 }
};
#endif /* AVCODEC_SVQ1_VLC_H */
diff --git a/gst-libs/ext/libav/libavcodec/svq1dec.c b/gst-libs/ext/libav/libavcodec/svq1dec.c
index 1cbf1f5..82f9301 100644
--- a/gst-libs/ext/libav/libavcodec/svq1dec.c
+++ b/gst-libs/ext/libav/libavcodec/svq1dec.c
@@ -32,12 +32,11 @@
* http://www.pcisys.net/~melanson/codecs/
*/
-
#include "avcodec.h"
#include "dsputil.h"
-#include "mpegvideo.h"
+#include "get_bits.h"
+#include "internal.h"
#include "mathops.h"
-
#include "svq1.h"
#undef NDEBUG
@@ -54,771 +53,781 @@ static VLC svq1_inter_mean;
/* motion vector (prediction) */
typedef struct svq1_pmv_s {
- int x;
- int y;
+ int x;
+ int y;
} svq1_pmv;
-static const uint16_t checksum_table[256] = {
- 0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50A5, 0x60C6, 0x70E7,
- 0x8108, 0x9129, 0xA14A, 0xB16B, 0xC18C, 0xD1AD, 0xE1CE, 0xF1EF,
- 0x1231, 0x0210, 0x3273, 0x2252, 0x52B5, 0x4294, 0x72F7, 0x62D6,
- 0x9339, 0x8318, 0xB37B, 0xA35A, 0xD3BD, 0xC39C, 0xF3FF, 0xE3DE,
- 0x2462, 0x3443, 0x0420, 0x1401, 0x64E6, 0x74C7, 0x44A4, 0x5485,
- 0xA56A, 0xB54B, 0x8528, 0x9509, 0xE5EE, 0xF5CF, 0xC5AC, 0xD58D,
- 0x3653, 0x2672, 0x1611, 0x0630, 0x76D7, 0x66F6, 0x5695, 0x46B4,
- 0xB75B, 0xA77A, 0x9719, 0x8738, 0xF7DF, 0xE7FE, 0xD79D, 0xC7BC,
- 0x48C4, 0x58E5, 0x6886, 0x78A7, 0x0840, 0x1861, 0x2802, 0x3823,
- 0xC9CC, 0xD9ED, 0xE98E, 0xF9AF, 0x8948, 0x9969, 0xA90A, 0xB92B,
- 0x5AF5, 0x4AD4, 0x7AB7, 0x6A96, 0x1A71, 0x0A50, 0x3A33, 0x2A12,
- 0xDBFD, 0xCBDC, 0xFBBF, 0xEB9E, 0x9B79, 0x8B58, 0xBB3B, 0xAB1A,
- 0x6CA6, 0x7C87, 0x4CE4, 0x5CC5, 0x2C22, 0x3C03, 0x0C60, 0x1C41,
- 0xEDAE, 0xFD8F, 0xCDEC, 0xDDCD, 0xAD2A, 0xBD0B, 0x8D68, 0x9D49,
- 0x7E97, 0x6EB6, 0x5ED5, 0x4EF4, 0x3E13, 0x2E32, 0x1E51, 0x0E70,
- 0xFF9F, 0xEFBE, 0xDFDD, 0xCFFC, 0xBF1B, 0xAF3A, 0x9F59, 0x8F78,
- 0x9188, 0x81A9, 0xB1CA, 0xA1EB, 0xD10C, 0xC12D, 0xF14E, 0xE16F,
- 0x1080, 0x00A1, 0x30C2, 0x20E3, 0x5004, 0x4025, 0x7046, 0x6067,
- 0x83B9, 0x9398, 0xA3FB, 0xB3DA, 0xC33D, 0xD31C, 0xE37F, 0xF35E,
- 0x02B1, 0x1290, 0x22F3, 0x32D2, 0x4235, 0x5214, 0x6277, 0x7256,
- 0xB5EA, 0xA5CB, 0x95A8, 0x8589, 0xF56E, 0xE54F, 0xD52C, 0xC50D,
- 0x34E2, 0x24C3, 0x14A0, 0x0481, 0x7466, 0x6447, 0x5424, 0x4405,
- 0xA7DB, 0xB7FA, 0x8799, 0x97B8, 0xE75F, 0xF77E, 0xC71D, 0xD73C,
- 0x26D3, 0x36F2, 0x0691, 0x16B0, 0x6657, 0x7676, 0x4615, 0x5634,
- 0xD94C, 0xC96D, 0xF90E, 0xE92F, 0x99C8, 0x89E9, 0xB98A, 0xA9AB,
- 0x5844, 0x4865, 0x7806, 0x6827, 0x18C0, 0x08E1, 0x3882, 0x28A3,
- 0xCB7D, 0xDB5C, 0xEB3F, 0xFB1E, 0x8BF9, 0x9BD8, 0xABBB, 0xBB9A,
- 0x4A75, 0x5A54, 0x6A37, 0x7A16, 0x0AF1, 0x1AD0, 0x2AB3, 0x3A92,
- 0xFD2E, 0xED0F, 0xDD6C, 0xCD4D, 0xBDAA, 0xAD8B, 0x9DE8, 0x8DC9,
- 0x7C26, 0x6C07, 0x5C64, 0x4C45, 0x3CA2, 0x2C83, 0x1CE0, 0x0CC1,
- 0xEF1F, 0xFF3E, 0xCF5D, 0xDF7C, 0xAF9B, 0xBFBA, 0x8FD9, 0x9FF8,
- 0x6E17, 0x7E36, 0x4E55, 0x5E74, 0x2E93, 0x3EB2, 0x0ED1, 0x1EF0
-};
+typedef struct SVQ1Context {
+ DSPContext dsp;
+ GetBitContext gb;
+ AVFrame *cur, *prev;
+ int width;
+ int height;
+ int frame_code;
+ int nonref; // 1 if the current frame won't be referenced
+} SVQ1Context;
static const uint8_t string_table[256] = {
- 0x00, 0xD5, 0x7F, 0xAA, 0xFE, 0x2B, 0x81, 0x54,
- 0x29, 0xFC, 0x56, 0x83, 0xD7, 0x02, 0xA8, 0x7D,
- 0x52, 0x87, 0x2D, 0xF8, 0xAC, 0x79, 0xD3, 0x06,
- 0x7B, 0xAE, 0x04, 0xD1, 0x85, 0x50, 0xFA, 0x2F,
- 0xA4, 0x71, 0xDB, 0x0E, 0x5A, 0x8F, 0x25, 0xF0,
- 0x8D, 0x58, 0xF2, 0x27, 0x73, 0xA6, 0x0C, 0xD9,
- 0xF6, 0x23, 0x89, 0x5C, 0x08, 0xDD, 0x77, 0xA2,
- 0xDF, 0x0A, 0xA0, 0x75, 0x21, 0xF4, 0x5E, 0x8B,
- 0x9D, 0x48, 0xE2, 0x37, 0x63, 0xB6, 0x1C, 0xC9,
- 0xB4, 0x61, 0xCB, 0x1E, 0x4A, 0x9F, 0x35, 0xE0,
- 0xCF, 0x1A, 0xB0, 0x65, 0x31, 0xE4, 0x4E, 0x9B,
- 0xE6, 0x33, 0x99, 0x4C, 0x18, 0xCD, 0x67, 0xB2,
- 0x39, 0xEC, 0x46, 0x93, 0xC7, 0x12, 0xB8, 0x6D,
- 0x10, 0xC5, 0x6F, 0xBA, 0xEE, 0x3B, 0x91, 0x44,
- 0x6B, 0xBE, 0x14, 0xC1, 0x95, 0x40, 0xEA, 0x3F,
- 0x42, 0x97, 0x3D, 0xE8, 0xBC, 0x69, 0xC3, 0x16,
- 0xEF, 0x3A, 0x90, 0x45, 0x11, 0xC4, 0x6E, 0xBB,
- 0xC6, 0x13, 0xB9, 0x6C, 0x38, 0xED, 0x47, 0x92,
- 0xBD, 0x68, 0xC2, 0x17, 0x43, 0x96, 0x3C, 0xE9,
- 0x94, 0x41, 0xEB, 0x3E, 0x6A, 0xBF, 0x15, 0xC0,
- 0x4B, 0x9E, 0x34, 0xE1, 0xB5, 0x60, 0xCA, 0x1F,
- 0x62, 0xB7, 0x1D, 0xC8, 0x9C, 0x49, 0xE3, 0x36,
- 0x19, 0xCC, 0x66, 0xB3, 0xE7, 0x32, 0x98, 0x4D,
- 0x30, 0xE5, 0x4F, 0x9A, 0xCE, 0x1B, 0xB1, 0x64,
- 0x72, 0xA7, 0x0D, 0xD8, 0x8C, 0x59, 0xF3, 0x26,
- 0x5B, 0x8E, 0x24, 0xF1, 0xA5, 0x70, 0xDA, 0x0F,
- 0x20, 0xF5, 0x5F, 0x8A, 0xDE, 0x0B, 0xA1, 0x74,
- 0x09, 0xDC, 0x76, 0xA3, 0xF7, 0x22, 0x88, 0x5D,
- 0xD6, 0x03, 0xA9, 0x7C, 0x28, 0xFD, 0x57, 0x82,
- 0xFF, 0x2A, 0x80, 0x55, 0x01, 0xD4, 0x7E, 0xAB,
- 0x84, 0x51, 0xFB, 0x2E, 0x7A, 0xAF, 0x05, 0xD0,
- 0xAD, 0x78, 0xD2, 0x07, 0x53, 0x86, 0x2C, 0xF9
+ 0x00, 0xD5, 0x7F, 0xAA, 0xFE, 0x2B, 0x81, 0x54,
+ 0x29, 0xFC, 0x56, 0x83, 0xD7, 0x02, 0xA8, 0x7D,
+ 0x52, 0x87, 0x2D, 0xF8, 0xAC, 0x79, 0xD3, 0x06,
+ 0x7B, 0xAE, 0x04, 0xD1, 0x85, 0x50, 0xFA, 0x2F,
+ 0xA4, 0x71, 0xDB, 0x0E, 0x5A, 0x8F, 0x25, 0xF0,
+ 0x8D, 0x58, 0xF2, 0x27, 0x73, 0xA6, 0x0C, 0xD9,
+ 0xF6, 0x23, 0x89, 0x5C, 0x08, 0xDD, 0x77, 0xA2,
+ 0xDF, 0x0A, 0xA0, 0x75, 0x21, 0xF4, 0x5E, 0x8B,
+ 0x9D, 0x48, 0xE2, 0x37, 0x63, 0xB6, 0x1C, 0xC9,
+ 0xB4, 0x61, 0xCB, 0x1E, 0x4A, 0x9F, 0x35, 0xE0,
+ 0xCF, 0x1A, 0xB0, 0x65, 0x31, 0xE4, 0x4E, 0x9B,
+ 0xE6, 0x33, 0x99, 0x4C, 0x18, 0xCD, 0x67, 0xB2,
+ 0x39, 0xEC, 0x46, 0x93, 0xC7, 0x12, 0xB8, 0x6D,
+ 0x10, 0xC5, 0x6F, 0xBA, 0xEE, 0x3B, 0x91, 0x44,
+ 0x6B, 0xBE, 0x14, 0xC1, 0x95, 0x40, 0xEA, 0x3F,
+ 0x42, 0x97, 0x3D, 0xE8, 0xBC, 0x69, 0xC3, 0x16,
+ 0xEF, 0x3A, 0x90, 0x45, 0x11, 0xC4, 0x6E, 0xBB,
+ 0xC6, 0x13, 0xB9, 0x6C, 0x38, 0xED, 0x47, 0x92,
+ 0xBD, 0x68, 0xC2, 0x17, 0x43, 0x96, 0x3C, 0xE9,
+ 0x94, 0x41, 0xEB, 0x3E, 0x6A, 0xBF, 0x15, 0xC0,
+ 0x4B, 0x9E, 0x34, 0xE1, 0xB5, 0x60, 0xCA, 0x1F,
+ 0x62, 0xB7, 0x1D, 0xC8, 0x9C, 0x49, 0xE3, 0x36,
+ 0x19, 0xCC, 0x66, 0xB3, 0xE7, 0x32, 0x98, 0x4D,
+ 0x30, 0xE5, 0x4F, 0x9A, 0xCE, 0x1B, 0xB1, 0x64,
+ 0x72, 0xA7, 0x0D, 0xD8, 0x8C, 0x59, 0xF3, 0x26,
+ 0x5B, 0x8E, 0x24, 0xF1, 0xA5, 0x70, 0xDA, 0x0F,
+ 0x20, 0xF5, 0x5F, 0x8A, 0xDE, 0x0B, 0xA1, 0x74,
+ 0x09, 0xDC, 0x76, 0xA3, 0xF7, 0x22, 0x88, 0x5D,
+ 0xD6, 0x03, 0xA9, 0x7C, 0x28, 0xFD, 0x57, 0x82,
+ 0xFF, 0x2A, 0x80, 0x55, 0x01, 0xD4, 0x7E, 0xAB,
+ 0x84, 0x51, 0xFB, 0x2E, 0x7A, 0xAF, 0x05, 0xD0,
+ 0xAD, 0x78, 0xD2, 0x07, 0x53, 0x86, 0x2C, 0xF9
};
-#define SVQ1_PROCESS_VECTOR()\
- for (; level > 0; i++) {\
- /* process next depth */\
- if (i == m) {\
- m = n;\
- if (--level == 0)\
- break;\
- }\
- /* divide block if next bit set */\
- if (get_bits1 (bitbuf) == 0)\
- break;\
- /* add child nodes */\
- list[n++] = list[i];\
- list[n++] = list[i] + (((level & 1) ? pitch : 1) << ((level / 2) + 1));\
+#define SVQ1_PROCESS_VECTOR() \
+ for (; level > 0; i++) { \
+ /* process next depth */ \
+ if (i == m) { \
+ m = n; \
+ if (--level == 0) \
+ break; \
+ } \
+ /* divide block if next bit set */ \
+ if (get_bits1(bitbuf) == 0) \
+ break; \
+ /* add child nodes */ \
+ list[n++] = list[i]; \
+ list[n++] = list[i] + \
+ (((level & 1) ? pitch : 1) << (level / 2 + 1)); \
}
-#define SVQ1_ADD_CODEBOOK()\
- /* add codebook entries to vector */\
- for (j=0; j < stages; j++) {\
- n3 = codebook[entries[j]] ^ 0x80808080;\
- n1 += ((n3 & 0xFF00FF00) >> 8);\
- n2 += (n3 & 0x00FF00FF);\
- }\
-\
- /* clip to [0..255] */\
- if (n1 & 0xFF00FF00) {\
- n3 = ((( n1 >> 15) & 0x00010001) | 0x01000100) - 0x00010001;\
- n1 += 0x7F007F00;\
- n1 |= (((~n1 >> 15) & 0x00010001) | 0x01000100) - 0x00010001;\
- n1 &= (n3 & 0x00FF00FF);\
- }\
-\
- if (n2 & 0xFF00FF00) {\
- n3 = ((( n2 >> 15) & 0x00010001) | 0x01000100) - 0x00010001;\
- n2 += 0x7F007F00;\
- n2 |= (((~n2 >> 15) & 0x00010001) | 0x01000100) - 0x00010001;\
- n2 &= (n3 & 0x00FF00FF);\
- }
-
-#define SVQ1_DO_CODEBOOK_INTRA()\
- for (y=0; y < height; y++) {\
- for (x=0; x < (width / 4); x++, codebook++) {\
- n1 = n4;\
- n2 = n4;\
- SVQ1_ADD_CODEBOOK()\
- /* store result */\
- dst[x] = (n1 << 8) | n2;\
- }\
- dst += (pitch / 4);\
- }
-
-#define SVQ1_DO_CODEBOOK_NONINTRA()\
- for (y=0; y < height; y++) {\
- for (x=0; x < (width / 4); x++, codebook++) {\
- n3 = dst[x];\
- /* add mean value to vector */\
- n1 = ((n3 & 0xFF00FF00) >> 8) + n4;\
- n2 = (n3 & 0x00FF00FF) + n4;\
- SVQ1_ADD_CODEBOOK()\
- /* store result */\
- dst[x] = (n1 << 8) | n2;\
- }\
- dst += (pitch / 4);\
- }
-
-#define SVQ1_CALC_CODEBOOK_ENTRIES(cbook)\
- codebook = (const uint32_t *) cbook[level];\
- if (stages > 0)\
- bit_cache = get_bits (bitbuf, 4*stages);\
- /* calculate codebook entries for this vector */\
- for (j=0; j < stages; j++) {\
- entries[j] = (((bit_cache >> (4*(stages - j - 1))) & 0xF) + 16*j) << (level + 1);\
- }\
- mean -= (stages * 128);\
- n4 = ((mean + (mean >> 31)) << 16) | (mean & 0xFFFF);
-
-static int svq1_decode_block_intra (GetBitContext *bitbuf, uint8_t *pixels, int pitch ) {
- uint32_t bit_cache;
- uint8_t *list[63];
- uint32_t *dst;
- const uint32_t *codebook;
- int entries[6];
- int i, j, m, n;
- int mean, stages;
- unsigned x, y, width, height, level;
- uint32_t n1, n2, n3, n4;
-
- /* initialize list for breadth first processing of vectors */
- list[0] = pixels;
-
- /* recursively process vector */
- for (i=0, m=1, n=1, level=5; i < n; i++) {
- SVQ1_PROCESS_VECTOR();
-
- /* destination address and vector size */
- dst = (uint32_t *) list[i];
- width = 1 << ((4 + level) /2);
- height = 1 << ((3 + level) /2);
-
- /* get number of stages (-1 skips vector, 0 for mean only) */
- stages = get_vlc2(bitbuf, svq1_intra_multistage[level].table, 3, 3) - 1;
-
- if (stages == -1) {
- for (y=0; y < height; y++) {
- memset (&dst[y*(pitch / 4)], 0, width);
- }
- continue; /* skip vector */
+#define SVQ1_ADD_CODEBOOK() \
+ /* add codebook entries to vector */ \
+ for (j = 0; j < stages; j++) { \
+ n3 = codebook[entries[j]] ^ 0x80808080; \
+ n1 += (n3 & 0xFF00FF00) >> 8; \
+ n2 += n3 & 0x00FF00FF; \
+ } \
+ \
+ /* clip to [0..255] */ \
+ if (n1 & 0xFF00FF00) { \
+ n3 = (n1 >> 15 & 0x00010001 | 0x01000100) - 0x00010001; \
+ n1 += 0x7F007F00; \
+ n1 |= (~n1 >> 15 & 0x00010001 | 0x01000100) - 0x00010001; \
+ n1 &= n3 & 0x00FF00FF; \
+ } \
+ \
+ if (n2 & 0xFF00FF00) { \
+ n3 = (n2 >> 15 & 0x00010001 | 0x01000100) - 0x00010001; \
+ n2 += 0x7F007F00; \
+ n2 |= (~n2 >> 15 & 0x00010001 | 0x01000100) - 0x00010001; \
+ n2 &= n3 & 0x00FF00FF; \
}
- if ((stages > 0) && (level >= 4)) {
- av_dlog(NULL,
- "Error (svq1_decode_block_intra): invalid vector: stages=%i level=%i\n",
- stages, level);
- return -1; /* invalid vector */
- }
+#define SVQ1_CALC_CODEBOOK_ENTRIES(cbook) \
+ codebook = (const uint32_t *)cbook[level]; \
+ if (stages > 0) \
+ bit_cache = get_bits(bitbuf, 4 * stages); \
+ /* calculate codebook entries for this vector */ \
+ for (j = 0; j < stages; j++) { \
+ entries[j] = (((bit_cache >> (4 * (stages - j - 1))) & 0xF) + \
+ 16 * j) << (level + 1); \
+ } \
+ mean -= stages * 128; \
+ n4 = mean + (mean >> 31) << 16 | (mean & 0xFFFF);
+
+static int svq1_decode_block_intra(GetBitContext *bitbuf, uint8_t *pixels,
+ int pitch)
+{
+ uint32_t bit_cache;
+ uint8_t *list[63];
+ uint32_t *dst;
+ const uint32_t *codebook;
+ int entries[6];
+ int i, j, m, n;
+ int mean, stages;
+ unsigned x, y, width, height, level;
+ uint32_t n1, n2, n3, n4;
+
+ /* initialize list for breadth first processing of vectors */
+ list[0] = pixels;
+
+ /* recursively process vector */
+ for (i = 0, m = 1, n = 1, level = 5; i < n; i++) {
+ SVQ1_PROCESS_VECTOR();
+
+ /* destination address and vector size */
+ dst = (uint32_t *)list[i];
+ width = 1 << ((4 + level) / 2);
+ height = 1 << ((3 + level) / 2);
+
+ /* get number of stages (-1 skips vector, 0 for mean only) */
+ stages = get_vlc2(bitbuf, svq1_intra_multistage[level].table, 3, 3) - 1;
+
+ if (stages == -1) {
+ for (y = 0; y < height; y++)
+ memset(&dst[y * (pitch / 4)], 0, width);
+ continue; /* skip vector */
+ }
- mean = get_vlc2(bitbuf, svq1_intra_mean.table, 8, 3);
+ if (stages > 0 && level >= 4) {
+ av_dlog(NULL,
+ "Error (svq1_decode_block_intra): invalid vector: stages=%i level=%i\n",
+ stages, level);
+ return AVERROR_INVALIDDATA; /* invalid vector */
+ }
- if (stages == 0) {
- for (y=0; y < height; y++) {
- memset (&dst[y*(pitch / 4)], mean, width);
- }
- } else {
- SVQ1_CALC_CODEBOOK_ENTRIES(ff_svq1_intra_codebooks);
- SVQ1_DO_CODEBOOK_INTRA()
+ mean = get_vlc2(bitbuf, svq1_intra_mean.table, 8, 3);
+
+ if (stages == 0) {
+ for (y = 0; y < height; y++)
+ memset(&dst[y * (pitch / 4)], mean, width);
+ } else {
+ SVQ1_CALC_CODEBOOK_ENTRIES(ff_svq1_intra_codebooks);
+
+ for (y = 0; y < height; y++) {
+ for (x = 0; x < width / 4; x++, codebook++) {
+ n1 = n4;
+ n2 = n4;
+ SVQ1_ADD_CODEBOOK()
+ /* store result */
+ dst[x] = n1 << 8 | n2;
+ }
+ dst += pitch / 4;
+ }
+ }
}
- }
- return 0;
+ return 0;
}
-static int svq1_decode_block_non_intra (GetBitContext *bitbuf, uint8_t *pixels, int pitch ) {
- uint32_t bit_cache;
- uint8_t *list[63];
- uint32_t *dst;
- const uint32_t *codebook;
- int entries[6];
- int i, j, m, n;
- int mean, stages;
- int x, y, width, height, level;
- uint32_t n1, n2, n3, n4;
-
- /* initialize list for breadth first processing of vectors */
- list[0] = pixels;
-
- /* recursively process vector */
- for (i=0, m=1, n=1, level=5; i < n; i++) {
- SVQ1_PROCESS_VECTOR();
-
- /* destination address and vector size */
- dst = (uint32_t *) list[i];
- width = 1 << ((4 + level) /2);
- height = 1 << ((3 + level) /2);
-
- /* get number of stages (-1 skips vector, 0 for mean only) */
- stages = get_vlc2(bitbuf, svq1_inter_multistage[level].table, 3, 2) - 1;
-
- if (stages == -1) continue; /* skip vector */
-
- if ((stages > 0) && (level >= 4)) {
- av_dlog(NULL,
- "Error (svq1_decode_block_non_intra): invalid vector: stages=%i level=%i\n",
- stages, level);
- return -1; /* invalid vector */
- }
-
- mean = get_vlc2(bitbuf, svq1_inter_mean.table, 9, 3) - 256;
+static int svq1_decode_block_non_intra(GetBitContext *bitbuf, uint8_t *pixels,
+ int pitch)
+{
+ uint32_t bit_cache;
+ uint8_t *list[63];
+ uint32_t *dst;
+ const uint32_t *codebook;
+ int entries[6];
+ int i, j, m, n;
+ int mean, stages;
+ int x, y, width, height, level;
+ uint32_t n1, n2, n3, n4;
+
+ /* initialize list for breadth first processing of vectors */
+ list[0] = pixels;
+
+ /* recursively process vector */
+ for (i = 0, m = 1, n = 1, level = 5; i < n; i++) {
+ SVQ1_PROCESS_VECTOR();
+
+ /* destination address and vector size */
+ dst = (uint32_t *)list[i];
+ width = 1 << ((4 + level) / 2);
+ height = 1 << ((3 + level) / 2);
+
+ /* get number of stages (-1 skips vector, 0 for mean only) */
+ stages = get_vlc2(bitbuf, svq1_inter_multistage[level].table, 3, 2) - 1;
+
+ if (stages == -1)
+ continue; /* skip vector */
+
+ if ((stages > 0) && (level >= 4)) {
+ av_dlog(NULL,
+ "Error (svq1_decode_block_non_intra): invalid vector: stages=%i level=%i\n",
+ stages, level);
+ return AVERROR_INVALIDDATA; /* invalid vector */
+ }
- SVQ1_CALC_CODEBOOK_ENTRIES(ff_svq1_inter_codebooks);
- SVQ1_DO_CODEBOOK_NONINTRA()
- }
- return 0;
+ mean = get_vlc2(bitbuf, svq1_inter_mean.table, 9, 3) - 256;
+
+ SVQ1_CALC_CODEBOOK_ENTRIES(ff_svq1_inter_codebooks);
+
+ for (y = 0; y < height; y++) {
+ for (x = 0; x < width / 4; x++, codebook++) {
+ n3 = dst[x];
+ /* add mean value to vector */
+ n1 = n4 + ((n3 & 0xFF00FF00) >> 8);
+ n2 = n4 + (n3 & 0x00FF00FF);
+ SVQ1_ADD_CODEBOOK()
+ /* store result */
+ dst[x] = n1 << 8 | n2;
+ }
+ dst += pitch / 4;
+ }
+ }
+ return 0;
}
-static int svq1_decode_motion_vector (GetBitContext *bitbuf, svq1_pmv *mv, svq1_pmv **pmv) {
- int diff;
- int i;
+static int svq1_decode_motion_vector(GetBitContext *bitbuf, svq1_pmv *mv,
+ svq1_pmv **pmv)
+{
+ int diff;
+ int i;
- for (i=0; i < 2; i++) {
+ for (i = 0; i < 2; i++) {
+ /* get motion code */
+ diff = get_vlc2(bitbuf, svq1_motion_component.table, 7, 2);
+ if (diff < 0)
+ return AVERROR_INVALIDDATA;
+ else if (diff) {
+ if (get_bits1(bitbuf))
+ diff = -diff;
+ }
- /* get motion code */
- diff = get_vlc2(bitbuf, svq1_motion_component.table, 7, 2);
- if(diff<0)
- return -1;
- else if(diff){
- if(get_bits1(bitbuf)) diff= -diff;
+ /* add median of motion vector predictors and clip result */
+ if (i == 1)
+ mv->y = sign_extend(diff + mid_pred(pmv[0]->y, pmv[1]->y, pmv[2]->y), 6);
+ else
+ mv->x = sign_extend(diff + mid_pred(pmv[0]->x, pmv[1]->x, pmv[2]->x), 6);
}
- /* add median of motion vector predictors and clip result */
- if (i == 1)
- mv->y = sign_extend(diff + mid_pred(pmv[0]->y, pmv[1]->y, pmv[2]->y), 6);
- else
- mv->x = sign_extend(diff + mid_pred(pmv[0]->x, pmv[1]->x, pmv[2]->x), 6);
- }
-
- return 0;
+ return 0;
}
-static void svq1_skip_block (uint8_t *current, uint8_t *previous, int pitch, int x, int y) {
- uint8_t *src;
- uint8_t *dst;
- int i;
+static void svq1_skip_block(uint8_t *current, uint8_t *previous,
+ int pitch, int x, int y)
+{
+ uint8_t *src;
+ uint8_t *dst;
+ int i;
- src = &previous[x + y*pitch];
- dst = current;
+ src = &previous[x + y * pitch];
+ dst = current;
- for (i=0; i < 16; i++) {
- memcpy (dst, src, 16);
- src += pitch;
- dst += pitch;
- }
+ for (i = 0; i < 16; i++) {
+ memcpy(dst, src, 16);
+ src += pitch;
+ dst += pitch;
+ }
}
-static int svq1_motion_inter_block (MpegEncContext *s, GetBitContext *bitbuf,
- uint8_t *current, uint8_t *previous, int pitch,
- svq1_pmv *motion, int x, int y) {
- uint8_t *src;
- uint8_t *dst;
- svq1_pmv mv;
- svq1_pmv *pmv[3];
- int result;
-
- /* predict and decode motion vector */
- pmv[0] = &motion[0];
- if (y == 0) {
- pmv[1] =
- pmv[2] = pmv[0];
- }
- else {
- pmv[1] = &motion[(x / 8) + 2];
- pmv[2] = &motion[(x / 8) + 4];
- }
-
- result = svq1_decode_motion_vector (bitbuf, &mv, pmv);
-
- if (result != 0)
- return result;
+static int svq1_motion_inter_block(DSPContext *dsp, GetBitContext *bitbuf,
+ uint8_t *current, uint8_t *previous,
+ int pitch, svq1_pmv *motion, int x, int y,
+ int width, int height)
+{
+ uint8_t *src;
+ uint8_t *dst;
+ svq1_pmv mv;
+ svq1_pmv *pmv[3];
+ int result;
+
+ /* predict and decode motion vector */
+ pmv[0] = &motion[0];
+ if (y == 0) {
+ pmv[1] =
+ pmv[2] = pmv[0];
+ } else {
+ pmv[1] = &motion[x / 8 + 2];
+ pmv[2] = &motion[x / 8 + 4];
+ }
- motion[0].x =
- motion[(x / 8) + 2].x =
- motion[(x / 8) + 3].x = mv.x;
- motion[0].y =
- motion[(x / 8) + 2].y =
- motion[(x / 8) + 3].y = mv.y;
+ result = svq1_decode_motion_vector(bitbuf, &mv, pmv);
- if(y + (mv.y >> 1)<0)
- mv.y= 0;
- if(x + (mv.x >> 1)<0)
- mv.x= 0;
+ if (result != 0)
+ return result;
- src = &previous[(x + (mv.x >> 1)) + (y + (mv.y >> 1))*pitch];
- dst = current;
+ motion[0].x =
+ motion[x / 8 + 2].x =
+ motion[x / 8 + 3].x = mv.x;
+ motion[0].y =
+ motion[x / 8 + 2].y =
+ motion[x / 8 + 3].y = mv.y;
- s->dsp.put_pixels_tab[0][((mv.y & 1) << 1) | (mv.x & 1)](dst,src,pitch,16);
+ mv.x = av_clip(mv.x, -2 * x, 2 * (width - x - 16));
+ mv.y = av_clip(mv.y, -2 * y, 2 * (height - y - 16));
- return 0;
-}
+ src = &previous[(x + (mv.x >> 1)) + (y + (mv.y >> 1)) * pitch];
+ dst = current;
-static int svq1_motion_inter_4v_block (MpegEncContext *s, GetBitContext *bitbuf,
- uint8_t *current, uint8_t *previous, int pitch,
- svq1_pmv *motion,int x, int y) {
- uint8_t *src;
- uint8_t *dst;
- svq1_pmv mv;
- svq1_pmv *pmv[4];
- int i, result;
-
- /* predict and decode motion vector (0) */
- pmv[0] = &motion[0];
- if (y == 0) {
- pmv[1] =
- pmv[2] = pmv[0];
- }
- else {
- pmv[1] = &motion[(x / 8) + 2];
- pmv[2] = &motion[(x / 8) + 4];
- }
-
- result = svq1_decode_motion_vector (bitbuf, &mv, pmv);
-
- if (result != 0)
- return result;
+ dsp->put_pixels_tab[0][(mv.y & 1) << 1 | (mv.x & 1)](dst, src, pitch, 16);
- /* predict and decode motion vector (1) */
- pmv[0] = &mv;
- if (y == 0) {
- pmv[1] =
- pmv[2] = pmv[0];
- }
- else {
- pmv[1] = &motion[(x / 8) + 3];
- }
- result = svq1_decode_motion_vector (bitbuf, &motion[0], pmv);
-
- if (result != 0)
- return result;
+ return 0;
+}
- /* predict and decode motion vector (2) */
- pmv[1] = &motion[0];
- pmv[2] = &motion[(x / 8) + 1];
+static int svq1_motion_inter_4v_block(DSPContext *dsp, GetBitContext *bitbuf,
+ uint8_t *current, uint8_t *previous,
+ int pitch, svq1_pmv *motion, int x, int y,
+ int width, int height)
+{
+ uint8_t *src;
+ uint8_t *dst;
+ svq1_pmv mv;
+ svq1_pmv *pmv[4];
+ int i, result;
+
+ /* predict and decode motion vector (0) */
+ pmv[0] = &motion[0];
+ if (y == 0) {
+ pmv[1] =
+ pmv[2] = pmv[0];
+ } else {
+ pmv[1] = &motion[(x / 8) + 2];
+ pmv[2] = &motion[(x / 8) + 4];
+ }
- result = svq1_decode_motion_vector (bitbuf, &motion[(x / 8) + 2], pmv);
+ result = svq1_decode_motion_vector(bitbuf, &mv, pmv);
- if (result != 0)
- return result;
+ if (result != 0)
+ return result;
- /* predict and decode motion vector (3) */
- pmv[2] = &motion[(x / 8) + 2];
- pmv[3] = &motion[(x / 8) + 3];
+ /* predict and decode motion vector (1) */
+ pmv[0] = &mv;
+ if (y == 0) {
+ pmv[1] =
+ pmv[2] = pmv[0];
+ } else {
+ pmv[1] = &motion[(x / 8) + 3];
+ }
+ result = svq1_decode_motion_vector(bitbuf, &motion[0], pmv);
- result = svq1_decode_motion_vector (bitbuf, pmv[3], pmv);
+ if (result != 0)
+ return result;
- if (result != 0)
- return result;
+ /* predict and decode motion vector (2) */
+ pmv[1] = &motion[0];
+ pmv[2] = &motion[(x / 8) + 1];
- /* form predictions */
- for (i=0; i < 4; i++) {
- int mvx= pmv[i]->x + (i&1)*16;
- int mvy= pmv[i]->y + (i>>1)*16;
+ result = svq1_decode_motion_vector(bitbuf, &motion[(x / 8) + 2], pmv);
- ///XXX /FIXME clipping or padding?
- if(y + (mvy >> 1)<0)
- mvy= 0;
- if(x + (mvx >> 1)<0)
- mvx= 0;
+ if (result != 0)
+ return result;
- src = &previous[(x + (mvx >> 1)) + (y + (mvy >> 1))*pitch];
- dst = current;
+ /* predict and decode motion vector (3) */
+ pmv[2] = &motion[(x / 8) + 2];
+ pmv[3] = &motion[(x / 8) + 3];
- s->dsp.put_pixels_tab[1][((mvy & 1) << 1) | (mvx & 1)](dst,src,pitch,8);
+ result = svq1_decode_motion_vector(bitbuf, pmv[3], pmv);
- /* select next block */
- if (i & 1) {
- current += 8*(pitch - 1);
- } else {
- current += 8;
- }
- }
+ if (result != 0)
+ return result;
- return 0;
-}
+ /* form predictions */
+ for (i = 0; i < 4; i++) {
+ int mvx = pmv[i]->x + (i & 1) * 16;
+ int mvy = pmv[i]->y + (i >> 1) * 16;
-static int svq1_decode_delta_block (MpegEncContext *s, GetBitContext *bitbuf,
- uint8_t *current, uint8_t *previous, int pitch,
- svq1_pmv *motion, int x, int y) {
- uint32_t block_type;
- int result = 0;
-
- /* get block type */
- block_type = get_vlc2(bitbuf, svq1_block_type.table, 2, 2);
-
- /* reset motion vectors */
- if (block_type == SVQ1_BLOCK_SKIP || block_type == SVQ1_BLOCK_INTRA) {
- motion[0].x =
- motion[0].y =
- motion[(x / 8) + 2].x =
- motion[(x / 8) + 2].y =
- motion[(x / 8) + 3].x =
- motion[(x / 8) + 3].y = 0;
- }
-
- switch (block_type) {
- case SVQ1_BLOCK_SKIP:
- svq1_skip_block (current, previous, pitch, x, y);
- break;
-
- case SVQ1_BLOCK_INTER:
- result = svq1_motion_inter_block (s, bitbuf, current, previous, pitch, motion, x, y);
+ // FIXME: clipping or padding?
+ mvx = av_clip(mvx, -2 * x, 2 * (width - x - 8));
+ mvy = av_clip(mvy, -2 * y, 2 * (height - y - 8));
- if (result != 0)
- {
- av_dlog(s->avctx, "Error in svq1_motion_inter_block %i\n", result);
- break;
- }
- result = svq1_decode_block_non_intra (bitbuf, current, pitch);
- break;
+ src = &previous[(x + (mvx >> 1)) + (y + (mvy >> 1)) * pitch];
+ dst = current;
- case SVQ1_BLOCK_INTER_4V:
- result = svq1_motion_inter_4v_block (s, bitbuf, current, previous, pitch, motion, x, y);
+ dsp->put_pixels_tab[1][((mvy & 1) << 1) | (mvx & 1)](dst, src, pitch, 8);
- if (result != 0)
- {
- av_dlog(s->avctx, "Error in svq1_motion_inter_4v_block %i\n", result);
- break;
+ /* select next block */
+ if (i & 1)
+ current += 8 * (pitch - 1);
+ else
+ current += 8;
}
- result = svq1_decode_block_non_intra (bitbuf, current, pitch);
- break;
-
- case SVQ1_BLOCK_INTRA:
- result = svq1_decode_block_intra (bitbuf, current, pitch);
- break;
- }
- return result;
+ return 0;
}
-uint16_t ff_svq1_packet_checksum (const uint8_t *data, const int length, int value) {
- int i;
+static int svq1_decode_delta_block(AVCodecContext *avctx, DSPContext *dsp,
+ GetBitContext *bitbuf,
+ uint8_t *current, uint8_t *previous,
+ int pitch, svq1_pmv *motion, int x, int y,
+ int width, int height)
+{
+ uint32_t block_type;
+ int result = 0;
+
+ /* get block type */
+ block_type = get_vlc2(bitbuf, svq1_block_type.table, 2, 2);
+
+ /* reset motion vectors */
+ if (block_type == SVQ1_BLOCK_SKIP || block_type == SVQ1_BLOCK_INTRA) {
+ motion[0].x =
+ motion[0].y =
+ motion[x / 8 + 2].x =
+ motion[x / 8 + 2].y =
+ motion[x / 8 + 3].x =
+ motion[x / 8 + 3].y = 0;
+ }
- for (i=0; i < length; i++) {
- value = checksum_table[data[i] ^ (value >> 8)] ^ ((value & 0xFF) << 8);
- }
+ switch (block_type) {
+ case SVQ1_BLOCK_SKIP:
+ svq1_skip_block(current, previous, pitch, x, y);
+ break;
- return value;
-}
+ case SVQ1_BLOCK_INTER:
+ result = svq1_motion_inter_block(dsp, bitbuf, current, previous,
+ pitch, motion, x, y, width, height);
-static void svq1_parse_string (GetBitContext *bitbuf, uint8_t *out) {
- uint8_t seed;
- int i;
+ if (result != 0) {
+ av_dlog(avctx, "Error in svq1_motion_inter_block %i\n", result);
+ break;
+ }
+ result = svq1_decode_block_non_intra(bitbuf, current, pitch);
+ break;
- out[0] = get_bits (bitbuf, 8);
+ case SVQ1_BLOCK_INTER_4V:
+ result = svq1_motion_inter_4v_block(dsp, bitbuf, current, previous,
+ pitch, motion, x, y, width, height);
- seed = string_table[out[0]];
+ if (result != 0) {
+ av_dlog(avctx, "Error in svq1_motion_inter_4v_block %i\n", result);
+ break;
+ }
+ result = svq1_decode_block_non_intra(bitbuf, current, pitch);
+ break;
- for (i=1; i <= out[0]; i++) {
- out[i] = get_bits (bitbuf, 8) ^ seed;
- seed = string_table[out[i] ^ seed];
- }
+ case SVQ1_BLOCK_INTRA:
+ result = svq1_decode_block_intra(bitbuf, current, pitch);
+ break;
+ }
+
+ return result;
}
-static int svq1_decode_frame_header (GetBitContext *bitbuf,MpegEncContext *s) {
- int frame_size_code;
+static void svq1_parse_string(GetBitContext *bitbuf, uint8_t *out)
+{
+ uint8_t seed;
+ int i;
- skip_bits(bitbuf, 8); /* temporal_reference */
+ out[0] = get_bits(bitbuf, 8);
+ seed = string_table[out[0]];
- /* frame type */
- s->pict_type= get_bits (bitbuf, 2)+1;
- if(s->pict_type==4)
- return -1;
+ for (i = 1; i <= out[0]; i++) {
+ out[i] = get_bits(bitbuf, 8) ^ seed;
+ seed = string_table[out[i] ^ seed];
+ }
+}
- if (s->pict_type == AV_PICTURE_TYPE_I) {
+static int svq1_decode_frame_header(AVCodecContext *avctx, AVFrame *frame)
+{
+ SVQ1Context *s = avctx->priv_data;
+ GetBitContext *bitbuf = &s->gb;
+ int frame_size_code;
+
+ skip_bits(bitbuf, 8); /* temporal_reference */
+
+ /* frame type */
+ s->nonref = 0;
+ switch (get_bits(bitbuf, 2)) {
+ case 0:
+ frame->pict_type = AV_PICTURE_TYPE_I;
+ break;
+ case 2:
+ s->nonref = 1;
+ case 1:
+ frame->pict_type = AV_PICTURE_TYPE_P;
+ break;
+ default:
+ av_log(avctx, AV_LOG_ERROR, "Invalid frame type.\n");
+ return AVERROR_INVALIDDATA;
+ }
- /* unknown fields */
- if (s->f_code == 0x50 || s->f_code == 0x60) {
- int csum = get_bits (bitbuf, 16);
+ if (frame->pict_type == AV_PICTURE_TYPE_I) {
+ /* unknown fields */
+ if (s->frame_code == 0x50 || s->frame_code == 0x60) {
+ int csum = get_bits(bitbuf, 16);
- csum = ff_svq1_packet_checksum (bitbuf->buffer, bitbuf->size_in_bits>>3, csum);
+ csum = ff_svq1_packet_checksum(bitbuf->buffer,
+ bitbuf->size_in_bits >> 3,
+ csum);
-// av_log(s->avctx, AV_LOG_INFO, "%s checksum (%02x) for packet data\n",
-// (csum == 0) ? "correct" : "incorrect", csum);
- }
+ av_dlog(avctx, "%s checksum (%02x) for packet data\n",
+ (csum == 0) ? "correct" : "incorrect", csum);
+ }
- if ((s->f_code ^ 0x10) >= 0x50) {
- uint8_t msg[256];
+ if ((s->frame_code ^ 0x10) >= 0x50) {
+ uint8_t msg[256];
- svq1_parse_string (bitbuf, msg);
+ svq1_parse_string(bitbuf, msg);
- av_log(s->avctx, AV_LOG_INFO, "embedded message: \"%s\"\n", (char *) msg);
- }
+ av_log(avctx, AV_LOG_INFO,
+ "embedded message: \"%s\"\n", (char *)msg);
+ }
- skip_bits (bitbuf, 2);
- skip_bits (bitbuf, 2);
- skip_bits1 (bitbuf);
+ skip_bits(bitbuf, 2);
+ skip_bits(bitbuf, 2);
+ skip_bits1(bitbuf);
- /* load frame size */
- frame_size_code = get_bits (bitbuf, 3);
+ /* load frame size */
+ frame_size_code = get_bits(bitbuf, 3);
- if (frame_size_code == 7) {
- /* load width, height (12 bits each) */
- s->width = get_bits (bitbuf, 12);
- s->height = get_bits (bitbuf, 12);
+ if (frame_size_code == 7) {
+ /* load width, height (12 bits each) */
+ s->width = get_bits(bitbuf, 12);
+ s->height = get_bits(bitbuf, 12);
- if (!s->width || !s->height)
- return -1;
- } else {
- /* get width, height from table */
- s->width = ff_svq1_frame_size_table[frame_size_code].width;
- s->height = ff_svq1_frame_size_table[frame_size_code].height;
+ if (!s->width || !s->height)
+ return AVERROR_INVALIDDATA;
+ } else {
+ /* get width, height from table */
+ s->width = ff_svq1_frame_size_table[frame_size_code].width;
+ s->height = ff_svq1_frame_size_table[frame_size_code].height;
+ }
}
- }
- /* unknown fields */
- if (get_bits1 (bitbuf) == 1) {
- skip_bits1 (bitbuf); /* use packet checksum if (1) */
- skip_bits1 (bitbuf); /* component checksums after image data if (1) */
+ /* unknown fields */
+ if (get_bits1(bitbuf) == 1) {
+ skip_bits1(bitbuf); /* use packet checksum if (1) */
+ skip_bits1(bitbuf); /* component checksums after image data if (1) */
- if (get_bits (bitbuf, 2) != 0)
- return -1;
- }
+ if (get_bits(bitbuf, 2) != 0)
+ return AVERROR_INVALIDDATA;
+ }
- if (get_bits1 (bitbuf) == 1) {
- skip_bits1 (bitbuf);
- skip_bits (bitbuf, 4);
- skip_bits1 (bitbuf);
- skip_bits (bitbuf, 2);
+ if (get_bits1(bitbuf) == 1) {
+ skip_bits1(bitbuf);
+ skip_bits(bitbuf, 4);
+ skip_bits1(bitbuf);
+ skip_bits(bitbuf, 2);
- while (get_bits1 (bitbuf) == 1) {
- skip_bits (bitbuf, 8);
+ while (get_bits1(bitbuf) == 1)
+ skip_bits(bitbuf, 8);
}
- }
- return 0;
+ return 0;
}
-static int svq1_decode_frame(AVCodecContext *avctx,
- void *data, int *data_size,
- AVPacket *avpkt)
+static int svq1_decode_frame(AVCodecContext *avctx, void *data,
+ int *got_frame, AVPacket *avpkt)
{
- const uint8_t *buf = avpkt->data;
- int buf_size = avpkt->size;
- MpegEncContext *s=avctx->priv_data;
- uint8_t *current, *previous;
- int result, i, x, y, width, height;
- AVFrame *pict = data;
- svq1_pmv *pmv;
-
- /* initialize bit buffer */
- init_get_bits(&s->gb,buf,buf_size*8);
+ const uint8_t *buf = avpkt->data;
+ int buf_size = avpkt->size;
+ SVQ1Context *s = avctx->priv_data;
+ AVFrame *cur = s->cur;
+ uint8_t *current;
+ int result, i, x, y, width, height;
+ svq1_pmv *pmv;
- /* decode frame header */
- s->f_code = get_bits (&s->gb, 22);
+ if (cur->data[0])
+ avctx->release_buffer(avctx, cur);
- if ((s->f_code & ~0x70) || !(s->f_code & 0x60))
- return -1;
+ /* initialize bit buffer */
+ init_get_bits(&s->gb, buf, buf_size * 8);
- /* swap some header bytes (why?) */
- if (s->f_code != 0x20) {
- uint32_t *src = (uint32_t *) (buf + 4);
+ /* decode frame header */
+ s->frame_code = get_bits(&s->gb, 22);
- for (i=0; i < 4; i++) {
- src[i] = ((src[i] << 16) | (src[i] >> 16)) ^ src[7 - i];
- }
- }
+ if ((s->frame_code & ~0x70) || !(s->frame_code & 0x60))
+ return AVERROR_INVALIDDATA;
- result = svq1_decode_frame_header (&s->gb, s);
+ /* swap some header bytes (why?) */
+ if (s->frame_code != 0x20) {
+ uint32_t *src = (uint32_t *)(buf + 4);
- if (result != 0)
- {
- av_dlog(s->avctx, "Error in svq1_decode_frame_header %i\n",result);
- return result;
- }
- avcodec_set_dimensions(avctx, s->width, s->height);
-
- //FIXME this avoids some confusion for "B frames" without 2 references
- //this should be removed after libavcodec can handle more flexible picture types & ordering
- if(s->pict_type==AV_PICTURE_TYPE_B && s->last_picture_ptr==NULL) return buf_size;
-
- 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)
- return buf_size;
-
- if(MPV_frame_start(s, avctx) < 0)
- return -1;
-
- pmv = av_malloc((FFALIGN(s->width, 16)/8 + 3) * sizeof(*pmv));
- if (!pmv)
- return -1;
-
- /* decode y, u and v components */
- for (i=0; i < 3; i++) {
- int linesize;
- if (i == 0) {
- width = FFALIGN(s->width, 16);
- height = FFALIGN(s->height, 16);
- linesize= s->linesize;
- } else {
- if(s->flags&CODEC_FLAG_GRAY) break;
- width = FFALIGN(s->width/4, 16);
- height = FFALIGN(s->height/4, 16);
- linesize= s->uvlinesize;
+ for (i = 0; i < 4; i++)
+ src[i] = ((src[i] << 16) | (src[i] >> 16)) ^ src[7 - i];
}
- current = s->current_picture.f.data[i];
+ result = svq1_decode_frame_header(avctx, cur);
- if(s->pict_type==AV_PICTURE_TYPE_B){
- previous = s->next_picture.f.data[i];
- }else{
- previous = s->last_picture.f.data[i];
+ if (result != 0) {
+ av_dlog(avctx, "Error in svq1_decode_frame_header %i\n", result);
+ return result;
}
-
- if (s->pict_type == AV_PICTURE_TYPE_I) {
- /* keyframe */
- for (y=0; y < height; y+=16) {
- for (x=0; x < width; x+=16) {
- result = svq1_decode_block_intra (&s->gb, &current[x], linesize);
- if (result != 0)
- {
- av_log(s->avctx, AV_LOG_INFO, "Error in svq1_decode_block %i (keyframe)\n",result);
- goto err;
- }
+ avcodec_set_dimensions(avctx, s->width, s->height);
+
+ if ((avctx->skip_frame >= AVDISCARD_NONREF && s->nonref) ||
+ (avctx->skip_frame >= AVDISCARD_NONKEY &&
+ cur->pict_type != AV_PICTURE_TYPE_I) ||
+ avctx->skip_frame >= AVDISCARD_ALL)
+ return buf_size;
+
+ result = ff_get_buffer(avctx, cur);
+ if (result < 0)
+ return result;
+
+ pmv = av_malloc((FFALIGN(s->width, 16) / 8 + 3) * sizeof(*pmv));
+ if (!pmv)
+ return AVERROR(ENOMEM);
+
+ /* decode y, u and v components */
+ for (i = 0; i < 3; i++) {
+ int linesize = cur->linesize[i];
+ if (i == 0) {
+ width = FFALIGN(s->width, 16);
+ height = FFALIGN(s->height, 16);
+ } else {
+ if (avctx->flags & CODEC_FLAG_GRAY)
+ break;
+ width = FFALIGN(s->width / 4, 16);
+ height = FFALIGN(s->height / 4, 16);
}
- current += 16*linesize;
- }
- } else {
- /* delta frame */
- memset (pmv, 0, ((width / 8) + 3) * sizeof(svq1_pmv));
-
- for (y=0; y < height; y+=16) {
- for (x=0; x < width; x+=16) {
- result = svq1_decode_delta_block (s, &s->gb, &current[x], previous,
- linesize, pmv, x, y);
- if (result != 0)
- {
- av_dlog(s->avctx, "Error in svq1_decode_delta_block %i\n",result);
- goto err;
- }
- }
-
- pmv[0].x =
- pmv[0].y = 0;
- current += 16*linesize;
- }
+ current = cur->data[i];
+
+ if (cur->pict_type == AV_PICTURE_TYPE_I) {
+ /* keyframe */
+ for (y = 0; y < height; y += 16) {
+ for (x = 0; x < width; x += 16) {
+ result = svq1_decode_block_intra(&s->gb, &current[x],
+ linesize);
+ if (result != 0) {
+ av_log(avctx, AV_LOG_INFO,
+ "Error in svq1_decode_block %i (keyframe)\n",
+ result);
+ goto err;
+ }
+ }
+ current += 16 * linesize;
+ }
+ } else {
+ /* delta frame */
+ uint8_t *previous = s->prev->data[i];
+ if (!previous ||
+ s->prev->width != s->width || s->prev->height != s->height) {
+ av_log(avctx, AV_LOG_ERROR, "Missing reference frame.\n");
+ result = AVERROR_INVALIDDATA;
+ goto err;
+ }
+
+ memset(pmv, 0, ((width / 8) + 3) * sizeof(svq1_pmv));
+
+ for (y = 0; y < height; y += 16) {
+ for (x = 0; x < width; x += 16) {
+ result = svq1_decode_delta_block(avctx, &s->dsp,
+ &s->gb, &current[x],
+ previous, linesize,
+ pmv, x, y, width, height);
+ if (result != 0) {
+ av_dlog(avctx,
+ "Error in svq1_decode_delta_block %i\n",
+ result);
+ goto err;
+ }
+ }
+
+ pmv[0].x =
+ pmv[0].y = 0;
+
+ current += 16 * linesize;
+ }
+ }
}
- }
-
- *pict = *(AVFrame*)&s->current_picture;
+ *(AVFrame*)data = *cur;
+ if (!s->nonref)
+ FFSWAP(AVFrame*, s->cur, s->prev);
- MPV_frame_end(s);
+ *got_frame = 1;
+ result = buf_size;
- *data_size=sizeof(AVFrame);
- result = buf_size;
err:
- av_free(pmv);
- return result;
+ av_free(pmv);
+ return result;
}
static av_cold int svq1_decode_init(AVCodecContext *avctx)
{
- MpegEncContext *s = avctx->priv_data;
+ SVQ1Context *s = avctx->priv_data;
int i;
int offset = 0;
- MPV_decode_defaults(s);
+ s->cur = avcodec_alloc_frame();
+ s->prev = avcodec_alloc_frame();
+ if (!s->cur || !s->prev) {
+ avcodec_free_frame(&s->cur);
+ avcodec_free_frame(&s->prev);
+ return AVERROR(ENOMEM);
+ }
+
+ s->width = avctx->width + 3 & ~3;
+ s->height = avctx->height + 3 & ~3;
+ avctx->pix_fmt = AV_PIX_FMT_YUV410P;
- s->avctx = avctx;
- s->width = (avctx->width+3)&~3;
- s->height = (avctx->height+3)&~3;
- s->codec_id= avctx->codec->id;
- avctx->pix_fmt = PIX_FMT_YUV410P;
- avctx->has_b_frames= 1; // not true, but DP frames and these behave like unidirectional b frames
- s->flags= avctx->flags;
- if (MPV_common_init(s) < 0) return -1;
+ ff_dsputil_init(&s->dsp, avctx);
INIT_VLC_STATIC(&svq1_block_type, 2, 4,
- &ff_svq1_block_type_vlc[0][1], 2, 1,
- &ff_svq1_block_type_vlc[0][0], 2, 1, 6);
+ &ff_svq1_block_type_vlc[0][1], 2, 1,
+ &ff_svq1_block_type_vlc[0][0], 2, 1, 6);
INIT_VLC_STATIC(&svq1_motion_component, 7, 33,
- &ff_mvtab[0][1], 2, 1,
- &ff_mvtab[0][0], 2, 1, 176);
+ &ff_mvtab[0][1], 2, 1,
+ &ff_mvtab[0][0], 2, 1, 176);
for (i = 0; i < 6; i++) {
- static const uint8_t sizes[2][6] = {{14, 10, 14, 18, 16, 18}, {10, 10, 14, 14, 14, 16}};
+ static const uint8_t sizes[2][6] = { { 14, 10, 14, 18, 16, 18 },
+ { 10, 10, 14, 14, 14, 16 } };
static VLC_TYPE table[168][2];
- svq1_intra_multistage[i].table = &table[offset];
+ svq1_intra_multistage[i].table = &table[offset];
svq1_intra_multistage[i].table_allocated = sizes[0][i];
- offset += sizes[0][i];
+ offset += sizes[0][i];
init_vlc(&svq1_intra_multistage[i], 3, 8,
- &ff_svq1_intra_multistage_vlc[i][0][1], 2, 1,
- &ff_svq1_intra_multistage_vlc[i][0][0], 2, 1, INIT_VLC_USE_NEW_STATIC);
- svq1_inter_multistage[i].table = &table[offset];
+ &ff_svq1_intra_multistage_vlc[i][0][1], 2, 1,
+ &ff_svq1_intra_multistage_vlc[i][0][0], 2, 1,
+ INIT_VLC_USE_NEW_STATIC);
+ svq1_inter_multistage[i].table = &table[offset];
svq1_inter_multistage[i].table_allocated = sizes[1][i];
- offset += sizes[1][i];
+ offset += sizes[1][i];
init_vlc(&svq1_inter_multistage[i], 3, 8,
- &ff_svq1_inter_multistage_vlc[i][0][1], 2, 1,
- &ff_svq1_inter_multistage_vlc[i][0][0], 2, 1, INIT_VLC_USE_NEW_STATIC);
+ &ff_svq1_inter_multistage_vlc[i][0][1], 2, 1,
+ &ff_svq1_inter_multistage_vlc[i][0][0], 2, 1,
+ INIT_VLC_USE_NEW_STATIC);
}
INIT_VLC_STATIC(&svq1_intra_mean, 8, 256,
- &ff_svq1_intra_mean_vlc[0][1], 4, 2,
- &ff_svq1_intra_mean_vlc[0][0], 4, 2, 632);
+ &ff_svq1_intra_mean_vlc[0][1], 4, 2,
+ &ff_svq1_intra_mean_vlc[0][0], 4, 2, 632);
INIT_VLC_STATIC(&svq1_inter_mean, 9, 512,
- &ff_svq1_inter_mean_vlc[0][1], 4, 2,
- &ff_svq1_inter_mean_vlc[0][0], 4, 2, 1434);
+ &ff_svq1_inter_mean_vlc[0][1], 4, 2,
+ &ff_svq1_inter_mean_vlc[0][0], 4, 2, 1434);
return 0;
}
static av_cold int svq1_decode_end(AVCodecContext *avctx)
{
- MpegEncContext *s = avctx->priv_data;
+ SVQ1Context *s = avctx->priv_data;
+
+ if (s->cur->data[0])
+ avctx->release_buffer(avctx, s->cur);
+ if (s->prev->data[0])
+ avctx->release_buffer(avctx, s->prev);
+ avcodec_free_frame(&s->cur);
+ avcodec_free_frame(&s->prev);
- MPV_common_end(s);
return 0;
}
+static void svq1_flush(AVCodecContext *avctx)
+{
+ SVQ1Context *s = avctx->priv_data;
+
+ if (s->cur->data[0])
+ avctx->release_buffer(avctx, s->cur);
+ if (s->prev->data[0])
+ avctx->release_buffer(avctx, s->prev);
+}
AVCodec ff_svq1_decoder = {
.name = "svq1",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_SVQ1,
- .priv_data_size = sizeof(MpegEncContext),
+ .id = AV_CODEC_ID_SVQ1,
+ .priv_data_size = sizeof(SVQ1Context),
.init = svq1_decode_init,
.close = svq1_decode_end,
.decode = svq1_decode_frame,
.capabilities = CODEC_CAP_DR1,
- .flush= ff_mpeg_flush,
- .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV410P, PIX_FMT_NONE},
- .long_name= NULL_IF_CONFIG_SMALL("Sorenson Vector Quantizer 1 / Sorenson Video 1 / SVQ1"),
+ .flush = svq1_flush,
+ .pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_YUV410P,
+ AV_PIX_FMT_NONE },
+ .long_name = NULL_IF_CONFIG_SMALL("Sorenson Vector Quantizer 1 / Sorenson Video 1 / SVQ1"),
};
diff --git a/gst-libs/ext/libav/libavcodec/svq1enc.c b/gst-libs/ext/libav/libavcodec/svq1enc.c
index ef136b9..21531f6 100644
--- a/gst-libs/ext/libav/libavcodec/svq1enc.c
+++ b/gst-libs/ext/libav/libavcodec/svq1enc.c
@@ -26,22 +26,22 @@
* http://www.pcisys.net/~melanson/codecs/
*/
-
#include "avcodec.h"
#include "dsputil.h"
#include "mpegvideo.h"
#include "h263.h"
#include "internal.h"
-
#include "svq1.h"
#include "svq1enc_cb.h"
#undef NDEBUG
#include <assert.h>
-
typedef struct SVQ1Context {
- MpegEncContext m; // needed for motion estimation, should not be used for anything else, the idea is to make the motion estimation eventually independent of MpegEncContext, so this will be removed then (FIXME/XXX)
+ /* FIXME: Needed for motion estimation, should not be used for anything
+ * else, the idea is to make the motion estimation eventually independent
+ * of MpegEncContext, so this will be removed then. */
+ MpegEncContext m;
AVCodecContext *avctx;
DSPContext dsp;
AVFrame picture;
@@ -50,7 +50,9 @@ typedef struct SVQ1Context {
PutBitContext pb;
GetBitContext gb;
- PutBitContext reorder_pb[6]; //why ooh why this sick breadth first order, everything is slower and more complex
+ /* why ooh why this sick breadth first order,
+ * everything is slower and more complex */
+ PutBitContext reorder_pb[6];
int frame_width;
int frame_height;
@@ -87,21 +89,19 @@ static void svq1_write_header(SVQ1Context *s, int frame_type)
put_bits(&s->pb, 2, frame_type - 1);
if (frame_type == AV_PICTURE_TYPE_I) {
-
/* no checksum since frame code is 0x20 */
-
/* no embedded string either */
-
/* output 5 unknown bits (2 + 2 + 1) */
put_bits(&s->pb, 5, 2); /* 2 needed by quicktime decoder */
- i= ff_match_2uint16(ff_svq1_frame_size_table, FF_ARRAY_ELEMS(ff_svq1_frame_size_table), s->frame_width, s->frame_height);
+ i = ff_match_2uint16(ff_svq1_frame_size_table,
+ FF_ARRAY_ELEMS(ff_svq1_frame_size_table),
+ s->frame_width, s->frame_height);
put_bits(&s->pb, 3, i);
- if (i == 7)
- {
- put_bits(&s->pb, 12, s->frame_width);
- put_bits(&s->pb, 12, s->frame_height);
+ if (i == 7) {
+ put_bits(&s->pb, 12, s->frame_width);
+ put_bits(&s->pb, 12, s->frame_height);
}
}
@@ -109,448 +109,498 @@ static void svq1_write_header(SVQ1Context *s, int frame_type)
put_bits(&s->pb, 2, 0);
}
-
-#define QUALITY_THRESHOLD 100
+#define QUALITY_THRESHOLD 100
#define THRESHOLD_MULTIPLIER 0.6
-static int encode_block(SVQ1Context *s, uint8_t *src, uint8_t *ref, uint8_t *decoded, int stride, int level, int threshold, int lambda, int intra){
+static int encode_block(SVQ1Context *s, uint8_t *src, uint8_t *ref,
+ uint8_t *decoded, int stride, int level,
+ int threshold, int lambda, int intra)
+{
int count, y, x, i, j, split, best_mean, best_score, best_count;
int best_vector[6];
- int block_sum[7]= {0, 0, 0, 0, 0, 0};
- int w= 2<<((level+2)>>1);
- int h= 2<<((level+1)>>1);
- int size=w*h;
+ int block_sum[7] = { 0, 0, 0, 0, 0, 0 };
+ int w = 2 << (level + 2 >> 1);
+ int h = 2 << (level + 1 >> 1);
+ int size = w * h;
int16_t block[7][256];
const int8_t *codebook_sum, *codebook;
- const uint16_t (*mean_vlc)[2];
- const uint8_t (*multistage_vlc)[2];
-
- best_score=0;
- //FIXME optimize, this doenst need to be done multiple times
- if(intra){
- codebook_sum= svq1_intra_codebook_sum[level];
- codebook= ff_svq1_intra_codebooks[level];
- mean_vlc= ff_svq1_intra_mean_vlc;
- multistage_vlc= ff_svq1_intra_multistage_vlc[level];
- for(y=0; y<h; y++){
- for(x=0; x<w; x++){
- int v= src[x + y*stride];
- block[0][x + w*y]= v;
- best_score += v*v;
- block_sum[0] += v;
+ const uint16_t(*mean_vlc)[2];
+ const uint8_t(*multistage_vlc)[2];
+
+ best_score = 0;
+ // FIXME: Optimize, this does not need to be done multiple times.
+ if (intra) {
+ codebook_sum = svq1_intra_codebook_sum[level];
+ codebook = ff_svq1_intra_codebooks[level];
+ mean_vlc = ff_svq1_intra_mean_vlc;
+ multistage_vlc = ff_svq1_intra_multistage_vlc[level];
+ for (y = 0; y < h; y++) {
+ for (x = 0; x < w; x++) {
+ int v = src[x + y * stride];
+ block[0][x + w * y] = v;
+ best_score += v * v;
+ block_sum[0] += v;
}
}
- }else{
- codebook_sum= svq1_inter_codebook_sum[level];
- codebook= ff_svq1_inter_codebooks[level];
- mean_vlc= ff_svq1_inter_mean_vlc + 256;
- multistage_vlc= ff_svq1_inter_multistage_vlc[level];
- for(y=0; y<h; y++){
- for(x=0; x<w; x++){
- int v= src[x + y*stride] - ref[x + y*stride];
- block[0][x + w*y]= v;
- best_score += v*v;
- block_sum[0] += v;
+ } else {
+ codebook_sum = svq1_inter_codebook_sum[level];
+ codebook = ff_svq1_inter_codebooks[level];
+ mean_vlc = ff_svq1_inter_mean_vlc + 256;
+ multistage_vlc = ff_svq1_inter_multistage_vlc[level];
+ for (y = 0; y < h; y++) {
+ for (x = 0; x < w; x++) {
+ int v = src[x + y * stride] - ref[x + y * stride];
+ block[0][x + w * y] = v;
+ best_score += v * v;
+ block_sum[0] += v;
}
}
}
- best_count=0;
- best_score -= (int)(((unsigned)block_sum[0]*block_sum[0])>>(level+3));
- best_mean= (block_sum[0] + (size>>1)) >> (level+3);
+ best_count = 0;
+ best_score -= (int)((unsigned)block_sum[0] * block_sum[0] >> (level + 3));
+ best_mean = block_sum[0] + (size >> 1) >> (level + 3);
- if(level<4){
- for(count=1; count<7; count++){
- int best_vector_score= INT_MAX;
- int best_vector_sum=-999, best_vector_mean=-999;
- const int stage= count-1;
+ if (level < 4) {
+ for (count = 1; count < 7; count++) {
+ int best_vector_score = INT_MAX;
+ int best_vector_sum = -999, best_vector_mean = -999;
+ const int stage = count - 1;
const int8_t *vector;
- for(i=0; i<16; i++){
- int sum= codebook_sum[stage*16 + i];
+ for (i = 0; i < 16; i++) {
+ int sum = codebook_sum[stage * 16 + i];
int sqr, diff, score;
- vector = codebook + stage*size*16 + i*size;
- sqr = s->dsp.ssd_int8_vs_int16(vector, block[stage], size);
- diff= block_sum[stage] - sum;
- score= sqr - ((diff*(int64_t)diff)>>(level+3)); //FIXME 64bit slooow
- if(score < best_vector_score){
- int mean= (diff + (size>>1)) >> (level+3);
- assert(mean >-300 && mean<300);
- mean= av_clip(mean, intra?0:-256, 255);
- best_vector_score= score;
- best_vector[stage]= i;
- best_vector_sum= sum;
- best_vector_mean= mean;
+ vector = codebook + stage * size * 16 + i * size;
+ sqr = s->dsp.ssd_int8_vs_int16(vector, block[stage], size);
+ diff = block_sum[stage] - sum;
+ score = sqr - (diff * (int64_t)diff >> (level + 3)); // FIXME: 64bit slooow
+ if (score < best_vector_score) {
+ int mean = diff + (size >> 1) >> (level + 3);
+ assert(mean > -300 && mean < 300);
+ mean = av_clip(mean, intra ? 0 : -256, 255);
+ best_vector_score = score;
+ best_vector[stage] = i;
+ best_vector_sum = sum;
+ best_vector_mean = mean;
}
}
assert(best_vector_mean != -999);
- vector= codebook + stage*size*16 + best_vector[stage]*size;
- for(j=0; j<size; j++){
- block[stage+1][j] = block[stage][j] - vector[j];
- }
- block_sum[stage+1]= block_sum[stage] - best_vector_sum;
- best_vector_score +=
- lambda*(+ 1 + 4*count
- + multistage_vlc[1+count][1]
- + mean_vlc[best_vector_mean][1]);
-
- if(best_vector_score < best_score){
- best_score= best_vector_score;
- best_count= count;
- best_mean= best_vector_mean;
+ vector = codebook + stage * size * 16 + best_vector[stage] * size;
+ for (j = 0; j < size; j++)
+ block[stage + 1][j] = block[stage][j] - vector[j];
+ block_sum[stage + 1] = block_sum[stage] - best_vector_sum;
+ best_vector_score += lambda *
+ (+1 + 4 * count +
+ multistage_vlc[1 + count][1]
+ + mean_vlc[best_vector_mean][1]);
+
+ if (best_vector_score < best_score) {
+ best_score = best_vector_score;
+ best_count = count;
+ best_mean = best_vector_mean;
}
}
}
- split=0;
- if(best_score > threshold && level){
- int score=0;
- int offset= (level&1) ? stride*h/2 : w/2;
+ split = 0;
+ if (best_score > threshold && level) {
+ int score = 0;
+ int offset = level & 1 ? stride * h / 2 : w / 2;
PutBitContext backup[6];
- for(i=level-1; i>=0; i--){
- backup[i]= s->reorder_pb[i];
- }
- score += encode_block(s, src , ref , decoded , stride, level-1, threshold>>1, lambda, intra);
- score += encode_block(s, src + offset, ref + offset, decoded + offset, stride, level-1, threshold>>1, lambda, intra);
+ for (i = level - 1; i >= 0; i--)
+ backup[i] = s->reorder_pb[i];
+ score += encode_block(s, src, ref, decoded, stride, level - 1,
+ threshold >> 1, lambda, intra);
+ score += encode_block(s, src + offset, ref + offset, decoded + offset,
+ stride, level - 1, threshold >> 1, lambda, intra);
score += lambda;
- if(score < best_score){
- best_score= score;
- split=1;
- }else{
- for(i=level-1; i>=0; i--){
- s->reorder_pb[i]= backup[i];
- }
+ if (score < best_score) {
+ best_score = score;
+ split = 1;
+ } else {
+ for (i = level - 1; i >= 0; i--)
+ s->reorder_pb[i] = backup[i];
}
}
if (level > 0)
put_bits(&s->reorder_pb[level], 1, split);
- if(!split){
- assert((best_mean >= 0 && best_mean<256) || !intra);
- assert(best_mean >= -256 && best_mean<256);
- assert(best_count >=0 && best_count<7);
- assert(level<4 || best_count==0);
+ if (!split) {
+ assert(best_mean >= 0 && best_mean < 256 || !intra);
+ assert(best_mean >= -256 && best_mean < 256);
+ assert(best_count >= 0 && best_count < 7);
+ assert(level < 4 || best_count == 0);
/* output the encoding */
put_bits(&s->reorder_pb[level],
- multistage_vlc[1 + best_count][1],
- multistage_vlc[1 + best_count][0]);
+ multistage_vlc[1 + best_count][1],
+ multistage_vlc[1 + best_count][0]);
put_bits(&s->reorder_pb[level], mean_vlc[best_mean][1],
- mean_vlc[best_mean][0]);
+ mean_vlc[best_mean][0]);
- for (i = 0; i < best_count; i++){
- assert(best_vector[i]>=0 && best_vector[i]<16);
+ for (i = 0; i < best_count; i++) {
+ assert(best_vector[i] >= 0 && best_vector[i] < 16);
put_bits(&s->reorder_pb[level], 4, best_vector[i]);
}
- for(y=0; y<h; y++){
- for(x=0; x<w; x++){
- decoded[x + y*stride]= src[x + y*stride] - block[best_count][x + w*y] + best_mean;
- }
- }
+ for (y = 0; y < h; y++)
+ for (x = 0; x < w; x++)
+ decoded[x + y * stride] = src[x + y * stride] -
+ block[best_count][x + w * y] +
+ best_mean;
}
return best_score;
}
-
-static int svq1_encode_plane(SVQ1Context *s, int plane, unsigned char *src_plane, unsigned char *ref_plane, unsigned char *decoded_plane,
- int width, int height, int src_stride, int stride)
+static int svq1_encode_plane(SVQ1Context *s, int plane,
+ unsigned char *src_plane,
+ unsigned char *ref_plane,
+ unsigned char *decoded_plane,
+ int width, int height, int src_stride, int stride)
{
int x, y;
int i;
int block_width, block_height;
int level;
int threshold[6];
- uint8_t *src = s->scratchbuf + stride * 16;
- const int lambda= (s->picture.quality*s->picture.quality) >> (2*FF_LAMBDA_SHIFT);
+ uint8_t *src = s->scratchbuf + stride * 16;
+ const int lambda = (s->picture.quality * s->picture.quality) >>
+ (2 * FF_LAMBDA_SHIFT);
/* figure out the acceptable level thresholds in advance */
threshold[5] = QUALITY_THRESHOLD;
for (level = 4; level >= 0; level--)
threshold[level] = threshold[level + 1] * THRESHOLD_MULTIPLIER;
- block_width = (width + 15) / 16;
+ block_width = (width + 15) / 16;
block_height = (height + 15) / 16;
- if(s->picture.pict_type == AV_PICTURE_TYPE_P){
- s->m.avctx= s->avctx;
- s->m.current_picture_ptr= &s->m.current_picture;
- s->m.last_picture_ptr = &s->m.last_picture;
- s->m.last_picture.f.data[0] = ref_plane;
- s->m.linesize=
- s->m.last_picture.f.linesize[0] =
- s->m.new_picture.f.linesize[0] =
+ if (s->picture.pict_type == AV_PICTURE_TYPE_P) {
+ s->m.avctx = s->avctx;
+ s->m.current_picture_ptr = &s->m.current_picture;
+ s->m.last_picture_ptr = &s->m.last_picture;
+ s->m.last_picture.f.data[0] = ref_plane;
+ s->m.linesize =
+ s->m.last_picture.f.linesize[0] =
+ s->m.new_picture.f.linesize[0] =
s->m.current_picture.f.linesize[0] = stride;
- s->m.width= width;
- s->m.height= height;
- s->m.mb_width= block_width;
- s->m.mb_height= block_height;
- s->m.mb_stride= s->m.mb_width+1;
- s->m.b8_stride= 2*s->m.mb_width+1;
- s->m.f_code=1;
- s->m.pict_type= s->picture.pict_type;
- s->m.me_method= s->avctx->me_method;
- s->m.me.scene_change_score=0;
- s->m.flags= s->avctx->flags;
-// s->m.out_format = FMT_H263;
-// s->m.unrestricted_mv= 1;
-
- s->m.lambda= s->picture.quality;
- s->m.qscale= (s->m.lambda*139 + FF_LAMBDA_SCALE*64) >> (FF_LAMBDA_SHIFT + 7);
- s->m.lambda2= (s->m.lambda*s->m.lambda + FF_LAMBDA_SCALE/2) >> FF_LAMBDA_SHIFT;
-
- if(!s->motion_val8[plane]){
- s->motion_val8 [plane]= av_mallocz((s->m.b8_stride*block_height*2 + 2)*2*sizeof(int16_t));
- s->motion_val16[plane]= av_mallocz((s->m.mb_stride*(block_height + 2) + 1)*2*sizeof(int16_t));
+ s->m.width = width;
+ s->m.height = height;
+ s->m.mb_width = block_width;
+ s->m.mb_height = block_height;
+ s->m.mb_stride = s->m.mb_width + 1;
+ s->m.b8_stride = 2 * s->m.mb_width + 1;
+ s->m.f_code = 1;
+ s->m.pict_type = s->picture.pict_type;
+ s->m.me_method = s->avctx->me_method;
+ s->m.me.scene_change_score = 0;
+ s->m.flags = s->avctx->flags;
+ // s->m.out_format = FMT_H263;
+ // s->m.unrestricted_mv = 1;
+ s->m.lambda = s->picture.quality;
+ s->m.qscale = s->m.lambda * 139 +
+ FF_LAMBDA_SCALE * 64 >>
+ FF_LAMBDA_SHIFT + 7;
+ s->m.lambda2 = s->m.lambda * s->m.lambda +
+ FF_LAMBDA_SCALE / 2 >>
+ FF_LAMBDA_SHIFT;
+
+ if (!s->motion_val8[plane]) {
+ s->motion_val8[plane] = av_mallocz((s->m.b8_stride *
+ block_height * 2 + 2) *
+ 2 * sizeof(int16_t));
+ s->motion_val16[plane] = av_mallocz((s->m.mb_stride *
+ (block_height + 2) + 1) *
+ 2 * sizeof(int16_t));
}
- s->m.mb_type= s->mb_type;
+ s->m.mb_type = s->mb_type;
- //dummies, to avoid segfaults
- s->m.current_picture.mb_mean= (uint8_t *)s->dummy;
- s->m.current_picture.mb_var= (uint16_t*)s->dummy;
- s->m.current_picture.mc_mb_var= (uint16_t*)s->dummy;
+ // dummies, to avoid segfaults
+ s->m.current_picture.mb_mean = (uint8_t *)s->dummy;
+ s->m.current_picture.mb_var = (uint16_t *)s->dummy;
+ s->m.current_picture.mc_mb_var = (uint16_t *)s->dummy;
s->m.current_picture.f.mb_type = s->dummy;
s->m.current_picture.f.motion_val[0] = s->motion_val8[plane] + 2;
- s->m.p_mv_table= s->motion_val16[plane] + s->m.mb_stride + 1;
- s->m.dsp= s->dsp; //move
+ s->m.p_mv_table = s->motion_val16[plane] +
+ s->m.mb_stride + 1;
+ s->m.dsp = s->dsp; // move
ff_init_me(&s->m);
- s->m.me.dia_size= s->avctx->dia_size;
- s->m.first_slice_line=1;
+ s->m.me.dia_size = s->avctx->dia_size;
+ s->m.first_slice_line = 1;
for (y = 0; y < block_height; y++) {
- s->m.new_picture.f.data[0] = src - y*16*stride; //ugly
- s->m.mb_y= y;
-
- for(i=0; i<16 && i + 16*y<height; i++){
- memcpy(&src[i*stride], &src_plane[(i+16*y)*src_stride], width);
- for(x=width; x<16*block_width; x++)
- src[i*stride+x]= src[i*stride+x-1];
+ s->m.new_picture.f.data[0] = src - y * 16 * stride; // ugly
+ s->m.mb_y = y;
+
+ for (i = 0; i < 16 && i + 16 * y < height; i++) {
+ memcpy(&src[i * stride], &src_plane[(i + 16 * y) * src_stride],
+ width);
+ for (x = width; x < 16 * block_width; x++)
+ src[i * stride + x] = src[i * stride + x - 1];
}
- for(; i<16 && i + 16*y<16*block_height; i++)
- memcpy(&src[i*stride], &src[(i-1)*stride], 16*block_width);
+ for (; i < 16 && i + 16 * y < 16 * block_height; i++)
+ memcpy(&src[i * stride], &src[(i - 1) * stride],
+ 16 * block_width);
for (x = 0; x < block_width; x++) {
- s->m.mb_x= x;
+ s->m.mb_x = x;
ff_init_block_index(&s->m);
ff_update_block_index(&s->m);
ff_estimate_p_frame_motion(&s->m, x, y);
}
- s->m.first_slice_line=0;
+ s->m.first_slice_line = 0;
}
ff_fix_long_p_mvs(&s->m);
- ff_fix_long_mvs(&s->m, NULL, 0, s->m.p_mv_table, s->m.f_code, CANDIDATE_MB_TYPE_INTER, 0);
+ ff_fix_long_mvs(&s->m, NULL, 0, s->m.p_mv_table, s->m.f_code,
+ CANDIDATE_MB_TYPE_INTER, 0);
}
- s->m.first_slice_line=1;
+ s->m.first_slice_line = 1;
for (y = 0; y < block_height; y++) {
- for(i=0; i<16 && i + 16*y<height; i++){
- memcpy(&src[i*stride], &src_plane[(i+16*y)*src_stride], width);
- for(x=width; x<16*block_width; x++)
- src[i*stride+x]= src[i*stride+x-1];
+ for (i = 0; i < 16 && i + 16 * y < height; i++) {
+ memcpy(&src[i * stride], &src_plane[(i + 16 * y) * src_stride],
+ width);
+ for (x = width; x < 16 * block_width; x++)
+ src[i * stride + x] = src[i * stride + x - 1];
}
- for(; i<16 && i + 16*y<16*block_height; i++)
- memcpy(&src[i*stride], &src[(i-1)*stride], 16*block_width);
+ for (; i < 16 && i + 16 * y < 16 * block_height; i++)
+ memcpy(&src[i * stride], &src[(i - 1) * stride], 16 * block_width);
- s->m.mb_y= y;
+ s->m.mb_y = y;
for (x = 0; x < block_width; x++) {
- uint8_t reorder_buffer[3][6][7*32];
+ uint8_t reorder_buffer[3][6][7 * 32];
int count[3][6];
- int offset = y * 16 * stride + x * 16;
- uint8_t *decoded= decoded_plane + offset;
- uint8_t *ref= ref_plane + offset;
- int score[4]={0,0,0,0}, best;
- uint8_t *temp = s->scratchbuf;
-
- if(s->pb.buf_end - s->pb.buf - (put_bits_count(&s->pb)>>3) < 3000){ //FIXME check size
+ int offset = y * 16 * stride + x * 16;
+ uint8_t *decoded = decoded_plane + offset;
+ uint8_t *ref = ref_plane + offset;
+ int score[4] = { 0, 0, 0, 0 }, best;
+ uint8_t *temp = s->scratchbuf;
+
+ if (s->pb.buf_end - s->pb.buf -
+ (put_bits_count(&s->pb) >> 3) < 3000) { // FIXME: check size
av_log(s->avctx, AV_LOG_ERROR, "encoded frame too large\n");
return -1;
}
- s->m.mb_x= x;
+ s->m.mb_x = x;
ff_init_block_index(&s->m);
ff_update_block_index(&s->m);
- if(s->picture.pict_type == AV_PICTURE_TYPE_I || (s->m.mb_type[x + y*s->m.mb_stride]&CANDIDATE_MB_TYPE_INTRA)){
- for(i=0; i<6; i++){
- init_put_bits(&s->reorder_pb[i], reorder_buffer[0][i], 7*32);
- }
- if(s->picture.pict_type == AV_PICTURE_TYPE_P){
- const uint8_t *vlc= ff_svq1_block_type_vlc[SVQ1_BLOCK_INTRA];
+ if (s->picture.pict_type == AV_PICTURE_TYPE_I ||
+ (s->m.mb_type[x + y * s->m.mb_stride] &
+ CANDIDATE_MB_TYPE_INTRA)) {
+ for (i = 0; i < 6; i++)
+ init_put_bits(&s->reorder_pb[i], reorder_buffer[0][i],
+ 7 * 32);
+ if (s->picture.pict_type == AV_PICTURE_TYPE_P) {
+ const uint8_t *vlc = ff_svq1_block_type_vlc[SVQ1_BLOCK_INTRA];
put_bits(&s->reorder_pb[5], vlc[1], vlc[0]);
- score[0]= vlc[1]*lambda;
+ score[0] = vlc[1] * lambda;
}
- score[0]+= encode_block(s, src+16*x, NULL, temp, stride, 5, 64, lambda, 1);
- for(i=0; i<6; i++){
- count[0][i]= put_bits_count(&s->reorder_pb[i]);
+ score[0] += encode_block(s, src + 16 * x, NULL, temp, stride,
+ 5, 64, lambda, 1);
+ for (i = 0; i < 6; i++) {
+ count[0][i] = put_bits_count(&s->reorder_pb[i]);
flush_put_bits(&s->reorder_pb[i]);
}
- }else
- score[0]= INT_MAX;
+ } else
+ score[0] = INT_MAX;
- best=0;
+ best = 0;
- if(s->picture.pict_type == AV_PICTURE_TYPE_P){
- const uint8_t *vlc= ff_svq1_block_type_vlc[SVQ1_BLOCK_INTER];
+ if (s->picture.pict_type == AV_PICTURE_TYPE_P) {
+ const uint8_t *vlc = ff_svq1_block_type_vlc[SVQ1_BLOCK_INTER];
int mx, my, pred_x, pred_y, dxy;
int16_t *motion_ptr;
- motion_ptr= ff_h263_pred_motion(&s->m, 0, 0, &pred_x, &pred_y);
- if(s->m.mb_type[x + y*s->m.mb_stride]&CANDIDATE_MB_TYPE_INTER){
- for(i=0; i<6; i++)
- init_put_bits(&s->reorder_pb[i], reorder_buffer[1][i], 7*32);
+ motion_ptr = ff_h263_pred_motion(&s->m, 0, 0, &pred_x, &pred_y);
+ if (s->m.mb_type[x + y * s->m.mb_stride] &
+ CANDIDATE_MB_TYPE_INTER) {
+ for (i = 0; i < 6; i++)
+ init_put_bits(&s->reorder_pb[i], reorder_buffer[1][i],
+ 7 * 32);
put_bits(&s->reorder_pb[5], vlc[1], vlc[0]);
- s->m.pb= s->reorder_pb[5];
- mx= motion_ptr[0];
- my= motion_ptr[1];
- assert(mx>=-32 && mx<=31);
- assert(my>=-32 && my<=31);
- assert(pred_x>=-32 && pred_x<=31);
- assert(pred_y>=-32 && pred_y<=31);
+ s->m.pb = s->reorder_pb[5];
+ mx = motion_ptr[0];
+ my = motion_ptr[1];
+ assert(mx >= -32 && mx <= 31);
+ assert(my >= -32 && my <= 31);
+ assert(pred_x >= -32 && pred_x <= 31);
+ assert(pred_y >= -32 && pred_y <= 31);
ff_h263_encode_motion(&s->m, mx - pred_x, 1);
ff_h263_encode_motion(&s->m, my - pred_y, 1);
- s->reorder_pb[5]= s->m.pb;
- score[1] += lambda*put_bits_count(&s->reorder_pb[5]);
-
- dxy= (mx&1) + 2*(my&1);
-
- s->dsp.put_pixels_tab[0][dxy](temp+16, ref + (mx>>1) + stride*(my>>1), stride, 16);
-
- score[1]+= encode_block(s, src+16*x, temp+16, decoded, stride, 5, 64, lambda, 0);
- best= score[1] <= score[0];
-
- vlc= ff_svq1_block_type_vlc[SVQ1_BLOCK_SKIP];
- score[2]= s->dsp.sse[0](NULL, src+16*x, ref, stride, 16);
- score[2]+= vlc[1]*lambda;
- if(score[2] < score[best] && mx==0 && my==0){
- best=2;
+ s->reorder_pb[5] = s->m.pb;
+ score[1] += lambda * put_bits_count(&s->reorder_pb[5]);
+
+ dxy = (mx & 1) + 2 * (my & 1);
+
+ s->dsp.put_pixels_tab[0][dxy](temp + 16,
+ ref + (mx >> 1) +
+ stride * (my >> 1),
+ stride, 16);
+
+ score[1] += encode_block(s, src + 16 * x, temp + 16,
+ decoded, stride, 5, 64, lambda, 0);
+ best = score[1] <= score[0];
+
+ vlc = ff_svq1_block_type_vlc[SVQ1_BLOCK_SKIP];
+ score[2] = s->dsp.sse[0](NULL, src + 16 * x, ref,
+ stride, 16);
+ score[2] += vlc[1] * lambda;
+ if (score[2] < score[best] && mx == 0 && my == 0) {
+ best = 2;
s->dsp.put_pixels_tab[0][0](decoded, ref, stride, 16);
- for(i=0; i<6; i++){
- count[2][i]=0;
- }
+ for (i = 0; i < 6; i++)
+ count[2][i] = 0;
put_bits(&s->pb, vlc[1], vlc[0]);
}
}
- if(best==1){
- for(i=0; i<6; i++){
- count[1][i]= put_bits_count(&s->reorder_pb[i]);
+ if (best == 1) {
+ for (i = 0; i < 6; i++) {
+ count[1][i] = put_bits_count(&s->reorder_pb[i]);
flush_put_bits(&s->reorder_pb[i]);
}
- }else{
- motion_ptr[0 ] = motion_ptr[1 ]=
- motion_ptr[2 ] = motion_ptr[3 ]=
- motion_ptr[0+2*s->m.b8_stride] = motion_ptr[1+2*s->m.b8_stride]=
- motion_ptr[2+2*s->m.b8_stride] = motion_ptr[3+2*s->m.b8_stride]=0;
+ } else {
+ motion_ptr[0] =
+ motion_ptr[1] =
+ motion_ptr[2] =
+ motion_ptr[3] =
+ motion_ptr[0 + 2 * s->m.b8_stride] =
+ motion_ptr[1 + 2 * s->m.b8_stride] =
+ motion_ptr[2 + 2 * s->m.b8_stride] =
+ motion_ptr[3 + 2 * s->m.b8_stride] = 0;
}
}
s->rd_total += score[best];
- for(i=5; i>=0; i--){
- avpriv_copy_bits(&s->pb, reorder_buffer[best][i], count[best][i]);
- }
- if(best==0){
+ for (i = 5; i >= 0; i--)
+ avpriv_copy_bits(&s->pb, reorder_buffer[best][i],
+ count[best][i]);
+ if (best == 0)
s->dsp.put_pixels_tab[0][0](decoded, temp, stride, 16);
- }
}
- s->m.first_slice_line=0;
+ s->m.first_slice_line = 0;
}
return 0;
}
static av_cold int svq1_encode_init(AVCodecContext *avctx)
{
- SVQ1Context * const s = avctx->priv_data;
+ SVQ1Context *const s = avctx->priv_data;
- dsputil_init(&s->dsp, avctx);
- avctx->coded_frame= (AVFrame*)&s->picture;
+ ff_dsputil_init(&s->dsp, avctx);
+ avctx->coded_frame = &s->picture;
- s->frame_width = avctx->width;
+ s->frame_width = avctx->width;
s->frame_height = avctx->height;
- s->y_block_width = (s->frame_width + 15) / 16;
+ s->y_block_width = (s->frame_width + 15) / 16;
s->y_block_height = (s->frame_height + 15) / 16;
- s->c_block_width = (s->frame_width / 4 + 15) / 16;
+ s->c_block_width = (s->frame_width / 4 + 15) / 16;
s->c_block_height = (s->frame_height / 4 + 15) / 16;
- s->avctx= avctx;
- s->m.avctx= avctx;
- s->m.me.temp =
- s->m.me.scratchpad= av_mallocz((avctx->width+64)*2*16*2*sizeof(uint8_t));
- s->m.me.map = av_mallocz(ME_MAP_SIZE*sizeof(uint32_t));
- s->m.me.score_map = av_mallocz(ME_MAP_SIZE*sizeof(uint32_t));
- s->mb_type = av_mallocz((s->y_block_width+1)*s->y_block_height*sizeof(int16_t));
- s->dummy = av_mallocz((s->y_block_width+1)*s->y_block_height*sizeof(int32_t));
- ff_h263_encode_init(&s->m); //mv_penalty
+ s->avctx = avctx;
+ s->m.avctx = avctx;
+ s->m.picture_structure = PICT_FRAME;
+ s->m.me.temp =
+ s->m.me.scratchpad = av_mallocz((avctx->width + 64) *
+ 2 * 16 * 2 * sizeof(uint8_t));
+ s->m.me.map = av_mallocz(ME_MAP_SIZE * sizeof(uint32_t));
+ s->m.me.score_map = av_mallocz(ME_MAP_SIZE * sizeof(uint32_t));
+ s->mb_type = av_mallocz((s->y_block_width + 1) *
+ s->y_block_height * sizeof(int16_t));
+ s->dummy = av_mallocz((s->y_block_width + 1) *
+ s->y_block_height * sizeof(int32_t));
+ ff_h263_encode_init(&s->m); // mv_penalty
return 0;
}
-static int svq1_encode_frame(AVCodecContext *avctx, unsigned char *buf,
- int buf_size, void *data)
+static int svq1_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
+ const AVFrame *pict, int *got_packet)
{
- SVQ1Context * const s = avctx->priv_data;
- AVFrame *pict = data;
- AVFrame * const p= (AVFrame*)&s->picture;
+ SVQ1Context *const s = avctx->priv_data;
+ AVFrame *const p = &s->picture;
AVFrame temp;
- int i;
+ int i, ret;
- if(avctx->pix_fmt != PIX_FMT_YUV410P){
+ if (!pkt->data &&
+ (ret = av_new_packet(pkt, s->y_block_width * s->y_block_height *
+ MAX_MB_BYTES * 3 + FF_MIN_BUFFER_SIZE) < 0)) {
+ av_log(avctx, AV_LOG_ERROR, "Error getting output packet.\n");
+ return ret;
+ }
+
+ if (avctx->pix_fmt != AV_PIX_FMT_YUV410P) {
av_log(avctx, AV_LOG_ERROR, "unsupported pixel format\n");
return -1;
}
- if(!s->current_picture.data[0]){
- avctx->get_buffer(avctx, &s->current_picture);
- avctx->get_buffer(avctx, &s->last_picture);
+ if (!s->current_picture.data[0]) {
+ ff_get_buffer(avctx, &s->current_picture);
+ ff_get_buffer(avctx, &s->last_picture);
s->scratchbuf = av_malloc(s->current_picture.linesize[0] * 16 * 2);
}
- temp= s->current_picture;
- s->current_picture= s->last_picture;
- s->last_picture= temp;
+ temp = s->current_picture;
+ s->current_picture = s->last_picture;
+ s->last_picture = temp;
- init_put_bits(&s->pb, buf, buf_size);
+ init_put_bits(&s->pb, pkt->data, pkt->size);
- *p = *pict;
- p->pict_type = avctx->gop_size && avctx->frame_number % avctx->gop_size ? AV_PICTURE_TYPE_P : AV_PICTURE_TYPE_I;
+ *p = *pict;
+ p->pict_type = avctx->gop_size && avctx->frame_number % avctx->gop_size ?
+ AV_PICTURE_TYPE_P : AV_PICTURE_TYPE_I;
p->key_frame = p->pict_type == AV_PICTURE_TYPE_I;
svq1_write_header(s, p->pict_type);
- for(i=0; i<3; i++){
- if(svq1_encode_plane(s, i,
- s->picture.data[i], s->last_picture.data[i], s->current_picture.data[i],
- s->frame_width / (i?4:1), s->frame_height / (i?4:1),
- s->picture.linesize[i], s->current_picture.linesize[i]) < 0)
- return -1;
- }
-
-// avpriv_align_put_bits(&s->pb);
- while(put_bits_count(&s->pb) & 31)
+ for (i = 0; i < 3; i++)
+ if (svq1_encode_plane(s, i,
+ s->picture.data[i],
+ s->last_picture.data[i],
+ s->current_picture.data[i],
+ s->frame_width / (i ? 4 : 1),
+ s->frame_height / (i ? 4 : 1),
+ s->picture.linesize[i],
+ s->current_picture.linesize[i]) < 0)
+ return -1;
+
+ // avpriv_align_put_bits(&s->pb);
+ while (put_bits_count(&s->pb) & 31)
put_bits(&s->pb, 1, 0);
flush_put_bits(&s->pb);
- return put_bits_count(&s->pb) / 8;
+ pkt->size = put_bits_count(&s->pb) / 8;
+ if (p->pict_type == AV_PICTURE_TYPE_I)
+ pkt->flags |= AV_PKT_FLAG_KEY;
+ *got_packet = 1;
+
+ return 0;
}
static av_cold int svq1_encode_end(AVCodecContext *avctx)
{
- SVQ1Context * const s = avctx->priv_data;
+ SVQ1Context *const s = avctx->priv_data;
int i;
- av_log(avctx, AV_LOG_DEBUG, "RD: %f\n", s->rd_total/(double)(avctx->width*avctx->height*avctx->frame_number));
+ av_log(avctx, AV_LOG_DEBUG, "RD: %f\n",
+ s->rd_total / (double)(avctx->width * avctx->height *
+ avctx->frame_number));
av_freep(&s->m.me.scratchpad);
av_freep(&s->m.me.map);
@@ -559,7 +609,7 @@ static av_cold int svq1_encode_end(AVCodecContext *avctx)
av_freep(&s->dummy);
av_freep(&s->scratchbuf);
- for(i=0; i<3; i++){
+ for (i = 0; i < 3; i++) {
av_freep(&s->motion_val8[i]);
av_freep(&s->motion_val16[i]);
}
@@ -567,15 +617,15 @@ static av_cold int svq1_encode_end(AVCodecContext *avctx)
return 0;
}
-
AVCodec ff_svq1_encoder = {
.name = "svq1",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_SVQ1,
+ .id = AV_CODEC_ID_SVQ1,
.priv_data_size = sizeof(SVQ1Context),
.init = svq1_encode_init,
- .encode = svq1_encode_frame,
+ .encode2 = svq1_encode_frame,
.close = svq1_encode_end,
- .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV410P, PIX_FMT_NONE},
- .long_name= NULL_IF_CONFIG_SMALL("Sorenson Vector Quantizer 1 / Sorenson Video 1 / SVQ1"),
+ .pix_fmts = (const enum PixelFormat[]) { AV_PIX_FMT_YUV410P,
+ AV_PIX_FMT_NONE },
+ .long_name = NULL_IF_CONFIG_SMALL("Sorenson Vector Quantizer 1 / Sorenson Video 1 / SVQ1"),
};
diff --git a/gst-libs/ext/libav/libavcodec/svq1enc_cb.h b/gst-libs/ext/libav/libavcodec/svq1enc_cb.h
index 1c86ebe..a5cd179 100644
--- a/gst-libs/ext/libav/libavcodec/svq1enc_cb.h
+++ b/gst-libs/ext/libav/libavcodec/svq1enc_cb.h
@@ -30,67 +30,57 @@
#include <stdint.h>
static const int8_t svq1_inter_codebook_sum[4][16*6] = {
- {
- -1, 1, -2, 0, 1, -1, -1, -1, -2, -1, 1, -1, -1, 0, -1, -1,
- 0, -1, -1, -1, -1, 0, -1, 0, 0, 0, -3, 1, -1, 0, 1, -1,
- 1, -1, 2, 2, 1, 1, 2, 0, 0, 0, -1, 1, 1, 0, 0, 0,
- 1, -1, 0, 1, -1, 1, 1, 0, 1, 0, -1, 1, 1, 0, 0, 0,
- -2, 0, 0, -2, 0, 0, -2, 0, -2, -1, -2, -1, 0, 0, -1, 0,
- 1, 0, 1, -1, 2, 2, 1, 2, 2, 1, 0, 1, 1, 0, 1, 1,
- },{
- -2, 1, -1, -1, 1, 0, 1, -1, -1, -1, 1, -1, 0, -1, 0, -1,
- 0, 0, 0, -2, 0, 1, 0, -1, -1, 0, 2, -3, 1, -2, 3, -1,
- 2, 0, 2, 1, 1, -1, 1, 1, 0, 0, 1, 1, 2, -2, 1, 0,
- -2, -1, 2, -2, -2, 0, -3, 0, -1, 0, -1, 0, -1, 0, -2, -3,
- 1, -2, -2, -1, 1, -1, -1, 1, -1, 1, 1, 0, -2, 0, 1, 1,
- 1, 1, 2, 1, 0, 0, -1, 0, 0, 1, 0, 1, -1, 1, 0, 2,
- },{
- 0, 0, 0, -3, 1, 1, 1, -3, 0, -1, 0, -3, 1, -3, 0, -2,
- 1, 2, -1, -3, 0, -3, 1, -1, 0, -1, 0, 0, 1, 2, 1, 1,
- -1, 2, -3, 3, 1, 0, -5, 1, 0, -1, -3, 1, 0, 2, 0, -3,
- 4, 2, 0, -2, 1, -2, 3, -2, 1, 1, 0, -1, 2, 5, 3, 1,
- -1, 0, 2, -3, -2, 0, 0, -2, 2, -3, -1, -1, 2, 1, 0, -2,
- 3, -1, 1, -1, 2, 4, 0, 1, 0, 1, 0, -1, -3, -2, -1, 0,
- },{
- 0, 2, -1, -1, 2, -4, -2, 3, 0, -1, -5, 1, 0, 1, 0, 6,
- -2, 2, 0, 1, 1, -1, -1, -2, 1, -2, -1, 0, 2, -2, -2, -1,
- -4, 2, -1, -3, -1, -2, 2, -1, 2, -1, 2, 0, 3, -3, -3, 0,
- -3, 0, 0, -2, 4, -4, 0, -1, 4, 0, -2, -2, 3, -2, 0, 4,
- 5, 0, 1, 0, -3, 3, 3, 2, 0, 0, 1, 2, -5, -2, -3, 0,
- -3, 2, -2, 2, -2, 4, 7, -3, 4, 2, 3, 2, -1, 0, -3, 1,
- }
+ { -1, 1, -2, 0, 1, -1, -1, -1, -2, -1, 1, -1, -1, 0, -1, -1,
+ 0, -1, -1, -1, -1, 0, -1, 0, 0, 0, -3, 1, -1, 0, 1, -1,
+ 1, -1, 2, 2, 1, 1, 2, 0, 0, 0, -1, 1, 1, 0, 0, 0,
+ 1, -1, 0, 1, -1, 1, 1, 0, 1, 0, -1, 1, 1, 0, 0, 0,
+ -2, 0, 0, -2, 0, 0, -2, 0, -2, -1, -2, -1, 0, 0, -1, 0,
+ 1, 0, 1, -1, 2, 2, 1, 2, 2, 1, 0, 1, 1, 0, 1, 1, },
+ { -2, 1, -1, -1, 1, 0, 1, -1, -1, -1, 1, -1, 0, -1, 0, -1,
+ 0, 0, 0, -2, 0, 1, 0, -1, -1, 0, 2, -3, 1, -2, 3, -1,
+ 2, 0, 2, 1, 1, -1, 1, 1, 0, 0, 1, 1, 2, -2, 1, 0,
+ -2, -1, 2, -2, -2, 0, -3, 0, -1, 0, -1, 0, -1, 0, -2, -3,
+ 1, -2, -2, -1, 1, -1, -1, 1, -1, 1, 1, 0, -2, 0, 1, 1,
+ 1, 1, 2, 1, 0, 0, -1, 0, 0, 1, 0, 1, -1, 1, 0, 2, },
+ { 0, 0, 0, -3, 1, 1, 1, -3, 0, -1, 0, -3, 1, -3, 0, -2,
+ 1, 2, -1, -3, 0, -3, 1, -1, 0, -1, 0, 0, 1, 2, 1, 1,
+ -1, 2, -3, 3, 1, 0, -5, 1, 0, -1, -3, 1, 0, 2, 0, -3,
+ 4, 2, 0, -2, 1, -2, 3, -2, 1, 1, 0, -1, 2, 5, 3, 1,
+ -1, 0, 2, -3, -2, 0, 0, -2, 2, -3, -1, -1, 2, 1, 0, -2,
+ 3, -1, 1, -1, 2, 4, 0, 1, 0, 1, 0, -1, -3, -2, -1, 0, },
+ { 0, 2, -1, -1, 2, -4, -2, 3, 0, -1, -5, 1, 0, 1, 0, 6,
+ -2, 2, 0, 1, 1, -1, -1, -2, 1, -2, -1, 0, 2, -2, -2, -1,
+ -4, 2, -1, -3, -1, -2, 2, -1, 2, -1, 2, 0, 3, -3, -3, 0,
+ -3, 0, 0, -2, 4, -4, 0, -1, 4, 0, -2, -2, 3, -2, 0, 4,
+ 5, 0, 1, 0, -3, 3, 3, 2, 0, 0, 1, 2, -5, -2, -3, 0,
+ -3, 2, -2, 2, -2, 4, 7, -3, 4, 2, 3, 2, -1, 0, -3, 1, }
};
static const int8_t svq1_intra_codebook_sum[4][16*6] = {
- {
- 0, 0, 0, -1, -1, -1, -1, -2, 0, -1, -1, 0, -1, 0, 1, 0,
- 1, 0, -1, 1, 0, 0, -1, 1, -1, 0, 0, 0, -1, 1, 0, 0,
- -1, 0, 0, 1, -1, 1, 0, -1, -1, 0, 1, 1, 0, 0, -1, 1,
- 0, 1, 0, 0, 1, -1, 0, 0, 0, -1, 1, 0, 1, 0, -2, 1,
- 0, -1, 1, 0, 0, 0, 1, 0, -1, 0, 0, 0, -1, 0, 0, 0,
- 0, 1, 1, 0, 0, -1, 0, 1, 0, 0, 0, 0, -1, 1, 1, -1,
- },{
- -1, -2, 0, -1, 1, 0, -1, 0, -1, -4, -1, -2, -1, -2, 1, -2,
- 0, 0, 4, -2, -1, 1, 1, 0, 2, 1, 1, 0, 2, 0, 0, 0,
- 1, 1, 0, -1, -1, -1, 1, 0, -1, -3, -3, 1, -1, 1, -2, -1,
- 1, -1, 0, 1, 2, 1, -1, -1, 1, 1, 1, 2, 1, 0, 1, -2,
- -2, 0, -1, -2, -2, 0, -1, -1, -1, 0, 1, 0, -1, -1, 0, -1,
- 0, 2, 1, 2, 2, 1, -1, 1, 0, 2, 0, -1, 1, 0, 0, 0,
- },{
- -2, 0, -1, -1, 1, 1, -2, 0, -2, 0, 1, -2, -2, 1, -1, -1,
- 3, -2, 0, -3, -4, -3, 2, 1, 0, 3, -2, 2, 3, 2, 2, -1,
- -3, 1, 0, 1, 0, 0, 0, 1, -2, 1, -2, -2, -1, -2, -2, 2,
- 0, -4, 0, 2, -1, 0, 2, 2, 2, 1, 0, -1, -1, 1, -3, 2,
- 2, 1, 0, 3, 1, -1, 1, 3, 1, 0, 1, 1, 2, -1, 1, -1,
- -2, -1, 0, -1, 1, -1, 1, -2, -2, -1, -1, -3, 1, -4, -3, 1,
- },{
- -2, 0, -2, 3, -1, -1, 0, 2, 2, -1, -3, 2, 1, 0, -2, -1,
- -3, -2, -2, 1, 2, -3, 0, 1, -5, -2, -3, 0, -2, -1, 2, 0,
- -1, -1, 0, -2, 1, 3, -7, -2, -2, -1, 2, -1, 0, 3, 1, 3,
- 1, 0, 0, 1, 2, 3, 1, 2, 0, -2, -2, 1, 1, 2, 2, 3,
- 4, 1, -1, 2, -2, 4, 0, 0, 0, 4, 2, 0, -2, -2, 2, -4,
- -1, 5, -2, -2, -3, 2, -3, -1, 3, -3, 0, 4, 3, 0, 1, -2,
- }
+ { 0, 0, 0, -1, -1, -1, -1, -2, 0, -1, -1, 0, -1, 0, 1, 0,
+ 1, 0, -1, 1, 0, 0, -1, 1, -1, 0, 0, 0, -1, 1, 0, 0,
+ -1, 0, 0, 1, -1, 1, 0, -1, -1, 0, 1, 1, 0, 0, -1, 1,
+ 0, 1, 0, 0, 1, -1, 0, 0, 0, -1, 1, 0, 1, 0, -2, 1,
+ 0, -1, 1, 0, 0, 0, 1, 0, -1, 0, 0, 0, -1, 0, 0, 0,
+ 0, 1, 1, 0, 0, -1, 0, 1, 0, 0, 0, 0, -1, 1, 1, -1, },
+ { -1, -2, 0, -1, 1, 0, -1, 0, -1, -4, -1, -2, -1, -2, 1, -2,
+ 0, 0, 4, -2, -1, 1, 1, 0, 2, 1, 1, 0, 2, 0, 0, 0,
+ 1, 1, 0, -1, -1, -1, 1, 0, -1, -3, -3, 1, -1, 1, -2, -1,
+ 1, -1, 0, 1, 2, 1, -1, -1, 1, 1, 1, 2, 1, 0, 1, -2,
+ -2, 0, -1, -2, -2, 0, -1, -1, -1, 0, 1, 0, -1, -1, 0, -1,
+ 0, 2, 1, 2, 2, 1, -1, 1, 0, 2, 0, -1, 1, 0, 0, 0, },
+ { -2, 0, -1, -1, 1, 1, -2, 0, -2, 0, 1, -2, -2, 1, -1, -1,
+ 3, -2, 0, -3, -4, -3, 2, 1, 0, 3, -2, 2, 3, 2, 2, -1,
+ -3, 1, 0, 1, 0, 0, 0, 1, -2, 1, -2, -2, -1, -2, -2, 2,
+ 0, -4, 0, 2, -1, 0, 2, 2, 2, 1, 0, -1, -1, 1, -3, 2,
+ 2, 1, 0, 3, 1, -1, 1, 3, 1, 0, 1, 1, 2, -1, 1, -1,
+ -2, -1, 0, -1, 1, -1, 1, -2, -2, -1, -1, -3, 1, -4, -3, 1, },
+ { -2, 0, -2, 3, -1, -1, 0, 2, 2, -1, -3, 2, 1, 0, -2, -1,
+ -3, -2, -2, 1, 2, -3, 0, 1, -5, -2, -3, 0, -2, -1, 2, 0,
+ -1, -1, 0, -2, 1, 3, -7, -2, -2, -1, 2, -1, 0, 3, 1, 3,
+ 1, 0, 0, 1, 2, 3, 1, 2, 0, -2, -2, 1, 1, 2, 2, 3,
+ 4, 1, -1, 2, -2, 4, 0, 0, 0, 4, 2, 0, -2, -2, 2, -4,
+ -1, 5, -2, -2, -3, 2, -3, -1, 3, -3, 0, 4, 3, 0, 1, -2, }
};
#endif /* AVCODEC_SVQ1ENC_CB_H */
diff --git a/gst-libs/ext/libav/libavcodec/svq3.c b/gst-libs/ext/libav/libavcodec/svq3.c
index ebe4fd9..68bf2f7 100644
--- a/gst-libs/ext/libav/libavcodec/svq3.c
+++ b/gst-libs/ext/libav/libavcodec/svq3.c
@@ -45,7 +45,7 @@
#include "mpegvideo.h"
#include "h264.h"
-#include "h264data.h" //FIXME FIXME FIXME
+#include "h264data.h" // FIXME FIXME FIXME
#include "h264_mvpred.h"
#include "golomb.h"
@@ -78,19 +78,19 @@ typedef struct {
#define PREDICT_MODE 4
/* dual scan (from some older h264 draft)
- o-->o-->o o
- | /|
- o o o / o
- | / | |/ |
- o o o o
- /
- o-->o-->o-->o
-*/
+ * o-->o-->o o
+ * | /|
+ * o o o / o
+ * | / | |/ |
+ * o o o o
+ * /
+ * o-->o-->o-->o
+ */
static const uint8_t svq3_scan[16] = {
- 0+0*4, 1+0*4, 2+0*4, 2+1*4,
- 2+2*4, 3+0*4, 3+1*4, 3+2*4,
- 0+1*4, 0+2*4, 1+1*4, 1+2*4,
- 0+3*4, 1+3*4, 2+3*4, 3+3*4,
+ 0 + 0 * 4, 1 + 0 * 4, 2 + 0 * 4, 2 + 1 * 4,
+ 2 + 2 * 4, 3 + 0 * 4, 3 + 1 * 4, 3 + 2 * 4,
+ 0 + 1 * 4, 0 + 2 * 4, 1 + 1 * 4, 1 + 2 * 4,
+ 0 + 3 * 4, 1 + 3 * 4, 2 + 3 * 4, 3 + 3 * 4,
};
static const uint8_t svq3_pred_0[25][2] = {
@@ -106,21 +106,24 @@ static const uint8_t svq3_pred_0[25][2] = {
};
static const int8_t svq3_pred_1[6][6][5] = {
- { { 2,-1,-1,-1,-1 }, { 2, 1,-1,-1,-1 }, { 1, 2,-1,-1,-1 },
- { 2, 1,-1,-1,-1 }, { 1, 2,-1,-1,-1 }, { 1, 2,-1,-1,-1 } },
- { { 0, 2,-1,-1,-1 }, { 0, 2, 1, 4, 3 }, { 0, 1, 2, 4, 3 },
- { 0, 2, 1, 4, 3 }, { 2, 0, 1, 3, 4 }, { 0, 4, 2, 1, 3 } },
- { { 2, 0,-1,-1,-1 }, { 2, 1, 0, 4, 3 }, { 1, 2, 4, 0, 3 },
- { 2, 1, 0, 4, 3 }, { 2, 1, 4, 3, 0 }, { 1, 2, 4, 0, 3 } },
- { { 2, 0,-1,-1,-1 }, { 2, 0, 1, 4, 3 }, { 1, 2, 0, 4, 3 },
- { 2, 1, 0, 4, 3 }, { 2, 1, 3, 4, 0 }, { 2, 4, 1, 0, 3 } },
- { { 0, 2,-1,-1,-1 }, { 0, 2, 1, 3, 4 }, { 1, 2, 3, 0, 4 },
- { 2, 0, 1, 3, 4 }, { 2, 1, 3, 0, 4 }, { 2, 0, 4, 3, 1 } },
- { { 0, 2,-1,-1,-1 }, { 0, 2, 4, 1, 3 }, { 1, 4, 2, 0, 3 },
- { 4, 2, 0, 1, 3 }, { 2, 0, 1, 4, 3 }, { 4, 2, 1, 0, 3 } },
+ { { 2, -1, -1, -1, -1 }, { 2, 1, -1, -1, -1 }, { 1, 2, -1, -1, -1 },
+ { 2, 1, -1, -1, -1 }, { 1, 2, -1, -1, -1 }, { 1, 2, -1, -1, -1 } },
+ { { 0, 2, -1, -1, -1 }, { 0, 2, 1, 4, 3 }, { 0, 1, 2, 4, 3 },
+ { 0, 2, 1, 4, 3 }, { 2, 0, 1, 3, 4 }, { 0, 4, 2, 1, 3 } },
+ { { 2, 0, -1, -1, -1 }, { 2, 1, 0, 4, 3 }, { 1, 2, 4, 0, 3 },
+ { 2, 1, 0, 4, 3 }, { 2, 1, 4, 3, 0 }, { 1, 2, 4, 0, 3 } },
+ { { 2, 0, -1, -1, -1 }, { 2, 0, 1, 4, 3 }, { 1, 2, 0, 4, 3 },
+ { 2, 1, 0, 4, 3 }, { 2, 1, 3, 4, 0 }, { 2, 4, 1, 0, 3 } },
+ { { 0, 2, -1, -1, -1 }, { 0, 2, 1, 3, 4 }, { 1, 2, 3, 0, 4 },
+ { 2, 0, 1, 3, 4 }, { 2, 1, 3, 0, 4 }, { 2, 0, 4, 3, 1 } },
+ { { 0, 2, -1, -1, -1 }, { 0, 2, 4, 1, 3 }, { 1, 4, 2, 0, 3 },
+ { 4, 2, 0, 1, 3 }, { 2, 0, 1, 4, 3 }, { 4, 2, 1, 0, 3 } },
};
-static const struct { uint8_t run; uint8_t level; } svq3_dct_tables[2][16] = {
+static const struct {
+ uint8_t run;
+ uint8_t level;
+} svq3_dct_tables[2][16] = {
{ { 0, 0 }, { 0, 1 }, { 1, 1 }, { 2, 1 }, { 0, 2 }, { 3, 1 }, { 4, 1 }, { 5, 1 },
{ 0, 3 }, { 1, 2 }, { 2, 2 }, { 6, 1 }, { 7, 1 }, { 8, 1 }, { 9, 1 }, { 0, 4 } },
{ { 0, 0 }, { 0, 1 }, { 1, 1 }, { 0, 2 }, { 2, 1 }, { 0, 3 }, { 0, 4 }, { 0, 5 },
@@ -128,80 +131,82 @@ static const struct { uint8_t run; uint8_t level; } svq3_dct_tables[2][16] = {
};
static const uint32_t svq3_dequant_coeff[32] = {
- 3881, 4351, 4890, 5481, 6154, 6914, 7761, 8718,
- 9781, 10987, 12339, 13828, 15523, 17435, 19561, 21873,
- 24552, 27656, 30847, 34870, 38807, 43747, 49103, 54683,
- 61694, 68745, 77615, 89113,100253,109366,126635,141533
+ 3881, 4351, 4890, 5481, 6154, 6914, 7761, 8718,
+ 9781, 10987, 12339, 13828, 15523, 17435, 19561, 21873,
+ 24552, 27656, 30847, 34870, 38807, 43747, 49103, 54683,
+ 61694, 68745, 77615, 89113, 100253, 109366, 126635, 141533
};
-void ff_svq3_luma_dc_dequant_idct_c(DCTELEM *output, DCTELEM *input, int qp){
+void ff_svq3_luma_dc_dequant_idct_c(DCTELEM *output, DCTELEM *input, int qp)
+{
const int qmul = svq3_dequant_coeff[qp];
#define stride 16
int i;
int temp[16];
- static const uint8_t x_offset[4]={0, 1*stride, 4*stride, 5*stride};
-
- for(i=0; i<4; i++){
- const int z0 = 13*(input[4*i+0] + input[4*i+2]);
- const int z1 = 13*(input[4*i+0] - input[4*i+2]);
- const int z2 = 7* input[4*i+1] - 17*input[4*i+3];
- const int z3 = 17* input[4*i+1] + 7*input[4*i+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;
+ static const uint8_t x_offset[4] = { 0, 1 * stride, 4 * stride, 5 * stride };
+
+ for (i = 0; i < 4; i++) {
+ const int z0 = 13 * (input[4 * i + 0] + input[4 * i + 2]);
+ const int z1 = 13 * (input[4 * i + 0] - input[4 * i + 2]);
+ const int z2 = 7 * input[4 * i + 1] - 17 * input[4 * i + 3];
+ const int z3 = 17 * input[4 * i + 1] + 7 * input[4 * i + 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;
}
- for(i=0; i<4; i++){
- const int offset= x_offset[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];
-
- output[stride* 0+offset] = ((z0 + z3)*qmul + 0x80000) >> 20;
- output[stride* 2+offset] = ((z1 + z2)*qmul + 0x80000) >> 20;
- output[stride* 8+offset] = ((z1 - z2)*qmul + 0x80000) >> 20;
- output[stride*10+offset] = ((z0 - z3)*qmul + 0x80000) >> 20;
+ for (i = 0; i < 4; i++) {
+ const int offset = x_offset[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];
+
+ output[stride * 0 + offset] = (z0 + z3) * qmul + 0x80000 >> 20;
+ output[stride * 2 + offset] = (z1 + z2) * qmul + 0x80000 >> 20;
+ output[stride * 8 + offset] = (z1 - z2) * qmul + 0x80000 >> 20;
+ output[stride * 10 + offset] = (z0 - z3) * qmul + 0x80000 >> 20;
}
}
#undef stride
-void ff_svq3_add_idct_c(uint8_t *dst, DCTELEM *block, int stride, int qp,
- int dc)
+void ff_svq3_add_idct_c(uint8_t *dst, DCTELEM *block,
+ int stride, int qp, int dc)
{
const int qmul = svq3_dequant_coeff[qp];
int i;
if (dc) {
- dc = 13*13*((dc == 1) ? 1538*block[0] : ((qmul*(block[0] >> 3)) / 2));
+ dc = 13 * 13 * (dc == 1 ? 1538 * block[0]
+ : qmul * (block[0] >> 3) / 2);
block[0] = 0;
}
for (i = 0; i < 4; i++) {
- const int z0 = 13*(block[0 + 4*i] + block[2 + 4*i]);
- const int z1 = 13*(block[0 + 4*i] - block[2 + 4*i]);
- const int z2 = 7* block[1 + 4*i] - 17*block[3 + 4*i];
- const int z3 = 17* block[1 + 4*i] + 7*block[3 + 4*i];
-
- block[0 + 4*i] = z0 + z3;
- block[1 + 4*i] = z1 + z2;
- block[2 + 4*i] = z1 - z2;
- block[3 + 4*i] = z0 - z3;
+ const int z0 = 13 * (block[0 + 4 * i] + block[2 + 4 * i]);
+ const int z1 = 13 * (block[0 + 4 * i] - block[2 + 4 * i]);
+ const int z2 = 7 * block[1 + 4 * i] - 17 * block[3 + 4 * i];
+ const int z3 = 17 * block[1 + 4 * i] + 7 * block[3 + 4 * i];
+
+ block[0 + 4 * i] = z0 + z3;
+ block[1 + 4 * i] = z1 + z2;
+ block[2 + 4 * i] = z1 - z2;
+ block[3 + 4 * i] = z0 - z3;
}
for (i = 0; i < 4; i++) {
- const int z0 = 13*(block[i + 4*0] + block[i + 4*2]);
- const int z1 = 13*(block[i + 4*0] - block[i + 4*2]);
- const int z2 = 7* block[i + 4*1] - 17*block[i + 4*3];
- const int z3 = 17* block[i + 4*1] + 7*block[i + 4*3];
+ const int z0 = 13 * (block[i + 4 * 0] + block[i + 4 * 2]);
+ const int z1 = 13 * (block[i + 4 * 0] - block[i + 4 * 2]);
+ const int z2 = 7 * block[i + 4 * 1] - 17 * block[i + 4 * 3];
+ const int z3 = 17 * block[i + 4 * 1] + 7 * block[i + 4 * 3];
const int rr = (dc + 0x80000);
- dst[i + stride*0] = av_clip_uint8( dst[i + stride*0] + (((z0 + z3)*qmul + rr) >> 20) );
- dst[i + stride*1] = av_clip_uint8( dst[i + stride*1] + (((z1 + z2)*qmul + rr) >> 20) );
- dst[i + stride*2] = av_clip_uint8( dst[i + stride*2] + (((z1 - z2)*qmul + rr) >> 20) );
- dst[i + stride*3] = av_clip_uint8( dst[i + stride*3] + (((z0 - z3)*qmul + rr) >> 20) );
+ dst[i + stride * 0] = av_clip_uint8(dst[i + stride * 0] + ((z0 + z3) * qmul + rr >> 20));
+ dst[i + stride * 1] = av_clip_uint8(dst[i + stride * 1] + ((z1 + z2) * qmul + rr >> 20));
+ dst[i + stride * 2] = av_clip_uint8(dst[i + stride * 2] + ((z1 - z2) * qmul + rr >> 20));
+ dst[i + stride * 3] = av_clip_uint8(dst[i + stride * 3] + ((z0 - z3) * qmul + rr >> 20));
}
}
@@ -211,47 +216,46 @@ static inline int svq3_decode_block(GetBitContext *gb, DCTELEM *block,
static const uint8_t *const scan_patterns[4] =
{ luma_dc_zigzag_scan, zigzag_scan, svq3_scan, chroma_dc_scan };
- int run, level, sign, vlc, limit;
- const int intra = (3 * type) >> 2;
+ int run, level, limit;
+ unsigned vlc;
+ const int intra = 3 * type >> 2;
const uint8_t *const scan = scan_patterns[type];
for (limit = (16 >> intra); index < 16; index = limit, limit += 8) {
for (; (vlc = svq3_get_ue_golomb(gb)) != 0; index++) {
+ int sign = (vlc & 1) ? 0 : -1;
+ vlc = vlc + 1 >> 1;
+
+ if (type == 3) {
+ if (vlc < 3) {
+ run = 0;
+ level = vlc;
+ } else if (vlc < 4) {
+ run = 1;
+ level = 1;
+ } else {
+ run = vlc & 0x3;
+ level = (vlc + 9 >> 2) - run;
+ }
+ } else {
+ if (vlc < 16) {
+ run = svq3_dct_tables[intra][vlc].run;
+ level = svq3_dct_tables[intra][vlc].level;
+ } else if (intra) {
+ run = vlc & 0x7;
+ level = (vlc >> 3) +
+ ((run == 0) ? 8 : ((run < 2) ? 2 : ((run < 5) ? 0 : -1)));
+ } else {
+ run = vlc & 0xF;
+ level = (vlc >> 4) +
+ ((run == 0) ? 4 : ((run < 3) ? 2 : ((run < 10) ? 1 : 0)));
+ }
+ }
+
+ if ((index += run) >= limit)
+ return -1;
- if (vlc == INVALID_VLC)
- return -1;
-
- sign = (vlc & 0x1) - 1;
- vlc = (vlc + 1) >> 1;
-
- if (type == 3) {
- if (vlc < 3) {
- run = 0;
- level = vlc;
- } else if (vlc < 4) {
- run = 1;
- level = 1;
- } else {
- run = (vlc & 0x3);
- level = ((vlc + 9) >> 2) - run;
- }
- } else {
- if (vlc < 16) {
- run = svq3_dct_tables[intra][vlc].run;
- level = svq3_dct_tables[intra][vlc].level;
- } else if (intra) {
- run = (vlc & 0x7);
- level = (vlc >> 3) + ((run == 0) ? 8 : ((run < 2) ? 2 : ((run < 5) ? 0 : -1)));
- } else {
- run = (vlc & 0xF);
- level = (vlc >> 4) + ((run == 0) ? 4 : ((run < 3) ? 2 : ((run < 10) ? 1 : 0)));
- }
- }
-
- if ((index += run) >= limit)
- return -1;
-
- block[scan[index]] = (level ^ sign) - sign;
+ block[scan[index]] = (level ^ sign) - sign;
}
if (type != 2) {
@@ -270,41 +274,44 @@ static inline void svq3_mc_dir_part(MpegEncContext *s,
const Picture *pic = (dir == 0) ? &s->last_picture : &s->next_picture;
uint8_t *src, *dest;
int i, emu = 0;
- int blocksize = 2 - (width>>3); //16->0, 8->1, 4->2
+ int blocksize = 2 - (width >> 3); // 16->0, 8->1, 4->2
mx += x;
my += y;
- if (mx < 0 || mx >= (s->h_edge_pos - width - 1) ||
- my < 0 || my >= (s->v_edge_pos - height - 1)) {
-
- if ((s->flags & CODEC_FLAG_EMU_EDGE)) {
+ if (mx < 0 || mx >= s->h_edge_pos - width - 1 ||
+ my < 0 || my >= s->v_edge_pos - height - 1) {
+ if ((s->flags & CODEC_FLAG_EMU_EDGE))
emu = 1;
- }
- mx = av_clip (mx, -16, (s->h_edge_pos - width + 15));
- my = av_clip (my, -16, (s->v_edge_pos - height + 15));
+ mx = av_clip(mx, -16, s->h_edge_pos - width + 15);
+ my = av_clip(my, -16, s->v_edge_pos - height + 15);
}
/* form component predictions */
- dest = s->current_picture.f.data[0] + x + y*s->linesize;
- src = pic->f.data[0] + mx + my*s->linesize;
+ dest = s->current_picture.f.data[0] + x + y * s->linesize;
+ src = pic->f.data[0] + mx + my * s->linesize;
if (emu) {
- s->dsp.emulated_edge_mc(s->edge_emu_buffer, src, s->linesize, (width + 1), (height + 1),
- mx, my, s->h_edge_pos, s->v_edge_pos);
+ s->vdsp.emulated_edge_mc(s->edge_emu_buffer, src, s->linesize,
+ width + 1, height + 1,
+ mx, my, s->h_edge_pos, s->v_edge_pos);
src = s->edge_emu_buffer;
}
if (thirdpel)
- (avg ? s->dsp.avg_tpel_pixels_tab : s->dsp.put_tpel_pixels_tab)[dxy](dest, src, s->linesize, width, height);
+ (avg ? s->dsp.avg_tpel_pixels_tab
+ : s->dsp.put_tpel_pixels_tab)[dxy](dest, src, s->linesize,
+ width, height);
else
- (avg ? s->dsp.avg_pixels_tab : s->dsp.put_pixels_tab)[blocksize][dxy](dest, src, s->linesize, height);
+ (avg ? s->dsp.avg_pixels_tab
+ : s->dsp.put_pixels_tab)[blocksize][dxy](dest, src, s->linesize,
+ height);
if (!(s->flags & CODEC_FLAG_GRAY)) {
- mx = (mx + (mx < (int) x)) >> 1;
- my = (my + (my < (int) y)) >> 1;
- width = (width >> 1);
- height = (height >> 1);
+ mx = mx + (mx < (int) x) >> 1;
+ my = my + (my < (int) y) >> 1;
+ width = width >> 1;
+ height = height >> 1;
blocksize++;
for (i = 1; i < 3; i++) {
@@ -312,55 +319,69 @@ static inline void svq3_mc_dir_part(MpegEncContext *s,
src = pic->f.data[i] + mx + my * s->uvlinesize;
if (emu) {
- s->dsp.emulated_edge_mc(s->edge_emu_buffer, src, s->uvlinesize, (width + 1), (height + 1),
- mx, my, (s->h_edge_pos >> 1), (s->v_edge_pos >> 1));
+ s->vdsp.emulated_edge_mc(s->edge_emu_buffer, src, s->uvlinesize,
+ width + 1, height + 1,
+ mx, my, (s->h_edge_pos >> 1),
+ s->v_edge_pos >> 1);
src = s->edge_emu_buffer;
}
if (thirdpel)
- (avg ? s->dsp.avg_tpel_pixels_tab : s->dsp.put_tpel_pixels_tab)[dxy](dest, src, s->uvlinesize, width, height);
+ (avg ? s->dsp.avg_tpel_pixels_tab
+ : s->dsp.put_tpel_pixels_tab)[dxy](dest, src,
+ s->uvlinesize,
+ width, height);
else
- (avg ? s->dsp.avg_pixels_tab : s->dsp.put_pixels_tab)[blocksize][dxy](dest, src, s->uvlinesize, height);
+ (avg ? s->dsp.avg_pixels_tab
+ : s->dsp.put_pixels_tab)[blocksize][dxy](dest, src,
+ s->uvlinesize,
+ height);
}
}
}
-static inline int svq3_mc_dir(H264Context *h, int size, int mode, int dir,
- int avg)
+static inline int svq3_mc_dir(H264Context *h, int size, int mode,
+ int dir, int avg)
{
int i, j, k, mx, my, dx, dy, x, y;
- MpegEncContext *const s = (MpegEncContext *) h;
- const int part_width = ((size & 5) == 4) ? 4 : 16 >> (size & 1);
- const int part_height = 16 >> ((unsigned) (size + 1) / 3);
- const int extra_width = (mode == PREDICT_MODE) ? -16*6 : 0;
- const int h_edge_pos = 6*(s->h_edge_pos - part_width ) - extra_width;
- const int v_edge_pos = 6*(s->v_edge_pos - part_height) - extra_width;
-
- for (i = 0; i < 16; i += part_height) {
+ MpegEncContext *const s = (MpegEncContext *)h;
+ const int part_width = ((size & 5) == 4) ? 4 : 16 >> (size & 1);
+ const int part_height = 16 >> ((unsigned)(size + 1) / 3);
+ const int extra_width = (mode == PREDICT_MODE) ? -16 * 6 : 0;
+ const int h_edge_pos = 6 * (s->h_edge_pos - part_width) - extra_width;
+ const int v_edge_pos = 6 * (s->v_edge_pos - part_height) - extra_width;
+
+ for (i = 0; i < 16; i += part_height)
for (j = 0; j < 16; j += part_width) {
- const int b_xy = (4*s->mb_x + (j >> 2)) + (4*s->mb_y + (i >> 2))*h->b_stride;
+ const int b_xy = (4 * s->mb_x + (j >> 2)) +
+ (4 * s->mb_y + (i >> 2)) * h->b_stride;
int dxy;
- x = 16*s->mb_x + j;
- y = 16*s->mb_y + i;
- k = ((j >> 2) & 1) + ((i >> 1) & 2) + ((j >> 1) & 4) + (i & 8);
+ x = 16 * s->mb_x + j;
+ y = 16 * s->mb_y + i;
+ k = (j >> 2 & 1) + (i >> 1 & 2) +
+ (j >> 1 & 4) + (i & 8);
if (mode != PREDICT_MODE) {
- pred_motion(h, k, (part_width >> 2), dir, 1, &mx, &my);
+ pred_motion(h, k, part_width >> 2, dir, 1, &mx, &my);
} else {
mx = s->next_picture.f.motion_val[0][b_xy][0] << 1;
my = s->next_picture.f.motion_val[0][b_xy][1] << 1;
if (dir == 0) {
- mx = ((mx * h->frame_num_offset) / h->prev_frame_num_offset + 1) >> 1;
- my = ((my * h->frame_num_offset) / h->prev_frame_num_offset + 1) >> 1;
+ mx = mx * h->frame_num_offset /
+ h->prev_frame_num_offset + 1 >> 1;
+ my = my * h->frame_num_offset /
+ h->prev_frame_num_offset + 1 >> 1;
} else {
- mx = ((mx * (h->frame_num_offset - h->prev_frame_num_offset)) / h->prev_frame_num_offset + 1) >> 1;
- my = ((my * (h->frame_num_offset - h->prev_frame_num_offset)) / h->prev_frame_num_offset + 1) >> 1;
+ mx = mx * (h->frame_num_offset - h->prev_frame_num_offset) /
+ h->prev_frame_num_offset + 1 >> 1;
+ my = my * (h->frame_num_offset - h->prev_frame_num_offset) /
+ h->prev_frame_num_offset + 1 >> 1;
}
}
/* clip motion vector prediction to frame border */
- mx = av_clip(mx, extra_width - 6*x, h_edge_pos - 6*x);
- my = av_clip(my, extra_width - 6*y, v_edge_pos - 6*y);
+ mx = av_clip(mx, extra_width - 6 * x, h_edge_pos - 6 * x);
+ my = av_clip(my, extra_width - 6 * y, v_edge_pos - 6 * y);
/* get (optional) motion vector differential */
if (mode == PREDICT_MODE) {
@@ -378,49 +399,49 @@ static inline int svq3_mc_dir(H264Context *h, int size, int mode, int dir,
/* compute motion vector */
if (mode == THIRDPEL_MODE) {
int fx, fy;
- mx = ((mx + 1)>>1) + dx;
- my = ((my + 1)>>1) + dy;
- fx = ((unsigned)(mx + 0x3000))/3 - 0x1000;
- fy = ((unsigned)(my + 0x3000))/3 - 0x1000;
- dxy = (mx - 3*fx) + 4*(my - 3*fy);
-
- svq3_mc_dir_part(s, x, y, part_width, part_height, fx, fy, dxy, 1, dir, avg);
+ mx = (mx + 1 >> 1) + dx;
+ my = (my + 1 >> 1) + dy;
+ fx = (unsigned)(mx + 0x3000) / 3 - 0x1000;
+ fy = (unsigned)(my + 0x3000) / 3 - 0x1000;
+ dxy = (mx - 3 * fx) + 4 * (my - 3 * fy);
+
+ svq3_mc_dir_part(s, x, y, part_width, part_height,
+ fx, fy, dxy, 1, dir, avg);
mx += mx;
my += my;
} else if (mode == HALFPEL_MODE || mode == PREDICT_MODE) {
- mx = ((unsigned)(mx + 1 + 0x3000))/3 + dx - 0x1000;
- my = ((unsigned)(my + 1 + 0x3000))/3 + dy - 0x1000;
- dxy = (mx&1) + 2*(my&1);
+ mx = (unsigned)(mx + 1 + 0x3000) / 3 + dx - 0x1000;
+ my = (unsigned)(my + 1 + 0x3000) / 3 + dy - 0x1000;
+ dxy = (mx & 1) + 2 * (my & 1);
- svq3_mc_dir_part(s, x, y, part_width, part_height, mx>>1, my>>1, dxy, 0, dir, avg);
+ svq3_mc_dir_part(s, x, y, part_width, part_height,
+ mx >> 1, my >> 1, dxy, 0, dir, avg);
mx *= 3;
my *= 3;
} else {
- mx = ((unsigned)(mx + 3 + 0x6000))/6 + dx - 0x1000;
- my = ((unsigned)(my + 3 + 0x6000))/6 + dy - 0x1000;
+ mx = (unsigned)(mx + 3 + 0x6000) / 6 + dx - 0x1000;
+ my = (unsigned)(my + 3 + 0x6000) / 6 + dy - 0x1000;
- svq3_mc_dir_part(s, x, y, part_width, part_height, mx, my, 0, 0, dir, avg);
+ svq3_mc_dir_part(s, x, y, part_width, part_height,
+ mx, my, 0, 0, dir, avg);
mx *= 6;
my *= 6;
}
/* update mv_cache */
if (mode != PREDICT_MODE) {
- int32_t mv = pack16to32(mx,my);
+ int32_t mv = pack16to32(mx, my);
if (part_height == 8 && i < 8) {
- AV_WN32A(h->mv_cache[dir][scan8[k] + 1*8], mv);
+ AV_WN32A(h->mv_cache[dir][scan8[k] + 1 * 8], mv);
- if (part_width == 8 && j < 8) {
- AV_WN32A(h->mv_cache[dir][scan8[k] + 1 + 1*8], mv);
- }
+ if (part_width == 8 && j < 8)
+ AV_WN32A(h->mv_cache[dir][scan8[k] + 1 + 1 * 8], mv);
}
- if (part_width == 8 && j < 8) {
+ if (part_width == 8 && j < 8)
AV_WN32A(h->mv_cache[dir][scan8[k] + 1], mv);
- }
- if (part_width == 4 || part_height == 4) {
+ if (part_width == 4 || part_height == 4)
AV_WN32A(h->mv_cache[dir][scan8[k]], mv);
- }
}
/* write back motion vectors */
@@ -428,7 +449,6 @@ static inline int svq3_mc_dir(H264Context *h, int size, int mode, int dir,
part_width >> 2, part_height >> 2, h->b_stride,
pack16to32(mx, my), 4);
}
- }
return 0;
}
@@ -440,21 +460,23 @@ static int svq3_decode_mb(SVQ3Context *svq3, unsigned int mb_type)
int cbp = 0;
uint32_t vlc;
int8_t *top, *left;
- MpegEncContext *const s = (MpegEncContext *) h;
- const int mb_xy = h->mb_xy;
- const int b_xy = 4*s->mb_x + 4*s->mb_y*h->b_stride;
+ MpegEncContext *const s = (MpegEncContext *)h;
+ const int mb_xy = h->mb_xy;
+ const int b_xy = 4 * s->mb_x + 4 * s->mb_y * h->b_stride;
h->top_samples_available = (s->mb_y == 0) ? 0x33FF : 0xFFFF;
h->left_samples_available = (s->mb_x == 0) ? 0x5F5F : 0xFFFF;
h->topright_samples_available = 0xFFFF;
if (mb_type == 0) { /* SKIP */
- if (s->pict_type == AV_PICTURE_TYPE_P || s->next_picture.f.mb_type[mb_xy] == -1) {
- svq3_mc_dir_part(s, 16*s->mb_x, 16*s->mb_y, 16, 16, 0, 0, 0, 0, 0, 0);
+ if (s->pict_type == AV_PICTURE_TYPE_P ||
+ s->next_picture.f.mb_type[mb_xy] == -1) {
+ svq3_mc_dir_part(s, 16 * s->mb_x, 16 * s->mb_y, 16, 16,
+ 0, 0, 0, 0, 0, 0);
- if (s->pict_type == AV_PICTURE_TYPE_B) {
- svq3_mc_dir_part(s, 16*s->mb_x, 16*s->mb_y, 16, 16, 0, 0, 0, 0, 1, 1);
- }
+ if (s->pict_type == AV_PICTURE_TYPE_B)
+ svq3_mc_dir_part(s, 16 * s->mb_x, 16 * s->mb_y, 16, 16,
+ 0, 0, 0, 0, 1, 1);
mb_type = MB_TYPE_SKIP;
} else {
@@ -467,51 +489,57 @@ static int svq3_decode_mb(SVQ3Context *svq3, unsigned int mb_type)
mb_type = MB_TYPE_16x16;
}
} else if (mb_type < 8) { /* INTER */
- if (svq3->thirdpel_flag && svq3->halfpel_flag == !get_bits1 (&s->gb)) {
+ if (svq3->thirdpel_flag && svq3->halfpel_flag == !get_bits1(&s->gb))
mode = THIRDPEL_MODE;
- } else if (svq3->halfpel_flag && svq3->thirdpel_flag == !get_bits1 (&s->gb)) {
+ else if (svq3->halfpel_flag &&
+ svq3->thirdpel_flag == !get_bits1(&s->gb))
mode = HALFPEL_MODE;
- } else {
+ else
mode = FULLPEL_MODE;
- }
/* fill caches */
/* note ref_cache should contain here:
- ????????
- ???11111
- N??11111
- N??11111
- N??11111
- */
+ * ????????
+ * ???11111
+ * N??11111
+ * N??11111
+ * N??11111
+ */
for (m = 0; m < 2; m++) {
- if (s->mb_x > 0 && h->intra4x4_pred_mode[h->mb2br_xy[mb_xy - 1]+6] != -1) {
- for (i = 0; i < 4; i++) {
- AV_COPY32(h->mv_cache[m][scan8[0] - 1 + i*8], s->current_picture.f.motion_val[m][b_xy - 1 + i*h->b_stride]);
- }
+ if (s->mb_x > 0 && h->intra4x4_pred_mode[h->mb2br_xy[mb_xy - 1] + 6] != -1) {
+ for (i = 0; i < 4; i++)
+ AV_COPY32(h->mv_cache[m][scan8[0] - 1 + i * 8],
+ s->current_picture.f.motion_val[m][b_xy - 1 + i * h->b_stride]);
} else {
- for (i = 0; i < 4; i++) {
- AV_ZERO32(h->mv_cache[m][scan8[0] - 1 + i*8]);
- }
+ for (i = 0; i < 4; i++)
+ AV_ZERO32(h->mv_cache[m][scan8[0] - 1 + i * 8]);
}
if (s->mb_y > 0) {
- memcpy(h->mv_cache[m][scan8[0] - 1*8], s->current_picture.f.motion_val[m][b_xy - h->b_stride], 4*2*sizeof(int16_t));
- memset(&h->ref_cache[m][scan8[0] - 1*8], (h->intra4x4_pred_mode[h->mb2br_xy[mb_xy - s->mb_stride]] == -1) ? PART_NOT_AVAILABLE : 1, 4);
-
- if (s->mb_x < (s->mb_width - 1)) {
- AV_COPY32(h->mv_cache[m][scan8[0] + 4 - 1*8], s->current_picture.f.motion_val[m][b_xy - h->b_stride + 4]);
- h->ref_cache[m][scan8[0] + 4 - 1*8] =
- (h->intra4x4_pred_mode[h->mb2br_xy[mb_xy - s->mb_stride + 1]+6] == -1 ||
- h->intra4x4_pred_mode[h->mb2br_xy[mb_xy - s->mb_stride ] ] == -1) ? PART_NOT_AVAILABLE : 1;
- }else
- h->ref_cache[m][scan8[0] + 4 - 1*8] = PART_NOT_AVAILABLE;
+ memcpy(h->mv_cache[m][scan8[0] - 1 * 8],
+ s->current_picture.f.motion_val[m][b_xy - h->b_stride],
+ 4 * 2 * sizeof(int16_t));
+ memset(&h->ref_cache[m][scan8[0] - 1 * 8],
+ (h->intra4x4_pred_mode[h->mb2br_xy[mb_xy - s->mb_stride]] == -1) ? PART_NOT_AVAILABLE : 1, 4);
+
+ if (s->mb_x < s->mb_width - 1) {
+ AV_COPY32(h->mv_cache[m][scan8[0] + 4 - 1 * 8],
+ s->current_picture.f.motion_val[m][b_xy - h->b_stride + 4]);
+ h->ref_cache[m][scan8[0] + 4 - 1 * 8] =
+ (h->intra4x4_pred_mode[h->mb2br_xy[mb_xy - s->mb_stride + 1] + 6] == -1 ||
+ h->intra4x4_pred_mode[h->mb2br_xy[mb_xy - s->mb_stride]] == -1) ? PART_NOT_AVAILABLE : 1;
+ } else
+ h->ref_cache[m][scan8[0] + 4 - 1 * 8] = PART_NOT_AVAILABLE;
if (s->mb_x > 0) {
- AV_COPY32(h->mv_cache[m][scan8[0] - 1 - 1*8], s->current_picture.f.motion_val[m][b_xy - h->b_stride - 1]);
- h->ref_cache[m][scan8[0] - 1 - 1*8] = (h->intra4x4_pred_mode[h->mb2br_xy[mb_xy - s->mb_stride - 1]+3] == -1) ? PART_NOT_AVAILABLE : 1;
- }else
- h->ref_cache[m][scan8[0] - 1 - 1*8] = PART_NOT_AVAILABLE;
- }else
- memset(&h->ref_cache[m][scan8[0] - 1*8 - 1], PART_NOT_AVAILABLE, 8);
+ AV_COPY32(h->mv_cache[m][scan8[0] - 1 - 1 * 8],
+ s->current_picture.f.motion_val[m][b_xy - h->b_stride - 1]);
+ h->ref_cache[m][scan8[0] - 1 - 1 * 8] =
+ (h->intra4x4_pred_mode[h->mb2br_xy[mb_xy - s->mb_stride - 1] + 3] == -1) ? PART_NOT_AVAILABLE : 1;
+ } else
+ h->ref_cache[m][scan8[0] - 1 - 1 * 8] = PART_NOT_AVAILABLE;
+ } else
+ memset(&h->ref_cache[m][scan8[0] - 1 * 8 - 1],
+ PART_NOT_AVAILABLE, 8);
if (s->pict_type != AV_PICTURE_TYPE_B)
break;
@@ -519,75 +547,71 @@ static int svq3_decode_mb(SVQ3Context *svq3, unsigned int mb_type)
/* decode motion vector(s) and form prediction(s) */
if (s->pict_type == AV_PICTURE_TYPE_P) {
- if (svq3_mc_dir(h, (mb_type - 1), mode, 0, 0) < 0)
+ if (svq3_mc_dir(h, mb_type - 1, mode, 0, 0) < 0)
return -1;
} else { /* AV_PICTURE_TYPE_B */
if (mb_type != 2) {
if (svq3_mc_dir(h, 0, mode, 0, 0) < 0)
return -1;
} else {
- for (i = 0; i < 4; i++) {
- memset(s->current_picture.f.motion_val[0][b_xy + i*h->b_stride], 0, 4*2*sizeof(int16_t));
- }
+ for (i = 0; i < 4; i++)
+ memset(s->current_picture.f.motion_val[0][b_xy + i * h->b_stride],
+ 0, 4 * 2 * sizeof(int16_t));
}
if (mb_type != 1) {
- if (svq3_mc_dir(h, 0, mode, 1, (mb_type == 3)) < 0)
+ if (svq3_mc_dir(h, 0, mode, 1, mb_type == 3) < 0)
return -1;
} else {
- for (i = 0; i < 4; i++) {
- memset(s->current_picture.f.motion_val[1][b_xy + i*h->b_stride], 0, 4*2*sizeof(int16_t));
- }
+ for (i = 0; i < 4; i++)
+ memset(s->current_picture.f.motion_val[1][b_xy + i * h->b_stride],
+ 0, 4 * 2 * sizeof(int16_t));
}
}
mb_type = MB_TYPE_16x16;
} else if (mb_type == 8 || mb_type == 33) { /* INTRA4x4 */
- memset(h->intra4x4_pred_mode_cache, -1, 8*5*sizeof(int8_t));
+ memset(h->intra4x4_pred_mode_cache, -1, 8 * 5 * sizeof(int8_t));
if (mb_type == 8) {
if (s->mb_x > 0) {
- for (i = 0; i < 4; i++) {
- h->intra4x4_pred_mode_cache[scan8[0] - 1 + i*8] = h->intra4x4_pred_mode[h->mb2br_xy[mb_xy - 1]+6-i];
- }
- if (h->intra4x4_pred_mode_cache[scan8[0] - 1] == -1) {
+ for (i = 0; i < 4; i++)
+ h->intra4x4_pred_mode_cache[scan8[0] - 1 + i * 8] = h->intra4x4_pred_mode[h->mb2br_xy[mb_xy - 1] + 6 - i];
+ if (h->intra4x4_pred_mode_cache[scan8[0] - 1] == -1)
h->left_samples_available = 0x5F5F;
- }
}
if (s->mb_y > 0) {
- h->intra4x4_pred_mode_cache[4+8*0] = h->intra4x4_pred_mode[h->mb2br_xy[mb_xy - s->mb_stride]+0];
- h->intra4x4_pred_mode_cache[5+8*0] = h->intra4x4_pred_mode[h->mb2br_xy[mb_xy - s->mb_stride]+1];
- h->intra4x4_pred_mode_cache[6+8*0] = h->intra4x4_pred_mode[h->mb2br_xy[mb_xy - s->mb_stride]+2];
- h->intra4x4_pred_mode_cache[7+8*0] = h->intra4x4_pred_mode[h->mb2br_xy[mb_xy - s->mb_stride]+3];
+ h->intra4x4_pred_mode_cache[4 + 8 * 0] = h->intra4x4_pred_mode[h->mb2br_xy[mb_xy - s->mb_stride] + 0];
+ h->intra4x4_pred_mode_cache[5 + 8 * 0] = h->intra4x4_pred_mode[h->mb2br_xy[mb_xy - s->mb_stride] + 1];
+ h->intra4x4_pred_mode_cache[6 + 8 * 0] = h->intra4x4_pred_mode[h->mb2br_xy[mb_xy - s->mb_stride] + 2];
+ h->intra4x4_pred_mode_cache[7 + 8 * 0] = h->intra4x4_pred_mode[h->mb2br_xy[mb_xy - s->mb_stride] + 3];
- if (h->intra4x4_pred_mode_cache[4+8*0] == -1) {
+ if (h->intra4x4_pred_mode_cache[4 + 8 * 0] == -1)
h->top_samples_available = 0x33FF;
- }
}
/* decode prediction codes for luma blocks */
- for (i = 0; i < 16; i+=2) {
+ for (i = 0; i < 16; i += 2) {
vlc = svq3_get_ue_golomb(&s->gb);
- if (vlc >= 25){
+ if (vlc >= 25) {
av_log(h->s.avctx, AV_LOG_ERROR, "luma prediction:%d\n", vlc);
return -1;
}
- left = &h->intra4x4_pred_mode_cache[scan8[i] - 1];
- top = &h->intra4x4_pred_mode_cache[scan8[i] - 8];
+ left = &h->intra4x4_pred_mode_cache[scan8[i] - 1];
+ top = &h->intra4x4_pred_mode_cache[scan8[i] - 8];
left[1] = svq3_pred_1[top[0] + 1][left[0] + 1][svq3_pred_0[vlc][0]];
left[2] = svq3_pred_1[top[1] + 1][left[1] + 1][svq3_pred_0[vlc][1]];
- if (left[1] == -1 || left[2] == -1){
+ if (left[1] == -1 || left[2] == -1) {
av_log(h->s.avctx, AV_LOG_ERROR, "weird prediction\n");
return -1;
}
}
} else { /* mb_type == 33, DC_128_PRED block type */
- for (i = 0; i < 4; i++) {
- memset(&h->intra4x4_pred_mode_cache[scan8[0] + 8*i], DC_PRED, 4);
- }
+ for (i = 0; i < 4; i++)
+ memset(&h->intra4x4_pred_mode_cache[scan8[0] + 8 * i], DC_PRED, 4);
}
write_back_intra_pred_mode(h);
@@ -598,9 +622,8 @@ static int svq3_decode_mb(SVQ3Context *svq3, unsigned int mb_type)
h->top_samples_available = (s->mb_y == 0) ? 0x33FF : 0xFFFF;
h->left_samples_available = (s->mb_x == 0) ? 0x5F5F : 0xFFFF;
} else {
- for (i = 0; i < 4; i++) {
- memset(&h->intra4x4_pred_mode_cache[scan8[0] + 8*i], DC_128_PRED, 4);
- }
+ for (i = 0; i < 4; i++)
+ memset(&h->intra4x4_pred_mode_cache[scan8[0] + 8 * i], DC_128_PRED, 4);
h->top_samples_available = 0x33FF;
h->left_samples_available = 0x5F5F;
@@ -609,95 +632,102 @@ static int svq3_decode_mb(SVQ3Context *svq3, unsigned int mb_type)
mb_type = MB_TYPE_INTRA4x4;
} else { /* INTRA16x16 */
dir = i_mb_type_info[mb_type - 8].pred_mode;
- dir = (dir >> 1) ^ 3*(dir & 1) ^ 1;
+ dir = (dir >> 1) ^ 3 * (dir & 1) ^ 1;
- if ((h->intra16x16_pred_mode = ff_h264_check_intra_pred_mode(h, dir, 0)) == -1){
+ if ((h->intra16x16_pred_mode = ff_h264_check_intra_pred_mode(h, dir, 0)) == -1) {
av_log(h->s.avctx, AV_LOG_ERROR, "check_intra_pred_mode = -1\n");
return -1;
}
- cbp = i_mb_type_info[mb_type - 8].cbp;
+ cbp = i_mb_type_info[mb_type - 8].cbp;
mb_type = MB_TYPE_INTRA16x16;
}
if (!IS_INTER(mb_type) && s->pict_type != AV_PICTURE_TYPE_I) {
- for (i = 0; i < 4; i++) {
- memset(s->current_picture.f.motion_val[0][b_xy + i*h->b_stride], 0, 4*2*sizeof(int16_t));
- }
+ for (i = 0; i < 4; i++)
+ memset(s->current_picture.f.motion_val[0][b_xy + i * h->b_stride],
+ 0, 4 * 2 * sizeof(int16_t));
if (s->pict_type == AV_PICTURE_TYPE_B) {
- for (i = 0; i < 4; i++) {
- memset(s->current_picture.f.motion_val[1][b_xy + i*h->b_stride], 0, 4*2*sizeof(int16_t));
- }
+ for (i = 0; i < 4; i++)
+ memset(s->current_picture.f.motion_val[1][b_xy + i * h->b_stride],
+ 0, 4 * 2 * sizeof(int16_t));
}
}
if (!IS_INTRA4x4(mb_type)) {
- memset(h->intra4x4_pred_mode+h->mb2br_xy[mb_xy], DC_PRED, 8);
+ memset(h->intra4x4_pred_mode + h->mb2br_xy[mb_xy], DC_PRED, 8);
}
if (!IS_SKIP(mb_type) || s->pict_type == AV_PICTURE_TYPE_B) {
- memset(h->non_zero_count_cache + 8, 0, 14*8*sizeof(uint8_t));
- s->dsp.clear_blocks(h->mb+ 0);
- s->dsp.clear_blocks(h->mb+384);
+ memset(h->non_zero_count_cache + 8, 0, 14 * 8 * sizeof(uint8_t));
+ s->dsp.clear_blocks(h->mb + 0);
+ s->dsp.clear_blocks(h->mb + 384);
}
- if (!IS_INTRA16x16(mb_type) && (!IS_SKIP(mb_type) || s->pict_type == AV_PICTURE_TYPE_B)) {
- if ((vlc = svq3_get_ue_golomb(&s->gb)) >= 48){
+ if (!IS_INTRA16x16(mb_type) &&
+ (!IS_SKIP(mb_type) || s->pict_type == AV_PICTURE_TYPE_B)) {
+ if ((vlc = svq3_get_ue_golomb(&s->gb)) >= 48) {
av_log(h->s.avctx, AV_LOG_ERROR, "cbp_vlc=%d\n", vlc);
return -1;
}
- cbp = IS_INTRA(mb_type) ? golomb_to_intra4x4_cbp[vlc] : golomb_to_inter_cbp[vlc];
+ cbp = IS_INTRA(mb_type) ? golomb_to_intra4x4_cbp[vlc]
+ : golomb_to_inter_cbp[vlc];
}
- if (IS_INTRA16x16(mb_type) || (s->pict_type != AV_PICTURE_TYPE_I && s->adaptive_quant && cbp)) {
+ if (IS_INTRA16x16(mb_type) ||
+ (s->pict_type != AV_PICTURE_TYPE_I && s->adaptive_quant && cbp)) {
s->qscale += svq3_get_se_golomb(&s->gb);
- if (s->qscale > 31u){
+ if (s->qscale > 31u) {
av_log(h->s.avctx, AV_LOG_ERROR, "qscale:%d\n", s->qscale);
return -1;
}
}
if (IS_INTRA16x16(mb_type)) {
- AV_ZERO128(h->mb_luma_dc[0]+0);
- AV_ZERO128(h->mb_luma_dc[0]+8);
- if (svq3_decode_block(&s->gb, h->mb_luma_dc, 0, 1)){
- av_log(h->s.avctx, AV_LOG_ERROR, "error while decoding intra luma dc\n");
+ AV_ZERO128(h->mb_luma_dc[0] + 0);
+ AV_ZERO128(h->mb_luma_dc[0] + 8);
+ if (svq3_decode_block(&s->gb, h->mb_luma_dc[0], 0, 1)) {
+ av_log(h->s.avctx, AV_LOG_ERROR,
+ "error while decoding intra luma dc\n");
return -1;
}
}
if (cbp) {
const int index = IS_INTRA16x16(mb_type) ? 1 : 0;
- const int type = ((s->qscale < 24 && IS_INTRA4x4(mb_type)) ? 2 : 1);
+ const int type = ((s->qscale < 24 && IS_INTRA4x4(mb_type)) ? 2 : 1);
- for (i = 0; i < 4; i++) {
+ for (i = 0; i < 4; i++)
if ((cbp & (1 << i))) {
for (j = 0; j < 4; j++) {
- k = index ? ((j&1) + 2*(i&1) + 2*(j&2) + 4*(i&2)) : (4*i + j);
- h->non_zero_count_cache[ scan8[k] ] = 1;
-
- if (svq3_decode_block(&s->gb, &h->mb[16*k], index, type)){
- av_log(h->s.avctx, AV_LOG_ERROR, "error while decoding block\n");
+ k = index ? (1 * (j & 1) + 2 * (i & 1) +
+ 2 * (j & 2) + 4 * (i & 2))
+ : (4 * i + j);
+ h->non_zero_count_cache[scan8[k]] = 1;
+
+ if (svq3_decode_block(&s->gb, &h->mb[16 * k], index, type)) {
+ av_log(h->s.avctx, AV_LOG_ERROR,
+ "error while decoding block\n");
return -1;
}
}
}
- }
if ((cbp & 0x30)) {
- for (i = 1; i < 3; ++i) {
- if (svq3_decode_block(&s->gb, &h->mb[16*16*i], 0, 3)){
- av_log(h->s.avctx, AV_LOG_ERROR, "error while decoding chroma dc block\n");
- return -1;
- }
- }
+ for (i = 1; i < 3; ++i)
+ if (svq3_decode_block(&s->gb, &h->mb[16 * 16 * i], 0, 3)) {
+ av_log(h->s.avctx, AV_LOG_ERROR,
+ "error while decoding chroma dc block\n");
+ return -1;
+ }
if ((cbp & 0x20)) {
for (i = 1; i < 3; i++) {
for (j = 0; j < 4; j++) {
- k = 16*i + j;
- h->non_zero_count_cache[ scan8[k] ] = 1;
+ k = 16 * i + j;
+ h->non_zero_count_cache[scan8[k]] = 1;
- if (svq3_decode_block(&s->gb, &h->mb[16*k], 1, 1)){
- av_log(h->s.avctx, AV_LOG_ERROR, "error while decoding chroma ac block\n");
+ if (svq3_decode_block(&s->gb, &h->mb[16 * k], 1, 1)) {
+ av_log(h->s.avctx, AV_LOG_ERROR,
+ "error while decoding chroma ac block\n");
return -1;
}
}
@@ -706,12 +736,11 @@ static int svq3_decode_mb(SVQ3Context *svq3, unsigned int mb_type)
}
}
- h->cbp= cbp;
+ h->cbp = cbp;
s->current_picture.f.mb_type[mb_xy] = mb_type;
- if (IS_INTRA(mb_type)) {
+ if (IS_INTRA(mb_type))
h->chroma_pred_mode = ff_h264_check_intra_pred_mode(h, DC_PRED8x8, 1);
- }
return 0;
}
@@ -719,10 +748,11 @@ static int svq3_decode_mb(SVQ3Context *svq3, unsigned int mb_type)
static int svq3_decode_slice_header(AVCodecContext *avctx)
{
SVQ3Context *svq3 = avctx->priv_data;
- H264Context *h = &svq3->h;
+ H264Context *h = &svq3->h;
MpegEncContext *s = &h->s;
- const int mb_xy = h->mb_xy;
+ const int mb_xy = h->mb_xy;
int i, header;
+ unsigned slice_id;
header = get_bits(&s->gb, 8);
@@ -731,73 +761,77 @@ static int svq3_decode_slice_header(AVCodecContext *avctx)
av_log(avctx, AV_LOG_ERROR, "unsupported slice header (%02X)\n", header);
return -1;
} else {
- int length = (header >> 5) & 3;
+ int length = header >> 5 & 3;
- svq3->next_slice_index = get_bits_count(&s->gb) + 8*show_bits(&s->gb, 8*length) + 8*length;
+ svq3->next_slice_index = get_bits_count(&s->gb) +
+ 8 * show_bits(&s->gb, 8 * length) +
+ 8 * length;
if (svq3->next_slice_index > s->gb.size_in_bits) {
av_log(avctx, AV_LOG_ERROR, "slice after bitstream end\n");
return -1;
- }
+ }
- s->gb.size_in_bits = svq3->next_slice_index - 8*(length - 1);
+ s->gb.size_in_bits = svq3->next_slice_index - 8 * (length - 1);
skip_bits(&s->gb, 8);
if (svq3->watermark_key) {
- uint32_t header = AV_RL32(&s->gb.buffer[(get_bits_count(&s->gb)>>3)+1]);
- AV_WL32(&s->gb.buffer[(get_bits_count(&s->gb)>>3)+1], header ^ svq3->watermark_key);
+ uint32_t header = AV_RL32(&s->gb.buffer[(get_bits_count(&s->gb) >> 3) + 1]);
+ AV_WL32(&s->gb.buffer[(get_bits_count(&s->gb) >> 3) + 1],
+ header ^ svq3->watermark_key);
}
if (length > 0) {
memcpy((uint8_t *) &s->gb.buffer[get_bits_count(&s->gb) >> 3],
- &s->gb.buffer[s->gb.size_in_bits >> 3], (length - 1));
+ &s->gb.buffer[s->gb.size_in_bits >> 3], length - 1);
}
skip_bits_long(&s->gb, 0);
}
- if ((i = svq3_get_ue_golomb(&s->gb)) == INVALID_VLC || i >= 3){
- av_log(h->s.avctx, AV_LOG_ERROR, "illegal slice type %d \n", i);
+ if ((slice_id = svq3_get_ue_golomb(&s->gb)) >= 3) {
+ av_log(h->s.avctx, AV_LOG_ERROR, "illegal slice type %d \n", slice_id);
return -1;
}
- h->slice_type = golomb_to_pict_type[i];
+ h->slice_type = golomb_to_pict_type[slice_id];
if ((header & 0x9F) == 2) {
- i = (s->mb_num < 64) ? 6 : (1 + av_log2 (s->mb_num - 1));
- s->mb_skip_run = get_bits(&s->gb, i) - (s->mb_x + (s->mb_y * s->mb_width));
+ i = (s->mb_num < 64) ? 6 : (1 + av_log2(s->mb_num - 1));
+ s->mb_skip_run = get_bits(&s->gb, i) -
+ (s->mb_y * s->mb_width + s->mb_x);
} else {
skip_bits1(&s->gb);
s->mb_skip_run = 0;
}
- h->slice_num = get_bits(&s->gb, 8);
- s->qscale = get_bits(&s->gb, 5);
+ h->slice_num = get_bits(&s->gb, 8);
+ s->qscale = get_bits(&s->gb, 5);
s->adaptive_quant = get_bits1(&s->gb);
/* unknown fields */
skip_bits1(&s->gb);
- if (svq3->unknown_flag) {
+ if (svq3->unknown_flag)
skip_bits1(&s->gb);
- }
skip_bits1(&s->gb);
skip_bits(&s->gb, 2);
- while (get_bits1(&s->gb)) {
+ while (get_bits1(&s->gb))
skip_bits(&s->gb, 8);
- }
/* reset intra predictors and invalidate motion vector references */
if (s->mb_x > 0) {
- memset(h->intra4x4_pred_mode+h->mb2br_xy[mb_xy - 1 ]+3, -1, 4*sizeof(int8_t));
- memset(h->intra4x4_pred_mode+h->mb2br_xy[mb_xy - s->mb_x] , -1, 8*sizeof(int8_t)*s->mb_x);
+ memset(h->intra4x4_pred_mode + h->mb2br_xy[mb_xy - 1] + 3,
+ -1, 4 * sizeof(int8_t));
+ memset(h->intra4x4_pred_mode + h->mb2br_xy[mb_xy - s->mb_x],
+ -1, 8 * sizeof(int8_t) * s->mb_x);
}
if (s->mb_y > 0) {
- memset(h->intra4x4_pred_mode+h->mb2br_xy[mb_xy - s->mb_stride], -1, 8*sizeof(int8_t)*(s->mb_width - s->mb_x));
+ memset(h->intra4x4_pred_mode + h->mb2br_xy[mb_xy - s->mb_stride],
+ -1, 8 * sizeof(int8_t) * (s->mb_width - s->mb_x));
- if (s->mb_x > 0) {
- h->intra4x4_pred_mode[h->mb2br_xy[mb_xy - s->mb_stride - 1]+3] = -1;
- }
+ if (s->mb_x > 0)
+ h->intra4x4_pred_mode[h->mb2br_xy[mb_xy - s->mb_stride - 1] + 3] = -1;
}
return 0;
@@ -806,7 +840,7 @@ static int svq3_decode_slice_header(AVCodecContext *avctx)
static av_cold int svq3_decode_init(AVCodecContext *avctx)
{
SVQ3Context *svq3 = avctx->priv_data;
- H264Context *h = &svq3->h;
+ H264Context *h = &svq3->h;
MpegEncContext *s = &h->s;
int m;
unsigned char *extradata;
@@ -817,11 +851,11 @@ static av_cold int svq3_decode_init(AVCodecContext *avctx)
if (ff_h264_decode_init(avctx) < 0)
return -1;
- s->flags = avctx->flags;
- s->flags2 = avctx->flags2;
+ s->flags = avctx->flags;
+ s->flags2 = avctx->flags2;
s->unrestricted_mv = 1;
- h->is_complex=1;
- avctx->pix_fmt = avctx->codec->pix_fmts[0];
+ h->is_complex = 1;
+ avctx->pix_fmt = avctx->codec->pix_fmts[0];
if (!s->context_initialized) {
h->chroma_qp[0] = h->chroma_qp[1] = 4;
@@ -831,7 +865,7 @@ static av_cold int svq3_decode_init(AVCodecContext *avctx)
svq3->unknown_flag = 0;
/* prowl for the "SEQH" marker in the extradata */
- extradata = (unsigned char *)avctx->extradata;
+ extradata = (unsigned char *)avctx->extradata;
extradata_end = avctx->extradata + avctx->extradata_size;
if (extradata) {
for (m = 0; m + 8 < avctx->extradata_size; m++) {
@@ -845,29 +879,49 @@ static av_cold int svq3_decode_init(AVCodecContext *avctx)
/* if a match was found, parse the extra data */
if (marker_found) {
-
GetBitContext gb;
int frame_size_code;
size = AV_RB32(&extradata[4]);
if (size > extradata_end - extradata - 8)
return AVERROR_INVALIDDATA;
- init_get_bits(&gb, extradata + 8, size*8);
+ init_get_bits(&gb, extradata + 8, size * 8);
/* 'frame size code' and optional 'width, height' */
frame_size_code = get_bits(&gb, 3);
switch (frame_size_code) {
- case 0: avctx->width = 160; avctx->height = 120; break;
- case 1: avctx->width = 128; avctx->height = 96; break;
- case 2: avctx->width = 176; avctx->height = 144; break;
- case 3: avctx->width = 352; avctx->height = 288; break;
- case 4: avctx->width = 704; avctx->height = 576; break;
- case 5: avctx->width = 240; avctx->height = 180; break;
- case 6: avctx->width = 320; avctx->height = 240; break;
- case 7:
- avctx->width = get_bits(&gb, 12);
- avctx->height = get_bits(&gb, 12);
- break;
+ case 0:
+ avctx->width = 160;
+ avctx->height = 120;
+ break;
+ case 1:
+ avctx->width = 128;
+ avctx->height = 96;
+ break;
+ case 2:
+ avctx->width = 176;
+ avctx->height = 144;
+ break;
+ case 3:
+ avctx->width = 352;
+ avctx->height = 288;
+ break;
+ case 4:
+ avctx->width = 704;
+ avctx->height = 576;
+ break;
+ case 5:
+ avctx->width = 240;
+ avctx->height = 180;
+ break;
+ case 6:
+ avctx->width = 320;
+ avctx->height = 240;
+ break;
+ case 7:
+ avctx->width = get_bits(&gb, 12);
+ avctx->height = get_bits(&gb, 12);
+ break;
}
svq3->halfpel_flag = get_bits1(&gb);
@@ -884,41 +938,49 @@ static av_cold int svq3_decode_init(AVCodecContext *avctx)
/* unknown field */
skip_bits1(&gb);
- while (get_bits1(&gb)) {
+ while (get_bits1(&gb))
skip_bits(&gb, 8);
- }
- svq3->unknown_flag = get_bits1(&gb);
+ svq3->unknown_flag = get_bits1(&gb);
avctx->has_b_frames = !s->low_delay;
if (svq3->unknown_flag) {
#if CONFIG_ZLIB
unsigned watermark_width = svq3_get_ue_golomb(&gb);
unsigned watermark_height = svq3_get_ue_golomb(&gb);
- int u1 = svq3_get_ue_golomb(&gb);
- int u2 = get_bits(&gb, 8);
- int u3 = get_bits(&gb, 2);
- int u4 = svq3_get_ue_golomb(&gb);
- unsigned long buf_len = watermark_width*watermark_height*4;
- int offset = (get_bits_count(&gb)+7)>>3;
+ int u1 = svq3_get_ue_golomb(&gb);
+ int u2 = get_bits(&gb, 8);
+ int u3 = get_bits(&gb, 2);
+ int u4 = svq3_get_ue_golomb(&gb);
+ unsigned long buf_len = watermark_width *
+ watermark_height * 4;
+ int offset = get_bits_count(&gb) + 7 >> 3;
uint8_t *buf;
- if ((uint64_t)watermark_width*4 > UINT_MAX/watermark_height)
+ if ((uint64_t)watermark_width * 4 > UINT_MAX / watermark_height)
return -1;
buf = av_malloc(buf_len);
- av_log(avctx, AV_LOG_DEBUG, "watermark size: %dx%d\n", watermark_width, watermark_height);
- av_log(avctx, AV_LOG_DEBUG, "u1: %x u2: %x u3: %x compressed data size: %d offset: %d\n", u1, u2, u3, u4, offset);
- if (uncompress(buf, &buf_len, extradata + 8 + offset, size - offset) != Z_OK) {
- av_log(avctx, AV_LOG_ERROR, "could not uncompress watermark logo\n");
+ av_log(avctx, AV_LOG_DEBUG, "watermark size: %dx%d\n",
+ watermark_width, watermark_height);
+ av_log(avctx, AV_LOG_DEBUG,
+ "u1: %x u2: %x u3: %x compressed data size: %d offset: %d\n",
+ u1, u2, u3, u4, offset);
+ if (uncompress(buf, &buf_len, extradata + 8 + offset,
+ size - offset) != Z_OK) {
+ av_log(avctx, AV_LOG_ERROR,
+ "could not uncompress watermark logo\n");
av_free(buf);
return -1;
}
svq3->watermark_key = ff_svq1_packet_checksum(buf, buf_len, 0);
- svq3->watermark_key = svq3->watermark_key << 16 | svq3->watermark_key;
- av_log(avctx, AV_LOG_DEBUG, "watermark key %#x\n", svq3->watermark_key);
+ svq3->watermark_key = svq3->watermark_key << 16 |
+ svq3->watermark_key;
+ av_log(avctx, AV_LOG_DEBUG,
+ "watermark key %#x\n", svq3->watermark_key);
av_free(buf);
#else
- av_log(avctx, AV_LOG_ERROR, "this svq3 file contains watermark which need zlib support compiled in\n");
+ av_log(avctx, AV_LOG_ERROR,
+ "this svq3 file contains watermark which need zlib support compiled in\n");
return -1;
#endif
}
@@ -927,10 +989,10 @@ static av_cold int svq3_decode_init(AVCodecContext *avctx)
s->width = avctx->width;
s->height = avctx->height;
- if (MPV_common_init(s) < 0)
+ if (ff_MPV_common_init(s) < 0)
return -1;
- h->b_stride = 4*s->mb_width;
+ h->b_stride = 4 * s->mb_width;
if (ff_h264_alloc_tables(h) < 0) {
av_log(avctx, AV_LOG_ERROR, "svq3 memory allocation failed\n");
@@ -941,42 +1003,42 @@ static av_cold int svq3_decode_init(AVCodecContext *avctx)
return 0;
}
-static int svq3_decode_frame(AVCodecContext *avctx,
- void *data, int *data_size,
- AVPacket *avpkt)
+static int svq3_decode_frame(AVCodecContext *avctx, void *data,
+ int *got_frame, AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
- SVQ3Context *svq3 = avctx->priv_data;
- H264Context *h = &svq3->h;
- MpegEncContext *s = &h->s;
- int buf_size = avpkt->size;
- int m, mb_type;
+ SVQ3Context *svq3 = avctx->priv_data;
+ H264Context *h = &svq3->h;
+ MpegEncContext *s = &h->s;
+ int buf_size = avpkt->size;
+ int m;
/* special case for last picture */
if (buf_size == 0) {
if (s->next_picture_ptr && !s->low_delay) {
- *(AVFrame *) data = *(AVFrame *) &s->next_picture;
+ *(AVFrame *) data = s->next_picture.f;
s->next_picture_ptr = NULL;
- *data_size = sizeof(AVFrame);
+ *got_frame = 1;
}
return 0;
}
- init_get_bits (&s->gb, buf, 8*buf_size);
+ init_get_bits(&s->gb, buf, 8 * buf_size);
s->mb_x = s->mb_y = h->mb_xy = 0;
if (svq3_decode_slice_header(avctx))
return -1;
- s->pict_type = h->slice_type;
+ s->pict_type = h->slice_type;
s->picture_number = h->slice_num;
- if (avctx->debug&FF_DEBUG_PICT_INFO){
- av_log(h->s.avctx, AV_LOG_DEBUG, "%c hpel:%d, tpel:%d aqp:%d qp:%d, slice_num:%02X\n",
- av_get_picture_type_char(s->pict_type), svq3->halfpel_flag, svq3->thirdpel_flag,
+ if (avctx->debug & FF_DEBUG_PICT_INFO)
+ av_log(h->s.avctx, AV_LOG_DEBUG,
+ "%c hpel:%d, tpel:%d aqp:%d qp:%d, slice_num:%02X\n",
+ av_get_picture_type_char(s->pict_type),
+ svq3->halfpel_flag, svq3->thirdpel_flag,
s->adaptive_quant, s->qscale, h->slice_num);
- }
/* for skipping the frame */
s->current_picture.f.pict_type = s->pict_type;
@@ -985,9 +1047,9 @@ static int svq3_decode_frame(AVCodecContext *avctx,
/* Skip B-frames if we do not have reference frames. */
if (s->last_picture_ptr == NULL && s->pict_type == AV_PICTURE_TYPE_B)
return 0;
- 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)
return 0;
if (s->next_p_frame_damaged) {
@@ -1001,45 +1063,45 @@ static int svq3_decode_frame(AVCodecContext *avctx,
return -1;
if (s->pict_type == AV_PICTURE_TYPE_B) {
- h->frame_num_offset = (h->slice_num - h->prev_frame_num);
+ h->frame_num_offset = h->slice_num - h->prev_frame_num;
- if (h->frame_num_offset < 0) {
+ if (h->frame_num_offset < 0)
h->frame_num_offset += 256;
- }
- if (h->frame_num_offset == 0 || h->frame_num_offset >= h->prev_frame_num_offset) {
+ if (h->frame_num_offset == 0 ||
+ h->frame_num_offset >= h->prev_frame_num_offset) {
av_log(h->s.avctx, AV_LOG_ERROR, "error in B-frame picture id\n");
return -1;
}
} else {
- h->prev_frame_num = h->frame_num;
- h->frame_num = h->slice_num;
- h->prev_frame_num_offset = (h->frame_num - h->prev_frame_num);
+ h->prev_frame_num = h->frame_num;
+ h->frame_num = h->slice_num;
+ h->prev_frame_num_offset = h->frame_num - h->prev_frame_num;
- if (h->prev_frame_num_offset < 0) {
+ if (h->prev_frame_num_offset < 0)
h->prev_frame_num_offset += 256;
- }
}
- for (m = 0; m < 2; m++){
+ for (m = 0; m < 2; m++) {
int i;
- for (i = 0; i < 4; i++){
+ for (i = 0; i < 4; i++) {
int j;
for (j = -1; j < 4; j++)
- h->ref_cache[m][scan8[0] + 8*i + j]= 1;
+ h->ref_cache[m][scan8[0] + 8 * i + j] = 1;
if (i < 3)
- h->ref_cache[m][scan8[0] + 8*i + j]= PART_NOT_AVAILABLE;
+ h->ref_cache[m][scan8[0] + 8 * i + j] = PART_NOT_AVAILABLE;
}
}
for (s->mb_y = 0; s->mb_y < s->mb_height; s->mb_y++) {
for (s->mb_x = 0; s->mb_x < s->mb_width; s->mb_x++) {
- h->mb_xy = s->mb_x + s->mb_y*s->mb_stride;
-
- if ( (get_bits_count(&s->gb) + 7) >= s->gb.size_in_bits &&
- ((get_bits_count(&s->gb) & 7) == 0 || show_bits(&s->gb, (-get_bits_count(&s->gb) & 7)) == 0)) {
+ unsigned mb_type;
+ h->mb_xy = s->mb_x + s->mb_y * s->mb_stride;
+ if ((get_bits_count(&s->gb) + 7) >= s->gb.size_in_bits &&
+ ((get_bits_count(&s->gb) & 7) == 0 ||
+ show_bits(&s->gb, -get_bits_count(&s->gb) & 7) == 0)) {
skip_bits(&s->gb, svq3->next_slice_index - get_bits_count(&s->gb));
- s->gb.size_in_bits = 8*buf_size;
+ s->gb.size_in_bits = 8 * buf_size;
if (svq3_decode_slice_header(avctx))
return -1;
@@ -1049,41 +1111,37 @@ static int svq3_decode_frame(AVCodecContext *avctx,
mb_type = svq3_get_ue_golomb(&s->gb);
- if (s->pict_type == AV_PICTURE_TYPE_I) {
+ if (s->pict_type == AV_PICTURE_TYPE_I)
mb_type += 8;
- } else if (s->pict_type == AV_PICTURE_TYPE_B && mb_type >= 4) {
+ else if (s->pict_type == AV_PICTURE_TYPE_B && mb_type >= 4)
mb_type += 4;
- }
- if ((unsigned)mb_type > 33 || svq3_decode_mb(svq3, mb_type)) {
- av_log(h->s.avctx, AV_LOG_ERROR, "error while decoding MB %d %d\n", s->mb_x, s->mb_y);
+ if (mb_type > 33 || svq3_decode_mb(svq3, mb_type)) {
+ av_log(h->s.avctx, AV_LOG_ERROR,
+ "error while decoding MB %d %d\n", s->mb_x, s->mb_y);
return -1;
}
- if (mb_type != 0) {
- ff_h264_hl_decode_mb (h);
- }
+ if (mb_type != 0)
+ ff_h264_hl_decode_mb(h);
- if (s->pict_type != AV_PICTURE_TYPE_B && !s->low_delay) {
+ if (s->pict_type != AV_PICTURE_TYPE_B && !s->low_delay)
s->current_picture.f.mb_type[s->mb_x + s->mb_y * s->mb_stride] =
(s->pict_type == AV_PICTURE_TYPE_P && mb_type < 8) ? (mb_type - 1) : -1;
- }
}
- ff_draw_horiz_band(s, 16*s->mb_y, 16);
+ ff_draw_horiz_band(s, 16 * s->mb_y, 16);
}
- MPV_frame_end(s);
+ ff_MPV_frame_end(s);
- if (s->pict_type == AV_PICTURE_TYPE_B || s->low_delay) {
- *(AVFrame *) data = *(AVFrame *) &s->current_picture;
- } else {
- *(AVFrame *) data = *(AVFrame *) &s->last_picture;
- }
+ if (s->pict_type == AV_PICTURE_TYPE_B || s->low_delay)
+ *(AVFrame *)data = s->current_picture.f;
+ else
+ *(AVFrame *)data = s->last_picture.f;
/* Do not output the last pic after seeking. */
- if (s->last_picture_ptr || s->low_delay) {
- *data_size = sizeof(AVFrame);
- }
+ if (s->last_picture_ptr || s->low_delay)
+ *got_frame = 1;
return buf_size;
}
@@ -1091,12 +1149,12 @@ static int svq3_decode_frame(AVCodecContext *avctx,
static int svq3_decode_end(AVCodecContext *avctx)
{
SVQ3Context *svq3 = avctx->priv_data;
- H264Context *h = &svq3->h;
+ H264Context *h = &svq3->h;
MpegEncContext *s = &h->s;
ff_h264_free_context(h);
- MPV_common_end(s);
+ ff_MPV_common_end(s);
return 0;
}
@@ -1104,12 +1162,15 @@ static int svq3_decode_end(AVCodecContext *avctx)
AVCodec ff_svq3_decoder = {
.name = "svq3",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_SVQ3,
+ .id = AV_CODEC_ID_SVQ3,
.priv_data_size = sizeof(SVQ3Context),
.init = svq3_decode_init,
.close = svq3_decode_end,
.decode = svq3_decode_frame,
- .capabilities = CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1 | CODEC_CAP_DELAY,
- .long_name = NULL_IF_CONFIG_SMALL("Sorenson Vector Quantizer 3 / Sorenson Video 3 / SVQ3"),
- .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUVJ420P, PIX_FMT_NONE},
+ .capabilities = CODEC_CAP_DRAW_HORIZ_BAND |
+ CODEC_CAP_DR1 |
+ CODEC_CAP_DELAY,
+ .long_name = NULL_IF_CONFIG_SMALL("Sorenson Vector Quantizer 3 / Sorenson Video 3 / SVQ3"),
+ .pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_YUVJ420P,
+ AV_PIX_FMT_NONE},
};
diff --git a/gst-libs/ext/libav/libavcodec/tak.c b/gst-libs/ext/libav/libavcodec/tak.c
new file mode 100644
index 0000000..867a84b
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/tak.c
@@ -0,0 +1,150 @@
+/*
+ * TAK common code
+ * Copyright (c) 2012 Paul B Mahol
+ *
+ * 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
+ */
+
+#include "libavutil/bswap.h"
+#include "libavutil/crc.h"
+#include "libavutil/intreadwrite.h"
+#include "tak.h"
+
+static const uint16_t frame_duration_type_quants[] = {
+ 3, 4, 6, 8, 4096, 8192, 16384, 512, 1024, 2048,
+};
+
+static int tak_get_nb_samples(int sample_rate, enum TAKFrameSizeType type)
+{
+ int nb_samples, max_nb_samples;
+
+ if (type <= TAK_FST_250ms) {
+ nb_samples = sample_rate * frame_duration_type_quants[type] >>
+ TAK_FRAME_DURATION_QUANT_SHIFT;
+ max_nb_samples = 16384;
+ } else if (type < FF_ARRAY_ELEMS(frame_duration_type_quants)) {
+ nb_samples = frame_duration_type_quants[type];
+ max_nb_samples = sample_rate *
+ frame_duration_type_quants[TAK_FST_250ms] >>
+ TAK_FRAME_DURATION_QUANT_SHIFT;
+ } else {
+ return AVERROR_INVALIDDATA;
+ }
+
+ if (nb_samples <= 0 || nb_samples > max_nb_samples)
+ return AVERROR_INVALIDDATA;
+
+ return nb_samples;
+}
+
+static int crc_init = 0;
+#if CONFIG_SMALL
+#define CRC_TABLE_SIZE 257
+#else
+#define CRC_TABLE_SIZE 1024
+#endif
+static AVCRC crc_24[CRC_TABLE_SIZE];
+
+av_cold void ff_tak_init_crc(void)
+{
+ if (!crc_init) {
+ av_crc_init(crc_24, 0, 24, 0x864CFBU, sizeof(crc_24));
+ crc_init = 1;
+ }
+}
+
+int ff_tak_check_crc(const uint8_t *buf, unsigned int buf_size)
+{
+ uint32_t crc, CRC;
+
+ if (buf_size < 4)
+ return AVERROR_INVALIDDATA;
+ buf_size -= 3;
+
+ CRC = av_bswap32(AV_RL24(buf + buf_size)) >> 8;
+ crc = av_crc(crc_24, 0xCE04B7U, buf, buf_size);
+ if (CRC != crc)
+ return AVERROR_INVALIDDATA;
+
+ return 0;
+}
+
+void avpriv_tak_parse_streaminfo(GetBitContext *gb, TAKStreamInfo *s)
+{
+ uint64_t channel_mask = 0;
+ int frame_type, i;
+
+ s->codec = get_bits(gb, TAK_ENCODER_CODEC_BITS);
+ skip_bits(gb, TAK_ENCODER_PROFILE_BITS);
+
+ frame_type = get_bits(gb, TAK_SIZE_FRAME_DURATION_BITS);
+ s->samples = get_bits64(gb, TAK_SIZE_SAMPLES_NUM_BITS);
+
+ s->data_type = get_bits(gb, TAK_FORMAT_DATA_TYPE_BITS);
+ s->sample_rate = get_bits(gb, TAK_FORMAT_SAMPLE_RATE_BITS) +
+ TAK_SAMPLE_RATE_MIN;
+ s->bps = get_bits(gb, TAK_FORMAT_BPS_BITS) +
+ TAK_BPS_MIN;
+ s->channels = get_bits(gb, TAK_FORMAT_CHANNEL_BITS) +
+ TAK_CHANNELS_MIN;
+
+ if (get_bits1(gb)) {
+ skip_bits(gb, TAK_FORMAT_VALID_BITS);
+ if (get_bits1(gb)) {
+ for (i = 0; i < s->channels; i++) {
+ int value = get_bits(gb, TAK_FORMAT_CH_LAYOUT_BITS);
+
+ if (value > 0 && value <= 18)
+ channel_mask |= 1 << (value - 1);
+ }
+ }
+ }
+
+ s->ch_layout = channel_mask;
+ s->frame_samples = tak_get_nb_samples(s->sample_rate, frame_type);
+}
+
+int ff_tak_decode_frame_header(AVCodecContext *avctx, GetBitContext *gb,
+ TAKStreamInfo *ti, int log_level_offset)
+{
+ if (get_bits(gb, TAK_FRAME_HEADER_SYNC_ID_BITS) != TAK_FRAME_HEADER_SYNC_ID) {
+ av_log(avctx, AV_LOG_ERROR + log_level_offset, "missing sync id\n");
+ return AVERROR_INVALIDDATA;
+ }
+
+ ti->flags = get_bits(gb, TAK_FRAME_HEADER_FLAGS_BITS);
+ ti->frame_num = get_bits(gb, TAK_FRAME_HEADER_NO_BITS);
+
+ if (ti->flags & TAK_FRAME_FLAG_IS_LAST) {
+ ti->last_frame_samples = get_bits(gb, TAK_FRAME_HEADER_SAMPLE_COUNT_BITS) + 1;
+ skip_bits(gb, 2);
+ } else {
+ ti->last_frame_samples = 0;
+ }
+
+ if (ti->flags & TAK_FRAME_FLAG_HAS_INFO) {
+ avpriv_tak_parse_streaminfo(gb, ti);
+
+ if (get_bits(gb, 6))
+ skip_bits(gb, 25);
+ align_get_bits(gb);
+ }
+
+ skip_bits(gb, 24);
+
+ return 0;
+}
diff --git a/gst-libs/ext/libav/libavcodec/tak.h b/gst-libs/ext/libav/libavcodec/tak.h
new file mode 100644
index 0000000..fa91149
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/tak.h
@@ -0,0 +1,166 @@
+/*
+ * TAK decoder/demuxer common code
+ * Copyright (c) 2012 Paul B Mahol
+ *
+ * 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
+ * TAK (Tom's lossless Audio Kompressor) decoder/demuxer common functions
+ */
+
+#ifndef AVCODEC_TAK_H
+#define AVCODEC_TAK_H
+
+#include <stdint.h>
+
+#define BITSTREAM_READER_LE
+#include "get_bits.h"
+#include "avcodec.h"
+
+#define TAK_FORMAT_DATA_TYPE_BITS 3
+#define TAK_FORMAT_SAMPLE_RATE_BITS 18
+#define TAK_FORMAT_BPS_BITS 5
+#define TAK_FORMAT_CHANNEL_BITS 4
+#define TAK_FORMAT_VALID_BITS 5
+#define TAK_FORMAT_CH_LAYOUT_BITS 6
+#define TAK_SIZE_FRAME_DURATION_BITS 4
+#define TAK_SIZE_SAMPLES_NUM_BITS 35
+#define TAK_LAST_FRAME_POS_BITS 40
+#define TAK_LAST_FRAME_SIZE_BITS 24
+#define TAK_ENCODER_CODEC_BITS 6
+#define TAK_ENCODER_PROFILE_BITS 4
+#define TAK_ENCODER_VERSION_BITS 24
+#define TAK_SAMPLE_RATE_MIN 6000
+#define TAK_CHANNELS_MIN 1
+#define TAK_BPS_MIN 8
+#define TAK_FRAME_HEADER_FLAGS_BITS 3
+#define TAK_FRAME_HEADER_SYNC_ID 0xA0FF
+#define TAK_FRAME_HEADER_SYNC_ID_BITS 16
+#define TAK_FRAME_HEADER_SAMPLE_COUNT_BITS 14
+#define TAK_FRAME_HEADER_NO_BITS 21
+#define TAK_FRAME_DURATION_QUANT_SHIFT 5
+#define TAK_CRC24_BITS 24
+
+
+#define TAK_FRAME_FLAG_IS_LAST 0x1
+#define TAK_FRAME_FLAG_HAS_INFO 0x2
+#define TAK_FRAME_FLAG_HAS_METADATA 0x4
+
+#define TAK_MAX_CHANNELS (1 << TAK_FORMAT_CHANNEL_BITS)
+
+#define TAK_MIN_FRAME_HEADER_BITS (TAK_FRAME_HEADER_SYNC_ID_BITS + \
+ TAK_FRAME_HEADER_FLAGS_BITS + \
+ TAK_FRAME_HEADER_NO_BITS + \
+ TAK_CRC24_BITS)
+
+#define TAK_MIN_FRAME_HEADER_LAST_BITS (TAK_MIN_FRAME_HEADER_BITS + 2 + \
+ TAK_FRAME_HEADER_SAMPLE_COUNT_BITS)
+
+#define TAK_ENCODER_BITS (TAK_ENCODER_CODEC_BITS + \
+ TAK_ENCODER_PROFILE_BITS)
+
+#define TAK_SIZE_BITS (TAK_SIZE_SAMPLES_NUM_BITS + \
+ TAK_SIZE_FRAME_DURATION_BITS)
+
+#define TAK_FORMAT_BITS (TAK_FORMAT_DATA_TYPE_BITS + \
+ TAK_FORMAT_SAMPLE_RATE_BITS + \
+ TAK_FORMAT_BPS_BITS + \
+ TAK_FORMAT_CHANNEL_BITS + 1 + \
+ TAK_FORMAT_VALID_BITS + 1 + \
+ TAK_FORMAT_CH_LAYOUT_BITS * \
+ TAK_MAX_CHANNELS)
+
+#define TAK_STREAMINFO_BITS (TAK_ENCODER_BITS + \
+ TAK_SIZE_BITS + \
+ TAK_FORMAT_BITS)
+
+#define TAK_MAX_FRAME_HEADER_BITS (TAK_MIN_FRAME_HEADER_LAST_BITS + \
+ TAK_STREAMINFO_BITS + 31)
+
+#define TAK_STREAMINFO_BYTES ((TAK_STREAMINFO_BITS + 7) / 8)
+#define TAK_MAX_FRAME_HEADER_BYTES ((TAK_MAX_FRAME_HEADER_BITS + 7) / 8)
+#define TAK_MIN_FRAME_HEADER_BYTES ((TAK_MIN_FRAME_HEADER_BITS + 7) / 8)
+
+enum TAKCodecType {
+ TAK_CODEC_MONO_STEREO = 2,
+ TAK_CODEC_MULTICHANNEL = 4
+};
+
+enum TAKMetaDataType {
+ TAK_METADATA_END = 0,
+ TAK_METADATA_STREAMINFO,
+ TAK_METADATA_SEEKTABLE,
+ TAK_METADATA_SIMPLE_WAVE_DATA,
+ TAK_METADATA_ENCODER,
+ TAK_METADATA_PADDING,
+ TAK_METADATA_MD5,
+ TAK_METADATA_LAST_FRAME,
+};
+
+enum TAKFrameSizeType {
+ TAK_FST_94ms = 0,
+ TAK_FST_125ms,
+ TAK_FST_188ms,
+ TAK_FST_250ms,
+ TAK_FST_4096,
+ TAK_FST_8192,
+ TAK_FST_16384,
+ TAK_FST_512,
+ TAK_FST_1024,
+ TAK_FST_2048,
+};
+
+typedef struct TAKStreamInfo {
+ int flags;
+ enum TAKCodecType codec;
+ int data_type;
+ int sample_rate;
+ int channels;
+ int bps;
+ int frame_num;
+ int frame_samples;
+ int last_frame_samples;
+ uint64_t ch_layout;
+ int64_t samples;
+} TAKStreamInfo;
+
+void ff_tak_init_crc(void);
+
+int ff_tak_check_crc(const uint8_t *buf, unsigned int buf_size);
+
+/**
+ * Parse the Streaminfo metadata block.
+ * @param[in] gb pointer to GetBitContext
+ * @param[out] s storage for parsed information
+ */
+void avpriv_tak_parse_streaminfo(GetBitContext *gb, TAKStreamInfo *s);
+
+/**
+ * Validate and decode a frame header.
+ * @param avctx AVCodecContext to use as av_log() context
+ * @param[in] gb GetBitContext from which to read frame header
+ * @param[out] s frame information
+ * @param log_level_offset log level offset, can be used to silence
+ * error messages.
+ * @return non-zero on error, 0 if OK
+ */
+int ff_tak_decode_frame_header(AVCodecContext *avctx, GetBitContext *gb,
+ TAKStreamInfo *s, int log_level_offset);
+
+#endif /* AVCODEC_TAK_H */
diff --git a/gst-libs/ext/libav/libavcodec/tak_parser.c b/gst-libs/ext/libav/libavcodec/tak_parser.c
new file mode 100644
index 0000000..295df24
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/tak_parser.c
@@ -0,0 +1,128 @@
+/*
+ * TAK parser
+ * Copyright (c) 2012 Michael Niedermayer
+ *
+ * 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
+ * TAK parser
+ **/
+
+#include "tak.h"
+#include "parser.h"
+
+typedef struct TAKParseContext {
+ ParseContext pc;
+ TAKStreamInfo ti;
+ int index;
+} TAKParseContext;
+
+static av_cold int tak_init(AVCodecParserContext *s)
+{
+ ff_tak_init_crc();
+ return 0;
+}
+
+static int tak_parse(AVCodecParserContext *s, AVCodecContext *avctx,
+ const uint8_t **poutbuf, int *poutbuf_size,
+ const uint8_t *buf, int buf_size)
+{
+ TAKParseContext *t = s->priv_data;
+ ParseContext *pc = &t->pc;
+ int next = END_NOT_FOUND;
+ GetBitContext gb;
+ int consumed = 0;
+ int needed = buf_size ? TAK_MAX_FRAME_HEADER_BYTES : 8;
+
+ if (s->flags & PARSER_FLAG_COMPLETE_FRAMES) {
+ TAKStreamInfo ti;
+ init_get_bits(&gb, buf, buf_size);
+ if (!ff_tak_decode_frame_header(avctx, &gb, &ti, 127))
+ s->duration = t->ti.last_frame_samples ? t->ti.last_frame_samples
+ : t->ti.frame_samples;
+ *poutbuf = buf;
+ *poutbuf_size = buf_size;
+ return buf_size;
+ }
+
+ while (buf_size || t->index + needed <= pc->index) {
+ if (buf_size && t->index + TAK_MAX_FRAME_HEADER_BYTES > pc->index) {
+ int tmp_buf_size = FFMIN(2 * TAK_MAX_FRAME_HEADER_BYTES,
+ buf_size);
+ const uint8_t *tmp_buf = buf;
+
+ ff_combine_frame(pc, END_NOT_FOUND, &tmp_buf, &tmp_buf_size);
+ consumed += tmp_buf_size;
+ buf += tmp_buf_size;
+ buf_size -= tmp_buf_size;
+ }
+
+ for (; t->index + needed <= pc->index; t->index++)
+ if (pc->buffer[t->index] == 0xFF &&
+ pc->buffer[t->index + 1] == 0xA0) {
+ TAKStreamInfo ti;
+
+ init_get_bits(&gb, pc->buffer + t->index,
+ 8 * (pc->index - t->index));
+ if (!ff_tak_decode_frame_header(avctx, &gb,
+ pc->frame_start_found ? &ti
+ : &t->ti,
+ 127) &&
+ !ff_tak_check_crc(pc->buffer + t->index,
+ get_bits_count(&gb) / 8)) {
+ if (!pc->frame_start_found) {
+ pc->frame_start_found = 1;
+ s->duration = t->ti.last_frame_samples ?
+ t->ti.last_frame_samples :
+ t->ti.frame_samples;
+ } else {
+ pc->frame_start_found = 0;
+ next = t->index - pc->index;
+ t->index = 0;
+ goto found;
+ }
+ }
+ }
+ }
+
+found:
+ if (consumed && !buf_size && next == END_NOT_FOUND ||
+ ff_combine_frame(pc, next, &buf, &buf_size) < 0) {
+ *poutbuf = NULL;
+ *poutbuf_size = 0;
+ return buf_size + consumed;
+ }
+
+ if (next != END_NOT_FOUND) {
+ next += consumed;
+ pc->overread = FFMAX(0, -next);
+ }
+
+ *poutbuf = buf;
+ *poutbuf_size = buf_size;
+ return next;
+}
+
+AVCodecParser ff_tak_parser = {
+ .codec_ids = { AV_CODEC_ID_TAK },
+ .priv_data_size = sizeof(TAKParseContext),
+ .parser_init = tak_init,
+ .parser_parse = tak_parse,
+ .parser_close = ff_parse_close,
+};
diff --git a/gst-libs/ext/libav/libavcodec/takdec.c b/gst-libs/ext/libav/libavcodec/takdec.c
new file mode 100644
index 0000000..d47db48
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/takdec.c
@@ -0,0 +1,933 @@
+/*
+ * TAK decoder
+ * Copyright (c) 2012 Paul B Mahol
+ *
+ * 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
+ * TAK (Tom's lossless Audio Kompressor) decoder
+ * @author Paul B Mahol
+ */
+
+#include "libavutil/samplefmt.h"
+#include "tak.h"
+#include "avcodec.h"
+#include "dsputil.h"
+#include "internal.h"
+#include "unary.h"
+
+#define MAX_SUBFRAMES 8 // max number of subframes per channel
+#define MAX_PREDICTORS 256
+
+typedef struct MCDParam {
+ int8_t present; // decorrelation parameter availability for this channel
+ int8_t index; // index into array of decorrelation types
+ int8_t chan1;
+ int8_t chan2;
+} MCDParam;
+
+typedef struct TAKDecContext {
+ AVCodecContext *avctx; // parent AVCodecContext
+ AVFrame frame; // AVFrame for decoded output
+ DSPContext dsp;
+ TAKStreamInfo ti;
+ GetBitContext gb; // bitstream reader initialized to start at the current frame
+
+ int uval;
+ int nb_samples; // number of samples in the current frame
+ uint8_t *decode_buffer;
+ unsigned int decode_buffer_size;
+ int32_t *decoded[TAK_MAX_CHANNELS]; // decoded samples for each channel
+
+ int8_t lpc_mode[TAK_MAX_CHANNELS];
+ int8_t sample_shift[TAK_MAX_CHANNELS]; // shift applied to every sample in the channel
+ int subframe_scale;
+
+ int8_t dmode; // channel decorrelation type in the current frame
+
+ MCDParam mcdparams[TAK_MAX_CHANNELS]; // multichannel decorrelation parameters
+
+ int16_t *residues;
+ unsigned int residues_buf_size;
+} TAKDecContext;
+
+static const int8_t mc_dmodes[] = { 1, 3, 4, 6, };
+
+static const uint16_t predictor_sizes[] = {
+ 4, 8, 12, 16, 24, 32, 48, 64, 80, 96, 128, 160, 192, 224, 256, 0,
+};
+
+static const struct CParam {
+ int init;
+ int escape;
+ int scale;
+ int aescape;
+ int bias;
+} xcodes[50] = {
+ { 0x01, 0x0000001, 0x0000001, 0x0000003, 0x0000008 },
+ { 0x02, 0x0000003, 0x0000001, 0x0000007, 0x0000006 },
+ { 0x03, 0x0000005, 0x0000002, 0x000000E, 0x000000D },
+ { 0x03, 0x0000003, 0x0000003, 0x000000D, 0x0000018 },
+ { 0x04, 0x000000B, 0x0000004, 0x000001C, 0x0000019 },
+ { 0x04, 0x0000006, 0x0000006, 0x000001A, 0x0000030 },
+ { 0x05, 0x0000016, 0x0000008, 0x0000038, 0x0000032 },
+ { 0x05, 0x000000C, 0x000000C, 0x0000034, 0x0000060 },
+ { 0x06, 0x000002C, 0x0000010, 0x0000070, 0x0000064 },
+ { 0x06, 0x0000018, 0x0000018, 0x0000068, 0x00000C0 },
+ { 0x07, 0x0000058, 0x0000020, 0x00000E0, 0x00000C8 },
+ { 0x07, 0x0000030, 0x0000030, 0x00000D0, 0x0000180 },
+ { 0x08, 0x00000B0, 0x0000040, 0x00001C0, 0x0000190 },
+ { 0x08, 0x0000060, 0x0000060, 0x00001A0, 0x0000300 },
+ { 0x09, 0x0000160, 0x0000080, 0x0000380, 0x0000320 },
+ { 0x09, 0x00000C0, 0x00000C0, 0x0000340, 0x0000600 },
+ { 0x0A, 0x00002C0, 0x0000100, 0x0000700, 0x0000640 },
+ { 0x0A, 0x0000180, 0x0000180, 0x0000680, 0x0000C00 },
+ { 0x0B, 0x0000580, 0x0000200, 0x0000E00, 0x0000C80 },
+ { 0x0B, 0x0000300, 0x0000300, 0x0000D00, 0x0001800 },
+ { 0x0C, 0x0000B00, 0x0000400, 0x0001C00, 0x0001900 },
+ { 0x0C, 0x0000600, 0x0000600, 0x0001A00, 0x0003000 },
+ { 0x0D, 0x0001600, 0x0000800, 0x0003800, 0x0003200 },
+ { 0x0D, 0x0000C00, 0x0000C00, 0x0003400, 0x0006000 },
+ { 0x0E, 0x0002C00, 0x0001000, 0x0007000, 0x0006400 },
+ { 0x0E, 0x0001800, 0x0001800, 0x0006800, 0x000C000 },
+ { 0x0F, 0x0005800, 0x0002000, 0x000E000, 0x000C800 },
+ { 0x0F, 0x0003000, 0x0003000, 0x000D000, 0x0018000 },
+ { 0x10, 0x000B000, 0x0004000, 0x001C000, 0x0019000 },
+ { 0x10, 0x0006000, 0x0006000, 0x001A000, 0x0030000 },
+ { 0x11, 0x0016000, 0x0008000, 0x0038000, 0x0032000 },
+ { 0x11, 0x000C000, 0x000C000, 0x0034000, 0x0060000 },
+ { 0x12, 0x002C000, 0x0010000, 0x0070000, 0x0064000 },
+ { 0x12, 0x0018000, 0x0018000, 0x0068000, 0x00C0000 },
+ { 0x13, 0x0058000, 0x0020000, 0x00E0000, 0x00C8000 },
+ { 0x13, 0x0030000, 0x0030000, 0x00D0000, 0x0180000 },
+ { 0x14, 0x00B0000, 0x0040000, 0x01C0000, 0x0190000 },
+ { 0x14, 0x0060000, 0x0060000, 0x01A0000, 0x0300000 },
+ { 0x15, 0x0160000, 0x0080000, 0x0380000, 0x0320000 },
+ { 0x15, 0x00C0000, 0x00C0000, 0x0340000, 0x0600000 },
+ { 0x16, 0x02C0000, 0x0100000, 0x0700000, 0x0640000 },
+ { 0x16, 0x0180000, 0x0180000, 0x0680000, 0x0C00000 },
+ { 0x17, 0x0580000, 0x0200000, 0x0E00000, 0x0C80000 },
+ { 0x17, 0x0300000, 0x0300000, 0x0D00000, 0x1800000 },
+ { 0x18, 0x0B00000, 0x0400000, 0x1C00000, 0x1900000 },
+ { 0x18, 0x0600000, 0x0600000, 0x1A00000, 0x3000000 },
+ { 0x19, 0x1600000, 0x0800000, 0x3800000, 0x3200000 },
+ { 0x19, 0x0C00000, 0x0C00000, 0x3400000, 0x6000000 },
+ { 0x1A, 0x2C00000, 0x1000000, 0x7000000, 0x6400000 },
+ { 0x1A, 0x1800000, 0x1800000, 0x6800000, 0xC000000 },
+};
+
+static av_cold void tak_init_static_data(AVCodec *codec)
+{
+ ff_tak_init_crc();
+}
+
+static int set_bps_params(AVCodecContext *avctx)
+{
+ switch (avctx->bits_per_coded_sample) {
+ case 8:
+ avctx->sample_fmt = AV_SAMPLE_FMT_U8P;
+ break;
+ case 16:
+ avctx->sample_fmt = AV_SAMPLE_FMT_S16P;
+ break;
+ case 24:
+ avctx->sample_fmt = AV_SAMPLE_FMT_S32P;
+ break;
+ default:
+ av_log(avctx, AV_LOG_ERROR, "unsupported bits per sample: %d\n",
+ avctx->bits_per_coded_sample);
+ return AVERROR_INVALIDDATA;
+ }
+ avctx->bits_per_raw_sample = avctx->bits_per_coded_sample;
+
+ return 0;
+}
+
+static void set_sample_rate_params(AVCodecContext *avctx)
+{
+ TAKDecContext *s = avctx->priv_data;
+ int shift = 3 - (avctx->sample_rate / 11025);
+ shift = FFMAX(0, shift);
+ s->uval = FFALIGN(avctx->sample_rate + 511 >> 9, 4) << shift;
+ s->subframe_scale = FFALIGN(avctx->sample_rate + 511 >> 9, 4) << 1;
+}
+
+static av_cold int tak_decode_init(AVCodecContext *avctx)
+{
+ TAKDecContext *s = avctx->priv_data;
+
+ ff_dsputil_init(&s->dsp, avctx);
+
+ s->avctx = avctx;
+ avcodec_get_frame_defaults(&s->frame);
+ avctx->coded_frame = &s->frame;
+
+ set_sample_rate_params(avctx);
+
+ return set_bps_params(avctx);
+}
+
+static void decode_lpc(int32_t *coeffs, int mode, int length)
+{
+ int i;
+
+ if (length < 2)
+ return;
+
+ if (mode == 1) {
+ int a1 = *coeffs++;
+ for (i = 0; i < length - 1 >> 1; i++) {
+ *coeffs += a1;
+ coeffs[1] += *coeffs;
+ a1 = coeffs[1];
+ coeffs += 2;
+ }
+ if (length - 1 & 1)
+ *coeffs += a1;
+ } else if (mode == 2) {
+ int a1 = coeffs[1];
+ int a2 = a1 + *coeffs;
+ coeffs[1] = a2;
+ if (length > 2) {
+ coeffs += 2;
+ for (i = 0; i < length - 2 >> 1; i++) {
+ int a3 = *coeffs + a1;
+ int a4 = a3 + a2;
+ *coeffs = a4;
+ a1 = coeffs[1] + a3;
+ a2 = a1 + a4;
+ coeffs[1] = a2;
+ coeffs += 2;
+ }
+ if (length & 1)
+ *coeffs += a1 + a2;
+ }
+ } else if (mode == 3) {
+ int a1 = coeffs[1];
+ int a2 = a1 + *coeffs;
+ coeffs[1] = a2;
+ if (length > 2) {
+ int a3 = coeffs[2];
+ int a4 = a3 + a1;
+ int a5 = a4 + a2;
+ coeffs += 3;
+ for (i = 0; i < length - 3; i++) {
+ a3 += *coeffs;
+ a4 += a3;
+ a5 += a4;
+ *coeffs = a5;
+ coeffs++;
+ }
+ }
+ }
+}
+
+static int decode_segment(GetBitContext *gb, int mode, int32_t *decoded,
+ int len)
+{
+ struct CParam code;
+ int i;
+
+ if (!mode) {
+ memset(decoded, 0, len * sizeof(*decoded));
+ return 0;
+ }
+
+ if (mode > FF_ARRAY_ELEMS(xcodes))
+ return AVERROR_INVALIDDATA;
+ code = xcodes[mode - 1];
+
+ for (i = 0; i < len; i++) {
+ int x = get_bits_long(gb, code.init);
+ if (x >= code.escape && get_bits1(gb)) {
+ x |= 1 << code.init;
+ if (x >= code.aescape) {
+ int scale = get_unary(gb, 1, 9);
+ if (scale == 9) {
+ int scale_bits = get_bits(gb, 3);
+ if (scale_bits > 0) {
+ if (scale_bits == 7) {
+ scale_bits += get_bits(gb, 5);
+ if (scale_bits > 29)
+ return AVERROR_INVALIDDATA;
+ }
+ scale = get_bits_long(gb, scale_bits) + 1;
+ x += code.scale * scale;
+ }
+ x += code.bias;
+ } else
+ x += code.scale * scale - code.escape;
+ } else
+ x -= code.escape;
+ }
+ decoded[i] = (x >> 1) ^ -(x & 1);
+ }
+
+ return 0;
+}
+
+static int decode_residues(TAKDecContext *s, int32_t *decoded, int length)
+{
+ GetBitContext *gb = &s->gb;
+ int i, mode, ret;
+
+ if (length > s->nb_samples)
+ return AVERROR_INVALIDDATA;
+
+ if (get_bits1(gb)) {
+ int wlength, rval;
+ int coding_mode[128];
+
+ wlength = length / s->uval;
+
+ rval = length - (wlength * s->uval);
+
+ if (rval < s->uval / 2)
+ rval += s->uval;
+ else
+ wlength++;
+
+ if (wlength <= 1 || wlength > 128)
+ return AVERROR_INVALIDDATA;
+
+ coding_mode[0] = mode = get_bits(gb, 6);
+
+ for (i = 1; i < wlength; i++) {
+ int c = get_unary(gb, 1, 6);
+
+ switch (c) {
+ case 6:
+ mode = get_bits(gb, 6);
+ break;
+ case 5:
+ case 4:
+ case 3: {
+ /* mode += sign ? (1 - c) : (c - 1) */
+ int sign = get_bits1(gb);
+ mode += (-sign ^ (c - 1)) + sign;
+ break;
+ }
+ case 2:
+ mode++;
+ break;
+ case 1:
+ mode--;
+ break;
+ }
+ coding_mode[i] = mode;
+ }
+
+ i = 0;
+ while (i < wlength) {
+ int len = 0;
+
+ mode = coding_mode[i];
+ do {
+ if (i >= wlength - 1)
+ len += rval;
+ else
+ len += s->uval;
+ i++;
+
+ if (i == wlength)
+ break;
+ } while (coding_mode[i] == mode);
+
+ if ((ret = decode_segment(gb, mode, decoded, len)) < 0)
+ return ret;
+ decoded += len;
+ }
+ } else {
+ mode = get_bits(gb, 6);
+ if ((ret = decode_segment(gb, mode, decoded, length)) < 0)
+ return ret;
+ }
+
+ return 0;
+}
+
+static int get_bits_esc4(GetBitContext *gb)
+{
+ if (get_bits1(gb))
+ return get_bits(gb, 4) + 1;
+ else
+ return 0;
+}
+
+static void decode_filter_coeffs(TAKDecContext *s, int filter_order, int size,
+ int filter_quant, int16_t *filter)
+{
+ GetBitContext *gb = &s->gb;
+ int i, j, a, b;
+ int filter_tmp[MAX_PREDICTORS];
+ int16_t predictors[MAX_PREDICTORS];
+
+ predictors[0] = get_sbits(gb, 10);
+ predictors[1] = get_sbits(gb, 10);
+ predictors[2] = get_sbits(gb, size) << (10 - size);
+ predictors[3] = get_sbits(gb, size) << (10 - size);
+ if (filter_order > 4) {
+ int av_uninit(code_size);
+ int code_size_base = size - get_bits1(gb);
+
+ for (i = 4; i < filter_order; i++) {
+ if (!(i & 3))
+ code_size = code_size_base - get_bits(gb, 2);
+ predictors[i] = get_sbits(gb, code_size) << (10 - size);
+ }
+ }
+
+ filter_tmp[0] = predictors[0] << 6;
+ for (i = 1; i < filter_order; i++) {
+ int *p1 = &filter_tmp[0];
+ int *p2 = &filter_tmp[i - 1];
+
+ for (j = 0; j < (i + 1) / 2; j++) {
+ int tmp = *p1 + (predictors[i] * *p2 + 256 >> 9);
+ *p2 = *p2 + (predictors[i] * *p1 + 256 >> 9);
+ *p1 = tmp;
+ p1++;
+ p2--;
+ }
+
+ filter_tmp[i] = predictors[i] << 6;
+ }
+
+ a = 1 << (32 - (15 - filter_quant));
+ b = 1 << ((15 - filter_quant) - 1);
+ for (i = 0, j = filter_order - 1; i < filter_order / 2; i++, j--) {
+ filter[j] = a - ((filter_tmp[i] + b) >> (15 - filter_quant));
+ filter[i] = a - ((filter_tmp[j] + b) >> (15 - filter_quant));
+ }
+}
+
+static int decode_subframe(TAKDecContext *s, int32_t *decoded,
+ int subframe_size, int prev_subframe_size)
+{
+ LOCAL_ALIGNED_16(int16_t, filter, [MAX_PREDICTORS]);
+ GetBitContext *gb = &s->gb;
+ int i, ret;
+ int dshift, size, filter_quant, filter_order;
+
+ memset(filter, 0, MAX_PREDICTORS * sizeof(*filter));
+
+ if (!get_bits1(gb))
+ return decode_residues(s, decoded, subframe_size);
+
+ filter_order = predictor_sizes[get_bits(gb, 4)];
+
+ if (prev_subframe_size > 0 && get_bits1(gb)) {
+ if (filter_order > prev_subframe_size)
+ return AVERROR_INVALIDDATA;
+
+ decoded -= filter_order;
+ subframe_size += filter_order;
+
+ if (filter_order > subframe_size)
+ return AVERROR_INVALIDDATA;
+ } else {
+ int lpc_mode;
+
+ if (filter_order > subframe_size)
+ return AVERROR_INVALIDDATA;
+
+ lpc_mode = get_bits(gb, 2);
+ if (lpc_mode > 2)
+ return AVERROR_INVALIDDATA;
+
+ if ((ret = decode_residues(s, decoded, filter_order)) < 0)
+ return ret;
+
+ if (lpc_mode)
+ decode_lpc(decoded, lpc_mode, filter_order);
+ }
+
+ dshift = get_bits_esc4(gb);
+ size = get_bits1(gb) + 6;
+
+ filter_quant = 10;
+ if (get_bits1(gb)) {
+ filter_quant -= get_bits(gb, 3) + 1;
+ if (filter_quant < 3)
+ return AVERROR_INVALIDDATA;
+ }
+
+ decode_filter_coeffs(s, filter_order, size, filter_quant, filter);
+
+ if ((ret = decode_residues(s, &decoded[filter_order],
+ subframe_size - filter_order)) < 0)
+ return ret;
+
+ av_fast_malloc(&s->residues, &s->residues_buf_size,
+ FFALIGN(subframe_size + 16, 16) * sizeof(*s->residues));
+ if (!s->residues)
+ return AVERROR(ENOMEM);
+ memset(s->residues, 0, s->residues_buf_size);
+
+ for (i = 0; i < filter_order; i++)
+ s->residues[i] = *decoded++ >> dshift;
+
+ for (i = 0; i < subframe_size - filter_order; i++) {
+ int v = 1 << (filter_quant - 1);
+
+ v += s->dsp.scalarproduct_int16(&s->residues[i], filter,
+ FFALIGN(filter_order, 16));
+
+ v = (av_clip(v >> filter_quant, -8192, 8191) << dshift) - *decoded;
+ *decoded++ = v;
+ s->residues[filter_order + i] = v >> dshift;
+ }
+
+ emms_c();
+
+ return 0;
+}
+
+static int decode_channel(TAKDecContext *s, int chan)
+{
+ AVCodecContext *avctx = s->avctx;
+ GetBitContext *gb = &s->gb;
+ int32_t *decoded = s->decoded[chan];
+ int left = s->nb_samples - 1;
+ int i, prev, ret, nb_subframes;
+ int subframe_len[MAX_SUBFRAMES];
+
+ s->sample_shift[chan] = get_bits_esc4(gb);
+ if (s->sample_shift[chan] >= avctx->bits_per_coded_sample)
+ return AVERROR_INVALIDDATA;
+
+ /* NOTE: TAK 2.2.0 appears to set the sample value to 0 if
+ * bits_per_coded_sample - sample_shift is 1, but this produces
+ * non-bit-exact output. Reading the 1 bit using get_sbits() instead
+ * of skipping it produces bit-exact output. This has been reported
+ * to the TAK author. */
+ *decoded++ = get_sbits(gb,
+ avctx->bits_per_coded_sample -
+ s->sample_shift[chan]);
+ s->lpc_mode[chan] = get_bits(gb, 2);
+ nb_subframes = get_bits(gb, 3) + 1;
+
+ i = 0;
+ if (nb_subframes > 1) {
+ if (get_bits_left(gb) < (nb_subframes - 1) * 6)
+ return AVERROR_INVALIDDATA;
+
+ prev = 0;
+ for (; i < nb_subframes - 1; i++) {
+ int subframe_end = get_bits(gb, 6) * s->subframe_scale;
+ if (subframe_end <= prev)
+ return AVERROR_INVALIDDATA;
+ subframe_len[i] = subframe_end - prev;
+ left -= subframe_len[i];
+ prev = subframe_end;
+ }
+
+ if (left <= 0)
+ return AVERROR_INVALIDDATA;
+ }
+ subframe_len[i] = left;
+
+ prev = 0;
+ for (i = 0; i < nb_subframes; i++) {
+ if ((ret = decode_subframe(s, decoded, subframe_len[i], prev)) < 0)
+ return ret;
+ decoded += subframe_len[i];
+ prev = subframe_len[i];
+ }
+
+ return 0;
+}
+
+static int decorrelate(TAKDecContext *s, int c1, int c2, int length)
+{
+ GetBitContext *gb = &s->gb;
+ int32_t *p1 = s->decoded[c1] + 1;
+ int32_t *p2 = s->decoded[c2] + 1;
+ int i;
+ int dshift, dfactor;
+
+ switch (s->dmode) {
+ case 1: /* left/side */
+ for (i = 0; i < length; i++) {
+ int32_t a = p1[i];
+ int32_t b = p2[i];
+ p2[i] = a + b;
+ }
+ break;
+ case 2: /* side/right */
+ for (i = 0; i < length; i++) {
+ int32_t a = p1[i];
+ int32_t b = p2[i];
+ p1[i] = b - a;
+ }
+ break;
+ case 3: /* side/mid */
+ for (i = 0; i < length; i++) {
+ int32_t a = p1[i];
+ int32_t b = p2[i];
+ a -= b >> 1;
+ p1[i] = a;
+ p2[i] = a + b;
+ }
+ break;
+ case 4: /* side/left with scale factor */
+ FFSWAP(int32_t*, p1, p2);
+ case 5: /* side/right with scale factor */
+ dshift = get_bits_esc4(gb);
+ dfactor = get_sbits(gb, 10);
+ for (i = 0; i < length; i++) {
+ int32_t a = p1[i];
+ int32_t b = p2[i];
+ b = dfactor * (b >> dshift) + 128 >> 8 << dshift;
+ p1[i] = b - a;
+ }
+ break;
+ case 6:
+ FFSWAP(int32_t*, p1, p2);
+ case 7: {
+ LOCAL_ALIGNED_16(int16_t, filter, [MAX_PREDICTORS]);
+ int length2, order_half, filter_order, dval1, dval2;
+ int av_uninit(code_size);
+
+ memset(filter, 0, MAX_PREDICTORS * sizeof(*filter));
+
+ if (length < 256)
+ return AVERROR_INVALIDDATA;
+
+ dshift = get_bits_esc4(gb);
+ filter_order = 8 << get_bits1(gb);
+ dval1 = get_bits1(gb);
+ dval2 = get_bits1(gb);
+
+ for (i = 0; i < filter_order; i++) {
+ if (!(i & 3))
+ code_size = 14 - get_bits(gb, 3);
+ filter[i] = get_sbits(gb, code_size);
+ }
+
+ order_half = filter_order / 2;
+ length2 = length - (filter_order - 1);
+
+ /* decorrelate beginning samples */
+ if (dval1) {
+ for (i = 0; i < order_half; i++) {
+ int32_t a = p1[i];
+ int32_t b = p2[i];
+ p1[i] = a + b;
+ }
+ }
+
+ /* decorrelate ending samples */
+ if (dval2) {
+ for (i = length2 + order_half; i < length; i++) {
+ int32_t a = p1[i];
+ int32_t b = p2[i];
+ p1[i] = a + b;
+ }
+ }
+
+ av_fast_malloc(&s->residues, &s->residues_buf_size,
+ FFALIGN(length + 16, 16) * sizeof(*s->residues));
+ if (!s->residues)
+ return AVERROR(ENOMEM);
+ memset(s->residues, 0, s->residues_buf_size);
+
+ for (i = 0; i < length; i++)
+ s->residues[i] = p2[i] >> dshift;
+
+ p1 += order_half;
+
+ for (i = 0; i < length2; i++) {
+ int v = 1 << 9;
+
+ v += s->dsp.scalarproduct_int16(&s->residues[i], filter,
+ FFALIGN(filter_order, 16));
+
+ p1[i] = (av_clip(v >> 10, -8192, 8191) << dshift) - p1[i];
+ }
+
+ emms_c();
+ break;
+ }
+ }
+
+ return 0;
+}
+
+static int tak_decode_frame(AVCodecContext *avctx, void *data,
+ int *got_frame_ptr, AVPacket *pkt)
+{
+ TAKDecContext *s = avctx->priv_data;
+ GetBitContext *gb = &s->gb;
+ int chan, i, ret, hsize;
+
+ if (pkt->size < TAK_MIN_FRAME_HEADER_BYTES)
+ return AVERROR_INVALIDDATA;
+
+ init_get_bits(gb, pkt->data, pkt->size * 8);
+
+ if ((ret = ff_tak_decode_frame_header(avctx, gb, &s->ti, 0)) < 0)
+ return ret;
+
+ if (s->ti.flags & TAK_FRAME_FLAG_HAS_METADATA) {
+ av_log_missing_feature(avctx, "frame metadata", 1);
+ return AVERROR_PATCHWELCOME;
+ }
+
+ hsize = get_bits_count(gb) / 8;
+ if (avctx->err_recognition & AV_EF_CRCCHECK) {
+ if (ff_tak_check_crc(pkt->data, hsize)) {
+ av_log(avctx, AV_LOG_ERROR, "CRC error\n");
+ return AVERROR_INVALIDDATA;
+ }
+ }
+
+ if (s->ti.codec != TAK_CODEC_MONO_STEREO &&
+ s->ti.codec != TAK_CODEC_MULTICHANNEL) {
+ av_log(avctx, AV_LOG_ERROR, "unsupported codec: %d\n", s->ti.codec);
+ return AVERROR_PATCHWELCOME;
+ }
+ if (s->ti.data_type) {
+ av_log(avctx, AV_LOG_ERROR,
+ "unsupported data type: %d\n", s->ti.data_type);
+ return AVERROR_INVALIDDATA;
+ }
+ if (s->ti.codec == TAK_CODEC_MONO_STEREO && s->ti.channels > 2) {
+ av_log(avctx, AV_LOG_ERROR,
+ "invalid number of channels: %d\n", s->ti.channels);
+ return AVERROR_INVALIDDATA;
+ }
+ if (s->ti.channels > 6) {
+ av_log(avctx, AV_LOG_ERROR,
+ "unsupported number of channels: %d\n", s->ti.channels);
+ return AVERROR_INVALIDDATA;
+ }
+
+ if (s->ti.frame_samples <= 0) {
+ av_log(avctx, AV_LOG_ERROR, "unsupported/invalid number of samples\n");
+ return AVERROR_INVALIDDATA;
+ }
+
+ if (s->ti.bps != avctx->bits_per_coded_sample) {
+ avctx->bits_per_coded_sample = s->ti.bps;
+ if ((ret = set_bps_params(avctx)) < 0)
+ return ret;
+ }
+ if (s->ti.sample_rate != avctx->sample_rate) {
+ avctx->sample_rate = s->ti.sample_rate;
+ set_sample_rate_params(avctx);
+ }
+ if (s->ti.ch_layout)
+ avctx->channel_layout = s->ti.ch_layout;
+ avctx->channels = s->ti.channels;
+
+ s->nb_samples = s->ti.last_frame_samples ? s->ti.last_frame_samples
+ : s->ti.frame_samples;
+
+ s->frame.nb_samples = s->nb_samples;
+ if ((ret = ff_get_buffer(avctx, &s->frame)) < 0)
+ return ret;
+
+ if (avctx->bits_per_coded_sample <= 16) {
+ int buf_size = av_samples_get_buffer_size(NULL, avctx->channels,
+ s->nb_samples,
+ AV_SAMPLE_FMT_S32P, 0);
+ av_fast_malloc(&s->decode_buffer, &s->decode_buffer_size, buf_size);
+ if (!s->decode_buffer)
+ return AVERROR(ENOMEM);
+ ret = av_samples_fill_arrays((uint8_t **)s->decoded, NULL,
+ s->decode_buffer, avctx->channels,
+ s->nb_samples, AV_SAMPLE_FMT_S32P, 0);
+ if (ret < 0)
+ return ret;
+ } else {
+ for (chan = 0; chan < avctx->channels; chan++)
+ s->decoded[chan] = (int32_t *)s->frame.extended_data[chan];
+ }
+
+ if (s->nb_samples < 16) {
+ for (chan = 0; chan < avctx->channels; chan++) {
+ int32_t *decoded = s->decoded[chan];
+ for (i = 0; i < s->nb_samples; i++)
+ decoded[i] = get_sbits(gb, avctx->bits_per_coded_sample);
+ }
+ } else {
+ if (s->ti.codec == TAK_CODEC_MONO_STEREO) {
+ for (chan = 0; chan < avctx->channels; chan++)
+ if (ret = decode_channel(s, chan))
+ return ret;
+
+ if (avctx->channels == 2) {
+ if (get_bits1(gb)) {
+ // some kind of subframe length, but it seems to be unused
+ skip_bits(gb, 6);
+ }
+
+ s->dmode = get_bits(gb, 3);
+ if (ret = decorrelate(s, 0, 1, s->nb_samples - 1))
+ return ret;
+ }
+ } else if (s->ti.codec == TAK_CODEC_MULTICHANNEL) {
+ if (get_bits1(gb)) {
+ int ch_mask = 0;
+
+ chan = get_bits(gb, 4) + 1;
+ if (chan > avctx->channels)
+ return AVERROR_INVALIDDATA;
+
+ for (i = 0; i < chan; i++) {
+ int nbit = get_bits(gb, 4);
+
+ if (nbit >= avctx->channels)
+ return AVERROR_INVALIDDATA;
+
+ if (ch_mask & 1 << nbit)
+ return AVERROR_INVALIDDATA;
+
+ s->mcdparams[i].present = get_bits1(gb);
+ if (s->mcdparams[i].present) {
+ s->mcdparams[i].index = get_bits(gb, 2);
+ s->mcdparams[i].chan2 = get_bits(gb, 4);
+ if (s->mcdparams[i].index == 1) {
+ if ((nbit == s->mcdparams[i].chan2) ||
+ (ch_mask & 1 << s->mcdparams[i].chan2))
+ return AVERROR_INVALIDDATA;
+
+ ch_mask |= 1 << s->mcdparams[i].chan2;
+ } else if (!(ch_mask & 1 << s->mcdparams[i].chan2)) {
+ return AVERROR_INVALIDDATA;
+ }
+ }
+ s->mcdparams[i].chan1 = nbit;
+
+ ch_mask |= 1 << nbit;
+ }
+ } else {
+ chan = avctx->channels;
+ for (i = 0; i < chan; i++) {
+ s->mcdparams[i].present = 0;
+ s->mcdparams[i].chan1 = i;
+ }
+ }
+
+ for (i = 0; i < chan; i++) {
+ if (s->mcdparams[i].present && s->mcdparams[i].index == 1)
+ if (ret = decode_channel(s, s->mcdparams[i].chan2))
+ return ret;
+
+ if (ret = decode_channel(s, s->mcdparams[i].chan1))
+ return ret;
+
+ if (s->mcdparams[i].present) {
+ s->dmode = mc_dmodes[s->mcdparams[i].index];
+ if (ret = decorrelate(s,
+ s->mcdparams[i].chan2,
+ s->mcdparams[i].chan1,
+ s->nb_samples - 1))
+ return ret;
+ }
+ }
+ }
+
+ for (chan = 0; chan < avctx->channels; chan++) {
+ int32_t *decoded = s->decoded[chan];
+
+ if (s->lpc_mode[chan])
+ decode_lpc(decoded, s->lpc_mode[chan], s->nb_samples);
+
+ if (s->sample_shift[chan] > 0)
+ for (i = 0; i < s->nb_samples; i++)
+ decoded[i] <<= s->sample_shift[chan];
+ }
+ }
+
+ align_get_bits(gb);
+ skip_bits(gb, 24);
+ if (get_bits_left(gb) < 0)
+ av_log(avctx, AV_LOG_DEBUG, "overread\n");
+ else if (get_bits_left(gb) > 0)
+ av_log(avctx, AV_LOG_DEBUG, "underread\n");
+
+ if (avctx->err_recognition & AV_EF_CRCCHECK) {
+ if (ff_tak_check_crc(pkt->data + hsize,
+ get_bits_count(gb) / 8 - hsize)) {
+ av_log(avctx, AV_LOG_ERROR, "CRC error\n");
+ return AVERROR_INVALIDDATA;
+ }
+ }
+
+ /* convert to output buffer */
+ switch (avctx->sample_fmt) {
+ case AV_SAMPLE_FMT_U8P:
+ for (chan = 0; chan < avctx->channels; chan++) {
+ uint8_t *samples = (uint8_t *)s->frame.extended_data[chan];
+ int32_t *decoded = s->decoded[chan];
+ for (i = 0; i < s->nb_samples; i++)
+ samples[i] = decoded[i] + 0x80;
+ }
+ break;
+ case AV_SAMPLE_FMT_S16P:
+ for (chan = 0; chan < avctx->channels; chan++) {
+ int16_t *samples = (int16_t *)s->frame.extended_data[chan];
+ int32_t *decoded = s->decoded[chan];
+ for (i = 0; i < s->nb_samples; i++)
+ samples[i] = decoded[i];
+ }
+ break;
+ case AV_SAMPLE_FMT_S32P:
+ for (chan = 0; chan < avctx->channels; chan++) {
+ int32_t *samples = (int32_t *)s->frame.extended_data[chan];
+ for (i = 0; i < s->nb_samples; i++)
+ samples[i] <<= 8;
+ }
+ break;
+ }
+
+ *got_frame_ptr = 1;
+ *(AVFrame *)data = s->frame;
+
+ return pkt->size;
+}
+
+static av_cold int tak_decode_close(AVCodecContext *avctx)
+{
+ TAKDecContext *s = avctx->priv_data;
+
+ av_freep(&s->decode_buffer);
+ av_freep(&s->residues);
+
+ return 0;
+}
+
+AVCodec ff_tak_decoder = {
+ .name = "tak",
+ .type = AVMEDIA_TYPE_AUDIO,
+ .id = AV_CODEC_ID_TAK,
+ .priv_data_size = sizeof(TAKDecContext),
+ .init = tak_decode_init,
+ .init_static_data = tak_init_static_data,
+ .close = tak_decode_close,
+ .decode = tak_decode_frame,
+ .capabilities = CODEC_CAP_DR1,
+ .long_name = NULL_IF_CONFIG_SMALL("TAK (Tom's lossless Audio Kompressor)"),
+ .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_U8P,
+ AV_SAMPLE_FMT_S16P,
+ AV_SAMPLE_FMT_S32P,
+ AV_SAMPLE_FMT_NONE },
+};
diff --git a/gst-libs/ext/libav/libavcodec/targa.c b/gst-libs/ext/libav/libavcodec/targa.c
index 00da758..3bbed94 100644
--- a/gst-libs/ext/libav/libavcodec/targa.c
+++ b/gst-libs/ext/libav/libavcodec/targa.c
@@ -23,133 +23,124 @@
#include "libavutil/imgutils.h"
#include "avcodec.h"
#include "bytestream.h"
+#include "internal.h"
#include "targa.h"
typedef struct TargaContext {
AVFrame picture;
+ GetByteContext gb;
- int width, height;
- int bpp;
int color_type;
int compression_type;
} TargaContext;
-#define CHECK_BUFFER_SIZE(buf, buf_end, needed, where) \
- if(needed > buf_end - buf){ \
- av_log(avctx, AV_LOG_ERROR, "Problem: unexpected end of data while reading " where "\n"); \
- return -1; \
- } \
-
-static int targa_decode_rle(AVCodecContext *avctx, TargaContext *s, const uint8_t *src, int src_size, uint8_t *dst, int w, int h, int stride, int bpp)
+static int targa_decode_rle(AVCodecContext *avctx, TargaContext *s,
+ uint8_t *dst, int w, int h, int stride, int bpp)
{
- int i, x, y;
+ int x, y;
int depth = (bpp + 1) >> 3;
int type, count;
int diff;
- const uint8_t *src_end = src + src_size;
diff = stride - w * depth;
x = y = 0;
- while(y < h){
- CHECK_BUFFER_SIZE(src, src_end, 1, "image type");
- type = *src++;
+ while (y < h) {
+ if (bytestream2_get_bytes_left(&s->gb) <= 0) {
+ av_log(avctx, AV_LOG_ERROR,
+ "Ran ouf of data before end-of-image\n");
+ return AVERROR_INVALIDDATA;
+ }
+ type = bytestream2_get_byteu(&s->gb);
count = (type & 0x7F) + 1;
type &= 0x80;
- if((x + count > w) && (x + count + 1 > (h - y) * w)){
- av_log(avctx, AV_LOG_ERROR, "Packet went out of bounds: position (%i,%i) size %i\n", x, y, count);
- return -1;
+ if (x + count > w && x + count + 1 > (h - y) * w) {
+ av_log(avctx, AV_LOG_ERROR,
+ "Packet went out of bounds: position (%i,%i) size %i\n",
+ x, y, count);
+ return AVERROR_INVALIDDATA;
}
- if(type){
- CHECK_BUFFER_SIZE(src, src_end, depth, "image data");
- }else{
- CHECK_BUFFER_SIZE(src, src_end, count * depth, "image data");
- }
- for(i = 0; i < count; i++){
- switch(depth){
- case 1:
- *dst = *src;
- break;
- case 2:
- *((uint16_t*)dst) = AV_RL16(src);
- break;
- case 3:
- dst[0] = src[0];
- dst[1] = src[1];
- dst[2] = src[2];
- break;
- case 4:
- *((uint32_t*)dst) = AV_RL32(src);
- break;
- }
- dst += depth;
- if(!type)
- src += depth;
-
- x++;
- if(x == w){
- x = 0;
- y++;
- dst += diff;
- }
+ if (!type) {
+ do {
+ int n = FFMIN(count, w - x);
+ bytestream2_get_buffer(&s->gb, dst, n * depth);
+ count -= n;
+ dst += n * depth;
+ x += n;
+ if (x == w) {
+ x = 0;
+ y++;
+ dst += diff;
+ }
+ } while (count > 0);
+ } else {
+ uint8_t tmp[4];
+ bytestream2_get_buffer(&s->gb, tmp, depth);
+ do {
+ int n = FFMIN(count, w - x);
+ count -= n;
+ x += n;
+ do {
+ memcpy(dst, tmp, depth);
+ dst += depth;
+ } while (--n);
+ if (x == w) {
+ x = 0;
+ y++;
+ dst += diff;
+ }
+ } while (count > 0);
}
- if(type)
- src += depth;
}
- return src_size;
+ return 0;
}
static int decode_frame(AVCodecContext *avctx,
- void *data, int *data_size,
+ void *data, int *got_frame,
AVPacket *avpkt)
{
- const uint8_t *buf = avpkt->data;
- const uint8_t *buf_end = avpkt->data + avpkt->size;
TargaContext * const s = avctx->priv_data;
AVFrame *picture = data;
- AVFrame * const p= (AVFrame*)&s->picture;
+ AVFrame * const p = &s->picture;
uint8_t *dst;
int stride;
int idlen, compr, y, w, h, bpp, flags;
int first_clr, colors, csize;
+ bytestream2_init(&s->gb, avpkt->data, avpkt->size);
+
/* parse image header */
- CHECK_BUFFER_SIZE(buf, buf_end, 18, "header");
- idlen = *buf++;
- buf++; /* pal */
- compr = *buf++;
- first_clr = AV_RL16(buf); buf += 2;
- colors = AV_RL16(buf); buf += 2;
- csize = *buf++;
- buf += 2; /* x */
- y = AV_RL16(buf); buf += 2;
- w = AV_RL16(buf); buf += 2;
- h = AV_RL16(buf); buf += 2;
- bpp = *buf++;
- flags = *buf++;
- //skip identifier if any
- CHECK_BUFFER_SIZE(buf, buf_end, idlen, "identifiers");
- buf += idlen;
- s->bpp = bpp;
- s->width = w;
- s->height = h;
- switch(s->bpp){
+ idlen = bytestream2_get_byte(&s->gb);
+ bytestream2_skip(&s->gb, 1); /* pal */
+ compr = bytestream2_get_byte(&s->gb);
+ first_clr = bytestream2_get_le16(&s->gb);
+ colors = bytestream2_get_le16(&s->gb);
+ csize = bytestream2_get_byte(&s->gb);
+ bytestream2_skip(&s->gb, 4); /* 2: x, 2: y */
+ w = bytestream2_get_le16(&s->gb);
+ h = bytestream2_get_le16(&s->gb);
+ bpp = bytestream2_get_byte(&s->gb);
+ flags = bytestream2_get_byte(&s->gb);
+ // skip identifier if any
+ bytestream2_skip(&s->gb, idlen);
+
+ switch(bpp){
case 8:
- avctx->pix_fmt = ((compr & (~TGA_RLE)) == TGA_BW) ? PIX_FMT_GRAY8 : PIX_FMT_PAL8;
+ avctx->pix_fmt = ((compr & (~TGA_RLE)) == TGA_BW) ? AV_PIX_FMT_GRAY8 : AV_PIX_FMT_PAL8;
break;
case 15:
- avctx->pix_fmt = PIX_FMT_RGB555;
+ avctx->pix_fmt = AV_PIX_FMT_RGB555LE;
break;
case 16:
- avctx->pix_fmt = PIX_FMT_RGB555;
+ avctx->pix_fmt = AV_PIX_FMT_RGB555LE;
break;
case 24:
- avctx->pix_fmt = PIX_FMT_BGR24;
+ avctx->pix_fmt = AV_PIX_FMT_BGR24;
break;
case 32:
- avctx->pix_fmt = PIX_FMT_RGB32;
+ avctx->pix_fmt = AV_PIX_FMT_BGRA;
break;
default:
- av_log(avctx, AV_LOG_ERROR, "Bit depth %i is not supported\n", s->bpp);
+ av_log(avctx, AV_LOG_ERROR, "Bit depth %i is not supported\n", bpp);
return -1;
}
@@ -160,7 +151,7 @@ static int decode_frame(AVCodecContext *avctx,
return -1;
if(w != avctx->width || h != avctx->height)
avcodec_set_dimensions(avctx, w, h);
- if(avctx->get_buffer(avctx, p) < 0){
+ if(ff_get_buffer(avctx, p) < 0){
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return -1;
}
@@ -187,23 +178,27 @@ static int decode_frame(AVCodecContext *avctx,
return -1;
}
pal_size = colors * pal_sample_size;
- CHECK_BUFFER_SIZE(buf, buf_end, pal_size, "color table");
- if(avctx->pix_fmt != PIX_FMT_PAL8)//should not occur but skip palette anyway
- buf += pal_size;
+ if(avctx->pix_fmt != AV_PIX_FMT_PAL8)//should not occur but skip palette anyway
+ bytestream2_skip(&s->gb, pal_size);
else{
int t;
uint32_t *pal = ((uint32_t *)p->data[1]) + first_clr;
+ if (bytestream2_get_bytes_left(&s->gb) < pal_size) {
+ av_log(avctx, AV_LOG_ERROR,
+ "Not enough data to read palette\n");
+ return AVERROR_INVALIDDATA;
+ }
switch (pal_sample_size) {
case 3:
/* RGB24 */
for (t = 0; t < colors; t++)
- *pal++ = bytestream_get_le24(&buf);
+ *pal++ = bytestream2_get_le24u(&s->gb);
break;
case 2:
/* RGB555 */
for (t = 0; t < colors; t++) {
- uint32_t v = bytestream_get_le16(&buf);
+ uint32_t v = bytestream2_get_le16u(&s->gb);
v = ((v & 0x7C00) << 9) |
((v & 0x03E0) << 6) |
((v & 0x001F) << 3);
@@ -216,40 +211,29 @@ static int decode_frame(AVCodecContext *avctx,
p->palette_has_changed = 1;
}
}
- if((compr & (~TGA_RLE)) == TGA_NODATA)
- memset(p->data[0], 0, p->linesize[0] * s->height);
- else{
+ if ((compr & (~TGA_RLE)) == TGA_NODATA) {
+ memset(p->data[0], 0, p->linesize[0] * h);
+ } else {
if(compr & TGA_RLE){
- int res = targa_decode_rle(avctx, s, buf, buf_end - buf, dst, avctx->width, avctx->height, stride, bpp);
+ int res = targa_decode_rle(avctx, s, dst, w, h, stride, bpp);
if (res < 0)
- return -1;
- buf += res;
- }else{
- size_t img_size = s->width * ((s->bpp + 1) >> 3);
- CHECK_BUFFER_SIZE(buf, buf_end, img_size, "image data");
- for(y = 0; y < s->height; y++){
-#if HAVE_BIGENDIAN
- int x;
- if((s->bpp + 1) >> 3 == 2){
- uint16_t *dst16 = (uint16_t*)dst;
- for(x = 0; x < s->width; x++)
- dst16[x] = AV_RL16(buf + x * 2);
- }else if((s->bpp + 1) >> 3 == 4){
- uint32_t *dst32 = (uint32_t*)dst;
- for(x = 0; x < s->width; x++)
- dst32[x] = AV_RL32(buf + x * 4);
- }else
-#endif
- memcpy(dst, buf, img_size);
-
+ return res;
+ } else {
+ size_t img_size = w * ((bpp + 1) >> 3);
+ if (bytestream2_get_bytes_left(&s->gb) < img_size * h) {
+ av_log(avctx, AV_LOG_ERROR,
+ "Not enough data available for image\n");
+ return AVERROR_INVALIDDATA;
+ }
+ for (y = 0; y < h; y++) {
+ bytestream2_get_bufferu(&s->gb, dst, img_size);
dst += stride;
- buf += img_size;
}
}
}
- *picture= *(AVFrame*)&s->picture;
- *data_size = sizeof(AVPicture);
+ *picture = s->picture;
+ *got_frame = 1;
return avpkt->size;
}
@@ -257,8 +241,8 @@ static int decode_frame(AVCodecContext *avctx,
static av_cold int targa_init(AVCodecContext *avctx){
TargaContext *s = avctx->priv_data;
- avcodec_get_frame_defaults((AVFrame*)&s->picture);
- avctx->coded_frame= (AVFrame*)&s->picture;
+ avcodec_get_frame_defaults(&s->picture);
+ avctx->coded_frame = &s->picture;
return 0;
}
@@ -275,11 +259,11 @@ static av_cold int targa_end(AVCodecContext *avctx){
AVCodec ff_targa_decoder = {
.name = "targa",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_TARGA,
+ .id = AV_CODEC_ID_TARGA,
.priv_data_size = sizeof(TargaContext),
.init = targa_init,
.close = targa_end,
.decode = decode_frame,
.capabilities = CODEC_CAP_DR1,
- .long_name = NULL_IF_CONFIG_SMALL("Truevision Targa image"),
+ .long_name = NULL_IF_CONFIG_SMALL("Truevision Targa image"),
};
diff --git a/gst-libs/ext/libav/libavcodec/targaenc.c b/gst-libs/ext/libav/libavcodec/targaenc.c
index 276bcc8..e13545f 100644
--- a/gst-libs/ext/libav/libavcodec/targaenc.c
+++ b/gst-libs/ext/libav/libavcodec/targaenc.c
@@ -19,9 +19,13 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <string.h>
+
+#include "libavutil/internal.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/pixdesc.h"
#include "avcodec.h"
+#include "internal.h"
#include "rle.h"
#include "targa.h"
@@ -39,7 +43,7 @@ typedef struct TargaContext {
* @param h Image height
* @return Size of output in bytes, or -1 if larger than out_size
*/
-static int targa_encode_rle(uint8_t *outbuf, int out_size, AVFrame *pic,
+static int targa_encode_rle(uint8_t *outbuf, int out_size, const AVFrame *pic,
int bpp, int w, int h)
{
int y,ret;
@@ -59,7 +63,7 @@ static int targa_encode_rle(uint8_t *outbuf, int out_size, AVFrame *pic,
return out - outbuf;
}
-static int targa_encode_normal(uint8_t *outbuf, AVFrame *pic, int bpp, int w, int h)
+static int targa_encode_normal(uint8_t *outbuf, const AVFrame *pic, int bpp, int w, int h)
{
int i, n = bpp * w;
uint8_t *out = outbuf;
@@ -74,11 +78,10 @@ static int targa_encode_normal(uint8_t *outbuf, AVFrame *pic, int bpp, int w, in
return out - outbuf;
}
-static int targa_encode_frame(AVCodecContext *avctx,
- unsigned char *outbuf,
- int buf_size, void *data){
- AVFrame *p = data;
- int bpp, picsize, datasize = -1;
+static int targa_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
+ const AVFrame *p, int *got_packet)
+{
+ int bpp, picsize, datasize = -1, ret;
uint8_t *out;
if(avctx->width > 0xffff || avctx->height > 0xffff) {
@@ -86,46 +89,43 @@ static int targa_encode_frame(AVCodecContext *avctx,
return AVERROR(EINVAL);
}
picsize = avpicture_get_size(avctx->pix_fmt, avctx->width, avctx->height);
- if(buf_size < picsize + 45) {
+ if ((ret = ff_alloc_packet(pkt, picsize + 45)) < 0) {
av_log(avctx, AV_LOG_ERROR, "encoded frame too large\n");
- return AVERROR(EINVAL);
+ return ret;
}
- p->pict_type= AV_PICTURE_TYPE_I;
- p->key_frame= 1;
-
/* zero out the header and only set applicable fields */
- memset(outbuf, 0, 12);
- AV_WL16(outbuf+12, avctx->width);
- AV_WL16(outbuf+14, avctx->height);
+ memset(pkt->data, 0, 12);
+ AV_WL16(pkt->data+12, avctx->width);
+ AV_WL16(pkt->data+14, avctx->height);
/* image descriptor byte: origin is always top-left, bits 0-3 specify alpha */
- outbuf[17] = 0x20 | (avctx->pix_fmt == PIX_FMT_BGRA ? 8 : 0);
+ pkt->data[17] = 0x20 | (avctx->pix_fmt == AV_PIX_FMT_BGRA ? 8 : 0);
switch(avctx->pix_fmt) {
- case PIX_FMT_GRAY8:
- outbuf[2] = TGA_BW; /* uncompressed grayscale image */
- outbuf[16] = 8; /* bpp */
+ case AV_PIX_FMT_GRAY8:
+ pkt->data[2] = TGA_BW; /* uncompressed grayscale image */
+ pkt->data[16] = 8; /* bpp */
break;
- case PIX_FMT_RGB555LE:
- outbuf[2] = TGA_RGB; /* uncompresses true-color image */
- outbuf[16] = 16; /* bpp */
+ case AV_PIX_FMT_RGB555LE:
+ pkt->data[2] = TGA_RGB; /* uncompresses true-color image */
+ pkt->data[16] = 16; /* bpp */
break;
- case PIX_FMT_BGR24:
- outbuf[2] = TGA_RGB; /* uncompressed true-color image */
- outbuf[16] = 24; /* bpp */
+ case AV_PIX_FMT_BGR24:
+ pkt->data[2] = TGA_RGB; /* uncompressed true-color image */
+ pkt->data[16] = 24; /* bpp */
break;
- case PIX_FMT_BGRA:
- outbuf[2] = TGA_RGB; /* uncompressed true-color image */
- outbuf[16] = 32; /* bpp */
+ case AV_PIX_FMT_BGRA:
+ pkt->data[2] = TGA_RGB; /* uncompressed true-color image */
+ pkt->data[16] = 32; /* bpp */
break;
default:
av_log(avctx, AV_LOG_ERROR, "Pixel format '%s' not supported.\n",
av_get_pix_fmt_name(avctx->pix_fmt));
return AVERROR(EINVAL);
}
- bpp = outbuf[16] >> 3;
+ bpp = pkt->data[16] >> 3;
- out = outbuf + 18; /* skip past the header we just output */
+ out = pkt->data + 18; /* skip past the header we just output */
/* try RLE compression */
if (avctx->coder_type != FF_CODER_TYPE_RAW)
@@ -133,7 +133,7 @@ static int targa_encode_frame(AVCodecContext *avctx,
/* if that worked well, mark the picture as RLE compressed */
if(datasize >= 0)
- outbuf[2] |= 8;
+ pkt->data[2] |= 8;
/* if RLE didn't make it smaller, go back to no compression */
else datasize = targa_encode_normal(out, p, bpp, avctx->width, avctx->height);
@@ -145,7 +145,11 @@ static int targa_encode_frame(AVCodecContext *avctx,
* aspect ratio and encoder ID fields available? */
memcpy(out, "\0\0\0\0\0\0\0\0TRUEVISION-XFILE.", 26);
- return out + 26 - outbuf;
+ pkt->size = out + 26 - pkt->data;
+ pkt->flags |= AV_PKT_FLAG_KEY;
+ *got_packet = 1;
+
+ return 0;
}
static av_cold int targa_encode_init(AVCodecContext *avctx)
@@ -154,18 +158,22 @@ static av_cold int targa_encode_init(AVCodecContext *avctx)
avcodec_get_frame_defaults(&s->picture);
s->picture.key_frame= 1;
+ s->picture.pict_type = AV_PICTURE_TYPE_I;
avctx->coded_frame= &s->picture;
return 0;
}
AVCodec ff_targa_encoder = {
- .name = "targa",
- .type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_TARGA,
+ .name = "targa",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .id = AV_CODEC_ID_TARGA,
.priv_data_size = sizeof(TargaContext),
- .init = targa_encode_init,
- .encode = targa_encode_frame,
- .pix_fmts= (const enum PixelFormat[]){PIX_FMT_BGR24, PIX_FMT_BGRA, PIX_FMT_RGB555LE, PIX_FMT_GRAY8, PIX_FMT_NONE},
+ .init = targa_encode_init,
+ .encode2 = targa_encode_frame,
+ .pix_fmts = (const enum AVPixelFormat[]){
+ AV_PIX_FMT_BGR24, AV_PIX_FMT_BGRA, AV_PIX_FMT_RGB555LE, AV_PIX_FMT_GRAY8,
+ AV_PIX_FMT_NONE
+ },
.long_name= NULL_IF_CONFIG_SMALL("Truevision Targa image"),
};
diff --git a/gst-libs/ext/libav/libavcodec/thread.h b/gst-libs/ext/libav/libavcodec/thread.h
index 7f018fc..99b0ce1 100644
--- a/gst-libs/ext/libav/libavcodec/thread.h
+++ b/gst-libs/ext/libav/libavcodec/thread.h
@@ -43,7 +43,7 @@ void ff_thread_flush(AVCodecContext *avctx);
* Returns the next available frame in picture. *got_picture_ptr
* will be 0 if none is available.
* The return value on success is the size of the consumed packet for
- * compatiblity with avcodec_decode_video2(). This means the decoder
+ * compatibility with avcodec_decode_video2(). This means the decoder
* has to consume the full packet.
*
* Parameters are the same as avcodec_decode_video2().
@@ -89,7 +89,7 @@ void ff_thread_await_progress(AVFrame *f, int progress, int field);
/**
* Wrapper around get_buffer() for frame-multithreaded codecs.
- * Call this function instead of avctx->get_buffer(f).
+ * Call this function instead of ff_get_buffer(f).
* Cannot be called after the codec has called ff_thread_finish_setup().
*
* @param avctx The current context.
diff --git a/gst-libs/ext/libav/libavcodec/tiertexseqv.c b/gst-libs/ext/libav/libavcodec/tiertexseqv.c
index 12d5bce..a9064ec 100644
--- a/gst-libs/ext/libav/libavcodec/tiertexseqv.c
+++ b/gst-libs/ext/libav/libavcodec/tiertexseqv.c
@@ -214,7 +214,7 @@ static av_cold int seqvideo_decode_init(AVCodecContext *avctx)
SeqVideoContext *seq = avctx->priv_data;
seq->avctx = avctx;
- avctx->pix_fmt = PIX_FMT_PAL8;
+ avctx->pix_fmt = AV_PIX_FMT_PAL8;
seq->frame.data[0] = NULL;
@@ -222,7 +222,7 @@ static av_cold int seqvideo_decode_init(AVCodecContext *avctx)
}
static int seqvideo_decode_frame(AVCodecContext *avctx,
- void *data, int *data_size,
+ void *data, int *got_frame,
AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
@@ -240,7 +240,7 @@ static int seqvideo_decode_frame(AVCodecContext *avctx,
if (seqvideo_decode(seq, buf, buf_size))
return AVERROR_INVALIDDATA;
- *data_size = sizeof(AVFrame);
+ *got_frame = 1;
*(AVFrame *)data = seq->frame;
return buf_size;
@@ -259,11 +259,11 @@ static av_cold int seqvideo_decode_end(AVCodecContext *avctx)
AVCodec ff_tiertexseqvideo_decoder = {
.name = "tiertexseqvideo",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_TIERTEXSEQVIDEO,
+ .id = AV_CODEC_ID_TIERTEXSEQVIDEO,
.priv_data_size = sizeof(SeqVideoContext),
.init = seqvideo_decode_init,
.close = seqvideo_decode_end,
.decode = seqvideo_decode_frame,
.capabilities = CODEC_CAP_DR1,
- .long_name = NULL_IF_CONFIG_SMALL("Tiertex Limited SEQ video"),
+ .long_name = NULL_IF_CONFIG_SMALL("Tiertex Limited SEQ video"),
};
diff --git a/gst-libs/ext/libav/libavcodec/tiff.c b/gst-libs/ext/libav/libavcodec/tiff.c
index 8a1db12..264e985 100644
--- a/gst-libs/ext/libav/libavcodec/tiff.c
+++ b/gst-libs/ext/libav/libavcodec/tiff.c
@@ -26,13 +26,16 @@
*/
#include "avcodec.h"
+#include "config.h"
#if CONFIG_ZLIB
#include <zlib.h>
#endif
#include "lzw.h"
#include "tiff.h"
#include "faxcompr.h"
-#include "libavutil/common.h"
+#include "internal.h"
+#include "mathops.h"
+#include "libavutil/attributes.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/imgutils.h"
@@ -53,40 +56,43 @@ typedef struct TiffContext {
int strips, rps, sstype;
int sot;
- const uint8_t* stripdata;
- const uint8_t* stripsizes;
+ const uint8_t *stripdata;
+ const uint8_t *stripsizes;
int stripsize, stripoff;
LZWState *lzw;
} TiffContext;
-static unsigned tget_short(const uint8_t **p, int le) {
+static unsigned tget_short(const uint8_t **p, int le)
+{
unsigned v = le ? AV_RL16(*p) : AV_RB16(*p);
*p += 2;
return v;
}
-static unsigned tget_long(const uint8_t **p, int le) {
+static unsigned tget_long(const uint8_t **p, int le)
+{
unsigned v = le ? AV_RL32(*p) : AV_RB32(*p);
*p += 4;
return v;
}
-static unsigned tget(const uint8_t **p, int type, int le) {
- switch(type){
+static unsigned tget(const uint8_t **p, int type, int le)
+{
+ switch (type) {
case TIFF_BYTE : return *(*p)++;
case TIFF_SHORT: return tget_short(p, le);
- case TIFF_LONG : return tget_long (p, le);
+ case TIFF_LONG : return tget_long(p, le);
default : return UINT_MAX;
}
}
#if CONFIG_ZLIB
-static int tiff_uncompress(uint8_t *dst, unsigned long *len, const uint8_t *src, int size)
+static int tiff_uncompress(uint8_t *dst, unsigned long *len, const uint8_t *src,
+ int size)
{
- z_stream zstream;
+ z_stream zstream = { 0 };
int zret;
- memset(&zstream, 0, sizeof(zstream));
zstream.next_in = src;
zstream.avail_in = size;
zstream.next_out = dst;
@@ -103,25 +109,35 @@ static int tiff_uncompress(uint8_t *dst, unsigned long *len, const uint8_t *src,
}
#endif
-static int tiff_unpack_strip(TiffContext *s, uint8_t* dst, int stride, const uint8_t *src, int size, int lines){
+static int tiff_unpack_strip(TiffContext *s, uint8_t *dst, int stride,
+ const uint8_t *src, int size, int lines)
+{
int c, line, pixels, code;
const uint8_t *ssrc = src;
int width = ((s->width * s->bpp) + 7) >> 3;
-#if CONFIG_ZLIB
- uint8_t *zbuf; unsigned long outlen;
- if(s->compr == TIFF_DEFLATE || s->compr == TIFF_ADOBE_DEFLATE){
+ if (size <= 0)
+ return AVERROR_INVALIDDATA;
+
+#if CONFIG_ZLIB
+ if (s->compr == TIFF_DEFLATE || s->compr == TIFF_ADOBE_DEFLATE) {
+ uint8_t *zbuf;
+ unsigned long outlen;
int ret;
outlen = width * lines;
zbuf = av_malloc(outlen);
+ if (!zbuf)
+ return AVERROR(ENOMEM);
ret = tiff_uncompress(zbuf, &outlen, src, size);
- if(ret != Z_OK){
- av_log(s->avctx, AV_LOG_ERROR, "Uncompressing failed (%lu of %lu) with error %d\n", outlen, (unsigned long)width * lines, ret);
+ if (ret != Z_OK) {
+ av_log(s->avctx, AV_LOG_ERROR,
+ "Uncompressing failed (%lu of %lu) with error %d\n", outlen,
+ (unsigned long)width * lines, ret);
av_free(zbuf);
return -1;
}
src = zbuf;
- for(line = 0; line < lines; line++){
+ for (line = 0; line < lines; line++) {
memcpy(dst, src, width);
dst += stride;
src += width;
@@ -130,48 +146,53 @@ static int tiff_unpack_strip(TiffContext *s, uint8_t* dst, int stride, const uin
return 0;
}
#endif
- if(s->compr == TIFF_LZW){
- if(ff_lzw_decode_init(s->lzw, 8, src, size, FF_LZW_TIFF) < 0){
+ if (s->compr == TIFF_LZW) {
+ if (ff_lzw_decode_init(s->lzw, 8, src, size, FF_LZW_TIFF) < 0) {
av_log(s->avctx, AV_LOG_ERROR, "Error initializing LZW decoder\n");
return -1;
}
}
- if(s->compr == TIFF_CCITT_RLE || s->compr == TIFF_G3 || s->compr == TIFF_G4){
+ if (s->compr == TIFF_CCITT_RLE || s->compr == TIFF_G3
+ || s->compr == TIFF_G4) {
int i, ret = 0;
- uint8_t *src2 = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE);
+ uint8_t *src2 = av_malloc((unsigned)size +
+ FF_INPUT_BUFFER_PADDING_SIZE);
- if(!src2 || (unsigned)size + FF_INPUT_BUFFER_PADDING_SIZE < (unsigned)size){
- av_log(s->avctx, AV_LOG_ERROR, "Error allocating temporary buffer\n");
- return -1;
+ if (!src2) {
+ av_log(s->avctx, AV_LOG_ERROR,
+ "Error allocating temporary buffer\n");
+ return AVERROR(ENOMEM);
}
- if(s->fax_opts & 2){
- av_log(s->avctx, AV_LOG_ERROR, "Uncompressed fax mode is not supported (yet)\n");
+ if (s->fax_opts & 2) {
+ av_log(s->avctx, AV_LOG_ERROR,
+ "Uncompressed fax mode is not supported (yet)\n");
av_free(src2);
return -1;
}
- if(!s->fill_order){
+ if (!s->fill_order) {
memcpy(src2, src, size);
- }else{
- for(i = 0; i < size; i++)
- src2[i] = av_reverse[src[i]];
+ } else {
+ for (i = 0; i < size; i++)
+ src2[i] = ff_reverse[src[i]];
}
- memset(src2+size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
- switch(s->compr){
+ memset(src2 + size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
+ switch (s->compr) {
case TIFF_CCITT_RLE:
case TIFF_G3:
case TIFF_G4:
- ret = ff_ccitt_unpack(s->avctx, src2, size, dst, lines, stride, s->compr, s->fax_opts);
+ ret = ff_ccitt_unpack(s->avctx, src2, size, dst, lines, stride,
+ s->compr, s->fax_opts);
break;
}
av_free(src2);
return ret;
}
- for(line = 0; line < lines; line++){
- if(src - ssrc > size){
+ for (line = 0; line < lines; line++) {
+ if (src - ssrc > size) {
av_log(s->avctx, AV_LOG_ERROR, "Source data overread\n");
return -1;
}
- switch(s->compr){
+ switch (s->compr) {
case TIFF_RAW:
if (ssrc + size - src < width)
return AVERROR_INVALIDDATA;
@@ -180,29 +201,31 @@ static int tiff_unpack_strip(TiffContext *s, uint8_t* dst, int stride, const uin
} else {
int i;
for (i = 0; i < width; i++)
- dst[i] = av_reverse[src[i]];
+ dst[i] = ff_reverse[src[i]];
}
src += width;
break;
case TIFF_PACKBITS:
- for(pixels = 0; pixels < width;){
+ for (pixels = 0; pixels < width;) {
if (ssrc + size - src < 2)
return AVERROR_INVALIDDATA;
- code = (int8_t)*src++;
- if(code >= 0){
+ code = (int8_t) * src++;
+ if (code >= 0) {
code++;
if (pixels + code > width ||
ssrc + size - src < code) {
- av_log(s->avctx, AV_LOG_ERROR, "Copy went out of bounds\n");
+ av_log(s->avctx, AV_LOG_ERROR,
+ "Copy went out of bounds\n");
return -1;
}
memcpy(dst + pixels, src, code);
src += code;
pixels += code;
- }else if(code != -128){ // -127..-1
+ } else if (code != -128) { // -127..-1
code = (-code) + 1;
- if(pixels + code > width){
- av_log(s->avctx, AV_LOG_ERROR, "Run went out of bounds\n");
+ if (pixels + code > width) {
+ av_log(s->avctx, AV_LOG_ERROR,
+ "Run went out of bounds\n");
return -1;
}
c = *src++;
@@ -213,8 +236,9 @@ static int tiff_unpack_strip(TiffContext *s, uint8_t* dst, int stride, const uin
break;
case TIFF_LZW:
pixels = ff_lzw_decode(s->lzw, dst, width);
- if(pixels < width){
- av_log(s->avctx, AV_LOG_ERROR, "Decoded only %i bytes of %i\n", pixels, width);
+ if (pixels < width) {
+ av_log(s->avctx, AV_LOG_ERROR, "Decoded only %i bytes of %i\n",
+ pixels, width);
return -1;
}
break;
@@ -231,22 +255,22 @@ static int init_image(TiffContext *s)
switch (s->bpp * 10 + s->bppcount) {
case 11:
- s->avctx->pix_fmt = PIX_FMT_MONOBLACK;
+ s->avctx->pix_fmt = AV_PIX_FMT_MONOBLACK;
break;
case 81:
- s->avctx->pix_fmt = PIX_FMT_PAL8;
+ s->avctx->pix_fmt = AV_PIX_FMT_PAL8;
break;
case 243:
- s->avctx->pix_fmt = PIX_FMT_RGB24;
+ s->avctx->pix_fmt = AV_PIX_FMT_RGB24;
break;
case 161:
- s->avctx->pix_fmt = PIX_FMT_GRAY16BE;
+ s->avctx->pix_fmt = s->le ? AV_PIX_FMT_GRAY16LE : AV_PIX_FMT_GRAY16BE;
break;
case 324:
- s->avctx->pix_fmt = PIX_FMT_RGBA;
+ s->avctx->pix_fmt = AV_PIX_FMT_RGBA;
break;
case 483:
- s->avctx->pix_fmt = s->le ? PIX_FMT_RGB48LE : PIX_FMT_RGB48BE;
+ s->avctx->pix_fmt = s->le ? AV_PIX_FMT_RGB48LE : AV_PIX_FMT_RGB48BE;
break;
default:
av_log(s->avctx, AV_LOG_ERROR,
@@ -261,11 +285,11 @@ static int init_image(TiffContext *s)
}
if (s->picture.data[0])
s->avctx->release_buffer(s->avctx, &s->picture);
- if ((ret = s->avctx->get_buffer(s->avctx, &s->picture)) < 0) {
+ if ((ret = ff_get_buffer(s->avctx, &s->picture)) < 0) {
av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return ret;
}
- if (s->avctx->pix_fmt == PIX_FMT_PAL8) {
+ if (s->avctx->pix_fmt == AV_PIX_FMT_PAL8) {
if (s->palette_is_set) {
memcpy(s->picture.data[1], s->palette, sizeof(s->palette));
} else {
@@ -278,7 +302,8 @@ static int init_image(TiffContext *s)
return 0;
}
-static int tiff_decode_tag(TiffContext *s, const uint8_t *start, const uint8_t *buf, const uint8_t *end_buf)
+static int tiff_decode_tag(TiffContext *s, const uint8_t *start,
+ const uint8_t *buf, const uint8_t *end_buf)
{
unsigned tag, type, count, off, value = 0;
int i, j;
@@ -293,12 +318,13 @@ static int tiff_decode_tag(TiffContext *s, const uint8_t *start, const uint8_t *
off = tget_long(&buf, s->le);
if (type == 0 || type >= FF_ARRAY_ELEMS(type_sizes)) {
- av_log(s->avctx, AV_LOG_DEBUG, "Unknown tiff type (%u) encountered\n", type);
+ av_log(s->avctx, AV_LOG_DEBUG, "Unknown tiff type (%u) encountered\n",
+ type);
return 0;
}
- if(count == 1){
- switch(type){
+ if (count == 1) {
+ switch (type) {
case TIFF_BYTE:
case TIFF_SHORT:
buf -= 4;
@@ -310,7 +336,7 @@ static int tiff_decode_tag(TiffContext *s, const uint8_t *start, const uint8_t *
buf = NULL;
break;
case TIFF_STRING:
- if(count <= 4){
+ if (count <= 4) {
buf -= 4;
break;
}
@@ -326,12 +352,13 @@ static int tiff_decode_tag(TiffContext *s, const uint8_t *start, const uint8_t *
}
}
- if(buf && (buf < start || buf > end_buf)){
- av_log(s->avctx, AV_LOG_ERROR, "Tag referencing position outside the image\n");
+ if (buf && (buf < start || buf > end_buf)) {
+ av_log(s->avctx, AV_LOG_ERROR,
+ "Tag referencing position outside the image\n");
return -1;
}
- switch(tag){
+ switch (tag) {
case TIFF_WIDTH:
s->width = value;
break;
@@ -340,20 +367,25 @@ static int tiff_decode_tag(TiffContext *s, const uint8_t *start, const uint8_t *
break;
case TIFF_BPP:
s->bppcount = count;
- if(count > 4){
- av_log(s->avctx, AV_LOG_ERROR, "This format is not supported (bpp=%d, %d components)\n", s->bpp, count);
+ if (count > 4) {
+ av_log(s->avctx, AV_LOG_ERROR,
+ "This format is not supported (bpp=%d, %d components)\n",
+ s->bpp, count);
return -1;
}
- if(count == 1) s->bpp = value;
- else{
- switch(type){
+ if (count == 1)
+ s->bpp = value;
+ else {
+ switch (type) {
case TIFF_BYTE:
- s->bpp = (off & 0xFF) + ((off >> 8) & 0xFF) + ((off >> 16) & 0xFF) + ((off >> 24) & 0xFF);
+ s->bpp = (off & 0xFF) + ((off >> 8) & 0xFF) +
+ ((off >> 16) & 0xFF) + ((off >> 24) & 0xFF);
break;
case TIFF_SHORT:
case TIFF_LONG:
s->bpp = 0;
- for(i = 0; i < count && buf < end_buf; i++) s->bpp += tget(&buf, type, s->le);
+ for (i = 0; i < count && buf < end_buf; i++)
+ s->bpp += tget(&buf, type, s->le);
break;
default:
s->bpp = -1;
@@ -373,7 +405,7 @@ static int tiff_decode_tag(TiffContext *s, const uint8_t *start, const uint8_t *
case TIFF_COMPR:
s->compr = value;
s->predictor = 0;
- switch(s->compr){
+ switch (s->compr) {
case TIFF_RAW:
case TIFF_PACKBITS:
case TIFF_LZW:
@@ -393,48 +425,54 @@ static int tiff_decode_tag(TiffContext *s, const uint8_t *start, const uint8_t *
#endif
case TIFF_JPEG:
case TIFF_NEWJPEG:
- av_log(s->avctx, AV_LOG_ERROR, "JPEG compression is not supported\n");
+ av_log(s->avctx, AV_LOG_ERROR,
+ "JPEG compression is not supported\n");
return -1;
default:
- av_log(s->avctx, AV_LOG_ERROR, "Unknown compression method %i\n", s->compr);
+ av_log(s->avctx, AV_LOG_ERROR, "Unknown compression method %i\n",
+ s->compr);
return -1;
}
break;
case TIFF_ROWSPERSTRIP:
if (type == TIFF_LONG && value == UINT_MAX)
value = s->avctx->height;
- if(value < 1){
- av_log(s->avctx, AV_LOG_ERROR, "Incorrect value of rows per strip\n");
+ if (value < 1) {
+ av_log(s->avctx, AV_LOG_ERROR,
+ "Incorrect value of rows per strip\n");
return -1;
}
s->rps = value;
break;
case TIFF_STRIP_OFFS:
- if(count == 1){
+ if (count == 1) {
s->stripdata = NULL;
s->stripoff = value;
- }else
+ } else
s->stripdata = start + off;
s->strips = count;
- if(s->strips == 1) s->rps = s->height;
+ if (s->strips == 1)
+ s->rps = s->height;
s->sot = type;
- if(s->stripdata > end_buf){
- av_log(s->avctx, AV_LOG_ERROR, "Tag referencing position outside the image\n");
+ if (s->stripdata > end_buf) {
+ av_log(s->avctx, AV_LOG_ERROR,
+ "Tag referencing position outside the image\n");
return -1;
}
break;
case TIFF_STRIP_SIZE:
- if(count == 1){
+ if (count == 1) {
s->stripsizes = NULL;
s->stripsize = value;
s->strips = 1;
- }else{
+ } else {
s->stripsizes = start + off;
}
s->strips = count;
s->sstype = type;
- if(s->stripsizes > end_buf){
- av_log(s->avctx, AV_LOG_ERROR, "Tag referencing position outside the image\n");
+ if (s->stripsizes > end_buf) {
+ av_log(s->avctx, AV_LOG_ERROR,
+ "Tag referencing position outside the image\n");
return -1;
}
break;
@@ -442,7 +480,7 @@ static int tiff_decode_tag(TiffContext *s, const uint8_t *start, const uint8_t *
s->predictor = value;
break;
case TIFF_INVERT:
- switch(value){
+ switch (value) {
case 0:
s->invert = 1;
break;
@@ -453,13 +491,15 @@ static int tiff_decode_tag(TiffContext *s, const uint8_t *start, const uint8_t *
case 3:
break;
default:
- av_log(s->avctx, AV_LOG_ERROR, "Color mode %d is not supported\n", value);
+ av_log(s->avctx, AV_LOG_ERROR, "Color mode %d is not supported\n",
+ value);
return -1;
}
break;
case TIFF_FILL_ORDER:
- if(value < 1 || value > 2){
- av_log(s->avctx, AV_LOG_ERROR, "Unknown FillOrder value %d, trying default one\n", value);
+ if (value < 1 || value > 2) {
+ av_log(s->avctx, AV_LOG_ERROR,
+ "Unknown FillOrder value %d, trying default one\n", value);
value = 1;
}
s->fill_order = value - 1;
@@ -473,43 +513,43 @@ static int tiff_decode_tag(TiffContext *s, const uint8_t *start, const uint8_t *
gp = buf + count / 3 * off;
bp = buf + count / 3 * off * 2;
off = (type_sizes[type] - 1) << 3;
- for(i = 0; i < count / 3; i++){
- j = (tget(&rp, type, s->le) >> off) << 16;
+ for (i = 0; i < count / 3; i++) {
+ j = (tget(&rp, type, s->le) >> off) << 16;
j |= (tget(&gp, type, s->le) >> off) << 8;
- j |= tget(&bp, type, s->le) >> off;
+ j |= tget(&bp, type, s->le) >> off;
pal[i] = j;
}
s->palette_is_set = 1;
break;
case TIFF_PLANAR:
- if(value == 2){
+ if (value == 2) {
av_log(s->avctx, AV_LOG_ERROR, "Planar format is not supported\n");
return -1;
}
break;
case TIFF_T4OPTIONS:
- if(s->compr == TIFF_G3)
+ if (s->compr == TIFF_G3)
s->fax_opts = value;
break;
case TIFF_T6OPTIONS:
- if(s->compr == TIFF_G4)
+ if (s->compr == TIFF_G4)
s->fax_opts = value;
break;
default:
- av_log(s->avctx, AV_LOG_DEBUG, "Unknown or unsupported tag %d/0X%0X\n", tag, tag);
+ av_log(s->avctx, AV_LOG_DEBUG, "Unknown or unsupported tag %d/0X%0X\n",
+ tag, tag);
}
return 0;
}
static int decode_frame(AVCodecContext *avctx,
- void *data, int *data_size,
- AVPacket *avpkt)
+ void *data, int *got_frame, AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
- TiffContext * const s = avctx->priv_data;
+ TiffContext *const s = avctx->priv_data;
AVFrame *picture = data;
- AVFrame * const p= (AVFrame*)&s->picture;
+ AVFrame *const p = &s->picture;
const uint8_t *orig_buf = buf, *end_buf = buf + buf_size;
unsigned off;
int id, le, ret;
@@ -521,10 +561,13 @@ static int decode_frame(AVCodecContext *avctx,
//parse image header
if (end_buf - buf < 8)
return AVERROR_INVALIDDATA;
- id = AV_RL16(buf); buf += 2;
- if(id == 0x4949) le = 1;
- else if(id == 0x4D4D) le = 0;
- else{
+ id = AV_RL16(buf);
+ buf += 2;
+ if (id == 0x4949)
+ le = 1;
+ else if (id == 0x4D4D)
+ le = 0;
+ else {
av_log(avctx, AV_LOG_ERROR, "TIFF header not found\n");
return -1;
}
@@ -534,8 +577,9 @@ static int decode_frame(AVCodecContext *avctx,
s->fill_order = 0;
// As TIFF 6.0 specification puts it "An arbitrary but carefully chosen number
// that further identifies the file as a TIFF file"
- if(tget_short(&buf, le) != 42){
- av_log(avctx, AV_LOG_ERROR, "The answer to life, universe and everything is not correct!\n");
+ if (tget_short(&buf, le) != 42) {
+ av_log(avctx, AV_LOG_ERROR,
+ "The answer to life, universe and everything is not correct!\n");
return -1;
}
// Reset these pointers so we can tell if they were set this frame
@@ -548,12 +592,12 @@ static int decode_frame(AVCodecContext *avctx,
}
buf = orig_buf + off;
entries = tget_short(&buf, le);
- for(i = 0; i < entries; i++){
- if(tiff_decode_tag(s, orig_buf, buf, end_buf) < 0)
+ for (i = 0; i < entries; i++) {
+ if (tiff_decode_tag(s, orig_buf, buf, end_buf) < 0)
return -1;
buf += 12;
}
- if(!s->stripdata && !s->stripoff){
+ if (!s->stripdata && !s->stripoff) {
av_log(avctx, AV_LOG_ERROR, "Image data is missing\n");
return -1;
}
@@ -561,71 +605,73 @@ static int decode_frame(AVCodecContext *avctx,
if ((ret = init_image(s)) < 0)
return ret;
- if(s->strips == 1 && !s->stripsize){
+ if (s->strips == 1 && !s->stripsize) {
av_log(avctx, AV_LOG_WARNING, "Image data size missing\n");
s->stripsize = buf_size - s->stripoff;
}
stride = p->linesize[0];
dst = p->data[0];
- for(i = 0; i < s->height; i += s->rps){
- if(s->stripsizes) {
+ for (i = 0; i < s->height; i += s->rps) {
+ if (s->stripsizes) {
if (s->stripsizes >= end_buf)
return AVERROR_INVALIDDATA;
ssize = tget(&s->stripsizes, s->sstype, s->le);
} else
ssize = s->stripsize;
- if(s->stripdata){
+ if (s->stripdata) {
if (s->stripdata >= end_buf)
return AVERROR_INVALIDDATA;
soff = tget(&s->stripdata, s->sot, s->le);
- }else
+ } else
soff = s->stripoff;
if (soff > buf_size || ssize > buf_size - soff) {
av_log(avctx, AV_LOG_ERROR, "Invalid strip size/offset\n");
return -1;
}
- if(tiff_unpack_strip(s, dst, stride, orig_buf + soff, ssize, FFMIN(s->rps, s->height - i)) < 0)
+ if (tiff_unpack_strip(s, dst, stride, orig_buf + soff, ssize,
+ FFMIN(s->rps, s->height - i)) < 0)
break;
dst += s->rps * stride;
}
- if(s->predictor == 2){
+ if (s->predictor == 2) {
dst = p->data[0];
soff = s->bpp >> 3;
ssize = s->width * soff;
- for(i = 0; i < s->height; i++) {
- for(j = soff; j < ssize; j++)
+ for (i = 0; i < s->height; i++) {
+ for (j = soff; j < ssize; j++)
dst[j] += dst[j - soff];
dst += stride;
}
}
- if(s->invert){
+ if (s->invert) {
uint8_t *src;
int j;
src = s->picture.data[0];
- for(j = 0; j < s->height; j++){
- for(i = 0; i < s->picture.linesize[0]; i++)
+ for (j = 0; j < s->height; j++) {
+ for (i = 0; i < s->picture.linesize[0]; i++)
src[i] = 255 - src[i];
src += s->picture.linesize[0];
}
}
- *picture= *(AVFrame*)&s->picture;
- *data_size = sizeof(AVPicture);
+ *picture = s->picture;
+ *got_frame = 1;
return buf_size;
}
-static av_cold int tiff_init(AVCodecContext *avctx){
+static av_cold int tiff_init(AVCodecContext *avctx)
+{
TiffContext *s = avctx->priv_data;
s->width = 0;
s->height = 0;
s->avctx = avctx;
- avcodec_get_frame_defaults((AVFrame*)&s->picture);
- avctx->coded_frame= (AVFrame*)&s->picture;
+ avcodec_get_frame_defaults(&s->picture);
+ avctx->coded_frame = &s->picture;
ff_lzw_decode_open(&s->lzw);
ff_ccitt_unpack_init();
@@ -634,10 +680,10 @@ static av_cold int tiff_init(AVCodecContext *avctx){
static av_cold int tiff_end(AVCodecContext *avctx)
{
- TiffContext * const s = avctx->priv_data;
+ TiffContext *const s = avctx->priv_data;
ff_lzw_decode_close(&s->lzw);
- if(s->picture.data[0])
+ if (s->picture.data[0])
avctx->release_buffer(avctx, &s->picture);
return 0;
}
@@ -645,11 +691,11 @@ static av_cold int tiff_end(AVCodecContext *avctx)
AVCodec ff_tiff_decoder = {
.name = "tiff",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_TIFF,
+ .id = AV_CODEC_ID_TIFF,
.priv_data_size = sizeof(TiffContext),
.init = tiff_init,
.close = tiff_end,
.decode = decode_frame,
.capabilities = CODEC_CAP_DR1,
- .long_name = NULL_IF_CONFIG_SMALL("TIFF image"),
+ .long_name = NULL_IF_CONFIG_SMALL("TIFF image"),
};
diff --git a/gst-libs/ext/libav/libavcodec/tiffenc.c b/gst-libs/ext/libav/libavcodec/tiffenc.c
index af9a870..8162c40 100644
--- a/gst-libs/ext/libav/libavcodec/tiffenc.c
+++ b/gst-libs/ext/libav/libavcodec/tiffenc.c
@@ -27,8 +27,10 @@
#include "libavutil/log.h"
#include "libavutil/opt.h"
+#include "libavutil/pixdesc.h"
#include "avcodec.h"
+#include "config.h"
#if CONFIG_ZLIB
#include <zlib.h>
#endif
@@ -74,7 +76,7 @@ typedef struct TiffEncoderContext {
* @param need Needed bytes
* @return 0 - ok, 1 - no free space
*/
-inline static int check_size(TiffEncoderContext * s, uint64_t need)
+static inline int check_size(TiffEncoderContext * s, uint64_t need)
{
if (s->buf_size < *s->buf - s->buf_start + need) {
*s->buf = s->buf_start + s->buf_size + 1;
@@ -200,87 +202,76 @@ static void pack_yuv(TiffEncoderContext * s, uint8_t * dst, int lnum)
}
}
-static int encode_frame(AVCodecContext * avctx, unsigned char *buf,
- int buf_size, void *data)
+static int encode_frame(AVCodecContext * avctx, AVPacket *pkt,
+ const AVFrame *pict, int *got_packet)
{
TiffEncoderContext *s = avctx->priv_data;
- AVFrame *pict = data;
- AVFrame *const p = (AVFrame *) & s->picture;
+ AVFrame *const p = &s->picture;
int i;
- int n;
- uint8_t *ptr = buf;
+ uint8_t *ptr;
uint8_t *offset;
uint32_t strips;
uint32_t *strip_sizes = NULL;
uint32_t *strip_offsets = NULL;
int bytes_per_row;
uint32_t res[2] = { 72, 1 }; // image resolution (72/1)
- static const uint16_t bpp_tab[] = { 8, 8, 8, 8 };
- int ret = -1;
+ uint16_t bpp_tab[] = { 8, 8, 8, 8 };
+ int ret;
int is_yuv = 0;
uint8_t *yuv_line = NULL;
int shift_h, shift_v;
+ const AVPixFmtDescriptor* pfd;
s->avctx = avctx;
- s->buf_start = buf;
- s->buf = &ptr;
- s->buf_size = buf_size;
*p = *pict;
p->pict_type = AV_PICTURE_TYPE_I;
p->key_frame = 1;
avctx->coded_frame= &s->picture;
-#if FF_API_TIFFENC_COMPLEVEL
- if (avctx->compression_level != FF_COMPRESSION_DEFAULT)
- av_log(avctx, AV_LOG_WARNING, "Using compression_level to set compression "
- "algorithm is deprecated. Please use the compression_algo private "
- "option instead.\n");
- if (avctx->compression_level == 0) {
- s->compr = TIFF_RAW;
- } else if(avctx->compression_level == 2) {
- s->compr = TIFF_LZW;
-#if CONFIG_ZLIB
- } else if ((avctx->compression_level >= 3)) {
- s->compr = TIFF_DEFLATE;
-#endif
- }
-#endif
-
s->width = avctx->width;
s->height = avctx->height;
s->subsampling[0] = 1;
s->subsampling[1] = 1;
switch (avctx->pix_fmt) {
- case PIX_FMT_RGB24:
- s->bpp = 24;
- s->photometric_interpretation = 2;
- break;
- case PIX_FMT_GRAY8:
- s->bpp = 8;
- s->photometric_interpretation = 1;
- break;
- case PIX_FMT_PAL8:
- s->bpp = 8;
- s->photometric_interpretation = 3;
+ case AV_PIX_FMT_RGB48LE:
+ case AV_PIX_FMT_GRAY16LE:
+ case AV_PIX_FMT_RGB24:
+ case AV_PIX_FMT_GRAY8:
+ case AV_PIX_FMT_PAL8:
+ pfd = av_pix_fmt_desc_get(avctx->pix_fmt);
+ s->bpp = av_get_bits_per_pixel(pfd);
+ if (pfd->flags & PIX_FMT_PAL) {
+ s->photometric_interpretation = 3;
+ } else if (pfd->flags & PIX_FMT_RGB) {
+ s->photometric_interpretation = 2;
+ } else {
+ s->photometric_interpretation = 1;
+ }
+ s->bpp_tab_size = pfd->nb_components;
+ for (i = 0; i < s->bpp_tab_size; i++) {
+ bpp_tab[i] = s->bpp / s->bpp_tab_size;
+ }
break;
- case PIX_FMT_MONOBLACK:
+ case AV_PIX_FMT_MONOBLACK:
s->bpp = 1;
s->photometric_interpretation = 1;
+ s->bpp_tab_size = 0;
break;
- case PIX_FMT_MONOWHITE:
+ case AV_PIX_FMT_MONOWHITE:
s->bpp = 1;
s->photometric_interpretation = 0;
+ s->bpp_tab_size = 0;
break;
- case PIX_FMT_YUV420P:
- case PIX_FMT_YUV422P:
- case PIX_FMT_YUV444P:
- case PIX_FMT_YUV410P:
- case PIX_FMT_YUV411P:
+ case AV_PIX_FMT_YUV420P:
+ case AV_PIX_FMT_YUV422P:
+ case AV_PIX_FMT_YUV444P:
+ case AV_PIX_FMT_YUV410P:
+ case AV_PIX_FMT_YUV411P:
s->photometric_interpretation = 6;
- avcodec_get_chroma_sub_sample(avctx->pix_fmt,
- &shift_h, &shift_v);
+ av_pix_fmt_get_chroma_sub_sample(avctx->pix_fmt,
+ &shift_h, &shift_v);
s->bpp = 8 + (16 >> (shift_h + shift_v));
s->subsampling[0] = 1 << shift_h;
s->subsampling[1] = 1 << shift_v;
@@ -292,8 +283,6 @@ static int encode_frame(AVCodecContext * avctx, unsigned char *buf,
"This colors format is not supported\n");
return -1;
}
- if (!is_yuv)
- s->bpp_tab_size = (s->bpp >> 3);
if (s->compr == TIFF_DEFLATE || s->compr == TIFF_ADOBE_DEFLATE || s->compr == TIFF_LZW)
//best choose for DEFLATE
@@ -304,6 +293,17 @@ static int encode_frame(AVCodecContext * avctx, unsigned char *buf,
strips = (s->height - 1) / s->rps + 1;
+ if (!pkt->data &&
+ (ret = av_new_packet(pkt, avctx->width * avctx->height * s->bpp * 2 +
+ avctx->height * 4 + FF_MIN_BUFFER_SIZE)) < 0) {
+ av_log(avctx, AV_LOG_ERROR, "Error getting output packet.\n");
+ return ret;
+ }
+ ptr = pkt->data;
+ s->buf_start = pkt->data;
+ s->buf = &ptr;
+ s->buf_size = pkt->size;
+
if (check_size(s, 8))
goto fail;
@@ -344,7 +344,7 @@ static int encode_frame(AVCodecContext * avctx, unsigned char *buf,
ret = AVERROR(ENOMEM);
goto fail;
}
- strip_offsets[0] = ptr - buf;
+ strip_offsets[0] = ptr - pkt->data;
zn = 0;
for (j = 0; j < s->rps; j++) {
if (is_yuv){
@@ -357,14 +357,14 @@ static int encode_frame(AVCodecContext * avctx, unsigned char *buf,
p->data[0] + j * p->linesize[0], bytes_per_row);
zn += bytes_per_row;
}
- n = encode_strip(s, zbuf, ptr, zn, s->compr);
+ ret = encode_strip(s, zbuf, ptr, zn, s->compr);
av_free(zbuf);
- if (n<0) {
+ if (ret < 0) {
av_log(s->avctx, AV_LOG_ERROR, "Encode strip failed\n");
goto fail;
}
- ptr += n;
- strip_sizes[0] = ptr - buf - strip_offsets[0];
+ ptr += ret;
+ strip_sizes[0] = ptr - pkt->data - strip_offsets[0];
} else
#endif
{
@@ -381,24 +381,23 @@ static int encode_frame(AVCodecContext * avctx, unsigned char *buf,
ff_lzw_encode_init(s->lzws, ptr, s->buf_size - (*s->buf - s->buf_start),
12, FF_LZW_TIFF, put_bits);
}
- strip_offsets[i / s->rps] = ptr - buf;
+ strip_offsets[i / s->rps] = ptr - pkt->data;
}
if (is_yuv){
pack_yuv(s, yuv_line, i);
- n = encode_strip(s, yuv_line, ptr, bytes_per_row, s->compr);
+ ret = encode_strip(s, yuv_line, ptr, bytes_per_row, s->compr);
i += s->subsampling[1] - 1;
}
else
- n = encode_strip(s, p->data[0] + i * p->linesize[0],
+ ret = encode_strip(s, p->data[0] + i * p->linesize[0],
ptr, bytes_per_row, s->compr);
- if (n < 0) {
+ if (ret < 0) {
av_log(s->avctx, AV_LOG_ERROR, "Encode strip failed\n");
goto fail;
}
- strip_sizes[i / s->rps] += n;
- ptr += n;
+ strip_sizes[i / s->rps] += ret;
+ ptr += ret;
if(s->compr == TIFF_LZW && (i==s->height-1 || i%s->rps == s->rps-1)){
- int ret;
ret = ff_lzw_encode_flush(s->lzws, flush_put_bits);
strip_sizes[(i / s->rps )] += ret ;
ptr += ret;
@@ -434,7 +433,7 @@ static int encode_frame(AVCodecContext * avctx, unsigned char *buf,
add_entry(s, TIFF_SOFTWARE_NAME, TIFF_STRING,
strlen(LIBAVCODEC_IDENT) + 1, LIBAVCODEC_IDENT);
- if (avctx->pix_fmt == PIX_FMT_PAL8) {
+ if (avctx->pix_fmt == AV_PIX_FMT_PAL8) {
uint16_t pal[256 * 3];
for (i = 0; i < 256; i++) {
uint32_t rgb = *(uint32_t *) (p->data[1] + i * 4);
@@ -450,15 +449,19 @@ static int encode_frame(AVCodecContext * avctx, unsigned char *buf,
add_entry(s, TIFF_YCBCR_SUBSAMPLING, TIFF_SHORT, 2, s->subsampling);
add_entry(s, TIFF_REFERENCE_BW, TIFF_RATIONAL, 6, refbw);
}
- bytestream_put_le32(&offset, ptr - buf); // write offset to dir
+ bytestream_put_le32(&offset, ptr - pkt->data); // write offset to dir
- if (check_size(s, 6 + s->num_entries * 12))
+ if (check_size(s, 6 + s->num_entries * 12)) {
+ ret = AVERROR(EINVAL);
goto fail;
+ }
bytestream_put_le16(&ptr, s->num_entries); // write tag count
bytestream_put_buffer(&ptr, s->entries, s->num_entries * 12);
bytestream_put_le32(&ptr, 0);
- ret = ptr - buf;
+ pkt->size = ptr - pkt->data;
+ pkt->flags |= AV_PKT_FLAG_KEY;
+ *got_packet = 1;
fail:
av_free(strip_sizes);
@@ -470,12 +473,12 @@ fail:
#define OFFSET(x) offsetof(TiffEncoderContext, x)
#define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
static const AVOption options[] = {
- { "compression_algo", NULL, OFFSET(compr), AV_OPT_TYPE_INT, {TIFF_PACKBITS}, TIFF_RAW, TIFF_DEFLATE, VE, "compression_algo" },
- { "packbits", NULL, 0, AV_OPT_TYPE_CONST, {TIFF_PACKBITS}, 0, 0, VE, "compression_algo" },
- { "raw", NULL, 0, AV_OPT_TYPE_CONST, {TIFF_RAW}, 0, 0, VE, "compression_algo" },
- { "lzw", NULL, 0, AV_OPT_TYPE_CONST, {TIFF_LZW}, 0, 0, VE, "compression_algo" },
+ { "compression_algo", NULL, OFFSET(compr), AV_OPT_TYPE_INT, {.i64 = TIFF_PACKBITS}, TIFF_RAW, TIFF_DEFLATE, VE, "compression_algo" },
+ { "packbits", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = TIFF_PACKBITS}, 0, 0, VE, "compression_algo" },
+ { "raw", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = TIFF_RAW}, 0, 0, VE, "compression_algo" },
+ { "lzw", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = TIFF_LZW}, 0, 0, VE, "compression_algo" },
#if CONFIG_ZLIB
- { "deflate", NULL, 0, AV_OPT_TYPE_CONST, {TIFF_DEFLATE}, 0, 0, VE, "compression_algo" },
+ { "deflate", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = TIFF_DEFLATE}, 0, 0, VE, "compression_algo" },
#endif
{ NULL },
};
@@ -490,16 +493,17 @@ static const AVClass tiffenc_class = {
AVCodec ff_tiff_encoder = {
.name = "tiff",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_TIFF,
+ .id = AV_CODEC_ID_TIFF,
.priv_data_size = sizeof(TiffEncoderContext),
- .encode = encode_frame,
- .pix_fmts =
- (const enum PixelFormat[]) {PIX_FMT_RGB24, PIX_FMT_PAL8, PIX_FMT_GRAY8,
- PIX_FMT_MONOBLACK, PIX_FMT_MONOWHITE,
- PIX_FMT_YUV420P, PIX_FMT_YUV422P,
- PIX_FMT_YUV444P, PIX_FMT_YUV410P,
- PIX_FMT_YUV411P,
- PIX_FMT_NONE},
- .long_name = NULL_IF_CONFIG_SMALL("TIFF image"),
+ .encode2 = encode_frame,
+ .pix_fmts = (const enum AVPixelFormat[]) {
+ AV_PIX_FMT_RGB24, AV_PIX_FMT_RGB48LE, AV_PIX_FMT_PAL8,
+ AV_PIX_FMT_GRAY8, AV_PIX_FMT_GRAY16LE,
+ AV_PIX_FMT_MONOBLACK, AV_PIX_FMT_MONOWHITE,
+ AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUV444P,
+ AV_PIX_FMT_YUV410P, AV_PIX_FMT_YUV411P,
+ AV_PIX_FMT_NONE
+ },
+ .long_name = NULL_IF_CONFIG_SMALL("TIFF image"),
.priv_class = &tiffenc_class,
};
diff --git a/gst-libs/ext/libav/libavcodec/tmv.c b/gst-libs/ext/libav/libavcodec/tmv.c
index be809b3..d4e5aa1 100644
--- a/gst-libs/ext/libav/libavcodec/tmv.c
+++ b/gst-libs/ext/libav/libavcodec/tmv.c
@@ -26,7 +26,11 @@
* @see http://www.oldskool.org/pc/8088_Corruption
*/
+#include <string.h>
+
#include "avcodec.h"
+#include "internal.h"
+#include "libavutil/internal.h"
#include "cga_data.h"
@@ -35,7 +39,7 @@ typedef struct TMVContext {
} TMVContext;
static int tmv_decode_frame(AVCodecContext *avctx, void *data,
- int *data_size, AVPacket *avpkt)
+ int *got_frame, AVPacket *avpkt)
{
TMVContext *tmv = avctx->priv_data;
const uint8_t *src = avpkt->data;
@@ -47,7 +51,7 @@ static int tmv_decode_frame(AVCodecContext *avctx, void *data,
if (tmv->pic.data[0])
avctx->release_buffer(avctx, &tmv->pic);
- if (avctx->get_buffer(avctx, &tmv->pic) < 0) {
+ if (ff_get_buffer(avctx, &tmv->pic) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return -1;
}
@@ -55,7 +59,7 @@ static int tmv_decode_frame(AVCodecContext *avctx, void *data,
if (avpkt->size < 2*char_rows*char_cols) {
av_log(avctx, AV_LOG_ERROR,
"Input buffer too small, truncated sample?\n");
- *data_size = 0;
+ *got_frame = 0;
return -1;
}
@@ -77,14 +81,14 @@ static int tmv_decode_frame(AVCodecContext *avctx, void *data,
dst += tmv->pic.linesize[0] * 8;
}
- *data_size = sizeof(AVFrame);
+ *got_frame = 1;
*(AVFrame *)data = tmv->pic;
return avpkt->size;
}
static av_cold int tmv_decode_init(AVCodecContext *avctx)
{
- avctx->pix_fmt = PIX_FMT_PAL8;
+ avctx->pix_fmt = AV_PIX_FMT_PAL8;
return 0;
}
@@ -101,7 +105,7 @@ static av_cold int tmv_decode_close(AVCodecContext *avctx)
AVCodec ff_tmv_decoder = {
.name = "tmv",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_TMV,
+ .id = AV_CODEC_ID_TMV,
.priv_data_size = sizeof(TMVContext),
.init = tmv_decode_init,
.close = tmv_decode_close,
diff --git a/gst-libs/ext/libav/libavcodec/truemotion1.c b/gst-libs/ext/libav/libavcodec/truemotion1.c
index fcf6004..c49f9fe 100644
--- a/gst-libs/ext/libav/libavcodec/truemotion1.c
+++ b/gst-libs/ext/libav/libavcodec/truemotion1.c
@@ -36,6 +36,8 @@
#include "avcodec.h"
#include "dsputil.h"
#include "libavutil/imgutils.h"
+#include "libavutil/internal.h"
+#include "libavutil/mem.h"
#include "truemotion1data.h"
@@ -310,7 +312,7 @@ static int truemotion1_decode_header(TrueMotion1Context *s)
int width_shift = 0;
int new_pix_fmt;
struct frame_header header;
- uint8_t header_buffer[128]; /* logical maximum size of the header */
+ uint8_t header_buffer[128] = { 0 }; /* logical maximum size of the header */
const uint8_t *sel_vector_table;
header.header_size = ((s->buf[0] >> 5) | (s->buf[0] << 3)) & 0x7f;
@@ -321,7 +323,6 @@ static int truemotion1_decode_header(TrueMotion1Context *s)
}
/* unscramble the header bytes with a XOR operation */
- memset(header_buffer, 0, 128);
for (i = 1; i < header.header_size; i++)
header_buffer[i - 1] = s->buf[i] ^ s->buf[i + 1];
@@ -355,14 +356,7 @@ static int truemotion1_decode_header(TrueMotion1Context *s)
if (s->flags & FLAG_SPRITE) {
av_log_ask_for_sample(s->avctx, "SPRITE frame found.\n");
/* FIXME header.width, height, xoffset and yoffset aren't initialized */
-#if 0
- s->w = header.width;
- s->h = header.height;
- s->x = header.xoffset;
- s->y = header.yoffset;
-#else
- return -1;
-#endif
+ return AVERROR_PATCHWELCOME;
} else {
s->w = header.xsize;
s->h = header.ysize;
@@ -396,10 +390,10 @@ static int truemotion1_decode_header(TrueMotion1Context *s)
}
if (compression_types[header.compression].algorithm == ALGO_RGB24H) {
- new_pix_fmt = PIX_FMT_RGB32;
+ new_pix_fmt = AV_PIX_FMT_RGB32;
width_shift = 1;
} else
- new_pix_fmt = PIX_FMT_RGB555; // RGB565 is supported as well
+ new_pix_fmt = AV_PIX_FMT_RGB555; // RGB565 is supported as well
s->w >>= width_shift;
if (av_image_check_size(s->w, s->h, 0, s->avctx) < 0)
@@ -425,7 +419,7 @@ static int truemotion1_decode_header(TrueMotion1Context *s)
if (compression_types[header.compression].algorithm == ALGO_RGB24H)
gen_vector_table24(s, sel_vector_table);
else
- if (s->avctx->pix_fmt == PIX_FMT_RGB555)
+ if (s->avctx->pix_fmt == AV_PIX_FMT_RGB555)
gen_vector_table15(s, sel_vector_table);
else
gen_vector_table16(s, sel_vector_table);
@@ -470,9 +464,9 @@ static av_cold int truemotion1_decode_init(AVCodecContext *avctx)
// FIXME: it may change ?
// if (avctx->bits_per_sample == 24)
-// avctx->pix_fmt = PIX_FMT_RGB24;
+// avctx->pix_fmt = AV_PIX_FMT_RGB24;
// else
-// avctx->pix_fmt = PIX_FMT_RGB555;
+// avctx->pix_fmt = AV_PIX_FMT_RGB555;
s->frame.data[0] = NULL;
@@ -845,7 +839,7 @@ static void truemotion1_decode_24bit(TrueMotion1Context *s)
static int truemotion1_decode_frame(AVCodecContext *avctx,
- void *data, int *data_size,
+ void *data, int *got_frame,
AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
@@ -872,7 +866,7 @@ static int truemotion1_decode_frame(AVCodecContext *avctx,
truemotion1_decode_16bit(s);
}
- *data_size = sizeof(AVFrame);
+ *got_frame = 1;
*(AVFrame*)data = s->frame;
/* report that the buffer was completely consumed */
@@ -894,11 +888,11 @@ static av_cold int truemotion1_decode_end(AVCodecContext *avctx)
AVCodec ff_truemotion1_decoder = {
.name = "truemotion1",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_TRUEMOTION1,
+ .id = AV_CODEC_ID_TRUEMOTION1,
.priv_data_size = sizeof(TrueMotion1Context),
.init = truemotion1_decode_init,
.close = truemotion1_decode_end,
.decode = truemotion1_decode_frame,
.capabilities = CODEC_CAP_DR1,
- .long_name = NULL_IF_CONFIG_SMALL("Duck TrueMotion 1.0"),
+ .long_name = NULL_IF_CONFIG_SMALL("Duck TrueMotion 1.0"),
};
diff --git a/gst-libs/ext/libav/libavcodec/truemotion2.c b/gst-libs/ext/libav/libavcodec/truemotion2.c
index 09d9e27..2d7a510 100644
--- a/gst-libs/ext/libav/libavcodec/truemotion2.c
+++ b/gst-libs/ext/libav/libavcodec/truemotion2.c
@@ -200,27 +200,23 @@ static inline int tm2_get_token(GetBitContext *gb, TM2Codes *code)
return code->recode[val];
}
+#define TM2_OLD_HEADER_MAGIC 0x00000100
+#define TM2_NEW_HEADER_MAGIC 0x00000101
+
static inline int tm2_read_header(TM2Context *ctx, const uint8_t *buf)
{
- uint32_t magic;
- const uint8_t *obuf;
-
- obuf = buf;
-
- magic = AV_RL32(buf);
- buf += 4;
+ uint32_t magic = AV_RL32(buf);
- if(magic == 0x00000100) { /* old header */
-/* av_log (ctx->avctx, AV_LOG_ERROR, "TM2 old header: not implemented (yet)\n"); */
- return 40;
- } else if(magic == 0x00000101) { /* new header */
- return 40;
- } else {
- av_log (ctx->avctx, AV_LOG_ERROR, "Not a TM2 header: 0x%08X\n", magic);
- return -1;
+ switch (magic) {
+ case TM2_OLD_HEADER_MAGIC:
+ av_log_missing_feature(ctx->avctx, "TM2 old header", 1);
+ return 0;
+ case TM2_NEW_HEADER_MAGIC:
+ return 0;
+ default:
+ av_log(ctx->avctx, AV_LOG_ERROR, "Not a TM2 header: 0x%08X\n", magic);
+ return AVERROR_INVALIDDATA;
}
-
- return buf - obuf;
}
static int tm2_read_deltas(TM2Context *ctx, int stream_id) {
@@ -810,15 +806,17 @@ static const int tm2_stream_order[TM2_NUM_STREAMS] = {
TM2_C_HI, TM2_C_LO, TM2_L_HI, TM2_L_LO, TM2_UPD, TM2_MOT, TM2_TYPE
};
+#define TM2_HEADER_SIZE 40
+
static int decode_frame(AVCodecContext *avctx,
- void *data, int *data_size,
+ void *data, int *got_frame,
AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size & ~3;
TM2Context * const l = avctx->priv_data;
- AVFrame * const p= (AVFrame*)&l->pic;
- int i, skip, t;
+ AVFrame * const p = &l->pic;
+ int i, offset = TM2_HEADER_SIZE, t, ret;
uint8_t *swbuf;
swbuf = av_malloc(buf_size + FF_INPUT_BUFFER_PADDING_SIZE);
@@ -835,24 +833,24 @@ static int decode_frame(AVCodecContext *avctx,
}
l->dsp.bswap_buf((uint32_t*)swbuf, (const uint32_t*)buf, buf_size >> 2);
- skip = tm2_read_header(l, swbuf);
- if(skip == -1){
+ if ((ret = tm2_read_header(l, swbuf)) < 0) {
av_free(swbuf);
- return -1;
+ return ret;
}
for(i = 0; i < TM2_NUM_STREAMS; i++){
- if (skip >= buf_size) {
+ if (offset >= buf_size) {
av_free(swbuf);
return AVERROR_INVALIDDATA;
}
- t = tm2_read_stream(l, swbuf + skip, tm2_stream_order[i], buf_size - skip);
+ t = tm2_read_stream(l, swbuf + offset, tm2_stream_order[i],
+ buf_size - offset);
if(t < 0){
av_free(swbuf);
return t;
}
- skip += t;
+ offset += t;
}
p->key_frame = tm2_decode_blocks(l, p);
if(p->key_frame)
@@ -861,7 +859,7 @@ static int decode_frame(AVCodecContext *avctx,
p->pict_type = AV_PICTURE_TYPE_P;
l->cur = !l->cur;
- *data_size = sizeof(AVFrame);
+ *got_frame = 1;
*(AVFrame*)data = l->pic;
av_free(swbuf);
@@ -879,9 +877,9 @@ static av_cold int decode_init(AVCodecContext *avctx){
l->avctx = avctx;
l->pic.data[0]=NULL;
- avctx->pix_fmt = PIX_FMT_BGR24;
+ avctx->pix_fmt = AV_PIX_FMT_BGR24;
- dsputil_init(&l->dsp, avctx);
+ ff_dsputil_init(&l->dsp, avctx);
l->last = av_malloc(4 * sizeof(*l->last) * (w >> 2));
l->clast = av_malloc(4 * sizeof(*l->clast) * (w >> 2));
@@ -954,11 +952,11 @@ static av_cold int decode_end(AVCodecContext *avctx){
AVCodec ff_truemotion2_decoder = {
.name = "truemotion2",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_TRUEMOTION2,
+ .id = AV_CODEC_ID_TRUEMOTION2,
.priv_data_size = sizeof(TM2Context),
.init = decode_init,
.close = decode_end,
.decode = decode_frame,
.capabilities = CODEC_CAP_DR1,
- .long_name = NULL_IF_CONFIG_SMALL("Duck TrueMotion 2.0"),
+ .long_name = NULL_IF_CONFIG_SMALL("Duck TrueMotion 2.0"),
};
diff --git a/gst-libs/ext/libav/libavcodec/truespeech.c b/gst-libs/ext/libav/libavcodec/truespeech.c
index 5ef0a01..486e41f 100644
--- a/gst-libs/ext/libav/libavcodec/truespeech.c
+++ b/gst-libs/ext/libav/libavcodec/truespeech.c
@@ -19,10 +19,12 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "libavutil/channel_layout.h"
#include "libavutil/intreadwrite.h"
#include "avcodec.h"
#include "dsputil.h"
#include "get_bits.h"
+#include "internal.h"
#include "truespeech_data.h"
/**
@@ -37,7 +39,7 @@ typedef struct {
AVFrame frame;
DSPContext dsp;
/* input data */
- uint8_t buffer[32];
+ DECLARE_ALIGNED(16, uint8_t, buffer)[32];
int16_t vector[8]; ///< input vector: 5/5/4/4/4/3/3/3
int offset1[2]; ///< 8-bit value, used in one copying offset
int offset2[4]; ///< 7-bit value, encodes offsets for copying and for two-point filter
@@ -63,12 +65,13 @@ static av_cold int truespeech_decode_init(AVCodecContext * avctx)
if (avctx->channels != 1) {
av_log_ask_for_sample(avctx, "Unsupported channel count: %d\n", avctx->channels);
- return AVERROR(EINVAL);
+ return AVERROR_PATCHWELCOME;
}
- avctx->sample_fmt = AV_SAMPLE_FMT_S16;
+ avctx->channel_layout = AV_CH_LAYOUT_MONO;
+ avctx->sample_fmt = AV_SAMPLE_FMT_S16;
- dsputil_init(&c->dsp, avctx);
+ ff_dsputil_init(&c->dsp, avctx);
avcodec_get_frame_defaults(&c->frame);
avctx->coded_frame = &c->frame;
@@ -182,7 +185,7 @@ static void truespeech_apply_twopoint_filter(TSContext *dec, int quart)
off = av_clip(off, 0, 145);
ptr0 = tmp + 145 - off;
ptr1 = tmp + 146;
- filter = (const int16_t*)ts_order2_coeffs + (t % 25) * 2;
+ filter = ts_order2_coeffs + (t % 25) * 2;
for(i = 0; i < 60; i++){
t = (ptr0[0] * filter[0] + ptr0[1] * filter[1] + 0x2000) >> 14;
ptr0++;
@@ -207,7 +210,7 @@ static void truespeech_place_pulses(TSContext *dec, int16_t *out, int quart)
}
coef = dec->pulsepos[quart] >> 15;
- ptr1 = (const int16_t*)ts_pulse_values + 30;
+ ptr1 = ts_pulse_values + 30;
ptr2 = tmp;
for(i = 0, j = 3; (i < 30) && (j > 0); i++){
t = *ptr1++;
@@ -220,7 +223,7 @@ static void truespeech_place_pulses(TSContext *dec, int16_t *out, int quart)
}
}
coef = dec->pulsepos[quart] & 0x7FFF;
- ptr1 = (const int16_t*)ts_pulse_values;
+ ptr1 = ts_pulse_values;
for(i = 30, j = 4; (i < 60) && (j > 0); i++){
t = *ptr1++;
if(coef >= t)
@@ -325,7 +328,7 @@ static int truespeech_decode_frame(AVCodecContext *avctx, void *data,
/* get output buffer */
c->frame.nb_samples = iterations * 240;
- if ((ret = avctx->get_buffer(avctx, &c->frame)) < 0) {
+ if ((ret = ff_get_buffer(avctx, &c->frame)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return ret;
}
@@ -360,10 +363,10 @@ static int truespeech_decode_frame(AVCodecContext *avctx, void *data,
AVCodec ff_truespeech_decoder = {
.name = "truespeech",
.type = AVMEDIA_TYPE_AUDIO,
- .id = CODEC_ID_TRUESPEECH,
+ .id = AV_CODEC_ID_TRUESPEECH,
.priv_data_size = sizeof(TSContext),
.init = truespeech_decode_init,
.decode = truespeech_decode_frame,
.capabilities = CODEC_CAP_DR1,
- .long_name = NULL_IF_CONFIG_SMALL("DSP Group TrueSpeech"),
+ .long_name = NULL_IF_CONFIG_SMALL("DSP Group TrueSpeech"),
};
diff --git a/gst-libs/ext/libav/libavcodec/tscc.c b/gst-libs/ext/libav/libavcodec/tscc.c
index 748072f..5b1c7be 100644
--- a/gst-libs/ext/libav/libavcodec/tscc.c
+++ b/gst-libs/ext/libav/libavcodec/tscc.c
@@ -39,6 +39,7 @@
#include <stdlib.h>
#include "avcodec.h"
+#include "internal.h"
#include "msrledec.h"
#include <zlib.h>
@@ -70,7 +71,8 @@ typedef struct TsccContext {
* Decode a frame
*
*/
-static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt)
+static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
+ AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
@@ -84,7 +86,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
c->pic.reference = 1;
c->pic.buffer_hints = FF_BUFFER_HINTS_VALID;
- if(avctx->get_buffer(avctx, &c->pic) < 0){
+ if(ff_get_buffer(avctx, &c->pic) < 0){
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return -1;
}
@@ -113,7 +115,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
}
/* make the palette available on the way out */
- if (c->avctx->pix_fmt == PIX_FMT_PAL8) {
+ if (c->avctx->pix_fmt == AV_PIX_FMT_PAL8) {
const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, NULL);
if (pal) {
@@ -123,7 +125,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
memcpy(c->pic.data[1], c->pal, AVPALETTE_SIZE);
}
- *data_size = sizeof(AVFrame);
+ *got_frame = 1;
*(AVFrame*)data = c->pic;
/* always report that the buffer was completely consumed */
@@ -149,12 +151,12 @@ static av_cold int decode_init(AVCodecContext *avctx)
// Needed if zlib unused or init aborted before inflateInit
memset(&c->zstream, 0, sizeof(z_stream));
switch(avctx->bits_per_coded_sample){
- case 8: avctx->pix_fmt = PIX_FMT_PAL8; break;
- case 16: avctx->pix_fmt = PIX_FMT_RGB555; break;
+ case 8: avctx->pix_fmt = AV_PIX_FMT_PAL8; break;
+ case 16: avctx->pix_fmt = AV_PIX_FMT_RGB555; break;
case 24:
- avctx->pix_fmt = PIX_FMT_BGR24;
+ avctx->pix_fmt = AV_PIX_FMT_BGR24;
break;
- case 32: avctx->pix_fmt = PIX_FMT_RGB32; break;
+ case 32: avctx->pix_fmt = AV_PIX_FMT_RGB32; break;
default: av_log(avctx, AV_LOG_ERROR, "Camtasia error: unknown depth %i bpp\n", avctx->bits_per_coded_sample);
return -1;
}
@@ -205,7 +207,7 @@ static av_cold int decode_end(AVCodecContext *avctx)
AVCodec ff_tscc_decoder = {
.name = "camtasia",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_TSCC,
+ .id = AV_CODEC_ID_TSCC,
.priv_data_size = sizeof(CamtasiaContext),
.init = decode_init,
.close = decode_end,
@@ -213,4 +215,3 @@ AVCodec ff_tscc_decoder = {
.capabilities = CODEC_CAP_DR1,
.long_name = NULL_IF_CONFIG_SMALL("TechSmith Screen Capture Codec"),
};
-
diff --git a/gst-libs/ext/libav/libavcodec/tscc2.c b/gst-libs/ext/libav/libavcodec/tscc2.c
new file mode 100644
index 0000000..b7f1b88
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/tscc2.c
@@ -0,0 +1,382 @@
+/*
+ * TechSmith Screen Codec 2 (aka Dora) decoder
+ * Copyright (c) 2012 Konstantin Shishkov
+ *
+ * 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
+ * TechSmith Screen Codec 2 decoder
+ */
+
+#define BITSTREAM_READER_LE
+#include "avcodec.h"
+#include "get_bits.h"
+#include "bytestream.h"
+#include "tscc2data.h"
+
+typedef struct TSCC2Context {
+ AVCodecContext *avctx;
+ AVFrame pic;
+ int mb_width, mb_height;
+ uint8_t *slice_quants;
+ int quant[2];
+ int q[2][3];
+ GetBitContext gb;
+
+ VLC dc_vlc, nc_vlc[NUM_VLC_SETS], ac_vlc[NUM_VLC_SETS];
+ int block[16];
+} TSCC2Context;
+
+static av_cold void free_vlcs(TSCC2Context *c)
+{
+ int i;
+
+ ff_free_vlc(&c->dc_vlc);
+ for (i = 0; i < NUM_VLC_SETS; i++) {
+ ff_free_vlc(c->nc_vlc + i);
+ ff_free_vlc(c->ac_vlc + i);
+ }
+}
+
+static av_cold int init_vlcs(TSCC2Context *c)
+{
+ int i, ret;
+
+ ret = ff_init_vlc_sparse(&c->dc_vlc, 9, DC_VLC_COUNT,
+ tscc2_dc_vlc_bits, 1, 1,
+ tscc2_dc_vlc_codes, 2, 2,
+ tscc2_dc_vlc_syms, 2, 2, INIT_VLC_LE);
+ if (ret)
+ return ret;
+
+ for (i = 0; i < NUM_VLC_SETS; i++) {
+ ret = ff_init_vlc_sparse(c->nc_vlc + i, 9, 16,
+ tscc2_nc_vlc_bits[i], 1, 1,
+ tscc2_nc_vlc_codes[i], 2, 2,
+ tscc2_nc_vlc_syms, 1, 1, INIT_VLC_LE);
+ if (ret) {
+ free_vlcs(c);
+ return ret;
+ }
+ ret = ff_init_vlc_sparse(c->ac_vlc + i, 9, tscc2_ac_vlc_sizes[i],
+ tscc2_ac_vlc_bits[i], 1, 1,
+ tscc2_ac_vlc_codes[i], 2, 2,
+ tscc2_ac_vlc_syms[i], 2, 2, INIT_VLC_LE);
+ if (ret) {
+ free_vlcs(c);
+ return ret;
+ }
+ }
+
+ return 0;
+}
+
+#define DEQUANT(val, q) ((q * val + 0x80) >> 8)
+#define DCT1D(d0, d1, d2, d3, s0, s1, s2, s3, OP) \
+ OP(d0, 5 * ((s0) + (s1) + (s2)) + 2 * (s3)); \
+ OP(d1, 5 * ((s0) - (s2) - (s3)) + 2 * (s1)); \
+ OP(d2, 5 * ((s0) - (s2) + (s3)) - 2 * (s1)); \
+ OP(d3, 5 * ((s0) - (s1) + (s2)) - 2 * (s3)); \
+
+#define COL_OP(a, b) a = b
+#define ROW_OP(a, b) a = ((b) + 0x20) >> 6
+
+static void tscc2_idct4_put(int *in, int q[3], uint8_t *dst, int stride)
+{
+ int i;
+ int tblk[4 * 4];
+ int t0, t1, t2, t3;
+
+ for (i = 0; i < 4; i++) {
+ t0 = DEQUANT(q[0 + (i & 1)], in[0 * 4 + i]);
+ t1 = DEQUANT(q[1 + (i & 1)], in[1 * 4 + i]);
+ t2 = DEQUANT(q[0 + (i & 1)], in[2 * 4 + i]);
+ t3 = DEQUANT(q[1 + (i & 1)], in[3 * 4 + i]);
+ DCT1D(tblk[0 * 4 + i], tblk[1 * 4 + i],
+ tblk[2 * 4 + i], tblk[3 * 4 + i],
+ t0, t1, t2, t3, COL_OP);
+ }
+ for (i = 0; i < 4; i++) {
+ DCT1D(dst[0], dst[1], dst[2], dst[3],
+ tblk[i * 4 + 0], tblk[i * 4 + 1],
+ tblk[i * 4 + 2], tblk[i * 4 + 3], ROW_OP);
+ dst += stride;
+ }
+}
+
+static int tscc2_decode_mb(TSCC2Context *c, int *q, int vlc_set,
+ uint8_t *dst, int stride, int plane)
+{
+ GetBitContext *gb = &c->gb;
+ int prev_dc, dc, nc, ac, bpos, val;
+ int i, j, k, l;
+
+ if (get_bits1(gb)) {
+ if (get_bits1(gb)) {
+ val = get_bits(gb, 8);
+ for (i = 0; i < 8; i++, dst += stride)
+ memset(dst, val, 16);
+ } else {
+ if (get_bits_left(gb) < 16 * 8 * 8)
+ return AVERROR_INVALIDDATA;
+ for (i = 0; i < 8; i++) {
+ for (j = 0; j < 16; j++)
+ dst[j] = get_bits(gb, 8);
+ dst += stride;
+ }
+ }
+ return 0;
+ }
+
+ prev_dc = 0;
+ for (j = 0; j < 2; j++) {
+ for (k = 0; k < 4; k++) {
+ if (!(j | k)) {
+ dc = get_bits(gb, 8);
+ } else {
+ dc = get_vlc2(gb, c->dc_vlc.table, 9, 2);
+ if (dc == -1)
+ return AVERROR_INVALIDDATA;
+ if (dc == 0x100)
+ dc = get_bits(gb, 8);
+ }
+ dc = (dc + prev_dc) & 0xFF;
+ prev_dc = dc;
+ c->block[0] = dc;
+
+ nc = get_vlc2(gb, c->nc_vlc[vlc_set].table, 9, 1);
+ if (nc == -1)
+ return AVERROR_INVALIDDATA;
+
+ bpos = 1;
+ memset(c->block + 1, 0, 15 * sizeof(*c->block));
+ for (l = 0; l < nc; l++) {
+ ac = get_vlc2(gb, c->ac_vlc[vlc_set].table, 9, 2);
+ if (ac == -1)
+ return AVERROR_INVALIDDATA;
+ if (ac == 0x1000)
+ ac = get_bits(gb, 12);
+ bpos += ac & 0xF;
+ if (bpos >= 16)
+ return AVERROR_INVALIDDATA;
+ val = sign_extend(ac >> 4, 8);
+ c->block[tscc2_zigzag[bpos++]] = val;
+ }
+ tscc2_idct4_put(c->block, q, dst + k * 4, stride);
+ }
+ dst += 4 * stride;
+ }
+ return 0;
+}
+
+static int tscc2_decode_slice(TSCC2Context *c, int mb_y,
+ const uint8_t *buf, int buf_size)
+{
+ int i, mb_x, q, ret;
+ int off;
+
+ init_get_bits(&c->gb, buf, buf_size * 8);
+
+ for (mb_x = 0; mb_x < c->mb_width; mb_x++) {
+ q = c->slice_quants[mb_x + c->mb_width * mb_y];
+
+ if (q == 0 || q == 3) // skip block
+ continue;
+ for (i = 0; i < 3; i++) {
+ off = mb_x * 16 + mb_y * 8 * c->pic.linesize[i];
+ ret = tscc2_decode_mb(c, c->q[q - 1], c->quant[q - 1] - 2,
+ c->pic.data[i] + off, c->pic.linesize[i], i);
+ if (ret)
+ return ret;
+ }
+ }
+
+ return 0;
+}
+
+static int tscc2_decode_frame(AVCodecContext *avctx, void *data,
+ int *got_frame, AVPacket *avpkt)
+{
+ const uint8_t *buf = avpkt->data;
+ int buf_size = avpkt->size;
+ TSCC2Context *c = avctx->priv_data;
+ GetByteContext gb;
+ uint32_t frame_type, size;
+ int i, val, len, pos = 0;
+ int num_mb = c->mb_width * c->mb_height;
+ int ret;
+
+ bytestream2_init(&gb, buf, buf_size);
+ frame_type = bytestream2_get_byte(&gb);
+ if (frame_type > 1) {
+ av_log(avctx, AV_LOG_ERROR, "Incorrect frame type %d\n", frame_type);
+ return AVERROR_INVALIDDATA;
+ }
+
+ c->pic.reference = 3;
+ c->pic.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE |
+ FF_BUFFER_HINTS_REUSABLE;
+ if ((ret = avctx->reget_buffer(avctx, &c->pic)) < 0) {
+ av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n");
+ return ret;
+ }
+
+ if (frame_type == 0) {
+ *got_frame = 1;
+ *(AVFrame*)data = c->pic;
+
+ return buf_size;
+ }
+
+ if (bytestream2_get_bytes_left(&gb) < 4) {
+ av_log(avctx, AV_LOG_ERROR, "Frame is too short\n");
+ return AVERROR_INVALIDDATA;
+ }
+
+ c->quant[0] = bytestream2_get_byte(&gb);
+ c->quant[1] = bytestream2_get_byte(&gb);
+ if (c->quant[0] < 2 || c->quant[0] > NUM_VLC_SETS + 1 ||
+ c->quant[1] < 2 || c->quant[1] > NUM_VLC_SETS + 1) {
+ av_log(avctx, AV_LOG_ERROR, "Invalid quantisers %d / %d\n",
+ c->quant[0], c->quant[1]);
+ return AVERROR_INVALIDDATA;
+ }
+
+ for (i = 0; i < 3; i++) {
+ c->q[0][i] = tscc2_quants[c->quant[0] - 2][i];
+ c->q[1][i] = tscc2_quants[c->quant[1] - 2][i];
+ }
+
+ bytestream2_skip(&gb, 1);
+
+ size = bytestream2_get_le32(&gb);
+ if (size > bytestream2_get_bytes_left(&gb)) {
+ av_log(avctx, AV_LOG_ERROR, "Slice properties chunk is too large\n");
+ return AVERROR_INVALIDDATA;
+ }
+
+ for (i = 0; i < size; i++) {
+ val = bytestream2_get_byte(&gb);
+ len = val & 0x3F;
+ val >>= 6;
+ if (pos + len > num_mb) {
+ av_log(avctx, AV_LOG_ERROR, "Too many slice properties\n");
+ return AVERROR_INVALIDDATA;
+ }
+ memset(c->slice_quants + pos, val, len);
+ pos += len;
+ }
+ if (pos < num_mb) {
+ av_log(avctx, AV_LOG_ERROR, "Too few slice properties (%d / %d)\n",
+ pos, num_mb);
+ return AVERROR_INVALIDDATA;
+ }
+
+ for (i = 0; i < c->mb_height; i++) {
+ size = bytestream2_peek_byte(&gb);
+ if (size & 1) {
+ size = bytestream2_get_byte(&gb) - 1;
+ } else {
+ size = bytestream2_get_le32(&gb) >> 1;
+ }
+ if (!size) {
+ int skip_row = 1, j, off = i * c->mb_width;
+ for (j = 0; j < c->mb_width; j++) {
+ if (c->slice_quants[off + j] == 1 ||
+ c->slice_quants[off + j] == 2) {
+ skip_row = 0;
+ break;
+ }
+ }
+ if (!skip_row) {
+ av_log(avctx, AV_LOG_ERROR, "Non-skip row with zero size\n");
+ return AVERROR_INVALIDDATA;
+ }
+ }
+ if (bytestream2_get_bytes_left(&gb) < size) {
+ av_log(avctx, AV_LOG_ERROR, "Invalid slice size (%d/%d)\n",
+ size, bytestream2_get_bytes_left(&gb));
+ return AVERROR_INVALIDDATA;
+ }
+ ret = tscc2_decode_slice(c, i, buf + bytestream2_tell(&gb), size);
+ if (ret) {
+ av_log(avctx, AV_LOG_ERROR, "Error decoding slice %d\n", i);
+ return ret;
+ }
+ bytestream2_skip(&gb, size);
+ }
+
+ *got_frame = 1;
+ *(AVFrame*)data = c->pic;
+
+ /* always report that the buffer was completely consumed */
+ return buf_size;
+}
+
+static av_cold int tscc2_decode_init(AVCodecContext *avctx)
+{
+ TSCC2Context * const c = avctx->priv_data;
+ int ret;
+
+ c->avctx = avctx;
+
+ avctx->pix_fmt = AV_PIX_FMT_YUV444P;
+
+ if ((ret = init_vlcs(c)) < 0) {
+ av_log(avctx, AV_LOG_ERROR, "Cannot initialise VLCs\n");
+ return ret;
+ }
+
+ c->mb_width = FFALIGN(avctx->width, 16) >> 4;
+ c->mb_height = FFALIGN(avctx->height, 8) >> 3;
+ c->slice_quants = av_malloc(c->mb_width * c->mb_height);
+ if (!c->slice_quants) {
+ av_log(avctx, AV_LOG_ERROR, "Cannot allocate slice information\n");
+ free_vlcs(c);
+ return AVERROR(ENOMEM);
+ }
+
+ avctx->coded_frame = &c->pic;
+
+ return 0;
+}
+
+static av_cold int tscc2_decode_end(AVCodecContext *avctx)
+{
+ TSCC2Context * const c = avctx->priv_data;
+
+ if (c->pic.data[0])
+ avctx->release_buffer(avctx, &c->pic);
+ av_freep(&c->slice_quants);
+ free_vlcs(c);
+
+ return 0;
+}
+
+AVCodec ff_tscc2_decoder = {
+ .name = "tscc2",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .id = AV_CODEC_ID_TSCC2,
+ .priv_data_size = sizeof(TSCC2Context),
+ .init = tscc2_decode_init,
+ .close = tscc2_decode_end,
+ .decode = tscc2_decode_frame,
+ .capabilities = CODEC_CAP_DR1,
+ .long_name = NULL_IF_CONFIG_SMALL("TechSmith Screen Codec 2"),
+};
diff --git a/gst-libs/ext/libav/libavcodec/tscc2data.h b/gst-libs/ext/libav/libavcodec/tscc2data.h
new file mode 100644
index 0000000..70a06e5
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/tscc2data.h
@@ -0,0 +1,935 @@
+/*
+ * TechSmith Screen Codec 2 (aka Dora) decoder
+ * Copyright (c) 2012 Konstantin Shishkov
+ *
+ * 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
+ */
+
+#ifndef AVCODEC_TSCC2_DATA_H
+#define AVCODEC_TSCC2_DATA_H
+
+#include <stdint.h>
+
+static const uint8_t tscc2_zigzag[16] = {
+ 0, 1, 4, 8,
+ 5, 2, 3, 6,
+ 9, 12, 13, 10,
+ 7, 11, 14, 15
+};
+
+#define NUM_VLC_SETS 13
+
+static const uint16_t tscc2_quants[NUM_VLC_SETS][3] = {
+ { 655, 861, 1130 }, { 983, 1291, 1695 }, { 1311, 1721, 2260 },
+ { 1638, 2151, 2825 }, { 1966, 2582, 3390 }, { 2294, 3012, 3955 },
+ { 2621, 3442, 4520 }, { 2949, 3872, 5085 }, { 3277, 4303, 5650 },
+ { 3604, 4733, 6215 }, { 3932, 5163, 6780 }, { 4260, 5593, 7345 },
+ { 4588, 6024, 7910 },
+};
+
+#define DC_VLC_COUNT 47
+
+static const uint16_t tscc2_dc_vlc_syms[DC_VLC_COUNT] = {
+ 0x100, 0xFF, 0xFE, 0xFD, 0xFC, 0xFB, 0xFA, 0xF9,
+ 0xF8, 0xF7, 0xF6, 0xF5, 0xF4, 0xF3, 0xF2, 0xF1,
+ 0xF0, 0xEF, 0xEE, 0xED, 0xEC, 0xEB, 0xEA, 0x17,
+ 0x16, 0x15, 0x14, 0x13, 0x12, 0x11, 0x10, 0x0F,
+ 0x0E, 0x0D, 0x0C, 0x0B, 0x0A, 0x09, 0x08, 0x07,
+ 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00,
+};
+
+static const uint16_t tscc2_dc_vlc_codes[DC_VLC_COUNT] = {
+ 0x000A, 0x0000, 0x0006, 0x002E, 0x0002, 0x000E, 0x001A, 0x007E,
+ 0x004E, 0x005A, 0x00E2, 0x01BE, 0x01BA, 0x00BA, 0x0072, 0x0022,
+ 0x02BE, 0x00BE, 0x033A, 0x03F2, 0x01F2, 0x03A2, 0x0122, 0x0322,
+ 0x01A2, 0x0172, 0x0372, 0x013A, 0x00CE, 0x02CE, 0x02FE, 0x00FE,
+ 0x00A2, 0x00F2, 0x003A, 0x01CE, 0x01FE, 0x0062, 0x00DA, 0x003E,
+ 0x0032, 0x007A, 0x0012, 0x001E, 0x0016, 0x0004, 0x0001,
+};
+
+static const uint8_t tscc2_dc_vlc_bits[DC_VLC_COUNT] = {
+ 5, 3, 5, 6, 6, 7, 7, 8,
+ 8, 8, 8, 9, 9, 9, 9, 9,
+ 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10,
+ 9, 9, 9, 9, 9, 8, 8, 8,
+ 7, 7, 6, 6, 5, 3, 1,
+};
+
+static const uint8_t tscc2_nc_vlc_syms[16] = {
+ 0x0F, 0x0E, 0x0D, 0x0C, 0x0B, 0x0A, 0x09, 0x08,
+ 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00,
+};
+
+static const uint16_t tscc2_nc_vlc_codes[NUM_VLC_SETS][16] = {
+ { 0x0023, 0x0003, 0x0031, 0x0021, 0x0011, 0x0053, 0x0013, 0x0001,
+ 0x0009, 0x0029, 0x0033, 0x0019, 0x000B, 0x0005, 0x0007, 0x0000, },
+ { 0x0030, 0x0022, 0x0028, 0x0020, 0x0008, 0x0000, 0x0032, 0x0072,
+ 0x0010, 0x0002, 0x0012, 0x0018, 0x000A, 0x0004, 0x0006, 0x0001, },
+ { 0x0032, 0x0038, 0x0020, 0x0008, 0x0002, 0x0018, 0x0072, 0x0000,
+ 0x0028, 0x0022, 0x0012, 0x0010, 0x000A, 0x0004, 0x0006, 0x0001, },
+ { 0x0032, 0x0010, 0x0072, 0x0030, 0x0022, 0x0038, 0x0008, 0x0028,
+ 0x0018, 0x0002, 0x0012, 0x0000, 0x000A, 0x0004, 0x0006, 0x0001, },
+ { 0x0012, 0x0052, 0x0000, 0x0020, 0x0018, 0x0022, 0x0008, 0x0028,
+ 0x0038, 0x0002, 0x0032, 0x0010, 0x000A, 0x0004, 0x0006, 0x0001, },
+ { 0x0016, 0x0096, 0x0006, 0x0046, 0x0056, 0x0002, 0x0036, 0x0076,
+ 0x0012, 0x0022, 0x0032, 0x0026, 0x000A, 0x000E, 0x0000, 0x0001, },
+ { 0x001A, 0x009A, 0x0032, 0x0072, 0x005A, 0x007A, 0x003A, 0x0002,
+ 0x0012, 0x0022, 0x000A, 0x002A, 0x0006, 0x000E, 0x0000, 0x0001, },
+ { 0x002A, 0x00AA, 0x0002, 0x0042, 0x006A, 0x003A, 0x007A, 0x0022,
+ 0x0032, 0x0012, 0x000A, 0x001A, 0x0006, 0x000E, 0x0000, 0x0001, },
+ { 0x0042, 0x00C2, 0x0002, 0x000A, 0x004A, 0x003A, 0x007A, 0x0022,
+ 0x0012, 0x0032, 0x002A, 0x001A, 0x0006, 0x000E, 0x0000, 0x0001, },
+ { 0x00BA, 0x01BA, 0x003A, 0x0012, 0x0052, 0x007A, 0x0002, 0x0022,
+ 0x0032, 0x000A, 0x002A, 0x001A, 0x0000, 0x0004, 0x0006, 0x0001, },
+ { 0x00AA, 0x01AA, 0x002A, 0x0022, 0x0062, 0x006A, 0x0002, 0x0012,
+ 0x0032, 0x000A, 0x001A, 0x003A, 0x0000, 0x0004, 0x0006, 0x0001, },
+ { 0x00AA, 0x01AA, 0x002A, 0x0022, 0x0062, 0x006A, 0x0002, 0x0012,
+ 0x0032, 0x000A, 0x003A, 0x001A, 0x0000, 0x0004, 0x0006, 0x0001, },
+ { 0x008A, 0x018A, 0x000A, 0x0022, 0x0062, 0x004A, 0x0002, 0x0012,
+ 0x0032, 0x002A, 0x001A, 0x003A, 0x0000, 0x0004, 0x0006, 0x0001, },
+};
+
+static const uint8_t tscc2_nc_vlc_bits[NUM_VLC_SETS][16] = {
+ { 6, 6, 6, 6, 6, 7, 7, 6, 6, 6, 6, 5, 4, 3, 3, 1 },
+ { 6, 6, 6, 6, 6, 6, 7, 7, 6, 6, 6, 5, 4, 3, 3, 1 },
+ { 7, 6, 6, 6, 6, 6, 7, 6, 6, 6, 6, 5, 4, 3, 3, 1 },
+ { 7, 6, 7, 6, 6, 6, 6, 6, 6, 6, 6, 5, 4, 3, 3, 1 },
+ { 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 4, 3, 3, 1 },
+ { 8, 8, 7, 7, 7, 6, 7, 7, 6, 6, 6, 6, 4, 4, 2, 1 },
+ { 8, 8, 7, 7, 7, 7, 7, 6, 6, 6, 6, 6, 4, 4, 2, 1 },
+ { 8, 8, 7, 7, 7, 7, 7, 6, 6, 6, 6, 6, 4, 4, 2, 1 },
+ { 8, 8, 7, 7, 7, 7, 7, 6, 6, 6, 6, 6, 4, 4, 2, 1 },
+ { 9, 9, 8, 7, 7, 7, 6, 6, 6, 6, 6, 6, 3, 3, 3, 1 },
+ { 9, 9, 8, 7, 7, 7, 6, 6, 6, 6, 6, 6, 3, 3, 3, 1 },
+ { 9, 9, 8, 7, 7, 7, 6, 6, 6, 6, 6, 6, 3, 3, 3, 1 },
+ { 9, 9, 8, 7, 7, 7, 6, 6, 6, 6, 6, 6, 3, 3, 3, 1 },
+};
+
+static const uint16_t ac_vlc_desc0_syms[172] = {
+ 0x1000, 0xFF8, 0xFF6, 0xFF5, 0xFF4, 0xFF3, 0xFF2, 0xFF1,
+ 0xFF0, 0xFE6, 0xFE5, 0xFE4, 0xFE3, 0xFE2, 0xFE1, 0xFE0,
+ 0xFD6, 0xFD5, 0xFD3, 0xFD2, 0xFD1, 0xFD0, 0xFC6, 0xFC5,
+ 0xFC3, 0xFC2, 0xFC1, 0xFC0, 0xFB5, 0xFB3, 0xFB2, 0xFB1,
+ 0xFB0, 0xFA5, 0xFA3, 0xFA1, 0xFA0, 0xF95, 0xF91, 0xF90,
+ 0xF83, 0xF81, 0xF80, 0xF73, 0xF71, 0xF70, 0xF61, 0xF60,
+ 0xF51, 0xF50, 0xF45, 0xF41, 0xF40, 0xF31, 0xF30, 0xF21,
+ 0xF20, 0xF10, 0xF00, 0xEF0, 0xEE0, 0xED5, 0xED1, 0xED0,
+ 0xEC0, 0xEB0, 0xEA0, 0xE90, 0xE80, 0xE70, 0xE60, 0xE50,
+ 0xE40, 0xE30, 0xE20, 0xE10, 0xE00, 0xDF0, 0xDE0, 0xDD0,
+ 0xDC0, 0xDB0, 0xDA0, 0xD90, 0xD80, 0xD60, 0xCD1, 0x280,
+ 0x270, 0x260, 0x250, 0x240, 0x230, 0x220, 0x210, 0x200,
+ 0x1F0, 0x1E0, 0x1D0, 0x1C0, 0x1B0, 0x1A1, 0x1A0, 0x190,
+ 0x180, 0x170, 0x160, 0x150, 0x140, 0x130, 0x121, 0x120,
+ 0x111, 0x110, 0x101, 0x100, 0x0F1, 0x0F0, 0x0E1, 0x0E0,
+ 0x0D1, 0x0D0, 0x0C1, 0x0C0, 0x0B1, 0x0B0, 0x0A5, 0x0A1,
+ 0x0A0, 0x091, 0x090, 0x081, 0x080, 0x075, 0x071, 0x070,
+ 0x065, 0x063, 0x061, 0x060, 0x055, 0x053, 0x052, 0x051,
+ 0x050, 0x046, 0x045, 0x043, 0x042, 0x041, 0x040, 0x036,
+ 0x035, 0x033, 0x032, 0x031, 0x030, 0x026, 0x025, 0x024,
+ 0x023, 0x022, 0x021, 0x020, 0x018, 0x016, 0x015, 0x014,
+ 0x013, 0x012, 0x011, 0x010,
+};
+
+static const uint16_t ac_vlc_desc0_codes[172] = {
+ 0x001F, 0x0D71, 0x013F, 0x006C, 0x00A7, 0x0067, 0x001C, 0x0008,
+ 0x0005, 0x06F1, 0x002C, 0x04BA, 0x0072, 0x01AA, 0x0002, 0x0006,
+ 0x06AC, 0x02AF, 0x06EF, 0x018F, 0x000A, 0x0009, 0x02AC, 0x042A,
+ 0x06E1, 0x068F, 0x00B1, 0x0000, 0x0317, 0x0C17, 0x0612, 0x010F,
+ 0x0011, 0x0FBA, 0x002A, 0x0172, 0x000C, 0x05AC, 0x03D7, 0x0037,
+ 0x0E8F, 0x02F2, 0x0041, 0x0BE1, 0x057F, 0x004A, 0x00AF, 0x006F,
+ 0x06AA, 0x0097, 0x0101, 0x0012, 0x0081, 0x0571, 0x0092, 0x0EAF,
+ 0x01BF, 0x00D7, 0x0031, 0x0001, 0x01F2, 0x0F17, 0x053A, 0x00BF,
+ 0x038F, 0x0217, 0x0371, 0x01F1, 0x01BA, 0x022A, 0x02BF, 0x028F,
+ 0x008F, 0x03F1, 0x00E1, 0x00BA, 0x00F2, 0x0EBF, 0x06AF, 0x048F,
+ 0x0FE1, 0x0271, 0x07BA, 0x0D3A, 0x0C12, 0x08AC, 0x0717, 0x00AC,
+ 0x0412, 0x0901, 0x04E1, 0x07E1, 0x0417, 0x0CAF, 0x04AC, 0x01AC,
+ 0x04F2, 0x03BA, 0x05D7, 0x07F1, 0x01D7, 0x04AF, 0x04EF, 0x03AC,
+ 0x00AA, 0x01E1, 0x0071, 0x00F1, 0x012C, 0x03EF, 0x082A, 0x0112,
+ 0x03E1, 0x01FA, 0x0DAC, 0x0131, 0x0E12, 0x000F, 0x0B17, 0x007F,
+ 0x0AEF, 0x007A, 0x02AA, 0x0061, 0x0671, 0x0027, 0x013A, 0x058F,
+ 0x00FF, 0x033A, 0x0032, 0x0301, 0x0021, 0x0C8F, 0x037F, 0x0077,
+ 0x02F1, 0x02E1, 0x003A, 0x003C, 0x0212, 0x0817, 0x0CE1, 0x003F,
+ 0x0007, 0x0017, 0x0501, 0x02BA, 0x06BF, 0x0057, 0x0010, 0x02EF,
+ 0x0117, 0x017F, 0x00EF, 0x006A, 0x0019, 0x0171, 0x01EF, 0x06BA,
+ 0x012A, 0x00FA, 0x0022, 0x000E, 0x0AE1, 0x01AF, 0x0052, 0x002F,
+ 0x004F, 0x001A, 0x0004, 0x0003,
+};
+
+static const uint8_t ac_vlc_desc0_bits[172] = {
+ 6, 12, 9, 7, 8, 7, 6, 4,
+ 3, 11, 9, 11, 9, 9, 6, 4,
+ 11, 11, 11, 11, 7, 5, 11, 11,
+ 11, 12, 8, 5, 12, 12, 12, 9,
+ 6, 12, 12, 9, 6, 12, 10, 7,
+ 12, 10, 7, 12, 11, 7, 11, 8,
+ 11, 8, 12, 11, 8, 12, 8, 12,
+ 9, 9, 9, 9, 9, 12, 12, 10,
+ 10, 10, 10, 10, 10, 10, 11, 11,
+ 11, 11, 11, 11, 11, 12, 12, 12,
+ 12, 11, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 11, 11,
+ 11, 11, 11, 11, 11, 12, 11, 10,
+ 10, 10, 10, 10, 9, 10, 12, 9,
+ 12, 9, 12, 9, 12, 9, 12, 9,
+ 12, 8, 11, 8, 11, 8, 11, 11,
+ 8, 10, 7, 10, 7, 12, 10, 7,
+ 11, 12, 9, 6, 11, 12, 12, 9,
+ 6, 12, 11, 11, 12, 8, 5, 12,
+ 10, 11, 11, 7, 5, 11, 10, 11,
+ 9, 9, 6, 4, 12, 9, 7, 8,
+ 7, 6, 4, 3,
+};
+
+static const uint16_t ac_vlc_desc1_syms[169] = {
+ 0x1000, 0xFF8, 0xFF6, 0xFF5, 0xFF4, 0xFF3, 0xFF2, 0xFF1,
+ 0xFF0, 0xFE6, 0xFE5, 0xFE4, 0xFE3, 0xFE2, 0xFE1, 0xFE0,
+ 0xFD6, 0xFD5, 0xFD3, 0xFD2, 0xFD1, 0xFD0, 0xFC6, 0xFC5,
+ 0xFC3, 0xFC2, 0xFC1, 0xFC0, 0xFB6, 0xFB5, 0xFB3, 0xFB2,
+ 0xFB1, 0xFB0, 0xFA6, 0xFA5, 0xFA3, 0xFA1, 0xFA0, 0xF95,
+ 0xF93, 0xF91, 0xF90, 0xF85, 0xF81, 0xF80, 0xF71, 0xF70,
+ 0xF61, 0xF60, 0xF51, 0xF50, 0xF45, 0xF41, 0xF40, 0xF31,
+ 0xF30, 0xF21, 0xF20, 0xF11, 0xF10, 0xF01, 0xF00, 0xEF1,
+ 0xEF0, 0xEE1, 0xEE0, 0xED0, 0xEC6, 0xEC0, 0xEB6, 0xEB0,
+ 0xEA0, 0xE90, 0xE80, 0xE70, 0xE60, 0xE50, 0xE40, 0xE33,
+ 0xE31, 0xE30, 0xE20, 0xE10, 0xE00, 0xDF0, 0xDE1, 0xDE0,
+ 0xDC0, 0xDB0, 0xDA0, 0x250, 0x240, 0x1F0, 0x1E0, 0x1D0,
+ 0x1C0, 0x1B0, 0x1A0, 0x190, 0x180, 0x170, 0x160, 0x150,
+ 0x140, 0x130, 0x120, 0x111, 0x110, 0x101, 0x100, 0x0F1,
+ 0x0F0, 0x0E1, 0x0E0, 0x0D1, 0x0D0, 0x0C6, 0x0C1, 0x0C0,
+ 0x0B1, 0x0B0, 0x0A1, 0x0A0, 0x095, 0x091, 0x090, 0x085,
+ 0x081, 0x080, 0x075, 0x071, 0x070, 0x065, 0x063, 0x061,
+ 0x060, 0x055, 0x053, 0x052, 0x051, 0x050, 0x046, 0x045,
+ 0x043, 0x042, 0x041, 0x040, 0x036, 0x035, 0x033, 0x032,
+ 0x031, 0x030, 0x026, 0x025, 0x024, 0x023, 0x022, 0x021,
+ 0x020, 0x018, 0x016, 0x015, 0x014, 0x013, 0x012, 0x011,
+ 0x010,
+};
+
+static const uint16_t ac_vlc_desc1_codes[169] = {
+ 0x0019, 0x027D, 0x0084, 0x0044, 0x009D, 0x003D, 0x000A, 0x0002,
+ 0x0003, 0x00EA, 0x02FD, 0x017A, 0x01C6, 0x00B6, 0x0026, 0x000E,
+ 0x0095, 0x0260, 0x032A, 0x0360, 0x0006, 0x0005, 0x05B6, 0x036A,
+ 0x06F6, 0x0704, 0x00FA, 0x0010, 0x0279, 0x04D4, 0x00F6, 0x066A,
+ 0x001D, 0x0029, 0x05F9, 0x0846, 0x04F6, 0x01D4, 0x0038, 0x0446,
+ 0x0160, 0x031D, 0x0075, 0x0054, 0x02D4, 0x005A, 0x05FD, 0x0040,
+ 0x06EA, 0x0055, 0x0460, 0x009A, 0x052A, 0x00A0, 0x00D8, 0x0380,
+ 0x017D, 0x092A, 0x00F9, 0x0D7A, 0x0179, 0x0304, 0x002A, 0x0104,
+ 0x01A0, 0x0780, 0x007D, 0x03F9, 0x0C46, 0x03EA, 0x0E6A, 0x0204,
+ 0x01FD, 0x051D, 0x02AA, 0x05EA, 0x00AA, 0x0080, 0x067D, 0x09EA,
+ 0x0C95, 0x09F9, 0x07B6, 0x0DB6, 0x012A, 0x0904, 0x0454, 0x0FB6,
+ 0x0960, 0x08D4, 0x0495, 0x0F80, 0x0560, 0x0B04, 0x057A, 0x0079,
+ 0x0795, 0x0E7D, 0x0060, 0x076A, 0x03B6, 0x0395, 0x0180, 0x02A0,
+ 0x006A, 0x0195, 0x0295, 0x0646, 0x03FD, 0x01F9, 0x0154, 0x0DF9,
+ 0x00C6, 0x0F95, 0x01F6, 0x0480, 0x0000, 0x0A79, 0x04AA, 0x00E0,
+ 0x0246, 0x001A, 0x0479, 0x0015, 0x0D60, 0x0280, 0x0018, 0x01EA,
+ 0x037A, 0x003A, 0x011D, 0x00FD, 0x0035, 0x0A7D, 0x04A0, 0x0146,
+ 0x0024, 0x01B6, 0x0504, 0x0046, 0x0020, 0x0009, 0x00D4, 0x03AA,
+ 0x0679, 0x026A, 0x0036, 0x0008, 0x02F6, 0x01AA, 0x016A, 0x0254,
+ 0x0039, 0x000D, 0x0004, 0x0176, 0x02EA, 0x007A, 0x0076, 0x0016,
+ 0x0001, 0x0879, 0x0058, 0x0014, 0x00D5, 0x005D, 0x0034, 0x000C,
+ 0x0007,
+};
+
+static const uint8_t ac_vlc_desc1_bits[169] = {
+ 6, 12, 8, 7, 8, 7, 6, 4,
+ 3, 10, 10, 11, 9, 9, 6, 4,
+ 11, 10, 10, 10, 7, 5, 12, 11,
+ 11, 11, 8, 5, 12, 11, 11, 12,
+ 9, 6, 12, 12, 11, 9, 6, 12,
+ 12, 10, 7, 11, 10, 7, 11, 7,
+ 11, 8, 11, 8, 11, 11, 8, 11,
+ 9, 12, 9, 12, 9, 12, 9, 12,
+ 9, 12, 10, 10, 12, 10, 12, 10,
+ 11, 11, 10, 11, 11, 11, 12, 12,
+ 12, 12, 12, 12, 12, 12, 11, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 11, 11, 11, 11, 10, 10,
+ 10, 10, 10, 11, 10, 12, 9, 12,
+ 9, 12, 9, 11, 8, 12, 11, 8,
+ 11, 8, 11, 8, 12, 10, 7, 12,
+ 10, 7, 11, 10, 7, 12, 11, 9,
+ 6, 11, 11, 12, 8, 6, 12, 10,
+ 11, 11, 8, 5, 11, 10, 10, 10,
+ 7, 5, 10, 9, 11, 9, 9, 6,
+ 4, 12, 8, 7, 8, 7, 6, 4,
+ 3,
+};
+
+static const uint16_t ac_vlc_desc2_syms[165] = {
+ 0x1000, 0xFF8, 0xFF7, 0xFF6, 0xFF5, 0xFF4, 0xFF3, 0xFF2,
+ 0xFF1, 0xFF0, 0xFE6, 0xFE5, 0xFE4, 0xFE3, 0xFE2, 0xFE1,
+ 0xFE0, 0xFD6, 0xFD5, 0xFD3, 0xFD2, 0xFD1, 0xFD0, 0xFC6,
+ 0xFC5, 0xFC3, 0xFC2, 0xFC1, 0xFC0, 0xFB6, 0xFB5, 0xFB3,
+ 0xFB2, 0xFB1, 0xFB0, 0xFA5, 0xFA3, 0xFA1, 0xFA0, 0xF95,
+ 0xF93, 0xF91, 0xF90, 0xF81, 0xF80, 0xF75, 0xF71, 0xF70,
+ 0xF61, 0xF60, 0xF51, 0xF50, 0xF41, 0xF40, 0xF36, 0xF31,
+ 0xF30, 0xF26, 0xF21, 0xF20, 0xF16, 0xF11, 0xF10, 0xF06,
+ 0xF01, 0xF00, 0xEF1, 0xEF0, 0xEE1, 0xEE0, 0xED0, 0xEC0,
+ 0xEB3, 0xEB1, 0xEB0, 0xEA3, 0xEA1, 0xEA0, 0xE90, 0xE81,
+ 0xE80, 0xE71, 0xE70, 0xE61, 0xE60, 0xE50, 0xE40, 0xE30,
+ 0xE10, 0xE00, 0x241, 0x240, 0x231, 0x1D0, 0x1C0, 0x1B3,
+ 0x1B0, 0x1A0, 0x190, 0x180, 0x170, 0x160, 0x150, 0x140,
+ 0x130, 0x120, 0x110, 0x100, 0x0F0, 0x0E0, 0x0D1, 0x0D0,
+ 0x0C1, 0x0C0, 0x0B1, 0x0B0, 0x0A5, 0x0A1, 0x0A0, 0x096,
+ 0x095, 0x091, 0x090, 0x086, 0x085, 0x081, 0x080, 0x075,
+ 0x071, 0x070, 0x065, 0x063, 0x061, 0x060, 0x055, 0x053,
+ 0x052, 0x051, 0x050, 0x045, 0x043, 0x042, 0x041, 0x040,
+ 0x036, 0x035, 0x033, 0x032, 0x031, 0x030, 0x026, 0x025,
+ 0x024, 0x023, 0x022, 0x021, 0x020, 0x018, 0x016, 0x015,
+ 0x014, 0x013, 0x012, 0x011, 0x010,
+};
+
+static const uint16_t ac_vlc_desc2_codes[165] = {
+ 0x0034, 0x059C, 0x0280, 0x001C, 0x004C, 0x00BD, 0x0020, 0x003C,
+ 0x000A, 0x0003, 0x00FD, 0x008C, 0x0332, 0x01D5, 0x0055, 0x003E,
+ 0x0001, 0x07E4, 0x0264, 0x00B2, 0x00A2, 0x005C, 0x0005, 0x02A2,
+ 0x011D, 0x0132, 0x076C, 0x0012, 0x0018, 0x01E4, 0x05E4, 0x02B2,
+ 0x0432, 0x017D, 0x000E, 0x055D, 0x0955, 0x0164, 0x0028, 0x0D62,
+ 0x0B24, 0x02DE, 0x001E, 0x0340, 0x0014, 0x0555, 0x0180, 0x00DD,
+ 0x01B2, 0x0092, 0x036C, 0x00EC, 0x00E4, 0x00C0, 0x0C64, 0x095D,
+ 0x01DE, 0x0AE4, 0x0C32, 0x01A2, 0x06E4, 0x0832, 0x01A4, 0x015D,
+ 0x0732, 0x031D, 0x0F9C, 0x03E2, 0x09E2, 0x02FD, 0x0224, 0x051D,
+ 0x02E4, 0x019C, 0x05B2, 0x0355, 0x0064, 0x016C, 0x038C, 0x0880,
+ 0x0480, 0x06B2, 0x0540, 0x0080, 0x075D, 0x0155, 0x0424, 0x0680,
+ 0x0A62, 0x0A80, 0x078C, 0x0D9C, 0x0F8C, 0x0562, 0x0FF2, 0x0464,
+ 0x0B55, 0x01E2, 0x0032, 0x07F2, 0x0140, 0x03E4, 0x0662, 0x0755,
+ 0x0380, 0x026C, 0x0232, 0x001D, 0x0040, 0x00E2, 0x035D, 0x00F2,
+ 0x0162, 0x01FD, 0x03F2, 0x000C, 0x0EA2, 0x05F2, 0x0072, 0x04E4,
+ 0x0F32, 0x018C, 0x009D, 0x0324, 0x079C, 0x006C, 0x0054, 0x0F5D,
+ 0x021D, 0x0015, 0x0024, 0x06A2, 0x009C, 0x0004, 0x0062, 0x056C,
+ 0x0262, 0x0000, 0x002E, 0x01F2, 0x0124, 0x039C, 0x005E, 0x0010,
+ 0x0724, 0x00A4, 0x00DE, 0x0362, 0x0052, 0x000D, 0x03B2, 0x007D,
+ 0x05E2, 0x00D5, 0x005D, 0x0035, 0x0009, 0x099C, 0x0022, 0x002C,
+ 0x003D, 0x0008, 0x0002, 0x0006, 0x0007,
+};
+
+static const uint8_t ac_vlc_desc2_bits[165] = {
+ 6, 12, 12, 8, 7, 8, 6, 6,
+ 4, 3, 10, 9, 11, 9, 9, 6,
+ 4, 11, 10, 10, 10, 7, 5, 11,
+ 11, 10, 11, 8, 5, 11, 11, 11,
+ 12, 9, 6, 11, 12, 9, 6, 12,
+ 12, 10, 7, 10, 7, 11, 10, 8,
+ 11, 8, 11, 8, 11, 8, 12, 12,
+ 9, 12, 12, 9, 11, 12, 9, 12,
+ 12, 10, 12, 10, 12, 10, 10, 11,
+ 12, 12, 11, 12, 11, 11, 11, 12,
+ 11, 11, 11, 12, 12, 12, 11, 11,
+ 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 11, 11, 11, 11,
+ 10, 10, 10, 10, 9, 9, 11, 9,
+ 11, 9, 11, 8, 12, 11, 8, 11,
+ 12, 10, 8, 12, 12, 10, 7, 12,
+ 10, 7, 11, 12, 9, 6, 10, 11,
+ 12, 8, 6, 11, 10, 11, 8, 5,
+ 11, 9, 10, 10, 7, 5, 10, 9,
+ 11, 9, 9, 6, 4, 12, 8, 7,
+ 8, 6, 6, 4, 3,
+};
+
+static const uint16_t ac_vlc_desc3_syms[162] = {
+ 0x1000, 0xFF8, 0xFF7, 0xFF6, 0xFF5, 0xFF4, 0xFF3, 0xFF2,
+ 0xFF1, 0xFF0, 0xFE6, 0xFE5, 0xFE4, 0xFE3, 0xFE2, 0xFE1,
+ 0xFE0, 0xFD6, 0xFD5, 0xFD4, 0xFD3, 0xFD2, 0xFD1, 0xFD0,
+ 0xFC6, 0xFC5, 0xFC3, 0xFC2, 0xFC1, 0xFC0, 0xFB5, 0xFB3,
+ 0xFB2, 0xFB1, 0xFB0, 0xFA5, 0xFA3, 0xFA1, 0xFA0, 0xF95,
+ 0xF93, 0xF91, 0xF90, 0xF85, 0xF83, 0xF81, 0xF80, 0xF71,
+ 0xF70, 0xF66, 0xF61, 0xF60, 0xF56, 0xF51, 0xF50, 0xF46,
+ 0xF41, 0xF40, 0xF36, 0xF31, 0xF30, 0xF26, 0xF21, 0xF20,
+ 0xF11, 0xF10, 0xF01, 0xF00, 0xEF3, 0xEF1, 0xEF0, 0xEE3,
+ 0xEE1, 0xEE0, 0xED3, 0xED1, 0xED0, 0xEC1, 0xEC0, 0xEB1,
+ 0xEB0, 0xEA0, 0xE90, 0xE80, 0xE70, 0x1E1, 0x1D1, 0x1D0,
+ 0x1C1, 0x1B1, 0x1A1, 0x180, 0x170, 0x163, 0x160, 0x150,
+ 0x140, 0x130, 0x123, 0x120, 0x113, 0x110, 0x100, 0x0F0,
+ 0x0E0, 0x0D1, 0x0D0, 0x0C1, 0x0C0, 0x0B1, 0x0B0, 0x0A1,
+ 0x0A0, 0x095, 0x091, 0x090, 0x085, 0x081, 0x080, 0x076,
+ 0x075, 0x073, 0x071, 0x070, 0x066, 0x065, 0x063, 0x061,
+ 0x060, 0x055, 0x053, 0x052, 0x051, 0x050, 0x045, 0x043,
+ 0x042, 0x041, 0x040, 0x036, 0x035, 0x034, 0x033, 0x032,
+ 0x031, 0x030, 0x026, 0x025, 0x024, 0x023, 0x022, 0x021,
+ 0x020, 0x018, 0x017, 0x016, 0x015, 0x014, 0x013, 0x012,
+ 0x011, 0x010,
+};
+
+static const uint16_t ac_vlc_desc3_codes[162] = {
+ 0x001D, 0x087C, 0x0AE8, 0x003A, 0x001C, 0x0008, 0x000C, 0x0032,
+ 0x0006, 0x0003, 0x03A5, 0x01EC, 0x01A5, 0x0080, 0x0030, 0x0005,
+ 0x0001, 0x0040, 0x03FC, 0x02D4, 0x0154, 0x02FC, 0x003C, 0x0015,
+ 0x051A, 0x0000, 0x02EC, 0x077C, 0x00D2, 0x0018, 0x03E8, 0x04EC,
+ 0x027C, 0x01FA, 0x0022, 0x0765, 0x0EA5, 0x0054, 0x0010, 0x08EC,
+ 0x0AAC, 0x03BA, 0x0042, 0x065D, 0x0AD4, 0x005C, 0x0028, 0x03C0,
+ 0x00E5, 0x035C, 0x04FA, 0x00DC, 0x06A5, 0x075C, 0x00C8, 0x05A5,
+ 0x04D4, 0x00BA, 0x01C0, 0x05E8, 0x012C, 0x00E8, 0x01B0, 0x00B0,
+ 0x025D, 0x002C, 0x0A52, 0x025C, 0x01E8, 0x00FA, 0x0348, 0x0652,
+ 0x0B7C, 0x0365, 0x031A, 0x0E52, 0x011A, 0x0200, 0x01BA, 0x02AC,
+ 0x06D4, 0x01FC, 0x05BA, 0x0DFC, 0x0248, 0x0EE8, 0x0B1A, 0x0CFC,
+ 0x0F65, 0x0B5C, 0x0DC0, 0x007C, 0x0548, 0x08A5, 0x00FC, 0x03B0,
+ 0x0148, 0x06AC, 0x0252, 0x071A, 0x02E8, 0x0240, 0x00AC, 0x021A,
+ 0x0140, 0x08E8, 0x01AC, 0x00EC, 0x0152, 0x00A5, 0x0068, 0x001A,
+ 0x006C, 0x05C0, 0x015C, 0x0025, 0x05B0, 0x017C, 0x0014, 0x047C,
+ 0x00D4, 0x06E8, 0x00C0, 0x0002, 0x0A5D, 0x04E8, 0x0A7C, 0x01D4,
+ 0x0020, 0x04A5, 0x07B0, 0x037C, 0x015D, 0x002A, 0x005D, 0x0048,
+ 0x067C, 0x007A, 0x0004, 0x04FC, 0x02FA, 0x0648, 0x0100, 0x0052,
+ 0x005A, 0x000D, 0x0165, 0x0065, 0x02A5, 0x0070, 0x00F0, 0x003D,
+ 0x0009, 0x05FC, 0x0E48, 0x009A, 0x0012, 0x00DD, 0x0034, 0x000A,
+ 0x000E, 0x0007,
+};
+
+static const uint8_t ac_vlc_desc3_bits[162] = {
+ 7, 12, 12, 8, 7, 7, 6, 6,
+ 4, 3, 10, 9, 11, 8, 8, 6,
+ 4, 10, 10, 12, 9, 10, 7, 5,
+ 11, 10, 10, 11, 8, 5, 10, 11,
+ 12, 9, 6, 12, 12, 9, 6, 12,
+ 12, 10, 7, 11, 12, 10, 7, 10,
+ 8, 12, 11, 8, 12, 11, 8, 11,
+ 11, 9, 11, 11, 9, 12, 11, 9,
+ 12, 9, 12, 10, 11, 11, 10, 12,
+ 12, 11, 12, 12, 11, 10, 11, 12,
+ 11, 11, 11, 12, 11, 12, 12, 12,
+ 12, 12, 12, 12, 11, 12, 11, 11,
+ 11, 11, 12, 11, 12, 10, 10, 10,
+ 9, 12, 9, 12, 9, 12, 8, 10,
+ 8, 12, 10, 8, 11, 10, 7, 11,
+ 11, 12, 9, 7, 12, 11, 12, 9,
+ 6, 11, 11, 12, 9, 6, 10, 10,
+ 11, 8, 5, 12, 10, 12, 9, 10,
+ 7, 5, 10, 9, 11, 8, 8, 6,
+ 4, 12, 12, 8, 7, 8, 6, 6,
+ 4, 3,
+};
+
+static const uint16_t ac_vlc_desc4_syms[131] = {
+ 0x1000, 0xFF6, 0xFF5, 0xFF4, 0xFF3, 0xFF2, 0xFF1, 0xFF0,
+ 0xFE6, 0xFE5, 0xFE4, 0xFE3, 0xFE2, 0xFE1, 0xFE0, 0xFD6,
+ 0xFD5, 0xFD3, 0xFD2, 0xFD1, 0xFD0, 0xFC5, 0xFC3, 0xFC2,
+ 0xFC1, 0xFC0, 0xFB5, 0xFB3, 0xFB1, 0xFB0, 0xFA5, 0xFA3,
+ 0xFA1, 0xFA0, 0xF93, 0xF91, 0xF90, 0xF81, 0xF80, 0xF76,
+ 0xF71, 0xF70, 0xF66, 0xF61, 0xF60, 0xF56, 0xF51, 0xF50,
+ 0xF41, 0xF40, 0xF31, 0xF30, 0xF23, 0xF21, 0xF20, 0xF13,
+ 0xF11, 0xF10, 0xF03, 0xF01, 0xF00, 0xEF1, 0xEF0, 0xEE0,
+ 0xED0, 0xEC0, 0xEB0, 0x191, 0x181, 0x180, 0x171, 0x161,
+ 0x140, 0x130, 0x123, 0x120, 0x110, 0x100, 0x0F3, 0x0F0,
+ 0x0E0, 0x0D0, 0x0C0, 0x0B1, 0x0B0, 0x0A1, 0x0A0, 0x091,
+ 0x090, 0x085, 0x081, 0x080, 0x075, 0x071, 0x070, 0x066,
+ 0x065, 0x063, 0x061, 0x060, 0x056, 0x055, 0x053, 0x051,
+ 0x050, 0x045, 0x043, 0x042, 0x041, 0x040, 0x036, 0x035,
+ 0x033, 0x032, 0x031, 0x030, 0x026, 0x025, 0x024, 0x023,
+ 0x022, 0x021, 0x020, 0x018, 0x016, 0x015, 0x014, 0x013,
+ 0x012, 0x011, 0x010,
+};
+
+static const uint16_t ac_vlc_desc4_codes[131] = {
+ 0x006B, 0x00BE, 0x0052, 0x00F3, 0x005B, 0x003A, 0x0009, 0x0007,
+ 0x00DA, 0x03FB, 0x0123, 0x00B3, 0x01B3, 0x002E, 0x0006, 0x030A,
+ 0x005A, 0x004A, 0x034A, 0x0072, 0x0005, 0x02DA, 0x0173, 0x04FB,
+ 0x0032, 0x0013, 0x039B, 0x0B9B, 0x011E, 0x0002, 0x00FB, 0x021E,
+ 0x009B, 0x007E, 0x0E1A, 0x03CA, 0x007B, 0x02FB, 0x0033, 0x03AB,
+ 0x0463, 0x008A, 0x0773, 0x041E, 0x002B, 0x031B, 0x065A, 0x011A,
+ 0x060A, 0x01DA, 0x0963, 0x0323, 0x0BAB, 0x059E, 0x010A, 0x05AB,
+ 0x0CFB, 0x071B, 0x079E, 0x0F9E, 0x0263, 0x079B, 0x0563, 0x019E,
+ 0x01AB, 0x0E63, 0x029B, 0x04CA, 0x0DAB, 0x0663, 0x0B1B, 0x020A,
+ 0x0A1E, 0x021A, 0x0063, 0x061E, 0x06FB, 0x025A, 0x0163, 0x0573,
+ 0x000A, 0x0223, 0x011B, 0x0C1A, 0x015A, 0x0863, 0x00AB, 0x02CA,
+ 0x00B2, 0x0A0A, 0x01CA, 0x00A3, 0x0B73, 0x0023, 0x0012, 0x039E,
+ 0x001A, 0x0CCA, 0x01FB, 0x005E, 0x0A9B, 0x00CA, 0x0373, 0x009E,
+ 0x0022, 0x07AB, 0x001E, 0x0EFB, 0x009A, 0x000B, 0x041A, 0x019B,
+ 0x0363, 0x014A, 0x006A, 0x0015, 0x069B, 0x0073, 0x0523, 0x001B,
+ 0x012B, 0x0003, 0x0001, 0x061A, 0x003E, 0x002A, 0x00E3, 0x003B,
+ 0x000E, 0x000D, 0x0000,
+};
+
+static const uint8_t ac_vlc_desc4_bits[131] = {
+ 7, 8, 7, 8, 7, 6, 4, 3,
+ 10, 10, 11, 9, 9, 6, 4, 10,
+ 10, 9, 10, 7, 5, 10, 11, 12,
+ 8, 6, 12, 12, 9, 6, 11, 12,
+ 10, 7, 12, 10, 8, 11, 8, 12,
+ 11, 8, 11, 11, 9, 12, 11, 9,
+ 11, 9, 12, 10, 12, 11, 10, 12,
+ 12, 11, 12, 12, 11, 11, 11, 11,
+ 11, 12, 12, 12, 12, 12, 12, 12,
+ 12, 11, 12, 11, 12, 11, 12, 11,
+ 10, 10, 10, 12, 9, 12, 9, 10,
+ 8, 12, 10, 8, 12, 10, 7, 11,
+ 11, 12, 10, 7, 12, 11, 12, 9,
+ 6, 11, 11, 12, 8, 6, 12, 10,
+ 10, 10, 7, 5, 11, 9, 11, 9,
+ 9, 6, 4, 12, 8, 7, 8, 7,
+ 6, 4, 2,
+};
+
+static const uint16_t ac_vlc_desc5_syms[132] = {
+ 0x1000, 0xFF8, 0xFF6, 0xFF5, 0xFF4, 0xFF3, 0xFF2, 0xFF1,
+ 0xFF0, 0xFE6, 0xFE5, 0xFE4, 0xFE3, 0xFE2, 0xFE1, 0xFE0,
+ 0xFD6, 0xFD5, 0xFD4, 0xFD3, 0xFD2, 0xFD1, 0xFD0, 0xFC5,
+ 0xFC3, 0xFC2, 0xFC1, 0xFC0, 0xFB5, 0xFB3, 0xFB1, 0xFB0,
+ 0xFA3, 0xFA1, 0xFA0, 0xF96, 0xF93, 0xF91, 0xF90, 0xF86,
+ 0xF85, 0xF81, 0xF80, 0xF76, 0xF75, 0xF71, 0xF70, 0xF66,
+ 0xF61, 0xF60, 0xF51, 0xF50, 0xF43, 0xF41, 0xF40, 0xF33,
+ 0xF31, 0xF30, 0xF23, 0xF21, 0xF20, 0xF11, 0xF10, 0xF00,
+ 0xEF0, 0xEE0, 0xEC1, 0xEC0, 0x151, 0x141, 0x140, 0x131,
+ 0x121, 0x120, 0x111, 0x110, 0x103, 0x100, 0x0F0, 0x0E0,
+ 0x0D3, 0x0D0, 0x0C3, 0x0C1, 0x0C0, 0x0B1, 0x0B0, 0x0A1,
+ 0x0A0, 0x091, 0x090, 0x081, 0x080, 0x075, 0x071, 0x070,
+ 0x065, 0x061, 0x060, 0x056, 0x055, 0x053, 0x052, 0x051,
+ 0x050, 0x046, 0x045, 0x043, 0x042, 0x041, 0x040, 0x035,
+ 0x034, 0x033, 0x032, 0x031, 0x030, 0x026, 0x025, 0x024,
+ 0x023, 0x022, 0x021, 0x020, 0x018, 0x016, 0x015, 0x014,
+ 0x013, 0x012, 0x011, 0x010,
+};
+
+static const uint16_t ac_vlc_desc5_codes[132] = {
+ 0x0001, 0x0D62, 0x00BD, 0x0022, 0x009B, 0x0032, 0x0019, 0x0005,
+ 0x0007, 0x034D, 0x009A, 0x012B, 0x0052, 0x006B, 0x003A, 0x0006,
+ 0x06FD, 0x017D, 0x081A, 0x031B, 0x031A, 0x0012, 0x0011, 0x0202,
+ 0x00FD, 0x051B, 0x00D2, 0x001D, 0x011A, 0x0782, 0x018D, 0x007B,
+ 0x067D, 0x037D, 0x0021, 0x0E8D, 0x0562, 0x008D, 0x00BB, 0x053D,
+ 0x082A, 0x0002, 0x000D, 0x0302, 0x007D, 0x053B, 0x003B, 0x0A4D,
+ 0x027D, 0x01FD, 0x042A, 0x01C2, 0x041A, 0x0182, 0x014D, 0x0162,
+ 0x00C2, 0x032A, 0x0D9A, 0x012A, 0x0102, 0x087D, 0x072B, 0x039A,
+ 0x0362, 0x019A, 0x0C62, 0x04C2, 0x0D1B, 0x028D, 0x0762, 0x0E7D,
+ 0x0E41, 0x059A, 0x024D, 0x093B, 0x052B, 0x011B, 0x064D, 0x013D,
+ 0x0382, 0x0262, 0x0641, 0x0462, 0x004D, 0x0CC2, 0x033B, 0x068D,
+ 0x0141, 0x0D2B, 0x001B, 0x0041, 0x00C1, 0x0C41, 0x01E2, 0x00EB,
+ 0x062A, 0x0082, 0x0061, 0x02FD, 0x047D, 0x013B, 0x002A, 0x003D,
+ 0x005B, 0x022A, 0x02C2, 0x0241, 0x0062, 0x00AA, 0x000B, 0x00E2,
+ 0x001A, 0x033D, 0x021A, 0x006A, 0x0009, 0x032B, 0x002B, 0x04FD,
+ 0x0042, 0x016B, 0x002D, 0x000E, 0x0441, 0x00CD, 0x005A, 0x00AB,
+ 0x000A, 0x0039, 0x0003, 0x0000,
+};
+
+static const uint8_t ac_vlc_desc5_bits[132] = {
+ 7, 12, 8, 7, 8, 6, 6, 4,
+ 3, 10, 9, 11, 8, 9, 6, 4,
+ 11, 10, 12, 10, 10, 7, 5, 10,
+ 11, 12, 8, 6, 10, 11, 9, 7,
+ 12, 10, 7, 12, 12, 10, 8, 11,
+ 12, 10, 8, 10, 12, 11, 9, 12,
+ 11, 9, 11, 9, 11, 10, 10, 11,
+ 11, 10, 12, 10, 10, 12, 11, 10,
+ 11, 11, 12, 12, 12, 11, 11, 12,
+ 12, 12, 12, 12, 12, 11, 11, 11,
+ 11, 10, 12, 12, 10, 12, 10, 12,
+ 9, 12, 9, 11, 8, 12, 9, 8,
+ 11, 9, 7, 11, 11, 12, 12, 9,
+ 7, 11, 10, 11, 11, 8, 6, 9,
+ 12, 10, 10, 7, 5, 11, 9, 11,
+ 8, 9, 6, 4, 12, 8, 7, 8,
+ 6, 6, 4, 2,
+};
+
+static const uint16_t ac_vlc_desc6_syms[130] = {
+ 0x1000, 0xFF8, 0xFF7, 0xFF6, 0xFF5, 0xFF4, 0xFF3, 0xFF2,
+ 0xFF1, 0xFF0, 0xFE6, 0xFE5, 0xFE4, 0xFE3, 0xFE2, 0xFE1,
+ 0xFE0, 0xFD6, 0xFD5, 0xFD4, 0xFD3, 0xFD2, 0xFD1, 0xFD0,
+ 0xFC5, 0xFC3, 0xFC2, 0xFC1, 0xFC0, 0xFB5, 0xFB3, 0xFB1,
+ 0xFB0, 0xFA6, 0xFA3, 0xFA1, 0xFA0, 0xF96, 0xF95, 0xF93,
+ 0xF91, 0xF90, 0xF86, 0xF85, 0xF81, 0xF80, 0xF76, 0xF71,
+ 0xF70, 0xF63, 0xF61, 0xF60, 0xF53, 0xF51, 0xF50, 0xF43,
+ 0xF41, 0xF40, 0xF31, 0xF30, 0xF20, 0xF10, 0xF00, 0xEF0,
+ 0xEE1, 0x131, 0x121, 0x120, 0x111, 0x110, 0x101, 0x100,
+ 0x0F1, 0x0F0, 0x0E3, 0x0E1, 0x0E0, 0x0D1, 0x0D0, 0x0C3,
+ 0x0C0, 0x0B3, 0x0B1, 0x0B0, 0x0A1, 0x0A0, 0x091, 0x090,
+ 0x081, 0x080, 0x075, 0x071, 0x070, 0x065, 0x063, 0x061,
+ 0x060, 0x056, 0x055, 0x053, 0x051, 0x050, 0x046, 0x045,
+ 0x043, 0x042, 0x041, 0x040, 0x036, 0x035, 0x034, 0x033,
+ 0x032, 0x031, 0x030, 0x026, 0x025, 0x024, 0x023, 0x022,
+ 0x021, 0x020, 0x018, 0x016, 0x015, 0x014, 0x013, 0x012,
+ 0x011, 0x010,
+};
+
+static const uint16_t ac_vlc_desc6_codes[130] = {
+ 0x0022, 0x0BB2, 0x0942, 0x002B, 0x0072, 0x0002, 0x001A, 0x0039,
+ 0x000D, 0x0007, 0x007B, 0x008E, 0x06DB, 0x00EA, 0x015B, 0x002E,
+ 0x0006, 0x0959, 0x027B, 0x0A0E, 0x01AB, 0x008A, 0x0012, 0x001E,
+ 0x0575, 0x005B, 0x02AB, 0x00C2, 0x0015, 0x036A, 0x04B2, 0x0099,
+ 0x001B, 0x0519, 0x0C19, 0x00DB, 0x004E, 0x0042, 0x0159, 0x03B2,
+ 0x030E, 0x00EB, 0x0252, 0x0EAB, 0x018A, 0x00E2, 0x06AB, 0x0242,
+ 0x017B, 0x0452, 0x0319, 0x0152, 0x025B, 0x016A, 0x00AB, 0x0052,
+ 0x05B2, 0x010E, 0x038E, 0x028A, 0x0359, 0x0019, 0x078A, 0x0C52,
+ 0x0D8E, 0x0ED9, 0x02D9, 0x0662, 0x0119, 0x09B2, 0x0BAB, 0x0D19,
+ 0x0C5B, 0x00B2, 0x0542, 0x0B8A, 0x02B2, 0x0142, 0x065B, 0x058E,
+ 0x0062, 0x018E, 0x038A, 0x00D9, 0x0419, 0x0162, 0x03AB, 0x0075,
+ 0x07B2, 0x0032, 0x020E, 0x07AB, 0x006B, 0x045B, 0x01B2, 0x0199,
+ 0x002A, 0x0375, 0x0775, 0x0AAB, 0x01D9, 0x003B, 0x060E, 0x0342,
+ 0x0175, 0x0262, 0x000A, 0x0005, 0x0559, 0x006A, 0x0D59, 0x0219,
+ 0x000E, 0x004A, 0x0009, 0x0719, 0x0059, 0x02DB, 0x00D2, 0x01DB,
+ 0x0025, 0x0001, 0x06D9, 0x00F5, 0x0035, 0x00FB, 0x003A, 0x000B,
+ 0x0003, 0x0000,
+};
+
+static const uint8_t ac_vlc_desc6_bits[130] = {
+ 7, 12, 12, 8, 7, 7, 6, 6,
+ 4, 3, 10, 9, 11, 8, 9, 6,
+ 4, 12, 10, 12, 10, 10, 7, 5,
+ 11, 11, 12, 8, 6, 10, 11, 9,
+ 7, 12, 12, 10, 7, 10, 12, 12,
+ 10, 8, 10, 12, 10, 8, 12, 10,
+ 9, 12, 11, 9, 11, 10, 10, 11,
+ 11, 10, 10, 10, 10, 11, 11, 12,
+ 12, 12, 11, 11, 11, 12, 12, 12,
+ 12, 11, 11, 12, 10, 12, 11, 12,
+ 10, 11, 12, 10, 12, 9, 12, 9,
+ 11, 8, 12, 11, 8, 12, 12, 9,
+ 7, 11, 11, 12, 9, 7, 11, 10,
+ 11, 11, 8, 6, 12, 9, 12, 10,
+ 10, 7, 5, 11, 9, 11, 8, 9,
+ 6, 4, 12, 8, 7, 8, 6, 6,
+ 4, 2,
+};
+
+static const uint16_t ac_vlc_desc7_syms[125] = {
+ 0x1000, 0xFF8, 0xFF7, 0xFF6, 0xFF5, 0xFF4, 0xFF3, 0xFF2,
+ 0xFF1, 0xFF0, 0xFE6, 0xFE5, 0xFE4, 0xFE3, 0xFE2, 0xFE1,
+ 0xFE0, 0xFD5, 0xFD4, 0xFD3, 0xFD2, 0xFD1, 0xFD0, 0xFC5,
+ 0xFC3, 0xFC2, 0xFC1, 0xFC0, 0xFB5, 0xFB3, 0xFB1, 0xFB0,
+ 0xFA6, 0xFA5, 0xFA3, 0xFA1, 0xFA0, 0xF96, 0xF95, 0xF93,
+ 0xF91, 0xF90, 0xF86, 0xF81, 0xF80, 0xF73, 0xF71, 0xF70,
+ 0xF63, 0xF61, 0xF60, 0xF53, 0xF51, 0xF50, 0xF41, 0xF40,
+ 0xF31, 0xF30, 0xF20, 0xF10, 0xF01, 0xF00, 0x121, 0x111,
+ 0x101, 0x100, 0x0F1, 0x0F0, 0x0E1, 0x0E0, 0x0D1, 0x0D0,
+ 0x0C3, 0x0C1, 0x0C0, 0x0B1, 0x0B0, 0x0A3, 0x0A1, 0x0A0,
+ 0x093, 0x091, 0x090, 0x081, 0x080, 0x071, 0x070, 0x065,
+ 0x063, 0x061, 0x060, 0x055, 0x053, 0x052, 0x051, 0x050,
+ 0x046, 0x045, 0x043, 0x042, 0x041, 0x040, 0x036, 0x035,
+ 0x034, 0x033, 0x032, 0x031, 0x030, 0x026, 0x025, 0x024,
+ 0x023, 0x022, 0x021, 0x020, 0x018, 0x017, 0x016, 0x015,
+ 0x014, 0x013, 0x012, 0x011, 0x010,
+};
+
+static const uint16_t ac_vlc_desc7_codes[125] = {
+ 0x0053, 0x009A, 0x0EE2, 0x00D3, 0x006A, 0x0052, 0x003A, 0x0035,
+ 0x000D, 0x0007, 0x0062, 0x0125, 0x0142, 0x0019, 0x01F3, 0x0029,
+ 0x000E, 0x0082, 0x0ADA, 0x02E3, 0x00E2, 0x0022, 0x0006, 0x0065,
+ 0x05E3, 0x0765, 0x0032, 0x0039, 0x0F99, 0x05E2, 0x0099, 0x0033,
+ 0x0362, 0x0799, 0x0F65, 0x0073, 0x004A, 0x02A5, 0x0162, 0x0742,
+ 0x01A5, 0x00D9, 0x0342, 0x005A, 0x00AA, 0x0EF3, 0x0182, 0x01DA,
+ 0x0382, 0x035A, 0x00F3, 0x0673, 0x0165, 0x00E5, 0x06F3, 0x0225,
+ 0x0842, 0x025A, 0x07E3, 0x0399, 0x07A5, 0x072A, 0x0F2A, 0x09E3,
+ 0x0273, 0x049A, 0x02E5, 0x0B99, 0x02E2, 0x0E73, 0x0562, 0x02F3,
+ 0x032A, 0x0F42, 0x00DA, 0x0999, 0x012A, 0x0365, 0x00A5, 0x00E3,
+ 0x0199, 0x03E3, 0x019A, 0x01E2, 0x0173, 0x06E5, 0x0059, 0x01E3,
+ 0x02DA, 0x002A, 0x000A, 0x06DA, 0x0FA5, 0x0042, 0x01E5, 0x0013,
+ 0x03E2, 0x015A, 0x03A5, 0x0442, 0x001A, 0x0005, 0x04A5, 0x0265,
+ 0x08A5, 0x0025, 0x029A, 0x0072, 0x0016, 0x0599, 0x00C2, 0x0242,
+ 0x00B2, 0x0002, 0x0015, 0x0001, 0x0BE3, 0x06E2, 0x0063, 0x0023,
+ 0x0012, 0x0009, 0x0003, 0x000B, 0x0000,
+};
+
+static const uint8_t ac_vlc_desc7_bits[125] = {
+ 8, 11, 12, 8, 7, 7, 6, 6,
+ 4, 3, 9, 9, 10, 8, 9, 6,
+ 4, 9, 12, 10, 10, 7, 5, 10,
+ 11, 12, 8, 6, 12, 11, 9, 7,
+ 10, 12, 12, 10, 7, 10, 11, 12,
+ 10, 8, 11, 10, 8, 12, 10, 9,
+ 10, 10, 10, 12, 10, 10, 12, 10,
+ 12, 10, 11, 12, 12, 12, 12, 12,
+ 11, 11, 11, 12, 11, 12, 11, 11,
+ 11, 12, 10, 12, 10, 11, 12, 10,
+ 12, 12, 9, 11, 9, 11, 8, 12,
+ 12, 9, 7, 11, 12, 12, 9, 7,
+ 10, 10, 11, 11, 8, 6, 11, 10,
+ 12, 10, 10, 7, 5, 11, 8, 10,
+ 8, 8, 6, 4, 12, 12, 8, 7,
+ 7, 6, 6, 4, 2,
+};
+
+static const uint16_t ac_vlc_desc8_syms[121] = {
+ 0x1000, 0xFF8, 0xFF7, 0xFF6, 0xFF5, 0xFF4, 0xFF3, 0xFF2,
+ 0xFF1, 0xFF0, 0xFE6, 0xFE5, 0xFE4, 0xFE3, 0xFE2, 0xFE1,
+ 0xFE0, 0xFD5, 0xFD4, 0xFD3, 0xFD2, 0xFD1, 0xFD0, 0xFC5,
+ 0xFC3, 0xFC2, 0xFC1, 0xFC0, 0xFB6, 0xFB5, 0xFB3, 0xFB1,
+ 0xFB0, 0xFA6, 0xFA5, 0xFA3, 0xFA1, 0xFA0, 0xF96, 0xF95,
+ 0xF93, 0xF91, 0xF90, 0xF86, 0xF83, 0xF81, 0xF80, 0xF73,
+ 0xF71, 0xF70, 0xF63, 0xF61, 0xF60, 0xF51, 0xF50, 0xF41,
+ 0xF40, 0xF30, 0xF21, 0xF20, 0x111, 0x101, 0x0F1, 0x0E1,
+ 0x0E0, 0x0D1, 0x0D0, 0x0C1, 0x0C0, 0x0B3, 0x0B1, 0x0B0,
+ 0x0A3, 0x0A1, 0x0A0, 0x093, 0x091, 0x090, 0x083, 0x081,
+ 0x080, 0x073, 0x071, 0x070, 0x065, 0x063, 0x061, 0x060,
+ 0x055, 0x053, 0x051, 0x050, 0x046, 0x045, 0x043, 0x042,
+ 0x041, 0x040, 0x036, 0x035, 0x034, 0x033, 0x032, 0x031,
+ 0x030, 0x026, 0x025, 0x024, 0x023, 0x022, 0x021, 0x020,
+ 0x018, 0x017, 0x016, 0x015, 0x014, 0x013, 0x012, 0x011,
+ 0x010,
+};
+
+static const uint16_t ac_vlc_desc8_codes[121] = {
+ 0x00F6, 0x0676, 0x0EB6, 0x00F3, 0x0056, 0x006A, 0x0039, 0x0003,
+ 0x000D, 0x0007, 0x00A2, 0x0173, 0x00CA, 0x0025, 0x0082, 0x0019,
+ 0x0001, 0x00B6, 0x0276, 0x02E3, 0x00B2, 0x0062, 0x001A, 0x0175,
+ 0x01E3, 0x0BE5, 0x004A, 0x0029, 0x07A5, 0x00E3, 0x030A, 0x0176,
+ 0x0023, 0x0042, 0x05CA, 0x00A5, 0x0142, 0x0052, 0x04A5, 0x0B02,
+ 0x0D22, 0x0375, 0x0065, 0x0522, 0x0DE3, 0x010A, 0x00F5, 0x0136,
+ 0x0275, 0x01B2, 0x03F5, 0x03E3, 0x0002, 0x08E3, 0x01A2, 0x0B36,
+ 0x020A, 0x0076, 0x0CE3, 0x07E5, 0x070A, 0x03A5, 0x02B6, 0x0036,
+ 0x01E5, 0x02A5, 0x05E3, 0x07B6, 0x07F5, 0x0736, 0x0BA5, 0x0075,
+ 0x0302, 0x0FE5, 0x01B6, 0x0102, 0x04E3, 0x0022, 0x08A5, 0x01CA,
+ 0x00E5, 0x0F0A, 0x05E5, 0x0096, 0x0A76, 0x0336, 0x0236, 0x0012,
+ 0x03B6, 0x0BF5, 0x0073, 0x0035, 0x02B2, 0x000A, 0x0476, 0x0122,
+ 0x0016, 0x0009, 0x0322, 0x01F5, 0x03E5, 0x01A5, 0x03CA, 0x0072,
+ 0x0006, 0x06A5, 0x0032, 0x02CA, 0x008A, 0x00C2, 0x0015, 0x000E,
+ 0x0702, 0x06B6, 0x0063, 0x0033, 0x002A, 0x0005, 0x0013, 0x000B,
+ 0x0000,
+};
+
+static const uint8_t ac_vlc_desc8_bits[121] = {
+ 8, 11, 12, 8, 7, 7, 6, 6,
+ 4, 3, 9, 9, 10, 8, 8, 6,
+ 4, 10, 12, 10, 10, 7, 5, 10,
+ 11, 12, 8, 6, 11, 12, 11, 9,
+ 7, 9, 11, 12, 9, 7, 11, 12,
+ 12, 10, 8, 12, 12, 10, 9, 10,
+ 10, 9, 12, 10, 9, 12, 9, 12,
+ 10, 11, 12, 12, 12, 12, 11, 10,
+ 11, 11, 12, 11, 11, 11, 12, 10,
+ 12, 12, 10, 10, 12, 9, 12, 11,
+ 9, 12, 11, 8, 12, 12, 10, 7,
+ 11, 12, 9, 7, 10, 10, 11, 11,
+ 8, 6, 10, 10, 12, 10, 10, 7,
+ 5, 11, 8, 10, 8, 8, 6, 4,
+ 11, 12, 8, 7, 7, 6, 6, 4,
+ 2,
+};
+
+static const uint16_t ac_vlc_desc9_syms[114] = {
+ 0x1000, 0xFF8, 0xFF7, 0xFF6, 0xFF5, 0xFF4, 0xFF3, 0xFF2,
+ 0xFF1, 0xFF0, 0xFE6, 0xFE5, 0xFE4, 0xFE3, 0xFE2, 0xFE1,
+ 0xFE0, 0xFD5, 0xFD4, 0xFD3, 0xFD2, 0xFD1, 0xFD0, 0xFC5,
+ 0xFC3, 0xFC2, 0xFC1, 0xFC0, 0xFB6, 0xFB5, 0xFB3, 0xFB2,
+ 0xFB1, 0xFB0, 0xFA6, 0xFA5, 0xFA3, 0xFA1, 0xFA0, 0xF96,
+ 0xF93, 0xF91, 0xF90, 0xF83, 0xF81, 0xF80, 0xF73, 0xF71,
+ 0xF70, 0xF61, 0xF60, 0xF51, 0xF50, 0xF40, 0xF31, 0xF30,
+ 0xF21, 0x121, 0x0F1, 0x0E1, 0x0D1, 0x0D0, 0x0C1, 0x0C0,
+ 0x0B1, 0x0B0, 0x0A3, 0x0A1, 0x0A0, 0x093, 0x091, 0x090,
+ 0x083, 0x081, 0x080, 0x073, 0x071, 0x070, 0x065, 0x063,
+ 0x061, 0x060, 0x055, 0x053, 0x051, 0x050, 0x045, 0x043,
+ 0x042, 0x041, 0x040, 0x036, 0x035, 0x034, 0x033, 0x032,
+ 0x031, 0x030, 0x026, 0x025, 0x024, 0x023, 0x022, 0x021,
+ 0x020, 0x018, 0x017, 0x016, 0x015, 0x014, 0x013, 0x012,
+ 0x011, 0x010,
+};
+
+static const uint16_t ac_vlc_desc9_codes[114] = {
+ 0x0061, 0x0403, 0x0DB1, 0x0012, 0x0071, 0x0056, 0x0035, 0x0023,
+ 0x000D, 0x0007, 0x0243, 0x01D3, 0x026A, 0x00A1, 0x00A2, 0x0011,
+ 0x000E, 0x01AA, 0x0531, 0x0093, 0x0222, 0x0032, 0x0006, 0x07F2,
+ 0x04D3, 0x0C43, 0x0072, 0x0001, 0x0343, 0x05F2, 0x04AA, 0x03F2,
+ 0x0031, 0x0045, 0x0143, 0x00AA, 0x0B31, 0x00F2, 0x00C3, 0x0693,
+ 0x0BF2, 0x0203, 0x00E1, 0x03B1, 0x02D3, 0x00B1, 0x056A, 0x01D2,
+ 0x008A, 0x046A, 0x01E2, 0x0003, 0x0103, 0x01B1, 0x02E2, 0x0293,
+ 0x016A, 0x04E2, 0x0443, 0x0521, 0x0321, 0x0043, 0x00D3, 0x00E2,
+ 0x0703, 0x00D2, 0x0731, 0x0A93, 0x0393, 0x0803, 0x0422, 0x0383,
+ 0x018A, 0x006A, 0x0021, 0x096A, 0x0303, 0x0052, 0x0CE2, 0x0D31,
+ 0x038A, 0x0013, 0x01F2, 0x0E93, 0x0083, 0x0005, 0x02D2, 0x0121,
+ 0x0022, 0x00EA, 0x0036, 0x0122, 0x0193, 0x0331, 0x0183, 0x02AA,
+ 0x004A, 0x001A, 0x0131, 0x002A, 0x036A, 0x000A, 0x0062, 0x0025,
+ 0x0009, 0x06E2, 0x05B1, 0x0053, 0x0002, 0x0016, 0x0015, 0x0033,
+ 0x000B, 0x0000,
+};
+
+static const uint8_t ac_vlc_desc9_bits[114] = {
+ 8, 11, 12, 7, 7, 7, 6, 6,
+ 4, 3, 10, 9, 10, 8, 8, 6,
+ 4, 9, 12, 10, 10, 7, 5, 11,
+ 11, 12, 8, 6, 10, 11, 11, 12,
+ 9, 7, 10, 11, 12, 9, 8, 12,
+ 12, 10, 8, 10, 10, 9, 11, 9,
+ 9, 11, 9, 12, 10, 11, 11, 12,
+ 12, 12, 12, 11, 10, 11, 11, 11,
+ 11, 10, 11, 12, 10, 12, 11, 10,
+ 10, 11, 9, 12, 11, 8, 12, 12,
+ 10, 8, 11, 12, 9, 7, 10, 11,
+ 11, 8, 6, 9, 10, 12, 10, 10,
+ 7, 5, 11, 8, 10, 8, 8, 6,
+ 4, 11, 12, 8, 6, 7, 6, 6,
+ 4, 2,
+};
+
+static const uint16_t ac_vlc_descA_syms[110] = {
+ 0x1000, 0xFF8, 0xFF7, 0xFF6, 0xFF5, 0xFF4, 0xFF3, 0xFF2,
+ 0xFF1, 0xFF0, 0xFE6, 0xFE5, 0xFE4, 0xFE3, 0xFE2, 0xFE1,
+ 0xFE0, 0xFD5, 0xFD4, 0xFD3, 0xFD2, 0xFD1, 0xFD0, 0xFC6,
+ 0xFC5, 0xFC3, 0xFC2, 0xFC1, 0xFC0, 0xFB6, 0xFB5, 0xFB3,
+ 0xFB2, 0xFB1, 0xFB0, 0xFA6, 0xFA5, 0xFA3, 0xFA1, 0xFA0,
+ 0xF96, 0xF93, 0xF91, 0xF90, 0xF83, 0xF81, 0xF80, 0xF73,
+ 0xF71, 0xF70, 0xF61, 0xF60, 0xF51, 0xF50, 0xF41, 0xF40,
+ 0xF31, 0x0E1, 0x0D1, 0x0C1, 0x0C0, 0x0B1, 0x0B0, 0x0A1,
+ 0x0A0, 0x093, 0x091, 0x090, 0x083, 0x081, 0x080, 0x073,
+ 0x071, 0x070, 0x063, 0x061, 0x060, 0x055, 0x053, 0x051,
+ 0x050, 0x045, 0x044, 0x043, 0x042, 0x041, 0x040, 0x036,
+ 0x035, 0x034, 0x033, 0x032, 0x031, 0x030, 0x026, 0x025,
+ 0x024, 0x023, 0x022, 0x021, 0x020, 0x018, 0x017, 0x016,
+ 0x015, 0x014, 0x013, 0x012, 0x011, 0x010,
+};
+
+static const uint16_t ac_vlc_descA_codes[110] = {
+ 0x002A, 0x04C5, 0x02A3, 0x004A, 0x0015, 0x0005, 0x0003, 0x0013,
+ 0x000D, 0x0007, 0x0171, 0x0032, 0x0371, 0x0076, 0x0042, 0x0011,
+ 0x000E, 0x00AA, 0x04D5, 0x03A3, 0x06A3, 0x0062, 0x001A, 0x06D5,
+ 0x07F2, 0x0223, 0x0CD5, 0x006A, 0x0001, 0x00F6, 0x0623, 0x03F2,
+ 0x07EA, 0x01F1, 0x0021, 0x03D5, 0x08C2, 0x07F6, 0x00F2, 0x00E3,
+ 0x0FEA, 0x02C5, 0x01AA, 0x0082, 0x04A3, 0x00B6, 0x0071, 0x03B2,
+ 0x0023, 0x01B6, 0x08A3, 0x0002, 0x0BB2, 0x00C5, 0x02EA, 0x0C23,
+ 0x0FF6, 0x0423, 0x07B2, 0x01C5, 0x07D5, 0x01EA, 0x06EA, 0x02C2,
+ 0x01F6, 0x01D5, 0x01B2, 0x00B2, 0x04F1, 0x03EA, 0x01A2, 0x02A2,
+ 0x02D5, 0x0123, 0x00D5, 0x01F2, 0x0055, 0x05B2, 0x04C2, 0x0102,
+ 0x0061, 0x05D5, 0x00C2, 0x00F1, 0x00A3, 0x0045, 0x0016, 0x01A3,
+ 0x01C2, 0x08D5, 0x03C5, 0x00EA, 0x000A, 0x0006, 0x00A2, 0x0036,
+ 0x02F1, 0x0072, 0x0022, 0x0025, 0x0009, 0x03F6, 0x0AA3, 0x0063,
+ 0x0012, 0x0031, 0x0035, 0x0033, 0x000B, 0x0000,
+};
+
+static const uint8_t ac_vlc_descA_bits[110] = {
+ 8, 11, 12, 7, 7, 7, 6, 6,
+ 4, 3, 10, 8, 10, 8, 8, 6,
+ 4, 9, 12, 10, 11, 7, 5, 11,
+ 11, 11, 12, 8, 6, 9, 11, 11,
+ 12, 9, 7, 11, 12, 12, 9, 8,
+ 12, 10, 9, 8, 11, 9, 9, 12,
+ 11, 9, 12, 9, 12, 11, 11, 12,
+ 12, 12, 11, 10, 11, 10, 11, 10,
+ 10, 11, 11, 9, 11, 11, 9, 10,
+ 11, 9, 12, 10, 8, 11, 11, 9,
+ 7, 11, 12, 11, 12, 8, 6, 10,
+ 9, 12, 10, 10, 7, 5, 10, 8,
+ 10, 8, 8, 6, 4, 11, 12, 8,
+ 6, 7, 6, 6, 4, 2,
+};
+
+static const uint16_t ac_vlc_descB_syms[101] = {
+ 0x1000, 0xFF8, 0xFF7, 0xFF6, 0xFF5, 0xFF4, 0xFF3, 0xFF2,
+ 0xFF1, 0xFF0, 0xFE6, 0xFE5, 0xFE4, 0xFE3, 0xFE2, 0xFE1,
+ 0xFE0, 0xFD5, 0xFD4, 0xFD3, 0xFD2, 0xFD1, 0xFD0, 0xFC6,
+ 0xFC5, 0xFC3, 0xFC2, 0xFC1, 0xFC0, 0xFB6, 0xFB5, 0xFB3,
+ 0xFB1, 0xFB0, 0xFA6, 0xFA3, 0xFA1, 0xFA0, 0xF93, 0xF91,
+ 0xF90, 0xF83, 0xF81, 0xF80, 0xF71, 0xF70, 0xF61, 0xF60,
+ 0xF51, 0xF50, 0xF41, 0x0F1, 0x0D1, 0x0C1, 0x0B1, 0x0B0,
+ 0x0A1, 0x0A0, 0x091, 0x090, 0x083, 0x081, 0x080, 0x073,
+ 0x071, 0x070, 0x063, 0x061, 0x060, 0x055, 0x053, 0x051,
+ 0x050, 0x045, 0x043, 0x042, 0x041, 0x040, 0x036, 0x035,
+ 0x034, 0x033, 0x032, 0x031, 0x030, 0x026, 0x025, 0x024,
+ 0x023, 0x022, 0x021, 0x020, 0x018, 0x017, 0x016, 0x015,
+ 0x014, 0x013, 0x012, 0x011, 0x010,
+};
+
+static const uint16_t ac_vlc_descB_codes[101] = {
+ 0x00EE, 0x03A5, 0x0B73, 0x004E, 0x0035, 0x0015, 0x0023, 0x0013,
+ 0x000D, 0x0007, 0x0673, 0x01F3, 0x02FE, 0x0096, 0x0133, 0x001E,
+ 0x0001, 0x0116, 0x00F5, 0x03F5, 0x0473, 0x0052, 0x001A, 0x01D5,
+ 0x0025, 0x0073, 0x0633, 0x0086, 0x0036, 0x012E, 0x0155, 0x0006,
+ 0x0055, 0x000E, 0x0106, 0x023E, 0x0192, 0x0075, 0x0173, 0x01AE,
+ 0x00D5, 0x08F5, 0x002E, 0x01FE, 0x0406, 0x00AE, 0x0E3E, 0x0206,
+ 0x013E, 0x0373, 0x0D55, 0x063E, 0x0E33, 0x033E, 0x01F5, 0x0273,
+ 0x003E, 0x06A5, 0x0092, 0x03D5, 0x04F5, 0x053E, 0x0016, 0x00FE,
+ 0x07A5, 0x0125, 0x0506, 0x0292, 0x00BE, 0x0425, 0x0F73, 0x02F5,
+ 0x0056, 0x0233, 0x02A5, 0x0C25, 0x007E, 0x0026, 0x0355, 0x0033,
+ 0x0555, 0x01A5, 0x0306, 0x0046, 0x000A, 0x0225, 0x006E, 0x00A5,
+ 0x0012, 0x00F3, 0x0005, 0x0009, 0x073E, 0x0773, 0x00B3, 0x0032,
+ 0x0065, 0x0003, 0x0002, 0x000B, 0x0000,
+};
+
+static const uint8_t ac_vlc_descB_bits[101] = {
+ 8, 11, 12, 7, 7, 7, 6, 6,
+ 4, 3, 11, 9, 10, 8, 9, 6,
+ 4, 9, 12, 10, 11, 7, 5, 10,
+ 11, 11, 12, 8, 6, 9, 11, 11,
+ 9, 7, 11, 11, 9, 8, 10, 9,
+ 9, 12, 9, 9, 11, 9, 12, 10,
+ 11, 12, 12, 12, 12, 11, 10, 11,
+ 10, 11, 10, 10, 11, 11, 9, 10,
+ 11, 9, 11, 10, 8, 12, 12, 10,
+ 7, 11, 11, 12, 8, 6, 10, 10,
+ 12, 10, 10, 7, 5, 10, 8, 10,
+ 8, 9, 6, 4, 11, 12, 8, 6,
+ 7, 6, 5, 4, 2,
+};
+
+static const uint16_t ac_vlc_descC_syms[96] = {
+ 0x1000, 0xFF8, 0xFF7, 0xFF6, 0xFF5, 0xFF4, 0xFF3, 0xFF2,
+ 0xFF1, 0xFF0, 0xFE6, 0xFE5, 0xFE4, 0xFE3, 0xFE2, 0xFE1,
+ 0xFE0, 0xFD5, 0xFD4, 0xFD3, 0xFD2, 0xFD1, 0xFD0, 0xFC6,
+ 0xFC5, 0xFC3, 0xFC2, 0xFC1, 0xFC0, 0xFB6, 0xFB5, 0xFB3,
+ 0xFB1, 0xFB0, 0xFA6, 0xFA3, 0xFA1, 0xFA0, 0xF93, 0xF91,
+ 0xF90, 0xF81, 0xF80, 0xF71, 0xF70, 0xF61, 0xF60, 0xF51,
+ 0x0E1, 0x0C1, 0x0B1, 0x0A1, 0x0A0, 0x091, 0x090, 0x083,
+ 0x081, 0x080, 0x073, 0x071, 0x070, 0x063, 0x061, 0x060,
+ 0x055, 0x053, 0x051, 0x050, 0x045, 0x043, 0x042, 0x041,
+ 0x040, 0x036, 0x035, 0x034, 0x033, 0x032, 0x031, 0x030,
+ 0x026, 0x025, 0x024, 0x023, 0x022, 0x021, 0x020, 0x018,
+ 0x017, 0x016, 0x015, 0x014, 0x013, 0x012, 0x011, 0x010,
+};
+
+static const uint16_t ac_vlc_descC_codes[96] = {
+ 0x00DE, 0x072E, 0x0576, 0x006E, 0x0075, 0x0055, 0x0013, 0x0033,
+ 0x000D, 0x0007, 0x07D2, 0x0052, 0x0065, 0x00CE, 0x0183, 0x003E,
+ 0x0001, 0x002E, 0x0F35, 0x0003, 0x0243, 0x001A, 0x0006, 0x01A5,
+ 0x0043, 0x0012, 0x0E43, 0x00B6, 0x0016, 0x0135, 0x0176, 0x0643,
+ 0x0035, 0x001E, 0x0735, 0x0283, 0x0125, 0x00AE, 0x00D2, 0x0165,
+ 0x0103, 0x0603, 0x00E5, 0x0C43, 0x02B5, 0x04A5, 0x00A5, 0x0443,
+ 0x0265, 0x0476, 0x0212, 0x0112, 0x0376, 0x012E, 0x02D2, 0x0083,
+ 0x0483, 0x015E, 0x06A5, 0x0335, 0x005E, 0x0025, 0x01D2, 0x00F6,
+ 0x03D2, 0x032E, 0x03B5, 0x005A, 0x0203, 0x02A5, 0x0BD2, 0x004E,
+ 0x0032, 0x01B5, 0x00B5, 0x0A65, 0x0225, 0x0276, 0x000E, 0x000A,
+ 0x03E5, 0x0143, 0x01E5, 0x0036, 0x0092, 0x0005, 0x0009, 0x0665,
+ 0x0076, 0x00C3, 0x003A, 0x0015, 0x0023, 0x0002, 0x000B, 0x0000,
+};
+
+static const uint8_t ac_vlc_descC_bits[96] = {
+ 8, 11, 11, 7, 7, 7, 6, 6,
+ 4, 3, 11, 8, 10, 8, 9, 6,
+ 4, 9, 12, 10, 11, 7, 5, 9,
+ 11, 10, 12, 8, 6, 10, 11, 12,
+ 9, 7, 12, 10, 9, 8, 10, 9,
+ 9, 11, 9, 12, 10, 11, 11, 12,
+ 12, 11, 10, 9, 10, 10, 10, 11,
+ 11, 9, 11, 11, 9, 10, 10, 8,
+ 12, 11, 10, 7, 11, 11, 12, 8,
+ 6, 10, 10, 12, 10, 10, 7, 5,
+ 10, 9, 10, 8, 8, 6, 4, 11,
+ 11, 8, 6, 7, 6, 5, 4, 2,
+};
+
+static const int tscc2_ac_vlc_sizes[NUM_VLC_SETS] = {
+ 172, 169, 165, 162, 131, 132, 130, 125, 121, 114, 110, 101, 96
+};
+
+static const uint16_t *tscc2_ac_vlc_syms[NUM_VLC_SETS] = {
+ ac_vlc_desc0_syms, ac_vlc_desc1_syms, ac_vlc_desc2_syms, ac_vlc_desc3_syms,
+ ac_vlc_desc4_syms, ac_vlc_desc5_syms, ac_vlc_desc6_syms, ac_vlc_desc7_syms,
+ ac_vlc_desc8_syms, ac_vlc_desc9_syms, ac_vlc_descA_syms, ac_vlc_descB_syms,
+ ac_vlc_descC_syms,
+};
+
+static const uint16_t *tscc2_ac_vlc_codes[NUM_VLC_SETS] = {
+ ac_vlc_desc0_codes, ac_vlc_desc1_codes, ac_vlc_desc2_codes,
+ ac_vlc_desc3_codes, ac_vlc_desc4_codes, ac_vlc_desc5_codes,
+ ac_vlc_desc6_codes, ac_vlc_desc7_codes, ac_vlc_desc8_codes,
+ ac_vlc_desc9_codes, ac_vlc_descA_codes, ac_vlc_descB_codes,
+ ac_vlc_descC_codes,
+};
+
+static const uint8_t *tscc2_ac_vlc_bits[NUM_VLC_SETS] = {
+ ac_vlc_desc0_bits, ac_vlc_desc1_bits, ac_vlc_desc2_bits, ac_vlc_desc3_bits,
+ ac_vlc_desc4_bits, ac_vlc_desc5_bits, ac_vlc_desc6_bits, ac_vlc_desc7_bits,
+ ac_vlc_desc8_bits, ac_vlc_desc9_bits, ac_vlc_descA_bits, ac_vlc_descB_bits,
+ ac_vlc_descC_bits,
+};
+
+#endif /* AVCODEC_TSCC2_DATA_H */
diff --git a/gst-libs/ext/libav/libavcodec/tta.c b/gst-libs/ext/libav/libavcodec/tta.c
index 1743f7d..5ed70e9 100644
--- a/gst-libs/ext/libav/libavcodec/tta.c
+++ b/gst-libs/ext/libav/libavcodec/tta.c
@@ -32,6 +32,7 @@
#include <limits.h>
#include "avcodec.h"
#include "get_bits.h"
+#include "internal.h"
#include "libavutil/crc.h"
#define FORMAT_SIMPLE 1
@@ -39,7 +40,7 @@
#define MAX_ORDER 16
typedef struct TTAFilter {
- int32_t shift, round, error, mode;
+ int32_t shift, round, error;
int32_t qm[MAX_ORDER];
int32_t dx[MAX_ORDER];
int32_t dl[MAX_ORDER];
@@ -63,7 +64,7 @@ typedef struct TTAContext {
int format, channels, bps;
unsigned data_length;
- int frame_length, last_frame_length, total_frames;
+ int frame_length, last_frame_length;
int32_t *decode_buffer;
@@ -85,19 +86,18 @@ static const uint32_t shift_1[] = {
static const uint32_t * const shift_16 = shift_1 + 4;
-static const int32_t ttafilter_configs[4][2] = {
- {10, 1},
- {9, 1},
- {10, 1},
- {12, 0}
+static const int32_t ttafilter_configs[4] = {
+ 10,
+ 9,
+ 10,
+ 12
};
-static void ttafilter_init(TTAFilter *c, int32_t shift, int32_t mode) {
+static void ttafilter_init(TTAFilter *c, int32_t shift) {
memset(c, 0, sizeof(TTAFilter));
c->shift = shift;
c->round = shift_1[shift-1];
// c->round = 1 << (shift - 1);
- c->mode = mode;
}
// FIXME: copy paste from original
@@ -112,9 +112,8 @@ static inline void memshl(register int32_t *a, register int32_t *b) {
*a = *b;
}
-// FIXME: copy paste from original
-// mode=1 encoder, mode=0 decoder
-static inline void ttafilter_process(TTAFilter *c, int32_t *in, int32_t mode) {
+static inline void ttafilter_process(TTAFilter *c, int32_t *in)
+{
register int32_t *dl = c->dl, *qm = c->qm, *dx = c->dx, sum = c->round;
if (!c->error) {
@@ -152,22 +151,13 @@ static inline void ttafilter_process(TTAFilter *c, int32_t *in, int32_t mode) {
*(dx-2) = ((*(dl-3) >> 30) | 1) << 1;
*(dx-3) = ((*(dl-4) >> 30) | 1);
- // compress
- if (mode) {
- *dl = *in;
- *in -= (sum >> c->shift);
- c->error = *in;
- } else {
- c->error = *in;
- *in += (sum >> c->shift);
- *dl = *in;
- }
+ c->error = *in;
+ *in += (sum >> c->shift);
+ *dl = *in;
- if (c->mode) {
- *(dl-1) = *dl - *(dl-1);
- *(dl-2) = *(dl-1) - *(dl-2);
- *(dl-3) = *(dl-2) - *(dl-3);
- }
+ *(dl-1) = *dl - *(dl-1);
+ *(dl-2) = *(dl-1) - *(dl-2);
+ *(dl-3) = *(dl-2) - *(dl-3);
memshl(c->dl, c->dl + 1);
memshl(c->dx, c->dx + 1);
@@ -208,6 +198,7 @@ static int tta_check_crc(TTAContext *s, const uint8_t *buf, int buf_size)
static av_cold int tta_decode_init(AVCodecContext * avctx)
{
TTAContext *s = avctx->priv_data;
+ int total_frames;
s->avctx = avctx;
@@ -220,8 +211,7 @@ static av_cold int tta_decode_init(AVCodecContext * avctx)
{
if (avctx->err_recognition & AV_EF_CRCCHECK) {
s->crc_table = av_crc_get_table(AV_CRC_32_IEEE_LE);
- if (tta_check_crc(s, avctx->extradata, 18))
- return AVERROR_INVALIDDATA;
+ tta_check_crc(s, avctx->extradata, 18);
}
/* signature */
@@ -234,7 +224,7 @@ static av_cold int tta_decode_init(AVCodecContext * avctx)
}
if (s->format == FORMAT_ENCRYPTED) {
av_log_missing_feature(s->avctx, "Encrypted TTA", 0);
- return AVERROR(EINVAL);
+ return AVERROR_PATCHWELCOME;
}
avctx->channels = s->channels = get_bits(&s->gb, 16);
avctx->bits_per_coded_sample = get_bits(&s->gb, 16);
@@ -273,24 +263,24 @@ static av_cold int tta_decode_init(AVCodecContext * avctx)
s->frame_length = 256 * avctx->sample_rate / 245;
s->last_frame_length = s->data_length % s->frame_length;
- s->total_frames = s->data_length / s->frame_length +
- (s->last_frame_length ? 1 : 0);
+ total_frames = s->data_length / s->frame_length +
+ (s->last_frame_length ? 1 : 0);
av_log(s->avctx, AV_LOG_DEBUG, "format: %d chans: %d bps: %d rate: %d block: %d\n",
s->format, avctx->channels, avctx->bits_per_coded_sample, avctx->sample_rate,
avctx->block_align);
av_log(s->avctx, AV_LOG_DEBUG, "data_length: %d frame_length: %d last: %d total: %d\n",
- s->data_length, s->frame_length, s->last_frame_length, s->total_frames);
+ s->data_length, s->frame_length, s->last_frame_length, total_frames);
// FIXME: seek table
- if (avctx->extradata_size <= 26 || s->total_frames > INT_MAX / 4 ||
- avctx->extradata_size - 26 < s->total_frames * 4)
+ if (avctx->extradata_size <= 26 || total_frames > INT_MAX / 4 ||
+ avctx->extradata_size - 26 < total_frames * 4)
av_log(avctx, AV_LOG_WARNING, "Seek table missing or too small\n");
else if (avctx->err_recognition & AV_EF_CRCCHECK) {
- if (tta_check_crc(s, avctx->extradata + 22, s->total_frames * 4))
+ if (tta_check_crc(s, avctx->extradata + 22, total_frames * 4))
return AVERROR_INVALIDDATA;
}
- skip_bits_long(&s->gb, 32 * s->total_frames);
+ skip_bits_long(&s->gb, 32 * total_frames);
skip_bits_long(&s->gb, 32); // CRC32 of seektable
if(s->frame_length >= UINT_MAX / (s->channels * sizeof(int32_t))){
@@ -336,14 +326,9 @@ static int tta_decode_frame(AVCodecContext *avctx, void *data,
init_get_bits(&s->gb, buf, buf_size*8);
- // FIXME: seeking
- s->total_frames--;
- if (!s->total_frames && s->last_frame_length)
- framelen = s->last_frame_length;
-
/* get output buffer */
s->frame.nb_samples = framelen;
- if ((ret = avctx->get_buffer(avctx, &s->frame)) < 0) {
+ if ((ret = ff_get_buffer(avctx, &s->frame)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return ret;
}
@@ -355,10 +340,11 @@ static int tta_decode_frame(AVCodecContext *avctx, void *data,
// init per channel states
for (i = 0; i < s->channels; i++) {
s->ch_ctx[i].predictor = 0;
- ttafilter_init(&s->ch_ctx[i].filter, ttafilter_configs[s->bps-1][0], ttafilter_configs[s->bps-1][1]);
+ ttafilter_init(&s->ch_ctx[i].filter, ttafilter_configs[s->bps-1]);
rice_init(&s->ch_ctx[i].rice, 10, 10);
}
+ i = 0;
for (p = s->decode_buffer; p < s->decode_buffer + (framelen * s->channels); p++) {
int32_t *predictor = &s->ch_ctx[cur_chan].predictor;
TTAFilter *filter = &s->ch_ctx[cur_chan].filter;
@@ -377,12 +363,16 @@ static int tta_decode_frame(AVCodecContext *avctx, void *data,
unary--;
}
- if (get_bits_left(&s->gb) < k)
- return -1;
+ if (get_bits_left(&s->gb) < k) {
+ ret = AVERROR_INVALIDDATA;
+ goto error;
+ }
if (k) {
- if (k > MIN_CACHE_BITS)
- return -1;
+ if (k > MIN_CACHE_BITS) {
+ ret = AVERROR_INVALIDDATA;
+ goto error;
+ }
value = (unary << k) + get_bits(&s->gb, k);
} else
value = unary;
@@ -405,19 +395,18 @@ static int tta_decode_frame(AVCodecContext *avctx, void *data,
}
// extract coded value
-#define UNFOLD(x) (((x)&1) ? (++(x)>>1) : (-(x)>>1))
- *p = UNFOLD(value);
+ *p = 1 + ((value >> 1) ^ ((value & 1) - 1));
// run hybrid filter
- ttafilter_process(filter, p, 0);
+ ttafilter_process(filter, p);
// fixed order prediction
#define PRED(x, k) (int32_t)((((uint64_t)x << k) - x) >> k)
switch (s->bps) {
- case 1: *p += PRED(*predictor, 4); break;
- case 2:
- case 3: *p += PRED(*predictor, 5); break;
- case 4: *p += *predictor; break;
+ case 1: *p += PRED(*predictor, 4); break;
+ case 2:
+ case 3: *p += PRED(*predictor, 5); break;
+ case 4: *p += *predictor; break;
}
*predictor = *p;
@@ -425,18 +414,27 @@ static int tta_decode_frame(AVCodecContext *avctx, void *data,
if (cur_chan < (s->channels-1))
cur_chan++;
else {
- // decorrelate in case of stereo integer
+ // decorrelate in case of multiple channels
if (s->channels > 1) {
int32_t *r = p - 1;
for (*p += *r / 2; r > p - s->channels; r--)
*r = *(r + 1) - *r;
}
cur_chan = 0;
+ i++;
+ // check for last frame
+ if (i == s->last_frame_length && get_bits_left(&s->gb) / 8 == 4) {
+ s->frame.nb_samples = framelen = s->last_frame_length;
+ break;
+ }
}
}
- if (get_bits_left(&s->gb) < 32)
- return -1;
+ align_get_bits(&s->gb);
+ if (get_bits_left(&s->gb) < 32) {
+ ret = AVERROR_INVALIDDATA;
+ goto error;
+ }
skip_bits_long(&s->gb, 32); // frame crc
// convert to output buffer
@@ -457,6 +455,11 @@ static int tta_decode_frame(AVCodecContext *avctx, void *data,
*(AVFrame *)data = s->frame;
return buf_size;
+error:
+ // reset decode buffer
+ if (s->bps == 3)
+ s->decode_buffer = NULL;
+ return ret;
}
static av_cold int tta_decode_close(AVCodecContext *avctx) {
@@ -471,11 +474,11 @@ static av_cold int tta_decode_close(AVCodecContext *avctx) {
AVCodec ff_tta_decoder = {
.name = "tta",
.type = AVMEDIA_TYPE_AUDIO,
- .id = CODEC_ID_TTA,
+ .id = AV_CODEC_ID_TTA,
.priv_data_size = sizeof(TTAContext),
.init = tta_decode_init,
.close = tta_decode_close,
.decode = tta_decode_frame,
.capabilities = CODEC_CAP_DR1,
- .long_name = NULL_IF_CONFIG_SMALL("True Audio (TTA)"),
+ .long_name = NULL_IF_CONFIG_SMALL("TTA (True Audio)"),
};
diff --git a/gst-libs/ext/libav/libavcodec/twinvq.c b/gst-libs/ext/libav/libavcodec/twinvq.c
index 22be07a..8989469 100644
--- a/gst-libs/ext/libav/libavcodec/twinvq.c
+++ b/gst-libs/ext/libav/libavcodec/twinvq.c
@@ -19,10 +19,13 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "libavutil/channel_layout.h"
+#include "libavutil/float_dsp.h"
#include "avcodec.h"
#include "get_bits.h"
#include "dsputil.h"
#include "fft.h"
+#include "internal.h"
#include "lsp.h"
#include "sinewin.h"
@@ -176,6 +179,7 @@ typedef struct TwinContext {
AVCodecContext *avctx;
AVFrame frame;
DSPContext dsp;
+ AVFloatDSPContext fdsp;
FFTContext mdct_ctx[3];
const ModeTab *mtab;
@@ -664,7 +668,7 @@ static void imdct_and_window(TwinContext *tctx, enum FrameType ftype, int wtype,
}
static void imdct_output(TwinContext *tctx, enum FrameType ftype, int wtype,
- float *out)
+ float **out)
{
const ModeTab *mtab = tctx->mtab;
int size1, size2;
@@ -683,24 +687,15 @@ static void imdct_output(TwinContext *tctx, enum FrameType ftype, int wtype,
size2 = tctx->last_block_pos[0];
size1 = mtab->size - size2;
- if (tctx->avctx->channels == 2) {
- tctx->dsp.butterflies_float_interleave(out, prev_buf,
- &prev_buf[2*mtab->size],
- size1);
-
- out += 2 * size1;
-
- tctx->dsp.butterflies_float_interleave(out, tctx->curr_frame,
- &tctx->curr_frame[2*mtab->size],
- size2);
- } else {
- memcpy(out, prev_buf, size1 * sizeof(*out));
- out += size1;
+ memcpy(&out[0][0 ], prev_buf, size1 * sizeof(out[0][0]));
+ memcpy(&out[0][size1], tctx->curr_frame, size2 * sizeof(out[0][0]));
- memcpy(out, tctx->curr_frame, size2 * sizeof(*out));
+ if (tctx->avctx->channels == 2) {
+ memcpy(&out[1][0], &prev_buf[2*mtab->size], size1 * sizeof(out[1][0]));
+ memcpy(&out[1][size1], &tctx->curr_frame[2*mtab->size], size2 * sizeof(out[1][0]));
+ tctx->dsp.butterflies_float(out[0], out[1], mtab->size);
}
-
}
static void dec_bark_env(TwinContext *tctx, const uint8_t *in, int use_hist,
@@ -787,8 +782,8 @@ static void read_and_decode_spectrum(TwinContext *tctx, GetBitContext *gb,
dec_bark_env(tctx, bark1[i][j], bark_use_hist[i][j], i,
tctx->tmp_buf, gain[sub*i+j], ftype);
- tctx->dsp.vector_fmul(chunk + block_size*j, chunk + block_size*j, tctx->tmp_buf,
- block_size);
+ tctx->fdsp.vector_fmul(chunk + block_size*j, chunk + block_size*j,
+ tctx->tmp_buf, block_size);
}
@@ -809,7 +804,7 @@ static void read_and_decode_spectrum(TwinContext *tctx, GetBitContext *gb,
dec_lpc_spectrum_inv(tctx, lsp, ftype, tctx->tmp_buf);
for (j = 0; j < mtab->fmode[ftype].sub; j++) {
- tctx->dsp.vector_fmul(chunk, chunk, tctx->tmp_buf, block_size);
+ tctx->fdsp.vector_fmul(chunk, chunk, tctx->tmp_buf, block_size);
chunk += block_size;
}
}
@@ -823,7 +818,7 @@ static int twin_decode_frame(AVCodecContext * avctx, void *data,
TwinContext *tctx = avctx->priv_data;
GetBitContext gb;
const ModeTab *mtab = tctx->mtab;
- float *out = NULL;
+ float **out = NULL;
enum FrameType ftype;
int window_type, ret;
static const enum FrameType wtype_to_ftype_table[] = {
@@ -840,11 +835,11 @@ static int twin_decode_frame(AVCodecContext * avctx, void *data,
/* get output buffer */
if (tctx->discarded_packets >= 2) {
tctx->frame.nb_samples = mtab->size;
- if ((ret = avctx->get_buffer(avctx, &tctx->frame)) < 0) {
+ if ((ret = ff_get_buffer(avctx, &tctx->frame)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return ret;
}
- out = (float *)tctx->frame.data[0];
+ out = (float **)tctx->frame.extended_data;
}
init_get_bits(&gb, buf, buf_size * 8);
@@ -1000,14 +995,16 @@ static av_cold void construct_perm_table(TwinContext *tctx,enum FrameType ftype)
{
int block_size;
const ModeTab *mtab = tctx->mtab;
- int size = tctx->avctx->channels*mtab->fmode[ftype].sub;
+ int size;
int16_t *tmp_perm = (int16_t *) tctx->tmp_buf;
if (ftype == FT_PPC) {
size = tctx->avctx->channels;
block_size = mtab->ppc_shape_len;
- } else
+ } else {
+ size = tctx->avctx->channels * mtab->fmode[ftype].sub;
block_size = mtab->size / mtab->fmode[ftype].sub;
+ }
permutate_in_line(tmp_perm, tctx->n_div[ftype], size,
block_size, tctx->length[ftype],
@@ -1115,7 +1112,7 @@ static av_cold int twin_decode_init(AVCodecContext *avctx)
int isampf, ibps;
tctx->avctx = avctx;
- avctx->sample_fmt = AV_SAMPLE_FMT_FLT;
+ avctx->sample_fmt = AV_SAMPLE_FMT_FLTP;
if (!avctx->extradata || avctx->extradata_size < 12) {
av_log(avctx, AV_LOG_ERROR, "Missing or incomplete extradata\n");
@@ -1124,6 +1121,11 @@ static av_cold int twin_decode_init(AVCodecContext *avctx)
avctx->channels = AV_RB32(avctx->extradata ) + 1;
avctx->bit_rate = AV_RB32(avctx->extradata + 4) * 1000;
isampf = AV_RB32(avctx->extradata + 8);
+
+ if (isampf < 8 || isampf > 44) {
+ av_log(avctx, AV_LOG_ERROR, "Unsupported sample rate\n");
+ return AVERROR_INVALIDDATA;
+ }
switch (isampf) {
case 44: avctx->sample_rate = 44100; break;
case 22: avctx->sample_rate = 22050; break;
@@ -1131,11 +1133,14 @@ static av_cold int twin_decode_init(AVCodecContext *avctx)
default: avctx->sample_rate = isampf * 1000; break;
}
- if (avctx->channels > CHANNELS_MAX) {
+ if (avctx->channels <= 0 || avctx->channels > CHANNELS_MAX) {
av_log(avctx, AV_LOG_ERROR, "Unsupported number of channels: %i\n",
avctx->channels);
return -1;
}
+ avctx->channel_layout = avctx->channels == 1 ? AV_CH_LAYOUT_MONO :
+ AV_CH_LAYOUT_STEREO;
+
ibps = avctx->bit_rate / (1000 * avctx->channels);
switch ((isampf << 8) + ibps) {
@@ -1153,7 +1158,8 @@ static av_cold int twin_decode_init(AVCodecContext *avctx)
return -1;
}
- dsputil_init(&tctx->dsp, avctx);
+ ff_dsputil_init(&tctx->dsp, avctx);
+ avpriv_float_dsp_init(&tctx->fdsp, avctx->flags & CODEC_FLAG_BITEXACT);
if ((ret = init_mdct_win(tctx))) {
av_log(avctx, AV_LOG_ERROR, "Error initializing MDCT\n");
twin_decode_close(avctx);
@@ -1172,11 +1178,13 @@ static av_cold int twin_decode_init(AVCodecContext *avctx)
AVCodec ff_twinvq_decoder = {
.name = "twinvq",
.type = AVMEDIA_TYPE_AUDIO,
- .id = CODEC_ID_TWINVQ,
+ .id = AV_CODEC_ID_TWINVQ,
.priv_data_size = sizeof(TwinContext),
.init = twin_decode_init,
.close = twin_decode_close,
.decode = twin_decode_frame,
.capabilities = CODEC_CAP_DR1,
.long_name = NULL_IF_CONFIG_SMALL("VQF TwinVQ"),
+ .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP,
+ AV_SAMPLE_FMT_NONE },
};
diff --git a/gst-libs/ext/libav/libavcodec/twinvq_data.h b/gst-libs/ext/libav/libavcodec/twinvq_data.h
index 1f1f334..a236127 100644
--- a/gst-libs/ext/libav/libavcodec/twinvq_data.h
+++ b/gst-libs/ext/libav/libavcodec/twinvq_data.h
@@ -135,7 +135,7 @@ static const uint16_t bark_tab_s44_128[] = {
*
* without risking a segfault on malformed files.
*/
-static const struct {
+static const struct twinvq_data {
float lsp08[504];
int16_t fcb08l[640];
int16_t fcb08m[320];
diff --git a/gst-libs/ext/libav/libavcodec/txd.c b/gst-libs/ext/libav/libavcodec/txd.c
index 734062a..8a10385 100644
--- a/gst-libs/ext/libav/libavcodec/txd.c
+++ b/gst-libs/ext/libav/libavcodec/txd.c
@@ -24,6 +24,8 @@
#include "libavutil/intreadwrite.h"
#include "libavutil/imgutils.h"
#include "avcodec.h"
+#include "bytestream.h"
+#include "internal.h"
#include "s3tc.h"
typedef struct TXDContext {
@@ -39,27 +41,26 @@ static av_cold int txd_init(AVCodecContext *avctx) {
return 0;
}
-static int txd_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
+static int txd_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
AVPacket *avpkt) {
- const uint8_t *buf = avpkt->data;
TXDContext * const s = avctx->priv_data;
+ GetByteContext gb;
AVFrame *picture = data;
AVFrame * const p = &s->picture;
- unsigned int version, w, h, d3d_format, depth, stride, mipmap_count, flags;
+ unsigned int version, w, h, d3d_format, depth, stride, flags;
unsigned int y, v;
uint8_t *ptr;
- const uint8_t *cur = buf;
- const uint32_t *palette = (const uint32_t *)(cur + 88);
uint32_t *pal;
- version = AV_RL32(cur);
- d3d_format = AV_RL32(cur+76);
- w = AV_RL16(cur+80);
- h = AV_RL16(cur+82);
- depth = AV_RL8 (cur+84);
- mipmap_count = AV_RL8 (cur+85);
- flags = AV_RL8 (cur+87);
- cur += 92;
+ bytestream2_init(&gb, avpkt->data, avpkt->size);
+ version = bytestream2_get_le32(&gb);
+ bytestream2_skip(&gb, 72);
+ d3d_format = bytestream2_get_le32(&gb);
+ w = bytestream2_get_le16(&gb);
+ h = bytestream2_get_le16(&gb);
+ depth = bytestream2_get_byte(&gb);
+ bytestream2_skip(&gb, 2);
+ flags = bytestream2_get_byte(&gb);
if (version < 8 || version > 9) {
av_log(avctx, AV_LOG_ERROR, "texture data version %i is unsupported\n",
@@ -68,11 +69,10 @@ static int txd_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
}
if (depth == 8) {
- avctx->pix_fmt = PIX_FMT_PAL8;
- cur += 1024;
- } else if (depth == 16 || depth == 32)
- avctx->pix_fmt = PIX_FMT_RGB32;
- else {
+ avctx->pix_fmt = AV_PIX_FMT_PAL8;
+ } else if (depth == 16 || depth == 32) {
+ avctx->pix_fmt = AV_PIX_FMT_RGB32;
+ } else {
av_log(avctx, AV_LOG_ERROR, "depth of %i is unsupported\n", depth);
return -1;
}
@@ -84,7 +84,7 @@ static int txd_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
return -1;
if (w != avctx->width || h != avctx->height)
avcodec_set_dimensions(avctx, w, h);
- if (avctx->get_buffer(avctx, p) < 0) {
+ if (ff_get_buffer(avctx, p) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return -1;
}
@@ -96,25 +96,26 @@ static int txd_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
if (depth == 8) {
pal = (uint32_t *) p->data[1];
- for (y=0; y<256; y++) {
- v = AV_RB32(palette+y);
- pal[y] = (v>>8) + (v<<24);
+ for (y = 0; y < 256; y++) {
+ v = bytestream2_get_be32(&gb);
+ pal[y] = (v >> 8) + (v << 24);
}
+ bytestream2_skip(&gb, 4);
for (y=0; y<h; y++) {
- memcpy(ptr, cur, w);
+ bytestream2_get_buffer(&gb, ptr, w);
ptr += stride;
- cur += w;
}
} else if (depth == 16) {
+ bytestream2_skip(&gb, 4);
switch (d3d_format) {
case 0:
if (!(flags & 1))
goto unsupported;
case FF_S3TC_DXT1:
- ff_decode_dxt1(cur, ptr, w, h, stride);
+ ff_decode_dxt1(&gb, ptr, w, h, stride);
break;
case FF_S3TC_DXT3:
- ff_decode_dxt3(cur, ptr, w, h, stride);
+ ff_decode_dxt3(&gb, ptr, w, h, stride);
break;
default:
goto unsupported;
@@ -124,9 +125,8 @@ static int txd_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
case 0x15:
case 0x16:
for (y=0; y<h; y++) {
- memcpy(ptr, cur, w*4);
+ bytestream2_get_buffer(&gb, ptr, w * 4);
ptr += stride;
- cur += w*4;
}
break;
default:
@@ -134,13 +134,10 @@ static int txd_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
}
}
- for (; mipmap_count > 1; mipmap_count--)
- cur += AV_RL32(cur) + 4;
-
*picture = s->picture;
- *data_size = sizeof(AVPicture);
+ *got_frame = 1;
- return cur - buf;
+ return avpkt->size;
unsupported:
av_log(avctx, AV_LOG_ERROR, "unsupported d3d format (%08x)\n", d3d_format);
@@ -159,11 +156,11 @@ static av_cold int txd_end(AVCodecContext *avctx) {
AVCodec ff_txd_decoder = {
.name = "txd",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_TXD,
+ .id = AV_CODEC_ID_TXD,
.priv_data_size = sizeof(TXDContext),
.init = txd_init,
.close = txd_end,
.decode = txd_decode_frame,
.capabilities = CODEC_CAP_DR1,
- .long_name = NULL_IF_CONFIG_SMALL("Renderware TXD (TeXture Dictionary) image"),
+ .long_name = NULL_IF_CONFIG_SMALL("Renderware TXD (TeXture Dictionary) image"),
};
diff --git a/gst-libs/ext/libav/libavcodec/ulti.c b/gst-libs/ext/libav/libavcodec/ulti.c
index 62bab3c..2753196 100644
--- a/gst-libs/ext/libav/libavcodec/ulti.c
+++ b/gst-libs/ext/libav/libavcodec/ulti.c
@@ -49,8 +49,8 @@ static av_cold int ulti_decode_init(AVCodecContext *avctx)
s->width = avctx->width;
s->height = avctx->height;
s->blocks = (s->width / 8) * (s->height / 8);
- avctx->pix_fmt = PIX_FMT_YUV410P;
- avctx->coded_frame = (AVFrame*) &s->frame;
+ avctx->pix_fmt = AV_PIX_FMT_YUV410P;
+ avctx->coded_frame = &s->frame;
s->ulti_codebook = ulti_codebook;
return 0;
@@ -209,7 +209,7 @@ static void ulti_grad(AVFrame *frame, int x, int y, uint8_t *Y, int chroma, int
}
static int ulti_decode_frame(AVCodecContext *avctx,
- void *data, int *data_size,
+ void *data, int *got_frame,
AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
@@ -406,7 +406,7 @@ static int ulti_decode_frame(AVCodecContext *avctx,
}
}
- *data_size=sizeof(AVFrame);
+ *got_frame = 1;
*(AVFrame*)data= s->frame;
return buf_size;
@@ -420,12 +420,11 @@ err:
AVCodec ff_ulti_decoder = {
.name = "ultimotion",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_ULTI,
+ .id = AV_CODEC_ID_ULTI,
.priv_data_size = sizeof(UltimotionDecodeContext),
.init = ulti_decode_init,
.close = ulti_decode_end,
.decode = ulti_decode_frame,
.capabilities = CODEC_CAP_DR1,
- .long_name = NULL_IF_CONFIG_SMALL("IBM UltiMotion"),
+ .long_name = NULL_IF_CONFIG_SMALL("IBM UltiMotion"),
};
-
diff --git a/gst-libs/ext/libav/libavcodec/utils.c b/gst-libs/ext/libav/libavcodec/utils.c
index f64bff8..19c8a99 100644
--- a/gst-libs/ext/libav/libavcodec/utils.c
+++ b/gst-libs/ext/libav/libavcodec/utils.c
@@ -27,19 +27,17 @@
#include "libavutil/avassert.h"
#include "libavutil/avstring.h"
+#include "libavutil/channel_layout.h"
#include "libavutil/crc.h"
#include "libavutil/mathematics.h"
#include "libavutil/pixdesc.h"
-#include "libavutil/audioconvert.h"
#include "libavutil/imgutils.h"
#include "libavutil/samplefmt.h"
#include "libavutil/dict.h"
#include "avcodec.h"
#include "dsputil.h"
#include "libavutil/opt.h"
-#include "imgconvert.h"
#include "thread.h"
-#include "audioconvert.h"
#include "internal.h"
#include "bytestream.h"
#include <stdlib.h>
@@ -47,23 +45,26 @@
#include <limits.h>
#include <float.h>
-static int volatile entangled_thread_counter=0;
+static int volatile entangled_thread_counter = 0;
static int (*ff_lockmgr_cb)(void **mutex, enum AVLockOp op);
static void *codec_mutex;
static void *avformat_mutex;
void *av_fast_realloc(void *ptr, unsigned int *size, size_t min_size)
{
- if(min_size < *size)
+ if (min_size < *size)
return ptr;
- min_size= FFMAX(17*min_size/16 + 32, min_size);
+ min_size = FFMAX(17 * min_size / 16 + 32, min_size);
- ptr= av_realloc(ptr, min_size);
- if(!ptr) //we could set this to the unmodified min_size but this is safer if the user lost the ptr and uses NULL now
- min_size= 0;
+ ptr = av_realloc(ptr, min_size);
+ /* we could set this to the unmodified min_size but this is safer
+ * if the user lost the ptr and uses NULL now
+ */
+ if (!ptr)
+ min_size = 0;
- *size= min_size;
+ *size = min_size;
return ptr;
}
@@ -73,25 +74,39 @@ void av_fast_malloc(void *ptr, unsigned int *size, size_t min_size)
void **p = ptr;
if (min_size < *size)
return;
- min_size= FFMAX(17*min_size/16 + 32, min_size);
+ min_size = FFMAX(17 * min_size / 16 + 32, min_size);
av_free(*p);
*p = av_malloc(min_size);
- if (!*p) min_size = 0;
- *size= min_size;
+ if (!*p)
+ min_size = 0;
+ *size = min_size;
+}
+
+void av_fast_padded_malloc(void *ptr, unsigned int *size, size_t min_size)
+{
+ void **p = ptr;
+ if (min_size > SIZE_MAX - FF_INPUT_BUFFER_PADDING_SIZE) {
+ av_freep(p);
+ *size = 0;
+ return;
+ }
+ av_fast_malloc(p, size, min_size + FF_INPUT_BUFFER_PADDING_SIZE);
+ if (*size)
+ memset((uint8_t *)*p + min_size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
}
/* encoder management */
static AVCodec *first_avcodec = NULL;
-AVCodec *av_codec_next(AVCodec *c){
- if(c) return c->next;
- else return first_avcodec;
+AVCodec *av_codec_next(const AVCodec *c)
+{
+ if (c)
+ return c->next;
+ else
+ return first_avcodec;
}
-#if !FF_API_AVCODEC_INIT
-static
-#endif
-void avcodec_init(void)
+static void avcodec_init(void)
{
static int initialized = 0;
@@ -99,15 +114,15 @@ void avcodec_init(void)
return;
initialized = 1;
- dsputil_static_init();
+ ff_dsputil_static_init();
}
-static av_always_inline int codec_is_encoder(AVCodec *codec)
+int av_codec_is_encoder(const AVCodec *codec)
{
- return codec && (codec->encode || codec->encode2);
+ return codec && (codec->encode_sub || codec->encode2);
}
-static av_always_inline int codec_is_decoder(AVCodec *codec)
+int av_codec_is_decoder(const AVCodec *codec)
{
return codec && codec->decode;
}
@@ -117,8 +132,9 @@ void avcodec_register(AVCodec *codec)
AVCodec **p;
avcodec_init();
p = &first_avcodec;
- while (*p != NULL) p = &(*p)->next;
- *p = codec;
+ while (*p != NULL)
+ p = &(*p)->next;
+ *p = codec;
codec->next = NULL;
if (codec->init_static_data)
@@ -130,124 +146,119 @@ unsigned avcodec_get_edge_width(void)
return EDGE_WIDTH;
}
-void avcodec_set_dimensions(AVCodecContext *s, int width, int height){
- s->coded_width = width;
- s->coded_height= height;
- s->width = -((-width )>>s->lowres);
- s->height= -((-height)>>s->lowres);
+void avcodec_set_dimensions(AVCodecContext *s, int width, int height)
+{
+ s->coded_width = width;
+ s->coded_height = height;
+ s->width = width;
+ s->height = height;
}
-#define INTERNAL_BUFFER_SIZE (32+1)
+#define INTERNAL_BUFFER_SIZE (32 + 1)
void avcodec_align_dimensions2(AVCodecContext *s, int *width, int *height,
int linesize_align[AV_NUM_DATA_POINTERS])
{
int i;
- int w_align= 1;
- int h_align= 1;
-
- switch(s->pix_fmt){
- case PIX_FMT_YUV420P:
- case PIX_FMT_YUYV422:
- case PIX_FMT_UYVY422:
- case PIX_FMT_YUV422P:
- case PIX_FMT_YUV440P:
- case PIX_FMT_YUV444P:
- case PIX_FMT_GBRP:
- case PIX_FMT_GRAY8:
- case PIX_FMT_GRAY16BE:
- case PIX_FMT_GRAY16LE:
- case PIX_FMT_YUVJ420P:
- case PIX_FMT_YUVJ422P:
- case PIX_FMT_YUVJ440P:
- case PIX_FMT_YUVJ444P:
- case PIX_FMT_YUVA420P:
- case PIX_FMT_YUV420P9LE:
- case PIX_FMT_YUV420P9BE:
- case PIX_FMT_YUV420P10LE:
- case PIX_FMT_YUV420P10BE:
- case PIX_FMT_YUV422P9LE:
- case PIX_FMT_YUV422P9BE:
- case PIX_FMT_YUV422P10LE:
- case PIX_FMT_YUV422P10BE:
- case PIX_FMT_YUV444P9LE:
- case PIX_FMT_YUV444P9BE:
- case PIX_FMT_YUV444P10LE:
- case PIX_FMT_YUV444P10BE:
- case PIX_FMT_GBRP9LE:
- case PIX_FMT_GBRP9BE:
- case PIX_FMT_GBRP10LE:
- case PIX_FMT_GBRP10BE:
+ int w_align = 1;
+ int h_align = 1;
+
+ switch (s->pix_fmt) {
+ case AV_PIX_FMT_YUV420P:
+ case AV_PIX_FMT_YUYV422:
+ case AV_PIX_FMT_UYVY422:
+ case AV_PIX_FMT_YUV422P:
+ case AV_PIX_FMT_YUV440P:
+ case AV_PIX_FMT_YUV444P:
+ case AV_PIX_FMT_GBRP:
+ case AV_PIX_FMT_GRAY8:
+ case AV_PIX_FMT_GRAY16BE:
+ case AV_PIX_FMT_GRAY16LE:
+ case AV_PIX_FMT_YUVJ420P:
+ case AV_PIX_FMT_YUVJ422P:
+ case AV_PIX_FMT_YUVJ440P:
+ case AV_PIX_FMT_YUVJ444P:
+ case AV_PIX_FMT_YUVA420P:
+ case AV_PIX_FMT_YUVA422P:
+ case AV_PIX_FMT_YUVA444P:
+ case AV_PIX_FMT_YUV420P9LE:
+ case AV_PIX_FMT_YUV420P9BE:
+ case AV_PIX_FMT_YUV420P10LE:
+ case AV_PIX_FMT_YUV420P10BE:
+ case AV_PIX_FMT_YUV422P9LE:
+ case AV_PIX_FMT_YUV422P9BE:
+ case AV_PIX_FMT_YUV422P10LE:
+ case AV_PIX_FMT_YUV422P10BE:
+ case AV_PIX_FMT_YUV444P9LE:
+ case AV_PIX_FMT_YUV444P9BE:
+ case AV_PIX_FMT_YUV444P10LE:
+ case AV_PIX_FMT_YUV444P10BE:
+ case AV_PIX_FMT_GBRP9LE:
+ case AV_PIX_FMT_GBRP9BE:
+ case AV_PIX_FMT_GBRP10LE:
+ case AV_PIX_FMT_GBRP10BE:
w_align = 16; //FIXME assume 16 pixel per macroblock
h_align = 16 * 2; // interlaced needs 2 macroblocks height
break;
- case PIX_FMT_YUV411P:
- case PIX_FMT_UYYVYY411:
- w_align=32;
- h_align=8;
+ case AV_PIX_FMT_YUV411P:
+ case AV_PIX_FMT_UYYVYY411:
+ w_align = 32;
+ h_align = 8;
break;
- case PIX_FMT_YUV410P:
- if(s->codec_id == CODEC_ID_SVQ1){
- w_align=64;
- h_align=64;
+ case AV_PIX_FMT_YUV410P:
+ if (s->codec_id == AV_CODEC_ID_SVQ1) {
+ w_align = 64;
+ h_align = 64;
}
- case PIX_FMT_RGB555:
- if(s->codec_id == CODEC_ID_RPZA){
- w_align=4;
- h_align=4;
+ case AV_PIX_FMT_RGB555:
+ if (s->codec_id == AV_CODEC_ID_RPZA) {
+ w_align = 4;
+ h_align = 4;
}
- case PIX_FMT_PAL8:
- case PIX_FMT_BGR8:
- case PIX_FMT_RGB8:
- if(s->codec_id == CODEC_ID_SMC){
- w_align=4;
- h_align=4;
+ case AV_PIX_FMT_PAL8:
+ case AV_PIX_FMT_BGR8:
+ case AV_PIX_FMT_RGB8:
+ if (s->codec_id == AV_CODEC_ID_SMC) {
+ w_align = 4;
+ h_align = 4;
}
break;
- case PIX_FMT_BGR24:
- if((s->codec_id == CODEC_ID_MSZH) || (s->codec_id == CODEC_ID_ZLIB)){
- w_align=4;
- h_align=4;
+ case AV_PIX_FMT_BGR24:
+ if ((s->codec_id == AV_CODEC_ID_MSZH) ||
+ (s->codec_id == AV_CODEC_ID_ZLIB)) {
+ w_align = 4;
+ h_align = 4;
}
break;
default:
- w_align= 1;
- h_align= 1;
+ w_align = 1;
+ h_align = 1;
break;
}
- *width = FFALIGN(*width , w_align);
- *height= FFALIGN(*height, h_align);
- if(s->codec_id == CODEC_ID_H264 || s->lowres)
- *height+=2; // some of the optimized chroma MC reads one line too much
- // which is also done in mpeg decoders with lowres > 0
+ *width = FFALIGN(*width, w_align);
+ *height = FFALIGN(*height, h_align);
+ if (s->codec_id == AV_CODEC_ID_H264)
+ // some of the optimized chroma MC reads one line too much
+ *height += 2;
- for (i = 0; i < AV_NUM_DATA_POINTERS; i++)
+ for (i = 0; i < 4; i++)
linesize_align[i] = STRIDE_ALIGN;
-//STRIDE_ALIGN is 8 for SSE* but this does not work for SVQ1 chroma planes
-//we could change STRIDE_ALIGN to 16 for x86/sse but it would increase the
-//picture size unneccessarily in some cases. The solution here is not
-//pretty and better ideas are welcome!
-#if HAVE_MMX
- if(s->codec_id == CODEC_ID_SVQ1 || s->codec_id == CODEC_ID_VP5 ||
- s->codec_id == CODEC_ID_VP6 || s->codec_id == CODEC_ID_VP6F ||
- s->codec_id == CODEC_ID_VP6A) {
- for (i = 0; i < AV_NUM_DATA_POINTERS; i++)
- linesize_align[i] = 16;
- }
-#endif
}
-void avcodec_align_dimensions(AVCodecContext *s, int *width, int *height){
- int chroma_shift = av_pix_fmt_descriptors[s->pix_fmt].log2_chroma_w;
+void avcodec_align_dimensions(AVCodecContext *s, int *width, int *height)
+{
+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(s->pix_fmt);
+ int chroma_shift = desc->log2_chroma_w;
int linesize_align[AV_NUM_DATA_POINTERS];
int align;
+
avcodec_align_dimensions2(s, width, height, linesize_align);
- align = FFMAX(linesize_align[0], linesize_align[3]);
+ align = FFMAX(linesize_align[0], linesize_align[3]);
linesize_align[1] <<= chroma_shift;
linesize_align[2] <<= chroma_shift;
- align = FFMAX3(align, linesize_align[1], linesize_align[2]);
- *width=FFALIGN(*width, align);
+ align = FFMAX3(align, linesize_align[1], linesize_align[2]);
+ *width = FFALIGN(*width, align);
}
int avcodec_fill_audio_frame(AVFrame *frame, int nb_channels,
@@ -289,79 +300,30 @@ int avcodec_fill_audio_frame(AVFrame *frame, int nb_channels,
static int audio_get_buffer(AVCodecContext *avctx, AVFrame *frame)
{
AVCodecInternal *avci = avctx->internal;
- InternalBuffer *buf;
int buf_size, ret;
+ av_freep(&avci->audio_data);
buf_size = av_samples_get_buffer_size(NULL, avctx->channels,
frame->nb_samples, avctx->sample_fmt,
- 32);
+ 0);
if (buf_size < 0)
return AVERROR(EINVAL);
- /* allocate InternalBuffer if needed */
- if (!avci->buffer) {
- avci->buffer = av_mallocz(sizeof(InternalBuffer));
- if (!avci->buffer)
- return AVERROR(ENOMEM);
- }
- buf = avci->buffer;
-
- /* if there is a previously-used internal buffer, check its size and
- channel count to see if we can reuse it */
- if (buf->extended_data) {
- /* if current buffer is too small, free it */
- if (buf->extended_data[0] && buf_size > buf->audio_data_size) {
- av_free(buf->extended_data[0]);
- if (buf->extended_data != buf->data)
- av_free(&buf->extended_data);
- buf->extended_data = NULL;
- buf->data[0] = NULL;
- }
- /* if number of channels has changed, reset and/or free extended data
- pointers but leave data buffer in buf->data[0] for reuse */
- if (buf->nb_channels != avctx->channels) {
- if (buf->extended_data != buf->data)
- av_free(buf->extended_data);
- buf->extended_data = NULL;
- }
- }
-
- /* if there is no previous buffer or the previous buffer cannot be used
- as-is, allocate a new buffer and/or rearrange the channel pointers */
- if (!buf->extended_data) {
- if (!buf->data[0]) {
- if (!(buf->data[0] = av_mallocz(buf_size)))
- return AVERROR(ENOMEM);
- buf->audio_data_size = buf_size;
- }
- if ((ret = avcodec_fill_audio_frame(frame, avctx->channels,
- avctx->sample_fmt, buf->data[0],
- buf->audio_data_size, 32)))
- return ret;
+ frame->data[0] = av_mallocz(buf_size);
+ if (!frame->data[0])
+ return AVERROR(ENOMEM);
- if (frame->extended_data == frame->data)
- buf->extended_data = buf->data;
- else
- buf->extended_data = frame->extended_data;
- memcpy(buf->data, frame->data, sizeof(frame->data));
- buf->linesize[0] = frame->linesize[0];
- buf->nb_channels = avctx->channels;
- } else {
- /* copy InternalBuffer info to the AVFrame */
- frame->extended_data = buf->extended_data;
- frame->linesize[0] = buf->linesize[0];
- memcpy(frame->data, buf->data, sizeof(frame->data));
+ ret = avcodec_fill_audio_frame(frame, avctx->channels, avctx->sample_fmt,
+ frame->data[0], buf_size, 0);
+ if (ret < 0) {
+ av_freep(&frame->data[0]);
+ return ret;
}
- frame->type = FF_BUFFER_TYPE_INTERNAL;
-
- if (avctx->pkt) frame->pkt_pts = avctx->pkt->pts;
- else frame->pkt_pts = AV_NOPTS_VALUE;
- frame->reordered_opaque = avctx->reordered_opaque;
-
+ avci->audio_data = frame->data[0];
if (avctx->debug & FF_DEBUG_BUFFERS)
av_log(avctx, AV_LOG_DEBUG, "default_get_buffer called on frame %p, "
- "internal audio buffer used\n", frame);
+ "internal audio buffer used\n", frame);
return 0;
}
@@ -369,58 +331,55 @@ static int audio_get_buffer(AVCodecContext *avctx, AVFrame *frame)
static int video_get_buffer(AVCodecContext *s, AVFrame *pic)
{
int i;
- int w= s->width;
- int h= s->height;
+ int w = s->width;
+ int h = s->height;
InternalBuffer *buf;
AVCodecInternal *avci = s->internal;
- if(pic->data[0]!=NULL) {
+ if (pic->data[0] != NULL) {
av_log(s, AV_LOG_ERROR, "pic->data[0]!=NULL in avcodec_default_get_buffer\n");
return -1;
}
- if(avci->buffer_count >= INTERNAL_BUFFER_SIZE) {
+ if (avci->buffer_count >= INTERNAL_BUFFER_SIZE) {
av_log(s, AV_LOG_ERROR, "buffer_count overflow (missing release_buffer?)\n");
return -1;
}
- if(av_image_check_size(w, h, 0, s))
+ if (av_image_check_size(w, h, 0, s))
return -1;
if (!avci->buffer) {
- avci->buffer = av_mallocz((INTERNAL_BUFFER_SIZE+1) *
+ avci->buffer = av_mallocz((INTERNAL_BUFFER_SIZE + 1) *
sizeof(InternalBuffer));
}
buf = &avci->buffer[avci->buffer_count];
- if(buf->base[0] && (buf->width != w || buf->height != h || buf->pix_fmt != s->pix_fmt)){
- if(s->active_thread_type&FF_THREAD_FRAME) {
- av_log_missing_feature(s, "Width/height changing with frame threads is", 0);
- return -1;
- }
-
+ if (buf->base[0] && (buf->width != w || buf->height != h || buf->pix_fmt != s->pix_fmt)) {
for (i = 0; i < AV_NUM_DATA_POINTERS; i++) {
av_freep(&buf->base[i]);
- buf->data[i]= NULL;
+ buf->data[i] = NULL;
}
}
if (!buf->base[0]) {
int h_chroma_shift, v_chroma_shift;
- int size[4] = {0};
+ int size[4] = { 0 };
int tmpsize;
int unaligned;
AVPicture picture;
int stride_align[AV_NUM_DATA_POINTERS];
- const int pixel_size = av_pix_fmt_descriptors[s->pix_fmt].comp[0].step_minus1+1;
+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(s->pix_fmt);
+ const int pixel_size = desc->comp[0].step_minus1 + 1;
- avcodec_get_chroma_sub_sample(s->pix_fmt, &h_chroma_shift, &v_chroma_shift);
+ av_pix_fmt_get_chroma_sub_sample(s->pix_fmt, &h_chroma_shift,
+ &v_chroma_shift);
avcodec_align_dimensions2(s, &w, &h, stride_align);
- if(!(s->flags&CODEC_FLAG_EMU_EDGE)){
- w+= EDGE_WIDTH*2;
- h+= EDGE_WIDTH*2;
+ if (!(s->flags & CODEC_FLAG_EMU_EDGE)) {
+ w += EDGE_WIDTH * 2;
+ h += EDGE_WIDTH * 2;
}
do {
@@ -428,74 +387,70 @@ static int video_get_buffer(AVCodecContext *s, AVFrame *pic)
// that linesize[0] == 2*linesize[1] in the MPEG-encoder for 4:2:2
av_image_fill_linesizes(picture.linesize, s->pix_fmt, w);
// increase alignment of w for next try (rhs gives the lowest bit set in w)
- w += w & ~(w-1);
+ w += w & ~(w - 1);
unaligned = 0;
- for (i=0; i<4; i++){
+ for (i = 0; i < 4; i++)
unaligned |= picture.linesize[i] % stride_align[i];
- }
} while (unaligned);
tmpsize = av_image_fill_pointers(picture.data, s->pix_fmt, h, NULL, picture.linesize);
if (tmpsize < 0)
return -1;
- for (i=0; i<3 && picture.data[i+1]; i++)
- size[i] = picture.data[i+1] - picture.data[i];
+ for (i = 0; i < 3 && picture.data[i + 1]; i++)
+ size[i] = picture.data[i + 1] - picture.data[i];
size[i] = tmpsize - (picture.data[i] - picture.data[0]);
memset(buf->base, 0, sizeof(buf->base));
memset(buf->data, 0, sizeof(buf->data));
- for(i=0; i<4 && size[i]; i++){
- const int h_shift= i==0 ? 0 : h_chroma_shift;
- const int v_shift= i==0 ? 0 : v_chroma_shift;
+ for (i = 0; i < 4 && size[i]; i++) {
+ const int h_shift = i == 0 ? 0 : h_chroma_shift;
+ const int v_shift = i == 0 ? 0 : v_chroma_shift;
- buf->linesize[i]= picture.linesize[i];
+ buf->linesize[i] = picture.linesize[i];
- buf->base[i]= av_malloc(size[i]+16); //FIXME 16
- if(buf->base[i]==NULL) return -1;
+ buf->base[i] = av_malloc(size[i] + 16); //FIXME 16
+ if (buf->base[i] == NULL)
+ return -1;
memset(buf->base[i], 128, size[i]);
// no edge if EDGE EMU or not planar YUV
- if((s->flags&CODEC_FLAG_EMU_EDGE) || !size[2])
+ if ((s->flags & CODEC_FLAG_EMU_EDGE) || !size[2])
buf->data[i] = buf->base[i];
else
- buf->data[i] = buf->base[i] + FFALIGN((buf->linesize[i]*EDGE_WIDTH>>v_shift) + (pixel_size*EDGE_WIDTH>>h_shift), stride_align[i]);
+ buf->data[i] = buf->base[i] + FFALIGN((buf->linesize[i] * EDGE_WIDTH >> v_shift) + (pixel_size * EDGE_WIDTH >> h_shift), stride_align[i]);
}
for (; i < AV_NUM_DATA_POINTERS; i++) {
- buf->base[i] = buf->data[i] = NULL;
+ buf->base[i] = buf->data[i] = NULL;
buf->linesize[i] = 0;
}
- if(size[1] && !size[2])
- ff_set_systematic_pal2((uint32_t*)buf->data[1], s->pix_fmt);
- buf->width = s->width;
- buf->height = s->height;
- buf->pix_fmt= s->pix_fmt;
+ if (size[1] && !size[2])
+ avpriv_set_systematic_pal2((uint32_t *)buf->data[1], s->pix_fmt);
+ buf->width = s->width;
+ buf->height = s->height;
+ buf->pix_fmt = s->pix_fmt;
}
- pic->type= FF_BUFFER_TYPE_INTERNAL;
for (i = 0; i < AV_NUM_DATA_POINTERS; i++) {
- pic->base[i]= buf->base[i];
- pic->data[i]= buf->data[i];
- pic->linesize[i]= buf->linesize[i];
+ pic->base[i] = buf->base[i];
+ pic->data[i] = buf->data[i];
+ pic->linesize[i] = buf->linesize[i];
}
pic->extended_data = pic->data;
avci->buffer_count++;
- if(s->pkt) pic->pkt_pts= s->pkt->pts;
- else pic->pkt_pts= AV_NOPTS_VALUE;
- pic->reordered_opaque= s->reordered_opaque;
-
- if(s->debug&FF_DEBUG_BUFFERS)
+ if (s->debug & FF_DEBUG_BUFFERS)
av_log(s, AV_LOG_DEBUG, "default_get_buffer called on pic %p, %d "
- "buffers used\n", pic, avci->buffer_count);
+ "buffers used\n", pic, avci->buffer_count);
return 0;
}
int avcodec_default_get_buffer(AVCodecContext *avctx, AVFrame *frame)
{
+ frame->type = FF_BUFFER_TYPE_INTERNAL;
switch (avctx->codec_type) {
case AVMEDIA_TYPE_VIDEO:
return video_get_buffer(avctx, frame);
@@ -506,14 +461,38 @@ int avcodec_default_get_buffer(AVCodecContext *avctx, AVFrame *frame)
}
}
-void avcodec_default_release_buffer(AVCodecContext *s, AVFrame *pic){
+int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame)
+{
+ switch (avctx->codec_type) {
+ case AVMEDIA_TYPE_VIDEO:
+ frame->width = avctx->width;
+ frame->height = avctx->height;
+ frame->format = avctx->pix_fmt;
+ frame->sample_aspect_ratio = avctx->sample_aspect_ratio;
+ break;
+ case AVMEDIA_TYPE_AUDIO:
+ frame->sample_rate = avctx->sample_rate;
+ frame->format = avctx->sample_fmt;
+ frame->channel_layout = avctx->channel_layout;
+ break;
+ default: return AVERROR(EINVAL);
+ }
+
+ frame->pkt_pts = avctx->pkt ? avctx->pkt->pts : AV_NOPTS_VALUE;
+ frame->reordered_opaque = avctx->reordered_opaque;
+
+ return avctx->get_buffer(avctx, frame);
+}
+
+void avcodec_default_release_buffer(AVCodecContext *s, AVFrame *pic)
+{
int i;
InternalBuffer *buf, *last;
AVCodecInternal *avci = s->internal;
assert(s->codec_type == AVMEDIA_TYPE_VIDEO);
- assert(pic->type==FF_BUFFER_TYPE_INTERNAL);
+ assert(pic->type == FF_BUFFER_TYPE_INTERNAL);
assert(avci->buffer_count);
if (avci->buffer) {
@@ -531,35 +510,38 @@ void avcodec_default_release_buffer(AVCodecContext *s, AVFrame *pic){
FFSWAP(InternalBuffer, *buf, *last);
}
- for (i = 0; i < AV_NUM_DATA_POINTERS; i++) {
- pic->data[i]=NULL;
+ for (i = 0; i < AV_NUM_DATA_POINTERS; i++)
+ pic->data[i] = NULL;
// pic->base[i]=NULL;
- }
-//printf("R%X\n", pic->opaque);
- if(s->debug&FF_DEBUG_BUFFERS)
+ if (s->debug & FF_DEBUG_BUFFERS)
av_log(s, AV_LOG_DEBUG, "default_release_buffer called on pic %p, %d "
- "buffers used\n", pic, avci->buffer_count);
+ "buffers used\n", pic, avci->buffer_count);
}
-int avcodec_default_reget_buffer(AVCodecContext *s, AVFrame *pic){
+int avcodec_default_reget_buffer(AVCodecContext *s, AVFrame *pic)
+{
AVFrame temp_pic;
int i;
assert(s->codec_type == AVMEDIA_TYPE_VIDEO);
/* If no picture return a new buffer */
- if(pic->data[0] == NULL) {
+ if (pic->data[0] == NULL) {
/* We will copy from buffer, so must be readable */
pic->buffer_hints |= FF_BUFFER_HINTS_READABLE;
- return s->get_buffer(s, pic);
+ return ff_get_buffer(s, pic);
}
+ assert(s->pix_fmt == pic->format);
+
/* If internal buffer type return the same buffer */
- if(pic->type == FF_BUFFER_TYPE_INTERNAL) {
- if(s->pkt) pic->pkt_pts= s->pkt->pts;
- else pic->pkt_pts= AV_NOPTS_VALUE;
- pic->reordered_opaque= s->reordered_opaque;
+ if (pic->type == FF_BUFFER_TYPE_INTERNAL) {
+ if (s->pkt)
+ pic->pkt_pts = s->pkt->pts;
+ else
+ pic->pkt_pts = AV_NOPTS_VALUE;
+ pic->reordered_opaque = s->reordered_opaque;
return 0;
}
@@ -567,72 +549,98 @@ int avcodec_default_reget_buffer(AVCodecContext *s, AVFrame *pic){
* Not internal type and reget_buffer not overridden, emulate cr buffer
*/
temp_pic = *pic;
- for(i = 0; i < AV_NUM_DATA_POINTERS; i++)
+ for (i = 0; i < AV_NUM_DATA_POINTERS; i++)
pic->data[i] = pic->base[i] = NULL;
pic->opaque = NULL;
/* Allocate new frame */
- if (s->get_buffer(s, pic))
+ if (ff_get_buffer(s, pic))
return -1;
/* Copy image data from old buffer to new buffer */
- av_picture_copy((AVPicture*)pic, (AVPicture*)&temp_pic, s->pix_fmt, s->width,
- s->height);
+ av_picture_copy((AVPicture *)pic, (AVPicture *)&temp_pic, s->pix_fmt, s->width,
+ s->height);
s->release_buffer(s, &temp_pic); // Release old frame
return 0;
}
-int avcodec_default_execute(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2),void *arg, int *ret, int count, int size){
+int avcodec_default_execute(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2), void *arg, int *ret, int count, int size)
+{
int i;
- for(i=0; i<count; i++){
- int r= func(c, (char*)arg + i*size);
- if(ret) ret[i]= r;
+ for (i = 0; i < count; i++) {
+ int r = func(c, (char *)arg + i * size);
+ if (ret)
+ ret[i] = r;
}
return 0;
}
-int avcodec_default_execute2(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2, int jobnr, int threadnr),void *arg, int *ret, int count){
+int avcodec_default_execute2(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2, int jobnr, int threadnr), void *arg, int *ret, int count)
+{
int i;
- for(i=0; i<count; i++){
- int r= func(c, arg, i, 0);
- if(ret) ret[i]= r;
+ for (i = 0; i < count; i++) {
+ int r = func(c, arg, i, 0);
+ if (ret)
+ ret[i] = r;
}
return 0;
}
-enum PixelFormat avcodec_default_get_format(struct AVCodecContext *s, const enum PixelFormat *fmt){
- while (*fmt != PIX_FMT_NONE && ff_is_hwaccel_pix_fmt(*fmt))
+static int is_hwaccel_pix_fmt(enum AVPixelFormat pix_fmt)
+{
+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
+ return desc->flags & PIX_FMT_HWACCEL;
+}
+
+enum AVPixelFormat avcodec_default_get_format(struct AVCodecContext *s, const enum AVPixelFormat *fmt)
+{
+ while (*fmt != AV_PIX_FMT_NONE && is_hwaccel_pix_fmt(*fmt))
++fmt;
return fmt[0];
}
-void avcodec_get_frame_defaults(AVFrame *pic){
- memset(pic, 0, sizeof(AVFrame));
+void avcodec_get_frame_defaults(AVFrame *frame)
+{
+ if (frame->extended_data != frame->data)
+ av_freep(&frame->extended_data);
+
+ memset(frame, 0, sizeof(AVFrame));
- pic->pts= AV_NOPTS_VALUE;
- pic->key_frame= 1;
- pic->sample_aspect_ratio = (AVRational){0, 1};
- pic->format = -1; /* unknown */
+ frame->pts = AV_NOPTS_VALUE;
+ frame->key_frame = 1;
+ frame->sample_aspect_ratio = (AVRational) {0, 1 };
+ frame->format = -1; /* unknown */
+ frame->extended_data = frame->data;
}
-AVFrame *avcodec_alloc_frame(void){
- AVFrame *pic= av_malloc(sizeof(AVFrame));
+AVFrame *avcodec_alloc_frame(void)
+{
+ AVFrame *frame = av_mallocz(sizeof(AVFrame));
- if(pic==NULL) return NULL;
+ if (frame == NULL)
+ return NULL;
- avcodec_get_frame_defaults(pic);
+ avcodec_get_frame_defaults(frame);
- return pic;
+ return frame;
}
-#if FF_API_AVCODEC_OPEN
-int attribute_align_arg avcodec_open(AVCodecContext *avctx, AVCodec *codec)
+void avcodec_free_frame(AVFrame **frame)
{
- return avcodec_open2(avctx, codec, NULL);
+ AVFrame *f;
+
+ if (!frame || !*frame)
+ return;
+
+ f = *frame;
+
+ if (f->extended_data != f->data)
+ av_freep(&f->extended_data);
+
+ av_freep(frame);
}
-#endif
-int attribute_align_arg avcodec_open2(AVCodecContext *avctx, AVCodec *codec, AVDictionary **options)
+int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *codec, AVDictionary **options)
{
int ret = 0;
AVDictionary *tmp = NULL;
@@ -646,7 +654,7 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, AVCodec *codec, AVD
}
if ((codec && avctx->codec && codec != avctx->codec)) {
av_log(avctx, AV_LOG_ERROR, "This AVCodecContext was allocated for %s, "
- "but %s passed to avcodec_open2().\n", avctx->codec->name, codec->name);
+ "but %s passed to avcodec_open2().\n", avctx->codec->name, codec->name);
return AVERROR(EINVAL);
}
if (!codec)
@@ -665,7 +673,7 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, AVCodec *codec, AVD
}
entangled_thread_counter++;
- if(entangled_thread_counter != 1){
+ if (entangled_thread_counter != 1) {
av_log(avctx, AV_LOG_ERROR, "insufficient thread locking around avcodec_open/close()\n");
ret = -1;
goto end;
@@ -678,28 +686,28 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, AVCodec *codec, AVD
}
if (codec->priv_data_size > 0) {
- if(!avctx->priv_data){
- avctx->priv_data = av_mallocz(codec->priv_data_size);
if (!avctx->priv_data) {
- ret = AVERROR(ENOMEM);
- goto end;
- }
- if (codec->priv_class) {
- *(AVClass**)avctx->priv_data= codec->priv_class;
- av_opt_set_defaults(avctx->priv_data);
+ avctx->priv_data = av_mallocz(codec->priv_data_size);
+ if (!avctx->priv_data) {
+ ret = AVERROR(ENOMEM);
+ goto end;
+ }
+ if (codec->priv_class) {
+ *(const AVClass **)avctx->priv_data = codec->priv_class;
+ av_opt_set_defaults(avctx->priv_data);
+ }
}
- }
- if (codec->priv_class && (ret = av_opt_set_dict(avctx->priv_data, &tmp)) < 0)
- goto free_and_end;
+ if (codec->priv_class && (ret = av_opt_set_dict(avctx->priv_data, &tmp)) < 0)
+ goto free_and_end;
} else {
avctx->priv_data = NULL;
}
if ((ret = av_opt_set_dict(avctx, &tmp)) < 0)
goto free_and_end;
- if(avctx->coded_width && avctx->coded_height)
+ if (avctx->coded_width && avctx->coded_height)
avcodec_set_dimensions(avctx, avctx->coded_width, avctx->coded_height);
- else if(avctx->width && avctx->height)
+ else if (avctx->width && avctx->height)
avcodec_set_dimensions(avctx, avctx->width, avctx->height);
if ((avctx->coded_width || avctx->coded_height || avctx->width || avctx->height)
@@ -710,39 +718,34 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, AVCodec *codec, AVD
}
/* if the decoder init function was already called previously,
- free the already allocated subtitle_header before overwriting it */
- if (codec_is_decoder(codec))
+ * free the already allocated subtitle_header before overwriting it */
+ if (av_codec_is_decoder(codec))
av_freep(&avctx->subtitle_header);
-#define SANE_NB_CHANNELS 128U
- if (avctx->channels > SANE_NB_CHANNELS) {
+ if (avctx->channels > FF_SANE_NB_CHANNELS) {
ret = AVERROR(EINVAL);
goto free_and_end;
}
avctx->codec = codec;
if ((avctx->codec_type == AVMEDIA_TYPE_UNKNOWN || avctx->codec_type == codec->type) &&
- avctx->codec_id == CODEC_ID_NONE) {
+ avctx->codec_id == AV_CODEC_ID_NONE) {
avctx->codec_type = codec->type;
avctx->codec_id = codec->id;
}
if (avctx->codec_id != codec->id || (avctx->codec_type != codec->type
- && avctx->codec_type != AVMEDIA_TYPE_ATTACHMENT)) {
+ && avctx->codec_type != AVMEDIA_TYPE_ATTACHMENT)) {
av_log(avctx, AV_LOG_ERROR, "codec type or id mismatches\n");
ret = AVERROR(EINVAL);
goto free_and_end;
}
avctx->frame_number = 0;
-#if FF_API_ER
-
- av_log(avctx, AV_LOG_DEBUG, "err{or,}_recognition separate: %d; %d\n",
- avctx->error_recognition, avctx->err_recognition);
- /* FF_ER_CAREFUL (==1) implies AV_EF_CRCCHECK (== 1<<1 - 1),
- FF_ER_COMPLIANT (==2) implies AV_EF_{CRCCHECK,BITSTREAM} (== 1<<2 - 1), et cetera} */
- avctx->err_recognition |= (1<<(avctx->error_recognition-(avctx->error_recognition>=FF_ER_VERY_AGGRESSIVE))) - 1;
- av_log(avctx, AV_LOG_DEBUG, "err{or,}_recognition combined: %d; %d\n",
- avctx->error_recognition, avctx->err_recognition);
-#endif
+
+ if (avctx->codec->capabilities & CODEC_CAP_EXPERIMENTAL &&
+ avctx->strict_std_compliance > FF_COMPLIANCE_EXPERIMENTAL) {
+ ret = AVERROR_EXPERIMENTAL;
+ goto free_and_end;
+ }
if (avctx->codec_type == AVMEDIA_TYPE_AUDIO &&
(!avctx->time_base.num || !avctx->time_base.den)) {
@@ -759,24 +762,35 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, AVCodec *codec, AVD
if (!HAVE_THREADS && !(codec->capabilities & CODEC_CAP_AUTO_THREADS))
avctx->thread_count = 1;
- if (avctx->codec->max_lowres < avctx->lowres) {
- av_log(avctx, AV_LOG_ERROR, "The maximum value for lowres supported by the decoder is %d\n",
- avctx->codec->max_lowres);
- ret = AVERROR(EINVAL);
- goto free_and_end;
- }
- if (codec_is_encoder(avctx->codec)) {
+ if (av_codec_is_encoder(avctx->codec)) {
int i;
if (avctx->codec->sample_fmts) {
- for (i = 0; avctx->codec->sample_fmts[i] != AV_SAMPLE_FMT_NONE; i++)
+ for (i = 0; avctx->codec->sample_fmts[i] != AV_SAMPLE_FMT_NONE; i++) {
if (avctx->sample_fmt == avctx->codec->sample_fmts[i])
break;
+ if (avctx->channels == 1 &&
+ av_get_planar_sample_fmt(avctx->sample_fmt) ==
+ av_get_planar_sample_fmt(avctx->codec->sample_fmts[i])) {
+ avctx->sample_fmt = avctx->codec->sample_fmts[i];
+ break;
+ }
+ }
if (avctx->codec->sample_fmts[i] == AV_SAMPLE_FMT_NONE) {
av_log(avctx, AV_LOG_ERROR, "Specified sample_fmt is not supported.\n");
ret = AVERROR(EINVAL);
goto free_and_end;
}
}
+ if (avctx->codec->pix_fmts) {
+ for (i = 0; avctx->codec->pix_fmts[i] != AV_PIX_FMT_NONE; i++)
+ if (avctx->pix_fmt == avctx->codec->pix_fmts[i])
+ break;
+ if (avctx->codec->pix_fmts[i] == AV_PIX_FMT_NONE) {
+ av_log(avctx, AV_LOG_ERROR, "Specified pix_fmt is not supported\n");
+ ret = AVERROR(EINVAL);
+ goto free_and_end;
+ }
+ }
if (avctx->codec->supported_samplerates) {
for (i = 0; avctx->codec->supported_samplerates[i] != 0; i++)
if (avctx->sample_rate == avctx->codec->supported_samplerates[i])
@@ -810,14 +824,36 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, AVCodec *codec, AVD
} else if (avctx->channel_layout) {
avctx->channels = av_get_channel_layout_nb_channels(avctx->channel_layout);
}
+
+ if (!avctx->rc_initial_buffer_occupancy)
+ avctx->rc_initial_buffer_occupancy = avctx->rc_buffer_size * 3 / 4;
}
- if(avctx->codec->init && !(avctx->active_thread_type&FF_THREAD_FRAME)){
+ if (avctx->codec->init && !(avctx->active_thread_type & FF_THREAD_FRAME)) {
ret = avctx->codec->init(avctx);
if (ret < 0) {
goto free_and_end;
}
}
+
+ if (av_codec_is_decoder(avctx->codec)) {
+ /* validate channel layout from the decoder */
+ if (avctx->channel_layout) {
+ int channels = av_get_channel_layout_nb_channels(avctx->channel_layout);
+ if (!avctx->channels)
+ avctx->channels = channels;
+ else if (channels != avctx->channels) {
+ av_log(avctx, AV_LOG_WARNING,
+ "channel layout does not match number of channels\n");
+ avctx->channel_layout = 0;
+ }
+ }
+ if (avctx->channels && avctx->channels < 0 ||
+ avctx->channels > FF_SANE_NB_CHANNELS) {
+ ret = AVERROR(EINVAL);
+ goto free_and_end;
+ }
+ }
end:
entangled_thread_counter--;
@@ -835,7 +871,7 @@ free_and_end:
av_dict_free(&tmp);
av_freep(&avctx->priv_data);
av_freep(&avctx->internal);
- avctx->codec= NULL;
+ avctx->codec = NULL;
goto end;
}
@@ -845,143 +881,176 @@ int ff_alloc_packet(AVPacket *avpkt, int size)
return AVERROR(EINVAL);
if (avpkt->data) {
- uint8_t *pkt_data;
- int pkt_size;
+ void *destruct = avpkt->destruct;
if (avpkt->size < size)
return AVERROR(EINVAL);
- pkt_data = avpkt->data;
- pkt_size = avpkt->size;
av_init_packet(avpkt);
- avpkt->data = pkt_data;
- avpkt->size = pkt_size;
+ avpkt->destruct = destruct;
+ avpkt->size = size;
return 0;
} else {
return av_new_packet(avpkt, size);
}
}
+/**
+ * Pad last frame with silence.
+ */
+static int pad_last_frame(AVCodecContext *s, AVFrame **dst, const AVFrame *src)
+{
+ AVFrame *frame = NULL;
+ uint8_t *buf = NULL;
+ int ret;
+
+ if (!(frame = avcodec_alloc_frame()))
+ return AVERROR(ENOMEM);
+ *frame = *src;
+
+ if ((ret = av_samples_get_buffer_size(&frame->linesize[0], s->channels,
+ s->frame_size, s->sample_fmt, 0)) < 0)
+ goto fail;
+
+ if (!(buf = av_malloc(ret))) {
+ ret = AVERROR(ENOMEM);
+ goto fail;
+ }
+
+ frame->nb_samples = s->frame_size;
+ if ((ret = avcodec_fill_audio_frame(frame, s->channels, s->sample_fmt,
+ buf, ret, 0)) < 0)
+ goto fail;
+ if ((ret = av_samples_copy(frame->extended_data, src->extended_data, 0, 0,
+ src->nb_samples, s->channels, s->sample_fmt)) < 0)
+ goto fail;
+ if ((ret = av_samples_set_silence(frame->extended_data, src->nb_samples,
+ frame->nb_samples - src->nb_samples,
+ s->channels, s->sample_fmt)) < 0)
+ goto fail;
+
+ *dst = frame;
+
+ return 0;
+
+fail:
+ if (frame->extended_data != frame->data)
+ av_freep(&frame->extended_data);
+ av_freep(&buf);
+ av_freep(&frame);
+ return ret;
+}
+
int attribute_align_arg avcodec_encode_audio2(AVCodecContext *avctx,
AVPacket *avpkt,
const AVFrame *frame,
int *got_packet_ptr)
{
+ AVFrame tmp;
+ AVFrame *padded_frame = NULL;
int ret;
int user_packet = !!avpkt->data;
- int nb_samples;
+
+ *got_packet_ptr = 0;
if (!(avctx->codec->capabilities & CODEC_CAP_DELAY) && !frame) {
+ av_free_packet(avpkt);
av_init_packet(avpkt);
- avpkt->size = 0;
return 0;
}
+ /* ensure that extended_data is properly set */
+ if (frame && !frame->extended_data) {
+ if (av_sample_fmt_is_planar(avctx->sample_fmt) &&
+ avctx->channels > AV_NUM_DATA_POINTERS) {
+ av_log(avctx, AV_LOG_ERROR, "Encoding to a planar sample format, "
+ "with more than %d channels, but extended_data is not set.\n",
+ AV_NUM_DATA_POINTERS);
+ return AVERROR(EINVAL);
+ }
+ av_log(avctx, AV_LOG_WARNING, "extended_data is not set.\n");
+
+ tmp = *frame;
+ tmp.extended_data = tmp.data;
+ frame = &tmp;
+ }
+
/* check for valid frame size */
if (frame) {
- nb_samples = frame->nb_samples;
if (avctx->codec->capabilities & CODEC_CAP_SMALL_LAST_FRAME) {
- if (nb_samples > avctx->frame_size)
+ if (frame->nb_samples > avctx->frame_size)
return AVERROR(EINVAL);
} else if (!(avctx->codec->capabilities & CODEC_CAP_VARIABLE_FRAME_SIZE)) {
- if (nb_samples != avctx->frame_size)
- return AVERROR(EINVAL);
- }
- } else {
- nb_samples = avctx->frame_size;
- }
-
- if (avctx->codec->encode2) {
- *got_packet_ptr = 0;
- ret = avctx->codec->encode2(avctx, avpkt, frame, got_packet_ptr);
- if (!ret && *got_packet_ptr &&
- !(avctx->codec->capabilities & CODEC_CAP_DELAY)) {
- avpkt->pts = frame->pts;
- avpkt->duration = av_rescale_q(frame->nb_samples,
- (AVRational){ 1, avctx->sample_rate },
- avctx->time_base);
- }
- } else {
- /* for compatibility with encoders not supporting encode2(), we need to
- allocate a packet buffer if the user has not provided one or check
- the size otherwise */
- int fs_tmp = 0;
- int buf_size = avpkt->size;
- if (!user_packet) {
- if (avctx->codec->capabilities & CODEC_CAP_VARIABLE_FRAME_SIZE) {
- av_assert0(av_get_bits_per_sample(avctx->codec_id) != 0);
- buf_size = nb_samples * avctx->channels *
- av_get_bits_per_sample(avctx->codec_id) / 8;
- } else {
- /* this is a guess as to the required size.
- if an encoder needs more than this, it should probably
- implement encode2() */
- buf_size = 2 * avctx->frame_size * avctx->channels *
- av_get_bytes_per_sample(avctx->sample_fmt);
- buf_size += FF_MIN_BUFFER_SIZE;
+ if (frame->nb_samples < avctx->frame_size &&
+ !avctx->internal->last_audio_frame) {
+ ret = pad_last_frame(avctx, &padded_frame, frame);
+ if (ret < 0)
+ return ret;
+
+ frame = padded_frame;
+ avctx->internal->last_audio_frame = 1;
}
- }
- if ((ret = ff_alloc_packet(avpkt, buf_size)))
- return ret;
- /* Encoders using AVCodec.encode() that support
- CODEC_CAP_SMALL_LAST_FRAME require avctx->frame_size to be set to
- the smaller size when encoding the last frame.
- This code can be removed once all encoders supporting
- CODEC_CAP_SMALL_LAST_FRAME use encode2() */
- if ((avctx->codec->capabilities & CODEC_CAP_SMALL_LAST_FRAME) &&
- nb_samples < avctx->frame_size) {
- fs_tmp = avctx->frame_size;
- avctx->frame_size = nb_samples;
+ if (frame->nb_samples != avctx->frame_size) {
+ ret = AVERROR(EINVAL);
+ goto end;
+ }
}
+ }
- /* encode the frame */
- ret = avctx->codec->encode(avctx, avpkt->data, avpkt->size,
- frame ? frame->data[0] : NULL);
- if (ret >= 0) {
- if (!ret) {
- /* no output. if the packet data was allocated by libavcodec,
- free it */
- if (!user_packet)
- av_freep(&avpkt->data);
- } else {
- if (avctx->coded_frame)
- avpkt->pts = avctx->coded_frame->pts;
- /* Set duration for final small packet. This can be removed
- once all encoders supporting CODEC_CAP_SMALL_LAST_FRAME use
- encode2() */
- if (fs_tmp) {
- avpkt->duration = av_rescale_q(avctx->frame_size,
- (AVRational){ 1, avctx->sample_rate },
- avctx->time_base);
- }
+ ret = avctx->codec->encode2(avctx, avpkt, frame, got_packet_ptr);
+ if (!ret) {
+ if (*got_packet_ptr) {
+ if (!(avctx->codec->capabilities & CODEC_CAP_DELAY)) {
+ if (avpkt->pts == AV_NOPTS_VALUE)
+ avpkt->pts = frame->pts;
+ if (!avpkt->duration)
+ avpkt->duration = ff_samples_to_time_base(avctx,
+ frame->nb_samples);
}
- avpkt->size = ret;
- *got_packet_ptr = (ret > 0);
- ret = 0;
+ avpkt->dts = avpkt->pts;
+ } else {
+ avpkt->size = 0;
+ }
+
+ if (!user_packet && avpkt->size) {
+ uint8_t *new_data = av_realloc(avpkt->data, avpkt->size);
+ if (new_data)
+ avpkt->data = new_data;
}
- if (fs_tmp)
- avctx->frame_size = fs_tmp;
- }
- if (!ret)
avctx->frame_number++;
+ }
+
+ if (ret < 0 || !*got_packet_ptr) {
+ av_free_packet(avpkt);
+ av_init_packet(avpkt);
+ goto end;
+ }
/* NOTE: if we add any audio encoders which output non-keyframe packets,
- this needs to be moved to the encoders, but for now we can do it
- here to simplify things */
+ * this needs to be moved to the encoders, but for now we can do it
+ * here to simplify things */
avpkt->flags |= AV_PKT_FLAG_KEY;
+end:
+ if (padded_frame) {
+ av_freep(&padded_frame->data[0]);
+ if (padded_frame->extended_data != padded_frame->data)
+ av_freep(&padded_frame->extended_data);
+ av_freep(&padded_frame);
+ }
+
return ret;
}
-#if FF_API_OLD_DECODE_AUDIO
+#if FF_API_OLD_ENCODE_AUDIO
int attribute_align_arg avcodec_encode_audio(AVCodecContext *avctx,
uint8_t *buf, int buf_size,
const short *samples)
{
AVPacket pkt;
- AVFrame frame0;
+ AVFrame frame0 = { { 0 } };
AVFrame *frame;
int ret, samples_size, got_packet;
@@ -997,37 +1066,37 @@ int attribute_align_arg avcodec_encode_audio(AVCodecContext *avctx,
frame->nb_samples = avctx->frame_size;
} else {
/* if frame_size is not set, the number of samples must be
- calculated from the buffer size */
+ * calculated from the buffer size */
int64_t nb_samples;
if (!av_get_bits_per_sample(avctx->codec_id)) {
av_log(avctx, AV_LOG_ERROR, "avcodec_encode_audio() does not "
- "support this codec\n");
+ "support this codec\n");
return AVERROR(EINVAL);
}
nb_samples = (int64_t)buf_size * 8 /
(av_get_bits_per_sample(avctx->codec_id) *
- avctx->channels);
+ avctx->channels);
if (nb_samples >= INT_MAX)
return AVERROR(EINVAL);
frame->nb_samples = nb_samples;
}
/* it is assumed that the samples buffer is large enough based on the
- relevant parameters */
+ * relevant parameters */
samples_size = av_samples_get_buffer_size(NULL, avctx->channels,
frame->nb_samples,
avctx->sample_fmt, 1);
if ((ret = avcodec_fill_audio_frame(frame, avctx->channels,
avctx->sample_fmt,
- samples, samples_size, 1)))
+ (const uint8_t *)samples,
+ samples_size, 1)))
return ret;
/* fabricate frame pts from sample count.
- this is needed because the avcodec_encode_audio() API does not have
- a way for the user to provide pts */
- frame->pts = av_rescale_q(avctx->internal->sample_count,
- (AVRational){ 1, avctx->sample_rate },
- avctx->time_base);
+ * this is needed because the avcodec_encode_audio() API does not have
+ * a way for the user to provide pts */
+ frame->pts = ff_samples_to_time_base(avctx,
+ avctx->internal->sample_count);
avctx->internal->sample_count += frame->nb_samples;
} else {
frame = NULL;
@@ -1053,38 +1122,101 @@ int attribute_align_arg avcodec_encode_audio(AVCodecContext *avctx,
return ret ? ret : pkt.size;
}
+
#endif
+#if FF_API_OLD_ENCODE_VIDEO
int attribute_align_arg avcodec_encode_video(AVCodecContext *avctx, uint8_t *buf, int buf_size,
- const AVFrame *pict)
+ const AVFrame *pict)
{
- if(buf_size < FF_MIN_BUFFER_SIZE){
+ AVPacket pkt;
+ int ret, got_packet = 0;
+
+ if (buf_size < FF_MIN_BUFFER_SIZE) {
av_log(avctx, AV_LOG_ERROR, "buffer smaller than minimum size\n");
return -1;
}
- if(av_image_check_size(avctx->width, avctx->height, 0, avctx))
- return -1;
- if((avctx->codec->capabilities & CODEC_CAP_DELAY) || pict){
- int ret = avctx->codec->encode(avctx, buf, buf_size, pict);
- avctx->frame_number++;
- emms_c(); //needed to avoid an emms_c() call before every return;
- return ret;
- }else
+ av_init_packet(&pkt);
+ pkt.data = buf;
+ pkt.size = buf_size;
+
+ ret = avcodec_encode_video2(avctx, &pkt, pict, &got_packet);
+ if (!ret && got_packet && avctx->coded_frame) {
+ avctx->coded_frame->pts = pkt.pts;
+ avctx->coded_frame->key_frame = !!(pkt.flags & AV_PKT_FLAG_KEY);
+ }
+
+ /* free any side data since we cannot return it */
+ if (pkt.side_data_elems > 0) {
+ int i;
+ for (i = 0; i < pkt.side_data_elems; i++)
+ av_free(pkt.side_data[i].data);
+ av_freep(&pkt.side_data);
+ pkt.side_data_elems = 0;
+ }
+
+ return ret ? ret : pkt.size;
+}
+
+#endif
+
+int attribute_align_arg avcodec_encode_video2(AVCodecContext *avctx,
+ AVPacket *avpkt,
+ const AVFrame *frame,
+ int *got_packet_ptr)
+{
+ int ret;
+ int user_packet = !!avpkt->data;
+
+ *got_packet_ptr = 0;
+
+ if (!(avctx->codec->capabilities & CODEC_CAP_DELAY) && !frame) {
+ av_free_packet(avpkt);
+ av_init_packet(avpkt);
+ avpkt->size = 0;
return 0;
+ }
+
+ if (av_image_check_size(avctx->width, avctx->height, 0, avctx))
+ return AVERROR(EINVAL);
+
+ av_assert0(avctx->codec->encode2);
+
+ ret = avctx->codec->encode2(avctx, avpkt, frame, got_packet_ptr);
+ if (!ret) {
+ if (!*got_packet_ptr)
+ avpkt->size = 0;
+ else if (!(avctx->codec->capabilities & CODEC_CAP_DELAY))
+ avpkt->pts = avpkt->dts = frame->pts;
+
+ if (!user_packet && avpkt->size) {
+ uint8_t *new_data = av_realloc(avpkt->data, avpkt->size);
+ if (new_data)
+ avpkt->data = new_data;
+ }
+
+ avctx->frame_number++;
+ }
+
+ if (ret < 0 || !*got_packet_ptr)
+ av_free_packet(avpkt);
+
+ emms_c();
+ return ret;
}
int avcodec_encode_subtitle(AVCodecContext *avctx, uint8_t *buf, int buf_size,
const AVSubtitle *sub)
{
int ret;
- if(sub->start_display_time) {
+ if (sub->start_display_time) {
av_log(avctx, AV_LOG_ERROR, "start_display_time must be 0.\n");
return -1;
}
- if(sub->num_rects == 0 || !sub->rects)
+ if (sub->num_rects == 0 || !sub->rects)
return -1;
- ret = avctx->codec->encode(avctx, buf, buf_size, sub);
+ ret = avctx->codec->encode_sub(avctx, buf, buf_size, sub);
avctx->frame_number++;
return ret;
}
@@ -1132,55 +1264,64 @@ static void apply_param_change(AVCodecContext *avctx, AVPacket *avpkt)
}
int attribute_align_arg avcodec_decode_video2(AVCodecContext *avctx, AVFrame *picture,
- int *got_picture_ptr,
- AVPacket *avpkt)
+ int *got_picture_ptr,
+ AVPacket *avpkt)
{
int ret;
- *got_picture_ptr= 0;
- if((avctx->coded_width||avctx->coded_height) && av_image_check_size(avctx->coded_width, avctx->coded_height, 0, avctx))
+ *got_picture_ptr = 0;
+ if ((avctx->coded_width || avctx->coded_height) && av_image_check_size(avctx->coded_width, avctx->coded_height, 0, avctx))
return -1;
avctx->pkt = avpkt;
apply_param_change(avctx, avpkt);
- if((avctx->codec->capabilities & CODEC_CAP_DELAY) || avpkt->size || (avctx->active_thread_type&FF_THREAD_FRAME)){
- if (HAVE_THREADS && avctx->active_thread_type&FF_THREAD_FRAME)
- ret = ff_thread_decode_frame(avctx, picture, got_picture_ptr,
- avpkt);
+ avcodec_get_frame_defaults(picture);
+
+ if ((avctx->codec->capabilities & CODEC_CAP_DELAY) || avpkt->size || (avctx->active_thread_type & FF_THREAD_FRAME)) {
+ if (HAVE_THREADS && avctx->active_thread_type & FF_THREAD_FRAME)
+ ret = ff_thread_decode_frame(avctx, picture, got_picture_ptr,
+ avpkt);
else {
ret = avctx->codec->decode(avctx, picture, got_picture_ptr,
- avpkt);
- picture->pkt_dts= avpkt->dts;
- picture->sample_aspect_ratio = avctx->sample_aspect_ratio;
- picture->width = avctx->width;
- picture->height = avctx->height;
- picture->format = avctx->pix_fmt;
+ avpkt);
+ picture->pkt_dts = avpkt->dts;
+ /* get_buffer is supposed to set frame parameters */
+ if (!(avctx->codec->capabilities & CODEC_CAP_DR1)) {
+ picture->sample_aspect_ratio = avctx->sample_aspect_ratio;
+ picture->width = avctx->width;
+ picture->height = avctx->height;
+ picture->format = avctx->pix_fmt;
+ }
}
emms_c(); //needed to avoid an emms_c() call before every return;
if (*got_picture_ptr)
avctx->frame_number++;
- }else
- ret= 0;
+ } else
+ ret = 0;
+
+ /* many decoders assign whole AVFrames, thus overwriting extended_data;
+ * make sure it's set correctly */
+ picture->extended_data = picture->data;
return ret;
}
#if FF_API_OLD_DECODE_AUDIO
int attribute_align_arg avcodec_decode_audio3(AVCodecContext *avctx, int16_t *samples,
- int *frame_size_ptr,
- AVPacket *avpkt)
+ int *frame_size_ptr,
+ AVPacket *avpkt)
{
- AVFrame frame;
+ AVFrame frame = { { 0 } };
int ret, got_frame = 0;
if (avctx->get_buffer != avcodec_default_get_buffer) {
av_log(avctx, AV_LOG_ERROR, "Custom get_buffer() for use with"
- "avcodec_decode_audio3() detected. Overriding with avcodec_default_get_buffer\n");
+ "avcodec_decode_audio3() detected. Overriding with avcodec_default_get_buffer\n");
av_log(avctx, AV_LOG_ERROR, "Please port your application to "
- "avcodec_decode_audio4()\n");
+ "avcodec_decode_audio4()\n");
avctx->get_buffer = avcodec_default_get_buffer;
}
@@ -1188,13 +1329,13 @@ int attribute_align_arg avcodec_decode_audio3(AVCodecContext *avctx, int16_t *sa
if (ret >= 0 && got_frame) {
int ch, plane_size;
- int planar = av_sample_fmt_is_planar(avctx->sample_fmt);
+ int planar = av_sample_fmt_is_planar(avctx->sample_fmt);
int data_size = av_samples_get_buffer_size(&plane_size, avctx->channels,
frame.nb_samples,
avctx->sample_fmt, 1);
if (*frame_size_ptr < data_size) {
av_log(avctx, AV_LOG_ERROR, "output buffer size is too small for "
- "the current frame (%d < %d)\n", *frame_size_ptr, data_size);
+ "the current frame (%d < %d)\n", *frame_size_ptr, data_size);
return AVERROR(EINVAL);
}
@@ -1213,6 +1354,7 @@ int attribute_align_arg avcodec_decode_audio3(AVCodecContext *avctx, int16_t *sa
}
return ret;
}
+
#endif
int attribute_align_arg avcodec_decode_audio4(AVCodecContext *avctx,
@@ -1220,6 +1362,7 @@ int attribute_align_arg avcodec_decode_audio4(AVCodecContext *avctx,
int *got_frame_ptr,
AVPacket *avpkt)
{
+ int planar, channels;
int ret = 0;
*got_frame_ptr = 0;
@@ -1233,6 +1376,8 @@ int attribute_align_arg avcodec_decode_audio4(AVCodecContext *avctx,
apply_param_change(avctx, avpkt);
+ avcodec_get_frame_defaults(frame);
+
if ((avctx->codec->capabilities & CODEC_CAP_DELAY) || avpkt->size) {
ret = avctx->codec->decode(avctx, frame, got_frame_ptr, avpkt);
if (ret >= 0 && *got_frame_ptr) {
@@ -1242,12 +1387,21 @@ int attribute_align_arg avcodec_decode_audio4(AVCodecContext *avctx,
frame->format = avctx->sample_fmt;
}
}
+
+ /* many decoders assign whole AVFrames, thus overwriting extended_data;
+ * make sure it's set correctly; assume decoders that actually use
+ * extended_data are doing it correctly */
+ planar = av_sample_fmt_is_planar(frame->format);
+ channels = av_get_channel_layout_nb_channels(frame->channel_layout);
+ if (!(planar && channels > AV_NUM_DATA_POINTERS))
+ frame->extended_data = frame->data;
+
return ret;
}
int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub,
- int *got_sub_ptr,
- AVPacket *avpkt)
+ int *got_sub_ptr,
+ AVPacket *avpkt)
{
int ret;
@@ -1263,8 +1417,7 @@ void avsubtitle_free(AVSubtitle *sub)
{
int i;
- for (i = 0; i < sub->num_rects; i++)
- {
+ for (i = 0; i < sub->num_rects; i++) {
av_freep(&sub->rects[i]->pict.data[0]);
av_freep(&sub->rects[i]->pict.data[1]);
av_freep(&sub->rects[i]->pict.data[2]);
@@ -1288,7 +1441,7 @@ av_cold int avcodec_close(AVCodecContext *avctx)
}
entangled_thread_counter++;
- if(entangled_thread_counter != 1){
+ if (entangled_thread_counter != 1) {
av_log(avctx, AV_LOG_ERROR, "insufficient thread locking around avcodec_open/close()\n");
entangled_thread_counter--;
return -1;
@@ -1308,7 +1461,7 @@ av_cold int avcodec_close(AVCodecContext *avctx)
av_opt_free(avctx->priv_data);
av_opt_free(avctx);
av_freep(&avctx->priv_data);
- if (codec_is_encoder(avctx->codec))
+ if (av_codec_is_encoder(avctx->codec))
av_freep(&avctx->extradata);
avctx->codec = NULL;
avctx->active_thread_type = 0;
@@ -1321,12 +1474,13 @@ av_cold int avcodec_close(AVCodecContext *avctx)
return 0;
}
-AVCodec *avcodec_find_encoder(enum CodecID id)
+static AVCodec *find_encdec(enum AVCodecID id, int encoder)
{
- AVCodec *p, *experimental=NULL;
+ AVCodec *p, *experimental = NULL;
p = first_avcodec;
while (p) {
- if (codec_is_encoder(p) && p->id == id) {
+ if ((encoder ? av_codec_is_encoder(p) : av_codec_is_decoder(p)) &&
+ p->id == id) {
if (p->capabilities & CODEC_CAP_EXPERIMENTAL && !experimental) {
experimental = p;
} else
@@ -1337,6 +1491,11 @@ AVCodec *avcodec_find_encoder(enum CodecID id)
return experimental;
}
+AVCodec *avcodec_find_encoder(enum AVCodecID id)
+{
+ return find_encdec(id, 1);
+}
+
AVCodec *avcodec_find_encoder_by_name(const char *name)
{
AVCodec *p;
@@ -1344,23 +1503,16 @@ AVCodec *avcodec_find_encoder_by_name(const char *name)
return NULL;
p = first_avcodec;
while (p) {
- if (codec_is_encoder(p) && strcmp(name,p->name) == 0)
+ if (av_codec_is_encoder(p) && strcmp(name, p->name) == 0)
return p;
p = p->next;
}
return NULL;
}
-AVCodec *avcodec_find_decoder(enum CodecID id)
+AVCodec *avcodec_find_decoder(enum AVCodecID id)
{
- AVCodec *p;
- p = first_avcodec;
- while (p) {
- if (codec_is_decoder(p) && p->id == id)
- return p;
- p = p->next;
- }
- return NULL;
+ return find_encdec(id, 0);
}
AVCodec *avcodec_find_decoder_by_name(const char *name)
@@ -1370,7 +1522,7 @@ AVCodec *avcodec_find_decoder_by_name(const char *name)
return NULL;
p = first_avcodec;
while (p) {
- if (codec_is_decoder(p) && strcmp(name,p->name) == 0)
+ if (av_codec_is_decoder(p) && strcmp(name, p->name) == 0)
return p;
p = p->next;
}
@@ -1382,7 +1534,7 @@ static int get_bit_rate(AVCodecContext *ctx)
int bit_rate;
int bits_per_sample;
- switch(ctx->codec_type) {
+ switch (ctx->codec_type) {
case AVMEDIA_TYPE_VIDEO:
case AVMEDIA_TYPE_DATA:
case AVMEDIA_TYPE_SUBTITLE:
@@ -1406,11 +1558,11 @@ size_t av_get_codec_tag_string(char *buf, size_t buf_size, unsigned int codec_ta
for (i = 0; i < 4; i++) {
len = snprintf(buf, buf_size,
- isprint(codec_tag&0xFF) ? "%c" : "[%d]", codec_tag&0xFF);
- buf += len;
- buf_size = buf_size > len ? buf_size - len : 0;
- ret += len;
- codec_tag>>=8;
+ isprint(codec_tag & 0xFF) ? "%c" : "[%d]", codec_tag & 0xFF);
+ buf += len;
+ buf_size = buf_size > len ? buf_size - len : 0;
+ ret += len;
+ codec_tag >>= 8;
}
return ret;
}
@@ -1419,12 +1571,14 @@ void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode)
{
const char *codec_name;
const char *profile = NULL;
- AVCodec *p;
+ const AVCodec *p;
char buf1[32];
int bitrate;
AVRational display_aspect_ratio;
- if (encode)
+ if (enc->codec)
+ p = enc->codec;
+ else if (encode)
p = avcodec_find_encoder(enc->codec_id);
else
p = avcodec_find_decoder(enc->codec_id);
@@ -1432,9 +1586,9 @@ void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode)
if (p) {
codec_name = p->name;
profile = av_get_profile_name(p, enc->profile);
- } else if (enc->codec_id == CODEC_ID_MPEG2TS) {
+ } else if (enc->codec_id == AV_CODEC_ID_MPEG2TS) {
/* fake mpeg2 transport stream codec (currently not
- registered) */
+ * registered) */
codec_name = "mpeg2ts";
} else if (enc->codec_name[0] != '\0') {
codec_name = enc->codec_name;
@@ -1446,7 +1600,7 @@ void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode)
codec_name = buf1;
}
- switch(enc->codec_type) {
+ switch (enc->codec_type) {
case AVMEDIA_TYPE_VIDEO:
snprintf(buf, buf_size,
"Video: %s%s",
@@ -1454,7 +1608,7 @@ void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode)
if (profile)
snprintf(buf + strlen(buf), buf_size - strlen(buf),
" (%s)", profile);
- if (enc->pix_fmt != PIX_FMT_NONE) {
+ if (enc->pix_fmt != AV_PIX_FMT_NONE) {
snprintf(buf + strlen(buf), buf_size - strlen(buf),
", %s",
av_get_pix_fmt_name(enc->pix_fmt));
@@ -1465,19 +1619,19 @@ void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode)
enc->width, enc->height);
if (enc->sample_aspect_ratio.num) {
av_reduce(&display_aspect_ratio.num, &display_aspect_ratio.den,
- enc->width*enc->sample_aspect_ratio.num,
- enc->height*enc->sample_aspect_ratio.den,
- 1024*1024);
+ enc->width * enc->sample_aspect_ratio.num,
+ enc->height * enc->sample_aspect_ratio.den,
+ 1024 * 1024);
snprintf(buf + strlen(buf), buf_size - strlen(buf),
" [PAR %d:%d DAR %d:%d]",
enc->sample_aspect_ratio.num, enc->sample_aspect_ratio.den,
display_aspect_ratio.num, display_aspect_ratio.den);
}
- if(av_log_get_level() >= AV_LOG_DEBUG){
- int g= av_gcd(enc->time_base.num, enc->time_base.den);
+ if (av_log_get_level() >= AV_LOG_DEBUG) {
+ int g = av_gcd(enc->time_base.num, enc->time_base.den);
snprintf(buf + strlen(buf), buf_size - strlen(buf),
- ", %d/%d",
- enc->time_base.num/g, enc->time_base.den/g);
+ ", %d/%d",
+ enc->time_base.num / g, enc->time_base.den / g);
}
}
if (encode) {
@@ -1544,9 +1698,9 @@ const char *av_get_profile_name(const AVCodec *codec, int profile)
return NULL;
}
-unsigned avcodec_version( void )
+unsigned avcodec_version(void)
{
- return LIBAVCODEC_VERSION_INT;
+ return LIBAVCODEC_VERSION_INT;
}
const char *avcodec_configuration(void)
@@ -1562,9 +1716,9 @@ const char *avcodec_license(void)
void avcodec_flush_buffers(AVCodecContext *avctx)
{
- if(HAVE_THREADS && avctx->active_thread_type&FF_THREAD_FRAME)
+ if (HAVE_THREADS && avctx->active_thread_type & FF_THREAD_FRAME)
ff_thread_flush(avctx);
- else if(avctx->codec->flush)
+ else if (avctx->codec->flush)
avctx->codec->flush(avctx);
}
@@ -1579,33 +1733,22 @@ static void video_free_buffers(AVCodecContext *s)
if (avci->buffer_count)
av_log(s, AV_LOG_WARNING, "Found %i unreleased buffers!\n",
avci->buffer_count);
- for(i=0; i<INTERNAL_BUFFER_SIZE; i++){
+ for (i = 0; i < INTERNAL_BUFFER_SIZE; i++) {
InternalBuffer *buf = &avci->buffer[i];
- for(j=0; j<4; j++){
+ for (j = 0; j < 4; j++) {
av_freep(&buf->base[j]);
- buf->data[j]= NULL;
+ buf->data[j] = NULL;
}
}
av_freep(&avci->buffer);
- avci->buffer_count=0;
+ avci->buffer_count = 0;
}
static void audio_free_buffers(AVCodecContext *avctx)
{
AVCodecInternal *avci = avctx->internal;
- InternalBuffer *buf;
-
- if (!avci->buffer)
- return;
- buf = avci->buffer;
-
- if (buf->extended_data) {
- av_free(buf->extended_data[0]);
- if (buf->extended_data != buf->data)
- av_free(buf->extended_data);
- }
- av_freep(&avci->buffer);
+ av_freep(&avci->audio_data);
}
void avcodec_default_free_buffers(AVCodecContext *avctx)
@@ -1622,77 +1765,227 @@ void avcodec_default_free_buffers(AVCodecContext *avctx)
}
}
-#if FF_API_OLD_FF_PICT_TYPES
-char av_get_pict_type_char(int pict_type){
- return av_get_picture_type_char(pict_type);
-}
-#endif
-
-int av_get_bits_per_sample(enum CodecID codec_id){
- switch(codec_id){
- case CODEC_ID_ADPCM_SBPRO_2:
- return 2;
- case CODEC_ID_ADPCM_SBPRO_3:
- return 3;
- case CODEC_ID_ADPCM_SBPRO_4:
- case CODEC_ID_ADPCM_CT:
- case CODEC_ID_ADPCM_IMA_WAV:
- case CODEC_ID_ADPCM_IMA_QT:
- case CODEC_ID_ADPCM_SWF:
- case CODEC_ID_ADPCM_MS:
- case CODEC_ID_ADPCM_YAMAHA:
- case CODEC_ID_ADPCM_G722:
+int av_get_exact_bits_per_sample(enum AVCodecID codec_id)
+{
+ switch (codec_id) {
+ case AV_CODEC_ID_ADPCM_CT:
+ case AV_CODEC_ID_ADPCM_IMA_APC:
+ case AV_CODEC_ID_ADPCM_IMA_EA_SEAD:
+ case AV_CODEC_ID_ADPCM_IMA_WS:
+ case AV_CODEC_ID_ADPCM_G722:
+ case AV_CODEC_ID_ADPCM_YAMAHA:
return 4;
- case CODEC_ID_PCM_ALAW:
- case CODEC_ID_PCM_MULAW:
- case CODEC_ID_PCM_S8:
- case CODEC_ID_PCM_U8:
- case CODEC_ID_PCM_ZORK:
+ case AV_CODEC_ID_PCM_ALAW:
+ case AV_CODEC_ID_PCM_MULAW:
+ case AV_CODEC_ID_PCM_S8:
+ case AV_CODEC_ID_PCM_U8:
+ case AV_CODEC_ID_PCM_ZORK:
return 8;
- case CODEC_ID_PCM_S16BE:
- case CODEC_ID_PCM_S16LE:
- case CODEC_ID_PCM_S16LE_PLANAR:
- case CODEC_ID_PCM_U16BE:
- case CODEC_ID_PCM_U16LE:
+ case AV_CODEC_ID_PCM_S16BE:
+ case AV_CODEC_ID_PCM_S16LE:
+ case AV_CODEC_ID_PCM_S16LE_PLANAR:
+ case AV_CODEC_ID_PCM_U16BE:
+ case AV_CODEC_ID_PCM_U16LE:
return 16;
- case CODEC_ID_PCM_S24DAUD:
- case CODEC_ID_PCM_S24BE:
- case CODEC_ID_PCM_S24LE:
- case CODEC_ID_PCM_U24BE:
- case CODEC_ID_PCM_U24LE:
+ case AV_CODEC_ID_PCM_S24DAUD:
+ case AV_CODEC_ID_PCM_S24BE:
+ case AV_CODEC_ID_PCM_S24LE:
+ case AV_CODEC_ID_PCM_U24BE:
+ case AV_CODEC_ID_PCM_U24LE:
return 24;
- case CODEC_ID_PCM_S32BE:
- case CODEC_ID_PCM_S32LE:
- case CODEC_ID_PCM_U32BE:
- case CODEC_ID_PCM_U32LE:
- case CODEC_ID_PCM_F32BE:
- case CODEC_ID_PCM_F32LE:
+ case AV_CODEC_ID_PCM_S32BE:
+ case AV_CODEC_ID_PCM_S32LE:
+ case AV_CODEC_ID_PCM_U32BE:
+ case AV_CODEC_ID_PCM_U32LE:
+ case AV_CODEC_ID_PCM_F32BE:
+ case AV_CODEC_ID_PCM_F32LE:
return 32;
- case CODEC_ID_PCM_F64BE:
- case CODEC_ID_PCM_F64LE:
+ case AV_CODEC_ID_PCM_F64BE:
+ case AV_CODEC_ID_PCM_F64LE:
return 64;
default:
return 0;
}
}
-#if FF_API_OLD_SAMPLE_FMT
-int av_get_bits_per_sample_format(enum AVSampleFormat sample_fmt) {
- return av_get_bytes_per_sample(sample_fmt) << 3;
+int av_get_bits_per_sample(enum AVCodecID codec_id)
+{
+ switch (codec_id) {
+ case AV_CODEC_ID_ADPCM_SBPRO_2:
+ return 2;
+ case AV_CODEC_ID_ADPCM_SBPRO_3:
+ return 3;
+ case AV_CODEC_ID_ADPCM_SBPRO_4:
+ case AV_CODEC_ID_ADPCM_IMA_WAV:
+ case AV_CODEC_ID_ADPCM_IMA_QT:
+ case AV_CODEC_ID_ADPCM_SWF:
+ case AV_CODEC_ID_ADPCM_MS:
+ return 4;
+ default:
+ return av_get_exact_bits_per_sample(codec_id);
+ }
+}
+
+int av_get_audio_frame_duration(AVCodecContext *avctx, int frame_bytes)
+{
+ int id, sr, ch, ba, tag, bps;
+
+ id = avctx->codec_id;
+ sr = avctx->sample_rate;
+ ch = avctx->channels;
+ ba = avctx->block_align;
+ tag = avctx->codec_tag;
+ bps = av_get_exact_bits_per_sample(avctx->codec_id);
+
+ /* codecs with an exact constant bits per sample */
+ if (bps > 0 && ch > 0 && frame_bytes > 0)
+ return (frame_bytes * 8) / (bps * ch);
+ bps = avctx->bits_per_coded_sample;
+
+ /* codecs with a fixed packet duration */
+ switch (id) {
+ case AV_CODEC_ID_ADPCM_ADX: return 32;
+ case AV_CODEC_ID_ADPCM_IMA_QT: return 64;
+ case AV_CODEC_ID_ADPCM_EA_XAS: return 128;
+ case AV_CODEC_ID_AMR_NB:
+ case AV_CODEC_ID_GSM:
+ case AV_CODEC_ID_QCELP:
+ case AV_CODEC_ID_RA_144:
+ case AV_CODEC_ID_RA_288: return 160;
+ case AV_CODEC_ID_IMC: return 256;
+ case AV_CODEC_ID_AMR_WB:
+ case AV_CODEC_ID_GSM_MS: return 320;
+ case AV_CODEC_ID_MP1: return 384;
+ case AV_CODEC_ID_ATRAC1: return 512;
+ case AV_CODEC_ID_ATRAC3: return 1024;
+ case AV_CODEC_ID_MP2:
+ case AV_CODEC_ID_MUSEPACK7: return 1152;
+ case AV_CODEC_ID_AC3: return 1536;
+ }
+
+ if (sr > 0) {
+ /* calc from sample rate */
+ if (id == AV_CODEC_ID_TTA)
+ return 256 * sr / 245;
+
+ if (ch > 0) {
+ /* calc from sample rate and channels */
+ if (id == AV_CODEC_ID_BINKAUDIO_DCT)
+ return (480 << (sr / 22050)) / ch;
+ }
+ }
+
+ if (ba > 0) {
+ /* calc from block_align */
+ if (id == AV_CODEC_ID_SIPR) {
+ switch (ba) {
+ case 20: return 160;
+ case 19: return 144;
+ case 29: return 288;
+ case 37: return 480;
+ }
+ } else if (id == AV_CODEC_ID_ILBC) {
+ switch (ba) {
+ case 38: return 160;
+ case 50: return 240;
+ }
+ }
+ }
+
+ if (frame_bytes > 0) {
+ /* calc from frame_bytes only */
+ if (id == AV_CODEC_ID_TRUESPEECH)
+ return 240 * (frame_bytes / 32);
+ if (id == AV_CODEC_ID_NELLYMOSER)
+ return 256 * (frame_bytes / 64);
+
+ if (bps > 0) {
+ /* calc from frame_bytes and bits_per_coded_sample */
+ if (id == AV_CODEC_ID_ADPCM_G726)
+ return frame_bytes * 8 / bps;
+ }
+
+ if (ch > 0) {
+ /* calc from frame_bytes and channels */
+ switch (id) {
+ case AV_CODEC_ID_ADPCM_4XM:
+ case AV_CODEC_ID_ADPCM_IMA_ISS:
+ return (frame_bytes - 4 * ch) * 2 / ch;
+ case AV_CODEC_ID_ADPCM_IMA_SMJPEG:
+ return (frame_bytes - 4) * 2 / ch;
+ case AV_CODEC_ID_ADPCM_IMA_AMV:
+ return (frame_bytes - 8) * 2 / ch;
+ case AV_CODEC_ID_ADPCM_XA:
+ return (frame_bytes / 128) * 224 / ch;
+ case AV_CODEC_ID_INTERPLAY_DPCM:
+ return (frame_bytes - 6 - ch) / ch;
+ case AV_CODEC_ID_ROQ_DPCM:
+ return (frame_bytes - 8) / ch;
+ case AV_CODEC_ID_XAN_DPCM:
+ return (frame_bytes - 2 * ch) / ch;
+ case AV_CODEC_ID_MACE3:
+ return 3 * frame_bytes / ch;
+ case AV_CODEC_ID_MACE6:
+ return 6 * frame_bytes / ch;
+ case AV_CODEC_ID_PCM_LXF:
+ return 2 * (frame_bytes / (5 * ch));
+ }
+
+ if (tag) {
+ /* calc from frame_bytes, channels, and codec_tag */
+ if (id == AV_CODEC_ID_SOL_DPCM) {
+ if (tag == 3)
+ return frame_bytes / ch;
+ else
+ return frame_bytes * 2 / ch;
+ }
+ }
+
+ if (ba > 0) {
+ /* calc from frame_bytes, channels, and block_align */
+ int blocks = frame_bytes / ba;
+ switch (avctx->codec_id) {
+ case AV_CODEC_ID_ADPCM_IMA_WAV:
+ return blocks * (1 + (ba - 4 * ch) / (4 * ch) * 8);
+ case AV_CODEC_ID_ADPCM_IMA_DK3:
+ return blocks * (((ba - 16) * 2 / 3 * 4) / ch);
+ case AV_CODEC_ID_ADPCM_IMA_DK4:
+ return blocks * (1 + (ba - 4 * ch) * 2 / ch);
+ case AV_CODEC_ID_ADPCM_MS:
+ return blocks * (2 + (ba - 7 * ch) * 2 / ch);
+ }
+ }
+
+ if (bps > 0) {
+ /* calc from frame_bytes, channels, and bits_per_coded_sample */
+ switch (avctx->codec_id) {
+ case AV_CODEC_ID_PCM_DVD:
+ return 2 * (frame_bytes / ((bps * 2 / 8) * ch));
+ case AV_CODEC_ID_PCM_BLURAY:
+ return frame_bytes / ((FFALIGN(ch, 2) * bps) / 8);
+ case AV_CODEC_ID_S302M:
+ return 2 * (frame_bytes / ((bps + 4) / 4)) / ch;
+ }
+ }
+ }
+ }
+
+ return 0;
}
-#endif
#if !HAVE_THREADS
-int ff_thread_init(AVCodecContext *s){
+int ff_thread_init(AVCodecContext *s)
+{
return -1;
}
+
#endif
unsigned int av_xiphlacing(unsigned char *s, unsigned int v)
{
unsigned int n = 0;
- while(v >= 0xff) {
+ while (v >= 0xff) {
*s++ = 0xff;
v -= 0xff;
n++;
@@ -1702,15 +1995,16 @@ unsigned int av_xiphlacing(unsigned char *s, unsigned int v)
return n;
}
-int ff_match_2uint16(const uint16_t (*tab)[2], int size, int a, int b){
+int ff_match_2uint16(const uint16_t(*tab)[2], int size, int a, int b)
+{
int i;
- for(i=0; i<size && !(tab[i][0]==a && tab[i][1]==b); i++);
+ for (i = 0; i < size && !(tab[i][0] == a && tab[i][1] == b); i++) ;
return i;
}
void av_log_missing_feature(void *avc, const char *feature, int want_sample)
{
- av_log(avc, AV_LOG_WARNING, "%s not implemented. Update your Libav "
+ av_log(avc, AV_LOG_WARNING, "%s is not implemented. Update your Libav "
"version to the newest one from Git. If the problem still "
"occurs, it means that your file has a feature which has not "
"been implemented.\n", feature);
@@ -1749,15 +2043,14 @@ AVHWAccel *av_hwaccel_next(AVHWAccel *hwaccel)
return hwaccel ? hwaccel->next : first_hwaccel;
}
-AVHWAccel *ff_find_hwaccel(enum CodecID codec_id, enum PixelFormat pix_fmt)
+AVHWAccel *ff_find_hwaccel(enum AVCodecID codec_id, enum AVPixelFormat pix_fmt)
{
- AVHWAccel *hwaccel=NULL;
+ AVHWAccel *hwaccel = NULL;
- while((hwaccel= av_hwaccel_next(hwaccel))){
- if ( hwaccel->id == codec_id
+ while ((hwaccel = av_hwaccel_next(hwaccel)))
+ if (hwaccel->id == codec_id
&& hwaccel->pix_fmt == pix_fmt)
return hwaccel;
- }
return NULL;
}
@@ -1801,10 +2094,10 @@ int avpriv_unlock_avformat(void)
unsigned int avpriv_toupper4(unsigned int x)
{
- return toupper( x &0xFF)
- + (toupper((x>>8 )&0xFF)<<8 )
- + (toupper((x>>16)&0xFF)<<16)
- + (toupper((x>>24)&0xFF)<<24);
+ return toupper(x & 0xFF)
+ + (toupper((x >> 8) & 0xFF) << 8)
+ + (toupper((x >> 16) & 0xFF) << 16)
+ + (toupper((x >> 24) & 0xFF) << 24);
}
#if !HAVE_THREADS
@@ -1812,7 +2105,7 @@ unsigned int avpriv_toupper4(unsigned int x)
int ff_thread_get_buffer(AVCodecContext *avctx, AVFrame *f)
{
f->owner = avctx;
- return avctx->get_buffer(avctx, f);
+ return ff_get_buffer(avctx, f);
}
void ff_thread_release_buffer(AVCodecContext *avctx, AVFrame *f)
@@ -1834,23 +2127,15 @@ void ff_thread_await_progress(AVFrame *f, int progress, int field)
#endif
-#if FF_API_THREAD_INIT
-int avcodec_thread_init(AVCodecContext *s, int thread_count)
-{
- s->thread_count = thread_count;
- return ff_thread_init(s);
-}
-#endif
-
-enum AVMediaType avcodec_get_type(enum CodecID codec_id)
+enum AVMediaType avcodec_get_type(enum AVCodecID codec_id)
{
- if (codec_id <= CODEC_ID_NONE)
+ if (codec_id <= AV_CODEC_ID_NONE)
return AVMEDIA_TYPE_UNKNOWN;
- else if (codec_id < CODEC_ID_FIRST_AUDIO)
+ else if (codec_id < AV_CODEC_ID_FIRST_AUDIO)
return AVMEDIA_TYPE_VIDEO;
- else if (codec_id < CODEC_ID_FIRST_SUBTITLE)
+ else if (codec_id < AV_CODEC_ID_FIRST_SUBTITLE)
return AVMEDIA_TYPE_AUDIO;
- else if (codec_id < CODEC_ID_FIRST_UNKNOWN)
+ else if (codec_id < AV_CODEC_ID_FIRST_UNKNOWN)
return AVMEDIA_TYPE_SUBTITLE;
return AVMEDIA_TYPE_UNKNOWN;
diff --git a/gst-libs/ext/libav/libavcodec/utvideo.c b/gst-libs/ext/libav/libavcodec/utvideo.c
index fdce255..eb5a924 100644
--- a/gst-libs/ext/libav/libavcodec/utvideo.c
+++ b/gst-libs/ext/libav/libavcodec/utvideo.c
@@ -1,5 +1,5 @@
/*
- * Ut Video decoder
+ * Common Ut Video code
* Copyright (c) 2011 Konstantin Shishkov
*
* This file is part of Libav.
@@ -21,557 +21,19 @@
/**
* @file
- * Ut Video decoder
+ * Common Ut Video code
*/
-#include <stdlib.h>
+#include "utvideo.h"
-#include "libavutil/intreadwrite.h"
-#include "avcodec.h"
-#include "bytestream.h"
-#include "get_bits.h"
-#include "dsputil.h"
-#include "thread.h"
-
-enum {
- PRED_NONE = 0,
- PRED_LEFT,
- PRED_GRADIENT,
- PRED_MEDIAN,
+const int ff_ut_pred_order[5] = {
+ PRED_LEFT, PRED_MEDIAN, PRED_MEDIAN, PRED_NONE, PRED_GRADIENT
};
-typedef struct UtvideoContext {
- AVCodecContext *avctx;
- AVFrame pic;
- DSPContext dsp;
-
- uint32_t frame_info_size, flags, frame_info;
- int planes;
- int slices;
- int compression;
- int interlaced;
- int frame_pred;
-
- uint8_t *slice_bits;
- int slice_bits_size;
-} UtvideoContext;
+const int ff_ut_rgb_order[4] = { 1, 2, 0, 3 }; // G, B, R, A
-typedef struct HuffEntry {
- uint8_t sym;
- uint8_t len;
-} HuffEntry;
-
-static int huff_cmp(const void *a, const void *b)
+int ff_ut_huff_cmp_len(const void *a, const void *b)
{
const HuffEntry *aa = a, *bb = b;
return (aa->len - bb->len)*256 + aa->sym - bb->sym;
}
-
-static int build_huff(const uint8_t *src, VLC *vlc, int *fsym)
-{
- int i;
- HuffEntry he[256];
- int last;
- uint32_t codes[256];
- uint8_t bits[256];
- uint8_t syms[256];
- uint32_t code;
-
- *fsym = -1;
- for (i = 0; i < 256; i++) {
- he[i].sym = i;
- he[i].len = *src++;
- }
- qsort(he, 256, sizeof(*he), huff_cmp);
-
- if (!he[0].len) {
- *fsym = he[0].sym;
- return 0;
- }
- if (he[0].len > 32)
- return -1;
-
- last = 255;
- while (he[last].len == 255 && last)
- last--;
-
- code = 1;
- for (i = last; i >= 0; i--) {
- codes[i] = code >> (32 - he[i].len);
- bits[i] = he[i].len;
- syms[i] = he[i].sym;
- code += 0x80000000u >> (he[i].len - 1);
- }
-
- return ff_init_vlc_sparse(vlc, FFMIN(he[last].len, 9), last + 1,
- bits, sizeof(*bits), sizeof(*bits),
- codes, sizeof(*codes), sizeof(*codes),
- syms, sizeof(*syms), sizeof(*syms), 0);
-}
-
-static int decode_plane(UtvideoContext *c, int plane_no,
- uint8_t *dst, int step, int stride,
- int width, int height,
- const uint8_t *src, int src_size, int use_pred)
-{
- int i, j, slice, pix;
- int sstart, send;
- VLC vlc;
- GetBitContext gb;
- int prev, fsym;
- const int cmask = ~(!plane_no && c->avctx->pix_fmt == PIX_FMT_YUV420P);
-
- if (build_huff(src, &vlc, &fsym)) {
- av_log(c->avctx, AV_LOG_ERROR, "Cannot build Huffman codes\n");
- return AVERROR_INVALIDDATA;
- }
- if (fsym >= 0) { // build_huff reported a symbol to fill slices with
- send = 0;
- for (slice = 0; slice < c->slices; slice++) {
- uint8_t *dest;
-
- sstart = send;
- send = (height * (slice + 1) / c->slices) & cmask;
- dest = dst + sstart * stride;
-
- prev = 0x80;
- for (j = sstart; j < send; j++) {
- for (i = 0; i < width * step; i += step) {
- pix = fsym;
- if (use_pred) {
- prev += pix;
- pix = prev;
- }
- dest[i] = pix;
- }
- dest += stride;
- }
- }
- return 0;
- }
-
- src += 256;
- src_size -= 256;
-
- send = 0;
- for (slice = 0; slice < c->slices; slice++) {
- uint8_t *dest;
- int slice_data_start, slice_data_end, slice_size;
-
- sstart = send;
- send = (height * (slice + 1) / c->slices) & cmask;
- dest = dst + sstart * stride;
-
- // slice offset and size validation was done earlier
- slice_data_start = slice ? AV_RL32(src + slice * 4 - 4) : 0;
- slice_data_end = AV_RL32(src + slice * 4);
- slice_size = slice_data_end - slice_data_start;
-
- if (!slice_size) {
- for (j = sstart; j < send; j++) {
- for (i = 0; i < width * step; i += step)
- dest[i] = 0x80;
- dest += stride;
- }
- continue;
- }
-
- memcpy(c->slice_bits, src + slice_data_start + c->slices * 4, slice_size);
- memset(c->slice_bits + slice_size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
- c->dsp.bswap_buf((uint32_t*)c->slice_bits, (uint32_t*)c->slice_bits,
- (slice_data_end - slice_data_start + 3) >> 2);
- init_get_bits(&gb, c->slice_bits, slice_size * 8);
-
- prev = 0x80;
- for (j = sstart; j < send; j++) {
- for (i = 0; i < width * step; i += step) {
- if (get_bits_left(&gb) <= 0) {
- av_log(c->avctx, AV_LOG_ERROR, "Slice decoding ran out of bits\n");
- goto fail;
- }
- pix = get_vlc2(&gb, vlc.table, vlc.bits, 4);
- if (pix < 0) {
- av_log(c->avctx, AV_LOG_ERROR, "Decoding error\n");
- goto fail;
- }
- if (use_pred) {
- prev += pix;
- pix = prev;
- }
- dest[i] = pix;
- }
- dest += stride;
- }
- if (get_bits_left(&gb) > 32)
- av_log(c->avctx, AV_LOG_WARNING, "%d bits left after decoding slice\n",
- get_bits_left(&gb));
- }
-
- ff_free_vlc(&vlc);
-
- return 0;
-fail:
- ff_free_vlc(&vlc);
- return AVERROR_INVALIDDATA;
-}
-
-static const int rgb_order[4] = { 1, 2, 0, 3 };
-
-static void restore_rgb_planes(uint8_t *src, int step, int stride, int width, int height)
-{
- int i, j;
- uint8_t r, g, b;
-
- for (j = 0; j < height; j++) {
- for (i = 0; i < width * step; i += step) {
- r = src[i];
- g = src[i + 1];
- b = src[i + 2];
- src[i] = r + g - 0x80;
- src[i + 2] = b + g - 0x80;
- }
- src += stride;
- }
-}
-
-static void restore_median(uint8_t *src, int step, int stride,
- int width, int height, int slices, int rmode)
-{
- int i, j, slice;
- int A, B, C;
- uint8_t *bsrc;
- int slice_start, slice_height;
- const int cmask = ~rmode;
-
- for (slice = 0; slice < slices; slice++) {
- slice_start = ((slice * height) / slices) & cmask;
- slice_height = ((((slice + 1) * height) / slices) & cmask) - slice_start;
-
- bsrc = src + slice_start * stride;
-
- // first line - left neighbour prediction
- bsrc[0] += 0x80;
- A = bsrc[0];
- for (i = step; i < width * step; i += step) {
- bsrc[i] += A;
- A = bsrc[i];
- }
- bsrc += stride;
- if (slice_height == 1)
- continue;
- // second line - first element has top predition, the rest uses median
- C = bsrc[-stride];
- bsrc[0] += C;
- A = bsrc[0];
- for (i = step; i < width * step; i += step) {
- B = bsrc[i - stride];
- bsrc[i] += mid_pred(A, B, (uint8_t)(A + B - C));
- C = B;
- A = bsrc[i];
- }
- bsrc += stride;
- // the rest of lines use continuous median prediction
- for (j = 2; j < slice_height; j++) {
- for (i = 0; i < width * step; i += step) {
- B = bsrc[i - stride];
- bsrc[i] += mid_pred(A, B, (uint8_t)(A + B - C));
- C = B;
- A = bsrc[i];
- }
- bsrc += stride;
- }
- }
-}
-
-/* UtVideo interlaced mode treats every two lines as a single one,
- * so restoring function should take care of possible padding between
- * two parts of the same "line".
- */
-static void restore_median_il(uint8_t *src, int step, int stride,
- int width, int height, int slices, int rmode)
-{
- int i, j, slice;
- int A, B, C;
- uint8_t *bsrc;
- int slice_start, slice_height;
- const int cmask = ~(rmode ? 3 : 1);
- const int stride2 = stride << 1;
-
- for (slice = 0; slice < slices; slice++) {
- slice_start = ((slice * height) / slices) & cmask;
- slice_height = ((((slice + 1) * height) / slices) & cmask) - slice_start;
- slice_height >>= 1;
-
- bsrc = src + slice_start * stride;
-
- // first line - left neighbour prediction
- bsrc[0] += 0x80;
- A = bsrc[0];
- for (i = step; i < width * step; i += step) {
- bsrc[i] += A;
- A = bsrc[i];
- }
- for (i = 0; i < width * step; i += step) {
- bsrc[stride + i] += A;
- A = bsrc[stride + i];
- }
- bsrc += stride2;
- if (slice_height == 1)
- continue;
- // second line - first element has top predition, the rest uses median
- C = bsrc[-stride2];
- bsrc[0] += C;
- A = bsrc[0];
- for (i = step; i < width * step; i += step) {
- B = bsrc[i - stride2];
- bsrc[i] += mid_pred(A, B, (uint8_t)(A + B - C));
- C = B;
- A = bsrc[i];
- }
- for (i = 0; i < width * step; i += step) {
- B = bsrc[i - stride];
- bsrc[stride + i] += mid_pred(A, B, (uint8_t)(A + B - C));
- C = B;
- A = bsrc[stride + i];
- }
- bsrc += stride2;
- // the rest of lines use continuous median prediction
- for (j = 2; j < slice_height; j++) {
- for (i = 0; i < width * step; i += step) {
- B = bsrc[i - stride2];
- bsrc[i] += mid_pred(A, B, (uint8_t)(A + B - C));
- C = B;
- A = bsrc[i];
- }
- for (i = 0; i < width * step; i += step) {
- B = bsrc[i - stride];
- bsrc[i + stride] += mid_pred(A, B, (uint8_t)(A + B - C));
- C = B;
- A = bsrc[i + stride];
- }
- bsrc += stride2;
- }
- }
-}
-
-static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt)
-{
- const uint8_t *buf = avpkt->data;
- int buf_size = avpkt->size;
- UtvideoContext *c = avctx->priv_data;
- int i, j;
- const uint8_t *plane_start[5];
- int plane_size, max_slice_size = 0, slice_start, slice_end, slice_size;
- int ret;
- GetByteContext gb;
-
- if (c->pic.data[0])
- ff_thread_release_buffer(avctx, &c->pic);
-
- c->pic.reference = 1;
- c->pic.buffer_hints = FF_BUFFER_HINTS_VALID;
- if ((ret = ff_thread_get_buffer(avctx, &c->pic)) < 0) {
- av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
- return ret;
- }
-
- ff_thread_finish_setup(avctx);
-
- /* parse plane structure to retrieve frame flags and validate slice offsets */
- bytestream2_init(&gb, buf, buf_size);
- for (i = 0; i < c->planes; i++) {
- plane_start[i] = gb.buffer;
- if (bytestream2_get_bytes_left(&gb) < 256 + 4 * c->slices) {
- av_log(avctx, AV_LOG_ERROR, "Insufficient data for a plane\n");
- return AVERROR_INVALIDDATA;
- }
- bytestream2_skipu(&gb, 256);
- slice_start = 0;
- slice_end = 0;
- for (j = 0; j < c->slices; j++) {
- slice_end = bytestream2_get_le32u(&gb);
- slice_size = slice_end - slice_start;
- if (slice_end <= 0 || slice_size <= 0 ||
- bytestream2_get_bytes_left(&gb) < slice_end) {
- av_log(avctx, AV_LOG_ERROR, "Incorrect slice size\n");
- return AVERROR_INVALIDDATA;
- }
- slice_start = slice_end;
- max_slice_size = FFMAX(max_slice_size, slice_size);
- }
- plane_size = slice_end;
- bytestream2_skipu(&gb, plane_size);
- }
- plane_start[c->planes] = gb.buffer;
- if (bytestream2_get_bytes_left(&gb) < c->frame_info_size) {
- av_log(avctx, AV_LOG_ERROR, "Not enough data for frame information\n");
- return AVERROR_INVALIDDATA;
- }
- c->frame_info = bytestream2_get_le32u(&gb);
- av_log(avctx, AV_LOG_DEBUG, "frame information flags %X\n", c->frame_info);
-
- c->frame_pred = (c->frame_info >> 8) & 3;
-
- if (c->frame_pred == PRED_GRADIENT) {
- av_log_ask_for_sample(avctx, "Frame uses gradient prediction\n");
- return AVERROR_PATCHWELCOME;
- }
-
- av_fast_malloc(&c->slice_bits, &c->slice_bits_size,
- max_slice_size + FF_INPUT_BUFFER_PADDING_SIZE);
-
- if (!c->slice_bits) {
- av_log(avctx, AV_LOG_ERROR, "Cannot allocate temporary buffer\n");
- return AVERROR(ENOMEM);
- }
-
- switch (c->avctx->pix_fmt) {
- case PIX_FMT_RGB24:
- case PIX_FMT_RGBA:
- for (i = 0; i < c->planes; i++) {
- ret = decode_plane(c, i, c->pic.data[0] + rgb_order[i], c->planes,
- c->pic.linesize[0], avctx->width, avctx->height,
- plane_start[i], plane_start[i + 1] - plane_start[i],
- c->frame_pred == PRED_LEFT);
- if (ret)
- return ret;
- if (c->frame_pred == PRED_MEDIAN)
- restore_median(c->pic.data[0] + rgb_order[i], c->planes,
- c->pic.linesize[0], avctx->width, avctx->height,
- c->slices, 0);
- }
- restore_rgb_planes(c->pic.data[0], c->planes, c->pic.linesize[0],
- avctx->width, avctx->height);
- break;
- case PIX_FMT_YUV420P:
- for (i = 0; i < 3; i++) {
- ret = decode_plane(c, i, c->pic.data[i], 1,
- c->pic.linesize[i], avctx->width >> !!i, avctx->height >> !!i,
- plane_start[i], plane_start[i + 1] - plane_start[i],
- c->frame_pred == PRED_LEFT);
- if (ret)
- return ret;
- if (c->frame_pred == PRED_MEDIAN) {
- if (!c->interlaced) {
- restore_median(c->pic.data[i], 1, c->pic.linesize[i],
- avctx->width >> !!i, avctx->height >> !!i,
- c->slices, !i);
- } else {
- restore_median_il(c->pic.data[i], 1, c->pic.linesize[i],
- avctx->width >> !!i,
- avctx->height >> !!i,
- c->slices, !i);
- }
- }
- }
- break;
- case PIX_FMT_YUV422P:
- for (i = 0; i < 3; i++) {
- ret = decode_plane(c, i, c->pic.data[i], 1,
- c->pic.linesize[i], avctx->width >> !!i, avctx->height,
- plane_start[i], plane_start[i + 1] - plane_start[i],
- c->frame_pred == PRED_LEFT);
- if (ret)
- return ret;
- if (c->frame_pred == PRED_MEDIAN) {
- if (!c->interlaced) {
- restore_median(c->pic.data[i], 1, c->pic.linesize[i],
- avctx->width >> !!i, avctx->height,
- c->slices, 0);
- } else {
- restore_median_il(c->pic.data[i], 1, c->pic.linesize[i],
- avctx->width >> !!i, avctx->height,
- c->slices, 0);
- }
- }
- }
- break;
- }
-
- *data_size = sizeof(AVFrame);
- *(AVFrame*)data = c->pic;
-
- /* always report that the buffer was completely consumed */
- return buf_size;
-}
-
-static av_cold int decode_init(AVCodecContext *avctx)
-{
- UtvideoContext * const c = avctx->priv_data;
-
- c->avctx = avctx;
-
- dsputil_init(&c->dsp, avctx);
-
- if (avctx->extradata_size < 16) {
- av_log(avctx, AV_LOG_ERROR, "Insufficient extradata size %d, should be at least 16\n",
- avctx->extradata_size);
- return AVERROR_INVALIDDATA;
- }
-
- av_log(avctx, AV_LOG_DEBUG, "Encoder version %d.%d.%d.%d\n",
- avctx->extradata[3], avctx->extradata[2],
- avctx->extradata[1], avctx->extradata[0]);
- av_log(avctx, AV_LOG_DEBUG, "Original format %X\n", AV_RB32(avctx->extradata + 4));
- c->frame_info_size = AV_RL32(avctx->extradata + 8);
- c->flags = AV_RL32(avctx->extradata + 12);
-
- if (c->frame_info_size != 4)
- av_log_ask_for_sample(avctx, "Frame info is not 4 bytes\n");
- av_log(avctx, AV_LOG_DEBUG, "Encoding parameters %08X\n", c->flags);
- c->slices = (c->flags >> 24) + 1;
- c->compression = c->flags & 1;
- c->interlaced = c->flags & 0x800;
-
- c->slice_bits_size = 0;
-
- switch (avctx->codec_tag) {
- case MKTAG('U', 'L', 'R', 'G'):
- c->planes = 3;
- avctx->pix_fmt = PIX_FMT_RGB24;
- break;
- case MKTAG('U', 'L', 'R', 'A'):
- c->planes = 4;
- avctx->pix_fmt = PIX_FMT_RGBA;
- break;
- case MKTAG('U', 'L', 'Y', '0'):
- c->planes = 3;
- avctx->pix_fmt = PIX_FMT_YUV420P;
- break;
- case MKTAG('U', 'L', 'Y', '2'):
- c->planes = 3;
- avctx->pix_fmt = PIX_FMT_YUV422P;
- break;
- default:
- av_log(avctx, AV_LOG_ERROR, "Unknown Ut Video FOURCC provided (%08X)\n",
- avctx->codec_tag);
- return AVERROR_INVALIDDATA;
- }
-
- return 0;
-}
-
-static av_cold int decode_end(AVCodecContext *avctx)
-{
- UtvideoContext * const c = avctx->priv_data;
-
- if (c->pic.data[0])
- ff_thread_release_buffer(avctx, &c->pic);
-
- av_freep(&c->slice_bits);
-
- return 0;
-}
-
-AVCodec ff_utvideo_decoder = {
- .name = "utvideo",
- .type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_UTVIDEO,
- .priv_data_size = sizeof(UtvideoContext),
- .init = decode_init,
- .close = decode_end,
- .decode = decode_frame,
- .capabilities = CODEC_CAP_DR1 | CODEC_CAP_FRAME_THREADS,
- .long_name = NULL_IF_CONFIG_SMALL("Ut Video"),
-};
-
diff --git a/gst-libs/ext/libav/libavcodec/utvideo.h b/gst-libs/ext/libav/libavcodec/utvideo.h
new file mode 100644
index 0000000..0d7664c
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/utvideo.h
@@ -0,0 +1,92 @@
+/*
+ * Common Ut Video header
+ * Copyright (c) 2011 Konstantin Shishkov
+ *
+ * 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
+ */
+
+#ifndef AVCODEC_UTVIDEO_H
+#define AVCODEC_UTVIDEO_H
+
+/**
+ * @file
+ * Common Ut Video header
+ */
+
+#include "libavutil/common.h"
+#include "avcodec.h"
+#include "dsputil.h"
+
+enum {
+ PRED_NONE = 0,
+ PRED_LEFT,
+ PRED_GRADIENT,
+ PRED_MEDIAN,
+};
+
+enum {
+ COMP_NONE = 0,
+ COMP_HUFF,
+};
+
+/*
+ * "Original format" markers.
+ * Based on values gotten from the official VFW encoder.
+ * They are not used during decoding, but they do have
+ * an informative role on seeing what was input
+ * to the encoder.
+ */
+enum {
+ UTVIDEO_RGB = MKTAG(0x00, 0x00, 0x01, 0x18),
+ UTVIDEO_RGBA = MKTAG(0x00, 0x00, 0x02, 0x18),
+ UTVIDEO_420 = MKTAG('Y', 'V', '1', '2'),
+ UTVIDEO_422 = MKTAG('Y', 'U', 'Y', '2'),
+};
+
+/* Mapping of libavcodec prediction modes to Ut Video's */
+extern const int ff_ut_pred_order[5];
+
+/* Order of RGB(A) planes in Ut Video */
+extern const int ff_ut_rgb_order[4];
+
+typedef struct UtvideoContext {
+ AVCodecContext *avctx;
+ AVFrame pic;
+ DSPContext dsp;
+
+ uint32_t frame_info_size, flags, frame_info;
+ int planes;
+ int slices;
+ int compression;
+ int interlaced;
+ int frame_pred;
+
+ int slice_stride;
+ uint8_t *slice_bits, *slice_buffer[4];
+ int slice_bits_size;
+} UtvideoContext;
+
+typedef struct HuffEntry {
+ uint8_t sym;
+ uint8_t len;
+ uint32_t code;
+} HuffEntry;
+
+/* Compare huffman tree nodes */
+int ff_ut_huff_cmp_len(const void *a, const void *b);
+
+#endif /* AVCODEC_UTVIDEO_H */
diff --git a/gst-libs/ext/libav/libavcodec/utvideodec.c b/gst-libs/ext/libav/libavcodec/utvideodec.c
new file mode 100644
index 0000000..3f8f690
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/utvideodec.c
@@ -0,0 +1,555 @@
+/*
+ * Ut Video decoder
+ * Copyright (c) 2011 Konstantin Shishkov
+ *
+ * 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
+ * Ut Video decoder
+ */
+
+#include <stdlib.h>
+
+#include "libavutil/intreadwrite.h"
+#include "avcodec.h"
+#include "bytestream.h"
+#include "get_bits.h"
+#include "dsputil.h"
+#include "thread.h"
+#include "utvideo.h"
+
+static int build_huff(const uint8_t *src, VLC *vlc, int *fsym)
+{
+ int i;
+ HuffEntry he[256];
+ int last;
+ uint32_t codes[256];
+ uint8_t bits[256];
+ uint8_t syms[256];
+ uint32_t code;
+
+ *fsym = -1;
+ for (i = 0; i < 256; i++) {
+ he[i].sym = i;
+ he[i].len = *src++;
+ }
+ qsort(he, 256, sizeof(*he), ff_ut_huff_cmp_len);
+
+ if (!he[0].len) {
+ *fsym = he[0].sym;
+ return 0;
+ }
+ if (he[0].len > 32)
+ return -1;
+
+ last = 255;
+ while (he[last].len == 255 && last)
+ last--;
+
+ code = 1;
+ for (i = last; i >= 0; i--) {
+ codes[i] = code >> (32 - he[i].len);
+ bits[i] = he[i].len;
+ syms[i] = he[i].sym;
+ code += 0x80000000u >> (he[i].len - 1);
+ }
+
+ return ff_init_vlc_sparse(vlc, FFMIN(he[last].len, 9), last + 1,
+ bits, sizeof(*bits), sizeof(*bits),
+ codes, sizeof(*codes), sizeof(*codes),
+ syms, sizeof(*syms), sizeof(*syms), 0);
+}
+
+static int decode_plane(UtvideoContext *c, int plane_no,
+ uint8_t *dst, int step, int stride,
+ int width, int height,
+ const uint8_t *src, int use_pred)
+{
+ int i, j, slice, pix;
+ int sstart, send;
+ VLC vlc;
+ GetBitContext gb;
+ int prev, fsym;
+ const int cmask = ~(!plane_no && c->avctx->pix_fmt == AV_PIX_FMT_YUV420P);
+
+ if (build_huff(src, &vlc, &fsym)) {
+ av_log(c->avctx, AV_LOG_ERROR, "Cannot build Huffman codes\n");
+ return AVERROR_INVALIDDATA;
+ }
+ if (fsym >= 0) { // build_huff reported a symbol to fill slices with
+ send = 0;
+ for (slice = 0; slice < c->slices; slice++) {
+ uint8_t *dest;
+
+ sstart = send;
+ send = (height * (slice + 1) / c->slices) & cmask;
+ dest = dst + sstart * stride;
+
+ prev = 0x80;
+ for (j = sstart; j < send; j++) {
+ for (i = 0; i < width * step; i += step) {
+ pix = fsym;
+ if (use_pred) {
+ prev += pix;
+ pix = prev;
+ }
+ dest[i] = pix;
+ }
+ dest += stride;
+ }
+ }
+ return 0;
+ }
+
+ src += 256;
+
+ send = 0;
+ for (slice = 0; slice < c->slices; slice++) {
+ uint8_t *dest;
+ int slice_data_start, slice_data_end, slice_size;
+
+ sstart = send;
+ send = (height * (slice + 1) / c->slices) & cmask;
+ dest = dst + sstart * stride;
+
+ // slice offset and size validation was done earlier
+ slice_data_start = slice ? AV_RL32(src + slice * 4 - 4) : 0;
+ slice_data_end = AV_RL32(src + slice * 4);
+ slice_size = slice_data_end - slice_data_start;
+
+ if (!slice_size) {
+ av_log(c->avctx, AV_LOG_ERROR, "Plane has more than one symbol "
+ "yet a slice has a length of zero.\n");
+ goto fail;
+ }
+
+ memcpy(c->slice_bits, src + slice_data_start + c->slices * 4,
+ slice_size);
+ memset(c->slice_bits + slice_size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
+ c->dsp.bswap_buf((uint32_t *) c->slice_bits, (uint32_t *) c->slice_bits,
+ (slice_data_end - slice_data_start + 3) >> 2);
+ init_get_bits(&gb, c->slice_bits, slice_size * 8);
+
+ prev = 0x80;
+ for (j = sstart; j < send; j++) {
+ for (i = 0; i < width * step; i += step) {
+ if (get_bits_left(&gb) <= 0) {
+ av_log(c->avctx, AV_LOG_ERROR,
+ "Slice decoding ran out of bits\n");
+ goto fail;
+ }
+ pix = get_vlc2(&gb, vlc.table, vlc.bits, 4);
+ if (pix < 0) {
+ av_log(c->avctx, AV_LOG_ERROR, "Decoding error\n");
+ goto fail;
+ }
+ if (use_pred) {
+ prev += pix;
+ pix = prev;
+ }
+ dest[i] = pix;
+ }
+ dest += stride;
+ }
+ if (get_bits_left(&gb) > 32)
+ av_log(c->avctx, AV_LOG_WARNING,
+ "%d bits left after decoding slice\n", get_bits_left(&gb));
+ }
+
+ ff_free_vlc(&vlc);
+
+ return 0;
+fail:
+ ff_free_vlc(&vlc);
+ return AVERROR_INVALIDDATA;
+}
+
+static void restore_rgb_planes(uint8_t *src, int step, int stride, int width,
+ int height)
+{
+ int i, j;
+ uint8_t r, g, b;
+
+ for (j = 0; j < height; j++) {
+ for (i = 0; i < width * step; i += step) {
+ r = src[i];
+ g = src[i + 1];
+ b = src[i + 2];
+ src[i] = r + g - 0x80;
+ src[i + 2] = b + g - 0x80;
+ }
+ src += stride;
+ }
+}
+
+static void restore_median(uint8_t *src, int step, int stride,
+ int width, int height, int slices, int rmode)
+{
+ int i, j, slice;
+ int A, B, C;
+ uint8_t *bsrc;
+ int slice_start, slice_height;
+ const int cmask = ~rmode;
+
+ for (slice = 0; slice < slices; slice++) {
+ slice_start = ((slice * height) / slices) & cmask;
+ slice_height = ((((slice + 1) * height) / slices) & cmask) -
+ slice_start;
+
+ bsrc = src + slice_start * stride;
+
+ // first line - left neighbour prediction
+ bsrc[0] += 0x80;
+ A = bsrc[0];
+ for (i = step; i < width * step; i += step) {
+ bsrc[i] += A;
+ A = bsrc[i];
+ }
+ bsrc += stride;
+ if (slice_height == 1)
+ continue;
+ // second line - first element has top prediction, the rest uses median
+ C = bsrc[-stride];
+ bsrc[0] += C;
+ A = bsrc[0];
+ for (i = step; i < width * step; i += step) {
+ B = bsrc[i - stride];
+ bsrc[i] += mid_pred(A, B, (uint8_t)(A + B - C));
+ C = B;
+ A = bsrc[i];
+ }
+ bsrc += stride;
+ // the rest of lines use continuous median prediction
+ for (j = 2; j < slice_height; j++) {
+ for (i = 0; i < width * step; i += step) {
+ B = bsrc[i - stride];
+ bsrc[i] += mid_pred(A, B, (uint8_t)(A + B - C));
+ C = B;
+ A = bsrc[i];
+ }
+ bsrc += stride;
+ }
+ }
+}
+
+/* UtVideo interlaced mode treats every two lines as a single one,
+ * so restoring function should take care of possible padding between
+ * two parts of the same "line".
+ */
+static void restore_median_il(uint8_t *src, int step, int stride,
+ int width, int height, int slices, int rmode)
+{
+ int i, j, slice;
+ int A, B, C;
+ uint8_t *bsrc;
+ int slice_start, slice_height;
+ const int cmask = ~(rmode ? 3 : 1);
+ const int stride2 = stride << 1;
+
+ for (slice = 0; slice < slices; slice++) {
+ slice_start = ((slice * height) / slices) & cmask;
+ slice_height = ((((slice + 1) * height) / slices) & cmask) -
+ slice_start;
+ slice_height >>= 1;
+
+ bsrc = src + slice_start * stride;
+
+ // first line - left neighbour prediction
+ bsrc[0] += 0x80;
+ A = bsrc[0];
+ for (i = step; i < width * step; i += step) {
+ bsrc[i] += A;
+ A = bsrc[i];
+ }
+ for (i = 0; i < width * step; i += step) {
+ bsrc[stride + i] += A;
+ A = bsrc[stride + i];
+ }
+ bsrc += stride2;
+ if (slice_height == 1)
+ continue;
+ // second line - first element has top prediction, the rest uses median
+ C = bsrc[-stride2];
+ bsrc[0] += C;
+ A = bsrc[0];
+ for (i = step; i < width * step; i += step) {
+ B = bsrc[i - stride2];
+ bsrc[i] += mid_pred(A, B, (uint8_t)(A + B - C));
+ C = B;
+ A = bsrc[i];
+ }
+ for (i = 0; i < width * step; i += step) {
+ B = bsrc[i - stride];
+ bsrc[stride + i] += mid_pred(A, B, (uint8_t)(A + B - C));
+ C = B;
+ A = bsrc[stride + i];
+ }
+ bsrc += stride2;
+ // the rest of lines use continuous median prediction
+ for (j = 2; j < slice_height; j++) {
+ for (i = 0; i < width * step; i += step) {
+ B = bsrc[i - stride2];
+ bsrc[i] += mid_pred(A, B, (uint8_t)(A + B - C));
+ C = B;
+ A = bsrc[i];
+ }
+ for (i = 0; i < width * step; i += step) {
+ B = bsrc[i - stride];
+ bsrc[i + stride] += mid_pred(A, B, (uint8_t)(A + B - C));
+ C = B;
+ A = bsrc[i + stride];
+ }
+ bsrc += stride2;
+ }
+ }
+}
+
+static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
+ AVPacket *avpkt)
+{
+ const uint8_t *buf = avpkt->data;
+ int buf_size = avpkt->size;
+ UtvideoContext *c = avctx->priv_data;
+ int i, j;
+ const uint8_t *plane_start[5];
+ int plane_size, max_slice_size = 0, slice_start, slice_end, slice_size;
+ int ret;
+ GetByteContext gb;
+
+ if (c->pic.data[0])
+ ff_thread_release_buffer(avctx, &c->pic);
+
+ c->pic.reference = 1;
+ c->pic.buffer_hints = FF_BUFFER_HINTS_VALID;
+ if ((ret = ff_thread_get_buffer(avctx, &c->pic)) < 0) {
+ av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
+ return ret;
+ }
+
+ ff_thread_finish_setup(avctx);
+
+ /* parse plane structure to get frame flags and validate slice offsets */
+ bytestream2_init(&gb, buf, buf_size);
+ for (i = 0; i < c->planes; i++) {
+ plane_start[i] = gb.buffer;
+ if (bytestream2_get_bytes_left(&gb) < 256 + 4 * c->slices) {
+ av_log(avctx, AV_LOG_ERROR, "Insufficient data for a plane\n");
+ return AVERROR_INVALIDDATA;
+ }
+ bytestream2_skipu(&gb, 256);
+ slice_start = 0;
+ slice_end = 0;
+ for (j = 0; j < c->slices; j++) {
+ slice_end = bytestream2_get_le32u(&gb);
+ slice_size = slice_end - slice_start;
+ if (slice_end < 0 || slice_size < 0 ||
+ bytestream2_get_bytes_left(&gb) < slice_end) {
+ av_log(avctx, AV_LOG_ERROR, "Incorrect slice size\n");
+ return AVERROR_INVALIDDATA;
+ }
+ slice_start = slice_end;
+ max_slice_size = FFMAX(max_slice_size, slice_size);
+ }
+ plane_size = slice_end;
+ bytestream2_skipu(&gb, plane_size);
+ }
+ plane_start[c->planes] = gb.buffer;
+ if (bytestream2_get_bytes_left(&gb) < c->frame_info_size) {
+ av_log(avctx, AV_LOG_ERROR, "Not enough data for frame information\n");
+ return AVERROR_INVALIDDATA;
+ }
+ c->frame_info = bytestream2_get_le32u(&gb);
+ av_log(avctx, AV_LOG_DEBUG, "frame information flags %X\n", c->frame_info);
+
+ c->frame_pred = (c->frame_info >> 8) & 3;
+
+ if (c->frame_pred == PRED_GRADIENT) {
+ av_log_ask_for_sample(avctx, "Frame uses gradient prediction\n");
+ return AVERROR_PATCHWELCOME;
+ }
+
+ av_fast_malloc(&c->slice_bits, &c->slice_bits_size,
+ max_slice_size + FF_INPUT_BUFFER_PADDING_SIZE);
+
+ if (!c->slice_bits) {
+ av_log(avctx, AV_LOG_ERROR, "Cannot allocate temporary buffer\n");
+ return AVERROR(ENOMEM);
+ }
+
+ switch (c->avctx->pix_fmt) {
+ case AV_PIX_FMT_RGB24:
+ case AV_PIX_FMT_RGBA:
+ for (i = 0; i < c->planes; i++) {
+ ret = decode_plane(c, i, c->pic.data[0] + ff_ut_rgb_order[i],
+ c->planes, c->pic.linesize[0], avctx->width,
+ avctx->height, plane_start[i],
+ c->frame_pred == PRED_LEFT);
+ if (ret)
+ return ret;
+ if (c->frame_pred == PRED_MEDIAN) {
+ if (!c->interlaced) {
+ restore_median(c->pic.data[0] + ff_ut_rgb_order[i],
+ c->planes, c->pic.linesize[0], avctx->width,
+ avctx->height, c->slices, 0);
+ } else {
+ restore_median_il(c->pic.data[0] + ff_ut_rgb_order[i],
+ c->planes, c->pic.linesize[0],
+ avctx->width, avctx->height, c->slices,
+ 0);
+ }
+ }
+ }
+ restore_rgb_planes(c->pic.data[0], c->planes, c->pic.linesize[0],
+ avctx->width, avctx->height);
+ break;
+ case AV_PIX_FMT_YUV420P:
+ for (i = 0; i < 3; i++) {
+ ret = decode_plane(c, i, c->pic.data[i], 1, c->pic.linesize[i],
+ avctx->width >> !!i, avctx->height >> !!i,
+ plane_start[i], c->frame_pred == PRED_LEFT);
+ if (ret)
+ return ret;
+ if (c->frame_pred == PRED_MEDIAN) {
+ if (!c->interlaced) {
+ restore_median(c->pic.data[i], 1, c->pic.linesize[i],
+ avctx->width >> !!i, avctx->height >> !!i,
+ c->slices, !i);
+ } else {
+ restore_median_il(c->pic.data[i], 1, c->pic.linesize[i],
+ avctx->width >> !!i,
+ avctx->height >> !!i,
+ c->slices, !i);
+ }
+ }
+ }
+ break;
+ case AV_PIX_FMT_YUV422P:
+ for (i = 0; i < 3; i++) {
+ ret = decode_plane(c, i, c->pic.data[i], 1, c->pic.linesize[i],
+ avctx->width >> !!i, avctx->height,
+ plane_start[i], c->frame_pred == PRED_LEFT);
+ if (ret)
+ return ret;
+ if (c->frame_pred == PRED_MEDIAN) {
+ if (!c->interlaced) {
+ restore_median(c->pic.data[i], 1, c->pic.linesize[i],
+ avctx->width >> !!i, avctx->height,
+ c->slices, 0);
+ } else {
+ restore_median_il(c->pic.data[i], 1, c->pic.linesize[i],
+ avctx->width >> !!i, avctx->height,
+ c->slices, 0);
+ }
+ }
+ }
+ break;
+ }
+
+ c->pic.key_frame = 1;
+ c->pic.pict_type = AV_PICTURE_TYPE_I;
+ c->pic.interlaced_frame = !!c->interlaced;
+
+ *got_frame = 1;
+ *(AVFrame*)data = c->pic;
+
+ /* always report that the buffer was completely consumed */
+ return buf_size;
+}
+
+static av_cold int decode_init(AVCodecContext *avctx)
+{
+ UtvideoContext * const c = avctx->priv_data;
+
+ c->avctx = avctx;
+
+ ff_dsputil_init(&c->dsp, avctx);
+
+ if (avctx->extradata_size < 16) {
+ av_log(avctx, AV_LOG_ERROR,
+ "Insufficient extradata size %d, should be at least 16\n",
+ avctx->extradata_size);
+ return AVERROR_INVALIDDATA;
+ }
+
+ av_log(avctx, AV_LOG_DEBUG, "Encoder version %d.%d.%d.%d\n",
+ avctx->extradata[3], avctx->extradata[2],
+ avctx->extradata[1], avctx->extradata[0]);
+ av_log(avctx, AV_LOG_DEBUG, "Original format %X\n",
+ AV_RB32(avctx->extradata + 4));
+ c->frame_info_size = AV_RL32(avctx->extradata + 8);
+ c->flags = AV_RL32(avctx->extradata + 12);
+
+ if (c->frame_info_size != 4)
+ av_log_ask_for_sample(avctx, "Frame info is not 4 bytes\n");
+ av_log(avctx, AV_LOG_DEBUG, "Encoding parameters %08X\n", c->flags);
+ c->slices = (c->flags >> 24) + 1;
+ c->compression = c->flags & 1;
+ c->interlaced = c->flags & 0x800;
+
+ c->slice_bits_size = 0;
+
+ switch (avctx->codec_tag) {
+ case MKTAG('U', 'L', 'R', 'G'):
+ c->planes = 3;
+ avctx->pix_fmt = AV_PIX_FMT_RGB24;
+ break;
+ case MKTAG('U', 'L', 'R', 'A'):
+ c->planes = 4;
+ avctx->pix_fmt = AV_PIX_FMT_RGBA;
+ break;
+ case MKTAG('U', 'L', 'Y', '0'):
+ c->planes = 3;
+ avctx->pix_fmt = AV_PIX_FMT_YUV420P;
+ break;
+ case MKTAG('U', 'L', 'Y', '2'):
+ c->planes = 3;
+ avctx->pix_fmt = AV_PIX_FMT_YUV422P;
+ break;
+ default:
+ av_log(avctx, AV_LOG_ERROR, "Unknown Ut Video FOURCC provided (%08X)\n",
+ avctx->codec_tag);
+ return AVERROR_INVALIDDATA;
+ }
+
+ return 0;
+}
+
+static av_cold int decode_end(AVCodecContext *avctx)
+{
+ UtvideoContext * const c = avctx->priv_data;
+
+ if (c->pic.data[0])
+ ff_thread_release_buffer(avctx, &c->pic);
+
+ av_freep(&c->slice_bits);
+
+ return 0;
+}
+
+AVCodec ff_utvideo_decoder = {
+ .name = "utvideo",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .id = AV_CODEC_ID_UTVIDEO,
+ .priv_data_size = sizeof(UtvideoContext),
+ .init = decode_init,
+ .close = decode_end,
+ .decode = decode_frame,
+ .capabilities = CODEC_CAP_DR1 | CODEC_CAP_FRAME_THREADS,
+ .long_name = NULL_IF_CONFIG_SMALL("Ut Video"),
+};
diff --git a/gst-libs/ext/libav/libavcodec/utvideoenc.c b/gst-libs/ext/libav/libavcodec/utvideoenc.c
new file mode 100644
index 0000000..085c415
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/utvideoenc.c
@@ -0,0 +1,627 @@
+/*
+ * Ut Video encoder
+ * Copyright (c) 2012 Jan Ekström
+ *
+ * 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
+ * Ut Video encoder
+ */
+
+#include "libavutil/intreadwrite.h"
+#include "avcodec.h"
+#include "internal.h"
+#include "bytestream.h"
+#include "put_bits.h"
+#include "dsputil.h"
+#include "mathops.h"
+#include "utvideo.h"
+#include "huffman.h"
+
+/* Compare huffentry symbols */
+static int huff_cmp_sym(const void *a, const void *b)
+{
+ const HuffEntry *aa = a, *bb = b;
+ return aa->sym - bb->sym;
+}
+
+static av_cold int utvideo_encode_close(AVCodecContext *avctx)
+{
+ UtvideoContext *c = avctx->priv_data;
+ int i;
+
+ av_freep(&avctx->coded_frame);
+ av_freep(&c->slice_bits);
+ for (i = 0; i < 4; i++)
+ av_freep(&c->slice_buffer[i]);
+
+ return 0;
+}
+
+static av_cold int utvideo_encode_init(AVCodecContext *avctx)
+{
+ UtvideoContext *c = avctx->priv_data;
+ int i;
+ uint32_t original_format;
+
+ c->avctx = avctx;
+ c->frame_info_size = 4;
+ c->slice_stride = FFALIGN(avctx->width, 32);
+
+ switch (avctx->pix_fmt) {
+ case AV_PIX_FMT_RGB24:
+ c->planes = 3;
+ avctx->codec_tag = MKTAG('U', 'L', 'R', 'G');
+ original_format = UTVIDEO_RGB;
+ break;
+ case AV_PIX_FMT_RGBA:
+ c->planes = 4;
+ avctx->codec_tag = MKTAG('U', 'L', 'R', 'A');
+ original_format = UTVIDEO_RGBA;
+ break;
+ case AV_PIX_FMT_YUV420P:
+ if (avctx->width & 1 || avctx->height & 1) {
+ av_log(avctx, AV_LOG_ERROR,
+ "4:2:0 video requires even width and height.\n");
+ return AVERROR_INVALIDDATA;
+ }
+ c->planes = 3;
+ avctx->codec_tag = MKTAG('U', 'L', 'Y', '0');
+ original_format = UTVIDEO_420;
+ break;
+ case AV_PIX_FMT_YUV422P:
+ if (avctx->width & 1) {
+ av_log(avctx, AV_LOG_ERROR,
+ "4:2:2 video requires even width.\n");
+ return AVERROR_INVALIDDATA;
+ }
+ c->planes = 3;
+ avctx->codec_tag = MKTAG('U', 'L', 'Y', '2');
+ original_format = UTVIDEO_422;
+ break;
+ default:
+ av_log(avctx, AV_LOG_ERROR, "Unknown pixel format: %d\n",
+ avctx->pix_fmt);
+ return AVERROR_INVALIDDATA;
+ }
+
+ ff_dsputil_init(&c->dsp, avctx);
+
+ /* Check the prediction method, and error out if unsupported */
+ if (avctx->prediction_method < 0 || avctx->prediction_method > 4) {
+ av_log(avctx, AV_LOG_WARNING,
+ "Prediction method %d is not supported in Ut Video.\n",
+ avctx->prediction_method);
+ return AVERROR_OPTION_NOT_FOUND;
+ }
+
+ if (avctx->prediction_method == FF_PRED_PLANE) {
+ av_log(avctx, AV_LOG_ERROR,
+ "Plane prediction is not supported in Ut Video.\n");
+ return AVERROR_OPTION_NOT_FOUND;
+ }
+
+ /* Convert from libavcodec prediction type to Ut Video's */
+ c->frame_pred = ff_ut_pred_order[avctx->prediction_method];
+
+ if (c->frame_pred == PRED_GRADIENT) {
+ av_log(avctx, AV_LOG_ERROR, "Gradient prediction is not supported.\n");
+ return AVERROR_OPTION_NOT_FOUND;
+ }
+
+ avctx->coded_frame = avcodec_alloc_frame();
+
+ if (!avctx->coded_frame) {
+ av_log(avctx, AV_LOG_ERROR, "Could not allocate frame.\n");
+ utvideo_encode_close(avctx);
+ return AVERROR(ENOMEM);
+ }
+
+ /* extradata size is 4 * 32bit */
+ avctx->extradata_size = 16;
+
+ avctx->extradata = av_mallocz(avctx->extradata_size +
+ FF_INPUT_BUFFER_PADDING_SIZE);
+
+ if (!avctx->extradata) {
+ av_log(avctx, AV_LOG_ERROR, "Could not allocate extradata.\n");
+ utvideo_encode_close(avctx);
+ return AVERROR(ENOMEM);
+ }
+
+ for (i = 0; i < c->planes; i++) {
+ c->slice_buffer[i] = av_malloc(c->slice_stride * (avctx->height + 2) +
+ FF_INPUT_BUFFER_PADDING_SIZE);
+ if (!c->slice_buffer[i]) {
+ av_log(avctx, AV_LOG_ERROR, "Cannot allocate temporary buffer 1.\n");
+ utvideo_encode_close(avctx);
+ return AVERROR(ENOMEM);
+ }
+ }
+
+ /*
+ * Set the version of the encoder.
+ * Last byte is "implementation ID", which is
+ * obtained from the creator of the format.
+ * Libavcodec has been assigned with the ID 0xF0.
+ */
+ AV_WB32(avctx->extradata, MKTAG(1, 0, 0, 0xF0));
+
+ /*
+ * Set the "original format"
+ * Not used for anything during decoding.
+ */
+ AV_WL32(avctx->extradata + 4, original_format);
+
+ /* Write 4 as the 'frame info size' */
+ AV_WL32(avctx->extradata + 8, c->frame_info_size);
+
+ /*
+ * Set how many slices are going to be used.
+ * Set one slice for now.
+ */
+ c->slices = 1;
+
+ /* Set compression mode */
+ c->compression = COMP_HUFF;
+
+ /*
+ * Set the encoding flags:
+ * - Slice count minus 1
+ * - Interlaced encoding mode flag, set to zero for now.
+ * - Compression mode (none/huff)
+ * And write the flags.
+ */
+ c->flags = (c->slices - 1) << 24;
+ c->flags |= 0 << 11; // bit field to signal interlaced encoding mode
+ c->flags |= c->compression;
+
+ AV_WL32(avctx->extradata + 12, c->flags);
+
+ return 0;
+}
+
+static void mangle_rgb_planes(uint8_t *dst[4], int dst_stride, uint8_t *src,
+ int step, int stride, int width, int height)
+{
+ int i, j;
+ int k = 2 * dst_stride;
+ unsigned int g;
+
+ for (j = 0; j < height; j++) {
+ if (step == 3) {
+ for (i = 0; i < width * step; i += step) {
+ g = src[i + 1];
+ dst[0][k] = g;
+ g += 0x80;
+ dst[1][k] = src[i + 2] - g;
+ dst[2][k] = src[i + 0] - g;
+ k++;
+ }
+ } else {
+ for (i = 0; i < width * step; i += step) {
+ g = src[i + 1];
+ dst[0][k] = g;
+ g += 0x80;
+ dst[1][k] = src[i + 2] - g;
+ dst[2][k] = src[i + 0] - g;
+ dst[3][k] = src[i + 3];
+ k++;
+ }
+ }
+ k += dst_stride - width;
+ src += stride;
+ }
+}
+
+/* Write data to a plane, no prediction applied */
+static void write_plane(uint8_t *src, uint8_t *dst, int stride,
+ int width, int height)
+{
+ int i, j;
+
+ for (j = 0; j < height; j++) {
+ for (i = 0; i < width; i++)
+ *dst++ = src[i];
+
+ src += stride;
+ }
+}
+
+/* Write data to a plane with left prediction */
+static void left_predict(uint8_t *src, uint8_t *dst, int stride,
+ int width, int height)
+{
+ int i, j;
+ uint8_t prev;
+
+ prev = 0x80; /* Set the initial value */
+ for (j = 0; j < height; j++) {
+ for (i = 0; i < width; i++) {
+ *dst++ = src[i] - prev;
+ prev = src[i];
+ }
+ src += stride;
+ }
+}
+
+/* Write data to a plane with median prediction */
+static void median_predict(UtvideoContext *c, uint8_t *src, uint8_t *dst, int stride,
+ int width, int height)
+{
+ int i, j;
+ int A, B;
+ uint8_t prev;
+
+ /* First line uses left neighbour prediction */
+ prev = 0x80; /* Set the initial value */
+ for (i = 0; i < width; i++) {
+ *dst++ = src[i] - prev;
+ prev = src[i];
+ }
+
+ if (height == 1)
+ return;
+
+ src += stride;
+
+ /*
+ * Second line uses top prediction for the first sample,
+ * and median for the rest.
+ */
+ A = B = 0;
+
+ /* Rest of the coded part uses median prediction */
+ for (j = 1; j < height; j++) {
+ c->dsp.sub_hfyu_median_prediction(dst, src - stride, src, width, &A, &B);
+ dst += width;
+ src += stride;
+ }
+}
+
+/* Count the usage of values in a plane */
+static void count_usage(uint8_t *src, int width,
+ int height, uint64_t *counts)
+{
+ int i, j;
+
+ for (j = 0; j < height; j++) {
+ for (i = 0; i < width; i++) {
+ counts[src[i]]++;
+ }
+ src += width;
+ }
+}
+
+/* Calculate the actual huffman codes from the code lengths */
+static void calculate_codes(HuffEntry *he)
+{
+ int last, i;
+ uint32_t code;
+
+ qsort(he, 256, sizeof(*he), ff_ut_huff_cmp_len);
+
+ last = 255;
+ while (he[last].len == 255 && last)
+ last--;
+
+ code = 1;
+ for (i = last; i >= 0; i--) {
+ he[i].code = code >> (32 - he[i].len);
+ code += 0x80000000u >> (he[i].len - 1);
+ }
+
+ qsort(he, 256, sizeof(*he), huff_cmp_sym);
+}
+
+/* Write huffman bit codes to a memory block */
+static int write_huff_codes(uint8_t *src, uint8_t *dst, int dst_size,
+ int width, int height, HuffEntry *he)
+{
+ PutBitContext pb;
+ int i, j;
+ int count;
+
+ init_put_bits(&pb, dst, dst_size);
+
+ /* Write the codes */
+ for (j = 0; j < height; j++) {
+ for (i = 0; i < width; i++)
+ put_bits(&pb, he[src[i]].len, he[src[i]].code);
+
+ src += width;
+ }
+
+ /* Pad output to a 32bit boundary */
+ count = put_bits_count(&pb) & 0x1F;
+
+ if (count)
+ put_bits(&pb, 32 - count, 0);
+
+ /* Get the amount of bits written */
+ count = put_bits_count(&pb);
+
+ /* Flush the rest with zeroes */
+ flush_put_bits(&pb);
+
+ return count;
+}
+
+static int encode_plane(AVCodecContext *avctx, uint8_t *src,
+ uint8_t *dst, int stride,
+ int width, int height, PutByteContext *pb)
+{
+ UtvideoContext *c = avctx->priv_data;
+ uint8_t lengths[256];
+ uint64_t counts[256] = { 0 };
+
+ HuffEntry he[256];
+
+ uint32_t offset = 0, slice_len = 0;
+ int i, sstart, send = 0;
+ int symbol;
+
+ /* Do prediction / make planes */
+ switch (c->frame_pred) {
+ case PRED_NONE:
+ for (i = 0; i < c->slices; i++) {
+ sstart = send;
+ send = height * (i + 1) / c->slices;
+ write_plane(src + sstart * stride, dst + sstart * width,
+ stride, width, send - sstart);
+ }
+ break;
+ case PRED_LEFT:
+ for (i = 0; i < c->slices; i++) {
+ sstart = send;
+ send = height * (i + 1) / c->slices;
+ left_predict(src + sstart * stride, dst + sstart * width,
+ stride, width, send - sstart);
+ }
+ break;
+ case PRED_MEDIAN:
+ for (i = 0; i < c->slices; i++) {
+ sstart = send;
+ send = height * (i + 1) / c->slices;
+ median_predict(c, src + sstart * stride, dst + sstart * width,
+ stride, width, send - sstart);
+ }
+ break;
+ default:
+ av_log(avctx, AV_LOG_ERROR, "Unknown prediction mode: %d\n",
+ c->frame_pred);
+ return AVERROR_OPTION_NOT_FOUND;
+ }
+
+ /* Count the usage of values */
+ count_usage(dst, width, height, counts);
+
+ /* Check for a special case where only one symbol was used */
+ for (symbol = 0; symbol < 256; symbol++) {
+ /* If non-zero count is found, see if it matches width * height */
+ if (counts[symbol]) {
+ /* Special case if only one symbol was used */
+ if (counts[symbol] == width * height) {
+ /*
+ * Write a zero for the single symbol
+ * used in the plane, else 0xFF.
+ */
+ for (i = 0; i < 256; i++) {
+ if (i == symbol)
+ bytestream2_put_byte(pb, 0);
+ else
+ bytestream2_put_byte(pb, 0xFF);
+ }
+
+ /* Write zeroes for lengths */
+ for (i = 0; i < c->slices; i++)
+ bytestream2_put_le32(pb, 0);
+
+ /* And that's all for that plane folks */
+ return 0;
+ }
+ break;
+ }
+ }
+
+ /* Calculate huffman lengths */
+ ff_huff_gen_len_table(lengths, counts);
+
+ /*
+ * Write the plane's header into the output packet:
+ * - huffman code lengths (256 bytes)
+ * - slice end offsets (gotten from the slice lengths)
+ */
+ for (i = 0; i < 256; i++) {
+ bytestream2_put_byte(pb, lengths[i]);
+
+ he[i].len = lengths[i];
+ he[i].sym = i;
+ }
+
+ /* Calculate the huffman codes themselves */
+ calculate_codes(he);
+
+ send = 0;
+ for (i = 0; i < c->slices; i++) {
+ sstart = send;
+ send = height * (i + 1) / c->slices;
+
+ /*
+ * Write the huffman codes to a buffer,
+ * get the offset in bits and convert to bytes.
+ */
+ offset += write_huff_codes(dst + sstart * width, c->slice_bits,
+ width * (send - sstart), width,
+ send - sstart, he) >> 3;
+
+ slice_len = offset - slice_len;
+
+ /* Byteswap the written huffman codes */
+ c->dsp.bswap_buf((uint32_t *) c->slice_bits,
+ (uint32_t *) c->slice_bits,
+ slice_len >> 2);
+
+ /* Write the offset to the stream */
+ bytestream2_put_le32(pb, offset);
+
+ /* Seek to the data part of the packet */
+ bytestream2_seek_p(pb, 4 * (c->slices - i - 1) +
+ offset - slice_len, SEEK_CUR);
+
+ /* Write the slices' data into the output packet */
+ bytestream2_put_buffer(pb, c->slice_bits, slice_len);
+
+ /* Seek back to the slice offsets */
+ bytestream2_seek_p(pb, -4 * (c->slices - i - 1) - offset,
+ SEEK_CUR);
+
+ slice_len = offset;
+ }
+
+ /* And at the end seek to the end of written slice(s) */
+ bytestream2_seek_p(pb, offset, SEEK_CUR);
+
+ return 0;
+}
+
+static int utvideo_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
+ const AVFrame *pic, int *got_packet)
+{
+ UtvideoContext *c = avctx->priv_data;
+ PutByteContext pb;
+
+ uint32_t frame_info;
+
+ uint8_t *dst;
+
+ int width = avctx->width, height = avctx->height;
+ int i, ret = 0;
+
+ /* Allocate a new packet if needed, and set it to the pointer dst */
+ ret = ff_alloc_packet(pkt, (256 + 4 * c->slices + width * height) *
+ c->planes + 4);
+
+ if (ret < 0) {
+ av_log(avctx, AV_LOG_ERROR,
+ "Error allocating the output packet, or the provided packet "
+ "was too small.\n");
+ return ret;
+ }
+
+ dst = pkt->data;
+
+ bytestream2_init_writer(&pb, dst, pkt->size);
+
+ av_fast_malloc(&c->slice_bits, &c->slice_bits_size,
+ width * height + FF_INPUT_BUFFER_PADDING_SIZE);
+
+ if (!c->slice_bits) {
+ av_log(avctx, AV_LOG_ERROR, "Cannot allocate temporary buffer 2.\n");
+ return AVERROR(ENOMEM);
+ }
+
+ /* In case of RGB, mangle the planes to Ut Video's format */
+ if (avctx->pix_fmt == AV_PIX_FMT_RGBA || avctx->pix_fmt == AV_PIX_FMT_RGB24)
+ mangle_rgb_planes(c->slice_buffer, c->slice_stride, pic->data[0],
+ c->planes, pic->linesize[0], width, height);
+
+ /* Deal with the planes */
+ switch (avctx->pix_fmt) {
+ case AV_PIX_FMT_RGB24:
+ case AV_PIX_FMT_RGBA:
+ for (i = 0; i < c->planes; i++) {
+ ret = encode_plane(avctx, c->slice_buffer[i] + 2 * c->slice_stride,
+ c->slice_buffer[i], c->slice_stride,
+ width, height, &pb);
+
+ if (ret) {
+ av_log(avctx, AV_LOG_ERROR, "Error encoding plane %d.\n", i);
+ return ret;
+ }
+ }
+ break;
+ case AV_PIX_FMT_YUV422P:
+ for (i = 0; i < c->planes; i++) {
+ ret = encode_plane(avctx, pic->data[i], c->slice_buffer[0],
+ pic->linesize[i], width >> !!i, height, &pb);
+
+ if (ret) {
+ av_log(avctx, AV_LOG_ERROR, "Error encoding plane %d.\n", i);
+ return ret;
+ }
+ }
+ break;
+ case AV_PIX_FMT_YUV420P:
+ for (i = 0; i < c->planes; i++) {
+ ret = encode_plane(avctx, pic->data[i], c->slice_buffer[0],
+ pic->linesize[i], width >> !!i, height >> !!i,
+ &pb);
+
+ if (ret) {
+ av_log(avctx, AV_LOG_ERROR, "Error encoding plane %d.\n", i);
+ return ret;
+ }
+ }
+ break;
+ default:
+ av_log(avctx, AV_LOG_ERROR, "Unknown pixel format: %d\n",
+ avctx->pix_fmt);
+ return AVERROR_INVALIDDATA;
+ }
+
+ /*
+ * Write frame information (LE 32bit unsigned)
+ * into the output packet.
+ * Contains the prediction method.
+ */
+ frame_info = c->frame_pred << 8;
+ bytestream2_put_le32(&pb, frame_info);
+
+ /*
+ * At least currently Ut Video is IDR only.
+ * Set flags accordingly.
+ */
+ avctx->coded_frame->reference = 0;
+ avctx->coded_frame->key_frame = 1;
+ avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I;
+
+ pkt->size = bytestream2_tell_p(&pb);
+ pkt->flags |= AV_PKT_FLAG_KEY;
+
+ /* Packet should be done */
+ *got_packet = 1;
+
+ return 0;
+}
+
+AVCodec ff_utvideo_encoder = {
+ .name = "utvideo",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .id = AV_CODEC_ID_UTVIDEO,
+ .priv_data_size = sizeof(UtvideoContext),
+ .init = utvideo_encode_init,
+ .encode2 = utvideo_encode_frame,
+ .close = utvideo_encode_close,
+ .pix_fmts = (const enum AVPixelFormat[]) {
+ AV_PIX_FMT_RGB24, AV_PIX_FMT_RGBA, AV_PIX_FMT_YUV422P,
+ AV_PIX_FMT_YUV420P, AV_PIX_FMT_NONE
+ },
+ .long_name = NULL_IF_CONFIG_SMALL("Ut Video"),
+};
diff --git a/gst-libs/ext/libav/libavcodec/v210dec.c b/gst-libs/ext/libav/libavcodec/v210dec.c
index 37b4a3c..6c53e36 100644
--- a/gst-libs/ext/libav/libavcodec/v210dec.c
+++ b/gst-libs/ext/libav/libavcodec/v210dec.c
@@ -22,7 +22,10 @@
*/
#include "avcodec.h"
+#include "internal.h"
#include "libavutil/bswap.h"
+#include "libavutil/internal.h"
+#include "libavutil/mem.h"
static av_cold int decode_init(AVCodecContext *avctx)
{
@@ -30,15 +33,17 @@ static av_cold int decode_init(AVCodecContext *avctx)
av_log(avctx, AV_LOG_ERROR, "v210 needs even width\n");
return -1;
}
- avctx->pix_fmt = PIX_FMT_YUV422P10;
+ avctx->pix_fmt = AV_PIX_FMT_YUV422P10;
avctx->bits_per_raw_sample = 10;
avctx->coded_frame = avcodec_alloc_frame();
+ if (!avctx->coded_frame)
+ return AVERROR(ENOMEM);
return 0;
}
-static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
+static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
AVPacket *avpkt)
{
int h, w;
@@ -57,7 +62,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
}
pic->reference = 0;
- if (avctx->get_buffer(avctx, pic) < 0)
+ if (ff_get_buffer(avctx, pic) < 0)
return -1;
y = (uint16_t*)pic->data[0];
@@ -104,7 +109,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
v += pic->linesize[2] / 2 - avctx->width / 2;
}
- *data_size = sizeof(AVFrame);
+ *got_frame = 1;
*(AVFrame*)data = *avctx->coded_frame;
return avpkt->size;
@@ -123,10 +128,10 @@ static av_cold int decode_close(AVCodecContext *avctx)
AVCodec ff_v210_decoder = {
.name = "v210",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_V210,
+ .id = AV_CODEC_ID_V210,
.init = decode_init,
.close = decode_close,
.decode = decode_frame,
.capabilities = CODEC_CAP_DR1,
- .long_name = NULL_IF_CONFIG_SMALL("Uncompressed 4:2:2 10-bit"),
+ .long_name = NULL_IF_CONFIG_SMALL("Uncompressed 4:2:2 10-bit"),
};
diff --git a/gst-libs/ext/libav/libavcodec/v210enc.c b/gst-libs/ext/libav/libavcodec/v210enc.c
index 5861352..ad8a4a5 100644
--- a/gst-libs/ext/libav/libavcodec/v210enc.c
+++ b/gst-libs/ext/libav/libavcodec/v210enc.c
@@ -23,17 +23,13 @@
#include "avcodec.h"
#include "bytestream.h"
+#include "internal.h"
static av_cold int encode_init(AVCodecContext *avctx)
{
if (avctx->width & 1) {
av_log(avctx, AV_LOG_ERROR, "v210 needs even width\n");
- return -1;
- }
-
- if (avctx->pix_fmt != PIX_FMT_YUV422P10) {
- av_log(avctx, AV_LOG_ERROR, "v210 needs YUV422P10\n");
- return -1;
+ return AVERROR(EINVAL);
}
if (avctx->bits_per_raw_sample != 10)
@@ -41,31 +37,33 @@ static av_cold int encode_init(AVCodecContext *avctx)
avctx->bits_per_raw_sample);
avctx->coded_frame = avcodec_alloc_frame();
+ if (!avctx->coded_frame)
+ return AVERROR(ENOMEM);
- avctx->coded_frame->key_frame = 1;
avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I;
return 0;
}
-static int encode_frame(AVCodecContext *avctx, unsigned char *buf,
- int buf_size, void *data)
+static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
+ const AVFrame *pic, int *got_packet)
{
- const AVFrame *pic = data;
int aligned_width = ((avctx->width + 47) / 48) * 48;
int stride = aligned_width * 8 / 3;
- int h, w;
+ int line_padding = stride - ((avctx->width * 8 + 11) / 12) * 4;
+ int h, w, ret;
const uint16_t *y = (const uint16_t*)pic->data[0];
const uint16_t *u = (const uint16_t*)pic->data[1];
const uint16_t *v = (const uint16_t*)pic->data[2];
- uint8_t *p = buf;
- uint8_t *pdst = buf;
+ PutByteContext p;
- if (buf_size < aligned_width * avctx->height * 8 / 3) {
- av_log(avctx, AV_LOG_ERROR, "output buffer too small\n");
- return -1;
+ if ((ret = ff_alloc_packet(pkt, avctx->height * stride)) < 0) {
+ av_log(avctx, AV_LOG_ERROR, "Error getting output packet.\n");
+ return ret;
}
+ bytestream2_init_writer(&p, pkt->data, pkt->size);
+
#define CLIP(v) av_clip(v, 4, 1019)
#define WRITE_PIXELS(a, b, c) \
@@ -73,7 +71,7 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf,
val = CLIP(*a++); \
val |= (CLIP(*b++) << 10) | \
(CLIP(*c++) << 20); \
- bytestream_put_le32(&p, val); \
+ bytestream2_put_le32u(&p, val); \
} while (0)
for (h = 0; h < avctx->height; h++) {
@@ -89,25 +87,26 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf,
val = CLIP(*y++);
if (w == avctx->width - 2)
- bytestream_put_le32(&p, val);
+ bytestream2_put_le32u(&p, val);
}
if (w < avctx->width - 3) {
val |= (CLIP(*u++) << 10) | (CLIP(*y++) << 20);
- bytestream_put_le32(&p, val);
+ bytestream2_put_le32u(&p, val);
val = CLIP(*v++) | (CLIP(*y++) << 10);
- bytestream_put_le32(&p, val);
+ bytestream2_put_le32u(&p, val);
}
- pdst += stride;
- memset(p, 0, pdst - p);
- p = pdst;
+ bytestream2_set_buffer(&p, 0, line_padding);
+
y += pic->linesize[0] / 2 - avctx->width;
u += pic->linesize[1] / 2 - avctx->width / 2;
v += pic->linesize[2] / 2 - avctx->width / 2;
}
- return p - buf;
+ pkt->flags |= AV_PKT_FLAG_KEY;
+ *got_packet = 1;
+ return 0;
}
static av_cold int encode_close(AVCodecContext *avctx)
@@ -120,10 +119,10 @@ static av_cold int encode_close(AVCodecContext *avctx)
AVCodec ff_v210_encoder = {
.name = "v210",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_V210,
+ .id = AV_CODEC_ID_V210,
.init = encode_init,
- .encode = encode_frame,
+ .encode2 = encode_frame,
.close = encode_close,
- .pix_fmts = (const enum PixelFormat[]){PIX_FMT_YUV422P10, PIX_FMT_NONE},
- .long_name = NULL_IF_CONFIG_SMALL("Uncompressed 4:2:2 10-bit"),
+ .pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_YUV422P10, AV_PIX_FMT_NONE },
+ .long_name = NULL_IF_CONFIG_SMALL("Uncompressed 4:2:2 10-bit"),
};
diff --git a/gst-libs/ext/libav/libavcodec/v210x.c b/gst-libs/ext/libav/libavcodec/v210x.c
index 959dec5..0b1b721 100644
--- a/gst-libs/ext/libav/libavcodec/v210x.c
+++ b/gst-libs/ext/libav/libavcodec/v210x.c
@@ -19,7 +19,10 @@
*/
#include "avcodec.h"
+#include "internal.h"
#include "libavutil/bswap.h"
+#include "libavutil/internal.h"
+#include "libavutil/mem.h"
static av_cold int decode_init(AVCodecContext *avctx)
{
@@ -27,7 +30,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
av_log(avctx, AV_LOG_ERROR, "v210x needs even width\n");
return -1;
}
- avctx->pix_fmt = PIX_FMT_YUV422P16;
+ avctx->pix_fmt = AV_PIX_FMT_YUV422P16;
avctx->bits_per_raw_sample= 10;
avctx->coded_frame= avcodec_alloc_frame();
@@ -35,7 +38,8 @@ static av_cold int decode_init(AVCodecContext *avctx)
return 0;
}
-static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt)
+static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
+ AVPacket *avpkt)
{
int y=0;
int width= avctx->width;
@@ -56,7 +60,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
}
pic->reference= 0;
- if(avctx->get_buffer(avctx, pic) < 0)
+ if(ff_get_buffer(avctx, pic) < 0)
return -1;
ydst= (uint16_t *)pic->data[0];
@@ -116,7 +120,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
}
}
- *data_size=sizeof(AVFrame);
+ *got_frame = 1;
*(AVFrame*)data= *avctx->coded_frame;
return avpkt->size;
@@ -135,10 +139,10 @@ static av_cold int decode_close(AVCodecContext *avctx)
AVCodec ff_v210x_decoder = {
.name = "v210x",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_V210X,
+ .id = AV_CODEC_ID_V210X,
.init = decode_init,
.close = decode_close,
.decode = decode_frame,
.capabilities = CODEC_CAP_DR1,
- .long_name = NULL_IF_CONFIG_SMALL("Uncompressed 4:2:2 10-bit"),
+ .long_name = NULL_IF_CONFIG_SMALL("Uncompressed 4:2:2 10-bit"),
};
diff --git a/gst-libs/ext/libav/libavcodec/v410dec.c b/gst-libs/ext/libav/libavcodec/v410dec.c
index a6f236b..efd2093 100644
--- a/gst-libs/ext/libav/libavcodec/v410dec.c
+++ b/gst-libs/ext/libav/libavcodec/v410dec.c
@@ -20,17 +20,23 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "libavutil/common.h"
#include "libavutil/intreadwrite.h"
#include "avcodec.h"
+#include "internal.h"
static av_cold int v410_decode_init(AVCodecContext *avctx)
{
- avctx->pix_fmt = PIX_FMT_YUV444P10;
+ avctx->pix_fmt = AV_PIX_FMT_YUV444P10;
avctx->bits_per_raw_sample = 10;
if (avctx->width & 1) {
- av_log(avctx, AV_LOG_ERROR, "v410 requires even width.\n");
- return AVERROR_INVALIDDATA;
+ if (avctx->err_recognition & AV_EF_EXPLODE) {
+ av_log(avctx, AV_LOG_ERROR, "v410 requires width to be even.\n");
+ return AVERROR_INVALIDDATA;
+ } else {
+ av_log(avctx, AV_LOG_WARNING, "v410 requires width to be even, continuing anyway.\n");
+ }
}
avctx->coded_frame = avcodec_alloc_frame();
@@ -44,7 +50,7 @@ static av_cold int v410_decode_init(AVCodecContext *avctx)
}
static int v410_decode_frame(AVCodecContext *avctx, void *data,
- int *data_size, AVPacket *avpkt)
+ int *got_frame, AVPacket *avpkt)
{
AVFrame *pic = avctx->coded_frame;
uint8_t *src = avpkt->data;
@@ -62,7 +68,7 @@ static int v410_decode_frame(AVCodecContext *avctx, void *data,
pic->reference = 0;
- if (avctx->get_buffer(avctx, pic) < 0) {
+ if (ff_get_buffer(avctx, pic) < 0) {
av_log(avctx, AV_LOG_ERROR, "Could not allocate buffer.\n");
return AVERROR(ENOMEM);
}
@@ -90,7 +96,7 @@ static int v410_decode_frame(AVCodecContext *avctx, void *data,
v += pic->linesize[2] >> 1;
}
- *data_size = sizeof(AVFrame);
+ *got_frame = 1;
*(AVFrame *)data = *pic;
return avpkt->size;
@@ -109,7 +115,7 @@ static av_cold int v410_decode_close(AVCodecContext *avctx)
AVCodec ff_v410_decoder = {
.name = "v410",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_V410,
+ .id = AV_CODEC_ID_V410,
.init = v410_decode_init,
.decode = v410_decode_frame,
.close = v410_decode_close,
diff --git a/gst-libs/ext/libav/libavcodec/v410enc.c b/gst-libs/ext/libav/libavcodec/v410enc.c
index a6b3ddb..cc7cef7 100644
--- a/gst-libs/ext/libav/libavcodec/v410enc.c
+++ b/gst-libs/ext/libav/libavcodec/v410enc.c
@@ -20,8 +20,10 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "libavutil/common.h"
#include "libavutil/intreadwrite.h"
#include "avcodec.h"
+#include "internal.h"
static av_cold int v410_encode_init(AVCodecContext *avctx)
{
@@ -40,20 +42,19 @@ static av_cold int v410_encode_init(AVCodecContext *avctx)
return 0;
}
-static int v410_encode_frame(AVCodecContext *avctx, uint8_t *buf,
- int buf_size, void *data)
+static int v410_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
+ const AVFrame *pic, int *got_packet)
{
- AVFrame *pic = data;
- uint8_t *dst = buf;
+ uint8_t *dst;
uint16_t *y, *u, *v;
uint32_t val;
- int i, j;
- int output_size = 0;
+ int i, j, ret;
- if (buf_size < avctx->width * avctx->height * 4) {
- av_log(avctx, AV_LOG_ERROR, "Out buffer is too small.\n");
- return AVERROR(ENOMEM);
+ if ((ret = ff_alloc_packet(pkt, avctx->width * avctx->height * 4)) < 0) {
+ av_log(avctx, AV_LOG_ERROR, "Error getting output packet.\n");
+ return ret;
}
+ dst = pkt->data;
avctx->coded_frame->reference = 0;
avctx->coded_frame->key_frame = 1;
@@ -70,14 +71,15 @@ static int v410_encode_frame(AVCodecContext *avctx, uint8_t *buf,
val |= (uint32_t) v[j] << 22;
AV_WL32(dst, val);
dst += 4;
- output_size += 4;
}
y += pic->linesize[0] >> 1;
u += pic->linesize[1] >> 1;
v += pic->linesize[2] >> 1;
}
- return output_size;
+ pkt->flags |= AV_PKT_FLAG_KEY;
+ *got_packet = 1;
+ return 0;
}
static av_cold int v410_encode_close(AVCodecContext *avctx)
@@ -90,10 +92,10 @@ static av_cold int v410_encode_close(AVCodecContext *avctx)
AVCodec ff_v410_encoder = {
.name = "v410",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_V410,
+ .id = AV_CODEC_ID_V410,
.init = v410_encode_init,
- .encode = v410_encode_frame,
+ .encode2 = v410_encode_frame,
.close = v410_encode_close,
- .pix_fmts = (const enum PixelFormat[]){ PIX_FMT_YUV444P10, PIX_FMT_NONE },
+ .pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_YUV444P10, AV_PIX_FMT_NONE },
.long_name = NULL_IF_CONFIG_SMALL("Uncompressed 4:4:4 10-bit"),
};
diff --git a/gst-libs/ext/libav/libavcodec/vaapi.h b/gst-libs/ext/libav/libavcodec/vaapi.h
index 36fb386..39e8825 100644
--- a/gst-libs/ext/libav/libavcodec/vaapi.h
+++ b/gst-libs/ext/libav/libavcodec/vaapi.h
@@ -24,11 +24,17 @@
#ifndef AVCODEC_VAAPI_H
#define AVCODEC_VAAPI_H
+/**
+ * @file
+ * @ingroup lavc_codec_hwaccel_vaapi
+ * Public libavcodec VA API header.
+ */
+
#include <stdint.h>
/**
- * @defgroup VAAPI_Decoding VA API Decoding
- * @ingroup Decoder
+ * @defgroup lavc_codec_hwaccel_vaapi VA API Decoding
+ * @ingroup lavc_codec_hwaccel
* @{
*/
diff --git a/gst-libs/ext/libav/libavcodec/vaapi_h264.c b/gst-libs/ext/libav/libavcodec/vaapi_h264.c
index 820568a..4ffc7d8 100644
--- a/gst-libs/ext/libav/libavcodec/vaapi_h264.c
+++ b/gst-libs/ext/libav/libavcodec/vaapi_h264.c
@@ -339,8 +339,8 @@ static int decode_slice(AVCodecContext *avctx,
AVHWAccel ff_h264_vaapi_hwaccel = {
.name = "h264_vaapi",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_H264,
- .pix_fmt = PIX_FMT_VAAPI_VLD,
+ .id = AV_CODEC_ID_H264,
+ .pix_fmt = AV_PIX_FMT_VAAPI_VLD,
.start_frame = start_frame,
.end_frame = end_frame,
.decode_slice = decode_slice,
diff --git a/gst-libs/ext/libav/libavcodec/vaapi_mpeg2.c b/gst-libs/ext/libav/libavcodec/vaapi_mpeg2.c
index 95107c8..cfe5d3a 100644
--- a/gst-libs/ext/libav/libavcodec/vaapi_mpeg2.c
+++ b/gst-libs/ext/libav/libavcodec/vaapi_mpeg2.c
@@ -132,7 +132,7 @@ static int vaapi_mpeg2_decode_slice(AVCodecContext *avctx, const uint8_t *buffer
return -1;
slice_param->macroblock_offset = macroblock_offset;
slice_param->slice_horizontal_position = s->mb_x;
- slice_param->slice_vertical_position = s->mb_y;
+ slice_param->slice_vertical_position = s->mb_y >> (s->picture_structure != PICT_FRAME);
slice_param->quantiser_scale_code = quantiser_scale_code;
slice_param->intra_slice_flag = intra_slice_flag;
return 0;
@@ -141,8 +141,8 @@ static int vaapi_mpeg2_decode_slice(AVCodecContext *avctx, const uint8_t *buffer
AVHWAccel ff_mpeg2_vaapi_hwaccel = {
.name = "mpeg2_vaapi",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_MPEG2VIDEO,
- .pix_fmt = PIX_FMT_VAAPI_VLD,
+ .id = AV_CODEC_ID_MPEG2VIDEO,
+ .pix_fmt = AV_PIX_FMT_VAAPI_VLD,
.start_frame = vaapi_mpeg2_start_frame,
.end_frame = vaapi_mpeg2_end_frame,
.decode_slice = vaapi_mpeg2_decode_slice,
diff --git a/gst-libs/ext/libav/libavcodec/vaapi_mpeg4.c b/gst-libs/ext/libav/libavcodec/vaapi_mpeg4.c
index 41d54c6..7d9ffd7 100644
--- a/gst-libs/ext/libav/libavcodec/vaapi_mpeg4.c
+++ b/gst-libs/ext/libav/libavcodec/vaapi_mpeg4.c
@@ -60,7 +60,7 @@ static int vaapi_mpeg4_start_frame(AVCodecContext *avctx, av_unused const uint8_
pic_param->forward_reference_picture = VA_INVALID_ID;
pic_param->backward_reference_picture = VA_INVALID_ID;
pic_param->vol_fields.value = 0; /* reset all bits */
- pic_param->vol_fields.bits.short_video_header = avctx->codec->id == CODEC_ID_H263;
+ pic_param->vol_fields.bits.short_video_header = avctx->codec->id == AV_CODEC_ID_H263;
pic_param->vol_fields.bits.chroma_format = CHROMA_420;
pic_param->vol_fields.bits.interlaced = !s->progressive_sequence;
pic_param->vol_fields.bits.obmc_disable = 1;
@@ -132,7 +132,7 @@ static int vaapi_mpeg4_decode_slice(AVCodecContext *avctx, const uint8_t *buffer
* a single slice param. So fake macroblock_number for Libav so
* that we don't call vaapi_mpeg4_decode_slice() again
*/
- if (avctx->codec->id == CODEC_ID_H263)
+ if (avctx->codec->id == AV_CODEC_ID_H263)
size = s->gb.buffer_end - buffer;
/* Fill in VASliceParameterBufferMPEG4 */
@@ -143,7 +143,7 @@ static int vaapi_mpeg4_decode_slice(AVCodecContext *avctx, const uint8_t *buffer
slice_param->macroblock_number = s->mb_y * s->mb_width + s->mb_x;
slice_param->quant_scale = s->qscale;
- if (avctx->codec->id == CODEC_ID_H263)
+ if (avctx->codec->id == AV_CODEC_ID_H263)
s->mb_y = s->mb_height;
return 0;
@@ -153,8 +153,8 @@ static int vaapi_mpeg4_decode_slice(AVCodecContext *avctx, const uint8_t *buffer
AVHWAccel ff_mpeg4_vaapi_hwaccel = {
.name = "mpeg4_vaapi",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_MPEG4,
- .pix_fmt = PIX_FMT_VAAPI_VLD,
+ .id = AV_CODEC_ID_MPEG4,
+ .pix_fmt = AV_PIX_FMT_VAAPI_VLD,
.start_frame = vaapi_mpeg4_start_frame,
.end_frame = vaapi_mpeg4_end_frame,
.decode_slice = vaapi_mpeg4_decode_slice,
@@ -165,8 +165,8 @@ AVHWAccel ff_mpeg4_vaapi_hwaccel = {
AVHWAccel ff_h263_vaapi_hwaccel = {
.name = "h263_vaapi",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_H263,
- .pix_fmt = PIX_FMT_VAAPI_VLD,
+ .id = AV_CODEC_ID_H263,
+ .pix_fmt = AV_PIX_FMT_VAAPI_VLD,
.start_frame = vaapi_mpeg4_start_frame,
.end_frame = vaapi_mpeg4_end_frame,
.decode_slice = vaapi_mpeg4_decode_slice,
diff --git a/gst-libs/ext/libav/libavcodec/vaapi_vc1.c b/gst-libs/ext/libav/libavcodec/vaapi_vc1.c
index df3f77e..4a98ba7 100644
--- a/gst-libs/ext/libav/libavcodec/vaapi_vc1.c
+++ b/gst-libs/ext/libav/libavcodec/vaapi_vc1.c
@@ -326,7 +326,7 @@ static int vaapi_vc1_decode_slice(AVCodecContext *avctx, const uint8_t *buffer,
av_dlog(avctx, "vaapi_vc1_decode_slice(): buffer %p, size %d\n", buffer, size);
/* Current bit buffer is beyond any marker for VC-1, so skip it */
- if (avctx->codec_id == CODEC_ID_VC1 && IS_MARKER(AV_RB32(buffer))) {
+ if (avctx->codec_id == AV_CODEC_ID_VC1 && IS_MARKER(AV_RB32(buffer))) {
buffer += 4;
size -= 4;
}
@@ -344,8 +344,8 @@ static int vaapi_vc1_decode_slice(AVCodecContext *avctx, const uint8_t *buffer,
AVHWAccel ff_wmv3_vaapi_hwaccel = {
.name = "wmv3_vaapi",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_WMV3,
- .pix_fmt = PIX_FMT_VAAPI_VLD,
+ .id = AV_CODEC_ID_WMV3,
+ .pix_fmt = AV_PIX_FMT_VAAPI_VLD,
.start_frame = vaapi_vc1_start_frame,
.end_frame = vaapi_vc1_end_frame,
.decode_slice = vaapi_vc1_decode_slice,
@@ -355,8 +355,8 @@ AVHWAccel ff_wmv3_vaapi_hwaccel = {
AVHWAccel ff_vc1_vaapi_hwaccel = {
.name = "vc1_vaapi",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_VC1,
- .pix_fmt = PIX_FMT_VAAPI_VLD,
+ .id = AV_CODEC_ID_VC1,
+ .pix_fmt = AV_PIX_FMT_VAAPI_VLD,
.start_frame = vaapi_vc1_start_frame,
.end_frame = vaapi_vc1_end_frame,
.decode_slice = vaapi_vc1_decode_slice,
diff --git a/gst-libs/ext/libav/libavcodec/vb.c b/gst-libs/ext/libav/libavcodec/vb.c
index a1052ef..1e241e7 100644
--- a/gst-libs/ext/libav/libavcodec/vb.c
+++ b/gst-libs/ext/libav/libavcodec/vb.c
@@ -29,6 +29,7 @@
#include "avcodec.h"
#include "bytestream.h"
+#include "internal.h"
enum VBFlags{
VB_HAS_GMC = 0x01,
@@ -184,7 +185,8 @@ static int vb_decode_framedata(VBDecContext *c, int offset)
return 0;
}
-static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt)
+static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
+ AVPacket *avpkt)
{
VBDecContext * const c = avctx->priv_data;
uint8_t *outptr, *srcptr;
@@ -198,7 +200,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
if(c->pic.data[0])
avctx->release_buffer(avctx, &c->pic);
c->pic.reference = 1;
- if(avctx->get_buffer(avctx, &c->pic) < 0){
+ if(ff_get_buffer(avctx, &c->pic) < 0){
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return -1;
}
@@ -234,7 +236,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
FFSWAP(uint8_t*, c->frame, c->prev_frame);
- *data_size = sizeof(AVFrame);
+ *got_frame = 1;
*(AVFrame*)data = c->pic;
/* always report that the buffer was completely consumed */
@@ -246,7 +248,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
VBDecContext * const c = avctx->priv_data;
c->avctx = avctx;
- avctx->pix_fmt = PIX_FMT_PAL8;
+ avctx->pix_fmt = AV_PIX_FMT_PAL8;
c->frame = av_mallocz(avctx->width * avctx->height);
c->prev_frame = av_mallocz(avctx->width * avctx->height);
@@ -269,11 +271,11 @@ static av_cold int decode_end(AVCodecContext *avctx)
AVCodec ff_vb_decoder = {
.name = "vb",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_VB,
+ .id = AV_CODEC_ID_VB,
.priv_data_size = sizeof(VBDecContext),
.init = decode_init,
.close = decode_end,
.decode = decode_frame,
- .long_name = NULL_IF_CONFIG_SMALL("Beam Software VB"),
+ .long_name = NULL_IF_CONFIG_SMALL("Beam Software VB"),
+ .capabilities = CODEC_CAP_DR1,
};
-
diff --git a/gst-libs/ext/libav/libavcodec/vble.c b/gst-libs/ext/libav/libavcodec/vble.c
index 574582a..228b1bd 100644
--- a/gst-libs/ext/libav/libavcodec/vble.c
+++ b/gst-libs/ext/libav/libavcodec/vble.c
@@ -29,6 +29,8 @@
#include "avcodec.h"
#include "dsputil.h"
#include "get_bits.h"
+#include "internal.h"
+#include "mathops.h"
typedef struct {
AVCodecContext *avctx;
@@ -44,7 +46,7 @@ static uint8_t vble_read_reverse_unary(GetBitContext *gb)
uint8_t val = show_bits(gb, 8);
if (val) {
- val = 7 - av_log2_16bit(av_reverse[val]);
+ val = 7 - av_log2_16bit(ff_reverse[val]);
skip_bits(gb, val + 1);
return val;
} else {
@@ -110,7 +112,7 @@ static void vble_restore_plane(VBLEContext *ctx, int plane, int offset,
}
}
-static int vble_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
+static int vble_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
AVPacket *avpkt)
{
VBLEContext *ctx = avctx->priv_data;
@@ -128,7 +130,7 @@ static int vble_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
avctx->release_buffer(avctx, pic);
/* Allocate buffer */
- if (avctx->get_buffer(avctx, pic) < 0) {
+ if (ff_get_buffer(avctx, pic) < 0) {
av_log(avctx, AV_LOG_ERROR, "Could not allocate buffer.\n");
return AVERROR(ENOMEM);
}
@@ -140,10 +142,8 @@ static int vble_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
/* Version should always be 1 */
version = AV_RL32(src);
- if (version != 1) {
- av_log(avctx, AV_LOG_ERROR, "Unsupported VBLE Version: %d\n", version);
- return AVERROR_INVALIDDATA;
- }
+ if (version != 1)
+ av_log(avctx, AV_LOG_WARNING, "Unsupported VBLE Version: %d\n", version);
init_get_bits(&gb, src + 4, (avpkt->size - 4) * 8);
@@ -165,7 +165,7 @@ static int vble_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
vble_restore_plane(ctx, 2, offset, width_uv, height_uv);
}
- *data_size = sizeof(AVFrame);
+ *got_frame = 1;
*(AVFrame *)data = *pic;
return avpkt->size;
@@ -191,9 +191,9 @@ static av_cold int vble_decode_init(AVCodecContext *avctx)
/* Stash for later use */
ctx->avctx = avctx;
- dsputil_init(&ctx->dsp, avctx);
+ ff_dsputil_init(&ctx->dsp, avctx);
- avctx->pix_fmt = PIX_FMT_YUV420P;
+ avctx->pix_fmt = AV_PIX_FMT_YUV420P;
avctx->bits_per_raw_sample = 8;
avctx->coded_frame = avcodec_alloc_frame();
@@ -219,7 +219,7 @@ static av_cold int vble_decode_init(AVCodecContext *avctx)
AVCodec ff_vble_decoder = {
.name = "vble",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_VBLE,
+ .id = AV_CODEC_ID_VBLE,
.priv_data_size = sizeof(VBLEContext),
.init = vble_decode_init,
.close = vble_decode_close,
diff --git a/gst-libs/ext/libav/libavcodec/vc1.c b/gst-libs/ext/libav/libavcodec/vc1.c
index 6135ebd..a8dd38a 100644
--- a/gst-libs/ext/libav/libavcodec/vc1.c
+++ b/gst-libs/ext/libav/libavcodec/vc1.c
@@ -291,7 +291,7 @@ static int decode_sequence_header_adv(VC1Context *v, GetBitContext *gb);
* @param gb GetBit context initialized from Codec context extra_data
* @return Status
*/
-int vc1_decode_sequence_header(AVCodecContext *avctx, VC1Context *v, GetBitContext *gb)
+int ff_vc1_decode_sequence_header(AVCodecContext *avctx, VC1Context *v, GetBitContext *gb)
{
av_log(avctx, AV_LOG_DEBUG, "Header: %0X\n", show_bits(gb, 32));
v->profile = get_bits(gb, 2);
@@ -304,8 +304,8 @@ int vc1_decode_sequence_header(AVCodecContext *avctx, VC1Context *v, GetBitConte
v->zz_4x8 = ff_vc1_adv_progressive_4x8_zz;
return decode_sequence_header_adv(v, gb);
} else {
- v->zz_8x4 = wmv2_scantableA;
- v->zz_4x8 = wmv2_scantableB;
+ v->zz_8x4 = ff_wmv2_scantableA;
+ v->zz_4x8 = ff_wmv2_scantableB;
v->res_y411 = get_bits1(gb);
v->res_sprite = get_bits1(gb);
if (v->res_y411) {
@@ -394,8 +394,6 @@ int vc1_decode_sequence_header(AVCodecContext *avctx, VC1Context *v, GetBitConte
v->res_rtm_flag = get_bits1(gb); //reserved
}
if (!v->res_rtm_flag) {
-// av_log(avctx, AV_LOG_ERROR,
-// "0 for reserved RES_RTM_FLAG is forbidden\n");
av_log(avctx, AV_LOG_ERROR,
"Old WMV3 version detected, some frames may be decoded incorrectly\n");
//return -1;
@@ -524,7 +522,7 @@ static int decode_sequence_header_adv(VC1Context *v, GetBitContext *gb)
return 0;
}
-int vc1_decode_entry_point(AVCodecContext *avctx, VC1Context *v, GetBitContext *gb)
+int ff_vc1_decode_entry_point(AVCodecContext *avctx, VC1Context *v, GetBitContext *gb)
{
int i;
@@ -572,13 +570,18 @@ int vc1_decode_entry_point(AVCodecContext *avctx, VC1Context *v, GetBitContext *
return 0;
}
-int vc1_parse_frame_header(VC1Context *v, GetBitContext* gb)
+int ff_vc1_parse_frame_header(VC1Context *v, GetBitContext* gb)
{
int pqindex, lowquant, status;
if (v->finterpflag)
v->interpfrm = get_bits1(gb);
- skip_bits(gb, 2); //framecnt unused
+ if (v->s.avctx->codec_id == AV_CODEC_ID_MSS2)
+ v->respic =
+ v->rangered =
+ v->multires = get_bits(gb, 2) == 1;
+ else
+ skip_bits(gb, 2); //framecnt unused
v->rangeredfrm = 0;
if (v->rangered)
v->rangeredfrm = get_bits1(gb);
@@ -649,8 +652,9 @@ int vc1_parse_frame_header(VC1Context *v, GetBitContext* gb)
v->x8_type = get_bits1(gb);
} else
v->x8_type = 0;
-//av_log(v->s.avctx, AV_LOG_INFO, "%c Frame: QP=[%i]%i (+%i/2) %i\n",
-// (v->s.pict_type == AV_PICTURE_TYPE_P) ? 'P' : ((v->s.pict_type == AV_PICTURE_TYPE_I) ? 'I' : 'B'), pqindex, v->pq, v->halfpq, v->rangeredfrm);
+ av_dlog(v->s.avctx, "%c Frame: QP=[%i]%i (+%i/2) %i\n",
+ (v->s.pict_type == AV_PICTURE_TYPE_P) ? 'P' : ((v->s.pict_type == AV_PICTURE_TYPE_I) ? 'I' : 'B'),
+ pqindex, v->pq, v->halfpq, v->rangeredfrm);
if (v->s.pict_type == AV_PICTURE_TYPE_I || v->s.pict_type == AV_PICTURE_TYPE_P)
v->use_ic = 0;
@@ -815,7 +819,7 @@ int vc1_parse_frame_header(VC1Context *v, GetBitContext* gb)
lutuv[i] = av_clip_uint8((scale * (i - 128) + 128*64 + 32) >> 6); \
}
-int vc1_parse_frame_header_adv(VC1Context *v, GetBitContext* gb)
+int ff_vc1_parse_frame_header_adv(VC1Context *v, GetBitContext* gb)
{
int pqindex, lowquant;
int status;
@@ -894,30 +898,30 @@ int vc1_parse_frame_header_adv(VC1Context *v, GetBitContext* gb)
if (v->field_mode) {
if (!v->refdist_flag)
v->refdist = 0;
- else {
- if ((v->s.pict_type != AV_PICTURE_TYPE_B)
- && (v->s.pict_type != AV_PICTURE_TYPE_BI)) {
- v->refdist = get_bits(gb, 2);
- if (v->refdist == 3)
- v->refdist += get_unary(gb, 0, 16);
- } else {
- v->bfraction_lut_index = get_vlc2(gb, ff_vc1_bfraction_vlc.table, VC1_BFRACTION_VLC_BITS, 1);
- v->bfraction = ff_vc1_bfraction_lut[v->bfraction_lut_index];
- v->frfd = (v->bfraction * v->refdist) >> 8;
- v->brfd = v->refdist - v->frfd - 1;
- if (v->brfd < 0)
- v->brfd = 0;
- }
+ else if ((v->s.pict_type != AV_PICTURE_TYPE_B) && (v->s.pict_type != AV_PICTURE_TYPE_BI)) {
+ v->refdist = get_bits(gb, 2);
+ if (v->refdist == 3)
+ v->refdist += get_unary(gb, 0, 16);
+ }
+ if ((v->s.pict_type == AV_PICTURE_TYPE_B) || (v->s.pict_type == AV_PICTURE_TYPE_BI)) {
+ v->bfraction_lut_index = get_vlc2(gb, ff_vc1_bfraction_vlc.table, VC1_BFRACTION_VLC_BITS, 1);
+ v->bfraction = ff_vc1_bfraction_lut[v->bfraction_lut_index];
+ v->frfd = (v->bfraction * v->refdist) >> 8;
+ v->brfd = v->refdist - v->frfd - 1;
+ if (v->brfd < 0)
+ v->brfd = 0;
}
goto parse_common_info;
}
- if (v->finterpflag)
- v->interpfrm = get_bits1(gb);
- if (v->s.pict_type == AV_PICTURE_TYPE_B) {
- v->bfraction_lut_index = get_vlc2(gb, ff_vc1_bfraction_vlc.table, VC1_BFRACTION_VLC_BITS, 1);
- v->bfraction = ff_vc1_bfraction_lut[v->bfraction_lut_index];
- if (v->bfraction == 0) {
- v->s.pict_type = AV_PICTURE_TYPE_BI; /* XXX: should not happen here */
+ if (v->fcm == PROGRESSIVE) {
+ if (v->finterpflag)
+ v->interpfrm = get_bits1(gb);
+ if (v->s.pict_type == AV_PICTURE_TYPE_B) {
+ v->bfraction_lut_index = get_vlc2(gb, ff_vc1_bfraction_vlc.table, VC1_BFRACTION_VLC_BITS, 1);
+ v->bfraction = ff_vc1_bfraction_lut[v->bfraction_lut_index];
+ if (v->bfraction == 0) {
+ v->s.pict_type = AV_PICTURE_TYPE_BI; /* XXX: should not happen here */
+ }
}
}
@@ -1219,6 +1223,11 @@ int vc1_parse_frame_header_adv(VC1Context *v, GetBitContext* gb)
break;
}
+ if (v->fcm != PROGRESSIVE && !v->s.quarter_sample) {
+ v->range_x <<= 1;
+ v->range_y <<= 1;
+ }
+
/* AC Syntax */
v->c_ac_table_index = decode012(gb);
if (v->s.pict_type == AV_PICTURE_TYPE_I || v->s.pict_type == AV_PICTURE_TYPE_BI) {
diff --git a/gst-libs/ext/libav/libavcodec/vc1.h b/gst-libs/ext/libav/libavcodec/vc1.h
index 0b94cbf..13011ae 100644
--- a/gst-libs/ext/libav/libavcodec/vc1.h
+++ b/gst-libs/ext/libav/libavcodec/vc1.h
@@ -394,6 +394,8 @@ typedef struct VC1Context{
uint8_t broken_link; ///< Broken link flag (BROKEN_LINK syntax element)
uint8_t closed_entry; ///< Closed entry point flag (CLOSED_ENTRY syntax element)
+ int end_mb_x; ///< Horizontal macroblock limit (used only by mss2)
+
int parse_only; ///< Context is used within parser
int warn_interlaced;
@@ -443,12 +445,17 @@ static av_always_inline int vc1_unescape_buffer(const uint8_t *src, int size, ui
* @param gb GetBit context initialized from Codec context extra_data
* @return Status
*/
-int vc1_decode_sequence_header(AVCodecContext *avctx, VC1Context *v, GetBitContext *gb);
+int ff_vc1_decode_sequence_header(AVCodecContext *avctx, VC1Context *v, GetBitContext *gb);
-int vc1_decode_entry_point(AVCodecContext *avctx, VC1Context *v, GetBitContext *gb);
+int ff_vc1_decode_entry_point(AVCodecContext *avctx, VC1Context *v, GetBitContext *gb);
-int vc1_parse_frame_header (VC1Context *v, GetBitContext *gb);
-int vc1_parse_frame_header_adv(VC1Context *v, GetBitContext *gb);
+int ff_vc1_parse_frame_header (VC1Context *v, GetBitContext *gb);
+int ff_vc1_parse_frame_header_adv(VC1Context *v, GetBitContext *gb);
int ff_vc1_init_common(VC1Context *v);
+av_cold int ff_vc1_decode_init_alloc_tables(VC1Context *v);
+av_cold void ff_vc1_init_transposed_scantables(VC1Context *v);
+av_cold int ff_vc1_decode_end(AVCodecContext *avctx);
+void ff_vc1_decode_blocks(VC1Context *v);
+
#endif /* AVCODEC_VC1_H */
diff --git a/gst-libs/ext/libav/libavcodec/vc1_parser.c b/gst-libs/ext/libav/libavcodec/vc1_parser.c
index cdea0d7..5aa1248 100644
--- a/gst-libs/ext/libav/libavcodec/vc1_parser.c
+++ b/gst-libs/ext/libav/libavcodec/vc1_parser.c
@@ -57,16 +57,16 @@ static void vc1_extract_headers(AVCodecParserContext *s, AVCodecContext *avctx,
if(size <= 0) continue;
switch(AV_RB32(start)){
case VC1_CODE_SEQHDR:
- vc1_decode_sequence_header(avctx, &vpc->v, &gb);
+ ff_vc1_decode_sequence_header(avctx, &vpc->v, &gb);
break;
case VC1_CODE_ENTRYPOINT:
- vc1_decode_entry_point(avctx, &vpc->v, &gb);
+ ff_vc1_decode_entry_point(avctx, &vpc->v, &gb);
break;
case VC1_CODE_FRAME:
if(vpc->v.profile < PROFILE_ADVANCED)
- vc1_parse_frame_header (&vpc->v, &gb);
+ ff_vc1_parse_frame_header (&vpc->v, &gb);
else
- vc1_parse_frame_header_adv(&vpc->v, &gb);
+ ff_vc1_parse_frame_header_adv(&vpc->v, &gb);
/* keep AV_PICTURE_TYPE_BI internal to VC1 */
if (vpc->v.s.pict_type == AV_PICTURE_TYPE_BI)
@@ -192,10 +192,10 @@ static int vc1_parse_init(AVCodecParserContext *s)
}
AVCodecParser ff_vc1_parser = {
- .codec_ids = { CODEC_ID_VC1 },
+ .codec_ids = { AV_CODEC_ID_VC1 },
.priv_data_size = sizeof(VC1ParseContext),
.parser_init = vc1_parse_init,
.parser_parse = vc1_parse,
- .parser_close = ff_parse1_close,
+ .parser_close = ff_parse_close,
.split = vc1_split,
};
diff --git a/gst-libs/ext/libav/libavcodec/vc1data.c b/gst-libs/ext/libav/libavcodec/vc1data.c
index e0baf94..70cead8 100644
--- a/gst-libs/ext/libav/libavcodec/vc1data.c
+++ b/gst-libs/ext/libav/libavcodec/vc1data.c
@@ -645,7 +645,7 @@ const uint8_t ff_vc1_2ref_mvdata_bits[8][126] = {
}
};
-const uint8_t wmv3_dc_scale_table[32] = {
+const uint8_t ff_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
};
@@ -1094,7 +1094,7 @@ const int32_t ff_vc1_dqscale[63] = {
};
/* P Interlaced field picture MV predictor scaling values (Table 114) */
-const uint16_t vc1_field_mvpred_scales[2][7][4] = {
+const uint16_t ff_vc1_field_mvpred_scales[2][7][4] = {
// Refdist:
// 0 1 2 3 or greater
{ // current field is first
@@ -1118,7 +1118,7 @@ const uint16_t vc1_field_mvpred_scales[2][7][4] = {
};
/* B Interlaced field picture backward MV predictor scaling values for first field (Table 115) */
-const uint16_t vc1_b_field_mvpred_scales[7][4] = {
+const uint16_t ff_vc1_b_field_mvpred_scales[7][4] = {
// BRFD:
// 0 1 2 3 or greater
{ 171, 205, 219, 228 }, // SCALESAME
diff --git a/gst-libs/ext/libav/libavcodec/vc1data.h b/gst-libs/ext/libav/libavcodec/vc1data.h
index 8345bf5..84e8188 100644
--- a/gst-libs/ext/libav/libavcodec/vc1data.h
+++ b/gst-libs/ext/libav/libavcodec/vc1data.h
@@ -126,7 +126,7 @@ extern const uint8_t ff_vc1_4mv_block_pattern_bits[4][16];
extern const uint8_t ff_vc1_2mv_block_pattern_codes[4][4];
extern const uint8_t ff_vc1_2mv_block_pattern_bits[4][4];
-extern const uint8_t wmv3_dc_scale_table[32];
+extern const uint8_t ff_wmv3_dc_scale_table[32];
/* P-Picture CBPCY VLC tables */
extern const uint16_t ff_vc1_cbpcy_p_codes[4][64];
@@ -197,9 +197,9 @@ extern const int8_t ff_vc1_intra_vert_8x8_zz [64];
extern const int32_t ff_vc1_dqscale[63];
/* P Interlaced field picture MV predictor scaling values (Table 114) */
-extern const uint16_t vc1_field_mvpred_scales[2][7][4];
+extern const uint16_t ff_vc1_field_mvpred_scales[2][7][4];
/* B Interlaced field picture backward MV predictor scaling values for first field (Table 115) */
-extern const uint16_t vc1_b_field_mvpred_scales[7][4];
+extern const uint16_t ff_vc1_b_field_mvpred_scales[7][4];
#define AC_MODES 8
diff --git a/gst-libs/ext/libav/libavcodec/vc1dec.c b/gst-libs/ext/libav/libavcodec/vc1dec.c
index 9bc340b..c29f91c 100644
--- a/gst-libs/ext/libav/libavcodec/vc1dec.c
+++ b/gst-libs/ext/libav/libavcodec/vc1dec.c
@@ -36,7 +36,6 @@
#include "vc1acdata.h"
#include "msmpeg4data.h"
#include "unary.h"
-#include "simple_idct.h"
#include "mathops.h"
#include "vdpau_internal.h"
@@ -431,19 +430,19 @@ static void vc1_mc_1mv(VC1Context *v, int dir)
if (v->rangeredfrm || (v->mv_mode == MV_PMODE_INTENSITY_COMP)
|| s->h_edge_pos < 22 || v_edge_pos < 22
|| (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) {
+ || (unsigned)(src_y - 1) > v_edge_pos - (my&3) - 16 - 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->vdsp.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->vdsp.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->vdsp.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 */
@@ -668,10 +667,10 @@ static void vc1_mc_4mv_luma(VC1Context *v, int n, int dir)
|| (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->vdsp.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) {
@@ -795,6 +794,7 @@ static void vc1_mc_4mv_chroma(VC1Context *v, int dir)
/* calculate chroma MV vector from four luma MVs */
if (!v->field_mode || (v->field_mode && !v->numref)) {
valid_count = get_chroma_mv(mvx, mvy, intra, 0, &tx, &ty);
+ chroma_ref_type = v->reffield;
if (!valid_count) {
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;
@@ -868,12 +868,12 @@ static void vc1_mc_4mv_chroma(VC1Context *v, int dir)
|| s->h_edge_pos < 18 || v_edge_pos < 18
|| (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);
+ s->vdsp.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->vdsp.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;
@@ -973,12 +973,12 @@ static void vc1_mc_4mv_chroma4(VC1Context *v)
|| s->h_edge_pos < 10 || v_edge_pos < (5 << fieldmv)
|| (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);
+ s->vdsp.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->vdsp.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;
@@ -1048,6 +1048,11 @@ static void vc1_mc_4mv_chroma4(VC1Context *v)
mquant = v->altpq; \
if ((edges&8) && s->mb_y == (s->mb_height - 1)) \
mquant = v->altpq; \
+ if (!mquant || mquant > 31) { \
+ av_log(v->s.avctx, AV_LOG_ERROR, \
+ "Overriding invalid mquant %d\n", mquant); \
+ mquant = 1; \
+ } \
}
/**
@@ -1128,8 +1133,12 @@ static av_always_inline void get_mvdata_interlaced(VC1Context *v, int *dmv_x,
*dmv_x = get_bits(gb, v->k_x);
*dmv_y = get_bits(gb, v->k_y);
if (v->numref) {
- *pred_flag = *dmv_y & 1;
- *dmv_y = (*dmv_y + *pred_flag) >> 1;
+ if (pred_flag) {
+ *pred_flag = *dmv_y & 1;
+ *dmv_y = (*dmv_y + *pred_flag) >> 1;
+ } else {
+ *dmv_y = (*dmv_y + (*dmv_y & 1)) >> 1;
+ }
}
}
else {
@@ -1155,7 +1164,7 @@ static av_always_inline void get_mvdata_interlaced(VC1Context *v, int *dmv_x,
*dmv_y = (sign ^ ((val >> 1) + offs_tab[index1 >> v->numref])) - sign;
} else
*dmv_y = 0;
- if (v->numref)
+ if (v->numref && pred_flag)
*pred_flag = index1 & 1;
}
}
@@ -1173,10 +1182,10 @@ 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[table_index][1][refdist];
- scalesame2 = vc1_field_mvpred_scales[table_index][2][refdist];
- scalezone1_x = vc1_field_mvpred_scales[table_index][3][refdist];
- zone1offset_x = vc1_field_mvpred_scales[table_index][5][refdist];
+ scalesame1 = ff_vc1_field_mvpred_scales[table_index][1][refdist];
+ scalesame2 = ff_vc1_field_mvpred_scales[table_index][2][refdist];
+ scalezone1_x = ff_vc1_field_mvpred_scales[table_index][3][refdist];
+ zone1offset_x = ff_vc1_field_mvpred_scales[table_index][5][refdist];
if (FFABS(n) > 255)
scaledvalue = n;
@@ -1206,10 +1215,10 @@ 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[table_index][1][refdist];
- scalesame2 = vc1_field_mvpred_scales[table_index][2][refdist];
- scalezone1_y = vc1_field_mvpred_scales[table_index][4][refdist];
- zone1offset_y = vc1_field_mvpred_scales[table_index][6][refdist];
+ scalesame1 = ff_vc1_field_mvpred_scales[table_index][1][refdist];
+ scalesame2 = ff_vc1_field_mvpred_scales[table_index][2][refdist];
+ scalezone1_y = ff_vc1_field_mvpred_scales[table_index][4][refdist];
+ zone1offset_y = ff_vc1_field_mvpred_scales[table_index][6][refdist];
if (FFABS(n) > 63)
scaledvalue = n;
@@ -1237,10 +1246,10 @@ static av_always_inline int scaleforopp_x(VC1Context *v, int n /* MV */)
int scaledvalue;
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];
+ scalezone1_x = ff_vc1_b_field_mvpred_scales[3][brfd];
+ zone1offset_x = ff_vc1_b_field_mvpred_scales[5][brfd];
+ scaleopp1 = ff_vc1_b_field_mvpred_scales[1][brfd];
+ scaleopp2 = ff_vc1_b_field_mvpred_scales[2][brfd];
if (FFABS(n) > 255)
scaledvalue = n;
@@ -1264,10 +1273,10 @@ static av_always_inline int scaleforopp_y(VC1Context *v, int n /* MV */, int dir
int scaledvalue;
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];
+ scalezone1_y = ff_vc1_b_field_mvpred_scales[4][brfd];
+ zone1offset_y = ff_vc1_b_field_mvpred_scales[6][brfd];
+ scaleopp1 = ff_vc1_b_field_mvpred_scales[1][brfd];
+ scaleopp2 = ff_vc1_b_field_mvpred_scales[2][brfd];
if (FFABS(n) > 63)
scaledvalue = n;
@@ -1303,7 +1312,7 @@ static av_always_inline int scaleforsame(VC1Context *v, int i, int n /* MV */,
return n;
}
brfd = FFMIN(v->brfd, 3);
- scalesame = vc1_b_field_mvpred_scales[0][brfd];
+ scalesame = ff_vc1_b_field_mvpred_scales[0][brfd];
n = (n * scalesame >> 8) << hpel;
return n;
@@ -1327,7 +1336,7 @@ static av_always_inline int scaleforopp(VC1Context *v, int n /* MV */,
refdist = FFMIN(v->refdist, 3);
else
refdist = dir ? v->brfd : v->frfd;
- scaleopp = vc1_field_mvpred_scales[dir ^ v->second_field][0][refdist];
+ scaleopp = ff_vc1_field_mvpred_scales[dir ^ v->second_field][0][refdist];
n = (n * scaleopp >> 8) << hpel;
return n;
@@ -1345,7 +1354,7 @@ static inline void vc1_pred_mv(VC1Context *v, int n, int dmv_x, int dmv_y,
int px, py;
int sum;
int mixedmv_pic, num_samefield = 0, num_oppfield = 0;
- int opposit, a_f, b_f, c_f;
+ int opposite, a_f, b_f, c_f;
int16_t field_predA[2];
int16_t field_predB[2];
int16_t field_predC[2];
@@ -1453,13 +1462,19 @@ static inline void vc1_pred_mv(VC1Context *v, int n, int dmv_x, int dmv_y,
}
if (v->field_mode) {
- if (num_samefield <= num_oppfield)
- opposit = 1 - pred_flag;
- else
- opposit = pred_flag;
+ if (!v->numref)
+ // REFFIELD determines if the last field or the second-last field is
+ // to be used as reference
+ opposite = 1 - v->reffield;
+ else {
+ if (num_samefield <= num_oppfield)
+ opposite = 1 - pred_flag;
+ else
+ opposite = pred_flag;
+ }
} else
- opposit = 0;
- if (opposit) {
+ opposite = 0;
+ if (opposite) {
if (a_valid && !a_f) {
field_predA[0] = scaleforopp(v, field_predA[0], 0, dir);
field_predA[1] = scaleforopp(v, field_predA[1], 1, dir);
@@ -1562,10 +1577,6 @@ static inline void vc1_pred_mv(VC1Context *v, int n, int dmv_x, int dmv_y,
}
}
- if (v->field_mode && !s->quarter_sample) {
- r_x <<= 1;
- r_y <<= 1;
- }
if (v->field_mode && v->numref)
r_y >>= 1;
if (v->field_mode && v->cur_field_type && v->ref_field_type[dir] == 0)
@@ -1876,20 +1887,20 @@ static void vc1_interp_mc(VC1Context *v)
}
if (v->rangeredfrm || s->h_edge_pos < 22 || v_edge_pos < 22
- || (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) {
+ || (unsigned)(src_x - 1) > s->h_edge_pos - (mx & 3) - 16 - 3
+ || (unsigned)(src_y - 1) > v_edge_pos - (my & 3) - 16 - 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->vdsp.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->vdsp.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->vdsp.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 */
@@ -1973,20 +1984,6 @@ static av_always_inline int scale_mv(int value, int bfrac, int inv, int qs)
#endif
}
-static av_always_inline int scale_mv_intfi(int value, int bfrac, int inv,
- int qs, int qs_last)
-{
- int n = bfrac;
-
- if (inv)
- n -= 256;
- n <<= !qs_last;
- if (!qs)
- return (value * n + 255) >> 9;
- else
- return (value * n + 128) >> 8;
-}
-
/** 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],
@@ -2240,14 +2237,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(s->next_picture.f.motion_val[1][s->block_index[0] + v->blocks_off][0],
+ v->bfraction, 0, s->quarter_sample);
+ s->mv[0][0][1] = scale_mv(s->next_picture.f.motion_val[1][s->block_index[0] + v->blocks_off][1],
+ v->bfraction, 0, s->quarter_sample);
+ s->mv[1][0][0] = scale_mv(s->next_picture.f.motion_val[1][s->block_index[0] + v->blocks_off][0],
+ v->bfraction, 1, s->quarter_sample);
+ s->mv[1][0][1] = scale_mv(s->next_picture.f.motion_val[1][s->block_index[0] + v->blocks_off][1],
+ v->bfraction, 1, s->quarter_sample);
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]
@@ -3835,6 +3832,7 @@ static int vc1_decode_p_mb_intfr(VC1Context *v)
vc1_mc_4mv_chroma4(v);
} else {
mvbp = ff_vc1_mbmode_intfrp[v->fourmvswitch][idx_mbmode][2];
+ dmv_x = dmv_y = 0;
if (mvbp) {
get_mvdata_interlaced(v, &dmv_x, &dmv_y, 0);
}
@@ -3949,7 +3947,7 @@ static int vc1_decode_p_mb_intfi(VC1Context *v)
s->current_picture.f.mb_type[mb_pos + v->mb_off] = MB_TYPE_16x16;
for (i = 0; i < 6; i++) v->mb_type[0][s->block_index[i]] = 0;
if (idx_mbmode <= 5) { // 1-MV
- dmv_x = dmv_y = 0;
+ dmv_x = dmv_y = pred_flag = 0;
if (idx_mbmode & 1) {
get_mvdata_interlaced(v, &dmv_x, &dmv_y, &pred_flag);
}
@@ -4357,10 +4355,10 @@ static void vc1_decode_i_blocks(VC1Context *v)
s->mb_x = s->mb_y = 0;
s->mb_intra = 1;
s->first_slice_line = 1;
- for (s->mb_y = 0; s->mb_y < s->mb_height; s->mb_y++) {
+ for (s->mb_y = 0; s->mb_y < s->end_mb_y; s->mb_y++) {
s->mb_x = 0;
ff_init_block_index(s);
- for (; s->mb_x < s->mb_width; s->mb_x++) {
+ for (; s->mb_x < v->end_mb_x; s->mb_x++) {
uint8_t *dst[6];
ff_update_block_index(s);
dst[0] = s->dest[0];
@@ -4447,7 +4445,10 @@ static void vc1_decode_i_blocks(VC1Context *v)
s->first_slice_line = 0;
}
if (v->s.loop_filter)
- ff_draw_horiz_band(s, (s->mb_height - 1) * 16, 16);
+ ff_draw_horiz_band(s, (s->end_mb_y - 1) * 16, 16);
+
+ /* This is intentionally mb_height and not end_mb_y - unlike in advanced
+ * profile, these only differ are when decoding MSS2 rectangles. */
ff_er_add_slice(s, 0, 0, s->mb_width - 1, s->mb_height - 1, ER_MB_END);
}
@@ -4741,7 +4742,7 @@ static void vc1_decode_skip_blocks(VC1Context *v)
s->pict_type = AV_PICTURE_TYPE_P;
}
-static void vc1_decode_blocks(VC1Context *v)
+void ff_vc1_decode_blocks(VC1Context *v)
{
v->s.esc3_level_length = 0;
@@ -4899,7 +4900,7 @@ static void vc1_parse_sprites(VC1Context *v, GetBitContext* gb, SpriteData* sd)
av_log(avctx, AV_LOG_DEBUG, "Effect flag set\n");
if (get_bits_count(gb) >= gb->size_in_bits +
- (avctx->codec_id == CODEC_ID_WMV3IMAGE ? 64 : 0))
+ (avctx->codec_id == AV_CODEC_ID_WMV3IMAGE ? 64 : 0))
av_log(avctx, AV_LOG_ERROR, "Buffer overrun\n");
if (get_bits_count(gb) < gb->size_in_bits - 8)
av_log(avctx, AV_LOG_WARNING, "Buffer not fully read\n");
@@ -4937,15 +4938,17 @@ static void vc1_draw_sprites(VC1Context *v, SpriteData* sd)
int iline = s->current_picture.f.linesize[plane];
int ycoord = yoff[sprite] + yadv[sprite] * row;
int yline = ycoord >> 16;
+ int next_line;
ysub[sprite] = ycoord & 0xFFFF;
if (sprite) {
iplane = s->last_picture.f.data[plane];
iline = s->last_picture.f.linesize[plane];
}
+ next_line = FFMIN(yline + 1, (v->sprite_height >> !!plane) - 1) * 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) + next_line;
} else {
if (sr_cache[sprite][0] != yline) {
if (sr_cache[sprite][1] == yline) {
@@ -4957,7 +4960,9 @@ static void vc1_draw_sprites(VC1Context *v, SpriteData* sd)
}
}
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 + next_line, xoff[sprite],
+ xadv[sprite], width);
sr_cache[sprite][1] = yline + 1;
}
src_h[sprite][0] = v->sr_rows[sprite][0];
@@ -5021,7 +5026,7 @@ static int vc1_decode_sprites(VC1Context *v, GetBitContext* gb)
v->sprite_output_frame.buffer_hints = FF_BUFFER_HINTS_VALID;
v->sprite_output_frame.reference = 0;
- if (avctx->get_buffer(avctx, &v->sprite_output_frame) < 0) {
+ if (ff_get_buffer(avctx, &v->sprite_output_frame) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return -1;
}
@@ -5051,7 +5056,7 @@ static void vc1_sprite_flush(AVCodecContext *avctx)
#endif
-static av_cold int vc1_decode_init_alloc_tables(VC1Context *v)
+av_cold int ff_vc1_decode_init_alloc_tables(VC1Context *v)
{
MpegEncContext *s = &v->s;
int i;
@@ -5104,7 +5109,7 @@ static av_cold int vc1_decode_init_alloc_tables(VC1Context *v)
ff_intrax8_common_init(&v->x8,s);
- if (s->avctx->codec_id == CODEC_ID_WMV3IMAGE || s->avctx->codec_id == CODEC_ID_VC1IMAGE) {
+ if (s->avctx->codec_id == AV_CODEC_ID_WMV3IMAGE || s->avctx->codec_id == AV_CODEC_ID_VC1IMAGE) {
for (i = 0; i < 4; i++)
if (!(v->sr_rows[i >> 1][i & 1] = av_malloc(v->output_width))) return -1;
}
@@ -5117,6 +5122,21 @@ static av_cold int vc1_decode_init_alloc_tables(VC1Context *v)
return 0;
}
+av_cold void ff_vc1_init_transposed_scantables(VC1Context *v)
+{
+ int i;
+ for (i = 0; i < 64; i++) {
+#define transpose(x) ((x >> 3) | ((x & 7) << 3))
+ v->zz_8x8[0][i] = transpose(ff_wmv1_scantable[0][i]);
+ v->zz_8x8[1][i] = transpose(ff_wmv1_scantable[1][i]);
+ v->zz_8x8[2][i] = transpose(ff_wmv1_scantable[2][i]);
+ v->zz_8x8[3][i] = transpose(ff_wmv1_scantable[3][i]);
+ v->zzi_8x8[i] = transpose(ff_vc1_adv_interlaced_8x8_zz[i]);
+ }
+ v->left_blk_sh = 0;
+ v->top_blk_sh = 3;
+}
+
/** Initialize a VC1/WMV3 decoder
* @todo TODO: Handle VC-1 IDUs (Transport level?)
* @todo TODO: Decypher remaining bits in extra_data
@@ -5126,7 +5146,6 @@ static av_cold int vc1_decode_init(AVCodecContext *avctx)
VC1Context *v = avctx->priv_data;
MpegEncContext *s = &v->s;
GetBitContext gb;
- int i;
/* save the container output size for WMImage */
v->output_width = avctx->width;
@@ -5137,7 +5156,7 @@ static av_cold int vc1_decode_init(AVCodecContext *avctx)
if (!(avctx->flags & CODEC_FLAG_GRAY))
avctx->pix_fmt = avctx->get_format(avctx, avctx->codec->pix_fmts);
else
- avctx->pix_fmt = PIX_FMT_GRAY8;
+ avctx->pix_fmt = AV_PIX_FMT_GRAY8;
avctx->hwaccel = ff_find_hwaccel(avctx->codec->id, avctx->pix_fmt);
v->s.avctx = avctx;
avctx->flags |= CODEC_FLAG_EMU_EDGE;
@@ -5151,7 +5170,7 @@ static av_cold int vc1_decode_init(AVCodecContext *avctx)
return -1;
ff_vc1dsp_init(&v->vc1dsp);
- if (avctx->codec_id == CODEC_ID_WMV3 || avctx->codec_id == CODEC_ID_WMV3IMAGE) {
+ if (avctx->codec_id == AV_CODEC_ID_WMV3 || avctx->codec_id == AV_CODEC_ID_WMV3IMAGE) {
int count = 0;
// looks like WMV3 has a sequence header stored in the extradata
@@ -5161,7 +5180,7 @@ static av_cold int vc1_decode_init(AVCodecContext *avctx)
init_get_bits(&gb, avctx->extradata, avctx->extradata_size*8);
- if (vc1_decode_sequence_header(avctx, v, &gb) < 0)
+ if (ff_vc1_decode_sequence_header(avctx, v, &gb) < 0)
return -1;
count = avctx->extradata_size*8 - get_bits_count(&gb);
@@ -5196,14 +5215,14 @@ static av_cold int vc1_decode_init(AVCodecContext *avctx)
init_get_bits(&gb, buf2, buf2_size * 8);
switch (AV_RB32(start)) {
case VC1_CODE_SEQHDR:
- if (vc1_decode_sequence_header(avctx, v, &gb) < 0) {
+ if (ff_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 (ff_vc1_decode_entry_point(avctx, v, &gb) < 0) {
av_free(buf2);
return -1;
}
@@ -5229,23 +5248,14 @@ static av_cold int vc1_decode_init(AVCodecContext *avctx)
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))
- 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]);
- v->zz_8x8[3][i] = transpose(wmv1_scantable[3][i]);
- v->zzi_8x8[i] = transpose(ff_vc1_adv_interlaced_8x8_zz[i]);
- }
- v->left_blk_sh = 0;
- v->top_blk_sh = 3;
+ ff_vc1_init_transposed_scantables(v);
} else {
- memcpy(v->zz_8x8, wmv1_scantable, 4*64);
+ memcpy(v->zz_8x8, ff_wmv1_scantable, 4*64);
v->left_blk_sh = 3;
v->top_blk_sh = 0;
}
- if (avctx->codec_id == CODEC_ID_WMV3IMAGE || avctx->codec_id == CODEC_ID_VC1IMAGE) {
+ if (avctx->codec_id == AV_CODEC_ID_WMV3IMAGE || avctx->codec_id == AV_CODEC_ID_VC1IMAGE) {
v->sprite_width = avctx->coded_width;
v->sprite_height = avctx->coded_height;
@@ -5264,19 +5274,19 @@ static av_cold int vc1_decode_init(AVCodecContext *avctx)
/** Close a VC1/WMV3 decoder
* @warning Initial try at using MpegEncContext stuff
*/
-static av_cold int vc1_decode_end(AVCodecContext *avctx)
+av_cold int ff_vc1_decode_end(AVCodecContext *avctx)
{
VC1Context *v = avctx->priv_data;
int i;
- if ((avctx->codec_id == CODEC_ID_WMV3IMAGE || avctx->codec_id == CODEC_ID_VC1IMAGE)
+ if ((avctx->codec_id == AV_CODEC_ID_WMV3IMAGE || avctx->codec_id == AV_CODEC_ID_VC1IMAGE)
&& 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 & 1]);
av_freep(&v->hrd_rate);
av_freep(&v->hrd_buffer);
- MPV_common_end(&v->s);
+ ff_MPV_common_end(&v->s);
av_freep(&v->mv_type_mb_plane);
av_freep(&v->direct_mb_plane);
av_freep(&v->forward_mb_plane);
@@ -5302,7 +5312,7 @@ static av_cold int vc1_decode_end(AVCodecContext *avctx)
* @todo TODO: Handle VC-1 IDUs (Transport level?)
*/
static int vc1_decode_frame(AVCodecContext *avctx, void *data,
- int *data_size, AVPacket *avpkt)
+ int *got_frame, AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size, n_slices = 0, i;
@@ -5322,10 +5332,10 @@ static int vc1_decode_frame(AVCodecContext *avctx, void *data,
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;
+ *pict = s->next_picture_ptr->f;
s->next_picture_ptr = NULL;
- *data_size = sizeof(AVFrame);
+ *got_frame = 1;
}
return 0;
@@ -5333,13 +5343,13 @@ static int vc1_decode_frame(AVCodecContext *avctx, void *data,
if (s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU) {
if (v->profile < PROFILE_ADVANCED)
- avctx->pix_fmt = PIX_FMT_VDPAU_WMV3;
+ avctx->pix_fmt = AV_PIX_FMT_VDPAU_WMV3;
else
- avctx->pix_fmt = PIX_FMT_VDPAU_VC1;
+ avctx->pix_fmt = AV_PIX_FMT_VDPAU_VC1;
}
//for advanced profile we may need to parse and unescape data
- if (avctx->codec_id == CODEC_ID_VC1 || avctx->codec_id == CODEC_ID_VC1IMAGE) {
+ if (avctx->codec_id == AV_CODEC_ID_VC1 || avctx->codec_id == AV_CODEC_ID_VC1IMAGE) {
int buf_size2 = 0;
buf2 = av_mallocz(buf_size + FF_INPUT_BUFFER_PADDING_SIZE);
@@ -5361,9 +5371,10 @@ static int vc1_decode_frame(AVCodecContext *avctx, void *data,
break;
case VC1_CODE_FIELD: {
int buf_size3;
- slices = av_realloc(slices, sizeof(*slices) * (n_slices+1));
- if (!slices)
+ tmp = av_realloc(slices, sizeof(*slices) * (n_slices+1));
+ if (!tmp)
goto err;
+ slices = tmp;
slices[n_slices].buf = av_mallocz(buf_size + FF_INPUT_BUFFER_PADDING_SIZE);
if (!slices[n_slices].buf)
goto err;
@@ -5381,13 +5392,14 @@ static int vc1_decode_frame(AVCodecContext *avctx, void *data,
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);
- vc1_decode_entry_point(avctx, v, &s->gb);
+ ff_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)
+ tmp = av_realloc(slices, sizeof(*slices) * (n_slices+1));
+ if (!tmp)
goto err;
+ slices = tmp;
slices[n_slices].buf = av_mallocz(buf_size + FF_INPUT_BUFFER_PADDING_SIZE);
if (!slices[n_slices].buf)
goto err;
@@ -5435,11 +5447,11 @@ static int vc1_decode_frame(AVCodecContext *avctx, void *data,
if (v->res_sprite) {
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
+ /* res_sprite means a Windows Media Image stream, AV_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
the vc1 one for WVP2 */
- if (avctx->codec_id == CODEC_ID_WMV3IMAGE || avctx->codec_id == CODEC_ID_VC1IMAGE) {
+ if (avctx->codec_id == AV_CODEC_ID_WMV3IMAGE || avctx->codec_id == AV_CODEC_ID_VC1IMAGE) {
if (v->new_sprite) {
// switch AVCodecContext parameters to those of the sprites
avctx->width = avctx->coded_width = v->sprite_width;
@@ -5453,12 +5465,12 @@ static int vc1_decode_frame(AVCodecContext *avctx, void *data,
if (s->context_initialized &&
(s->width != avctx->coded_width ||
s->height != avctx->coded_height)) {
- vc1_decode_end(avctx);
+ ff_vc1_decode_end(avctx);
}
if (!s->context_initialized) {
- if (ff_msmpeg4_decode_init(avctx) < 0 || vc1_decode_init_alloc_tables(v) < 0)
- return -1;
+ if (ff_msmpeg4_decode_init(avctx) < 0 || ff_vc1_decode_init_alloc_tables(v) < 0)
+ goto err;
s->low_delay = !avctx->has_b_frames || v->res_sprite;
@@ -5480,16 +5492,16 @@ static int vc1_decode_frame(AVCodecContext *avctx, void *data,
// do parse frame header
v->pic_header_flag = 0;
if (v->profile < PROFILE_ADVANCED) {
- if (vc1_parse_frame_header(v, &s->gb) == -1) {
+ if (ff_vc1_parse_frame_header(v, &s->gb) == -1) {
goto err;
}
} else {
- if (vc1_parse_frame_header_adv(v, &s->gb) == -1) {
+ if (ff_vc1_parse_frame_header_adv(v, &s->gb) == -1) {
goto err;
}
}
- if ((avctx->codec_id == CODEC_ID_WMV3IMAGE || avctx->codec_id == CODEC_ID_VC1IMAGE)
+ if ((avctx->codec_id == AV_CODEC_ID_WMV3IMAGE || avctx->codec_id == AV_CODEC_ID_VC1IMAGE)
&& s->pict_type != AV_PICTURE_TYPE_I) {
av_log(v->s.avctx, AV_LOG_ERROR, "Sprite decoder: expected I-frame\n");
goto err;
@@ -5512,7 +5524,7 @@ static int vc1_decode_frame(AVCodecContext *avctx, void *data,
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->droppable)) {
goto err;
}
if ((avctx->skip_frame >= AVDISCARD_NONREF && s->pict_type == AV_PICTURE_TYPE_B) ||
@@ -5528,7 +5540,7 @@ static int vc1_decode_frame(AVCodecContext *avctx, void *data,
s->next_p_frame_damaged = 0;
}
- if (MPV_frame_start(s, avctx) < 0) {
+ if (ff_MPV_frame_start(s, avctx) < 0) {
goto err;
}
@@ -5549,6 +5561,7 @@ static int vc1_decode_frame(AVCodecContext *avctx, void *data,
ff_er_frame_start(s);
v->bits = buf_size * 8;
+ v->end_mb_x = s->mb_width;
if (v->field_mode) {
uint8_t *tmp[2];
s->current_picture.f.linesize[0] <<= 1;
@@ -5584,11 +5597,17 @@ static int vc1_decode_frame(AVCodecContext *avctx, void *data,
}
if (i) {
v->pic_header_flag = 0;
- if (v->field_mode && i == n_slices1 + 2)
- vc1_parse_frame_header_adv(v, &s->gb);
- else if (get_bits1(&s->gb)) {
+ if (v->field_mode && i == n_slices1 + 2) {
+ if (ff_vc1_parse_frame_header_adv(v, &s->gb) < 0) {
+ av_log(v->s.avctx, AV_LOG_ERROR, "Field header damaged\n");
+ continue;
+ }
+ } else if (get_bits1(&s->gb)) {
v->pic_header_flag = 1;
- vc1_parse_frame_header_adv(v, &s->gb);
+ if (ff_vc1_parse_frame_header_adv(v, &s->gb) < 0) {
+ av_log(v->s.avctx, AV_LOG_ERROR, "Slice header damaged\n");
+ continue;
+ }
}
}
s->start_mb_y = (i == 0) ? 0 : FFMAX(0, slices[i-1].mby_start % mb_height);
@@ -5596,7 +5615,7 @@ static int vc1_decode_frame(AVCodecContext *avctx, void *data,
s->end_mb_y = (i == n_slices ) ? mb_height : FFMIN(mb_height, slices[i].mby_start % mb_height);
else
s->end_mb_y = (i <= n_slices1 + 1) ? mb_height : FFMIN(mb_height, slices[i].mby_start % mb_height);
- vc1_decode_blocks(v);
+ ff_vc1_decode_blocks(v);
if (i != n_slices)
s->gb = slices[i].gb;
}
@@ -5612,15 +5631,16 @@ static int vc1_decode_frame(AVCodecContext *avctx, void *data,
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);
+ av_dlog(s->avctx, "Consumed %i/%i bits\n",
+ get_bits_count(&s->gb), s->gb.size_in_bits);
// if (get_bits_count(&s->gb) > buf_size * 8)
// return -1;
ff_er_frame_end(s);
}
- MPV_frame_end(s);
+ ff_MPV_frame_end(s);
- if (avctx->codec_id == CODEC_ID_WMV3IMAGE || avctx->codec_id == CODEC_ID_VC1IMAGE) {
+ if (avctx->codec_id == AV_CODEC_ID_WMV3IMAGE || avctx->codec_id == AV_CODEC_ID_VC1IMAGE) {
image:
avctx->width = avctx->coded_width = v->output_width;
avctx->height = avctx->coded_height = v->output_height;
@@ -5631,15 +5651,15 @@ image:
goto err;
#endif
*pict = v->sprite_output_frame;
- *data_size = sizeof(AVFrame);
+ *got_frame = 1;
} else {
if (s->pict_type == AV_PICTURE_TYPE_B || s->low_delay) {
- *pict = *(AVFrame*)s->current_picture_ptr;
+ *pict = s->current_picture_ptr->f;
} else if (s->last_picture_ptr != NULL) {
- *pict = *(AVFrame*)s->last_picture_ptr;
+ *pict = s->last_picture_ptr->f;
}
if (s->last_picture_ptr || s->low_delay) {
- *data_size = sizeof(AVFrame);
+ *got_frame = 1;
ff_print_debug_info(s, pict);
}
}
@@ -5671,10 +5691,10 @@ static const AVProfile profiles[] = {
AVCodec ff_vc1_decoder = {
.name = "vc1",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_VC1,
+ .id = AV_CODEC_ID_VC1,
.priv_data_size = sizeof(VC1Context),
.init = vc1_decode_init,
- .close = vc1_decode_end,
+ .close = ff_vc1_decode_end,
.decode = vc1_decode_frame,
.flush = ff_mpeg_flush,
.capabilities = CODEC_CAP_DR1 | CODEC_CAP_DELAY,
@@ -5687,10 +5707,10 @@ AVCodec ff_vc1_decoder = {
AVCodec ff_wmv3_decoder = {
.name = "wmv3",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_WMV3,
+ .id = AV_CODEC_ID_WMV3,
.priv_data_size = sizeof(VC1Context),
.init = vc1_decode_init,
- .close = vc1_decode_end,
+ .close = ff_vc1_decode_end,
.decode = vc1_decode_frame,
.flush = ff_mpeg_flush,
.capabilities = CODEC_CAP_DR1 | CODEC_CAP_DELAY,
@@ -5704,14 +5724,14 @@ AVCodec ff_wmv3_decoder = {
AVCodec ff_wmv3_vdpau_decoder = {
.name = "wmv3_vdpau",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_WMV3,
+ .id = AV_CODEC_ID_WMV3,
.priv_data_size = sizeof(VC1Context),
.init = vc1_decode_init,
- .close = vc1_decode_end,
+ .close = ff_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},
+ .pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_VDPAU_WMV3, AV_PIX_FMT_NONE },
.profiles = NULL_IF_CONFIG_SMALL(profiles)
};
#endif
@@ -5720,14 +5740,14 @@ AVCodec ff_wmv3_vdpau_decoder = {
AVCodec ff_vc1_vdpau_decoder = {
.name = "vc1_vdpau",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_VC1,
+ .id = AV_CODEC_ID_VC1,
.priv_data_size = sizeof(VC1Context),
.init = vc1_decode_init,
- .close = vc1_decode_end,
+ .close = ff_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},
+ .pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_VDPAU_VC1, AV_PIX_FMT_NONE },
.profiles = NULL_IF_CONFIG_SMALL(profiles)
};
#endif
@@ -5736,10 +5756,10 @@ AVCodec ff_vc1_vdpau_decoder = {
AVCodec ff_wmv3image_decoder = {
.name = "wmv3image",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_WMV3IMAGE,
+ .id = AV_CODEC_ID_WMV3IMAGE,
.priv_data_size = sizeof(VC1Context),
.init = vc1_decode_init,
- .close = vc1_decode_end,
+ .close = ff_vc1_decode_end,
.decode = vc1_decode_frame,
.capabilities = CODEC_CAP_DR1,
.flush = vc1_sprite_flush,
@@ -5752,10 +5772,10 @@ AVCodec ff_wmv3image_decoder = {
AVCodec ff_vc1image_decoder = {
.name = "vc1image",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_VC1IMAGE,
+ .id = AV_CODEC_ID_VC1IMAGE,
.priv_data_size = sizeof(VC1Context),
.init = vc1_decode_init,
- .close = vc1_decode_end,
+ .close = ff_vc1_decode_end,
.decode = vc1_decode_frame,
.capabilities = CODEC_CAP_DR1,
.flush = vc1_sprite_flush,
diff --git a/gst-libs/ext/libav/libavcodec/vc1dsp.c b/gst-libs/ext/libav/libavcodec/vc1dsp.c
index b40824b..81a74e3 100644
--- a/gst-libs/ext/libav/libavcodec/vc1dsp.c
+++ b/gst-libs/ext/libav/libavcodec/vc1dsp.c
@@ -26,6 +26,7 @@
*/
#include "vc1dsp.h"
+#include "libavutil/common.h"
/** Apply overlap transform to horizontal edge
@@ -561,7 +562,7 @@ static av_always_inline int vc1_mspel_filter(const uint8_t *src, int stride, int
/** Function used to do motion compensation with bicubic interpolation
*/
#define VC1_MSPEL_MC(OP, OPNAME)\
-static void OPNAME ## vc1_mspel_mc(uint8_t *dst, const uint8_t *src, int stride, int hmode, int vmode, int rnd)\
+static av_always_inline void OPNAME ## vc1_mspel_mc(uint8_t *dst, const uint8_t *src, int stride, int hmode, int vmode, int rnd)\
{\
int i, j;\
\
@@ -848,6 +849,6 @@ av_cold void ff_vc1dsp_init(VC1DSPContext* dsp) {
if (HAVE_ALTIVEC)
ff_vc1dsp_init_altivec(dsp);
- if (HAVE_MMX)
- ff_vc1dsp_init_mmx(dsp);
+ if (ARCH_X86)
+ ff_vc1dsp_init_x86(dsp);
}
diff --git a/gst-libs/ext/libav/libavcodec/vc1dsp.h b/gst-libs/ext/libav/libavcodec/vc1dsp.h
index 3e0a88e..5f364b3 100644
--- a/gst-libs/ext/libav/libavcodec/vc1dsp.h
+++ b/gst-libs/ext/libav/libavcodec/vc1dsp.h
@@ -74,6 +74,6 @@ typedef struct VC1DSPContext {
void ff_vc1dsp_init(VC1DSPContext* c);
void ff_vc1dsp_init_altivec(VC1DSPContext* c);
-void ff_vc1dsp_init_mmx(VC1DSPContext* dsp);
+void ff_vc1dsp_init_x86(VC1DSPContext* dsp);
#endif /* AVCODEC_VC1DSP_H */
diff --git a/gst-libs/ext/libav/libavcodec/vcr1.c b/gst-libs/ext/libav/libavcodec/vcr1.c
index e50e092..d0805a3 100644
--- a/gst-libs/ext/libav/libavcodec/vcr1.c
+++ b/gst-libs/ext/libav/libavcodec/vcr1.c
@@ -21,177 +21,170 @@
/**
* @file
- * ati vcr1 codec.
+ * ATI VCR1 codec
*/
#include "avcodec.h"
#include "dsputil.h"
+#include "internal.h"
+#include "libavutil/internal.h"
-//#undef NDEBUG
-//#include <assert.h>
-
-/* Disable the encoder. */
-#undef CONFIG_VCR1_ENCODER
-#define CONFIG_VCR1_ENCODER 0
-
-typedef struct VCR1Context{
- AVCodecContext *avctx;
+typedef struct VCR1Context {
AVFrame picture;
int delta[16];
int offset[4];
} VCR1Context;
-static int decode_frame(AVCodecContext *avctx,
- void *data, int *data_size,
- AVPacket *avpkt)
+static av_cold int vcr1_common_init(AVCodecContext *avctx)
+{
+ VCR1Context *const a = avctx->priv_data;
+
+ avctx->coded_frame = &a->picture;
+
+ return 0;
+}
+
+static av_cold int vcr1_decode_init(AVCodecContext *avctx)
+{
+ vcr1_common_init(avctx);
+
+ avctx->pix_fmt = AV_PIX_FMT_YUV410P;
+
+ return 0;
+}
+
+static av_cold int vcr1_decode_end(AVCodecContext *avctx)
{
- const uint8_t *buf = avpkt->data;
- int buf_size = avpkt->size;
- VCR1Context * const a = avctx->priv_data;
- AVFrame *picture = data;
- AVFrame * const p= (AVFrame*)&a->picture;
- const uint8_t *bytestream= buf;
+ VCR1Context *s = avctx->priv_data;
+
+ if (s->picture.data[0])
+ avctx->release_buffer(avctx, &s->picture);
+
+ return 0;
+}
+
+static int vcr1_decode_frame(AVCodecContext *avctx, void *data,
+ int *got_frame, AVPacket *avpkt)
+{
+ const uint8_t *buf = avpkt->data;
+ int buf_size = avpkt->size;
+ VCR1Context *const a = avctx->priv_data;
+ AVFrame *picture = data;
+ AVFrame *const p = &a->picture;
+ const uint8_t *bytestream = buf;
int i, x, y;
- if(p->data[0])
+ if (p->data[0])
avctx->release_buffer(avctx, p);
- p->reference= 0;
- if(avctx->get_buffer(avctx, p) < 0){
+ p->reference = 0;
+ if (ff_get_buffer(avctx, p) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return -1;
}
- p->pict_type= AV_PICTURE_TYPE_I;
- p->key_frame= 1;
+ p->pict_type = AV_PICTURE_TYPE_I;
+ p->key_frame = 1;
- for(i=0; i<16; i++){
- a->delta[i]= *(bytestream++);
+ for (i = 0; i < 16; i++) {
+ a->delta[i] = *bytestream++;
bytestream++;
}
- for(y=0; y<avctx->height; y++){
+ for (y = 0; y < avctx->height; y++) {
int offset;
- uint8_t *luma= &a->picture.data[0][ y*a->picture.linesize[0] ];
+ uint8_t *luma = &a->picture.data[0][y * a->picture.linesize[0]];
- if((y&3) == 0){
- uint8_t *cb= &a->picture.data[1][ (y>>2)*a->picture.linesize[1] ];
- uint8_t *cr= &a->picture.data[2][ (y>>2)*a->picture.linesize[2] ];
+ if ((y & 3) == 0) {
+ uint8_t *cb = &a->picture.data[1][(y >> 2) * a->picture.linesize[1]];
+ uint8_t *cr = &a->picture.data[2][(y >> 2) * a->picture.linesize[2]];
- for(i=0; i<4; i++)
- a->offset[i]= *(bytestream++);
+ for (i = 0; i < 4; i++)
+ a->offset[i] = *bytestream++;
- offset= a->offset[0] - a->delta[ bytestream[2]&0xF ];
- for(x=0; x<avctx->width; x+=4){
- luma[0]=( offset += a->delta[ bytestream[2]&0xF ]);
- luma[1]=( offset += a->delta[ bytestream[2]>>4 ]);
- luma[2]=( offset += a->delta[ bytestream[0]&0xF ]);
- luma[3]=( offset += a->delta[ bytestream[0]>>4 ]);
- luma += 4;
+ offset = a->offset[0] - a->delta[bytestream[2] & 0xF];
+ for (x = 0; x < avctx->width; x += 4) {
+ luma[0] = offset += a->delta[bytestream[2] & 0xF];
+ luma[1] = offset += a->delta[bytestream[2] >> 4];
+ luma[2] = offset += a->delta[bytestream[0] & 0xF];
+ luma[3] = offset += a->delta[bytestream[0] >> 4];
+ luma += 4;
- *(cb++) = bytestream[3];
- *(cr++) = bytestream[1];
+ *cb++ = bytestream[3];
+ *cr++ = bytestream[1];
- bytestream+= 4;
+ bytestream += 4;
}
- }else{
- offset= a->offset[y&3] - a->delta[ bytestream[2]&0xF ];
-
- for(x=0; x<avctx->width; x+=8){
- luma[0]=( offset += a->delta[ bytestream[2]&0xF ]);
- luma[1]=( offset += a->delta[ bytestream[2]>>4 ]);
- luma[2]=( offset += a->delta[ bytestream[3]&0xF ]);
- luma[3]=( offset += a->delta[ bytestream[3]>>4 ]);
- luma[4]=( offset += a->delta[ bytestream[0]&0xF ]);
- luma[5]=( offset += a->delta[ bytestream[0]>>4 ]);
- luma[6]=( offset += a->delta[ bytestream[1]&0xF ]);
- luma[7]=( offset += a->delta[ bytestream[1]>>4 ]);
- luma += 8;
- bytestream+= 4;
+ } else {
+ offset = a->offset[y & 3] - a->delta[bytestream[2] & 0xF];
+
+ for (x = 0; x < avctx->width; x += 8) {
+ luma[0] = offset += a->delta[bytestream[2] & 0xF];
+ luma[1] = offset += a->delta[bytestream[2] >> 4];
+ luma[2] = offset += a->delta[bytestream[3] & 0xF];
+ luma[3] = offset += a->delta[bytestream[3] >> 4];
+ luma[4] = offset += a->delta[bytestream[0] & 0xF];
+ luma[5] = offset += a->delta[bytestream[0] >> 4];
+ luma[6] = offset += a->delta[bytestream[1] & 0xF];
+ luma[7] = offset += a->delta[bytestream[1] >> 4];
+ luma += 8;
+ bytestream += 4;
}
}
}
- *picture= *(AVFrame*)&a->picture;
- *data_size = sizeof(AVPicture);
+ *picture = a->picture;
+ *got_frame = 1;
return buf_size;
}
-#if CONFIG_VCR1_ENCODER
-static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size, void *data){
- VCR1Context * const a = avctx->priv_data;
- AVFrame *pict = data;
- AVFrame * const p= (AVFrame*)&a->picture;
- int size;
-
- *p = *pict;
- p->pict_type= AV_PICTURE_TYPE_I;
- p->key_frame= 1;
-
- avpriv_align_put_bits(&a->pb);
- while(get_bit_count(&a->pb)&31)
- put_bits(&a->pb, 8, 0);
-
- size= get_bit_count(&a->pb)/32;
-
- return size*4;
-}
-#endif
-
-static av_cold void common_init(AVCodecContext *avctx){
- VCR1Context * const a = avctx->priv_data;
-
- avctx->coded_frame= (AVFrame*)&a->picture;
- a->avctx= avctx;
-}
-
-static av_cold int decode_init(AVCodecContext *avctx){
-
- common_init(avctx);
+AVCodec ff_vcr1_decoder = {
+ .name = "vcr1",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .id = AV_CODEC_ID_VCR1,
+ .priv_data_size = sizeof(VCR1Context),
+ .init = vcr1_decode_init,
+ .close = vcr1_decode_end,
+ .decode = vcr1_decode_frame,
+ .capabilities = CODEC_CAP_DR1,
+ .long_name = NULL_IF_CONFIG_SMALL("ATI VCR1"),
+};
- avctx->pix_fmt= PIX_FMT_YUV410P;
+/* Disable the encoder. */
+#undef CONFIG_VCR1_ENCODER
+#define CONFIG_VCR1_ENCODER 0
- return 0;
-}
+#if CONFIG_VCR1_ENCODER
-static av_cold int decode_end(AVCodecContext *avctx){
- VCR1Context *s = avctx->priv_data;
+#include "put_bits.h"
- if (s->picture.data[0])
- avctx->release_buffer(avctx, &s->picture);
+static int vcr1_encode_frame(AVCodecContext *avctx, unsigned char *buf,
+ int buf_size, void *data)
+{
+ VCR1Context *const a = avctx->priv_data;
+ AVFrame *pict = data;
+ AVFrame *const p = &a->picture;
+ int size;
- return 0;
-}
+ *p = *pict;
+ p->pict_type = AV_PICTURE_TYPE_I;
+ p->key_frame = 1;
-#if CONFIG_VCR1_ENCODER
-static av_cold int encode_init(AVCodecContext *avctx){
+ avpriv_align_put_bits(&a->pb);
+ flush_put_bits(&a->pb);
- common_init(avctx);
+ size = put_bits_count(&a->pb) / 32;
- return 0;
+ return size * 4;
}
-#endif
-AVCodec ff_vcr1_decoder = {
- .name = "vcr1",
- .type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_VCR1,
- .priv_data_size = sizeof(VCR1Context),
- .init = decode_init,
- .close = decode_end,
- .decode = decode_frame,
- .capabilities = CODEC_CAP_DR1,
- .long_name = NULL_IF_CONFIG_SMALL("ATI VCR1"),
-};
-
-#if CONFIG_VCR1_ENCODER
AVCodec ff_vcr1_encoder = {
.name = "vcr1",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_VCR1,
+ .id = AV_CODEC_ID_VCR1,
.priv_data_size = sizeof(VCR1Context),
- .init = encode_init,
- .encode = encode_frame,
- .long_name = NULL_IF_CONFIG_SMALL("ATI VCR1"),
+ .init = vcr1_common_init,
+ .encode = vcr1_encode_frame,
+ .long_name = NULL_IF_CONFIG_SMALL("ATI VCR1"),
};
-#endif
+#endif /* CONFIG_VCR1_ENCODER */
diff --git a/gst-libs/ext/libav/libavcodec/vda.c b/gst-libs/ext/libav/libavcodec/vda.c
deleted file mode 100644
index 34739f8..0000000
--- a/gst-libs/ext/libav/libavcodec/vda.c
+++ /dev/null
@@ -1,259 +0,0 @@
-/*
- * VDA hardware acceleration
- *
- * copyright (c) 2011 Sebastien Zwickert
- *
- * 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
- */
-
-#include <pthread.h>
-#include <CoreFoundation/CFDictionary.h>
-#include <CoreFoundation/CFNumber.h>
-#include <CoreFoundation/CFData.h>
-#include <CoreFoundation/CFString.h>
-
-#include "libavutil/avutil.h"
-#include "vda_internal.h"
-
-/* helper to create a dictionary according to the given pts */
-static CFDictionaryRef vda_dictionary_with_pts(int64_t i_pts)
-{
- CFStringRef key = CFSTR("FF_VDA_DECODER_PTS_KEY");
- CFNumberRef value = CFNumberCreate(kCFAllocatorDefault,
- kCFNumberSInt64Type, &i_pts);
- CFDictionaryRef user_info = CFDictionaryCreate(kCFAllocatorDefault,
- (const void **)&key,
- (const void **)&value,
- 1,
- &kCFTypeDictionaryKeyCallBacks,
- &kCFTypeDictionaryValueCallBacks);
- CFRelease(value);
- return user_info;
-}
-
-/* helper to retrieve the pts from the given dictionary */
-static int64_t vda_pts_from_dictionary(CFDictionaryRef user_info)
-{
- CFNumberRef pts;
- int64_t outValue = 0;
-
- if (!user_info)
- return 0;
-
- pts = CFDictionaryGetValue(user_info, CFSTR("FF_VDA_DECODER_PTS_KEY"));
-
- if (pts)
- CFNumberGetValue(pts, kCFNumberSInt64Type, &outValue);
-
- return outValue;
-}
-
-/* Remove and release all frames from the queue. */
-static void vda_clear_queue(struct vda_context *vda_ctx)
-{
- vda_frame *top_frame;
-
- pthread_mutex_lock(&vda_ctx->queue_mutex);
-
- while (vda_ctx->queue) {
- top_frame = vda_ctx->queue;
- vda_ctx->queue = top_frame->next_frame;
- ff_vda_release_vda_frame(top_frame);
- }
-
- pthread_mutex_unlock(&vda_ctx->queue_mutex);
-}
-
-/* Decoder callback that adds the VDA frame to the queue in display order. */
-static void vda_decoder_callback(void *vda_hw_ctx,
- CFDictionaryRef user_info,
- OSStatus status,
- uint32_t infoFlags,
- CVImageBufferRef image_buffer)
-{
- struct vda_context *vda_ctx = vda_hw_ctx;
- vda_frame *new_frame;
- vda_frame *queue_walker;
-
- if (!image_buffer)
- return;
-
- if (vda_ctx->cv_pix_fmt_type != CVPixelBufferGetPixelFormatType(image_buffer))
- return;
-
- if (!(new_frame = av_mallocz(sizeof(vda_frame))))
- return;
- new_frame->next_frame = NULL;
- new_frame->cv_buffer = CVPixelBufferRetain(image_buffer);
- new_frame->pts = vda_pts_from_dictionary(user_info);
-
- pthread_mutex_lock(&vda_ctx->queue_mutex);
-
- queue_walker = vda_ctx->queue;
-
- if (!queue_walker || new_frame->pts < queue_walker->pts) {
- /* we have an empty queue, or this frame earlier than the current queue head */
- new_frame->next_frame = queue_walker;
- vda_ctx->queue = new_frame;
- } else {
- /* walk the queue and insert this frame where it belongs in display order */
- vda_frame *next_frame;
- while (1) {
- next_frame = queue_walker->next_frame;
- if (!next_frame || new_frame->pts < next_frame->pts) {
- new_frame->next_frame = next_frame;
- queue_walker->next_frame = new_frame;
- break;
- }
- queue_walker = next_frame;
- }
- }
-
- pthread_mutex_unlock(&vda_ctx->queue_mutex);
-}
-
-int ff_vda_create_decoder(struct vda_context *vda_ctx,
- uint8_t *extradata,
- int extradata_size)
-{
- OSStatus status = kVDADecoderNoErr;
- CFNumberRef height;
- CFNumberRef width;
- CFNumberRef format;
- CFDataRef avc_data;
- CFMutableDictionaryRef config_info;
- CFMutableDictionaryRef buffer_attributes;
- CFMutableDictionaryRef io_surface_properties;
- CFNumberRef cv_pix_fmt;
-
- pthread_mutex_init(&vda_ctx->queue_mutex, NULL);
-
- config_info = CFDictionaryCreateMutable(kCFAllocatorDefault,
- 4,
- &kCFTypeDictionaryKeyCallBacks,
- &kCFTypeDictionaryValueCallBacks);
-
- height = CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt32Type, &vda_ctx->height);
- width = CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt32Type, &vda_ctx->width);
- format = CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt32Type, &vda_ctx->format);
- avc_data = CFDataCreate(kCFAllocatorDefault, extradata, extradata_size);
-
- CFDictionarySetValue(config_info, kVDADecoderConfiguration_Height, height);
- CFDictionarySetValue(config_info, kVDADecoderConfiguration_Width, width);
- CFDictionarySetValue(config_info, kVDADecoderConfiguration_SourceFormat, format);
- CFDictionarySetValue(config_info, kVDADecoderConfiguration_avcCData, avc_data);
-
- buffer_attributes = CFDictionaryCreateMutable(kCFAllocatorDefault,
- 2,
- &kCFTypeDictionaryKeyCallBacks,
- &kCFTypeDictionaryValueCallBacks);
- io_surface_properties = CFDictionaryCreateMutable(kCFAllocatorDefault,
- 0,
- &kCFTypeDictionaryKeyCallBacks,
- &kCFTypeDictionaryValueCallBacks);
- cv_pix_fmt = CFNumberCreate(kCFAllocatorDefault,
- kCFNumberSInt32Type,
- &vda_ctx->cv_pix_fmt_type);
- CFDictionarySetValue(buffer_attributes,
- kCVPixelBufferPixelFormatTypeKey,
- cv_pix_fmt);
- CFDictionarySetValue(buffer_attributes,
- kCVPixelBufferIOSurfacePropertiesKey,
- io_surface_properties);
-
- status = VDADecoderCreate(config_info,
- buffer_attributes,
- vda_decoder_callback,
- vda_ctx,
- &vda_ctx->decoder);
-
- CFRelease(height);
- CFRelease(width);
- CFRelease(format);
- CFRelease(avc_data);
- CFRelease(config_info);
- CFRelease(io_surface_properties);
- CFRelease(cv_pix_fmt);
- CFRelease(buffer_attributes);
-
- if (kVDADecoderNoErr != status)
- return status;
-
- return 0;
-}
-
-int ff_vda_destroy_decoder(struct vda_context *vda_ctx)
-{
- OSStatus status = kVDADecoderNoErr;
-
- if (vda_ctx->decoder)
- status = VDADecoderDestroy(vda_ctx->decoder);
-
- vda_clear_queue(vda_ctx);
-
- pthread_mutex_destroy(&vda_ctx->queue_mutex);
-
- if (kVDADecoderNoErr != status)
- return status;
-
- return 0;
-}
-
-vda_frame *ff_vda_queue_pop(struct vda_context *vda_ctx)
-{
- vda_frame *top_frame;
-
- if (!vda_ctx->queue)
- return NULL;
-
- pthread_mutex_lock(&vda_ctx->queue_mutex);
- top_frame = vda_ctx->queue;
- vda_ctx->queue = top_frame->next_frame;
- pthread_mutex_unlock(&vda_ctx->queue_mutex);
-
- return top_frame;
-}
-
-void ff_vda_release_vda_frame(vda_frame *frame)
-{
- if (frame) {
- CVPixelBufferRelease(frame->cv_buffer);
- av_freep(&frame);
- }
-}
-
-int ff_vda_decoder_decode(struct vda_context *vda_ctx,
- uint8_t *bitstream,
- int bitstream_size,
- int64_t frame_pts)
-{
- OSStatus status = kVDADecoderNoErr;
- CFDictionaryRef user_info;
- CFDataRef coded_frame;
-
- coded_frame = CFDataCreate(kCFAllocatorDefault, bitstream, bitstream_size);
- user_info = vda_dictionary_with_pts(frame_pts);
- status = VDADecoderDecode(vda_ctx->decoder, 0, coded_frame, user_info);
-
- CFRelease(user_info);
- CFRelease(coded_frame);
-
- if (kVDADecoderNoErr != status)
- return status;
-
- return 0;
-}
diff --git a/gst-libs/ext/libav/libavcodec/vda.h b/gst-libs/ext/libav/libavcodec/vda.h
index 2cb51c5..f0ec2bf 100644
--- a/gst-libs/ext/libav/libavcodec/vda.h
+++ b/gst-libs/ext/libav/libavcodec/vda.h
@@ -23,7 +23,18 @@
#ifndef AVCODEC_VDA_H
#define AVCODEC_VDA_H
+/**
+ * @file
+ * @ingroup lavc_codec_hwaccel_vda
+ * Public libavcodec VDA header.
+ */
+
+#include "libavcodec/version.h"
+
+#if FF_API_VDA_ASYNC
#include <pthread.h>
+#endif
+
#include <stdint.h>
// emmintrin.h is unable to compile with -std=c99 -Werror=missing-prototypes
@@ -35,33 +46,44 @@
#undef Picture
/**
- * This structure is used to store a decoded frame information and data.
+ * @defgroup lavc_codec_hwaccel_vda VDA
+ * @ingroup lavc_codec_hwaccel
+ *
+ * @{
+ */
+
+#if FF_API_VDA_ASYNC
+/**
+ * This structure is used to store decoded frame information and data.
+ *
+ * @deprecated Use synchronous decoding mode.
*/
typedef struct vda_frame {
/**
- * The PTS of the frame.
- *
- * - encoding: unused
- * - decoding: Set/Unset by libavcodec.
- */
+ * The PTS of the frame.
+ *
+ * - encoding: unused
+ * - decoding: Set/Unset by libavcodec.
+ */
int64_t pts;
/**
- * The CoreVideo buffer that contains the decoded data.
- *
- * - encoding: unused
- * - decoding: Set/Unset by libavcodec.
- */
+ * The CoreVideo buffer that contains the decoded data.
+ *
+ * - encoding: unused
+ * - decoding: Set/Unset by libavcodec.
+ */
CVPixelBufferRef cv_buffer;
/**
- * A pointer to the next frame.
- *
- * - encoding: unused
- * - decoding: Set/Unset by libavcodec.
- */
+ * A pointer to the next frame.
+ *
+ * - encoding: unused
+ * - decoding: Set/Unset by libavcodec.
+ */
struct vda_frame *next_frame;
} vda_frame;
+#endif
/**
* This structure is used to provide the necessary configurations and data
@@ -71,60 +93,97 @@ typedef struct vda_frame {
*/
struct vda_context {
/**
- * VDA decoder object.
- *
- * - encoding: unused
- * - decoding: Set/Unset by libavcodec.
- */
+ * VDA decoder object.
+ *
+ * - encoding: unused
+ * - decoding: Set/Unset by libavcodec.
+ */
VDADecoder decoder;
/**
- * VDA frames queue ordered by presentation timestamp.
- *
- * - encoding: unused
- * - decoding: Set/Unset by libavcodec.
- */
+ * The Core Video pixel buffer that contains the current image data.
+ *
+ * encoding: unused
+ * decoding: Set by libavcodec. Unset by user.
+ */
+ CVPixelBufferRef cv_buffer;
+
+ /**
+ * Use the hardware decoder in synchronous mode.
+ *
+ * encoding: unused
+ * decoding: Set by user.
+ */
+ int use_sync_decoding;
+
+#if FF_API_VDA_ASYNC
+ /**
+ * VDA frames queue ordered by presentation timestamp.
+ *
+ * @deprecated Use synchronous decoding mode.
+ *
+ * - encoding: unused
+ * - decoding: Set/Unset by libavcodec.
+ */
vda_frame *queue;
/**
- * Mutex for locking queue operations.
- *
- * - encoding: unused
- * - decoding: Set/Unset by libavcodec.
- */
+ * Mutex for locking queue operations.
+ *
+ * @deprecated Use synchronous decoding mode.
+ *
+ * - encoding: unused
+ * - decoding: Set/Unset by libavcodec.
+ */
pthread_mutex_t queue_mutex;
+#endif
/**
- * The frame width.
- *
- * - encoding: unused
- * - decoding: Set/Unset by user.
- */
+ * The frame width.
+ *
+ * - encoding: unused
+ * - decoding: Set/Unset by user.
+ */
int width;
/**
- * The frame height.
- *
- * - encoding: unused
- * - decoding: Set/Unset by user.
- */
+ * The frame height.
+ *
+ * - encoding: unused
+ * - decoding: Set/Unset by user.
+ */
int height;
/**
- * The frame format.
- *
- * - encoding: unused
- * - decoding: Set/Unset by user.
- */
+ * The frame format.
+ *
+ * - encoding: unused
+ * - decoding: Set/Unset by user.
+ */
int format;
/**
- * The pixel format for output image buffers.
- *
- * - encoding: unused
- * - decoding: Set/Unset by user.
- */
+ * The pixel format for output image buffers.
+ *
+ * - encoding: unused
+ * - decoding: Set/Unset by user.
+ */
OSType cv_pix_fmt_type;
+
+ /**
+ * The current bitstream buffer.
+ */
+ uint8_t *priv_bitstream;
+
+ /**
+ * The current size of the bitstream.
+ */
+ int priv_bitstream_size;
+
+ /**
+ * The reference size used for fast reallocation.
+ */
+ int priv_allocated_size;
};
/** Create the video decoder. */
@@ -135,10 +194,24 @@ int ff_vda_create_decoder(struct vda_context *vda_ctx,
/** Destroy the video decoder. */
int ff_vda_destroy_decoder(struct vda_context *vda_ctx);
-/** Return the top frame of the queue. */
+#if FF_API_VDA_ASYNC
+/**
+ * Return the top frame of the queue.
+ *
+ * @deprecated Use synchronous decoding mode.
+ */
vda_frame *ff_vda_queue_pop(struct vda_context *vda_ctx);
-/** Release the given frame. */
+/**
+ * Release the given frame.
+ *
+ * @deprecated Use synchronous decoding mode.
+ */
void ff_vda_release_vda_frame(vda_frame *frame);
+#endif
+
+/**
+ * @}
+ */
#endif /* AVCODEC_VDA_H */
diff --git a/gst-libs/ext/libav/libavcodec/vda_h264.c b/gst-libs/ext/libav/libavcodec/vda_h264.c
index b50a4c9..34fcd3c 100644
--- a/gst-libs/ext/libav/libavcodec/vda_h264.c
+++ b/gst-libs/ext/libav/libavcodec/vda_h264.c
@@ -20,30 +20,193 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <CoreFoundation/CFNumber.h>
+#include <CoreFoundation/CFData.h>
+#include <CoreFoundation/CFString.h>
+
+#include "libavutil/avutil.h"
#include "h264.h"
-#include "h264data.h"
+#include "vda.h"
-#include "vda_internal.h"
+#if FF_API_VDA_ASYNC
+#include <CoreFoundation/CFDictionary.h>
+
+/* helper to create a dictionary according to the given pts */
+static CFDictionaryRef vda_dictionary_with_pts(int64_t i_pts)
+{
+ CFStringRef key = CFSTR("FF_VDA_DECODER_PTS_KEY");
+ CFNumberRef value = CFNumberCreate(kCFAllocatorDefault,
+ kCFNumberSInt64Type, &i_pts);
+ CFDictionaryRef user_info = CFDictionaryCreate(kCFAllocatorDefault,
+ (const void **)&key,
+ (const void **)&value,
+ 1,
+ &kCFTypeDictionaryKeyCallBacks,
+ &kCFTypeDictionaryValueCallBacks);
+ CFRelease(value);
+ return user_info;
+}
+
+/* helper to retrieve the pts from the given dictionary */
+static int64_t vda_pts_from_dictionary(CFDictionaryRef user_info)
+{
+ CFNumberRef pts;
+ int64_t outValue = 0;
+
+ if (!user_info)
+ return 0;
+
+ pts = CFDictionaryGetValue(user_info, CFSTR("FF_VDA_DECODER_PTS_KEY"));
+
+ if (pts)
+ CFNumberGetValue(pts, kCFNumberSInt64Type, &outValue);
+
+ return outValue;
+}
+
+/* Remove and release all frames from the queue. */
+static void vda_clear_queue(struct vda_context *vda_ctx)
+{
+ vda_frame *top_frame;
+
+ pthread_mutex_lock(&vda_ctx->queue_mutex);
+
+ while (vda_ctx->queue) {
+ top_frame = vda_ctx->queue;
+ vda_ctx->queue = top_frame->next_frame;
+ ff_vda_release_vda_frame(top_frame);
+ }
+
+ pthread_mutex_unlock(&vda_ctx->queue_mutex);
+}
+
+static int vda_decoder_decode(struct vda_context *vda_ctx,
+ uint8_t *bitstream,
+ int bitstream_size,
+ int64_t frame_pts)
+{
+ OSStatus status = kVDADecoderNoErr;
+ CFDictionaryRef user_info;
+ CFDataRef coded_frame;
+
+ coded_frame = CFDataCreate(kCFAllocatorDefault, bitstream, bitstream_size);
+ user_info = vda_dictionary_with_pts(frame_pts);
+ status = VDADecoderDecode(vda_ctx->decoder, 0, coded_frame, user_info);
+
+ CFRelease(user_info);
+ CFRelease(coded_frame);
+
+ return status;
+}
+
+vda_frame *ff_vda_queue_pop(struct vda_context *vda_ctx)
+{
+ vda_frame *top_frame;
+
+ if (!vda_ctx->queue)
+ return NULL;
+
+ pthread_mutex_lock(&vda_ctx->queue_mutex);
+ top_frame = vda_ctx->queue;
+ vda_ctx->queue = top_frame->next_frame;
+ pthread_mutex_unlock(&vda_ctx->queue_mutex);
+
+ return top_frame;
+}
+
+void ff_vda_release_vda_frame(vda_frame *frame)
+{
+ if (frame) {
+ CVPixelBufferRelease(frame->cv_buffer);
+ av_freep(&frame);
+ }
+}
+#endif
+
+/* Decoder callback that adds the VDA frame to the queue in display order. */
+static void vda_decoder_callback(void *vda_hw_ctx,
+ CFDictionaryRef user_info,
+ OSStatus status,
+ uint32_t infoFlags,
+ CVImageBufferRef image_buffer)
+{
+ struct vda_context *vda_ctx = vda_hw_ctx;
+
+ if (!image_buffer)
+ return;
+
+ if (vda_ctx->cv_pix_fmt_type != CVPixelBufferGetPixelFormatType(image_buffer))
+ return;
+
+ if (vda_ctx->use_sync_decoding) {
+ vda_ctx->cv_buffer = CVPixelBufferRetain(image_buffer);
+ } else {
+ vda_frame *new_frame;
+ vda_frame *queue_walker;
+
+ if (!(new_frame = av_mallocz(sizeof(*new_frame))))
+ return;
+ new_frame->next_frame = NULL;
+ new_frame->cv_buffer = CVPixelBufferRetain(image_buffer);
+ new_frame->pts = vda_pts_from_dictionary(user_info);
+
+ pthread_mutex_lock(&vda_ctx->queue_mutex);
+
+ queue_walker = vda_ctx->queue;
+
+ if (!queue_walker || new_frame->pts < queue_walker->pts) {
+ /* we have an empty queue, or this frame earlier than the current queue head */
+ new_frame->next_frame = queue_walker;
+ vda_ctx->queue = new_frame;
+ } else {
+ /* walk the queue and insert this frame where it belongs in display order */
+ vda_frame *next_frame;
+ while (1) {
+ next_frame = queue_walker->next_frame;
+ if (!next_frame || new_frame->pts < next_frame->pts) {
+ new_frame->next_frame = next_frame;
+ queue_walker->next_frame = new_frame;
+ break;
+ }
+ queue_walker = next_frame;
+ }
+ }
+
+ pthread_mutex_unlock(&vda_ctx->queue_mutex);
+ }
+}
+
+static int vda_sync_decode(struct vda_context *vda_ctx)
+{
+ OSStatus status;
+ CFDataRef coded_frame;
+ uint32_t flush_flags = 1 << 0; ///< kVDADecoderFlush_emitFrames
+
+ coded_frame = CFDataCreate(kCFAllocatorDefault,
+ vda_ctx->priv_bitstream,
+ vda_ctx->priv_bitstream_size);
+
+ status = VDADecoderDecode(vda_ctx->decoder, 0, coded_frame, NULL);
+
+ if (kVDADecoderNoErr == status)
+ status = VDADecoderFlush(vda_ctx->decoder, flush_flags);
+
+ CFRelease(coded_frame);
+
+ return status;
+}
-/* This structure is used to store the bitstream of the current frame. */
-struct vda_picture_context {
- uint8_t *bitstream;
- int bitstream_size;
-};
static int start_frame(AVCodecContext *avctx,
av_unused const uint8_t *buffer,
av_unused uint32_t size)
{
- const H264Context *h = avctx->priv_data;
struct vda_context *vda_ctx = avctx->hwaccel_context;
- struct vda_picture_context *pic_ctx = h->s.current_picture_ptr->f.hwaccel_picture_private;
if (!vda_ctx->decoder)
return -1;
- pic_ctx->bitstream = NULL;
- pic_ctx->bitstream_size = 0;
+ vda_ctx->priv_bitstream_size = 0;
return 0;
}
@@ -52,24 +215,24 @@ static int decode_slice(AVCodecContext *avctx,
const uint8_t *buffer,
uint32_t size)
{
- H264Context *h = avctx->priv_data;
struct vda_context *vda_ctx = avctx->hwaccel_context;
- struct vda_picture_context *pic_ctx = h->s.current_picture_ptr->f.hwaccel_picture_private;
void *tmp;
if (!vda_ctx->decoder)
return -1;
- tmp = av_realloc(pic_ctx->bitstream, pic_ctx->bitstream_size+size+4);
+ tmp = av_fast_realloc(vda_ctx->priv_bitstream,
+ &vda_ctx->priv_allocated_size,
+ vda_ctx->priv_bitstream_size + size + 4);
if (!tmp)
return AVERROR(ENOMEM);
- pic_ctx->bitstream = tmp;
+ vda_ctx->priv_bitstream = tmp;
- AV_WB32(pic_ctx->bitstream + pic_ctx->bitstream_size, size);
- memcpy(pic_ctx->bitstream + pic_ctx->bitstream_size + 4, buffer, size);
+ AV_WB32(vda_ctx->priv_bitstream + vda_ctx->priv_bitstream_size, size);
+ memcpy(vda_ctx->priv_bitstream + vda_ctx->priv_bitstream_size + 4, buffer, size);
- pic_ctx->bitstream_size += size + 4;
+ vda_ctx->priv_bitstream_size += size + 4;
return 0;
}
@@ -78,21 +241,128 @@ static int end_frame(AVCodecContext *avctx)
{
H264Context *h = avctx->priv_data;
struct vda_context *vda_ctx = avctx->hwaccel_context;
- struct vda_picture_context *pic_ctx = h->s.current_picture_ptr->f.hwaccel_picture_private;
AVFrame *frame = &h->s.current_picture_ptr->f;
int status;
- if (!vda_ctx->decoder || !pic_ctx->bitstream)
+ if (!vda_ctx->decoder || !vda_ctx->priv_bitstream)
return -1;
- status = ff_vda_decoder_decode(vda_ctx, pic_ctx->bitstream,
- pic_ctx->bitstream_size,
- frame->reordered_opaque);
+ if (vda_ctx->use_sync_decoding) {
+ status = vda_sync_decode(vda_ctx);
+ frame->data[3] = (void*)vda_ctx->cv_buffer;
+ } else {
+ status = vda_decoder_decode(vda_ctx, vda_ctx->priv_bitstream,
+ vda_ctx->priv_bitstream_size,
+ frame->reordered_opaque);
+ }
if (status)
av_log(avctx, AV_LOG_ERROR, "Failed to decode frame (%d)\n", status);
- av_freep(&pic_ctx->bitstream);
+ return status;
+}
+
+int ff_vda_create_decoder(struct vda_context *vda_ctx,
+ uint8_t *extradata,
+ int extradata_size)
+{
+ OSStatus status = kVDADecoderNoErr;
+ CFNumberRef height;
+ CFNumberRef width;
+ CFNumberRef format;
+ CFDataRef avc_data;
+ CFMutableDictionaryRef config_info;
+ CFMutableDictionaryRef buffer_attributes;
+ CFMutableDictionaryRef io_surface_properties;
+ CFNumberRef cv_pix_fmt;
+
+#if FF_API_VDA_ASYNC
+ pthread_mutex_init(&vda_ctx->queue_mutex, NULL);
+#endif
+
+ /* Each VCL NAL in the bistream sent to the decoder
+ * is preceded by a 4 bytes length header.
+ * Change the avcC atom header if needed, to signal headers of 4 bytes. */
+ if (extradata_size >= 4 && (extradata[4] & 0x03) != 0x03) {
+ uint8_t *rw_extradata;
+
+ if (!(rw_extradata = av_malloc(extradata_size)))
+ return AVERROR(ENOMEM);
+
+ memcpy(rw_extradata, extradata, extradata_size);
+
+ rw_extradata[4] |= 0x03;
+
+ avc_data = CFDataCreate(kCFAllocatorDefault, rw_extradata, extradata_size);
+
+ av_freep(&rw_extradata);
+ } else {
+ avc_data = CFDataCreate(kCFAllocatorDefault, extradata, extradata_size);
+ }
+
+ config_info = CFDictionaryCreateMutable(kCFAllocatorDefault,
+ 4,
+ &kCFTypeDictionaryKeyCallBacks,
+ &kCFTypeDictionaryValueCallBacks);
+
+ height = CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt32Type, &vda_ctx->height);
+ width = CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt32Type, &vda_ctx->width);
+ format = CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt32Type, &vda_ctx->format);
+
+ CFDictionarySetValue(config_info, kVDADecoderConfiguration_Height, height);
+ CFDictionarySetValue(config_info, kVDADecoderConfiguration_Width, width);
+ CFDictionarySetValue(config_info, kVDADecoderConfiguration_SourceFormat, format);
+ CFDictionarySetValue(config_info, kVDADecoderConfiguration_avcCData, avc_data);
+
+ buffer_attributes = CFDictionaryCreateMutable(kCFAllocatorDefault,
+ 2,
+ &kCFTypeDictionaryKeyCallBacks,
+ &kCFTypeDictionaryValueCallBacks);
+ io_surface_properties = CFDictionaryCreateMutable(kCFAllocatorDefault,
+ 0,
+ &kCFTypeDictionaryKeyCallBacks,
+ &kCFTypeDictionaryValueCallBacks);
+ cv_pix_fmt = CFNumberCreate(kCFAllocatorDefault,
+ kCFNumberSInt32Type,
+ &vda_ctx->cv_pix_fmt_type);
+ CFDictionarySetValue(buffer_attributes,
+ kCVPixelBufferPixelFormatTypeKey,
+ cv_pix_fmt);
+ CFDictionarySetValue(buffer_attributes,
+ kCVPixelBufferIOSurfacePropertiesKey,
+ io_surface_properties);
+
+ status = VDADecoderCreate(config_info,
+ buffer_attributes,
+ vda_decoder_callback,
+ vda_ctx,
+ &vda_ctx->decoder);
+
+ CFRelease(height);
+ CFRelease(width);
+ CFRelease(format);
+ CFRelease(avc_data);
+ CFRelease(config_info);
+ CFRelease(io_surface_properties);
+ CFRelease(cv_pix_fmt);
+ CFRelease(buffer_attributes);
+
+ return status;
+}
+
+int ff_vda_destroy_decoder(struct vda_context *vda_ctx)
+{
+ OSStatus status = kVDADecoderNoErr;
+
+ if (vda_ctx->decoder)
+ status = VDADecoderDestroy(vda_ctx->decoder);
+
+#if FF_API_VDA_ASYNC
+ vda_clear_queue(vda_ctx);
+ pthread_mutex_destroy(&vda_ctx->queue_mutex);
+#endif
+
+ av_freep(&vda_ctx->priv_bitstream);
return status;
}
@@ -100,10 +370,9 @@ static int end_frame(AVCodecContext *avctx)
AVHWAccel ff_h264_vda_hwaccel = {
.name = "h264_vda",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_H264,
- .pix_fmt = PIX_FMT_VDA_VLD,
+ .id = AV_CODEC_ID_H264,
+ .pix_fmt = AV_PIX_FMT_VDA_VLD,
.start_frame = start_frame,
.decode_slice = decode_slice,
.end_frame = end_frame,
- .priv_data_size = sizeof(struct vda_picture_context),
};
diff --git a/gst-libs/ext/libav/libavcodec/vda_internal.h b/gst-libs/ext/libav/libavcodec/vda_internal.h
deleted file mode 100644
index 364ebfb..0000000
--- a/gst-libs/ext/libav/libavcodec/vda_internal.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * VDA hardware acceleration
- *
- * copyright (c) 2011 Sebastien Zwickert
- *
- * 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
- */
-
-#ifndef AVCODEC_VDA_INTERNAL_H
-#define AVCODEC_VDA_INTERNAL_H
-
-#include "vda.h"
-
-/**
- * @addtogroup VDA_Decoding
- *
- * @{
- */
-
-/** Send frame data to the hardware decoder. */
-int ff_vda_decoder_decode(struct vda_context *vda_ctx,
- uint8_t *bitstream,
- int bitstream_size,
- int64_t frame_pts);
-
-/* @} */
-
-#endif /* AVCODEC_VDA_INTERNAL_H */
diff --git a/gst-libs/ext/libav/libavcodec/vdpau.c b/gst-libs/ext/libav/libavcodec/vdpau.c
index df04ca0..6daf494 100644
--- a/gst-libs/ext/libav/libavcodec/vdpau.c
+++ b/gst-libs/ext/libav/libavcodec/vdpau.c
@@ -340,7 +340,7 @@ void ff_vdpau_mpeg4_decode_picture(MpegEncContext *s, const uint8_t *buf,
render->info.mpeg4.interlaced = !s->progressive_sequence;
render->info.mpeg4.quant_type = s->mpeg_quant;
render->info.mpeg4.quarter_sample = s->quarter_sample;
- render->info.mpeg4.short_video_header = s->avctx->codec->id == CODEC_ID_H263;
+ render->info.mpeg4.short_video_header = s->avctx->codec->id == AV_CODEC_ID_H263;
render->info.mpeg4.rounding_control = s->no_rounding;
render->info.mpeg4.alternate_vertical_scan_flag = s->alternate_scan;
render->info.mpeg4.top_field_first = s->top_field_first;
diff --git a/gst-libs/ext/libav/libavcodec/vdpau.h b/gst-libs/ext/libav/libavcodec/vdpau.h
index 6f13860..241ff19 100644
--- a/gst-libs/ext/libav/libavcodec/vdpau.h
+++ b/gst-libs/ext/libav/libavcodec/vdpau.h
@@ -25,7 +25,15 @@
#define AVCODEC_VDPAU_H
/**
- * @defgroup Decoder VDPAU Decoder and Renderer
+ * @file
+ * @ingroup lavc_codec_hwaccel_vdpau
+ * Public libavcodec VDPAU header.
+ */
+
+
+/**
+ * @defgroup lavc_codec_hwaccel_vdpau VDPAU Decoder and Renderer
+ * @ingroup lavc_codec_hwaccel
*
* VDPAU hardware acceleration has two modules
* - VDPAU decoding
@@ -38,8 +46,6 @@
* and rendering (API calls) are done as part of the VDPAU
* presentation (vo_vdpau.c) module.
*
- * @defgroup VDPAU_Decoding VDPAU Decoding
- * @ingroup Decoder
* @{
*/
diff --git a/gst-libs/ext/libav/libavcodec/version.h b/gst-libs/ext/libav/libavcodec/version.h
index 77e1682..348ce99 100644
--- a/gst-libs/ext/libav/libavcodec/version.h
+++ b/gst-libs/ext/libav/libavcodec/version.h
@@ -20,7 +20,13 @@
#ifndef AVCODEC_VERSION_H
#define AVCODEC_VERSION_H
-#define LIBAVCODEC_VERSION_MAJOR 53
+/**
+ * @file
+ * @ingroup libavc
+ * Libavcodec version macros.
+ */
+
+#define LIBAVCODEC_VERSION_MAJOR 54
#define LIBAVCODEC_VERSION_MINOR 35
#define LIBAVCODEC_VERSION_MICRO 0
@@ -35,92 +41,55 @@
#define LIBAVCODEC_IDENT "Lavc" AV_STRINGIFY(LIBAVCODEC_VERSION)
/**
- * Those FF_API_* defines are not part of public API.
- * They may change, break or disappear at any time.
+ * FF_API_* defines may be placed below to indicate public API that will be
+ * dropped at a future version bump. The defines themselves are not part of
+ * the public API and may change, break or disappear at any time.
*/
-#ifndef FF_API_PALETTE_CONTROL
-#define FF_API_PALETTE_CONTROL (LIBAVCODEC_VERSION_MAJOR < 54)
-#endif
-#ifndef FF_API_OLD_SAMPLE_FMT
-#define FF_API_OLD_SAMPLE_FMT (LIBAVCODEC_VERSION_MAJOR < 54)
-#endif
-#ifndef FF_API_OLD_AUDIOCONVERT
-#define FF_API_OLD_AUDIOCONVERT (LIBAVCODEC_VERSION_MAJOR < 54)
-#endif
-#ifndef FF_API_ANTIALIAS_ALGO
-#define FF_API_ANTIALIAS_ALGO (LIBAVCODEC_VERSION_MAJOR < 54)
-#endif
+
#ifndef FF_API_REQUEST_CHANNELS
-#define FF_API_REQUEST_CHANNELS (LIBAVCODEC_VERSION_MAJOR < 54)
-#endif
-#ifndef FF_API_OPT_H
-#define FF_API_OPT_H (LIBAVCODEC_VERSION_MAJOR < 54)
-#endif
-#ifndef FF_API_THREAD_INIT
-#define FF_API_THREAD_INIT (LIBAVCODEC_VERSION_MAJOR < 54)
-#endif
-#ifndef FF_API_OLD_FF_PICT_TYPES
-#define FF_API_OLD_FF_PICT_TYPES (LIBAVCODEC_VERSION_MAJOR < 54)
+#define FF_API_REQUEST_CHANNELS (LIBAVCODEC_VERSION_MAJOR < 55)
#endif
-#ifndef FF_API_FLAC_GLOBAL_OPTS
-#define FF_API_FLAC_GLOBAL_OPTS (LIBAVCODEC_VERSION_MAJOR < 54)
-#endif
-#ifndef FF_API_GET_PIX_FMT_NAME
-#define FF_API_GET_PIX_FMT_NAME (LIBAVCODEC_VERSION_MAJOR < 54)
-#endif
-#ifndef FF_API_ALLOC_CONTEXT
-#define FF_API_ALLOC_CONTEXT (LIBAVCODEC_VERSION_MAJOR < 54)
-#endif
-#ifndef FF_API_AVCODEC_OPEN
-#define FF_API_AVCODEC_OPEN (LIBAVCODEC_VERSION_MAJOR < 54)
-#endif
-#ifndef FF_API_DRC_SCALE
-#define FF_API_DRC_SCALE (LIBAVCODEC_VERSION_MAJOR < 54)
-#endif
-#ifndef FF_API_ER
-#define FF_API_ER (LIBAVCODEC_VERSION_MAJOR < 54)
+#ifndef FF_API_OLD_DECODE_AUDIO
+#define FF_API_OLD_DECODE_AUDIO (LIBAVCODEC_VERSION_MAJOR < 55)
#endif
-#ifndef FF_API_AVCODEC_INIT
-#define FF_API_AVCODEC_INIT (LIBAVCODEC_VERSION_MAJOR < 54)
+#ifndef FF_API_OLD_ENCODE_AUDIO
+#define FF_API_OLD_ENCODE_AUDIO (LIBAVCODEC_VERSION_MAJOR < 55)
#endif
-#ifndef FF_API_X264_GLOBAL_OPTS
-#define FF_API_X264_GLOBAL_OPTS (LIBAVCODEC_VERSION_MAJOR < 54)
+#ifndef FF_API_OLD_ENCODE_VIDEO
+#define FF_API_OLD_ENCODE_VIDEO (LIBAVCODEC_VERSION_MAJOR < 55)
#endif
-#ifndef FF_API_MPEGVIDEO_GLOBAL_OPTS
-#define FF_API_MPEGVIDEO_GLOBAL_OPTS (LIBAVCODEC_VERSION_MAJOR < 54)
+#ifndef FF_API_MPV_GLOBAL_OPTS
+#define FF_API_MPV_GLOBAL_OPTS (LIBAVCODEC_VERSION_MAJOR < 55)
#endif
-#ifndef FF_API_LAME_GLOBAL_OPTS
-#define FF_API_LAME_GLOBAL_OPTS (LIBAVCODEC_VERSION_MAJOR < 54)
+#ifndef FF_API_COLOR_TABLE_ID
+#define FF_API_COLOR_TABLE_ID (LIBAVCODEC_VERSION_MAJOR < 55)
#endif
-#ifndef FF_API_SNOW_GLOBAL_OPTS
-#define FF_API_SNOW_GLOBAL_OPTS (LIBAVCODEC_VERSION_MAJOR < 54)
+#ifndef FF_API_INTER_THRESHOLD
+#define FF_API_INTER_THRESHOLD (LIBAVCODEC_VERSION_MAJOR < 55)
#endif
-#ifndef FF_API_MJPEG_GLOBAL_OPTS
-#define FF_API_MJPEG_GLOBAL_OPTS (LIBAVCODEC_VERSION_MAJOR < 54)
+#ifndef FF_API_SUB_ID
+#define FF_API_SUB_ID (LIBAVCODEC_VERSION_MAJOR < 55)
#endif
-#ifndef FF_API_GET_ALPHA_INFO
-#define FF_API_GET_ALPHA_INFO (LIBAVCODEC_VERSION_MAJOR < 54)
+#ifndef FF_API_DSP_MASK
+#define FF_API_DSP_MASK (LIBAVCODEC_VERSION_MAJOR < 55)
#endif
-#ifndef FF_API_PARSE_FRAME
-#define FF_API_PARSE_FRAME (LIBAVCODEC_VERSION_MAJOR < 54)
+#ifndef FF_API_FIND_BEST_PIX_FMT
+#define FF_API_FIND_BEST_PIX_FMT (LIBAVCODEC_VERSION_MAJOR < 55)
#endif
-#ifndef FF_API_INTERNAL_CONTEXT
-#define FF_API_INTERNAL_CONTEXT (LIBAVCODEC_VERSION_MAJOR < 54)
+#ifndef FF_API_CODEC_ID
+#define FF_API_CODEC_ID (LIBAVCODEC_VERSION_MAJOR < 55)
#endif
-#ifndef FF_API_TIFFENC_COMPLEVEL
-#define FF_API_TIFFENC_COMPLEVEL (LIBAVCODEC_VERSION_MAJOR < 54)
+#ifndef FF_API_VDA_ASYNC
+#define FF_API_VDA_ASYNC (LIBAVCODEC_VERSION_MAJOR < 55)
#endif
-#ifndef FF_API_DATA_POINTERS
-#define FF_API_DATA_POINTERS (LIBAVCODEC_VERSION_MAJOR < 54)
+#ifndef FF_API_AVCODEC_RESAMPLE
+#define FF_API_AVCODEC_RESAMPLE (LIBAVCODEC_VERSION_MAJOR < 55)
#endif
-#ifndef FF_API_OLD_DECODE_AUDIO
-#define FF_API_OLD_DECODE_AUDIO (LIBAVCODEC_VERSION_MAJOR < 54)
+#ifndef FF_API_LIBMPEG2
+#define FF_API_LIBMPEG2 (LIBAVCODEC_VERSION_MAJOR < 55)
#endif
-#ifndef FF_API_AVFRAME_AGE
-#define FF_API_AVFRAME_AGE (LIBAVCODEC_VERSION_MAJOR < 54)
-#endif
-#ifndef FF_API_OLD_ENCODE_AUDIO
-#define FF_API_OLD_ENCODE_AUDIO (LIBAVCODEC_VERSION_MAJOR < 54)
+#ifndef FF_API_MMI
+#define FF_API_MMI (LIBAVCODEC_VERSION_MAJOR < 55)
#endif
#endif /* AVCODEC_VERSION_H */
diff --git a/gst-libs/ext/libav/libavcodec/videodsp.c b/gst-libs/ext/libav/libavcodec/videodsp.c
new file mode 100644
index 0000000..d14b0a1
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/videodsp.c
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2012 Ronald S. Bultje
+ *
+ * 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
+ */
+
+#include "libavutil/common.h"
+#include "videodsp.h"
+
+#define BIT_DEPTH 8
+#include "videodsp_template.c"
+#undef BIT_DEPTH
+
+#define BIT_DEPTH 16
+#include "videodsp_template.c"
+#undef BIT_DEPTH
+
+static void just_return(uint8_t *buf, ptrdiff_t stride, int h)
+{
+}
+
+void ff_videodsp_init(VideoDSPContext *ctx, int bpc)
+{
+ ctx->prefetch = just_return;
+ if (bpc <= 8) {
+ ctx->emulated_edge_mc = ff_emulated_edge_mc_8;
+ } else {
+ ctx->emulated_edge_mc = ff_emulated_edge_mc_16;
+ }
+
+ if (ARCH_ARM)
+ ff_videodsp_init_arm(ctx, bpc);
+ if (ARCH_PPC)
+ ff_videodsp_init_ppc(ctx, bpc);
+ if (ARCH_X86)
+ ff_videodsp_init_x86(ctx, bpc);
+}
diff --git a/gst-libs/ext/libav/libavcodec/videodsp.h b/gst-libs/ext/libav/libavcodec/videodsp.h
new file mode 100644
index 0000000..7d78593
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/videodsp.h
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2012 Ronald S. Bultje
+ *
+ * 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
+ * Core video DSP helper functions
+ */
+
+#ifndef AVCODEC_VIDEODSP_H
+#define AVCODEC_VIDEODSP_H
+
+#include <stddef.h>
+#include <stdint.h>
+
+typedef struct VideoDSPContext {
+ /**
+ * Copy a rectangular area of samples to a temporary buffer and replicate
+ * the border samples.
+ *
+ * @param buf destination buffer
+ * @param src source buffer
+ * @param linesize number of bytes between 2 vertically adjacent samples
+ * in both the source and destination buffers
+ * @param block_w width of block
+ * @param block_h height of block
+ * @param src_x x coordinate of the top left sample of the block in the
+ * source buffer
+ * @param src_y y coordinate of the top left sample of the block in the
+ * source buffer
+ * @param w width of the source buffer
+ * @param h height of the source buffer
+ */
+ void (*emulated_edge_mc)(uint8_t *buf, const uint8_t *src,
+ ptrdiff_t linesize, int block_w, int block_h,
+ int src_x, int src_y, int w, int h);
+
+ /**
+ * Prefetch memory into cache (if supported by hardware).
+ *
+ * @buf pointer to buffer to prefetch memory from
+ * @stride distance between two lines of buf (in bytes)
+ * @h number of lines to prefetch
+ */
+ void (*prefetch)(uint8_t *buf, ptrdiff_t stride, int h);
+} VideoDSPContext;
+
+void ff_videodsp_init(VideoDSPContext *ctx, int bpc);
+
+/* for internal use only (i.e. called by ff_videodsp_init() */
+void ff_videodsp_init_arm(VideoDSPContext *ctx, int bpc);
+void ff_videodsp_init_ppc(VideoDSPContext *ctx, int bpc);
+void ff_videodsp_init_x86(VideoDSPContext *ctx, int bpc);
+
+#endif /* AVCODEC_VIDEODSP_H */
diff --git a/gst-libs/ext/libav/libavcodec/videodsp_template.c b/gst-libs/ext/libav/libavcodec/videodsp_template.c
new file mode 100644
index 0000000..5d5a32f
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/videodsp_template.c
@@ -0,0 +1,93 @@
+/*
+ * Copyright (c) 2002-2004 Michael Niedermayer
+ * Copyright (C) 2012 Ronald S. Bultje
+ *
+ * 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
+ */
+
+#include "bit_depth_template.c"
+
+static void FUNC(ff_emulated_edge_mc)(uint8_t *buf, const uint8_t *src,
+ ptrdiff_t linesize,
+ int block_w, int block_h,
+ int src_x, int src_y, int w, int h)
+{
+ int x, y;
+ int start_y, start_x, end_y, end_x;
+
+ if (src_y >= h) {
+ src += (h - 1 - src_y) * linesize;
+ src_y = h - 1;
+ } else if (src_y <= -block_h) {
+ src += (1 - block_h - src_y) * linesize;
+ src_y = 1 - block_h;
+ }
+ if (src_x >= w) {
+ src += (w - 1 - src_x) * sizeof(pixel);
+ src_x = w - 1;
+ } else if (src_x <= -block_w) {
+ src += (1 - block_w - src_x) * sizeof(pixel);
+ src_x = 1 - block_w;
+ }
+
+ start_y = FFMAX(0, -src_y);
+ start_x = FFMAX(0, -src_x);
+ end_y = FFMIN(block_h, h-src_y);
+ end_x = FFMIN(block_w, w-src_x);
+ assert(start_y < end_y && block_h);
+ assert(start_x < end_x && block_w);
+
+ w = end_x - start_x;
+ src += start_y * linesize + start_x * sizeof(pixel);
+ buf += start_x * sizeof(pixel);
+
+ // top
+ for (y = 0; y < start_y; y++) {
+ memcpy(buf, src, w * sizeof(pixel));
+ buf += linesize;
+ }
+
+ // copy existing part
+ for (; y < end_y; y++) {
+ memcpy(buf, src, w * sizeof(pixel));
+ src += linesize;
+ buf += linesize;
+ }
+
+ // bottom
+ src -= linesize;
+ for (; y < block_h; y++) {
+ memcpy(buf, src, w * sizeof(pixel));
+ buf += linesize;
+ }
+
+ buf -= block_h * linesize + start_x * sizeof(pixel);
+ while (block_h--) {
+ pixel *bufp = (pixel *) buf;
+
+ // left
+ for(x = 0; x < start_x; x++) {
+ bufp[x] = bufp[start_x];
+ }
+
+ // right
+ for (x = end_x; x < block_w; x++) {
+ bufp[x] = bufp[end_x - 1];
+ }
+ buf += linesize;
+ }
+}
diff --git a/gst-libs/ext/libav/libavcodec/vmdav.c b/gst-libs/ext/libav/libavcodec/vmdav.c
index 4659971..d4ac6f7 100644
--- a/gst-libs/ext/libav/libavcodec/vmdav.c
+++ b/gst-libs/ext/libav/libavcodec/vmdav.c
@@ -43,8 +43,11 @@
#include <stdlib.h>
#include <string.h>
+#include "libavutil/channel_layout.h"
+#include "libavutil/common.h"
#include "libavutil/intreadwrite.h"
#include "avcodec.h"
+#include "internal.h"
#include "bytestream.h"
#define VMD_HEADER_SIZE 0x330
@@ -189,7 +192,7 @@ static int rle_unpack(const unsigned char *src, unsigned char *dest,
return bytestream2_tell(&gb);
}
-static void vmd_decode(VmdVideoContext *s)
+static int vmd_decode(VmdVideoContext *s)
{
int i;
unsigned int *palette32;
@@ -213,13 +216,21 @@ static void vmd_decode(VmdVideoContext *s)
if (frame_x < 0 || frame_width < 0 ||
frame_x >= s->avctx->width ||
frame_width > s->avctx->width ||
- frame_x + frame_width > s->avctx->width)
- return;
+ frame_x + frame_width > s->avctx->width) {
+ av_log(s->avctx, AV_LOG_ERROR,
+ "Invalid horizontal range %d-%d\n",
+ frame_x, frame_width);
+ return AVERROR_INVALIDDATA;
+ }
if (frame_y < 0 || frame_height < 0 ||
frame_y >= s->avctx->height ||
frame_height > s->avctx->height ||
- frame_y + frame_height > s->avctx->height)
- return;
+ frame_y + frame_height > s->avctx->height) {
+ av_log(s->avctx, AV_LOG_ERROR,
+ "Invalid vertical range %d-%d\n",
+ frame_x, frame_width);
+ return AVERROR_INVALIDDATA;
+ }
if ((frame_width == s->avctx->width && frame_height == s->avctx->height) &&
(frame_x || frame_y)) {
@@ -252,94 +263,103 @@ static void vmd_decode(VmdVideoContext *s)
b = bytestream2_get_byteu(&gb) * 4;
palette32[i] = (r << 16) | (g << 8) | (b);
}
+ } else {
+ av_log(s->avctx, AV_LOG_ERROR, "Incomplete palette\n");
+ return AVERROR_INVALIDDATA;
}
- s->size -= (256 * 3 + 2);
+ s->size -= PALETTE_COUNT * 3 + 2;
}
- if (s->size > 0) {
- /* originally UnpackFrame in VAG's code */
- bytestream2_init(&gb, gb.buffer, s->buf + s->size - gb.buffer);
- if (bytestream2_get_bytes_left(&gb) < 1)
- return;
- meth = bytestream2_get_byteu(&gb);
- if (meth & 0x80) {
- lz_unpack(gb.buffer, bytestream2_get_bytes_left(&gb),
- s->unpack_buffer, s->unpack_buffer_size);
- meth &= 0x7F;
- bytestream2_init(&gb, s->unpack_buffer, s->unpack_buffer_size);
- }
- dp = &s->frame.data[0][frame_y * s->frame.linesize[0] + frame_x];
- pp = &s->prev_frame.data[0][frame_y * s->prev_frame.linesize[0] + frame_x];
- switch (meth) {
- case 1:
- for (i = 0; i < frame_height; i++) {
- ofs = 0;
- do {
- len = bytestream2_get_byte(&gb);
- if (len & 0x80) {
- len = (len & 0x7F) + 1;
- if (ofs + len > frame_width || bytestream2_get_bytes_left(&gb) < len)
- return;
- bytestream2_get_buffer(&gb, &dp[ofs], len);
- ofs += len;
- } else {
- /* interframe pixel copy */
- if (ofs + len + 1 > frame_width || !s->prev_frame.data[0])
- return;
- memcpy(&dp[ofs], &pp[ofs], len + 1);
- ofs += len + 1;
- }
- } while (ofs < frame_width);
- if (ofs > frame_width) {
- av_log(s->avctx, AV_LOG_ERROR, "VMD video: offset > width (%d > %d)\n",
- ofs, frame_width);
- break;
- }
- dp += s->frame.linesize[0];
- pp += s->prev_frame.linesize[0];
- }
- break;
+ if (!s->size)
+ return 0;
+
+ /* originally UnpackFrame in VAG's code */
+ if (bytestream2_get_bytes_left(&gb) < 1)
+ return AVERROR_INVALIDDATA;
+ meth = bytestream2_get_byteu(&gb);
+ if (meth & 0x80) {
+ lz_unpack(gb.buffer, bytestream2_get_bytes_left(&gb),
+ s->unpack_buffer, s->unpack_buffer_size);
+ meth &= 0x7F;
+ bytestream2_init(&gb, s->unpack_buffer, s->unpack_buffer_size);
+ }
- case 2:
- for (i = 0; i < frame_height; i++) {
- bytestream2_get_buffer(&gb, dp, frame_width);
- dp += s->frame.linesize[0];
- pp += s->prev_frame.linesize[0];
+ dp = &s->frame.data[0][frame_y * s->frame.linesize[0] + frame_x];
+ pp = &s->prev_frame.data[0][frame_y * s->prev_frame.linesize[0] + frame_x];
+ switch (meth) {
+ case 1:
+ for (i = 0; i < frame_height; i++) {
+ ofs = 0;
+ do {
+ len = bytestream2_get_byte(&gb);
+ if (len & 0x80) {
+ len = (len & 0x7F) + 1;
+ if (ofs + len > frame_width ||
+ bytestream2_get_bytes_left(&gb) < len)
+ return AVERROR_INVALIDDATA;
+ bytestream2_get_buffer(&gb, &dp[ofs], len);
+ ofs += len;
+ } else {
+ /* interframe pixel copy */
+ if (ofs + len + 1 > frame_width || !s->prev_frame.data[0])
+ return AVERROR_INVALIDDATA;
+ memcpy(&dp[ofs], &pp[ofs], len + 1);
+ ofs += len + 1;
+ }
+ } while (ofs < frame_width);
+ if (ofs > frame_width) {
+ av_log(s->avctx, AV_LOG_ERROR,
+ "VMD video: offset > width (%d > %d)\n",
+ ofs, frame_width);
+ return AVERROR_INVALIDDATA;
}
- break;
+ dp += s->frame.linesize[0];
+ pp += s->prev_frame.linesize[0];
+ }
+ break;
- case 3:
- for (i = 0; i < frame_height; i++) {
- ofs = 0;
- do {
- len = bytestream2_get_byte(&gb);
- if (len & 0x80) {
- len = (len & 0x7F) + 1;
- if (bytestream2_get_byte(&gb) == 0xFF)
- len = rle_unpack(gb.buffer, &dp[ofs],
- len, bytestream2_get_bytes_left(&gb),
- frame_width - ofs);
- else
- bytestream2_get_buffer(&gb, &dp[ofs], len);
- bytestream2_skip(&gb, len);
- } else {
- /* interframe pixel copy */
- if (ofs + len + 1 > frame_width || !s->prev_frame.data[0])
- return;
- memcpy(&dp[ofs], &pp[ofs], len + 1);
- ofs += len + 1;
- }
- } while (ofs < frame_width);
- if (ofs > frame_width) {
- av_log(s->avctx, AV_LOG_ERROR, "VMD video: offset > width (%d > %d)\n",
- ofs, frame_width);
+ case 2:
+ for (i = 0; i < frame_height; i++) {
+ bytestream2_get_buffer(&gb, dp, frame_width);
+ dp += s->frame.linesize[0];
+ pp += s->prev_frame.linesize[0];
+ }
+ break;
+
+ case 3:
+ for (i = 0; i < frame_height; i++) {
+ ofs = 0;
+ do {
+ len = bytestream2_get_byte(&gb);
+ if (len & 0x80) {
+ len = (len & 0x7F) + 1;
+ if (bytestream2_get_byte(&gb) == 0xFF)
+ len = rle_unpack(gb.buffer, &dp[ofs],
+ len, bytestream2_get_bytes_left(&gb),
+ frame_width - ofs);
+ else
+ bytestream2_get_buffer(&gb, &dp[ofs], len);
+ bytestream2_skip(&gb, len);
+ } else {
+ /* interframe pixel copy */
+ if (ofs + len + 1 > frame_width || !s->prev_frame.data[0])
+ return AVERROR_INVALIDDATA;
+ memcpy(&dp[ofs], &pp[ofs], len + 1);
+ ofs += len + 1;
}
- dp += s->frame.linesize[0];
- pp += s->prev_frame.linesize[0];
+ } while (ofs < frame_width);
+ if (ofs > frame_width) {
+ av_log(s->avctx, AV_LOG_ERROR,
+ "VMD video: offset > width (%d > %d)\n",
+ ofs, frame_width);
+ return AVERROR_INVALIDDATA;
}
- break;
+ dp += s->frame.linesize[0];
+ pp += s->prev_frame.linesize[0];
}
+ break;
}
+ return 0;
}
static av_cold int vmdvideo_decode_init(AVCodecContext *avctx)
@@ -353,7 +373,7 @@ static av_cold int vmdvideo_decode_init(AVCodecContext *avctx)
unsigned char *raw_palette;
s->avctx = avctx;
- avctx->pix_fmt = PIX_FMT_PAL8;
+ avctx->pix_fmt = AV_PIX_FMT_PAL8;
/* make sure the VMD header made it */
if (s->avctx->extradata_size != VMD_HEADER_SIZE) {
@@ -382,7 +402,7 @@ static av_cold int vmdvideo_decode_init(AVCodecContext *avctx)
}
static int vmdvideo_decode_frame(AVCodecContext *avctx,
- void *data, int *data_size,
+ void *data, int *got_frame,
AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
@@ -393,10 +413,10 @@ static int vmdvideo_decode_frame(AVCodecContext *avctx,
s->size = buf_size;
if (buf_size < 16)
- return buf_size;
+ return AVERROR_INVALIDDATA;
s->frame.reference = 1;
- if (avctx->get_buffer(avctx, &s->frame)) {
+ if (ff_get_buffer(avctx, &s->frame)) {
av_log(s->avctx, AV_LOG_ERROR, "VMD Video: get_buffer() failed\n");
return -1;
}
@@ -411,7 +431,7 @@ static int vmdvideo_decode_frame(AVCodecContext *avctx,
if (s->frame.data[0])
avctx->release_buffer(avctx, &s->frame);
- *data_size = sizeof(AVFrame);
+ *got_frame = 1;
*(AVFrame*)data = s->prev_frame;
/* report that the buffer was completely consumed */
@@ -473,6 +493,9 @@ static av_cold int vmdaudio_decode_init(AVCodecContext *avctx)
return AVERROR(EINVAL);
}
+ avctx->channel_layout = avctx->channels == 1 ? AV_CH_LAYOUT_MONO :
+ AV_CH_LAYOUT_STEREO;
+
if (avctx->bits_per_coded_sample == 16)
avctx->sample_fmt = AV_SAMPLE_FMT_S16;
else
@@ -567,9 +590,12 @@ static int vmdaudio_decode_frame(AVCodecContext *avctx, void *data,
/* ensure output buffer is large enough */
audio_chunks = buf_size / s->chunk_size;
+ /* drop incomplete chunks */
+ buf_size = audio_chunks * s->chunk_size;
+
/* get output buffer */
s->frame.nb_samples = ((silent_chunks + audio_chunks) * avctx->block_align) / avctx->channels;
- if ((ret = avctx->get_buffer(avctx, &s->frame)) < 0) {
+ if ((ret = ff_get_buffer(avctx, &s->frame)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return ret;
}
@@ -578,7 +604,8 @@ static int vmdaudio_decode_frame(AVCodecContext *avctx, void *data,
/* decode silent chunks */
if (silent_chunks > 0) {
- int silent_size = avctx->block_align * silent_chunks;
+ int silent_size = FFMIN(avctx->block_align * silent_chunks,
+ s->frame.nb_samples * avctx->channels);
if (s->out_bps == 2) {
memset(output_samples_s16, 0x00, silent_size * 2);
output_samples_s16 += silent_size;
@@ -590,7 +617,7 @@ static int vmdaudio_decode_frame(AVCodecContext *avctx, void *data,
/* decode audio chunks */
if (audio_chunks > 0) {
- buf_end = buf + buf_size;
+ buf_end = buf + (buf_size & ~(avctx->channels > 1));
while (buf + s->chunk_size <= buf_end) {
if (s->out_bps == 2) {
decode_audio_s16(output_samples_s16, buf, s->chunk_size,
@@ -618,22 +645,22 @@ static int vmdaudio_decode_frame(AVCodecContext *avctx, void *data,
AVCodec ff_vmdvideo_decoder = {
.name = "vmdvideo",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_VMDVIDEO,
+ .id = AV_CODEC_ID_VMDVIDEO,
.priv_data_size = sizeof(VmdVideoContext),
.init = vmdvideo_decode_init,
.close = vmdvideo_decode_end,
.decode = vmdvideo_decode_frame,
.capabilities = CODEC_CAP_DR1,
- .long_name = NULL_IF_CONFIG_SMALL("Sierra VMD video"),
+ .long_name = NULL_IF_CONFIG_SMALL("Sierra VMD video"),
};
AVCodec ff_vmdaudio_decoder = {
.name = "vmdaudio",
.type = AVMEDIA_TYPE_AUDIO,
- .id = CODEC_ID_VMDAUDIO,
+ .id = AV_CODEC_ID_VMDAUDIO,
.priv_data_size = sizeof(VmdAudioContext),
.init = vmdaudio_decode_init,
.decode = vmdaudio_decode_frame,
.capabilities = CODEC_CAP_DR1,
- .long_name = NULL_IF_CONFIG_SMALL("Sierra VMD audio"),
+ .long_name = NULL_IF_CONFIG_SMALL("Sierra VMD audio"),
};
diff --git a/gst-libs/ext/libav/libavcodec/vmnc.c b/gst-libs/ext/libav/libavcodec/vmnc.c
index ca0ba82..4071cdf 100644
--- a/gst-libs/ext/libav/libavcodec/vmnc.c
+++ b/gst-libs/ext/libav/libavcodec/vmnc.c
@@ -28,6 +28,7 @@
#include <stdio.h>
#include <stdlib.h>
+#include "libavutil/common.h"
#include "libavutil/intreadwrite.h"
#include "avcodec.h"
@@ -284,7 +285,8 @@ static int decode_hextile(VmncContext *c, uint8_t* dst, const uint8_t* src, int
return src - ssrc;
}
-static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt)
+static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
+ AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
@@ -445,7 +447,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
put_cursor(outptr, c->pic.linesize[0], c, c->cur_x, c->cur_y);
}
}
- *data_size = sizeof(AVFrame);
+ *got_frame = 1;
*(AVFrame*)data = c->pic;
/* always report that the buffer was completely consumed */
@@ -473,13 +475,13 @@ static av_cold int decode_init(AVCodecContext *avctx)
switch(c->bpp){
case 8:
- avctx->pix_fmt = PIX_FMT_PAL8;
+ avctx->pix_fmt = AV_PIX_FMT_PAL8;
break;
case 16:
- avctx->pix_fmt = PIX_FMT_RGB555;
+ avctx->pix_fmt = AV_PIX_FMT_RGB555;
break;
case 32:
- avctx->pix_fmt = PIX_FMT_RGB32;
+ avctx->pix_fmt = AV_PIX_FMT_RGB32;
break;
default:
av_log(avctx, AV_LOG_ERROR, "Unsupported bitdepth %i\n", c->bpp);
@@ -512,12 +514,11 @@ static av_cold int decode_end(AVCodecContext *avctx)
AVCodec ff_vmnc_decoder = {
.name = "vmnc",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_VMNC,
+ .id = AV_CODEC_ID_VMNC,
.priv_data_size = sizeof(VmncContext),
.init = decode_init,
.close = decode_end,
.decode = decode_frame,
.capabilities = CODEC_CAP_DR1,
- .long_name = NULL_IF_CONFIG_SMALL("VMware Screen Codec / VMware Video"),
+ .long_name = NULL_IF_CONFIG_SMALL("VMware Screen Codec / VMware Video"),
};
-
diff --git a/gst-libs/ext/libav/libavcodec/vorbis.c b/gst-libs/ext/libav/libavcodec/vorbis.c
index 16fb998..78a2467 100644
--- a/gst-libs/ext/libav/libavcodec/vorbis.c
+++ b/gst-libs/ext/libav/libavcodec/vorbis.c
@@ -62,10 +62,8 @@ int ff_vorbis_len2vlc(uint8_t *bits, uint32_t *codes, unsigned num)
for (p = 0; (bits[p] == 0) && (p < num); ++p)
;
- if (p == num) {
-// av_log(vc->avccontext, AV_LOG_INFO, "An empty codebook. Heh?! \n");
+ if (p == num)
return 0;
- }
codes[p] = 0;
if (bits[p] > 32)
diff --git a/gst-libs/ext/libav/libavcodec/vorbis.h b/gst-libs/ext/libav/libavcodec/vorbis.h
index baa5af2..6b72f6a 100644
--- a/gst-libs/ext/libav/libavcodec/vorbis.h
+++ b/gst-libs/ext/libav/libavcodec/vorbis.h
@@ -29,7 +29,7 @@ extern const uint8_t ff_vorbis_channel_layout_offsets[8][8];
extern const uint8_t ff_vorbis_encoding_channel_layout_offsets[8][8];
extern const uint64_t ff_vorbis_channel_layouts[9];
-typedef struct {
+typedef struct vorbis_floor1_entry {
uint16_t x;
uint16_t sort;
uint16_t low;
@@ -43,7 +43,7 @@ int ff_vorbis_len2vlc(uint8_t *bits, uint32_t *codes, unsigned num);
void ff_vorbis_floor1_render_list(vorbis_floor1_entry * list, int values,
uint16_t *y_list, int *flag,
int multiplier, float * out, int samples);
-void vorbis_inverse_coupling(float *mag, float *ang, int blocksize);
+void ff_vorbis_inverse_coupling(float *mag, float *ang, int blocksize);
#define ilog(i) av_log2(2*(i))
diff --git a/gst-libs/ext/libav/libavcodec/vorbis_data.c b/gst-libs/ext/libav/libavcodec/vorbis_data.c
index bd27b82..03c3d6b 100644
--- a/gst-libs/ext/libav/libavcodec/vorbis_data.c
+++ b/gst-libs/ext/libav/libavcodec/vorbis_data.c
@@ -18,9 +18,10 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "libavutil/channel_layout.h"
+#include "libavutil/mem.h"
#include "dsputil.h"
#include "vorbis.h"
-#include "libavutil/audioconvert.h"
const uint8_t ff_vorbis_channel_layout_offsets[8][8] = {
{ 0 },
diff --git a/gst-libs/ext/libav/libavcodec/vorbis_parser.c b/gst-libs/ext/libav/libavcodec/vorbis_parser.c
new file mode 100644
index 0000000..c6d300d
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/vorbis_parser.c
@@ -0,0 +1,270 @@
+/*
+ * Copyright (c) 2012 Justin Ruggles
+ *
+ * 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
+ * Vorbis audio parser
+ *
+ * Determines the duration for each packet.
+ */
+
+#include "get_bits.h"
+#include "parser.h"
+#include "xiph.h"
+#include "vorbis_parser.h"
+
+static int parse_id_header(AVCodecContext *avctx, VorbisParseContext *s,
+ const uint8_t *buf, int buf_size)
+{
+ /* Id header should be 30 bytes */
+ if (buf_size < 30) {
+ av_log(avctx, AV_LOG_ERROR, "Id header is too short\n");
+ return AVERROR_INVALIDDATA;
+ }
+
+ /* make sure this is the Id header */
+ if (buf[0] != 1) {
+ av_log(avctx, AV_LOG_ERROR, "Wrong packet type in Id header\n");
+ return AVERROR_INVALIDDATA;
+ }
+
+ /* check for header signature */
+ if (memcmp(&buf[1], "vorbis", 6)) {
+ av_log(avctx, AV_LOG_ERROR, "Invalid packet signature in Id header\n");
+ return AVERROR_INVALIDDATA;
+ }
+
+ if (!(buf[29] & 0x1)) {
+ av_log(avctx, AV_LOG_ERROR, "Invalid framing bit in Id header\n");
+ return AVERROR_INVALIDDATA;
+ }
+
+ s->blocksize[0] = 1 << (buf[28] & 0xF);
+ s->blocksize[1] = 1 << (buf[28] >> 4);
+
+ return 0;
+}
+
+static int parse_setup_header(AVCodecContext *avctx, VorbisParseContext *s,
+ const uint8_t *buf, int buf_size)
+{
+ GetBitContext gb, gb0;
+ uint8_t *rev_buf;
+ int i, ret = 0;
+ int got_framing_bit, mode_count, got_mode_header, last_mode_count = 0;
+
+ /* avoid overread */
+ if (buf_size < 7) {
+ av_log(avctx, AV_LOG_ERROR, "Setup header is too short\n");
+ return AVERROR_INVALIDDATA;
+ }
+
+ /* make sure this is the Setup header */
+ if (buf[0] != 5) {
+ av_log(avctx, AV_LOG_ERROR, "Wrong packet type in Setup header\n");
+ return AVERROR_INVALIDDATA;
+ }
+
+ /* check for header signature */
+ if (memcmp(&buf[1], "vorbis", 6)) {
+ av_log(avctx, AV_LOG_ERROR, "Invalid packet signature in Setup header\n");
+ return AVERROR_INVALIDDATA;
+ }
+
+ /* reverse bytes so we can easily read backwards with get_bits() */
+ if (!(rev_buf = av_malloc(buf_size))) {
+ av_log(avctx, AV_LOG_ERROR, "Out of memory\n");
+ return AVERROR(ENOMEM);
+ }
+ for (i = 0; i < buf_size; i++)
+ rev_buf[i] = buf[buf_size - 1 - i];
+ init_get_bits(&gb, rev_buf, buf_size * 8);
+
+ got_framing_bit = 0;
+ while (get_bits_left(&gb) > 97) {
+ if (get_bits1(&gb)) {
+ got_framing_bit = get_bits_count(&gb);
+ break;
+ }
+ }
+ if (!got_framing_bit) {
+ av_log(avctx, AV_LOG_ERROR, "Invalid Setup header\n");
+ ret = AVERROR_INVALIDDATA;
+ goto bad_header;
+ }
+
+ /* Now we search backwards to find possible valid mode counts. This is not
+ * fool-proof because we could have false positive matches and read too
+ * far, but there isn't really any way to be sure without parsing through
+ * all the many variable-sized fields before the modes. This approach seems
+ * to work well in testing, and it is similar to how it is handled in
+ * liboggz. */
+ mode_count = 0;
+ got_mode_header = 0;
+ while (get_bits_left(&gb) >= 97) {
+ if (get_bits(&gb, 8) > 63 || get_bits(&gb, 16) || get_bits(&gb, 16))
+ break;
+ skip_bits(&gb, 1);
+ mode_count++;
+ if (mode_count > 64)
+ break;
+ gb0 = gb;
+ if (get_bits(&gb0, 6) + 1 == mode_count) {
+ got_mode_header = 1;
+ last_mode_count = mode_count;
+ }
+ }
+ if (!got_mode_header) {
+ av_log(avctx, AV_LOG_ERROR, "Invalid Setup header\n");
+ ret = AVERROR_INVALIDDATA;
+ goto bad_header;
+ }
+ /* All samples I've seen use <= 2 modes, so ask for a sample if we find
+ * more than that, as it is most likely a false positive. If we get any
+ * we may need to approach this the long way and parse the whole Setup
+ * header, but I hope very much that it never comes to that. */
+ if (last_mode_count > 2) {
+ av_log_ask_for_sample(avctx, "%d modes found. This is either a false "
+ "positive or a sample from an unknown encoder.\n",
+ last_mode_count);
+ }
+ /* We're limiting the mode count to 63 so that we know that the previous
+ * block flag will be in the first packet byte. */
+ if (last_mode_count > 63) {
+ av_log(avctx, AV_LOG_ERROR, "Unsupported mode count: %d\n",
+ last_mode_count);
+ ret = AVERROR_INVALIDDATA;
+ goto bad_header;
+ }
+ s->mode_count = mode_count = last_mode_count;
+ /* Determine the number of bits required to code the mode and turn that
+ * into a bitmask to directly access the mode from the first frame byte. */
+ s->mode_mask = ((1 << (av_log2(mode_count - 1) + 1)) - 1) << 1;
+ /* The previous window flag is the next bit after the mode */
+ s->prev_mask = (s->mode_mask | 0x1) + 1;
+
+ init_get_bits(&gb, rev_buf, buf_size * 8);
+ skip_bits_long(&gb, got_framing_bit);
+ for (i = mode_count - 1; i >= 0; i--) {
+ skip_bits_long(&gb, 40);
+ s->mode_blocksize[i] = s->blocksize[get_bits1(&gb)];
+ }
+
+bad_header:
+ av_free(rev_buf);
+ return ret;
+}
+
+int avpriv_vorbis_parse_extradata(AVCodecContext *avctx, VorbisParseContext *s)
+{
+ uint8_t *header_start[3];
+ int header_len[3];
+ int ret;
+
+ s->avctx = avctx;
+ s->extradata_parsed = 1;
+
+ if ((ret = avpriv_split_xiph_headers(avctx->extradata,
+ avctx->extradata_size, 30,
+ header_start, header_len)) < 0) {
+ av_log(avctx, AV_LOG_ERROR, "Extradata corrupt.\n");
+ return ret;
+ }
+
+ if ((ret = parse_id_header(avctx, s, header_start[0], header_len[0])) < 0)
+ return ret;
+
+ if ((ret = parse_setup_header(avctx, s, header_start[2], header_len[2])) < 0)
+ return ret;
+
+ s->valid_extradata = 1;
+ s->previous_blocksize = s->mode_blocksize[0];
+
+ return 0;
+}
+
+int avpriv_vorbis_parse_frame(VorbisParseContext *s, const uint8_t *buf,
+ int buf_size)
+{
+ int duration = 0;
+
+ if (s->valid_extradata && buf_size > 0) {
+ int mode, current_blocksize;
+ int previous_blocksize = s->previous_blocksize;
+
+ if (buf[0] & 1) {
+ av_log(s->avctx, AV_LOG_ERROR, "Invalid packet\n");
+ return AVERROR_INVALIDDATA;
+ }
+ if (s->mode_count == 1)
+ mode = 0;
+ else
+ mode = (buf[0] & s->mode_mask) >> 1;
+ if (mode >= s->mode_count) {
+ av_log(s->avctx, AV_LOG_ERROR, "Invalid mode in packet\n");
+ return AVERROR_INVALIDDATA;
+ }
+ if (mode) {
+ int flag = !!(buf[0] & s->prev_mask);
+ previous_blocksize = s->blocksize[flag];
+ }
+ current_blocksize = s->mode_blocksize[mode];
+ duration = (previous_blocksize + current_blocksize) >> 2;
+ s->previous_blocksize = current_blocksize;
+ }
+
+ return duration;
+}
+
+void avpriv_vorbis_parse_reset(VorbisParseContext *s)
+{
+ if (s->valid_extradata)
+ s->previous_blocksize = s->mode_blocksize[0];
+}
+
+#if CONFIG_VORBIS_PARSER
+static int vorbis_parse(AVCodecParserContext *s1, AVCodecContext *avctx,
+ const uint8_t **poutbuf, int *poutbuf_size,
+ const uint8_t *buf, int buf_size)
+{
+ VorbisParseContext *s = s1->priv_data;
+ int duration;
+
+ if (!s->extradata_parsed && avctx->extradata && avctx->extradata_size)
+ if (avpriv_vorbis_parse_extradata(avctx, s))
+ goto end;
+
+ if ((duration = avpriv_vorbis_parse_frame(s, buf, buf_size)) >= 0)
+ s1->duration = duration;
+
+end:
+ /* always return the full packet. this parser isn't doing any splitting or
+ combining, only packet analysis */
+ *poutbuf = buf;
+ *poutbuf_size = buf_size;
+ return buf_size;
+}
+
+AVCodecParser ff_vorbis_parser = {
+ .codec_ids = { AV_CODEC_ID_VORBIS },
+ .priv_data_size = sizeof(VorbisParseContext),
+ .parser_parse = vorbis_parse,
+};
+#endif /* CONFIG_VORBIS_PARSER */
diff --git a/gst-libs/ext/libav/libavcodec/vorbis_parser.h b/gst-libs/ext/libav/libavcodec/vorbis_parser.h
new file mode 100644
index 0000000..480a918
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/vorbis_parser.h
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2012 Justin Ruggles
+ *
+ * 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
+ * Vorbis audio parser
+ *
+ * Determines the duration for each packet.
+ */
+
+#ifndef AVCODEC_VORBIS_PARSER_H
+#define AVCODEC_VORBIS_PARSER_H
+
+#include "avcodec.h"
+
+typedef struct VorbisParseContext {
+ AVCodecContext *avctx; ///< codec context
+ int extradata_parsed; ///< we have attempted to parse extradata
+ int valid_extradata; ///< extradata is valid, so we can calculate duration
+ int blocksize[2]; ///< short and long window sizes
+ int previous_blocksize; ///< previous window size
+ int mode_blocksize[64]; ///< window size mapping for each mode
+ int mode_count; ///< number of modes
+ int mode_mask; ///< bitmask used to get the mode in each packet
+ int prev_mask; ///< bitmask used to get the previous mode flag in each packet
+} VorbisParseContext;
+
+/**
+ * Initialize the Vorbis parser using headers in the extradata.
+ *
+ * @param avctx codec context
+ * @param s Vorbis parser context
+ */
+int avpriv_vorbis_parse_extradata(AVCodecContext *avctx, VorbisParseContext *s);
+
+/**
+ * Get the duration for a Vorbis packet.
+ *
+ * avpriv_vorbis_parse_extradata() must have been successfully called prior to
+ * this in order for a correct duration to be returned.
+ *
+ * @param s Vorbis parser context
+ * @param buf buffer containing a Vorbis frame
+ * @param buf_size size of the buffer
+ */
+int avpriv_vorbis_parse_frame(VorbisParseContext *s, const uint8_t *buf,
+ int buf_size);
+
+void avpriv_vorbis_parse_reset(VorbisParseContext *s);
+
+#endif /* AVCODEC_VORBIS_PARSER_H */
diff --git a/gst-libs/ext/libav/libavcodec/vorbisdec.c b/gst-libs/ext/libav/libavcodec/vorbisdec.c
index 5a0a4a4..884cd5b 100644
--- a/gst-libs/ext/libav/libavcodec/vorbisdec.c
+++ b/gst-libs/ext/libav/libavcodec/vorbisdec.c
@@ -26,11 +26,13 @@
#include <math.h>
#define BITSTREAM_READER_LE
+#include "libavutil/float_dsp.h"
#include "avcodec.h"
#include "get_bits.h"
#include "dsputil.h"
#include "fft.h"
#include "fmtconvert.h"
+#include "internal.h"
#include "vorbis.h"
#include "xiph.h"
@@ -124,6 +126,7 @@ typedef struct vorbis_context_s {
AVFrame frame;
GetBitContext gb;
DSPContext dsp;
+ AVFloatDSPContext fdsp;
FmtConvertContext fmt_conv;
FFTContext mdct[2];
@@ -149,9 +152,7 @@ typedef struct vorbis_context_s {
uint8_t mode_number; // mode number for the current packet
uint8_t previous_window;
float *channel_residues;
- float *channel_floors;
float *saved;
- float scale_bias; // for float->int conversion
} vorbis_context;
/* Helper functions */
@@ -190,7 +191,6 @@ static void vorbis_free(vorbis_context *vc)
int i;
av_freep(&vc->channel_residues);
- av_freep(&vc->channel_floors);
av_freep(&vc->saved);
for (i = 0; i < vc->residue_count; i++)
@@ -585,7 +585,17 @@ static int vorbis_parse_setup_hdr_floors(vorbis_context *vc)
floor_setup->decode = vorbis_floor0_decode;
floor_setup->data.t0.order = get_bits(gb, 8);
+ if (!floor_setup->data.t0.order) {
+ av_log(vc->avccontext, AV_LOG_ERROR,
+ "Floor 0 order is 0.\n");
+ return AVERROR_INVALIDDATA;
+ }
floor_setup->data.t0.rate = get_bits(gb, 16);
+ if (!floor_setup->data.t0.rate) {
+ av_log(vc->avccontext, AV_LOG_ERROR,
+ "Floor 0 rate is 0.\n");
+ return AVERROR_INVALIDDATA;
+ }
floor_setup->data.t0.bark_map_size = get_bits(gb, 16);
if (floor_setup->data.t0.bark_map_size == 0) {
av_log(vc->avccontext, AV_LOG_ERROR,
@@ -593,13 +603,6 @@ static int vorbis_parse_setup_hdr_floors(vorbis_context *vc)
return AVERROR_INVALIDDATA;
}
floor_setup->data.t0.amplitude_bits = get_bits(gb, 6);
- /* zero would result in a div by zero later *
- * 2^0 - 1 == 0 */
- if (floor_setup->data.t0.amplitude_bits == 0) {
- av_log(vc->avccontext, AV_LOG_ERROR,
- "Floor 0 amplitude bits is 0.\n");
- return AVERROR_INVALIDDATA;
- }
floor_setup->data.t0.amplitude_offset = get_bits(gb, 8);
floor_setup->data.t0.num_books = get_bits(gb, 4) + 1;
@@ -954,12 +957,11 @@ static int vorbis_parse_id_hdr(vorbis_context *vc)
}
vc->channel_residues = av_malloc((vc->blocksize[1] / 2) * vc->audio_channels * sizeof(*vc->channel_residues));
- vc->channel_floors = av_malloc((vc->blocksize[1] / 2) * vc->audio_channels * sizeof(*vc->channel_floors));
vc->saved = av_mallocz((vc->blocksize[1] / 4) * vc->audio_channels * sizeof(*vc->saved));
vc->previous_window = 0;
- ff_mdct_init(&vc->mdct[0], bl0, 1, -vc->scale_bias);
- ff_mdct_init(&vc->mdct[1], bl1, 1, -vc->scale_bias);
+ ff_mdct_init(&vc->mdct[0], bl0, 1, -1.0);
+ ff_mdct_init(&vc->mdct[1], bl1, 1, -1.0);
av_dlog(NULL, " vorbis version %d \n audio_channels %d \n audio_samplerate %d \n bitrate_max %d \n bitrate_nom %d \n bitrate_min %d \n blk_0 %d blk_1 %d \n ",
vc->version, vc->audio_channels, vc->audio_samplerate, vc->bitrate_maximum, vc->bitrate_nominal, vc->bitrate_minimum, vc->blocksize[0], vc->blocksize[1]);
@@ -987,16 +989,11 @@ static av_cold int vorbis_decode_init(AVCodecContext *avccontext)
int hdr_type, ret;
vc->avccontext = avccontext;
- dsputil_init(&vc->dsp, avccontext);
+ ff_dsputil_init(&vc->dsp, avccontext);
+ avpriv_float_dsp_init(&vc->fdsp, avccontext->flags & CODEC_FLAG_BITEXACT);
ff_fmt_convert_init(&vc->fmt_conv, avccontext);
- if (avccontext->request_sample_fmt == AV_SAMPLE_FMT_FLT) {
- avccontext->sample_fmt = AV_SAMPLE_FMT_FLT;
- vc->scale_bias = 1.0f;
- } else {
- avccontext->sample_fmt = AV_SAMPLE_FMT_S16;
- vc->scale_bias = 32768.0f;
- }
+ avccontext->sample_fmt = AV_SAMPLE_FMT_FLTP;
if (!headers_len) {
av_log(avccontext, AV_LOG_ERROR, "Extradata missing.\n");
@@ -1040,7 +1037,6 @@ static av_cold int vorbis_decode_init(AVCodecContext *avccontext)
avccontext->channels = vc->audio_channels;
avccontext->sample_rate = vc->audio_samplerate;
- avccontext->frame_size = FFMIN(vc->blocksize[0], vc->blocksize[1]) >> 2;
avcodec_get_frame_defaults(&vc->frame);
avccontext->coded_frame = &vc->frame;
@@ -1060,6 +1056,9 @@ static int vorbis_floor0_decode(vorbis_context *vc,
unsigned amplitude, book_idx;
unsigned blockflag = vc->modes[vc->mode_number].blockflag;
+ if (!vf->amplitude_bits)
+ return 1;
+
amplitude = get_bits(&vc->gb, vf->amplitude_bits);
if (amplitude > 0) {
float last = 0;
@@ -1245,7 +1244,7 @@ static int vorbis_floor1_decode(vorbis_context *vc,
if (highroom < lowroom) {
room = highroom * 2;
} else {
- room = lowroom * 2; // SPEC mispelling
+ room = lowroom * 2; // SPEC misspelling
}
if (val) {
floor1_flag[low_neigh_offs] = 1;
@@ -1357,8 +1356,7 @@ static av_always_inline int vorbis_residue_decode_internal(vorbis_context *vc,
if (vqbook >= 0 && vc->codebooks[vqbook].codevectors) {
unsigned coffs;
unsigned dim = vc->codebooks[vqbook].dimensions;
- unsigned step = dim == 1 ? vr->partition_size
- : FASTDIV(vr->partition_size, dim);
+ unsigned step = FASTDIV(vr->partition_size << 1, dim << 1);
vorbis_codebook codebook = vc->codebooks[vqbook];
if (vr_type == 0) {
@@ -1367,14 +1365,14 @@ static av_always_inline int vorbis_residue_decode_internal(vorbis_context *vc,
for (k = 0; k < step; ++k) {
coffs = get_vlc2(gb, codebook.vlc.table, codebook.nb_bits, 3) * dim;
for (l = 0; l < dim; ++l)
- vec[voffs + k + l * step] += codebook.codevectors[coffs + l]; // FPMATH
+ vec[voffs + k + l * step] += codebook.codevectors[coffs + l];
}
} else if (vr_type == 1) {
voffs = voffset + j * vlen;
for (k = 0; k < step; ++k) {
coffs = get_vlc2(gb, codebook.vlc.table, codebook.nb_bits, 3) * dim;
for (l = 0; l < dim; ++l, ++voffs) {
- vec[voffs]+=codebook.codevectors[coffs+l]; // FPMATH
+ vec[voffs]+=codebook.codevectors[coffs+l];
av_dlog(NULL, " pass %d offs: %d curr: %f change: %f cv offs.: %d \n",
pass, voffs, vec[voffs], codebook.codevectors[coffs+l], coffs);
@@ -1386,23 +1384,23 @@ static av_always_inline int vorbis_residue_decode_internal(vorbis_context *vc,
if (dim == 2) {
for (k = 0; k < step; ++k) {
coffs = get_vlc2(gb, codebook.vlc.table, codebook.nb_bits, 3) * 2;
- vec[voffs + k ] += codebook.codevectors[coffs ]; // FPMATH
- vec[voffs + k + vlen] += codebook.codevectors[coffs + 1]; // FPMATH
+ vec[voffs + k ] += codebook.codevectors[coffs ];
+ vec[voffs + k + vlen] += codebook.codevectors[coffs + 1];
}
} else if (dim == 4) {
for (k = 0; k < step; ++k, voffs += 2) {
coffs = get_vlc2(gb, codebook.vlc.table, codebook.nb_bits, 3) * 4;
- vec[voffs ] += codebook.codevectors[coffs ]; // FPMATH
- vec[voffs + 1 ] += codebook.codevectors[coffs + 2]; // FPMATH
- vec[voffs + vlen ] += codebook.codevectors[coffs + 1]; // FPMATH
- vec[voffs + vlen + 1] += codebook.codevectors[coffs + 3]; // FPMATH
+ vec[voffs ] += codebook.codevectors[coffs ];
+ vec[voffs + 1 ] += codebook.codevectors[coffs + 2];
+ vec[voffs + vlen ] += codebook.codevectors[coffs + 1];
+ vec[voffs + vlen + 1] += codebook.codevectors[coffs + 3];
}
} else
for (k = 0; k < step; ++k) {
coffs = get_vlc2(gb, codebook.vlc.table, codebook.nb_bits, 3) * dim;
for (l = 0; l < dim; l += 2, voffs++) {
- vec[voffs ] += codebook.codevectors[coffs + l ]; // FPMATH
- vec[voffs + vlen] += codebook.codevectors[coffs + l + 1]; // FPMATH
+ vec[voffs ] += codebook.codevectors[coffs + l ];
+ vec[voffs + vlen] += codebook.codevectors[coffs + l + 1];
av_dlog(NULL, " pass %d offs: %d curr: %f change: %f cv offs.: %d+%d \n",
pass, voffset / ch + (voffs % ch) * vlen,
@@ -1412,17 +1410,24 @@ static av_always_inline int vorbis_residue_decode_internal(vorbis_context *vc,
}
} else if (vr_type == 2) {
- voffs = voffset;
+ unsigned voffs_div = FASTDIV(voffset << 1, ch <<1);
+ unsigned voffs_mod = voffset - voffs_div * ch;
for (k = 0; k < step; ++k) {
coffs = get_vlc2(gb, codebook.vlc.table, codebook.nb_bits, 3) * dim;
- for (l = 0; l < dim; ++l, ++voffs) {
- vec[voffs / ch + (voffs % ch) * vlen] += codebook.codevectors[coffs + l]; // FPMATH FIXME use if and counter instead of / and %
+ for (l = 0; l < dim; ++l) {
+ vec[voffs_div + voffs_mod * vlen] +=
+ codebook.codevectors[coffs + l];
av_dlog(NULL, " pass %d offs: %d curr: %f change: %f cv offs.: %d+%d \n",
- pass, voffset / ch + (voffs % ch) * vlen,
- vec[voffset / ch + (voffs % ch) * vlen],
+ pass, voffs_div + voffs_mod * vlen,
+ vec[voffs_div + voffs_mod * vlen],
codebook.codevectors[coffs + l], coffs, l);
+
+ if (++voffs_mod == ch) {
+ voffs_div++;
+ voffs_mod = 0;
+ }
}
}
}
@@ -1456,7 +1461,7 @@ static inline int vorbis_residue_decode(vorbis_context *vc, vorbis_residue *vr,
}
}
-void vorbis_inverse_coupling(float *mag, float *ang, int blocksize)
+void ff_vorbis_inverse_coupling(float *mag, float *ang, int blocksize)
{
int i;
for (i = 0; i < blocksize; i++) {
@@ -1482,7 +1487,7 @@ void vorbis_inverse_coupling(float *mag, float *ang, int blocksize)
// Decode the audio packet using the functions above
-static int vorbis_parse_audio_packet(vorbis_context *vc)
+static int vorbis_parse_audio_packet(vorbis_context *vc, float **floor_ptr)
{
GetBitContext *gb = &vc->gb;
FFTContext *mdct;
@@ -1493,7 +1498,6 @@ static int vorbis_parse_audio_packet(vorbis_context *vc)
uint8_t do_not_decode[255];
vorbis_mapping *mapping;
float *ch_res_ptr = vc->channel_residues;
- float *ch_floor_ptr = vc->channel_floors;
uint8_t res_chan[255];
unsigned res_num = 0;
int retlen = 0;
@@ -1519,11 +1523,14 @@ static int vorbis_parse_audio_packet(vorbis_context *vc)
blockflag = vc->modes[mode_number].blockflag;
blocksize = vc->blocksize[blockflag];
vlen = blocksize / 2;
- if (blockflag)
- skip_bits(gb, 2); // previous_window, next_window
+ if (blockflag) {
+ previous_window = get_bits(gb, 1);
+ skip_bits1(gb); // next_window
+ }
memset(ch_res_ptr, 0, sizeof(float) * vc->audio_channels * vlen); //FIXME can this be removed ?
- memset(ch_floor_ptr, 0, sizeof(float) * vc->audio_channels * vlen); //FIXME can this be removed ?
+ for (i = 0; i < vc->audio_channels; ++i)
+ memset(floor_ptr[i], 0, vlen * sizeof(floor_ptr[0][0])); //FIXME can this be removed ?
// Decode floor
@@ -1536,14 +1543,13 @@ static int vorbis_parse_audio_packet(vorbis_context *vc)
floor = &vc->floors[mapping->submap_floor[0]];
}
- ret = floor->decode(vc, &floor->data, ch_floor_ptr);
+ ret = floor->decode(vc, &floor->data, floor_ptr[i]);
if (ret < 0) {
av_log(vc->avccontext, AV_LOG_ERROR, "Invalid codebook in vorbis_floor_decode.\n");
return AVERROR_INVALIDDATA;
}
no_residue[i] = ret;
- ch_floor_ptr += vlen;
}
// Nonzero vector propagate
@@ -1589,6 +1595,9 @@ static int vorbis_parse_audio_packet(vorbis_context *vc)
ch_left -= ch;
}
+ if (ch_left > 0)
+ return AVERROR_INVALIDDATA;
+
// Inverse coupling
for (i = mapping->coupling_steps - 1; i >= 0; --i) { //warning: i has to be signed
@@ -1604,13 +1613,12 @@ static int vorbis_parse_audio_packet(vorbis_context *vc)
mdct = &vc->mdct[blockflag];
for (j = vc->audio_channels-1;j >= 0; j--) {
- ch_floor_ptr = vc->channel_floors + j * blocksize / 2;
ch_res_ptr = vc->channel_residues + res_chan[j] * blocksize / 2;
- vc->dsp.vector_fmul(ch_floor_ptr, ch_floor_ptr, ch_res_ptr, blocksize / 2);
- mdct->imdct_half(mdct, ch_res_ptr, ch_floor_ptr);
+ vc->fdsp.vector_fmul(floor_ptr[j], floor_ptr[j], ch_res_ptr, blocksize / 2);
+ mdct->imdct_half(mdct, ch_res_ptr, floor_ptr[j]);
}
-// Overlap/add, save data for next overlapping FPMATH
+// Overlap/add, save data for next overlapping
retlen = (blocksize + vc->blocksize[previous_window]) / 4;
for (j = 0; j < vc->audio_channels; j++) {
@@ -1618,7 +1626,7 @@ static int vorbis_parse_audio_packet(vorbis_context *vc)
unsigned bs1 = vc->blocksize[1];
float *residue = vc->channel_residues + res_chan[j] * blocksize / 2;
float *saved = vc->saved + j * bs1 / 4;
- float *ret = vc->channel_floors + j * retlen;
+ float *ret = floor_ptr[j];
float *buf = residue;
const float *win = vc->win[blockflag & previous_window];
@@ -1647,14 +1655,31 @@ static int vorbis_decode_frame(AVCodecContext *avccontext, void *data,
int buf_size = avpkt->size;
vorbis_context *vc = avccontext->priv_data;
GetBitContext *gb = &vc->gb;
- const float *channel_ptrs[255];
+ float *channel_ptrs[255];
int i, len, ret;
av_dlog(NULL, "packet length %d \n", buf_size);
+ /* get output buffer */
+ vc->frame.nb_samples = vc->blocksize[1] / 2;
+ if ((ret = ff_get_buffer(avccontext, &vc->frame)) < 0) {
+ av_log(avccontext, AV_LOG_ERROR, "get_buffer() failed\n");
+ return ret;
+ }
+
+ if (vc->audio_channels > 8) {
+ for (i = 0; i < vc->audio_channels; i++)
+ channel_ptrs[i] = (float *)vc->frame.extended_data[i];
+ } else {
+ for (i = 0; i < vc->audio_channels; i++) {
+ int ch = ff_vorbis_channel_layout_offsets[vc->audio_channels - 1][i];
+ channel_ptrs[ch] = (float *)vc->frame.extended_data[i];
+ }
+ }
+
init_get_bits(gb, buf, buf_size*8);
- if ((len = vorbis_parse_audio_packet(vc)) <= 0)
+ if ((len = vorbis_parse_audio_packet(vc, channel_ptrs)) <= 0)
return len;
if (!vc->first_frame) {
@@ -1666,30 +1691,7 @@ static int vorbis_decode_frame(AVCodecContext *avccontext, void *data,
av_dlog(NULL, "parsed %d bytes %d bits, returned %d samples (*ch*bits) \n",
get_bits_count(gb) / 8, get_bits_count(gb) % 8, len);
- /* get output buffer */
vc->frame.nb_samples = len;
- if ((ret = avccontext->get_buffer(avccontext, &vc->frame)) < 0) {
- av_log(avccontext, AV_LOG_ERROR, "get_buffer() failed\n");
- return ret;
- }
-
- if (vc->audio_channels > 8) {
- for (i = 0; i < vc->audio_channels; i++)
- channel_ptrs[i] = vc->channel_floors + i * len;
- } else {
- for (i = 0; i < vc->audio_channels; i++)
- channel_ptrs[i] = vc->channel_floors +
- len * ff_vorbis_channel_layout_offsets[vc->audio_channels - 1][i];
- }
-
- if (avccontext->sample_fmt == AV_SAMPLE_FMT_FLT)
- vc->fmt_conv.float_interleave((float *)vc->frame.data[0], channel_ptrs,
- len, vc->audio_channels);
- else
- vc->fmt_conv.float_to_int16_interleave((int16_t *)vc->frame.data[0],
- channel_ptrs, len,
- vc->audio_channels);
-
*got_frame_ptr = 1;
*(AVFrame *)data = vc->frame;
@@ -1707,19 +1709,29 @@ static av_cold int vorbis_decode_close(AVCodecContext *avccontext)
return 0;
}
+static av_cold void vorbis_decode_flush(AVCodecContext *avccontext)
+{
+ vorbis_context *vc = avccontext->priv_data;
+
+ if (vc->saved) {
+ memset(vc->saved, 0, (vc->blocksize[1] / 4) * vc->audio_channels *
+ sizeof(*vc->saved));
+ }
+ vc->previous_window = 0;
+}
+
AVCodec ff_vorbis_decoder = {
- .name = "vorbis",
- .type = AVMEDIA_TYPE_AUDIO,
- .id = CODEC_ID_VORBIS,
- .priv_data_size = sizeof(vorbis_context),
- .init = vorbis_decode_init,
- .close = vorbis_decode_close,
- .decode = vorbis_decode_frame,
- .capabilities = CODEC_CAP_DR1,
- .long_name = NULL_IF_CONFIG_SMALL("Vorbis"),
+ .name = "vorbis",
+ .type = AVMEDIA_TYPE_AUDIO,
+ .id = AV_CODEC_ID_VORBIS,
+ .priv_data_size = sizeof(vorbis_context),
+ .init = vorbis_decode_init,
+ .close = vorbis_decode_close,
+ .decode = vorbis_decode_frame,
+ .flush = vorbis_decode_flush,
+ .capabilities = CODEC_CAP_DR1,
+ .long_name = NULL_IF_CONFIG_SMALL("Vorbis"),
.channel_layouts = ff_vorbis_channel_layouts,
- .sample_fmts = (const enum AVSampleFormat[]) {
- AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_NONE
- },
+ .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP,
+ AV_SAMPLE_FMT_NONE },
};
-
diff --git a/gst-libs/ext/libav/libavcodec/vorbisenc.c b/gst-libs/ext/libav/libavcodec/vorbisenc.c
index 2cab6b3..42713f9 100644
--- a/gst-libs/ext/libav/libavcodec/vorbisenc.c
+++ b/gst-libs/ext/libav/libavcodec/vorbisenc.c
@@ -27,6 +27,7 @@
#include <float.h>
#include "avcodec.h"
#include "dsputil.h"
+#include "internal.h"
#include "fft.h"
#include "vorbis.h"
#include "vorbis_enc_data.h"
@@ -41,13 +42,13 @@ typedef struct {
int nentries;
uint8_t *lens;
uint32_t *codewords;
- int ndimentions;
+ int ndimensions;
float min;
float delta;
int seq_p;
int lookup;
int *quantlist;
- float *dimentions;
+ float *dimensions;
float *pow2;
} vorbis_enc_codebook;
@@ -123,7 +124,7 @@ typedef struct {
int nmodes;
vorbis_enc_mode *modes;
- int64_t sample_count;
+ int64_t next_pts;
} vorbis_enc_context;
#define MAX_CHANNELS 2
@@ -137,21 +138,24 @@ typedef struct {
#define RESIDUE_PART_SIZE 32
#define NUM_RESIDUE_PARTITIONS (RESIDUE_SIZE/RESIDUE_PART_SIZE)
-static inline void put_codeword(PutBitContext *pb, vorbis_enc_codebook *cb,
- int entry)
+static inline int put_codeword(PutBitContext *pb, vorbis_enc_codebook *cb,
+ int entry)
{
assert(entry >= 0);
assert(entry < cb->nentries);
assert(cb->lens[entry]);
+ if (pb->size_in_bits - put_bits_count(pb) < cb->lens[entry])
+ return AVERROR(EINVAL);
put_bits(pb, cb->lens[entry], cb->codewords[entry]);
+ return 0;
}
-static int cb_lookup_vals(int lookup, int dimentions, int entries)
+static int cb_lookup_vals(int lookup, int dimensions, int entries)
{
if (lookup == 1)
- return ff_vorbis_nth_root(entries, dimentions);
+ return ff_vorbis_nth_root(entries, dimensions);
else if (lookup == 2)
- return dimentions *entries;
+ return dimensions *entries;
return 0;
}
@@ -162,28 +166,28 @@ static int ready_codebook(vorbis_enc_codebook *cb)
ff_vorbis_len2vlc(cb->lens, cb->codewords, cb->nentries);
if (!cb->lookup) {
- cb->pow2 = cb->dimentions = NULL;
+ cb->pow2 = cb->dimensions = NULL;
} else {
- int vals = cb_lookup_vals(cb->lookup, cb->ndimentions, cb->nentries);
- cb->dimentions = av_malloc(sizeof(float) * cb->nentries * cb->ndimentions);
+ int vals = cb_lookup_vals(cb->lookup, cb->ndimensions, cb->nentries);
+ cb->dimensions = av_malloc(sizeof(float) * cb->nentries * cb->ndimensions);
cb->pow2 = av_mallocz(sizeof(float) * cb->nentries);
- if (!cb->dimentions || !cb->pow2)
+ if (!cb->dimensions || !cb->pow2)
return AVERROR(ENOMEM);
for (i = 0; i < cb->nentries; i++) {
float last = 0;
int j;
int div = 1;
- for (j = 0; j < cb->ndimentions; j++) {
+ for (j = 0; j < cb->ndimensions; j++) {
int off;
if (cb->lookup == 1)
off = (i / div) % vals; // lookup type 1
else
- off = i * cb->ndimentions + j; // lookup type 2
+ off = i * cb->ndimensions + j; // lookup type 2
- cb->dimentions[i * cb->ndimentions + j] = last + cb->min + cb->quantlist[off] * cb->delta;
+ cb->dimensions[i * cb->ndimensions + j] = last + cb->min + cb->quantlist[off] * cb->delta;
if (cb->seq_p)
- last = cb->dimentions[i * cb->ndimentions + j];
- cb->pow2[i] += cb->dimentions[i * cb->ndimentions + j] * cb->dimentions[i * cb->ndimentions + j];
+ last = cb->dimensions[i * cb->ndimensions + j];
+ cb->pow2[i] += cb->dimensions[i * cb->ndimensions + j] * cb->dimensions[i * cb->ndimensions + j];
div *= vals;
}
cb->pow2[i] /= 2.;
@@ -208,17 +212,17 @@ static int ready_residue(vorbis_enc_residue *rc, vorbis_enc_context *venc)
if (j == 8) // zero
continue;
cb = &venc->codebooks[rc->books[i][j]];
- assert(cb->ndimentions >= 2);
+ assert(cb->ndimensions >= 2);
assert(cb->lookup);
for (j = 0; j < cb->nentries; j++) {
float a;
if (!cb->lens[j])
continue;
- a = fabs(cb->dimentions[j * cb->ndimentions]);
+ a = fabs(cb->dimensions[j * cb->ndimensions]);
if (a > rc->maxes[i][0])
rc->maxes[i][0] = a;
- a = fabs(cb->dimentions[j * cb->ndimentions + 1]);
+ a = fabs(cb->dimensions[j * cb->ndimensions + 1]);
if (a > rc->maxes[i][1])
rc->maxes[i][1] = a;
}
@@ -254,7 +258,7 @@ static int create_vorbis_context(vorbis_enc_context *venc,
for (book = 0; book < venc->ncodebooks; book++) {
vorbis_enc_codebook *cb = &venc->codebooks[book];
int vals;
- cb->ndimentions = cvectors[book].dim;
+ cb->ndimensions = cvectors[book].dim;
cb->nentries = cvectors[book].real_len;
cb->min = cvectors[book].min;
cb->delta = cvectors[book].delta;
@@ -269,7 +273,7 @@ static int create_vorbis_context(vorbis_enc_context *venc,
memset(cb->lens + cvectors[book].len, 0, cb->nentries - cvectors[book].len);
if (cb->lookup) {
- vals = cb_lookup_vals(cb->lookup, cb->ndimentions, cb->nentries);
+ vals = cb_lookup_vals(cb->lookup, cb->ndimensions, cb->nentries);
cb->quantlist = av_malloc(sizeof(int) * vals);
if (!cb->quantlist)
return AVERROR(ENOMEM);
@@ -452,7 +456,7 @@ static void put_codebook_header(PutBitContext *pb, vorbis_enc_codebook *cb)
int ordered = 0;
put_bits(pb, 24, 0x564342); //magic
- put_bits(pb, 16, cb->ndimentions);
+ put_bits(pb, 16, cb->ndimensions);
put_bits(pb, 24, cb->nentries);
for (i = 1; i < cb->nentries; i++)
@@ -494,7 +498,7 @@ static void put_codebook_header(PutBitContext *pb, vorbis_enc_codebook *cb)
put_bits(pb, 4, cb->lookup);
if (cb->lookup) {
- int tmp = cb_lookup_vals(cb->lookup, cb->ndimentions, cb->nentries);
+ int tmp = cb_lookup_vals(cb->lookup, cb->ndimensions, cb->nentries);
int bits = ilog(cb->quantlist[0]);
for (i = 1; i < tmp; i++)
@@ -752,14 +756,16 @@ static int render_point(int x0, int y0, int x1, int y1, int x)
return y0 + (x - x0) * (y1 - y0) / (x1 - x0);
}
-static void floor_encode(vorbis_enc_context *venc, vorbis_enc_floor *fc,
- PutBitContext *pb, uint16_t *posts,
- float *floor, int samples)
+static int floor_encode(vorbis_enc_context *venc, vorbis_enc_floor *fc,
+ PutBitContext *pb, uint16_t *posts,
+ float *floor, int samples)
{
int range = 255 / fc->multiplier + 1;
int coded[MAX_FLOOR_VALUES]; // first 2 values are unused
int i, counter;
+ if (pb->size_in_bits - put_bits_count(pb) < 1 + 2 * ilog(range - 1))
+ return AVERROR(EINVAL);
put_bits(pb, 1, 1); // non zero
put_bits(pb, ilog(range - 1), posts[0]);
put_bits(pb, ilog(range - 1), posts[1]);
@@ -817,7 +823,8 @@ static void floor_encode(vorbis_enc_context *venc, vorbis_enc_floor *fc,
cval |= l << cshift;
cshift += c->subclass;
}
- put_codeword(pb, book, cval);
+ if (put_codeword(pb, book, cval))
+ return AVERROR(EINVAL);
}
for (k = 0; k < c->dim; k++) {
int book = c->books[cval & (csub-1)];
@@ -827,12 +834,15 @@ static void floor_encode(vorbis_enc_context *venc, vorbis_enc_floor *fc,
continue;
if (entry == -1)
entry = 0;
- put_codeword(pb, &venc->codebooks[book], entry);
+ if (put_codeword(pb, &venc->codebooks[book], entry))
+ return AVERROR(EINVAL);
}
}
ff_vorbis_floor1_render_list(fc->list, fc->values, posts, coded,
fc->multiplier, floor, samples);
+
+ return 0;
}
static float *put_vector(vorbis_enc_codebook *book, PutBitContext *pb,
@@ -840,33 +850,34 @@ static float *put_vector(vorbis_enc_codebook *book, PutBitContext *pb,
{
int i, entry = -1;
float distance = FLT_MAX;
- assert(book->dimentions);
+ assert(book->dimensions);
for (i = 0; i < book->nentries; i++) {
- float * vec = book->dimentions + i * book->ndimentions, d = book->pow2[i];
+ float * vec = book->dimensions + i * book->ndimensions, d = book->pow2[i];
int j;
if (!book->lens[i])
continue;
- for (j = 0; j < book->ndimentions; j++)
+ for (j = 0; j < book->ndimensions; j++)
d -= vec[j] * num[j];
if (distance > d) {
entry = i;
distance = d;
}
}
- put_codeword(pb, book, entry);
- return &book->dimentions[entry * book->ndimentions];
+ if (put_codeword(pb, book, entry))
+ return NULL;
+ return &book->dimensions[entry * book->ndimensions];
}
-static void residue_encode(vorbis_enc_context *venc, vorbis_enc_residue *rc,
- PutBitContext *pb, float *coeffs, int samples,
- int real_ch)
+static int residue_encode(vorbis_enc_context *venc, vorbis_enc_residue *rc,
+ PutBitContext *pb, float *coeffs, int samples,
+ int real_ch)
{
int pass, i, j, p, k;
int psize = rc->partition_size;
int partitions = (rc->end - rc->begin) / psize;
int channels = (rc->type == 2) ? 1 : real_ch;
int classes[MAX_CHANNELS][NUM_RESIDUE_PARTITIONS];
- int classwords = venc->codebooks[rc->classbook].ndimentions;
+ int classwords = venc->codebooks[rc->classbook].ndimensions;
assert(rc->type == 2);
assert(real_ch == 2);
@@ -895,7 +906,8 @@ static void residue_encode(vorbis_enc_context *venc, vorbis_enc_residue *rc,
entry *= rc->classifications;
entry += classes[j][p + i];
}
- put_codeword(pb, book, entry);
+ if (put_codeword(pb, book, entry))
+ return AVERROR(EINVAL);
}
for (i = 0; i < classwords && p < partitions; i++, p++) {
for (j = 0; j < channels; j++) {
@@ -906,13 +918,15 @@ static void residue_encode(vorbis_enc_context *venc, vorbis_enc_residue *rc,
continue;
assert(rc->type == 0 || rc->type == 2);
- assert(!(psize % book->ndimentions));
+ assert(!(psize % book->ndimensions));
if (rc->type == 0) {
- for (k = 0; k < psize; k += book->ndimentions) {
- float *a = put_vector(book, pb, &buf[k]);
+ for (k = 0; k < psize; k += book->ndimensions) {
int l;
- for (l = 0; l < book->ndimentions; l++)
+ float *a = put_vector(book, pb, &buf[k]);
+ if (!a)
+ return AVERROR(EINVAL);
+ for (l = 0; l < book->ndimensions; l++)
buf[k + l] -= a[l];
}
} else {
@@ -920,10 +934,10 @@ static void residue_encode(vorbis_enc_context *venc, vorbis_enc_residue *rc,
a1 = (s % real_ch) * samples;
b1 = s / real_ch;
s = real_ch * samples;
- for (k = 0; k < psize; k += book->ndimentions) {
+ for (k = 0; k < psize; k += book->ndimensions) {
int dim, a2 = a1, b2 = b1;
float vec[MAX_CODEBOOK_DIM], *pv = vec;
- for (dim = book->ndimentions; dim--; ) {
+ for (dim = book->ndimensions; dim--; ) {
*pv++ = coeffs[a2 + b2];
if ((a2 += samples) == s) {
a2 = 0;
@@ -931,7 +945,9 @@ static void residue_encode(vorbis_enc_context *venc, vorbis_enc_residue *rc,
}
}
pv = put_vector(book, pb, vec);
- for (dim = book->ndimentions; dim--; ) {
+ if (!pv)
+ return AVERROR(EINVAL);
+ for (dim = book->ndimensions; dim--; ) {
coeffs[a1 + b1] -= *pv++;
if ((a1 += samples) == s) {
a1 = 0;
@@ -944,12 +960,13 @@ static void residue_encode(vorbis_enc_context *venc, vorbis_enc_residue *rc,
}
}
}
+ return 0;
}
-static int apply_window_and_mdct(vorbis_enc_context *venc, const signed short *audio,
- int samples)
+static int apply_window_and_mdct(vorbis_enc_context *venc,
+ float **audio, int samples)
{
- int i, j, channel;
+ int i, channel;
const float * win = venc->win[0];
int window_len = 1 << (venc->log2_blocksize[0] - 1);
float n = (float)(1 << venc->log2_blocksize[0]) / 4.;
@@ -971,9 +988,8 @@ static int apply_window_and_mdct(vorbis_enc_context *venc, const signed short *a
if (samples) {
for (channel = 0; channel < venc->channels; channel++) {
float * offset = venc->samples + channel*window_len*2 + window_len;
- j = channel;
- for (i = 0; i < samples; i++, j += venc->channels)
- offset[i] = audio[j] / 32768. / n * win[window_len - i - 1];
+ for (i = 0; i < samples; i++)
+ offset[i] = audio[channel][i] / n * win[window_len - i - 1];
}
} else {
for (channel = 0; channel < venc->channels; channel++)
@@ -988,9 +1004,8 @@ static int apply_window_and_mdct(vorbis_enc_context *venc, const signed short *a
if (samples) {
for (channel = 0; channel < venc->channels; channel++) {
float *offset = venc->saved + channel * window_len;
- j = channel;
- for (i = 0; i < samples; i++, j += venc->channels)
- offset[i] = audio[j] / 32768. / n * win[i];
+ for (i = 0; i < samples; i++)
+ offset[i] = audio[channel][i] / n * win[i];
}
venc->have_saved = 1;
} else {
@@ -1000,23 +1015,32 @@ static int apply_window_and_mdct(vorbis_enc_context *venc, const signed short *a
}
-static int vorbis_encode_frame(AVCodecContext *avccontext,
- unsigned char *packets,
- int buf_size, void *data)
+static int vorbis_encode_frame(AVCodecContext *avccontext, AVPacket *avpkt,
+ const AVFrame *frame, int *got_packet_ptr)
{
vorbis_enc_context *venc = avccontext->priv_data;
- const signed short *audio = data;
- int samples = data ? avccontext->frame_size : 0;
+ float **audio = frame ? (float **)frame->extended_data : NULL;
+ int samples = frame ? frame->nb_samples : 0;
vorbis_enc_mode *mode;
vorbis_enc_mapping *mapping;
PutBitContext pb;
- int i;
+ int i, ret;
if (!apply_window_and_mdct(venc, audio, samples))
return 0;
samples = 1 << (venc->log2_blocksize[0] - 1);
- init_put_bits(&pb, packets, buf_size);
+ if ((ret = ff_alloc_packet(avpkt, 8192))) {
+ av_log(avccontext, AV_LOG_ERROR, "Error getting output packet\n");
+ return ret;
+ }
+
+ init_put_bits(&pb, avpkt->data, avpkt->size);
+
+ if (pb.size_in_bits - put_bits_count(&pb) < 1 + ilog(venc->nmodes - 1)) {
+ av_log(avccontext, AV_LOG_ERROR, "output buffer is too small\n");
+ return AVERROR(EINVAL);
+ }
put_bits(&pb, 1, 0); // magic bit
@@ -1033,7 +1057,10 @@ static int vorbis_encode_frame(AVCodecContext *avccontext,
vorbis_enc_floor *fc = &venc->floors[mapping->floor[mapping->mux[i]]];
uint16_t posts[MAX_FLOOR_VALUES];
floor_fit(venc, fc, &venc->coeffs[i * samples], posts, samples);
- floor_encode(venc, fc, &pb, posts, &venc->floor[i * samples], samples);
+ if (floor_encode(venc, fc, &pb, posts, &venc->floor[i * samples], samples)) {
+ av_log(avccontext, AV_LOG_ERROR, "output buffer is too small\n");
+ return AVERROR(EINVAL);
+ }
}
for (i = 0; i < venc->channels * samples; i++)
@@ -1053,13 +1080,26 @@ static int vorbis_encode_frame(AVCodecContext *avccontext,
}
}
- residue_encode(venc, &venc->residues[mapping->residue[mapping->mux[0]]],
- &pb, venc->coeffs, samples, venc->channels);
+ if (residue_encode(venc, &venc->residues[mapping->residue[mapping->mux[0]]],
+ &pb, venc->coeffs, samples, venc->channels)) {
+ av_log(avccontext, AV_LOG_ERROR, "output buffer is too small\n");
+ return AVERROR(EINVAL);
+ }
- avccontext->coded_frame->pts = venc->sample_count;
- venc->sample_count += avccontext->frame_size;
flush_put_bits(&pb);
- return put_bits_count(&pb) >> 3;
+ avpkt->size = put_bits_count(&pb) >> 3;
+
+ avpkt->duration = ff_samples_to_time_base(avccontext, avccontext->frame_size);
+ if (frame)
+ if (frame->pts != AV_NOPTS_VALUE)
+ avpkt->pts = ff_samples_to_time_base(avccontext, frame->pts);
+ else
+ avpkt->pts = venc->next_pts;
+ if (avpkt->pts != AV_NOPTS_VALUE)
+ venc->next_pts = avpkt->pts + avpkt->duration;
+
+ *got_packet_ptr = 1;
+ return 0;
}
@@ -1073,7 +1113,7 @@ static av_cold int vorbis_encode_close(AVCodecContext *avccontext)
av_freep(&venc->codebooks[i].lens);
av_freep(&venc->codebooks[i].codewords);
av_freep(&venc->codebooks[i].quantlist);
- av_freep(&venc->codebooks[i].dimentions);
+ av_freep(&venc->codebooks[i].dimensions);
av_freep(&venc->codebooks[i].pow2);
}
av_freep(&venc->codebooks);
@@ -1117,7 +1157,9 @@ static av_cold int vorbis_encode_close(AVCodecContext *avccontext)
ff_mdct_end(&venc->mdct[0]);
ff_mdct_end(&venc->mdct[1]);
+#if FF_API_OLD_ENCODE_AUDIO
av_freep(&avccontext->coded_frame);
+#endif
av_freep(&avccontext->extradata);
return 0 ;
@@ -1136,10 +1178,11 @@ static av_cold int vorbis_encode_init(AVCodecContext *avccontext)
if ((ret = create_vorbis_context(venc, avccontext)) < 0)
goto error;
+ avccontext->bit_rate = 0;
if (avccontext->flags & CODEC_FLAG_QSCALE)
- venc->quality = avccontext->global_quality / (float)FF_QP2LAMBDA / 10.;
+ venc->quality = avccontext->global_quality / (float)FF_QP2LAMBDA;
else
- venc->quality = 0.03;
+ venc->quality = 3.0;
venc->quality *= venc->quality;
if ((ret = put_main_header(venc, (uint8_t**)&avccontext->extradata)) < 0)
@@ -1148,11 +1191,13 @@ static av_cold int vorbis_encode_init(AVCodecContext *avccontext)
avccontext->frame_size = 1 << (venc->log2_blocksize[0] - 1);
+#if FF_API_OLD_ENCODE_AUDIO
avccontext->coded_frame = avcodec_alloc_frame();
if (!avccontext->coded_frame) {
ret = AVERROR(ENOMEM);
goto error;
}
+#endif
return 0;
error:
@@ -1163,12 +1208,13 @@ error:
AVCodec ff_vorbis_encoder = {
.name = "vorbis",
.type = AVMEDIA_TYPE_AUDIO,
- .id = CODEC_ID_VORBIS,
+ .id = AV_CODEC_ID_VORBIS,
.priv_data_size = sizeof(vorbis_enc_context),
.init = vorbis_encode_init,
- .encode = vorbis_encode_frame,
+ .encode2 = vorbis_encode_frame,
.close = vorbis_encode_close,
- .capabilities= CODEC_CAP_DELAY | CODEC_CAP_EXPERIMENTAL,
- .sample_fmts = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_NONE},
- .long_name = NULL_IF_CONFIG_SMALL("Vorbis"),
+ .capabilities = CODEC_CAP_DELAY | CODEC_CAP_EXPERIMENTAL,
+ .sample_fmts = (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_FLTP,
+ AV_SAMPLE_FMT_NONE },
+ .long_name = NULL_IF_CONFIG_SMALL("Vorbis"),
};
diff --git a/gst-libs/ext/libav/libavcodec/vp3.c b/gst-libs/ext/libav/libavcodec/vp3.c
index da70e66..0340c22 100644
--- a/gst-libs/ext/libav/libavcodec/vp3.c
+++ b/gst-libs/ext/libav/libavcodec/vp3.c
@@ -38,8 +38,9 @@
#include "internal.h"
#include "dsputil.h"
#include "get_bits.h"
-
+#include "videodsp.h"
#include "vp3data.h"
+#include "vp3dsp.h"
#include "xiph.h"
#include "thread.h"
@@ -135,6 +136,8 @@ typedef struct Vp3DecodeContext {
AVFrame current_frame;
int keyframe;
DSPContext dsp;
+ VideoDSPContext vdsp;
+ VP3DSPContext vp3dsp;
int flipped_image;
int last_slice_end;
int skip_loop_filter;
@@ -278,15 +281,15 @@ static av_cold int vp3_decode_end(AVCodecContext *avctx)
Vp3DecodeContext *s = avctx->priv_data;
int i;
- av_free(s->superblock_coding);
- av_free(s->all_fragments);
- av_free(s->coded_fragment_list[0]);
- av_free(s->dct_tokens_base);
- av_free(s->superblock_fragments);
- av_free(s->macroblock_coding);
- av_free(s->motion_val[0]);
- av_free(s->motion_val[1]);
- av_free(s->edge_emu_buffer);
+ av_freep(&s->superblock_coding);
+ av_freep(&s->all_fragments);
+ av_freep(&s->coded_fragment_list[0]);
+ av_freep(&s->dct_tokens_base);
+ av_freep(&s->superblock_fragments);
+ av_freep(&s->macroblock_coding);
+ av_freep(&s->motion_val[0]);
+ av_freep(&s->motion_val[1]);
+ av_freep(&s->edge_emu_buffer);
if (avctx->internal->is_copy)
return 0;
@@ -396,6 +399,7 @@ static void init_loop_filter(Vp3DecodeContext *s)
int value;
filter_limit = s->filter_limit_values[s->qps[0]];
+ assert(filter_limit < 128);
/* set up the bounding values */
memset(s->bounding_values_array, 0, 256 * sizeof(int));
@@ -1301,14 +1305,14 @@ static void apply_loop_filter(Vp3DecodeContext *s, int plane, int ystart, int ye
{
/* do not perform left edge filter for left columns frags */
if (x > 0) {
- s->dsp.vp3_h_loop_filter(
+ s->vp3dsp.h_loop_filter(
plane_data + 8*x,
stride, bounding_values);
}
/* do not perform top edge filter for top row fragments */
if (y > 0) {
- s->dsp.vp3_v_loop_filter(
+ s->vp3dsp.v_loop_filter(
plane_data + 8*x,
stride, bounding_values);
}
@@ -1318,7 +1322,7 @@ static void apply_loop_filter(Vp3DecodeContext *s, int plane, int ystart, int ye
* in this frame (it will be filtered in next iteration) */
if ((x < width - 1) &&
(s->all_fragments[fragment + 1].coding_method == MODE_COPY)) {
- s->dsp.vp3_h_loop_filter(
+ s->vp3dsp.h_loop_filter(
plane_data + 8*x + 8,
stride, bounding_values);
}
@@ -1328,7 +1332,7 @@ static void apply_loop_filter(Vp3DecodeContext *s, int plane, int ystart, int ye
* in this frame (it will be filtered in the next row) */
if ((y < height - 1) &&
(s->all_fragments[fragment + width].coding_method == MODE_COPY)) {
- s->dsp.vp3_v_loop_filter(
+ s->vp3dsp.v_loop_filter(
plane_data + 8*x + 8*stride,
stride, bounding_values);
}
@@ -1540,7 +1544,7 @@ static void render_slice(Vp3DecodeContext *s, int slice)
uint8_t *temp= s->edge_emu_buffer;
if(stride<0) temp -= 8*stride;
- s->dsp.emulated_edge_mc(temp, motion_source, stride, 9, 9, src_x, src_y, plane_width, plane_height);
+ s->vdsp.emulated_edge_mc(temp, motion_source, stride, 9, 9, src_x, src_y, plane_width, plane_height);
motion_source= temp;
}
}
@@ -1576,9 +1580,7 @@ static void render_slice(Vp3DecodeContext *s, int slice)
index = vp3_dequant(s, s->all_fragments + i, plane, 0, block);
if (index > 63)
continue;
- if(s->avctx->idct_algo!=FF_IDCT_VP3)
- block[0] += 128<<3;
- s->dsp.idct_put(
+ s->vp3dsp.idct_put(
output_plane + first_pixel,
stride,
block);
@@ -1587,12 +1589,12 @@ static void render_slice(Vp3DecodeContext *s, int slice)
if (index > 63)
continue;
if (index > 0) {
- s->dsp.idct_add(
+ s->vp3dsp.idct_add(
output_plane + first_pixel,
stride,
block);
} else {
- s->dsp.vp3_idct_dc_add(output_plane + first_pixel, stride, block);
+ s->vp3dsp.idct_dc_add(output_plane + first_pixel, stride, block);
}
}
} else {
@@ -1672,13 +1674,14 @@ static av_cold int vp3_decode_init(AVCodecContext *avctx)
s->avctx = avctx;
s->width = FFALIGN(avctx->width, 16);
s->height = FFALIGN(avctx->height, 16);
- if (avctx->pix_fmt == PIX_FMT_NONE)
- avctx->pix_fmt = PIX_FMT_YUV420P;
+ if (avctx->pix_fmt == AV_PIX_FMT_NONE)
+ avctx->pix_fmt = AV_PIX_FMT_YUV420P;
avctx->chroma_sample_location = AVCHROMA_LOC_CENTER;
- if(avctx->idct_algo==FF_IDCT_AUTO)
- avctx->idct_algo=FF_IDCT_VP3;
- dsputil_init(&s->dsp, avctx);
+ ff_dsputil_init(&s->dsp, avctx);
+ ff_videodsp_init(&s->vdsp, 8);
+ ff_vp3dsp_init(&s->vp3dsp, avctx->flags);
+ ff_init_scantable_permutation(s->dsp.idct_permutation, s->vp3dsp.idct_perm);
ff_init_scantable(s->dsp.idct_permutation, &s->scantable, ff_zigzag_direct);
/* initialize to an impossible value which will force a recalculation
@@ -1686,7 +1689,8 @@ static av_cold int vp3_decode_init(AVCodecContext *avctx)
for (i = 0; i < 3; i++)
s->qps[i] = -1;
- avcodec_get_chroma_sub_sample(avctx->pix_fmt, &s->chroma_x_shift, &s->chroma_y_shift);
+ av_pix_fmt_get_chroma_sub_sample(avctx->pix_fmt, &s->chroma_x_shift,
+ &s->chroma_y_shift);
s->y_superblock_width = (s->width + 31) / 32;
s->y_superblock_height = (s->height + 31) / 32;
@@ -1908,7 +1912,7 @@ static int vp3_update_thread_context(AVCodecContext *dst, const AVCodecContext *
}
static int vp3_decode_frame(AVCodecContext *avctx,
- void *data, int *data_size,
+ void *data, int *got_frame,
AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
@@ -2044,7 +2048,7 @@ static int vp3_decode_frame(AVCodecContext *avctx,
}
vp3_draw_horiz_band(s, s->avctx->height);
- *data_size=sizeof(AVFrame);
+ *got_frame = 1;
*(AVFrame*)data= s->current_frame;
if (!HAVE_THREADS || !(s->avctx->active_thread_type&FF_THREAD_FRAME))
@@ -2072,7 +2076,8 @@ static int read_huffman_tree(AVCodecContext *avctx, GetBitContext *gb)
return -1;
}
token = get_bits(gb, 5);
- //av_log(avctx, AV_LOG_DEBUG, "hti %d hbits %x token %d entry : %d size %d\n", s->hti, s->hbits, token, s->entries, s->huff_code_size);
+ av_dlog(avctx, "hti %d hbits %x token %d entry : %d size %d\n",
+ s->hti, s->hbits, token, s->entries, s->huff_code_size);
s->huffman_table[s->hti][token][0] = s->hbits;
s->huffman_table[s->hti][token][1] = s->huff_code_size;
s->entries++;
@@ -2113,8 +2118,8 @@ static int vp3_init_thread_copy(AVCodecContext *avctx)
}
#if CONFIG_THEORA_DECODER
-static const enum PixelFormat theora_pix_fmts[4] = {
- PIX_FMT_YUV420P, PIX_FMT_NONE, PIX_FMT_YUV422P, PIX_FMT_YUV444P
+static const enum AVPixelFormat theora_pix_fmts[4] = {
+ AV_PIX_FMT_YUV420P, AV_PIX_FMT_NONE, AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUV444P
};
static int theora_decode_header(AVCodecContext *avctx, GetBitContext *gb)
@@ -2334,6 +2339,8 @@ static av_cold int theora_decode_init(AVCodecContext *avctx)
}
for(i=0;i<3;i++) {
+ if (header_len[i] <= 0)
+ continue;
init_get_bits(&gb, header_start[i], header_len[i] * 8);
ptype = get_bits(&gb, 8);
@@ -2374,32 +2381,34 @@ static av_cold int theora_decode_init(AVCodecContext *avctx)
}
AVCodec ff_theora_decoder = {
- .name = "theora",
- .type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_THEORA,
- .priv_data_size = sizeof(Vp3DecodeContext),
- .init = theora_decode_init,
- .close = vp3_decode_end,
- .decode = vp3_decode_frame,
- .capabilities = CODEC_CAP_DR1 | CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_FRAME_THREADS,
- .flush = vp3_decode_flush,
- .long_name = NULL_IF_CONFIG_SMALL("Theora"),
+ .name = "theora",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .id = AV_CODEC_ID_THEORA,
+ .priv_data_size = sizeof(Vp3DecodeContext),
+ .init = theora_decode_init,
+ .close = vp3_decode_end,
+ .decode = vp3_decode_frame,
+ .capabilities = CODEC_CAP_DR1 | CODEC_CAP_DRAW_HORIZ_BAND |
+ CODEC_CAP_FRAME_THREADS,
+ .flush = vp3_decode_flush,
+ .long_name = NULL_IF_CONFIG_SMALL("Theora"),
.init_thread_copy = ONLY_IF_THREADS_ENABLED(vp3_init_thread_copy),
.update_thread_context = ONLY_IF_THREADS_ENABLED(vp3_update_thread_context)
};
#endif
AVCodec ff_vp3_decoder = {
- .name = "vp3",
- .type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_VP3,
- .priv_data_size = sizeof(Vp3DecodeContext),
- .init = vp3_decode_init,
- .close = vp3_decode_end,
- .decode = vp3_decode_frame,
- .capabilities = CODEC_CAP_DR1 | CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_FRAME_THREADS,
- .flush = vp3_decode_flush,
- .long_name = NULL_IF_CONFIG_SMALL("On2 VP3"),
+ .name = "vp3",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .id = AV_CODEC_ID_VP3,
+ .priv_data_size = sizeof(Vp3DecodeContext),
+ .init = vp3_decode_init,
+ .close = vp3_decode_end,
+ .decode = vp3_decode_frame,
+ .capabilities = CODEC_CAP_DR1 | CODEC_CAP_DRAW_HORIZ_BAND |
+ CODEC_CAP_FRAME_THREADS,
+ .flush = vp3_decode_flush,
+ .long_name = NULL_IF_CONFIG_SMALL("On2 VP3"),
.init_thread_copy = ONLY_IF_THREADS_ENABLED(vp3_init_thread_copy),
- .update_thread_context = ONLY_IF_THREADS_ENABLED(vp3_update_thread_context)
+ .update_thread_context = ONLY_IF_THREADS_ENABLED(vp3_update_thread_context),
};
diff --git a/gst-libs/ext/libav/libavcodec/vp3_parser.c b/gst-libs/ext/libav/libavcodec/vp3_parser.c
index 1d70408..ef2c55b 100644
--- a/gst-libs/ext/libav/libavcodec/vp3_parser.c
+++ b/gst-libs/ext/libav/libavcodec/vp3_parser.c
@@ -25,7 +25,7 @@ static int parse(AVCodecParserContext *s,
const uint8_t **poutbuf, int *poutbuf_size,
const uint8_t *buf, int buf_size)
{
- if(avctx->codec_id == CODEC_ID_THEORA)
+ if(avctx->codec_id == AV_CODEC_ID_THEORA)
s->pict_type= (buf[0]&0x40) ? AV_PICTURE_TYPE_P : AV_PICTURE_TYPE_I;
else
s->pict_type= (buf[0]&0x80) ? AV_PICTURE_TYPE_P : AV_PICTURE_TYPE_I;
@@ -36,7 +36,7 @@ static int parse(AVCodecParserContext *s,
}
AVCodecParser ff_vp3_parser = {
- .codec_ids = { CODEC_ID_THEORA, CODEC_ID_VP3, CODEC_ID_VP6,
- CODEC_ID_VP6F, CODEC_ID_VP6A },
+ .codec_ids = { AV_CODEC_ID_THEORA, AV_CODEC_ID_VP3, AV_CODEC_ID_VP6,
+ AV_CODEC_ID_VP6F, AV_CODEC_ID_VP6A },
.parser_parse = parse,
};
diff --git a/gst-libs/ext/libav/libavcodec/vp3dsp.c b/gst-libs/ext/libav/libavcodec/vp3dsp.c
index 438ae76..9b0b5d0 100644
--- a/gst-libs/ext/libav/libavcodec/vp3dsp.c
+++ b/gst-libs/ext/libav/libavcodec/vp3dsp.c
@@ -24,8 +24,11 @@
* source code.
*/
+#include "libavutil/attributes.h"
+#include "libavutil/common.h"
#include "avcodec.h"
#include "dsputil.h"
+#include "vp3dsp.h"
#define IdctAdjustBeforeShift 8
#define xC1S7 64277
@@ -210,19 +213,16 @@ static av_always_inline void idct(uint8_t *dst, int stride, int16_t *input, int
}
}
-void ff_vp3_idct_c(DCTELEM *block/* align 16*/){
- idct(NULL, 0, block, 0);
-}
-
-void ff_vp3_idct_put_c(uint8_t *dest/*align 8*/, int line_size, DCTELEM *block/*align 16*/){
+static void vp3_idct_put_c(uint8_t *dest/*align 8*/, int line_size, DCTELEM *block/*align 16*/){
idct(dest, line_size, block, 1);
}
-void ff_vp3_idct_add_c(uint8_t *dest/*align 8*/, int line_size, DCTELEM *block/*align 16*/){
+static void vp3_idct_add_c(uint8_t *dest/*align 8*/, int line_size, DCTELEM *block/*align 16*/){
idct(dest, line_size, block, 2);
}
-void ff_vp3_idct_dc_add_c(uint8_t *dest/*align 8*/, int line_size, const DCTELEM *block/*align 16*/){
+static void vp3_idct_dc_add_c(uint8_t *dest/*align 8*/, int line_size,
+ const DCTELEM *block/*align 16*/){
int i, dc = (block[0] + 15) >> 5;
for(i = 0; i < 8; i++){
@@ -238,7 +238,8 @@ void ff_vp3_idct_dc_add_c(uint8_t *dest/*align 8*/, int line_size, const DCTELEM
}
}
-void ff_vp3_v_loop_filter_c(uint8_t *first_pixel, int stride, int *bounding_values)
+static void vp3_v_loop_filter_c(uint8_t *first_pixel, int stride,
+ int *bounding_values)
{
unsigned char *end;
int filter_value;
@@ -254,7 +255,8 @@ void ff_vp3_v_loop_filter_c(uint8_t *first_pixel, int stride, int *bounding_valu
}
}
-void ff_vp3_h_loop_filter_c(uint8_t *first_pixel, int stride, int *bounding_values)
+static void vp3_h_loop_filter_c(uint8_t *first_pixel, int stride,
+ int *bounding_values)
{
unsigned char *end;
int filter_value;
@@ -268,3 +270,21 @@ void ff_vp3_h_loop_filter_c(uint8_t *first_pixel, int stride, int *bounding_valu
first_pixel[ 0] = av_clip_uint8(first_pixel[ 0] - filter_value);
}
}
+
+av_cold void ff_vp3dsp_init(VP3DSPContext *c, int flags)
+{
+ c->idct_put = vp3_idct_put_c;
+ c->idct_add = vp3_idct_add_c;
+ c->idct_dc_add = vp3_idct_dc_add_c;
+ c->v_loop_filter = vp3_v_loop_filter_c;
+ c->h_loop_filter = vp3_h_loop_filter_c;
+
+ c->idct_perm = FF_NO_IDCT_PERM;
+
+ if (ARCH_ARM)
+ ff_vp3dsp_init_arm(c, flags);
+ if (ARCH_PPC)
+ ff_vp3dsp_init_ppc(c, flags);
+ if (ARCH_X86)
+ ff_vp3dsp_init_x86(c, flags);
+}
diff --git a/gst-libs/ext/libav/libavcodec/vp3dsp.h b/gst-libs/ext/libav/libavcodec/vp3dsp.h
new file mode 100644
index 0000000..3781bbf
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/vp3dsp.h
@@ -0,0 +1,40 @@
+/*
+ * 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
+ */
+
+#ifndef AVCODEC_VP3DSP_H
+#define AVCODEC_VP3DSP_H
+
+#include <stdint.h>
+#include "dsputil.h"
+
+typedef struct VP3DSPContext {
+ void (*idct_put)(uint8_t *dest, int line_size, DCTELEM *block);
+ void (*idct_add)(uint8_t *dest, int line_size, DCTELEM *block);
+ void (*idct_dc_add)(uint8_t *dest, int line_size, const DCTELEM *block);
+ void (*v_loop_filter)(uint8_t *src, int stride, int *bounding_values);
+ void (*h_loop_filter)(uint8_t *src, int stride, int *bounding_values);
+
+ int idct_perm;
+} VP3DSPContext;
+
+void ff_vp3dsp_init(VP3DSPContext *c, int flags);
+void ff_vp3dsp_init_arm(VP3DSPContext *c, int flags);
+void ff_vp3dsp_init_ppc(VP3DSPContext *c, int flags);
+void ff_vp3dsp_init_x86(VP3DSPContext *c, int flags);
+
+#endif /* AVCODEC_VP3DSP_H */
diff --git a/gst-libs/ext/libav/libavcodec/vp5.c b/gst-libs/ext/libav/libavcodec/vp5.c
index 05c399c..3671623 100644
--- a/gst-libs/ext/libav/libavcodec/vp5.c
+++ b/gst-libs/ext/libav/libavcodec/vp5.c
@@ -88,7 +88,7 @@ static void vp5_parse_vector_adjustment(VP56Context *s, VP56mv *vect)
int sign = vp56_rac_get_prob(c, model->vector_sig[comp]);
di = vp56_rac_get_prob(c, model->vector_pdi[comp][0]);
di |= vp56_rac_get_prob(c, model->vector_pdi[comp][1]) << 1;
- delta = vp56_rac_get_tree(c, vp56_pva_tree,
+ delta = vp56_rac_get_tree(c, ff_vp56_pva_tree,
model->vector_pdv[comp]);
delta = di | (delta << 2);
delta = (delta ^ -sign) + sign;
@@ -185,7 +185,7 @@ static void vp5_parse_coeff(VP56Context *s)
if (b > 3) pt = 1;
- ctx = 6*s->coeff_ctx[vp56_b6to4[b]][0]
+ ctx = 6*s->coeff_ctx[ff_vp56_b6to4[b]][0]
+ s->above_blocks[s->above_block_idx[b]].not_null_dc;
model1 = model->coeff_dccv[pt];
model2 = model->coeff_dcct[pt][ctx];
@@ -195,26 +195,26 @@ static void vp5_parse_coeff(VP56Context *s)
if (vp56_rac_get_prob(c, model2[0])) {
if (vp56_rac_get_prob(c, model2[2])) {
if (vp56_rac_get_prob(c, model2[3])) {
- s->coeff_ctx[vp56_b6to4[b]][coeff_idx] = 4;
- idx = vp56_rac_get_tree(c, vp56_pc_tree, model1);
+ s->coeff_ctx[ff_vp56_b6to4[b]][coeff_idx] = 4;
+ idx = vp56_rac_get_tree(c, ff_vp56_pc_tree, model1);
sign = vp56_rac_get(c);
- coeff = vp56_coeff_bias[idx+5];
- for (i=vp56_coeff_bit_length[idx]; i>=0; i--)
- coeff += vp56_rac_get_prob(c, vp56_coeff_parse_table[idx][i]) << i;
+ coeff = ff_vp56_coeff_bias[idx+5];
+ for (i=ff_vp56_coeff_bit_length[idx]; i>=0; i--)
+ coeff += vp56_rac_get_prob(c, ff_vp56_coeff_parse_table[idx][i]) << i;
} else {
if (vp56_rac_get_prob(c, model2[4])) {
coeff = 3 + vp56_rac_get_prob(c, model1[5]);
- s->coeff_ctx[vp56_b6to4[b]][coeff_idx] = 3;
+ s->coeff_ctx[ff_vp56_b6to4[b]][coeff_idx] = 3;
} else {
coeff = 2;
- s->coeff_ctx[vp56_b6to4[b]][coeff_idx] = 2;
+ s->coeff_ctx[ff_vp56_b6to4[b]][coeff_idx] = 2;
}
sign = vp56_rac_get(c);
}
ct = 2;
} else {
ct = 1;
- s->coeff_ctx[vp56_b6to4[b]][coeff_idx] = 1;
+ s->coeff_ctx[ff_vp56_b6to4[b]][coeff_idx] = 1;
sign = vp56_rac_get(c);
coeff = 1;
}
@@ -226,24 +226,24 @@ static void vp5_parse_coeff(VP56Context *s)
if (ct && !vp56_rac_get_prob(c, model2[1]))
break;
ct = 0;
- s->coeff_ctx[vp56_b6to4[b]][coeff_idx] = 0;
+ s->coeff_ctx[ff_vp56_b6to4[b]][coeff_idx] = 0;
}
coeff_idx++;
if (coeff_idx >= 64)
break;
cg = vp5_coeff_groups[coeff_idx];
- ctx = s->coeff_ctx[vp56_b6to4[b]][coeff_idx];
+ ctx = s->coeff_ctx[ff_vp56_b6to4[b]][coeff_idx];
model1 = model->coeff_ract[pt][ct][cg];
model2 = cg > 2 ? model1 : model->coeff_acct[pt][ct][cg][ctx];
}
- ctx_last = FFMIN(s->coeff_ctx_last[vp56_b6to4[b]], 24);
- s->coeff_ctx_last[vp56_b6to4[b]] = coeff_idx;
+ ctx_last = FFMIN(s->coeff_ctx_last[ff_vp56_b6to4[b]], 24);
+ s->coeff_ctx_last[ff_vp56_b6to4[b]] = coeff_idx;
if (coeff_idx < ctx_last)
for (i=coeff_idx; i<=ctx_last; i++)
- s->coeff_ctx[vp56_b6to4[b]][i] = 5;
- s->above_blocks[s->above_block_idx[b]].not_null_dc = s->coeff_ctx[vp56_b6to4[b]][0];
+ s->coeff_ctx[ff_vp56_b6to4[b]][i] = 5;
+ s->above_blocks[s->above_block_idx[b]].not_null_dc = s->coeff_ctx[ff_vp56_b6to4[b]][0];
}
}
@@ -258,7 +258,7 @@ static void vp5_default_models_init(VP56Context *s)
model->vector_pdi[i][0] = 0x55;
model->vector_pdi[i][1] = 0x80;
}
- memcpy(model->mb_types_stats, vp56_def_mb_types_stats, sizeof(model->mb_types_stats));
+ memcpy(model->mb_types_stats, ff_vp56_def_mb_types_stats, sizeof(model->mb_types_stats));
memset(model->vector_pdv, 0x80, sizeof(model->vector_pdv));
}
@@ -281,11 +281,11 @@ static av_cold int vp5_decode_init(AVCodecContext *avctx)
AVCodec ff_vp5_decoder = {
.name = "vp5",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_VP5,
+ .id = AV_CODEC_ID_VP5,
.priv_data_size = sizeof(VP56Context),
.init = vp5_decode_init,
.close = ff_vp56_free,
.decode = ff_vp56_decode_frame,
.capabilities = CODEC_CAP_DR1,
- .long_name = NULL_IF_CONFIG_SMALL("On2 VP5"),
+ .long_name = NULL_IF_CONFIG_SMALL("On2 VP5"),
};
diff --git a/gst-libs/ext/libav/libavcodec/vp56.c b/gst-libs/ext/libav/libavcodec/vp56.c
index 7767461..c3c9cb2 100644
--- a/gst-libs/ext/libav/libavcodec/vp56.c
+++ b/gst-libs/ext/libav/libavcodec/vp56.c
@@ -25,6 +25,7 @@
#include "avcodec.h"
#include "bytestream.h"
+#include "internal.h"
#include "vp56.h"
#include "vp56data.h"
@@ -196,7 +197,7 @@ static void vp56_decode_4mv(VP56Context *s, int row, int col)
s->macroblocks[row * s->mb_width + col].mv = s->mv[3];
/* chroma vectors are average luma vectors */
- if (s->avctx->codec->id == CODEC_ID_VP5) {
+ if (s->avctx->codec->id == AV_CODEC_ID_VP5) {
s->mv[4].x = s->mv[5].x = RSHIFT(mv.x,2);
s->mv[4].y = s->mv[5].y = RSHIFT(mv.y,2);
} else {
@@ -268,7 +269,7 @@ static void vp56_add_predictors_dc(VP56Context *s, VP56Frame ref_frame)
for (b=0; b<6; b++) {
VP56RefDc *ab = &s->above_blocks[s->above_block_idx[b]];
- VP56RefDc *lb = &s->left_block[vp56_b6to4[b]];
+ VP56RefDc *lb = &s->left_block[ff_vp56_b6to4[b]];
int count = 0;
int dc = 0;
int i;
@@ -281,19 +282,19 @@ static void vp56_add_predictors_dc(VP56Context *s, VP56Frame ref_frame)
dc += ab->dc_coeff;
count++;
}
- if (s->avctx->codec->id == CODEC_ID_VP5)
+ if (s->avctx->codec->id == AV_CODEC_ID_VP5)
for (i=0; i<2; i++)
if (count < 2 && ref_frame == ab[-1+2*i].ref_frame) {
dc += ab[-1+2*i].dc_coeff;
count++;
}
if (count == 0)
- dc = s->prev_dc[vp56_b2p[b]][ref_frame];
+ dc = s->prev_dc[ff_vp56_b2p[b]][ref_frame];
else if (count == 2)
dc /= 2;
s->block_coeff[b][idx] += dc;
- s->prev_dc[vp56_b2p[b]][ref_frame] = s->block_coeff[b][idx];
+ s->prev_dc[ff_vp56_b2p[b]][ref_frame] = s->block_coeff[b][idx];
ab->dc_coeff = s->block_coeff[b][idx];
ab->ref_frame = ref_frame;
lb->dc_coeff = s->block_coeff[b][idx];
@@ -339,7 +340,7 @@ static void vp56_mc(VP56Context *s, int b, int plane, uint8_t *src,
if (x<0 || x+12>=s->plane_width[plane] ||
y<0 || y+12>=s->plane_height[plane]) {
- s->dsp.emulated_edge_mc(s->edge_emu_buffer,
+ s->vdsp.emulated_edge_mc(s->edge_emu_buffer,
src + s->block_offset[b] + (dy-2)*stride + (dx-2),
stride, 12, 12, x, y,
s->plane_width[plane],
@@ -410,8 +411,8 @@ static void vp56_decode_mb(VP56Context *s, int row, int col, int is_alpha)
switch (mb_type) {
case VP56_MB_INTRA:
for (b=0; b<b_max; b++) {
- plane = vp56_b2p[b+ab];
- s->dsp.idct_put(frame_current->data[plane] + s->block_offset[b],
+ plane = ff_vp56_b2p[b+ab];
+ s->vp3dsp.idct_put(frame_current->data[plane] + s->block_offset[b],
s->stride[plane], s->block_coeff[b]);
}
break;
@@ -419,12 +420,12 @@ static void vp56_decode_mb(VP56Context *s, int row, int col, int is_alpha)
case VP56_MB_INTER_NOVEC_PF:
case VP56_MB_INTER_NOVEC_GF:
for (b=0; b<b_max; b++) {
- plane = vp56_b2p[b+ab];
+ plane = ff_vp56_b2p[b+ab];
off = s->block_offset[b];
s->dsp.put_pixels_tab[1][0](frame_current->data[plane] + off,
frame_ref->data[plane] + off,
s->stride[plane], 8);
- s->dsp.idct_add(frame_current->data[plane] + off,
+ s->vp3dsp.idct_add(frame_current->data[plane] + off,
s->stride[plane], s->block_coeff[b]);
}
break;
@@ -439,10 +440,10 @@ static void vp56_decode_mb(VP56Context *s, int row, int col, int is_alpha)
for (b=0; b<b_max; b++) {
int x_off = b==1 || b==3 ? 8 : 0;
int y_off = b==2 || b==3 ? 8 : 0;
- plane = vp56_b2p[b+ab];
+ plane = ff_vp56_b2p[b+ab];
vp56_mc(s, b, plane, frame_ref->data[plane], s->stride[plane],
16*col+x_off, 16*row+y_off);
- s->dsp.idct_add(frame_current->data[plane] + s->block_offset[b],
+ s->vp3dsp.idct_add(frame_current->data[plane] + s->block_offset[b],
s->stride[plane], s->block_coeff[b]);
}
break;
@@ -486,7 +487,7 @@ static int vp56_size_changed(AVCodecContext *avctx)
return 0;
}
-int ff_vp56_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
+int ff_vp56_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
@@ -536,7 +537,7 @@ int ff_vp56_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
if (!is_alpha) {
p->reference = 1;
- if (avctx->get_buffer(avctx, p) < 0) {
+ if (ff_get_buffer(avctx, p) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return -1;
}
@@ -659,7 +660,7 @@ int ff_vp56_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
p->qscale_table = s->qscale_table;
p->qscale_type = FF_QSCALE_TYPE_VP56;
*(AVFrame*)data = *p;
- *data_size = sizeof(AVFrame);
+ *got_frame = 1;
return avpkt->size;
}
@@ -670,12 +671,13 @@ av_cold void ff_vp56_init(AVCodecContext *avctx, int flip, int has_alpha)
int i;
s->avctx = avctx;
- avctx->pix_fmt = has_alpha ? PIX_FMT_YUVA420P : PIX_FMT_YUV420P;
+ avctx->pix_fmt = has_alpha ? AV_PIX_FMT_YUVA420P : AV_PIX_FMT_YUV420P;
- if (avctx->idct_algo == FF_IDCT_AUTO)
- avctx->idct_algo = FF_IDCT_VP3;
- dsputil_init(&s->dsp, avctx);
+ ff_dsputil_init(&s->dsp, avctx);
+ ff_videodsp_init(&s->vdsp, 8);
+ ff_vp3dsp_init(&s->vp3dsp, avctx->flags);
ff_vp56dsp_init(&s->vp56dsp, avctx->codec->id);
+ ff_init_scantable_permutation(s->dsp.idct_permutation, s->vp3dsp.idct_perm);
ff_init_scantable(s->dsp.idct_permutation, &s->scantable,ff_zigzag_direct);
for (i=0; i<4; i++)
diff --git a/gst-libs/ext/libav/libavcodec/vp56.h b/gst-libs/ext/libav/libavcodec/vp56.h
index 770b608..431d1a9 100644
--- a/gst-libs/ext/libav/libavcodec/vp56.h
+++ b/gst-libs/ext/libav/libavcodec/vp56.h
@@ -30,14 +30,16 @@
#include "dsputil.h"
#include "get_bits.h"
#include "bytestream.h"
+#include "videodsp.h"
+#include "vp3dsp.h"
#include "vp56dsp.h"
typedef struct vp56_context VP56Context;
-typedef struct {
- int16_t x;
+typedef struct VP56mv {
+ DECLARE_ALIGNED(4, int16_t, x);
int16_t y;
-} DECLARE_ALIGNED(4, , VP56mv);
+} VP56mv;
#define VP56_SIZE_CHANGE 1
@@ -53,7 +55,7 @@ typedef int (*VP56ParseCoeffModels)(VP56Context *s);
typedef int (*VP56ParseHeader)(VP56Context *s, const uint8_t *buf,
int buf_size, int *golden_frame);
-typedef struct {
+typedef struct VP56RangeCoder {
int high;
int bits; /* stored negated (i.e. negative "bits" is a positive number of
bits left) in order to eliminate a negate in cache refilling */
@@ -62,18 +64,18 @@ typedef struct {
unsigned int code_word;
} VP56RangeCoder;
-typedef struct {
+typedef struct VP56RefDc {
uint8_t not_null_dc;
VP56Frame ref_frame;
DCTELEM dc_coeff;
} VP56RefDc;
-typedef struct {
+typedef struct VP56Macroblock {
uint8_t type;
VP56mv mv;
} VP56Macroblock;
-typedef struct {
+typedef struct VP56Model {
uint8_t coeff_reorder[64]; /* used in vp6 only */
uint8_t coeff_index_to_pos[64]; /* used in vp6 only */
uint8_t vector_sig[2]; /* delta sign */
@@ -93,6 +95,8 @@ typedef struct {
struct vp56_context {
AVCodecContext *avctx;
DSPContext dsp;
+ VideoDSPContext vdsp;
+ VP3DSPContext vp3dsp;
VP56DSPContext vp56dsp;
ScanTable scantable;
AVFrame frames[4];
@@ -176,7 +180,7 @@ struct vp56_context {
void ff_vp56_init(AVCodecContext *avctx, int flip, int has_alpha);
int ff_vp56_free(AVCodecContext *avctx);
void ff_vp56_init_dequant(VP56Context *s, int quantizer);
-int ff_vp56_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
+int ff_vp56_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
AVPacket *avpkt);
diff --git a/gst-libs/ext/libav/libavcodec/vp56data.c b/gst-libs/ext/libav/libavcodec/vp56data.c
index aa1dcef..90e2f36 100644
--- a/gst-libs/ext/libav/libavcodec/vp56data.c
+++ b/gst-libs/ext/libav/libavcodec/vp56data.c
@@ -25,10 +25,10 @@
#include "vp56data.h"
-const uint8_t vp56_b2p[] = { 0, 0, 0, 0, 1, 2, 3, 3, 3, 3 };
-const uint8_t vp56_b6to4[] = { 0, 0, 1, 1, 2, 3 };
+const uint8_t ff_vp56_b2p[] = { 0, 0, 0, 0, 1, 2, 3, 3, 3, 3 };
+const uint8_t ff_vp56_b6to4[] = { 0, 0, 1, 1, 2, 3 };
-const uint8_t vp56_coeff_parse_table[6][11] = {
+const uint8_t ff_vp56_coeff_parse_table[6][11] = {
{ 159, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 145, 165, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 140, 148, 173, 0, 0, 0, 0, 0, 0, 0, 0 },
@@ -37,7 +37,7 @@ const uint8_t vp56_coeff_parse_table[6][11] = {
{ 129, 130, 133, 140, 153, 177, 196, 230, 243, 254, 254 },
};
-const uint8_t vp56_def_mb_types_stats[3][10][2] = {
+const uint8_t ff_vp56_def_mb_types_stats[3][10][2] = {
{ { 69, 42 }, { 1, 2 }, { 1, 7 }, { 44, 42 }, { 6, 22 },
{ 1, 3 }, { 0, 2 }, { 1, 5 }, { 0, 1 }, { 0, 0 }, },
{ { 229, 8 }, { 1, 1 }, { 0, 8 }, { 0, 0 }, { 0, 0 },
@@ -46,7 +46,7 @@ const uint8_t vp56_def_mb_types_stats[3][10][2] = {
{ 1, 2 }, { 0, 1 }, { 0, 1 }, { 1, 1 }, { 0, 0 }, },
};
-const VP56Tree vp56_pva_tree[] = {
+const VP56Tree ff_vp56_pva_tree[] = {
{ 8, 0},
{ 4, 1},
{ 2, 2}, {-0}, {-1},
@@ -56,7 +56,7 @@ const VP56Tree vp56_pva_tree[] = {
{ 2, 6}, {-6}, {-7},
};
-const VP56Tree vp56_pc_tree[] = {
+const VP56Tree ff_vp56_pc_tree[] = {
{ 4, 6},
{ 2, 7}, {-0}, {-1},
{ 4, 8},
@@ -64,5 +64,5 @@ const VP56Tree vp56_pc_tree[] = {
{ 2,10}, {-4}, {-5},
};
-const uint8_t vp56_coeff_bias[] = { 0, 1, 2, 3, 4, 5, 7, 11, 19, 35, 67 };
-const uint8_t vp56_coeff_bit_length[] = { 0, 1, 2, 3, 4, 10 };
+const uint8_t ff_vp56_coeff_bias[] = { 0, 1, 2, 3, 4, 5, 7, 11, 19, 35, 67 };
+const uint8_t ff_vp56_coeff_bit_length[] = { 0, 1, 2, 3, 4, 10 };
diff --git a/gst-libs/ext/libav/libavcodec/vp56data.h b/gst-libs/ext/libav/libavcodec/vp56data.h
index b1f2710..0535425 100644
--- a/gst-libs/ext/libav/libavcodec/vp56data.h
+++ b/gst-libs/ext/libav/libavcodec/vp56data.h
@@ -51,19 +51,19 @@ typedef enum {
VP56_MB_INTER_V2_GF = 9, /**< Inter MB, second vector, from golden frame */
} VP56mb;
-typedef struct {
+typedef struct VP56Tree {
int8_t val;
int8_t prob_idx;
} VP56Tree;
-extern const uint8_t vp56_b2p[];
-extern const uint8_t vp56_b6to4[];
-extern const uint8_t vp56_coeff_parse_table[6][11];
-extern const uint8_t vp56_def_mb_types_stats[3][10][2];
-extern const VP56Tree vp56_pva_tree[];
-extern const VP56Tree vp56_pc_tree[];
-extern const uint8_t vp56_coeff_bias[];
-extern const uint8_t vp56_coeff_bit_length[];
+extern const uint8_t ff_vp56_b2p[];
+extern const uint8_t ff_vp56_b6to4[];
+extern const uint8_t ff_vp56_coeff_parse_table[6][11];
+extern const uint8_t ff_vp56_def_mb_types_stats[3][10][2];
+extern const VP56Tree ff_vp56_pva_tree[];
+extern const VP56Tree ff_vp56_pc_tree[];
+extern const uint8_t ff_vp56_coeff_bias[];
+extern const uint8_t ff_vp56_coeff_bit_length[];
static const VP56Frame vp56_reference_frame[] = {
VP56_FRAME_PREVIOUS, /* VP56_MB_INTER_NOVEC_PF */
diff --git a/gst-libs/ext/libav/libavcodec/vp56dsp.c b/gst-libs/ext/libav/libavcodec/vp56dsp.c
index 7b4a771..5a36e52 100644
--- a/gst-libs/ext/libav/libavcodec/vp56dsp.c
+++ b/gst-libs/ext/libav/libavcodec/vp56dsp.c
@@ -22,6 +22,7 @@
#include <stdint.h>
#include "avcodec.h"
#include "vp56dsp.h"
+#include "libavutil/common.h"
/* Gives very similar result than the vp6 version except in a few cases */
static int vp5_adjust(int v, int t)
@@ -74,9 +75,9 @@ VP56_EDGE_FILTER(vp5, ver, stride, 1)
VP56_EDGE_FILTER(vp6, hor, 1, stride)
VP56_EDGE_FILTER(vp6, ver, stride, 1)
-void ff_vp56dsp_init(VP56DSPContext *s, enum CodecID codec)
+void ff_vp56dsp_init(VP56DSPContext *s, enum AVCodecID codec)
{
- if (codec == CODEC_ID_VP5) {
+ if (codec == AV_CODEC_ID_VP5) {
s->edge_filter_hor = vp5_edge_filter_hor;
s->edge_filter_ver = vp5_edge_filter_ver;
} else {
@@ -89,5 +90,5 @@ void ff_vp56dsp_init(VP56DSPContext *s, enum CodecID codec)
}
if (ARCH_ARM) ff_vp56dsp_init_arm(s, codec);
- if (HAVE_MMX) ff_vp56dsp_init_x86(s, codec);
+ if (ARCH_X86) ff_vp56dsp_init_x86(s, codec);
}
diff --git a/gst-libs/ext/libav/libavcodec/vp56dsp.h b/gst-libs/ext/libav/libavcodec/vp56dsp.h
index 3bd6d27..034e2e9 100644
--- a/gst-libs/ext/libav/libavcodec/vp56dsp.h
+++ b/gst-libs/ext/libav/libavcodec/vp56dsp.h
@@ -35,8 +35,8 @@ typedef struct VP56DSPContext {
void ff_vp6_filter_diag4_c(uint8_t *dst, uint8_t *src, int stride,
const int16_t *h_weights, const int16_t *v_weights);
-void ff_vp56dsp_init(VP56DSPContext *s, enum CodecID codec);
-void ff_vp56dsp_init_arm(VP56DSPContext *s, enum CodecID codec);
-void ff_vp56dsp_init_x86(VP56DSPContext* c, enum CodecID codec);
+void ff_vp56dsp_init(VP56DSPContext *s, enum AVCodecID codec);
+void ff_vp56dsp_init_arm(VP56DSPContext *s, enum AVCodecID codec);
+void ff_vp56dsp_init_x86(VP56DSPContext* c, enum AVCodecID codec);
#endif /* AVCODEC_VP56DSP_H */
diff --git a/gst-libs/ext/libav/libavcodec/vp6.c b/gst-libs/ext/libav/libavcodec/vp6.c
index faba49b..c433acb 100644
--- a/gst-libs/ext/libav/libavcodec/vp6.c
+++ b/gst-libs/ext/libav/libavcodec/vp6.c
@@ -182,7 +182,7 @@ static void vp6_default_models_init(VP56Context *s)
model->vector_sig[0] = 0x80;
model->vector_sig[1] = 0x80;
- memcpy(model->mb_types_stats, vp56_def_mb_types_stats, sizeof(model->mb_types_stats));
+ memcpy(model->mb_types_stats, ff_vp56_def_mb_types_stats, sizeof(model->mb_types_stats));
memcpy(model->vector_fdv, vp6_def_fdv_vector_model, sizeof(model->vector_fdv));
memcpy(model->vector_pdv, vp6_def_pdv_vector_model, sizeof(model->vector_pdv));
memcpy(model->coeff_runv, vp6_def_runv_coeff_model, sizeof(model->coeff_runv));
@@ -336,7 +336,7 @@ static void vp6_parse_vector_adjustment(VP56Context *s, VP56mv *vect)
else
delta |= 8;
} else {
- delta = vp56_rac_get_tree(c, vp56_pva_tree,
+ delta = vp56_rac_get_tree(c, ff_vp56_pva_tree,
model->vector_pdv[comp]);
}
@@ -404,7 +404,7 @@ static void vp6_parse_coeff_huffman(VP56Context *s)
s->nb_null[1][pt] = vp6_get_nb_null(s);
break;
} else {
- int coeff2 = vp56_coeff_bias[coeff];
+ int coeff2 = ff_vp56_coeff_bias[coeff];
if (coeff > 4)
coeff2 += get_bits(&s->gb, coeff <= 9 ? coeff - 4 : 11);
ct = 1 + (coeff2 > 1);
@@ -441,7 +441,7 @@ static void vp6_parse_coeff(VP56Context *s)
if (b > 3) pt = 1;
- ctx = s->left_block[vp56_b6to4[b]].not_null_dc
+ ctx = s->left_block[ff_vp56_b6to4[b]].not_null_dc
+ s->above_blocks[s->above_block_idx[b]].not_null_dc;
model1 = model->coeff_dccv[pt];
model2 = model->coeff_dcct[pt][ctx];
@@ -452,10 +452,10 @@ static void vp6_parse_coeff(VP56Context *s)
/* parse a coeff */
if (vp56_rac_get_prob(c, model2[2])) {
if (vp56_rac_get_prob(c, model2[3])) {
- idx = vp56_rac_get_tree(c, vp56_pc_tree, model1);
- coeff = vp56_coeff_bias[idx+5];
- for (i=vp56_coeff_bit_length[idx]; i>=0; i--)
- coeff += vp56_rac_get_prob(c, vp56_coeff_parse_table[idx][i]) << i;
+ idx = vp56_rac_get_tree(c, ff_vp56_pc_tree, model1);
+ coeff = ff_vp56_coeff_bias[idx+5];
+ for (i=ff_vp56_coeff_bit_length[idx]; i>=0; i--)
+ coeff += vp56_rac_get_prob(c, ff_vp56_coeff_parse_table[idx][i]) << i;
} else {
if (vp56_rac_get_prob(c, model2[4]))
coeff = 3 + vp56_rac_get_prob(c, model1[5]);
@@ -495,7 +495,7 @@ static void vp6_parse_coeff(VP56Context *s)
model1 = model2 = model->coeff_ract[pt][ct][cg];
}
- s->left_block[vp56_b6to4[b]].not_null_dc =
+ s->left_block[ff_vp56_b6to4[b]].not_null_dc =
s->above_blocks[s->above_block_idx[b]].not_null_dc = !!s->block_coeff[b][0];
}
}
@@ -594,8 +594,8 @@ static av_cold int vp6_decode_init(AVCodecContext *avctx)
{
VP56Context *s = avctx->priv_data;
- ff_vp56_init(avctx, avctx->codec->id == CODEC_ID_VP6,
- avctx->codec->id == CODEC_ID_VP6A);
+ ff_vp56_init(avctx, avctx->codec->id == AV_CODEC_ID_VP6,
+ avctx->codec->id == AV_CODEC_ID_VP6A);
s->vp56_coord_div = vp6_coord_div;
s->parse_vector_adjustment = vp6_parse_vector_adjustment;
s->filter = vp6_filter;
@@ -627,37 +627,37 @@ static av_cold int vp6_decode_free(AVCodecContext *avctx)
AVCodec ff_vp6_decoder = {
.name = "vp6",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_VP6,
+ .id = AV_CODEC_ID_VP6,
.priv_data_size = sizeof(VP56Context),
.init = vp6_decode_init,
.close = vp6_decode_free,
.decode = ff_vp56_decode_frame,
.capabilities = CODEC_CAP_DR1,
- .long_name = NULL_IF_CONFIG_SMALL("On2 VP6"),
+ .long_name = NULL_IF_CONFIG_SMALL("On2 VP6"),
};
/* flash version, not flipped upside-down */
AVCodec ff_vp6f_decoder = {
.name = "vp6f",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_VP6F,
+ .id = AV_CODEC_ID_VP6F,
.priv_data_size = sizeof(VP56Context),
.init = vp6_decode_init,
.close = vp6_decode_free,
.decode = ff_vp56_decode_frame,
.capabilities = CODEC_CAP_DR1,
- .long_name = NULL_IF_CONFIG_SMALL("On2 VP6 (Flash version)"),
+ .long_name = NULL_IF_CONFIG_SMALL("On2 VP6 (Flash version)"),
};
/* flash version, not flipped upside-down, with alpha channel */
AVCodec ff_vp6a_decoder = {
.name = "vp6a",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_VP6A,
+ .id = AV_CODEC_ID_VP6A,
.priv_data_size = sizeof(VP56Context),
.init = vp6_decode_init,
.close = vp6_decode_free,
.decode = ff_vp56_decode_frame,
.capabilities = CODEC_CAP_DR1,
- .long_name = NULL_IF_CONFIG_SMALL("On2 VP6 (Flash version, with alpha channel)"),
+ .long_name = NULL_IF_CONFIG_SMALL("On2 VP6 (Flash version, with alpha channel)"),
};
diff --git a/gst-libs/ext/libav/libavcodec/vp8.c b/gst-libs/ext/libav/libavcodec/vp8.c
index a16f5ca..deb5015 100644
--- a/gst-libs/ext/libav/libavcodec/vp8.c
+++ b/gst-libs/ext/libav/libavcodec/vp8.c
@@ -1,9 +1,10 @@
-/**
+/*
* VP8 compatible video decoder
*
* Copyright (C) 2010 David Conrad
* Copyright (C) 2010 Ronald S. Bultje
* Copyright (C) 2010 Jason Garrett-Glaser
+ * Copyright (C) 2012 Daniel Kang
*
* This file is part of Libav.
*
@@ -36,11 +37,20 @@
static void free_buffers(VP8Context *s)
{
+ int i;
+ if (s->thread_data)
+ for (i = 0; i < MAX_THREADS; i++) {
+#if HAVE_THREADS
+ pthread_cond_destroy(&s->thread_data[i].cond);
+ pthread_mutex_destroy(&s->thread_data[i].lock);
+#endif
+ av_freep(&s->thread_data[i].filter_strength);
+ av_freep(&s->thread_data[i].edge_emu_buffer);
+ }
+ av_freep(&s->thread_data);
av_freep(&s->macroblocks_base);
- av_freep(&s->filter_strength);
av_freep(&s->intra4x4_pred_mode_top);
av_freep(&s->top_nnz);
- av_freep(&s->edge_emu_buffer);
av_freep(&s->top_border);
s->macroblocks = NULL;
@@ -108,6 +118,9 @@ static void vp8_decode_flush(AVCodecContext *avctx)
static int update_dimensions(VP8Context *s, int width, int height)
{
+ AVCodecContext *avctx = s->avctx;
+ int i;
+
if (width != s->avctx->width ||
height != s->avctx->height) {
if (av_image_check_size(width, height, 0, s->avctx))
@@ -121,14 +134,27 @@ static int update_dimensions(VP8Context *s, int width, int height)
s->mb_width = (s->avctx->coded_width +15) / 16;
s->mb_height = (s->avctx->coded_height+15) / 16;
- s->macroblocks_base = av_mallocz((s->mb_width+s->mb_height*2+1)*sizeof(*s->macroblocks));
- s->filter_strength = av_mallocz(s->mb_width*sizeof(*s->filter_strength));
- s->intra4x4_pred_mode_top = av_mallocz(s->mb_width*4);
- s->top_nnz = av_mallocz(s->mb_width*sizeof(*s->top_nnz));
- s->top_border = av_mallocz((s->mb_width+1)*sizeof(*s->top_border));
+ s->mb_layout = (avctx->active_thread_type == FF_THREAD_SLICE) && (FFMIN(s->num_coeff_partitions, avctx->thread_count) > 1);
+ if (!s->mb_layout) { // Frame threading and one thread
+ s->macroblocks_base = av_mallocz((s->mb_width+s->mb_height*2+1)*sizeof(*s->macroblocks));
+ s->intra4x4_pred_mode_top = av_mallocz(s->mb_width*4);
+ }
+ else // Sliced threading
+ s->macroblocks_base = av_mallocz((s->mb_width+2)*(s->mb_height+2)*sizeof(*s->macroblocks));
+ s->top_nnz = av_mallocz(s->mb_width*sizeof(*s->top_nnz));
+ s->top_border = av_mallocz((s->mb_width+1)*sizeof(*s->top_border));
+ s->thread_data = av_mallocz(MAX_THREADS*sizeof(VP8ThreadData));
+
+ for (i = 0; i < MAX_THREADS; i++) {
+ s->thread_data[i].filter_strength = av_mallocz(s->mb_width*sizeof(*s->thread_data[0].filter_strength));
+#if HAVE_THREADS
+ pthread_mutex_init(&s->thread_data[i].lock, NULL);
+ pthread_cond_init(&s->thread_data[i].cond, NULL);
+#endif
+ }
- if (!s->macroblocks_base || !s->filter_strength || !s->intra4x4_pred_mode_top ||
- !s->top_nnz || !s->top_border)
+ if (!s->macroblocks_base || !s->top_nnz || !s->top_border ||
+ (!s->intra4x4_pred_mode_top && !s->mb_layout))
return AVERROR(ENOMEM);
s->macroblocks = s->macroblocks_base + 1;
@@ -162,11 +188,23 @@ static void update_lf_deltas(VP8Context *s)
VP56RangeCoder *c = &s->c;
int i;
- for (i = 0; i < 4; i++)
- s->lf_delta.ref[i] = vp8_rac_get_sint(c, 6);
+ for (i = 0; i < 4; i++) {
+ if (vp8_rac_get(c)) {
+ s->lf_delta.ref[i] = vp8_rac_get_uint(c, 6);
+
+ if (vp8_rac_get(c))
+ s->lf_delta.ref[i] = -s->lf_delta.ref[i];
+ }
+ }
- for (i = MODE_I4x4; i <= VP8_MVMODE_SPLIT; i++)
- s->lf_delta.mode[i] = vp8_rac_get_sint(c, 6);
+ for (i = MODE_I4x4; i <= VP8_MVMODE_SPLIT; i++) {
+ if (vp8_rac_get(c)) {
+ s->lf_delta.mode[i] = vp8_rac_get_uint(c, 6);
+
+ if (vp8_rac_get(c))
+ s->lf_delta.mode[i] = -s->lf_delta.mode[i];
+ }
+ }
}
static int setup_partitions(VP8Context *s, const uint8_t *buf, int buf_size)
@@ -215,12 +253,13 @@ static void get_quants(VP8Context *s)
} else
base_qi = yac_qi;
- s->qmat[i].luma_qmul[0] = vp8_dc_qlookup[av_clip_uintp2(base_qi + ydc_delta , 7)];
- s->qmat[i].luma_qmul[1] = vp8_ac_qlookup[av_clip_uintp2(base_qi , 7)];
- s->qmat[i].luma_dc_qmul[0] = 2 * vp8_dc_qlookup[av_clip_uintp2(base_qi + y2dc_delta, 7)];
- s->qmat[i].luma_dc_qmul[1] = 155 * vp8_ac_qlookup[av_clip_uintp2(base_qi + y2ac_delta, 7)] / 100;
- s->qmat[i].chroma_qmul[0] = vp8_dc_qlookup[av_clip_uintp2(base_qi + uvdc_delta, 7)];
- s->qmat[i].chroma_qmul[1] = vp8_ac_qlookup[av_clip_uintp2(base_qi + uvac_delta, 7)];
+ s->qmat[i].luma_qmul[0] = vp8_dc_qlookup[av_clip_uintp2(base_qi + ydc_delta , 7)];
+ s->qmat[i].luma_qmul[1] = vp8_ac_qlookup[av_clip_uintp2(base_qi , 7)];
+ s->qmat[i].luma_dc_qmul[0] = 2 * vp8_dc_qlookup[av_clip_uintp2(base_qi + y2dc_delta, 7)];
+ /* 101581>>16 is equivalent to 155/100 */
+ s->qmat[i].luma_dc_qmul[1] = (101581 * vp8_ac_qlookup[av_clip_uintp2(base_qi + y2ac_delta, 7)]) >> 16;
+ s->qmat[i].chroma_qmul[0] = vp8_dc_qlookup[av_clip_uintp2(base_qi + uvdc_delta, 7)];
+ s->qmat[i].chroma_qmul[1] = vp8_ac_qlookup[av_clip_uintp2(base_qi + uvac_delta, 7)];
s->qmat[i].luma_dc_qmul[1] = FFMAX(s->qmat[i].luma_dc_qmul[1], 8);
s->qmat[i].chroma_qmul[0] = FFMIN(s->qmat[i].chroma_qmul[0], 132);
@@ -321,12 +360,6 @@ static int decode_frame_header(VP8Context *s, const uint8_t *buf, int buf_size)
memset(&s->lf_delta, 0, sizeof(s->lf_delta));
}
- if (!s->macroblocks_base || /* first frame */
- width != s->avctx->width || height != s->avctx->height) {
- if ((ret = update_dimensions(s, width, height)) < 0)
- return ret;
- }
-
ff_vp56_init_range_decoder(c, buf, header_size);
buf += header_size;
buf_size -= header_size;
@@ -355,6 +388,12 @@ static int decode_frame_header(VP8Context *s, const uint8_t *buf, int buf_size)
return AVERROR_INVALIDDATA;
}
+ if (!s->macroblocks_base || /* first frame */
+ width != s->avctx->width || height != s->avctx->height) {
+ if ((ret = update_dimensions(s, width, height)) < 0)
+ return ret;
+ }
+
get_quants(s);
if (!s->keyframe) {
@@ -457,19 +496,26 @@ const uint8_t *get_submv_prob(uint32_t left, uint32_t top)
* @returns the number of motion vectors parsed (2, 4 or 16)
*/
static av_always_inline
-int decode_splitmvs(VP8Context *s, VP56RangeCoder *c, VP8Macroblock *mb)
+int decode_splitmvs(VP8Context *s, VP56RangeCoder *c, VP8Macroblock *mb, int layout)
{
int part_idx;
int n, num;
- VP8Macroblock *top_mb = &mb[2];
+ VP8Macroblock *top_mb;
VP8Macroblock *left_mb = &mb[-1];
const uint8_t *mbsplits_left = vp8_mbsplits[left_mb->partitioning],
- *mbsplits_top = vp8_mbsplits[top_mb->partitioning],
+ *mbsplits_top,
*mbsplits_cur, *firstidx;
- VP56mv *top_mv = top_mb->bmv;
+ VP56mv *top_mv;
VP56mv *left_mv = left_mb->bmv;
VP56mv *cur_mv = mb->bmv;
+ if (!layout) // layout is inlined, s->mb_layout is not
+ top_mb = &mb[2];
+ else
+ top_mb = &mb[-s->mb_width-1];
+ mbsplits_top = vp8_mbsplits[top_mb->partitioning];
+ top_mv = top_mb->bmv;
+
if (vp56_rac_get_prob_branchy(c, vp8_mbsplit_prob[0])) {
if (vp56_rac_get_prob_branchy(c, vp8_mbsplit_prob[1])) {
part_idx = VP8_SPLITMVMODE_16x8 + vp56_rac_get_prob(c, vp8_mbsplit_prob[2]);
@@ -521,11 +567,11 @@ int decode_splitmvs(VP8Context *s, VP56RangeCoder *c, VP8Macroblock *mb)
}
static av_always_inline
-void decode_mvs(VP8Context *s, VP8Macroblock *mb, int mb_x, int mb_y)
+void decode_mvs(VP8Context *s, VP8Macroblock *mb, int mb_x, int mb_y, int layout)
{
- VP8Macroblock *mb_edge[3] = { mb + 2 /* top */,
+ VP8Macroblock *mb_edge[3] = { 0 /* top */,
mb - 1 /* left */,
- mb + 1 /* top-left */ };
+ 0 /* top-left */ };
enum { CNT_ZERO, CNT_NEAREST, CNT_NEAR, CNT_SPLITMV };
enum { VP8_EDGE_TOP, VP8_EDGE_LEFT, VP8_EDGE_TOPLEFT };
int idx = CNT_ZERO;
@@ -535,6 +581,15 @@ void decode_mvs(VP8Context *s, VP8Macroblock *mb, int mb_x, int mb_y)
uint8_t cnt[4] = { 0 };
VP56RangeCoder *c = &s->c;
+ if (!layout) { // layout is inlined (s->mb_layout is not)
+ mb_edge[0] = mb + 2;
+ mb_edge[2] = mb + 1;
+ }
+ else {
+ mb_edge[0] = mb - s->mb_width-1;
+ mb_edge[2] = mb - s->mb_width-2;
+ }
+
AV_ZERO32(&near_mv[0]);
AV_ZERO32(&near_mv[1]);
AV_ZERO32(&near_mv[2]);
@@ -589,7 +644,7 @@ void decode_mvs(VP8Context *s, VP8Macroblock *mb, int mb_x, int mb_y)
if (vp56_rac_get_prob_branchy(c, vp8_mode_contexts[cnt[CNT_SPLITMV]][3])) {
mb->mode = VP8_MVMODE_SPLIT;
- mb->mv = mb->bmv[decode_splitmvs(s, c, mb) - 1];
+ mb->mv = mb->bmv[decode_splitmvs(s, c, mb, layout) - 1];
} else {
mb->mv.y += read_mv_component(c, s->prob->mvc[0]);
mb->mv.x += read_mv_component(c, s->prob->mvc[1]);
@@ -611,14 +666,23 @@ void decode_mvs(VP8Context *s, VP8Macroblock *mb, int mb_x, int mb_y)
}
static av_always_inline
-void decode_intra4x4_modes(VP8Context *s, VP56RangeCoder *c,
- int mb_x, int keyframe)
+void decode_intra4x4_modes(VP8Context *s, VP56RangeCoder *c, VP8Macroblock *mb,
+ int mb_x, int keyframe, int layout)
{
- uint8_t *intra4x4 = s->intra4x4_pred_mode_mb;
+ uint8_t *intra4x4 = mb->intra4x4_pred_mode_mb;
+
+ if (layout == 1) {
+ VP8Macroblock *mb_top = mb - s->mb_width - 1;
+ memcpy(mb->intra4x4_pred_mode_top, mb_top->intra4x4_pred_mode_top, 4);
+ }
if (keyframe) {
int x, y;
- uint8_t* const top = s->intra4x4_pred_mode_top + 4 * mb_x;
+ uint8_t* top;
uint8_t* const left = s->intra4x4_pred_mode_left;
+ if (layout == 1)
+ top = mb->intra4x4_pred_mode_top;
+ else
+ top = s->intra4x4_pred_mode_top + 4 * mb_x;
for (y = 0; y < 4; y++) {
for (x = 0; x < 4; x++) {
const uint8_t *ctx;
@@ -636,15 +700,16 @@ void decode_intra4x4_modes(VP8Context *s, VP56RangeCoder *c,
}
static av_always_inline
-void decode_mb_mode(VP8Context *s, VP8Macroblock *mb, int mb_x, int mb_y, uint8_t *segment, uint8_t *ref)
+void decode_mb_mode(VP8Context *s, VP8Macroblock *mb, int mb_x, int mb_y,
+ uint8_t *segment, uint8_t *ref, int layout)
{
VP56RangeCoder *c = &s->c;
if (s->segmentation.update_map)
*segment = vp8_rac_get_tree(c, vp8_segmentid_tree, s->prob->segmentid);
- else
+ else if (s->segmentation.enabled)
*segment = ref ? *ref : *segment;
- s->segment = *segment;
+ mb->segment = *segment;
mb->skip = s->mbskip_enabled ? vp56_rac_get_prob(c, s->prob->mbskip) : 0;
@@ -652,14 +717,17 @@ void decode_mb_mode(VP8Context *s, VP8Macroblock *mb, int mb_x, int mb_y, uint8_
mb->mode = vp8_rac_get_tree(c, vp8_pred16x16_tree_intra, vp8_pred16x16_prob_intra);
if (mb->mode == MODE_I4x4) {
- decode_intra4x4_modes(s, c, mb_x, 1);
+ decode_intra4x4_modes(s, c, mb, mb_x, 1, layout);
} else {
const uint32_t modes = vp8_pred4x4_mode[mb->mode] * 0x01010101u;
- AV_WN32A(s->intra4x4_pred_mode_top + 4 * mb_x, modes);
- AV_WN32A(s->intra4x4_pred_mode_left, modes);
+ if (s->mb_layout == 1)
+ AV_WN32A(mb->intra4x4_pred_mode_top, modes);
+ else
+ AV_WN32A(s->intra4x4_pred_mode_top + 4 * mb_x, modes);
+ AV_WN32A( s->intra4x4_pred_mode_left, modes);
}
- s->chroma_pred_mode = vp8_rac_get_tree(c, vp8_pred8x8c_tree, vp8_pred8x8c_prob_intra);
+ mb->chroma_pred_mode = vp8_rac_get_tree(c, vp8_pred8x8c_tree, vp8_pred8x8c_prob_intra);
mb->ref_frame = VP56_FRAME_CURRENT;
} else if (vp56_rac_get_prob_branchy(c, s->prob->intra)) {
// inter MB, 16.2
@@ -671,15 +739,15 @@ void decode_mb_mode(VP8Context *s, VP8Macroblock *mb, int mb_x, int mb_y, uint8_
s->ref_count[mb->ref_frame-1]++;
// motion vectors, 16.3
- decode_mvs(s, mb, mb_x, mb_y);
+ decode_mvs(s, mb, mb_x, mb_y, layout);
} else {
// intra MB, 16.1
mb->mode = vp8_rac_get_tree(c, vp8_pred16x16_tree_inter, s->prob->pred16x16);
if (mb->mode == MODE_I4x4)
- decode_intra4x4_modes(s, c, mb_x, 0);
+ decode_intra4x4_modes(s, c, mb, mb_x, 0, layout);
- s->chroma_pred_mode = vp8_rac_get_tree(c, vp8_pred8x8c_tree, s->prob->pred8x8c);
+ mb->chroma_pred_mode = vp8_rac_get_tree(c, vp8_pred8x8c_tree, s->prob->pred8x8c);
mb->ref_frame = VP56_FRAME_CURRENT;
mb->partitioning = VP8_SPLITMVMODE_NONE;
AV_ZERO32(&mb->bmv[0]);
@@ -688,7 +756,7 @@ void decode_mb_mode(VP8Context *s, VP8Macroblock *mb, int mb_x, int mb_y, uint8_
#ifndef decode_block_coeffs_internal
/**
- * @param c arithmetic bitstream reader context
+ * @param r arithmetic bitstream reader context
* @param block destination for block coefficients
* @param probs probabilities to use when reading trees from the bitstream
* @param i initial coeff index, 0 unless a separate DC block is coded
@@ -696,56 +764,58 @@ void decode_mb_mode(VP8Context *s, VP8Macroblock *mb, int mb_x, int mb_y, uint8_
* @return 0 if no coeffs were decoded
* otherwise, the index of the last coeff decoded plus one
*/
-static int decode_block_coeffs_internal(VP56RangeCoder *c, DCTELEM block[16],
+static int decode_block_coeffs_internal(VP56RangeCoder *r, DCTELEM block[16],
uint8_t probs[16][3][NUM_DCT_TOKENS-1],
int i, uint8_t *token_prob, int16_t qmul[2])
{
+ VP56RangeCoder c = *r;
goto skip_eob;
do {
int coeff;
- if (!vp56_rac_get_prob_branchy(c, token_prob[0])) // DCT_EOB
- return i;
+ if (!vp56_rac_get_prob_branchy(&c, token_prob[0])) // DCT_EOB
+ break;
skip_eob:
- if (!vp56_rac_get_prob_branchy(c, token_prob[1])) { // DCT_0
+ if (!vp56_rac_get_prob_branchy(&c, token_prob[1])) { // DCT_0
if (++i == 16)
- return i; // invalid input; blocks should end with EOB
+ break; // invalid input; blocks should end with EOB
token_prob = probs[i][0];
goto skip_eob;
}
- if (!vp56_rac_get_prob_branchy(c, token_prob[2])) { // DCT_1
+ if (!vp56_rac_get_prob_branchy(&c, token_prob[2])) { // DCT_1
coeff = 1;
token_prob = probs[i+1][1];
} else {
- if (!vp56_rac_get_prob_branchy(c, token_prob[3])) { // DCT 2,3,4
- coeff = vp56_rac_get_prob_branchy(c, token_prob[4]);
+ if (!vp56_rac_get_prob_branchy(&c, token_prob[3])) { // DCT 2,3,4
+ coeff = vp56_rac_get_prob_branchy(&c, token_prob[4]);
if (coeff)
- coeff += vp56_rac_get_prob(c, token_prob[5]);
+ coeff += vp56_rac_get_prob(&c, token_prob[5]);
coeff += 2;
} else {
// DCT_CAT*
- if (!vp56_rac_get_prob_branchy(c, token_prob[6])) {
- if (!vp56_rac_get_prob_branchy(c, token_prob[7])) { // DCT_CAT1
- coeff = 5 + vp56_rac_get_prob(c, vp8_dct_cat1_prob[0]);
+ if (!vp56_rac_get_prob_branchy(&c, token_prob[6])) {
+ if (!vp56_rac_get_prob_branchy(&c, token_prob[7])) { // DCT_CAT1
+ coeff = 5 + vp56_rac_get_prob(&c, vp8_dct_cat1_prob[0]);
} else { // DCT_CAT2
coeff = 7;
- coeff += vp56_rac_get_prob(c, vp8_dct_cat2_prob[0]) << 1;
- coeff += vp56_rac_get_prob(c, vp8_dct_cat2_prob[1]);
+ coeff += vp56_rac_get_prob(&c, vp8_dct_cat2_prob[0]) << 1;
+ coeff += vp56_rac_get_prob(&c, vp8_dct_cat2_prob[1]);
}
} else { // DCT_CAT3 and up
- int a = vp56_rac_get_prob(c, token_prob[8]);
- int b = vp56_rac_get_prob(c, token_prob[9+a]);
+ int a = vp56_rac_get_prob(&c, token_prob[8]);
+ int b = vp56_rac_get_prob(&c, token_prob[9+a]);
int cat = (a<<1) + b;
coeff = 3 + (8<<cat);
- coeff += vp8_rac_get_coeff(c, ff_vp8_dct_cat_prob[cat]);
+ coeff += vp8_rac_get_coeff(&c, ff_vp8_dct_cat_prob[cat]);
}
}
token_prob = probs[i+1][2];
}
- block[zigzag_scan[i]] = (vp8_rac_get(c) ? -coeff : coeff) * qmul[!!i];
+ block[zigzag_scan[i]] = (vp8_rac_get(&c) ? -coeff : coeff) * qmul[!!i];
} while (++i < 16);
+ *r = c;
return i;
}
#endif
@@ -773,28 +843,28 @@ int decode_block_coeffs(VP56RangeCoder *c, DCTELEM block[16],
}
static av_always_inline
-void decode_mb_coeffs(VP8Context *s, VP56RangeCoder *c, VP8Macroblock *mb,
+void decode_mb_coeffs(VP8Context *s, VP8ThreadData *td, VP56RangeCoder *c, VP8Macroblock *mb,
uint8_t t_nnz[9], uint8_t l_nnz[9])
{
int i, x, y, luma_start = 0, luma_ctx = 3;
int nnz_pred, nnz, nnz_total = 0;
- int segment = s->segment;
+ int segment = mb->segment;
int block_dc = 0;
if (mb->mode != MODE_I4x4 && mb->mode != VP8_MVMODE_SPLIT) {
nnz_pred = t_nnz[8] + l_nnz[8];
// decode DC values and do hadamard
- nnz = decode_block_coeffs(c, s->block_dc, s->prob->token[1], 0, nnz_pred,
+ nnz = decode_block_coeffs(c, td->block_dc, s->prob->token[1], 0, nnz_pred,
s->qmat[segment].luma_dc_qmul);
l_nnz[8] = t_nnz[8] = !!nnz;
if (nnz) {
nnz_total += nnz;
block_dc = 1;
if (nnz == 1)
- s->vp8dsp.vp8_luma_dc_wht_dc(s->block, s->block_dc);
+ s->vp8dsp.vp8_luma_dc_wht_dc(td->block, td->block_dc);
else
- s->vp8dsp.vp8_luma_dc_wht(s->block, s->block_dc);
+ s->vp8dsp.vp8_luma_dc_wht(td->block, td->block_dc);
}
luma_start = 1;
luma_ctx = 0;
@@ -804,10 +874,10 @@ void decode_mb_coeffs(VP8Context *s, VP56RangeCoder *c, VP8Macroblock *mb,
for (y = 0; y < 4; y++)
for (x = 0; x < 4; x++) {
nnz_pred = l_nnz[y] + t_nnz[x];
- nnz = decode_block_coeffs(c, s->block[y][x], s->prob->token[luma_ctx], luma_start,
+ nnz = decode_block_coeffs(c, td->block[y][x], s->prob->token[luma_ctx], luma_start,
nnz_pred, s->qmat[segment].luma_qmul);
// nnz+block_dc may be one more than the actual last index, but we don't care
- s->non_zero_count_cache[y][x] = nnz + block_dc;
+ td->non_zero_count_cache[y][x] = nnz + block_dc;
t_nnz[x] = l_nnz[y] = !!nnz;
nnz_total += nnz;
}
@@ -819,9 +889,9 @@ void decode_mb_coeffs(VP8Context *s, VP56RangeCoder *c, VP8Macroblock *mb,
for (y = 0; y < 2; y++)
for (x = 0; x < 2; x++) {
nnz_pred = l_nnz[i+2*y] + t_nnz[i+2*x];
- nnz = decode_block_coeffs(c, s->block[i][(y<<1)+x], s->prob->token[2], 0,
+ nnz = decode_block_coeffs(c, td->block[i][(y<<1)+x], s->prob->token[2], 0,
nnz_pred, s->qmat[segment].chroma_qmul);
- s->non_zero_count_cache[i][(y<<1)+x] = nnz;
+ td->non_zero_count_cache[i][(y<<1)+x] = nnz;
t_nnz[i+2*x] = l_nnz[i+2*y] = !!nnz;
nnz_total += nnz;
}
@@ -966,8 +1036,8 @@ int check_intra_pred4x4_mode_emuedge(int mode, int mb_x, int mb_y, int *copy_buf
}
static av_always_inline
-void intra_predict(VP8Context *s, uint8_t *dst[3], VP8Macroblock *mb,
- int mb_x, int mb_y)
+void intra_predict(VP8Context *s, VP8ThreadData *td, uint8_t *dst[3],
+ VP8Macroblock *mb, int mb_x, int mb_y)
{
AVCodecContext *avctx = s->avctx;
int x, y, mode, nnz;
@@ -975,7 +1045,7 @@ void intra_predict(VP8Context *s, uint8_t *dst[3], VP8Macroblock *mb,
// for the first row, we need to run xchg_mb_border to init the top edge to 127
// otherwise, skip it if we aren't going to deblock
- if (!(avctx->flags & CODEC_FLAG_EMU_EDGE && !mb_y) && (s->deblock_filter || !mb_y))
+ if (!(avctx->flags & CODEC_FLAG_EMU_EDGE && !mb_y) && (s->deblock_filter || !mb_y) && td->thread_nr == 0)
xchg_mb_border(s->top_border[mb_x+1], dst[0], dst[1], dst[2],
s->linesize, s->uvlinesize, mb_x, mb_y, s->mb_width,
s->filter.simple, 1);
@@ -989,7 +1059,7 @@ void intra_predict(VP8Context *s, uint8_t *dst[3], VP8Macroblock *mb,
s->hpc.pred16x16[mode](dst[0], s->linesize);
} else {
uint8_t *ptr = dst[0];
- uint8_t *intra4x4 = s->intra4x4_pred_mode_mb;
+ uint8_t *intra4x4 = mb->intra4x4_pred_mode_mb;
uint8_t tr_top[4] = { 127, 127, 127, 127 };
// all blocks on the right edge of the macroblock use bottom edge
@@ -1005,7 +1075,7 @@ void intra_predict(VP8Context *s, uint8_t *dst[3], VP8Macroblock *mb,
}
if (mb->skip)
- AV_ZERO128(s->non_zero_count_cache);
+ AV_ZERO128(td->non_zero_count_cache);
for (y = 0; y < 4; y++) {
uint8_t *topright = ptr + 4 - s->linesize;
@@ -1058,12 +1128,12 @@ void intra_predict(VP8Context *s, uint8_t *dst[3], VP8Macroblock *mb,
AV_COPY32(ptr+4*x+s->linesize*3, copy_dst+36);
}
- nnz = s->non_zero_count_cache[y][x];
+ nnz = td->non_zero_count_cache[y][x];
if (nnz) {
if (nnz == 1)
- s->vp8dsp.vp8_idct_dc_add(ptr+4*x, s->block[y][x], s->linesize);
+ s->vp8dsp.vp8_idct_dc_add(ptr+4*x, td->block[y][x], s->linesize);
else
- s->vp8dsp.vp8_idct_add(ptr+4*x, s->block[y][x], s->linesize);
+ s->vp8dsp.vp8_idct_add(ptr+4*x, td->block[y][x], s->linesize);
}
topright += 4;
}
@@ -1074,14 +1144,14 @@ void intra_predict(VP8Context *s, uint8_t *dst[3], VP8Macroblock *mb,
}
if (avctx->flags & CODEC_FLAG_EMU_EDGE) {
- mode = check_intra_pred8x8_mode_emuedge(s->chroma_pred_mode, mb_x, mb_y);
+ mode = check_intra_pred8x8_mode_emuedge(mb->chroma_pred_mode, mb_x, mb_y);
} else {
- mode = check_intra_pred8x8_mode(s->chroma_pred_mode, mb_x, mb_y);
+ mode = check_intra_pred8x8_mode(mb->chroma_pred_mode, mb_x, mb_y);
}
s->hpc.pred8x8[mode](dst[1], s->uvlinesize);
s->hpc.pred8x8[mode](dst[2], s->uvlinesize);
- if (!(avctx->flags & CODEC_FLAG_EMU_EDGE && !mb_y) && (s->deblock_filter || !mb_y))
+ if (!(avctx->flags & CODEC_FLAG_EMU_EDGE && !mb_y) && (s->deblock_filter || !mb_y) && td->thread_nr == 0)
xchg_mb_border(s->top_border[mb_x+1], dst[0], dst[1], dst[2],
s->linesize, s->uvlinesize, mb_x, mb_y, s->mb_width,
s->filter.simple, 0);
@@ -1111,7 +1181,8 @@ static const uint8_t subpel_idx[3][8] = {
* @param mc_func motion compensation function pointers (bilinear or sixtap MC)
*/
static av_always_inline
-void vp8_mc_luma(VP8Context *s, uint8_t *dst, AVFrame *ref, const VP56mv *mv,
+void vp8_mc_luma(VP8Context *s, VP8ThreadData *td, uint8_t *dst,
+ AVFrame *ref, const VP56mv *mv,
int x_off, int y_off, int block_w, int block_h,
int width, int height, int linesize,
vp8_mc_func mc_func[3][3])
@@ -1131,10 +1202,10 @@ void vp8_mc_luma(VP8Context *s, uint8_t *dst, AVFrame *ref, const VP56mv *mv,
src += y_off * linesize + x_off;
if (x_off < mx_idx || x_off >= width - block_w - subpel_idx[2][mx] ||
y_off < my_idx || y_off >= height - block_h - subpel_idx[2][my]) {
- s->dsp.emulated_edge_mc(s->edge_emu_buffer, src - my_idx * linesize - mx_idx, linesize,
- block_w + subpel_idx[1][mx], block_h + subpel_idx[1][my],
- x_off - mx_idx, y_off - my_idx, width, height);
- src = s->edge_emu_buffer + mx_idx + linesize * my_idx;
+ s->vdsp.emulated_edge_mc(td->edge_emu_buffer, src - my_idx * linesize - mx_idx, linesize,
+ block_w + subpel_idx[1][mx], block_h + subpel_idx[1][my],
+ x_off - mx_idx, y_off - my_idx, width, height);
+ src = td->edge_emu_buffer + mx_idx + linesize * my_idx;
}
mc_func[my_idx][mx_idx](dst, linesize, src, linesize, block_h, mx, my);
} else {
@@ -1161,8 +1232,8 @@ void vp8_mc_luma(VP8Context *s, uint8_t *dst, AVFrame *ref, const VP56mv *mv,
* @param mc_func motion compensation function pointers (bilinear or sixtap MC)
*/
static av_always_inline
-void vp8_mc_chroma(VP8Context *s, uint8_t *dst1, uint8_t *dst2, AVFrame *ref,
- const VP56mv *mv, int x_off, int y_off,
+void vp8_mc_chroma(VP8Context *s, VP8ThreadData *td, uint8_t *dst1, uint8_t *dst2,
+ AVFrame *ref, const VP56mv *mv, int x_off, int y_off,
int block_w, int block_h, int width, int height, int linesize,
vp8_mc_func mc_func[3][3])
{
@@ -1181,16 +1252,16 @@ void vp8_mc_chroma(VP8Context *s, uint8_t *dst1, uint8_t *dst2, AVFrame *ref,
ff_thread_await_progress(ref, (3 + y_off + block_h + subpel_idx[2][my]) >> 3, 0);
if (x_off < mx_idx || x_off >= width - block_w - subpel_idx[2][mx] ||
y_off < my_idx || y_off >= height - block_h - subpel_idx[2][my]) {
- s->dsp.emulated_edge_mc(s->edge_emu_buffer, src1 - my_idx * linesize - mx_idx, linesize,
- block_w + subpel_idx[1][mx], block_h + subpel_idx[1][my],
- x_off - mx_idx, y_off - my_idx, width, height);
- src1 = s->edge_emu_buffer + mx_idx + linesize * my_idx;
+ s->vdsp.emulated_edge_mc(td->edge_emu_buffer, src1 - my_idx * linesize - mx_idx, linesize,
+ block_w + subpel_idx[1][mx], block_h + subpel_idx[1][my],
+ x_off - mx_idx, y_off - my_idx, width, height);
+ src1 = td->edge_emu_buffer + mx_idx + linesize * my_idx;
mc_func[my_idx][mx_idx](dst1, linesize, src1, linesize, block_h, mx, my);
- s->dsp.emulated_edge_mc(s->edge_emu_buffer, src2 - my_idx * linesize - mx_idx, linesize,
- block_w + subpel_idx[1][mx], block_h + subpel_idx[1][my],
- x_off - mx_idx, y_off - my_idx, width, height);
- src2 = s->edge_emu_buffer + mx_idx + linesize * my_idx;
+ s->vdsp.emulated_edge_mc(td->edge_emu_buffer, src2 - my_idx * linesize - mx_idx, linesize,
+ block_w + subpel_idx[1][mx], block_h + subpel_idx[1][my],
+ x_off - mx_idx, y_off - my_idx, width, height);
+ src2 = td->edge_emu_buffer + mx_idx + linesize * my_idx;
mc_func[my_idx][mx_idx](dst2, linesize, src2, linesize, block_h, mx, my);
} else {
mc_func[my_idx][mx_idx](dst1, linesize, src1, linesize, block_h, mx, my);
@@ -1204,7 +1275,7 @@ void vp8_mc_chroma(VP8Context *s, uint8_t *dst1, uint8_t *dst2, AVFrame *ref,
}
static av_always_inline
-void vp8_mc_part(VP8Context *s, uint8_t *dst[3],
+void vp8_mc_part(VP8Context *s, VP8ThreadData *td, uint8_t *dst[3],
AVFrame *ref_frame, int x_off, int y_off,
int bx_off, int by_off,
int block_w, int block_h,
@@ -1213,7 +1284,7 @@ void vp8_mc_part(VP8Context *s, uint8_t *dst[3],
VP56mv uvmv = *mv;
/* Y */
- vp8_mc_luma(s, dst[0] + by_off * s->linesize + bx_off,
+ vp8_mc_luma(s, td, dst[0] + by_off * s->linesize + bx_off,
ref_frame, mv, x_off + bx_off, y_off + by_off,
block_w, block_h, width, height, s->linesize,
s->put_pixels_tab[block_w == 8]);
@@ -1227,7 +1298,7 @@ void vp8_mc_part(VP8Context *s, uint8_t *dst[3],
bx_off >>= 1; by_off >>= 1;
width >>= 1; height >>= 1;
block_w >>= 1; block_h >>= 1;
- vp8_mc_chroma(s, dst[1] + by_off * s->uvlinesize + bx_off,
+ vp8_mc_chroma(s, td, dst[1] + by_off * s->uvlinesize + bx_off,
dst[2] + by_off * s->uvlinesize + bx_off, ref_frame,
&uvmv, x_off + bx_off, y_off + by_off,
block_w, block_h, width, height, s->uvlinesize,
@@ -1248,9 +1319,9 @@ static av_always_inline void prefetch_motion(VP8Context *s, VP8Macroblock *mb, i
/* For threading, a ff_thread_await_progress here might be useful, but
* it actually slows down the decoder. Since a bad prefetch doesn't
* generate bad decoder output, we don't run it here. */
- s->dsp.prefetch(src[0]+off, s->linesize, 4);
+ s->vdsp.prefetch(src[0]+off, s->linesize, 4);
off= (mx>>1) + ((my>>1) + (mb_x&7))*s->uvlinesize + 64;
- s->dsp.prefetch(src[1]+off, src[2]-src[1], 2);
+ s->vdsp.prefetch(src[1]+off, src[2]-src[1], 2);
}
}
@@ -1258,8 +1329,8 @@ static av_always_inline void prefetch_motion(VP8Context *s, VP8Macroblock *mb, i
* Apply motion vectors to prediction buffer, chapter 18.
*/
static av_always_inline
-void inter_predict(VP8Context *s, uint8_t *dst[3], VP8Macroblock *mb,
- int mb_x, int mb_y)
+void inter_predict(VP8Context *s, VP8ThreadData *td, uint8_t *dst[3],
+ VP8Macroblock *mb, int mb_x, int mb_y)
{
int x_off = mb_x << 4, y_off = mb_y << 4;
int width = 16*s->mb_width, height = 16*s->mb_height;
@@ -1268,7 +1339,7 @@ void inter_predict(VP8Context *s, uint8_t *dst[3], VP8Macroblock *mb,
switch (mb->partitioning) {
case VP8_SPLITMVMODE_NONE:
- vp8_mc_part(s, dst, ref, x_off, y_off,
+ vp8_mc_part(s, td, dst, ref, x_off, y_off,
0, 0, 16, 16, width, height, &mb->mv);
break;
case VP8_SPLITMVMODE_4x4: {
@@ -1278,7 +1349,7 @@ void inter_predict(VP8Context *s, uint8_t *dst[3], VP8Macroblock *mb,
/* Y */
for (y = 0; y < 4; y++) {
for (x = 0; x < 4; x++) {
- vp8_mc_luma(s, dst[0] + 4*y*s->linesize + x*4,
+ vp8_mc_luma(s, td, dst[0] + 4*y*s->linesize + x*4,
ref, &bmv[4*y + x],
4*x + x_off, 4*y + y_off, 4, 4,
width, height, s->linesize,
@@ -1304,7 +1375,7 @@ void inter_predict(VP8Context *s, uint8_t *dst[3], VP8Macroblock *mb,
uvmv.x &= ~7;
uvmv.y &= ~7;
}
- vp8_mc_chroma(s, dst[1] + 4*y*s->uvlinesize + x*4,
+ vp8_mc_chroma(s, td, dst[1] + 4*y*s->uvlinesize + x*4,
dst[2] + 4*y*s->uvlinesize + x*4, ref, &uvmv,
4*x + x_off, 4*y + y_off, 4, 4,
width, height, s->uvlinesize,
@@ -1314,51 +1385,52 @@ void inter_predict(VP8Context *s, uint8_t *dst[3], VP8Macroblock *mb,
break;
}
case VP8_SPLITMVMODE_16x8:
- vp8_mc_part(s, dst, ref, x_off, y_off,
+ vp8_mc_part(s, td, dst, ref, x_off, y_off,
0, 0, 16, 8, width, height, &bmv[0]);
- vp8_mc_part(s, dst, ref, x_off, y_off,
+ vp8_mc_part(s, td, dst, ref, x_off, y_off,
0, 8, 16, 8, width, height, &bmv[1]);
break;
case VP8_SPLITMVMODE_8x16:
- vp8_mc_part(s, dst, ref, x_off, y_off,
+ vp8_mc_part(s, td, dst, ref, x_off, y_off,
0, 0, 8, 16, width, height, &bmv[0]);
- vp8_mc_part(s, dst, ref, x_off, y_off,
+ vp8_mc_part(s, td, dst, ref, x_off, y_off,
8, 0, 8, 16, width, height, &bmv[1]);
break;
case VP8_SPLITMVMODE_8x8:
- vp8_mc_part(s, dst, ref, x_off, y_off,
+ vp8_mc_part(s, td, dst, ref, x_off, y_off,
0, 0, 8, 8, width, height, &bmv[0]);
- vp8_mc_part(s, dst, ref, x_off, y_off,
+ vp8_mc_part(s, td, dst, ref, x_off, y_off,
8, 0, 8, 8, width, height, &bmv[1]);
- vp8_mc_part(s, dst, ref, x_off, y_off,
+ vp8_mc_part(s, td, dst, ref, x_off, y_off,
0, 8, 8, 8, width, height, &bmv[2]);
- vp8_mc_part(s, dst, ref, x_off, y_off,
+ vp8_mc_part(s, td, dst, ref, x_off, y_off,
8, 8, 8, 8, width, height, &bmv[3]);
break;
}
}
-static av_always_inline void idct_mb(VP8Context *s, uint8_t *dst[3], VP8Macroblock *mb)
+static av_always_inline void idct_mb(VP8Context *s, VP8ThreadData *td,
+ uint8_t *dst[3], VP8Macroblock *mb)
{
int x, y, ch;
if (mb->mode != MODE_I4x4) {
uint8_t *y_dst = dst[0];
for (y = 0; y < 4; y++) {
- uint32_t nnz4 = AV_RL32(s->non_zero_count_cache[y]);
+ uint32_t nnz4 = AV_RL32(td->non_zero_count_cache[y]);
if (nnz4) {
if (nnz4&~0x01010101) {
for (x = 0; x < 4; x++) {
if ((uint8_t)nnz4 == 1)
- s->vp8dsp.vp8_idct_dc_add(y_dst+4*x, s->block[y][x], s->linesize);
+ s->vp8dsp.vp8_idct_dc_add(y_dst+4*x, td->block[y][x], s->linesize);
else if((uint8_t)nnz4 > 1)
- s->vp8dsp.vp8_idct_add(y_dst+4*x, s->block[y][x], s->linesize);
+ s->vp8dsp.vp8_idct_add(y_dst+4*x, td->block[y][x], s->linesize);
nnz4 >>= 8;
if (!nnz4)
break;
}
} else {
- s->vp8dsp.vp8_idct_dc_add4y(y_dst, s->block[y], s->linesize);
+ s->vp8dsp.vp8_idct_dc_add4y(y_dst, td->block[y], s->linesize);
}
}
y_dst += 4*s->linesize;
@@ -1366,16 +1438,16 @@ static av_always_inline void idct_mb(VP8Context *s, uint8_t *dst[3], VP8Macroblo
}
for (ch = 0; ch < 2; ch++) {
- uint32_t nnz4 = AV_RL32(s->non_zero_count_cache[4+ch]);
+ uint32_t nnz4 = AV_RL32(td->non_zero_count_cache[4+ch]);
if (nnz4) {
uint8_t *ch_dst = dst[1+ch];
if (nnz4&~0x01010101) {
for (y = 0; y < 2; y++) {
for (x = 0; x < 2; x++) {
if ((uint8_t)nnz4 == 1)
- s->vp8dsp.vp8_idct_dc_add(ch_dst+4*x, s->block[4+ch][(y<<1)+x], s->uvlinesize);
+ s->vp8dsp.vp8_idct_dc_add(ch_dst+4*x, td->block[4+ch][(y<<1)+x], s->uvlinesize);
else if((uint8_t)nnz4 > 1)
- s->vp8dsp.vp8_idct_add(ch_dst+4*x, s->block[4+ch][(y<<1)+x], s->uvlinesize);
+ s->vp8dsp.vp8_idct_add(ch_dst+4*x, td->block[4+ch][(y<<1)+x], s->uvlinesize);
nnz4 >>= 8;
if (!nnz4)
goto chroma_idct_end;
@@ -1383,7 +1455,7 @@ static av_always_inline void idct_mb(VP8Context *s, uint8_t *dst[3], VP8Macroblo
ch_dst += 4*s->uvlinesize;
}
} else {
- s->vp8dsp.vp8_idct_dc_add4uv(ch_dst, s->block[4+ch], s->uvlinesize);
+ s->vp8dsp.vp8_idct_dc_add4uv(ch_dst, td->block[4+ch], s->uvlinesize);
}
}
chroma_idct_end: ;
@@ -1395,7 +1467,7 @@ static av_always_inline void filter_level_for_mb(VP8Context *s, VP8Macroblock *m
int interior_limit, filter_level;
if (s->segmentation.enabled) {
- filter_level = s->segmentation.filter_level[s->segment];
+ filter_level = s->segmentation.filter_level[mb->segment];
if (!s->segmentation.absolute_vals)
filter_level += s->filter.level;
} else
@@ -1521,58 +1593,284 @@ static av_always_inline void filter_mb_simple(VP8Context *s, uint8_t *dst, VP8Fi
}
}
-static void filter_mb_row(VP8Context *s, AVFrame *curframe, int mb_y)
+static void release_queued_segmaps(VP8Context *s, int is_close)
+{
+ int leave_behind = is_close ? 0 : !s->maps_are_invalid;
+ while (s->num_maps_to_be_freed > leave_behind)
+ av_freep(&s->segmentation_maps[--s->num_maps_to_be_freed]);
+ s->maps_are_invalid = 0;
+}
+
+#define MARGIN (16 << 2)
+static void vp8_decode_mv_mb_modes(AVCodecContext *avctx, AVFrame *curframe,
+ AVFrame *prev_frame)
+{
+ VP8Context *s = avctx->priv_data;
+ int mb_x, mb_y;
+
+ s->mv_min.y = -MARGIN;
+ s->mv_max.y = ((s->mb_height - 1) << 6) + MARGIN;
+ for (mb_y = 0; mb_y < s->mb_height; mb_y++) {
+ VP8Macroblock *mb = s->macroblocks_base + ((s->mb_width+1)*(mb_y + 1) + 1);
+ int mb_xy = mb_y*s->mb_width;
+
+ AV_WN32A(s->intra4x4_pred_mode_left, DC_PRED*0x01010101);
+
+ s->mv_min.x = -MARGIN;
+ s->mv_max.x = ((s->mb_width - 1) << 6) + MARGIN;
+ for (mb_x = 0; mb_x < s->mb_width; mb_x++, mb_xy++, mb++) {
+ if (mb_y == 0)
+ AV_WN32A((mb-s->mb_width-1)->intra4x4_pred_mode_top, DC_PRED*0x01010101);
+ decode_mb_mode(s, mb, mb_x, mb_y, curframe->ref_index[0] + mb_xy,
+ prev_frame && prev_frame->ref_index[0] ? prev_frame->ref_index[0] + mb_xy : NULL, 1);
+ s->mv_min.x -= 64;
+ s->mv_max.x -= 64;
+ }
+ s->mv_min.y -= 64;
+ s->mv_max.y -= 64;
+ }
+}
+
+#if HAVE_THREADS
+#define check_thread_pos(td, otd, mb_x_check, mb_y_check)\
+ do {\
+ int tmp = (mb_y_check << 16) | (mb_x_check & 0xFFFF);\
+ if (otd->thread_mb_pos < tmp) {\
+ pthread_mutex_lock(&otd->lock);\
+ td->wait_mb_pos = tmp;\
+ do {\
+ if (otd->thread_mb_pos >= tmp)\
+ break;\
+ pthread_cond_wait(&otd->cond, &otd->lock);\
+ } while (1);\
+ td->wait_mb_pos = INT_MAX;\
+ pthread_mutex_unlock(&otd->lock);\
+ }\
+ } while(0);
+
+#define update_pos(td, mb_y, mb_x)\
+ do {\
+ int pos = (mb_y << 16) | (mb_x & 0xFFFF);\
+ int sliced_threading = (avctx->active_thread_type == FF_THREAD_SLICE) && (num_jobs > 1);\
+ int is_null = (next_td == NULL) || (prev_td == NULL);\
+ int pos_check = (is_null) ? 1 :\
+ (next_td != td && pos >= next_td->wait_mb_pos) ||\
+ (prev_td != td && pos >= prev_td->wait_mb_pos);\
+ td->thread_mb_pos = pos;\
+ if (sliced_threading && pos_check) {\
+ pthread_mutex_lock(&td->lock);\
+ pthread_cond_broadcast(&td->cond);\
+ pthread_mutex_unlock(&td->lock);\
+ }\
+ } while(0);
+#else
+#define check_thread_pos(td, otd, mb_x_check, mb_y_check)
+#define update_pos(td, mb_y, mb_x)
+#endif
+
+static void vp8_decode_mb_row_no_filter(AVCodecContext *avctx, void *tdata,
+ int jobnr, int threadnr)
{
- VP8FilterStrength *f = s->filter_strength;
+ VP8Context *s = avctx->priv_data;
+ VP8ThreadData *prev_td, *next_td, *td = &s->thread_data[threadnr];
+ int mb_y = td->thread_mb_pos>>16;
+ int i, y, mb_x, mb_xy = mb_y*s->mb_width;
+ int num_jobs = s->num_jobs;
+ AVFrame *curframe = s->curframe, *prev_frame = s->prev_frame;
+ VP56RangeCoder *c = &s->coeff_partition[mb_y & (s->num_coeff_partitions-1)];
+ VP8Macroblock *mb;
uint8_t *dst[3] = {
curframe->data[0] + 16*mb_y*s->linesize,
curframe->data[1] + 8*mb_y*s->uvlinesize,
curframe->data[2] + 8*mb_y*s->uvlinesize
};
- int mb_x;
+ if (mb_y == 0) prev_td = td;
+ else prev_td = &s->thread_data[(jobnr + num_jobs - 1)%num_jobs];
+ if (mb_y == s->mb_height-1) next_td = td;
+ else next_td = &s->thread_data[(jobnr + 1)%num_jobs];
+ if (s->mb_layout == 1)
+ mb = s->macroblocks_base + ((s->mb_width+1)*(mb_y + 1) + 1);
+ else {
+ mb = s->macroblocks + (s->mb_height - mb_y - 1)*2;
+ memset(mb - 1, 0, sizeof(*mb)); // zero left macroblock
+ AV_WN32A(s->intra4x4_pred_mode_left, DC_PRED*0x01010101);
+ }
+
+ memset(td->left_nnz, 0, sizeof(td->left_nnz));
+ // left edge of 129 for intra prediction
+ if (!(avctx->flags & CODEC_FLAG_EMU_EDGE)) {
+ for (i = 0; i < 3; i++)
+ for (y = 0; y < 16>>!!i; y++)
+ dst[i][y*curframe->linesize[i]-1] = 129;
+ if (mb_y == 1) {
+ s->top_border[0][15] = s->top_border[0][23] = s->top_border[0][31] = 129;
+ }
+ }
+
+ s->mv_min.x = -MARGIN;
+ s->mv_max.x = ((s->mb_width - 1) << 6) + MARGIN;
+
+ for (mb_x = 0; mb_x < s->mb_width; mb_x++, mb_xy++, mb++) {
+ // Wait for previous thread to read mb_x+2, and reach mb_y-1.
+ if (prev_td != td) {
+ if (threadnr != 0) {
+ check_thread_pos(td, prev_td, mb_x+1, mb_y-1);
+ } else {
+ check_thread_pos(td, prev_td, (s->mb_width+3) + (mb_x+1), mb_y-1);
+ }
+ }
+
+ s->vdsp.prefetch(dst[0] + (mb_x&3)*4*s->linesize + 64, s->linesize, 4);
+ s->vdsp.prefetch(dst[1] + (mb_x&7)*s->uvlinesize + 64, dst[2] - dst[1], 2);
+
+ if (!s->mb_layout)
+ decode_mb_mode(s, mb, mb_x, mb_y, curframe->ref_index[0] + mb_xy,
+ prev_frame && prev_frame->ref_index[0] ? prev_frame->ref_index[0] + mb_xy : NULL, 0);
+
+ prefetch_motion(s, mb, mb_x, mb_y, mb_xy, VP56_FRAME_PREVIOUS);
+
+ if (!mb->skip)
+ decode_mb_coeffs(s, td, c, mb, s->top_nnz[mb_x], td->left_nnz);
+
+ if (mb->mode <= MODE_I4x4)
+ intra_predict(s, td, dst, mb, mb_x, mb_y);
+ else
+ inter_predict(s, td, dst, mb, mb_x, mb_y);
+
+ prefetch_motion(s, mb, mb_x, mb_y, mb_xy, VP56_FRAME_GOLDEN);
+
+ if (!mb->skip) {
+ idct_mb(s, td, dst, mb);
+ } else {
+ AV_ZERO64(td->left_nnz);
+ AV_WN64(s->top_nnz[mb_x], 0); // array of 9, so unaligned
+
+ // Reset DC block predictors if they would exist if the mb had coefficients
+ if (mb->mode != MODE_I4x4 && mb->mode != VP8_MVMODE_SPLIT) {
+ td->left_nnz[8] = 0;
+ s->top_nnz[mb_x][8] = 0;
+ }
+ }
+
+ if (s->deblock_filter)
+ filter_level_for_mb(s, mb, &td->filter_strength[mb_x]);
+
+ if (s->deblock_filter && num_jobs != 1 && threadnr == num_jobs-1) {
+ if (s->filter.simple)
+ backup_mb_border(s->top_border[mb_x+1], dst[0], NULL, NULL, s->linesize, 0, 1);
+ else
+ backup_mb_border(s->top_border[mb_x+1], dst[0], dst[1], dst[2], s->linesize, s->uvlinesize, 0);
+ }
+
+ prefetch_motion(s, mb, mb_x, mb_y, mb_xy, VP56_FRAME_GOLDEN2);
- for (mb_x = 0; mb_x < s->mb_width; mb_x++) {
- backup_mb_border(s->top_border[mb_x+1], dst[0], dst[1], dst[2], s->linesize, s->uvlinesize, 0);
- filter_mb(s, dst, f++, mb_x, mb_y);
dst[0] += 16;
dst[1] += 8;
dst[2] += 8;
+ s->mv_min.x -= 64;
+ s->mv_max.x -= 64;
+
+ if (mb_x == s->mb_width+1) {
+ update_pos(td, mb_y, s->mb_width+3);
+ } else {
+ update_pos(td, mb_y, mb_x);
+ }
}
}
-static void filter_mb_row_simple(VP8Context *s, AVFrame *curframe, int mb_y)
+static void vp8_filter_mb_row(AVCodecContext *avctx, void *tdata,
+ int jobnr, int threadnr)
{
- VP8FilterStrength *f = s->filter_strength;
- uint8_t *dst = curframe->data[0] + 16*mb_y*s->linesize;
- int mb_x;
+ VP8Context *s = avctx->priv_data;
+ VP8ThreadData *td = &s->thread_data[threadnr];
+ int mb_x, mb_y = td->thread_mb_pos>>16, num_jobs = s->num_jobs;
+ AVFrame *curframe = s->curframe;
+ VP8Macroblock *mb;
+ VP8ThreadData *prev_td, *next_td;
+ uint8_t *dst[3] = {
+ curframe->data[0] + 16*mb_y*s->linesize,
+ curframe->data[1] + 8*mb_y*s->uvlinesize,
+ curframe->data[2] + 8*mb_y*s->uvlinesize
+ };
+
+ if (s->mb_layout == 1)
+ mb = s->macroblocks_base + ((s->mb_width+1)*(mb_y + 1) + 1);
+ else
+ mb = s->macroblocks + (s->mb_height - mb_y - 1)*2;
+
+ if (mb_y == 0) prev_td = td;
+ else prev_td = &s->thread_data[(jobnr + num_jobs - 1)%num_jobs];
+ if (mb_y == s->mb_height-1) next_td = td;
+ else next_td = &s->thread_data[(jobnr + 1)%num_jobs];
+
+ for (mb_x = 0; mb_x < s->mb_width; mb_x++, mb++) {
+ VP8FilterStrength *f = &td->filter_strength[mb_x];
+ if (prev_td != td) {
+ check_thread_pos(td, prev_td, (mb_x+1) + (s->mb_width+3), mb_y-1);
+ }
+ if (next_td != td)
+ if (next_td != &s->thread_data[0]) {
+ check_thread_pos(td, next_td, mb_x+1, mb_y+1);
+ }
+
+ if (num_jobs == 1) {
+ if (s->filter.simple)
+ backup_mb_border(s->top_border[mb_x+1], dst[0], NULL, NULL, s->linesize, 0, 1);
+ else
+ backup_mb_border(s->top_border[mb_x+1], dst[0], dst[1], dst[2], s->linesize, s->uvlinesize, 0);
+ }
+
+ if (s->filter.simple)
+ filter_mb_simple(s, dst[0], f, mb_x, mb_y);
+ else
+ filter_mb(s, dst, f, mb_x, mb_y);
+ dst[0] += 16;
+ dst[1] += 8;
+ dst[2] += 8;
- for (mb_x = 0; mb_x < s->mb_width; mb_x++) {
- backup_mb_border(s->top_border[mb_x+1], dst, NULL, NULL, s->linesize, 0, 1);
- filter_mb_simple(s, dst, f++, mb_x, mb_y);
- dst += 16;
+ update_pos(td, mb_y, (s->mb_width+3) + mb_x);
}
}
-static void release_queued_segmaps(VP8Context *s, int is_close)
+static int vp8_decode_mb_row_sliced(AVCodecContext *avctx, void *tdata,
+ int jobnr, int threadnr)
{
- int leave_behind = is_close ? 0 : !s->maps_are_invalid;
- while (s->num_maps_to_be_freed > leave_behind)
- av_freep(&s->segmentation_maps[--s->num_maps_to_be_freed]);
- s->maps_are_invalid = 0;
+ VP8Context *s = avctx->priv_data;
+ VP8ThreadData *td = &s->thread_data[jobnr];
+ VP8ThreadData *next_td = NULL, *prev_td = NULL;
+ AVFrame *curframe = s->curframe;
+ int mb_y, num_jobs = s->num_jobs;
+ td->thread_nr = threadnr;
+ for (mb_y = jobnr; mb_y < s->mb_height; mb_y += num_jobs) {
+ if (mb_y >= s->mb_height) break;
+ td->thread_mb_pos = mb_y<<16;
+ vp8_decode_mb_row_no_filter(avctx, tdata, jobnr, threadnr);
+ if (s->deblock_filter)
+ vp8_filter_mb_row(avctx, tdata, jobnr, threadnr);
+ update_pos(td, mb_y, INT_MAX & 0xFFFF);
+
+ s->mv_min.y -= 64;
+ s->mv_max.y -= 64;
+
+ if (avctx->active_thread_type == FF_THREAD_FRAME)
+ ff_thread_report_progress(curframe, mb_y, 0);
+ }
+
+ return 0;
}
-static int vp8_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
+static int vp8_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
AVPacket *avpkt)
{
VP8Context *s = avctx->priv_data;
- int ret, mb_x, mb_y, i, y, referenced;
+ int ret, i, referenced, num_jobs;
enum AVDiscard skip_thresh;
AVFrame *av_uninit(curframe), *prev_frame;
release_queued_segmaps(s, 0);
if ((ret = decode_frame_header(s, avpkt->data, avpkt->size)) < 0)
- return ret;
+ goto err;
prev_frame = s->framep[VP56_FRAME_CURRENT];
@@ -1584,6 +1882,7 @@ static int vp8_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
if (avctx->skip_frame >= skip_thresh) {
s->invisible = 1;
+ memcpy(&s->next_framep[0], &s->framep[0], sizeof(s->framep[0]) * 4);
goto skip_decode;
}
s->deblock_filter = s->filter.level && avctx->skip_loop_filter < skip_thresh;
@@ -1613,12 +1912,23 @@ static int vp8_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
if (curframe->data[0])
vp8_release_frame(s, curframe, 1, 0);
+ // Given that arithmetic probabilities are updated every frame, it's quite likely
+ // that the values we have on a random interframe are complete junk if we didn't
+ // start decode on a keyframe. So just don't display anything rather than junk.
+ if (!s->keyframe && (!s->framep[VP56_FRAME_PREVIOUS] ||
+ !s->framep[VP56_FRAME_GOLDEN] ||
+ !s->framep[VP56_FRAME_GOLDEN2])) {
+ av_log(avctx, AV_LOG_WARNING, "Discarding interframe without a prior keyframe!\n");
+ ret = AVERROR_INVALIDDATA;
+ goto err;
+ }
+
curframe->key_frame = s->keyframe;
curframe->pict_type = s->keyframe ? AV_PICTURE_TYPE_I : AV_PICTURE_TYPE_P;
curframe->reference = referenced ? 3 : 0;
if ((ret = vp8_alloc_frame(s, curframe))) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed!\n");
- return ret;
+ goto err;
}
// check if golden and altref are swapped
@@ -1641,139 +1951,70 @@ static int vp8_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
ff_thread_finish_setup(avctx);
- // Given that arithmetic probabilities are updated every frame, it's quite likely
- // that the values we have on a random interframe are complete junk if we didn't
- // start decode on a keyframe. So just don't display anything rather than junk.
- if (!s->keyframe && (!s->framep[VP56_FRAME_PREVIOUS] ||
- !s->framep[VP56_FRAME_GOLDEN] ||
- !s->framep[VP56_FRAME_GOLDEN2])) {
- av_log(avctx, AV_LOG_WARNING, "Discarding interframe without a prior keyframe!\n");
- return AVERROR_INVALIDDATA;
- }
-
s->linesize = curframe->linesize[0];
s->uvlinesize = curframe->linesize[1];
- if (!s->edge_emu_buffer)
- s->edge_emu_buffer = av_malloc(21*s->linesize);
+ if (!s->thread_data[0].edge_emu_buffer)
+ for (i = 0; i < MAX_THREADS; i++)
+ s->thread_data[i].edge_emu_buffer = av_malloc(21*s->linesize);
memset(s->top_nnz, 0, s->mb_width*sizeof(*s->top_nnz));
-
/* Zero macroblock structures for top/top-left prediction from outside the frame. */
- memset(s->macroblocks + s->mb_height*2 - 1, 0, (s->mb_width+1)*sizeof(*s->macroblocks));
+ if (!s->mb_layout)
+ memset(s->macroblocks + s->mb_height*2 - 1, 0, (s->mb_width+1)*sizeof(*s->macroblocks));
+ if (!s->mb_layout && s->keyframe)
+ memset(s->intra4x4_pred_mode_top, DC_PRED, s->mb_width*4);
// top edge of 127 for intra prediction
if (!(avctx->flags & CODEC_FLAG_EMU_EDGE)) {
s->top_border[0][15] = s->top_border[0][23] = 127;
- memset(s->top_border[1]-1, 127, s->mb_width*sizeof(*s->top_border)+1);
+ s->top_border[0][31] = 127;
+ memset(s->top_border[1], 127, s->mb_width*sizeof(*s->top_border));
}
memset(s->ref_count, 0, sizeof(s->ref_count));
- if (s->keyframe)
- memset(s->intra4x4_pred_mode_top, DC_PRED, s->mb_width*4);
-
-#define MARGIN (16 << 2)
- s->mv_min.y = -MARGIN;
- s->mv_max.y = ((s->mb_height - 1) << 6) + MARGIN;
-
- for (mb_y = 0; mb_y < s->mb_height; mb_y++) {
- VP56RangeCoder *c = &s->coeff_partition[mb_y & (s->num_coeff_partitions-1)];
- VP8Macroblock *mb = s->macroblocks + (s->mb_height - mb_y - 1)*2;
- int mb_xy = mb_y*s->mb_width;
- uint8_t *dst[3] = {
- curframe->data[0] + 16*mb_y*s->linesize,
- curframe->data[1] + 8*mb_y*s->uvlinesize,
- curframe->data[2] + 8*mb_y*s->uvlinesize
- };
-
- memset(mb - 1, 0, sizeof(*mb)); // zero left macroblock
- memset(s->left_nnz, 0, sizeof(s->left_nnz));
- AV_WN32A(s->intra4x4_pred_mode_left, DC_PRED*0x01010101);
-
- // left edge of 129 for intra prediction
- if (!(avctx->flags & CODEC_FLAG_EMU_EDGE)) {
- for (i = 0; i < 3; i++)
- for (y = 0; y < 16>>!!i; y++)
- dst[i][y*curframe->linesize[i]-1] = 129;
- if (mb_y == 1) // top left edge is also 129
- s->top_border[0][15] = s->top_border[0][23] = s->top_border[0][31] = 129;
- }
-
- s->mv_min.x = -MARGIN;
- s->mv_max.x = ((s->mb_width - 1) << 6) + MARGIN;
- if (prev_frame && s->segmentation.enabled && !s->segmentation.update_map)
- ff_thread_await_progress(prev_frame, mb_y, 0);
-
- for (mb_x = 0; mb_x < s->mb_width; mb_x++, mb_xy++, mb++) {
- /* Prefetch the current frame, 4 MBs ahead */
- s->dsp.prefetch(dst[0] + (mb_x&3)*4*s->linesize + 64, s->linesize, 4);
- s->dsp.prefetch(dst[1] + (mb_x&7)*s->uvlinesize + 64, dst[2] - dst[1], 2);
-
- decode_mb_mode(s, mb, mb_x, mb_y, curframe->ref_index[0] + mb_xy,
- prev_frame && prev_frame->ref_index[0] ? prev_frame->ref_index[0] + mb_xy : NULL);
-
- prefetch_motion(s, mb, mb_x, mb_y, mb_xy, VP56_FRAME_PREVIOUS);
-
- if (!mb->skip)
- decode_mb_coeffs(s, c, mb, s->top_nnz[mb_x], s->left_nnz);
-
- if (mb->mode <= MODE_I4x4)
- intra_predict(s, dst, mb, mb_x, mb_y);
- else
- inter_predict(s, dst, mb, mb_x, mb_y);
-
- prefetch_motion(s, mb, mb_x, mb_y, mb_xy, VP56_FRAME_GOLDEN);
-
- if (!mb->skip) {
- idct_mb(s, dst, mb);
- } else {
- AV_ZERO64(s->left_nnz);
- AV_WN64(s->top_nnz[mb_x], 0); // array of 9, so unaligned
-
- // Reset DC block predictors if they would exist if the mb had coefficients
- if (mb->mode != MODE_I4x4 && mb->mode != VP8_MVMODE_SPLIT) {
- s->left_nnz[8] = 0;
- s->top_nnz[mb_x][8] = 0;
- }
- }
- if (s->deblock_filter)
- filter_level_for_mb(s, mb, &s->filter_strength[mb_x]);
- prefetch_motion(s, mb, mb_x, mb_y, mb_xy, VP56_FRAME_GOLDEN2);
+ // Make sure the previous frame has read its segmentation map,
+ // if we re-use the same map.
+ if (prev_frame && s->segmentation.enabled && !s->segmentation.update_map)
+ ff_thread_await_progress(prev_frame, 1, 0);
- dst[0] += 16;
- dst[1] += 8;
- dst[2] += 8;
- s->mv_min.x -= 64;
- s->mv_max.x -= 64;
- }
- if (s->deblock_filter) {
- if (s->filter.simple)
- filter_mb_row_simple(s, curframe, mb_y);
- else
- filter_mb_row(s, curframe, mb_y);
- }
- s->mv_min.y -= 64;
- s->mv_max.y -= 64;
+ if (s->mb_layout == 1)
+ vp8_decode_mv_mb_modes(avctx, curframe, prev_frame);
- ff_thread_report_progress(curframe, mb_y, 0);
+ if (avctx->active_thread_type == FF_THREAD_FRAME)
+ num_jobs = 1;
+ else
+ num_jobs = FFMIN(s->num_coeff_partitions, avctx->thread_count);
+ s->num_jobs = num_jobs;
+ s->curframe = curframe;
+ s->prev_frame = prev_frame;
+ s->mv_min.y = -MARGIN;
+ s->mv_max.y = ((s->mb_height - 1) << 6) + MARGIN;
+ for (i = 0; i < MAX_THREADS; i++) {
+ s->thread_data[i].thread_mb_pos = 0;
+ s->thread_data[i].wait_mb_pos = INT_MAX;
}
+ avctx->execute2(avctx, vp8_decode_mb_row_sliced, s->thread_data, NULL, num_jobs);
ff_thread_report_progress(curframe, INT_MAX, 0);
+ memcpy(&s->framep[0], &s->next_framep[0], sizeof(s->framep[0]) * 4);
+
skip_decode:
// if future frames don't use the updated probabilities,
// reset them to the values we saved
if (!s->update_probabilities)
s->prob[0] = s->prob[1];
- memcpy(&s->framep[0], &s->next_framep[0], sizeof(s->framep[0]) * 4);
-
if (!s->invisible) {
*(AVFrame*)data = *curframe;
- *data_size = sizeof(AVFrame);
+ *got_frame = 1;
}
return avpkt->size;
+err:
+ memcpy(&s->next_framep[0], &s->framep[0], sizeof(s->framep[0]) * 4);
+ return ret;
}
static av_cold int vp8_decode_init(AVCodecContext *avctx)
@@ -1781,10 +2022,10 @@ static av_cold int vp8_decode_init(AVCodecContext *avctx)
VP8Context *s = avctx->priv_data;
s->avctx = avctx;
- avctx->pix_fmt = PIX_FMT_YUV420P;
+ avctx->pix_fmt = AV_PIX_FMT_YUV420P;
- dsputil_init(&s->dsp, avctx);
- ff_h264_pred_init(&s->hpc, CODEC_ID_VP8, 8, 1);
+ ff_videodsp_init(&s->vdsp, 8);
+ ff_h264_pred_init(&s->hpc, AV_CODEC_ID_VP8, 8, 1);
ff_vp8dsp_init(&s->vp8dsp);
return 0;
@@ -1817,6 +2058,8 @@ static int vp8_decode_update_thread_context(AVCodecContext *dst, const AVCodecCo
(s_src->mb_width != s->mb_width || s_src->mb_height != s->mb_height)) {
free_buffers(s);
s->maps_are_invalid = 1;
+ s->mb_width = s_src->mb_width;
+ s->mb_height = s_src->mb_height;
}
s->prob[0] = s_src->prob[!s_src->update_probabilities];
@@ -1834,16 +2077,16 @@ static int vp8_decode_update_thread_context(AVCodecContext *dst, const AVCodecCo
}
AVCodec ff_vp8_decoder = {
- .name = "vp8",
- .type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_VP8,
- .priv_data_size = sizeof(VP8Context),
- .init = vp8_decode_init,
- .close = vp8_decode_free,
- .decode = vp8_decode_frame,
- .capabilities = CODEC_CAP_DR1 | CODEC_CAP_FRAME_THREADS,
- .flush = vp8_decode_flush,
- .long_name = NULL_IF_CONFIG_SMALL("On2 VP8"),
+ .name = "vp8",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .id = AV_CODEC_ID_VP8,
+ .priv_data_size = sizeof(VP8Context),
+ .init = vp8_decode_init,
+ .close = vp8_decode_free,
+ .decode = vp8_decode_frame,
+ .capabilities = CODEC_CAP_DR1 | CODEC_CAP_FRAME_THREADS | CODEC_CAP_SLICE_THREADS,
+ .flush = vp8_decode_flush,
+ .long_name = NULL_IF_CONFIG_SMALL("On2 VP8"),
.init_thread_copy = ONLY_IF_THREADS_ENABLED(vp8_decode_init_thread_copy),
.update_thread_context = ONLY_IF_THREADS_ENABLED(vp8_decode_update_thread_context),
};
diff --git a/gst-libs/ext/libav/libavcodec/vp8.h b/gst-libs/ext/libav/libavcodec/vp8.h
index 6cbdca2..4a85541 100644
--- a/gst-libs/ext/libav/libavcodec/vp8.h
+++ b/gst-libs/ext/libav/libavcodec/vp8.h
@@ -1,9 +1,10 @@
-/**
+/*
* VP8 compatible video decoder
*
* Copyright (C) 2010 David Conrad
* Copyright (C) 2010 Ronald S. Bultje
* Copyright (C) 2010 Jason Garrett-Glaser
+ * Copyright (C) 2012 Daniel Kang
*
* This file is part of Libav.
*
@@ -29,6 +30,11 @@
#include "vp56data.h"
#include "vp8dsp.h"
#include "h264pred.h"
+#if HAVE_PTHREADS
+#include <pthread.h>
+#elif HAVE_W32THREADS
+#include "w32pthreads.h"
+#endif
#define VP8_MAX_QUANT 127
@@ -66,28 +72,64 @@ enum inter_splitmvmode {
VP8_SPLITMVMODE_NONE, ///< (only used in prediction) no split MVs
};
-typedef struct {
+typedef struct VP8FilterStrength {
uint8_t filter_level;
uint8_t inner_limit;
uint8_t inner_filter;
} VP8FilterStrength;
-typedef struct {
+typedef struct VP8Macroblock {
uint8_t skip;
// todo: make it possible to check for at least (i4x4 or split_mv)
// in one op. are others needed?
uint8_t mode;
uint8_t ref_frame;
uint8_t partitioning;
+ uint8_t chroma_pred_mode;
+ uint8_t segment;
+ uint8_t intra4x4_pred_mode_mb[16];
+ uint8_t intra4x4_pred_mode_top[4];
VP56mv mv;
VP56mv bmv[16];
} VP8Macroblock;
-typedef struct {
+typedef struct VP8ThreadData {
+ DECLARE_ALIGNED(16, DCTELEM, block)[6][4][16];
+ DECLARE_ALIGNED(16, DCTELEM, block_dc)[16];
+ /**
+ * This is the index plus one of the last non-zero coeff
+ * for each of the blocks in the current macroblock.
+ * So, 0 -> no coeffs
+ * 1 -> dc-only (special transform)
+ * 2+-> full transform
+ */
+ DECLARE_ALIGNED(16, uint8_t, non_zero_count_cache)[6][4];
+ /**
+ * For coeff decode, we need to know whether the above block had non-zero
+ * coefficients. This means for each macroblock, we need data for 4 luma
+ * blocks, 2 u blocks, 2 v blocks, and the luma dc block, for a total of 9
+ * per macroblock. We keep the last row in top_nnz.
+ */
+ DECLARE_ALIGNED(8, uint8_t, left_nnz)[9];
+ int thread_nr;
+#if HAVE_THREADS
+ pthread_mutex_t lock;
+ pthread_cond_t cond;
+#endif
+ int thread_mb_pos; // (mb_y << 16) | (mb_x & 0xFFFF)
+ int wait_mb_pos; // What the current thread is waiting on.
+ uint8_t *edge_emu_buffer;
+ VP8FilterStrength *filter_strength;
+} VP8ThreadData;
+
+#define MAX_THREADS 8
+typedef struct VP8Context {
+ VP8ThreadData *thread_data;
AVCodecContext *avctx;
AVFrame *framep[4];
AVFrame *next_framep[4];
- uint8_t *edge_emu_buffer;
+ AVFrame *curframe;
+ AVFrame *prev_frame;
uint16_t mb_width; /* number of horizontal MB */
uint16_t mb_height; /* number of vertical MB */
@@ -97,8 +139,6 @@ typedef struct {
uint8_t keyframe;
uint8_t deblock_filter;
uint8_t mbskip_enabled;
- uint8_t segment; ///< segment of the current macroblock
- uint8_t chroma_pred_mode; ///< 8x8c pred mode of the current macroblock
uint8_t profile;
VP56mv mv_min;
VP56mv mv_max;
@@ -126,7 +166,6 @@ typedef struct {
} filter;
VP8Macroblock *macroblocks;
- VP8FilterStrength *filter_strength;
uint8_t *intra4x4_pred_mode_top;
uint8_t intra4x4_pred_mode_left[4];
@@ -167,33 +206,10 @@ typedef struct {
int8_t ref[4];
} lf_delta;
- /**
- * Cache of the top row needed for intra prediction
- * 16 for luma, 8 for each chroma plane
- */
uint8_t (*top_border)[16+8+8];
-
- /**
- * For coeff decode, we need to know whether the above block had non-zero
- * coefficients. This means for each macroblock, we need data for 4 luma
- * blocks, 2 u blocks, 2 v blocks, and the luma dc block, for a total of 9
- * per macroblock. We keep the last row in top_nnz.
- */
uint8_t (*top_nnz)[9];
- DECLARE_ALIGNED(8, uint8_t, left_nnz)[9];
- /**
- * This is the index plus one of the last non-zero coeff
- * for each of the blocks in the current macroblock.
- * So, 0 -> no coeffs
- * 1 -> dc-only (special transform)
- * 2+-> full transform
- */
- DECLARE_ALIGNED(16, uint8_t, non_zero_count_cache)[6][4];
VP56RangeCoder c; ///< header context, includes mb modes and motion vectors
- DECLARE_ALIGNED(16, DCTELEM, block)[6][4][16];
- DECLARE_ALIGNED(16, DCTELEM, block_dc)[16];
- uint8_t intra4x4_pred_mode_mb[16];
/**
* These are all of the updatable probabilities for binary decisions.
@@ -231,7 +247,7 @@ typedef struct {
*/
int num_coeff_partitions;
VP56RangeCoder coeff_partition[8];
- DSPContext dsp;
+ VideoDSPContext vdsp;
VP8DSPContext vp8dsp;
H264PredContext hpc;
vp8_mc_func put_pixels_tab[3][3][3];
@@ -246,6 +262,13 @@ typedef struct {
uint8_t *segmentation_maps[5];
int num_maps_to_be_freed;
int maps_are_invalid;
+ int num_jobs;
+ /**
+ * This describes the macroblock memory layout.
+ * 0 -> Only width+height*2+1 macroblocks allocated (frame/single thread).
+ * 1 -> Macroblocks for entire frame alloced (sliced thread).
+ */
+ int mb_layout;
} VP8Context;
#endif /* AVCODEC_VP8_H */
diff --git a/gst-libs/ext/libav/libavcodec/vp8_parser.c b/gst-libs/ext/libav/libavcodec/vp8_parser.c
index e6d4151..196de83 100644
--- a/gst-libs/ext/libav/libavcodec/vp8_parser.c
+++ b/gst-libs/ext/libav/libavcodec/vp8_parser.c
@@ -33,6 +33,6 @@ static int parse(AVCodecParserContext *s,
}
AVCodecParser ff_vp8_parser = {
- .codec_ids = { CODEC_ID_VP8 },
+ .codec_ids = { AV_CODEC_ID_VP8 },
.parser_parse = parse,
};
diff --git a/gst-libs/ext/libav/libavcodec/vp8dsp.c b/gst-libs/ext/libav/libavcodec/vp8dsp.c
index 20bf66f..2ab68bc 100644
--- a/gst-libs/ext/libav/libavcodec/vp8dsp.c
+++ b/gst-libs/ext/libav/libavcodec/vp8dsp.c
@@ -26,6 +26,7 @@
#include "dsputil.h"
#include "vp8dsp.h"
+#include "libavutil/common.h"
// TODO: Maybe add dequant
static void vp8_luma_dc_wht_c(DCTELEM block[4][4][16], DCTELEM dc[16])
@@ -77,7 +78,7 @@ static void vp8_luma_dc_wht_dc_c(DCTELEM block[4][4][16], DCTELEM dc[16])
#define MUL_20091(a) ((((a)*20091) >> 16) + (a))
#define MUL_35468(a) (((a)*35468) >> 16)
-static void vp8_idct_add_c(uint8_t *dst, DCTELEM block[16], int stride)
+static void vp8_idct_add_c(uint8_t *dst, DCTELEM block[16], ptrdiff_t stride)
{
int i, t0, t1, t2, t3;
DCTELEM tmp[16];
@@ -112,7 +113,7 @@ static void vp8_idct_add_c(uint8_t *dst, DCTELEM block[16], int stride)
}
}
-static void vp8_idct_dc_add_c(uint8_t *dst, DCTELEM block[16], int stride)
+static void vp8_idct_dc_add_c(uint8_t *dst, DCTELEM block[16], ptrdiff_t stride)
{
int i, dc = (block[0] + 4) >> 3;
block[0] = 0;
@@ -126,7 +127,7 @@ static void vp8_idct_dc_add_c(uint8_t *dst, DCTELEM block[16], int stride)
}
}
-static void vp8_idct_dc_add4uv_c(uint8_t *dst, DCTELEM block[4][16], int stride)
+static void vp8_idct_dc_add4uv_c(uint8_t *dst, DCTELEM block[4][16], ptrdiff_t stride)
{
vp8_idct_dc_add_c(dst+stride*0+0, block[0], stride);
vp8_idct_dc_add_c(dst+stride*0+4, block[1], stride);
@@ -134,7 +135,7 @@ static void vp8_idct_dc_add4uv_c(uint8_t *dst, DCTELEM block[4][16], int stride)
vp8_idct_dc_add_c(dst+stride*4+4, block[3], stride);
}
-static void vp8_idct_dc_add4y_c(uint8_t *dst, DCTELEM block[4][16], int stride)
+static void vp8_idct_dc_add4y_c(uint8_t *dst, DCTELEM block[4][16], ptrdiff_t stride)
{
vp8_idct_dc_add_c(dst+ 0, block[0], stride);
vp8_idct_dc_add_c(dst+ 4, block[1], stride);
@@ -155,7 +156,7 @@ static void vp8_idct_dc_add4y_c(uint8_t *dst, DCTELEM block[4][16], int stride)
#define clip_int8(n) (cm[n+0x80]-0x80)
-static av_always_inline void filter_common(uint8_t *p, int stride, int is4tap)
+static av_always_inline void filter_common(uint8_t *p, ptrdiff_t stride, int is4tap)
{
LOAD_PIXELS
int a, f1, f2;
@@ -186,7 +187,7 @@ static av_always_inline void filter_common(uint8_t *p, int stride, int is4tap)
}
}
-static av_always_inline int simple_limit(uint8_t *p, int stride, int flim)
+static av_always_inline int simple_limit(uint8_t *p, ptrdiff_t stride, int flim)
{
LOAD_PIXELS
return 2*FFABS(p0-q0) + (FFABS(p1-q1) >> 1) <= flim;
@@ -196,7 +197,7 @@ static av_always_inline int simple_limit(uint8_t *p, int stride, int flim)
* E - limit at the macroblock edge
* I - limit for interior difference
*/
-static av_always_inline int normal_limit(uint8_t *p, int stride, int E, int I)
+static av_always_inline int normal_limit(uint8_t *p, ptrdiff_t stride, int E, int I)
{
LOAD_PIXELS
return simple_limit(p, stride, E)
@@ -205,13 +206,13 @@ static av_always_inline int normal_limit(uint8_t *p, int stride, int E, int I)
}
// high edge variance
-static av_always_inline int hev(uint8_t *p, int stride, int thresh)
+static av_always_inline int hev(uint8_t *p, ptrdiff_t stride, int thresh)
{
LOAD_PIXELS
return FFABS(p1-p0) > thresh || FFABS(q1-q0) > thresh;
}
-static av_always_inline void filter_mbedge(uint8_t *p, int stride)
+static av_always_inline void filter_mbedge(uint8_t *p, ptrdiff_t stride)
{
int a0, a1, a2, w;
uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
@@ -234,7 +235,7 @@ static av_always_inline void filter_mbedge(uint8_t *p, int stride)
}
#define LOOP_FILTER(dir, size, stridea, strideb, maybe_inline) \
-static maybe_inline void vp8_ ## dir ## _loop_filter ## size ## _c(uint8_t *dst, int stride,\
+static maybe_inline void vp8_ ## dir ## _loop_filter ## size ## _c(uint8_t *dst, ptrdiff_t stride,\
int flim_E, int flim_I, int hev_thresh)\
{\
int i;\
@@ -248,7 +249,7 @@ static maybe_inline void vp8_ ## dir ## _loop_filter ## size ## _c(uint8_t *dst,
}\
}\
\
-static maybe_inline void vp8_ ## dir ## _loop_filter ## size ## _inner_c(uint8_t *dst, int stride,\
+static maybe_inline void vp8_ ## dir ## _loop_filter ## size ## _inner_c(uint8_t *dst, ptrdiff_t stride,\
int flim_E, int flim_I, int hev_thresh)\
{\
int i;\
@@ -268,13 +269,13 @@ LOOP_FILTER(h, 16, stride, 1,)
#define UV_LOOP_FILTER(dir, stridea, strideb) \
LOOP_FILTER(dir, 8, stridea, strideb, av_always_inline) \
-static void vp8_ ## dir ## _loop_filter8uv_c(uint8_t *dstU, uint8_t *dstV, int stride,\
+static void vp8_ ## dir ## _loop_filter8uv_c(uint8_t *dstU, uint8_t *dstV, ptrdiff_t stride,\
int fE, int fI, int hev_thresh)\
{\
vp8_ ## dir ## _loop_filter8_c(dstU, stride, fE, fI, hev_thresh);\
vp8_ ## dir ## _loop_filter8_c(dstV, stride, fE, fI, hev_thresh);\
}\
-static void vp8_ ## dir ## _loop_filter8uv_inner_c(uint8_t *dstU, uint8_t *dstV, int stride,\
+static void vp8_ ## dir ## _loop_filter8uv_inner_c(uint8_t *dstU, uint8_t *dstV, ptrdiff_t stride,\
int fE, int fI, int hev_thresh)\
{\
vp8_ ## dir ## _loop_filter8_inner_c(dstU, stride, fE, fI, hev_thresh);\
@@ -284,7 +285,7 @@ static void vp8_ ## dir ## _loop_filter8uv_inner_c(uint8_t *dstU, uint8_t *dstV,
UV_LOOP_FILTER(v, 1, stride)
UV_LOOP_FILTER(h, stride, 1)
-static void vp8_v_loop_filter_simple_c(uint8_t *dst, int stride, int flim)
+static void vp8_v_loop_filter_simple_c(uint8_t *dst, ptrdiff_t stride, int flim)
{
int i;
@@ -293,7 +294,7 @@ static void vp8_v_loop_filter_simple_c(uint8_t *dst, int stride, int flim)
filter_common(dst+i, stride, 1);
}
-static void vp8_h_loop_filter_simple_c(uint8_t *dst, int stride, int flim)
+static void vp8_h_loop_filter_simple_c(uint8_t *dst, ptrdiff_t stride, int flim)
{
int i;
@@ -313,7 +314,7 @@ static const uint8_t subpel_filters[7][6] = {
};
#define PUT_PIXELS(WIDTH) \
-static void put_vp8_pixels ## WIDTH ##_c(uint8_t *dst, int dststride, uint8_t *src, int srcstride, int h, int x, int y) { \
+static void put_vp8_pixels ## WIDTH ##_c(uint8_t *dst, ptrdiff_t dststride, uint8_t *src, ptrdiff_t srcstride, int h, int x, int y) { \
int i; \
for (i = 0; i < h; i++, dst+= dststride, src+= srcstride) { \
memcpy(dst, src, WIDTH); \
@@ -333,7 +334,7 @@ PUT_PIXELS(4)
F[3]*src[x+1*stride] - F[4]*src[x+2*stride] + 64) >> 7]
#define VP8_EPEL_H(SIZE, TAPS) \
-static void put_vp8_epel ## SIZE ## _h ## TAPS ## _c(uint8_t *dst, int dststride, uint8_t *src, int srcstride, int h, int mx, int my) \
+static void put_vp8_epel ## SIZE ## _h ## TAPS ## _c(uint8_t *dst, ptrdiff_t dststride, uint8_t *src, ptrdiff_t srcstride, int h, int mx, int my) \
{ \
const uint8_t *filter = subpel_filters[mx-1]; \
uint8_t *cm = ff_cropTbl + MAX_NEG_CROP; \
@@ -347,7 +348,7 @@ static void put_vp8_epel ## SIZE ## _h ## TAPS ## _c(uint8_t *dst, int dststride
} \
}
#define VP8_EPEL_V(SIZE, TAPS) \
-static void put_vp8_epel ## SIZE ## _v ## TAPS ## _c(uint8_t *dst, int dststride, uint8_t *src, int srcstride, int h, int mx, int my) \
+static void put_vp8_epel ## SIZE ## _v ## TAPS ## _c(uint8_t *dst, ptrdiff_t dststride, uint8_t *src, ptrdiff_t srcstride, int h, int mx, int my) \
{ \
const uint8_t *filter = subpel_filters[my-1]; \
uint8_t *cm = ff_cropTbl + MAX_NEG_CROP; \
@@ -361,7 +362,7 @@ static void put_vp8_epel ## SIZE ## _v ## TAPS ## _c(uint8_t *dst, int dststride
} \
}
#define VP8_EPEL_HV(SIZE, HTAPS, VTAPS) \
-static void put_vp8_epel ## SIZE ## _h ## HTAPS ## v ## VTAPS ## _c(uint8_t *dst, int dststride, uint8_t *src, int srcstride, int h, int mx, int my) \
+static void put_vp8_epel ## SIZE ## _h ## HTAPS ## v ## VTAPS ## _c(uint8_t *dst, ptrdiff_t dststride, uint8_t *src, ptrdiff_t srcstride, int h, int mx, int my) \
{ \
const uint8_t *filter = subpel_filters[mx-1]; \
uint8_t *cm = ff_cropTbl + MAX_NEG_CROP; \
@@ -414,7 +415,7 @@ VP8_EPEL_HV(8, 6, 6)
VP8_EPEL_HV(4, 6, 6)
#define VP8_BILINEAR(SIZE) \
-static void put_vp8_bilinear ## SIZE ## _h_c(uint8_t *dst, int stride, uint8_t *src, int s2, int h, int mx, int my) \
+static void put_vp8_bilinear ## SIZE ## _h_c(uint8_t *dst, ptrdiff_t stride, uint8_t *src, ptrdiff_t s2, int h, int mx, int my) \
{ \
int a = 8-mx, b = mx; \
int x, y; \
@@ -426,7 +427,7 @@ static void put_vp8_bilinear ## SIZE ## _h_c(uint8_t *dst, int stride, uint8_t *
src += stride; \
} \
} \
-static void put_vp8_bilinear ## SIZE ## _v_c(uint8_t *dst, int stride, uint8_t *src, int s2, int h, int mx, int my) \
+static void put_vp8_bilinear ## SIZE ## _v_c(uint8_t *dst, ptrdiff_t stride, uint8_t *src, ptrdiff_t s2, int h, int mx, int my) \
{ \
int c = 8-my, d = my; \
int x, y; \
@@ -439,7 +440,7 @@ static void put_vp8_bilinear ## SIZE ## _v_c(uint8_t *dst, int stride, uint8_t *
} \
} \
\
-static void put_vp8_bilinear ## SIZE ## _hv_c(uint8_t *dst, int stride, uint8_t *src, int s2, int h, int mx, int my) \
+static void put_vp8_bilinear ## SIZE ## _hv_c(uint8_t *dst, ptrdiff_t stride, uint8_t *src, ptrdiff_t s2, int h, int mx, int my) \
{ \
int a = 8-mx, b = mx; \
int c = 8-my, d = my; \
@@ -520,7 +521,7 @@ av_cold void ff_vp8dsp_init(VP8DSPContext *dsp)
VP8_BILINEAR_MC_FUNC(1, 8);
VP8_BILINEAR_MC_FUNC(2, 4);
- if (HAVE_MMX)
+ if (ARCH_X86)
ff_vp8dsp_init_x86(dsp);
if (HAVE_ALTIVEC)
ff_vp8dsp_init_altivec(dsp);
diff --git a/gst-libs/ext/libav/libavcodec/vp8dsp.h b/gst-libs/ext/libav/libavcodec/vp8dsp.h
index 5429e98..bce0062 100644
--- a/gst-libs/ext/libav/libavcodec/vp8dsp.h
+++ b/gst-libs/ext/libav/libavcodec/vp8dsp.h
@@ -29,54 +29,63 @@
#include "dsputil.h"
-typedef void (*vp8_mc_func)(uint8_t *dst/*align 8*/, int dstStride, uint8_t *src/*align 1*/, int srcStride, int h, int x, int y);
+typedef void (*vp8_mc_func)(uint8_t *dst/*align 8*/, ptrdiff_t dstStride,
+ uint8_t *src/*align 1*/, ptrdiff_t srcStride,
+ int h, int x, int y);
typedef struct VP8DSPContext {
void (*vp8_luma_dc_wht)(DCTELEM block[4][4][16], DCTELEM dc[16]);
void (*vp8_luma_dc_wht_dc)(DCTELEM block[4][4][16], DCTELEM dc[16]);
- void (*vp8_idct_add)(uint8_t *dst, DCTELEM block[16], int stride);
- void (*vp8_idct_dc_add)(uint8_t *dst, DCTELEM block[16], int stride);
- void (*vp8_idct_dc_add4y)(uint8_t *dst, DCTELEM block[4][16], int stride);
- void (*vp8_idct_dc_add4uv)(uint8_t *dst, DCTELEM block[4][16], int stride);
+ void (*vp8_idct_add)(uint8_t *dst, DCTELEM block[16], ptrdiff_t stride);
+ void (*vp8_idct_dc_add)(uint8_t *dst, DCTELEM block[16], ptrdiff_t stride);
+ void (*vp8_idct_dc_add4y)(uint8_t *dst, DCTELEM block[4][16],
+ ptrdiff_t stride);
+ void (*vp8_idct_dc_add4uv)(uint8_t *dst, DCTELEM block[4][16],
+ ptrdiff_t stride);
// loop filter applied to edges between macroblocks
- void (*vp8_v_loop_filter16y)(uint8_t *dst, int stride,
+ void (*vp8_v_loop_filter16y)(uint8_t *dst, ptrdiff_t stride,
int flim_E, int flim_I, int hev_thresh);
- void (*vp8_h_loop_filter16y)(uint8_t *dst, int stride,
+ void (*vp8_h_loop_filter16y)(uint8_t *dst, ptrdiff_t stride,
int flim_E, int flim_I, int hev_thresh);
- void (*vp8_v_loop_filter8uv)(uint8_t *dstU, uint8_t *dstV, int stride,
+ void (*vp8_v_loop_filter8uv)(uint8_t *dstU, uint8_t *dstV, ptrdiff_t stride,
int flim_E, int flim_I, int hev_thresh);
- void (*vp8_h_loop_filter8uv)(uint8_t *dstU, uint8_t *dstV, int stride,
+ void (*vp8_h_loop_filter8uv)(uint8_t *dstU, uint8_t *dstV, ptrdiff_t stride,
int flim_E, int flim_I, int hev_thresh);
// loop filter applied to inner macroblock edges
- void (*vp8_v_loop_filter16y_inner)(uint8_t *dst, int stride,
+ void (*vp8_v_loop_filter16y_inner)(uint8_t *dst, ptrdiff_t stride,
int flim_E, int flim_I, int hev_thresh);
- void (*vp8_h_loop_filter16y_inner)(uint8_t *dst, int stride,
+ void (*vp8_h_loop_filter16y_inner)(uint8_t *dst, ptrdiff_t stride,
int flim_E, int flim_I, int hev_thresh);
- void (*vp8_v_loop_filter8uv_inner)(uint8_t *dstU, uint8_t *dstV, int stride,
+ void (*vp8_v_loop_filter8uv_inner)(uint8_t *dstU, uint8_t *dstV,
+ ptrdiff_t stride,
int flim_E, int flim_I, int hev_thresh);
- void (*vp8_h_loop_filter8uv_inner)(uint8_t *dstU, uint8_t *dstV, int stride,
+ void (*vp8_h_loop_filter8uv_inner)(uint8_t *dstU, uint8_t *dstV,
+ ptrdiff_t stride,
int flim_E, int flim_I, int hev_thresh);
- void (*vp8_v_loop_filter_simple)(uint8_t *dst, int stride, int flim);
- void (*vp8_h_loop_filter_simple)(uint8_t *dst, int stride, int flim);
+ void (*vp8_v_loop_filter_simple)(uint8_t *dst, ptrdiff_t stride, int flim);
+ void (*vp8_h_loop_filter_simple)(uint8_t *dst, ptrdiff_t stride, int flim);
/**
* first dimension: width>>3, height is assumed equal to width
* second dimension: 0 if no vertical interpolation is needed;
* 1 4-tap vertical interpolation filter (my & 1)
* 2 6-tap vertical interpolation filter (!(my & 1))
- * third dimension: same as second dimention, for horizontal interpolation
+ * third dimension: same as second dimension, for horizontal interpolation
* so something like put_vp8_epel_pixels_tab[width>>3][2*!!my-(my&1)][2*!!mx-(mx&1)](..., mx, my)
*/
vp8_mc_func put_vp8_epel_pixels_tab[3][3][3];
vp8_mc_func put_vp8_bilinear_pixels_tab[3][3][3];
} VP8DSPContext;
-void ff_put_vp8_pixels16_c(uint8_t *dst, uint8_t *src, int stride, int h, int x, int y);
-void ff_put_vp8_pixels8_c(uint8_t *dst, uint8_t *src, int stride, int h, int x, int y);
-void ff_put_vp8_pixels4_c(uint8_t *dst, uint8_t *src, int stride, int h, int x, int y);
+void ff_put_vp8_pixels16_c(uint8_t *dst, uint8_t *src, ptrdiff_t stride,
+ int h, int x, int y);
+void ff_put_vp8_pixels8_c(uint8_t *dst, uint8_t *src, ptrdiff_t stride,
+ int h, int x, int y);
+void ff_put_vp8_pixels4_c(uint8_t *dst, uint8_t *src, ptrdiff_t stride,
+ int h, int x, int y);
void ff_vp8dsp_init(VP8DSPContext *c);
void ff_vp8dsp_init_x86(VP8DSPContext *c);
diff --git a/gst-libs/ext/libav/libavcodec/vqavideo.c b/gst-libs/ext/libav/libavcodec/vqavideo.c
index 4826650..841210c 100644
--- a/gst-libs/ext/libav/libavcodec/vqavideo.c
+++ b/gst-libs/ext/libav/libavcodec/vqavideo.c
@@ -71,6 +71,7 @@
#include "libavutil/imgutils.h"
#include "avcodec.h"
#include "bytestream.h"
+#include "internal.h"
#define PALETTE_COUNT 256
#define VQA_HEADER_SIZE 0x2A
@@ -124,7 +125,7 @@ static av_cold int vqa_decode_init(AVCodecContext *avctx)
int i, j, codebook_index;
s->avctx = avctx;
- avctx->pix_fmt = PIX_FMT_PAL8;
+ avctx->pix_fmt = AV_PIX_FMT_PAL8;
/* make sure the extradata made it */
if (s->avctx->extradata_size != VQA_HEADER_SIZE) {
@@ -160,7 +161,18 @@ static av_cold int vqa_decode_init(AVCodecContext *avctx)
/* allocate codebooks */
s->codebook_size = MAX_CODEBOOK_SIZE;
s->codebook = av_malloc(s->codebook_size);
+ if (!s->codebook)
+ goto fail;
s->next_codebook_buffer = av_malloc(s->codebook_size);
+ if (!s->next_codebook_buffer)
+ goto fail;
+
+ /* allocate decode buffer */
+ s->decode_buffer_size = (s->width / s->vector_width) *
+ (s->height / s->vector_height) * 2;
+ s->decode_buffer = av_malloc(s->decode_buffer_size);
+ if (!s->decode_buffer)
+ goto fail;
/* initialize the solid-color vectors */
if (s->vector_height == 4) {
@@ -176,14 +188,14 @@ static av_cold int vqa_decode_init(AVCodecContext *avctx)
}
s->next_codebook_buffer_index = 0;
- /* allocate decode buffer */
- s->decode_buffer_size = (s->width / s->vector_width) *
- (s->height / s->vector_height) * 2;
- s->decode_buffer = av_malloc(s->decode_buffer_size);
-
s->frame.data[0] = NULL;
return 0;
+fail:
+ av_freep(&s->codebook);
+ av_freep(&s->next_codebook_buffer);
+ av_freep(&s->decode_buffer);
+ return AVERROR(ENOMEM);
}
#define CHECK_COUNT() \
@@ -457,11 +469,9 @@ static int vqa_decode_chunk(VqaContext *s)
index_shift = 4;
else
index_shift = 3;
- for (y = 0; y < s->frame.linesize[0] * s->height;
- y += s->frame.linesize[0] * s->vector_height) {
-
- for (x = y; x < y + s->width; x += 4, lobytes++, hibytes++) {
- pixel_ptr = x;
+ for (y = 0; y < s->height; y += s->vector_height) {
+ for (x = 0; x < s->width; x += 4, lobytes++, hibytes++) {
+ pixel_ptr = y * s->frame.linesize[0] + x;
/* get the vector index, the method for which varies according to
* VQA file version */
@@ -522,6 +532,12 @@ static int vqa_decode_chunk(VqaContext *s)
bytestream2_seek(&s->gb, cbp0_chunk, SEEK_SET);
chunk_size = bytestream2_get_be32(&s->gb);
+ if (chunk_size > MAX_CODEBOOK_SIZE - s->next_codebook_buffer_index) {
+ av_log(s->avctx, AV_LOG_ERROR, "cbp0 chunk too large (%u bytes)\n",
+ chunk_size);
+ return AVERROR_INVALIDDATA;
+ }
+
/* accumulate partial codebook */
bytestream2_get_buffer(&s->gb, &s->next_codebook_buffer[s->next_codebook_buffer_index],
chunk_size);
@@ -545,6 +561,12 @@ static int vqa_decode_chunk(VqaContext *s)
bytestream2_seek(&s->gb, cbpz_chunk, SEEK_SET);
chunk_size = bytestream2_get_be32(&s->gb);
+ if (chunk_size > MAX_CODEBOOK_SIZE - s->next_codebook_buffer_index) {
+ av_log(s->avctx, AV_LOG_ERROR, "cbpz chunk too large (%u bytes)\n",
+ chunk_size);
+ return AVERROR_INVALIDDATA;
+ }
+
/* accumulate partial codebook */
bytestream2_get_buffer(&s->gb, &s->next_codebook_buffer[s->next_codebook_buffer_index],
chunk_size);
@@ -570,7 +592,7 @@ static int vqa_decode_chunk(VqaContext *s)
}
static int vqa_decode_frame(AVCodecContext *avctx,
- void *data, int *data_size,
+ void *data, int *got_frame,
AVPacket *avpkt)
{
VqaContext *s = avctx->priv_data;
@@ -579,7 +601,7 @@ static int vqa_decode_frame(AVCodecContext *avctx,
if (s->frame.data[0])
avctx->release_buffer(avctx, &s->frame);
- if (avctx->get_buffer(avctx, &s->frame)) {
+ if (ff_get_buffer(avctx, &s->frame)) {
av_log(s->avctx, AV_LOG_ERROR, " VQA Video: get_buffer() failed\n");
return -1;
}
@@ -592,7 +614,7 @@ static int vqa_decode_frame(AVCodecContext *avctx,
memcpy(s->frame.data[1], s->palette, PALETTE_COUNT * 4);
s->frame.palette_has_changed = 1;
- *data_size = sizeof(AVFrame);
+ *got_frame = 1;
*(AVFrame*)data = s->frame;
/* report that the buffer was completely consumed */
@@ -603,9 +625,9 @@ static av_cold int vqa_decode_end(AVCodecContext *avctx)
{
VqaContext *s = avctx->priv_data;
- av_free(s->codebook);
- av_free(s->next_codebook_buffer);
- av_free(s->decode_buffer);
+ av_freep(&s->codebook);
+ av_freep(&s->next_codebook_buffer);
+ av_freep(&s->decode_buffer);
if (s->frame.data[0])
avctx->release_buffer(avctx, &s->frame);
@@ -616,11 +638,11 @@ static av_cold int vqa_decode_end(AVCodecContext *avctx)
AVCodec ff_vqa_decoder = {
.name = "vqavideo",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_WS_VQA,
+ .id = AV_CODEC_ID_WS_VQA,
.priv_data_size = sizeof(VqaContext),
.init = vqa_decode_init,
.close = vqa_decode_end,
.decode = vqa_decode_frame,
.capabilities = CODEC_CAP_DR1,
- .long_name = NULL_IF_CONFIG_SMALL("Westwood Studios VQA (Vector Quantized Animation) video"),
+ .long_name = NULL_IF_CONFIG_SMALL("Westwood Studios VQA (Vector Quantized Animation) video"),
};
diff --git a/gst-libs/ext/libav/libavcodec/w32pthreads.h b/gst-libs/ext/libav/libavcodec/w32pthreads.h
index 70b84cf..91e7353 100644
--- a/gst-libs/ext/libav/libavcodec/w32pthreads.h
+++ b/gst-libs/ext/libav/libavcodec/w32pthreads.h
@@ -39,7 +39,10 @@
#include <windows.h>
#include <process.h>
-typedef struct {
+#include "libavutil/internal.h"
+#include "libavutil/mem.h"
+
+typedef struct pthread_t {
void *handle;
void *(*func)(void* arg);
void *arg;
@@ -53,7 +56,7 @@ typedef CRITICAL_SECTION pthread_mutex_t;
/* This is the CONDITIONAL_VARIABLE typedef for using Window's native
* conditional variables on kernels 6.0+.
* MinGW does not currently have this typedef. */
-typedef struct {
+typedef struct pthread_cond_t {
void *ptr;
} pthread_cond_t;
@@ -114,7 +117,7 @@ static inline int pthread_mutex_unlock(pthread_mutex_t *m)
/* for pre-Windows 6.0 platforms we need to define and use our own condition
* variable and api */
-typedef struct {
+typedef struct win32_cond_t {
pthread_mutex_t mtx_broadcast;
pthread_mutex_t mtx_waiter_count;
volatile int waiter_count;
@@ -194,13 +197,13 @@ static void pthread_cond_broadcast(pthread_cond_t *cond)
pthread_mutex_unlock(&win32_cond->mtx_broadcast);
}
-static void pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex)
+static int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex)
{
win32_cond_t *win32_cond = cond->ptr;
int last_waiter;
if (cond_wait) {
cond_wait(cond, mutex, INFINITE);
- return;
+ return 0;
}
/* non native condition variables */
diff --git a/gst-libs/ext/libav/libavcodec/wavpack.c b/gst-libs/ext/libav/libavcodec/wavpack.c
index 31377e7..02cef5f 100644
--- a/gst-libs/ext/libav/libavcodec/wavpack.c
+++ b/gst-libs/ext/libav/libavcodec/wavpack.c
@@ -21,10 +21,12 @@
#define BITSTREAM_READER_LE
-#include "libavutil/audioconvert.h"
+#include "libavutil/channel_layout.h"
#include "avcodec.h"
#include "get_bits.h"
+#include "internal.h"
#include "unary.h"
+#include "bytestream.h"
/**
* @file
@@ -428,7 +430,7 @@ static float wv_get_value_float(WavpackFrameContext *s, uint32_t *crc, int S)
uint32_t u;
} value;
- int sign;
+ unsigned int sign;
int exp = s->float_max_exp;
if (s->got_extra_bits) {
@@ -500,6 +502,21 @@ static void wv_reset_saved_context(WavpackFrameContext *s)
s->sc.crc = s->extra_sc.crc = 0xFFFFFFFF;
}
+static inline int wv_check_crc(WavpackFrameContext *s, uint32_t crc,
+ uint32_t crc_extra_bits)
+{
+ if (crc != s->CRC) {
+ av_log(s->avctx, AV_LOG_ERROR, "CRC error\n");
+ return AVERROR_INVALIDDATA;
+ }
+ if (s->got_extra_bits && crc_extra_bits != s->crc_extra_bits) {
+ av_log(s->avctx, AV_LOG_ERROR, "Extra bits CRC error\n");
+ return AVERROR_INVALIDDATA;
+ }
+
+ return 0;
+}
+
static inline int wv_unpack_stereo(WavpackFrameContext *s, GetBitContext *gb,
void *dst, const int type)
{
@@ -610,14 +627,9 @@ static inline int wv_unpack_stereo(WavpackFrameContext *s, GetBitContext *gb,
} while (!last && count < s->samples);
wv_reset_saved_context(s);
- if (crc != s->CRC) {
- av_log(s->avctx, AV_LOG_ERROR, "CRC error\n");
- return -1;
- }
- if (s->got_extra_bits && crc_extra_bits != s->crc_extra_bits) {
- av_log(s->avctx, AV_LOG_ERROR, "Extra bits CRC error\n");
- return -1;
- }
+ if ((s->avctx->err_recognition & AV_EF_CRCCHECK) &&
+ wv_check_crc(s, crc, crc_extra_bits))
+ return AVERROR_INVALIDDATA;
return count * 2;
}
@@ -680,14 +692,9 @@ static inline int wv_unpack_mono(WavpackFrameContext *s, GetBitContext *gb,
} while (!last && count < s->samples);
wv_reset_saved_context(s);
- if (crc != s->CRC) {
- av_log(s->avctx, AV_LOG_ERROR, "CRC error\n");
- return -1;
- }
- if (s->got_extra_bits && crc_extra_bits != s->crc_extra_bits) {
- av_log(s->avctx, AV_LOG_ERROR, "Extra bits CRC error\n");
- return -1;
- }
+ if ((s->avctx->err_recognition & AV_EF_CRCCHECK) &&
+ wv_check_crc(s, crc, crc_extra_bits))
+ return AVERROR_INVALIDDATA;
return count;
}
@@ -757,12 +764,11 @@ static int wavpack_decode_block(AVCodecContext *avctx, int block_no,
{
WavpackContext *wc = avctx->priv_data;
WavpackFrameContext *s;
+ GetByteContext gb;
void *samples = data;
int samplecount;
int got_terms = 0, got_weights = 0, got_samples = 0,
got_entropy = 0, got_bs = 0, got_float = 0, got_hybrid = 0;
- const uint8_t *orig_buf = buf;
- const uint8_t *buf_end = buf + buf_size;
int i, j, id, size, ssize, weights, t;
int bpp, chan, chmask, orig_bpp;
@@ -788,8 +794,10 @@ static int wavpack_decode_block(AVCodecContext *avctx, int block_no,
s->and = s->or = s->shift = 0;
s->got_extra_bits = 0;
+ bytestream2_init(&gb, buf, buf_size);
+
if (!wc->mkv_mode) {
- s->samples = AV_RL32(buf); buf += 4;
+ s->samples = bytestream2_get_le32(&gb);
if (s->samples != wc->samples)
return AVERROR_INVALIDDATA;
@@ -800,7 +808,7 @@ static int wavpack_decode_block(AVCodecContext *avctx, int block_no,
} else {
s->samples = wc->samples;
}
- s->frame_flags = AV_RL32(buf); buf += 4;
+ s->frame_flags = bytestream2_get_le32(&gb);
bpp = av_get_bytes_per_sample(avctx->sample_fmt);
samples = (uint8_t*)samples + bpp * wc->ch_offset;
orig_bpp = ((s->frame_flags & 0x03) + 1) << 3;
@@ -811,21 +819,21 @@ static int wavpack_decode_block(AVCodecContext *avctx, int block_no,
s->hybrid = s->frame_flags & WV_HYBRID_MODE;
s->hybrid_bitrate = s->frame_flags & WV_HYBRID_BITRATE;
s->post_shift = bpp * 8 - orig_bpp + ((s->frame_flags >> 13) & 0x1f);
- s->hybrid_maxclip = (( 1LL << (orig_bpp - 1)) - 1) >> s->post_shift;
- s->hybrid_minclip = ((-1LL << (orig_bpp - 1))) >> s->post_shift;
- s->CRC = AV_RL32(buf); buf += 4;
+ s->hybrid_maxclip = (( 1LL << (orig_bpp - 1)) - 1);
+ s->hybrid_minclip = ((-1LL << (orig_bpp - 1)));
+ s->CRC = bytestream2_get_le32(&gb);
if (wc->mkv_mode)
- buf += 4; //skip block size;
+ bytestream2_skip(&gb, 4); // skip block size;
wc->ch_offset += 1 + s->stereo;
// parse metadata blocks
- while (buf < buf_end) {
- id = *buf++;
- size = *buf++;
+ while (bytestream2_get_bytes_left(&gb)) {
+ id = bytestream2_get_byte(&gb);
+ size = bytestream2_get_byte(&gb);
if (id & WP_IDF_LONG) {
- size |= (*buf++) << 8;
- size |= (*buf++) << 16;
+ size |= (bytestream2_get_byte(&gb)) << 8;
+ size |= (bytestream2_get_byte(&gb)) << 16;
}
size <<= 1; // size is specified in words
ssize = size;
@@ -835,12 +843,13 @@ static int wavpack_decode_block(AVCodecContext *avctx, int block_no,
av_log(avctx, AV_LOG_ERROR, "Got incorrect block %02X with size %i\n", id, size);
break;
}
- if (buf + ssize > buf_end) {
- av_log(avctx, AV_LOG_ERROR, "Block size %i is out of bounds\n", size);
+ if (bytestream2_get_bytes_left(&gb) < ssize) {
+ av_log(avctx, AV_LOG_ERROR,
+ "Block size %i is out of bounds\n", size);
break;
}
if (id & WP_IDF_IGNORE) {
- buf += ssize;
+ bytestream2_skip(&gb, ssize);
continue;
}
switch (id & WP_IDF_MASK) {
@@ -848,14 +857,14 @@ static int wavpack_decode_block(AVCodecContext *avctx, int block_no,
if (size > MAX_TERMS) {
av_log(avctx, AV_LOG_ERROR, "Too many decorrelation terms\n");
s->terms = 0;
- buf += ssize;
+ bytestream2_skip(&gb, ssize);
continue;
}
s->terms = size;
for (i = 0; i < s->terms; i++) {
- s->decorr[s->terms - i - 1].value = (*buf & 0x1F) - 5;
- s->decorr[s->terms - i - 1].delta = *buf >> 5;
- buf++;
+ uint8_t val = bytestream2_get_byte(&gb);
+ s->decorr[s->terms - i - 1].value = (val & 0x1F) - 5;
+ s->decorr[s->terms - i - 1].delta = val >> 5;
}
got_terms = 1;
break;
@@ -867,17 +876,17 @@ static int wavpack_decode_block(AVCodecContext *avctx, int block_no,
weights = size >> s->stereo_in;
if (weights > MAX_TERMS || weights > s->terms) {
av_log(avctx, AV_LOG_ERROR, "Too many decorrelation weights\n");
- buf += ssize;
+ bytestream2_skip(&gb, ssize);
continue;
}
for (i = 0; i < weights; i++) {
- t = (int8_t)(*buf++);
+ t = (int8_t)bytestream2_get_byte(&gb);
s->decorr[s->terms - i - 1].weightA = t << 3;
if (s->decorr[s->terms - i - 1].weightA > 0)
s->decorr[s->terms - i - 1].weightA +=
(s->decorr[s->terms - i - 1].weightA + 64) >> 7;
if (s->stereo_in) {
- t = (int8_t)(*buf++);
+ t = (int8_t)bytestream2_get_byte(&gb);
s->decorr[s->terms - i - 1].weightB = t << 3;
if (s->decorr[s->terms - i - 1].weightB > 0)
s->decorr[s->terms - i - 1].weightB +=
@@ -894,23 +903,33 @@ static int wavpack_decode_block(AVCodecContext *avctx, int block_no,
t = 0;
for (i = s->terms - 1; (i >= 0) && (t < size); i--) {
if (s->decorr[i].value > 8) {
- s->decorr[i].samplesA[0] = wp_exp2(AV_RL16(buf)); buf += 2;
- s->decorr[i].samplesA[1] = wp_exp2(AV_RL16(buf)); buf += 2;
+ s->decorr[i].samplesA[0] =
+ wp_exp2(bytestream2_get_le16(&gb));
+ s->decorr[i].samplesA[1] =
+ wp_exp2(bytestream2_get_le16(&gb));
+
if (s->stereo_in) {
- s->decorr[i].samplesB[0] = wp_exp2(AV_RL16(buf)); buf += 2;
- s->decorr[i].samplesB[1] = wp_exp2(AV_RL16(buf)); buf += 2;
- t += 4;
+ s->decorr[i].samplesB[0] =
+ wp_exp2(bytestream2_get_le16(&gb));
+ s->decorr[i].samplesB[1] =
+ wp_exp2(bytestream2_get_le16(&gb));
+ t += 4;
}
t += 4;
} else if (s->decorr[i].value < 0) {
- s->decorr[i].samplesA[0] = wp_exp2(AV_RL16(buf)); buf += 2;
- s->decorr[i].samplesB[0] = wp_exp2(AV_RL16(buf)); buf += 2;
- t += 4;
+ s->decorr[i].samplesA[0] =
+ wp_exp2(bytestream2_get_le16(&gb));
+ s->decorr[i].samplesB[0] =
+ wp_exp2(bytestream2_get_le16(&gb));
+ t += 4;
} else {
for (j = 0; j < s->decorr[i].value; j++) {
- s->decorr[i].samplesA[j] = wp_exp2(AV_RL16(buf)); buf += 2;
- if (s->stereo_in)
- s->decorr[i].samplesB[j] = wp_exp2(AV_RL16(buf)); buf += 2;
+ s->decorr[i].samplesA[j] =
+ wp_exp2(bytestream2_get_le16(&gb));
+ if (s->stereo_in) {
+ s->decorr[i].samplesB[j] =
+ wp_exp2(bytestream2_get_le16(&gb));
+ }
}
t += s->decorr[i].value * 2 * (s->stereo_in + 1);
}
@@ -919,15 +938,15 @@ static int wavpack_decode_block(AVCodecContext *avctx, int block_no,
break;
case WP_ID_ENTROPY:
if (size != 6 * (s->stereo_in + 1)) {
- av_log(avctx, AV_LOG_ERROR, "Entropy vars size should be %i, "
- "got %i", 6 * (s->stereo_in + 1), size);
- buf += ssize;
+ av_log(avctx, AV_LOG_ERROR,
+ "Entropy vars size should be %i, got %i",
+ 6 * (s->stereo_in + 1), size);
+ bytestream2_skip(&gb, ssize);
continue;
}
for (j = 0; j <= s->stereo_in; j++) {
for (i = 0; i < 3; i++) {
- s->ch[j].median[i] = wp_exp2(AV_RL16(buf));
- buf += 2;
+ s->ch[j].median[i] = wp_exp2(bytestream2_get_le16(&gb));
}
}
got_entropy = 1;
@@ -935,20 +954,18 @@ static int wavpack_decode_block(AVCodecContext *avctx, int block_no,
case WP_ID_HYBRID:
if (s->hybrid_bitrate) {
for (i = 0; i <= s->stereo_in; i++) {
- s->ch[i].slow_level = wp_exp2(AV_RL16(buf));
- buf += 2;
- size -= 2;
+ s->ch[i].slow_level = wp_exp2(bytestream2_get_le16(&gb));
+ size -= 2;
}
}
for (i = 0; i < (s->stereo_in + 1); i++) {
- s->ch[i].bitrate_acc = AV_RL16(buf) << 16;
- buf += 2;
- size -= 2;
+ s->ch[i].bitrate_acc = bytestream2_get_le16(&gb) << 16;
+ size -= 2;
}
if (size > 0) {
for (i = 0; i < (s->stereo_in + 1); i++) {
- s->ch[i].bitrate_delta = wp_exp2((int16_t)AV_RL16(buf));
- buf += 2;
+ s->ch[i].bitrate_delta =
+ wp_exp2((int16_t)bytestream2_get_le16(&gb));
}
} else {
for (i = 0; i < (s->stereo_in + 1); i++)
@@ -956,22 +973,26 @@ static int wavpack_decode_block(AVCodecContext *avctx, int block_no,
}
got_hybrid = 1;
break;
- case WP_ID_INT32INFO:
+ case WP_ID_INT32INFO: {
+ uint8_t val[4];
if (size != 4) {
- av_log(avctx, AV_LOG_ERROR, "Invalid INT32INFO, size = %i, sent_bits = %i\n", size, *buf);
- buf += ssize;
+ av_log(avctx, AV_LOG_ERROR,
+ "Invalid INT32INFO, size = %i\n",
+ size);
+ bytestream2_skip(&gb, ssize - 4);
continue;
}
- if (buf[0])
- s->extra_bits = buf[0];
- else if (buf[1])
- s->shift = buf[1];
- else if (buf[2]){
- s->and = s->or = 1;
- s->shift = buf[2];
- } else if(buf[3]) {
+ bytestream2_get_buffer(&gb, val, 4);
+ if (val[0]) {
+ s->extra_bits = val[0];
+ } else if (val[1]) {
+ s->shift = val[1];
+ } else if (val[2]) {
+ s->and = s->or = 1;
+ s->shift = val[2];
+ } else if (val[3]) {
s->and = 1;
- s->shift = buf[3];
+ s->shift = val[3];
}
/* original WavPack decoder forces 32-bit lossy sound to be treated
* as 24-bit one in order to have proper clipping
@@ -982,56 +1003,66 @@ static int wavpack_decode_block(AVCodecContext *avctx, int block_no,
s->hybrid_maxclip >>= 8;
s->hybrid_minclip >>= 8;
}
- buf += 4;
break;
+ }
case WP_ID_FLOATINFO:
if (size != 4) {
- av_log(avctx, AV_LOG_ERROR, "Invalid FLOATINFO, size = %i\n", size);
- buf += ssize;
+ av_log(avctx, AV_LOG_ERROR,
+ "Invalid FLOATINFO, size = %i\n", size);
+ bytestream2_skip(&gb, ssize);
continue;
}
- s->float_flag = buf[0];
- s->float_shift = buf[1];
- s->float_max_exp = buf[2];
- buf += 4;
- got_float = 1;
+ s->float_flag = bytestream2_get_byte(&gb);
+ s->float_shift = bytestream2_get_byte(&gb);
+ s->float_max_exp = bytestream2_get_byte(&gb);
+ got_float = 1;
+ bytestream2_skip(&gb, 1);
break;
case WP_ID_DATA:
- s->sc.offset = buf - orig_buf;
+ s->sc.offset = bytestream2_tell(&gb);
s->sc.size = size * 8;
- init_get_bits(&s->gb, buf, size * 8);
+ init_get_bits(&s->gb, gb.buffer, size * 8);
s->data_size = size * 8;
- buf += size;
+ bytestream2_skip(&gb, size);
got_bs = 1;
break;
case WP_ID_EXTRABITS:
if (size <= 4) {
av_log(avctx, AV_LOG_ERROR, "Invalid EXTRABITS, size = %i\n",
size);
- buf += size;
+ bytestream2_skip(&gb, size);
continue;
}
- s->extra_sc.offset = buf - orig_buf;
+ s->extra_sc.offset = bytestream2_tell(&gb);
s->extra_sc.size = size * 8;
- init_get_bits(&s->gb_extra_bits, buf, size * 8);
- s->crc_extra_bits = get_bits_long(&s->gb_extra_bits, 32);
- buf += size;
- s->got_extra_bits = 1;
+ init_get_bits(&s->gb_extra_bits, gb.buffer, size * 8);
+ s->crc_extra_bits = get_bits_long(&s->gb_extra_bits, 32);
+ bytestream2_skip(&gb, size);
+ s->got_extra_bits = 1;
break;
case WP_ID_CHANINFO:
if (size <= 1) {
av_log(avctx, AV_LOG_ERROR, "Insufficient channel information\n");
return AVERROR_INVALIDDATA;
}
- chan = *buf++;
+ chan = bytestream2_get_byte(&gb);
switch (size - 2) {
- case 0: chmask = *buf; break;
- case 1: chmask = AV_RL16(buf); break;
- case 2: chmask = AV_RL24(buf); break;
- case 3: chmask = AV_RL32(buf); break;
+ case 0:
+ chmask = bytestream2_get_byte(&gb);
+ break;
+ case 1:
+ chmask = bytestream2_get_le16(&gb);
+ break;
+ case 2:
+ chmask = bytestream2_get_le24(&gb);
+ break;
+ case 3:
+ chmask = bytestream2_get_le32(&gb);;
+ break;
case 5:
- chan |= (buf[1] & 0xF) << 8;
- chmask = AV_RL24(buf + 2);
+ bytestream2_skip(&gb, 1);
+ chan |= (bytestream2_get_byte(&gb) & 0xF) << 8;
+ chmask = bytestream2_get_le16(&gb);
break;
default:
av_log(avctx, AV_LOG_ERROR, "Invalid channel info size %d\n",
@@ -1048,13 +1079,12 @@ static int wavpack_decode_block(AVCodecContext *avctx, int block_no,
}
if (!avctx->channel_layout)
avctx->channel_layout = chmask;
- buf += size - 1;
break;
default:
- buf += size;
+ bytestream2_skip(&gb, size);
}
if (id & WP_IDF_ODD)
- buf++;
+ bytestream2_skip(&gb, 1);
}
if (!got_terms) {
@@ -1203,11 +1233,12 @@ static int wavpack_decode_frame(AVCodecContext *avctx, void *data,
avctx->sample_fmt = AV_SAMPLE_FMT_S16;
} else {
avctx->sample_fmt = AV_SAMPLE_FMT_S32;
+ avctx->bits_per_raw_sample = ((frame_flags & 0x03) + 1) << 3;
}
/* get output buffer */
s->frame.nb_samples = s->samples;
- if ((ret = avctx->get_buffer(avctx, &s->frame)) < 0) {
+ if ((ret = ff_get_buffer(avctx, &s->frame)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return ret;
}
@@ -1249,7 +1280,7 @@ static int wavpack_decode_frame(AVCodecContext *avctx, void *data,
AVCodec ff_wavpack_decoder = {
.name = "wavpack",
.type = AVMEDIA_TYPE_AUDIO,
- .id = CODEC_ID_WAVPACK,
+ .id = AV_CODEC_ID_WAVPACK,
.priv_data_size = sizeof(WavpackContext),
.init = wavpack_decode_init,
.close = wavpack_decode_end,
diff --git a/gst-libs/ext/libav/libavcodec/wma.c b/gst-libs/ext/libav/libavcodec/wma.c
index 63ddb6c..9808a16 100644
--- a/gst-libs/ext/libav/libavcodec/wma.c
+++ b/gst-libs/ext/libav/libavcodec/wma.c
@@ -22,6 +22,7 @@
#include "avcodec.h"
#include "sinewin.h"
#include "wma.h"
+#include "wma_common.h"
#include "wmadata.h"
#undef NDEBUG
@@ -67,46 +68,6 @@ static void init_coef_vlc(VLC *vlc, uint16_t **prun_table,
av_free(level_table);
}
-/**
- *@brief Get the samples per frame for this stream.
- *@param sample_rate output sample_rate
- *@param version wma version
- *@param decode_flags codec compression features
- *@return log2 of the number of output samples per frame
- */
-int av_cold ff_wma_get_frame_len_bits(int sample_rate, int version,
- unsigned int decode_flags)
-{
-
- int frame_len_bits;
-
- if (sample_rate <= 16000) {
- frame_len_bits = 9;
- } else if (sample_rate <= 22050 ||
- (sample_rate <= 32000 && version == 1)) {
- frame_len_bits = 10;
- } else if (sample_rate <= 48000 || version < 3) {
- frame_len_bits = 11;
- } else if (sample_rate <= 96000) {
- frame_len_bits = 12;
- } else {
- frame_len_bits = 13;
- }
-
- if (version == 3) {
- int tmp = decode_flags & 0x6;
- if (tmp == 0x2) {
- ++frame_len_bits;
- } else if (tmp == 0x4) {
- --frame_len_bits;
- } else if (tmp == 0x6) {
- frame_len_bits -= 2;
- }
- }
-
- return frame_len_bits;
-}
-
int ff_wma_init(AVCodecContext *avctx, int flags2)
{
WMACodecContext *s = avctx->priv_data;
@@ -117,26 +78,23 @@ int ff_wma_init(AVCodecContext *avctx, int flags2)
int coef_vlc_table;
if ( avctx->sample_rate <= 0 || avctx->sample_rate > 50000
- || avctx->channels <= 0 || avctx->channels > 8
+ || avctx->channels <= 0 || avctx->channels > 2
|| avctx->bit_rate <= 0)
return -1;
- s->sample_rate = avctx->sample_rate;
- s->nb_channels = avctx->channels;
- s->bit_rate = avctx->bit_rate;
- s->block_align = avctx->block_align;
-
- dsputil_init(&s->dsp, avctx);
+ ff_dsputil_init(&s->dsp, avctx);
ff_fmt_convert_init(&s->fmt_conv, avctx);
+ avpriv_float_dsp_init(&s->fdsp, avctx->flags & CODEC_FLAG_BITEXACT);
- if (avctx->codec->id == CODEC_ID_WMAV1) {
+ if (avctx->codec->id == AV_CODEC_ID_WMAV1) {
s->version = 1;
} else {
s->version = 2;
}
/* compute MDCT block size */
- s->frame_len_bits = ff_wma_get_frame_len_bits(s->sample_rate, s->version, 0);
+ s->frame_len_bits = ff_wma_get_frame_len_bits(avctx->sample_rate,
+ s->version, 0);
s->next_block_len_bits = s->frame_len_bits;
s->prev_block_len_bits = s->frame_len_bits;
s->block_len_bits = s->frame_len_bits;
@@ -145,7 +103,7 @@ int ff_wma_init(AVCodecContext *avctx, int flags2)
if (s->use_variable_block_len) {
int nb_max, nb;
nb = ((flags2 >> 3) & 3) + 1;
- if ((s->bit_rate / s->nb_channels) >= 32000)
+ if ((avctx->bit_rate / avctx->channels) >= 32000)
nb += 2;
nb_max = s->frame_len_bits - BLOCK_MIN_BITS;
if (nb > nb_max)
@@ -157,10 +115,10 @@ int ff_wma_init(AVCodecContext *avctx, int flags2)
/* init rate dependent parameters */
s->use_noise_coding = 1;
- high_freq = s->sample_rate * 0.5;
+ high_freq = avctx->sample_rate * 0.5;
/* if version 2, then the rates are normalized */
- sample_rate1 = s->sample_rate;
+ sample_rate1 = avctx->sample_rate;
if (s->version == 2) {
if (sample_rate1 >= 44100) {
sample_rate1 = 44100;
@@ -175,13 +133,13 @@ int ff_wma_init(AVCodecContext *avctx, int flags2)
}
}
- bps = (float)s->bit_rate / (float)(s->nb_channels * s->sample_rate);
+ bps = (float)avctx->bit_rate / (float)(avctx->channels * avctx->sample_rate);
s->byte_offset_bits = av_log2((int)(bps * s->frame_len / 8.0 + 0.5)) + 2;
/* compute high frequency value and choose if noise coding should
be activated */
bps1 = bps;
- if (s->nb_channels == 2)
+ if (avctx->channels == 2)
bps1 = bps * 1.6;
if (sample_rate1 == 44100) {
if (bps1 >= 0.61) {
@@ -224,8 +182,8 @@ int ff_wma_init(AVCodecContext *avctx, int flags2)
}
av_dlog(s->avctx, "flags2=0x%x\n", flags2);
av_dlog(s->avctx, "version=%d channels=%d sample_rate=%d bitrate=%d block_align=%d\n",
- s->version, s->nb_channels, s->sample_rate, s->bit_rate,
- s->block_align);
+ s->version, avctx->channels, avctx->sample_rate, avctx->bit_rate,
+ avctx->block_align);
av_dlog(s->avctx, "bps=%f bps1=%f high_freq=%f bitoffset=%d\n",
bps, bps1, high_freq, s->byte_offset_bits);
av_dlog(s->avctx, "use_noise_coding=%d use_exp_vlc=%d nb_block_sizes=%d\n",
@@ -248,7 +206,7 @@ int ff_wma_init(AVCodecContext *avctx, int flags2)
lpos = 0;
for (i = 0; i < 25; i++) {
a = ff_wma_critical_freqs[i];
- b = s->sample_rate;
+ b = avctx->sample_rate;
pos = ((block_len * 2 * a) + (b >> 1)) / b;
if (pos > block_len)
pos = block_len;
@@ -265,11 +223,11 @@ int ff_wma_init(AVCodecContext *avctx, int flags2)
table = NULL;
a = s->frame_len_bits - BLOCK_MIN_BITS - k;
if (a < 3) {
- if (s->sample_rate >= 44100) {
+ if (avctx->sample_rate >= 44100) {
table = exponent_band_44100[a];
- } else if (s->sample_rate >= 32000) {
+ } else if (avctx->sample_rate >= 32000) {
table = exponent_band_32000[a];
- } else if (s->sample_rate >= 22050) {
+ } else if (avctx->sample_rate >= 22050) {
table = exponent_band_22050[a];
}
}
@@ -283,7 +241,7 @@ int ff_wma_init(AVCodecContext *avctx, int flags2)
lpos = 0;
for (i = 0; i < 25; i++) {
a = ff_wma_critical_freqs[i];
- b = s->sample_rate;
+ b = avctx->sample_rate;
pos = ((block_len * 2 * a) + (b << 1)) / (4 * b);
pos <<= 2;
if (pos > block_len)
@@ -302,7 +260,7 @@ int ff_wma_init(AVCodecContext *avctx, int flags2)
s->coefs_end[k] = (s->frame_len - ((s->frame_len * 9) / 100)) >> k;
/* high freq computation */
s->high_band_start[k] = (int)((block_len * 2 * high_freq) /
- s->sample_rate + 0.5);
+ avctx->sample_rate + 0.5);
n = s->exponent_sizes[k];
j = 0;
pos = 0;
@@ -382,7 +340,7 @@ int ff_wma_init(AVCodecContext *avctx, int flags2)
/* choose the VLC tables for the coefficients */
coef_vlc_table = 2;
- if (s->sample_rate >= 32000) {
+ if (avctx->sample_rate >= 32000) {
if (bps1 < 0.72) {
coef_vlc_table = 0;
} else if (bps1 < 1.16) {
@@ -525,4 +483,3 @@ int ff_wma_run_level_decode(AVCodecContext* avctx, GetBitContext* gb,
return 0;
}
-
diff --git a/gst-libs/ext/libav/libavcodec/wma.h b/gst-libs/ext/libav/libavcodec/wma.h
index d6f4880..fb2aa8b 100644
--- a/gst-libs/ext/libav/libavcodec/wma.h
+++ b/gst-libs/ext/libav/libavcodec/wma.h
@@ -22,6 +22,7 @@
#ifndef AVCODEC_WMA_H
#define AVCODEC_WMA_H
+#include "libavutil/float_dsp.h"
#include "get_bits.h"
#include "put_bits.h"
#include "dsputil.h"
@@ -68,11 +69,7 @@ typedef struct WMACodecContext {
AVFrame frame;
GetBitContext gb;
PutBitContext pb;
- int sample_rate;
- int nb_channels;
- int bit_rate;
int version; ///< 1 = 0x160 (WMAV1), 2 = 0x161 (WMAV2)
- int block_align;
int use_bit_reservoir;
int use_variable_block_len;
int use_exp_vlc; ///< exponent coding: 0 = lsp, 1 = vlc + delta
@@ -137,6 +134,7 @@ typedef struct WMACodecContext {
float lsp_pow_m_table2[(1 << LSP_POW_BITS)];
DSPContext dsp;
FmtConvertContext fmt_conv;
+ AVFloatDSPContext fdsp;
#ifdef TRACE
int frame_count;
@@ -150,8 +148,6 @@ extern const float ff_wma_lsp_codebook[NB_LSP_COEFS][16];
extern const uint32_t ff_aac_scalefactor_code[121];
extern const uint8_t ff_aac_scalefactor_bits[121];
-int av_cold ff_wma_get_frame_len_bits(int sample_rate, int version,
- unsigned int decode_flags);
int ff_wma_init(AVCodecContext * avctx, int flags2);
int ff_wma_total_gain_to_bits(int total_gain);
int ff_wma_end(AVCodecContext *avctx);
diff --git a/gst-libs/ext/libav/libavcodec/wma_common.c b/gst-libs/ext/libav/libavcodec/wma_common.c
new file mode 100644
index 0000000..d1d8045
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/wma_common.c
@@ -0,0 +1,62 @@
+/*
+ * common code shared by all WMA variants
+ *
+ * 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
+ */
+
+#include "libavutil/attributes.h"
+#include "wma_common.h"
+
+/**
+ *@brief Get the samples per frame for this stream.
+ *@param sample_rate output sample_rate
+ *@param version wma version
+ *@param decode_flags codec compression features
+ *@return log2 of the number of output samples per frame
+ */
+av_cold int ff_wma_get_frame_len_bits(int sample_rate, int version,
+ unsigned int decode_flags)
+{
+
+ int frame_len_bits;
+
+ if (sample_rate <= 16000) {
+ frame_len_bits = 9;
+ } else if (sample_rate <= 22050 ||
+ (sample_rate <= 32000 && version == 1)) {
+ frame_len_bits = 10;
+ } else if (sample_rate <= 48000 || version < 3) {
+ frame_len_bits = 11;
+ } else if (sample_rate <= 96000) {
+ frame_len_bits = 12;
+ } else {
+ frame_len_bits = 13;
+ }
+
+ if (version == 3) {
+ int tmp = decode_flags & 0x6;
+ if (tmp == 0x2) {
+ ++frame_len_bits;
+ } else if (tmp == 0x4) {
+ --frame_len_bits;
+ } else if (tmp == 0x6) {
+ frame_len_bits -= 2;
+ }
+ }
+
+ return frame_len_bits;
+}
diff --git a/gst-libs/ext/libav/libavcodec/wma_common.h b/gst-libs/ext/libav/libavcodec/wma_common.h
new file mode 100644
index 0000000..3a786c3
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/wma_common.h
@@ -0,0 +1,29 @@
+/*
+ * common code shared by all WMA variants
+ *
+ * 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
+ */
+
+#ifndef AVCODEC_WMA_COMMON_H
+#define AVCODEC_WMA_COMMON_H
+
+#include "libavutil/attributes.h"
+
+av_cold int ff_wma_get_frame_len_bits(int sample_rate, int version,
+ unsigned int decode_flags);
+
+#endif /* AVCODEC_WMA_COMMON_H */
diff --git a/gst-libs/ext/libav/libavcodec/wmadec.c b/gst-libs/ext/libav/libavcodec/wmadec.c
index c88a035..2f4afd3 100644
--- a/gst-libs/ext/libav/libavcodec/wmadec.c
+++ b/gst-libs/ext/libav/libavcodec/wmadec.c
@@ -34,6 +34,7 @@
*/
#include "avcodec.h"
+#include "internal.h"
#include "wma.h"
#undef NDEBUG
@@ -48,20 +49,6 @@
static void wma_lsp_to_curve_init(WMACodecContext *s, int frame_len);
#ifdef TRACE
-static void dump_shorts(WMACodecContext *s, const char *name, const short *tab, int n)
-{
- int i;
-
- tprintf(s->avctx, "%s[%d]:\n", name, n);
- for(i=0;i<n;i++) {
- if ((i & 7) == 0)
- tprintf(s->avctx, "%4d: ", i);
- tprintf(s->avctx, " %5d.0", tab[i]);
- if ((i & 7) == 7)
- tprintf(s->avctx, "\n");
- }
-}
-
static void dump_floats(WMACodecContext *s, const char *name, int prec, const float *tab, int n)
{
int i;
@@ -95,13 +82,11 @@ static int wma_decode_init(AVCodecContext * avctx)
/* extract flag infos */
flags2 = 0;
extradata = avctx->extradata;
- if (avctx->codec->id == CODEC_ID_WMAV1 && avctx->extradata_size >= 4) {
+ if (avctx->codec->id == AV_CODEC_ID_WMAV1 && avctx->extradata_size >= 4) {
flags2 = AV_RL16(extradata+2);
- } else if (avctx->codec->id == CODEC_ID_WMAV2 && avctx->extradata_size >= 6) {
+ } else if (avctx->codec->id == AV_CODEC_ID_WMAV2 && avctx->extradata_size >= 6) {
flags2 = AV_RL16(extradata+4);
}
-// for(i=0; i<avctx->extradata_size; i++)
-// av_log(NULL, AV_LOG_ERROR, "%02X ", extradata[i]);
s->use_exp_vlc = flags2 & 0x0001;
s->use_bit_reservoir = flags2 & 0x0002;
@@ -112,7 +97,7 @@ static int wma_decode_init(AVCodecContext * avctx)
/* init MDCT */
for(i = 0; i < s->nb_block_sizes; i++)
- ff_mdct_init(&s->mdct_ctx[i], s->frame_len_bits - i + 1, 1, 1.0);
+ ff_mdct_init(&s->mdct_ctx[i], s->frame_len_bits - i + 1, 1, 1.0 / 32768.0);
if (s->use_noise_coding) {
init_vlc(&s->hgain_vlc, HGAINVLCBITS, sizeof(ff_wma_hgain_huffbits),
@@ -128,7 +113,7 @@ static int wma_decode_init(AVCodecContext * avctx)
wma_lsp_to_curve_init(s, s->frame_len);
}
- avctx->sample_fmt = AV_SAMPLE_FMT_S16;
+ avctx->sample_fmt = AV_SAMPLE_FMT_FLTP;
avcodec_get_frame_defaults(&s->frame);
avctx->coded_frame = &s->frame;
@@ -496,11 +481,11 @@ static int wma_decode_block(WMACodecContext *s)
return -1;
}
- if (s->nb_channels == 2) {
+ if (s->avctx->channels == 2) {
s->ms_stereo = get_bits1(&s->gb);
}
v = 0;
- for(ch = 0; ch < s->nb_channels; ch++) {
+ for(ch = 0; ch < s->avctx->channels; ch++) {
a = get_bits1(&s->gb);
s->channel_coded[ch] = a;
v |= a;
@@ -527,13 +512,13 @@ static int wma_decode_block(WMACodecContext *s)
/* compute number of coefficients */
n = s->coefs_end[bsize] - s->coefs_start;
- for(ch = 0; ch < s->nb_channels; ch++)
+ for(ch = 0; ch < s->avctx->channels; ch++)
nb_coefs[ch] = n;
/* complex coding */
if (s->use_noise_coding) {
- for(ch = 0; ch < s->nb_channels; ch++) {
+ for(ch = 0; ch < s->avctx->channels; ch++) {
if (s->channel_coded[ch]) {
int i, n, a;
n = s->exponent_high_sizes[bsize];
@@ -546,7 +531,7 @@ static int wma_decode_block(WMACodecContext *s)
}
}
}
- for(ch = 0; ch < s->nb_channels; ch++) {
+ for(ch = 0; ch < s->avctx->channels; ch++) {
if (s->channel_coded[ch]) {
int i, n, val, code;
@@ -574,7 +559,7 @@ static int wma_decode_block(WMACodecContext *s)
/* exponents can be reused in short blocks. */
if ((s->block_len_bits == s->frame_len_bits) ||
get_bits1(&s->gb)) {
- for(ch = 0; ch < s->nb_channels; ch++) {
+ for(ch = 0; ch < s->avctx->channels; ch++) {
if (s->channel_coded[ch]) {
if (s->use_exp_vlc) {
if (decode_exp_vlc(s, ch) < 0)
@@ -588,7 +573,7 @@ static int wma_decode_block(WMACodecContext *s)
}
/* parse spectral coefficients : just RLE encoding */
- for(ch = 0; ch < s->nb_channels; ch++) {
+ for (ch = 0; ch < s->avctx->channels; ch++) {
if (s->channel_coded[ch]) {
int tindex;
WMACoef* ptr = &s->coefs1[ch][0];
@@ -602,7 +587,7 @@ static int wma_decode_block(WMACodecContext *s)
0, ptr, 0, nb_coefs[ch],
s->block_len, s->frame_len_bits, coef_nb_bits);
}
- if (s->version == 1 && s->nb_channels >= 2) {
+ if (s->version == 1 && s->avctx->channels >= 2) {
align_get_bits(&s->gb);
}
}
@@ -617,7 +602,7 @@ static int wma_decode_block(WMACodecContext *s)
}
/* finally compute the MDCT coefficients */
- for(ch = 0; ch < s->nb_channels; ch++) {
+ for (ch = 0; ch < s->avctx->channels; ch++) {
if (s->channel_coded[ch]) {
WMACoef *coefs1;
float *coefs, *exponents, mult, mult1, noise;
@@ -721,7 +706,7 @@ static int wma_decode_block(WMACodecContext *s)
}
#ifdef TRACE
- for(ch = 0; ch < s->nb_channels; ch++) {
+ for (ch = 0; ch < s->avctx->channels; ch++) {
if (s->channel_coded[ch]) {
dump_floats(s, "exponents", 3, s->exponents[ch], s->block_len);
dump_floats(s, "coefs", 1, s->coefs[ch], s->block_len);
@@ -745,7 +730,7 @@ static int wma_decode_block(WMACodecContext *s)
next:
mdct = &s->mdct_ctx[bsize];
- for(ch = 0; ch < s->nb_channels; ch++) {
+ for (ch = 0; ch < s->avctx->channels; ch++) {
int n4, index;
n4 = s->block_len / 2;
@@ -769,10 +754,10 @@ next:
}
/* decode a frame of frame_len samples */
-static int wma_decode_frame(WMACodecContext *s, int16_t *samples)
+static int wma_decode_frame(WMACodecContext *s, float **samples,
+ int samples_offset)
{
- int ret, n, ch, incr;
- const float *output[MAX_CHANNELS];
+ int ret, ch;
#ifdef TRACE
tprintf(s->avctx, "***decode_frame: %d size=%d\n", s->frame_count++, s->frame_len);
@@ -789,20 +774,19 @@ static int wma_decode_frame(WMACodecContext *s, int16_t *samples)
break;
}
- /* convert frame to integer */
- n = s->frame_len;
- incr = s->nb_channels;
- for (ch = 0; ch < MAX_CHANNELS; ch++)
- output[ch] = s->frame_out[ch];
- s->fmt_conv.float_to_int16_interleave(samples, output, n, incr);
- for (ch = 0; ch < incr; ch++) {
+ for (ch = 0; ch < s->avctx->channels; ch++) {
+ /* copy current block to output */
+ memcpy(samples[ch] + samples_offset, s->frame_out[ch],
+ s->frame_len * sizeof(*s->frame_out[ch]));
/* prepare for next block */
- memmove(&s->frame_out[ch][0], &s->frame_out[ch][n], n * sizeof(float));
- }
+ memmove(&s->frame_out[ch][0], &s->frame_out[ch][s->frame_len],
+ s->frame_len * sizeof(*s->frame_out[ch]));
#ifdef TRACE
- dump_shorts(s, "samples", samples, n * s->nb_channels);
+ dump_floats(s, "samples", 6, samples[ch] + samples_offset, s->frame_len);
#endif
+ }
+
return 0;
}
@@ -814,7 +798,8 @@ static int wma_decode_superframe(AVCodecContext *avctx, void *data,
WMACodecContext *s = avctx->priv_data;
int nb_frames, bit_offset, i, pos, len, ret;
uint8_t *q;
- int16_t *samples;
+ float **samples;
+ int samples_offset;
tprintf(avctx, "***decode_superframe:\n");
@@ -822,13 +807,13 @@ static int wma_decode_superframe(AVCodecContext *avctx, void *data,
s->last_superframe_len = 0;
return 0;
}
- if (buf_size < s->block_align) {
+ if (buf_size < avctx->block_align) {
av_log(avctx, AV_LOG_ERROR,
"Input packet size too small (%d < %d)\n",
- buf_size, s->block_align);
+ buf_size, avctx->block_align);
return AVERROR_INVALIDDATA;
}
- buf_size = s->block_align;
+ buf_size = avctx->block_align;
init_get_bits(&s->gb, buf, buf_size*8);
@@ -842,11 +827,12 @@ static int wma_decode_superframe(AVCodecContext *avctx, void *data,
/* get output buffer */
s->frame.nb_samples = nb_frames * s->frame_len;
- if ((ret = avctx->get_buffer(avctx, &s->frame)) < 0) {
+ if ((ret = ff_get_buffer(avctx, &s->frame)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return ret;
}
- samples = (int16_t *)s->frame.data[0];
+ samples = (float **)s->frame.extended_data;
+ samples_offset = 0;
if (s->use_bit_reservoir) {
bit_offset = get_bits(&s->gb, s->byte_offset_bits + 3);
@@ -858,7 +844,6 @@ static int wma_decode_superframe(AVCodecContext *avctx, void *data,
}
if (s->last_superframe_len > 0) {
- // printf("skip=%d\n", s->last_bitoffset);
/* add bit_offset bits to last frame */
if ((s->last_superframe_len + ((bit_offset + 7) >> 3)) >
MAX_CODED_SUPERFRAME_SIZE)
@@ -881,9 +866,9 @@ static int wma_decode_superframe(AVCodecContext *avctx, void *data,
skip_bits(&s->gb, s->last_bitoffset);
/* this frame is stored in the last superframe and in the
current one */
- if (wma_decode_frame(s, samples) < 0)
+ if (wma_decode_frame(s, samples, samples_offset) < 0)
goto fail;
- samples += s->nb_channels * s->frame_len;
+ samples_offset += s->frame_len;
nb_frames--;
}
@@ -898,9 +883,9 @@ static int wma_decode_superframe(AVCodecContext *avctx, void *data,
s->reset_block_lengths = 1;
for(i=0;i<nb_frames;i++) {
- if (wma_decode_frame(s, samples) < 0)
+ if (wma_decode_frame(s, samples, samples_offset) < 0)
goto fail;
- samples += s->nb_channels * s->frame_len;
+ samples_offset += s->frame_len;
}
/* we copy the end of the frame in the last frame buffer */
@@ -916,17 +901,19 @@ static int wma_decode_superframe(AVCodecContext *avctx, void *data,
memcpy(s->last_superframe, buf + pos, len);
} else {
/* single frame decode */
- if (wma_decode_frame(s, samples) < 0)
+ if (wma_decode_frame(s, samples, samples_offset) < 0)
goto fail;
- samples += s->nb_channels * s->frame_len;
+ samples_offset += s->frame_len;
}
-//av_log(NULL, AV_LOG_ERROR, "%d %d %d %d outbytes:%d eaten:%d\n", s->frame_len_bits, s->block_len_bits, s->frame_len, s->block_len, (int8_t *)samples - (int8_t *)data, s->block_align);
+ av_dlog(s->avctx, "%d %d %d %d outbytes:%td eaten:%d\n",
+ s->frame_len_bits, s->block_len_bits, s->frame_len, s->block_len,
+ (int8_t *)samples - (int8_t *)data, avctx->block_align);
*got_frame_ptr = 1;
*(AVFrame *)data = s->frame;
- return s->block_align;
+ return avctx->block_align;
fail:
/* when error, we reset the bit reservoir */
s->last_superframe_len = 0;
@@ -944,7 +931,7 @@ static av_cold void flush(AVCodecContext *avctx)
AVCodec ff_wmav1_decoder = {
.name = "wmav1",
.type = AVMEDIA_TYPE_AUDIO,
- .id = CODEC_ID_WMAV1,
+ .id = AV_CODEC_ID_WMAV1,
.priv_data_size = sizeof(WMACodecContext),
.init = wma_decode_init,
.close = ff_wma_end,
@@ -952,12 +939,14 @@ AVCodec ff_wmav1_decoder = {
.flush = flush,
.capabilities = CODEC_CAP_DR1,
.long_name = NULL_IF_CONFIG_SMALL("Windows Media Audio 1"),
+ .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP,
+ AV_SAMPLE_FMT_NONE },
};
AVCodec ff_wmav2_decoder = {
.name = "wmav2",
.type = AVMEDIA_TYPE_AUDIO,
- .id = CODEC_ID_WMAV2,
+ .id = AV_CODEC_ID_WMAV2,
.priv_data_size = sizeof(WMACodecContext),
.init = wma_decode_init,
.close = ff_wma_end,
@@ -965,4 +954,6 @@ AVCodec ff_wmav2_decoder = {
.flush = flush,
.capabilities = CODEC_CAP_DR1,
.long_name = NULL_IF_CONFIG_SMALL("Windows Media Audio 2"),
+ .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP,
+ AV_SAMPLE_FMT_NONE },
};
diff --git a/gst-libs/ext/libav/libavcodec/wmaenc.c b/gst-libs/ext/libav/libavcodec/wmaenc.c
index df59cab..044114b 100644
--- a/gst-libs/ext/libav/libavcodec/wmaenc.c
+++ b/gst-libs/ext/libav/libavcodec/wmaenc.c
@@ -20,6 +20,7 @@
*/
#include "avcodec.h"
+#include "internal.h"
#include "wma.h"
#undef NDEBUG
@@ -28,7 +29,7 @@
static int encode_init(AVCodecContext * avctx){
WMACodecContext *s = avctx->priv_data;
- int i, flags1, flags2;
+ int i, flags1, flags2, block_align;
uint8_t *extradata;
s->avctx = avctx;
@@ -54,12 +55,12 @@ static int encode_init(AVCodecContext * avctx){
/* extract flag infos */
flags1 = 0;
flags2 = 1;
- if (avctx->codec->id == CODEC_ID_WMAV1) {
+ if (avctx->codec->id == AV_CODEC_ID_WMAV1) {
extradata= av_malloc(4);
avctx->extradata_size= 4;
AV_WL16(extradata, flags1);
AV_WL16(extradata+2, flags2);
- } else if (avctx->codec->id == CODEC_ID_WMAV2) {
+ } else if (avctx->codec->id == AV_CODEC_ID_WMAV2) {
extradata= av_mallocz(10);
avctx->extradata_size= 10;
AV_WL32(extradata, flags1);
@@ -79,36 +80,41 @@ static int encode_init(AVCodecContext * avctx){
for(i = 0; i < s->nb_block_sizes; i++)
ff_mdct_init(&s->mdct_ctx[i], s->frame_len_bits - i + 1, 0, 1.0);
- s->block_align = avctx->bit_rate * (int64_t)s->frame_len /
+ block_align = avctx->bit_rate * (int64_t)s->frame_len /
(avctx->sample_rate * 8);
- s->block_align = FFMIN(s->block_align, MAX_CODED_SUPERFRAME_SIZE);
- avctx->block_align = s->block_align;
+ block_align = FFMIN(block_align, MAX_CODED_SUPERFRAME_SIZE);
+ avctx->block_align = block_align;
avctx->bit_rate = avctx->block_align * 8LL * avctx->sample_rate /
s->frame_len;
-//av_log(NULL, AV_LOG_ERROR, "%d %d %d %d\n", s->block_align, avctx->bit_rate, s->frame_len, avctx->sample_rate);
- avctx->frame_size= s->frame_len;
+ avctx->frame_size = avctx->delay = s->frame_len;
+
+#if FF_API_OLD_ENCODE_AUDIO
+ avctx->coded_frame = &s->frame;
+ avcodec_get_frame_defaults(avctx->coded_frame);
+#endif
return 0;
}
-static void apply_window_and_mdct(AVCodecContext * avctx, const signed short * audio, int len) {
+static void apply_window_and_mdct(AVCodecContext * avctx, const AVFrame *frame)
+{
WMACodecContext *s = avctx->priv_data;
+ float **audio = (float **)frame->extended_data;
+ int len = frame->nb_samples;
int window_index= s->frame_len_bits - s->block_len_bits;
FFTContext *mdct = &s->mdct_ctx[window_index];
- int i, j, channel;
+ int ch;
const float * win = s->windows[window_index];
int window_len = 1 << s->block_len_bits;
- float n = window_len/2;
-
- for (channel = 0; channel < avctx->channels; channel++) {
- memcpy(s->output, s->frame_out[channel], sizeof(float)*window_len);
- j = channel;
- for (i = 0; i < len; i++, j += avctx->channels){
- s->output[i+window_len] = audio[j] / n * win[window_len - i - 1];
- s->frame_out[channel][i] = audio[j] / n * win[i];
- }
- mdct->mdct_calc(mdct, s->coefs[channel], s->output);
+ float n = 2.0 * 32768.0 / window_len;
+
+ for (ch = 0; ch < avctx->channels; ch++) {
+ memcpy(s->output, s->frame_out[ch], window_len * sizeof(*s->output));
+ s->fdsp.vector_fmul_scalar(s->frame_out[ch], audio[ch], n, len);
+ s->dsp.vector_fmul_reverse(&s->output[window_len], s->frame_out[ch], win, len);
+ s->fdsp.vector_fmul(s->frame_out[ch], s->frame_out[ch], win, len);
+ mdct->mdct_calc(mdct, s->coefs[ch], s->output);
}
}
@@ -182,7 +188,7 @@ static int encode_block(WMACodecContext *s, float (*src_coefs)[BLOCK_MAX_SIZE],
//FIXME factor
v = s->coefs_end[bsize] - s->coefs_start;
- for(ch = 0; ch < s->nb_channels; ch++)
+ for (ch = 0; ch < s->avctx->channels; ch++)
nb_coefs[ch] = v;
{
int n4 = s->block_len / 2;
@@ -192,18 +198,18 @@ static int encode_block(WMACodecContext *s, float (*src_coefs)[BLOCK_MAX_SIZE],
}
}
- if (s->nb_channels == 2) {
+ if (s->avctx->channels == 2) {
put_bits(&s->pb, 1, !!s->ms_stereo);
}
- for(ch = 0; ch < s->nb_channels; ch++) {
+ for (ch = 0; ch < s->avctx->channels; ch++) {
s->channel_coded[ch] = 1; //FIXME only set channel_coded when needed, instead of always
if (s->channel_coded[ch]) {
init_exp(s, ch, fixed_exp);
}
}
- for(ch = 0; ch < s->nb_channels; ch++) {
+ for (ch = 0; ch < s->avctx->channels; ch++) {
if (s->channel_coded[ch]) {
WMACoef *coefs1;
float *coefs, *exponents, mult;
@@ -231,7 +237,7 @@ static int encode_block(WMACodecContext *s, float (*src_coefs)[BLOCK_MAX_SIZE],
}
v = 0;
- for(ch = 0; ch < s->nb_channels; ch++) {
+ for (ch = 0; ch < s->avctx->channels; ch++) {
int a = s->channel_coded[ch];
put_bits(&s->pb, 1, a);
v |= a;
@@ -247,7 +253,7 @@ static int encode_block(WMACodecContext *s, float (*src_coefs)[BLOCK_MAX_SIZE],
coef_nb_bits= ff_wma_total_gain_to_bits(total_gain);
if (s->use_noise_coding) {
- for(ch = 0; ch < s->nb_channels; ch++) {
+ for (ch = 0; ch < s->avctx->channels; ch++) {
if (s->channel_coded[ch]) {
int i, n;
n = s->exponent_high_sizes[bsize];
@@ -266,7 +272,7 @@ static int encode_block(WMACodecContext *s, float (*src_coefs)[BLOCK_MAX_SIZE],
}
if (parse_exponents) {
- for(ch = 0; ch < s->nb_channels; ch++) {
+ for (ch = 0; ch < s->avctx->channels; ch++) {
if (s->channel_coded[ch]) {
if (s->use_exp_vlc) {
encode_exp_vlc(s, ch, fixed_exp);
@@ -280,7 +286,7 @@ static int encode_block(WMACodecContext *s, float (*src_coefs)[BLOCK_MAX_SIZE],
assert(0); //FIXME not implemented
}
- for(ch = 0; ch < s->nb_channels; ch++) {
+ for (ch = 0; ch < s->avctx->channels; ch++) {
if (s->channel_coded[ch]) {
int run, tindex;
WMACoef *ptr, *eptr;
@@ -306,10 +312,6 @@ static int encode_block(WMACodecContext *s, float (*src_coefs)[BLOCK_MAX_SIZE],
if(1<<coef_nb_bits <= abs_level)
return -1;
-
- //Workaround minor rounding differences for the regression tests, FIXME we should find and replace the problematic float by fixpoint for reg tests
- if(abs_level == 0x71B && (s->avctx->flags & CODEC_FLAG_BITEXACT)) abs_level=0x71A;
-
put_bits(&s->pb, coef_nb_bits, abs_level);
put_bits(&s->pb, s->frame_len_bits, run);
}
@@ -322,7 +324,7 @@ static int encode_block(WMACodecContext *s, float (*src_coefs)[BLOCK_MAX_SIZE],
if(run)
put_bits(&s->pb, s->coef_vlcs[tindex]->huffbits[1], s->coef_vlcs[tindex]->huffcodes[1]);
}
- if (s->version == 1 && s->nb_channels >= 2) {
+ if (s->version == 1 && s->avctx->channels >= 2) {
avpriv_align_put_bits(&s->pb);
}
}
@@ -341,19 +343,19 @@ static int encode_frame(WMACodecContext *s, float (*src_coefs)[BLOCK_MAX_SIZE],
avpriv_align_put_bits(&s->pb);
- return put_bits_count(&s->pb)/8 - s->block_align;
+ return put_bits_count(&s->pb) / 8 - s->avctx->block_align;
}
-static int encode_superframe(AVCodecContext *avctx,
- unsigned char *buf, int buf_size, void *data){
+static int encode_superframe(AVCodecContext *avctx, AVPacket *avpkt,
+ const AVFrame *frame, int *got_packet_ptr)
+{
WMACodecContext *s = avctx->priv_data;
- const short *samples = data;
- int i, total_gain;
+ int i, total_gain, ret;
s->block_len_bits= s->frame_len_bits; //required by non variable block len
s->block_len = 1 << s->block_len_bits;
- apply_window_and_mdct(avctx, samples, avctx->frame_size);
+ apply_window_and_mdct(avctx, frame);
if (s->ms_stereo) {
float a, b;
@@ -367,24 +369,25 @@ static int encode_superframe(AVCodecContext *avctx,
}
}
- if (buf_size < 2 * MAX_CODED_SUPERFRAME_SIZE) {
- av_log(avctx, AV_LOG_ERROR, "output buffer size is too small\n");
- return AVERROR(EINVAL);
+ if ((ret = ff_alloc_packet(avpkt, 2 * MAX_CODED_SUPERFRAME_SIZE))) {
+ av_log(avctx, AV_LOG_ERROR, "Error getting output packet\n");
+ return ret;
}
#if 1
total_gain= 128;
for(i=64; i; i>>=1){
- int error= encode_frame(s, s->coefs, buf, buf_size, total_gain-i);
+ int error = encode_frame(s, s->coefs, avpkt->data, avpkt->size,
+ total_gain - i);
if(error<0)
total_gain-= i;
}
#else
total_gain= 90;
- best= encode_frame(s, s->coefs, buf, buf_size, total_gain);
+ best = encode_frame(s, s->coefs, avpkt->data, avpkt->size, total_gain);
for(i=32; i; i>>=1){
- int scoreL= encode_frame(s, s->coefs, buf, buf_size, total_gain-i);
- int scoreR= encode_frame(s, s->coefs, buf, buf_size, total_gain+i);
+ int scoreL = encode_frame(s, s->coefs, avpkt->data, avpkt->size, total_gain - i);
+ int scoreR = encode_frame(s, s->coefs, avpkt->data, avpkt->size, total_gain + i);
av_log(NULL, AV_LOG_ERROR, "%d %d %d (%d)\n", scoreL, best, scoreR, total_gain);
if(scoreL < FFMIN(best, scoreR)){
best = scoreL;
@@ -396,37 +399,47 @@ static int encode_superframe(AVCodecContext *avctx,
}
#endif
- encode_frame(s, s->coefs, buf, buf_size, total_gain);
+ if ((i = encode_frame(s, s->coefs, avpkt->data, avpkt->size, total_gain)) >= 0) {
+ av_log(avctx, AV_LOG_ERROR, "required frame size too large. please "
+ "use a higher bit rate.\n");
+ return AVERROR(EINVAL);
+ }
assert((put_bits_count(&s->pb) & 7) == 0);
- i= s->block_align - (put_bits_count(&s->pb)+7)/8;
- assert(i>=0);
- while(i--)
+ while (i++)
put_bits(&s->pb, 8, 'N');
flush_put_bits(&s->pb);
- return put_bits_ptr(&s->pb) - s->pb.buf;
+
+ if (frame->pts != AV_NOPTS_VALUE)
+ avpkt->pts = frame->pts - ff_samples_to_time_base(avctx, avctx->delay);
+
+ avpkt->size = avctx->block_align;
+ *got_packet_ptr = 1;
+ return 0;
}
AVCodec ff_wmav1_encoder = {
.name = "wmav1",
.type = AVMEDIA_TYPE_AUDIO,
- .id = CODEC_ID_WMAV1,
+ .id = AV_CODEC_ID_WMAV1,
.priv_data_size = sizeof(WMACodecContext),
.init = encode_init,
- .encode = encode_superframe,
+ .encode2 = encode_superframe,
.close = ff_wma_end,
- .sample_fmts = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_NONE},
+ .sample_fmts = (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_FLTP,
+ AV_SAMPLE_FMT_NONE },
.long_name = NULL_IF_CONFIG_SMALL("Windows Media Audio 1"),
};
AVCodec ff_wmav2_encoder = {
.name = "wmav2",
.type = AVMEDIA_TYPE_AUDIO,
- .id = CODEC_ID_WMAV2,
+ .id = AV_CODEC_ID_WMAV2,
.priv_data_size = sizeof(WMACodecContext),
.init = encode_init,
- .encode = encode_superframe,
+ .encode2 = encode_superframe,
.close = ff_wma_end,
- .sample_fmts = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_NONE},
+ .sample_fmts = (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_FLTP,
+ AV_SAMPLE_FMT_NONE },
.long_name = NULL_IF_CONFIG_SMALL("Windows Media Audio 2"),
};
diff --git a/gst-libs/ext/libav/libavcodec/wmalosslessdec.c b/gst-libs/ext/libav/libavcodec/wmalosslessdec.c
new file mode 100644
index 0000000..747ac37
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/wmalosslessdec.c
@@ -0,0 +1,1300 @@
+/*
+ * Windows Media Audio Lossless decoder
+ * Copyright (c) 2007 Baptiste Coudurier, Benjamin Larsson, Ulion
+ * Copyright (c) 2008 - 2011 Sascha Sommer, Benjamin Larsson
+ * Copyright (c) 2011 Andreas Öman
+ * Copyright (c) 2011 - 2012 Mashiat Sarker Shakkhar
+ *
+ * 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
+ */
+
+#include "libavutil/attributes.h"
+#include "libavutil/avassert.h"
+
+#include "avcodec.h"
+#include "internal.h"
+#include "get_bits.h"
+#include "put_bits.h"
+#include "wma.h"
+#include "wma_common.h"
+
+/** current decoder limitations */
+#define WMALL_MAX_CHANNELS 8 ///< max number of handled channels
+#define MAX_SUBFRAMES 32 ///< max number of subframes per channel
+#define MAX_BANDS 29 ///< max number of scale factor bands
+#define MAX_FRAMESIZE 32768 ///< maximum compressed frame size
+#define MAX_ORDER 256
+
+#define WMALL_BLOCK_MIN_BITS 6 ///< log2 of min block size
+#define WMALL_BLOCK_MAX_BITS 14 ///< log2 of max block size
+#define WMALL_BLOCK_MAX_SIZE (1 << WMALL_BLOCK_MAX_BITS) ///< maximum block size
+#define WMALL_BLOCK_SIZES (WMALL_BLOCK_MAX_BITS - WMALL_BLOCK_MIN_BITS + 1) ///< possible block sizes
+
+
+/**
+ * @brief frame-specific decoder context for a single channel
+ */
+typedef struct {
+ int16_t prev_block_len; ///< length of the previous block
+ uint8_t transmit_coefs;
+ uint8_t num_subframes;
+ uint16_t subframe_len[MAX_SUBFRAMES]; ///< subframe length in samples
+ uint16_t subframe_offsets[MAX_SUBFRAMES]; ///< subframe positions in the current frame
+ uint8_t cur_subframe; ///< current subframe number
+ uint16_t decoded_samples; ///< number of already processed samples
+ int quant_step; ///< quantization step for the current subframe
+ int transient_counter; ///< number of transient samples from the beginning of the transient zone
+} WmallChannelCtx;
+
+/**
+ * @brief main decoder context
+ */
+typedef struct WmallDecodeCtx {
+ /* generic decoder variables */
+ AVCodecContext *avctx;
+ AVFrame frame;
+ uint8_t frame_data[MAX_FRAMESIZE + FF_INPUT_BUFFER_PADDING_SIZE]; ///< compressed frame data
+ PutBitContext pb; ///< context for filling the frame_data buffer
+
+ /* frame size dependent frame information (set during initialization) */
+ uint32_t decode_flags; ///< used compression features
+ int len_prefix; ///< frame is prefixed with its length
+ int dynamic_range_compression; ///< frame contains DRC data
+ uint8_t bits_per_sample; ///< integer audio sample size for the unscaled IMDCT output (used to scale to [-1.0, 1.0])
+ uint16_t samples_per_frame; ///< number of samples to output
+ uint16_t log2_frame_size;
+ int8_t num_channels; ///< number of channels in the stream (same as AVCodecContext.num_channels)
+ int8_t lfe_channel; ///< lfe channel index
+ uint8_t max_num_subframes;
+ uint8_t subframe_len_bits; ///< number of bits used for the subframe length
+ uint8_t max_subframe_len_bit; ///< flag indicating that the subframe is of maximum size when the first subframe length bit is 1
+ uint16_t min_samples_per_subframe;
+
+ /* packet decode state */
+ GetBitContext pgb; ///< bitstream reader context for the packet
+ int next_packet_start; ///< start offset of the next WMA packet in the demuxer packet
+ uint8_t packet_offset; ///< offset to the frame in the packet
+ uint8_t packet_sequence_number; ///< current packet number
+ int num_saved_bits; ///< saved number of bits
+ int frame_offset; ///< frame offset in the bit reservoir
+ int subframe_offset; ///< subframe offset in the bit reservoir
+ uint8_t packet_loss; ///< set in case of bitstream error
+ uint8_t packet_done; ///< set when a packet is fully decoded
+
+ /* frame decode state */
+ uint32_t frame_num; ///< current frame number (not used for decoding)
+ GetBitContext gb; ///< bitstream reader context
+ int buf_bit_size; ///< buffer size in bits
+ int16_t *samples_16[WMALL_MAX_CHANNELS]; ///< current samplebuffer pointer (16-bit)
+ int32_t *samples_32[WMALL_MAX_CHANNELS]; ///< current samplebuffer pointer (24-bit)
+ uint8_t drc_gain; ///< gain for the DRC tool
+ int8_t skip_frame; ///< skip output step
+ int8_t parsed_all_subframes; ///< all subframes decoded?
+
+ /* subframe/block decode state */
+ int16_t subframe_len; ///< current subframe length
+ int8_t channels_for_cur_subframe; ///< number of channels that contain the subframe
+ int8_t channel_indexes_for_cur_subframe[WMALL_MAX_CHANNELS];
+
+ WmallChannelCtx channel[WMALL_MAX_CHANNELS]; ///< per channel data
+
+ // WMA Lossless-specific
+
+ uint8_t do_arith_coding;
+ uint8_t do_ac_filter;
+ uint8_t do_inter_ch_decorr;
+ uint8_t do_mclms;
+ uint8_t do_lpc;
+
+ int8_t acfilter_order;
+ int8_t acfilter_scaling;
+ int64_t acfilter_coeffs[16];
+ int acfilter_prevvalues[2][16];
+
+ int8_t mclms_order;
+ int8_t mclms_scaling;
+ int16_t mclms_coeffs[128];
+ int16_t mclms_coeffs_cur[4];
+ int16_t mclms_prevvalues[WMALL_MAX_CHANNELS * 2 * 32];
+ int16_t mclms_updates[WMALL_MAX_CHANNELS * 2 * 32];
+ int mclms_recent;
+
+ int movave_scaling;
+ int quant_stepsize;
+
+ struct {
+ int order;
+ int scaling;
+ int coefsend;
+ int bitsend;
+ int16_t coefs[MAX_ORDER];
+ int16_t lms_prevvalues[MAX_ORDER * 2];
+ int16_t lms_updates[MAX_ORDER * 2];
+ int recent;
+ } cdlms[2][9];
+
+ int cdlms_ttl[2];
+
+ int bV3RTM;
+
+ int is_channel_coded[2];
+ int update_speed[2];
+
+ int transient[2];
+ int transient_pos[2];
+ int seekable_tile;
+
+ int ave_sum[2];
+
+ int channel_residues[2][WMALL_BLOCK_MAX_SIZE];
+
+ int lpc_coefs[2][40];
+ int lpc_order;
+ int lpc_scaling;
+ int lpc_intbits;
+
+ int channel_coeffs[2][WMALL_BLOCK_MAX_SIZE];
+} WmallDecodeCtx;
+
+
+static av_cold int decode_init(AVCodecContext *avctx)
+{
+ WmallDecodeCtx *s = avctx->priv_data;
+ uint8_t *edata_ptr = avctx->extradata;
+ unsigned int channel_mask;
+ int i, log2_max_num_subframes;
+
+ s->avctx = avctx;
+ init_put_bits(&s->pb, s->frame_data, MAX_FRAMESIZE);
+
+ if (avctx->extradata_size >= 18) {
+ s->decode_flags = AV_RL16(edata_ptr + 14);
+ channel_mask = AV_RL32(edata_ptr + 2);
+ s->bits_per_sample = AV_RL16(edata_ptr);
+ if (s->bits_per_sample == 16)
+ avctx->sample_fmt = AV_SAMPLE_FMT_S16P;
+ else if (s->bits_per_sample == 24) {
+ avctx->sample_fmt = AV_SAMPLE_FMT_S32P;
+ av_log_missing_feature(avctx, "Bit-depth higher than 16", 0);
+ return AVERROR_PATCHWELCOME;
+ } else {
+ av_log(avctx, AV_LOG_ERROR, "Unknown bit-depth: %d\n",
+ s->bits_per_sample);
+ return AVERROR_INVALIDDATA;
+ }
+ /* dump the extradata */
+ for (i = 0; i < avctx->extradata_size; i++)
+ av_dlog(avctx, "[%x] ", avctx->extradata[i]);
+ av_dlog(avctx, "\n");
+
+ } else {
+ av_log_ask_for_sample(avctx, "Unsupported extradata size\n");
+ return AVERROR_PATCHWELCOME;
+ }
+
+ /* generic init */
+ s->log2_frame_size = av_log2(avctx->block_align) + 4;
+
+ /* frame info */
+ s->skip_frame = 1; /* skip first frame */
+ s->packet_loss = 1;
+ s->len_prefix = s->decode_flags & 0x40;
+
+ /* get frame len */
+ s->samples_per_frame = 1 << ff_wma_get_frame_len_bits(avctx->sample_rate,
+ 3, s->decode_flags);
+ av_assert0(s->samples_per_frame <= WMALL_BLOCK_MAX_SIZE);
+
+ /* init previous block len */
+ for (i = 0; i < avctx->channels; i++)
+ s->channel[i].prev_block_len = s->samples_per_frame;
+
+ /* subframe info */
+ log2_max_num_subframes = (s->decode_flags & 0x38) >> 3;
+ s->max_num_subframes = 1 << log2_max_num_subframes;
+ s->max_subframe_len_bit = 0;
+ s->subframe_len_bits = av_log2(log2_max_num_subframes) + 1;
+
+ s->min_samples_per_subframe = s->samples_per_frame / s->max_num_subframes;
+ s->dynamic_range_compression = s->decode_flags & 0x80;
+ s->bV3RTM = s->decode_flags & 0x100;
+
+ if (s->max_num_subframes > MAX_SUBFRAMES) {
+ av_log(avctx, AV_LOG_ERROR, "invalid number of subframes %i\n",
+ s->max_num_subframes);
+ return AVERROR_INVALIDDATA;
+ }
+
+ s->num_channels = avctx->channels;
+
+ /* extract lfe channel position */
+ s->lfe_channel = -1;
+
+ if (channel_mask & 8) {
+ unsigned int mask;
+ for (mask = 1; mask < 16; mask <<= 1)
+ if (channel_mask & mask)
+ ++s->lfe_channel;
+ }
+
+ if (s->num_channels < 0) {
+ av_log(avctx, AV_LOG_ERROR, "invalid number of channels %d\n",
+ s->num_channels);
+ return AVERROR_INVALIDDATA;
+ } else if (s->num_channels > WMALL_MAX_CHANNELS) {
+ av_log_ask_for_sample(avctx, "unsupported number of channels\n");
+ return AVERROR_PATCHWELCOME;
+ }
+
+ avcodec_get_frame_defaults(&s->frame);
+ avctx->coded_frame = &s->frame;
+ avctx->channel_layout = channel_mask;
+ return 0;
+}
+
+/**
+ * @brief Decode the subframe length.
+ * @param s context
+ * @param offset sample offset in the frame
+ * @return decoded subframe length on success, < 0 in case of an error
+ */
+static int decode_subframe_length(WmallDecodeCtx *s, int offset)
+{
+ int frame_len_ratio, subframe_len, len;
+
+ /* no need to read from the bitstream when only one length is possible */
+ if (offset == s->samples_per_frame - s->min_samples_per_subframe)
+ return s->min_samples_per_subframe;
+
+ len = av_log2(s->max_num_subframes - 1) + 1;
+ frame_len_ratio = get_bits(&s->gb, len);
+ subframe_len = s->min_samples_per_subframe * (frame_len_ratio + 1);
+
+ /* sanity check the length */
+ if (subframe_len < s->min_samples_per_subframe ||
+ subframe_len > s->samples_per_frame) {
+ av_log(s->avctx, AV_LOG_ERROR, "broken frame: subframe_len %i\n",
+ subframe_len);
+ return AVERROR_INVALIDDATA;
+ }
+ return subframe_len;
+}
+
+/**
+ * @brief Decode how the data in the frame is split into subframes.
+ * Every WMA frame contains the encoded data for a fixed number of
+ * samples per channel. The data for every channel might be split
+ * into several subframes. This function will reconstruct the list of
+ * subframes for every channel.
+ *
+ * If the subframes are not evenly split, the algorithm estimates the
+ * channels with the lowest number of total samples.
+ * Afterwards, for each of these channels a bit is read from the
+ * bitstream that indicates if the channel contains a subframe with the
+ * next subframe size that is going to be read from the bitstream or not.
+ * If a channel contains such a subframe, the subframe size gets added to
+ * the channel's subframe list.
+ * The algorithm repeats these steps until the frame is properly divided
+ * between the individual channels.
+ *
+ * @param s context
+ * @return 0 on success, < 0 in case of an error
+ */
+static int decode_tilehdr(WmallDecodeCtx *s)
+{
+ uint16_t num_samples[WMALL_MAX_CHANNELS] = { 0 }; /* sum of samples for all currently known subframes of a channel */
+ uint8_t contains_subframe[WMALL_MAX_CHANNELS]; /* flag indicating if a channel contains the current subframe */
+ int channels_for_cur_subframe = s->num_channels; /* number of channels that contain the current subframe */
+ int fixed_channel_layout = 0; /* flag indicating that all channels use the same subfra2me offsets and sizes */
+ int min_channel_len = 0; /* smallest sum of samples (channels with this length will be processed first) */
+ int c, tile_aligned;
+
+ /* reset tiling information */
+ for (c = 0; c < s->num_channels; c++)
+ s->channel[c].num_subframes = 0;
+
+ tile_aligned = get_bits1(&s->gb);
+ if (s->max_num_subframes == 1 || tile_aligned)
+ fixed_channel_layout = 1;
+
+ /* loop until the frame data is split between the subframes */
+ do {
+ int subframe_len, in_use = 0;
+
+ /* check which channels contain the subframe */
+ for (c = 0; c < s->num_channels; c++) {
+ if (num_samples[c] == min_channel_len) {
+ if (fixed_channel_layout || channels_for_cur_subframe == 1 ||
+ (min_channel_len == s->samples_per_frame - s->min_samples_per_subframe)) {
+ contains_subframe[c] = in_use = 1;
+ } else {
+ if (get_bits1(&s->gb))
+ contains_subframe[c] = in_use = 1;
+ }
+ } else
+ contains_subframe[c] = 0;
+ }
+
+ if (!in_use) {
+ av_log(s->avctx, AV_LOG_ERROR,
+ "Found empty subframe\n");
+ return AVERROR_INVALIDDATA;
+ }
+
+ /* get subframe length, subframe_len == 0 is not allowed */
+ if ((subframe_len = decode_subframe_length(s, min_channel_len)) <= 0)
+ return AVERROR_INVALIDDATA;
+ /* add subframes to the individual channels and find new min_channel_len */
+ min_channel_len += subframe_len;
+ for (c = 0; c < s->num_channels; c++) {
+ WmallChannelCtx *chan = &s->channel[c];
+
+ if (contains_subframe[c]) {
+ if (chan->num_subframes >= MAX_SUBFRAMES) {
+ av_log(s->avctx, AV_LOG_ERROR,
+ "broken frame: num subframes > 31\n");
+ return AVERROR_INVALIDDATA;
+ }
+ chan->subframe_len[chan->num_subframes] = subframe_len;
+ num_samples[c] += subframe_len;
+ ++chan->num_subframes;
+ if (num_samples[c] > s->samples_per_frame) {
+ av_log(s->avctx, AV_LOG_ERROR, "broken frame: "
+ "channel len(%d) > samples_per_frame(%d)\n",
+ num_samples[c], s->samples_per_frame);
+ return AVERROR_INVALIDDATA;
+ }
+ } else if (num_samples[c] <= min_channel_len) {
+ if (num_samples[c] < min_channel_len) {
+ channels_for_cur_subframe = 0;
+ min_channel_len = num_samples[c];
+ }
+ ++channels_for_cur_subframe;
+ }
+ }
+ } while (min_channel_len < s->samples_per_frame);
+
+ for (c = 0; c < s->num_channels; c++) {
+ int i, offset = 0;
+ for (i = 0; i < s->channel[c].num_subframes; i++) {
+ s->channel[c].subframe_offsets[i] = offset;
+ offset += s->channel[c].subframe_len[i];
+ }
+ }
+
+ return 0;
+}
+
+static void decode_ac_filter(WmallDecodeCtx *s)
+{
+ int i;
+ s->acfilter_order = get_bits(&s->gb, 4) + 1;
+ s->acfilter_scaling = get_bits(&s->gb, 4);
+
+ for (i = 0; i < s->acfilter_order; i++)
+ s->acfilter_coeffs[i] = (s->acfilter_scaling ?
+ get_bits(&s->gb, s->acfilter_scaling) : 0) + 1;
+}
+
+static void decode_mclms(WmallDecodeCtx *s)
+{
+ s->mclms_order = (get_bits(&s->gb, 4) + 1) * 2;
+ s->mclms_scaling = get_bits(&s->gb, 4);
+ if (get_bits1(&s->gb)) {
+ int i, send_coef_bits;
+ int cbits = av_log2(s->mclms_scaling + 1);
+ if (1 << cbits < s->mclms_scaling + 1)
+ cbits++;
+
+ send_coef_bits = (cbits ? get_bits(&s->gb, cbits) : 0) + 2;
+
+ for (i = 0; i < s->mclms_order * s->num_channels * s->num_channels; i++)
+ s->mclms_coeffs[i] = get_bits(&s->gb, send_coef_bits);
+
+ for (i = 0; i < s->num_channels; i++) {
+ int c;
+ for (c = 0; c < i; c++)
+ s->mclms_coeffs_cur[i * s->num_channels + c] = get_bits(&s->gb, send_coef_bits);
+ }
+ }
+}
+
+static int decode_cdlms(WmallDecodeCtx *s)
+{
+ int c, i;
+ int cdlms_send_coef = get_bits1(&s->gb);
+
+ for (c = 0; c < s->num_channels; c++) {
+ s->cdlms_ttl[c] = get_bits(&s->gb, 3) + 1;
+ for (i = 0; i < s->cdlms_ttl[c]; i++) {
+ s->cdlms[c][i].order = (get_bits(&s->gb, 7) + 1) * 8;
+ if (s->cdlms[c][i].order > MAX_ORDER) {
+ av_log(s->avctx, AV_LOG_ERROR,
+ "Order[%d][%d] %d > max (%d), not supported\n",
+ c, i, s->cdlms[c][i].order, MAX_ORDER);
+ s->cdlms[0][0].order = 0;
+ return AVERROR_INVALIDDATA;
+ }
+ }
+
+ for (i = 0; i < s->cdlms_ttl[c]; i++)
+ s->cdlms[c][i].scaling = get_bits(&s->gb, 4);
+
+ if (cdlms_send_coef) {
+ for (i = 0; i < s->cdlms_ttl[c]; i++) {
+ int cbits, shift_l, shift_r, j;
+ cbits = av_log2(s->cdlms[c][i].order);
+ if ((1 << cbits) < s->cdlms[c][i].order)
+ cbits++;
+ s->cdlms[c][i].coefsend = get_bits(&s->gb, cbits) + 1;
+
+ cbits = av_log2(s->cdlms[c][i].scaling + 1);
+ if ((1 << cbits) < s->cdlms[c][i].scaling + 1)
+ cbits++;
+
+ s->cdlms[c][i].bitsend = get_bits(&s->gb, cbits) + 2;
+ shift_l = 32 - s->cdlms[c][i].bitsend;
+ shift_r = 32 - s->cdlms[c][i].scaling - 2;
+ for (j = 0; j < s->cdlms[c][i].coefsend; j++)
+ s->cdlms[c][i].coefs[j] =
+ (get_bits(&s->gb, s->cdlms[c][i].bitsend) << shift_l) >> shift_r;
+ }
+ }
+ }
+
+ return 0;
+}
+
+static int decode_channel_residues(WmallDecodeCtx *s, int ch, int tile_size)
+{
+ int i = 0;
+ unsigned int ave_mean;
+ s->transient[ch] = get_bits1(&s->gb);
+ if (s->transient[ch]) {
+ s->transient_pos[ch] = get_bits(&s->gb, av_log2(tile_size));
+ if (s->transient_pos[ch])
+ s->transient[ch] = 0;
+ s->channel[ch].transient_counter =
+ FFMAX(s->channel[ch].transient_counter, s->samples_per_frame / 2);
+ } else if (s->channel[ch].transient_counter)
+ s->transient[ch] = 1;
+
+ if (s->seekable_tile) {
+ ave_mean = get_bits(&s->gb, s->bits_per_sample);
+ s->ave_sum[ch] = ave_mean << (s->movave_scaling + 1);
+ }
+
+ if (s->seekable_tile) {
+ if (s->do_inter_ch_decorr)
+ s->channel_residues[ch][0] = get_sbits(&s->gb, s->bits_per_sample + 1);
+ else
+ s->channel_residues[ch][0] = get_sbits(&s->gb, s->bits_per_sample);
+ i++;
+ }
+ for (; i < tile_size; i++) {
+ int quo = 0, rem, rem_bits, residue;
+ while(get_bits1(&s->gb)) {
+ quo++;
+ if (get_bits_left(&s->gb) <= 0)
+ return -1;
+ }
+ if (quo >= 32)
+ quo += get_bits_long(&s->gb, get_bits(&s->gb, 5) + 1);
+
+ ave_mean = (s->ave_sum[ch] + (1 << s->movave_scaling)) >> (s->movave_scaling + 1);
+ if (ave_mean <= 1)
+ residue = quo;
+ else {
+ rem_bits = av_ceil_log2(ave_mean);
+ rem = rem_bits ? get_bits_long(&s->gb, rem_bits) : 0;
+ residue = (quo << rem_bits) + rem;
+ }
+
+ s->ave_sum[ch] = residue + s->ave_sum[ch] -
+ (s->ave_sum[ch] >> s->movave_scaling);
+
+ if (residue & 1)
+ residue = -(residue >> 1) - 1;
+ else
+ residue = residue >> 1;
+ s->channel_residues[ch][i] = residue;
+ }
+
+ return 0;
+
+}
+
+static void decode_lpc(WmallDecodeCtx *s)
+{
+ int ch, i, cbits;
+ s->lpc_order = get_bits(&s->gb, 5) + 1;
+ s->lpc_scaling = get_bits(&s->gb, 4);
+ s->lpc_intbits = get_bits(&s->gb, 3) + 1;
+ cbits = s->lpc_scaling + s->lpc_intbits;
+ for (ch = 0; ch < s->num_channels; ch++)
+ for (i = 0; i < s->lpc_order; i++)
+ s->lpc_coefs[ch][i] = get_sbits(&s->gb, cbits);
+}
+
+static void clear_codec_buffers(WmallDecodeCtx *s)
+{
+ int ich, ilms;
+
+ memset(s->acfilter_coeffs, 0, sizeof(s->acfilter_coeffs));
+ memset(s->acfilter_prevvalues, 0, sizeof(s->acfilter_prevvalues));
+ memset(s->lpc_coefs, 0, sizeof(s->lpc_coefs));
+
+ memset(s->mclms_coeffs, 0, sizeof(s->mclms_coeffs));
+ memset(s->mclms_coeffs_cur, 0, sizeof(s->mclms_coeffs_cur));
+ memset(s->mclms_prevvalues, 0, sizeof(s->mclms_prevvalues));
+ memset(s->mclms_updates, 0, sizeof(s->mclms_updates));
+
+ for (ich = 0; ich < s->num_channels; ich++) {
+ for (ilms = 0; ilms < s->cdlms_ttl[ich]; ilms++) {
+ memset(s->cdlms[ich][ilms].coefs, 0,
+ sizeof(s->cdlms[ich][ilms].coefs));
+ memset(s->cdlms[ich][ilms].lms_prevvalues, 0,
+ sizeof(s->cdlms[ich][ilms].lms_prevvalues));
+ memset(s->cdlms[ich][ilms].lms_updates, 0,
+ sizeof(s->cdlms[ich][ilms].lms_updates));
+ }
+ s->ave_sum[ich] = 0;
+ }
+}
+
+/**
+ * @brief Reset filter parameters and transient area at new seekable tile.
+ */
+static void reset_codec(WmallDecodeCtx *s)
+{
+ int ich, ilms;
+ s->mclms_recent = s->mclms_order * s->num_channels;
+ for (ich = 0; ich < s->num_channels; ich++) {
+ for (ilms = 0; ilms < s->cdlms_ttl[ich]; ilms++)
+ s->cdlms[ich][ilms].recent = s->cdlms[ich][ilms].order;
+ /* first sample of a seekable subframe is considered as the starting of
+ a transient area which is samples_per_frame samples long */
+ s->channel[ich].transient_counter = s->samples_per_frame;
+ s->transient[ich] = 1;
+ s->transient_pos[ich] = 0;
+ }
+}
+
+static void mclms_update(WmallDecodeCtx *s, int icoef, int *pred)
+{
+ int i, j, ich, pred_error;
+ int order = s->mclms_order;
+ int num_channels = s->num_channels;
+ int range = 1 << (s->bits_per_sample - 1);
+
+ for (ich = 0; ich < num_channels; ich++) {
+ pred_error = s->channel_residues[ich][icoef] - pred[ich];
+ if (pred_error > 0) {
+ for (i = 0; i < order * num_channels; i++)
+ s->mclms_coeffs[i + ich * order * num_channels] +=
+ s->mclms_updates[s->mclms_recent + i];
+ for (j = 0; j < ich; j++) {
+ if (s->channel_residues[j][icoef] > 0)
+ s->mclms_coeffs_cur[ich * num_channels + j] += 1;
+ else if (s->channel_residues[j][icoef] < 0)
+ s->mclms_coeffs_cur[ich * num_channels + j] -= 1;
+ }
+ } else if (pred_error < 0) {
+ for (i = 0; i < order * num_channels; i++)
+ s->mclms_coeffs[i + ich * order * num_channels] -=
+ s->mclms_updates[s->mclms_recent + i];
+ for (j = 0; j < ich; j++) {
+ if (s->channel_residues[j][icoef] > 0)
+ s->mclms_coeffs_cur[ich * num_channels + j] -= 1;
+ else if (s->channel_residues[j][icoef] < 0)
+ s->mclms_coeffs_cur[ich * num_channels + j] += 1;
+ }
+ }
+ }
+
+ for (ich = num_channels - 1; ich >= 0; ich--) {
+ s->mclms_recent--;
+ s->mclms_prevvalues[s->mclms_recent] = s->channel_residues[ich][icoef];
+ if (s->channel_residues[ich][icoef] > range - 1)
+ s->mclms_prevvalues[s->mclms_recent] = range - 1;
+ else if (s->channel_residues[ich][icoef] < -range)
+ s->mclms_prevvalues[s->mclms_recent] = -range;
+
+ s->mclms_updates[s->mclms_recent] = 0;
+ if (s->channel_residues[ich][icoef] > 0)
+ s->mclms_updates[s->mclms_recent] = 1;
+ else if (s->channel_residues[ich][icoef] < 0)
+ s->mclms_updates[s->mclms_recent] = -1;
+ }
+
+ if (s->mclms_recent == 0) {
+ memcpy(&s->mclms_prevvalues[order * num_channels],
+ s->mclms_prevvalues,
+ 2 * order * num_channels);
+ memcpy(&s->mclms_updates[order * num_channels],
+ s->mclms_updates,
+ 2 * order * num_channels);
+ s->mclms_recent = num_channels * order;
+ }
+}
+
+static void mclms_predict(WmallDecodeCtx *s, int icoef, int *pred)
+{
+ int ich, i;
+ int order = s->mclms_order;
+ int num_channels = s->num_channels;
+
+ for (ich = 0; ich < num_channels; ich++) {
+ pred[ich] = 0;
+ if (!s->is_channel_coded[ich])
+ continue;
+ for (i = 0; i < order * num_channels; i++)
+ pred[ich] += s->mclms_prevvalues[i + s->mclms_recent] *
+ s->mclms_coeffs[i + order * num_channels * ich];
+ for (i = 0; i < ich; i++)
+ pred[ich] += s->channel_residues[i][icoef] *
+ s->mclms_coeffs_cur[i + num_channels * ich];
+ pred[ich] += 1 << s->mclms_scaling - 1;
+ pred[ich] >>= s->mclms_scaling;
+ s->channel_residues[ich][icoef] += pred[ich];
+ }
+}
+
+static void revert_mclms(WmallDecodeCtx *s, int tile_size)
+{
+ int icoef, pred[WMALL_MAX_CHANNELS] = { 0 };
+ for (icoef = 0; icoef < tile_size; icoef++) {
+ mclms_predict(s, icoef, pred);
+ mclms_update(s, icoef, pred);
+ }
+}
+
+static int lms_predict(WmallDecodeCtx *s, int ich, int ilms)
+{
+ int pred = 0, icoef;
+ int recent = s->cdlms[ich][ilms].recent;
+
+ for (icoef = 0; icoef < s->cdlms[ich][ilms].order; icoef++)
+ pred += s->cdlms[ich][ilms].coefs[icoef] *
+ s->cdlms[ich][ilms].lms_prevvalues[icoef + recent];
+
+ return pred;
+}
+
+static void lms_update(WmallDecodeCtx *s, int ich, int ilms,
+ int input, int residue)
+{
+ int icoef;
+ int recent = s->cdlms[ich][ilms].recent;
+ int range = 1 << s->bits_per_sample - 1;
+
+ if (residue < 0) {
+ for (icoef = 0; icoef < s->cdlms[ich][ilms].order; icoef++)
+ s->cdlms[ich][ilms].coefs[icoef] -=
+ s->cdlms[ich][ilms].lms_updates[icoef + recent];
+ } else if (residue > 0) {
+ for (icoef = 0; icoef < s->cdlms[ich][ilms].order; icoef++)
+ s->cdlms[ich][ilms].coefs[icoef] +=
+ s->cdlms[ich][ilms].lms_updates[icoef + recent];
+ }
+
+ if (recent)
+ recent--;
+ else {
+ memcpy(&s->cdlms[ich][ilms].lms_prevvalues[s->cdlms[ich][ilms].order],
+ s->cdlms[ich][ilms].lms_prevvalues,
+ 2 * s->cdlms[ich][ilms].order);
+ memcpy(&s->cdlms[ich][ilms].lms_updates[s->cdlms[ich][ilms].order],
+ s->cdlms[ich][ilms].lms_updates,
+ 2 * s->cdlms[ich][ilms].order);
+ recent = s->cdlms[ich][ilms].order - 1;
+ }
+
+ s->cdlms[ich][ilms].lms_prevvalues[recent] = av_clip(input, -range, range - 1);
+ if (!input)
+ s->cdlms[ich][ilms].lms_updates[recent] = 0;
+ else if (input < 0)
+ s->cdlms[ich][ilms].lms_updates[recent] = -s->update_speed[ich];
+ else
+ s->cdlms[ich][ilms].lms_updates[recent] = s->update_speed[ich];
+
+ s->cdlms[ich][ilms].lms_updates[recent + (s->cdlms[ich][ilms].order >> 4)] >>= 2;
+ s->cdlms[ich][ilms].lms_updates[recent + (s->cdlms[ich][ilms].order >> 3)] >>= 1;
+ s->cdlms[ich][ilms].recent = recent;
+}
+
+static void use_high_update_speed(WmallDecodeCtx *s, int ich)
+{
+ int ilms, recent, icoef;
+ for (ilms = s->cdlms_ttl[ich] - 1; ilms >= 0; ilms--) {
+ recent = s->cdlms[ich][ilms].recent;
+ if (s->update_speed[ich] == 16)
+ continue;
+ if (s->bV3RTM) {
+ for (icoef = 0; icoef < s->cdlms[ich][ilms].order; icoef++)
+ s->cdlms[ich][ilms].lms_updates[icoef + recent] *= 2;
+ } else {
+ for (icoef = 0; icoef < s->cdlms[ich][ilms].order; icoef++)
+ s->cdlms[ich][ilms].lms_updates[icoef] *= 2;
+ }
+ }
+ s->update_speed[ich] = 16;
+}
+
+static void use_normal_update_speed(WmallDecodeCtx *s, int ich)
+{
+ int ilms, recent, icoef;
+ for (ilms = s->cdlms_ttl[ich] - 1; ilms >= 0; ilms--) {
+ recent = s->cdlms[ich][ilms].recent;
+ if (s->update_speed[ich] == 8)
+ continue;
+ if (s->bV3RTM)
+ for (icoef = 0; icoef < s->cdlms[ich][ilms].order; icoef++)
+ s->cdlms[ich][ilms].lms_updates[icoef + recent] /= 2;
+ else
+ for (icoef = 0; icoef < s->cdlms[ich][ilms].order; icoef++)
+ s->cdlms[ich][ilms].lms_updates[icoef] /= 2;
+ }
+ s->update_speed[ich] = 8;
+}
+
+static void revert_cdlms(WmallDecodeCtx *s, int ch,
+ int coef_begin, int coef_end)
+{
+ int icoef, pred, ilms, num_lms, residue, input;
+
+ num_lms = s->cdlms_ttl[ch];
+ for (ilms = num_lms - 1; ilms >= 0; ilms--) {
+ for (icoef = coef_begin; icoef < coef_end; icoef++) {
+ pred = 1 << (s->cdlms[ch][ilms].scaling - 1);
+ residue = s->channel_residues[ch][icoef];
+ pred += lms_predict(s, ch, ilms);
+ input = residue + (pred >> s->cdlms[ch][ilms].scaling);
+ lms_update(s, ch, ilms, input, residue);
+ s->channel_residues[ch][icoef] = input;
+ }
+ }
+}
+
+static void revert_inter_ch_decorr(WmallDecodeCtx *s, int tile_size)
+{
+ if (s->num_channels != 2)
+ return;
+ else if (s->is_channel_coded[0] || s->is_channel_coded[1]) {
+ int icoef;
+ for (icoef = 0; icoef < tile_size; icoef++) {
+ s->channel_residues[0][icoef] -= s->channel_residues[1][icoef] >> 1;
+ s->channel_residues[1][icoef] += s->channel_residues[0][icoef];
+ }
+ }
+}
+
+static void revert_acfilter(WmallDecodeCtx *s, int tile_size)
+{
+ int ich, pred, i, j;
+ int64_t *filter_coeffs = s->acfilter_coeffs;
+ int scaling = s->acfilter_scaling;
+ int order = s->acfilter_order;
+
+ for (ich = 0; ich < s->num_channels; ich++) {
+ int *prevvalues = s->acfilter_prevvalues[ich];
+ for (i = 0; i < order; i++) {
+ pred = 0;
+ for (j = 0; j < order; j++) {
+ if (i <= j)
+ pred += filter_coeffs[j] * prevvalues[j - i];
+ else
+ pred += s->channel_residues[ich][i - j - 1] * filter_coeffs[j];
+ }
+ pred >>= scaling;
+ s->channel_residues[ich][i] += pred;
+ }
+ for (i = order; i < tile_size; i++) {
+ pred = 0;
+ for (j = 0; j < order; j++)
+ pred += s->channel_residues[ich][i - j - 1] * filter_coeffs[j];
+ pred >>= scaling;
+ s->channel_residues[ich][i] += pred;
+ }
+ for (j = 0; j < order; j++)
+ prevvalues[j] = s->channel_residues[ich][tile_size - j - 1];
+ }
+}
+
+static int decode_subframe(WmallDecodeCtx *s)
+{
+ int offset = s->samples_per_frame;
+ int subframe_len = s->samples_per_frame;
+ int total_samples = s->samples_per_frame * s->num_channels;
+ int i, j, rawpcm_tile, padding_zeroes, res;
+
+ s->subframe_offset = get_bits_count(&s->gb);
+
+ /* reset channel context and find the next block offset and size
+ == the next block of the channel with the smallest number of
+ decoded samples */
+ for (i = 0; i < s->num_channels; i++) {
+ if (offset > s->channel[i].decoded_samples) {
+ offset = s->channel[i].decoded_samples;
+ subframe_len =
+ s->channel[i].subframe_len[s->channel[i].cur_subframe];
+ }
+ }
+
+ /* get a list of all channels that contain the estimated block */
+ s->channels_for_cur_subframe = 0;
+ for (i = 0; i < s->num_channels; i++) {
+ const int cur_subframe = s->channel[i].cur_subframe;
+ /* subtract already processed samples */
+ total_samples -= s->channel[i].decoded_samples;
+
+ /* and count if there are multiple subframes that match our profile */
+ if (offset == s->channel[i].decoded_samples &&
+ subframe_len == s->channel[i].subframe_len[cur_subframe]) {
+ total_samples -= s->channel[i].subframe_len[cur_subframe];
+ s->channel[i].decoded_samples +=
+ s->channel[i].subframe_len[cur_subframe];
+ s->channel_indexes_for_cur_subframe[s->channels_for_cur_subframe] = i;
+ ++s->channels_for_cur_subframe;
+ }
+ }
+
+ /* check if the frame will be complete after processing the
+ estimated block */
+ if (!total_samples)
+ s->parsed_all_subframes = 1;
+
+
+ s->seekable_tile = get_bits1(&s->gb);
+ if (s->seekable_tile) {
+ clear_codec_buffers(s);
+
+ s->do_arith_coding = get_bits1(&s->gb);
+ if (s->do_arith_coding) {
+ av_log_missing_feature(s->avctx, "Arithmetic coding", 1);
+ return AVERROR_PATCHWELCOME;
+ }
+ s->do_ac_filter = get_bits1(&s->gb);
+ s->do_inter_ch_decorr = get_bits1(&s->gb);
+ s->do_mclms = get_bits1(&s->gb);
+
+ if (s->do_ac_filter)
+ decode_ac_filter(s);
+
+ if (s->do_mclms)
+ decode_mclms(s);
+
+ if ((res = decode_cdlms(s)) < 0)
+ return res;
+ s->movave_scaling = get_bits(&s->gb, 3);
+ s->quant_stepsize = get_bits(&s->gb, 8) + 1;
+
+ reset_codec(s);
+ } else if (!s->cdlms[0][0].order) {
+ av_log(s->avctx, AV_LOG_DEBUG,
+ "Waiting for seekable tile\n");
+ s->frame.nb_samples = 0;
+ return -1;
+ }
+
+ rawpcm_tile = get_bits1(&s->gb);
+
+ for (i = 0; i < s->num_channels; i++)
+ s->is_channel_coded[i] = 1;
+
+ if (!rawpcm_tile) {
+ for (i = 0; i < s->num_channels; i++)
+ s->is_channel_coded[i] = get_bits1(&s->gb);
+
+ if (s->bV3RTM) {
+ // LPC
+ s->do_lpc = get_bits1(&s->gb);
+ if (s->do_lpc) {
+ decode_lpc(s);
+ av_log_ask_for_sample(s->avctx, "Inverse LPC filter not "
+ "implemented. Expect wrong output.\n");
+ }
+ } else
+ s->do_lpc = 0;
+ }
+
+
+ if (get_bits1(&s->gb))
+ padding_zeroes = get_bits(&s->gb, 5);
+ else
+ padding_zeroes = 0;
+
+ if (rawpcm_tile) {
+ int bits = s->bits_per_sample - padding_zeroes;
+ if (bits <= 0) {
+ av_log(s->avctx, AV_LOG_ERROR,
+ "Invalid number of padding bits in raw PCM tile\n");
+ return AVERROR_INVALIDDATA;
+ }
+ av_dlog(s->avctx, "RAWPCM %d bits per sample. "
+ "total %d bits, remain=%d\n", bits,
+ bits * s->num_channels * subframe_len, get_bits_count(&s->gb));
+ for (i = 0; i < s->num_channels; i++)
+ for (j = 0; j < subframe_len; j++)
+ s->channel_coeffs[i][j] = get_sbits(&s->gb, bits);
+ } else {
+ for (i = 0; i < s->num_channels; i++)
+ if (s->is_channel_coded[i]) {
+ decode_channel_residues(s, i, subframe_len);
+ if (s->seekable_tile)
+ use_high_update_speed(s, i);
+ else
+ use_normal_update_speed(s, i);
+ revert_cdlms(s, i, 0, subframe_len);
+ } else {
+ memset(s->channel_residues[i], 0, sizeof(**s->channel_residues) * subframe_len);
+ }
+ }
+ if (s->do_mclms)
+ revert_mclms(s, subframe_len);
+ if (s->do_inter_ch_decorr)
+ revert_inter_ch_decorr(s, subframe_len);
+ if (s->do_ac_filter)
+ revert_acfilter(s, subframe_len);
+
+ /* Dequantize */
+ if (s->quant_stepsize != 1)
+ for (i = 0; i < s->num_channels; i++)
+ for (j = 0; j < subframe_len; j++)
+ s->channel_residues[i][j] *= s->quant_stepsize;
+
+ /* Write to proper output buffer depending on bit-depth */
+ for (i = 0; i < s->channels_for_cur_subframe; i++) {
+ int c = s->channel_indexes_for_cur_subframe[i];
+ int subframe_len = s->channel[c].subframe_len[s->channel[c].cur_subframe];
+
+ for (j = 0; j < subframe_len; j++) {
+ if (s->bits_per_sample == 16) {
+ *s->samples_16[c]++ = (int16_t) s->channel_residues[c][j] << padding_zeroes;
+ } else {
+ *s->samples_32[c]++ = s->channel_residues[c][j] << padding_zeroes;
+ }
+ }
+ }
+
+ /* handled one subframe */
+ for (i = 0; i < s->channels_for_cur_subframe; i++) {
+ int c = s->channel_indexes_for_cur_subframe[i];
+ if (s->channel[c].cur_subframe >= s->channel[c].num_subframes) {
+ av_log(s->avctx, AV_LOG_ERROR, "broken subframe\n");
+ return AVERROR_INVALIDDATA;
+ }
+ ++s->channel[c].cur_subframe;
+ }
+ return 0;
+}
+
+/**
+ * @brief Decode one WMA frame.
+ * @param s codec context
+ * @return 0 if the trailer bit indicates that this is the last frame,
+ * 1 if there are additional frames
+ */
+static int decode_frame(WmallDecodeCtx *s)
+{
+ GetBitContext* gb = &s->gb;
+ int more_frames = 0, len = 0, i, ret;
+
+ s->frame.nb_samples = s->samples_per_frame;
+ if ((ret = ff_get_buffer(s->avctx, &s->frame)) < 0) {
+ /* return an error if no frame could be decoded at all */
+ av_log(s->avctx, AV_LOG_ERROR,
+ "not enough space for the output samples\n");
+ s->packet_loss = 1;
+ return ret;
+ }
+ for (i = 0; i < s->num_channels; i++) {
+ s->samples_16[i] = (int16_t *)s->frame.extended_data[i];
+ s->samples_32[i] = (int32_t *)s->frame.extended_data[i];
+ }
+
+ /* get frame length */
+ if (s->len_prefix)
+ len = get_bits(gb, s->log2_frame_size);
+
+ /* decode tile information */
+ if (decode_tilehdr(s)) {
+ s->packet_loss = 1;
+ return 0;
+ }
+
+ /* read drc info */
+ if (s->dynamic_range_compression)
+ s->drc_gain = get_bits(gb, 8);
+
+ /* no idea what these are for, might be the number of samples
+ that need to be skipped at the beginning or end of a stream */
+ if (get_bits1(gb)) {
+ int av_unused skip;
+
+ /* usually true for the first frame */
+ if (get_bits1(gb)) {
+ skip = get_bits(gb, av_log2(s->samples_per_frame * 2));
+ av_dlog(s->avctx, "start skip: %i\n", skip);
+ }
+
+ /* sometimes true for the last frame */
+ if (get_bits1(gb)) {
+ skip = get_bits(gb, av_log2(s->samples_per_frame * 2));
+ av_dlog(s->avctx, "end skip: %i\n", skip);
+ }
+
+ }
+
+ /* reset subframe states */
+ s->parsed_all_subframes = 0;
+ for (i = 0; i < s->num_channels; i++) {
+ s->channel[i].decoded_samples = 0;
+ s->channel[i].cur_subframe = 0;
+ }
+
+ /* decode all subframes */
+ while (!s->parsed_all_subframes) {
+ if (decode_subframe(s) < 0) {
+ s->packet_loss = 1;
+ return 0;
+ }
+ }
+
+ av_dlog(s->avctx, "Frame done\n");
+
+ if (s->skip_frame)
+ s->skip_frame = 0;
+
+ if (s->len_prefix) {
+ if (len != (get_bits_count(gb) - s->frame_offset) + 2) {
+ /* FIXME: not sure if this is always an error */
+ av_log(s->avctx, AV_LOG_ERROR,
+ "frame[%i] would have to skip %i bits\n", s->frame_num,
+ len - (get_bits_count(gb) - s->frame_offset) - 1);
+ s->packet_loss = 1;
+ return 0;
+ }
+
+ /* skip the rest of the frame data */
+ skip_bits_long(gb, len - (get_bits_count(gb) - s->frame_offset) - 1);
+ }
+
+ /* decode trailer bit */
+ more_frames = get_bits1(gb);
+ ++s->frame_num;
+ return more_frames;
+}
+
+/**
+ * @brief Calculate remaining input buffer length.
+ * @param s codec context
+ * @param gb bitstream reader context
+ * @return remaining size in bits
+ */
+static int remaining_bits(WmallDecodeCtx *s, GetBitContext *gb)
+{
+ return s->buf_bit_size - get_bits_count(gb);
+}
+
+/**
+ * @brief Fill the bit reservoir with a (partial) frame.
+ * @param s codec context
+ * @param gb bitstream reader context
+ * @param len length of the partial frame
+ * @param append decides whether to reset the buffer or not
+ */
+static void save_bits(WmallDecodeCtx *s, GetBitContext* gb, int len,
+ int append)
+{
+ int buflen;
+ PutBitContext tmp;
+
+ /* when the frame data does not need to be concatenated, the input buffer
+ is reset and additional bits from the previous frame are copied
+ and skipped later so that a fast byte copy is possible */
+
+ if (!append) {
+ s->frame_offset = get_bits_count(gb) & 7;
+ s->num_saved_bits = s->frame_offset;
+ init_put_bits(&s->pb, s->frame_data, MAX_FRAMESIZE);
+ }
+
+ buflen = (s->num_saved_bits + len + 8) >> 3;
+
+ if (len <= 0 || buflen > MAX_FRAMESIZE) {
+ av_log_ask_for_sample(s->avctx, "input buffer too small\n");
+ s->packet_loss = 1;
+ return;
+ }
+
+ s->num_saved_bits += len;
+ if (!append) {
+ avpriv_copy_bits(&s->pb, gb->buffer + (get_bits_count(gb) >> 3),
+ s->num_saved_bits);
+ } else {
+ int align = 8 - (get_bits_count(gb) & 7);
+ align = FFMIN(align, len);
+ put_bits(&s->pb, align, get_bits(gb, align));
+ len -= align;
+ avpriv_copy_bits(&s->pb, gb->buffer + (get_bits_count(gb) >> 3), len);
+ }
+ skip_bits_long(gb, len);
+
+ tmp = s->pb;
+ flush_put_bits(&tmp);
+
+ init_get_bits(&s->gb, s->frame_data, s->num_saved_bits);
+ skip_bits(&s->gb, s->frame_offset);
+}
+
+static int decode_packet(AVCodecContext *avctx, void *data, int *got_frame_ptr,
+ AVPacket* avpkt)
+{
+ WmallDecodeCtx *s = avctx->priv_data;
+ GetBitContext* gb = &s->pgb;
+ const uint8_t* buf = avpkt->data;
+ int buf_size = avpkt->size;
+ int num_bits_prev_frame, packet_sequence_number, spliced_packet;
+
+ s->frame.nb_samples = 0;
+
+ if (s->packet_done || s->packet_loss) {
+ s->packet_done = 0;
+
+ /* sanity check for the buffer length */
+ if (buf_size < avctx->block_align)
+ return 0;
+
+ s->next_packet_start = buf_size - avctx->block_align;
+ buf_size = avctx->block_align;
+ s->buf_bit_size = buf_size << 3;
+
+ /* parse packet header */
+ init_get_bits(gb, buf, s->buf_bit_size);
+ packet_sequence_number = get_bits(gb, 4);
+ skip_bits(gb, 1); // Skip seekable_frame_in_packet, currently ununused
+ spliced_packet = get_bits1(gb);
+ if (spliced_packet)
+ av_log_missing_feature(avctx, "Bitstream splicing", 1);
+
+ /* get number of bits that need to be added to the previous frame */
+ num_bits_prev_frame = get_bits(gb, s->log2_frame_size);
+
+ /* check for packet loss */
+ if (!s->packet_loss &&
+ ((s->packet_sequence_number + 1) & 0xF) != packet_sequence_number) {
+ s->packet_loss = 1;
+ av_log(avctx, AV_LOG_ERROR, "Packet loss detected! seq %x vs %x\n",
+ s->packet_sequence_number, packet_sequence_number);
+ }
+ s->packet_sequence_number = packet_sequence_number;
+
+ if (num_bits_prev_frame > 0) {
+ int remaining_packet_bits = s->buf_bit_size - get_bits_count(gb);
+ if (num_bits_prev_frame >= remaining_packet_bits) {
+ num_bits_prev_frame = remaining_packet_bits;
+ s->packet_done = 1;
+ }
+
+ /* Append the previous frame data to the remaining data from the
+ * previous packet to create a full frame. */
+ save_bits(s, gb, num_bits_prev_frame, 1);
+
+ /* decode the cross packet frame if it is valid */
+ if (num_bits_prev_frame < remaining_packet_bits && !s->packet_loss)
+ decode_frame(s);
+ } else if (s->num_saved_bits - s->frame_offset) {
+ av_dlog(avctx, "ignoring %x previously saved bits\n",
+ s->num_saved_bits - s->frame_offset);
+ }
+
+ if (s->packet_loss) {
+ /* Reset number of saved bits so that the decoder does not start
+ * to decode incomplete frames in the s->len_prefix == 0 case. */
+ s->num_saved_bits = 0;
+ s->packet_loss = 0;
+ init_put_bits(&s->pb, s->frame_data, MAX_FRAMESIZE);
+ }
+
+ } else {
+ int frame_size;
+
+ s->buf_bit_size = (avpkt->size - s->next_packet_start) << 3;
+ init_get_bits(gb, avpkt->data, s->buf_bit_size);
+ skip_bits(gb, s->packet_offset);
+
+ if (s->len_prefix && remaining_bits(s, gb) > s->log2_frame_size &&
+ (frame_size = show_bits(gb, s->log2_frame_size)) &&
+ frame_size <= remaining_bits(s, gb)) {
+ save_bits(s, gb, frame_size, 0);
+ s->packet_done = !decode_frame(s);
+ } else if (!s->len_prefix
+ && s->num_saved_bits > get_bits_count(&s->gb)) {
+ /* when the frames do not have a length prefix, we don't know the
+ * compressed length of the individual frames however, we know what
+ * part of a new packet belongs to the previous frame therefore we
+ * save the incoming packet first, then we append the "previous
+ * frame" data from the next packet so that we get a buffer that
+ * only contains full frames */
+ s->packet_done = !decode_frame(s);
+ } else {
+ s->packet_done = 1;
+ }
+ }
+
+ if (s->packet_done && !s->packet_loss &&
+ remaining_bits(s, gb) > 0) {
+ /* save the rest of the data so that it can be decoded
+ * with the next packet */
+ save_bits(s, gb, remaining_bits(s, gb), 0);
+ }
+
+ *(AVFrame *)data = s->frame;
+ *got_frame_ptr = s->frame.nb_samples > 0;
+ s->packet_offset = get_bits_count(gb) & 7;
+
+ return (s->packet_loss) ? AVERROR_INVALIDDATA : get_bits_count(gb) >> 3;
+}
+
+static void flush(AVCodecContext *avctx)
+{
+ WmallDecodeCtx *s = avctx->priv_data;
+ s->packet_loss = 1;
+ s->packet_done = 0;
+ s->num_saved_bits = 0;
+ s->frame_offset = 0;
+ s->next_packet_start = 0;
+ s->cdlms[0][0].order = 0;
+ s->frame.nb_samples = 0;
+ init_put_bits(&s->pb, s->frame_data, MAX_FRAMESIZE);
+}
+
+AVCodec ff_wmalossless_decoder = {
+ .name = "wmalossless",
+ .type = AVMEDIA_TYPE_AUDIO,
+ .id = AV_CODEC_ID_WMALOSSLESS,
+ .priv_data_size = sizeof(WmallDecodeCtx),
+ .init = decode_init,
+ .decode = decode_packet,
+ .flush = flush,
+ .capabilities = CODEC_CAP_SUBFRAMES | CODEC_CAP_DR1 | CODEC_CAP_DELAY,
+ .long_name = NULL_IF_CONFIG_SMALL("Windows Media Audio Lossless"),
+ .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_S16P,
+ AV_SAMPLE_FMT_S32P,
+ AV_SAMPLE_FMT_NONE },
+};
diff --git a/gst-libs/ext/libav/libavcodec/wmaprodec.c b/gst-libs/ext/libav/libavcodec/wmaprodec.c
index 902c4e3..ed9c6d3 100644
--- a/gst-libs/ext/libav/libavcodec/wmaprodec.c
+++ b/gst-libs/ext/libav/libavcodec/wmaprodec.c
@@ -86,6 +86,7 @@
* subframe in order to reconstruct the output samples.
*/
+#include "libavutil/float_dsp.h"
#include "libavutil/intfloat.h"
#include "libavutil/intreadwrite.h"
#include "avcodec.h"
@@ -94,9 +95,9 @@
#include "put_bits.h"
#include "wmaprodata.h"
#include "dsputil.h"
-#include "fmtconvert.h"
#include "sinewin.h"
#include "wma.h"
+#include "wma_common.h"
/** current decoder limitations */
#define WMAPRO_MAX_CHANNELS 8 ///< max number of handled channels
@@ -105,7 +106,7 @@
#define MAX_FRAMESIZE 32768 ///< maximum compressed frame size
#define WMAPRO_BLOCK_MIN_BITS 6 ///< log2 of min block size
-#define WMAPRO_BLOCK_MAX_BITS 12 ///< log2 of max block size
+#define WMAPRO_BLOCK_MAX_BITS 13 ///< log2 of max block size
#define WMAPRO_BLOCK_MIN_SIZE (1 << WMAPRO_BLOCK_MIN_BITS) ///< minimum block size
#define WMAPRO_BLOCK_MAX_SIZE (1 << WMAPRO_BLOCK_MAX_BITS) ///< maximum block size
#define WMAPRO_BLOCK_SIZES (WMAPRO_BLOCK_MAX_BITS - WMAPRO_BLOCK_MIN_BITS + 1) ///< possible block sizes
@@ -171,7 +172,7 @@ typedef struct WMAProDecodeCtx {
AVCodecContext* avctx; ///< codec context for av_log
AVFrame frame; ///< AVFrame for decoded output
DSPContext dsp; ///< accelerated DSP functions
- FmtConvertContext fmt_conv;
+ AVFloatDSPContext fdsp;
uint8_t frame_data[MAX_FRAMESIZE +
FF_INPUT_BUFFER_PADDING_SIZE];///< compressed frame data
PutBitContext pb; ///< context for filling the frame_data buffer
@@ -186,7 +187,6 @@ typedef struct WMAProDecodeCtx {
uint8_t bits_per_sample; ///< integer audio sample size for the unscaled IMDCT output (used to scale to [-1.0, 1.0])
uint16_t samples_per_frame; ///< number of samples to output
uint16_t log2_frame_size;
- int8_t num_channels; ///< number of channels in the stream (same as AVCodecContext.num_channels)
int8_t lfe_channel; ///< lfe channel index
uint8_t max_num_subframes;
uint8_t subframe_len_bits; ///< number of bits used for the subframe length
@@ -237,7 +237,7 @@ typedef struct WMAProDecodeCtx {
*@brief helper function to print the most important members of the context
*@param s context
*/
-static void av_cold dump_context(WMAProDecodeCtx *s)
+static av_cold void dump_context(WMAProDecodeCtx *s)
{
#define PRINT(a, b) av_log(s->avctx, AV_LOG_DEBUG, " %s = %d\n", a, b);
#define PRINT_HEX(a, b) av_log(s->avctx, AV_LOG_DEBUG, " %s = %x\n", a, b);
@@ -248,7 +248,7 @@ static void av_cold dump_context(WMAProDecodeCtx *s)
PRINT("log2 frame size", s->log2_frame_size);
PRINT("max num subframes", s->max_num_subframes);
PRINT("len prefix", s->len_prefix);
- PRINT("num channels", s->num_channels);
+ PRINT("num channels", s->avctx->channels);
}
/**
@@ -277,7 +277,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
WMAProDecodeCtx *s = avctx->priv_data;
uint8_t *edata_ptr = avctx->extradata;
unsigned int channel_mask;
- int i;
+ int i, bits;
int log2_max_num_subframes;
int num_possible_block_sizes;
@@ -287,11 +287,12 @@ static av_cold int decode_init(AVCodecContext *avctx)
}
s->avctx = avctx;
- dsputil_init(&s->dsp, avctx);
- ff_fmt_convert_init(&s->fmt_conv, avctx);
+ ff_dsputil_init(&s->dsp, avctx);
+ avpriv_float_dsp_init(&s->fdsp, avctx->flags & CODEC_FLAG_BITEXACT);
+
init_put_bits(&s->pb, s->frame_data, MAX_FRAMESIZE);
- avctx->sample_fmt = AV_SAMPLE_FMT_FLT;
+ avctx->sample_fmt = AV_SAMPLE_FMT_FLTP;
if (avctx->extradata_size >= 18) {
s->decode_flags = AV_RL16(edata_ptr+14);
@@ -304,7 +305,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
} else {
av_log_ask_for_sample(avctx, "Unknown extradata size\n");
- return AVERROR_INVALIDDATA;
+ return AVERROR_PATCHWELCOME;
}
/** generic init */
@@ -316,8 +317,12 @@ static av_cold int decode_init(AVCodecContext *avctx)
s->len_prefix = (s->decode_flags & 0x40);
/** get frame len */
- s->samples_per_frame = 1 << ff_wma_get_frame_len_bits(avctx->sample_rate,
- 3, s->decode_flags);
+ bits = ff_wma_get_frame_len_bits(avctx->sample_rate, 3, s->decode_flags);
+ if (bits > WMAPRO_BLOCK_MAX_BITS) {
+ av_log_missing_feature(avctx, "14-bits block sizes", 1);
+ return AVERROR_PATCHWELCOME;
+ }
+ s->samples_per_frame = 1 << bits;
/** subframe info */
log2_max_num_subframes = ((s->decode_flags & 0x38) >> 3);
@@ -347,18 +352,17 @@ static av_cold int decode_init(AVCodecContext *avctx)
return AVERROR_INVALIDDATA;
}
- s->num_channels = avctx->channels;
-
- if (s->num_channels < 0) {
- av_log(avctx, AV_LOG_ERROR, "invalid number of channels %d\n", s->num_channels);
+ if (avctx->channels < 0) {
+ av_log(avctx, AV_LOG_ERROR, "invalid number of channels %d\n",
+ avctx->channels);
return AVERROR_INVALIDDATA;
- } else if (s->num_channels > WMAPRO_MAX_CHANNELS) {
+ } else if (avctx->channels > WMAPRO_MAX_CHANNELS) {
av_log_ask_for_sample(avctx, "unsupported number of channels\n");
return AVERROR_PATCHWELCOME;
}
/** init previous block len */
- for (i = 0; i < s->num_channels; i++)
+ for (i = 0; i < avctx->channels; i++)
s->channel[i].prev_block_len = s->samples_per_frame;
/** extract lfe channel position */
@@ -534,25 +538,23 @@ static int decode_subframe_length(WMAProDecodeCtx *s, int offset)
*/
static int decode_tilehdr(WMAProDecodeCtx *s)
{
- uint16_t num_samples[WMAPRO_MAX_CHANNELS]; /**< sum of samples for all currently known subframes of a channel */
+ uint16_t num_samples[WMAPRO_MAX_CHANNELS] = { 0 };/**< sum of samples for all currently known subframes of a channel */
uint8_t contains_subframe[WMAPRO_MAX_CHANNELS]; /**< flag indicating if a channel contains the current subframe */
- int channels_for_cur_subframe = s->num_channels; /**< number of channels that contain the current subframe */
+ int channels_for_cur_subframe = s->avctx->channels; /**< number of channels that contain the current subframe */
int fixed_channel_layout = 0; /**< flag indicating that all channels use the same subframe offsets and sizes */
int min_channel_len = 0; /**< smallest sum of samples (channels with this length will be processed first) */
int c;
/* Should never consume more than 3073 bits (256 iterations for the
- * while loop when always the minimum amount of 128 samples is substracted
+ * while loop when always the minimum amount of 128 samples is subtracted
* from missing samples in the 8 channel case).
* 1 + BLOCK_MAX_SIZE * MAX_CHANNELS / BLOCK_MIN_SIZE * (MAX_CHANNELS + 4)
*/
/** reset tiling information */
- for (c = 0; c < s->num_channels; c++)
+ for (c = 0; c < s->avctx->channels; c++)
s->channel[c].num_subframes = 0;
- memset(num_samples, 0, sizeof(num_samples));
-
if (s->max_num_subframes == 1 || get_bits1(&s->gb))
fixed_channel_layout = 1;
@@ -561,7 +563,7 @@ static int decode_tilehdr(WMAProDecodeCtx *s)
int subframe_len;
/** check which channels contain the subframe */
- for (c = 0; c < s->num_channels; c++) {
+ for (c = 0; c < s->avctx->channels; c++) {
if (num_samples[c] == min_channel_len) {
if (fixed_channel_layout || channels_for_cur_subframe == 1 ||
(min_channel_len == s->samples_per_frame - s->min_samples_per_subframe))
@@ -578,7 +580,7 @@ static int decode_tilehdr(WMAProDecodeCtx *s)
/** add subframes to the individual channels and find new min_channel_len */
min_channel_len += subframe_len;
- for (c = 0; c < s->num_channels; c++) {
+ for (c = 0; c < s->avctx->channels; c++) {
WMAProChannelCtx* chan = &s->channel[c];
if (contains_subframe[c]) {
@@ -605,7 +607,7 @@ static int decode_tilehdr(WMAProDecodeCtx *s)
}
} while (min_channel_len < s->samples_per_frame);
- for (c = 0; c < s->num_channels; c++) {
+ for (c = 0; c < s->avctx->channels; c++) {
int i;
int offset = 0;
for (i = 0; i < s->channel[c].num_subframes; i++) {
@@ -631,8 +633,8 @@ static void decode_decorrelation_matrix(WMAProDecodeCtx *s,
int i;
int offset = 0;
int8_t rotation_offset[WMAPRO_MAX_CHANNELS * WMAPRO_MAX_CHANNELS];
- memset(chgroup->decorrelation_matrix, 0, s->num_channels *
- s->num_channels * sizeof(*chgroup->decorrelation_matrix));
+ memset(chgroup->decorrelation_matrix, 0, s->avctx->channels *
+ s->avctx->channels * sizeof(*chgroup->decorrelation_matrix));
for (i = 0; i < chgroup->num_channels * (chgroup->num_channels - 1) >> 1; i++)
rotation_offset[i] = get_bits(&s->gb, 6);
@@ -685,13 +687,13 @@ static int decode_channel_transform(WMAProDecodeCtx* s)
/** in the one channel case channel transforms are pointless */
s->num_chgroups = 0;
- if (s->num_channels > 1) {
+ if (s->avctx->channels > 1) {
int remaining_channels = s->channels_for_cur_subframe;
if (get_bits1(&s->gb)) {
av_log_ask_for_sample(s->avctx,
"unsupported channel transform bit\n");
- return AVERROR_INVALIDDATA;
+ return AVERROR_PATCHWELCOME;
}
for (s->num_chgroups = 0; remaining_channels &&
@@ -732,7 +734,7 @@ static int decode_channel_transform(WMAProDecodeCtx* s)
}
} else {
chgroup->transform = 1;
- if (s->num_channels == 2) {
+ if (s->avctx->channels == 2) {
chgroup->decorrelation_matrix[0] = 1.0;
chgroup->decorrelation_matrix[1] = -1.0;
chgroup->decorrelation_matrix[2] = 1.0;
@@ -1022,14 +1024,14 @@ static void inverse_channel_transform(WMAProDecodeCtx *s)
(*ch)[y] = sum;
}
}
- } else if (s->num_channels == 2) {
+ } else if (s->avctx->channels == 2) {
int len = FFMIN(sfb[1], s->subframe_len) - sfb[0];
- s->dsp.vector_fmul_scalar(ch_data[0] + sfb[0],
- ch_data[0] + sfb[0],
- 181.0 / 128, len);
- s->dsp.vector_fmul_scalar(ch_data[1] + sfb[0],
- ch_data[1] + sfb[0],
- 181.0 / 128, len);
+ s->fdsp.vector_fmul_scalar(ch_data[0] + sfb[0],
+ ch_data[0] + sfb[0],
+ 181.0 / 128, len);
+ s->fdsp.vector_fmul_scalar(ch_data[1] + sfb[0],
+ ch_data[1] + sfb[0],
+ 181.0 / 128, len);
}
}
}
@@ -1075,7 +1077,7 @@ static int decode_subframe(WMAProDecodeCtx *s)
int offset = s->samples_per_frame;
int subframe_len = s->samples_per_frame;
int i;
- int total_samples = s->samples_per_frame * s->num_channels;
+ int total_samples = s->samples_per_frame * s->avctx->channels;
int transmit_coeffs = 0;
int cur_subwoofer_cutoff;
@@ -1085,7 +1087,7 @@ static int decode_subframe(WMAProDecodeCtx *s)
== the next block of the channel with the smallest number of
decoded samples
*/
- for (i = 0; i < s->num_channels; i++) {
+ for (i = 0; i < s->avctx->channels; i++) {
s->channel[i].grouped = 0;
if (offset > s->channel[i].decoded_samples) {
offset = s->channel[i].decoded_samples;
@@ -1099,9 +1101,9 @@ static int decode_subframe(WMAProDecodeCtx *s)
/** get a list of all channels that contain the estimated block */
s->channels_for_cur_subframe = 0;
- for (i = 0; i < s->num_channels; i++) {
+ for (i = 0; i < s->avctx->channels; i++) {
const int cur_subframe = s->channel[i].cur_subframe;
- /** substract already processed samples */
+ /** subtract already processed samples */
total_samples -= s->channel[i].decoded_samples;
/** and count if there are multiple subframes that match our profile */
@@ -1163,7 +1165,7 @@ static int decode_subframe(WMAProDecodeCtx *s)
/** no idea for what the following bit is used */
if (get_bits1(&s->gb)) {
av_log_ask_for_sample(s->avctx, "reserved bit set\n");
- return AVERROR_INVALIDDATA;
+ return AVERROR_PATCHWELCOME;
}
@@ -1276,9 +1278,9 @@ static int decode_subframe(WMAProDecodeCtx *s)
s->channel[c].scale_factor_step;
const float quant = pow(10.0, exp / 20.0);
int start = s->cur_sfb_offsets[b];
- s->dsp.vector_fmul_scalar(s->tmp + start,
- s->channel[c].coeffs + start,
- quant, end - start);
+ s->fdsp.vector_fmul_scalar(s->tmp + start,
+ s->channel[c].coeffs + start,
+ quant, end - start);
}
/** apply imdct (imdct_half == DCTIV with reverse) */
@@ -1315,8 +1317,6 @@ static int decode_frame(WMAProDecodeCtx *s, int *got_frame_ptr)
int more_frames = 0;
int len = 0;
int i, ret;
- const float *out_ptr[WMAPRO_MAX_CHANNELS];
- float *samples;
/** get frame length */
if (s->len_prefix)
@@ -1331,9 +1331,9 @@ static int decode_frame(WMAProDecodeCtx *s, int *got_frame_ptr)
}
/** read postproc transform */
- if (s->num_channels > 1 && get_bits1(gb)) {
+ if (s->avctx->channels > 1 && get_bits1(gb)) {
if (get_bits1(gb)) {
- for (i = 0; i < s->num_channels * s->num_channels; i++)
+ for (i = 0; i < avctx->channels * avctx->channels; i++)
skip_bits(gb, 4);
}
}
@@ -1368,7 +1368,7 @@ static int decode_frame(WMAProDecodeCtx *s, int *got_frame_ptr)
/** reset subframe states */
s->parsed_all_subframes = 0;
- for (i = 0; i < s->num_channels; i++) {
+ for (i = 0; i < avctx->channels; i++) {
s->channel[i].decoded_samples = 0;
s->channel[i].cur_subframe = 0;
s->channel[i].reuse_sf = 0;
@@ -1384,20 +1384,18 @@ static int decode_frame(WMAProDecodeCtx *s, int *got_frame_ptr)
/* get output buffer */
s->frame.nb_samples = s->samples_per_frame;
- if ((ret = avctx->get_buffer(avctx, &s->frame)) < 0) {
+ if ((ret = ff_get_buffer(avctx, &s->frame)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
s->packet_loss = 1;
return 0;
}
- samples = (float *)s->frame.data[0];
- /** interleave samples and write them to the output buffer */
- for (i = 0; i < s->num_channels; i++)
- out_ptr[i] = s->channel[i].out;
- s->fmt_conv.float_interleave(samples, out_ptr, s->samples_per_frame,
- s->num_channels);
+ /** copy samples to the output buffer */
+ for (i = 0; i < avctx->channels; i++)
+ memcpy(s->frame.extended_data[i], s->channel[i].out,
+ s->samples_per_frame * sizeof(*s->channel[i].out));
- for (i = 0; i < s->num_channels; i++) {
+ for (i = 0; i < avctx->channels; i++) {
/** reuse second half of the IMDCT output for the next frame */
memcpy(&s->channel[i].out[0],
&s->channel[i].out[s->samples_per_frame],
@@ -1510,7 +1508,6 @@ static void save_bits(WMAProDecodeCtx *s, GetBitContext* gb, int len,
*@brief Decode a single WMA packet.
*@param avctx codec context
*@param data the output buffer
- *@param data_size number of bytes that were written to the output buffer
*@param avpkt input packet
*@return number of bytes that were read from the input buffer
*/
@@ -1639,7 +1636,7 @@ static void flush(AVCodecContext *avctx)
int i;
/** reset output buffer as a part of it is used during the windowing of a
new frame */
- for (i = 0; i < s->num_channels; i++)
+ for (i = 0; i < avctx->channels; i++)
memset(s->channel[i].out, 0, s->samples_per_frame *
sizeof(*s->channel[i].out));
s->packet_loss = 1;
@@ -1652,12 +1649,14 @@ static void flush(AVCodecContext *avctx)
AVCodec ff_wmapro_decoder = {
.name = "wmapro",
.type = AVMEDIA_TYPE_AUDIO,
- .id = CODEC_ID_WMAPRO,
+ .id = AV_CODEC_ID_WMAPRO,
.priv_data_size = sizeof(WMAProDecodeCtx),
.init = decode_init,
.close = decode_end,
.decode = decode_packet,
.capabilities = CODEC_CAP_SUBFRAMES | CODEC_CAP_DR1,
- .flush= flush,
- .long_name = NULL_IF_CONFIG_SMALL("Windows Media Audio 9 Professional"),
+ .flush = flush,
+ .long_name = NULL_IF_CONFIG_SMALL("Windows Media Audio 9 Professional"),
+ .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP,
+ AV_SAMPLE_FMT_NONE },
};
diff --git a/gst-libs/ext/libav/libavcodec/wmavoice.c b/gst-libs/ext/libav/libavcodec/wmavoice.c
index 86e6996..08d0600 100644
--- a/gst-libs/ext/libav/libavcodec/wmavoice.c
+++ b/gst-libs/ext/libav/libavcodec/wmavoice.c
@@ -28,16 +28,19 @@
#define UNCHECKED_BITSTREAM_READER 1
#include <math.h>
+
+#include "libavutil/channel_layout.h"
+#include "libavutil/mem.h"
+#include "dsputil.h"
#include "avcodec.h"
+#include "internal.h"
#include "get_bits.h"
#include "put_bits.h"
#include "wmavoice_data.h"
-#include "celp_math.h"
#include "celp_filters.h"
#include "acelp_vectors.h"
#include "acelp_filters.h"
#include "lsp.h"
-#include "libavutil/lzo.h"
#include "dct.h"
#include "rdft.h"
#include "sinewin.h"
@@ -318,10 +321,9 @@ static av_cold int decode_vbmtree(GetBitContext *gb, int8_t vbm_tree[25])
0x0ffc, 0x0ffd, 0x0ffe, // 1111111111+00/01/10
0x3ffc, 0x3ffd, 0x3ffe, 0x3fff // 111111111111+xx
};
- int cntr[8], n, res;
+ int cntr[8] = { 0 }, n, res;
memset(vbm_tree, 0xff, sizeof(vbm_tree[0]) * 25);
- memset(cntr, 0, sizeof(cntr));
for (n = 0; n < 17; n++) {
res = get_bits(gb, 3);
if (cntr[res] > 3) // should be >= 3 + (res == 7))
@@ -439,6 +441,8 @@ static av_cold int wmavoice_decode_init(AVCodecContext *ctx)
2 * (s->block_conv_table[1] - 2 * s->min_pitch_val);
s->block_pitch_nbits = av_ceil_log2(s->block_pitch_range);
+ ctx->channels = 1;
+ ctx->channel_layout = AV_CH_LAYOUT_MONO;
ctx->sample_fmt = AV_SAMPLE_FMT_FLT;
avcodec_get_frame_defaults(&s->frame);
@@ -519,7 +523,7 @@ static int kalman_smoothen(WMAVoiceContext *s, int pitch,
/* find best fitting point in history */
do {
- dot = ff_dot_productf(in, ptr, size);
+ dot = ff_scalarproduct_float_c(in, ptr, size);
if (dot > optimal_gain) {
optimal_gain = dot;
best_hist_ptr = ptr;
@@ -528,7 +532,7 @@ static int kalman_smoothen(WMAVoiceContext *s, int pitch,
if (optimal_gain <= 0)
return -1;
- dot = ff_dot_productf(best_hist_ptr, best_hist_ptr, size);
+ dot = ff_scalarproduct_float_c(best_hist_ptr, best_hist_ptr, size);
if (dot <= 0) // would be 1.0
return -1;
@@ -558,8 +562,8 @@ static float tilt_factor(const float *lpcs, int n_lpcs)
{
float rh0, rh1;
- rh0 = 1.0 + ff_dot_productf(lpcs, lpcs, n_lpcs);
- rh1 = lpcs[0] + ff_dot_productf(lpcs, &lpcs[1], n_lpcs - 1);
+ rh0 = 1.0 + ff_scalarproduct_float_c(lpcs, lpcs, n_lpcs);
+ rh1 = lpcs[0] + ff_scalarproduct_float_c(lpcs, &lpcs[1], n_lpcs - 1);
return rh1 / rh0;
}
@@ -652,7 +656,7 @@ static void calc_input_response(WMAVoiceContext *s, float *lpcs,
-1.8 * tilt_factor(coeffs, remainder - 1),
coeffs, remainder);
}
- sq = (1.0 / 64.0) * sqrtf(1 / ff_dot_productf(coeffs, coeffs, remainder));
+ sq = (1.0 / 64.0) * sqrtf(1 / ff_scalarproduct_float_c(coeffs, coeffs, remainder));
for (n = 0; n < remainder; n++)
coeffs[n] *= sq;
}
@@ -1316,7 +1320,7 @@ static void synth_block_fcb_acb(WMAVoiceContext *s, GetBitContext *gb,
/* Calculate gain for adaptive & fixed codebook signal.
* see ff_amr_set_fixed_gain(). */
idx = get_bits(gb, 7);
- fcb_gain = expf(ff_dot_productf(s->gain_pred_err, gain_coeff, 6) -
+ fcb_gain = expf(ff_scalarproduct_float_c(s->gain_pred_err, gain_coeff, 6) -
5.2409161640 + wmavoice_gain_codebook_fcb[idx]);
acb_gain = wmavoice_gain_codebook_acb[idx];
pred_err = av_clipf(wmavoice_gain_codebook_fcb[idx],
@@ -1726,9 +1730,6 @@ static int check_bits_for_superframe(GetBitContext *orig_gb,
* (if less than 480), usually used to prevent blanks at track boundaries.
*
* @param ctx WMA Voice decoder context
- * @param samples pointer to output buffer for voice samples
- * @param data_size pointer containing the size of #samples on input, and the
- * amount of #samples filled on output
* @return 0 on success, <0 on error or 1 if there was not enough data to
* fully parse the superframe
*/
@@ -1765,8 +1766,8 @@ static int synth_superframe(AVCodecContext *ctx, int *got_frame_ptr)
* are really WMAPro-in-WMAVoice-superframes. I've never seen those in
* the wild yet. */
if (!get_bits1(gb)) {
- av_log_missing_feature(ctx, "WMAPro-in-WMAVoice support", 1);
- return -1;
+ av_log_missing_feature(ctx, "WMAPro-in-WMAVoice", 1);
+ return AVERROR_PATCHWELCOME;
}
/* (optional) nr. of samples in superframe; always <= 480 and >= 0 */
@@ -1801,7 +1802,7 @@ static int synth_superframe(AVCodecContext *ctx, int *got_frame_ptr)
/* get output buffer */
s->frame.nb_samples = 480;
- if ((res = ctx->get_buffer(ctx, &s->frame)) < 0) {
+ if ((res = ff_get_buffer(ctx, &s->frame)) < 0) {
av_log(ctx, AV_LOG_ERROR, "get_buffer() failed\n");
return res;
}
@@ -2050,12 +2051,12 @@ static av_cold void wmavoice_flush(AVCodecContext *ctx)
AVCodec ff_wmavoice_decoder = {
.name = "wmavoice",
.type = AVMEDIA_TYPE_AUDIO,
- .id = CODEC_ID_WMAVOICE,
+ .id = AV_CODEC_ID_WMAVOICE,
.priv_data_size = sizeof(WMAVoiceContext),
.init = wmavoice_decode_init,
.close = wmavoice_decode_end,
.decode = wmavoice_decode_packet,
.capabilities = CODEC_CAP_SUBFRAMES | CODEC_CAP_DR1,
- .flush = wmavoice_flush,
- .long_name = NULL_IF_CONFIG_SMALL("Windows Media Audio Voice"),
+ .flush = wmavoice_flush,
+ .long_name = NULL_IF_CONFIG_SMALL("Windows Media Audio Voice"),
};
diff --git a/gst-libs/ext/libav/libavcodec/wmv2.c b/gst-libs/ext/libav/libavcodec/wmv2.c
index 74389ef..a3dcbb3 100644
--- a/gst-libs/ext/libav/libavcodec/wmv2.c
+++ b/gst-libs/ext/libav/libavcodec/wmv2.c
@@ -28,8 +28,8 @@
av_cold void ff_wmv2_common_init(Wmv2Context * w){
MpegEncContext * const s= &w->s;
- ff_init_scantable(s->dsp.idct_permutation, &w->abt_scantable[0], wmv2_scantableA);
- ff_init_scantable(s->dsp.idct_permutation, &w->abt_scantable[1], wmv2_scantableB);
+ ff_init_scantable(s->dsp.idct_permutation, &w->abt_scantable[0], ff_wmv2_scantableA);
+ ff_init_scantable(s->dsp.idct_permutation, &w->abt_scantable[1], ff_wmv2_scantableB);
}
static void wmv2_add_block(Wmv2Context *w, DCTELEM *block1, uint8_t *dst, int stride, int n){
@@ -102,7 +102,7 @@ void ff_mspel_motion(MpegEncContext *s,
if(s->flags&CODEC_FLAG_EMU_EDGE){
if(src_x<1 || src_y<1 || src_x + 17 >= s->h_edge_pos
|| src_y + h+1 >= v_edge_pos){
- s->dsp.emulated_edge_mc(s->edge_emu_buffer, ptr - 1 - s->linesize, s->linesize, 19, 19,
+ s->vdsp.emulated_edge_mc(s->edge_emu_buffer, ptr - 1 - s->linesize, s->linesize, 19, 19,
src_x-1, src_y-1, s->h_edge_pos, s->v_edge_pos);
ptr= s->edge_emu_buffer + 1 + s->linesize;
emu=1;
@@ -143,7 +143,7 @@ void ff_mspel_motion(MpegEncContext *s,
offset = (src_y * uvlinesize) + src_x;
ptr = ref_picture[1] + offset;
if(emu){
- s->dsp.emulated_edge_mc(s->edge_emu_buffer, ptr, s->uvlinesize, 9, 9,
+ s->vdsp.emulated_edge_mc(s->edge_emu_buffer, ptr, s->uvlinesize, 9, 9,
src_x, src_y, s->h_edge_pos>>1, s->v_edge_pos>>1);
ptr= s->edge_emu_buffer;
}
@@ -151,7 +151,7 @@ void ff_mspel_motion(MpegEncContext *s,
ptr = ref_picture[2] + offset;
if(emu){
- s->dsp.emulated_edge_mc(s->edge_emu_buffer, ptr, s->uvlinesize, 9, 9,
+ s->vdsp.emulated_edge_mc(s->edge_emu_buffer, ptr, s->uvlinesize, 9, 9,
src_x, src_y, s->h_edge_pos>>1, s->v_edge_pos>>1);
ptr= s->edge_emu_buffer;
}
diff --git a/gst-libs/ext/libav/libavcodec/wmv2dec.c b/gst-libs/ext/libav/libavcodec/wmv2dec.c
index 21fc1cf..c1fd4ee 100644
--- a/gst-libs/ext/libav/libavcodec/wmv2dec.c
+++ b/gst-libs/ext/libav/libavcodec/wmv2dec.c
@@ -244,8 +244,6 @@ static inline int wmv2_decode_motion(Wmv2Context *w, int *mx_ptr, int *my_ptr){
else
w->hshift= 0;
-//printf("%d %d ", *mx_ptr, *my_ptr);
-
return 0;
}
@@ -314,7 +312,6 @@ static inline int wmv2_decode_inter_block(Wmv2Context *w, DCTELEM *block, int n,
// const uint8_t *scantable= w->abt_type-1 ? w->abt_scantable[1].permutated : w->abt_scantable[0].scantable;
sub_cbp= sub_cbp_table[ decode012(&s->gb) ];
-// printf("S%d", sub_cbp);
if(sub_cbp&1){
if (ff_msmpeg4_decode_block(s, block, n, 1, scantable) < 0)
@@ -385,7 +382,6 @@ int ff_wmv2_decode_mb(MpegEncContext *s, DCTELEM block[6][64])
if (!s->mb_intra) {
int mx, my;
-//printf("P at %d %d\n", s->mb_x, s->mb_y);
wmv2_pred_motion(w, &mx, &my);
if(cbp){
@@ -419,13 +415,16 @@ int ff_wmv2_decode_mb(MpegEncContext *s, DCTELEM block[6][64])
}
}
} else {
-//if(s->pict_type==AV_PICTURE_TYPE_P)
-// printf("%d%d ", s->inter_intra_pred, cbp);
-//printf("I at %d %d %d %06X\n", s->mb_x, s->mb_y, ((cbp&3)? 1 : 0) +((cbp&0x3C)? 2 : 0), show_bits(&s->gb, 24));
+ if (s->pict_type==AV_PICTURE_TYPE_P)
+ av_dlog(s->avctx, "%d%d ", s->inter_intra_pred, cbp);
+ av_dlog(s->avctx, "I at %d %d %d %06X\n", s->mb_x, s->mb_y,
+ ((cbp & 3) ? 1 : 0) +((cbp & 0x3C)? 2 : 0),
+ show_bits(&s->gb, 24));
s->ac_pred = get_bits1(&s->gb);
if(s->inter_intra_pred){
s->h263_aic_dir= get_vlc2(&s->gb, ff_inter_intra_vlc.table, INTER_INTRA_VLC_BITS, 1);
-// printf("%d%d %d %d/", s->ac_pred, s->h263_aic_dir, s->mb_x, s->mb_y);
+ av_dlog(s->avctx, "%d%d %d %d/",
+ s->ac_pred, s->h263_aic_dir, s->mb_x, s->mb_y);
}
if(s->per_mb_rl_table && cbp){
s->rl_table_index = decode012(&s->gb);
@@ -473,13 +472,12 @@ static av_cold int wmv2_decode_end(AVCodecContext *avctx)
AVCodec ff_wmv2_decoder = {
.name = "wmv2",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_WMV2,
+ .id = AV_CODEC_ID_WMV2,
.priv_data_size = sizeof(Wmv2Context),
.init = wmv2_decode_init,
.close = wmv2_decode_end,
.decode = ff_h263_decode_frame,
.capabilities = CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1,
- .max_lowres = 3,
- .long_name = NULL_IF_CONFIG_SMALL("Windows Media Video 8"),
- .pix_fmts= ff_pixfmt_list_420,
+ .long_name = NULL_IF_CONFIG_SMALL("Windows Media Video 8"),
+ .pix_fmts = ff_pixfmt_list_420,
};
diff --git a/gst-libs/ext/libav/libavcodec/wmv2enc.c b/gst-libs/ext/libav/libavcodec/wmv2enc.c
index 78acad1..4643835 100644
--- a/gst-libs/ext/libav/libavcodec/wmv2enc.c
+++ b/gst-libs/ext/libav/libavcodec/wmv2enc.c
@@ -55,7 +55,7 @@ static int encode_ext_header(Wmv2Context *w){
static av_cold int wmv2_encode_init(AVCodecContext *avctx){
Wmv2Context * const w= avctx->priv_data;
- if(MPV_encode_init(avctx) < 0)
+ if(ff_MPV_encode_init(avctx) < 0)
return -1;
ff_wmv2_common_init(w);
@@ -167,8 +167,8 @@ void ff_wmv2_encode_mb(MpegEncContext * s,
}
put_bits(&s->pb,
- wmv2_inter_table[w->cbp_table_index][cbp + 64][1],
- wmv2_inter_table[w->cbp_table_index][cbp + 64][0]);
+ ff_wmv2_inter_table[w->cbp_table_index][cbp + 64][1],
+ ff_wmv2_inter_table[w->cbp_table_index][cbp + 64][0]);
/* motion vector */
ff_h263_pred_motion(s, 0, 0, &pred_x, &pred_y);
@@ -196,13 +196,13 @@ void ff_wmv2_encode_mb(MpegEncContext * s,
ff_msmp4_mb_i_table[coded_cbp][1], ff_msmp4_mb_i_table[coded_cbp][0]);
} else {
put_bits(&s->pb,
- wmv2_inter_table[w->cbp_table_index][cbp][1],
- wmv2_inter_table[w->cbp_table_index][cbp][0]);
+ ff_wmv2_inter_table[w->cbp_table_index][cbp][1],
+ ff_wmv2_inter_table[w->cbp_table_index][cbp][0]);
}
put_bits(&s->pb, 1, 0); /* no AC prediction yet */
if(s->inter_intra_pred){
s->h263_aic_dir=0;
- put_bits(&s->pb, table_inter_intra[s->h263_aic_dir][1], table_inter_intra[s->h263_aic_dir][0]);
+ put_bits(&s->pb, ff_table_inter_intra[s->h263_aic_dir][1], ff_table_inter_intra[s->h263_aic_dir][0]);
}
}
@@ -214,11 +214,11 @@ void ff_wmv2_encode_mb(MpegEncContext * s,
AVCodec ff_wmv2_encoder = {
.name = "wmv2",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_WMV2,
+ .id = AV_CODEC_ID_WMV2,
.priv_data_size = sizeof(Wmv2Context),
.init = wmv2_encode_init,
- .encode = MPV_encode_picture,
- .close = MPV_encode_end,
- .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE},
- .long_name= NULL_IF_CONFIG_SMALL("Windows Media Video 8"),
+ .encode2 = ff_MPV_encode_picture,
+ .close = ff_MPV_encode_end,
+ .pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_YUV420P, AV_PIX_FMT_NONE },
+ .long_name = NULL_IF_CONFIG_SMALL("Windows Media Video 8"),
};
diff --git a/gst-libs/ext/libav/libavcodec/wnv1.c b/gst-libs/ext/libav/libavcodec/wnv1.c
index f6e4694..1636f16 100644
--- a/gst-libs/ext/libav/libavcodec/wnv1.c
+++ b/gst-libs/ext/libav/libavcodec/wnv1.c
@@ -26,10 +26,11 @@
#include "avcodec.h"
#include "get_bits.h"
-#include "libavutil/common.h"
+#include "internal.h"
+#include "mathops.h"
-typedef struct WNV1Context{
+typedef struct WNV1Context {
AVCodecContext *avctx;
AVFrame pic;
@@ -37,10 +38,10 @@ typedef struct WNV1Context{
GetBitContext gb;
} WNV1Context;
-static const uint16_t code_tab[16][2]={
-{0x1FD,9}, {0xFD,8}, {0x7D,7}, {0x3D,6}, {0x1D,5}, {0x0D,4}, {0x005,3},
-{0x000,1},
-{0x004,3}, {0x0C,4}, {0x1C,5}, {0x3C,6}, {0x7C,7}, {0xFC,8}, {0x1FC,9}, {0xFF,8}
+static const uint16_t code_tab[16][2] = {
+ { 0x1FD, 9 }, { 0xFD, 8 }, { 0x7D, 7 }, { 0x3D, 6 }, { 0x1D, 5 }, { 0x0D, 4 }, { 0x005, 3 },
+ { 0x000, 1 },
+ { 0x004, 3 }, { 0x0C, 4 }, { 0x1C, 5 }, { 0x3C, 6 }, { 0x7C, 7 }, { 0xFC, 8 }, { 0x1FC, 9 }, { 0xFF, 8 }
};
#define CODE_VLC_BITS 9
@@ -51,45 +52,45 @@ static inline int wnv1_get_code(WNV1Context *w, int base_value)
{
int v = get_vlc2(&w->gb, code_vlc.table, CODE_VLC_BITS, 1);
- if(v==15)
- return av_reverse[ get_bits(&w->gb, 8 - w->shift) ];
+ if (v == 15)
+ return ff_reverse[get_bits(&w->gb, 8 - w->shift)];
else
- return base_value + ((v - 7)<<w->shift);
+ return base_value + ((v - 7) << w->shift);
}
static int decode_frame(AVCodecContext *avctx,
- void *data, int *data_size,
+ void *data, int *got_frame,
AVPacket *avpkt)
{
- const uint8_t *buf = avpkt->data;
- int buf_size = avpkt->size;
WNV1Context * const l = avctx->priv_data;
- AVFrame * const p= (AVFrame*)&l->pic;
+ const uint8_t *buf = avpkt->data;
+ int buf_size = avpkt->size;
+ AVFrame * const p = &l->pic;
unsigned char *Y,*U,*V;
int i, j;
int prev_y = 0, prev_u = 0, prev_v = 0;
uint8_t *rbuf;
rbuf = av_malloc(buf_size + FF_INPUT_BUFFER_PADDING_SIZE);
- if(!rbuf){
+ if (!rbuf) {
av_log(avctx, AV_LOG_ERROR, "Cannot allocate temporary buffer\n");
return -1;
}
- if(p->data[0])
+ if (p->data[0])
avctx->release_buffer(avctx, p);
p->reference = 0;
- if(avctx->get_buffer(avctx, p) < 0){
+ if(ff_get_buffer(avctx, p) < 0){
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
av_free(rbuf);
return -1;
}
p->key_frame = 1;
- for(i=8; i<buf_size; i++)
- rbuf[i]= av_reverse[ buf[i] ];
- init_get_bits(&l->gb, rbuf+8, (buf_size-8)*8);
+ for (i = 8; i < buf_size; i++)
+ rbuf[i] = ff_reverse[buf[i]];
+ init_get_bits(&l->gb, rbuf + 8, (buf_size - 8) * 8);
if (buf[2] >> 4 == 6)
l->shift = 2;
@@ -123,21 +124,22 @@ static int decode_frame(AVCodecContext *avctx,
}
- *data_size = sizeof(AVFrame);
+ *got_frame = 1;
*(AVFrame*)data = l->pic;
av_free(rbuf);
return buf_size;
}
-static av_cold int decode_init(AVCodecContext *avctx){
+static av_cold int decode_init(AVCodecContext *avctx)
+{
WNV1Context * const l = avctx->priv_data;
static VLC_TYPE code_table[1 << CODE_VLC_BITS][2];
- l->avctx = avctx;
- avctx->pix_fmt = PIX_FMT_YUV422P;
+ l->avctx = avctx;
+ avctx->pix_fmt = AV_PIX_FMT_YUV422P;
- code_vlc.table = code_table;
+ code_vlc.table = code_table;
code_vlc.table_allocated = 1 << CODE_VLC_BITS;
init_vlc(&code_vlc, CODE_VLC_BITS, 16,
&code_tab[0][1], 4, 2,
@@ -146,7 +148,8 @@ static av_cold int decode_init(AVCodecContext *avctx){
return 0;
}
-static av_cold int decode_end(AVCodecContext *avctx){
+static av_cold int decode_end(AVCodecContext *avctx)
+{
WNV1Context * const l = avctx->priv_data;
AVFrame *pic = &l->pic;
@@ -159,11 +162,11 @@ static av_cold int decode_end(AVCodecContext *avctx){
AVCodec ff_wnv1_decoder = {
.name = "wnv1",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_WNV1,
+ .id = AV_CODEC_ID_WNV1,
.priv_data_size = sizeof(WNV1Context),
.init = decode_init,
.close = decode_end,
.decode = decode_frame,
.capabilities = CODEC_CAP_DR1,
- .long_name = NULL_IF_CONFIG_SMALL("Winnov WNV1"),
+ .long_name = NULL_IF_CONFIG_SMALL("Winnov WNV1"),
};
diff --git a/gst-libs/ext/libav/libavcodec/ws-snd1.c b/gst-libs/ext/libav/libavcodec/ws-snd1.c
index 15eb6f8..62e0c6f 100644
--- a/gst-libs/ext/libav/libavcodec/ws-snd1.c
+++ b/gst-libs/ext/libav/libavcodec/ws-snd1.c
@@ -20,8 +20,12 @@
*/
#include <stdint.h>
+
+#include "libavutil/channel_layout.h"
+#include "libavutil/common.h"
#include "libavutil/intreadwrite.h"
#include "avcodec.h"
+#include "internal.h"
/**
* @file
@@ -45,12 +49,9 @@ static av_cold int ws_snd_decode_init(AVCodecContext *avctx)
{
WSSndContext *s = avctx->priv_data;
- if (avctx->channels != 1) {
- av_log_ask_for_sample(avctx, "unsupported number of channels\n");
- return AVERROR(EINVAL);
- }
-
- avctx->sample_fmt = AV_SAMPLE_FMT_U8;
+ avctx->channels = 1;
+ avctx->channel_layout = AV_CH_LAYOUT_MONO;
+ avctx->sample_fmt = AV_SAMPLE_FMT_U8;
avcodec_get_frame_defaults(&s->frame);
avctx->coded_frame = &s->frame;
@@ -89,7 +90,7 @@ static int ws_snd_decode_frame(AVCodecContext *avctx, void *data,
/* get output buffer */
s->frame.nb_samples = out_size;
- if ((ret = avctx->get_buffer(avctx, &s->frame)) < 0) {
+ if ((ret = ff_get_buffer(avctx, &s->frame)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return ret;
}
@@ -112,8 +113,8 @@ static int ws_snd_decode_frame(AVCodecContext *avctx, void *data,
/* make sure we don't write past the output buffer */
switch (code) {
- case 0: smp = 4*(count+1); break;
- case 1: smp = 2*(count+1); break;
+ case 0: smp = 4 * (count + 1); break;
+ case 1: smp = 2 * (count + 1); break;
case 2: smp = (count & 0x20) ? 1 : count + 1; break;
default: smp = count + 1; break;
}
@@ -185,10 +186,10 @@ static int ws_snd_decode_frame(AVCodecContext *avctx, void *data,
AVCodec ff_ws_snd1_decoder = {
.name = "ws_snd1",
.type = AVMEDIA_TYPE_AUDIO,
- .id = CODEC_ID_WESTWOOD_SND1,
+ .id = AV_CODEC_ID_WESTWOOD_SND1,
.priv_data_size = sizeof(WSSndContext),
.init = ws_snd_decode_init,
.decode = ws_snd_decode_frame,
.capabilities = CODEC_CAP_DR1,
- .long_name = NULL_IF_CONFIG_SMALL("Westwood Audio (SND1)"),
+ .long_name = NULL_IF_CONFIG_SMALL("Westwood Audio (SND1)"),
};
diff --git a/gst-libs/ext/libav/libavcodec/x86/Makefile b/gst-libs/ext/libav/libavcodec/x86/Makefile
index 1e88e4a..4fc7ac0 100644
--- a/gst-libs/ext/libav/libavcodec/x86/Makefile
+++ b/gst-libs/ext/libav/libavcodec/x86/Makefile
@@ -1,73 +1,71 @@
+OBJS += x86/fmtconvert_init.o
+
+OBJS-$(CONFIG_AAC_DECODER) += x86/sbrdsp_init.o
+OBJS-$(CONFIG_AC3DSP) += x86/ac3dsp_init.o
+OBJS-$(CONFIG_CAVS_DECODER) += x86/cavsdsp.o
+OBJS-$(CONFIG_DNXHD_ENCODER) += x86/dnxhdenc.o
+OBJS-$(CONFIG_FFT) += x86/fft_init.o
+OBJS-$(CONFIG_H264DSP) += x86/h264dsp_init.o
+OBJS-$(CONFIG_H264PRED) += x86/h264_intrapred_init.o
+OBJS-$(CONFIG_LPC) += x86/lpc.o
OBJS-$(CONFIG_MLP_DECODER) += x86/mlpdsp.o
+OBJS-$(CONFIG_MPEGAUDIODSP) += x86/mpegaudiodec.o
+OBJS-$(CONFIG_MPEGVIDEO) += x86/mpegvideo.o
+OBJS-$(CONFIG_MPEGVIDEOENC) += x86/mpegvideoenc.o
+OBJS-$(CONFIG_PNG_DECODER) += x86/pngdsp_init.o
+OBJS-$(CONFIG_PRORES_DECODER) += x86/proresdsp_init.o
+OBJS-$(CONFIG_RV30_DECODER) += x86/rv34dsp_init.o
+OBJS-$(CONFIG_RV40_DECODER) += x86/rv34dsp_init.o \
+ x86/rv40dsp_init.o
OBJS-$(CONFIG_TRUEHD_DECODER) += x86/mlpdsp.o
+OBJS-$(CONFIG_VC1_DECODER) += x86/vc1dsp_init.o
+OBJS-$(CONFIG_VIDEODSP) += x86/videodsp_init.o
+OBJS-$(CONFIG_VP3DSP) += x86/vp3dsp_init.o
+OBJS-$(CONFIG_VP5_DECODER) += x86/vp56dsp_init.o
+OBJS-$(CONFIG_VP6_DECODER) += x86/vp56dsp_init.o
+OBJS-$(CONFIG_VP8_DECODER) += x86/vp8dsp_init.o
+OBJS-$(CONFIG_XMM_CLOBBER_TEST) += x86/w64xmmtest.o
-YASM-OBJS-$(CONFIG_DCT) += x86/dct32_sse.o
+MMX-OBJS += x86/dsputil_mmx.o \
+ x86/fdct.o \
+ x86/idct_mmx_xvid.o \
+ x86/idct_sse2_xvid.o \
+ x86/simple_idct.o \
-YASM-OBJS-FFT-$(HAVE_AMD3DNOW) += x86/fft_3dn.o
-YASM-OBJS-FFT-$(HAVE_AMD3DNOWEXT) += x86/fft_3dn2.o
-YASM-OBJS-FFT-$(HAVE_SSE) += x86/fft_sse.o
-YASM-OBJS-$(CONFIG_FFT) += x86/fft_mmx.o \
- $(YASM-OBJS-FFT-yes)
+MMX-OBJS-$(CONFIG_DWT) += x86/snowdsp.o
+MMX-OBJS-$(CONFIG_ENCODERS) += x86/dsputilenc_mmx.o \
+ x86/motion_est.o
+MMX-OBJS-$(CONFIG_VC1_DECODER) += x86/vc1dsp_mmx.o
+YASM-OBJS-$(CONFIG_AAC_DECODER) += x86/sbrdsp.o
+YASM-OBJS-$(CONFIG_AC3DSP) += x86/ac3dsp.o
+YASM-OBJS-$(CONFIG_DCT) += x86/dct32.o
+YASM-OBJS-$(CONFIG_ENCODERS) += x86/dsputilenc.o
+YASM-OBJS-$(CONFIG_FFT) += x86/fft.o
YASM-OBJS-$(CONFIG_H264CHROMA) += x86/h264_chromamc.o \
x86/h264_chromamc_10bit.o
-
-MMX-OBJS-$(CONFIG_H264DSP) += x86/h264dsp_mmx.o
YASM-OBJS-$(CONFIG_H264DSP) += x86/h264_deblock.o \
x86/h264_deblock_10bit.o \
x86/h264_idct.o \
x86/h264_idct_10bit.o \
x86/h264_weight.o \
- x86/h264_weight_10bit.o \
-
+ x86/h264_weight_10bit.o
YASM-OBJS-$(CONFIG_H264PRED) += x86/h264_intrapred.o \
x86/h264_intrapred_10bit.o
-MMX-OBJS-$(CONFIG_H264PRED) += x86/h264_intrapred_init.o
-
-MMX-OBJS-$(CONFIG_RV30_DECODER) += x86/rv34dsp_init.o
+YASM-OBJS-$(CONFIG_H264QPEL) += x86/h264_qpel_8bit.o \
+ x86/h264_qpel_10bit.o
+YASM-OBJS-$(CONFIG_MPEGAUDIODSP) += x86/imdct36.o
+YASM-OBJS-$(CONFIG_PNG_DECODER) += x86/pngdsp.o
+YASM-OBJS-$(CONFIG_PRORES_DECODER) += x86/proresdsp.o
YASM-OBJS-$(CONFIG_RV30_DECODER) += x86/rv34dsp.o
-MMX-OBJS-$(CONFIG_RV40_DECODER) += x86/rv34dsp_init.o \
+YASM-OBJS-$(CONFIG_RV40_DECODER) += x86/rv34dsp.o \
x86/rv40dsp.o
-YASM-OBJS-$(CONFIG_RV40_DECODER) += x86/rv34dsp.o
-
-YASM-OBJS-$(CONFIG_VC1_DECODER) += x86/vc1dsp_yasm.o
-
-MMX-OBJS-$(CONFIG_AC3DSP) += x86/ac3dsp_mmx.o
-YASM-OBJS-$(CONFIG_AC3DSP) += x86/ac3dsp.o
-MMX-OBJS-$(CONFIG_CAVS_DECODER) += x86/cavsdsp_mmx.o
-MMX-OBJS-$(CONFIG_DNXHD_ENCODER) += x86/dnxhd_mmx.o
-MMX-OBJS-$(CONFIG_MPEGAUDIODSP) += x86/mpegaudiodec_mmx.o
-YASM-OBJS-$(CONFIG_MPEGAUDIODSP) += x86/imdct36_sse.o
-MMX-OBJS-$(CONFIG_ENCODERS) += x86/dsputilenc_mmx.o
-YASM-OBJS-$(CONFIG_ENCODERS) += x86/dsputilenc_yasm.o
-MMX-OBJS-$(CONFIG_GPL) += x86/idct_mmx.o
-MMX-OBJS-$(CONFIG_LPC) += x86/lpc_mmx.o
-YASM-OBJS-$(CONFIG_PRORES_DECODER) += x86/proresdsp.o
-MMX-OBJS-$(CONFIG_PRORES_DECODER) += x86/proresdsp-init.o
-MMX-OBJS-$(CONFIG_DWT) += x86/snowdsp_mmx.o
-MMX-OBJS-$(CONFIG_VC1_DECODER) += x86/vc1dsp_mmx.o
-YASM-OBJS-$(CONFIG_VP3_DECODER) += x86/vp3dsp.o
-YASM-OBJS-$(CONFIG_VP5_DECODER) += x86/vp3dsp.o
-MMX-OBJS-$(CONFIG_VP5_DECODER) += x86/vp56dsp_init.o
-YASM-OBJS-$(CONFIG_VP6_DECODER) += x86/vp3dsp.o \
- x86/vp56dsp.o
-MMX-OBJS-$(CONFIG_VP6_DECODER) += x86/vp56dsp_init.o
+YASM-OBJS-$(CONFIG_VC1_DECODER) += x86/vc1dsp.o
+YASM-OBJS-$(CONFIG_VIDEODSP) += x86/videodsp.o
+YASM-OBJS-$(CONFIG_VP3DSP) += x86/vp3dsp.o
+YASM-OBJS-$(CONFIG_VP6_DECODER) += x86/vp56dsp.o
YASM-OBJS-$(CONFIG_VP8_DECODER) += x86/vp8dsp.o
-MMX-OBJS-$(CONFIG_VP8_DECODER) += x86/vp8dsp-init.o
-MMX-OBJS-$(HAVE_YASM) += x86/dsputil_yasm.o \
+
+YASM-OBJS += x86/dsputil.o \
x86/deinterlace.o \
x86/fmtconvert.o \
- x86/h264_qpel_10bit.o \
- $(YASM-OBJS-yes)
-
-MMX-OBJS-$(CONFIG_FFT) += x86/fft.o
-
-OBJS-$(HAVE_MMX) += x86/dsputil_mmx.o \
- x86/fdct_mmx.o \
- x86/fmtconvert_mmx.o \
- x86/idct_mmx_xvid.o \
- x86/idct_sse2_xvid.o \
- x86/motion_est_mmx.o \
- x86/mpegvideo_mmx.o \
- x86/simple_idct_mmx.o \
-
diff --git a/gst-libs/ext/libav/libavcodec/x86/ac3dsp.asm b/gst-libs/ext/libav/libavcodec/x86/ac3dsp.asm
index 9312ff6..45c30d1 100644
--- a/gst-libs/ext/libav/libavcodec/x86/ac3dsp.asm
+++ b/gst-libs/ext/libav/libavcodec/x86/ac3dsp.asm
@@ -19,8 +19,7 @@
;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
;******************************************************************************
-%include "x86inc.asm"
-%include "x86util.asm"
+%include "libavutil/x86/x86util.asm"
SECTION_RODATA
@@ -42,8 +41,8 @@ SECTION .text
; void ff_ac3_exponent_min(uint8_t *exp, int num_reuse_blocks, int nb_coefs)
;-----------------------------------------------------------------------------
-%macro AC3_EXPONENT_MIN 1
-cglobal ac3_exponent_min_%1, 3,4,2, exp, reuse_blks, expn, offset
+%macro AC3_EXPONENT_MIN 0
+cglobal ac3_exponent_min, 3, 4, 2, exp, reuse_blks, expn, offset
shl reuse_blksq, 8
jz .end
LOOP_ALIGN
@@ -64,20 +63,18 @@ cglobal ac3_exponent_min_%1, 3,4,2, exp, reuse_blks, expn, offset
REP_RET
%endmacro
-%define PMINUB PMINUB_MMX
%define LOOP_ALIGN
-INIT_MMX
-AC3_EXPONENT_MIN mmx
-%ifdef HAVE_MMX2
-%define PMINUB PMINUB_MMXEXT
+INIT_MMX mmx
+AC3_EXPONENT_MIN
+%if HAVE_MMXEXT_EXTERNAL
%define LOOP_ALIGN ALIGN 16
-AC3_EXPONENT_MIN mmxext
+INIT_MMX mmxext
+AC3_EXPONENT_MIN
%endif
-%ifdef HAVE_SSE
-INIT_XMM
-AC3_EXPONENT_MIN sse2
+%if HAVE_SSE2_EXTERNAL
+INIT_XMM sse2
+AC3_EXPONENT_MIN
%endif
-%undef PMINUB
%undef LOOP_ALIGN
;-----------------------------------------------------------------------------
@@ -91,12 +88,36 @@ AC3_EXPONENT_MIN sse2
; This is used for mmxext and sse2 because they have pminsw/pmaxsw.
;-----------------------------------------------------------------------------
-%macro AC3_MAX_MSB_ABS_INT16 2
-cglobal ac3_max_msb_abs_int16_%1, 2,2,5, src, len
+; logical 'or' of 4 or 8 words in an mmx or xmm register into the low word
+%macro OR_WORDS_HORIZ 2 ; src, tmp
+%if cpuflag(sse2)
+ movhlps %2, %1
+ por %1, %2
+ pshuflw %2, %1, q0032
+ por %1, %2
+ pshuflw %2, %1, q0001
+ por %1, %2
+%elif cpuflag(mmxext)
+ pshufw %2, %1, q0032
+ por %1, %2
+ pshufw %2, %1, q0001
+ por %1, %2
+%else ; mmx
+ movq %2, %1
+ psrlq %2, 32
+ por %1, %2
+ movq %2, %1
+ psrlq %2, 16
+ por %1, %2
+%endif
+%endmacro
+
+%macro AC3_MAX_MSB_ABS_INT16 1
+cglobal ac3_max_msb_abs_int16, 2,2,5, src, len
pxor m2, m2
pxor m3, m3
.loop:
-%ifidn %2, min_max
+%ifidn %1, min_max
mova m0, [srcq]
mova m1, [srcq+mmsize]
pminsw m2, m0
@@ -104,7 +125,7 @@ cglobal ac3_max_msb_abs_int16_%1, 2,2,5, src, len
pmaxsw m3, m0
pmaxsw m3, m1
%else ; or_abs
-%ifidn %1, mmx
+%if notcpuflag(ssse3)
mova m0, [srcq]
mova m1, [srcq+mmsize]
ABS2 m0, m1, m3, m4
@@ -119,41 +140,34 @@ cglobal ac3_max_msb_abs_int16_%1, 2,2,5, src, len
add srcq, mmsize*2
sub lend, mmsize
ja .loop
-%ifidn %2, min_max
+%ifidn %1, min_max
ABS2 m2, m3, m0, m1
por m2, m3
%endif
-%ifidn mmsize, 16
- movhlps m0, m2
- por m2, m0
-%endif
- PSHUFLW m0, m2, 0xe
- por m2, m0
- PSHUFLW m0, m2, 0x1
- por m2, m0
+ OR_WORDS_HORIZ m2, m0
movd eax, m2
and eax, 0xFFFF
RET
%endmacro
-INIT_MMX
+INIT_MMX mmx
%define ABS2 ABS2_MMX
-%define PSHUFLW pshufw
-AC3_MAX_MSB_ABS_INT16 mmx, or_abs
-%define ABS2 ABS2_MMX2
-AC3_MAX_MSB_ABS_INT16 mmxext, min_max
-INIT_XMM
-%define PSHUFLW pshuflw
-AC3_MAX_MSB_ABS_INT16 sse2, min_max
+AC3_MAX_MSB_ABS_INT16 or_abs
+INIT_MMX mmxext
+%define ABS2 ABS2_MMXEXT
+AC3_MAX_MSB_ABS_INT16 min_max
+INIT_XMM sse2
+AC3_MAX_MSB_ABS_INT16 min_max
+INIT_XMM ssse3
%define ABS2 ABS2_SSSE3
-AC3_MAX_MSB_ABS_INT16 ssse3, or_abs
+AC3_MAX_MSB_ABS_INT16 or_abs
;-----------------------------------------------------------------------------
; macro used for ff_ac3_lshift_int16() and ff_ac3_rshift_int32()
;-----------------------------------------------------------------------------
-%macro AC3_SHIFT 4 ; l/r, 16/32, shift instruction, instruction set
-cglobal ac3_%1shift_int%2_%4, 3,3,5, src, len, shift
+%macro AC3_SHIFT 3 ; l/r, 16/32, shift instruction, instruction set
+cglobal ac3_%1shift_int%2, 3, 3, 5, src, len, shift
movd m0, shiftd
.loop:
mova m1, [srcq ]
@@ -179,19 +193,19 @@ cglobal ac3_%1shift_int%2_%4, 3,3,5, src, len, shift
; void ff_ac3_lshift_int16(int16_t *src, unsigned int len, unsigned int shift)
;-----------------------------------------------------------------------------
-INIT_MMX
-AC3_SHIFT l, 16, psllw, mmx
-INIT_XMM
-AC3_SHIFT l, 16, psllw, sse2
+INIT_MMX mmx
+AC3_SHIFT l, 16, psllw
+INIT_XMM sse2
+AC3_SHIFT l, 16, psllw
;-----------------------------------------------------------------------------
; void ff_ac3_rshift_int32(int32_t *src, unsigned int len, unsigned int shift)
;-----------------------------------------------------------------------------
-INIT_MMX
-AC3_SHIFT r, 32, psrad, mmx
-INIT_XMM
-AC3_SHIFT r, 32, psrad, sse2
+INIT_MMX mmx
+AC3_SHIFT r, 32, psrad
+INIT_XMM sse2
+AC3_SHIFT r, 32, psrad
;-----------------------------------------------------------------------------
; void ff_float_to_fixed24(int32_t *dst, const float *src, unsigned int len)
@@ -199,8 +213,8 @@ AC3_SHIFT r, 32, psrad, sse2
; The 3DNow! version is not bit-identical because pf2id uses truncation rather
; than round-to-nearest.
-INIT_MMX
-cglobal float_to_fixed24_3dnow, 3,3,0, dst, src, len
+INIT_MMX 3dnow
+cglobal float_to_fixed24, 3, 3, 0, dst, src, len
movq m0, [pf_1_24]
.loop:
movq m1, [srcq ]
@@ -223,10 +237,11 @@ cglobal float_to_fixed24_3dnow, 3,3,0, dst, src, len
add dstq, 32
sub lend, 8
ja .loop
- REP_RET
+ femms
+ RET
-INIT_XMM
-cglobal float_to_fixed24_sse, 3,3,3, dst, src, len
+INIT_XMM sse
+cglobal float_to_fixed24, 3, 3, 3, dst, src, len
movaps m0, [pf_1_24]
.loop:
movaps m1, [srcq ]
@@ -247,10 +262,11 @@ cglobal float_to_fixed24_sse, 3,3,3, dst, src, len
add dstq, 32
sub lend, 8
ja .loop
- REP_RET
+ emms
+ RET
-INIT_XMM
-cglobal float_to_fixed24_sse2, 3,3,9, dst, src, len
+INIT_XMM sse2
+cglobal float_to_fixed24, 3, 3, 9, dst, src, len
movaps m0, [pf_1_24]
.loop:
movaps m1, [srcq ]
@@ -314,8 +330,8 @@ cglobal float_to_fixed24_sse2, 3,3,9, dst, src, len
paddd %1, %2
%endmacro
-INIT_XMM
-cglobal ac3_compute_mantissa_size_sse2, 1,2,4, mant_cnt, sum
+INIT_XMM sse2
+cglobal ac3_compute_mantissa_size, 1, 2, 4, mant_cnt, sum
movdqa m0, [mant_cntq ]
movdqa m1, [mant_cntq+ 1*16]
paddw m0, [mant_cntq+ 2*16]
@@ -355,20 +371,20 @@ cglobal ac3_compute_mantissa_size_sse2, 1,2,4, mant_cnt, sum
; void ff_ac3_extract_exponents(uint8_t *exp, int32_t *coef, int nb_coefs)
;------------------------------------------------------------------------------
-%macro PABSD_MMX 2 ; src/dst, tmp
+%macro PABSD 1-2 ; src/dst, unused
+%if cpuflag(ssse3)
+ pabsd %1, %1
+%else ; src/dst, tmp
pxor %2, %2
pcmpgtd %2, %1
pxor %1, %2
psubd %1, %2
+%endif
%endmacro
-%macro PABSD_SSSE3 1-2 ; src/dst, unused
- pabsd %1, %1
-%endmacro
-
-%ifdef HAVE_AMD3DNOW
-INIT_MMX
-cglobal ac3_extract_exponents_3dnow, 3,3,0, exp, coef, len
+%if HAVE_AMD3DNOW_EXTERNAL
+INIT_MMX 3dnow
+cglobal ac3_extract_exponents, 3, 3, 0, exp, coef, len
add expq, lenq
lea coefq, [coefq+4*lenq]
neg lenq
@@ -377,8 +393,8 @@ cglobal ac3_extract_exponents_3dnow, 3,3,0, exp, coef, len
.loop:
movq m0, [coefq+4*lenq ]
movq m1, [coefq+4*lenq+8]
- PABSD_MMX m0, m2
- PABSD_MMX m1, m2
+ PABSD m0, m2
+ PABSD m1, m2
pslld m0, 1
por m0, m3
pi2fd m2, m0
@@ -402,8 +418,8 @@ cglobal ac3_extract_exponents_3dnow, 3,3,0, exp, coef, len
REP_RET
%endif
-%macro AC3_EXTRACT_EXPONENTS 1
-cglobal ac3_extract_exponents_%1, 3,3,4, exp, coef, len
+%macro AC3_EXTRACT_EXPONENTS 0
+cglobal ac3_extract_exponents, 3, 3, 4, exp, coef, len
add expq, lenq
lea coefq, [coefq+4*lenq]
neg lenq
@@ -434,12 +450,11 @@ cglobal ac3_extract_exponents_%1, 3,3,4, exp, coef, len
REP_RET
%endmacro
-%ifdef HAVE_SSE
-INIT_XMM
-%define PABSD PABSD_MMX
-AC3_EXTRACT_EXPONENTS sse2
-%ifdef HAVE_SSSE3
-%define PABSD PABSD_SSSE3
-AC3_EXTRACT_EXPONENTS ssse3
+%if HAVE_SSE2_EXTERNAL
+INIT_XMM sse2
+AC3_EXTRACT_EXPONENTS
%endif
+%if HAVE_SSSE3_EXTERNAL
+INIT_XMM ssse3
+AC3_EXTRACT_EXPONENTS
%endif
diff --git a/gst-libs/ext/libav/libavcodec/x86/ac3dsp_init.c b/gst-libs/ext/libav/libavcodec/x86/ac3dsp_init.c
new file mode 100644
index 0000000..e8f7304
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/x86/ac3dsp_init.c
@@ -0,0 +1,227 @@
+/*
+ * x86-optimized AC-3 DSP utils
+ * Copyright (c) 2011 Justin Ruggles
+ *
+ * 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
+ */
+
+#include "libavutil/mem.h"
+#include "libavutil/x86/asm.h"
+#include "libavutil/x86/cpu.h"
+#include "dsputil_mmx.h"
+#include "libavcodec/ac3.h"
+#include "libavcodec/ac3dsp.h"
+
+extern void ff_ac3_exponent_min_mmx (uint8_t *exp, int num_reuse_blocks, int nb_coefs);
+extern void ff_ac3_exponent_min_mmxext(uint8_t *exp, int num_reuse_blocks, int nb_coefs);
+extern void ff_ac3_exponent_min_sse2 (uint8_t *exp, int num_reuse_blocks, int nb_coefs);
+
+extern int ff_ac3_max_msb_abs_int16_mmx (const int16_t *src, int len);
+extern int ff_ac3_max_msb_abs_int16_mmxext(const int16_t *src, int len);
+extern int ff_ac3_max_msb_abs_int16_sse2 (const int16_t *src, int len);
+extern int ff_ac3_max_msb_abs_int16_ssse3(const int16_t *src, int len);
+
+extern void ff_ac3_lshift_int16_mmx (int16_t *src, unsigned int len, unsigned int shift);
+extern void ff_ac3_lshift_int16_sse2(int16_t *src, unsigned int len, unsigned int shift);
+
+extern void ff_ac3_rshift_int32_mmx (int32_t *src, unsigned int len, unsigned int shift);
+extern void ff_ac3_rshift_int32_sse2(int32_t *src, unsigned int len, unsigned int shift);
+
+extern void ff_float_to_fixed24_3dnow(int32_t *dst, const float *src, unsigned int len);
+extern void ff_float_to_fixed24_sse (int32_t *dst, const float *src, unsigned int len);
+extern void ff_float_to_fixed24_sse2 (int32_t *dst, const float *src, unsigned int len);
+
+extern int ff_ac3_compute_mantissa_size_sse2(uint16_t mant_cnt[6][16]);
+
+extern void ff_ac3_extract_exponents_3dnow(uint8_t *exp, int32_t *coef, int nb_coefs);
+extern void ff_ac3_extract_exponents_sse2 (uint8_t *exp, int32_t *coef, int nb_coefs);
+extern void ff_ac3_extract_exponents_ssse3(uint8_t *exp, int32_t *coef, int nb_coefs);
+
+#if HAVE_SSE_INLINE && HAVE_7REGS
+
+#define IF1(x) x
+#define IF0(x)
+
+#define MIX5(mono, stereo) \
+ __asm__ volatile ( \
+ "movss 0(%1), %%xmm5 \n" \
+ "movss 8(%1), %%xmm6 \n" \
+ "movss 24(%1), %%xmm7 \n" \
+ "shufps $0, %%xmm5, %%xmm5 \n" \
+ "shufps $0, %%xmm6, %%xmm6 \n" \
+ "shufps $0, %%xmm7, %%xmm7 \n" \
+ "1: \n" \
+ "movaps (%0, %2), %%xmm0 \n" \
+ "movaps (%0, %3), %%xmm1 \n" \
+ "movaps (%0, %4), %%xmm2 \n" \
+ "movaps (%0, %5), %%xmm3 \n" \
+ "movaps (%0, %6), %%xmm4 \n" \
+ "mulps %%xmm5, %%xmm0 \n" \
+ "mulps %%xmm6, %%xmm1 \n" \
+ "mulps %%xmm5, %%xmm2 \n" \
+ "mulps %%xmm7, %%xmm3 \n" \
+ "mulps %%xmm7, %%xmm4 \n" \
+ stereo("addps %%xmm1, %%xmm0 \n") \
+ "addps %%xmm1, %%xmm2 \n" \
+ "addps %%xmm3, %%xmm0 \n" \
+ "addps %%xmm4, %%xmm2 \n" \
+ mono("addps %%xmm2, %%xmm0 \n") \
+ "movaps %%xmm0, (%0, %2) \n" \
+ stereo("movaps %%xmm2, (%0, %3) \n") \
+ "add $16, %0 \n" \
+ "jl 1b \n" \
+ : "+&r"(i) \
+ : "r"(matrix), \
+ "r"(samples[0] + len), \
+ "r"(samples[1] + len), \
+ "r"(samples[2] + len), \
+ "r"(samples[3] + len), \
+ "r"(samples[4] + len) \
+ : XMM_CLOBBERS("%xmm0", "%xmm1", "%xmm2", "%xmm3", \
+ "%xmm4", "%xmm5", "%xmm6", "%xmm7",) \
+ "memory" \
+ );
+
+#define MIX_MISC(stereo) \
+ __asm__ volatile ( \
+ "mov %5, %2 \n" \
+ "1: \n" \
+ "mov -%c7(%6, %2, %c8), %3 \n" \
+ "movaps (%3, %0), %%xmm0 \n" \
+ stereo("movaps %%xmm0, %%xmm1 \n") \
+ "mulps %%xmm4, %%xmm0 \n" \
+ stereo("mulps %%xmm5, %%xmm1 \n") \
+ "2: \n" \
+ "mov (%6, %2, %c8), %1 \n" \
+ "movaps (%1, %0), %%xmm2 \n" \
+ stereo("movaps %%xmm2, %%xmm3 \n") \
+ "mulps (%4, %2, 8), %%xmm2 \n" \
+ stereo("mulps 16(%4, %2, 8), %%xmm3 \n") \
+ "addps %%xmm2, %%xmm0 \n" \
+ stereo("addps %%xmm3, %%xmm1 \n") \
+ "add $4, %2 \n" \
+ "jl 2b \n" \
+ "mov %5, %2 \n" \
+ stereo("mov (%6, %2, %c8), %1 \n") \
+ "movaps %%xmm0, (%3, %0) \n" \
+ stereo("movaps %%xmm1, (%1, %0) \n") \
+ "add $16, %0 \n" \
+ "jl 1b \n" \
+ : "+&r"(i), "=&r"(j), "=&r"(k), "=&r"(m) \
+ : "r"(matrix_simd + in_ch), \
+ "g"((intptr_t) - 4 * (in_ch - 1)), \
+ "r"(samp + in_ch), \
+ "i"(sizeof(float *)), "i"(sizeof(float *)/4) \
+ : "memory" \
+ );
+
+static void ac3_downmix_sse(float **samples, float (*matrix)[2],
+ int out_ch, int in_ch, int len)
+{
+ int (*matrix_cmp)[2] = (int(*)[2])matrix;
+ intptr_t i, j, k, m;
+
+ i = -len * sizeof(float);
+ if (in_ch == 5 && out_ch == 2 &&
+ !(matrix_cmp[0][1] | matrix_cmp[2][0] |
+ matrix_cmp[3][1] | matrix_cmp[4][0] |
+ (matrix_cmp[1][0] ^ matrix_cmp[1][1]) |
+ (matrix_cmp[0][0] ^ matrix_cmp[2][1]))) {
+ MIX5(IF0, IF1);
+ } else if (in_ch == 5 && out_ch == 1 &&
+ matrix_cmp[0][0] == matrix_cmp[2][0] &&
+ matrix_cmp[3][0] == matrix_cmp[4][0]) {
+ MIX5(IF1, IF0);
+ } else {
+ DECLARE_ALIGNED(16, float, matrix_simd)[AC3_MAX_CHANNELS][2][4];
+ float *samp[AC3_MAX_CHANNELS];
+
+ for (j = 0; j < in_ch; j++)
+ samp[j] = samples[j] + len;
+
+ j = 2 * in_ch * sizeof(float);
+ __asm__ volatile (
+ "1: \n"
+ "sub $8, %0 \n"
+ "movss (%2, %0), %%xmm4 \n"
+ "movss 4(%2, %0), %%xmm5 \n"
+ "shufps $0, %%xmm4, %%xmm4 \n"
+ "shufps $0, %%xmm5, %%xmm5 \n"
+ "movaps %%xmm4, (%1, %0, 4) \n"
+ "movaps %%xmm5, 16(%1, %0, 4) \n"
+ "jg 1b \n"
+ : "+&r"(j)
+ : "r"(matrix_simd), "r"(matrix)
+ : "memory"
+ );
+ if (out_ch == 2) {
+ MIX_MISC(IF1);
+ } else {
+ MIX_MISC(IF0);
+ }
+ }
+}
+
+#endif /* HAVE_SSE_INLINE && HAVE_7REGS */
+
+av_cold void ff_ac3dsp_init_x86(AC3DSPContext *c, int bit_exact)
+{
+ int mm_flags = av_get_cpu_flags();
+
+ if (EXTERNAL_MMX(mm_flags)) {
+ c->ac3_exponent_min = ff_ac3_exponent_min_mmx;
+ c->ac3_max_msb_abs_int16 = ff_ac3_max_msb_abs_int16_mmx;
+ c->ac3_lshift_int16 = ff_ac3_lshift_int16_mmx;
+ c->ac3_rshift_int32 = ff_ac3_rshift_int32_mmx;
+ }
+ if (EXTERNAL_AMD3DNOW(mm_flags)) {
+ c->extract_exponents = ff_ac3_extract_exponents_3dnow;
+ if (!bit_exact) {
+ c->float_to_fixed24 = ff_float_to_fixed24_3dnow;
+ }
+ }
+ if (EXTERNAL_MMXEXT(mm_flags)) {
+ c->ac3_exponent_min = ff_ac3_exponent_min_mmxext;
+ c->ac3_max_msb_abs_int16 = ff_ac3_max_msb_abs_int16_mmxext;
+ }
+ if (EXTERNAL_SSE(mm_flags)) {
+ c->float_to_fixed24 = ff_float_to_fixed24_sse;
+ }
+ if (EXTERNAL_SSE2(mm_flags)) {
+ c->ac3_exponent_min = ff_ac3_exponent_min_sse2;
+ c->ac3_max_msb_abs_int16 = ff_ac3_max_msb_abs_int16_sse2;
+ c->float_to_fixed24 = ff_float_to_fixed24_sse2;
+ c->compute_mantissa_size = ff_ac3_compute_mantissa_size_sse2;
+ c->extract_exponents = ff_ac3_extract_exponents_sse2;
+ if (!(mm_flags & AV_CPU_FLAG_SSE2SLOW)) {
+ c->ac3_lshift_int16 = ff_ac3_lshift_int16_sse2;
+ c->ac3_rshift_int32 = ff_ac3_rshift_int32_sse2;
+ }
+ }
+ if (EXTERNAL_SSSE3(mm_flags)) {
+ c->ac3_max_msb_abs_int16 = ff_ac3_max_msb_abs_int16_ssse3;
+ if (!(mm_flags & AV_CPU_FLAG_ATOM)) {
+ c->extract_exponents = ff_ac3_extract_exponents_ssse3;
+ }
+ }
+
+#if HAVE_SSE_INLINE && HAVE_7REGS
+ if (INLINE_SSE(mm_flags)) {
+ c->downmix = ac3_downmix_sse;
+ }
+#endif
+}
diff --git a/gst-libs/ext/libav/libavcodec/x86/ac3dsp_mmx.c b/gst-libs/ext/libav/libavcodec/x86/ac3dsp_mmx.c
deleted file mode 100644
index d6bb469..0000000
--- a/gst-libs/ext/libav/libavcodec/x86/ac3dsp_mmx.c
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * x86-optimized AC-3 DSP utils
- * Copyright (c) 2011 Justin Ruggles
- *
- * 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
- */
-
-#include "libavutil/x86_cpu.h"
-#include "dsputil_mmx.h"
-#include "libavcodec/ac3dsp.h"
-
-extern void ff_ac3_exponent_min_mmx (uint8_t *exp, int num_reuse_blocks, int nb_coefs);
-extern void ff_ac3_exponent_min_mmxext(uint8_t *exp, int num_reuse_blocks, int nb_coefs);
-extern void ff_ac3_exponent_min_sse2 (uint8_t *exp, int num_reuse_blocks, int nb_coefs);
-
-extern int ff_ac3_max_msb_abs_int16_mmx (const int16_t *src, int len);
-extern int ff_ac3_max_msb_abs_int16_mmxext(const int16_t *src, int len);
-extern int ff_ac3_max_msb_abs_int16_sse2 (const int16_t *src, int len);
-extern int ff_ac3_max_msb_abs_int16_ssse3 (const int16_t *src, int len);
-
-extern void ff_ac3_lshift_int16_mmx (int16_t *src, unsigned int len, unsigned int shift);
-extern void ff_ac3_lshift_int16_sse2(int16_t *src, unsigned int len, unsigned int shift);
-
-extern void ff_ac3_rshift_int32_mmx (int32_t *src, unsigned int len, unsigned int shift);
-extern void ff_ac3_rshift_int32_sse2(int32_t *src, unsigned int len, unsigned int shift);
-
-extern void ff_float_to_fixed24_3dnow(int32_t *dst, const float *src, unsigned int len);
-extern void ff_float_to_fixed24_sse (int32_t *dst, const float *src, unsigned int len);
-extern void ff_float_to_fixed24_sse2 (int32_t *dst, const float *src, unsigned int len);
-
-extern int ff_ac3_compute_mantissa_size_sse2(uint16_t mant_cnt[6][16]);
-
-extern void ff_ac3_extract_exponents_3dnow(uint8_t *exp, int32_t *coef, int nb_coefs);
-extern void ff_ac3_extract_exponents_sse2 (uint8_t *exp, int32_t *coef, int nb_coefs);
-extern void ff_ac3_extract_exponents_ssse3(uint8_t *exp, int32_t *coef, int nb_coefs);
-
-av_cold void ff_ac3dsp_init_x86(AC3DSPContext *c, int bit_exact)
-{
-#if HAVE_YASM
- int mm_flags = av_get_cpu_flags();
-
- if (mm_flags & AV_CPU_FLAG_MMX) {
- c->ac3_exponent_min = ff_ac3_exponent_min_mmx;
- c->ac3_max_msb_abs_int16 = ff_ac3_max_msb_abs_int16_mmx;
- c->ac3_lshift_int16 = ff_ac3_lshift_int16_mmx;
- c->ac3_rshift_int32 = ff_ac3_rshift_int32_mmx;
- }
- if (mm_flags & AV_CPU_FLAG_3DNOW && HAVE_AMD3DNOW) {
- c->extract_exponents = ff_ac3_extract_exponents_3dnow;
- if (!bit_exact) {
- c->float_to_fixed24 = ff_float_to_fixed24_3dnow;
- }
- }
- if (mm_flags & AV_CPU_FLAG_MMX2 && HAVE_MMX2) {
- c->ac3_exponent_min = ff_ac3_exponent_min_mmxext;
- c->ac3_max_msb_abs_int16 = ff_ac3_max_msb_abs_int16_mmxext;
- }
- if (mm_flags & AV_CPU_FLAG_SSE && HAVE_SSE) {
- c->float_to_fixed24 = ff_float_to_fixed24_sse;
- }
- if (mm_flags & AV_CPU_FLAG_SSE2 && HAVE_SSE) {
- c->ac3_exponent_min = ff_ac3_exponent_min_sse2;
- c->ac3_max_msb_abs_int16 = ff_ac3_max_msb_abs_int16_sse2;
- c->float_to_fixed24 = ff_float_to_fixed24_sse2;
- c->compute_mantissa_size = ff_ac3_compute_mantissa_size_sse2;
- c->extract_exponents = ff_ac3_extract_exponents_sse2;
- if (!(mm_flags & AV_CPU_FLAG_SSE2SLOW)) {
- c->ac3_lshift_int16 = ff_ac3_lshift_int16_sse2;
- c->ac3_rshift_int32 = ff_ac3_rshift_int32_sse2;
- }
- }
- if (mm_flags & AV_CPU_FLAG_SSSE3 && HAVE_SSSE3) {
- c->ac3_max_msb_abs_int16 = ff_ac3_max_msb_abs_int16_ssse3;
- if (!(mm_flags & AV_CPU_FLAG_ATOM)) {
- c->extract_exponents = ff_ac3_extract_exponents_ssse3;
- }
- }
-#endif
-}
diff --git a/gst-libs/ext/libav/libavcodec/x86/cabac.h b/gst-libs/ext/libav/libavcodec/x86/cabac.h
index 3c3652d..a74cf0b 100644
--- a/gst-libs/ext/libav/libavcodec/x86/cabac.h
+++ b/gst-libs/ext/libav/libavcodec/x86/cabac.h
@@ -23,11 +23,79 @@
#include "libavcodec/cabac.h"
#include "libavutil/attributes.h"
-#include "libavutil/x86_cpu.h"
+#include "libavutil/x86/asm.h"
+#include "libavutil/internal.h"
#include "config.h"
+#if HAVE_INLINE_ASM
+
+#ifdef BROKEN_RELOCATIONS
+#define TABLES_ARG , "r"(tables)
+
+#if HAVE_FAST_CMOV
+#define BRANCHLESS_GET_CABAC_UPDATE(ret, retq, low, range, tmp) \
+ "cmp "low" , "tmp" \n\t"\
+ "cmova %%ecx , "range" \n\t"\
+ "sbb %%rcx , %%rcx \n\t"\
+ "and %%ecx , "tmp" \n\t"\
+ "xor %%rcx , "retq" \n\t"\
+ "sub "tmp" , "low" \n\t"
+#else /* HAVE_FAST_CMOV */
+#define BRANCHLESS_GET_CABAC_UPDATE(ret, retq, low, range, tmp) \
+/* P4 Prescott has crappy cmov,sbb,64bit shift so avoid them */ \
+ "sub "low" , "tmp" \n\t"\
+ "sar $31 , "tmp" \n\t"\
+ "sub %%ecx , "range" \n\t"\
+ "and "tmp" , "range" \n\t"\
+ "add %%ecx , "range" \n\t"\
+ "shl $17 , %%ecx \n\t"\
+ "and "tmp" , %%ecx \n\t"\
+ "sub %%ecx , "low" \n\t"\
+ "xor "tmp" , "ret" \n\t"\
+ "movslq "ret" , "retq" \n\t"
+#endif /* HAVE_FAST_CMOV */
+
+#define BRANCHLESS_GET_CABAC(ret, retq, statep, low, lowword, range, rangeq, tmp, tmpbyte, byte, end, norm_off, lps_off, mlps_off, tables) \
+ "movzbl "statep" , "ret" \n\t"\
+ "mov "range" , "tmp" \n\t"\
+ "and $0xC0 , "range" \n\t"\
+ "lea ("ret", "range", 2), %%ecx \n\t"\
+ "movzbl "lps_off"("tables", %%rcx), "range" \n\t"\
+ "sub "range" , "tmp" \n\t"\
+ "mov "tmp" , %%ecx \n\t"\
+ "shl $17 , "tmp" \n\t"\
+ BRANCHLESS_GET_CABAC_UPDATE(ret, retq, low, range, tmp) \
+ "movzbl "norm_off"("tables", "rangeq"), %%ecx \n\t"\
+ "shl %%cl , "range" \n\t"\
+ "movzbl "mlps_off"+128("tables", "retq"), "tmp" \n\t"\
+ "shl %%cl , "low" \n\t"\
+ "mov "tmpbyte" , "statep" \n\t"\
+ "test "lowword" , "lowword" \n\t"\
+ "jnz 2f \n\t"\
+ "mov "byte" , %%"REG_c" \n\t"\
+ "cmp "end" , %%"REG_c" \n\t"\
+ "jge 1f \n\t"\
+ "add"OPSIZE" $2 , "byte" \n\t"\
+ "1: \n\t"\
+ "movzwl (%%"REG_c") , "tmp" \n\t"\
+ "lea -1("low") , %%ecx \n\t"\
+ "xor "low" , %%ecx \n\t"\
+ "shr $15 , %%ecx \n\t"\
+ "bswap "tmp" \n\t"\
+ "shr $15 , "tmp" \n\t"\
+ "movzbl "norm_off"("tables", %%rcx), %%ecx \n\t"\
+ "sub $0xFFFF , "tmp" \n\t"\
+ "neg %%ecx \n\t"\
+ "add $7 , %%ecx \n\t"\
+ "shl %%cl , "tmp" \n\t"\
+ "add "tmp" , "low" \n\t"\
+ "2: \n\t"
+
+#else /* BROKEN_RELOCATIONS */
+#define TABLES_ARG
+
#if HAVE_FAST_CMOV
-#define BRANCHLESS_GET_CABAC_UPDATE(ret, statep, low, lowword, range, tmp)\
+#define BRANCHLESS_GET_CABAC_UPDATE(ret, low, range, tmp)\
"mov "tmp" , %%ecx \n\t"\
"shl $17 , "tmp" \n\t"\
"cmp "low" , "tmp" \n\t"\
@@ -37,7 +105,7 @@
"xor %%ecx , "ret" \n\t"\
"sub "tmp" , "low" \n\t"
#else /* HAVE_FAST_CMOV */
-#define BRANCHLESS_GET_CABAC_UPDATE(ret, statep, low, lowword, range, tmp)\
+#define BRANCHLESS_GET_CABAC_UPDATE(ret, low, range, tmp)\
"mov "tmp" , %%ecx \n\t"\
"shl $17 , "tmp" \n\t"\
"sub "low" , "tmp" \n\t"\
@@ -51,88 +119,115 @@
"xor "tmp" , "ret" \n\t"
#endif /* HAVE_FAST_CMOV */
-#define BRANCHLESS_GET_CABAC(ret, statep, low, lowword, range, tmp, tmpbyte, byte) \
+#define BRANCHLESS_GET_CABAC(ret, retq, statep, low, lowword, range, rangeq, tmp, tmpbyte, byte, end, norm_off, lps_off, mlps_off, tables) \
"movzbl "statep" , "ret" \n\t"\
"mov "range" , "tmp" \n\t"\
"and $0xC0 , "range" \n\t"\
- "movzbl "MANGLE(ff_h264_lps_range)"("ret", "range", 2), "range" \n\t"\
+ "movzbl "MANGLE(ff_h264_cabac_tables)"+"lps_off"("ret", "range", 2), "range" \n\t"\
"sub "range" , "tmp" \n\t"\
- BRANCHLESS_GET_CABAC_UPDATE(ret, statep, low, lowword, range, tmp) \
- "movzbl " MANGLE(ff_h264_norm_shift) "("range"), %%ecx \n\t"\
+ BRANCHLESS_GET_CABAC_UPDATE(ret, low, range, tmp) \
+ "movzbl "MANGLE(ff_h264_cabac_tables)"+"norm_off"("range"), %%ecx \n\t"\
"shl %%cl , "range" \n\t"\
- "movzbl "MANGLE(ff_h264_mlps_state)"+128("ret"), "tmp" \n\t"\
+ "movzbl "MANGLE(ff_h264_cabac_tables)"+"mlps_off"+128("ret"), "tmp" \n\t"\
"shl %%cl , "low" \n\t"\
"mov "tmpbyte" , "statep" \n\t"\
"test "lowword" , "lowword" \n\t"\
- " jnz 1f \n\t"\
+ " jnz 2f \n\t"\
"mov "byte" , %%"REG_c" \n\t"\
+ "cmp "end" , %%"REG_c" \n\t"\
+ "jge 1f \n\t"\
"add"OPSIZE" $2 , "byte" \n\t"\
+ "1: \n\t"\
"movzwl (%%"REG_c") , "tmp" \n\t"\
"lea -1("low") , %%ecx \n\t"\
"xor "low" , %%ecx \n\t"\
"shr $15 , %%ecx \n\t"\
"bswap "tmp" \n\t"\
"shr $15 , "tmp" \n\t"\
- "movzbl " MANGLE(ff_h264_norm_shift) "(%%ecx), %%ecx \n\t"\
+ "movzbl "MANGLE(ff_h264_cabac_tables)"+"norm_off"(%%ecx), %%ecx \n\t"\
"sub $0xFFFF , "tmp" \n\t"\
"neg %%ecx \n\t"\
"add $7 , %%ecx \n\t"\
"shl %%cl , "tmp" \n\t"\
"add "tmp" , "low" \n\t"\
- "1: \n\t"
+ "2: \n\t"
+
+#endif /* BROKEN_RELOCATIONS */
+
-#if HAVE_7REGS && !defined(BROKEN_RELOCATIONS)
+#if HAVE_7REGS
#define get_cabac_inline get_cabac_inline_x86
static av_always_inline int get_cabac_inline_x86(CABACContext *c,
uint8_t *const state)
{
int bit, tmp;
+#ifdef BROKEN_RELOCATIONS
+ void *tables;
__asm__ volatile(
- BRANCHLESS_GET_CABAC("%0", "(%5)", "%1", "%w1", "%2",
- "%3", "%b3", "%4")
- :"=&r"(bit), "+&r"(c->low), "+&r"(c->range), "=&q"(tmp),
- "+m"(c->bytestream)
- :"r"(state)
+ "lea "MANGLE(ff_h264_cabac_tables)", %0 \n\t"
+ : "=&r"(tables)
+ );
+#endif
+
+ __asm__ volatile(
+ BRANCHLESS_GET_CABAC("%0", "%q0", "(%4)", "%1", "%w1",
+ "%2", "%q2", "%3", "%b3",
+ "%c6(%5)", "%c7(%5)",
+ AV_STRINGIFY(H264_NORM_SHIFT_OFFSET),
+ AV_STRINGIFY(H264_LPS_RANGE_OFFSET),
+ AV_STRINGIFY(H264_MLPS_STATE_OFFSET),
+ "%8")
+ : "=&r"(bit), "+&r"(c->low), "+&r"(c->range), "=&q"(tmp)
+ : "r"(state), "r"(c),
+ "i"(offsetof(CABACContext, bytestream)),
+ "i"(offsetof(CABACContext, bytestream_end))
+ TABLES_ARG
: "%"REG_c, "memory"
);
return bit & 1;
}
-#endif /* HAVE_7REGS && !defined(BROKEN_RELOCATIONS) */
+#endif /* HAVE_7REGS */
#define get_cabac_bypass_sign get_cabac_bypass_sign_x86
static av_always_inline int get_cabac_bypass_sign_x86(CABACContext *c, int val)
{
x86_reg tmp;
__asm__ volatile(
- "movl %4, %k1 \n\t"
- "movl %2, %%eax \n\t"
- "shl $17, %k1 \n\t"
- "add %%eax, %%eax \n\t"
- "sub %k1, %%eax \n\t"
- "cltd \n\t"
- "and %%edx, %k1 \n\t"
- "add %k1, %%eax \n\t"
- "xor %%edx, %%ecx \n\t"
- "sub %%edx, %%ecx \n\t"
- "test %%ax, %%ax \n\t"
- " jnz 1f \n\t"
- "mov %3, %1 \n\t"
- "subl $0xFFFF, %%eax \n\t"
- "movzwl (%1), %%edx \n\t"
- "bswap %%edx \n\t"
- "shrl $15, %%edx \n\t"
- "add $2, %1 \n\t"
- "addl %%edx, %%eax \n\t"
- "mov %1, %3 \n\t"
- "1: \n\t"
- "movl %%eax, %2 \n\t"
-
- :"+c"(val), "=&r"(tmp), "+m"(c->low), "+m"(c->bytestream)
- :"m"(c->range)
- : "%eax", "%edx"
+ "movl %c6(%2), %k1 \n\t"
+ "movl %c3(%2), %%eax \n\t"
+ "shl $17, %k1 \n\t"
+ "add %%eax, %%eax \n\t"
+ "sub %k1, %%eax \n\t"
+ "cltd \n\t"
+ "and %%edx, %k1 \n\t"
+ "add %k1, %%eax \n\t"
+ "xor %%edx, %%ecx \n\t"
+ "sub %%edx, %%ecx \n\t"
+ "test %%ax, %%ax \n\t"
+ "jnz 1f \n\t"
+ "mov %c4(%2), %1 \n\t"
+ "subl $0xFFFF, %%eax \n\t"
+ "movzwl (%1), %%edx \n\t"
+ "bswap %%edx \n\t"
+ "shrl $15, %%edx \n\t"
+ "addl %%edx, %%eax \n\t"
+ "cmp %c5(%2), %1 \n\t"
+ "jge 1f \n\t"
+ "add"OPSIZE" $2, %c4(%2) \n\t"
+ "1: \n\t"
+ "movl %%eax, %c3(%2) \n\t"
+
+ : "+c"(val), "=&r"(tmp)
+ : "r"(c),
+ "i"(offsetof(CABACContext, low)),
+ "i"(offsetof(CABACContext, bytestream)),
+ "i"(offsetof(CABACContext, bytestream_end)),
+ "i"(offsetof(CABACContext, range))
+ : "%eax", "%edx", "memory"
);
return val;
}
+#endif /* HAVE_INLINE_ASM */
#endif /* AVCODEC_X86_CABAC_H */
diff --git a/gst-libs/ext/libav/libavcodec/x86/cavsdsp.c b/gst-libs/ext/libav/libavcodec/x86/cavsdsp.c
new file mode 100644
index 0000000..f94e2f3
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/x86/cavsdsp.c
@@ -0,0 +1,505 @@
+/*
+ * Chinese AVS video (AVS1-P2, JiZhun profile) decoder.
+ * Copyright (c) 2006 Stefan Gehrer <stefan.gehrer@gmx.de>
+ *
+ * MMX-optimized DSP functions, based on H.264 optimizations by
+ * Michael Niedermayer and Loren Merritt
+ *
+ * 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
+ */
+
+#include "libavutil/common.h"
+#include "libavutil/cpu.h"
+#include "libavutil/x86/asm.h"
+#include "libavutil/x86/cpu.h"
+#include "libavcodec/dsputil.h"
+#include "libavcodec/cavsdsp.h"
+#include "dsputil_mmx.h"
+#include "config.h"
+
+#if (HAVE_MMXEXT_INLINE || HAVE_AMD3DNOW_INLINE)
+
+/* in/out: mma=mma+mmb, mmb=mmb-mma */
+#define SUMSUB_BA( a, b ) \
+ "paddw "#b", "#a" \n\t"\
+ "paddw "#b", "#b" \n\t"\
+ "psubw "#a", "#b" \n\t"
+
+/*****************************************************************************
+ *
+ * inverse transform
+ *
+ ****************************************************************************/
+
+static inline void cavs_idct8_1d(int16_t *block, uint64_t bias)
+{
+ __asm__ volatile(
+ "movq 112(%0), %%mm4 \n\t" /* mm4 = src7 */
+ "movq 16(%0), %%mm5 \n\t" /* mm5 = src1 */
+ "movq 80(%0), %%mm2 \n\t" /* mm2 = src5 */
+ "movq 48(%0), %%mm7 \n\t" /* mm7 = src3 */
+ "movq %%mm4, %%mm0 \n\t"
+ "movq %%mm5, %%mm3 \n\t"
+ "movq %%mm2, %%mm6 \n\t"
+ "movq %%mm7, %%mm1 \n\t"
+
+ "paddw %%mm4, %%mm4 \n\t" /* mm4 = 2*src7 */
+ "paddw %%mm3, %%mm3 \n\t" /* mm3 = 2*src1 */
+ "paddw %%mm6, %%mm6 \n\t" /* mm6 = 2*src5 */
+ "paddw %%mm1, %%mm1 \n\t" /* mm1 = 2*src3 */
+ "paddw %%mm4, %%mm0 \n\t" /* mm0 = 3*src7 */
+ "paddw %%mm3, %%mm5 \n\t" /* mm5 = 3*src1 */
+ "paddw %%mm6, %%mm2 \n\t" /* mm2 = 3*src5 */
+ "paddw %%mm1, %%mm7 \n\t" /* mm7 = 3*src3 */
+ "psubw %%mm4, %%mm5 \n\t" /* mm5 = 3*src1 - 2*src7 = a0 */
+ "paddw %%mm6, %%mm7 \n\t" /* mm7 = 3*src3 + 2*src5 = a1 */
+ "psubw %%mm2, %%mm1 \n\t" /* mm1 = 2*src3 - 3*src5 = a2 */
+ "paddw %%mm0, %%mm3 \n\t" /* mm3 = 2*src1 + 3*src7 = a3 */
+
+ "movq %%mm5, %%mm4 \n\t"
+ "movq %%mm7, %%mm6 \n\t"
+ "movq %%mm3, %%mm0 \n\t"
+ "movq %%mm1, %%mm2 \n\t"
+ SUMSUB_BA( %%mm7, %%mm5 ) /* mm7 = a0 + a1 mm5 = a0 - a1 */
+ "paddw %%mm3, %%mm7 \n\t" /* mm7 = a0 + a1 + a3 */
+ "paddw %%mm1, %%mm5 \n\t" /* mm5 = a0 - a1 + a2 */
+ "paddw %%mm7, %%mm7 \n\t"
+ "paddw %%mm5, %%mm5 \n\t"
+ "paddw %%mm6, %%mm7 \n\t" /* mm7 = b4 */
+ "paddw %%mm4, %%mm5 \n\t" /* mm5 = b5 */
+
+ SUMSUB_BA( %%mm1, %%mm3 ) /* mm1 = a3 + a2 mm3 = a3 - a2 */
+ "psubw %%mm1, %%mm4 \n\t" /* mm4 = a0 - a2 - a3 */
+ "movq %%mm4, %%mm1 \n\t" /* mm1 = a0 - a2 - a3 */
+ "psubw %%mm6, %%mm3 \n\t" /* mm3 = a3 - a2 - a1 */
+ "paddw %%mm1, %%mm1 \n\t"
+ "paddw %%mm3, %%mm3 \n\t"
+ "psubw %%mm2, %%mm1 \n\t" /* mm1 = b7 */
+ "paddw %%mm0, %%mm3 \n\t" /* mm3 = b6 */
+
+ "movq 32(%0), %%mm2 \n\t" /* mm2 = src2 */
+ "movq 96(%0), %%mm6 \n\t" /* mm6 = src6 */
+ "movq %%mm2, %%mm4 \n\t"
+ "movq %%mm6, %%mm0 \n\t"
+ "psllw $2, %%mm4 \n\t" /* mm4 = 4*src2 */
+ "psllw $2, %%mm6 \n\t" /* mm6 = 4*src6 */
+ "paddw %%mm4, %%mm2 \n\t" /* mm2 = 5*src2 */
+ "paddw %%mm6, %%mm0 \n\t" /* mm0 = 5*src6 */
+ "paddw %%mm2, %%mm2 \n\t"
+ "paddw %%mm0, %%mm0 \n\t"
+ "psubw %%mm0, %%mm4 \n\t" /* mm4 = 4*src2 - 10*src6 = a7 */
+ "paddw %%mm2, %%mm6 \n\t" /* mm6 = 4*src6 + 10*src2 = a6 */
+
+ "movq (%0), %%mm2 \n\t" /* mm2 = src0 */
+ "movq 64(%0), %%mm0 \n\t" /* mm0 = src4 */
+ SUMSUB_BA( %%mm0, %%mm2 ) /* mm0 = src0+src4 mm2 = src0-src4 */
+ "psllw $3, %%mm0 \n\t"
+ "psllw $3, %%mm2 \n\t"
+ "paddw %1, %%mm0 \n\t" /* add rounding bias */
+ "paddw %1, %%mm2 \n\t" /* add rounding bias */
+
+ SUMSUB_BA( %%mm6, %%mm0 ) /* mm6 = a4 + a6 mm0 = a4 - a6 */
+ SUMSUB_BA( %%mm4, %%mm2 ) /* mm4 = a5 + a7 mm2 = a5 - a7 */
+ SUMSUB_BA( %%mm7, %%mm6 ) /* mm7 = dst0 mm6 = dst7 */
+ SUMSUB_BA( %%mm5, %%mm4 ) /* mm5 = dst1 mm4 = dst6 */
+ SUMSUB_BA( %%mm3, %%mm2 ) /* mm3 = dst2 mm2 = dst5 */
+ SUMSUB_BA( %%mm1, %%mm0 ) /* mm1 = dst3 mm0 = dst4 */
+ :: "r"(block), "m"(bias)
+ );
+}
+
+static void cavs_idct8_add_mmx(uint8_t *dst, int16_t *block, int stride)
+{
+ int i;
+ DECLARE_ALIGNED(8, int16_t, b2)[64];
+
+ for(i=0; i<2; i++){
+ DECLARE_ALIGNED(8, uint64_t, tmp);
+
+ cavs_idct8_1d(block+4*i, ff_pw_4.a);
+
+ __asm__ volatile(
+ "psraw $3, %%mm7 \n\t"
+ "psraw $3, %%mm6 \n\t"
+ "psraw $3, %%mm5 \n\t"
+ "psraw $3, %%mm4 \n\t"
+ "psraw $3, %%mm3 \n\t"
+ "psraw $3, %%mm2 \n\t"
+ "psraw $3, %%mm1 \n\t"
+ "psraw $3, %%mm0 \n\t"
+ "movq %%mm7, %0 \n\t"
+ TRANSPOSE4( %%mm0, %%mm2, %%mm4, %%mm6, %%mm7 )
+ "movq %%mm0, 8(%1) \n\t"
+ "movq %%mm6, 24(%1) \n\t"
+ "movq %%mm7, 40(%1) \n\t"
+ "movq %%mm4, 56(%1) \n\t"
+ "movq %0, %%mm7 \n\t"
+ TRANSPOSE4( %%mm7, %%mm5, %%mm3, %%mm1, %%mm0 )
+ "movq %%mm7, (%1) \n\t"
+ "movq %%mm1, 16(%1) \n\t"
+ "movq %%mm0, 32(%1) \n\t"
+ "movq %%mm3, 48(%1) \n\t"
+ : "=m"(tmp)
+ : "r"(b2+32*i)
+ : "memory"
+ );
+ }
+
+ for(i=0; i<2; i++){
+ cavs_idct8_1d(b2+4*i, ff_pw_64.a);
+
+ __asm__ volatile(
+ "psraw $7, %%mm7 \n\t"
+ "psraw $7, %%mm6 \n\t"
+ "psraw $7, %%mm5 \n\t"
+ "psraw $7, %%mm4 \n\t"
+ "psraw $7, %%mm3 \n\t"
+ "psraw $7, %%mm2 \n\t"
+ "psraw $7, %%mm1 \n\t"
+ "psraw $7, %%mm0 \n\t"
+ "movq %%mm7, (%0) \n\t"
+ "movq %%mm5, 16(%0) \n\t"
+ "movq %%mm3, 32(%0) \n\t"
+ "movq %%mm1, 48(%0) \n\t"
+ "movq %%mm0, 64(%0) \n\t"
+ "movq %%mm2, 80(%0) \n\t"
+ "movq %%mm4, 96(%0) \n\t"
+ "movq %%mm6, 112(%0) \n\t"
+ :: "r"(b2+4*i)
+ : "memory"
+ );
+ }
+
+ ff_add_pixels_clamped_mmx(b2, dst, stride);
+}
+
+/*****************************************************************************
+ *
+ * motion compensation
+ *
+ ****************************************************************************/
+
+/* vertical filter [-1 -2 96 42 -7 0] */
+#define QPEL_CAVSV1(A,B,C,D,E,F,OP,MUL2) \
+ "movd (%0), "#F" \n\t"\
+ "movq "#C", %%mm6 \n\t"\
+ "pmullw %5, %%mm6 \n\t"\
+ "movq "#D", %%mm7 \n\t"\
+ "pmullw "MANGLE(MUL2)", %%mm7\n\t"\
+ "psllw $3, "#E" \n\t"\
+ "psubw "#E", %%mm6 \n\t"\
+ "psraw $3, "#E" \n\t"\
+ "paddw %%mm7, %%mm6 \n\t"\
+ "paddw "#E", %%mm6 \n\t"\
+ "paddw "#B", "#B" \n\t"\
+ "pxor %%mm7, %%mm7 \n\t"\
+ "add %2, %0 \n\t"\
+ "punpcklbw %%mm7, "#F" \n\t"\
+ "psubw "#B", %%mm6 \n\t"\
+ "psraw $1, "#B" \n\t"\
+ "psubw "#A", %%mm6 \n\t"\
+ "paddw %4, %%mm6 \n\t"\
+ "psraw $7, %%mm6 \n\t"\
+ "packuswb %%mm6, %%mm6 \n\t"\
+ OP(%%mm6, (%1), A, d) \
+ "add %3, %1 \n\t"
+
+/* vertical filter [ 0 -1 5 5 -1 0] */
+#define QPEL_CAVSV2(A,B,C,D,E,F,OP,MUL2) \
+ "movd (%0), "#F" \n\t"\
+ "movq "#C", %%mm6 \n\t"\
+ "paddw "#D", %%mm6 \n\t"\
+ "pmullw %5, %%mm6 \n\t"\
+ "add %2, %0 \n\t"\
+ "punpcklbw %%mm7, "#F" \n\t"\
+ "psubw "#B", %%mm6 \n\t"\
+ "psubw "#E", %%mm6 \n\t"\
+ "paddw %4, %%mm6 \n\t"\
+ "psraw $3, %%mm6 \n\t"\
+ "packuswb %%mm6, %%mm6 \n\t"\
+ OP(%%mm6, (%1), A, d) \
+ "add %3, %1 \n\t"
+
+/* vertical filter [ 0 -7 42 96 -2 -1] */
+#define QPEL_CAVSV3(A,B,C,D,E,F,OP,MUL2) \
+ "movd (%0), "#F" \n\t"\
+ "movq "#C", %%mm6 \n\t"\
+ "pmullw "MANGLE(MUL2)", %%mm6\n\t"\
+ "movq "#D", %%mm7 \n\t"\
+ "pmullw %5, %%mm7 \n\t"\
+ "psllw $3, "#B" \n\t"\
+ "psubw "#B", %%mm6 \n\t"\
+ "psraw $3, "#B" \n\t"\
+ "paddw %%mm7, %%mm6 \n\t"\
+ "paddw "#B", %%mm6 \n\t"\
+ "paddw "#E", "#E" \n\t"\
+ "pxor %%mm7, %%mm7 \n\t"\
+ "add %2, %0 \n\t"\
+ "punpcklbw %%mm7, "#F" \n\t"\
+ "psubw "#E", %%mm6 \n\t"\
+ "psraw $1, "#E" \n\t"\
+ "psubw "#F", %%mm6 \n\t"\
+ "paddw %4, %%mm6 \n\t"\
+ "psraw $7, %%mm6 \n\t"\
+ "packuswb %%mm6, %%mm6 \n\t"\
+ OP(%%mm6, (%1), A, d) \
+ "add %3, %1 \n\t"
+
+
+#define QPEL_CAVSVNUM(VOP,OP,ADD,MUL1,MUL2)\
+ int w= 2;\
+ src -= 2*srcStride;\
+ \
+ while(w--){\
+ __asm__ volatile(\
+ "pxor %%mm7, %%mm7 \n\t"\
+ "movd (%0), %%mm0 \n\t"\
+ "add %2, %0 \n\t"\
+ "movd (%0), %%mm1 \n\t"\
+ "add %2, %0 \n\t"\
+ "movd (%0), %%mm2 \n\t"\
+ "add %2, %0 \n\t"\
+ "movd (%0), %%mm3 \n\t"\
+ "add %2, %0 \n\t"\
+ "movd (%0), %%mm4 \n\t"\
+ "add %2, %0 \n\t"\
+ "punpcklbw %%mm7, %%mm0 \n\t"\
+ "punpcklbw %%mm7, %%mm1 \n\t"\
+ "punpcklbw %%mm7, %%mm2 \n\t"\
+ "punpcklbw %%mm7, %%mm3 \n\t"\
+ "punpcklbw %%mm7, %%mm4 \n\t"\
+ VOP(%%mm0, %%mm1, %%mm2, %%mm3, %%mm4, %%mm5, OP, MUL2)\
+ VOP(%%mm1, %%mm2, %%mm3, %%mm4, %%mm5, %%mm0, OP, MUL2)\
+ VOP(%%mm2, %%mm3, %%mm4, %%mm5, %%mm0, %%mm1, OP, MUL2)\
+ VOP(%%mm3, %%mm4, %%mm5, %%mm0, %%mm1, %%mm2, OP, MUL2)\
+ VOP(%%mm4, %%mm5, %%mm0, %%mm1, %%mm2, %%mm3, OP, MUL2)\
+ VOP(%%mm5, %%mm0, %%mm1, %%mm2, %%mm3, %%mm4, OP, MUL2)\
+ VOP(%%mm0, %%mm1, %%mm2, %%mm3, %%mm4, %%mm5, OP, MUL2)\
+ VOP(%%mm1, %%mm2, %%mm3, %%mm4, %%mm5, %%mm0, OP, MUL2)\
+ \
+ : "+a"(src), "+c"(dst)\
+ : "S"((x86_reg)srcStride), "r"((x86_reg)dstStride), "m"(ADD), "m"(MUL1)\
+ : "memory"\
+ );\
+ if(h==16){\
+ __asm__ volatile(\
+ VOP(%%mm2, %%mm3, %%mm4, %%mm5, %%mm0, %%mm1, OP, MUL2)\
+ VOP(%%mm3, %%mm4, %%mm5, %%mm0, %%mm1, %%mm2, OP, MUL2)\
+ VOP(%%mm4, %%mm5, %%mm0, %%mm1, %%mm2, %%mm3, OP, MUL2)\
+ VOP(%%mm5, %%mm0, %%mm1, %%mm2, %%mm3, %%mm4, OP, MUL2)\
+ VOP(%%mm0, %%mm1, %%mm2, %%mm3, %%mm4, %%mm5, OP, MUL2)\
+ VOP(%%mm1, %%mm2, %%mm3, %%mm4, %%mm5, %%mm0, OP, MUL2)\
+ VOP(%%mm2, %%mm3, %%mm4, %%mm5, %%mm0, %%mm1, OP, MUL2)\
+ VOP(%%mm3, %%mm4, %%mm5, %%mm0, %%mm1, %%mm2, OP, MUL2)\
+ \
+ : "+a"(src), "+c"(dst)\
+ : "S"((x86_reg)srcStride), "r"((x86_reg)dstStride), "m"(ADD), "m"(MUL1)\
+ : "memory"\
+ );\
+ }\
+ src += 4-(h+5)*srcStride;\
+ dst += 4-h*dstStride;\
+ }
+
+#define QPEL_CAVS(OPNAME, OP, MMX)\
+static void OPNAME ## cavs_qpel8_h_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
+ int h=8;\
+ __asm__ volatile(\
+ "pxor %%mm7, %%mm7 \n\t"\
+ "movq %5, %%mm6 \n\t"\
+ "1: \n\t"\
+ "movq (%0), %%mm0 \n\t"\
+ "movq 1(%0), %%mm2 \n\t"\
+ "movq %%mm0, %%mm1 \n\t"\
+ "movq %%mm2, %%mm3 \n\t"\
+ "punpcklbw %%mm7, %%mm0 \n\t"\
+ "punpckhbw %%mm7, %%mm1 \n\t"\
+ "punpcklbw %%mm7, %%mm2 \n\t"\
+ "punpckhbw %%mm7, %%mm3 \n\t"\
+ "paddw %%mm2, %%mm0 \n\t"\
+ "paddw %%mm3, %%mm1 \n\t"\
+ "pmullw %%mm6, %%mm0 \n\t"\
+ "pmullw %%mm6, %%mm1 \n\t"\
+ "movq -1(%0), %%mm2 \n\t"\
+ "movq 2(%0), %%mm4 \n\t"\
+ "movq %%mm2, %%mm3 \n\t"\
+ "movq %%mm4, %%mm5 \n\t"\
+ "punpcklbw %%mm7, %%mm2 \n\t"\
+ "punpckhbw %%mm7, %%mm3 \n\t"\
+ "punpcklbw %%mm7, %%mm4 \n\t"\
+ "punpckhbw %%mm7, %%mm5 \n\t"\
+ "paddw %%mm4, %%mm2 \n\t"\
+ "paddw %%mm3, %%mm5 \n\t"\
+ "psubw %%mm2, %%mm0 \n\t"\
+ "psubw %%mm5, %%mm1 \n\t"\
+ "movq %6, %%mm5 \n\t"\
+ "paddw %%mm5, %%mm0 \n\t"\
+ "paddw %%mm5, %%mm1 \n\t"\
+ "psraw $3, %%mm0 \n\t"\
+ "psraw $3, %%mm1 \n\t"\
+ "packuswb %%mm1, %%mm0 \n\t"\
+ OP(%%mm0, (%1),%%mm5, q) \
+ "add %3, %0 \n\t"\
+ "add %4, %1 \n\t"\
+ "decl %2 \n\t"\
+ " jnz 1b \n\t"\
+ : "+a"(src), "+c"(dst), "+m"(h)\
+ : "d"((x86_reg)srcStride), "S"((x86_reg)dstStride), "m"(ff_pw_5), "m"(ff_pw_4)\
+ : "memory"\
+ );\
+}\
+\
+static inline void OPNAME ## cavs_qpel8or16_v1_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int h){\
+ QPEL_CAVSVNUM(QPEL_CAVSV1,OP,ff_pw_64,ff_pw_96,ff_pw_42) \
+}\
+\
+static inline void OPNAME ## cavs_qpel8or16_v2_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int h){\
+ QPEL_CAVSVNUM(QPEL_CAVSV2,OP,ff_pw_4,ff_pw_5,ff_pw_5) \
+}\
+\
+static inline void OPNAME ## cavs_qpel8or16_v3_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int h){\
+ QPEL_CAVSVNUM(QPEL_CAVSV3,OP,ff_pw_64,ff_pw_96,ff_pw_42) \
+}\
+\
+static void OPNAME ## cavs_qpel8_v1_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
+ OPNAME ## cavs_qpel8or16_v1_ ## MMX(dst , src , dstStride, srcStride, 8);\
+}\
+static void OPNAME ## cavs_qpel16_v1_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
+ OPNAME ## cavs_qpel8or16_v1_ ## MMX(dst , src , dstStride, srcStride, 16);\
+ OPNAME ## cavs_qpel8or16_v1_ ## MMX(dst+8, src+8, dstStride, srcStride, 16);\
+}\
+\
+static void OPNAME ## cavs_qpel8_v2_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
+ OPNAME ## cavs_qpel8or16_v2_ ## MMX(dst , src , dstStride, srcStride, 8);\
+}\
+static void OPNAME ## cavs_qpel16_v2_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
+ OPNAME ## cavs_qpel8or16_v2_ ## MMX(dst , src , dstStride, srcStride, 16);\
+ OPNAME ## cavs_qpel8or16_v2_ ## MMX(dst+8, src+8, dstStride, srcStride, 16);\
+}\
+\
+static void OPNAME ## cavs_qpel8_v3_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
+ OPNAME ## cavs_qpel8or16_v3_ ## MMX(dst , src , dstStride, srcStride, 8);\
+}\
+static void OPNAME ## cavs_qpel16_v3_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
+ OPNAME ## cavs_qpel8or16_v3_ ## MMX(dst , src , dstStride, srcStride, 16);\
+ OPNAME ## cavs_qpel8or16_v3_ ## MMX(dst+8, src+8, dstStride, srcStride, 16);\
+}\
+\
+static void OPNAME ## cavs_qpel16_h_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
+ OPNAME ## cavs_qpel8_h_ ## MMX(dst , src , dstStride, srcStride);\
+ OPNAME ## cavs_qpel8_h_ ## MMX(dst+8, src+8, dstStride, srcStride);\
+ src += 8*srcStride;\
+ dst += 8*dstStride;\
+ OPNAME ## cavs_qpel8_h_ ## MMX(dst , src , dstStride, srcStride);\
+ OPNAME ## cavs_qpel8_h_ ## MMX(dst+8, src+8, dstStride, srcStride);\
+}\
+
+#define CAVS_MC(OPNAME, SIZE, MMX) \
+static void ff_ ## OPNAME ## cavs_qpel ## SIZE ## _mc20_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
+ OPNAME ## cavs_qpel ## SIZE ## _h_ ## MMX(dst, src, stride, stride);\
+}\
+\
+static void ff_ ## OPNAME ## cavs_qpel ## SIZE ## _mc01_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
+ OPNAME ## cavs_qpel ## SIZE ## _v1_ ## MMX(dst, src, stride, stride);\
+}\
+\
+static void ff_ ## OPNAME ## cavs_qpel ## SIZE ## _mc02_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
+ OPNAME ## cavs_qpel ## SIZE ## _v2_ ## MMX(dst, src, stride, stride);\
+}\
+\
+static void ff_ ## OPNAME ## cavs_qpel ## SIZE ## _mc03_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
+ OPNAME ## cavs_qpel ## SIZE ## _v3_ ## MMX(dst, src, stride, stride);\
+}\
+
+#define PUT_OP(a,b,temp, size) "mov" #size " " #a ", " #b " \n\t"
+#define AVG_3DNOW_OP(a,b,temp, size) \
+"mov" #size " " #b ", " #temp " \n\t"\
+"pavgusb " #temp ", " #a " \n\t"\
+"mov" #size " " #a ", " #b " \n\t"
+#define AVG_MMXEXT_OP(a, b, temp, size) \
+"mov" #size " " #b ", " #temp " \n\t"\
+"pavgb " #temp ", " #a " \n\t"\
+"mov" #size " " #a ", " #b " \n\t"
+
+#endif /* (HAVE_MMXEXT_INLINE || HAVE_AMD3DNOW_INLINE) */
+
+#if HAVE_MMXEXT_INLINE
+QPEL_CAVS(put_, PUT_OP, mmxext)
+QPEL_CAVS(avg_, AVG_MMXEXT_OP, mmxext)
+
+CAVS_MC(put_, 8, mmxext)
+CAVS_MC(put_, 16, mmxext)
+CAVS_MC(avg_, 8, mmxext)
+CAVS_MC(avg_, 16, mmxext)
+
+static void ff_cavsdsp_init_mmxext(CAVSDSPContext *c, AVCodecContext *avctx)
+{
+#define dspfunc(PFX, IDX, NUM) \
+ c->PFX ## _pixels_tab[IDX][ 0] = ff_ ## PFX ## NUM ## _mc00_mmxext; \
+ c->PFX ## _pixels_tab[IDX][ 2] = ff_ ## PFX ## NUM ## _mc20_mmxext; \
+ c->PFX ## _pixels_tab[IDX][ 4] = ff_ ## PFX ## NUM ## _mc01_mmxext; \
+ c->PFX ## _pixels_tab[IDX][ 8] = ff_ ## PFX ## NUM ## _mc02_mmxext; \
+ c->PFX ## _pixels_tab[IDX][12] = ff_ ## PFX ## NUM ## _mc03_mmxext; \
+
+ dspfunc(put_cavs_qpel, 0, 16);
+ dspfunc(put_cavs_qpel, 1, 8);
+ dspfunc(avg_cavs_qpel, 0, 16);
+ dspfunc(avg_cavs_qpel, 1, 8);
+#undef dspfunc
+ c->cavs_idct8_add = cavs_idct8_add_mmx;
+ c->idct_perm = FF_TRANSPOSE_IDCT_PERM;
+}
+#endif /* HAVE_MMXEXT_INLINE */
+
+#if HAVE_AMD3DNOW_INLINE
+QPEL_CAVS(put_, PUT_OP, 3dnow)
+QPEL_CAVS(avg_, AVG_3DNOW_OP, 3dnow)
+
+CAVS_MC(put_, 8, 3dnow)
+CAVS_MC(put_, 16,3dnow)
+CAVS_MC(avg_, 8, 3dnow)
+CAVS_MC(avg_, 16,3dnow)
+
+static void ff_cavsdsp_init_3dnow(CAVSDSPContext* c, AVCodecContext *avctx) {
+#define dspfunc(PFX, IDX, NUM) \
+ c->PFX ## _pixels_tab[IDX][ 0] = ff_ ## PFX ## NUM ## _mc00_mmxext; \
+ c->PFX ## _pixels_tab[IDX][ 2] = ff_ ## PFX ## NUM ## _mc20_3dnow; \
+ c->PFX ## _pixels_tab[IDX][ 4] = ff_ ## PFX ## NUM ## _mc01_3dnow; \
+ c->PFX ## _pixels_tab[IDX][ 8] = ff_ ## PFX ## NUM ## _mc02_3dnow; \
+ c->PFX ## _pixels_tab[IDX][12] = ff_ ## PFX ## NUM ## _mc03_3dnow; \
+
+ dspfunc(put_cavs_qpel, 0, 16);
+ dspfunc(put_cavs_qpel, 1, 8);
+ dspfunc(avg_cavs_qpel, 0, 16);
+ dspfunc(avg_cavs_qpel, 1, 8);
+#undef dspfunc
+ c->cavs_idct8_add = cavs_idct8_add_mmx;
+ c->idct_perm = FF_TRANSPOSE_IDCT_PERM;
+}
+#endif /* HAVE_AMD3DNOW_INLINE */
+
+av_cold void ff_cavsdsp_init_x86(CAVSDSPContext *c, AVCodecContext *avctx)
+{
+ int mm_flags = av_get_cpu_flags();
+
+#if HAVE_MMXEXT_INLINE
+ if (mm_flags & AV_CPU_FLAG_MMXEXT) ff_cavsdsp_init_mmxext(c, avctx);
+#endif /* HAVE_MMXEXT_INLINE */
+#if HAVE_AMD3DNOW_INLINE
+ if (mm_flags & AV_CPU_FLAG_3DNOW) ff_cavsdsp_init_3dnow(c, avctx);
+#endif /* HAVE_AMD3DNOW_INLINE */
+}
diff --git a/gst-libs/ext/libav/libavcodec/x86/cavsdsp_mmx.c b/gst-libs/ext/libav/libavcodec/x86/cavsdsp_mmx.c
deleted file mode 100644
index 3bc62ea..0000000
--- a/gst-libs/ext/libav/libavcodec/x86/cavsdsp_mmx.c
+++ /dev/null
@@ -1,480 +0,0 @@
-/*
- * Chinese AVS video (AVS1-P2, JiZhun profile) decoder.
- * Copyright (c) 2006 Stefan Gehrer <stefan.gehrer@gmx.de>
- *
- * MMX-optimized DSP functions, based on H.264 optimizations by
- * Michael Niedermayer and Loren Merritt
- *
- * 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
- */
-
-#include "libavutil/common.h"
-#include "libavutil/cpu.h"
-#include "libavutil/x86_cpu.h"
-#include "libavcodec/dsputil.h"
-#include "libavcodec/cavsdsp.h"
-#include "dsputil_mmx.h"
-
-/*****************************************************************************
- *
- * inverse transform
- *
- ****************************************************************************/
-
-static inline void cavs_idct8_1d(int16_t *block, uint64_t bias)
-{
- __asm__ volatile(
- "movq 112(%0), %%mm4 \n\t" /* mm4 = src7 */
- "movq 16(%0), %%mm5 \n\t" /* mm5 = src1 */
- "movq 80(%0), %%mm2 \n\t" /* mm2 = src5 */
- "movq 48(%0), %%mm7 \n\t" /* mm7 = src3 */
- "movq %%mm4, %%mm0 \n\t"
- "movq %%mm5, %%mm3 \n\t"
- "movq %%mm2, %%mm6 \n\t"
- "movq %%mm7, %%mm1 \n\t"
-
- "paddw %%mm4, %%mm4 \n\t" /* mm4 = 2*src7 */
- "paddw %%mm3, %%mm3 \n\t" /* mm3 = 2*src1 */
- "paddw %%mm6, %%mm6 \n\t" /* mm6 = 2*src5 */
- "paddw %%mm1, %%mm1 \n\t" /* mm1 = 2*src3 */
- "paddw %%mm4, %%mm0 \n\t" /* mm0 = 3*src7 */
- "paddw %%mm3, %%mm5 \n\t" /* mm5 = 3*src1 */
- "paddw %%mm6, %%mm2 \n\t" /* mm2 = 3*src5 */
- "paddw %%mm1, %%mm7 \n\t" /* mm7 = 3*src3 */
- "psubw %%mm4, %%mm5 \n\t" /* mm5 = 3*src1 - 2*src7 = a0 */
- "paddw %%mm6, %%mm7 \n\t" /* mm7 = 3*src3 + 2*src5 = a1 */
- "psubw %%mm2, %%mm1 \n\t" /* mm1 = 2*src3 - 3*src5 = a2 */
- "paddw %%mm0, %%mm3 \n\t" /* mm3 = 2*src1 + 3*src7 = a3 */
-
- "movq %%mm5, %%mm4 \n\t"
- "movq %%mm7, %%mm6 \n\t"
- "movq %%mm3, %%mm0 \n\t"
- "movq %%mm1, %%mm2 \n\t"
- SUMSUB_BA( %%mm7, %%mm5 ) /* mm7 = a0 + a1 mm5 = a0 - a1 */
- "paddw %%mm3, %%mm7 \n\t" /* mm7 = a0 + a1 + a3 */
- "paddw %%mm1, %%mm5 \n\t" /* mm5 = a0 - a1 + a2 */
- "paddw %%mm7, %%mm7 \n\t"
- "paddw %%mm5, %%mm5 \n\t"
- "paddw %%mm6, %%mm7 \n\t" /* mm7 = b4 */
- "paddw %%mm4, %%mm5 \n\t" /* mm5 = b5 */
-
- SUMSUB_BA( %%mm1, %%mm3 ) /* mm1 = a3 + a2 mm3 = a3 - a2 */
- "psubw %%mm1, %%mm4 \n\t" /* mm4 = a0 - a2 - a3 */
- "movq %%mm4, %%mm1 \n\t" /* mm1 = a0 - a2 - a3 */
- "psubw %%mm6, %%mm3 \n\t" /* mm3 = a3 - a2 - a1 */
- "paddw %%mm1, %%mm1 \n\t"
- "paddw %%mm3, %%mm3 \n\t"
- "psubw %%mm2, %%mm1 \n\t" /* mm1 = b7 */
- "paddw %%mm0, %%mm3 \n\t" /* mm3 = b6 */
-
- "movq 32(%0), %%mm2 \n\t" /* mm2 = src2 */
- "movq 96(%0), %%mm6 \n\t" /* mm6 = src6 */
- "movq %%mm2, %%mm4 \n\t"
- "movq %%mm6, %%mm0 \n\t"
- "psllw $2, %%mm4 \n\t" /* mm4 = 4*src2 */
- "psllw $2, %%mm6 \n\t" /* mm6 = 4*src6 */
- "paddw %%mm4, %%mm2 \n\t" /* mm2 = 5*src2 */
- "paddw %%mm6, %%mm0 \n\t" /* mm0 = 5*src6 */
- "paddw %%mm2, %%mm2 \n\t"
- "paddw %%mm0, %%mm0 \n\t"
- "psubw %%mm0, %%mm4 \n\t" /* mm4 = 4*src2 - 10*src6 = a7 */
- "paddw %%mm2, %%mm6 \n\t" /* mm6 = 4*src6 + 10*src2 = a6 */
-
- "movq (%0), %%mm2 \n\t" /* mm2 = src0 */
- "movq 64(%0), %%mm0 \n\t" /* mm0 = src4 */
- SUMSUB_BA( %%mm0, %%mm2 ) /* mm0 = src0+src4 mm2 = src0-src4 */
- "psllw $3, %%mm0 \n\t"
- "psllw $3, %%mm2 \n\t"
- "paddw %1, %%mm0 \n\t" /* add rounding bias */
- "paddw %1, %%mm2 \n\t" /* add rounding bias */
-
- SUMSUB_BA( %%mm6, %%mm0 ) /* mm6 = a4 + a6 mm0 = a4 - a6 */
- SUMSUB_BA( %%mm4, %%mm2 ) /* mm4 = a5 + a7 mm2 = a5 - a7 */
- SUMSUB_BA( %%mm7, %%mm6 ) /* mm7 = dst0 mm6 = dst7 */
- SUMSUB_BA( %%mm5, %%mm4 ) /* mm5 = dst1 mm4 = dst6 */
- SUMSUB_BA( %%mm3, %%mm2 ) /* mm3 = dst2 mm2 = dst5 */
- SUMSUB_BA( %%mm1, %%mm0 ) /* mm1 = dst3 mm0 = dst4 */
- :: "r"(block), "m"(bias)
- );
-}
-
-static void cavs_idct8_add_mmx(uint8_t *dst, int16_t *block, int stride)
-{
- int i;
- DECLARE_ALIGNED(8, int16_t, b2)[64];
-
- for(i=0; i<2; i++){
- DECLARE_ALIGNED(8, uint64_t, tmp);
-
- cavs_idct8_1d(block+4*i, ff_pw_4.a);
-
- __asm__ volatile(
- "psraw $3, %%mm7 \n\t"
- "psraw $3, %%mm6 \n\t"
- "psraw $3, %%mm5 \n\t"
- "psraw $3, %%mm4 \n\t"
- "psraw $3, %%mm3 \n\t"
- "psraw $3, %%mm2 \n\t"
- "psraw $3, %%mm1 \n\t"
- "psraw $3, %%mm0 \n\t"
- "movq %%mm7, %0 \n\t"
- TRANSPOSE4( %%mm0, %%mm2, %%mm4, %%mm6, %%mm7 )
- "movq %%mm0, 8(%1) \n\t"
- "movq %%mm6, 24(%1) \n\t"
- "movq %%mm7, 40(%1) \n\t"
- "movq %%mm4, 56(%1) \n\t"
- "movq %0, %%mm7 \n\t"
- TRANSPOSE4( %%mm7, %%mm5, %%mm3, %%mm1, %%mm0 )
- "movq %%mm7, (%1) \n\t"
- "movq %%mm1, 16(%1) \n\t"
- "movq %%mm0, 32(%1) \n\t"
- "movq %%mm3, 48(%1) \n\t"
- : "=m"(tmp)
- : "r"(b2+32*i)
- : "memory"
- );
- }
-
- for(i=0; i<2; i++){
- cavs_idct8_1d(b2+4*i, ff_pw_64.a);
-
- __asm__ volatile(
- "psraw $7, %%mm7 \n\t"
- "psraw $7, %%mm6 \n\t"
- "psraw $7, %%mm5 \n\t"
- "psraw $7, %%mm4 \n\t"
- "psraw $7, %%mm3 \n\t"
- "psraw $7, %%mm2 \n\t"
- "psraw $7, %%mm1 \n\t"
- "psraw $7, %%mm0 \n\t"
- "movq %%mm7, (%0) \n\t"
- "movq %%mm5, 16(%0) \n\t"
- "movq %%mm3, 32(%0) \n\t"
- "movq %%mm1, 48(%0) \n\t"
- "movq %%mm0, 64(%0) \n\t"
- "movq %%mm2, 80(%0) \n\t"
- "movq %%mm4, 96(%0) \n\t"
- "movq %%mm6, 112(%0) \n\t"
- :: "r"(b2+4*i)
- : "memory"
- );
- }
-
- ff_add_pixels_clamped_mmx(b2, dst, stride);
-}
-
-/*****************************************************************************
- *
- * motion compensation
- *
- ****************************************************************************/
-
-/* vertical filter [-1 -2 96 42 -7 0] */
-#define QPEL_CAVSV1(A,B,C,D,E,F,OP,MUL2) \
- "movd (%0), "#F" \n\t"\
- "movq "#C", %%mm6 \n\t"\
- "pmullw %5, %%mm6 \n\t"\
- "movq "#D", %%mm7 \n\t"\
- "pmullw "MANGLE(MUL2)", %%mm7\n\t"\
- "psllw $3, "#E" \n\t"\
- "psubw "#E", %%mm6 \n\t"\
- "psraw $3, "#E" \n\t"\
- "paddw %%mm7, %%mm6 \n\t"\
- "paddw "#E", %%mm6 \n\t"\
- "paddw "#B", "#B" \n\t"\
- "pxor %%mm7, %%mm7 \n\t"\
- "add %2, %0 \n\t"\
- "punpcklbw %%mm7, "#F" \n\t"\
- "psubw "#B", %%mm6 \n\t"\
- "psraw $1, "#B" \n\t"\
- "psubw "#A", %%mm6 \n\t"\
- "paddw %4, %%mm6 \n\t"\
- "psraw $7, %%mm6 \n\t"\
- "packuswb %%mm6, %%mm6 \n\t"\
- OP(%%mm6, (%1), A, d) \
- "add %3, %1 \n\t"
-
-/* vertical filter [ 0 -1 5 5 -1 0] */
-#define QPEL_CAVSV2(A,B,C,D,E,F,OP,MUL2) \
- "movd (%0), "#F" \n\t"\
- "movq "#C", %%mm6 \n\t"\
- "paddw "#D", %%mm6 \n\t"\
- "pmullw %5, %%mm6 \n\t"\
- "add %2, %0 \n\t"\
- "punpcklbw %%mm7, "#F" \n\t"\
- "psubw "#B", %%mm6 \n\t"\
- "psubw "#E", %%mm6 \n\t"\
- "paddw %4, %%mm6 \n\t"\
- "psraw $3, %%mm6 \n\t"\
- "packuswb %%mm6, %%mm6 \n\t"\
- OP(%%mm6, (%1), A, d) \
- "add %3, %1 \n\t"
-
-/* vertical filter [ 0 -7 42 96 -2 -1] */
-#define QPEL_CAVSV3(A,B,C,D,E,F,OP,MUL2) \
- "movd (%0), "#F" \n\t"\
- "movq "#C", %%mm6 \n\t"\
- "pmullw "MANGLE(MUL2)", %%mm6\n\t"\
- "movq "#D", %%mm7 \n\t"\
- "pmullw %5, %%mm7 \n\t"\
- "psllw $3, "#B" \n\t"\
- "psubw "#B", %%mm6 \n\t"\
- "psraw $3, "#B" \n\t"\
- "paddw %%mm7, %%mm6 \n\t"\
- "paddw "#B", %%mm6 \n\t"\
- "paddw "#E", "#E" \n\t"\
- "pxor %%mm7, %%mm7 \n\t"\
- "add %2, %0 \n\t"\
- "punpcklbw %%mm7, "#F" \n\t"\
- "psubw "#E", %%mm6 \n\t"\
- "psraw $1, "#E" \n\t"\
- "psubw "#F", %%mm6 \n\t"\
- "paddw %4, %%mm6 \n\t"\
- "psraw $7, %%mm6 \n\t"\
- "packuswb %%mm6, %%mm6 \n\t"\
- OP(%%mm6, (%1), A, d) \
- "add %3, %1 \n\t"
-
-
-#define QPEL_CAVSVNUM(VOP,OP,ADD,MUL1,MUL2)\
- int w= 2;\
- src -= 2*srcStride;\
- \
- while(w--){\
- __asm__ volatile(\
- "pxor %%mm7, %%mm7 \n\t"\
- "movd (%0), %%mm0 \n\t"\
- "add %2, %0 \n\t"\
- "movd (%0), %%mm1 \n\t"\
- "add %2, %0 \n\t"\
- "movd (%0), %%mm2 \n\t"\
- "add %2, %0 \n\t"\
- "movd (%0), %%mm3 \n\t"\
- "add %2, %0 \n\t"\
- "movd (%0), %%mm4 \n\t"\
- "add %2, %0 \n\t"\
- "punpcklbw %%mm7, %%mm0 \n\t"\
- "punpcklbw %%mm7, %%mm1 \n\t"\
- "punpcklbw %%mm7, %%mm2 \n\t"\
- "punpcklbw %%mm7, %%mm3 \n\t"\
- "punpcklbw %%mm7, %%mm4 \n\t"\
- VOP(%%mm0, %%mm1, %%mm2, %%mm3, %%mm4, %%mm5, OP, MUL2)\
- VOP(%%mm1, %%mm2, %%mm3, %%mm4, %%mm5, %%mm0, OP, MUL2)\
- VOP(%%mm2, %%mm3, %%mm4, %%mm5, %%mm0, %%mm1, OP, MUL2)\
- VOP(%%mm3, %%mm4, %%mm5, %%mm0, %%mm1, %%mm2, OP, MUL2)\
- VOP(%%mm4, %%mm5, %%mm0, %%mm1, %%mm2, %%mm3, OP, MUL2)\
- VOP(%%mm5, %%mm0, %%mm1, %%mm2, %%mm3, %%mm4, OP, MUL2)\
- VOP(%%mm0, %%mm1, %%mm2, %%mm3, %%mm4, %%mm5, OP, MUL2)\
- VOP(%%mm1, %%mm2, %%mm3, %%mm4, %%mm5, %%mm0, OP, MUL2)\
- \
- : "+a"(src), "+c"(dst)\
- : "S"((x86_reg)srcStride), "r"((x86_reg)dstStride), "m"(ADD), "m"(MUL1)\
- : "memory"\
- );\
- if(h==16){\
- __asm__ volatile(\
- VOP(%%mm2, %%mm3, %%mm4, %%mm5, %%mm0, %%mm1, OP, MUL2)\
- VOP(%%mm3, %%mm4, %%mm5, %%mm0, %%mm1, %%mm2, OP, MUL2)\
- VOP(%%mm4, %%mm5, %%mm0, %%mm1, %%mm2, %%mm3, OP, MUL2)\
- VOP(%%mm5, %%mm0, %%mm1, %%mm2, %%mm3, %%mm4, OP, MUL2)\
- VOP(%%mm0, %%mm1, %%mm2, %%mm3, %%mm4, %%mm5, OP, MUL2)\
- VOP(%%mm1, %%mm2, %%mm3, %%mm4, %%mm5, %%mm0, OP, MUL2)\
- VOP(%%mm2, %%mm3, %%mm4, %%mm5, %%mm0, %%mm1, OP, MUL2)\
- VOP(%%mm3, %%mm4, %%mm5, %%mm0, %%mm1, %%mm2, OP, MUL2)\
- \
- : "+a"(src), "+c"(dst)\
- : "S"((x86_reg)srcStride), "r"((x86_reg)dstStride), "m"(ADD), "m"(MUL1)\
- : "memory"\
- );\
- }\
- src += 4-(h+5)*srcStride;\
- dst += 4-h*dstStride;\
- }
-
-#define QPEL_CAVS(OPNAME, OP, MMX)\
-static void OPNAME ## cavs_qpel8_h_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
- int h=8;\
- __asm__ volatile(\
- "pxor %%mm7, %%mm7 \n\t"\
- "movq %5, %%mm6 \n\t"\
- "1: \n\t"\
- "movq (%0), %%mm0 \n\t"\
- "movq 1(%0), %%mm2 \n\t"\
- "movq %%mm0, %%mm1 \n\t"\
- "movq %%mm2, %%mm3 \n\t"\
- "punpcklbw %%mm7, %%mm0 \n\t"\
- "punpckhbw %%mm7, %%mm1 \n\t"\
- "punpcklbw %%mm7, %%mm2 \n\t"\
- "punpckhbw %%mm7, %%mm3 \n\t"\
- "paddw %%mm2, %%mm0 \n\t"\
- "paddw %%mm3, %%mm1 \n\t"\
- "pmullw %%mm6, %%mm0 \n\t"\
- "pmullw %%mm6, %%mm1 \n\t"\
- "movq -1(%0), %%mm2 \n\t"\
- "movq 2(%0), %%mm4 \n\t"\
- "movq %%mm2, %%mm3 \n\t"\
- "movq %%mm4, %%mm5 \n\t"\
- "punpcklbw %%mm7, %%mm2 \n\t"\
- "punpckhbw %%mm7, %%mm3 \n\t"\
- "punpcklbw %%mm7, %%mm4 \n\t"\
- "punpckhbw %%mm7, %%mm5 \n\t"\
- "paddw %%mm4, %%mm2 \n\t"\
- "paddw %%mm3, %%mm5 \n\t"\
- "psubw %%mm2, %%mm0 \n\t"\
- "psubw %%mm5, %%mm1 \n\t"\
- "movq %6, %%mm5 \n\t"\
- "paddw %%mm5, %%mm0 \n\t"\
- "paddw %%mm5, %%mm1 \n\t"\
- "psraw $3, %%mm0 \n\t"\
- "psraw $3, %%mm1 \n\t"\
- "packuswb %%mm1, %%mm0 \n\t"\
- OP(%%mm0, (%1),%%mm5, q) \
- "add %3, %0 \n\t"\
- "add %4, %1 \n\t"\
- "decl %2 \n\t"\
- " jnz 1b \n\t"\
- : "+a"(src), "+c"(dst), "+m"(h)\
- : "d"((x86_reg)srcStride), "S"((x86_reg)dstStride), "m"(ff_pw_5), "m"(ff_pw_4)\
- : "memory"\
- );\
-}\
-\
-static inline void OPNAME ## cavs_qpel8or16_v1_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int h){\
- QPEL_CAVSVNUM(QPEL_CAVSV1,OP,ff_pw_64,ff_pw_96,ff_pw_42) \
-}\
-\
-static inline void OPNAME ## cavs_qpel8or16_v2_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int h){\
- QPEL_CAVSVNUM(QPEL_CAVSV2,OP,ff_pw_4,ff_pw_5,ff_pw_5) \
-}\
-\
-static inline void OPNAME ## cavs_qpel8or16_v3_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int h){\
- QPEL_CAVSVNUM(QPEL_CAVSV3,OP,ff_pw_64,ff_pw_96,ff_pw_42) \
-}\
-\
-static void OPNAME ## cavs_qpel8_v1_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
- OPNAME ## cavs_qpel8or16_v1_ ## MMX(dst , src , dstStride, srcStride, 8);\
-}\
-static void OPNAME ## cavs_qpel16_v1_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
- OPNAME ## cavs_qpel8or16_v1_ ## MMX(dst , src , dstStride, srcStride, 16);\
- OPNAME ## cavs_qpel8or16_v1_ ## MMX(dst+8, src+8, dstStride, srcStride, 16);\
-}\
-\
-static void OPNAME ## cavs_qpel8_v2_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
- OPNAME ## cavs_qpel8or16_v2_ ## MMX(dst , src , dstStride, srcStride, 8);\
-}\
-static void OPNAME ## cavs_qpel16_v2_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
- OPNAME ## cavs_qpel8or16_v2_ ## MMX(dst , src , dstStride, srcStride, 16);\
- OPNAME ## cavs_qpel8or16_v2_ ## MMX(dst+8, src+8, dstStride, srcStride, 16);\
-}\
-\
-static void OPNAME ## cavs_qpel8_v3_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
- OPNAME ## cavs_qpel8or16_v3_ ## MMX(dst , src , dstStride, srcStride, 8);\
-}\
-static void OPNAME ## cavs_qpel16_v3_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
- OPNAME ## cavs_qpel8or16_v3_ ## MMX(dst , src , dstStride, srcStride, 16);\
- OPNAME ## cavs_qpel8or16_v3_ ## MMX(dst+8, src+8, dstStride, srcStride, 16);\
-}\
-\
-static void OPNAME ## cavs_qpel16_h_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
- OPNAME ## cavs_qpel8_h_ ## MMX(dst , src , dstStride, srcStride);\
- OPNAME ## cavs_qpel8_h_ ## MMX(dst+8, src+8, dstStride, srcStride);\
- src += 8*srcStride;\
- dst += 8*dstStride;\
- OPNAME ## cavs_qpel8_h_ ## MMX(dst , src , dstStride, srcStride);\
- OPNAME ## cavs_qpel8_h_ ## MMX(dst+8, src+8, dstStride, srcStride);\
-}\
-
-#define CAVS_MC(OPNAME, SIZE, MMX) \
-static void ff_ ## OPNAME ## cavs_qpel ## SIZE ## _mc20_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
- OPNAME ## cavs_qpel ## SIZE ## _h_ ## MMX(dst, src, stride, stride);\
-}\
-\
-static void ff_ ## OPNAME ## cavs_qpel ## SIZE ## _mc01_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
- OPNAME ## cavs_qpel ## SIZE ## _v1_ ## MMX(dst, src, stride, stride);\
-}\
-\
-static void ff_ ## OPNAME ## cavs_qpel ## SIZE ## _mc02_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
- OPNAME ## cavs_qpel ## SIZE ## _v2_ ## MMX(dst, src, stride, stride);\
-}\
-\
-static void ff_ ## OPNAME ## cavs_qpel ## SIZE ## _mc03_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
- OPNAME ## cavs_qpel ## SIZE ## _v3_ ## MMX(dst, src, stride, stride);\
-}\
-
-#define PUT_OP(a,b,temp, size) "mov" #size " " #a ", " #b " \n\t"
-#define AVG_3DNOW_OP(a,b,temp, size) \
-"mov" #size " " #b ", " #temp " \n\t"\
-"pavgusb " #temp ", " #a " \n\t"\
-"mov" #size " " #a ", " #b " \n\t"
-#define AVG_MMX2_OP(a,b,temp, size) \
-"mov" #size " " #b ", " #temp " \n\t"\
-"pavgb " #temp ", " #a " \n\t"\
-"mov" #size " " #a ", " #b " \n\t"
-
-QPEL_CAVS(put_, PUT_OP, 3dnow)
-QPEL_CAVS(avg_, AVG_3DNOW_OP, 3dnow)
-QPEL_CAVS(put_, PUT_OP, mmx2)
-QPEL_CAVS(avg_, AVG_MMX2_OP, mmx2)
-
-CAVS_MC(put_, 8, 3dnow)
-CAVS_MC(put_, 16,3dnow)
-CAVS_MC(avg_, 8, 3dnow)
-CAVS_MC(avg_, 16,3dnow)
-CAVS_MC(put_, 8, mmx2)
-CAVS_MC(put_, 16,mmx2)
-CAVS_MC(avg_, 8, mmx2)
-CAVS_MC(avg_, 16,mmx2)
-
-static void ff_cavsdsp_init_mmx2(CAVSDSPContext* c, AVCodecContext *avctx) {
-#define dspfunc(PFX, IDX, NUM) \
- c->PFX ## _pixels_tab[IDX][ 0] = ff_ ## PFX ## NUM ## _mc00_mmx2; \
- c->PFX ## _pixels_tab[IDX][ 2] = ff_ ## PFX ## NUM ## _mc20_mmx2; \
- c->PFX ## _pixels_tab[IDX][ 4] = ff_ ## PFX ## NUM ## _mc01_mmx2; \
- c->PFX ## _pixels_tab[IDX][ 8] = ff_ ## PFX ## NUM ## _mc02_mmx2; \
- c->PFX ## _pixels_tab[IDX][12] = ff_ ## PFX ## NUM ## _mc03_mmx2; \
-
- dspfunc(put_cavs_qpel, 0, 16);
- dspfunc(put_cavs_qpel, 1, 8);
- dspfunc(avg_cavs_qpel, 0, 16);
- dspfunc(avg_cavs_qpel, 1, 8);
-#undef dspfunc
- c->cavs_idct8_add = cavs_idct8_add_mmx;
-}
-
-static void ff_cavsdsp_init_3dnow(CAVSDSPContext* c, AVCodecContext *avctx) {
-#define dspfunc(PFX, IDX, NUM) \
- c->PFX ## _pixels_tab[IDX][ 0] = ff_ ## PFX ## NUM ## _mc00_mmx2; \
- c->PFX ## _pixels_tab[IDX][ 2] = ff_ ## PFX ## NUM ## _mc20_3dnow; \
- c->PFX ## _pixels_tab[IDX][ 4] = ff_ ## PFX ## NUM ## _mc01_3dnow; \
- c->PFX ## _pixels_tab[IDX][ 8] = ff_ ## PFX ## NUM ## _mc02_3dnow; \
- c->PFX ## _pixels_tab[IDX][12] = ff_ ## PFX ## NUM ## _mc03_3dnow; \
-
- dspfunc(put_cavs_qpel, 0, 16);
- dspfunc(put_cavs_qpel, 1, 8);
- dspfunc(avg_cavs_qpel, 0, 16);
- dspfunc(avg_cavs_qpel, 1, 8);
-#undef dspfunc
- c->cavs_idct8_add = cavs_idct8_add_mmx;
-}
-
-void ff_cavsdsp_init_mmx(CAVSDSPContext *c, AVCodecContext *avctx)
-{
- int mm_flags = av_get_cpu_flags();
-
- if (mm_flags & AV_CPU_FLAG_MMX2) ff_cavsdsp_init_mmx2 (c, avctx);
- if (mm_flags & AV_CPU_FLAG_3DNOW) ff_cavsdsp_init_3dnow(c, avctx);
-}
diff --git a/gst-libs/ext/libav/libavcodec/x86/dct32.asm b/gst-libs/ext/libav/libavcodec/x86/dct32.asm
new file mode 100644
index 0000000..9c147b9
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/x86/dct32.asm
@@ -0,0 +1,488 @@
+;******************************************************************************
+;* 32 point SSE-optimized DCT transform
+;* Copyright (c) 2010 Vitor Sessak
+;*
+;* 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
+;******************************************************************************
+
+%include "libavutil/x86/x86util.asm"
+
+SECTION_RODATA 32
+
+align 32
+ps_cos_vec: dd 0.500603, 0.505471, 0.515447, 0.531043
+ dd 0.553104, 0.582935, 0.622504, 0.674808
+ dd -10.190008, -3.407609, -2.057781, -1.484165
+ dd -1.169440, -0.972568, -0.839350, -0.744536
+ dd 0.502419, 0.522499, 0.566944, 0.646822
+ dd 0.788155, 1.060678, 1.722447, 5.101149
+ dd 0.509796, 0.601345, 0.899976, 2.562916
+ dd 0.509796, 0.601345, 0.899976, 2.562916
+ dd 1.000000, 1.000000, 1.306563, 0.541196
+ dd 1.000000, 1.000000, 1.306563, 0.541196
+ dd 1.000000, 0.707107, 1.000000, -0.707107
+ dd 1.000000, 0.707107, 1.000000, -0.707107
+ dd 0.707107, 0.707107, 0.707107, 0.707107
+
+align 32
+ps_p1p1m1m1: dd 0, 0, 0x80000000, 0x80000000, 0, 0, 0x80000000, 0x80000000
+
+%macro BUTTERFLY 4
+ subps %4, %1, %2
+ addps %2, %2, %1
+ mulps %1, %4, %3
+%endmacro
+
+%macro BUTTERFLY0 5
+%if cpuflag(sse2) && notcpuflag(avx)
+ pshufd %4, %1, %5
+ xorps %1, %2
+ addps %1, %4
+ mulps %1, %3
+%else
+ shufps %4, %1, %1, %5
+ xorps %1, %1, %2
+ addps %4, %4, %1
+ mulps %1, %4, %3
+%endif
+%endmacro
+
+%macro BUTTERFLY2 4
+ BUTTERFLY0 %1, %2, %3, %4, 0x1b
+%endmacro
+
+%macro BUTTERFLY3 4
+ BUTTERFLY0 %1, %2, %3, %4, 0xb1
+%endmacro
+
+%macro BUTTERFLY3V 5
+ movaps m%5, m%1
+ addps m%1, m%2
+ subps m%5, m%2
+ SWAP %2, %5
+ mulps m%2, [ps_cos_vec+192]
+ movaps m%5, m%3
+ addps m%3, m%4
+ subps m%4, m%5
+ mulps m%4, [ps_cos_vec+192]
+%endmacro
+
+%macro PASS6_AND_PERMUTE 0
+ mov tmpd, [outq+4]
+ movss m7, [outq+72]
+ addss m7, [outq+76]
+ movss m3, [outq+56]
+ addss m3, [outq+60]
+ addss m4, m3
+ movss m2, [outq+52]
+ addss m2, m3
+ movss m3, [outq+104]
+ addss m3, [outq+108]
+ addss m1, m3
+ addss m5, m4
+ movss [outq+ 16], m1
+ movss m1, [outq+100]
+ addss m1, m3
+ movss m3, [outq+40]
+ movss [outq+ 48], m1
+ addss m3, [outq+44]
+ movss m1, [outq+100]
+ addss m4, m3
+ addss m3, m2
+ addss m1, [outq+108]
+ movss [outq+ 40], m3
+ addss m2, [outq+36]
+ movss m3, [outq+8]
+ movss [outq+ 56], m2
+ addss m3, [outq+12]
+ movss [outq+ 32], m3
+ movss m3, [outq+80]
+ movss [outq+ 8], m5
+ movss [outq+ 80], m1
+ movss m2, [outq+52]
+ movss m5, [outq+120]
+ addss m5, [outq+124]
+ movss m1, [outq+64]
+ addss m2, [outq+60]
+ addss m0, m5
+ addss m5, [outq+116]
+ mov [outq+64], tmpd
+ addss m6, m0
+ addss m1, m6
+ mov tmpd, [outq+12]
+ mov [outq+ 96], tmpd
+ movss [outq+ 4], m1
+ movss m1, [outq+24]
+ movss [outq+ 24], m4
+ movss m4, [outq+88]
+ addss m4, [outq+92]
+ addss m3, m4
+ addss m4, [outq+84]
+ mov tmpd, [outq+108]
+ addss m1, [outq+28]
+ addss m0, m1
+ addss m1, m5
+ addss m6, m3
+ addss m3, m0
+ addss m0, m7
+ addss m5, [outq+20]
+ addss m7, m1
+ movss [outq+ 12], m6
+ mov [outq+112], tmpd
+ movss m6, [outq+28]
+ movss [outq+ 28], m0
+ movss m0, [outq+36]
+ movss [outq+ 36], m7
+ addss m1, m4
+ movss m7, [outq+116]
+ addss m0, m2
+ addss m7, [outq+124]
+ movss [outq+ 72], m0
+ movss m0, [outq+44]
+ addss m2, m0
+ movss [outq+ 44], m1
+ movss [outq+ 88], m2
+ addss m0, [outq+60]
+ mov tmpd, [outq+60]
+ mov [outq+120], tmpd
+ movss [outq+104], m0
+ addss m4, m5
+ addss m5, [outq+68]
+ movss [outq+52], m4
+ movss [outq+60], m5
+ movss m4, [outq+68]
+ movss m5, [outq+20]
+ movss [outq+ 20], m3
+ addss m5, m7
+ addss m7, m6
+ addss m4, m5
+ movss m2, [outq+84]
+ addss m2, [outq+92]
+ addss m5, m2
+ movss [outq+ 68], m4
+ addss m2, m7
+ movss m4, [outq+76]
+ movss [outq+ 84], m2
+ movss [outq+ 76], m5
+ addss m7, m4
+ addss m6, [outq+124]
+ addss m4, m6
+ addss m6, [outq+92]
+ movss [outq+100], m4
+ movss [outq+108], m6
+ movss m6, [outq+92]
+ movss [outq+92], m7
+ addss m6, [outq+124]
+ movss [outq+116], m6
+%endmacro
+
+INIT_YMM avx
+SECTION_TEXT
+; void ff_dct32_float_avx(FFTSample *out, const FFTSample *in)
+cglobal dct32_float, 2,3,8, out, in, tmp
+ ; pass 1
+ vmovaps m4, [inq+0]
+ vinsertf128 m5, m5, [inq+96], 1
+ vinsertf128 m5, m5, [inq+112], 0
+ vshufps m5, m5, m5, 0x1b
+ BUTTERFLY m4, m5, [ps_cos_vec], m6
+
+ vmovaps m2, [inq+64]
+ vinsertf128 m6, m6, [inq+32], 1
+ vinsertf128 m6, m6, [inq+48], 0
+ vshufps m6, m6, m6, 0x1b
+ BUTTERFLY m2, m6, [ps_cos_vec+32], m0
+
+ ; pass 2
+
+ BUTTERFLY m5, m6, [ps_cos_vec+64], m0
+ BUTTERFLY m4, m2, [ps_cos_vec+64], m7
+
+
+ ; pass 3
+ vperm2f128 m3, m6, m4, 0x31
+ vperm2f128 m1, m6, m4, 0x20
+ vshufps m3, m3, m3, 0x1b
+
+ BUTTERFLY m1, m3, [ps_cos_vec+96], m6
+
+
+ vperm2f128 m4, m5, m2, 0x20
+ vperm2f128 m5, m5, m2, 0x31
+ vshufps m5, m5, m5, 0x1b
+
+ BUTTERFLY m4, m5, [ps_cos_vec+96], m6
+
+ ; pass 4
+ vmovaps m6, [ps_p1p1m1m1+0]
+ vmovaps m2, [ps_cos_vec+128]
+
+ BUTTERFLY2 m5, m6, m2, m7
+ BUTTERFLY2 m4, m6, m2, m7
+ BUTTERFLY2 m1, m6, m2, m7
+ BUTTERFLY2 m3, m6, m2, m7
+
+
+ ; pass 5
+ vshufps m6, m6, m6, 0xcc
+ vmovaps m2, [ps_cos_vec+160]
+
+ BUTTERFLY3 m5, m6, m2, m7
+ BUTTERFLY3 m4, m6, m2, m7
+ BUTTERFLY3 m1, m6, m2, m7
+ BUTTERFLY3 m3, m6, m2, m7
+
+ vperm2f128 m6, m3, m3, 0x31
+ vmovaps [outq], m3
+
+ vextractf128 [outq+64], m5, 1
+ vextractf128 [outq+32], m5, 0
+
+ vextractf128 [outq+80], m4, 1
+ vextractf128 [outq+48], m4, 0
+
+ vperm2f128 m0, m1, m1, 0x31
+ vmovaps [outq+96], m1
+
+ vzeroupper
+
+ ; pass 6, no SIMD...
+INIT_XMM
+ PASS6_AND_PERMUTE
+ RET
+
+%if ARCH_X86_64
+%define SPILL SWAP
+%define UNSPILL SWAP
+
+%macro PASS5 0
+ nop ; FIXME code alignment
+ SWAP 5, 8
+ SWAP 4, 12
+ SWAP 6, 14
+ SWAP 7, 13
+ SWAP 0, 15
+ PERMUTE 9,10, 10,12, 11,14, 12,9, 13,11, 14,13
+ TRANSPOSE4x4PS 8, 9, 10, 11, 0
+ BUTTERFLY3V 8, 9, 10, 11, 0
+ addps m10, m11
+ TRANSPOSE4x4PS 12, 13, 14, 15, 0
+ BUTTERFLY3V 12, 13, 14, 15, 0
+ addps m14, m15
+ addps m12, m14
+ addps m14, m13
+ addps m13, m15
+%endmacro
+
+%macro PASS6 0
+ SWAP 9, 12
+ SWAP 11, 14
+ movss [outq+0x00], m8
+ pshuflw m0, m8, 0xe
+ movss [outq+0x10], m9
+ pshuflw m1, m9, 0xe
+ movss [outq+0x20], m10
+ pshuflw m2, m10, 0xe
+ movss [outq+0x30], m11
+ pshuflw m3, m11, 0xe
+ movss [outq+0x40], m12
+ pshuflw m4, m12, 0xe
+ movss [outq+0x50], m13
+ pshuflw m5, m13, 0xe
+ movss [outq+0x60], m14
+ pshuflw m6, m14, 0xe
+ movaps [outq+0x70], m15
+ pshuflw m7, m15, 0xe
+ addss m0, m1
+ addss m1, m2
+ movss [outq+0x08], m0
+ addss m2, m3
+ movss [outq+0x18], m1
+ addss m3, m4
+ movss [outq+0x28], m2
+ addss m4, m5
+ movss [outq+0x38], m3
+ addss m5, m6
+ movss [outq+0x48], m4
+ addss m6, m7
+ movss [outq+0x58], m5
+ movss [outq+0x68], m6
+ movss [outq+0x78], m7
+
+ PERMUTE 1,8, 3,9, 5,10, 7,11, 9,12, 11,13, 13,14, 8,1, 10,3, 12,5, 14,7
+ movhlps m0, m1
+ pshufd m1, m1, 3
+ SWAP 0, 2, 4, 6, 8, 10, 12, 14
+ SWAP 1, 3, 5, 7, 9, 11, 13, 15
+%rep 7
+ movhlps m0, m1
+ pshufd m1, m1, 3
+ addss m15, m1
+ SWAP 0, 2, 4, 6, 8, 10, 12, 14
+ SWAP 1, 3, 5, 7, 9, 11, 13, 15
+%endrep
+%assign i 4
+%rep 15
+ addss m0, m1
+ movss [outq+i], m0
+ SWAP 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
+ %assign i i+8
+%endrep
+%endmacro
+
+%else ; ARCH_X86_32
+%macro SPILL 2 ; xmm#, mempos
+ movaps [outq+(%2-8)*16], m%1
+%endmacro
+%macro UNSPILL 2
+ movaps m%1, [outq+(%2-8)*16]
+%endmacro
+
+%define PASS6 PASS6_AND_PERMUTE
+%macro PASS5 0
+ movaps m2, [ps_cos_vec+160]
+ shufps m3, m3, 0xcc
+
+ BUTTERFLY3 m5, m3, m2, m1
+ SPILL 5, 8
+
+ UNSPILL 1, 9
+ BUTTERFLY3 m1, m3, m2, m5
+ SPILL 1, 14
+
+ BUTTERFLY3 m4, m3, m2, m5
+ SPILL 4, 12
+
+ BUTTERFLY3 m7, m3, m2, m5
+ SPILL 7, 13
+
+ UNSPILL 5, 10
+ BUTTERFLY3 m5, m3, m2, m7
+ SPILL 5, 10
+
+ UNSPILL 4, 11
+ BUTTERFLY3 m4, m3, m2, m7
+ SPILL 4, 11
+
+ BUTTERFLY3 m6, m3, m2, m7
+ SPILL 6, 9
+
+ BUTTERFLY3 m0, m3, m2, m7
+ SPILL 0, 15
+%endmacro
+%endif
+
+
+; void ff_dct32_float_sse(FFTSample *out, const FFTSample *in)
+%macro DCT32_FUNC 0
+cglobal dct32_float, 2, 3, 16, out, in, tmp
+ ; pass 1
+
+ movaps m0, [inq+0]
+ LOAD_INV m1, [inq+112]
+ BUTTERFLY m0, m1, [ps_cos_vec], m3
+
+ movaps m7, [inq+64]
+ LOAD_INV m4, [inq+48]
+ BUTTERFLY m7, m4, [ps_cos_vec+32], m3
+
+ ; pass 2
+ movaps m2, [ps_cos_vec+64]
+ BUTTERFLY m1, m4, m2, m3
+ SPILL 1, 11
+ SPILL 4, 8
+
+ ; pass 1
+ movaps m1, [inq+16]
+ LOAD_INV m6, [inq+96]
+ BUTTERFLY m1, m6, [ps_cos_vec+16], m3
+
+ movaps m4, [inq+80]
+ LOAD_INV m5, [inq+32]
+ BUTTERFLY m4, m5, [ps_cos_vec+48], m3
+
+ ; pass 2
+ BUTTERFLY m0, m7, m2, m3
+
+ movaps m2, [ps_cos_vec+80]
+ BUTTERFLY m6, m5, m2, m3
+
+ BUTTERFLY m1, m4, m2, m3
+
+ ; pass 3
+ movaps m2, [ps_cos_vec+96]
+ shufps m1, m1, 0x1b
+ BUTTERFLY m0, m1, m2, m3
+ SPILL 0, 15
+ SPILL 1, 14
+
+ UNSPILL 0, 8
+ shufps m5, m5, 0x1b
+ BUTTERFLY m0, m5, m2, m3
+
+ UNSPILL 1, 11
+ shufps m6, m6, 0x1b
+ BUTTERFLY m1, m6, m2, m3
+ SPILL 1, 11
+
+ shufps m4, m4, 0x1b
+ BUTTERFLY m7, m4, m2, m3
+
+ ; pass 4
+ movaps m3, [ps_p1p1m1m1+0]
+ movaps m2, [ps_cos_vec+128]
+
+ BUTTERFLY2 m5, m3, m2, m1
+
+ BUTTERFLY2 m0, m3, m2, m1
+ SPILL 0, 9
+
+ BUTTERFLY2 m6, m3, m2, m1
+ SPILL 6, 10
+
+ UNSPILL 0, 11
+ BUTTERFLY2 m0, m3, m2, m1
+ SPILL 0, 11
+
+ BUTTERFLY2 m4, m3, m2, m1
+
+ BUTTERFLY2 m7, m3, m2, m1
+
+ UNSPILL 6, 14
+ BUTTERFLY2 m6, m3, m2, m1
+
+ UNSPILL 0, 15
+ BUTTERFLY2 m0, m3, m2, m1
+
+ PASS5
+ PASS6
+ RET
+%endmacro
+
+%macro LOAD_INV 2
+%if cpuflag(sse2)
+ pshufd %1, %2, 0x1b
+%elif cpuflag(sse)
+ movaps %1, %2
+ shufps %1, %1, 0x1b
+%endif
+%endmacro
+
+INIT_XMM sse
+DCT32_FUNC
+INIT_XMM sse2
+DCT32_FUNC
diff --git a/gst-libs/ext/libav/libavcodec/x86/dct32_sse.asm b/gst-libs/ext/libav/libavcodec/x86/dct32_sse.asm
deleted file mode 100644
index 720a061..0000000
--- a/gst-libs/ext/libav/libavcodec/x86/dct32_sse.asm
+++ /dev/null
@@ -1,515 +0,0 @@
-;******************************************************************************
-;* 32 point SSE-optimized DCT transform
-;* Copyright (c) 2010 Vitor Sessak
-;*
-;* 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
-;******************************************************************************
-
-%include "x86inc.asm"
-%include "x86util.asm"
-
-SECTION_RODATA 32
-
-align 32
-ps_cos_vec: dd 0.500603, 0.505471, 0.515447, 0.531043
- dd 0.553104, 0.582935, 0.622504, 0.674808
- dd -10.190008, -3.407609, -2.057781, -1.484165
- dd -1.169440, -0.972568, -0.839350, -0.744536
- dd 0.502419, 0.522499, 0.566944, 0.646822
- dd 0.788155, 1.060678, 1.722447, 5.101149
- dd 0.509796, 0.601345, 0.899976, 2.562916
- dd 0.509796, 0.601345, 0.899976, 2.562916
- dd 1.000000, 1.000000, 1.306563, 0.541196
- dd 1.000000, 1.000000, 1.306563, 0.541196
- dd 1.000000, 0.707107, 1.000000, -0.707107
- dd 1.000000, 0.707107, 1.000000, -0.707107
- dd 0.707107, 0.707107, 0.707107, 0.707107
-
-align 32
-ps_p1p1m1m1: dd 0, 0, 0x80000000, 0x80000000, 0, 0, 0x80000000, 0x80000000
-
-%macro BUTTERFLY_SSE 4
- movaps %4, %1
- subps %1, %2
- addps %2, %4
- mulps %1, %3
-%endmacro
-
-%macro BUTTERFLY_AVX 4
- vsubps %4, %1, %2
- vaddps %2, %2, %1
- vmulps %1, %4, %3
-%endmacro
-
-%macro BUTTERFLY0_SSE 5
- movaps %4, %1
- shufps %1, %1, %5
- xorps %4, %2
- addps %1, %4
- mulps %1, %3
-%endmacro
-
-%macro BUTTERFLY0_SSE2 5
- pshufd %4, %1, %5
- xorps %1, %2
- addps %1, %4
- mulps %1, %3
-%endmacro
-
-%macro BUTTERFLY0_AVX 5
- vshufps %4, %1, %1, %5
- vxorps %1, %1, %2
- vaddps %4, %4, %1
- vmulps %1, %4, %3
-%endmacro
-
-%macro BUTTERFLY2 4
- BUTTERFLY0 %1, %2, %3, %4, 0x1b
-%endmacro
-
-%macro BUTTERFLY3 4
- BUTTERFLY0 %1, %2, %3, %4, 0xb1
-%endmacro
-
-%macro BUTTERFLY3V 5
- movaps m%5, m%1
- addps m%1, m%2
- subps m%5, m%2
- SWAP %2, %5
- mulps m%2, [ps_cos_vec+192]
- movaps m%5, m%3
- addps m%3, m%4
- subps m%4, m%5
- mulps m%4, [ps_cos_vec+192]
-%endmacro
-
-%macro PASS6_AND_PERMUTE 0
- mov tmpd, [outq+4]
- movss m7, [outq+72]
- addss m7, [outq+76]
- movss m3, [outq+56]
- addss m3, [outq+60]
- addss m4, m3
- movss m2, [outq+52]
- addss m2, m3
- movss m3, [outq+104]
- addss m3, [outq+108]
- addss m1, m3
- addss m5, m4
- movss [outq+ 16], m1
- movss m1, [outq+100]
- addss m1, m3
- movss m3, [outq+40]
- movss [outq+ 48], m1
- addss m3, [outq+44]
- movss m1, [outq+100]
- addss m4, m3
- addss m3, m2
- addss m1, [outq+108]
- movss [outq+ 40], m3
- addss m2, [outq+36]
- movss m3, [outq+8]
- movss [outq+ 56], m2
- addss m3, [outq+12]
- movss [outq+ 32], m3
- movss m3, [outq+80]
- movss [outq+ 8], m5
- movss [outq+ 80], m1
- movss m2, [outq+52]
- movss m5, [outq+120]
- addss m5, [outq+124]
- movss m1, [outq+64]
- addss m2, [outq+60]
- addss m0, m5
- addss m5, [outq+116]
- mov [outq+64], tmpd
- addss m6, m0
- addss m1, m6
- mov tmpd, [outq+12]
- mov [outq+ 96], tmpd
- movss [outq+ 4], m1
- movss m1, [outq+24]
- movss [outq+ 24], m4
- movss m4, [outq+88]
- addss m4, [outq+92]
- addss m3, m4
- addss m4, [outq+84]
- mov tmpd, [outq+108]
- addss m1, [outq+28]
- addss m0, m1
- addss m1, m5
- addss m6, m3
- addss m3, m0
- addss m0, m7
- addss m5, [outq+20]
- addss m7, m1
- movss [outq+ 12], m6
- mov [outq+112], tmpd
- movss m6, [outq+28]
- movss [outq+ 28], m0
- movss m0, [outq+36]
- movss [outq+ 36], m7
- addss m1, m4
- movss m7, [outq+116]
- addss m0, m2
- addss m7, [outq+124]
- movss [outq+ 72], m0
- movss m0, [outq+44]
- addss m2, m0
- movss [outq+ 44], m1
- movss [outq+ 88], m2
- addss m0, [outq+60]
- mov tmpd, [outq+60]
- mov [outq+120], tmpd
- movss [outq+104], m0
- addss m4, m5
- addss m5, [outq+68]
- movss [outq+52], m4
- movss [outq+60], m5
- movss m4, [outq+68]
- movss m5, [outq+20]
- movss [outq+ 20], m3
- addss m5, m7
- addss m7, m6
- addss m4, m5
- movss m2, [outq+84]
- addss m2, [outq+92]
- addss m5, m2
- movss [outq+ 68], m4
- addss m2, m7
- movss m4, [outq+76]
- movss [outq+ 84], m2
- movss [outq+ 76], m5
- addss m7, m4
- addss m6, [outq+124]
- addss m4, m6
- addss m6, [outq+92]
- movss [outq+100], m4
- movss [outq+108], m6
- movss m6, [outq+92]
- movss [outq+92], m7
- addss m6, [outq+124]
- movss [outq+116], m6
-%endmacro
-
-%define BUTTERFLY BUTTERFLY_AVX
-%define BUTTERFLY0 BUTTERFLY0_AVX
-
-INIT_YMM
-SECTION_TEXT
-%ifdef HAVE_AVX
-; void ff_dct32_float_avx(FFTSample *out, const FFTSample *in)
-cglobal dct32_float_avx, 2,3,8, out, in, tmp
- ; pass 1
- vmovaps m4, [inq+0]
- vinsertf128 m5, m5, [inq+96], 1
- vinsertf128 m5, m5, [inq+112], 0
- vshufps m5, m5, m5, 0x1b
- BUTTERFLY m4, m5, [ps_cos_vec], m6
-
- vmovaps m2, [inq+64]
- vinsertf128 m6, m6, [inq+32], 1
- vinsertf128 m6, m6, [inq+48], 0
- vshufps m6, m6, m6, 0x1b
- BUTTERFLY m2, m6, [ps_cos_vec+32], m0
-
- ; pass 2
-
- BUTTERFLY m5, m6, [ps_cos_vec+64], m0
- BUTTERFLY m4, m2, [ps_cos_vec+64], m7
-
-
- ; pass 3
- vperm2f128 m3, m6, m4, 0x31
- vperm2f128 m1, m6, m4, 0x20
- vshufps m3, m3, m3, 0x1b
-
- BUTTERFLY m1, m3, [ps_cos_vec+96], m6
-
-
- vperm2f128 m4, m5, m2, 0x20
- vperm2f128 m5, m5, m2, 0x31
- vshufps m5, m5, m5, 0x1b
-
- BUTTERFLY m4, m5, [ps_cos_vec+96], m6
-
- ; pass 4
- vmovaps m6, [ps_p1p1m1m1+0]
- vmovaps m2, [ps_cos_vec+128]
-
- BUTTERFLY2 m5, m6, m2, m7
- BUTTERFLY2 m4, m6, m2, m7
- BUTTERFLY2 m1, m6, m2, m7
- BUTTERFLY2 m3, m6, m2, m7
-
-
- ; pass 5
- vshufps m6, m6, m6, 0xcc
- vmovaps m2, [ps_cos_vec+160]
-
- BUTTERFLY3 m5, m6, m2, m7
- BUTTERFLY3 m4, m6, m2, m7
- BUTTERFLY3 m1, m6, m2, m7
- BUTTERFLY3 m3, m6, m2, m7
-
- vperm2f128 m6, m3, m3, 0x31
- vmovaps [outq], m3
-
- vextractf128 [outq+64], m5, 1
- vextractf128 [outq+32], m5, 0
-
- vextractf128 [outq+80], m4, 1
- vextractf128 [outq+48], m4, 0
-
- vperm2f128 m0, m1, m1, 0x31
- vmovaps [outq+96], m1
-
- vzeroupper
-
- ; pass 6, no SIMD...
-INIT_XMM
- PASS6_AND_PERMUTE
- RET
-%endif
-
-%define BUTTERFLY BUTTERFLY_SSE
-%define BUTTERFLY0 BUTTERFLY0_SSE
-
-%ifdef ARCH_X86_64
-%define SPILL SWAP
-%define UNSPILL SWAP
-
-%macro PASS5 0
- nop ; FIXME code alignment
- SWAP 5, 8
- SWAP 4, 12
- SWAP 6, 14
- SWAP 7, 13
- SWAP 0, 15
- PERMUTE 9,10, 10,12, 11,14, 12,9, 13,11, 14,13
- TRANSPOSE4x4PS 8, 9, 10, 11, 0
- BUTTERFLY3V 8, 9, 10, 11, 0
- addps m10, m11
- TRANSPOSE4x4PS 12, 13, 14, 15, 0
- BUTTERFLY3V 12, 13, 14, 15, 0
- addps m14, m15
- addps m12, m14
- addps m14, m13
- addps m13, m15
-%endmacro
-
-%macro PASS6 0
- SWAP 9, 12
- SWAP 11, 14
- movss [outq+0x00], m8
- pshuflw m0, m8, 0xe
- movss [outq+0x10], m9
- pshuflw m1, m9, 0xe
- movss [outq+0x20], m10
- pshuflw m2, m10, 0xe
- movss [outq+0x30], m11
- pshuflw m3, m11, 0xe
- movss [outq+0x40], m12
- pshuflw m4, m12, 0xe
- movss [outq+0x50], m13
- pshuflw m5, m13, 0xe
- movss [outq+0x60], m14
- pshuflw m6, m14, 0xe
- movaps [outq+0x70], m15
- pshuflw m7, m15, 0xe
- addss m0, m1
- addss m1, m2
- movss [outq+0x08], m0
- addss m2, m3
- movss [outq+0x18], m1
- addss m3, m4
- movss [outq+0x28], m2
- addss m4, m5
- movss [outq+0x38], m3
- addss m5, m6
- movss [outq+0x48], m4
- addss m6, m7
- movss [outq+0x58], m5
- movss [outq+0x68], m6
- movss [outq+0x78], m7
-
- PERMUTE 1,8, 3,9, 5,10, 7,11, 9,12, 11,13, 13,14, 8,1, 10,3, 12,5, 14,7
- movhlps m0, m1
- pshufd m1, m1, 3
- SWAP 0, 2, 4, 6, 8, 10, 12, 14
- SWAP 1, 3, 5, 7, 9, 11, 13, 15
-%rep 7
- movhlps m0, m1
- pshufd m1, m1, 3
- addss m15, m1
- SWAP 0, 2, 4, 6, 8, 10, 12, 14
- SWAP 1, 3, 5, 7, 9, 11, 13, 15
-%endrep
-%assign i 4
-%rep 15
- addss m0, m1
- movss [outq+i], m0
- SWAP 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
- %assign i i+8
-%endrep
-%endmacro
-
-%else ; ARCH_X86_32
-%macro SPILL 2 ; xmm#, mempos
- movaps [outq+(%2-8)*16], m%1
-%endmacro
-%macro UNSPILL 2
- movaps m%1, [outq+(%2-8)*16]
-%endmacro
-
-%define PASS6 PASS6_AND_PERMUTE
-%macro PASS5 0
- movaps m2, [ps_cos_vec+160]
- shufps m3, m3, 0xcc
-
- BUTTERFLY3 m5, m3, m2, m1
- SPILL 5, 8
-
- UNSPILL 1, 9
- BUTTERFLY3 m1, m3, m2, m5
- SPILL 1, 14
-
- BUTTERFLY3 m4, m3, m2, m5
- SPILL 4, 12
-
- BUTTERFLY3 m7, m3, m2, m5
- SPILL 7, 13
-
- UNSPILL 5, 10
- BUTTERFLY3 m5, m3, m2, m7
- SPILL 5, 10
-
- UNSPILL 4, 11
- BUTTERFLY3 m4, m3, m2, m7
- SPILL 4, 11
-
- BUTTERFLY3 m6, m3, m2, m7
- SPILL 6, 9
-
- BUTTERFLY3 m0, m3, m2, m7
- SPILL 0, 15
-%endmacro
-%endif
-
-
-INIT_XMM
-%macro DCT32_FUNC 1
-; void ff_dct32_float_sse(FFTSample *out, const FFTSample *in)
-cglobal dct32_float_%1, 2,3,16, out, in, tmp
- ; pass 1
-
- movaps m0, [inq+0]
- LOAD_INV m1, [inq+112]
- BUTTERFLY m0, m1, [ps_cos_vec], m3
-
- movaps m7, [inq+64]
- LOAD_INV m4, [inq+48]
- BUTTERFLY m7, m4, [ps_cos_vec+32], m3
-
- ; pass 2
- movaps m2, [ps_cos_vec+64]
- BUTTERFLY m1, m4, m2, m3
- SPILL 1, 11
- SPILL 4, 8
-
- ; pass 1
- movaps m1, [inq+16]
- LOAD_INV m6, [inq+96]
- BUTTERFLY m1, m6, [ps_cos_vec+16], m3
-
- movaps m4, [inq+80]
- LOAD_INV m5, [inq+32]
- BUTTERFLY m4, m5, [ps_cos_vec+48], m3
-
- ; pass 2
- BUTTERFLY m0, m7, m2, m3
-
- movaps m2, [ps_cos_vec+80]
- BUTTERFLY m6, m5, m2, m3
-
- BUTTERFLY m1, m4, m2, m3
-
- ; pass 3
- movaps m2, [ps_cos_vec+96]
- shufps m1, m1, 0x1b
- BUTTERFLY m0, m1, m2, m3
- SPILL 0, 15
- SPILL 1, 14
-
- UNSPILL 0, 8
- shufps m5, m5, 0x1b
- BUTTERFLY m0, m5, m2, m3
-
- UNSPILL 1, 11
- shufps m6, m6, 0x1b
- BUTTERFLY m1, m6, m2, m3
- SPILL 1, 11
-
- shufps m4, m4, 0x1b
- BUTTERFLY m7, m4, m2, m3
-
- ; pass 4
- movaps m3, [ps_p1p1m1m1+0]
- movaps m2, [ps_cos_vec+128]
-
- BUTTERFLY2 m5, m3, m2, m1
-
- BUTTERFLY2 m0, m3, m2, m1
- SPILL 0, 9
-
- BUTTERFLY2 m6, m3, m2, m1
- SPILL 6, 10
-
- UNSPILL 0, 11
- BUTTERFLY2 m0, m3, m2, m1
- SPILL 0, 11
-
- BUTTERFLY2 m4, m3, m2, m1
-
- BUTTERFLY2 m7, m3, m2, m1
-
- UNSPILL 6, 14
- BUTTERFLY2 m6, m3, m2, m1
-
- UNSPILL 0, 15
- BUTTERFLY2 m0, m3, m2, m1
-
- PASS5
- PASS6
- RET
-%endmacro
-
-%macro LOAD_INV_SSE 2
- movaps %1, %2
- shufps %1, %1, 0x1b
-%endmacro
-
-%define LOAD_INV LOAD_INV_SSE
-DCT32_FUNC sse
-
-%macro LOAD_INV_SSE2 2
- pshufd %1, %2, 0x1b
-%endmacro
-
-%define LOAD_INV LOAD_INV_SSE2
-%define BUTTERFLY0 BUTTERFLY0_SSE2
-DCT32_FUNC sse2
diff --git a/gst-libs/ext/libav/libavcodec/x86/deinterlace.asm b/gst-libs/ext/libav/libavcodec/x86/deinterlace.asm
index 8613485..b2828f3 100644
--- a/gst-libs/ext/libav/libavcodec/x86/deinterlace.asm
+++ b/gst-libs/ext/libav/libavcodec/x86/deinterlace.asm
@@ -20,8 +20,7 @@
;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
;******************************************************************************
-%include "x86inc.asm"
-%include "x86util.asm"
+%include "libavutil/x86/x86util.asm"
SECTION_RODATA
@@ -39,7 +38,7 @@ cglobal deinterlace_line_mmx, 7,7,7, dst, lum_m4, lum_m3, lum_m2, lum_m1
%endif
pxor mm7, mm7
movq mm6, [pw_4]
-.nextrow
+.nextrow:
movd mm0, [lum_m4q]
movd mm1, [lum_m3q]
movd mm2, [lum_m2q]
diff --git a/gst-libs/ext/libav/libavcodec/x86/dnxhd_mmx.c b/gst-libs/ext/libav/libavcodec/x86/dnxhd_mmx.c
deleted file mode 100644
index e193d62..0000000
--- a/gst-libs/ext/libav/libavcodec/x86/dnxhd_mmx.c
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * VC3/DNxHD SIMD functions
- * Copyright (c) 2007 Baptiste Coudurier <baptiste dot coudurier at smartjog dot com>
- *
- * VC-3 encoder funded by the British Broadcasting Corporation
- *
- * 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
- */
-
-#include "libavutil/x86_cpu.h"
-#include "libavcodec/dnxhdenc.h"
-
-static void get_pixels_8x4_sym_sse2(DCTELEM *block, const uint8_t *pixels, int line_size)
-{
- __asm__ volatile(
- "pxor %%xmm5, %%xmm5 \n\t"
- "movq (%0), %%xmm0 \n\t"
- "add %2, %0 \n\t"
- "movq (%0), %%xmm1 \n\t"
- "movq (%0, %2), %%xmm2 \n\t"
- "movq (%0, %2,2), %%xmm3 \n\t"
- "punpcklbw %%xmm5, %%xmm0 \n\t"
- "punpcklbw %%xmm5, %%xmm1 \n\t"
- "punpcklbw %%xmm5, %%xmm2 \n\t"
- "punpcklbw %%xmm5, %%xmm3 \n\t"
- "movdqa %%xmm0, (%1) \n\t"
- "movdqa %%xmm1, 16(%1) \n\t"
- "movdqa %%xmm2, 32(%1) \n\t"
- "movdqa %%xmm3, 48(%1) \n\t"
- "movdqa %%xmm3 , 64(%1) \n\t"
- "movdqa %%xmm2 , 80(%1) \n\t"
- "movdqa %%xmm1 , 96(%1) \n\t"
- "movdqa %%xmm0, 112(%1) \n\t"
- : "+r" (pixels)
- : "r" (block), "r" ((x86_reg)line_size)
- );
-}
-
-void ff_dnxhd_init_mmx(DNXHDEncContext *ctx)
-{
- if (av_get_cpu_flags() & AV_CPU_FLAG_SSE2) {
- if (ctx->cid_table->bit_depth == 8)
- ctx->get_pixels_8x4_sym = get_pixels_8x4_sym_sse2;
- }
-}
diff --git a/gst-libs/ext/libav/libavcodec/x86/dnxhdenc.c b/gst-libs/ext/libav/libavcodec/x86/dnxhdenc.c
new file mode 100644
index 0000000..43ee246
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/x86/dnxhdenc.c
@@ -0,0 +1,65 @@
+/*
+ * VC3/DNxHD SIMD functions
+ * Copyright (c) 2007 Baptiste Coudurier <baptiste dot coudurier at smartjog dot com>
+ *
+ * VC-3 encoder funded by the British Broadcasting Corporation
+ *
+ * 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
+ */
+
+#include "libavutil/x86/asm.h"
+#include "libavcodec/dnxhdenc.h"
+
+#if HAVE_SSE2_INLINE
+
+static void get_pixels_8x4_sym_sse2(DCTELEM *block, const uint8_t *pixels, int line_size)
+{
+ __asm__ volatile(
+ "pxor %%xmm5, %%xmm5 \n\t"
+ "movq (%0), %%xmm0 \n\t"
+ "add %2, %0 \n\t"
+ "movq (%0), %%xmm1 \n\t"
+ "movq (%0, %2), %%xmm2 \n\t"
+ "movq (%0, %2,2), %%xmm3 \n\t"
+ "punpcklbw %%xmm5, %%xmm0 \n\t"
+ "punpcklbw %%xmm5, %%xmm1 \n\t"
+ "punpcklbw %%xmm5, %%xmm2 \n\t"
+ "punpcklbw %%xmm5, %%xmm3 \n\t"
+ "movdqa %%xmm0, (%1) \n\t"
+ "movdqa %%xmm1, 16(%1) \n\t"
+ "movdqa %%xmm2, 32(%1) \n\t"
+ "movdqa %%xmm3, 48(%1) \n\t"
+ "movdqa %%xmm3 , 64(%1) \n\t"
+ "movdqa %%xmm2 , 80(%1) \n\t"
+ "movdqa %%xmm1 , 96(%1) \n\t"
+ "movdqa %%xmm0, 112(%1) \n\t"
+ : "+r" (pixels)
+ : "r" (block), "r" ((x86_reg)line_size)
+ );
+}
+
+#endif /* HAVE_SSE2_INLINE */
+
+void ff_dnxhdenc_init_x86(DNXHDEncContext *ctx)
+{
+#if HAVE_SSE2_INLINE
+ if (av_get_cpu_flags() & AV_CPU_FLAG_SSE2) {
+ if (ctx->cid_table->bit_depth == 8)
+ ctx->get_pixels_8x4_sym = get_pixels_8x4_sym_sse2;
+ }
+#endif /* HAVE_SSE2_INLINE */
+}
diff --git a/gst-libs/ext/libav/libavcodec/x86/dsputil.asm b/gst-libs/ext/libav/libavcodec/x86/dsputil.asm
new file mode 100644
index 0000000..b9990bb
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/x86/dsputil.asm
@@ -0,0 +1,1016 @@
+;******************************************************************************
+;* MMX optimized DSP utils
+;* Copyright (c) 2008 Loren Merritt
+;*
+;* 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
+;******************************************************************************
+
+%include "libavutil/x86/x86util.asm"
+
+SECTION_RODATA
+pb_f: times 16 db 15
+pb_zzzzzzzz77777777: times 8 db -1
+pb_7: times 8 db 7
+pb_zzzz3333zzzzbbbb: db -1,-1,-1,-1,3,3,3,3,-1,-1,-1,-1,11,11,11,11
+pb_zz11zz55zz99zzdd: db -1,-1,1,1,-1,-1,5,5,-1,-1,9,9,-1,-1,13,13
+pb_revwords: SHUFFLE_MASK_W 7, 6, 5, 4, 3, 2, 1, 0
+pd_16384: times 4 dd 16384
+pb_bswap32: db 3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 9, 8, 15, 14, 13, 12
+
+SECTION_TEXT
+
+%macro SCALARPRODUCT 0
+; int scalarproduct_int16(int16_t *v1, int16_t *v2, int order)
+cglobal scalarproduct_int16, 3,3,3, v1, v2, order
+ shl orderq, 1
+ add v1q, orderq
+ add v2q, orderq
+ neg orderq
+ pxor m2, m2
+.loop:
+ movu m0, [v1q + orderq]
+ movu m1, [v1q + orderq + mmsize]
+ pmaddwd m0, [v2q + orderq]
+ pmaddwd m1, [v2q + orderq + mmsize]
+ paddd m2, m0
+ paddd m2, m1
+ add orderq, mmsize*2
+ jl .loop
+%if mmsize == 16
+ movhlps m0, m2
+ paddd m2, m0
+ pshuflw m0, m2, 0x4e
+%else
+ pshufw m0, m2, 0x4e
+%endif
+ paddd m2, m0
+ movd eax, m2
+ RET
+
+; int scalarproduct_and_madd_int16(int16_t *v1, int16_t *v2, int16_t *v3, int order, int mul)
+cglobal scalarproduct_and_madd_int16, 4,4,8, v1, v2, v3, order, mul
+ shl orderq, 1
+ movd m7, mulm
+%if mmsize == 16
+ pshuflw m7, m7, 0
+ punpcklqdq m7, m7
+%else
+ pshufw m7, m7, 0
+%endif
+ pxor m6, m6
+ add v1q, orderq
+ add v2q, orderq
+ add v3q, orderq
+ neg orderq
+.loop:
+ movu m0, [v2q + orderq]
+ movu m1, [v2q + orderq + mmsize]
+ mova m4, [v1q + orderq]
+ mova m5, [v1q + orderq + mmsize]
+ movu m2, [v3q + orderq]
+ movu m3, [v3q + orderq + mmsize]
+ pmaddwd m0, m4
+ pmaddwd m1, m5
+ pmullw m2, m7
+ pmullw m3, m7
+ paddd m6, m0
+ paddd m6, m1
+ paddw m2, m4
+ paddw m3, m5
+ mova [v1q + orderq], m2
+ mova [v1q + orderq + mmsize], m3
+ add orderq, mmsize*2
+ jl .loop
+%if mmsize == 16
+ movhlps m0, m6
+ paddd m6, m0
+ pshuflw m0, m6, 0x4e
+%else
+ pshufw m0, m6, 0x4e
+%endif
+ paddd m6, m0
+ movd eax, m6
+ RET
+%endmacro
+
+INIT_MMX mmxext
+SCALARPRODUCT
+INIT_XMM sse2
+SCALARPRODUCT
+
+%macro SCALARPRODUCT_LOOP 1
+align 16
+.loop%1:
+ sub orderq, mmsize*2
+%if %1
+ mova m1, m4
+ mova m4, [v2q + orderq]
+ mova m0, [v2q + orderq + mmsize]
+ palignr m1, m0, %1
+ palignr m0, m4, %1
+ mova m3, m5
+ mova m5, [v3q + orderq]
+ mova m2, [v3q + orderq + mmsize]
+ palignr m3, m2, %1
+ palignr m2, m5, %1
+%else
+ mova m0, [v2q + orderq]
+ mova m1, [v2q + orderq + mmsize]
+ mova m2, [v3q + orderq]
+ mova m3, [v3q + orderq + mmsize]
+%endif
+ %define t0 [v1q + orderq]
+ %define t1 [v1q + orderq + mmsize]
+%if ARCH_X86_64
+ mova m8, t0
+ mova m9, t1
+ %define t0 m8
+ %define t1 m9
+%endif
+ pmaddwd m0, t0
+ pmaddwd m1, t1
+ pmullw m2, m7
+ pmullw m3, m7
+ paddw m2, t0
+ paddw m3, t1
+ paddd m6, m0
+ paddd m6, m1
+ mova [v1q + orderq], m2
+ mova [v1q + orderq + mmsize], m3
+ jg .loop%1
+%if %1
+ jmp .end
+%endif
+%endmacro
+
+; int scalarproduct_and_madd_int16(int16_t *v1, int16_t *v2, int16_t *v3, int order, int mul)
+INIT_XMM ssse3
+cglobal scalarproduct_and_madd_int16, 4,5,10, v1, v2, v3, order, mul
+ shl orderq, 1
+ movd m7, mulm
+ pshuflw m7, m7, 0
+ punpcklqdq m7, m7
+ pxor m6, m6
+ mov r4d, v2d
+ and r4d, 15
+ and v2q, ~15
+ and v3q, ~15
+ mova m4, [v2q + orderq]
+ mova m5, [v3q + orderq]
+ ; linear is faster than branch tree or jump table, because the branches taken are cyclic (i.e. predictable)
+ cmp r4d, 0
+ je .loop0
+ cmp r4d, 2
+ je .loop2
+ cmp r4d, 4
+ je .loop4
+ cmp r4d, 6
+ je .loop6
+ cmp r4d, 8
+ je .loop8
+ cmp r4d, 10
+ je .loop10
+ cmp r4d, 12
+ je .loop12
+SCALARPRODUCT_LOOP 14
+SCALARPRODUCT_LOOP 12
+SCALARPRODUCT_LOOP 10
+SCALARPRODUCT_LOOP 8
+SCALARPRODUCT_LOOP 6
+SCALARPRODUCT_LOOP 4
+SCALARPRODUCT_LOOP 2
+SCALARPRODUCT_LOOP 0
+.end:
+ movhlps m0, m6
+ paddd m6, m0
+ pshuflw m0, m6, 0x4e
+ paddd m6, m0
+ movd eax, m6
+ RET
+
+
+;-----------------------------------------------------------------------------
+; void ff_apply_window_int16(int16_t *output, const int16_t *input,
+; const int16_t *window, unsigned int len)
+;-----------------------------------------------------------------------------
+
+%macro REVERSE_WORDS 1-2
+%if cpuflag(ssse3) && notcpuflag(atom)
+ pshufb %1, %2
+%elif cpuflag(sse2)
+ pshuflw %1, %1, 0x1B
+ pshufhw %1, %1, 0x1B
+ pshufd %1, %1, 0x4E
+%elif cpuflag(mmxext)
+ pshufw %1, %1, 0x1B
+%endif
+%endmacro
+
+%macro MUL16FIXED 3
+%if cpuflag(ssse3) ; dst, src, unused
+; dst = ((dst * src) + (1<<14)) >> 15
+ pmulhrsw %1, %2
+%elif cpuflag(mmxext) ; dst, src, temp
+; dst = (dst * src) >> 15
+; pmulhw cuts off the bottom bit, so we have to lshift by 1 and add it back
+; in from the pmullw result.
+ mova %3, %1
+ pmulhw %1, %2
+ pmullw %3, %2
+ psrlw %3, 15
+ psllw %1, 1
+ por %1, %3
+%endif
+%endmacro
+
+%macro APPLY_WINDOW_INT16 1 ; %1 bitexact version
+%if %1
+cglobal apply_window_int16, 4,5,6, output, input, window, offset, offset2
+%else
+cglobal apply_window_int16_round, 4,5,6, output, input, window, offset, offset2
+%endif
+ lea offset2q, [offsetq-mmsize]
+%if cpuflag(ssse3) && notcpuflag(atom)
+ mova m5, [pb_revwords]
+ ALIGN 16
+%elif %1
+ mova m5, [pd_16384]
+%endif
+.loop:
+%if cpuflag(ssse3)
+ ; This version does the 16x16->16 multiplication in-place without expanding
+ ; to 32-bit. The ssse3 version is bit-identical.
+ mova m0, [windowq+offset2q]
+ mova m1, [ inputq+offset2q]
+ pmulhrsw m1, m0
+ REVERSE_WORDS m0, m5
+ pmulhrsw m0, [ inputq+offsetq ]
+ mova [outputq+offset2q], m1
+ mova [outputq+offsetq ], m0
+%elif %1
+ ; This version expands 16-bit to 32-bit, multiplies by the window,
+ ; adds 16384 for rounding, right shifts 15, then repacks back to words to
+ ; save to the output. The window is reversed for the second half.
+ mova m3, [windowq+offset2q]
+ mova m4, [ inputq+offset2q]
+ pxor m0, m0
+ punpcklwd m0, m3
+ punpcklwd m1, m4
+ pmaddwd m0, m1
+ paddd m0, m5
+ psrad m0, 15
+ pxor m2, m2
+ punpckhwd m2, m3
+ punpckhwd m1, m4
+ pmaddwd m2, m1
+ paddd m2, m5
+ psrad m2, 15
+ packssdw m0, m2
+ mova [outputq+offset2q], m0
+ REVERSE_WORDS m3
+ mova m4, [ inputq+offsetq]
+ pxor m0, m0
+ punpcklwd m0, m3
+ punpcklwd m1, m4
+ pmaddwd m0, m1
+ paddd m0, m5
+ psrad m0, 15
+ pxor m2, m2
+ punpckhwd m2, m3
+ punpckhwd m1, m4
+ pmaddwd m2, m1
+ paddd m2, m5
+ psrad m2, 15
+ packssdw m0, m2
+ mova [outputq+offsetq], m0
+%else
+ ; This version does the 16x16->16 multiplication in-place without expanding
+ ; to 32-bit. The mmxext and sse2 versions do not use rounding, and
+ ; therefore are not bit-identical to the C version.
+ mova m0, [windowq+offset2q]
+ mova m1, [ inputq+offset2q]
+ mova m2, [ inputq+offsetq ]
+ MUL16FIXED m1, m0, m3
+ REVERSE_WORDS m0
+ MUL16FIXED m2, m0, m3
+ mova [outputq+offset2q], m1
+ mova [outputq+offsetq ], m2
+%endif
+ add offsetd, mmsize
+ sub offset2d, mmsize
+ jae .loop
+ REP_RET
+%endmacro
+
+INIT_MMX mmxext
+APPLY_WINDOW_INT16 0
+INIT_XMM sse2
+APPLY_WINDOW_INT16 0
+
+INIT_MMX mmxext
+APPLY_WINDOW_INT16 1
+INIT_XMM sse2
+APPLY_WINDOW_INT16 1
+INIT_XMM ssse3
+APPLY_WINDOW_INT16 1
+INIT_XMM ssse3, atom
+APPLY_WINDOW_INT16 1
+
+
+; void add_hfyu_median_prediction_mmxext(uint8_t *dst, const uint8_t *top, const uint8_t *diff, int w, int *left, int *left_top)
+INIT_MMX mmxext
+cglobal add_hfyu_median_prediction, 6,6,0, dst, top, diff, w, left, left_top
+ movq mm0, [topq]
+ movq mm2, mm0
+ movd mm4, [left_topq]
+ psllq mm2, 8
+ movq mm1, mm0
+ por mm4, mm2
+ movd mm3, [leftq]
+ psubb mm0, mm4 ; t-tl
+ add dstq, wq
+ add topq, wq
+ add diffq, wq
+ neg wq
+ jmp .skip
+.loop:
+ movq mm4, [topq+wq]
+ movq mm0, mm4
+ psllq mm4, 8
+ por mm4, mm1
+ movq mm1, mm0 ; t
+ psubb mm0, mm4 ; t-tl
+.skip:
+ movq mm2, [diffq+wq]
+%assign i 0
+%rep 8
+ movq mm4, mm0
+ paddb mm4, mm3 ; t-tl+l
+ movq mm5, mm3
+ pmaxub mm3, mm1
+ pminub mm5, mm1
+ pminub mm3, mm4
+ pmaxub mm3, mm5 ; median
+ paddb mm3, mm2 ; +residual
+%if i==0
+ movq mm7, mm3
+ psllq mm7, 56
+%else
+ movq mm6, mm3
+ psrlq mm7, 8
+ psllq mm6, 56
+ por mm7, mm6
+%endif
+%if i<7
+ psrlq mm0, 8
+ psrlq mm1, 8
+ psrlq mm2, 8
+%endif
+%assign i i+1
+%endrep
+ movq [dstq+wq], mm7
+ add wq, 8
+ jl .loop
+ movzx r2d, byte [dstq-1]
+ mov [leftq], r2d
+ movzx r2d, byte [topq-1]
+ mov [left_topq], r2d
+ RET
+
+
+%macro ADD_HFYU_LEFT_LOOP 2 ; %1 = dst_is_aligned, %2 = src_is_aligned
+ add srcq, wq
+ add dstq, wq
+ neg wq
+%%.loop:
+%if %2
+ mova m1, [srcq+wq]
+%else
+ movu m1, [srcq+wq]
+%endif
+ mova m2, m1
+ psllw m1, 8
+ paddb m1, m2
+ mova m2, m1
+ pshufb m1, m3
+ paddb m1, m2
+ pshufb m0, m5
+ mova m2, m1
+ pshufb m1, m4
+ paddb m1, m2
+%if mmsize == 16
+ mova m2, m1
+ pshufb m1, m6
+ paddb m1, m2
+%endif
+ paddb m0, m1
+%if %1
+ mova [dstq+wq], m0
+%else
+ movq [dstq+wq], m0
+ movhps [dstq+wq+8], m0
+%endif
+ add wq, mmsize
+ jl %%.loop
+ mov eax, mmsize-1
+ sub eax, wd
+ movd m1, eax
+ pshufb m0, m1
+ movd eax, m0
+ RET
+%endmacro
+
+; int add_hfyu_left_prediction(uint8_t *dst, const uint8_t *src, int w, int left)
+INIT_MMX ssse3
+cglobal add_hfyu_left_prediction, 3,3,7, dst, src, w, left
+.skip_prologue:
+ mova m5, [pb_7]
+ mova m4, [pb_zzzz3333zzzzbbbb]
+ mova m3, [pb_zz11zz55zz99zzdd]
+ movd m0, leftm
+ psllq m0, 56
+ ADD_HFYU_LEFT_LOOP 1, 1
+
+INIT_XMM sse4
+cglobal add_hfyu_left_prediction, 3,3,7, dst, src, w, left
+ mova m5, [pb_f]
+ mova m6, [pb_zzzzzzzz77777777]
+ mova m4, [pb_zzzz3333zzzzbbbb]
+ mova m3, [pb_zz11zz55zz99zzdd]
+ movd m0, leftm
+ pslldq m0, 15
+ test srcq, 15
+ jnz .src_unaligned
+ test dstq, 15
+ jnz .dst_unaligned
+ ADD_HFYU_LEFT_LOOP 1, 1
+.dst_unaligned:
+ ADD_HFYU_LEFT_LOOP 0, 1
+.src_unaligned:
+ ADD_HFYU_LEFT_LOOP 0, 0
+
+
+; float scalarproduct_float_sse(const float *v1, const float *v2, int len)
+INIT_XMM sse
+cglobal scalarproduct_float, 3,3,2, v1, v2, offset
+ neg offsetq
+ shl offsetq, 2
+ sub v1q, offsetq
+ sub v2q, offsetq
+ xorps xmm0, xmm0
+ .loop:
+ movaps xmm1, [v1q+offsetq]
+ mulps xmm1, [v2q+offsetq]
+ addps xmm0, xmm1
+ add offsetq, 16
+ js .loop
+ movhlps xmm1, xmm0
+ addps xmm0, xmm1
+ movss xmm1, xmm0
+ shufps xmm0, xmm0, 1
+ addss xmm0, xmm1
+%if ARCH_X86_64 == 0
+ movss r0m, xmm0
+ fld dword r0m
+%endif
+ RET
+
+;-----------------------------------------------------------------------------
+; void ff_vector_clip_int32(int32_t *dst, const int32_t *src, int32_t min,
+; int32_t max, unsigned int len)
+;-----------------------------------------------------------------------------
+
+; %1 = number of xmm registers used
+; %2 = number of inline load/process/store loops per asm loop
+; %3 = process 4*mmsize (%3=0) or 8*mmsize (%3=1) bytes per loop
+; %4 = CLIPD function takes min/max as float instead of int (CLIPD_SSE2)
+; %5 = suffix
+%macro VECTOR_CLIP_INT32 4-5
+cglobal vector_clip_int32%5, 5,5,%1, dst, src, min, max, len
+%if %4
+ cvtsi2ss m4, minm
+ cvtsi2ss m5, maxm
+%else
+ movd m4, minm
+ movd m5, maxm
+%endif
+ SPLATD m4
+ SPLATD m5
+.loop:
+%assign %%i 1
+%rep %2
+ mova m0, [srcq+mmsize*0*%%i]
+ mova m1, [srcq+mmsize*1*%%i]
+ mova m2, [srcq+mmsize*2*%%i]
+ mova m3, [srcq+mmsize*3*%%i]
+%if %3
+ mova m7, [srcq+mmsize*4*%%i]
+ mova m8, [srcq+mmsize*5*%%i]
+ mova m9, [srcq+mmsize*6*%%i]
+ mova m10, [srcq+mmsize*7*%%i]
+%endif
+ CLIPD m0, m4, m5, m6
+ CLIPD m1, m4, m5, m6
+ CLIPD m2, m4, m5, m6
+ CLIPD m3, m4, m5, m6
+%if %3
+ CLIPD m7, m4, m5, m6
+ CLIPD m8, m4, m5, m6
+ CLIPD m9, m4, m5, m6
+ CLIPD m10, m4, m5, m6
+%endif
+ mova [dstq+mmsize*0*%%i], m0
+ mova [dstq+mmsize*1*%%i], m1
+ mova [dstq+mmsize*2*%%i], m2
+ mova [dstq+mmsize*3*%%i], m3
+%if %3
+ mova [dstq+mmsize*4*%%i], m7
+ mova [dstq+mmsize*5*%%i], m8
+ mova [dstq+mmsize*6*%%i], m9
+ mova [dstq+mmsize*7*%%i], m10
+%endif
+%assign %%i %%i+1
+%endrep
+ add srcq, mmsize*4*(%2+%3)
+ add dstq, mmsize*4*(%2+%3)
+ sub lend, mmsize*(%2+%3)
+ jg .loop
+ REP_RET
+%endmacro
+
+INIT_MMX mmx
+%define CLIPD CLIPD_MMX
+VECTOR_CLIP_INT32 0, 1, 0, 0
+INIT_XMM sse2
+VECTOR_CLIP_INT32 6, 1, 0, 0, _int
+%define CLIPD CLIPD_SSE2
+VECTOR_CLIP_INT32 6, 2, 0, 1
+INIT_XMM sse4
+%define CLIPD CLIPD_SSE41
+%ifdef m8
+VECTOR_CLIP_INT32 11, 1, 1, 0
+%else
+VECTOR_CLIP_INT32 6, 1, 0, 0
+%endif
+
+;-----------------------------------------------------------------------------
+; void vector_fmul_reverse(float *dst, const float *src0, const float *src1,
+; int len)
+;-----------------------------------------------------------------------------
+%macro VECTOR_FMUL_REVERSE 0
+cglobal vector_fmul_reverse, 4,4,2, dst, src0, src1, len
+ lea lenq, [lend*4 - 2*mmsize]
+ALIGN 16
+.loop:
+%if cpuflag(avx)
+ vmovaps xmm0, [src1q + 16]
+ vinsertf128 m0, m0, [src1q], 1
+ vshufps m0, m0, m0, q0123
+ vmovaps xmm1, [src1q + mmsize + 16]
+ vinsertf128 m1, m1, [src1q + mmsize], 1
+ vshufps m1, m1, m1, q0123
+%else
+ mova m0, [src1q]
+ mova m1, [src1q + mmsize]
+ shufps m0, m0, q0123
+ shufps m1, m1, q0123
+%endif
+ mulps m0, m0, [src0q + lenq + mmsize]
+ mulps m1, m1, [src0q + lenq]
+ mova [dstq + lenq + mmsize], m0
+ mova [dstq + lenq], m1
+ add src1q, 2*mmsize
+ sub lenq, 2*mmsize
+ jge .loop
+ REP_RET
+%endmacro
+
+INIT_XMM sse
+VECTOR_FMUL_REVERSE
+INIT_YMM avx
+VECTOR_FMUL_REVERSE
+
+;-----------------------------------------------------------------------------
+; vector_fmul_add(float *dst, const float *src0, const float *src1,
+; const float *src2, int len)
+;-----------------------------------------------------------------------------
+%macro VECTOR_FMUL_ADD 0
+cglobal vector_fmul_add, 5,5,2, dst, src0, src1, src2, len
+ lea lenq, [lend*4 - 2*mmsize]
+ALIGN 16
+.loop:
+ mova m0, [src0q + lenq]
+ mova m1, [src0q + lenq + mmsize]
+ mulps m0, m0, [src1q + lenq]
+ mulps m1, m1, [src1q + lenq + mmsize]
+ addps m0, m0, [src2q + lenq]
+ addps m1, m1, [src2q + lenq + mmsize]
+ mova [dstq + lenq], m0
+ mova [dstq + lenq + mmsize], m1
+
+ sub lenq, 2*mmsize
+ jge .loop
+ REP_RET
+%endmacro
+
+INIT_XMM sse
+VECTOR_FMUL_ADD
+INIT_YMM avx
+VECTOR_FMUL_ADD
+
+;-----------------------------------------------------------------------------
+; void ff_butterflies_float_interleave(float *dst, const float *src0,
+; const float *src1, int len);
+;-----------------------------------------------------------------------------
+
+%macro BUTTERFLIES_FLOAT_INTERLEAVE 0
+cglobal butterflies_float_interleave, 4,4,3, dst, src0, src1, len
+%if ARCH_X86_64
+ movsxd lenq, lend
+%endif
+ test lenq, lenq
+ jz .end
+ shl lenq, 2
+ lea src0q, [src0q + lenq]
+ lea src1q, [src1q + lenq]
+ lea dstq, [ dstq + 2*lenq]
+ neg lenq
+.loop:
+ mova m0, [src0q + lenq]
+ mova m1, [src1q + lenq]
+ subps m2, m0, m1
+ addps m0, m0, m1
+ unpcklps m1, m0, m2
+ unpckhps m0, m0, m2
+%if cpuflag(avx)
+ vextractf128 [dstq + 2*lenq ], m1, 0
+ vextractf128 [dstq + 2*lenq + 16], m0, 0
+ vextractf128 [dstq + 2*lenq + 32], m1, 1
+ vextractf128 [dstq + 2*lenq + 48], m0, 1
+%else
+ mova [dstq + 2*lenq ], m1
+ mova [dstq + 2*lenq + mmsize], m0
+%endif
+ add lenq, mmsize
+ jl .loop
+.end:
+ REP_RET
+%endmacro
+
+INIT_XMM sse
+BUTTERFLIES_FLOAT_INTERLEAVE
+INIT_YMM avx
+BUTTERFLIES_FLOAT_INTERLEAVE
+
+; %1 = aligned/unaligned
+%macro BSWAP_LOOPS 1
+ mov r3, r2
+ sar r2, 3
+ jz .left4_%1
+.loop8_%1:
+ mov%1 m0, [r1 + 0]
+ mov%1 m1, [r1 + 16]
+%if cpuflag(ssse3)
+ pshufb m0, m2
+ pshufb m1, m2
+ mova [r0 + 0], m0
+ mova [r0 + 16], m1
+%else
+ pshuflw m0, m0, 10110001b
+ pshuflw m1, m1, 10110001b
+ pshufhw m0, m0, 10110001b
+ pshufhw m1, m1, 10110001b
+ mova m2, m0
+ mova m3, m1
+ psllw m0, 8
+ psllw m1, 8
+ psrlw m2, 8
+ psrlw m3, 8
+ por m2, m0
+ por m3, m1
+ mova [r0 + 0], m2
+ mova [r0 + 16], m3
+%endif
+ add r0, 32
+ add r1, 32
+ dec r2
+ jnz .loop8_%1
+.left4_%1:
+ mov r2, r3
+ and r3, 4
+ jz .left
+ mov%1 m0, [r1]
+%if cpuflag(ssse3)
+ pshufb m0, m2
+ mova [r0], m0
+%else
+ pshuflw m0, m0, 10110001b
+ pshufhw m0, m0, 10110001b
+ mova m2, m0
+ psllw m0, 8
+ psrlw m2, 8
+ por m2, m0
+ mova [r0], m2
+%endif
+ add r1, 16
+ add r0, 16
+%endmacro
+
+; void bswap_buf(uint32_t *dst, const uint32_t *src, int w);
+%macro BSWAP32_BUF 0
+%if cpuflag(ssse3)
+cglobal bswap32_buf, 3,4,3
+ mov r3, r1
+ mova m2, [pb_bswap32]
+%else
+cglobal bswap32_buf, 3,4,5
+ mov r3, r1
+%endif
+ and r3, 15
+ jz .start_align
+ BSWAP_LOOPS u
+ jmp .left
+.start_align:
+ BSWAP_LOOPS a
+.left:
+%if cpuflag(ssse3)
+ mov r3, r2
+ and r2, 2
+ jz .left1
+ movq m0, [r1]
+ pshufb m0, m2
+ movq [r0], m0
+ add r1, 8
+ add r0, 8
+.left1:
+ and r3, 1
+ jz .end
+ mov r2d, [r1]
+ bswap r2d
+ mov [r0], r2d
+%else
+ and r2, 3
+ jz .end
+.loop2:
+ mov r3d, [r1]
+ bswap r3d
+ mov [r0], r3d
+ add r1, 4
+ add r0, 4
+ dec r2
+ jnz .loop2
+%endif
+.end:
+ RET
+%endmacro
+
+INIT_XMM sse2
+BSWAP32_BUF
+
+INIT_XMM ssse3
+BSWAP32_BUF
+
+%macro op_avgh 3
+ movh %3, %2
+ pavgb %1, %3
+ movh %2, %1
+%endmacro
+
+%macro op_avg 2
+ pavgb %1, %2
+ mova %2, %1
+%endmacro
+
+%macro op_puth 2-3
+ movh %2, %1
+%endmacro
+
+%macro op_put 2
+ mova %2, %1
+%endmacro
+
+; void pixels4_l2_mmxext(uint8_t *dst, uint8_t *src1, uint8_t *src2, int dstStride, int src1Stride, int h)
+%macro PIXELS4_L2 1
+%define OP op_%1h
+cglobal %1_pixels4_l2, 6,6
+ movsxdifnidn r3, r3d
+ movsxdifnidn r4, r4d
+ test r5d, 1
+ je .loop
+ movd m0, [r1]
+ movd m1, [r2]
+ add r1, r4
+ add r2, 4
+ pavgb m0, m1
+ OP m0, [r0], m3
+ add r0, r3
+ dec r5d
+.loop:
+ mova m0, [r1]
+ mova m1, [r1+r4]
+ lea r1, [r1+2*r4]
+ pavgb m0, [r2]
+ pavgb m1, [r2+4]
+ OP m0, [r0], m3
+ OP m1, [r0+r3], m3
+ lea r0, [r0+2*r3]
+ mova m0, [r1]
+ mova m1, [r1+r4]
+ lea r1, [r1+2*r4]
+ pavgb m0, [r2+8]
+ pavgb m1, [r2+12]
+ OP m0, [r0], m3
+ OP m1, [r0+r3], m3
+ lea r0, [r0+2*r3]
+ add r2, 16
+ sub r5d, 4
+ jne .loop
+ REP_RET
+%endmacro
+
+INIT_MMX mmxext
+PIXELS4_L2 put
+PIXELS4_L2 avg
+
+; void pixels8_l2_mmxext(uint8_t *dst, uint8_t *src1, uint8_t *src2, int dstStride, int src1Stride, int h)
+%macro PIXELS8_L2 1
+%define OP op_%1
+cglobal %1_pixels8_l2, 6,6
+ movsxdifnidn r3, r3d
+ movsxdifnidn r4, r4d
+ test r5d, 1
+ je .loop
+ mova m0, [r1]
+ mova m1, [r2]
+ add r1, r4
+ add r2, 8
+ pavgb m0, m1
+ OP m0, [r0]
+ add r0, r3
+ dec r5d
+.loop:
+ mova m0, [r1]
+ mova m1, [r1+r4]
+ lea r1, [r1+2*r4]
+ pavgb m0, [r2]
+ pavgb m1, [r2+8]
+ OP m0, [r0]
+ OP m1, [r0+r3]
+ lea r0, [r0+2*r3]
+ mova m0, [r1]
+ mova m1, [r1+r4]
+ lea r1, [r1+2*r4]
+ pavgb m0, [r2+16]
+ pavgb m1, [r2+24]
+ OP m0, [r0]
+ OP m1, [r0+r3]
+ lea r0, [r0+2*r3]
+ add r2, 32
+ sub r5d, 4
+ jne .loop
+ REP_RET
+%endmacro
+
+INIT_MMX mmxext
+PIXELS8_L2 put
+PIXELS8_L2 avg
+
+; void pixels16_l2_mmxext(uint8_t *dst, uint8_t *src1, uint8_t *src2, int dstStride, int src1Stride, int h)
+%macro PIXELS16_L2 1
+%define OP op_%1
+cglobal %1_pixels16_l2, 6,6
+ movsxdifnidn r3, r3d
+ movsxdifnidn r4, r4d
+ test r5d, 1
+ je .loop
+ mova m0, [r1]
+ mova m1, [r1+8]
+ pavgb m0, [r2]
+ pavgb m1, [r2+8]
+ add r1, r4
+ add r2, 16
+ OP m0, [r0]
+ OP m1, [r0+8]
+ add r0, r3
+ dec r5d
+.loop:
+ mova m0, [r1]
+ mova m1, [r1+8]
+ add r1, r4
+ pavgb m0, [r2]
+ pavgb m1, [r2+8]
+ OP m0, [r0]
+ OP m1, [r0+8]
+ add r0, r3
+ mova m0, [r1]
+ mova m1, [r1+8]
+ add r1, r4
+ pavgb m0, [r2+16]
+ pavgb m1, [r2+24]
+ OP m0, [r0]
+ OP m1, [r0+8]
+ add r0, r3
+ add r2, 32
+ sub r5d, 2
+ jne .loop
+ REP_RET
+%endmacro
+
+INIT_MMX mmxext
+PIXELS16_L2 put
+PIXELS16_L2 avg
+
+INIT_MMX mmxext
+; void pixels(uint8_t *block, const uint8_t *pixels, int line_size, int h)
+%macro PIXELS48 2
+%if %2 == 4
+%define OP movh
+%else
+%define OP mova
+%endif
+cglobal %1_pixels%2, 4,5
+ movsxdifnidn r2, r2d
+ lea r4, [r2*3]
+.loop:
+ OP m0, [r1]
+ OP m1, [r1+r2]
+ OP m2, [r1+r2*2]
+ OP m3, [r1+r4]
+ lea r1, [r1+r2*4]
+%ifidn %1, avg
+ pavgb m0, [r0]
+ pavgb m1, [r0+r2]
+ pavgb m2, [r0+r2*2]
+ pavgb m3, [r0+r4]
+%endif
+ OP [r0], m0
+ OP [r0+r2], m1
+ OP [r0+r2*2], m2
+ OP [r0+r4], m3
+ sub r3d, 4
+ lea r0, [r0+r2*4]
+ jne .loop
+ RET
+%endmacro
+
+PIXELS48 put, 4
+PIXELS48 avg, 4
+PIXELS48 put, 8
+PIXELS48 avg, 8
+
+INIT_XMM sse2
+; void put_pixels16_sse2(uint8_t *block, const uint8_t *pixels, int line_size, int h)
+cglobal put_pixels16, 4,5,4
+ movsxdifnidn r2, r2d
+ lea r4, [r2*3]
+.loop:
+ movu m0, [r1]
+ movu m1, [r1+r2]
+ movu m2, [r1+r2*2]
+ movu m3, [r1+r4]
+ lea r1, [r1+r2*4]
+ mova [r0], m0
+ mova [r0+r2], m1
+ mova [r0+r2*2], m2
+ mova [r0+r4], m3
+ sub r3d, 4
+ lea r0, [r0+r2*4]
+ jnz .loop
+ REP_RET
+
+; void avg_pixels16_sse2(uint8_t *block, const uint8_t *pixels, int line_size, int h)
+cglobal avg_pixels16, 4,5,4
+ movsxdifnidn r2, r2d
+ lea r4, [r2*3]
+.loop:
+ movu m0, [r1]
+ movu m1, [r1+r2]
+ movu m2, [r1+r2*2]
+ movu m3, [r1+r4]
+ lea r1, [r1+r2*4]
+ pavgb m0, [r0]
+ pavgb m1, [r0+r2]
+ pavgb m2, [r0+r2*2]
+ pavgb m3, [r0+r4]
+ mova [r0], m0
+ mova [r0+r2], m1
+ mova [r0+r2*2], m2
+ mova [r0+r4], m3
+ sub r3d, 4
+ lea r0, [r0+r2*4]
+ jnz .loop
+ REP_RET
diff --git a/gst-libs/ext/libav/libavcodec/x86/dsputil_avg_template.c b/gst-libs/ext/libav/libavcodec/x86/dsputil_avg_template.c
new file mode 100644
index 0000000..1a4343d
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/x86/dsputil_avg_template.c
@@ -0,0 +1,855 @@
+/*
+ * DSP utils : average functions are compiled twice for 3dnow/mmxext
+ * Copyright (c) 2000, 2001 Fabrice Bellard
+ * Copyright (c) 2002-2004 Michael Niedermayer
+ *
+ * MMX optimization by Nick Kurshev <nickols_k@mail.ru>
+ * mostly rewritten by Michael Niedermayer <michaelni@gmx.at>
+ * and improved by Zdenek Kabelac <kabi@users.sf.net>
+ *
+ * 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
+ */
+
+/* XXX: we use explicit registers to avoid a gcc 2.95.2 register asm
+ clobber bug - now it will work with 2.95.2 and also with -fPIC
+ */
+static void DEF(put_pixels8_x2)(uint8_t *block, const uint8_t *pixels, int line_size, int h)
+{
+ __asm__ volatile(
+ "lea (%3, %3), %%"REG_a" \n\t"
+ "1: \n\t"
+ "movq (%1), %%mm0 \n\t"
+ "movq (%1, %3), %%mm1 \n\t"
+ PAVGB" 1(%1), %%mm0 \n\t"
+ PAVGB" 1(%1, %3), %%mm1 \n\t"
+ "movq %%mm0, (%2) \n\t"
+ "movq %%mm1, (%2, %3) \n\t"
+ "add %%"REG_a", %1 \n\t"
+ "add %%"REG_a", %2 \n\t"
+ "movq (%1), %%mm0 \n\t"
+ "movq (%1, %3), %%mm1 \n\t"
+ PAVGB" 1(%1), %%mm0 \n\t"
+ PAVGB" 1(%1, %3), %%mm1 \n\t"
+ "add %%"REG_a", %1 \n\t"
+ "movq %%mm0, (%2) \n\t"
+ "movq %%mm1, (%2, %3) \n\t"
+ "add %%"REG_a", %2 \n\t"
+ "subl $4, %0 \n\t"
+ "jnz 1b \n\t"
+ :"+g"(h), "+S"(pixels), "+D"(block)
+ :"r" ((x86_reg)line_size)
+ :"%"REG_a, "memory");
+}
+
+#ifndef SKIP_FOR_3DNOW
+static void DEF(put_pixels8_l2)(uint8_t *dst, uint8_t *src1, uint8_t *src2, int dstStride, int src1Stride, int h)
+{
+ __asm__ volatile(
+ "testl $1, %0 \n\t"
+ " jz 1f \n\t"
+ "movq (%1), %%mm0 \n\t"
+ "movq (%2), %%mm1 \n\t"
+ "add %4, %1 \n\t"
+ "add $8, %2 \n\t"
+ PAVGB" %%mm1, %%mm0 \n\t"
+ "movq %%mm0, (%3) \n\t"
+ "add %5, %3 \n\t"
+ "decl %0 \n\t"
+ "1: \n\t"
+ "movq (%1), %%mm0 \n\t"
+ "add %4, %1 \n\t"
+ "movq (%1), %%mm1 \n\t"
+ "add %4, %1 \n\t"
+ PAVGB" (%2), %%mm0 \n\t"
+ PAVGB" 8(%2), %%mm1 \n\t"
+ "movq %%mm0, (%3) \n\t"
+ "add %5, %3 \n\t"
+ "movq %%mm1, (%3) \n\t"
+ "add %5, %3 \n\t"
+ "movq (%1), %%mm0 \n\t"
+ "add %4, %1 \n\t"
+ "movq (%1), %%mm1 \n\t"
+ "add %4, %1 \n\t"
+ PAVGB" 16(%2), %%mm0 \n\t"
+ PAVGB" 24(%2), %%mm1 \n\t"
+ "movq %%mm0, (%3) \n\t"
+ "add %5, %3 \n\t"
+ "movq %%mm1, (%3) \n\t"
+ "add %5, %3 \n\t"
+ "add $32, %2 \n\t"
+ "subl $4, %0 \n\t"
+ "jnz 1b \n\t"
+#if !HAVE_EBX_AVAILABLE //Note "+bm" and "+mb" are buggy too (with gcc 3.2.2 at least) and cannot be used
+ :"+m"(h), "+a"(src1), "+c"(src2), "+d"(dst)
+#else
+ :"+b"(h), "+a"(src1), "+c"(src2), "+d"(dst)
+#endif
+ :"S"((x86_reg)src1Stride), "D"((x86_reg)dstStride)
+ :"memory");
+//the following should be used, though better not with gcc ...
+/* :"+g"(h), "+r"(src1), "+r"(src2), "+r"(dst)
+ :"r"(src1Stride), "r"(dstStride)
+ :"memory");*/
+}
+
+static void DEF(put_no_rnd_pixels8_l2)(uint8_t *dst, uint8_t *src1, uint8_t *src2, int dstStride, int src1Stride, int h)
+{
+ __asm__ volatile(
+ "pcmpeqb %%mm6, %%mm6 \n\t"
+ "testl $1, %0 \n\t"
+ " jz 1f \n\t"
+ "movq (%1), %%mm0 \n\t"
+ "movq (%2), %%mm1 \n\t"
+ "add %4, %1 \n\t"
+ "add $8, %2 \n\t"
+ "pxor %%mm6, %%mm0 \n\t"
+ "pxor %%mm6, %%mm1 \n\t"
+ PAVGB" %%mm1, %%mm0 \n\t"
+ "pxor %%mm6, %%mm0 \n\t"
+ "movq %%mm0, (%3) \n\t"
+ "add %5, %3 \n\t"
+ "decl %0 \n\t"
+ "1: \n\t"
+ "movq (%1), %%mm0 \n\t"
+ "add %4, %1 \n\t"
+ "movq (%1), %%mm1 \n\t"
+ "add %4, %1 \n\t"
+ "movq (%2), %%mm2 \n\t"
+ "movq 8(%2), %%mm3 \n\t"
+ "pxor %%mm6, %%mm0 \n\t"
+ "pxor %%mm6, %%mm1 \n\t"
+ "pxor %%mm6, %%mm2 \n\t"
+ "pxor %%mm6, %%mm3 \n\t"
+ PAVGB" %%mm2, %%mm0 \n\t"
+ PAVGB" %%mm3, %%mm1 \n\t"
+ "pxor %%mm6, %%mm0 \n\t"
+ "pxor %%mm6, %%mm1 \n\t"
+ "movq %%mm0, (%3) \n\t"
+ "add %5, %3 \n\t"
+ "movq %%mm1, (%3) \n\t"
+ "add %5, %3 \n\t"
+ "movq (%1), %%mm0 \n\t"
+ "add %4, %1 \n\t"
+ "movq (%1), %%mm1 \n\t"
+ "add %4, %1 \n\t"
+ "movq 16(%2), %%mm2 \n\t"
+ "movq 24(%2), %%mm3 \n\t"
+ "pxor %%mm6, %%mm0 \n\t"
+ "pxor %%mm6, %%mm1 \n\t"
+ "pxor %%mm6, %%mm2 \n\t"
+ "pxor %%mm6, %%mm3 \n\t"
+ PAVGB" %%mm2, %%mm0 \n\t"
+ PAVGB" %%mm3, %%mm1 \n\t"
+ "pxor %%mm6, %%mm0 \n\t"
+ "pxor %%mm6, %%mm1 \n\t"
+ "movq %%mm0, (%3) \n\t"
+ "add %5, %3 \n\t"
+ "movq %%mm1, (%3) \n\t"
+ "add %5, %3 \n\t"
+ "add $32, %2 \n\t"
+ "subl $4, %0 \n\t"
+ "jnz 1b \n\t"
+#if !HAVE_EBX_AVAILABLE //Note "+bm" and "+mb" are buggy too (with gcc 3.2.2 at least) and cannot be used
+ :"+m"(h), "+a"(src1), "+c"(src2), "+d"(dst)
+#else
+ :"+b"(h), "+a"(src1), "+c"(src2), "+d"(dst)
+#endif
+ :"S"((x86_reg)src1Stride), "D"((x86_reg)dstStride)
+ :"memory");
+//the following should be used, though better not with gcc ...
+/* :"+g"(h), "+r"(src1), "+r"(src2), "+r"(dst)
+ :"r"(src1Stride), "r"(dstStride)
+ :"memory");*/
+}
+
+static void DEF(avg_pixels8_l2)(uint8_t *dst, uint8_t *src1, uint8_t *src2, int dstStride, int src1Stride, int h)
+{
+ __asm__ volatile(
+ "testl $1, %0 \n\t"
+ " jz 1f \n\t"
+ "movq (%1), %%mm0 \n\t"
+ "movq (%2), %%mm1 \n\t"
+ "add %4, %1 \n\t"
+ "add $8, %2 \n\t"
+ PAVGB" %%mm1, %%mm0 \n\t"
+ PAVGB" (%3), %%mm0 \n\t"
+ "movq %%mm0, (%3) \n\t"
+ "add %5, %3 \n\t"
+ "decl %0 \n\t"
+ "1: \n\t"
+ "movq (%1), %%mm0 \n\t"
+ "add %4, %1 \n\t"
+ "movq (%1), %%mm1 \n\t"
+ "add %4, %1 \n\t"
+ PAVGB" (%2), %%mm0 \n\t"
+ PAVGB" 8(%2), %%mm1 \n\t"
+ PAVGB" (%3), %%mm0 \n\t"
+ "movq %%mm0, (%3) \n\t"
+ "add %5, %3 \n\t"
+ PAVGB" (%3), %%mm1 \n\t"
+ "movq %%mm1, (%3) \n\t"
+ "add %5, %3 \n\t"
+ "movq (%1), %%mm0 \n\t"
+ "add %4, %1 \n\t"
+ "movq (%1), %%mm1 \n\t"
+ "add %4, %1 \n\t"
+ PAVGB" 16(%2), %%mm0 \n\t"
+ PAVGB" 24(%2), %%mm1 \n\t"
+ PAVGB" (%3), %%mm0 \n\t"
+ "movq %%mm0, (%3) \n\t"
+ "add %5, %3 \n\t"
+ PAVGB" (%3), %%mm1 \n\t"
+ "movq %%mm1, (%3) \n\t"
+ "add %5, %3 \n\t"
+ "add $32, %2 \n\t"
+ "subl $4, %0 \n\t"
+ "jnz 1b \n\t"
+#if !HAVE_EBX_AVAILABLE //Note "+bm" and "+mb" are buggy too (with gcc 3.2.2 at least) and cannot be used
+ :"+m"(h), "+a"(src1), "+c"(src2), "+d"(dst)
+#else
+ :"+b"(h), "+a"(src1), "+c"(src2), "+d"(dst)
+#endif
+ :"S"((x86_reg)src1Stride), "D"((x86_reg)dstStride)
+ :"memory");
+//the following should be used, though better not with gcc ...
+/* :"+g"(h), "+r"(src1), "+r"(src2), "+r"(dst)
+ :"r"(src1Stride), "r"(dstStride)
+ :"memory");*/
+}
+#endif /* SKIP_FOR_3DNOW */
+
+static void DEF(put_pixels16_x2)(uint8_t *block, const uint8_t *pixels, int line_size, int h)
+{
+ __asm__ volatile(
+ "lea (%3, %3), %%"REG_a" \n\t"
+ "1: \n\t"
+ "movq (%1), %%mm0 \n\t"
+ "movq (%1, %3), %%mm1 \n\t"
+ "movq 8(%1), %%mm2 \n\t"
+ "movq 8(%1, %3), %%mm3 \n\t"
+ PAVGB" 1(%1), %%mm0 \n\t"
+ PAVGB" 1(%1, %3), %%mm1 \n\t"
+ PAVGB" 9(%1), %%mm2 \n\t"
+ PAVGB" 9(%1, %3), %%mm3 \n\t"
+ "movq %%mm0, (%2) \n\t"
+ "movq %%mm1, (%2, %3) \n\t"
+ "movq %%mm2, 8(%2) \n\t"
+ "movq %%mm3, 8(%2, %3) \n\t"
+ "add %%"REG_a", %1 \n\t"
+ "add %%"REG_a", %2 \n\t"
+ "movq (%1), %%mm0 \n\t"
+ "movq (%1, %3), %%mm1 \n\t"
+ "movq 8(%1), %%mm2 \n\t"
+ "movq 8(%1, %3), %%mm3 \n\t"
+ PAVGB" 1(%1), %%mm0 \n\t"
+ PAVGB" 1(%1, %3), %%mm1 \n\t"
+ PAVGB" 9(%1), %%mm2 \n\t"
+ PAVGB" 9(%1, %3), %%mm3 \n\t"
+ "add %%"REG_a", %1 \n\t"
+ "movq %%mm0, (%2) \n\t"
+ "movq %%mm1, (%2, %3) \n\t"
+ "movq %%mm2, 8(%2) \n\t"
+ "movq %%mm3, 8(%2, %3) \n\t"
+ "add %%"REG_a", %2 \n\t"
+ "subl $4, %0 \n\t"
+ "jnz 1b \n\t"
+ :"+g"(h), "+S"(pixels), "+D"(block)
+ :"r" ((x86_reg)line_size)
+ :"%"REG_a, "memory");
+}
+
+#ifndef SKIP_FOR_3DNOW
+static void DEF(put_pixels16_l2)(uint8_t *dst, uint8_t *src1, uint8_t *src2, int dstStride, int src1Stride, int h)
+{
+ __asm__ volatile(
+ "testl $1, %0 \n\t"
+ " jz 1f \n\t"
+ "movq (%1), %%mm0 \n\t"
+ "movq 8(%1), %%mm1 \n\t"
+ PAVGB" (%2), %%mm0 \n\t"
+ PAVGB" 8(%2), %%mm1 \n\t"
+ "add %4, %1 \n\t"
+ "add $16, %2 \n\t"
+ "movq %%mm0, (%3) \n\t"
+ "movq %%mm1, 8(%3) \n\t"
+ "add %5, %3 \n\t"
+ "decl %0 \n\t"
+ "1: \n\t"
+ "movq (%1), %%mm0 \n\t"
+ "movq 8(%1), %%mm1 \n\t"
+ "add %4, %1 \n\t"
+ PAVGB" (%2), %%mm0 \n\t"
+ PAVGB" 8(%2), %%mm1 \n\t"
+ "movq %%mm0, (%3) \n\t"
+ "movq %%mm1, 8(%3) \n\t"
+ "add %5, %3 \n\t"
+ "movq (%1), %%mm0 \n\t"
+ "movq 8(%1), %%mm1 \n\t"
+ "add %4, %1 \n\t"
+ PAVGB" 16(%2), %%mm0 \n\t"
+ PAVGB" 24(%2), %%mm1 \n\t"
+ "movq %%mm0, (%3) \n\t"
+ "movq %%mm1, 8(%3) \n\t"
+ "add %5, %3 \n\t"
+ "add $32, %2 \n\t"
+ "subl $2, %0 \n\t"
+ "jnz 1b \n\t"
+#if !HAVE_EBX_AVAILABLE //Note "+bm" and "+mb" are buggy too (with gcc 3.2.2 at least) and cannot be used
+ :"+m"(h), "+a"(src1), "+c"(src2), "+d"(dst)
+#else
+ :"+b"(h), "+a"(src1), "+c"(src2), "+d"(dst)
+#endif
+ :"S"((x86_reg)src1Stride), "D"((x86_reg)dstStride)
+ :"memory");
+//the following should be used, though better not with gcc ...
+/* :"+g"(h), "+r"(src1), "+r"(src2), "+r"(dst)
+ :"r"(src1Stride), "r"(dstStride)
+ :"memory");*/
+}
+
+static void DEF(avg_pixels16_l2)(uint8_t *dst, uint8_t *src1, uint8_t *src2, int dstStride, int src1Stride, int h)
+{
+ __asm__ volatile(
+ "testl $1, %0 \n\t"
+ " jz 1f \n\t"
+ "movq (%1), %%mm0 \n\t"
+ "movq 8(%1), %%mm1 \n\t"
+ PAVGB" (%2), %%mm0 \n\t"
+ PAVGB" 8(%2), %%mm1 \n\t"
+ "add %4, %1 \n\t"
+ "add $16, %2 \n\t"
+ PAVGB" (%3), %%mm0 \n\t"
+ PAVGB" 8(%3), %%mm1 \n\t"
+ "movq %%mm0, (%3) \n\t"
+ "movq %%mm1, 8(%3) \n\t"
+ "add %5, %3 \n\t"
+ "decl %0 \n\t"
+ "1: \n\t"
+ "movq (%1), %%mm0 \n\t"
+ "movq 8(%1), %%mm1 \n\t"
+ "add %4, %1 \n\t"
+ PAVGB" (%2), %%mm0 \n\t"
+ PAVGB" 8(%2), %%mm1 \n\t"
+ PAVGB" (%3), %%mm0 \n\t"
+ PAVGB" 8(%3), %%mm1 \n\t"
+ "movq %%mm0, (%3) \n\t"
+ "movq %%mm1, 8(%3) \n\t"
+ "add %5, %3 \n\t"
+ "movq (%1), %%mm0 \n\t"
+ "movq 8(%1), %%mm1 \n\t"
+ "add %4, %1 \n\t"
+ PAVGB" 16(%2), %%mm0 \n\t"
+ PAVGB" 24(%2), %%mm1 \n\t"
+ PAVGB" (%3), %%mm0 \n\t"
+ PAVGB" 8(%3), %%mm1 \n\t"
+ "movq %%mm0, (%3) \n\t"
+ "movq %%mm1, 8(%3) \n\t"
+ "add %5, %3 \n\t"
+ "add $32, %2 \n\t"
+ "subl $2, %0 \n\t"
+ "jnz 1b \n\t"
+#if !HAVE_EBX_AVAILABLE //Note "+bm" and "+mb" are buggy too (with gcc 3.2.2 at least) and cannot be used
+ :"+m"(h), "+a"(src1), "+c"(src2), "+d"(dst)
+#else
+ :"+b"(h), "+a"(src1), "+c"(src2), "+d"(dst)
+#endif
+ :"S"((x86_reg)src1Stride), "D"((x86_reg)dstStride)
+ :"memory");
+//the following should be used, though better not with gcc ...
+/* :"+g"(h), "+r"(src1), "+r"(src2), "+r"(dst)
+ :"r"(src1Stride), "r"(dstStride)
+ :"memory");*/
+}
+
+static void DEF(put_no_rnd_pixels16_l2)(uint8_t *dst, uint8_t *src1, uint8_t *src2, int dstStride, int src1Stride, int h)
+{
+ __asm__ volatile(
+ "pcmpeqb %%mm6, %%mm6 \n\t"
+ "testl $1, %0 \n\t"
+ " jz 1f \n\t"
+ "movq (%1), %%mm0 \n\t"
+ "movq 8(%1), %%mm1 \n\t"
+ "movq (%2), %%mm2 \n\t"
+ "movq 8(%2), %%mm3 \n\t"
+ "pxor %%mm6, %%mm0 \n\t"
+ "pxor %%mm6, %%mm1 \n\t"
+ "pxor %%mm6, %%mm2 \n\t"
+ "pxor %%mm6, %%mm3 \n\t"
+ PAVGB" %%mm2, %%mm0 \n\t"
+ PAVGB" %%mm3, %%mm1 \n\t"
+ "pxor %%mm6, %%mm0 \n\t"
+ "pxor %%mm6, %%mm1 \n\t"
+ "add %4, %1 \n\t"
+ "add $16, %2 \n\t"
+ "movq %%mm0, (%3) \n\t"
+ "movq %%mm1, 8(%3) \n\t"
+ "add %5, %3 \n\t"
+ "decl %0 \n\t"
+ "1: \n\t"
+ "movq (%1), %%mm0 \n\t"
+ "movq 8(%1), %%mm1 \n\t"
+ "add %4, %1 \n\t"
+ "movq (%2), %%mm2 \n\t"
+ "movq 8(%2), %%mm3 \n\t"
+ "pxor %%mm6, %%mm0 \n\t"
+ "pxor %%mm6, %%mm1 \n\t"
+ "pxor %%mm6, %%mm2 \n\t"
+ "pxor %%mm6, %%mm3 \n\t"
+ PAVGB" %%mm2, %%mm0 \n\t"
+ PAVGB" %%mm3, %%mm1 \n\t"
+ "pxor %%mm6, %%mm0 \n\t"
+ "pxor %%mm6, %%mm1 \n\t"
+ "movq %%mm0, (%3) \n\t"
+ "movq %%mm1, 8(%3) \n\t"
+ "add %5, %3 \n\t"
+ "movq (%1), %%mm0 \n\t"
+ "movq 8(%1), %%mm1 \n\t"
+ "add %4, %1 \n\t"
+ "movq 16(%2), %%mm2 \n\t"
+ "movq 24(%2), %%mm3 \n\t"
+ "pxor %%mm6, %%mm0 \n\t"
+ "pxor %%mm6, %%mm1 \n\t"
+ "pxor %%mm6, %%mm2 \n\t"
+ "pxor %%mm6, %%mm3 \n\t"
+ PAVGB" %%mm2, %%mm0 \n\t"
+ PAVGB" %%mm3, %%mm1 \n\t"
+ "pxor %%mm6, %%mm0 \n\t"
+ "pxor %%mm6, %%mm1 \n\t"
+ "movq %%mm0, (%3) \n\t"
+ "movq %%mm1, 8(%3) \n\t"
+ "add %5, %3 \n\t"
+ "add $32, %2 \n\t"
+ "subl $2, %0 \n\t"
+ "jnz 1b \n\t"
+#if !HAVE_EBX_AVAILABLE //Note "+bm" and "+mb" are buggy too (with gcc 3.2.2 at least) and cannot be used
+ :"+m"(h), "+a"(src1), "+c"(src2), "+d"(dst)
+#else
+ :"+b"(h), "+a"(src1), "+c"(src2), "+d"(dst)
+#endif
+ :"S"((x86_reg)src1Stride), "D"((x86_reg)dstStride)
+ :"memory");
+//the following should be used, though better not with gcc ...
+/* :"+g"(h), "+r"(src1), "+r"(src2), "+r"(dst)
+ :"r"(src1Stride), "r"(dstStride)
+ :"memory");*/
+}
+#endif /* SKIP_FOR_3DNOW */
+
+/* GL: this function does incorrect rounding if overflow */
+static void DEF(put_no_rnd_pixels8_x2)(uint8_t *block, const uint8_t *pixels, int line_size, int h)
+{
+ MOVQ_BONE(mm6);
+ __asm__ volatile(
+ "lea (%3, %3), %%"REG_a" \n\t"
+ "1: \n\t"
+ "movq (%1), %%mm0 \n\t"
+ "movq (%1, %3), %%mm2 \n\t"
+ "movq 1(%1), %%mm1 \n\t"
+ "movq 1(%1, %3), %%mm3 \n\t"
+ "add %%"REG_a", %1 \n\t"
+ "psubusb %%mm6, %%mm0 \n\t"
+ "psubusb %%mm6, %%mm2 \n\t"
+ PAVGB" %%mm1, %%mm0 \n\t"
+ PAVGB" %%mm3, %%mm2 \n\t"
+ "movq %%mm0, (%2) \n\t"
+ "movq %%mm2, (%2, %3) \n\t"
+ "movq (%1), %%mm0 \n\t"
+ "movq 1(%1), %%mm1 \n\t"
+ "movq (%1, %3), %%mm2 \n\t"
+ "movq 1(%1, %3), %%mm3 \n\t"
+ "add %%"REG_a", %2 \n\t"
+ "add %%"REG_a", %1 \n\t"
+ "psubusb %%mm6, %%mm0 \n\t"
+ "psubusb %%mm6, %%mm2 \n\t"
+ PAVGB" %%mm1, %%mm0 \n\t"
+ PAVGB" %%mm3, %%mm2 \n\t"
+ "movq %%mm0, (%2) \n\t"
+ "movq %%mm2, (%2, %3) \n\t"
+ "add %%"REG_a", %2 \n\t"
+ "subl $4, %0 \n\t"
+ "jnz 1b \n\t"
+ :"+g"(h), "+S"(pixels), "+D"(block)
+ :"r" ((x86_reg)line_size)
+ :"%"REG_a, "memory");
+}
+
+static void DEF(put_no_rnd_pixels8_x2_exact)(uint8_t *block, const uint8_t *pixels, int line_size, int h)
+{
+ __asm__ volatile (
+ "pcmpeqb %%mm6, %%mm6 \n\t"
+ "1: \n\t"
+ "movq (%1), %%mm0 \n\t"
+ "movq (%1, %3), %%mm2 \n\t"
+ "movq 1(%1), %%mm1 \n\t"
+ "movq 1(%1, %3), %%mm3 \n\t"
+ "pxor %%mm6, %%mm0 \n\t"
+ "pxor %%mm6, %%mm2 \n\t"
+ "pxor %%mm6, %%mm1 \n\t"
+ "pxor %%mm6, %%mm3 \n\t"
+ PAVGB" %%mm1, %%mm0 \n\t"
+ PAVGB" %%mm3, %%mm2 \n\t"
+ "pxor %%mm6, %%mm0 \n\t"
+ "pxor %%mm6, %%mm2 \n\t"
+ "movq %%mm0, (%2) \n\t"
+ "movq %%mm2, (%2, %3) \n\t"
+ "movq (%1, %3,2), %%mm0 \n\t"
+ "movq 1(%1, %3,2), %%mm1 \n\t"
+ "movq (%1, %4), %%mm2 \n\t"
+ "movq 1(%1, %4), %%mm3 \n\t"
+ "pxor %%mm6, %%mm0 \n\t"
+ "pxor %%mm6, %%mm1 \n\t"
+ "pxor %%mm6, %%mm2 \n\t"
+ "pxor %%mm6, %%mm3 \n\t"
+ PAVGB" %%mm1, %%mm0 \n\t"
+ PAVGB" %%mm3, %%mm2 \n\t"
+ "pxor %%mm6, %%mm0 \n\t"
+ "pxor %%mm6, %%mm2 \n\t"
+ "movq %%mm0, (%2, %3,2) \n\t"
+ "movq %%mm2, (%2, %4) \n\t"
+ "lea (%1, %3,4), %1 \n\t"
+ "lea (%2, %3,4), %2 \n\t"
+ "subl $4, %0 \n\t"
+ "jg 1b \n\t"
+ : "+g"(h), "+r"(pixels), "+r"(block)
+ : "r" ((x86_reg)line_size), "r"((x86_reg)3*line_size)
+ : "memory"
+ );
+}
+
+static void DEF(put_pixels8_y2)(uint8_t *block, const uint8_t *pixels, int line_size, int h)
+{
+ __asm__ volatile(
+ "lea (%3, %3), %%"REG_a" \n\t"
+ "movq (%1), %%mm0 \n\t"
+ "sub %3, %2 \n\t"
+ "1: \n\t"
+ "movq (%1, %3), %%mm1 \n\t"
+ "movq (%1, %%"REG_a"), %%mm2 \n\t"
+ "add %%"REG_a", %1 \n\t"
+ PAVGB" %%mm1, %%mm0 \n\t"
+ PAVGB" %%mm2, %%mm1 \n\t"
+ "movq %%mm0, (%2, %3) \n\t"
+ "movq %%mm1, (%2, %%"REG_a") \n\t"
+ "movq (%1, %3), %%mm1 \n\t"
+ "movq (%1, %%"REG_a"), %%mm0 \n\t"
+ "add %%"REG_a", %2 \n\t"
+ "add %%"REG_a", %1 \n\t"
+ PAVGB" %%mm1, %%mm2 \n\t"
+ PAVGB" %%mm0, %%mm1 \n\t"
+ "movq %%mm2, (%2, %3) \n\t"
+ "movq %%mm1, (%2, %%"REG_a") \n\t"
+ "add %%"REG_a", %2 \n\t"
+ "subl $4, %0 \n\t"
+ "jnz 1b \n\t"
+ :"+g"(h), "+S"(pixels), "+D" (block)
+ :"r" ((x86_reg)line_size)
+ :"%"REG_a, "memory");
+}
+
+/* GL: this function does incorrect rounding if overflow */
+static void DEF(put_no_rnd_pixels8_y2)(uint8_t *block, const uint8_t *pixels, int line_size, int h)
+{
+ MOVQ_BONE(mm6);
+ __asm__ volatile(
+ "lea (%3, %3), %%"REG_a" \n\t"
+ "movq (%1), %%mm0 \n\t"
+ "sub %3, %2 \n\t"
+ "1: \n\t"
+ "movq (%1, %3), %%mm1 \n\t"
+ "movq (%1, %%"REG_a"), %%mm2 \n\t"
+ "add %%"REG_a", %1 \n\t"
+ "psubusb %%mm6, %%mm1 \n\t"
+ PAVGB" %%mm1, %%mm0 \n\t"
+ PAVGB" %%mm2, %%mm1 \n\t"
+ "movq %%mm0, (%2, %3) \n\t"
+ "movq %%mm1, (%2, %%"REG_a") \n\t"
+ "movq (%1, %3), %%mm1 \n\t"
+ "movq (%1, %%"REG_a"), %%mm0 \n\t"
+ "add %%"REG_a", %2 \n\t"
+ "add %%"REG_a", %1 \n\t"
+ "psubusb %%mm6, %%mm1 \n\t"
+ PAVGB" %%mm1, %%mm2 \n\t"
+ PAVGB" %%mm0, %%mm1 \n\t"
+ "movq %%mm2, (%2, %3) \n\t"
+ "movq %%mm1, (%2, %%"REG_a") \n\t"
+ "add %%"REG_a", %2 \n\t"
+ "subl $4, %0 \n\t"
+ "jnz 1b \n\t"
+ :"+g"(h), "+S"(pixels), "+D" (block)
+ :"r" ((x86_reg)line_size)
+ :"%"REG_a, "memory");
+}
+
+static void DEF(put_no_rnd_pixels8_y2_exact)(uint8_t *block, const uint8_t *pixels, int line_size, int h)
+{
+ __asm__ volatile (
+ "movq (%1), %%mm0 \n\t"
+ "pcmpeqb %%mm6, %%mm6 \n\t"
+ "add %3, %1 \n\t"
+ "pxor %%mm6, %%mm0 \n\t"
+ "1: \n\t"
+ "movq (%1), %%mm1 \n\t"
+ "movq (%1, %3), %%mm2 \n\t"
+ "pxor %%mm6, %%mm1 \n\t"
+ "pxor %%mm6, %%mm2 \n\t"
+ PAVGB" %%mm1, %%mm0 \n\t"
+ PAVGB" %%mm2, %%mm1 \n\t"
+ "pxor %%mm6, %%mm0 \n\t"
+ "pxor %%mm6, %%mm1 \n\t"
+ "movq %%mm0, (%2) \n\t"
+ "movq %%mm1, (%2, %3) \n\t"
+ "movq (%1, %3,2), %%mm1 \n\t"
+ "movq (%1, %4), %%mm0 \n\t"
+ "pxor %%mm6, %%mm1 \n\t"
+ "pxor %%mm6, %%mm0 \n\t"
+ PAVGB" %%mm1, %%mm2 \n\t"
+ PAVGB" %%mm0, %%mm1 \n\t"
+ "pxor %%mm6, %%mm2 \n\t"
+ "pxor %%mm6, %%mm1 \n\t"
+ "movq %%mm2, (%2, %3,2) \n\t"
+ "movq %%mm1, (%2, %4) \n\t"
+ "lea (%1, %3,4), %1 \n\t"
+ "lea (%2, %3,4), %2 \n\t"
+ "subl $4, %0 \n\t"
+ "jg 1b \n\t"
+ :"+g"(h), "+r"(pixels), "+r" (block)
+ :"r" ((x86_reg)line_size), "r"((x86_reg)3*line_size)
+ :"memory"
+ );
+}
+
+static void DEF(avg_pixels8)(uint8_t *block, const uint8_t *pixels, int line_size, int h)
+{
+ __asm__ volatile(
+ "lea (%3, %3), %%"REG_a" \n\t"
+ "1: \n\t"
+ "movq (%2), %%mm0 \n\t"
+ "movq (%2, %3), %%mm1 \n\t"
+ PAVGB" (%1), %%mm0 \n\t"
+ PAVGB" (%1, %3), %%mm1 \n\t"
+ "movq %%mm0, (%2) \n\t"
+ "movq %%mm1, (%2, %3) \n\t"
+ "add %%"REG_a", %1 \n\t"
+ "add %%"REG_a", %2 \n\t"
+ "movq (%2), %%mm0 \n\t"
+ "movq (%2, %3), %%mm1 \n\t"
+ PAVGB" (%1), %%mm0 \n\t"
+ PAVGB" (%1, %3), %%mm1 \n\t"
+ "add %%"REG_a", %1 \n\t"
+ "movq %%mm0, (%2) \n\t"
+ "movq %%mm1, (%2, %3) \n\t"
+ "add %%"REG_a", %2 \n\t"
+ "subl $4, %0 \n\t"
+ "jnz 1b \n\t"
+ :"+g"(h), "+S"(pixels), "+D"(block)
+ :"r" ((x86_reg)line_size)
+ :"%"REG_a, "memory");
+}
+
+static void DEF(avg_pixels8_x2)(uint8_t *block, const uint8_t *pixels, int line_size, int h)
+{
+ __asm__ volatile(
+ "lea (%3, %3), %%"REG_a" \n\t"
+ "1: \n\t"
+ "movq (%1), %%mm0 \n\t"
+ "movq (%1, %3), %%mm2 \n\t"
+ PAVGB" 1(%1), %%mm0 \n\t"
+ PAVGB" 1(%1, %3), %%mm2 \n\t"
+ PAVGB" (%2), %%mm0 \n\t"
+ PAVGB" (%2, %3), %%mm2 \n\t"
+ "add %%"REG_a", %1 \n\t"
+ "movq %%mm0, (%2) \n\t"
+ "movq %%mm2, (%2, %3) \n\t"
+ "movq (%1), %%mm0 \n\t"
+ "movq (%1, %3), %%mm2 \n\t"
+ PAVGB" 1(%1), %%mm0 \n\t"
+ PAVGB" 1(%1, %3), %%mm2 \n\t"
+ "add %%"REG_a", %2 \n\t"
+ "add %%"REG_a", %1 \n\t"
+ PAVGB" (%2), %%mm0 \n\t"
+ PAVGB" (%2, %3), %%mm2 \n\t"
+ "movq %%mm0, (%2) \n\t"
+ "movq %%mm2, (%2, %3) \n\t"
+ "add %%"REG_a", %2 \n\t"
+ "subl $4, %0 \n\t"
+ "jnz 1b \n\t"
+ :"+g"(h), "+S"(pixels), "+D"(block)
+ :"r" ((x86_reg)line_size)
+ :"%"REG_a, "memory");
+}
+
+static void DEF(avg_pixels8_y2)(uint8_t *block, const uint8_t *pixels, int line_size, int h)
+{
+ __asm__ volatile(
+ "lea (%3, %3), %%"REG_a" \n\t"
+ "movq (%1), %%mm0 \n\t"
+ "sub %3, %2 \n\t"
+ "1: \n\t"
+ "movq (%1, %3), %%mm1 \n\t"
+ "movq (%1, %%"REG_a"), %%mm2 \n\t"
+ "add %%"REG_a", %1 \n\t"
+ PAVGB" %%mm1, %%mm0 \n\t"
+ PAVGB" %%mm2, %%mm1 \n\t"
+ "movq (%2, %3), %%mm3 \n\t"
+ "movq (%2, %%"REG_a"), %%mm4 \n\t"
+ PAVGB" %%mm3, %%mm0 \n\t"
+ PAVGB" %%mm4, %%mm1 \n\t"
+ "movq %%mm0, (%2, %3) \n\t"
+ "movq %%mm1, (%2, %%"REG_a") \n\t"
+ "movq (%1, %3), %%mm1 \n\t"
+ "movq (%1, %%"REG_a"), %%mm0 \n\t"
+ PAVGB" %%mm1, %%mm2 \n\t"
+ PAVGB" %%mm0, %%mm1 \n\t"
+ "add %%"REG_a", %2 \n\t"
+ "add %%"REG_a", %1 \n\t"
+ "movq (%2, %3), %%mm3 \n\t"
+ "movq (%2, %%"REG_a"), %%mm4 \n\t"
+ PAVGB" %%mm3, %%mm2 \n\t"
+ PAVGB" %%mm4, %%mm1 \n\t"
+ "movq %%mm2, (%2, %3) \n\t"
+ "movq %%mm1, (%2, %%"REG_a") \n\t"
+ "add %%"REG_a", %2 \n\t"
+ "subl $4, %0 \n\t"
+ "jnz 1b \n\t"
+ :"+g"(h), "+S"(pixels), "+D"(block)
+ :"r" ((x86_reg)line_size)
+ :"%"REG_a, "memory");
+}
+
+/* Note this is not correctly rounded, but this function is only
+ * used for B-frames so it does not matter. */
+static void DEF(avg_pixels8_xy2)(uint8_t *block, const uint8_t *pixels, int line_size, int h)
+{
+ MOVQ_BONE(mm6);
+ __asm__ volatile(
+ "lea (%3, %3), %%"REG_a" \n\t"
+ "movq (%1), %%mm0 \n\t"
+ PAVGB" 1(%1), %%mm0 \n\t"
+ ".p2align 3 \n\t"
+ "1: \n\t"
+ "movq (%1, %%"REG_a"), %%mm2 \n\t"
+ "movq (%1, %3), %%mm1 \n\t"
+ "psubusb %%mm6, %%mm2 \n\t"
+ PAVGB" 1(%1, %3), %%mm1 \n\t"
+ PAVGB" 1(%1, %%"REG_a"), %%mm2 \n\t"
+ "add %%"REG_a", %1 \n\t"
+ PAVGB" %%mm1, %%mm0 \n\t"
+ PAVGB" %%mm2, %%mm1 \n\t"
+ PAVGB" (%2), %%mm0 \n\t"
+ PAVGB" (%2, %3), %%mm1 \n\t"
+ "movq %%mm0, (%2) \n\t"
+ "movq %%mm1, (%2, %3) \n\t"
+ "movq (%1, %3), %%mm1 \n\t"
+ "movq (%1, %%"REG_a"), %%mm0 \n\t"
+ PAVGB" 1(%1, %3), %%mm1 \n\t"
+ PAVGB" 1(%1, %%"REG_a"), %%mm0 \n\t"
+ "add %%"REG_a", %2 \n\t"
+ "add %%"REG_a", %1 \n\t"
+ PAVGB" %%mm1, %%mm2 \n\t"
+ PAVGB" %%mm0, %%mm1 \n\t"
+ PAVGB" (%2), %%mm2 \n\t"
+ PAVGB" (%2, %3), %%mm1 \n\t"
+ "movq %%mm2, (%2) \n\t"
+ "movq %%mm1, (%2, %3) \n\t"
+ "add %%"REG_a", %2 \n\t"
+ "subl $4, %0 \n\t"
+ "jnz 1b \n\t"
+ :"+g"(h), "+S"(pixels), "+D"(block)
+ :"r" ((x86_reg)line_size)
+ :"%"REG_a, "memory");
+}
+
+//FIXME the following could be optimized too ...
+static void DEF(put_no_rnd_pixels16_x2)(uint8_t *block, const uint8_t *pixels, int line_size, int h){
+ DEF(put_no_rnd_pixels8_x2)(block , pixels , line_size, h);
+ DEF(put_no_rnd_pixels8_x2)(block+8, pixels+8, line_size, h);
+}
+static void DEF(put_pixels16_y2)(uint8_t *block, const uint8_t *pixels, int line_size, int h){
+ DEF(put_pixels8_y2)(block , pixels , line_size, h);
+ DEF(put_pixels8_y2)(block+8, pixels+8, line_size, h);
+}
+static void DEF(put_no_rnd_pixels16_y2)(uint8_t *block, const uint8_t *pixels, int line_size, int h){
+ DEF(put_no_rnd_pixels8_y2)(block , pixels , line_size, h);
+ DEF(put_no_rnd_pixels8_y2)(block+8, pixels+8, line_size, h);
+}
+static void DEF(avg_pixels16)(uint8_t *block, const uint8_t *pixels, int line_size, int h){
+ DEF(avg_pixels8)(block , pixels , line_size, h);
+ DEF(avg_pixels8)(block+8, pixels+8, line_size, h);
+}
+static void DEF(avg_pixels16_x2)(uint8_t *block, const uint8_t *pixels, int line_size, int h){
+ DEF(avg_pixels8_x2)(block , pixels , line_size, h);
+ DEF(avg_pixels8_x2)(block+8, pixels+8, line_size, h);
+}
+static void DEF(avg_pixels16_y2)(uint8_t *block, const uint8_t *pixels, int line_size, int h){
+ DEF(avg_pixels8_y2)(block , pixels , line_size, h);
+ DEF(avg_pixels8_y2)(block+8, pixels+8, line_size, h);
+}
+static void DEF(avg_pixels16_xy2)(uint8_t *block, const uint8_t *pixels, int line_size, int h){
+ DEF(avg_pixels8_xy2)(block , pixels , line_size, h);
+ DEF(avg_pixels8_xy2)(block+8, pixels+8, line_size, h);
+}
+
+#define QPEL_2TAP_L3(OPNAME) \
+static void DEF(OPNAME ## 2tap_qpel16_l3)(uint8_t *dst, uint8_t *src, int stride, int h, int off1, int off2){\
+ __asm__ volatile(\
+ "1: \n\t"\
+ "movq (%1,%2), %%mm0 \n\t"\
+ "movq 8(%1,%2), %%mm1 \n\t"\
+ PAVGB" (%1,%3), %%mm0 \n\t"\
+ PAVGB" 8(%1,%3), %%mm1 \n\t"\
+ PAVGB" (%1), %%mm0 \n\t"\
+ PAVGB" 8(%1), %%mm1 \n\t"\
+ STORE_OP( (%1,%4),%%mm0)\
+ STORE_OP(8(%1,%4),%%mm1)\
+ "movq %%mm0, (%1,%4) \n\t"\
+ "movq %%mm1, 8(%1,%4) \n\t"\
+ "add %5, %1 \n\t"\
+ "decl %0 \n\t"\
+ "jnz 1b \n\t"\
+ :"+g"(h), "+r"(src)\
+ :"r"((x86_reg)off1), "r"((x86_reg)off2),\
+ "r"((x86_reg)(dst-src)), "r"((x86_reg)stride)\
+ :"memory"\
+ );\
+}\
+static void DEF(OPNAME ## 2tap_qpel8_l3)(uint8_t *dst, uint8_t *src, int stride, int h, int off1, int off2){\
+ __asm__ volatile(\
+ "1: \n\t"\
+ "movq (%1,%2), %%mm0 \n\t"\
+ PAVGB" (%1,%3), %%mm0 \n\t"\
+ PAVGB" (%1), %%mm0 \n\t"\
+ STORE_OP((%1,%4),%%mm0)\
+ "movq %%mm0, (%1,%4) \n\t"\
+ "add %5, %1 \n\t"\
+ "decl %0 \n\t"\
+ "jnz 1b \n\t"\
+ :"+g"(h), "+r"(src)\
+ :"r"((x86_reg)off1), "r"((x86_reg)off2),\
+ "r"((x86_reg)(dst-src)), "r"((x86_reg)stride)\
+ :"memory"\
+ );\
+}
+
+#ifndef SKIP_FOR_3DNOW
+#define STORE_OP(a,b) PAVGB" "#a","#b" \n\t"
+QPEL_2TAP_L3(avg_)
+#undef STORE_OP
+#define STORE_OP(a,b)
+QPEL_2TAP_L3(put_)
+#undef STORE_OP
+#undef QPEL_2TAP_L3
+#endif /* SKIP_FOR_3DNOW */
diff --git a/gst-libs/ext/libav/libavcodec/x86/dsputil_mmx.c b/gst-libs/ext/libav/libavcodec/x86/dsputil_mmx.c
index e34b95b..b16f7e4 100644
--- a/gst-libs/ext/libav/libavcodec/x86/dsputil_mmx.c
+++ b/gst-libs/ext/libav/libavcodec/x86/dsputil_mmx.c
@@ -3,6 +3,8 @@
* Copyright (c) 2000, 2001 Fabrice Bellard
* Copyright (c) 2002-2004 Michael Niedermayer <michaelni@gmx.at>
*
+ * MMX optimization by Nick Kurshev <nickols_k@mail.ru>
+ *
* This file is part of Libav.
*
* Libav is free software; you can redistribute it and/or
@@ -18,17 +20,14 @@
* 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
- *
- * MMX optimization by Nick Kurshev <nickols_k@mail.ru>
*/
#include "libavutil/cpu.h"
-#include "libavutil/x86_cpu.h"
+#include "libavutil/x86/asm.h"
#include "libavcodec/dsputil.h"
#include "libavcodec/h264dsp.h"
#include "libavcodec/mpegvideo.h"
#include "libavcodec/simple_idct.h"
-#include "libavcodec/ac3dec.h"
#include "dsputil_mmx.h"
#include "idct_xvid.h"
@@ -40,135 +39,137 @@ DECLARE_ALIGNED(8, const uint64_t, ff_bone) = 0x0101010101010101ULL;
DECLARE_ALIGNED(8, const uint64_t, ff_wtwo) = 0x0002000200020002ULL;
DECLARE_ALIGNED(16, const uint64_t, ff_pdw_80000000)[2] =
-{0x8000000080000000ULL, 0x8000000080000000ULL};
-
-DECLARE_ALIGNED(16, const xmm_reg, ff_pw_1 ) = {0x0001000100010001ULL, 0x0001000100010001ULL};
-DECLARE_ALIGNED(16, const xmm_reg, ff_pw_2 ) = {0x0002000200020002ULL, 0x0002000200020002ULL};
-DECLARE_ALIGNED(16, const xmm_reg, ff_pw_3 ) = {0x0003000300030003ULL, 0x0003000300030003ULL};
-DECLARE_ALIGNED(16, const xmm_reg, ff_pw_4 ) = {0x0004000400040004ULL, 0x0004000400040004ULL};
-DECLARE_ALIGNED(16, const xmm_reg, ff_pw_5 ) = {0x0005000500050005ULL, 0x0005000500050005ULL};
-DECLARE_ALIGNED(16, const xmm_reg, ff_pw_8 ) = {0x0008000800080008ULL, 0x0008000800080008ULL};
-DECLARE_ALIGNED(16, const xmm_reg, ff_pw_9 ) = {0x0009000900090009ULL, 0x0009000900090009ULL};
-DECLARE_ALIGNED(8, const uint64_t, ff_pw_15 ) = 0x000F000F000F000FULL;
-DECLARE_ALIGNED(16, const xmm_reg, ff_pw_16 ) = {0x0010001000100010ULL, 0x0010001000100010ULL};
-DECLARE_ALIGNED(16, const xmm_reg, ff_pw_17 ) = {0x0011001100110011ULL, 0x0011001100110011ULL};
-DECLARE_ALIGNED(16, const xmm_reg, ff_pw_18 ) = {0x0012001200120012ULL, 0x0012001200120012ULL};
-DECLARE_ALIGNED(8, const uint64_t, ff_pw_20 ) = 0x0014001400140014ULL;
-DECLARE_ALIGNED(16, const xmm_reg, ff_pw_27 ) = {0x001B001B001B001BULL, 0x001B001B001B001BULL};
-DECLARE_ALIGNED(16, const xmm_reg, ff_pw_28 ) = {0x001C001C001C001CULL, 0x001C001C001C001CULL};
-DECLARE_ALIGNED(16, const xmm_reg, ff_pw_32 ) = {0x0020002000200020ULL, 0x0020002000200020ULL};
-DECLARE_ALIGNED(8, const uint64_t, ff_pw_42 ) = 0x002A002A002A002AULL;
-DECLARE_ALIGNED(8, const uint64_t, ff_pw_53 ) = 0x0035003500350035ULL;
-DECLARE_ALIGNED(16, const xmm_reg, ff_pw_63 ) = {0x003F003F003F003FULL, 0x003F003F003F003FULL};
-DECLARE_ALIGNED(16, const xmm_reg, ff_pw_64 ) = {0x0040004000400040ULL, 0x0040004000400040ULL};
-DECLARE_ALIGNED(8, const uint64_t, ff_pw_96 ) = 0x0060006000600060ULL;
-DECLARE_ALIGNED(8, const uint64_t, ff_pw_128) = 0x0080008000800080ULL;
-DECLARE_ALIGNED(8, const uint64_t, ff_pw_255) = 0x00ff00ff00ff00ffULL;
-DECLARE_ALIGNED(16, const xmm_reg, ff_pw_512) = {0x0200020002000200ULL, 0x0200020002000200ULL};
-DECLARE_ALIGNED(16, const xmm_reg, ff_pw_1019)= {0x03FB03FB03FB03FBULL, 0x03FB03FB03FB03FBULL};
-
-DECLARE_ALIGNED(16, const xmm_reg, ff_pb_0 ) = {0x0000000000000000ULL, 0x0000000000000000ULL};
-DECLARE_ALIGNED(16, const xmm_reg, ff_pb_1 ) = {0x0101010101010101ULL, 0x0101010101010101ULL};
-DECLARE_ALIGNED(16, const xmm_reg, ff_pb_3 ) = {0x0303030303030303ULL, 0x0303030303030303ULL};
-DECLARE_ALIGNED(16, const xmm_reg, ff_pb_4 ) = {0x0404040404040404ULL, 0x0404040404040404ULL};
-DECLARE_ALIGNED(8, const uint64_t, ff_pb_7 ) = 0x0707070707070707ULL;
-DECLARE_ALIGNED(8, const uint64_t, ff_pb_1F ) = 0x1F1F1F1F1F1F1F1FULL;
-DECLARE_ALIGNED(8, const uint64_t, ff_pb_3F ) = 0x3F3F3F3F3F3F3F3FULL;
-DECLARE_ALIGNED(16, const xmm_reg, ff_pb_80 ) = {0x8080808080808080ULL, 0x8080808080808080ULL};
-DECLARE_ALIGNED(8, const uint64_t, ff_pb_81 ) = 0x8181818181818181ULL;
-DECLARE_ALIGNED(16, const xmm_reg, ff_pb_A1 ) = {0xA1A1A1A1A1A1A1A1ULL, 0xA1A1A1A1A1A1A1A1ULL};
-DECLARE_ALIGNED(16, const xmm_reg, ff_pb_F8 ) = {0xF8F8F8F8F8F8F8F8ULL, 0xF8F8F8F8F8F8F8F8ULL};
-DECLARE_ALIGNED(8, const uint64_t, ff_pb_FC ) = 0xFCFCFCFCFCFCFCFCULL;
-DECLARE_ALIGNED(16, const xmm_reg, ff_pb_FE ) = {0xFEFEFEFEFEFEFEFEULL, 0xFEFEFEFEFEFEFEFEULL};
+ { 0x8000000080000000ULL, 0x8000000080000000ULL };
+
+DECLARE_ALIGNED(16, const xmm_reg, ff_pw_1) = { 0x0001000100010001ULL, 0x0001000100010001ULL };
+DECLARE_ALIGNED(16, const xmm_reg, ff_pw_2) = { 0x0002000200020002ULL, 0x0002000200020002ULL };
+DECLARE_ALIGNED(16, const xmm_reg, ff_pw_3) = { 0x0003000300030003ULL, 0x0003000300030003ULL };
+DECLARE_ALIGNED(16, const xmm_reg, ff_pw_4) = { 0x0004000400040004ULL, 0x0004000400040004ULL };
+DECLARE_ALIGNED(16, const xmm_reg, ff_pw_5) = { 0x0005000500050005ULL, 0x0005000500050005ULL };
+DECLARE_ALIGNED(16, const xmm_reg, ff_pw_8) = { 0x0008000800080008ULL, 0x0008000800080008ULL };
+DECLARE_ALIGNED(16, const xmm_reg, ff_pw_9) = { 0x0009000900090009ULL, 0x0009000900090009ULL };
+DECLARE_ALIGNED(8, const uint64_t, ff_pw_15) = 0x000F000F000F000FULL;
+DECLARE_ALIGNED(16, const xmm_reg, ff_pw_16) = { 0x0010001000100010ULL, 0x0010001000100010ULL };
+DECLARE_ALIGNED(16, const xmm_reg, ff_pw_17) = { 0x0011001100110011ULL, 0x0011001100110011ULL };
+DECLARE_ALIGNED(16, const xmm_reg, ff_pw_18) = { 0x0012001200120012ULL, 0x0012001200120012ULL };
+DECLARE_ALIGNED(8, const uint64_t, ff_pw_20) = 0x0014001400140014ULL;
+DECLARE_ALIGNED(16, const xmm_reg, ff_pw_27) = { 0x001B001B001B001BULL, 0x001B001B001B001BULL };
+DECLARE_ALIGNED(16, const xmm_reg, ff_pw_28) = { 0x001C001C001C001CULL, 0x001C001C001C001CULL };
+DECLARE_ALIGNED(16, const xmm_reg, ff_pw_32) = { 0x0020002000200020ULL, 0x0020002000200020ULL };
+DECLARE_ALIGNED(8, const uint64_t, ff_pw_42) = 0x002A002A002A002AULL;
+DECLARE_ALIGNED(8, const uint64_t, ff_pw_53) = 0x0035003500350035ULL;
+DECLARE_ALIGNED(16, const xmm_reg, ff_pw_63) = { 0x003F003F003F003FULL, 0x003F003F003F003FULL };
+DECLARE_ALIGNED(16, const xmm_reg, ff_pw_64) = { 0x0040004000400040ULL, 0x0040004000400040ULL };
+DECLARE_ALIGNED(8, const uint64_t, ff_pw_96) = 0x0060006000600060ULL;
+DECLARE_ALIGNED(8, const uint64_t, ff_pw_128) = 0x0080008000800080ULL;
+DECLARE_ALIGNED(8, const uint64_t, ff_pw_255) = 0x00ff00ff00ff00ffULL;
+DECLARE_ALIGNED(16, const xmm_reg, ff_pw_512) = { 0x0200020002000200ULL, 0x0200020002000200ULL };
+DECLARE_ALIGNED(16, const xmm_reg, ff_pw_1019) = { 0x03FB03FB03FB03FBULL, 0x03FB03FB03FB03FBULL };
+
+DECLARE_ALIGNED(16, const xmm_reg, ff_pb_0) = { 0x0000000000000000ULL, 0x0000000000000000ULL };
+DECLARE_ALIGNED(16, const xmm_reg, ff_pb_1) = { 0x0101010101010101ULL, 0x0101010101010101ULL };
+DECLARE_ALIGNED(16, const xmm_reg, ff_pb_3) = { 0x0303030303030303ULL, 0x0303030303030303ULL };
+DECLARE_ALIGNED(16, const xmm_reg, ff_pb_4) = { 0x0404040404040404ULL, 0x0404040404040404ULL };
+DECLARE_ALIGNED(8, const uint64_t, ff_pb_7) = 0x0707070707070707ULL;
+DECLARE_ALIGNED(8, const uint64_t, ff_pb_1F) = 0x1F1F1F1F1F1F1F1FULL;
+DECLARE_ALIGNED(8, const uint64_t, ff_pb_3F) = 0x3F3F3F3F3F3F3F3FULL;
+DECLARE_ALIGNED(16, const xmm_reg, ff_pb_80) = { 0x8080808080808080ULL, 0x8080808080808080ULL };
+DECLARE_ALIGNED(8, const uint64_t, ff_pb_81) = 0x8181818181818181ULL;
+DECLARE_ALIGNED(16, const xmm_reg, ff_pb_A1) = { 0xA1A1A1A1A1A1A1A1ULL, 0xA1A1A1A1A1A1A1A1ULL };
+DECLARE_ALIGNED(16, const xmm_reg, ff_pb_F8) = { 0xF8F8F8F8F8F8F8F8ULL, 0xF8F8F8F8F8F8F8F8ULL };
+DECLARE_ALIGNED(8, const uint64_t, ff_pb_FC) = 0xFCFCFCFCFCFCFCFCULL;
+DECLARE_ALIGNED(16, const xmm_reg, ff_pb_FE) = { 0xFEFEFEFEFEFEFEFEULL, 0xFEFEFEFEFEFEFEFEULL };
DECLARE_ALIGNED(16, const double, ff_pd_1)[2] = { 1.0, 1.0 };
DECLARE_ALIGNED(16, const double, ff_pd_2)[2] = { 2.0, 2.0 };
-#define JUMPALIGN() __asm__ volatile (".p2align 3"::)
-#define MOVQ_ZERO(regd) __asm__ volatile ("pxor %%" #regd ", %%" #regd ::)
+#if HAVE_INLINE_ASM
+
+#define JUMPALIGN() __asm__ volatile (".p2align 3"::)
+#define MOVQ_ZERO(regd) __asm__ volatile ("pxor %%"#regd", %%"#regd ::)
-#define MOVQ_BFE(regd) \
- __asm__ volatile ( \
- "pcmpeqd %%" #regd ", %%" #regd " \n\t"\
- "paddb %%" #regd ", %%" #regd " \n\t" ::)
+#define MOVQ_BFE(regd) \
+ __asm__ volatile ( \
+ "pcmpeqd %%"#regd", %%"#regd" \n\t" \
+ "paddb %%"#regd", %%"#regd" \n\t" ::)
#ifndef PIC
-#define MOVQ_BONE(regd) __asm__ volatile ("movq %0, %%" #regd " \n\t" ::"m"(ff_bone))
-#define MOVQ_WTWO(regd) __asm__ volatile ("movq %0, %%" #regd " \n\t" ::"m"(ff_wtwo))
+#define MOVQ_BONE(regd) __asm__ volatile ("movq %0, %%"#regd" \n\t" :: "m"(ff_bone))
+#define MOVQ_WTWO(regd) __asm__ volatile ("movq %0, %%"#regd" \n\t" :: "m"(ff_wtwo))
#else
// for shared library it's better to use this way for accessing constants
// pcmpeqd -> -1
-#define MOVQ_BONE(regd) \
- __asm__ volatile ( \
- "pcmpeqd %%" #regd ", %%" #regd " \n\t" \
- "psrlw $15, %%" #regd " \n\t" \
- "packuswb %%" #regd ", %%" #regd " \n\t" ::)
-
-#define MOVQ_WTWO(regd) \
- __asm__ volatile ( \
- "pcmpeqd %%" #regd ", %%" #regd " \n\t" \
- "psrlw $15, %%" #regd " \n\t" \
- "psllw $1, %%" #regd " \n\t"::)
+#define MOVQ_BONE(regd) \
+ __asm__ volatile ( \
+ "pcmpeqd %%"#regd", %%"#regd" \n\t" \
+ "psrlw $15, %%"#regd" \n\t" \
+ "packuswb %%"#regd", %%"#regd" \n\t" ::)
+
+#define MOVQ_WTWO(regd) \
+ __asm__ volatile ( \
+ "pcmpeqd %%"#regd", %%"#regd" \n\t" \
+ "psrlw $15, %%"#regd" \n\t" \
+ "psllw $1, %%"#regd" \n\t"::)
#endif
// using regr as temporary and for the output result
// first argument is unmodifed and second is trashed
// regfe is supposed to contain 0xfefefefefefefefe
-#define PAVGB_MMX_NO_RND(rega, regb, regr, regfe) \
- "movq " #rega ", " #regr " \n\t"\
- "pand " #regb ", " #regr " \n\t"\
- "pxor " #rega ", " #regb " \n\t"\
- "pand " #regfe "," #regb " \n\t"\
- "psrlq $1, " #regb " \n\t"\
- "paddb " #regb ", " #regr " \n\t"
-
-#define PAVGB_MMX(rega, regb, regr, regfe) \
- "movq " #rega ", " #regr " \n\t"\
- "por " #regb ", " #regr " \n\t"\
- "pxor " #rega ", " #regb " \n\t"\
- "pand " #regfe "," #regb " \n\t"\
- "psrlq $1, " #regb " \n\t"\
- "psubb " #regb ", " #regr " \n\t"
+#define PAVGB_MMX_NO_RND(rega, regb, regr, regfe) \
+ "movq "#rega", "#regr" \n\t" \
+ "pand "#regb", "#regr" \n\t" \
+ "pxor "#rega", "#regb" \n\t" \
+ "pand "#regfe", "#regb" \n\t" \
+ "psrlq $1, "#regb" \n\t" \
+ "paddb "#regb", "#regr" \n\t"
+
+#define PAVGB_MMX(rega, regb, regr, regfe) \
+ "movq "#rega", "#regr" \n\t" \
+ "por "#regb", "#regr" \n\t" \
+ "pxor "#rega", "#regb" \n\t" \
+ "pand "#regfe", "#regb" \n\t" \
+ "psrlq $1, "#regb" \n\t" \
+ "psubb "#regb", "#regr" \n\t"
// mm6 is supposed to contain 0xfefefefefefefefe
-#define PAVGBP_MMX_NO_RND(rega, regb, regr, regc, regd, regp) \
- "movq " #rega ", " #regr " \n\t"\
- "movq " #regc ", " #regp " \n\t"\
- "pand " #regb ", " #regr " \n\t"\
- "pand " #regd ", " #regp " \n\t"\
- "pxor " #rega ", " #regb " \n\t"\
- "pxor " #regc ", " #regd " \n\t"\
- "pand %%mm6, " #regb " \n\t"\
- "pand %%mm6, " #regd " \n\t"\
- "psrlq $1, " #regb " \n\t"\
- "psrlq $1, " #regd " \n\t"\
- "paddb " #regb ", " #regr " \n\t"\
- "paddb " #regd ", " #regp " \n\t"
-
-#define PAVGBP_MMX(rega, regb, regr, regc, regd, regp) \
- "movq " #rega ", " #regr " \n\t"\
- "movq " #regc ", " #regp " \n\t"\
- "por " #regb ", " #regr " \n\t"\
- "por " #regd ", " #regp " \n\t"\
- "pxor " #rega ", " #regb " \n\t"\
- "pxor " #regc ", " #regd " \n\t"\
- "pand %%mm6, " #regb " \n\t"\
- "pand %%mm6, " #regd " \n\t"\
- "psrlq $1, " #regd " \n\t"\
- "psrlq $1, " #regb " \n\t"\
- "psubb " #regb ", " #regr " \n\t"\
- "psubb " #regd ", " #regp " \n\t"
+#define PAVGBP_MMX_NO_RND(rega, regb, regr, regc, regd, regp) \
+ "movq "#rega", "#regr" \n\t" \
+ "movq "#regc", "#regp" \n\t" \
+ "pand "#regb", "#regr" \n\t" \
+ "pand "#regd", "#regp" \n\t" \
+ "pxor "#rega", "#regb" \n\t" \
+ "pxor "#regc", "#regd" \n\t" \
+ "pand %%mm6, "#regb" \n\t" \
+ "pand %%mm6, "#regd" \n\t" \
+ "psrlq $1, "#regb" \n\t" \
+ "psrlq $1, "#regd" \n\t" \
+ "paddb "#regb", "#regr" \n\t" \
+ "paddb "#regd", "#regp" \n\t"
+
+#define PAVGBP_MMX(rega, regb, regr, regc, regd, regp) \
+ "movq "#rega", "#regr" \n\t" \
+ "movq "#regc", "#regp" \n\t" \
+ "por "#regb", "#regr" \n\t" \
+ "por "#regd", "#regp" \n\t" \
+ "pxor "#rega", "#regb" \n\t" \
+ "pxor "#regc", "#regd" \n\t" \
+ "pand %%mm6, "#regb" \n\t" \
+ "pand %%mm6, "#regd" \n\t" \
+ "psrlq $1, "#regd" \n\t" \
+ "psrlq $1, "#regb" \n\t" \
+ "psubb "#regb", "#regr" \n\t" \
+ "psubb "#regd", "#regp" \n\t"
/***********************************/
/* MMX no rounding */
-#define DEF(x, y) x ## _no_rnd_ ## y ##_mmx
+#define DEF(x, y) x ## _no_rnd_ ## y ## _mmx
#define SET_RND MOVQ_WONE
#define PAVGBP(a, b, c, d, e, f) PAVGBP_MMX_NO_RND(a, b, c, d, e, f)
#define PAVGB(a, b, c, e) PAVGB_MMX_NO_RND(a, b, c, e)
#define OP_AVG(a, b, c, e) PAVGB_MMX(a, b, c, e)
-#include "dsputil_mmx_rnd_template.c"
+#include "dsputil_rnd_template.c"
#undef DEF
#undef SET_RND
@@ -177,12 +178,12 @@ DECLARE_ALIGNED(16, const double, ff_pd_2)[2] = { 2.0, 2.0 };
/***********************************/
/* MMX rounding */
-#define DEF(x, y) x ## _ ## y ##_mmx
+#define DEF(x, y) x ## _ ## y ## _mmx
#define SET_RND MOVQ_WTWO
#define PAVGBP(a, b, c, d, e, f) PAVGBP_MMX(a, b, c, d, e, f)
#define PAVGB(a, b, c, e) PAVGB_MMX(a, b, c, e)
-#include "dsputil_mmx_rnd_template.c"
+#include "dsputil_rnd_template.c"
#undef DEF
#undef SET_RND
@@ -196,23 +197,25 @@ DECLARE_ALIGNED(16, const double, ff_pd_2)[2] = { 2.0, 2.0 };
#define DEF(x) x ## _3dnow
#define PAVGB "pavgusb"
#define OP_AVG PAVGB
+#define SKIP_FOR_3DNOW
-#include "dsputil_mmx_avg_template.c"
+#include "dsputil_avg_template.c"
#undef DEF
#undef PAVGB
#undef OP_AVG
+#undef SKIP_FOR_3DNOW
/***********************************/
-/* MMX2 specific */
+/* MMXEXT specific */
-#define DEF(x) x ## _mmx2
+#define DEF(x) x ## _mmxext
-/* Introduced only in MMX2 set */
+/* Introduced only in MMXEXT set */
#define PAVGB "pavgb"
#define OP_AVG PAVGB
-#include "dsputil_mmx_avg_template.c"
+#include "dsputil_avg_template.c"
#undef DEF
#undef PAVGB
@@ -220,573 +223,512 @@ DECLARE_ALIGNED(16, const double, ff_pd_2)[2] = { 2.0, 2.0 };
#define put_no_rnd_pixels16_mmx put_pixels16_mmx
#define put_no_rnd_pixels8_mmx put_pixels8_mmx
-#define put_pixels16_mmx2 put_pixels16_mmx
-#define put_pixels8_mmx2 put_pixels8_mmx
-#define put_pixels4_mmx2 put_pixels4_mmx
-#define put_no_rnd_pixels16_mmx2 put_no_rnd_pixels16_mmx
-#define put_no_rnd_pixels8_mmx2 put_no_rnd_pixels8_mmx
-#define put_pixels16_3dnow put_pixels16_mmx
-#define put_pixels8_3dnow put_pixels8_mmx
-#define put_pixels4_3dnow put_pixels4_mmx
-#define put_no_rnd_pixels16_3dnow put_no_rnd_pixels16_mmx
-#define put_no_rnd_pixels8_3dnow put_no_rnd_pixels8_mmx
+#define put_pixels16_mmxext put_pixels16_mmx
+#define put_pixels8_mmxext put_pixels8_mmx
+#define put_pixels4_mmxext put_pixels4_mmx
+#define put_no_rnd_pixels16_mmxext put_no_rnd_pixels16_mmx
+#define put_no_rnd_pixels8_mmxext put_no_rnd_pixels8_mmx
/***********************************/
/* standard MMX */
-void ff_put_pixels_clamped_mmx(const DCTELEM *block, uint8_t *pixels, int line_size)
+void ff_put_pixels_clamped_mmx(const DCTELEM *block, uint8_t *pixels,
+ int line_size)
{
const DCTELEM *p;
uint8_t *pix;
/* read the pixels */
- p = block;
+ p = block;
pix = pixels;
/* unrolled loop */
- __asm__ volatile(
- "movq %3, %%mm0 \n\t"
- "movq 8%3, %%mm1 \n\t"
- "movq 16%3, %%mm2 \n\t"
- "movq 24%3, %%mm3 \n\t"
- "movq 32%3, %%mm4 \n\t"
- "movq 40%3, %%mm5 \n\t"
- "movq 48%3, %%mm6 \n\t"
- "movq 56%3, %%mm7 \n\t"
- "packuswb %%mm1, %%mm0 \n\t"
- "packuswb %%mm3, %%mm2 \n\t"
- "packuswb %%mm5, %%mm4 \n\t"
- "packuswb %%mm7, %%mm6 \n\t"
- "movq %%mm0, (%0) \n\t"
- "movq %%mm2, (%0, %1) \n\t"
- "movq %%mm4, (%0, %1, 2) \n\t"
- "movq %%mm6, (%0, %2) \n\t"
- ::"r" (pix), "r" ((x86_reg)line_size), "r" ((x86_reg)line_size*3), "m"(*p)
- :"memory");
- pix += line_size*4;
- p += 32;
+ __asm__ volatile (
+ "movq (%3), %%mm0 \n\t"
+ "movq 8(%3), %%mm1 \n\t"
+ "movq 16(%3), %%mm2 \n\t"
+ "movq 24(%3), %%mm3 \n\t"
+ "movq 32(%3), %%mm4 \n\t"
+ "movq 40(%3), %%mm5 \n\t"
+ "movq 48(%3), %%mm6 \n\t"
+ "movq 56(%3), %%mm7 \n\t"
+ "packuswb %%mm1, %%mm0 \n\t"
+ "packuswb %%mm3, %%mm2 \n\t"
+ "packuswb %%mm5, %%mm4 \n\t"
+ "packuswb %%mm7, %%mm6 \n\t"
+ "movq %%mm0, (%0) \n\t"
+ "movq %%mm2, (%0, %1) \n\t"
+ "movq %%mm4, (%0, %1, 2) \n\t"
+ "movq %%mm6, (%0, %2) \n\t"
+ :: "r"(pix), "r"((x86_reg)line_size), "r"((x86_reg)line_size * 3),
+ "r"(p)
+ : "memory");
+ pix += line_size * 4;
+ p += 32;
// if here would be an exact copy of the code above
// compiler would generate some very strange code
// thus using "r"
- __asm__ volatile(
- "movq (%3), %%mm0 \n\t"
- "movq 8(%3), %%mm1 \n\t"
- "movq 16(%3), %%mm2 \n\t"
- "movq 24(%3), %%mm3 \n\t"
- "movq 32(%3), %%mm4 \n\t"
- "movq 40(%3), %%mm5 \n\t"
- "movq 48(%3), %%mm6 \n\t"
- "movq 56(%3), %%mm7 \n\t"
- "packuswb %%mm1, %%mm0 \n\t"
- "packuswb %%mm3, %%mm2 \n\t"
- "packuswb %%mm5, %%mm4 \n\t"
- "packuswb %%mm7, %%mm6 \n\t"
- "movq %%mm0, (%0) \n\t"
- "movq %%mm2, (%0, %1) \n\t"
- "movq %%mm4, (%0, %1, 2) \n\t"
- "movq %%mm6, (%0, %2) \n\t"
- ::"r" (pix), "r" ((x86_reg)line_size), "r" ((x86_reg)line_size*3), "r"(p)
- :"memory");
+ __asm__ volatile (
+ "movq (%3), %%mm0 \n\t"
+ "movq 8(%3), %%mm1 \n\t"
+ "movq 16(%3), %%mm2 \n\t"
+ "movq 24(%3), %%mm3 \n\t"
+ "movq 32(%3), %%mm4 \n\t"
+ "movq 40(%3), %%mm5 \n\t"
+ "movq 48(%3), %%mm6 \n\t"
+ "movq 56(%3), %%mm7 \n\t"
+ "packuswb %%mm1, %%mm0 \n\t"
+ "packuswb %%mm3, %%mm2 \n\t"
+ "packuswb %%mm5, %%mm4 \n\t"
+ "packuswb %%mm7, %%mm6 \n\t"
+ "movq %%mm0, (%0) \n\t"
+ "movq %%mm2, (%0, %1) \n\t"
+ "movq %%mm4, (%0, %1, 2) \n\t"
+ "movq %%mm6, (%0, %2) \n\t"
+ :: "r"(pix), "r"((x86_reg)line_size), "r"((x86_reg)line_size * 3), "r"(p)
+ : "memory");
}
-#define put_signed_pixels_clamped_mmx_half(off) \
- "movq "#off"(%2), %%mm1 \n\t"\
- "movq 16+"#off"(%2), %%mm2 \n\t"\
- "movq 32+"#off"(%2), %%mm3 \n\t"\
- "movq 48+"#off"(%2), %%mm4 \n\t"\
- "packsswb 8+"#off"(%2), %%mm1 \n\t"\
- "packsswb 24+"#off"(%2), %%mm2 \n\t"\
- "packsswb 40+"#off"(%2), %%mm3 \n\t"\
- "packsswb 56+"#off"(%2), %%mm4 \n\t"\
- "paddb %%mm0, %%mm1 \n\t"\
- "paddb %%mm0, %%mm2 \n\t"\
- "paddb %%mm0, %%mm3 \n\t"\
- "paddb %%mm0, %%mm4 \n\t"\
- "movq %%mm1, (%0) \n\t"\
- "movq %%mm2, (%0, %3) \n\t"\
- "movq %%mm3, (%0, %3, 2) \n\t"\
- "movq %%mm4, (%0, %1) \n\t"
-
-void ff_put_signed_pixels_clamped_mmx(const DCTELEM *block, uint8_t *pixels, int line_size)
+#define put_signed_pixels_clamped_mmx_half(off) \
+ "movq "#off"(%2), %%mm1 \n\t" \
+ "movq 16 + "#off"(%2), %%mm2 \n\t" \
+ "movq 32 + "#off"(%2), %%mm3 \n\t" \
+ "movq 48 + "#off"(%2), %%mm4 \n\t" \
+ "packsswb 8 + "#off"(%2), %%mm1 \n\t" \
+ "packsswb 24 + "#off"(%2), %%mm2 \n\t" \
+ "packsswb 40 + "#off"(%2), %%mm3 \n\t" \
+ "packsswb 56 + "#off"(%2), %%mm4 \n\t" \
+ "paddb %%mm0, %%mm1 \n\t" \
+ "paddb %%mm0, %%mm2 \n\t" \
+ "paddb %%mm0, %%mm3 \n\t" \
+ "paddb %%mm0, %%mm4 \n\t" \
+ "movq %%mm1, (%0) \n\t" \
+ "movq %%mm2, (%0, %3) \n\t" \
+ "movq %%mm3, (%0, %3, 2) \n\t" \
+ "movq %%mm4, (%0, %1) \n\t"
+
+void ff_put_signed_pixels_clamped_mmx(const DCTELEM *block, uint8_t *pixels,
+ int line_size)
{
x86_reg line_skip = line_size;
x86_reg line_skip3;
__asm__ volatile (
- "movq "MANGLE(ff_pb_80)", %%mm0 \n\t"
- "lea (%3, %3, 2), %1 \n\t"
- put_signed_pixels_clamped_mmx_half(0)
- "lea (%0, %3, 4), %0 \n\t"
- put_signed_pixels_clamped_mmx_half(64)
- :"+&r" (pixels), "=&r" (line_skip3)
- :"r" (block), "r"(line_skip)
- :"memory");
+ "movq "MANGLE(ff_pb_80)", %%mm0 \n\t"
+ "lea (%3, %3, 2), %1 \n\t"
+ put_signed_pixels_clamped_mmx_half(0)
+ "lea (%0, %3, 4), %0 \n\t"
+ put_signed_pixels_clamped_mmx_half(64)
+ : "+&r"(pixels), "=&r"(line_skip3)
+ : "r"(block), "r"(line_skip)
+ : "memory");
}
-void ff_add_pixels_clamped_mmx(const DCTELEM *block, uint8_t *pixels, int line_size)
+void ff_add_pixels_clamped_mmx(const DCTELEM *block, uint8_t *pixels,
+ int line_size)
{
const DCTELEM *p;
uint8_t *pix;
int i;
/* read the pixels */
- p = block;
+ p = block;
pix = pixels;
MOVQ_ZERO(mm7);
i = 4;
do {
- __asm__ volatile(
- "movq (%2), %%mm0 \n\t"
- "movq 8(%2), %%mm1 \n\t"
- "movq 16(%2), %%mm2 \n\t"
- "movq 24(%2), %%mm3 \n\t"
- "movq %0, %%mm4 \n\t"
- "movq %1, %%mm6 \n\t"
- "movq %%mm4, %%mm5 \n\t"
- "punpcklbw %%mm7, %%mm4 \n\t"
- "punpckhbw %%mm7, %%mm5 \n\t"
- "paddsw %%mm4, %%mm0 \n\t"
- "paddsw %%mm5, %%mm1 \n\t"
- "movq %%mm6, %%mm5 \n\t"
- "punpcklbw %%mm7, %%mm6 \n\t"
- "punpckhbw %%mm7, %%mm5 \n\t"
- "paddsw %%mm6, %%mm2 \n\t"
- "paddsw %%mm5, %%mm3 \n\t"
- "packuswb %%mm1, %%mm0 \n\t"
- "packuswb %%mm3, %%mm2 \n\t"
- "movq %%mm0, %0 \n\t"
- "movq %%mm2, %1 \n\t"
- :"+m"(*pix), "+m"(*(pix+line_size))
- :"r"(p)
- :"memory");
- pix += line_size*2;
- p += 16;
+ __asm__ volatile (
+ "movq (%2), %%mm0 \n\t"
+ "movq 8(%2), %%mm1 \n\t"
+ "movq 16(%2), %%mm2 \n\t"
+ "movq 24(%2), %%mm3 \n\t"
+ "movq %0, %%mm4 \n\t"
+ "movq %1, %%mm6 \n\t"
+ "movq %%mm4, %%mm5 \n\t"
+ "punpcklbw %%mm7, %%mm4 \n\t"
+ "punpckhbw %%mm7, %%mm5 \n\t"
+ "paddsw %%mm4, %%mm0 \n\t"
+ "paddsw %%mm5, %%mm1 \n\t"
+ "movq %%mm6, %%mm5 \n\t"
+ "punpcklbw %%mm7, %%mm6 \n\t"
+ "punpckhbw %%mm7, %%mm5 \n\t"
+ "paddsw %%mm6, %%mm2 \n\t"
+ "paddsw %%mm5, %%mm3 \n\t"
+ "packuswb %%mm1, %%mm0 \n\t"
+ "packuswb %%mm3, %%mm2 \n\t"
+ "movq %%mm0, %0 \n\t"
+ "movq %%mm2, %1 \n\t"
+ : "+m"(*pix), "+m"(*(pix + line_size))
+ : "r"(p)
+ : "memory");
+ pix += line_size * 2;
+ p += 16;
} while (--i);
}
-static void put_pixels4_mmx(uint8_t *block, const uint8_t *pixels, int line_size, int h)
-{
- __asm__ volatile(
- "lea (%3, %3), %%"REG_a" \n\t"
- ".p2align 3 \n\t"
- "1: \n\t"
- "movd (%1), %%mm0 \n\t"
- "movd (%1, %3), %%mm1 \n\t"
- "movd %%mm0, (%2) \n\t"
- "movd %%mm1, (%2, %3) \n\t"
- "add %%"REG_a", %1 \n\t"
- "add %%"REG_a", %2 \n\t"
- "movd (%1), %%mm0 \n\t"
- "movd (%1, %3), %%mm1 \n\t"
- "movd %%mm0, (%2) \n\t"
- "movd %%mm1, (%2, %3) \n\t"
- "add %%"REG_a", %1 \n\t"
- "add %%"REG_a", %2 \n\t"
- "subl $4, %0 \n\t"
- "jnz 1b \n\t"
- : "+g"(h), "+r" (pixels), "+r" (block)
- : "r"((x86_reg)line_size)
- : "%"REG_a, "memory"
- );
-}
-
-static void put_pixels8_mmx(uint8_t *block, const uint8_t *pixels, int line_size, int h)
-{
- __asm__ volatile(
- "lea (%3, %3), %%"REG_a" \n\t"
- ".p2align 3 \n\t"
- "1: \n\t"
- "movq (%1), %%mm0 \n\t"
- "movq (%1, %3), %%mm1 \n\t"
- "movq %%mm0, (%2) \n\t"
- "movq %%mm1, (%2, %3) \n\t"
- "add %%"REG_a", %1 \n\t"
- "add %%"REG_a", %2 \n\t"
- "movq (%1), %%mm0 \n\t"
- "movq (%1, %3), %%mm1 \n\t"
- "movq %%mm0, (%2) \n\t"
- "movq %%mm1, (%2, %3) \n\t"
- "add %%"REG_a", %1 \n\t"
- "add %%"REG_a", %2 \n\t"
- "subl $4, %0 \n\t"
- "jnz 1b \n\t"
- : "+g"(h), "+r" (pixels), "+r" (block)
- : "r"((x86_reg)line_size)
- : "%"REG_a, "memory"
- );
-}
-
-static void put_pixels16_mmx(uint8_t *block, const uint8_t *pixels, int line_size, int h)
+static void put_pixels8_mmx(uint8_t *block, const uint8_t *pixels,
+ int line_size, int h)
{
- __asm__ volatile(
- "lea (%3, %3), %%"REG_a" \n\t"
- ".p2align 3 \n\t"
- "1: \n\t"
- "movq (%1), %%mm0 \n\t"
- "movq 8(%1), %%mm4 \n\t"
- "movq (%1, %3), %%mm1 \n\t"
- "movq 8(%1, %3), %%mm5 \n\t"
- "movq %%mm0, (%2) \n\t"
- "movq %%mm4, 8(%2) \n\t"
- "movq %%mm1, (%2, %3) \n\t"
- "movq %%mm5, 8(%2, %3) \n\t"
- "add %%"REG_a", %1 \n\t"
- "add %%"REG_a", %2 \n\t"
- "movq (%1), %%mm0 \n\t"
- "movq 8(%1), %%mm4 \n\t"
- "movq (%1, %3), %%mm1 \n\t"
- "movq 8(%1, %3), %%mm5 \n\t"
- "movq %%mm0, (%2) \n\t"
- "movq %%mm4, 8(%2) \n\t"
- "movq %%mm1, (%2, %3) \n\t"
- "movq %%mm5, 8(%2, %3) \n\t"
- "add %%"REG_a", %1 \n\t"
- "add %%"REG_a", %2 \n\t"
- "subl $4, %0 \n\t"
- "jnz 1b \n\t"
- : "+g"(h), "+r" (pixels), "+r" (block)
- : "r"((x86_reg)line_size)
- : "%"REG_a, "memory"
- );
-}
-
-static void put_pixels16_sse2(uint8_t *block, const uint8_t *pixels, int line_size, int h)
-{
- __asm__ volatile(
- "1: \n\t"
- "movdqu (%1), %%xmm0 \n\t"
- "movdqu (%1,%3), %%xmm1 \n\t"
- "movdqu (%1,%3,2), %%xmm2 \n\t"
- "movdqu (%1,%4), %%xmm3 \n\t"
- "lea (%1,%3,4), %1 \n\t"
- "movdqa %%xmm0, (%2) \n\t"
- "movdqa %%xmm1, (%2,%3) \n\t"
- "movdqa %%xmm2, (%2,%3,2) \n\t"
- "movdqa %%xmm3, (%2,%4) \n\t"
- "subl $4, %0 \n\t"
- "lea (%2,%3,4), %2 \n\t"
- "jnz 1b \n\t"
- : "+g"(h), "+r" (pixels), "+r" (block)
- : "r"((x86_reg)line_size), "r"((x86_reg)3L*line_size)
- : "memory"
+ __asm__ volatile (
+ "lea (%3, %3), %%"REG_a" \n\t"
+ ".p2align 3 \n\t"
+ "1: \n\t"
+ "movq (%1 ), %%mm0 \n\t"
+ "movq (%1, %3), %%mm1 \n\t"
+ "movq %%mm0, (%2) \n\t"
+ "movq %%mm1, (%2, %3) \n\t"
+ "add %%"REG_a", %1 \n\t"
+ "add %%"REG_a", %2 \n\t"
+ "movq (%1 ), %%mm0 \n\t"
+ "movq (%1, %3), %%mm1 \n\t"
+ "movq %%mm0, (%2) \n\t"
+ "movq %%mm1, (%2, %3) \n\t"
+ "add %%"REG_a", %1 \n\t"
+ "add %%"REG_a", %2 \n\t"
+ "subl $4, %0 \n\t"
+ "jnz 1b \n\t"
+ : "+g"(h), "+r"(pixels), "+r"(block)
+ : "r"((x86_reg)line_size)
+ : "%"REG_a, "memory"
);
}
-static void avg_pixels16_sse2(uint8_t *block, const uint8_t *pixels, int line_size, int h)
+static void put_pixels16_mmx(uint8_t *block, const uint8_t *pixels,
+ int line_size, int h)
{
- __asm__ volatile(
- "1: \n\t"
- "movdqu (%1), %%xmm0 \n\t"
- "movdqu (%1,%3), %%xmm1 \n\t"
- "movdqu (%1,%3,2), %%xmm2 \n\t"
- "movdqu (%1,%4), %%xmm3 \n\t"
- "lea (%1,%3,4), %1 \n\t"
- "pavgb (%2), %%xmm0 \n\t"
- "pavgb (%2,%3), %%xmm1 \n\t"
- "pavgb (%2,%3,2), %%xmm2 \n\t"
- "pavgb (%2,%4), %%xmm3 \n\t"
- "movdqa %%xmm0, (%2) \n\t"
- "movdqa %%xmm1, (%2,%3) \n\t"
- "movdqa %%xmm2, (%2,%3,2) \n\t"
- "movdqa %%xmm3, (%2,%4) \n\t"
- "subl $4, %0 \n\t"
- "lea (%2,%3,4), %2 \n\t"
- "jnz 1b \n\t"
- : "+g"(h), "+r" (pixels), "+r" (block)
- : "r"((x86_reg)line_size), "r"((x86_reg)3L*line_size)
- : "memory"
+ __asm__ volatile (
+ "lea (%3, %3), %%"REG_a" \n\t"
+ ".p2align 3 \n\t"
+ "1: \n\t"
+ "movq (%1 ), %%mm0 \n\t"
+ "movq 8(%1 ), %%mm4 \n\t"
+ "movq (%1, %3), %%mm1 \n\t"
+ "movq 8(%1, %3), %%mm5 \n\t"
+ "movq %%mm0, (%2) \n\t"
+ "movq %%mm4, 8(%2) \n\t"
+ "movq %%mm1, (%2, %3) \n\t"
+ "movq %%mm5, 8(%2, %3) \n\t"
+ "add %%"REG_a", %1 \n\t"
+ "add %%"REG_a", %2 \n\t"
+ "movq (%1 ), %%mm0 \n\t"
+ "movq 8(%1 ), %%mm4 \n\t"
+ "movq (%1, %3), %%mm1 \n\t"
+ "movq 8(%1, %3), %%mm5 \n\t"
+ "movq %%mm0, (%2) \n\t"
+ "movq %%mm4, 8(%2) \n\t"
+ "movq %%mm1, (%2, %3) \n\t"
+ "movq %%mm5, 8(%2, %3) \n\t"
+ "add %%"REG_a", %1 \n\t"
+ "add %%"REG_a", %2 \n\t"
+ "subl $4, %0 \n\t"
+ "jnz 1b \n\t"
+ : "+g"(h), "+r"(pixels), "+r"(block)
+ : "r"((x86_reg)line_size)
+ : "%"REG_a, "memory"
);
}
-#define CLEAR_BLOCKS(name,n) \
-static void name(DCTELEM *blocks)\
-{\
- __asm__ volatile(\
- "pxor %%mm7, %%mm7 \n\t"\
- "mov %1, %%"REG_a" \n\t"\
- "1: \n\t"\
- "movq %%mm7, (%0, %%"REG_a") \n\t"\
- "movq %%mm7, 8(%0, %%"REG_a") \n\t"\
- "movq %%mm7, 16(%0, %%"REG_a") \n\t"\
- "movq %%mm7, 24(%0, %%"REG_a") \n\t"\
- "add $32, %%"REG_a" \n\t"\
- " js 1b \n\t"\
- : : "r" (((uint8_t *)blocks)+128*n),\
- "i" (-128*n)\
- : "%"REG_a\
- );\
+#define CLEAR_BLOCKS(name, n) \
+static void name(DCTELEM *blocks) \
+{ \
+ __asm__ volatile ( \
+ "pxor %%mm7, %%mm7 \n\t" \
+ "mov %1, %%"REG_a" \n\t" \
+ "1: \n\t" \
+ "movq %%mm7, (%0, %%"REG_a") \n\t" \
+ "movq %%mm7, 8(%0, %%"REG_a") \n\t" \
+ "movq %%mm7, 16(%0, %%"REG_a") \n\t" \
+ "movq %%mm7, 24(%0, %%"REG_a") \n\t" \
+ "add $32, %%"REG_a" \n\t" \
+ "js 1b \n\t" \
+ :: "r"(((uint8_t *)blocks) + 128 * n), \
+ "i"(-128 * n) \
+ : "%"REG_a \
+ ); \
}
CLEAR_BLOCKS(clear_blocks_mmx, 6)
CLEAR_BLOCKS(clear_block_mmx, 1)
static void clear_block_sse(DCTELEM *block)
{
- __asm__ volatile(
- "xorps %%xmm0, %%xmm0 \n"
- "movaps %%xmm0, (%0) \n"
- "movaps %%xmm0, 16(%0) \n"
- "movaps %%xmm0, 32(%0) \n"
- "movaps %%xmm0, 48(%0) \n"
- "movaps %%xmm0, 64(%0) \n"
- "movaps %%xmm0, 80(%0) \n"
- "movaps %%xmm0, 96(%0) \n"
- "movaps %%xmm0, 112(%0) \n"
+ __asm__ volatile (
+ "xorps %%xmm0, %%xmm0 \n"
+ "movaps %%xmm0, (%0) \n"
+ "movaps %%xmm0, 16(%0) \n"
+ "movaps %%xmm0, 32(%0) \n"
+ "movaps %%xmm0, 48(%0) \n"
+ "movaps %%xmm0, 64(%0) \n"
+ "movaps %%xmm0, 80(%0) \n"
+ "movaps %%xmm0, 96(%0) \n"
+ "movaps %%xmm0, 112(%0) \n"
:: "r"(block)
: "memory"
);
}
static void clear_blocks_sse(DCTELEM *blocks)
-{\
- __asm__ volatile(
- "xorps %%xmm0, %%xmm0 \n"
- "mov %1, %%"REG_a" \n"
- "1: \n"
- "movaps %%xmm0, (%0, %%"REG_a") \n"
- "movaps %%xmm0, 16(%0, %%"REG_a") \n"
- "movaps %%xmm0, 32(%0, %%"REG_a") \n"
- "movaps %%xmm0, 48(%0, %%"REG_a") \n"
- "movaps %%xmm0, 64(%0, %%"REG_a") \n"
- "movaps %%xmm0, 80(%0, %%"REG_a") \n"
- "movaps %%xmm0, 96(%0, %%"REG_a") \n"
- "movaps %%xmm0, 112(%0, %%"REG_a") \n"
- "add $128, %%"REG_a" \n"
- " js 1b \n"
- : : "r" (((uint8_t *)blocks)+128*6),
- "i" (-128*6)
+{
+ __asm__ volatile (
+ "xorps %%xmm0, %%xmm0 \n"
+ "mov %1, %%"REG_a" \n"
+ "1: \n"
+ "movaps %%xmm0, (%0, %%"REG_a") \n"
+ "movaps %%xmm0, 16(%0, %%"REG_a") \n"
+ "movaps %%xmm0, 32(%0, %%"REG_a") \n"
+ "movaps %%xmm0, 48(%0, %%"REG_a") \n"
+ "movaps %%xmm0, 64(%0, %%"REG_a") \n"
+ "movaps %%xmm0, 80(%0, %%"REG_a") \n"
+ "movaps %%xmm0, 96(%0, %%"REG_a") \n"
+ "movaps %%xmm0, 112(%0, %%"REG_a") \n"
+ "add $128, %%"REG_a" \n"
+ "js 1b \n"
+ :: "r"(((uint8_t *)blocks) + 128 * 6),
+ "i"(-128 * 6)
: "%"REG_a
);
}
-static void add_bytes_mmx(uint8_t *dst, uint8_t *src, int w){
- x86_reg i=0;
- __asm__ volatile(
- "jmp 2f \n\t"
- "1: \n\t"
- "movq (%1, %0), %%mm0 \n\t"
- "movq (%2, %0), %%mm1 \n\t"
- "paddb %%mm0, %%mm1 \n\t"
- "movq %%mm1, (%2, %0) \n\t"
- "movq 8(%1, %0), %%mm0 \n\t"
- "movq 8(%2, %0), %%mm1 \n\t"
- "paddb %%mm0, %%mm1 \n\t"
- "movq %%mm1, 8(%2, %0) \n\t"
- "add $16, %0 \n\t"
- "2: \n\t"
- "cmp %3, %0 \n\t"
- " js 1b \n\t"
- : "+r" (i)
- : "r"(src), "r"(dst), "r"((x86_reg)w-15)
- );
- for(; i<w; i++)
- dst[i+0] += src[i+0];
-}
-
-static void add_bytes_l2_mmx(uint8_t *dst, uint8_t *src1, uint8_t *src2, int w){
- x86_reg i=0;
- __asm__ volatile(
- "jmp 2f \n\t"
+static void add_bytes_mmx(uint8_t *dst, uint8_t *src, int w)
+{
+ x86_reg i = 0;
+ __asm__ volatile (
+ "jmp 2f \n\t"
"1: \n\t"
- "movq (%2, %0), %%mm0 \n\t"
+ "movq (%1, %0), %%mm0 \n\t"
+ "movq (%2, %0), %%mm1 \n\t"
+ "paddb %%mm0, %%mm1 \n\t"
+ "movq %%mm1, (%2, %0) \n\t"
+ "movq 8(%1, %0), %%mm0 \n\t"
"movq 8(%2, %0), %%mm1 \n\t"
- "paddb (%3, %0), %%mm0 \n\t"
- "paddb 8(%3, %0), %%mm1 \n\t"
- "movq %%mm0, (%1, %0) \n\t"
- "movq %%mm1, 8(%1, %0) \n\t"
- "add $16, %0 \n\t"
+ "paddb %%mm0, %%mm1 \n\t"
+ "movq %%mm1, 8(%2, %0) \n\t"
+ "add $16, %0 \n\t"
"2: \n\t"
- "cmp %4, %0 \n\t"
- " js 1b \n\t"
- : "+r" (i)
- : "r"(dst), "r"(src1), "r"(src2), "r"((x86_reg)w-15)
+ "cmp %3, %0 \n\t"
+ "js 1b \n\t"
+ : "+r"(i)
+ : "r"(src), "r"(dst), "r"((x86_reg)w - 15)
);
- for(; i<w; i++)
- dst[i] = src1[i] + src2[i];
+ for ( ; i < w; i++)
+ dst[i + 0] += src[i + 0];
}
#if HAVE_7REGS
-static void add_hfyu_median_prediction_cmov(uint8_t *dst, const uint8_t *top, const uint8_t *diff, int w, int *left, int *left_top) {
+static void add_hfyu_median_prediction_cmov(uint8_t *dst, const uint8_t *top,
+ const uint8_t *diff, int w,
+ int *left, int *left_top)
+{
x86_reg w2 = -w;
x86_reg x;
- int l = *left & 0xff;
+ int l = *left & 0xff;
int tl = *left_top & 0xff;
int t;
- __asm__ volatile(
- "mov %7, %3 \n"
- "1: \n"
- "movzbl (%3,%4), %2 \n"
- "mov %2, %k3 \n"
- "sub %b1, %b3 \n"
- "add %b0, %b3 \n"
- "mov %2, %1 \n"
- "cmp %0, %2 \n"
- "cmovg %0, %2 \n"
- "cmovg %1, %0 \n"
- "cmp %k3, %0 \n"
- "cmovg %k3, %0 \n"
- "mov %7, %3 \n"
- "cmp %2, %0 \n"
- "cmovl %2, %0 \n"
- "add (%6,%4), %b0 \n"
- "mov %b0, (%5,%4) \n"
- "inc %4 \n"
- "jl 1b \n"
- :"+&q"(l), "+&q"(tl), "=&r"(t), "=&q"(x), "+&r"(w2)
- :"r"(dst+w), "r"(diff+w), "rm"(top+w)
+ __asm__ volatile (
+ "mov %7, %3 \n"
+ "1: \n"
+ "movzbl (%3, %4), %2 \n"
+ "mov %2, %k3 \n"
+ "sub %b1, %b3 \n"
+ "add %b0, %b3 \n"
+ "mov %2, %1 \n"
+ "cmp %0, %2 \n"
+ "cmovg %0, %2 \n"
+ "cmovg %1, %0 \n"
+ "cmp %k3, %0 \n"
+ "cmovg %k3, %0 \n"
+ "mov %7, %3 \n"
+ "cmp %2, %0 \n"
+ "cmovl %2, %0 \n"
+ "add (%6, %4), %b0 \n"
+ "mov %b0, (%5, %4) \n"
+ "inc %4 \n"
+ "jl 1b \n"
+ : "+&q"(l), "+&q"(tl), "=&r"(t), "=&q"(x), "+&r"(w2)
+ : "r"(dst + w), "r"(diff + w), "rm"(top + w)
);
- *left = l;
+ *left = l;
*left_top = tl;
}
#endif
-#define H263_LOOP_FILTER \
- "pxor %%mm7, %%mm7 \n\t"\
- "movq %0, %%mm0 \n\t"\
- "movq %0, %%mm1 \n\t"\
- "movq %3, %%mm2 \n\t"\
- "movq %3, %%mm3 \n\t"\
- "punpcklbw %%mm7, %%mm0 \n\t"\
- "punpckhbw %%mm7, %%mm1 \n\t"\
- "punpcklbw %%mm7, %%mm2 \n\t"\
- "punpckhbw %%mm7, %%mm3 \n\t"\
- "psubw %%mm2, %%mm0 \n\t"\
- "psubw %%mm3, %%mm1 \n\t"\
- "movq %1, %%mm2 \n\t"\
- "movq %1, %%mm3 \n\t"\
- "movq %2, %%mm4 \n\t"\
- "movq %2, %%mm5 \n\t"\
- "punpcklbw %%mm7, %%mm2 \n\t"\
- "punpckhbw %%mm7, %%mm3 \n\t"\
- "punpcklbw %%mm7, %%mm4 \n\t"\
- "punpckhbw %%mm7, %%mm5 \n\t"\
- "psubw %%mm2, %%mm4 \n\t"\
- "psubw %%mm3, %%mm5 \n\t"\
- "psllw $2, %%mm4 \n\t"\
- "psllw $2, %%mm5 \n\t"\
- "paddw %%mm0, %%mm4 \n\t"\
- "paddw %%mm1, %%mm5 \n\t"\
- "pxor %%mm6, %%mm6 \n\t"\
- "pcmpgtw %%mm4, %%mm6 \n\t"\
- "pcmpgtw %%mm5, %%mm7 \n\t"\
- "pxor %%mm6, %%mm4 \n\t"\
- "pxor %%mm7, %%mm5 \n\t"\
- "psubw %%mm6, %%mm4 \n\t"\
- "psubw %%mm7, %%mm5 \n\t"\
- "psrlw $3, %%mm4 \n\t"\
- "psrlw $3, %%mm5 \n\t"\
- "packuswb %%mm5, %%mm4 \n\t"\
- "packsswb %%mm7, %%mm6 \n\t"\
- "pxor %%mm7, %%mm7 \n\t"\
- "movd %4, %%mm2 \n\t"\
- "punpcklbw %%mm2, %%mm2 \n\t"\
- "punpcklbw %%mm2, %%mm2 \n\t"\
- "punpcklbw %%mm2, %%mm2 \n\t"\
- "psubusb %%mm4, %%mm2 \n\t"\
- "movq %%mm2, %%mm3 \n\t"\
- "psubusb %%mm4, %%mm3 \n\t"\
- "psubb %%mm3, %%mm2 \n\t"\
- "movq %1, %%mm3 \n\t"\
- "movq %2, %%mm4 \n\t"\
- "pxor %%mm6, %%mm3 \n\t"\
- "pxor %%mm6, %%mm4 \n\t"\
- "paddusb %%mm2, %%mm3 \n\t"\
- "psubusb %%mm2, %%mm4 \n\t"\
- "pxor %%mm6, %%mm3 \n\t"\
- "pxor %%mm6, %%mm4 \n\t"\
- "paddusb %%mm2, %%mm2 \n\t"\
- "packsswb %%mm1, %%mm0 \n\t"\
- "pcmpgtb %%mm0, %%mm7 \n\t"\
- "pxor %%mm7, %%mm0 \n\t"\
- "psubb %%mm7, %%mm0 \n\t"\
- "movq %%mm0, %%mm1 \n\t"\
- "psubusb %%mm2, %%mm0 \n\t"\
- "psubb %%mm0, %%mm1 \n\t"\
- "pand %5, %%mm1 \n\t"\
- "psrlw $2, %%mm1 \n\t"\
- "pxor %%mm7, %%mm1 \n\t"\
- "psubb %%mm7, %%mm1 \n\t"\
- "movq %0, %%mm5 \n\t"\
- "movq %3, %%mm6 \n\t"\
- "psubb %%mm1, %%mm5 \n\t"\
- "paddb %%mm1, %%mm6 \n\t"
-
-static void h263_v_loop_filter_mmx(uint8_t *src, int stride, int qscale){
- if(CONFIG_H263_DECODER || CONFIG_H263_ENCODER) {
- const int strength= ff_h263_loop_filter_strength[qscale];
-
- __asm__ volatile(
-
- H263_LOOP_FILTER
-
- "movq %%mm3, %1 \n\t"
- "movq %%mm4, %2 \n\t"
- "movq %%mm5, %0 \n\t"
- "movq %%mm6, %3 \n\t"
- : "+m" (*(uint64_t*)(src - 2*stride)),
- "+m" (*(uint64_t*)(src - 1*stride)),
- "+m" (*(uint64_t*)(src + 0*stride)),
- "+m" (*(uint64_t*)(src + 1*stride))
- : "g" (2*strength), "m"(ff_pb_FC)
+static inline void transpose4x4(uint8_t *dst, uint8_t *src, x86_reg dst_stride, x86_reg src_stride){
+ __asm__ volatile( //FIXME could save 1 instruction if done as 8x4 ...
+ "movd (%1), %%mm0 \n\t"
+ "add %3, %1 \n\t"
+ "movd (%1), %%mm1 \n\t"
+ "movd (%1,%3,1), %%mm2 \n\t"
+ "movd (%1,%3,2), %%mm3 \n\t"
+ "punpcklbw %%mm1, %%mm0 \n\t"
+ "punpcklbw %%mm3, %%mm2 \n\t"
+ "movq %%mm0, %%mm1 \n\t"
+ "punpcklwd %%mm2, %%mm0 \n\t"
+ "punpckhwd %%mm2, %%mm1 \n\t"
+ "movd %%mm0, (%0) \n\t"
+ "add %2, %0 \n\t"
+ "punpckhdq %%mm0, %%mm0 \n\t"
+ "movd %%mm0, (%0) \n\t"
+ "movd %%mm1, (%0,%2,1) \n\t"
+ "punpckhdq %%mm1, %%mm1 \n\t"
+ "movd %%mm1, (%0,%2,2) \n\t"
+
+ : "+&r" (dst),
+ "+&r" (src)
+ : "r" (dst_stride),
+ "r" (src_stride)
+ : "memory"
);
- }
}
-static void h263_h_loop_filter_mmx(uint8_t *src, int stride, int qscale){
- if(CONFIG_H263_DECODER || CONFIG_H263_ENCODER) {
- const int strength= ff_h263_loop_filter_strength[qscale];
- DECLARE_ALIGNED(8, uint64_t, temp)[4];
- uint8_t *btemp= (uint8_t*)temp;
-
- src -= 2;
-
- transpose4x4(btemp , src , 8, stride);
- transpose4x4(btemp+4, src + 4*stride, 8, stride);
- __asm__ volatile(
- H263_LOOP_FILTER // 5 3 4 6
+#define H263_LOOP_FILTER \
+ "pxor %%mm7, %%mm7 \n\t" \
+ "movq %0, %%mm0 \n\t" \
+ "movq %0, %%mm1 \n\t" \
+ "movq %3, %%mm2 \n\t" \
+ "movq %3, %%mm3 \n\t" \
+ "punpcklbw %%mm7, %%mm0 \n\t" \
+ "punpckhbw %%mm7, %%mm1 \n\t" \
+ "punpcklbw %%mm7, %%mm2 \n\t" \
+ "punpckhbw %%mm7, %%mm3 \n\t" \
+ "psubw %%mm2, %%mm0 \n\t" \
+ "psubw %%mm3, %%mm1 \n\t" \
+ "movq %1, %%mm2 \n\t" \
+ "movq %1, %%mm3 \n\t" \
+ "movq %2, %%mm4 \n\t" \
+ "movq %2, %%mm5 \n\t" \
+ "punpcklbw %%mm7, %%mm2 \n\t" \
+ "punpckhbw %%mm7, %%mm3 \n\t" \
+ "punpcklbw %%mm7, %%mm4 \n\t" \
+ "punpckhbw %%mm7, %%mm5 \n\t" \
+ "psubw %%mm2, %%mm4 \n\t" \
+ "psubw %%mm3, %%mm5 \n\t" \
+ "psllw $2, %%mm4 \n\t" \
+ "psllw $2, %%mm5 \n\t" \
+ "paddw %%mm0, %%mm4 \n\t" \
+ "paddw %%mm1, %%mm5 \n\t" \
+ "pxor %%mm6, %%mm6 \n\t" \
+ "pcmpgtw %%mm4, %%mm6 \n\t" \
+ "pcmpgtw %%mm5, %%mm7 \n\t" \
+ "pxor %%mm6, %%mm4 \n\t" \
+ "pxor %%mm7, %%mm5 \n\t" \
+ "psubw %%mm6, %%mm4 \n\t" \
+ "psubw %%mm7, %%mm5 \n\t" \
+ "psrlw $3, %%mm4 \n\t" \
+ "psrlw $3, %%mm5 \n\t" \
+ "packuswb %%mm5, %%mm4 \n\t" \
+ "packsswb %%mm7, %%mm6 \n\t" \
+ "pxor %%mm7, %%mm7 \n\t" \
+ "movd %4, %%mm2 \n\t" \
+ "punpcklbw %%mm2, %%mm2 \n\t" \
+ "punpcklbw %%mm2, %%mm2 \n\t" \
+ "punpcklbw %%mm2, %%mm2 \n\t" \
+ "psubusb %%mm4, %%mm2 \n\t" \
+ "movq %%mm2, %%mm3 \n\t" \
+ "psubusb %%mm4, %%mm3 \n\t" \
+ "psubb %%mm3, %%mm2 \n\t" \
+ "movq %1, %%mm3 \n\t" \
+ "movq %2, %%mm4 \n\t" \
+ "pxor %%mm6, %%mm3 \n\t" \
+ "pxor %%mm6, %%mm4 \n\t" \
+ "paddusb %%mm2, %%mm3 \n\t" \
+ "psubusb %%mm2, %%mm4 \n\t" \
+ "pxor %%mm6, %%mm3 \n\t" \
+ "pxor %%mm6, %%mm4 \n\t" \
+ "paddusb %%mm2, %%mm2 \n\t" \
+ "packsswb %%mm1, %%mm0 \n\t" \
+ "pcmpgtb %%mm0, %%mm7 \n\t" \
+ "pxor %%mm7, %%mm0 \n\t" \
+ "psubb %%mm7, %%mm0 \n\t" \
+ "movq %%mm0, %%mm1 \n\t" \
+ "psubusb %%mm2, %%mm0 \n\t" \
+ "psubb %%mm0, %%mm1 \n\t" \
+ "pand %5, %%mm1 \n\t" \
+ "psrlw $2, %%mm1 \n\t" \
+ "pxor %%mm7, %%mm1 \n\t" \
+ "psubb %%mm7, %%mm1 \n\t" \
+ "movq %0, %%mm5 \n\t" \
+ "movq %3, %%mm6 \n\t" \
+ "psubb %%mm1, %%mm5 \n\t" \
+ "paddb %%mm1, %%mm6 \n\t"
+
+static void h263_v_loop_filter_mmx(uint8_t *src, int stride, int qscale)
+{
+ if (CONFIG_H263_DECODER || CONFIG_H263_ENCODER) {
+ const int strength = ff_h263_loop_filter_strength[qscale];
+
+ __asm__ volatile (
+ H263_LOOP_FILTER
+
+ "movq %%mm3, %1 \n\t"
+ "movq %%mm4, %2 \n\t"
+ "movq %%mm5, %0 \n\t"
+ "movq %%mm6, %3 \n\t"
+ : "+m"(*(uint64_t*)(src - 2 * stride)),
+ "+m"(*(uint64_t*)(src - 1 * stride)),
+ "+m"(*(uint64_t*)(src + 0 * stride)),
+ "+m"(*(uint64_t*)(src + 1 * stride))
+ : "g"(2 * strength), "m"(ff_pb_FC)
+ );
+ }
+}
- : "+m" (temp[0]),
- "+m" (temp[1]),
- "+m" (temp[2]),
- "+m" (temp[3])
- : "g" (2*strength), "m"(ff_pb_FC)
- );
+static void h263_h_loop_filter_mmx(uint8_t *src, int stride, int qscale)
+{
+ if (CONFIG_H263_DECODER || CONFIG_H263_ENCODER) {
+ const int strength = ff_h263_loop_filter_strength[qscale];
+ DECLARE_ALIGNED(8, uint64_t, temp)[4];
+ uint8_t *btemp = (uint8_t*)temp;
+
+ src -= 2;
+
+ transpose4x4(btemp, src, 8, stride);
+ transpose4x4(btemp + 4, src + 4 * stride, 8, stride);
+ __asm__ volatile (
+ H263_LOOP_FILTER // 5 3 4 6
+
+ : "+m"(temp[0]),
+ "+m"(temp[1]),
+ "+m"(temp[2]),
+ "+m"(temp[3])
+ : "g"(2 * strength), "m"(ff_pb_FC)
+ );
- __asm__ volatile(
- "movq %%mm5, %%mm1 \n\t"
- "movq %%mm4, %%mm0 \n\t"
- "punpcklbw %%mm3, %%mm5 \n\t"
- "punpcklbw %%mm6, %%mm4 \n\t"
- "punpckhbw %%mm3, %%mm1 \n\t"
- "punpckhbw %%mm6, %%mm0 \n\t"
- "movq %%mm5, %%mm3 \n\t"
- "movq %%mm1, %%mm6 \n\t"
- "punpcklwd %%mm4, %%mm5 \n\t"
- "punpcklwd %%mm0, %%mm1 \n\t"
- "punpckhwd %%mm4, %%mm3 \n\t"
- "punpckhwd %%mm0, %%mm6 \n\t"
- "movd %%mm5, (%0) \n\t"
- "punpckhdq %%mm5, %%mm5 \n\t"
- "movd %%mm5, (%0,%2) \n\t"
- "movd %%mm3, (%0,%2,2) \n\t"
- "punpckhdq %%mm3, %%mm3 \n\t"
- "movd %%mm3, (%0,%3) \n\t"
- "movd %%mm1, (%1) \n\t"
- "punpckhdq %%mm1, %%mm1 \n\t"
- "movd %%mm1, (%1,%2) \n\t"
- "movd %%mm6, (%1,%2,2) \n\t"
- "punpckhdq %%mm6, %%mm6 \n\t"
- "movd %%mm6, (%1,%3) \n\t"
- :: "r" (src),
- "r" (src + 4*stride),
- "r" ((x86_reg) stride ),
- "r" ((x86_reg)(3*stride))
- );
+ __asm__ volatile (
+ "movq %%mm5, %%mm1 \n\t"
+ "movq %%mm4, %%mm0 \n\t"
+ "punpcklbw %%mm3, %%mm5 \n\t"
+ "punpcklbw %%mm6, %%mm4 \n\t"
+ "punpckhbw %%mm3, %%mm1 \n\t"
+ "punpckhbw %%mm6, %%mm0 \n\t"
+ "movq %%mm5, %%mm3 \n\t"
+ "movq %%mm1, %%mm6 \n\t"
+ "punpcklwd %%mm4, %%mm5 \n\t"
+ "punpcklwd %%mm0, %%mm1 \n\t"
+ "punpckhwd %%mm4, %%mm3 \n\t"
+ "punpckhwd %%mm0, %%mm6 \n\t"
+ "movd %%mm5, (%0) \n\t"
+ "punpckhdq %%mm5, %%mm5 \n\t"
+ "movd %%mm5, (%0, %2) \n\t"
+ "movd %%mm3, (%0, %2, 2) \n\t"
+ "punpckhdq %%mm3, %%mm3 \n\t"
+ "movd %%mm3, (%0, %3) \n\t"
+ "movd %%mm1, (%1) \n\t"
+ "punpckhdq %%mm1, %%mm1 \n\t"
+ "movd %%mm1, (%1, %2) \n\t"
+ "movd %%mm6, (%1, %2, 2) \n\t"
+ "punpckhdq %%mm6, %%mm6 \n\t"
+ "movd %%mm6, (%1, %3) \n\t"
+ :: "r"(src),
+ "r"(src + 4 * stride),
+ "r"((x86_reg)stride),
+ "r"((x86_reg)(3 * stride))
+ );
}
}
-/* draw the edges of width 'w' of an image of size width, height
- this mmx version can only handle w==8 || w==16 */
-static void draw_edges_mmx(uint8_t *buf, int wrap, int width, int height, int w, int h, int sides)
+/* Draw the edges of width 'w' of an image of size width, height
+ * this MMX version can only handle w == 8 || w == 16. */
+static void draw_edges_mmx(uint8_t *buf, int wrap, int width, int height,
+ int w, int h, int sides)
{
uint8_t *ptr, *last_line;
int i;
@@ -794,1139 +736,1056 @@ static void draw_edges_mmx(uint8_t *buf, int wrap, int width, int height, int w,
last_line = buf + (height - 1) * wrap;
/* left and right */
ptr = buf;
- if(w==8)
- {
- __asm__ volatile(
- "1: \n\t"
- "movd (%0), %%mm0 \n\t"
- "punpcklbw %%mm0, %%mm0 \n\t"
- "punpcklwd %%mm0, %%mm0 \n\t"
- "punpckldq %%mm0, %%mm0 \n\t"
- "movq %%mm0, -8(%0) \n\t"
- "movq -8(%0, %2), %%mm1 \n\t"
- "punpckhbw %%mm1, %%mm1 \n\t"
- "punpckhwd %%mm1, %%mm1 \n\t"
- "punpckhdq %%mm1, %%mm1 \n\t"
- "movq %%mm1, (%0, %2) \n\t"
- "add %1, %0 \n\t"
- "cmp %3, %0 \n\t"
- " jb 1b \n\t"
- : "+r" (ptr)
- : "r" ((x86_reg)wrap), "r" ((x86_reg)width), "r" (ptr + wrap*height)
- );
- }
- else
- {
- __asm__ volatile(
- "1: \n\t"
- "movd (%0), %%mm0 \n\t"
- "punpcklbw %%mm0, %%mm0 \n\t"
- "punpcklwd %%mm0, %%mm0 \n\t"
- "punpckldq %%mm0, %%mm0 \n\t"
- "movq %%mm0, -8(%0) \n\t"
- "movq %%mm0, -16(%0) \n\t"
- "movq -8(%0, %2), %%mm1 \n\t"
- "punpckhbw %%mm1, %%mm1 \n\t"
- "punpckhwd %%mm1, %%mm1 \n\t"
- "punpckhdq %%mm1, %%mm1 \n\t"
- "movq %%mm1, (%0, %2) \n\t"
- "movq %%mm1, 8(%0, %2) \n\t"
- "add %1, %0 \n\t"
- "cmp %3, %0 \n\t"
- " jb 1b \n\t"
- : "+r" (ptr)
- : "r" ((x86_reg)wrap), "r" ((x86_reg)width), "r" (ptr + wrap*height)
- );
+ if (w == 8) {
+ __asm__ volatile (
+ "1: \n\t"
+ "movd (%0), %%mm0 \n\t"
+ "punpcklbw %%mm0, %%mm0 \n\t"
+ "punpcklwd %%mm0, %%mm0 \n\t"
+ "punpckldq %%mm0, %%mm0 \n\t"
+ "movq %%mm0, -8(%0) \n\t"
+ "movq -8(%0, %2), %%mm1 \n\t"
+ "punpckhbw %%mm1, %%mm1 \n\t"
+ "punpckhwd %%mm1, %%mm1 \n\t"
+ "punpckhdq %%mm1, %%mm1 \n\t"
+ "movq %%mm1, (%0, %2) \n\t"
+ "add %1, %0 \n\t"
+ "cmp %3, %0 \n\t"
+ "jb 1b \n\t"
+ : "+r"(ptr)
+ : "r"((x86_reg)wrap), "r"((x86_reg)width), "r"(ptr + wrap * height)
+ );
+ } else {
+ __asm__ volatile (
+ "1: \n\t"
+ "movd (%0), %%mm0 \n\t"
+ "punpcklbw %%mm0, %%mm0 \n\t"
+ "punpcklwd %%mm0, %%mm0 \n\t"
+ "punpckldq %%mm0, %%mm0 \n\t"
+ "movq %%mm0, -8(%0) \n\t"
+ "movq %%mm0, -16(%0) \n\t"
+ "movq -8(%0, %2), %%mm1 \n\t"
+ "punpckhbw %%mm1, %%mm1 \n\t"
+ "punpckhwd %%mm1, %%mm1 \n\t"
+ "punpckhdq %%mm1, %%mm1 \n\t"
+ "movq %%mm1, (%0, %2) \n\t"
+ "movq %%mm1, 8(%0, %2) \n\t"
+ "add %1, %0 \n\t"
+ "cmp %3, %0 \n\t"
+ "jb 1b \n\t"
+ : "+r"(ptr)
+ : "r"((x86_reg)wrap), "r"((x86_reg)width), "r"(ptr + wrap * height)
+ );
}
/* top and bottom (and hopefully also the corners) */
- if (sides&EDGE_TOP) {
- for(i = 0; i < h; i += 4) {
- ptr= buf - (i + 1) * wrap - w;
- __asm__ volatile(
- "1: \n\t"
- "movq (%1, %0), %%mm0 \n\t"
- "movq %%mm0, (%0) \n\t"
- "movq %%mm0, (%0, %2) \n\t"
- "movq %%mm0, (%0, %2, 2) \n\t"
- "movq %%mm0, (%0, %3) \n\t"
- "add $8, %0 \n\t"
- "cmp %4, %0 \n\t"
- " jb 1b \n\t"
- : "+r" (ptr)
- : "r" ((x86_reg)buf - (x86_reg)ptr - w), "r" ((x86_reg)-wrap), "r" ((x86_reg)-wrap*3), "r" (ptr+width+2*w)
- );
+ if (sides & EDGE_TOP) {
+ for (i = 0; i < h; i += 4) {
+ ptr = buf - (i + 1) * wrap - w;
+ __asm__ volatile (
+ "1: \n\t"
+ "movq (%1, %0), %%mm0 \n\t"
+ "movq %%mm0, (%0) \n\t"
+ "movq %%mm0, (%0, %2) \n\t"
+ "movq %%mm0, (%0, %2, 2) \n\t"
+ "movq %%mm0, (%0, %3) \n\t"
+ "add $8, %0 \n\t"
+ "cmp %4, %0 \n\t"
+ "jb 1b \n\t"
+ : "+r"(ptr)
+ : "r"((x86_reg)buf - (x86_reg)ptr - w), "r"((x86_reg) -wrap),
+ "r"((x86_reg) -wrap * 3), "r"(ptr + width + 2 * w)
+ );
}
}
- if (sides&EDGE_BOTTOM) {
- for(i = 0; i < w; i += 4) {
- ptr= last_line + (i + 1) * wrap - w;
- __asm__ volatile(
- "1: \n\t"
- "movq (%1, %0), %%mm0 \n\t"
- "movq %%mm0, (%0) \n\t"
- "movq %%mm0, (%0, %2) \n\t"
- "movq %%mm0, (%0, %2, 2) \n\t"
- "movq %%mm0, (%0, %3) \n\t"
- "add $8, %0 \n\t"
- "cmp %4, %0 \n\t"
- " jb 1b \n\t"
- : "+r" (ptr)
- : "r" ((x86_reg)last_line - (x86_reg)ptr - w), "r" ((x86_reg)wrap), "r" ((x86_reg)wrap*3), "r" (ptr+width+2*w)
- );
+ if (sides & EDGE_BOTTOM) {
+ for (i = 0; i < h; i += 4) {
+ ptr = last_line + (i + 1) * wrap - w;
+ __asm__ volatile (
+ "1: \n\t"
+ "movq (%1, %0), %%mm0 \n\t"
+ "movq %%mm0, (%0) \n\t"
+ "movq %%mm0, (%0, %2) \n\t"
+ "movq %%mm0, (%0, %2, 2) \n\t"
+ "movq %%mm0, (%0, %3) \n\t"
+ "add $8, %0 \n\t"
+ "cmp %4, %0 \n\t"
+ "jb 1b \n\t"
+ : "+r"(ptr)
+ : "r"((x86_reg)last_line - (x86_reg)ptr - w),
+ "r"((x86_reg)wrap), "r"((x86_reg)wrap * 3),
+ "r"(ptr + width + 2 * w)
+ );
}
}
}
-#define PAETH(cpu, abs3)\
-static void add_png_paeth_prediction_##cpu(uint8_t *dst, uint8_t *src, uint8_t *top, int w, int bpp)\
-{\
- x86_reg i = -bpp;\
- x86_reg end = w-3;\
- __asm__ volatile(\
- "pxor %%mm7, %%mm7 \n"\
- "movd (%1,%0), %%mm0 \n"\
- "movd (%2,%0), %%mm1 \n"\
- "punpcklbw %%mm7, %%mm0 \n"\
- "punpcklbw %%mm7, %%mm1 \n"\
- "add %4, %0 \n"\
- "1: \n"\
- "movq %%mm1, %%mm2 \n"\
- "movd (%2,%0), %%mm1 \n"\
- "movq %%mm2, %%mm3 \n"\
- "punpcklbw %%mm7, %%mm1 \n"\
- "movq %%mm2, %%mm4 \n"\
- "psubw %%mm1, %%mm3 \n"\
- "psubw %%mm0, %%mm4 \n"\
- "movq %%mm3, %%mm5 \n"\
- "paddw %%mm4, %%mm5 \n"\
- abs3\
- "movq %%mm4, %%mm6 \n"\
- "pminsw %%mm5, %%mm6 \n"\
- "pcmpgtw %%mm6, %%mm3 \n"\
- "pcmpgtw %%mm5, %%mm4 \n"\
- "movq %%mm4, %%mm6 \n"\
- "pand %%mm3, %%mm4 \n"\
- "pandn %%mm3, %%mm6 \n"\
- "pandn %%mm0, %%mm3 \n"\
- "movd (%3,%0), %%mm0 \n"\
- "pand %%mm1, %%mm6 \n"\
- "pand %%mm4, %%mm2 \n"\
- "punpcklbw %%mm7, %%mm0 \n"\
- "movq %6, %%mm5 \n"\
- "paddw %%mm6, %%mm0 \n"\
- "paddw %%mm2, %%mm3 \n"\
- "paddw %%mm3, %%mm0 \n"\
- "pand %%mm5, %%mm0 \n"\
- "movq %%mm0, %%mm3 \n"\
- "packuswb %%mm3, %%mm3 \n"\
- "movd %%mm3, (%1,%0) \n"\
- "add %4, %0 \n"\
- "cmp %5, %0 \n"\
- "jle 1b \n"\
- :"+r"(i)\
- :"r"(dst), "r"(top), "r"(src), "r"((x86_reg)bpp), "g"(end),\
- "m"(ff_pw_255)\
- :"memory"\
- );\
+#define QPEL_V_LOW(m3, m4, m5, m6, pw_20, pw_3, rnd, \
+ in0, in1, in2, in7, out, OP) \
+ "paddw "#m4", "#m3" \n\t" /* x1 */ \
+ "movq "MANGLE(ff_pw_20)", %%mm4 \n\t" /* 20 */ \
+ "pmullw "#m3", %%mm4 \n\t" /* 20x1 */ \
+ "movq "#in7", "#m3" \n\t" /* d */ \
+ "movq "#in0", %%mm5 \n\t" /* D */ \
+ "paddw "#m3", %%mm5 \n\t" /* x4 */ \
+ "psubw %%mm5, %%mm4 \n\t" /* 20x1 - x4 */ \
+ "movq "#in1", %%mm5 \n\t" /* C */ \
+ "movq "#in2", %%mm6 \n\t" /* B */ \
+ "paddw "#m6", %%mm5 \n\t" /* x3 */ \
+ "paddw "#m5", %%mm6 \n\t" /* x2 */ \
+ "paddw %%mm6, %%mm6 \n\t" /* 2x2 */ \
+ "psubw %%mm6, %%mm5 \n\t" /* -2x2 + x3 */ \
+ "pmullw "MANGLE(ff_pw_3)", %%mm5 \n\t" /* -6x2 + 3x3 */ \
+ "paddw "#rnd", %%mm4 \n\t" /* x2 */ \
+ "paddw %%mm4, %%mm5 \n\t" /* 20x1 - 6x2 + 3x3 - x4 */ \
+ "psraw $5, %%mm5 \n\t" \
+ "packuswb %%mm5, %%mm5 \n\t" \
+ OP(%%mm5, out, %%mm7, d)
+
+#define QPEL_BASE(OPNAME, ROUNDER, RND, OP_MMXEXT) \
+static void OPNAME ## mpeg4_qpel16_h_lowpass_mmxext(uint8_t *dst, \
+ uint8_t *src, \
+ int dstStride, \
+ int srcStride, \
+ int h) \
+{ \
+ uint64_t temp; \
+ \
+ __asm__ volatile ( \
+ "pxor %%mm7, %%mm7 \n\t" \
+ "1: \n\t" \
+ "movq (%0), %%mm0 \n\t" /* ABCDEFGH */ \
+ "movq %%mm0, %%mm1 \n\t" /* ABCDEFGH */ \
+ "movq %%mm0, %%mm2 \n\t" /* ABCDEFGH */ \
+ "punpcklbw %%mm7, %%mm0 \n\t" /* 0A0B0C0D */ \
+ "punpckhbw %%mm7, %%mm1 \n\t" /* 0E0F0G0H */ \
+ "pshufw $0x90, %%mm0, %%mm5 \n\t" /* 0A0A0B0C */ \
+ "pshufw $0x41, %%mm0, %%mm6 \n\t" /* 0B0A0A0B */ \
+ "movq %%mm2, %%mm3 \n\t" /* ABCDEFGH */ \
+ "movq %%mm2, %%mm4 \n\t" /* ABCDEFGH */ \
+ "psllq $8, %%mm2 \n\t" /* 0ABCDEFG */ \
+ "psllq $16, %%mm3 \n\t" /* 00ABCDEF */ \
+ "psllq $24, %%mm4 \n\t" /* 000ABCDE */ \
+ "punpckhbw %%mm7, %%mm2 \n\t" /* 0D0E0F0G */ \
+ "punpckhbw %%mm7, %%mm3 \n\t" /* 0C0D0E0F */ \
+ "punpckhbw %%mm7, %%mm4 \n\t" /* 0B0C0D0E */ \
+ "paddw %%mm3, %%mm5 \n\t" /* b */ \
+ "paddw %%mm2, %%mm6 \n\t" /* c */ \
+ "paddw %%mm5, %%mm5 \n\t" /* 2b */ \
+ "psubw %%mm5, %%mm6 \n\t" /* c - 2b */ \
+ "pshufw $0x06, %%mm0, %%mm5 \n\t" /* 0C0B0A0A */ \
+ "pmullw "MANGLE(ff_pw_3)", %%mm6 \n\t" /* 3c - 6b */ \
+ "paddw %%mm4, %%mm0 \n\t" /* a */ \
+ "paddw %%mm1, %%mm5 \n\t" /* d */ \
+ "pmullw "MANGLE(ff_pw_20)", %%mm0 \n\t" /* 20a */ \
+ "psubw %%mm5, %%mm0 \n\t" /* 20a - d */ \
+ "paddw %6, %%mm6 \n\t" \
+ "paddw %%mm6, %%mm0 \n\t" /* 20a - 6b + 3c - d */ \
+ "psraw $5, %%mm0 \n\t" \
+ "movq %%mm0, %5 \n\t" \
+ /* mm1 = EFGH, mm2 = DEFG, mm3 = CDEF, mm4 = BCDE, mm7 = 0 */ \
+ \
+ "movq 5(%0), %%mm0 \n\t" /* FGHIJKLM */ \
+ "movq %%mm0, %%mm5 \n\t" /* FGHIJKLM */ \
+ "movq %%mm0, %%mm6 \n\t" /* FGHIJKLM */ \
+ "psrlq $8, %%mm0 \n\t" /* GHIJKLM0 */ \
+ "psrlq $16, %%mm5 \n\t" /* HIJKLM00 */ \
+ "punpcklbw %%mm7, %%mm0 \n\t" /* 0G0H0I0J */ \
+ "punpcklbw %%mm7, %%mm5 \n\t" /* 0H0I0J0K */ \
+ "paddw %%mm0, %%mm2 \n\t" /* b */ \
+ "paddw %%mm5, %%mm3 \n\t" /* c */ \
+ "paddw %%mm2, %%mm2 \n\t" /* 2b */ \
+ "psubw %%mm2, %%mm3 \n\t" /* c - 2b */ \
+ "movq %%mm6, %%mm2 \n\t" /* FGHIJKLM */ \
+ "psrlq $24, %%mm6 \n\t" /* IJKLM000 */ \
+ "punpcklbw %%mm7, %%mm2 \n\t" /* 0F0G0H0I */ \
+ "punpcklbw %%mm7, %%mm6 \n\t" /* 0I0J0K0L */ \
+ "pmullw "MANGLE(ff_pw_3)", %%mm3 \n\t" /* 3c - 6b */ \
+ "paddw %%mm2, %%mm1 \n\t" /* a */ \
+ "paddw %%mm6, %%mm4 \n\t" /* d */ \
+ "pmullw "MANGLE(ff_pw_20)", %%mm1 \n\t" /* 20a */ \
+ "psubw %%mm4, %%mm3 \n\t" /* - 6b +3c - d */ \
+ "paddw %6, %%mm1 \n\t" \
+ "paddw %%mm1, %%mm3 \n\t" /* 20a - 6b +3c - d */ \
+ "psraw $5, %%mm3 \n\t" \
+ "movq %5, %%mm1 \n\t" \
+ "packuswb %%mm3, %%mm1 \n\t" \
+ OP_MMXEXT(%%mm1, (%1), %%mm4, q) \
+ /* mm0 = GHIJ, mm2 = FGHI, mm5 = HIJK, mm6 = IJKL, mm7 = 0 */ \
+ \
+ "movq 9(%0), %%mm1 \n\t" /* JKLMNOPQ */ \
+ "movq %%mm1, %%mm4 \n\t" /* JKLMNOPQ */ \
+ "movq %%mm1, %%mm3 \n\t" /* JKLMNOPQ */ \
+ "psrlq $8, %%mm1 \n\t" /* KLMNOPQ0 */ \
+ "psrlq $16, %%mm4 \n\t" /* LMNOPQ00 */ \
+ "punpcklbw %%mm7, %%mm1 \n\t" /* 0K0L0M0N */ \
+ "punpcklbw %%mm7, %%mm4 \n\t" /* 0L0M0N0O */ \
+ "paddw %%mm1, %%mm5 \n\t" /* b */ \
+ "paddw %%mm4, %%mm0 \n\t" /* c */ \
+ "paddw %%mm5, %%mm5 \n\t" /* 2b */ \
+ "psubw %%mm5, %%mm0 \n\t" /* c - 2b */ \
+ "movq %%mm3, %%mm5 \n\t" /* JKLMNOPQ */ \
+ "psrlq $24, %%mm3 \n\t" /* MNOPQ000 */ \
+ "pmullw "MANGLE(ff_pw_3)", %%mm0 \n\t" /* 3c - 6b */ \
+ "punpcklbw %%mm7, %%mm3 \n\t" /* 0M0N0O0P */ \
+ "paddw %%mm3, %%mm2 \n\t" /* d */ \
+ "psubw %%mm2, %%mm0 \n\t" /* -6b + 3c - d */ \
+ "movq %%mm5, %%mm2 \n\t" /* JKLMNOPQ */ \
+ "punpcklbw %%mm7, %%mm2 \n\t" /* 0J0K0L0M */ \
+ "punpckhbw %%mm7, %%mm5 \n\t" /* 0N0O0P0Q */ \
+ "paddw %%mm2, %%mm6 \n\t" /* a */ \
+ "pmullw "MANGLE(ff_pw_20)", %%mm6 \n\t" /* 20a */ \
+ "paddw %6, %%mm0 \n\t" \
+ "paddw %%mm6, %%mm0 \n\t" /* 20a - 6b + 3c - d */ \
+ "psraw $5, %%mm0 \n\t" \
+ /* mm1 = KLMN, mm2 = JKLM, mm3 = MNOP, */ \
+ /* mm4 = LMNO, mm5 = NOPQ mm7 = 0 */ \
+ \
+ "paddw %%mm5, %%mm3 \n\t" /* a */ \
+ "pshufw $0xF9, %%mm5, %%mm6 \n\t" /* 0O0P0Q0Q */ \
+ "paddw %%mm4, %%mm6 \n\t" /* b */ \
+ "pshufw $0xBE, %%mm5, %%mm4 \n\t" /* 0P0Q0Q0P */ \
+ "pshufw $0x6F, %%mm5, %%mm5 \n\t" /* 0Q0Q0P0O */ \
+ "paddw %%mm1, %%mm4 \n\t" /* c */ \
+ "paddw %%mm2, %%mm5 \n\t" /* d */ \
+ "paddw %%mm6, %%mm6 \n\t" /* 2b */ \
+ "psubw %%mm6, %%mm4 \n\t" /* c - 2b */ \
+ "pmullw "MANGLE(ff_pw_20)", %%mm3 \n\t" /* 20a */ \
+ "pmullw "MANGLE(ff_pw_3)", %%mm4 \n\t" /* 3c - 6b */ \
+ "psubw %%mm5, %%mm3 \n\t" /* -6b + 3c - d */ \
+ "paddw %6, %%mm4 \n\t" \
+ "paddw %%mm3, %%mm4 \n\t" /* 20a - 6b + 3c - d */ \
+ "psraw $5, %%mm4 \n\t" \
+ "packuswb %%mm4, %%mm0 \n\t" \
+ OP_MMXEXT(%%mm0, 8(%1), %%mm4, q) \
+ \
+ "add %3, %0 \n\t" \
+ "add %4, %1 \n\t" \
+ "decl %2 \n\t" \
+ "jnz 1b \n\t" \
+ : "+a"(src), "+c"(dst), "+D"(h) \
+ : "d"((x86_reg)srcStride), "S"((x86_reg)dstStride), \
+ /* "m"(ff_pw_20), "m"(ff_pw_3), */ "m"(temp), "m"(ROUNDER) \
+ : "memory" \
+ ); \
+} \
+ \
+static void OPNAME ## mpeg4_qpel8_h_lowpass_mmxext(uint8_t *dst, \
+ uint8_t *src, \
+ int dstStride, \
+ int srcStride, \
+ int h) \
+{ \
+ __asm__ volatile ( \
+ "pxor %%mm7, %%mm7 \n\t" \
+ "1: \n\t" \
+ "movq (%0), %%mm0 \n\t" /* ABCDEFGH */ \
+ "movq %%mm0, %%mm1 \n\t" /* ABCDEFGH */ \
+ "movq %%mm0, %%mm2 \n\t" /* ABCDEFGH */ \
+ "punpcklbw %%mm7, %%mm0 \n\t" /* 0A0B0C0D */ \
+ "punpckhbw %%mm7, %%mm1 \n\t" /* 0E0F0G0H */ \
+ "pshufw $0x90, %%mm0, %%mm5 \n\t" /* 0A0A0B0C */ \
+ "pshufw $0x41, %%mm0, %%mm6 \n\t" /* 0B0A0A0B */ \
+ "movq %%mm2, %%mm3 \n\t" /* ABCDEFGH */ \
+ "movq %%mm2, %%mm4 \n\t" /* ABCDEFGH */ \
+ "psllq $8, %%mm2 \n\t" /* 0ABCDEFG */ \
+ "psllq $16, %%mm3 \n\t" /* 00ABCDEF */ \
+ "psllq $24, %%mm4 \n\t" /* 000ABCDE */ \
+ "punpckhbw %%mm7, %%mm2 \n\t" /* 0D0E0F0G */ \
+ "punpckhbw %%mm7, %%mm3 \n\t" /* 0C0D0E0F */ \
+ "punpckhbw %%mm7, %%mm4 \n\t" /* 0B0C0D0E */ \
+ "paddw %%mm3, %%mm5 \n\t" /* b */ \
+ "paddw %%mm2, %%mm6 \n\t" /* c */ \
+ "paddw %%mm5, %%mm5 \n\t" /* 2b */ \
+ "psubw %%mm5, %%mm6 \n\t" /* c - 2b */ \
+ "pshufw $0x06, %%mm0, %%mm5 \n\t" /* 0C0B0A0A */ \
+ "pmullw "MANGLE(ff_pw_3)", %%mm6 \n\t" /* 3c - 6b */ \
+ "paddw %%mm4, %%mm0 \n\t" /* a */ \
+ "paddw %%mm1, %%mm5 \n\t" /* d */ \
+ "pmullw "MANGLE(ff_pw_20)", %%mm0 \n\t" /* 20a */ \
+ "psubw %%mm5, %%mm0 \n\t" /* 20a - d */ \
+ "paddw %5, %%mm6 \n\t" \
+ "paddw %%mm6, %%mm0 \n\t" /* 20a - 6b + 3c - d */ \
+ "psraw $5, %%mm0 \n\t" \
+ /* mm1 = EFGH, mm2 = DEFG, mm3 = CDEF, mm4 = BCDE, mm7 = 0 */ \
+ \
+ "movd 5(%0), %%mm5 \n\t" /* FGHI */ \
+ "punpcklbw %%mm7, %%mm5 \n\t" /* 0F0G0H0I */ \
+ "pshufw $0xF9, %%mm5, %%mm6 \n\t" /* 0G0H0I0I */ \
+ "paddw %%mm5, %%mm1 \n\t" /* a */ \
+ "paddw %%mm6, %%mm2 \n\t" /* b */ \
+ "pshufw $0xBE, %%mm5, %%mm6 \n\t" /* 0H0I0I0H */ \
+ "pshufw $0x6F, %%mm5, %%mm5 \n\t" /* 0I0I0H0G */ \
+ "paddw %%mm6, %%mm3 \n\t" /* c */ \
+ "paddw %%mm5, %%mm4 \n\t" /* d */ \
+ "paddw %%mm2, %%mm2 \n\t" /* 2b */ \
+ "psubw %%mm2, %%mm3 \n\t" /* c - 2b */ \
+ "pmullw "MANGLE(ff_pw_20)", %%mm1 \n\t" /* 20a */ \
+ "pmullw "MANGLE(ff_pw_3)", %%mm3 \n\t" /* 3c - 6b */ \
+ "psubw %%mm4, %%mm3 \n\t" /* -6b + 3c - d */ \
+ "paddw %5, %%mm1 \n\t" \
+ "paddw %%mm1, %%mm3 \n\t" /* 20a - 6b + 3c - d */ \
+ "psraw $5, %%mm3 \n\t" \
+ "packuswb %%mm3, %%mm0 \n\t" \
+ OP_MMXEXT(%%mm0, (%1), %%mm4, q) \
+ \
+ "add %3, %0 \n\t" \
+ "add %4, %1 \n\t" \
+ "decl %2 \n\t" \
+ "jnz 1b \n\t" \
+ : "+a"(src), "+c"(dst), "+d"(h) \
+ : "S"((x86_reg)srcStride), "D"((x86_reg)dstStride), \
+ /* "m"(ff_pw_20), "m"(ff_pw_3), */ "m"(ROUNDER) \
+ : "memory" \
+ ); \
}
-#define ABS3_MMX2\
- "psubw %%mm5, %%mm7 \n"\
- "pmaxsw %%mm7, %%mm5 \n"\
- "pxor %%mm6, %%mm6 \n"\
- "pxor %%mm7, %%mm7 \n"\
- "psubw %%mm3, %%mm6 \n"\
- "psubw %%mm4, %%mm7 \n"\
- "pmaxsw %%mm6, %%mm3 \n"\
- "pmaxsw %%mm7, %%mm4 \n"\
- "pxor %%mm7, %%mm7 \n"
-
-#define ABS3_SSSE3\
- "pabsw %%mm3, %%mm3 \n"\
- "pabsw %%mm4, %%mm4 \n"\
- "pabsw %%mm5, %%mm5 \n"
-
-PAETH(mmx2, ABS3_MMX2)
-#if HAVE_SSSE3
-PAETH(ssse3, ABS3_SSSE3)
-#endif
-
-#define QPEL_V_LOW(m3,m4,m5,m6, pw_20, pw_3, rnd, in0, in1, in2, in7, out, OP)\
- "paddw " #m4 ", " #m3 " \n\t" /* x1 */\
- "movq "MANGLE(ff_pw_20)", %%mm4 \n\t" /* 20 */\
- "pmullw " #m3 ", %%mm4 \n\t" /* 20x1 */\
- "movq "#in7", " #m3 " \n\t" /* d */\
- "movq "#in0", %%mm5 \n\t" /* D */\
- "paddw " #m3 ", %%mm5 \n\t" /* x4 */\
- "psubw %%mm5, %%mm4 \n\t" /* 20x1 - x4 */\
- "movq "#in1", %%mm5 \n\t" /* C */\
- "movq "#in2", %%mm6 \n\t" /* B */\
- "paddw " #m6 ", %%mm5 \n\t" /* x3 */\
- "paddw " #m5 ", %%mm6 \n\t" /* x2 */\
- "paddw %%mm6, %%mm6 \n\t" /* 2x2 */\
- "psubw %%mm6, %%mm5 \n\t" /* -2x2 + x3 */\
- "pmullw "MANGLE(ff_pw_3)", %%mm5 \n\t" /* -6x2 + 3x3 */\
- "paddw " #rnd ", %%mm4 \n\t" /* x2 */\
- "paddw %%mm4, %%mm5 \n\t" /* 20x1 - 6x2 + 3x3 - x4 */\
- "psraw $5, %%mm5 \n\t"\
- "packuswb %%mm5, %%mm5 \n\t"\
- OP(%%mm5, out, %%mm7, d)
-
-#define QPEL_BASE(OPNAME, ROUNDER, RND, OP_MMX2, OP_3DNOW)\
-static void OPNAME ## mpeg4_qpel16_h_lowpass_mmx2(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int h){\
- uint64_t temp;\
-\
- __asm__ volatile(\
- "pxor %%mm7, %%mm7 \n\t"\
- "1: \n\t"\
- "movq (%0), %%mm0 \n\t" /* ABCDEFGH */\
- "movq %%mm0, %%mm1 \n\t" /* ABCDEFGH */\
- "movq %%mm0, %%mm2 \n\t" /* ABCDEFGH */\
- "punpcklbw %%mm7, %%mm0 \n\t" /* 0A0B0C0D */\
- "punpckhbw %%mm7, %%mm1 \n\t" /* 0E0F0G0H */\
- "pshufw $0x90, %%mm0, %%mm5 \n\t" /* 0A0A0B0C */\
- "pshufw $0x41, %%mm0, %%mm6 \n\t" /* 0B0A0A0B */\
- "movq %%mm2, %%mm3 \n\t" /* ABCDEFGH */\
- "movq %%mm2, %%mm4 \n\t" /* ABCDEFGH */\
- "psllq $8, %%mm2 \n\t" /* 0ABCDEFG */\
- "psllq $16, %%mm3 \n\t" /* 00ABCDEF */\
- "psllq $24, %%mm4 \n\t" /* 000ABCDE */\
- "punpckhbw %%mm7, %%mm2 \n\t" /* 0D0E0F0G */\
- "punpckhbw %%mm7, %%mm3 \n\t" /* 0C0D0E0F */\
- "punpckhbw %%mm7, %%mm4 \n\t" /* 0B0C0D0E */\
- "paddw %%mm3, %%mm5 \n\t" /* b */\
- "paddw %%mm2, %%mm6 \n\t" /* c */\
- "paddw %%mm5, %%mm5 \n\t" /* 2b */\
- "psubw %%mm5, %%mm6 \n\t" /* c - 2b */\
- "pshufw $0x06, %%mm0, %%mm5 \n\t" /* 0C0B0A0A */\
- "pmullw "MANGLE(ff_pw_3)", %%mm6 \n\t" /* 3c - 6b */\
- "paddw %%mm4, %%mm0 \n\t" /* a */\
- "paddw %%mm1, %%mm5 \n\t" /* d */\
- "pmullw "MANGLE(ff_pw_20)", %%mm0 \n\t" /* 20a */\
- "psubw %%mm5, %%mm0 \n\t" /* 20a - d */\
- "paddw %6, %%mm6 \n\t"\
- "paddw %%mm6, %%mm0 \n\t" /* 20a - 6b + 3c - d */\
- "psraw $5, %%mm0 \n\t"\
- "movq %%mm0, %5 \n\t"\
- /* mm1=EFGH, mm2=DEFG, mm3=CDEF, mm4=BCDE, mm7=0 */\
- \
- "movq 5(%0), %%mm0 \n\t" /* FGHIJKLM */\
- "movq %%mm0, %%mm5 \n\t" /* FGHIJKLM */\
- "movq %%mm0, %%mm6 \n\t" /* FGHIJKLM */\
- "psrlq $8, %%mm0 \n\t" /* GHIJKLM0 */\
- "psrlq $16, %%mm5 \n\t" /* HIJKLM00 */\
- "punpcklbw %%mm7, %%mm0 \n\t" /* 0G0H0I0J */\
- "punpcklbw %%mm7, %%mm5 \n\t" /* 0H0I0J0K */\
- "paddw %%mm0, %%mm2 \n\t" /* b */\
- "paddw %%mm5, %%mm3 \n\t" /* c */\
- "paddw %%mm2, %%mm2 \n\t" /* 2b */\
- "psubw %%mm2, %%mm3 \n\t" /* c - 2b */\
- "movq %%mm6, %%mm2 \n\t" /* FGHIJKLM */\
- "psrlq $24, %%mm6 \n\t" /* IJKLM000 */\
- "punpcklbw %%mm7, %%mm2 \n\t" /* 0F0G0H0I */\
- "punpcklbw %%mm7, %%mm6 \n\t" /* 0I0J0K0L */\
- "pmullw "MANGLE(ff_pw_3)", %%mm3 \n\t" /* 3c - 6b */\
- "paddw %%mm2, %%mm1 \n\t" /* a */\
- "paddw %%mm6, %%mm4 \n\t" /* d */\
- "pmullw "MANGLE(ff_pw_20)", %%mm1 \n\t" /* 20a */\
- "psubw %%mm4, %%mm3 \n\t" /* - 6b +3c - d */\
- "paddw %6, %%mm1 \n\t"\
- "paddw %%mm1, %%mm3 \n\t" /* 20a - 6b +3c - d */\
- "psraw $5, %%mm3 \n\t"\
- "movq %5, %%mm1 \n\t"\
- "packuswb %%mm3, %%mm1 \n\t"\
- OP_MMX2(%%mm1, (%1),%%mm4, q)\
- /* mm0= GHIJ, mm2=FGHI, mm5=HIJK, mm6=IJKL, mm7=0 */\
- \
- "movq 9(%0), %%mm1 \n\t" /* JKLMNOPQ */\
- "movq %%mm1, %%mm4 \n\t" /* JKLMNOPQ */\
- "movq %%mm1, %%mm3 \n\t" /* JKLMNOPQ */\
- "psrlq $8, %%mm1 \n\t" /* KLMNOPQ0 */\
- "psrlq $16, %%mm4 \n\t" /* LMNOPQ00 */\
- "punpcklbw %%mm7, %%mm1 \n\t" /* 0K0L0M0N */\
- "punpcklbw %%mm7, %%mm4 \n\t" /* 0L0M0N0O */\
- "paddw %%mm1, %%mm5 \n\t" /* b */\
- "paddw %%mm4, %%mm0 \n\t" /* c */\
- "paddw %%mm5, %%mm5 \n\t" /* 2b */\
- "psubw %%mm5, %%mm0 \n\t" /* c - 2b */\
- "movq %%mm3, %%mm5 \n\t" /* JKLMNOPQ */\
- "psrlq $24, %%mm3 \n\t" /* MNOPQ000 */\
- "pmullw "MANGLE(ff_pw_3)", %%mm0 \n\t" /* 3c - 6b */\
- "punpcklbw %%mm7, %%mm3 \n\t" /* 0M0N0O0P */\
- "paddw %%mm3, %%mm2 \n\t" /* d */\
- "psubw %%mm2, %%mm0 \n\t" /* -6b + 3c - d */\
- "movq %%mm5, %%mm2 \n\t" /* JKLMNOPQ */\
- "punpcklbw %%mm7, %%mm2 \n\t" /* 0J0K0L0M */\
- "punpckhbw %%mm7, %%mm5 \n\t" /* 0N0O0P0Q */\
- "paddw %%mm2, %%mm6 \n\t" /* a */\
- "pmullw "MANGLE(ff_pw_20)", %%mm6 \n\t" /* 20a */\
- "paddw %6, %%mm0 \n\t"\
- "paddw %%mm6, %%mm0 \n\t" /* 20a - 6b + 3c - d */\
- "psraw $5, %%mm0 \n\t"\
- /* mm1=KLMN, mm2=JKLM, mm3=MNOP, mm4=LMNO, mm5=NOPQ mm7=0 */\
- \
- "paddw %%mm5, %%mm3 \n\t" /* a */\
- "pshufw $0xF9, %%mm5, %%mm6 \n\t" /* 0O0P0Q0Q */\
- "paddw %%mm4, %%mm6 \n\t" /* b */\
- "pshufw $0xBE, %%mm5, %%mm4 \n\t" /* 0P0Q0Q0P */\
- "pshufw $0x6F, %%mm5, %%mm5 \n\t" /* 0Q0Q0P0O */\
- "paddw %%mm1, %%mm4 \n\t" /* c */\
- "paddw %%mm2, %%mm5 \n\t" /* d */\
- "paddw %%mm6, %%mm6 \n\t" /* 2b */\
- "psubw %%mm6, %%mm4 \n\t" /* c - 2b */\
- "pmullw "MANGLE(ff_pw_20)", %%mm3 \n\t" /* 20a */\
- "pmullw "MANGLE(ff_pw_3)", %%mm4 \n\t" /* 3c - 6b */\
- "psubw %%mm5, %%mm3 \n\t" /* -6b + 3c - d */\
- "paddw %6, %%mm4 \n\t"\
- "paddw %%mm3, %%mm4 \n\t" /* 20a - 6b + 3c - d */\
- "psraw $5, %%mm4 \n\t"\
- "packuswb %%mm4, %%mm0 \n\t"\
- OP_MMX2(%%mm0, 8(%1), %%mm4, q)\
- \
- "add %3, %0 \n\t"\
- "add %4, %1 \n\t"\
- "decl %2 \n\t"\
- " jnz 1b \n\t"\
- : "+a"(src), "+c"(dst), "+D"(h)\
- : "d"((x86_reg)srcStride), "S"((x86_reg)dstStride), /*"m"(ff_pw_20), "m"(ff_pw_3),*/ "m"(temp), "m"(ROUNDER)\
- : "memory"\
- );\
-}\
-\
-static void OPNAME ## mpeg4_qpel16_h_lowpass_3dnow(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int h){\
- int i;\
- int16_t temp[16];\
- /* quick HACK, XXX FIXME MUST be optimized */\
- for(i=0; i<h; i++)\
- {\
- temp[ 0]= (src[ 0]+src[ 1])*20 - (src[ 0]+src[ 2])*6 + (src[ 1]+src[ 3])*3 - (src[ 2]+src[ 4]);\
- temp[ 1]= (src[ 1]+src[ 2])*20 - (src[ 0]+src[ 3])*6 + (src[ 0]+src[ 4])*3 - (src[ 1]+src[ 5]);\
- temp[ 2]= (src[ 2]+src[ 3])*20 - (src[ 1]+src[ 4])*6 + (src[ 0]+src[ 5])*3 - (src[ 0]+src[ 6]);\
- temp[ 3]= (src[ 3]+src[ 4])*20 - (src[ 2]+src[ 5])*6 + (src[ 1]+src[ 6])*3 - (src[ 0]+src[ 7]);\
- temp[ 4]= (src[ 4]+src[ 5])*20 - (src[ 3]+src[ 6])*6 + (src[ 2]+src[ 7])*3 - (src[ 1]+src[ 8]);\
- temp[ 5]= (src[ 5]+src[ 6])*20 - (src[ 4]+src[ 7])*6 + (src[ 3]+src[ 8])*3 - (src[ 2]+src[ 9]);\
- temp[ 6]= (src[ 6]+src[ 7])*20 - (src[ 5]+src[ 8])*6 + (src[ 4]+src[ 9])*3 - (src[ 3]+src[10]);\
- temp[ 7]= (src[ 7]+src[ 8])*20 - (src[ 6]+src[ 9])*6 + (src[ 5]+src[10])*3 - (src[ 4]+src[11]);\
- temp[ 8]= (src[ 8]+src[ 9])*20 - (src[ 7]+src[10])*6 + (src[ 6]+src[11])*3 - (src[ 5]+src[12]);\
- temp[ 9]= (src[ 9]+src[10])*20 - (src[ 8]+src[11])*6 + (src[ 7]+src[12])*3 - (src[ 6]+src[13]);\
- temp[10]= (src[10]+src[11])*20 - (src[ 9]+src[12])*6 + (src[ 8]+src[13])*3 - (src[ 7]+src[14]);\
- temp[11]= (src[11]+src[12])*20 - (src[10]+src[13])*6 + (src[ 9]+src[14])*3 - (src[ 8]+src[15]);\
- temp[12]= (src[12]+src[13])*20 - (src[11]+src[14])*6 + (src[10]+src[15])*3 - (src[ 9]+src[16]);\
- temp[13]= (src[13]+src[14])*20 - (src[12]+src[15])*6 + (src[11]+src[16])*3 - (src[10]+src[16]);\
- temp[14]= (src[14]+src[15])*20 - (src[13]+src[16])*6 + (src[12]+src[16])*3 - (src[11]+src[15]);\
- temp[15]= (src[15]+src[16])*20 - (src[14]+src[16])*6 + (src[13]+src[15])*3 - (src[12]+src[14]);\
- __asm__ volatile(\
- "movq (%0), %%mm0 \n\t"\
- "movq 8(%0), %%mm1 \n\t"\
- "paddw %2, %%mm0 \n\t"\
- "paddw %2, %%mm1 \n\t"\
- "psraw $5, %%mm0 \n\t"\
- "psraw $5, %%mm1 \n\t"\
- "packuswb %%mm1, %%mm0 \n\t"\
- OP_3DNOW(%%mm0, (%1), %%mm1, q)\
- "movq 16(%0), %%mm0 \n\t"\
- "movq 24(%0), %%mm1 \n\t"\
- "paddw %2, %%mm0 \n\t"\
- "paddw %2, %%mm1 \n\t"\
- "psraw $5, %%mm0 \n\t"\
- "psraw $5, %%mm1 \n\t"\
- "packuswb %%mm1, %%mm0 \n\t"\
- OP_3DNOW(%%mm0, 8(%1), %%mm1, q)\
- :: "r"(temp), "r"(dst), "m"(ROUNDER)\
- : "memory"\
- );\
- dst+=dstStride;\
- src+=srcStride;\
- }\
-}\
-\
-static void OPNAME ## mpeg4_qpel8_h_lowpass_mmx2(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int h){\
- __asm__ volatile(\
- "pxor %%mm7, %%mm7 \n\t"\
- "1: \n\t"\
- "movq (%0), %%mm0 \n\t" /* ABCDEFGH */\
- "movq %%mm0, %%mm1 \n\t" /* ABCDEFGH */\
- "movq %%mm0, %%mm2 \n\t" /* ABCDEFGH */\
- "punpcklbw %%mm7, %%mm0 \n\t" /* 0A0B0C0D */\
- "punpckhbw %%mm7, %%mm1 \n\t" /* 0E0F0G0H */\
- "pshufw $0x90, %%mm0, %%mm5 \n\t" /* 0A0A0B0C */\
- "pshufw $0x41, %%mm0, %%mm6 \n\t" /* 0B0A0A0B */\
- "movq %%mm2, %%mm3 \n\t" /* ABCDEFGH */\
- "movq %%mm2, %%mm4 \n\t" /* ABCDEFGH */\
- "psllq $8, %%mm2 \n\t" /* 0ABCDEFG */\
- "psllq $16, %%mm3 \n\t" /* 00ABCDEF */\
- "psllq $24, %%mm4 \n\t" /* 000ABCDE */\
- "punpckhbw %%mm7, %%mm2 \n\t" /* 0D0E0F0G */\
- "punpckhbw %%mm7, %%mm3 \n\t" /* 0C0D0E0F */\
- "punpckhbw %%mm7, %%mm4 \n\t" /* 0B0C0D0E */\
- "paddw %%mm3, %%mm5 \n\t" /* b */\
- "paddw %%mm2, %%mm6 \n\t" /* c */\
- "paddw %%mm5, %%mm5 \n\t" /* 2b */\
- "psubw %%mm5, %%mm6 \n\t" /* c - 2b */\
- "pshufw $0x06, %%mm0, %%mm5 \n\t" /* 0C0B0A0A */\
- "pmullw "MANGLE(ff_pw_3)", %%mm6 \n\t" /* 3c - 6b */\
- "paddw %%mm4, %%mm0 \n\t" /* a */\
- "paddw %%mm1, %%mm5 \n\t" /* d */\
- "pmullw "MANGLE(ff_pw_20)", %%mm0 \n\t" /* 20a */\
- "psubw %%mm5, %%mm0 \n\t" /* 20a - d */\
- "paddw %5, %%mm6 \n\t"\
- "paddw %%mm6, %%mm0 \n\t" /* 20a - 6b + 3c - d */\
- "psraw $5, %%mm0 \n\t"\
- /* mm1=EFGH, mm2=DEFG, mm3=CDEF, mm4=BCDE, mm7=0 */\
- \
- "movd 5(%0), %%mm5 \n\t" /* FGHI */\
- "punpcklbw %%mm7, %%mm5 \n\t" /* 0F0G0H0I */\
- "pshufw $0xF9, %%mm5, %%mm6 \n\t" /* 0G0H0I0I */\
- "paddw %%mm5, %%mm1 \n\t" /* a */\
- "paddw %%mm6, %%mm2 \n\t" /* b */\
- "pshufw $0xBE, %%mm5, %%mm6 \n\t" /* 0H0I0I0H */\
- "pshufw $0x6F, %%mm5, %%mm5 \n\t" /* 0I0I0H0G */\
- "paddw %%mm6, %%mm3 \n\t" /* c */\
- "paddw %%mm5, %%mm4 \n\t" /* d */\
- "paddw %%mm2, %%mm2 \n\t" /* 2b */\
- "psubw %%mm2, %%mm3 \n\t" /* c - 2b */\
- "pmullw "MANGLE(ff_pw_20)", %%mm1 \n\t" /* 20a */\
- "pmullw "MANGLE(ff_pw_3)", %%mm3 \n\t" /* 3c - 6b */\
- "psubw %%mm4, %%mm3 \n\t" /* -6b + 3c - d */\
- "paddw %5, %%mm1 \n\t"\
- "paddw %%mm1, %%mm3 \n\t" /* 20a - 6b + 3c - d */\
- "psraw $5, %%mm3 \n\t"\
- "packuswb %%mm3, %%mm0 \n\t"\
- OP_MMX2(%%mm0, (%1), %%mm4, q)\
- \
- "add %3, %0 \n\t"\
- "add %4, %1 \n\t"\
- "decl %2 \n\t"\
- " jnz 1b \n\t"\
- : "+a"(src), "+c"(dst), "+d"(h)\
- : "S"((x86_reg)srcStride), "D"((x86_reg)dstStride), /*"m"(ff_pw_20), "m"(ff_pw_3),*/ "m"(ROUNDER)\
- : "memory"\
- );\
-}\
-\
-static void OPNAME ## mpeg4_qpel8_h_lowpass_3dnow(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int h){\
- int i;\
- int16_t temp[8];\
- /* quick HACK, XXX FIXME MUST be optimized */\
- for(i=0; i<h; i++)\
- {\
- temp[ 0]= (src[ 0]+src[ 1])*20 - (src[ 0]+src[ 2])*6 + (src[ 1]+src[ 3])*3 - (src[ 2]+src[ 4]);\
- temp[ 1]= (src[ 1]+src[ 2])*20 - (src[ 0]+src[ 3])*6 + (src[ 0]+src[ 4])*3 - (src[ 1]+src[ 5]);\
- temp[ 2]= (src[ 2]+src[ 3])*20 - (src[ 1]+src[ 4])*6 + (src[ 0]+src[ 5])*3 - (src[ 0]+src[ 6]);\
- temp[ 3]= (src[ 3]+src[ 4])*20 - (src[ 2]+src[ 5])*6 + (src[ 1]+src[ 6])*3 - (src[ 0]+src[ 7]);\
- temp[ 4]= (src[ 4]+src[ 5])*20 - (src[ 3]+src[ 6])*6 + (src[ 2]+src[ 7])*3 - (src[ 1]+src[ 8]);\
- temp[ 5]= (src[ 5]+src[ 6])*20 - (src[ 4]+src[ 7])*6 + (src[ 3]+src[ 8])*3 - (src[ 2]+src[ 8]);\
- temp[ 6]= (src[ 6]+src[ 7])*20 - (src[ 5]+src[ 8])*6 + (src[ 4]+src[ 8])*3 - (src[ 3]+src[ 7]);\
- temp[ 7]= (src[ 7]+src[ 8])*20 - (src[ 6]+src[ 8])*6 + (src[ 5]+src[ 7])*3 - (src[ 4]+src[ 6]);\
- __asm__ volatile(\
- "movq (%0), %%mm0 \n\t"\
- "movq 8(%0), %%mm1 \n\t"\
- "paddw %2, %%mm0 \n\t"\
- "paddw %2, %%mm1 \n\t"\
- "psraw $5, %%mm0 \n\t"\
- "psraw $5, %%mm1 \n\t"\
- "packuswb %%mm1, %%mm0 \n\t"\
- OP_3DNOW(%%mm0, (%1), %%mm1, q)\
- :: "r"(temp), "r"(dst), "m"(ROUNDER)\
- :"memory"\
- );\
- dst+=dstStride;\
- src+=srcStride;\
- }\
+#define QPEL_OP(OPNAME, ROUNDER, RND, OP, MMX) \
+static void OPNAME ## mpeg4_qpel16_v_lowpass_ ## MMX(uint8_t *dst, \
+ uint8_t *src, \
+ int dstStride, \
+ int srcStride) \
+{ \
+ uint64_t temp[17 * 4]; \
+ uint64_t *temp_ptr = temp; \
+ int count = 17; \
+ \
+ /* FIXME unroll */ \
+ __asm__ volatile ( \
+ "pxor %%mm7, %%mm7 \n\t" \
+ "1: \n\t" \
+ "movq (%0), %%mm0 \n\t" \
+ "movq (%0), %%mm1 \n\t" \
+ "movq 8(%0), %%mm2 \n\t" \
+ "movq 8(%0), %%mm3 \n\t" \
+ "punpcklbw %%mm7, %%mm0 \n\t" \
+ "punpckhbw %%mm7, %%mm1 \n\t" \
+ "punpcklbw %%mm7, %%mm2 \n\t" \
+ "punpckhbw %%mm7, %%mm3 \n\t" \
+ "movq %%mm0, (%1) \n\t" \
+ "movq %%mm1, 17 * 8(%1) \n\t" \
+ "movq %%mm2, 2 * 17 * 8(%1) \n\t" \
+ "movq %%mm3, 3 * 17 * 8(%1) \n\t" \
+ "add $8, %1 \n\t" \
+ "add %3, %0 \n\t" \
+ "decl %2 \n\t" \
+ "jnz 1b \n\t" \
+ : "+r"(src), "+r"(temp_ptr), "+r"(count) \
+ : "r"((x86_reg)srcStride) \
+ : "memory" \
+ ); \
+ \
+ temp_ptr = temp; \
+ count = 4; \
+ \
+ /* FIXME reorder for speed */ \
+ __asm__ volatile ( \
+ /* "pxor %%mm7, %%mm7 \n\t" */ \
+ "1: \n\t" \
+ "movq (%0), %%mm0 \n\t" \
+ "movq 8(%0), %%mm1 \n\t" \
+ "movq 16(%0), %%mm2 \n\t" \
+ "movq 24(%0), %%mm3 \n\t" \
+ QPEL_V_LOW(%%mm0, %%mm1, %%mm2, %%mm3, %5, %6, %5, 16(%0), 8(%0), (%0), 32(%0), (%1), OP) \
+ QPEL_V_LOW(%%mm1, %%mm2, %%mm3, %%mm0, %5, %6, %5, 8(%0), (%0), (%0), 40(%0), (%1, %3), OP) \
+ "add %4, %1 \n\t" \
+ QPEL_V_LOW(%%mm2, %%mm3, %%mm0, %%mm1, %5, %6, %5, (%0), (%0), 8(%0), 48(%0), (%1), OP) \
+ \
+ QPEL_V_LOW(%%mm3, %%mm0, %%mm1, %%mm2, %5, %6, %5, (%0), 8(%0), 16(%0), 56(%0), (%1, %3), OP) \
+ "add %4, %1 \n\t" \
+ QPEL_V_LOW(%%mm0, %%mm1, %%mm2, %%mm3, %5, %6, %5, 8(%0), 16(%0), 24(%0), 64(%0), (%1), OP) \
+ QPEL_V_LOW(%%mm1, %%mm2, %%mm3, %%mm0, %5, %6, %5, 16(%0), 24(%0), 32(%0), 72(%0), (%1, %3), OP) \
+ "add %4, %1 \n\t" \
+ QPEL_V_LOW(%%mm2, %%mm3, %%mm0, %%mm1, %5, %6, %5, 24(%0), 32(%0), 40(%0), 80(%0), (%1), OP) \
+ QPEL_V_LOW(%%mm3, %%mm0, %%mm1, %%mm2, %5, %6, %5, 32(%0), 40(%0), 48(%0), 88(%0), (%1, %3), OP) \
+ "add %4, %1 \n\t" \
+ QPEL_V_LOW(%%mm0, %%mm1, %%mm2, %%mm3, %5, %6, %5, 40(%0), 48(%0), 56(%0), 96(%0), (%1), OP) \
+ QPEL_V_LOW(%%mm1, %%mm2, %%mm3, %%mm0, %5, %6, %5, 48(%0), 56(%0), 64(%0), 104(%0), (%1, %3), OP) \
+ "add %4, %1 \n\t" \
+ QPEL_V_LOW(%%mm2, %%mm3, %%mm0, %%mm1, %5, %6, %5, 56(%0), 64(%0), 72(%0), 112(%0), (%1), OP) \
+ QPEL_V_LOW(%%mm3, %%mm0, %%mm1, %%mm2, %5, %6, %5, 64(%0), 72(%0), 80(%0), 120(%0), (%1, %3), OP) \
+ "add %4, %1 \n\t" \
+ QPEL_V_LOW(%%mm0, %%mm1, %%mm2, %%mm3, %5, %6, %5, 72(%0), 80(%0), 88(%0), 128(%0), (%1), OP) \
+ \
+ QPEL_V_LOW(%%mm1, %%mm2, %%mm3, %%mm0, %5, %6, %5, 80(%0), 88(%0), 96(%0), 128(%0), (%1, %3), OP) \
+ "add %4, %1 \n\t" \
+ QPEL_V_LOW(%%mm2, %%mm3, %%mm0, %%mm1, %5, %6, %5, 88(%0), 96(%0), 104(%0), 120(%0), (%1), OP) \
+ QPEL_V_LOW(%%mm3, %%mm0, %%mm1, %%mm2, %5, %6, %5, 96(%0), 104(%0), 112(%0), 112(%0), (%1, %3), OP) \
+ \
+ "add $136, %0 \n\t" \
+ "add %6, %1 \n\t" \
+ "decl %2 \n\t" \
+ "jnz 1b \n\t" \
+ \
+ : "+r"(temp_ptr), "+r"(dst), "+g"(count) \
+ : "r"((x86_reg)dstStride), "r"(2 * (x86_reg)dstStride), \
+ /* "m"(ff_pw_20), "m"(ff_pw_3), */ "m"(ROUNDER), \
+ "g"(4 - 14 * (x86_reg)dstStride) \
+ : "memory" \
+ ); \
+} \
+ \
+static void OPNAME ## mpeg4_qpel8_v_lowpass_ ## MMX(uint8_t *dst, \
+ uint8_t *src, \
+ int dstStride, \
+ int srcStride) \
+{ \
+ uint64_t temp[9 * 2]; \
+ uint64_t *temp_ptr = temp; \
+ int count = 9; \
+ \
+ /* FIXME unroll */ \
+ __asm__ volatile ( \
+ "pxor %%mm7, %%mm7 \n\t" \
+ "1: \n\t" \
+ "movq (%0), %%mm0 \n\t" \
+ "movq (%0), %%mm1 \n\t" \
+ "punpcklbw %%mm7, %%mm0 \n\t" \
+ "punpckhbw %%mm7, %%mm1 \n\t" \
+ "movq %%mm0, (%1) \n\t" \
+ "movq %%mm1, 9*8(%1) \n\t" \
+ "add $8, %1 \n\t" \
+ "add %3, %0 \n\t" \
+ "decl %2 \n\t" \
+ "jnz 1b \n\t" \
+ : "+r"(src), "+r"(temp_ptr), "+r"(count) \
+ : "r"((x86_reg)srcStride) \
+ : "memory" \
+ ); \
+ \
+ temp_ptr = temp; \
+ count = 2; \
+ \
+ /* FIXME reorder for speed */ \
+ __asm__ volatile ( \
+ /* "pxor %%mm7, %%mm7 \n\t" */ \
+ "1: \n\t" \
+ "movq (%0), %%mm0 \n\t" \
+ "movq 8(%0), %%mm1 \n\t" \
+ "movq 16(%0), %%mm2 \n\t" \
+ "movq 24(%0), %%mm3 \n\t" \
+ QPEL_V_LOW(%%mm0, %%mm1, %%mm2, %%mm3, %5, %6, %5, 16(%0), 8(%0), (%0), 32(%0), (%1), OP) \
+ QPEL_V_LOW(%%mm1, %%mm2, %%mm3, %%mm0, %5, %6, %5, 8(%0), (%0), (%0), 40(%0), (%1, %3), OP) \
+ "add %4, %1 \n\t" \
+ QPEL_V_LOW(%%mm2, %%mm3, %%mm0, %%mm1, %5, %6, %5, (%0), (%0), 8(%0), 48(%0), (%1), OP) \
+ \
+ QPEL_V_LOW(%%mm3, %%mm0, %%mm1, %%mm2, %5, %6, %5, (%0), 8(%0), 16(%0), 56(%0), (%1, %3), OP) \
+ "add %4, %1 \n\t" \
+ QPEL_V_LOW(%%mm0, %%mm1, %%mm2, %%mm3, %5, %6, %5, 8(%0), 16(%0), 24(%0), 64(%0), (%1), OP) \
+ \
+ QPEL_V_LOW(%%mm1, %%mm2, %%mm3, %%mm0, %5, %6, %5, 16(%0), 24(%0), 32(%0), 64(%0), (%1, %3), OP) \
+ "add %4, %1 \n\t" \
+ QPEL_V_LOW(%%mm2, %%mm3, %%mm0, %%mm1, %5, %6, %5, 24(%0), 32(%0), 40(%0), 56(%0), (%1), OP) \
+ QPEL_V_LOW(%%mm3, %%mm0, %%mm1, %%mm2, %5, %6, %5, 32(%0), 40(%0), 48(%0), 48(%0), (%1, %3), OP) \
+ \
+ "add $72, %0 \n\t" \
+ "add %6, %1 \n\t" \
+ "decl %2 \n\t" \
+ "jnz 1b \n\t" \
+ \
+ : "+r"(temp_ptr), "+r"(dst), "+g"(count) \
+ : "r"((x86_reg)dstStride), "r"(2 * (x86_reg)dstStride), \
+ /* "m"(ff_pw_20), "m"(ff_pw_3), */ "m"(ROUNDER), \
+ "g"(4 - 6 * (x86_reg)dstStride) \
+ : "memory" \
+ ); \
+} \
+ \
+static void OPNAME ## qpel8_mc00_ ## MMX (uint8_t *dst, uint8_t *src, \
+ int stride) \
+{ \
+ OPNAME ## pixels8_ ## MMX(dst, src, stride, 8); \
+} \
+ \
+static void OPNAME ## qpel8_mc10_ ## MMX(uint8_t *dst, uint8_t *src, \
+ int stride) \
+{ \
+ uint64_t temp[8]; \
+ uint8_t * const half = (uint8_t*)temp; \
+ put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(half, src, 8, \
+ stride, 8); \
+ OPNAME ## pixels8_l2_ ## MMX(dst, src, half, stride, stride, 8); \
+} \
+ \
+static void OPNAME ## qpel8_mc20_ ## MMX(uint8_t *dst, uint8_t *src, \
+ int stride) \
+{ \
+ OPNAME ## mpeg4_qpel8_h_lowpass_ ## MMX(dst, src, stride, \
+ stride, 8); \
+} \
+ \
+static void OPNAME ## qpel8_mc30_ ## MMX(uint8_t *dst, uint8_t *src, \
+ int stride) \
+{ \
+ uint64_t temp[8]; \
+ uint8_t * const half = (uint8_t*)temp; \
+ put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(half, src, 8, \
+ stride, 8); \
+ OPNAME ## pixels8_l2_ ## MMX(dst, src + 1, half, stride, \
+ stride, 8); \
+} \
+ \
+static void OPNAME ## qpel8_mc01_ ## MMX(uint8_t *dst, uint8_t *src, \
+ int stride) \
+{ \
+ uint64_t temp[8]; \
+ uint8_t * const half = (uint8_t*)temp; \
+ put ## RND ## mpeg4_qpel8_v_lowpass_ ## MMX(half, src, 8, stride); \
+ OPNAME ## pixels8_l2_ ## MMX(dst, src, half, stride, stride, 8); \
+} \
+ \
+static void OPNAME ## qpel8_mc02_ ## MMX(uint8_t *dst, uint8_t *src, \
+ int stride) \
+{ \
+ OPNAME ## mpeg4_qpel8_v_lowpass_ ## MMX(dst, src, stride, stride); \
+} \
+ \
+static void OPNAME ## qpel8_mc03_ ## MMX(uint8_t *dst, uint8_t *src, \
+ int stride) \
+{ \
+ uint64_t temp[8]; \
+ uint8_t * const half = (uint8_t*)temp; \
+ put ## RND ## mpeg4_qpel8_v_lowpass_ ## MMX(half, src, 8, stride); \
+ OPNAME ## pixels8_l2_ ## MMX(dst, src + stride, half, stride, \
+ stride, 8); \
+} \
+ \
+static void OPNAME ## qpel8_mc11_ ## MMX(uint8_t *dst, uint8_t *src, \
+ int stride) \
+{ \
+ uint64_t half[8 + 9]; \
+ uint8_t * const halfH = ((uint8_t*)half) + 64; \
+ uint8_t * const halfHV = ((uint8_t*)half); \
+ put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(halfH, src, 8, \
+ stride, 9); \
+ put ## RND ## pixels8_l2_ ## MMX(halfH, src, halfH, 8, stride, 9); \
+ put ## RND ## mpeg4_qpel8_v_lowpass_ ## MMX(halfHV, halfH, 8, 8); \
+ OPNAME ## pixels8_l2_ ## MMX(dst, halfH, halfHV, stride, 8, 8); \
+} \
+ \
+static void OPNAME ## qpel8_mc31_ ## MMX(uint8_t *dst, uint8_t *src, \
+ int stride) \
+{ \
+ uint64_t half[8 + 9]; \
+ uint8_t * const halfH = ((uint8_t*)half) + 64; \
+ uint8_t * const halfHV = ((uint8_t*)half); \
+ put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(halfH, src, 8, \
+ stride, 9); \
+ put ## RND ## pixels8_l2_ ## MMX(halfH, src + 1, halfH, 8, \
+ stride, 9); \
+ put ## RND ## mpeg4_qpel8_v_lowpass_ ## MMX(halfHV, halfH, 8, 8); \
+ OPNAME ## pixels8_l2_ ## MMX(dst, halfH, halfHV, stride, 8, 8); \
+} \
+ \
+static void OPNAME ## qpel8_mc13_ ## MMX(uint8_t *dst, uint8_t *src, \
+ int stride) \
+{ \
+ uint64_t half[8 + 9]; \
+ uint8_t * const halfH = ((uint8_t*)half) + 64; \
+ uint8_t * const halfHV = ((uint8_t*)half); \
+ put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(halfH, src, 8, \
+ stride, 9); \
+ put ## RND ## pixels8_l2_ ## MMX(halfH, src, halfH, 8, stride, 9); \
+ put ## RND ## mpeg4_qpel8_v_lowpass_ ## MMX(halfHV, halfH, 8, 8); \
+ OPNAME ## pixels8_l2_ ## MMX(dst, halfH + 8, halfHV, stride, 8, 8); \
+} \
+ \
+static void OPNAME ## qpel8_mc33_ ## MMX(uint8_t *dst, uint8_t *src, \
+ int stride) \
+{ \
+ uint64_t half[8 + 9]; \
+ uint8_t * const halfH = ((uint8_t*)half) + 64; \
+ uint8_t * const halfHV = ((uint8_t*)half); \
+ put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(halfH, src, 8, \
+ stride, 9); \
+ put ## RND ## pixels8_l2_ ## MMX(halfH, src + 1, halfH, 8, \
+ stride, 9); \
+ put ## RND ## mpeg4_qpel8_v_lowpass_ ## MMX(halfHV, halfH, 8, 8); \
+ OPNAME ## pixels8_l2_ ## MMX(dst, halfH + 8, halfHV, stride, 8, 8); \
+} \
+ \
+static void OPNAME ## qpel8_mc21_ ## MMX(uint8_t *dst, uint8_t *src, \
+ int stride) \
+{ \
+ uint64_t half[8 + 9]; \
+ uint8_t * const halfH = ((uint8_t*)half) + 64; \
+ uint8_t * const halfHV = ((uint8_t*)half); \
+ put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(halfH, src, 8, \
+ stride, 9); \
+ put ## RND ## mpeg4_qpel8_v_lowpass_ ## MMX(halfHV, halfH, 8, 8); \
+ OPNAME ## pixels8_l2_ ## MMX(dst, halfH, halfHV, stride, 8, 8); \
+} \
+ \
+static void OPNAME ## qpel8_mc23_ ## MMX(uint8_t *dst, uint8_t *src, \
+ int stride) \
+{ \
+ uint64_t half[8 + 9]; \
+ uint8_t * const halfH = ((uint8_t*)half) + 64; \
+ uint8_t * const halfHV = ((uint8_t*)half); \
+ put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(halfH, src, 8, \
+ stride, 9); \
+ put ## RND ## mpeg4_qpel8_v_lowpass_ ## MMX(halfHV, halfH, 8, 8); \
+ OPNAME ## pixels8_l2_ ## MMX(dst, halfH + 8, halfHV, stride, 8, 8); \
+} \
+ \
+static void OPNAME ## qpel8_mc12_ ## MMX(uint8_t *dst, uint8_t *src, \
+ int stride) \
+{ \
+ uint64_t half[8 + 9]; \
+ uint8_t * const halfH = ((uint8_t*)half); \
+ put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(halfH, src, 8, \
+ stride, 9); \
+ put ## RND ## pixels8_l2_ ## MMX(halfH, src, halfH, 8, stride, 9); \
+ OPNAME ## mpeg4_qpel8_v_lowpass_ ## MMX(dst, halfH, stride, 8); \
+} \
+ \
+static void OPNAME ## qpel8_mc32_ ## MMX(uint8_t *dst, uint8_t *src, \
+ int stride) \
+{ \
+ uint64_t half[8 + 9]; \
+ uint8_t * const halfH = ((uint8_t*)half); \
+ put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(halfH, src, 8, \
+ stride, 9); \
+ put ## RND ## pixels8_l2_ ## MMX(halfH, src + 1, halfH, 8, \
+ stride, 9); \
+ OPNAME ## mpeg4_qpel8_v_lowpass_ ## MMX(dst, halfH, stride, 8); \
+} \
+ \
+static void OPNAME ## qpel8_mc22_ ## MMX(uint8_t *dst, uint8_t *src, \
+ int stride) \
+{ \
+ uint64_t half[9]; \
+ uint8_t * const halfH = ((uint8_t*)half); \
+ put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(halfH, src, 8, \
+ stride, 9); \
+ OPNAME ## mpeg4_qpel8_v_lowpass_ ## MMX(dst, halfH, stride, 8); \
+} \
+ \
+static void OPNAME ## qpel16_mc00_ ## MMX (uint8_t *dst, uint8_t *src, \
+ int stride) \
+{ \
+ OPNAME ## pixels16_ ## MMX(dst, src, stride, 16); \
+} \
+ \
+static void OPNAME ## qpel16_mc10_ ## MMX(uint8_t *dst, uint8_t *src, \
+ int stride) \
+{ \
+ uint64_t temp[32]; \
+ uint8_t * const half = (uint8_t*)temp; \
+ put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(half, src, 16, \
+ stride, 16); \
+ OPNAME ## pixels16_l2_ ## MMX(dst, src, half, stride, stride, 16); \
+} \
+ \
+static void OPNAME ## qpel16_mc20_ ## MMX(uint8_t *dst, uint8_t *src, \
+ int stride) \
+{ \
+ OPNAME ## mpeg4_qpel16_h_lowpass_ ## MMX(dst, src, \
+ stride, stride, 16); \
+} \
+ \
+static void OPNAME ## qpel16_mc30_ ## MMX(uint8_t *dst, uint8_t *src, \
+ int stride) \
+{ \
+ uint64_t temp[32]; \
+ uint8_t * const half = (uint8_t*)temp; \
+ put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(half, src, 16, \
+ stride, 16); \
+ OPNAME ## pixels16_l2_ ## MMX(dst, src + 1, half, \
+ stride, stride, 16); \
+} \
+ \
+static void OPNAME ## qpel16_mc01_ ## MMX(uint8_t *dst, uint8_t *src, \
+ int stride) \
+{ \
+ uint64_t temp[32]; \
+ uint8_t * const half = (uint8_t*)temp; \
+ put ## RND ## mpeg4_qpel16_v_lowpass_ ## MMX(half, src, 16, \
+ stride); \
+ OPNAME ## pixels16_l2_ ## MMX(dst, src, half, stride, stride, 16); \
+} \
+ \
+static void OPNAME ## qpel16_mc02_ ## MMX(uint8_t *dst, uint8_t *src, \
+ int stride) \
+{ \
+ OPNAME ## mpeg4_qpel16_v_lowpass_ ## MMX(dst, src, stride, stride); \
+} \
+ \
+static void OPNAME ## qpel16_mc03_ ## MMX(uint8_t *dst, uint8_t *src, \
+ int stride) \
+{ \
+ uint64_t temp[32]; \
+ uint8_t * const half = (uint8_t*)temp; \
+ put ## RND ## mpeg4_qpel16_v_lowpass_ ## MMX(half, src, 16, \
+ stride); \
+ OPNAME ## pixels16_l2_ ## MMX(dst, src+stride, half, \
+ stride, stride, 16); \
+} \
+ \
+static void OPNAME ## qpel16_mc11_ ## MMX(uint8_t *dst, uint8_t *src, \
+ int stride) \
+{ \
+ uint64_t half[16 * 2 + 17 * 2]; \
+ uint8_t * const halfH = ((uint8_t*)half) + 256; \
+ uint8_t * const halfHV = ((uint8_t*)half); \
+ put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(halfH, src, 16, \
+ stride, 17); \
+ put ## RND ## pixels16_l2_ ## MMX(halfH, src, halfH, 16, \
+ stride, 17); \
+ put ## RND ## mpeg4_qpel16_v_lowpass_ ## MMX(halfHV, halfH, \
+ 16, 16); \
+ OPNAME ## pixels16_l2_ ## MMX(dst, halfH, halfHV, stride, 16, 16); \
+} \
+ \
+static void OPNAME ## qpel16_mc31_ ## MMX(uint8_t *dst, uint8_t *src, \
+ int stride) \
+{ \
+ uint64_t half[16 * 2 + 17 * 2]; \
+ uint8_t * const halfH = ((uint8_t*)half) + 256; \
+ uint8_t * const halfHV = ((uint8_t*)half); \
+ put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(halfH, src, 16, \
+ stride, 17); \
+ put ## RND ## pixels16_l2_ ## MMX(halfH, src + 1, halfH, 16, \
+ stride, 17); \
+ put ## RND ## mpeg4_qpel16_v_lowpass_ ## MMX(halfHV, halfH, \
+ 16, 16); \
+ OPNAME ## pixels16_l2_ ## MMX(dst, halfH, halfHV, stride, 16, 16); \
+} \
+ \
+static void OPNAME ## qpel16_mc13_ ## MMX(uint8_t *dst, uint8_t *src, \
+ int stride) \
+{ \
+ uint64_t half[16 * 2 + 17 * 2]; \
+ uint8_t * const halfH = ((uint8_t*)half) + 256; \
+ uint8_t * const halfHV = ((uint8_t*)half); \
+ put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(halfH, src, 16, \
+ stride, 17); \
+ put ## RND ## pixels16_l2_ ## MMX(halfH, src, halfH, 16, \
+ stride, 17); \
+ put ## RND ## mpeg4_qpel16_v_lowpass_ ## MMX(halfHV, halfH, \
+ 16, 16); \
+ OPNAME ## pixels16_l2_ ## MMX(dst, halfH + 16, halfHV, stride, \
+ 16, 16); \
+} \
+ \
+static void OPNAME ## qpel16_mc33_ ## MMX(uint8_t *dst, uint8_t *src, \
+ int stride) \
+{ \
+ uint64_t half[16 * 2 + 17 * 2]; \
+ uint8_t * const halfH = ((uint8_t*)half) + 256; \
+ uint8_t * const halfHV = ((uint8_t*)half); \
+ put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(halfH, src, 16, \
+ stride, 17); \
+ put ## RND ## pixels16_l2_ ## MMX(halfH, src + 1, halfH, 16, \
+ stride, 17); \
+ put ## RND ## mpeg4_qpel16_v_lowpass_ ## MMX(halfHV, halfH, \
+ 16, 16); \
+ OPNAME ## pixels16_l2_ ## MMX(dst, halfH + 16, halfHV, stride, \
+ 16, 16); \
+} \
+ \
+static void OPNAME ## qpel16_mc21_ ## MMX(uint8_t *dst, uint8_t *src, \
+ int stride) \
+{ \
+ uint64_t half[16 * 2 + 17 * 2]; \
+ uint8_t * const halfH = ((uint8_t*)half) + 256; \
+ uint8_t * const halfHV = ((uint8_t*)half); \
+ put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(halfH, src, 16, \
+ stride, 17); \
+ put ## RND ## mpeg4_qpel16_v_lowpass_ ## MMX(halfHV, halfH, \
+ 16, 16); \
+ OPNAME ## pixels16_l2_ ## MMX(dst, halfH, halfHV, stride, 16, 16); \
+} \
+ \
+static void OPNAME ## qpel16_mc23_ ## MMX(uint8_t *dst, uint8_t *src, \
+ int stride) \
+{ \
+ uint64_t half[16 * 2 + 17 * 2]; \
+ uint8_t * const halfH = ((uint8_t*)half) + 256; \
+ uint8_t * const halfHV = ((uint8_t*)half); \
+ put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(halfH, src, 16, \
+ stride, 17); \
+ put ## RND ## mpeg4_qpel16_v_lowpass_ ## MMX(halfHV, halfH, \
+ 16, 16); \
+ OPNAME ## pixels16_l2_ ## MMX(dst, halfH + 16, halfHV, stride, \
+ 16, 16); \
+} \
+ \
+static void OPNAME ## qpel16_mc12_ ## MMX(uint8_t *dst, uint8_t *src, \
+ int stride) \
+{ \
+ uint64_t half[17 * 2]; \
+ uint8_t * const halfH = ((uint8_t*)half); \
+ put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(halfH, src, 16, \
+ stride, 17); \
+ put ## RND ## pixels16_l2_ ## MMX(halfH, src, halfH, 16, \
+ stride, 17); \
+ OPNAME ## mpeg4_qpel16_v_lowpass_ ## MMX(dst, halfH, stride, 16); \
+} \
+ \
+static void OPNAME ## qpel16_mc32_ ## MMX(uint8_t *dst, uint8_t *src, \
+ int stride) \
+{ \
+ uint64_t half[17 * 2]; \
+ uint8_t * const halfH = ((uint8_t*)half); \
+ put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(halfH, src, 16, \
+ stride, 17); \
+ put ## RND ## pixels16_l2_ ## MMX(halfH, src + 1, halfH, 16, \
+ stride, 17); \
+ OPNAME ## mpeg4_qpel16_v_lowpass_ ## MMX(dst, halfH, stride, 16); \
+} \
+ \
+static void OPNAME ## qpel16_mc22_ ## MMX(uint8_t *dst, uint8_t *src, \
+ int stride) \
+{ \
+ uint64_t half[17 * 2]; \
+ uint8_t * const halfH = ((uint8_t*)half); \
+ put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(halfH, src, 16, \
+ stride, 17); \
+ OPNAME ## mpeg4_qpel16_v_lowpass_ ## MMX(dst, halfH, stride, 16); \
}
-#define QPEL_OP(OPNAME, ROUNDER, RND, OP, MMX)\
-\
-static void OPNAME ## mpeg4_qpel16_v_lowpass_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
- uint64_t temp[17*4];\
- uint64_t *temp_ptr= temp;\
- int count= 17;\
-\
- /*FIXME unroll */\
- __asm__ volatile(\
- "pxor %%mm7, %%mm7 \n\t"\
- "1: \n\t"\
- "movq (%0), %%mm0 \n\t"\
- "movq (%0), %%mm1 \n\t"\
- "movq 8(%0), %%mm2 \n\t"\
- "movq 8(%0), %%mm3 \n\t"\
- "punpcklbw %%mm7, %%mm0 \n\t"\
- "punpckhbw %%mm7, %%mm1 \n\t"\
- "punpcklbw %%mm7, %%mm2 \n\t"\
- "punpckhbw %%mm7, %%mm3 \n\t"\
- "movq %%mm0, (%1) \n\t"\
- "movq %%mm1, 17*8(%1) \n\t"\
- "movq %%mm2, 2*17*8(%1) \n\t"\
- "movq %%mm3, 3*17*8(%1) \n\t"\
- "add $8, %1 \n\t"\
- "add %3, %0 \n\t"\
- "decl %2 \n\t"\
- " jnz 1b \n\t"\
- : "+r" (src), "+r" (temp_ptr), "+r"(count)\
- : "r" ((x86_reg)srcStride)\
- : "memory"\
- );\
- \
- temp_ptr= temp;\
- count=4;\
- \
-/*FIXME reorder for speed */\
- __asm__ volatile(\
- /*"pxor %%mm7, %%mm7 \n\t"*/\
- "1: \n\t"\
- "movq (%0), %%mm0 \n\t"\
- "movq 8(%0), %%mm1 \n\t"\
- "movq 16(%0), %%mm2 \n\t"\
- "movq 24(%0), %%mm3 \n\t"\
- QPEL_V_LOW(%%mm0, %%mm1, %%mm2, %%mm3, %5, %6, %5, 16(%0), 8(%0), (%0), 32(%0), (%1), OP)\
- QPEL_V_LOW(%%mm1, %%mm2, %%mm3, %%mm0, %5, %6, %5, 8(%0), (%0), (%0), 40(%0), (%1, %3), OP)\
- "add %4, %1 \n\t"\
- QPEL_V_LOW(%%mm2, %%mm3, %%mm0, %%mm1, %5, %6, %5, (%0), (%0), 8(%0), 48(%0), (%1), OP)\
- \
- QPEL_V_LOW(%%mm3, %%mm0, %%mm1, %%mm2, %5, %6, %5, (%0), 8(%0), 16(%0), 56(%0), (%1, %3), OP)\
- "add %4, %1 \n\t"\
- QPEL_V_LOW(%%mm0, %%mm1, %%mm2, %%mm3, %5, %6, %5, 8(%0), 16(%0), 24(%0), 64(%0), (%1), OP)\
- QPEL_V_LOW(%%mm1, %%mm2, %%mm3, %%mm0, %5, %6, %5, 16(%0), 24(%0), 32(%0), 72(%0), (%1, %3), OP)\
- "add %4, %1 \n\t"\
- QPEL_V_LOW(%%mm2, %%mm3, %%mm0, %%mm1, %5, %6, %5, 24(%0), 32(%0), 40(%0), 80(%0), (%1), OP)\
- QPEL_V_LOW(%%mm3, %%mm0, %%mm1, %%mm2, %5, %6, %5, 32(%0), 40(%0), 48(%0), 88(%0), (%1, %3), OP)\
- "add %4, %1 \n\t"\
- QPEL_V_LOW(%%mm0, %%mm1, %%mm2, %%mm3, %5, %6, %5, 40(%0), 48(%0), 56(%0), 96(%0), (%1), OP)\
- QPEL_V_LOW(%%mm1, %%mm2, %%mm3, %%mm0, %5, %6, %5, 48(%0), 56(%0), 64(%0),104(%0), (%1, %3), OP)\
- "add %4, %1 \n\t"\
- QPEL_V_LOW(%%mm2, %%mm3, %%mm0, %%mm1, %5, %6, %5, 56(%0), 64(%0), 72(%0),112(%0), (%1), OP)\
- QPEL_V_LOW(%%mm3, %%mm0, %%mm1, %%mm2, %5, %6, %5, 64(%0), 72(%0), 80(%0),120(%0), (%1, %3), OP)\
- "add %4, %1 \n\t"\
- QPEL_V_LOW(%%mm0, %%mm1, %%mm2, %%mm3, %5, %6, %5, 72(%0), 80(%0), 88(%0),128(%0), (%1), OP)\
- \
- QPEL_V_LOW(%%mm1, %%mm2, %%mm3, %%mm0, %5, %6, %5, 80(%0), 88(%0), 96(%0),128(%0), (%1, %3), OP)\
- "add %4, %1 \n\t" \
- QPEL_V_LOW(%%mm2, %%mm3, %%mm0, %%mm1, %5, %6, %5, 88(%0), 96(%0),104(%0),120(%0), (%1), OP)\
- QPEL_V_LOW(%%mm3, %%mm0, %%mm1, %%mm2, %5, %6, %5, 96(%0),104(%0),112(%0),112(%0), (%1, %3), OP)\
- \
- "add $136, %0 \n\t"\
- "add %6, %1 \n\t"\
- "decl %2 \n\t"\
- " jnz 1b \n\t"\
- \
- : "+r"(temp_ptr), "+r"(dst), "+g"(count)\
- : "r"((x86_reg)dstStride), "r"(2*(x86_reg)dstStride), /*"m"(ff_pw_20), "m"(ff_pw_3),*/ "m"(ROUNDER), "g"(4-14*(x86_reg)dstStride)\
- :"memory"\
- );\
-}\
-\
-static void OPNAME ## mpeg4_qpel8_v_lowpass_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
- uint64_t temp[9*2];\
- uint64_t *temp_ptr= temp;\
- int count= 9;\
-\
- /*FIXME unroll */\
- __asm__ volatile(\
- "pxor %%mm7, %%mm7 \n\t"\
- "1: \n\t"\
- "movq (%0), %%mm0 \n\t"\
- "movq (%0), %%mm1 \n\t"\
- "punpcklbw %%mm7, %%mm0 \n\t"\
- "punpckhbw %%mm7, %%mm1 \n\t"\
- "movq %%mm0, (%1) \n\t"\
- "movq %%mm1, 9*8(%1) \n\t"\
- "add $8, %1 \n\t"\
- "add %3, %0 \n\t"\
- "decl %2 \n\t"\
- " jnz 1b \n\t"\
- : "+r" (src), "+r" (temp_ptr), "+r"(count)\
- : "r" ((x86_reg)srcStride)\
- : "memory"\
- );\
- \
- temp_ptr= temp;\
- count=2;\
- \
-/*FIXME reorder for speed */\
- __asm__ volatile(\
- /*"pxor %%mm7, %%mm7 \n\t"*/\
- "1: \n\t"\
- "movq (%0), %%mm0 \n\t"\
- "movq 8(%0), %%mm1 \n\t"\
- "movq 16(%0), %%mm2 \n\t"\
- "movq 24(%0), %%mm3 \n\t"\
- QPEL_V_LOW(%%mm0, %%mm1, %%mm2, %%mm3, %5, %6, %5, 16(%0), 8(%0), (%0), 32(%0), (%1), OP)\
- QPEL_V_LOW(%%mm1, %%mm2, %%mm3, %%mm0, %5, %6, %5, 8(%0), (%0), (%0), 40(%0), (%1, %3), OP)\
- "add %4, %1 \n\t"\
- QPEL_V_LOW(%%mm2, %%mm3, %%mm0, %%mm1, %5, %6, %5, (%0), (%0), 8(%0), 48(%0), (%1), OP)\
- \
- QPEL_V_LOW(%%mm3, %%mm0, %%mm1, %%mm2, %5, %6, %5, (%0), 8(%0), 16(%0), 56(%0), (%1, %3), OP)\
- "add %4, %1 \n\t"\
- QPEL_V_LOW(%%mm0, %%mm1, %%mm2, %%mm3, %5, %6, %5, 8(%0), 16(%0), 24(%0), 64(%0), (%1), OP)\
- \
- QPEL_V_LOW(%%mm1, %%mm2, %%mm3, %%mm0, %5, %6, %5, 16(%0), 24(%0), 32(%0), 64(%0), (%1, %3), OP)\
- "add %4, %1 \n\t"\
- QPEL_V_LOW(%%mm2, %%mm3, %%mm0, %%mm1, %5, %6, %5, 24(%0), 32(%0), 40(%0), 56(%0), (%1), OP)\
- QPEL_V_LOW(%%mm3, %%mm0, %%mm1, %%mm2, %5, %6, %5, 32(%0), 40(%0), 48(%0), 48(%0), (%1, %3), OP)\
- \
- "add $72, %0 \n\t"\
- "add %6, %1 \n\t"\
- "decl %2 \n\t"\
- " jnz 1b \n\t"\
- \
- : "+r"(temp_ptr), "+r"(dst), "+g"(count)\
- : "r"((x86_reg)dstStride), "r"(2*(x86_reg)dstStride), /*"m"(ff_pw_20), "m"(ff_pw_3),*/ "m"(ROUNDER), "g"(4-6*(x86_reg)dstStride)\
- : "memory"\
- );\
-}\
-\
-static void OPNAME ## qpel8_mc00_ ## MMX (uint8_t *dst, uint8_t *src, int stride){\
- OPNAME ## pixels8_ ## MMX(dst, src, stride, 8);\
-}\
-\
-static void OPNAME ## qpel8_mc10_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
- uint64_t temp[8];\
- uint8_t * const half= (uint8_t*)temp;\
- put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(half, src, 8, stride, 8);\
- OPNAME ## pixels8_l2_ ## MMX(dst, src, half, stride, stride, 8);\
-}\
-\
-static void OPNAME ## qpel8_mc20_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
- OPNAME ## mpeg4_qpel8_h_lowpass_ ## MMX(dst, src, stride, stride, 8);\
-}\
-\
-static void OPNAME ## qpel8_mc30_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
- uint64_t temp[8];\
- uint8_t * const half= (uint8_t*)temp;\
- put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(half, src, 8, stride, 8);\
- OPNAME ## pixels8_l2_ ## MMX(dst, src+1, half, stride, stride, 8);\
-}\
-\
-static void OPNAME ## qpel8_mc01_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
- uint64_t temp[8];\
- uint8_t * const half= (uint8_t*)temp;\
- put ## RND ## mpeg4_qpel8_v_lowpass_ ## MMX(half, src, 8, stride);\
- OPNAME ## pixels8_l2_ ## MMX(dst, src, half, stride, stride, 8);\
-}\
-\
-static void OPNAME ## qpel8_mc02_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
- OPNAME ## mpeg4_qpel8_v_lowpass_ ## MMX(dst, src, stride, stride);\
-}\
-\
-static void OPNAME ## qpel8_mc03_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
- uint64_t temp[8];\
- uint8_t * const half= (uint8_t*)temp;\
- put ## RND ## mpeg4_qpel8_v_lowpass_ ## MMX(half, src, 8, stride);\
- OPNAME ## pixels8_l2_ ## MMX(dst, src+stride, half, stride, stride, 8);\
-}\
-static void OPNAME ## qpel8_mc11_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
- uint64_t half[8 + 9];\
- uint8_t * const halfH= ((uint8_t*)half) + 64;\
- uint8_t * const halfHV= ((uint8_t*)half);\
- put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(halfH, src, 8, stride, 9);\
- put ## RND ## pixels8_l2_ ## MMX(halfH, src, halfH, 8, stride, 9);\
- put ## RND ## mpeg4_qpel8_v_lowpass_ ## MMX(halfHV, halfH, 8, 8);\
- OPNAME ## pixels8_l2_ ## MMX(dst, halfH, halfHV, stride, 8, 8);\
-}\
-static void OPNAME ## qpel8_mc31_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
- uint64_t half[8 + 9];\
- uint8_t * const halfH= ((uint8_t*)half) + 64;\
- uint8_t * const halfHV= ((uint8_t*)half);\
- put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(halfH, src, 8, stride, 9);\
- put ## RND ## pixels8_l2_ ## MMX(halfH, src+1, halfH, 8, stride, 9);\
- put ## RND ## mpeg4_qpel8_v_lowpass_ ## MMX(halfHV, halfH, 8, 8);\
- OPNAME ## pixels8_l2_ ## MMX(dst, halfH, halfHV, stride, 8, 8);\
-}\
-static void OPNAME ## qpel8_mc13_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
- uint64_t half[8 + 9];\
- uint8_t * const halfH= ((uint8_t*)half) + 64;\
- uint8_t * const halfHV= ((uint8_t*)half);\
- put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(halfH, src, 8, stride, 9);\
- put ## RND ## pixels8_l2_ ## MMX(halfH, src, halfH, 8, stride, 9);\
- put ## RND ## mpeg4_qpel8_v_lowpass_ ## MMX(halfHV, halfH, 8, 8);\
- OPNAME ## pixels8_l2_ ## MMX(dst, halfH+8, halfHV, stride, 8, 8);\
-}\
-static void OPNAME ## qpel8_mc33_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
- uint64_t half[8 + 9];\
- uint8_t * const halfH= ((uint8_t*)half) + 64;\
- uint8_t * const halfHV= ((uint8_t*)half);\
- put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(halfH, src, 8, stride, 9);\
- put ## RND ## pixels8_l2_ ## MMX(halfH, src+1, halfH, 8, stride, 9);\
- put ## RND ## mpeg4_qpel8_v_lowpass_ ## MMX(halfHV, halfH, 8, 8);\
- OPNAME ## pixels8_l2_ ## MMX(dst, halfH+8, halfHV, stride, 8, 8);\
-}\
-static void OPNAME ## qpel8_mc21_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
- uint64_t half[8 + 9];\
- uint8_t * const halfH= ((uint8_t*)half) + 64;\
- uint8_t * const halfHV= ((uint8_t*)half);\
- put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(halfH, src, 8, stride, 9);\
- put ## RND ## mpeg4_qpel8_v_lowpass_ ## MMX(halfHV, halfH, 8, 8);\
- OPNAME ## pixels8_l2_ ## MMX(dst, halfH, halfHV, stride, 8, 8);\
-}\
-static void OPNAME ## qpel8_mc23_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
- uint64_t half[8 + 9];\
- uint8_t * const halfH= ((uint8_t*)half) + 64;\
- uint8_t * const halfHV= ((uint8_t*)half);\
- put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(halfH, src, 8, stride, 9);\
- put ## RND ## mpeg4_qpel8_v_lowpass_ ## MMX(halfHV, halfH, 8, 8);\
- OPNAME ## pixels8_l2_ ## MMX(dst, halfH+8, halfHV, stride, 8, 8);\
-}\
-static void OPNAME ## qpel8_mc12_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
- uint64_t half[8 + 9];\
- uint8_t * const halfH= ((uint8_t*)half);\
- put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(halfH, src, 8, stride, 9);\
- put ## RND ## pixels8_l2_ ## MMX(halfH, src, halfH, 8, stride, 9);\
- OPNAME ## mpeg4_qpel8_v_lowpass_ ## MMX(dst, halfH, stride, 8);\
-}\
-static void OPNAME ## qpel8_mc32_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
- uint64_t half[8 + 9];\
- uint8_t * const halfH= ((uint8_t*)half);\
- put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(halfH, src, 8, stride, 9);\
- put ## RND ## pixels8_l2_ ## MMX(halfH, src+1, halfH, 8, stride, 9);\
- OPNAME ## mpeg4_qpel8_v_lowpass_ ## MMX(dst, halfH, stride, 8);\
-}\
-static void OPNAME ## qpel8_mc22_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
- uint64_t half[9];\
- uint8_t * const halfH= ((uint8_t*)half);\
- put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(halfH, src, 8, stride, 9);\
- OPNAME ## mpeg4_qpel8_v_lowpass_ ## MMX(dst, halfH, stride, 8);\
-}\
-static void OPNAME ## qpel16_mc00_ ## MMX (uint8_t *dst, uint8_t *src, int stride){\
- OPNAME ## pixels16_ ## MMX(dst, src, stride, 16);\
-}\
-\
-static void OPNAME ## qpel16_mc10_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
- uint64_t temp[32];\
- uint8_t * const half= (uint8_t*)temp;\
- put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(half, src, 16, stride, 16);\
- OPNAME ## pixels16_l2_ ## MMX(dst, src, half, stride, stride, 16);\
-}\
-\
-static void OPNAME ## qpel16_mc20_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
- OPNAME ## mpeg4_qpel16_h_lowpass_ ## MMX(dst, src, stride, stride, 16);\
-}\
-\
-static void OPNAME ## qpel16_mc30_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
- uint64_t temp[32];\
- uint8_t * const half= (uint8_t*)temp;\
- put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(half, src, 16, stride, 16);\
- OPNAME ## pixels16_l2_ ## MMX(dst, src+1, half, stride, stride, 16);\
-}\
-\
-static void OPNAME ## qpel16_mc01_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
- uint64_t temp[32];\
- uint8_t * const half= (uint8_t*)temp;\
- put ## RND ## mpeg4_qpel16_v_lowpass_ ## MMX(half, src, 16, stride);\
- OPNAME ## pixels16_l2_ ## MMX(dst, src, half, stride, stride, 16);\
-}\
-\
-static void OPNAME ## qpel16_mc02_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
- OPNAME ## mpeg4_qpel16_v_lowpass_ ## MMX(dst, src, stride, stride);\
-}\
-\
-static void OPNAME ## qpel16_mc03_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
- uint64_t temp[32];\
- uint8_t * const half= (uint8_t*)temp;\
- put ## RND ## mpeg4_qpel16_v_lowpass_ ## MMX(half, src, 16, stride);\
- OPNAME ## pixels16_l2_ ## MMX(dst, src+stride, half, stride, stride, 16);\
-}\
-static void OPNAME ## qpel16_mc11_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
- uint64_t half[16*2 + 17*2];\
- uint8_t * const halfH= ((uint8_t*)half) + 256;\
- uint8_t * const halfHV= ((uint8_t*)half);\
- put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(halfH, src, 16, stride, 17);\
- put ## RND ## pixels16_l2_ ## MMX(halfH, src, halfH, 16, stride, 17);\
- put ## RND ## mpeg4_qpel16_v_lowpass_ ## MMX(halfHV, halfH, 16, 16);\
- OPNAME ## pixels16_l2_ ## MMX(dst, halfH, halfHV, stride, 16, 16);\
-}\
-static void OPNAME ## qpel16_mc31_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
- uint64_t half[16*2 + 17*2];\
- uint8_t * const halfH= ((uint8_t*)half) + 256;\
- uint8_t * const halfHV= ((uint8_t*)half);\
- put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(halfH, src, 16, stride, 17);\
- put ## RND ## pixels16_l2_ ## MMX(halfH, src+1, halfH, 16, stride, 17);\
- put ## RND ## mpeg4_qpel16_v_lowpass_ ## MMX(halfHV, halfH, 16, 16);\
- OPNAME ## pixels16_l2_ ## MMX(dst, halfH, halfHV, stride, 16, 16);\
-}\
-static void OPNAME ## qpel16_mc13_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
- uint64_t half[16*2 + 17*2];\
- uint8_t * const halfH= ((uint8_t*)half) + 256;\
- uint8_t * const halfHV= ((uint8_t*)half);\
- put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(halfH, src, 16, stride, 17);\
- put ## RND ## pixels16_l2_ ## MMX(halfH, src, halfH, 16, stride, 17);\
- put ## RND ## mpeg4_qpel16_v_lowpass_ ## MMX(halfHV, halfH, 16, 16);\
- OPNAME ## pixels16_l2_ ## MMX(dst, halfH+16, halfHV, stride, 16, 16);\
-}\
-static void OPNAME ## qpel16_mc33_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
- uint64_t half[16*2 + 17*2];\
- uint8_t * const halfH= ((uint8_t*)half) + 256;\
- uint8_t * const halfHV= ((uint8_t*)half);\
- put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(halfH, src, 16, stride, 17);\
- put ## RND ## pixels16_l2_ ## MMX(halfH, src+1, halfH, 16, stride, 17);\
- put ## RND ## mpeg4_qpel16_v_lowpass_ ## MMX(halfHV, halfH, 16, 16);\
- OPNAME ## pixels16_l2_ ## MMX(dst, halfH+16, halfHV, stride, 16, 16);\
-}\
-static void OPNAME ## qpel16_mc21_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
- uint64_t half[16*2 + 17*2];\
- uint8_t * const halfH= ((uint8_t*)half) + 256;\
- uint8_t * const halfHV= ((uint8_t*)half);\
- put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(halfH, src, 16, stride, 17);\
- put ## RND ## mpeg4_qpel16_v_lowpass_ ## MMX(halfHV, halfH, 16, 16);\
- OPNAME ## pixels16_l2_ ## MMX(dst, halfH, halfHV, stride, 16, 16);\
-}\
-static void OPNAME ## qpel16_mc23_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
- uint64_t half[16*2 + 17*2];\
- uint8_t * const halfH= ((uint8_t*)half) + 256;\
- uint8_t * const halfHV= ((uint8_t*)half);\
- put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(halfH, src, 16, stride, 17);\
- put ## RND ## mpeg4_qpel16_v_lowpass_ ## MMX(halfHV, halfH, 16, 16);\
- OPNAME ## pixels16_l2_ ## MMX(dst, halfH+16, halfHV, stride, 16, 16);\
-}\
-static void OPNAME ## qpel16_mc12_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
- uint64_t half[17*2];\
- uint8_t * const halfH= ((uint8_t*)half);\
- put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(halfH, src, 16, stride, 17);\
- put ## RND ## pixels16_l2_ ## MMX(halfH, src, halfH, 16, stride, 17);\
- OPNAME ## mpeg4_qpel16_v_lowpass_ ## MMX(dst, halfH, stride, 16);\
-}\
-static void OPNAME ## qpel16_mc32_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
- uint64_t half[17*2];\
- uint8_t * const halfH= ((uint8_t*)half);\
- put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(halfH, src, 16, stride, 17);\
- put ## RND ## pixels16_l2_ ## MMX(halfH, src+1, halfH, 16, stride, 17);\
- OPNAME ## mpeg4_qpel16_v_lowpass_ ## MMX(dst, halfH, stride, 16);\
-}\
-static void OPNAME ## qpel16_mc22_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
- uint64_t half[17*2];\
- uint8_t * const halfH= ((uint8_t*)half);\
- put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(halfH, src, 16, stride, 17);\
- OPNAME ## mpeg4_qpel16_v_lowpass_ ## MMX(dst, halfH, stride, 16);\
-}
+#define PUT_OP(a, b, temp, size) \
+ "mov"#size" "#a", "#b" \n\t"
-#define PUT_OP(a,b,temp, size) "mov" #size " " #a ", " #b " \n\t"
-#define AVG_3DNOW_OP(a,b,temp, size) \
-"mov" #size " " #b ", " #temp " \n\t"\
-"pavgusb " #temp ", " #a " \n\t"\
-"mov" #size " " #a ", " #b " \n\t"
-#define AVG_MMX2_OP(a,b,temp, size) \
-"mov" #size " " #b ", " #temp " \n\t"\
-"pavgb " #temp ", " #a " \n\t"\
-"mov" #size " " #a ", " #b " \n\t"
-
-QPEL_BASE(put_ , ff_pw_16, _ , PUT_OP, PUT_OP)
-QPEL_BASE(avg_ , ff_pw_16, _ , AVG_MMX2_OP, AVG_3DNOW_OP)
-QPEL_BASE(put_no_rnd_, ff_pw_15, _no_rnd_, PUT_OP, PUT_OP)
-QPEL_OP(put_ , ff_pw_16, _ , PUT_OP, 3dnow)
-QPEL_OP(avg_ , ff_pw_16, _ , AVG_3DNOW_OP, 3dnow)
-QPEL_OP(put_no_rnd_, ff_pw_15, _no_rnd_, PUT_OP, 3dnow)
-QPEL_OP(put_ , ff_pw_16, _ , PUT_OP, mmx2)
-QPEL_OP(avg_ , ff_pw_16, _ , AVG_MMX2_OP, mmx2)
-QPEL_OP(put_no_rnd_, ff_pw_15, _no_rnd_, PUT_OP, mmx2)
+#define AVG_MMXEXT_OP(a, b, temp, size) \
+ "mov"#size" "#b", "#temp" \n\t" \
+ "pavgb "#temp", "#a" \n\t" \
+ "mov"#size" "#a", "#b" \n\t"
+
+QPEL_BASE(put_, ff_pw_16, _, PUT_OP)
+QPEL_BASE(avg_, ff_pw_16, _, AVG_MMXEXT_OP)
+QPEL_BASE(put_no_rnd_, ff_pw_15, _no_rnd_, PUT_OP)
+QPEL_OP(put_, ff_pw_16, _, PUT_OP, mmxext)
+QPEL_OP(avg_, ff_pw_16, _, AVG_MMXEXT_OP, mmxext)
+QPEL_OP(put_no_rnd_, ff_pw_15, _no_rnd_, PUT_OP, mmxext)
/***********************************/
/* bilinear qpel: not compliant to any spec, only for -lavdopts fast */
-#define QPEL_2TAP_XY(OPNAME, SIZE, MMX, XY, HPEL)\
-static void OPNAME ## 2tap_qpel ## SIZE ## _mc ## XY ## _ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
- OPNAME ## pixels ## SIZE ## HPEL(dst, src, stride, SIZE);\
-}
-#define QPEL_2TAP_L3(OPNAME, SIZE, MMX, XY, S0, S1, S2)\
-static void OPNAME ## 2tap_qpel ## SIZE ## _mc ## XY ## _ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
- OPNAME ## 2tap_qpel ## SIZE ## _l3_ ## MMX(dst, src+S0, stride, SIZE, S1, S2);\
+#define QPEL_2TAP_XY(OPNAME, SIZE, MMX, XY, HPEL) \
+static void OPNAME ## 2tap_qpel ## SIZE ## _mc ## XY ## _ ## MMX(uint8_t *dst, \
+ uint8_t *src, \
+ int stride) \
+{ \
+ OPNAME ## pixels ## SIZE ## HPEL(dst, src, stride, SIZE); \
}
-#define QPEL_2TAP(OPNAME, SIZE, MMX)\
-QPEL_2TAP_XY(OPNAME, SIZE, MMX, 20, _x2_ ## MMX)\
-QPEL_2TAP_XY(OPNAME, SIZE, MMX, 02, _y2_ ## MMX)\
-QPEL_2TAP_XY(OPNAME, SIZE, MMX, 22, _xy2_mmx)\
-static const qpel_mc_func OPNAME ## 2tap_qpel ## SIZE ## _mc00_ ## MMX =\
- OPNAME ## qpel ## SIZE ## _mc00_ ## MMX;\
-static const qpel_mc_func OPNAME ## 2tap_qpel ## SIZE ## _mc21_ ## MMX =\
- OPNAME ## 2tap_qpel ## SIZE ## _mc20_ ## MMX;\
-static const qpel_mc_func OPNAME ## 2tap_qpel ## SIZE ## _mc12_ ## MMX =\
- OPNAME ## 2tap_qpel ## SIZE ## _mc02_ ## MMX;\
-static void OPNAME ## 2tap_qpel ## SIZE ## _mc32_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
- OPNAME ## pixels ## SIZE ## _y2_ ## MMX(dst, src+1, stride, SIZE);\
-}\
-static void OPNAME ## 2tap_qpel ## SIZE ## _mc23_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
- OPNAME ## pixels ## SIZE ## _x2_ ## MMX(dst, src+stride, stride, SIZE);\
-}\
-QPEL_2TAP_L3(OPNAME, SIZE, MMX, 10, 0, 1, 0)\
-QPEL_2TAP_L3(OPNAME, SIZE, MMX, 30, 1, -1, 0)\
-QPEL_2TAP_L3(OPNAME, SIZE, MMX, 01, 0, stride, 0)\
-QPEL_2TAP_L3(OPNAME, SIZE, MMX, 03, stride, -stride, 0)\
-QPEL_2TAP_L3(OPNAME, SIZE, MMX, 11, 0, stride, 1)\
-QPEL_2TAP_L3(OPNAME, SIZE, MMX, 31, 1, stride, -1)\
-QPEL_2TAP_L3(OPNAME, SIZE, MMX, 13, stride, -stride, 1)\
-QPEL_2TAP_L3(OPNAME, SIZE, MMX, 33, stride+1, -stride, -1)\
-
-QPEL_2TAP(put_, 16, mmx2)
-QPEL_2TAP(avg_, 16, mmx2)
-QPEL_2TAP(put_, 8, mmx2)
-QPEL_2TAP(avg_, 8, mmx2)
-QPEL_2TAP(put_, 16, 3dnow)
-QPEL_2TAP(avg_, 16, 3dnow)
-QPEL_2TAP(put_, 8, 3dnow)
-QPEL_2TAP(avg_, 8, 3dnow)
-
+#define QPEL_2TAP_L3(OPNAME, SIZE, MMX, XY, S0, S1, S2) \
+static void OPNAME ## 2tap_qpel ## SIZE ## _mc ## XY ## _ ## MMX(uint8_t *dst, \
+ uint8_t *src, \
+ int stride) \
+{ \
+ OPNAME ## 2tap_qpel ## SIZE ## _l3_ ## MMX(dst, src + S0, stride, SIZE, \
+ S1, S2); \
+}
-#if HAVE_YASM
-typedef void emu_edge_core_func (uint8_t *buf, const uint8_t *src,
- x86_reg linesize, x86_reg start_y,
- x86_reg end_y, x86_reg block_h,
- x86_reg start_x, x86_reg end_x,
- x86_reg block_w);
-extern emu_edge_core_func ff_emu_edge_core_mmx;
-extern emu_edge_core_func ff_emu_edge_core_sse;
-
-static av_always_inline
-void emulated_edge_mc(uint8_t *buf, const uint8_t *src, int linesize,
- int block_w, int block_h,
- int src_x, int src_y, int w, int h,
- emu_edge_core_func *core_fn)
+#define QPEL_2TAP(OPNAME, SIZE, MMX) \
+QPEL_2TAP_XY(OPNAME, SIZE, MMX, 20, _x2_ ## MMX) \
+QPEL_2TAP_XY(OPNAME, SIZE, MMX, 02, _y2_ ## MMX) \
+QPEL_2TAP_XY(OPNAME, SIZE, MMX, 22, _xy2_mmx) \
+static const qpel_mc_func OPNAME ## 2tap_qpel ## SIZE ## _mc00_ ## MMX = \
+ OPNAME ## qpel ## SIZE ## _mc00_ ## MMX; \
+static const qpel_mc_func OPNAME ## 2tap_qpel ## SIZE ## _mc21_ ## MMX = \
+ OPNAME ## 2tap_qpel ## SIZE ## _mc20_ ## MMX; \
+static const qpel_mc_func OPNAME ## 2tap_qpel ## SIZE ## _mc12_ ## MMX = \
+ OPNAME ## 2tap_qpel ## SIZE ## _mc02_ ## MMX; \
+static void OPNAME ## 2tap_qpel ## SIZE ## _mc32_ ## MMX(uint8_t *dst, \
+ uint8_t *src, \
+ int stride) \
+{ \
+ OPNAME ## pixels ## SIZE ## _y2_ ## MMX(dst, src + 1, stride, SIZE); \
+} \
+static void OPNAME ## 2tap_qpel ## SIZE ## _mc23_ ## MMX(uint8_t *dst, \
+ uint8_t *src, \
+ int stride) \
+{ \
+ OPNAME ## pixels ## SIZE ## _x2_ ## MMX(dst, src + stride, \
+ stride, SIZE); \
+} \
+QPEL_2TAP_L3(OPNAME, SIZE, MMX, 10, 0, 1, 0) \
+QPEL_2TAP_L3(OPNAME, SIZE, MMX, 30, 1, -1, 0) \
+QPEL_2TAP_L3(OPNAME, SIZE, MMX, 01, 0, stride, 0) \
+QPEL_2TAP_L3(OPNAME, SIZE, MMX, 03, stride, -stride, 0) \
+QPEL_2TAP_L3(OPNAME, SIZE, MMX, 11, 0, stride, 1) \
+QPEL_2TAP_L3(OPNAME, SIZE, MMX, 31, 1, stride, -1) \
+QPEL_2TAP_L3(OPNAME, SIZE, MMX, 13, stride, -stride, 1) \
+QPEL_2TAP_L3(OPNAME, SIZE, MMX, 33, stride + 1, -stride, -1) \
+
+QPEL_2TAP(put_, 16, mmxext)
+QPEL_2TAP(avg_, 16, mmxext)
+QPEL_2TAP(put_, 8, mmxext)
+QPEL_2TAP(avg_, 8, mmxext)
+
+void ff_put_rv40_qpel8_mc33_mmx(uint8_t *dst, uint8_t *src, int stride)
{
- int start_y, start_x, end_y, end_x, src_y_add=0;
-
- if(src_y>= h){
- src_y_add = h-1-src_y;
- src_y=h-1;
- }else if(src_y<=-block_h){
- src_y_add = 1-block_h-src_y;
- src_y=1-block_h;
- }
- if(src_x>= w){
- src+= (w-1-src_x);
- src_x=w-1;
- }else if(src_x<=-block_w){
- src+= (1-block_w-src_x);
- src_x=1-block_w;
- }
-
- start_y= FFMAX(0, -src_y);
- start_x= FFMAX(0, -src_x);
- end_y= FFMIN(block_h, h-src_y);
- end_x= FFMIN(block_w, w-src_x);
- assert(start_x < end_x && block_w > 0);
- assert(start_y < end_y && block_h > 0);
-
- // fill in the to-be-copied part plus all above/below
- src += (src_y_add+start_y)*linesize + start_x;
- buf += start_x;
- core_fn(buf, src, linesize, start_y, end_y, block_h, start_x, end_x, block_w);
+ put_pixels8_xy2_mmx(dst, src, stride, 8);
}
-
-#if ARCH_X86_32
-static av_noinline
-void emulated_edge_mc_mmx(uint8_t *buf, const uint8_t *src, int linesize,
- int block_w, int block_h,
- int src_x, int src_y, int w, int h)
+void ff_put_rv40_qpel16_mc33_mmx(uint8_t *dst, uint8_t *src, int stride)
{
- emulated_edge_mc(buf, src, linesize, block_w, block_h, src_x, src_y,
- w, h, &ff_emu_edge_core_mmx);
+ put_pixels16_xy2_mmx(dst, src, stride, 16);
}
-#endif
-static av_noinline
-void emulated_edge_mc_sse(uint8_t *buf, const uint8_t *src, int linesize,
- int block_w, int block_h,
- int src_x, int src_y, int w, int h)
+void ff_avg_rv40_qpel8_mc33_mmx(uint8_t *dst, uint8_t *src, int stride)
{
- emulated_edge_mc(buf, src, linesize, block_w, block_h, src_x, src_y,
- w, h, &ff_emu_edge_core_sse);
+ avg_pixels8_xy2_mmx(dst, src, stride, 8);
+}
+void ff_avg_rv40_qpel16_mc33_mmx(uint8_t *dst, uint8_t *src, int stride)
+{
+ avg_pixels16_xy2_mmx(dst, src, stride, 16);
}
-#endif /* HAVE_YASM */
-
-typedef void emulated_edge_mc_func (uint8_t *dst, const uint8_t *src,
- int linesize, int block_w, int block_h,
- int src_x, int src_y, int w, int h);
-static av_always_inline
-void gmc(uint8_t *dst, uint8_t *src, int stride, int h, int ox, int oy,
- int dxx, int dxy, int dyx, int dyy, int shift, int r, int width, int height,
- emulated_edge_mc_func *emu_edge_fn)
+static void gmc_mmx(uint8_t *dst, uint8_t *src,
+ int stride, int h, int ox, int oy,
+ int dxx, int dxy, int dyx, int dyy,
+ int shift, int r, int width, int height)
{
- const int w = 8;
- const int ix = ox>>(16+shift);
- const int iy = oy>>(16+shift);
- const int oxs = ox>>4;
- const int oys = oy>>4;
- const int dxxs = dxx>>4;
- const int dxys = dxy>>4;
- const int dyxs = dyx>>4;
- const int dyys = dyy>>4;
- const uint16_t r4[4] = {r,r,r,r};
- const uint16_t dxy4[4] = {dxys,dxys,dxys,dxys};
- const uint16_t dyy4[4] = {dyys,dyys,dyys,dyys};
- const uint64_t shift2 = 2*shift;
- uint8_t edge_buf[(h+1)*stride];
+ const int w = 8;
+ const int ix = ox >> (16 + shift);
+ const int iy = oy >> (16 + shift);
+ const int oxs = ox >> 4;
+ const int oys = oy >> 4;
+ const int dxxs = dxx >> 4;
+ const int dxys = dxy >> 4;
+ const int dyxs = dyx >> 4;
+ const int dyys = dyy >> 4;
+ const uint16_t r4[4] = { r, r, r, r };
+ const uint16_t dxy4[4] = { dxys, dxys, dxys, dxys };
+ const uint16_t dyy4[4] = { dyys, dyys, dyys, dyys };
+ const uint64_t shift2 = 2 * shift;
int x, y;
- const int dxw = (dxx-(1<<(16+shift)))*(w-1);
- const int dyh = (dyy-(1<<(16+shift)))*(h-1);
- const int dxh = dxy*(h-1);
- const int dyw = dyx*(w-1);
- if( // non-constant fullpel offset (3% of blocks)
- ((ox^(ox+dxw)) | (ox^(ox+dxh)) | (ox^(ox+dxw+dxh)) |
- (oy^(oy+dyw)) | (oy^(oy+dyh)) | (oy^(oy+dyw+dyh))) >> (16+shift)
+ const int dxw = (dxx - (1 << (16 + shift))) * (w - 1);
+ const int dyh = (dyy - (1 << (16 + shift))) * (h - 1);
+ const int dxh = dxy * (h - 1);
+ const int dyw = dyx * (w - 1);
+ if ( // non-constant fullpel offset (3% of blocks)
+ ((ox ^ (ox + dxw)) | (ox ^ (ox + dxh)) | (ox ^ (ox + dxw + dxh)) |
+ (oy ^ (oy + dyw)) | (oy ^ (oy + dyh)) | (oy ^ (oy + dyw + dyh))) >> (16 + shift)
// uses more than 16 bits of subpel mv (only at huge resolution)
- || (dxx|dxy|dyx|dyy)&15 )
- {
- //FIXME could still use mmx for some of the rows
- ff_gmc_c(dst, src, stride, h, ox, oy, dxx, dxy, dyx, dyy, shift, r, width, height);
+ || (dxx | dxy | dyx | dyy) & 15 ||
+ (unsigned)ix >= width - w ||
+ (unsigned)iy >= height - h) {
+ // FIXME could still use mmx for some of the rows
+ ff_gmc_c(dst, src, stride, h, ox, oy, dxx, dxy, dyx, dyy,
+ shift, r, width, height);
return;
}
- src += ix + iy*stride;
- if( (unsigned)ix >= width-w ||
- (unsigned)iy >= height-h )
- {
- emu_edge_fn(edge_buf, src, stride, w+1, h+1, ix, iy, width, height);
- src = edge_buf;
- }
+ src += ix + iy * stride;
- __asm__ volatile(
- "movd %0, %%mm6 \n\t"
- "pxor %%mm7, %%mm7 \n\t"
- "punpcklwd %%mm6, %%mm6 \n\t"
- "punpcklwd %%mm6, %%mm6 \n\t"
+ __asm__ volatile (
+ "movd %0, %%mm6 \n\t"
+ "pxor %%mm7, %%mm7 \n\t"
+ "punpcklwd %%mm6, %%mm6 \n\t"
+ "punpcklwd %%mm6, %%mm6 \n\t"
:: "r"(1<<shift)
);
- for(x=0; x<w; x+=4){
- uint16_t dx4[4] = { oxs - dxys + dxxs*(x+0),
- oxs - dxys + dxxs*(x+1),
- oxs - dxys + dxxs*(x+2),
- oxs - dxys + dxxs*(x+3) };
- uint16_t dy4[4] = { oys - dyys + dyxs*(x+0),
- oys - dyys + dyxs*(x+1),
- oys - dyys + dyxs*(x+2),
- oys - dyys + dyxs*(x+3) };
-
- for(y=0; y<h; y++){
- __asm__ volatile(
- "movq %0, %%mm4 \n\t"
- "movq %1, %%mm5 \n\t"
- "paddw %2, %%mm4 \n\t"
- "paddw %3, %%mm5 \n\t"
- "movq %%mm4, %0 \n\t"
- "movq %%mm5, %1 \n\t"
- "psrlw $12, %%mm4 \n\t"
- "psrlw $12, %%mm5 \n\t"
+ for (x = 0; x < w; x += 4) {
+ uint16_t dx4[4] = { oxs - dxys + dxxs * (x + 0),
+ oxs - dxys + dxxs * (x + 1),
+ oxs - dxys + dxxs * (x + 2),
+ oxs - dxys + dxxs * (x + 3) };
+ uint16_t dy4[4] = { oys - dyys + dyxs * (x + 0),
+ oys - dyys + dyxs * (x + 1),
+ oys - dyys + dyxs * (x + 2),
+ oys - dyys + dyxs * (x + 3) };
+
+ for (y = 0; y < h; y++) {
+ __asm__ volatile (
+ "movq %0, %%mm4 \n\t"
+ "movq %1, %%mm5 \n\t"
+ "paddw %2, %%mm4 \n\t"
+ "paddw %3, %%mm5 \n\t"
+ "movq %%mm4, %0 \n\t"
+ "movq %%mm5, %1 \n\t"
+ "psrlw $12, %%mm4 \n\t"
+ "psrlw $12, %%mm5 \n\t"
: "+m"(*dx4), "+m"(*dy4)
: "m"(*dxy4), "m"(*dyy4)
);
- __asm__ volatile(
- "movq %%mm6, %%mm2 \n\t"
- "movq %%mm6, %%mm1 \n\t"
- "psubw %%mm4, %%mm2 \n\t"
- "psubw %%mm5, %%mm1 \n\t"
- "movq %%mm2, %%mm0 \n\t"
- "movq %%mm4, %%mm3 \n\t"
- "pmullw %%mm1, %%mm0 \n\t" // (s-dx)*(s-dy)
- "pmullw %%mm5, %%mm3 \n\t" // dx*dy
- "pmullw %%mm5, %%mm2 \n\t" // (s-dx)*dy
- "pmullw %%mm4, %%mm1 \n\t" // dx*(s-dy)
-
- "movd %4, %%mm5 \n\t"
- "movd %3, %%mm4 \n\t"
+ __asm__ volatile (
+ "movq %%mm6, %%mm2 \n\t"
+ "movq %%mm6, %%mm1 \n\t"
+ "psubw %%mm4, %%mm2 \n\t"
+ "psubw %%mm5, %%mm1 \n\t"
+ "movq %%mm2, %%mm0 \n\t"
+ "movq %%mm4, %%mm3 \n\t"
+ "pmullw %%mm1, %%mm0 \n\t" // (s - dx) * (s - dy)
+ "pmullw %%mm5, %%mm3 \n\t" // dx * dy
+ "pmullw %%mm5, %%mm2 \n\t" // (s - dx) * dy
+ "pmullw %%mm4, %%mm1 \n\t" // dx * (s - dy)
+
+ "movd %4, %%mm5 \n\t"
+ "movd %3, %%mm4 \n\t"
"punpcklbw %%mm7, %%mm5 \n\t"
"punpcklbw %%mm7, %%mm4 \n\t"
- "pmullw %%mm5, %%mm3 \n\t" // src[1,1] * dx*dy
- "pmullw %%mm4, %%mm2 \n\t" // src[0,1] * (s-dx)*dy
+ "pmullw %%mm5, %%mm3 \n\t" // src[1, 1] * dx * dy
+ "pmullw %%mm4, %%mm2 \n\t" // src[0, 1] * (s - dx) * dy
- "movd %2, %%mm5 \n\t"
- "movd %1, %%mm4 \n\t"
+ "movd %2, %%mm5 \n\t"
+ "movd %1, %%mm4 \n\t"
"punpcklbw %%mm7, %%mm5 \n\t"
"punpcklbw %%mm7, %%mm4 \n\t"
- "pmullw %%mm5, %%mm1 \n\t" // src[1,0] * dx*(s-dy)
- "pmullw %%mm4, %%mm0 \n\t" // src[0,0] * (s-dx)*(s-dy)
- "paddw %5, %%mm1 \n\t"
- "paddw %%mm3, %%mm2 \n\t"
- "paddw %%mm1, %%mm0 \n\t"
- "paddw %%mm2, %%mm0 \n\t"
-
- "psrlw %6, %%mm0 \n\t"
- "packuswb %%mm0, %%mm0 \n\t"
- "movd %%mm0, %0 \n\t"
-
- : "=m"(dst[x+y*stride])
+ "pmullw %%mm5, %%mm1 \n\t" // src[1, 0] * dx * (s - dy)
+ "pmullw %%mm4, %%mm0 \n\t" // src[0, 0] * (s - dx) * (s - dy)
+ "paddw %5, %%mm1 \n\t"
+ "paddw %%mm3, %%mm2 \n\t"
+ "paddw %%mm1, %%mm0 \n\t"
+ "paddw %%mm2, %%mm0 \n\t"
+
+ "psrlw %6, %%mm0 \n\t"
+ "packuswb %%mm0, %%mm0 \n\t"
+ "movd %%mm0, %0 \n\t"
+
+ : "=m"(dst[x + y * stride])
: "m"(src[0]), "m"(src[1]),
- "m"(src[stride]), "m"(src[stride+1]),
+ "m"(src[stride]), "m"(src[stride + 1]),
"m"(*r4), "m"(shift2)
);
src += stride;
}
- src += 4-h*stride;
+ src += 4 - h * stride;
}
}
+#endif /* HAVE_INLINE_ASM */
-#if HAVE_YASM
-#if ARCH_X86_32
-static void gmc_mmx(uint8_t *dst, uint8_t *src, int stride, int h, int ox, int oy,
- int dxx, int dxy, int dyx, int dyy, int shift, int r, int width, int height)
-{
- gmc(dst, src, stride, h, ox, oy, dxx, dxy, dyx, dyy, shift, r,
- width, height, &emulated_edge_mc_mmx);
-}
-#endif
-static void gmc_sse(uint8_t *dst, uint8_t *src, int stride, int h, int ox, int oy,
- int dxx, int dxy, int dyx, int dyy, int shift, int r, int width, int height)
-{
- gmc(dst, src, stride, h, ox, oy, dxx, dxy, dyx, dyy, shift, r,
- width, height, &emulated_edge_mc_sse);
-}
-#else
-static void gmc_mmx(uint8_t *dst, uint8_t *src, int stride, int h, int ox, int oy,
- int dxx, int dxy, int dyx, int dyy, int shift, int r, int width, int height)
-{
- gmc(dst, src, stride, h, ox, oy, dxx, dxy, dyx, dyy, shift, r,
- width, height, &ff_emulated_edge_mc_8);
-}
-#endif
-
-#define PREFETCH(name, op) \
-static void name(void *mem, int stride, int h){\
- const uint8_t *p= mem;\
- do{\
- __asm__ volatile(#op" %0" :: "m"(*p));\
- p+= stride;\
- }while(--h);\
-}
-PREFETCH(prefetch_mmx2, prefetcht0)
-PREFETCH(prefetch_3dnow, prefetch)
-#undef PREFETCH
-
-#include "h264_qpel_mmx.c"
-
-void ff_put_h264_chroma_mc8_mmx_rnd (uint8_t *dst, uint8_t *src,
- int stride, int h, int x, int y);
-void ff_avg_h264_chroma_mc8_mmx2_rnd (uint8_t *dst, uint8_t *src,
- int stride, int h, int x, int y);
-void ff_avg_h264_chroma_mc8_3dnow_rnd (uint8_t *dst, uint8_t *src,
- int stride, int h, int x, int y);
-
-void ff_put_h264_chroma_mc4_mmx (uint8_t *dst, uint8_t *src,
- int stride, int h, int x, int y);
-void ff_avg_h264_chroma_mc4_mmx2 (uint8_t *dst, uint8_t *src,
- int stride, int h, int x, int y);
-void ff_avg_h264_chroma_mc4_3dnow (uint8_t *dst, uint8_t *src,
- int stride, int h, int x, int y);
-
-void ff_put_h264_chroma_mc2_mmx2 (uint8_t *dst, uint8_t *src,
- int stride, int h, int x, int y);
-void ff_avg_h264_chroma_mc2_mmx2 (uint8_t *dst, uint8_t *src,
- int stride, int h, int x, int y);
+#include "h264_qpel.c"
-void ff_put_h264_chroma_mc8_ssse3_rnd (uint8_t *dst, uint8_t *src,
+void ff_put_h264_chroma_mc8_rnd_mmx (uint8_t *dst, uint8_t *src,
+ int stride, int h, int x, int y);
+void ff_avg_h264_chroma_mc8_rnd_mmxext(uint8_t *dst, uint8_t *src,
int stride, int h, int x, int y);
-void ff_put_h264_chroma_mc4_ssse3 (uint8_t *dst, uint8_t *src,
- int stride, int h, int x, int y);
-
-void ff_avg_h264_chroma_mc8_ssse3_rnd (uint8_t *dst, uint8_t *src,
- int stride, int h, int x, int y);
-void ff_avg_h264_chroma_mc4_ssse3 (uint8_t *dst, uint8_t *src,
- int stride, int h, int x, int y);
-
-#define CHROMA_MC(OP, NUM, DEPTH, OPT) \
-void ff_ ## OP ## _h264_chroma_mc ## NUM ## _ ## DEPTH ## _ ## OPT \
- (uint8_t *dst, uint8_t *src,\
+void ff_avg_h264_chroma_mc8_rnd_3dnow(uint8_t *dst, uint8_t *src,
+ int stride, int h, int x, int y);
+
+void ff_put_h264_chroma_mc4_mmx (uint8_t *dst, uint8_t *src,
+ int stride, int h, int x, int y);
+void ff_avg_h264_chroma_mc4_mmxext (uint8_t *dst, uint8_t *src,
+ int stride, int h, int x, int y);
+void ff_avg_h264_chroma_mc4_3dnow (uint8_t *dst, uint8_t *src,
+ int stride, int h, int x, int y);
+
+void ff_put_h264_chroma_mc2_mmxext (uint8_t *dst, uint8_t *src,
+ int stride, int h, int x, int y);
+void ff_avg_h264_chroma_mc2_mmxext (uint8_t *dst, uint8_t *src,
+ int stride, int h, int x, int y);
+
+void ff_put_h264_chroma_mc8_rnd_ssse3(uint8_t *dst, uint8_t *src,
+ int stride, int h, int x, int y);
+void ff_put_h264_chroma_mc4_ssse3 (uint8_t *dst, uint8_t *src,
+ int stride, int h, int x, int y);
+
+void ff_avg_h264_chroma_mc8_rnd_ssse3(uint8_t *dst, uint8_t *src,
+ int stride, int h, int x, int y);
+void ff_avg_h264_chroma_mc4_ssse3 (uint8_t *dst, uint8_t *src,
+ int stride, int h, int x, int y);
+
+#define CHROMA_MC(OP, NUM, DEPTH, OPT) \
+void ff_ ## OP ## _h264_chroma_mc ## NUM ## _ ## DEPTH ## _ ## OPT \
+ (uint8_t *dst, uint8_t *src, \
int stride, int h, int x, int y);
CHROMA_MC(put, 2, 10, mmxext)
@@ -1938,112 +1797,82 @@ CHROMA_MC(avg, 8, 10, sse2)
CHROMA_MC(put, 8, 10, avx)
CHROMA_MC(avg, 8, 10, avx)
-/* CAVS specific */
-void ff_put_cavs_qpel8_mc00_mmx2(uint8_t *dst, uint8_t *src, int stride) {
- put_pixels8_mmx(dst, src, stride, 8);
-}
-void ff_avg_cavs_qpel8_mc00_mmx2(uint8_t *dst, uint8_t *src, int stride) {
- avg_pixels8_mmx(dst, src, stride, 8);
-}
-void ff_put_cavs_qpel16_mc00_mmx2(uint8_t *dst, uint8_t *src, int stride) {
- put_pixels16_mmx(dst, src, stride, 16);
-}
-void ff_avg_cavs_qpel16_mc00_mmx2(uint8_t *dst, uint8_t *src, int stride) {
- avg_pixels16_mmx(dst, src, stride, 16);
-}
+#if HAVE_INLINE_ASM
-/* VC1 specific */
-void ff_put_vc1_mspel_mc00_mmx(uint8_t *dst, const uint8_t *src, int stride, int rnd) {
+/* CAVS-specific */
+void ff_put_cavs_qpel8_mc00_mmxext(uint8_t *dst, uint8_t *src, int stride)
+{
put_pixels8_mmx(dst, src, stride, 8);
}
-void ff_avg_vc1_mspel_mc00_mmx2(uint8_t *dst, const uint8_t *src, int stride, int rnd) {
- avg_pixels8_mmx2(dst, src, stride, 8);
-}
-/* XXX: those functions should be suppressed ASAP when all IDCTs are
- converted */
-#if CONFIG_GPL
-static void ff_libmpeg2mmx_idct_put(uint8_t *dest, int line_size, DCTELEM *block)
-{
- ff_mmx_idct (block);
- ff_put_pixels_clamped_mmx(block, dest, line_size);
-}
-static void ff_libmpeg2mmx_idct_add(uint8_t *dest, int line_size, DCTELEM *block)
-{
- ff_mmx_idct (block);
- ff_add_pixels_clamped_mmx(block, dest, line_size);
-}
-static void ff_libmpeg2mmx2_idct_put(uint8_t *dest, int line_size, DCTELEM *block)
-{
- ff_mmxext_idct (block);
- ff_put_pixels_clamped_mmx(block, dest, line_size);
-}
-static void ff_libmpeg2mmx2_idct_add(uint8_t *dest, int line_size, DCTELEM *block)
+void ff_avg_cavs_qpel8_mc00_mmxext(uint8_t *dst, uint8_t *src, int stride)
{
- ff_mmxext_idct (block);
- ff_add_pixels_clamped_mmx(block, dest, line_size);
+ avg_pixels8_mmx(dst, src, stride, 8);
}
-#endif
-static void ff_idct_xvid_mmx_put(uint8_t *dest, int line_size, DCTELEM *block)
+
+void ff_put_cavs_qpel16_mc00_mmxext(uint8_t *dst, uint8_t *src, int stride)
{
- ff_idct_xvid_mmx (block);
- ff_put_pixels_clamped_mmx(block, dest, line_size);
+ put_pixels16_mmx(dst, src, stride, 16);
}
-static void ff_idct_xvid_mmx_add(uint8_t *dest, int line_size, DCTELEM *block)
+
+void ff_avg_cavs_qpel16_mc00_mmxext(uint8_t *dst, uint8_t *src, int stride)
{
- ff_idct_xvid_mmx (block);
- ff_add_pixels_clamped_mmx(block, dest, line_size);
+ avg_pixels16_mmx(dst, src, stride, 16);
}
-static void ff_idct_xvid_mmx2_put(uint8_t *dest, int line_size, DCTELEM *block)
+
+/* VC-1-specific */
+void ff_put_vc1_mspel_mc00_mmx(uint8_t *dst, const uint8_t *src,
+ int stride, int rnd)
{
- ff_idct_xvid_mmx2 (block);
- ff_put_pixels_clamped_mmx(block, dest, line_size);
+ put_pixels8_mmx(dst, src, stride, 8);
}
-static void ff_idct_xvid_mmx2_add(uint8_t *dest, int line_size, DCTELEM *block)
+
+void ff_avg_vc1_mspel_mc00_mmxext(uint8_t *dst, const uint8_t *src,
+ int stride, int rnd)
{
- ff_idct_xvid_mmx2 (block);
- ff_add_pixels_clamped_mmx(block, dest, line_size);
+ avg_pixels8_mmxext(dst, src, stride, 8);
}
static void vorbis_inverse_coupling_3dnow(float *mag, float *ang, int blocksize)
{
int i;
- __asm__ volatile("pxor %%mm7, %%mm7":);
- for(i=0; i<blocksize; i+=2) {
- __asm__ volatile(
- "movq %0, %%mm0 \n\t"
- "movq %1, %%mm1 \n\t"
- "movq %%mm0, %%mm2 \n\t"
- "movq %%mm1, %%mm3 \n\t"
- "pfcmpge %%mm7, %%mm2 \n\t" // m <= 0.0
- "pfcmpge %%mm7, %%mm3 \n\t" // a <= 0.0
- "pslld $31, %%mm2 \n\t" // keep only the sign bit
- "pxor %%mm2, %%mm1 \n\t"
- "movq %%mm3, %%mm4 \n\t"
- "pand %%mm1, %%mm3 \n\t"
- "pandn %%mm1, %%mm4 \n\t"
- "pfadd %%mm0, %%mm3 \n\t" // a = m + ((a<0) & (a ^ sign(m)))
- "pfsub %%mm4, %%mm0 \n\t" // m = m + ((a>0) & (a ^ sign(m)))
- "movq %%mm3, %1 \n\t"
- "movq %%mm0, %0 \n\t"
- :"+m"(mag[i]), "+m"(ang[i])
- ::"memory"
+ __asm__ volatile ("pxor %%mm7, %%mm7":);
+ for (i = 0; i < blocksize; i += 2) {
+ __asm__ volatile (
+ "movq %0, %%mm0 \n\t"
+ "movq %1, %%mm1 \n\t"
+ "movq %%mm0, %%mm2 \n\t"
+ "movq %%mm1, %%mm3 \n\t"
+ "pfcmpge %%mm7, %%mm2 \n\t" // m <= 0.0
+ "pfcmpge %%mm7, %%mm3 \n\t" // a <= 0.0
+ "pslld $31, %%mm2 \n\t" // keep only the sign bit
+ "pxor %%mm2, %%mm1 \n\t"
+ "movq %%mm3, %%mm4 \n\t"
+ "pand %%mm1, %%mm3 \n\t"
+ "pandn %%mm1, %%mm4 \n\t"
+ "pfadd %%mm0, %%mm3 \n\t" // a = m + ((a < 0) & (a ^ sign(m)))
+ "pfsub %%mm4, %%mm0 \n\t" // m = m + ((a > 0) & (a ^ sign(m)))
+ "movq %%mm3, %1 \n\t"
+ "movq %%mm0, %0 \n\t"
+ : "+m"(mag[i]), "+m"(ang[i])
+ :: "memory"
);
}
- __asm__ volatile("femms");
+ __asm__ volatile ("femms");
}
+
static void vorbis_inverse_coupling_sse(float *mag, float *ang, int blocksize)
{
int i;
- __asm__ volatile(
- "movaps %0, %%xmm5 \n\t"
- ::"m"(ff_pdw_80000000[0])
+ __asm__ volatile (
+ "movaps %0, %%xmm5 \n\t"
+ :: "m"(ff_pdw_80000000[0])
);
- for(i=0; i<blocksize; i+=4) {
- __asm__ volatile(
- "movaps %0, %%xmm0 \n\t"
- "movaps %1, %%xmm1 \n\t"
+ for (i = 0; i < blocksize; i += 4) {
+ __asm__ volatile (
+ "movaps %0, %%xmm0 \n\t"
+ "movaps %1, %%xmm1 \n\t"
"xorps %%xmm2, %%xmm2 \n\t"
"xorps %%xmm3, %%xmm3 \n\t"
"cmpleps %%xmm0, %%xmm2 \n\t" // m <= 0.0
@@ -2053,893 +1882,672 @@ static void vorbis_inverse_coupling_sse(float *mag, float *ang, int blocksize)
"movaps %%xmm3, %%xmm4 \n\t"
"andps %%xmm1, %%xmm3 \n\t"
"andnps %%xmm1, %%xmm4 \n\t"
- "addps %%xmm0, %%xmm3 \n\t" // a = m + ((a<0) & (a ^ sign(m)))
- "subps %%xmm4, %%xmm0 \n\t" // m = m + ((a>0) & (a ^ sign(m)))
+ "addps %%xmm0, %%xmm3 \n\t" // a = m + ((a < 0) & (a ^ sign(m)))
+ "subps %%xmm4, %%xmm0 \n\t" // m = m + ((a > 0) & (a ^ sign(m)))
"movaps %%xmm3, %1 \n\t"
"movaps %%xmm0, %0 \n\t"
- :"+m"(mag[i]), "+m"(ang[i])
- ::"memory"
- );
- }
-}
-
-#define IF1(x) x
-#define IF0(x)
-
-#define MIX5(mono,stereo)\
- __asm__ volatile(\
- "movss 0(%2), %%xmm5 \n"\
- "movss 8(%2), %%xmm6 \n"\
- "movss 24(%2), %%xmm7 \n"\
- "shufps $0, %%xmm5, %%xmm5 \n"\
- "shufps $0, %%xmm6, %%xmm6 \n"\
- "shufps $0, %%xmm7, %%xmm7 \n"\
- "1: \n"\
- "movaps (%0,%1), %%xmm0 \n"\
- "movaps 0x400(%0,%1), %%xmm1 \n"\
- "movaps 0x800(%0,%1), %%xmm2 \n"\
- "movaps 0xc00(%0,%1), %%xmm3 \n"\
- "movaps 0x1000(%0,%1), %%xmm4 \n"\
- "mulps %%xmm5, %%xmm0 \n"\
- "mulps %%xmm6, %%xmm1 \n"\
- "mulps %%xmm5, %%xmm2 \n"\
- "mulps %%xmm7, %%xmm3 \n"\
- "mulps %%xmm7, %%xmm4 \n"\
- stereo("addps %%xmm1, %%xmm0 \n")\
- "addps %%xmm1, %%xmm2 \n"\
- "addps %%xmm3, %%xmm0 \n"\
- "addps %%xmm4, %%xmm2 \n"\
- mono("addps %%xmm2, %%xmm0 \n")\
- "movaps %%xmm0, (%0,%1) \n"\
- stereo("movaps %%xmm2, 0x400(%0,%1) \n")\
- "add $16, %0 \n"\
- "jl 1b \n"\
- :"+&r"(i)\
- :"r"(samples[0]+len), "r"(matrix)\
- :XMM_CLOBBERS("%xmm0", "%xmm1", "%xmm2", "%xmm3", \
- "%xmm4", "%xmm5", "%xmm6", "%xmm7",)\
- "memory"\
- );
-
-#define MIX_MISC(stereo)\
- __asm__ volatile(\
- "1: \n"\
- "movaps (%3,%0), %%xmm0 \n"\
- stereo("movaps %%xmm0, %%xmm1 \n")\
- "mulps %%xmm4, %%xmm0 \n"\
- stereo("mulps %%xmm5, %%xmm1 \n")\
- "lea 1024(%3,%0), %1 \n"\
- "mov %5, %2 \n"\
- "2: \n"\
- "movaps (%1), %%xmm2 \n"\
- stereo("movaps %%xmm2, %%xmm3 \n")\
- "mulps (%4,%2), %%xmm2 \n"\
- stereo("mulps 16(%4,%2), %%xmm3 \n")\
- "addps %%xmm2, %%xmm0 \n"\
- stereo("addps %%xmm3, %%xmm1 \n")\
- "add $1024, %1 \n"\
- "add $32, %2 \n"\
- "jl 2b \n"\
- "movaps %%xmm0, (%3,%0) \n"\
- stereo("movaps %%xmm1, 1024(%3,%0) \n")\
- "add $16, %0 \n"\
- "jl 1b \n"\
- :"+&r"(i), "=&r"(j), "=&r"(k)\
- :"r"(samples[0]+len), "r"(matrix_simd+in_ch), "g"((intptr_t)-32*(in_ch-1))\
- :"memory"\
- );
-
-static void ac3_downmix_sse(float (*samples)[256], float (*matrix)[2], int out_ch, int in_ch, int len)
-{
- int (*matrix_cmp)[2] = (int(*)[2])matrix;
- intptr_t i,j,k;
-
- i = -len*sizeof(float);
- if(in_ch == 5 && out_ch == 2 && !(matrix_cmp[0][1]|matrix_cmp[2][0]|matrix_cmp[3][1]|matrix_cmp[4][0]|(matrix_cmp[1][0]^matrix_cmp[1][1])|(matrix_cmp[0][0]^matrix_cmp[2][1]))) {
- MIX5(IF0,IF1);
- } else if(in_ch == 5 && out_ch == 1 && matrix_cmp[0][0]==matrix_cmp[2][0] && matrix_cmp[3][0]==matrix_cmp[4][0]) {
- MIX5(IF1,IF0);
- } else {
- DECLARE_ALIGNED(16, float, matrix_simd)[AC3_MAX_CHANNELS][2][4];
- j = 2*in_ch*sizeof(float);
- __asm__ volatile(
- "1: \n"
- "sub $8, %0 \n"
- "movss (%2,%0), %%xmm4 \n"
- "movss 4(%2,%0), %%xmm5 \n"
- "shufps $0, %%xmm4, %%xmm4 \n"
- "shufps $0, %%xmm5, %%xmm5 \n"
- "movaps %%xmm4, (%1,%0,4) \n"
- "movaps %%xmm5, 16(%1,%0,4) \n"
- "jg 1b \n"
- :"+&r"(j)
- :"r"(matrix_simd), "r"(matrix)
- :"memory"
+ : "+m"(mag[i]), "+m"(ang[i])
+ :: "memory"
);
- if(out_ch == 2) {
- MIX_MISC(IF1);
- } else {
- MIX_MISC(IF0);
- }
}
}
-static void vector_fmul_3dnow(float *dst, const float *src0, const float *src1, int len){
- x86_reg i = (len-4)*4;
- __asm__ volatile(
- "1: \n\t"
- "movq (%2,%0), %%mm0 \n\t"
- "movq 8(%2,%0), %%mm1 \n\t"
- "pfmul (%3,%0), %%mm0 \n\t"
- "pfmul 8(%3,%0), %%mm1 \n\t"
- "movq %%mm0, (%1,%0) \n\t"
- "movq %%mm1, 8(%1,%0) \n\t"
- "sub $16, %0 \n\t"
- "jge 1b \n\t"
- "femms \n\t"
- :"+r"(i)
- :"r"(dst), "r"(src0), "r"(src1)
- :"memory"
- );
-}
-static void vector_fmul_sse(float *dst, const float *src0, const float *src1, int len){
- x86_reg i = (len-8)*4;
- __asm__ volatile(
- "1: \n\t"
- "movaps (%2,%0), %%xmm0 \n\t"
- "movaps 16(%2,%0), %%xmm1 \n\t"
- "mulps (%3,%0), %%xmm0 \n\t"
- "mulps 16(%3,%0), %%xmm1 \n\t"
- "movaps %%xmm0, (%1,%0) \n\t"
- "movaps %%xmm1, 16(%1,%0) \n\t"
- "sub $32, %0 \n\t"
- "jge 1b \n\t"
- :"+r"(i)
- :"r"(dst), "r"(src0), "r"(src1)
- :"memory"
- );
-}
-
-static void vector_fmul_reverse_3dnow2(float *dst, const float *src0, const float *src1, int len){
- x86_reg i = len*4-16;
- __asm__ volatile(
- "1: \n\t"
- "pswapd 8(%1), %%mm0 \n\t"
- "pswapd (%1), %%mm1 \n\t"
- "pfmul (%3,%0), %%mm0 \n\t"
- "pfmul 8(%3,%0), %%mm1 \n\t"
- "movq %%mm0, (%2,%0) \n\t"
- "movq %%mm1, 8(%2,%0) \n\t"
- "add $16, %1 \n\t"
- "sub $16, %0 \n\t"
- "jge 1b \n\t"
- :"+r"(i), "+r"(src1)
- :"r"(dst), "r"(src0)
- );
- __asm__ volatile("femms");
-}
-static void vector_fmul_reverse_sse(float *dst, const float *src0, const float *src1, int len){
- x86_reg i = len*4-32;
- __asm__ volatile(
- "1: \n\t"
- "movaps 16(%1), %%xmm0 \n\t"
- "movaps (%1), %%xmm1 \n\t"
- "shufps $0x1b, %%xmm0, %%xmm0 \n\t"
- "shufps $0x1b, %%xmm1, %%xmm1 \n\t"
- "mulps (%3,%0), %%xmm0 \n\t"
- "mulps 16(%3,%0), %%xmm1 \n\t"
- "movaps %%xmm0, (%2,%0) \n\t"
- "movaps %%xmm1, 16(%2,%0) \n\t"
- "add $32, %1 \n\t"
- "sub $32, %0 \n\t"
- "jge 1b \n\t"
- :"+r"(i), "+r"(src1)
- :"r"(dst), "r"(src0)
- );
-}
-
-static void vector_fmul_add_3dnow(float *dst, const float *src0, const float *src1,
- const float *src2, int len){
- x86_reg i = (len-4)*4;
- __asm__ volatile(
- "1: \n\t"
- "movq (%2,%0), %%mm0 \n\t"
- "movq 8(%2,%0), %%mm1 \n\t"
- "pfmul (%3,%0), %%mm0 \n\t"
- "pfmul 8(%3,%0), %%mm1 \n\t"
- "pfadd (%4,%0), %%mm0 \n\t"
- "pfadd 8(%4,%0), %%mm1 \n\t"
- "movq %%mm0, (%1,%0) \n\t"
- "movq %%mm1, 8(%1,%0) \n\t"
- "sub $16, %0 \n\t"
- "jge 1b \n\t"
- :"+r"(i)
- :"r"(dst), "r"(src0), "r"(src1), "r"(src2)
- :"memory"
- );
- __asm__ volatile("femms");
-}
-static void vector_fmul_add_sse(float *dst, const float *src0, const float *src1,
- const float *src2, int len){
- x86_reg i = (len-8)*4;
- __asm__ volatile(
- "1: \n\t"
- "movaps (%2,%0), %%xmm0 \n\t"
- "movaps 16(%2,%0), %%xmm1 \n\t"
- "mulps (%3,%0), %%xmm0 \n\t"
- "mulps 16(%3,%0), %%xmm1 \n\t"
- "addps (%4,%0), %%xmm0 \n\t"
- "addps 16(%4,%0), %%xmm1 \n\t"
- "movaps %%xmm0, (%1,%0) \n\t"
- "movaps %%xmm1, 16(%1,%0) \n\t"
- "sub $32, %0 \n\t"
- "jge 1b \n\t"
- :"+r"(i)
- :"r"(dst), "r"(src0), "r"(src1), "r"(src2)
- :"memory"
- );
-}
-
#if HAVE_6REGS
-static void vector_fmul_window_3dnow2(float *dst, const float *src0, const float *src1,
- const float *win, int len){
- x86_reg i = -len*4;
- x86_reg j = len*4-8;
- __asm__ volatile(
- "1: \n"
- "pswapd (%5,%1), %%mm1 \n"
- "movq (%5,%0), %%mm0 \n"
- "pswapd (%4,%1), %%mm5 \n"
- "movq (%3,%0), %%mm4 \n"
- "movq %%mm0, %%mm2 \n"
- "movq %%mm1, %%mm3 \n"
- "pfmul %%mm4, %%mm2 \n" // src0[len+i]*win[len+i]
- "pfmul %%mm5, %%mm3 \n" // src1[ j]*win[len+j]
- "pfmul %%mm4, %%mm1 \n" // src0[len+i]*win[len+j]
- "pfmul %%mm5, %%mm0 \n" // src1[ j]*win[len+i]
- "pfadd %%mm3, %%mm2 \n"
- "pfsub %%mm0, %%mm1 \n"
- "pswapd %%mm2, %%mm2 \n"
- "movq %%mm1, (%2,%0) \n"
- "movq %%mm2, (%2,%1) \n"
- "sub $8, %1 \n"
- "add $8, %0 \n"
- "jl 1b \n"
- "femms \n"
- :"+r"(i), "+r"(j)
- :"r"(dst+len), "r"(src0+len), "r"(src1), "r"(win+len)
+static void vector_fmul_window_3dnowext(float *dst, const float *src0,
+ const float *src1, const float *win,
+ int len)
+{
+ x86_reg i = -len * 4;
+ x86_reg j = len * 4 - 8;
+ __asm__ volatile (
+ "1: \n"
+ "pswapd (%5, %1), %%mm1 \n"
+ "movq (%5, %0), %%mm0 \n"
+ "pswapd (%4, %1), %%mm5 \n"
+ "movq (%3, %0), %%mm4 \n"
+ "movq %%mm0, %%mm2 \n"
+ "movq %%mm1, %%mm3 \n"
+ "pfmul %%mm4, %%mm2 \n" // src0[len + i] * win[len + i]
+ "pfmul %%mm5, %%mm3 \n" // src1[j] * win[len + j]
+ "pfmul %%mm4, %%mm1 \n" // src0[len + i] * win[len + j]
+ "pfmul %%mm5, %%mm0 \n" // src1[j] * win[len + i]
+ "pfadd %%mm3, %%mm2 \n"
+ "pfsub %%mm0, %%mm1 \n"
+ "pswapd %%mm2, %%mm2 \n"
+ "movq %%mm1, (%2, %0) \n"
+ "movq %%mm2, (%2, %1) \n"
+ "sub $8, %1 \n"
+ "add $8, %0 \n"
+ "jl 1b \n"
+ "femms \n"
+ : "+r"(i), "+r"(j)
+ : "r"(dst + len), "r"(src0 + len), "r"(src1), "r"(win + len)
);
}
-static void vector_fmul_window_sse(float *dst, const float *src0, const float *src1,
- const float *win, int len){
- x86_reg i = -len*4;
- x86_reg j = len*4-16;
- __asm__ volatile(
- "1: \n"
- "movaps (%5,%1), %%xmm1 \n"
- "movaps (%5,%0), %%xmm0 \n"
- "movaps (%4,%1), %%xmm5 \n"
- "movaps (%3,%0), %%xmm4 \n"
- "shufps $0x1b, %%xmm1, %%xmm1 \n"
- "shufps $0x1b, %%xmm5, %%xmm5 \n"
- "movaps %%xmm0, %%xmm2 \n"
- "movaps %%xmm1, %%xmm3 \n"
- "mulps %%xmm4, %%xmm2 \n" // src0[len+i]*win[len+i]
- "mulps %%xmm5, %%xmm3 \n" // src1[ j]*win[len+j]
- "mulps %%xmm4, %%xmm1 \n" // src0[len+i]*win[len+j]
- "mulps %%xmm5, %%xmm0 \n" // src1[ j]*win[len+i]
- "addps %%xmm3, %%xmm2 \n"
- "subps %%xmm0, %%xmm1 \n"
- "shufps $0x1b, %%xmm2, %%xmm2 \n"
- "movaps %%xmm1, (%2,%0) \n"
- "movaps %%xmm2, (%2,%1) \n"
- "sub $16, %1 \n"
- "add $16, %0 \n"
- "jl 1b \n"
- :"+r"(i), "+r"(j)
- :"r"(dst+len), "r"(src0+len), "r"(src1), "r"(win+len)
+static void vector_fmul_window_sse(float *dst, const float *src0,
+ const float *src1, const float *win, int len)
+{
+ x86_reg i = -len * 4;
+ x86_reg j = len * 4 - 16;
+ __asm__ volatile (
+ "1: \n"
+ "movaps (%5, %1), %%xmm1 \n"
+ "movaps (%5, %0), %%xmm0 \n"
+ "movaps (%4, %1), %%xmm5 \n"
+ "movaps (%3, %0), %%xmm4 \n"
+ "shufps $0x1b, %%xmm1, %%xmm1 \n"
+ "shufps $0x1b, %%xmm5, %%xmm5 \n"
+ "movaps %%xmm0, %%xmm2 \n"
+ "movaps %%xmm1, %%xmm3 \n"
+ "mulps %%xmm4, %%xmm2 \n" // src0[len + i] * win[len + i]
+ "mulps %%xmm5, %%xmm3 \n" // src1[j] * win[len + j]
+ "mulps %%xmm4, %%xmm1 \n" // src0[len + i] * win[len + j]
+ "mulps %%xmm5, %%xmm0 \n" // src1[j] * win[len + i]
+ "addps %%xmm3, %%xmm2 \n"
+ "subps %%xmm0, %%xmm1 \n"
+ "shufps $0x1b, %%xmm2, %%xmm2 \n"
+ "movaps %%xmm1, (%2, %0) \n"
+ "movaps %%xmm2, (%2, %1) \n"
+ "sub $16, %1 \n"
+ "add $16, %0 \n"
+ "jl 1b \n"
+ : "+r"(i), "+r"(j)
+ : "r"(dst + len), "r"(src0 + len), "r"(src1), "r"(win + len)
);
}
#endif /* HAVE_6REGS */
-static void vector_clipf_sse(float *dst, const float *src, float min, float max,
- int len)
+static void vector_clipf_sse(float *dst, const float *src,
+ float min, float max, int len)
{
- x86_reg i = (len-16)*4;
- __asm__ volatile(
- "movss %3, %%xmm4 \n"
- "movss %4, %%xmm5 \n"
- "shufps $0, %%xmm4, %%xmm4 \n"
- "shufps $0, %%xmm5, %%xmm5 \n"
- "1: \n\t"
- "movaps (%2,%0), %%xmm0 \n\t" // 3/1 on intel
- "movaps 16(%2,%0), %%xmm1 \n\t"
- "movaps 32(%2,%0), %%xmm2 \n\t"
- "movaps 48(%2,%0), %%xmm3 \n\t"
- "maxps %%xmm4, %%xmm0 \n\t"
- "maxps %%xmm4, %%xmm1 \n\t"
- "maxps %%xmm4, %%xmm2 \n\t"
- "maxps %%xmm4, %%xmm3 \n\t"
- "minps %%xmm5, %%xmm0 \n\t"
- "minps %%xmm5, %%xmm1 \n\t"
- "minps %%xmm5, %%xmm2 \n\t"
- "minps %%xmm5, %%xmm3 \n\t"
- "movaps %%xmm0, (%1,%0) \n\t"
- "movaps %%xmm1, 16(%1,%0) \n\t"
- "movaps %%xmm2, 32(%1,%0) \n\t"
- "movaps %%xmm3, 48(%1,%0) \n\t"
- "sub $64, %0 \n\t"
- "jge 1b \n\t"
- :"+&r"(i)
- :"r"(dst), "r"(src), "m"(min), "m"(max)
- :"memory"
+ x86_reg i = (len - 16) * 4;
+ __asm__ volatile (
+ "movss %3, %%xmm4 \n\t"
+ "movss %4, %%xmm5 \n\t"
+ "shufps $0, %%xmm4, %%xmm4 \n\t"
+ "shufps $0, %%xmm5, %%xmm5 \n\t"
+ "1: \n\t"
+ "movaps (%2, %0), %%xmm0 \n\t" // 3/1 on intel
+ "movaps 16(%2, %0), %%xmm1 \n\t"
+ "movaps 32(%2, %0), %%xmm2 \n\t"
+ "movaps 48(%2, %0), %%xmm3 \n\t"
+ "maxps %%xmm4, %%xmm0 \n\t"
+ "maxps %%xmm4, %%xmm1 \n\t"
+ "maxps %%xmm4, %%xmm2 \n\t"
+ "maxps %%xmm4, %%xmm3 \n\t"
+ "minps %%xmm5, %%xmm0 \n\t"
+ "minps %%xmm5, %%xmm1 \n\t"
+ "minps %%xmm5, %%xmm2 \n\t"
+ "minps %%xmm5, %%xmm3 \n\t"
+ "movaps %%xmm0, (%1, %0) \n\t"
+ "movaps %%xmm1, 16(%1, %0) \n\t"
+ "movaps %%xmm2, 32(%1, %0) \n\t"
+ "movaps %%xmm3, 48(%1, %0) \n\t"
+ "sub $64, %0 \n\t"
+ "jge 1b \n\t"
+ : "+&r"(i)
+ : "r"(dst), "r"(src), "m"(min), "m"(max)
+ : "memory"
);
}
-void ff_vp3_idct_mmx(int16_t *input_data);
-void ff_vp3_idct_put_mmx(uint8_t *dest, int line_size, DCTELEM *block);
-void ff_vp3_idct_add_mmx(uint8_t *dest, int line_size, DCTELEM *block);
-
-void ff_vp3_idct_dc_add_mmx2(uint8_t *dest, int line_size, const DCTELEM *block);
-
-void ff_vp3_v_loop_filter_mmx2(uint8_t *src, int stride, int *bounding_values);
-void ff_vp3_h_loop_filter_mmx2(uint8_t *src, int stride, int *bounding_values);
-
-void ff_vp3_idct_sse2(int16_t *input_data);
-void ff_vp3_idct_put_sse2(uint8_t *dest, int line_size, DCTELEM *block);
-void ff_vp3_idct_add_sse2(uint8_t *dest, int line_size, DCTELEM *block);
-
-int32_t ff_scalarproduct_int16_mmx2(const int16_t *v1, const int16_t *v2, int order, int shift);
-int32_t ff_scalarproduct_int16_sse2(const int16_t *v1, const int16_t *v2, int order, int shift);
-int32_t ff_scalarproduct_and_madd_int16_mmx2(int16_t *v1, const int16_t *v2, const int16_t *v3, int order, int mul);
-int32_t ff_scalarproduct_and_madd_int16_sse2(int16_t *v1, const int16_t *v2, const int16_t *v3, int order, int mul);
-int32_t ff_scalarproduct_and_madd_int16_ssse3(int16_t *v1, const int16_t *v2, const int16_t *v3, int order, int mul);
-
-void ff_apply_window_int16_mmxext (int16_t *output, const int16_t *input,
- const int16_t *window, unsigned int len);
-void ff_apply_window_int16_mmxext_ba (int16_t *output, const int16_t *input,
- const int16_t *window, unsigned int len);
-void ff_apply_window_int16_sse2 (int16_t *output, const int16_t *input,
- const int16_t *window, unsigned int len);
-void ff_apply_window_int16_sse2_ba (int16_t *output, const int16_t *input,
- const int16_t *window, unsigned int len);
-void ff_apply_window_int16_ssse3 (int16_t *output, const int16_t *input,
+#endif /* HAVE_INLINE_ASM */
+
+int32_t ff_scalarproduct_int16_mmxext(const int16_t *v1, const int16_t *v2,
+ int order);
+int32_t ff_scalarproduct_int16_sse2(const int16_t *v1, const int16_t *v2,
+ int order);
+int32_t ff_scalarproduct_and_madd_int16_mmxext(int16_t *v1, const int16_t *v2,
+ const int16_t *v3,
+ int order, int mul);
+int32_t ff_scalarproduct_and_madd_int16_sse2(int16_t *v1, const int16_t *v2,
+ const int16_t *v3,
+ int order, int mul);
+int32_t ff_scalarproduct_and_madd_int16_ssse3(int16_t *v1, const int16_t *v2,
+ const int16_t *v3,
+ int order, int mul);
+
+void ff_apply_window_int16_round_mmxext(int16_t *output, const int16_t *input,
+ const int16_t *window, unsigned int len);
+void ff_apply_window_int16_round_sse2(int16_t *output, const int16_t *input,
const int16_t *window, unsigned int len);
+void ff_apply_window_int16_mmxext(int16_t *output, const int16_t *input,
+ const int16_t *window, unsigned int len);
+void ff_apply_window_int16_sse2(int16_t *output, const int16_t *input,
+ const int16_t *window, unsigned int len);
+void ff_apply_window_int16_ssse3(int16_t *output, const int16_t *input,
+ const int16_t *window, unsigned int len);
void ff_apply_window_int16_ssse3_atom(int16_t *output, const int16_t *input,
const int16_t *window, unsigned int len);
-void ff_add_hfyu_median_prediction_mmx2(uint8_t *dst, const uint8_t *top, const uint8_t *diff, int w, int *left, int *left_top);
-int ff_add_hfyu_left_prediction_ssse3(uint8_t *dst, const uint8_t *src, int w, int left);
-int ff_add_hfyu_left_prediction_sse4(uint8_t *dst, const uint8_t *src, int w, int left);
+void ff_bswap32_buf_ssse3(uint32_t *dst, const uint32_t *src, int w);
+void ff_bswap32_buf_sse2(uint32_t *dst, const uint32_t *src, int w);
+
+void ff_add_hfyu_median_prediction_mmxext(uint8_t *dst, const uint8_t *top,
+ const uint8_t *diff, int w,
+ int *left, int *left_top);
+int ff_add_hfyu_left_prediction_ssse3(uint8_t *dst, const uint8_t *src,
+ int w, int left);
+int ff_add_hfyu_left_prediction_sse4(uint8_t *dst, const uint8_t *src,
+ int w, int left);
float ff_scalarproduct_float_sse(const float *v1, const float *v2, int order);
-void ff_vector_clip_int32_mmx (int32_t *dst, const int32_t *src, int32_t min,
- int32_t max, unsigned int len);
-void ff_vector_clip_int32_sse2 (int32_t *dst, const int32_t *src, int32_t min,
- int32_t max, unsigned int len);
-void ff_vector_clip_int32_int_sse2(int32_t *dst, const int32_t *src, int32_t min,
- int32_t max, unsigned int len);
-void ff_vector_clip_int32_sse4 (int32_t *dst, const int32_t *src, int32_t min,
- int32_t max, unsigned int len);
+void ff_vector_fmul_reverse_sse(float *dst, const float *src0,
+ const float *src1, int len);
+void ff_vector_fmul_reverse_avx(float *dst, const float *src0,
+ const float *src1, int len);
+
+void ff_vector_fmul_add_sse(float *dst, const float *src0, const float *src1,
+ const float *src2, int len);
+void ff_vector_fmul_add_avx(float *dst, const float *src0, const float *src1,
+ const float *src2, int len);
+
+void ff_vector_clip_int32_mmx (int32_t *dst, const int32_t *src,
+ int32_t min, int32_t max, unsigned int len);
+void ff_vector_clip_int32_sse2 (int32_t *dst, const int32_t *src,
+ int32_t min, int32_t max, unsigned int len);
+void ff_vector_clip_int32_int_sse2(int32_t *dst, const int32_t *src,
+ int32_t min, int32_t max, unsigned int len);
+void ff_vector_clip_int32_sse4 (int32_t *dst, const int32_t *src,
+ int32_t min, int32_t max, unsigned int len);
extern void ff_butterflies_float_interleave_sse(float *dst, const float *src0,
const float *src1, int len);
extern void ff_butterflies_float_interleave_avx(float *dst, const float *src0,
const float *src1, int len);
-void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx)
+#define SET_QPEL_FUNCS(PFX, IDX, SIZE, CPU, PREFIX) \
+ do { \
+ c->PFX ## _pixels_tab[IDX][ 0] = PREFIX ## PFX ## SIZE ## _mc00_ ## CPU; \
+ c->PFX ## _pixels_tab[IDX][ 1] = PREFIX ## PFX ## SIZE ## _mc10_ ## CPU; \
+ c->PFX ## _pixels_tab[IDX][ 2] = PREFIX ## PFX ## SIZE ## _mc20_ ## CPU; \
+ c->PFX ## _pixels_tab[IDX][ 3] = PREFIX ## PFX ## SIZE ## _mc30_ ## CPU; \
+ c->PFX ## _pixels_tab[IDX][ 4] = PREFIX ## PFX ## SIZE ## _mc01_ ## CPU; \
+ c->PFX ## _pixels_tab[IDX][ 5] = PREFIX ## PFX ## SIZE ## _mc11_ ## CPU; \
+ c->PFX ## _pixels_tab[IDX][ 6] = PREFIX ## PFX ## SIZE ## _mc21_ ## CPU; \
+ c->PFX ## _pixels_tab[IDX][ 7] = PREFIX ## PFX ## SIZE ## _mc31_ ## CPU; \
+ c->PFX ## _pixels_tab[IDX][ 8] = PREFIX ## PFX ## SIZE ## _mc02_ ## CPU; \
+ c->PFX ## _pixels_tab[IDX][ 9] = PREFIX ## PFX ## SIZE ## _mc12_ ## CPU; \
+ c->PFX ## _pixels_tab[IDX][10] = PREFIX ## PFX ## SIZE ## _mc22_ ## CPU; \
+ c->PFX ## _pixels_tab[IDX][11] = PREFIX ## PFX ## SIZE ## _mc32_ ## CPU; \
+ c->PFX ## _pixels_tab[IDX][12] = PREFIX ## PFX ## SIZE ## _mc03_ ## CPU; \
+ c->PFX ## _pixels_tab[IDX][13] = PREFIX ## PFX ## SIZE ## _mc13_ ## CPU; \
+ c->PFX ## _pixels_tab[IDX][14] = PREFIX ## PFX ## SIZE ## _mc23_ ## CPU; \
+ c->PFX ## _pixels_tab[IDX][15] = PREFIX ## PFX ## SIZE ## _mc33_ ## CPU; \
+ } while (0)
+
+#define SET_HPEL_FUNCS(PFX, IDX, SIZE, CPU) \
+ do { \
+ c->PFX ## _pixels_tab[IDX][0] = PFX ## _pixels ## SIZE ## _ ## CPU; \
+ c->PFX ## _pixels_tab[IDX][1] = PFX ## _pixels ## SIZE ## _x2_ ## CPU; \
+ c->PFX ## _pixels_tab[IDX][2] = PFX ## _pixels ## SIZE ## _y2_ ## CPU; \
+ c->PFX ## _pixels_tab[IDX][3] = PFX ## _pixels ## SIZE ## _xy2_ ## CPU; \
+ } while (0)
+
+#define H264_QPEL_FUNCS(x, y, CPU) \
+ do { \
+ c->put_h264_qpel_pixels_tab[0][x + y * 4] = put_h264_qpel16_mc ## x ## y ## _ ## CPU; \
+ c->put_h264_qpel_pixels_tab[1][x + y * 4] = put_h264_qpel8_mc ## x ## y ## _ ## CPU; \
+ c->avg_h264_qpel_pixels_tab[0][x + y * 4] = avg_h264_qpel16_mc ## x ## y ## _ ## CPU; \
+ c->avg_h264_qpel_pixels_tab[1][x + y * 4] = avg_h264_qpel8_mc ## x ## y ## _ ## CPU; \
+ } while (0)
+
+#define H264_QPEL_FUNCS_10(x, y, CPU) \
+ do { \
+ c->put_h264_qpel_pixels_tab[0][x + y * 4] = ff_put_h264_qpel16_mc ## x ## y ## _10_ ## CPU; \
+ c->put_h264_qpel_pixels_tab[1][x + y * 4] = ff_put_h264_qpel8_mc ## x ## y ## _10_ ## CPU; \
+ c->avg_h264_qpel_pixels_tab[0][x + y * 4] = ff_avg_h264_qpel16_mc ## x ## y ## _10_ ## CPU; \
+ c->avg_h264_qpel_pixels_tab[1][x + y * 4] = ff_avg_h264_qpel8_mc ## x ## y ## _10_ ## CPU; \
+ } while (0)
+
+static void dsputil_init_mmx(DSPContext *c, AVCodecContext *avctx, int mm_flags)
{
- int mm_flags = av_get_cpu_flags();
const int high_bit_depth = avctx->bits_per_raw_sample > 8;
- const int bit_depth = avctx->bits_per_raw_sample;
- if (avctx->dsp_mask) {
- if (avctx->dsp_mask & AV_CPU_FLAG_FORCE)
- mm_flags |= (avctx->dsp_mask & 0xffff);
- else
- mm_flags &= ~(avctx->dsp_mask & 0xffff);
- }
+#if HAVE_INLINE_ASM
+ c->put_pixels_clamped = ff_put_pixels_clamped_mmx;
+ c->put_signed_pixels_clamped = ff_put_signed_pixels_clamped_mmx;
+ c->add_pixels_clamped = ff_add_pixels_clamped_mmx;
-#if 0
- av_log(avctx, AV_LOG_INFO, "libavcodec: CPU flags:");
- if (mm_flags & AV_CPU_FLAG_MMX)
- av_log(avctx, AV_LOG_INFO, " mmx");
- if (mm_flags & AV_CPU_FLAG_MMX2)
- av_log(avctx, AV_LOG_INFO, " mmx2");
- if (mm_flags & AV_CPU_FLAG_3DNOW)
- av_log(avctx, AV_LOG_INFO, " 3dnow");
- if (mm_flags & AV_CPU_FLAG_SSE)
- av_log(avctx, AV_LOG_INFO, " sse");
- if (mm_flags & AV_CPU_FLAG_SSE2)
- av_log(avctx, AV_LOG_INFO, " sse2");
- av_log(avctx, AV_LOG_INFO, "\n");
-#endif
-
- if (mm_flags & AV_CPU_FLAG_MMX) {
- const int idct_algo= avctx->idct_algo;
-
- if (avctx->lowres == 0 && avctx->bits_per_raw_sample <= 8) {
- if(idct_algo==FF_IDCT_AUTO || idct_algo==FF_IDCT_SIMPLEMMX){
- c->idct_put= ff_simple_idct_put_mmx;
- c->idct_add= ff_simple_idct_add_mmx;
- c->idct = ff_simple_idct_mmx;
- c->idct_permutation_type= FF_SIMPLE_IDCT_PERM;
-#if CONFIG_GPL
- }else if(idct_algo==FF_IDCT_LIBMPEG2MMX){
- if(mm_flags & AV_CPU_FLAG_MMX2){
- c->idct_put= ff_libmpeg2mmx2_idct_put;
- c->idct_add= ff_libmpeg2mmx2_idct_add;
- c->idct = ff_mmxext_idct;
- }else{
- c->idct_put= ff_libmpeg2mmx_idct_put;
- c->idct_add= ff_libmpeg2mmx_idct_add;
- c->idct = ff_mmx_idct;
- }
- c->idct_permutation_type= FF_LIBMPEG2_IDCT_PERM;
-#endif
- }else if((CONFIG_VP3_DECODER || CONFIG_VP5_DECODER || CONFIG_VP6_DECODER) &&
- idct_algo==FF_IDCT_VP3 && HAVE_YASM){
- if(mm_flags & AV_CPU_FLAG_SSE2){
- c->idct_put= ff_vp3_idct_put_sse2;
- c->idct_add= ff_vp3_idct_add_sse2;
- c->idct = ff_vp3_idct_sse2;
- c->idct_permutation_type= FF_TRANSPOSE_IDCT_PERM;
- }else{
- c->idct_put= ff_vp3_idct_put_mmx;
- c->idct_add= ff_vp3_idct_add_mmx;
- c->idct = ff_vp3_idct_mmx;
- c->idct_permutation_type= FF_PARTTRANS_IDCT_PERM;
- }
- }else if(idct_algo==FF_IDCT_CAVS){
- c->idct_permutation_type= FF_TRANSPOSE_IDCT_PERM;
- }else if(idct_algo==FF_IDCT_XVIDMMX){
- if(mm_flags & AV_CPU_FLAG_SSE2){
- c->idct_put= ff_idct_xvid_sse2_put;
- c->idct_add= ff_idct_xvid_sse2_add;
- c->idct = ff_idct_xvid_sse2;
- c->idct_permutation_type= FF_SSE2_IDCT_PERM;
- }else if(mm_flags & AV_CPU_FLAG_MMX2){
- c->idct_put= ff_idct_xvid_mmx2_put;
- c->idct_add= ff_idct_xvid_mmx2_add;
- c->idct = ff_idct_xvid_mmx2;
- }else{
- c->idct_put= ff_idct_xvid_mmx_put;
- c->idct_add= ff_idct_xvid_mmx_add;
- c->idct = ff_idct_xvid_mmx;
- }
- }
- }
-
- c->put_pixels_clamped = ff_put_pixels_clamped_mmx;
- c->put_signed_pixels_clamped = ff_put_signed_pixels_clamped_mmx;
- c->add_pixels_clamped = ff_add_pixels_clamped_mmx;
- if (!high_bit_depth) {
+ if (!high_bit_depth) {
c->clear_block = clear_block_mmx;
c->clear_blocks = clear_blocks_mmx;
- if ((mm_flags & AV_CPU_FLAG_SSE) &&
- !(CONFIG_MPEG_XVMC_DECODER && avctx->xvmc_acceleration > 1)){
- /* XvMCCreateBlocks() may not allocate 16-byte aligned blocks */
- c->clear_block = clear_block_sse;
- c->clear_blocks = clear_blocks_sse;
- }
- }
-
-#define SET_HPEL_FUNCS(PFX, IDX, SIZE, CPU) \
- c->PFX ## _pixels_tab[IDX][0] = PFX ## _pixels ## SIZE ## _ ## CPU; \
- c->PFX ## _pixels_tab[IDX][1] = PFX ## _pixels ## SIZE ## _x2_ ## CPU; \
- c->PFX ## _pixels_tab[IDX][2] = PFX ## _pixels ## SIZE ## _y2_ ## CPU; \
- c->PFX ## _pixels_tab[IDX][3] = PFX ## _pixels ## SIZE ## _xy2_ ## CPU
+ c->draw_edges = draw_edges_mmx;
- if (!high_bit_depth) {
- SET_HPEL_FUNCS(put, 0, 16, mmx);
+ SET_HPEL_FUNCS(put, 0, 16, mmx);
SET_HPEL_FUNCS(put_no_rnd, 0, 16, mmx);
- SET_HPEL_FUNCS(avg, 0, 16, mmx);
+ SET_HPEL_FUNCS(avg, 0, 16, mmx);
SET_HPEL_FUNCS(avg_no_rnd, 0, 16, mmx);
- SET_HPEL_FUNCS(put, 1, 8, mmx);
- SET_HPEL_FUNCS(put_no_rnd, 1, 8, mmx);
- SET_HPEL_FUNCS(avg, 1, 8, mmx);
- SET_HPEL_FUNCS(avg_no_rnd, 1, 8, mmx);
+ SET_HPEL_FUNCS(put, 1, 8, mmx);
+ SET_HPEL_FUNCS(put_no_rnd, 1, 8, mmx);
+ SET_HPEL_FUNCS(avg, 1, 8, mmx);
+ SET_HPEL_FUNCS(avg_no_rnd, 1, 8, mmx);
+
+ switch (avctx->idct_algo) {
+ case FF_IDCT_AUTO:
+ case FF_IDCT_SIMPLEMMX:
+ c->idct_put = ff_simple_idct_put_mmx;
+ c->idct_add = ff_simple_idct_add_mmx;
+ c->idct = ff_simple_idct_mmx;
+ c->idct_permutation_type = FF_SIMPLE_IDCT_PERM;
+ break;
+ case FF_IDCT_XVIDMMX:
+ c->idct_put = ff_idct_xvid_mmx_put;
+ c->idct_add = ff_idct_xvid_mmx_add;
+ c->idct = ff_idct_xvid_mmx;
+ break;
}
+ }
-#if ARCH_X86_32 || !HAVE_YASM
- c->gmc= gmc_mmx;
-#endif
-#if ARCH_X86_32 && HAVE_YASM
- if (!high_bit_depth)
- c->emulated_edge_mc = emulated_edge_mc_mmx;
+ c->gmc = gmc_mmx;
+
+ c->add_bytes = add_bytes_mmx;
+
+ if (CONFIG_H263_DECODER || CONFIG_H263_ENCODER) {
+ c->h263_v_loop_filter = h263_v_loop_filter_mmx;
+ c->h263_h_loop_filter = h263_h_loop_filter_mmx;
+ }
+#endif /* HAVE_INLINE_ASM */
+
+#if HAVE_YASM
+ if (!high_bit_depth && CONFIG_H264CHROMA) {
+ c->put_h264_chroma_pixels_tab[0] = ff_put_h264_chroma_mc8_rnd_mmx;
+ c->put_h264_chroma_pixels_tab[1] = ff_put_h264_chroma_mc4_mmx;
+ }
+
+ c->vector_clip_int32 = ff_vector_clip_int32_mmx;
#endif
- c->add_bytes= add_bytes_mmx;
- c->add_bytes_l2= add_bytes_l2_mmx;
+}
- if (!high_bit_depth)
- c->draw_edges = draw_edges_mmx;
+static void dsputil_init_mmxext(DSPContext *c, AVCodecContext *avctx,
+ int mm_flags)
+{
+ const int bit_depth = avctx->bits_per_raw_sample;
+ const int high_bit_depth = bit_depth > 8;
+
+#if HAVE_INLINE_ASM
+ SET_QPEL_FUNCS(avg_qpel, 0, 16, mmxext, );
+ SET_QPEL_FUNCS(avg_qpel, 1, 8, mmxext, );
+ SET_QPEL_FUNCS(avg_2tap_qpel, 0, 16, mmxext, );
+ SET_QPEL_FUNCS(avg_2tap_qpel, 1, 8, mmxext, );
+
+ SET_QPEL_FUNCS(put_qpel, 0, 16, mmxext, );
+ SET_QPEL_FUNCS(put_qpel, 1, 8, mmxext, );
+ SET_QPEL_FUNCS(put_2tap_qpel, 0, 16, mmxext, );
+ SET_QPEL_FUNCS(put_2tap_qpel, 1, 8, mmxext, );
+ SET_QPEL_FUNCS(put_no_rnd_qpel, 0, 16, mmxext, );
+ SET_QPEL_FUNCS(put_no_rnd_qpel, 1, 8, mmxext, );
+
+ if (!high_bit_depth) {
+ c->put_pixels_tab[0][1] = put_pixels16_x2_mmxext;
+ c->put_pixels_tab[0][2] = put_pixels16_y2_mmxext;
+
+ c->avg_pixels_tab[0][0] = avg_pixels16_mmxext;
+ c->avg_pixels_tab[0][1] = avg_pixels16_x2_mmxext;
+ c->avg_pixels_tab[0][2] = avg_pixels16_y2_mmxext;
+
+ c->put_pixels_tab[1][1] = put_pixels8_x2_mmxext;
+ c->put_pixels_tab[1][2] = put_pixels8_y2_mmxext;
+
+ c->avg_pixels_tab[1][0] = avg_pixels8_mmxext;
+ c->avg_pixels_tab[1][1] = avg_pixels8_x2_mmxext;
+ c->avg_pixels_tab[1][2] = avg_pixels8_y2_mmxext;
+ }
- if (CONFIG_H263_DECODER || CONFIG_H263_ENCODER) {
- c->h263_v_loop_filter= h263_v_loop_filter_mmx;
- c->h263_h_loop_filter= h263_h_loop_filter_mmx;
- }
+ if (!(avctx->flags & CODEC_FLAG_BITEXACT)) {
+ if (!high_bit_depth) {
+ c->put_no_rnd_pixels_tab[0][1] = put_no_rnd_pixels16_x2_mmxext;
+ c->put_no_rnd_pixels_tab[0][2] = put_no_rnd_pixels16_y2_mmxext;
+ c->put_no_rnd_pixels_tab[1][1] = put_no_rnd_pixels8_x2_mmxext;
+ c->put_no_rnd_pixels_tab[1][2] = put_no_rnd_pixels8_y2_mmxext;
-#if HAVE_YASM
- if (!high_bit_depth && CONFIG_H264CHROMA) {
- c->put_h264_chroma_pixels_tab[0]= ff_put_h264_chroma_mc8_mmx_rnd;
- c->put_h264_chroma_pixels_tab[1]= ff_put_h264_chroma_mc4_mmx;
+ c->avg_pixels_tab[0][3] = avg_pixels16_xy2_mmxext;
+ c->avg_pixels_tab[1][3] = avg_pixels8_xy2_mmxext;
}
+ }
- c->vector_clip_int32 = ff_vector_clip_int32_mmx;
-#endif
+ if (!high_bit_depth && avctx->idct_algo == FF_IDCT_XVIDMMX) {
+ c->idct_put = ff_idct_xvid_mmxext_put;
+ c->idct_add = ff_idct_xvid_mmxext_add;
+ c->idct = ff_idct_xvid_mmxext;
+ }
- if (mm_flags & AV_CPU_FLAG_MMX2) {
- c->prefetch = prefetch_mmx2;
-
- if (!high_bit_depth) {
- c->put_pixels_tab[0][1] = put_pixels16_x2_mmx2;
- c->put_pixels_tab[0][2] = put_pixels16_y2_mmx2;
-
- c->avg_pixels_tab[0][0] = avg_pixels16_mmx2;
- c->avg_pixels_tab[0][1] = avg_pixels16_x2_mmx2;
- c->avg_pixels_tab[0][2] = avg_pixels16_y2_mmx2;
-
- c->put_pixels_tab[1][1] = put_pixels8_x2_mmx2;
- c->put_pixels_tab[1][2] = put_pixels8_y2_mmx2;
-
- c->avg_pixels_tab[1][0] = avg_pixels8_mmx2;
- c->avg_pixels_tab[1][1] = avg_pixels8_x2_mmx2;
- c->avg_pixels_tab[1][2] = avg_pixels8_y2_mmx2;
- }
-
- if(!(avctx->flags & CODEC_FLAG_BITEXACT)){
- if (!high_bit_depth) {
- c->put_no_rnd_pixels_tab[0][1] = put_no_rnd_pixels16_x2_mmx2;
- c->put_no_rnd_pixels_tab[0][2] = put_no_rnd_pixels16_y2_mmx2;
- c->put_no_rnd_pixels_tab[1][1] = put_no_rnd_pixels8_x2_mmx2;
- c->put_no_rnd_pixels_tab[1][2] = put_no_rnd_pixels8_y2_mmx2;
- c->avg_pixels_tab[0][3] = avg_pixels16_xy2_mmx2;
- c->avg_pixels_tab[1][3] = avg_pixels8_xy2_mmx2;
- }
-
- if (CONFIG_VP3_DECODER && HAVE_YASM) {
- c->vp3_v_loop_filter= ff_vp3_v_loop_filter_mmx2;
- c->vp3_h_loop_filter= ff_vp3_h_loop_filter_mmx2;
- }
- }
- if (CONFIG_VP3_DECODER && HAVE_YASM) {
- c->vp3_idct_dc_add = ff_vp3_idct_dc_add_mmx2;
- }
-
- if (CONFIG_VP3_DECODER
- && (avctx->codec_id == CODEC_ID_VP3 || avctx->codec_id == CODEC_ID_THEORA)) {
- c->put_no_rnd_pixels_tab[1][1] = put_no_rnd_pixels8_x2_exact_mmx2;
- c->put_no_rnd_pixels_tab[1][2] = put_no_rnd_pixels8_y2_exact_mmx2;
- }
-
-#define SET_QPEL_FUNCS(PFX, IDX, SIZE, CPU, PREFIX) \
- c->PFX ## _pixels_tab[IDX][ 0] = PREFIX ## PFX ## SIZE ## _mc00_ ## CPU; \
- c->PFX ## _pixels_tab[IDX][ 1] = PREFIX ## PFX ## SIZE ## _mc10_ ## CPU; \
- c->PFX ## _pixels_tab[IDX][ 2] = PREFIX ## PFX ## SIZE ## _mc20_ ## CPU; \
- c->PFX ## _pixels_tab[IDX][ 3] = PREFIX ## PFX ## SIZE ## _mc30_ ## CPU; \
- c->PFX ## _pixels_tab[IDX][ 4] = PREFIX ## PFX ## SIZE ## _mc01_ ## CPU; \
- c->PFX ## _pixels_tab[IDX][ 5] = PREFIX ## PFX ## SIZE ## _mc11_ ## CPU; \
- c->PFX ## _pixels_tab[IDX][ 6] = PREFIX ## PFX ## SIZE ## _mc21_ ## CPU; \
- c->PFX ## _pixels_tab[IDX][ 7] = PREFIX ## PFX ## SIZE ## _mc31_ ## CPU; \
- c->PFX ## _pixels_tab[IDX][ 8] = PREFIX ## PFX ## SIZE ## _mc02_ ## CPU; \
- c->PFX ## _pixels_tab[IDX][ 9] = PREFIX ## PFX ## SIZE ## _mc12_ ## CPU; \
- c->PFX ## _pixels_tab[IDX][10] = PREFIX ## PFX ## SIZE ## _mc22_ ## CPU; \
- c->PFX ## _pixels_tab[IDX][11] = PREFIX ## PFX ## SIZE ## _mc32_ ## CPU; \
- c->PFX ## _pixels_tab[IDX][12] = PREFIX ## PFX ## SIZE ## _mc03_ ## CPU; \
- c->PFX ## _pixels_tab[IDX][13] = PREFIX ## PFX ## SIZE ## _mc13_ ## CPU; \
- c->PFX ## _pixels_tab[IDX][14] = PREFIX ## PFX ## SIZE ## _mc23_ ## CPU; \
- c->PFX ## _pixels_tab[IDX][15] = PREFIX ## PFX ## SIZE ## _mc33_ ## CPU
-
- SET_QPEL_FUNCS(put_qpel, 0, 16, mmx2, );
- SET_QPEL_FUNCS(put_qpel, 1, 8, mmx2, );
- SET_QPEL_FUNCS(put_no_rnd_qpel, 0, 16, mmx2, );
- SET_QPEL_FUNCS(put_no_rnd_qpel, 1, 8, mmx2, );
- SET_QPEL_FUNCS(avg_qpel, 0, 16, mmx2, );
- SET_QPEL_FUNCS(avg_qpel, 1, 8, mmx2, );
-
- if (!high_bit_depth) {
- SET_QPEL_FUNCS(put_h264_qpel, 0, 16, mmx2, );
- SET_QPEL_FUNCS(put_h264_qpel, 1, 8, mmx2, );
- SET_QPEL_FUNCS(put_h264_qpel, 2, 4, mmx2, );
- SET_QPEL_FUNCS(avg_h264_qpel, 0, 16, mmx2, );
- SET_QPEL_FUNCS(avg_h264_qpel, 1, 8, mmx2, );
- SET_QPEL_FUNCS(avg_h264_qpel, 2, 4, mmx2, );
- }
- else if (bit_depth == 10) {
-#if HAVE_YASM
+ if (CONFIG_VP3_DECODER && (avctx->codec_id == AV_CODEC_ID_VP3 ||
+ avctx->codec_id == AV_CODEC_ID_THEORA)) {
+ c->put_no_rnd_pixels_tab[1][1] = put_no_rnd_pixels8_x2_exact_mmxext;
+ c->put_no_rnd_pixels_tab[1][2] = put_no_rnd_pixels8_y2_exact_mmxext;
+ }
+#endif /* HAVE_INLINE_ASM */
+
+#if HAVE_MMXEXT_EXTERNAL
+ if (CONFIG_H264QPEL) {
+ if (!high_bit_depth) {
+ SET_QPEL_FUNCS(put_h264_qpel, 0, 16, mmxext, );
+ SET_QPEL_FUNCS(put_h264_qpel, 1, 8, mmxext, );
+ SET_QPEL_FUNCS(put_h264_qpel, 2, 4, mmxext, );
+ SET_QPEL_FUNCS(avg_h264_qpel, 0, 16, mmxext, );
+ SET_QPEL_FUNCS(avg_h264_qpel, 1, 8, mmxext, );
+ SET_QPEL_FUNCS(avg_h264_qpel, 2, 4, mmxext, );
+ } else if (bit_depth == 10) {
#if !ARCH_X86_64
- SET_QPEL_FUNCS(avg_h264_qpel, 0, 16, 10_mmxext, ff_);
- SET_QPEL_FUNCS(put_h264_qpel, 0, 16, 10_mmxext, ff_);
- SET_QPEL_FUNCS(put_h264_qpel, 1, 8, 10_mmxext, ff_);
- SET_QPEL_FUNCS(avg_h264_qpel, 1, 8, 10_mmxext, ff_);
+ SET_QPEL_FUNCS(avg_h264_qpel, 0, 16, 10_mmxext, ff_);
+ SET_QPEL_FUNCS(put_h264_qpel, 0, 16, 10_mmxext, ff_);
+ SET_QPEL_FUNCS(put_h264_qpel, 1, 8, 10_mmxext, ff_);
+ SET_QPEL_FUNCS(avg_h264_qpel, 1, 8, 10_mmxext, ff_);
#endif
- SET_QPEL_FUNCS(put_h264_qpel, 2, 4, 10_mmxext, ff_);
- SET_QPEL_FUNCS(avg_h264_qpel, 2, 4, 10_mmxext, ff_);
-#endif
- }
+ SET_QPEL_FUNCS(put_h264_qpel, 2, 4, 10_mmxext, ff_);
+ SET_QPEL_FUNCS(avg_h264_qpel, 2, 4, 10_mmxext, ff_);
+ }
+ }
- SET_QPEL_FUNCS(put_2tap_qpel, 0, 16, mmx2, );
- SET_QPEL_FUNCS(put_2tap_qpel, 1, 8, mmx2, );
- SET_QPEL_FUNCS(avg_2tap_qpel, 0, 16, mmx2, );
- SET_QPEL_FUNCS(avg_2tap_qpel, 1, 8, mmx2, );
+ if (!high_bit_depth && CONFIG_H264CHROMA) {
+ c->avg_h264_chroma_pixels_tab[0] = ff_avg_h264_chroma_mc8_rnd_mmxext;
+ c->avg_h264_chroma_pixels_tab[1] = ff_avg_h264_chroma_mc4_mmxext;
+ c->avg_h264_chroma_pixels_tab[2] = ff_avg_h264_chroma_mc2_mmxext;
+ c->put_h264_chroma_pixels_tab[2] = ff_put_h264_chroma_mc2_mmxext;
+ }
+ if (bit_depth == 10 && CONFIG_H264CHROMA) {
+ c->put_h264_chroma_pixels_tab[2] = ff_put_h264_chroma_mc2_10_mmxext;
+ c->avg_h264_chroma_pixels_tab[2] = ff_avg_h264_chroma_mc2_10_mmxext;
+ c->put_h264_chroma_pixels_tab[1] = ff_put_h264_chroma_mc4_10_mmxext;
+ c->avg_h264_chroma_pixels_tab[1] = ff_avg_h264_chroma_mc4_10_mmxext;
+ }
-#if HAVE_YASM
- if (!high_bit_depth && CONFIG_H264CHROMA) {
- c->avg_h264_chroma_pixels_tab[0]= ff_avg_h264_chroma_mc8_mmx2_rnd;
- c->avg_h264_chroma_pixels_tab[1]= ff_avg_h264_chroma_mc4_mmx2;
- c->avg_h264_chroma_pixels_tab[2]= ff_avg_h264_chroma_mc2_mmx2;
- c->put_h264_chroma_pixels_tab[2]= ff_put_h264_chroma_mc2_mmx2;
- }
- if (bit_depth == 10 && CONFIG_H264CHROMA) {
- c->put_h264_chroma_pixels_tab[2]= ff_put_h264_chroma_mc2_10_mmxext;
- c->avg_h264_chroma_pixels_tab[2]= ff_avg_h264_chroma_mc2_10_mmxext;
- c->put_h264_chroma_pixels_tab[1]= ff_put_h264_chroma_mc4_10_mmxext;
- c->avg_h264_chroma_pixels_tab[1]= ff_avg_h264_chroma_mc4_10_mmxext;
- }
-
- c->add_hfyu_median_prediction = ff_add_hfyu_median_prediction_mmx2;
-#endif
-#if HAVE_7REGS
- if (HAVE_AMD3DNOW && (mm_flags & AV_CPU_FLAG_3DNOW))
- c->add_hfyu_median_prediction = add_hfyu_median_prediction_cmov;
-#endif
+ /* slower than cmov version on AMD */
+ if (!(mm_flags & AV_CPU_FLAG_3DNOW))
+ c->add_hfyu_median_prediction = ff_add_hfyu_median_prediction_mmxext;
- c->add_png_paeth_prediction= add_png_paeth_prediction_mmx2;
- } else if (HAVE_AMD3DNOW && (mm_flags & AV_CPU_FLAG_3DNOW)) {
- c->prefetch = prefetch_3dnow;
-
- if (!high_bit_depth) {
- c->put_pixels_tab[0][1] = put_pixels16_x2_3dnow;
- c->put_pixels_tab[0][2] = put_pixels16_y2_3dnow;
-
- c->avg_pixels_tab[0][0] = avg_pixels16_3dnow;
- c->avg_pixels_tab[0][1] = avg_pixels16_x2_3dnow;
- c->avg_pixels_tab[0][2] = avg_pixels16_y2_3dnow;
-
- c->put_pixels_tab[1][1] = put_pixels8_x2_3dnow;
- c->put_pixels_tab[1][2] = put_pixels8_y2_3dnow;
-
- c->avg_pixels_tab[1][0] = avg_pixels8_3dnow;
- c->avg_pixels_tab[1][1] = avg_pixels8_x2_3dnow;
- c->avg_pixels_tab[1][2] = avg_pixels8_y2_3dnow;
-
- if(!(avctx->flags & CODEC_FLAG_BITEXACT)){
- c->put_no_rnd_pixels_tab[0][1] = put_no_rnd_pixels16_x2_3dnow;
- c->put_no_rnd_pixels_tab[0][2] = put_no_rnd_pixels16_y2_3dnow;
- c->put_no_rnd_pixels_tab[1][1] = put_no_rnd_pixels8_x2_3dnow;
- c->put_no_rnd_pixels_tab[1][2] = put_no_rnd_pixels8_y2_3dnow;
- c->avg_pixels_tab[0][3] = avg_pixels16_xy2_3dnow;
- c->avg_pixels_tab[1][3] = avg_pixels8_xy2_3dnow;
- }
- }
-
- if (CONFIG_VP3_DECODER
- && (avctx->codec_id == CODEC_ID_VP3 || avctx->codec_id == CODEC_ID_THEORA)) {
- c->put_no_rnd_pixels_tab[1][1] = put_no_rnd_pixels8_x2_exact_3dnow;
- c->put_no_rnd_pixels_tab[1][2] = put_no_rnd_pixels8_y2_exact_3dnow;
- }
-
- SET_QPEL_FUNCS(put_qpel, 0, 16, 3dnow, );
- SET_QPEL_FUNCS(put_qpel, 1, 8, 3dnow, );
- SET_QPEL_FUNCS(put_no_rnd_qpel, 0, 16, 3dnow, );
- SET_QPEL_FUNCS(put_no_rnd_qpel, 1, 8, 3dnow, );
- SET_QPEL_FUNCS(avg_qpel, 0, 16, 3dnow, );
- SET_QPEL_FUNCS(avg_qpel, 1, 8, 3dnow, );
-
- if (!high_bit_depth) {
- SET_QPEL_FUNCS(put_h264_qpel, 0, 16, 3dnow, );
- SET_QPEL_FUNCS(put_h264_qpel, 1, 8, 3dnow, );
- SET_QPEL_FUNCS(put_h264_qpel, 2, 4, 3dnow, );
- SET_QPEL_FUNCS(avg_h264_qpel, 0, 16, 3dnow, );
- SET_QPEL_FUNCS(avg_h264_qpel, 1, 8, 3dnow, );
- SET_QPEL_FUNCS(avg_h264_qpel, 2, 4, 3dnow, );
- }
-
- SET_QPEL_FUNCS(put_2tap_qpel, 0, 16, 3dnow, );
- SET_QPEL_FUNCS(put_2tap_qpel, 1, 8, 3dnow, );
- SET_QPEL_FUNCS(avg_2tap_qpel, 0, 16, 3dnow, );
- SET_QPEL_FUNCS(avg_2tap_qpel, 1, 8, 3dnow, );
+ c->scalarproduct_int16 = ff_scalarproduct_int16_mmxext;
+ c->scalarproduct_and_madd_int16 = ff_scalarproduct_and_madd_int16_mmxext;
-#if HAVE_YASM
- if (!high_bit_depth && CONFIG_H264CHROMA) {
- c->avg_h264_chroma_pixels_tab[0]= ff_avg_h264_chroma_mc8_3dnow_rnd;
- c->avg_h264_chroma_pixels_tab[1]= ff_avg_h264_chroma_mc4_3dnow;
- }
+ if (avctx->flags & CODEC_FLAG_BITEXACT) {
+ c->apply_window_int16 = ff_apply_window_int16_mmxext;
+ } else {
+ c->apply_window_int16 = ff_apply_window_int16_round_mmxext;
+ }
+#endif /* HAVE_MMXEXT_EXTERNAL */
+}
-#endif
- }
+static void dsputil_init_3dnow(DSPContext *c, AVCodecContext *avctx,
+ int mm_flags)
+{
+ const int high_bit_depth = avctx->bits_per_raw_sample > 8;
+#if HAVE_INLINE_ASM
+ if (!high_bit_depth) {
+ c->put_pixels_tab[0][1] = put_pixels16_x2_3dnow;
+ c->put_pixels_tab[0][2] = put_pixels16_y2_3dnow;
-#define H264_QPEL_FUNCS(x, y, CPU)\
- c->put_h264_qpel_pixels_tab[0][x+y*4] = put_h264_qpel16_mc##x##y##_##CPU;\
- c->put_h264_qpel_pixels_tab[1][x+y*4] = put_h264_qpel8_mc##x##y##_##CPU;\
- c->avg_h264_qpel_pixels_tab[0][x+y*4] = avg_h264_qpel16_mc##x##y##_##CPU;\
- c->avg_h264_qpel_pixels_tab[1][x+y*4] = avg_h264_qpel8_mc##x##y##_##CPU;
- if((mm_flags & AV_CPU_FLAG_SSE2) && !(mm_flags & AV_CPU_FLAG_3DNOW)){
- // these functions are slower than mmx on AMD, but faster on Intel
- if (!high_bit_depth) {
- c->put_pixels_tab[0][0] = put_pixels16_sse2;
- c->put_no_rnd_pixels_tab[0][0] = put_pixels16_sse2;
- c->avg_pixels_tab[0][0] = avg_pixels16_sse2;
- H264_QPEL_FUNCS(0, 0, sse2);
- }
- }
- if(mm_flags & AV_CPU_FLAG_SSE2){
- if (!high_bit_depth) {
- H264_QPEL_FUNCS(0, 1, sse2);
- H264_QPEL_FUNCS(0, 2, sse2);
- H264_QPEL_FUNCS(0, 3, sse2);
- H264_QPEL_FUNCS(1, 1, sse2);
- H264_QPEL_FUNCS(1, 2, sse2);
- H264_QPEL_FUNCS(1, 3, sse2);
- H264_QPEL_FUNCS(2, 1, sse2);
- H264_QPEL_FUNCS(2, 2, sse2);
- H264_QPEL_FUNCS(2, 3, sse2);
- H264_QPEL_FUNCS(3, 1, sse2);
- H264_QPEL_FUNCS(3, 2, sse2);
- H264_QPEL_FUNCS(3, 3, sse2);
- }
-#if HAVE_YASM
-#define H264_QPEL_FUNCS_10(x, y, CPU)\
- c->put_h264_qpel_pixels_tab[0][x+y*4] = ff_put_h264_qpel16_mc##x##y##_10_##CPU;\
- c->put_h264_qpel_pixels_tab[1][x+y*4] = ff_put_h264_qpel8_mc##x##y##_10_##CPU;\
- c->avg_h264_qpel_pixels_tab[0][x+y*4] = ff_avg_h264_qpel16_mc##x##y##_10_##CPU;\
- c->avg_h264_qpel_pixels_tab[1][x+y*4] = ff_avg_h264_qpel8_mc##x##y##_10_##CPU;
- if (bit_depth == 10) {
- SET_QPEL_FUNCS(put_h264_qpel, 0, 16, 10_sse2, ff_);
- SET_QPEL_FUNCS(put_h264_qpel, 1, 8, 10_sse2, ff_);
- SET_QPEL_FUNCS(avg_h264_qpel, 0, 16, 10_sse2, ff_);
- SET_QPEL_FUNCS(avg_h264_qpel, 1, 8, 10_sse2, ff_);
- H264_QPEL_FUNCS_10(1, 0, sse2_cache64)
- H264_QPEL_FUNCS_10(2, 0, sse2_cache64)
- H264_QPEL_FUNCS_10(3, 0, sse2_cache64)
-
- if (CONFIG_H264CHROMA) {
- c->put_h264_chroma_pixels_tab[0] = ff_put_h264_chroma_mc8_10_sse2;
- c->avg_h264_chroma_pixels_tab[0] = ff_avg_h264_chroma_mc8_10_sse2;
- }
- }
-#endif
- }
-#if HAVE_SSSE3
- if(mm_flags & AV_CPU_FLAG_SSSE3){
- if (!high_bit_depth) {
- H264_QPEL_FUNCS(1, 0, ssse3);
- H264_QPEL_FUNCS(1, 1, ssse3);
- H264_QPEL_FUNCS(1, 2, ssse3);
- H264_QPEL_FUNCS(1, 3, ssse3);
- H264_QPEL_FUNCS(2, 0, ssse3);
- H264_QPEL_FUNCS(2, 1, ssse3);
- H264_QPEL_FUNCS(2, 2, ssse3);
- H264_QPEL_FUNCS(2, 3, ssse3);
- H264_QPEL_FUNCS(3, 0, ssse3);
- H264_QPEL_FUNCS(3, 1, ssse3);
- H264_QPEL_FUNCS(3, 2, ssse3);
- H264_QPEL_FUNCS(3, 3, ssse3);
- }
-#if HAVE_YASM
- else if (bit_depth == 10) {
- H264_QPEL_FUNCS_10(1, 0, ssse3_cache64)
- H264_QPEL_FUNCS_10(2, 0, ssse3_cache64)
- H264_QPEL_FUNCS_10(3, 0, ssse3_cache64)
- }
-#endif
- c->add_png_paeth_prediction= add_png_paeth_prediction_ssse3;
-#if HAVE_YASM
- if (!high_bit_depth && CONFIG_H264CHROMA) {
- c->put_h264_chroma_pixels_tab[0]= ff_put_h264_chroma_mc8_ssse3_rnd;
- c->avg_h264_chroma_pixels_tab[0]= ff_avg_h264_chroma_mc8_ssse3_rnd;
- c->put_h264_chroma_pixels_tab[1]= ff_put_h264_chroma_mc4_ssse3;
- c->avg_h264_chroma_pixels_tab[1]= ff_avg_h264_chroma_mc4_ssse3;
- }
- c->add_hfyu_left_prediction = ff_add_hfyu_left_prediction_ssse3;
- if (mm_flags & AV_CPU_FLAG_SSE4) // not really sse4, just slow on Conroe
- c->add_hfyu_left_prediction = ff_add_hfyu_left_prediction_sse4;
-#endif
- }
-#endif
+ c->avg_pixels_tab[0][0] = avg_pixels16_3dnow;
+ c->avg_pixels_tab[0][1] = avg_pixels16_x2_3dnow;
+ c->avg_pixels_tab[0][2] = avg_pixels16_y2_3dnow;
- if (HAVE_AMD3DNOW && (mm_flags & AV_CPU_FLAG_3DNOW)) {
- c->vorbis_inverse_coupling = vorbis_inverse_coupling_3dnow;
- c->vector_fmul = vector_fmul_3dnow;
- }
- if (HAVE_AMD3DNOWEXT && (mm_flags & AV_CPU_FLAG_3DNOWEXT)) {
- c->vector_fmul_reverse = vector_fmul_reverse_3dnow2;
-#if HAVE_6REGS
- c->vector_fmul_window = vector_fmul_window_3dnow2;
-#endif
+ c->put_pixels_tab[1][1] = put_pixels8_x2_3dnow;
+ c->put_pixels_tab[1][2] = put_pixels8_y2_3dnow;
+
+ c->avg_pixels_tab[1][0] = avg_pixels8_3dnow;
+ c->avg_pixels_tab[1][1] = avg_pixels8_x2_3dnow;
+ c->avg_pixels_tab[1][2] = avg_pixels8_y2_3dnow;
+
+ if (!(avctx->flags & CODEC_FLAG_BITEXACT)){
+ c->put_no_rnd_pixels_tab[0][1] = put_no_rnd_pixels16_x2_3dnow;
+ c->put_no_rnd_pixels_tab[0][2] = put_no_rnd_pixels16_y2_3dnow;
+ c->put_no_rnd_pixels_tab[1][1] = put_no_rnd_pixels8_x2_3dnow;
+ c->put_no_rnd_pixels_tab[1][2] = put_no_rnd_pixels8_y2_3dnow;
+
+ c->avg_pixels_tab[0][3] = avg_pixels16_xy2_3dnow;
+ c->avg_pixels_tab[1][3] = avg_pixels8_xy2_3dnow;
}
- if(mm_flags & AV_CPU_FLAG_MMX2){
+ }
+
+ if (CONFIG_VP3_DECODER && (avctx->codec_id == AV_CODEC_ID_VP3 ||
+ avctx->codec_id == AV_CODEC_ID_THEORA)) {
+ c->put_no_rnd_pixels_tab[1][1] = put_no_rnd_pixels8_x2_exact_3dnow;
+ c->put_no_rnd_pixels_tab[1][2] = put_no_rnd_pixels8_y2_exact_3dnow;
+ }
+
+ c->vorbis_inverse_coupling = vorbis_inverse_coupling_3dnow;
+#endif /* HAVE_INLINE_ASM */
+
#if HAVE_YASM
- c->scalarproduct_int16 = ff_scalarproduct_int16_mmx2;
- c->scalarproduct_and_madd_int16 = ff_scalarproduct_and_madd_int16_mmx2;
- if (avctx->flags & CODEC_FLAG_BITEXACT) {
- c->apply_window_int16 = ff_apply_window_int16_mmxext_ba;
- } else {
- c->apply_window_int16 = ff_apply_window_int16_mmxext;
- }
+ if (!high_bit_depth && CONFIG_H264CHROMA) {
+ c->avg_h264_chroma_pixels_tab[0] = ff_avg_h264_chroma_mc8_rnd_3dnow;
+ c->avg_h264_chroma_pixels_tab[1] = ff_avg_h264_chroma_mc4_3dnow;
+ }
+#endif /* HAVE_YASM */
+}
+
+static void dsputil_init_3dnowext(DSPContext *c, AVCodecContext *avctx,
+ int mm_flags)
+{
+#if HAVE_AMD3DNOWEXT_INLINE && HAVE_6REGS
+ c->vector_fmul_window = vector_fmul_window_3dnowext;
#endif
+}
+
+static void dsputil_init_sse(DSPContext *c, AVCodecContext *avctx, int mm_flags)
+{
+ const int high_bit_depth = avctx->bits_per_raw_sample > 8;
+
+#if HAVE_INLINE_ASM
+ if (!high_bit_depth) {
+ if (!(CONFIG_MPEG_XVMC_DECODER && avctx->xvmc_acceleration > 1)) {
+ /* XvMCCreateBlocks() may not allocate 16-byte aligned blocks */
+ c->clear_block = clear_block_sse;
+ c->clear_blocks = clear_blocks_sse;
}
- if(mm_flags & AV_CPU_FLAG_SSE){
- c->vorbis_inverse_coupling = vorbis_inverse_coupling_sse;
- c->ac3_downmix = ac3_downmix_sse;
- c->vector_fmul = vector_fmul_sse;
- c->vector_fmul_reverse = vector_fmul_reverse_sse;
- c->vector_fmul_add = vector_fmul_add_sse;
+ }
+
+ c->vorbis_inverse_coupling = vorbis_inverse_coupling_sse;
+
#if HAVE_6REGS
- c->vector_fmul_window = vector_fmul_window_sse;
+ c->vector_fmul_window = vector_fmul_window_sse;
#endif
- c->vector_clipf = vector_clipf_sse;
+
+ c->vector_clipf = vector_clipf_sse;
+#endif /* HAVE_INLINE_ASM */
+
#if HAVE_YASM
- c->scalarproduct_float = ff_scalarproduct_float_sse;
- c->butterflies_float_interleave = ff_butterflies_float_interleave_sse;
+ c->vector_fmul_reverse = ff_vector_fmul_reverse_sse;
+ c->vector_fmul_add = ff_vector_fmul_add_sse;
- if (!high_bit_depth)
- c->emulated_edge_mc = emulated_edge_mc_sse;
- c->gmc = gmc_sse;
-#endif
+ c->scalarproduct_float = ff_scalarproduct_float_sse;
+ c->butterflies_float_interleave = ff_butterflies_float_interleave_sse;
+#endif /* HAVE_YASM */
+}
+
+static void dsputil_init_sse2(DSPContext *c, AVCodecContext *avctx,
+ int mm_flags)
+{
+ const int bit_depth = avctx->bits_per_raw_sample;
+ const int high_bit_depth = bit_depth > 8;
+
+#if HAVE_SSE2_INLINE
+ if (!high_bit_depth && avctx->idct_algo == FF_IDCT_XVIDMMX) {
+ c->idct_put = ff_idct_xvid_sse2_put;
+ c->idct_add = ff_idct_xvid_sse2_add;
+ c->idct = ff_idct_xvid_sse2;
+ c->idct_permutation_type = FF_SSE2_IDCT_PERM;
+ }
+#endif /* HAVE_SSE2_INLINE */
+
+#if HAVE_SSE2_EXTERNAL
+ if (!(mm_flags & AV_CPU_FLAG_SSE2SLOW)) {
+ // these functions are slower than mmx on AMD, but faster on Intel
+ if (!high_bit_depth) {
+ c->put_pixels_tab[0][0] = ff_put_pixels16_sse2;
+ c->put_no_rnd_pixels_tab[0][0] = ff_put_pixels16_sse2;
+ c->avg_pixels_tab[0][0] = ff_avg_pixels16_sse2;
+ if (CONFIG_H264QPEL)
+ H264_QPEL_FUNCS(0, 0, sse2);
}
- if (HAVE_AMD3DNOW && (mm_flags & AV_CPU_FLAG_3DNOW))
- c->vector_fmul_add = vector_fmul_add_3dnow; // faster than sse
- if(mm_flags & AV_CPU_FLAG_SSE2){
-#if HAVE_YASM
- c->scalarproduct_int16 = ff_scalarproduct_int16_sse2;
- c->scalarproduct_and_madd_int16 = ff_scalarproduct_and_madd_int16_sse2;
- if (mm_flags & AV_CPU_FLAG_ATOM) {
- c->vector_clip_int32 = ff_vector_clip_int32_int_sse2;
- } else {
- c->vector_clip_int32 = ff_vector_clip_int32_sse2;
- }
- if (avctx->flags & CODEC_FLAG_BITEXACT) {
- c->apply_window_int16 = ff_apply_window_int16_sse2_ba;
- } else {
- if (!(mm_flags & AV_CPU_FLAG_SSE2SLOW)) {
- c->apply_window_int16 = ff_apply_window_int16_sse2;
- }
- }
-#endif
+ }
+
+ if (!high_bit_depth && CONFIG_H264QPEL) {
+ H264_QPEL_FUNCS(0, 1, sse2);
+ H264_QPEL_FUNCS(0, 2, sse2);
+ H264_QPEL_FUNCS(0, 3, sse2);
+ H264_QPEL_FUNCS(1, 1, sse2);
+ H264_QPEL_FUNCS(1, 2, sse2);
+ H264_QPEL_FUNCS(1, 3, sse2);
+ H264_QPEL_FUNCS(2, 1, sse2);
+ H264_QPEL_FUNCS(2, 2, sse2);
+ H264_QPEL_FUNCS(2, 3, sse2);
+ H264_QPEL_FUNCS(3, 1, sse2);
+ H264_QPEL_FUNCS(3, 2, sse2);
+ H264_QPEL_FUNCS(3, 3, sse2);
+ }
+
+ if (bit_depth == 10) {
+ if (CONFIG_H264QPEL) {
+ SET_QPEL_FUNCS(put_h264_qpel, 0, 16, 10_sse2, ff_);
+ SET_QPEL_FUNCS(put_h264_qpel, 1, 8, 10_sse2, ff_);
+ SET_QPEL_FUNCS(avg_h264_qpel, 0, 16, 10_sse2, ff_);
+ SET_QPEL_FUNCS(avg_h264_qpel, 1, 8, 10_sse2, ff_);
+ H264_QPEL_FUNCS_10(1, 0, sse2_cache64);
+ H264_QPEL_FUNCS_10(2, 0, sse2_cache64);
+ H264_QPEL_FUNCS_10(3, 0, sse2_cache64);
}
- if (mm_flags & AV_CPU_FLAG_SSSE3) {
-#if HAVE_YASM
- if (mm_flags & AV_CPU_FLAG_ATOM) {
- c->apply_window_int16 = ff_apply_window_int16_ssse3_atom;
- } else {
- c->apply_window_int16 = ff_apply_window_int16_ssse3;
- }
- if (!(mm_flags & (AV_CPU_FLAG_SSE42|AV_CPU_FLAG_3DNOW))) { // cachesplit
- c->scalarproduct_and_madd_int16 = ff_scalarproduct_and_madd_int16_ssse3;
- }
-#endif
+ if (CONFIG_H264CHROMA) {
+ c->put_h264_chroma_pixels_tab[0] = ff_put_h264_chroma_mc8_10_sse2;
+ c->avg_h264_chroma_pixels_tab[0] = ff_avg_h264_chroma_mc8_10_sse2;
}
+ }
- if (mm_flags & AV_CPU_FLAG_SSE4 && HAVE_SSE) {
-#if HAVE_YASM
- c->vector_clip_int32 = ff_vector_clip_int32_sse4;
-#endif
+ c->scalarproduct_int16 = ff_scalarproduct_int16_sse2;
+ c->scalarproduct_and_madd_int16 = ff_scalarproduct_and_madd_int16_sse2;
+ if (mm_flags & AV_CPU_FLAG_ATOM) {
+ c->vector_clip_int32 = ff_vector_clip_int32_int_sse2;
+ } else {
+ c->vector_clip_int32 = ff_vector_clip_int32_sse2;
+ }
+ if (avctx->flags & CODEC_FLAG_BITEXACT) {
+ c->apply_window_int16 = ff_apply_window_int16_sse2;
+ } else if (!(mm_flags & AV_CPU_FLAG_SSE2SLOW)) {
+ c->apply_window_int16 = ff_apply_window_int16_round_sse2;
+ }
+ c->bswap_buf = ff_bswap32_buf_sse2;
+#endif /* HAVE_SSE2_EXTERNAL */
+}
+
+static void dsputil_init_ssse3(DSPContext *c, AVCodecContext *avctx,
+ int mm_flags)
+{
+#if HAVE_SSSE3_EXTERNAL
+ const int high_bit_depth = avctx->bits_per_raw_sample > 8;
+ const int bit_depth = avctx->bits_per_raw_sample;
+
+ if (!high_bit_depth && CONFIG_H264QPEL) {
+ H264_QPEL_FUNCS(1, 0, ssse3);
+ H264_QPEL_FUNCS(1, 1, ssse3);
+ H264_QPEL_FUNCS(1, 2, ssse3);
+ H264_QPEL_FUNCS(1, 3, ssse3);
+ H264_QPEL_FUNCS(2, 0, ssse3);
+ H264_QPEL_FUNCS(2, 1, ssse3);
+ H264_QPEL_FUNCS(2, 2, ssse3);
+ H264_QPEL_FUNCS(2, 3, ssse3);
+ H264_QPEL_FUNCS(3, 0, ssse3);
+ H264_QPEL_FUNCS(3, 1, ssse3);
+ H264_QPEL_FUNCS(3, 2, ssse3);
+ H264_QPEL_FUNCS(3, 3, ssse3);
+ }
+ if (bit_depth == 10 && CONFIG_H264QPEL) {
+ H264_QPEL_FUNCS_10(1, 0, ssse3_cache64);
+ H264_QPEL_FUNCS_10(2, 0, ssse3_cache64);
+ H264_QPEL_FUNCS_10(3, 0, ssse3_cache64);
+ }
+ if (!high_bit_depth && CONFIG_H264CHROMA) {
+ c->put_h264_chroma_pixels_tab[0] = ff_put_h264_chroma_mc8_rnd_ssse3;
+ c->avg_h264_chroma_pixels_tab[0] = ff_avg_h264_chroma_mc8_rnd_ssse3;
+ c->put_h264_chroma_pixels_tab[1] = ff_put_h264_chroma_mc4_ssse3;
+ c->avg_h264_chroma_pixels_tab[1] = ff_avg_h264_chroma_mc4_ssse3;
+ }
+ c->add_hfyu_left_prediction = ff_add_hfyu_left_prediction_ssse3;
+ if (mm_flags & AV_CPU_FLAG_SSE4) // not really sse4, just slow on Conroe
+ c->add_hfyu_left_prediction = ff_add_hfyu_left_prediction_sse4;
+
+ if (mm_flags & AV_CPU_FLAG_ATOM)
+ c->apply_window_int16 = ff_apply_window_int16_ssse3_atom;
+ else
+ c->apply_window_int16 = ff_apply_window_int16_ssse3;
+ if (!(mm_flags & (AV_CPU_FLAG_SSE42|AV_CPU_FLAG_3DNOW))) // cachesplit
+ c->scalarproduct_and_madd_int16 = ff_scalarproduct_and_madd_int16_ssse3;
+ c->bswap_buf = ff_bswap32_buf_ssse3;
+#endif /* HAVE_SSSE3_EXTERNAL */
+}
+
+static void dsputil_init_sse4(DSPContext *c, AVCodecContext *avctx,
+ int mm_flags)
+{
+#if HAVE_SSE4_EXTERNAL
+ c->vector_clip_int32 = ff_vector_clip_int32_sse4;
+#endif /* HAVE_SSE4_EXTERNAL */
+}
+
+static void dsputil_init_avx(DSPContext *c, AVCodecContext *avctx, int mm_flags)
+{
+#if HAVE_AVX_EXTERNAL
+ const int bit_depth = avctx->bits_per_raw_sample;
+
+ if (bit_depth == 10) {
+ // AVX implies !cache64.
+ // TODO: Port cache(32|64) detection from x264.
+ if (CONFIG_H264QPEL) {
+ H264_QPEL_FUNCS_10(1, 0, sse2);
+ H264_QPEL_FUNCS_10(2, 0, sse2);
+ H264_QPEL_FUNCS_10(3, 0, sse2);
}
-#if HAVE_AVX && HAVE_YASM
- if (mm_flags & AV_CPU_FLAG_AVX) {
- if (bit_depth == 10) {
- //AVX implies !cache64.
- //TODO: Port cache(32|64) detection from x264.
- H264_QPEL_FUNCS_10(1, 0, sse2)
- H264_QPEL_FUNCS_10(2, 0, sse2)
- H264_QPEL_FUNCS_10(3, 0, sse2)
-
- if (CONFIG_H264CHROMA) {
- c->put_h264_chroma_pixels_tab[0] = ff_put_h264_chroma_mc8_10_avx;
- c->avg_h264_chroma_pixels_tab[0] = ff_avg_h264_chroma_mc8_10_avx;
- }
- }
- c->butterflies_float_interleave = ff_butterflies_float_interleave_avx;
+ if (CONFIG_H264CHROMA) {
+ c->put_h264_chroma_pixels_tab[0] = ff_put_h264_chroma_mc8_10_avx;
+ c->avg_h264_chroma_pixels_tab[0] = ff_avg_h264_chroma_mc8_10_avx;
}
-#endif
}
+ c->butterflies_float_interleave = ff_butterflies_float_interleave_avx;
+ c->vector_fmul_reverse = ff_vector_fmul_reverse_avx;
+ c->vector_fmul_add = ff_vector_fmul_add_avx;
+#endif /* HAVE_AVX_EXTERNAL */
+}
+
+void ff_dsputil_init_mmx(DSPContext *c, AVCodecContext *avctx)
+{
+ int mm_flags = av_get_cpu_flags();
+
+#if HAVE_7REGS && HAVE_INLINE_ASM
+ if (mm_flags & AV_CPU_FLAG_CMOV)
+ c->add_hfyu_median_prediction = add_hfyu_median_prediction_cmov;
+#endif
+
+ if (mm_flags & AV_CPU_FLAG_MMX)
+ dsputil_init_mmx(c, avctx, mm_flags);
+
+ if (mm_flags & AV_CPU_FLAG_MMXEXT)
+ dsputil_init_mmxext(c, avctx, mm_flags);
+
+ if (mm_flags & AV_CPU_FLAG_3DNOW)
+ dsputil_init_3dnow(c, avctx, mm_flags);
+
+ if (mm_flags & AV_CPU_FLAG_3DNOWEXT)
+ dsputil_init_3dnowext(c, avctx, mm_flags);
+
+ if (mm_flags & AV_CPU_FLAG_SSE)
+ dsputil_init_sse(c, avctx, mm_flags);
+
+ if (mm_flags & AV_CPU_FLAG_SSE2)
+ dsputil_init_sse2(c, avctx, mm_flags);
+
+ if (mm_flags & AV_CPU_FLAG_SSSE3)
+ dsputil_init_ssse3(c, avctx, mm_flags);
+
+ if (mm_flags & AV_CPU_FLAG_SSE4)
+ dsputil_init_sse4(c, avctx, mm_flags);
+
+ if (mm_flags & AV_CPU_FLAG_AVX)
+ dsputil_init_avx(c, avctx, mm_flags);
if (CONFIG_ENCODERS)
- dsputilenc_init_mmx(c, avctx);
+ ff_dsputilenc_init_mmx(c, avctx);
}
diff --git a/gst-libs/ext/libav/libavcodec/x86/dsputil_mmx.h b/gst-libs/ext/libav/libavcodec/x86/dsputil_mmx.h
index 7ab55e7..a142406 100644
--- a/gst-libs/ext/libav/libavcodec/x86/dsputil_mmx.h
+++ b/gst-libs/ext/libav/libavcodec/x86/dsputil_mmx.h
@@ -24,9 +24,9 @@
#include <stdint.h>
#include "libavcodec/dsputil.h"
-#include "libavutil/x86_cpu.h"
+#include "libavutil/x86/asm.h"
-typedef struct { uint64_t a, b; } xmm_reg;
+typedef struct xmm_reg { uint64_t a, b; } xmm_reg;
extern const uint64_t ff_bone;
extern const uint64_t ff_wtwo;
@@ -66,24 +66,6 @@ extern const xmm_reg ff_pb_FE;
extern const double ff_pd_1[2];
extern const double ff_pd_2[2];
-#define LOAD4(stride,in,a,b,c,d)\
- "movq 0*"#stride"+"#in", "#a"\n\t"\
- "movq 1*"#stride"+"#in", "#b"\n\t"\
- "movq 2*"#stride"+"#in", "#c"\n\t"\
- "movq 3*"#stride"+"#in", "#d"\n\t"
-
-#define STORE4(stride,out,a,b,c,d)\
- "movq "#a", 0*"#stride"+"#out"\n\t"\
- "movq "#b", 1*"#stride"+"#out"\n\t"\
- "movq "#c", 2*"#stride"+"#out"\n\t"\
- "movq "#d", 3*"#stride"+"#out"\n\t"
-
-/* in/out: mma=mma+mmb, mmb=mmb-mma */
-#define SUMSUB_BA( a, b ) \
- "paddw "#b", "#a" \n\t"\
- "paddw "#b", "#b" \n\t"\
- "psubw "#a", "#b" \n\t"
-
#define SBUTTERFLY(a,b,t,n,m)\
"mov" #m " " #a ", " #t " \n\t" /* abcd */\
"punpckl" #n " " #b ", " #a " \n\t" /* aebf */\
@@ -95,113 +77,30 @@ extern const double ff_pd_2[2];
SBUTTERFLY(a,c,d,dq,q) /* a=aeim d=bfjn */\
SBUTTERFLY(t,b,c,dq,q) /* t=cgko c=dhlp */
-static inline void transpose4x4(uint8_t *dst, uint8_t *src, x86_reg dst_stride, x86_reg src_stride){
- __asm__ volatile( //FIXME could save 1 instruction if done as 8x4 ...
- "movd (%1), %%mm0 \n\t"
- "add %3, %1 \n\t"
- "movd (%1), %%mm1 \n\t"
- "movd (%1,%3,1), %%mm2 \n\t"
- "movd (%1,%3,2), %%mm3 \n\t"
- "punpcklbw %%mm1, %%mm0 \n\t"
- "punpcklbw %%mm3, %%mm2 \n\t"
- "movq %%mm0, %%mm1 \n\t"
- "punpcklwd %%mm2, %%mm0 \n\t"
- "punpckhwd %%mm2, %%mm1 \n\t"
- "movd %%mm0, (%0) \n\t"
- "add %2, %0 \n\t"
- "punpckhdq %%mm0, %%mm0 \n\t"
- "movd %%mm0, (%0) \n\t"
- "movd %%mm1, (%0,%2,1) \n\t"
- "punpckhdq %%mm1, %%mm1 \n\t"
- "movd %%mm1, (%0,%2,2) \n\t"
-
- : "+&r" (dst),
- "+&r" (src)
- : "r" (dst_stride),
- "r" (src_stride)
- : "memory"
- );
-}
-
-// e,f,g,h can be memory
-// out: a,d,t,c
-#define TRANSPOSE8x4(a,b,c,d,e,f,g,h,t)\
- "punpcklbw " #e ", " #a " \n\t" /* a0 e0 a1 e1 a2 e2 a3 e3 */\
- "punpcklbw " #f ", " #b " \n\t" /* b0 f0 b1 f1 b2 f2 b3 f3 */\
- "punpcklbw " #g ", " #c " \n\t" /* c0 g0 c1 g1 c2 g2 d3 g3 */\
- "punpcklbw " #h ", " #d " \n\t" /* d0 h0 d1 h1 d2 h2 d3 h3 */\
- SBUTTERFLY(a, b, t, bw, q) /* a= a0 b0 e0 f0 a1 b1 e1 f1 */\
- /* t= a2 b2 e2 f2 a3 b3 e3 f3 */\
- SBUTTERFLY(c, d, b, bw, q) /* c= c0 d0 g0 h0 c1 d1 g1 h1 */\
- /* b= c2 d2 g2 h2 c3 d3 g3 h3 */\
- SBUTTERFLY(a, c, d, wd, q) /* a= a0 b0 c0 d0 e0 f0 g0 h0 */\
- /* d= a1 b1 c1 d1 e1 f1 g1 h1 */\
- SBUTTERFLY(t, b, c, wd, q) /* t= a2 b2 c2 d2 e2 f2 g2 h2 */\
- /* c= a3 b3 c3 d3 e3 f3 g3 h3 */
-
-#if ARCH_X86_64
-// permutes 01234567 -> 05736421
-#define TRANSPOSE8(a,b,c,d,e,f,g,h,t)\
- SBUTTERFLY(a,b,%%xmm8,wd,dqa)\
- SBUTTERFLY(c,d,b,wd,dqa)\
- SBUTTERFLY(e,f,d,wd,dqa)\
- SBUTTERFLY(g,h,f,wd,dqa)\
- SBUTTERFLY(a,c,h,dq,dqa)\
- SBUTTERFLY(%%xmm8,b,c,dq,dqa)\
- SBUTTERFLY(e,g,b,dq,dqa)\
- SBUTTERFLY(d,f,g,dq,dqa)\
- SBUTTERFLY(a,e,f,qdq,dqa)\
- SBUTTERFLY(%%xmm8,d,e,qdq,dqa)\
- SBUTTERFLY(h,b,d,qdq,dqa)\
- SBUTTERFLY(c,g,b,qdq,dqa)\
- "movdqa %%xmm8, "#g" \n\t"
-#else
-#define TRANSPOSE8(a,b,c,d,e,f,g,h,t)\
- "movdqa "#h", "#t" \n\t"\
- SBUTTERFLY(a,b,h,wd,dqa)\
- "movdqa "#h", 16"#t" \n\t"\
- "movdqa "#t", "#h" \n\t"\
- SBUTTERFLY(c,d,b,wd,dqa)\
- SBUTTERFLY(e,f,d,wd,dqa)\
- SBUTTERFLY(g,h,f,wd,dqa)\
- SBUTTERFLY(a,c,h,dq,dqa)\
- "movdqa "#h", "#t" \n\t"\
- "movdqa 16"#t", "#h" \n\t"\
- SBUTTERFLY(h,b,c,dq,dqa)\
- SBUTTERFLY(e,g,b,dq,dqa)\
- SBUTTERFLY(d,f,g,dq,dqa)\
- SBUTTERFLY(a,e,f,qdq,dqa)\
- SBUTTERFLY(h,d,e,qdq,dqa)\
- "movdqa "#h", 16"#t" \n\t"\
- "movdqa "#t", "#h" \n\t"\
- SBUTTERFLY(h,b,d,qdq,dqa)\
- SBUTTERFLY(c,g,b,qdq,dqa)\
- "movdqa 16"#t", "#g" \n\t"
-#endif
-
#define MOVQ_WONE(regd) \
__asm__ volatile ( \
"pcmpeqd %%" #regd ", %%" #regd " \n\t" \
"psrlw $15, %%" #regd ::)
-void dsputilenc_init_mmx(DSPContext* c, AVCodecContext *avctx);
-void dsputil_init_pix_mmx(DSPContext* c, AVCodecContext *avctx);
+void ff_dsputilenc_init_mmx(DSPContext* c, AVCodecContext *avctx);
+void ff_dsputil_init_pix_mmx(DSPContext* c, AVCodecContext *avctx);
void ff_add_pixels_clamped_mmx(const DCTELEM *block, uint8_t *pixels, int line_size);
void ff_put_pixels_clamped_mmx(const DCTELEM *block, uint8_t *pixels, int line_size);
void ff_put_signed_pixels_clamped_mmx(const DCTELEM *block, uint8_t *pixels, int line_size);
-void ff_put_cavs_qpel8_mc00_mmx2(uint8_t *dst, uint8_t *src, int stride);
-void ff_avg_cavs_qpel8_mc00_mmx2(uint8_t *dst, uint8_t *src, int stride);
-void ff_put_cavs_qpel16_mc00_mmx2(uint8_t *dst, uint8_t *src, int stride);
-void ff_avg_cavs_qpel16_mc00_mmx2(uint8_t *dst, uint8_t *src, int stride);
+void ff_put_cavs_qpel8_mc00_mmxext(uint8_t *dst, uint8_t *src, int stride);
+void ff_avg_cavs_qpel8_mc00_mmxext(uint8_t *dst, uint8_t *src, int stride);
+void ff_put_cavs_qpel16_mc00_mmxext(uint8_t *dst, uint8_t *src, int stride);
+void ff_avg_cavs_qpel16_mc00_mmxext(uint8_t *dst, uint8_t *src, int stride);
void ff_put_vc1_mspel_mc00_mmx(uint8_t *dst, const uint8_t *src, int stride, int rnd);
-void ff_avg_vc1_mspel_mc00_mmx2(uint8_t *dst, const uint8_t *src, int stride, int rnd);
-
-void ff_mmx_idct(DCTELEM *block);
-void ff_mmxext_idct(DCTELEM *block);
+void ff_avg_vc1_mspel_mc00_mmxext(uint8_t *dst, const uint8_t *src, int stride, int rnd);
+void ff_put_rv40_qpel8_mc33_mmx(uint8_t *block, uint8_t *pixels, int line_size);
+void ff_put_rv40_qpel16_mc33_mmx(uint8_t *block, uint8_t *pixels, int line_size);
+void ff_avg_rv40_qpel8_mc33_mmx(uint8_t *block, uint8_t *pixels, int line_size);
+void ff_avg_rv40_qpel16_mc33_mmx(uint8_t *block, uint8_t *pixels, int line_size);
void ff_deinterlace_line_mmx(uint8_t *dst,
const uint8_t *lum_m4, const uint8_t *lum_m3,
diff --git a/gst-libs/ext/libav/libavcodec/x86/dsputil_mmx_avg_template.c b/gst-libs/ext/libav/libavcodec/x86/dsputil_mmx_avg_template.c
deleted file mode 100644
index 8b116b7..0000000
--- a/gst-libs/ext/libav/libavcodec/x86/dsputil_mmx_avg_template.c
+++ /dev/null
@@ -1,977 +0,0 @@
-/*
- * DSP utils : average functions are compiled twice for 3dnow/mmx2
- * Copyright (c) 2000, 2001 Fabrice Bellard
- * Copyright (c) 2002-2004 Michael Niedermayer
- *
- * MMX optimization by Nick Kurshev <nickols_k@mail.ru>
- * mostly rewritten by Michael Niedermayer <michaelni@gmx.at>
- * and improved by Zdenek Kabelac <kabi@users.sf.net>
- *
- * 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
- */
-
-/* XXX: we use explicit registers to avoid a gcc 2.95.2 register asm
- clobber bug - now it will work with 2.95.2 and also with -fPIC
- */
-static void DEF(put_pixels8_x2)(uint8_t *block, const uint8_t *pixels, int line_size, int h)
-{
- __asm__ volatile(
- "lea (%3, %3), %%"REG_a" \n\t"
- "1: \n\t"
- "movq (%1), %%mm0 \n\t"
- "movq (%1, %3), %%mm1 \n\t"
- PAVGB" 1(%1), %%mm0 \n\t"
- PAVGB" 1(%1, %3), %%mm1 \n\t"
- "movq %%mm0, (%2) \n\t"
- "movq %%mm1, (%2, %3) \n\t"
- "add %%"REG_a", %1 \n\t"
- "add %%"REG_a", %2 \n\t"
- "movq (%1), %%mm0 \n\t"
- "movq (%1, %3), %%mm1 \n\t"
- PAVGB" 1(%1), %%mm0 \n\t"
- PAVGB" 1(%1, %3), %%mm1 \n\t"
- "add %%"REG_a", %1 \n\t"
- "movq %%mm0, (%2) \n\t"
- "movq %%mm1, (%2, %3) \n\t"
- "add %%"REG_a", %2 \n\t"
- "subl $4, %0 \n\t"
- "jnz 1b \n\t"
- :"+g"(h), "+S"(pixels), "+D"(block)
- :"r" ((x86_reg)line_size)
- :"%"REG_a, "memory");
-}
-
-static void DEF(put_pixels4_l2)(uint8_t *dst, uint8_t *src1, uint8_t *src2, int dstStride, int src1Stride, int h)
-{
- __asm__ volatile(
- "testl $1, %0 \n\t"
- " jz 1f \n\t"
- "movd (%1), %%mm0 \n\t"
- "movd (%2), %%mm1 \n\t"
- "add %4, %1 \n\t"
- "add $4, %2 \n\t"
- PAVGB" %%mm1, %%mm0 \n\t"
- "movd %%mm0, (%3) \n\t"
- "add %5, %3 \n\t"
- "decl %0 \n\t"
- "1: \n\t"
- "movd (%1), %%mm0 \n\t"
- "add %4, %1 \n\t"
- "movd (%1), %%mm1 \n\t"
- "movd (%2), %%mm2 \n\t"
- "movd 4(%2), %%mm3 \n\t"
- "add %4, %1 \n\t"
- PAVGB" %%mm2, %%mm0 \n\t"
- PAVGB" %%mm3, %%mm1 \n\t"
- "movd %%mm0, (%3) \n\t"
- "add %5, %3 \n\t"
- "movd %%mm1, (%3) \n\t"
- "add %5, %3 \n\t"
- "movd (%1), %%mm0 \n\t"
- "add %4, %1 \n\t"
- "movd (%1), %%mm1 \n\t"
- "movd 8(%2), %%mm2 \n\t"
- "movd 12(%2), %%mm3 \n\t"
- "add %4, %1 \n\t"
- PAVGB" %%mm2, %%mm0 \n\t"
- PAVGB" %%mm3, %%mm1 \n\t"
- "movd %%mm0, (%3) \n\t"
- "add %5, %3 \n\t"
- "movd %%mm1, (%3) \n\t"
- "add %5, %3 \n\t"
- "add $16, %2 \n\t"
- "subl $4, %0 \n\t"
- "jnz 1b \n\t"
-#if !HAVE_EBX_AVAILABLE //Note "+bm" and "+mb" are buggy too (with gcc 3.2.2 at least) and cannot be used
- :"+m"(h), "+a"(src1), "+c"(src2), "+d"(dst)
-#else
- :"+b"(h), "+a"(src1), "+c"(src2), "+d"(dst)
-#endif
- :"S"((x86_reg)src1Stride), "D"((x86_reg)dstStride)
- :"memory");
-}
-
-
-static void DEF(put_pixels8_l2)(uint8_t *dst, uint8_t *src1, uint8_t *src2, int dstStride, int src1Stride, int h)
-{
- __asm__ volatile(
- "testl $1, %0 \n\t"
- " jz 1f \n\t"
- "movq (%1), %%mm0 \n\t"
- "movq (%2), %%mm1 \n\t"
- "add %4, %1 \n\t"
- "add $8, %2 \n\t"
- PAVGB" %%mm1, %%mm0 \n\t"
- "movq %%mm0, (%3) \n\t"
- "add %5, %3 \n\t"
- "decl %0 \n\t"
- "1: \n\t"
- "movq (%1), %%mm0 \n\t"
- "add %4, %1 \n\t"
- "movq (%1), %%mm1 \n\t"
- "add %4, %1 \n\t"
- PAVGB" (%2), %%mm0 \n\t"
- PAVGB" 8(%2), %%mm1 \n\t"
- "movq %%mm0, (%3) \n\t"
- "add %5, %3 \n\t"
- "movq %%mm1, (%3) \n\t"
- "add %5, %3 \n\t"
- "movq (%1), %%mm0 \n\t"
- "add %4, %1 \n\t"
- "movq (%1), %%mm1 \n\t"
- "add %4, %1 \n\t"
- PAVGB" 16(%2), %%mm0 \n\t"
- PAVGB" 24(%2), %%mm1 \n\t"
- "movq %%mm0, (%3) \n\t"
- "add %5, %3 \n\t"
- "movq %%mm1, (%3) \n\t"
- "add %5, %3 \n\t"
- "add $32, %2 \n\t"
- "subl $4, %0 \n\t"
- "jnz 1b \n\t"
-#if !HAVE_EBX_AVAILABLE //Note "+bm" and "+mb" are buggy too (with gcc 3.2.2 at least) and cannot be used
- :"+m"(h), "+a"(src1), "+c"(src2), "+d"(dst)
-#else
- :"+b"(h), "+a"(src1), "+c"(src2), "+d"(dst)
-#endif
- :"S"((x86_reg)src1Stride), "D"((x86_reg)dstStride)
- :"memory");
-//the following should be used, though better not with gcc ...
-/* :"+g"(h), "+r"(src1), "+r"(src2), "+r"(dst)
- :"r"(src1Stride), "r"(dstStride)
- :"memory");*/
-}
-
-static void DEF(put_no_rnd_pixels8_l2)(uint8_t *dst, uint8_t *src1, uint8_t *src2, int dstStride, int src1Stride, int h)
-{
- __asm__ volatile(
- "pcmpeqb %%mm6, %%mm6 \n\t"
- "testl $1, %0 \n\t"
- " jz 1f \n\t"
- "movq (%1), %%mm0 \n\t"
- "movq (%2), %%mm1 \n\t"
- "add %4, %1 \n\t"
- "add $8, %2 \n\t"
- "pxor %%mm6, %%mm0 \n\t"
- "pxor %%mm6, %%mm1 \n\t"
- PAVGB" %%mm1, %%mm0 \n\t"
- "pxor %%mm6, %%mm0 \n\t"
- "movq %%mm0, (%3) \n\t"
- "add %5, %3 \n\t"
- "decl %0 \n\t"
- "1: \n\t"
- "movq (%1), %%mm0 \n\t"
- "add %4, %1 \n\t"
- "movq (%1), %%mm1 \n\t"
- "add %4, %1 \n\t"
- "movq (%2), %%mm2 \n\t"
- "movq 8(%2), %%mm3 \n\t"
- "pxor %%mm6, %%mm0 \n\t"
- "pxor %%mm6, %%mm1 \n\t"
- "pxor %%mm6, %%mm2 \n\t"
- "pxor %%mm6, %%mm3 \n\t"
- PAVGB" %%mm2, %%mm0 \n\t"
- PAVGB" %%mm3, %%mm1 \n\t"
- "pxor %%mm6, %%mm0 \n\t"
- "pxor %%mm6, %%mm1 \n\t"
- "movq %%mm0, (%3) \n\t"
- "add %5, %3 \n\t"
- "movq %%mm1, (%3) \n\t"
- "add %5, %3 \n\t"
- "movq (%1), %%mm0 \n\t"
- "add %4, %1 \n\t"
- "movq (%1), %%mm1 \n\t"
- "add %4, %1 \n\t"
- "movq 16(%2), %%mm2 \n\t"
- "movq 24(%2), %%mm3 \n\t"
- "pxor %%mm6, %%mm0 \n\t"
- "pxor %%mm6, %%mm1 \n\t"
- "pxor %%mm6, %%mm2 \n\t"
- "pxor %%mm6, %%mm3 \n\t"
- PAVGB" %%mm2, %%mm0 \n\t"
- PAVGB" %%mm3, %%mm1 \n\t"
- "pxor %%mm6, %%mm0 \n\t"
- "pxor %%mm6, %%mm1 \n\t"
- "movq %%mm0, (%3) \n\t"
- "add %5, %3 \n\t"
- "movq %%mm1, (%3) \n\t"
- "add %5, %3 \n\t"
- "add $32, %2 \n\t"
- "subl $4, %0 \n\t"
- "jnz 1b \n\t"
-#if !HAVE_EBX_AVAILABLE //Note "+bm" and "+mb" are buggy too (with gcc 3.2.2 at least) and cannot be used
- :"+m"(h), "+a"(src1), "+c"(src2), "+d"(dst)
-#else
- :"+b"(h), "+a"(src1), "+c"(src2), "+d"(dst)
-#endif
- :"S"((x86_reg)src1Stride), "D"((x86_reg)dstStride)
- :"memory");
-//the following should be used, though better not with gcc ...
-/* :"+g"(h), "+r"(src1), "+r"(src2), "+r"(dst)
- :"r"(src1Stride), "r"(dstStride)
- :"memory");*/
-}
-
-static void DEF(avg_pixels4_l2)(uint8_t *dst, uint8_t *src1, uint8_t *src2, int dstStride, int src1Stride, int h)
-{
- __asm__ volatile(
- "testl $1, %0 \n\t"
- " jz 1f \n\t"
- "movd (%1), %%mm0 \n\t"
- "movd (%2), %%mm1 \n\t"
- "add %4, %1 \n\t"
- "add $4, %2 \n\t"
- PAVGB" %%mm1, %%mm0 \n\t"
- PAVGB" (%3), %%mm0 \n\t"
- "movd %%mm0, (%3) \n\t"
- "add %5, %3 \n\t"
- "decl %0 \n\t"
- "1: \n\t"
- "movd (%1), %%mm0 \n\t"
- "add %4, %1 \n\t"
- "movd (%1), %%mm1 \n\t"
- "add %4, %1 \n\t"
- PAVGB" (%2), %%mm0 \n\t"
- PAVGB" 4(%2), %%mm1 \n\t"
- PAVGB" (%3), %%mm0 \n\t"
- "movd %%mm0, (%3) \n\t"
- "add %5, %3 \n\t"
- PAVGB" (%3), %%mm1 \n\t"
- "movd %%mm1, (%3) \n\t"
- "add %5, %3 \n\t"
- "movd (%1), %%mm0 \n\t"
- "add %4, %1 \n\t"
- "movd (%1), %%mm1 \n\t"
- "add %4, %1 \n\t"
- PAVGB" 8(%2), %%mm0 \n\t"
- PAVGB" 12(%2), %%mm1 \n\t"
- PAVGB" (%3), %%mm0 \n\t"
- "movd %%mm0, (%3) \n\t"
- "add %5, %3 \n\t"
- PAVGB" (%3), %%mm1 \n\t"
- "movd %%mm1, (%3) \n\t"
- "add %5, %3 \n\t"
- "add $16, %2 \n\t"
- "subl $4, %0 \n\t"
- "jnz 1b \n\t"
-#if !HAVE_EBX_AVAILABLE //Note "+bm" and "+mb" are buggy too (with gcc 3.2.2 at least) and cannot be used
- :"+m"(h), "+a"(src1), "+c"(src2), "+d"(dst)
-#else
- :"+b"(h), "+a"(src1), "+c"(src2), "+d"(dst)
-#endif
- :"S"((x86_reg)src1Stride), "D"((x86_reg)dstStride)
- :"memory");
-}
-
-
-static void DEF(avg_pixels8_l2)(uint8_t *dst, uint8_t *src1, uint8_t *src2, int dstStride, int src1Stride, int h)
-{
- __asm__ volatile(
- "testl $1, %0 \n\t"
- " jz 1f \n\t"
- "movq (%1), %%mm0 \n\t"
- "movq (%2), %%mm1 \n\t"
- "add %4, %1 \n\t"
- "add $8, %2 \n\t"
- PAVGB" %%mm1, %%mm0 \n\t"
- PAVGB" (%3), %%mm0 \n\t"
- "movq %%mm0, (%3) \n\t"
- "add %5, %3 \n\t"
- "decl %0 \n\t"
- "1: \n\t"
- "movq (%1), %%mm0 \n\t"
- "add %4, %1 \n\t"
- "movq (%1), %%mm1 \n\t"
- "add %4, %1 \n\t"
- PAVGB" (%2), %%mm0 \n\t"
- PAVGB" 8(%2), %%mm1 \n\t"
- PAVGB" (%3), %%mm0 \n\t"
- "movq %%mm0, (%3) \n\t"
- "add %5, %3 \n\t"
- PAVGB" (%3), %%mm1 \n\t"
- "movq %%mm1, (%3) \n\t"
- "add %5, %3 \n\t"
- "movq (%1), %%mm0 \n\t"
- "add %4, %1 \n\t"
- "movq (%1), %%mm1 \n\t"
- "add %4, %1 \n\t"
- PAVGB" 16(%2), %%mm0 \n\t"
- PAVGB" 24(%2), %%mm1 \n\t"
- PAVGB" (%3), %%mm0 \n\t"
- "movq %%mm0, (%3) \n\t"
- "add %5, %3 \n\t"
- PAVGB" (%3), %%mm1 \n\t"
- "movq %%mm1, (%3) \n\t"
- "add %5, %3 \n\t"
- "add $32, %2 \n\t"
- "subl $4, %0 \n\t"
- "jnz 1b \n\t"
-#if !HAVE_EBX_AVAILABLE //Note "+bm" and "+mb" are buggy too (with gcc 3.2.2 at least) and cannot be used
- :"+m"(h), "+a"(src1), "+c"(src2), "+d"(dst)
-#else
- :"+b"(h), "+a"(src1), "+c"(src2), "+d"(dst)
-#endif
- :"S"((x86_reg)src1Stride), "D"((x86_reg)dstStride)
- :"memory");
-//the following should be used, though better not with gcc ...
-/* :"+g"(h), "+r"(src1), "+r"(src2), "+r"(dst)
- :"r"(src1Stride), "r"(dstStride)
- :"memory");*/
-}
-
-static void DEF(put_pixels16_x2)(uint8_t *block, const uint8_t *pixels, int line_size, int h)
-{
- __asm__ volatile(
- "lea (%3, %3), %%"REG_a" \n\t"
- "1: \n\t"
- "movq (%1), %%mm0 \n\t"
- "movq (%1, %3), %%mm1 \n\t"
- "movq 8(%1), %%mm2 \n\t"
- "movq 8(%1, %3), %%mm3 \n\t"
- PAVGB" 1(%1), %%mm0 \n\t"
- PAVGB" 1(%1, %3), %%mm1 \n\t"
- PAVGB" 9(%1), %%mm2 \n\t"
- PAVGB" 9(%1, %3), %%mm3 \n\t"
- "movq %%mm0, (%2) \n\t"
- "movq %%mm1, (%2, %3) \n\t"
- "movq %%mm2, 8(%2) \n\t"
- "movq %%mm3, 8(%2, %3) \n\t"
- "add %%"REG_a", %1 \n\t"
- "add %%"REG_a", %2 \n\t"
- "movq (%1), %%mm0 \n\t"
- "movq (%1, %3), %%mm1 \n\t"
- "movq 8(%1), %%mm2 \n\t"
- "movq 8(%1, %3), %%mm3 \n\t"
- PAVGB" 1(%1), %%mm0 \n\t"
- PAVGB" 1(%1, %3), %%mm1 \n\t"
- PAVGB" 9(%1), %%mm2 \n\t"
- PAVGB" 9(%1, %3), %%mm3 \n\t"
- "add %%"REG_a", %1 \n\t"
- "movq %%mm0, (%2) \n\t"
- "movq %%mm1, (%2, %3) \n\t"
- "movq %%mm2, 8(%2) \n\t"
- "movq %%mm3, 8(%2, %3) \n\t"
- "add %%"REG_a", %2 \n\t"
- "subl $4, %0 \n\t"
- "jnz 1b \n\t"
- :"+g"(h), "+S"(pixels), "+D"(block)
- :"r" ((x86_reg)line_size)
- :"%"REG_a, "memory");
-}
-
-static void DEF(put_pixels16_l2)(uint8_t *dst, uint8_t *src1, uint8_t *src2, int dstStride, int src1Stride, int h)
-{
- __asm__ volatile(
- "testl $1, %0 \n\t"
- " jz 1f \n\t"
- "movq (%1), %%mm0 \n\t"
- "movq 8(%1), %%mm1 \n\t"
- PAVGB" (%2), %%mm0 \n\t"
- PAVGB" 8(%2), %%mm1 \n\t"
- "add %4, %1 \n\t"
- "add $16, %2 \n\t"
- "movq %%mm0, (%3) \n\t"
- "movq %%mm1, 8(%3) \n\t"
- "add %5, %3 \n\t"
- "decl %0 \n\t"
- "1: \n\t"
- "movq (%1), %%mm0 \n\t"
- "movq 8(%1), %%mm1 \n\t"
- "add %4, %1 \n\t"
- PAVGB" (%2), %%mm0 \n\t"
- PAVGB" 8(%2), %%mm1 \n\t"
- "movq %%mm0, (%3) \n\t"
- "movq %%mm1, 8(%3) \n\t"
- "add %5, %3 \n\t"
- "movq (%1), %%mm0 \n\t"
- "movq 8(%1), %%mm1 \n\t"
- "add %4, %1 \n\t"
- PAVGB" 16(%2), %%mm0 \n\t"
- PAVGB" 24(%2), %%mm1 \n\t"
- "movq %%mm0, (%3) \n\t"
- "movq %%mm1, 8(%3) \n\t"
- "add %5, %3 \n\t"
- "add $32, %2 \n\t"
- "subl $2, %0 \n\t"
- "jnz 1b \n\t"
-#if !HAVE_EBX_AVAILABLE //Note "+bm" and "+mb" are buggy too (with gcc 3.2.2 at least) and cannot be used
- :"+m"(h), "+a"(src1), "+c"(src2), "+d"(dst)
-#else
- :"+b"(h), "+a"(src1), "+c"(src2), "+d"(dst)
-#endif
- :"S"((x86_reg)src1Stride), "D"((x86_reg)dstStride)
- :"memory");
-//the following should be used, though better not with gcc ...
-/* :"+g"(h), "+r"(src1), "+r"(src2), "+r"(dst)
- :"r"(src1Stride), "r"(dstStride)
- :"memory");*/
-}
-
-static void DEF(avg_pixels16_l2)(uint8_t *dst, uint8_t *src1, uint8_t *src2, int dstStride, int src1Stride, int h)
-{
- __asm__ volatile(
- "testl $1, %0 \n\t"
- " jz 1f \n\t"
- "movq (%1), %%mm0 \n\t"
- "movq 8(%1), %%mm1 \n\t"
- PAVGB" (%2), %%mm0 \n\t"
- PAVGB" 8(%2), %%mm1 \n\t"
- "add %4, %1 \n\t"
- "add $16, %2 \n\t"
- PAVGB" (%3), %%mm0 \n\t"
- PAVGB" 8(%3), %%mm1 \n\t"
- "movq %%mm0, (%3) \n\t"
- "movq %%mm1, 8(%3) \n\t"
- "add %5, %3 \n\t"
- "decl %0 \n\t"
- "1: \n\t"
- "movq (%1), %%mm0 \n\t"
- "movq 8(%1), %%mm1 \n\t"
- "add %4, %1 \n\t"
- PAVGB" (%2), %%mm0 \n\t"
- PAVGB" 8(%2), %%mm1 \n\t"
- PAVGB" (%3), %%mm0 \n\t"
- PAVGB" 8(%3), %%mm1 \n\t"
- "movq %%mm0, (%3) \n\t"
- "movq %%mm1, 8(%3) \n\t"
- "add %5, %3 \n\t"
- "movq (%1), %%mm0 \n\t"
- "movq 8(%1), %%mm1 \n\t"
- "add %4, %1 \n\t"
- PAVGB" 16(%2), %%mm0 \n\t"
- PAVGB" 24(%2), %%mm1 \n\t"
- PAVGB" (%3), %%mm0 \n\t"
- PAVGB" 8(%3), %%mm1 \n\t"
- "movq %%mm0, (%3) \n\t"
- "movq %%mm1, 8(%3) \n\t"
- "add %5, %3 \n\t"
- "add $32, %2 \n\t"
- "subl $2, %0 \n\t"
- "jnz 1b \n\t"
-#if !HAVE_EBX_AVAILABLE //Note "+bm" and "+mb" are buggy too (with gcc 3.2.2 at least) and cannot be used
- :"+m"(h), "+a"(src1), "+c"(src2), "+d"(dst)
-#else
- :"+b"(h), "+a"(src1), "+c"(src2), "+d"(dst)
-#endif
- :"S"((x86_reg)src1Stride), "D"((x86_reg)dstStride)
- :"memory");
-//the following should be used, though better not with gcc ...
-/* :"+g"(h), "+r"(src1), "+r"(src2), "+r"(dst)
- :"r"(src1Stride), "r"(dstStride)
- :"memory");*/
-}
-
-static void DEF(put_no_rnd_pixels16_l2)(uint8_t *dst, uint8_t *src1, uint8_t *src2, int dstStride, int src1Stride, int h)
-{
- __asm__ volatile(
- "pcmpeqb %%mm6, %%mm6 \n\t"
- "testl $1, %0 \n\t"
- " jz 1f \n\t"
- "movq (%1), %%mm0 \n\t"
- "movq 8(%1), %%mm1 \n\t"
- "movq (%2), %%mm2 \n\t"
- "movq 8(%2), %%mm3 \n\t"
- "pxor %%mm6, %%mm0 \n\t"
- "pxor %%mm6, %%mm1 \n\t"
- "pxor %%mm6, %%mm2 \n\t"
- "pxor %%mm6, %%mm3 \n\t"
- PAVGB" %%mm2, %%mm0 \n\t"
- PAVGB" %%mm3, %%mm1 \n\t"
- "pxor %%mm6, %%mm0 \n\t"
- "pxor %%mm6, %%mm1 \n\t"
- "add %4, %1 \n\t"
- "add $16, %2 \n\t"
- "movq %%mm0, (%3) \n\t"
- "movq %%mm1, 8(%3) \n\t"
- "add %5, %3 \n\t"
- "decl %0 \n\t"
- "1: \n\t"
- "movq (%1), %%mm0 \n\t"
- "movq 8(%1), %%mm1 \n\t"
- "add %4, %1 \n\t"
- "movq (%2), %%mm2 \n\t"
- "movq 8(%2), %%mm3 \n\t"
- "pxor %%mm6, %%mm0 \n\t"
- "pxor %%mm6, %%mm1 \n\t"
- "pxor %%mm6, %%mm2 \n\t"
- "pxor %%mm6, %%mm3 \n\t"
- PAVGB" %%mm2, %%mm0 \n\t"
- PAVGB" %%mm3, %%mm1 \n\t"
- "pxor %%mm6, %%mm0 \n\t"
- "pxor %%mm6, %%mm1 \n\t"
- "movq %%mm0, (%3) \n\t"
- "movq %%mm1, 8(%3) \n\t"
- "add %5, %3 \n\t"
- "movq (%1), %%mm0 \n\t"
- "movq 8(%1), %%mm1 \n\t"
- "add %4, %1 \n\t"
- "movq 16(%2), %%mm2 \n\t"
- "movq 24(%2), %%mm3 \n\t"
- "pxor %%mm6, %%mm0 \n\t"
- "pxor %%mm6, %%mm1 \n\t"
- "pxor %%mm6, %%mm2 \n\t"
- "pxor %%mm6, %%mm3 \n\t"
- PAVGB" %%mm2, %%mm0 \n\t"
- PAVGB" %%mm3, %%mm1 \n\t"
- "pxor %%mm6, %%mm0 \n\t"
- "pxor %%mm6, %%mm1 \n\t"
- "movq %%mm0, (%3) \n\t"
- "movq %%mm1, 8(%3) \n\t"
- "add %5, %3 \n\t"
- "add $32, %2 \n\t"
- "subl $2, %0 \n\t"
- "jnz 1b \n\t"
-#if !HAVE_EBX_AVAILABLE //Note "+bm" and "+mb" are buggy too (with gcc 3.2.2 at least) and cannot be used
- :"+m"(h), "+a"(src1), "+c"(src2), "+d"(dst)
-#else
- :"+b"(h), "+a"(src1), "+c"(src2), "+d"(dst)
-#endif
- :"S"((x86_reg)src1Stride), "D"((x86_reg)dstStride)
- :"memory");
-//the following should be used, though better not with gcc ...
-/* :"+g"(h), "+r"(src1), "+r"(src2), "+r"(dst)
- :"r"(src1Stride), "r"(dstStride)
- :"memory");*/
-}
-
-/* GL: this function does incorrect rounding if overflow */
-static void DEF(put_no_rnd_pixels8_x2)(uint8_t *block, const uint8_t *pixels, int line_size, int h)
-{
- MOVQ_BONE(mm6);
- __asm__ volatile(
- "lea (%3, %3), %%"REG_a" \n\t"
- "1: \n\t"
- "movq (%1), %%mm0 \n\t"
- "movq (%1, %3), %%mm2 \n\t"
- "movq 1(%1), %%mm1 \n\t"
- "movq 1(%1, %3), %%mm3 \n\t"
- "add %%"REG_a", %1 \n\t"
- "psubusb %%mm6, %%mm0 \n\t"
- "psubusb %%mm6, %%mm2 \n\t"
- PAVGB" %%mm1, %%mm0 \n\t"
- PAVGB" %%mm3, %%mm2 \n\t"
- "movq %%mm0, (%2) \n\t"
- "movq %%mm2, (%2, %3) \n\t"
- "movq (%1), %%mm0 \n\t"
- "movq 1(%1), %%mm1 \n\t"
- "movq (%1, %3), %%mm2 \n\t"
- "movq 1(%1, %3), %%mm3 \n\t"
- "add %%"REG_a", %2 \n\t"
- "add %%"REG_a", %1 \n\t"
- "psubusb %%mm6, %%mm0 \n\t"
- "psubusb %%mm6, %%mm2 \n\t"
- PAVGB" %%mm1, %%mm0 \n\t"
- PAVGB" %%mm3, %%mm2 \n\t"
- "movq %%mm0, (%2) \n\t"
- "movq %%mm2, (%2, %3) \n\t"
- "add %%"REG_a", %2 \n\t"
- "subl $4, %0 \n\t"
- "jnz 1b \n\t"
- :"+g"(h), "+S"(pixels), "+D"(block)
- :"r" ((x86_reg)line_size)
- :"%"REG_a, "memory");
-}
-
-static void DEF(put_no_rnd_pixels8_x2_exact)(uint8_t *block, const uint8_t *pixels, int line_size, int h)
-{
- __asm__ volatile (
- "pcmpeqb %%mm6, %%mm6 \n\t"
- "1: \n\t"
- "movq (%1), %%mm0 \n\t"
- "movq (%1, %3), %%mm2 \n\t"
- "movq 1(%1), %%mm1 \n\t"
- "movq 1(%1, %3), %%mm3 \n\t"
- "pxor %%mm6, %%mm0 \n\t"
- "pxor %%mm6, %%mm2 \n\t"
- "pxor %%mm6, %%mm1 \n\t"
- "pxor %%mm6, %%mm3 \n\t"
- PAVGB" %%mm1, %%mm0 \n\t"
- PAVGB" %%mm3, %%mm2 \n\t"
- "pxor %%mm6, %%mm0 \n\t"
- "pxor %%mm6, %%mm2 \n\t"
- "movq %%mm0, (%2) \n\t"
- "movq %%mm2, (%2, %3) \n\t"
- "movq (%1, %3,2), %%mm0 \n\t"
- "movq 1(%1, %3,2), %%mm1 \n\t"
- "movq (%1, %4), %%mm2 \n\t"
- "movq 1(%1, %4), %%mm3 \n\t"
- "pxor %%mm6, %%mm0 \n\t"
- "pxor %%mm6, %%mm1 \n\t"
- "pxor %%mm6, %%mm2 \n\t"
- "pxor %%mm6, %%mm3 \n\t"
- PAVGB" %%mm1, %%mm0 \n\t"
- PAVGB" %%mm3, %%mm2 \n\t"
- "pxor %%mm6, %%mm0 \n\t"
- "pxor %%mm6, %%mm2 \n\t"
- "movq %%mm0, (%2, %3,2) \n\t"
- "movq %%mm2, (%2, %4) \n\t"
- "lea (%1, %3,4), %1 \n\t"
- "lea (%2, %3,4), %2 \n\t"
- "subl $4, %0 \n\t"
- "jg 1b \n\t"
- : "+g"(h), "+r"(pixels), "+r"(block)
- : "r" ((x86_reg)line_size), "r"((x86_reg)3*line_size)
- : "memory"
- );
-}
-
-static void DEF(put_pixels8_y2)(uint8_t *block, const uint8_t *pixels, int line_size, int h)
-{
- __asm__ volatile(
- "lea (%3, %3), %%"REG_a" \n\t"
- "movq (%1), %%mm0 \n\t"
- "sub %3, %2 \n\t"
- "1: \n\t"
- "movq (%1, %3), %%mm1 \n\t"
- "movq (%1, %%"REG_a"), %%mm2 \n\t"
- "add %%"REG_a", %1 \n\t"
- PAVGB" %%mm1, %%mm0 \n\t"
- PAVGB" %%mm2, %%mm1 \n\t"
- "movq %%mm0, (%2, %3) \n\t"
- "movq %%mm1, (%2, %%"REG_a") \n\t"
- "movq (%1, %3), %%mm1 \n\t"
- "movq (%1, %%"REG_a"), %%mm0 \n\t"
- "add %%"REG_a", %2 \n\t"
- "add %%"REG_a", %1 \n\t"
- PAVGB" %%mm1, %%mm2 \n\t"
- PAVGB" %%mm0, %%mm1 \n\t"
- "movq %%mm2, (%2, %3) \n\t"
- "movq %%mm1, (%2, %%"REG_a") \n\t"
- "add %%"REG_a", %2 \n\t"
- "subl $4, %0 \n\t"
- "jnz 1b \n\t"
- :"+g"(h), "+S"(pixels), "+D" (block)
- :"r" ((x86_reg)line_size)
- :"%"REG_a, "memory");
-}
-
-/* GL: this function does incorrect rounding if overflow */
-static void DEF(put_no_rnd_pixels8_y2)(uint8_t *block, const uint8_t *pixels, int line_size, int h)
-{
- MOVQ_BONE(mm6);
- __asm__ volatile(
- "lea (%3, %3), %%"REG_a" \n\t"
- "movq (%1), %%mm0 \n\t"
- "sub %3, %2 \n\t"
- "1: \n\t"
- "movq (%1, %3), %%mm1 \n\t"
- "movq (%1, %%"REG_a"), %%mm2 \n\t"
- "add %%"REG_a", %1 \n\t"
- "psubusb %%mm6, %%mm1 \n\t"
- PAVGB" %%mm1, %%mm0 \n\t"
- PAVGB" %%mm2, %%mm1 \n\t"
- "movq %%mm0, (%2, %3) \n\t"
- "movq %%mm1, (%2, %%"REG_a") \n\t"
- "movq (%1, %3), %%mm1 \n\t"
- "movq (%1, %%"REG_a"), %%mm0 \n\t"
- "add %%"REG_a", %2 \n\t"
- "add %%"REG_a", %1 \n\t"
- "psubusb %%mm6, %%mm1 \n\t"
- PAVGB" %%mm1, %%mm2 \n\t"
- PAVGB" %%mm0, %%mm1 \n\t"
- "movq %%mm2, (%2, %3) \n\t"
- "movq %%mm1, (%2, %%"REG_a") \n\t"
- "add %%"REG_a", %2 \n\t"
- "subl $4, %0 \n\t"
- "jnz 1b \n\t"
- :"+g"(h), "+S"(pixels), "+D" (block)
- :"r" ((x86_reg)line_size)
- :"%"REG_a, "memory");
-}
-
-static void DEF(put_no_rnd_pixels8_y2_exact)(uint8_t *block, const uint8_t *pixels, int line_size, int h)
-{
- __asm__ volatile (
- "movq (%1), %%mm0 \n\t"
- "pcmpeqb %%mm6, %%mm6 \n\t"
- "add %3, %1 \n\t"
- "pxor %%mm6, %%mm0 \n\t"
- "1: \n\t"
- "movq (%1), %%mm1 \n\t"
- "movq (%1, %3), %%mm2 \n\t"
- "pxor %%mm6, %%mm1 \n\t"
- "pxor %%mm6, %%mm2 \n\t"
- PAVGB" %%mm1, %%mm0 \n\t"
- PAVGB" %%mm2, %%mm1 \n\t"
- "pxor %%mm6, %%mm0 \n\t"
- "pxor %%mm6, %%mm1 \n\t"
- "movq %%mm0, (%2) \n\t"
- "movq %%mm1, (%2, %3) \n\t"
- "movq (%1, %3,2), %%mm1 \n\t"
- "movq (%1, %4), %%mm0 \n\t"
- "pxor %%mm6, %%mm1 \n\t"
- "pxor %%mm6, %%mm0 \n\t"
- PAVGB" %%mm1, %%mm2 \n\t"
- PAVGB" %%mm0, %%mm1 \n\t"
- "pxor %%mm6, %%mm2 \n\t"
- "pxor %%mm6, %%mm1 \n\t"
- "movq %%mm2, (%2, %3,2) \n\t"
- "movq %%mm1, (%2, %4) \n\t"
- "lea (%1, %3,4), %1 \n\t"
- "lea (%2, %3,4), %2 \n\t"
- "subl $4, %0 \n\t"
- "jg 1b \n\t"
- :"+g"(h), "+r"(pixels), "+r" (block)
- :"r" ((x86_reg)line_size), "r"((x86_reg)3*line_size)
- :"memory"
- );
-}
-
-static void DEF(avg_pixels8)(uint8_t *block, const uint8_t *pixels, int line_size, int h)
-{
- __asm__ volatile(
- "lea (%3, %3), %%"REG_a" \n\t"
- "1: \n\t"
- "movq (%2), %%mm0 \n\t"
- "movq (%2, %3), %%mm1 \n\t"
- PAVGB" (%1), %%mm0 \n\t"
- PAVGB" (%1, %3), %%mm1 \n\t"
- "movq %%mm0, (%2) \n\t"
- "movq %%mm1, (%2, %3) \n\t"
- "add %%"REG_a", %1 \n\t"
- "add %%"REG_a", %2 \n\t"
- "movq (%2), %%mm0 \n\t"
- "movq (%2, %3), %%mm1 \n\t"
- PAVGB" (%1), %%mm0 \n\t"
- PAVGB" (%1, %3), %%mm1 \n\t"
- "add %%"REG_a", %1 \n\t"
- "movq %%mm0, (%2) \n\t"
- "movq %%mm1, (%2, %3) \n\t"
- "add %%"REG_a", %2 \n\t"
- "subl $4, %0 \n\t"
- "jnz 1b \n\t"
- :"+g"(h), "+S"(pixels), "+D"(block)
- :"r" ((x86_reg)line_size)
- :"%"REG_a, "memory");
-}
-
-static void DEF(avg_pixels8_x2)(uint8_t *block, const uint8_t *pixels, int line_size, int h)
-{
- __asm__ volatile(
- "lea (%3, %3), %%"REG_a" \n\t"
- "1: \n\t"
- "movq (%1), %%mm0 \n\t"
- "movq (%1, %3), %%mm2 \n\t"
- PAVGB" 1(%1), %%mm0 \n\t"
- PAVGB" 1(%1, %3), %%mm2 \n\t"
- PAVGB" (%2), %%mm0 \n\t"
- PAVGB" (%2, %3), %%mm2 \n\t"
- "add %%"REG_a", %1 \n\t"
- "movq %%mm0, (%2) \n\t"
- "movq %%mm2, (%2, %3) \n\t"
- "movq (%1), %%mm0 \n\t"
- "movq (%1, %3), %%mm2 \n\t"
- PAVGB" 1(%1), %%mm0 \n\t"
- PAVGB" 1(%1, %3), %%mm2 \n\t"
- "add %%"REG_a", %2 \n\t"
- "add %%"REG_a", %1 \n\t"
- PAVGB" (%2), %%mm0 \n\t"
- PAVGB" (%2, %3), %%mm2 \n\t"
- "movq %%mm0, (%2) \n\t"
- "movq %%mm2, (%2, %3) \n\t"
- "add %%"REG_a", %2 \n\t"
- "subl $4, %0 \n\t"
- "jnz 1b \n\t"
- :"+g"(h), "+S"(pixels), "+D"(block)
- :"r" ((x86_reg)line_size)
- :"%"REG_a, "memory");
-}
-
-static void DEF(avg_pixels8_y2)(uint8_t *block, const uint8_t *pixels, int line_size, int h)
-{
- __asm__ volatile(
- "lea (%3, %3), %%"REG_a" \n\t"
- "movq (%1), %%mm0 \n\t"
- "sub %3, %2 \n\t"
- "1: \n\t"
- "movq (%1, %3), %%mm1 \n\t"
- "movq (%1, %%"REG_a"), %%mm2 \n\t"
- "add %%"REG_a", %1 \n\t"
- PAVGB" %%mm1, %%mm0 \n\t"
- PAVGB" %%mm2, %%mm1 \n\t"
- "movq (%2, %3), %%mm3 \n\t"
- "movq (%2, %%"REG_a"), %%mm4 \n\t"
- PAVGB" %%mm3, %%mm0 \n\t"
- PAVGB" %%mm4, %%mm1 \n\t"
- "movq %%mm0, (%2, %3) \n\t"
- "movq %%mm1, (%2, %%"REG_a") \n\t"
- "movq (%1, %3), %%mm1 \n\t"
- "movq (%1, %%"REG_a"), %%mm0 \n\t"
- PAVGB" %%mm1, %%mm2 \n\t"
- PAVGB" %%mm0, %%mm1 \n\t"
- "add %%"REG_a", %2 \n\t"
- "add %%"REG_a", %1 \n\t"
- "movq (%2, %3), %%mm3 \n\t"
- "movq (%2, %%"REG_a"), %%mm4 \n\t"
- PAVGB" %%mm3, %%mm2 \n\t"
- PAVGB" %%mm4, %%mm1 \n\t"
- "movq %%mm2, (%2, %3) \n\t"
- "movq %%mm1, (%2, %%"REG_a") \n\t"
- "add %%"REG_a", %2 \n\t"
- "subl $4, %0 \n\t"
- "jnz 1b \n\t"
- :"+g"(h), "+S"(pixels), "+D"(block)
- :"r" ((x86_reg)line_size)
- :"%"REG_a, "memory");
-}
-
-/* Note this is not correctly rounded, but this function is only
- * used for B-frames so it does not matter. */
-static void DEF(avg_pixels8_xy2)(uint8_t *block, const uint8_t *pixels, int line_size, int h)
-{
- MOVQ_BONE(mm6);
- __asm__ volatile(
- "lea (%3, %3), %%"REG_a" \n\t"
- "movq (%1), %%mm0 \n\t"
- PAVGB" 1(%1), %%mm0 \n\t"
- ".p2align 3 \n\t"
- "1: \n\t"
- "movq (%1, %%"REG_a"), %%mm2 \n\t"
- "movq (%1, %3), %%mm1 \n\t"
- "psubusb %%mm6, %%mm2 \n\t"
- PAVGB" 1(%1, %3), %%mm1 \n\t"
- PAVGB" 1(%1, %%"REG_a"), %%mm2 \n\t"
- "add %%"REG_a", %1 \n\t"
- PAVGB" %%mm1, %%mm0 \n\t"
- PAVGB" %%mm2, %%mm1 \n\t"
- PAVGB" (%2), %%mm0 \n\t"
- PAVGB" (%2, %3), %%mm1 \n\t"
- "movq %%mm0, (%2) \n\t"
- "movq %%mm1, (%2, %3) \n\t"
- "movq (%1, %3), %%mm1 \n\t"
- "movq (%1, %%"REG_a"), %%mm0 \n\t"
- PAVGB" 1(%1, %3), %%mm1 \n\t"
- PAVGB" 1(%1, %%"REG_a"), %%mm0 \n\t"
- "add %%"REG_a", %2 \n\t"
- "add %%"REG_a", %1 \n\t"
- PAVGB" %%mm1, %%mm2 \n\t"
- PAVGB" %%mm0, %%mm1 \n\t"
- PAVGB" (%2), %%mm2 \n\t"
- PAVGB" (%2, %3), %%mm1 \n\t"
- "movq %%mm2, (%2) \n\t"
- "movq %%mm1, (%2, %3) \n\t"
- "add %%"REG_a", %2 \n\t"
- "subl $4, %0 \n\t"
- "jnz 1b \n\t"
- :"+g"(h), "+S"(pixels), "+D"(block)
- :"r" ((x86_reg)line_size)
- :"%"REG_a, "memory");
-}
-
-static void DEF(avg_pixels4)(uint8_t *block, const uint8_t *pixels, int line_size, int h)
-{
- do {
- __asm__ volatile(
- "movd (%1), %%mm0 \n\t"
- "movd (%1, %2), %%mm1 \n\t"
- "movd (%1, %2, 2), %%mm2 \n\t"
- "movd (%1, %3), %%mm3 \n\t"
- PAVGB" (%0), %%mm0 \n\t"
- PAVGB" (%0, %2), %%mm1 \n\t"
- PAVGB" (%0, %2, 2), %%mm2 \n\t"
- PAVGB" (%0, %3), %%mm3 \n\t"
- "movd %%mm0, (%1) \n\t"
- "movd %%mm1, (%1, %2) \n\t"
- "movd %%mm2, (%1, %2, 2) \n\t"
- "movd %%mm3, (%1, %3) \n\t"
- ::"S"(pixels), "D"(block),
- "r" ((x86_reg)line_size), "r"((x86_reg)3L*line_size)
- :"memory");
- block += 4*line_size;
- pixels += 4*line_size;
- h -= 4;
- } while(h > 0);
-}
-
-//FIXME the following could be optimized too ...
-static void DEF(put_no_rnd_pixels16_x2)(uint8_t *block, const uint8_t *pixels, int line_size, int h){
- DEF(put_no_rnd_pixels8_x2)(block , pixels , line_size, h);
- DEF(put_no_rnd_pixels8_x2)(block+8, pixels+8, line_size, h);
-}
-static void DEF(put_pixels16_y2)(uint8_t *block, const uint8_t *pixels, int line_size, int h){
- DEF(put_pixels8_y2)(block , pixels , line_size, h);
- DEF(put_pixels8_y2)(block+8, pixels+8, line_size, h);
-}
-static void DEF(put_no_rnd_pixels16_y2)(uint8_t *block, const uint8_t *pixels, int line_size, int h){
- DEF(put_no_rnd_pixels8_y2)(block , pixels , line_size, h);
- DEF(put_no_rnd_pixels8_y2)(block+8, pixels+8, line_size, h);
-}
-static void DEF(avg_pixels16)(uint8_t *block, const uint8_t *pixels, int line_size, int h){
- DEF(avg_pixels8)(block , pixels , line_size, h);
- DEF(avg_pixels8)(block+8, pixels+8, line_size, h);
-}
-static void DEF(avg_pixels16_x2)(uint8_t *block, const uint8_t *pixels, int line_size, int h){
- DEF(avg_pixels8_x2)(block , pixels , line_size, h);
- DEF(avg_pixels8_x2)(block+8, pixels+8, line_size, h);
-}
-static void DEF(avg_pixels16_y2)(uint8_t *block, const uint8_t *pixels, int line_size, int h){
- DEF(avg_pixels8_y2)(block , pixels , line_size, h);
- DEF(avg_pixels8_y2)(block+8, pixels+8, line_size, h);
-}
-static void DEF(avg_pixels16_xy2)(uint8_t *block, const uint8_t *pixels, int line_size, int h){
- DEF(avg_pixels8_xy2)(block , pixels , line_size, h);
- DEF(avg_pixels8_xy2)(block+8, pixels+8, line_size, h);
-}
-
-#define QPEL_2TAP_L3(OPNAME) \
-static void DEF(OPNAME ## 2tap_qpel16_l3)(uint8_t *dst, uint8_t *src, int stride, int h, int off1, int off2){\
- __asm__ volatile(\
- "1: \n\t"\
- "movq (%1,%2), %%mm0 \n\t"\
- "movq 8(%1,%2), %%mm1 \n\t"\
- PAVGB" (%1,%3), %%mm0 \n\t"\
- PAVGB" 8(%1,%3), %%mm1 \n\t"\
- PAVGB" (%1), %%mm0 \n\t"\
- PAVGB" 8(%1), %%mm1 \n\t"\
- STORE_OP( (%1,%4),%%mm0)\
- STORE_OP(8(%1,%4),%%mm1)\
- "movq %%mm0, (%1,%4) \n\t"\
- "movq %%mm1, 8(%1,%4) \n\t"\
- "add %5, %1 \n\t"\
- "decl %0 \n\t"\
- "jnz 1b \n\t"\
- :"+g"(h), "+r"(src)\
- :"r"((x86_reg)off1), "r"((x86_reg)off2),\
- "r"((x86_reg)(dst-src)), "r"((x86_reg)stride)\
- :"memory"\
- );\
-}\
-static void DEF(OPNAME ## 2tap_qpel8_l3)(uint8_t *dst, uint8_t *src, int stride, int h, int off1, int off2){\
- __asm__ volatile(\
- "1: \n\t"\
- "movq (%1,%2), %%mm0 \n\t"\
- PAVGB" (%1,%3), %%mm0 \n\t"\
- PAVGB" (%1), %%mm0 \n\t"\
- STORE_OP((%1,%4),%%mm0)\
- "movq %%mm0, (%1,%4) \n\t"\
- "add %5, %1 \n\t"\
- "decl %0 \n\t"\
- "jnz 1b \n\t"\
- :"+g"(h), "+r"(src)\
- :"r"((x86_reg)off1), "r"((x86_reg)off2),\
- "r"((x86_reg)(dst-src)), "r"((x86_reg)stride)\
- :"memory"\
- );\
-}
-
-#define STORE_OP(a,b) PAVGB" "#a","#b" \n\t"
-QPEL_2TAP_L3(avg_)
-#undef STORE_OP
-#define STORE_OP(a,b)
-QPEL_2TAP_L3(put_)
-#undef STORE_OP
-#undef QPEL_2TAP_L3
diff --git a/gst-libs/ext/libav/libavcodec/x86/dsputil_mmx_qns_template.c b/gst-libs/ext/libav/libavcodec/x86/dsputil_qns_template.c
index 20a40a1..20a40a1 100644
--- a/gst-libs/ext/libav/libavcodec/x86/dsputil_mmx_qns_template.c
+++ b/gst-libs/ext/libav/libavcodec/x86/dsputil_qns_template.c
diff --git a/gst-libs/ext/libav/libavcodec/x86/dsputil_mmx_rnd_template.c b/gst-libs/ext/libav/libavcodec/x86/dsputil_rnd_template.c
index 34a2c0b..34a2c0b 100644
--- a/gst-libs/ext/libav/libavcodec/x86/dsputil_mmx_rnd_template.c
+++ b/gst-libs/ext/libav/libavcodec/x86/dsputil_rnd_template.c
diff --git a/gst-libs/ext/libav/libavcodec/x86/dsputil_yasm.asm b/gst-libs/ext/libav/libavcodec/x86/dsputil_yasm.asm
deleted file mode 100644
index 4d2fb6a..0000000
--- a/gst-libs/ext/libav/libavcodec/x86/dsputil_yasm.asm
+++ /dev/null
@@ -1,1180 +0,0 @@
-;******************************************************************************
-;* MMX optimized DSP utils
-;* Copyright (c) 2008 Loren Merritt
-;*
-;* 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
-;******************************************************************************
-
-%include "x86inc.asm"
-%include "x86util.asm"
-
-SECTION_RODATA
-pb_f: times 16 db 15
-pb_zzzzzzzz77777777: times 8 db -1
-pb_7: times 8 db 7
-pb_zzzz3333zzzzbbbb: db -1,-1,-1,-1,3,3,3,3,-1,-1,-1,-1,11,11,11,11
-pb_zz11zz55zz99zzdd: db -1,-1,1,1,-1,-1,5,5,-1,-1,9,9,-1,-1,13,13
-pb_revwords: db 14, 15, 12, 13, 10, 11, 8, 9, 6, 7, 4, 5, 2, 3, 0, 1
-pd_16384: times 4 dd 16384
-
-SECTION_TEXT
-
-%macro SCALARPRODUCT 1
-; int scalarproduct_int16(int16_t *v1, int16_t *v2, int order, int shift)
-cglobal scalarproduct_int16_%1, 3,3,4, v1, v2, order, shift
- shl orderq, 1
- add v1q, orderq
- add v2q, orderq
- neg orderq
- movd m3, shiftm
- pxor m2, m2
-.loop:
- movu m0, [v1q + orderq]
- movu m1, [v1q + orderq + mmsize]
- pmaddwd m0, [v2q + orderq]
- pmaddwd m1, [v2q + orderq + mmsize]
- paddd m2, m0
- paddd m2, m1
- add orderq, mmsize*2
- jl .loop
-%if mmsize == 16
- movhlps m0, m2
- paddd m2, m0
- psrad m2, m3
- pshuflw m0, m2, 0x4e
-%else
- psrad m2, m3
- pshufw m0, m2, 0x4e
-%endif
- paddd m2, m0
- movd eax, m2
- RET
-
-; int scalarproduct_and_madd_int16(int16_t *v1, int16_t *v2, int16_t *v3, int order, int mul)
-cglobal scalarproduct_and_madd_int16_%1, 4,4,8, v1, v2, v3, order, mul
- shl orderq, 1
- movd m7, mulm
-%if mmsize == 16
- pshuflw m7, m7, 0
- punpcklqdq m7, m7
-%else
- pshufw m7, m7, 0
-%endif
- pxor m6, m6
- add v1q, orderq
- add v2q, orderq
- add v3q, orderq
- neg orderq
-.loop:
- movu m0, [v2q + orderq]
- movu m1, [v2q + orderq + mmsize]
- mova m4, [v1q + orderq]
- mova m5, [v1q + orderq + mmsize]
- movu m2, [v3q + orderq]
- movu m3, [v3q + orderq + mmsize]
- pmaddwd m0, m4
- pmaddwd m1, m5
- pmullw m2, m7
- pmullw m3, m7
- paddd m6, m0
- paddd m6, m1
- paddw m2, m4
- paddw m3, m5
- mova [v1q + orderq], m2
- mova [v1q + orderq + mmsize], m3
- add orderq, mmsize*2
- jl .loop
-%if mmsize == 16
- movhlps m0, m6
- paddd m6, m0
- pshuflw m0, m6, 0x4e
-%else
- pshufw m0, m6, 0x4e
-%endif
- paddd m6, m0
- movd eax, m6
- RET
-%endmacro
-
-INIT_MMX
-SCALARPRODUCT mmx2
-INIT_XMM
-SCALARPRODUCT sse2
-
-%macro SCALARPRODUCT_LOOP 1
-align 16
-.loop%1:
- sub orderq, mmsize*2
-%if %1
- mova m1, m4
- mova m4, [v2q + orderq]
- mova m0, [v2q + orderq + mmsize]
- palignr m1, m0, %1
- palignr m0, m4, %1
- mova m3, m5
- mova m5, [v3q + orderq]
- mova m2, [v3q + orderq + mmsize]
- palignr m3, m2, %1
- palignr m2, m5, %1
-%else
- mova m0, [v2q + orderq]
- mova m1, [v2q + orderq + mmsize]
- mova m2, [v3q + orderq]
- mova m3, [v3q + orderq + mmsize]
-%endif
- %define t0 [v1q + orderq]
- %define t1 [v1q + orderq + mmsize]
-%ifdef ARCH_X86_64
- mova m8, t0
- mova m9, t1
- %define t0 m8
- %define t1 m9
-%endif
- pmaddwd m0, t0
- pmaddwd m1, t1
- pmullw m2, m7
- pmullw m3, m7
- paddw m2, t0
- paddw m3, t1
- paddd m6, m0
- paddd m6, m1
- mova [v1q + orderq], m2
- mova [v1q + orderq + mmsize], m3
- jg .loop%1
-%if %1
- jmp .end
-%endif
-%endmacro
-
-; int scalarproduct_and_madd_int16(int16_t *v1, int16_t *v2, int16_t *v3, int order, int mul)
-cglobal scalarproduct_and_madd_int16_ssse3, 4,5,10, v1, v2, v3, order, mul
- shl orderq, 1
- movd m7, mulm
- pshuflw m7, m7, 0
- punpcklqdq m7, m7
- pxor m6, m6
- mov r4d, v2d
- and r4d, 15
- and v2q, ~15
- and v3q, ~15
- mova m4, [v2q + orderq]
- mova m5, [v3q + orderq]
- ; linear is faster than branch tree or jump table, because the branches taken are cyclic (i.e. predictable)
- cmp r4d, 0
- je .loop0
- cmp r4d, 2
- je .loop2
- cmp r4d, 4
- je .loop4
- cmp r4d, 6
- je .loop6
- cmp r4d, 8
- je .loop8
- cmp r4d, 10
- je .loop10
- cmp r4d, 12
- je .loop12
-SCALARPRODUCT_LOOP 14
-SCALARPRODUCT_LOOP 12
-SCALARPRODUCT_LOOP 10
-SCALARPRODUCT_LOOP 8
-SCALARPRODUCT_LOOP 6
-SCALARPRODUCT_LOOP 4
-SCALARPRODUCT_LOOP 2
-SCALARPRODUCT_LOOP 0
-.end:
- movhlps m0, m6
- paddd m6, m0
- pshuflw m0, m6, 0x4e
- paddd m6, m0
- movd eax, m6
- RET
-
-
-;-----------------------------------------------------------------------------
-; void ff_apply_window_int16(int16_t *output, const int16_t *input,
-; const int16_t *window, unsigned int len)
-;-----------------------------------------------------------------------------
-
-%macro REVERSE_WORDS_MMXEXT 1-2
- pshufw %1, %1, 0x1B
-%endmacro
-
-%macro REVERSE_WORDS_SSE2 1-2
- pshuflw %1, %1, 0x1B
- pshufhw %1, %1, 0x1B
- pshufd %1, %1, 0x4E
-%endmacro
-
-%macro REVERSE_WORDS_SSSE3 2
- pshufb %1, %2
-%endmacro
-
-; dst = (dst * src) >> 15
-; pmulhw cuts off the bottom bit, so we have to lshift by 1 and add it back
-; in from the pmullw result.
-%macro MUL16FIXED_MMXEXT 3 ; dst, src, temp
- mova %3, %1
- pmulhw %1, %2
- pmullw %3, %2
- psrlw %3, 15
- psllw %1, 1
- por %1, %3
-%endmacro
-
-; dst = ((dst * src) + (1<<14)) >> 15
-%macro MUL16FIXED_SSSE3 3 ; dst, src, unused
- pmulhrsw %1, %2
-%endmacro
-
-%macro APPLY_WINDOW_INT16 3 ; %1=instruction set, %2=mmxext/sse2 bit exact version, %3=has_ssse3
-cglobal apply_window_int16_%1, 4,5,6, output, input, window, offset, offset2
- lea offset2q, [offsetq-mmsize]
-%if %2
- mova m5, [pd_16384]
-%elifidn %1, ssse3
- mova m5, [pb_revwords]
- ALIGN 16
-%endif
-.loop:
-%if %2
- ; This version expands 16-bit to 32-bit, multiplies by the window,
- ; adds 16384 for rounding, right shifts 15, then repacks back to words to
- ; save to the output. The window is reversed for the second half.
- mova m3, [windowq+offset2q]
- mova m4, [ inputq+offset2q]
- pxor m0, m0
- punpcklwd m0, m3
- punpcklwd m1, m4
- pmaddwd m0, m1
- paddd m0, m5
- psrad m0, 15
- pxor m2, m2
- punpckhwd m2, m3
- punpckhwd m1, m4
- pmaddwd m2, m1
- paddd m2, m5
- psrad m2, 15
- packssdw m0, m2
- mova [outputq+offset2q], m0
- REVERSE_WORDS m3
- mova m4, [ inputq+offsetq]
- pxor m0, m0
- punpcklwd m0, m3
- punpcklwd m1, m4
- pmaddwd m0, m1
- paddd m0, m5
- psrad m0, 15
- pxor m2, m2
- punpckhwd m2, m3
- punpckhwd m1, m4
- pmaddwd m2, m1
- paddd m2, m5
- psrad m2, 15
- packssdw m0, m2
- mova [outputq+offsetq], m0
-%elif %3
- ; This version does the 16x16->16 multiplication in-place without expanding
- ; to 32-bit. The ssse3 version is bit-identical.
- mova m0, [windowq+offset2q]
- mova m1, [ inputq+offset2q]
- pmulhrsw m1, m0
- REVERSE_WORDS m0, m5
- pmulhrsw m0, [ inputq+offsetq ]
- mova [outputq+offset2q], m1
- mova [outputq+offsetq ], m0
-%else
- ; This version does the 16x16->16 multiplication in-place without expanding
- ; to 32-bit. The mmxext and sse2 versions do not use rounding, and
- ; therefore are not bit-identical to the C version.
- mova m0, [windowq+offset2q]
- mova m1, [ inputq+offset2q]
- mova m2, [ inputq+offsetq ]
- MUL16FIXED m1, m0, m3
- REVERSE_WORDS m0
- MUL16FIXED m2, m0, m3
- mova [outputq+offset2q], m1
- mova [outputq+offsetq ], m2
-%endif
- add offsetd, mmsize
- sub offset2d, mmsize
- jae .loop
- REP_RET
-%endmacro
-
-INIT_MMX
-%define REVERSE_WORDS REVERSE_WORDS_MMXEXT
-%define MUL16FIXED MUL16FIXED_MMXEXT
-APPLY_WINDOW_INT16 mmxext, 0, 0
-APPLY_WINDOW_INT16 mmxext_ba, 1, 0
-INIT_XMM
-%define REVERSE_WORDS REVERSE_WORDS_SSE2
-APPLY_WINDOW_INT16 sse2, 0, 0
-APPLY_WINDOW_INT16 sse2_ba, 1, 0
-APPLY_WINDOW_INT16 ssse3_atom, 0, 1
-%define REVERSE_WORDS REVERSE_WORDS_SSSE3
-APPLY_WINDOW_INT16 ssse3, 0, 1
-
-
-; void add_hfyu_median_prediction_mmx2(uint8_t *dst, const uint8_t *top, const uint8_t *diff, int w, int *left, int *left_top)
-cglobal add_hfyu_median_prediction_mmx2, 6,6,0, dst, top, diff, w, left, left_top
- movq mm0, [topq]
- movq mm2, mm0
- movd mm4, [left_topq]
- psllq mm2, 8
- movq mm1, mm0
- por mm4, mm2
- movd mm3, [leftq]
- psubb mm0, mm4 ; t-tl
- add dstq, wq
- add topq, wq
- add diffq, wq
- neg wq
- jmp .skip
-.loop:
- movq mm4, [topq+wq]
- movq mm0, mm4
- psllq mm4, 8
- por mm4, mm1
- movq mm1, mm0 ; t
- psubb mm0, mm4 ; t-tl
-.skip:
- movq mm2, [diffq+wq]
-%assign i 0
-%rep 8
- movq mm4, mm0
- paddb mm4, mm3 ; t-tl+l
- movq mm5, mm3
- pmaxub mm3, mm1
- pminub mm5, mm1
- pminub mm3, mm4
- pmaxub mm3, mm5 ; median
- paddb mm3, mm2 ; +residual
-%if i==0
- movq mm7, mm3
- psllq mm7, 56
-%else
- movq mm6, mm3
- psrlq mm7, 8
- psllq mm6, 56
- por mm7, mm6
-%endif
-%if i<7
- psrlq mm0, 8
- psrlq mm1, 8
- psrlq mm2, 8
-%endif
-%assign i i+1
-%endrep
- movq [dstq+wq], mm7
- add wq, 8
- jl .loop
- movzx r2d, byte [dstq-1]
- mov [leftq], r2d
- movzx r2d, byte [topq-1]
- mov [left_topq], r2d
- RET
-
-
-%macro ADD_HFYU_LEFT_LOOP 1 ; %1 = is_aligned
- add srcq, wq
- add dstq, wq
- neg wq
-%%.loop:
- mova m1, [srcq+wq]
- mova m2, m1
- psllw m1, 8
- paddb m1, m2
- mova m2, m1
- pshufb m1, m3
- paddb m1, m2
- pshufb m0, m5
- mova m2, m1
- pshufb m1, m4
- paddb m1, m2
-%if mmsize == 16
- mova m2, m1
- pshufb m1, m6
- paddb m1, m2
-%endif
- paddb m0, m1
-%if %1
- mova [dstq+wq], m0
-%else
- movq [dstq+wq], m0
- movhps [dstq+wq+8], m0
-%endif
- add wq, mmsize
- jl %%.loop
- mov eax, mmsize-1
- sub eax, wd
- movd m1, eax
- pshufb m0, m1
- movd eax, m0
- RET
-%endmacro
-
-; int add_hfyu_left_prediction(uint8_t *dst, const uint8_t *src, int w, int left)
-INIT_MMX
-cglobal add_hfyu_left_prediction_ssse3, 3,3,7, dst, src, w, left
-.skip_prologue:
- mova m5, [pb_7]
- mova m4, [pb_zzzz3333zzzzbbbb]
- mova m3, [pb_zz11zz55zz99zzdd]
- movd m0, leftm
- psllq m0, 56
- ADD_HFYU_LEFT_LOOP 1
-
-INIT_XMM
-cglobal add_hfyu_left_prediction_sse4, 3,3,7, dst, src, w, left
- mova m5, [pb_f]
- mova m6, [pb_zzzzzzzz77777777]
- mova m4, [pb_zzzz3333zzzzbbbb]
- mova m3, [pb_zz11zz55zz99zzdd]
- movd m0, leftm
- pslldq m0, 15
- test srcq, 15
- jnz add_hfyu_left_prediction_ssse3.skip_prologue
- test dstq, 15
- jnz .unaligned
- ADD_HFYU_LEFT_LOOP 1
-.unaligned:
- ADD_HFYU_LEFT_LOOP 0
-
-
-; float scalarproduct_float_sse(const float *v1, const float *v2, int len)
-cglobal scalarproduct_float_sse, 3,3,2, v1, v2, offset
- neg offsetq
- shl offsetq, 2
- sub v1q, offsetq
- sub v2q, offsetq
- xorps xmm0, xmm0
- .loop:
- movaps xmm1, [v1q+offsetq]
- mulps xmm1, [v2q+offsetq]
- addps xmm0, xmm1
- add offsetq, 16
- js .loop
- movhlps xmm1, xmm0
- addps xmm0, xmm1
- movss xmm1, xmm0
- shufps xmm0, xmm0, 1
- addss xmm0, xmm1
-%ifndef ARCH_X86_64
- movd r0m, xmm0
- fld dword r0m
-%endif
- RET
-
-; extern void ff_emu_edge_core(uint8_t *buf, const uint8_t *src, x86_reg linesize,
-; x86_reg start_y, x86_reg end_y, x86_reg block_h,
-; x86_reg start_x, x86_reg end_x, x86_reg block_w);
-;
-; The actual function itself is below. It basically wraps a very simple
-; w = end_x - start_x
-; if (w) {
-; if (w > 22) {
-; jump to the slow loop functions
-; } else {
-; jump to the fast loop functions
-; }
-; }
-;
-; ... and then the same for left/right extend also. See below for loop
-; function implementations. Fast are fixed-width, slow is variable-width
-
-%macro EMU_EDGE_FUNC 0
-%ifdef ARCH_X86_64
-%define w_reg r10
-cglobal emu_edge_core, 6, 7, 1
- mov r11, r5 ; save block_h
-%else
-%define w_reg r6
-cglobal emu_edge_core, 2, 7, 0
- mov r4, r4m ; end_y
- mov r5, r5m ; block_h
-%endif
-
- ; start with vertical extend (top/bottom) and body pixel copy
- mov w_reg, r7m
- sub w_reg, r6m ; w = start_x - end_x
- sub r5, r4
-%ifdef ARCH_X86_64
- sub r4, r3
-%else
- sub r4, dword r3m
-%endif
- cmp w_reg, 22
- jg .slow_v_extend_loop
-%ifdef ARCH_X86_32
- mov r2, r2m ; linesize
-%endif
- sal w_reg, 7 ; w * 128
-%ifdef PIC
- lea rax, [.emuedge_v_extend_1 - (.emuedge_v_extend_2 - .emuedge_v_extend_1)]
- add w_reg, rax
-%else
- lea w_reg, [.emuedge_v_extend_1 - (.emuedge_v_extend_2 - .emuedge_v_extend_1)+w_reg]
-%endif
- call w_reg ; fast top extend, body copy and bottom extend
-.v_extend_end:
-
- ; horizontal extend (left/right)
- mov w_reg, r6m ; start_x
- sub r0, w_reg
-%ifdef ARCH_X86_64
- mov r3, r0 ; backup of buf+block_h*linesize
- mov r5, r11
-%else
- mov r0m, r0 ; backup of buf+block_h*linesize
- mov r5, r5m
-%endif
- test w_reg, w_reg
- jz .right_extend
- cmp w_reg, 22
- jg .slow_left_extend_loop
- mov r1, w_reg
- dec w_reg
- ; FIXME we can do a if size == 1 here if that makes any speed difference, test me
- sar w_reg, 1
- sal w_reg, 6
- ; r0=buf+block_h*linesize,r10(64)/r6(32)=start_x offset for funcs
- ; r6(rax)/r3(ebx)=val,r2=linesize,r1=start_x,r5=block_h
-%ifdef PIC
- lea rax, [.emuedge_extend_left_2]
- add w_reg, rax
-%else
- lea w_reg, [.emuedge_extend_left_2+w_reg]
-%endif
- call w_reg
-
- ; now r3(64)/r0(32)=buf,r2=linesize,r11/r5=block_h,r6/r3=val, r10/r6=end_x, r1=block_w
-.right_extend:
-%ifdef ARCH_X86_32
- mov r0, r0m
- mov r5, r5m
-%endif
- mov w_reg, r7m ; end_x
- mov r1, r8m ; block_w
- mov r4, r1
- sub r1, w_reg
- jz .h_extend_end ; if (end_x == block_w) goto h_extend_end
- cmp r1, 22
- jg .slow_right_extend_loop
- dec r1
- ; FIXME we can do a if size == 1 here if that makes any speed difference, test me
- sar r1, 1
- sal r1, 6
-%ifdef PIC
- lea rax, [.emuedge_extend_right_2]
- add r1, rax
-%else
- lea r1, [.emuedge_extend_right_2+r1]
-%endif
- call r1
-.h_extend_end:
- RET
-
-%ifdef ARCH_X86_64
-%define vall al
-%define valh ah
-%define valw ax
-%define valw2 r10w
-%define valw3 r3w
-%ifdef WIN64
-%define valw4 r4w
-%else ; unix64
-%define valw4 r3w
-%endif
-%define vald eax
-%else
-%define vall bl
-%define valh bh
-%define valw bx
-%define valw2 r6w
-%define valw3 valw2
-%define valw4 valw3
-%define vald ebx
-%define stack_offset 0x14
-%endif
-
-%endmacro
-
-; macro to read/write a horizontal number of pixels (%2) to/from registers
-; on x86-64, - fills xmm0-15 for consecutive sets of 16 pixels
-; - if (%2 & 15 == 8) fills the last 8 bytes into rax
-; - else if (%2 & 8) fills 8 bytes into mm0
-; - if (%2 & 7 == 4) fills the last 4 bytes into rax
-; - else if (%2 & 4) fills 4 bytes into mm0-1
-; - if (%2 & 3 == 3) fills 2 bytes into r10/r3, and 1 into eax
-; (note that we're using r3 for body/bottom because it's a shorter
-; opcode, and then the loop fits in 128 bytes)
-; - else fills remaining bytes into rax
-; on x86-32, - fills mm0-7 for consecutive sets of 8 pixels
-; - if (%2 & 7 == 4) fills 4 bytes into ebx
-; - else if (%2 & 4) fills 4 bytes into mm0-7
-; - if (%2 & 3 == 3) fills 2 bytes into r6, and 1 into ebx
-; - else fills remaining bytes into ebx
-; writing data out is in the same way
-%macro READ_NUM_BYTES 2
-%assign %%src_off 0 ; offset in source buffer
-%assign %%smidx 0 ; mmx register idx
-%assign %%sxidx 0 ; xmm register idx
-
-%if cpuflag(sse)
-%rep %2/16
- movups xmm %+ %%sxidx, [r1+%%src_off]
-%assign %%src_off %%src_off+16
-%assign %%sxidx %%sxidx+1
-%endrep ; %2/16
-%endif
-
-%ifdef ARCH_X86_64
-%if (%2-%%src_off) == 8
- mov rax, [r1+%%src_off]
-%assign %%src_off %%src_off+8
-%endif ; (%2-%%src_off) == 8
-%endif ; x86-64
-
-%rep (%2-%%src_off)/8
- movq mm %+ %%smidx, [r1+%%src_off]
-%assign %%src_off %%src_off+8
-%assign %%smidx %%smidx+1
-%endrep ; (%2-%%dst_off)/8
-
-%if (%2-%%src_off) == 4
- mov vald, [r1+%%src_off]
-%elif (%2-%%src_off) & 4
- movd mm %+ %%smidx, [r1+%%src_off]
-%assign %%src_off %%src_off+4
-%endif ; (%2-%%src_off) ==/& 4
-
-%if (%2-%%src_off) == 1
- mov vall, [r1+%%src_off]
-%elif (%2-%%src_off) == 2
- mov valw, [r1+%%src_off]
-%elif (%2-%%src_off) == 3
-%ifidn %1, top
- mov valw2, [r1+%%src_off]
-%elifidn %1, body
- mov valw3, [r1+%%src_off]
-%elifidn %1, bottom
- mov valw4, [r1+%%src_off]
-%endif ; %1 ==/!= top
- mov vall, [r1+%%src_off+2]
-%endif ; (%2-%%src_off) == 1/2/3
-%endmacro ; READ_NUM_BYTES
-
-%macro WRITE_NUM_BYTES 2
-%assign %%dst_off 0 ; offset in destination buffer
-%assign %%dmidx 0 ; mmx register idx
-%assign %%dxidx 0 ; xmm register idx
-
-%if cpuflag(sse)
-%rep %2/16
- movups [r0+%%dst_off], xmm %+ %%dxidx
-%assign %%dst_off %%dst_off+16
-%assign %%dxidx %%dxidx+1
-%endrep ; %2/16
-%endif
-
-%ifdef ARCH_X86_64
-%if (%2-%%dst_off) == 8
- mov [r0+%%dst_off], rax
-%assign %%dst_off %%dst_off+8
-%endif ; (%2-%%dst_off) == 8
-%endif ; x86-64
-
-%rep (%2-%%dst_off)/8
- movq [r0+%%dst_off], mm %+ %%dmidx
-%assign %%dst_off %%dst_off+8
-%assign %%dmidx %%dmidx+1
-%endrep ; (%2-%%dst_off)/8
-
-%if (%2-%%dst_off) == 4
- mov [r0+%%dst_off], vald
-%elif (%2-%%dst_off) & 4
- movd [r0+%%dst_off], mm %+ %%dmidx
-%assign %%dst_off %%dst_off+4
-%endif ; (%2-%%dst_off) ==/& 4
-
-%if (%2-%%dst_off) == 1
- mov [r0+%%dst_off], vall
-%elif (%2-%%dst_off) == 2
- mov [r0+%%dst_off], valw
-%elif (%2-%%dst_off) == 3
-%ifidn %1, top
- mov [r0+%%dst_off], valw2
-%elifidn %1, body
- mov [r0+%%dst_off], valw3
-%elifidn %1, bottom
- mov [r0+%%dst_off], valw4
-%endif ; %1 ==/!= top
- mov [r0+%%dst_off+2], vall
-%endif ; (%2-%%dst_off) == 1/2/3
-%endmacro ; WRITE_NUM_BYTES
-
-; vertical top/bottom extend and body copy fast loops
-; these are function pointers to set-width line copy functions, i.e.
-; they read a fixed number of pixels into set registers, and write
-; those out into the destination buffer
-; r0=buf,r1=src,r2=linesize,r3(64)/r3m(32)=start_x,r4=end_y,r5=block_h
-; r6(eax/64)/r3(ebx/32)=val_reg
-%macro VERTICAL_EXTEND 0
-%assign %%n 1
-%rep 22
-ALIGN 128
-.emuedge_v_extend_ %+ %%n:
- ; extend pixels above body
-%ifdef ARCH_X86_64
- test r3 , r3 ; if (!start_y)
- jz .emuedge_copy_body_ %+ %%n %+ _loop ; goto body
-%else ; ARCH_X86_32
- cmp dword r3m, 0
- je .emuedge_copy_body_ %+ %%n %+ _loop
-%endif ; ARCH_X86_64/32
- READ_NUM_BYTES top, %%n ; read bytes
-.emuedge_extend_top_ %+ %%n %+ _loop: ; do {
- WRITE_NUM_BYTES top, %%n ; write bytes
- add r0 , r2 ; dst += linesize
-%ifdef ARCH_X86_64
- dec r3d
-%else ; ARCH_X86_32
- dec dword r3m
-%endif ; ARCH_X86_64/32
- jnz .emuedge_extend_top_ %+ %%n %+ _loop ; } while (--start_y)
-
- ; copy body pixels
-.emuedge_copy_body_ %+ %%n %+ _loop: ; do {
- READ_NUM_BYTES body, %%n ; read bytes
- WRITE_NUM_BYTES body, %%n ; write bytes
- add r0 , r2 ; dst += linesize
- add r1 , r2 ; src += linesize
- dec r4d
- jnz .emuedge_copy_body_ %+ %%n %+ _loop ; } while (--end_y)
-
- ; copy bottom pixels
- test r5 , r5 ; if (!block_h)
- jz .emuedge_v_extend_end_ %+ %%n ; goto end
- sub r1 , r2 ; src -= linesize
- READ_NUM_BYTES bottom, %%n ; read bytes
-.emuedge_extend_bottom_ %+ %%n %+ _loop: ; do {
- WRITE_NUM_BYTES bottom, %%n ; write bytes
- add r0 , r2 ; dst += linesize
- dec r5d
- jnz .emuedge_extend_bottom_ %+ %%n %+ _loop ; } while (--block_h)
-
-.emuedge_v_extend_end_ %+ %%n:
-%ifdef ARCH_X86_64
- ret
-%else ; ARCH_X86_32
- rep ret
-%endif ; ARCH_X86_64/32
-%assign %%n %%n+1
-%endrep
-%endmacro VERTICAL_EXTEND
-
-; left/right (horizontal) fast extend functions
-; these are essentially identical to the vertical extend ones above,
-; just left/right separated because number of pixels to extend is
-; obviously not the same on both sides.
-; for reading, pixels are placed in eax (x86-64) or ebx (x86-64) in the
-; lowest two bytes of the register (so val*0x0101), and are splatted
-; into each byte of mm0 as well if n_pixels >= 8
-
-%macro READ_V_PIXEL 2
- mov vall, %2
- mov valh, vall
-%if %1 >= 8
- movd mm0, vald
-%if cpuflag(mmx2)
- pshufw mm0, mm0, 0
-%else ; mmx
- punpcklwd mm0, mm0
- punpckldq mm0, mm0
-%endif ; sse
-%endif ; %1 >= 8
-%endmacro
-
-%macro WRITE_V_PIXEL 2
-%assign %%dst_off 0
-%rep %1/8
- movq [%2+%%dst_off], mm0
-%assign %%dst_off %%dst_off+8
-%endrep
-%if %1 & 4
-%if %1 >= 8
- movd [%2+%%dst_off], mm0
-%else ; %1 < 8
- mov [%2+%%dst_off] , valw
- mov [%2+%%dst_off+2], valw
-%endif ; %1 >=/< 8
-%assign %%dst_off %%dst_off+4
-%endif ; %1 & 4
-%if %1&2
- mov [%2+%%dst_off], valw
-%endif ; %1 & 2
-%endmacro
-
-; r0=buf+block_h*linesize, r1=start_x, r2=linesize, r5=block_h, r6/r3=val
-%macro LEFT_EXTEND 0
-%assign %%n 2
-%rep 11
-ALIGN 64
-.emuedge_extend_left_ %+ %%n: ; do {
- sub r0, r2 ; dst -= linesize
- READ_V_PIXEL %%n, [r0+r1] ; read pixels
- WRITE_V_PIXEL %%n, r0 ; write pixels
- dec r5
- jnz .emuedge_extend_left_ %+ %%n ; } while (--block_h)
-%ifdef ARCH_X86_64
- ret
-%else ; ARCH_X86_32
- rep ret
-%endif ; ARCH_X86_64/32
-%assign %%n %%n+2
-%endrep
-%endmacro ; LEFT_EXTEND
-
-; r3/r0=buf+block_h*linesize, r2=linesize, r11/r5=block_h, r0/r6=end_x, r6/r3=val
-%macro RIGHT_EXTEND 0
-%assign %%n 2
-%rep 11
-ALIGN 64
-.emuedge_extend_right_ %+ %%n: ; do {
-%ifdef ARCH_X86_64
- sub r3, r2 ; dst -= linesize
- READ_V_PIXEL %%n, [r3+w_reg-1] ; read pixels
- WRITE_V_PIXEL %%n, r3+r4-%%n ; write pixels
- dec r11
-%else ; ARCH_X86_32
- sub r0, r2 ; dst -= linesize
- READ_V_PIXEL %%n, [r0+w_reg-1] ; read pixels
- WRITE_V_PIXEL %%n, r0+r4-%%n ; write pixels
- dec r5
-%endif ; ARCH_X86_64/32
- jnz .emuedge_extend_right_ %+ %%n ; } while (--block_h)
-%ifdef ARCH_X86_64
- ret
-%else ; ARCH_X86_32
- rep ret
-%endif ; ARCH_X86_64/32
-%assign %%n %%n+2
-%endrep
-
-%ifdef ARCH_X86_32
-%define stack_offset 0x10
-%endif
-%endmacro ; RIGHT_EXTEND
-
-; below follow the "slow" copy/extend functions, these act on a non-fixed
-; width specified in a register, and run a loop to copy the full amount
-; of bytes. They are optimized for copying of large amounts of pixels per
-; line, so they unconditionally splat data into mm registers to copy 8
-; bytes per loop iteration. It could be considered to use xmm for x86-64
-; also, but I haven't optimized this as much (i.e. FIXME)
-%macro V_COPY_NPX 4-5
-%if %0 == 4
- test w_reg, %4
- jz .%1_skip_%4_px
-%else ; %0 == 5
-.%1_%4_px_loop:
-%endif
- %3 %2, [r1+cnt_reg]
- %3 [r0+cnt_reg], %2
- add cnt_reg, %4
-%if %0 == 5
- sub w_reg, %4
- test w_reg, %5
- jnz .%1_%4_px_loop
-%endif
-.%1_skip_%4_px:
-%endmacro
-
-%macro V_COPY_ROW 2
-%ifidn %1, bottom
- sub r1, linesize
-%endif
-.%1_copy_loop:
- xor cnt_reg, cnt_reg
-%if notcpuflag(sse)
-%define linesize r2m
- V_COPY_NPX %1, mm0, movq, 8, 0xFFFFFFF8
-%else ; sse
- V_COPY_NPX %1, xmm0, movups, 16, 0xFFFFFFF0
-%ifdef ARCH_X86_64
-%define linesize r2
- V_COPY_NPX %1, rax , mov, 8
-%else ; ARCH_X86_32
-%define linesize r2m
- V_COPY_NPX %1, mm0, movq, 8
-%endif ; ARCH_X86_64/32
-%endif ; sse
- V_COPY_NPX %1, vald, mov, 4
- V_COPY_NPX %1, valw, mov, 2
- V_COPY_NPX %1, vall, mov, 1
- mov w_reg, cnt_reg
-%ifidn %1, body
- add r1, linesize
-%endif
- add r0, linesize
- dec %2
- jnz .%1_copy_loop
-%endmacro
-
-%macro SLOW_V_EXTEND 0
-.slow_v_extend_loop:
-; r0=buf,r1=src,r2(64)/r2m(32)=linesize,r3(64)/r3m(32)=start_x,r4=end_y,r5=block_h
-; r11(64)/r3(later-64)/r2(32)=cnt_reg,r6(64)/r3(32)=val_reg,r10(64)/r6(32)=w=end_x-start_x
-%ifdef ARCH_X86_64
- push r11 ; save old value of block_h
- test r3, r3
-%define cnt_reg r11
- jz .do_body_copy ; if (!start_y) goto do_body_copy
- V_COPY_ROW top, r3
-%else
- cmp dword r3m, 0
-%define cnt_reg r2
- je .do_body_copy ; if (!start_y) goto do_body_copy
- V_COPY_ROW top, dword r3m
-%endif
-
-.do_body_copy:
- V_COPY_ROW body, r4
-
-%ifdef ARCH_X86_64
- pop r11 ; restore old value of block_h
-%define cnt_reg r3
-%endif
- test r5, r5
-%ifdef ARCH_X86_64
- jz .v_extend_end
-%else
- jz .skip_bottom_extend
-%endif
- V_COPY_ROW bottom, r5
-%ifdef ARCH_X86_32
-.skip_bottom_extend:
- mov r2, r2m
-%endif
- jmp .v_extend_end
-%endmacro
-
-%macro SLOW_LEFT_EXTEND 0
-.slow_left_extend_loop:
-; r0=buf+block_h*linesize,r2=linesize,r6(64)/r3(32)=val,r5=block_h,r4=cntr,r10/r6=start_x
- mov r4, 8
- sub r0, linesize
- READ_V_PIXEL 8, [r0+w_reg]
-.left_extend_8px_loop:
- movq [r0+r4-8], mm0
- add r4, 8
- cmp r4, w_reg
- jle .left_extend_8px_loop
- sub r4, 8
- cmp r4, w_reg
- jge .left_extend_loop_end
-.left_extend_2px_loop:
- mov [r0+r4], valw
- add r4, 2
- cmp r4, w_reg
- jl .left_extend_2px_loop
-.left_extend_loop_end:
- dec r5
- jnz .slow_left_extend_loop
-%ifdef ARCH_X86_32
- mov r2, r2m
-%endif
- jmp .right_extend
-%endmacro
-
-%macro SLOW_RIGHT_EXTEND 0
-.slow_right_extend_loop:
-; r3(64)/r0(32)=buf+block_h*linesize,r2=linesize,r4=block_w,r11(64)/r5(32)=block_h,
-; r10(64)/r6(32)=end_x,r6/r3=val,r1=cntr
-%ifdef ARCH_X86_64
-%define buf_reg r3
-%define bh_reg r11
-%else
-%define buf_reg r0
-%define bh_reg r5
-%endif
- lea r1, [r4-8]
- sub buf_reg, linesize
- READ_V_PIXEL 8, [buf_reg+w_reg-1]
-.right_extend_8px_loop:
- movq [buf_reg+r1], mm0
- sub r1, 8
- cmp r1, w_reg
- jge .right_extend_8px_loop
- add r1, 8
- cmp r1, w_reg
- je .right_extend_loop_end
-.right_extend_2px_loop:
- sub r1, 2
- mov [buf_reg+r1], valw
- cmp r1, w_reg
- jg .right_extend_2px_loop
-.right_extend_loop_end:
- dec bh_reg
- jnz .slow_right_extend_loop
- jmp .h_extend_end
-%endmacro
-
-%macro emu_edge 1
-INIT_XMM %1
-EMU_EDGE_FUNC
-VERTICAL_EXTEND
-LEFT_EXTEND
-RIGHT_EXTEND
-SLOW_V_EXTEND
-SLOW_LEFT_EXTEND
-SLOW_RIGHT_EXTEND
-%endmacro
-
-emu_edge sse
-%ifdef ARCH_X86_32
-emu_edge mmx
-%endif
-
-;-----------------------------------------------------------------------------
-; void ff_vector_clip_int32(int32_t *dst, const int32_t *src, int32_t min,
-; int32_t max, unsigned int len)
-;-----------------------------------------------------------------------------
-
-; %1 = number of xmm registers used
-; %2 = number of inline load/process/store loops per asm loop
-; %3 = process 4*mmsize (%3=0) or 8*mmsize (%3=1) bytes per loop
-; %4 = CLIPD function takes min/max as float instead of int (CLIPD_SSE2)
-; %5 = suffix
-%macro VECTOR_CLIP_INT32 4-5
-cglobal vector_clip_int32%5, 5,5,%2, dst, src, min, max, len
-%if %4
- cvtsi2ss m4, minm
- cvtsi2ss m5, maxm
-%else
- movd m4, minm
- movd m5, maxm
-%endif
- SPLATD m4
- SPLATD m5
-.loop:
-%assign %%i 1
-%rep %2
- mova m0, [srcq+mmsize*0*%%i]
- mova m1, [srcq+mmsize*1*%%i]
- mova m2, [srcq+mmsize*2*%%i]
- mova m3, [srcq+mmsize*3*%%i]
-%if %3
- mova m7, [srcq+mmsize*4*%%i]
- mova m8, [srcq+mmsize*5*%%i]
- mova m9, [srcq+mmsize*6*%%i]
- mova m10, [srcq+mmsize*7*%%i]
-%endif
- CLIPD m0, m4, m5, m6
- CLIPD m1, m4, m5, m6
- CLIPD m2, m4, m5, m6
- CLIPD m3, m4, m5, m6
-%if %3
- CLIPD m7, m4, m5, m6
- CLIPD m8, m4, m5, m6
- CLIPD m9, m4, m5, m6
- CLIPD m10, m4, m5, m6
-%endif
- mova [dstq+mmsize*0*%%i], m0
- mova [dstq+mmsize*1*%%i], m1
- mova [dstq+mmsize*2*%%i], m2
- mova [dstq+mmsize*3*%%i], m3
-%if %3
- mova [dstq+mmsize*4*%%i], m7
- mova [dstq+mmsize*5*%%i], m8
- mova [dstq+mmsize*6*%%i], m9
- mova [dstq+mmsize*7*%%i], m10
-%endif
-%assign %%i %%i+1
-%endrep
- add srcq, mmsize*4*(%2+%3)
- add dstq, mmsize*4*(%2+%3)
- sub lend, mmsize*(%2+%3)
- jg .loop
- REP_RET
-%endmacro
-
-INIT_MMX mmx
-%define SPLATD SPLATD_MMX
-%define CLIPD CLIPD_MMX
-VECTOR_CLIP_INT32 0, 1, 0, 0
-INIT_XMM sse2
-%define SPLATD SPLATD_SSE2
-VECTOR_CLIP_INT32 6, 1, 0, 0, _int
-%define CLIPD CLIPD_SSE2
-VECTOR_CLIP_INT32 6, 2, 0, 1
-INIT_XMM sse4
-%define CLIPD CLIPD_SSE41
-%ifdef m8
-VECTOR_CLIP_INT32 11, 1, 1, 0
-%else
-VECTOR_CLIP_INT32 6, 1, 0, 0
-%endif
-
-;-----------------------------------------------------------------------------
-; void ff_butterflies_float_interleave(float *dst, const float *src0,
-; const float *src1, int len);
-;-----------------------------------------------------------------------------
-
-%macro BUTTERFLIES_FLOAT_INTERLEAVE 0
-cglobal butterflies_float_interleave, 4,4,3, dst, src0, src1, len
-%ifdef ARCH_X86_64
- movsxd lenq, lend
-%endif
- test lenq, lenq
- jz .end
- shl lenq, 2
- lea src0q, [src0q + lenq]
- lea src1q, [src1q + lenq]
- lea dstq, [ dstq + 2*lenq]
- neg lenq
-.loop:
- mova m0, [src0q + lenq]
- mova m1, [src1q + lenq]
- subps m2, m0, m1
- addps m0, m0, m1
- unpcklps m1, m0, m2
- unpckhps m0, m0, m2
-%if cpuflag(avx)
- vextractf128 [dstq + 2*lenq ], m1, 0
- vextractf128 [dstq + 2*lenq + 16], m0, 0
- vextractf128 [dstq + 2*lenq + 32], m1, 1
- vextractf128 [dstq + 2*lenq + 48], m0, 1
-%else
- mova [dstq + 2*lenq ], m1
- mova [dstq + 2*lenq + mmsize], m0
-%endif
- add lenq, mmsize
- jl .loop
-%if mmsize == 32
- vzeroupper
- RET
-%endif
-.end:
- REP_RET
-%endmacro
-
-INIT_XMM sse
-BUTTERFLIES_FLOAT_INTERLEAVE
-INIT_YMM avx
-BUTTERFLIES_FLOAT_INTERLEAVE
diff --git a/gst-libs/ext/libav/libavcodec/x86/dsputilenc.asm b/gst-libs/ext/libav/libavcodec/x86/dsputilenc.asm
new file mode 100644
index 0000000..104ec58
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/x86/dsputilenc.asm
@@ -0,0 +1,339 @@
+;*****************************************************************************
+;* MMX optimized DSP utils
+;*****************************************************************************
+;* Copyright (c) 2000, 2001 Fabrice Bellard
+;* Copyright (c) 2002-2004 Michael Niedermayer <michaelni@gmx.at>
+;*
+;* 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
+;*****************************************************************************
+
+%include "libavutil/x86/x86util.asm"
+
+SECTION .text
+
+%macro DIFF_PIXELS_1 4
+ movh %1, %3
+ movh %2, %4
+ punpcklbw %2, %1
+ punpcklbw %1, %1
+ psubw %1, %2
+%endmacro
+
+; %1=uint8_t *pix1, %2=uint8_t *pix2, %3=static offset, %4=stride, %5=stride*3
+; %6=temporary storage location
+; this macro requires $mmsize stack space (aligned) on %6 (except on SSE+x86-64)
+%macro DIFF_PIXELS_8 6
+ DIFF_PIXELS_1 m0, m7, [%1 +%3], [%2 +%3]
+ DIFF_PIXELS_1 m1, m7, [%1+%4 +%3], [%2+%4 +%3]
+ DIFF_PIXELS_1 m2, m7, [%1+%4*2+%3], [%2+%4*2+%3]
+ add %1, %5
+ add %2, %5
+ DIFF_PIXELS_1 m3, m7, [%1 +%3], [%2 +%3]
+ DIFF_PIXELS_1 m4, m7, [%1+%4 +%3], [%2+%4 +%3]
+ DIFF_PIXELS_1 m5, m7, [%1+%4*2+%3], [%2+%4*2+%3]
+ DIFF_PIXELS_1 m6, m7, [%1+%5 +%3], [%2+%5 +%3]
+%ifdef m8
+ DIFF_PIXELS_1 m7, m8, [%1+%4*4+%3], [%2+%4*4+%3]
+%else
+ mova [%6], m0
+ DIFF_PIXELS_1 m7, m0, [%1+%4*4+%3], [%2+%4*4+%3]
+ mova m0, [%6]
+%endif
+ sub %1, %5
+ sub %2, %5
+%endmacro
+
+%macro HADAMARD8 0
+ SUMSUB_BADC w, 0, 1, 2, 3
+ SUMSUB_BADC w, 4, 5, 6, 7
+ SUMSUB_BADC w, 0, 2, 1, 3
+ SUMSUB_BADC w, 4, 6, 5, 7
+ SUMSUB_BADC w, 0, 4, 1, 5
+ SUMSUB_BADC w, 2, 6, 3, 7
+%endmacro
+
+%macro ABS1_SUM 3
+ ABS1 %1, %2
+ paddusw %3, %1
+%endmacro
+
+%macro ABS2_SUM 6
+ ABS2 %1, %2, %3, %4
+ paddusw %5, %1
+ paddusw %6, %2
+%endmacro
+
+%macro ABS_SUM_8x8_64 1
+ ABS2 m0, m1, m8, m9
+ ABS2_SUM m2, m3, m8, m9, m0, m1
+ ABS2_SUM m4, m5, m8, m9, m0, m1
+ ABS2_SUM m6, m7, m8, m9, m0, m1
+ paddusw m0, m1
+%endmacro
+
+%macro ABS_SUM_8x8_32 1
+ mova [%1], m7
+ ABS1 m0, m7
+ ABS1 m1, m7
+ ABS1_SUM m2, m7, m0
+ ABS1_SUM m3, m7, m1
+ ABS1_SUM m4, m7, m0
+ ABS1_SUM m5, m7, m1
+ ABS1_SUM m6, m7, m0
+ mova m2, [%1]
+ ABS1_SUM m2, m7, m1
+ paddusw m0, m1
+%endmacro
+
+; FIXME: HSUM saturates at 64k, while an 8x8 hadamard or dct block can get up to
+; about 100k on extreme inputs. But that's very unlikely to occur in natural video,
+; and it's even more unlikely to not have any alternative mvs/modes with lower cost.
+%macro HSUM 3
+%if cpuflag(sse2)
+ movhlps %2, %1
+ paddusw %1, %2
+ pshuflw %2, %1, 0xE
+ paddusw %1, %2
+ pshuflw %2, %1, 0x1
+ paddusw %1, %2
+ movd %3, %1
+%elif cpuflag(mmxext)
+ pshufw %2, %1, 0xE
+ paddusw %1, %2
+ pshufw %2, %1, 0x1
+ paddusw %1, %2
+ movd %3, %1
+%elif cpuflag(mmx)
+ mova %2, %1
+ psrlq %1, 32
+ paddusw %1, %2
+ mova %2, %1
+ psrlq %1, 16
+ paddusw %1, %2
+ movd %3, %1
+%endif
+%endmacro
+
+%macro STORE4 5
+ mova [%1+mmsize*0], %2
+ mova [%1+mmsize*1], %3
+ mova [%1+mmsize*2], %4
+ mova [%1+mmsize*3], %5
+%endmacro
+
+%macro LOAD4 5
+ mova %2, [%1+mmsize*0]
+ mova %3, [%1+mmsize*1]
+ mova %4, [%1+mmsize*2]
+ mova %5, [%1+mmsize*3]
+%endmacro
+
+%macro hadamard8_16_wrapper 2
+cglobal hadamard8_diff, 4, 4, %1
+%ifndef m8
+ %assign pad %2*mmsize-(4+stack_offset&(mmsize-1))
+ SUB rsp, pad
+%endif
+ call hadamard8x8_diff %+ SUFFIX
+%ifndef m8
+ ADD rsp, pad
+%endif
+ RET
+
+cglobal hadamard8_diff16, 5, 6, %1
+%ifndef m8
+ %assign pad %2*mmsize-(4+stack_offset&(mmsize-1))
+ SUB rsp, pad
+%endif
+
+ call hadamard8x8_diff %+ SUFFIX
+ mov r5d, eax
+
+ add r1, 8
+ add r2, 8
+ call hadamard8x8_diff %+ SUFFIX
+ add r5d, eax
+
+ cmp r4d, 16
+ jne .done
+
+ lea r1, [r1+r3*8-8]
+ lea r2, [r2+r3*8-8]
+ call hadamard8x8_diff %+ SUFFIX
+ add r5d, eax
+
+ add r1, 8
+ add r2, 8
+ call hadamard8x8_diff %+ SUFFIX
+ add r5d, eax
+
+.done:
+ mov eax, r5d
+%ifndef m8
+ ADD rsp, pad
+%endif
+ RET
+%endmacro
+
+%macro HADAMARD8_DIFF 0-1
+%if cpuflag(sse2)
+hadamard8x8_diff %+ SUFFIX:
+ lea r0, [r3*3]
+ DIFF_PIXELS_8 r1, r2, 0, r3, r0, rsp+gprsize
+ HADAMARD8
+%if ARCH_X86_64
+ TRANSPOSE8x8W 0, 1, 2, 3, 4, 5, 6, 7, 8
+%else
+ TRANSPOSE8x8W 0, 1, 2, 3, 4, 5, 6, 7, [rsp+gprsize], [rsp+mmsize+gprsize]
+%endif
+ HADAMARD8
+ ABS_SUM_8x8 rsp+gprsize
+ HSUM m0, m1, eax
+ and eax, 0xFFFF
+ ret
+
+hadamard8_16_wrapper %1, 3
+%elif cpuflag(mmx)
+ALIGN 16
+; int hadamard8_diff_##cpu(void *s, uint8_t *src1, uint8_t *src2,
+; int stride, int h)
+; r0 = void *s = unused, int h = unused (always 8)
+; note how r1, r2 and r3 are not clobbered in this function, so 16x16
+; can simply call this 2x2x (and that's why we access rsp+gprsize
+; everywhere, which is rsp of calling func
+hadamard8x8_diff %+ SUFFIX:
+ lea r0, [r3*3]
+
+ ; first 4x8 pixels
+ DIFF_PIXELS_8 r1, r2, 0, r3, r0, rsp+gprsize+0x60
+ HADAMARD8
+ mova [rsp+gprsize+0x60], m7
+ TRANSPOSE4x4W 0, 1, 2, 3, 7
+ STORE4 rsp+gprsize, m0, m1, m2, m3
+ mova m7, [rsp+gprsize+0x60]
+ TRANSPOSE4x4W 4, 5, 6, 7, 0
+ STORE4 rsp+gprsize+0x40, m4, m5, m6, m7
+
+ ; second 4x8 pixels
+ DIFF_PIXELS_8 r1, r2, 4, r3, r0, rsp+gprsize+0x60
+ HADAMARD8
+ mova [rsp+gprsize+0x60], m7
+ TRANSPOSE4x4W 0, 1, 2, 3, 7
+ STORE4 rsp+gprsize+0x20, m0, m1, m2, m3
+ mova m7, [rsp+gprsize+0x60]
+ TRANSPOSE4x4W 4, 5, 6, 7, 0
+
+ LOAD4 rsp+gprsize+0x40, m0, m1, m2, m3
+ HADAMARD8
+ ABS_SUM_8x8_32 rsp+gprsize+0x60
+ mova [rsp+gprsize+0x60], m0
+
+ LOAD4 rsp+gprsize , m0, m1, m2, m3
+ LOAD4 rsp+gprsize+0x20, m4, m5, m6, m7
+ HADAMARD8
+ ABS_SUM_8x8_32 rsp+gprsize
+ paddusw m0, [rsp+gprsize+0x60]
+
+ HSUM m0, m1, eax
+ and rax, 0xFFFF
+ ret
+
+hadamard8_16_wrapper 0, 14
+%endif
+%endmacro
+
+INIT_MMX mmx
+%define ABS1 ABS1_MMX
+HADAMARD8_DIFF
+
+INIT_MMX mmxext
+%define ABS1 ABS1_MMXEXT
+HADAMARD8_DIFF
+
+INIT_XMM sse2
+%define ABS2 ABS2_MMXEXT
+%if ARCH_X86_64
+%define ABS_SUM_8x8 ABS_SUM_8x8_64
+%else
+%define ABS_SUM_8x8 ABS_SUM_8x8_32
+%endif
+HADAMARD8_DIFF 10
+
+INIT_XMM ssse3
+%define ABS2 ABS2_SSSE3
+%define ABS_SUM_8x8 ABS_SUM_8x8_64
+HADAMARD8_DIFF 9
+
+INIT_XMM sse2
+; sse16_sse2(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int h)
+cglobal sse16, 5, 5, 8
+ shr r4d, 1
+ pxor m0, m0 ; mm0 = 0
+ pxor m7, m7 ; mm7 holds the sum
+
+.next2lines: ; FIXME why are these unaligned movs? pix1[] is aligned
+ movu m1, [r1 ] ; mm1 = pix1[0][0-15]
+ movu m2, [r2 ] ; mm2 = pix2[0][0-15]
+ movu m3, [r1+r3] ; mm3 = pix1[1][0-15]
+ movu m4, [r2+r3] ; mm4 = pix2[1][0-15]
+
+ ; todo: mm1-mm2, mm3-mm4
+ ; algo: subtract mm1 from mm2 with saturation and vice versa
+ ; OR the result to get the absolute difference
+ mova m5, m1
+ mova m6, m3
+ psubusb m1, m2
+ psubusb m3, m4
+ psubusb m2, m5
+ psubusb m4, m6
+
+ por m2, m1
+ por m4, m3
+
+ ; now convert to 16-bit vectors so we can square them
+ mova m1, m2
+ mova m3, m4
+
+ punpckhbw m2, m0
+ punpckhbw m4, m0
+ punpcklbw m1, m0 ; mm1 not spread over (mm1,mm2)
+ punpcklbw m3, m0 ; mm4 not spread over (mm3,mm4)
+
+ pmaddwd m2, m2
+ pmaddwd m4, m4
+ pmaddwd m1, m1
+ pmaddwd m3, m3
+
+ lea r1, [r1+r3*2] ; pix1 += 2*line_size
+ lea r2, [r2+r3*2] ; pix2 += 2*line_size
+
+ paddd m1, m2
+ paddd m3, m4
+ paddd m7, m1
+ paddd m7, m3
+
+ dec r4
+ jnz .next2lines
+
+ mova m1, m7
+ psrldq m7, 8 ; shift hi qword to lo
+ paddd m7, m1
+ mova m1, m7
+ psrldq m7, 4 ; shift hi dword to lo
+ paddd m7, m1
+ movd eax, m7 ; return value
+ RET
diff --git a/gst-libs/ext/libav/libavcodec/x86/dsputilenc_mmx.c b/gst-libs/ext/libav/libavcodec/x86/dsputilenc_mmx.c
index 7362234..e5d2473 100644
--- a/gst-libs/ext/libav/libavcodec/x86/dsputilenc_mmx.c
+++ b/gst-libs/ext/libav/libavcodec/x86/dsputilenc_mmx.c
@@ -23,13 +23,16 @@
*/
#include "libavutil/cpu.h"
-#include "libavutil/x86_cpu.h"
+#include "libavutil/x86/asm.h"
+#include "libavutil/x86/cpu.h"
#include "libavcodec/dsputil.h"
#include "libavcodec/mpegvideo.h"
#include "libavcodec/mathops.h"
#include "dsputil_mmx.h"
+#if HAVE_INLINE_ASM
+
static void get_pixels_mmx(DCTELEM *block, const uint8_t *pixels, int line_size)
{
__asm__ volatile(
@@ -323,8 +326,6 @@ static int sse16_mmx(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int
return tmp;
}
-int ff_sse16_sse2(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int h);
-
static int hf_noise8_mmx(uint8_t * pix1, int line_size, int h) {
int tmp;
__asm__ volatile (
@@ -646,7 +647,9 @@ static int vsad_intra16_mmx(void *v, uint8_t * pix, uint8_t * dummy, int line_si
}
#undef SUM
-static int vsad_intra16_mmx2(void *v, uint8_t * pix, uint8_t * dummy, int line_size, int h) {
+static int vsad_intra16_mmxext(void *v, uint8_t *pix, uint8_t *dummy,
+ int line_size, int h)
+{
int tmp;
assert( (((int)pix) & 7) == 0);
@@ -764,7 +767,9 @@ static int vsad16_mmx(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, in
}
#undef SUM
-static int vsad16_mmx2(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int h) {
+static int vsad16_mmxext(void *v, uint8_t *pix1, uint8_t *pix2,
+ int line_size, int h)
+{
int tmp;
assert( (((int)pix1) & 7) == 0);
@@ -843,13 +848,17 @@ static void diff_bytes_mmx(uint8_t *dst, uint8_t *src1, uint8_t *src2, int w){
dst[i+0] = src1[i+0]-src2[i+0];
}
-static void sub_hfyu_median_prediction_mmx2(uint8_t *dst, const uint8_t *src1, const uint8_t *src2, int w, int *left, int *left_top){
+static void sub_hfyu_median_prediction_mmxext(uint8_t *dst, const uint8_t *src1,
+ const uint8_t *src2, int w,
+ int *left, int *left_top)
+{
x86_reg i=0;
uint8_t l, lt;
__asm__ volatile(
+ "movq (%1, %0), %%mm0 \n\t" // LT
+ "psllq $8, %%mm0 \n\t"
"1: \n\t"
- "movq -1(%1, %0), %%mm0 \n\t" // LT
"movq (%1, %0), %%mm1 \n\t" // T
"movq -1(%2, %0), %%mm2 \n\t" // L
"movq (%2, %0), %%mm3 \n\t" // X
@@ -864,6 +873,7 @@ static void sub_hfyu_median_prediction_mmx2(uint8_t *dst, const uint8_t *src1, c
"psubb %%mm4, %%mm3 \n\t" // dst - pred
"movq %%mm3, (%3, %0) \n\t"
"add $8, %0 \n\t"
+ "movq -1(%1, %0), %%mm0 \n\t" // LT
"cmp %4, %0 \n\t"
" jb 1b \n\t"
: "+r" (i)
@@ -885,7 +895,7 @@ static void sub_hfyu_median_prediction_mmx2(uint8_t *dst, const uint8_t *src1, c
"pxor " #z ", " #a " \n\t"\
"psubw " #z ", " #a " \n\t"
-#define MMABS_MMX2(a,z)\
+#define MMABS_MMXEXT(a, z) \
"pxor " #z ", " #z " \n\t"\
"psubw " #a ", " #z " \n\t"\
"pmaxsw " #z ", " #a " \n\t"
@@ -909,7 +919,7 @@ static void sub_hfyu_median_prediction_mmx2(uint8_t *dst, const uint8_t *src1, c
"paddusw "#t", "#a" \n\t"\
"movd "#a", "#dst" \n\t"\
-#define HSUM_MMX2(a, t, dst)\
+#define HSUM_MMXEXT(a, t, dst) \
"pshufw $0x0E, "#a", "#t" \n\t"\
"paddusw "#t", "#a" \n\t"\
"pshufw $0x01, "#a", "#t" \n\t"\
@@ -925,17 +935,6 @@ static void sub_hfyu_median_prediction_mmx2(uint8_t *dst, const uint8_t *src1, c
"paddusw "#t", "#a" \n\t"\
"movd "#a", "#dst" \n\t"\
-#define hadamard_func(cpu) \
-int ff_hadamard8_diff_##cpu (void *s, uint8_t *src1, uint8_t *src2, \
- int stride, int h); \
-int ff_hadamard8_diff16_##cpu(void *s, uint8_t *src1, uint8_t *src2, \
- int stride, int h);
-
-hadamard_func(mmx)
-hadamard_func(mmx2)
-hadamard_func(sse2)
-hadamard_func(ssse3)
-
#define DCT_SAD4(m,mm,o)\
"mov"#m" "#o"+ 0(%1), "#mm"2 \n\t"\
"mov"#m" "#o"+16(%1), "#mm"3 \n\t"\
@@ -982,9 +981,9 @@ DCT_SAD_FUNC(mmx)
#undef MMABS
#undef HSUM
-#define HSUM(a,t,dst) HSUM_MMX2(a,t,dst)
-#define MMABS(a,z) MMABS_MMX2(a,z)
-DCT_SAD_FUNC(mmx2)
+#define HSUM(a,t,dst) HSUM_MMXEXT(a,t,dst)
+#define MMABS(a,z) MMABS_MMXEXT(a,z)
+DCT_SAD_FUNC(mmxext)
#undef HSUM
#undef DCT_SAD
@@ -993,7 +992,7 @@ DCT_SAD_FUNC(mmx2)
DCT_SAD_FUNC(sse2)
#undef MMABS
-#if HAVE_SSSE3
+#if HAVE_SSSE3_INLINE
#define MMABS(a,z) MMABS_SSSE3(a,z)
DCT_SAD_FUNC(ssse3)
#undef MMABS
@@ -1052,7 +1051,7 @@ static int ssd_int8_vs_int16_mmx(const int8_t *pix1, const int16_t *pix2, int si
#define SET_RND MOVQ_WONE
#define SCALE_OFFSET 1
-#include "dsputil_mmx_qns_template.c"
+#include "dsputil_qns_template.c"
#undef DEF
#undef SET_RND
@@ -1066,14 +1065,14 @@ static int ssd_int8_vs_int16_mmx(const int8_t *pix1, const int16_t *pix2, int si
"pmulhrw " #s ", "#x " \n\t"\
"pmulhrw " #s ", "#y " \n\t"
-#include "dsputil_mmx_qns_template.c"
+#include "dsputil_qns_template.c"
#undef DEF
#undef SET_RND
#undef SCALE_OFFSET
#undef PMULHRW
-#if HAVE_SSSE3
+#if HAVE_SSSE3_INLINE
#undef PHADDD
#define DEF(x) x ## _ssse3
#define SET_RND(x)
@@ -1085,19 +1084,35 @@ static int ssd_int8_vs_int16_mmx(const int8_t *pix1, const int16_t *pix2, int si
"pmulhrsw " #s ", "#x " \n\t"\
"pmulhrsw " #s ", "#y " \n\t"
-#include "dsputil_mmx_qns_template.c"
+#include "dsputil_qns_template.c"
#undef DEF
#undef SET_RND
#undef SCALE_OFFSET
#undef PMULHRW
#undef PHADDD
-#endif //HAVE_SSSE3
+#endif /* HAVE_SSSE3_INLINE */
+
+#endif /* HAVE_INLINE_ASM */
+int ff_sse16_sse2(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int h);
-void dsputilenc_init_mmx(DSPContext* c, AVCodecContext *avctx)
+#define hadamard_func(cpu) \
+int ff_hadamard8_diff_##cpu (void *s, uint8_t *src1, uint8_t *src2, \
+ int stride, int h); \
+int ff_hadamard8_diff16_##cpu(void *s, uint8_t *src1, uint8_t *src2, \
+ int stride, int h);
+
+hadamard_func(mmx)
+hadamard_func(mmxext)
+hadamard_func(sse2)
+hadamard_func(ssse3)
+
+void ff_dsputilenc_init_mmx(DSPContext* c, AVCodecContext *avctx)
{
int mm_flags = av_get_cpu_flags();
+
+#if HAVE_INLINE_ASM
int bit_depth = avctx->bits_per_raw_sample;
if (mm_flags & AV_CPU_FLAG_MMX) {
@@ -1106,8 +1121,8 @@ void dsputilenc_init_mmx(DSPContext* c, AVCodecContext *avctx)
(dct_algo==FF_DCT_AUTO || dct_algo==FF_DCT_MMX)) {
if(mm_flags & AV_CPU_FLAG_SSE2){
c->fdct = ff_fdct_sse2;
- }else if(mm_flags & AV_CPU_FLAG_MMX2){
- c->fdct = ff_fdct_mmx2;
+ } else if (mm_flags & AV_CPU_FLAG_MMXEXT) {
+ c->fdct = ff_fdct_mmxext;
}else{
c->fdct = ff_fdct_mmx;
}
@@ -1121,14 +1136,9 @@ void dsputilenc_init_mmx(DSPContext* c, AVCodecContext *avctx)
c->diff_bytes= diff_bytes_mmx;
c->sum_abs_dctelem= sum_abs_dctelem_mmx;
-#if HAVE_YASM
- c->hadamard8_diff[0]= ff_hadamard8_diff16_mmx;
- c->hadamard8_diff[1]= ff_hadamard8_diff_mmx;
-#endif
-
c->pix_norm1 = pix_norm1_mmx;
- c->sse[0] = (HAVE_YASM && mm_flags & AV_CPU_FLAG_SSE2) ? ff_sse16_sse2 : sse16_mmx;
- c->sse[1] = sse8_mmx;
+ c->sse[0] = sse16_mmx;
+ c->sse[1] = sse8_mmx;
c->vsad[4]= vsad_intra16_mmx;
c->nsse[0] = nsse16_mmx;
@@ -1144,43 +1154,30 @@ void dsputilenc_init_mmx(DSPContext* c, AVCodecContext *avctx)
c->ssd_int8_vs_int16 = ssd_int8_vs_int16_mmx;
-
- if (mm_flags & AV_CPU_FLAG_MMX2) {
- c->sum_abs_dctelem= sum_abs_dctelem_mmx2;
-#if HAVE_YASM
- c->hadamard8_diff[0]= ff_hadamard8_diff16_mmx2;
- c->hadamard8_diff[1]= ff_hadamard8_diff_mmx2;
-#endif
- c->vsad[4]= vsad_intra16_mmx2;
+ if (mm_flags & AV_CPU_FLAG_MMXEXT) {
+ c->sum_abs_dctelem = sum_abs_dctelem_mmxext;
+ c->vsad[4] = vsad_intra16_mmxext;
if(!(avctx->flags & CODEC_FLAG_BITEXACT)){
- c->vsad[0] = vsad16_mmx2;
+ c->vsad[0] = vsad16_mmxext;
}
- c->sub_hfyu_median_prediction= sub_hfyu_median_prediction_mmx2;
+ c->sub_hfyu_median_prediction = sub_hfyu_median_prediction_mmxext;
}
if(mm_flags & AV_CPU_FLAG_SSE2){
if (bit_depth <= 8)
c->get_pixels = get_pixels_sse2;
c->sum_abs_dctelem= sum_abs_dctelem_sse2;
-#if HAVE_YASM && HAVE_ALIGNED_STACK
- c->hadamard8_diff[0]= ff_hadamard8_diff16_sse2;
- c->hadamard8_diff[1]= ff_hadamard8_diff_sse2;
-#endif
}
-#if HAVE_SSSE3
+#if HAVE_SSSE3_INLINE
if(mm_flags & AV_CPU_FLAG_SSSE3){
if(!(avctx->flags & CODEC_FLAG_BITEXACT)){
c->try_8x8basis= try_8x8basis_ssse3;
}
c->add_8x8basis= add_8x8basis_ssse3;
c->sum_abs_dctelem= sum_abs_dctelem_ssse3;
-#if HAVE_YASM && HAVE_ALIGNED_STACK
- c->hadamard8_diff[0]= ff_hadamard8_diff16_ssse3;
- c->hadamard8_diff[1]= ff_hadamard8_diff_ssse3;
-#endif
}
#endif
@@ -1191,6 +1188,31 @@ void dsputilenc_init_mmx(DSPContext* c, AVCodecContext *avctx)
c->add_8x8basis= add_8x8basis_3dnow;
}
}
+#endif /* HAVE_INLINE_ASM */
+
+ if (EXTERNAL_MMX(mm_flags)) {
+ c->hadamard8_diff[0] = ff_hadamard8_diff16_mmx;
+ c->hadamard8_diff[1] = ff_hadamard8_diff_mmx;
+
+ if (EXTERNAL_MMXEXT(mm_flags)) {
+ c->hadamard8_diff[0] = ff_hadamard8_diff16_mmxext;
+ c->hadamard8_diff[1] = ff_hadamard8_diff_mmxext;
+ }
+
+ if (EXTERNAL_SSE2(mm_flags)) {
+ c->sse[0] = ff_sse16_sse2;
+
+#if HAVE_ALIGNED_STACK
+ c->hadamard8_diff[0] = ff_hadamard8_diff16_sse2;
+ c->hadamard8_diff[1] = ff_hadamard8_diff_sse2;
+#endif
+ }
+
+ if (EXTERNAL_SSSE3(mm_flags) && HAVE_ALIGNED_STACK) {
+ c->hadamard8_diff[0] = ff_hadamard8_diff16_ssse3;
+ c->hadamard8_diff[1] = ff_hadamard8_diff_ssse3;
+ }
+ }
- dsputil_init_pix_mmx(c, avctx);
+ ff_dsputil_init_pix_mmx(c, avctx);
}
diff --git a/gst-libs/ext/libav/libavcodec/x86/dsputilenc_yasm.asm b/gst-libs/ext/libav/libavcodec/x86/dsputilenc_yasm.asm
deleted file mode 100644
index 6063ff1..0000000
--- a/gst-libs/ext/libav/libavcodec/x86/dsputilenc_yasm.asm
+++ /dev/null
@@ -1,342 +0,0 @@
-;*****************************************************************************
-;* MMX optimized DSP utils
-;*****************************************************************************
-;* Copyright (c) 2000, 2001 Fabrice Bellard
-;* Copyright (c) 2002-2004 Michael Niedermayer <michaelni@gmx.at>
-;*
-;* 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
-;*****************************************************************************
-
-%include "x86inc.asm"
-%include "x86util.asm"
-
-SECTION .text
-
-%macro DIFF_PIXELS_1 4
- movh %1, %3
- movh %2, %4
- punpcklbw %2, %1
- punpcklbw %1, %1
- psubw %1, %2
-%endmacro
-
-; %1=uint8_t *pix1, %2=uint8_t *pix2, %3=static offset, %4=stride, %5=stride*3
-; %6=temporary storage location
-; this macro requires $mmsize stack space (aligned) on %6 (except on SSE+x86-64)
-%macro DIFF_PIXELS_8 6
- DIFF_PIXELS_1 m0, m7, [%1 +%3], [%2 +%3]
- DIFF_PIXELS_1 m1, m7, [%1+%4 +%3], [%2+%4 +%3]
- DIFF_PIXELS_1 m2, m7, [%1+%4*2+%3], [%2+%4*2+%3]
- add %1, %5
- add %2, %5
- DIFF_PIXELS_1 m3, m7, [%1 +%3], [%2 +%3]
- DIFF_PIXELS_1 m4, m7, [%1+%4 +%3], [%2+%4 +%3]
- DIFF_PIXELS_1 m5, m7, [%1+%4*2+%3], [%2+%4*2+%3]
- DIFF_PIXELS_1 m6, m7, [%1+%5 +%3], [%2+%5 +%3]
-%ifdef m8
- DIFF_PIXELS_1 m7, m8, [%1+%4*4+%3], [%2+%4*4+%3]
-%else
- mova [%6], m0
- DIFF_PIXELS_1 m7, m0, [%1+%4*4+%3], [%2+%4*4+%3]
- mova m0, [%6]
-%endif
- sub %1, %5
- sub %2, %5
-%endmacro
-
-%macro HADAMARD8 0
- SUMSUB_BADC w, 0, 1, 2, 3
- SUMSUB_BADC w, 4, 5, 6, 7
- SUMSUB_BADC w, 0, 2, 1, 3
- SUMSUB_BADC w, 4, 6, 5, 7
- SUMSUB_BADC w, 0, 4, 1, 5
- SUMSUB_BADC w, 2, 6, 3, 7
-%endmacro
-
-%macro ABS1_SUM 3
- ABS1 %1, %2
- paddusw %3, %1
-%endmacro
-
-%macro ABS2_SUM 6
- ABS2 %1, %2, %3, %4
- paddusw %5, %1
- paddusw %6, %2
-%endmacro
-
-%macro ABS_SUM_8x8_64 1
- ABS2 m0, m1, m8, m9
- ABS2_SUM m2, m3, m8, m9, m0, m1
- ABS2_SUM m4, m5, m8, m9, m0, m1
- ABS2_SUM m6, m7, m8, m9, m0, m1
- paddusw m0, m1
-%endmacro
-
-%macro ABS_SUM_8x8_32 1
- mova [%1], m7
- ABS1 m0, m7
- ABS1 m1, m7
- ABS1_SUM m2, m7, m0
- ABS1_SUM m3, m7, m1
- ABS1_SUM m4, m7, m0
- ABS1_SUM m5, m7, m1
- ABS1_SUM m6, m7, m0
- mova m2, [%1]
- ABS1_SUM m2, m7, m1
- paddusw m0, m1
-%endmacro
-
-; FIXME: HSUM_* saturates at 64k, while an 8x8 hadamard or dct block can get up to
-; about 100k on extreme inputs. But that's very unlikely to occur in natural video,
-; and it's even more unlikely to not have any alternative mvs/modes with lower cost.
-%macro HSUM_MMX 3
- mova %2, %1
- psrlq %1, 32
- paddusw %1, %2
- mova %2, %1
- psrlq %1, 16
- paddusw %1, %2
- movd %3, %1
-%endmacro
-
-%macro HSUM_MMX2 3
- pshufw %2, %1, 0xE
- paddusw %1, %2
- pshufw %2, %1, 0x1
- paddusw %1, %2
- movd %3, %1
-%endmacro
-
-%macro HSUM_SSE2 3
- movhlps %2, %1
- paddusw %1, %2
- pshuflw %2, %1, 0xE
- paddusw %1, %2
- pshuflw %2, %1, 0x1
- paddusw %1, %2
- movd %3, %1
-%endmacro
-
-%macro STORE4 5
- mova [%1+mmsize*0], %2
- mova [%1+mmsize*1], %3
- mova [%1+mmsize*2], %4
- mova [%1+mmsize*3], %5
-%endmacro
-
-%macro LOAD4 5
- mova %2, [%1+mmsize*0]
- mova %3, [%1+mmsize*1]
- mova %4, [%1+mmsize*2]
- mova %5, [%1+mmsize*3]
-%endmacro
-
-%macro hadamard8_16_wrapper 3
-cglobal hadamard8_diff_%1, 4, 4, %2
-%ifndef m8
- %assign pad %3*mmsize-(4+stack_offset&(mmsize-1))
- SUB rsp, pad
-%endif
- call hadamard8x8_diff_%1
-%ifndef m8
- ADD rsp, pad
-%endif
- RET
-
-cglobal hadamard8_diff16_%1, 5, 6, %2
-%ifndef m8
- %assign pad %3*mmsize-(4+stack_offset&(mmsize-1))
- SUB rsp, pad
-%endif
-
- call hadamard8x8_diff_%1
- mov r5d, eax
-
- add r1, 8
- add r2, 8
- call hadamard8x8_diff_%1
- add r5d, eax
-
- cmp r4d, 16
- jne .done
-
- lea r1, [r1+r3*8-8]
- lea r2, [r2+r3*8-8]
- call hadamard8x8_diff_%1
- add r5d, eax
-
- add r1, 8
- add r2, 8
- call hadamard8x8_diff_%1
- add r5d, eax
-
-.done
- mov eax, r5d
-%ifndef m8
- ADD rsp, pad
-%endif
- RET
-%endmacro
-
-%macro HADAMARD8_DIFF_MMX 1
-ALIGN 16
-; int hadamard8_diff_##cpu(void *s, uint8_t *src1, uint8_t *src2,
-; int stride, int h)
-; r0 = void *s = unused, int h = unused (always 8)
-; note how r1, r2 and r3 are not clobbered in this function, so 16x16
-; can simply call this 2x2x (and that's why we access rsp+gprsize
-; everywhere, which is rsp of calling func
-hadamard8x8_diff_%1:
- lea r0, [r3*3]
-
- ; first 4x8 pixels
- DIFF_PIXELS_8 r1, r2, 0, r3, r0, rsp+gprsize+0x60
- HADAMARD8
- mova [rsp+gprsize+0x60], m7
- TRANSPOSE4x4W 0, 1, 2, 3, 7
- STORE4 rsp+gprsize, m0, m1, m2, m3
- mova m7, [rsp+gprsize+0x60]
- TRANSPOSE4x4W 4, 5, 6, 7, 0
- STORE4 rsp+gprsize+0x40, m4, m5, m6, m7
-
- ; second 4x8 pixels
- DIFF_PIXELS_8 r1, r2, 4, r3, r0, rsp+gprsize+0x60
- HADAMARD8
- mova [rsp+gprsize+0x60], m7
- TRANSPOSE4x4W 0, 1, 2, 3, 7
- STORE4 rsp+gprsize+0x20, m0, m1, m2, m3
- mova m7, [rsp+gprsize+0x60]
- TRANSPOSE4x4W 4, 5, 6, 7, 0
-
- LOAD4 rsp+gprsize+0x40, m0, m1, m2, m3
- HADAMARD8
- ABS_SUM_8x8_32 rsp+gprsize+0x60
- mova [rsp+gprsize+0x60], m0
-
- LOAD4 rsp+gprsize , m0, m1, m2, m3
- LOAD4 rsp+gprsize+0x20, m4, m5, m6, m7
- HADAMARD8
- ABS_SUM_8x8_32 rsp+gprsize
- paddusw m0, [rsp+gprsize+0x60]
-
- HSUM m0, m1, eax
- and rax, 0xFFFF
- ret
-
-hadamard8_16_wrapper %1, 0, 14
-%endmacro
-
-%macro HADAMARD8_DIFF_SSE2 2
-hadamard8x8_diff_%1:
- lea r0, [r3*3]
- DIFF_PIXELS_8 r1, r2, 0, r3, r0, rsp+gprsize
- HADAMARD8
-%ifdef ARCH_X86_64
- TRANSPOSE8x8W 0, 1, 2, 3, 4, 5, 6, 7, 8
-%else
- TRANSPOSE8x8W 0, 1, 2, 3, 4, 5, 6, 7, [rsp+gprsize], [rsp+mmsize+gprsize]
-%endif
- HADAMARD8
- ABS_SUM_8x8 rsp+gprsize
- HSUM_SSE2 m0, m1, eax
- and eax, 0xFFFF
- ret
-
-hadamard8_16_wrapper %1, %2, 3
-%endmacro
-
-INIT_MMX
-%define ABS1 ABS1_MMX
-%define HSUM HSUM_MMX
-HADAMARD8_DIFF_MMX mmx
-
-%define ABS1 ABS1_MMX2
-%define HSUM HSUM_MMX2
-HADAMARD8_DIFF_MMX mmx2
-
-INIT_XMM
-%define ABS2 ABS2_MMX2
-%ifdef ARCH_X86_64
-%define ABS_SUM_8x8 ABS_SUM_8x8_64
-%else
-%define ABS_SUM_8x8 ABS_SUM_8x8_32
-%endif
-HADAMARD8_DIFF_SSE2 sse2, 10
-
-%define ABS2 ABS2_SSSE3
-%define ABS_SUM_8x8 ABS_SUM_8x8_64
-HADAMARD8_DIFF_SSE2 ssse3, 9
-
-INIT_XMM
-; sse16_sse2(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int h)
-cglobal sse16_sse2, 5, 5, 8
- shr r4d, 1
- pxor m0, m0 ; mm0 = 0
- pxor m7, m7 ; mm7 holds the sum
-
-.next2lines ; FIXME why are these unaligned movs? pix1[] is aligned
- movu m1, [r1 ] ; mm1 = pix1[0][0-15]
- movu m2, [r2 ] ; mm2 = pix2[0][0-15]
- movu m3, [r1+r3] ; mm3 = pix1[1][0-15]
- movu m4, [r2+r3] ; mm4 = pix2[1][0-15]
-
- ; todo: mm1-mm2, mm3-mm4
- ; algo: subtract mm1 from mm2 with saturation and vice versa
- ; OR the result to get the absolute difference
- mova m5, m1
- mova m6, m3
- psubusb m1, m2
- psubusb m3, m4
- psubusb m2, m5
- psubusb m4, m6
-
- por m2, m1
- por m4, m3
-
- ; now convert to 16-bit vectors so we can square them
- mova m1, m2
- mova m3, m4
-
- punpckhbw m2, m0
- punpckhbw m4, m0
- punpcklbw m1, m0 ; mm1 not spread over (mm1,mm2)
- punpcklbw m3, m0 ; mm4 not spread over (mm3,mm4)
-
- pmaddwd m2, m2
- pmaddwd m4, m4
- pmaddwd m1, m1
- pmaddwd m3, m3
-
- lea r1, [r1+r3*2] ; pix1 += 2*line_size
- lea r2, [r2+r3*2] ; pix2 += 2*line_size
-
- paddd m1, m2
- paddd m3, m4
- paddd m7, m1
- paddd m7, m3
-
- dec r4
- jnz .next2lines
-
- mova m1, m7
- psrldq m7, 8 ; shift hi qword to lo
- paddd m7, m1
- mova m1, m7
- psrldq m7, 4 ; shift hi dword to lo
- paddd m7, m1
- movd eax, m7 ; return value
- RET
diff --git a/gst-libs/ext/libav/libavcodec/x86/fdct.c b/gst-libs/ext/libav/libavcodec/x86/fdct.c
new file mode 100644
index 0000000..b37238d
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/x86/fdct.c
@@ -0,0 +1,586 @@
+/*
+ * MMX optimized forward DCT
+ * The gcc porting is Copyright (c) 2001 Fabrice Bellard.
+ * cleanup/optimizations are Copyright (c) 2002-2004 Michael Niedermayer <michaelni@gmx.at>
+ * SSE2 optimization is Copyright (c) 2004 Denes Balatoni.
+ *
+ * from fdctam32.c - AP922 MMX(3D-Now) forward-DCT
+ *
+ * Intel Application Note AP-922 - fast, precise implementation of DCT
+ * http://developer.intel.com/vtune/cbts/appnotes.htm
+ *
+ * Also of inspiration:
+ * a page about fdct at http://www.geocities.com/ssavekar/dct.htm
+ * Skal's fdct at http://skal.planet-d.net/coding/dct.html
+ *
+ * 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
+ */
+
+#include "libavutil/common.h"
+#include "libavutil/x86/asm.h"
+#include "libavcodec/dsputil.h"
+
+#if HAVE_INLINE_ASM
+
+//////////////////////////////////////////////////////////////////////
+//
+// constants for the forward DCT
+// -----------------------------
+//
+// Be sure to check that your compiler is aligning all constants to QWORD
+// (8-byte) memory boundaries! Otherwise the unaligned memory access will
+// severely stall MMX execution.
+//
+//////////////////////////////////////////////////////////////////////
+
+#define BITS_FRW_ACC 3 //; 2 or 3 for accuracy
+#define SHIFT_FRW_COL BITS_FRW_ACC
+#define SHIFT_FRW_ROW (BITS_FRW_ACC + 17 - 3)
+#define RND_FRW_ROW (1 << (SHIFT_FRW_ROW-1))
+//#define RND_FRW_COL (1 << (SHIFT_FRW_COL-1))
+
+#define X8(x) x,x,x,x,x,x,x,x
+
+//concatenated table, for forward DCT transformation
+DECLARE_ALIGNED(16, static const int16_t, fdct_tg_all_16)[24] = {
+ X8(13036), // tg * (2<<16) + 0.5
+ X8(27146), // tg * (2<<16) + 0.5
+ X8(-21746) // tg * (2<<16) + 0.5
+};
+
+DECLARE_ALIGNED(16, static const int16_t, ocos_4_16)[8] = {
+ X8(23170) //cos * (2<<15) + 0.5
+};
+
+DECLARE_ALIGNED(16, static const int16_t, fdct_one_corr)[8] = { X8(1) };
+
+DECLARE_ALIGNED(8, static const int32_t, fdct_r_row)[2] = {RND_FRW_ROW, RND_FRW_ROW };
+
+static struct
+{
+ DECLARE_ALIGNED(16, const int32_t, fdct_r_row_sse2)[4];
+} fdct_r_row_sse2 =
+{{
+ RND_FRW_ROW, RND_FRW_ROW, RND_FRW_ROW, RND_FRW_ROW
+}};
+//DECLARE_ALIGNED(16, static const long, fdct_r_row_sse2)[4] = {RND_FRW_ROW, RND_FRW_ROW, RND_FRW_ROW, RND_FRW_ROW};
+
+DECLARE_ALIGNED(8, static const int16_t, tab_frw_01234567)[] = { // forward_dct coeff table
+ 16384, 16384, 22725, 19266,
+ 16384, 16384, 12873, 4520,
+ 21407, 8867, 19266, -4520,
+ -8867, -21407, -22725, -12873,
+ 16384, -16384, 12873, -22725,
+ -16384, 16384, 4520, 19266,
+ 8867, -21407, 4520, -12873,
+ 21407, -8867, 19266, -22725,
+
+ 22725, 22725, 31521, 26722,
+ 22725, 22725, 17855, 6270,
+ 29692, 12299, 26722, -6270,
+ -12299, -29692, -31521, -17855,
+ 22725, -22725, 17855, -31521,
+ -22725, 22725, 6270, 26722,
+ 12299, -29692, 6270, -17855,
+ 29692, -12299, 26722, -31521,
+
+ 21407, 21407, 29692, 25172,
+ 21407, 21407, 16819, 5906,
+ 27969, 11585, 25172, -5906,
+ -11585, -27969, -29692, -16819,
+ 21407, -21407, 16819, -29692,
+ -21407, 21407, 5906, 25172,
+ 11585, -27969, 5906, -16819,
+ 27969, -11585, 25172, -29692,
+
+ 19266, 19266, 26722, 22654,
+ 19266, 19266, 15137, 5315,
+ 25172, 10426, 22654, -5315,
+ -10426, -25172, -26722, -15137,
+ 19266, -19266, 15137, -26722,
+ -19266, 19266, 5315, 22654,
+ 10426, -25172, 5315, -15137,
+ 25172, -10426, 22654, -26722,
+
+ 16384, 16384, 22725, 19266,
+ 16384, 16384, 12873, 4520,
+ 21407, 8867, 19266, -4520,
+ -8867, -21407, -22725, -12873,
+ 16384, -16384, 12873, -22725,
+ -16384, 16384, 4520, 19266,
+ 8867, -21407, 4520, -12873,
+ 21407, -8867, 19266, -22725,
+
+ 19266, 19266, 26722, 22654,
+ 19266, 19266, 15137, 5315,
+ 25172, 10426, 22654, -5315,
+ -10426, -25172, -26722, -15137,
+ 19266, -19266, 15137, -26722,
+ -19266, 19266, 5315, 22654,
+ 10426, -25172, 5315, -15137,
+ 25172, -10426, 22654, -26722,
+
+ 21407, 21407, 29692, 25172,
+ 21407, 21407, 16819, 5906,
+ 27969, 11585, 25172, -5906,
+ -11585, -27969, -29692, -16819,
+ 21407, -21407, 16819, -29692,
+ -21407, 21407, 5906, 25172,
+ 11585, -27969, 5906, -16819,
+ 27969, -11585, 25172, -29692,
+
+ 22725, 22725, 31521, 26722,
+ 22725, 22725, 17855, 6270,
+ 29692, 12299, 26722, -6270,
+ -12299, -29692, -31521, -17855,
+ 22725, -22725, 17855, -31521,
+ -22725, 22725, 6270, 26722,
+ 12299, -29692, 6270, -17855,
+ 29692, -12299, 26722, -31521,
+};
+
+static struct
+{
+ DECLARE_ALIGNED(16, const int16_t, tab_frw_01234567_sse2)[256];
+} tab_frw_01234567_sse2 =
+{{
+//DECLARE_ALIGNED(16, static const int16_t, tab_frw_01234567_sse2)[] = { // forward_dct coeff table
+#define TABLE_SSE2 C4, C4, C1, C3, -C6, -C2, -C1, -C5, \
+ C4, C4, C5, C7, C2, C6, C3, -C7, \
+ -C4, C4, C7, C3, C6, -C2, C7, -C5, \
+ C4, -C4, C5, -C1, C2, -C6, C3, -C1,
+// c1..c7 * cos(pi/4) * 2^15
+#define C1 22725
+#define C2 21407
+#define C3 19266
+#define C4 16384
+#define C5 12873
+#define C6 8867
+#define C7 4520
+TABLE_SSE2
+
+#undef C1
+#undef C2
+#undef C3
+#undef C4
+#undef C5
+#undef C6
+#undef C7
+#define C1 31521
+#define C2 29692
+#define C3 26722
+#define C4 22725
+#define C5 17855
+#define C6 12299
+#define C7 6270
+TABLE_SSE2
+
+#undef C1
+#undef C2
+#undef C3
+#undef C4
+#undef C5
+#undef C6
+#undef C7
+#define C1 29692
+#define C2 27969
+#define C3 25172
+#define C4 21407
+#define C5 16819
+#define C6 11585
+#define C7 5906
+TABLE_SSE2
+
+#undef C1
+#undef C2
+#undef C3
+#undef C4
+#undef C5
+#undef C6
+#undef C7
+#define C1 26722
+#define C2 25172
+#define C3 22654
+#define C4 19266
+#define C5 15137
+#define C6 10426
+#define C7 5315
+TABLE_SSE2
+
+#undef C1
+#undef C2
+#undef C3
+#undef C4
+#undef C5
+#undef C6
+#undef C7
+#define C1 22725
+#define C2 21407
+#define C3 19266
+#define C4 16384
+#define C5 12873
+#define C6 8867
+#define C7 4520
+TABLE_SSE2
+
+#undef C1
+#undef C2
+#undef C3
+#undef C4
+#undef C5
+#undef C6
+#undef C7
+#define C1 26722
+#define C2 25172
+#define C3 22654
+#define C4 19266
+#define C5 15137
+#define C6 10426
+#define C7 5315
+TABLE_SSE2
+
+#undef C1
+#undef C2
+#undef C3
+#undef C4
+#undef C5
+#undef C6
+#undef C7
+#define C1 29692
+#define C2 27969
+#define C3 25172
+#define C4 21407
+#define C5 16819
+#define C6 11585
+#define C7 5906
+TABLE_SSE2
+
+#undef C1
+#undef C2
+#undef C3
+#undef C4
+#undef C5
+#undef C6
+#undef C7
+#define C1 31521
+#define C2 29692
+#define C3 26722
+#define C4 22725
+#define C5 17855
+#define C6 12299
+#define C7 6270
+TABLE_SSE2
+}};
+
+#define S(s) AV_TOSTRING(s) //AV_STRINGIFY is too long
+
+#define FDCT_COL(cpu, mm, mov)\
+static av_always_inline void fdct_col_##cpu(const int16_t *in, int16_t *out, int offset)\
+{\
+ __asm__ volatile (\
+ #mov" 16(%0), %%"#mm"0 \n\t" \
+ #mov" 96(%0), %%"#mm"1 \n\t" \
+ #mov" %%"#mm"0, %%"#mm"2 \n\t" \
+ #mov" 32(%0), %%"#mm"3 \n\t" \
+ "paddsw %%"#mm"1, %%"#mm"0 \n\t" \
+ #mov" 80(%0), %%"#mm"4 \n\t" \
+ "psllw $"S(SHIFT_FRW_COL)", %%"#mm"0 \n\t" \
+ #mov" (%0), %%"#mm"5 \n\t" \
+ "paddsw %%"#mm"3, %%"#mm"4 \n\t" \
+ "paddsw 112(%0), %%"#mm"5 \n\t" \
+ "psllw $"S(SHIFT_FRW_COL)", %%"#mm"4 \n\t" \
+ #mov" %%"#mm"0, %%"#mm"6 \n\t" \
+ "psubsw %%"#mm"1, %%"#mm"2 \n\t" \
+ #mov" 16(%1), %%"#mm"1 \n\t" \
+ "psubsw %%"#mm"4, %%"#mm"0 \n\t" \
+ #mov" 48(%0), %%"#mm"7 \n\t" \
+ "pmulhw %%"#mm"0, %%"#mm"1 \n\t" \
+ "paddsw 64(%0), %%"#mm"7 \n\t" \
+ "psllw $"S(SHIFT_FRW_COL)", %%"#mm"5 \n\t" \
+ "paddsw %%"#mm"4, %%"#mm"6 \n\t" \
+ "psllw $"S(SHIFT_FRW_COL)", %%"#mm"7 \n\t" \
+ #mov" %%"#mm"5, %%"#mm"4 \n\t" \
+ "psubsw %%"#mm"7, %%"#mm"5 \n\t" \
+ "paddsw %%"#mm"5, %%"#mm"1 \n\t" \
+ "paddsw %%"#mm"7, %%"#mm"4 \n\t" \
+ "por (%2), %%"#mm"1 \n\t" \
+ "psllw $"S(SHIFT_FRW_COL)"+1, %%"#mm"2 \n\t" \
+ "pmulhw 16(%1), %%"#mm"5 \n\t" \
+ #mov" %%"#mm"4, %%"#mm"7 \n\t" \
+ "psubsw 80(%0), %%"#mm"3 \n\t" \
+ "psubsw %%"#mm"6, %%"#mm"4 \n\t" \
+ #mov" %%"#mm"1, 32(%3) \n\t" \
+ "paddsw %%"#mm"6, %%"#mm"7 \n\t" \
+ #mov" 48(%0), %%"#mm"1 \n\t" \
+ "psllw $"S(SHIFT_FRW_COL)"+1, %%"#mm"3 \n\t" \
+ "psubsw 64(%0), %%"#mm"1 \n\t" \
+ #mov" %%"#mm"2, %%"#mm"6 \n\t" \
+ #mov" %%"#mm"4, 64(%3) \n\t" \
+ "paddsw %%"#mm"3, %%"#mm"2 \n\t" \
+ "pmulhw (%4), %%"#mm"2 \n\t" \
+ "psubsw %%"#mm"3, %%"#mm"6 \n\t" \
+ "pmulhw (%4), %%"#mm"6 \n\t" \
+ "psubsw %%"#mm"0, %%"#mm"5 \n\t" \
+ "por (%2), %%"#mm"5 \n\t" \
+ "psllw $"S(SHIFT_FRW_COL)", %%"#mm"1 \n\t" \
+ "por (%2), %%"#mm"2 \n\t" \
+ #mov" %%"#mm"1, %%"#mm"4 \n\t" \
+ #mov" (%0), %%"#mm"3 \n\t" \
+ "paddsw %%"#mm"6, %%"#mm"1 \n\t" \
+ "psubsw 112(%0), %%"#mm"3 \n\t" \
+ "psubsw %%"#mm"6, %%"#mm"4 \n\t" \
+ #mov" (%1), %%"#mm"0 \n\t" \
+ "psllw $"S(SHIFT_FRW_COL)", %%"#mm"3 \n\t" \
+ #mov" 32(%1), %%"#mm"6 \n\t" \
+ "pmulhw %%"#mm"1, %%"#mm"0 \n\t" \
+ #mov" %%"#mm"7, (%3) \n\t" \
+ "pmulhw %%"#mm"4, %%"#mm"6 \n\t" \
+ #mov" %%"#mm"5, 96(%3) \n\t" \
+ #mov" %%"#mm"3, %%"#mm"7 \n\t" \
+ #mov" 32(%1), %%"#mm"5 \n\t" \
+ "psubsw %%"#mm"2, %%"#mm"7 \n\t" \
+ "paddsw %%"#mm"2, %%"#mm"3 \n\t" \
+ "pmulhw %%"#mm"7, %%"#mm"5 \n\t" \
+ "paddsw %%"#mm"3, %%"#mm"0 \n\t" \
+ "paddsw %%"#mm"4, %%"#mm"6 \n\t" \
+ "pmulhw (%1), %%"#mm"3 \n\t" \
+ "por (%2), %%"#mm"0 \n\t" \
+ "paddsw %%"#mm"7, %%"#mm"5 \n\t" \
+ "psubsw %%"#mm"6, %%"#mm"7 \n\t" \
+ #mov" %%"#mm"0, 16(%3) \n\t" \
+ "paddsw %%"#mm"4, %%"#mm"5 \n\t" \
+ #mov" %%"#mm"7, 48(%3) \n\t" \
+ "psubsw %%"#mm"1, %%"#mm"3 \n\t" \
+ #mov" %%"#mm"5, 80(%3) \n\t" \
+ #mov" %%"#mm"3, 112(%3) \n\t" \
+ : \
+ : "r" (in + offset), "r" (fdct_tg_all_16), "r" (fdct_one_corr), \
+ "r" (out + offset), "r" (ocos_4_16)); \
+}
+
+FDCT_COL(mmx, mm, movq)
+FDCT_COL(sse2, xmm, movdqa)
+
+static av_always_inline void fdct_row_sse2(const int16_t *in, int16_t *out)
+{
+ __asm__ volatile(
+#define FDCT_ROW_SSE2_H1(i,t) \
+ "movq " #i "(%0), %%xmm2 \n\t" \
+ "movq " #i "+8(%0), %%xmm0 \n\t" \
+ "movdqa " #t "+32(%1), %%xmm3 \n\t" \
+ "movdqa " #t "+48(%1), %%xmm7 \n\t" \
+ "movdqa " #t "(%1), %%xmm4 \n\t" \
+ "movdqa " #t "+16(%1), %%xmm5 \n\t"
+
+#define FDCT_ROW_SSE2_H2(i,t) \
+ "movq " #i "(%0), %%xmm2 \n\t" \
+ "movq " #i "+8(%0), %%xmm0 \n\t" \
+ "movdqa " #t "+32(%1), %%xmm3 \n\t" \
+ "movdqa " #t "+48(%1), %%xmm7 \n\t"
+
+#define FDCT_ROW_SSE2(i) \
+ "movq %%xmm2, %%xmm1 \n\t" \
+ "pshuflw $27, %%xmm0, %%xmm0 \n\t" \
+ "paddsw %%xmm0, %%xmm1 \n\t" \
+ "psubsw %%xmm0, %%xmm2 \n\t" \
+ "punpckldq %%xmm2, %%xmm1 \n\t" \
+ "pshufd $78, %%xmm1, %%xmm2 \n\t" \
+ "pmaddwd %%xmm2, %%xmm3 \n\t" \
+ "pmaddwd %%xmm1, %%xmm7 \n\t" \
+ "pmaddwd %%xmm5, %%xmm2 \n\t" \
+ "pmaddwd %%xmm4, %%xmm1 \n\t" \
+ "paddd %%xmm7, %%xmm3 \n\t" \
+ "paddd %%xmm2, %%xmm1 \n\t" \
+ "paddd %%xmm6, %%xmm3 \n\t" \
+ "paddd %%xmm6, %%xmm1 \n\t" \
+ "psrad %3, %%xmm3 \n\t" \
+ "psrad %3, %%xmm1 \n\t" \
+ "packssdw %%xmm3, %%xmm1 \n\t" \
+ "movdqa %%xmm1, " #i "(%4) \n\t"
+
+ "movdqa (%2), %%xmm6 \n\t"
+ FDCT_ROW_SSE2_H1(0,0)
+ FDCT_ROW_SSE2(0)
+ FDCT_ROW_SSE2_H2(64,0)
+ FDCT_ROW_SSE2(64)
+
+ FDCT_ROW_SSE2_H1(16,64)
+ FDCT_ROW_SSE2(16)
+ FDCT_ROW_SSE2_H2(112,64)
+ FDCT_ROW_SSE2(112)
+
+ FDCT_ROW_SSE2_H1(32,128)
+ FDCT_ROW_SSE2(32)
+ FDCT_ROW_SSE2_H2(96,128)
+ FDCT_ROW_SSE2(96)
+
+ FDCT_ROW_SSE2_H1(48,192)
+ FDCT_ROW_SSE2(48)
+ FDCT_ROW_SSE2_H2(80,192)
+ FDCT_ROW_SSE2(80)
+ :
+ : "r" (in), "r" (tab_frw_01234567_sse2.tab_frw_01234567_sse2),
+ "r" (fdct_r_row_sse2.fdct_r_row_sse2), "i" (SHIFT_FRW_ROW), "r" (out)
+ XMM_CLOBBERS_ONLY("%xmm0", "%xmm1", "%xmm2", "%xmm3",
+ "%xmm4", "%xmm5", "%xmm6", "%xmm7")
+ );
+}
+
+static av_always_inline void fdct_row_mmxext(const int16_t *in, int16_t *out,
+ const int16_t *table)
+{
+ __asm__ volatile (
+ "pshufw $0x1B, 8(%0), %%mm5 \n\t"
+ "movq (%0), %%mm0 \n\t"
+ "movq %%mm0, %%mm1 \n\t"
+ "paddsw %%mm5, %%mm0 \n\t"
+ "psubsw %%mm5, %%mm1 \n\t"
+ "movq %%mm0, %%mm2 \n\t"
+ "punpckldq %%mm1, %%mm0 \n\t"
+ "punpckhdq %%mm1, %%mm2 \n\t"
+ "movq (%1), %%mm1 \n\t"
+ "movq 8(%1), %%mm3 \n\t"
+ "movq 16(%1), %%mm4 \n\t"
+ "movq 24(%1), %%mm5 \n\t"
+ "movq 32(%1), %%mm6 \n\t"
+ "movq 40(%1), %%mm7 \n\t"
+ "pmaddwd %%mm0, %%mm1 \n\t"
+ "pmaddwd %%mm2, %%mm3 \n\t"
+ "pmaddwd %%mm0, %%mm4 \n\t"
+ "pmaddwd %%mm2, %%mm5 \n\t"
+ "pmaddwd %%mm0, %%mm6 \n\t"
+ "pmaddwd %%mm2, %%mm7 \n\t"
+ "pmaddwd 48(%1), %%mm0 \n\t"
+ "pmaddwd 56(%1), %%mm2 \n\t"
+ "paddd %%mm1, %%mm3 \n\t"
+ "paddd %%mm4, %%mm5 \n\t"
+ "paddd %%mm6, %%mm7 \n\t"
+ "paddd %%mm0, %%mm2 \n\t"
+ "movq (%2), %%mm0 \n\t"
+ "paddd %%mm0, %%mm3 \n\t"
+ "paddd %%mm0, %%mm5 \n\t"
+ "paddd %%mm0, %%mm7 \n\t"
+ "paddd %%mm0, %%mm2 \n\t"
+ "psrad $"S(SHIFT_FRW_ROW)", %%mm3 \n\t"
+ "psrad $"S(SHIFT_FRW_ROW)", %%mm5 \n\t"
+ "psrad $"S(SHIFT_FRW_ROW)", %%mm7 \n\t"
+ "psrad $"S(SHIFT_FRW_ROW)", %%mm2 \n\t"
+ "packssdw %%mm5, %%mm3 \n\t"
+ "packssdw %%mm2, %%mm7 \n\t"
+ "movq %%mm3, (%3) \n\t"
+ "movq %%mm7, 8(%3) \n\t"
+ :
+ : "r" (in), "r" (table), "r" (fdct_r_row), "r" (out));
+}
+
+static av_always_inline void fdct_row_mmx(const int16_t *in, int16_t *out, const int16_t *table)
+{
+ //FIXME reorder (I do not have an old MMX-only CPU here to benchmark ...)
+ __asm__ volatile(
+ "movd 12(%0), %%mm1 \n\t"
+ "punpcklwd 8(%0), %%mm1 \n\t"
+ "movq %%mm1, %%mm2 \n\t"
+ "psrlq $0x20, %%mm1 \n\t"
+ "movq 0(%0), %%mm0 \n\t"
+ "punpcklwd %%mm2, %%mm1 \n\t"
+ "movq %%mm0, %%mm5 \n\t"
+ "paddsw %%mm1, %%mm0 \n\t"
+ "psubsw %%mm1, %%mm5 \n\t"
+ "movq %%mm0, %%mm2 \n\t"
+ "punpckldq %%mm5, %%mm0 \n\t"
+ "punpckhdq %%mm5, %%mm2 \n\t"
+ "movq 0(%1), %%mm1 \n\t"
+ "movq 8(%1), %%mm3 \n\t"
+ "movq 16(%1), %%mm4 \n\t"
+ "movq 24(%1), %%mm5 \n\t"
+ "movq 32(%1), %%mm6 \n\t"
+ "movq 40(%1), %%mm7 \n\t"
+ "pmaddwd %%mm0, %%mm1 \n\t"
+ "pmaddwd %%mm2, %%mm3 \n\t"
+ "pmaddwd %%mm0, %%mm4 \n\t"
+ "pmaddwd %%mm2, %%mm5 \n\t"
+ "pmaddwd %%mm0, %%mm6 \n\t"
+ "pmaddwd %%mm2, %%mm7 \n\t"
+ "pmaddwd 48(%1), %%mm0 \n\t"
+ "pmaddwd 56(%1), %%mm2 \n\t"
+ "paddd %%mm1, %%mm3 \n\t"
+ "paddd %%mm4, %%mm5 \n\t"
+ "paddd %%mm6, %%mm7 \n\t"
+ "paddd %%mm0, %%mm2 \n\t"
+ "movq (%2), %%mm0 \n\t"
+ "paddd %%mm0, %%mm3 \n\t"
+ "paddd %%mm0, %%mm5 \n\t"
+ "paddd %%mm0, %%mm7 \n\t"
+ "paddd %%mm0, %%mm2 \n\t"
+ "psrad $"S(SHIFT_FRW_ROW)", %%mm3 \n\t"
+ "psrad $"S(SHIFT_FRW_ROW)", %%mm5 \n\t"
+ "psrad $"S(SHIFT_FRW_ROW)", %%mm7 \n\t"
+ "psrad $"S(SHIFT_FRW_ROW)", %%mm2 \n\t"
+ "packssdw %%mm5, %%mm3 \n\t"
+ "packssdw %%mm2, %%mm7 \n\t"
+ "movq %%mm3, 0(%3) \n\t"
+ "movq %%mm7, 8(%3) \n\t"
+ :
+ : "r" (in), "r" (table), "r" (fdct_r_row), "r" (out));
+}
+
+void ff_fdct_mmx(int16_t *block)
+{
+ DECLARE_ALIGNED(8, int64_t, align_tmp)[16];
+ int16_t * block1= (int16_t*)align_tmp;
+ const int16_t *table= tab_frw_01234567;
+ int i;
+
+ fdct_col_mmx(block, block1, 0);
+ fdct_col_mmx(block, block1, 4);
+
+ for(i=8;i>0;i--) {
+ fdct_row_mmx(block1, block, table);
+ block1 += 8;
+ table += 32;
+ block += 8;
+ }
+}
+
+void ff_fdct_mmxext(int16_t *block)
+{
+ DECLARE_ALIGNED(8, int64_t, align_tmp)[16];
+ int16_t *block1= (int16_t*)align_tmp;
+ const int16_t *table= tab_frw_01234567;
+ int i;
+
+ fdct_col_mmx(block, block1, 0);
+ fdct_col_mmx(block, block1, 4);
+
+ for(i=8;i>0;i--) {
+ fdct_row_mmxext(block1, block, table);
+ block1 += 8;
+ table += 32;
+ block += 8;
+ }
+}
+
+void ff_fdct_sse2(int16_t *block)
+{
+ DECLARE_ALIGNED(16, int64_t, align_tmp)[16];
+ int16_t * const block1= (int16_t*)align_tmp;
+
+ fdct_col_sse2(block, block1, 0);
+ fdct_row_sse2(block1, block);
+}
+
+#endif /* HAVE_INLINE_ASM */
diff --git a/gst-libs/ext/libav/libavcodec/x86/fdct_mmx.c b/gst-libs/ext/libav/libavcodec/x86/fdct_mmx.c
deleted file mode 100644
index f35a059..0000000
--- a/gst-libs/ext/libav/libavcodec/x86/fdct_mmx.c
+++ /dev/null
@@ -1,582 +0,0 @@
-/*
- * MMX optimized forward DCT
- * The gcc porting is Copyright (c) 2001 Fabrice Bellard.
- * cleanup/optimizations are Copyright (c) 2002-2004 Michael Niedermayer <michaelni@gmx.at>
- * SSE2 optimization is Copyright (c) 2004 Denes Balatoni.
- *
- * from fdctam32.c - AP922 MMX(3D-Now) forward-DCT
- *
- * Intel Application Note AP-922 - fast, precise implementation of DCT
- * http://developer.intel.com/vtune/cbts/appnotes.htm
- *
- * Also of inspiration:
- * a page about fdct at http://www.geocities.com/ssavekar/dct.htm
- * Skal's fdct at http://skal.planet-d.net/coding/dct.html
- *
- * 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
- */
-
-#include "libavutil/common.h"
-#include "libavutil/x86_cpu.h"
-#include "libavcodec/dsputil.h"
-
-//////////////////////////////////////////////////////////////////////
-//
-// constants for the forward DCT
-// -----------------------------
-//
-// Be sure to check that your compiler is aligning all constants to QWORD
-// (8-byte) memory boundaries! Otherwise the unaligned memory access will
-// severely stall MMX execution.
-//
-//////////////////////////////////////////////////////////////////////
-
-#define BITS_FRW_ACC 3 //; 2 or 3 for accuracy
-#define SHIFT_FRW_COL BITS_FRW_ACC
-#define SHIFT_FRW_ROW (BITS_FRW_ACC + 17 - 3)
-#define RND_FRW_ROW (1 << (SHIFT_FRW_ROW-1))
-//#define RND_FRW_COL (1 << (SHIFT_FRW_COL-1))
-
-#define X8(x) x,x,x,x,x,x,x,x
-
-//concatenated table, for forward DCT transformation
-DECLARE_ALIGNED(16, static const int16_t, fdct_tg_all_16)[24] = {
- X8(13036), // tg * (2<<16) + 0.5
- X8(27146), // tg * (2<<16) + 0.5
- X8(-21746) // tg * (2<<16) + 0.5
-};
-
-DECLARE_ALIGNED(16, static const int16_t, ocos_4_16)[8] = {
- X8(23170) //cos * (2<<15) + 0.5
-};
-
-DECLARE_ALIGNED(16, static const int16_t, fdct_one_corr)[8] = { X8(1) };
-
-DECLARE_ALIGNED(8, static const int32_t, fdct_r_row)[2] = {RND_FRW_ROW, RND_FRW_ROW };
-
-static struct
-{
- DECLARE_ALIGNED(16, const int32_t, fdct_r_row_sse2)[4];
-} fdct_r_row_sse2 =
-{{
- RND_FRW_ROW, RND_FRW_ROW, RND_FRW_ROW, RND_FRW_ROW
-}};
-//DECLARE_ALIGNED(16, static const long, fdct_r_row_sse2)[4] = {RND_FRW_ROW, RND_FRW_ROW, RND_FRW_ROW, RND_FRW_ROW};
-
-DECLARE_ALIGNED(8, static const int16_t, tab_frw_01234567)[] = { // forward_dct coeff table
- 16384, 16384, 22725, 19266,
- 16384, 16384, 12873, 4520,
- 21407, 8867, 19266, -4520,
- -8867, -21407, -22725, -12873,
- 16384, -16384, 12873, -22725,
- -16384, 16384, 4520, 19266,
- 8867, -21407, 4520, -12873,
- 21407, -8867, 19266, -22725,
-
- 22725, 22725, 31521, 26722,
- 22725, 22725, 17855, 6270,
- 29692, 12299, 26722, -6270,
- -12299, -29692, -31521, -17855,
- 22725, -22725, 17855, -31521,
- -22725, 22725, 6270, 26722,
- 12299, -29692, 6270, -17855,
- 29692, -12299, 26722, -31521,
-
- 21407, 21407, 29692, 25172,
- 21407, 21407, 16819, 5906,
- 27969, 11585, 25172, -5906,
- -11585, -27969, -29692, -16819,
- 21407, -21407, 16819, -29692,
- -21407, 21407, 5906, 25172,
- 11585, -27969, 5906, -16819,
- 27969, -11585, 25172, -29692,
-
- 19266, 19266, 26722, 22654,
- 19266, 19266, 15137, 5315,
- 25172, 10426, 22654, -5315,
- -10426, -25172, -26722, -15137,
- 19266, -19266, 15137, -26722,
- -19266, 19266, 5315, 22654,
- 10426, -25172, 5315, -15137,
- 25172, -10426, 22654, -26722,
-
- 16384, 16384, 22725, 19266,
- 16384, 16384, 12873, 4520,
- 21407, 8867, 19266, -4520,
- -8867, -21407, -22725, -12873,
- 16384, -16384, 12873, -22725,
- -16384, 16384, 4520, 19266,
- 8867, -21407, 4520, -12873,
- 21407, -8867, 19266, -22725,
-
- 19266, 19266, 26722, 22654,
- 19266, 19266, 15137, 5315,
- 25172, 10426, 22654, -5315,
- -10426, -25172, -26722, -15137,
- 19266, -19266, 15137, -26722,
- -19266, 19266, 5315, 22654,
- 10426, -25172, 5315, -15137,
- 25172, -10426, 22654, -26722,
-
- 21407, 21407, 29692, 25172,
- 21407, 21407, 16819, 5906,
- 27969, 11585, 25172, -5906,
- -11585, -27969, -29692, -16819,
- 21407, -21407, 16819, -29692,
- -21407, 21407, 5906, 25172,
- 11585, -27969, 5906, -16819,
- 27969, -11585, 25172, -29692,
-
- 22725, 22725, 31521, 26722,
- 22725, 22725, 17855, 6270,
- 29692, 12299, 26722, -6270,
- -12299, -29692, -31521, -17855,
- 22725, -22725, 17855, -31521,
- -22725, 22725, 6270, 26722,
- 12299, -29692, 6270, -17855,
- 29692, -12299, 26722, -31521,
-};
-
-static struct
-{
- DECLARE_ALIGNED(16, const int16_t, tab_frw_01234567_sse2)[256];
-} tab_frw_01234567_sse2 =
-{{
-//DECLARE_ALIGNED(16, static const int16_t, tab_frw_01234567_sse2)[] = { // forward_dct coeff table
-#define TABLE_SSE2 C4, C4, C1, C3, -C6, -C2, -C1, -C5, \
- C4, C4, C5, C7, C2, C6, C3, -C7, \
- -C4, C4, C7, C3, C6, -C2, C7, -C5, \
- C4, -C4, C5, -C1, C2, -C6, C3, -C1,
-// c1..c7 * cos(pi/4) * 2^15
-#define C1 22725
-#define C2 21407
-#define C3 19266
-#define C4 16384
-#define C5 12873
-#define C6 8867
-#define C7 4520
-TABLE_SSE2
-
-#undef C1
-#undef C2
-#undef C3
-#undef C4
-#undef C5
-#undef C6
-#undef C7
-#define C1 31521
-#define C2 29692
-#define C3 26722
-#define C4 22725
-#define C5 17855
-#define C6 12299
-#define C7 6270
-TABLE_SSE2
-
-#undef C1
-#undef C2
-#undef C3
-#undef C4
-#undef C5
-#undef C6
-#undef C7
-#define C1 29692
-#define C2 27969
-#define C3 25172
-#define C4 21407
-#define C5 16819
-#define C6 11585
-#define C7 5906
-TABLE_SSE2
-
-#undef C1
-#undef C2
-#undef C3
-#undef C4
-#undef C5
-#undef C6
-#undef C7
-#define C1 26722
-#define C2 25172
-#define C3 22654
-#define C4 19266
-#define C5 15137
-#define C6 10426
-#define C7 5315
-TABLE_SSE2
-
-#undef C1
-#undef C2
-#undef C3
-#undef C4
-#undef C5
-#undef C6
-#undef C7
-#define C1 22725
-#define C2 21407
-#define C3 19266
-#define C4 16384
-#define C5 12873
-#define C6 8867
-#define C7 4520
-TABLE_SSE2
-
-#undef C1
-#undef C2
-#undef C3
-#undef C4
-#undef C5
-#undef C6
-#undef C7
-#define C1 26722
-#define C2 25172
-#define C3 22654
-#define C4 19266
-#define C5 15137
-#define C6 10426
-#define C7 5315
-TABLE_SSE2
-
-#undef C1
-#undef C2
-#undef C3
-#undef C4
-#undef C5
-#undef C6
-#undef C7
-#define C1 29692
-#define C2 27969
-#define C3 25172
-#define C4 21407
-#define C5 16819
-#define C6 11585
-#define C7 5906
-TABLE_SSE2
-
-#undef C1
-#undef C2
-#undef C3
-#undef C4
-#undef C5
-#undef C6
-#undef C7
-#define C1 31521
-#define C2 29692
-#define C3 26722
-#define C4 22725
-#define C5 17855
-#define C6 12299
-#define C7 6270
-TABLE_SSE2
-}};
-
-#define S(s) AV_TOSTRING(s) //AV_STRINGIFY is too long
-
-#define FDCT_COL(cpu, mm, mov)\
-static av_always_inline void fdct_col_##cpu(const int16_t *in, int16_t *out, int offset)\
-{\
- __asm__ volatile (\
- #mov" 16(%0), %%"#mm"0 \n\t" \
- #mov" 96(%0), %%"#mm"1 \n\t" \
- #mov" %%"#mm"0, %%"#mm"2 \n\t" \
- #mov" 32(%0), %%"#mm"3 \n\t" \
- "paddsw %%"#mm"1, %%"#mm"0 \n\t" \
- #mov" 80(%0), %%"#mm"4 \n\t" \
- "psllw $"S(SHIFT_FRW_COL)", %%"#mm"0 \n\t" \
- #mov" (%0), %%"#mm"5 \n\t" \
- "paddsw %%"#mm"3, %%"#mm"4 \n\t" \
- "paddsw 112(%0), %%"#mm"5 \n\t" \
- "psllw $"S(SHIFT_FRW_COL)", %%"#mm"4 \n\t" \
- #mov" %%"#mm"0, %%"#mm"6 \n\t" \
- "psubsw %%"#mm"1, %%"#mm"2 \n\t" \
- #mov" 16(%1), %%"#mm"1 \n\t" \
- "psubsw %%"#mm"4, %%"#mm"0 \n\t" \
- #mov" 48(%0), %%"#mm"7 \n\t" \
- "pmulhw %%"#mm"0, %%"#mm"1 \n\t" \
- "paddsw 64(%0), %%"#mm"7 \n\t" \
- "psllw $"S(SHIFT_FRW_COL)", %%"#mm"5 \n\t" \
- "paddsw %%"#mm"4, %%"#mm"6 \n\t" \
- "psllw $"S(SHIFT_FRW_COL)", %%"#mm"7 \n\t" \
- #mov" %%"#mm"5, %%"#mm"4 \n\t" \
- "psubsw %%"#mm"7, %%"#mm"5 \n\t" \
- "paddsw %%"#mm"5, %%"#mm"1 \n\t" \
- "paddsw %%"#mm"7, %%"#mm"4 \n\t" \
- "por (%2), %%"#mm"1 \n\t" \
- "psllw $"S(SHIFT_FRW_COL)"+1, %%"#mm"2 \n\t" \
- "pmulhw 16(%1), %%"#mm"5 \n\t" \
- #mov" %%"#mm"4, %%"#mm"7 \n\t" \
- "psubsw 80(%0), %%"#mm"3 \n\t" \
- "psubsw %%"#mm"6, %%"#mm"4 \n\t" \
- #mov" %%"#mm"1, 32(%3) \n\t" \
- "paddsw %%"#mm"6, %%"#mm"7 \n\t" \
- #mov" 48(%0), %%"#mm"1 \n\t" \
- "psllw $"S(SHIFT_FRW_COL)"+1, %%"#mm"3 \n\t" \
- "psubsw 64(%0), %%"#mm"1 \n\t" \
- #mov" %%"#mm"2, %%"#mm"6 \n\t" \
- #mov" %%"#mm"4, 64(%3) \n\t" \
- "paddsw %%"#mm"3, %%"#mm"2 \n\t" \
- "pmulhw (%4), %%"#mm"2 \n\t" \
- "psubsw %%"#mm"3, %%"#mm"6 \n\t" \
- "pmulhw (%4), %%"#mm"6 \n\t" \
- "psubsw %%"#mm"0, %%"#mm"5 \n\t" \
- "por (%2), %%"#mm"5 \n\t" \
- "psllw $"S(SHIFT_FRW_COL)", %%"#mm"1 \n\t" \
- "por (%2), %%"#mm"2 \n\t" \
- #mov" %%"#mm"1, %%"#mm"4 \n\t" \
- #mov" (%0), %%"#mm"3 \n\t" \
- "paddsw %%"#mm"6, %%"#mm"1 \n\t" \
- "psubsw 112(%0), %%"#mm"3 \n\t" \
- "psubsw %%"#mm"6, %%"#mm"4 \n\t" \
- #mov" (%1), %%"#mm"0 \n\t" \
- "psllw $"S(SHIFT_FRW_COL)", %%"#mm"3 \n\t" \
- #mov" 32(%1), %%"#mm"6 \n\t" \
- "pmulhw %%"#mm"1, %%"#mm"0 \n\t" \
- #mov" %%"#mm"7, (%3) \n\t" \
- "pmulhw %%"#mm"4, %%"#mm"6 \n\t" \
- #mov" %%"#mm"5, 96(%3) \n\t" \
- #mov" %%"#mm"3, %%"#mm"7 \n\t" \
- #mov" 32(%1), %%"#mm"5 \n\t" \
- "psubsw %%"#mm"2, %%"#mm"7 \n\t" \
- "paddsw %%"#mm"2, %%"#mm"3 \n\t" \
- "pmulhw %%"#mm"7, %%"#mm"5 \n\t" \
- "paddsw %%"#mm"3, %%"#mm"0 \n\t" \
- "paddsw %%"#mm"4, %%"#mm"6 \n\t" \
- "pmulhw (%1), %%"#mm"3 \n\t" \
- "por (%2), %%"#mm"0 \n\t" \
- "paddsw %%"#mm"7, %%"#mm"5 \n\t" \
- "psubsw %%"#mm"6, %%"#mm"7 \n\t" \
- #mov" %%"#mm"0, 16(%3) \n\t" \
- "paddsw %%"#mm"4, %%"#mm"5 \n\t" \
- #mov" %%"#mm"7, 48(%3) \n\t" \
- "psubsw %%"#mm"1, %%"#mm"3 \n\t" \
- #mov" %%"#mm"5, 80(%3) \n\t" \
- #mov" %%"#mm"3, 112(%3) \n\t" \
- : \
- : "r" (in + offset), "r" (fdct_tg_all_16), "r" (fdct_one_corr), \
- "r" (out + offset), "r" (ocos_4_16)); \
-}
-
-FDCT_COL(mmx, mm, movq)
-FDCT_COL(sse2, xmm, movdqa)
-
-static av_always_inline void fdct_row_sse2(const int16_t *in, int16_t *out)
-{
- __asm__ volatile(
-#define FDCT_ROW_SSE2_H1(i,t) \
- "movq " #i "(%0), %%xmm2 \n\t" \
- "movq " #i "+8(%0), %%xmm0 \n\t" \
- "movdqa " #t "+32(%1), %%xmm3 \n\t" \
- "movdqa " #t "+48(%1), %%xmm7 \n\t" \
- "movdqa " #t "(%1), %%xmm4 \n\t" \
- "movdqa " #t "+16(%1), %%xmm5 \n\t"
-
-#define FDCT_ROW_SSE2_H2(i,t) \
- "movq " #i "(%0), %%xmm2 \n\t" \
- "movq " #i "+8(%0), %%xmm0 \n\t" \
- "movdqa " #t "+32(%1), %%xmm3 \n\t" \
- "movdqa " #t "+48(%1), %%xmm7 \n\t"
-
-#define FDCT_ROW_SSE2(i) \
- "movq %%xmm2, %%xmm1 \n\t" \
- "pshuflw $27, %%xmm0, %%xmm0 \n\t" \
- "paddsw %%xmm0, %%xmm1 \n\t" \
- "psubsw %%xmm0, %%xmm2 \n\t" \
- "punpckldq %%xmm2, %%xmm1 \n\t" \
- "pshufd $78, %%xmm1, %%xmm2 \n\t" \
- "pmaddwd %%xmm2, %%xmm3 \n\t" \
- "pmaddwd %%xmm1, %%xmm7 \n\t" \
- "pmaddwd %%xmm5, %%xmm2 \n\t" \
- "pmaddwd %%xmm4, %%xmm1 \n\t" \
- "paddd %%xmm7, %%xmm3 \n\t" \
- "paddd %%xmm2, %%xmm1 \n\t" \
- "paddd %%xmm6, %%xmm3 \n\t" \
- "paddd %%xmm6, %%xmm1 \n\t" \
- "psrad %3, %%xmm3 \n\t" \
- "psrad %3, %%xmm1 \n\t" \
- "packssdw %%xmm3, %%xmm1 \n\t" \
- "movdqa %%xmm1, " #i "(%4) \n\t"
-
- "movdqa (%2), %%xmm6 \n\t"
- FDCT_ROW_SSE2_H1(0,0)
- FDCT_ROW_SSE2(0)
- FDCT_ROW_SSE2_H2(64,0)
- FDCT_ROW_SSE2(64)
-
- FDCT_ROW_SSE2_H1(16,64)
- FDCT_ROW_SSE2(16)
- FDCT_ROW_SSE2_H2(112,64)
- FDCT_ROW_SSE2(112)
-
- FDCT_ROW_SSE2_H1(32,128)
- FDCT_ROW_SSE2(32)
- FDCT_ROW_SSE2_H2(96,128)
- FDCT_ROW_SSE2(96)
-
- FDCT_ROW_SSE2_H1(48,192)
- FDCT_ROW_SSE2(48)
- FDCT_ROW_SSE2_H2(80,192)
- FDCT_ROW_SSE2(80)
- :
- : "r" (in), "r" (tab_frw_01234567_sse2.tab_frw_01234567_sse2),
- "r" (fdct_r_row_sse2.fdct_r_row_sse2), "i" (SHIFT_FRW_ROW), "r" (out)
- XMM_CLOBBERS_ONLY("%xmm0", "%xmm1", "%xmm2", "%xmm3",
- "%xmm4", "%xmm5", "%xmm6", "%xmm7")
- );
-}
-
-static av_always_inline void fdct_row_mmx2(const int16_t *in, int16_t *out, const int16_t *table)
-{
- __asm__ volatile (
- "pshufw $0x1B, 8(%0), %%mm5 \n\t"
- "movq (%0), %%mm0 \n\t"
- "movq %%mm0, %%mm1 \n\t"
- "paddsw %%mm5, %%mm0 \n\t"
- "psubsw %%mm5, %%mm1 \n\t"
- "movq %%mm0, %%mm2 \n\t"
- "punpckldq %%mm1, %%mm0 \n\t"
- "punpckhdq %%mm1, %%mm2 \n\t"
- "movq (%1), %%mm1 \n\t"
- "movq 8(%1), %%mm3 \n\t"
- "movq 16(%1), %%mm4 \n\t"
- "movq 24(%1), %%mm5 \n\t"
- "movq 32(%1), %%mm6 \n\t"
- "movq 40(%1), %%mm7 \n\t"
- "pmaddwd %%mm0, %%mm1 \n\t"
- "pmaddwd %%mm2, %%mm3 \n\t"
- "pmaddwd %%mm0, %%mm4 \n\t"
- "pmaddwd %%mm2, %%mm5 \n\t"
- "pmaddwd %%mm0, %%mm6 \n\t"
- "pmaddwd %%mm2, %%mm7 \n\t"
- "pmaddwd 48(%1), %%mm0 \n\t"
- "pmaddwd 56(%1), %%mm2 \n\t"
- "paddd %%mm1, %%mm3 \n\t"
- "paddd %%mm4, %%mm5 \n\t"
- "paddd %%mm6, %%mm7 \n\t"
- "paddd %%mm0, %%mm2 \n\t"
- "movq (%2), %%mm0 \n\t"
- "paddd %%mm0, %%mm3 \n\t"
- "paddd %%mm0, %%mm5 \n\t"
- "paddd %%mm0, %%mm7 \n\t"
- "paddd %%mm0, %%mm2 \n\t"
- "psrad $"S(SHIFT_FRW_ROW)", %%mm3 \n\t"
- "psrad $"S(SHIFT_FRW_ROW)", %%mm5 \n\t"
- "psrad $"S(SHIFT_FRW_ROW)", %%mm7 \n\t"
- "psrad $"S(SHIFT_FRW_ROW)", %%mm2 \n\t"
- "packssdw %%mm5, %%mm3 \n\t"
- "packssdw %%mm2, %%mm7 \n\t"
- "movq %%mm3, (%3) \n\t"
- "movq %%mm7, 8(%3) \n\t"
- :
- : "r" (in), "r" (table), "r" (fdct_r_row), "r" (out));
-}
-
-static av_always_inline void fdct_row_mmx(const int16_t *in, int16_t *out, const int16_t *table)
-{
- //FIXME reorder (I do not have an old MMX-only CPU here to benchmark ...)
- __asm__ volatile(
- "movd 12(%0), %%mm1 \n\t"
- "punpcklwd 8(%0), %%mm1 \n\t"
- "movq %%mm1, %%mm2 \n\t"
- "psrlq $0x20, %%mm1 \n\t"
- "movq 0(%0), %%mm0 \n\t"
- "punpcklwd %%mm2, %%mm1 \n\t"
- "movq %%mm0, %%mm5 \n\t"
- "paddsw %%mm1, %%mm0 \n\t"
- "psubsw %%mm1, %%mm5 \n\t"
- "movq %%mm0, %%mm2 \n\t"
- "punpckldq %%mm5, %%mm0 \n\t"
- "punpckhdq %%mm5, %%mm2 \n\t"
- "movq 0(%1), %%mm1 \n\t"
- "movq 8(%1), %%mm3 \n\t"
- "movq 16(%1), %%mm4 \n\t"
- "movq 24(%1), %%mm5 \n\t"
- "movq 32(%1), %%mm6 \n\t"
- "movq 40(%1), %%mm7 \n\t"
- "pmaddwd %%mm0, %%mm1 \n\t"
- "pmaddwd %%mm2, %%mm3 \n\t"
- "pmaddwd %%mm0, %%mm4 \n\t"
- "pmaddwd %%mm2, %%mm5 \n\t"
- "pmaddwd %%mm0, %%mm6 \n\t"
- "pmaddwd %%mm2, %%mm7 \n\t"
- "pmaddwd 48(%1), %%mm0 \n\t"
- "pmaddwd 56(%1), %%mm2 \n\t"
- "paddd %%mm1, %%mm3 \n\t"
- "paddd %%mm4, %%mm5 \n\t"
- "paddd %%mm6, %%mm7 \n\t"
- "paddd %%mm0, %%mm2 \n\t"
- "movq (%2), %%mm0 \n\t"
- "paddd %%mm0, %%mm3 \n\t"
- "paddd %%mm0, %%mm5 \n\t"
- "paddd %%mm0, %%mm7 \n\t"
- "paddd %%mm0, %%mm2 \n\t"
- "psrad $"S(SHIFT_FRW_ROW)", %%mm3 \n\t"
- "psrad $"S(SHIFT_FRW_ROW)", %%mm5 \n\t"
- "psrad $"S(SHIFT_FRW_ROW)", %%mm7 \n\t"
- "psrad $"S(SHIFT_FRW_ROW)", %%mm2 \n\t"
- "packssdw %%mm5, %%mm3 \n\t"
- "packssdw %%mm2, %%mm7 \n\t"
- "movq %%mm3, 0(%3) \n\t"
- "movq %%mm7, 8(%3) \n\t"
- :
- : "r" (in), "r" (table), "r" (fdct_r_row), "r" (out));
-}
-
-void ff_fdct_mmx(int16_t *block)
-{
- DECLARE_ALIGNED(8, int64_t, align_tmp)[16];
- int16_t * block1= (int16_t*)align_tmp;
- const int16_t *table= tab_frw_01234567;
- int i;
-
- fdct_col_mmx(block, block1, 0);
- fdct_col_mmx(block, block1, 4);
-
- for(i=8;i>0;i--) {
- fdct_row_mmx(block1, block, table);
- block1 += 8;
- table += 32;
- block += 8;
- }
-}
-
-void ff_fdct_mmx2(int16_t *block)
-{
- DECLARE_ALIGNED(8, int64_t, align_tmp)[16];
- int16_t *block1= (int16_t*)align_tmp;
- const int16_t *table= tab_frw_01234567;
- int i;
-
- fdct_col_mmx(block, block1, 0);
- fdct_col_mmx(block, block1, 4);
-
- for(i=8;i>0;i--) {
- fdct_row_mmx2(block1, block, table);
- block1 += 8;
- table += 32;
- block += 8;
- }
-}
-
-void ff_fdct_sse2(int16_t *block)
-{
- DECLARE_ALIGNED(16, int64_t, align_tmp)[16];
- int16_t * const block1= (int16_t*)align_tmp;
-
- fdct_col_sse2(block, block1, 0);
- fdct_row_sse2(block1, block);
-}
-
diff --git a/gst-libs/ext/libav/libavcodec/x86/fft.asm b/gst-libs/ext/libav/libavcodec/x86/fft.asm
new file mode 100644
index 0000000..c87752b
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/x86/fft.asm
@@ -0,0 +1,1083 @@
+;******************************************************************************
+;* FFT transform with SSE/3DNow optimizations
+;* Copyright (c) 2008 Loren Merritt
+;* Copyright (c) 2011 Vitor Sessak
+;*
+;* This algorithm (though not any of the implementation details) is
+;* based on libdjbfft by D. J. Bernstein.
+;*
+;* 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
+;******************************************************************************
+
+; These functions are not individually interchangeable with the C versions.
+; While C takes arrays of FFTComplex, SSE/3DNow leave intermediate results
+; in blocks as conventient to the vector size.
+; i.e. {4x real, 4x imaginary, 4x real, ...} (or 2x respectively)
+
+%include "libavutil/x86/x86util.asm"
+
+%if ARCH_X86_64
+%define pointer resq
+%else
+%define pointer resd
+%endif
+
+struc FFTContext
+ .nbits: resd 1
+ .reverse: resd 1
+ .revtab: pointer 1
+ .tmpbuf: pointer 1
+ .mdctsize: resd 1
+ .mdctbits: resd 1
+ .tcos: pointer 1
+ .tsin: pointer 1
+ .fftperm: pointer 1
+ .fftcalc: pointer 1
+ .imdctcalc:pointer 1
+ .imdcthalf:pointer 1
+endstruc
+
+SECTION_RODATA
+
+%define M_SQRT1_2 0.70710678118654752440
+%define M_COS_PI_1_8 0.923879532511287
+%define M_COS_PI_3_8 0.38268343236509
+
+align 32
+ps_cos16_1: dd 1.0, M_COS_PI_1_8, M_SQRT1_2, M_COS_PI_3_8, 1.0, M_COS_PI_1_8, M_SQRT1_2, M_COS_PI_3_8
+ps_cos16_2: dd 0, M_COS_PI_3_8, M_SQRT1_2, M_COS_PI_1_8, 0, -M_COS_PI_3_8, -M_SQRT1_2, -M_COS_PI_1_8
+
+ps_root2: times 8 dd M_SQRT1_2
+ps_root2mppm: dd -M_SQRT1_2, M_SQRT1_2, M_SQRT1_2, -M_SQRT1_2, -M_SQRT1_2, M_SQRT1_2, M_SQRT1_2, -M_SQRT1_2
+ps_p1p1m1p1: dd 0, 0, 1<<31, 0, 0, 0, 1<<31, 0
+
+perm1: dd 0x00, 0x02, 0x03, 0x01, 0x03, 0x00, 0x02, 0x01
+perm2: dd 0x00, 0x01, 0x02, 0x03, 0x01, 0x00, 0x02, 0x03
+ps_p1p1m1p1root2: dd 1.0, 1.0, -1.0, 1.0, M_SQRT1_2, M_SQRT1_2, M_SQRT1_2, M_SQRT1_2
+ps_m1m1p1m1p1m1m1m1: dd 1<<31, 1<<31, 0, 1<<31, 0, 1<<31, 1<<31, 1<<31
+ps_m1m1m1m1: times 4 dd 1<<31
+ps_m1p1: dd 1<<31, 0
+
+%assign i 16
+%rep 13
+cextern cos_ %+ i
+%assign i i<<1
+%endrep
+
+%if ARCH_X86_64
+ %define pointer dq
+%else
+ %define pointer dd
+%endif
+
+%macro IF0 1+
+%endmacro
+%macro IF1 1+
+ %1
+%endmacro
+
+SECTION_TEXT
+
+%macro T2_3DNOW 4 ; z0, z1, mem0, mem1
+ mova %1, %3
+ mova %2, %1
+ pfadd %1, %4
+ pfsub %2, %4
+%endmacro
+
+%macro T4_3DNOW 6 ; z0, z1, z2, z3, tmp0, tmp1
+ mova %5, %3
+ pfsub %3, %4
+ pfadd %5, %4 ; {t6,t5}
+ pxor %3, [ps_m1p1] ; {t8,t7}
+ mova %6, %1
+ movd [r0+12], %3
+ punpckhdq %3, [r0+8]
+ pfadd %1, %5 ; {r0,i0}
+ pfsub %6, %5 ; {r2,i2}
+ mova %4, %2
+ pfadd %2, %3 ; {r1,i1}
+ pfsub %4, %3 ; {r3,i3}
+ SWAP %3, %6
+%endmacro
+
+; in: %1 = {r0,i0,r2,i2,r4,i4,r6,i6}
+; %2 = {r1,i1,r3,i3,r5,i5,r7,i7}
+; %3, %4, %5 tmp
+; out: %1 = {r0,r1,r2,r3,i0,i1,i2,i3}
+; %2 = {r4,r5,r6,r7,i4,i5,i6,i7}
+%macro T8_AVX 5
+ vsubps %5, %1, %2 ; v = %1 - %2
+ vaddps %3, %1, %2 ; w = %1 + %2
+ vmulps %2, %5, [ps_p1p1m1p1root2] ; v *= vals1
+ vpermilps %2, %2, [perm1]
+ vblendps %1, %2, %3, 0x33 ; q = {w1,w2,v4,v2,w5,w6,v7,v6}
+ vshufps %5, %3, %2, 0x4e ; r = {w3,w4,v1,v3,w7,w8,v8,v5}
+ vsubps %4, %5, %1 ; s = r - q
+ vaddps %1, %5, %1 ; u = r + q
+ vpermilps %1, %1, [perm2] ; k = {u1,u2,u3,u4,u6,u5,u7,u8}
+ vshufps %5, %4, %1, 0xbb
+ vshufps %3, %4, %1, 0xee
+ vperm2f128 %3, %3, %5, 0x13
+ vxorps %4, %4, [ps_m1m1p1m1p1m1m1m1] ; s *= {1,1,-1,-1,1,-1,-1,-1}
+ vshufps %2, %1, %4, 0xdd
+ vshufps %1, %1, %4, 0x88
+ vperm2f128 %4, %2, %1, 0x02 ; v = {k1,k3,s1,s3,k2,k4,s2,s4}
+ vperm2f128 %1, %1, %2, 0x13 ; w = {k6,k8,s6,s8,k5,k7,s5,s7}
+ vsubps %5, %1, %3
+ vblendps %1, %5, %1, 0x55 ; w -= {0,s7,0,k7,0,s8,0,k8}
+ vsubps %2, %4, %1 ; %2 = v - w
+ vaddps %1, %4, %1 ; %1 = v + w
+%endmacro
+
+; In SSE mode do one fft4 transforms
+; in: %1={r0,i0,r2,i2} %2={r1,i1,r3,i3}
+; out: %1={r0,r1,r2,r3} %2={i0,i1,i2,i3}
+;
+; In AVX mode do two fft4 transforms
+; in: %1={r0,i0,r2,i2,r4,i4,r6,i6} %2={r1,i1,r3,i3,r5,i5,r7,i7}
+; out: %1={r0,r1,r2,r3,r4,r5,r6,r7} %2={i0,i1,i2,i3,i4,i5,i6,i7}
+%macro T4_SSE 3
+ subps %3, %1, %2 ; {t3,t4,-t8,t7}
+ addps %1, %1, %2 ; {t1,t2,t6,t5}
+ xorps %3, %3, [ps_p1p1m1p1]
+ shufps %2, %1, %3, 0xbe ; {t6,t5,t7,t8}
+ shufps %1, %1, %3, 0x44 ; {t1,t2,t3,t4}
+ subps %3, %1, %2 ; {r2,i2,r3,i3}
+ addps %1, %1, %2 ; {r0,i0,r1,i1}
+ shufps %2, %1, %3, 0xdd ; {i0,i1,i2,i3}
+ shufps %1, %1, %3, 0x88 ; {r0,r1,r2,r3}
+%endmacro
+
+; In SSE mode do one FFT8
+; in: %1={r0,r1,r2,r3} %2={i0,i1,i2,i3} %3={r4,i4,r6,i6} %4={r5,i5,r7,i7}
+; out: %1={r0,r1,r2,r3} %2={i0,i1,i2,i3} %1={r4,r5,r6,r7} %2={i4,i5,i6,i7}
+;
+; In AVX mode do two FFT8
+; in: %1={r0,i0,r2,i2,r8, i8, r10,i10} %2={r1,i1,r3,i3,r9, i9, r11,i11}
+; %3={r4,i4,r6,i6,r12,i12,r14,i14} %4={r5,i5,r7,i7,r13,i13,r15,i15}
+; out: %1={r0,r1,r2,r3,r8, r9, r10,r11} %2={i0,i1,i2,i3,i8, i9, i10,i11}
+; %3={r4,r5,r6,r7,r12,r13,r14,r15} %4={i4,i5,i6,i7,i12,i13,i14,i15}
+%macro T8_SSE 6
+ addps %6, %3, %4 ; {t1,t2,t3,t4}
+ subps %3, %3, %4 ; {r5,i5,r7,i7}
+ shufps %4, %3, %3, 0xb1 ; {i5,r5,i7,r7}
+ mulps %3, %3, [ps_root2mppm] ; {-r5,i5,r7,-i7}
+ mulps %4, %4, [ps_root2]
+ addps %3, %3, %4 ; {t8,t7,ta,t9}
+ shufps %4, %6, %3, 0x9c ; {t1,t4,t7,ta}
+ shufps %6, %6, %3, 0x36 ; {t3,t2,t9,t8}
+ subps %3, %6, %4 ; {t6,t5,tc,tb}
+ addps %6, %6, %4 ; {t1,t2,t9,ta}
+ shufps %5, %6, %3, 0x8d ; {t2,ta,t6,tc}
+ shufps %6, %6, %3, 0xd8 ; {t1,t9,t5,tb}
+ subps %3, %1, %6 ; {r4,r5,r6,r7}
+ addps %1, %1, %6 ; {r0,r1,r2,r3}
+ subps %4, %2, %5 ; {i4,i5,i6,i7}
+ addps %2, %2, %5 ; {i0,i1,i2,i3}
+%endmacro
+
+; scheduled for cpu-bound sizes
+%macro PASS_SMALL 3 ; (to load m4-m7), wre, wim
+IF%1 mova m4, Z(4)
+IF%1 mova m5, Z(5)
+ mova m0, %2 ; wre
+ mova m1, %3 ; wim
+ mulps m2, m4, m0 ; r2*wre
+IF%1 mova m6, Z2(6)
+ mulps m3, m5, m1 ; i2*wim
+IF%1 mova m7, Z2(7)
+ mulps m4, m4, m1 ; r2*wim
+ mulps m5, m5, m0 ; i2*wre
+ addps m2, m2, m3 ; r2*wre + i2*wim
+ mulps m3, m1, m7 ; i3*wim
+ subps m5, m5, m4 ; i2*wre - r2*wim
+ mulps m1, m1, m6 ; r3*wim
+ mulps m4, m0, m6 ; r3*wre
+ mulps m0, m0, m7 ; i3*wre
+ subps m4, m4, m3 ; r3*wre - i3*wim
+ mova m3, Z(0)
+ addps m0, m0, m1 ; i3*wre + r3*wim
+ subps m1, m4, m2 ; t3
+ addps m4, m4, m2 ; t5
+ subps m3, m3, m4 ; r2
+ addps m4, m4, Z(0) ; r0
+ mova m6, Z(2)
+ mova Z(4), m3
+ mova Z(0), m4
+ subps m3, m5, m0 ; t4
+ subps m4, m6, m3 ; r3
+ addps m3, m3, m6 ; r1
+ mova Z2(6), m4
+ mova Z(2), m3
+ mova m2, Z(3)
+ addps m3, m5, m0 ; t6
+ subps m2, m2, m1 ; i3
+ mova m7, Z(1)
+ addps m1, m1, Z(3) ; i1
+ mova Z2(7), m2
+ mova Z(3), m1
+ subps m4, m7, m3 ; i2
+ addps m3, m3, m7 ; i0
+ mova Z(5), m4
+ mova Z(1), m3
+%endmacro
+
+; scheduled to avoid store->load aliasing
+%macro PASS_BIG 1 ; (!interleave)
+ mova m4, Z(4) ; r2
+ mova m5, Z(5) ; i2
+ mova m0, [wq] ; wre
+ mova m1, [wq+o1q] ; wim
+ mulps m2, m4, m0 ; r2*wre
+ mova m6, Z2(6) ; r3
+ mulps m3, m5, m1 ; i2*wim
+ mova m7, Z2(7) ; i3
+ mulps m4, m4, m1 ; r2*wim
+ mulps m5, m5, m0 ; i2*wre
+ addps m2, m2, m3 ; r2*wre + i2*wim
+ mulps m3, m1, m7 ; i3*wim
+ mulps m1, m1, m6 ; r3*wim
+ subps m5, m5, m4 ; i2*wre - r2*wim
+ mulps m4, m0, m6 ; r3*wre
+ mulps m0, m0, m7 ; i3*wre
+ subps m4, m4, m3 ; r3*wre - i3*wim
+ mova m3, Z(0)
+ addps m0, m0, m1 ; i3*wre + r3*wim
+ subps m1, m4, m2 ; t3
+ addps m4, m4, m2 ; t5
+ subps m3, m3, m4 ; r2
+ addps m4, m4, Z(0) ; r0
+ mova m6, Z(2)
+ mova Z(4), m3
+ mova Z(0), m4
+ subps m3, m5, m0 ; t4
+ subps m4, m6, m3 ; r3
+ addps m3, m3, m6 ; r1
+IF%1 mova Z2(6), m4
+IF%1 mova Z(2), m3
+ mova m2, Z(3)
+ addps m5, m5, m0 ; t6
+ subps m2, m2, m1 ; i3
+ mova m7, Z(1)
+ addps m1, m1, Z(3) ; i1
+IF%1 mova Z2(7), m2
+IF%1 mova Z(3), m1
+ subps m6, m7, m5 ; i2
+ addps m5, m5, m7 ; i0
+IF%1 mova Z(5), m6
+IF%1 mova Z(1), m5
+%if %1==0
+ INTERL m1, m3, m7, Z, 2
+ INTERL m2, m4, m0, Z2, 6
+
+ mova m1, Z(0)
+ mova m2, Z(4)
+
+ INTERL m5, m1, m3, Z, 0
+ INTERL m6, m2, m7, Z, 4
+%endif
+%endmacro
+
+%macro PUNPCK 3
+ mova %3, %1
+ punpckldq %1, %2
+ punpckhdq %3, %2
+%endmacro
+
+%define Z(x) [r0+mmsize*x]
+%define Z2(x) [r0+mmsize*x]
+%define ZH(x) [r0+mmsize*x+mmsize/2]
+
+INIT_YMM avx
+
+align 16
+fft8_avx:
+ mova m0, Z(0)
+ mova m1, Z(1)
+ T8_AVX m0, m1, m2, m3, m4
+ mova Z(0), m0
+ mova Z(1), m1
+ ret
+
+
+align 16
+fft16_avx:
+ mova m2, Z(2)
+ mova m3, Z(3)
+ T4_SSE m2, m3, m7
+
+ mova m0, Z(0)
+ mova m1, Z(1)
+ T8_AVX m0, m1, m4, m5, m7
+
+ mova m4, [ps_cos16_1]
+ mova m5, [ps_cos16_2]
+ vmulps m6, m2, m4
+ vmulps m7, m3, m5
+ vaddps m7, m7, m6
+ vmulps m2, m2, m5
+ vmulps m3, m3, m4
+ vsubps m3, m3, m2
+ vblendps m2, m7, m3, 0xf0
+ vperm2f128 m3, m7, m3, 0x21
+ vaddps m4, m2, m3
+ vsubps m2, m3, m2
+ vperm2f128 m2, m2, m2, 0x01
+ vsubps m3, m1, m2
+ vaddps m1, m1, m2
+ vsubps m5, m0, m4
+ vaddps m0, m0, m4
+ vextractf128 Z(0), m0, 0
+ vextractf128 ZH(0), m1, 0
+ vextractf128 Z(1), m0, 1
+ vextractf128 ZH(1), m1, 1
+ vextractf128 Z(2), m5, 0
+ vextractf128 ZH(2), m3, 0
+ vextractf128 Z(3), m5, 1
+ vextractf128 ZH(3), m3, 1
+ ret
+
+align 16
+fft32_avx:
+ call fft16_avx
+
+ mova m0, Z(4)
+ mova m1, Z(5)
+
+ T4_SSE m0, m1, m4
+
+ mova m2, Z(6)
+ mova m3, Z(7)
+
+ T8_SSE m0, m1, m2, m3, m4, m6
+ ; m0={r0,r1,r2,r3,r8, r9, r10,r11} m1={i0,i1,i2,i3,i8, i9, i10,i11}
+ ; m2={r4,r5,r6,r7,r12,r13,r14,r15} m3={i4,i5,i6,i7,i12,i13,i14,i15}
+
+ vperm2f128 m4, m0, m2, 0x20
+ vperm2f128 m5, m1, m3, 0x20
+ vperm2f128 m6, m0, m2, 0x31
+ vperm2f128 m7, m1, m3, 0x31
+
+ PASS_SMALL 0, [cos_32], [cos_32+32]
+
+ ret
+
+fft32_interleave_avx:
+ call fft32_avx
+ mov r2d, 32
+.deint_loop:
+ mova m2, Z(0)
+ mova m3, Z(1)
+ vunpcklps m0, m2, m3
+ vunpckhps m1, m2, m3
+ vextractf128 Z(0), m0, 0
+ vextractf128 ZH(0), m1, 0
+ vextractf128 Z(1), m0, 1
+ vextractf128 ZH(1), m1, 1
+ add r0, mmsize*2
+ sub r2d, mmsize/4
+ jg .deint_loop
+ ret
+
+INIT_XMM sse
+
+align 16
+fft4_avx:
+fft4_sse:
+ mova m0, Z(0)
+ mova m1, Z(1)
+ T4_SSE m0, m1, m2
+ mova Z(0), m0
+ mova Z(1), m1
+ ret
+
+align 16
+fft8_sse:
+ mova m0, Z(0)
+ mova m1, Z(1)
+ T4_SSE m0, m1, m2
+ mova m2, Z(2)
+ mova m3, Z(3)
+ T8_SSE m0, m1, m2, m3, m4, m5
+ mova Z(0), m0
+ mova Z(1), m1
+ mova Z(2), m2
+ mova Z(3), m3
+ ret
+
+align 16
+fft16_sse:
+ mova m0, Z(0)
+ mova m1, Z(1)
+ T4_SSE m0, m1, m2
+ mova m2, Z(2)
+ mova m3, Z(3)
+ T8_SSE m0, m1, m2, m3, m4, m5
+ mova m4, Z(4)
+ mova m5, Z(5)
+ mova Z(0), m0
+ mova Z(1), m1
+ mova Z(2), m2
+ mova Z(3), m3
+ T4_SSE m4, m5, m6
+ mova m6, Z2(6)
+ mova m7, Z2(7)
+ T4_SSE m6, m7, m0
+ PASS_SMALL 0, [cos_16], [cos_16+16]
+ ret
+
+
+%macro FFT48_3DNOW 0
+align 16
+fft4 %+ SUFFIX:
+ T2_3DNOW m0, m1, Z(0), Z(1)
+ mova m2, Z(2)
+ mova m3, Z(3)
+ T4_3DNOW m0, m1, m2, m3, m4, m5
+ PUNPCK m0, m1, m4
+ PUNPCK m2, m3, m5
+ mova Z(0), m0
+ mova Z(1), m4
+ mova Z(2), m2
+ mova Z(3), m5
+ ret
+
+align 16
+fft8 %+ SUFFIX:
+ T2_3DNOW m0, m1, Z(0), Z(1)
+ mova m2, Z(2)
+ mova m3, Z(3)
+ T4_3DNOW m0, m1, m2, m3, m4, m5
+ mova Z(0), m0
+ mova Z(2), m2
+ T2_3DNOW m4, m5, Z(4), Z(5)
+ T2_3DNOW m6, m7, Z2(6), Z2(7)
+ PSWAPD m0, m5
+ PSWAPD m2, m7
+ pxor m0, [ps_m1p1]
+ pxor m2, [ps_m1p1]
+ pfsub m5, m0
+ pfadd m7, m2
+ pfmul m5, [ps_root2]
+ pfmul m7, [ps_root2]
+ T4_3DNOW m1, m3, m5, m7, m0, m2
+ mova Z(5), m5
+ mova Z2(7), m7
+ mova m0, Z(0)
+ mova m2, Z(2)
+ T4_3DNOW m0, m2, m4, m6, m5, m7
+ PUNPCK m0, m1, m5
+ PUNPCK m2, m3, m7
+ mova Z(0), m0
+ mova Z(1), m5
+ mova Z(2), m2
+ mova Z(3), m7
+ PUNPCK m4, Z(5), m5
+ PUNPCK m6, Z2(7), m7
+ mova Z(4), m4
+ mova Z(5), m5
+ mova Z2(6), m6
+ mova Z2(7), m7
+ ret
+%endmacro
+
+%if ARCH_X86_32
+INIT_MMX 3dnowext
+FFT48_3DNOW
+
+INIT_MMX 3dnow
+FFT48_3DNOW
+%endif
+
+%define Z(x) [zcq + o1q*(x&6) + mmsize*(x&1)]
+%define Z2(x) [zcq + o3q + mmsize*(x&1)]
+%define ZH(x) [zcq + o1q*(x&6) + mmsize*(x&1) + mmsize/2]
+%define Z2H(x) [zcq + o3q + mmsize*(x&1) + mmsize/2]
+
+%macro DECL_PASS 2+ ; name, payload
+align 16
+%1:
+DEFINE_ARGS zc, w, n, o1, o3
+ lea o3q, [nq*3]
+ lea o1q, [nq*8]
+ shl o3q, 4
+.loop:
+ %2
+ add zcq, mmsize*2
+ add wq, mmsize
+ sub nd, mmsize/8
+ jg .loop
+ rep ret
+%endmacro
+
+%macro FFT_DISPATCH 2; clobbers 5 GPRs, 8 XMMs
+ lea r2, [dispatch_tab%1]
+ mov r2, [r2 + (%2q-2)*gprsize]
+%ifdef PIC
+ lea r3, [$$]
+ add r2, r3
+%endif
+ call r2
+%endmacro ; FFT_DISPATCH
+
+INIT_YMM avx
+
+%macro INTERL_AVX 5
+ vunpckhps %3, %2, %1
+ vunpcklps %2, %2, %1
+ vextractf128 %4(%5), %2, 0
+ vextractf128 %4 %+ H(%5), %3, 0
+ vextractf128 %4(%5 + 1), %2, 1
+ vextractf128 %4 %+ H(%5 + 1), %3, 1
+%endmacro
+
+%define INTERL INTERL_AVX
+
+DECL_PASS pass_avx, PASS_BIG 1
+DECL_PASS pass_interleave_avx, PASS_BIG 0
+
+cglobal fft_calc, 2,5,8
+ mov r3d, [r0 + FFTContext.nbits]
+ mov r0, r1
+ mov r1, r3
+ FFT_DISPATCH _interleave %+ SUFFIX, r1
+ REP_RET
+
+
+INIT_XMM sse
+
+%macro INTERL_SSE 5
+ mova %3, %2
+ unpcklps %2, %1
+ unpckhps %3, %1
+ mova %4(%5), %2
+ mova %4(%5+1), %3
+%endmacro
+
+%define INTERL INTERL_SSE
+
+DECL_PASS pass_sse, PASS_BIG 1
+DECL_PASS pass_interleave_sse, PASS_BIG 0
+
+%macro FFT_CALC_FUNC 0
+cglobal fft_calc, 2,5,8
+ mov r3d, [r0 + FFTContext.nbits]
+ PUSH r1
+ PUSH r3
+ mov r0, r1
+ mov r1, r3
+ FFT_DISPATCH _interleave %+ SUFFIX, r1
+ POP rcx
+ POP r4
+ cmp rcx, 3+(mmsize/16)
+ jg .end
+ mov r2, -1
+ add rcx, 3
+ shl r2, cl
+ sub r4, r2
+.loop:
+%if mmsize == 8
+ PSWAPD m0, [r4 + r2 + 4]
+ mova [r4 + r2 + 4], m0
+%else
+ movaps xmm0, [r4 + r2]
+ movaps xmm1, xmm0
+ unpcklps xmm0, [r4 + r2 + 16]
+ unpckhps xmm1, [r4 + r2 + 16]
+ movaps [r4 + r2], xmm0
+ movaps [r4 + r2 + 16], xmm1
+%endif
+ add r2, mmsize*2
+ jl .loop
+.end:
+%if cpuflag(3dnow)
+ femms
+ RET
+%else
+ REP_RET
+%endif
+%endmacro
+
+%if ARCH_X86_32
+INIT_MMX 3dnow
+FFT_CALC_FUNC
+INIT_MMX 3dnowext
+FFT_CALC_FUNC
+%endif
+INIT_XMM sse
+FFT_CALC_FUNC
+
+cglobal fft_permute, 2,7,1
+ mov r4, [r0 + FFTContext.revtab]
+ mov r5, [r0 + FFTContext.tmpbuf]
+ mov ecx, [r0 + FFTContext.nbits]
+ mov r2, 1
+ shl r2, cl
+ xor r0, r0
+%if ARCH_X86_32
+ mov r1, r1m
+%endif
+.loop:
+ movaps xmm0, [r1 + 8*r0]
+ movzx r6, word [r4 + 2*r0]
+ movzx r3, word [r4 + 2*r0 + 2]
+ movlps [r5 + 8*r6], xmm0
+ movhps [r5 + 8*r3], xmm0
+ add r0, 2
+ cmp r0, r2
+ jl .loop
+ shl r2, 3
+ add r1, r2
+ add r5, r2
+ neg r2
+; nbits >= 2 (FFT4) and sizeof(FFTComplex)=8 => at least 32B
+.loopcopy:
+ movaps xmm0, [r5 + r2]
+ movaps xmm1, [r5 + r2 + 16]
+ movaps [r1 + r2], xmm0
+ movaps [r1 + r2 + 16], xmm1
+ add r2, 32
+ jl .loopcopy
+ REP_RET
+
+%macro IMDCT_CALC_FUNC 0
+cglobal imdct_calc, 3,5,3
+ mov r3d, [r0 + FFTContext.mdctsize]
+ mov r4, [r0 + FFTContext.imdcthalf]
+ add r1, r3
+ PUSH r3
+ PUSH r1
+%if ARCH_X86_32
+ push r2
+ push r1
+ push r0
+%else
+ sub rsp, 8
+%endif
+ call r4
+%if ARCH_X86_32
+ add esp, 12
+%else
+ add rsp, 8
+%endif
+ POP r1
+ POP r3
+ lea r0, [r1 + 2*r3]
+ mov r2, r3
+ sub r3, mmsize
+ neg r2
+ mova m2, [ps_m1m1m1m1]
+.loop:
+%if mmsize == 8
+ PSWAPD m0, [r1 + r3]
+ PSWAPD m1, [r0 + r2]
+ pxor m0, m2
+%else
+ mova m0, [r1 + r3]
+ mova m1, [r0 + r2]
+ shufps m0, m0, 0x1b
+ shufps m1, m1, 0x1b
+ xorps m0, m2
+%endif
+ mova [r0 + r3], m1
+ mova [r1 + r2], m0
+ sub r3, mmsize
+ add r2, mmsize
+ jl .loop
+%if cpuflag(3dnow)
+ femms
+ RET
+%else
+ REP_RET
+%endif
+%endmacro
+
+%if ARCH_X86_32
+INIT_MMX 3dnow
+IMDCT_CALC_FUNC
+INIT_MMX 3dnowext
+IMDCT_CALC_FUNC
+%endif
+
+INIT_XMM sse
+IMDCT_CALC_FUNC
+
+%if ARCH_X86_32
+INIT_MMX 3dnow
+%define mulps pfmul
+%define addps pfadd
+%define subps pfsub
+%define unpcklps punpckldq
+%define unpckhps punpckhdq
+DECL_PASS pass_3dnow, PASS_SMALL 1, [wq], [wq+o1q]
+DECL_PASS pass_interleave_3dnow, PASS_BIG 0
+%define pass_3dnowext pass_3dnow
+%define pass_interleave_3dnowext pass_interleave_3dnow
+%endif
+
+%ifdef PIC
+%define SECTION_REL - $$
+%else
+%define SECTION_REL
+%endif
+
+%macro DECL_FFT 1-2 ; nbits, suffix
+%ifidn %0, 1
+%xdefine fullsuffix SUFFIX
+%else
+%xdefine fullsuffix %2 %+ SUFFIX
+%endif
+%xdefine list_of_fft fft4 %+ SUFFIX SECTION_REL, fft8 %+ SUFFIX SECTION_REL
+%if %1>=5
+%xdefine list_of_fft list_of_fft, fft16 %+ SUFFIX SECTION_REL
+%endif
+%if %1>=6
+%xdefine list_of_fft list_of_fft, fft32 %+ fullsuffix SECTION_REL
+%endif
+
+%assign n 1<<%1
+%rep 17-%1
+%assign n2 n/2
+%assign n4 n/4
+%xdefine list_of_fft list_of_fft, fft %+ n %+ fullsuffix SECTION_REL
+
+align 16
+fft %+ n %+ fullsuffix:
+ call fft %+ n2 %+ SUFFIX
+ add r0, n*4 - (n&(-2<<%1))
+ call fft %+ n4 %+ SUFFIX
+ add r0, n*2 - (n2&(-2<<%1))
+ call fft %+ n4 %+ SUFFIX
+ sub r0, n*6 + (n2&(-2<<%1))
+ lea r1, [cos_ %+ n]
+ mov r2d, n4/2
+ jmp pass %+ fullsuffix
+
+%assign n n*2
+%endrep
+%undef n
+
+align 8
+dispatch_tab %+ fullsuffix: pointer list_of_fft
+%endmacro ; DECL_FFT
+
+INIT_YMM avx
+DECL_FFT 6
+DECL_FFT 6, _interleave
+INIT_XMM sse
+DECL_FFT 5
+DECL_FFT 5, _interleave
+%if ARCH_X86_32
+INIT_MMX 3dnow
+DECL_FFT 4
+DECL_FFT 4, _interleave
+INIT_MMX 3dnowext
+DECL_FFT 4
+DECL_FFT 4, _interleave
+%endif
+
+INIT_XMM sse
+%undef mulps
+%undef addps
+%undef subps
+%undef unpcklps
+%undef unpckhps
+
+%macro PREROTATER 5 ;-2*k, 2*k, input+n4, tcos+n8, tsin+n8
+%if mmsize == 8 ; j*2+2-n4, n4-2-j*2, input+n4, tcos+n8, tsin+n8
+ PSWAPD m0, [%3+%2*4]
+ movq m2, [%3+%1*4-8]
+ movq m3, m0
+ punpckldq m0, m2
+ punpckhdq m2, m3
+ movd m1, [%4+%1*2-4] ; tcos[j]
+ movd m3, [%4+%2*2] ; tcos[n4-j-1]
+ punpckldq m1, [%5+%1*2-4] ; tsin[j]
+ punpckldq m3, [%5+%2*2] ; tsin[n4-j-1]
+
+ mova m4, m0
+ PSWAPD m5, m1
+ pfmul m0, m1
+ pfmul m4, m5
+ mova m6, m2
+ PSWAPD m5, m3
+ pfmul m2, m3
+ pfmul m6, m5
+%if cpuflag(3dnowext)
+ pfpnacc m0, m4
+ pfpnacc m2, m6
+%else
+ SBUTTERFLY dq, 0, 4, 1
+ SBUTTERFLY dq, 2, 6, 3
+ pxor m4, m7
+ pxor m6, m7
+ pfadd m0, m4
+ pfadd m2, m6
+%endif
+%else
+ movaps xmm0, [%3+%2*4]
+ movaps xmm1, [%3+%1*4-0x10]
+ movaps xmm2, xmm0
+ shufps xmm0, xmm1, 0x88
+ shufps xmm1, xmm2, 0x77
+ movlps xmm4, [%4+%2*2]
+ movlps xmm5, [%5+%2*2+0x0]
+ movhps xmm4, [%4+%1*2-0x8]
+ movhps xmm5, [%5+%1*2-0x8]
+ movaps xmm2, xmm0
+ movaps xmm3, xmm1
+ mulps xmm0, xmm5
+ mulps xmm1, xmm4
+ mulps xmm2, xmm4
+ mulps xmm3, xmm5
+ subps xmm1, xmm0
+ addps xmm2, xmm3
+ movaps xmm0, xmm1
+ unpcklps xmm1, xmm2
+ unpckhps xmm0, xmm2
+%endif
+%endmacro
+
+%macro CMUL 6 ;j, xmm0, xmm1, 3, 4, 5
+ mulps m6, %3, [%5+%1]
+ mulps m7, %2, [%5+%1]
+ mulps %2, %2, [%6+%1]
+ mulps %3, %3, [%6+%1]
+ subps %2, %2, m6
+ addps %3, %3, m7
+%endmacro
+
+%macro POSROTATESHUF_AVX 5 ;j, k, z+n8, tcos+n8, tsin+n8
+.post:
+ vmovaps ymm1, [%3+%1*2]
+ vmovaps ymm0, [%3+%1*2+0x20]
+ vmovaps ymm3, [%3+%2*2]
+ vmovaps ymm2, [%3+%2*2+0x20]
+
+ CMUL %1, ymm0, ymm1, %3, %4, %5
+ CMUL %2, ymm2, ymm3, %3, %4, %5
+ vshufps ymm1, ymm1, ymm1, 0x1b
+ vshufps ymm3, ymm3, ymm3, 0x1b
+ vperm2f128 ymm1, ymm1, ymm1, 0x01
+ vperm2f128 ymm3, ymm3, ymm3, 0x01
+ vunpcklps ymm6, ymm2, ymm1
+ vunpckhps ymm4, ymm2, ymm1
+ vunpcklps ymm7, ymm0, ymm3
+ vunpckhps ymm5, ymm0, ymm3
+
+ vextractf128 [%3+%1*2], ymm7, 0
+ vextractf128 [%3+%1*2+0x10], ymm5, 0
+ vextractf128 [%3+%1*2+0x20], ymm7, 1
+ vextractf128 [%3+%1*2+0x30], ymm5, 1
+
+ vextractf128 [%3+%2*2], ymm6, 0
+ vextractf128 [%3+%2*2+0x10], ymm4, 0
+ vextractf128 [%3+%2*2+0x20], ymm6, 1
+ vextractf128 [%3+%2*2+0x30], ymm4, 1
+ sub %2, 0x20
+ add %1, 0x20
+ jl .post
+%endmacro
+
+%macro POSROTATESHUF 5 ;j, k, z+n8, tcos+n8, tsin+n8
+.post:
+ movaps xmm1, [%3+%1*2]
+ movaps xmm0, [%3+%1*2+0x10]
+ CMUL %1, xmm0, xmm1, %3, %4, %5
+ movaps xmm5, [%3+%2*2]
+ movaps xmm4, [%3+%2*2+0x10]
+ CMUL %2, xmm4, xmm5, %3, %4, %5
+ shufps xmm1, xmm1, 0x1b
+ shufps xmm5, xmm5, 0x1b
+ movaps xmm6, xmm4
+ unpckhps xmm4, xmm1
+ unpcklps xmm6, xmm1
+ movaps xmm2, xmm0
+ unpcklps xmm0, xmm5
+ unpckhps xmm2, xmm5
+ movaps [%3+%2*2], xmm6
+ movaps [%3+%2*2+0x10], xmm4
+ movaps [%3+%1*2], xmm0
+ movaps [%3+%1*2+0x10], xmm2
+ sub %2, 0x10
+ add %1, 0x10
+ jl .post
+%endmacro
+
+%macro CMUL_3DNOW 6
+ mova m6, [%1+%2*2]
+ mova %3, [%1+%2*2+8]
+ mova %4, m6
+ mova m7, %3
+ pfmul m6, [%5+%2]
+ pfmul %3, [%6+%2]
+ pfmul %4, [%6+%2]
+ pfmul m7, [%5+%2]
+ pfsub %3, m6
+ pfadd %4, m7
+%endmacro
+
+%macro POSROTATESHUF_3DNOW 5 ;j, k, z+n8, tcos+n8, tsin+n8
+.post:
+ CMUL_3DNOW %3, %1, m0, m1, %4, %5
+ CMUL_3DNOW %3, %2, m2, m3, %4, %5
+ movd [%3+%1*2+ 0], m0
+ movd [%3+%2*2+12], m1
+ movd [%3+%2*2+ 0], m2
+ movd [%3+%1*2+12], m3
+ psrlq m0, 32
+ psrlq m1, 32
+ psrlq m2, 32
+ psrlq m3, 32
+ movd [%3+%1*2+ 8], m0
+ movd [%3+%2*2+ 4], m1
+ movd [%3+%2*2+ 8], m2
+ movd [%3+%1*2+ 4], m3
+ sub %2, 8
+ add %1, 8
+ jl .post
+%endmacro
+
+%macro DECL_IMDCT 1
+cglobal imdct_half, 3,12,8; FFTContext *s, FFTSample *output, const FFTSample *input
+%if ARCH_X86_64
+%define rrevtab r7
+%define rtcos r8
+%define rtsin r9
+%else
+%define rrevtab r6
+%define rtsin r6
+%define rtcos r5
+%endif
+ mov r3d, [r0+FFTContext.mdctsize]
+ add r2, r3
+ shr r3, 1
+ mov rtcos, [r0+FFTContext.tcos]
+ mov rtsin, [r0+FFTContext.tsin]
+ add rtcos, r3
+ add rtsin, r3
+%if ARCH_X86_64 == 0
+ push rtcos
+ push rtsin
+%endif
+ shr r3, 1
+ mov rrevtab, [r0+FFTContext.revtab]
+ add rrevtab, r3
+%if ARCH_X86_64 == 0
+ push rrevtab
+%endif
+
+%if mmsize == 8
+ sub r3, 2
+%else
+ sub r3, 4
+%endif
+%if ARCH_X86_64 || mmsize == 8
+ xor r4, r4
+ sub r4, r3
+%endif
+%if notcpuflag(3dnowext) && mmsize == 8
+ movd m7, [ps_m1m1m1m1]
+%endif
+.pre:
+%if ARCH_X86_64 == 0
+;unspill
+%if mmsize != 8
+ xor r4, r4
+ sub r4, r3
+%endif
+ mov rtcos, [esp+8]
+ mov rtsin, [esp+4]
+%endif
+
+ PREROTATER r4, r3, r2, rtcos, rtsin
+%if mmsize == 8
+ mov r6, [esp] ; rrevtab = ptr+n8
+ movzx r5, word [rrevtab+r4-2] ; rrevtab[j]
+ movzx r6, word [rrevtab+r3] ; rrevtab[n4-j-1]
+ mova [r1+r5*8], m0
+ mova [r1+r6*8], m2
+ add r4, 2
+ sub r3, 2
+%else
+%if ARCH_X86_64
+ movzx r5, word [rrevtab+r4-4]
+ movzx r6, word [rrevtab+r4-2]
+ movzx r10, word [rrevtab+r3]
+ movzx r11, word [rrevtab+r3+2]
+ movlps [r1+r5 *8], xmm0
+ movhps [r1+r6 *8], xmm0
+ movlps [r1+r10*8], xmm1
+ movhps [r1+r11*8], xmm1
+ add r4, 4
+%else
+ mov r6, [esp]
+ movzx r5, word [r6+r4-4]
+ movzx r4, word [r6+r4-2]
+ movlps [r1+r5*8], xmm0
+ movhps [r1+r4*8], xmm0
+ movzx r5, word [r6+r3]
+ movzx r4, word [r6+r3+2]
+ movlps [r1+r5*8], xmm1
+ movhps [r1+r4*8], xmm1
+%endif
+ sub r3, 4
+%endif
+ jns .pre
+
+ mov r5, r0
+ mov r6, r1
+ mov r0, r1
+ mov r1d, [r5+FFTContext.nbits]
+
+ FFT_DISPATCH SUFFIX, r1
+
+ mov r0d, [r5+FFTContext.mdctsize]
+ add r6, r0
+ shr r0, 1
+%if ARCH_X86_64 == 0
+%define rtcos r2
+%define rtsin r3
+ mov rtcos, [esp+8]
+ mov rtsin, [esp+4]
+%endif
+ neg r0
+ mov r1, -mmsize
+ sub r1, r0
+ %1 r0, r1, r6, rtcos, rtsin
+%if ARCH_X86_64 == 0
+ add esp, 12
+%endif
+%if mmsize == 8
+ femms
+%endif
+ RET
+%endmacro
+
+DECL_IMDCT POSROTATESHUF
+
+%if ARCH_X86_32
+INIT_MMX 3dnow
+DECL_IMDCT POSROTATESHUF_3DNOW
+
+INIT_MMX 3dnowext
+DECL_IMDCT POSROTATESHUF_3DNOW
+%endif
+
+INIT_YMM avx
+DECL_IMDCT POSROTATESHUF_AVX
diff --git a/gst-libs/ext/libav/libavcodec/x86/fft.c b/gst-libs/ext/libav/libavcodec/x86/fft.c
deleted file mode 100644
index f7308cc..0000000
--- a/gst-libs/ext/libav/libavcodec/x86/fft.c
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * 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
- */
-
-#include "libavutil/cpu.h"
-#include "libavcodec/dsputil.h"
-#include "libavcodec/dct.h"
-#include "fft.h"
-
-av_cold void ff_fft_init_mmx(FFTContext *s)
-{
-#if HAVE_YASM
- int has_vectors = av_get_cpu_flags();
- if (has_vectors & AV_CPU_FLAG_AVX && HAVE_AVX && s->nbits >= 5) {
- /* AVX for SB */
- s->imdct_calc = ff_imdct_calc_sse;
- s->imdct_half = ff_imdct_half_avx;
- s->fft_permute = ff_fft_permute_sse;
- s->fft_calc = ff_fft_calc_avx;
- s->fft_permutation = FF_FFT_PERM_AVX;
- } else if (has_vectors & AV_CPU_FLAG_SSE && HAVE_SSE) {
- /* SSE for P3/P4/K8 */
- s->imdct_calc = ff_imdct_calc_sse;
- s->imdct_half = ff_imdct_half_sse;
- s->fft_permute = ff_fft_permute_sse;
- s->fft_calc = ff_fft_calc_sse;
- s->fft_permutation = FF_FFT_PERM_SWAP_LSBS;
- } else if (has_vectors & AV_CPU_FLAG_3DNOWEXT && HAVE_AMD3DNOWEXT) {
- /* 3DNowEx for K7 */
- s->imdct_calc = ff_imdct_calc_3dn2;
- s->imdct_half = ff_imdct_half_3dn2;
- s->fft_calc = ff_fft_calc_3dn2;
- } else if (has_vectors & AV_CPU_FLAG_3DNOW && HAVE_AMD3DNOW) {
- /* 3DNow! for K6-2/3 */
- s->imdct_calc = ff_imdct_calc_3dn;
- s->imdct_half = ff_imdct_half_3dn;
- s->fft_calc = ff_fft_calc_3dn;
- }
-#endif
-}
-
-#if CONFIG_DCT
-av_cold void ff_dct_init_mmx(DCTContext *s)
-{
-#if HAVE_YASM
- int has_vectors = av_get_cpu_flags();
- if (has_vectors & AV_CPU_FLAG_AVX && HAVE_AVX)
- s->dct32 = ff_dct32_float_avx;
- else if (has_vectors & AV_CPU_FLAG_SSE2 && HAVE_SSE)
- s->dct32 = ff_dct32_float_sse2;
- else if (has_vectors & AV_CPU_FLAG_SSE && HAVE_SSE)
- s->dct32 = ff_dct32_float_sse;
-#endif
-}
-#endif
-
diff --git a/gst-libs/ext/libav/libavcodec/x86/fft.h b/gst-libs/ext/libav/libavcodec/x86/fft.h
index 9d68d5b..6e80b95 100644
--- a/gst-libs/ext/libav/libavcodec/x86/fft.h
+++ b/gst-libs/ext/libav/libavcodec/x86/fft.h
@@ -24,13 +24,13 @@
void ff_fft_permute_sse(FFTContext *s, FFTComplex *z);
void ff_fft_calc_avx(FFTContext *s, FFTComplex *z);
void ff_fft_calc_sse(FFTContext *s, FFTComplex *z);
-void ff_fft_calc_3dn(FFTContext *s, FFTComplex *z);
-void ff_fft_calc_3dn2(FFTContext *s, FFTComplex *z);
+void ff_fft_calc_3dnow(FFTContext *s, FFTComplex *z);
+void ff_fft_calc_3dnowext(FFTContext *s, FFTComplex *z);
-void ff_imdct_calc_3dn(FFTContext *s, FFTSample *output, const FFTSample *input);
-void ff_imdct_half_3dn(FFTContext *s, FFTSample *output, const FFTSample *input);
-void ff_imdct_calc_3dn2(FFTContext *s, FFTSample *output, const FFTSample *input);
-void ff_imdct_half_3dn2(FFTContext *s, FFTSample *output, const FFTSample *input);
+void ff_imdct_calc_3dnow(FFTContext *s, FFTSample *output, const FFTSample *input);
+void ff_imdct_half_3dnow(FFTContext *s, FFTSample *output, const FFTSample *input);
+void ff_imdct_calc_3dnowext(FFTContext *s, FFTSample *output, const FFTSample *input);
+void ff_imdct_half_3dnowext(FFTContext *s, FFTSample *output, const FFTSample *input);
void ff_imdct_calc_sse(FFTContext *s, FFTSample *output, const FFTSample *input);
void ff_imdct_half_sse(FFTContext *s, FFTSample *output, const FFTSample *input);
void ff_imdct_half_avx(FFTContext *s, FFTSample *output, const FFTSample *input);
diff --git a/gst-libs/ext/libav/libavcodec/x86/fft_3dn.c b/gst-libs/ext/libav/libavcodec/x86/fft_3dn.c
deleted file mode 100644
index 5a4d3ad..0000000
--- a/gst-libs/ext/libav/libavcodec/x86/fft_3dn.c
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * FFT/MDCT transform with 3DNow! optimizations
- * Copyright (c) 2008 Loren Merritt
- *
- * 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
- */
-
-#define EMULATE_3DNOWEXT
-#include "fft_3dn2.c"
diff --git a/gst-libs/ext/libav/libavcodec/x86/fft_3dn2.c b/gst-libs/ext/libav/libavcodec/x86/fft_3dn2.c
deleted file mode 100644
index a724398..0000000
--- a/gst-libs/ext/libav/libavcodec/x86/fft_3dn2.c
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
- * FFT/MDCT transform with Extended 3DNow! optimizations
- * Copyright (c) 2006-2008 Zuxy MENG Jie, Loren Merritt
- *
- * 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
- */
-
-#include "libavutil/x86_cpu.h"
-#include "libavcodec/dsputil.h"
-#include "fft.h"
-
-DECLARE_ALIGNED(8, static const unsigned int, m1m1)[2] = { 1U<<31, 1U<<31 };
-
-#ifdef EMULATE_3DNOWEXT
-#define PSWAPD(s,d)\
- "movq "#s","#d"\n"\
- "psrlq $32,"#d"\n"\
- "punpckldq "#s","#d"\n"
-#define ff_fft_calc_3dn2 ff_fft_calc_3dn
-#define ff_fft_dispatch_3dn2 ff_fft_dispatch_3dn
-#define ff_fft_dispatch_interleave_3dn2 ff_fft_dispatch_interleave_3dn
-#define ff_imdct_calc_3dn2 ff_imdct_calc_3dn
-#define ff_imdct_half_3dn2 ff_imdct_half_3dn
-#else
-#define PSWAPD(s,d) "pswapd "#s","#d"\n"
-#endif
-
-void ff_fft_dispatch_3dn2(FFTComplex *z, int nbits);
-void ff_fft_dispatch_interleave_3dn2(FFTComplex *z, int nbits);
-
-void ff_fft_calc_3dn2(FFTContext *s, FFTComplex *z)
-{
- int n = 1<<s->nbits;
- int i;
- ff_fft_dispatch_interleave_3dn2(z, s->nbits);
- __asm__ volatile("femms");
- if(n <= 8)
- for(i=0; i<n; i+=2)
- FFSWAP(FFTSample, z[i].im, z[i+1].re);
-}
-
-void ff_imdct_half_3dn2(FFTContext *s, FFTSample *output, const FFTSample *input)
-{
- x86_reg j, k;
- long n = s->mdct_size;
- long n2 = n >> 1;
- long n4 = n >> 2;
- long n8 = n >> 3;
- const uint16_t *revtab = s->revtab;
- const FFTSample *tcos = s->tcos;
- const FFTSample *tsin = s->tsin;
- const FFTSample *in1, *in2;
- FFTComplex *z = (FFTComplex *)output;
-
- /* pre rotation */
- in1 = input;
- in2 = input + n2 - 1;
-#ifdef EMULATE_3DNOWEXT
- __asm__ volatile("movd %0, %%mm7" ::"r"(1U<<31));
-#endif
- for(k = 0; k < n4; k++) {
- // FIXME a single block is faster, but gcc 2.95 and 3.4.x on 32bit can't compile it
- __asm__ volatile(
- "movd %0, %%mm0 \n"
- "movd %2, %%mm1 \n"
- "punpckldq %1, %%mm0 \n"
- "punpckldq %3, %%mm1 \n"
- "movq %%mm0, %%mm2 \n"
- PSWAPD( %%mm1, %%mm3 )
- "pfmul %%mm1, %%mm0 \n"
- "pfmul %%mm3, %%mm2 \n"
-#ifdef EMULATE_3DNOWEXT
- "movq %%mm0, %%mm1 \n"
- "punpckhdq %%mm2, %%mm0 \n"
- "punpckldq %%mm2, %%mm1 \n"
- "pxor %%mm7, %%mm0 \n"
- "pfadd %%mm1, %%mm0 \n"
-#else
- "pfpnacc %%mm2, %%mm0 \n"
-#endif
- ::"m"(in2[-2*k]), "m"(in1[2*k]),
- "m"(tcos[k]), "m"(tsin[k])
- );
- __asm__ volatile(
- "movq %%mm0, %0 \n\t"
- :"=m"(z[revtab[k]])
- );
- }
-
- ff_fft_dispatch_3dn2(z, s->nbits);
-
-#define CMUL(j,mm0,mm1)\
- "movq (%2,"#j",2), %%mm6 \n"\
- "movq 8(%2,"#j",2), "#mm0"\n"\
- "movq %%mm6, "#mm1"\n"\
- "movq "#mm0",%%mm7 \n"\
- "pfmul (%3,"#j"), %%mm6 \n"\
- "pfmul (%4,"#j"), "#mm0"\n"\
- "pfmul (%4,"#j"), "#mm1"\n"\
- "pfmul (%3,"#j"), %%mm7 \n"\
- "pfsub %%mm6, "#mm0"\n"\
- "pfadd %%mm7, "#mm1"\n"
-
- /* post rotation */
- j = -n2;
- k = n2-8;
- __asm__ volatile(
- "1: \n"
- CMUL(%0, %%mm0, %%mm1)
- CMUL(%1, %%mm2, %%mm3)
- "movd %%mm0, (%2,%0,2) \n"
- "movd %%mm1,12(%2,%1,2) \n"
- "movd %%mm2, (%2,%1,2) \n"
- "movd %%mm3,12(%2,%0,2) \n"
- "psrlq $32, %%mm0 \n"
- "psrlq $32, %%mm1 \n"
- "psrlq $32, %%mm2 \n"
- "psrlq $32, %%mm3 \n"
- "movd %%mm0, 8(%2,%0,2) \n"
- "movd %%mm1, 4(%2,%1,2) \n"
- "movd %%mm2, 8(%2,%1,2) \n"
- "movd %%mm3, 4(%2,%0,2) \n"
- "sub $8, %1 \n"
- "add $8, %0 \n"
- "jl 1b \n"
- :"+r"(j), "+r"(k)
- :"r"(z+n8), "r"(tcos+n8), "r"(tsin+n8)
- :"memory"
- );
- __asm__ volatile("femms");
-}
-
-void ff_imdct_calc_3dn2(FFTContext *s, FFTSample *output, const FFTSample *input)
-{
- x86_reg j, k;
- long n = s->mdct_size;
- long n4 = n >> 2;
-
- ff_imdct_half_3dn2(s, output+n4, input);
-
- j = -n;
- k = n-8;
- __asm__ volatile(
- "movq %4, %%mm7 \n"
- "1: \n"
- PSWAPD((%2,%1), %%mm0)
- PSWAPD((%3,%0), %%mm1)
- "pxor %%mm7, %%mm0 \n"
- "movq %%mm1, (%3,%1) \n"
- "movq %%mm0, (%2,%0) \n"
- "sub $8, %1 \n"
- "add $8, %0 \n"
- "jl 1b \n"
- :"+r"(j), "+r"(k)
- :"r"(output+n4), "r"(output+n4*3),
- "m"(*m1m1)
- );
- __asm__ volatile("femms");
-}
-
diff --git a/gst-libs/ext/libav/libavcodec/x86/fft_init.c b/gst-libs/ext/libav/libavcodec/x86/fft_init.c
new file mode 100644
index 0000000..5554b24
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/x86/fft_init.c
@@ -0,0 +1,69 @@
+/*
+ * 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
+ */
+
+#include "libavutil/cpu.h"
+#include "libavutil/x86/cpu.h"
+#include "libavcodec/dsputil.h"
+#include "libavcodec/dct.h"
+#include "fft.h"
+
+av_cold void ff_fft_init_x86(FFTContext *s)
+{
+ int has_vectors = av_get_cpu_flags();
+#if ARCH_X86_32
+ if (EXTERNAL_AMD3DNOW(has_vectors)) {
+ /* 3DNow! for K6-2/3 */
+ s->imdct_calc = ff_imdct_calc_3dnow;
+ s->imdct_half = ff_imdct_half_3dnow;
+ s->fft_calc = ff_fft_calc_3dnow;
+ }
+ if (EXTERNAL_AMD3DNOWEXT(has_vectors)) {
+ /* 3DNowEx for K7 */
+ s->imdct_calc = ff_imdct_calc_3dnowext;
+ s->imdct_half = ff_imdct_half_3dnowext;
+ s->fft_calc = ff_fft_calc_3dnowext;
+ }
+#endif
+ if (EXTERNAL_SSE(has_vectors)) {
+ /* SSE for P3/P4/K8 */
+ s->imdct_calc = ff_imdct_calc_sse;
+ s->imdct_half = ff_imdct_half_sse;
+ s->fft_permute = ff_fft_permute_sse;
+ s->fft_calc = ff_fft_calc_sse;
+ s->fft_permutation = FF_FFT_PERM_SWAP_LSBS;
+ }
+ if (EXTERNAL_AVX(has_vectors) && s->nbits >= 5) {
+ /* AVX for SB */
+ s->imdct_half = ff_imdct_half_avx;
+ s->fft_calc = ff_fft_calc_avx;
+ s->fft_permutation = FF_FFT_PERM_AVX;
+ }
+}
+
+#if CONFIG_DCT
+av_cold void ff_dct_init_x86(DCTContext *s)
+{
+ int has_vectors = av_get_cpu_flags();
+ if (EXTERNAL_SSE(has_vectors))
+ s->dct32 = ff_dct32_float_sse;
+ if (EXTERNAL_SSE2(has_vectors))
+ s->dct32 = ff_dct32_float_sse2;
+ if (EXTERNAL_AVX(has_vectors))
+ s->dct32 = ff_dct32_float_avx;
+}
+#endif
diff --git a/gst-libs/ext/libav/libavcodec/x86/fft_mmx.asm b/gst-libs/ext/libav/libavcodec/x86/fft_mmx.asm
deleted file mode 100644
index d6d07b8..0000000
--- a/gst-libs/ext/libav/libavcodec/x86/fft_mmx.asm
+++ /dev/null
@@ -1,861 +0,0 @@
-;******************************************************************************
-;* FFT transform with SSE/3DNow optimizations
-;* Copyright (c) 2008 Loren Merritt
-;* Copyright (c) 2011 Vitor Sessak
-;*
-;* This algorithm (though not any of the implementation details) is
-;* based on libdjbfft by D. J. Bernstein.
-;*
-;* 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
-;******************************************************************************
-
-; These functions are not individually interchangeable with the C versions.
-; While C takes arrays of FFTComplex, SSE/3DNow leave intermediate results
-; in blocks as conventient to the vector size.
-; i.e. {4x real, 4x imaginary, 4x real, ...} (or 2x respectively)
-
-%include "x86inc.asm"
-
-%ifdef ARCH_X86_64
-%define pointer resq
-%else
-%define pointer resd
-%endif
-
-struc FFTContext
- .nbits: resd 1
- .reverse: resd 1
- .revtab: pointer 1
- .tmpbuf: pointer 1
- .mdctsize: resd 1
- .mdctbits: resd 1
- .tcos: pointer 1
- .tsin: pointer 1
-endstruc
-
-SECTION_RODATA
-
-%define M_SQRT1_2 0.70710678118654752440
-%define M_COS_PI_1_8 0.923879532511287
-%define M_COS_PI_3_8 0.38268343236509
-
-align 32
-ps_cos16_1: dd 1.0, M_COS_PI_1_8, M_SQRT1_2, M_COS_PI_3_8, 1.0, M_COS_PI_1_8, M_SQRT1_2, M_COS_PI_3_8
-ps_cos16_2: dd 0, M_COS_PI_3_8, M_SQRT1_2, M_COS_PI_1_8, 0, -M_COS_PI_3_8, -M_SQRT1_2, -M_COS_PI_1_8
-
-ps_root2: times 8 dd M_SQRT1_2
-ps_root2mppm: dd -M_SQRT1_2, M_SQRT1_2, M_SQRT1_2, -M_SQRT1_2, -M_SQRT1_2, M_SQRT1_2, M_SQRT1_2, -M_SQRT1_2
-ps_p1p1m1p1: dd 0, 0, 1<<31, 0, 0, 0, 1<<31, 0
-
-perm1: dd 0x00, 0x02, 0x03, 0x01, 0x03, 0x00, 0x02, 0x01
-perm2: dd 0x00, 0x01, 0x02, 0x03, 0x01, 0x00, 0x02, 0x03
-ps_p1p1m1p1root2: dd 1.0, 1.0, -1.0, 1.0, M_SQRT1_2, M_SQRT1_2, M_SQRT1_2, M_SQRT1_2
-ps_m1m1p1m1p1m1m1m1: dd 1<<31, 1<<31, 0, 1<<31, 0, 1<<31, 1<<31, 1<<31
-ps_m1p1: dd 1<<31, 0
-
-%assign i 16
-%rep 13
-cextern cos_ %+ i
-%assign i i<<1
-%endrep
-
-%ifdef ARCH_X86_64
- %define pointer dq
-%else
- %define pointer dd
-%endif
-
-%macro IF0 1+
-%endmacro
-%macro IF1 1+
- %1
-%endmacro
-
-SECTION_TEXT
-
-%macro T2_3DN 4 ; z0, z1, mem0, mem1
- mova %1, %3
- mova %2, %1
- pfadd %1, %4
- pfsub %2, %4
-%endmacro
-
-%macro T4_3DN 6 ; z0, z1, z2, z3, tmp0, tmp1
- mova %5, %3
- pfsub %3, %4
- pfadd %5, %4 ; {t6,t5}
- pxor %3, [ps_m1p1] ; {t8,t7}
- mova %6, %1
- pswapd %3, %3
- pfadd %1, %5 ; {r0,i0}
- pfsub %6, %5 ; {r2,i2}
- mova %4, %2
- pfadd %2, %3 ; {r1,i1}
- pfsub %4, %3 ; {r3,i3}
- SWAP %3, %6
-%endmacro
-
-; in: %1 = {r0,i0,r2,i2,r4,i4,r6,i6}
-; %2 = {r1,i1,r3,i3,r5,i5,r7,i7}
-; %3, %4, %5 tmp
-; out: %1 = {r0,r1,r2,r3,i0,i1,i2,i3}
-; %2 = {r4,r5,r6,r7,i4,i5,i6,i7}
-%macro T8_AVX 5
- vsubps %5, %1, %2 ; v = %1 - %2
- vaddps %3, %1, %2 ; w = %1 + %2
- vmulps %2, %5, [ps_p1p1m1p1root2] ; v *= vals1
- vpermilps %2, %2, [perm1]
- vblendps %1, %2, %3, 0x33 ; q = {w1,w2,v4,v2,w5,w6,v7,v6}
- vshufps %5, %3, %2, 0x4e ; r = {w3,w4,v1,v3,w7,w8,v8,v5}
- vsubps %4, %5, %1 ; s = r - q
- vaddps %1, %5, %1 ; u = r + q
- vpermilps %1, %1, [perm2] ; k = {u1,u2,u3,u4,u6,u5,u7,u8}
- vshufps %5, %4, %1, 0xbb
- vshufps %3, %4, %1, 0xee
- vperm2f128 %3, %3, %5, 0x13
- vxorps %4, %4, [ps_m1m1p1m1p1m1m1m1] ; s *= {1,1,-1,-1,1,-1,-1,-1}
- vshufps %2, %1, %4, 0xdd
- vshufps %1, %1, %4, 0x88
- vperm2f128 %4, %2, %1, 0x02 ; v = {k1,k3,s1,s3,k2,k4,s2,s4}
- vperm2f128 %1, %1, %2, 0x13 ; w = {k6,k8,s6,s8,k5,k7,s5,s7}
- vsubps %5, %1, %3
- vblendps %1, %5, %1, 0x55 ; w -= {0,s7,0,k7,0,s8,0,k8}
- vsubps %2, %4, %1 ; %2 = v - w
- vaddps %1, %4, %1 ; %1 = v + w
-%endmacro
-
-; In SSE mode do one fft4 transforms
-; in: %1={r0,i0,r2,i2} %2={r1,i1,r3,i3}
-; out: %1={r0,r1,r2,r3} %2={i0,i1,i2,i3}
-;
-; In AVX mode do two fft4 transforms
-; in: %1={r0,i0,r2,i2,r4,i4,r6,i6} %2={r1,i1,r3,i3,r5,i5,r7,i7}
-; out: %1={r0,r1,r2,r3,r4,r5,r6,r7} %2={i0,i1,i2,i3,i4,i5,i6,i7}
-%macro T4_SSE 3
- subps %3, %1, %2 ; {t3,t4,-t8,t7}
- addps %1, %1, %2 ; {t1,t2,t6,t5}
- xorps %3, %3, [ps_p1p1m1p1]
- shufps %2, %1, %3, 0xbe ; {t6,t5,t7,t8}
- shufps %1, %1, %3, 0x44 ; {t1,t2,t3,t4}
- subps %3, %1, %2 ; {r2,i2,r3,i3}
- addps %1, %1, %2 ; {r0,i0,r1,i1}
- shufps %2, %1, %3, 0xdd ; {i0,i1,i2,i3}
- shufps %1, %1, %3, 0x88 ; {r0,r1,r2,r3}
-%endmacro
-
-; In SSE mode do one FFT8
-; in: %1={r0,r1,r2,r3} %2={i0,i1,i2,i3} %3={r4,i4,r6,i6} %4={r5,i5,r7,i7}
-; out: %1={r0,r1,r2,r3} %2={i0,i1,i2,i3} %1={r4,r5,r6,r7} %2={i4,i5,i6,i7}
-;
-; In AVX mode do two FFT8
-; in: %1={r0,i0,r2,i2,r8, i8, r10,i10} %2={r1,i1,r3,i3,r9, i9, r11,i11}
-; %3={r4,i4,r6,i6,r12,i12,r14,i14} %4={r5,i5,r7,i7,r13,i13,r15,i15}
-; out: %1={r0,r1,r2,r3,r8, r9, r10,r11} %2={i0,i1,i2,i3,i8, i9, i10,i11}
-; %3={r4,r5,r6,r7,r12,r13,r14,r15} %4={i4,i5,i6,i7,i12,i13,i14,i15}
-%macro T8_SSE 6
- addps %6, %3, %4 ; {t1,t2,t3,t4}
- subps %3, %3, %4 ; {r5,i5,r7,i7}
- shufps %4, %3, %3, 0xb1 ; {i5,r5,i7,r7}
- mulps %3, %3, [ps_root2mppm] ; {-r5,i5,r7,-i7}
- mulps %4, %4, [ps_root2]
- addps %3, %3, %4 ; {t8,t7,ta,t9}
- shufps %4, %6, %3, 0x9c ; {t1,t4,t7,ta}
- shufps %6, %6, %3, 0x36 ; {t3,t2,t9,t8}
- subps %3, %6, %4 ; {t6,t5,tc,tb}
- addps %6, %6, %4 ; {t1,t2,t9,ta}
- shufps %5, %6, %3, 0x8d ; {t2,ta,t6,tc}
- shufps %6, %6, %3, 0xd8 ; {t1,t9,t5,tb}
- subps %3, %1, %6 ; {r4,r5,r6,r7}
- addps %1, %1, %6 ; {r0,r1,r2,r3}
- subps %4, %2, %5 ; {i4,i5,i6,i7}
- addps %2, %2, %5 ; {i0,i1,i2,i3}
-%endmacro
-
-; scheduled for cpu-bound sizes
-%macro PASS_SMALL 3 ; (to load m4-m7), wre, wim
-IF%1 mova m4, Z(4)
-IF%1 mova m5, Z(5)
- mova m0, %2 ; wre
- mova m1, %3 ; wim
- mulps m2, m4, m0 ; r2*wre
-IF%1 mova m6, Z2(6)
- mulps m3, m5, m1 ; i2*wim
-IF%1 mova m7, Z2(7)
- mulps m4, m4, m1 ; r2*wim
- mulps m5, m5, m0 ; i2*wre
- addps m2, m2, m3 ; r2*wre + i2*wim
- mulps m3, m1, m7 ; i3*wim
- subps m5, m5, m4 ; i2*wre - r2*wim
- mulps m1, m1, m6 ; r3*wim
- mulps m4, m0, m6 ; r3*wre
- mulps m0, m0, m7 ; i3*wre
- subps m4, m4, m3 ; r3*wre - i3*wim
- mova m3, Z(0)
- addps m0, m0, m1 ; i3*wre + r3*wim
- subps m1, m4, m2 ; t3
- addps m4, m4, m2 ; t5
- subps m3, m3, m4 ; r2
- addps m4, m4, Z(0) ; r0
- mova m6, Z(2)
- mova Z(4), m3
- mova Z(0), m4
- subps m3, m5, m0 ; t4
- subps m4, m6, m3 ; r3
- addps m3, m3, m6 ; r1
- mova Z2(6), m4
- mova Z(2), m3
- mova m2, Z(3)
- addps m3, m5, m0 ; t6
- subps m2, m2, m1 ; i3
- mova m7, Z(1)
- addps m1, m1, Z(3) ; i1
- mova Z2(7), m2
- mova Z(3), m1
- subps m4, m7, m3 ; i2
- addps m3, m3, m7 ; i0
- mova Z(5), m4
- mova Z(1), m3
-%endmacro
-
-; scheduled to avoid store->load aliasing
-%macro PASS_BIG 1 ; (!interleave)
- mova m4, Z(4) ; r2
- mova m5, Z(5) ; i2
- mova m0, [wq] ; wre
- mova m1, [wq+o1q] ; wim
- mulps m2, m4, m0 ; r2*wre
- mova m6, Z2(6) ; r3
- mulps m3, m5, m1 ; i2*wim
- mova m7, Z2(7) ; i3
- mulps m4, m4, m1 ; r2*wim
- mulps m5, m5, m0 ; i2*wre
- addps m2, m2, m3 ; r2*wre + i2*wim
- mulps m3, m1, m7 ; i3*wim
- mulps m1, m1, m6 ; r3*wim
- subps m5, m5, m4 ; i2*wre - r2*wim
- mulps m4, m0, m6 ; r3*wre
- mulps m0, m0, m7 ; i3*wre
- subps m4, m4, m3 ; r3*wre - i3*wim
- mova m3, Z(0)
- addps m0, m0, m1 ; i3*wre + r3*wim
- subps m1, m4, m2 ; t3
- addps m4, m4, m2 ; t5
- subps m3, m3, m4 ; r2
- addps m4, m4, Z(0) ; r0
- mova m6, Z(2)
- mova Z(4), m3
- mova Z(0), m4
- subps m3, m5, m0 ; t4
- subps m4, m6, m3 ; r3
- addps m3, m3, m6 ; r1
-IF%1 mova Z2(6), m4
-IF%1 mova Z(2), m3
- mova m2, Z(3)
- addps m5, m5, m0 ; t6
- subps m2, m2, m1 ; i3
- mova m7, Z(1)
- addps m1, m1, Z(3) ; i1
-IF%1 mova Z2(7), m2
-IF%1 mova Z(3), m1
- subps m6, m7, m5 ; i2
- addps m5, m5, m7 ; i0
-IF%1 mova Z(5), m6
-IF%1 mova Z(1), m5
-%if %1==0
- INTERL m1, m3, m7, Z, 2
- INTERL m2, m4, m0, Z2, 6
-
- mova m1, Z(0)
- mova m2, Z(4)
-
- INTERL m5, m1, m3, Z, 0
- INTERL m6, m2, m7, Z, 4
-%endif
-%endmacro
-
-%macro PUNPCK 3
- mova %3, %1
- punpckldq %1, %2
- punpckhdq %3, %2
-%endmacro
-
-%define Z(x) [r0+mmsize*x]
-%define Z2(x) [r0+mmsize*x]
-%define ZH(x) [r0+mmsize*x+mmsize/2]
-
-INIT_YMM
-
-%ifdef HAVE_AVX
-align 16
-fft8_avx:
- mova m0, Z(0)
- mova m1, Z(1)
- T8_AVX m0, m1, m2, m3, m4
- mova Z(0), m0
- mova Z(1), m1
- ret
-
-
-align 16
-fft16_avx:
- mova m2, Z(2)
- mova m3, Z(3)
- T4_SSE m2, m3, m7
-
- mova m0, Z(0)
- mova m1, Z(1)
- T8_AVX m0, m1, m4, m5, m7
-
- mova m4, [ps_cos16_1]
- mova m5, [ps_cos16_2]
- vmulps m6, m2, m4
- vmulps m7, m3, m5
- vaddps m7, m7, m6
- vmulps m2, m2, m5
- vmulps m3, m3, m4
- vsubps m3, m3, m2
- vblendps m2, m7, m3, 0xf0
- vperm2f128 m3, m7, m3, 0x21
- vaddps m4, m2, m3
- vsubps m2, m3, m2
- vperm2f128 m2, m2, m2, 0x01
- vsubps m3, m1, m2
- vaddps m1, m1, m2
- vsubps m5, m0, m4
- vaddps m0, m0, m4
- vextractf128 Z(0), m0, 0
- vextractf128 ZH(0), m1, 0
- vextractf128 Z(1), m0, 1
- vextractf128 ZH(1), m1, 1
- vextractf128 Z(2), m5, 0
- vextractf128 ZH(2), m3, 0
- vextractf128 Z(3), m5, 1
- vextractf128 ZH(3), m3, 1
- ret
-
-align 16
-fft32_avx:
- call fft16_avx
-
- mova m0, Z(4)
- mova m1, Z(5)
-
- T4_SSE m0, m1, m4
-
- mova m2, Z(6)
- mova m3, Z(7)
-
- T8_SSE m0, m1, m2, m3, m4, m6
- ; m0={r0,r1,r2,r3,r8, r9, r10,r11} m1={i0,i1,i2,i3,i8, i9, i10,i11}
- ; m2={r4,r5,r6,r7,r12,r13,r14,r15} m3={i4,i5,i6,i7,i12,i13,i14,i15}
-
- vperm2f128 m4, m0, m2, 0x20
- vperm2f128 m5, m1, m3, 0x20
- vperm2f128 m6, m0, m2, 0x31
- vperm2f128 m7, m1, m3, 0x31
-
- PASS_SMALL 0, [cos_32], [cos_32+32]
-
- ret
-
-fft32_interleave_avx:
- call fft32_avx
- mov r2d, 32
-.deint_loop:
- mova m2, Z(0)
- mova m3, Z(1)
- vunpcklps m0, m2, m3
- vunpckhps m1, m2, m3
- vextractf128 Z(0), m0, 0
- vextractf128 ZH(0), m1, 0
- vextractf128 Z(1), m0, 1
- vextractf128 ZH(1), m1, 1
- add r0, mmsize*2
- sub r2d, mmsize/4
- jg .deint_loop
- ret
-%endif
-
-INIT_XMM
-%define movdqa movaps
-
-align 16
-fft4_avx:
-fft4_sse:
- mova m0, Z(0)
- mova m1, Z(1)
- T4_SSE m0, m1, m2
- mova Z(0), m0
- mova Z(1), m1
- ret
-
-align 16
-fft8_sse:
- mova m0, Z(0)
- mova m1, Z(1)
- T4_SSE m0, m1, m2
- mova m2, Z(2)
- mova m3, Z(3)
- T8_SSE m0, m1, m2, m3, m4, m5
- mova Z(0), m0
- mova Z(1), m1
- mova Z(2), m2
- mova Z(3), m3
- ret
-
-align 16
-fft16_sse:
- mova m0, Z(0)
- mova m1, Z(1)
- T4_SSE m0, m1, m2
- mova m2, Z(2)
- mova m3, Z(3)
- T8_SSE m0, m1, m2, m3, m4, m5
- mova m4, Z(4)
- mova m5, Z(5)
- mova Z(0), m0
- mova Z(1), m1
- mova Z(2), m2
- mova Z(3), m3
- T4_SSE m4, m5, m6
- mova m6, Z2(6)
- mova m7, Z2(7)
- T4_SSE m6, m7, m0
- PASS_SMALL 0, [cos_16], [cos_16+16]
- ret
-
-
-INIT_MMX
-
-%macro FFT48_3DN 1
-align 16
-fft4%1:
- T2_3DN m0, m1, Z(0), Z(1)
- mova m2, Z(2)
- mova m3, Z(3)
- T4_3DN m0, m1, m2, m3, m4, m5
- PUNPCK m0, m1, m4
- PUNPCK m2, m3, m5
- mova Z(0), m0
- mova Z(1), m4
- mova Z(2), m2
- mova Z(3), m5
- ret
-
-align 16
-fft8%1:
- T2_3DN m0, m1, Z(0), Z(1)
- mova m2, Z(2)
- mova m3, Z(3)
- T4_3DN m0, m1, m2, m3, m4, m5
- mova Z(0), m0
- mova Z(2), m2
- T2_3DN m4, m5, Z(4), Z(5)
- T2_3DN m6, m7, Z2(6), Z2(7)
- pswapd m0, m5
- pswapd m2, m7
- pxor m0, [ps_m1p1]
- pxor m2, [ps_m1p1]
- pfsub m5, m0
- pfadd m7, m2
- pfmul m5, [ps_root2]
- pfmul m7, [ps_root2]
- T4_3DN m1, m3, m5, m7, m0, m2
- mova Z(5), m5
- mova Z2(7), m7
- mova m0, Z(0)
- mova m2, Z(2)
- T4_3DN m0, m2, m4, m6, m5, m7
- PUNPCK m0, m1, m5
- PUNPCK m2, m3, m7
- mova Z(0), m0
- mova Z(1), m5
- mova Z(2), m2
- mova Z(3), m7
- PUNPCK m4, Z(5), m5
- PUNPCK m6, Z2(7), m7
- mova Z(4), m4
- mova Z(5), m5
- mova Z2(6), m6
- mova Z2(7), m7
- ret
-%endmacro
-
-FFT48_3DN _3dn2
-
-%macro pswapd 2
-%ifidn %1, %2
- movd [r0+12], %1
- punpckhdq %1, [r0+8]
-%else
- movq %1, %2
- psrlq %1, 32
- punpckldq %1, %2
-%endif
-%endmacro
-
-FFT48_3DN _3dn
-
-
-%define Z(x) [zq + o1q*(x&6) + mmsize*(x&1)]
-%define Z2(x) [zq + o3q + mmsize*(x&1)]
-%define ZH(x) [zq + o1q*(x&6) + mmsize*(x&1) + mmsize/2]
-%define Z2H(x) [zq + o3q + mmsize*(x&1) + mmsize/2]
-
-%macro DECL_PASS 2+ ; name, payload
-align 16
-%1:
-DEFINE_ARGS z, w, n, o1, o3
- lea o3q, [nq*3]
- lea o1q, [nq*8]
- shl o3q, 4
-.loop:
- %2
- add zq, mmsize*2
- add wq, mmsize
- sub nd, mmsize/8
- jg .loop
- rep ret
-%endmacro
-
-INIT_YMM
-
-%ifdef HAVE_AVX
-%macro INTERL_AVX 5
- vunpckhps %3, %2, %1
- vunpcklps %2, %2, %1
- vextractf128 %4(%5), %2, 0
- vextractf128 %4 %+ H(%5), %3, 0
- vextractf128 %4(%5 + 1), %2, 1
- vextractf128 %4 %+ H(%5 + 1), %3, 1
-%endmacro
-
-%define INTERL INTERL_AVX
-
-DECL_PASS pass_avx, PASS_BIG 1
-DECL_PASS pass_interleave_avx, PASS_BIG 0
-%endif
-
-INIT_XMM
-
-%macro INTERL_SSE 5
- mova %3, %2
- unpcklps %2, %1
- unpckhps %3, %1
- mova %4(%5), %2
- mova %4(%5+1), %3
-%endmacro
-
-%define INTERL INTERL_SSE
-
-DECL_PASS pass_sse, PASS_BIG 1
-DECL_PASS pass_interleave_sse, PASS_BIG 0
-
-INIT_MMX
-%define mulps pfmul
-%define addps pfadd
-%define subps pfsub
-%define unpcklps punpckldq
-%define unpckhps punpckhdq
-DECL_PASS pass_3dn, PASS_SMALL 1, [wq], [wq+o1q]
-DECL_PASS pass_interleave_3dn, PASS_BIG 0
-%define pass_3dn2 pass_3dn
-%define pass_interleave_3dn2 pass_interleave_3dn
-
-%ifdef PIC
-%define SECTION_REL - $$
-%else
-%define SECTION_REL
-%endif
-
-%macro FFT_DISPATCH 2; clobbers 5 GPRs, 8 XMMs
- lea r2, [dispatch_tab%1]
- mov r2, [r2 + (%2q-2)*gprsize]
-%ifdef PIC
- lea r3, [$$]
- add r2, r3
-%endif
- call r2
-%endmacro ; FFT_DISPATCH
-
-%macro DECL_FFT 2-3 ; nbits, cpu, suffix
-%xdefine list_of_fft fft4%2 SECTION_REL, fft8%2 SECTION_REL
-%if %1>=5
-%xdefine list_of_fft list_of_fft, fft16%2 SECTION_REL
-%endif
-%if %1>=6
-%xdefine list_of_fft list_of_fft, fft32%3%2 SECTION_REL
-%endif
-
-%assign n 1<<%1
-%rep 17-%1
-%assign n2 n/2
-%assign n4 n/4
-%xdefine list_of_fft list_of_fft, fft %+ n %+ %3%2 SECTION_REL
-
-align 16
-fft %+ n %+ %3%2:
- call fft %+ n2 %+ %2
- add r0, n*4 - (n&(-2<<%1))
- call fft %+ n4 %+ %2
- add r0, n*2 - (n2&(-2<<%1))
- call fft %+ n4 %+ %2
- sub r0, n*6 + (n2&(-2<<%1))
- lea r1, [cos_ %+ n]
- mov r2d, n4/2
- jmp pass%3%2
-
-%assign n n*2
-%endrep
-%undef n
-
-align 8
-dispatch_tab%3%2: pointer list_of_fft
-
-section .text
-
-; On x86_32, this function does the register saving and restoring for all of fft.
-; The others pass args in registers and don't spill anything.
-cglobal fft_dispatch%3%2, 2,5,8, z, nbits
- FFT_DISPATCH %3%2, nbits
-%ifidn %2, _avx
- vzeroupper
-%endif
- RET
-%endmacro ; DECL_FFT
-
-%ifdef HAVE_AVX
-INIT_YMM
-DECL_FFT 6, _avx
-DECL_FFT 6, _avx, _interleave
-%endif
-INIT_XMM
-DECL_FFT 5, _sse
-DECL_FFT 5, _sse, _interleave
-INIT_MMX
-DECL_FFT 4, _3dn
-DECL_FFT 4, _3dn, _interleave
-DECL_FFT 4, _3dn2
-DECL_FFT 4, _3dn2, _interleave
-
-INIT_XMM
-%undef mulps
-%undef addps
-%undef subps
-%undef unpcklps
-%undef unpckhps
-
-%macro PREROTATER 5 ;-2*k, 2*k, input+n4, tcos+n8, tsin+n8
- movaps xmm0, [%3+%2*4]
- movaps xmm1, [%3+%1*4-0x10]
- movaps xmm2, xmm0
- shufps xmm0, xmm1, 0x88
- shufps xmm1, xmm2, 0x77
- movlps xmm4, [%4+%2*2]
- movlps xmm5, [%5+%2*2+0x0]
- movhps xmm4, [%4+%1*2-0x8]
- movhps xmm5, [%5+%1*2-0x8]
- movaps xmm2, xmm0
- movaps xmm3, xmm1
- mulps xmm0, xmm5
- mulps xmm1, xmm4
- mulps xmm2, xmm4
- mulps xmm3, xmm5
- subps xmm1, xmm0
- addps xmm2, xmm3
- movaps xmm0, xmm1
- unpcklps xmm1, xmm2
- unpckhps xmm0, xmm2
-%endmacro
-
-%macro CMUL 6 ;j, xmm0, xmm1, 3, 4, 5
- mulps m6, %3, [%5+%1]
- mulps m7, %2, [%5+%1]
- mulps %2, %2, [%6+%1]
- mulps %3, %3, [%6+%1]
- subps %2, %2, m6
- addps %3, %3, m7
-%endmacro
-
-%macro POSROTATESHUF_AVX 5 ;j, k, z+n8, tcos+n8, tsin+n8
-.post:
- vmovaps ymm1, [%3+%1*2]
- vmovaps ymm0, [%3+%1*2+0x20]
- vmovaps ymm3, [%3+%2*2]
- vmovaps ymm2, [%3+%2*2+0x20]
-
- CMUL %1, ymm0, ymm1, %3, %4, %5
- CMUL %2, ymm2, ymm3, %3, %4, %5
- vshufps ymm1, ymm1, ymm1, 0x1b
- vshufps ymm3, ymm3, ymm3, 0x1b
- vperm2f128 ymm1, ymm1, ymm1, 0x01
- vperm2f128 ymm3, ymm3, ymm3, 0x01
- vunpcklps ymm6, ymm2, ymm1
- vunpckhps ymm4, ymm2, ymm1
- vunpcklps ymm7, ymm0, ymm3
- vunpckhps ymm5, ymm0, ymm3
-
- vextractf128 [%3+%1*2], ymm7, 0
- vextractf128 [%3+%1*2+0x10], ymm5, 0
- vextractf128 [%3+%1*2+0x20], ymm7, 1
- vextractf128 [%3+%1*2+0x30], ymm5, 1
-
- vextractf128 [%3+%2*2], ymm6, 0
- vextractf128 [%3+%2*2+0x10], ymm4, 0
- vextractf128 [%3+%2*2+0x20], ymm6, 1
- vextractf128 [%3+%2*2+0x30], ymm4, 1
- sub %2, 0x20
- add %1, 0x20
- jl .post
-%endmacro
-
-%macro POSROTATESHUF 5 ;j, k, z+n8, tcos+n8, tsin+n8
-.post:
- movaps xmm1, [%3+%1*2]
- movaps xmm0, [%3+%1*2+0x10]
- CMUL %1, xmm0, xmm1, %3, %4, %5
- movaps xmm5, [%3+%2*2]
- movaps xmm4, [%3+%2*2+0x10]
- CMUL %2, xmm4, xmm5, %3, %4, %5
- shufps xmm1, xmm1, 0x1b
- shufps xmm5, xmm5, 0x1b
- movaps xmm6, xmm4
- unpckhps xmm4, xmm1
- unpcklps xmm6, xmm1
- movaps xmm2, xmm0
- unpcklps xmm0, xmm5
- unpckhps xmm2, xmm5
- movaps [%3+%2*2], xmm6
- movaps [%3+%2*2+0x10], xmm4
- movaps [%3+%1*2], xmm0
- movaps [%3+%1*2+0x10], xmm2
- sub %2, 0x10
- add %1, 0x10
- jl .post
-%endmacro
-
-%macro DECL_IMDCT 2
-cglobal imdct_half%1, 3,7,8; FFTContext *s, FFTSample *output, const FFTSample *input
-%ifdef ARCH_X86_64
-%define rrevtab r10
-%define rtcos r11
-%define rtsin r12
- push r12
- push r13
- push r14
-%else
-%define rrevtab r6
-%define rtsin r6
-%define rtcos r5
-%endif
- mov r3d, [r0+FFTContext.mdctsize]
- add r2, r3
- shr r3, 1
- mov rtcos, [r0+FFTContext.tcos]
- mov rtsin, [r0+FFTContext.tsin]
- add rtcos, r3
- add rtsin, r3
-%ifndef ARCH_X86_64
- push rtcos
- push rtsin
-%endif
- shr r3, 1
- mov rrevtab, [r0+FFTContext.revtab]
- add rrevtab, r3
-%ifndef ARCH_X86_64
- push rrevtab
-%endif
-
- sub r3, 4
-%ifdef ARCH_X86_64
- xor r4, r4
- sub r4, r3
-%endif
-.pre:
-%ifndef ARCH_X86_64
-;unspill
- xor r4, r4
- sub r4, r3
- mov rtsin, [esp+4]
- mov rtcos, [esp+8]
-%endif
-
- PREROTATER r4, r3, r2, rtcos, rtsin
-%ifdef ARCH_X86_64
- movzx r5, word [rrevtab+r4-4]
- movzx r6, word [rrevtab+r4-2]
- movzx r13, word [rrevtab+r3]
- movzx r14, word [rrevtab+r3+2]
- movlps [r1+r5 *8], xmm0
- movhps [r1+r6 *8], xmm0
- movlps [r1+r13*8], xmm1
- movhps [r1+r14*8], xmm1
- add r4, 4
-%else
- mov r6, [esp]
- movzx r5, word [r6+r4-4]
- movzx r4, word [r6+r4-2]
- movlps [r1+r5*8], xmm0
- movhps [r1+r4*8], xmm0
- movzx r5, word [r6+r3]
- movzx r4, word [r6+r3+2]
- movlps [r1+r5*8], xmm1
- movhps [r1+r4*8], xmm1
-%endif
- sub r3, 4
- jns .pre
-
- mov r5, r0
- mov r6, r1
- mov r0, r1
- mov r1d, [r5+FFTContext.nbits]
-
- FFT_DISPATCH %1, r1
-
- mov r0d, [r5+FFTContext.mdctsize]
- add r6, r0
- shr r0, 1
-%ifndef ARCH_X86_64
-%define rtcos r2
-%define rtsin r3
- mov rtcos, [esp+8]
- mov rtsin, [esp+4]
-%endif
- neg r0
- mov r1, -mmsize
- sub r1, r0
- %2 r0, r1, r6, rtcos, rtsin
-%ifdef ARCH_X86_64
- pop r14
- pop r13
- pop r12
-%else
- add esp, 12
-%endif
-%ifidn avx_enabled, 1
- vzeroupper
-%endif
- RET
-%endmacro
-
-DECL_IMDCT _sse, POSROTATESHUF
-
-INIT_YMM
-
-%ifdef HAVE_AVX
-DECL_IMDCT _avx, POSROTATESHUF_AVX
-%endif
diff --git a/gst-libs/ext/libav/libavcodec/x86/fft_sse.c b/gst-libs/ext/libav/libavcodec/x86/fft_sse.c
deleted file mode 100644
index 6be5be9..0000000
--- a/gst-libs/ext/libav/libavcodec/x86/fft_sse.c
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * FFT/MDCT transform with SSE optimizations
- * Copyright (c) 2008 Loren Merritt
- *
- * 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
- */
-
-#include "libavutil/x86_cpu.h"
-#include "libavcodec/dsputil.h"
-#include "fft.h"
-#include "config.h"
-
-DECLARE_ASM_CONST(16, unsigned int, ff_m1m1m1m1)[4] =
- { 1U << 31, 1U << 31, 1U << 31, 1U << 31 };
-
-void ff_fft_dispatch_sse(FFTComplex *z, int nbits);
-void ff_fft_dispatch_interleave_sse(FFTComplex *z, int nbits);
-void ff_fft_dispatch_interleave_avx(FFTComplex *z, int nbits);
-
-#if HAVE_AVX
-void ff_fft_calc_avx(FFTContext *s, FFTComplex *z)
-{
- ff_fft_dispatch_interleave_avx(z, s->nbits);
-}
-#endif
-
-void ff_fft_calc_sse(FFTContext *s, FFTComplex *z)
-{
- int n = 1 << s->nbits;
-
- ff_fft_dispatch_interleave_sse(z, s->nbits);
-
- if(n <= 16) {
- x86_reg i = -8*n;
- __asm__ volatile(
- "1: \n"
- "movaps (%0,%1), %%xmm0 \n"
- "movaps %%xmm0, %%xmm1 \n"
- "unpcklps 16(%0,%1), %%xmm0 \n"
- "unpckhps 16(%0,%1), %%xmm1 \n"
- "movaps %%xmm0, (%0,%1) \n"
- "movaps %%xmm1, 16(%0,%1) \n"
- "add $32, %0 \n"
- "jl 1b \n"
- :"+r"(i)
- :"r"(z+n)
- :"memory"
- );
- }
-}
-
-void ff_fft_permute_sse(FFTContext *s, FFTComplex *z)
-{
- int n = 1 << s->nbits;
- int i;
- for(i=0; i<n; i+=2) {
- __asm__ volatile(
- "movaps %2, %%xmm0 \n"
- "movlps %%xmm0, %0 \n"
- "movhps %%xmm0, %1 \n"
- :"=m"(s->tmp_buf[s->revtab[i]]),
- "=m"(s->tmp_buf[s->revtab[i+1]])
- :"m"(z[i])
- );
- }
- memcpy(z, s->tmp_buf, n*sizeof(FFTComplex));
-}
-
-void ff_imdct_calc_sse(FFTContext *s, FFTSample *output, const FFTSample *input)
-{
- x86_reg j, k;
- long n = s->mdct_size;
- long n4 = n >> 2;
-
- s->imdct_half(s, output + n4, input);
-
- j = -n;
- k = n-16;
- __asm__ volatile(
- "movaps "MANGLE(ff_m1m1m1m1)", %%xmm7 \n"
- "1: \n"
- "movaps (%2,%1), %%xmm0 \n"
- "movaps (%3,%0), %%xmm1 \n"
- "shufps $0x1b, %%xmm0, %%xmm0 \n"
- "shufps $0x1b, %%xmm1, %%xmm1 \n"
- "xorps %%xmm7, %%xmm0 \n"
- "movaps %%xmm1, (%3,%1) \n"
- "movaps %%xmm0, (%2,%0) \n"
- "sub $16, %1 \n"
- "add $16, %0 \n"
- "jl 1b \n"
- :"+r"(j), "+r"(k)
- :"r"(output+n4), "r"(output+n4*3)
- XMM_CLOBBERS_ONLY("%xmm0", "%xmm1", "%xmm7")
- );
-}
-
diff --git a/gst-libs/ext/libav/libavcodec/x86/fmtconvert.asm b/gst-libs/ext/libav/libavcodec/x86/fmtconvert.asm
index d621089..8267bd4 100644
--- a/gst-libs/ext/libav/libavcodec/x86/fmtconvert.asm
+++ b/gst-libs/ext/libav/libavcodec/x86/fmtconvert.asm
@@ -19,23 +19,30 @@
;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
;******************************************************************************
-%include "x86inc.asm"
-%include "x86util.asm"
+%include "libavutil/x86/x86util.asm"
SECTION_TEXT
+%macro CVTPS2PI 2
+%if cpuflag(sse)
+ cvtps2pi %1, %2
+%elif cpuflag(3dnow)
+ pf2id %1, %2
+%endif
+%endmacro
+
;---------------------------------------------------------------------------------
; void int32_to_float_fmul_scalar(float *dst, const int *src, float mul, int len);
;---------------------------------------------------------------------------------
-%macro INT32_TO_FLOAT_FMUL_SCALAR 2
-%ifdef UNIX64
-cglobal int32_to_float_fmul_scalar_%1, 3,3,%2, dst, src, len
+%macro INT32_TO_FLOAT_FMUL_SCALAR 1
+%if UNIX64
+cglobal int32_to_float_fmul_scalar, 3, 3, %1, dst, src, len
%else
-cglobal int32_to_float_fmul_scalar_%1, 4,4,%2, dst, src, mul, len
+cglobal int32_to_float_fmul_scalar, 4, 4, %1, dst, src, mul, len
%endif
-%ifdef WIN64
+%if WIN64
SWAP 0, 2
-%elifdef ARCH_X86_32
+%elif ARCH_X86_32
movss m0, mulm
%endif
SPLATD m0
@@ -44,7 +51,7 @@ cglobal int32_to_float_fmul_scalar_%1, 4,4,%2, dst, src, mul, len
add dstq, lenq
neg lenq
.loop:
-%ifidn %1, sse2
+%if cpuflag(sse2)
cvtdq2ps m1, [srcq+lenq ]
cvtdq2ps m2, [srcq+lenq+16]
%else
@@ -64,36 +71,32 @@ cglobal int32_to_float_fmul_scalar_%1, 4,4,%2, dst, src, mul, len
REP_RET
%endmacro
-INIT_XMM
-%define SPLATD SPLATD_SSE
-%define movdqa movaps
-INT32_TO_FLOAT_FMUL_SCALAR sse, 5
-%undef movdqa
-%define SPLATD SPLATD_SSE2
-INT32_TO_FLOAT_FMUL_SCALAR sse2, 3
-%undef SPLATD
+INIT_XMM sse
+INT32_TO_FLOAT_FMUL_SCALAR 5
+INIT_XMM sse2
+INT32_TO_FLOAT_FMUL_SCALAR 3
;------------------------------------------------------------------------------
; void ff_float_to_int16(int16_t *dst, const float *src, long len);
;------------------------------------------------------------------------------
-%macro FLOAT_TO_INT16 2
-cglobal float_to_int16_%1, 3,3,%2, dst, src, len
+%macro FLOAT_TO_INT16 1
+cglobal float_to_int16, 3, 3, %1, dst, src, len
add lenq, lenq
lea srcq, [srcq+2*lenq]
add dstq, lenq
neg lenq
.loop:
-%ifidn %1, sse2
+%if cpuflag(sse2)
cvtps2dq m0, [srcq+2*lenq ]
cvtps2dq m1, [srcq+2*lenq+16]
packssdw m0, m1
mova [dstq+lenq], m0
%else
- cvtps2pi m0, [srcq+2*lenq ]
- cvtps2pi m1, [srcq+2*lenq+ 8]
- cvtps2pi m2, [srcq+2*lenq+16]
- cvtps2pi m3, [srcq+2*lenq+24]
+ CVTPS2PI m0, [srcq+2*lenq ]
+ CVTPS2PI m1, [srcq+2*lenq+ 8]
+ CVTPS2PI m2, [srcq+2*lenq+16]
+ CVTPS2PI m3, [srcq+2*lenq+24]
packssdw m0, m1
packssdw m2, m3
mova [dstq+lenq ], m0
@@ -101,26 +104,102 @@ cglobal float_to_int16_%1, 3,3,%2, dst, src, len
%endif
add lenq, 16
js .loop
-%ifnidn %1, sse2
+%if mmsize == 8
emms
%endif
REP_RET
%endmacro
-INIT_XMM
-FLOAT_TO_INT16 sse2, 2
-INIT_MMX
-FLOAT_TO_INT16 sse, 0
-%define cvtps2pi pf2id
-FLOAT_TO_INT16 3dnow, 0
-%undef cvtps2pi
+INIT_XMM sse2
+FLOAT_TO_INT16 2
+INIT_MMX sse
+FLOAT_TO_INT16 0
+INIT_MMX 3dnow
+FLOAT_TO_INT16 0
+
+;------------------------------------------------------------------------------
+; void ff_float_to_int16_step(int16_t *dst, const float *src, long len, long step);
+;------------------------------------------------------------------------------
+%macro FLOAT_TO_INT16_STEP 1
+cglobal float_to_int16_step, 4, 7, %1, dst, src, len, step, step3, v1, v2
+ add lenq, lenq
+ lea srcq, [srcq+2*lenq]
+ lea step3q, [stepq*3]
+ neg lenq
+.loop:
+%if cpuflag(sse2)
+ cvtps2dq m0, [srcq+2*lenq ]
+ cvtps2dq m1, [srcq+2*lenq+16]
+ packssdw m0, m1
+ movd v1d, m0
+ psrldq m0, 4
+ movd v2d, m0
+ psrldq m0, 4
+ mov [dstq], v1w
+ mov [dstq+stepq*4], v2w
+ shr v1d, 16
+ shr v2d, 16
+ mov [dstq+stepq*2], v1w
+ mov [dstq+step3q*2], v2w
+ lea dstq, [dstq+stepq*8]
+ movd v1d, m0
+ psrldq m0, 4
+ movd v2d, m0
+ mov [dstq], v1w
+ mov [dstq+stepq*4], v2w
+ shr v1d, 16
+ shr v2d, 16
+ mov [dstq+stepq*2], v1w
+ mov [dstq+step3q*2], v2w
+ lea dstq, [dstq+stepq*8]
+%else
+ CVTPS2PI m0, [srcq+2*lenq ]
+ CVTPS2PI m1, [srcq+2*lenq+ 8]
+ CVTPS2PI m2, [srcq+2*lenq+16]
+ CVTPS2PI m3, [srcq+2*lenq+24]
+ packssdw m0, m1
+ packssdw m2, m3
+ movd v1d, m0
+ psrlq m0, 32
+ movd v2d, m0
+ mov [dstq], v1w
+ mov [dstq+stepq*4], v2w
+ shr v1d, 16
+ shr v2d, 16
+ mov [dstq+stepq*2], v1w
+ mov [dstq+step3q*2], v2w
+ lea dstq, [dstq+stepq*8]
+ movd v1d, m2
+ psrlq m2, 32
+ movd v2d, m2
+ mov [dstq], v1w
+ mov [dstq+stepq*4], v2w
+ shr v1d, 16
+ shr v2d, 16
+ mov [dstq+stepq*2], v1w
+ mov [dstq+step3q*2], v2w
+ lea dstq, [dstq+stepq*8]
+%endif
+ add lenq, 16
+ js .loop
+%if mmsize == 8
+ emms
+%endif
+ REP_RET
+%endmacro
+INIT_XMM sse2
+FLOAT_TO_INT16_STEP 2
+INIT_MMX sse
+FLOAT_TO_INT16_STEP 0
+INIT_MMX 3dnow
+FLOAT_TO_INT16_STEP 0
;-------------------------------------------------------------------------------
; void ff_float_to_int16_interleave2(int16_t *dst, const float **src, long len);
;-------------------------------------------------------------------------------
-%macro FLOAT_TO_INT16_INTERLEAVE2 1
-cglobal float_to_int16_interleave2_%1, 3,4,2, dst, src0, src1, len
+%macro FLOAT_TO_INT16_INTERLEAVE2 0
+cglobal float_to_int16_interleave2, 3, 4, 2, dst, src0, src1, len
lea lenq, [4*r2q]
mov src1q, [src0q+gprsize]
mov src0q, [src0q]
@@ -129,7 +208,7 @@ cglobal float_to_int16_interleave2_%1, 3,4,2, dst, src0, src1, len
add src1q, lenq
neg lenq
.loop:
-%ifidn %1, sse2
+%if cpuflag(sse2)
cvtps2dq m0, [src0q+lenq]
cvtps2dq m1, [src1q+lenq]
packssdw m0, m1
@@ -137,10 +216,10 @@ cglobal float_to_int16_interleave2_%1, 3,4,2, dst, src0, src1, len
punpcklwd m0, m1
mova [dstq+lenq], m0
%else
- cvtps2pi m0, [src0q+lenq ]
- cvtps2pi m1, [src0q+lenq+8]
- cvtps2pi m2, [src1q+lenq ]
- cvtps2pi m3, [src1q+lenq+8]
+ CVTPS2PI m0, [src0q+lenq ]
+ CVTPS2PI m1, [src0q+lenq+8]
+ CVTPS2PI m2, [src1q+lenq ]
+ CVTPS2PI m3, [src1q+lenq+8]
packssdw m0, m1
packssdw m2, m3
mova m1, m0
@@ -151,37 +230,23 @@ cglobal float_to_int16_interleave2_%1, 3,4,2, dst, src0, src1, len
%endif
add lenq, 16
js .loop
-%ifnidn %1, sse2
+%if mmsize == 8
emms
%endif
REP_RET
%endmacro
-INIT_MMX
-%define cvtps2pi pf2id
-FLOAT_TO_INT16_INTERLEAVE2 3dnow
-%undef cvtps2pi
-%define movdqa movaps
-FLOAT_TO_INT16_INTERLEAVE2 sse
-%undef movdqa
-INIT_XMM
-FLOAT_TO_INT16_INTERLEAVE2 sse2
+INIT_MMX 3dnow
+FLOAT_TO_INT16_INTERLEAVE2
+INIT_MMX sse
+FLOAT_TO_INT16_INTERLEAVE2
+INIT_XMM sse2
+FLOAT_TO_INT16_INTERLEAVE2
-
-%macro PSWAPD_SSE 2
- pshufw %1, %2, 0x4e
-%endmacro
-%macro PSWAPD_3DN1 2
- movq %1, %2
- psrlq %1, 32
- punpckldq %1, %2
-%endmacro
-
-%macro FLOAT_TO_INT16_INTERLEAVE6 1
+%macro FLOAT_TO_INT16_INTERLEAVE6 0
; void float_to_int16_interleave6_sse(int16_t *dst, const float **src, int len)
-cglobal float_to_int16_interleave6_%1, 2,7,0, dst, src, src1, src2, src3, src4, src5
-%ifdef ARCH_X86_64
- %define lend r10d
+cglobal float_to_int16_interleave6, 2, 8, 0, dst, src, src1, src2, src3, src4, src5, len
+%if ARCH_X86_64
mov lend, r2d
%else
%define lend dword r2m
@@ -198,20 +263,20 @@ cglobal float_to_int16_interleave6_%1, 2,7,0, dst, src, src1, src2, src3, src4,
sub src4q, srcq
sub src5q, srcq
.loop:
- cvtps2pi mm0, [srcq]
- cvtps2pi mm1, [srcq+src1q]
- cvtps2pi mm2, [srcq+src2q]
- cvtps2pi mm3, [srcq+src3q]
- cvtps2pi mm4, [srcq+src4q]
- cvtps2pi mm5, [srcq+src5q]
+ CVTPS2PI mm0, [srcq]
+ CVTPS2PI mm1, [srcq+src1q]
+ CVTPS2PI mm2, [srcq+src2q]
+ CVTPS2PI mm3, [srcq+src3q]
+ CVTPS2PI mm4, [srcq+src4q]
+ CVTPS2PI mm5, [srcq+src5q]
packssdw mm0, mm3
packssdw mm1, mm4
packssdw mm2, mm5
- pswapd mm3, mm0
+ PSWAPD mm3, mm0
punpcklwd mm0, mm1
punpckhwd mm1, mm2
punpcklwd mm2, mm3
- pswapd mm3, mm0
+ PSWAPD mm3, mm0
punpckldq mm0, mm2
punpckhdq mm2, mm1
punpckldq mm1, mm3
@@ -226,23 +291,20 @@ cglobal float_to_int16_interleave6_%1, 2,7,0, dst, src, src1, src2, src3, src4,
RET
%endmacro ; FLOAT_TO_INT16_INTERLEAVE6
-%define pswapd PSWAPD_SSE
-FLOAT_TO_INT16_INTERLEAVE6 sse
-%define cvtps2pi pf2id
-%define pswapd PSWAPD_3DN1
-FLOAT_TO_INT16_INTERLEAVE6 3dnow
-%undef pswapd
-FLOAT_TO_INT16_INTERLEAVE6 3dn2
-%undef cvtps2pi
+INIT_MMX sse
+FLOAT_TO_INT16_INTERLEAVE6
+INIT_MMX 3dnow
+FLOAT_TO_INT16_INTERLEAVE6
+INIT_MMX 3dnowext
+FLOAT_TO_INT16_INTERLEAVE6
;-----------------------------------------------------------------------------
; void ff_float_interleave6(float *dst, const float **src, unsigned int len);
;-----------------------------------------------------------------------------
-%macro FLOAT_INTERLEAVE6 2
-cglobal float_interleave6_%1, 2,7,%2, dst, src, src1, src2, src3, src4, src5
-%ifdef ARCH_X86_64
- %define lend r10d
+%macro FLOAT_INTERLEAVE6 1
+cglobal float_interleave6, 2, 8, %1, dst, src, src1, src2, src3, src4, src5, len
+%if ARCH_X86_64
mov lend, r2d
%else
%define lend dword r2m
@@ -259,7 +321,7 @@ cglobal float_interleave6_%1, 2,7,%2, dst, src, src1, src2, src3, src4, src5
sub src4q, srcq
sub src5q, srcq
.loop:
-%ifidn %1, sse
+%if cpuflag(sse)
movaps m0, [srcq]
movaps m1, [srcq+src1q]
movaps m2, [srcq+src2q]
@@ -308,62 +370,60 @@ cglobal float_interleave6_%1, 2,7,%2, dst, src, src1, src2, src3, src4, src5
add dstq, mmsize*6
sub lend, mmsize/4
jg .loop
-%ifidn %1, mmx
+%if mmsize == 8
emms
%endif
REP_RET
%endmacro
-INIT_MMX
-FLOAT_INTERLEAVE6 mmx, 0
-INIT_XMM
-FLOAT_INTERLEAVE6 sse, 7
+INIT_MMX mmx
+FLOAT_INTERLEAVE6 0
+INIT_XMM sse
+FLOAT_INTERLEAVE6 7
;-----------------------------------------------------------------------------
; void ff_float_interleave2(float *dst, const float **src, unsigned int len);
;-----------------------------------------------------------------------------
-%macro FLOAT_INTERLEAVE2 2
-cglobal float_interleave2_%1, 3,4,%2, dst, src, len, src1
+%macro FLOAT_INTERLEAVE2 1
+cglobal float_interleave2, 3, 4, %1, dst, src, len, src1
mov src1q, [srcq+gprsize]
mov srcq, [srcq ]
sub src1q, srcq
-.loop
- MOVPS m0, [srcq ]
- MOVPS m1, [srcq+src1q ]
- MOVPS m3, [srcq +mmsize]
- MOVPS m4, [srcq+src1q+mmsize]
+.loop:
+ mova m0, [srcq ]
+ mova m1, [srcq+src1q ]
+ mova m3, [srcq +mmsize]
+ mova m4, [srcq+src1q+mmsize]
- MOVPS m2, m0
+ mova m2, m0
PUNPCKLDQ m0, m1
PUNPCKHDQ m2, m1
- MOVPS m1, m3
+ mova m1, m3
PUNPCKLDQ m3, m4
PUNPCKHDQ m1, m4
- MOVPS [dstq ], m0
- MOVPS [dstq+1*mmsize], m2
- MOVPS [dstq+2*mmsize], m3
- MOVPS [dstq+3*mmsize], m1
+ mova [dstq ], m0
+ mova [dstq+1*mmsize], m2
+ mova [dstq+2*mmsize], m3
+ mova [dstq+3*mmsize], m1
add srcq, mmsize*2
add dstq, mmsize*4
sub lend, mmsize/2
jg .loop
-%ifidn %1, mmx
+%if mmsize == 8
emms
%endif
REP_RET
%endmacro
-INIT_MMX
-%define MOVPS movq
+INIT_MMX mmx
%define PUNPCKLDQ punpckldq
%define PUNPCKHDQ punpckhdq
-FLOAT_INTERLEAVE2 mmx, 0
-INIT_XMM
-%define MOVPS movaps
+FLOAT_INTERLEAVE2 0
+INIT_XMM sse
%define PUNPCKLDQ unpcklps
%define PUNPCKHDQ unpckhps
-FLOAT_INTERLEAVE2 sse, 5
+FLOAT_INTERLEAVE2 5
diff --git a/gst-libs/ext/libav/libavcodec/x86/fmtconvert_init.c b/gst-libs/ext/libav/libavcodec/x86/fmtconvert_init.c
new file mode 100644
index 0000000..b97fbf9
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/x86/fmtconvert_init.c
@@ -0,0 +1,148 @@
+/*
+ * Format Conversion Utils
+ * Copyright (c) 2000, 2001 Fabrice Bellard
+ * Copyright (c) 2002-2004 Michael Niedermayer <michaelni@gmx.at>
+ *
+ * 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
+ *
+ * MMX optimization by Nick Kurshev <nickols_k@mail.ru>
+ */
+
+#include "libavutil/cpu.h"
+#include "libavutil/x86/asm.h"
+#include "libavutil/x86/cpu.h"
+#include "libavcodec/fmtconvert.h"
+#include "libavcodec/dsputil.h"
+
+#if HAVE_YASM
+
+void ff_int32_to_float_fmul_scalar_sse (float *dst, const int *src, float mul, int len);
+void ff_int32_to_float_fmul_scalar_sse2(float *dst, const int *src, float mul, int len);
+
+void ff_float_to_int16_3dnow(int16_t *dst, const float *src, long len);
+void ff_float_to_int16_sse (int16_t *dst, const float *src, long len);
+void ff_float_to_int16_sse2 (int16_t *dst, const float *src, long len);
+
+void ff_float_to_int16_step_3dnow(int16_t *dst, const float *src, long len, long step);
+void ff_float_to_int16_step_sse (int16_t *dst, const float *src, long len, long step);
+void ff_float_to_int16_step_sse2 (int16_t *dst, const float *src, long len, long step);
+
+void ff_float_to_int16_interleave2_3dnow(int16_t *dst, const float **src, long len);
+void ff_float_to_int16_interleave2_sse (int16_t *dst, const float **src, long len);
+void ff_float_to_int16_interleave2_sse2 (int16_t *dst, const float **src, long len);
+
+void ff_float_to_int16_interleave6_sse(int16_t *dst, const float **src, int len);
+void ff_float_to_int16_interleave6_3dnow(int16_t *dst, const float **src, int len);
+void ff_float_to_int16_interleave6_3dnowext(int16_t *dst, const float **src, int len);
+
+#define ff_float_to_int16_interleave6_sse2 ff_float_to_int16_interleave6_sse
+
+#define FLOAT_TO_INT16_INTERLEAVE(cpu) \
+/* gcc pessimizes register allocation if this is in the same function as float_to_int16_interleave_sse2*/\
+static av_noinline void float_to_int16_interleave_misc_##cpu(int16_t *dst, const float **src, long len, int channels){\
+ int c;\
+ for(c=0; c<channels; c++){\
+ ff_float_to_int16_step_##cpu(dst+c, src[c], len, channels);\
+ }\
+}\
+\
+static void float_to_int16_interleave_##cpu(int16_t *dst, const float **src, long len, int channels){\
+ if(channels==1)\
+ ff_float_to_int16_##cpu(dst, src[0], len);\
+ else if(channels==2){\
+ ff_float_to_int16_interleave2_##cpu(dst, src, len);\
+ }else if(channels==6){\
+ ff_float_to_int16_interleave6_##cpu(dst, src, len);\
+ }else\
+ float_to_int16_interleave_misc_##cpu(dst, src, len, channels);\
+}
+
+FLOAT_TO_INT16_INTERLEAVE(3dnow)
+FLOAT_TO_INT16_INTERLEAVE(sse)
+FLOAT_TO_INT16_INTERLEAVE(sse2)
+
+static void float_to_int16_interleave_3dnowext(int16_t *dst, const float **src,
+ long len, int channels)
+{
+ if(channels==6)
+ ff_float_to_int16_interleave6_3dnowext(dst, src, len);
+ else
+ float_to_int16_interleave_3dnow(dst, src, len, channels);
+}
+
+void ff_float_interleave2_mmx(float *dst, const float **src, unsigned int len);
+void ff_float_interleave2_sse(float *dst, const float **src, unsigned int len);
+
+void ff_float_interleave6_mmx(float *dst, const float **src, unsigned int len);
+void ff_float_interleave6_sse(float *dst, const float **src, unsigned int len);
+
+static void float_interleave_mmx(float *dst, const float **src,
+ unsigned int len, int channels)
+{
+ if (channels == 2) {
+ ff_float_interleave2_mmx(dst, src, len);
+ } else if (channels == 6)
+ ff_float_interleave6_mmx(dst, src, len);
+ else
+ ff_float_interleave_c(dst, src, len, channels);
+}
+
+static void float_interleave_sse(float *dst, const float **src,
+ unsigned int len, int channels)
+{
+ if (channels == 2) {
+ ff_float_interleave2_sse(dst, src, len);
+ } else if (channels == 6)
+ ff_float_interleave6_sse(dst, src, len);
+ else
+ ff_float_interleave_c(dst, src, len, channels);
+}
+#endif /* HAVE_YASM */
+
+void ff_fmt_convert_init_x86(FmtConvertContext *c, AVCodecContext *avctx)
+{
+#if HAVE_YASM
+ int mm_flags = av_get_cpu_flags();
+
+ if (EXTERNAL_MMX(mm_flags)) {
+ c->float_interleave = float_interleave_mmx;
+
+ if (EXTERNAL_AMD3DNOW(mm_flags)) {
+ if(!(avctx->flags & CODEC_FLAG_BITEXACT)){
+ c->float_to_int16 = ff_float_to_int16_3dnow;
+ c->float_to_int16_interleave = float_to_int16_interleave_3dnow;
+ }
+ }
+ if (EXTERNAL_AMD3DNOWEXT(mm_flags)) {
+ if(!(avctx->flags & CODEC_FLAG_BITEXACT)){
+ c->float_to_int16_interleave = float_to_int16_interleave_3dnowext;
+ }
+ }
+ if (EXTERNAL_SSE(mm_flags)) {
+ c->int32_to_float_fmul_scalar = ff_int32_to_float_fmul_scalar_sse;
+ c->float_to_int16 = ff_float_to_int16_sse;
+ c->float_to_int16_interleave = float_to_int16_interleave_sse;
+ c->float_interleave = float_interleave_sse;
+ }
+ if (EXTERNAL_SSE2(mm_flags)) {
+ c->int32_to_float_fmul_scalar = ff_int32_to_float_fmul_scalar_sse2;
+ c->float_to_int16 = ff_float_to_int16_sse2;
+ c->float_to_int16_interleave = float_to_int16_interleave_sse2;
+ }
+ }
+#endif /* HAVE_YASM */
+}
diff --git a/gst-libs/ext/libav/libavcodec/x86/fmtconvert_mmx.c b/gst-libs/ext/libav/libavcodec/x86/fmtconvert_mmx.c
deleted file mode 100644
index 17079d3..0000000
--- a/gst-libs/ext/libav/libavcodec/x86/fmtconvert_mmx.c
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- * Format Conversion Utils
- * Copyright (c) 2000, 2001 Fabrice Bellard
- * Copyright (c) 2002-2004 Michael Niedermayer <michaelni@gmx.at>
- *
- * 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
- *
- * MMX optimization by Nick Kurshev <nickols_k@mail.ru>
- */
-
-#include "libavutil/cpu.h"
-#include "libavutil/x86_cpu.h"
-#include "libavcodec/fmtconvert.h"
-
-#if HAVE_YASM
-
-void ff_int32_to_float_fmul_scalar_sse (float *dst, const int *src, float mul, int len);
-void ff_int32_to_float_fmul_scalar_sse2(float *dst, const int *src, float mul, int len);
-
-void ff_float_to_int16_3dnow(int16_t *dst, const float *src, long len);
-void ff_float_to_int16_sse (int16_t *dst, const float *src, long len);
-void ff_float_to_int16_sse2 (int16_t *dst, const float *src, long len);
-
-void ff_float_to_int16_interleave2_3dnow(int16_t *dst, const float **src, long len);
-void ff_float_to_int16_interleave2_sse (int16_t *dst, const float **src, long len);
-void ff_float_to_int16_interleave2_sse2 (int16_t *dst, const float **src, long len);
-
-void ff_float_to_int16_interleave6_sse(int16_t *dst, const float **src, int len);
-void ff_float_to_int16_interleave6_3dnow(int16_t *dst, const float **src, int len);
-void ff_float_to_int16_interleave6_3dn2(int16_t *dst, const float **src, int len);
-
-#define ff_float_to_int16_interleave6_sse2 ff_float_to_int16_interleave6_sse
-
-#define FLOAT_TO_INT16_INTERLEAVE(cpu) \
-/* gcc pessimizes register allocation if this is in the same function as float_to_int16_interleave_sse2*/\
-static av_noinline void float_to_int16_interleave_misc_##cpu(int16_t *dst, const float **src, long len, int channels){\
- DECLARE_ALIGNED(16, int16_t, tmp)[len];\
- int i,j,c;\
- for(c=0; c<channels; c++){\
- ff_float_to_int16_##cpu(tmp, src[c], len);\
- for(i=0, j=c; i<len; i++, j+=channels)\
- dst[j] = tmp[i];\
- }\
-}\
-\
-static void float_to_int16_interleave_##cpu(int16_t *dst, const float **src, long len, int channels){\
- if(channels==1)\
- ff_float_to_int16_##cpu(dst, src[0], len);\
- else if(channels==2){\
- ff_float_to_int16_interleave2_##cpu(dst, src, len);\
- }else if(channels==6){\
- ff_float_to_int16_interleave6_##cpu(dst, src, len);\
- }else\
- float_to_int16_interleave_misc_##cpu(dst, src, len, channels);\
-}
-
-FLOAT_TO_INT16_INTERLEAVE(3dnow)
-FLOAT_TO_INT16_INTERLEAVE(sse)
-FLOAT_TO_INT16_INTERLEAVE(sse2)
-
-static void float_to_int16_interleave_3dn2(int16_t *dst, const float **src, long len, int channels){
- if(channels==6)
- ff_float_to_int16_interleave6_3dn2(dst, src, len);
- else
- float_to_int16_interleave_3dnow(dst, src, len, channels);
-}
-
-void ff_float_interleave2_mmx(float *dst, const float **src, unsigned int len);
-void ff_float_interleave2_sse(float *dst, const float **src, unsigned int len);
-
-void ff_float_interleave6_mmx(float *dst, const float **src, unsigned int len);
-void ff_float_interleave6_sse(float *dst, const float **src, unsigned int len);
-
-static void float_interleave_mmx(float *dst, const float **src,
- unsigned int len, int channels)
-{
- if (channels == 2) {
- ff_float_interleave2_mmx(dst, src, len);
- } else if (channels == 6)
- ff_float_interleave6_mmx(dst, src, len);
- else
- ff_float_interleave_c(dst, src, len, channels);
-}
-
-static void float_interleave_sse(float *dst, const float **src,
- unsigned int len, int channels)
-{
- if (channels == 2) {
- ff_float_interleave2_sse(dst, src, len);
- } else if (channels == 6)
- ff_float_interleave6_sse(dst, src, len);
- else
- ff_float_interleave_c(dst, src, len, channels);
-}
-#endif
-
-void ff_fmt_convert_init_x86(FmtConvertContext *c, AVCodecContext *avctx)
-{
- int mm_flags = av_get_cpu_flags();
-
-#if HAVE_YASM
- if (mm_flags & AV_CPU_FLAG_MMX) {
- c->float_interleave = float_interleave_mmx;
-
- if (HAVE_AMD3DNOW && mm_flags & AV_CPU_FLAG_3DNOW) {
- if(!(avctx->flags & CODEC_FLAG_BITEXACT)){
- c->float_to_int16 = ff_float_to_int16_3dnow;
- c->float_to_int16_interleave = float_to_int16_interleave_3dnow;
- }
- }
- if (HAVE_AMD3DNOWEXT && mm_flags & AV_CPU_FLAG_3DNOWEXT) {
- if(!(avctx->flags & CODEC_FLAG_BITEXACT)){
- c->float_to_int16_interleave = float_to_int16_interleave_3dn2;
- }
- }
- if (HAVE_SSE && mm_flags & AV_CPU_FLAG_SSE) {
- c->int32_to_float_fmul_scalar = ff_int32_to_float_fmul_scalar_sse;
- c->float_to_int16 = ff_float_to_int16_sse;
- c->float_to_int16_interleave = float_to_int16_interleave_sse;
- c->float_interleave = float_interleave_sse;
- }
- if (HAVE_SSE && mm_flags & AV_CPU_FLAG_SSE2) {
- c->int32_to_float_fmul_scalar = ff_int32_to_float_fmul_scalar_sse2;
- c->float_to_int16 = ff_float_to_int16_sse2;
- c->float_to_int16_interleave = float_to_int16_interleave_sse2;
- }
- }
-#endif
-}
diff --git a/gst-libs/ext/libav/libavcodec/x86/h264_chromamc.asm b/gst-libs/ext/libav/libavcodec/x86/h264_chromamc.asm
index 16cf2ec..1be37de 100644
--- a/gst-libs/ext/libav/libavcodec/x86/h264_chromamc.asm
+++ b/gst-libs/ext/libav/libavcodec/x86/h264_chromamc.asm
@@ -20,8 +20,7 @@
;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
;******************************************************************************
-%include "x86inc.asm"
-%include "x86util.asm"
+%include "libavutil/x86/x86util.asm"
SECTION_RODATA
@@ -69,7 +68,7 @@ SECTION .text
%macro mv0_pixels_mc8 0
lea r4, [r2*2 ]
-.next4rows
+.next4rows:
movq mm0, [r1 ]
movq mm1, [r1+r2]
add r1, r4
@@ -90,11 +89,24 @@ SECTION .text
jne .next4rows
%endmacro
-%macro chroma_mc8_mmx_func 3
-; put/avg_h264_chroma_mc8_mmx_*(uint8_t *dst /*align 8*/, uint8_t *src /*align 1*/,
-; int stride, int h, int mx, int my)
-cglobal %1_%2_chroma_mc8_%3, 6, 7, 0
-%ifdef ARCH_X86_64
+%macro chroma_mc8_mmx_func 2-3
+%ifidn %2, rv40
+%ifdef PIC
+%define rnd_1d_rv40 r8
+%define rnd_2d_rv40 r8
+%define extra_regs 2
+%else ; no-PIC
+%define rnd_1d_rv40 rnd_rv40_1d_tbl
+%define rnd_2d_rv40 rnd_rv40_2d_tbl
+%define extra_regs 1
+%endif ; PIC
+%else
+%define extra_regs 0
+%endif ; rv40
+; put/avg_h264_chroma_mc8_*(uint8_t *dst /*align 8*/, uint8_t *src /*align 1*/,
+; int stride, int h, int mx, int my)
+cglobal %1_%2_chroma_mc8%3, 6, 7 + extra_regs, 0
+%if ARCH_X86_64
movsxd r2, r2d
%endif
mov r6d, r5d
@@ -104,21 +116,14 @@ cglobal %1_%2_chroma_mc8_%3, 6, 7, 0
mv0_pixels_mc8
REP_RET
-.at_least_one_non_zero
+.at_least_one_non_zero:
%ifidn %2, rv40
-%ifdef PIC
-%define rnd_1d_rv40 r11
-%define rnd_2d_rv40 r11
-%else ; no-PIC
-%define rnd_1d_rv40 rnd_rv40_1d_tbl
-%define rnd_2d_rv40 rnd_rv40_2d_tbl
-%endif
-%ifdef ARCH_X86_64
- mov r10, r5
- and r10, 6 ; &~1 for mx/my=[0,7]
- lea r10, [r10*4+r4]
- sar r10d, 1
-%define rnd_bias r10
+%if ARCH_X86_64
+ mov r7, r5
+ and r7, 6 ; &~1 for mx/my=[0,7]
+ lea r7, [r7*4+r4]
+ sar r7d, 1
+%define rnd_bias r7
%define dest_reg r0
%else ; x86-32
mov r0, r5
@@ -139,15 +144,15 @@ cglobal %1_%2_chroma_mc8_%3, 6, 7, 0
test r4d, r4d
mov r6, r2 ; dxy = x ? 1 : stride
jne .both_non_zero
-.my_is_zero
+.my_is_zero:
; mx == 0 XOR my == 0 - 1 dimensional filter only
or r4d, r5d ; x + y
%ifidn %2, rv40
%ifdef PIC
- lea r11, [rnd_rv40_1d_tbl]
+ lea r8, [rnd_rv40_1d_tbl]
%endif
-%ifndef ARCH_X86_64
+%if ARCH_X86_64 == 0
mov r5, r0m
%endif
%endif
@@ -160,7 +165,7 @@ cglobal %1_%2_chroma_mc8_%3, 6, 7, 0
pxor m7, m7
psubw m4, m5 ; mm4 = A = 8-x
-.next1drow
+.next1drow:
movq m0, [r1 ] ; mm0 = src[0..7]
movq m2, [r1+r6] ; mm1 = src[1..8]
@@ -191,14 +196,14 @@ cglobal %1_%2_chroma_mc8_%3, 6, 7, 0
jne .next1drow
REP_RET
-.both_non_zero ; general case, bilinear
+.both_non_zero: ; general case, bilinear
movd m4, r4d ; x
movd m6, r5d ; y
%ifidn %2, rv40
%ifdef PIC
- lea r11, [rnd_rv40_2d_tbl]
+ lea r8, [rnd_rv40_2d_tbl]
%endif
-%ifndef ARCH_X86_64
+%if ARCH_X86_64 == 0
mov r5, r0m
%endif
%endif
@@ -226,7 +231,7 @@ cglobal %1_%2_chroma_mc8_%3, 6, 7, 0
movq m0, [r1 ] ; mm0 = src[0..7]
movq m1, [r1+1] ; mm1 = src[1..8]
-.next2drow
+.next2drow:
add r1, r2
movq m2, m0
@@ -277,9 +282,15 @@ cglobal %1_%2_chroma_mc8_%3, 6, 7, 0
RET
%endmacro
-%macro chroma_mc4_mmx_func 3
-cglobal %1_%2_chroma_mc4_%3, 6, 6, 0
-%ifdef ARCH_X86_64
+%macro chroma_mc4_mmx_func 2
+%define extra_regs 0
+%ifidn %2, rv40
+%ifdef PIC
+%define extra_regs 1
+%endif ; PIC
+%endif ; rv40
+cglobal %1_%2_chroma_mc4, 6, 6 + extra_regs, 0
+%if ARCH_X86_64
movsxd r2, r2d
%endif
pxor m7, m7
@@ -296,8 +307,8 @@ cglobal %1_%2_chroma_mc4_%3, 6, 6, 0
%ifidn %2, rv40
%ifdef PIC
- lea r11, [rnd_rv40_2d_tbl]
-%define rnd_2d_rv40 r11
+ lea r6, [rnd_rv40_2d_tbl]
+%define rnd_2d_rv40 r6
%else
%define rnd_2d_rv40 rnd_rv40_2d_tbl
%endif
@@ -318,7 +329,7 @@ cglobal %1_%2_chroma_mc4_%3, 6, 6, 0
pmullw m6, m2
paddw m6, m0
-.next2rows
+.next2rows:
movd m0, [r1 ]
movd m1, [r1+1]
add r1, r2
@@ -362,9 +373,9 @@ cglobal %1_%2_chroma_mc4_%3, 6, 6, 0
REP_RET
%endmacro
-%macro chroma_mc2_mmx_func 3
-cglobal %1_%2_chroma_mc2_%3, 6, 7, 0
-%ifdef ARCH_X86_64
+%macro chroma_mc2_mmx_func 2
+cglobal %1_%2_chroma_mc2, 6, 7, 0
+%if ARCH_X86_64
movsxd r2, r2d
%endif
@@ -385,7 +396,7 @@ cglobal %1_%2_chroma_mc2_%3, 6, 7, 0
punpcklbw m2, m7
pshufw m2, m2, 0x94 ; mm0 = src[0,1,1,2]
-.nextrow
+.nextrow:
add r1, r2
movq m1, m2
pmaddwd m1, m5 ; mm1 = A * src[0,1] + B * src[1,2]
@@ -423,36 +434,39 @@ cglobal %1_%2_chroma_mc2_%3, 6, 7, 0
PAVG %1, %2
%endmacro
-INIT_MMX
+INIT_MMX mmx
%define CHROMAMC_AVG NOTHING
%define CHROMAMC_AVG4 NOTHING
-chroma_mc8_mmx_func put, h264, mmx_rnd
-chroma_mc8_mmx_func put, vc1, mmx_nornd
-chroma_mc8_mmx_func put, rv40, mmx
-chroma_mc4_mmx_func put, h264, mmx
-chroma_mc4_mmx_func put, rv40, mmx
-chroma_mc2_mmx_func put, h264, mmx2
+chroma_mc8_mmx_func put, h264, _rnd
+chroma_mc8_mmx_func put, vc1, _nornd
+chroma_mc8_mmx_func put, rv40
+chroma_mc4_mmx_func put, h264
+chroma_mc4_mmx_func put, rv40
+
+INIT_MMX mmxext
+chroma_mc2_mmx_func put, h264
%define CHROMAMC_AVG DIRECT_AVG
%define CHROMAMC_AVG4 COPY_AVG
%define PAVG pavgb
-chroma_mc8_mmx_func avg, h264, mmx2_rnd
-chroma_mc8_mmx_func avg, vc1, mmx2_nornd
-chroma_mc8_mmx_func avg, rv40, mmx2
-chroma_mc4_mmx_func avg, h264, mmx2
-chroma_mc4_mmx_func avg, rv40, mmx2
-chroma_mc2_mmx_func avg, h264, mmx2
+chroma_mc8_mmx_func avg, h264, _rnd
+chroma_mc8_mmx_func avg, vc1, _nornd
+chroma_mc8_mmx_func avg, rv40
+chroma_mc4_mmx_func avg, h264
+chroma_mc4_mmx_func avg, rv40
+chroma_mc2_mmx_func avg, h264
%define PAVG pavgusb
-chroma_mc8_mmx_func avg, h264, 3dnow_rnd
-chroma_mc8_mmx_func avg, vc1, 3dnow_nornd
-chroma_mc8_mmx_func avg, rv40, 3dnow
-chroma_mc4_mmx_func avg, h264, 3dnow
-chroma_mc4_mmx_func avg, rv40, 3dnow
-
-%macro chroma_mc8_ssse3_func 3
-cglobal %1_%2_chroma_mc8_%3, 6, 7, 8
-%ifdef ARCH_X86_64
+INIT_MMX 3dnow
+chroma_mc8_mmx_func avg, h264, _rnd
+chroma_mc8_mmx_func avg, vc1, _nornd
+chroma_mc8_mmx_func avg, rv40
+chroma_mc4_mmx_func avg, h264
+chroma_mc4_mmx_func avg, rv40
+
+%macro chroma_mc8_ssse3_func 2-3
+cglobal %1_%2_chroma_mc8%3, 6, 7, 8
+%if ARCH_X86_64
movsxd r2, r2d
%endif
mov r6d, r5d
@@ -462,7 +476,7 @@ cglobal %1_%2_chroma_mc8_%3, 6, 7, 8
mv0_pixels_mc8
REP_RET
-.at_least_one_non_zero
+.at_least_one_non_zero:
test r5d, r5d
je .my_is_zero
test r4d, r4d
@@ -489,7 +503,7 @@ cglobal %1_%2_chroma_mc8_%3, 6, 7, 8
movlhps m7, m7
movlhps m6, m6
-.next2rows
+.next2rows:
movq m1, [r1+r2*1 ]
movq m2, [r1+r2*1+1]
movq m3, [r1+r2*2 ]
@@ -523,7 +537,7 @@ cglobal %1_%2_chroma_mc8_%3, 6, 7, 8
jg .next2rows
REP_RET
-.my_is_zero
+.my_is_zero:
mov r5d, r4d
shl r4d, 8
add r4, 8
@@ -533,7 +547,7 @@ cglobal %1_%2_chroma_mc8_%3, 6, 7, 8
pshuflw m7, m7, 0
movlhps m7, m7
-.next2xrows
+.next2xrows:
movq m0, [r1 ]
movq m1, [r1 +1]
movq m2, [r1+r2 ]
@@ -560,7 +574,7 @@ cglobal %1_%2_chroma_mc8_%3, 6, 7, 8
jg .next2xrows
REP_RET
-.mx_is_zero
+.mx_is_zero:
mov r4d, r5d
shl r5d, 8
add r5, 8
@@ -570,7 +584,7 @@ cglobal %1_%2_chroma_mc8_%3, 6, 7, 8
pshuflw m7, m7, 0
movlhps m7, m7
-.next2yrows
+.next2yrows:
movq m0, [r1 ]
movq m1, [r1+r2 ]
movdqa m2, m1
@@ -598,9 +612,9 @@ cglobal %1_%2_chroma_mc8_%3, 6, 7, 8
REP_RET
%endmacro
-%macro chroma_mc4_ssse3_func 3
-cglobal %1_%2_chroma_mc4_%3, 6, 7, 0
-%ifdef ARCH_X86_64
+%macro chroma_mc4_ssse3_func 2
+cglobal %1_%2_chroma_mc4, 6, 7, 0
+%if ARCH_X86_64
movsxd r2, r2d
%endif
mov r6, r4
@@ -620,7 +634,7 @@ cglobal %1_%2_chroma_mc4_%3, 6, 7, 0
punpcklbw m0, [r1+1]
pshufw m6, m6, 0
-.next2rows
+.next2rows:
movd m1, [r1+r2*1 ]
movd m3, [r1+r2*2 ]
punpcklbw m1, [r1+r2*1+1]
@@ -652,16 +666,16 @@ cglobal %1_%2_chroma_mc4_%3, 6, 7, 0
%endmacro
%define CHROMAMC_AVG NOTHING
-INIT_XMM
-chroma_mc8_ssse3_func put, h264, ssse3_rnd
-chroma_mc8_ssse3_func put, vc1, ssse3_nornd
-INIT_MMX
-chroma_mc4_ssse3_func put, h264, ssse3
+INIT_XMM ssse3
+chroma_mc8_ssse3_func put, h264, _rnd
+chroma_mc8_ssse3_func put, vc1, _nornd
+INIT_MMX ssse3
+chroma_mc4_ssse3_func put, h264
%define CHROMAMC_AVG DIRECT_AVG
%define PAVG pavgb
-INIT_XMM
-chroma_mc8_ssse3_func avg, h264, ssse3_rnd
-chroma_mc8_ssse3_func avg, vc1, ssse3_nornd
-INIT_MMX
-chroma_mc4_ssse3_func avg, h264, ssse3
+INIT_XMM ssse3
+chroma_mc8_ssse3_func avg, h264, _rnd
+chroma_mc8_ssse3_func avg, vc1, _nornd
+INIT_MMX ssse3
+chroma_mc4_ssse3_func avg, h264
diff --git a/gst-libs/ext/libav/libavcodec/x86/h264_chromamc_10bit.asm b/gst-libs/ext/libav/libavcodec/x86/h264_chromamc_10bit.asm
index 9d07543..aec7678 100644
--- a/gst-libs/ext/libav/libavcodec/x86/h264_chromamc_10bit.asm
+++ b/gst-libs/ext/libav/libavcodec/x86/h264_chromamc_10bit.asm
@@ -22,8 +22,7 @@
;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
;******************************************************************************
-%include "x86inc.asm"
-%include "x86util.asm"
+%include "libavutil/x86/x86util.asm"
SECTION_RODATA
@@ -38,7 +37,7 @@ SECTION .text
%macro MV0_PIXELS_MC8 0
lea r4, [r2*3 ]
lea r5, [r2*4 ]
-.next4rows
+.next4rows:
movu m0, [r1 ]
movu m1, [r1+r2 ]
CHROMAMC_AVG m0, [r0 ]
@@ -60,10 +59,10 @@ SECTION .text
;-----------------------------------------------------------------------------
; void put/avg_h264_chroma_mc8(pixel *dst, pixel *src, int stride, int h, int mx, int my)
;-----------------------------------------------------------------------------
-%macro CHROMA_MC8 2
+%macro CHROMA_MC8 1
; put/avg_h264_chroma_mc8_*(uint8_t *dst /*align 8*/, uint8_t *src /*align 1*/,
; int stride, int h, int mx, int my)
-cglobal %1_h264_chroma_mc8_10_%2, 6,7,8
+cglobal %1_h264_chroma_mc8_10, 6,7,8
movsxdifnidn r2, r2d
mov r6d, r5d
or r6d, r4d
@@ -72,14 +71,14 @@ cglobal %1_h264_chroma_mc8_10_%2, 6,7,8
MV0_PIXELS_MC8
REP_RET
-.at_least_one_non_zero
+.at_least_one_non_zero:
mov r6d, 2
test r5d, r5d
je .x_interpolation
mov r6, r2 ; dxy = x ? 1 : stride
test r4d, r4d
jne .xy_interpolation
-.x_interpolation
+.x_interpolation:
; mx == 0 XOR my == 0 - 1 dimensional filter only
or r4d, r5d ; x + y
movd m5, r4d
@@ -88,7 +87,7 @@ cglobal %1_h264_chroma_mc8_10_%2, 6,7,8
SPLATW m5, m5 ; mm5 = B = x
psubw m4, m5 ; mm4 = A = 8-x
-.next1drow
+.next1drow:
movu m0, [r1 ] ; mm0 = src[0..7]
movu m2, [r1+r6] ; mm2 = src[1..8]
@@ -107,7 +106,7 @@ cglobal %1_h264_chroma_mc8_10_%2, 6,7,8
jne .next1drow
REP_RET
-.xy_interpolation ; general case, bilinear
+.xy_interpolation: ; general case, bilinear
movd m4, r4m ; x
movd m6, r5m ; y
@@ -125,7 +124,7 @@ cglobal %1_h264_chroma_mc8_10_%2, 6,7,8
movu m0, [r1 ] ; mm0 = src[0..7]
movu m1, [r1+2] ; mm1 = src[1..8]
-.next2drow
+.next2drow:
add r1, r2
pmullw m2, m0, m4
@@ -173,8 +172,8 @@ cglobal %1_h264_chroma_mc8_10_%2, 6,7,8
add r0, r2
%endmacro
-%macro CHROMA_MC4 2
-cglobal %1_h264_chroma_mc4_10_%2, 6,6,7
+%macro CHROMA_MC4 1
+cglobal %1_h264_chroma_mc4_10, 6,6,7
movsxdifnidn r2, r2d
movd m2, r4m ; x
movd m3, r5m ; y
@@ -192,7 +191,7 @@ cglobal %1_h264_chroma_mc4_10_%2, 6,6,7
pmullw m6, m2
paddw m6, m0
-.next2rows
+.next2rows:
MC4_OP m0, m6
MC4_OP m6, m0
sub r3d, 2
@@ -203,8 +202,8 @@ cglobal %1_h264_chroma_mc4_10_%2, 6,6,7
;-----------------------------------------------------------------------------
; void put/avg_h264_chroma_mc2(pixel *dst, pixel *src, int stride, int h, int mx, int my)
;-----------------------------------------------------------------------------
-%macro CHROMA_MC2 2
-cglobal %1_h264_chroma_mc2_10_%2, 6,7
+%macro CHROMA_MC2 1
+cglobal %1_h264_chroma_mc2_10, 6,7
movsxdifnidn r2, r2d
mov r6d, r4d
shl r4d, 16
@@ -221,7 +220,7 @@ cglobal %1_h264_chroma_mc2_10_%2, 6,7
pxor m7, m7
pshufw m2, [r1], 0x94 ; mm0 = src[0,1,1,2]
-.nextrow
+.nextrow:
add r1, r2
movq m1, m2
pmaddwd m1, m5 ; mm1 = A * src[0,1] + B * src[1,2]
@@ -246,28 +245,23 @@ cglobal %1_h264_chroma_mc2_10_%2, 6,7
%if %0==3
movq %2, %3
%endif
- PAVG %1, %2
+ pavgw %1, %2
%endmacro
%define CHROMAMC_AVG NOTHING
-INIT_XMM
-CHROMA_MC8 put, sse2
-%ifdef HAVE_AVX
-INIT_AVX
-CHROMA_MC8 put, avx
-%endif
-INIT_MMX
-CHROMA_MC4 put, mmxext
-CHROMA_MC2 put, mmxext
+INIT_XMM sse2
+CHROMA_MC8 put
+INIT_XMM avx
+CHROMA_MC8 put
+INIT_MMX mmxext
+CHROMA_MC4 put
+CHROMA_MC2 put
%define CHROMAMC_AVG AVG
-%define PAVG pavgw
-INIT_XMM
-CHROMA_MC8 avg, sse2
-%ifdef HAVE_AVX
-INIT_AVX
-CHROMA_MC8 avg, avx
-%endif
-INIT_MMX
-CHROMA_MC4 avg, mmxext
-CHROMA_MC2 avg, mmxext
+INIT_XMM sse2
+CHROMA_MC8 avg
+INIT_XMM avx
+CHROMA_MC8 avg
+INIT_MMX mmxext
+CHROMA_MC4 avg
+CHROMA_MC2 avg
diff --git a/gst-libs/ext/libav/libavcodec/x86/h264_deblock.asm b/gst-libs/ext/libav/libavcodec/x86/h264_deblock.asm
index 92f91ac..67f9c02 100644
--- a/gst-libs/ext/libav/libavcodec/x86/h264_deblock.asm
+++ b/gst-libs/ext/libav/libavcodec/x86/h264_deblock.asm
@@ -24,8 +24,11 @@
;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
;******************************************************************************
-%include "x86inc.asm"
-%include "x86util.asm"
+%include "libavutil/x86/x86util.asm"
+
+SECTION_RODATA
+
+pb_3_1: times 4 db 3, 1
SECTION .text
@@ -200,7 +203,7 @@ cextern pb_A1
; out: %4 = |%1-%2|>%3
; clobbers: %5
%macro DIFF_GT2 5
-%ifdef ARCH_X86_64
+%if ARCH_X86_64
psubusb %5, %2, %1
psubusb %4, %1, %2
%else
@@ -278,12 +281,12 @@ cextern pb_A1
mova %4, %2
%endmacro
-%ifdef ARCH_X86_64
+%if ARCH_X86_64
;-----------------------------------------------------------------------------
; void deblock_v_luma( uint8_t *pix, int stride, int alpha, int beta, int8_t *tc0 )
;-----------------------------------------------------------------------------
-%macro DEBLOCK_LUMA 1
-cglobal deblock_v_luma_8_%1, 5,5,10
+%macro DEBLOCK_LUMA 0
+cglobal deblock_v_luma_8, 5,5,10
movd m8, [r4] ; tc0
lea r4, [r1*3]
dec r2d ; alpha-1
@@ -327,13 +330,13 @@ cglobal deblock_v_luma_8_%1, 5,5,10
;-----------------------------------------------------------------------------
; void deblock_h_luma( uint8_t *pix, int stride, int alpha, int beta, int8_t *tc0 )
;-----------------------------------------------------------------------------
-INIT_MMX
-cglobal deblock_h_luma_8_%1, 5,7
- movsxd r10, r1d
- lea r11, [r10+r10*2]
+INIT_MMX cpuname
+cglobal deblock_h_luma_8, 5,9
+ movsxd r7, r1d
+ lea r8, [r7+r7*2]
lea r6, [r0-4]
- lea r5, [r0-4+r11]
-%ifdef WIN64
+ lea r5, [r0-4+r8]
+%if WIN64
sub rsp, 0x98
%define pix_tmp rsp+0x30
%else
@@ -342,20 +345,20 @@ cglobal deblock_h_luma_8_%1, 5,7
%endif
; transpose 6x16 -> tmp space
- TRANSPOSE6x8_MEM PASS8ROWS(r6, r5, r10, r11), pix_tmp
- lea r6, [r6+r10*8]
- lea r5, [r5+r10*8]
- TRANSPOSE6x8_MEM PASS8ROWS(r6, r5, r10, r11), pix_tmp+8
+ TRANSPOSE6x8_MEM PASS8ROWS(r6, r5, r7, r8), pix_tmp
+ lea r6, [r6+r7*8]
+ lea r5, [r5+r7*8]
+ TRANSPOSE6x8_MEM PASS8ROWS(r6, r5, r7, r8), pix_tmp+8
; vertical filter
; alpha, beta, tc0 are still in r2d, r3d, r4
- ; don't backup r6, r5, r10, r11 because deblock_v_luma_sse2 doesn't use them
+ ; don't backup r6, r5, r7, r8 because deblock_v_luma_sse2 doesn't use them
lea r0, [pix_tmp+0x30]
mov r1d, 0x10
-%ifdef WIN64
+%if WIN64
mov [rsp+0x20], r4
%endif
- call deblock_v_luma_8_%1
+ call deblock_v_luma_8
; transpose 16x4 -> original space (only the middle 4 rows were changed by the filter)
add r6, 2
@@ -364,19 +367,19 @@ cglobal deblock_h_luma_8_%1, 5,7
movq m1, [pix_tmp+0x28]
movq m2, [pix_tmp+0x38]
movq m3, [pix_tmp+0x48]
- TRANSPOSE8x4B_STORE PASS8ROWS(r6, r5, r10, r11)
+ TRANSPOSE8x4B_STORE PASS8ROWS(r6, r5, r7, r8)
- shl r10, 3
- sub r6, r10
- sub r5, r10
- shr r10, 3
+ shl r7, 3
+ sub r6, r7
+ sub r5, r7
+ shr r7, 3
movq m0, [pix_tmp+0x10]
movq m1, [pix_tmp+0x20]
movq m2, [pix_tmp+0x30]
movq m3, [pix_tmp+0x40]
- TRANSPOSE8x4B_STORE PASS8ROWS(r6, r5, r10, r11)
+ TRANSPOSE8x4B_STORE PASS8ROWS(r6, r5, r7, r8)
-%ifdef WIN64
+%if WIN64
add rsp, 0x98
%else
add rsp, 0x68
@@ -384,25 +387,23 @@ cglobal deblock_h_luma_8_%1, 5,7
RET
%endmacro
-INIT_XMM
-DEBLOCK_LUMA sse2
-INIT_AVX
-DEBLOCK_LUMA avx
+INIT_XMM sse2
+DEBLOCK_LUMA
+INIT_XMM avx
+DEBLOCK_LUMA
%else
-%macro DEBLOCK_LUMA 3
+%macro DEBLOCK_LUMA 2
;-----------------------------------------------------------------------------
; void deblock_v8_luma( uint8_t *pix, int stride, int alpha, int beta, int8_t *tc0 )
;-----------------------------------------------------------------------------
-cglobal deblock_%2_luma_8_%1, 5,5
+cglobal deblock_%1_luma_8, 5,5,8,2*%2
lea r4, [r1*3]
dec r2 ; alpha-1
neg r4
dec r3 ; beta-1
add r4, r0 ; pix-3*stride
- %assign pad 2*%3+12-(stack_offset&15)
- SUB esp, pad
mova m0, [r4+r1] ; p1
mova m1, [r4+2*r1] ; p0
@@ -415,7 +416,7 @@ cglobal deblock_%2_luma_8_%1, 5,5
movd m4, [r3] ; tc0
punpcklbw m4, m4
punpcklbw m4, m4 ; tc = 4x tc0[3], 4x tc0[2], 4x tc0[1], 4x tc0[0]
- mova [esp+%3], m4 ; tc
+ mova [esp+%2], m4 ; tc
pcmpgtb m4, m3
mova m3, [r4] ; p2
pand m4, m7
@@ -423,7 +424,7 @@ cglobal deblock_%2_luma_8_%1, 5,5
DIFF_GT2 m1, m3, m5, m6, m7 ; |p2-p0| > beta-1
pand m6, m4
- pand m4, [esp+%3] ; tc
+ pand m4, [esp+%2] ; tc
psubb m7, m4, m6
pand m6, m4
LUMA_Q1 m0, m3, [r4], [r4+r1], m6, m4
@@ -431,7 +432,7 @@ cglobal deblock_%2_luma_8_%1, 5,5
mova m4, [r0+2*r1] ; q2
DIFF_GT2 m2, m4, m5, m6, m3 ; |q2-q0| > beta-1
pand m6, [esp] ; mask
- mova m5, [esp+%3] ; tc
+ mova m5, [esp+%2] ; tc
psubb m7, m6
pand m5, m6
mova m3, [r0+r1]
@@ -440,22 +441,19 @@ cglobal deblock_%2_luma_8_%1, 5,5
DEBLOCK_P0_Q0
mova [r4+2*r1], m1
mova [r0], m2
- ADD esp, pad
RET
;-----------------------------------------------------------------------------
; void deblock_h_luma( uint8_t *pix, int stride, int alpha, int beta, int8_t *tc0 )
;-----------------------------------------------------------------------------
-INIT_MMX
-cglobal deblock_h_luma_8_%1, 0,5
+INIT_MMX cpuname
+cglobal deblock_h_luma_8, 0,5,8,0x60+HAVE_ALIGNED_STACK*12
mov r0, r0mp
mov r3, r1m
lea r4, [r3*3]
sub r0, 4
lea r1, [r0+r4]
- %assign pad 0x78-(stack_offset&15)
- SUB esp, pad
-%define pix_tmp esp+12
+%define pix_tmp esp+12*HAVE_ALIGNED_STACK
; transpose 6x16 -> tmp space
TRANSPOSE6x8_MEM PASS8ROWS(r0, r1, r3, r4), pix_tmp
@@ -470,11 +468,11 @@ cglobal deblock_h_luma_8_%1, 0,5
PUSH dword r2m
PUSH dword 16
PUSH dword r0
- call deblock_%2_luma_8_%1
-%ifidn %2, v8
+ call deblock_%1_luma_8
+%ifidn %1, v8
add dword [esp ], 8 ; pix_tmp+0x38
add dword [esp+16], 2 ; tc0+2
- call deblock_%2_luma_8_%1
+ call deblock_%1_luma_8
%endif
ADD esp, 20
@@ -497,23 +495,22 @@ cglobal deblock_h_luma_8_%1, 0,5
movq m3, [pix_tmp+0x48]
TRANSPOSE8x4B_STORE PASS8ROWS(r0, r1, r3, r4)
- ADD esp, pad
RET
%endmacro ; DEBLOCK_LUMA
-INIT_MMX
-DEBLOCK_LUMA mmxext, v8, 8
-INIT_XMM
-DEBLOCK_LUMA sse2, v, 16
-INIT_AVX
-DEBLOCK_LUMA avx, v, 16
+INIT_MMX mmxext
+DEBLOCK_LUMA v8, 8
+INIT_XMM sse2
+DEBLOCK_LUMA v, 16
+INIT_XMM avx
+DEBLOCK_LUMA v, 16
%endif ; ARCH
%macro LUMA_INTRA_P012 4 ; p0..p3 in memory
-%ifdef ARCH_X86_64
+%if ARCH_X86_64
pavgb t0, p2, p1
pavgb t1, p0, q0
%else
@@ -524,7 +521,7 @@ DEBLOCK_LUMA avx, v, 16
%endif
pavgb t0, t1 ; ((p2+p1+1)/2 + (p0+q0+1)/2 + 1)/2
mova t5, t1
-%ifdef ARCH_X86_64
+%if ARCH_X86_64
paddb t2, p2, p1
paddb t3, p0, q0
%else
@@ -542,7 +539,7 @@ DEBLOCK_LUMA avx, v, 16
pand t2, mpb_1
psubb t0, t2 ; p1' = (p2+p1+p0+q0+2)/4;
-%ifdef ARCH_X86_64
+%if ARCH_X86_64
pavgb t1, p2, q1
psubb t2, p2, q1
%else
@@ -608,7 +605,7 @@ DEBLOCK_LUMA avx, v, 16
%define mask1p mask1q
%endmacro
-%macro DEBLOCK_LUMA_INTRA 2
+%macro DEBLOCK_LUMA_INTRA 1
%define p1 m0
%define p0 m1
%define q0 m2
@@ -617,18 +614,22 @@ DEBLOCK_LUMA avx, v, 16
%define t1 m5
%define t2 m6
%define t3 m7
-%ifdef ARCH_X86_64
+%if ARCH_X86_64
%define p2 m8
%define q2 m9
%define t4 m10
%define t5 m11
%define mask0 m12
%define mask1p m13
+%if WIN64
+ %define mask1q [rsp]
+%else
%define mask1q [rsp-24]
+%endif
%define mpb_0 m14
%define mpb_1 m15
%else
- %define spill(x) [esp+16*x+((stack_offset+4)&15)]
+ %define spill(x) [esp+16*x]
%define p2 [r4+r1]
%define q2 [r0+2*r1]
%define t4 spill(0)
@@ -643,9 +644,10 @@ DEBLOCK_LUMA avx, v, 16
;-----------------------------------------------------------------------------
; void deblock_v_luma_intra( uint8_t *pix, int stride, int alpha, int beta )
;-----------------------------------------------------------------------------
-cglobal deblock_%2_luma_intra_8_%1, 4,6,16
-%ifndef ARCH_X86_64
- sub esp, 0x60
+%if WIN64
+cglobal deblock_%1_luma_intra_8, 4,6,16,0x10
+%else
+cglobal deblock_%1_luma_intra_8, 4,6,16,ARCH_X86_64*0x50-0x50
%endif
lea r4, [r1*4]
lea r5, [r1*3] ; 3*stride
@@ -659,7 +661,7 @@ cglobal deblock_%2_luma_intra_8_%1, 4,6,16
mova p0, [r4+r5]
mova q0, [r0]
mova q1, [r0+r1]
-%ifdef ARCH_X86_64
+%if ARCH_X86_64
pxor mpb_0, mpb_0
mova mpb_1, [pb_1]
LOAD_MASK r2d, r3d, t5 ; m5=beta-1, t5=alpha-1, m7=mask0
@@ -695,51 +697,46 @@ cglobal deblock_%2_luma_intra_8_%1, 4,6,16
LUMA_INTRA_SWAP_PQ
LUMA_INTRA_P012 [r0], [r0+r1], [r0+2*r1], [r0+r5]
.end:
-%ifndef ARCH_X86_64
- add esp, 0x60
-%endif
RET
-INIT_MMX
-%ifdef ARCH_X86_64
+INIT_MMX cpuname
+%if ARCH_X86_64
;-----------------------------------------------------------------------------
; void deblock_h_luma_intra( uint8_t *pix, int stride, int alpha, int beta )
;-----------------------------------------------------------------------------
-cglobal deblock_h_luma_intra_8_%1, 4,7
- movsxd r10, r1d
- lea r11, [r10*3]
+cglobal deblock_h_luma_intra_8, 4,9
+ movsxd r7, r1d
+ lea r8, [r7*3]
lea r6, [r0-4]
- lea r5, [r0-4+r11]
+ lea r5, [r0-4+r8]
sub rsp, 0x88
%define pix_tmp rsp
; transpose 8x16 -> tmp space
- TRANSPOSE8x8_MEM PASS8ROWS(r6, r5, r10, r11), PASS8ROWS(pix_tmp, pix_tmp+0x30, 0x10, 0x30)
- lea r6, [r6+r10*8]
- lea r5, [r5+r10*8]
- TRANSPOSE8x8_MEM PASS8ROWS(r6, r5, r10, r11), PASS8ROWS(pix_tmp+8, pix_tmp+0x38, 0x10, 0x30)
+ TRANSPOSE8x8_MEM PASS8ROWS(r6, r5, r7, r8), PASS8ROWS(pix_tmp, pix_tmp+0x30, 0x10, 0x30)
+ lea r6, [r6+r7*8]
+ lea r5, [r5+r7*8]
+ TRANSPOSE8x8_MEM PASS8ROWS(r6, r5, r7, r8), PASS8ROWS(pix_tmp+8, pix_tmp+0x38, 0x10, 0x30)
lea r0, [pix_tmp+0x40]
mov r1, 0x10
- call deblock_v_luma_intra_8_%1
+ call deblock_v_luma_intra_8
; transpose 16x6 -> original space (but we can't write only 6 pixels, so really 16x8)
- lea r5, [r6+r11]
- TRANSPOSE8x8_MEM PASS8ROWS(pix_tmp+8, pix_tmp+0x38, 0x10, 0x30), PASS8ROWS(r6, r5, r10, r11)
- shl r10, 3
- sub r6, r10
- sub r5, r10
- shr r10, 3
- TRANSPOSE8x8_MEM PASS8ROWS(pix_tmp, pix_tmp+0x30, 0x10, 0x30), PASS8ROWS(r6, r5, r10, r11)
+ lea r5, [r6+r8]
+ TRANSPOSE8x8_MEM PASS8ROWS(pix_tmp+8, pix_tmp+0x38, 0x10, 0x30), PASS8ROWS(r6, r5, r7, r8)
+ shl r7, 3
+ sub r6, r7
+ sub r5, r7
+ shr r7, 3
+ TRANSPOSE8x8_MEM PASS8ROWS(pix_tmp, pix_tmp+0x30, 0x10, 0x30), PASS8ROWS(r6, r5, r7, r8)
add rsp, 0x88
RET
%else
-cglobal deblock_h_luma_intra_8_%1, 2,4
+cglobal deblock_h_luma_intra_8, 2,4,8,0x80
lea r3, [r1*3]
sub r0, 4
lea r2, [r0+r3]
-%assign pad 0x8c-(stack_offset&15)
- SUB rsp, pad
%define pix_tmp rsp
; transpose 8x16 -> tmp space
@@ -753,10 +750,10 @@ cglobal deblock_h_luma_intra_8_%1, 2,4
PUSH dword r2m
PUSH dword 16
PUSH r0
- call deblock_%2_luma_intra_8_%1
-%ifidn %2, v8
+ call deblock_%1_luma_intra_8
+%ifidn %1, v8
add dword [rsp], 8 ; pix_tmp+8
- call deblock_%2_luma_intra_8_%1
+ call deblock_%1_luma_intra_8
%endif
ADD esp, 16
@@ -770,21 +767,20 @@ cglobal deblock_h_luma_intra_8_%1, 2,4
lea r0, [r0+r1*8]
lea r2, [r2+r1*8]
TRANSPOSE8x8_MEM PASS8ROWS(pix_tmp+8, pix_tmp+0x38, 0x10, 0x30), PASS8ROWS(r0, r2, r1, r3)
- ADD rsp, pad
RET
%endif ; ARCH_X86_64
%endmacro ; DEBLOCK_LUMA_INTRA
-INIT_XMM
-DEBLOCK_LUMA_INTRA sse2, v
-INIT_AVX
-DEBLOCK_LUMA_INTRA avx , v
-%ifndef ARCH_X86_64
-INIT_MMX
-DEBLOCK_LUMA_INTRA mmxext, v8
+INIT_XMM sse2
+DEBLOCK_LUMA_INTRA v
+INIT_XMM avx
+DEBLOCK_LUMA_INTRA v
+%if ARCH_X86_64 == 0
+INIT_MMX mmxext
+DEBLOCK_LUMA_INTRA v8
%endif
-INIT_MMX
+INIT_MMX mmxext
%macro CHROMA_V_START 0
dec r2d ; alpha-1
@@ -809,7 +805,7 @@ INIT_MMX
;-----------------------------------------------------------------------------
; void ff_deblock_v_chroma( uint8_t *pix, int stride, int alpha, int beta, int8_t *tc0 )
;-----------------------------------------------------------------------------
-cglobal deblock_v_chroma_8_mmxext, 5,6
+cglobal deblock_v_chroma_8, 5,6
CHROMA_V_START
movq m0, [t5]
movq m1, [t5+r1]
@@ -823,10 +819,14 @@ cglobal deblock_v_chroma_8_mmxext, 5,6
;-----------------------------------------------------------------------------
; void ff_deblock_h_chroma( uint8_t *pix, int stride, int alpha, int beta, int8_t *tc0 )
;-----------------------------------------------------------------------------
-cglobal deblock_h_chroma_8_mmxext, 5,7
-%ifdef ARCH_X86_64
+cglobal deblock_h_chroma_8, 5,7
+%if UNIX64
%define buf0 [rsp-24]
%define buf1 [rsp-16]
+%elif WIN64
+ sub rsp, 16
+ %define buf0 [rsp]
+ %define buf1 [rsp+8]
%else
%define buf0 r0m
%define buf1 r2m
@@ -839,6 +839,9 @@ cglobal deblock_h_chroma_8_mmxext, 5,7
movq m0, buf0
movq m3, buf1
TRANSPOSE8x4B_STORE PASS8ROWS(t5, r0, r1, t6)
+%if WIN64
+ add rsp, 16
+%endif
RET
ALIGN 16
@@ -869,7 +872,7 @@ ff_chroma_inter_body_mmxext:
;-----------------------------------------------------------------------------
; void ff_deblock_v_chroma_intra( uint8_t *pix, int stride, int alpha, int beta )
;-----------------------------------------------------------------------------
-cglobal deblock_v_chroma_intra_8_mmxext, 4,5
+cglobal deblock_v_chroma_intra_8, 4,5
CHROMA_V_START
movq m0, [t5]
movq m1, [t5+r1]
@@ -883,7 +886,7 @@ cglobal deblock_v_chroma_intra_8_mmxext, 4,5
;-----------------------------------------------------------------------------
; void ff_deblock_h_chroma_intra( uint8_t *pix, int stride, int alpha, int beta )
;-----------------------------------------------------------------------------
-cglobal deblock_h_chroma_intra_8_mmxext, 4,6
+cglobal deblock_h_chroma_intra_8, 4,6
CHROMA_H_START
TRANSPOSE4x8_LOAD bw, wd, dq, PASS8ROWS(t5, r0, r1, t6)
call ff_chroma_intra_body_mmxext
@@ -904,3 +907,167 @@ ff_chroma_intra_body_mmxext:
paddb m1, m5
paddb m2, m6
ret
+
+;-----------------------------------------------------------------------------
+; void h264_loop_filter_strength(int16_t bs[2][4][4], uint8_t nnz[40],
+; int8_t ref[2][40], int16_t mv[2][40][2],
+; int bidir, int edges, int step,
+; int mask_mv0, int mask_mv1, int field);
+;
+; bidir is 0 or 1
+; edges is 1 or 4
+; step is 1 or 2
+; mask_mv0 is 0 or 3
+; mask_mv1 is 0 or 1
+; field is 0 or 1
+;-----------------------------------------------------------------------------
+%macro loop_filter_strength_iteration 7 ; edges, step, mask_mv,
+ ; dir, d_idx, mask_dir, bidir
+%define edgesd %1
+%define stepd %2
+%define mask_mvd %3
+%define dir %4
+%define d_idx %5
+%define mask_dir %6
+%define bidir %7
+ xor b_idxd, b_idxd ; for (b_idx = 0; b_idx < edges; b_idx += step)
+%%.b_idx_loop:
+%if mask_dir == 0
+ pxor m0, m0
+%endif
+ test b_idxd, dword mask_mvd
+ jnz %%.skip_loop_iter ; if (!(b_idx & mask_mv))
+%if bidir == 1
+ movd m2, [refq+b_idxq+d_idx+12] ; { ref0[bn] }
+ punpckldq m2, [refq+b_idxq+d_idx+52] ; { ref0[bn], ref1[bn] }
+ pshufw m0, [refq+b_idxq+12], 0x44 ; { ref0[b], ref0[b] }
+ pshufw m1, [refq+b_idxq+52], 0x44 ; { ref1[b], ref1[b] }
+ pshufw m3, m2, 0x4E ; { ref1[bn], ref0[bn] }
+ psubb m0, m2 ; { ref0[b] != ref0[bn],
+ ; ref0[b] != ref1[bn] }
+ psubb m1, m3 ; { ref1[b] != ref1[bn],
+ ; ref1[b] != ref0[bn] }
+
+ por m0, m1
+ mova m1, [mvq+b_idxq*4+(d_idx+12)*4]
+ mova m2, [mvq+b_idxq*4+(d_idx+12)*4+mmsize]
+ mova m3, m1
+ mova m4, m2
+ psubw m1, [mvq+b_idxq*4+12*4]
+ psubw m2, [mvq+b_idxq*4+12*4+mmsize]
+ psubw m3, [mvq+b_idxq*4+52*4]
+ psubw m4, [mvq+b_idxq*4+52*4+mmsize]
+ packsswb m1, m2
+ packsswb m3, m4
+ paddb m1, m6
+ paddb m3, m6
+ psubusb m1, m5 ; abs(mv[b] - mv[bn]) >= limit
+ psubusb m3, m5
+ packsswb m1, m3
+
+ por m0, m1
+ mova m1, [mvq+b_idxq*4+(d_idx+52)*4]
+ mova m2, [mvq+b_idxq*4+(d_idx+52)*4+mmsize]
+ mova m3, m1
+ mova m4, m2
+ psubw m1, [mvq+b_idxq*4+12*4]
+ psubw m2, [mvq+b_idxq*4+12*4+mmsize]
+ psubw m3, [mvq+b_idxq*4+52*4]
+ psubw m4, [mvq+b_idxq*4+52*4+mmsize]
+ packsswb m1, m2
+ packsswb m3, m4
+ paddb m1, m6
+ paddb m3, m6
+ psubusb m1, m5 ; abs(mv[b] - mv[bn]) >= limit
+ psubusb m3, m5
+ packsswb m1, m3
+
+ pshufw m1, m1, 0x4E
+ por m0, m1
+ pshufw m1, m0, 0x4E
+ pminub m0, m1
+%else ; bidir == 0
+ movd m0, [refq+b_idxq+12]
+ psubb m0, [refq+b_idxq+d_idx+12] ; ref[b] != ref[bn]
+
+ mova m1, [mvq+b_idxq*4+12*4]
+ mova m2, [mvq+b_idxq*4+12*4+mmsize]
+ psubw m1, [mvq+b_idxq*4+(d_idx+12)*4]
+ psubw m2, [mvq+b_idxq*4+(d_idx+12)*4+mmsize]
+ packsswb m1, m2
+ paddb m1, m6
+ psubusb m1, m5 ; abs(mv[b] - mv[bn]) >= limit
+ packsswb m1, m1
+ por m0, m1
+%endif ; bidir == 1/0
+
+%%.skip_loop_iter:
+ movd m1, [nnzq+b_idxq+12]
+ por m1, [nnzq+b_idxq+d_idx+12] ; nnz[b] || nnz[bn]
+
+ pminub m1, m7
+ pminub m0, m7
+ psllw m1, 1
+ pxor m2, m2
+ pmaxub m1, m0
+ punpcklbw m1, m2
+ movq [bsq+b_idxq+32*dir], m1
+
+ add b_idxd, dword stepd
+ cmp b_idxd, dword edgesd
+ jl %%.b_idx_loop
+%endmacro
+
+INIT_MMX mmxext
+cglobal h264_loop_filter_strength, 9, 9, 0, bs, nnz, ref, mv, bidir, edges, \
+ step, mask_mv0, mask_mv1, field
+%define b_idxq bidirq
+%define b_idxd bidird
+ cmp dword fieldm, 0
+ mova m7, [pb_1]
+ mova m5, [pb_3]
+ je .nofield
+ mova m5, [pb_3_1]
+.nofield:
+ mova m6, m5
+ paddb m5, m5
+
+ shl dword stepd, 3
+ shl dword edgesd, 3
+%if ARCH_X86_32
+%define mask_mv0d mask_mv0m
+%define mask_mv1d mask_mv1m
+%endif
+ shl dword mask_mv1d, 3
+ shl dword mask_mv0d, 3
+
+ cmp dword bidird, 0
+ jne .bidir
+ loop_filter_strength_iteration edgesd, stepd, mask_mv1d, 1, -8, 0, 0
+ loop_filter_strength_iteration 32, 8, mask_mv0d, 0, -1, -1, 0
+
+ mova m0, [bsq+mmsize*0]
+ mova m1, [bsq+mmsize*1]
+ mova m2, [bsq+mmsize*2]
+ mova m3, [bsq+mmsize*3]
+ TRANSPOSE4x4W 0, 1, 2, 3, 4
+ mova [bsq+mmsize*0], m0
+ mova [bsq+mmsize*1], m1
+ mova [bsq+mmsize*2], m2
+ mova [bsq+mmsize*3], m3
+ RET
+
+.bidir:
+ loop_filter_strength_iteration edgesd, stepd, mask_mv1d, 1, -8, 0, 1
+ loop_filter_strength_iteration 32, 8, mask_mv0d, 0, -1, -1, 1
+
+ mova m0, [bsq+mmsize*0]
+ mova m1, [bsq+mmsize*1]
+ mova m2, [bsq+mmsize*2]
+ mova m3, [bsq+mmsize*3]
+ TRANSPOSE4x4W 0, 1, 2, 3, 4
+ mova [bsq+mmsize*0], m0
+ mova [bsq+mmsize*1], m1
+ mova [bsq+mmsize*2], m2
+ mova [bsq+mmsize*3], m3
+ RET
diff --git a/gst-libs/ext/libav/libavcodec/x86/h264_deblock_10bit.asm b/gst-libs/ext/libav/libavcodec/x86/h264_deblock_10bit.asm
index 6744661..3b81ef6 100644
--- a/gst-libs/ext/libav/libavcodec/x86/h264_deblock_10bit.asm
+++ b/gst-libs/ext/libav/libavcodec/x86/h264_deblock_10bit.asm
@@ -24,8 +24,7 @@
;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
;******************************************************************************
-%include "x86inc.asm"
-%include "x86util.asm"
+%include "libavutil/x86/x86util.asm"
SECTION_RODATA
@@ -151,11 +150,11 @@ cextern pw_4
%endif
%endmacro
-%macro DEBLOCK_LUMA 1
+%macro DEBLOCK_LUMA 0
;-----------------------------------------------------------------------------
; void deblock_v_luma( uint16_t *pix, int stride, int alpha, int beta, int8_t *tc0 )
;-----------------------------------------------------------------------------
-cglobal deblock_v_luma_10_%1, 5,5,8*(mmsize/16)
+cglobal deblock_v_luma_10, 5,5,8*(mmsize/16)
%assign pad 5*mmsize+12-(stack_offset&15)
%define tcm [rsp]
%define ms1 [rsp+mmsize]
@@ -165,7 +164,7 @@ cglobal deblock_v_luma_10_%1, 5,5,8*(mmsize/16)
SUB rsp, pad
shl r2d, 2
shl r3d, 2
- LOAD_AB m4, m5, r2, r3
+ LOAD_AB m4, m5, r2d, r3d
mov r3, 32/mmsize
mov r2, r0
sub r0, r1
@@ -210,7 +209,7 @@ cglobal deblock_v_luma_10_%1, 5,5,8*(mmsize/16)
ADD rsp, pad
RET
-cglobal deblock_h_luma_10_%1, 5,6,8*(mmsize/16)
+cglobal deblock_h_luma_10, 5,6,8*(mmsize/16)
%assign pad 7*mmsize+12-(stack_offset&15)
%define tcm [rsp]
%define ms1 [rsp+mmsize]
@@ -222,7 +221,7 @@ cglobal deblock_h_luma_10_%1, 5,6,8*(mmsize/16)
SUB rsp, pad
shl r2d, 2
shl r3d, 2
- LOAD_AB m4, m5, r2, r3
+ LOAD_AB m4, m5, r2d, r3d
mov r3, r1
mova am, m4
add r3, r1
@@ -301,8 +300,7 @@ cglobal deblock_h_luma_10_%1, 5,6,8*(mmsize/16)
RET
%endmacro
-INIT_XMM
-%ifdef ARCH_X86_64
+%if ARCH_X86_64
; in: m0=p1, m1=p0, m2=q0, m3=q1, m8=p2, m9=q2
; m12=alpha, m13=beta
; out: m0=p1', m3=q1', m1=p0', m2=q0'
@@ -339,8 +337,8 @@ INIT_XMM
SWAP 3, 9
%endmacro
-%macro DEBLOCK_LUMA_64 1
-cglobal deblock_v_luma_10_%1, 5,5,15
+%macro DEBLOCK_LUMA_64 0
+cglobal deblock_v_luma_10, 5,5,15
%define p2 m8
%define p1 m0
%define p0 m1
@@ -352,7 +350,7 @@ cglobal deblock_v_luma_10_%1, 5,5,15
%define mask2 m11
shl r2d, 2
shl r3d, 2
- LOAD_AB m12, m13, r2, r3
+ LOAD_AB m12, m13, r2d, r3d
mov r2, r0
sub r0, r1
sub r0, r1
@@ -377,10 +375,10 @@ cglobal deblock_v_luma_10_%1, 5,5,15
jg .loop
REP_RET
-cglobal deblock_h_luma_10_%1, 5,7,15
+cglobal deblock_h_luma_10, 5,7,15
shl r2d, 2
shl r3d, 2
- LOAD_AB m12, m13, r2, r3
+ LOAD_AB m12, m13, r2d, r3d
mov r2, r1
add r2, r1
add r2, r1
@@ -417,10 +415,10 @@ cglobal deblock_h_luma_10_%1, 5,7,15
REP_RET
%endmacro
-INIT_XMM
-DEBLOCK_LUMA_64 sse2
-INIT_AVX
-DEBLOCK_LUMA_64 avx
+INIT_XMM sse2
+DEBLOCK_LUMA_64
+INIT_XMM avx
+DEBLOCK_LUMA_64
%endif
%macro SWAPMOVA 2
@@ -435,7 +433,7 @@ DEBLOCK_LUMA_64 avx
; %1=p0 %2=p1 %3=p2 %4=p3 %5=q0 %6=q1 %7=mask0
; %8=mask1p %9=2 %10=p0' %11=p1' %12=p2'
%macro LUMA_INTRA_P012 12 ; p0..p3 in memory
-%ifdef ARCH_X86_64
+%if ARCH_X86_64
paddw t0, %3, %2
mova t2, %4
paddw t2, %3
@@ -501,7 +499,7 @@ DEBLOCK_LUMA_64 avx
LOAD_AB t0, t1, r2d, r3d
mova %1, t0
LOAD_MASK m0, m1, m2, m3, %1, t1, t0, t2, t3
-%ifdef ARCH_X86_64
+%if ARCH_X86_64
mova %2, t0 ; mask0
psrlw t3, %1, 2
%else
@@ -598,12 +596,12 @@ DEBLOCK_LUMA_64 avx
%endif
%endmacro
-%ifdef ARCH_X86_64
+%if ARCH_X86_64
;-----------------------------------------------------------------------------
; void deblock_v_luma_intra( uint16_t *pix, int stride, int alpha, int beta )
;-----------------------------------------------------------------------------
-%macro DEBLOCK_LUMA_INTRA_64 1
-cglobal deblock_v_luma_intra_10_%1, 4,7,16
+%macro DEBLOCK_LUMA_INTRA_64 0
+cglobal deblock_v_luma_intra_10, 4,7,16
%define t0 m1
%define t1 m2
%define t2 m4
@@ -624,7 +622,7 @@ cglobal deblock_v_luma_intra_10_%1, 4,7,16
shl r2d, 2
shl r3d, 2
LOAD_AB aa, bb, r2d, r3d
-.loop
+.loop:
mova p2, [r4+r1]
mova p1, [r4+2*r1]
mova p0, [r4+r5]
@@ -653,7 +651,7 @@ cglobal deblock_v_luma_intra_10_%1, 4,7,16
;-----------------------------------------------------------------------------
; void deblock_h_luma_intra( uint16_t *pix, int stride, int alpha, int beta )
;-----------------------------------------------------------------------------
-cglobal deblock_h_luma_intra_10_%1, 4,7,16
+cglobal deblock_h_luma_intra_10, 4,7,16
%define t0 m15
%define t1 m14
%define t2 m2
@@ -675,7 +673,7 @@ cglobal deblock_h_luma_intra_10_%1, 4,7,16
mova m0, [pw_2]
shl r2d, 2
shl r3d, 2
-.loop
+.loop:
movu q3, [r0-8]
movu q2, [r0+r1-8]
movu q1, [r0+r1*2-8]
@@ -712,18 +710,18 @@ cglobal deblock_h_luma_intra_10_%1, 4,7,16
RET
%endmacro
-INIT_XMM
-DEBLOCK_LUMA_INTRA_64 sse2
-INIT_AVX
-DEBLOCK_LUMA_INTRA_64 avx
+INIT_XMM sse2
+DEBLOCK_LUMA_INTRA_64
+INIT_XMM avx
+DEBLOCK_LUMA_INTRA_64
%endif
-%macro DEBLOCK_LUMA_INTRA 1
+%macro DEBLOCK_LUMA_INTRA 0
;-----------------------------------------------------------------------------
; void deblock_v_luma_intra( uint16_t *pix, int stride, int alpha, int beta )
;-----------------------------------------------------------------------------
-cglobal deblock_v_luma_intra_10_%1, 4,7,8*(mmsize/16)
+cglobal deblock_v_luma_intra_10, 4,7,8*(mmsize/16)
LUMA_INTRA_INIT 3
lea r4, [r1*4]
lea r5, [r1*3]
@@ -751,7 +749,7 @@ cglobal deblock_v_luma_intra_10_%1, 4,7,8*(mmsize/16)
;-----------------------------------------------------------------------------
; void deblock_h_luma_intra( uint16_t *pix, int stride, int alpha, int beta )
;-----------------------------------------------------------------------------
-cglobal deblock_h_luma_intra_10_%1, 4,7,8*(mmsize/16)
+cglobal deblock_h_luma_intra_10, 4,7,8*(mmsize/16)
LUMA_INTRA_INIT 8
%if mmsize == 8
lea r4, [r1*3]
@@ -792,16 +790,16 @@ cglobal deblock_h_luma_intra_10_%1, 4,7,8*(mmsize/16)
RET
%endmacro
-%ifndef ARCH_X86_64
-INIT_MMX
-DEBLOCK_LUMA mmxext
-DEBLOCK_LUMA_INTRA mmxext
-INIT_XMM
-DEBLOCK_LUMA sse2
-DEBLOCK_LUMA_INTRA sse2
-INIT_AVX
-DEBLOCK_LUMA avx
-DEBLOCK_LUMA_INTRA avx
+%if ARCH_X86_64 == 0
+INIT_MMX mmxext
+DEBLOCK_LUMA
+DEBLOCK_LUMA_INTRA
+INIT_XMM sse2
+DEBLOCK_LUMA
+DEBLOCK_LUMA_INTRA
+INIT_XMM avx
+DEBLOCK_LUMA
+DEBLOCK_LUMA_INTRA
%endif
; in: %1=p0, %2=q0, %3=p1, %4=q1, %5=mask, %6=tmp, %7=tmp
@@ -843,11 +841,11 @@ DEBLOCK_LUMA_INTRA avx
psraw %1, 6
%endmacro
-%macro DEBLOCK_CHROMA 1
+%macro DEBLOCK_CHROMA 0
;-----------------------------------------------------------------------------
; void deblock_v_chroma( uint16_t *pix, int stride, int alpha, int beta, int8_t *tc0 )
;-----------------------------------------------------------------------------
-cglobal deblock_v_chroma_10_%1, 5,7-(mmsize/16),8*(mmsize/16)
+cglobal deblock_v_chroma_10, 5,7-(mmsize/16),8*(mmsize/16)
mov r5, r0
sub r0, r1
sub r0, r1
@@ -858,7 +856,7 @@ cglobal deblock_v_chroma_10_%1, 5,7-(mmsize/16),8*(mmsize/16)
.loop:
%endif
CHROMA_V_LOAD r5
- LOAD_AB m4, m5, r2, r3
+ LOAD_AB m4, m5, r2d, r3d
LOAD_MASK m0, m1, m2, m3, m4, m5, m7, m6, m4
pxor m4, m4
CHROMA_V_LOAD_TC m6, r4
@@ -881,7 +879,7 @@ cglobal deblock_v_chroma_10_%1, 5,7-(mmsize/16),8*(mmsize/16)
;-----------------------------------------------------------------------------
; void deblock_v_chroma_intra( uint16_t *pix, int stride, int alpha, int beta )
;-----------------------------------------------------------------------------
-cglobal deblock_v_chroma_intra_10_%1, 4,6-(mmsize/16),8*(mmsize/16)
+cglobal deblock_v_chroma_intra_10, 4,6-(mmsize/16),8*(mmsize/16)
mov r4, r0
sub r0, r1
sub r0, r1
@@ -892,7 +890,7 @@ cglobal deblock_v_chroma_intra_10_%1, 4,6-(mmsize/16),8*(mmsize/16)
.loop:
%endif
CHROMA_V_LOAD r4
- LOAD_AB m4, m5, r2, r3
+ LOAD_AB m4, m5, r2d, r3d
LOAD_MASK m0, m1, m2, m3, m4, m5, m7, m6, m4
CHROMA_DEBLOCK_P0_Q0_INTRA m1, m2, m0, m3, m7, m5, m6
CHROMA_V_STORE
@@ -907,11 +905,11 @@ cglobal deblock_v_chroma_intra_10_%1, 4,6-(mmsize/16),8*(mmsize/16)
%endif
%endmacro
-%ifndef ARCH_X86_64
-INIT_MMX
-DEBLOCK_CHROMA mmxext
+%if ARCH_X86_64 == 0
+INIT_MMX mmxext
+DEBLOCK_CHROMA
%endif
-INIT_XMM
-DEBLOCK_CHROMA sse2
-INIT_AVX
-DEBLOCK_CHROMA avx
+INIT_XMM sse2
+DEBLOCK_CHROMA
+INIT_XMM avx
+DEBLOCK_CHROMA
diff --git a/gst-libs/ext/libav/libavcodec/x86/h264_i386.h b/gst-libs/ext/libav/libavcodec/x86/h264_i386.h
index e195e04..bb881c3 100644
--- a/gst-libs/ext/libav/libavcodec/x86/h264_i386.h
+++ b/gst-libs/ext/libav/libavcodec/x86/h264_i386.h
@@ -34,9 +34,12 @@
#include "libavcodec/cabac.h"
#include "cabac.h"
+#if HAVE_INLINE_ASM
+
//FIXME use some macros to avoid duplicating get_cabac (cannot be done yet
//as that would make optimization work hard)
-#if HAVE_7REGS && !defined(BROKEN_RELOCATIONS)
+#if HAVE_7REGS
+#define decode_significance decode_significance_x86
static int decode_significance_x86(CABACContext *c, int max_coeff,
uint8_t *significant_coeff_ctx_base,
int *index, x86_reg last_off){
@@ -45,18 +48,38 @@ static int decode_significance_x86(CABACContext *c, int max_coeff,
int minusindex= 4-(intptr_t)index;
int bit;
x86_reg coeff_count;
+
+#ifdef BROKEN_RELOCATIONS
+ void *tables;
+
+ __asm__ volatile(
+ "lea "MANGLE(ff_h264_cabac_tables)", %0 \n\t"
+ : "=&r"(tables)
+ );
+#endif
+
__asm__ volatile(
- "2: \n\t"
+ "3: \n\t"
- BRANCHLESS_GET_CABAC("%4", "(%1)", "%3",
- "%w3", "%5", "%k0", "%b0", "%6")
+ BRANCHLESS_GET_CABAC("%4", "%q4", "(%1)", "%3", "%w3",
+ "%5", "%q5", "%k0", "%b0",
+ "%c11(%6)", "%c12(%6)",
+ AV_STRINGIFY(H264_NORM_SHIFT_OFFSET),
+ AV_STRINGIFY(H264_LPS_RANGE_OFFSET),
+ AV_STRINGIFY(H264_MLPS_STATE_OFFSET),
+ "%13")
"test $1, %4 \n\t"
- " jz 3f \n\t"
+ " jz 4f \n\t"
"add %10, %1 \n\t"
- BRANCHLESS_GET_CABAC("%4", "(%1)", "%3",
- "%w3", "%5", "%k0", "%b0", "%6")
+ BRANCHLESS_GET_CABAC("%4", "%q4", "(%1)", "%3", "%w3",
+ "%5", "%q5", "%k0", "%b0",
+ "%c11(%6)", "%c12(%6)",
+ AV_STRINGIFY(H264_NORM_SHIFT_OFFSET),
+ AV_STRINGIFY(H264_LPS_RANGE_OFFSET),
+ AV_STRINGIFY(H264_MLPS_STATE_OFFSET),
+ "%13")
"sub %10, %1 \n\t"
"mov %2, %0 \n\t"
@@ -65,30 +88,33 @@ static int decode_significance_x86(CABACContext *c, int max_coeff,
"movl %%ecx, (%0) \n\t"
"test $1, %4 \n\t"
- " jnz 4f \n\t"
+ " jnz 5f \n\t"
"add"OPSIZE" $4, %2 \n\t"
- "3: \n\t"
+ "4: \n\t"
"add $1, %1 \n\t"
"cmp %8, %1 \n\t"
- " jb 2b \n\t"
+ " jb 3b \n\t"
"mov %2, %0 \n\t"
"movl %7, %%ecx \n\t"
"add %1, %%"REG_c" \n\t"
"movl %%ecx, (%0) \n\t"
- "4: \n\t"
+ "5: \n\t"
"add %9, %k0 \n\t"
"shr $2, %k0 \n\t"
- :"=&q"(coeff_count), "+r"(significant_coeff_ctx_base), "+m"(index),
- "+&r"(c->low), "=&r"(bit), "+&r"(c->range),
- "+m"(c->bytestream)
- :"m"(minusstart), "m"(end), "m"(minusindex), "m"(last_off)
+ : "=&q"(coeff_count), "+r"(significant_coeff_ctx_base), "+m"(index),
+ "+&r"(c->low), "=&r"(bit), "+&r"(c->range)
+ : "r"(c), "m"(minusstart), "m"(end), "m"(minusindex), "m"(last_off),
+ "i"(offsetof(CABACContext, bytestream)),
+ "i"(offsetof(CABACContext, bytestream_end))
+ TABLES_ARG
: "%"REG_c, "memory"
);
return coeff_count;
}
+#define decode_significance_8x8 decode_significance_8x8_x86
static int decode_significance_8x8_x86(CABACContext *c,
uint8_t *significant_coeff_ctx_base,
int *index, uint8_t *last_coeff_ctx_base, const uint8_t *sig_off){
@@ -97,53 +123,82 @@ static int decode_significance_8x8_x86(CABACContext *c,
x86_reg coeff_count;
x86_reg last=0;
x86_reg state;
+
+#ifdef BROKEN_RELOCATIONS
+ void *tables;
+
+ __asm__ volatile(
+ "lea "MANGLE(ff_h264_cabac_tables)", %0 \n\t"
+ : "=&r"(tables)
+ );
+#endif
+
__asm__ volatile(
"mov %1, %6 \n\t"
- "2: \n\t"
+ "3: \n\t"
"mov %10, %0 \n\t"
"movzbl (%0, %6), %k6 \n\t"
"add %9, %6 \n\t"
- BRANCHLESS_GET_CABAC("%4", "(%6)", "%3",
- "%w3", "%5", "%k0", "%b0", "%7")
+ BRANCHLESS_GET_CABAC("%4", "%q4", "(%6)", "%3", "%w3",
+ "%5", "%q5", "%k0", "%b0",
+ "%c12(%7)", "%c13(%7)",
+ AV_STRINGIFY(H264_NORM_SHIFT_OFFSET),
+ AV_STRINGIFY(H264_LPS_RANGE_OFFSET),
+ AV_STRINGIFY(H264_MLPS_STATE_OFFSET),
+ "%15")
"mov %1, %k6 \n\t"
"test $1, %4 \n\t"
- " jz 3f \n\t"
+ " jz 4f \n\t"
- "movzbl "MANGLE(last_coeff_flag_offset_8x8)"(%k6), %k6\n\t"
+#ifdef BROKEN_RELOCATIONS
+ "movzbl %c14(%15, %q6), %k6\n\t"
+#else
+ "movzbl "MANGLE(ff_h264_cabac_tables)"+%c14(%k6), %k6\n\t"
+#endif
"add %11, %6 \n\t"
- BRANCHLESS_GET_CABAC("%4", "(%6)", "%3",
- "%w3", "%5", "%k0", "%b0", "%7")
+ BRANCHLESS_GET_CABAC("%4", "%q4", "(%6)", "%3", "%w3",
+ "%5", "%q5", "%k0", "%b0",
+ "%c12(%7)", "%c13(%7)",
+ AV_STRINGIFY(H264_NORM_SHIFT_OFFSET),
+ AV_STRINGIFY(H264_LPS_RANGE_OFFSET),
+ AV_STRINGIFY(H264_MLPS_STATE_OFFSET),
+ "%15")
"mov %2, %0 \n\t"
"mov %1, %k6 \n\t"
"movl %k6, (%0) \n\t"
"test $1, %4 \n\t"
- " jnz 4f \n\t"
+ " jnz 5f \n\t"
"add"OPSIZE" $4, %2 \n\t"
- "3: \n\t"
+ "4: \n\t"
"addl $1, %k6 \n\t"
"mov %k6, %1 \n\t"
"cmpl $63, %k6 \n\t"
- " jb 2b \n\t"
+ " jb 3b \n\t"
"mov %2, %0 \n\t"
"movl %k6, (%0) \n\t"
- "4: \n\t"
+ "5: \n\t"
"addl %8, %k0 \n\t"
"shr $2, %k0 \n\t"
- :"=&q"(coeff_count),"+m"(last), "+m"(index), "+&r"(c->low), "=&r"(bit),
- "+&r"(c->range), "=&r"(state), "+m"(c->bytestream)
- :"m"(minusindex), "m"(significant_coeff_ctx_base), "m"(sig_off), "m"(last_coeff_ctx_base)
+ : "=&q"(coeff_count), "+m"(last), "+m"(index), "+&r"(c->low),
+ "=&r"(bit), "+&r"(c->range), "=&r"(state)
+ : "r"(c), "m"(minusindex), "m"(significant_coeff_ctx_base),
+ "m"(sig_off), "m"(last_coeff_ctx_base),
+ "i"(offsetof(CABACContext, bytestream)),
+ "i"(offsetof(CABACContext, bytestream_end)),
+ "i"(H264_LAST_COEFF_FLAG_OFFSET_8x8_OFFSET) TABLES_ARG
: "%"REG_c, "memory"
);
return coeff_count;
}
#endif /* HAVE_7REGS && !defined(BROKEN_RELOCATIONS) */
+#endif /* HAVE_INLINE_ASM */
#endif /* AVCODEC_X86_H264_I386_H */
diff --git a/gst-libs/ext/libav/libavcodec/x86/h264_idct.asm b/gst-libs/ext/libav/libavcodec/x86/h264_idct.asm
index 37c2c90..30cecd9 100644
--- a/gst-libs/ext/libav/libavcodec/x86/h264_idct.asm
+++ b/gst-libs/ext/libav/libavcodec/x86/h264_idct.asm
@@ -26,8 +26,7 @@
;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
;*****************************************************************************
-%include "x86inc.asm"
-%include "x86util.asm"
+%include "libavutil/x86/x86util.asm"
SECTION_RODATA
@@ -45,8 +44,10 @@ scan8_mem: db 4+ 1*8, 5+ 1*8, 4+ 2*8, 5+ 2*8
db 4+13*8, 5+13*8, 4+14*8, 5+14*8
db 6+13*8, 7+13*8, 6+14*8, 7+14*8
%ifdef PIC
-%define scan8 r11
+%define npicregs 1
+%define scan8 picregq
%else
+%define npicregs 0
%define scan8 scan8_mem
%endif
@@ -75,9 +76,9 @@ SECTION .text
STORE_DIFFx2 m2, m3, m4, m5, m7, 6, %1, %3
%endmacro
-INIT_MMX
+INIT_MMX mmx
; ff_h264_idct_add_mmx(uint8_t *dst, int16_t *block, int stride)
-cglobal h264_idct_add_8_mmx, 3, 3, 0
+cglobal h264_idct_add_8, 3, 3, 0
IDCT4_ADD r0, r1, r2
RET
@@ -179,9 +180,9 @@ cglobal h264_idct_add_8_mmx, 3, 3, 0
STORE_DIFFx2 m1, m2, m5, m6, m7, 6, %1, %3
%endmacro
-INIT_MMX
+INIT_MMX mmx
; ff_h264_idct8_add_mmx(uint8_t *dst, int16_t *block, int stride)
-cglobal h264_idct8_add_8_mmx, 3, 4, 0
+cglobal h264_idct8_add_8, 3, 4, 0
%assign pad 128+4-(stack_offset&7)
SUB rsp, pad
@@ -198,14 +199,14 @@ cglobal h264_idct8_add_8_mmx, 3, 4, 0
; %1=uint8_t *dst, %2=int16_t *block, %3=int stride
%macro IDCT8_ADD_SSE 4
IDCT8_1D_FULL %2
-%ifdef ARCH_X86_64
+%if ARCH_X86_64
TRANSPOSE8x8W 0, 1, 2, 3, 4, 5, 6, 7, 8
%else
TRANSPOSE8x8W 0, 1, 2, 3, 4, 5, 6, 7, [%2], [%2+16]
%endif
paddw m0, [pw_32]
-%ifndef ARCH_X86_64
+%if ARCH_X86_64 == 0
mova [%2 ], m0
mova [%2+16], m4
IDCT8_1D [%2], [%2+ 16]
@@ -225,7 +226,7 @@ cglobal h264_idct8_add_8_mmx, 3, 4, 0
STORE_DIFF m1, m6, m7, [%1+%3 ]
STORE_DIFF m2, m6, m7, [%1+%3*2]
STORE_DIFF m3, m6, m7, [%1+%4 ]
-%ifndef ARCH_X86_64
+%if ARCH_X86_64 == 0
mova m0, [%2 ]
mova m1, [%2+16]
%else
@@ -239,13 +240,13 @@ cglobal h264_idct8_add_8_mmx, 3, 4, 0
STORE_DIFF m1, m6, m7, [%1+%4 ]
%endmacro
-INIT_XMM
+INIT_XMM sse2
; ff_h264_idct8_add_sse2(uint8_t *dst, int16_t *block, int stride)
-cglobal h264_idct8_add_8_sse2, 3, 4, 10
+cglobal h264_idct8_add_8, 3, 4, 10
IDCT8_ADD_SSE r0, r1, r2, r3
RET
-%macro DC_ADD_MMX2_INIT 2-3
+%macro DC_ADD_MMXEXT_INIT 2-3
%if %0 == 2
movsx %1, word [%1]
add %1, 32
@@ -265,7 +266,7 @@ cglobal h264_idct8_add_8_sse2, 3, 4, 10
packuswb m1, m1
%endmacro
-%macro DC_ADD_MMX2_OP 4
+%macro DC_ADD_MMXEXT_OP 4
%1 m2, [%2 ]
%1 m3, [%2+%3 ]
%1 m4, [%2+%3*2]
@@ -284,29 +285,30 @@ cglobal h264_idct8_add_8_sse2, 3, 4, 10
%1 [%2+%4 ], m5
%endmacro
-INIT_MMX
-; ff_h264_idct_dc_add_mmx2(uint8_t *dst, int16_t *block, int stride)
-cglobal h264_idct_dc_add_8_mmx2, 3, 3, 0
- DC_ADD_MMX2_INIT r1, r2
- DC_ADD_MMX2_OP movh, r0, r2, r1
+INIT_MMX mmxext
+; ff_h264_idct_dc_add_mmxext(uint8_t *dst, int16_t *block, int stride)
+cglobal h264_idct_dc_add_8, 3, 3, 0
+ DC_ADD_MMXEXT_INIT r1, r2
+ DC_ADD_MMXEXT_OP movh, r0, r2, r1
RET
-; ff_h264_idct8_dc_add_mmx2(uint8_t *dst, int16_t *block, int stride)
-cglobal h264_idct8_dc_add_8_mmx2, 3, 3, 0
- DC_ADD_MMX2_INIT r1, r2
- DC_ADD_MMX2_OP mova, r0, r2, r1
+; ff_h264_idct8_dc_add_mmxext(uint8_t *dst, int16_t *block, int stride)
+cglobal h264_idct8_dc_add_8, 3, 3, 0
+ DC_ADD_MMXEXT_INIT r1, r2
+ DC_ADD_MMXEXT_OP mova, r0, r2, r1
lea r0, [r0+r2*4]
- DC_ADD_MMX2_OP mova, r0, r2, r1
+ DC_ADD_MMXEXT_OP mova, r0, r2, r1
RET
+INIT_MMX mmx
; ff_h264_idct_add16_mmx(uint8_t *dst, const int *block_offset,
; DCTELEM *block, int stride, const uint8_t nnzc[6*8])
-cglobal h264_idct_add16_8_mmx, 5, 7, 0
+cglobal h264_idct_add16_8, 5, 7 + npicregs, 0, dst, block_offset, block, stride, nnzc, cntr, coeff, picreg
xor r5, r5
%ifdef PIC
- lea r11, [scan8_mem]
+ lea picregq, [scan8_mem]
%endif
-.nextblock
+.nextblock:
movzx r6, byte [scan8+r5]
movzx r6, byte [r4+r6]
test r6, r6
@@ -314,7 +316,7 @@ cglobal h264_idct_add16_8_mmx, 5, 7, 0
mov r6d, dword [r1+r5*4]
lea r6, [r0+r6]
IDCT4_ADD r6, r2, r3
-.skipblock
+.skipblock:
inc r5
add r2, 32
cmp r5, 16
@@ -323,15 +325,15 @@ cglobal h264_idct_add16_8_mmx, 5, 7, 0
; ff_h264_idct8_add4_mmx(uint8_t *dst, const int *block_offset,
; DCTELEM *block, int stride, const uint8_t nnzc[6*8])
-cglobal h264_idct8_add4_8_mmx, 5, 7, 0
+cglobal h264_idct8_add4_8, 5, 7 + npicregs, 0, dst, block_offset, block, stride, nnzc, cntr, coeff, picreg
%assign pad 128+4-(stack_offset&7)
SUB rsp, pad
xor r5, r5
%ifdef PIC
- lea r11, [scan8_mem]
+ lea picregq, [scan8_mem]
%endif
-.nextblock
+.nextblock:
movzx r6, byte [scan8+r5]
movzx r6, byte [r4+r6]
test r6, r6
@@ -345,7 +347,7 @@ cglobal h264_idct8_add4_8_mmx, 5, 7, 0
mov r6d, dword [r1+r5*4]
lea r6, [r0+r6+4]
IDCT8_ADD_MMX_END r6 , rsp+8, r3
-.skipblock
+.skipblock:
add r5, 4
add r2, 128
cmp r5, 16
@@ -353,14 +355,15 @@ cglobal h264_idct8_add4_8_mmx, 5, 7, 0
ADD rsp, pad
RET
-; ff_h264_idct_add16_mmx2(uint8_t *dst, const int *block_offset,
-; DCTELEM *block, int stride, const uint8_t nnzc[6*8])
-cglobal h264_idct_add16_8_mmx2, 5, 7, 0
+INIT_MMX mmxext
+; ff_h264_idct_add16_mmxext(uint8_t *dst, const int *block_offset,
+; DCTELEM *block, int stride, const uint8_t nnzc[6*8])
+cglobal h264_idct_add16_8, 5, 8 + npicregs, 0, dst1, block_offset, block, stride, nnzc, cntr, coeff, dst2, picreg
xor r5, r5
%ifdef PIC
- lea r11, [scan8_mem]
+ lea picregq, [scan8_mem]
%endif
-.nextblock
+.nextblock:
movzx r6, byte [scan8+r5]
movzx r6, byte [r4+r6]
test r6, r6
@@ -370,18 +373,15 @@ cglobal h264_idct_add16_8_mmx2, 5, 7, 0
movsx r6, word [r2]
test r6, r6
jz .no_dc
- DC_ADD_MMX2_INIT r2, r3, r6
-%ifdef ARCH_X86_64
-%define dst_reg r10
-%define dst_regd r10d
-%else
-%define dst_reg r1
-%define dst_regd r1d
-%endif
- mov dst_regd, dword [r1+r5*4]
- lea dst_reg, [r0+dst_reg]
- DC_ADD_MMX2_OP movh, dst_reg, r3, r6
-%ifndef ARCH_X86_64
+ DC_ADD_MMXEXT_INIT r2, r3, r6
+%if ARCH_X86_64 == 0
+%define dst2q r1
+%define dst2d r1d
+%endif
+ mov dst2d, dword [r1+r5*4]
+ lea dst2q, [r0+dst2q]
+ DC_ADD_MMXEXT_OP movh, dst2q, r3, r6
+%if ARCH_X86_64 == 0
mov r1, r1m
%endif
inc r5
@@ -389,25 +389,26 @@ cglobal h264_idct_add16_8_mmx2, 5, 7, 0
cmp r5, 16
jl .nextblock
REP_RET
-.no_dc
+.no_dc:
mov r6d, dword [r1+r5*4]
add r6, r0
IDCT4_ADD r6, r2, r3
-.skipblock
+.skipblock:
inc r5
add r2, 32
cmp r5, 16
jl .nextblock
REP_RET
+INIT_MMX mmx
; ff_h264_idct_add16intra_mmx(uint8_t *dst, const int *block_offset,
; DCTELEM *block, int stride, const uint8_t nnzc[6*8])
-cglobal h264_idct_add16intra_8_mmx, 5, 7, 0
+cglobal h264_idct_add16intra_8, 5, 7 + npicregs, 0, dst, block_offset, block, stride, nnzc, cntr, coeff, picreg
xor r5, r5
%ifdef PIC
- lea r11, [scan8_mem]
+ lea picregq, [scan8_mem]
%endif
-.nextblock
+.nextblock:
movzx r6, byte [scan8+r5]
movzx r6, byte [r4+r6]
or r6w, word [r2]
@@ -416,21 +417,23 @@ cglobal h264_idct_add16intra_8_mmx, 5, 7, 0
mov r6d, dword [r1+r5*4]
add r6, r0
IDCT4_ADD r6, r2, r3
-.skipblock
+.skipblock:
inc r5
add r2, 32
cmp r5, 16
jl .nextblock
REP_RET
-; ff_h264_idct_add16intra_mmx2(uint8_t *dst, const int *block_offset,
-; DCTELEM *block, int stride, const uint8_t nnzc[6*8])
-cglobal h264_idct_add16intra_8_mmx2, 5, 7, 0
+INIT_MMX mmxext
+; ff_h264_idct_add16intra_mmxext(uint8_t *dst, const int *block_offset,
+; DCTELEM *block, int stride,
+; const uint8_t nnzc[6*8])
+cglobal h264_idct_add16intra_8, 5, 8 + npicregs, 0, dst1, block_offset, block, stride, nnzc, cntr, coeff, dst2, picreg
xor r5, r5
%ifdef PIC
- lea r11, [scan8_mem]
+ lea picregq, [scan8_mem]
%endif
-.nextblock
+.nextblock:
movzx r6, byte [scan8+r5]
movzx r6, byte [r4+r6]
test r6, r6
@@ -443,42 +446,40 @@ cglobal h264_idct_add16intra_8_mmx2, 5, 7, 0
cmp r5, 16
jl .nextblock
REP_RET
-.try_dc
+.try_dc:
movsx r6, word [r2]
test r6, r6
jz .skipblock
- DC_ADD_MMX2_INIT r2, r3, r6
-%ifdef ARCH_X86_64
-%define dst_reg r10
-%define dst_regd r10d
-%else
-%define dst_reg r1
-%define dst_regd r1d
-%endif
- mov dst_regd, dword [r1+r5*4]
- add dst_reg, r0
- DC_ADD_MMX2_OP movh, dst_reg, r3, r6
-%ifndef ARCH_X86_64
+ DC_ADD_MMXEXT_INIT r2, r3, r6
+%if ARCH_X86_64 == 0
+%define dst2q r1
+%define dst2d r1d
+%endif
+ mov dst2d, dword [r1+r5*4]
+ add dst2q, r0
+ DC_ADD_MMXEXT_OP movh, dst2q, r3, r6
+%if ARCH_X86_64 == 0
mov r1, r1m
%endif
-.skipblock
+.skipblock:
inc r5
add r2, 32
cmp r5, 16
jl .nextblock
REP_RET
-; ff_h264_idct8_add4_mmx2(uint8_t *dst, const int *block_offset,
-; DCTELEM *block, int stride, const uint8_t nnzc[6*8])
-cglobal h264_idct8_add4_8_mmx2, 5, 7, 0
+; ff_h264_idct8_add4_mmxext(uint8_t *dst, const int *block_offset,
+; DCTELEM *block, int stride,
+; const uint8_t nnzc[6*8])
+cglobal h264_idct8_add4_8, 5, 8 + npicregs, 0, dst1, block_offset, block, stride, nnzc, cntr, coeff, dst2, picreg
%assign pad 128+4-(stack_offset&7)
SUB rsp, pad
xor r5, r5
%ifdef PIC
- lea r11, [scan8_mem]
+ lea picregq, [scan8_mem]
%endif
-.nextblock
+.nextblock:
movzx r6, byte [scan8+r5]
movzx r6, byte [r4+r6]
test r6, r6
@@ -488,20 +489,17 @@ cglobal h264_idct8_add4_8_mmx2, 5, 7, 0
movsx r6, word [r2]
test r6, r6
jz .no_dc
- DC_ADD_MMX2_INIT r2, r3, r6
-%ifdef ARCH_X86_64
-%define dst_reg r10
-%define dst_regd r10d
-%else
-%define dst_reg r1
-%define dst_regd r1d
-%endif
- mov dst_regd, dword [r1+r5*4]
- lea dst_reg, [r0+dst_reg]
- DC_ADD_MMX2_OP mova, dst_reg, r3, r6
- lea dst_reg, [dst_reg+r3*4]
- DC_ADD_MMX2_OP mova, dst_reg, r3, r6
-%ifndef ARCH_X86_64
+ DC_ADD_MMXEXT_INIT r2, r3, r6
+%if ARCH_X86_64 == 0
+%define dst2q r1
+%define dst2d r1d
+%endif
+ mov dst2d, dword [r1+r5*4]
+ lea dst2q, [r0+dst2q]
+ DC_ADD_MMXEXT_OP mova, dst2q, r3, r6
+ lea dst2q, [dst2q+r3*4]
+ DC_ADD_MMXEXT_OP mova, dst2q, r3, r6
+%if ARCH_X86_64 == 0
mov r1, r1m
%endif
add r5, 4
@@ -511,7 +509,7 @@ cglobal h264_idct8_add4_8_mmx2, 5, 7, 0
ADD rsp, pad
RET
-.no_dc
+.no_dc:
mov r6d, dword [r1+r5*4]
add r6, r0
add word [r2], 32
@@ -521,7 +519,7 @@ cglobal h264_idct8_add4_8_mmx2, 5, 7, 0
mov r6d, dword [r1+r5*4]
lea r6, [r0+r6+4]
IDCT8_ADD_MMX_END r6 , rsp+8, r3
-.skipblock
+.skipblock:
add r5, 4
add r2, 128
cmp r5, 16
@@ -530,15 +528,15 @@ cglobal h264_idct8_add4_8_mmx2, 5, 7, 0
ADD rsp, pad
RET
-INIT_XMM
+INIT_XMM sse2
; ff_h264_idct8_add4_sse2(uint8_t *dst, const int *block_offset,
; DCTELEM *block, int stride, const uint8_t nnzc[6*8])
-cglobal h264_idct8_add4_8_sse2, 5, 7, 10
+cglobal h264_idct8_add4_8, 5, 8 + npicregs, 10, dst1, block_offset, block, stride, nnzc, cntr, coeff, dst2, picreg
xor r5, r5
%ifdef PIC
- lea r11, [scan8_mem]
+ lea picregq, [scan8_mem]
%endif
-.nextblock
+.nextblock:
movzx r6, byte [scan8+r5]
movzx r6, byte [r4+r6]
test r6, r6
@@ -548,21 +546,18 @@ cglobal h264_idct8_add4_8_sse2, 5, 7, 10
movsx r6, word [r2]
test r6, r6
jz .no_dc
-INIT_MMX
- DC_ADD_MMX2_INIT r2, r3, r6
-%ifdef ARCH_X86_64
-%define dst_reg r10
-%define dst_regd r10d
-%else
-%define dst_reg r1
-%define dst_regd r1d
-%endif
- mov dst_regd, dword [r1+r5*4]
- add dst_reg, r0
- DC_ADD_MMX2_OP mova, dst_reg, r3, r6
- lea dst_reg, [dst_reg+r3*4]
- DC_ADD_MMX2_OP mova, dst_reg, r3, r6
-%ifndef ARCH_X86_64
+INIT_MMX cpuname
+ DC_ADD_MMXEXT_INIT r2, r3, r6
+%if ARCH_X86_64 == 0
+%define dst2q r1
+%define dst2d r1d
+%endif
+ mov dst2d, dword [r1+r5*4]
+ add dst2q, r0
+ DC_ADD_MMXEXT_OP mova, dst2q, r3, r6
+ lea dst2q, [dst2q+r3*4]
+ DC_ADD_MMXEXT_OP mova, dst2q, r3, r6
+%if ARCH_X86_64 == 0
mov r1, r1m
%endif
add r5, 4
@@ -570,39 +565,39 @@ INIT_MMX
cmp r5, 16
jl .nextblock
REP_RET
-.no_dc
-INIT_XMM
- mov dst_regd, dword [r1+r5*4]
- add dst_reg, r0
- IDCT8_ADD_SSE dst_reg, r2, r3, r6
-%ifndef ARCH_X86_64
+.no_dc:
+INIT_XMM cpuname
+ mov dst2d, dword [r1+r5*4]
+ add dst2q, r0
+ IDCT8_ADD_SSE dst2q, r2, r3, r6
+%if ARCH_X86_64 == 0
mov r1, r1m
%endif
-.skipblock
+.skipblock:
add r5, 4
add r2, 128
cmp r5, 16
jl .nextblock
REP_RET
-INIT_MMX
+INIT_MMX mmx
h264_idct_add8_mmx_plane:
-.nextblock
+.nextblock:
movzx r6, byte [scan8+r5]
movzx r6, byte [r4+r6]
or r6w, word [r2]
test r6, r6
jz .skipblock
-%ifdef ARCH_X86_64
+%if ARCH_X86_64
mov r0d, dword [r1+r5*4]
- add r0, [r10]
+ add r0, [dst2q]
%else
mov r0, r1m ; XXX r1m here is actually r0m of the calling func
mov r0, [r0]
add r0, dword [r1+r5*4]
%endif
IDCT4_ADD r0, r2, r3
-.skipblock
+.skipblock:
inc r5
add r2, 32
test r5, 3
@@ -611,35 +606,35 @@ h264_idct_add8_mmx_plane:
; ff_h264_idct_add8_mmx(uint8_t **dest, const int *block_offset,
; DCTELEM *block, int stride, const uint8_t nnzc[6*8])
-cglobal h264_idct_add8_8_mmx, 5, 7, 0
+cglobal h264_idct_add8_8, 5, 8 + npicregs, 0, dst1, block_offset, block, stride, nnzc, cntr, coeff, dst2, picreg
mov r5, 16
add r2, 512
%ifdef PIC
- lea r11, [scan8_mem]
+ lea picregq, [scan8_mem]
%endif
-%ifdef ARCH_X86_64
- mov r10, r0
+%if ARCH_X86_64
+ mov dst2q, r0
%endif
call h264_idct_add8_mmx_plane
mov r5, 32
add r2, 384
-%ifdef ARCH_X86_64
- add r10, gprsize
+%if ARCH_X86_64
+ add dst2q, gprsize
%else
add r0mp, gprsize
%endif
call h264_idct_add8_mmx_plane
RET
-h264_idct_add8_mmx2_plane
-.nextblock
+h264_idct_add8_mmxext_plane:
+.nextblock:
movzx r6, byte [scan8+r5]
movzx r6, byte [r4+r6]
test r6, r6
jz .try_dc
-%ifdef ARCH_X86_64
+%if ARCH_X86_64
mov r0d, dword [r1+r5*4]
- add r0, [r10]
+ add r0, [dst2q]
%else
mov r0, r1m ; XXX r1m here is actually r0m of the calling func
mov r0, [r0]
@@ -651,52 +646,52 @@ h264_idct_add8_mmx2_plane
test r5, 3
jnz .nextblock
rep ret
-.try_dc
+.try_dc:
movsx r6, word [r2]
test r6, r6
jz .skipblock
- DC_ADD_MMX2_INIT r2, r3, r6
-%ifdef ARCH_X86_64
+ DC_ADD_MMXEXT_INIT r2, r3, r6
+%if ARCH_X86_64
mov r0d, dword [r1+r5*4]
- add r0, [r10]
+ add r0, [dst2q]
%else
mov r0, r1m ; XXX r1m here is actually r0m of the calling func
mov r0, [r0]
add r0, dword [r1+r5*4]
%endif
- DC_ADD_MMX2_OP movh, r0, r3, r6
-.skipblock
+ DC_ADD_MMXEXT_OP movh, r0, r3, r6
+.skipblock:
inc r5
add r2, 32
test r5, 3
jnz .nextblock
rep ret
-; ff_h264_idct_add8_mmx2(uint8_t **dest, const int *block_offset,
-; DCTELEM *block, int stride, const uint8_t nnzc[6*8])
-cglobal h264_idct_add8_8_mmx2, 5, 7, 0
+INIT_MMX mmxext
+; ff_h264_idct_add8_mmxext(uint8_t **dest, const int *block_offset,
+; DCTELEM *block, int stride, const uint8_t nnzc[6*8])
+cglobal h264_idct_add8_8, 5, 8 + npicregs, 0, dst1, block_offset, block, stride, nnzc, cntr, coeff, dst2, picreg
mov r5, 16
add r2, 512
-%ifdef ARCH_X86_64
- mov r10, r0
+%if ARCH_X86_64
+ mov dst2q, r0
%endif
%ifdef PIC
- lea r11, [scan8_mem]
+ lea picregq, [scan8_mem]
%endif
- call h264_idct_add8_mmx2_plane
+ call h264_idct_add8_mmxext_plane
mov r5, 32
add r2, 384
-%ifdef ARCH_X86_64
- add r10, gprsize
+%if ARCH_X86_64
+ add dst2q, gprsize
%else
add r0mp, gprsize
%endif
- call h264_idct_add8_mmx2_plane
+ call h264_idct_add8_mmxext_plane
RET
-INIT_MMX
; r0 = uint8_t *dst, r2 = int16_t *block, r3 = int stride, r6=clobbered
-h264_idct_dc_add8_mmx2:
+h264_idct_dc_add8_mmxext:
movd m0, [r2 ] ; 0 0 X D
punpcklwd m0, [r2+32] ; x X d D
paddsw m0, [pw_32]
@@ -708,13 +703,13 @@ h264_idct_dc_add8_mmx2:
pshufw m1, m0, 0xFA ; -d-d-d-d-D-D-D-D
punpcklwd m0, m0 ; d d d d D D D D
lea r6, [r3*3]
- DC_ADD_MMX2_OP movq, r0, r3, r6
+ DC_ADD_MMXEXT_OP movq, r0, r3, r6
ret
ALIGN 16
-INIT_XMM
+INIT_XMM sse2
; r0 = uint8_t *dst (clobbered), r2 = int16_t *block, r3 = int stride
-x264_add8x4_idct_sse2:
+h264_add8x4_idct_sse2:
movq m0, [r2+ 0]
movq m1, [r2+ 8]
movq m2, [r2+16]
@@ -738,13 +733,13 @@ x264_add8x4_idct_sse2:
test r0, r0
jz .cycle%1end
mov r0d, dword [r1+%1*8]
-%ifdef ARCH_X86_64
- add r0, r10
+%if ARCH_X86_64
+ add r0, r5
%else
add r0, r0m
%endif
- call x264_add8x4_idct_sse2
-.cycle%1end
+ call h264_add8x4_idct_sse2
+.cycle%1end:
%if %1 < 7
add r2, 64
%endif
@@ -752,9 +747,9 @@ x264_add8x4_idct_sse2:
; ff_h264_idct_add16_sse2(uint8_t *dst, const int *block_offset,
; DCTELEM *block, int stride, const uint8_t nnzc[6*8])
-cglobal h264_idct_add16_8_sse2, 5, 5, 8
-%ifdef ARCH_X86_64
- mov r10, r0
+cglobal h264_idct_add16_8, 5, 5 + ARCH_X86_64, 8
+%if ARCH_X86_64
+ mov r5, r0
%endif
; unrolling of the loop leads to an average performance gain of
; 20-25%
@@ -773,25 +768,25 @@ cglobal h264_idct_add16_8_sse2, 5, 5, 8
test r0, r0
jz .try%1dc
mov r0d, dword [r1+%1*8]
-%ifdef ARCH_X86_64
- add r0, r10
+%if ARCH_X86_64
+ add r0, r7
%else
add r0, r0m
%endif
- call x264_add8x4_idct_sse2
+ call h264_add8x4_idct_sse2
jmp .cycle%1end
-.try%1dc
+.try%1dc:
movsx r0, word [r2 ]
or r0w, word [r2+32]
jz .cycle%1end
mov r0d, dword [r1+%1*8]
-%ifdef ARCH_X86_64
- add r0, r10
+%if ARCH_X86_64
+ add r0, r7
%else
add r0, r0m
%endif
- call h264_idct_dc_add8_mmx2
-.cycle%1end
+ call h264_idct_dc_add8_mmxext
+.cycle%1end:
%if %1 < 7
add r2, 64
%endif
@@ -799,9 +794,9 @@ cglobal h264_idct_add16_8_sse2, 5, 5, 8
; ff_h264_idct_add16intra_sse2(uint8_t *dst, const int *block_offset,
; DCTELEM *block, int stride, const uint8_t nnzc[6*8])
-cglobal h264_idct_add16intra_8_sse2, 5, 7, 8
-%ifdef ARCH_X86_64
- mov r10, r0
+cglobal h264_idct_add16intra_8, 5, 7 + ARCH_X86_64, 8
+%if ARCH_X86_64
+ mov r7, r0
%endif
add16intra_sse2_cycle 0, 0xc
add16intra_sse2_cycle 1, 0x14
@@ -817,30 +812,30 @@ cglobal h264_idct_add16intra_8_sse2, 5, 7, 8
movzx r0, word [r4+%2]
test r0, r0
jz .try%1dc
-%ifdef ARCH_X86_64
+%if ARCH_X86_64
mov r0d, dword [r1+(%1&1)*8+64*(1+(%1>>1))]
- add r0, [r10]
+ add r0, [r7]
%else
mov r0, r0m
mov r0, [r0]
add r0, dword [r1+(%1&1)*8+64*(1+(%1>>1))]
%endif
- call x264_add8x4_idct_sse2
+ call h264_add8x4_idct_sse2
jmp .cycle%1end
-.try%1dc
+.try%1dc:
movsx r0, word [r2 ]
or r0w, word [r2+32]
jz .cycle%1end
-%ifdef ARCH_X86_64
+%if ARCH_X86_64
mov r0d, dword [r1+(%1&1)*8+64*(1+(%1>>1))]
- add r0, [r10]
+ add r0, [r7]
%else
mov r0, r0m
mov r0, [r0]
add r0, dword [r1+(%1&1)*8+64*(1+(%1>>1))]
%endif
- call h264_idct_dc_add8_mmx2
-.cycle%1end
+ call h264_idct_dc_add8_mmxext
+.cycle%1end:
%if %1 == 1
add r2, 384+64
%elif %1 < 3
@@ -850,15 +845,15 @@ cglobal h264_idct_add16intra_8_sse2, 5, 7, 8
; ff_h264_idct_add8_sse2(uint8_t **dest, const int *block_offset,
; DCTELEM *block, int stride, const uint8_t nnzc[6*8])
-cglobal h264_idct_add8_8_sse2, 5, 7, 8
+cglobal h264_idct_add8_8, 5, 7 + ARCH_X86_64, 8
add r2, 512
-%ifdef ARCH_X86_64
- mov r10, r0
+%if ARCH_X86_64
+ mov r7, r0
%endif
add8_sse2_cycle 0, 0x34
add8_sse2_cycle 1, 0x3c
-%ifdef ARCH_X86_64
- add r10, gprsize
+%if ARCH_X86_64
+ add r7, gprsize
%else
add r0mp, gprsize
%endif
@@ -896,29 +891,8 @@ cglobal h264_idct_add8_8_sse2, 5, 7, 8
packssdw %2, m5
%endmacro
-%macro STORE_WORDS_MMX 5
- movd t0d, %1
- psrlq %1, 32
- movd t1d, %1
- mov [t2+%2*32], t0w
- mov [t2+%4*32], t1w
- shr t0d, 16
- shr t1d, 16
- mov [t2+%3*32], t0w
- mov [t2+%5*32], t1w
-%endmacro
-
-%macro DEQUANT_STORE_MMX 1
- DEQUANT_MMX m0, m1, %1
- STORE_WORDS_MMX m0, 0, 1, 4, 5
- STORE_WORDS_MMX m1, 2, 3, 6, 7
-
- DEQUANT_MMX m2, m3, %1
- STORE_WORDS_MMX m2, 8, 9, 12, 13
- STORE_WORDS_MMX m3, 10, 11, 14, 15
-%endmacro
-
-%macro STORE_WORDS_SSE 9
+%macro STORE_WORDS 5-9
+%if cpuflag(sse)
movd t0d, %1
psrldq %1, 4
movd t1d, %1
@@ -938,9 +912,21 @@ cglobal h264_idct_add8_8_sse2, 5, 7, 8
shr t1d, 16
mov [t2+%7*32], t0w
mov [t2+%9*32], t1w
+%else
+ movd t0d, %1
+ psrlq %1, 32
+ movd t1d, %1
+ mov [t2+%2*32], t0w
+ mov [t2+%4*32], t1w
+ shr t0d, 16
+ shr t1d, 16
+ mov [t2+%3*32], t0w
+ mov [t2+%5*32], t1w
+%endif
%endmacro
-%macro DEQUANT_STORE_SSE2 1
+%macro DEQUANT_STORE 1
+%if cpuflag(sse2)
movd xmm4, t3d
movq xmm5, [pw_1]
pshufd xmm4, xmm4, 0
@@ -962,12 +948,24 @@ cglobal h264_idct_add8_8_sse2, 5, 7, 8
psrad xmm3, %1
packssdw xmm0, xmm1
packssdw xmm2, xmm3
- STORE_WORDS_SSE xmm0, 0, 1, 4, 5, 2, 3, 6, 7
- STORE_WORDS_SSE xmm2, 8, 9, 12, 13, 10, 11, 14, 15
+ STORE_WORDS xmm0, 0, 1, 4, 5, 2, 3, 6, 7
+ STORE_WORDS xmm2, 8, 9, 12, 13, 10, 11, 14, 15
+%else
+ DEQUANT_MMX m0, m1, %1
+ STORE_WORDS m0, 0, 1, 4, 5
+ STORE_WORDS m1, 2, 3, 6, 7
+
+ DEQUANT_MMX m2, m3, %1
+ STORE_WORDS m2, 8, 9, 12, 13
+ STORE_WORDS m3, 10, 11, 14, 15
+%endif
%endmacro
-%macro IDCT_DC_DEQUANT 2
-cglobal h264_luma_dc_dequant_idct_%1, 3,4,%2
+%macro IDCT_DC_DEQUANT 1
+cglobal h264_luma_dc_dequant_idct, 3, 4, %1
+ ; manually spill XMM registers for Win64 because
+ ; the code here is initialized with INIT_MMX
+ WIN64_SPILL_XMM %1
movq m3, [r1+24]
movq m2, [r1+16]
movq m1, [r1+ 8]
@@ -977,11 +975,11 @@ cglobal h264_luma_dc_dequant_idct_%1, 3,4,%2
WALSH4_1D 0,1,2,3,4
; shift, tmp, output, qmul
-%ifdef WIN64
+%if WIN64
DECLARE_REG_TMP 0,3,1,2
; we can't avoid this, because r0 is the shift register (ecx) on win64
xchg r0, t2
-%elifdef ARCH_X86_64
+%elif ARCH_X86_64
DECLARE_REG_TMP 3,1,0,2
%else
DECLARE_REG_TMP 1,3,0,2
@@ -990,11 +988,7 @@ cglobal h264_luma_dc_dequant_idct_%1, 3,4,%2
cmp t3d, 32767
jg .big_qmul
add t3d, 128 << 16
-%ifidn %1,mmx
- DEQUANT_STORE_MMX 8
-%else
- DEQUANT_STORE_SSE2 8
-%endif
+ DEQUANT_STORE 8
RET
.big_qmul:
bsr t0d, t3d
@@ -1005,16 +999,17 @@ cglobal h264_luma_dc_dequant_idct_%1, 3,4,%2
inc t1d
shr t3d, t0b
sub t1d, t0d
-%ifidn %1,mmx
- movd m6, t1d
- DEQUANT_STORE_MMX m6
-%else
+%if cpuflag(sse2)
movd xmm6, t1d
- DEQUANT_STORE_SSE2 xmm6
+ DEQUANT_STORE xmm6
+%else
+ movd m6, t1d
+ DEQUANT_STORE m6
%endif
RET
%endmacro
-INIT_MMX
-IDCT_DC_DEQUANT mmx, 0
-IDCT_DC_DEQUANT sse2, 7
+INIT_MMX mmx
+IDCT_DC_DEQUANT 0
+INIT_MMX sse2
+IDCT_DC_DEQUANT 7
diff --git a/gst-libs/ext/libav/libavcodec/x86/h264_idct_10bit.asm b/gst-libs/ext/libav/libavcodec/x86/h264_idct_10bit.asm
index 54636a9..51965f0 100644
--- a/gst-libs/ext/libav/libavcodec/x86/h264_idct_10bit.asm
+++ b/gst-libs/ext/libav/libavcodec/x86/h264_idct_10bit.asm
@@ -22,31 +22,12 @@
;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
;******************************************************************************
-%include "x86inc.asm"
-%include "x86util.asm"
+%include "libavutil/x86/x86util.asm"
SECTION_RODATA
pw_pixel_max: times 8 dw ((1 << 10)-1)
pd_32: times 4 dd 32
-scan8_mem: db 4+ 1*8, 5+ 1*8, 4+ 2*8, 5+ 2*8
- db 6+ 1*8, 7+ 1*8, 6+ 2*8, 7+ 2*8
- db 4+ 3*8, 5+ 3*8, 4+ 4*8, 5+ 4*8
- db 6+ 3*8, 7+ 3*8, 6+ 4*8, 7+ 4*8
- db 4+ 6*8, 5+ 6*8, 4+ 7*8, 5+ 7*8
- db 6+ 6*8, 7+ 6*8, 6+ 7*8, 7+ 7*8
- db 4+ 8*8, 5+ 8*8, 4+ 9*8, 5+ 9*8
- db 6+ 8*8, 7+ 8*8, 6+ 9*8, 7+ 9*8
- db 4+11*8, 5+11*8, 4+12*8, 5+12*8
- db 6+11*8, 7+11*8, 6+12*8, 7+12*8
- db 4+13*8, 5+13*8, 4+14*8, 5+14*8
- db 6+13*8, 7+13*8, 6+14*8, 7+14*8
-
-%ifdef PIC
-%define scan8 r11
-%else
-%define scan8 scan8_mem
-%endif
SECTION .text
@@ -90,25 +71,23 @@ SECTION .text
STORE_DIFFx2 m2, m3, m4, m5, %1, %3
%endmacro
-%macro IDCT_ADD_10 1
-cglobal h264_idct_add_10_%1, 3,3
+%macro IDCT_ADD_10 0
+cglobal h264_idct_add_10, 3,3
IDCT4_ADD_10 r0, r1, r2
RET
%endmacro
-INIT_XMM
-IDCT_ADD_10 sse2
-%ifdef HAVE_AVX
-INIT_AVX
-IDCT_ADD_10 avx
-%endif
+INIT_XMM sse2
+IDCT_ADD_10
+INIT_XMM avx
+IDCT_ADD_10
;-----------------------------------------------------------------------------
; h264_idct_add16(pixel *dst, const int *block_offset, dctcoef *block, int stride, const uint8_t nnzc[6*8])
;-----------------------------------------------------------------------------
;;;;;;; NO FATE SAMPLES TRIGGER THIS
-%macro ADD4x4IDCT 1
-add4x4_idct_%1:
+%macro ADD4x4IDCT 0
+add4x4_idct %+ SUFFIX:
add r5, r0
mova m0, [r2+ 0]
mova m1, [r2+16]
@@ -125,53 +104,49 @@ add4x4_idct_%1:
ret
%endmacro
-INIT_XMM
+INIT_XMM sse2
ALIGN 16
-ADD4x4IDCT sse2
-%ifdef HAVE_AVX
-INIT_AVX
+ADD4x4IDCT
+INIT_XMM avx
ALIGN 16
-ADD4x4IDCT avx
-%endif
-
-%macro ADD16_OP 3
- cmp byte [r4+%3], 0
- jz .skipblock%2
- mov r5d, [r1+%2*4]
- call add4x4_idct_%1
-.skipblock%2:
-%if %2<15
+ADD4x4IDCT
+
+%macro ADD16_OP 2
+ cmp byte [r4+%2], 0
+ jz .skipblock%1
+ mov r5d, [r1+%1*4]
+ call add4x4_idct %+ SUFFIX
+.skipblock%1:
+%if %1<15
add r2, 64
%endif
%endmacro
-%macro IDCT_ADD16_10 1
-cglobal h264_idct_add16_10_%1, 5,6
- ADD16_OP %1, 0, 4+1*8
- ADD16_OP %1, 1, 5+1*8
- ADD16_OP %1, 2, 4+2*8
- ADD16_OP %1, 3, 5+2*8
- ADD16_OP %1, 4, 6+1*8
- ADD16_OP %1, 5, 7+1*8
- ADD16_OP %1, 6, 6+2*8
- ADD16_OP %1, 7, 7+2*8
- ADD16_OP %1, 8, 4+3*8
- ADD16_OP %1, 9, 5+3*8
- ADD16_OP %1, 10, 4+4*8
- ADD16_OP %1, 11, 5+4*8
- ADD16_OP %1, 12, 6+3*8
- ADD16_OP %1, 13, 7+3*8
- ADD16_OP %1, 14, 6+4*8
- ADD16_OP %1, 15, 7+4*8
+%macro IDCT_ADD16_10 0
+cglobal h264_idct_add16_10, 5,6
+ ADD16_OP 0, 4+1*8
+ ADD16_OP 1, 5+1*8
+ ADD16_OP 2, 4+2*8
+ ADD16_OP 3, 5+2*8
+ ADD16_OP 4, 6+1*8
+ ADD16_OP 5, 7+1*8
+ ADD16_OP 6, 6+2*8
+ ADD16_OP 7, 7+2*8
+ ADD16_OP 8, 4+3*8
+ ADD16_OP 9, 5+3*8
+ ADD16_OP 10, 4+4*8
+ ADD16_OP 11, 5+4*8
+ ADD16_OP 12, 6+3*8
+ ADD16_OP 13, 7+3*8
+ ADD16_OP 14, 6+4*8
+ ADD16_OP 15, 7+4*8
REP_RET
%endmacro
-INIT_XMM
-IDCT_ADD16_10 sse2
-%ifdef HAVE_AVX
-INIT_AVX
-IDCT_ADD16_10 avx
-%endif
+INIT_XMM sse2
+IDCT_ADD16_10
+INIT_XMM avx
+IDCT_ADD16_10
;-----------------------------------------------------------------------------
; void h264_idct_dc_add(pixel *dst, dctcoef *block, int stride)
@@ -203,8 +178,8 @@ IDCT_ADD16_10 avx
mova [%1+%3 ], m4
%endmacro
-INIT_MMX
-cglobal h264_idct_dc_add_10_mmx2,3,3
+INIT_MMX mmxext
+cglobal h264_idct_dc_add_10,3,3
movd m0, [r1]
paddd m0, [pd_32]
psrad m0, 6
@@ -217,8 +192,8 @@ cglobal h264_idct_dc_add_10_mmx2,3,3
;-----------------------------------------------------------------------------
; void h264_idct8_dc_add(pixel *dst, dctcoef *block, int stride)
;-----------------------------------------------------------------------------
-%macro IDCT8_DC_ADD 1
-cglobal h264_idct8_dc_add_10_%1,3,3,7
+%macro IDCT8_DC_ADD 0
+cglobal h264_idct8_dc_add_10,3,3,7
mov r1d, [r1]
add r1, 32
sar r1, 6
@@ -232,45 +207,43 @@ cglobal h264_idct8_dc_add_10_%1,3,3,7
RET
%endmacro
-INIT_XMM
-IDCT8_DC_ADD sse2
-%ifdef HAVE_AVX
-INIT_AVX
-IDCT8_DC_ADD avx
-%endif
+INIT_XMM sse2
+IDCT8_DC_ADD
+INIT_XMM avx
+IDCT8_DC_ADD
;-----------------------------------------------------------------------------
; h264_idct_add16intra(pixel *dst, const int *block_offset, dctcoef *block, int stride, const uint8_t nnzc[6*8])
;-----------------------------------------------------------------------------
-%macro AC 2
-.ac%2
- mov r5d, [r1+(%2+0)*4]
- call add4x4_idct_%1
- mov r5d, [r1+(%2+1)*4]
+%macro AC 1
+.ac%1:
+ mov r5d, [r1+(%1+0)*4]
+ call add4x4_idct %+ SUFFIX
+ mov r5d, [r1+(%1+1)*4]
add r2, 64
- call add4x4_idct_%1
+ call add4x4_idct %+ SUFFIX
add r2, 64
- jmp .skipadd%2
+ jmp .skipadd%1
%endmacro
%assign last_block 16
-%macro ADD16_OP_INTRA 3
- cmp word [r4+%3], 0
- jnz .ac%2
+%macro ADD16_OP_INTRA 2
+ cmp word [r4+%2], 0
+ jnz .ac%1
mov r5d, [r2+ 0]
or r5d, [r2+64]
- jz .skipblock%2
- mov r5d, [r1+(%2+0)*4]
- call idct_dc_add_%1
-.skipblock%2:
-%if %2<last_block-2
+ jz .skipblock%1
+ mov r5d, [r1+(%1+0)*4]
+ call idct_dc_add %+ SUFFIX
+.skipblock%1:
+%if %1<last_block-2
add r2, 128
%endif
-.skipadd%2:
+.skipadd%1:
%endmacro
-%macro IDCT_ADD16INTRA_10 1
-idct_dc_add_%1:
+%macro IDCT_ADD16INTRA_10 0
+idct_dc_add %+ SUFFIX:
add r5, r0
movq m0, [r2+ 0]
movhps m0, [r2+64]
@@ -283,69 +256,65 @@ idct_dc_add_%1:
IDCT_DC_ADD_OP_10 r5, r3, r6
ret
-cglobal h264_idct_add16intra_10_%1,5,7,8
- ADD16_OP_INTRA %1, 0, 4+1*8
- ADD16_OP_INTRA %1, 2, 4+2*8
- ADD16_OP_INTRA %1, 4, 6+1*8
- ADD16_OP_INTRA %1, 6, 6+2*8
- ADD16_OP_INTRA %1, 8, 4+3*8
- ADD16_OP_INTRA %1, 10, 4+4*8
- ADD16_OP_INTRA %1, 12, 6+3*8
- ADD16_OP_INTRA %1, 14, 6+4*8
+cglobal h264_idct_add16intra_10,5,7,8
+ ADD16_OP_INTRA 0, 4+1*8
+ ADD16_OP_INTRA 2, 4+2*8
+ ADD16_OP_INTRA 4, 6+1*8
+ ADD16_OP_INTRA 6, 6+2*8
+ ADD16_OP_INTRA 8, 4+3*8
+ ADD16_OP_INTRA 10, 4+4*8
+ ADD16_OP_INTRA 12, 6+3*8
+ ADD16_OP_INTRA 14, 6+4*8
REP_RET
- AC %1, 8
- AC %1, 10
- AC %1, 12
- AC %1, 14
- AC %1, 0
- AC %1, 2
- AC %1, 4
- AC %1, 6
+ AC 8
+ AC 10
+ AC 12
+ AC 14
+ AC 0
+ AC 2
+ AC 4
+ AC 6
%endmacro
-INIT_XMM
-IDCT_ADD16INTRA_10 sse2
-%ifdef HAVE_AVX
-INIT_AVX
-IDCT_ADD16INTRA_10 avx
-%endif
+INIT_XMM sse2
+IDCT_ADD16INTRA_10
+INIT_XMM avx
+IDCT_ADD16INTRA_10
%assign last_block 36
;-----------------------------------------------------------------------------
; h264_idct_add8(pixel **dst, const int *block_offset, dctcoef *block, int stride, const uint8_t nnzc[6*8])
;-----------------------------------------------------------------------------
-%macro IDCT_ADD8 1
-cglobal h264_idct_add8_10_%1,5,7
-%ifdef ARCH_X86_64
- mov r10, r0
+%macro IDCT_ADD8 0
+cglobal h264_idct_add8_10,5,8,7
+%if ARCH_X86_64
+ mov r7, r0
%endif
add r2, 1024
mov r0, [r0]
- ADD16_OP_INTRA %1, 16, 4+ 6*8
- ADD16_OP_INTRA %1, 18, 4+ 7*8
+ ADD16_OP_INTRA 16, 4+ 6*8
+ ADD16_OP_INTRA 18, 4+ 7*8
add r2, 1024-128*2
-%ifdef ARCH_X86_64
- mov r0, [r10+gprsize]
+%if ARCH_X86_64
+ mov r0, [r7+gprsize]
%else
mov r0, r0m
mov r0, [r0+gprsize]
%endif
- ADD16_OP_INTRA %1, 32, 4+11*8
- ADD16_OP_INTRA %1, 34, 4+12*8
+ ADD16_OP_INTRA 32, 4+11*8
+ ADD16_OP_INTRA 34, 4+12*8
REP_RET
- AC %1, 16
- AC %1, 18
- AC %1, 32
- AC %1, 34
+ AC 16
+ AC 18
+ AC 32
+ AC 34
%endmacro ; IDCT_ADD8
-INIT_XMM
-IDCT_ADD8 sse2
-%ifdef HAVE_AVX
-INIT_AVX
-IDCT_ADD8 avx
-%endif
+INIT_XMM sse2
+IDCT_ADD8
+INIT_XMM avx
+IDCT_ADD8
;-----------------------------------------------------------------------------
; void h264_idct8_add(pixel *dst, dctcoef *block, int stride)
@@ -411,7 +380,7 @@ IDCT_ADD8 avx
; %1=int16_t *block, %2=int16_t *dstblock
%macro IDCT8_ADD_SSE_START 2
IDCT8_1D_FULL %1
-%ifdef ARCH_X86_64
+%if ARCH_X86_64
TRANSPOSE4x4D 0,1,2,3,8
mova [%2 ], m0
TRANSPOSE4x4D 4,5,6,7,8
@@ -450,24 +419,24 @@ IDCT_ADD8 avx
STORE_DIFFx2 m0, m1, m6, m7, %1, %3
%endmacro
-%macro IDCT8_ADD 1
-cglobal h264_idct8_add_10_%1, 3,4,16
-%ifndef UNIX64
+%macro IDCT8_ADD 0
+cglobal h264_idct8_add_10, 3,4,16
+%if UNIX64 == 0
%assign pad 16-gprsize-(stack_offset&15)
sub rsp, pad
- call h264_idct8_add1_10_%1
+ call h264_idct8_add1_10 %+ SUFFIX
add rsp, pad
RET
%endif
ALIGN 16
; TODO: does not need to use stack
-h264_idct8_add1_10_%1:
+h264_idct8_add1_10 %+ SUFFIX:
%assign pad 256+16-gprsize
sub rsp, pad
add dword [r1], 32
-%ifdef ARCH_X86_64
+%if ARCH_X86_64
IDCT8_ADD_SSE_START r1, rsp
SWAP 1, 9
SWAP 2, 10
@@ -517,31 +486,29 @@ h264_idct8_add1_10_%1:
ret
%endmacro
-INIT_XMM
-IDCT8_ADD sse2
-%ifdef HAVE_AVX
-INIT_AVX
-IDCT8_ADD avx
-%endif
+INIT_XMM sse2
+IDCT8_ADD
+INIT_XMM avx
+IDCT8_ADD
;-----------------------------------------------------------------------------
; h264_idct8_add4(pixel **dst, const int *block_offset, dctcoef *block, int stride, const uint8_t nnzc[6*8])
;-----------------------------------------------------------------------------
;;;;;;; NO FATE SAMPLES TRIGGER THIS
-%macro IDCT8_ADD4_OP 3
- cmp byte [r4+%3], 0
- jz .skipblock%2
- mov r0d, [r6+%2*4]
+%macro IDCT8_ADD4_OP 2
+ cmp byte [r4+%2], 0
+ jz .skipblock%1
+ mov r0d, [r6+%1*4]
add r0, r5
- call h264_idct8_add1_10_%1
-.skipblock%2:
-%if %2<12
+ call h264_idct8_add1_10 %+ SUFFIX
+.skipblock%1:
+%if %1<12
add r1, 256
%endif
%endmacro
-%macro IDCT8_ADD4 1
-cglobal h264_idct8_add4_10_%1, 0,7,16
+%macro IDCT8_ADD4 0
+cglobal h264_idct8_add4_10, 0,7,16
%assign pad 16-gprsize-(stack_offset&15)
SUB rsp, pad
mov r5, r0mp
@@ -549,17 +516,15 @@ cglobal h264_idct8_add4_10_%1, 0,7,16
mov r1, r2mp
mov r2d, r3m
movifnidn r4, r4mp
- IDCT8_ADD4_OP %1, 0, 4+1*8
- IDCT8_ADD4_OP %1, 4, 6+1*8
- IDCT8_ADD4_OP %1, 8, 4+3*8
- IDCT8_ADD4_OP %1, 12, 6+3*8
+ IDCT8_ADD4_OP 0, 4+1*8
+ IDCT8_ADD4_OP 4, 6+1*8
+ IDCT8_ADD4_OP 8, 4+3*8
+ IDCT8_ADD4_OP 12, 6+3*8
ADD rsp, pad
RET
%endmacro ; IDCT8_ADD4
-INIT_XMM
-IDCT8_ADD4 sse2
-%ifdef HAVE_AVX
-INIT_AVX
-IDCT8_ADD4 avx
-%endif
+INIT_XMM sse2
+IDCT8_ADD4
+INIT_XMM avx
+IDCT8_ADD4
diff --git a/gst-libs/ext/libav/libavcodec/x86/h264_intrapred.asm b/gst-libs/ext/libav/libavcodec/x86/h264_intrapred.asm
index c1cd5c4..b9db3f4 100644
--- a/gst-libs/ext/libav/libavcodec/x86/h264_intrapred.asm
+++ b/gst-libs/ext/libav/libavcodec/x86/h264_intrapred.asm
@@ -22,8 +22,7 @@
;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
;******************************************************************************
-%include "x86inc.asm"
-%include "x86util.asm"
+%include "libavutil/x86/x86util.asm"
SECTION_RODATA
@@ -50,10 +49,11 @@ cextern pw_17
cextern pw_32
;-----------------------------------------------------------------------------
-; void pred16x16_vertical(uint8_t *src, int stride)
+; void pred16x16_vertical_8(uint8_t *src, int stride)
;-----------------------------------------------------------------------------
-cglobal pred16x16_vertical_mmx, 2,3
+INIT_MMX mmx
+cglobal pred16x16_vertical_8, 2,3
sub r0, r1
mov r2, 8
movq mm0, [r0+0]
@@ -68,7 +68,8 @@ cglobal pred16x16_vertical_mmx, 2,3
jg .loop
REP_RET
-cglobal pred16x16_vertical_sse, 2,3
+INIT_XMM sse
+cglobal pred16x16_vertical_8, 2,3
sub r0, r1
mov r2, 4
movaps xmm0, [r0]
@@ -84,34 +85,27 @@ cglobal pred16x16_vertical_sse, 2,3
REP_RET
;-----------------------------------------------------------------------------
-; void pred16x16_horizontal(uint8_t *src, int stride)
+; void pred16x16_horizontal_8(uint8_t *src, int stride)
;-----------------------------------------------------------------------------
-%macro PRED16x16_H 1
-cglobal pred16x16_horizontal_%1, 2,3
+%macro PRED16x16_H 0
+cglobal pred16x16_horizontal_8, 2,3
mov r2, 8
-%ifidn %1, ssse3
+%if cpuflag(ssse3)
mova m2, [pb_3]
%endif
.loop:
movd m0, [r0+r1*0-4]
movd m1, [r0+r1*1-4]
-%ifidn %1, ssse3
+%if cpuflag(ssse3)
pshufb m0, m2
pshufb m1, m2
%else
punpcklbw m0, m0
punpcklbw m1, m1
-%ifidn %1, mmxext
- pshufw m0, m0, 0xff
- pshufw m1, m1, 0xff
-%else
- punpckhwd m0, m0
- punpckhwd m1, m1
- punpckhdq m0, m0
- punpckhdq m1, m1
-%endif
+ SPLATW m0, m0, 3
+ SPLATW m1, m1, 3
mova [r0+r1*0+8], m0
mova [r0+r1*1+8], m1
%endif
@@ -124,18 +118,19 @@ cglobal pred16x16_horizontal_%1, 2,3
REP_RET
%endmacro
-INIT_MMX
-PRED16x16_H mmx
-PRED16x16_H mmxext
-INIT_XMM
-PRED16x16_H ssse3
+INIT_MMX mmx
+PRED16x16_H
+INIT_MMX mmxext
+PRED16x16_H
+INIT_XMM ssse3
+PRED16x16_H
;-----------------------------------------------------------------------------
-; void pred16x16_dc(uint8_t *src, int stride)
+; void pred16x16_dc_8(uint8_t *src, int stride)
;-----------------------------------------------------------------------------
-%macro PRED16x16_DC 1
-cglobal pred16x16_dc_%1, 2,7
+%macro PRED16x16_DC 0
+cglobal pred16x16_dc_8, 2,7
mov r4, r0
sub r0, r1
pxor mm0, mm0
@@ -158,20 +153,10 @@ cglobal pred16x16_dc_%1, 2,7
add r5d, r6d
lea r2d, [r2+r5+16]
shr r2d, 5
-%ifidn %1, mmxext
- movd m0, r2d
- punpcklbw m0, m0
- pshufw m0, m0, 0
-%elifidn %1, sse2
- movd m0, r2d
- punpcklbw m0, m0
- pshuflw m0, m0, 0
- punpcklqdq m0, m0
-%elifidn %1, ssse3
+%if cpuflag(ssse3)
pxor m1, m1
- movd m0, r2d
- pshufb m0, m1
%endif
+ SPLATB_REG m0, r2, m1
%if mmsize==8
mov r3d, 8
@@ -195,18 +180,19 @@ cglobal pred16x16_dc_%1, 2,7
REP_RET
%endmacro
-INIT_MMX
-PRED16x16_DC mmxext
-INIT_XMM
-PRED16x16_DC sse2
-PRED16x16_DC ssse3
+INIT_MMX mmxext
+PRED16x16_DC
+INIT_XMM sse2
+PRED16x16_DC
+INIT_XMM ssse3
+PRED16x16_DC
;-----------------------------------------------------------------------------
-; void pred16x16_tm_vp8(uint8_t *src, int stride)
+; void pred16x16_tm_vp8_8(uint8_t *src, int stride)
;-----------------------------------------------------------------------------
-%macro PRED16x16_TM_MMX 1
-cglobal pred16x16_tm_vp8_%1, 2,5
+%macro PRED16x16_TM 0
+cglobal pred16x16_tm_vp8_8, 2,5
sub r0, r1
pxor mm7, mm7
movq mm0, [r0+0]
@@ -223,12 +209,7 @@ cglobal pred16x16_tm_vp8_%1, 2,5
movzx r2d, byte [r0+r1-1]
sub r2d, r3d
movd mm4, r2d
-%ifidn %1, mmx
- punpcklwd mm4, mm4
- punpckldq mm4, mm4
-%else
- pshufw mm4, mm4, 0
-%endif
+ SPLATW mm4, mm4, 0
movq mm5, mm4
movq mm6, mm4
movq mm7, mm4
@@ -246,10 +227,13 @@ cglobal pred16x16_tm_vp8_%1, 2,5
REP_RET
%endmacro
-PRED16x16_TM_MMX mmx
-PRED16x16_TM_MMX mmxext
+INIT_MMX mmx
+PRED16x16_TM
+INIT_MMX mmxext
+PRED16x16_TM
-cglobal pred16x16_tm_vp8_sse2, 2,6,6
+INIT_XMM sse2
+cglobal pred16x16_tm_vp8_8, 2,6,6
sub r0, r1
pxor xmm2, xmm2
movdqa xmm0, [r0]
@@ -285,11 +269,11 @@ cglobal pred16x16_tm_vp8_sse2, 2,6,6
REP_RET
;-----------------------------------------------------------------------------
-; void pred16x16_plane(uint8_t *src, int stride)
+; void pred16x16_plane_*_8(uint8_t *src, int stride)
;-----------------------------------------------------------------------------
-%macro H264_PRED16x16_PLANE 3
-cglobal pred16x16_plane_%3_%1, 2, 7, %2
+%macro H264_PRED16x16_PLANE 1
+cglobal pred16x16_plane_%1_8, 2,9,7
mov r2, r1 ; +stride
neg r1 ; -stride
@@ -310,7 +294,10 @@ cglobal pred16x16_plane_%3_%1, 2, 7, %2
paddw m0, m2
paddw m1, m3
%else ; mmsize == 16
-%ifidn %1, sse2
+%if cpuflag(ssse3)
+ movhps m0, [r0+r1 +8]
+ pmaddubsw m0, [plane_shuf] ; H coefficients
+%else ; sse2
pxor m2, m2
movh m1, [r0+r1 +8]
punpcklbw m0, m2
@@ -318,29 +305,22 @@ cglobal pred16x16_plane_%3_%1, 2, 7, %2
pmullw m0, [pw_m8tom1]
pmullw m1, [pw_1to8]
paddw m0, m1
-%else ; ssse3
- movhps m0, [r0+r1 +8]
- pmaddubsw m0, [plane_shuf] ; H coefficients
%endif
movhlps m1, m0
%endif
paddw m0, m1
-%ifidn %1, mmx
+%if cpuflag(mmxext)
+ PSHUFLW m1, m0, 0xE
+%elif cpuflag(mmx)
mova m1, m0
psrlq m1, 32
-%elifidn %1, mmx2
- pshufw m1, m0, 0xE
-%else ; mmsize == 16
- pshuflw m1, m0, 0xE
%endif
paddw m0, m1
-%ifidn %1, mmx
+%if cpuflag(mmxext)
+ PSHUFLW m1, m0, 0x1
+%elif cpuflag(mmx)
mova m1, m0
psrlq m1, 16
-%elifidn %1, mmx2
- pshufw m1, m0, 0x1
-%else
- pshuflw m1, m0, 0x1
%endif
paddw m0, m1 ; sum of H coefficients
@@ -348,8 +328,8 @@ cglobal pred16x16_plane_%3_%1, 2, 7, %2
lea r3, [r0+r2*4-1]
add r4, r2
-%ifdef ARCH_X86_64
-%define e_reg r11
+%if ARCH_X86_64
+%define e_reg r8
%else
%define e_reg r0
%endif
@@ -369,9 +349,9 @@ cglobal pred16x16_plane_%3_%1, 2, 7, %2
lea r5, [r5+r6*4]
movzx e_reg, byte [r3 ]
-%ifdef ARCH_X86_64
- movzx r10, byte [r4+r2 ]
- sub r10, e_reg
+%if ARCH_X86_64
+ movzx r7, byte [r4+r2 ]
+ sub r7, e_reg
%else
movzx r6, byte [r4+r2 ]
sub r6, e_reg
@@ -385,8 +365,8 @@ cglobal pred16x16_plane_%3_%1, 2, 7, %2
movzx r4, byte [e_reg+r2 ]
movzx r6, byte [r3 ]
sub r6, r4
-%ifdef ARCH_X86_64
- lea r6, [r10+r6*2]
+%if ARCH_X86_64
+ lea r6, [r7+r6*2]
lea r5, [r5+r6*2]
add r5, r6
%else
@@ -395,10 +375,10 @@ cglobal pred16x16_plane_%3_%1, 2, 7, %2
%endif
movzx r4, byte [e_reg ]
-%ifdef ARCH_X86_64
- movzx r10, byte [r3 +r2 ]
- sub r10, r4
- sub r5, r10
+%if ARCH_X86_64
+ movzx r7, byte [r3 +r2 ]
+ sub r7, r4
+ sub r5, r7
%else
movzx r6, byte [r3 +r2 ]
sub r6, r4
@@ -409,8 +389,8 @@ cglobal pred16x16_plane_%3_%1, 2, 7, %2
movzx r4, byte [e_reg+r1 ]
movzx r6, byte [r3 +r2*2]
sub r6, r4
-%ifdef ARCH_X86_64
- add r6, r10
+%if ARCH_X86_64
+ add r6, r7
%endif
lea r5, [r5+r6*8]
@@ -420,17 +400,17 @@ cglobal pred16x16_plane_%3_%1, 2, 7, %2
lea r5, [r5+r6*4]
add r5, r6 ; sum of V coefficients
-%ifndef ARCH_X86_64
+%if ARCH_X86_64 == 0
mov r0, r0m
%endif
-%ifidn %3, h264
+%ifidn %1, h264
lea r5, [r5*5+32]
sar r5, 6
-%elifidn %3, rv40
+%elifidn %1, rv40
lea r5, [r5*5]
sar r5, 6
-%elifidn %3, svq3
+%elifidn %1, svq3
test r5, r5
lea r6, [r5+3]
cmovs r5, r6
@@ -449,8 +429,8 @@ cglobal pred16x16_plane_%3_%1, 2, 7, %2
movd r1d, m0
movsx r1d, r1w
-%ifnidn %3, svq3
-%ifidn %3, h264
+%ifnidn %1, svq3
+%ifidn %1, h264
lea r1d, [r1d*5+32]
%else ; rv40
lea r1d, [r1d*5]
@@ -476,26 +456,10 @@ cglobal pred16x16_plane_%3_%1, 2, 7, %2
movd m1, r5d
movd m3, r3d
-%ifidn %1, mmx
- punpcklwd m0, m0
- punpcklwd m1, m1
- punpcklwd m3, m3
- punpckldq m0, m0
- punpckldq m1, m1
- punpckldq m3, m3
-%elifidn %1, mmx2
- pshufw m0, m0, 0x0
- pshufw m1, m1, 0x0
- pshufw m3, m3, 0x0
-%else
- pshuflw m0, m0, 0x0
- pshuflw m1, m1, 0x0
- pshuflw m3, m3, 0x0
- punpcklqdq m0, m0 ; splat H (words)
- punpcklqdq m1, m1 ; splat V (words)
- punpcklqdq m3, m3 ; splat a (words)
-%endif
-%ifidn %3, svq3
+ SPLATW m0, m0, 0 ; H
+ SPLATW m1, m1, 0 ; V
+ SPLATW m3, m3, 0 ; a
+%ifidn %1, svq3
SWAP 0, 1
%endif
mova m2, m0
@@ -519,7 +483,7 @@ cglobal pred16x16_plane_%3_%1, 2, 7, %2
%endif
mov r4, 8
-.loop
+.loop:
mova m3, m0 ; b[0..7]
mova m4, m2 ; b[8..15]
psraw m3, 5
@@ -568,27 +532,29 @@ cglobal pred16x16_plane_%3_%1, 2, 7, %2
REP_RET
%endmacro
-INIT_MMX
-H264_PRED16x16_PLANE mmx, 0, h264
-H264_PRED16x16_PLANE mmx, 0, rv40
-H264_PRED16x16_PLANE mmx, 0, svq3
-H264_PRED16x16_PLANE mmx2, 0, h264
-H264_PRED16x16_PLANE mmx2, 0, rv40
-H264_PRED16x16_PLANE mmx2, 0, svq3
-INIT_XMM
-H264_PRED16x16_PLANE sse2, 8, h264
-H264_PRED16x16_PLANE sse2, 8, rv40
-H264_PRED16x16_PLANE sse2, 8, svq3
-H264_PRED16x16_PLANE ssse3, 8, h264
-H264_PRED16x16_PLANE ssse3, 8, rv40
-H264_PRED16x16_PLANE ssse3, 8, svq3
+INIT_MMX mmx
+H264_PRED16x16_PLANE h264
+H264_PRED16x16_PLANE rv40
+H264_PRED16x16_PLANE svq3
+INIT_MMX mmxext
+H264_PRED16x16_PLANE h264
+H264_PRED16x16_PLANE rv40
+H264_PRED16x16_PLANE svq3
+INIT_XMM sse2
+H264_PRED16x16_PLANE h264
+H264_PRED16x16_PLANE rv40
+H264_PRED16x16_PLANE svq3
+INIT_XMM ssse3
+H264_PRED16x16_PLANE h264
+H264_PRED16x16_PLANE rv40
+H264_PRED16x16_PLANE svq3
;-----------------------------------------------------------------------------
-; void pred8x8_plane(uint8_t *src, int stride)
+; void pred8x8_plane_8(uint8_t *src, int stride)
;-----------------------------------------------------------------------------
-%macro H264_PRED8x8_PLANE 2
-cglobal pred8x8_plane_%1, 2, 7, %2
+%macro H264_PRED8x8_PLANE 0
+cglobal pred8x8_plane_8, 2,9,7
mov r2, r1 ; +stride
neg r1 ; -stride
@@ -601,39 +567,35 @@ cglobal pred8x8_plane_%1, 2, 7, %2
pmullw m0, [pw_m4to4]
pmullw m1, [pw_m4to4+8]
%else ; mmsize == 16
-%ifidn %1, sse2
+%if cpuflag(ssse3)
+ movhps m0, [r0+r1 +4] ; this reads 4 bytes more than necessary
+ pmaddubsw m0, [plane8_shuf] ; H coefficients
+%else ; sse2
pxor m2, m2
movd m1, [r0+r1 +4]
punpckldq m0, m1
punpcklbw m0, m2
pmullw m0, [pw_m4to4]
-%else ; ssse3
- movhps m0, [r0+r1 +4] ; this reads 4 bytes more than necessary
- pmaddubsw m0, [plane8_shuf] ; H coefficients
%endif
movhlps m1, m0
%endif
paddw m0, m1
-%ifnidn %1, ssse3
-%ifidn %1, mmx
+%if notcpuflag(ssse3)
+%if cpuflag(mmxext)
+ PSHUFLW m1, m0, 0xE
+%elif cpuflag(mmx)
mova m1, m0
psrlq m1, 32
-%elifidn %1, mmx2
- pshufw m1, m0, 0xE
-%else ; mmsize == 16
- pshuflw m1, m0, 0xE
%endif
paddw m0, m1
%endif ; !ssse3
-%ifidn %1, mmx
+%if cpuflag(mmxext)
+ PSHUFLW m1, m0, 0x1
+%elif cpuflag(mmx)
mova m1, m0
psrlq m1, 16
-%elifidn %1, mmx2
- pshufw m1, m0, 0x1
-%else
- pshuflw m1, m0, 0x1
%endif
paddw m0, m1 ; sum of H coefficients
@@ -641,8 +603,8 @@ cglobal pred8x8_plane_%1, 2, 7, %2
lea r3, [r0 -1]
add r4, r2
-%ifdef ARCH_X86_64
-%define e_reg r11
+%if ARCH_X86_64
+%define e_reg r8
%else
%define e_reg r0
%endif
@@ -652,10 +614,10 @@ cglobal pred8x8_plane_%1, 2, 7, %2
sub r5, e_reg
movzx e_reg, byte [r3 ]
-%ifdef ARCH_X86_64
- movzx r10, byte [r4+r2 ]
- sub r10, e_reg
- sub r5, r10
+%if ARCH_X86_64
+ movzx r7, byte [r4+r2 ]
+ sub r7, e_reg
+ sub r5, r7
%else
movzx r6, byte [r4+r2 ]
sub r6, e_reg
@@ -666,8 +628,8 @@ cglobal pred8x8_plane_%1, 2, 7, %2
movzx e_reg, byte [r3+r1 ]
movzx r6, byte [r4+r2*2 ]
sub r6, e_reg
-%ifdef ARCH_X86_64
- add r6, r10
+%if ARCH_X86_64
+ add r6, r7
%endif
lea r5, [r5+r6*4]
@@ -680,7 +642,7 @@ cglobal pred8x8_plane_%1, 2, 7, %2
lea r5, [r5+r6*8]
sar r5, 5
-%ifndef ARCH_X86_64
+%if ARCH_X86_64 == 0
mov r0, r0m
%endif
@@ -701,25 +663,9 @@ cglobal pred8x8_plane_%1, 2, 7, %2
movd m1, r5d
movd m3, r3d
-%ifidn %1, mmx
- punpcklwd m0, m0
- punpcklwd m1, m1
- punpcklwd m3, m3
- punpckldq m0, m0
- punpckldq m1, m1
- punpckldq m3, m3
-%elifidn %1, mmx2
- pshufw m0, m0, 0x0
- pshufw m1, m1, 0x0
- pshufw m3, m3, 0x0
-%else
- pshuflw m0, m0, 0x0
- pshuflw m1, m1, 0x0
- pshuflw m3, m3, 0x0
- punpcklqdq m0, m0 ; splat H (words)
- punpcklqdq m1, m1 ; splat V (words)
- punpcklqdq m3, m3 ; splat a (words)
-%endif
+ SPLATW m0, m0, 0 ; H
+ SPLATW m1, m1, 0 ; V
+ SPLATW m3, m3, 0 ; a
%if mmsize == 8
mova m2, m0
%endif
@@ -732,7 +678,7 @@ cglobal pred8x8_plane_%1, 2, 7, %2
mov r4, 4
ALIGN 16
-.loop
+.loop:
%if mmsize == 16
mova m3, m0 ; b[0..7]
paddw m0, m1
@@ -768,18 +714,21 @@ ALIGN 16
REP_RET
%endmacro
-INIT_MMX
-H264_PRED8x8_PLANE mmx, 0
-H264_PRED8x8_PLANE mmx2, 0
-INIT_XMM
-H264_PRED8x8_PLANE sse2, 8
-H264_PRED8x8_PLANE ssse3, 8
+INIT_MMX mmx
+H264_PRED8x8_PLANE
+INIT_MMX mmxext
+H264_PRED8x8_PLANE
+INIT_XMM sse2
+H264_PRED8x8_PLANE
+INIT_XMM ssse3
+H264_PRED8x8_PLANE
;-----------------------------------------------------------------------------
-; void pred8x8_vertical(uint8_t *src, int stride)
+; void pred8x8_vertical_8(uint8_t *src, int stride)
;-----------------------------------------------------------------------------
-cglobal pred8x8_vertical_mmx, 2,2
+INIT_MMX mmx
+cglobal pred8x8_vertical_8, 2,2
sub r0, r1
movq mm0, [r0]
%rep 3
@@ -792,34 +741,18 @@ cglobal pred8x8_vertical_mmx, 2,2
RET
;-----------------------------------------------------------------------------
-; void pred8x8_horizontal(uint8_t *src, int stride)
+; void pred8x8_horizontal_8(uint8_t *src, int stride)
;-----------------------------------------------------------------------------
-%macro PRED8x8_H 1
-cglobal pred8x8_horizontal_%1, 2,3
+%macro PRED8x8_H 0
+cglobal pred8x8_horizontal_8, 2,3
mov r2, 4
-%ifidn %1, ssse3
+%if cpuflag(ssse3)
mova m2, [pb_3]
%endif
.loop:
- movd m0, [r0+r1*0-4]
- movd m1, [r0+r1*1-4]
-%ifidn %1, ssse3
- pshufb m0, m2
- pshufb m1, m2
-%else
- punpcklbw m0, m0
- punpcklbw m1, m1
-%ifidn %1, mmxext
- pshufw m0, m0, 0xff
- pshufw m1, m1, 0xff
-%else
- punpckhwd m0, m0
- punpckhwd m1, m1
- punpckhdq m0, m0
- punpckhdq m1, m1
-%endif
-%endif
+ SPLATB_LOAD m0, r0+r1*0-1, m2
+ SPLATB_LOAD m1, r0+r1*1-1, m2
mova [r0+r1*0], m0
mova [r0+r1*1], m1
lea r0, [r0+r1*2]
@@ -828,15 +761,18 @@ cglobal pred8x8_horizontal_%1, 2,3
REP_RET
%endmacro
-INIT_MMX
-PRED8x8_H mmx
-PRED8x8_H mmxext
-PRED8x8_H ssse3
+INIT_MMX mmx
+PRED8x8_H
+INIT_MMX mmxext
+PRED8x8_H
+INIT_MMX ssse3
+PRED8x8_H
;-----------------------------------------------------------------------------
-; void pred8x8_top_dc_mmxext(uint8_t *src, int stride)
+; void pred8x8_top_dc_8_mmxext(uint8_t *src, int stride)
;-----------------------------------------------------------------------------
-cglobal pred8x8_top_dc_mmxext, 2,5
+INIT_MMX mmxext
+cglobal pred8x8_top_dc_8, 2,5
sub r0, r1
movq mm0, [r0]
pxor mm1, mm1
@@ -867,11 +803,11 @@ cglobal pred8x8_top_dc_mmxext, 2,5
RET
;-----------------------------------------------------------------------------
-; void pred8x8_dc_mmxext(uint8_t *src, int stride)
+; void pred8x8_dc_8_mmxext(uint8_t *src, int stride)
;-----------------------------------------------------------------------------
-INIT_MMX
-cglobal pred8x8_dc_mmxext, 2,5
+INIT_MMX mmxext
+cglobal pred8x8_dc_8, 2,5
sub r0, r1
pxor m7, m7
movd m0, [r0+0]
@@ -928,10 +864,11 @@ cglobal pred8x8_dc_mmxext, 2,5
RET
;-----------------------------------------------------------------------------
-; void pred8x8_dc_rv40(uint8_t *src, int stride)
+; void pred8x8_dc_rv40_8(uint8_t *src, int stride)
;-----------------------------------------------------------------------------
-cglobal pred8x8_dc_rv40_mmxext, 2,7
+INIT_MMX mmxext
+cglobal pred8x8_dc_rv40_8, 2,7
mov r4, r0
sub r0, r1
pxor mm0, mm0
@@ -964,11 +901,11 @@ cglobal pred8x8_dc_rv40_mmxext, 2,7
REP_RET
;-----------------------------------------------------------------------------
-; void pred8x8_tm_vp8(uint8_t *src, int stride)
+; void pred8x8_tm_vp8_8(uint8_t *src, int stride)
;-----------------------------------------------------------------------------
-%macro PRED8x8_TM_MMX 1
-cglobal pred8x8_tm_vp8_%1, 2,6
+%macro PRED8x8_TM 0
+cglobal pred8x8_tm_vp8_8, 2,6
sub r0, r1
pxor mm7, mm7
movq mm0, [r0]
@@ -984,15 +921,8 @@ cglobal pred8x8_tm_vp8_%1, 2,6
sub r3d, r4d
movd mm2, r2d
movd mm4, r3d
-%ifidn %1, mmx
- punpcklwd mm2, mm2
- punpcklwd mm4, mm4
- punpckldq mm2, mm2
- punpckldq mm4, mm4
-%else
- pshufw mm2, mm2, 0
- pshufw mm4, mm4, 0
-%endif
+ SPLATW mm2, mm2, 0
+ SPLATW mm4, mm4, 0
movq mm3, mm2
movq mm5, mm4
paddw mm2, mm0
@@ -1009,10 +939,13 @@ cglobal pred8x8_tm_vp8_%1, 2,6
REP_RET
%endmacro
-PRED8x8_TM_MMX mmx
-PRED8x8_TM_MMX mmxext
+INIT_MMX mmx
+PRED8x8_TM
+INIT_MMX mmxext
+PRED8x8_TM
-cglobal pred8x8_tm_vp8_sse2, 2,6,4
+INIT_XMM sse2
+cglobal pred8x8_tm_vp8_8, 2,6,4
sub r0, r1
pxor xmm1, xmm1
movq xmm0, [r0]
@@ -1040,7 +973,8 @@ cglobal pred8x8_tm_vp8_sse2, 2,6,4
jg .loop
REP_RET
-cglobal pred8x8_tm_vp8_ssse3, 2,3,6
+INIT_XMM ssse3
+cglobal pred8x8_tm_vp8_8, 2,3,6
sub r0, r1
movdqa xmm4, [tm_shuf]
pxor xmm1, xmm1
@@ -1079,10 +1013,10 @@ cglobal pred8x8_tm_vp8_ssse3, 2,3,6
%endmacro
;-----------------------------------------------------------------------------
-; void pred8x8l_top_dc(uint8_t *src, int has_topleft, int has_topright, int stride)
+; void pred8x8l_top_dc_8(uint8_t *src, int has_topleft, int has_topright, int stride)
;-----------------------------------------------------------------------------
-%macro PRED8x8L_TOP_DC 1
-cglobal pred8x8l_top_dc_%1, 4,4
+%macro PRED8x8L_TOP_DC 0
+cglobal pred8x8l_top_dc_8, 4,4
sub r0, r3
pxor mm7, mm7
movq mm0, [r0-8]
@@ -1111,7 +1045,7 @@ cglobal pred8x8l_top_dc_%1, 4,4
psrlq mm5, 56
psllq mm5, 56
pxor mm1, mm5
-.body
+.body:
PRED4x4_LOWPASS mm0, mm2, mm1, mm3, mm5
psadbw mm7, mm0
paddw mm7, [pw_4]
@@ -1128,18 +1062,17 @@ cglobal pred8x8l_top_dc_%1, 4,4
RET
%endmacro
-INIT_MMX
-%define PALIGNR PALIGNR_MMX
-PRED8x8L_TOP_DC mmxext
-%define PALIGNR PALIGNR_SSSE3
-PRED8x8L_TOP_DC ssse3
+INIT_MMX mmxext
+PRED8x8L_TOP_DC
+INIT_MMX ssse3
+PRED8x8L_TOP_DC
;-----------------------------------------------------------------------------
-;void pred8x8l_dc(uint8_t *src, int has_topleft, int has_topright, int stride)
+;void pred8x8l_dc_8(uint8_t *src, int has_topleft, int has_topright, int stride)
;-----------------------------------------------------------------------------
-%macro PRED8x8L_DC 1
-cglobal pred8x8l_dc_%1, 4,5
+%macro PRED8x8L_DC 0
+cglobal pred8x8l_dc_8, 4,5
sub r0, r3
lea r4, [r0+r3*2]
movq mm0, [r0+r3*1-8]
@@ -1207,7 +1140,7 @@ cglobal pred8x8l_dc_%1, 4,5
jz .fix_lt_2
test r2, r2
jz .fix_tr_1
-.body
+.body:
lea r1, [r0+r3*2]
PRED4x4_LOWPASS mm6, mm2, mm1, mm3, mm5
pxor mm0, mm0
@@ -1231,18 +1164,18 @@ cglobal pred8x8l_dc_%1, 4,5
movq [r4+r3*2], mm0
RET
%endmacro
-INIT_MMX
-%define PALIGNR PALIGNR_MMX
-PRED8x8L_DC mmxext
-%define PALIGNR PALIGNR_SSSE3
-PRED8x8L_DC ssse3
+
+INIT_MMX mmxext
+PRED8x8L_DC
+INIT_MMX ssse3
+PRED8x8L_DC
;-----------------------------------------------------------------------------
-; void pred8x8l_horizontal(uint8_t *src, int has_topleft, int has_topright, int stride)
+; void pred8x8l_horizontal_8(uint8_t *src, int has_topleft, int has_topright, int stride)
;-----------------------------------------------------------------------------
-%macro PRED8x8L_HORIZONTAL 1
-cglobal pred8x8l_horizontal_%1, 4,4
+%macro PRED8x8L_HORIZONTAL 0
+cglobal pred8x8l_horizontal_8, 4,4
sub r0, r3
lea r2, [r0+r3*2]
movq mm0, [r0+r3*1-8]
@@ -1303,18 +1236,17 @@ cglobal pred8x8l_horizontal_%1, 4,4
RET
%endmacro
-INIT_MMX
-%define PALIGNR PALIGNR_MMX
-PRED8x8L_HORIZONTAL mmxext
-%define PALIGNR PALIGNR_SSSE3
-PRED8x8L_HORIZONTAL ssse3
+INIT_MMX mmxext
+PRED8x8L_HORIZONTAL
+INIT_MMX ssse3
+PRED8x8L_HORIZONTAL
;-----------------------------------------------------------------------------
-; void pred8x8l_vertical(uint8_t *src, int has_topleft, int has_topright, int stride)
+; void pred8x8l_vertical_8(uint8_t *src, int has_topleft, int has_topright, int stride)
;-----------------------------------------------------------------------------
-%macro PRED8x8L_VERTICAL 1
-cglobal pred8x8l_vertical_%1, 4,4
+%macro PRED8x8L_VERTICAL 0
+cglobal pred8x8l_vertical_8, 4,4
sub r0, r3
movq mm0, [r0-8]
movq mm3, [r0]
@@ -1342,7 +1274,7 @@ cglobal pred8x8l_vertical_%1, 4,4
psrlq mm5, 56
psllq mm5, 56
pxor mm1, mm5
-.body
+.body:
PRED4x4_LOWPASS mm0, mm2, mm1, mm3, mm5
%rep 3
movq [r0+r3*1], mm0
@@ -1354,19 +1286,17 @@ cglobal pred8x8l_vertical_%1, 4,4
RET
%endmacro
-INIT_MMX
-%define PALIGNR PALIGNR_MMX
-PRED8x8L_VERTICAL mmxext
-%define PALIGNR PALIGNR_SSSE3
-PRED8x8L_VERTICAL ssse3
+INIT_MMX mmxext
+PRED8x8L_VERTICAL
+INIT_MMX ssse3
+PRED8x8L_VERTICAL
;-----------------------------------------------------------------------------
-;void pred8x8l_down_left(uint8_t *src, int has_topleft, int has_topright, int stride)
+;void pred8x8l_down_left_8(uint8_t *src, int has_topleft, int has_topright, int stride)
;-----------------------------------------------------------------------------
-INIT_MMX
-%define PALIGNR PALIGNR_MMX
-cglobal pred8x8l_down_left_mmxext, 4,5
+INIT_MMX mmxext
+cglobal pred8x8l_down_left_8, 4,5
sub r0, r3
movq mm0, [r0-8]
movq mm3, [r0]
@@ -1473,8 +1403,8 @@ cglobal pred8x8l_down_left_mmxext, 4,5
movq [r0+r3*1], mm1
RET
-%macro PRED8x8L_DOWN_LEFT 1
-cglobal pred8x8l_down_left_%1, 4,4
+%macro PRED8x8L_DOWN_LEFT 0
+cglobal pred8x8l_down_left_8, 4,4
sub r0, r3
movq mm0, [r0-8]
movq mm3, [r0]
@@ -1534,7 +1464,7 @@ cglobal pred8x8l_down_left_%1, 4,4
lea r2, [r1+r3*2]
movdqa xmm1, xmm3
pslldq xmm1, 1
-INIT_XMM
+INIT_XMM cpuname
PRED4x4_LOWPASS xmm0, xmm1, xmm2, xmm3, xmm4
psrldq xmm0, 1
movq [r0+r3*1], xmm0
@@ -1556,20 +1486,17 @@ INIT_XMM
RET
%endmacro
-INIT_MMX
-%define PALIGNR PALIGNR_MMX
-PRED8x8L_DOWN_LEFT sse2
-INIT_MMX
-%define PALIGNR PALIGNR_SSSE3
-PRED8x8L_DOWN_LEFT ssse3
+INIT_MMX sse2
+PRED8x8L_DOWN_LEFT
+INIT_MMX ssse3
+PRED8x8L_DOWN_LEFT
;-----------------------------------------------------------------------------
-;void pred8x8l_down_right_mmxext(uint8_t *src, int has_topleft, int has_topright, int stride)
+;void pred8x8l_down_right_8_mmxext(uint8_t *src, int has_topleft, int has_topright, int stride)
;-----------------------------------------------------------------------------
-INIT_MMX
-%define PALIGNR PALIGNR_MMX
-cglobal pred8x8l_down_right_mmxext, 4,5
+INIT_MMX mmxext
+cglobal pred8x8l_down_right_8, 4,5
sub r0, r3
lea r4, [r0+r3*2]
movq mm0, [r0+r3*1-8]
@@ -1642,7 +1569,7 @@ cglobal pred8x8l_down_right_mmxext, 4,5
psllq mm5, 56
pxor mm1, mm5
jmp .do_top
-.body
+.body:
lea r1, [r0+r3*2]
movq mm1, mm7
movq mm7, mm5
@@ -1700,8 +1627,8 @@ cglobal pred8x8l_down_right_mmxext, 4,5
movq [r0+r3*1], mm0
RET
-%macro PRED8x8L_DOWN_RIGHT 1
-cglobal pred8x8l_down_right_%1, 4,5
+%macro PRED8x8L_DOWN_RIGHT 0
+cglobal pred8x8l_down_right_8, 4,5
sub r0, r3
lea r4, [r0+r3*2]
movq mm0, [r0+r3*1-8]
@@ -1789,7 +1716,7 @@ cglobal pred8x8l_down_right_%1, 4,5
lea r0, [r2+r3*2]
movdqa xmm2, xmm3
psrldq xmm2, 1
-INIT_XMM
+INIT_XMM cpuname
PRED4x4_LOWPASS xmm0, xmm1, xmm2, xmm3, xmm4
movdqa xmm1, xmm0
psrldq xmm1, 1
@@ -1810,20 +1737,17 @@ INIT_XMM
RET
%endmacro
-INIT_MMX
-%define PALIGNR PALIGNR_MMX
-PRED8x8L_DOWN_RIGHT sse2
-INIT_MMX
-%define PALIGNR PALIGNR_SSSE3
-PRED8x8L_DOWN_RIGHT ssse3
+INIT_MMX sse2
+PRED8x8L_DOWN_RIGHT
+INIT_MMX ssse3
+PRED8x8L_DOWN_RIGHT
;-----------------------------------------------------------------------------
-; void pred8x8l_vertical_right(uint8_t *src, int has_topleft, int has_topright, int stride)
+; void pred8x8l_vertical_right_8(uint8_t *src, int has_topleft, int has_topright, int stride)
;-----------------------------------------------------------------------------
-INIT_MMX
-%define PALIGNR PALIGNR_MMX
-cglobal pred8x8l_vertical_right_mmxext, 4,5
+INIT_MMX mmxext
+cglobal pred8x8l_vertical_right_8, 4,5
sub r0, r3
lea r4, [r0+r3*2]
movq mm0, [r0+r3*1-8]
@@ -1888,7 +1812,7 @@ cglobal pred8x8l_vertical_right_mmxext, 4,5
jz .fix_lt_2
test r2, r2
jz .fix_tr_1
-.do_top
+.do_top:
PRED4x4_LOWPASS mm6, mm2, mm1, mm3, mm5
lea r1, [r0+r3*2]
movq mm2, mm6
@@ -1929,8 +1853,11 @@ cglobal pred8x8l_vertical_right_mmxext, 4,5
movq [r4+r3*2], mm5
RET
-%macro PRED8x8L_VERTICAL_RIGHT 1
-cglobal pred8x8l_vertical_right_%1, 4,5,7
+%macro PRED8x8L_VERTICAL_RIGHT 0
+cglobal pred8x8l_vertical_right_8, 4,5,7
+ ; manually spill XMM registers for Win64 because
+ ; the code here is initialized with INIT_MMX
+ WIN64_SPILL_XMM 7
sub r0, r3
lea r4, [r0+r3*2]
movq mm0, [r0+r3*1-8]
@@ -1994,7 +1921,7 @@ cglobal pred8x8l_vertical_right_%1, 4,5,7
jz .fix_lt_2
test r2, r2
jz .fix_tr_1
-.do_top
+.do_top:
PRED4x4_LOWPASS mm6, mm2, mm1, mm3, mm5
lea r1, [r0+r3*2]
movq2dq xmm4, mm6
@@ -2008,7 +1935,7 @@ cglobal pred8x8l_vertical_right_%1, 4,5,7
pslldq xmm0, 1
pslldq xmm1, 2
pavgb xmm2, xmm0
-INIT_XMM
+INIT_XMM cpuname
PRED4x4_LOWPASS xmm4, xmm3, xmm1, xmm0, xmm5
pandn xmm6, xmm4
movdqa xmm5, xmm4
@@ -2037,19 +1964,17 @@ INIT_XMM
RET
%endmacro
-INIT_MMX
-%define PALIGNR PALIGNR_MMX
-PRED8x8L_VERTICAL_RIGHT sse2
-INIT_MMX
-%define PALIGNR PALIGNR_SSSE3
-PRED8x8L_VERTICAL_RIGHT ssse3
+INIT_MMX sse2
+PRED8x8L_VERTICAL_RIGHT
+INIT_MMX ssse3
+PRED8x8L_VERTICAL_RIGHT
;-----------------------------------------------------------------------------
-;void pred8x8l_vertical_left(uint8_t *src, int has_topleft, int has_topright, int stride)
+;void pred8x8l_vertical_left_8(uint8_t *src, int has_topleft, int has_topright, int stride)
;-----------------------------------------------------------------------------
-%macro PRED8x8L_VERTICAL_LEFT 1
-cglobal pred8x8l_vertical_left_%1, 4,4
+%macro PRED8x8L_VERTICAL_LEFT 0
+cglobal pred8x8l_vertical_left_8, 4,4
sub r0, r3
movq mm0, [r0-8]
movq mm3, [r0]
@@ -2107,7 +2032,7 @@ cglobal pred8x8l_vertical_left_%1, 4,4
pslldq xmm1, 1
pavgb xmm3, xmm2
lea r2, [r1+r3*2]
-INIT_XMM
+INIT_XMM cpuname
PRED4x4_LOWPASS xmm0, xmm1, xmm2, xmm4, xmm5
psrldq xmm0, 1
movq [r0+r3*1], xmm3
@@ -2128,19 +2053,17 @@ INIT_XMM
RET
%endmacro
-INIT_MMX
-%define PALIGNR PALIGNR_MMX
-PRED8x8L_VERTICAL_LEFT sse2
-%define PALIGNR PALIGNR_SSSE3
-INIT_MMX
-PRED8x8L_VERTICAL_LEFT ssse3
+INIT_MMX sse2
+PRED8x8L_VERTICAL_LEFT
+INIT_MMX ssse3
+PRED8x8L_VERTICAL_LEFT
;-----------------------------------------------------------------------------
-; void pred8x8l_horizontal_up(uint8_t *src, int has_topleft, int has_topright, int stride)
+; void pred8x8l_horizontal_up_8(uint8_t *src, int has_topleft, int has_topright, int stride)
;-----------------------------------------------------------------------------
-%macro PRED8x8L_HORIZONTAL_UP 1
-cglobal pred8x8l_horizontal_up_%1, 4,4
+%macro PRED8x8L_HORIZONTAL_UP 0
+cglobal pred8x8l_horizontal_up_8, 4,4
sub r0, r3
lea r2, [r0+r3*2]
movq mm0, [r0+r3*1-8]
@@ -2217,19 +2140,17 @@ cglobal pred8x8l_horizontal_up_%1, 4,4
RET
%endmacro
-INIT_MMX
-%define PALIGNR PALIGNR_MMX
-PRED8x8L_HORIZONTAL_UP mmxext
-%define PALIGNR PALIGNR_SSSE3
-PRED8x8L_HORIZONTAL_UP ssse3
+INIT_MMX mmxext
+PRED8x8L_HORIZONTAL_UP
+INIT_MMX ssse3
+PRED8x8L_HORIZONTAL_UP
;-----------------------------------------------------------------------------
-;void pred8x8l_horizontal_down(uint8_t *src, int has_topleft, int has_topright, int stride)
+;void pred8x8l_horizontal_down_8(uint8_t *src, int has_topleft, int has_topright, int stride)
;-----------------------------------------------------------------------------
-INIT_MMX
-%define PALIGNR PALIGNR_MMX
-cglobal pred8x8l_horizontal_down_mmxext, 4,5
+INIT_MMX mmxext
+cglobal pred8x8l_horizontal_down_8, 4,5
sub r0, r3
lea r4, [r0+r3*2]
movq mm0, [r0+r3*1-8]
@@ -2343,8 +2264,8 @@ cglobal pred8x8l_horizontal_down_mmxext, 4,5
movq [r0+r3*1], mm3
RET
-%macro PRED8x8L_HORIZONTAL_DOWN 1
-cglobal pred8x8l_horizontal_down_%1, 4,5
+%macro PRED8x8L_HORIZONTAL_DOWN 0
+cglobal pred8x8l_horizontal_down_8, 4,5
sub r0, r3
lea r4, [r0+r3*2]
movq mm0, [r0+r3*1-8]
@@ -2436,7 +2357,7 @@ cglobal pred8x8l_horizontal_down_%1, 4,5
movq2dq xmm5, mm1
pslldq xmm5, 8
por xmm1, xmm5
-INIT_XMM
+INIT_XMM cpuname
lea r2, [r4+r3*2]
movdqa xmm2, xmm1
movdqa xmm3, xmm1
@@ -2467,18 +2388,17 @@ INIT_XMM
RET
%endmacro
-INIT_MMX
-%define PALIGNR PALIGNR_MMX
-PRED8x8L_HORIZONTAL_DOWN sse2
-INIT_MMX
-%define PALIGNR PALIGNR_SSSE3
-PRED8x8L_HORIZONTAL_DOWN ssse3
+INIT_MMX sse2
+PRED8x8L_HORIZONTAL_DOWN
+INIT_MMX ssse3
+PRED8x8L_HORIZONTAL_DOWN
;-----------------------------------------------------------------------------
-; void pred4x4_dc_mmxext(uint8_t *src, const uint8_t *topright, int stride)
+; void pred4x4_dc_8_mmxext(uint8_t *src, const uint8_t *topright, int stride)
;-----------------------------------------------------------------------------
-cglobal pred4x4_dc_mmxext, 3,5
+INIT_MMX mmxext
+cglobal pred4x4_dc_8, 3,5
pxor mm7, mm7
mov r4, r0
sub r0, r2
@@ -2504,11 +2424,11 @@ cglobal pred4x4_dc_mmxext, 3,5
RET
;-----------------------------------------------------------------------------
-; void pred4x4_tm_vp8_mmxext(uint8_t *src, const uint8_t *topright, int stride)
+; void pred4x4_tm_vp8_8_mmxext(uint8_t *src, const uint8_t *topright, int stride)
;-----------------------------------------------------------------------------
-%macro PRED4x4_TM_MMX 1
-cglobal pred4x4_tm_vp8_%1, 3,6
+%macro PRED4x4_TM 0
+cglobal pred4x4_tm_vp8_8, 3,6
sub r0, r2
pxor mm7, mm7
movd mm0, [r0]
@@ -2522,14 +2442,14 @@ cglobal pred4x4_tm_vp8_%1, 3,6
sub r3d, r4d
movd mm2, r1d
movd mm4, r3d
-%ifidn %1, mmx
+%if cpuflag(mmxext)
+ pshufw mm2, mm2, 0
+ pshufw mm4, mm4, 0
+%else
punpcklwd mm2, mm2
punpcklwd mm4, mm4
punpckldq mm2, mm2
punpckldq mm4, mm4
-%else
- pshufw mm2, mm2, 0
- pshufw mm4, mm4, 0
%endif
paddw mm2, mm0
paddw mm4, mm0
@@ -2543,10 +2463,13 @@ cglobal pred4x4_tm_vp8_%1, 3,6
REP_RET
%endmacro
-PRED4x4_TM_MMX mmx
-PRED4x4_TM_MMX mmxext
+INIT_MMX mmx
+PRED4x4_TM
+INIT_MMX mmxext
+PRED4x4_TM
-cglobal pred4x4_tm_vp8_ssse3, 3,3
+INIT_XMM ssse3
+cglobal pred4x4_tm_vp8_8, 3,3
sub r0, r2
movq mm6, [tm_shuf]
pxor mm1, mm1
@@ -2582,11 +2505,11 @@ cglobal pred4x4_tm_vp8_ssse3, 3,3
RET
;-----------------------------------------------------------------------------
-; void pred4x4_vertical_vp8_mmxext(uint8_t *src, const uint8_t *topright, int stride)
+; void pred4x4_vertical_vp8_8_mmxext(uint8_t *src, const uint8_t *topright, int stride)
;-----------------------------------------------------------------------------
-INIT_MMX
-cglobal pred4x4_vertical_vp8_mmxext, 3,3
+INIT_MMX mmxext
+cglobal pred4x4_vertical_vp8_8, 3,3
sub r0, r2
movd m1, [r0-1]
movd m0, [r0]
@@ -2602,10 +2525,10 @@ cglobal pred4x4_vertical_vp8_mmxext, 3,3
RET
;-----------------------------------------------------------------------------
-; void pred4x4_down_left_mmxext(uint8_t *src, const uint8_t *topright, int stride)
+; void pred4x4_down_left_8_mmxext(uint8_t *src, const uint8_t *topright, int stride)
;-----------------------------------------------------------------------------
-INIT_MMX
-cglobal pred4x4_down_left_mmxext, 3,3
+INIT_MMX mmxext
+cglobal pred4x4_down_left_8, 3,3
sub r0, r2
movq m1, [r0]
punpckldq m1, [r1]
@@ -2628,11 +2551,11 @@ cglobal pred4x4_down_left_mmxext, 3,3
RET
;-----------------------------------------------------------------------------
-; void pred4x4_vertical_left_mmxext(uint8_t *src, const uint8_t *topright, int stride)
+; void pred4x4_vertical_left_8_mmxext(uint8_t *src, const uint8_t *topright, int stride)
;-----------------------------------------------------------------------------
-INIT_MMX
-cglobal pred4x4_vertical_left_mmxext, 3,3
+INIT_MMX mmxext
+cglobal pred4x4_vertical_left_8, 3,3
sub r0, r2
movq m1, [r0]
punpckldq m1, [r1]
@@ -2653,11 +2576,11 @@ cglobal pred4x4_vertical_left_mmxext, 3,3
RET
;-----------------------------------------------------------------------------
-; void pred4x4_horizontal_up_mmxext(uint8_t *src, const uint8_t *topright, int stride)
+; void pred4x4_horizontal_up_8_mmxext(uint8_t *src, const uint8_t *topright, int stride)
;-----------------------------------------------------------------------------
-INIT_MMX
-cglobal pred4x4_horizontal_up_mmxext, 3,3
+INIT_MMX mmxext
+cglobal pred4x4_horizontal_up_8, 3,3
sub r0, r2
lea r1, [r0+r2*2]
movd m0, [r0+r2*1-4]
@@ -2686,12 +2609,11 @@ cglobal pred4x4_horizontal_up_mmxext, 3,3
RET
;-----------------------------------------------------------------------------
-; void pred4x4_horizontal_down_mmxext(uint8_t *src, const uint8_t *topright, int stride)
+; void pred4x4_horizontal_down_8_mmxext(uint8_t *src, const uint8_t *topright, int stride)
;-----------------------------------------------------------------------------
-INIT_MMX
-%define PALIGNR PALIGNR_MMX
-cglobal pred4x4_horizontal_down_mmxext, 3,3
+INIT_MMX mmxext
+cglobal pred4x4_horizontal_down_8, 3,3
sub r0, r2
lea r1, [r0+r2*2]
movh m0, [r0-4] ; lt ..
@@ -2722,12 +2644,11 @@ cglobal pred4x4_horizontal_down_mmxext, 3,3
RET
;-----------------------------------------------------------------------------
-; void pred4x4_vertical_right_mmxext(uint8_t *src, const uint8_t *topright, int stride)
+; void pred4x4_vertical_right_8_mmxext(uint8_t *src, const uint8_t *topright, int stride)
;-----------------------------------------------------------------------------
-INIT_MMX
-%define PALIGNR PALIGNR_MMX
-cglobal pred4x4_vertical_right_mmxext, 3,3
+INIT_MMX mmxext
+cglobal pred4x4_vertical_right_8, 3,3
sub r0, r2
lea r1, [r0+r2*2]
movh m0, [r0] ; ........t3t2t1t0
@@ -2753,12 +2674,11 @@ cglobal pred4x4_vertical_right_mmxext, 3,3
RET
;-----------------------------------------------------------------------------
-; void pred4x4_down_right_mmxext(uint8_t *src, const uint8_t *topright, int stride)
+; void pred4x4_down_right_8_mmxext(uint8_t *src, const uint8_t *topright, int stride)
;-----------------------------------------------------------------------------
-INIT_MMX
-%define PALIGNR PALIGNR_MMX
-cglobal pred4x4_down_right_mmxext, 3,3
+INIT_MMX mmxext
+cglobal pred4x4_down_right_8, 3,3
sub r0, r2
lea r1, [r0+r2*2]
movq m1, [r1-8]
diff --git a/gst-libs/ext/libav/libavcodec/x86/h264_intrapred_10bit.asm b/gst-libs/ext/libav/libavcodec/x86/h264_intrapred_10bit.asm
index e14e31a..1b7974b 100644
--- a/gst-libs/ext/libav/libavcodec/x86/h264_intrapred_10bit.asm
+++ b/gst-libs/ext/libav/libavcodec/x86/h264_intrapred_10bit.asm
@@ -22,8 +22,7 @@
;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
;******************************************************************************
-%include "x86inc.asm"
-%include "x86util.asm"
+%include "libavutil/x86/x86util.asm"
SECTION_RODATA
@@ -53,8 +52,8 @@ SECTION .text
;-----------------------------------------------------------------------------
; void pred4x4_down_right(pixel *src, const pixel *topright, int stride)
;-----------------------------------------------------------------------------
-%macro PRED4x4_DR 1
-cglobal pred4x4_down_right_10_%1, 3,3
+%macro PRED4x4_DR 0
+cglobal pred4x4_down_right_10, 3, 3
sub r0, r2
lea r1, [r0+r2*2]
movhps m1, [r1-8]
@@ -79,21 +78,18 @@ cglobal pred4x4_down_right_10_%1, 3,3
RET
%endmacro
-INIT_XMM
-%define PALIGNR PALIGNR_MMX
-PRED4x4_DR sse2
-%define PALIGNR PALIGNR_SSSE3
-PRED4x4_DR ssse3
-%ifdef HAVE_AVX
-INIT_AVX
-PRED4x4_DR avx
-%endif
+INIT_XMM sse2
+PRED4x4_DR
+INIT_XMM ssse3
+PRED4x4_DR
+INIT_XMM avx
+PRED4x4_DR
;-----------------------------------------------------------------------------
; void pred4x4_vertical_right(pixel *src, const pixel *topright, int stride)
;-----------------------------------------------------------------------------
-%macro PRED4x4_VR 1
-cglobal pred4x4_vertical_right_10_%1, 3,3,6
+%macro PRED4x4_VR 0
+cglobal pred4x4_vertical_right_10, 3, 3, 6
sub r0, r2
lea r1, [r0+r2*2]
movq m5, [r0] ; ........t3t2t1t0
@@ -119,21 +115,18 @@ cglobal pred4x4_vertical_right_10_%1, 3,3,6
RET
%endmacro
-INIT_XMM
-%define PALIGNR PALIGNR_MMX
-PRED4x4_VR sse2
-%define PALIGNR PALIGNR_SSSE3
-PRED4x4_VR ssse3
-%ifdef HAVE_AVX
-INIT_AVX
-PRED4x4_VR avx
-%endif
+INIT_XMM sse2
+PRED4x4_VR
+INIT_XMM ssse3
+PRED4x4_VR
+INIT_XMM avx
+PRED4x4_VR
;-----------------------------------------------------------------------------
; void pred4x4_horizontal_down(pixel *src, const pixel *topright, int stride)
;-----------------------------------------------------------------------------
-%macro PRED4x4_HD 1
-cglobal pred4x4_horizontal_down_10_%1, 3,3
+%macro PRED4x4_HD 0
+cglobal pred4x4_horizontal_down_10, 3, 3
sub r0, r2
lea r1, [r0+r2*2]
movq m0, [r0-8] ; lt ..
@@ -162,15 +155,12 @@ cglobal pred4x4_horizontal_down_10_%1, 3,3
RET
%endmacro
-INIT_XMM
-%define PALIGNR PALIGNR_MMX
-PRED4x4_HD sse2
-%define PALIGNR PALIGNR_SSSE3
-PRED4x4_HD ssse3
-%ifdef HAVE_AVX
-INIT_AVX
-PRED4x4_HD avx
-%endif
+INIT_XMM sse2
+PRED4x4_HD
+INIT_XMM ssse3
+PRED4x4_HD
+INIT_XMM avx
+PRED4x4_HD
;-----------------------------------------------------------------------------
; void pred4x4_dc(pixel *src, const pixel *topright, int stride)
@@ -192,8 +182,8 @@ PRED4x4_HD avx
HADDD %1, %2
%endmacro
-INIT_MMX
-cglobal pred4x4_dc_10_mmxext, 3,3
+INIT_MMX mmxext
+cglobal pred4x4_dc_10, 3, 3
sub r0, r2
lea r1, [r0+r2*2]
movq m2, [r0+r2*1-8]
@@ -216,8 +206,8 @@ cglobal pred4x4_dc_10_mmxext, 3,3
;-----------------------------------------------------------------------------
; void pred4x4_down_left(pixel *src, const pixel *topright, int stride)
;-----------------------------------------------------------------------------
-%macro PRED4x4_DL 1
-cglobal pred4x4_down_left_10_%1, 3,3
+%macro PRED4x4_DL 0
+cglobal pred4x4_down_left_10, 3, 3
sub r0, r2
movq m0, [r0]
movhps m0, [r1]
@@ -236,18 +226,16 @@ cglobal pred4x4_down_left_10_%1, 3,3
RET
%endmacro
-INIT_XMM
-PRED4x4_DL sse2
-%ifdef HAVE_AVX
-INIT_AVX
-PRED4x4_DL avx
-%endif
+INIT_XMM sse2
+PRED4x4_DL
+INIT_XMM avx
+PRED4x4_DL
;-----------------------------------------------------------------------------
; void pred4x4_vertical_left(pixel *src, const pixel *topright, int stride)
;-----------------------------------------------------------------------------
-%macro PRED4x4_VL 1
-cglobal pred4x4_vertical_left_10_%1, 3,3
+%macro PRED4x4_VL 0
+cglobal pred4x4_vertical_left_10, 3, 3
sub r0, r2
movu m1, [r0]
movhps m1, [r1]
@@ -265,18 +253,16 @@ cglobal pred4x4_vertical_left_10_%1, 3,3
RET
%endmacro
-INIT_XMM
-PRED4x4_VL sse2
-%ifdef HAVE_AVX
-INIT_AVX
-PRED4x4_VL avx
-%endif
+INIT_XMM sse2
+PRED4x4_VL
+INIT_XMM avx
+PRED4x4_VL
;-----------------------------------------------------------------------------
; void pred4x4_horizontal_up(pixel *src, const pixel *topright, int stride)
;-----------------------------------------------------------------------------
-INIT_MMX
-cglobal pred4x4_horizontal_up_10_mmxext, 3,3
+INIT_MMX mmxext
+cglobal pred4x4_horizontal_up_10, 3, 3
sub r0, r2
lea r1, [r0+r2*2]
movq m0, [r0+r2*1-8]
@@ -309,8 +295,8 @@ cglobal pred4x4_horizontal_up_10_mmxext, 3,3
;-----------------------------------------------------------------------------
; void pred8x8_vertical(pixel *src, int stride)
;-----------------------------------------------------------------------------
-INIT_XMM
-cglobal pred8x8_vertical_10_sse2, 2,2
+INIT_XMM sse2
+cglobal pred8x8_vertical_10, 2, 2
sub r0, r1
mova m0, [r0]
%rep 3
@@ -325,8 +311,8 @@ cglobal pred8x8_vertical_10_sse2, 2,2
;-----------------------------------------------------------------------------
; void pred8x8_horizontal(pixel *src, int stride)
;-----------------------------------------------------------------------------
-INIT_XMM
-cglobal pred8x8_horizontal_10_sse2, 2,3
+INIT_XMM sse2
+cglobal pred8x8_horizontal_10, 2, 3
mov r2d, 4
.loop:
movq m0, [r0+r1*0-8]
@@ -355,8 +341,8 @@ cglobal pred8x8_horizontal_10_sse2, 2,3
%endif
%endmacro
-%macro PRED8x8_DC 2
-cglobal pred8x8_dc_10_%1, 2,6
+%macro PRED8x8_DC 1
+cglobal pred8x8_dc_10, 2, 6
sub r0, r1
pxor m4, m4
movq m0, [r0+0]
@@ -372,7 +358,7 @@ cglobal pred8x8_dc_10_%1, 2,6
paddw m1, m3
punpcklwd m0, m1
%endif
- %2 m2, m0, 00001110b
+ %1 m2, m0, 00001110b
paddw m0, m2
lea r5, [r1*3]
@@ -397,8 +383,8 @@ cglobal pred8x8_dc_10_%1, 2,6
punpcklwd m2, m3
punpckldq m0, m2 ; s0, s1, s2, s3
- %2 m3, m0, 11110110b ; s2, s1, s3, s3
- %2 m0, m0, 01110100b ; s0, s1, s3, s1
+ %1 m3, m0, 11110110b ; s2, s1, s3, s3
+ %1 m0, m0, 01110100b ; s0, s1, s3, s1
paddw m0, m3
psrlw m0, 2
pavgw m0, m4 ; s0+s2, s1, s3, s1+s3
@@ -424,16 +410,16 @@ cglobal pred8x8_dc_10_%1, 2,6
RET
%endmacro
-INIT_MMX
-PRED8x8_DC mmxext, pshufw
-INIT_XMM
-PRED8x8_DC sse2 , pshuflw
+INIT_MMX mmxext
+PRED8x8_DC pshufw
+INIT_XMM sse2
+PRED8x8_DC pshuflw
;-----------------------------------------------------------------------------
; void pred8x8_top_dc(pixel *src, int stride)
;-----------------------------------------------------------------------------
-INIT_XMM
-cglobal pred8x8_top_dc_10_sse2, 2,4
+INIT_XMM sse2
+cglobal pred8x8_top_dc_10, 2, 4
sub r0, r1
mova m0, [r0]
pshuflw m1, m0, 0x4e
@@ -459,8 +445,8 @@ cglobal pred8x8_top_dc_10_sse2, 2,4
;-----------------------------------------------------------------------------
; void pred8x8_plane(pixel *src, int stride)
;-----------------------------------------------------------------------------
-INIT_XMM
-cglobal pred8x8_plane_10_sse2, 2,7,7
+INIT_XMM sse2
+cglobal pred8x8_plane_10, 2, 7, 7
sub r0, r1
lea r2, [r1*3]
lea r3, [r0+r1*4]
@@ -522,8 +508,8 @@ cglobal pred8x8_plane_10_sse2, 2,7,7
;-----------------------------------------------------------------------------
; void pred8x8l_128_dc(pixel *src, int has_topleft, int has_topright, int stride)
;-----------------------------------------------------------------------------
-%macro PRED8x8L_128_DC 1
-cglobal pred8x8l_128_dc_10_%1, 4,4
+%macro PRED8x8L_128_DC 0
+cglobal pred8x8l_128_dc_10, 4, 4
mova m0, [pw_512] ; (1<<(BIT_DEPTH-1))
lea r1, [r3*3]
lea r2, [r0+r3*4]
@@ -538,16 +524,16 @@ cglobal pred8x8l_128_dc_10_%1, 4,4
RET
%endmacro
-INIT_MMX
-PRED8x8L_128_DC mmxext
-INIT_XMM
-PRED8x8L_128_DC sse2
+INIT_MMX mmxext
+PRED8x8L_128_DC
+INIT_XMM sse2
+PRED8x8L_128_DC
;-----------------------------------------------------------------------------
; void pred8x8l_top_dc(pixel *src, int has_topleft, int has_topright, int stride)
;-----------------------------------------------------------------------------
-%macro PRED8x8L_TOP_DC 1
-cglobal pred8x8l_top_dc_10_%1, 4,4,6
+%macro PRED8x8L_TOP_DC 0
+cglobal pred8x8l_top_dc_10, 4, 4, 6
sub r0, r3
mova m0, [r0]
shr r1d, 14
@@ -575,19 +561,17 @@ cglobal pred8x8l_top_dc_10_%1, 4,4,6
RET
%endmacro
-INIT_XMM
-PRED8x8L_TOP_DC sse2
-%ifdef HAVE_AVX
-INIT_AVX
-PRED8x8L_TOP_DC avx
-%endif
+INIT_XMM sse2
+PRED8x8L_TOP_DC
+INIT_XMM avx
+PRED8x8L_TOP_DC
;-----------------------------------------------------------------------------
;void pred8x8l_dc(pixel *src, int has_topleft, int has_topright, int stride)
;-----------------------------------------------------------------------------
;TODO: see if scalar is faster
-%macro PRED8x8L_DC 1
-cglobal pred8x8l_dc_10_%1, 4,6,6
+%macro PRED8x8L_DC 0
+cglobal pred8x8l_dc_10, 4, 6, 6
sub r0, r3
lea r4, [r0+r3*4]
lea r5, [r3*3]
@@ -634,18 +618,16 @@ cglobal pred8x8l_dc_10_%1, 4,6,6
RET
%endmacro
-INIT_XMM
-PRED8x8L_DC sse2
-%ifdef HAVE_AVX
-INIT_AVX
-PRED8x8L_DC avx
-%endif
+INIT_XMM sse2
+PRED8x8L_DC
+INIT_XMM avx
+PRED8x8L_DC
;-----------------------------------------------------------------------------
; void pred8x8l_vertical(pixel *src, int has_topleft, int has_topright, int stride)
;-----------------------------------------------------------------------------
-%macro PRED8x8L_VERTICAL 1
-cglobal pred8x8l_vertical_10_%1, 4,4,6
+%macro PRED8x8L_VERTICAL 0
+cglobal pred8x8l_vertical_10, 4, 4, 6
sub r0, r3
mova m0, [r0]
shr r1d, 14
@@ -669,18 +651,16 @@ cglobal pred8x8l_vertical_10_%1, 4,4,6
RET
%endmacro
-INIT_XMM
-PRED8x8L_VERTICAL sse2
-%ifdef HAVE_AVX
-INIT_AVX
-PRED8x8L_VERTICAL avx
-%endif
+INIT_XMM sse2
+PRED8x8L_VERTICAL
+INIT_XMM avx
+PRED8x8L_VERTICAL
;-----------------------------------------------------------------------------
; void pred8x8l_horizontal(uint8_t *src, int has_topleft, int has_topright, int stride)
;-----------------------------------------------------------------------------
-%macro PRED8x8L_HORIZONTAL 1
-cglobal pred8x8l_horizontal_10_%1, 4,4,5
+%macro PRED8x8L_HORIZONTAL 0
+cglobal pred8x8l_horizontal_10, 4, 4, 5
mova m0, [r0-16]
shr r1d, 14
dec r1
@@ -723,21 +703,18 @@ cglobal pred8x8l_horizontal_10_%1, 4,4,5
RET
%endmacro
-INIT_XMM
-%define PALIGNR PALIGNR_MMX
-PRED8x8L_HORIZONTAL sse2
-%define PALIGNR PALIGNR_SSSE3
-PRED8x8L_HORIZONTAL ssse3
-%ifdef HAVE_AVX
-INIT_AVX
-PRED8x8L_HORIZONTAL avx
-%endif
+INIT_XMM sse2
+PRED8x8L_HORIZONTAL
+INIT_XMM ssse3
+PRED8x8L_HORIZONTAL
+INIT_XMM avx
+PRED8x8L_HORIZONTAL
;-----------------------------------------------------------------------------
;void pred8x8l_down_left(pixel *src, int has_topleft, int has_topright, int stride)
;-----------------------------------------------------------------------------
-%macro PRED8x8L_DOWN_LEFT 1
-cglobal pred8x8l_down_left_10_%1, 4,4,7
+%macro PRED8x8L_DOWN_LEFT 0
+cglobal pred8x8l_down_left_10, 4, 4, 7
sub r0, r3
mova m3, [r0]
shr r1d, 14
@@ -792,23 +769,20 @@ cglobal pred8x8l_down_left_10_%1, 4,4,7
jmp .do_topright
%endmacro
-INIT_XMM
-%define PALIGNR PALIGNR_MMX
-PRED8x8L_DOWN_LEFT sse2
-%define PALIGNR PALIGNR_SSSE3
-PRED8x8L_DOWN_LEFT ssse3
-%ifdef HAVE_AVX
-INIT_AVX
-PRED8x8L_DOWN_LEFT avx
-%endif
+INIT_XMM sse2
+PRED8x8L_DOWN_LEFT
+INIT_XMM ssse3
+PRED8x8L_DOWN_LEFT
+INIT_XMM avx
+PRED8x8L_DOWN_LEFT
;-----------------------------------------------------------------------------
;void pred8x8l_down_right(pixel *src, int has_topleft, int has_topright, int stride)
;-----------------------------------------------------------------------------
-%macro PRED8x8L_DOWN_RIGHT 1
+%macro PRED8x8L_DOWN_RIGHT 0
; standard forbids this when has_topleft is false
; no need to check
-cglobal pred8x8l_down_right_10_%1, 4,5,8
+cglobal pred8x8l_down_right_10, 4, 5, 8
sub r0, r3
lea r4, [r0+r3*4]
lea r1, [r3*3]
@@ -867,22 +841,19 @@ cglobal pred8x8l_down_right_10_%1, 4,5,8
RET
%endmacro
-INIT_XMM
-%define PALIGNR PALIGNR_MMX
-PRED8x8L_DOWN_RIGHT sse2
-%define PALIGNR PALIGNR_SSSE3
-PRED8x8L_DOWN_RIGHT ssse3
-%ifdef HAVE_AVX
-INIT_AVX
-PRED8x8L_DOWN_RIGHT avx
-%endif
+INIT_XMM sse2
+PRED8x8L_DOWN_RIGHT
+INIT_XMM ssse3
+PRED8x8L_DOWN_RIGHT
+INIT_XMM avx
+PRED8x8L_DOWN_RIGHT
;-----------------------------------------------------------------------------
; void pred8x8l_vertical_right(pixel *src, int has_topleft, int has_topright, int stride)
;-----------------------------------------------------------------------------
-%macro PRED8x8L_VERTICAL_RIGHT 1
+%macro PRED8x8L_VERTICAL_RIGHT 0
; likewise with 8x8l_down_right
-cglobal pred8x8l_vertical_right_10_%1, 4,5,7
+cglobal pred8x8l_vertical_right_10, 4, 5, 7
sub r0, r3
lea r4, [r0+r3*4]
lea r1, [r3*3]
@@ -938,21 +909,18 @@ cglobal pred8x8l_vertical_right_10_%1, 4,5,7
RET
%endmacro
-INIT_XMM
-%define PALIGNR PALIGNR_MMX
-PRED8x8L_VERTICAL_RIGHT sse2
-%define PALIGNR PALIGNR_SSSE3
-PRED8x8L_VERTICAL_RIGHT ssse3
-%ifdef HAVE_AVX
-INIT_AVX
-PRED8x8L_VERTICAL_RIGHT avx
-%endif
+INIT_XMM sse2
+PRED8x8L_VERTICAL_RIGHT
+INIT_XMM ssse3
+PRED8x8L_VERTICAL_RIGHT
+INIT_XMM avx
+PRED8x8L_VERTICAL_RIGHT
;-----------------------------------------------------------------------------
; void pred8x8l_horizontal_up(pixel *src, int has_topleft, int has_topright, int stride)
;-----------------------------------------------------------------------------
-%macro PRED8x8L_HORIZONTAL_UP 1
-cglobal pred8x8l_horizontal_up_10_%1, 4,4,6
+%macro PRED8x8L_HORIZONTAL_UP 0
+cglobal pred8x8l_horizontal_up_10, 4, 4, 6
mova m0, [r0+r3*0-16]
punpckhwd m0, [r0+r3*1-16]
shr r1d, 14
@@ -1000,15 +968,12 @@ cglobal pred8x8l_horizontal_up_10_%1, 4,4,6
RET
%endmacro
-INIT_XMM
-%define PALIGNR PALIGNR_MMX
-PRED8x8L_HORIZONTAL_UP sse2
-%define PALIGNR PALIGNR_SSSE3
-PRED8x8L_HORIZONTAL_UP ssse3
-%ifdef HAVE_AVX
-INIT_AVX
-PRED8x8L_HORIZONTAL_UP avx
-%endif
+INIT_XMM sse2
+PRED8x8L_HORIZONTAL_UP
+INIT_XMM ssse3
+PRED8x8L_HORIZONTAL_UP
+INIT_XMM avx
+PRED8x8L_HORIZONTAL_UP
;-----------------------------------------------------------------------------
@@ -1023,8 +988,8 @@ PRED8x8L_HORIZONTAL_UP avx
%endif
%endmacro
-%macro PRED16x16_VERTICAL 1
-cglobal pred16x16_vertical_10_%1, 2,3
+%macro PRED16x16_VERTICAL 0
+cglobal pred16x16_vertical_10, 2, 3
sub r0, r1
mov r2d, 8
mova m0, [r0+ 0]
@@ -1042,16 +1007,16 @@ cglobal pred16x16_vertical_10_%1, 2,3
REP_RET
%endmacro
-INIT_MMX
-PRED16x16_VERTICAL mmxext
-INIT_XMM
-PRED16x16_VERTICAL sse2
+INIT_MMX mmxext
+PRED16x16_VERTICAL
+INIT_XMM sse2
+PRED16x16_VERTICAL
;-----------------------------------------------------------------------------
; void pred16x16_horizontal(pixel *src, int stride)
;-----------------------------------------------------------------------------
-%macro PRED16x16_HORIZONTAL 1
-cglobal pred16x16_horizontal_10_%1, 2,3
+%macro PRED16x16_HORIZONTAL 0
+cglobal pred16x16_horizontal_10, 2, 3
mov r2d, 8
.vloop:
movd m0, [r0+r1*0-4]
@@ -1066,16 +1031,16 @@ cglobal pred16x16_horizontal_10_%1, 2,3
REP_RET
%endmacro
-INIT_MMX
-PRED16x16_HORIZONTAL mmxext
-INIT_XMM
-PRED16x16_HORIZONTAL sse2
+INIT_MMX mmxext
+PRED16x16_HORIZONTAL
+INIT_XMM sse2
+PRED16x16_HORIZONTAL
;-----------------------------------------------------------------------------
; void pred16x16_dc(pixel *src, int stride)
;-----------------------------------------------------------------------------
-%macro PRED16x16_DC 1
-cglobal pred16x16_dc_10_%1, 2,6
+%macro PRED16x16_DC 0
+cglobal pred16x16_dc_10, 2, 6
mov r5, r0
sub r0, r1
mova m0, [r0+0]
@@ -1112,16 +1077,16 @@ cglobal pred16x16_dc_10_%1, 2,6
REP_RET
%endmacro
-INIT_MMX
-PRED16x16_DC mmxext
-INIT_XMM
-PRED16x16_DC sse2
+INIT_MMX mmxext
+PRED16x16_DC
+INIT_XMM sse2
+PRED16x16_DC
;-----------------------------------------------------------------------------
; void pred16x16_top_dc(pixel *src, int stride)
;-----------------------------------------------------------------------------
-%macro PRED16x16_TOP_DC 1
-cglobal pred16x16_top_dc_10_%1, 2,3
+%macro PRED16x16_TOP_DC 0
+cglobal pred16x16_top_dc_10, 2, 3
sub r0, r1
mova m0, [r0+0]
paddw m0, [r0+mmsize]
@@ -1144,16 +1109,16 @@ cglobal pred16x16_top_dc_10_%1, 2,3
REP_RET
%endmacro
-INIT_MMX
-PRED16x16_TOP_DC mmxext
-INIT_XMM
-PRED16x16_TOP_DC sse2
+INIT_MMX mmxext
+PRED16x16_TOP_DC
+INIT_XMM sse2
+PRED16x16_TOP_DC
;-----------------------------------------------------------------------------
; void pred16x16_left_dc(pixel *src, int stride)
;-----------------------------------------------------------------------------
-%macro PRED16x16_LEFT_DC 1
-cglobal pred16x16_left_dc_10_%1, 2,6
+%macro PRED16x16_LEFT_DC 0
+cglobal pred16x16_left_dc_10, 2, 6
mov r5, r0
sub r0, 2
@@ -1181,16 +1146,16 @@ cglobal pred16x16_left_dc_10_%1, 2,6
REP_RET
%endmacro
-INIT_MMX
-PRED16x16_LEFT_DC mmxext
-INIT_XMM
-PRED16x16_LEFT_DC sse2
+INIT_MMX mmxext
+PRED16x16_LEFT_DC
+INIT_XMM sse2
+PRED16x16_LEFT_DC
;-----------------------------------------------------------------------------
; void pred16x16_128_dc(pixel *src, int stride)
;-----------------------------------------------------------------------------
-%macro PRED16x16_128_DC 1
-cglobal pred16x16_128_dc_10_%1, 2,3
+%macro PRED16x16_128_DC 0
+cglobal pred16x16_128_dc_10, 2,3
mova m0, [pw_512]
mov r2d, 8
.loop:
@@ -1202,7 +1167,7 @@ cglobal pred16x16_128_dc_10_%1, 2,3
REP_RET
%endmacro
-INIT_MMX
-PRED16x16_128_DC mmxext
-INIT_XMM
-PRED16x16_128_DC sse2
+INIT_MMX mmxext
+PRED16x16_128_DC
+INIT_XMM sse2
+PRED16x16_128_DC
diff --git a/gst-libs/ext/libav/libavcodec/x86/h264_intrapred_init.c b/gst-libs/ext/libav/libavcodec/x86/h264_intrapred_init.c
index 41e611e..454dd3f 100644
--- a/gst-libs/ext/libav/libavcodec/x86/h264_intrapred_init.c
+++ b/gst-libs/ext/libav/libavcodec/x86/h264_intrapred_init.c
@@ -19,10 +19,13 @@
*/
#include "libavutil/cpu.h"
+#include "libavutil/x86/cpu.h"
#include "libavcodec/h264pred.h"
#define PRED4x4(TYPE, DEPTH, OPT) \
-void ff_pred4x4_ ## TYPE ## _ ## DEPTH ## _ ## OPT (uint8_t *src, const uint8_t *topright, int stride);
+void ff_pred4x4_ ## TYPE ## _ ## DEPTH ## _ ## OPT (uint8_t *src, \
+ const uint8_t *topright, \
+ ptrdiff_t stride);
PRED4x4(dc, 10, mmxext)
PRED4x4(down_left, 10, sse2)
@@ -41,7 +44,8 @@ PRED4x4(horizontal_down, 10, ssse3)
PRED4x4(horizontal_down, 10, avx)
#define PRED8x8(TYPE, DEPTH, OPT) \
-void ff_pred8x8_ ## TYPE ## _ ## DEPTH ## _ ## OPT (uint8_t *src, int stride);
+void ff_pred8x8_ ## TYPE ## _ ## DEPTH ## _ ## OPT (uint8_t *src, \
+ ptrdiff_t stride);
PRED8x8(dc, 10, mmxext)
PRED8x8(dc, 10, sse2)
@@ -51,7 +55,10 @@ PRED8x8(vertical, 10, sse2)
PRED8x8(horizontal, 10, sse2)
#define PRED8x8L(TYPE, DEPTH, OPT)\
-void ff_pred8x8l_ ## TYPE ## _ ## DEPTH ## _ ## OPT (uint8_t *src, int has_topleft, int has_topright, int stride);
+void ff_pred8x8l_ ## TYPE ## _ ## DEPTH ## _ ## OPT (uint8_t *src, \
+ int has_topleft, \
+ int has_topright, \
+ ptrdiff_t stride);
PRED8x8L(dc, 10, sse2)
PRED8x8L(dc, 10, avx)
@@ -78,7 +85,8 @@ PRED8x8L(horizontal_up, 10, ssse3)
PRED8x8L(horizontal_up, 10, avx)
#define PRED16x16(TYPE, DEPTH, OPT)\
-void ff_pred16x16_ ## TYPE ## _ ## DEPTH ## _ ## OPT (uint8_t *src, int stride);
+void ff_pred16x16_ ## TYPE ## _ ## DEPTH ## _ ## OPT (uint8_t *src, \
+ ptrdiff_t stride);
PRED16x16(dc, 10, mmxext)
PRED16x16(dc, 10, sse2)
@@ -93,221 +101,225 @@ PRED16x16(vertical, 10, sse2)
PRED16x16(horizontal, 10, mmxext)
PRED16x16(horizontal, 10, sse2)
-void ff_pred16x16_vertical_mmx (uint8_t *src, int stride);
-void ff_pred16x16_vertical_sse (uint8_t *src, int stride);
-void ff_pred16x16_horizontal_mmx (uint8_t *src, int stride);
-void ff_pred16x16_horizontal_mmxext(uint8_t *src, int stride);
-void ff_pred16x16_horizontal_ssse3 (uint8_t *src, int stride);
-void ff_pred16x16_dc_mmxext (uint8_t *src, int stride);
-void ff_pred16x16_dc_sse2 (uint8_t *src, int stride);
-void ff_pred16x16_dc_ssse3 (uint8_t *src, int stride);
-void ff_pred16x16_plane_h264_mmx (uint8_t *src, int stride);
-void ff_pred16x16_plane_h264_mmx2 (uint8_t *src, int stride);
-void ff_pred16x16_plane_h264_sse2 (uint8_t *src, int stride);
-void ff_pred16x16_plane_h264_ssse3 (uint8_t *src, int stride);
-void ff_pred16x16_plane_rv40_mmx (uint8_t *src, int stride);
-void ff_pred16x16_plane_rv40_mmx2 (uint8_t *src, int stride);
-void ff_pred16x16_plane_rv40_sse2 (uint8_t *src, int stride);
-void ff_pred16x16_plane_rv40_ssse3 (uint8_t *src, int stride);
-void ff_pred16x16_plane_svq3_mmx (uint8_t *src, int stride);
-void ff_pred16x16_plane_svq3_mmx2 (uint8_t *src, int stride);
-void ff_pred16x16_plane_svq3_sse2 (uint8_t *src, int stride);
-void ff_pred16x16_plane_svq3_ssse3 (uint8_t *src, int stride);
-void ff_pred16x16_tm_vp8_mmx (uint8_t *src, int stride);
-void ff_pred16x16_tm_vp8_mmxext (uint8_t *src, int stride);
-void ff_pred16x16_tm_vp8_sse2 (uint8_t *src, int stride);
-void ff_pred8x8_top_dc_mmxext (uint8_t *src, int stride);
-void ff_pred8x8_dc_rv40_mmxext (uint8_t *src, int stride);
-void ff_pred8x8_dc_mmxext (uint8_t *src, int stride);
-void ff_pred8x8_vertical_mmx (uint8_t *src, int stride);
-void ff_pred8x8_horizontal_mmx (uint8_t *src, int stride);
-void ff_pred8x8_horizontal_mmxext (uint8_t *src, int stride);
-void ff_pred8x8_horizontal_ssse3 (uint8_t *src, int stride);
-void ff_pred8x8_plane_mmx (uint8_t *src, int stride);
-void ff_pred8x8_plane_mmx2 (uint8_t *src, int stride);
-void ff_pred8x8_plane_sse2 (uint8_t *src, int stride);
-void ff_pred8x8_plane_ssse3 (uint8_t *src, int stride);
-void ff_pred8x8_tm_vp8_mmx (uint8_t *src, int stride);
-void ff_pred8x8_tm_vp8_mmxext (uint8_t *src, int stride);
-void ff_pred8x8_tm_vp8_sse2 (uint8_t *src, int stride);
-void ff_pred8x8_tm_vp8_ssse3 (uint8_t *src, int stride);
-void ff_pred8x8l_top_dc_mmxext (uint8_t *src, int has_topleft, int has_topright, int stride);
-void ff_pred8x8l_top_dc_ssse3 (uint8_t *src, int has_topleft, int has_topright, int stride);
-void ff_pred8x8l_dc_mmxext (uint8_t *src, int has_topleft, int has_topright, int stride);
-void ff_pred8x8l_dc_ssse3 (uint8_t *src, int has_topleft, int has_topright, int stride);
-void ff_pred8x8l_horizontal_mmxext (uint8_t *src, int has_topleft, int has_topright, int stride);
-void ff_pred8x8l_horizontal_ssse3 (uint8_t *src, int has_topleft, int has_topright, int stride);
-void ff_pred8x8l_vertical_mmxext (uint8_t *src, int has_topleft, int has_topright, int stride);
-void ff_pred8x8l_vertical_ssse3 (uint8_t *src, int has_topleft, int has_topright, int stride);
-void ff_pred8x8l_down_left_mmxext (uint8_t *src, int has_topleft, int has_topright, int stride);
-void ff_pred8x8l_down_left_sse2 (uint8_t *src, int has_topleft, int has_topright, int stride);
-void ff_pred8x8l_down_left_ssse3 (uint8_t *src, int has_topleft, int has_topright, int stride);
-void ff_pred8x8l_down_right_mmxext (uint8_t *src, int has_topleft, int has_topright, int stride);
-void ff_pred8x8l_down_right_sse2 (uint8_t *src, int has_topleft, int has_topright, int stride);
-void ff_pred8x8l_down_right_ssse3 (uint8_t *src, int has_topleft, int has_topright, int stride);
-void ff_pred8x8l_vertical_right_mmxext(uint8_t *src, int has_topleft, int has_topright, int stride);
-void ff_pred8x8l_vertical_right_sse2(uint8_t *src, int has_topleft, int has_topright, int stride);
-void ff_pred8x8l_vertical_right_ssse3(uint8_t *src, int has_topleft, int has_topright, int stride);
-void ff_pred8x8l_vertical_left_sse2(uint8_t *src, int has_topleft, int has_topright, int stride);
-void ff_pred8x8l_vertical_left_ssse3(uint8_t *src, int has_topleft, int has_topright, int stride);
-void ff_pred8x8l_horizontal_up_mmxext(uint8_t *src, int has_topleft, int has_topright, int stride);
-void ff_pred8x8l_horizontal_up_ssse3(uint8_t *src, int has_topleft, int has_topright, int stride);
-void ff_pred8x8l_horizontal_down_mmxext(uint8_t *src, int has_topleft, int has_topright, int stride);
-void ff_pred8x8l_horizontal_down_sse2(uint8_t *src, int has_topleft, int has_topright, int stride);
-void ff_pred8x8l_horizontal_down_ssse3(uint8_t *src, int has_topleft, int has_topright, int stride);
-void ff_pred4x4_dc_mmxext (uint8_t *src, const uint8_t *topright, int stride);
-void ff_pred4x4_down_left_mmxext (uint8_t *src, const uint8_t *topright, int stride);
-void ff_pred4x4_down_right_mmxext (uint8_t *src, const uint8_t *topright, int stride);
-void ff_pred4x4_vertical_left_mmxext(uint8_t *src, const uint8_t *topright, int stride);
-void ff_pred4x4_vertical_right_mmxext(uint8_t *src, const uint8_t *topright, int stride);
-void ff_pred4x4_horizontal_up_mmxext(uint8_t *src, const uint8_t *topright, int stride);
-void ff_pred4x4_horizontal_down_mmxext(uint8_t *src, const uint8_t *topright, int stride);
-void ff_pred4x4_tm_vp8_mmx (uint8_t *src, const uint8_t *topright, int stride);
-void ff_pred4x4_tm_vp8_mmxext (uint8_t *src, const uint8_t *topright, int stride);
-void ff_pred4x4_tm_vp8_ssse3 (uint8_t *src, const uint8_t *topright, int stride);
-void ff_pred4x4_vertical_vp8_mmxext(uint8_t *src, const uint8_t *topright, int stride);
+/* 8-bit versions */
+PRED16x16(vertical, 8, mmx)
+PRED16x16(vertical, 8, sse)
+PRED16x16(horizontal, 8, mmx)
+PRED16x16(horizontal, 8, mmxext)
+PRED16x16(horizontal, 8, ssse3)
+PRED16x16(dc, 8, mmxext)
+PRED16x16(dc, 8, sse2)
+PRED16x16(dc, 8, ssse3)
+PRED16x16(plane_h264, 8, mmx)
+PRED16x16(plane_h264, 8, mmxext)
+PRED16x16(plane_h264, 8, sse2)
+PRED16x16(plane_h264, 8, ssse3)
+PRED16x16(plane_rv40, 8, mmx)
+PRED16x16(plane_rv40, 8, mmxext)
+PRED16x16(plane_rv40, 8, sse2)
+PRED16x16(plane_rv40, 8, ssse3)
+PRED16x16(plane_svq3, 8, mmx)
+PRED16x16(plane_svq3, 8, mmxext)
+PRED16x16(plane_svq3, 8, sse2)
+PRED16x16(plane_svq3, 8, ssse3)
+PRED16x16(tm_vp8, 8, mmx)
+PRED16x16(tm_vp8, 8, mmxext)
+PRED16x16(tm_vp8, 8, sse2)
+
+PRED8x8(top_dc, 8, mmxext)
+PRED8x8(dc_rv40, 8, mmxext)
+PRED8x8(dc, 8, mmxext)
+PRED8x8(vertical, 8, mmx)
+PRED8x8(horizontal, 8, mmx)
+PRED8x8(horizontal, 8, mmxext)
+PRED8x8(horizontal, 8, ssse3)
+PRED8x8(plane, 8, mmx)
+PRED8x8(plane, 8, mmxext)
+PRED8x8(plane, 8, sse2)
+PRED8x8(plane, 8, ssse3)
+PRED8x8(tm_vp8, 8, mmx)
+PRED8x8(tm_vp8, 8, mmxext)
+PRED8x8(tm_vp8, 8, sse2)
+PRED8x8(tm_vp8, 8, ssse3)
+
+PRED8x8L(top_dc, 8, mmxext)
+PRED8x8L(top_dc, 8, ssse3)
+PRED8x8L(dc, 8, mmxext)
+PRED8x8L(dc, 8, ssse3)
+PRED8x8L(horizontal, 8, mmxext)
+PRED8x8L(horizontal, 8, ssse3)
+PRED8x8L(vertical, 8, mmxext)
+PRED8x8L(vertical, 8, ssse3)
+PRED8x8L(down_left, 8, mmxext)
+PRED8x8L(down_left, 8, sse2)
+PRED8x8L(down_left, 8, ssse3)
+PRED8x8L(down_right, 8, mmxext)
+PRED8x8L(down_right, 8, sse2)
+PRED8x8L(down_right, 8, ssse3)
+PRED8x8L(vertical_right, 8, mmxext)
+PRED8x8L(vertical_right, 8, sse2)
+PRED8x8L(vertical_right, 8, ssse3)
+PRED8x8L(vertical_left, 8, sse2)
+PRED8x8L(vertical_left, 8, ssse3)
+PRED8x8L(horizontal_up, 8, mmxext)
+PRED8x8L(horizontal_up, 8, ssse3)
+PRED8x8L(horizontal_down, 8, mmxext)
+PRED8x8L(horizontal_down, 8, sse2)
+PRED8x8L(horizontal_down, 8, ssse3)
+
+PRED4x4(dc, 8, mmxext)
+PRED4x4(down_left, 8, mmxext)
+PRED4x4(down_right, 8, mmxext)
+PRED4x4(vertical_left, 8, mmxext)
+PRED4x4(vertical_right, 8, mmxext)
+PRED4x4(horizontal_up, 8, mmxext)
+PRED4x4(horizontal_down, 8, mmxext)
+PRED4x4(tm_vp8, 8, mmx)
+PRED4x4(tm_vp8, 8, mmxext)
+PRED4x4(tm_vp8, 8, ssse3)
+PRED4x4(vertical_vp8, 8, mmxext)
void ff_h264_pred_init_x86(H264PredContext *h, int codec_id, const int bit_depth, const int chroma_format_idc)
{
-#if HAVE_YASM
int mm_flags = av_get_cpu_flags();
if (bit_depth == 8) {
- if (mm_flags & AV_CPU_FLAG_MMX) {
- h->pred16x16[VERT_PRED8x8 ] = ff_pred16x16_vertical_mmx;
- h->pred16x16[HOR_PRED8x8 ] = ff_pred16x16_horizontal_mmx;
+ if (EXTERNAL_MMX(mm_flags)) {
+ h->pred16x16[VERT_PRED8x8 ] = ff_pred16x16_vertical_8_mmx;
+ h->pred16x16[HOR_PRED8x8 ] = ff_pred16x16_horizontal_8_mmx;
if (chroma_format_idc == 1) {
- h->pred8x8 [VERT_PRED8x8 ] = ff_pred8x8_vertical_mmx;
- h->pred8x8 [HOR_PRED8x8 ] = ff_pred8x8_horizontal_mmx;
+ h->pred8x8 [VERT_PRED8x8 ] = ff_pred8x8_vertical_8_mmx;
+ h->pred8x8 [HOR_PRED8x8 ] = ff_pred8x8_horizontal_8_mmx;
}
- if (codec_id == CODEC_ID_VP8) {
- h->pred16x16[PLANE_PRED8x8 ] = ff_pred16x16_tm_vp8_mmx;
- h->pred8x8 [PLANE_PRED8x8 ] = ff_pred8x8_tm_vp8_mmx;
- h->pred4x4 [TM_VP8_PRED ] = ff_pred4x4_tm_vp8_mmx;
+ if (codec_id == AV_CODEC_ID_VP8) {
+ h->pred16x16[PLANE_PRED8x8 ] = ff_pred16x16_tm_vp8_8_mmx;
+ h->pred8x8 [PLANE_PRED8x8 ] = ff_pred8x8_tm_vp8_8_mmx;
+ h->pred4x4 [TM_VP8_PRED ] = ff_pred4x4_tm_vp8_8_mmx;
} else {
if (chroma_format_idc == 1)
- h->pred8x8 [PLANE_PRED8x8] = ff_pred8x8_plane_mmx;
- if (codec_id == CODEC_ID_SVQ3) {
- h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_svq3_mmx;
- } else if (codec_id == CODEC_ID_RV40) {
- h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_rv40_mmx;
+ h->pred8x8 [PLANE_PRED8x8] = ff_pred8x8_plane_8_mmx;
+ if (codec_id == AV_CODEC_ID_SVQ3) {
+ if (mm_flags & AV_CPU_FLAG_CMOV)
+ h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_svq3_8_mmx;
+ } else if (codec_id == AV_CODEC_ID_RV40) {
+ h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_rv40_8_mmx;
} else {
- h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_h264_mmx;
+ h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_h264_8_mmx;
}
}
}
- if (mm_flags & AV_CPU_FLAG_MMX2) {
- h->pred16x16[HOR_PRED8x8 ] = ff_pred16x16_horizontal_mmxext;
- h->pred16x16[DC_PRED8x8 ] = ff_pred16x16_dc_mmxext;
+ if (EXTERNAL_MMXEXT(mm_flags)) {
+ h->pred16x16[HOR_PRED8x8 ] = ff_pred16x16_horizontal_8_mmxext;
+ h->pred16x16[DC_PRED8x8 ] = ff_pred16x16_dc_8_mmxext;
if (chroma_format_idc == 1)
- h->pred8x8[HOR_PRED8x8 ] = ff_pred8x8_horizontal_mmxext;
- h->pred8x8l [TOP_DC_PRED ] = ff_pred8x8l_top_dc_mmxext;
- h->pred8x8l [DC_PRED ] = ff_pred8x8l_dc_mmxext;
- h->pred8x8l [HOR_PRED ] = ff_pred8x8l_horizontal_mmxext;
- h->pred8x8l [VERT_PRED ] = ff_pred8x8l_vertical_mmxext;
- h->pred8x8l [DIAG_DOWN_RIGHT_PRED ] = ff_pred8x8l_down_right_mmxext;
- h->pred8x8l [VERT_RIGHT_PRED ] = ff_pred8x8l_vertical_right_mmxext;
- h->pred8x8l [HOR_UP_PRED ] = ff_pred8x8l_horizontal_up_mmxext;
- h->pred8x8l [DIAG_DOWN_LEFT_PRED ] = ff_pred8x8l_down_left_mmxext;
- h->pred8x8l [HOR_DOWN_PRED ] = ff_pred8x8l_horizontal_down_mmxext;
- h->pred4x4 [DIAG_DOWN_RIGHT_PRED ] = ff_pred4x4_down_right_mmxext;
- h->pred4x4 [VERT_RIGHT_PRED ] = ff_pred4x4_vertical_right_mmxext;
- h->pred4x4 [HOR_DOWN_PRED ] = ff_pred4x4_horizontal_down_mmxext;
- h->pred4x4 [DC_PRED ] = ff_pred4x4_dc_mmxext;
- if (codec_id == CODEC_ID_VP8 || codec_id == CODEC_ID_H264) {
- h->pred4x4 [DIAG_DOWN_LEFT_PRED] = ff_pred4x4_down_left_mmxext;
+ h->pred8x8[HOR_PRED8x8 ] = ff_pred8x8_horizontal_8_mmxext;
+ h->pred8x8l [TOP_DC_PRED ] = ff_pred8x8l_top_dc_8_mmxext;
+ h->pred8x8l [DC_PRED ] = ff_pred8x8l_dc_8_mmxext;
+ h->pred8x8l [HOR_PRED ] = ff_pred8x8l_horizontal_8_mmxext;
+ h->pred8x8l [VERT_PRED ] = ff_pred8x8l_vertical_8_mmxext;
+ h->pred8x8l [DIAG_DOWN_RIGHT_PRED ] = ff_pred8x8l_down_right_8_mmxext;
+ h->pred8x8l [VERT_RIGHT_PRED ] = ff_pred8x8l_vertical_right_8_mmxext;
+ h->pred8x8l [HOR_UP_PRED ] = ff_pred8x8l_horizontal_up_8_mmxext;
+ h->pred8x8l [DIAG_DOWN_LEFT_PRED ] = ff_pred8x8l_down_left_8_mmxext;
+ h->pred8x8l [HOR_DOWN_PRED ] = ff_pred8x8l_horizontal_down_8_mmxext;
+ h->pred4x4 [DIAG_DOWN_RIGHT_PRED ] = ff_pred4x4_down_right_8_mmxext;
+ h->pred4x4 [VERT_RIGHT_PRED ] = ff_pred4x4_vertical_right_8_mmxext;
+ h->pred4x4 [HOR_DOWN_PRED ] = ff_pred4x4_horizontal_down_8_mmxext;
+ h->pred4x4 [DC_PRED ] = ff_pred4x4_dc_8_mmxext;
+ if (codec_id == AV_CODEC_ID_VP8 || codec_id == AV_CODEC_ID_H264) {
+ h->pred4x4 [DIAG_DOWN_LEFT_PRED] = ff_pred4x4_down_left_8_mmxext;
}
- if (codec_id == CODEC_ID_SVQ3 || codec_id == CODEC_ID_H264) {
- h->pred4x4 [VERT_LEFT_PRED ] = ff_pred4x4_vertical_left_mmxext;
+ if (codec_id == AV_CODEC_ID_SVQ3 || codec_id == AV_CODEC_ID_H264) {
+ h->pred4x4 [VERT_LEFT_PRED ] = ff_pred4x4_vertical_left_8_mmxext;
}
- if (codec_id != CODEC_ID_RV40) {
- h->pred4x4 [HOR_UP_PRED ] = ff_pred4x4_horizontal_up_mmxext;
+ if (codec_id != AV_CODEC_ID_RV40) {
+ h->pred4x4 [HOR_UP_PRED ] = ff_pred4x4_horizontal_up_8_mmxext;
}
- if (codec_id == CODEC_ID_SVQ3 || codec_id == CODEC_ID_H264) {
+ if (codec_id == AV_CODEC_ID_SVQ3 || codec_id == AV_CODEC_ID_H264) {
if (chroma_format_idc == 1) {
- h->pred8x8[TOP_DC_PRED8x8 ] = ff_pred8x8_top_dc_mmxext;
- h->pred8x8[DC_PRED8x8 ] = ff_pred8x8_dc_mmxext;
+ h->pred8x8[TOP_DC_PRED8x8 ] = ff_pred8x8_top_dc_8_mmxext;
+ h->pred8x8[DC_PRED8x8 ] = ff_pred8x8_dc_8_mmxext;
}
}
- if (codec_id == CODEC_ID_VP8) {
- h->pred16x16[PLANE_PRED8x8 ] = ff_pred16x16_tm_vp8_mmxext;
- h->pred8x8 [DC_PRED8x8 ] = ff_pred8x8_dc_rv40_mmxext;
- h->pred8x8 [PLANE_PRED8x8 ] = ff_pred8x8_tm_vp8_mmxext;
- h->pred4x4 [TM_VP8_PRED ] = ff_pred4x4_tm_vp8_mmxext;
- h->pred4x4 [VERT_PRED ] = ff_pred4x4_vertical_vp8_mmxext;
+ if (codec_id == AV_CODEC_ID_VP8) {
+ h->pred16x16[PLANE_PRED8x8 ] = ff_pred16x16_tm_vp8_8_mmxext;
+ h->pred8x8 [DC_PRED8x8 ] = ff_pred8x8_dc_rv40_8_mmxext;
+ h->pred8x8 [PLANE_PRED8x8 ] = ff_pred8x8_tm_vp8_8_mmxext;
+ h->pred4x4 [TM_VP8_PRED ] = ff_pred4x4_tm_vp8_8_mmxext;
+ h->pred4x4 [VERT_PRED ] = ff_pred4x4_vertical_vp8_8_mmxext;
} else {
if (chroma_format_idc == 1)
- h->pred8x8 [PLANE_PRED8x8] = ff_pred8x8_plane_mmx2;
- if (codec_id == CODEC_ID_SVQ3) {
- h->pred16x16[PLANE_PRED8x8 ] = ff_pred16x16_plane_svq3_mmx2;
- } else if (codec_id == CODEC_ID_RV40) {
- h->pred16x16[PLANE_PRED8x8 ] = ff_pred16x16_plane_rv40_mmx2;
+ h->pred8x8 [PLANE_PRED8x8] = ff_pred8x8_plane_8_mmxext;
+ if (codec_id == AV_CODEC_ID_SVQ3) {
+ h->pred16x16[PLANE_PRED8x8 ] = ff_pred16x16_plane_svq3_8_mmxext;
+ } else if (codec_id == AV_CODEC_ID_RV40) {
+ h->pred16x16[PLANE_PRED8x8 ] = ff_pred16x16_plane_rv40_8_mmxext;
} else {
- h->pred16x16[PLANE_PRED8x8 ] = ff_pred16x16_plane_h264_mmx2;
+ h->pred16x16[PLANE_PRED8x8 ] = ff_pred16x16_plane_h264_8_mmxext;
}
}
}
- if (mm_flags & AV_CPU_FLAG_SSE) {
- h->pred16x16[VERT_PRED8x8] = ff_pred16x16_vertical_sse;
+ if (EXTERNAL_SSE(mm_flags)) {
+ h->pred16x16[VERT_PRED8x8] = ff_pred16x16_vertical_8_sse;
}
- if (mm_flags & AV_CPU_FLAG_SSE2) {
- h->pred16x16[DC_PRED8x8 ] = ff_pred16x16_dc_sse2;
- h->pred8x8l [DIAG_DOWN_LEFT_PRED ] = ff_pred8x8l_down_left_sse2;
- h->pred8x8l [DIAG_DOWN_RIGHT_PRED ] = ff_pred8x8l_down_right_sse2;
- h->pred8x8l [VERT_RIGHT_PRED ] = ff_pred8x8l_vertical_right_sse2;
- h->pred8x8l [VERT_LEFT_PRED ] = ff_pred8x8l_vertical_left_sse2;
- h->pred8x8l [HOR_DOWN_PRED ] = ff_pred8x8l_horizontal_down_sse2;
- if (codec_id == CODEC_ID_VP8) {
- h->pred16x16[PLANE_PRED8x8 ] = ff_pred16x16_tm_vp8_sse2;
- h->pred8x8 [PLANE_PRED8x8 ] = ff_pred8x8_tm_vp8_sse2;
+ if (EXTERNAL_SSE2(mm_flags)) {
+ h->pred16x16[DC_PRED8x8 ] = ff_pred16x16_dc_8_sse2;
+ h->pred8x8l [DIAG_DOWN_LEFT_PRED ] = ff_pred8x8l_down_left_8_sse2;
+ h->pred8x8l [DIAG_DOWN_RIGHT_PRED ] = ff_pred8x8l_down_right_8_sse2;
+ h->pred8x8l [VERT_RIGHT_PRED ] = ff_pred8x8l_vertical_right_8_sse2;
+ h->pred8x8l [VERT_LEFT_PRED ] = ff_pred8x8l_vertical_left_8_sse2;
+ h->pred8x8l [HOR_DOWN_PRED ] = ff_pred8x8l_horizontal_down_8_sse2;
+ if (codec_id == AV_CODEC_ID_VP8) {
+ h->pred16x16[PLANE_PRED8x8 ] = ff_pred16x16_tm_vp8_8_sse2;
+ h->pred8x8 [PLANE_PRED8x8 ] = ff_pred8x8_tm_vp8_8_sse2;
} else {
if (chroma_format_idc == 1)
- h->pred8x8 [PLANE_PRED8x8] = ff_pred8x8_plane_sse2;
- if (codec_id == CODEC_ID_SVQ3) {
- h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_svq3_sse2;
- } else if (codec_id == CODEC_ID_RV40) {
- h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_rv40_sse2;
+ h->pred8x8 [PLANE_PRED8x8] = ff_pred8x8_plane_8_sse2;
+ if (codec_id == AV_CODEC_ID_SVQ3) {
+ h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_svq3_8_sse2;
+ } else if (codec_id == AV_CODEC_ID_RV40) {
+ h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_rv40_8_sse2;
} else {
- h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_h264_sse2;
+ h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_h264_8_sse2;
}
}
}
- if (mm_flags & AV_CPU_FLAG_SSSE3) {
- h->pred16x16[HOR_PRED8x8 ] = ff_pred16x16_horizontal_ssse3;
- h->pred16x16[DC_PRED8x8 ] = ff_pred16x16_dc_ssse3;
+ if (EXTERNAL_SSSE3(mm_flags)) {
+ h->pred16x16[HOR_PRED8x8 ] = ff_pred16x16_horizontal_8_ssse3;
+ h->pred16x16[DC_PRED8x8 ] = ff_pred16x16_dc_8_ssse3;
if (chroma_format_idc == 1)
- h->pred8x8 [HOR_PRED8x8 ] = ff_pred8x8_horizontal_ssse3;
- h->pred8x8l [TOP_DC_PRED ] = ff_pred8x8l_top_dc_ssse3;
- h->pred8x8l [DC_PRED ] = ff_pred8x8l_dc_ssse3;
- h->pred8x8l [HOR_PRED ] = ff_pred8x8l_horizontal_ssse3;
- h->pred8x8l [VERT_PRED ] = ff_pred8x8l_vertical_ssse3;
- h->pred8x8l [DIAG_DOWN_LEFT_PRED ] = ff_pred8x8l_down_left_ssse3;
- h->pred8x8l [DIAG_DOWN_RIGHT_PRED ] = ff_pred8x8l_down_right_ssse3;
- h->pred8x8l [VERT_RIGHT_PRED ] = ff_pred8x8l_vertical_right_ssse3;
- h->pred8x8l [VERT_LEFT_PRED ] = ff_pred8x8l_vertical_left_ssse3;
- h->pred8x8l [HOR_UP_PRED ] = ff_pred8x8l_horizontal_up_ssse3;
- h->pred8x8l [HOR_DOWN_PRED ] = ff_pred8x8l_horizontal_down_ssse3;
- if (codec_id == CODEC_ID_VP8) {
- h->pred8x8 [PLANE_PRED8x8 ] = ff_pred8x8_tm_vp8_ssse3;
- h->pred4x4 [TM_VP8_PRED ] = ff_pred4x4_tm_vp8_ssse3;
+ h->pred8x8 [HOR_PRED8x8 ] = ff_pred8x8_horizontal_8_ssse3;
+ h->pred8x8l [TOP_DC_PRED ] = ff_pred8x8l_top_dc_8_ssse3;
+ h->pred8x8l [DC_PRED ] = ff_pred8x8l_dc_8_ssse3;
+ h->pred8x8l [HOR_PRED ] = ff_pred8x8l_horizontal_8_ssse3;
+ h->pred8x8l [VERT_PRED ] = ff_pred8x8l_vertical_8_ssse3;
+ h->pred8x8l [DIAG_DOWN_LEFT_PRED ] = ff_pred8x8l_down_left_8_ssse3;
+ h->pred8x8l [DIAG_DOWN_RIGHT_PRED ] = ff_pred8x8l_down_right_8_ssse3;
+ h->pred8x8l [VERT_RIGHT_PRED ] = ff_pred8x8l_vertical_right_8_ssse3;
+ h->pred8x8l [VERT_LEFT_PRED ] = ff_pred8x8l_vertical_left_8_ssse3;
+ h->pred8x8l [HOR_UP_PRED ] = ff_pred8x8l_horizontal_up_8_ssse3;
+ h->pred8x8l [HOR_DOWN_PRED ] = ff_pred8x8l_horizontal_down_8_ssse3;
+ if (codec_id == AV_CODEC_ID_VP8) {
+ h->pred8x8 [PLANE_PRED8x8 ] = ff_pred8x8_tm_vp8_8_ssse3;
+ h->pred4x4 [TM_VP8_PRED ] = ff_pred4x4_tm_vp8_8_ssse3;
} else {
if (chroma_format_idc == 1)
- h->pred8x8 [PLANE_PRED8x8] = ff_pred8x8_plane_ssse3;
- if (codec_id == CODEC_ID_SVQ3) {
- h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_svq3_ssse3;
- } else if (codec_id == CODEC_ID_RV40) {
- h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_rv40_ssse3;
+ h->pred8x8 [PLANE_PRED8x8] = ff_pred8x8_plane_8_ssse3;
+ if (codec_id == AV_CODEC_ID_SVQ3) {
+ h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_svq3_8_ssse3;
+ } else if (codec_id == AV_CODEC_ID_RV40) {
+ h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_rv40_8_ssse3;
} else {
- h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_h264_ssse3;
+ h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_h264_8_ssse3;
}
}
}
} else if (bit_depth == 10) {
- if (mm_flags & AV_CPU_FLAG_MMX2) {
+ if (EXTERNAL_MMXEXT(mm_flags)) {
h->pred4x4[DC_PRED ] = ff_pred4x4_dc_10_mmxext;
h->pred4x4[HOR_UP_PRED ] = ff_pred4x4_horizontal_up_10_mmxext;
@@ -323,7 +335,7 @@ void ff_h264_pred_init_x86(H264PredContext *h, int codec_id, const int bit_depth
h->pred16x16[VERT_PRED8x8 ] = ff_pred16x16_vertical_10_mmxext;
h->pred16x16[HOR_PRED8x8 ] = ff_pred16x16_horizontal_10_mmxext;
}
- if (mm_flags & AV_CPU_FLAG_SSE2) {
+ if (EXTERNAL_SSE2(mm_flags)) {
h->pred4x4[DIAG_DOWN_LEFT_PRED ] = ff_pred4x4_down_left_10_sse2;
h->pred4x4[DIAG_DOWN_RIGHT_PRED] = ff_pred4x4_down_right_10_sse2;
h->pred4x4[VERT_LEFT_PRED ] = ff_pred4x4_vertical_left_10_sse2;
@@ -355,7 +367,7 @@ void ff_h264_pred_init_x86(H264PredContext *h, int codec_id, const int bit_depth
h->pred16x16[VERT_PRED8x8 ] = ff_pred16x16_vertical_10_sse2;
h->pred16x16[HOR_PRED8x8 ] = ff_pred16x16_horizontal_10_sse2;
}
- if (mm_flags & AV_CPU_FLAG_SSSE3) {
+ if (EXTERNAL_SSSE3(mm_flags)) {
h->pred4x4[DIAG_DOWN_RIGHT_PRED] = ff_pred4x4_down_right_10_ssse3;
h->pred4x4[VERT_RIGHT_PRED ] = ff_pred4x4_vertical_right_10_ssse3;
h->pred4x4[HOR_DOWN_PRED ] = ff_pred4x4_horizontal_down_10_ssse3;
@@ -366,8 +378,7 @@ void ff_h264_pred_init_x86(H264PredContext *h, int codec_id, const int bit_depth
h->pred8x8l[VERT_RIGHT_PRED ] = ff_pred8x8l_vertical_right_10_ssse3;
h->pred8x8l[HOR_UP_PRED ] = ff_pred8x8l_horizontal_up_10_ssse3;
}
-#if HAVE_AVX
- if (mm_flags & AV_CPU_FLAG_AVX) {
+ if (EXTERNAL_AVX(mm_flags)) {
h->pred4x4[DIAG_DOWN_LEFT_PRED ] = ff_pred4x4_down_left_10_avx;
h->pred4x4[DIAG_DOWN_RIGHT_PRED] = ff_pred4x4_down_right_10_avx;
h->pred4x4[VERT_LEFT_PRED ] = ff_pred4x4_vertical_left_10_avx;
@@ -383,7 +394,5 @@ void ff_h264_pred_init_x86(H264PredContext *h, int codec_id, const int bit_depth
h->pred8x8l[VERT_RIGHT_PRED ] = ff_pred8x8l_vertical_right_10_avx;
h->pred8x8l[HOR_UP_PRED ] = ff_pred8x8l_horizontal_up_10_avx;
}
-#endif /* HAVE_AVX */
}
-#endif /* HAVE_YASM */
}
diff --git a/gst-libs/ext/libav/libavcodec/x86/h264_qpel.c b/gst-libs/ext/libav/libavcodec/x86/h264_qpel.c
new file mode 100644
index 0000000..bc56d09
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/x86/h264_qpel.c
@@ -0,0 +1,492 @@
+/*
+ * Copyright (c) 2004-2005 Michael Niedermayer, Loren Merritt
+ * Copyright (c) 2011 Daniel Kang
+ *
+ * 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
+ */
+
+#include "libavutil/cpu.h"
+#include "libavutil/x86/asm.h"
+#include "libavcodec/dsputil.h"
+#include "libavcodec/mpegvideo.h"
+#include "dsputil_mmx.h"
+
+#if HAVE_YASM
+void ff_put_pixels4_mmxext(uint8_t *block, const uint8_t *pixels, int line_size, int h);
+void ff_avg_pixels4_mmxext(uint8_t *block, const uint8_t *pixels, int line_size, int h);
+void ff_put_pixels8_mmxext(uint8_t *block, const uint8_t *pixels, int line_size, int h);
+void ff_avg_pixels8_mmxext(uint8_t *block, const uint8_t *pixels, int line_size, int h);
+static void ff_put_pixels16_mmxext(uint8_t *block, const uint8_t *pixels,
+ int line_size, int h)
+{
+ ff_put_pixels8_mmxext(block, pixels, line_size, h);
+ ff_put_pixels8_mmxext(block + 8, pixels + 8, line_size, h);
+}
+static void ff_avg_pixels16_mmxext(uint8_t *block, const uint8_t *pixels,
+ int line_size, int h)
+{
+ ff_avg_pixels8_mmxext(block, pixels, line_size, h);
+ ff_avg_pixels8_mmxext(block + 8, pixels + 8, line_size, h);
+}
+void ff_put_pixels4_l2_mmxext(uint8_t *dst, uint8_t *src1, uint8_t *src2,
+ int dstStride, int src1Stride, int h);
+void ff_avg_pixels4_l2_mmxext(uint8_t *dst, uint8_t *src1, uint8_t *src2,
+ int dstStride, int src1Stride, int h);
+void ff_put_pixels8_l2_mmxext(uint8_t *dst, uint8_t *src1, uint8_t *src2,
+ int dstStride, int src1Stride, int h);
+void ff_avg_pixels8_l2_mmxext(uint8_t *dst, uint8_t *src1, uint8_t *src2,
+ int dstStride, int src1Stride, int h);
+void ff_put_pixels16_l2_mmxext(uint8_t *dst, uint8_t *src1, uint8_t *src2,
+ int dstStride, int src1Stride, int h);
+void ff_avg_pixels16_l2_mmxext(uint8_t *dst, uint8_t *src1, uint8_t *src2,
+ int dstStride, int src1Stride, int h);
+void ff_put_pixels16_sse2(uint8_t *block, const uint8_t *pixels,
+ int line_size, int h);
+void ff_avg_pixels16_sse2(uint8_t *block, const uint8_t *pixels,
+ int line_size, int h);
+#define ff_put_pixels8_l2_sse2 ff_put_pixels8_l2_mmxext
+#define ff_avg_pixels8_l2_sse2 ff_avg_pixels8_l2_mmxext
+#define ff_put_pixels16_l2_sse2 ff_put_pixels16_l2_mmxext
+#define ff_avg_pixels16_l2_sse2 ff_avg_pixels16_l2_mmxext
+
+#define DEF_QPEL(OPNAME)\
+void ff_ ## OPNAME ## _h264_qpel4_h_lowpass_mmxext(uint8_t *dst, uint8_t *src, int dstStride, int srcStride);\
+void ff_ ## OPNAME ## _h264_qpel8_h_lowpass_mmxext(uint8_t *dst, uint8_t *src, int dstStride, int srcStride);\
+void ff_ ## OPNAME ## _h264_qpel8_h_lowpass_ssse3(uint8_t *dst, uint8_t *src, int dstStride, int srcStride);\
+void ff_ ## OPNAME ## _h264_qpel4_h_lowpass_l2_mmxext(uint8_t *dst, uint8_t *src, uint8_t *src2, int dstStride, int src2Stride);\
+void ff_ ## OPNAME ## _h264_qpel8_h_lowpass_l2_mmxext(uint8_t *dst, uint8_t *src, uint8_t *src2, int dstStride, int src2Stride);\
+void ff_ ## OPNAME ## _h264_qpel8_h_lowpass_l2_ssse3(uint8_t *dst, uint8_t *src, uint8_t *src2, int dstStride, int src2Stride);\
+void ff_ ## OPNAME ## _h264_qpel4_v_lowpass_mmxext(uint8_t *dst, uint8_t *src, int dstStride, int srcStride);\
+void ff_ ## OPNAME ## _h264_qpel8or16_v_lowpass_op_mmxext(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int h);\
+void ff_ ## OPNAME ## _h264_qpel8or16_v_lowpass_sse2(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int h);\
+void ff_ ## OPNAME ## _h264_qpel4_hv_lowpass_v_mmxext(uint8_t *src, int16_t *tmp, int srcStride);\
+void ff_ ## OPNAME ## _h264_qpel4_hv_lowpass_h_mmxext(int16_t *tmp, uint8_t *dst, int dstStride);\
+void ff_ ## OPNAME ## _h264_qpel8or16_hv1_lowpass_op_mmxext(uint8_t *src, int16_t *tmp, int srcStride, int size);\
+void ff_ ## OPNAME ## _h264_qpel8or16_hv1_lowpass_op_sse2(uint8_t *src, int16_t *tmp, int srcStride, int size);\
+void ff_ ## OPNAME ## _h264_qpel8or16_hv2_lowpass_op_mmxext(uint8_t *dst, int16_t *tmp, int dstStride, int unused, int h);\
+void ff_ ## OPNAME ## _h264_qpel8or16_hv2_lowpass_ssse3(uint8_t *dst, int16_t *tmp, int dstStride, int tmpStride, int size);\
+void ff_ ## OPNAME ## _pixels4_l2_shift5_mmxext(uint8_t *dst, int16_t *src16, uint8_t *src8, int dstStride, int src8Stride, int h);\
+void ff_ ## OPNAME ## _pixels8_l2_shift5_mmxext(uint8_t *dst, int16_t *src16, uint8_t *src8, int dstStride, int src8Stride, int h);
+
+DEF_QPEL(avg)
+DEF_QPEL(put)
+
+#define QPEL_H264(OPNAME, OP, MMX)\
+static av_always_inline void ff_ ## OPNAME ## h264_qpel4_hv_lowpass_ ## MMX(uint8_t *dst, int16_t *tmp, uint8_t *src, int dstStride, int tmpStride, int srcStride){\
+ int w=3;\
+ src -= 2*srcStride+2;\
+ while(w--){\
+ ff_ ## OPNAME ## h264_qpel4_hv_lowpass_v_mmxext(src, tmp, srcStride);\
+ tmp += 4;\
+ src += 4;\
+ }\
+ tmp -= 3*4;\
+ ff_ ## OPNAME ## h264_qpel4_hv_lowpass_h_mmxext(tmp, dst, dstStride);\
+}\
+\
+static av_always_inline void ff_ ## OPNAME ## h264_qpel8or16_v_lowpass_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int h){\
+ src -= 2*srcStride;\
+ ff_ ## OPNAME ## h264_qpel8or16_v_lowpass_op_mmxext(dst, src, dstStride, srcStride, h);\
+ src += 4;\
+ dst += 4;\
+ ff_ ## OPNAME ## h264_qpel8or16_v_lowpass_op_mmxext(dst, src, dstStride, srcStride, h);\
+}\
+static av_always_inline void ff_ ## OPNAME ## h264_qpel8or16_hv1_lowpass_ ## MMX(int16_t *tmp, uint8_t *src, int tmpStride, int srcStride, int size){\
+ int w = (size+8)>>2;\
+ src -= 2*srcStride+2;\
+ while(w--){\
+ ff_ ## OPNAME ## h264_qpel8or16_hv1_lowpass_op_mmxext(src, tmp, srcStride, size);\
+ tmp += 4;\
+ src += 4;\
+ }\
+}\
+static av_always_inline void ff_ ## OPNAME ## h264_qpel8or16_hv2_lowpass_ ## MMX(uint8_t *dst, int16_t *tmp, int dstStride, int tmpStride, int size){\
+ int w = size>>4;\
+ do{\
+ ff_ ## OPNAME ## h264_qpel8or16_hv2_lowpass_op_mmxext(dst, tmp, dstStride, 0, size);\
+ tmp += 8;\
+ dst += 8;\
+ }while(w--);\
+}\
+\
+static av_always_inline void ff_ ## OPNAME ## h264_qpel8_v_lowpass_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
+ ff_ ## OPNAME ## h264_qpel8or16_v_lowpass_ ## MMX(dst , src , dstStride, srcStride, 8);\
+}\
+static av_always_inline void ff_ ## OPNAME ## h264_qpel16_v_lowpass_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
+ ff_ ## OPNAME ## h264_qpel8or16_v_lowpass_ ## MMX(dst , src , dstStride, srcStride, 16);\
+ ff_ ## OPNAME ## h264_qpel8or16_v_lowpass_ ## MMX(dst+8, src+8, dstStride, srcStride, 16);\
+}\
+\
+static av_always_inline void ff_ ## OPNAME ## h264_qpel16_h_lowpass_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
+ ff_ ## OPNAME ## h264_qpel8_h_lowpass_ ## MMX(dst , src , dstStride, srcStride);\
+ ff_ ## OPNAME ## h264_qpel8_h_lowpass_ ## MMX(dst+8, src+8, dstStride, srcStride);\
+ src += 8*srcStride;\
+ dst += 8*dstStride;\
+ ff_ ## OPNAME ## h264_qpel8_h_lowpass_ ## MMX(dst , src , dstStride, srcStride);\
+ ff_ ## OPNAME ## h264_qpel8_h_lowpass_ ## MMX(dst+8, src+8, dstStride, srcStride);\
+}\
+\
+static av_always_inline void ff_ ## OPNAME ## h264_qpel16_h_lowpass_l2_ ## MMX(uint8_t *dst, uint8_t *src, uint8_t *src2, int dstStride, int src2Stride){\
+ ff_ ## OPNAME ## h264_qpel8_h_lowpass_l2_ ## MMX(dst , src , src2 , dstStride, src2Stride);\
+ ff_ ## OPNAME ## h264_qpel8_h_lowpass_l2_ ## MMX(dst+8, src+8, src2+8, dstStride, src2Stride);\
+ src += 8*dstStride;\
+ dst += 8*dstStride;\
+ src2 += 8*src2Stride;\
+ ff_ ## OPNAME ## h264_qpel8_h_lowpass_l2_ ## MMX(dst , src , src2 , dstStride, src2Stride);\
+ ff_ ## OPNAME ## h264_qpel8_h_lowpass_l2_ ## MMX(dst+8, src+8, src2+8, dstStride, src2Stride);\
+}\
+\
+static av_always_inline void ff_ ## OPNAME ## h264_qpel8or16_hv_lowpass_ ## MMX(uint8_t *dst, int16_t *tmp, uint8_t *src, int dstStride, int tmpStride, int srcStride, int size){\
+ ff_put_h264_qpel8or16_hv1_lowpass_ ## MMX(tmp, src, tmpStride, srcStride, size);\
+ ff_ ## OPNAME ## h264_qpel8or16_hv2_lowpass_ ## MMX(dst, tmp, dstStride, tmpStride, size);\
+}\
+static av_always_inline void ff_ ## OPNAME ## h264_qpel8_hv_lowpass_ ## MMX(uint8_t *dst, int16_t *tmp, uint8_t *src, int dstStride, int tmpStride, int srcStride){\
+ ff_ ## OPNAME ## h264_qpel8or16_hv_lowpass_ ## MMX(dst , tmp , src , dstStride, tmpStride, srcStride, 8);\
+}\
+\
+static av_always_inline void ff_ ## OPNAME ## h264_qpel16_hv_lowpass_ ## MMX(uint8_t *dst, int16_t *tmp, uint8_t *src, int dstStride, int tmpStride, int srcStride){\
+ ff_ ## OPNAME ## h264_qpel8or16_hv_lowpass_ ## MMX(dst , tmp , src , dstStride, tmpStride, srcStride, 16);\
+}\
+\
+static av_always_inline void ff_ ## OPNAME ## pixels16_l2_shift5_ ## MMX(uint8_t *dst, int16_t *src16, uint8_t *src8, int dstStride, int src8Stride, int h)\
+{\
+ ff_ ## OPNAME ## pixels8_l2_shift5_ ## MMX(dst , src16 , src8 , dstStride, src8Stride, h);\
+ ff_ ## OPNAME ## pixels8_l2_shift5_ ## MMX(dst+8, src16+8, src8+8, dstStride, src8Stride, h);\
+}\
+
+
+#if ARCH_X86_64
+#define QPEL_H264_H16_XMM(OPNAME, OP, MMX)\
+
+void ff_avg_h264_qpel16_h_lowpass_l2_ssse3(uint8_t *dst, uint8_t *src, uint8_t *src2, int dstStride, int src2Stride);
+void ff_put_h264_qpel16_h_lowpass_l2_ssse3(uint8_t *dst, uint8_t *src, uint8_t *src2, int dstStride, int src2Stride);
+
+#else // ARCH_X86_64
+#define QPEL_H264_H16_XMM(OPNAME, OP, MMX)\
+static av_always_inline void ff_ ## OPNAME ## h264_qpel16_h_lowpass_l2_ ## MMX(uint8_t *dst, uint8_t *src, uint8_t *src2, int dstStride, int src2Stride){\
+ ff_ ## OPNAME ## h264_qpel8_h_lowpass_l2_ ## MMX(dst , src , src2 , dstStride, src2Stride);\
+ ff_ ## OPNAME ## h264_qpel8_h_lowpass_l2_ ## MMX(dst+8, src+8, src2+8, dstStride, src2Stride);\
+ src += 8*dstStride;\
+ dst += 8*dstStride;\
+ src2 += 8*src2Stride;\
+ ff_ ## OPNAME ## h264_qpel8_h_lowpass_l2_ ## MMX(dst , src , src2 , dstStride, src2Stride);\
+ ff_ ## OPNAME ## h264_qpel8_h_lowpass_l2_ ## MMX(dst+8, src+8, src2+8, dstStride, src2Stride);\
+}
+#endif // ARCH_X86_64
+
+#define QPEL_H264_H_XMM(OPNAME, OP, MMX)\
+QPEL_H264_H16_XMM(OPNAME, OP, MMX)\
+static av_always_inline void ff_ ## OPNAME ## h264_qpel16_h_lowpass_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
+ ff_ ## OPNAME ## h264_qpel8_h_lowpass_ ## MMX(dst , src , dstStride, srcStride);\
+ ff_ ## OPNAME ## h264_qpel8_h_lowpass_ ## MMX(dst+8, src+8, dstStride, srcStride);\
+ src += 8*srcStride;\
+ dst += 8*dstStride;\
+ ff_ ## OPNAME ## h264_qpel8_h_lowpass_ ## MMX(dst , src , dstStride, srcStride);\
+ ff_ ## OPNAME ## h264_qpel8_h_lowpass_ ## MMX(dst+8, src+8, dstStride, srcStride);\
+}\
+
+#define QPEL_H264_V_XMM(OPNAME, OP, MMX)\
+static av_always_inline void ff_ ## OPNAME ## h264_qpel8_v_lowpass_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
+ ff_ ## OPNAME ## h264_qpel8or16_v_lowpass_ ## MMX(dst , src , dstStride, srcStride, 8);\
+}\
+static av_always_inline void ff_ ## OPNAME ## h264_qpel16_v_lowpass_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
+ ff_ ## OPNAME ## h264_qpel8or16_v_lowpass_ ## MMX(dst , src , dstStride, srcStride, 16);\
+ ff_ ## OPNAME ## h264_qpel8or16_v_lowpass_ ## MMX(dst+8, src+8, dstStride, srcStride, 16);\
+}
+
+static av_always_inline void ff_put_h264_qpel8or16_hv1_lowpass_sse2(int16_t *tmp, uint8_t *src, int tmpStride, int srcStride, int size){
+ int w = (size+8)>>3;
+ src -= 2*srcStride+2;
+ while(w--){
+ ff_put_h264_qpel8or16_hv1_lowpass_op_sse2(src, tmp, srcStride, size);
+ tmp += 8;
+ src += 8;
+ }
+}
+
+#define QPEL_H264_HV_XMM(OPNAME, OP, MMX)\
+static av_always_inline void ff_ ## OPNAME ## h264_qpel8or16_hv_lowpass_ ## MMX(uint8_t *dst, int16_t *tmp, uint8_t *src, int dstStride, int tmpStride, int srcStride, int size){\
+ ff_put_h264_qpel8or16_hv1_lowpass_sse2(tmp, src, tmpStride, srcStride, size);\
+ ff_ ## OPNAME ## h264_qpel8or16_hv2_lowpass_ ## MMX(dst, tmp, dstStride, tmpStride, size);\
+}\
+static av_always_inline void ff_ ## OPNAME ## h264_qpel8_hv_lowpass_ ## MMX(uint8_t *dst, int16_t *tmp, uint8_t *src, int dstStride, int tmpStride, int srcStride){\
+ ff_ ## OPNAME ## h264_qpel8or16_hv_lowpass_ ## MMX(dst, tmp, src, dstStride, tmpStride, srcStride, 8);\
+}\
+static av_always_inline void ff_ ## OPNAME ## h264_qpel16_hv_lowpass_ ## MMX(uint8_t *dst, int16_t *tmp, uint8_t *src, int dstStride, int tmpStride, int srcStride){\
+ ff_ ## OPNAME ## h264_qpel8or16_hv_lowpass_ ## MMX(dst, tmp, src, dstStride, tmpStride, srcStride, 16);\
+}\
+
+#define ff_put_h264_qpel8_h_lowpass_l2_sse2 ff_put_h264_qpel8_h_lowpass_l2_mmxext
+#define ff_avg_h264_qpel8_h_lowpass_l2_sse2 ff_avg_h264_qpel8_h_lowpass_l2_mmxext
+#define ff_put_h264_qpel16_h_lowpass_l2_sse2 ff_put_h264_qpel16_h_lowpass_l2_mmxext
+#define ff_avg_h264_qpel16_h_lowpass_l2_sse2 ff_avg_h264_qpel16_h_lowpass_l2_mmxext
+
+#define ff_put_h264_qpel8_v_lowpass_ssse3 ff_put_h264_qpel8_v_lowpass_sse2
+#define ff_avg_h264_qpel8_v_lowpass_ssse3 ff_avg_h264_qpel8_v_lowpass_sse2
+#define ff_put_h264_qpel16_v_lowpass_ssse3 ff_put_h264_qpel16_v_lowpass_sse2
+#define ff_avg_h264_qpel16_v_lowpass_ssse3 ff_avg_h264_qpel16_v_lowpass_sse2
+
+#define ff_put_h264_qpel8or16_hv2_lowpass_sse2 ff_put_h264_qpel8or16_hv2_lowpass_mmxext
+#define ff_avg_h264_qpel8or16_hv2_lowpass_sse2 ff_avg_h264_qpel8or16_hv2_lowpass_mmxext
+
+#define H264_MC(OPNAME, SIZE, MMX, ALIGN) \
+H264_MC_C(OPNAME, SIZE, MMX, ALIGN)\
+H264_MC_V(OPNAME, SIZE, MMX, ALIGN)\
+H264_MC_H(OPNAME, SIZE, MMX, ALIGN)\
+H264_MC_HV(OPNAME, SIZE, MMX, ALIGN)\
+
+static void put_h264_qpel16_mc00_sse2 (uint8_t *dst, uint8_t *src, int stride){
+ ff_put_pixels16_sse2(dst, src, stride, 16);
+}
+static void avg_h264_qpel16_mc00_sse2 (uint8_t *dst, uint8_t *src, int stride){
+ ff_avg_pixels16_sse2(dst, src, stride, 16);
+}
+#define put_h264_qpel8_mc00_sse2 put_h264_qpel8_mc00_mmxext
+#define avg_h264_qpel8_mc00_sse2 avg_h264_qpel8_mc00_mmxext
+
+#define H264_MC_C(OPNAME, SIZE, MMX, ALIGN) \
+static void OPNAME ## h264_qpel ## SIZE ## _mc00_ ## MMX (uint8_t *dst, uint8_t *src, int stride){\
+ ff_ ## OPNAME ## pixels ## SIZE ## _ ## MMX(dst, src, stride, SIZE);\
+}\
+
+#define H264_MC_H(OPNAME, SIZE, MMX, ALIGN) \
+static void OPNAME ## h264_qpel ## SIZE ## _mc10_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
+ ff_ ## OPNAME ## h264_qpel ## SIZE ## _h_lowpass_l2_ ## MMX(dst, src, src, stride, stride);\
+}\
+\
+static void OPNAME ## h264_qpel ## SIZE ## _mc20_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
+ ff_ ## OPNAME ## h264_qpel ## SIZE ## _h_lowpass_ ## MMX(dst, src, stride, stride);\
+}\
+\
+static void OPNAME ## h264_qpel ## SIZE ## _mc30_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
+ ff_ ## OPNAME ## h264_qpel ## SIZE ## _h_lowpass_l2_ ## MMX(dst, src, src+1, stride, stride);\
+}\
+
+#define H264_MC_V(OPNAME, SIZE, MMX, ALIGN) \
+static void OPNAME ## h264_qpel ## SIZE ## _mc01_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
+ DECLARE_ALIGNED(ALIGN, uint8_t, temp)[SIZE*SIZE];\
+ ff_put_h264_qpel ## SIZE ## _v_lowpass_ ## MMX(temp, src, SIZE, stride);\
+ ff_ ## OPNAME ## pixels ## SIZE ## _l2_ ## MMX(dst, src, temp, stride, stride, SIZE);\
+}\
+\
+static void OPNAME ## h264_qpel ## SIZE ## _mc02_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
+ ff_ ## OPNAME ## h264_qpel ## SIZE ## _v_lowpass_ ## MMX(dst, src, stride, stride);\
+}\
+\
+static void OPNAME ## h264_qpel ## SIZE ## _mc03_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
+ DECLARE_ALIGNED(ALIGN, uint8_t, temp)[SIZE*SIZE];\
+ ff_put_h264_qpel ## SIZE ## _v_lowpass_ ## MMX(temp, src, SIZE, stride);\
+ ff_ ## OPNAME ## pixels ## SIZE ## _l2_ ## MMX(dst, src+stride, temp, stride, stride, SIZE);\
+}\
+
+#define H264_MC_HV(OPNAME, SIZE, MMX, ALIGN) \
+static void OPNAME ## h264_qpel ## SIZE ## _mc11_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
+ DECLARE_ALIGNED(ALIGN, uint8_t, temp)[SIZE*SIZE];\
+ ff_put_h264_qpel ## SIZE ## _v_lowpass_ ## MMX(temp, src, SIZE, stride);\
+ ff_ ## OPNAME ## h264_qpel ## SIZE ## _h_lowpass_l2_ ## MMX(dst, src, temp, stride, SIZE);\
+}\
+\
+static void OPNAME ## h264_qpel ## SIZE ## _mc31_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
+ DECLARE_ALIGNED(ALIGN, uint8_t, temp)[SIZE*SIZE];\
+ ff_put_h264_qpel ## SIZE ## _v_lowpass_ ## MMX(temp, src+1, SIZE, stride);\
+ ff_ ## OPNAME ## h264_qpel ## SIZE ## _h_lowpass_l2_ ## MMX(dst, src, temp, stride, SIZE);\
+}\
+\
+static void OPNAME ## h264_qpel ## SIZE ## _mc13_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
+ DECLARE_ALIGNED(ALIGN, uint8_t, temp)[SIZE*SIZE];\
+ ff_put_h264_qpel ## SIZE ## _v_lowpass_ ## MMX(temp, src, SIZE, stride);\
+ ff_ ## OPNAME ## h264_qpel ## SIZE ## _h_lowpass_l2_ ## MMX(dst, src+stride, temp, stride, SIZE);\
+}\
+\
+static void OPNAME ## h264_qpel ## SIZE ## _mc33_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
+ DECLARE_ALIGNED(ALIGN, uint8_t, temp)[SIZE*SIZE];\
+ ff_put_h264_qpel ## SIZE ## _v_lowpass_ ## MMX(temp, src+1, SIZE, stride);\
+ ff_ ## OPNAME ## h264_qpel ## SIZE ## _h_lowpass_l2_ ## MMX(dst, src+stride, temp, stride, SIZE);\
+}\
+\
+static void OPNAME ## h264_qpel ## SIZE ## _mc22_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
+ DECLARE_ALIGNED(ALIGN, uint16_t, temp)[SIZE*(SIZE<8?12:24)];\
+ ff_ ## OPNAME ## h264_qpel ## SIZE ## _hv_lowpass_ ## MMX(dst, temp, src, stride, SIZE, stride);\
+}\
+\
+static void OPNAME ## h264_qpel ## SIZE ## _mc21_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
+ DECLARE_ALIGNED(ALIGN, uint8_t, temp)[SIZE*(SIZE<8?12:24)*2 + SIZE*SIZE];\
+ uint8_t * const halfHV= temp;\
+ int16_t * const halfV= (int16_t*)(temp + SIZE*SIZE);\
+ assert(((int)temp & 7) == 0);\
+ ff_put_h264_qpel ## SIZE ## _hv_lowpass_ ## MMX(halfHV, halfV, src, SIZE, SIZE, stride);\
+ ff_ ## OPNAME ## h264_qpel ## SIZE ## _h_lowpass_l2_ ## MMX(dst, src, halfHV, stride, SIZE);\
+}\
+\
+static void OPNAME ## h264_qpel ## SIZE ## _mc23_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
+ DECLARE_ALIGNED(ALIGN, uint8_t, temp)[SIZE*(SIZE<8?12:24)*2 + SIZE*SIZE];\
+ uint8_t * const halfHV= temp;\
+ int16_t * const halfV= (int16_t*)(temp + SIZE*SIZE);\
+ assert(((int)temp & 7) == 0);\
+ ff_put_h264_qpel ## SIZE ## _hv_lowpass_ ## MMX(halfHV, halfV, src, SIZE, SIZE, stride);\
+ ff_ ## OPNAME ## h264_qpel ## SIZE ## _h_lowpass_l2_ ## MMX(dst, src+stride, halfHV, stride, SIZE);\
+}\
+\
+static void OPNAME ## h264_qpel ## SIZE ## _mc12_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
+ DECLARE_ALIGNED(ALIGN, uint8_t, temp)[SIZE*(SIZE<8?12:24)*2 + SIZE*SIZE];\
+ uint8_t * const halfHV= temp;\
+ int16_t * const halfV= (int16_t*)(temp + SIZE*SIZE);\
+ assert(((int)temp & 7) == 0);\
+ ff_put_h264_qpel ## SIZE ## _hv_lowpass_ ## MMX(halfHV, halfV, src, SIZE, SIZE, stride);\
+ ff_ ## OPNAME ## pixels ## SIZE ## _l2_shift5_mmxext(dst, halfV+2, halfHV, stride, SIZE, SIZE);\
+}\
+\
+static void OPNAME ## h264_qpel ## SIZE ## _mc32_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
+ DECLARE_ALIGNED(ALIGN, uint8_t, temp)[SIZE*(SIZE<8?12:24)*2 + SIZE*SIZE];\
+ uint8_t * const halfHV= temp;\
+ int16_t * const halfV= (int16_t*)(temp + SIZE*SIZE);\
+ assert(((int)temp & 7) == 0);\
+ ff_put_h264_qpel ## SIZE ## _hv_lowpass_ ## MMX(halfHV, halfV, src, SIZE, SIZE, stride);\
+ ff_ ## OPNAME ## pixels ## SIZE ## _l2_shift5_mmxext(dst, halfV+3, halfHV, stride, SIZE, SIZE);\
+}\
+
+#define H264_MC_4816(MMX)\
+H264_MC(put_, 4, MMX, 8)\
+H264_MC(put_, 8, MMX, 8)\
+H264_MC(put_, 16,MMX, 8)\
+H264_MC(avg_, 4, MMX, 8)\
+H264_MC(avg_, 8, MMX, 8)\
+H264_MC(avg_, 16,MMX, 8)\
+
+#define H264_MC_816(QPEL, XMM)\
+QPEL(put_, 8, XMM, 16)\
+QPEL(put_, 16,XMM, 16)\
+QPEL(avg_, 8, XMM, 16)\
+QPEL(avg_, 16,XMM, 16)\
+
+#undef PAVGB
+#define PAVGB "pavgb"
+QPEL_H264(put_, PUT_OP, mmxext)
+QPEL_H264(avg_, AVG_MMXEXT_OP, mmxext)
+QPEL_H264_V_XMM(put_, PUT_OP, sse2)
+QPEL_H264_V_XMM(avg_,AVG_MMXEXT_OP, sse2)
+QPEL_H264_HV_XMM(put_, PUT_OP, sse2)
+QPEL_H264_HV_XMM(avg_,AVG_MMXEXT_OP, sse2)
+QPEL_H264_H_XMM(put_, PUT_OP, ssse3)
+QPEL_H264_H_XMM(avg_,AVG_MMXEXT_OP, ssse3)
+QPEL_H264_HV_XMM(put_, PUT_OP, ssse3)
+QPEL_H264_HV_XMM(avg_,AVG_MMXEXT_OP, ssse3)
+#undef PAVGB
+
+H264_MC_4816(mmxext)
+H264_MC_816(H264_MC_V, sse2)
+H264_MC_816(H264_MC_HV, sse2)
+H264_MC_816(H264_MC_H, ssse3)
+H264_MC_816(H264_MC_HV, ssse3)
+
+
+//10bit
+#define LUMA_MC_OP(OP, NUM, DEPTH, TYPE, OPT) \
+void ff_ ## OP ## _h264_qpel ## NUM ## _ ## TYPE ## _ ## DEPTH ## _ ## OPT \
+ (uint8_t *dst, uint8_t *src, int stride);
+
+#define LUMA_MC_ALL(DEPTH, TYPE, OPT) \
+ LUMA_MC_OP(put, 4, DEPTH, TYPE, OPT) \
+ LUMA_MC_OP(avg, 4, DEPTH, TYPE, OPT) \
+ LUMA_MC_OP(put, 8, DEPTH, TYPE, OPT) \
+ LUMA_MC_OP(avg, 8, DEPTH, TYPE, OPT) \
+ LUMA_MC_OP(put, 16, DEPTH, TYPE, OPT) \
+ LUMA_MC_OP(avg, 16, DEPTH, TYPE, OPT)
+
+#define LUMA_MC_816(DEPTH, TYPE, OPT) \
+ LUMA_MC_OP(put, 8, DEPTH, TYPE, OPT) \
+ LUMA_MC_OP(avg, 8, DEPTH, TYPE, OPT) \
+ LUMA_MC_OP(put, 16, DEPTH, TYPE, OPT) \
+ LUMA_MC_OP(avg, 16, DEPTH, TYPE, OPT)
+
+LUMA_MC_ALL(10, mc00, mmxext)
+LUMA_MC_ALL(10, mc10, mmxext)
+LUMA_MC_ALL(10, mc20, mmxext)
+LUMA_MC_ALL(10, mc30, mmxext)
+LUMA_MC_ALL(10, mc01, mmxext)
+LUMA_MC_ALL(10, mc11, mmxext)
+LUMA_MC_ALL(10, mc21, mmxext)
+LUMA_MC_ALL(10, mc31, mmxext)
+LUMA_MC_ALL(10, mc02, mmxext)
+LUMA_MC_ALL(10, mc12, mmxext)
+LUMA_MC_ALL(10, mc22, mmxext)
+LUMA_MC_ALL(10, mc32, mmxext)
+LUMA_MC_ALL(10, mc03, mmxext)
+LUMA_MC_ALL(10, mc13, mmxext)
+LUMA_MC_ALL(10, mc23, mmxext)
+LUMA_MC_ALL(10, mc33, mmxext)
+
+LUMA_MC_816(10, mc00, sse2)
+LUMA_MC_816(10, mc10, sse2)
+LUMA_MC_816(10, mc10, sse2_cache64)
+LUMA_MC_816(10, mc10, ssse3_cache64)
+LUMA_MC_816(10, mc20, sse2)
+LUMA_MC_816(10, mc20, sse2_cache64)
+LUMA_MC_816(10, mc20, ssse3_cache64)
+LUMA_MC_816(10, mc30, sse2)
+LUMA_MC_816(10, mc30, sse2_cache64)
+LUMA_MC_816(10, mc30, ssse3_cache64)
+LUMA_MC_816(10, mc01, sse2)
+LUMA_MC_816(10, mc11, sse2)
+LUMA_MC_816(10, mc21, sse2)
+LUMA_MC_816(10, mc31, sse2)
+LUMA_MC_816(10, mc02, sse2)
+LUMA_MC_816(10, mc12, sse2)
+LUMA_MC_816(10, mc22, sse2)
+LUMA_MC_816(10, mc32, sse2)
+LUMA_MC_816(10, mc03, sse2)
+LUMA_MC_816(10, mc13, sse2)
+LUMA_MC_816(10, mc23, sse2)
+LUMA_MC_816(10, mc33, sse2)
+
+#define QPEL16_OPMC(OP, MC, MMX)\
+void ff_ ## OP ## _h264_qpel16_ ## MC ## _10_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
+ ff_ ## OP ## _h264_qpel8_ ## MC ## _10_ ## MMX(dst , src , stride);\
+ ff_ ## OP ## _h264_qpel8_ ## MC ## _10_ ## MMX(dst+16, src+16, stride);\
+ src += 8*stride;\
+ dst += 8*stride;\
+ ff_ ## OP ## _h264_qpel8_ ## MC ## _10_ ## MMX(dst , src , stride);\
+ ff_ ## OP ## _h264_qpel8_ ## MC ## _10_ ## MMX(dst+16, src+16, stride);\
+}
+
+#define QPEL16_OP(MC, MMX)\
+QPEL16_OPMC(put, MC, MMX)\
+QPEL16_OPMC(avg, MC, MMX)
+
+#define QPEL16(MMX)\
+QPEL16_OP(mc00, MMX)\
+QPEL16_OP(mc01, MMX)\
+QPEL16_OP(mc02, MMX)\
+QPEL16_OP(mc03, MMX)\
+QPEL16_OP(mc10, MMX)\
+QPEL16_OP(mc11, MMX)\
+QPEL16_OP(mc12, MMX)\
+QPEL16_OP(mc13, MMX)\
+QPEL16_OP(mc20, MMX)\
+QPEL16_OP(mc21, MMX)\
+QPEL16_OP(mc22, MMX)\
+QPEL16_OP(mc23, MMX)\
+QPEL16_OP(mc30, MMX)\
+QPEL16_OP(mc31, MMX)\
+QPEL16_OP(mc32, MMX)\
+QPEL16_OP(mc33, MMX)
+
+#if ARCH_X86_32 && HAVE_YASM && CONFIG_H264QPEL // ARCH_X86_64 implies SSE2+
+QPEL16(mmxext)
+#endif
+
+#endif /* HAVE_YASM */
diff --git a/gst-libs/ext/libav/libavcodec/x86/h264_qpel_10bit.asm b/gst-libs/ext/libav/libavcodec/x86/h264_qpel_10bit.asm
index cafd4da..e14df84 100644
--- a/gst-libs/ext/libav/libavcodec/x86/h264_qpel_10bit.asm
+++ b/gst-libs/ext/libav/libavcodec/x86/h264_qpel_10bit.asm
@@ -22,8 +22,7 @@
;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
;******************************************************************************
-%include "x86inc.asm"
-%include "x86util.asm"
+%include "libavutil/x86/x86util.asm"
SECTION_RODATA 32
@@ -98,79 +97,73 @@ SECTION .text
%macro MC 1
%define OP_MOV mova
-INIT_MMX
-%1 mmxext, put, 4
-INIT_XMM
-%1 sse2 , put, 8
+INIT_MMX mmxext
+%1 put, 4
+INIT_XMM sse2
+%1 put, 8
%define OP_MOV AVG_MOV
-INIT_MMX
-%1 mmxext, avg, 4
-INIT_XMM
-%1 sse2 , avg, 8
+INIT_MMX mmxext
+%1 avg, 4
+INIT_XMM sse2
+%1 avg, 8
%endmacro
-%macro MCAxA 8
-%ifdef ARCH_X86_64
-%ifnidn %1,mmxext
-MCAxA_OP %1,%2,%3,%4,%5,%6,%7,%8
-%endif
-%else
-MCAxA_OP %1,%2,%3,%4,%5,%6,%7,%8
-%endif
-%endmacro
-
-%macro MCAxA_OP 8
-cglobal %2_h264_qpel%5_%3_10_%1, %6,%7,%8
-%ifdef ARCH_X86_32
- call stub_%2_h264_qpel%4_%3_10_%1
+%macro MCAxA_OP 7
+%if ARCH_X86_32
+cglobal %1_h264_qpel%4_%2_10, %5,%6,%7
+ call stub_%1_h264_qpel%3_%2_10 %+ SUFFIX
mov r0, r0m
mov r1, r1m
- add r0, %4*2
- add r1, %4*2
- call stub_%2_h264_qpel%4_%3_10_%1
+ add r0, %3*2
+ add r1, %3*2
+ call stub_%1_h264_qpel%3_%2_10 %+ SUFFIX
mov r0, r0m
mov r1, r1m
- lea r0, [r0+r2*%4]
- lea r1, [r1+r2*%4]
- call stub_%2_h264_qpel%4_%3_10_%1
+ lea r0, [r0+r2*%3]
+ lea r1, [r1+r2*%3]
+ call stub_%1_h264_qpel%3_%2_10 %+ SUFFIX
mov r0, r0m
mov r1, r1m
- lea r0, [r0+r2*%4+%4*2]
- lea r1, [r1+r2*%4+%4*2]
- call stub_%2_h264_qpel%4_%3_10_%1
+ lea r0, [r0+r2*%3+%3*2]
+ lea r1, [r1+r2*%3+%3*2]
+ call stub_%1_h264_qpel%3_%2_10 %+ SUFFIX
RET
%else ; ARCH_X86_64
- mov r10, r0
- mov r11, r1
- call stub_%2_h264_qpel%4_%3_10_%1
- lea r0, [r10+%4*2]
- lea r1, [r11+%4*2]
- call stub_%2_h264_qpel%4_%3_10_%1
- lea r0, [r10+r2*%4]
- lea r1, [r11+r2*%4]
- call stub_%2_h264_qpel%4_%3_10_%1
- lea r0, [r10+r2*%4+%4*2]
- lea r1, [r11+r2*%4+%4*2]
-%ifndef UNIX64 ; fall through to function
- call stub_%2_h264_qpel%4_%3_10_%1
+cglobal %1_h264_qpel%4_%2_10, %5,%6 + 2,%7
+ mov r%6, r0
+%assign p1 %6+1
+ mov r %+ p1, r1
+ call stub_%1_h264_qpel%3_%2_10 %+ SUFFIX
+ lea r0, [r%6+%3*2]
+ lea r1, [r %+ p1+%3*2]
+ call stub_%1_h264_qpel%3_%2_10 %+ SUFFIX
+ lea r0, [r%6+r2*%3]
+ lea r1, [r %+ p1+r2*%3]
+ call stub_%1_h264_qpel%3_%2_10 %+ SUFFIX
+ lea r0, [r%6+r2*%3+%3*2]
+ lea r1, [r %+ p1+r2*%3+%3*2]
+%if UNIX64 == 0 ; fall through to function
+ call stub_%1_h264_qpel%3_%2_10 %+ SUFFIX
RET
%endif
%endif
%endmacro
;cpu, put/avg, mc, 4/8, ...
-%macro cglobal_mc 7
-%assign i %4*2
-MCAxA %1, %2, %3, %4, i, %5,%6,%7
+%macro cglobal_mc 6
+%assign i %3*2
+%if ARCH_X86_32 || cpuflag(sse2)
+MCAxA_OP %1, %2, %3, i, %4,%5,%6
+%endif
-cglobal %2_h264_qpel%4_%3_10_%1, %5,%6,%7
-%ifndef UNIX64 ; no prologue or epilogue for UNIX64
- call stub_%2_h264_qpel%4_%3_10_%1
+cglobal %1_h264_qpel%3_%2_10, %4,%5,%6
+%if UNIX64 == 0 ; no prologue or epilogue for UNIX64
+ call stub_%1_h264_qpel%3_%2_10 %+ SUFFIX
RET
%endif
-stub_%2_h264_qpel%4_%3_10_%1:
+stub_%1_h264_qpel%3_%2_10 %+ SUFFIX:
%endmacro
;-----------------------------------------------------------------------------
@@ -188,14 +181,14 @@ stub_%2_h264_qpel%4_%3_10_%1:
%endmacro
%macro MC00 1
-INIT_MMX
-cglobal_mc mmxext, %1, mc00, 4, 3,4,0
+INIT_MMX mmxext
+cglobal_mc %1, mc00, 4, 3,4,0
lea r3, [r2*3]
COPY4
ret
-INIT_XMM
-cglobal %1_h264_qpel8_mc00_10_sse2, 3,4
+INIT_XMM sse2
+cglobal %1_h264_qpel8_mc00_10, 3,4
lea r3, [r2*3]
COPY4
lea r0, [r0+r2*4]
@@ -203,7 +196,7 @@ cglobal %1_h264_qpel8_mc00_10_sse2, 3,4
COPY4
RET
-cglobal %1_h264_qpel16_mc00_10_sse2, 3,4
+cglobal %1_h264_qpel16_mc00_10, 3,4
mov r3d, 8
.loop:
movu m0, [r1 ]
@@ -232,29 +225,29 @@ MC00 avg
;-----------------------------------------------------------------------------
%macro MC_CACHE 1
%define OP_MOV mova
-%define PALIGNR PALIGNR_MMX
-INIT_MMX
-%1 mmxext , put, 4
-INIT_XMM
-%1 sse2_cache64 , put, 8
-%define PALIGNR PALIGNR_SSSE3
-%1 ssse3_cache64, put, 8
-%1 sse2 , put, 8, 0
+INIT_MMX mmxext
+%1 put, 4
+INIT_XMM sse2, cache64
+%1 put, 8
+INIT_XMM ssse3, cache64
+%1 put, 8
+INIT_XMM sse2
+%1 put, 8
%define OP_MOV AVG_MOV
-%define PALIGNR PALIGNR_MMX
-INIT_MMX
-%1 mmxext , avg, 4
-INIT_XMM
-%1 sse2_cache64 , avg, 8
-%define PALIGNR PALIGNR_SSSE3
-%1 ssse3_cache64, avg, 8
-%1 sse2 , avg, 8, 0
-%endmacro
-
-%macro MC20 3-4
-cglobal_mc %1, %2, mc20, %3, 3,4,9
- mov r3d, %3
+INIT_MMX mmxext
+%1 avg, 4
+INIT_XMM sse2, cache64
+%1 avg, 8
+INIT_XMM ssse3, cache64
+%1 avg, 8
+INIT_XMM sse2
+%1 avg, 8
+%endmacro
+
+%macro MC20 2
+cglobal_mc %1, mc20, %2, 3,4,9
+ mov r3d, %2
mova m1, [pw_pixel_max]
%if num_mmregs > 8
mova m8, [pw_16]
@@ -262,7 +255,7 @@ cglobal_mc %1, %2, mc20, %3, 3,4,9
%else
%define p16 [pw_16]
%endif
-.nextrow
+.nextrow:
%if %0 == 4
movu m2, [r1-4]
movu m3, [r1-2]
@@ -314,10 +307,10 @@ MC_CACHE MC20
;-----------------------------------------------------------------------------
; void h264_qpel_mc30(uint8_t *dst, uint8_t *src, int stride)
;-----------------------------------------------------------------------------
-%macro MC30 3-4
-cglobal_mc %1, %2, mc30, %3, 3,5,9
+%macro MC30 2
+cglobal_mc %1, mc30, %2, 3,5,9
lea r4, [r1+2]
- jmp stub_%2_h264_qpel%3_mc10_10_%1.body
+ jmp stub_%1_h264_qpel%2_mc10_10 %+ SUFFIX %+ .body
%endmacro
MC_CACHE MC30
@@ -325,11 +318,11 @@ MC_CACHE MC30
;-----------------------------------------------------------------------------
; void h264_qpel_mc10(uint8_t *dst, uint8_t *src, int stride)
;-----------------------------------------------------------------------------
-%macro MC10 3-4
-cglobal_mc %1, %2, mc10, %3, 3,5,9
+%macro MC10 2
+cglobal_mc %1, mc10, %2, 3,5,9
mov r4, r1
-.body
- mov r3d, %3
+.body:
+ mov r3d, %2
mova m1, [pw_pixel_max]
%if num_mmregs > 8
mova m8, [pw_16]
@@ -337,7 +330,7 @@ cglobal_mc %1, %2, mc10, %3, 3,5,9
%else
%define p16 [pw_16]
%endif
-.nextrow
+.nextrow:
%if %0 == 4
movu m2, [r1-4]
movu m3, [r1-2]
@@ -392,8 +385,8 @@ MC_CACHE MC10
;-----------------------------------------------------------------------------
; void h264_qpel_mc02(uint8_t *dst, uint8_t *src, int stride)
;-----------------------------------------------------------------------------
-%macro V_FILT 11
-v_filt%9_%10_10_%11:
+%macro V_FILT 10
+v_filt%9_%10_10
add r4, r2
.no_addr4:
FILT_V m0, m1, m2, m3, m4, m5, m6, m7
@@ -402,33 +395,33 @@ v_filt%9_%10_10_%11:
ret
%endmacro
-INIT_MMX
+INIT_MMX mmxext
RESET_MM_PERMUTATION
%assign i 0
%rep 4
-V_FILT m0, m1, m2, m3, m4, m5, m6, m7, 4, i, mmxext
+V_FILT m0, m1, m2, m3, m4, m5, m6, m7, 4, i
SWAP 0,1,2,3,4,5
%assign i i+1
%endrep
-INIT_XMM
+INIT_XMM sse2
RESET_MM_PERMUTATION
%assign i 0
%rep 6
-V_FILT m0, m1, m2, m3, m4, m5, m6, m7, 8, i, sse2
+V_FILT m0, m1, m2, m3, m4, m5, m6, m7, 8, i
SWAP 0,1,2,3,4,5
%assign i i+1
%endrep
-%macro MC02 3
-cglobal_mc %1, %2, mc02, %3, 3,4,8
+%macro MC02 2
+cglobal_mc %1, mc02, %2, 3,4,8
PRELOAD_V
sub r0, r2
%assign j 0
-%rep %3
+%rep %2
%assign i (j % 6)
- call v_filt%3_ %+ i %+ _10_%1.no_addr4
+ call v_filt%2_ %+ i %+ _10.no_addr4
OP_MOV [r0], m0
SWAP 0,1,2,3,4,5
%assign j j+1
@@ -441,18 +434,18 @@ MC MC02
;-----------------------------------------------------------------------------
; void h264_qpel_mc01(uint8_t *dst, uint8_t *src, int stride)
;-----------------------------------------------------------------------------
-%macro MC01 3
-cglobal_mc %1, %2, mc01, %3, 3,5,8
+%macro MC01 2
+cglobal_mc %1, mc01, %2, 3,5,8
mov r4, r1
-.body
+.body:
PRELOAD_V
sub r4, r2
sub r0, r2
%assign j 0
-%rep %3
+%rep %2
%assign i (j % 6)
- call v_filt%3_ %+ i %+ _10_%1
+ call v_filt%2_ %+ i %+ _10
movu m7, [r4]
pavgw m0, m7
OP_MOV [r0], m0
@@ -467,10 +460,10 @@ MC MC01
;-----------------------------------------------------------------------------
; void h264_qpel_mc03(uint8_t *dst, uint8_t *src, int stride)
;-----------------------------------------------------------------------------
-%macro MC03 3
-cglobal_mc %1, %2, mc03, %3, 3,5,8
+%macro MC03 2
+cglobal_mc %1, mc03, %2, 3,5,8
lea r4, [r1+r2]
- jmp stub_%2_h264_qpel%3_mc01_10_%1.body
+ jmp stub_%1_h264_qpel%2_mc01_10 %+ SUFFIX %+ .body
%endmacro
MC MC03
@@ -478,8 +471,8 @@ MC MC03
;-----------------------------------------------------------------------------
; void h264_qpel_mc11(uint8_t *dst, uint8_t *src, int stride)
;-----------------------------------------------------------------------------
-%macro H_FILT_AVG 3-4
-h_filt%2_%3_10_%1:
+%macro H_FILT_AVG 2-3
+h_filt%1_%2_10:
;FILT_H with fewer registers and averaged with the FILT_V result
;m6,m7 are tmp registers, m0 is the FILT_V result, the rest are to be used next in the next iteration
;unfortunately I need three registers, so m5 will have to be re-read from memory
@@ -506,34 +499,34 @@ h_filt%2_%3_10_%1:
ret
%endmacro
-INIT_MMX
+INIT_MMX mmxext
RESET_MM_PERMUTATION
%assign i 0
%rep 3
-H_FILT_AVG mmxext, 4, i
+H_FILT_AVG 4, i
SWAP 0,1,2,3,4,5
%assign i i+1
%endrep
-H_FILT_AVG mmxext, 4, i, 0
+H_FILT_AVG 4, i, 0
-INIT_XMM
+INIT_XMM sse2
RESET_MM_PERMUTATION
%assign i 0
%rep 6
%if i==1
-H_FILT_AVG sse2, 8, i, 0
+H_FILT_AVG 8, i, 0
%else
-H_FILT_AVG sse2, 8, i
+H_FILT_AVG 8, i
%endif
SWAP 0,1,2,3,4,5
%assign i i+1
%endrep
-%macro MC11 3
+%macro MC11 2
; this REALLY needs x86_64
-cglobal_mc %1, %2, mc11, %3, 3,6,8
+cglobal_mc %1, mc11, %2, 3,6,8
mov r4, r1
-.body
+.body:
PRELOAD_V
sub r0, r2
@@ -541,11 +534,11 @@ cglobal_mc %1, %2, mc11, %3, 3,6,8
mov r5, r2
neg r5
%assign j 0
-%rep %3
+%rep %2
%assign i (j % 6)
- call v_filt%3_ %+ i %+ _10_%1
- call h_filt%3_ %+ i %+ _10_%1
-%if %3==8 && i==1
+ call v_filt%2_ %+ i %+ _10
+ call h_filt%2_ %+ i %+ _10
+%if %2==8 && i==1
movu m5, [r1+r5]
%endif
OP_MOV [r0], m0
@@ -560,11 +553,11 @@ MC MC11
;-----------------------------------------------------------------------------
; void h264_qpel_mc31(uint8_t *dst, uint8_t *src, int stride)
;-----------------------------------------------------------------------------
-%macro MC31 3
-cglobal_mc %1, %2, mc31, %3, 3,6,8
+%macro MC31 2
+cglobal_mc %1, mc31, %2, 3,6,8
mov r4, r1
add r1, 2
- jmp stub_%2_h264_qpel%3_mc11_10_%1.body
+ jmp stub_%1_h264_qpel%2_mc11_10 %+ SUFFIX %+ .body
%endmacro
MC MC31
@@ -572,10 +565,10 @@ MC MC31
;-----------------------------------------------------------------------------
; void h264_qpel_mc13(uint8_t *dst, uint8_t *src, int stride)
;-----------------------------------------------------------------------------
-%macro MC13 3
-cglobal_mc %1, %2, mc13, %3, 3,7,12
+%macro MC13 2
+cglobal_mc %1, mc13, %2, 3,7,12
lea r4, [r1+r2]
- jmp stub_%2_h264_qpel%3_mc11_10_%1.body
+ jmp stub_%1_h264_qpel%2_mc11_10 %+ SUFFIX %+ .body
%endmacro
MC MC13
@@ -583,11 +576,11 @@ MC MC13
;-----------------------------------------------------------------------------
; void h264_qpel_mc33(uint8_t *dst, uint8_t *src, int stride)
;-----------------------------------------------------------------------------
-%macro MC33 3
-cglobal_mc %1, %2, mc33, %3, 3,6,8
+%macro MC33 2
+cglobal_mc %1, mc33, %2, 3,6,8
lea r4, [r1+r2]
add r1, 2
- jmp stub_%2_h264_qpel%3_mc11_10_%1.body
+ jmp stub_%1_h264_qpel%2_mc11_10 %+ SUFFIX %+ .body
%endmacro
MC MC33
@@ -614,15 +607,15 @@ MC MC33
FILT_H2 %1, %7, %8
%endmacro
-%macro HV 2
-%ifidn %1,sse2
+%macro HV 1
+%if mmsize==16
%define PAD 12
%define COUNT 2
%else
%define PAD 4
%define COUNT 3
%endif
-put_hv%2_10_%1:
+put_hv%1_10:
neg r2 ; This actually saves instructions
lea r1, [r1+r2*2-mmsize+PAD]
lea r4, [rsp+PAD+gprsize]
@@ -639,7 +632,7 @@ put_hv%2_10_%1:
movu m4, [r1]
sub r1, r2
%assign i 0
-%rep %2-1
+%rep %1-1
FILT_VNRD m0, m1, m2, m3, m4, m5, m6, m7
psubw m0, [pad20]
movu [r4+i*mmsize*3], m0
@@ -652,7 +645,7 @@ put_hv%2_10_%1:
movu [r4+i*mmsize*3], m0
add r4, mmsize
lea r1, [r1+r2*8+mmsize]
-%if %2==8
+%if %1==8
lea r1, [r1+r2*4]
%endif
dec r3d
@@ -661,12 +654,12 @@ put_hv%2_10_%1:
ret
%endmacro
-INIT_MMX
-HV mmxext, 4
-INIT_XMM
-HV sse2 , 8
+INIT_MMX mmxext
+HV 4
+INIT_XMM sse2
+HV 8
-%macro H_LOOP 2
+%macro H_LOOP 1
%if num_mmregs > 8
%define s1 m8
%define s2 m9
@@ -678,7 +671,7 @@ HV sse2 , 8
%define s3 [tap3]
%define d1 [depad]
%endif
-h%2_loop_op_%1:
+h%1_loop_op:
movu m1, [r1+mmsize-4]
movu m2, [r1+mmsize-2]
mova m3, [r1+mmsize+0]
@@ -725,21 +718,21 @@ h%2_loop_op_%1:
ret
%endmacro
-INIT_MMX
-H_LOOP mmxext, 4
-INIT_XMM
-H_LOOP sse2 , 8
+INIT_MMX mmxext
+H_LOOP 4
+INIT_XMM sse2
+H_LOOP 8
-%macro MC22 3
-cglobal_mc %1, %2, mc22, %3, 3,7,12
+%macro MC22 2
+cglobal_mc %1, mc22, %2, 3,7,12
%define PAD mmsize*8*4*2 ; SIZE*16*4*sizeof(pixel)
mov r6, rsp ; backup stack pointer
and rsp, ~(mmsize-1) ; align stack
sub rsp, PAD
- call put_hv%3_10_%1
+ call put_hv%2_10
- mov r3d, %3
+ mov r3d, %2
mova m7, [pw_pixel_max]
%if num_mmregs > 8
pxor m0, m0
@@ -750,7 +743,7 @@ cglobal_mc %1, %2, mc22, %3, 3,7,12
%endif
mov r1, rsp
.h_loop:
- call h%3_loop_op_%1
+ call h%2_loop_op
OP_MOV [r0], m1
add r0, r2
@@ -766,18 +759,18 @@ MC MC22
;-----------------------------------------------------------------------------
; void h264_qpel_mc12(uint8_t *dst, uint8_t *src, int stride)
;-----------------------------------------------------------------------------
-%macro MC12 3
-cglobal_mc %1, %2, mc12, %3, 3,7,12
+%macro MC12 2
+cglobal_mc %1, mc12, %2, 3,7,12
%define PAD mmsize*8*4*2 ; SIZE*16*4*sizeof(pixel)
mov r6, rsp ; backup stack pointer
and rsp, ~(mmsize-1) ; align stack
sub rsp, PAD
- call put_hv%3_10_%1
+ call put_hv%2_10
xor r4d, r4d
-.body
- mov r3d, %3
+.body:
+ mov r3d, %2
pxor m0, m0
mova m7, [pw_pixel_max]
%if num_mmregs > 8
@@ -788,7 +781,7 @@ cglobal_mc %1, %2, mc12, %3, 3,7,12
%endif
mov r1, rsp
.h_loop:
- call h%3_loop_op_%1
+ call h%2_loop_op
movu m3, [r1+r4-2*mmsize] ; movu needed for mc32, etc
paddw m3, [depad2]
@@ -811,17 +804,17 @@ MC MC12
;-----------------------------------------------------------------------------
; void h264_qpel_mc32(uint8_t *dst, uint8_t *src, int stride)
;-----------------------------------------------------------------------------
-%macro MC32 3
-cglobal_mc %1, %2, mc32, %3, 3,7,12
+%macro MC32 2
+cglobal_mc %1, mc32, %2, 3,7,12
%define PAD mmsize*8*3*2 ; SIZE*16*4*sizeof(pixel)
mov r6, rsp ; backup stack pointer
and rsp, ~(mmsize-1) ; align stack
sub rsp, PAD
- call put_hv%3_10_%1
+ call put_hv%2_10
mov r4d, 2 ; sizeof(pixel)
- jmp stub_%2_h264_qpel%3_mc12_10_%1.body
+ jmp stub_%1_h264_qpel%2_mc12_10 %+ SUFFIX %+ .body
%endmacro
MC MC32
@@ -829,13 +822,13 @@ MC MC32
;-----------------------------------------------------------------------------
; void h264_qpel_mc21(uint8_t *dst, uint8_t *src, int stride)
;-----------------------------------------------------------------------------
-%macro H_NRD 2
-put_h%2_10_%1:
+%macro H_NRD 1
+put_h%1_10:
add rsp, gprsize
- mov r3d, %2
+ mov r3d, %1
xor r4d, r4d
mova m6, [pad20]
-.nextrow
+.nextrow:
movu m2, [r5-4]
movu m3, [r5-2]
movu m4, [r5+0]
@@ -854,27 +847,27 @@ put_h%2_10_%1:
ret
%endmacro
-INIT_MMX
-H_NRD mmxext, 4
-INIT_XMM
-H_NRD sse2 , 8
+INIT_MMX mmxext
+H_NRD 4
+INIT_XMM sse2
+H_NRD 8
-%macro MC21 3
-cglobal_mc %1, %2, mc21, %3, 3,7,12
+%macro MC21 2
+cglobal_mc %1, mc21, %2, 3,7,12
mov r5, r1
-.body
+.body:
%define PAD mmsize*8*3*2 ; SIZE*16*4*sizeof(pixel)
mov r6, rsp ; backup stack pointer
and rsp, ~(mmsize-1) ; align stack
sub rsp, PAD
- call put_h%3_10_%1
+ call put_h%2_10
sub rsp, PAD
- call put_hv%3_10_%1
+ call put_hv%2_10
mov r4d, PAD-mmsize ; H buffer
- jmp stub_%2_h264_qpel%3_mc12_10_%1.body
+ jmp stub_%1_h264_qpel%2_mc12_10 %+ SUFFIX %+ .body
%endmacro
MC MC21
@@ -882,10 +875,10 @@ MC MC21
;-----------------------------------------------------------------------------
; void h264_qpel_mc23(uint8_t *dst, uint8_t *src, int stride)
;-----------------------------------------------------------------------------
-%macro MC23 3
-cglobal_mc %1, %2, mc23, %3, 3,7,12
+%macro MC23 2
+cglobal_mc %1, mc23, %2, 3,7,12
lea r5, [r1+r2]
- jmp stub_%2_h264_qpel%3_mc21_10_%1.body
+ jmp stub_%1_h264_qpel%2_mc21_10 %+ SUFFIX %+ .body
%endmacro
MC MC23
diff --git a/gst-libs/ext/libav/libavcodec/x86/h264_qpel_8bit.asm b/gst-libs/ext/libav/libavcodec/x86/h264_qpel_8bit.asm
new file mode 100644
index 0000000..bc6c725
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/x86/h264_qpel_8bit.asm
@@ -0,0 +1,862 @@
+;*****************************************************************************
+;* MMX/SSE2/SSSE3-optimized H.264 QPEL code
+;*****************************************************************************
+;* Copyright (c) 2004-2005 Michael Niedermayer, Loren Merritt
+;* Copyright (C) 2012 Daniel Kang
+;*
+;* Authors: Daniel Kang <daniel.d.kang@gmail.com>
+;*
+;* 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
+;******************************************************************************
+
+%include "libavutil/x86/x86util.asm"
+
+SECTION_RODATA 32
+
+cextern pw_16
+cextern pw_5
+cextern pb_0
+
+SECTION .text
+
+
+%macro op_avgh 3
+ movh %3, %2
+ pavgb %1, %3
+ movh %2, %1
+%endmacro
+
+%macro op_avg 2-3
+ pavgb %1, %2
+ mova %2, %1
+%endmacro
+
+%macro op_puth 2-3
+ movh %2, %1
+%endmacro
+
+%macro op_put 2-3
+ mova %2, %1
+%endmacro
+
+%macro QPEL4_H_LOWPASS_OP 1
+cglobal %1_h264_qpel4_h_lowpass, 4,5 ; dst, src, dstStride, srcStride
+ movsxdifnidn r2, r2d
+ movsxdifnidn r3, r3d
+ pxor m7, m7
+ mova m4, [pw_5]
+ mova m5, [pw_16]
+ mov r4d, 4
+.loop:
+ movh m1, [r1-1]
+ movh m2, [r1+0]
+ movh m3, [r1+1]
+ movh m0, [r1+2]
+ punpcklbw m1, m7
+ punpcklbw m2, m7
+ punpcklbw m3, m7
+ punpcklbw m0, m7
+ paddw m1, m0
+ paddw m2, m3
+ movh m0, [r1-2]
+ movh m3, [r1+3]
+ punpcklbw m0, m7
+ punpcklbw m3, m7
+ paddw m0, m3
+ psllw m2, 2
+ psubw m2, m1
+ pmullw m2, m4
+ paddw m0, m5
+ paddw m0, m2
+ psraw m0, 5
+ packuswb m0, m0
+ op_%1h m0, [r0], m6
+ add r0, r2
+ add r1, r3
+ dec r4d
+ jg .loop
+ REP_RET
+%endmacro
+
+INIT_MMX mmxext
+QPEL4_H_LOWPASS_OP put
+QPEL4_H_LOWPASS_OP avg
+
+%macro QPEL8_H_LOWPASS_OP 1
+cglobal %1_h264_qpel8_h_lowpass, 4,5 ; dst, src, dstStride, srcStride
+ movsxdifnidn r2, r2d
+ movsxdifnidn r3, r3d
+ mov r4d, 8
+ pxor m7, m7
+ mova m6, [pw_5]
+.loop:
+ mova m0, [r1]
+ mova m2, [r1+1]
+ mova m1, m0
+ mova m3, m2
+ punpcklbw m0, m7
+ punpckhbw m1, m7
+ punpcklbw m2, m7
+ punpckhbw m3, m7
+ paddw m0, m2
+ paddw m1, m3
+ psllw m0, 2
+ psllw m1, 2
+ mova m2, [r1-1]
+ mova m4, [r1+2]
+ mova m3, m2
+ mova m5, m4
+ punpcklbw m2, m7
+ punpckhbw m3, m7
+ punpcklbw m4, m7
+ punpckhbw m5, m7
+ paddw m2, m4
+ paddw m5, m3
+ psubw m0, m2
+ psubw m1, m5
+ pmullw m0, m6
+ pmullw m1, m6
+ movd m2, [r1-2]
+ movd m5, [r1+7]
+ punpcklbw m2, m7
+ punpcklbw m5, m7
+ paddw m2, m3
+ paddw m4, m5
+ mova m5, [pw_16]
+ paddw m2, m5
+ paddw m4, m5
+ paddw m0, m2
+ paddw m1, m4
+ psraw m0, 5
+ psraw m1, 5
+ packuswb m0, m1
+ op_%1 m0, [r0], m4
+ add r0, r2
+ add r1, r3
+ dec r4d
+ jg .loop
+ REP_RET
+%endmacro
+
+INIT_MMX mmxext
+QPEL8_H_LOWPASS_OP put
+QPEL8_H_LOWPASS_OP avg
+
+%macro QPEL8_H_LOWPASS_OP_XMM 1
+cglobal %1_h264_qpel8_h_lowpass, 4,5,8 ; dst, src, dstStride, srcStride
+ movsxdifnidn r2, r2d
+ movsxdifnidn r3, r3d
+ mov r4d, 8
+ pxor m7, m7
+ mova m6, [pw_5]
+.loop:
+ movu m1, [r1-2]
+ mova m0, m1
+ punpckhbw m1, m7
+ punpcklbw m0, m7
+ mova m2, m1
+ mova m3, m1
+ mova m4, m1
+ mova m5, m1
+ palignr m4, m0, 2
+ palignr m3, m0, 4
+ palignr m2, m0, 6
+ palignr m1, m0, 8
+ palignr m5, m0, 10
+ paddw m0, m5
+ paddw m2, m3
+ paddw m1, m4
+ psllw m2, 2
+ psubw m2, m1
+ paddw m0, [pw_16]
+ pmullw m2, m6
+ paddw m2, m0
+ psraw m2, 5
+ packuswb m2, m2
+ op_%1h m2, [r0], m4
+ add r1, r3
+ add r0, r2
+ dec r4d
+ jne .loop
+ REP_RET
+%endmacro
+
+INIT_XMM ssse3
+QPEL8_H_LOWPASS_OP_XMM put
+QPEL8_H_LOWPASS_OP_XMM avg
+
+
+%macro QPEL4_H_LOWPASS_L2_OP 1
+cglobal %1_h264_qpel4_h_lowpass_l2, 5,6 ; dst, src, src2, dstStride, srcStride
+ movsxdifnidn r3, r3d
+ movsxdifnidn r4, r4d
+ pxor m7, m7
+ mova m4, [pw_5]
+ mova m5, [pw_16]
+ mov r5d, 4
+.loop:
+ movh m1, [r1-1]
+ movh m2, [r1+0]
+ movh m3, [r1+1]
+ movh m0, [r1+2]
+ punpcklbw m1, m7
+ punpcklbw m2, m7
+ punpcklbw m3, m7
+ punpcklbw m0, m7
+ paddw m1, m0
+ paddw m2, m3
+ movh m0, [r1-2]
+ movh m3, [r1+3]
+ punpcklbw m0, m7
+ punpcklbw m3, m7
+ paddw m0, m3
+ psllw m2, 2
+ psubw m2, m1
+ pmullw m2, m4
+ paddw m0, m5
+ paddw m0, m2
+ movh m3, [r2]
+ psraw m0, 5
+ packuswb m0, m0
+ pavgb m0, m3
+ op_%1h m0, [r0], m6
+ add r0, r3
+ add r1, r3
+ add r2, r4
+ dec r5d
+ jg .loop
+ REP_RET
+%endmacro
+
+INIT_MMX mmxext
+QPEL4_H_LOWPASS_L2_OP put
+QPEL4_H_LOWPASS_L2_OP avg
+
+
+%macro QPEL8_H_LOWPASS_L2_OP 1
+cglobal %1_h264_qpel8_h_lowpass_l2, 5,6 ; dst, src, src2, dstStride, srcStride
+ movsxdifnidn r3, r3d
+ movsxdifnidn r4, r4d
+ mov r5d, 8
+ pxor m7, m7
+ mova m6, [pw_5]
+.loop:
+ mova m0, [r1]
+ mova m2, [r1+1]
+ mova m1, m0
+ mova m3, m2
+ punpcklbw m0, m7
+ punpckhbw m1, m7
+ punpcklbw m2, m7
+ punpckhbw m3, m7
+ paddw m0, m2
+ paddw m1, m3
+ psllw m0, 2
+ psllw m1, 2
+ mova m2, [r1-1]
+ mova m4, [r1+2]
+ mova m3, m2
+ mova m5, m4
+ punpcklbw m2, m7
+ punpckhbw m3, m7
+ punpcklbw m4, m7
+ punpckhbw m5, m7
+ paddw m2, m4
+ paddw m5, m3
+ psubw m0, m2
+ psubw m1, m5
+ pmullw m0, m6
+ pmullw m1, m6
+ movd m2, [r1-2]
+ movd m5, [r1+7]
+ punpcklbw m2, m7
+ punpcklbw m5, m7
+ paddw m2, m3
+ paddw m4, m5
+ mova m5, [pw_16]
+ paddw m2, m5
+ paddw m4, m5
+ paddw m0, m2
+ paddw m1, m4
+ psraw m0, 5
+ psraw m1, 5
+ mova m4, [r2]
+ packuswb m0, m1
+ pavgb m0, m4
+ op_%1 m0, [r0], m4
+ add r0, r3
+ add r1, r3
+ add r2, r4
+ dec r5d
+ jg .loop
+ REP_RET
+%endmacro
+
+INIT_MMX mmxext
+QPEL8_H_LOWPASS_L2_OP put
+QPEL8_H_LOWPASS_L2_OP avg
+
+
+%macro QPEL8_H_LOWPASS_L2_OP_XMM 1
+cglobal %1_h264_qpel8_h_lowpass_l2, 5,6,8 ; dst, src, src2, dstStride, src2Stride
+ movsxdifnidn r3, r3d
+ movsxdifnidn r4, r4d
+ mov r5d, 8
+ pxor m7, m7
+ mova m6, [pw_5]
+.loop:
+ lddqu m1, [r1-2]
+ mova m0, m1
+ punpckhbw m1, m7
+ punpcklbw m0, m7
+ mova m2, m1
+ mova m3, m1
+ mova m4, m1
+ mova m5, m1
+ palignr m4, m0, 2
+ palignr m3, m0, 4
+ palignr m2, m0, 6
+ palignr m1, m0, 8
+ palignr m5, m0, 10
+ paddw m0, m5
+ paddw m2, m3
+ paddw m1, m4
+ psllw m2, 2
+ movh m3, [r2]
+ psubw m2, m1
+ paddw m0, [pw_16]
+ pmullw m2, m6
+ paddw m2, m0
+ psraw m2, 5
+ packuswb m2, m2
+ pavgb m2, m3
+ op_%1h m2, [r0], m4
+ add r1, r3
+ add r0, r3
+ add r2, r4
+ dec r5d
+ jg .loop
+ REP_RET
+%endmacro
+
+INIT_XMM ssse3
+QPEL8_H_LOWPASS_L2_OP_XMM put
+QPEL8_H_LOWPASS_L2_OP_XMM avg
+
+
+; All functions that call this are required to have function arguments of
+; dst, src, dstStride, srcStride
+%macro FILT_V 1
+ mova m6, m2
+ movh m5, [r1]
+ paddw m6, m3
+ psllw m6, 2
+ psubw m6, m1
+ psubw m6, m4
+ punpcklbw m5, m7
+ pmullw m6, [pw_5]
+ paddw m0, [pw_16]
+ add r1, r3
+ paddw m0, m5
+ paddw m6, m0
+ psraw m6, 5
+ packuswb m6, m6
+ op_%1h m6, [r0], m0 ; 1
+ add r0, r2
+ SWAP 0, 1, 2, 3, 4, 5
+%endmacro
+
+%macro QPEL4_V_LOWPASS_OP 1
+cglobal %1_h264_qpel4_v_lowpass, 4,4 ; dst, src, dstStride, srcStride
+ movsxdifnidn r2, r2d
+ movsxdifnidn r3, r3d
+ sub r1, r3
+ sub r1, r3
+ pxor m7, m7
+ movh m0, [r1]
+ movh m1, [r1+r3]
+ lea r1, [r1+2*r3]
+ movh m2, [r1]
+ movh m3, [r1+r3]
+ lea r1, [r1+2*r3]
+ movh m4, [r1]
+ add r1, r3
+ punpcklbw m0, m7
+ punpcklbw m1, m7
+ punpcklbw m2, m7
+ punpcklbw m3, m7
+ punpcklbw m4, m7
+ FILT_V %1
+ FILT_V %1
+ FILT_V %1
+ FILT_V %1
+ RET
+%endmacro
+
+INIT_MMX mmxext
+QPEL4_V_LOWPASS_OP put
+QPEL4_V_LOWPASS_OP avg
+
+
+
+%macro QPEL8OR16_V_LOWPASS_OP 1
+%if cpuflag(sse2)
+cglobal %1_h264_qpel8or16_v_lowpass, 5,5,8 ; dst, src, dstStride, srcStride, h
+ movsxdifnidn r2, r2d
+ movsxdifnidn r3, r3d
+ sub r1, r3
+ sub r1, r3
+%else
+cglobal %1_h264_qpel8or16_v_lowpass_op, 5,5,8 ; dst, src, dstStride, srcStride, h
+ movsxdifnidn r2, r2d
+ movsxdifnidn r3, r3d
+%endif
+ pxor m7, m7
+ movh m0, [r1]
+ movh m1, [r1+r3]
+ lea r1, [r1+2*r3]
+ movh m2, [r1]
+ movh m3, [r1+r3]
+ lea r1, [r1+2*r3]
+ movh m4, [r1]
+ add r1, r3
+ punpcklbw m0, m7
+ punpcklbw m1, m7
+ punpcklbw m2, m7
+ punpcklbw m3, m7
+ punpcklbw m4, m7
+ FILT_V %1
+ FILT_V %1
+ FILT_V %1
+ FILT_V %1
+ FILT_V %1
+ FILT_V %1
+ FILT_V %1
+ FILT_V %1
+ cmp r4d, 16
+ jne .end
+ FILT_V %1
+ FILT_V %1
+ FILT_V %1
+ FILT_V %1
+ FILT_V %1
+ FILT_V %1
+ FILT_V %1
+ FILT_V %1
+.end:
+ REP_RET
+%endmacro
+
+INIT_MMX mmxext
+QPEL8OR16_V_LOWPASS_OP put
+QPEL8OR16_V_LOWPASS_OP avg
+
+INIT_XMM sse2
+QPEL8OR16_V_LOWPASS_OP put
+QPEL8OR16_V_LOWPASS_OP avg
+
+
+; All functions that use this are required to have args:
+; src, tmp, srcSize
+%macro FILT_HV 1 ; offset
+ mova m6, m2
+ movh m5, [r0]
+ paddw m6, m3
+ psllw m6, 2
+ paddw m0, [pw_16]
+ psubw m6, m1
+ psubw m6, m4
+ punpcklbw m5, m7
+ pmullw m6, [pw_5]
+ paddw m0, m5
+ add r0, r2
+ paddw m6, m0
+ mova [r1+%1], m6
+ SWAP 0, 1, 2, 3, 4, 5
+%endmacro
+
+%macro QPEL4_HV1_LOWPASS_OP 1
+cglobal %1_h264_qpel4_hv_lowpass_v, 3,3 ; src, tmp, srcStride
+ movsxdifnidn r2, r2d
+ pxor m7, m7
+ movh m0, [r0]
+ movh m1, [r0+r2]
+ lea r0, [r0+2*r2]
+ movh m2, [r0]
+ movh m3, [r0+r2]
+ lea r0, [r0+2*r2]
+ movh m4, [r0]
+ add r0, r2
+ punpcklbw m0, m7
+ punpcklbw m1, m7
+ punpcklbw m2, m7
+ punpcklbw m3, m7
+ punpcklbw m4, m7
+ FILT_HV 0*24
+ FILT_HV 1*24
+ FILT_HV 2*24
+ FILT_HV 3*24
+ RET
+
+cglobal %1_h264_qpel4_hv_lowpass_h, 3,4 ; tmp, dst, dstStride
+ movsxdifnidn r2, r2d
+ mov r3d, 4
+.loop:
+ mova m0, [r0]
+ paddw m0, [r0+10]
+ mova m1, [r0+2]
+ paddw m1, [r0+8]
+ mova m2, [r0+4]
+ paddw m2, [r0+6]
+ psubw m0, m1
+ psraw m0, 2
+ psubw m0, m1
+ paddsw m0, m2
+ psraw m0, 2
+ paddw m0, m2
+ psraw m0, 6
+ packuswb m0, m0
+ op_%1h m0, [r1], m7
+ add r0, 24
+ add r1, r2
+ dec r3d
+ jnz .loop
+ REP_RET
+%endmacro
+
+INIT_MMX mmxext
+QPEL4_HV1_LOWPASS_OP put
+QPEL4_HV1_LOWPASS_OP avg
+
+%macro QPEL8OR16_HV1_LOWPASS_OP 1
+cglobal %1_h264_qpel8or16_hv1_lowpass_op, 4,4,8 ; src, tmp, srcStride, size
+ movsxdifnidn r2, r2d
+ pxor m7, m7
+ movh m0, [r0]
+ movh m1, [r0+r2]
+ lea r0, [r0+2*r2]
+ movh m2, [r0]
+ movh m3, [r0+r2]
+ lea r0, [r0+2*r2]
+ movh m4, [r0]
+ add r0, r2
+ punpcklbw m0, m7
+ punpcklbw m1, m7
+ punpcklbw m2, m7
+ punpcklbw m3, m7
+ punpcklbw m4, m7
+ FILT_HV 0*48
+ FILT_HV 1*48
+ FILT_HV 2*48
+ FILT_HV 3*48
+ FILT_HV 4*48
+ FILT_HV 5*48
+ FILT_HV 6*48
+ FILT_HV 7*48
+ cmp r3d, 16
+ jne .end
+ FILT_HV 8*48
+ FILT_HV 9*48
+ FILT_HV 10*48
+ FILT_HV 11*48
+ FILT_HV 12*48
+ FILT_HV 13*48
+ FILT_HV 14*48
+ FILT_HV 15*48
+.end:
+ REP_RET
+%endmacro
+
+INIT_MMX mmxext
+QPEL8OR16_HV1_LOWPASS_OP put
+QPEL8OR16_HV1_LOWPASS_OP avg
+
+INIT_XMM sse2
+QPEL8OR16_HV1_LOWPASS_OP put
+
+
+
+%macro QPEL8OR16_HV2_LOWPASS_OP 1
+; unused is to match ssse3 and mmxext args
+cglobal %1_h264_qpel8or16_hv2_lowpass_op, 5,5 ; dst, tmp, dstStride, unused, h
+ movsxdifnidn r2, r2d
+.loop:
+ mova m0, [r1]
+ mova m3, [r1+8]
+ mova m1, [r1+2]
+ mova m4, [r1+10]
+ paddw m0, m4
+ paddw m1, m3
+ paddw m3, [r1+18]
+ paddw m4, [r1+16]
+ mova m2, [r1+4]
+ mova m5, [r1+12]
+ paddw m2, [r1+6]
+ paddw m5, [r1+14]
+ psubw m0, m1
+ psubw m3, m4
+ psraw m0, 2
+ psraw m3, 2
+ psubw m0, m1
+ psubw m3, m4
+ paddsw m0, m2
+ paddsw m3, m5
+ psraw m0, 2
+ psraw m3, 2
+ paddw m0, m2
+ paddw m3, m5
+ psraw m0, 6
+ psraw m3, 6
+ packuswb m0, m3
+ op_%1 m0, [r0], m7
+ add r1, 48
+ add r0, r2
+ dec r4d
+ jne .loop
+ REP_RET
+%endmacro
+
+INIT_MMX mmxext
+QPEL8OR16_HV2_LOWPASS_OP put
+QPEL8OR16_HV2_LOWPASS_OP avg
+
+%macro QPEL8OR16_HV2_LOWPASS_OP_XMM 1
+cglobal %1_h264_qpel8or16_hv2_lowpass, 5,5,8 ; dst, tmp, dstStride, tmpStride, size
+ movsxdifnidn r2, r2d
+ movsxdifnidn r3, r3d
+ cmp r4d, 16
+ je .op16
+.loop8:
+ mova m1, [r1+16]
+ mova m0, [r1]
+ mova m2, m1
+ mova m3, m1
+ mova m4, m1
+ mova m5, m1
+ palignr m5, m0, 10
+ palignr m4, m0, 8
+ palignr m3, m0, 6
+ palignr m2, m0, 4
+ palignr m1, m0, 2
+ paddw m0, m5
+ paddw m1, m4
+ paddw m2, m3
+ psubw m0, m1
+ psraw m0, 2
+ psubw m0, m1
+ paddw m0, m2
+ psraw m0, 2
+ paddw m0, m2
+ psraw m0, 6
+ packuswb m0, m0
+ op_%1h m0, [r0], m7
+ add r1, 48
+ add r0, r2
+ dec r4d
+ jne .loop8
+ jmp .done
+.op16:
+ mova m4, [r1+32]
+ mova m5, [r1+16]
+ mova m7, [r1]
+ mova m3, m4
+ mova m2, m4
+ mova m1, m4
+ mova m0, m4
+ palignr m0, m5, 10
+ palignr m1, m5, 8
+ palignr m2, m5, 6
+ palignr m3, m5, 4
+ palignr m4, m5, 2
+ paddw m0, m5
+ paddw m1, m4
+ paddw m2, m3
+ mova m6, m5
+ mova m4, m5
+ mova m3, m5
+ palignr m4, m7, 8
+ palignr m6, m7, 2
+ palignr m3, m7, 10
+ paddw m4, m6
+ mova m6, m5
+ palignr m5, m7, 6
+ palignr m6, m7, 4
+ paddw m3, m7
+ paddw m5, m6
+ psubw m0, m1
+ psubw m3, m4
+ psraw m0, 2
+ psraw m3, 2
+ psubw m0, m1
+ psubw m3, m4
+ paddw m0, m2
+ paddw m3, m5
+ psraw m0, 2
+ psraw m3, 2
+ paddw m0, m2
+ paddw m3, m5
+ psraw m0, 6
+ psraw m3, 6
+ packuswb m3, m0
+ op_%1 m3, [r0], m7
+ add r1, 48
+ add r0, r2
+ dec r4d
+ jne .op16
+.done:
+ REP_RET
+%endmacro
+
+INIT_XMM ssse3
+QPEL8OR16_HV2_LOWPASS_OP_XMM put
+QPEL8OR16_HV2_LOWPASS_OP_XMM avg
+
+
+%macro PIXELS4_L2_SHIFT5 1
+cglobal %1_pixels4_l2_shift5,6,6 ; dst, src16, src8, dstStride, src8Stride, h
+ movsxdifnidn r3, r3d
+ movsxdifnidn r4, r4d
+ mova m0, [r1]
+ mova m1, [r1+24]
+ psraw m0, 5
+ psraw m1, 5
+ packuswb m0, m0
+ packuswb m1, m1
+ pavgb m0, [r2]
+ pavgb m1, [r2+r4]
+ op_%1h m0, [r0], m4
+ op_%1h m1, [r0+r3], m5
+ lea r2, [r2+r4*2]
+ lea r0, [r0+r3*2]
+ mova m0, [r1+48]
+ mova m1, [r1+72]
+ psraw m0, 5
+ psraw m1, 5
+ packuswb m0, m0
+ packuswb m1, m1
+ pavgb m0, [r2]
+ pavgb m1, [r2+r4]
+ op_%1h m0, [r0], m4
+ op_%1h m1, [r0+r3], m5
+ RET
+%endmacro
+
+INIT_MMX mmxext
+PIXELS4_L2_SHIFT5 put
+PIXELS4_L2_SHIFT5 avg
+
+
+%macro PIXELS8_L2_SHIFT5 1
+cglobal %1_pixels8_l2_shift5, 6, 6 ; dst, src16, src8, dstStride, src8Stride, h
+ movsxdifnidn r3, r3d
+ movsxdifnidn r4, r4d
+.loop:
+ mova m0, [r1]
+ mova m1, [r1+8]
+ mova m2, [r1+48]
+ mova m3, [r1+48+8]
+ psraw m0, 5
+ psraw m1, 5
+ psraw m2, 5
+ psraw m3, 5
+ packuswb m0, m1
+ packuswb m2, m3
+ pavgb m0, [r2]
+ pavgb m2, [r2+r4]
+ op_%1 m0, [r0], m4
+ op_%1 m2, [r0+r3], m5
+ lea r2, [r2+2*r4]
+ add r1, 48*2
+ lea r0, [r0+2*r3]
+ sub r5d, 2
+ jne .loop
+ REP_RET
+%endmacro
+
+INIT_MMX mmxext
+PIXELS8_L2_SHIFT5 put
+PIXELS8_L2_SHIFT5 avg
+
+
+%if ARCH_X86_64
+%macro QPEL16_H_LOWPASS_L2_OP 1
+cglobal %1_h264_qpel16_h_lowpass_l2, 5, 6, 16 ; dst, src, src2, dstStride, src2Stride
+ movsxdifnidn r3, r3d
+ movsxdifnidn r4, r4d
+ mov r5d, 16
+ pxor m15, m15
+ mova m14, [pw_5]
+ mova m13, [pw_16]
+.loop:
+ lddqu m1, [r1+6]
+ lddqu m7, [r1-2]
+ mova m0, m1
+ punpckhbw m1, m15
+ punpcklbw m0, m15
+ punpcklbw m7, m15
+ mova m2, m1
+ mova m6, m0
+ mova m3, m1
+ mova m8, m0
+ mova m4, m1
+ mova m9, m0
+ mova m12, m0
+ mova m11, m1
+ palignr m11, m0, 10
+ palignr m12, m7, 10
+ palignr m4, m0, 2
+ palignr m9, m7, 2
+ palignr m3, m0, 4
+ palignr m8, m7, 4
+ palignr m2, m0, 6
+ palignr m6, m7, 6
+ paddw m11, m0
+ palignr m1, m0, 8
+ palignr m0, m7, 8
+ paddw m7, m12
+ paddw m2, m3
+ paddw m6, m8
+ paddw m1, m4
+ paddw m0, m9
+ psllw m2, 2
+ psllw m6, 2
+ psubw m2, m1
+ psubw m6, m0
+ paddw m11, m13
+ paddw m7, m13
+ pmullw m2, m14
+ pmullw m6, m14
+ lddqu m3, [r2]
+ paddw m2, m11
+ paddw m6, m7
+ psraw m2, 5
+ psraw m6, 5
+ packuswb m6, m2
+ pavgb m6, m3
+ op_%1 m6, [r0], m11
+ add r1, r3
+ add r0, r3
+ add r2, r4
+ dec r5d
+ jg .loop
+ REP_RET
+%endmacro
+
+INIT_XMM ssse3
+QPEL16_H_LOWPASS_L2_OP put
+QPEL16_H_LOWPASS_L2_OP avg
+%endif
diff --git a/gst-libs/ext/libav/libavcodec/x86/h264_qpel_mmx.c b/gst-libs/ext/libav/libavcodec/x86/h264_qpel_mmx.c
deleted file mode 100644
index b7a4183..0000000
--- a/gst-libs/ext/libav/libavcodec/x86/h264_qpel_mmx.c
+++ /dev/null
@@ -1,1299 +0,0 @@
-/*
- * Copyright (c) 2004-2005 Michael Niedermayer, Loren Merritt
- * Copyright (c) 2011 Daniel Kang
- *
- * 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
- */
-
-#include "dsputil_mmx.h"
-
-/***********************************/
-/* motion compensation */
-
-#define QPEL_H264V_MM(A,B,C,D,E,F,OP,T,Z,d,q)\
- "mov"#q" "#C", "#T" \n\t"\
- "mov"#d" (%0), "#F" \n\t"\
- "paddw "#D", "#T" \n\t"\
- "psllw $2, "#T" \n\t"\
- "psubw "#B", "#T" \n\t"\
- "psubw "#E", "#T" \n\t"\
- "punpcklbw "#Z", "#F" \n\t"\
- "pmullw "MANGLE(ff_pw_5)", "#T"\n\t"\
- "paddw "MANGLE(ff_pw_16)", "#A"\n\t"\
- "add %2, %0 \n\t"\
- "paddw "#F", "#A" \n\t"\
- "paddw "#A", "#T" \n\t"\
- "psraw $5, "#T" \n\t"\
- "packuswb "#T", "#T" \n\t"\
- OP(T, (%1), A, d)\
- "add %3, %1 \n\t"
-
-#define QPEL_H264HV_MM(A,B,C,D,E,F,OF,T,Z,d,q)\
- "mov"#q" "#C", "#T" \n\t"\
- "mov"#d" (%0), "#F" \n\t"\
- "paddw "#D", "#T" \n\t"\
- "psllw $2, "#T" \n\t"\
- "paddw "MANGLE(ff_pw_16)", "#A"\n\t"\
- "psubw "#B", "#T" \n\t"\
- "psubw "#E", "#T" \n\t"\
- "punpcklbw "#Z", "#F" \n\t"\
- "pmullw "MANGLE(ff_pw_5)", "#T"\n\t"\
- "paddw "#F", "#A" \n\t"\
- "add %2, %0 \n\t"\
- "paddw "#A", "#T" \n\t"\
- "mov"#q" "#T", "#OF"(%1) \n\t"
-
-#define QPEL_H264V(A,B,C,D,E,F,OP) QPEL_H264V_MM(A,B,C,D,E,F,OP,%%mm6,%%mm7,d,q)
-#define QPEL_H264HV(A,B,C,D,E,F,OF) QPEL_H264HV_MM(A,B,C,D,E,F,OF,%%mm6,%%mm7,d,q)
-#define QPEL_H264V_XMM(A,B,C,D,E,F,OP) QPEL_H264V_MM(A,B,C,D,E,F,OP,%%xmm6,%%xmm7,q,dqa)
-#define QPEL_H264HV_XMM(A,B,C,D,E,F,OF) QPEL_H264HV_MM(A,B,C,D,E,F,OF,%%xmm6,%%xmm7,q,dqa)
-
-
-#define QPEL_H264(OPNAME, OP, MMX)\
-static av_noinline void OPNAME ## h264_qpel4_h_lowpass_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
- int h=4;\
-\
- __asm__ volatile(\
- "pxor %%mm7, %%mm7 \n\t"\
- "movq "MANGLE(ff_pw_5) ", %%mm4\n\t"\
- "movq "MANGLE(ff_pw_16)", %%mm5\n\t"\
- "1: \n\t"\
- "movd -1(%0), %%mm1 \n\t"\
- "movd (%0), %%mm2 \n\t"\
- "movd 1(%0), %%mm3 \n\t"\
- "movd 2(%0), %%mm0 \n\t"\
- "punpcklbw %%mm7, %%mm1 \n\t"\
- "punpcklbw %%mm7, %%mm2 \n\t"\
- "punpcklbw %%mm7, %%mm3 \n\t"\
- "punpcklbw %%mm7, %%mm0 \n\t"\
- "paddw %%mm0, %%mm1 \n\t"\
- "paddw %%mm3, %%mm2 \n\t"\
- "movd -2(%0), %%mm0 \n\t"\
- "movd 3(%0), %%mm3 \n\t"\
- "punpcklbw %%mm7, %%mm0 \n\t"\
- "punpcklbw %%mm7, %%mm3 \n\t"\
- "paddw %%mm3, %%mm0 \n\t"\
- "psllw $2, %%mm2 \n\t"\
- "psubw %%mm1, %%mm2 \n\t"\
- "pmullw %%mm4, %%mm2 \n\t"\
- "paddw %%mm5, %%mm0 \n\t"\
- "paddw %%mm2, %%mm0 \n\t"\
- "psraw $5, %%mm0 \n\t"\
- "packuswb %%mm0, %%mm0 \n\t"\
- OP(%%mm0, (%1),%%mm6, d)\
- "add %3, %0 \n\t"\
- "add %4, %1 \n\t"\
- "decl %2 \n\t"\
- " jnz 1b \n\t"\
- : "+a"(src), "+c"(dst), "+g"(h)\
- : "d"((x86_reg)srcStride), "S"((x86_reg)dstStride)\
- : "memory"\
- );\
-}\
-static av_noinline void OPNAME ## h264_qpel4_h_lowpass_l2_ ## MMX(uint8_t *dst, uint8_t *src, uint8_t *src2, int dstStride, int src2Stride){\
- int h=4;\
- __asm__ volatile(\
- "pxor %%mm7, %%mm7 \n\t"\
- "movq %0, %%mm4 \n\t"\
- "movq %1, %%mm5 \n\t"\
- :: "m"(ff_pw_5), "m"(ff_pw_16)\
- );\
- do{\
- __asm__ volatile(\
- "movd -1(%0), %%mm1 \n\t"\
- "movd (%0), %%mm2 \n\t"\
- "movd 1(%0), %%mm3 \n\t"\
- "movd 2(%0), %%mm0 \n\t"\
- "punpcklbw %%mm7, %%mm1 \n\t"\
- "punpcklbw %%mm7, %%mm2 \n\t"\
- "punpcklbw %%mm7, %%mm3 \n\t"\
- "punpcklbw %%mm7, %%mm0 \n\t"\
- "paddw %%mm0, %%mm1 \n\t"\
- "paddw %%mm3, %%mm2 \n\t"\
- "movd -2(%0), %%mm0 \n\t"\
- "movd 3(%0), %%mm3 \n\t"\
- "punpcklbw %%mm7, %%mm0 \n\t"\
- "punpcklbw %%mm7, %%mm3 \n\t"\
- "paddw %%mm3, %%mm0 \n\t"\
- "psllw $2, %%mm2 \n\t"\
- "psubw %%mm1, %%mm2 \n\t"\
- "pmullw %%mm4, %%mm2 \n\t"\
- "paddw %%mm5, %%mm0 \n\t"\
- "paddw %%mm2, %%mm0 \n\t"\
- "movd (%2), %%mm3 \n\t"\
- "psraw $5, %%mm0 \n\t"\
- "packuswb %%mm0, %%mm0 \n\t"\
- PAVGB" %%mm3, %%mm0 \n\t"\
- OP(%%mm0, (%1),%%mm6, d)\
- "add %4, %0 \n\t"\
- "add %4, %1 \n\t"\
- "add %3, %2 \n\t"\
- : "+a"(src), "+c"(dst), "+d"(src2)\
- : "D"((x86_reg)src2Stride), "S"((x86_reg)dstStride)\
- : "memory"\
- );\
- }while(--h);\
-}\
-static av_noinline void OPNAME ## h264_qpel4_v_lowpass_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
- src -= 2*srcStride;\
- __asm__ volatile(\
- "pxor %%mm7, %%mm7 \n\t"\
- "movd (%0), %%mm0 \n\t"\
- "add %2, %0 \n\t"\
- "movd (%0), %%mm1 \n\t"\
- "add %2, %0 \n\t"\
- "movd (%0), %%mm2 \n\t"\
- "add %2, %0 \n\t"\
- "movd (%0), %%mm3 \n\t"\
- "add %2, %0 \n\t"\
- "movd (%0), %%mm4 \n\t"\
- "add %2, %0 \n\t"\
- "punpcklbw %%mm7, %%mm0 \n\t"\
- "punpcklbw %%mm7, %%mm1 \n\t"\
- "punpcklbw %%mm7, %%mm2 \n\t"\
- "punpcklbw %%mm7, %%mm3 \n\t"\
- "punpcklbw %%mm7, %%mm4 \n\t"\
- QPEL_H264V(%%mm0, %%mm1, %%mm2, %%mm3, %%mm4, %%mm5, OP)\
- QPEL_H264V(%%mm1, %%mm2, %%mm3, %%mm4, %%mm5, %%mm0, OP)\
- QPEL_H264V(%%mm2, %%mm3, %%mm4, %%mm5, %%mm0, %%mm1, OP)\
- QPEL_H264V(%%mm3, %%mm4, %%mm5, %%mm0, %%mm1, %%mm2, OP)\
- \
- : "+a"(src), "+c"(dst)\
- : "S"((x86_reg)srcStride), "D"((x86_reg)dstStride), "m"(ff_pw_5), "m"(ff_pw_16)\
- : "memory"\
- );\
-}\
-static av_noinline void OPNAME ## h264_qpel4_hv_lowpass_ ## MMX(uint8_t *dst, int16_t *tmp, uint8_t *src, int dstStride, int tmpStride, int srcStride){\
- int h=4;\
- int w=3;\
- src -= 2*srcStride+2;\
- while(w--){\
- __asm__ volatile(\
- "pxor %%mm7, %%mm7 \n\t"\
- "movd (%0), %%mm0 \n\t"\
- "add %2, %0 \n\t"\
- "movd (%0), %%mm1 \n\t"\
- "add %2, %0 \n\t"\
- "movd (%0), %%mm2 \n\t"\
- "add %2, %0 \n\t"\
- "movd (%0), %%mm3 \n\t"\
- "add %2, %0 \n\t"\
- "movd (%0), %%mm4 \n\t"\
- "add %2, %0 \n\t"\
- "punpcklbw %%mm7, %%mm0 \n\t"\
- "punpcklbw %%mm7, %%mm1 \n\t"\
- "punpcklbw %%mm7, %%mm2 \n\t"\
- "punpcklbw %%mm7, %%mm3 \n\t"\
- "punpcklbw %%mm7, %%mm4 \n\t"\
- QPEL_H264HV(%%mm0, %%mm1, %%mm2, %%mm3, %%mm4, %%mm5, 0*8*3)\
- QPEL_H264HV(%%mm1, %%mm2, %%mm3, %%mm4, %%mm5, %%mm0, 1*8*3)\
- QPEL_H264HV(%%mm2, %%mm3, %%mm4, %%mm5, %%mm0, %%mm1, 2*8*3)\
- QPEL_H264HV(%%mm3, %%mm4, %%mm5, %%mm0, %%mm1, %%mm2, 3*8*3)\
- \
- : "+a"(src)\
- : "c"(tmp), "S"((x86_reg)srcStride)\
- : "memory"\
- );\
- tmp += 4;\
- src += 4 - 9*srcStride;\
- }\
- tmp -= 3*4;\
- __asm__ volatile(\
- "1: \n\t"\
- "movq (%0), %%mm0 \n\t"\
- "paddw 10(%0), %%mm0 \n\t"\
- "movq 2(%0), %%mm1 \n\t"\
- "paddw 8(%0), %%mm1 \n\t"\
- "movq 4(%0), %%mm2 \n\t"\
- "paddw 6(%0), %%mm2 \n\t"\
- "psubw %%mm1, %%mm0 \n\t"/*a-b (abccba)*/\
- "psraw $2, %%mm0 \n\t"/*(a-b)/4 */\
- "psubw %%mm1, %%mm0 \n\t"/*(a-b)/4-b */\
- "paddsw %%mm2, %%mm0 \n\t"\
- "psraw $2, %%mm0 \n\t"/*((a-b)/4-b+c)/4 */\
- "paddw %%mm2, %%mm0 \n\t"/*(a-5*b+20*c)/16 */\
- "psraw $6, %%mm0 \n\t"\
- "packuswb %%mm0, %%mm0 \n\t"\
- OP(%%mm0, (%1),%%mm7, d)\
- "add $24, %0 \n\t"\
- "add %3, %1 \n\t"\
- "decl %2 \n\t"\
- " jnz 1b \n\t"\
- : "+a"(tmp), "+c"(dst), "+g"(h)\
- : "S"((x86_reg)dstStride)\
- : "memory"\
- );\
-}\
-\
-static av_noinline void OPNAME ## h264_qpel8_h_lowpass_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
- int h=8;\
- __asm__ volatile(\
- "pxor %%mm7, %%mm7 \n\t"\
- "movq "MANGLE(ff_pw_5)", %%mm6\n\t"\
- "1: \n\t"\
- "movq (%0), %%mm0 \n\t"\
- "movq 1(%0), %%mm2 \n\t"\
- "movq %%mm0, %%mm1 \n\t"\
- "movq %%mm2, %%mm3 \n\t"\
- "punpcklbw %%mm7, %%mm0 \n\t"\
- "punpckhbw %%mm7, %%mm1 \n\t"\
- "punpcklbw %%mm7, %%mm2 \n\t"\
- "punpckhbw %%mm7, %%mm3 \n\t"\
- "paddw %%mm2, %%mm0 \n\t"\
- "paddw %%mm3, %%mm1 \n\t"\
- "psllw $2, %%mm0 \n\t"\
- "psllw $2, %%mm1 \n\t"\
- "movq -1(%0), %%mm2 \n\t"\
- "movq 2(%0), %%mm4 \n\t"\
- "movq %%mm2, %%mm3 \n\t"\
- "movq %%mm4, %%mm5 \n\t"\
- "punpcklbw %%mm7, %%mm2 \n\t"\
- "punpckhbw %%mm7, %%mm3 \n\t"\
- "punpcklbw %%mm7, %%mm4 \n\t"\
- "punpckhbw %%mm7, %%mm5 \n\t"\
- "paddw %%mm4, %%mm2 \n\t"\
- "paddw %%mm3, %%mm5 \n\t"\
- "psubw %%mm2, %%mm0 \n\t"\
- "psubw %%mm5, %%mm1 \n\t"\
- "pmullw %%mm6, %%mm0 \n\t"\
- "pmullw %%mm6, %%mm1 \n\t"\
- "movd -2(%0), %%mm2 \n\t"\
- "movd 7(%0), %%mm5 \n\t"\
- "punpcklbw %%mm7, %%mm2 \n\t"\
- "punpcklbw %%mm7, %%mm5 \n\t"\
- "paddw %%mm3, %%mm2 \n\t"\
- "paddw %%mm5, %%mm4 \n\t"\
- "movq "MANGLE(ff_pw_16)", %%mm5\n\t"\
- "paddw %%mm5, %%mm2 \n\t"\
- "paddw %%mm5, %%mm4 \n\t"\
- "paddw %%mm2, %%mm0 \n\t"\
- "paddw %%mm4, %%mm1 \n\t"\
- "psraw $5, %%mm0 \n\t"\
- "psraw $5, %%mm1 \n\t"\
- "packuswb %%mm1, %%mm0 \n\t"\
- OP(%%mm0, (%1),%%mm5, q)\
- "add %3, %0 \n\t"\
- "add %4, %1 \n\t"\
- "decl %2 \n\t"\
- " jnz 1b \n\t"\
- : "+a"(src), "+c"(dst), "+g"(h)\
- : "d"((x86_reg)srcStride), "S"((x86_reg)dstStride)\
- : "memory"\
- );\
-}\
-\
-static av_noinline void OPNAME ## h264_qpel8_h_lowpass_l2_ ## MMX(uint8_t *dst, uint8_t *src, uint8_t *src2, int dstStride, int src2Stride){\
- int h=8;\
- __asm__ volatile(\
- "pxor %%mm7, %%mm7 \n\t"\
- "movq "MANGLE(ff_pw_5)", %%mm6\n\t"\
- "1: \n\t"\
- "movq (%0), %%mm0 \n\t"\
- "movq 1(%0), %%mm2 \n\t"\
- "movq %%mm0, %%mm1 \n\t"\
- "movq %%mm2, %%mm3 \n\t"\
- "punpcklbw %%mm7, %%mm0 \n\t"\
- "punpckhbw %%mm7, %%mm1 \n\t"\
- "punpcklbw %%mm7, %%mm2 \n\t"\
- "punpckhbw %%mm7, %%mm3 \n\t"\
- "paddw %%mm2, %%mm0 \n\t"\
- "paddw %%mm3, %%mm1 \n\t"\
- "psllw $2, %%mm0 \n\t"\
- "psllw $2, %%mm1 \n\t"\
- "movq -1(%0), %%mm2 \n\t"\
- "movq 2(%0), %%mm4 \n\t"\
- "movq %%mm2, %%mm3 \n\t"\
- "movq %%mm4, %%mm5 \n\t"\
- "punpcklbw %%mm7, %%mm2 \n\t"\
- "punpckhbw %%mm7, %%mm3 \n\t"\
- "punpcklbw %%mm7, %%mm4 \n\t"\
- "punpckhbw %%mm7, %%mm5 \n\t"\
- "paddw %%mm4, %%mm2 \n\t"\
- "paddw %%mm3, %%mm5 \n\t"\
- "psubw %%mm2, %%mm0 \n\t"\
- "psubw %%mm5, %%mm1 \n\t"\
- "pmullw %%mm6, %%mm0 \n\t"\
- "pmullw %%mm6, %%mm1 \n\t"\
- "movd -2(%0), %%mm2 \n\t"\
- "movd 7(%0), %%mm5 \n\t"\
- "punpcklbw %%mm7, %%mm2 \n\t"\
- "punpcklbw %%mm7, %%mm5 \n\t"\
- "paddw %%mm3, %%mm2 \n\t"\
- "paddw %%mm5, %%mm4 \n\t"\
- "movq "MANGLE(ff_pw_16)", %%mm5\n\t"\
- "paddw %%mm5, %%mm2 \n\t"\
- "paddw %%mm5, %%mm4 \n\t"\
- "paddw %%mm2, %%mm0 \n\t"\
- "paddw %%mm4, %%mm1 \n\t"\
- "psraw $5, %%mm0 \n\t"\
- "psraw $5, %%mm1 \n\t"\
- "movq (%2), %%mm4 \n\t"\
- "packuswb %%mm1, %%mm0 \n\t"\
- PAVGB" %%mm4, %%mm0 \n\t"\
- OP(%%mm0, (%1),%%mm5, q)\
- "add %5, %0 \n\t"\
- "add %5, %1 \n\t"\
- "add %4, %2 \n\t"\
- "decl %3 \n\t"\
- "jg 1b \n\t"\
- : "+a"(src), "+c"(dst), "+d"(src2), "+g"(h)\
- : "D"((x86_reg)src2Stride), "S"((x86_reg)dstStride)\
- : "memory"\
- );\
-}\
-\
-static av_noinline void OPNAME ## h264_qpel8or16_v_lowpass_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int h){\
- int w= 2;\
- src -= 2*srcStride;\
- \
- while(w--){\
- __asm__ volatile(\
- "pxor %%mm7, %%mm7 \n\t"\
- "movd (%0), %%mm0 \n\t"\
- "add %2, %0 \n\t"\
- "movd (%0), %%mm1 \n\t"\
- "add %2, %0 \n\t"\
- "movd (%0), %%mm2 \n\t"\
- "add %2, %0 \n\t"\
- "movd (%0), %%mm3 \n\t"\
- "add %2, %0 \n\t"\
- "movd (%0), %%mm4 \n\t"\
- "add %2, %0 \n\t"\
- "punpcklbw %%mm7, %%mm0 \n\t"\
- "punpcklbw %%mm7, %%mm1 \n\t"\
- "punpcklbw %%mm7, %%mm2 \n\t"\
- "punpcklbw %%mm7, %%mm3 \n\t"\
- "punpcklbw %%mm7, %%mm4 \n\t"\
- QPEL_H264V(%%mm0, %%mm1, %%mm2, %%mm3, %%mm4, %%mm5, OP)\
- QPEL_H264V(%%mm1, %%mm2, %%mm3, %%mm4, %%mm5, %%mm0, OP)\
- QPEL_H264V(%%mm2, %%mm3, %%mm4, %%mm5, %%mm0, %%mm1, OP)\
- QPEL_H264V(%%mm3, %%mm4, %%mm5, %%mm0, %%mm1, %%mm2, OP)\
- QPEL_H264V(%%mm4, %%mm5, %%mm0, %%mm1, %%mm2, %%mm3, OP)\
- QPEL_H264V(%%mm5, %%mm0, %%mm1, %%mm2, %%mm3, %%mm4, OP)\
- QPEL_H264V(%%mm0, %%mm1, %%mm2, %%mm3, %%mm4, %%mm5, OP)\
- QPEL_H264V(%%mm1, %%mm2, %%mm3, %%mm4, %%mm5, %%mm0, OP)\
- "cmpl $16, %4 \n\t"\
- "jne 2f \n\t"\
- QPEL_H264V(%%mm2, %%mm3, %%mm4, %%mm5, %%mm0, %%mm1, OP)\
- QPEL_H264V(%%mm3, %%mm4, %%mm5, %%mm0, %%mm1, %%mm2, OP)\
- QPEL_H264V(%%mm4, %%mm5, %%mm0, %%mm1, %%mm2, %%mm3, OP)\
- QPEL_H264V(%%mm5, %%mm0, %%mm1, %%mm2, %%mm3, %%mm4, OP)\
- QPEL_H264V(%%mm0, %%mm1, %%mm2, %%mm3, %%mm4, %%mm5, OP)\
- QPEL_H264V(%%mm1, %%mm2, %%mm3, %%mm4, %%mm5, %%mm0, OP)\
- QPEL_H264V(%%mm2, %%mm3, %%mm4, %%mm5, %%mm0, %%mm1, OP)\
- QPEL_H264V(%%mm3, %%mm4, %%mm5, %%mm0, %%mm1, %%mm2, OP)\
- "2: \n\t"\
- \
- : "+a"(src), "+c"(dst)\
- : "S"((x86_reg)srcStride), "D"((x86_reg)dstStride), "rm"(h)\
- : "memory"\
- );\
- src += 4-(h+5)*srcStride;\
- dst += 4-h*dstStride;\
- }\
-}\
-static av_always_inline void OPNAME ## h264_qpel8or16_hv1_lowpass_ ## MMX(int16_t *tmp, uint8_t *src, int tmpStride, int srcStride, int size){\
- int w = (size+8)>>2;\
- src -= 2*srcStride+2;\
- while(w--){\
- __asm__ volatile(\
- "pxor %%mm7, %%mm7 \n\t"\
- "movd (%0), %%mm0 \n\t"\
- "add %2, %0 \n\t"\
- "movd (%0), %%mm1 \n\t"\
- "add %2, %0 \n\t"\
- "movd (%0), %%mm2 \n\t"\
- "add %2, %0 \n\t"\
- "movd (%0), %%mm3 \n\t"\
- "add %2, %0 \n\t"\
- "movd (%0), %%mm4 \n\t"\
- "add %2, %0 \n\t"\
- "punpcklbw %%mm7, %%mm0 \n\t"\
- "punpcklbw %%mm7, %%mm1 \n\t"\
- "punpcklbw %%mm7, %%mm2 \n\t"\
- "punpcklbw %%mm7, %%mm3 \n\t"\
- "punpcklbw %%mm7, %%mm4 \n\t"\
- QPEL_H264HV(%%mm0, %%mm1, %%mm2, %%mm3, %%mm4, %%mm5, 0*48)\
- QPEL_H264HV(%%mm1, %%mm2, %%mm3, %%mm4, %%mm5, %%mm0, 1*48)\
- QPEL_H264HV(%%mm2, %%mm3, %%mm4, %%mm5, %%mm0, %%mm1, 2*48)\
- QPEL_H264HV(%%mm3, %%mm4, %%mm5, %%mm0, %%mm1, %%mm2, 3*48)\
- QPEL_H264HV(%%mm4, %%mm5, %%mm0, %%mm1, %%mm2, %%mm3, 4*48)\
- QPEL_H264HV(%%mm5, %%mm0, %%mm1, %%mm2, %%mm3, %%mm4, 5*48)\
- QPEL_H264HV(%%mm0, %%mm1, %%mm2, %%mm3, %%mm4, %%mm5, 6*48)\
- QPEL_H264HV(%%mm1, %%mm2, %%mm3, %%mm4, %%mm5, %%mm0, 7*48)\
- "cmpl $16, %3 \n\t"\
- "jne 2f \n\t"\
- QPEL_H264HV(%%mm2, %%mm3, %%mm4, %%mm5, %%mm0, %%mm1, 8*48)\
- QPEL_H264HV(%%mm3, %%mm4, %%mm5, %%mm0, %%mm1, %%mm2, 9*48)\
- QPEL_H264HV(%%mm4, %%mm5, %%mm0, %%mm1, %%mm2, %%mm3, 10*48)\
- QPEL_H264HV(%%mm5, %%mm0, %%mm1, %%mm2, %%mm3, %%mm4, 11*48)\
- QPEL_H264HV(%%mm0, %%mm1, %%mm2, %%mm3, %%mm4, %%mm5, 12*48)\
- QPEL_H264HV(%%mm1, %%mm2, %%mm3, %%mm4, %%mm5, %%mm0, 13*48)\
- QPEL_H264HV(%%mm2, %%mm3, %%mm4, %%mm5, %%mm0, %%mm1, 14*48)\
- QPEL_H264HV(%%mm3, %%mm4, %%mm5, %%mm0, %%mm1, %%mm2, 15*48)\
- "2: \n\t"\
- : "+a"(src)\
- : "c"(tmp), "S"((x86_reg)srcStride), "rm"(size)\
- : "memory"\
- );\
- tmp += 4;\
- src += 4 - (size+5)*srcStride;\
- }\
-}\
-static av_always_inline void OPNAME ## h264_qpel8or16_hv2_lowpass_ ## MMX(uint8_t *dst, int16_t *tmp, int dstStride, int tmpStride, int size){\
- int w = size>>4;\
- do{\
- int h = size;\
- __asm__ volatile(\
- "1: \n\t"\
- "movq (%0), %%mm0 \n\t"\
- "movq 8(%0), %%mm3 \n\t"\
- "movq 2(%0), %%mm1 \n\t"\
- "movq 10(%0), %%mm4 \n\t"\
- "paddw %%mm4, %%mm0 \n\t"\
- "paddw %%mm3, %%mm1 \n\t"\
- "paddw 18(%0), %%mm3 \n\t"\
- "paddw 16(%0), %%mm4 \n\t"\
- "movq 4(%0), %%mm2 \n\t"\
- "movq 12(%0), %%mm5 \n\t"\
- "paddw 6(%0), %%mm2 \n\t"\
- "paddw 14(%0), %%mm5 \n\t"\
- "psubw %%mm1, %%mm0 \n\t"\
- "psubw %%mm4, %%mm3 \n\t"\
- "psraw $2, %%mm0 \n\t"\
- "psraw $2, %%mm3 \n\t"\
- "psubw %%mm1, %%mm0 \n\t"\
- "psubw %%mm4, %%mm3 \n\t"\
- "paddsw %%mm2, %%mm0 \n\t"\
- "paddsw %%mm5, %%mm3 \n\t"\
- "psraw $2, %%mm0 \n\t"\
- "psraw $2, %%mm3 \n\t"\
- "paddw %%mm2, %%mm0 \n\t"\
- "paddw %%mm5, %%mm3 \n\t"\
- "psraw $6, %%mm0 \n\t"\
- "psraw $6, %%mm3 \n\t"\
- "packuswb %%mm3, %%mm0 \n\t"\
- OP(%%mm0, (%1),%%mm7, q)\
- "add $48, %0 \n\t"\
- "add %3, %1 \n\t"\
- "decl %2 \n\t"\
- " jnz 1b \n\t"\
- : "+a"(tmp), "+c"(dst), "+g"(h)\
- : "S"((x86_reg)dstStride)\
- : "memory"\
- );\
- tmp += 8 - size*24;\
- dst += 8 - size*dstStride;\
- }while(w--);\
-}\
-\
-static void OPNAME ## h264_qpel8_v_lowpass_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
- OPNAME ## h264_qpel8or16_v_lowpass_ ## MMX(dst , src , dstStride, srcStride, 8);\
-}\
-static av_noinline void OPNAME ## h264_qpel16_v_lowpass_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
- OPNAME ## h264_qpel8or16_v_lowpass_ ## MMX(dst , src , dstStride, srcStride, 16);\
- OPNAME ## h264_qpel8or16_v_lowpass_ ## MMX(dst+8, src+8, dstStride, srcStride, 16);\
-}\
-\
-static void OPNAME ## h264_qpel16_h_lowpass_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
- OPNAME ## h264_qpel8_h_lowpass_ ## MMX(dst , src , dstStride, srcStride);\
- OPNAME ## h264_qpel8_h_lowpass_ ## MMX(dst+8, src+8, dstStride, srcStride);\
- src += 8*srcStride;\
- dst += 8*dstStride;\
- OPNAME ## h264_qpel8_h_lowpass_ ## MMX(dst , src , dstStride, srcStride);\
- OPNAME ## h264_qpel8_h_lowpass_ ## MMX(dst+8, src+8, dstStride, srcStride);\
-}\
-\
-static av_noinline void OPNAME ## h264_qpel16_h_lowpass_l2_ ## MMX(uint8_t *dst, uint8_t *src, uint8_t *src2, int dstStride, int src2Stride){\
- OPNAME ## h264_qpel8_h_lowpass_l2_ ## MMX(dst , src , src2 , dstStride, src2Stride);\
- OPNAME ## h264_qpel8_h_lowpass_l2_ ## MMX(dst+8, src+8, src2+8, dstStride, src2Stride);\
- src += 8*dstStride;\
- dst += 8*dstStride;\
- src2 += 8*src2Stride;\
- OPNAME ## h264_qpel8_h_lowpass_l2_ ## MMX(dst , src , src2 , dstStride, src2Stride);\
- OPNAME ## h264_qpel8_h_lowpass_l2_ ## MMX(dst+8, src+8, src2+8, dstStride, src2Stride);\
-}\
-\
-static av_noinline void OPNAME ## h264_qpel8or16_hv_lowpass_ ## MMX(uint8_t *dst, int16_t *tmp, uint8_t *src, int dstStride, int tmpStride, int srcStride, int size){\
- put_h264_qpel8or16_hv1_lowpass_ ## MMX(tmp, src, tmpStride, srcStride, size);\
- OPNAME ## h264_qpel8or16_hv2_lowpass_ ## MMX(dst, tmp, dstStride, tmpStride, size);\
-}\
-static void OPNAME ## h264_qpel8_hv_lowpass_ ## MMX(uint8_t *dst, int16_t *tmp, uint8_t *src, int dstStride, int tmpStride, int srcStride){\
- OPNAME ## h264_qpel8or16_hv_lowpass_ ## MMX(dst , tmp , src , dstStride, tmpStride, srcStride, 8);\
-}\
-\
-static void OPNAME ## h264_qpel16_hv_lowpass_ ## MMX(uint8_t *dst, int16_t *tmp, uint8_t *src, int dstStride, int tmpStride, int srcStride){\
- OPNAME ## h264_qpel8or16_hv_lowpass_ ## MMX(dst , tmp , src , dstStride, tmpStride, srcStride, 16);\
-}\
-\
-static av_noinline void OPNAME ## pixels4_l2_shift5_ ## MMX(uint8_t *dst, int16_t *src16, uint8_t *src8, int dstStride, int src8Stride, int h)\
-{\
- __asm__ volatile(\
- "movq (%1), %%mm0 \n\t"\
- "movq 24(%1), %%mm1 \n\t"\
- "psraw $5, %%mm0 \n\t"\
- "psraw $5, %%mm1 \n\t"\
- "packuswb %%mm0, %%mm0 \n\t"\
- "packuswb %%mm1, %%mm1 \n\t"\
- PAVGB" (%0), %%mm0 \n\t"\
- PAVGB" (%0,%3), %%mm1 \n\t"\
- OP(%%mm0, (%2), %%mm4, d)\
- OP(%%mm1, (%2,%4), %%mm5, d)\
- "lea (%0,%3,2), %0 \n\t"\
- "lea (%2,%4,2), %2 \n\t"\
- "movq 48(%1), %%mm0 \n\t"\
- "movq 72(%1), %%mm1 \n\t"\
- "psraw $5, %%mm0 \n\t"\
- "psraw $5, %%mm1 \n\t"\
- "packuswb %%mm0, %%mm0 \n\t"\
- "packuswb %%mm1, %%mm1 \n\t"\
- PAVGB" (%0), %%mm0 \n\t"\
- PAVGB" (%0,%3), %%mm1 \n\t"\
- OP(%%mm0, (%2), %%mm4, d)\
- OP(%%mm1, (%2,%4), %%mm5, d)\
- :"+a"(src8), "+c"(src16), "+d"(dst)\
- :"S"((x86_reg)src8Stride), "D"((x86_reg)dstStride)\
- :"memory");\
-}\
-static av_noinline void OPNAME ## pixels8_l2_shift5_ ## MMX(uint8_t *dst, int16_t *src16, uint8_t *src8, int dstStride, int src8Stride, int h)\
-{\
- do{\
- __asm__ volatile(\
- "movq (%1), %%mm0 \n\t"\
- "movq 8(%1), %%mm1 \n\t"\
- "movq 48(%1), %%mm2 \n\t"\
- "movq 8+48(%1), %%mm3 \n\t"\
- "psraw $5, %%mm0 \n\t"\
- "psraw $5, %%mm1 \n\t"\
- "psraw $5, %%mm2 \n\t"\
- "psraw $5, %%mm3 \n\t"\
- "packuswb %%mm1, %%mm0 \n\t"\
- "packuswb %%mm3, %%mm2 \n\t"\
- PAVGB" (%0), %%mm0 \n\t"\
- PAVGB" (%0,%3), %%mm2 \n\t"\
- OP(%%mm0, (%2), %%mm5, q)\
- OP(%%mm2, (%2,%4), %%mm5, q)\
- ::"a"(src8), "c"(src16), "d"(dst),\
- "r"((x86_reg)src8Stride), "r"((x86_reg)dstStride)\
- :"memory");\
- src8 += 2L*src8Stride;\
- src16 += 48;\
- dst += 2L*dstStride;\
- }while(h-=2);\
-}\
-static void OPNAME ## pixels16_l2_shift5_ ## MMX(uint8_t *dst, int16_t *src16, uint8_t *src8, int dstStride, int src8Stride, int h)\
-{\
- OPNAME ## pixels8_l2_shift5_ ## MMX(dst , src16 , src8 , dstStride, src8Stride, h);\
- OPNAME ## pixels8_l2_shift5_ ## MMX(dst+8, src16+8, src8+8, dstStride, src8Stride, h);\
-}\
-
-
-#if ARCH_X86_64
-#define QPEL_H264_H16_XMM(OPNAME, OP, MMX)\
-static av_noinline void OPNAME ## h264_qpel16_h_lowpass_l2_ ## MMX(uint8_t *dst, uint8_t *src, uint8_t *src2, int dstStride, int src2Stride){\
- int h=16;\
- __asm__ volatile(\
- "pxor %%xmm15, %%xmm15 \n\t"\
- "movdqa %6, %%xmm14 \n\t"\
- "movdqa %7, %%xmm13 \n\t"\
- "1: \n\t"\
- "lddqu 6(%0), %%xmm1 \n\t"\
- "lddqu -2(%0), %%xmm7 \n\t"\
- "movdqa %%xmm1, %%xmm0 \n\t"\
- "punpckhbw %%xmm15, %%xmm1 \n\t"\
- "punpcklbw %%xmm15, %%xmm0 \n\t"\
- "punpcklbw %%xmm15, %%xmm7 \n\t"\
- "movdqa %%xmm1, %%xmm2 \n\t"\
- "movdqa %%xmm0, %%xmm6 \n\t"\
- "movdqa %%xmm1, %%xmm3 \n\t"\
- "movdqa %%xmm0, %%xmm8 \n\t"\
- "movdqa %%xmm1, %%xmm4 \n\t"\
- "movdqa %%xmm0, %%xmm9 \n\t"\
- "movdqa %%xmm0, %%xmm12 \n\t"\
- "movdqa %%xmm1, %%xmm11 \n\t"\
- "palignr $10,%%xmm0, %%xmm11\n\t"\
- "palignr $10,%%xmm7, %%xmm12\n\t"\
- "palignr $2, %%xmm0, %%xmm4 \n\t"\
- "palignr $2, %%xmm7, %%xmm9 \n\t"\
- "palignr $4, %%xmm0, %%xmm3 \n\t"\
- "palignr $4, %%xmm7, %%xmm8 \n\t"\
- "palignr $6, %%xmm0, %%xmm2 \n\t"\
- "palignr $6, %%xmm7, %%xmm6 \n\t"\
- "paddw %%xmm0 ,%%xmm11 \n\t"\
- "palignr $8, %%xmm0, %%xmm1 \n\t"\
- "palignr $8, %%xmm7, %%xmm0 \n\t"\
- "paddw %%xmm12,%%xmm7 \n\t"\
- "paddw %%xmm3, %%xmm2 \n\t"\
- "paddw %%xmm8, %%xmm6 \n\t"\
- "paddw %%xmm4, %%xmm1 \n\t"\
- "paddw %%xmm9, %%xmm0 \n\t"\
- "psllw $2, %%xmm2 \n\t"\
- "psllw $2, %%xmm6 \n\t"\
- "psubw %%xmm1, %%xmm2 \n\t"\
- "psubw %%xmm0, %%xmm6 \n\t"\
- "paddw %%xmm13,%%xmm11 \n\t"\
- "paddw %%xmm13,%%xmm7 \n\t"\
- "pmullw %%xmm14,%%xmm2 \n\t"\
- "pmullw %%xmm14,%%xmm6 \n\t"\
- "lddqu (%2), %%xmm3 \n\t"\
- "paddw %%xmm11,%%xmm2 \n\t"\
- "paddw %%xmm7, %%xmm6 \n\t"\
- "psraw $5, %%xmm2 \n\t"\
- "psraw $5, %%xmm6 \n\t"\
- "packuswb %%xmm2,%%xmm6 \n\t"\
- "pavgb %%xmm3, %%xmm6 \n\t"\
- OP(%%xmm6, (%1), %%xmm4, dqa)\
- "add %5, %0 \n\t"\
- "add %5, %1 \n\t"\
- "add %4, %2 \n\t"\
- "decl %3 \n\t"\
- "jg 1b \n\t"\
- : "+a"(src), "+c"(dst), "+d"(src2), "+g"(h)\
- : "D"((x86_reg)src2Stride), "S"((x86_reg)dstStride),\
- "m"(ff_pw_5), "m"(ff_pw_16)\
- : XMM_CLOBBERS("%xmm0" , "%xmm1" , "%xmm2" , "%xmm3" , \
- "%xmm4" , "%xmm5" , "%xmm6" , "%xmm7" , \
- "%xmm8" , "%xmm9" , "%xmm10", "%xmm11", \
- "%xmm12", "%xmm13", "%xmm14", "%xmm15",)\
- "memory"\
- );\
-}
-#else // ARCH_X86_64
-#define QPEL_H264_H16_XMM(OPNAME, OP, MMX)\
-static av_noinline void OPNAME ## h264_qpel16_h_lowpass_l2_ ## MMX(uint8_t *dst, uint8_t *src, uint8_t *src2, int dstStride, int src2Stride){\
- OPNAME ## h264_qpel8_h_lowpass_l2_ ## MMX(dst , src , src2 , dstStride, src2Stride);\
- OPNAME ## h264_qpel8_h_lowpass_l2_ ## MMX(dst+8, src+8, src2+8, dstStride, src2Stride);\
- src += 8*dstStride;\
- dst += 8*dstStride;\
- src2 += 8*src2Stride;\
- OPNAME ## h264_qpel8_h_lowpass_l2_ ## MMX(dst , src , src2 , dstStride, src2Stride);\
- OPNAME ## h264_qpel8_h_lowpass_l2_ ## MMX(dst+8, src+8, src2+8, dstStride, src2Stride);\
-}
-#endif // ARCH_X86_64
-
-#define QPEL_H264_H_XMM(OPNAME, OP, MMX)\
-static av_noinline void OPNAME ## h264_qpel8_h_lowpass_l2_ ## MMX(uint8_t *dst, uint8_t *src, uint8_t *src2, int dstStride, int src2Stride){\
- int h=8;\
- __asm__ volatile(\
- "pxor %%xmm7, %%xmm7 \n\t"\
- "movdqa "MANGLE(ff_pw_5)", %%xmm6\n\t"\
- "1: \n\t"\
- "lddqu -2(%0), %%xmm1 \n\t"\
- "movdqa %%xmm1, %%xmm0 \n\t"\
- "punpckhbw %%xmm7, %%xmm1 \n\t"\
- "punpcklbw %%xmm7, %%xmm0 \n\t"\
- "movdqa %%xmm1, %%xmm2 \n\t"\
- "movdqa %%xmm1, %%xmm3 \n\t"\
- "movdqa %%xmm1, %%xmm4 \n\t"\
- "movdqa %%xmm1, %%xmm5 \n\t"\
- "palignr $2, %%xmm0, %%xmm4 \n\t"\
- "palignr $4, %%xmm0, %%xmm3 \n\t"\
- "palignr $6, %%xmm0, %%xmm2 \n\t"\
- "palignr $8, %%xmm0, %%xmm1 \n\t"\
- "palignr $10,%%xmm0, %%xmm5 \n\t"\
- "paddw %%xmm5, %%xmm0 \n\t"\
- "paddw %%xmm3, %%xmm2 \n\t"\
- "paddw %%xmm4, %%xmm1 \n\t"\
- "psllw $2, %%xmm2 \n\t"\
- "movq (%2), %%xmm3 \n\t"\
- "psubw %%xmm1, %%xmm2 \n\t"\
- "paddw "MANGLE(ff_pw_16)", %%xmm0\n\t"\
- "pmullw %%xmm6, %%xmm2 \n\t"\
- "paddw %%xmm0, %%xmm2 \n\t"\
- "psraw $5, %%xmm2 \n\t"\
- "packuswb %%xmm2, %%xmm2 \n\t"\
- "pavgb %%xmm3, %%xmm2 \n\t"\
- OP(%%xmm2, (%1), %%xmm4, q)\
- "add %5, %0 \n\t"\
- "add %5, %1 \n\t"\
- "add %4, %2 \n\t"\
- "decl %3 \n\t"\
- "jg 1b \n\t"\
- : "+a"(src), "+c"(dst), "+d"(src2), "+g"(h)\
- : "D"((x86_reg)src2Stride), "S"((x86_reg)dstStride)\
- : XMM_CLOBBERS("%xmm0", "%xmm1", "%xmm2", "%xmm3", \
- "%xmm4", "%xmm5", "%xmm6", "%xmm7",)\
- "memory"\
- );\
-}\
-QPEL_H264_H16_XMM(OPNAME, OP, MMX)\
-\
-static av_noinline void OPNAME ## h264_qpel8_h_lowpass_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
- int h=8;\
- __asm__ volatile(\
- "pxor %%xmm7, %%xmm7 \n\t"\
- "movdqa "MANGLE(ff_pw_5)", %%xmm6\n\t"\
- "1: \n\t"\
- "lddqu -2(%0), %%xmm1 \n\t"\
- "movdqa %%xmm1, %%xmm0 \n\t"\
- "punpckhbw %%xmm7, %%xmm1 \n\t"\
- "punpcklbw %%xmm7, %%xmm0 \n\t"\
- "movdqa %%xmm1, %%xmm2 \n\t"\
- "movdqa %%xmm1, %%xmm3 \n\t"\
- "movdqa %%xmm1, %%xmm4 \n\t"\
- "movdqa %%xmm1, %%xmm5 \n\t"\
- "palignr $2, %%xmm0, %%xmm4 \n\t"\
- "palignr $4, %%xmm0, %%xmm3 \n\t"\
- "palignr $6, %%xmm0, %%xmm2 \n\t"\
- "palignr $8, %%xmm0, %%xmm1 \n\t"\
- "palignr $10,%%xmm0, %%xmm5 \n\t"\
- "paddw %%xmm5, %%xmm0 \n\t"\
- "paddw %%xmm3, %%xmm2 \n\t"\
- "paddw %%xmm4, %%xmm1 \n\t"\
- "psllw $2, %%xmm2 \n\t"\
- "psubw %%xmm1, %%xmm2 \n\t"\
- "paddw "MANGLE(ff_pw_16)", %%xmm0\n\t"\
- "pmullw %%xmm6, %%xmm2 \n\t"\
- "paddw %%xmm0, %%xmm2 \n\t"\
- "psraw $5, %%xmm2 \n\t"\
- "packuswb %%xmm2, %%xmm2 \n\t"\
- OP(%%xmm2, (%1), %%xmm4, q)\
- "add %3, %0 \n\t"\
- "add %4, %1 \n\t"\
- "decl %2 \n\t"\
- " jnz 1b \n\t"\
- : "+a"(src), "+c"(dst), "+g"(h)\
- : "D"((x86_reg)srcStride), "S"((x86_reg)dstStride)\
- : XMM_CLOBBERS("%xmm0", "%xmm1", "%xmm2", "%xmm3", \
- "%xmm4", "%xmm5", "%xmm6", "%xmm7",)\
- "memory"\
- );\
-}\
-static void OPNAME ## h264_qpel16_h_lowpass_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
- OPNAME ## h264_qpel8_h_lowpass_ ## MMX(dst , src , dstStride, srcStride);\
- OPNAME ## h264_qpel8_h_lowpass_ ## MMX(dst+8, src+8, dstStride, srcStride);\
- src += 8*srcStride;\
- dst += 8*dstStride;\
- OPNAME ## h264_qpel8_h_lowpass_ ## MMX(dst , src , dstStride, srcStride);\
- OPNAME ## h264_qpel8_h_lowpass_ ## MMX(dst+8, src+8, dstStride, srcStride);\
-}\
-
-#define QPEL_H264_V_XMM(OPNAME, OP, MMX)\
-static av_noinline void OPNAME ## h264_qpel8or16_v_lowpass_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int h){\
- src -= 2*srcStride;\
- \
- __asm__ volatile(\
- "pxor %%xmm7, %%xmm7 \n\t"\
- "movq (%0), %%xmm0 \n\t"\
- "add %2, %0 \n\t"\
- "movq (%0), %%xmm1 \n\t"\
- "add %2, %0 \n\t"\
- "movq (%0), %%xmm2 \n\t"\
- "add %2, %0 \n\t"\
- "movq (%0), %%xmm3 \n\t"\
- "add %2, %0 \n\t"\
- "movq (%0), %%xmm4 \n\t"\
- "add %2, %0 \n\t"\
- "punpcklbw %%xmm7, %%xmm0 \n\t"\
- "punpcklbw %%xmm7, %%xmm1 \n\t"\
- "punpcklbw %%xmm7, %%xmm2 \n\t"\
- "punpcklbw %%xmm7, %%xmm3 \n\t"\
- "punpcklbw %%xmm7, %%xmm4 \n\t"\
- QPEL_H264V_XMM(%%xmm0, %%xmm1, %%xmm2, %%xmm3, %%xmm4, %%xmm5, OP)\
- QPEL_H264V_XMM(%%xmm1, %%xmm2, %%xmm3, %%xmm4, %%xmm5, %%xmm0, OP)\
- QPEL_H264V_XMM(%%xmm2, %%xmm3, %%xmm4, %%xmm5, %%xmm0, %%xmm1, OP)\
- QPEL_H264V_XMM(%%xmm3, %%xmm4, %%xmm5, %%xmm0, %%xmm1, %%xmm2, OP)\
- QPEL_H264V_XMM(%%xmm4, %%xmm5, %%xmm0, %%xmm1, %%xmm2, %%xmm3, OP)\
- QPEL_H264V_XMM(%%xmm5, %%xmm0, %%xmm1, %%xmm2, %%xmm3, %%xmm4, OP)\
- QPEL_H264V_XMM(%%xmm0, %%xmm1, %%xmm2, %%xmm3, %%xmm4, %%xmm5, OP)\
- QPEL_H264V_XMM(%%xmm1, %%xmm2, %%xmm3, %%xmm4, %%xmm5, %%xmm0, OP)\
- "cmpl $16, %4 \n\t"\
- "jne 2f \n\t"\
- QPEL_H264V_XMM(%%xmm2, %%xmm3, %%xmm4, %%xmm5, %%xmm0, %%xmm1, OP)\
- QPEL_H264V_XMM(%%xmm3, %%xmm4, %%xmm5, %%xmm0, %%xmm1, %%xmm2, OP)\
- QPEL_H264V_XMM(%%xmm4, %%xmm5, %%xmm0, %%xmm1, %%xmm2, %%xmm3, OP)\
- QPEL_H264V_XMM(%%xmm5, %%xmm0, %%xmm1, %%xmm2, %%xmm3, %%xmm4, OP)\
- QPEL_H264V_XMM(%%xmm0, %%xmm1, %%xmm2, %%xmm3, %%xmm4, %%xmm5, OP)\
- QPEL_H264V_XMM(%%xmm1, %%xmm2, %%xmm3, %%xmm4, %%xmm5, %%xmm0, OP)\
- QPEL_H264V_XMM(%%xmm2, %%xmm3, %%xmm4, %%xmm5, %%xmm0, %%xmm1, OP)\
- QPEL_H264V_XMM(%%xmm3, %%xmm4, %%xmm5, %%xmm0, %%xmm1, %%xmm2, OP)\
- "2: \n\t"\
- \
- : "+a"(src), "+c"(dst)\
- : "S"((x86_reg)srcStride), "D"((x86_reg)dstStride), "rm"(h)\
- : XMM_CLOBBERS("%xmm0", "%xmm1", "%xmm2", "%xmm3", \
- "%xmm4", "%xmm5", "%xmm6", "%xmm7",)\
- "memory"\
- );\
-}\
-static void OPNAME ## h264_qpel8_v_lowpass_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
- OPNAME ## h264_qpel8or16_v_lowpass_ ## MMX(dst , src , dstStride, srcStride, 8);\
-}\
-static av_noinline void OPNAME ## h264_qpel16_v_lowpass_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
- OPNAME ## h264_qpel8or16_v_lowpass_ ## MMX(dst , src , dstStride, srcStride, 16);\
- OPNAME ## h264_qpel8or16_v_lowpass_ ## MMX(dst+8, src+8, dstStride, srcStride, 16);\
-}
-
-static av_always_inline void put_h264_qpel8or16_hv1_lowpass_sse2(int16_t *tmp, uint8_t *src, int tmpStride, int srcStride, int size){
- int w = (size+8)>>3;
- src -= 2*srcStride+2;
- while(w--){
- __asm__ volatile(
- "pxor %%xmm7, %%xmm7 \n\t"
- "movq (%0), %%xmm0 \n\t"
- "add %2, %0 \n\t"
- "movq (%0), %%xmm1 \n\t"
- "add %2, %0 \n\t"
- "movq (%0), %%xmm2 \n\t"
- "add %2, %0 \n\t"
- "movq (%0), %%xmm3 \n\t"
- "add %2, %0 \n\t"
- "movq (%0), %%xmm4 \n\t"
- "add %2, %0 \n\t"
- "punpcklbw %%xmm7, %%xmm0 \n\t"
- "punpcklbw %%xmm7, %%xmm1 \n\t"
- "punpcklbw %%xmm7, %%xmm2 \n\t"
- "punpcklbw %%xmm7, %%xmm3 \n\t"
- "punpcklbw %%xmm7, %%xmm4 \n\t"
- QPEL_H264HV_XMM(%%xmm0, %%xmm1, %%xmm2, %%xmm3, %%xmm4, %%xmm5, 0*48)
- QPEL_H264HV_XMM(%%xmm1, %%xmm2, %%xmm3, %%xmm4, %%xmm5, %%xmm0, 1*48)
- QPEL_H264HV_XMM(%%xmm2, %%xmm3, %%xmm4, %%xmm5, %%xmm0, %%xmm1, 2*48)
- QPEL_H264HV_XMM(%%xmm3, %%xmm4, %%xmm5, %%xmm0, %%xmm1, %%xmm2, 3*48)
- QPEL_H264HV_XMM(%%xmm4, %%xmm5, %%xmm0, %%xmm1, %%xmm2, %%xmm3, 4*48)
- QPEL_H264HV_XMM(%%xmm5, %%xmm0, %%xmm1, %%xmm2, %%xmm3, %%xmm4, 5*48)
- QPEL_H264HV_XMM(%%xmm0, %%xmm1, %%xmm2, %%xmm3, %%xmm4, %%xmm5, 6*48)
- QPEL_H264HV_XMM(%%xmm1, %%xmm2, %%xmm3, %%xmm4, %%xmm5, %%xmm0, 7*48)
- "cmpl $16, %3 \n\t"
- "jne 2f \n\t"
- QPEL_H264HV_XMM(%%xmm2, %%xmm3, %%xmm4, %%xmm5, %%xmm0, %%xmm1, 8*48)
- QPEL_H264HV_XMM(%%xmm3, %%xmm4, %%xmm5, %%xmm0, %%xmm1, %%xmm2, 9*48)
- QPEL_H264HV_XMM(%%xmm4, %%xmm5, %%xmm0, %%xmm1, %%xmm2, %%xmm3, 10*48)
- QPEL_H264HV_XMM(%%xmm5, %%xmm0, %%xmm1, %%xmm2, %%xmm3, %%xmm4, 11*48)
- QPEL_H264HV_XMM(%%xmm0, %%xmm1, %%xmm2, %%xmm3, %%xmm4, %%xmm5, 12*48)
- QPEL_H264HV_XMM(%%xmm1, %%xmm2, %%xmm3, %%xmm4, %%xmm5, %%xmm0, 13*48)
- QPEL_H264HV_XMM(%%xmm2, %%xmm3, %%xmm4, %%xmm5, %%xmm0, %%xmm1, 14*48)
- QPEL_H264HV_XMM(%%xmm3, %%xmm4, %%xmm5, %%xmm0, %%xmm1, %%xmm2, 15*48)
- "2: \n\t"
- : "+a"(src)
- : "c"(tmp), "S"((x86_reg)srcStride), "rm"(size)
- : XMM_CLOBBERS("%xmm0", "%xmm1", "%xmm2", "%xmm3",
- "%xmm4", "%xmm5", "%xmm6", "%xmm7",)
- "memory"
- );
- tmp += 8;
- src += 8 - (size+5)*srcStride;
- }
-}
-
-#define QPEL_H264_HV2_XMM(OPNAME, OP, MMX)\
-static av_always_inline void OPNAME ## h264_qpel8or16_hv2_lowpass_ ## MMX(uint8_t *dst, int16_t *tmp, int dstStride, int tmpStride, int size){\
- int h = size;\
- if(size == 16){\
- __asm__ volatile(\
- "1: \n\t"\
- "movdqa 32(%0), %%xmm4 \n\t"\
- "movdqa 16(%0), %%xmm5 \n\t"\
- "movdqa (%0), %%xmm7 \n\t"\
- "movdqa %%xmm4, %%xmm3 \n\t"\
- "movdqa %%xmm4, %%xmm2 \n\t"\
- "movdqa %%xmm4, %%xmm1 \n\t"\
- "movdqa %%xmm4, %%xmm0 \n\t"\
- "palignr $10, %%xmm5, %%xmm0 \n\t"\
- "palignr $8, %%xmm5, %%xmm1 \n\t"\
- "palignr $6, %%xmm5, %%xmm2 \n\t"\
- "palignr $4, %%xmm5, %%xmm3 \n\t"\
- "palignr $2, %%xmm5, %%xmm4 \n\t"\
- "paddw %%xmm5, %%xmm0 \n\t"\
- "paddw %%xmm4, %%xmm1 \n\t"\
- "paddw %%xmm3, %%xmm2 \n\t"\
- "movdqa %%xmm5, %%xmm6 \n\t"\
- "movdqa %%xmm5, %%xmm4 \n\t"\
- "movdqa %%xmm5, %%xmm3 \n\t"\
- "palignr $8, %%xmm7, %%xmm4 \n\t"\
- "palignr $2, %%xmm7, %%xmm6 \n\t"\
- "palignr $10, %%xmm7, %%xmm3 \n\t"\
- "paddw %%xmm6, %%xmm4 \n\t"\
- "movdqa %%xmm5, %%xmm6 \n\t"\
- "palignr $6, %%xmm7, %%xmm5 \n\t"\
- "palignr $4, %%xmm7, %%xmm6 \n\t"\
- "paddw %%xmm7, %%xmm3 \n\t"\
- "paddw %%xmm6, %%xmm5 \n\t"\
- \
- "psubw %%xmm1, %%xmm0 \n\t"\
- "psubw %%xmm4, %%xmm3 \n\t"\
- "psraw $2, %%xmm0 \n\t"\
- "psraw $2, %%xmm3 \n\t"\
- "psubw %%xmm1, %%xmm0 \n\t"\
- "psubw %%xmm4, %%xmm3 \n\t"\
- "paddw %%xmm2, %%xmm0 \n\t"\
- "paddw %%xmm5, %%xmm3 \n\t"\
- "psraw $2, %%xmm0 \n\t"\
- "psraw $2, %%xmm3 \n\t"\
- "paddw %%xmm2, %%xmm0 \n\t"\
- "paddw %%xmm5, %%xmm3 \n\t"\
- "psraw $6, %%xmm0 \n\t"\
- "psraw $6, %%xmm3 \n\t"\
- "packuswb %%xmm0, %%xmm3 \n\t"\
- OP(%%xmm3, (%1), %%xmm7, dqa)\
- "add $48, %0 \n\t"\
- "add %3, %1 \n\t"\
- "decl %2 \n\t"\
- " jnz 1b \n\t"\
- : "+a"(tmp), "+c"(dst), "+g"(h)\
- : "S"((x86_reg)dstStride)\
- : XMM_CLOBBERS("%xmm0", "%xmm1", "%xmm2", "%xmm3", \
- "%xmm4", "%xmm5", "%xmm6", "%xmm7",)\
- "memory"\
- );\
- }else{\
- __asm__ volatile(\
- "1: \n\t"\
- "movdqa 16(%0), %%xmm1 \n\t"\
- "movdqa (%0), %%xmm0 \n\t"\
- "movdqa %%xmm1, %%xmm2 \n\t"\
- "movdqa %%xmm1, %%xmm3 \n\t"\
- "movdqa %%xmm1, %%xmm4 \n\t"\
- "movdqa %%xmm1, %%xmm5 \n\t"\
- "palignr $10, %%xmm0, %%xmm5 \n\t"\
- "palignr $8, %%xmm0, %%xmm4 \n\t"\
- "palignr $6, %%xmm0, %%xmm3 \n\t"\
- "palignr $4, %%xmm0, %%xmm2 \n\t"\
- "palignr $2, %%xmm0, %%xmm1 \n\t"\
- "paddw %%xmm5, %%xmm0 \n\t"\
- "paddw %%xmm4, %%xmm1 \n\t"\
- "paddw %%xmm3, %%xmm2 \n\t"\
- "psubw %%xmm1, %%xmm0 \n\t"\
- "psraw $2, %%xmm0 \n\t"\
- "psubw %%xmm1, %%xmm0 \n\t"\
- "paddw %%xmm2, %%xmm0 \n\t"\
- "psraw $2, %%xmm0 \n\t"\
- "paddw %%xmm2, %%xmm0 \n\t"\
- "psraw $6, %%xmm0 \n\t"\
- "packuswb %%xmm0, %%xmm0 \n\t"\
- OP(%%xmm0, (%1), %%xmm7, q)\
- "add $48, %0 \n\t"\
- "add %3, %1 \n\t"\
- "decl %2 \n\t"\
- " jnz 1b \n\t"\
- : "+a"(tmp), "+c"(dst), "+g"(h)\
- : "S"((x86_reg)dstStride)\
- : XMM_CLOBBERS("%xmm0", "%xmm1", "%xmm2", "%xmm3", \
- "%xmm4", "%xmm5", "%xmm6", "%xmm7",)\
- "memory"\
- );\
- }\
-}
-
-#define QPEL_H264_HV_XMM(OPNAME, OP, MMX)\
-static av_noinline void OPNAME ## h264_qpel8or16_hv_lowpass_ ## MMX(uint8_t *dst, int16_t *tmp, uint8_t *src, int dstStride, int tmpStride, int srcStride, int size){\
- put_h264_qpel8or16_hv1_lowpass_sse2(tmp, src, tmpStride, srcStride, size);\
- OPNAME ## h264_qpel8or16_hv2_lowpass_ ## MMX(dst, tmp, dstStride, tmpStride, size);\
-}\
-static void OPNAME ## h264_qpel8_hv_lowpass_ ## MMX(uint8_t *dst, int16_t *tmp, uint8_t *src, int dstStride, int tmpStride, int srcStride){\
- OPNAME ## h264_qpel8or16_hv_lowpass_ ## MMX(dst, tmp, src, dstStride, tmpStride, srcStride, 8);\
-}\
-static void OPNAME ## h264_qpel16_hv_lowpass_ ## MMX(uint8_t *dst, int16_t *tmp, uint8_t *src, int dstStride, int tmpStride, int srcStride){\
- OPNAME ## h264_qpel8or16_hv_lowpass_ ## MMX(dst, tmp, src, dstStride, tmpStride, srcStride, 16);\
-}\
-
-#define put_pixels8_l2_sse2 put_pixels8_l2_mmx2
-#define avg_pixels8_l2_sse2 avg_pixels8_l2_mmx2
-#define put_pixels16_l2_sse2 put_pixels16_l2_mmx2
-#define avg_pixels16_l2_sse2 avg_pixels16_l2_mmx2
-#define put_pixels8_l2_ssse3 put_pixels8_l2_mmx2
-#define avg_pixels8_l2_ssse3 avg_pixels8_l2_mmx2
-#define put_pixels16_l2_ssse3 put_pixels16_l2_mmx2
-#define avg_pixels16_l2_ssse3 avg_pixels16_l2_mmx2
-
-#define put_pixels8_l2_shift5_sse2 put_pixels8_l2_shift5_mmx2
-#define avg_pixels8_l2_shift5_sse2 avg_pixels8_l2_shift5_mmx2
-#define put_pixels16_l2_shift5_sse2 put_pixels16_l2_shift5_mmx2
-#define avg_pixels16_l2_shift5_sse2 avg_pixels16_l2_shift5_mmx2
-#define put_pixels8_l2_shift5_ssse3 put_pixels8_l2_shift5_mmx2
-#define avg_pixels8_l2_shift5_ssse3 avg_pixels8_l2_shift5_mmx2
-#define put_pixels16_l2_shift5_ssse3 put_pixels16_l2_shift5_mmx2
-#define avg_pixels16_l2_shift5_ssse3 avg_pixels16_l2_shift5_mmx2
-
-#define put_h264_qpel8_h_lowpass_l2_sse2 put_h264_qpel8_h_lowpass_l2_mmx2
-#define avg_h264_qpel8_h_lowpass_l2_sse2 avg_h264_qpel8_h_lowpass_l2_mmx2
-#define put_h264_qpel16_h_lowpass_l2_sse2 put_h264_qpel16_h_lowpass_l2_mmx2
-#define avg_h264_qpel16_h_lowpass_l2_sse2 avg_h264_qpel16_h_lowpass_l2_mmx2
-
-#define put_h264_qpel8_v_lowpass_ssse3 put_h264_qpel8_v_lowpass_sse2
-#define avg_h264_qpel8_v_lowpass_ssse3 avg_h264_qpel8_v_lowpass_sse2
-#define put_h264_qpel16_v_lowpass_ssse3 put_h264_qpel16_v_lowpass_sse2
-#define avg_h264_qpel16_v_lowpass_ssse3 avg_h264_qpel16_v_lowpass_sse2
-
-#define put_h264_qpel8or16_hv2_lowpass_sse2 put_h264_qpel8or16_hv2_lowpass_mmx2
-#define avg_h264_qpel8or16_hv2_lowpass_sse2 avg_h264_qpel8or16_hv2_lowpass_mmx2
-
-#define H264_MC(OPNAME, SIZE, MMX, ALIGN) \
-H264_MC_C(OPNAME, SIZE, MMX, ALIGN)\
-H264_MC_V(OPNAME, SIZE, MMX, ALIGN)\
-H264_MC_H(OPNAME, SIZE, MMX, ALIGN)\
-H264_MC_HV(OPNAME, SIZE, MMX, ALIGN)\
-
-static void put_h264_qpel16_mc00_sse2 (uint8_t *dst, uint8_t *src, int stride){
- put_pixels16_sse2(dst, src, stride, 16);
-}
-static void avg_h264_qpel16_mc00_sse2 (uint8_t *dst, uint8_t *src, int stride){
- avg_pixels16_sse2(dst, src, stride, 16);
-}
-#define put_h264_qpel8_mc00_sse2 put_h264_qpel8_mc00_mmx2
-#define avg_h264_qpel8_mc00_sse2 avg_h264_qpel8_mc00_mmx2
-
-#define H264_MC_C(OPNAME, SIZE, MMX, ALIGN) \
-static void OPNAME ## h264_qpel ## SIZE ## _mc00_ ## MMX (uint8_t *dst, uint8_t *src, int stride){\
- OPNAME ## pixels ## SIZE ## _ ## MMX(dst, src, stride, SIZE);\
-}\
-
-#define H264_MC_H(OPNAME, SIZE, MMX, ALIGN) \
-static void OPNAME ## h264_qpel ## SIZE ## _mc10_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
- OPNAME ## h264_qpel ## SIZE ## _h_lowpass_l2_ ## MMX(dst, src, src, stride, stride);\
-}\
-\
-static void OPNAME ## h264_qpel ## SIZE ## _mc20_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
- OPNAME ## h264_qpel ## SIZE ## _h_lowpass_ ## MMX(dst, src, stride, stride);\
-}\
-\
-static void OPNAME ## h264_qpel ## SIZE ## _mc30_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
- OPNAME ## h264_qpel ## SIZE ## _h_lowpass_l2_ ## MMX(dst, src, src+1, stride, stride);\
-}\
-
-#define H264_MC_V(OPNAME, SIZE, MMX, ALIGN) \
-static void OPNAME ## h264_qpel ## SIZE ## _mc01_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
- DECLARE_ALIGNED(ALIGN, uint8_t, temp)[SIZE*SIZE];\
- put_h264_qpel ## SIZE ## _v_lowpass_ ## MMX(temp, src, SIZE, stride);\
- OPNAME ## pixels ## SIZE ## _l2_ ## MMX(dst, src, temp, stride, stride, SIZE);\
-}\
-\
-static void OPNAME ## h264_qpel ## SIZE ## _mc02_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
- OPNAME ## h264_qpel ## SIZE ## _v_lowpass_ ## MMX(dst, src, stride, stride);\
-}\
-\
-static void OPNAME ## h264_qpel ## SIZE ## _mc03_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
- DECLARE_ALIGNED(ALIGN, uint8_t, temp)[SIZE*SIZE];\
- put_h264_qpel ## SIZE ## _v_lowpass_ ## MMX(temp, src, SIZE, stride);\
- OPNAME ## pixels ## SIZE ## _l2_ ## MMX(dst, src+stride, temp, stride, stride, SIZE);\
-}\
-
-#define H264_MC_HV(OPNAME, SIZE, MMX, ALIGN) \
-static void OPNAME ## h264_qpel ## SIZE ## _mc11_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
- DECLARE_ALIGNED(ALIGN, uint8_t, temp)[SIZE*SIZE];\
- put_h264_qpel ## SIZE ## _v_lowpass_ ## MMX(temp, src, SIZE, stride);\
- OPNAME ## h264_qpel ## SIZE ## _h_lowpass_l2_ ## MMX(dst, src, temp, stride, SIZE);\
-}\
-\
-static void OPNAME ## h264_qpel ## SIZE ## _mc31_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
- DECLARE_ALIGNED(ALIGN, uint8_t, temp)[SIZE*SIZE];\
- put_h264_qpel ## SIZE ## _v_lowpass_ ## MMX(temp, src+1, SIZE, stride);\
- OPNAME ## h264_qpel ## SIZE ## _h_lowpass_l2_ ## MMX(dst, src, temp, stride, SIZE);\
-}\
-\
-static void OPNAME ## h264_qpel ## SIZE ## _mc13_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
- DECLARE_ALIGNED(ALIGN, uint8_t, temp)[SIZE*SIZE];\
- put_h264_qpel ## SIZE ## _v_lowpass_ ## MMX(temp, src, SIZE, stride);\
- OPNAME ## h264_qpel ## SIZE ## _h_lowpass_l2_ ## MMX(dst, src+stride, temp, stride, SIZE);\
-}\
-\
-static void OPNAME ## h264_qpel ## SIZE ## _mc33_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
- DECLARE_ALIGNED(ALIGN, uint8_t, temp)[SIZE*SIZE];\
- put_h264_qpel ## SIZE ## _v_lowpass_ ## MMX(temp, src+1, SIZE, stride);\
- OPNAME ## h264_qpel ## SIZE ## _h_lowpass_l2_ ## MMX(dst, src+stride, temp, stride, SIZE);\
-}\
-\
-static void OPNAME ## h264_qpel ## SIZE ## _mc22_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
- DECLARE_ALIGNED(ALIGN, uint16_t, temp)[SIZE*(SIZE<8?12:24)];\
- OPNAME ## h264_qpel ## SIZE ## _hv_lowpass_ ## MMX(dst, temp, src, stride, SIZE, stride);\
-}\
-\
-static void OPNAME ## h264_qpel ## SIZE ## _mc21_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
- DECLARE_ALIGNED(ALIGN, uint8_t, temp)[SIZE*(SIZE<8?12:24)*2 + SIZE*SIZE];\
- uint8_t * const halfHV= temp;\
- int16_t * const halfV= (int16_t*)(temp + SIZE*SIZE);\
- assert(((int)temp & 7) == 0);\
- put_h264_qpel ## SIZE ## _hv_lowpass_ ## MMX(halfHV, halfV, src, SIZE, SIZE, stride);\
- OPNAME ## h264_qpel ## SIZE ## _h_lowpass_l2_ ## MMX(dst, src, halfHV, stride, SIZE);\
-}\
-\
-static void OPNAME ## h264_qpel ## SIZE ## _mc23_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
- DECLARE_ALIGNED(ALIGN, uint8_t, temp)[SIZE*(SIZE<8?12:24)*2 + SIZE*SIZE];\
- uint8_t * const halfHV= temp;\
- int16_t * const halfV= (int16_t*)(temp + SIZE*SIZE);\
- assert(((int)temp & 7) == 0);\
- put_h264_qpel ## SIZE ## _hv_lowpass_ ## MMX(halfHV, halfV, src, SIZE, SIZE, stride);\
- OPNAME ## h264_qpel ## SIZE ## _h_lowpass_l2_ ## MMX(dst, src+stride, halfHV, stride, SIZE);\
-}\
-\
-static void OPNAME ## h264_qpel ## SIZE ## _mc12_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
- DECLARE_ALIGNED(ALIGN, uint8_t, temp)[SIZE*(SIZE<8?12:24)*2 + SIZE*SIZE];\
- uint8_t * const halfHV= temp;\
- int16_t * const halfV= (int16_t*)(temp + SIZE*SIZE);\
- assert(((int)temp & 7) == 0);\
- put_h264_qpel ## SIZE ## _hv_lowpass_ ## MMX(halfHV, halfV, src, SIZE, SIZE, stride);\
- OPNAME ## pixels ## SIZE ## _l2_shift5_ ## MMX(dst, halfV+2, halfHV, stride, SIZE, SIZE);\
-}\
-\
-static void OPNAME ## h264_qpel ## SIZE ## _mc32_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
- DECLARE_ALIGNED(ALIGN, uint8_t, temp)[SIZE*(SIZE<8?12:24)*2 + SIZE*SIZE];\
- uint8_t * const halfHV= temp;\
- int16_t * const halfV= (int16_t*)(temp + SIZE*SIZE);\
- assert(((int)temp & 7) == 0);\
- put_h264_qpel ## SIZE ## _hv_lowpass_ ## MMX(halfHV, halfV, src, SIZE, SIZE, stride);\
- OPNAME ## pixels ## SIZE ## _l2_shift5_ ## MMX(dst, halfV+3, halfHV, stride, SIZE, SIZE);\
-}\
-
-#define H264_MC_4816(MMX)\
-H264_MC(put_, 4, MMX, 8)\
-H264_MC(put_, 8, MMX, 8)\
-H264_MC(put_, 16,MMX, 8)\
-H264_MC(avg_, 4, MMX, 8)\
-H264_MC(avg_, 8, MMX, 8)\
-H264_MC(avg_, 16,MMX, 8)\
-
-#define H264_MC_816(QPEL, XMM)\
-QPEL(put_, 8, XMM, 16)\
-QPEL(put_, 16,XMM, 16)\
-QPEL(avg_, 8, XMM, 16)\
-QPEL(avg_, 16,XMM, 16)\
-
-
-#define AVG_3DNOW_OP(a,b,temp, size) \
-"mov" #size " " #b ", " #temp " \n\t"\
-"pavgusb " #temp ", " #a " \n\t"\
-"mov" #size " " #a ", " #b " \n\t"
-#define AVG_MMX2_OP(a,b,temp, size) \
-"mov" #size " " #b ", " #temp " \n\t"\
-"pavgb " #temp ", " #a " \n\t"\
-"mov" #size " " #a ", " #b " \n\t"
-
-#define PAVGB "pavgusb"
-QPEL_H264(put_, PUT_OP, 3dnow)
-QPEL_H264(avg_, AVG_3DNOW_OP, 3dnow)
-#undef PAVGB
-#define PAVGB "pavgb"
-QPEL_H264(put_, PUT_OP, mmx2)
-QPEL_H264(avg_, AVG_MMX2_OP, mmx2)
-QPEL_H264_V_XMM(put_, PUT_OP, sse2)
-QPEL_H264_V_XMM(avg_, AVG_MMX2_OP, sse2)
-QPEL_H264_HV_XMM(put_, PUT_OP, sse2)
-QPEL_H264_HV_XMM(avg_, AVG_MMX2_OP, sse2)
-#if HAVE_SSSE3
-QPEL_H264_H_XMM(put_, PUT_OP, ssse3)
-QPEL_H264_H_XMM(avg_, AVG_MMX2_OP, ssse3)
-QPEL_H264_HV2_XMM(put_, PUT_OP, ssse3)
-QPEL_H264_HV2_XMM(avg_, AVG_MMX2_OP, ssse3)
-QPEL_H264_HV_XMM(put_, PUT_OP, ssse3)
-QPEL_H264_HV_XMM(avg_, AVG_MMX2_OP, ssse3)
-#endif
-#undef PAVGB
-
-H264_MC_4816(3dnow)
-H264_MC_4816(mmx2)
-H264_MC_816(H264_MC_V, sse2)
-H264_MC_816(H264_MC_HV, sse2)
-#if HAVE_SSSE3
-H264_MC_816(H264_MC_H, ssse3)
-H264_MC_816(H264_MC_HV, ssse3)
-#endif
-
-
-
-//10bit
-#define LUMA_MC_OP(OP, NUM, DEPTH, TYPE, OPT) \
-void ff_ ## OP ## _h264_qpel ## NUM ## _ ## TYPE ## _ ## DEPTH ## _ ## OPT \
- (uint8_t *dst, uint8_t *src, int stride);
-
-#define LUMA_MC_ALL(DEPTH, TYPE, OPT) \
- LUMA_MC_OP(put, 4, DEPTH, TYPE, OPT) \
- LUMA_MC_OP(avg, 4, DEPTH, TYPE, OPT) \
- LUMA_MC_OP(put, 8, DEPTH, TYPE, OPT) \
- LUMA_MC_OP(avg, 8, DEPTH, TYPE, OPT) \
- LUMA_MC_OP(put, 16, DEPTH, TYPE, OPT) \
- LUMA_MC_OP(avg, 16, DEPTH, TYPE, OPT)
-
-#define LUMA_MC_816(DEPTH, TYPE, OPT) \
- LUMA_MC_OP(put, 8, DEPTH, TYPE, OPT) \
- LUMA_MC_OP(avg, 8, DEPTH, TYPE, OPT) \
- LUMA_MC_OP(put, 16, DEPTH, TYPE, OPT) \
- LUMA_MC_OP(avg, 16, DEPTH, TYPE, OPT)
-
-LUMA_MC_ALL(10, mc00, mmxext)
-LUMA_MC_ALL(10, mc10, mmxext)
-LUMA_MC_ALL(10, mc20, mmxext)
-LUMA_MC_ALL(10, mc30, mmxext)
-LUMA_MC_ALL(10, mc01, mmxext)
-LUMA_MC_ALL(10, mc11, mmxext)
-LUMA_MC_ALL(10, mc21, mmxext)
-LUMA_MC_ALL(10, mc31, mmxext)
-LUMA_MC_ALL(10, mc02, mmxext)
-LUMA_MC_ALL(10, mc12, mmxext)
-LUMA_MC_ALL(10, mc22, mmxext)
-LUMA_MC_ALL(10, mc32, mmxext)
-LUMA_MC_ALL(10, mc03, mmxext)
-LUMA_MC_ALL(10, mc13, mmxext)
-LUMA_MC_ALL(10, mc23, mmxext)
-LUMA_MC_ALL(10, mc33, mmxext)
-
-LUMA_MC_816(10, mc00, sse2)
-LUMA_MC_816(10, mc10, sse2)
-LUMA_MC_816(10, mc10, sse2_cache64)
-LUMA_MC_816(10, mc10, ssse3_cache64)
-LUMA_MC_816(10, mc20, sse2)
-LUMA_MC_816(10, mc20, sse2_cache64)
-LUMA_MC_816(10, mc20, ssse3_cache64)
-LUMA_MC_816(10, mc30, sse2)
-LUMA_MC_816(10, mc30, sse2_cache64)
-LUMA_MC_816(10, mc30, ssse3_cache64)
-LUMA_MC_816(10, mc01, sse2)
-LUMA_MC_816(10, mc11, sse2)
-LUMA_MC_816(10, mc21, sse2)
-LUMA_MC_816(10, mc31, sse2)
-LUMA_MC_816(10, mc02, sse2)
-LUMA_MC_816(10, mc12, sse2)
-LUMA_MC_816(10, mc22, sse2)
-LUMA_MC_816(10, mc32, sse2)
-LUMA_MC_816(10, mc03, sse2)
-LUMA_MC_816(10, mc13, sse2)
-LUMA_MC_816(10, mc23, sse2)
-LUMA_MC_816(10, mc33, sse2)
-
-#define QPEL16_OPMC(OP, MC, MMX)\
-void ff_ ## OP ## _h264_qpel16_ ## MC ## _10_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
- ff_ ## OP ## _h264_qpel8_ ## MC ## _10_ ## MMX(dst , src , stride);\
- ff_ ## OP ## _h264_qpel8_ ## MC ## _10_ ## MMX(dst+16, src+16, stride);\
- src += 8*stride;\
- dst += 8*stride;\
- ff_ ## OP ## _h264_qpel8_ ## MC ## _10_ ## MMX(dst , src , stride);\
- ff_ ## OP ## _h264_qpel8_ ## MC ## _10_ ## MMX(dst+16, src+16, stride);\
-}
-
-#define QPEL16_OP(MC, MMX)\
-QPEL16_OPMC(put, MC, MMX)\
-QPEL16_OPMC(avg, MC, MMX)
-
-#define QPEL16(MMX)\
-QPEL16_OP(mc00, MMX)\
-QPEL16_OP(mc01, MMX)\
-QPEL16_OP(mc02, MMX)\
-QPEL16_OP(mc03, MMX)\
-QPEL16_OP(mc10, MMX)\
-QPEL16_OP(mc11, MMX)\
-QPEL16_OP(mc12, MMX)\
-QPEL16_OP(mc13, MMX)\
-QPEL16_OP(mc20, MMX)\
-QPEL16_OP(mc21, MMX)\
-QPEL16_OP(mc22, MMX)\
-QPEL16_OP(mc23, MMX)\
-QPEL16_OP(mc30, MMX)\
-QPEL16_OP(mc31, MMX)\
-QPEL16_OP(mc32, MMX)\
-QPEL16_OP(mc33, MMX)
-
-#if ARCH_X86_32 && HAVE_YASM // ARCH_X86_64 implies sse2+
-QPEL16(mmxext)
-#endif
diff --git a/gst-libs/ext/libav/libavcodec/x86/h264_weight.asm b/gst-libs/ext/libav/libavcodec/x86/h264_weight.asm
index bd0d9d6..646acdf 100644
--- a/gst-libs/ext/libav/libavcodec/x86/h264_weight.asm
+++ b/gst-libs/ext/libav/libavcodec/x86/h264_weight.asm
@@ -21,7 +21,7 @@
;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
;******************************************************************************
-%include "x86inc.asm"
+%include "libavutil/x86/x86util.asm"
SECTION .text
@@ -70,10 +70,10 @@ SECTION .text
packuswb m0, m1
%endmacro
-INIT_MMX
-cglobal h264_weight_16_mmx2, 6, 6, 0
+INIT_MMX mmxext
+cglobal h264_weight_16, 6, 6, 0
WEIGHT_SETUP
-.nextrow
+.nextrow:
WEIGHT_OP 0, 4
mova [r0 ], m0
WEIGHT_OP 8, 12
@@ -83,10 +83,10 @@ cglobal h264_weight_16_mmx2, 6, 6, 0
jnz .nextrow
REP_RET
-%macro WEIGHT_FUNC_MM 3
-cglobal h264_weight_%1_%3, 6, 6, %2
+%macro WEIGHT_FUNC_MM 2
+cglobal h264_weight_%1, 6, 6, %2
WEIGHT_SETUP
-.nextrow
+.nextrow:
WEIGHT_OP 0, mmsize/2
mova [r0], m0
add r0, r1
@@ -95,17 +95,17 @@ cglobal h264_weight_%1_%3, 6, 6, %2
REP_RET
%endmacro
-INIT_MMX
-WEIGHT_FUNC_MM 8, 0, mmx2
-INIT_XMM
-WEIGHT_FUNC_MM 16, 8, sse2
+INIT_MMX mmxext
+WEIGHT_FUNC_MM 8, 0
+INIT_XMM sse2
+WEIGHT_FUNC_MM 16, 8
-%macro WEIGHT_FUNC_HALF_MM 3
-cglobal h264_weight_%1_%3, 6, 6, %2
+%macro WEIGHT_FUNC_HALF_MM 2
+cglobal h264_weight_%1, 6, 6, %2
WEIGHT_SETUP
sar r2d, 1
lea r3, [r1*2]
-.nextrow
+.nextrow:
WEIGHT_OP 0, r1
movh [r0], m0
%if mmsize == 16
@@ -120,14 +120,14 @@ cglobal h264_weight_%1_%3, 6, 6, %2
REP_RET
%endmacro
-INIT_MMX
-WEIGHT_FUNC_HALF_MM 4, 0, mmx2
-INIT_XMM
-WEIGHT_FUNC_HALF_MM 8, 8, sse2
+INIT_MMX mmxext
+WEIGHT_FUNC_HALF_MM 4, 0
+INIT_XMM sse2
+WEIGHT_FUNC_HALF_MM 8, 8
%macro BIWEIGHT_SETUP 0
-%ifdef ARCH_X86_64
-%define off_regd r11d
+%if ARCH_X86_64
+%define off_regd r7d
%else
%define off_regd r3d
%endif
@@ -135,12 +135,25 @@ WEIGHT_FUNC_HALF_MM 8, 8, sse2
add off_regd, 1
or off_regd, 1
add r4, 1
+%if cpuflag(ssse3)
+ movd m4, r5d
+ movd m0, r6d
+%else
movd m3, r5d
movd m4, r6d
+%endif
movd m5, off_regd
movd m6, r4d
pslld m5, m6
psrld m5, 1
+%if cpuflag(ssse3)
+ punpcklbw m4, m0
+ pshuflw m4, m4, 0
+ pshuflw m5, m5, 0
+ punpcklqdq m4, m4
+ punpcklqdq m5, m5
+
+%else
%if mmsize == 16
pshuflw m3, m3, 0
pshuflw m4, m4, 0
@@ -154,6 +167,7 @@ WEIGHT_FUNC_HALF_MM 8, 8, sse2
pshufw m5, m5, 0
%endif
pxor m7, m7
+%endif
%endmacro
%macro BIWEIGHT_STEPA 3
@@ -174,11 +188,11 @@ WEIGHT_FUNC_HALF_MM 8, 8, sse2
packuswb m0, m1
%endmacro
-INIT_MMX
-cglobal h264_biweight_16_mmx2, 7, 7, 0
+INIT_MMX mmxext
+cglobal h264_biweight_16, 7, 8, 0
BIWEIGHT_SETUP
movifnidn r3d, r3m
-.nextrow
+.nextrow:
BIWEIGHT_STEPA 0, 1, 0
BIWEIGHT_STEPA 1, 2, 4
BIWEIGHT_STEPB
@@ -193,11 +207,11 @@ cglobal h264_biweight_16_mmx2, 7, 7, 0
jnz .nextrow
REP_RET
-%macro BIWEIGHT_FUNC_MM 3
-cglobal h264_biweight_%1_%3, 7, 7, %2
+%macro BIWEIGHT_FUNC_MM 2
+cglobal h264_biweight_%1, 7, 8, %2
BIWEIGHT_SETUP
movifnidn r3d, r3m
-.nextrow
+.nextrow:
BIWEIGHT_STEPA 0, 1, 0
BIWEIGHT_STEPA 1, 2, mmsize/2
BIWEIGHT_STEPB
@@ -209,18 +223,18 @@ cglobal h264_biweight_%1_%3, 7, 7, %2
REP_RET
%endmacro
-INIT_MMX
-BIWEIGHT_FUNC_MM 8, 0, mmx2
-INIT_XMM
-BIWEIGHT_FUNC_MM 16, 8, sse2
+INIT_MMX mmxext
+BIWEIGHT_FUNC_MM 8, 0
+INIT_XMM sse2
+BIWEIGHT_FUNC_MM 16, 8
-%macro BIWEIGHT_FUNC_HALF_MM 3
-cglobal h264_biweight_%1_%3, 7, 7, %2
+%macro BIWEIGHT_FUNC_HALF_MM 2
+cglobal h264_biweight_%1, 7, 8, %2
BIWEIGHT_SETUP
movifnidn r3d, r3m
sar r3, 1
lea r4, [r2*2]
-.nextrow
+.nextrow:
BIWEIGHT_STEPA 0, 1, 0
BIWEIGHT_STEPA 1, 2, r2
BIWEIGHT_STEPB
@@ -238,33 +252,10 @@ cglobal h264_biweight_%1_%3, 7, 7, %2
REP_RET
%endmacro
-INIT_MMX
-BIWEIGHT_FUNC_HALF_MM 4, 0, mmx2
-INIT_XMM
-BIWEIGHT_FUNC_HALF_MM 8, 8, sse2
-
-%macro BIWEIGHT_SSSE3_SETUP 0
-%ifdef ARCH_X86_64
-%define off_regd r11d
-%else
-%define off_regd r3d
-%endif
- mov off_regd, r7m
- add off_regd, 1
- or off_regd, 1
- add r4, 1
- movd m4, r5d
- movd m0, r6d
- movd m5, off_regd
- movd m6, r4d
- pslld m5, m6
- psrld m5, 1
- punpcklbw m4, m0
- pshuflw m4, m4, 0
- pshuflw m5, m5, 0
- punpcklqdq m4, m4
- punpcklqdq m5, m5
-%endmacro
+INIT_MMX mmxext
+BIWEIGHT_FUNC_HALF_MM 4, 0
+INIT_XMM sse2
+BIWEIGHT_FUNC_HALF_MM 8, 8
%macro BIWEIGHT_SSSE3_OP 0
pmaddubsw m0, m4
@@ -276,12 +267,12 @@ BIWEIGHT_FUNC_HALF_MM 8, 8, sse2
packuswb m0, m2
%endmacro
-INIT_XMM
-cglobal h264_biweight_16_ssse3, 7, 7, 8
- BIWEIGHT_SSSE3_SETUP
+INIT_XMM ssse3
+cglobal h264_biweight_16, 7, 8, 8
+ BIWEIGHT_SETUP
movifnidn r3d, r3m
-.nextrow
+.nextrow:
movh m0, [r0]
movh m2, [r0+8]
movh m3, [r1+8]
@@ -295,14 +286,14 @@ cglobal h264_biweight_16_ssse3, 7, 7, 8
jnz .nextrow
REP_RET
-INIT_XMM
-cglobal h264_biweight_8_ssse3, 7, 7, 8
- BIWEIGHT_SSSE3_SETUP
+INIT_XMM ssse3
+cglobal h264_biweight_8, 7, 8, 8
+ BIWEIGHT_SETUP
movifnidn r3d, r3m
sar r3, 1
lea r4, [r2*2]
-.nextrow
+.nextrow:
movh m0, [r0]
movh m1, [r1]
movh m2, [r0+r2]
diff --git a/gst-libs/ext/libav/libavcodec/x86/h264_weight_10bit.asm b/gst-libs/ext/libav/libavcodec/x86/h264_weight_10bit.asm
index 9c4b276..3b09e42 100644
--- a/gst-libs/ext/libav/libavcodec/x86/h264_weight_10bit.asm
+++ b/gst-libs/ext/libav/libavcodec/x86/h264_weight_10bit.asm
@@ -22,8 +22,7 @@
;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
;******************************************************************************
-%include "x86inc.asm"
-%include "x86util.asm"
+%include "libavutil/x86/x86util.asm"
SECTION_RODATA 32
@@ -40,7 +39,7 @@ SECTION .text
; int weight, int offset);
;-----------------------------------------------------------------------------
%macro WEIGHT_PROLOGUE 0
-.prologue
+.prologue:
PROLOGUE 0,6,8
movifnidn r0, r0mp
movifnidn r1d, r1m
@@ -49,7 +48,7 @@ SECTION .text
movifnidn r5d, r5m
%endmacro
-%macro WEIGHT_SETUP 1
+%macro WEIGHT_SETUP 0
mova m0, [pw_1]
movd m2, r3m
pslld m0, m2 ; 1<<log2_denom
@@ -60,19 +59,19 @@ SECTION .text
pshufd m3, m3, 0
mova m4, [pw_pixel_max]
paddw m2, [sq_1] ; log2_denom+1
-%ifnidn %1, sse4
+%if notcpuflag(sse4)
pxor m7, m7
%endif
%endmacro
-%macro WEIGHT_OP 2-3
-%if %0==2
- mova m5, [r0+%2]
+%macro WEIGHT_OP 1-2
+%if %0==1
+ mova m5, [r0+%1]
punpckhwd m6, m5, m0
punpcklwd m5, m0
%else
- movq m5, [r0+%2]
- movq m6, [r0+%3]
+ movq m5, [r0+%1]
+ movq m6, [r0+%2]
punpcklwd m5, m0
punpcklwd m6, m0
%endif
@@ -80,7 +79,7 @@ SECTION .text
pmaddwd m6, m3
psrad m5, m2
psrad m6, m2
-%ifidn %1, sse4
+%if cpuflag(sse4)
packusdw m5, m6
pminsw m5, m4
%else
@@ -89,14 +88,14 @@ SECTION .text
%endif
%endmacro
-%macro WEIGHT_FUNC_DBL 1
-cglobal h264_weight_16_10_%1
+%macro WEIGHT_FUNC_DBL 0
+cglobal h264_weight_16_10
WEIGHT_PROLOGUE
- WEIGHT_SETUP %1
-.nextrow
- WEIGHT_OP %1, 0
+ WEIGHT_SETUP
+.nextrow:
+ WEIGHT_OP 0
mova [r0 ], m5
- WEIGHT_OP %1, 16
+ WEIGHT_OP 16
mova [r0+16], m5
add r0, r1
dec r2d
@@ -104,17 +103,18 @@ cglobal h264_weight_16_10_%1
REP_RET
%endmacro
-INIT_XMM
-WEIGHT_FUNC_DBL sse2
-WEIGHT_FUNC_DBL sse4
+INIT_XMM sse2
+WEIGHT_FUNC_DBL
+INIT_XMM sse4
+WEIGHT_FUNC_DBL
-%macro WEIGHT_FUNC_MM 1
-cglobal h264_weight_8_10_%1
+%macro WEIGHT_FUNC_MM 0
+cglobal h264_weight_8_10
WEIGHT_PROLOGUE
- WEIGHT_SETUP %1
-.nextrow
- WEIGHT_OP %1, 0
+ WEIGHT_SETUP
+.nextrow:
+ WEIGHT_OP 0
mova [r0], m5
add r0, r1
dec r2d
@@ -122,19 +122,20 @@ cglobal h264_weight_8_10_%1
REP_RET
%endmacro
-INIT_XMM
-WEIGHT_FUNC_MM sse2
-WEIGHT_FUNC_MM sse4
+INIT_XMM sse2
+WEIGHT_FUNC_MM
+INIT_XMM sse4
+WEIGHT_FUNC_MM
-%macro WEIGHT_FUNC_HALF_MM 1
-cglobal h264_weight_4_10_%1
+%macro WEIGHT_FUNC_HALF_MM 0
+cglobal h264_weight_4_10
WEIGHT_PROLOGUE
sar r2d, 1
- WEIGHT_SETUP %1
+ WEIGHT_SETUP
lea r3, [r1*2]
-.nextrow
- WEIGHT_OP %1, 0, r1
+.nextrow:
+ WEIGHT_OP 0, r1
movh [r0], m5
movhps [r0+r1], m5
add r0, r3
@@ -143,24 +144,25 @@ cglobal h264_weight_4_10_%1
REP_RET
%endmacro
-INIT_XMM
-WEIGHT_FUNC_HALF_MM sse2
-WEIGHT_FUNC_HALF_MM sse4
+INIT_XMM sse2
+WEIGHT_FUNC_HALF_MM
+INIT_XMM sse4
+WEIGHT_FUNC_HALF_MM
;-----------------------------------------------------------------------------
; void h264_biweight(uint8_t *dst, uint8_t *src, int stride, int height,
; int log2_denom, int weightd, int weights, int offset);
;-----------------------------------------------------------------------------
-%ifdef ARCH_X86_32
+%if ARCH_X86_32
DECLARE_REG_TMP 3
%else
-DECLARE_REG_TMP 10
+DECLARE_REG_TMP 7
%endif
%macro BIWEIGHT_PROLOGUE 0
-.prologue
- PROLOGUE 0,7,8
+.prologue:
+ PROLOGUE 0,8,8
movifnidn r0, r0mp
movifnidn r1, r1mp
movifnidn r2d, r2m
@@ -169,7 +171,7 @@ DECLARE_REG_TMP 10
movifnidn t0d, r7m
%endmacro
-%macro BIWEIGHT_SETUP 1
+%macro BIWEIGHT_SETUP 0
lea t0, [t0*4+1] ; (offset<<2)+1
or t0, 1
shl r6, 16
@@ -183,23 +185,23 @@ DECLARE_REG_TMP 10
pshufd m5, m5, 0
mova m3, [pw_pixel_max]
movifnidn r3d, r3m
-%ifnidn %1, sse4
+%if notcpuflag(sse4)
pxor m7, m7
%endif
%endmacro
-%macro BIWEIGHT 2-3
-%if %0==2
- mova m0, [r0+%2]
- mova m1, [r1+%2]
+%macro BIWEIGHT 1-2
+%if %0==1
+ mova m0, [r0+%1]
+ mova m1, [r1+%1]
punpckhwd m2, m0, m1
punpcklwd m0, m1
%else
- movq m0, [r0+%2]
- movq m1, [r1+%2]
+ movq m0, [r0+%1]
+ movq m1, [r1+%1]
punpcklwd m0, m1
- movq m2, [r0+%3]
- movq m1, [r1+%3]
+ movq m2, [r0+%2]
+ movq m1, [r1+%2]
punpcklwd m2, m1
%endif
pmaddwd m0, m4
@@ -208,7 +210,7 @@ DECLARE_REG_TMP 10
paddd m2, m5
psrad m0, m6
psrad m2, m6
-%ifidn %1, sse4
+%if cpuflag(sse4)
packusdw m0, m2
pminsw m0, m3
%else
@@ -217,14 +219,14 @@ DECLARE_REG_TMP 10
%endif
%endmacro
-%macro BIWEIGHT_FUNC_DBL 1
-cglobal h264_biweight_16_10_%1
+%macro BIWEIGHT_FUNC_DBL 0
+cglobal h264_biweight_16_10
BIWEIGHT_PROLOGUE
- BIWEIGHT_SETUP %1
-.nextrow
- BIWEIGHT %1, 0
+ BIWEIGHT_SETUP
+.nextrow:
+ BIWEIGHT 0
mova [r0 ], m0
- BIWEIGHT %1, 16
+ BIWEIGHT 16
mova [r0+16], m0
add r0, r2
add r1, r2
@@ -233,16 +235,17 @@ cglobal h264_biweight_16_10_%1
REP_RET
%endmacro
-INIT_XMM
-BIWEIGHT_FUNC_DBL sse2
-BIWEIGHT_FUNC_DBL sse4
+INIT_XMM sse2
+BIWEIGHT_FUNC_DBL
+INIT_XMM sse4
+BIWEIGHT_FUNC_DBL
-%macro BIWEIGHT_FUNC 1
-cglobal h264_biweight_8_10_%1
+%macro BIWEIGHT_FUNC 0
+cglobal h264_biweight_8_10
BIWEIGHT_PROLOGUE
- BIWEIGHT_SETUP %1
-.nextrow
- BIWEIGHT %1, 0
+ BIWEIGHT_SETUP
+.nextrow:
+ BIWEIGHT 0
mova [r0], m0
add r0, r2
add r1, r2
@@ -251,18 +254,19 @@ cglobal h264_biweight_8_10_%1
REP_RET
%endmacro
-INIT_XMM
-BIWEIGHT_FUNC sse2
-BIWEIGHT_FUNC sse4
+INIT_XMM sse2
+BIWEIGHT_FUNC
+INIT_XMM sse4
+BIWEIGHT_FUNC
-%macro BIWEIGHT_FUNC_HALF 1
-cglobal h264_biweight_4_10_%1
+%macro BIWEIGHT_FUNC_HALF 0
+cglobal h264_biweight_4_10
BIWEIGHT_PROLOGUE
- BIWEIGHT_SETUP %1
+ BIWEIGHT_SETUP
sar r3d, 1
lea r4, [r2*2]
-.nextrow
- BIWEIGHT %1, 0, r2
+.nextrow:
+ BIWEIGHT 0, r2
movh [r0 ], m0
movhps [r0+r2], m0
add r0, r4
@@ -272,6 +276,7 @@ cglobal h264_biweight_4_10_%1
REP_RET
%endmacro
-INIT_XMM
-BIWEIGHT_FUNC_HALF sse2
-BIWEIGHT_FUNC_HALF sse4
+INIT_XMM sse2
+BIWEIGHT_FUNC_HALF
+INIT_XMM sse4
+BIWEIGHT_FUNC_HALF
diff --git a/gst-libs/ext/libav/libavcodec/x86/h264dsp_init.c b/gst-libs/ext/libav/libavcodec/x86/h264dsp_init.c
new file mode 100644
index 0000000..73d4990
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/x86/h264dsp_init.c
@@ -0,0 +1,372 @@
+/*
+ * Copyright (c) 2004-2005 Michael Niedermayer, Loren Merritt
+ *
+ * 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
+ */
+
+#include "libavutil/cpu.h"
+#include "libavutil/x86/asm.h"
+#include "libavutil/x86/cpu.h"
+#include "libavcodec/h264dsp.h"
+#include "dsputil_mmx.h"
+
+/***********************************/
+/* IDCT */
+#define IDCT_ADD_FUNC(NUM, DEPTH, OPT) \
+void ff_h264_idct ## NUM ## _add_ ## DEPTH ## _ ## OPT(uint8_t *dst, \
+ int16_t *block, \
+ int stride);
+
+IDCT_ADD_FUNC(, 8, mmx)
+IDCT_ADD_FUNC(, 10, sse2)
+IDCT_ADD_FUNC(_dc, 8, mmxext)
+IDCT_ADD_FUNC(_dc, 10, mmxext)
+IDCT_ADD_FUNC(8_dc, 8, mmxext)
+IDCT_ADD_FUNC(8_dc, 10, sse2)
+IDCT_ADD_FUNC(8, 8, mmx)
+IDCT_ADD_FUNC(8, 8, sse2)
+IDCT_ADD_FUNC(8, 10, sse2)
+IDCT_ADD_FUNC(, 10, avx)
+IDCT_ADD_FUNC(8_dc, 10, avx)
+IDCT_ADD_FUNC(8, 10, avx)
+
+
+#define IDCT_ADD_REP_FUNC(NUM, REP, DEPTH, OPT) \
+void ff_h264_idct ## NUM ## _add ## REP ## _ ## DEPTH ## _ ## OPT \
+ (uint8_t *dst, const int *block_offset, \
+ DCTELEM *block, int stride, const uint8_t nnzc[6 * 8]);
+
+IDCT_ADD_REP_FUNC(8, 4, 8, mmx)
+IDCT_ADD_REP_FUNC(8, 4, 8, mmxext)
+IDCT_ADD_REP_FUNC(8, 4, 8, sse2)
+IDCT_ADD_REP_FUNC(8, 4, 10, sse2)
+IDCT_ADD_REP_FUNC(8, 4, 10, avx)
+IDCT_ADD_REP_FUNC(, 16, 8, mmx)
+IDCT_ADD_REP_FUNC(, 16, 8, mmxext)
+IDCT_ADD_REP_FUNC(, 16, 8, sse2)
+IDCT_ADD_REP_FUNC(, 16, 10, sse2)
+IDCT_ADD_REP_FUNC(, 16intra, 8, mmx)
+IDCT_ADD_REP_FUNC(, 16intra, 8, mmxext)
+IDCT_ADD_REP_FUNC(, 16intra, 8, sse2)
+IDCT_ADD_REP_FUNC(, 16intra, 10, sse2)
+IDCT_ADD_REP_FUNC(, 16, 10, avx)
+IDCT_ADD_REP_FUNC(, 16intra, 10, avx)
+
+
+#define IDCT_ADD_REP_FUNC2(NUM, REP, DEPTH, OPT) \
+void ff_h264_idct ## NUM ## _add ## REP ## _ ## DEPTH ## _ ## OPT \
+ (uint8_t **dst, const int *block_offset, \
+ DCTELEM *block, int stride, const uint8_t nnzc[6 * 8]);
+
+IDCT_ADD_REP_FUNC2(, 8, 8, mmx)
+IDCT_ADD_REP_FUNC2(, 8, 8, mmxext)
+IDCT_ADD_REP_FUNC2(, 8, 8, sse2)
+IDCT_ADD_REP_FUNC2(, 8, 10, sse2)
+IDCT_ADD_REP_FUNC2(, 8, 10, avx)
+
+void ff_h264_luma_dc_dequant_idct_mmx(DCTELEM *output, DCTELEM *input, int qmul);
+void ff_h264_luma_dc_dequant_idct_sse2(DCTELEM *output, DCTELEM *input, int qmul);
+
+/***********************************/
+/* deblocking */
+
+void ff_h264_loop_filter_strength_mmxext(int16_t bS[2][4][4], uint8_t nnz[40],
+ int8_t ref[2][40],
+ int16_t mv[2][40][2],
+ int bidir, int edges, int step,
+ int mask_mv0, int mask_mv1, int field);
+
+#define LF_FUNC(DIR, TYPE, DEPTH, OPT) \
+void ff_deblock_ ## DIR ## _ ## TYPE ## _ ## DEPTH ## _ ## OPT(uint8_t *pix, \
+ int stride, \
+ int alpha, \
+ int beta, \
+ int8_t *tc0);
+#define LF_IFUNC(DIR, TYPE, DEPTH, OPT) \
+void ff_deblock_ ## DIR ## _ ## TYPE ## _ ## DEPTH ## _ ## OPT(uint8_t *pix, \
+ int stride, \
+ int alpha, \
+ int beta);
+
+#define LF_FUNCS(type, depth) \
+LF_FUNC(h, chroma, depth, mmxext) \
+LF_IFUNC(h, chroma_intra, depth, mmxext) \
+LF_FUNC(v, chroma, depth, mmxext) \
+LF_IFUNC(v, chroma_intra, depth, mmxext) \
+LF_FUNC(h, luma, depth, mmxext) \
+LF_IFUNC(h, luma_intra, depth, mmxext) \
+LF_FUNC(h, luma, depth, sse2) \
+LF_IFUNC(h, luma_intra, depth, sse2) \
+LF_FUNC(v, luma, depth, sse2) \
+LF_IFUNC(v, luma_intra, depth, sse2) \
+LF_FUNC(h, chroma, depth, sse2) \
+LF_IFUNC(h, chroma_intra, depth, sse2) \
+LF_FUNC(v, chroma, depth, sse2) \
+LF_IFUNC(v, chroma_intra, depth, sse2) \
+LF_FUNC(h, luma, depth, avx) \
+LF_IFUNC(h, luma_intra, depth, avx) \
+LF_FUNC(v, luma, depth, avx) \
+LF_IFUNC(v, luma_intra, depth, avx) \
+LF_FUNC(h, chroma, depth, avx) \
+LF_IFUNC(h, chroma_intra, depth, avx) \
+LF_FUNC(v, chroma, depth, avx) \
+LF_IFUNC(v, chroma_intra, depth, avx)
+
+LF_FUNCS(uint8_t, 8)
+LF_FUNCS(uint16_t, 10)
+
+#if ARCH_X86_32 && HAVE_MMXEXT_EXTERNAL
+LF_FUNC(v8, luma, 8, mmxext)
+static void ff_deblock_v_luma_8_mmxext(uint8_t *pix, int stride, int alpha,
+ int beta, int8_t *tc0)
+{
+ if ((tc0[0] & tc0[1]) >= 0)
+ ff_deblock_v8_luma_8_mmxext(pix + 0, stride, alpha, beta, tc0);
+ if ((tc0[2] & tc0[3]) >= 0)
+ ff_deblock_v8_luma_8_mmxext(pix + 8, stride, alpha, beta, tc0 + 2);
+}
+LF_IFUNC(v8, luma_intra, 8, mmxext)
+static void ff_deblock_v_luma_intra_8_mmxext(uint8_t *pix, int stride,
+ int alpha, int beta)
+{
+ ff_deblock_v8_luma_intra_8_mmxext(pix + 0, stride, alpha, beta);
+ ff_deblock_v8_luma_intra_8_mmxext(pix + 8, stride, alpha, beta);
+}
+#endif /* ARCH_X86_32 && HAVE_MMXEXT_EXTERNAL */
+
+LF_FUNC(v, luma, 10, mmxext)
+LF_IFUNC(v, luma_intra, 10, mmxext)
+
+/***********************************/
+/* weighted prediction */
+
+#define H264_WEIGHT(W, OPT) \
+void ff_h264_weight_ ## W ## _ ## OPT(uint8_t *dst, int stride, \
+ int height, int log2_denom, \
+ int weight, int offset);
+
+#define H264_BIWEIGHT(W, OPT) \
+void ff_h264_biweight_ ## W ## _ ## OPT(uint8_t *dst, uint8_t *src, \
+ int stride, int height, \
+ int log2_denom, int weightd, \
+ int weights, int offset);
+
+#define H264_BIWEIGHT_MMX(W) \
+ H264_WEIGHT(W, mmxext) \
+ H264_BIWEIGHT(W, mmxext)
+
+#define H264_BIWEIGHT_MMX_SSE(W) \
+ H264_BIWEIGHT_MMX(W) \
+ H264_WEIGHT(W, sse2) \
+ H264_BIWEIGHT(W, sse2) \
+ H264_BIWEIGHT(W, ssse3)
+
+H264_BIWEIGHT_MMX_SSE(16)
+H264_BIWEIGHT_MMX_SSE(8)
+H264_BIWEIGHT_MMX(4)
+
+#define H264_WEIGHT_10(W, DEPTH, OPT) \
+void ff_h264_weight_ ## W ## _ ## DEPTH ## _ ## OPT(uint8_t *dst, \
+ int stride, \
+ int height, \
+ int log2_denom, \
+ int weight, \
+ int offset);
+
+#define H264_BIWEIGHT_10(W, DEPTH, OPT) \
+void ff_h264_biweight_ ## W ## _ ## DEPTH ## _ ## OPT(uint8_t *dst, \
+ uint8_t *src, \
+ int stride, \
+ int height, \
+ int log2_denom, \
+ int weightd, \
+ int weights, \
+ int offset);
+
+#define H264_BIWEIGHT_10_SSE(W, DEPTH) \
+ H264_WEIGHT_10(W, DEPTH, sse2) \
+ H264_WEIGHT_10(W, DEPTH, sse4) \
+ H264_BIWEIGHT_10(W, DEPTH, sse2) \
+ H264_BIWEIGHT_10(W, DEPTH, sse4)
+
+H264_BIWEIGHT_10_SSE(16, 10)
+H264_BIWEIGHT_10_SSE(8, 10)
+H264_BIWEIGHT_10_SSE(4, 10)
+
+void ff_h264dsp_init_x86(H264DSPContext *c, const int bit_depth,
+ const int chroma_format_idc)
+{
+ int mm_flags = av_get_cpu_flags();
+
+ if (chroma_format_idc == 1 && EXTERNAL_MMXEXT(mm_flags))
+ c->h264_loop_filter_strength = ff_h264_loop_filter_strength_mmxext;
+
+ if (bit_depth == 8) {
+ if (EXTERNAL_MMX(mm_flags)) {
+ c->h264_idct_dc_add =
+ c->h264_idct_add = ff_h264_idct_add_8_mmx;
+ c->h264_idct8_dc_add =
+ c->h264_idct8_add = ff_h264_idct8_add_8_mmx;
+
+ c->h264_idct_add16 = ff_h264_idct_add16_8_mmx;
+ c->h264_idct8_add4 = ff_h264_idct8_add4_8_mmx;
+ if (chroma_format_idc == 1)
+ c->h264_idct_add8 = ff_h264_idct_add8_8_mmx;
+ c->h264_idct_add16intra = ff_h264_idct_add16intra_8_mmx;
+ if (mm_flags & AV_CPU_FLAG_CMOV)
+ c->h264_luma_dc_dequant_idct = ff_h264_luma_dc_dequant_idct_mmx;
+
+ if (EXTERNAL_MMXEXT(mm_flags)) {
+ c->h264_idct_dc_add = ff_h264_idct_dc_add_8_mmxext;
+ c->h264_idct8_dc_add = ff_h264_idct8_dc_add_8_mmxext;
+ c->h264_idct_add16 = ff_h264_idct_add16_8_mmxext;
+ c->h264_idct8_add4 = ff_h264_idct8_add4_8_mmxext;
+ if (chroma_format_idc == 1)
+ c->h264_idct_add8 = ff_h264_idct_add8_8_mmxext;
+ c->h264_idct_add16intra = ff_h264_idct_add16intra_8_mmxext;
+
+ c->h264_v_loop_filter_chroma = ff_deblock_v_chroma_8_mmxext;
+ c->h264_v_loop_filter_chroma_intra = ff_deblock_v_chroma_intra_8_mmxext;
+ if (chroma_format_idc == 1) {
+ c->h264_h_loop_filter_chroma = ff_deblock_h_chroma_8_mmxext;
+ c->h264_h_loop_filter_chroma_intra = ff_deblock_h_chroma_intra_8_mmxext;
+ }
+#if ARCH_X86_32 && HAVE_MMXEXT_EXTERNAL
+ c->h264_v_loop_filter_luma = ff_deblock_v_luma_8_mmxext;
+ c->h264_h_loop_filter_luma = ff_deblock_h_luma_8_mmxext;
+ c->h264_v_loop_filter_luma_intra = ff_deblock_v_luma_intra_8_mmxext;
+ c->h264_h_loop_filter_luma_intra = ff_deblock_h_luma_intra_8_mmxext;
+#endif /* ARCH_X86_32 && HAVE_MMXEXT_EXTERNAL */
+ c->weight_h264_pixels_tab[0] = ff_h264_weight_16_mmxext;
+ c->weight_h264_pixels_tab[1] = ff_h264_weight_8_mmxext;
+ c->weight_h264_pixels_tab[2] = ff_h264_weight_4_mmxext;
+
+ c->biweight_h264_pixels_tab[0] = ff_h264_biweight_16_mmxext;
+ c->biweight_h264_pixels_tab[1] = ff_h264_biweight_8_mmxext;
+ c->biweight_h264_pixels_tab[2] = ff_h264_biweight_4_mmxext;
+
+ if (EXTERNAL_SSE2(mm_flags)) {
+ c->h264_idct8_add = ff_h264_idct8_add_8_sse2;
+
+ c->h264_idct_add16 = ff_h264_idct_add16_8_sse2;
+ c->h264_idct8_add4 = ff_h264_idct8_add4_8_sse2;
+ if (chroma_format_idc == 1)
+ c->h264_idct_add8 = ff_h264_idct_add8_8_sse2;
+ c->h264_idct_add16intra = ff_h264_idct_add16intra_8_sse2;
+ c->h264_luma_dc_dequant_idct = ff_h264_luma_dc_dequant_idct_sse2;
+
+ c->weight_h264_pixels_tab[0] = ff_h264_weight_16_sse2;
+ c->weight_h264_pixels_tab[1] = ff_h264_weight_8_sse2;
+
+ c->biweight_h264_pixels_tab[0] = ff_h264_biweight_16_sse2;
+ c->biweight_h264_pixels_tab[1] = ff_h264_biweight_8_sse2;
+
+ c->h264_v_loop_filter_luma = ff_deblock_v_luma_8_sse2;
+ c->h264_h_loop_filter_luma = ff_deblock_h_luma_8_sse2;
+ c->h264_v_loop_filter_luma_intra = ff_deblock_v_luma_intra_8_sse2;
+ c->h264_h_loop_filter_luma_intra = ff_deblock_h_luma_intra_8_sse2;
+ }
+ if (EXTERNAL_SSSE3(mm_flags)) {
+ c->biweight_h264_pixels_tab[0] = ff_h264_biweight_16_ssse3;
+ c->biweight_h264_pixels_tab[1] = ff_h264_biweight_8_ssse3;
+ }
+ if (EXTERNAL_AVX(mm_flags)) {
+ c->h264_v_loop_filter_luma = ff_deblock_v_luma_8_avx;
+ c->h264_h_loop_filter_luma = ff_deblock_h_luma_8_avx;
+ c->h264_v_loop_filter_luma_intra = ff_deblock_v_luma_intra_8_avx;
+ c->h264_h_loop_filter_luma_intra = ff_deblock_h_luma_intra_8_avx;
+ }
+ }
+ }
+ } else if (bit_depth == 10) {
+ if (EXTERNAL_MMX(mm_flags)) {
+ if (EXTERNAL_MMXEXT(mm_flags)) {
+#if ARCH_X86_32
+ c->h264_v_loop_filter_chroma = ff_deblock_v_chroma_10_mmxext;
+ c->h264_v_loop_filter_chroma_intra = ff_deblock_v_chroma_intra_10_mmxext;
+ c->h264_v_loop_filter_luma = ff_deblock_v_luma_10_mmxext;
+ c->h264_h_loop_filter_luma = ff_deblock_h_luma_10_mmxext;
+ c->h264_v_loop_filter_luma_intra = ff_deblock_v_luma_intra_10_mmxext;
+ c->h264_h_loop_filter_luma_intra = ff_deblock_h_luma_intra_10_mmxext;
+#endif /* ARCH_X86_32 */
+ c->h264_idct_dc_add = ff_h264_idct_dc_add_10_mmxext;
+ if (EXTERNAL_SSE2(mm_flags)) {
+ c->h264_idct_add = ff_h264_idct_add_10_sse2;
+ c->h264_idct8_dc_add = ff_h264_idct8_dc_add_10_sse2;
+
+ c->h264_idct_add16 = ff_h264_idct_add16_10_sse2;
+ if (chroma_format_idc == 1)
+ c->h264_idct_add8 = ff_h264_idct_add8_10_sse2;
+ c->h264_idct_add16intra = ff_h264_idct_add16intra_10_sse2;
+#if HAVE_ALIGNED_STACK
+ c->h264_idct8_add = ff_h264_idct8_add_10_sse2;
+ c->h264_idct8_add4 = ff_h264_idct8_add4_10_sse2;
+#endif /* HAVE_ALIGNED_STACK */
+
+ c->weight_h264_pixels_tab[0] = ff_h264_weight_16_10_sse2;
+ c->weight_h264_pixels_tab[1] = ff_h264_weight_8_10_sse2;
+ c->weight_h264_pixels_tab[2] = ff_h264_weight_4_10_sse2;
+
+ c->biweight_h264_pixels_tab[0] = ff_h264_biweight_16_10_sse2;
+ c->biweight_h264_pixels_tab[1] = ff_h264_biweight_8_10_sse2;
+ c->biweight_h264_pixels_tab[2] = ff_h264_biweight_4_10_sse2;
+
+ c->h264_v_loop_filter_chroma = ff_deblock_v_chroma_10_sse2;
+ c->h264_v_loop_filter_chroma_intra = ff_deblock_v_chroma_intra_10_sse2;
+#if HAVE_ALIGNED_STACK
+ c->h264_v_loop_filter_luma = ff_deblock_v_luma_10_sse2;
+ c->h264_h_loop_filter_luma = ff_deblock_h_luma_10_sse2;
+ c->h264_v_loop_filter_luma_intra = ff_deblock_v_luma_intra_10_sse2;
+ c->h264_h_loop_filter_luma_intra = ff_deblock_h_luma_intra_10_sse2;
+#endif /* HAVE_ALIGNED_STACK */
+ }
+ if (EXTERNAL_SSE4(mm_flags)) {
+ c->weight_h264_pixels_tab[0] = ff_h264_weight_16_10_sse4;
+ c->weight_h264_pixels_tab[1] = ff_h264_weight_8_10_sse4;
+ c->weight_h264_pixels_tab[2] = ff_h264_weight_4_10_sse4;
+
+ c->biweight_h264_pixels_tab[0] = ff_h264_biweight_16_10_sse4;
+ c->biweight_h264_pixels_tab[1] = ff_h264_biweight_8_10_sse4;
+ c->biweight_h264_pixels_tab[2] = ff_h264_biweight_4_10_sse4;
+ }
+ if (EXTERNAL_AVX(mm_flags)) {
+ c->h264_idct_dc_add =
+ c->h264_idct_add = ff_h264_idct_add_10_avx;
+ c->h264_idct8_dc_add = ff_h264_idct8_dc_add_10_avx;
+
+ c->h264_idct_add16 = ff_h264_idct_add16_10_avx;
+ if (chroma_format_idc == 1)
+ c->h264_idct_add8 = ff_h264_idct_add8_10_avx;
+ c->h264_idct_add16intra = ff_h264_idct_add16intra_10_avx;
+#if HAVE_ALIGNED_STACK
+ c->h264_idct8_add = ff_h264_idct8_add_10_avx;
+ c->h264_idct8_add4 = ff_h264_idct8_add4_10_avx;
+#endif /* HAVE_ALIGNED_STACK */
+
+ c->h264_v_loop_filter_chroma = ff_deblock_v_chroma_10_avx;
+ c->h264_v_loop_filter_chroma_intra = ff_deblock_v_chroma_intra_10_avx;
+#if HAVE_ALIGNED_STACK
+ c->h264_v_loop_filter_luma = ff_deblock_v_luma_10_avx;
+ c->h264_h_loop_filter_luma = ff_deblock_h_luma_10_avx;
+ c->h264_v_loop_filter_luma_intra = ff_deblock_v_luma_intra_10_avx;
+ c->h264_h_loop_filter_luma_intra = ff_deblock_h_luma_intra_10_avx;
+#endif /* HAVE_ALIGNED_STACK */
+ }
+ }
+ }
+ }
+}
diff --git a/gst-libs/ext/libav/libavcodec/x86/h264dsp_mmx.c b/gst-libs/ext/libav/libavcodec/x86/h264dsp_mmx.c
deleted file mode 100644
index dcd9180..0000000
--- a/gst-libs/ext/libav/libavcodec/x86/h264dsp_mmx.c
+++ /dev/null
@@ -1,514 +0,0 @@
-/*
- * Copyright (c) 2004-2005 Michael Niedermayer, Loren Merritt
- *
- * 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
- */
-
-#include "libavutil/cpu.h"
-#include "libavutil/x86_cpu.h"
-#include "libavcodec/h264dsp.h"
-#include "dsputil_mmx.h"
-
-DECLARE_ALIGNED(8, static const uint64_t, ff_pb_3_1 ) = 0x0103010301030103ULL;
-
-/***********************************/
-/* IDCT */
-#define IDCT_ADD_FUNC(NUM, DEPTH, OPT) \
-void ff_h264_idct ## NUM ## _add_ ## DEPTH ## _ ## OPT (uint8_t *dst, int16_t *block, int stride);
-
-IDCT_ADD_FUNC(, 8, mmx)
-IDCT_ADD_FUNC(, 10, sse2)
-IDCT_ADD_FUNC(_dc, 8, mmx2)
-IDCT_ADD_FUNC(_dc, 10, mmx2)
-IDCT_ADD_FUNC(8_dc, 8, mmx2)
-IDCT_ADD_FUNC(8_dc, 10, sse2)
-IDCT_ADD_FUNC(8, 8, mmx)
-IDCT_ADD_FUNC(8, 8, sse2)
-IDCT_ADD_FUNC(8, 10, sse2)
-#if HAVE_AVX
-IDCT_ADD_FUNC(, 10, avx)
-IDCT_ADD_FUNC(8_dc, 10, avx)
-IDCT_ADD_FUNC(8, 10, avx)
-#endif
-
-
-#define IDCT_ADD_REP_FUNC(NUM, REP, DEPTH, OPT) \
-void ff_h264_idct ## NUM ## _add ## REP ## _ ## DEPTH ## _ ## OPT \
- (uint8_t *dst, const int *block_offset, \
- DCTELEM *block, int stride, const uint8_t nnzc[6*8]);
-
-IDCT_ADD_REP_FUNC(8, 4, 8, mmx)
-IDCT_ADD_REP_FUNC(8, 4, 8, mmx2)
-IDCT_ADD_REP_FUNC(8, 4, 8, sse2)
-IDCT_ADD_REP_FUNC(8, 4, 10, sse2)
-IDCT_ADD_REP_FUNC(8, 4, 10, avx)
-IDCT_ADD_REP_FUNC(, 16, 8, mmx)
-IDCT_ADD_REP_FUNC(, 16, 8, mmx2)
-IDCT_ADD_REP_FUNC(, 16, 8, sse2)
-IDCT_ADD_REP_FUNC(, 16, 10, sse2)
-IDCT_ADD_REP_FUNC(, 16intra, 8, mmx)
-IDCT_ADD_REP_FUNC(, 16intra, 8, mmx2)
-IDCT_ADD_REP_FUNC(, 16intra, 8, sse2)
-IDCT_ADD_REP_FUNC(, 16intra, 10, sse2)
-#if HAVE_AVX
-IDCT_ADD_REP_FUNC(, 16, 10, avx)
-IDCT_ADD_REP_FUNC(, 16intra, 10, avx)
-#endif
-
-
-#define IDCT_ADD_REP_FUNC2(NUM, REP, DEPTH, OPT) \
-void ff_h264_idct ## NUM ## _add ## REP ## _ ## DEPTH ## _ ## OPT \
- (uint8_t **dst, const int *block_offset, \
- DCTELEM *block, int stride, const uint8_t nnzc[6*8]);
-IDCT_ADD_REP_FUNC2(, 8, 8, mmx)
-IDCT_ADD_REP_FUNC2(, 8, 8, mmx2)
-IDCT_ADD_REP_FUNC2(, 8, 8, sse2)
-IDCT_ADD_REP_FUNC2(, 8, 10, sse2)
-#if HAVE_AVX
-IDCT_ADD_REP_FUNC2(, 8, 10, avx)
-#endif
-
-void ff_h264_luma_dc_dequant_idct_mmx (DCTELEM *output, DCTELEM *input, int qmul);
-void ff_h264_luma_dc_dequant_idct_sse2(DCTELEM *output, DCTELEM *input, int qmul);
-
-/***********************************/
-/* deblocking */
-
-#define h264_loop_filter_strength_iteration_mmx2(bS, nz, ref, mv, bidir, edges, step, mask_mv, dir, d_idx, mask_dir) \
- do { \
- x86_reg b_idx; \
- mask_mv <<= 3; \
- for( b_idx=0; b_idx<edges; b_idx+=step ) { \
- if (!mask_dir) \
- __asm__ volatile( \
- "pxor %%mm0, %%mm0 \n\t" \
- :: \
- ); \
- if(!(mask_mv & b_idx)) { \
- if(bidir) { \
- __asm__ volatile( \
- "movd %a3(%0,%2), %%mm2 \n" \
- "punpckldq %a4(%0,%2), %%mm2 \n" /* { ref0[bn], ref1[bn] } */ \
- "pshufw $0x44, 12(%0,%2), %%mm0 \n" /* { ref0[b], ref0[b] } */ \
- "pshufw $0x44, 52(%0,%2), %%mm1 \n" /* { ref1[b], ref1[b] } */ \
- "pshufw $0x4E, %%mm2, %%mm3 \n" \
- "psubb %%mm2, %%mm0 \n" /* { ref0[b]!=ref0[bn], ref0[b]!=ref1[bn] } */ \
- "psubb %%mm3, %%mm1 \n" /* { ref1[b]!=ref1[bn], ref1[b]!=ref0[bn] } */ \
- \
- "por %%mm1, %%mm0 \n" \
- "movq %a5(%1,%2,4), %%mm1 \n" \
- "movq %a6(%1,%2,4), %%mm2 \n" \
- "movq %%mm1, %%mm3 \n" \
- "movq %%mm2, %%mm4 \n" \
- "psubw 48(%1,%2,4), %%mm1 \n" \
- "psubw 56(%1,%2,4), %%mm2 \n" \
- "psubw 208(%1,%2,4), %%mm3 \n" \
- "psubw 216(%1,%2,4), %%mm4 \n" \
- "packsswb %%mm2, %%mm1 \n" \
- "packsswb %%mm4, %%mm3 \n" \
- "paddb %%mm6, %%mm1 \n" \
- "paddb %%mm6, %%mm3 \n" \
- "psubusb %%mm5, %%mm1 \n" /* abs(mv[b] - mv[bn]) >= limit */ \
- "psubusb %%mm5, %%mm3 \n" \
- "packsswb %%mm3, %%mm1 \n" \
- \
- "por %%mm1, %%mm0 \n" \
- "movq %a7(%1,%2,4), %%mm1 \n" \
- "movq %a8(%1,%2,4), %%mm2 \n" \
- "movq %%mm1, %%mm3 \n" \
- "movq %%mm2, %%mm4 \n" \
- "psubw 48(%1,%2,4), %%mm1 \n" \
- "psubw 56(%1,%2,4), %%mm2 \n" \
- "psubw 208(%1,%2,4), %%mm3 \n" \
- "psubw 216(%1,%2,4), %%mm4 \n" \
- "packsswb %%mm2, %%mm1 \n" \
- "packsswb %%mm4, %%mm3 \n" \
- "paddb %%mm6, %%mm1 \n" \
- "paddb %%mm6, %%mm3 \n" \
- "psubusb %%mm5, %%mm1 \n" /* abs(mv[b] - mv[bn]) >= limit */ \
- "psubusb %%mm5, %%mm3 \n" \
- "packsswb %%mm3, %%mm1 \n" \
- \
- "pshufw $0x4E, %%mm1, %%mm1 \n" \
- "por %%mm1, %%mm0 \n" \
- "pshufw $0x4E, %%mm0, %%mm1 \n" \
- "pminub %%mm1, %%mm0 \n" \
- ::"r"(ref), \
- "r"(mv), \
- "r"(b_idx), \
- "i"(d_idx+12), \
- "i"(d_idx+52), \
- "i"(d_idx*4+48), \
- "i"(d_idx*4+56), \
- "i"(d_idx*4+208), \
- "i"(d_idx*4+216) \
- ); \
- } else { \
- __asm__ volatile( \
- "movd 12(%0,%2), %%mm0 \n" \
- "psubb %a3(%0,%2), %%mm0 \n" /* ref[b] != ref[bn] */ \
- "movq 48(%1,%2,4), %%mm1 \n" \
- "movq 56(%1,%2,4), %%mm2 \n" \
- "psubw %a4(%1,%2,4), %%mm1 \n" \
- "psubw %a5(%1,%2,4), %%mm2 \n" \
- "packsswb %%mm2, %%mm1 \n" \
- "paddb %%mm6, %%mm1 \n" \
- "psubusb %%mm5, %%mm1 \n" /* abs(mv[b] - mv[bn]) >= limit */ \
- "packsswb %%mm1, %%mm1 \n" \
- "por %%mm1, %%mm0 \n" \
- ::"r"(ref), \
- "r"(mv), \
- "r"(b_idx), \
- "i"(d_idx+12), \
- "i"(d_idx*4+48), \
- "i"(d_idx*4+56) \
- ); \
- } \
- } \
- __asm__ volatile( \
- "movd 12(%0,%1), %%mm1 \n" \
- "por %a2(%0,%1), %%mm1 \n" /* nnz[b] || nnz[bn] */ \
- ::"r"(nnz), \
- "r"(b_idx), \
- "i"(d_idx+12) \
- ); \
- __asm__ volatile( \
- "pminub %%mm7, %%mm1 \n" \
- "pminub %%mm7, %%mm0 \n" \
- "psllw $1, %%mm1 \n" \
- "pxor %%mm2, %%mm2 \n" \
- "pmaxub %%mm0, %%mm1 \n" \
- "punpcklbw %%mm2, %%mm1 \n" \
- "movq %%mm1, %a1(%0,%2) \n" \
- ::"r"(bS), \
- "i"(32*dir), \
- "r"(b_idx) \
- :"memory" \
- ); \
- } \
- } while (0)
-
-static void h264_loop_filter_strength_mmx2( int16_t bS[2][4][4], uint8_t nnz[40], int8_t ref[2][40], int16_t mv[2][40][2],
- int bidir, int edges, int step, int mask_mv0, int mask_mv1, int field ) {
- __asm__ volatile(
- "movq %0, %%mm7 \n"
- "movq %1, %%mm6 \n"
- ::"m"(ff_pb_1), "m"(ff_pb_3)
- );
- if(field)
- __asm__ volatile(
- "movq %0, %%mm6 \n"
- ::"m"(ff_pb_3_1)
- );
- __asm__ volatile(
- "movq %%mm6, %%mm5 \n"
- "paddb %%mm5, %%mm5 \n"
- :);
-
- // could do a special case for dir==0 && edges==1, but it only reduces the
- // average filter time by 1.2%
- step <<= 3;
- edges <<= 3;
- h264_loop_filter_strength_iteration_mmx2(bS, nnz, ref, mv, bidir, edges, step, mask_mv1, 1, -8, 0);
- h264_loop_filter_strength_iteration_mmx2(bS, nnz, ref, mv, bidir, 32, 8, mask_mv0, 0, -1, -1);
-
- __asm__ volatile(
- "movq (%0), %%mm0 \n\t"
- "movq 8(%0), %%mm1 \n\t"
- "movq 16(%0), %%mm2 \n\t"
- "movq 24(%0), %%mm3 \n\t"
- TRANSPOSE4(%%mm0, %%mm1, %%mm2, %%mm3, %%mm4)
- "movq %%mm0, (%0) \n\t"
- "movq %%mm3, 8(%0) \n\t"
- "movq %%mm4, 16(%0) \n\t"
- "movq %%mm2, 24(%0) \n\t"
- ::"r"(bS[0])
- :"memory"
- );
-}
-
-#define LF_FUNC(DIR, TYPE, DEPTH, OPT) \
-void ff_deblock_ ## DIR ## _ ## TYPE ## _ ## DEPTH ## _ ## OPT (uint8_t *pix, int stride, \
- int alpha, int beta, int8_t *tc0);
-#define LF_IFUNC(DIR, TYPE, DEPTH, OPT) \
-void ff_deblock_ ## DIR ## _ ## TYPE ## _ ## DEPTH ## _ ## OPT (uint8_t *pix, int stride, \
- int alpha, int beta);
-
-#define LF_FUNCS(type, depth)\
-LF_FUNC (h, chroma, depth, mmxext)\
-LF_IFUNC(h, chroma_intra, depth, mmxext)\
-LF_FUNC (v, chroma, depth, mmxext)\
-LF_IFUNC(v, chroma_intra, depth, mmxext)\
-LF_FUNC (h, luma, depth, mmxext)\
-LF_IFUNC(h, luma_intra, depth, mmxext)\
-LF_FUNC (h, luma, depth, sse2)\
-LF_IFUNC(h, luma_intra, depth, sse2)\
-LF_FUNC (v, luma, depth, sse2)\
-LF_IFUNC(v, luma_intra, depth, sse2)\
-LF_FUNC (h, chroma, depth, sse2)\
-LF_IFUNC(h, chroma_intra, depth, sse2)\
-LF_FUNC (v, chroma, depth, sse2)\
-LF_IFUNC(v, chroma_intra, depth, sse2)\
-LF_FUNC (h, luma, depth, avx)\
-LF_IFUNC(h, luma_intra, depth, avx)\
-LF_FUNC (v, luma, depth, avx)\
-LF_IFUNC(v, luma_intra, depth, avx)\
-LF_FUNC (h, chroma, depth, avx)\
-LF_IFUNC(h, chroma_intra, depth, avx)\
-LF_FUNC (v, chroma, depth, avx)\
-LF_IFUNC(v, chroma_intra, depth, avx)
-
-LF_FUNCS( uint8_t, 8)
-LF_FUNCS(uint16_t, 10)
-
-#if ARCH_X86_32
-LF_FUNC (v8, luma, 8, mmxext)
-static void ff_deblock_v_luma_8_mmxext(uint8_t *pix, int stride, int alpha, int beta, int8_t *tc0)
-{
- if((tc0[0] & tc0[1]) >= 0)
- ff_deblock_v8_luma_8_mmxext(pix+0, stride, alpha, beta, tc0);
- if((tc0[2] & tc0[3]) >= 0)
- ff_deblock_v8_luma_8_mmxext(pix+8, stride, alpha, beta, tc0+2);
-}
-LF_IFUNC(v8, luma_intra, 8, mmxext)
-static void ff_deblock_v_luma_intra_8_mmxext(uint8_t *pix, int stride, int alpha, int beta)
-{
- ff_deblock_v8_luma_intra_8_mmxext(pix+0, stride, alpha, beta);
- ff_deblock_v8_luma_intra_8_mmxext(pix+8, stride, alpha, beta);
-}
-#endif /* ARCH_X86_32 */
-
-LF_FUNC (v, luma, 10, mmxext)
-LF_IFUNC(v, luma_intra, 10, mmxext)
-
-/***********************************/
-/* weighted prediction */
-
-#define H264_WEIGHT(W, OPT) \
-void ff_h264_weight_ ## W ## _ ## OPT(uint8_t *dst, \
- int stride, int height, int log2_denom, int weight, int offset);
-
-#define H264_BIWEIGHT(W, OPT) \
-void ff_h264_biweight_ ## W ## _ ## OPT(uint8_t *dst, \
- uint8_t *src, int stride, int height, int log2_denom, int weightd, \
- int weights, int offset);
-
-#define H264_BIWEIGHT_MMX(W) \
-H264_WEIGHT (W, mmx2) \
-H264_BIWEIGHT(W, mmx2)
-
-#define H264_BIWEIGHT_MMX_SSE(W) \
-H264_BIWEIGHT_MMX(W) \
-H264_WEIGHT (W, sse2) \
-H264_BIWEIGHT (W, sse2) \
-H264_BIWEIGHT (W, ssse3)
-
-H264_BIWEIGHT_MMX_SSE(16)
-H264_BIWEIGHT_MMX_SSE( 8)
-H264_BIWEIGHT_MMX ( 4)
-
-#define H264_WEIGHT_10(W, DEPTH, OPT) \
-void ff_h264_weight_ ## W ## _ ## DEPTH ## _ ## OPT(uint8_t *dst, \
- int stride, int height, int log2_denom, int weight, int offset);
-
-#define H264_BIWEIGHT_10(W, DEPTH, OPT) \
-void ff_h264_biweight_ ## W ## _ ## DEPTH ## _ ## OPT \
- (uint8_t *dst, uint8_t *src, int stride, int height, int log2_denom, \
- int weightd, int weights, int offset);
-
-#define H264_BIWEIGHT_10_SSE(W, DEPTH) \
-H264_WEIGHT_10 (W, DEPTH, sse2) \
-H264_WEIGHT_10 (W, DEPTH, sse4) \
-H264_BIWEIGHT_10(W, DEPTH, sse2) \
-H264_BIWEIGHT_10(W, DEPTH, sse4)
-
-H264_BIWEIGHT_10_SSE(16, 10)
-H264_BIWEIGHT_10_SSE( 8, 10)
-H264_BIWEIGHT_10_SSE( 4, 10)
-
-void ff_h264dsp_init_x86(H264DSPContext *c, const int bit_depth, const int chroma_format_idc)
-{
- int mm_flags = av_get_cpu_flags();
-
- if (chroma_format_idc == 1 && mm_flags & AV_CPU_FLAG_MMX2) {
- c->h264_loop_filter_strength= h264_loop_filter_strength_mmx2;
- }
-
- if (bit_depth == 8) {
-#if HAVE_YASM
- if (mm_flags & AV_CPU_FLAG_MMX) {
- c->h264_idct_dc_add =
- c->h264_idct_add = ff_h264_idct_add_8_mmx;
- c->h264_idct8_dc_add =
- c->h264_idct8_add = ff_h264_idct8_add_8_mmx;
-
- c->h264_idct_add16 = ff_h264_idct_add16_8_mmx;
- c->h264_idct8_add4 = ff_h264_idct8_add4_8_mmx;
- if (chroma_format_idc == 1)
- c->h264_idct_add8 = ff_h264_idct_add8_8_mmx;
- c->h264_idct_add16intra = ff_h264_idct_add16intra_8_mmx;
- c->h264_luma_dc_dequant_idct= ff_h264_luma_dc_dequant_idct_mmx;
-
- if (mm_flags & AV_CPU_FLAG_MMX2) {
- c->h264_idct_dc_add = ff_h264_idct_dc_add_8_mmx2;
- c->h264_idct8_dc_add = ff_h264_idct8_dc_add_8_mmx2;
- c->h264_idct_add16 = ff_h264_idct_add16_8_mmx2;
- c->h264_idct8_add4 = ff_h264_idct8_add4_8_mmx2;
- if (chroma_format_idc == 1)
- c->h264_idct_add8 = ff_h264_idct_add8_8_mmx2;
- c->h264_idct_add16intra= ff_h264_idct_add16intra_8_mmx2;
-
- c->h264_v_loop_filter_chroma= ff_deblock_v_chroma_8_mmxext;
- c->h264_v_loop_filter_chroma_intra= ff_deblock_v_chroma_intra_8_mmxext;
- if (chroma_format_idc == 1) {
- c->h264_h_loop_filter_chroma= ff_deblock_h_chroma_8_mmxext;
- c->h264_h_loop_filter_chroma_intra= ff_deblock_h_chroma_intra_8_mmxext;
- }
-#if ARCH_X86_32
- c->h264_v_loop_filter_luma= ff_deblock_v_luma_8_mmxext;
- c->h264_h_loop_filter_luma= ff_deblock_h_luma_8_mmxext;
- c->h264_v_loop_filter_luma_intra = ff_deblock_v_luma_intra_8_mmxext;
- c->h264_h_loop_filter_luma_intra = ff_deblock_h_luma_intra_8_mmxext;
-#endif
- c->weight_h264_pixels_tab[0]= ff_h264_weight_16_mmx2;
- c->weight_h264_pixels_tab[1]= ff_h264_weight_8_mmx2;
- c->weight_h264_pixels_tab[2]= ff_h264_weight_4_mmx2;
-
- c->biweight_h264_pixels_tab[0]= ff_h264_biweight_16_mmx2;
- c->biweight_h264_pixels_tab[1]= ff_h264_biweight_8_mmx2;
- c->biweight_h264_pixels_tab[2]= ff_h264_biweight_4_mmx2;
-
- if (mm_flags&AV_CPU_FLAG_SSE2) {
- c->h264_idct8_add = ff_h264_idct8_add_8_sse2;
-
- c->h264_idct_add16 = ff_h264_idct_add16_8_sse2;
- c->h264_idct8_add4 = ff_h264_idct8_add4_8_sse2;
- if (chroma_format_idc == 1)
- c->h264_idct_add8 = ff_h264_idct_add8_8_sse2;
- c->h264_idct_add16intra = ff_h264_idct_add16intra_8_sse2;
- c->h264_luma_dc_dequant_idct= ff_h264_luma_dc_dequant_idct_sse2;
-
- c->weight_h264_pixels_tab[0]= ff_h264_weight_16_sse2;
- c->weight_h264_pixels_tab[1]= ff_h264_weight_8_sse2;
-
- c->biweight_h264_pixels_tab[0]= ff_h264_biweight_16_sse2;
- c->biweight_h264_pixels_tab[1]= ff_h264_biweight_8_sse2;
-
-#if HAVE_ALIGNED_STACK
- c->h264_v_loop_filter_luma = ff_deblock_v_luma_8_sse2;
- c->h264_h_loop_filter_luma = ff_deblock_h_luma_8_sse2;
- c->h264_v_loop_filter_luma_intra = ff_deblock_v_luma_intra_8_sse2;
- c->h264_h_loop_filter_luma_intra = ff_deblock_h_luma_intra_8_sse2;
-#endif
- }
- if (mm_flags&AV_CPU_FLAG_SSSE3) {
- c->biweight_h264_pixels_tab[0]= ff_h264_biweight_16_ssse3;
- c->biweight_h264_pixels_tab[1]= ff_h264_biweight_8_ssse3;
- }
- if (mm_flags&AV_CPU_FLAG_AVX) {
-#if HAVE_ALIGNED_STACK
- c->h264_v_loop_filter_luma = ff_deblock_v_luma_8_avx;
- c->h264_h_loop_filter_luma = ff_deblock_h_luma_8_avx;
- c->h264_v_loop_filter_luma_intra = ff_deblock_v_luma_intra_8_avx;
- c->h264_h_loop_filter_luma_intra = ff_deblock_h_luma_intra_8_avx;
-#endif
- }
- }
- }
-#endif
- } else if (bit_depth == 10) {
-#if HAVE_YASM
- if (mm_flags & AV_CPU_FLAG_MMX) {
- if (mm_flags & AV_CPU_FLAG_MMX2) {
-#if ARCH_X86_32
- c->h264_v_loop_filter_chroma= ff_deblock_v_chroma_10_mmxext;
- c->h264_v_loop_filter_chroma_intra= ff_deblock_v_chroma_intra_10_mmxext;
- c->h264_v_loop_filter_luma= ff_deblock_v_luma_10_mmxext;
- c->h264_h_loop_filter_luma= ff_deblock_h_luma_10_mmxext;
- c->h264_v_loop_filter_luma_intra = ff_deblock_v_luma_intra_10_mmxext;
- c->h264_h_loop_filter_luma_intra = ff_deblock_h_luma_intra_10_mmxext;
-#endif
- c->h264_idct_dc_add= ff_h264_idct_dc_add_10_mmx2;
- if (mm_flags&AV_CPU_FLAG_SSE2) {
- c->h264_idct_add = ff_h264_idct_add_10_sse2;
- c->h264_idct8_dc_add = ff_h264_idct8_dc_add_10_sse2;
-
- c->h264_idct_add16 = ff_h264_idct_add16_10_sse2;
- if (chroma_format_idc == 1)
- c->h264_idct_add8 = ff_h264_idct_add8_10_sse2;
- c->h264_idct_add16intra= ff_h264_idct_add16intra_10_sse2;
-#if HAVE_ALIGNED_STACK
- c->h264_idct8_add = ff_h264_idct8_add_10_sse2;
- c->h264_idct8_add4 = ff_h264_idct8_add4_10_sse2;
-#endif
-
- c->weight_h264_pixels_tab[0] = ff_h264_weight_16_10_sse2;
- c->weight_h264_pixels_tab[1] = ff_h264_weight_8_10_sse2;
- c->weight_h264_pixels_tab[2] = ff_h264_weight_4_10_sse2;
-
- c->biweight_h264_pixels_tab[0] = ff_h264_biweight_16_10_sse2;
- c->biweight_h264_pixels_tab[1] = ff_h264_biweight_8_10_sse2;
- c->biweight_h264_pixels_tab[2] = ff_h264_biweight_4_10_sse2;
-
- c->h264_v_loop_filter_chroma= ff_deblock_v_chroma_10_sse2;
- c->h264_v_loop_filter_chroma_intra= ff_deblock_v_chroma_intra_10_sse2;
-#if HAVE_ALIGNED_STACK
- c->h264_v_loop_filter_luma = ff_deblock_v_luma_10_sse2;
- c->h264_h_loop_filter_luma = ff_deblock_h_luma_10_sse2;
- c->h264_v_loop_filter_luma_intra = ff_deblock_v_luma_intra_10_sse2;
- c->h264_h_loop_filter_luma_intra = ff_deblock_h_luma_intra_10_sse2;
-#endif
- }
- if (mm_flags&AV_CPU_FLAG_SSE4) {
- c->weight_h264_pixels_tab[0] = ff_h264_weight_16_10_sse4;
- c->weight_h264_pixels_tab[1] = ff_h264_weight_8_10_sse4;
- c->weight_h264_pixels_tab[2] = ff_h264_weight_4_10_sse4;
-
- c->biweight_h264_pixels_tab[0] = ff_h264_biweight_16_10_sse4;
- c->biweight_h264_pixels_tab[1] = ff_h264_biweight_8_10_sse4;
- c->biweight_h264_pixels_tab[2] = ff_h264_biweight_4_10_sse4;
- }
-#if HAVE_AVX
- if (mm_flags&AV_CPU_FLAG_AVX) {
- c->h264_idct_dc_add =
- c->h264_idct_add = ff_h264_idct_add_10_avx;
- c->h264_idct8_dc_add = ff_h264_idct8_dc_add_10_avx;
-
- c->h264_idct_add16 = ff_h264_idct_add16_10_avx;
- if (chroma_format_idc == 1)
- c->h264_idct_add8 = ff_h264_idct_add8_10_avx;
- c->h264_idct_add16intra= ff_h264_idct_add16intra_10_avx;
-#if HAVE_ALIGNED_STACK
- c->h264_idct8_add = ff_h264_idct8_add_10_avx;
- c->h264_idct8_add4 = ff_h264_idct8_add4_10_avx;
-#endif
-
- c->h264_v_loop_filter_chroma= ff_deblock_v_chroma_10_avx;
- c->h264_v_loop_filter_chroma_intra= ff_deblock_v_chroma_intra_10_avx;
-#if HAVE_ALIGNED_STACK
- c->h264_v_loop_filter_luma = ff_deblock_v_luma_10_avx;
- c->h264_h_loop_filter_luma = ff_deblock_h_luma_10_avx;
- c->h264_v_loop_filter_luma_intra = ff_deblock_v_luma_intra_10_avx;
- c->h264_h_loop_filter_luma_intra = ff_deblock_h_luma_intra_10_avx;
-#endif
- }
-#endif /* HAVE_AVX */
- }
- }
-#endif
- }
-}
diff --git a/gst-libs/ext/libav/libavcodec/x86/idct_mmx.c b/gst-libs/ext/libav/libavcodec/x86/idct_mmx.c
deleted file mode 100644
index ed2d321..0000000
--- a/gst-libs/ext/libav/libavcodec/x86/idct_mmx.c
+++ /dev/null
@@ -1,629 +0,0 @@
-/*
- * Copyright (C) 1999-2001 Aaron Holtzman <aholtzma@ess.engr.uvic.ca>
- *
- * This file is part of mpeg2dec, a free MPEG-2 video stream decoder.
- * See http://libmpeg2.sourceforge.net/ for updates.
- *
- * mpeg2dec is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * mpeg2dec 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with mpeg2dec; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavutil/common.h"
-#include "libavcodec/dsputil.h"
-
-#include "libavutil/x86_cpu.h"
-#include "dsputil_mmx.h"
-
-#define ROW_SHIFT 11
-#define COL_SHIFT 6
-
-#define round(bias) ((int)(((bias)+0.5) * (1<<ROW_SHIFT)))
-#define rounder(bias) {round (bias), round (bias)}
-
-
-#if 0
-/* C row IDCT - it is just here to document the MMXEXT and MMX versions */
-static inline void idct_row (int16_t * row, int offset,
- int16_t * table, int32_t * rounder)
-{
- int C1, C2, C3, C4, C5, C6, C7;
- int a0, a1, a2, a3, b0, b1, b2, b3;
-
- row += offset;
-
- C1 = table[1];
- C2 = table[2];
- C3 = table[3];
- C4 = table[4];
- C5 = table[5];
- C6 = table[6];
- C7 = table[7];
-
- a0 = C4*row[0] + C2*row[2] + C4*row[4] + C6*row[6] + *rounder;
- a1 = C4*row[0] + C6*row[2] - C4*row[4] - C2*row[6] + *rounder;
- a2 = C4*row[0] - C6*row[2] - C4*row[4] + C2*row[6] + *rounder;
- a3 = C4*row[0] - C2*row[2] + C4*row[4] - C6*row[6] + *rounder;
-
- b0 = C1*row[1] + C3*row[3] + C5*row[5] + C7*row[7];
- b1 = C3*row[1] - C7*row[3] - C1*row[5] - C5*row[7];
- b2 = C5*row[1] - C1*row[3] + C7*row[5] + C3*row[7];
- b3 = C7*row[1] - C5*row[3] + C3*row[5] - C1*row[7];
-
- row[0] = (a0 + b0) >> ROW_SHIFT;
- row[1] = (a1 + b1) >> ROW_SHIFT;
- row[2] = (a2 + b2) >> ROW_SHIFT;
- row[3] = (a3 + b3) >> ROW_SHIFT;
- row[4] = (a3 - b3) >> ROW_SHIFT;
- row[5] = (a2 - b2) >> ROW_SHIFT;
- row[6] = (a1 - b1) >> ROW_SHIFT;
- row[7] = (a0 - b0) >> ROW_SHIFT;
-}
-#endif
-
-
-/* MMXEXT row IDCT */
-
-#define mmxext_table(c1,c2,c3,c4,c5,c6,c7) { c4, c2, -c4, -c2, \
- c4, c6, c4, c6, \
- c1, c3, -c1, -c5, \
- c5, c7, c3, -c7, \
- c4, -c6, c4, -c6, \
- -c4, c2, c4, -c2, \
- c5, -c1, c3, -c1, \
- c7, c3, c7, -c5 }
-
-static inline void mmxext_row_head (int16_t * const row, const int offset,
- const int16_t * const table)
-{
- __asm__ volatile(
- "movq (%0), %%mm2 \n\t" /* mm2 = x6 x4 x2 x0 */
-
- "movq 8(%0), %%mm5 \n\t" /* mm5 = x7 x5 x3 x1 */
- "movq %%mm2, %%mm0 \n\t" /* mm0 = x6 x4 x2 x0 */
-
- "movq (%1), %%mm3 \n\t" /* mm3 = -C2 -C4 C2 C4 */
- "movq %%mm5, %%mm6 \n\t" /* mm6 = x7 x5 x3 x1 */
-
- "movq 8(%1), %%mm4 \n\t" /* mm4 = C6 C4 C6 C4 */
- "pmaddwd %%mm0, %%mm3 \n\t" /* mm3 = -C4*x4-C2*x6 C4*x0+C2*x2 */
-
- "pshufw $0x4e, %%mm2, %%mm2 \n\t" /* mm2 = x2 x0 x6 x4 */
- :: "r" ((row+offset)), "r" (table)
- );
-}
-
-static inline void mmxext_row (const int16_t * const table,
- const int32_t * const rounder)
-{
- __asm__ volatile (
- "movq 16(%0), %%mm1 \n\t" /* mm1 = -C5 -C1 C3 C1 */
- "pmaddwd %%mm2, %%mm4 \n\t" /* mm4 = C4*x0+C6*x2 C4*x4+C6*x6 */
-
- "pmaddwd 32(%0), %%mm0 \n\t" /* mm0 = C4*x4-C6*x6 C4*x0-C6*x2 */
- "pshufw $0x4e, %%mm6, %%mm6 \n\t" /* mm6 = x3 x1 x7 x5 */
-
- "movq 24(%0), %%mm7 \n\t" /* mm7 = -C7 C3 C7 C5 */
- "pmaddwd %%mm5, %%mm1 \n\t" /* mm1= -C1*x5-C5*x7 C1*x1+C3*x3 */
-
- "paddd (%1), %%mm3 \n\t" /* mm3 += rounder */
- "pmaddwd %%mm6, %%mm7 \n\t" /* mm7 = C3*x1-C7*x3 C5*x5+C7*x7 */
-
- "pmaddwd 40(%0), %%mm2 \n\t" /* mm2= C4*x0-C2*x2 -C4*x4+C2*x6 */
- "paddd %%mm4, %%mm3 \n\t" /* mm3 = a1 a0 + rounder */
-
- "pmaddwd 48(%0), %%mm5 \n\t" /* mm5 = C3*x5-C1*x7 C5*x1-C1*x3 */
- "movq %%mm3, %%mm4 \n\t" /* mm4 = a1 a0 + rounder */
-
- "pmaddwd 56(%0), %%mm6 \n\t" /* mm6 = C7*x1-C5*x3 C7*x5+C3*x7 */
- "paddd %%mm7, %%mm1 \n\t" /* mm1 = b1 b0 */
-
- "paddd (%1), %%mm0 \n\t" /* mm0 += rounder */
- "psubd %%mm1, %%mm3 \n\t" /* mm3 = a1-b1 a0-b0 + rounder */
-
- "psrad $" AV_STRINGIFY(ROW_SHIFT) ", %%mm3 \n\t" /* mm3 = y6 y7 */
- "paddd %%mm4, %%mm1 \n\t" /* mm1 = a1+b1 a0+b0 + rounder */
-
- "paddd %%mm2, %%mm0 \n\t" /* mm0 = a3 a2 + rounder */
- "psrad $" AV_STRINGIFY(ROW_SHIFT) ", %%mm1 \n\t" /* mm1 = y1 y0 */
-
- "paddd %%mm6, %%mm5 \n\t" /* mm5 = b3 b2 */
- "movq %%mm0, %%mm4 \n\t" /* mm4 = a3 a2 + rounder */
-
- "paddd %%mm5, %%mm0 \n\t" /* mm0 = a3+b3 a2+b2 + rounder */
- "psubd %%mm5, %%mm4 \n\t" /* mm4 = a3-b3 a2-b2 + rounder */
- : : "r" (table), "r" (rounder));
-}
-
-static inline void mmxext_row_tail (int16_t * const row, const int store)
-{
- __asm__ volatile (
- "psrad $" AV_STRINGIFY(ROW_SHIFT) ", %%mm0 \n\t" /* mm0 = y3 y2 */
-
- "psrad $" AV_STRINGIFY(ROW_SHIFT) ", %%mm4 \n\t" /* mm4 = y4 y5 */
-
- "packssdw %%mm0, %%mm1 \n\t" /* mm1 = y3 y2 y1 y0 */
-
- "packssdw %%mm3, %%mm4 \n\t" /* mm4 = y6 y7 y4 y5 */
-
- "movq %%mm1, (%0) \n\t" /* save y3 y2 y1 y0 */
- "pshufw $0xb1, %%mm4, %%mm4 \n\t" /* mm4 = y7 y6 y5 y4 */
-
- /* slot */
-
- "movq %%mm4, 8(%0) \n\t" /* save y7 y6 y5 y4 */
- :: "r" (row+store)
- );
-}
-
-static inline void mmxext_row_mid (int16_t * const row, const int store,
- const int offset,
- const int16_t * const table)
-{
- __asm__ volatile (
- "movq (%0,%1), %%mm2 \n\t" /* mm2 = x6 x4 x2 x0 */
- "psrad $" AV_STRINGIFY(ROW_SHIFT) ", %%mm0 \n\t" /* mm0 = y3 y2 */
-
- "movq 8(%0,%1), %%mm5 \n\t" /* mm5 = x7 x5 x3 x1 */
- "psrad $" AV_STRINGIFY(ROW_SHIFT) ", %%mm4 \n\t" /* mm4 = y4 y5 */
-
- "packssdw %%mm0, %%mm1 \n\t" /* mm1 = y3 y2 y1 y0 */
- "movq %%mm5, %%mm6 \n\t" /* mm6 = x7 x5 x3 x1 */
-
- "packssdw %%mm3, %%mm4 \n\t" /* mm4 = y6 y7 y4 y5 */
- "movq %%mm2, %%mm0 \n\t" /* mm0 = x6 x4 x2 x0 */
-
- "movq %%mm1, (%0,%2) \n\t" /* save y3 y2 y1 y0 */
- "pshufw $0xb1, %%mm4, %%mm4\n\t" /* mm4 = y7 y6 y5 y4 */
-
- "movq (%3), %%mm3 \n\t" /* mm3 = -C2 -C4 C2 C4 */
- "movq %%mm4, 8(%0,%2) \n\t" /* save y7 y6 y5 y4 */
-
- "pmaddwd %%mm0, %%mm3 \n\t" /* mm3= -C4*x4-C2*x6 C4*x0+C2*x2 */
-
- "movq 8(%3), %%mm4 \n\t" /* mm4 = C6 C4 C6 C4 */
- "pshufw $0x4e, %%mm2, %%mm2\n\t" /* mm2 = x2 x0 x6 x4 */
- :: "r" (row), "r" ((x86_reg) (2*offset)), "r" ((x86_reg) (2*store)), "r" (table)
- );
-}
-
-
-/* MMX row IDCT */
-
-#define mmx_table(c1,c2,c3,c4,c5,c6,c7) { c4, c2, c4, c6, \
- c4, c6, -c4, -c2, \
- c1, c3, c3, -c7, \
- c5, c7, -c1, -c5, \
- c4, -c6, c4, -c2, \
- -c4, c2, c4, -c6, \
- c5, -c1, c7, -c5, \
- c7, c3, c3, -c1 }
-
-static inline void mmx_row_head (int16_t * const row, const int offset,
- const int16_t * const table)
-{
- __asm__ volatile (
- "movq (%0), %%mm2 \n\t" /* mm2 = x6 x4 x2 x0 */
-
- "movq 8(%0), %%mm5 \n\t" /* mm5 = x7 x5 x3 x1 */
- "movq %%mm2, %%mm0 \n\t" /* mm0 = x6 x4 x2 x0 */
-
- "movq (%1), %%mm3 \n\t" /* mm3 = C6 C4 C2 C4 */
- "movq %%mm5, %%mm6 \n\t" /* mm6 = x7 x5 x3 x1 */
-
- "punpckldq %%mm0, %%mm0 \n\t" /* mm0 = x2 x0 x2 x0 */
-
- "movq 8(%1), %%mm4 \n\t" /* mm4 = -C2 -C4 C6 C4 */
- "pmaddwd %%mm0, %%mm3 \n\t" /* mm3 = C4*x0+C6*x2 C4*x0+C2*x2 */
-
- "movq 16(%1), %%mm1 \n\t" /* mm1 = -C7 C3 C3 C1 */
- "punpckhdq %%mm2, %%mm2 \n\t" /* mm2 = x6 x4 x6 x4 */
- :: "r" ((row+offset)), "r" (table)
- );
-}
-
-static inline void mmx_row (const int16_t * const table,
- const int32_t * const rounder)
-{
- __asm__ volatile (
- "pmaddwd %%mm2, %%mm4 \n\t" /* mm4 = -C4*x4-C2*x6 C4*x4+C6*x6 */
- "punpckldq %%mm5, %%mm5 \n\t" /* mm5 = x3 x1 x3 x1 */
-
- "pmaddwd 32(%0), %%mm0 \n\t" /* mm0 = C4*x0-C2*x2 C4*x0-C6*x2 */
- "punpckhdq %%mm6, %%mm6 \n\t" /* mm6 = x7 x5 x7 x5 */
-
- "movq 24(%0), %%mm7 \n\t" /* mm7 = -C5 -C1 C7 C5 */
- "pmaddwd %%mm5, %%mm1 \n\t" /* mm1 = C3*x1-C7*x3 C1*x1+C3*x3 */
-
- "paddd (%1), %%mm3 \n\t" /* mm3 += rounder */
- "pmaddwd %%mm6, %%mm7 \n\t" /* mm7 = -C1*x5-C5*x7 C5*x5+C7*x7 */
-
- "pmaddwd 40(%0), %%mm2 \n\t" /* mm2 = C4*x4-C6*x6 -C4*x4+C2*x6 */
- "paddd %%mm4, %%mm3 \n\t" /* mm3 = a1 a0 + rounder */
-
- "pmaddwd 48(%0), %%mm5 \n\t" /* mm5 = C7*x1-C5*x3 C5*x1-C1*x3 */
- "movq %%mm3, %%mm4 \n\t" /* mm4 = a1 a0 + rounder */
-
- "pmaddwd 56(%0), %%mm6 \n\t" /* mm6 = C3*x5-C1*x7 C7*x5+C3*x7 */
- "paddd %%mm7, %%mm1 \n\t" /* mm1 = b1 b0 */
-
- "paddd (%1), %%mm0 \n\t" /* mm0 += rounder */
- "psubd %%mm1, %%mm3 \n\t" /* mm3 = a1-b1 a0-b0 + rounder */
-
- "psrad $" AV_STRINGIFY(ROW_SHIFT) ", %%mm3 \n\t" /* mm3 = y6 y7 */
- "paddd %%mm4, %%mm1 \n\t" /* mm1 = a1+b1 a0+b0 + rounder */
-
- "paddd %%mm2, %%mm0 \n\t" /* mm0 = a3 a2 + rounder */
- "psrad $" AV_STRINGIFY(ROW_SHIFT) ", %%mm1 \n\t" /* mm1 = y1 y0 */
-
- "paddd %%mm6, %%mm5 \n\t" /* mm5 = b3 b2 */
- "movq %%mm0, %%mm7 \n\t" /* mm7 = a3 a2 + rounder */
-
- "paddd %%mm5, %%mm0 \n\t" /* mm0 = a3+b3 a2+b2 + rounder */
- "psubd %%mm5, %%mm7 \n\t" /* mm7 = a3-b3 a2-b2 + rounder */
- :: "r" (table), "r" (rounder)
- );
-}
-
-static inline void mmx_row_tail (int16_t * const row, const int store)
-{
- __asm__ volatile (
- "psrad $" AV_STRINGIFY(ROW_SHIFT) ", %%mm0 \n\t" /* mm0 = y3 y2 */
-
- "psrad $" AV_STRINGIFY(ROW_SHIFT) ", %%mm7 \n\t" /* mm7 = y4 y5 */
-
- "packssdw %%mm0, %%mm1 \n\t" /* mm1 = y3 y2 y1 y0 */
-
- "packssdw %%mm3, %%mm7 \n\t" /* mm7 = y6 y7 y4 y5 */
-
- "movq %%mm1, (%0) \n\t" /* save y3 y2 y1 y0 */
- "movq %%mm7, %%mm4 \n\t" /* mm4 = y6 y7 y4 y5 */
-
- "pslld $16, %%mm7 \n\t" /* mm7 = y7 0 y5 0 */
-
- "psrld $16, %%mm4 \n\t" /* mm4 = 0 y6 0 y4 */
-
- "por %%mm4, %%mm7 \n\t" /* mm7 = y7 y6 y5 y4 */
-
- /* slot */
-
- "movq %%mm7, 8(%0) \n\t" /* save y7 y6 y5 y4 */
- :: "r" (row+store)
- );
-}
-
-static inline void mmx_row_mid (int16_t * const row, const int store,
- const int offset, const int16_t * const table)
-{
-
- __asm__ volatile (
- "movq (%0,%1), %%mm2 \n\t" /* mm2 = x6 x4 x2 x0 */
- "psrad $" AV_STRINGIFY(ROW_SHIFT) ", %%mm0 \n\t" /* mm0 = y3 y2 */
-
- "movq 8(%0,%1), %%mm5 \n\t" /* mm5 = x7 x5 x3 x1 */
- "psrad $" AV_STRINGIFY(ROW_SHIFT) ", %%mm7 \n\t" /* mm7 = y4 y5 */
-
- "packssdw %%mm0, %%mm1 \n\t" /* mm1 = y3 y2 y1 y0 */
- "movq %%mm5, %%mm6 \n\t" /* mm6 = x7 x5 x3 x1 */
-
- "packssdw %%mm3, %%mm7 \n\t" /* mm7 = y6 y7 y4 y5 */
- "movq %%mm2, %%mm0 \n\t" /* mm0 = x6 x4 x2 x0 */
-
- "movq %%mm1, (%0,%2) \n\t" /* save y3 y2 y1 y0 */
- "movq %%mm7, %%mm1 \n\t" /* mm1 = y6 y7 y4 y5 */
-
- "punpckldq %%mm0, %%mm0 \n\t" /* mm0 = x2 x0 x2 x0 */
- "psrld $16, %%mm7 \n\t" /* mm7 = 0 y6 0 y4 */
-
- "movq (%3), %%mm3 \n\t" /* mm3 = C6 C4 C2 C4 */
- "pslld $16, %%mm1 \n\t" /* mm1 = y7 0 y5 0 */
-
- "movq 8(%3), %%mm4 \n\t" /* mm4 = -C2 -C4 C6 C4 */
- "por %%mm1, %%mm7 \n\t" /* mm7 = y7 y6 y5 y4 */
-
- "movq 16(%3), %%mm1 \n\t" /* mm1 = -C7 C3 C3 C1 */
- "punpckhdq %%mm2, %%mm2 \n\t" /* mm2 = x6 x4 x6 x4 */
-
- "movq %%mm7, 8(%0,%2) \n\t" /* save y7 y6 y5 y4 */
- "pmaddwd %%mm0, %%mm3 \n\t" /* mm3 = C4*x0+C6*x2 C4*x0+C2*x2 */
- : : "r" (row), "r" ((x86_reg) (2*offset)), "r" ((x86_reg) (2*store)), "r" (table)
- );
-}
-
-
-#if 0
-/* C column IDCT - it is just here to document the MMXEXT and MMX versions */
-static inline void idct_col (int16_t * col, int offset)
-{
-/* multiplication - as implemented on mmx */
-#define F(c,x) (((c) * (x)) >> 16)
-
-/* saturation - it helps us handle torture test cases */
-#define S(x) (((x)>32767) ? 32767 : ((x)<-32768) ? -32768 : (x))
-
- int16_t x0, x1, x2, x3, x4, x5, x6, x7;
- int16_t y0, y1, y2, y3, y4, y5, y6, y7;
- int16_t a0, a1, a2, a3, b0, b1, b2, b3;
- int16_t u04, v04, u26, v26, u17, v17, u35, v35, u12, v12;
-
- col += offset;
-
- x0 = col[0*8];
- x1 = col[1*8];
- x2 = col[2*8];
- x3 = col[3*8];
- x4 = col[4*8];
- x5 = col[5*8];
- x6 = col[6*8];
- x7 = col[7*8];
-
- u04 = S (x0 + x4);
- v04 = S (x0 - x4);
- u26 = S (F (T2, x6) + x2);
- v26 = S (F (T2, x2) - x6);
-
- a0 = S (u04 + u26);
- a1 = S (v04 + v26);
- a2 = S (v04 - v26);
- a3 = S (u04 - u26);
-
- u17 = S (F (T1, x7) + x1);
- v17 = S (F (T1, x1) - x7);
- u35 = S (F (T3, x5) + x3);
- v35 = S (F (T3, x3) - x5);
-
- b0 = S (u17 + u35);
- b3 = S (v17 - v35);
- u12 = S (u17 - u35);
- v12 = S (v17 + v35);
- u12 = S (2 * F (C4, u12));
- v12 = S (2 * F (C4, v12));
- b1 = S (u12 + v12);
- b2 = S (u12 - v12);
-
- y0 = S (a0 + b0) >> COL_SHIFT;
- y1 = S (a1 + b1) >> COL_SHIFT;
- y2 = S (a2 + b2) >> COL_SHIFT;
- y3 = S (a3 + b3) >> COL_SHIFT;
-
- y4 = S (a3 - b3) >> COL_SHIFT;
- y5 = S (a2 - b2) >> COL_SHIFT;
- y6 = S (a1 - b1) >> COL_SHIFT;
- y7 = S (a0 - b0) >> COL_SHIFT;
-
- col[0*8] = y0;
- col[1*8] = y1;
- col[2*8] = y2;
- col[3*8] = y3;
- col[4*8] = y4;
- col[5*8] = y5;
- col[6*8] = y6;
- col[7*8] = y7;
-}
-#endif
-
-
-/* MMX column IDCT */
-static inline void idct_col (int16_t * const col, const int offset)
-{
-#define T1 13036
-#define T2 27146
-#define T3 43790
-#define C4 23170
-
- DECLARE_ALIGNED(8, static const short, t1_vector)[] = {
- T1,T1,T1,T1,
- T2,T2,T2,T2,
- T3,T3,T3,T3,
- C4,C4,C4,C4
- };
-
- /* column code adapted from Peter Gubanov */
- /* http://www.elecard.com/peter/idct.shtml */
-
- __asm__ volatile (
- "movq (%0), %%mm0 \n\t" /* mm0 = T1 */
-
- "movq 2*8(%1), %%mm1 \n\t" /* mm1 = x1 */
- "movq %%mm0, %%mm2 \n\t" /* mm2 = T1 */
-
- "movq 7*2*8(%1), %%mm4 \n\t" /* mm4 = x7 */
- "pmulhw %%mm1, %%mm0 \n\t" /* mm0 = T1*x1 */
-
- "movq 16(%0), %%mm5 \n\t" /* mm5 = T3 */
- "pmulhw %%mm4, %%mm2 \n\t" /* mm2 = T1*x7 */
-
- "movq 2*5*8(%1), %%mm6 \n\t" /* mm6 = x5 */
- "movq %%mm5, %%mm7 \n\t" /* mm7 = T3-1 */
-
- "movq 3*8*2(%1), %%mm3 \n\t" /* mm3 = x3 */
- "psubsw %%mm4, %%mm0 \n\t" /* mm0 = v17 */
-
- "movq 8(%0), %%mm4 \n\t" /* mm4 = T2 */
- "pmulhw %%mm3, %%mm5 \n\t" /* mm5 = (T3-1)*x3 */
-
- "paddsw %%mm2, %%mm1 \n\t" /* mm1 = u17 */
- "pmulhw %%mm6, %%mm7 \n\t" /* mm7 = (T3-1)*x5 */
-
- /* slot */
-
- "movq %%mm4, %%mm2 \n\t" /* mm2 = T2 */
- "paddsw %%mm3, %%mm5 \n\t" /* mm5 = T3*x3 */
-
- "pmulhw 2*8*2(%1), %%mm4 \n\t" /* mm4 = T2*x2 */
- "paddsw %%mm6, %%mm7 \n\t" /* mm7 = T3*x5 */
-
- "psubsw %%mm6, %%mm5 \n\t" /* mm5 = v35 */
- "paddsw %%mm3, %%mm7 \n\t" /* mm7 = u35 */
-
- "movq 6*8*2(%1), %%mm3 \n\t" /* mm3 = x6 */
- "movq %%mm0, %%mm6 \n\t" /* mm6 = v17 */
-
- "pmulhw %%mm3, %%mm2 \n\t" /* mm2 = T2*x6 */
- "psubsw %%mm5, %%mm0 \n\t" /* mm0 = b3 */
-
- "psubsw %%mm3, %%mm4 \n\t" /* mm4 = v26 */
- "paddsw %%mm6, %%mm5 \n\t" /* mm5 = v12 */
-
- "movq %%mm0, 3*8*2(%1)\n\t" /* save b3 in scratch0 */
- "movq %%mm1, %%mm6 \n\t" /* mm6 = u17 */
-
- "paddsw 2*8*2(%1), %%mm2 \n\t" /* mm2 = u26 */
- "paddsw %%mm7, %%mm6 \n\t" /* mm6 = b0 */
-
- "psubsw %%mm7, %%mm1 \n\t" /* mm1 = u12 */
- "movq %%mm1, %%mm7 \n\t" /* mm7 = u12 */
-
- "movq 0*8(%1), %%mm3 \n\t" /* mm3 = x0 */
- "paddsw %%mm5, %%mm1 \n\t" /* mm1 = u12+v12 */
-
- "movq 24(%0), %%mm0 \n\t" /* mm0 = C4/2 */
- "psubsw %%mm5, %%mm7 \n\t" /* mm7 = u12-v12 */
-
- "movq %%mm6, 5*8*2(%1)\n\t" /* save b0 in scratch1 */
- "pmulhw %%mm0, %%mm1 \n\t" /* mm1 = b1/2 */
-
- "movq %%mm4, %%mm6 \n\t" /* mm6 = v26 */
- "pmulhw %%mm0, %%mm7 \n\t" /* mm7 = b2/2 */
-
- "movq 4*8*2(%1), %%mm5 \n\t" /* mm5 = x4 */
- "movq %%mm3, %%mm0 \n\t" /* mm0 = x0 */
-
- "psubsw %%mm5, %%mm3 \n\t" /* mm3 = v04 */
- "paddsw %%mm5, %%mm0 \n\t" /* mm0 = u04 */
-
- "paddsw %%mm3, %%mm4 \n\t" /* mm4 = a1 */
- "movq %%mm0, %%mm5 \n\t" /* mm5 = u04 */
-
- "psubsw %%mm6, %%mm3 \n\t" /* mm3 = a2 */
- "paddsw %%mm2, %%mm5 \n\t" /* mm5 = a0 */
-
- "paddsw %%mm1, %%mm1 \n\t" /* mm1 = b1 */
- "psubsw %%mm2, %%mm0 \n\t" /* mm0 = a3 */
-
- "paddsw %%mm7, %%mm7 \n\t" /* mm7 = b2 */
- "movq %%mm3, %%mm2 \n\t" /* mm2 = a2 */
-
- "movq %%mm4, %%mm6 \n\t" /* mm6 = a1 */
- "paddsw %%mm7, %%mm3 \n\t" /* mm3 = a2+b2 */
-
- "psraw $" AV_STRINGIFY(COL_SHIFT) ", %%mm3\n\t" /* mm3 = y2 */
- "paddsw %%mm1, %%mm4\n\t" /* mm4 = a1+b1 */
-
- "psraw $" AV_STRINGIFY(COL_SHIFT) ", %%mm4\n\t" /* mm4 = y1 */
- "psubsw %%mm1, %%mm6 \n\t" /* mm6 = a1-b1 */
-
- "movq 5*8*2(%1), %%mm1 \n\t" /* mm1 = b0 */
- "psubsw %%mm7, %%mm2 \n\t" /* mm2 = a2-b2 */
-
- "psraw $" AV_STRINGIFY(COL_SHIFT) ", %%mm6\n\t" /* mm6 = y6 */
- "movq %%mm5, %%mm7 \n\t" /* mm7 = a0 */
-
- "movq %%mm4, 1*8*2(%1)\n\t" /* save y1 */
- "psraw $" AV_STRINGIFY(COL_SHIFT) ", %%mm2\n\t" /* mm2 = y5 */
-
- "movq %%mm3, 2*8*2(%1)\n\t" /* save y2 */
- "paddsw %%mm1, %%mm5 \n\t" /* mm5 = a0+b0 */
-
- "movq 3*8*2(%1), %%mm4 \n\t" /* mm4 = b3 */
- "psubsw %%mm1, %%mm7 \n\t" /* mm7 = a0-b0 */
-
- "psraw $" AV_STRINGIFY(COL_SHIFT) ", %%mm5\n\t" /* mm5 = y0 */
- "movq %%mm0, %%mm3 \n\t" /* mm3 = a3 */
-
- "movq %%mm2, 5*8*2(%1)\n\t" /* save y5 */
- "psubsw %%mm4, %%mm3 \n\t" /* mm3 = a3-b3 */
-
- "psraw $" AV_STRINGIFY(COL_SHIFT) ", %%mm7\n\t" /* mm7 = y7 */
- "paddsw %%mm0, %%mm4 \n\t" /* mm4 = a3+b3 */
-
- "movq %%mm5, 0*8*2(%1)\n\t" /* save y0 */
- "psraw $" AV_STRINGIFY(COL_SHIFT) ", %%mm3\n\t" /* mm3 = y4 */
-
- "movq %%mm6, 6*8*2(%1)\n\t" /* save y6 */
- "psraw $" AV_STRINGIFY(COL_SHIFT) ", %%mm4\n\t" /* mm4 = y3 */
-
- "movq %%mm7, 7*8*2(%1)\n\t" /* save y7 */
-
- "movq %%mm3, 4*8*2(%1)\n\t" /* save y4 */
-
- "movq %%mm4, 3*8*2(%1)\n\t" /* save y3 */
- :: "r" (t1_vector), "r" (col+offset)
- );
-
-#undef T1
-#undef T2
-#undef T3
-#undef C4
-}
-
-
-DECLARE_ALIGNED(8, static const int32_t, rounder0)[] =
- rounder ((1 << (COL_SHIFT - 1)) - 0.5);
-DECLARE_ALIGNED(8, static const int32_t, rounder4)[] = rounder (0);
-DECLARE_ALIGNED(8, static const int32_t, rounder1)[] =
- rounder (1.25683487303); /* C1*(C1/C4+C1+C7)/2 */
-DECLARE_ALIGNED(8, static const int32_t, rounder7)[] =
- rounder (-0.25); /* C1*(C7/C4+C7-C1)/2 */
-DECLARE_ALIGNED(8, static const int32_t, rounder2)[] =
- rounder (0.60355339059); /* C2 * (C6+C2)/2 */
-DECLARE_ALIGNED(8, static const int32_t, rounder6)[] =
- rounder (-0.25); /* C2 * (C6-C2)/2 */
-DECLARE_ALIGNED(8, static const int32_t, rounder3)[] =
- rounder (0.087788325588); /* C3*(-C3/C4+C3+C5)/2 */
-DECLARE_ALIGNED(8, static const int32_t, rounder5)[] =
- rounder (-0.441341716183); /* C3*(-C5/C4+C5-C3)/2 */
-
-#undef COL_SHIFT
-#undef ROW_SHIFT
-
-#define declare_idct(idct,table,idct_row_head,idct_row,idct_row_tail,idct_row_mid) \
-void idct (int16_t * const block) \
-{ \
- DECLARE_ALIGNED(16, static const int16_t, table04)[] = \
- table (22725, 21407, 19266, 16384, 12873, 8867, 4520); \
- DECLARE_ALIGNED(16, static const int16_t, table17)[] = \
- table (31521, 29692, 26722, 22725, 17855, 12299, 6270); \
- DECLARE_ALIGNED(16, static const int16_t, table26)[] = \
- table (29692, 27969, 25172, 21407, 16819, 11585, 5906); \
- DECLARE_ALIGNED(16, static const int16_t, table35)[] = \
- table (26722, 25172, 22654, 19266, 15137, 10426, 5315); \
- \
- idct_row_head (block, 0*8, table04); \
- idct_row (table04, rounder0); \
- idct_row_mid (block, 0*8, 4*8, table04); \
- idct_row (table04, rounder4); \
- idct_row_mid (block, 4*8, 1*8, table17); \
- idct_row (table17, rounder1); \
- idct_row_mid (block, 1*8, 7*8, table17); \
- idct_row (table17, rounder7); \
- idct_row_mid (block, 7*8, 2*8, table26); \
- idct_row (table26, rounder2); \
- idct_row_mid (block, 2*8, 6*8, table26); \
- idct_row (table26, rounder6); \
- idct_row_mid (block, 6*8, 3*8, table35); \
- idct_row (table35, rounder3); \
- idct_row_mid (block, 3*8, 5*8, table35); \
- idct_row (table35, rounder5); \
- idct_row_tail (block, 5*8); \
- \
- idct_col (block, 0); \
- idct_col (block, 4); \
-}
-
-declare_idct (ff_mmxext_idct, mmxext_table,
- mmxext_row_head, mmxext_row, mmxext_row_tail, mmxext_row_mid)
-
-declare_idct (ff_mmx_idct, mmx_table,
- mmx_row_head, mmx_row, mmx_row_tail, mmx_row_mid)
-
diff --git a/gst-libs/ext/libav/libavcodec/x86/idct_mmx_xvid.c b/gst-libs/ext/libav/libavcodec/x86/idct_mmx_xvid.c
index 3055205..2cf8b47 100644
--- a/gst-libs/ext/libav/libavcodec/x86/idct_mmx_xvid.c
+++ b/gst-libs/ext/libav/libavcodec/x86/idct_mmx_xvid.c
@@ -40,9 +40,15 @@
*/
#include <inttypes.h>
+
+#include "config.h"
#include "libavcodec/avcodec.h"
+#include "libavutil/mem.h"
+#include "dsputil_mmx.h"
#include "idct_xvid.h"
+#if HAVE_INLINE_ASM
+
//=============================================================================
// Macros and other preprocessor constants
//=============================================================================
@@ -506,7 +512,8 @@ __asm__ volatile(
//-----------------------------------------------------------------------------
-void ff_idct_xvid_mmx2(short *block){
+void ff_idct_xvid_mmxext(short *block)
+{
__asm__ volatile(
//# Process each row
DCT_8_INV_ROW_XMM(0*16(%0), 0*16(%0), 64*0(%2), 8*0(%1))
@@ -524,3 +531,28 @@ __asm__ volatile(
:: "r"(block), "r"(rounder_0), "r"(tab_i_04_xmm), "r"(tg_1_16));
}
+void ff_idct_xvid_mmx_put(uint8_t *dest, int line_size, DCTELEM *block)
+{
+ ff_idct_xvid_mmx(block);
+ ff_put_pixels_clamped_mmx(block, dest, line_size);
+}
+
+void ff_idct_xvid_mmx_add(uint8_t *dest, int line_size, DCTELEM *block)
+{
+ ff_idct_xvid_mmx(block);
+ ff_add_pixels_clamped_mmx(block, dest, line_size);
+}
+
+void ff_idct_xvid_mmxext_put(uint8_t *dest, int line_size, DCTELEM *block)
+{
+ ff_idct_xvid_mmxext(block);
+ ff_put_pixels_clamped_mmx(block, dest, line_size);
+}
+
+void ff_idct_xvid_mmxext_add(uint8_t *dest, int line_size, DCTELEM *block)
+{
+ ff_idct_xvid_mmxext(block);
+ ff_add_pixels_clamped_mmx(block, dest, line_size);
+}
+
+#endif /* HAVE_INLINE_ASM */
diff --git a/gst-libs/ext/libav/libavcodec/x86/idct_sse2_xvid.c b/gst-libs/ext/libav/libavcodec/x86/idct_sse2_xvid.c
index 968b400..fe2478e 100644
--- a/gst-libs/ext/libav/libavcodec/x86/idct_sse2_xvid.c
+++ b/gst-libs/ext/libav/libavcodec/x86/idct_sse2_xvid.c
@@ -39,10 +39,14 @@
*/
#include "libavcodec/dsputil.h"
-#include "libavutil/x86_cpu.h"
+#include "libavutil/internal.h"
+#include "libavutil/mem.h"
+#include "libavutil/x86/asm.h"
#include "idct_xvid.h"
#include "dsputil_mmx.h"
+#if HAVE_INLINE_ASM
+
/**
* @file
* @brief SSE2 idct compatible with xvidmmx
@@ -401,3 +405,5 @@ void ff_idct_xvid_sse2_add(uint8_t *dest, int line_size, short *block)
ff_idct_xvid_sse2(block);
ff_add_pixels_clamped_mmx(block, dest, line_size);
}
+
+#endif /* HAVE_INLINE_ASM */
diff --git a/gst-libs/ext/libav/libavcodec/x86/idct_xvid.h b/gst-libs/ext/libav/libavcodec/x86/idct_xvid.h
index 495d2ca..79d5bf9 100644
--- a/gst-libs/ext/libav/libavcodec/x86/idct_xvid.h
+++ b/gst-libs/ext/libav/libavcodec/x86/idct_xvid.h
@@ -28,8 +28,16 @@
#include <stdint.h>
+#include "libavcodec/dsputil.h"
+
void ff_idct_xvid_mmx(short *block);
-void ff_idct_xvid_mmx2(short *block);
+void ff_idct_xvid_mmx_put(uint8_t *dest, int line_size, DCTELEM *block);
+void ff_idct_xvid_mmx_add(uint8_t *dest, int line_size, DCTELEM *block);
+
+void ff_idct_xvid_mmxext(short *block);
+void ff_idct_xvid_mmxext_put(uint8_t *dest, int line_size, DCTELEM *block);
+void ff_idct_xvid_mmxext_add(uint8_t *dest, int line_size, DCTELEM *block);
+
void ff_idct_xvid_sse2(short *block);
void ff_idct_xvid_sse2_put(uint8_t *dest, int line_size, short *block);
void ff_idct_xvid_sse2_add(uint8_t *dest, int line_size, short *block);
diff --git a/gst-libs/ext/libav/libavcodec/x86/imdct36.asm b/gst-libs/ext/libav/libavcodec/x86/imdct36.asm
new file mode 100644
index 0000000..633fcd9
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/x86/imdct36.asm
@@ -0,0 +1,720 @@
+;******************************************************************************
+;* 36 point SSE-optimized IMDCT transform
+;* Copyright (c) 2011 Vitor Sessak
+;*
+;* 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
+;******************************************************************************
+
+%include "libavutil/x86/x86util.asm"
+
+SECTION_RODATA
+
+align 16
+ps_mask: dd 0, ~0, ~0, ~0
+ps_mask2: dd 0, ~0, 0, ~0
+ps_mask3: dd 0, 0, 0, ~0
+ps_mask4: dd 0, ~0, 0, 0
+
+ps_val1: dd -0.5, -0.5, -0.8660254038, -0.8660254038
+ps_val2: dd 1.0, 1.0, 0.8660254038, 0.8660254038
+ps_val3: dd 0.1736481777, 0.1736481777, 0.3420201433, 0.3420201433
+ps_val4: dd -0.7660444431, -0.7660444431, 0.8660254038, 0.8660254038
+ps_val5: dd -0.9396926208, -0.9396926208, -0.9848077530, -0.9848077530
+ps_val6: dd 0.5, 0.5, -0.6427876097, -0.6427876097
+ps_val7: dd 1.0, 1.0, -0.6427876097, -0.6427876097
+
+ps_p1p1m1m1: dd 0, 0, 0x80000000, 0x80000000
+ps_p1m1p1m1: dd 0, 0x80000000, 0, 0x80000000
+
+ps_cosh: dd 1.0, 0.50190991877167369479, 1.0, 5.73685662283492756461
+ dd 1.0, 0.51763809020504152469, 1.0, 1.93185165257813657349
+ dd 1.0, 0.55168895948124587824, -1.0, -1.18310079157624925896
+ dd 1.0, 0.61038729438072803416, -1.0, -0.87172339781054900991
+ dd 1.0, 0.70710678118654752439, 0.0, 0.0
+
+ps_cosh_sse3: dd 1.0, -0.50190991877167369479, 1.0, -5.73685662283492756461
+ dd 1.0, -0.51763809020504152469, 1.0, -1.93185165257813657349
+ dd 1.0, -0.55168895948124587824, -1.0, 1.18310079157624925896
+ dd 1.0, -0.61038729438072803416, -1.0, 0.87172339781054900991
+ dd 1.0, 0.70710678118654752439, 0.0, 0.0
+
+costabs: times 4 dd 0.98480773
+ times 4 dd 0.93969262
+ times 4 dd 0.86602539
+ times 4 dd -0.76604444
+ times 4 dd -0.64278764
+ times 4 dd 0.50000000
+ times 4 dd -0.50000000
+ times 4 dd -0.34202015
+ times 4 dd -0.17364818
+ times 4 dd 0.50190992
+ times 4 dd 0.51763808
+ times 4 dd 0.55168896
+ times 4 dd 0.61038726
+ times 4 dd 0.70710677
+ times 4 dd 0.87172341
+ times 4 dd 1.18310082
+ times 4 dd 1.93185163
+ times 4 dd 5.73685646
+
+%define SBLIMIT 32
+SECTION_TEXT
+
+%macro PSHUFD 3
+%if cpuflag(sse2) && notcpuflag(avx)
+ pshufd %1, %2, %3
+%else
+ shufps %1, %2, %2, %3
+%endif
+%endmacro
+
+; input %2={x1,x2,x3,x4}, %3={y1,y2,y3,y4}
+; output %1={x3,x4,y1,y2}
+%macro BUILDINVHIGHLOW 3
+%if cpuflag(avx)
+ shufps %1, %2, %3, 0x4e
+%else
+ movlhps %1, %3
+ movhlps %1, %2
+%endif
+%endmacro
+
+; input %2={x1,x2,x3,x4}, %3={y1,y2,y3,y4}
+; output %1={x4,y1,y2,y3}
+%macro ROTLEFT 3
+%if cpuflag(ssse3)
+ palignr %1, %3, %2, 12
+%else
+ BUILDINVHIGHLOW %1, %2, %3
+ shufps %1, %1, %3, 0x99
+%endif
+%endmacro
+
+%macro INVERTHL 2
+%if cpuflag(sse2)
+ PSHUFD %1, %2, 0x4e
+%else
+ movhlps %1, %2
+ movlhps %1, %2
+%endif
+%endmacro
+
+%macro BUTTERF 3
+ INVERTHL %2, %1
+ xorps %1, [ps_p1p1m1m1]
+ addps %1, %2
+%if cpuflag(sse3)
+ mulps %1, %1, [ps_cosh_sse3 + %3]
+ PSHUFD %2, %1, 0xb1
+ addsubps %1, %1, %2
+%else
+ mulps %1, [ps_cosh + %3]
+ PSHUFD %2, %1, 0xb1
+ xorps %1, [ps_p1m1p1m1]
+ addps %1, %2
+%endif
+%endmacro
+
+%macro STORE 4
+ movhlps %2, %1
+ movss [%3 ], %1
+ movss [%3 + 2*%4], %2
+ shufps %1, %1, 0xb1
+ movss [%3 + %4], %1
+ movhlps %2, %1
+ movss [%3 + 3*%4], %2
+%endmacro
+
+%macro LOAD 4
+ movlps %1, [%3 ]
+ movhps %1, [%3 + %4]
+ movlps %2, [%3 + 2*%4]
+ movhps %2, [%3 + 3*%4]
+ shufps %1, %2, 0x88
+%endmacro
+
+%macro LOADA64 2
+%if cpuflag(avx)
+ movu %1, [%2]
+%else
+ movlps %1, [%2]
+ movhps %1, [%2 + 8]
+%endif
+%endmacro
+
+%macro DEFINE_IMDCT 0
+cglobal imdct36_float, 4,4,9, out, buf, in, win
+
+ ; for(i=17;i>=1;i--) in[i] += in[i-1];
+ LOADA64 m0, inq
+ LOADA64 m1, inq + 16
+
+ ROTLEFT m5, m0, m1
+
+ PSHUFD m6, m0, 0x93
+ andps m6, m6, [ps_mask]
+ addps m0, m0, m6
+
+ LOADA64 m2, inq + 32
+
+ ROTLEFT m7, m1, m2
+
+ addps m1, m1, m5
+ LOADA64 m3, inq + 48
+
+ ROTLEFT m5, m2, m3
+
+ xorps m4, m4, m4
+ movlps m4, [inq+64]
+ BUILDINVHIGHLOW m6, m3, m4
+ shufps m6, m6, m4, 0xa9
+
+ addps m4, m4, m6
+ addps m2, m2, m7
+ addps m3, m3, m5
+
+ ; for(i=17;i>=3;i-=2) in[i] += in[i-2];
+ movlhps m5, m5, m0
+ andps m5, m5, [ps_mask3]
+
+ BUILDINVHIGHLOW m7, m0, m1
+ andps m7, m7, [ps_mask2]
+
+ addps m0, m0, m5
+
+ BUILDINVHIGHLOW m6, m1, m2
+ andps m6, m6, [ps_mask2]
+
+ addps m1, m1, m7
+
+ BUILDINVHIGHLOW m7, m2, m3
+ andps m7, m7, [ps_mask2]
+
+ addps m2, m2, m6
+
+ movhlps m6, m6, m3
+ andps m6, m6, [ps_mask4]
+
+ addps m3, m3, m7
+ addps m4, m4, m6
+
+ ; Populate tmp[]
+ movlhps m6, m1, m5 ; zero out high values
+ subps m6, m6, m4
+
+ subps m5, m0, m3
+
+%if ARCH_X86_64
+ SWAP m5, m8
+%endif
+
+ mulps m7, m2, [ps_val1]
+
+%if ARCH_X86_64
+ mulps m5, m8, [ps_val2]
+%else
+ mulps m5, m5, [ps_val2]
+%endif
+ addps m7, m7, m5
+
+ mulps m5, m6, [ps_val1]
+ subps m7, m7, m5
+
+%if ARCH_X86_64
+ SWAP m5, m8
+%else
+ subps m5, m0, m3
+%endif
+
+ subps m5, m5, m6
+ addps m5, m5, m2
+
+ shufps m6, m4, m3, 0xe4
+ subps m6, m6, m2
+ mulps m6, m6, [ps_val3]
+
+ addps m4, m4, m1
+ mulps m4, m4, [ps_val4]
+
+ shufps m1, m1, m0, 0xe4
+ addps m1, m1, m2
+ mulps m1, m1, [ps_val5]
+
+ mulps m3, m3, [ps_val6]
+ mulps m0, m0, [ps_val7]
+ addps m0, m0, m3
+
+ xorps m2, m1, [ps_p1p1m1m1]
+ subps m2, m2, m4
+ addps m2, m2, m0
+
+ addps m3, m4, m0
+ subps m3, m3, m6
+ xorps m3, m3, [ps_p1p1m1m1]
+
+ shufps m0, m0, m4, 0xe4
+ subps m0, m0, m1
+ addps m0, m0, m6
+
+ BUILDINVHIGHLOW m4, m2, m3
+ shufps m3, m3, m2, 0x4e
+
+ ; we have tmp = {SwAPLH(m0), SwAPLH(m7), m3, m4, m5}
+
+ BUTTERF m0, m1, 0
+ BUTTERF m7, m2, 16
+ BUTTERF m3, m6, 32
+ BUTTERF m4, m1, 48
+
+ mulps m5, m5, [ps_cosh + 64]
+ PSHUFD m1, m5, 0xe1
+ xorps m5, m5, [ps_p1m1p1m1]
+ addps m5, m5, m1
+
+ ; permutates:
+ ; m0 0 1 2 3 => 2 6 10 14 m1
+ ; m7 4 5 6 7 => 3 7 11 15 m2
+ ; m3 8 9 10 11 => 17 13 9 5 m3
+ ; m4 12 13 14 15 => 16 12 8 4 m5
+ ; m5 16 17 xx xx => 0 1 xx xx m0
+
+ unpckhps m1, m0, m7
+ unpckhps m6, m3, m4
+ movhlps m2, m6, m1
+ movlhps m1, m1, m6
+
+ unpcklps m5, m5, m4
+ unpcklps m3, m3, m7
+ movhlps m4, m3, m5
+ movlhps m5, m5, m3
+ SWAP m4, m3
+ ; permutation done
+
+ PSHUFD m6, m2, 0xb1
+ movss m4, [bufq + 4*68]
+ movss m7, [bufq + 4*64]
+ unpcklps m7, m7, m4
+ mulps m6, m6, [winq + 16*4]
+ addps m6, m6, m7
+ movss [outq + 64*SBLIMIT], m6
+ shufps m6, m6, m6, 0xb1
+ movss [outq + 68*SBLIMIT], m6
+
+ mulps m6, m3, [winq + 4*4]
+ LOAD m4, m7, bufq + 4*16, 16
+ addps m6, m6, m4
+ STORE m6, m7, outq + 16*SBLIMIT, 4*SBLIMIT
+
+ shufps m4, m0, m3, 0xb5
+ mulps m4, m4, [winq + 8*4]
+ LOAD m7, m6, bufq + 4*32, 16
+ addps m4, m4, m7
+ STORE m4, m6, outq + 32*SBLIMIT, 4*SBLIMIT
+
+ shufps m3, m3, m2, 0xb1
+ mulps m3, m3, [winq + 12*4]
+ LOAD m7, m6, bufq + 4*48, 16
+ addps m3, m3, m7
+ STORE m3, m7, outq + 48*SBLIMIT, 4*SBLIMIT
+
+ mulps m2, m2, [winq]
+ LOAD m6, m7, bufq, 16
+ addps m2, m2, m6
+ STORE m2, m7, outq, 4*SBLIMIT
+
+ mulps m4, m1, [winq + 20*4]
+ STORE m4, m7, bufq, 16
+
+ mulps m3, m5, [winq + 24*4]
+ STORE m3, m7, bufq + 4*16, 16
+
+ shufps m0, m0, m5, 0xb0
+ mulps m0, m0, [winq + 28*4]
+ STORE m0, m7, bufq + 4*32, 16
+
+ shufps m5, m5, m1, 0xb1
+ mulps m5, m5, [winq + 32*4]
+ STORE m5, m7, bufq + 4*48, 16
+
+ shufps m1, m1, m1, 0xb1
+ mulps m1, m1, [winq + 36*4]
+ movss [bufq + 4*64], m1
+ shufps m1, m1, 0xb1
+ movss [bufq + 4*68], m1
+ RET
+%endmacro
+
+INIT_XMM sse
+DEFINE_IMDCT
+
+INIT_XMM sse2
+DEFINE_IMDCT
+
+INIT_XMM sse3
+DEFINE_IMDCT
+
+INIT_XMM ssse3
+DEFINE_IMDCT
+
+INIT_XMM avx
+DEFINE_IMDCT
+
+INIT_XMM sse
+
+%if ARCH_X86_64
+%define SPILL SWAP
+%define UNSPILL SWAP
+%define SPILLED(x) m %+ x
+%else
+%define SPILLED(x) [tmpq+(x-8)*16 + 32*4]
+%macro SPILL 2 ; xmm#, mempos
+ movaps SPILLED(%2), m%1
+%endmacro
+%macro UNSPILL 2
+ movaps m%1, SPILLED(%2)
+%endmacro
+%endif
+
+%macro DEFINE_FOUR_IMDCT 0
+cglobal four_imdct36_float, 5,5,16, out, buf, in, win, tmp
+ movlps m0, [inq+64]
+ movhps m0, [inq+64 + 72]
+ movlps m3, [inq+64 + 2*72]
+ movhps m3, [inq+64 + 3*72]
+
+ shufps m5, m0, m3, 0xdd
+ shufps m0, m0, m3, 0x88
+
+ mova m1, [inq+48]
+ movu m6, [inq+48 + 72]
+ mova m7, [inq+48 + 2*72]
+ movu m3, [inq+48 + 3*72]
+
+ TRANSPOSE4x4PS 1, 6, 7, 3, 4
+
+ addps m4, m6, m7
+ mova [tmpq+4*28], m4
+
+ addps m7, m3
+ addps m6, m1
+ addps m3, m0
+ addps m0, m5
+ addps m0, m7
+ addps m7, m6
+ mova [tmpq+4*12], m7
+ SPILL 3, 12
+
+ mova m4, [inq+32]
+ movu m5, [inq+32 + 72]
+ mova m2, [inq+32 + 2*72]
+ movu m7, [inq+32 + 3*72]
+
+ TRANSPOSE4x4PS 4, 5, 2, 7, 3
+
+ addps m1, m7
+ SPILL 1, 11
+
+ addps m3, m5, m2
+ SPILL 3, 13
+
+ addps m7, m2
+ addps m5, m4
+ addps m6, m7
+ mova [tmpq], m6
+ addps m7, m5
+ mova [tmpq+4*16], m7
+
+ mova m2, [inq+16]
+ movu m7, [inq+16 + 72]
+ mova m1, [inq+16 + 2*72]
+ movu m6, [inq+16 + 3*72]
+
+ TRANSPOSE4x4PS 2, 7, 1, 6, 3
+
+ addps m4, m6
+ addps m6, m1
+ addps m1, m7
+ addps m7, m2
+ addps m5, m6
+ SPILL 5, 15
+ addps m6, m7
+ mulps m6, [costabs + 16*2]
+ mova [tmpq+4*8], m6
+ SPILL 1, 10
+ SPILL 0, 14
+
+ mova m1, [inq]
+ movu m6, [inq + 72]
+ mova m3, [inq + 2*72]
+ movu m5, [inq + 3*72]
+
+ TRANSPOSE4x4PS 1, 6, 3, 5, 0
+
+ addps m2, m5
+ addps m5, m3
+ addps m7, m5
+ addps m3, m6
+ addps m6, m1
+ SPILL 7, 8
+ addps m5, m6
+ SPILL 6, 9
+ addps m6, m4, SPILLED(12)
+ subps m6, m2
+ UNSPILL 7, 11
+ SPILL 5, 11
+ subps m5, m1, m7
+ mulps m7, [costabs + 16*5]
+ addps m7, m1
+ mulps m0, m6, [costabs + 16*6]
+ addps m0, m5
+ mova [tmpq+4*24], m0
+ addps m6, m5
+ mova [tmpq+4*4], m6
+ addps m6, m4, m2
+ mulps m6, [costabs + 16*1]
+ subps m4, SPILLED(12)
+ mulps m4, [costabs + 16*8]
+ addps m2, SPILLED(12)
+ mulps m2, [costabs + 16*3]
+ subps m5, m7, m6
+ subps m5, m2
+ addps m6, m7
+ addps m6, m4
+ addps m7, m2
+ subps m7, m4
+ mova [tmpq+4*20], m7
+ mova m2, [tmpq+4*28]
+ mova [tmpq+4*28], m5
+ UNSPILL 7, 13
+ subps m5, m7, m2
+ mulps m5, [costabs + 16*7]
+ UNSPILL 1, 10
+ mulps m1, [costabs + 16*2]
+ addps m4, m3, m2
+ mulps m4, [costabs + 16*4]
+ addps m2, m7
+ addps m7, m3
+ mulps m7, [costabs]
+ subps m3, m2
+ mulps m3, [costabs + 16*2]
+ addps m2, m7, m5
+ addps m2, m1
+ SPILL 2, 10
+ addps m7, m4
+ subps m7, m1
+ SPILL 7, 12
+ subps m5, m4
+ subps m5, m1
+ UNSPILL 0, 14
+ SPILL 5, 13
+ addps m1, m0, SPILLED(15)
+ subps m1, SPILLED(8)
+ mova m4, [costabs + 16*5]
+ mulps m4, [tmpq]
+ UNSPILL 2, 9
+ addps m4, m2
+ subps m2, [tmpq]
+ mulps m5, m1, [costabs + 16*6]
+ addps m5, m2
+ SPILL 5, 9
+ addps m2, m1
+ SPILL 2, 14
+ UNSPILL 5, 15
+ subps m7, m5, m0
+ addps m5, SPILLED(8)
+ mulps m5, [costabs + 16*1]
+ mulps m7, [costabs + 16*8]
+ addps m0, SPILLED(8)
+ mulps m0, [costabs + 16*3]
+ subps m2, m4, m5
+ subps m2, m0
+ SPILL 2, 15
+ addps m5, m4
+ addps m5, m7
+ addps m4, m0
+ subps m4, m7
+ SPILL 4, 8
+ mova m7, [tmpq+4*16]
+ mova m2, [tmpq+4*12]
+ addps m0, m7, m2
+ subps m0, SPILLED(11)
+ mulps m0, [costabs + 16*2]
+ addps m4, m7, SPILLED(11)
+ mulps m4, [costabs]
+ subps m7, m2
+ mulps m7, [costabs + 16*7]
+ addps m2, SPILLED(11)
+ mulps m2, [costabs + 16*4]
+ addps m1, m7, [tmpq+4*8]
+ addps m1, m4
+ addps m4, m2
+ subps m4, [tmpq+4*8]
+ SPILL 4, 11
+ subps m7, m2
+ subps m7, [tmpq+4*8]
+ addps m4, m6, SPILLED(10)
+ subps m6, SPILLED(10)
+ addps m2, m5, m1
+ mulps m2, [costabs + 16*9]
+ subps m5, m1
+ mulps m5, [costabs + 16*17]
+ subps m1, m4, m2
+ addps m4, m2
+ mulps m2, m1, [winq+4*36]
+ addps m2, [bufq+4*36]
+ mova [outq+1152], m2
+ mulps m1, [winq+4*32]
+ addps m1, [bufq+4*32]
+ mova [outq+1024], m1
+ mulps m1, m4, [winq+4*116]
+ mova [bufq+4*36], m1
+ mulps m4, [winq+4*112]
+ mova [bufq+4*32], m4
+ addps m2, m6, m5
+ subps m6, m5
+ mulps m1, m6, [winq+4*68]
+ addps m1, [bufq+4*68]
+ mova [outq+2176], m1
+ mulps m6, [winq]
+ addps m6, [bufq]
+ mova [outq], m6
+ mulps m1, m2, [winq+4*148]
+ mova [bufq+4*68], m1
+ mulps m2, [winq+4*80]
+ mova [bufq], m2
+ addps m5, m3, [tmpq+4*24]
+ mova m2, [tmpq+4*24]
+ subps m2, m3
+ mova m1, SPILLED(9)
+ subps m1, m0
+ mulps m1, [costabs + 16*10]
+ addps m0, SPILLED(9)
+ mulps m0, [costabs + 16*16]
+ addps m6, m5, m1
+ subps m5, m1
+ mulps m3, m5, [winq+4*40]
+ addps m3, [bufq+4*40]
+ mova [outq+1280], m3
+ mulps m5, [winq+4*28]
+ addps m5, [bufq+4*28]
+ mova [outq+896], m5
+ mulps m1, m6, [winq+4*120]
+ mova [bufq+4*40], m1
+ mulps m6, [winq+4*108]
+ mova [bufq+4*28], m6
+ addps m1, m2, m0
+ subps m2, m0
+ mulps m5, m2, [winq+4*64]
+ addps m5, [bufq+4*64]
+ mova [outq+2048], m5
+ mulps m2, [winq+4*4]
+ addps m2, [bufq+4*4]
+ mova [outq+128], m2
+ mulps m0, m1, [winq+4*144]
+ mova [bufq+4*64], m0
+ mulps m1, [winq+4*84]
+ mova [bufq+4*4], m1
+ mova m1, [tmpq+4*28]
+ mova m5, m1
+ addps m1, SPILLED(13)
+ subps m5, SPILLED(13)
+ UNSPILL 3, 15
+ addps m2, m7, m3
+ mulps m2, [costabs + 16*11]
+ subps m3, m7
+ mulps m3, [costabs + 16*15]
+ addps m0, m2, m1
+ subps m1, m2
+ SWAP m0, m2
+ mulps m6, m1, [winq+4*44]
+ addps m6, [bufq+4*44]
+ mova [outq+1408], m6
+ mulps m1, [winq+4*24]
+ addps m1, [bufq+4*24]
+ mova [outq+768], m1
+ mulps m0, m2, [winq+4*124]
+ mova [bufq+4*44], m0
+ mulps m2, [winq+4*104]
+ mova [bufq+4*24], m2
+ addps m0, m5, m3
+ subps m5, m3
+ mulps m1, m5, [winq+4*60]
+ addps m1, [bufq+4*60]
+ mova [outq+1920], m1
+ mulps m5, [winq+4*8]
+ addps m5, [bufq+4*8]
+ mova [outq+256], m5
+ mulps m1, m0, [winq+4*140]
+ mova [bufq+4*60], m1
+ mulps m0, [winq+4*88]
+ mova [bufq+4*8], m0
+ mova m1, [tmpq+4*20]
+ addps m1, SPILLED(12)
+ mova m2, [tmpq+4*20]
+ subps m2, SPILLED(12)
+ UNSPILL 7, 8
+ subps m0, m7, SPILLED(11)
+ addps m7, SPILLED(11)
+ mulps m4, m7, [costabs + 16*12]
+ mulps m0, [costabs + 16*14]
+ addps m5, m1, m4
+ subps m1, m4
+ mulps m7, m1, [winq+4*48]
+ addps m7, [bufq+4*48]
+ mova [outq+1536], m7
+ mulps m1, [winq+4*20]
+ addps m1, [bufq+4*20]
+ mova [outq+640], m1
+ mulps m1, m5, [winq+4*128]
+ mova [bufq+4*48], m1
+ mulps m5, [winq+4*100]
+ mova [bufq+4*20], m5
+ addps m6, m2, m0
+ subps m2, m0
+ mulps m1, m2, [winq+4*56]
+ addps m1, [bufq+4*56]
+ mova [outq+1792], m1
+ mulps m2, [winq+4*12]
+ addps m2, [bufq+4*12]
+ mova [outq+384], m2
+ mulps m0, m6, [winq+4*136]
+ mova [bufq+4*56], m0
+ mulps m6, [winq+4*92]
+ mova [bufq+4*12], m6
+ UNSPILL 0, 14
+ mulps m0, [costabs + 16*13]
+ mova m3, [tmpq+4*4]
+ addps m2, m0, m3
+ subps m3, m0
+ mulps m0, m3, [winq+4*52]
+ addps m0, [bufq+4*52]
+ mova [outq+1664], m0
+ mulps m3, [winq+4*16]
+ addps m3, [bufq+4*16]
+ mova [outq+512], m3
+ mulps m0, m2, [winq+4*132]
+ mova [bufq+4*52], m0
+ mulps m2, [winq+4*96]
+ mova [bufq+4*16], m2
+ RET
+%endmacro
+
+INIT_XMM sse
+DEFINE_FOUR_IMDCT
+
+INIT_XMM avx
+DEFINE_FOUR_IMDCT
diff --git a/gst-libs/ext/libav/libavcodec/x86/imdct36_sse.asm b/gst-libs/ext/libav/libavcodec/x86/imdct36_sse.asm
deleted file mode 100644
index 2908459..0000000
--- a/gst-libs/ext/libav/libavcodec/x86/imdct36_sse.asm
+++ /dev/null
@@ -1,721 +0,0 @@
-;******************************************************************************
-;* 36 point SSE-optimized IMDCT transform
-;* Copyright (c) 2011 Vitor Sessak
-;*
-;* 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
-;******************************************************************************
-
-%include "libavutil/x86/x86inc.asm"
-%include "libavutil/x86/x86util.asm"
-
-SECTION_RODATA
-
-align 16
-ps_mask: dd 0, ~0, ~0, ~0
-ps_mask2: dd 0, ~0, 0, ~0
-ps_mask3: dd 0, 0, 0, ~0
-ps_mask4: dd 0, ~0, 0, 0
-
-ps_val1: dd -0.5, -0.5, -0.8660254038, -0.8660254038
-ps_val2: dd 1.0, 1.0, 0.8660254038, 0.8660254038
-ps_val3: dd 0.1736481777, 0.1736481777, 0.3420201433, 0.3420201433
-ps_val4: dd -0.7660444431, -0.7660444431, 0.8660254038, 0.8660254038
-ps_val5: dd -0.9396926208, -0.9396926208, -0.9848077530, -0.9848077530
-ps_val6: dd 0.5, 0.5, -0.6427876097, -0.6427876097
-ps_val7: dd 1.0, 1.0, -0.6427876097, -0.6427876097
-
-ps_p1p1m1m1: dd 0, 0, 0x80000000, 0x80000000
-ps_p1m1p1m1: dd 0, 0x80000000, 0, 0x80000000
-
-ps_cosh: dd 1.0, 0.50190991877167369479, 1.0, 5.73685662283492756461
- dd 1.0, 0.51763809020504152469, 1.0, 1.93185165257813657349
- dd 1.0, 0.55168895948124587824, -1.0, -1.18310079157624925896
- dd 1.0, 0.61038729438072803416, -1.0, -0.87172339781054900991
- dd 1.0, 0.70710678118654752439, 0.0, 0.0
-
-ps_cosh_sse3: dd 1.0, -0.50190991877167369479, 1.0, -5.73685662283492756461
- dd 1.0, -0.51763809020504152469, 1.0, -1.93185165257813657349
- dd 1.0, -0.55168895948124587824, -1.0, 1.18310079157624925896
- dd 1.0, -0.61038729438072803416, -1.0, 0.87172339781054900991
- dd 1.0, 0.70710678118654752439, 0.0, 0.0
-
-costabs: times 4 dd 0.98480773
- times 4 dd 0.93969262
- times 4 dd 0.86602539
- times 4 dd -0.76604444
- times 4 dd -0.64278764
- times 4 dd 0.50000000
- times 4 dd -0.50000000
- times 4 dd -0.34202015
- times 4 dd -0.17364818
- times 4 dd 0.50190992
- times 4 dd 0.51763808
- times 4 dd 0.55168896
- times 4 dd 0.61038726
- times 4 dd 0.70710677
- times 4 dd 0.87172341
- times 4 dd 1.18310082
- times 4 dd 1.93185163
- times 4 dd 5.73685646
-
-%define SBLIMIT 32
-SECTION_TEXT
-
-%macro PSHUFD 3
-%if cpuflag(sse2) && notcpuflag(avx)
- pshufd %1, %2, %3
-%else
- shufps %1, %2, %2, %3
-%endif
-%endmacro
-
-; input %2={x1,x2,x3,x4}, %3={y1,y2,y3,y4}
-; output %1={x3,x4,y1,y2}
-%macro BUILDINVHIGHLOW 3
-%if cpuflag(avx)
- shufps %1, %2, %3, 0x4e
-%else
- movlhps %1, %3
- movhlps %1, %2
-%endif
-%endmacro
-
-; input %2={x1,x2,x3,x4}, %3={y1,y2,y3,y4}
-; output %1={x4,y1,y2,y3}
-%macro ROTLEFT 3
-%if cpuflag(ssse3)
- palignr %1, %3, %2, 12
-%else
- BUILDINVHIGHLOW %1, %2, %3
- shufps %1, %1, %3, 0x99
-%endif
-%endmacro
-
-%macro INVERTHL 2
-%if cpuflag(sse2)
- PSHUFD %1, %2, 0x4e
-%else
- movhlps %1, %2
- movlhps %1, %2
-%endif
-%endmacro
-
-%macro BUTTERF 3
- INVERTHL %2, %1
- xorps %1, [ps_p1p1m1m1]
- addps %1, %2
-%if cpuflag(sse3)
- mulps %1, %1, [ps_cosh_sse3 + %3]
- PSHUFD %2, %1, 0xb1
- addsubps %1, %1, %2
-%else
- mulps %1, [ps_cosh + %3]
- PSHUFD %2, %1, 0xb1
- xorps %1, [ps_p1m1p1m1]
- addps %1, %2
-%endif
-%endmacro
-
-%macro STORE 4
- movhlps %2, %1
- movss [%3 ], %1
- movss [%3 + 2*%4], %2
- shufps %1, %1, 0xb1
- movss [%3 + %4], %1
- movhlps %2, %1
- movss [%3 + 3*%4], %2
-%endmacro
-
-%macro LOAD 4
- movlps %1, [%3 ]
- movhps %1, [%3 + %4]
- movlps %2, [%3 + 2*%4]
- movhps %2, [%3 + 3*%4]
- shufps %1, %2, 0x88
-%endmacro
-
-%macro LOADA64 2
-%if cpuflag(avx)
- movu %1, [%2]
-%else
- movlps %1, [%2]
- movhps %1, [%2 + 8]
-%endif
-%endmacro
-
-%macro DEFINE_IMDCT 0
-cglobal imdct36_float, 4,4,9, out, buf, in, win
-
- ; for(i=17;i>=1;i--) in[i] += in[i-1];
- LOADA64 m0, inq
- LOADA64 m1, inq + 16
-
- ROTLEFT m5, m0, m1
-
- PSHUFD m6, m0, 0x93
- andps m6, m6, [ps_mask]
- addps m0, m0, m6
-
- LOADA64 m2, inq + 32
-
- ROTLEFT m7, m1, m2
-
- addps m1, m1, m5
- LOADA64 m3, inq + 48
-
- ROTLEFT m5, m2, m3
-
- xorps m4, m4, m4
- movlps m4, [inq+64]
- BUILDINVHIGHLOW m6, m3, m4
- shufps m6, m6, m4, 0xa9
-
- addps m4, m4, m6
- addps m2, m2, m7
- addps m3, m3, m5
-
- ; for(i=17;i>=3;i-=2) in[i] += in[i-2];
- movlhps m5, m5, m0
- andps m5, m5, [ps_mask3]
-
- BUILDINVHIGHLOW m7, m0, m1
- andps m7, m7, [ps_mask2]
-
- addps m0, m0, m5
-
- BUILDINVHIGHLOW m6, m1, m2
- andps m6, m6, [ps_mask2]
-
- addps m1, m1, m7
-
- BUILDINVHIGHLOW m7, m2, m3
- andps m7, m7, [ps_mask2]
-
- addps m2, m2, m6
-
- movhlps m6, m6, m3
- andps m6, m6, [ps_mask4]
-
- addps m3, m3, m7
- addps m4, m4, m6
-
- ; Populate tmp[]
- movlhps m6, m1, m5 ; zero out high values
- subps m6, m6, m4
-
- subps m5, m0, m3
-
-%ifdef ARCH_X86_64
- SWAP m5, m8
-%endif
-
- mulps m7, m2, [ps_val1]
-
-%ifdef ARCH_X86_64
- mulps m5, m8, [ps_val2]
-%else
- mulps m5, m5, [ps_val2]
-%endif
- addps m7, m7, m5
-
- mulps m5, m6, [ps_val1]
- subps m7, m7, m5
-
-%ifdef ARCH_X86_64
- SWAP m5, m8
-%else
- subps m5, m0, m3
-%endif
-
- subps m5, m5, m6
- addps m5, m5, m2
-
- shufps m6, m4, m3, 0xe4
- subps m6, m6, m2
- mulps m6, m6, [ps_val3]
-
- addps m4, m4, m1
- mulps m4, m4, [ps_val4]
-
- shufps m1, m1, m0, 0xe4
- addps m1, m1, m2
- mulps m1, m1, [ps_val5]
-
- mulps m3, m3, [ps_val6]
- mulps m0, m0, [ps_val7]
- addps m0, m0, m3
-
- xorps m2, m1, [ps_p1p1m1m1]
- subps m2, m2, m4
- addps m2, m2, m0
-
- addps m3, m4, m0
- subps m3, m3, m6
- xorps m3, m3, [ps_p1p1m1m1]
-
- shufps m0, m0, m4, 0xe4
- subps m0, m0, m1
- addps m0, m0, m6
-
- BUILDINVHIGHLOW m4, m2, m3
- shufps m3, m3, m2, 0x4e
-
- ; we have tmp = {SwAPLH(m0), SwAPLH(m7), m3, m4, m5}
-
- BUTTERF m0, m1, 0
- BUTTERF m7, m2, 16
- BUTTERF m3, m6, 32
- BUTTERF m4, m1, 48
-
- mulps m5, m5, [ps_cosh + 64]
- PSHUFD m1, m5, 0xe1
- xorps m5, m5, [ps_p1m1p1m1]
- addps m5, m5, m1
-
- ; permutates:
- ; m0 0 1 2 3 => 2 6 10 14 m1
- ; m7 4 5 6 7 => 3 7 11 15 m2
- ; m3 8 9 10 11 => 17 13 9 5 m3
- ; m4 12 13 14 15 => 16 12 8 4 m5
- ; m5 16 17 xx xx => 0 1 xx xx m0
-
- unpckhps m1, m0, m7
- unpckhps m6, m3, m4
- movhlps m2, m6, m1
- movlhps m1, m1, m6
-
- unpcklps m5, m5, m4
- unpcklps m3, m3, m7
- movhlps m4, m3, m5
- movlhps m5, m5, m3
- SWAP m4, m3
- ; permutation done
-
- PSHUFD m6, m2, 0xb1
- movss m4, [bufq + 4*68]
- movss m7, [bufq + 4*64]
- unpcklps m7, m7, m4
- mulps m6, m6, [winq + 16*4]
- addps m6, m6, m7
- movss [outq + 64*SBLIMIT], m6
- shufps m6, m6, m6, 0xb1
- movss [outq + 68*SBLIMIT], m6
-
- mulps m6, m3, [winq + 4*4]
- LOAD m4, m7, bufq + 4*16, 16
- addps m6, m6, m4
- STORE m6, m7, outq + 16*SBLIMIT, 4*SBLIMIT
-
- shufps m4, m0, m3, 0xb5
- mulps m4, m4, [winq + 8*4]
- LOAD m7, m6, bufq + 4*32, 16
- addps m4, m4, m7
- STORE m4, m6, outq + 32*SBLIMIT, 4*SBLIMIT
-
- shufps m3, m3, m2, 0xb1
- mulps m3, m3, [winq + 12*4]
- LOAD m7, m6, bufq + 4*48, 16
- addps m3, m3, m7
- STORE m3, m7, outq + 48*SBLIMIT, 4*SBLIMIT
-
- mulps m2, m2, [winq]
- LOAD m6, m7, bufq, 16
- addps m2, m2, m6
- STORE m2, m7, outq, 4*SBLIMIT
-
- mulps m4, m1, [winq + 20*4]
- STORE m4, m7, bufq, 16
-
- mulps m3, m5, [winq + 24*4]
- STORE m3, m7, bufq + 4*16, 16
-
- shufps m0, m0, m5, 0xb0
- mulps m0, m0, [winq + 28*4]
- STORE m0, m7, bufq + 4*32, 16
-
- shufps m5, m5, m1, 0xb1
- mulps m5, m5, [winq + 32*4]
- STORE m5, m7, bufq + 4*48, 16
-
- shufps m1, m1, m1, 0xb1
- mulps m1, m1, [winq + 36*4]
- movss [bufq + 4*64], m1
- shufps m1, m1, 0xb1
- movss [bufq + 4*68], m1
- RET
-%endmacro
-
-INIT_XMM sse
-DEFINE_IMDCT
-
-INIT_XMM sse2
-DEFINE_IMDCT
-
-INIT_XMM sse3
-DEFINE_IMDCT
-
-INIT_XMM ssse3
-DEFINE_IMDCT
-
-INIT_XMM avx
-DEFINE_IMDCT
-
-INIT_XMM sse
-
-%ifdef ARCH_X86_64
-%define SPILL SWAP
-%define UNSPILL SWAP
-%define SPILLED(x) m %+ x
-%else
-%define SPILLED(x) [tmpq+(x-8)*16 + 32*4]
-%macro SPILL 2 ; xmm#, mempos
- movaps SPILLED(%2), m%1
-%endmacro
-%macro UNSPILL 2
- movaps m%1, SPILLED(%2)
-%endmacro
-%endif
-
-%macro DEFINE_FOUR_IMDCT 0
-cglobal four_imdct36_float, 5,5,8, out, buf, in, win, tmp
- movlps m0, [inq+64]
- movhps m0, [inq+64 + 72]
- movlps m3, [inq+64 + 2*72]
- movhps m3, [inq+64 + 3*72]
-
- shufps m5, m0, m3, 0xdd
- shufps m0, m0, m3, 0x88
-
- mova m1, [inq+48]
- movu m6, [inq+48 + 72]
- mova m7, [inq+48 + 2*72]
- movu m3, [inq+48 + 3*72]
-
- TRANSPOSE4x4PS 1, 6, 7, 3, 4
-
- addps m4, m6, m7
- mova [tmpq+4*28], m4
-
- addps m7, m3
- addps m6, m1
- addps m3, m0
- addps m0, m5
- addps m0, m7
- addps m7, m6
- mova [tmpq+4*12], m7
- SPILL 3, 12
-
- mova m4, [inq+32]
- movu m5, [inq+32 + 72]
- mova m2, [inq+32 + 2*72]
- movu m7, [inq+32 + 3*72]
-
- TRANSPOSE4x4PS 4, 5, 2, 7, 3
-
- addps m1, m7
- SPILL 1, 11
-
- addps m3, m5, m2
- SPILL 3, 13
-
- addps m7, m2
- addps m5, m4
- addps m6, m7
- mova [tmpq], m6
- addps m7, m5
- mova [tmpq+4*16], m7
-
- mova m2, [inq+16]
- movu m7, [inq+16 + 72]
- mova m1, [inq+16 + 2*72]
- movu m6, [inq+16 + 3*72]
-
- TRANSPOSE4x4PS 2, 7, 1, 6, 3
-
- addps m4, m6
- addps m6, m1
- addps m1, m7
- addps m7, m2
- addps m5, m6
- SPILL 5, 15
- addps m6, m7
- mulps m6, [costabs + 16*2]
- mova [tmpq+4*8], m6
- SPILL 1, 10
- SPILL 0, 14
-
- mova m1, [inq]
- movu m6, [inq + 72]
- mova m3, [inq + 2*72]
- movu m5, [inq + 3*72]
-
- TRANSPOSE4x4PS 1, 6, 3, 5, 0
-
- addps m2, m5
- addps m5, m3
- addps m7, m5
- addps m3, m6
- addps m6, m1
- SPILL 7, 8
- addps m5, m6
- SPILL 6, 9
- addps m6, m4, SPILLED(12)
- subps m6, m2
- UNSPILL 7, 11
- SPILL 5, 11
- subps m5, m1, m7
- mulps m7, [costabs + 16*5]
- addps m7, m1
- mulps m0, m6, [costabs + 16*6]
- addps m0, m5
- mova [tmpq+4*24], m0
- addps m6, m5
- mova [tmpq+4*4], m6
- addps m6, m4, m2
- mulps m6, [costabs + 16*1]
- subps m4, SPILLED(12)
- mulps m4, [costabs + 16*8]
- addps m2, SPILLED(12)
- mulps m2, [costabs + 16*3]
- subps m5, m7, m6
- subps m5, m2
- addps m6, m7
- addps m6, m4
- addps m7, m2
- subps m7, m4
- mova [tmpq+4*20], m7
- mova m2, [tmpq+4*28]
- mova [tmpq+4*28], m5
- UNSPILL 7, 13
- subps m5, m7, m2
- mulps m5, [costabs + 16*7]
- UNSPILL 1, 10
- mulps m1, [costabs + 16*2]
- addps m4, m3, m2
- mulps m4, [costabs + 16*4]
- addps m2, m7
- addps m7, m3
- mulps m7, [costabs]
- subps m3, m2
- mulps m3, [costabs + 16*2]
- addps m2, m7, m5
- addps m2, m1
- SPILL 2, 10
- addps m7, m4
- subps m7, m1
- SPILL 7, 12
- subps m5, m4
- subps m5, m1
- UNSPILL 0, 14
- SPILL 5, 13
- addps m1, m0, SPILLED(15)
- subps m1, SPILLED(8)
- mova m4, [costabs + 16*5]
- mulps m4, [tmpq]
- UNSPILL 2, 9
- addps m4, m2
- subps m2, [tmpq]
- mulps m5, m1, [costabs + 16*6]
- addps m5, m2
- SPILL 5, 9
- addps m2, m1
- SPILL 2, 14
- UNSPILL 5, 15
- subps m7, m5, m0
- addps m5, SPILLED(8)
- mulps m5, [costabs + 16*1]
- mulps m7, [costabs + 16*8]
- addps m0, SPILLED(8)
- mulps m0, [costabs + 16*3]
- subps m2, m4, m5
- subps m2, m0
- SPILL 2, 15
- addps m5, m4
- addps m5, m7
- addps m4, m0
- subps m4, m7
- SPILL 4, 8
- mova m7, [tmpq+4*16]
- mova m2, [tmpq+4*12]
- addps m0, m7, m2
- subps m0, SPILLED(11)
- mulps m0, [costabs + 16*2]
- addps m4, m7, SPILLED(11)
- mulps m4, [costabs]
- subps m7, m2
- mulps m7, [costabs + 16*7]
- addps m2, SPILLED(11)
- mulps m2, [costabs + 16*4]
- addps m1, m7, [tmpq+4*8]
- addps m1, m4
- addps m4, m2
- subps m4, [tmpq+4*8]
- SPILL 4, 11
- subps m7, m2
- subps m7, [tmpq+4*8]
- addps m4, m6, SPILLED(10)
- subps m6, SPILLED(10)
- addps m2, m5, m1
- mulps m2, [costabs + 16*9]
- subps m5, m1
- mulps m5, [costabs + 16*17]
- subps m1, m4, m2
- addps m4, m2
- mulps m2, m1, [winq+4*36]
- addps m2, [bufq+4*36]
- mova [outq+1152], m2
- mulps m1, [winq+4*32]
- addps m1, [bufq+4*32]
- mova [outq+1024], m1
- mulps m1, m4, [winq+4*116]
- mova [bufq+4*36], m1
- mulps m4, [winq+4*112]
- mova [bufq+4*32], m4
- addps m2, m6, m5
- subps m6, m5
- mulps m1, m6, [winq+4*68]
- addps m1, [bufq+4*68]
- mova [outq+2176], m1
- mulps m6, [winq]
- addps m6, [bufq]
- mova [outq], m6
- mulps m1, m2, [winq+4*148]
- mova [bufq+4*68], m1
- mulps m2, [winq+4*80]
- mova [bufq], m2
- addps m5, m3, [tmpq+4*24]
- mova m2, [tmpq+4*24]
- subps m2, m3
- mova m1, SPILLED(9)
- subps m1, m0
- mulps m1, [costabs + 16*10]
- addps m0, SPILLED(9)
- mulps m0, [costabs + 16*16]
- addps m6, m5, m1
- subps m5, m1
- mulps m3, m5, [winq+4*40]
- addps m3, [bufq+4*40]
- mova [outq+1280], m3
- mulps m5, [winq+4*28]
- addps m5, [bufq+4*28]
- mova [outq+896], m5
- mulps m1, m6, [winq+4*120]
- mova [bufq+4*40], m1
- mulps m6, [winq+4*108]
- mova [bufq+4*28], m6
- addps m1, m2, m0
- subps m2, m0
- mulps m5, m2, [winq+4*64]
- addps m5, [bufq+4*64]
- mova [outq+2048], m5
- mulps m2, [winq+4*4]
- addps m2, [bufq+4*4]
- mova [outq+128], m2
- mulps m0, m1, [winq+4*144]
- mova [bufq+4*64], m0
- mulps m1, [winq+4*84]
- mova [bufq+4*4], m1
- mova m1, [tmpq+4*28]
- mova m5, m1
- addps m1, SPILLED(13)
- subps m5, SPILLED(13)
- UNSPILL 3, 15
- addps m2, m7, m3
- mulps m2, [costabs + 16*11]
- subps m3, m7
- mulps m3, [costabs + 16*15]
- addps m0, m2, m1
- subps m1, m2
- SWAP m0, m2
- mulps m6, m1, [winq+4*44]
- addps m6, [bufq+4*44]
- mova [outq+1408], m6
- mulps m1, [winq+4*24]
- addps m1, [bufq+4*24]
- mova [outq+768], m1
- mulps m0, m2, [winq+4*124]
- mova [bufq+4*44], m0
- mulps m2, [winq+4*104]
- mova [bufq+4*24], m2
- addps m0, m5, m3
- subps m5, m3
- mulps m1, m5, [winq+4*60]
- addps m1, [bufq+4*60]
- mova [outq+1920], m1
- mulps m5, [winq+4*8]
- addps m5, [bufq+4*8]
- mova [outq+256], m5
- mulps m1, m0, [winq+4*140]
- mova [bufq+4*60], m1
- mulps m0, [winq+4*88]
- mova [bufq+4*8], m0
- mova m1, [tmpq+4*20]
- addps m1, SPILLED(12)
- mova m2, [tmpq+4*20]
- subps m2, SPILLED(12)
- UNSPILL 7, 8
- subps m0, m7, SPILLED(11)
- addps m7, SPILLED(11)
- mulps m4, m7, [costabs + 16*12]
- mulps m0, [costabs + 16*14]
- addps m5, m1, m4
- subps m1, m4
- mulps m7, m1, [winq+4*48]
- addps m7, [bufq+4*48]
- mova [outq+1536], m7
- mulps m1, [winq+4*20]
- addps m1, [bufq+4*20]
- mova [outq+640], m1
- mulps m1, m5, [winq+4*128]
- mova [bufq+4*48], m1
- mulps m5, [winq+4*100]
- mova [bufq+4*20], m5
- addps m6, m2, m0
- subps m2, m0
- mulps m1, m2, [winq+4*56]
- addps m1, [bufq+4*56]
- mova [outq+1792], m1
- mulps m2, [winq+4*12]
- addps m2, [bufq+4*12]
- mova [outq+384], m2
- mulps m0, m6, [winq+4*136]
- mova [bufq+4*56], m0
- mulps m6, [winq+4*92]
- mova [bufq+4*12], m6
- UNSPILL 0, 14
- mulps m0, [costabs + 16*13]
- mova m3, [tmpq+4*4]
- addps m2, m0, m3
- subps m3, m0
- mulps m0, m3, [winq+4*52]
- addps m0, [bufq+4*52]
- mova [outq+1664], m0
- mulps m3, [winq+4*16]
- addps m3, [bufq+4*16]
- mova [outq+512], m3
- mulps m0, m2, [winq+4*132]
- mova [bufq+4*52], m0
- mulps m2, [winq+4*96]
- mova [bufq+4*16], m2
- RET
-%endmacro
-
-INIT_XMM sse
-DEFINE_FOUR_IMDCT
-
-INIT_XMM avx
-DEFINE_FOUR_IMDCT
diff --git a/gst-libs/ext/libav/libavcodec/x86/lpc.c b/gst-libs/ext/libav/libavcodec/x86/lpc.c
new file mode 100644
index 0000000..b8c77e2
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/x86/lpc.c
@@ -0,0 +1,154 @@
+/*
+ * MMX optimized LPC DSP utils
+ * Copyright (c) 2007 Loren Merritt
+ *
+ * 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
+ */
+
+#include "libavutil/x86/asm.h"
+#include "libavutil/cpu.h"
+#include "libavutil/internal.h"
+#include "libavcodec/lpc.h"
+
+#if HAVE_SSE2_INLINE
+
+static void lpc_apply_welch_window_sse2(const int32_t *data, int len,
+ double *w_data)
+{
+ double c = 2.0 / (len-1.0);
+ int n2 = len>>1;
+ x86_reg i = -n2*sizeof(int32_t);
+ x86_reg j = n2*sizeof(int32_t);
+ __asm__ volatile(
+ "movsd %4, %%xmm7 \n\t"
+ "movapd "MANGLE(ff_pd_1)", %%xmm6 \n\t"
+ "movapd "MANGLE(ff_pd_2)", %%xmm5 \n\t"
+ "movlhps %%xmm7, %%xmm7 \n\t"
+ "subpd %%xmm5, %%xmm7 \n\t"
+ "addsd %%xmm6, %%xmm7 \n\t"
+ "test $1, %5 \n\t"
+ "jz 2f \n\t"
+#define WELCH(MOVPD, offset)\
+ "1: \n\t"\
+ "movapd %%xmm7, %%xmm1 \n\t"\
+ "mulpd %%xmm1, %%xmm1 \n\t"\
+ "movapd %%xmm6, %%xmm0 \n\t"\
+ "subpd %%xmm1, %%xmm0 \n\t"\
+ "pshufd $0x4e, %%xmm0, %%xmm1 \n\t"\
+ "cvtpi2pd (%3,%0), %%xmm2 \n\t"\
+ "cvtpi2pd "#offset"*4(%3,%1), %%xmm3 \n\t"\
+ "mulpd %%xmm0, %%xmm2 \n\t"\
+ "mulpd %%xmm1, %%xmm3 \n\t"\
+ "movapd %%xmm2, (%2,%0,2) \n\t"\
+ MOVPD" %%xmm3, "#offset"*8(%2,%1,2) \n\t"\
+ "subpd %%xmm5, %%xmm7 \n\t"\
+ "sub $8, %1 \n\t"\
+ "add $8, %0 \n\t"\
+ "jl 1b \n\t"\
+
+ WELCH("movupd", -1)
+ "jmp 3f \n\t"
+ "2: \n\t"
+ WELCH("movapd", -2)
+ "3: \n\t"
+ :"+&r"(i), "+&r"(j)
+ :"r"(w_data+n2), "r"(data+n2), "m"(c), "r"(len)
+ XMM_CLOBBERS_ONLY("%xmm0", "%xmm1", "%xmm2", "%xmm3",
+ "%xmm5", "%xmm6", "%xmm7")
+ );
+#undef WELCH
+}
+
+static void lpc_compute_autocorr_sse2(const double *data, int len, int lag,
+ double *autoc)
+{
+ int j;
+
+ if((x86_reg)data & 15)
+ data++;
+
+ for(j=0; j<lag; j+=2){
+ x86_reg i = -len*sizeof(double);
+ if(j == lag-2) {
+ __asm__ volatile(
+ "movsd "MANGLE(ff_pd_1)", %%xmm0 \n\t"
+ "movsd "MANGLE(ff_pd_1)", %%xmm1 \n\t"
+ "movsd "MANGLE(ff_pd_1)", %%xmm2 \n\t"
+ "1: \n\t"
+ "movapd (%2,%0), %%xmm3 \n\t"
+ "movupd -8(%3,%0), %%xmm4 \n\t"
+ "movapd (%3,%0), %%xmm5 \n\t"
+ "mulpd %%xmm3, %%xmm4 \n\t"
+ "mulpd %%xmm3, %%xmm5 \n\t"
+ "mulpd -16(%3,%0), %%xmm3 \n\t"
+ "addpd %%xmm4, %%xmm1 \n\t"
+ "addpd %%xmm5, %%xmm0 \n\t"
+ "addpd %%xmm3, %%xmm2 \n\t"
+ "add $16, %0 \n\t"
+ "jl 1b \n\t"
+ "movhlps %%xmm0, %%xmm3 \n\t"
+ "movhlps %%xmm1, %%xmm4 \n\t"
+ "movhlps %%xmm2, %%xmm5 \n\t"
+ "addsd %%xmm3, %%xmm0 \n\t"
+ "addsd %%xmm4, %%xmm1 \n\t"
+ "addsd %%xmm5, %%xmm2 \n\t"
+ "movsd %%xmm0, (%1) \n\t"
+ "movsd %%xmm1, 8(%1) \n\t"
+ "movsd %%xmm2, 16(%1) \n\t"
+ :"+&r"(i)
+ :"r"(autoc+j), "r"(data+len), "r"(data+len-j)
+ :"memory"
+ );
+ } else {
+ __asm__ volatile(
+ "movsd "MANGLE(ff_pd_1)", %%xmm0 \n\t"
+ "movsd "MANGLE(ff_pd_1)", %%xmm1 \n\t"
+ "1: \n\t"
+ "movapd (%3,%0), %%xmm3 \n\t"
+ "movupd -8(%4,%0), %%xmm4 \n\t"
+ "mulpd %%xmm3, %%xmm4 \n\t"
+ "mulpd (%4,%0), %%xmm3 \n\t"
+ "addpd %%xmm4, %%xmm1 \n\t"
+ "addpd %%xmm3, %%xmm0 \n\t"
+ "add $16, %0 \n\t"
+ "jl 1b \n\t"
+ "movhlps %%xmm0, %%xmm3 \n\t"
+ "movhlps %%xmm1, %%xmm4 \n\t"
+ "addsd %%xmm3, %%xmm0 \n\t"
+ "addsd %%xmm4, %%xmm1 \n\t"
+ "movsd %%xmm0, %1 \n\t"
+ "movsd %%xmm1, %2 \n\t"
+ :"+&r"(i), "=m"(autoc[j]), "=m"(autoc[j+1])
+ :"r"(data+len), "r"(data+len-j)
+ );
+ }
+ }
+}
+
+#endif /* HAVE_SSE2_INLINE */
+
+av_cold void ff_lpc_init_x86(LPCContext *c)
+{
+#if HAVE_SSE2_INLINE
+ int mm_flags = av_get_cpu_flags();
+
+ if (mm_flags & (AV_CPU_FLAG_SSE2|AV_CPU_FLAG_SSE2SLOW)) {
+ c->lpc_apply_welch_window = lpc_apply_welch_window_sse2;
+ c->lpc_compute_autocorr = lpc_compute_autocorr_sse2;
+ }
+#endif /* HAVE_SSE2_INLINE */
+}
diff --git a/gst-libs/ext/libav/libavcodec/x86/lpc_mmx.c b/gst-libs/ext/libav/libavcodec/x86/lpc_mmx.c
deleted file mode 100644
index d41c19b..0000000
--- a/gst-libs/ext/libav/libavcodec/x86/lpc_mmx.c
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * MMX optimized LPC DSP utils
- * Copyright (c) 2007 Loren Merritt
- *
- * 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
- */
-
-#include "libavutil/x86_cpu.h"
-#include "libavutil/cpu.h"
-#include "libavcodec/lpc.h"
-
-static void lpc_apply_welch_window_sse2(const int32_t *data, int len,
- double *w_data)
-{
- double c = 2.0 / (len-1.0);
- int n2 = len>>1;
- x86_reg i = -n2*sizeof(int32_t);
- x86_reg j = n2*sizeof(int32_t);
- __asm__ volatile(
- "movsd %4, %%xmm7 \n\t"
- "movapd "MANGLE(ff_pd_1)", %%xmm6 \n\t"
- "movapd "MANGLE(ff_pd_2)", %%xmm5 \n\t"
- "movlhps %%xmm7, %%xmm7 \n\t"
- "subpd %%xmm5, %%xmm7 \n\t"
- "addsd %%xmm6, %%xmm7 \n\t"
- "test $1, %5 \n\t"
- "jz 2f \n\t"
-#define WELCH(MOVPD, offset)\
- "1: \n\t"\
- "movapd %%xmm7, %%xmm1 \n\t"\
- "mulpd %%xmm1, %%xmm1 \n\t"\
- "movapd %%xmm6, %%xmm0 \n\t"\
- "subpd %%xmm1, %%xmm0 \n\t"\
- "pshufd $0x4e, %%xmm0, %%xmm1 \n\t"\
- "cvtpi2pd (%3,%0), %%xmm2 \n\t"\
- "cvtpi2pd "#offset"*4(%3,%1), %%xmm3 \n\t"\
- "mulpd %%xmm0, %%xmm2 \n\t"\
- "mulpd %%xmm1, %%xmm3 \n\t"\
- "movapd %%xmm2, (%2,%0,2) \n\t"\
- MOVPD" %%xmm3, "#offset"*8(%2,%1,2) \n\t"\
- "subpd %%xmm5, %%xmm7 \n\t"\
- "sub $8, %1 \n\t"\
- "add $8, %0 \n\t"\
- "jl 1b \n\t"\
-
- WELCH("movupd", -1)
- "jmp 3f \n\t"
- "2: \n\t"
- WELCH("movapd", -2)
- "3: \n\t"
- :"+&r"(i), "+&r"(j)
- :"r"(w_data+n2), "r"(data+n2), "m"(c), "r"(len)
- XMM_CLOBBERS_ONLY("%xmm0", "%xmm1", "%xmm2", "%xmm3",
- "%xmm5", "%xmm6", "%xmm7")
- );
-#undef WELCH
-}
-
-static void lpc_compute_autocorr_sse2(const double *data, int len, int lag,
- double *autoc)
-{
- int j;
-
- if((x86_reg)data & 15)
- data++;
-
- for(j=0; j<lag; j+=2){
- x86_reg i = -len*sizeof(double);
- if(j == lag-2) {
- __asm__ volatile(
- "movsd "MANGLE(ff_pd_1)", %%xmm0 \n\t"
- "movsd "MANGLE(ff_pd_1)", %%xmm1 \n\t"
- "movsd "MANGLE(ff_pd_1)", %%xmm2 \n\t"
- "1: \n\t"
- "movapd (%2,%0), %%xmm3 \n\t"
- "movupd -8(%3,%0), %%xmm4 \n\t"
- "movapd (%3,%0), %%xmm5 \n\t"
- "mulpd %%xmm3, %%xmm4 \n\t"
- "mulpd %%xmm3, %%xmm5 \n\t"
- "mulpd -16(%3,%0), %%xmm3 \n\t"
- "addpd %%xmm4, %%xmm1 \n\t"
- "addpd %%xmm5, %%xmm0 \n\t"
- "addpd %%xmm3, %%xmm2 \n\t"
- "add $16, %0 \n\t"
- "jl 1b \n\t"
- "movhlps %%xmm0, %%xmm3 \n\t"
- "movhlps %%xmm1, %%xmm4 \n\t"
- "movhlps %%xmm2, %%xmm5 \n\t"
- "addsd %%xmm3, %%xmm0 \n\t"
- "addsd %%xmm4, %%xmm1 \n\t"
- "addsd %%xmm5, %%xmm2 \n\t"
- "movsd %%xmm0, (%1) \n\t"
- "movsd %%xmm1, 8(%1) \n\t"
- "movsd %%xmm2, 16(%1) \n\t"
- :"+&r"(i)
- :"r"(autoc+j), "r"(data+len), "r"(data+len-j)
- :"memory"
- );
- } else {
- __asm__ volatile(
- "movsd "MANGLE(ff_pd_1)", %%xmm0 \n\t"
- "movsd "MANGLE(ff_pd_1)", %%xmm1 \n\t"
- "1: \n\t"
- "movapd (%3,%0), %%xmm3 \n\t"
- "movupd -8(%4,%0), %%xmm4 \n\t"
- "mulpd %%xmm3, %%xmm4 \n\t"
- "mulpd (%4,%0), %%xmm3 \n\t"
- "addpd %%xmm4, %%xmm1 \n\t"
- "addpd %%xmm3, %%xmm0 \n\t"
- "add $16, %0 \n\t"
- "jl 1b \n\t"
- "movhlps %%xmm0, %%xmm3 \n\t"
- "movhlps %%xmm1, %%xmm4 \n\t"
- "addsd %%xmm3, %%xmm0 \n\t"
- "addsd %%xmm4, %%xmm1 \n\t"
- "movsd %%xmm0, %1 \n\t"
- "movsd %%xmm1, %2 \n\t"
- :"+&r"(i), "=m"(autoc[j]), "=m"(autoc[j+1])
- :"r"(data+len), "r"(data+len-j)
- );
- }
- }
-}
-
-av_cold void ff_lpc_init_x86(LPCContext *c)
-{
- int mm_flags = av_get_cpu_flags();
-
- if (mm_flags & (AV_CPU_FLAG_SSE2|AV_CPU_FLAG_SSE2SLOW)) {
- c->lpc_apply_welch_window = lpc_apply_welch_window_sse2;
- c->lpc_compute_autocorr = lpc_compute_autocorr_sse2;
- }
-}
diff --git a/gst-libs/ext/libav/libavcodec/x86/mathops.h b/gst-libs/ext/libav/libavcodec/x86/mathops.h
index 50b0283..cd408ac 100644
--- a/gst-libs/ext/libav/libavcodec/x86/mathops.h
+++ b/gst-libs/ext/libav/libavcodec/x86/mathops.h
@@ -25,6 +25,8 @@
#include "config.h"
#include "libavutil/common.h"
+#if HAVE_INLINE_ASM
+
#if ARCH_X86_32
#define MULL MULL
@@ -99,6 +101,12 @@ __asm__ volatile(\
);
#endif
+#define MASK_ABS(mask, level) \
+ __asm__ ("cltd \n\t" \
+ "xorl %1, %0 \n\t" \
+ "subl %1, %0 \n\t" \
+ : "+a"(level), "=&d"(mask))
+
// avoid +32 for shift optimization (gcc should do that ...)
#define NEG_SSR32 NEG_SSR32
static inline int32_t NEG_SSR32( int32_t a, int8_t s){
@@ -118,4 +126,5 @@ static inline uint32_t NEG_USR32(uint32_t a, int8_t s){
return a;
}
+#endif /* HAVE_INLINE_ASM */
#endif /* AVCODEC_X86_MATHOPS_H */
diff --git a/gst-libs/ext/libav/libavcodec/x86/mlpdsp.c b/gst-libs/ext/libav/libavcodec/x86/mlpdsp.c
index 400855d..a18e9fa 100644
--- a/gst-libs/ext/libav/libavcodec/x86/mlpdsp.c
+++ b/gst-libs/ext/libav/libavcodec/x86/mlpdsp.c
@@ -19,27 +19,28 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "libavutil/x86_cpu.h"
-#include "libavcodec/dsputil.h"
+#include "libavutil/internal.h"
+#include "libavutil/x86/asm.h"
+#include "libavcodec/mlpdsp.h"
#include "libavcodec/mlp.h"
-#if HAVE_7REGS
+#if HAVE_7REGS && HAVE_INLINE_ASM
-extern void ff_mlp_firorder_8;
-extern void ff_mlp_firorder_7;
-extern void ff_mlp_firorder_6;
-extern void ff_mlp_firorder_5;
-extern void ff_mlp_firorder_4;
-extern void ff_mlp_firorder_3;
-extern void ff_mlp_firorder_2;
-extern void ff_mlp_firorder_1;
-extern void ff_mlp_firorder_0;
+extern char ff_mlp_firorder_8;
+extern char ff_mlp_firorder_7;
+extern char ff_mlp_firorder_6;
+extern char ff_mlp_firorder_5;
+extern char ff_mlp_firorder_4;
+extern char ff_mlp_firorder_3;
+extern char ff_mlp_firorder_2;
+extern char ff_mlp_firorder_1;
+extern char ff_mlp_firorder_0;
-extern void ff_mlp_iirorder_4;
-extern void ff_mlp_iirorder_3;
-extern void ff_mlp_iirorder_2;
-extern void ff_mlp_iirorder_1;
-extern void ff_mlp_iirorder_0;
+extern char ff_mlp_iirorder_4;
+extern char ff_mlp_iirorder_3;
+extern char ff_mlp_iirorder_2;
+extern char ff_mlp_iirorder_1;
+extern char ff_mlp_iirorder_0;
static const void *firtable[9] = { &ff_mlp_firorder_0, &ff_mlp_firorder_1,
&ff_mlp_firorder_2, &ff_mlp_firorder_3,
@@ -171,11 +172,11 @@ static void mlp_filter_channel_x86(int32_t *state, const int32_t *coeff,
);
}
-#endif /* HAVE_7REGS */
+#endif /* HAVE_7REGS && HAVE_INLINE_ASM */
-void ff_mlp_init_x86(DSPContext* c, AVCodecContext *avctx)
+void ff_mlpdsp_init_x86(MLPDSPContext *c)
{
-#if HAVE_7REGS
+#if HAVE_7REGS && HAVE_INLINE_ASM
c->mlp_filter_channel = mlp_filter_channel_x86;
#endif
}
diff --git a/gst-libs/ext/libav/libavcodec/x86/motion_est.c b/gst-libs/ext/libav/libavcodec/x86/motion_est.c
new file mode 100644
index 0000000..0a0cab9
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/x86/motion_est.c
@@ -0,0 +1,473 @@
+/*
+ * MMX optimized motion estimation
+ * Copyright (c) 2001 Fabrice Bellard
+ * Copyright (c) 2002-2004 Michael Niedermayer
+ *
+ * mostly by Michael Niedermayer <michaelni@gmx.at>
+ *
+ * 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
+ */
+
+#include "libavutil/internal.h"
+#include "libavutil/mem.h"
+#include "libavutil/x86/asm.h"
+#include "libavcodec/dsputil.h"
+#include "dsputil_mmx.h"
+
+#if HAVE_INLINE_ASM
+
+DECLARE_ASM_CONST(8, uint64_t, round_tab)[3]={
+0x0000000000000000ULL,
+0x0001000100010001ULL,
+0x0002000200020002ULL,
+};
+
+DECLARE_ASM_CONST(8, uint64_t, bone)= 0x0101010101010101LL;
+
+static inline void sad8_1_mmx(uint8_t *blk1, uint8_t *blk2, int stride, int h)
+{
+ x86_reg len= -(stride*h);
+ __asm__ volatile(
+ ".p2align 4 \n\t"
+ "1: \n\t"
+ "movq (%1, %%"REG_a"), %%mm0 \n\t"
+ "movq (%2, %%"REG_a"), %%mm2 \n\t"
+ "movq (%2, %%"REG_a"), %%mm4 \n\t"
+ "add %3, %%"REG_a" \n\t"
+ "psubusb %%mm0, %%mm2 \n\t"
+ "psubusb %%mm4, %%mm0 \n\t"
+ "movq (%1, %%"REG_a"), %%mm1 \n\t"
+ "movq (%2, %%"REG_a"), %%mm3 \n\t"
+ "movq (%2, %%"REG_a"), %%mm5 \n\t"
+ "psubusb %%mm1, %%mm3 \n\t"
+ "psubusb %%mm5, %%mm1 \n\t"
+ "por %%mm2, %%mm0 \n\t"
+ "por %%mm1, %%mm3 \n\t"
+ "movq %%mm0, %%mm1 \n\t"
+ "movq %%mm3, %%mm2 \n\t"
+ "punpcklbw %%mm7, %%mm0 \n\t"
+ "punpckhbw %%mm7, %%mm1 \n\t"
+ "punpcklbw %%mm7, %%mm3 \n\t"
+ "punpckhbw %%mm7, %%mm2 \n\t"
+ "paddw %%mm1, %%mm0 \n\t"
+ "paddw %%mm3, %%mm2 \n\t"
+ "paddw %%mm2, %%mm0 \n\t"
+ "paddw %%mm0, %%mm6 \n\t"
+ "add %3, %%"REG_a" \n\t"
+ " js 1b \n\t"
+ : "+a" (len)
+ : "r" (blk1 - len), "r" (blk2 - len), "r" ((x86_reg)stride)
+ );
+}
+
+static inline void sad8_1_mmxext(uint8_t *blk1, uint8_t *blk2,
+ int stride, int h)
+{
+ __asm__ volatile(
+ ".p2align 4 \n\t"
+ "1: \n\t"
+ "movq (%1), %%mm0 \n\t"
+ "movq (%1, %3), %%mm1 \n\t"
+ "psadbw (%2), %%mm0 \n\t"
+ "psadbw (%2, %3), %%mm1 \n\t"
+ "paddw %%mm0, %%mm6 \n\t"
+ "paddw %%mm1, %%mm6 \n\t"
+ "lea (%1,%3,2), %1 \n\t"
+ "lea (%2,%3,2), %2 \n\t"
+ "sub $2, %0 \n\t"
+ " jg 1b \n\t"
+ : "+r" (h), "+r" (blk1), "+r" (blk2)
+ : "r" ((x86_reg)stride)
+ );
+}
+
+static int sad16_sse2(void *v, uint8_t *blk2, uint8_t *blk1, int stride, int h)
+{
+ int ret;
+ __asm__ volatile(
+ "pxor %%xmm2, %%xmm2 \n\t"
+ ".p2align 4 \n\t"
+ "1: \n\t"
+ "movdqu (%1), %%xmm0 \n\t"
+ "movdqu (%1, %4), %%xmm1 \n\t"
+ "psadbw (%2), %%xmm0 \n\t"
+ "psadbw (%2, %4), %%xmm1 \n\t"
+ "paddw %%xmm0, %%xmm2 \n\t"
+ "paddw %%xmm1, %%xmm2 \n\t"
+ "lea (%1,%4,2), %1 \n\t"
+ "lea (%2,%4,2), %2 \n\t"
+ "sub $2, %0 \n\t"
+ " jg 1b \n\t"
+ "movhlps %%xmm2, %%xmm0 \n\t"
+ "paddw %%xmm0, %%xmm2 \n\t"
+ "movd %%xmm2, %3 \n\t"
+ : "+r" (h), "+r" (blk1), "+r" (blk2), "=r"(ret)
+ : "r" ((x86_reg)stride)
+ );
+ return ret;
+}
+
+static inline void sad8_x2a_mmxext(uint8_t *blk1, uint8_t *blk2,
+ int stride, int h)
+{
+ __asm__ volatile(
+ ".p2align 4 \n\t"
+ "1: \n\t"
+ "movq (%1), %%mm0 \n\t"
+ "movq (%1, %3), %%mm1 \n\t"
+ "pavgb 1(%1), %%mm0 \n\t"
+ "pavgb 1(%1, %3), %%mm1 \n\t"
+ "psadbw (%2), %%mm0 \n\t"
+ "psadbw (%2, %3), %%mm1 \n\t"
+ "paddw %%mm0, %%mm6 \n\t"
+ "paddw %%mm1, %%mm6 \n\t"
+ "lea (%1,%3,2), %1 \n\t"
+ "lea (%2,%3,2), %2 \n\t"
+ "sub $2, %0 \n\t"
+ " jg 1b \n\t"
+ : "+r" (h), "+r" (blk1), "+r" (blk2)
+ : "r" ((x86_reg)stride)
+ );
+}
+
+static inline void sad8_y2a_mmxext(uint8_t *blk1, uint8_t *blk2,
+ int stride, int h)
+{
+ __asm__ volatile(
+ "movq (%1), %%mm0 \n\t"
+ "add %3, %1 \n\t"
+ ".p2align 4 \n\t"
+ "1: \n\t"
+ "movq (%1), %%mm1 \n\t"
+ "movq (%1, %3), %%mm2 \n\t"
+ "pavgb %%mm1, %%mm0 \n\t"
+ "pavgb %%mm2, %%mm1 \n\t"
+ "psadbw (%2), %%mm0 \n\t"
+ "psadbw (%2, %3), %%mm1 \n\t"
+ "paddw %%mm0, %%mm6 \n\t"
+ "paddw %%mm1, %%mm6 \n\t"
+ "movq %%mm2, %%mm0 \n\t"
+ "lea (%1,%3,2), %1 \n\t"
+ "lea (%2,%3,2), %2 \n\t"
+ "sub $2, %0 \n\t"
+ " jg 1b \n\t"
+ : "+r" (h), "+r" (blk1), "+r" (blk2)
+ : "r" ((x86_reg)stride)
+ );
+}
+
+static inline void sad8_4_mmxext(uint8_t *blk1, uint8_t *blk2,
+ int stride, int h)
+{
+ __asm__ volatile(
+ "movq "MANGLE(bone)", %%mm5 \n\t"
+ "movq (%1), %%mm0 \n\t"
+ "pavgb 1(%1), %%mm0 \n\t"
+ "add %3, %1 \n\t"
+ ".p2align 4 \n\t"
+ "1: \n\t"
+ "movq (%1), %%mm1 \n\t"
+ "movq (%1,%3), %%mm2 \n\t"
+ "pavgb 1(%1), %%mm1 \n\t"
+ "pavgb 1(%1,%3), %%mm2 \n\t"
+ "psubusb %%mm5, %%mm1 \n\t"
+ "pavgb %%mm1, %%mm0 \n\t"
+ "pavgb %%mm2, %%mm1 \n\t"
+ "psadbw (%2), %%mm0 \n\t"
+ "psadbw (%2,%3), %%mm1 \n\t"
+ "paddw %%mm0, %%mm6 \n\t"
+ "paddw %%mm1, %%mm6 \n\t"
+ "movq %%mm2, %%mm0 \n\t"
+ "lea (%1,%3,2), %1 \n\t"
+ "lea (%2,%3,2), %2 \n\t"
+ "sub $2, %0 \n\t"
+ " jg 1b \n\t"
+ : "+r" (h), "+r" (blk1), "+r" (blk2)
+ : "r" ((x86_reg)stride)
+ );
+}
+
+static inline void sad8_2_mmx(uint8_t *blk1a, uint8_t *blk1b, uint8_t *blk2, int stride, int h)
+{
+ x86_reg len= -(stride*h);
+ __asm__ volatile(
+ ".p2align 4 \n\t"
+ "1: \n\t"
+ "movq (%1, %%"REG_a"), %%mm0 \n\t"
+ "movq (%2, %%"REG_a"), %%mm1 \n\t"
+ "movq (%1, %%"REG_a"), %%mm2 \n\t"
+ "movq (%2, %%"REG_a"), %%mm3 \n\t"
+ "punpcklbw %%mm7, %%mm0 \n\t"
+ "punpcklbw %%mm7, %%mm1 \n\t"
+ "punpckhbw %%mm7, %%mm2 \n\t"
+ "punpckhbw %%mm7, %%mm3 \n\t"
+ "paddw %%mm0, %%mm1 \n\t"
+ "paddw %%mm2, %%mm3 \n\t"
+ "movq (%3, %%"REG_a"), %%mm4 \n\t"
+ "movq (%3, %%"REG_a"), %%mm2 \n\t"
+ "paddw %%mm5, %%mm1 \n\t"
+ "paddw %%mm5, %%mm3 \n\t"
+ "psrlw $1, %%mm1 \n\t"
+ "psrlw $1, %%mm3 \n\t"
+ "packuswb %%mm3, %%mm1 \n\t"
+ "psubusb %%mm1, %%mm4 \n\t"
+ "psubusb %%mm2, %%mm1 \n\t"
+ "por %%mm4, %%mm1 \n\t"
+ "movq %%mm1, %%mm0 \n\t"
+ "punpcklbw %%mm7, %%mm0 \n\t"
+ "punpckhbw %%mm7, %%mm1 \n\t"
+ "paddw %%mm1, %%mm0 \n\t"
+ "paddw %%mm0, %%mm6 \n\t"
+ "add %4, %%"REG_a" \n\t"
+ " js 1b \n\t"
+ : "+a" (len)
+ : "r" (blk1a - len), "r" (blk1b -len), "r" (blk2 - len), "r" ((x86_reg)stride)
+ );
+}
+
+static inline void sad8_4_mmx(uint8_t *blk1, uint8_t *blk2, int stride, int h)
+{
+ x86_reg len= -(stride*h);
+ __asm__ volatile(
+ "movq (%1, %%"REG_a"), %%mm0 \n\t"
+ "movq 1(%1, %%"REG_a"), %%mm2 \n\t"
+ "movq %%mm0, %%mm1 \n\t"
+ "movq %%mm2, %%mm3 \n\t"
+ "punpcklbw %%mm7, %%mm0 \n\t"
+ "punpckhbw %%mm7, %%mm1 \n\t"
+ "punpcklbw %%mm7, %%mm2 \n\t"
+ "punpckhbw %%mm7, %%mm3 \n\t"
+ "paddw %%mm2, %%mm0 \n\t"
+ "paddw %%mm3, %%mm1 \n\t"
+ ".p2align 4 \n\t"
+ "1: \n\t"
+ "movq (%2, %%"REG_a"), %%mm2 \n\t"
+ "movq 1(%2, %%"REG_a"), %%mm4 \n\t"
+ "movq %%mm2, %%mm3 \n\t"
+ "movq %%mm4, %%mm5 \n\t"
+ "punpcklbw %%mm7, %%mm2 \n\t"
+ "punpckhbw %%mm7, %%mm3 \n\t"
+ "punpcklbw %%mm7, %%mm4 \n\t"
+ "punpckhbw %%mm7, %%mm5 \n\t"
+ "paddw %%mm4, %%mm2 \n\t"
+ "paddw %%mm5, %%mm3 \n\t"
+ "movq 16+"MANGLE(round_tab)", %%mm5 \n\t"
+ "paddw %%mm2, %%mm0 \n\t"
+ "paddw %%mm3, %%mm1 \n\t"
+ "paddw %%mm5, %%mm0 \n\t"
+ "paddw %%mm5, %%mm1 \n\t"
+ "movq (%3, %%"REG_a"), %%mm4 \n\t"
+ "movq (%3, %%"REG_a"), %%mm5 \n\t"
+ "psrlw $2, %%mm0 \n\t"
+ "psrlw $2, %%mm1 \n\t"
+ "packuswb %%mm1, %%mm0 \n\t"
+ "psubusb %%mm0, %%mm4 \n\t"
+ "psubusb %%mm5, %%mm0 \n\t"
+ "por %%mm4, %%mm0 \n\t"
+ "movq %%mm0, %%mm4 \n\t"
+ "punpcklbw %%mm7, %%mm0 \n\t"
+ "punpckhbw %%mm7, %%mm4 \n\t"
+ "paddw %%mm0, %%mm6 \n\t"
+ "paddw %%mm4, %%mm6 \n\t"
+ "movq %%mm2, %%mm0 \n\t"
+ "movq %%mm3, %%mm1 \n\t"
+ "add %4, %%"REG_a" \n\t"
+ " js 1b \n\t"
+ : "+a" (len)
+ : "r" (blk1 - len), "r" (blk1 -len + stride), "r" (blk2 - len), "r" ((x86_reg)stride)
+ );
+}
+
+static inline int sum_mmx(void)
+{
+ int ret;
+ __asm__ volatile(
+ "movq %%mm6, %%mm0 \n\t"
+ "psrlq $32, %%mm6 \n\t"
+ "paddw %%mm0, %%mm6 \n\t"
+ "movq %%mm6, %%mm0 \n\t"
+ "psrlq $16, %%mm6 \n\t"
+ "paddw %%mm0, %%mm6 \n\t"
+ "movd %%mm6, %0 \n\t"
+ : "=r" (ret)
+ );
+ return ret&0xFFFF;
+}
+
+static inline int sum_mmxext(void)
+{
+ int ret;
+ __asm__ volatile(
+ "movd %%mm6, %0 \n\t"
+ : "=r" (ret)
+ );
+ return ret;
+}
+
+static inline void sad8_x2a_mmx(uint8_t *blk1, uint8_t *blk2, int stride, int h)
+{
+ sad8_2_mmx(blk1, blk1+1, blk2, stride, h);
+}
+static inline void sad8_y2a_mmx(uint8_t *blk1, uint8_t *blk2, int stride, int h)
+{
+ sad8_2_mmx(blk1, blk1+stride, blk2, stride, h);
+}
+
+
+#define PIX_SAD(suf)\
+static int sad8_ ## suf(void *v, uint8_t *blk2, uint8_t *blk1, int stride, int h)\
+{\
+ assert(h==8);\
+ __asm__ volatile("pxor %%mm7, %%mm7 \n\t"\
+ "pxor %%mm6, %%mm6 \n\t":);\
+\
+ sad8_1_ ## suf(blk1, blk2, stride, 8);\
+\
+ return sum_ ## suf();\
+}\
+static int sad8_x2_ ## suf(void *v, uint8_t *blk2, uint8_t *blk1, int stride, int h)\
+{\
+ assert(h==8);\
+ __asm__ volatile("pxor %%mm7, %%mm7 \n\t"\
+ "pxor %%mm6, %%mm6 \n\t"\
+ "movq %0, %%mm5 \n\t"\
+ :: "m"(round_tab[1]) \
+ );\
+\
+ sad8_x2a_ ## suf(blk1, blk2, stride, 8);\
+\
+ return sum_ ## suf();\
+}\
+\
+static int sad8_y2_ ## suf(void *v, uint8_t *blk2, uint8_t *blk1, int stride, int h)\
+{\
+ assert(h==8);\
+ __asm__ volatile("pxor %%mm7, %%mm7 \n\t"\
+ "pxor %%mm6, %%mm6 \n\t"\
+ "movq %0, %%mm5 \n\t"\
+ :: "m"(round_tab[1]) \
+ );\
+\
+ sad8_y2a_ ## suf(blk1, blk2, stride, 8);\
+\
+ return sum_ ## suf();\
+}\
+\
+static int sad8_xy2_ ## suf(void *v, uint8_t *blk2, uint8_t *blk1, int stride, int h)\
+{\
+ assert(h==8);\
+ __asm__ volatile("pxor %%mm7, %%mm7 \n\t"\
+ "pxor %%mm6, %%mm6 \n\t"\
+ ::);\
+\
+ sad8_4_ ## suf(blk1, blk2, stride, 8);\
+\
+ return sum_ ## suf();\
+}\
+\
+static int sad16_ ## suf(void *v, uint8_t *blk2, uint8_t *blk1, int stride, int h)\
+{\
+ __asm__ volatile("pxor %%mm7, %%mm7 \n\t"\
+ "pxor %%mm6, %%mm6 \n\t":);\
+\
+ sad8_1_ ## suf(blk1 , blk2 , stride, h);\
+ sad8_1_ ## suf(blk1+8, blk2+8, stride, h);\
+\
+ return sum_ ## suf();\
+}\
+static int sad16_x2_ ## suf(void *v, uint8_t *blk2, uint8_t *blk1, int stride, int h)\
+{\
+ __asm__ volatile("pxor %%mm7, %%mm7 \n\t"\
+ "pxor %%mm6, %%mm6 \n\t"\
+ "movq %0, %%mm5 \n\t"\
+ :: "m"(round_tab[1]) \
+ );\
+\
+ sad8_x2a_ ## suf(blk1 , blk2 , stride, h);\
+ sad8_x2a_ ## suf(blk1+8, blk2+8, stride, h);\
+\
+ return sum_ ## suf();\
+}\
+static int sad16_y2_ ## suf(void *v, uint8_t *blk2, uint8_t *blk1, int stride, int h)\
+{\
+ __asm__ volatile("pxor %%mm7, %%mm7 \n\t"\
+ "pxor %%mm6, %%mm6 \n\t"\
+ "movq %0, %%mm5 \n\t"\
+ :: "m"(round_tab[1]) \
+ );\
+\
+ sad8_y2a_ ## suf(blk1 , blk2 , stride, h);\
+ sad8_y2a_ ## suf(blk1+8, blk2+8, stride, h);\
+\
+ return sum_ ## suf();\
+}\
+static int sad16_xy2_ ## suf(void *v, uint8_t *blk2, uint8_t *blk1, int stride, int h)\
+{\
+ __asm__ volatile("pxor %%mm7, %%mm7 \n\t"\
+ "pxor %%mm6, %%mm6 \n\t"\
+ ::);\
+\
+ sad8_4_ ## suf(blk1 , blk2 , stride, h);\
+ sad8_4_ ## suf(blk1+8, blk2+8, stride, h);\
+\
+ return sum_ ## suf();\
+}\
+
+PIX_SAD(mmx)
+PIX_SAD(mmxext)
+
+#endif /* HAVE_INLINE_ASM */
+
+void ff_dsputil_init_pix_mmx(DSPContext* c, AVCodecContext *avctx)
+{
+#if HAVE_INLINE_ASM
+ int mm_flags = av_get_cpu_flags();
+
+ if (mm_flags & AV_CPU_FLAG_MMX) {
+ c->pix_abs[0][0] = sad16_mmx;
+ c->pix_abs[0][1] = sad16_x2_mmx;
+ c->pix_abs[0][2] = sad16_y2_mmx;
+ c->pix_abs[0][3] = sad16_xy2_mmx;
+ c->pix_abs[1][0] = sad8_mmx;
+ c->pix_abs[1][1] = sad8_x2_mmx;
+ c->pix_abs[1][2] = sad8_y2_mmx;
+ c->pix_abs[1][3] = sad8_xy2_mmx;
+
+ c->sad[0]= sad16_mmx;
+ c->sad[1]= sad8_mmx;
+ }
+ if (mm_flags & AV_CPU_FLAG_MMXEXT) {
+ c->pix_abs[0][0] = sad16_mmxext;
+ c->pix_abs[1][0] = sad8_mmxext;
+
+ c->sad[0] = sad16_mmxext;
+ c->sad[1] = sad8_mmxext;
+
+ if(!(avctx->flags & CODEC_FLAG_BITEXACT)){
+ c->pix_abs[0][1] = sad16_x2_mmxext;
+ c->pix_abs[0][2] = sad16_y2_mmxext;
+ c->pix_abs[0][3] = sad16_xy2_mmxext;
+ c->pix_abs[1][1] = sad8_x2_mmxext;
+ c->pix_abs[1][2] = sad8_y2_mmxext;
+ c->pix_abs[1][3] = sad8_xy2_mmxext;
+ }
+ }
+ if ((mm_flags & AV_CPU_FLAG_SSE2) && !(mm_flags & AV_CPU_FLAG_3DNOW) && avctx->codec_id != AV_CODEC_ID_SNOW) {
+ c->sad[0]= sad16_sse2;
+ }
+#endif /* HAVE_INLINE_ASM */
+}
diff --git a/gst-libs/ext/libav/libavcodec/x86/motion_est_mmx.c b/gst-libs/ext/libav/libavcodec/x86/motion_est_mmx.c
deleted file mode 100644
index 948af98..0000000
--- a/gst-libs/ext/libav/libavcodec/x86/motion_est_mmx.c
+++ /dev/null
@@ -1,461 +0,0 @@
-/*
- * MMX optimized motion estimation
- * Copyright (c) 2001 Fabrice Bellard
- * Copyright (c) 2002-2004 Michael Niedermayer
- *
- * mostly by Michael Niedermayer <michaelni@gmx.at>
- *
- * 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
- */
-
-#include "libavutil/x86_cpu.h"
-#include "libavcodec/dsputil.h"
-#include "dsputil_mmx.h"
-
-DECLARE_ASM_CONST(8, uint64_t, round_tab)[3]={
-0x0000000000000000ULL,
-0x0001000100010001ULL,
-0x0002000200020002ULL,
-};
-
-DECLARE_ASM_CONST(8, uint64_t, bone)= 0x0101010101010101LL;
-
-static inline void sad8_1_mmx(uint8_t *blk1, uint8_t *blk2, int stride, int h)
-{
- x86_reg len= -(stride*h);
- __asm__ volatile(
- ".p2align 4 \n\t"
- "1: \n\t"
- "movq (%1, %%"REG_a"), %%mm0 \n\t"
- "movq (%2, %%"REG_a"), %%mm2 \n\t"
- "movq (%2, %%"REG_a"), %%mm4 \n\t"
- "add %3, %%"REG_a" \n\t"
- "psubusb %%mm0, %%mm2 \n\t"
- "psubusb %%mm4, %%mm0 \n\t"
- "movq (%1, %%"REG_a"), %%mm1 \n\t"
- "movq (%2, %%"REG_a"), %%mm3 \n\t"
- "movq (%2, %%"REG_a"), %%mm5 \n\t"
- "psubusb %%mm1, %%mm3 \n\t"
- "psubusb %%mm5, %%mm1 \n\t"
- "por %%mm2, %%mm0 \n\t"
- "por %%mm1, %%mm3 \n\t"
- "movq %%mm0, %%mm1 \n\t"
- "movq %%mm3, %%mm2 \n\t"
- "punpcklbw %%mm7, %%mm0 \n\t"
- "punpckhbw %%mm7, %%mm1 \n\t"
- "punpcklbw %%mm7, %%mm3 \n\t"
- "punpckhbw %%mm7, %%mm2 \n\t"
- "paddw %%mm1, %%mm0 \n\t"
- "paddw %%mm3, %%mm2 \n\t"
- "paddw %%mm2, %%mm0 \n\t"
- "paddw %%mm0, %%mm6 \n\t"
- "add %3, %%"REG_a" \n\t"
- " js 1b \n\t"
- : "+a" (len)
- : "r" (blk1 - len), "r" (blk2 - len), "r" ((x86_reg)stride)
- );
-}
-
-static inline void sad8_1_mmx2(uint8_t *blk1, uint8_t *blk2, int stride, int h)
-{
- __asm__ volatile(
- ".p2align 4 \n\t"
- "1: \n\t"
- "movq (%1), %%mm0 \n\t"
- "movq (%1, %3), %%mm1 \n\t"
- "psadbw (%2), %%mm0 \n\t"
- "psadbw (%2, %3), %%mm1 \n\t"
- "paddw %%mm0, %%mm6 \n\t"
- "paddw %%mm1, %%mm6 \n\t"
- "lea (%1,%3,2), %1 \n\t"
- "lea (%2,%3,2), %2 \n\t"
- "sub $2, %0 \n\t"
- " jg 1b \n\t"
- : "+r" (h), "+r" (blk1), "+r" (blk2)
- : "r" ((x86_reg)stride)
- );
-}
-
-static int sad16_sse2(void *v, uint8_t *blk2, uint8_t *blk1, int stride, int h)
-{
- int ret;
- __asm__ volatile(
- "pxor %%xmm2, %%xmm2 \n\t"
- ".p2align 4 \n\t"
- "1: \n\t"
- "movdqu (%1), %%xmm0 \n\t"
- "movdqu (%1, %4), %%xmm1 \n\t"
- "psadbw (%2), %%xmm0 \n\t"
- "psadbw (%2, %4), %%xmm1 \n\t"
- "paddw %%xmm0, %%xmm2 \n\t"
- "paddw %%xmm1, %%xmm2 \n\t"
- "lea (%1,%4,2), %1 \n\t"
- "lea (%2,%4,2), %2 \n\t"
- "sub $2, %0 \n\t"
- " jg 1b \n\t"
- "movhlps %%xmm2, %%xmm0 \n\t"
- "paddw %%xmm0, %%xmm2 \n\t"
- "movd %%xmm2, %3 \n\t"
- : "+r" (h), "+r" (blk1), "+r" (blk2), "=r"(ret)
- : "r" ((x86_reg)stride)
- );
- return ret;
-}
-
-static inline void sad8_x2a_mmx2(uint8_t *blk1, uint8_t *blk2, int stride, int h)
-{
- __asm__ volatile(
- ".p2align 4 \n\t"
- "1: \n\t"
- "movq (%1), %%mm0 \n\t"
- "movq (%1, %3), %%mm1 \n\t"
- "pavgb 1(%1), %%mm0 \n\t"
- "pavgb 1(%1, %3), %%mm1 \n\t"
- "psadbw (%2), %%mm0 \n\t"
- "psadbw (%2, %3), %%mm1 \n\t"
- "paddw %%mm0, %%mm6 \n\t"
- "paddw %%mm1, %%mm6 \n\t"
- "lea (%1,%3,2), %1 \n\t"
- "lea (%2,%3,2), %2 \n\t"
- "sub $2, %0 \n\t"
- " jg 1b \n\t"
- : "+r" (h), "+r" (blk1), "+r" (blk2)
- : "r" ((x86_reg)stride)
- );
-}
-
-static inline void sad8_y2a_mmx2(uint8_t *blk1, uint8_t *blk2, int stride, int h)
-{
- __asm__ volatile(
- "movq (%1), %%mm0 \n\t"
- "add %3, %1 \n\t"
- ".p2align 4 \n\t"
- "1: \n\t"
- "movq (%1), %%mm1 \n\t"
- "movq (%1, %3), %%mm2 \n\t"
- "pavgb %%mm1, %%mm0 \n\t"
- "pavgb %%mm2, %%mm1 \n\t"
- "psadbw (%2), %%mm0 \n\t"
- "psadbw (%2, %3), %%mm1 \n\t"
- "paddw %%mm0, %%mm6 \n\t"
- "paddw %%mm1, %%mm6 \n\t"
- "movq %%mm2, %%mm0 \n\t"
- "lea (%1,%3,2), %1 \n\t"
- "lea (%2,%3,2), %2 \n\t"
- "sub $2, %0 \n\t"
- " jg 1b \n\t"
- : "+r" (h), "+r" (blk1), "+r" (blk2)
- : "r" ((x86_reg)stride)
- );
-}
-
-static inline void sad8_4_mmx2(uint8_t *blk1, uint8_t *blk2, int stride, int h)
-{
- __asm__ volatile(
- "movq "MANGLE(bone)", %%mm5 \n\t"
- "movq (%1), %%mm0 \n\t"
- "pavgb 1(%1), %%mm0 \n\t"
- "add %3, %1 \n\t"
- ".p2align 4 \n\t"
- "1: \n\t"
- "movq (%1), %%mm1 \n\t"
- "movq (%1,%3), %%mm2 \n\t"
- "pavgb 1(%1), %%mm1 \n\t"
- "pavgb 1(%1,%3), %%mm2 \n\t"
- "psubusb %%mm5, %%mm1 \n\t"
- "pavgb %%mm1, %%mm0 \n\t"
- "pavgb %%mm2, %%mm1 \n\t"
- "psadbw (%2), %%mm0 \n\t"
- "psadbw (%2,%3), %%mm1 \n\t"
- "paddw %%mm0, %%mm6 \n\t"
- "paddw %%mm1, %%mm6 \n\t"
- "movq %%mm2, %%mm0 \n\t"
- "lea (%1,%3,2), %1 \n\t"
- "lea (%2,%3,2), %2 \n\t"
- "sub $2, %0 \n\t"
- " jg 1b \n\t"
- : "+r" (h), "+r" (blk1), "+r" (blk2)
- : "r" ((x86_reg)stride)
- );
-}
-
-static inline void sad8_2_mmx(uint8_t *blk1a, uint8_t *blk1b, uint8_t *blk2, int stride, int h)
-{
- x86_reg len= -(stride*h);
- __asm__ volatile(
- ".p2align 4 \n\t"
- "1: \n\t"
- "movq (%1, %%"REG_a"), %%mm0 \n\t"
- "movq (%2, %%"REG_a"), %%mm1 \n\t"
- "movq (%1, %%"REG_a"), %%mm2 \n\t"
- "movq (%2, %%"REG_a"), %%mm3 \n\t"
- "punpcklbw %%mm7, %%mm0 \n\t"
- "punpcklbw %%mm7, %%mm1 \n\t"
- "punpckhbw %%mm7, %%mm2 \n\t"
- "punpckhbw %%mm7, %%mm3 \n\t"
- "paddw %%mm0, %%mm1 \n\t"
- "paddw %%mm2, %%mm3 \n\t"
- "movq (%3, %%"REG_a"), %%mm4 \n\t"
- "movq (%3, %%"REG_a"), %%mm2 \n\t"
- "paddw %%mm5, %%mm1 \n\t"
- "paddw %%mm5, %%mm3 \n\t"
- "psrlw $1, %%mm1 \n\t"
- "psrlw $1, %%mm3 \n\t"
- "packuswb %%mm3, %%mm1 \n\t"
- "psubusb %%mm1, %%mm4 \n\t"
- "psubusb %%mm2, %%mm1 \n\t"
- "por %%mm4, %%mm1 \n\t"
- "movq %%mm1, %%mm0 \n\t"
- "punpcklbw %%mm7, %%mm0 \n\t"
- "punpckhbw %%mm7, %%mm1 \n\t"
- "paddw %%mm1, %%mm0 \n\t"
- "paddw %%mm0, %%mm6 \n\t"
- "add %4, %%"REG_a" \n\t"
- " js 1b \n\t"
- : "+a" (len)
- : "r" (blk1a - len), "r" (blk1b -len), "r" (blk2 - len), "r" ((x86_reg)stride)
- );
-}
-
-static inline void sad8_4_mmx(uint8_t *blk1, uint8_t *blk2, int stride, int h)
-{
- x86_reg len= -(stride*h);
- __asm__ volatile(
- "movq (%1, %%"REG_a"), %%mm0 \n\t"
- "movq 1(%1, %%"REG_a"), %%mm2 \n\t"
- "movq %%mm0, %%mm1 \n\t"
- "movq %%mm2, %%mm3 \n\t"
- "punpcklbw %%mm7, %%mm0 \n\t"
- "punpckhbw %%mm7, %%mm1 \n\t"
- "punpcklbw %%mm7, %%mm2 \n\t"
- "punpckhbw %%mm7, %%mm3 \n\t"
- "paddw %%mm2, %%mm0 \n\t"
- "paddw %%mm3, %%mm1 \n\t"
- ".p2align 4 \n\t"
- "1: \n\t"
- "movq (%2, %%"REG_a"), %%mm2 \n\t"
- "movq 1(%2, %%"REG_a"), %%mm4 \n\t"
- "movq %%mm2, %%mm3 \n\t"
- "movq %%mm4, %%mm5 \n\t"
- "punpcklbw %%mm7, %%mm2 \n\t"
- "punpckhbw %%mm7, %%mm3 \n\t"
- "punpcklbw %%mm7, %%mm4 \n\t"
- "punpckhbw %%mm7, %%mm5 \n\t"
- "paddw %%mm4, %%mm2 \n\t"
- "paddw %%mm5, %%mm3 \n\t"
- "movq 16+"MANGLE(round_tab)", %%mm5 \n\t"
- "paddw %%mm2, %%mm0 \n\t"
- "paddw %%mm3, %%mm1 \n\t"
- "paddw %%mm5, %%mm0 \n\t"
- "paddw %%mm5, %%mm1 \n\t"
- "movq (%3, %%"REG_a"), %%mm4 \n\t"
- "movq (%3, %%"REG_a"), %%mm5 \n\t"
- "psrlw $2, %%mm0 \n\t"
- "psrlw $2, %%mm1 \n\t"
- "packuswb %%mm1, %%mm0 \n\t"
- "psubusb %%mm0, %%mm4 \n\t"
- "psubusb %%mm5, %%mm0 \n\t"
- "por %%mm4, %%mm0 \n\t"
- "movq %%mm0, %%mm4 \n\t"
- "punpcklbw %%mm7, %%mm0 \n\t"
- "punpckhbw %%mm7, %%mm4 \n\t"
- "paddw %%mm0, %%mm6 \n\t"
- "paddw %%mm4, %%mm6 \n\t"
- "movq %%mm2, %%mm0 \n\t"
- "movq %%mm3, %%mm1 \n\t"
- "add %4, %%"REG_a" \n\t"
- " js 1b \n\t"
- : "+a" (len)
- : "r" (blk1 - len), "r" (blk1 -len + stride), "r" (blk2 - len), "r" ((x86_reg)stride)
- );
-}
-
-static inline int sum_mmx(void)
-{
- int ret;
- __asm__ volatile(
- "movq %%mm6, %%mm0 \n\t"
- "psrlq $32, %%mm6 \n\t"
- "paddw %%mm0, %%mm6 \n\t"
- "movq %%mm6, %%mm0 \n\t"
- "psrlq $16, %%mm6 \n\t"
- "paddw %%mm0, %%mm6 \n\t"
- "movd %%mm6, %0 \n\t"
- : "=r" (ret)
- );
- return ret&0xFFFF;
-}
-
-static inline int sum_mmx2(void)
-{
- int ret;
- __asm__ volatile(
- "movd %%mm6, %0 \n\t"
- : "=r" (ret)
- );
- return ret;
-}
-
-static inline void sad8_x2a_mmx(uint8_t *blk1, uint8_t *blk2, int stride, int h)
-{
- sad8_2_mmx(blk1, blk1+1, blk2, stride, h);
-}
-static inline void sad8_y2a_mmx(uint8_t *blk1, uint8_t *blk2, int stride, int h)
-{
- sad8_2_mmx(blk1, blk1+stride, blk2, stride, h);
-}
-
-
-#define PIX_SAD(suf)\
-static int sad8_ ## suf(void *v, uint8_t *blk2, uint8_t *blk1, int stride, int h)\
-{\
- assert(h==8);\
- __asm__ volatile("pxor %%mm7, %%mm7 \n\t"\
- "pxor %%mm6, %%mm6 \n\t":);\
-\
- sad8_1_ ## suf(blk1, blk2, stride, 8);\
-\
- return sum_ ## suf();\
-}\
-static int sad8_x2_ ## suf(void *v, uint8_t *blk2, uint8_t *blk1, int stride, int h)\
-{\
- assert(h==8);\
- __asm__ volatile("pxor %%mm7, %%mm7 \n\t"\
- "pxor %%mm6, %%mm6 \n\t"\
- "movq %0, %%mm5 \n\t"\
- :: "m"(round_tab[1]) \
- );\
-\
- sad8_x2a_ ## suf(blk1, blk2, stride, 8);\
-\
- return sum_ ## suf();\
-}\
-\
-static int sad8_y2_ ## suf(void *v, uint8_t *blk2, uint8_t *blk1, int stride, int h)\
-{\
- assert(h==8);\
- __asm__ volatile("pxor %%mm7, %%mm7 \n\t"\
- "pxor %%mm6, %%mm6 \n\t"\
- "movq %0, %%mm5 \n\t"\
- :: "m"(round_tab[1]) \
- );\
-\
- sad8_y2a_ ## suf(blk1, blk2, stride, 8);\
-\
- return sum_ ## suf();\
-}\
-\
-static int sad8_xy2_ ## suf(void *v, uint8_t *blk2, uint8_t *blk1, int stride, int h)\
-{\
- assert(h==8);\
- __asm__ volatile("pxor %%mm7, %%mm7 \n\t"\
- "pxor %%mm6, %%mm6 \n\t"\
- ::);\
-\
- sad8_4_ ## suf(blk1, blk2, stride, 8);\
-\
- return sum_ ## suf();\
-}\
-\
-static int sad16_ ## suf(void *v, uint8_t *blk2, uint8_t *blk1, int stride, int h)\
-{\
- __asm__ volatile("pxor %%mm7, %%mm7 \n\t"\
- "pxor %%mm6, %%mm6 \n\t":);\
-\
- sad8_1_ ## suf(blk1 , blk2 , stride, h);\
- sad8_1_ ## suf(blk1+8, blk2+8, stride, h);\
-\
- return sum_ ## suf();\
-}\
-static int sad16_x2_ ## suf(void *v, uint8_t *blk2, uint8_t *blk1, int stride, int h)\
-{\
- __asm__ volatile("pxor %%mm7, %%mm7 \n\t"\
- "pxor %%mm6, %%mm6 \n\t"\
- "movq %0, %%mm5 \n\t"\
- :: "m"(round_tab[1]) \
- );\
-\
- sad8_x2a_ ## suf(blk1 , blk2 , stride, h);\
- sad8_x2a_ ## suf(blk1+8, blk2+8, stride, h);\
-\
- return sum_ ## suf();\
-}\
-static int sad16_y2_ ## suf(void *v, uint8_t *blk2, uint8_t *blk1, int stride, int h)\
-{\
- __asm__ volatile("pxor %%mm7, %%mm7 \n\t"\
- "pxor %%mm6, %%mm6 \n\t"\
- "movq %0, %%mm5 \n\t"\
- :: "m"(round_tab[1]) \
- );\
-\
- sad8_y2a_ ## suf(blk1 , blk2 , stride, h);\
- sad8_y2a_ ## suf(blk1+8, blk2+8, stride, h);\
-\
- return sum_ ## suf();\
-}\
-static int sad16_xy2_ ## suf(void *v, uint8_t *blk2, uint8_t *blk1, int stride, int h)\
-{\
- __asm__ volatile("pxor %%mm7, %%mm7 \n\t"\
- "pxor %%mm6, %%mm6 \n\t"\
- ::);\
-\
- sad8_4_ ## suf(blk1 , blk2 , stride, h);\
- sad8_4_ ## suf(blk1+8, blk2+8, stride, h);\
-\
- return sum_ ## suf();\
-}\
-
-PIX_SAD(mmx)
-PIX_SAD(mmx2)
-
-void dsputil_init_pix_mmx(DSPContext* c, AVCodecContext *avctx)
-{
- int mm_flags = av_get_cpu_flags();
-
- if (mm_flags & AV_CPU_FLAG_MMX) {
- c->pix_abs[0][0] = sad16_mmx;
- c->pix_abs[0][1] = sad16_x2_mmx;
- c->pix_abs[0][2] = sad16_y2_mmx;
- c->pix_abs[0][3] = sad16_xy2_mmx;
- c->pix_abs[1][0] = sad8_mmx;
- c->pix_abs[1][1] = sad8_x2_mmx;
- c->pix_abs[1][2] = sad8_y2_mmx;
- c->pix_abs[1][3] = sad8_xy2_mmx;
-
- c->sad[0]= sad16_mmx;
- c->sad[1]= sad8_mmx;
- }
- if (mm_flags & AV_CPU_FLAG_MMX2) {
- c->pix_abs[0][0] = sad16_mmx2;
- c->pix_abs[1][0] = sad8_mmx2;
-
- c->sad[0]= sad16_mmx2;
- c->sad[1]= sad8_mmx2;
-
- if(!(avctx->flags & CODEC_FLAG_BITEXACT)){
- c->pix_abs[0][1] = sad16_x2_mmx2;
- c->pix_abs[0][2] = sad16_y2_mmx2;
- c->pix_abs[0][3] = sad16_xy2_mmx2;
- c->pix_abs[1][1] = sad8_x2_mmx2;
- c->pix_abs[1][2] = sad8_y2_mmx2;
- c->pix_abs[1][3] = sad8_xy2_mmx2;
- }
- }
- if ((mm_flags & AV_CPU_FLAG_SSE2) && !(mm_flags & AV_CPU_FLAG_3DNOW) && avctx->codec_id != CODEC_ID_SNOW) {
- c->sad[0]= sad16_sse2;
- }
-}
diff --git a/gst-libs/ext/libav/libavcodec/x86/mpegaudiodec.c b/gst-libs/ext/libav/libavcodec/x86/mpegaudiodec.c
new file mode 100644
index 0000000..c914fe1
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/x86/mpegaudiodec.c
@@ -0,0 +1,263 @@
+/*
+ * MMX optimized MP3 decoding functions
+ * Copyright (c) 2010 Vitor Sessak
+ *
+ * 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
+ */
+
+#include "libavutil/cpu.h"
+#include "libavutil/x86/asm.h"
+#include "libavutil/x86/cpu.h"
+#include "libavcodec/dsputil.h"
+#include "libavcodec/mpegaudiodsp.h"
+
+void ff_imdct36_float_sse(float *out, float *buf, float *in, float *win);
+void ff_imdct36_float_sse2(float *out, float *buf, float *in, float *win);
+void ff_imdct36_float_sse3(float *out, float *buf, float *in, float *win);
+void ff_imdct36_float_ssse3(float *out, float *buf, float *in, float *win);
+void ff_imdct36_float_avx(float *out, float *buf, float *in, float *win);
+void ff_four_imdct36_float_sse(float *out, float *buf, float *in, float *win,
+ float *tmpbuf);
+void ff_four_imdct36_float_avx(float *out, float *buf, float *in, float *win,
+ float *tmpbuf);
+
+DECLARE_ALIGNED(16, static float, mdct_win_sse)[2][4][4*40];
+
+#if HAVE_SSE2_INLINE
+
+#define MACS(rt, ra, rb) rt+=(ra)*(rb)
+#define MLSS(rt, ra, rb) rt-=(ra)*(rb)
+
+#define SUM8(op, sum, w, p) \
+{ \
+ op(sum, (w)[0 * 64], (p)[0 * 64]); \
+ op(sum, (w)[1 * 64], (p)[1 * 64]); \
+ op(sum, (w)[2 * 64], (p)[2 * 64]); \
+ op(sum, (w)[3 * 64], (p)[3 * 64]); \
+ op(sum, (w)[4 * 64], (p)[4 * 64]); \
+ op(sum, (w)[5 * 64], (p)[5 * 64]); \
+ op(sum, (w)[6 * 64], (p)[6 * 64]); \
+ op(sum, (w)[7 * 64], (p)[7 * 64]); \
+}
+
+static void apply_window(const float *buf, const float *win1,
+ const float *win2, float *sum1, float *sum2, int len)
+{
+ x86_reg count = - 4*len;
+ const float *win1a = win1+len;
+ const float *win2a = win2+len;
+ const float *bufa = buf+len;
+ float *sum1a = sum1+len;
+ float *sum2a = sum2+len;
+
+
+#define MULT(a, b) \
+ "movaps " #a "(%1,%0), %%xmm1 \n\t" \
+ "movaps " #a "(%3,%0), %%xmm2 \n\t" \
+ "mulps %%xmm2, %%xmm1 \n\t" \
+ "subps %%xmm1, %%xmm0 \n\t" \
+ "mulps " #b "(%2,%0), %%xmm2 \n\t" \
+ "subps %%xmm2, %%xmm4 \n\t" \
+
+ __asm__ volatile(
+ "1: \n\t"
+ "xorps %%xmm0, %%xmm0 \n\t"
+ "xorps %%xmm4, %%xmm4 \n\t"
+
+ MULT( 0, 0)
+ MULT( 256, 64)
+ MULT( 512, 128)
+ MULT( 768, 192)
+ MULT(1024, 256)
+ MULT(1280, 320)
+ MULT(1536, 384)
+ MULT(1792, 448)
+
+ "movaps %%xmm0, (%4,%0) \n\t"
+ "movaps %%xmm4, (%5,%0) \n\t"
+ "add $16, %0 \n\t"
+ "jl 1b \n\t"
+ :"+&r"(count)
+ :"r"(win1a), "r"(win2a), "r"(bufa), "r"(sum1a), "r"(sum2a)
+ );
+
+#undef MULT
+}
+
+static void apply_window_mp3(float *in, float *win, int *unused, float *out,
+ int incr)
+{
+ LOCAL_ALIGNED_16(float, suma, [17]);
+ LOCAL_ALIGNED_16(float, sumb, [17]);
+ LOCAL_ALIGNED_16(float, sumc, [17]);
+ LOCAL_ALIGNED_16(float, sumd, [17]);
+
+ float sum;
+
+ /* copy to avoid wrap */
+ __asm__ volatile(
+ "movaps 0(%0), %%xmm0 \n\t" \
+ "movaps 16(%0), %%xmm1 \n\t" \
+ "movaps 32(%0), %%xmm2 \n\t" \
+ "movaps 48(%0), %%xmm3 \n\t" \
+ "movaps %%xmm0, 0(%1) \n\t" \
+ "movaps %%xmm1, 16(%1) \n\t" \
+ "movaps %%xmm2, 32(%1) \n\t" \
+ "movaps %%xmm3, 48(%1) \n\t" \
+ "movaps 64(%0), %%xmm0 \n\t" \
+ "movaps 80(%0), %%xmm1 \n\t" \
+ "movaps 96(%0), %%xmm2 \n\t" \
+ "movaps 112(%0), %%xmm3 \n\t" \
+ "movaps %%xmm0, 64(%1) \n\t" \
+ "movaps %%xmm1, 80(%1) \n\t" \
+ "movaps %%xmm2, 96(%1) \n\t" \
+ "movaps %%xmm3, 112(%1) \n\t"
+ ::"r"(in), "r"(in+512)
+ :"memory"
+ );
+
+ apply_window(in + 16, win , win + 512, suma, sumc, 16);
+ apply_window(in + 32, win + 48, win + 640, sumb, sumd, 16);
+
+ SUM8(MACS, suma[0], win + 32, in + 48);
+
+ sumc[ 0] = 0;
+ sumb[16] = 0;
+ sumd[16] = 0;
+
+#define SUMS(suma, sumb, sumc, sumd, out1, out2) \
+ "movups " #sumd "(%4), %%xmm0 \n\t" \
+ "shufps $0x1b, %%xmm0, %%xmm0 \n\t" \
+ "subps " #suma "(%1), %%xmm0 \n\t" \
+ "movaps %%xmm0," #out1 "(%0) \n\t" \
+\
+ "movups " #sumc "(%3), %%xmm0 \n\t" \
+ "shufps $0x1b, %%xmm0, %%xmm0 \n\t" \
+ "addps " #sumb "(%2), %%xmm0 \n\t" \
+ "movaps %%xmm0," #out2 "(%0) \n\t"
+
+ if (incr == 1) {
+ __asm__ volatile(
+ SUMS( 0, 48, 4, 52, 0, 112)
+ SUMS(16, 32, 20, 36, 16, 96)
+ SUMS(32, 16, 36, 20, 32, 80)
+ SUMS(48, 0, 52, 4, 48, 64)
+
+ :"+&r"(out)
+ :"r"(&suma[0]), "r"(&sumb[0]), "r"(&sumc[0]), "r"(&sumd[0])
+ :"memory"
+ );
+ out += 16*incr;
+ } else {
+ int j;
+ float *out2 = out + 32 * incr;
+ out[0 ] = -suma[ 0];
+ out += incr;
+ out2 -= incr;
+ for(j=1;j<16;j++) {
+ *out = -suma[ j] + sumd[16-j];
+ *out2 = sumb[16-j] + sumc[ j];
+ out += incr;
+ out2 -= incr;
+ }
+ }
+
+ sum = 0;
+ SUM8(MLSS, sum, win + 16 + 32, in + 32);
+ *out = sum;
+}
+
+#endif /* HAVE_SSE2_INLINE */
+
+#if HAVE_YASM
+#define DECL_IMDCT_BLOCKS(CPU1, CPU2) \
+static void imdct36_blocks_ ## CPU1(float *out, float *buf, float *in, \
+ int count, int switch_point, int block_type) \
+{ \
+ int align_end = count - (count & 3); \
+ int j; \
+ for (j = 0; j < align_end; j+= 4) { \
+ LOCAL_ALIGNED_16(float, tmpbuf, [1024]); \
+ float *win = mdct_win_sse[switch_point && j < 4][block_type]; \
+ /* apply window & overlap with previous buffer */ \
+ \
+ /* select window */ \
+ ff_four_imdct36_float_ ## CPU2(out, buf, in, win, tmpbuf); \
+ in += 4*18; \
+ buf += 4*18; \
+ out += 4; \
+ } \
+ for (; j < count; j++) { \
+ /* apply window & overlap with previous buffer */ \
+ \
+ /* select window */ \
+ int win_idx = (switch_point && j < 2) ? 0 : block_type; \
+ float *win = ff_mdct_win_float[win_idx + (4 & -(j & 1))]; \
+ \
+ ff_imdct36_float_ ## CPU1(out, buf, in, win); \
+ \
+ in += 18; \
+ buf++; \
+ out++; \
+ } \
+}
+
+DECL_IMDCT_BLOCKS(sse,sse)
+DECL_IMDCT_BLOCKS(sse2,sse)
+DECL_IMDCT_BLOCKS(sse3,sse)
+DECL_IMDCT_BLOCKS(ssse3,sse)
+DECL_IMDCT_BLOCKS(avx,avx)
+#endif /* HAVE_YASM */
+
+void ff_mpadsp_init_x86(MPADSPContext *s)
+{
+ int mm_flags = av_get_cpu_flags();
+
+ int i, j;
+ for (j = 0; j < 4; j++) {
+ for (i = 0; i < 40; i ++) {
+ mdct_win_sse[0][j][4*i ] = ff_mdct_win_float[j ][i];
+ mdct_win_sse[0][j][4*i + 1] = ff_mdct_win_float[j + 4][i];
+ mdct_win_sse[0][j][4*i + 2] = ff_mdct_win_float[j ][i];
+ mdct_win_sse[0][j][4*i + 3] = ff_mdct_win_float[j + 4][i];
+ mdct_win_sse[1][j][4*i ] = ff_mdct_win_float[0 ][i];
+ mdct_win_sse[1][j][4*i + 1] = ff_mdct_win_float[4 ][i];
+ mdct_win_sse[1][j][4*i + 2] = ff_mdct_win_float[j ][i];
+ mdct_win_sse[1][j][4*i + 3] = ff_mdct_win_float[j + 4][i];
+ }
+ }
+
+#if HAVE_SSE2_INLINE
+ if (mm_flags & AV_CPU_FLAG_SSE2) {
+ s->apply_window_float = apply_window_mp3;
+ }
+#endif /* HAVE_SSE2_INLINE */
+
+#if HAVE_YASM
+ if (EXTERNAL_AVX(mm_flags)) {
+ s->imdct36_blocks_float = imdct36_blocks_avx;
+ } else if (EXTERNAL_SSSE3(mm_flags)) {
+ s->imdct36_blocks_float = imdct36_blocks_ssse3;
+ } else if (EXTERNAL_SSE3(mm_flags)) {
+ s->imdct36_blocks_float = imdct36_blocks_sse3;
+ } else if (EXTERNAL_SSE2(mm_flags)) {
+ s->imdct36_blocks_float = imdct36_blocks_sse2;
+ } else if (EXTERNAL_SSE(mm_flags)) {
+ s->imdct36_blocks_float = imdct36_blocks_sse;
+ }
+#endif /* HAVE_YASM */
+}
diff --git a/gst-libs/ext/libav/libavcodec/x86/mpegaudiodec_mmx.c b/gst-libs/ext/libav/libavcodec/x86/mpegaudiodec_mmx.c
deleted file mode 100644
index 06ffbca..0000000
--- a/gst-libs/ext/libav/libavcodec/x86/mpegaudiodec_mmx.c
+++ /dev/null
@@ -1,237 +0,0 @@
-/*
- * MMX optimized MP3 decoding functions
- * Copyright (c) 2010 Vitor Sessak
- *
- * 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
- */
-
-#include "libavutil/cpu.h"
-#include "libavutil/x86_cpu.h"
-#include "libavcodec/dsputil.h"
-#include "libavcodec/mpegaudiodsp.h"
-
-void ff_imdct36_float_sse(float *out, float *buf, float *in, float *win);
-void ff_imdct36_float_sse2(float *out, float *buf, float *in, float *win);
-void ff_imdct36_float_sse3(float *out, float *buf, float *in, float *win);
-void ff_imdct36_float_ssse3(float *out, float *buf, float *in, float *win);
-void ff_imdct36_float_avx(float *out, float *buf, float *in, float *win);
-void ff_four_imdct36_float_sse(float *out, float *buf, float *in, float *win,
- float *tmpbuf);
-void ff_four_imdct36_float_avx(float *out, float *buf, float *in, float *win,
- float *tmpbuf);
-
-DECLARE_ALIGNED(16, static float, mdct_win_sse)[2][4][4*40];
-
-#define MACS(rt, ra, rb) rt+=(ra)*(rb)
-#define MLSS(rt, ra, rb) rt-=(ra)*(rb)
-
-#define SUM8(op, sum, w, p) \
-{ \
- op(sum, (w)[0 * 64], (p)[0 * 64]); \
- op(sum, (w)[1 * 64], (p)[1 * 64]); \
- op(sum, (w)[2 * 64], (p)[2 * 64]); \
- op(sum, (w)[3 * 64], (p)[3 * 64]); \
- op(sum, (w)[4 * 64], (p)[4 * 64]); \
- op(sum, (w)[5 * 64], (p)[5 * 64]); \
- op(sum, (w)[6 * 64], (p)[6 * 64]); \
- op(sum, (w)[7 * 64], (p)[7 * 64]); \
-}
-
-static void apply_window(const float *buf, const float *win1,
- const float *win2, float *sum1, float *sum2, int len)
-{
- x86_reg count = - 4*len;
- const float *win1a = win1+len;
- const float *win2a = win2+len;
- const float *bufa = buf+len;
- float *sum1a = sum1+len;
- float *sum2a = sum2+len;
-
-
-#define MULT(a, b) \
- "movaps " #a "(%1,%0), %%xmm1 \n\t" \
- "movaps " #a "(%3,%0), %%xmm2 \n\t" \
- "mulps %%xmm2, %%xmm1 \n\t" \
- "subps %%xmm1, %%xmm0 \n\t" \
- "mulps " #b "(%2,%0), %%xmm2 \n\t" \
- "subps %%xmm2, %%xmm4 \n\t" \
-
- __asm__ volatile(
- "1: \n\t"
- "xorps %%xmm0, %%xmm0 \n\t"
- "xorps %%xmm4, %%xmm4 \n\t"
-
- MULT( 0, 0)
- MULT( 256, 64)
- MULT( 512, 128)
- MULT( 768, 192)
- MULT(1024, 256)
- MULT(1280, 320)
- MULT(1536, 384)
- MULT(1792, 448)
-
- "movaps %%xmm0, (%4,%0) \n\t"
- "movaps %%xmm4, (%5,%0) \n\t"
- "add $16, %0 \n\t"
- "jl 1b \n\t"
- :"+&r"(count)
- :"r"(win1a), "r"(win2a), "r"(bufa), "r"(sum1a), "r"(sum2a)
- );
-
-#undef MULT
-}
-
-static void apply_window_mp3(float *in, float *win, int *unused, float *out,
- int incr)
-{
- LOCAL_ALIGNED_16(float, suma, [17]);
- LOCAL_ALIGNED_16(float, sumb, [17]);
- LOCAL_ALIGNED_16(float, sumc, [17]);
- LOCAL_ALIGNED_16(float, sumd, [17]);
-
- float sum;
-
- /* copy to avoid wrap */
- memcpy(in + 512, in, 32 * sizeof(*in));
-
- apply_window(in + 16, win , win + 512, suma, sumc, 16);
- apply_window(in + 32, win + 48, win + 640, sumb, sumd, 16);
-
- SUM8(MACS, suma[0], win + 32, in + 48);
-
- sumc[ 0] = 0;
- sumb[16] = 0;
- sumd[16] = 0;
-
-#define SUMS(suma, sumb, sumc, sumd, out1, out2) \
- "movups " #sumd "(%4), %%xmm0 \n\t" \
- "shufps $0x1b, %%xmm0, %%xmm0 \n\t" \
- "subps " #suma "(%1), %%xmm0 \n\t" \
- "movaps %%xmm0," #out1 "(%0) \n\t" \
-\
- "movups " #sumc "(%3), %%xmm0 \n\t" \
- "shufps $0x1b, %%xmm0, %%xmm0 \n\t" \
- "addps " #sumb "(%2), %%xmm0 \n\t" \
- "movaps %%xmm0," #out2 "(%0) \n\t"
-
- if (incr == 1) {
- __asm__ volatile(
- SUMS( 0, 48, 4, 52, 0, 112)
- SUMS(16, 32, 20, 36, 16, 96)
- SUMS(32, 16, 36, 20, 32, 80)
- SUMS(48, 0, 52, 4, 48, 64)
-
- :"+&r"(out)
- :"r"(&suma[0]), "r"(&sumb[0]), "r"(&sumc[0]), "r"(&sumd[0])
- :"memory"
- );
- out += 16*incr;
- } else {
- int j;
- float *out2 = out + 32 * incr;
- out[0 ] = -suma[ 0];
- out += incr;
- out2 -= incr;
- for(j=1;j<16;j++) {
- *out = -suma[ j] + sumd[16-j];
- *out2 = sumb[16-j] + sumc[ j];
- out += incr;
- out2 -= incr;
- }
- }
-
- sum = 0;
- SUM8(MLSS, sum, win + 16 + 32, in + 32);
- *out = sum;
-}
-
-
-#define DECL_IMDCT_BLOCKS(CPU1, CPU2) \
-static void imdct36_blocks_ ## CPU1(float *out, float *buf, float *in, \
- int count, int switch_point, int block_type) \
-{ \
- int align_end = count - (count & 3); \
- int j; \
- for (j = 0; j < align_end; j+= 4) { \
- LOCAL_ALIGNED_16(float, tmpbuf, [1024]); \
- float *win = mdct_win_sse[switch_point && j < 4][block_type]; \
- /* apply window & overlap with previous buffer */ \
- \
- /* select window */ \
- ff_four_imdct36_float_ ## CPU2(out, buf, in, win, tmpbuf); \
- in += 4*18; \
- buf += 4*18; \
- out += 4; \
- } \
- for (; j < count; j++) { \
- /* apply window & overlap with previous buffer */ \
- \
- /* select window */ \
- int win_idx = (switch_point && j < 2) ? 0 : block_type; \
- float *win = ff_mdct_win_float[win_idx + (4 & -(j & 1))]; \
- \
- ff_imdct36_float_ ## CPU1(out, buf, in, win); \
- \
- in += 18; \
- buf++; \
- out++; \
- } \
-}
-
-DECL_IMDCT_BLOCKS(sse,sse)
-DECL_IMDCT_BLOCKS(sse2,sse)
-DECL_IMDCT_BLOCKS(sse3,sse)
-DECL_IMDCT_BLOCKS(ssse3,sse)
-DECL_IMDCT_BLOCKS(avx,avx)
-
-void ff_mpadsp_init_mmx(MPADSPContext *s)
-{
- int mm_flags = av_get_cpu_flags();
-
- int i, j;
- for (j = 0; j < 4; j++) {
- for (i = 0; i < 40; i ++) {
- mdct_win_sse[0][j][4*i ] = ff_mdct_win_float[j ][i];
- mdct_win_sse[0][j][4*i + 1] = ff_mdct_win_float[j + 4][i];
- mdct_win_sse[0][j][4*i + 2] = ff_mdct_win_float[j ][i];
- mdct_win_sse[0][j][4*i + 3] = ff_mdct_win_float[j + 4][i];
- mdct_win_sse[1][j][4*i ] = ff_mdct_win_float[0 ][i];
- mdct_win_sse[1][j][4*i + 1] = ff_mdct_win_float[4 ][i];
- mdct_win_sse[1][j][4*i + 2] = ff_mdct_win_float[j ][i];
- mdct_win_sse[1][j][4*i + 3] = ff_mdct_win_float[j + 4][i];
- }
- }
-
- if (mm_flags & AV_CPU_FLAG_SSE2) {
- s->apply_window_float = apply_window_mp3;
- }
-#if HAVE_YASM
- if (mm_flags & AV_CPU_FLAG_AVX && HAVE_AVX) {
- s->imdct36_blocks_float = imdct36_blocks_avx;
-#if HAVE_SSE
- } else if (mm_flags & AV_CPU_FLAG_SSSE3) {
- s->imdct36_blocks_float = imdct36_blocks_ssse3;
- } else if (mm_flags & AV_CPU_FLAG_SSE3) {
- s->imdct36_blocks_float = imdct36_blocks_sse3;
- } else if (mm_flags & AV_CPU_FLAG_SSE2) {
- s->imdct36_blocks_float = imdct36_blocks_sse2;
- } else if (mm_flags & AV_CPU_FLAG_SSE) {
- s->imdct36_blocks_float = imdct36_blocks_sse;
-#endif /* HAVE_SSE */
- }
-#endif /* HAVE_YASM */
-}
diff --git a/gst-libs/ext/libav/libavcodec/x86/mpegvideo.c b/gst-libs/ext/libav/libavcodec/x86/mpegvideo.c
new file mode 100644
index 0000000..3bc93f3
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/x86/mpegvideo.c
@@ -0,0 +1,608 @@
+/*
+ * Optimized for ia32 CPUs by Nick Kurshev <nickols_k@mail.ru>
+ * h263, mpeg1, mpeg2 dequantizer & draw_edges by Michael Niedermayer <michaelni@gmx.at>
+ *
+ * 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
+ */
+
+#include "libavutil/cpu.h"
+#include "libavutil/x86/asm.h"
+#include "libavcodec/avcodec.h"
+#include "libavcodec/dsputil.h"
+#include "libavcodec/mpegvideo.h"
+#include "dsputil_mmx.h"
+
+#if HAVE_INLINE_ASM
+
+static void dct_unquantize_h263_intra_mmx(MpegEncContext *s,
+ DCTELEM *block, int n, int qscale)
+{
+ x86_reg level, qmul, qadd, nCoeffs;
+
+ qmul = qscale << 1;
+
+ assert(s->block_last_index[n]>=0 || s->h263_aic);
+
+ if (!s->h263_aic) {
+ if (n < 4)
+ level = block[0] * s->y_dc_scale;
+ else
+ level = block[0] * s->c_dc_scale;
+ qadd = (qscale - 1) | 1;
+ }else{
+ qadd = 0;
+ level= block[0];
+ }
+ if(s->ac_pred)
+ nCoeffs=63;
+ else
+ nCoeffs= s->inter_scantable.raster_end[ s->block_last_index[n] ];
+
+__asm__ volatile(
+ "movd %1, %%mm6 \n\t" //qmul
+ "packssdw %%mm6, %%mm6 \n\t"
+ "packssdw %%mm6, %%mm6 \n\t"
+ "movd %2, %%mm5 \n\t" //qadd
+ "pxor %%mm7, %%mm7 \n\t"
+ "packssdw %%mm5, %%mm5 \n\t"
+ "packssdw %%mm5, %%mm5 \n\t"
+ "psubw %%mm5, %%mm7 \n\t"
+ "pxor %%mm4, %%mm4 \n\t"
+ ".p2align 4 \n\t"
+ "1: \n\t"
+ "movq (%0, %3), %%mm0 \n\t"
+ "movq 8(%0, %3), %%mm1 \n\t"
+
+ "pmullw %%mm6, %%mm0 \n\t"
+ "pmullw %%mm6, %%mm1 \n\t"
+
+ "movq (%0, %3), %%mm2 \n\t"
+ "movq 8(%0, %3), %%mm3 \n\t"
+
+ "pcmpgtw %%mm4, %%mm2 \n\t" // block[i] < 0 ? -1 : 0
+ "pcmpgtw %%mm4, %%mm3 \n\t" // block[i] < 0 ? -1 : 0
+
+ "pxor %%mm2, %%mm0 \n\t"
+ "pxor %%mm3, %%mm1 \n\t"
+
+ "paddw %%mm7, %%mm0 \n\t"
+ "paddw %%mm7, %%mm1 \n\t"
+
+ "pxor %%mm0, %%mm2 \n\t"
+ "pxor %%mm1, %%mm3 \n\t"
+
+ "pcmpeqw %%mm7, %%mm0 \n\t" // block[i] == 0 ? -1 : 0
+ "pcmpeqw %%mm7, %%mm1 \n\t" // block[i] == 0 ? -1 : 0
+
+ "pandn %%mm2, %%mm0 \n\t"
+ "pandn %%mm3, %%mm1 \n\t"
+
+ "movq %%mm0, (%0, %3) \n\t"
+ "movq %%mm1, 8(%0, %3) \n\t"
+
+ "add $16, %3 \n\t"
+ "jng 1b \n\t"
+ ::"r" (block+nCoeffs), "rm"(qmul), "rm" (qadd), "r" (2*(-nCoeffs))
+ : "memory"
+ );
+ block[0]= level;
+}
+
+
+static void dct_unquantize_h263_inter_mmx(MpegEncContext *s,
+ DCTELEM *block, int n, int qscale)
+{
+ x86_reg qmul, qadd, nCoeffs;
+
+ qmul = qscale << 1;
+ qadd = (qscale - 1) | 1;
+
+ assert(s->block_last_index[n]>=0 || s->h263_aic);
+
+ nCoeffs= s->inter_scantable.raster_end[ s->block_last_index[n] ];
+
+__asm__ volatile(
+ "movd %1, %%mm6 \n\t" //qmul
+ "packssdw %%mm6, %%mm6 \n\t"
+ "packssdw %%mm6, %%mm6 \n\t"
+ "movd %2, %%mm5 \n\t" //qadd
+ "pxor %%mm7, %%mm7 \n\t"
+ "packssdw %%mm5, %%mm5 \n\t"
+ "packssdw %%mm5, %%mm5 \n\t"
+ "psubw %%mm5, %%mm7 \n\t"
+ "pxor %%mm4, %%mm4 \n\t"
+ ".p2align 4 \n\t"
+ "1: \n\t"
+ "movq (%0, %3), %%mm0 \n\t"
+ "movq 8(%0, %3), %%mm1 \n\t"
+
+ "pmullw %%mm6, %%mm0 \n\t"
+ "pmullw %%mm6, %%mm1 \n\t"
+
+ "movq (%0, %3), %%mm2 \n\t"
+ "movq 8(%0, %3), %%mm3 \n\t"
+
+ "pcmpgtw %%mm4, %%mm2 \n\t" // block[i] < 0 ? -1 : 0
+ "pcmpgtw %%mm4, %%mm3 \n\t" // block[i] < 0 ? -1 : 0
+
+ "pxor %%mm2, %%mm0 \n\t"
+ "pxor %%mm3, %%mm1 \n\t"
+
+ "paddw %%mm7, %%mm0 \n\t"
+ "paddw %%mm7, %%mm1 \n\t"
+
+ "pxor %%mm0, %%mm2 \n\t"
+ "pxor %%mm1, %%mm3 \n\t"
+
+ "pcmpeqw %%mm7, %%mm0 \n\t" // block[i] == 0 ? -1 : 0
+ "pcmpeqw %%mm7, %%mm1 \n\t" // block[i] == 0 ? -1 : 0
+
+ "pandn %%mm2, %%mm0 \n\t"
+ "pandn %%mm3, %%mm1 \n\t"
+
+ "movq %%mm0, (%0, %3) \n\t"
+ "movq %%mm1, 8(%0, %3) \n\t"
+
+ "add $16, %3 \n\t"
+ "jng 1b \n\t"
+ ::"r" (block+nCoeffs), "rm"(qmul), "rm" (qadd), "r" (2*(-nCoeffs))
+ : "memory"
+ );
+}
+
+
+/*
+ NK:
+ Note: looking at PARANOID:
+ "enable all paranoid tests for rounding, overflows, etc..."
+
+#ifdef PARANOID
+ if (level < -2048 || level > 2047)
+ fprintf(stderr, "unquant error %d %d\n", i, level);
+#endif
+ We can suppose that result of two multiplications can't be greater than 0xFFFF
+ i.e. is 16-bit, so we use here only PMULLW instruction and can avoid
+ a complex multiplication.
+=====================================================
+ Full formula for multiplication of 2 integer numbers
+ which are represent as high:low words:
+ input: value1 = high1:low1
+ value2 = high2:low2
+ output: value3 = value1*value2
+ value3=high3:low3 (on overflow: modulus 2^32 wrap-around)
+ this mean that for 0x123456 * 0x123456 correct result is 0x766cb0ce4
+ but this algorithm will compute only 0x66cb0ce4
+ this limited by 16-bit size of operands
+ ---------------------------------
+ tlow1 = high1*low2
+ tlow2 = high2*low1
+ tlow1 = tlow1 + tlow2
+ high3:low3 = low1*low2
+ high3 += tlow1
+*/
+static void dct_unquantize_mpeg1_intra_mmx(MpegEncContext *s,
+ DCTELEM *block, int n, int qscale)
+{
+ x86_reg nCoeffs;
+ const uint16_t *quant_matrix;
+ int block0;
+
+ assert(s->block_last_index[n]>=0);
+
+ nCoeffs= s->intra_scantable.raster_end[ s->block_last_index[n] ]+1;
+
+ if (n < 4)
+ block0 = block[0] * s->y_dc_scale;
+ else
+ block0 = block[0] * s->c_dc_scale;
+ /* XXX: only mpeg1 */
+ quant_matrix = s->intra_matrix;
+__asm__ volatile(
+ "pcmpeqw %%mm7, %%mm7 \n\t"
+ "psrlw $15, %%mm7 \n\t"
+ "movd %2, %%mm6 \n\t"
+ "packssdw %%mm6, %%mm6 \n\t"
+ "packssdw %%mm6, %%mm6 \n\t"
+ "mov %3, %%"REG_a" \n\t"
+ ".p2align 4 \n\t"
+ "1: \n\t"
+ "movq (%0, %%"REG_a"), %%mm0 \n\t"
+ "movq 8(%0, %%"REG_a"), %%mm1 \n\t"
+ "movq (%1, %%"REG_a"), %%mm4 \n\t"
+ "movq 8(%1, %%"REG_a"), %%mm5 \n\t"
+ "pmullw %%mm6, %%mm4 \n\t" // q=qscale*quant_matrix[i]
+ "pmullw %%mm6, %%mm5 \n\t" // q=qscale*quant_matrix[i]
+ "pxor %%mm2, %%mm2 \n\t"
+ "pxor %%mm3, %%mm3 \n\t"
+ "pcmpgtw %%mm0, %%mm2 \n\t" // block[i] < 0 ? -1 : 0
+ "pcmpgtw %%mm1, %%mm3 \n\t" // block[i] < 0 ? -1 : 0
+ "pxor %%mm2, %%mm0 \n\t"
+ "pxor %%mm3, %%mm1 \n\t"
+ "psubw %%mm2, %%mm0 \n\t" // abs(block[i])
+ "psubw %%mm3, %%mm1 \n\t" // abs(block[i])
+ "pmullw %%mm4, %%mm0 \n\t" // abs(block[i])*q
+ "pmullw %%mm5, %%mm1 \n\t" // abs(block[i])*q
+ "pxor %%mm4, %%mm4 \n\t"
+ "pxor %%mm5, %%mm5 \n\t" // FIXME slow
+ "pcmpeqw (%0, %%"REG_a"), %%mm4 \n\t" // block[i] == 0 ? -1 : 0
+ "pcmpeqw 8(%0, %%"REG_a"), %%mm5\n\t" // block[i] == 0 ? -1 : 0
+ "psraw $3, %%mm0 \n\t"
+ "psraw $3, %%mm1 \n\t"
+ "psubw %%mm7, %%mm0 \n\t"
+ "psubw %%mm7, %%mm1 \n\t"
+ "por %%mm7, %%mm0 \n\t"
+ "por %%mm7, %%mm1 \n\t"
+ "pxor %%mm2, %%mm0 \n\t"
+ "pxor %%mm3, %%mm1 \n\t"
+ "psubw %%mm2, %%mm0 \n\t"
+ "psubw %%mm3, %%mm1 \n\t"
+ "pandn %%mm0, %%mm4 \n\t"
+ "pandn %%mm1, %%mm5 \n\t"
+ "movq %%mm4, (%0, %%"REG_a") \n\t"
+ "movq %%mm5, 8(%0, %%"REG_a") \n\t"
+
+ "add $16, %%"REG_a" \n\t"
+ "js 1b \n\t"
+ ::"r" (block+nCoeffs), "r"(quant_matrix+nCoeffs), "rm" (qscale), "g" (-2*nCoeffs)
+ : "%"REG_a, "memory"
+ );
+ block[0]= block0;
+}
+
+static void dct_unquantize_mpeg1_inter_mmx(MpegEncContext *s,
+ DCTELEM *block, int n, int qscale)
+{
+ x86_reg nCoeffs;
+ const uint16_t *quant_matrix;
+
+ assert(s->block_last_index[n]>=0);
+
+ nCoeffs= s->intra_scantable.raster_end[ s->block_last_index[n] ]+1;
+
+ quant_matrix = s->inter_matrix;
+__asm__ volatile(
+ "pcmpeqw %%mm7, %%mm7 \n\t"
+ "psrlw $15, %%mm7 \n\t"
+ "movd %2, %%mm6 \n\t"
+ "packssdw %%mm6, %%mm6 \n\t"
+ "packssdw %%mm6, %%mm6 \n\t"
+ "mov %3, %%"REG_a" \n\t"
+ ".p2align 4 \n\t"
+ "1: \n\t"
+ "movq (%0, %%"REG_a"), %%mm0 \n\t"
+ "movq 8(%0, %%"REG_a"), %%mm1 \n\t"
+ "movq (%1, %%"REG_a"), %%mm4 \n\t"
+ "movq 8(%1, %%"REG_a"), %%mm5 \n\t"
+ "pmullw %%mm6, %%mm4 \n\t" // q=qscale*quant_matrix[i]
+ "pmullw %%mm6, %%mm5 \n\t" // q=qscale*quant_matrix[i]
+ "pxor %%mm2, %%mm2 \n\t"
+ "pxor %%mm3, %%mm3 \n\t"
+ "pcmpgtw %%mm0, %%mm2 \n\t" // block[i] < 0 ? -1 : 0
+ "pcmpgtw %%mm1, %%mm3 \n\t" // block[i] < 0 ? -1 : 0
+ "pxor %%mm2, %%mm0 \n\t"
+ "pxor %%mm3, %%mm1 \n\t"
+ "psubw %%mm2, %%mm0 \n\t" // abs(block[i])
+ "psubw %%mm3, %%mm1 \n\t" // abs(block[i])
+ "paddw %%mm0, %%mm0 \n\t" // abs(block[i])*2
+ "paddw %%mm1, %%mm1 \n\t" // abs(block[i])*2
+ "paddw %%mm7, %%mm0 \n\t" // abs(block[i])*2 + 1
+ "paddw %%mm7, %%mm1 \n\t" // abs(block[i])*2 + 1
+ "pmullw %%mm4, %%mm0 \n\t" // (abs(block[i])*2 + 1)*q
+ "pmullw %%mm5, %%mm1 \n\t" // (abs(block[i])*2 + 1)*q
+ "pxor %%mm4, %%mm4 \n\t"
+ "pxor %%mm5, %%mm5 \n\t" // FIXME slow
+ "pcmpeqw (%0, %%"REG_a"), %%mm4 \n\t" // block[i] == 0 ? -1 : 0
+ "pcmpeqw 8(%0, %%"REG_a"), %%mm5\n\t" // block[i] == 0 ? -1 : 0
+ "psraw $4, %%mm0 \n\t"
+ "psraw $4, %%mm1 \n\t"
+ "psubw %%mm7, %%mm0 \n\t"
+ "psubw %%mm7, %%mm1 \n\t"
+ "por %%mm7, %%mm0 \n\t"
+ "por %%mm7, %%mm1 \n\t"
+ "pxor %%mm2, %%mm0 \n\t"
+ "pxor %%mm3, %%mm1 \n\t"
+ "psubw %%mm2, %%mm0 \n\t"
+ "psubw %%mm3, %%mm1 \n\t"
+ "pandn %%mm0, %%mm4 \n\t"
+ "pandn %%mm1, %%mm5 \n\t"
+ "movq %%mm4, (%0, %%"REG_a") \n\t"
+ "movq %%mm5, 8(%0, %%"REG_a") \n\t"
+
+ "add $16, %%"REG_a" \n\t"
+ "js 1b \n\t"
+ ::"r" (block+nCoeffs), "r"(quant_matrix+nCoeffs), "rm" (qscale), "g" (-2*nCoeffs)
+ : "%"REG_a, "memory"
+ );
+}
+
+static void dct_unquantize_mpeg2_intra_mmx(MpegEncContext *s,
+ DCTELEM *block, int n, int qscale)
+{
+ x86_reg nCoeffs;
+ const uint16_t *quant_matrix;
+ int block0;
+
+ assert(s->block_last_index[n]>=0);
+
+ if(s->alternate_scan) nCoeffs= 63; //FIXME
+ else nCoeffs= s->intra_scantable.raster_end[ s->block_last_index[n] ];
+
+ if (n < 4)
+ block0 = block[0] * s->y_dc_scale;
+ else
+ block0 = block[0] * s->c_dc_scale;
+ quant_matrix = s->intra_matrix;
+__asm__ volatile(
+ "pcmpeqw %%mm7, %%mm7 \n\t"
+ "psrlw $15, %%mm7 \n\t"
+ "movd %2, %%mm6 \n\t"
+ "packssdw %%mm6, %%mm6 \n\t"
+ "packssdw %%mm6, %%mm6 \n\t"
+ "mov %3, %%"REG_a" \n\t"
+ ".p2align 4 \n\t"
+ "1: \n\t"
+ "movq (%0, %%"REG_a"), %%mm0 \n\t"
+ "movq 8(%0, %%"REG_a"), %%mm1 \n\t"
+ "movq (%1, %%"REG_a"), %%mm4 \n\t"
+ "movq 8(%1, %%"REG_a"), %%mm5 \n\t"
+ "pmullw %%mm6, %%mm4 \n\t" // q=qscale*quant_matrix[i]
+ "pmullw %%mm6, %%mm5 \n\t" // q=qscale*quant_matrix[i]
+ "pxor %%mm2, %%mm2 \n\t"
+ "pxor %%mm3, %%mm3 \n\t"
+ "pcmpgtw %%mm0, %%mm2 \n\t" // block[i] < 0 ? -1 : 0
+ "pcmpgtw %%mm1, %%mm3 \n\t" // block[i] < 0 ? -1 : 0
+ "pxor %%mm2, %%mm0 \n\t"
+ "pxor %%mm3, %%mm1 \n\t"
+ "psubw %%mm2, %%mm0 \n\t" // abs(block[i])
+ "psubw %%mm3, %%mm1 \n\t" // abs(block[i])
+ "pmullw %%mm4, %%mm0 \n\t" // abs(block[i])*q
+ "pmullw %%mm5, %%mm1 \n\t" // abs(block[i])*q
+ "pxor %%mm4, %%mm4 \n\t"
+ "pxor %%mm5, %%mm5 \n\t" // FIXME slow
+ "pcmpeqw (%0, %%"REG_a"), %%mm4 \n\t" // block[i] == 0 ? -1 : 0
+ "pcmpeqw 8(%0, %%"REG_a"), %%mm5\n\t" // block[i] == 0 ? -1 : 0
+ "psraw $3, %%mm0 \n\t"
+ "psraw $3, %%mm1 \n\t"
+ "pxor %%mm2, %%mm0 \n\t"
+ "pxor %%mm3, %%mm1 \n\t"
+ "psubw %%mm2, %%mm0 \n\t"
+ "psubw %%mm3, %%mm1 \n\t"
+ "pandn %%mm0, %%mm4 \n\t"
+ "pandn %%mm1, %%mm5 \n\t"
+ "movq %%mm4, (%0, %%"REG_a") \n\t"
+ "movq %%mm5, 8(%0, %%"REG_a") \n\t"
+
+ "add $16, %%"REG_a" \n\t"
+ "jng 1b \n\t"
+ ::"r" (block+nCoeffs), "r"(quant_matrix+nCoeffs), "rm" (qscale), "g" (-2*nCoeffs)
+ : "%"REG_a, "memory"
+ );
+ block[0]= block0;
+ //Note, we do not do mismatch control for intra as errors cannot accumulate
+}
+
+static void dct_unquantize_mpeg2_inter_mmx(MpegEncContext *s,
+ DCTELEM *block, int n, int qscale)
+{
+ x86_reg nCoeffs;
+ const uint16_t *quant_matrix;
+
+ assert(s->block_last_index[n]>=0);
+
+ if(s->alternate_scan) nCoeffs= 63; //FIXME
+ else nCoeffs= s->intra_scantable.raster_end[ s->block_last_index[n] ];
+
+ quant_matrix = s->inter_matrix;
+__asm__ volatile(
+ "pcmpeqw %%mm7, %%mm7 \n\t"
+ "psrlq $48, %%mm7 \n\t"
+ "movd %2, %%mm6 \n\t"
+ "packssdw %%mm6, %%mm6 \n\t"
+ "packssdw %%mm6, %%mm6 \n\t"
+ "mov %3, %%"REG_a" \n\t"
+ ".p2align 4 \n\t"
+ "1: \n\t"
+ "movq (%0, %%"REG_a"), %%mm0 \n\t"
+ "movq 8(%0, %%"REG_a"), %%mm1 \n\t"
+ "movq (%1, %%"REG_a"), %%mm4 \n\t"
+ "movq 8(%1, %%"REG_a"), %%mm5 \n\t"
+ "pmullw %%mm6, %%mm4 \n\t" // q=qscale*quant_matrix[i]
+ "pmullw %%mm6, %%mm5 \n\t" // q=qscale*quant_matrix[i]
+ "pxor %%mm2, %%mm2 \n\t"
+ "pxor %%mm3, %%mm3 \n\t"
+ "pcmpgtw %%mm0, %%mm2 \n\t" // block[i] < 0 ? -1 : 0
+ "pcmpgtw %%mm1, %%mm3 \n\t" // block[i] < 0 ? -1 : 0
+ "pxor %%mm2, %%mm0 \n\t"
+ "pxor %%mm3, %%mm1 \n\t"
+ "psubw %%mm2, %%mm0 \n\t" // abs(block[i])
+ "psubw %%mm3, %%mm1 \n\t" // abs(block[i])
+ "paddw %%mm0, %%mm0 \n\t" // abs(block[i])*2
+ "paddw %%mm1, %%mm1 \n\t" // abs(block[i])*2
+ "pmullw %%mm4, %%mm0 \n\t" // abs(block[i])*2*q
+ "pmullw %%mm5, %%mm1 \n\t" // abs(block[i])*2*q
+ "paddw %%mm4, %%mm0 \n\t" // (abs(block[i])*2 + 1)*q
+ "paddw %%mm5, %%mm1 \n\t" // (abs(block[i])*2 + 1)*q
+ "pxor %%mm4, %%mm4 \n\t"
+ "pxor %%mm5, %%mm5 \n\t" // FIXME slow
+ "pcmpeqw (%0, %%"REG_a"), %%mm4 \n\t" // block[i] == 0 ? -1 : 0
+ "pcmpeqw 8(%0, %%"REG_a"), %%mm5\n\t" // block[i] == 0 ? -1 : 0
+ "psrlw $4, %%mm0 \n\t"
+ "psrlw $4, %%mm1 \n\t"
+ "pxor %%mm2, %%mm0 \n\t"
+ "pxor %%mm3, %%mm1 \n\t"
+ "psubw %%mm2, %%mm0 \n\t"
+ "psubw %%mm3, %%mm1 \n\t"
+ "pandn %%mm0, %%mm4 \n\t"
+ "pandn %%mm1, %%mm5 \n\t"
+ "pxor %%mm4, %%mm7 \n\t"
+ "pxor %%mm5, %%mm7 \n\t"
+ "movq %%mm4, (%0, %%"REG_a") \n\t"
+ "movq %%mm5, 8(%0, %%"REG_a") \n\t"
+
+ "add $16, %%"REG_a" \n\t"
+ "jng 1b \n\t"
+ "movd 124(%0, %3), %%mm0 \n\t"
+ "movq %%mm7, %%mm6 \n\t"
+ "psrlq $32, %%mm7 \n\t"
+ "pxor %%mm6, %%mm7 \n\t"
+ "movq %%mm7, %%mm6 \n\t"
+ "psrlq $16, %%mm7 \n\t"
+ "pxor %%mm6, %%mm7 \n\t"
+ "pslld $31, %%mm7 \n\t"
+ "psrlq $15, %%mm7 \n\t"
+ "pxor %%mm7, %%mm0 \n\t"
+ "movd %%mm0, 124(%0, %3) \n\t"
+
+ ::"r" (block+nCoeffs), "r"(quant_matrix+nCoeffs), "rm" (qscale), "r" (-2*nCoeffs)
+ : "%"REG_a, "memory"
+ );
+}
+
+static void denoise_dct_mmx(MpegEncContext *s, DCTELEM *block){
+ const int intra= s->mb_intra;
+ int *sum= s->dct_error_sum[intra];
+ uint16_t *offset= s->dct_offset[intra];
+
+ s->dct_count[intra]++;
+
+ __asm__ volatile(
+ "pxor %%mm7, %%mm7 \n\t"
+ "1: \n\t"
+ "pxor %%mm0, %%mm0 \n\t"
+ "pxor %%mm1, %%mm1 \n\t"
+ "movq (%0), %%mm2 \n\t"
+ "movq 8(%0), %%mm3 \n\t"
+ "pcmpgtw %%mm2, %%mm0 \n\t"
+ "pcmpgtw %%mm3, %%mm1 \n\t"
+ "pxor %%mm0, %%mm2 \n\t"
+ "pxor %%mm1, %%mm3 \n\t"
+ "psubw %%mm0, %%mm2 \n\t"
+ "psubw %%mm1, %%mm3 \n\t"
+ "movq %%mm2, %%mm4 \n\t"
+ "movq %%mm3, %%mm5 \n\t"
+ "psubusw (%2), %%mm2 \n\t"
+ "psubusw 8(%2), %%mm3 \n\t"
+ "pxor %%mm0, %%mm2 \n\t"
+ "pxor %%mm1, %%mm3 \n\t"
+ "psubw %%mm0, %%mm2 \n\t"
+ "psubw %%mm1, %%mm3 \n\t"
+ "movq %%mm2, (%0) \n\t"
+ "movq %%mm3, 8(%0) \n\t"
+ "movq %%mm4, %%mm2 \n\t"
+ "movq %%mm5, %%mm3 \n\t"
+ "punpcklwd %%mm7, %%mm4 \n\t"
+ "punpckhwd %%mm7, %%mm2 \n\t"
+ "punpcklwd %%mm7, %%mm5 \n\t"
+ "punpckhwd %%mm7, %%mm3 \n\t"
+ "paddd (%1), %%mm4 \n\t"
+ "paddd 8(%1), %%mm2 \n\t"
+ "paddd 16(%1), %%mm5 \n\t"
+ "paddd 24(%1), %%mm3 \n\t"
+ "movq %%mm4, (%1) \n\t"
+ "movq %%mm2, 8(%1) \n\t"
+ "movq %%mm5, 16(%1) \n\t"
+ "movq %%mm3, 24(%1) \n\t"
+ "add $16, %0 \n\t"
+ "add $32, %1 \n\t"
+ "add $16, %2 \n\t"
+ "cmp %3, %0 \n\t"
+ " jb 1b \n\t"
+ : "+r" (block), "+r" (sum), "+r" (offset)
+ : "r"(block+64)
+ );
+}
+
+static void denoise_dct_sse2(MpegEncContext *s, DCTELEM *block){
+ const int intra= s->mb_intra;
+ int *sum= s->dct_error_sum[intra];
+ uint16_t *offset= s->dct_offset[intra];
+
+ s->dct_count[intra]++;
+
+ __asm__ volatile(
+ "pxor %%xmm7, %%xmm7 \n\t"
+ "1: \n\t"
+ "pxor %%xmm0, %%xmm0 \n\t"
+ "pxor %%xmm1, %%xmm1 \n\t"
+ "movdqa (%0), %%xmm2 \n\t"
+ "movdqa 16(%0), %%xmm3 \n\t"
+ "pcmpgtw %%xmm2, %%xmm0 \n\t"
+ "pcmpgtw %%xmm3, %%xmm1 \n\t"
+ "pxor %%xmm0, %%xmm2 \n\t"
+ "pxor %%xmm1, %%xmm3 \n\t"
+ "psubw %%xmm0, %%xmm2 \n\t"
+ "psubw %%xmm1, %%xmm3 \n\t"
+ "movdqa %%xmm2, %%xmm4 \n\t"
+ "movdqa %%xmm3, %%xmm5 \n\t"
+ "psubusw (%2), %%xmm2 \n\t"
+ "psubusw 16(%2), %%xmm3 \n\t"
+ "pxor %%xmm0, %%xmm2 \n\t"
+ "pxor %%xmm1, %%xmm3 \n\t"
+ "psubw %%xmm0, %%xmm2 \n\t"
+ "psubw %%xmm1, %%xmm3 \n\t"
+ "movdqa %%xmm2, (%0) \n\t"
+ "movdqa %%xmm3, 16(%0) \n\t"
+ "movdqa %%xmm4, %%xmm6 \n\t"
+ "movdqa %%xmm5, %%xmm0 \n\t"
+ "punpcklwd %%xmm7, %%xmm4 \n\t"
+ "punpckhwd %%xmm7, %%xmm6 \n\t"
+ "punpcklwd %%xmm7, %%xmm5 \n\t"
+ "punpckhwd %%xmm7, %%xmm0 \n\t"
+ "paddd (%1), %%xmm4 \n\t"
+ "paddd 16(%1), %%xmm6 \n\t"
+ "paddd 32(%1), %%xmm5 \n\t"
+ "paddd 48(%1), %%xmm0 \n\t"
+ "movdqa %%xmm4, (%1) \n\t"
+ "movdqa %%xmm6, 16(%1) \n\t"
+ "movdqa %%xmm5, 32(%1) \n\t"
+ "movdqa %%xmm0, 48(%1) \n\t"
+ "add $32, %0 \n\t"
+ "add $64, %1 \n\t"
+ "add $32, %2 \n\t"
+ "cmp %3, %0 \n\t"
+ " jb 1b \n\t"
+ : "+r" (block), "+r" (sum), "+r" (offset)
+ : "r"(block+64)
+ XMM_CLOBBERS_ONLY("%xmm0", "%xmm1", "%xmm2", "%xmm3",
+ "%xmm4", "%xmm5", "%xmm6", "%xmm7")
+ );
+}
+
+#endif /* HAVE_INLINE_ASM */
+
+void ff_MPV_common_init_x86(MpegEncContext *s)
+{
+#if HAVE_INLINE_ASM
+ int mm_flags = av_get_cpu_flags();
+
+ if (mm_flags & AV_CPU_FLAG_MMX) {
+ s->dct_unquantize_h263_intra = dct_unquantize_h263_intra_mmx;
+ s->dct_unquantize_h263_inter = dct_unquantize_h263_inter_mmx;
+ s->dct_unquantize_mpeg1_intra = dct_unquantize_mpeg1_intra_mmx;
+ s->dct_unquantize_mpeg1_inter = dct_unquantize_mpeg1_inter_mmx;
+ if(!(s->flags & CODEC_FLAG_BITEXACT))
+ s->dct_unquantize_mpeg2_intra = dct_unquantize_mpeg2_intra_mmx;
+ s->dct_unquantize_mpeg2_inter = dct_unquantize_mpeg2_inter_mmx;
+
+ if (mm_flags & AV_CPU_FLAG_SSE2) {
+ s->denoise_dct= denoise_dct_sse2;
+ } else {
+ s->denoise_dct= denoise_dct_mmx;
+ }
+ }
+#endif /* HAVE_INLINE_ASM */
+}
diff --git a/gst-libs/ext/libav/libavcodec/x86/mpegvideo_mmx.c b/gst-libs/ext/libav/libavcodec/x86/mpegvideo_mmx.c
deleted file mode 100644
index 7dd9a66..0000000
--- a/gst-libs/ext/libav/libavcodec/x86/mpegvideo_mmx.c
+++ /dev/null
@@ -1,665 +0,0 @@
-/*
- * The simplest mpeg encoder (well, it was the simplest!)
- * Copyright (c) 2000,2001 Fabrice Bellard
- *
- * Optimized for ia32 CPUs by Nick Kurshev <nickols_k@mail.ru>
- * h263, mpeg1, mpeg2 dequantizer & draw_edges by Michael Niedermayer <michaelni@gmx.at>
- *
- * 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
- */
-
-#include "libavutil/cpu.h"
-#include "libavutil/x86_cpu.h"
-#include "libavcodec/avcodec.h"
-#include "libavcodec/dsputil.h"
-#include "libavcodec/mpegvideo.h"
-#include "dsputil_mmx.h"
-
-extern uint16_t inv_zigzag_direct16[64];
-
-
-static void dct_unquantize_h263_intra_mmx(MpegEncContext *s,
- DCTELEM *block, int n, int qscale)
-{
- x86_reg level, qmul, qadd, nCoeffs;
-
- qmul = qscale << 1;
-
- assert(s->block_last_index[n]>=0 || s->h263_aic);
-
- if (!s->h263_aic) {
- if (n < 4)
- level = block[0] * s->y_dc_scale;
- else
- level = block[0] * s->c_dc_scale;
- qadd = (qscale - 1) | 1;
- }else{
- qadd = 0;
- level= block[0];
- }
- if(s->ac_pred)
- nCoeffs=63;
- else
- nCoeffs= s->inter_scantable.raster_end[ s->block_last_index[n] ];
-//printf("%d %d ", qmul, qadd);
-__asm__ volatile(
- "movd %1, %%mm6 \n\t" //qmul
- "packssdw %%mm6, %%mm6 \n\t"
- "packssdw %%mm6, %%mm6 \n\t"
- "movd %2, %%mm5 \n\t" //qadd
- "pxor %%mm7, %%mm7 \n\t"
- "packssdw %%mm5, %%mm5 \n\t"
- "packssdw %%mm5, %%mm5 \n\t"
- "psubw %%mm5, %%mm7 \n\t"
- "pxor %%mm4, %%mm4 \n\t"
- ".p2align 4 \n\t"
- "1: \n\t"
- "movq (%0, %3), %%mm0 \n\t"
- "movq 8(%0, %3), %%mm1 \n\t"
-
- "pmullw %%mm6, %%mm0 \n\t"
- "pmullw %%mm6, %%mm1 \n\t"
-
- "movq (%0, %3), %%mm2 \n\t"
- "movq 8(%0, %3), %%mm3 \n\t"
-
- "pcmpgtw %%mm4, %%mm2 \n\t" // block[i] < 0 ? -1 : 0
- "pcmpgtw %%mm4, %%mm3 \n\t" // block[i] < 0 ? -1 : 0
-
- "pxor %%mm2, %%mm0 \n\t"
- "pxor %%mm3, %%mm1 \n\t"
-
- "paddw %%mm7, %%mm0 \n\t"
- "paddw %%mm7, %%mm1 \n\t"
-
- "pxor %%mm0, %%mm2 \n\t"
- "pxor %%mm1, %%mm3 \n\t"
-
- "pcmpeqw %%mm7, %%mm0 \n\t" // block[i] == 0 ? -1 : 0
- "pcmpeqw %%mm7, %%mm1 \n\t" // block[i] == 0 ? -1 : 0
-
- "pandn %%mm2, %%mm0 \n\t"
- "pandn %%mm3, %%mm1 \n\t"
-
- "movq %%mm0, (%0, %3) \n\t"
- "movq %%mm1, 8(%0, %3) \n\t"
-
- "add $16, %3 \n\t"
- "jng 1b \n\t"
- ::"r" (block+nCoeffs), "rm"(qmul), "rm" (qadd), "r" (2*(-nCoeffs))
- : "memory"
- );
- block[0]= level;
-}
-
-
-static void dct_unquantize_h263_inter_mmx(MpegEncContext *s,
- DCTELEM *block, int n, int qscale)
-{
- x86_reg qmul, qadd, nCoeffs;
-
- qmul = qscale << 1;
- qadd = (qscale - 1) | 1;
-
- assert(s->block_last_index[n]>=0 || s->h263_aic);
-
- nCoeffs= s->inter_scantable.raster_end[ s->block_last_index[n] ];
-//printf("%d %d ", qmul, qadd);
-__asm__ volatile(
- "movd %1, %%mm6 \n\t" //qmul
- "packssdw %%mm6, %%mm6 \n\t"
- "packssdw %%mm6, %%mm6 \n\t"
- "movd %2, %%mm5 \n\t" //qadd
- "pxor %%mm7, %%mm7 \n\t"
- "packssdw %%mm5, %%mm5 \n\t"
- "packssdw %%mm5, %%mm5 \n\t"
- "psubw %%mm5, %%mm7 \n\t"
- "pxor %%mm4, %%mm4 \n\t"
- ".p2align 4 \n\t"
- "1: \n\t"
- "movq (%0, %3), %%mm0 \n\t"
- "movq 8(%0, %3), %%mm1 \n\t"
-
- "pmullw %%mm6, %%mm0 \n\t"
- "pmullw %%mm6, %%mm1 \n\t"
-
- "movq (%0, %3), %%mm2 \n\t"
- "movq 8(%0, %3), %%mm3 \n\t"
-
- "pcmpgtw %%mm4, %%mm2 \n\t" // block[i] < 0 ? -1 : 0
- "pcmpgtw %%mm4, %%mm3 \n\t" // block[i] < 0 ? -1 : 0
-
- "pxor %%mm2, %%mm0 \n\t"
- "pxor %%mm3, %%mm1 \n\t"
-
- "paddw %%mm7, %%mm0 \n\t"
- "paddw %%mm7, %%mm1 \n\t"
-
- "pxor %%mm0, %%mm2 \n\t"
- "pxor %%mm1, %%mm3 \n\t"
-
- "pcmpeqw %%mm7, %%mm0 \n\t" // block[i] == 0 ? -1 : 0
- "pcmpeqw %%mm7, %%mm1 \n\t" // block[i] == 0 ? -1 : 0
-
- "pandn %%mm2, %%mm0 \n\t"
- "pandn %%mm3, %%mm1 \n\t"
-
- "movq %%mm0, (%0, %3) \n\t"
- "movq %%mm1, 8(%0, %3) \n\t"
-
- "add $16, %3 \n\t"
- "jng 1b \n\t"
- ::"r" (block+nCoeffs), "rm"(qmul), "rm" (qadd), "r" (2*(-nCoeffs))
- : "memory"
- );
-}
-
-
-/*
- NK:
- Note: looking at PARANOID:
- "enable all paranoid tests for rounding, overflows, etc..."
-
-#ifdef PARANOID
- if (level < -2048 || level > 2047)
- fprintf(stderr, "unquant error %d %d\n", i, level);
-#endif
- We can suppose that result of two multiplications can't be greater than 0xFFFF
- i.e. is 16-bit, so we use here only PMULLW instruction and can avoid
- a complex multiplication.
-=====================================================
- Full formula for multiplication of 2 integer numbers
- which are represent as high:low words:
- input: value1 = high1:low1
- value2 = high2:low2
- output: value3 = value1*value2
- value3=high3:low3 (on overflow: modulus 2^32 wrap-around)
- this mean that for 0x123456 * 0x123456 correct result is 0x766cb0ce4
- but this algorithm will compute only 0x66cb0ce4
- this limited by 16-bit size of operands
- ---------------------------------
- tlow1 = high1*low2
- tlow2 = high2*low1
- tlow1 = tlow1 + tlow2
- high3:low3 = low1*low2
- high3 += tlow1
-*/
-static void dct_unquantize_mpeg1_intra_mmx(MpegEncContext *s,
- DCTELEM *block, int n, int qscale)
-{
- x86_reg nCoeffs;
- const uint16_t *quant_matrix;
- int block0;
-
- assert(s->block_last_index[n]>=0);
-
- nCoeffs= s->intra_scantable.raster_end[ s->block_last_index[n] ]+1;
-
- if (n < 4)
- block0 = block[0] * s->y_dc_scale;
- else
- block0 = block[0] * s->c_dc_scale;
- /* XXX: only mpeg1 */
- quant_matrix = s->intra_matrix;
-__asm__ volatile(
- "pcmpeqw %%mm7, %%mm7 \n\t"
- "psrlw $15, %%mm7 \n\t"
- "movd %2, %%mm6 \n\t"
- "packssdw %%mm6, %%mm6 \n\t"
- "packssdw %%mm6, %%mm6 \n\t"
- "mov %3, %%"REG_a" \n\t"
- ".p2align 4 \n\t"
- "1: \n\t"
- "movq (%0, %%"REG_a"), %%mm0 \n\t"
- "movq 8(%0, %%"REG_a"), %%mm1 \n\t"
- "movq (%1, %%"REG_a"), %%mm4 \n\t"
- "movq 8(%1, %%"REG_a"), %%mm5 \n\t"
- "pmullw %%mm6, %%mm4 \n\t" // q=qscale*quant_matrix[i]
- "pmullw %%mm6, %%mm5 \n\t" // q=qscale*quant_matrix[i]
- "pxor %%mm2, %%mm2 \n\t"
- "pxor %%mm3, %%mm3 \n\t"
- "pcmpgtw %%mm0, %%mm2 \n\t" // block[i] < 0 ? -1 : 0
- "pcmpgtw %%mm1, %%mm3 \n\t" // block[i] < 0 ? -1 : 0
- "pxor %%mm2, %%mm0 \n\t"
- "pxor %%mm3, %%mm1 \n\t"
- "psubw %%mm2, %%mm0 \n\t" // abs(block[i])
- "psubw %%mm3, %%mm1 \n\t" // abs(block[i])
- "pmullw %%mm4, %%mm0 \n\t" // abs(block[i])*q
- "pmullw %%mm5, %%mm1 \n\t" // abs(block[i])*q
- "pxor %%mm4, %%mm4 \n\t"
- "pxor %%mm5, %%mm5 \n\t" // FIXME slow
- "pcmpeqw (%0, %%"REG_a"), %%mm4 \n\t" // block[i] == 0 ? -1 : 0
- "pcmpeqw 8(%0, %%"REG_a"), %%mm5\n\t" // block[i] == 0 ? -1 : 0
- "psraw $3, %%mm0 \n\t"
- "psraw $3, %%mm1 \n\t"
- "psubw %%mm7, %%mm0 \n\t"
- "psubw %%mm7, %%mm1 \n\t"
- "por %%mm7, %%mm0 \n\t"
- "por %%mm7, %%mm1 \n\t"
- "pxor %%mm2, %%mm0 \n\t"
- "pxor %%mm3, %%mm1 \n\t"
- "psubw %%mm2, %%mm0 \n\t"
- "psubw %%mm3, %%mm1 \n\t"
- "pandn %%mm0, %%mm4 \n\t"
- "pandn %%mm1, %%mm5 \n\t"
- "movq %%mm4, (%0, %%"REG_a") \n\t"
- "movq %%mm5, 8(%0, %%"REG_a") \n\t"
-
- "add $16, %%"REG_a" \n\t"
- "js 1b \n\t"
- ::"r" (block+nCoeffs), "r"(quant_matrix+nCoeffs), "rm" (qscale), "g" (-2*nCoeffs)
- : "%"REG_a, "memory"
- );
- block[0]= block0;
-}
-
-static void dct_unquantize_mpeg1_inter_mmx(MpegEncContext *s,
- DCTELEM *block, int n, int qscale)
-{
- x86_reg nCoeffs;
- const uint16_t *quant_matrix;
-
- assert(s->block_last_index[n]>=0);
-
- nCoeffs= s->intra_scantable.raster_end[ s->block_last_index[n] ]+1;
-
- quant_matrix = s->inter_matrix;
-__asm__ volatile(
- "pcmpeqw %%mm7, %%mm7 \n\t"
- "psrlw $15, %%mm7 \n\t"
- "movd %2, %%mm6 \n\t"
- "packssdw %%mm6, %%mm6 \n\t"
- "packssdw %%mm6, %%mm6 \n\t"
- "mov %3, %%"REG_a" \n\t"
- ".p2align 4 \n\t"
- "1: \n\t"
- "movq (%0, %%"REG_a"), %%mm0 \n\t"
- "movq 8(%0, %%"REG_a"), %%mm1 \n\t"
- "movq (%1, %%"REG_a"), %%mm4 \n\t"
- "movq 8(%1, %%"REG_a"), %%mm5 \n\t"
- "pmullw %%mm6, %%mm4 \n\t" // q=qscale*quant_matrix[i]
- "pmullw %%mm6, %%mm5 \n\t" // q=qscale*quant_matrix[i]
- "pxor %%mm2, %%mm2 \n\t"
- "pxor %%mm3, %%mm3 \n\t"
- "pcmpgtw %%mm0, %%mm2 \n\t" // block[i] < 0 ? -1 : 0
- "pcmpgtw %%mm1, %%mm3 \n\t" // block[i] < 0 ? -1 : 0
- "pxor %%mm2, %%mm0 \n\t"
- "pxor %%mm3, %%mm1 \n\t"
- "psubw %%mm2, %%mm0 \n\t" // abs(block[i])
- "psubw %%mm3, %%mm1 \n\t" // abs(block[i])
- "paddw %%mm0, %%mm0 \n\t" // abs(block[i])*2
- "paddw %%mm1, %%mm1 \n\t" // abs(block[i])*2
- "paddw %%mm7, %%mm0 \n\t" // abs(block[i])*2 + 1
- "paddw %%mm7, %%mm1 \n\t" // abs(block[i])*2 + 1
- "pmullw %%mm4, %%mm0 \n\t" // (abs(block[i])*2 + 1)*q
- "pmullw %%mm5, %%mm1 \n\t" // (abs(block[i])*2 + 1)*q
- "pxor %%mm4, %%mm4 \n\t"
- "pxor %%mm5, %%mm5 \n\t" // FIXME slow
- "pcmpeqw (%0, %%"REG_a"), %%mm4 \n\t" // block[i] == 0 ? -1 : 0
- "pcmpeqw 8(%0, %%"REG_a"), %%mm5\n\t" // block[i] == 0 ? -1 : 0
- "psraw $4, %%mm0 \n\t"
- "psraw $4, %%mm1 \n\t"
- "psubw %%mm7, %%mm0 \n\t"
- "psubw %%mm7, %%mm1 \n\t"
- "por %%mm7, %%mm0 \n\t"
- "por %%mm7, %%mm1 \n\t"
- "pxor %%mm2, %%mm0 \n\t"
- "pxor %%mm3, %%mm1 \n\t"
- "psubw %%mm2, %%mm0 \n\t"
- "psubw %%mm3, %%mm1 \n\t"
- "pandn %%mm0, %%mm4 \n\t"
- "pandn %%mm1, %%mm5 \n\t"
- "movq %%mm4, (%0, %%"REG_a") \n\t"
- "movq %%mm5, 8(%0, %%"REG_a") \n\t"
-
- "add $16, %%"REG_a" \n\t"
- "js 1b \n\t"
- ::"r" (block+nCoeffs), "r"(quant_matrix+nCoeffs), "rm" (qscale), "g" (-2*nCoeffs)
- : "%"REG_a, "memory"
- );
-}
-
-static void dct_unquantize_mpeg2_intra_mmx(MpegEncContext *s,
- DCTELEM *block, int n, int qscale)
-{
- x86_reg nCoeffs;
- const uint16_t *quant_matrix;
- int block0;
-
- assert(s->block_last_index[n]>=0);
-
- if(s->alternate_scan) nCoeffs= 63; //FIXME
- else nCoeffs= s->intra_scantable.raster_end[ s->block_last_index[n] ];
-
- if (n < 4)
- block0 = block[0] * s->y_dc_scale;
- else
- block0 = block[0] * s->c_dc_scale;
- quant_matrix = s->intra_matrix;
-__asm__ volatile(
- "pcmpeqw %%mm7, %%mm7 \n\t"
- "psrlw $15, %%mm7 \n\t"
- "movd %2, %%mm6 \n\t"
- "packssdw %%mm6, %%mm6 \n\t"
- "packssdw %%mm6, %%mm6 \n\t"
- "mov %3, %%"REG_a" \n\t"
- ".p2align 4 \n\t"
- "1: \n\t"
- "movq (%0, %%"REG_a"), %%mm0 \n\t"
- "movq 8(%0, %%"REG_a"), %%mm1 \n\t"
- "movq (%1, %%"REG_a"), %%mm4 \n\t"
- "movq 8(%1, %%"REG_a"), %%mm5 \n\t"
- "pmullw %%mm6, %%mm4 \n\t" // q=qscale*quant_matrix[i]
- "pmullw %%mm6, %%mm5 \n\t" // q=qscale*quant_matrix[i]
- "pxor %%mm2, %%mm2 \n\t"
- "pxor %%mm3, %%mm3 \n\t"
- "pcmpgtw %%mm0, %%mm2 \n\t" // block[i] < 0 ? -1 : 0
- "pcmpgtw %%mm1, %%mm3 \n\t" // block[i] < 0 ? -1 : 0
- "pxor %%mm2, %%mm0 \n\t"
- "pxor %%mm3, %%mm1 \n\t"
- "psubw %%mm2, %%mm0 \n\t" // abs(block[i])
- "psubw %%mm3, %%mm1 \n\t" // abs(block[i])
- "pmullw %%mm4, %%mm0 \n\t" // abs(block[i])*q
- "pmullw %%mm5, %%mm1 \n\t" // abs(block[i])*q
- "pxor %%mm4, %%mm4 \n\t"
- "pxor %%mm5, %%mm5 \n\t" // FIXME slow
- "pcmpeqw (%0, %%"REG_a"), %%mm4 \n\t" // block[i] == 0 ? -1 : 0
- "pcmpeqw 8(%0, %%"REG_a"), %%mm5\n\t" // block[i] == 0 ? -1 : 0
- "psraw $3, %%mm0 \n\t"
- "psraw $3, %%mm1 \n\t"
- "pxor %%mm2, %%mm0 \n\t"
- "pxor %%mm3, %%mm1 \n\t"
- "psubw %%mm2, %%mm0 \n\t"
- "psubw %%mm3, %%mm1 \n\t"
- "pandn %%mm0, %%mm4 \n\t"
- "pandn %%mm1, %%mm5 \n\t"
- "movq %%mm4, (%0, %%"REG_a") \n\t"
- "movq %%mm5, 8(%0, %%"REG_a") \n\t"
-
- "add $16, %%"REG_a" \n\t"
- "jng 1b \n\t"
- ::"r" (block+nCoeffs), "r"(quant_matrix+nCoeffs), "rm" (qscale), "g" (-2*nCoeffs)
- : "%"REG_a, "memory"
- );
- block[0]= block0;
- //Note, we do not do mismatch control for intra as errors cannot accumulate
-}
-
-static void dct_unquantize_mpeg2_inter_mmx(MpegEncContext *s,
- DCTELEM *block, int n, int qscale)
-{
- x86_reg nCoeffs;
- const uint16_t *quant_matrix;
-
- assert(s->block_last_index[n]>=0);
-
- if(s->alternate_scan) nCoeffs= 63; //FIXME
- else nCoeffs= s->intra_scantable.raster_end[ s->block_last_index[n] ];
-
- quant_matrix = s->inter_matrix;
-__asm__ volatile(
- "pcmpeqw %%mm7, %%mm7 \n\t"
- "psrlq $48, %%mm7 \n\t"
- "movd %2, %%mm6 \n\t"
- "packssdw %%mm6, %%mm6 \n\t"
- "packssdw %%mm6, %%mm6 \n\t"
- "mov %3, %%"REG_a" \n\t"
- ".p2align 4 \n\t"
- "1: \n\t"
- "movq (%0, %%"REG_a"), %%mm0 \n\t"
- "movq 8(%0, %%"REG_a"), %%mm1 \n\t"
- "movq (%1, %%"REG_a"), %%mm4 \n\t"
- "movq 8(%1, %%"REG_a"), %%mm5 \n\t"
- "pmullw %%mm6, %%mm4 \n\t" // q=qscale*quant_matrix[i]
- "pmullw %%mm6, %%mm5 \n\t" // q=qscale*quant_matrix[i]
- "pxor %%mm2, %%mm2 \n\t"
- "pxor %%mm3, %%mm3 \n\t"
- "pcmpgtw %%mm0, %%mm2 \n\t" // block[i] < 0 ? -1 : 0
- "pcmpgtw %%mm1, %%mm3 \n\t" // block[i] < 0 ? -1 : 0
- "pxor %%mm2, %%mm0 \n\t"
- "pxor %%mm3, %%mm1 \n\t"
- "psubw %%mm2, %%mm0 \n\t" // abs(block[i])
- "psubw %%mm3, %%mm1 \n\t" // abs(block[i])
- "paddw %%mm0, %%mm0 \n\t" // abs(block[i])*2
- "paddw %%mm1, %%mm1 \n\t" // abs(block[i])*2
- "pmullw %%mm4, %%mm0 \n\t" // abs(block[i])*2*q
- "pmullw %%mm5, %%mm1 \n\t" // abs(block[i])*2*q
- "paddw %%mm4, %%mm0 \n\t" // (abs(block[i])*2 + 1)*q
- "paddw %%mm5, %%mm1 \n\t" // (abs(block[i])*2 + 1)*q
- "pxor %%mm4, %%mm4 \n\t"
- "pxor %%mm5, %%mm5 \n\t" // FIXME slow
- "pcmpeqw (%0, %%"REG_a"), %%mm4 \n\t" // block[i] == 0 ? -1 : 0
- "pcmpeqw 8(%0, %%"REG_a"), %%mm5\n\t" // block[i] == 0 ? -1 : 0
- "psrlw $4, %%mm0 \n\t"
- "psrlw $4, %%mm1 \n\t"
- "pxor %%mm2, %%mm0 \n\t"
- "pxor %%mm3, %%mm1 \n\t"
- "psubw %%mm2, %%mm0 \n\t"
- "psubw %%mm3, %%mm1 \n\t"
- "pandn %%mm0, %%mm4 \n\t"
- "pandn %%mm1, %%mm5 \n\t"
- "pxor %%mm4, %%mm7 \n\t"
- "pxor %%mm5, %%mm7 \n\t"
- "movq %%mm4, (%0, %%"REG_a") \n\t"
- "movq %%mm5, 8(%0, %%"REG_a") \n\t"
-
- "add $16, %%"REG_a" \n\t"
- "jng 1b \n\t"
- "movd 124(%0, %3), %%mm0 \n\t"
- "movq %%mm7, %%mm6 \n\t"
- "psrlq $32, %%mm7 \n\t"
- "pxor %%mm6, %%mm7 \n\t"
- "movq %%mm7, %%mm6 \n\t"
- "psrlq $16, %%mm7 \n\t"
- "pxor %%mm6, %%mm7 \n\t"
- "pslld $31, %%mm7 \n\t"
- "psrlq $15, %%mm7 \n\t"
- "pxor %%mm7, %%mm0 \n\t"
- "movd %%mm0, 124(%0, %3) \n\t"
-
- ::"r" (block+nCoeffs), "r"(quant_matrix+nCoeffs), "rm" (qscale), "r" (-2*nCoeffs)
- : "%"REG_a, "memory"
- );
-}
-
-static void denoise_dct_mmx(MpegEncContext *s, DCTELEM *block){
- const int intra= s->mb_intra;
- int *sum= s->dct_error_sum[intra];
- uint16_t *offset= s->dct_offset[intra];
-
- s->dct_count[intra]++;
-
- __asm__ volatile(
- "pxor %%mm7, %%mm7 \n\t"
- "1: \n\t"
- "pxor %%mm0, %%mm0 \n\t"
- "pxor %%mm1, %%mm1 \n\t"
- "movq (%0), %%mm2 \n\t"
- "movq 8(%0), %%mm3 \n\t"
- "pcmpgtw %%mm2, %%mm0 \n\t"
- "pcmpgtw %%mm3, %%mm1 \n\t"
- "pxor %%mm0, %%mm2 \n\t"
- "pxor %%mm1, %%mm3 \n\t"
- "psubw %%mm0, %%mm2 \n\t"
- "psubw %%mm1, %%mm3 \n\t"
- "movq %%mm2, %%mm4 \n\t"
- "movq %%mm3, %%mm5 \n\t"
- "psubusw (%2), %%mm2 \n\t"
- "psubusw 8(%2), %%mm3 \n\t"
- "pxor %%mm0, %%mm2 \n\t"
- "pxor %%mm1, %%mm3 \n\t"
- "psubw %%mm0, %%mm2 \n\t"
- "psubw %%mm1, %%mm3 \n\t"
- "movq %%mm2, (%0) \n\t"
- "movq %%mm3, 8(%0) \n\t"
- "movq %%mm4, %%mm2 \n\t"
- "movq %%mm5, %%mm3 \n\t"
- "punpcklwd %%mm7, %%mm4 \n\t"
- "punpckhwd %%mm7, %%mm2 \n\t"
- "punpcklwd %%mm7, %%mm5 \n\t"
- "punpckhwd %%mm7, %%mm3 \n\t"
- "paddd (%1), %%mm4 \n\t"
- "paddd 8(%1), %%mm2 \n\t"
- "paddd 16(%1), %%mm5 \n\t"
- "paddd 24(%1), %%mm3 \n\t"
- "movq %%mm4, (%1) \n\t"
- "movq %%mm2, 8(%1) \n\t"
- "movq %%mm5, 16(%1) \n\t"
- "movq %%mm3, 24(%1) \n\t"
- "add $16, %0 \n\t"
- "add $32, %1 \n\t"
- "add $16, %2 \n\t"
- "cmp %3, %0 \n\t"
- " jb 1b \n\t"
- : "+r" (block), "+r" (sum), "+r" (offset)
- : "r"(block+64)
- );
-}
-
-static void denoise_dct_sse2(MpegEncContext *s, DCTELEM *block){
- const int intra= s->mb_intra;
- int *sum= s->dct_error_sum[intra];
- uint16_t *offset= s->dct_offset[intra];
-
- s->dct_count[intra]++;
-
- __asm__ volatile(
- "pxor %%xmm7, %%xmm7 \n\t"
- "1: \n\t"
- "pxor %%xmm0, %%xmm0 \n\t"
- "pxor %%xmm1, %%xmm1 \n\t"
- "movdqa (%0), %%xmm2 \n\t"
- "movdqa 16(%0), %%xmm3 \n\t"
- "pcmpgtw %%xmm2, %%xmm0 \n\t"
- "pcmpgtw %%xmm3, %%xmm1 \n\t"
- "pxor %%xmm0, %%xmm2 \n\t"
- "pxor %%xmm1, %%xmm3 \n\t"
- "psubw %%xmm0, %%xmm2 \n\t"
- "psubw %%xmm1, %%xmm3 \n\t"
- "movdqa %%xmm2, %%xmm4 \n\t"
- "movdqa %%xmm3, %%xmm5 \n\t"
- "psubusw (%2), %%xmm2 \n\t"
- "psubusw 16(%2), %%xmm3 \n\t"
- "pxor %%xmm0, %%xmm2 \n\t"
- "pxor %%xmm1, %%xmm3 \n\t"
- "psubw %%xmm0, %%xmm2 \n\t"
- "psubw %%xmm1, %%xmm3 \n\t"
- "movdqa %%xmm2, (%0) \n\t"
- "movdqa %%xmm3, 16(%0) \n\t"
- "movdqa %%xmm4, %%xmm6 \n\t"
- "movdqa %%xmm5, %%xmm0 \n\t"
- "punpcklwd %%xmm7, %%xmm4 \n\t"
- "punpckhwd %%xmm7, %%xmm6 \n\t"
- "punpcklwd %%xmm7, %%xmm5 \n\t"
- "punpckhwd %%xmm7, %%xmm0 \n\t"
- "paddd (%1), %%xmm4 \n\t"
- "paddd 16(%1), %%xmm6 \n\t"
- "paddd 32(%1), %%xmm5 \n\t"
- "paddd 48(%1), %%xmm0 \n\t"
- "movdqa %%xmm4, (%1) \n\t"
- "movdqa %%xmm6, 16(%1) \n\t"
- "movdqa %%xmm5, 32(%1) \n\t"
- "movdqa %%xmm0, 48(%1) \n\t"
- "add $32, %0 \n\t"
- "add $64, %1 \n\t"
- "add $32, %2 \n\t"
- "cmp %3, %0 \n\t"
- " jb 1b \n\t"
- : "+r" (block), "+r" (sum), "+r" (offset)
- : "r"(block+64)
- XMM_CLOBBERS_ONLY("%xmm0", "%xmm1", "%xmm2", "%xmm3",
- "%xmm4", "%xmm5", "%xmm6", "%xmm7")
- );
-}
-
-#if HAVE_SSSE3
-#define HAVE_SSSE3_BAK
-#endif
-#undef HAVE_SSSE3
-#define HAVE_SSSE3 0
-
-#undef HAVE_SSE2
-#undef HAVE_MMX2
-#define HAVE_SSE2 0
-#define HAVE_MMX2 0
-#define RENAME(a) a ## _MMX
-#define RENAMEl(a) a ## _mmx
-#include "mpegvideo_mmx_template.c"
-
-#undef HAVE_MMX2
-#define HAVE_MMX2 1
-#undef RENAME
-#undef RENAMEl
-#define RENAME(a) a ## _MMX2
-#define RENAMEl(a) a ## _mmx2
-#include "mpegvideo_mmx_template.c"
-
-#undef HAVE_SSE2
-#define HAVE_SSE2 1
-#undef RENAME
-#undef RENAMEl
-#define RENAME(a) a ## _SSE2
-#define RENAMEl(a) a ## _sse2
-#include "mpegvideo_mmx_template.c"
-
-#ifdef HAVE_SSSE3_BAK
-#undef HAVE_SSSE3
-#define HAVE_SSSE3 1
-#undef RENAME
-#undef RENAMEl
-#define RENAME(a) a ## _SSSE3
-#define RENAMEl(a) a ## _sse2
-#include "mpegvideo_mmx_template.c"
-#endif
-
-void MPV_common_init_mmx(MpegEncContext *s)
-{
- int mm_flags = av_get_cpu_flags();
-
- if (mm_flags & AV_CPU_FLAG_MMX) {
- const int dct_algo = s->avctx->dct_algo;
-
- s->dct_unquantize_h263_intra = dct_unquantize_h263_intra_mmx;
- s->dct_unquantize_h263_inter = dct_unquantize_h263_inter_mmx;
- s->dct_unquantize_mpeg1_intra = dct_unquantize_mpeg1_intra_mmx;
- s->dct_unquantize_mpeg1_inter = dct_unquantize_mpeg1_inter_mmx;
- if(!(s->flags & CODEC_FLAG_BITEXACT))
- s->dct_unquantize_mpeg2_intra = dct_unquantize_mpeg2_intra_mmx;
- s->dct_unquantize_mpeg2_inter = dct_unquantize_mpeg2_inter_mmx;
-
- if (mm_flags & AV_CPU_FLAG_SSE2) {
- s->denoise_dct= denoise_dct_sse2;
- } else {
- s->denoise_dct= denoise_dct_mmx;
- }
-
- if(dct_algo==FF_DCT_AUTO || dct_algo==FF_DCT_MMX){
-#if HAVE_SSSE3
- if(mm_flags & AV_CPU_FLAG_SSSE3){
- s->dct_quantize= dct_quantize_SSSE3;
- } else
-#endif
- if(mm_flags & AV_CPU_FLAG_SSE2){
- s->dct_quantize= dct_quantize_SSE2;
- } else if(mm_flags & AV_CPU_FLAG_MMX2){
- s->dct_quantize= dct_quantize_MMX2;
- } else {
- s->dct_quantize= dct_quantize_MMX;
- }
- }
- }
-}
diff --git a/gst-libs/ext/libav/libavcodec/x86/mpegvideo_mmx_template.c b/gst-libs/ext/libav/libavcodec/x86/mpegvideo_mmx_template.c
deleted file mode 100644
index 0b6cff3..0000000
--- a/gst-libs/ext/libav/libavcodec/x86/mpegvideo_mmx_template.c
+++ /dev/null
@@ -1,369 +0,0 @@
-/*
- * MPEG video MMX templates
- *
- * Copyright (c) 2002 Michael Niedermayer <michaelni@gmx.at>
- *
- * 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
- */
-
-#undef MMREG_WIDTH
-#undef MM
-#undef MOVQ
-#undef SPREADW
-#undef PMAXW
-#undef PMAX
-#undef SAVE_SIGN
-#undef RESTORE_SIGN
-
-#if HAVE_SSE2
-#define MMREG_WIDTH "16"
-#define MM "%%xmm"
-#define MOVQ "movdqa"
-#define SPREADW(a) \
- "pshuflw $0, "a", "a" \n\t"\
- "punpcklwd "a", "a" \n\t"
-#define PMAXW(a,b) "pmaxsw "a", "b" \n\t"
-#define PMAX(a,b) \
- "movhlps "a", "b" \n\t"\
- PMAXW(b, a)\
- "pshuflw $0x0E, "a", "b" \n\t"\
- PMAXW(b, a)\
- "pshuflw $0x01, "a", "b" \n\t"\
- PMAXW(b, a)
-#else
-#define MMREG_WIDTH "8"
-#define MM "%%mm"
-#define MOVQ "movq"
-#if HAVE_MMX2
-#define SPREADW(a) "pshufw $0, "a", "a" \n\t"
-#define PMAXW(a,b) "pmaxsw "a", "b" \n\t"
-#define PMAX(a,b) \
- "pshufw $0x0E, "a", "b" \n\t"\
- PMAXW(b, a)\
- "pshufw $0x01, "a", "b" \n\t"\
- PMAXW(b, a)
-#else
-#define SPREADW(a) \
- "punpcklwd "a", "a" \n\t"\
- "punpcklwd "a", "a" \n\t"
-#define PMAXW(a,b) \
- "psubusw "a", "b" \n\t"\
- "paddw "a", "b" \n\t"
-#define PMAX(a,b) \
- "movq "a", "b" \n\t"\
- "psrlq $32, "a" \n\t"\
- PMAXW(b, a)\
- "movq "a", "b" \n\t"\
- "psrlq $16, "a" \n\t"\
- PMAXW(b, a)
-
-#endif
-#endif
-
-#if HAVE_SSSE3
-#define SAVE_SIGN(a,b) \
- "movdqa "b", "a" \n\t"\
- "pabsw "b", "b" \n\t"
-#define RESTORE_SIGN(a,b) \
- "psignw "a", "b" \n\t"
-#else
-#define SAVE_SIGN(a,b) \
- "pxor "a", "a" \n\t"\
- "pcmpgtw "b", "a" \n\t" /* block[i] <= 0 ? 0xFF : 0x00 */\
- "pxor "a", "b" \n\t"\
- "psubw "a", "b" \n\t" /* ABS(block[i]) */
-#define RESTORE_SIGN(a,b) \
- "pxor "a", "b" \n\t"\
- "psubw "a", "b" \n\t" // out=((ABS(block[i])*qmat[0] - bias[0]*qmat[0])>>16)*sign(block[i])
-#endif
-
-static int RENAME(dct_quantize)(MpegEncContext *s,
- DCTELEM *block, int n,
- int qscale, int *overflow)
-{
- x86_reg last_non_zero_p1;
- int level=0, q; //=0 is because gcc says uninitialized ...
- const uint16_t *qmat, *bias;
- LOCAL_ALIGNED_16(int16_t, temp_block, [64]);
-
- assert((7&(int)(&temp_block[0])) == 0); //did gcc align it correctly?
-
- //s->fdct (block);
- RENAMEl(ff_fdct) (block); //cannot be anything else ...
-
- if(s->dct_error_sum)
- s->denoise_dct(s, block);
-
- if (s->mb_intra) {
- int dummy;
- if (n < 4)
- q = s->y_dc_scale;
- else
- q = s->c_dc_scale;
- /* note: block[0] is assumed to be positive */
- if (!s->h263_aic) {
- __asm__ volatile (
- "mul %%ecx \n\t"
- : "=d" (level), "=a"(dummy)
- : "a" ((block[0]>>2) + q), "c" (ff_inverse[q<<1])
- );
- } else
- /* For AIC we skip quant/dequant of INTRADC */
- level = (block[0] + 4)>>3;
-
- block[0]=0; //avoid fake overflow
-// temp_block[0] = (block[0] + (q >> 1)) / q;
- last_non_zero_p1 = 1;
- bias = s->q_intra_matrix16[qscale][1];
- qmat = s->q_intra_matrix16[qscale][0];
- } else {
- last_non_zero_p1 = 0;
- bias = s->q_inter_matrix16[qscale][1];
- qmat = s->q_inter_matrix16[qscale][0];
- }
-
- if((s->out_format == FMT_H263 || s->out_format == FMT_H261) && s->mpeg_quant==0){
-
- __asm__ volatile(
- "movd %%"REG_a", "MM"3 \n\t" // last_non_zero_p1
- SPREADW(MM"3")
- "pxor "MM"7, "MM"7 \n\t" // 0
- "pxor "MM"4, "MM"4 \n\t" // 0
- MOVQ" (%2), "MM"5 \n\t" // qmat[0]
- "pxor "MM"6, "MM"6 \n\t"
- "psubw (%3), "MM"6 \n\t" // -bias[0]
- "mov $-128, %%"REG_a" \n\t"
- ".p2align 4 \n\t"
- "1: \n\t"
- MOVQ" (%1, %%"REG_a"), "MM"0 \n\t" // block[i]
- SAVE_SIGN(MM"1", MM"0") // ABS(block[i])
- "psubusw "MM"6, "MM"0 \n\t" // ABS(block[i]) + bias[0]
- "pmulhw "MM"5, "MM"0 \n\t" // (ABS(block[i])*qmat[0] - bias[0]*qmat[0])>>16
- "por "MM"0, "MM"4 \n\t"
- RESTORE_SIGN(MM"1", MM"0") // out=((ABS(block[i])*qmat[0] - bias[0]*qmat[0])>>16)*sign(block[i])
- MOVQ" "MM"0, (%5, %%"REG_a") \n\t"
- "pcmpeqw "MM"7, "MM"0 \n\t" // out==0 ? 0xFF : 0x00
- MOVQ" (%4, %%"REG_a"), "MM"1 \n\t"
- MOVQ" "MM"7, (%1, %%"REG_a") \n\t" // 0
- "pandn "MM"1, "MM"0 \n\t"
- PMAXW(MM"0", MM"3")
- "add $"MMREG_WIDTH", %%"REG_a" \n\t"
- " js 1b \n\t"
- PMAX(MM"3", MM"0")
- "movd "MM"3, %%"REG_a" \n\t"
- "movzb %%al, %%"REG_a" \n\t" // last_non_zero_p1
- : "+a" (last_non_zero_p1)
- : "r" (block+64), "r" (qmat), "r" (bias),
- "r" (inv_zigzag_direct16+64), "r" (temp_block+64)
- XMM_CLOBBERS_ONLY("%xmm0", "%xmm1", "%xmm2", "%xmm3",
- "%xmm4", "%xmm5", "%xmm6", "%xmm7")
- );
- }else{ // FMT_H263
- __asm__ volatile(
- "movd %%"REG_a", "MM"3 \n\t" // last_non_zero_p1
- SPREADW(MM"3")
- "pxor "MM"7, "MM"7 \n\t" // 0
- "pxor "MM"4, "MM"4 \n\t" // 0
- "mov $-128, %%"REG_a" \n\t"
- ".p2align 4 \n\t"
- "1: \n\t"
- MOVQ" (%1, %%"REG_a"), "MM"0 \n\t" // block[i]
- SAVE_SIGN(MM"1", MM"0") // ABS(block[i])
- MOVQ" (%3, %%"REG_a"), "MM"6 \n\t" // bias[0]
- "paddusw "MM"6, "MM"0 \n\t" // ABS(block[i]) + bias[0]
- MOVQ" (%2, %%"REG_a"), "MM"5 \n\t" // qmat[i]
- "pmulhw "MM"5, "MM"0 \n\t" // (ABS(block[i])*qmat[0] + bias[0]*qmat[0])>>16
- "por "MM"0, "MM"4 \n\t"
- RESTORE_SIGN(MM"1", MM"0") // out=((ABS(block[i])*qmat[0] - bias[0]*qmat[0])>>16)*sign(block[i])
- MOVQ" "MM"0, (%5, %%"REG_a") \n\t"
- "pcmpeqw "MM"7, "MM"0 \n\t" // out==0 ? 0xFF : 0x00
- MOVQ" (%4, %%"REG_a"), "MM"1 \n\t"
- MOVQ" "MM"7, (%1, %%"REG_a") \n\t" // 0
- "pandn "MM"1, "MM"0 \n\t"
- PMAXW(MM"0", MM"3")
- "add $"MMREG_WIDTH", %%"REG_a" \n\t"
- " js 1b \n\t"
- PMAX(MM"3", MM"0")
- "movd "MM"3, %%"REG_a" \n\t"
- "movzb %%al, %%"REG_a" \n\t" // last_non_zero_p1
- : "+a" (last_non_zero_p1)
- : "r" (block+64), "r" (qmat+64), "r" (bias+64),
- "r" (inv_zigzag_direct16+64), "r" (temp_block+64)
- XMM_CLOBBERS_ONLY("%xmm0", "%xmm1", "%xmm2", "%xmm3",
- "%xmm4", "%xmm5", "%xmm6", "%xmm7")
- );
- }
- __asm__ volatile(
- "movd %1, "MM"1 \n\t" // max_qcoeff
- SPREADW(MM"1")
- "psubusw "MM"1, "MM"4 \n\t"
- "packuswb "MM"4, "MM"4 \n\t"
-#if HAVE_SSE2
- "packuswb "MM"4, "MM"4 \n\t"
-#endif
- "movd "MM"4, %0 \n\t" // *overflow
- : "=g" (*overflow)
- : "g" (s->max_qcoeff)
- );
-
- if(s->mb_intra) block[0]= level;
- else block[0]= temp_block[0];
-
- if(s->dsp.idct_permutation_type == FF_SIMPLE_IDCT_PERM){
- if(last_non_zero_p1 <= 1) goto end;
- block[0x08] = temp_block[0x01]; block[0x10] = temp_block[0x08];
- block[0x20] = temp_block[0x10];
- if(last_non_zero_p1 <= 4) goto end;
- block[0x18] = temp_block[0x09]; block[0x04] = temp_block[0x02];
- block[0x09] = temp_block[0x03];
- if(last_non_zero_p1 <= 7) goto end;
- block[0x14] = temp_block[0x0A]; block[0x28] = temp_block[0x11];
- block[0x12] = temp_block[0x18]; block[0x02] = temp_block[0x20];
- if(last_non_zero_p1 <= 11) goto end;
- block[0x1A] = temp_block[0x19]; block[0x24] = temp_block[0x12];
- block[0x19] = temp_block[0x0B]; block[0x01] = temp_block[0x04];
- block[0x0C] = temp_block[0x05];
- if(last_non_zero_p1 <= 16) goto end;
- block[0x11] = temp_block[0x0C]; block[0x29] = temp_block[0x13];
- block[0x16] = temp_block[0x1A]; block[0x0A] = temp_block[0x21];
- block[0x30] = temp_block[0x28]; block[0x22] = temp_block[0x30];
- block[0x38] = temp_block[0x29]; block[0x06] = temp_block[0x22];
- if(last_non_zero_p1 <= 24) goto end;
- block[0x1B] = temp_block[0x1B]; block[0x21] = temp_block[0x14];
- block[0x1C] = temp_block[0x0D]; block[0x05] = temp_block[0x06];
- block[0x0D] = temp_block[0x07]; block[0x15] = temp_block[0x0E];
- block[0x2C] = temp_block[0x15]; block[0x13] = temp_block[0x1C];
- if(last_non_zero_p1 <= 32) goto end;
- block[0x0B] = temp_block[0x23]; block[0x34] = temp_block[0x2A];
- block[0x2A] = temp_block[0x31]; block[0x32] = temp_block[0x38];
- block[0x3A] = temp_block[0x39]; block[0x26] = temp_block[0x32];
- block[0x39] = temp_block[0x2B]; block[0x03] = temp_block[0x24];
- if(last_non_zero_p1 <= 40) goto end;
- block[0x1E] = temp_block[0x1D]; block[0x25] = temp_block[0x16];
- block[0x1D] = temp_block[0x0F]; block[0x2D] = temp_block[0x17];
- block[0x17] = temp_block[0x1E]; block[0x0E] = temp_block[0x25];
- block[0x31] = temp_block[0x2C]; block[0x2B] = temp_block[0x33];
- if(last_non_zero_p1 <= 48) goto end;
- block[0x36] = temp_block[0x3A]; block[0x3B] = temp_block[0x3B];
- block[0x23] = temp_block[0x34]; block[0x3C] = temp_block[0x2D];
- block[0x07] = temp_block[0x26]; block[0x1F] = temp_block[0x1F];
- block[0x0F] = temp_block[0x27]; block[0x35] = temp_block[0x2E];
- if(last_non_zero_p1 <= 56) goto end;
- block[0x2E] = temp_block[0x35]; block[0x33] = temp_block[0x3C];
- block[0x3E] = temp_block[0x3D]; block[0x27] = temp_block[0x36];
- block[0x3D] = temp_block[0x2F]; block[0x2F] = temp_block[0x37];
- block[0x37] = temp_block[0x3E]; block[0x3F] = temp_block[0x3F];
- }else if(s->dsp.idct_permutation_type == FF_LIBMPEG2_IDCT_PERM){
- if(last_non_zero_p1 <= 1) goto end;
- block[0x04] = temp_block[0x01];
- block[0x08] = temp_block[0x08]; block[0x10] = temp_block[0x10];
- if(last_non_zero_p1 <= 4) goto end;
- block[0x0C] = temp_block[0x09]; block[0x01] = temp_block[0x02];
- block[0x05] = temp_block[0x03];
- if(last_non_zero_p1 <= 7) goto end;
- block[0x09] = temp_block[0x0A]; block[0x14] = temp_block[0x11];
- block[0x18] = temp_block[0x18]; block[0x20] = temp_block[0x20];
- if(last_non_zero_p1 <= 11) goto end;
- block[0x1C] = temp_block[0x19];
- block[0x11] = temp_block[0x12]; block[0x0D] = temp_block[0x0B];
- block[0x02] = temp_block[0x04]; block[0x06] = temp_block[0x05];
- if(last_non_zero_p1 <= 16) goto end;
- block[0x0A] = temp_block[0x0C]; block[0x15] = temp_block[0x13];
- block[0x19] = temp_block[0x1A]; block[0x24] = temp_block[0x21];
- block[0x28] = temp_block[0x28]; block[0x30] = temp_block[0x30];
- block[0x2C] = temp_block[0x29]; block[0x21] = temp_block[0x22];
- if(last_non_zero_p1 <= 24) goto end;
- block[0x1D] = temp_block[0x1B]; block[0x12] = temp_block[0x14];
- block[0x0E] = temp_block[0x0D]; block[0x03] = temp_block[0x06];
- block[0x07] = temp_block[0x07]; block[0x0B] = temp_block[0x0E];
- block[0x16] = temp_block[0x15]; block[0x1A] = temp_block[0x1C];
- if(last_non_zero_p1 <= 32) goto end;
- block[0x25] = temp_block[0x23]; block[0x29] = temp_block[0x2A];
- block[0x34] = temp_block[0x31]; block[0x38] = temp_block[0x38];
- block[0x3C] = temp_block[0x39]; block[0x31] = temp_block[0x32];
- block[0x2D] = temp_block[0x2B]; block[0x22] = temp_block[0x24];
- if(last_non_zero_p1 <= 40) goto end;
- block[0x1E] = temp_block[0x1D]; block[0x13] = temp_block[0x16];
- block[0x0F] = temp_block[0x0F]; block[0x17] = temp_block[0x17];
- block[0x1B] = temp_block[0x1E]; block[0x26] = temp_block[0x25];
- block[0x2A] = temp_block[0x2C]; block[0x35] = temp_block[0x33];
- if(last_non_zero_p1 <= 48) goto end;
- block[0x39] = temp_block[0x3A]; block[0x3D] = temp_block[0x3B];
- block[0x32] = temp_block[0x34]; block[0x2E] = temp_block[0x2D];
- block[0x23] = temp_block[0x26]; block[0x1F] = temp_block[0x1F];
- block[0x27] = temp_block[0x27]; block[0x2B] = temp_block[0x2E];
- if(last_non_zero_p1 <= 56) goto end;
- block[0x36] = temp_block[0x35]; block[0x3A] = temp_block[0x3C];
- block[0x3E] = temp_block[0x3D]; block[0x33] = temp_block[0x36];
- block[0x2F] = temp_block[0x2F]; block[0x37] = temp_block[0x37];
- block[0x3B] = temp_block[0x3E]; block[0x3F] = temp_block[0x3F];
- }else{
- if(last_non_zero_p1 <= 1) goto end;
- block[0x01] = temp_block[0x01];
- block[0x08] = temp_block[0x08]; block[0x10] = temp_block[0x10];
- if(last_non_zero_p1 <= 4) goto end;
- block[0x09] = temp_block[0x09]; block[0x02] = temp_block[0x02];
- block[0x03] = temp_block[0x03];
- if(last_non_zero_p1 <= 7) goto end;
- block[0x0A] = temp_block[0x0A]; block[0x11] = temp_block[0x11];
- block[0x18] = temp_block[0x18]; block[0x20] = temp_block[0x20];
- if(last_non_zero_p1 <= 11) goto end;
- block[0x19] = temp_block[0x19];
- block[0x12] = temp_block[0x12]; block[0x0B] = temp_block[0x0B];
- block[0x04] = temp_block[0x04]; block[0x05] = temp_block[0x05];
- if(last_non_zero_p1 <= 16) goto end;
- block[0x0C] = temp_block[0x0C]; block[0x13] = temp_block[0x13];
- block[0x1A] = temp_block[0x1A]; block[0x21] = temp_block[0x21];
- block[0x28] = temp_block[0x28]; block[0x30] = temp_block[0x30];
- block[0x29] = temp_block[0x29]; block[0x22] = temp_block[0x22];
- if(last_non_zero_p1 <= 24) goto end;
- block[0x1B] = temp_block[0x1B]; block[0x14] = temp_block[0x14];
- block[0x0D] = temp_block[0x0D]; block[0x06] = temp_block[0x06];
- block[0x07] = temp_block[0x07]; block[0x0E] = temp_block[0x0E];
- block[0x15] = temp_block[0x15]; block[0x1C] = temp_block[0x1C];
- if(last_non_zero_p1 <= 32) goto end;
- block[0x23] = temp_block[0x23]; block[0x2A] = temp_block[0x2A];
- block[0x31] = temp_block[0x31]; block[0x38] = temp_block[0x38];
- block[0x39] = temp_block[0x39]; block[0x32] = temp_block[0x32];
- block[0x2B] = temp_block[0x2B]; block[0x24] = temp_block[0x24];
- if(last_non_zero_p1 <= 40) goto end;
- block[0x1D] = temp_block[0x1D]; block[0x16] = temp_block[0x16];
- block[0x0F] = temp_block[0x0F]; block[0x17] = temp_block[0x17];
- block[0x1E] = temp_block[0x1E]; block[0x25] = temp_block[0x25];
- block[0x2C] = temp_block[0x2C]; block[0x33] = temp_block[0x33];
- if(last_non_zero_p1 <= 48) goto end;
- block[0x3A] = temp_block[0x3A]; block[0x3B] = temp_block[0x3B];
- block[0x34] = temp_block[0x34]; block[0x2D] = temp_block[0x2D];
- block[0x26] = temp_block[0x26]; block[0x1F] = temp_block[0x1F];
- block[0x27] = temp_block[0x27]; block[0x2E] = temp_block[0x2E];
- if(last_non_zero_p1 <= 56) goto end;
- block[0x35] = temp_block[0x35]; block[0x3C] = temp_block[0x3C];
- block[0x3D] = temp_block[0x3D]; block[0x36] = temp_block[0x36];
- block[0x2F] = temp_block[0x2F]; block[0x37] = temp_block[0x37];
- block[0x3E] = temp_block[0x3E]; block[0x3F] = temp_block[0x3F];
- }
- end:
-/*
- for(i=0; i<last_non_zero_p1; i++)
- {
- int j= zigzag_direct_noperm[i];
- block[block_permute_op(j)]= temp_block[j];
- }
-*/
-
- return last_non_zero_p1 - 1;
-}
diff --git a/gst-libs/ext/libav/libavcodec/x86/mpegvideoenc.c b/gst-libs/ext/libav/libavcodec/x86/mpegvideoenc.c
new file mode 100644
index 0000000..8f7c2e4
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/x86/mpegvideoenc.c
@@ -0,0 +1,106 @@
+/*
+ * The simplest mpeg encoder (well, it was the simplest!)
+ * Copyright (c) 2000,2001 Fabrice Bellard
+ *
+ * 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
+ */
+
+#include "libavutil/cpu.h"
+#include "libavutil/x86/asm.h"
+#include "libavutil/x86/cpu.h"
+#include "libavcodec/avcodec.h"
+#include "libavcodec/dsputil.h"
+#include "libavcodec/mpegvideo.h"
+#include "dsputil_mmx.h"
+
+extern uint16_t ff_inv_zigzag_direct16[64];
+
+#if HAVE_MMX_INLINE
+#define COMPILE_TEMPLATE_MMXEXT 0
+#define COMPILE_TEMPLATE_SSE2 0
+#define COMPILE_TEMPLATE_SSSE3 0
+#define RENAME(a) a ## _MMX
+#define RENAMEl(a) a ## _mmx
+#include "mpegvideoenc_template.c"
+#endif /* HAVE_MMX_INLINE */
+
+#if HAVE_MMXEXT_INLINE
+#undef COMPILE_TEMPLATE_SSSE3
+#undef COMPILE_TEMPLATE_SSE2
+#undef COMPILE_TEMPLATE_MMXEXT
+#define COMPILE_TEMPLATE_MMXEXT 1
+#define COMPILE_TEMPLATE_SSE2 0
+#define COMPILE_TEMPLATE_SSSE3 0
+#undef RENAME
+#undef RENAMEl
+#define RENAME(a) a ## _MMXEXT
+#define RENAMEl(a) a ## _mmxext
+#include "mpegvideoenc_template.c"
+#endif /* HAVE_MMXEXT_INLINE */
+
+#if HAVE_SSE2_INLINE
+#undef COMPILE_TEMPLATE_MMXEXT
+#undef COMPILE_TEMPLATE_SSE2
+#undef COMPILE_TEMPLATE_SSSE3
+#define COMPILE_TEMPLATE_MMXEXT 0
+#define COMPILE_TEMPLATE_SSE2 1
+#define COMPILE_TEMPLATE_SSSE3 0
+#undef RENAME
+#undef RENAMEl
+#define RENAME(a) a ## _SSE2
+#define RENAMEl(a) a ## _sse2
+#include "mpegvideoenc_template.c"
+#endif /* HAVE_SSE2_INLINE */
+
+#if HAVE_SSSE3_INLINE
+#undef COMPILE_TEMPLATE_MMXEXT
+#undef COMPILE_TEMPLATE_SSE2
+#undef COMPILE_TEMPLATE_SSSE3
+#define COMPILE_TEMPLATE_MMXEXT 0
+#define COMPILE_TEMPLATE_SSE2 1
+#define COMPILE_TEMPLATE_SSSE3 1
+#undef RENAME
+#undef RENAMEl
+#define RENAME(a) a ## _SSSE3
+#define RENAMEl(a) a ## _sse2
+#include "mpegvideoenc_template.c"
+#endif /* HAVE_SSSE3_INLINE */
+
+void ff_MPV_encode_init_x86(MpegEncContext *s)
+{
+ int mm_flags = av_get_cpu_flags();
+ const int dct_algo = s->avctx->dct_algo;
+
+ if (dct_algo == FF_DCT_AUTO || dct_algo == FF_DCT_MMX) {
+#if HAVE_MMX_INLINE
+ if (INLINE_MMX(mm_flags))
+ s->dct_quantize = dct_quantize_MMX;
+#endif
+#if HAVE_MMXEXT_INLINE
+ if (INLINE_MMXEXT(mm_flags))
+ s->dct_quantize = dct_quantize_MMXEXT;
+#endif
+#if HAVE_SSE2_INLINE
+ if (INLINE_SSE2(mm_flags))
+ s->dct_quantize = dct_quantize_SSE2;
+#endif
+#if HAVE_SSSE3_INLINE
+ if (INLINE_SSSE3(mm_flags))
+ s->dct_quantize = dct_quantize_SSSE3;
+#endif
+ }
+}
diff --git a/gst-libs/ext/libav/libavcodec/x86/mpegvideoenc_template.c b/gst-libs/ext/libav/libavcodec/x86/mpegvideoenc_template.c
new file mode 100644
index 0000000..a6e7ba4
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/x86/mpegvideoenc_template.c
@@ -0,0 +1,361 @@
+/*
+ * MPEG video MMX templates
+ *
+ * Copyright (c) 2002 Michael Niedermayer <michaelni@gmx.at>
+ *
+ * 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
+ */
+
+#undef MMREG_WIDTH
+#undef MM
+#undef MOVQ
+#undef SPREADW
+#undef PMAXW
+#undef PMAX
+#undef SAVE_SIGN
+#undef RESTORE_SIGN
+
+#if COMPILE_TEMPLATE_SSE2
+#define MMREG_WIDTH "16"
+#define MM "%%xmm"
+#define MOVQ "movdqa"
+#define SPREADW(a) \
+ "pshuflw $0, "a", "a" \n\t"\
+ "punpcklwd "a", "a" \n\t"
+#define PMAXW(a,b) "pmaxsw "a", "b" \n\t"
+#define PMAX(a,b) \
+ "movhlps "a", "b" \n\t"\
+ PMAXW(b, a)\
+ "pshuflw $0x0E, "a", "b" \n\t"\
+ PMAXW(b, a)\
+ "pshuflw $0x01, "a", "b" \n\t"\
+ PMAXW(b, a)
+#else
+#define MMREG_WIDTH "8"
+#define MM "%%mm"
+#define MOVQ "movq"
+#if COMPILE_TEMPLATE_MMXEXT
+#define SPREADW(a) "pshufw $0, "a", "a" \n\t"
+#define PMAXW(a,b) "pmaxsw "a", "b" \n\t"
+#define PMAX(a,b) \
+ "pshufw $0x0E, "a", "b" \n\t"\
+ PMAXW(b, a)\
+ "pshufw $0x01, "a", "b" \n\t"\
+ PMAXW(b, a)
+#else
+#define SPREADW(a) \
+ "punpcklwd "a", "a" \n\t"\
+ "punpcklwd "a", "a" \n\t"
+#define PMAXW(a,b) \
+ "psubusw "a", "b" \n\t"\
+ "paddw "a", "b" \n\t"
+#define PMAX(a,b) \
+ "movq "a", "b" \n\t"\
+ "psrlq $32, "a" \n\t"\
+ PMAXW(b, a)\
+ "movq "a", "b" \n\t"\
+ "psrlq $16, "a" \n\t"\
+ PMAXW(b, a)
+
+#endif
+#endif
+
+#if COMPILE_TEMPLATE_SSSE3
+#define SAVE_SIGN(a,b) \
+ "movdqa "b", "a" \n\t"\
+ "pabsw "b", "b" \n\t"
+#define RESTORE_SIGN(a,b) \
+ "psignw "a", "b" \n\t"
+#else
+#define SAVE_SIGN(a,b) \
+ "pxor "a", "a" \n\t"\
+ "pcmpgtw "b", "a" \n\t" /* block[i] <= 0 ? 0xFF : 0x00 */\
+ "pxor "a", "b" \n\t"\
+ "psubw "a", "b" \n\t" /* ABS(block[i]) */
+#define RESTORE_SIGN(a,b) \
+ "pxor "a", "b" \n\t"\
+ "psubw "a", "b" \n\t" // out=((ABS(block[i])*qmat[0] - bias[0]*qmat[0])>>16)*sign(block[i])
+#endif
+
+static int RENAME(dct_quantize)(MpegEncContext *s,
+ DCTELEM *block, int n,
+ int qscale, int *overflow)
+{
+ x86_reg last_non_zero_p1;
+ int level=0, q; //=0 is because gcc says uninitialized ...
+ const uint16_t *qmat, *bias;
+ LOCAL_ALIGNED_16(int16_t, temp_block, [64]);
+
+ assert((7&(int)(&temp_block[0])) == 0); //did gcc align it correctly?
+
+ //s->fdct (block);
+ RENAMEl(ff_fdct) (block); //cannot be anything else ...
+
+ if(s->dct_error_sum)
+ s->denoise_dct(s, block);
+
+ if (s->mb_intra) {
+ int dummy;
+ if (n < 4)
+ q = s->y_dc_scale;
+ else
+ q = s->c_dc_scale;
+ /* note: block[0] is assumed to be positive */
+ if (!s->h263_aic) {
+ __asm__ volatile (
+ "mul %%ecx \n\t"
+ : "=d" (level), "=a"(dummy)
+ : "a" ((block[0]>>2) + q), "c" (ff_inverse[q<<1])
+ );
+ } else
+ /* For AIC we skip quant/dequant of INTRADC */
+ level = (block[0] + 4)>>3;
+
+ block[0]=0; //avoid fake overflow
+// temp_block[0] = (block[0] + (q >> 1)) / q;
+ last_non_zero_p1 = 1;
+ bias = s->q_intra_matrix16[qscale][1];
+ qmat = s->q_intra_matrix16[qscale][0];
+ } else {
+ last_non_zero_p1 = 0;
+ bias = s->q_inter_matrix16[qscale][1];
+ qmat = s->q_inter_matrix16[qscale][0];
+ }
+
+ if((s->out_format == FMT_H263 || s->out_format == FMT_H261) && s->mpeg_quant==0){
+
+ __asm__ volatile(
+ "movd %%"REG_a", "MM"3 \n\t" // last_non_zero_p1
+ SPREADW(MM"3")
+ "pxor "MM"7, "MM"7 \n\t" // 0
+ "pxor "MM"4, "MM"4 \n\t" // 0
+ MOVQ" (%2), "MM"5 \n\t" // qmat[0]
+ "pxor "MM"6, "MM"6 \n\t"
+ "psubw (%3), "MM"6 \n\t" // -bias[0]
+ "mov $-128, %%"REG_a" \n\t"
+ ".p2align 4 \n\t"
+ "1: \n\t"
+ MOVQ" (%1, %%"REG_a"), "MM"0 \n\t" // block[i]
+ SAVE_SIGN(MM"1", MM"0") // ABS(block[i])
+ "psubusw "MM"6, "MM"0 \n\t" // ABS(block[i]) + bias[0]
+ "pmulhw "MM"5, "MM"0 \n\t" // (ABS(block[i])*qmat[0] - bias[0]*qmat[0])>>16
+ "por "MM"0, "MM"4 \n\t"
+ RESTORE_SIGN(MM"1", MM"0") // out=((ABS(block[i])*qmat[0] - bias[0]*qmat[0])>>16)*sign(block[i])
+ MOVQ" "MM"0, (%5, %%"REG_a") \n\t"
+ "pcmpeqw "MM"7, "MM"0 \n\t" // out==0 ? 0xFF : 0x00
+ MOVQ" (%4, %%"REG_a"), "MM"1 \n\t"
+ MOVQ" "MM"7, (%1, %%"REG_a") \n\t" // 0
+ "pandn "MM"1, "MM"0 \n\t"
+ PMAXW(MM"0", MM"3")
+ "add $"MMREG_WIDTH", %%"REG_a" \n\t"
+ " js 1b \n\t"
+ PMAX(MM"3", MM"0")
+ "movd "MM"3, %%"REG_a" \n\t"
+ "movzb %%al, %%"REG_a" \n\t" // last_non_zero_p1
+ : "+a" (last_non_zero_p1)
+ : "r" (block+64), "r" (qmat), "r" (bias),
+ "r" (ff_inv_zigzag_direct16+64), "r" (temp_block+64)
+ XMM_CLOBBERS_ONLY("%xmm0", "%xmm1", "%xmm2", "%xmm3",
+ "%xmm4", "%xmm5", "%xmm6", "%xmm7")
+ );
+ }else{ // FMT_H263
+ __asm__ volatile(
+ "movd %%"REG_a", "MM"3 \n\t" // last_non_zero_p1
+ SPREADW(MM"3")
+ "pxor "MM"7, "MM"7 \n\t" // 0
+ "pxor "MM"4, "MM"4 \n\t" // 0
+ "mov $-128, %%"REG_a" \n\t"
+ ".p2align 4 \n\t"
+ "1: \n\t"
+ MOVQ" (%1, %%"REG_a"), "MM"0 \n\t" // block[i]
+ SAVE_SIGN(MM"1", MM"0") // ABS(block[i])
+ MOVQ" (%3, %%"REG_a"), "MM"6 \n\t" // bias[0]
+ "paddusw "MM"6, "MM"0 \n\t" // ABS(block[i]) + bias[0]
+ MOVQ" (%2, %%"REG_a"), "MM"5 \n\t" // qmat[i]
+ "pmulhw "MM"5, "MM"0 \n\t" // (ABS(block[i])*qmat[0] + bias[0]*qmat[0])>>16
+ "por "MM"0, "MM"4 \n\t"
+ RESTORE_SIGN(MM"1", MM"0") // out=((ABS(block[i])*qmat[0] - bias[0]*qmat[0])>>16)*sign(block[i])
+ MOVQ" "MM"0, (%5, %%"REG_a") \n\t"
+ "pcmpeqw "MM"7, "MM"0 \n\t" // out==0 ? 0xFF : 0x00
+ MOVQ" (%4, %%"REG_a"), "MM"1 \n\t"
+ MOVQ" "MM"7, (%1, %%"REG_a") \n\t" // 0
+ "pandn "MM"1, "MM"0 \n\t"
+ PMAXW(MM"0", MM"3")
+ "add $"MMREG_WIDTH", %%"REG_a" \n\t"
+ " js 1b \n\t"
+ PMAX(MM"3", MM"0")
+ "movd "MM"3, %%"REG_a" \n\t"
+ "movzb %%al, %%"REG_a" \n\t" // last_non_zero_p1
+ : "+a" (last_non_zero_p1)
+ : "r" (block+64), "r" (qmat+64), "r" (bias+64),
+ "r" (ff_inv_zigzag_direct16+64), "r" (temp_block+64)
+ XMM_CLOBBERS_ONLY("%xmm0", "%xmm1", "%xmm2", "%xmm3",
+ "%xmm4", "%xmm5", "%xmm6", "%xmm7")
+ );
+ }
+ __asm__ volatile(
+ "movd %1, "MM"1 \n\t" // max_qcoeff
+ SPREADW(MM"1")
+ "psubusw "MM"1, "MM"4 \n\t"
+ "packuswb "MM"4, "MM"4 \n\t"
+#if COMPILE_TEMPLATE_SSE2
+ "packuswb "MM"4, "MM"4 \n\t"
+#endif
+ "movd "MM"4, %0 \n\t" // *overflow
+ : "=g" (*overflow)
+ : "g" (s->max_qcoeff)
+ );
+
+ if(s->mb_intra) block[0]= level;
+ else block[0]= temp_block[0];
+
+ if(s->dsp.idct_permutation_type == FF_SIMPLE_IDCT_PERM){
+ if(last_non_zero_p1 <= 1) goto end;
+ block[0x08] = temp_block[0x01]; block[0x10] = temp_block[0x08];
+ block[0x20] = temp_block[0x10];
+ if(last_non_zero_p1 <= 4) goto end;
+ block[0x18] = temp_block[0x09]; block[0x04] = temp_block[0x02];
+ block[0x09] = temp_block[0x03];
+ if(last_non_zero_p1 <= 7) goto end;
+ block[0x14] = temp_block[0x0A]; block[0x28] = temp_block[0x11];
+ block[0x12] = temp_block[0x18]; block[0x02] = temp_block[0x20];
+ if(last_non_zero_p1 <= 11) goto end;
+ block[0x1A] = temp_block[0x19]; block[0x24] = temp_block[0x12];
+ block[0x19] = temp_block[0x0B]; block[0x01] = temp_block[0x04];
+ block[0x0C] = temp_block[0x05];
+ if(last_non_zero_p1 <= 16) goto end;
+ block[0x11] = temp_block[0x0C]; block[0x29] = temp_block[0x13];
+ block[0x16] = temp_block[0x1A]; block[0x0A] = temp_block[0x21];
+ block[0x30] = temp_block[0x28]; block[0x22] = temp_block[0x30];
+ block[0x38] = temp_block[0x29]; block[0x06] = temp_block[0x22];
+ if(last_non_zero_p1 <= 24) goto end;
+ block[0x1B] = temp_block[0x1B]; block[0x21] = temp_block[0x14];
+ block[0x1C] = temp_block[0x0D]; block[0x05] = temp_block[0x06];
+ block[0x0D] = temp_block[0x07]; block[0x15] = temp_block[0x0E];
+ block[0x2C] = temp_block[0x15]; block[0x13] = temp_block[0x1C];
+ if(last_non_zero_p1 <= 32) goto end;
+ block[0x0B] = temp_block[0x23]; block[0x34] = temp_block[0x2A];
+ block[0x2A] = temp_block[0x31]; block[0x32] = temp_block[0x38];
+ block[0x3A] = temp_block[0x39]; block[0x26] = temp_block[0x32];
+ block[0x39] = temp_block[0x2B]; block[0x03] = temp_block[0x24];
+ if(last_non_zero_p1 <= 40) goto end;
+ block[0x1E] = temp_block[0x1D]; block[0x25] = temp_block[0x16];
+ block[0x1D] = temp_block[0x0F]; block[0x2D] = temp_block[0x17];
+ block[0x17] = temp_block[0x1E]; block[0x0E] = temp_block[0x25];
+ block[0x31] = temp_block[0x2C]; block[0x2B] = temp_block[0x33];
+ if(last_non_zero_p1 <= 48) goto end;
+ block[0x36] = temp_block[0x3A]; block[0x3B] = temp_block[0x3B];
+ block[0x23] = temp_block[0x34]; block[0x3C] = temp_block[0x2D];
+ block[0x07] = temp_block[0x26]; block[0x1F] = temp_block[0x1F];
+ block[0x0F] = temp_block[0x27]; block[0x35] = temp_block[0x2E];
+ if(last_non_zero_p1 <= 56) goto end;
+ block[0x2E] = temp_block[0x35]; block[0x33] = temp_block[0x3C];
+ block[0x3E] = temp_block[0x3D]; block[0x27] = temp_block[0x36];
+ block[0x3D] = temp_block[0x2F]; block[0x2F] = temp_block[0x37];
+ block[0x37] = temp_block[0x3E]; block[0x3F] = temp_block[0x3F];
+ }else if(s->dsp.idct_permutation_type == FF_LIBMPEG2_IDCT_PERM){
+ if(last_non_zero_p1 <= 1) goto end;
+ block[0x04] = temp_block[0x01];
+ block[0x08] = temp_block[0x08]; block[0x10] = temp_block[0x10];
+ if(last_non_zero_p1 <= 4) goto end;
+ block[0x0C] = temp_block[0x09]; block[0x01] = temp_block[0x02];
+ block[0x05] = temp_block[0x03];
+ if(last_non_zero_p1 <= 7) goto end;
+ block[0x09] = temp_block[0x0A]; block[0x14] = temp_block[0x11];
+ block[0x18] = temp_block[0x18]; block[0x20] = temp_block[0x20];
+ if(last_non_zero_p1 <= 11) goto end;
+ block[0x1C] = temp_block[0x19];
+ block[0x11] = temp_block[0x12]; block[0x0D] = temp_block[0x0B];
+ block[0x02] = temp_block[0x04]; block[0x06] = temp_block[0x05];
+ if(last_non_zero_p1 <= 16) goto end;
+ block[0x0A] = temp_block[0x0C]; block[0x15] = temp_block[0x13];
+ block[0x19] = temp_block[0x1A]; block[0x24] = temp_block[0x21];
+ block[0x28] = temp_block[0x28]; block[0x30] = temp_block[0x30];
+ block[0x2C] = temp_block[0x29]; block[0x21] = temp_block[0x22];
+ if(last_non_zero_p1 <= 24) goto end;
+ block[0x1D] = temp_block[0x1B]; block[0x12] = temp_block[0x14];
+ block[0x0E] = temp_block[0x0D]; block[0x03] = temp_block[0x06];
+ block[0x07] = temp_block[0x07]; block[0x0B] = temp_block[0x0E];
+ block[0x16] = temp_block[0x15]; block[0x1A] = temp_block[0x1C];
+ if(last_non_zero_p1 <= 32) goto end;
+ block[0x25] = temp_block[0x23]; block[0x29] = temp_block[0x2A];
+ block[0x34] = temp_block[0x31]; block[0x38] = temp_block[0x38];
+ block[0x3C] = temp_block[0x39]; block[0x31] = temp_block[0x32];
+ block[0x2D] = temp_block[0x2B]; block[0x22] = temp_block[0x24];
+ if(last_non_zero_p1 <= 40) goto end;
+ block[0x1E] = temp_block[0x1D]; block[0x13] = temp_block[0x16];
+ block[0x0F] = temp_block[0x0F]; block[0x17] = temp_block[0x17];
+ block[0x1B] = temp_block[0x1E]; block[0x26] = temp_block[0x25];
+ block[0x2A] = temp_block[0x2C]; block[0x35] = temp_block[0x33];
+ if(last_non_zero_p1 <= 48) goto end;
+ block[0x39] = temp_block[0x3A]; block[0x3D] = temp_block[0x3B];
+ block[0x32] = temp_block[0x34]; block[0x2E] = temp_block[0x2D];
+ block[0x23] = temp_block[0x26]; block[0x1F] = temp_block[0x1F];
+ block[0x27] = temp_block[0x27]; block[0x2B] = temp_block[0x2E];
+ if(last_non_zero_p1 <= 56) goto end;
+ block[0x36] = temp_block[0x35]; block[0x3A] = temp_block[0x3C];
+ block[0x3E] = temp_block[0x3D]; block[0x33] = temp_block[0x36];
+ block[0x2F] = temp_block[0x2F]; block[0x37] = temp_block[0x37];
+ block[0x3B] = temp_block[0x3E]; block[0x3F] = temp_block[0x3F];
+ }else{
+ if(last_non_zero_p1 <= 1) goto end;
+ block[0x01] = temp_block[0x01];
+ block[0x08] = temp_block[0x08]; block[0x10] = temp_block[0x10];
+ if(last_non_zero_p1 <= 4) goto end;
+ block[0x09] = temp_block[0x09]; block[0x02] = temp_block[0x02];
+ block[0x03] = temp_block[0x03];
+ if(last_non_zero_p1 <= 7) goto end;
+ block[0x0A] = temp_block[0x0A]; block[0x11] = temp_block[0x11];
+ block[0x18] = temp_block[0x18]; block[0x20] = temp_block[0x20];
+ if(last_non_zero_p1 <= 11) goto end;
+ block[0x19] = temp_block[0x19];
+ block[0x12] = temp_block[0x12]; block[0x0B] = temp_block[0x0B];
+ block[0x04] = temp_block[0x04]; block[0x05] = temp_block[0x05];
+ if(last_non_zero_p1 <= 16) goto end;
+ block[0x0C] = temp_block[0x0C]; block[0x13] = temp_block[0x13];
+ block[0x1A] = temp_block[0x1A]; block[0x21] = temp_block[0x21];
+ block[0x28] = temp_block[0x28]; block[0x30] = temp_block[0x30];
+ block[0x29] = temp_block[0x29]; block[0x22] = temp_block[0x22];
+ if(last_non_zero_p1 <= 24) goto end;
+ block[0x1B] = temp_block[0x1B]; block[0x14] = temp_block[0x14];
+ block[0x0D] = temp_block[0x0D]; block[0x06] = temp_block[0x06];
+ block[0x07] = temp_block[0x07]; block[0x0E] = temp_block[0x0E];
+ block[0x15] = temp_block[0x15]; block[0x1C] = temp_block[0x1C];
+ if(last_non_zero_p1 <= 32) goto end;
+ block[0x23] = temp_block[0x23]; block[0x2A] = temp_block[0x2A];
+ block[0x31] = temp_block[0x31]; block[0x38] = temp_block[0x38];
+ block[0x39] = temp_block[0x39]; block[0x32] = temp_block[0x32];
+ block[0x2B] = temp_block[0x2B]; block[0x24] = temp_block[0x24];
+ if(last_non_zero_p1 <= 40) goto end;
+ block[0x1D] = temp_block[0x1D]; block[0x16] = temp_block[0x16];
+ block[0x0F] = temp_block[0x0F]; block[0x17] = temp_block[0x17];
+ block[0x1E] = temp_block[0x1E]; block[0x25] = temp_block[0x25];
+ block[0x2C] = temp_block[0x2C]; block[0x33] = temp_block[0x33];
+ if(last_non_zero_p1 <= 48) goto end;
+ block[0x3A] = temp_block[0x3A]; block[0x3B] = temp_block[0x3B];
+ block[0x34] = temp_block[0x34]; block[0x2D] = temp_block[0x2D];
+ block[0x26] = temp_block[0x26]; block[0x1F] = temp_block[0x1F];
+ block[0x27] = temp_block[0x27]; block[0x2E] = temp_block[0x2E];
+ if(last_non_zero_p1 <= 56) goto end;
+ block[0x35] = temp_block[0x35]; block[0x3C] = temp_block[0x3C];
+ block[0x3D] = temp_block[0x3D]; block[0x36] = temp_block[0x36];
+ block[0x2F] = temp_block[0x2F]; block[0x37] = temp_block[0x37];
+ block[0x3E] = temp_block[0x3E]; block[0x3F] = temp_block[0x3F];
+ }
+ end:
+ return last_non_zero_p1 - 1;
+}
diff --git a/gst-libs/ext/libav/libavcodec/x86/pngdsp.asm b/gst-libs/ext/libav/libavcodec/x86/pngdsp.asm
new file mode 100644
index 0000000..c05f3da
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/x86/pngdsp.asm
@@ -0,0 +1,173 @@
+;******************************************************************************
+;* x86 optimizations for PNG decoding
+;*
+;* Copyright (c) 2008 Loren Merritt <lorenm@u.washington.edu>
+;* Copyright (c) 2012 Ronald S. Bultje <rsbultje@gmail.com>
+;*
+;* 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
+;* 51, Inc., Foundation Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+;******************************************************************************
+
+%include "libavutil/x86/x86util.asm"
+
+SECTION_RODATA
+
+cextern pw_255
+
+SECTION_TEXT
+
+; %1 = nr. of xmm registers used
+%macro ADD_BYTES_FN 1
+cglobal add_bytes_l2, 4, 6, %1, dst, src1, src2, wa, w, i
+%if ARCH_X86_64
+ movsxd waq, wad
+%endif
+ xor iq, iq
+
+ ; vector loop
+ mov wq, waq
+ and waq, ~(mmsize*2-1)
+ jmp .end_v
+.loop_v:
+ mova m0, [src1q+iq]
+ mova m1, [src1q+iq+mmsize]
+ paddb m0, [src2q+iq]
+ paddb m1, [src2q+iq+mmsize]
+ mova [dstq+iq ], m0
+ mova [dstq+iq+mmsize], m1
+ add iq, mmsize*2
+.end_v:
+ cmp iq, waq
+ jl .loop_v
+
+%if mmsize == 16
+ ; vector loop
+ mov waq, wq
+ and waq, ~7
+ jmp .end_l
+.loop_l:
+ movq mm0, [src1q+iq]
+ paddb mm0, [src2q+iq]
+ movq [dstq+iq ], mm0
+ add iq, 8
+.end_l:
+ cmp iq, waq
+ jl .loop_l
+%endif
+
+ ; scalar loop for leftover
+ jmp .end_s
+.loop_s:
+ mov wab, [src1q+iq]
+ add wab, [src2q+iq]
+ mov [dstq+iq], wab
+ inc iq
+.end_s:
+ cmp iq, wq
+ jl .loop_s
+ REP_RET
+%endmacro
+
+%if ARCH_X86_32
+INIT_MMX mmx
+ADD_BYTES_FN 0
+%endif
+
+INIT_XMM sse2
+ADD_BYTES_FN 2
+
+%macro ADD_PAETH_PRED_FN 1
+cglobal add_png_paeth_prediction, 5, 7, %1, dst, src, top, w, bpp, end, cntr
+%if ARCH_X86_64
+ movsxd bppq, bppd
+ movsxd wq, wd
+%endif
+ lea endq, [dstq+wq-(mmsize/2-1)]
+ sub topq, dstq
+ sub srcq, dstq
+ sub dstq, bppq
+ pxor m7, m7
+
+ PUSH dstq
+ lea cntrq, [bppq-1]
+ shr cntrq, 2 + mmsize/16
+.bpp_loop:
+ lea dstq, [dstq+cntrq*(mmsize/2)]
+ movh m0, [dstq]
+ movh m1, [topq+dstq]
+ punpcklbw m0, m7
+ punpcklbw m1, m7
+ add dstq, bppq
+.loop:
+ mova m2, m1
+ movh m1, [topq+dstq]
+ mova m3, m2
+ punpcklbw m1, m7
+ mova m4, m2
+ psubw m3, m1
+ psubw m4, m0
+ mova m5, m3
+ paddw m5, m4
+%if cpuflag(ssse3)
+ pabsw m3, m3
+ pabsw m4, m4
+ pabsw m5, m5
+%else ; !cpuflag(ssse3)
+ psubw m7, m5
+ pmaxsw m5, m7
+ pxor m6, m6
+ pxor m7, m7
+ psubw m6, m3
+ psubw m7, m4
+ pmaxsw m3, m6
+ pmaxsw m4, m7
+ pxor m7, m7
+%endif ; cpuflag(ssse3)
+ mova m6, m4
+ pminsw m6, m5
+ pcmpgtw m3, m6
+ pcmpgtw m4, m5
+ mova m6, m4
+ pand m4, m3
+ pandn m6, m3
+ pandn m3, m0
+ movh m0, [srcq+dstq]
+ pand m6, m1
+ pand m2, m4
+ punpcklbw m0, m7
+ paddw m0, m6
+ paddw m3, m2
+ paddw m0, m3
+ pand m0, [pw_255]
+ mova m3, m0
+ packuswb m3, m3
+ movh [dstq], m3
+ add dstq, bppq
+ cmp dstq, endq
+ jle .loop
+
+ mov dstq, [rsp]
+ dec cntrq
+ jge .bpp_loop
+ POP dstq
+ RET
+%endmacro
+
+INIT_MMX mmxext
+ADD_PAETH_PRED_FN 0
+
+INIT_MMX ssse3
+ADD_PAETH_PRED_FN 0
diff --git a/gst-libs/ext/libav/libavcodec/x86/pngdsp_init.c b/gst-libs/ext/libav/libavcodec/x86/pngdsp_init.c
new file mode 100644
index 0000000..2e858fa
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/x86/pngdsp_init.c
@@ -0,0 +1,49 @@
+/*
+ * x86 PNG optimizations.
+ * Copyright (c) 2008 Loren Merrit <lorenm@u.washington.edu>
+ *
+ * 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
+ */
+
+#include "libavutil/common.h"
+#include "libavutil/x86/cpu.h"
+#include "libavcodec/pngdsp.h"
+
+void ff_add_png_paeth_prediction_mmxext(uint8_t *dst, uint8_t *src,
+ uint8_t *top, int w, int bpp);
+void ff_add_png_paeth_prediction_ssse3(uint8_t *dst, uint8_t *src,
+ uint8_t *top, int w, int bpp);
+void ff_add_bytes_l2_mmx (uint8_t *dst, uint8_t *src1,
+ uint8_t *src2, int w);
+void ff_add_bytes_l2_sse2(uint8_t *dst, uint8_t *src1,
+ uint8_t *src2, int w);
+
+void ff_pngdsp_init_x86(PNGDSPContext *dsp)
+{
+ int flags = av_get_cpu_flags();
+
+#if ARCH_X86_32
+ if (EXTERNAL_MMX(flags))
+ dsp->add_bytes_l2 = ff_add_bytes_l2_mmx;
+#endif
+ if (EXTERNAL_MMXEXT(flags))
+ dsp->add_paeth_prediction = ff_add_png_paeth_prediction_mmxext;
+ if (EXTERNAL_SSE2(flags))
+ dsp->add_bytes_l2 = ff_add_bytes_l2_sse2;
+ if (EXTERNAL_SSSE3(flags))
+ dsp->add_paeth_prediction = ff_add_png_paeth_prediction_ssse3;
+}
diff --git a/gst-libs/ext/libav/libavcodec/x86/proresdsp-init.c b/gst-libs/ext/libav/libavcodec/x86/proresdsp-init.c
deleted file mode 100644
index f202f9f..0000000
--- a/gst-libs/ext/libav/libavcodec/x86/proresdsp-init.c
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Apple ProRes compatible decoder
- *
- * Copyright (c) 2010-2011 Maxim Poliakovski
- *
- * 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
- */
-
-#include "libavcodec/proresdsp.h"
-
-void ff_prores_idct_put_10_sse2(uint16_t *dst, int linesize,
- DCTELEM *block, const int16_t *qmat);
-void ff_prores_idct_put_10_sse4(uint16_t *dst, int linesize,
- DCTELEM *block, const int16_t *qmat);
-void ff_prores_idct_put_10_avx (uint16_t *dst, int linesize,
- DCTELEM *block, const int16_t *qmat);
-
-void ff_proresdsp_x86_init(ProresDSPContext *dsp)
-{
-#if ARCH_X86_64 && HAVE_YASM
- int flags = av_get_cpu_flags();
-
- if (flags & AV_CPU_FLAG_SSE2) {
- dsp->idct_permutation_type = FF_TRANSPOSE_IDCT_PERM;
- dsp->idct_put = ff_prores_idct_put_10_sse2;
- }
-
- if (flags & AV_CPU_FLAG_SSE4) {
- dsp->idct_permutation_type = FF_TRANSPOSE_IDCT_PERM;
- dsp->idct_put = ff_prores_idct_put_10_sse4;
- }
-
-#if HAVE_AVX
- if (flags & AV_CPU_FLAG_AVX) {
- dsp->idct_permutation_type = FF_TRANSPOSE_IDCT_PERM;
- dsp->idct_put = ff_prores_idct_put_10_avx;
- }
-#endif /* HAVE_AVX */
-#endif /* ARCH_X86_64 && HAVE_YASM */
-}
diff --git a/gst-libs/ext/libav/libavcodec/x86/proresdsp.asm b/gst-libs/ext/libav/libavcodec/x86/proresdsp.asm
index 9365bf1..91e0800 100644
--- a/gst-libs/ext/libav/libavcodec/x86/proresdsp.asm
+++ b/gst-libs/ext/libav/libavcodec/x86/proresdsp.asm
@@ -21,8 +21,7 @@
;* 51, Inc., Foundation Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
;******************************************************************************
-%include "x86inc.asm"
-%include "x86util.asm"
+%include "libavutil/x86/x86util.asm"
%define W1sh2 22725 ; W1 = 90901 = 22725<<2 + 1
%define W2sh2 21407 ; W2 = 85627 = 21407<<2 - 1
@@ -32,7 +31,7 @@
%define W6sh2 8867 ; W6 = 35468 = 8867<<2
%define W7sh2 4520 ; W7 = 18081 = 4520<<2 + 1
-%ifdef ARCH_X86_64
+%if ARCH_X86_64
SECTION_RODATA
@@ -82,8 +81,7 @@ section .text align=16
; %1 = row or col (for rounding variable)
; %2 = number of bits to shift at the end
-; %3 = optimization
-%macro IDCT_1D 3
+%macro IDCT_1D 2
; a0 = (W4 * row[0]) + (1 << (15 - 1));
; a1 = a0;
; a2 = a0;
@@ -330,8 +328,8 @@ section .text align=16
; void prores_idct_put_10_<opt>(uint8_t *pixels, int stride,
; DCTELEM *block, const int16_t *qmat);
-%macro idct_put_fn 2
-cglobal prores_idct_put_10_%1, 4, 4, %2
+%macro idct_put_fn 1
+cglobal prores_idct_put_10, 4, 4, %1
movsxd r1, r1d
pxor m15, m15 ; zero
@@ -347,7 +345,7 @@ cglobal prores_idct_put_10_%1, 4, 4, %2
pmullw m13,[r3+64]
pmullw m12,[r3+96]
- IDCT_1D row, 17, %1
+ IDCT_1D row, 17
; transpose for second part of IDCT
TRANSPOSE8x8W 8, 0, 1, 2, 4, 11, 9, 10, 3
@@ -362,7 +360,7 @@ cglobal prores_idct_put_10_%1, 4, 4, %2
; for (i = 0; i < 8; i++)
; idctSparseColAdd(dest + i, line_size, block + i);
- IDCT_1D col, 20, %1
+ IDCT_1D col, 20
; clip/store
mova m6, [pw_512]
@@ -406,27 +404,25 @@ cglobal prores_idct_put_10_%1, 4, 4, %2
RET
%endmacro
-%macro signextend_sse2 3 ; dstlow, dsthigh, tmp
+%macro SIGNEXTEND 2-3
+%if cpuflag(sse4) ; dstlow, dsthigh
+ movhlps %2, %1
+ pmovsxwd %1, %1
+ pmovsxwd %2, %2
+%elif cpuflag(sse2) ; dstlow, dsthigh, tmp
pxor %3, %3
pcmpgtw %3, %1
mova %2, %1
punpcklwd %1, %3
punpckhwd %2, %3
+%endif
%endmacro
-%macro signextend_sse4 2-3 ; dstlow, dsthigh
- movhlps %2, %1
- pmovsxwd %1, %1
- pmovsxwd %2, %2
-%endmacro
-
-INIT_XMM
-%define SIGNEXTEND signextend_sse2
-idct_put_fn sse2, 16
-INIT_XMM
-%define SIGNEXTEND signextend_sse4
-idct_put_fn sse4, 16
-INIT_AVX
-idct_put_fn avx, 16
+INIT_XMM sse2
+idct_put_fn 16
+INIT_XMM sse4
+idct_put_fn 16
+INIT_XMM avx
+idct_put_fn 16
%endif
diff --git a/gst-libs/ext/libav/libavcodec/x86/proresdsp_init.c b/gst-libs/ext/libav/libavcodec/x86/proresdsp_init.c
new file mode 100644
index 0000000..46c26bd
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/x86/proresdsp_init.c
@@ -0,0 +1,53 @@
+/*
+ * Apple ProRes compatible decoder
+ *
+ * Copyright (c) 2010-2011 Maxim Poliakovski
+ *
+ * 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
+ */
+
+#include "libavutil/x86/cpu.h"
+#include "libavcodec/proresdsp.h"
+
+void ff_prores_idct_put_10_sse2(uint16_t *dst, int linesize,
+ DCTELEM *block, const int16_t *qmat);
+void ff_prores_idct_put_10_sse4(uint16_t *dst, int linesize,
+ DCTELEM *block, const int16_t *qmat);
+void ff_prores_idct_put_10_avx (uint16_t *dst, int linesize,
+ DCTELEM *block, const int16_t *qmat);
+
+void ff_proresdsp_x86_init(ProresDSPContext *dsp)
+{
+#if ARCH_X86_64
+ int flags = av_get_cpu_flags();
+
+ if (EXTERNAL_SSE2(flags)) {
+ dsp->idct_permutation_type = FF_TRANSPOSE_IDCT_PERM;
+ dsp->idct_put = ff_prores_idct_put_10_sse2;
+ }
+
+ if (EXTERNAL_SSE4(flags)) {
+ dsp->idct_permutation_type = FF_TRANSPOSE_IDCT_PERM;
+ dsp->idct_put = ff_prores_idct_put_10_sse4;
+ }
+
+ if (EXTERNAL_AVX(flags)) {
+ dsp->idct_permutation_type = FF_TRANSPOSE_IDCT_PERM;
+ dsp->idct_put = ff_prores_idct_put_10_avx;
+ }
+#endif /* ARCH_X86_64 */
+}
diff --git a/gst-libs/ext/libav/libavcodec/x86/rv34dsp.asm b/gst-libs/ext/libav/libavcodec/x86/rv34dsp.asm
index 2d2f6e1..c099ac5 100644
--- a/gst-libs/ext/libav/libavcodec/x86/rv34dsp.asm
+++ b/gst-libs/ext/libav/libavcodec/x86/rv34dsp.asm
@@ -19,8 +19,17 @@
;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
;******************************************************************************
-%include "x86inc.asm"
-%include "x86util.asm"
+%include "libavutil/x86/x86util.asm"
+
+SECTION_RODATA
+pw_row_coeffs: times 4 dw 13
+ times 4 dw 17
+ times 4 dw 7
+pd_512: times 2 dd 0x200
+pw_col_coeffs: dw 13, 13, 13, -13
+ dw 17, 7, 7, -17
+ dw 13, -13, 13, 13
+ dw -7, 17, -17, -7
SECTION .text
@@ -36,10 +45,10 @@ SECTION .text
%endmacro
%macro rv34_idct 1
-cglobal rv34_idct_%1_mmx2, 1, 2, 0
+cglobal rv34_idct_%1, 1, 2, 0
movsx r1, word [r0]
IDCT_DC r1
- movd m0, r1
+ movd m0, r1d
pshufw m0, m0, 0
movq [r0+ 0], m0
movq [r0+ 8], m0
@@ -48,18 +57,19 @@ cglobal rv34_idct_%1_mmx2, 1, 2, 0
REP_RET
%endmacro
-INIT_MMX
+INIT_MMX mmxext
%define IDCT_DC IDCT_DC_ROUND
rv34_idct dc
%define IDCT_DC IDCT_DC_NOROUND
rv34_idct dc_noround
; ff_rv34_idct_dc_add_mmx(uint8_t *dst, int stride, int dc);
-cglobal rv34_idct_dc_add_mmx, 3, 3
+INIT_MMX mmx
+cglobal rv34_idct_dc_add, 3, 3
; calculate DC
IDCT_DC_ROUND r2
pxor m1, m1
- movd m0, r2
+ movd m0, r2d
psubw m1, m0
packuswb m0, m0
packuswb m1, m1
@@ -88,15 +98,83 @@ cglobal rv34_idct_dc_add_mmx, 3, 3
movh [r2+r1], m5
RET
+; Load coeffs and perform row transform
+; Output: coeffs in mm[0467], rounder in mm5
+%macro ROW_TRANSFORM 1
+ pxor mm7, mm7
+ mova mm0, [%1+ 0*8]
+ mova mm1, [%1+ 1*8]
+ mova mm2, [%1+ 2*8]
+ mova mm3, [%1+ 3*8]
+ mova [%1+ 0*8], mm7
+ mova [%1+ 1*8], mm7
+ mova [%1+ 2*8], mm7
+ mova [%1+ 3*8], mm7
+ mova mm4, mm0
+ mova mm6, [pw_row_coeffs+ 0]
+ paddsw mm0, mm2 ; b0 + b2
+ psubsw mm4, mm2 ; b0 - b2
+ pmullw mm0, mm6 ; *13 = z0
+ pmullw mm4, mm6 ; *13 = z1
+ mova mm5, mm1
+ pmullw mm1, [pw_row_coeffs+ 8] ; b1*17
+ pmullw mm5, [pw_row_coeffs+16] ; b1* 7
+ mova mm7, mm3
+ pmullw mm3, [pw_row_coeffs+ 8] ; b3*17
+ pmullw mm7, [pw_row_coeffs+16] ; b3* 7
+ paddsw mm1, mm7 ; z3 = b1*17 + b3* 7
+ psubsw mm5, mm3 ; z2 = b1* 7 - b3*17
+ mova mm7, mm0
+ mova mm6, mm4
+ paddsw mm0, mm1 ; z0 + z3
+ psubsw mm7, mm1 ; z0 - z3
+ paddsw mm4, mm5 ; z1 + z2
+ psubsw mm6, mm5 ; z1 - z2
+ mova mm5, [pd_512] ; 0x200
+%endmacro
+
+; ff_rv34_idct_add_mmxext(uint8_t *dst, ptrdiff_t stride, DCTELEM *block);
+%macro COL_TRANSFORM 4
+ pshufw mm3, %2, 0xDD ; col. 1,3,1,3
+ pshufw %2, %2, 0x88 ; col. 0,2,0,2
+ pmaddwd %2, %3 ; 13*c0+13*c2 | 13*c0-13*c2 = z0 | z1
+ pmaddwd mm3, %4 ; 17*c1+ 7*c3 | 7*c1-17*c3 = z3 | z2
+ paddd %2, mm5
+ pshufw mm1, %2, 01001110b ; z1 | z0
+ pshufw mm2, mm3, 01001110b ; z2 | z3
+ paddd %2, mm3 ; z0+z3 | z1+z2
+ psubd mm1, mm2 ; z1-z2 | z0-z3
+ movd mm3, %1
+ psrad %2, 10
+ pxor mm2, mm2
+ psrad mm1, 10
+ punpcklbw mm3, mm2
+ packssdw %2, mm1
+ paddw %2, mm3
+ packuswb %2, %2
+ movd %1, %2
+%endmacro
+INIT_MMX mmxext
+cglobal rv34_idct_add, 3,3,0, d, s, b
+ ROW_TRANSFORM bq
+ COL_TRANSFORM [dq], mm0, [pw_col_coeffs+ 0], [pw_col_coeffs+ 8]
+ mova mm0, [pw_col_coeffs+ 0]
+ COL_TRANSFORM [dq+sq], mm4, mm0, [pw_col_coeffs+ 8]
+ mova mm4, [pw_col_coeffs+ 8]
+ lea dq, [dq + 2*sq]
+ COL_TRANSFORM [dq], mm6, mm0, mm4
+ COL_TRANSFORM [dq+sq], mm7, mm0, mm4
+ ret
+
; ff_rv34_idct_dc_add_sse4(uint8_t *dst, int stride, int dc);
-INIT_XMM
-cglobal rv34_idct_dc_add_sse4, 3, 3, 6
+INIT_XMM sse4
+cglobal rv34_idct_dc_add, 3, 3, 6
; load data
IDCT_DC_ROUND r2
pxor m1, m1
; calculate DC
- movd m0, r2
+ movd m0, r2d
lea r2, [r0+r1*2]
movd m2, [r0]
movd m3, [r0+r1]
diff --git a/gst-libs/ext/libav/libavcodec/x86/rv34dsp_init.c b/gst-libs/ext/libav/libavcodec/x86/rv34dsp_init.c
index f3d2e17..6b6cf91 100644
--- a/gst-libs/ext/libav/libavcodec/x86/rv34dsp_init.c
+++ b/gst-libs/ext/libav/libavcodec/x86/rv34dsp_init.c
@@ -20,26 +20,27 @@
*/
#include "libavutil/cpu.h"
-#include "libavutil/x86_cpu.h"
+#include "libavutil/x86/asm.h"
+#include "libavutil/x86/cpu.h"
#include "libavcodec/dsputil.h"
#include "libavcodec/rv34dsp.h"
-void ff_rv34_idct_dc_mmx2(DCTELEM *block);
-void ff_rv34_idct_dc_noround_mmx2(DCTELEM *block);
-void ff_rv34_idct_dc_add_mmx(uint8_t *dst, int stride, int dc);
-void ff_rv34_idct_dc_add_sse4(uint8_t *dst, int stride, int dc);
+void ff_rv34_idct_dc_mmxext(DCTELEM *block);
+void ff_rv34_idct_dc_noround_mmxext(DCTELEM *block);
+void ff_rv34_idct_dc_add_mmx(uint8_t *dst, ptrdiff_t stride, int dc);
+void ff_rv34_idct_dc_add_sse4(uint8_t *dst, ptrdiff_t stride, int dc);
+void ff_rv34_idct_add_mmxext(uint8_t *dst, ptrdiff_t stride, DCTELEM *block);
av_cold void ff_rv34dsp_init_x86(RV34DSPContext* c, DSPContext *dsp)
{
-#if HAVE_YASM
int mm_flags = av_get_cpu_flags();
- if (mm_flags & AV_CPU_FLAG_MMX)
+ if (EXTERNAL_MMX(mm_flags))
c->rv34_idct_dc_add = ff_rv34_idct_dc_add_mmx;
- if (mm_flags & AV_CPU_FLAG_MMX2) {
- c->rv34_inv_transform_dc = ff_rv34_idct_dc_noround_mmx2;
+ if (EXTERNAL_MMXEXT(mm_flags)) {
+ c->rv34_inv_transform_dc = ff_rv34_idct_dc_noround_mmxext;
+ c->rv34_idct_add = ff_rv34_idct_add_mmxext;
}
- if (mm_flags & AV_CPU_FLAG_SSE4)
+ if (EXTERNAL_SSE4(mm_flags))
c->rv34_idct_dc_add = ff_rv34_idct_dc_add_sse4;
-#endif
}
diff --git a/gst-libs/ext/libav/libavcodec/x86/rv40dsp.asm b/gst-libs/ext/libav/libavcodec/x86/rv40dsp.asm
new file mode 100644
index 0000000..7ec72be
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/x86/rv40dsp.asm
@@ -0,0 +1,505 @@
+;******************************************************************************
+;* MMX/SSE2-optimized functions for the RV40 decoder
+;* Copyright (c) 2010 Ronald S. Bultje <rsbultje@gmail.com>
+;* Copyright (c) 2010 Jason Garrett-Glaser <darkshikari@gmail.com>
+;* Copyright (C) 2012 Christophe Gisquet <christophe.gisquet@gmail.com>
+;*
+;* 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
+;******************************************************************************
+
+%include "libavutil/x86/x86util.asm"
+
+SECTION_RODATA
+
+align 16
+pw_1024: times 8 dw 1 << (16 - 6) ; pw_1024
+
+sixtap_filter_hb_m: times 8 db 1, -5
+ times 8 db 52, 20
+ ; multiplied by 2 to have the same shift
+ times 8 db 2, -10
+ times 8 db 40, 40
+ ; back to normal
+ times 8 db 1, -5
+ times 8 db 20, 52
+
+sixtap_filter_v_m: times 8 dw 1
+ times 8 dw -5
+ times 8 dw 52
+ times 8 dw 20
+ ; multiplied by 2 to have the same shift
+ times 8 dw 2
+ times 8 dw -10
+ times 8 dw 40
+ times 8 dw 40
+ ; back to normal
+ times 8 dw 1
+ times 8 dw -5
+ times 8 dw 20
+ times 8 dw 52
+
+%ifdef PIC
+%define sixtap_filter_hw picregq
+%define sixtap_filter_hb picregq
+%define sixtap_filter_v picregq
+%define npicregs 1
+%else
+%define sixtap_filter_hw sixtap_filter_hw_m
+%define sixtap_filter_hb sixtap_filter_hb_m
+%define sixtap_filter_v sixtap_filter_v_m
+%define npicregs 0
+%endif
+
+filter_h6_shuf1: db 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8
+filter_h6_shuf2: db 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10
+filter_h6_shuf3: db 5, 4, 6, 5, 7, 6, 8, 7, 9, 8, 10, 9, 11, 10, 12, 11
+
+cextern pw_32
+cextern pw_16
+cextern pw_512
+
+SECTION .text
+
+;-----------------------------------------------------------------------------
+; subpel MC functions:
+;
+; void [put|rv40]_rv40_qpel_[h|v]_<opt>(uint8_t *dst, int deststride,
+; uint8_t *src, int srcstride,
+; int len, int m);
+;----------------------------------------------------------------------
+%macro LOAD 2
+%if WIN64
+ movsxd %1q, %1d
+%endif
+%ifdef PIC
+ add %1q, picregq
+%else
+ add %1q, %2
+%endif
+%endmacro
+
+%macro STORE 3
+%ifidn %3, avg
+ movh %2, [dstq]
+%endif
+ packuswb %1, %1
+%ifidn %3, avg
+%if cpuflag(3dnow)
+ pavgusb %1, %2
+%else
+ pavgb %1, %2
+%endif
+%endif
+ movh [dstq], %1
+%endmacro
+
+%macro FILTER_V 1
+cglobal %1_rv40_qpel_v, 6,6+npicregs,12, dst, dststride, src, srcstride, height, my, picreg
+%ifdef PIC
+ lea picregq, [sixtap_filter_v_m]
+%endif
+ pxor m7, m7
+ LOAD my, sixtap_filter_v
+
+ ; read 5 lines
+ sub srcq, srcstrideq
+ sub srcq, srcstrideq
+ movh m0, [srcq]
+ movh m1, [srcq+srcstrideq]
+ movh m2, [srcq+srcstrideq*2]
+ lea srcq, [srcq+srcstrideq*2]
+ add srcq, srcstrideq
+ movh m3, [srcq]
+ movh m4, [srcq+srcstrideq]
+ punpcklbw m0, m7
+ punpcklbw m1, m7
+ punpcklbw m2, m7
+ punpcklbw m3, m7
+ punpcklbw m4, m7
+
+%ifdef m8
+ mova m8, [myq+ 0]
+ mova m9, [myq+16]
+ mova m10, [myq+32]
+ mova m11, [myq+48]
+%define COEFF05 m8
+%define COEFF14 m9
+%define COEFF2 m10
+%define COEFF3 m11
+%else
+%define COEFF05 [myq+ 0]
+%define COEFF14 [myq+16]
+%define COEFF2 [myq+32]
+%define COEFF3 [myq+48]
+%endif
+.nextrow:
+ mova m6, m1
+ movh m5, [srcq+2*srcstrideq] ; read new row
+ paddw m6, m4
+ punpcklbw m5, m7
+ pmullw m6, COEFF14
+ paddw m0, m5
+ pmullw m0, COEFF05
+ paddw m6, m0
+ mova m0, m1
+ paddw m6, [pw_32]
+ mova m1, m2
+ pmullw m2, COEFF2
+ paddw m6, m2
+ mova m2, m3
+ pmullw m3, COEFF3
+ paddw m6, m3
+
+ ; round/clip/store
+ mova m3, m4
+ psraw m6, 6
+ mova m4, m5
+ STORE m6, m5, %1
+
+ ; go to next line
+ add dstq, dststrideq
+ add srcq, srcstrideq
+ dec heightd ; next row
+ jg .nextrow
+ REP_RET
+%endmacro
+
+%macro FILTER_H 1
+cglobal %1_rv40_qpel_h, 6, 6+npicregs, 12, dst, dststride, src, srcstride, height, mx, picreg
+%ifdef PIC
+ lea picregq, [sixtap_filter_v_m]
+%endif
+ pxor m7, m7
+ LOAD mx, sixtap_filter_v
+ mova m6, [pw_32]
+%ifdef m8
+ mova m8, [mxq+ 0]
+ mova m9, [mxq+16]
+ mova m10, [mxq+32]
+ mova m11, [mxq+48]
+%define COEFF05 m8
+%define COEFF14 m9
+%define COEFF2 m10
+%define COEFF3 m11
+%else
+%define COEFF05 [mxq+ 0]
+%define COEFF14 [mxq+16]
+%define COEFF2 [mxq+32]
+%define COEFF3 [mxq+48]
+%endif
+.nextrow:
+ movq m0, [srcq-2]
+ movq m5, [srcq+3]
+ movq m1, [srcq-1]
+ movq m4, [srcq+2]
+ punpcklbw m0, m7
+ punpcklbw m5, m7
+ punpcklbw m1, m7
+ punpcklbw m4, m7
+ movq m2, [srcq-0]
+ movq m3, [srcq+1]
+ paddw m0, m5
+ paddw m1, m4
+ punpcklbw m2, m7
+ punpcklbw m3, m7
+ pmullw m0, COEFF05
+ pmullw m1, COEFF14
+ pmullw m2, COEFF2
+ pmullw m3, COEFF3
+ paddw m0, m6
+ paddw m1, m2
+ paddw m0, m3
+ paddw m0, m1
+ psraw m0, 6
+ STORE m0, m1, %1
+
+ ; go to next line
+ add dstq, dststrideq
+ add srcq, srcstrideq
+ dec heightd ; next row
+ jg .nextrow
+ REP_RET
+%endmacro
+
+%if ARCH_X86_32
+INIT_MMX mmx
+FILTER_V put
+FILTER_H put
+
+INIT_MMX mmxext
+FILTER_V avg
+FILTER_H avg
+
+INIT_MMX 3dnow
+FILTER_V avg
+FILTER_H avg
+%endif
+
+INIT_XMM sse2
+FILTER_H put
+FILTER_H avg
+FILTER_V put
+FILTER_V avg
+
+%macro FILTER_SSSE3 1
+cglobal %1_rv40_qpel_v, 6,6+npicregs,8, dst, dststride, src, srcstride, height, my, picreg
+%ifdef PIC
+ lea picregq, [sixtap_filter_hb_m]
+%endif
+
+ ; read 5 lines
+ sub srcq, srcstrideq
+ LOAD my, sixtap_filter_hb
+ sub srcq, srcstrideq
+ movh m0, [srcq]
+ movh m1, [srcq+srcstrideq]
+ movh m2, [srcq+srcstrideq*2]
+ lea srcq, [srcq+srcstrideq*2]
+ add srcq, srcstrideq
+ mova m5, [myq]
+ movh m3, [srcq]
+ movh m4, [srcq+srcstrideq]
+ lea srcq, [srcq+2*srcstrideq]
+
+.nextrow:
+ mova m6, m2
+ punpcklbw m0, m1
+ punpcklbw m6, m3
+ pmaddubsw m0, m5
+ pmaddubsw m6, [myq+16]
+ movh m7, [srcq] ; read new row
+ paddw m6, m0
+ mova m0, m1
+ mova m1, m2
+ mova m2, m3
+ mova m3, m4
+ mova m4, m7
+ punpcklbw m7, m3
+ pmaddubsw m7, m5
+ paddw m6, m7
+ pmulhrsw m6, [pw_512]
+ STORE m6, m7, %1
+
+ ; go to next line
+ add dstq, dststrideq
+ add srcq, srcstrideq
+ dec heightd ; next row
+ jg .nextrow
+ REP_RET
+
+cglobal %1_rv40_qpel_h, 6,6+npicregs,8, dst, dststride, src, srcstride, height, mx, picreg
+%ifdef PIC
+ lea picregq, [sixtap_filter_hb_m]
+%endif
+ mova m3, [filter_h6_shuf2]
+ mova m4, [filter_h6_shuf3]
+ LOAD mx, sixtap_filter_hb
+ mova m5, [mxq] ; set up 6tap filter in bytes
+ mova m6, [mxq+16]
+ mova m7, [filter_h6_shuf1]
+
+.nextrow:
+ movu m0, [srcq-2]
+ mova m1, m0
+ mova m2, m0
+ pshufb m0, m7
+ pshufb m1, m3
+ pshufb m2, m4
+ pmaddubsw m0, m5
+ pmaddubsw m1, m6
+ pmaddubsw m2, m5
+ paddw m0, m1
+ paddw m0, m2
+ pmulhrsw m0, [pw_512]
+ STORE m0, m1, %1
+
+ ; go to next line
+ add dstq, dststrideq
+ add srcq, srcstrideq
+ dec heightd ; next row
+ jg .nextrow
+ REP_RET
+%endmacro
+
+INIT_XMM ssse3
+FILTER_SSSE3 put
+FILTER_SSSE3 avg
+
+; %1=5bits weights?, %2=dst %3=src1 %4=src3 %5=stride if sse2
+%macro RV40_WCORE 4-5
+ movh m4, [%3 + r6 + 0]
+ movh m5, [%4 + r6 + 0]
+%if %0 == 4
+%define OFFSET r6 + mmsize / 2
+%else
+ ; 8x8 block and sse2, stride was provided
+%define OFFSET r6
+ add r6, r5
+%endif
+ movh m6, [%3 + OFFSET]
+ movh m7, [%4 + OFFSET]
+
+%if %1 == 0
+ ; 14bits weights
+ punpcklbw m4, m0
+ punpcklbw m5, m0
+ punpcklbw m6, m0
+ punpcklbw m7, m0
+
+ psllw m4, 7
+ psllw m5, 7
+ psllw m6, 7
+ psllw m7, 7
+ pmulhw m4, m3
+ pmulhw m5, m2
+ pmulhw m6, m3
+ pmulhw m7, m2
+
+ paddw m4, m5
+ paddw m6, m7
+%else
+ ; 5bits weights
+%if cpuflag(ssse3)
+ punpcklbw m4, m5
+ punpcklbw m6, m7
+
+ pmaddubsw m4, m3
+ pmaddubsw m6, m3
+%else
+ punpcklbw m4, m0
+ punpcklbw m5, m0
+ punpcklbw m6, m0
+ punpcklbw m7, m0
+
+ pmullw m4, m3
+ pmullw m5, m2
+ pmullw m6, m3
+ pmullw m7, m2
+ paddw m4, m5
+ paddw m6, m7
+%endif
+
+%endif
+
+ ; bias and shift down
+%if cpuflag(ssse3)
+ pmulhrsw m4, m1
+ pmulhrsw m6, m1
+%else
+ paddw m4, m1
+ paddw m6, m1
+ psrlw m4, 5
+ psrlw m6, 5
+%endif
+
+ packuswb m4, m6
+%if %0 == 5
+ ; Only called for 8x8 blocks and sse2
+ sub r6, r5
+ movh [%2 + r6], m4
+ add r6, r5
+ movhps [%2 + r6], m4
+%else
+ mova [%2 + r6], m4
+%endif
+%endmacro
+
+
+%macro MAIN_LOOP 2
+%if mmsize == 8
+ RV40_WCORE %2, r0, r1, r2
+%if %1 == 16
+ RV40_WCORE %2, r0 + 8, r1 + 8, r2 + 8
+%endif
+
+ ; Prepare for next loop
+ add r6, r5
+%else
+%ifidn %1, 8
+ RV40_WCORE %2, r0, r1, r2, r5
+ ; Prepare 2 next lines
+ add r6, r5
+%else
+ RV40_WCORE %2, r0, r1, r2
+ ; Prepare single next line
+ add r6, r5
+%endif
+%endif
+
+%endmacro
+
+; rv40_weight_func_%1(uint8_t *dst, uint8_t *src1, uint8_t *src2, int w1, int w2, int stride)
+; %1=size %2=num of xmm regs
+; The weights are FP0.14 notation of fractions depending on pts.
+; For timebases without rounding error (i.e. PAL), the fractions
+; can be simplified, and several operations can be avoided.
+; Therefore, we check here whether they are multiples of 2^9 for
+; those simplifications to occur.
+%macro RV40_WEIGHT 3
+cglobal rv40_weight_func_%1_%2, 6, 7, 8
+%if cpuflag(ssse3)
+ mova m1, [pw_1024]
+%else
+ mova m1, [pw_16]
+%endif
+ pxor m0, m0
+ ; Set loop counter and increments
+ mov r6, r5
+ shl r6, %3
+ add r0, r6
+ add r1, r6
+ add r2, r6
+ neg r6
+
+ movd m2, r3d
+ movd m3, r4d
+%ifidn %1,rnd
+%define RND 0
+ SPLATW m2, m2
+%else
+%define RND 1
+%if cpuflag(ssse3)
+ punpcklbw m3, m2
+%else
+ SPLATW m2, m2
+%endif
+%endif
+ SPLATW m3, m3
+
+.loop:
+ MAIN_LOOP %2, RND
+ jnz .loop
+ REP_RET
+%endmacro
+
+INIT_MMX mmxext
+RV40_WEIGHT rnd, 8, 3
+RV40_WEIGHT rnd, 16, 4
+RV40_WEIGHT nornd, 8, 3
+RV40_WEIGHT nornd, 16, 4
+
+INIT_XMM sse2
+RV40_WEIGHT rnd, 8, 3
+RV40_WEIGHT rnd, 16, 4
+RV40_WEIGHT nornd, 8, 3
+RV40_WEIGHT nornd, 16, 4
+
+INIT_XMM ssse3
+RV40_WEIGHT rnd, 8, 3
+RV40_WEIGHT rnd, 16, 4
+RV40_WEIGHT nornd, 8, 3
+RV40_WEIGHT nornd, 16, 4
diff --git a/gst-libs/ext/libav/libavcodec/x86/rv40dsp.c b/gst-libs/ext/libav/libavcodec/x86/rv40dsp.c
deleted file mode 100644
index 9f90ad8..0000000
--- a/gst-libs/ext/libav/libavcodec/x86/rv40dsp.c
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * RV40 decoder motion compensation functions x86-optimised
- * Copyright (c) 2008 Konstantin Shishkov
- *
- * 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
- * RV40 decoder motion compensation functions x86-optimised
- */
-
-#include "libavcodec/rv34dsp.h"
-
-void ff_put_rv40_chroma_mc8_mmx (uint8_t *dst, uint8_t *src,
- int stride, int h, int x, int y);
-void ff_avg_rv40_chroma_mc8_mmx2 (uint8_t *dst, uint8_t *src,
- int stride, int h, int x, int y);
-void ff_avg_rv40_chroma_mc8_3dnow(uint8_t *dst, uint8_t *src,
- int stride, int h, int x, int y);
-
-void ff_put_rv40_chroma_mc4_mmx (uint8_t *dst, uint8_t *src,
- int stride, int h, int x, int y);
-void ff_avg_rv40_chroma_mc4_mmx2 (uint8_t *dst, uint8_t *src,
- int stride, int h, int x, int y);
-void ff_avg_rv40_chroma_mc4_3dnow(uint8_t *dst, uint8_t *src,
- int stride, int h, int x, int y);
-
-void ff_rv40dsp_init_x86(RV34DSPContext *c, DSPContext *dsp)
-{
- av_unused int mm_flags = av_get_cpu_flags();
-
-#if HAVE_YASM
- if (mm_flags & AV_CPU_FLAG_MMX) {
- c->put_chroma_pixels_tab[0] = ff_put_rv40_chroma_mc8_mmx;
- c->put_chroma_pixels_tab[1] = ff_put_rv40_chroma_mc4_mmx;
- }
- if (mm_flags & AV_CPU_FLAG_MMX2) {
- c->avg_chroma_pixels_tab[0] = ff_avg_rv40_chroma_mc8_mmx2;
- c->avg_chroma_pixels_tab[1] = ff_avg_rv40_chroma_mc4_mmx2;
- } else if (mm_flags & AV_CPU_FLAG_3DNOW) {
- c->avg_chroma_pixels_tab[0] = ff_avg_rv40_chroma_mc8_3dnow;
- c->avg_chroma_pixels_tab[1] = ff_avg_rv40_chroma_mc4_3dnow;
- }
-#endif
-}
diff --git a/gst-libs/ext/libav/libavcodec/x86/rv40dsp_init.c b/gst-libs/ext/libav/libavcodec/x86/rv40dsp_init.c
new file mode 100644
index 0000000..a1dc22a
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/x86/rv40dsp_init.c
@@ -0,0 +1,242 @@
+/*
+ * RV40 decoder motion compensation functions x86-optimised
+ * Copyright (c) 2008 Konstantin Shishkov
+ *
+ * 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
+ * RV40 decoder motion compensation functions x86-optimised
+ * 2,0 and 0,2 have h264 equivalents.
+ * 3,3 is bugged in the rv40 format and maps to _xy2 version
+ */
+
+#include "libavcodec/rv34dsp.h"
+#include "libavutil/mem.h"
+#include "libavutil/x86/cpu.h"
+#include "dsputil_mmx.h"
+
+#if HAVE_YASM
+void ff_put_rv40_chroma_mc8_mmx (uint8_t *dst, uint8_t *src,
+ int stride, int h, int x, int y);
+void ff_avg_rv40_chroma_mc8_mmxext(uint8_t *dst, uint8_t *src,
+ int stride, int h, int x, int y);
+void ff_avg_rv40_chroma_mc8_3dnow(uint8_t *dst, uint8_t *src,
+ int stride, int h, int x, int y);
+
+void ff_put_rv40_chroma_mc4_mmx (uint8_t *dst, uint8_t *src,
+ int stride, int h, int x, int y);
+void ff_avg_rv40_chroma_mc4_mmxext(uint8_t *dst, uint8_t *src,
+ int stride, int h, int x, int y);
+void ff_avg_rv40_chroma_mc4_3dnow(uint8_t *dst, uint8_t *src,
+ int stride, int h, int x, int y);
+
+#define DECLARE_WEIGHT(opt) \
+void ff_rv40_weight_func_rnd_16_##opt(uint8_t *dst, uint8_t *src1, uint8_t *src2, \
+ int w1, int w2, ptrdiff_t stride); \
+void ff_rv40_weight_func_rnd_8_##opt (uint8_t *dst, uint8_t *src1, uint8_t *src2, \
+ int w1, int w2, ptrdiff_t stride); \
+void ff_rv40_weight_func_nornd_16_##opt(uint8_t *dst, uint8_t *src1, uint8_t *src2, \
+ int w1, int w2, ptrdiff_t stride); \
+void ff_rv40_weight_func_nornd_8_##opt (uint8_t *dst, uint8_t *src1, uint8_t *src2, \
+ int w1, int w2, ptrdiff_t stride);
+DECLARE_WEIGHT(mmxext)
+DECLARE_WEIGHT(sse2)
+DECLARE_WEIGHT(ssse3)
+
+/** @{ */
+/**
+ * Define one qpel function.
+ * LOOPSIZE must be already set to the number of pixels processed per
+ * iteration in the inner loop of the called functions.
+ * COFF(x) must be already defined so as to provide the offset into any
+ * array of coeffs used by the called function for the qpel position x.
+ */
+#define QPEL_FUNC_DECL(OP, SIZE, PH, PV, OPT) \
+static void OP ## rv40_qpel ##SIZE ##_mc ##PH ##PV ##OPT(uint8_t *dst, \
+ uint8_t *src, \
+ int stride) \
+{ \
+ int i; \
+ if (PH && PV) { \
+ DECLARE_ALIGNED(16, uint8_t, tmp)[SIZE * (SIZE + 5)]; \
+ uint8_t *tmpptr = tmp + SIZE * 2; \
+ src -= stride * 2; \
+ \
+ for (i = 0; i < SIZE; i += LOOPSIZE) \
+ ff_put_rv40_qpel_h ##OPT(tmp + i, SIZE, src + i, stride, \
+ SIZE + 5, HCOFF(PH)); \
+ for (i = 0; i < SIZE; i += LOOPSIZE) \
+ ff_ ##OP ##rv40_qpel_v ##OPT(dst + i, stride, tmpptr + i, \
+ SIZE, SIZE, VCOFF(PV)); \
+ } else if (PV) { \
+ for (i = 0; i < SIZE; i += LOOPSIZE) \
+ ff_ ##OP ##rv40_qpel_v ## OPT(dst + i, stride, src + i, \
+ stride, SIZE, VCOFF(PV)); \
+ } else { \
+ for (i = 0; i < SIZE; i += LOOPSIZE) \
+ ff_ ##OP ##rv40_qpel_h ## OPT(dst + i, stride, src + i, \
+ stride, SIZE, HCOFF(PH)); \
+ } \
+};
+
+/** Declare functions for sizes 8 and 16 and given operations
+ * and qpel position. */
+#define QPEL_FUNCS_DECL(OP, PH, PV, OPT) \
+ QPEL_FUNC_DECL(OP, 8, PH, PV, OPT) \
+ QPEL_FUNC_DECL(OP, 16, PH, PV, OPT)
+
+/** Declare all functions for all sizes and qpel positions */
+#define QPEL_MC_DECL(OP, OPT) \
+void ff_ ##OP ##rv40_qpel_h ##OPT(uint8_t *dst, ptrdiff_t dstStride, \
+ const uint8_t *src, \
+ ptrdiff_t srcStride, \
+ int len, int m); \
+void ff_ ##OP ##rv40_qpel_v ##OPT(uint8_t *dst, ptrdiff_t dstStride, \
+ const uint8_t *src, \
+ ptrdiff_t srcStride, \
+ int len, int m); \
+QPEL_FUNCS_DECL(OP, 0, 1, OPT) \
+QPEL_FUNCS_DECL(OP, 0, 3, OPT) \
+QPEL_FUNCS_DECL(OP, 1, 0, OPT) \
+QPEL_FUNCS_DECL(OP, 1, 1, OPT) \
+QPEL_FUNCS_DECL(OP, 1, 2, OPT) \
+QPEL_FUNCS_DECL(OP, 1, 3, OPT) \
+QPEL_FUNCS_DECL(OP, 2, 1, OPT) \
+QPEL_FUNCS_DECL(OP, 2, 2, OPT) \
+QPEL_FUNCS_DECL(OP, 2, 3, OPT) \
+QPEL_FUNCS_DECL(OP, 3, 0, OPT) \
+QPEL_FUNCS_DECL(OP, 3, 1, OPT) \
+QPEL_FUNCS_DECL(OP, 3, 2, OPT)
+/** @} */
+
+#define LOOPSIZE 8
+#define HCOFF(x) (32 * (x - 1))
+#define VCOFF(x) (32 * (x - 1))
+QPEL_MC_DECL(put_, _ssse3)
+QPEL_MC_DECL(avg_, _ssse3)
+
+#undef LOOPSIZE
+#undef HCOFF
+#undef VCOFF
+#define LOOPSIZE 8
+#define HCOFF(x) (64 * (x - 1))
+#define VCOFF(x) (64 * (x - 1))
+QPEL_MC_DECL(put_, _sse2)
+QPEL_MC_DECL(avg_, _sse2)
+
+#if ARCH_X86_32
+#undef LOOPSIZE
+#undef HCOFF
+#undef VCOFF
+#define LOOPSIZE 4
+#define HCOFF(x) (64 * (x - 1))
+#define VCOFF(x) (64 * (x - 1))
+
+QPEL_MC_DECL(put_, _mmx)
+
+#define ff_put_rv40_qpel_h_mmxext ff_put_rv40_qpel_h_mmx
+#define ff_put_rv40_qpel_v_mmxext ff_put_rv40_qpel_v_mmx
+QPEL_MC_DECL(avg_, _mmxext)
+
+#define ff_put_rv40_qpel_h_3dnow ff_put_rv40_qpel_h_mmx
+#define ff_put_rv40_qpel_v_3dnow ff_put_rv40_qpel_v_mmx
+QPEL_MC_DECL(avg_, _3dnow)
+#endif
+
+/** @{ */
+/** Set one function */
+#define QPEL_FUNC_SET(OP, SIZE, PH, PV, OPT) \
+ c-> OP ## pixels_tab[2 - SIZE / 8][4 * PV + PH] = OP ## rv40_qpel ##SIZE ## _mc ##PH ##PV ##OPT;
+
+/** Set functions put and avg for sizes 8 and 16 and a given qpel position */
+#define QPEL_FUNCS_SET(OP, PH, PV, OPT) \
+ QPEL_FUNC_SET(OP, 8, PH, PV, OPT) \
+ QPEL_FUNC_SET(OP, 16, PH, PV, OPT)
+
+/** Set all functions for all sizes and qpel positions */
+#define QPEL_MC_SET(OP, OPT) \
+QPEL_FUNCS_SET (OP, 0, 1, OPT) \
+QPEL_FUNCS_SET (OP, 0, 3, OPT) \
+QPEL_FUNCS_SET (OP, 1, 0, OPT) \
+QPEL_FUNCS_SET (OP, 1, 1, OPT) \
+QPEL_FUNCS_SET (OP, 1, 2, OPT) \
+QPEL_FUNCS_SET (OP, 1, 3, OPT) \
+QPEL_FUNCS_SET (OP, 2, 1, OPT) \
+QPEL_FUNCS_SET (OP, 2, 2, OPT) \
+QPEL_FUNCS_SET (OP, 2, 3, OPT) \
+QPEL_FUNCS_SET (OP, 3, 0, OPT) \
+QPEL_FUNCS_SET (OP, 3, 1, OPT) \
+QPEL_FUNCS_SET (OP, 3, 2, OPT)
+/** @} */
+
+#endif /* HAVE_YASM */
+
+void ff_rv40dsp_init_x86(RV34DSPContext *c, DSPContext *dsp)
+{
+#if HAVE_YASM
+ int mm_flags = av_get_cpu_flags();
+
+ if (EXTERNAL_MMX(mm_flags)) {
+ c->put_chroma_pixels_tab[0] = ff_put_rv40_chroma_mc8_mmx;
+ c->put_chroma_pixels_tab[1] = ff_put_rv40_chroma_mc4_mmx;
+#if HAVE_MMX_INLINE
+ c->put_pixels_tab[0][15] = ff_put_rv40_qpel16_mc33_mmx;
+ c->put_pixels_tab[1][15] = ff_put_rv40_qpel8_mc33_mmx;
+ c->avg_pixels_tab[0][15] = ff_avg_rv40_qpel16_mc33_mmx;
+ c->avg_pixels_tab[1][15] = ff_avg_rv40_qpel8_mc33_mmx;
+#endif /* HAVE_MMX_INLINE */
+#if ARCH_X86_32
+ QPEL_MC_SET(put_, _mmx)
+#endif
+ }
+ if (EXTERNAL_MMXEXT(mm_flags)) {
+ c->avg_chroma_pixels_tab[0] = ff_avg_rv40_chroma_mc8_mmxext;
+ c->avg_chroma_pixels_tab[1] = ff_avg_rv40_chroma_mc4_mmxext;
+ c->rv40_weight_pixels_tab[0][0] = ff_rv40_weight_func_rnd_16_mmxext;
+ c->rv40_weight_pixels_tab[0][1] = ff_rv40_weight_func_rnd_8_mmxext;
+ c->rv40_weight_pixels_tab[1][0] = ff_rv40_weight_func_nornd_16_mmxext;
+ c->rv40_weight_pixels_tab[1][1] = ff_rv40_weight_func_nornd_8_mmxext;
+#if ARCH_X86_32
+ QPEL_MC_SET(avg_, _mmxext)
+#endif
+ } else if (EXTERNAL_AMD3DNOW(mm_flags)) {
+ c->avg_chroma_pixels_tab[0] = ff_avg_rv40_chroma_mc8_3dnow;
+ c->avg_chroma_pixels_tab[1] = ff_avg_rv40_chroma_mc4_3dnow;
+#if ARCH_X86_32
+ QPEL_MC_SET(avg_, _3dnow)
+#endif
+ }
+ if (EXTERNAL_SSE2(mm_flags)) {
+ c->rv40_weight_pixels_tab[0][0] = ff_rv40_weight_func_rnd_16_sse2;
+ c->rv40_weight_pixels_tab[0][1] = ff_rv40_weight_func_rnd_8_sse2;
+ c->rv40_weight_pixels_tab[1][0] = ff_rv40_weight_func_nornd_16_sse2;
+ c->rv40_weight_pixels_tab[1][1] = ff_rv40_weight_func_nornd_8_sse2;
+ QPEL_MC_SET(put_, _sse2)
+ QPEL_MC_SET(avg_, _sse2)
+ }
+ if (EXTERNAL_SSSE3(mm_flags)) {
+ c->rv40_weight_pixels_tab[0][0] = ff_rv40_weight_func_rnd_16_ssse3;
+ c->rv40_weight_pixels_tab[0][1] = ff_rv40_weight_func_rnd_8_ssse3;
+ c->rv40_weight_pixels_tab[1][0] = ff_rv40_weight_func_nornd_16_ssse3;
+ c->rv40_weight_pixels_tab[1][1] = ff_rv40_weight_func_nornd_8_ssse3;
+ QPEL_MC_SET(put_, _ssse3)
+ QPEL_MC_SET(avg_, _ssse3)
+ }
+#endif /* HAVE_YASM */
+}
diff --git a/gst-libs/ext/libav/libavcodec/x86/sbrdsp.asm b/gst-libs/ext/libav/libavcodec/x86/sbrdsp.asm
new file mode 100644
index 0000000..b87da4a
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/x86/sbrdsp.asm
@@ -0,0 +1,183 @@
+;******************************************************************************
+;* AAC Spectral Band Replication decoding functions
+;* Copyright (C) 2012 Christophe Gisquet <christophe.gisquet@gmail.com>
+;*
+;* 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
+;******************************************************************************
+
+%include "libavutil/x86/x86util.asm"
+
+SECTION_RODATA
+; mask equivalent for multiply by -1.0 1.0
+ps_mask times 2 dd 1<<31, 0
+
+SECTION_TEXT
+
+INIT_XMM sse
+cglobal sbr_sum_square, 2, 3, 6
+ mov r2, r1
+ xorps m0, m0
+ xorps m1, m1
+ sar r2, 3
+ jz .prepare
+.loop:
+ movu m2, [r0 + 0]
+ movu m3, [r0 + 16]
+ movu m4, [r0 + 32]
+ movu m5, [r0 + 48]
+ mulps m2, m2
+ mulps m3, m3
+ mulps m4, m4
+ mulps m5, m5
+ addps m0, m2
+ addps m1, m3
+ addps m0, m4
+ addps m1, m5
+ add r0, 64
+ dec r2
+ jnz .loop
+.prepare:
+ and r1, 7
+ sar r1, 1
+ jz .end
+; len is a multiple of 2, thus there are at least 4 elements to process
+.endloop:
+ movu m2, [r0]
+ add r0, 16
+ mulps m2, m2
+ dec r1
+ addps m0, m2
+ jnz .endloop
+.end:
+ addps m0, m1
+ movhlps m2, m0
+ addps m0, m2
+ movss m1, m0
+ shufps m0, m0, 1
+ addss m0, m1
+%if ARCH_X86_64 == 0
+ movss r0m, m0
+ fld dword r0m
+%endif
+ RET
+
+%define STEP 40*4*2
+cglobal sbr_hf_g_filt, 5, 6, 5
+ lea r1, [r1 + 8*r4] ; offset by ixh elements into X_high
+ mov r5, r3
+ and r3, 0xFC
+ lea r2, [r2 + r3*4]
+ lea r0, [r0 + r3*8]
+ neg r3
+ jz .loop1
+.loop4:
+ movlps m0, [r2 + 4*r3 + 0]
+ movlps m1, [r2 + 4*r3 + 8]
+ movlps m2, [r1 + 0*STEP]
+ movlps m3, [r1 + 2*STEP]
+ movhps m2, [r1 + 1*STEP]
+ movhps m3, [r1 + 3*STEP]
+ unpcklps m0, m0
+ unpcklps m1, m1
+ mulps m0, m2
+ mulps m1, m3
+ movu [r0 + 8*r3 + 0], m0
+ movu [r0 + 8*r3 + 16], m1
+ add r1, 4*STEP
+ add r3, 4
+ jnz .loop4
+ and r5, 3 ; number of single element loops
+ jz .end
+.loop1: ; element 0 and 1 can be computed at the same time
+ movss m0, [r2]
+ movlps m2, [r1]
+ unpcklps m0, m0
+ mulps m2, m0
+ movlps [r0], m2
+ add r0, 8
+ add r2, 4
+ add r1, STEP
+ dec r5
+ jnz .loop1
+.end:
+ RET
+
+; static void sbr_hf_gen_c(float (*X_high)[2], const float (*X_low)[2],
+; const float alpha0[2], const float alpha1[2],
+; float bw, int start, int end)
+;
+cglobal sbr_hf_gen, 4,4,8, X_high, X_low, alpha0, alpha1, BW, S, E
+ ; load alpha factors
+%define bw m0
+%if ARCH_X86_64 == 0 || WIN64
+ movss bw, BWm
+%endif
+ movlps m2, [alpha1q]
+ movlps m1, [alpha0q]
+ shufps bw, bw, 0
+ mulps m2, bw ; (a1[0] a1[1])*bw
+ mulps m1, bw ; (a0[0] a0[1])*bw = (a2 a3)
+ mulps m2, bw ; (a1[0] a1[1])*bw*bw = (a0 a1)
+ mova m3, m1
+ mova m4, m2
+ mova m7, [ps_mask]
+
+ ; Set pointers
+%if ARCH_X86_64 == 0 || WIN64
+ ; start and end 6th and 7th args on stack
+ mov r2d, Sm
+ mov r3d, Em
+%define start r2q
+%define end r3q
+%else
+; BW does not actually occupy a register, so shift by 1
+%define start BWq
+%define end Sq
+%endif
+ sub start, end ; neg num of loops
+ lea X_highq, [X_highq + end*2*4]
+ lea X_lowq, [X_lowq + end*2*4 - 2*2*4]
+ shl start, 3 ; offset from num loops
+
+ mova m0, [X_lowq + start]
+ movlhps m1, m1 ; (a2 a3 a2 a3)
+ movlhps m2, m2 ; (a0 a1 a0 a1)
+ shufps m3, m3, q0101 ; (a3 a2 a3 a2)
+ shufps m4, m4, q0101 ; (a1 a0 a1 a0)
+ xorps m3, m7 ; (-a3 a2 -a3 a2)
+ xorps m4, m7 ; (-a1 a0 -a1 a0)
+.loop2:
+ mova m5, m0
+ mova m6, m0
+ shufps m0, m0, q2200 ; {Xl[-2][0],",Xl[-1][0],"}
+ shufps m5, m5, q3311 ; {Xl[-2][1],",Xl[-1][1],"}
+ mulps m0, m2
+ mulps m5, m4
+ mova m7, m6
+ addps m5, m0
+ mova m0, [X_lowq + start + 2*2*4]
+ shufps m6, m0, q0022 ; {Xl[-1][0],",Xl[0][0],"}
+ shufps m7, m0, q1133 ; {Xl[-1][1],",Xl[1][1],"}
+ mulps m6, m1
+ mulps m7, m3
+ addps m5, m6
+ addps m7, m0
+ addps m5, m7
+ mova [X_highq + start], m5
+ add start, 16
+ jnz .loop2
+ RET
diff --git a/gst-libs/ext/libav/libavcodec/x86/sbrdsp_init.c b/gst-libs/ext/libav/libavcodec/x86/sbrdsp_init.c
new file mode 100644
index 0000000..51c4bd4
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/x86/sbrdsp_init.c
@@ -0,0 +1,43 @@
+/*
+ * AAC Spectral Band Replication decoding functions
+ * Copyright (c) 2012 Christophe Gisquet <christophe.gisquet@gmail.com>
+ *
+ * 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
+ */
+
+#include "config.h"
+#include "libavutil/cpu.h"
+#include "libavutil/x86/cpu.h"
+#include "libavcodec/sbrdsp.h"
+
+float ff_sbr_sum_square_sse(float (*x)[2], int n);
+void ff_sbr_hf_g_filt_sse(float (*Y)[2], const float (*X_high)[40][2],
+ const float *g_filt, int m_max, intptr_t ixh);
+void ff_sbr_hf_gen_sse(float (*X_high)[2], const float (*X_low)[2],
+ const float alpha0[2], const float alpha1[2],
+ float bw, int start, int end);
+
+void ff_sbrdsp_init_x86(SBRDSPContext *s)
+{
+ int mm_flags = av_get_cpu_flags();
+
+ if (EXTERNAL_SSE(mm_flags)) {
+ s->sum_square = ff_sbr_sum_square_sse;
+ s->hf_g_filt = ff_sbr_hf_g_filt_sse;
+ s->hf_gen = ff_sbr_hf_gen_sse;
+ }
+}
diff --git a/gst-libs/ext/libav/libavcodec/x86/simple_idct.c b/gst-libs/ext/libav/libavcodec/x86/simple_idct.c
new file mode 100644
index 0000000..0e80933
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/x86/simple_idct.c
@@ -0,0 +1,1169 @@
+/*
+ * Simple IDCT MMX
+ *
+ * Copyright (c) 2001, 2002 Michael Niedermayer <michaelni@gmx.at>
+ *
+ * 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
+ */
+#include "libavcodec/dsputil.h"
+#include "libavcodec/simple_idct.h"
+#include "libavutil/internal.h"
+#include "libavutil/mem.h"
+#include "dsputil_mmx.h"
+
+#if HAVE_INLINE_ASM
+
+/*
+23170.475006
+22725.260826
+21406.727617
+19265.545870
+16384.000000
+12872.826198
+8866.956905
+4520.335430
+*/
+#define C0 23170 //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
+#define C1 22725 //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
+#define C2 21407 //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
+#define C3 19266 //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
+#define C4 16383 //cos(i*M_PI/16)*sqrt(2)*(1<<14) - 0.5
+#define C5 12873 //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
+#define C6 8867 //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
+#define C7 4520 //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
+
+#define ROW_SHIFT 11
+#define COL_SHIFT 20 // 6
+
+DECLARE_ASM_CONST(8, uint64_t, wm1010)= 0xFFFF0000FFFF0000ULL;
+DECLARE_ASM_CONST(8, uint64_t, d40000)= 0x0000000000040000ULL;
+
+DECLARE_ALIGNED(8, static const int16_t, coeffs)[]= {
+ 1<<(ROW_SHIFT-1), 0, 1<<(ROW_SHIFT-1), 0,
+// 1<<(COL_SHIFT-1), 0, 1<<(COL_SHIFT-1), 0,
+// 0, 1<<(COL_SHIFT-1-16), 0, 1<<(COL_SHIFT-1-16),
+ 1<<(ROW_SHIFT-1), 1, 1<<(ROW_SHIFT-1), 0,
+ // the 1 = ((1<<(COL_SHIFT-1))/C4)<<ROW_SHIFT :)
+// 0, 0, 0, 0,
+// 0, 0, 0, 0,
+
+ C4, C4, C4, C4,
+ C4, -C4, C4, -C4,
+
+ C2, C6, C2, C6,
+ C6, -C2, C6, -C2,
+
+ C1, C3, C1, C3,
+ C5, C7, C5, C7,
+
+ C3, -C7, C3, -C7,
+-C1, -C5, -C1, -C5,
+
+ C5, -C1, C5, -C1,
+ C7, C3, C7, C3,
+
+ C7, -C5, C7, -C5,
+ C3, -C1, C3, -C1
+};
+
+static inline void idct(int16_t *block)
+{
+ DECLARE_ALIGNED(8, int64_t, align_tmp)[16];
+ int16_t * const temp= (int16_t*)align_tmp;
+
+ __asm__ volatile(
+#if 0 //Alternative, simpler variant
+
+#define ROW_IDCT(src0, src4, src1, src5, dst, rounder, shift) \
+ "movq " #src0 ", %%mm0 \n\t" /* R4 R0 r4 r0 */\
+ "movq " #src4 ", %%mm1 \n\t" /* R6 R2 r6 r2 */\
+ "movq " #src1 ", %%mm2 \n\t" /* R3 R1 r3 r1 */\
+ "movq " #src5 ", %%mm3 \n\t" /* R7 R5 r7 r5 */\
+ "movq 16(%2), %%mm4 \n\t" /* C4 C4 C4 C4 */\
+ "pmaddwd %%mm0, %%mm4 \n\t" /* C4R4+C4R0 C4r4+C4r0 */\
+ "movq 24(%2), %%mm5 \n\t" /* -C4 C4 -C4 C4 */\
+ "pmaddwd %%mm5, %%mm0 \n\t" /* -C4R4+C4R0 -C4r4+C4r0 */\
+ "movq 32(%2), %%mm5 \n\t" /* C6 C2 C6 C2 */\
+ "pmaddwd %%mm1, %%mm5 \n\t" /* C6R6+C2R2 C6r6+C2r2 */\
+ "movq 40(%2), %%mm6 \n\t" /* -C2 C6 -C2 C6 */\
+ "pmaddwd %%mm6, %%mm1 \n\t" /* -C2R6+C6R2 -C2r6+C6r2 */\
+ "movq 48(%2), %%mm7 \n\t" /* C3 C1 C3 C1 */\
+ "pmaddwd %%mm2, %%mm7 \n\t" /* C3R3+C1R1 C3r3+C1r1 */\
+ #rounder ", %%mm4 \n\t"\
+ "movq %%mm4, %%mm6 \n\t" /* C4R4+C4R0 C4r4+C4r0 */\
+ "paddd %%mm5, %%mm4 \n\t" /* A0 a0 */\
+ "psubd %%mm5, %%mm6 \n\t" /* A3 a3 */\
+ "movq 56(%2), %%mm5 \n\t" /* C7 C5 C7 C5 */\
+ "pmaddwd %%mm3, %%mm5 \n\t" /* C7R7+C5R5 C7r7+C5r5 */\
+ #rounder ", %%mm0 \n\t"\
+ "paddd %%mm0, %%mm1 \n\t" /* A1 a1 */\
+ "paddd %%mm0, %%mm0 \n\t" \
+ "psubd %%mm1, %%mm0 \n\t" /* A2 a2 */\
+ "pmaddwd 64(%2), %%mm2 \n\t" /* -C7R3+C3R1 -C7r3+C3r1 */\
+ "paddd %%mm5, %%mm7 \n\t" /* B0 b0 */\
+ "movq 72(%2), %%mm5 \n\t" /* -C5 -C1 -C5 -C1 */\
+ "pmaddwd %%mm3, %%mm5 \n\t" /* -C5R7-C1R5 -C5r7-C1r5 */\
+ "paddd %%mm4, %%mm7 \n\t" /* A0+B0 a0+b0 */\
+ "paddd %%mm4, %%mm4 \n\t" /* 2A0 2a0 */\
+ "psubd %%mm7, %%mm4 \n\t" /* A0-B0 a0-b0 */\
+ "paddd %%mm2, %%mm5 \n\t" /* B1 b1 */\
+ "psrad $" #shift ", %%mm7 \n\t"\
+ "psrad $" #shift ", %%mm4 \n\t"\
+ "movq %%mm1, %%mm2 \n\t" /* A1 a1 */\
+ "paddd %%mm5, %%mm1 \n\t" /* A1+B1 a1+b1 */\
+ "psubd %%mm5, %%mm2 \n\t" /* A1-B1 a1-b1 */\
+ "psrad $" #shift ", %%mm1 \n\t"\
+ "psrad $" #shift ", %%mm2 \n\t"\
+ "packssdw %%mm1, %%mm7 \n\t" /* A1+B1 a1+b1 A0+B0 a0+b0 */\
+ "packssdw %%mm4, %%mm2 \n\t" /* A0-B0 a0-b0 A1-B1 a1-b1 */\
+ "movq %%mm7, " #dst " \n\t"\
+ "movq " #src1 ", %%mm1 \n\t" /* R3 R1 r3 r1 */\
+ "movq 80(%2), %%mm4 \n\t" /* -C1 C5 -C1 C5 */\
+ "movq %%mm2, 24+" #dst " \n\t"\
+ "pmaddwd %%mm1, %%mm4 \n\t" /* -C1R3+C5R1 -C1r3+C5r1 */\
+ "movq 88(%2), %%mm7 \n\t" /* C3 C7 C3 C7 */\
+ "pmaddwd 96(%2), %%mm1 \n\t" /* -C5R3+C7R1 -C5r3+C7r1 */\
+ "pmaddwd %%mm3, %%mm7 \n\t" /* C3R7+C7R5 C3r7+C7r5 */\
+ "movq %%mm0, %%mm2 \n\t" /* A2 a2 */\
+ "pmaddwd 104(%2), %%mm3 \n\t" /* -C1R7+C3R5 -C1r7+C3r5 */\
+ "paddd %%mm7, %%mm4 \n\t" /* B2 b2 */\
+ "paddd %%mm4, %%mm2 \n\t" /* A2+B2 a2+b2 */\
+ "psubd %%mm4, %%mm0 \n\t" /* a2-B2 a2-b2 */\
+ "psrad $" #shift ", %%mm2 \n\t"\
+ "psrad $" #shift ", %%mm0 \n\t"\
+ "movq %%mm6, %%mm4 \n\t" /* A3 a3 */\
+ "paddd %%mm1, %%mm3 \n\t" /* B3 b3 */\
+ "paddd %%mm3, %%mm6 \n\t" /* A3+B3 a3+b3 */\
+ "psubd %%mm3, %%mm4 \n\t" /* a3-B3 a3-b3 */\
+ "psrad $" #shift ", %%mm6 \n\t"\
+ "packssdw %%mm6, %%mm2 \n\t" /* A3+B3 a3+b3 A2+B2 a2+b2 */\
+ "movq %%mm2, 8+" #dst " \n\t"\
+ "psrad $" #shift ", %%mm4 \n\t"\
+ "packssdw %%mm0, %%mm4 \n\t" /* A2-B2 a2-b2 A3-B3 a3-b3 */\
+ "movq %%mm4, 16+" #dst " \n\t"\
+
+#define COL_IDCT(src0, src4, src1, src5, dst, shift) \
+ "movq " #src0 ", %%mm0 \n\t" /* R4 R0 r4 r0 */\
+ "movq " #src4 ", %%mm1 \n\t" /* R6 R2 r6 r2 */\
+ "movq " #src1 ", %%mm2 \n\t" /* R3 R1 r3 r1 */\
+ "movq " #src5 ", %%mm3 \n\t" /* R7 R5 r7 r5 */\
+ "movq 16(%2), %%mm4 \n\t" /* C4 C4 C4 C4 */\
+ "pmaddwd %%mm0, %%mm4 \n\t" /* C4R4+C4R0 C4r4+C4r0 */\
+ "movq 24(%2), %%mm5 \n\t" /* -C4 C4 -C4 C4 */\
+ "pmaddwd %%mm5, %%mm0 \n\t" /* -C4R4+C4R0 -C4r4+C4r0 */\
+ "movq 32(%2), %%mm5 \n\t" /* C6 C2 C6 C2 */\
+ "pmaddwd %%mm1, %%mm5 \n\t" /* C6R6+C2R2 C6r6+C2r2 */\
+ "movq 40(%2), %%mm6 \n\t" /* -C2 C6 -C2 C6 */\
+ "pmaddwd %%mm6, %%mm1 \n\t" /* -C2R6+C6R2 -C2r6+C6r2 */\
+ "movq %%mm4, %%mm6 \n\t" /* C4R4+C4R0 C4r4+C4r0 */\
+ "movq 48(%2), %%mm7 \n\t" /* C3 C1 C3 C1 */\
+ "pmaddwd %%mm2, %%mm7 \n\t" /* C3R3+C1R1 C3r3+C1r1 */\
+ "paddd %%mm5, %%mm4 \n\t" /* A0 a0 */\
+ "psubd %%mm5, %%mm6 \n\t" /* A3 a3 */\
+ "movq %%mm0, %%mm5 \n\t" /* -C4R4+C4R0 -C4r4+C4r0 */\
+ "paddd %%mm1, %%mm0 \n\t" /* A1 a1 */\
+ "psubd %%mm1, %%mm5 \n\t" /* A2 a2 */\
+ "movq 56(%2), %%mm1 \n\t" /* C7 C5 C7 C5 */\
+ "pmaddwd %%mm3, %%mm1 \n\t" /* C7R7+C5R5 C7r7+C5r5 */\
+ "pmaddwd 64(%2), %%mm2 \n\t" /* -C7R3+C3R1 -C7r3+C3r1 */\
+ "paddd %%mm1, %%mm7 \n\t" /* B0 b0 */\
+ "movq 72(%2), %%mm1 \n\t" /* -C5 -C1 -C5 -C1 */\
+ "pmaddwd %%mm3, %%mm1 \n\t" /* -C5R7-C1R5 -C5r7-C1r5 */\
+ "paddd %%mm4, %%mm7 \n\t" /* A0+B0 a0+b0 */\
+ "paddd %%mm4, %%mm4 \n\t" /* 2A0 2a0 */\
+ "psubd %%mm7, %%mm4 \n\t" /* A0-B0 a0-b0 */\
+ "paddd %%mm2, %%mm1 \n\t" /* B1 b1 */\
+ "psrad $" #shift ", %%mm7 \n\t"\
+ "psrad $" #shift ", %%mm4 \n\t"\
+ "movq %%mm0, %%mm2 \n\t" /* A1 a1 */\
+ "paddd %%mm1, %%mm0 \n\t" /* A1+B1 a1+b1 */\
+ "psubd %%mm1, %%mm2 \n\t" /* A1-B1 a1-b1 */\
+ "psrad $" #shift ", %%mm0 \n\t"\
+ "psrad $" #shift ", %%mm2 \n\t"\
+ "packssdw %%mm7, %%mm7 \n\t" /* A0+B0 a0+b0 */\
+ "movd %%mm7, " #dst " \n\t"\
+ "packssdw %%mm0, %%mm0 \n\t" /* A1+B1 a1+b1 */\
+ "movd %%mm0, 16+" #dst " \n\t"\
+ "packssdw %%mm2, %%mm2 \n\t" /* A1-B1 a1-b1 */\
+ "movd %%mm2, 96+" #dst " \n\t"\
+ "packssdw %%mm4, %%mm4 \n\t" /* A0-B0 a0-b0 */\
+ "movd %%mm4, 112+" #dst " \n\t"\
+ "movq " #src1 ", %%mm0 \n\t" /* R3 R1 r3 r1 */\
+ "movq 80(%2), %%mm4 \n\t" /* -C1 C5 -C1 C5 */\
+ "pmaddwd %%mm0, %%mm4 \n\t" /* -C1R3+C5R1 -C1r3+C5r1 */\
+ "movq 88(%2), %%mm7 \n\t" /* C3 C7 C3 C7 */\
+ "pmaddwd 96(%2), %%mm0 \n\t" /* -C5R3+C7R1 -C5r3+C7r1 */\
+ "pmaddwd %%mm3, %%mm7 \n\t" /* C3R7+C7R5 C3r7+C7r5 */\
+ "movq %%mm5, %%mm2 \n\t" /* A2 a2 */\
+ "pmaddwd 104(%2), %%mm3 \n\t" /* -C1R7+C3R5 -C1r7+C3r5 */\
+ "paddd %%mm7, %%mm4 \n\t" /* B2 b2 */\
+ "paddd %%mm4, %%mm2 \n\t" /* A2+B2 a2+b2 */\
+ "psubd %%mm4, %%mm5 \n\t" /* a2-B2 a2-b2 */\
+ "psrad $" #shift ", %%mm2 \n\t"\
+ "psrad $" #shift ", %%mm5 \n\t"\
+ "movq %%mm6, %%mm4 \n\t" /* A3 a3 */\
+ "paddd %%mm0, %%mm3 \n\t" /* B3 b3 */\
+ "paddd %%mm3, %%mm6 \n\t" /* A3+B3 a3+b3 */\
+ "psubd %%mm3, %%mm4 \n\t" /* a3-B3 a3-b3 */\
+ "psrad $" #shift ", %%mm6 \n\t"\
+ "psrad $" #shift ", %%mm4 \n\t"\
+ "packssdw %%mm2, %%mm2 \n\t" /* A2+B2 a2+b2 */\
+ "packssdw %%mm6, %%mm6 \n\t" /* A3+B3 a3+b3 */\
+ "movd %%mm2, 32+" #dst " \n\t"\
+ "packssdw %%mm4, %%mm4 \n\t" /* A3-B3 a3-b3 */\
+ "packssdw %%mm5, %%mm5 \n\t" /* A2-B2 a2-b2 */\
+ "movd %%mm6, 48+" #dst " \n\t"\
+ "movd %%mm4, 64+" #dst " \n\t"\
+ "movd %%mm5, 80+" #dst " \n\t"\
+
+
+#define DC_COND_ROW_IDCT(src0, src4, src1, src5, dst, rounder, shift) \
+ "movq " #src0 ", %%mm0 \n\t" /* R4 R0 r4 r0 */\
+ "movq " #src4 ", %%mm1 \n\t" /* R6 R2 r6 r2 */\
+ "movq " #src1 ", %%mm2 \n\t" /* R3 R1 r3 r1 */\
+ "movq " #src5 ", %%mm3 \n\t" /* R7 R5 r7 r5 */\
+ "movq "MANGLE(wm1010)", %%mm4 \n\t"\
+ "pand %%mm0, %%mm4 \n\t"\
+ "por %%mm1, %%mm4 \n\t"\
+ "por %%mm2, %%mm4 \n\t"\
+ "por %%mm3, %%mm4 \n\t"\
+ "packssdw %%mm4,%%mm4 \n\t"\
+ "movd %%mm4, %%eax \n\t"\
+ "orl %%eax, %%eax \n\t"\
+ "jz 1f \n\t"\
+ "movq 16(%2), %%mm4 \n\t" /* C4 C4 C4 C4 */\
+ "pmaddwd %%mm0, %%mm4 \n\t" /* C4R4+C4R0 C4r4+C4r0 */\
+ "movq 24(%2), %%mm5 \n\t" /* -C4 C4 -C4 C4 */\
+ "pmaddwd %%mm5, %%mm0 \n\t" /* -C4R4+C4R0 -C4r4+C4r0 */\
+ "movq 32(%2), %%mm5 \n\t" /* C6 C2 C6 C2 */\
+ "pmaddwd %%mm1, %%mm5 \n\t" /* C6R6+C2R2 C6r6+C2r2 */\
+ "movq 40(%2), %%mm6 \n\t" /* -C2 C6 -C2 C6 */\
+ "pmaddwd %%mm6, %%mm1 \n\t" /* -C2R6+C6R2 -C2r6+C6r2 */\
+ "movq 48(%2), %%mm7 \n\t" /* C3 C1 C3 C1 */\
+ "pmaddwd %%mm2, %%mm7 \n\t" /* C3R3+C1R1 C3r3+C1r1 */\
+ #rounder ", %%mm4 \n\t"\
+ "movq %%mm4, %%mm6 \n\t" /* C4R4+C4R0 C4r4+C4r0 */\
+ "paddd %%mm5, %%mm4 \n\t" /* A0 a0 */\
+ "psubd %%mm5, %%mm6 \n\t" /* A3 a3 */\
+ "movq 56(%2), %%mm5 \n\t" /* C7 C5 C7 C5 */\
+ "pmaddwd %%mm3, %%mm5 \n\t" /* C7R7+C5R5 C7r7+C5r5 */\
+ #rounder ", %%mm0 \n\t"\
+ "paddd %%mm0, %%mm1 \n\t" /* A1 a1 */\
+ "paddd %%mm0, %%mm0 \n\t" \
+ "psubd %%mm1, %%mm0 \n\t" /* A2 a2 */\
+ "pmaddwd 64(%2), %%mm2 \n\t" /* -C7R3+C3R1 -C7r3+C3r1 */\
+ "paddd %%mm5, %%mm7 \n\t" /* B0 b0 */\
+ "movq 72(%2), %%mm5 \n\t" /* -C5 -C1 -C5 -C1 */\
+ "pmaddwd %%mm3, %%mm5 \n\t" /* -C5R7-C1R5 -C5r7-C1r5 */\
+ "paddd %%mm4, %%mm7 \n\t" /* A0+B0 a0+b0 */\
+ "paddd %%mm4, %%mm4 \n\t" /* 2A0 2a0 */\
+ "psubd %%mm7, %%mm4 \n\t" /* A0-B0 a0-b0 */\
+ "paddd %%mm2, %%mm5 \n\t" /* B1 b1 */\
+ "psrad $" #shift ", %%mm7 \n\t"\
+ "psrad $" #shift ", %%mm4 \n\t"\
+ "movq %%mm1, %%mm2 \n\t" /* A1 a1 */\
+ "paddd %%mm5, %%mm1 \n\t" /* A1+B1 a1+b1 */\
+ "psubd %%mm5, %%mm2 \n\t" /* A1-B1 a1-b1 */\
+ "psrad $" #shift ", %%mm1 \n\t"\
+ "psrad $" #shift ", %%mm2 \n\t"\
+ "packssdw %%mm1, %%mm7 \n\t" /* A1+B1 a1+b1 A0+B0 a0+b0 */\
+ "packssdw %%mm4, %%mm2 \n\t" /* A0-B0 a0-b0 A1-B1 a1-b1 */\
+ "movq %%mm7, " #dst " \n\t"\
+ "movq " #src1 ", %%mm1 \n\t" /* R3 R1 r3 r1 */\
+ "movq 80(%2), %%mm4 \n\t" /* -C1 C5 -C1 C5 */\
+ "movq %%mm2, 24+" #dst " \n\t"\
+ "pmaddwd %%mm1, %%mm4 \n\t" /* -C1R3+C5R1 -C1r3+C5r1 */\
+ "movq 88(%2), %%mm7 \n\t" /* C3 C7 C3 C7 */\
+ "pmaddwd 96(%2), %%mm1 \n\t" /* -C5R3+C7R1 -C5r3+C7r1 */\
+ "pmaddwd %%mm3, %%mm7 \n\t" /* C3R7+C7R5 C3r7+C7r5 */\
+ "movq %%mm0, %%mm2 \n\t" /* A2 a2 */\
+ "pmaddwd 104(%2), %%mm3 \n\t" /* -C1R7+C3R5 -C1r7+C3r5 */\
+ "paddd %%mm7, %%mm4 \n\t" /* B2 b2 */\
+ "paddd %%mm4, %%mm2 \n\t" /* A2+B2 a2+b2 */\
+ "psubd %%mm4, %%mm0 \n\t" /* a2-B2 a2-b2 */\
+ "psrad $" #shift ", %%mm2 \n\t"\
+ "psrad $" #shift ", %%mm0 \n\t"\
+ "movq %%mm6, %%mm4 \n\t" /* A3 a3 */\
+ "paddd %%mm1, %%mm3 \n\t" /* B3 b3 */\
+ "paddd %%mm3, %%mm6 \n\t" /* A3+B3 a3+b3 */\
+ "psubd %%mm3, %%mm4 \n\t" /* a3-B3 a3-b3 */\
+ "psrad $" #shift ", %%mm6 \n\t"\
+ "packssdw %%mm6, %%mm2 \n\t" /* A3+B3 a3+b3 A2+B2 a2+b2 */\
+ "movq %%mm2, 8+" #dst " \n\t"\
+ "psrad $" #shift ", %%mm4 \n\t"\
+ "packssdw %%mm0, %%mm4 \n\t" /* A2-B2 a2-b2 A3-B3 a3-b3 */\
+ "movq %%mm4, 16+" #dst " \n\t"\
+ "jmp 2f \n\t"\
+ "1: \n\t"\
+ "pslld $16, %%mm0 \n\t"\
+ "#paddd "MANGLE(d40000)", %%mm0 \n\t"\
+ "psrad $13, %%mm0 \n\t"\
+ "packssdw %%mm0, %%mm0 \n\t"\
+ "movq %%mm0, " #dst " \n\t"\
+ "movq %%mm0, 8+" #dst " \n\t"\
+ "movq %%mm0, 16+" #dst " \n\t"\
+ "movq %%mm0, 24+" #dst " \n\t"\
+ "2: \n\t"
+
+
+//IDCT( src0, src4, src1, src5, dst, rounder, shift)
+ROW_IDCT( (%0), 8(%0), 16(%0), 24(%0), 0(%1),paddd 8(%2), 11)
+/*ROW_IDCT( 32(%0), 40(%0), 48(%0), 56(%0), 32(%1), paddd (%2), 11)
+ROW_IDCT( 64(%0), 72(%0), 80(%0), 88(%0), 64(%1), paddd (%2), 11)
+ROW_IDCT( 96(%0),104(%0),112(%0),120(%0), 96(%1), paddd (%2), 11)*/
+
+DC_COND_ROW_IDCT( 32(%0), 40(%0), 48(%0), 56(%0), 32(%1),paddd (%2), 11)
+DC_COND_ROW_IDCT( 64(%0), 72(%0), 80(%0), 88(%0), 64(%1),paddd (%2), 11)
+DC_COND_ROW_IDCT( 96(%0),104(%0),112(%0),120(%0), 96(%1),paddd (%2), 11)
+
+
+//IDCT( src0, src4, src1, src5, dst, shift)
+COL_IDCT( (%1), 64(%1), 32(%1), 96(%1), 0(%0), 20)
+COL_IDCT( 8(%1), 72(%1), 40(%1), 104(%1), 4(%0), 20)
+COL_IDCT( 16(%1), 80(%1), 48(%1), 112(%1), 8(%0), 20)
+COL_IDCT( 24(%1), 88(%1), 56(%1), 120(%1), 12(%0), 20)
+
+#else
+
+#define DC_COND_IDCT(src0, src4, src1, src5, dst, rounder, shift) \
+ "movq " #src0 ", %%mm0 \n\t" /* R4 R0 r4 r0 */\
+ "movq " #src4 ", %%mm1 \n\t" /* R6 R2 r6 r2 */\
+ "movq " #src1 ", %%mm2 \n\t" /* R3 R1 r3 r1 */\
+ "movq " #src5 ", %%mm3 \n\t" /* R7 R5 r7 r5 */\
+ "movq "MANGLE(wm1010)", %%mm4 \n\t"\
+ "pand %%mm0, %%mm4 \n\t"\
+ "por %%mm1, %%mm4 \n\t"\
+ "por %%mm2, %%mm4 \n\t"\
+ "por %%mm3, %%mm4 \n\t"\
+ "packssdw %%mm4,%%mm4 \n\t"\
+ "movd %%mm4, %%eax \n\t"\
+ "orl %%eax, %%eax \n\t"\
+ "jz 1f \n\t"\
+ "movq 16(%2), %%mm4 \n\t" /* C4 C4 C4 C4 */\
+ "pmaddwd %%mm0, %%mm4 \n\t" /* C4R4+C4R0 C4r4+C4r0 */\
+ "movq 24(%2), %%mm5 \n\t" /* -C4 C4 -C4 C4 */\
+ "pmaddwd %%mm5, %%mm0 \n\t" /* -C4R4+C4R0 -C4r4+C4r0 */\
+ "movq 32(%2), %%mm5 \n\t" /* C6 C2 C6 C2 */\
+ "pmaddwd %%mm1, %%mm5 \n\t" /* C6R6+C2R2 C6r6+C2r2 */\
+ "movq 40(%2), %%mm6 \n\t" /* -C2 C6 -C2 C6 */\
+ "pmaddwd %%mm6, %%mm1 \n\t" /* -C2R6+C6R2 -C2r6+C6r2 */\
+ "movq 48(%2), %%mm7 \n\t" /* C3 C1 C3 C1 */\
+ "pmaddwd %%mm2, %%mm7 \n\t" /* C3R3+C1R1 C3r3+C1r1 */\
+ #rounder ", %%mm4 \n\t"\
+ "movq %%mm4, %%mm6 \n\t" /* C4R4+C4R0 C4r4+C4r0 */\
+ "paddd %%mm5, %%mm4 \n\t" /* A0 a0 */\
+ "psubd %%mm5, %%mm6 \n\t" /* A3 a3 */\
+ "movq 56(%2), %%mm5 \n\t" /* C7 C5 C7 C5 */\
+ "pmaddwd %%mm3, %%mm5 \n\t" /* C7R7+C5R5 C7r7+C5r5 */\
+ #rounder ", %%mm0 \n\t"\
+ "paddd %%mm0, %%mm1 \n\t" /* A1 a1 */\
+ "paddd %%mm0, %%mm0 \n\t" \
+ "psubd %%mm1, %%mm0 \n\t" /* A2 a2 */\
+ "pmaddwd 64(%2), %%mm2 \n\t" /* -C7R3+C3R1 -C7r3+C3r1 */\
+ "paddd %%mm5, %%mm7 \n\t" /* B0 b0 */\
+ "movq 72(%2), %%mm5 \n\t" /* -C5 -C1 -C5 -C1 */\
+ "pmaddwd %%mm3, %%mm5 \n\t" /* -C5R7-C1R5 -C5r7-C1r5 */\
+ "paddd %%mm4, %%mm7 \n\t" /* A0+B0 a0+b0 */\
+ "paddd %%mm4, %%mm4 \n\t" /* 2A0 2a0 */\
+ "psubd %%mm7, %%mm4 \n\t" /* A0-B0 a0-b0 */\
+ "paddd %%mm2, %%mm5 \n\t" /* B1 b1 */\
+ "psrad $" #shift ", %%mm7 \n\t"\
+ "psrad $" #shift ", %%mm4 \n\t"\
+ "movq %%mm1, %%mm2 \n\t" /* A1 a1 */\
+ "paddd %%mm5, %%mm1 \n\t" /* A1+B1 a1+b1 */\
+ "psubd %%mm5, %%mm2 \n\t" /* A1-B1 a1-b1 */\
+ "psrad $" #shift ", %%mm1 \n\t"\
+ "psrad $" #shift ", %%mm2 \n\t"\
+ "packssdw %%mm1, %%mm7 \n\t" /* A1+B1 a1+b1 A0+B0 a0+b0 */\
+ "packssdw %%mm4, %%mm2 \n\t" /* A0-B0 a0-b0 A1-B1 a1-b1 */\
+ "movq %%mm7, " #dst " \n\t"\
+ "movq " #src1 ", %%mm1 \n\t" /* R3 R1 r3 r1 */\
+ "movq 80(%2), %%mm4 \n\t" /* -C1 C5 -C1 C5 */\
+ "movq %%mm2, 24+" #dst " \n\t"\
+ "pmaddwd %%mm1, %%mm4 \n\t" /* -C1R3+C5R1 -C1r3+C5r1 */\
+ "movq 88(%2), %%mm7 \n\t" /* C3 C7 C3 C7 */\
+ "pmaddwd 96(%2), %%mm1 \n\t" /* -C5R3+C7R1 -C5r3+C7r1 */\
+ "pmaddwd %%mm3, %%mm7 \n\t" /* C3R7+C7R5 C3r7+C7r5 */\
+ "movq %%mm0, %%mm2 \n\t" /* A2 a2 */\
+ "pmaddwd 104(%2), %%mm3 \n\t" /* -C1R7+C3R5 -C1r7+C3r5 */\
+ "paddd %%mm7, %%mm4 \n\t" /* B2 b2 */\
+ "paddd %%mm4, %%mm2 \n\t" /* A2+B2 a2+b2 */\
+ "psubd %%mm4, %%mm0 \n\t" /* a2-B2 a2-b2 */\
+ "psrad $" #shift ", %%mm2 \n\t"\
+ "psrad $" #shift ", %%mm0 \n\t"\
+ "movq %%mm6, %%mm4 \n\t" /* A3 a3 */\
+ "paddd %%mm1, %%mm3 \n\t" /* B3 b3 */\
+ "paddd %%mm3, %%mm6 \n\t" /* A3+B3 a3+b3 */\
+ "psubd %%mm3, %%mm4 \n\t" /* a3-B3 a3-b3 */\
+ "psrad $" #shift ", %%mm6 \n\t"\
+ "packssdw %%mm6, %%mm2 \n\t" /* A3+B3 a3+b3 A2+B2 a2+b2 */\
+ "movq %%mm2, 8+" #dst " \n\t"\
+ "psrad $" #shift ", %%mm4 \n\t"\
+ "packssdw %%mm0, %%mm4 \n\t" /* A2-B2 a2-b2 A3-B3 a3-b3 */\
+ "movq %%mm4, 16+" #dst " \n\t"\
+ "jmp 2f \n\t"\
+ "1: \n\t"\
+ "pslld $16, %%mm0 \n\t"\
+ "paddd "MANGLE(d40000)", %%mm0 \n\t"\
+ "psrad $13, %%mm0 \n\t"\
+ "packssdw %%mm0, %%mm0 \n\t"\
+ "movq %%mm0, " #dst " \n\t"\
+ "movq %%mm0, 8+" #dst " \n\t"\
+ "movq %%mm0, 16+" #dst " \n\t"\
+ "movq %%mm0, 24+" #dst " \n\t"\
+ "2: \n\t"
+
+#define Z_COND_IDCT(src0, src4, src1, src5, dst, rounder, shift, bt) \
+ "movq " #src0 ", %%mm0 \n\t" /* R4 R0 r4 r0 */\
+ "movq " #src4 ", %%mm1 \n\t" /* R6 R2 r6 r2 */\
+ "movq " #src1 ", %%mm2 \n\t" /* R3 R1 r3 r1 */\
+ "movq " #src5 ", %%mm3 \n\t" /* R7 R5 r7 r5 */\
+ "movq %%mm0, %%mm4 \n\t"\
+ "por %%mm1, %%mm4 \n\t"\
+ "por %%mm2, %%mm4 \n\t"\
+ "por %%mm3, %%mm4 \n\t"\
+ "packssdw %%mm4,%%mm4 \n\t"\
+ "movd %%mm4, %%eax \n\t"\
+ "orl %%eax, %%eax \n\t"\
+ "jz " #bt " \n\t"\
+ "movq 16(%2), %%mm4 \n\t" /* C4 C4 C4 C4 */\
+ "pmaddwd %%mm0, %%mm4 \n\t" /* C4R4+C4R0 C4r4+C4r0 */\
+ "movq 24(%2), %%mm5 \n\t" /* -C4 C4 -C4 C4 */\
+ "pmaddwd %%mm5, %%mm0 \n\t" /* -C4R4+C4R0 -C4r4+C4r0 */\
+ "movq 32(%2), %%mm5 \n\t" /* C6 C2 C6 C2 */\
+ "pmaddwd %%mm1, %%mm5 \n\t" /* C6R6+C2R2 C6r6+C2r2 */\
+ "movq 40(%2), %%mm6 \n\t" /* -C2 C6 -C2 C6 */\
+ "pmaddwd %%mm6, %%mm1 \n\t" /* -C2R6+C6R2 -C2r6+C6r2 */\
+ "movq 48(%2), %%mm7 \n\t" /* C3 C1 C3 C1 */\
+ "pmaddwd %%mm2, %%mm7 \n\t" /* C3R3+C1R1 C3r3+C1r1 */\
+ #rounder ", %%mm4 \n\t"\
+ "movq %%mm4, %%mm6 \n\t" /* C4R4+C4R0 C4r4+C4r0 */\
+ "paddd %%mm5, %%mm4 \n\t" /* A0 a0 */\
+ "psubd %%mm5, %%mm6 \n\t" /* A3 a3 */\
+ "movq 56(%2), %%mm5 \n\t" /* C7 C5 C7 C5 */\
+ "pmaddwd %%mm3, %%mm5 \n\t" /* C7R7+C5R5 C7r7+C5r5 */\
+ #rounder ", %%mm0 \n\t"\
+ "paddd %%mm0, %%mm1 \n\t" /* A1 a1 */\
+ "paddd %%mm0, %%mm0 \n\t" \
+ "psubd %%mm1, %%mm0 \n\t" /* A2 a2 */\
+ "pmaddwd 64(%2), %%mm2 \n\t" /* -C7R3+C3R1 -C7r3+C3r1 */\
+ "paddd %%mm5, %%mm7 \n\t" /* B0 b0 */\
+ "movq 72(%2), %%mm5 \n\t" /* -C5 -C1 -C5 -C1 */\
+ "pmaddwd %%mm3, %%mm5 \n\t" /* -C5R7-C1R5 -C5r7-C1r5 */\
+ "paddd %%mm4, %%mm7 \n\t" /* A0+B0 a0+b0 */\
+ "paddd %%mm4, %%mm4 \n\t" /* 2A0 2a0 */\
+ "psubd %%mm7, %%mm4 \n\t" /* A0-B0 a0-b0 */\
+ "paddd %%mm2, %%mm5 \n\t" /* B1 b1 */\
+ "psrad $" #shift ", %%mm7 \n\t"\
+ "psrad $" #shift ", %%mm4 \n\t"\
+ "movq %%mm1, %%mm2 \n\t" /* A1 a1 */\
+ "paddd %%mm5, %%mm1 \n\t" /* A1+B1 a1+b1 */\
+ "psubd %%mm5, %%mm2 \n\t" /* A1-B1 a1-b1 */\
+ "psrad $" #shift ", %%mm1 \n\t"\
+ "psrad $" #shift ", %%mm2 \n\t"\
+ "packssdw %%mm1, %%mm7 \n\t" /* A1+B1 a1+b1 A0+B0 a0+b0 */\
+ "packssdw %%mm4, %%mm2 \n\t" /* A0-B0 a0-b0 A1-B1 a1-b1 */\
+ "movq %%mm7, " #dst " \n\t"\
+ "movq " #src1 ", %%mm1 \n\t" /* R3 R1 r3 r1 */\
+ "movq 80(%2), %%mm4 \n\t" /* -C1 C5 -C1 C5 */\
+ "movq %%mm2, 24+" #dst " \n\t"\
+ "pmaddwd %%mm1, %%mm4 \n\t" /* -C1R3+C5R1 -C1r3+C5r1 */\
+ "movq 88(%2), %%mm7 \n\t" /* C3 C7 C3 C7 */\
+ "pmaddwd 96(%2), %%mm1 \n\t" /* -C5R3+C7R1 -C5r3+C7r1 */\
+ "pmaddwd %%mm3, %%mm7 \n\t" /* C3R7+C7R5 C3r7+C7r5 */\
+ "movq %%mm0, %%mm2 \n\t" /* A2 a2 */\
+ "pmaddwd 104(%2), %%mm3 \n\t" /* -C1R7+C3R5 -C1r7+C3r5 */\
+ "paddd %%mm7, %%mm4 \n\t" /* B2 b2 */\
+ "paddd %%mm4, %%mm2 \n\t" /* A2+B2 a2+b2 */\
+ "psubd %%mm4, %%mm0 \n\t" /* a2-B2 a2-b2 */\
+ "psrad $" #shift ", %%mm2 \n\t"\
+ "psrad $" #shift ", %%mm0 \n\t"\
+ "movq %%mm6, %%mm4 \n\t" /* A3 a3 */\
+ "paddd %%mm1, %%mm3 \n\t" /* B3 b3 */\
+ "paddd %%mm3, %%mm6 \n\t" /* A3+B3 a3+b3 */\
+ "psubd %%mm3, %%mm4 \n\t" /* a3-B3 a3-b3 */\
+ "psrad $" #shift ", %%mm6 \n\t"\
+ "packssdw %%mm6, %%mm2 \n\t" /* A3+B3 a3+b3 A2+B2 a2+b2 */\
+ "movq %%mm2, 8+" #dst " \n\t"\
+ "psrad $" #shift ", %%mm4 \n\t"\
+ "packssdw %%mm0, %%mm4 \n\t" /* A2-B2 a2-b2 A3-B3 a3-b3 */\
+ "movq %%mm4, 16+" #dst " \n\t"\
+
+#define ROW_IDCT(src0, src4, src1, src5, dst, rounder, shift) \
+ "movq " #src0 ", %%mm0 \n\t" /* R4 R0 r4 r0 */\
+ "movq " #src4 ", %%mm1 \n\t" /* R6 R2 r6 r2 */\
+ "movq " #src1 ", %%mm2 \n\t" /* R3 R1 r3 r1 */\
+ "movq " #src5 ", %%mm3 \n\t" /* R7 R5 r7 r5 */\
+ "movq 16(%2), %%mm4 \n\t" /* C4 C4 C4 C4 */\
+ "pmaddwd %%mm0, %%mm4 \n\t" /* C4R4+C4R0 C4r4+C4r0 */\
+ "movq 24(%2), %%mm5 \n\t" /* -C4 C4 -C4 C4 */\
+ "pmaddwd %%mm5, %%mm0 \n\t" /* -C4R4+C4R0 -C4r4+C4r0 */\
+ "movq 32(%2), %%mm5 \n\t" /* C6 C2 C6 C2 */\
+ "pmaddwd %%mm1, %%mm5 \n\t" /* C6R6+C2R2 C6r6+C2r2 */\
+ "movq 40(%2), %%mm6 \n\t" /* -C2 C6 -C2 C6 */\
+ "pmaddwd %%mm6, %%mm1 \n\t" /* -C2R6+C6R2 -C2r6+C6r2 */\
+ "movq 48(%2), %%mm7 \n\t" /* C3 C1 C3 C1 */\
+ "pmaddwd %%mm2, %%mm7 \n\t" /* C3R3+C1R1 C3r3+C1r1 */\
+ #rounder ", %%mm4 \n\t"\
+ "movq %%mm4, %%mm6 \n\t" /* C4R4+C4R0 C4r4+C4r0 */\
+ "paddd %%mm5, %%mm4 \n\t" /* A0 a0 */\
+ "psubd %%mm5, %%mm6 \n\t" /* A3 a3 */\
+ "movq 56(%2), %%mm5 \n\t" /* C7 C5 C7 C5 */\
+ "pmaddwd %%mm3, %%mm5 \n\t" /* C7R7+C5R5 C7r7+C5r5 */\
+ #rounder ", %%mm0 \n\t"\
+ "paddd %%mm0, %%mm1 \n\t" /* A1 a1 */\
+ "paddd %%mm0, %%mm0 \n\t" \
+ "psubd %%mm1, %%mm0 \n\t" /* A2 a2 */\
+ "pmaddwd 64(%2), %%mm2 \n\t" /* -C7R3+C3R1 -C7r3+C3r1 */\
+ "paddd %%mm5, %%mm7 \n\t" /* B0 b0 */\
+ "movq 72(%2), %%mm5 \n\t" /* -C5 -C1 -C5 -C1 */\
+ "pmaddwd %%mm3, %%mm5 \n\t" /* -C5R7-C1R5 -C5r7-C1r5 */\
+ "paddd %%mm4, %%mm7 \n\t" /* A0+B0 a0+b0 */\
+ "paddd %%mm4, %%mm4 \n\t" /* 2A0 2a0 */\
+ "psubd %%mm7, %%mm4 \n\t" /* A0-B0 a0-b0 */\
+ "paddd %%mm2, %%mm5 \n\t" /* B1 b1 */\
+ "psrad $" #shift ", %%mm7 \n\t"\
+ "psrad $" #shift ", %%mm4 \n\t"\
+ "movq %%mm1, %%mm2 \n\t" /* A1 a1 */\
+ "paddd %%mm5, %%mm1 \n\t" /* A1+B1 a1+b1 */\
+ "psubd %%mm5, %%mm2 \n\t" /* A1-B1 a1-b1 */\
+ "psrad $" #shift ", %%mm1 \n\t"\
+ "psrad $" #shift ", %%mm2 \n\t"\
+ "packssdw %%mm1, %%mm7 \n\t" /* A1+B1 a1+b1 A0+B0 a0+b0 */\
+ "packssdw %%mm4, %%mm2 \n\t" /* A0-B0 a0-b0 A1-B1 a1-b1 */\
+ "movq %%mm7, " #dst " \n\t"\
+ "movq " #src1 ", %%mm1 \n\t" /* R3 R1 r3 r1 */\
+ "movq 80(%2), %%mm4 \n\t" /* -C1 C5 -C1 C5 */\
+ "movq %%mm2, 24+" #dst " \n\t"\
+ "pmaddwd %%mm1, %%mm4 \n\t" /* -C1R3+C5R1 -C1r3+C5r1 */\
+ "movq 88(%2), %%mm7 \n\t" /* C3 C7 C3 C7 */\
+ "pmaddwd 96(%2), %%mm1 \n\t" /* -C5R3+C7R1 -C5r3+C7r1 */\
+ "pmaddwd %%mm3, %%mm7 \n\t" /* C3R7+C7R5 C3r7+C7r5 */\
+ "movq %%mm0, %%mm2 \n\t" /* A2 a2 */\
+ "pmaddwd 104(%2), %%mm3 \n\t" /* -C1R7+C3R5 -C1r7+C3r5 */\
+ "paddd %%mm7, %%mm4 \n\t" /* B2 b2 */\
+ "paddd %%mm4, %%mm2 \n\t" /* A2+B2 a2+b2 */\
+ "psubd %%mm4, %%mm0 \n\t" /* a2-B2 a2-b2 */\
+ "psrad $" #shift ", %%mm2 \n\t"\
+ "psrad $" #shift ", %%mm0 \n\t"\
+ "movq %%mm6, %%mm4 \n\t" /* A3 a3 */\
+ "paddd %%mm1, %%mm3 \n\t" /* B3 b3 */\
+ "paddd %%mm3, %%mm6 \n\t" /* A3+B3 a3+b3 */\
+ "psubd %%mm3, %%mm4 \n\t" /* a3-B3 a3-b3 */\
+ "psrad $" #shift ", %%mm6 \n\t"\
+ "packssdw %%mm6, %%mm2 \n\t" /* A3+B3 a3+b3 A2+B2 a2+b2 */\
+ "movq %%mm2, 8+" #dst " \n\t"\
+ "psrad $" #shift ", %%mm4 \n\t"\
+ "packssdw %%mm0, %%mm4 \n\t" /* A2-B2 a2-b2 A3-B3 a3-b3 */\
+ "movq %%mm4, 16+" #dst " \n\t"\
+
+//IDCT( src0, src4, src1, src5, dst, rounder, shift)
+DC_COND_IDCT( 0(%0), 8(%0), 16(%0), 24(%0), 0(%1),paddd 8(%2), 11)
+Z_COND_IDCT( 32(%0), 40(%0), 48(%0), 56(%0), 32(%1),paddd (%2), 11, 4f)
+Z_COND_IDCT( 64(%0), 72(%0), 80(%0), 88(%0), 64(%1),paddd (%2), 11, 2f)
+Z_COND_IDCT( 96(%0),104(%0),112(%0),120(%0), 96(%1),paddd (%2), 11, 1f)
+
+#undef IDCT
+#define IDCT(src0, src4, src1, src5, dst, shift) \
+ "movq " #src0 ", %%mm0 \n\t" /* R4 R0 r4 r0 */\
+ "movq " #src4 ", %%mm1 \n\t" /* R6 R2 r6 r2 */\
+ "movq " #src1 ", %%mm2 \n\t" /* R3 R1 r3 r1 */\
+ "movq " #src5 ", %%mm3 \n\t" /* R7 R5 r7 r5 */\
+ "movq 16(%2), %%mm4 \n\t" /* C4 C4 C4 C4 */\
+ "pmaddwd %%mm0, %%mm4 \n\t" /* C4R4+C4R0 C4r4+C4r0 */\
+ "movq 24(%2), %%mm5 \n\t" /* -C4 C4 -C4 C4 */\
+ "pmaddwd %%mm5, %%mm0 \n\t" /* -C4R4+C4R0 -C4r4+C4r0 */\
+ "movq 32(%2), %%mm5 \n\t" /* C6 C2 C6 C2 */\
+ "pmaddwd %%mm1, %%mm5 \n\t" /* C6R6+C2R2 C6r6+C2r2 */\
+ "movq 40(%2), %%mm6 \n\t" /* -C2 C6 -C2 C6 */\
+ "pmaddwd %%mm6, %%mm1 \n\t" /* -C2R6+C6R2 -C2r6+C6r2 */\
+ "movq %%mm4, %%mm6 \n\t" /* C4R4+C4R0 C4r4+C4r0 */\
+ "movq 48(%2), %%mm7 \n\t" /* C3 C1 C3 C1 */\
+ "pmaddwd %%mm2, %%mm7 \n\t" /* C3R3+C1R1 C3r3+C1r1 */\
+ "paddd %%mm5, %%mm4 \n\t" /* A0 a0 */\
+ "psubd %%mm5, %%mm6 \n\t" /* A3 a3 */\
+ "movq %%mm0, %%mm5 \n\t" /* -C4R4+C4R0 -C4r4+C4r0 */\
+ "paddd %%mm1, %%mm0 \n\t" /* A1 a1 */\
+ "psubd %%mm1, %%mm5 \n\t" /* A2 a2 */\
+ "movq 56(%2), %%mm1 \n\t" /* C7 C5 C7 C5 */\
+ "pmaddwd %%mm3, %%mm1 \n\t" /* C7R7+C5R5 C7r7+C5r5 */\
+ "pmaddwd 64(%2), %%mm2 \n\t" /* -C7R3+C3R1 -C7r3+C3r1 */\
+ "paddd %%mm1, %%mm7 \n\t" /* B0 b0 */\
+ "movq 72(%2), %%mm1 \n\t" /* -C5 -C1 -C5 -C1 */\
+ "pmaddwd %%mm3, %%mm1 \n\t" /* -C5R7-C1R5 -C5r7-C1r5 */\
+ "paddd %%mm4, %%mm7 \n\t" /* A0+B0 a0+b0 */\
+ "paddd %%mm4, %%mm4 \n\t" /* 2A0 2a0 */\
+ "psubd %%mm7, %%mm4 \n\t" /* A0-B0 a0-b0 */\
+ "paddd %%mm2, %%mm1 \n\t" /* B1 b1 */\
+ "psrad $" #shift ", %%mm7 \n\t"\
+ "psrad $" #shift ", %%mm4 \n\t"\
+ "movq %%mm0, %%mm2 \n\t" /* A1 a1 */\
+ "paddd %%mm1, %%mm0 \n\t" /* A1+B1 a1+b1 */\
+ "psubd %%mm1, %%mm2 \n\t" /* A1-B1 a1-b1 */\
+ "psrad $" #shift ", %%mm0 \n\t"\
+ "psrad $" #shift ", %%mm2 \n\t"\
+ "packssdw %%mm7, %%mm7 \n\t" /* A0+B0 a0+b0 */\
+ "movd %%mm7, " #dst " \n\t"\
+ "packssdw %%mm0, %%mm0 \n\t" /* A1+B1 a1+b1 */\
+ "movd %%mm0, 16+" #dst " \n\t"\
+ "packssdw %%mm2, %%mm2 \n\t" /* A1-B1 a1-b1 */\
+ "movd %%mm2, 96+" #dst " \n\t"\
+ "packssdw %%mm4, %%mm4 \n\t" /* A0-B0 a0-b0 */\
+ "movd %%mm4, 112+" #dst " \n\t"\
+ "movq " #src1 ", %%mm0 \n\t" /* R3 R1 r3 r1 */\
+ "movq 80(%2), %%mm4 \n\t" /* -C1 C5 -C1 C5 */\
+ "pmaddwd %%mm0, %%mm4 \n\t" /* -C1R3+C5R1 -C1r3+C5r1 */\
+ "movq 88(%2), %%mm7 \n\t" /* C3 C7 C3 C7 */\
+ "pmaddwd 96(%2), %%mm0 \n\t" /* -C5R3+C7R1 -C5r3+C7r1 */\
+ "pmaddwd %%mm3, %%mm7 \n\t" /* C3R7+C7R5 C3r7+C7r5 */\
+ "movq %%mm5, %%mm2 \n\t" /* A2 a2 */\
+ "pmaddwd 104(%2), %%mm3 \n\t" /* -C1R7+C3R5 -C1r7+C3r5 */\
+ "paddd %%mm7, %%mm4 \n\t" /* B2 b2 */\
+ "paddd %%mm4, %%mm2 \n\t" /* A2+B2 a2+b2 */\
+ "psubd %%mm4, %%mm5 \n\t" /* a2-B2 a2-b2 */\
+ "psrad $" #shift ", %%mm2 \n\t"\
+ "psrad $" #shift ", %%mm5 \n\t"\
+ "movq %%mm6, %%mm4 \n\t" /* A3 a3 */\
+ "paddd %%mm0, %%mm3 \n\t" /* B3 b3 */\
+ "paddd %%mm3, %%mm6 \n\t" /* A3+B3 a3+b3 */\
+ "psubd %%mm3, %%mm4 \n\t" /* a3-B3 a3-b3 */\
+ "psrad $" #shift ", %%mm6 \n\t"\
+ "psrad $" #shift ", %%mm4 \n\t"\
+ "packssdw %%mm2, %%mm2 \n\t" /* A2+B2 a2+b2 */\
+ "packssdw %%mm6, %%mm6 \n\t" /* A3+B3 a3+b3 */\
+ "movd %%mm2, 32+" #dst " \n\t"\
+ "packssdw %%mm4, %%mm4 \n\t" /* A3-B3 a3-b3 */\
+ "packssdw %%mm5, %%mm5 \n\t" /* A2-B2 a2-b2 */\
+ "movd %%mm6, 48+" #dst " \n\t"\
+ "movd %%mm4, 64+" #dst " \n\t"\
+ "movd %%mm5, 80+" #dst " \n\t"
+
+
+//IDCT( src0, src4, src1, src5, dst, shift)
+IDCT( (%1), 64(%1), 32(%1), 96(%1), 0(%0), 20)
+IDCT( 8(%1), 72(%1), 40(%1), 104(%1), 4(%0), 20)
+IDCT( 16(%1), 80(%1), 48(%1), 112(%1), 8(%0), 20)
+IDCT( 24(%1), 88(%1), 56(%1), 120(%1), 12(%0), 20)
+ "jmp 9f \n\t"
+
+ "# .p2align 4 \n\t"\
+ "4: \n\t"
+Z_COND_IDCT( 64(%0), 72(%0), 80(%0), 88(%0), 64(%1),paddd (%2), 11, 6f)
+Z_COND_IDCT( 96(%0),104(%0),112(%0),120(%0), 96(%1),paddd (%2), 11, 5f)
+
+#undef IDCT
+#define IDCT(src0, src4, src1, src5, dst, shift) \
+ "movq " #src0 ", %%mm0 \n\t" /* R4 R0 r4 r0 */\
+ "movq " #src4 ", %%mm1 \n\t" /* R6 R2 r6 r2 */\
+ "movq " #src5 ", %%mm3 \n\t" /* R7 R5 r7 r5 */\
+ "movq 16(%2), %%mm4 \n\t" /* C4 C4 C4 C4 */\
+ "pmaddwd %%mm0, %%mm4 \n\t" /* C4R4+C4R0 C4r4+C4r0 */\
+ "movq 24(%2), %%mm5 \n\t" /* -C4 C4 -C4 C4 */\
+ "pmaddwd %%mm5, %%mm0 \n\t" /* -C4R4+C4R0 -C4r4+C4r0 */\
+ "movq 32(%2), %%mm5 \n\t" /* C6 C2 C6 C2 */\
+ "pmaddwd %%mm1, %%mm5 \n\t" /* C6R6+C2R2 C6r6+C2r2 */\
+ "movq 40(%2), %%mm6 \n\t" /* -C2 C6 -C2 C6 */\
+ "pmaddwd %%mm6, %%mm1 \n\t" /* -C2R6+C6R2 -C2r6+C6r2 */\
+ "movq %%mm4, %%mm6 \n\t" /* C4R4+C4R0 C4r4+C4r0 */\
+ "paddd %%mm5, %%mm4 \n\t" /* A0 a0 */\
+ "psubd %%mm5, %%mm6 \n\t" /* A3 a3 */\
+ "movq %%mm0, %%mm5 \n\t" /* -C4R4+C4R0 -C4r4+C4r0 */\
+ "paddd %%mm1, %%mm0 \n\t" /* A1 a1 */\
+ "psubd %%mm1, %%mm5 \n\t" /* A2 a2 */\
+ "movq 56(%2), %%mm1 \n\t" /* C7 C5 C7 C5 */\
+ "pmaddwd %%mm3, %%mm1 \n\t" /* C7R7+C5R5 C7r7+C5r5 */\
+ "movq 72(%2), %%mm7 \n\t" /* -C5 -C1 -C5 -C1 */\
+ "pmaddwd %%mm3, %%mm7 \n\t" /* -C5R7-C1R5 -C5r7-C1r5 */\
+ "paddd %%mm4, %%mm1 \n\t" /* A0+B0 a0+b0 */\
+ "paddd %%mm4, %%mm4 \n\t" /* 2A0 2a0 */\
+ "psubd %%mm1, %%mm4 \n\t" /* A0-B0 a0-b0 */\
+ "psrad $" #shift ", %%mm1 \n\t"\
+ "psrad $" #shift ", %%mm4 \n\t"\
+ "movq %%mm0, %%mm2 \n\t" /* A1 a1 */\
+ "paddd %%mm7, %%mm0 \n\t" /* A1+B1 a1+b1 */\
+ "psubd %%mm7, %%mm2 \n\t" /* A1-B1 a1-b1 */\
+ "psrad $" #shift ", %%mm0 \n\t"\
+ "psrad $" #shift ", %%mm2 \n\t"\
+ "packssdw %%mm1, %%mm1 \n\t" /* A0+B0 a0+b0 */\
+ "movd %%mm1, " #dst " \n\t"\
+ "packssdw %%mm0, %%mm0 \n\t" /* A1+B1 a1+b1 */\
+ "movd %%mm0, 16+" #dst " \n\t"\
+ "packssdw %%mm2, %%mm2 \n\t" /* A1-B1 a1-b1 */\
+ "movd %%mm2, 96+" #dst " \n\t"\
+ "packssdw %%mm4, %%mm4 \n\t" /* A0-B0 a0-b0 */\
+ "movd %%mm4, 112+" #dst " \n\t"\
+ "movq 88(%2), %%mm1 \n\t" /* C3 C7 C3 C7 */\
+ "pmaddwd %%mm3, %%mm1 \n\t" /* C3R7+C7R5 C3r7+C7r5 */\
+ "movq %%mm5, %%mm2 \n\t" /* A2 a2 */\
+ "pmaddwd 104(%2), %%mm3 \n\t" /* -C1R7+C3R5 -C1r7+C3r5 */\
+ "paddd %%mm1, %%mm2 \n\t" /* A2+B2 a2+b2 */\
+ "psubd %%mm1, %%mm5 \n\t" /* a2-B2 a2-b2 */\
+ "psrad $" #shift ", %%mm2 \n\t"\
+ "psrad $" #shift ", %%mm5 \n\t"\
+ "movq %%mm6, %%mm1 \n\t" /* A3 a3 */\
+ "paddd %%mm3, %%mm6 \n\t" /* A3+B3 a3+b3 */\
+ "psubd %%mm3, %%mm1 \n\t" /* a3-B3 a3-b3 */\
+ "psrad $" #shift ", %%mm6 \n\t"\
+ "psrad $" #shift ", %%mm1 \n\t"\
+ "packssdw %%mm2, %%mm2 \n\t" /* A2+B2 a2+b2 */\
+ "packssdw %%mm6, %%mm6 \n\t" /* A3+B3 a3+b3 */\
+ "movd %%mm2, 32+" #dst " \n\t"\
+ "packssdw %%mm1, %%mm1 \n\t" /* A3-B3 a3-b3 */\
+ "packssdw %%mm5, %%mm5 \n\t" /* A2-B2 a2-b2 */\
+ "movd %%mm6, 48+" #dst " \n\t"\
+ "movd %%mm1, 64+" #dst " \n\t"\
+ "movd %%mm5, 80+" #dst " \n\t"
+
+//IDCT( src0, src4, src1, src5, dst, shift)
+IDCT( (%1), 64(%1), 32(%1), 96(%1), 0(%0), 20)
+IDCT( 8(%1), 72(%1), 40(%1), 104(%1), 4(%0), 20)
+IDCT( 16(%1), 80(%1), 48(%1), 112(%1), 8(%0), 20)
+IDCT( 24(%1), 88(%1), 56(%1), 120(%1), 12(%0), 20)
+ "jmp 9f \n\t"
+
+ "# .p2align 4 \n\t"\
+ "6: \n\t"
+Z_COND_IDCT( 96(%0),104(%0),112(%0),120(%0), 96(%1),paddd (%2), 11, 7f)
+
+#undef IDCT
+#define IDCT(src0, src4, src1, src5, dst, shift) \
+ "movq " #src0 ", %%mm0 \n\t" /* R4 R0 r4 r0 */\
+ "movq " #src5 ", %%mm3 \n\t" /* R7 R5 r7 r5 */\
+ "movq 16(%2), %%mm4 \n\t" /* C4 C4 C4 C4 */\
+ "pmaddwd %%mm0, %%mm4 \n\t" /* C4R4+C4R0 C4r4+C4r0 */\
+ "movq 24(%2), %%mm5 \n\t" /* -C4 C4 -C4 C4 */\
+ "pmaddwd %%mm5, %%mm0 \n\t" /* -C4R4+C4R0 -C4r4+C4r0 */\
+ "movq %%mm4, %%mm6 \n\t" /* C4R4+C4R0 C4r4+C4r0 */\
+ "movq %%mm0, %%mm5 \n\t" /* -C4R4+C4R0 -C4r4+C4r0 */\
+ "movq 56(%2), %%mm1 \n\t" /* C7 C5 C7 C5 */\
+ "pmaddwd %%mm3, %%mm1 \n\t" /* C7R7+C5R5 C7r7+C5r5 */\
+ "movq 72(%2), %%mm7 \n\t" /* -C5 -C1 -C5 -C1 */\
+ "pmaddwd %%mm3, %%mm7 \n\t" /* -C5R7-C1R5 -C5r7-C1r5 */\
+ "paddd %%mm4, %%mm1 \n\t" /* A0+B0 a0+b0 */\
+ "paddd %%mm4, %%mm4 \n\t" /* 2A0 2a0 */\
+ "psubd %%mm1, %%mm4 \n\t" /* A0-B0 a0-b0 */\
+ "psrad $" #shift ", %%mm1 \n\t"\
+ "psrad $" #shift ", %%mm4 \n\t"\
+ "movq %%mm0, %%mm2 \n\t" /* A1 a1 */\
+ "paddd %%mm7, %%mm0 \n\t" /* A1+B1 a1+b1 */\
+ "psubd %%mm7, %%mm2 \n\t" /* A1-B1 a1-b1 */\
+ "psrad $" #shift ", %%mm0 \n\t"\
+ "psrad $" #shift ", %%mm2 \n\t"\
+ "packssdw %%mm1, %%mm1 \n\t" /* A0+B0 a0+b0 */\
+ "movd %%mm1, " #dst " \n\t"\
+ "packssdw %%mm0, %%mm0 \n\t" /* A1+B1 a1+b1 */\
+ "movd %%mm0, 16+" #dst " \n\t"\
+ "packssdw %%mm2, %%mm2 \n\t" /* A1-B1 a1-b1 */\
+ "movd %%mm2, 96+" #dst " \n\t"\
+ "packssdw %%mm4, %%mm4 \n\t" /* A0-B0 a0-b0 */\
+ "movd %%mm4, 112+" #dst " \n\t"\
+ "movq 88(%2), %%mm1 \n\t" /* C3 C7 C3 C7 */\
+ "pmaddwd %%mm3, %%mm1 \n\t" /* C3R7+C7R5 C3r7+C7r5 */\
+ "movq %%mm5, %%mm2 \n\t" /* A2 a2 */\
+ "pmaddwd 104(%2), %%mm3 \n\t" /* -C1R7+C3R5 -C1r7+C3r5 */\
+ "paddd %%mm1, %%mm2 \n\t" /* A2+B2 a2+b2 */\
+ "psubd %%mm1, %%mm5 \n\t" /* a2-B2 a2-b2 */\
+ "psrad $" #shift ", %%mm2 \n\t"\
+ "psrad $" #shift ", %%mm5 \n\t"\
+ "movq %%mm6, %%mm1 \n\t" /* A3 a3 */\
+ "paddd %%mm3, %%mm6 \n\t" /* A3+B3 a3+b3 */\
+ "psubd %%mm3, %%mm1 \n\t" /* a3-B3 a3-b3 */\
+ "psrad $" #shift ", %%mm6 \n\t"\
+ "psrad $" #shift ", %%mm1 \n\t"\
+ "packssdw %%mm2, %%mm2 \n\t" /* A2+B2 a2+b2 */\
+ "packssdw %%mm6, %%mm6 \n\t" /* A3+B3 a3+b3 */\
+ "movd %%mm2, 32+" #dst " \n\t"\
+ "packssdw %%mm1, %%mm1 \n\t" /* A3-B3 a3-b3 */\
+ "packssdw %%mm5, %%mm5 \n\t" /* A2-B2 a2-b2 */\
+ "movd %%mm6, 48+" #dst " \n\t"\
+ "movd %%mm1, 64+" #dst " \n\t"\
+ "movd %%mm5, 80+" #dst " \n\t"
+
+
+//IDCT( src0, src4, src1, src5, dst, shift)
+IDCT( (%1), 64(%1), 32(%1), 96(%1), 0(%0), 20)
+IDCT( 8(%1), 72(%1), 40(%1), 104(%1), 4(%0), 20)
+IDCT( 16(%1), 80(%1), 48(%1), 112(%1), 8(%0), 20)
+IDCT( 24(%1), 88(%1), 56(%1), 120(%1), 12(%0), 20)
+ "jmp 9f \n\t"
+
+ "# .p2align 4 \n\t"\
+ "2: \n\t"
+Z_COND_IDCT( 96(%0),104(%0),112(%0),120(%0), 96(%1),paddd (%2), 11, 3f)
+
+#undef IDCT
+#define IDCT(src0, src4, src1, src5, dst, shift) \
+ "movq " #src0 ", %%mm0 \n\t" /* R4 R0 r4 r0 */\
+ "movq " #src1 ", %%mm2 \n\t" /* R3 R1 r3 r1 */\
+ "movq " #src5 ", %%mm3 \n\t" /* R7 R5 r7 r5 */\
+ "movq 16(%2), %%mm4 \n\t" /* C4 C4 C4 C4 */\
+ "pmaddwd %%mm0, %%mm4 \n\t" /* C4R4+C4R0 C4r4+C4r0 */\
+ "movq 24(%2), %%mm5 \n\t" /* -C4 C4 -C4 C4 */\
+ "pmaddwd %%mm5, %%mm0 \n\t" /* -C4R4+C4R0 -C4r4+C4r0 */\
+ "movq %%mm4, %%mm6 \n\t" /* C4R4+C4R0 C4r4+C4r0 */\
+ "movq 48(%2), %%mm7 \n\t" /* C3 C1 C3 C1 */\
+ "pmaddwd %%mm2, %%mm7 \n\t" /* C3R3+C1R1 C3r3+C1r1 */\
+ "movq %%mm0, %%mm5 \n\t" /* -C4R4+C4R0 -C4r4+C4r0 */\
+ "movq 56(%2), %%mm1 \n\t" /* C7 C5 C7 C5 */\
+ "pmaddwd %%mm3, %%mm1 \n\t" /* C7R7+C5R5 C7r7+C5r5 */\
+ "pmaddwd 64(%2), %%mm2 \n\t" /* -C7R3+C3R1 -C7r3+C3r1 */\
+ "paddd %%mm1, %%mm7 \n\t" /* B0 b0 */\
+ "movq 72(%2), %%mm1 \n\t" /* -C5 -C1 -C5 -C1 */\
+ "pmaddwd %%mm3, %%mm1 \n\t" /* -C5R7-C1R5 -C5r7-C1r5 */\
+ "paddd %%mm4, %%mm7 \n\t" /* A0+B0 a0+b0 */\
+ "paddd %%mm4, %%mm4 \n\t" /* 2A0 2a0 */\
+ "psubd %%mm7, %%mm4 \n\t" /* A0-B0 a0-b0 */\
+ "paddd %%mm2, %%mm1 \n\t" /* B1 b1 */\
+ "psrad $" #shift ", %%mm7 \n\t"\
+ "psrad $" #shift ", %%mm4 \n\t"\
+ "movq %%mm0, %%mm2 \n\t" /* A1 a1 */\
+ "paddd %%mm1, %%mm0 \n\t" /* A1+B1 a1+b1 */\
+ "psubd %%mm1, %%mm2 \n\t" /* A1-B1 a1-b1 */\
+ "psrad $" #shift ", %%mm0 \n\t"\
+ "psrad $" #shift ", %%mm2 \n\t"\
+ "packssdw %%mm7, %%mm7 \n\t" /* A0+B0 a0+b0 */\
+ "movd %%mm7, " #dst " \n\t"\
+ "packssdw %%mm0, %%mm0 \n\t" /* A1+B1 a1+b1 */\
+ "movd %%mm0, 16+" #dst " \n\t"\
+ "packssdw %%mm2, %%mm2 \n\t" /* A1-B1 a1-b1 */\
+ "movd %%mm2, 96+" #dst " \n\t"\
+ "packssdw %%mm4, %%mm4 \n\t" /* A0-B0 a0-b0 */\
+ "movd %%mm4, 112+" #dst " \n\t"\
+ "movq " #src1 ", %%mm0 \n\t" /* R3 R1 r3 r1 */\
+ "movq 80(%2), %%mm4 \n\t" /* -C1 C5 -C1 C5 */\
+ "pmaddwd %%mm0, %%mm4 \n\t" /* -C1R3+C5R1 -C1r3+C5r1 */\
+ "movq 88(%2), %%mm7 \n\t" /* C3 C7 C3 C7 */\
+ "pmaddwd 96(%2), %%mm0 \n\t" /* -C5R3+C7R1 -C5r3+C7r1 */\
+ "pmaddwd %%mm3, %%mm7 \n\t" /* C3R7+C7R5 C3r7+C7r5 */\
+ "movq %%mm5, %%mm2 \n\t" /* A2 a2 */\
+ "pmaddwd 104(%2), %%mm3 \n\t" /* -C1R7+C3R5 -C1r7+C3r5 */\
+ "paddd %%mm7, %%mm4 \n\t" /* B2 b2 */\
+ "paddd %%mm4, %%mm2 \n\t" /* A2+B2 a2+b2 */\
+ "psubd %%mm4, %%mm5 \n\t" /* a2-B2 a2-b2 */\
+ "psrad $" #shift ", %%mm2 \n\t"\
+ "psrad $" #shift ", %%mm5 \n\t"\
+ "movq %%mm6, %%mm4 \n\t" /* A3 a3 */\
+ "paddd %%mm0, %%mm3 \n\t" /* B3 b3 */\
+ "paddd %%mm3, %%mm6 \n\t" /* A3+B3 a3+b3 */\
+ "psubd %%mm3, %%mm4 \n\t" /* a3-B3 a3-b3 */\
+ "psrad $" #shift ", %%mm6 \n\t"\
+ "psrad $" #shift ", %%mm4 \n\t"\
+ "packssdw %%mm2, %%mm2 \n\t" /* A2+B2 a2+b2 */\
+ "packssdw %%mm6, %%mm6 \n\t" /* A3+B3 a3+b3 */\
+ "movd %%mm2, 32+" #dst " \n\t"\
+ "packssdw %%mm4, %%mm4 \n\t" /* A3-B3 a3-b3 */\
+ "packssdw %%mm5, %%mm5 \n\t" /* A2-B2 a2-b2 */\
+ "movd %%mm6, 48+" #dst " \n\t"\
+ "movd %%mm4, 64+" #dst " \n\t"\
+ "movd %%mm5, 80+" #dst " \n\t"
+
+//IDCT( src0, src4, src1, src5, dst, shift)
+IDCT( (%1), 64(%1), 32(%1), 96(%1), 0(%0), 20)
+IDCT( 8(%1), 72(%1), 40(%1), 104(%1), 4(%0), 20)
+IDCT( 16(%1), 80(%1), 48(%1), 112(%1), 8(%0), 20)
+IDCT( 24(%1), 88(%1), 56(%1), 120(%1), 12(%0), 20)
+ "jmp 9f \n\t"
+
+ "# .p2align 4 \n\t"\
+ "3: \n\t"
+#undef IDCT
+#define IDCT(src0, src4, src1, src5, dst, shift) \
+ "movq " #src0 ", %%mm0 \n\t" /* R4 R0 r4 r0 */\
+ "movq " #src1 ", %%mm2 \n\t" /* R3 R1 r3 r1 */\
+ "movq 16(%2), %%mm4 \n\t" /* C4 C4 C4 C4 */\
+ "pmaddwd %%mm0, %%mm4 \n\t" /* C4R4+C4R0 C4r4+C4r0 */\
+ "movq 24(%2), %%mm5 \n\t" /* -C4 C4 -C4 C4 */\
+ "pmaddwd %%mm5, %%mm0 \n\t" /* -C4R4+C4R0 -C4r4+C4r0 */\
+ "movq %%mm4, %%mm6 \n\t" /* C4R4+C4R0 C4r4+C4r0 */\
+ "movq 48(%2), %%mm7 \n\t" /* C3 C1 C3 C1 */\
+ "pmaddwd %%mm2, %%mm7 \n\t" /* C3R3+C1R1 C3r3+C1r1 */\
+ "movq %%mm0, %%mm5 \n\t" /* -C4R4+C4R0 -C4r4+C4r0 */\
+ "movq 64(%2), %%mm3 \n\t"\
+ "pmaddwd %%mm2, %%mm3 \n\t" /* -C7R3+C3R1 -C7r3+C3r1 */\
+ "paddd %%mm4, %%mm7 \n\t" /* A0+B0 a0+b0 */\
+ "paddd %%mm4, %%mm4 \n\t" /* 2A0 2a0 */\
+ "psubd %%mm7, %%mm4 \n\t" /* A0-B0 a0-b0 */\
+ "psrad $" #shift ", %%mm7 \n\t"\
+ "psrad $" #shift ", %%mm4 \n\t"\
+ "movq %%mm0, %%mm1 \n\t" /* A1 a1 */\
+ "paddd %%mm3, %%mm0 \n\t" /* A1+B1 a1+b1 */\
+ "psubd %%mm3, %%mm1 \n\t" /* A1-B1 a1-b1 */\
+ "psrad $" #shift ", %%mm0 \n\t"\
+ "psrad $" #shift ", %%mm1 \n\t"\
+ "packssdw %%mm7, %%mm7 \n\t" /* A0+B0 a0+b0 */\
+ "movd %%mm7, " #dst " \n\t"\
+ "packssdw %%mm0, %%mm0 \n\t" /* A1+B1 a1+b1 */\
+ "movd %%mm0, 16+" #dst " \n\t"\
+ "packssdw %%mm1, %%mm1 \n\t" /* A1-B1 a1-b1 */\
+ "movd %%mm1, 96+" #dst " \n\t"\
+ "packssdw %%mm4, %%mm4 \n\t" /* A0-B0 a0-b0 */\
+ "movd %%mm4, 112+" #dst " \n\t"\
+ "movq 80(%2), %%mm4 \n\t" /* -C1 C5 -C1 C5 */\
+ "pmaddwd %%mm2, %%mm4 \n\t" /* -C1R3+C5R1 -C1r3+C5r1 */\
+ "pmaddwd 96(%2), %%mm2 \n\t" /* -C5R3+C7R1 -C5r3+C7r1 */\
+ "movq %%mm5, %%mm1 \n\t" /* A2 a2 */\
+ "paddd %%mm4, %%mm1 \n\t" /* A2+B2 a2+b2 */\
+ "psubd %%mm4, %%mm5 \n\t" /* a2-B2 a2-b2 */\
+ "psrad $" #shift ", %%mm1 \n\t"\
+ "psrad $" #shift ", %%mm5 \n\t"\
+ "movq %%mm6, %%mm4 \n\t" /* A3 a3 */\
+ "paddd %%mm2, %%mm6 \n\t" /* A3+B3 a3+b3 */\
+ "psubd %%mm2, %%mm4 \n\t" /* a3-B3 a3-b3 */\
+ "psrad $" #shift ", %%mm6 \n\t"\
+ "psrad $" #shift ", %%mm4 \n\t"\
+ "packssdw %%mm1, %%mm1 \n\t" /* A2+B2 a2+b2 */\
+ "packssdw %%mm6, %%mm6 \n\t" /* A3+B3 a3+b3 */\
+ "movd %%mm1, 32+" #dst " \n\t"\
+ "packssdw %%mm4, %%mm4 \n\t" /* A3-B3 a3-b3 */\
+ "packssdw %%mm5, %%mm5 \n\t" /* A2-B2 a2-b2 */\
+ "movd %%mm6, 48+" #dst " \n\t"\
+ "movd %%mm4, 64+" #dst " \n\t"\
+ "movd %%mm5, 80+" #dst " \n\t"
+
+
+//IDCT( src0, src4, src1, src5, dst, shift)
+IDCT( (%1), 64(%1), 32(%1), 96(%1), 0(%0), 20)
+IDCT( 8(%1), 72(%1), 40(%1), 104(%1), 4(%0), 20)
+IDCT( 16(%1), 80(%1), 48(%1), 112(%1), 8(%0), 20)
+IDCT( 24(%1), 88(%1), 56(%1), 120(%1), 12(%0), 20)
+ "jmp 9f \n\t"
+
+ "# .p2align 4 \n\t"\
+ "5: \n\t"
+#undef IDCT
+#define IDCT(src0, src4, src1, src5, dst, shift) \
+ "movq " #src0 ", %%mm0 \n\t" /* R4 R0 r4 r0 */\
+ "movq " #src4 ", %%mm1 \n\t" /* R6 R2 r6 r2 */\
+ "movq 16(%2), %%mm4 \n\t" /* C4 C4 C4 C4 */\
+ "pmaddwd %%mm0, %%mm4 \n\t" /* C4R4+C4R0 C4r4+C4r0 */\
+ "movq 24(%2), %%mm5 \n\t" /* -C4 C4 -C4 C4 */\
+ "pmaddwd %%mm5, %%mm0 \n\t" /* -C4R4+C4R0 -C4r4+C4r0 */\
+ "movq 32(%2), %%mm5 \n\t" /* C6 C2 C6 C2 */\
+ "pmaddwd %%mm1, %%mm5 \n\t" /* C6R6+C2R2 C6r6+C2r2 */\
+ "movq 40(%2), %%mm6 \n\t" /* -C2 C6 -C2 C6 */\
+ "pmaddwd %%mm6, %%mm1 \n\t" /* -C2R6+C6R2 -C2r6+C6r2 */\
+ "movq %%mm4, %%mm6 \n\t" /* C4R4+C4R0 C4r4+C4r0 */\
+ "paddd %%mm5, %%mm4 \n\t" /* A0 a0 */\
+ "psubd %%mm5, %%mm6 \n\t" /* A3 a3 */\
+ "movq %%mm0, %%mm5 \n\t" /* -C4R4+C4R0 -C4r4+C4r0 */\
+ "paddd %%mm1, %%mm0 \n\t" /* A1 a1 */\
+ "psubd %%mm1, %%mm5 \n\t" /* A2 a2 */\
+ "movq 8+" #src0 ", %%mm2 \n\t" /* R4 R0 r4 r0 */\
+ "movq 8+" #src4 ", %%mm3 \n\t" /* R6 R2 r6 r2 */\
+ "movq 16(%2), %%mm1 \n\t" /* C4 C4 C4 C4 */\
+ "pmaddwd %%mm2, %%mm1 \n\t" /* C4R4+C4R0 C4r4+C4r0 */\
+ "movq 24(%2), %%mm7 \n\t" /* -C4 C4 -C4 C4 */\
+ "pmaddwd %%mm7, %%mm2 \n\t" /* -C4R4+C4R0 -C4r4+C4r0 */\
+ "movq 32(%2), %%mm7 \n\t" /* C6 C2 C6 C2 */\
+ "pmaddwd %%mm3, %%mm7 \n\t" /* C6R6+C2R2 C6r6+C2r2 */\
+ "pmaddwd 40(%2), %%mm3 \n\t" /* -C2R6+C6R2 -C2r6+C6r2 */\
+ "paddd %%mm1, %%mm7 \n\t" /* A0 a0 */\
+ "paddd %%mm1, %%mm1 \n\t" /* 2C0 2c0 */\
+ "psubd %%mm7, %%mm1 \n\t" /* A3 a3 */\
+ "paddd %%mm2, %%mm3 \n\t" /* A1 a1 */\
+ "paddd %%mm2, %%mm2 \n\t" /* 2C1 2c1 */\
+ "psubd %%mm3, %%mm2 \n\t" /* A2 a2 */\
+ "psrad $" #shift ", %%mm4 \n\t"\
+ "psrad $" #shift ", %%mm7 \n\t"\
+ "psrad $" #shift ", %%mm3 \n\t"\
+ "packssdw %%mm7, %%mm4 \n\t" /* A0 a0 */\
+ "movq %%mm4, " #dst " \n\t"\
+ "psrad $" #shift ", %%mm0 \n\t"\
+ "packssdw %%mm3, %%mm0 \n\t" /* A1 a1 */\
+ "movq %%mm0, 16+" #dst " \n\t"\
+ "movq %%mm0, 96+" #dst " \n\t"\
+ "movq %%mm4, 112+" #dst " \n\t"\
+ "psrad $" #shift ", %%mm5 \n\t"\
+ "psrad $" #shift ", %%mm6 \n\t"\
+ "psrad $" #shift ", %%mm2 \n\t"\
+ "packssdw %%mm2, %%mm5 \n\t" /* A2-B2 a2-b2 */\
+ "movq %%mm5, 32+" #dst " \n\t"\
+ "psrad $" #shift ", %%mm1 \n\t"\
+ "packssdw %%mm1, %%mm6 \n\t" /* A3+B3 a3+b3 */\
+ "movq %%mm6, 48+" #dst " \n\t"\
+ "movq %%mm6, 64+" #dst " \n\t"\
+ "movq %%mm5, 80+" #dst " \n\t"
+
+
+//IDCT( src0, src4, src1, src5, dst, shift)
+IDCT( 0(%1), 64(%1), 32(%1), 96(%1), 0(%0), 20)
+//IDCT( 8(%1), 72(%1), 40(%1), 104(%1), 4(%0), 20)
+IDCT( 16(%1), 80(%1), 48(%1), 112(%1), 8(%0), 20)
+//IDCT( 24(%1), 88(%1), 56(%1), 120(%1), 12(%0), 20)
+ "jmp 9f \n\t"
+
+
+ "# .p2align 4 \n\t"\
+ "1: \n\t"
+#undef IDCT
+#define IDCT(src0, src4, src1, src5, dst, shift) \
+ "movq " #src0 ", %%mm0 \n\t" /* R4 R0 r4 r0 */\
+ "movq " #src4 ", %%mm1 \n\t" /* R6 R2 r6 r2 */\
+ "movq " #src1 ", %%mm2 \n\t" /* R3 R1 r3 r1 */\
+ "movq 16(%2), %%mm4 \n\t" /* C4 C4 C4 C4 */\
+ "pmaddwd %%mm0, %%mm4 \n\t" /* C4R4+C4R0 C4r4+C4r0 */\
+ "movq 24(%2), %%mm5 \n\t" /* -C4 C4 -C4 C4 */\
+ "pmaddwd %%mm5, %%mm0 \n\t" /* -C4R4+C4R0 -C4r4+C4r0 */\
+ "movq 32(%2), %%mm5 \n\t" /* C6 C2 C6 C2 */\
+ "pmaddwd %%mm1, %%mm5 \n\t" /* C6R6+C2R2 C6r6+C2r2 */\
+ "movq 40(%2), %%mm6 \n\t" /* -C2 C6 -C2 C6 */\
+ "pmaddwd %%mm6, %%mm1 \n\t" /* -C2R6+C6R2 -C2r6+C6r2 */\
+ "movq %%mm4, %%mm6 \n\t" /* C4R4+C4R0 C4r4+C4r0 */\
+ "movq 48(%2), %%mm7 \n\t" /* C3 C1 C3 C1 */\
+ "pmaddwd %%mm2, %%mm7 \n\t" /* C3R3+C1R1 C3r3+C1r1 */\
+ "paddd %%mm5, %%mm4 \n\t" /* A0 a0 */\
+ "psubd %%mm5, %%mm6 \n\t" /* A3 a3 */\
+ "movq %%mm0, %%mm5 \n\t" /* -C4R4+C4R0 -C4r4+C4r0 */\
+ "paddd %%mm1, %%mm0 \n\t" /* A1 a1 */\
+ "psubd %%mm1, %%mm5 \n\t" /* A2 a2 */\
+ "movq 64(%2), %%mm1 \n\t"\
+ "pmaddwd %%mm2, %%mm1 \n\t" /* -C7R3+C3R1 -C7r3+C3r1 */\
+ "paddd %%mm4, %%mm7 \n\t" /* A0+B0 a0+b0 */\
+ "paddd %%mm4, %%mm4 \n\t" /* 2A0 2a0 */\
+ "psubd %%mm7, %%mm4 \n\t" /* A0-B0 a0-b0 */\
+ "psrad $" #shift ", %%mm7 \n\t"\
+ "psrad $" #shift ", %%mm4 \n\t"\
+ "movq %%mm0, %%mm3 \n\t" /* A1 a1 */\
+ "paddd %%mm1, %%mm0 \n\t" /* A1+B1 a1+b1 */\
+ "psubd %%mm1, %%mm3 \n\t" /* A1-B1 a1-b1 */\
+ "psrad $" #shift ", %%mm0 \n\t"\
+ "psrad $" #shift ", %%mm3 \n\t"\
+ "packssdw %%mm7, %%mm7 \n\t" /* A0+B0 a0+b0 */\
+ "movd %%mm7, " #dst " \n\t"\
+ "packssdw %%mm0, %%mm0 \n\t" /* A1+B1 a1+b1 */\
+ "movd %%mm0, 16+" #dst " \n\t"\
+ "packssdw %%mm3, %%mm3 \n\t" /* A1-B1 a1-b1 */\
+ "movd %%mm3, 96+" #dst " \n\t"\
+ "packssdw %%mm4, %%mm4 \n\t" /* A0-B0 a0-b0 */\
+ "movd %%mm4, 112+" #dst " \n\t"\
+ "movq 80(%2), %%mm4 \n\t" /* -C1 C5 -C1 C5 */\
+ "pmaddwd %%mm2, %%mm4 \n\t" /* -C1R3+C5R1 -C1r3+C5r1 */\
+ "pmaddwd 96(%2), %%mm2 \n\t" /* -C5R3+C7R1 -C5r3+C7r1 */\
+ "movq %%mm5, %%mm3 \n\t" /* A2 a2 */\
+ "paddd %%mm4, %%mm3 \n\t" /* A2+B2 a2+b2 */\
+ "psubd %%mm4, %%mm5 \n\t" /* a2-B2 a2-b2 */\
+ "psrad $" #shift ", %%mm3 \n\t"\
+ "psrad $" #shift ", %%mm5 \n\t"\
+ "movq %%mm6, %%mm4 \n\t" /* A3 a3 */\
+ "paddd %%mm2, %%mm6 \n\t" /* A3+B3 a3+b3 */\
+ "psubd %%mm2, %%mm4 \n\t" /* a3-B3 a3-b3 */\
+ "psrad $" #shift ", %%mm6 \n\t"\
+ "packssdw %%mm3, %%mm3 \n\t" /* A2+B2 a2+b2 */\
+ "movd %%mm3, 32+" #dst " \n\t"\
+ "psrad $" #shift ", %%mm4 \n\t"\
+ "packssdw %%mm6, %%mm6 \n\t" /* A3+B3 a3+b3 */\
+ "movd %%mm6, 48+" #dst " \n\t"\
+ "packssdw %%mm4, %%mm4 \n\t" /* A3-B3 a3-b3 */\
+ "packssdw %%mm5, %%mm5 \n\t" /* A2-B2 a2-b2 */\
+ "movd %%mm4, 64+" #dst " \n\t"\
+ "movd %%mm5, 80+" #dst " \n\t"
+
+
+//IDCT( src0, src4, src1, src5, dst, shift)
+IDCT( (%1), 64(%1), 32(%1), 96(%1), 0(%0), 20)
+IDCT( 8(%1), 72(%1), 40(%1), 104(%1), 4(%0), 20)
+IDCT( 16(%1), 80(%1), 48(%1), 112(%1), 8(%0), 20)
+IDCT( 24(%1), 88(%1), 56(%1), 120(%1), 12(%0), 20)
+ "jmp 9f \n\t"
+
+
+ "# .p2align 4 \n\t"
+ "7: \n\t"
+#undef IDCT
+#define IDCT(src0, src4, src1, src5, dst, shift) \
+ "movq " #src0 ", %%mm0 \n\t" /* R4 R0 r4 r0 */\
+ "movq 16(%2), %%mm4 \n\t" /* C4 C4 C4 C4 */\
+ "pmaddwd %%mm0, %%mm4 \n\t" /* C4R4+C4R0 C4r4+C4r0 */\
+ "movq 24(%2), %%mm5 \n\t" /* -C4 C4 -C4 C4 */\
+ "pmaddwd %%mm5, %%mm0 \n\t" /* -C4R4+C4R0 -C4r4+C4r0 */\
+ "psrad $" #shift ", %%mm4 \n\t"\
+ "psrad $" #shift ", %%mm0 \n\t"\
+ "movq 8+" #src0 ", %%mm2 \n\t" /* R4 R0 r4 r0 */\
+ "movq 16(%2), %%mm1 \n\t" /* C4 C4 C4 C4 */\
+ "pmaddwd %%mm2, %%mm1 \n\t" /* C4R4+C4R0 C4r4+C4r0 */\
+ "movq 24(%2), %%mm7 \n\t" /* -C4 C4 -C4 C4 */\
+ "pmaddwd %%mm7, %%mm2 \n\t" /* -C4R4+C4R0 -C4r4+C4r0 */\
+ "movq 32(%2), %%mm7 \n\t" /* C6 C2 C6 C2 */\
+ "psrad $" #shift ", %%mm1 \n\t"\
+ "packssdw %%mm1, %%mm4 \n\t" /* A0 a0 */\
+ "movq %%mm4, " #dst " \n\t"\
+ "psrad $" #shift ", %%mm2 \n\t"\
+ "packssdw %%mm2, %%mm0 \n\t" /* A1 a1 */\
+ "movq %%mm0, 16+" #dst " \n\t"\
+ "movq %%mm0, 96+" #dst " \n\t"\
+ "movq %%mm4, 112+" #dst " \n\t"\
+ "movq %%mm0, 32+" #dst " \n\t"\
+ "movq %%mm4, 48+" #dst " \n\t"\
+ "movq %%mm4, 64+" #dst " \n\t"\
+ "movq %%mm0, 80+" #dst " \n\t"
+
+//IDCT( src0, src4, src1, src5, dst, shift)
+IDCT( 0(%1), 64(%1), 32(%1), 96(%1), 0(%0), 20)
+//IDCT( 8(%1), 72(%1), 40(%1), 104(%1), 4(%0), 20)
+IDCT( 16(%1), 80(%1), 48(%1), 112(%1), 8(%0), 20)
+//IDCT( 24(%1), 88(%1), 56(%1), 120(%1), 12(%0), 20)
+
+
+#endif
+
+/*
+Input
+ 00 40 04 44 20 60 24 64
+ 10 30 14 34 50 70 54 74
+ 01 41 03 43 21 61 23 63
+ 11 31 13 33 51 71 53 73
+ 02 42 06 46 22 62 26 66
+ 12 32 16 36 52 72 56 76
+ 05 45 07 47 25 65 27 67
+ 15 35 17 37 55 75 57 77
+
+Temp
+ 00 04 10 14 20 24 30 34
+ 40 44 50 54 60 64 70 74
+ 01 03 11 13 21 23 31 33
+ 41 43 51 53 61 63 71 73
+ 02 06 12 16 22 26 32 36
+ 42 46 52 56 62 66 72 76
+ 05 07 15 17 25 27 35 37
+ 45 47 55 57 65 67 75 77
+*/
+
+"9: \n\t"
+ :: "r" (block), "r" (temp), "r" (coeffs)
+ : "%eax"
+ );
+}
+
+void ff_simple_idct_mmx(int16_t *block)
+{
+ idct(block);
+}
+
+//FIXME merge add/put into the idct
+
+void ff_simple_idct_put_mmx(uint8_t *dest, int line_size, DCTELEM *block)
+{
+ idct(block);
+ ff_put_pixels_clamped_mmx(block, dest, line_size);
+}
+void ff_simple_idct_add_mmx(uint8_t *dest, int line_size, DCTELEM *block)
+{
+ idct(block);
+ ff_add_pixels_clamped_mmx(block, dest, line_size);
+}
+
+#endif /* HAVE_INLINE_ASM */
diff --git a/gst-libs/ext/libav/libavcodec/x86/simple_idct_mmx.c b/gst-libs/ext/libav/libavcodec/x86/simple_idct_mmx.c
deleted file mode 100644
index dc285cf..0000000
--- a/gst-libs/ext/libav/libavcodec/x86/simple_idct_mmx.c
+++ /dev/null
@@ -1,1163 +0,0 @@
-/*
- * Simple IDCT MMX
- *
- * Copyright (c) 2001, 2002 Michael Niedermayer <michaelni@gmx.at>
- *
- * 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
- */
-#include "libavcodec/dsputil.h"
-#include "libavcodec/simple_idct.h"
-#include "dsputil_mmx.h"
-
-/*
-23170.475006
-22725.260826
-21406.727617
-19265.545870
-16384.000000
-12872.826198
-8866.956905
-4520.335430
-*/
-#define C0 23170 //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
-#define C1 22725 //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
-#define C2 21407 //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
-#define C3 19266 //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
-#define C4 16383 //cos(i*M_PI/16)*sqrt(2)*(1<<14) - 0.5
-#define C5 12873 //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
-#define C6 8867 //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
-#define C7 4520 //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
-
-#define ROW_SHIFT 11
-#define COL_SHIFT 20 // 6
-
-DECLARE_ASM_CONST(8, uint64_t, wm1010)= 0xFFFF0000FFFF0000ULL;
-DECLARE_ASM_CONST(8, uint64_t, d40000)= 0x0000000000040000ULL;
-
-DECLARE_ALIGNED(8, static const int16_t, coeffs)[]= {
- 1<<(ROW_SHIFT-1), 0, 1<<(ROW_SHIFT-1), 0,
-// 1<<(COL_SHIFT-1), 0, 1<<(COL_SHIFT-1), 0,
-// 0, 1<<(COL_SHIFT-1-16), 0, 1<<(COL_SHIFT-1-16),
- 1<<(ROW_SHIFT-1), 1, 1<<(ROW_SHIFT-1), 0,
- // the 1 = ((1<<(COL_SHIFT-1))/C4)<<ROW_SHIFT :)
-// 0, 0, 0, 0,
-// 0, 0, 0, 0,
-
- C4, C4, C4, C4,
- C4, -C4, C4, -C4,
-
- C2, C6, C2, C6,
- C6, -C2, C6, -C2,
-
- C1, C3, C1, C3,
- C5, C7, C5, C7,
-
- C3, -C7, C3, -C7,
--C1, -C5, -C1, -C5,
-
- C5, -C1, C5, -C1,
- C7, C3, C7, C3,
-
- C7, -C5, C7, -C5,
- C3, -C1, C3, -C1
-};
-
-static inline void idct(int16_t *block)
-{
- DECLARE_ALIGNED(8, int64_t, align_tmp)[16];
- int16_t * const temp= (int16_t*)align_tmp;
-
- __asm__ volatile(
-#if 0 //Alternative, simpler variant
-
-#define ROW_IDCT(src0, src4, src1, src5, dst, rounder, shift) \
- "movq " #src0 ", %%mm0 \n\t" /* R4 R0 r4 r0 */\
- "movq " #src4 ", %%mm1 \n\t" /* R6 R2 r6 r2 */\
- "movq " #src1 ", %%mm2 \n\t" /* R3 R1 r3 r1 */\
- "movq " #src5 ", %%mm3 \n\t" /* R7 R5 r7 r5 */\
- "movq 16(%2), %%mm4 \n\t" /* C4 C4 C4 C4 */\
- "pmaddwd %%mm0, %%mm4 \n\t" /* C4R4+C4R0 C4r4+C4r0 */\
- "movq 24(%2), %%mm5 \n\t" /* -C4 C4 -C4 C4 */\
- "pmaddwd %%mm5, %%mm0 \n\t" /* -C4R4+C4R0 -C4r4+C4r0 */\
- "movq 32(%2), %%mm5 \n\t" /* C6 C2 C6 C2 */\
- "pmaddwd %%mm1, %%mm5 \n\t" /* C6R6+C2R2 C6r6+C2r2 */\
- "movq 40(%2), %%mm6 \n\t" /* -C2 C6 -C2 C6 */\
- "pmaddwd %%mm6, %%mm1 \n\t" /* -C2R6+C6R2 -C2r6+C6r2 */\
- "movq 48(%2), %%mm7 \n\t" /* C3 C1 C3 C1 */\
- "pmaddwd %%mm2, %%mm7 \n\t" /* C3R3+C1R1 C3r3+C1r1 */\
- #rounder ", %%mm4 \n\t"\
- "movq %%mm4, %%mm6 \n\t" /* C4R4+C4R0 C4r4+C4r0 */\
- "paddd %%mm5, %%mm4 \n\t" /* A0 a0 */\
- "psubd %%mm5, %%mm6 \n\t" /* A3 a3 */\
- "movq 56(%2), %%mm5 \n\t" /* C7 C5 C7 C5 */\
- "pmaddwd %%mm3, %%mm5 \n\t" /* C7R7+C5R5 C7r7+C5r5 */\
- #rounder ", %%mm0 \n\t"\
- "paddd %%mm0, %%mm1 \n\t" /* A1 a1 */\
- "paddd %%mm0, %%mm0 \n\t" \
- "psubd %%mm1, %%mm0 \n\t" /* A2 a2 */\
- "pmaddwd 64(%2), %%mm2 \n\t" /* -C7R3+C3R1 -C7r3+C3r1 */\
- "paddd %%mm5, %%mm7 \n\t" /* B0 b0 */\
- "movq 72(%2), %%mm5 \n\t" /* -C5 -C1 -C5 -C1 */\
- "pmaddwd %%mm3, %%mm5 \n\t" /* -C5R7-C1R5 -C5r7-C1r5 */\
- "paddd %%mm4, %%mm7 \n\t" /* A0+B0 a0+b0 */\
- "paddd %%mm4, %%mm4 \n\t" /* 2A0 2a0 */\
- "psubd %%mm7, %%mm4 \n\t" /* A0-B0 a0-b0 */\
- "paddd %%mm2, %%mm5 \n\t" /* B1 b1 */\
- "psrad $" #shift ", %%mm7 \n\t"\
- "psrad $" #shift ", %%mm4 \n\t"\
- "movq %%mm1, %%mm2 \n\t" /* A1 a1 */\
- "paddd %%mm5, %%mm1 \n\t" /* A1+B1 a1+b1 */\
- "psubd %%mm5, %%mm2 \n\t" /* A1-B1 a1-b1 */\
- "psrad $" #shift ", %%mm1 \n\t"\
- "psrad $" #shift ", %%mm2 \n\t"\
- "packssdw %%mm1, %%mm7 \n\t" /* A1+B1 a1+b1 A0+B0 a0+b0 */\
- "packssdw %%mm4, %%mm2 \n\t" /* A0-B0 a0-b0 A1-B1 a1-b1 */\
- "movq %%mm7, " #dst " \n\t"\
- "movq " #src1 ", %%mm1 \n\t" /* R3 R1 r3 r1 */\
- "movq 80(%2), %%mm4 \n\t" /* -C1 C5 -C1 C5 */\
- "movq %%mm2, 24+" #dst " \n\t"\
- "pmaddwd %%mm1, %%mm4 \n\t" /* -C1R3+C5R1 -C1r3+C5r1 */\
- "movq 88(%2), %%mm7 \n\t" /* C3 C7 C3 C7 */\
- "pmaddwd 96(%2), %%mm1 \n\t" /* -C5R3+C7R1 -C5r3+C7r1 */\
- "pmaddwd %%mm3, %%mm7 \n\t" /* C3R7+C7R5 C3r7+C7r5 */\
- "movq %%mm0, %%mm2 \n\t" /* A2 a2 */\
- "pmaddwd 104(%2), %%mm3 \n\t" /* -C1R7+C3R5 -C1r7+C3r5 */\
- "paddd %%mm7, %%mm4 \n\t" /* B2 b2 */\
- "paddd %%mm4, %%mm2 \n\t" /* A2+B2 a2+b2 */\
- "psubd %%mm4, %%mm0 \n\t" /* a2-B2 a2-b2 */\
- "psrad $" #shift ", %%mm2 \n\t"\
- "psrad $" #shift ", %%mm0 \n\t"\
- "movq %%mm6, %%mm4 \n\t" /* A3 a3 */\
- "paddd %%mm1, %%mm3 \n\t" /* B3 b3 */\
- "paddd %%mm3, %%mm6 \n\t" /* A3+B3 a3+b3 */\
- "psubd %%mm3, %%mm4 \n\t" /* a3-B3 a3-b3 */\
- "psrad $" #shift ", %%mm6 \n\t"\
- "packssdw %%mm6, %%mm2 \n\t" /* A3+B3 a3+b3 A2+B2 a2+b2 */\
- "movq %%mm2, 8+" #dst " \n\t"\
- "psrad $" #shift ", %%mm4 \n\t"\
- "packssdw %%mm0, %%mm4 \n\t" /* A2-B2 a2-b2 A3-B3 a3-b3 */\
- "movq %%mm4, 16+" #dst " \n\t"\
-
-#define COL_IDCT(src0, src4, src1, src5, dst, shift) \
- "movq " #src0 ", %%mm0 \n\t" /* R4 R0 r4 r0 */\
- "movq " #src4 ", %%mm1 \n\t" /* R6 R2 r6 r2 */\
- "movq " #src1 ", %%mm2 \n\t" /* R3 R1 r3 r1 */\
- "movq " #src5 ", %%mm3 \n\t" /* R7 R5 r7 r5 */\
- "movq 16(%2), %%mm4 \n\t" /* C4 C4 C4 C4 */\
- "pmaddwd %%mm0, %%mm4 \n\t" /* C4R4+C4R0 C4r4+C4r0 */\
- "movq 24(%2), %%mm5 \n\t" /* -C4 C4 -C4 C4 */\
- "pmaddwd %%mm5, %%mm0 \n\t" /* -C4R4+C4R0 -C4r4+C4r0 */\
- "movq 32(%2), %%mm5 \n\t" /* C6 C2 C6 C2 */\
- "pmaddwd %%mm1, %%mm5 \n\t" /* C6R6+C2R2 C6r6+C2r2 */\
- "movq 40(%2), %%mm6 \n\t" /* -C2 C6 -C2 C6 */\
- "pmaddwd %%mm6, %%mm1 \n\t" /* -C2R6+C6R2 -C2r6+C6r2 */\
- "movq %%mm4, %%mm6 \n\t" /* C4R4+C4R0 C4r4+C4r0 */\
- "movq 48(%2), %%mm7 \n\t" /* C3 C1 C3 C1 */\
- "pmaddwd %%mm2, %%mm7 \n\t" /* C3R3+C1R1 C3r3+C1r1 */\
- "paddd %%mm5, %%mm4 \n\t" /* A0 a0 */\
- "psubd %%mm5, %%mm6 \n\t" /* A3 a3 */\
- "movq %%mm0, %%mm5 \n\t" /* -C4R4+C4R0 -C4r4+C4r0 */\
- "paddd %%mm1, %%mm0 \n\t" /* A1 a1 */\
- "psubd %%mm1, %%mm5 \n\t" /* A2 a2 */\
- "movq 56(%2), %%mm1 \n\t" /* C7 C5 C7 C5 */\
- "pmaddwd %%mm3, %%mm1 \n\t" /* C7R7+C5R5 C7r7+C5r5 */\
- "pmaddwd 64(%2), %%mm2 \n\t" /* -C7R3+C3R1 -C7r3+C3r1 */\
- "paddd %%mm1, %%mm7 \n\t" /* B0 b0 */\
- "movq 72(%2), %%mm1 \n\t" /* -C5 -C1 -C5 -C1 */\
- "pmaddwd %%mm3, %%mm1 \n\t" /* -C5R7-C1R5 -C5r7-C1r5 */\
- "paddd %%mm4, %%mm7 \n\t" /* A0+B0 a0+b0 */\
- "paddd %%mm4, %%mm4 \n\t" /* 2A0 2a0 */\
- "psubd %%mm7, %%mm4 \n\t" /* A0-B0 a0-b0 */\
- "paddd %%mm2, %%mm1 \n\t" /* B1 b1 */\
- "psrad $" #shift ", %%mm7 \n\t"\
- "psrad $" #shift ", %%mm4 \n\t"\
- "movq %%mm0, %%mm2 \n\t" /* A1 a1 */\
- "paddd %%mm1, %%mm0 \n\t" /* A1+B1 a1+b1 */\
- "psubd %%mm1, %%mm2 \n\t" /* A1-B1 a1-b1 */\
- "psrad $" #shift ", %%mm0 \n\t"\
- "psrad $" #shift ", %%mm2 \n\t"\
- "packssdw %%mm7, %%mm7 \n\t" /* A0+B0 a0+b0 */\
- "movd %%mm7, " #dst " \n\t"\
- "packssdw %%mm0, %%mm0 \n\t" /* A1+B1 a1+b1 */\
- "movd %%mm0, 16+" #dst " \n\t"\
- "packssdw %%mm2, %%mm2 \n\t" /* A1-B1 a1-b1 */\
- "movd %%mm2, 96+" #dst " \n\t"\
- "packssdw %%mm4, %%mm4 \n\t" /* A0-B0 a0-b0 */\
- "movd %%mm4, 112+" #dst " \n\t"\
- "movq " #src1 ", %%mm0 \n\t" /* R3 R1 r3 r1 */\
- "movq 80(%2), %%mm4 \n\t" /* -C1 C5 -C1 C5 */\
- "pmaddwd %%mm0, %%mm4 \n\t" /* -C1R3+C5R1 -C1r3+C5r1 */\
- "movq 88(%2), %%mm7 \n\t" /* C3 C7 C3 C7 */\
- "pmaddwd 96(%2), %%mm0 \n\t" /* -C5R3+C7R1 -C5r3+C7r1 */\
- "pmaddwd %%mm3, %%mm7 \n\t" /* C3R7+C7R5 C3r7+C7r5 */\
- "movq %%mm5, %%mm2 \n\t" /* A2 a2 */\
- "pmaddwd 104(%2), %%mm3 \n\t" /* -C1R7+C3R5 -C1r7+C3r5 */\
- "paddd %%mm7, %%mm4 \n\t" /* B2 b2 */\
- "paddd %%mm4, %%mm2 \n\t" /* A2+B2 a2+b2 */\
- "psubd %%mm4, %%mm5 \n\t" /* a2-B2 a2-b2 */\
- "psrad $" #shift ", %%mm2 \n\t"\
- "psrad $" #shift ", %%mm5 \n\t"\
- "movq %%mm6, %%mm4 \n\t" /* A3 a3 */\
- "paddd %%mm0, %%mm3 \n\t" /* B3 b3 */\
- "paddd %%mm3, %%mm6 \n\t" /* A3+B3 a3+b3 */\
- "psubd %%mm3, %%mm4 \n\t" /* a3-B3 a3-b3 */\
- "psrad $" #shift ", %%mm6 \n\t"\
- "psrad $" #shift ", %%mm4 \n\t"\
- "packssdw %%mm2, %%mm2 \n\t" /* A2+B2 a2+b2 */\
- "packssdw %%mm6, %%mm6 \n\t" /* A3+B3 a3+b3 */\
- "movd %%mm2, 32+" #dst " \n\t"\
- "packssdw %%mm4, %%mm4 \n\t" /* A3-B3 a3-b3 */\
- "packssdw %%mm5, %%mm5 \n\t" /* A2-B2 a2-b2 */\
- "movd %%mm6, 48+" #dst " \n\t"\
- "movd %%mm4, 64+" #dst " \n\t"\
- "movd %%mm5, 80+" #dst " \n\t"\
-
-
-#define DC_COND_ROW_IDCT(src0, src4, src1, src5, dst, rounder, shift) \
- "movq " #src0 ", %%mm0 \n\t" /* R4 R0 r4 r0 */\
- "movq " #src4 ", %%mm1 \n\t" /* R6 R2 r6 r2 */\
- "movq " #src1 ", %%mm2 \n\t" /* R3 R1 r3 r1 */\
- "movq " #src5 ", %%mm3 \n\t" /* R7 R5 r7 r5 */\
- "movq "MANGLE(wm1010)", %%mm4 \n\t"\
- "pand %%mm0, %%mm4 \n\t"\
- "por %%mm1, %%mm4 \n\t"\
- "por %%mm2, %%mm4 \n\t"\
- "por %%mm3, %%mm4 \n\t"\
- "packssdw %%mm4,%%mm4 \n\t"\
- "movd %%mm4, %%eax \n\t"\
- "orl %%eax, %%eax \n\t"\
- "jz 1f \n\t"\
- "movq 16(%2), %%mm4 \n\t" /* C4 C4 C4 C4 */\
- "pmaddwd %%mm0, %%mm4 \n\t" /* C4R4+C4R0 C4r4+C4r0 */\
- "movq 24(%2), %%mm5 \n\t" /* -C4 C4 -C4 C4 */\
- "pmaddwd %%mm5, %%mm0 \n\t" /* -C4R4+C4R0 -C4r4+C4r0 */\
- "movq 32(%2), %%mm5 \n\t" /* C6 C2 C6 C2 */\
- "pmaddwd %%mm1, %%mm5 \n\t" /* C6R6+C2R2 C6r6+C2r2 */\
- "movq 40(%2), %%mm6 \n\t" /* -C2 C6 -C2 C6 */\
- "pmaddwd %%mm6, %%mm1 \n\t" /* -C2R6+C6R2 -C2r6+C6r2 */\
- "movq 48(%2), %%mm7 \n\t" /* C3 C1 C3 C1 */\
- "pmaddwd %%mm2, %%mm7 \n\t" /* C3R3+C1R1 C3r3+C1r1 */\
- #rounder ", %%mm4 \n\t"\
- "movq %%mm4, %%mm6 \n\t" /* C4R4+C4R0 C4r4+C4r0 */\
- "paddd %%mm5, %%mm4 \n\t" /* A0 a0 */\
- "psubd %%mm5, %%mm6 \n\t" /* A3 a3 */\
- "movq 56(%2), %%mm5 \n\t" /* C7 C5 C7 C5 */\
- "pmaddwd %%mm3, %%mm5 \n\t" /* C7R7+C5R5 C7r7+C5r5 */\
- #rounder ", %%mm0 \n\t"\
- "paddd %%mm0, %%mm1 \n\t" /* A1 a1 */\
- "paddd %%mm0, %%mm0 \n\t" \
- "psubd %%mm1, %%mm0 \n\t" /* A2 a2 */\
- "pmaddwd 64(%2), %%mm2 \n\t" /* -C7R3+C3R1 -C7r3+C3r1 */\
- "paddd %%mm5, %%mm7 \n\t" /* B0 b0 */\
- "movq 72(%2), %%mm5 \n\t" /* -C5 -C1 -C5 -C1 */\
- "pmaddwd %%mm3, %%mm5 \n\t" /* -C5R7-C1R5 -C5r7-C1r5 */\
- "paddd %%mm4, %%mm7 \n\t" /* A0+B0 a0+b0 */\
- "paddd %%mm4, %%mm4 \n\t" /* 2A0 2a0 */\
- "psubd %%mm7, %%mm4 \n\t" /* A0-B0 a0-b0 */\
- "paddd %%mm2, %%mm5 \n\t" /* B1 b1 */\
- "psrad $" #shift ", %%mm7 \n\t"\
- "psrad $" #shift ", %%mm4 \n\t"\
- "movq %%mm1, %%mm2 \n\t" /* A1 a1 */\
- "paddd %%mm5, %%mm1 \n\t" /* A1+B1 a1+b1 */\
- "psubd %%mm5, %%mm2 \n\t" /* A1-B1 a1-b1 */\
- "psrad $" #shift ", %%mm1 \n\t"\
- "psrad $" #shift ", %%mm2 \n\t"\
- "packssdw %%mm1, %%mm7 \n\t" /* A1+B1 a1+b1 A0+B0 a0+b0 */\
- "packssdw %%mm4, %%mm2 \n\t" /* A0-B0 a0-b0 A1-B1 a1-b1 */\
- "movq %%mm7, " #dst " \n\t"\
- "movq " #src1 ", %%mm1 \n\t" /* R3 R1 r3 r1 */\
- "movq 80(%2), %%mm4 \n\t" /* -C1 C5 -C1 C5 */\
- "movq %%mm2, 24+" #dst " \n\t"\
- "pmaddwd %%mm1, %%mm4 \n\t" /* -C1R3+C5R1 -C1r3+C5r1 */\
- "movq 88(%2), %%mm7 \n\t" /* C3 C7 C3 C7 */\
- "pmaddwd 96(%2), %%mm1 \n\t" /* -C5R3+C7R1 -C5r3+C7r1 */\
- "pmaddwd %%mm3, %%mm7 \n\t" /* C3R7+C7R5 C3r7+C7r5 */\
- "movq %%mm0, %%mm2 \n\t" /* A2 a2 */\
- "pmaddwd 104(%2), %%mm3 \n\t" /* -C1R7+C3R5 -C1r7+C3r5 */\
- "paddd %%mm7, %%mm4 \n\t" /* B2 b2 */\
- "paddd %%mm4, %%mm2 \n\t" /* A2+B2 a2+b2 */\
- "psubd %%mm4, %%mm0 \n\t" /* a2-B2 a2-b2 */\
- "psrad $" #shift ", %%mm2 \n\t"\
- "psrad $" #shift ", %%mm0 \n\t"\
- "movq %%mm6, %%mm4 \n\t" /* A3 a3 */\
- "paddd %%mm1, %%mm3 \n\t" /* B3 b3 */\
- "paddd %%mm3, %%mm6 \n\t" /* A3+B3 a3+b3 */\
- "psubd %%mm3, %%mm4 \n\t" /* a3-B3 a3-b3 */\
- "psrad $" #shift ", %%mm6 \n\t"\
- "packssdw %%mm6, %%mm2 \n\t" /* A3+B3 a3+b3 A2+B2 a2+b2 */\
- "movq %%mm2, 8+" #dst " \n\t"\
- "psrad $" #shift ", %%mm4 \n\t"\
- "packssdw %%mm0, %%mm4 \n\t" /* A2-B2 a2-b2 A3-B3 a3-b3 */\
- "movq %%mm4, 16+" #dst " \n\t"\
- "jmp 2f \n\t"\
- "1: \n\t"\
- "pslld $16, %%mm0 \n\t"\
- "#paddd "MANGLE(d40000)", %%mm0 \n\t"\
- "psrad $13, %%mm0 \n\t"\
- "packssdw %%mm0, %%mm0 \n\t"\
- "movq %%mm0, " #dst " \n\t"\
- "movq %%mm0, 8+" #dst " \n\t"\
- "movq %%mm0, 16+" #dst " \n\t"\
- "movq %%mm0, 24+" #dst " \n\t"\
- "2: \n\t"
-
-
-//IDCT( src0, src4, src1, src5, dst, rounder, shift)
-ROW_IDCT( (%0), 8(%0), 16(%0), 24(%0), 0(%1),paddd 8(%2), 11)
-/*ROW_IDCT( 32(%0), 40(%0), 48(%0), 56(%0), 32(%1), paddd (%2), 11)
-ROW_IDCT( 64(%0), 72(%0), 80(%0), 88(%0), 64(%1), paddd (%2), 11)
-ROW_IDCT( 96(%0),104(%0),112(%0),120(%0), 96(%1), paddd (%2), 11)*/
-
-DC_COND_ROW_IDCT( 32(%0), 40(%0), 48(%0), 56(%0), 32(%1),paddd (%2), 11)
-DC_COND_ROW_IDCT( 64(%0), 72(%0), 80(%0), 88(%0), 64(%1),paddd (%2), 11)
-DC_COND_ROW_IDCT( 96(%0),104(%0),112(%0),120(%0), 96(%1),paddd (%2), 11)
-
-
-//IDCT( src0, src4, src1, src5, dst, shift)
-COL_IDCT( (%1), 64(%1), 32(%1), 96(%1), 0(%0), 20)
-COL_IDCT( 8(%1), 72(%1), 40(%1), 104(%1), 4(%0), 20)
-COL_IDCT( 16(%1), 80(%1), 48(%1), 112(%1), 8(%0), 20)
-COL_IDCT( 24(%1), 88(%1), 56(%1), 120(%1), 12(%0), 20)
-
-#else
-
-#define DC_COND_IDCT(src0, src4, src1, src5, dst, rounder, shift) \
- "movq " #src0 ", %%mm0 \n\t" /* R4 R0 r4 r0 */\
- "movq " #src4 ", %%mm1 \n\t" /* R6 R2 r6 r2 */\
- "movq " #src1 ", %%mm2 \n\t" /* R3 R1 r3 r1 */\
- "movq " #src5 ", %%mm3 \n\t" /* R7 R5 r7 r5 */\
- "movq "MANGLE(wm1010)", %%mm4 \n\t"\
- "pand %%mm0, %%mm4 \n\t"\
- "por %%mm1, %%mm4 \n\t"\
- "por %%mm2, %%mm4 \n\t"\
- "por %%mm3, %%mm4 \n\t"\
- "packssdw %%mm4,%%mm4 \n\t"\
- "movd %%mm4, %%eax \n\t"\
- "orl %%eax, %%eax \n\t"\
- "jz 1f \n\t"\
- "movq 16(%2), %%mm4 \n\t" /* C4 C4 C4 C4 */\
- "pmaddwd %%mm0, %%mm4 \n\t" /* C4R4+C4R0 C4r4+C4r0 */\
- "movq 24(%2), %%mm5 \n\t" /* -C4 C4 -C4 C4 */\
- "pmaddwd %%mm5, %%mm0 \n\t" /* -C4R4+C4R0 -C4r4+C4r0 */\
- "movq 32(%2), %%mm5 \n\t" /* C6 C2 C6 C2 */\
- "pmaddwd %%mm1, %%mm5 \n\t" /* C6R6+C2R2 C6r6+C2r2 */\
- "movq 40(%2), %%mm6 \n\t" /* -C2 C6 -C2 C6 */\
- "pmaddwd %%mm6, %%mm1 \n\t" /* -C2R6+C6R2 -C2r6+C6r2 */\
- "movq 48(%2), %%mm7 \n\t" /* C3 C1 C3 C1 */\
- "pmaddwd %%mm2, %%mm7 \n\t" /* C3R3+C1R1 C3r3+C1r1 */\
- #rounder ", %%mm4 \n\t"\
- "movq %%mm4, %%mm6 \n\t" /* C4R4+C4R0 C4r4+C4r0 */\
- "paddd %%mm5, %%mm4 \n\t" /* A0 a0 */\
- "psubd %%mm5, %%mm6 \n\t" /* A3 a3 */\
- "movq 56(%2), %%mm5 \n\t" /* C7 C5 C7 C5 */\
- "pmaddwd %%mm3, %%mm5 \n\t" /* C7R7+C5R5 C7r7+C5r5 */\
- #rounder ", %%mm0 \n\t"\
- "paddd %%mm0, %%mm1 \n\t" /* A1 a1 */\
- "paddd %%mm0, %%mm0 \n\t" \
- "psubd %%mm1, %%mm0 \n\t" /* A2 a2 */\
- "pmaddwd 64(%2), %%mm2 \n\t" /* -C7R3+C3R1 -C7r3+C3r1 */\
- "paddd %%mm5, %%mm7 \n\t" /* B0 b0 */\
- "movq 72(%2), %%mm5 \n\t" /* -C5 -C1 -C5 -C1 */\
- "pmaddwd %%mm3, %%mm5 \n\t" /* -C5R7-C1R5 -C5r7-C1r5 */\
- "paddd %%mm4, %%mm7 \n\t" /* A0+B0 a0+b0 */\
- "paddd %%mm4, %%mm4 \n\t" /* 2A0 2a0 */\
- "psubd %%mm7, %%mm4 \n\t" /* A0-B0 a0-b0 */\
- "paddd %%mm2, %%mm5 \n\t" /* B1 b1 */\
- "psrad $" #shift ", %%mm7 \n\t"\
- "psrad $" #shift ", %%mm4 \n\t"\
- "movq %%mm1, %%mm2 \n\t" /* A1 a1 */\
- "paddd %%mm5, %%mm1 \n\t" /* A1+B1 a1+b1 */\
- "psubd %%mm5, %%mm2 \n\t" /* A1-B1 a1-b1 */\
- "psrad $" #shift ", %%mm1 \n\t"\
- "psrad $" #shift ", %%mm2 \n\t"\
- "packssdw %%mm1, %%mm7 \n\t" /* A1+B1 a1+b1 A0+B0 a0+b0 */\
- "packssdw %%mm4, %%mm2 \n\t" /* A0-B0 a0-b0 A1-B1 a1-b1 */\
- "movq %%mm7, " #dst " \n\t"\
- "movq " #src1 ", %%mm1 \n\t" /* R3 R1 r3 r1 */\
- "movq 80(%2), %%mm4 \n\t" /* -C1 C5 -C1 C5 */\
- "movq %%mm2, 24+" #dst " \n\t"\
- "pmaddwd %%mm1, %%mm4 \n\t" /* -C1R3+C5R1 -C1r3+C5r1 */\
- "movq 88(%2), %%mm7 \n\t" /* C3 C7 C3 C7 */\
- "pmaddwd 96(%2), %%mm1 \n\t" /* -C5R3+C7R1 -C5r3+C7r1 */\
- "pmaddwd %%mm3, %%mm7 \n\t" /* C3R7+C7R5 C3r7+C7r5 */\
- "movq %%mm0, %%mm2 \n\t" /* A2 a2 */\
- "pmaddwd 104(%2), %%mm3 \n\t" /* -C1R7+C3R5 -C1r7+C3r5 */\
- "paddd %%mm7, %%mm4 \n\t" /* B2 b2 */\
- "paddd %%mm4, %%mm2 \n\t" /* A2+B2 a2+b2 */\
- "psubd %%mm4, %%mm0 \n\t" /* a2-B2 a2-b2 */\
- "psrad $" #shift ", %%mm2 \n\t"\
- "psrad $" #shift ", %%mm0 \n\t"\
- "movq %%mm6, %%mm4 \n\t" /* A3 a3 */\
- "paddd %%mm1, %%mm3 \n\t" /* B3 b3 */\
- "paddd %%mm3, %%mm6 \n\t" /* A3+B3 a3+b3 */\
- "psubd %%mm3, %%mm4 \n\t" /* a3-B3 a3-b3 */\
- "psrad $" #shift ", %%mm6 \n\t"\
- "packssdw %%mm6, %%mm2 \n\t" /* A3+B3 a3+b3 A2+B2 a2+b2 */\
- "movq %%mm2, 8+" #dst " \n\t"\
- "psrad $" #shift ", %%mm4 \n\t"\
- "packssdw %%mm0, %%mm4 \n\t" /* A2-B2 a2-b2 A3-B3 a3-b3 */\
- "movq %%mm4, 16+" #dst " \n\t"\
- "jmp 2f \n\t"\
- "1: \n\t"\
- "pslld $16, %%mm0 \n\t"\
- "paddd "MANGLE(d40000)", %%mm0 \n\t"\
- "psrad $13, %%mm0 \n\t"\
- "packssdw %%mm0, %%mm0 \n\t"\
- "movq %%mm0, " #dst " \n\t"\
- "movq %%mm0, 8+" #dst " \n\t"\
- "movq %%mm0, 16+" #dst " \n\t"\
- "movq %%mm0, 24+" #dst " \n\t"\
- "2: \n\t"
-
-#define Z_COND_IDCT(src0, src4, src1, src5, dst, rounder, shift, bt) \
- "movq " #src0 ", %%mm0 \n\t" /* R4 R0 r4 r0 */\
- "movq " #src4 ", %%mm1 \n\t" /* R6 R2 r6 r2 */\
- "movq " #src1 ", %%mm2 \n\t" /* R3 R1 r3 r1 */\
- "movq " #src5 ", %%mm3 \n\t" /* R7 R5 r7 r5 */\
- "movq %%mm0, %%mm4 \n\t"\
- "por %%mm1, %%mm4 \n\t"\
- "por %%mm2, %%mm4 \n\t"\
- "por %%mm3, %%mm4 \n\t"\
- "packssdw %%mm4,%%mm4 \n\t"\
- "movd %%mm4, %%eax \n\t"\
- "orl %%eax, %%eax \n\t"\
- "jz " #bt " \n\t"\
- "movq 16(%2), %%mm4 \n\t" /* C4 C4 C4 C4 */\
- "pmaddwd %%mm0, %%mm4 \n\t" /* C4R4+C4R0 C4r4+C4r0 */\
- "movq 24(%2), %%mm5 \n\t" /* -C4 C4 -C4 C4 */\
- "pmaddwd %%mm5, %%mm0 \n\t" /* -C4R4+C4R0 -C4r4+C4r0 */\
- "movq 32(%2), %%mm5 \n\t" /* C6 C2 C6 C2 */\
- "pmaddwd %%mm1, %%mm5 \n\t" /* C6R6+C2R2 C6r6+C2r2 */\
- "movq 40(%2), %%mm6 \n\t" /* -C2 C6 -C2 C6 */\
- "pmaddwd %%mm6, %%mm1 \n\t" /* -C2R6+C6R2 -C2r6+C6r2 */\
- "movq 48(%2), %%mm7 \n\t" /* C3 C1 C3 C1 */\
- "pmaddwd %%mm2, %%mm7 \n\t" /* C3R3+C1R1 C3r3+C1r1 */\
- #rounder ", %%mm4 \n\t"\
- "movq %%mm4, %%mm6 \n\t" /* C4R4+C4R0 C4r4+C4r0 */\
- "paddd %%mm5, %%mm4 \n\t" /* A0 a0 */\
- "psubd %%mm5, %%mm6 \n\t" /* A3 a3 */\
- "movq 56(%2), %%mm5 \n\t" /* C7 C5 C7 C5 */\
- "pmaddwd %%mm3, %%mm5 \n\t" /* C7R7+C5R5 C7r7+C5r5 */\
- #rounder ", %%mm0 \n\t"\
- "paddd %%mm0, %%mm1 \n\t" /* A1 a1 */\
- "paddd %%mm0, %%mm0 \n\t" \
- "psubd %%mm1, %%mm0 \n\t" /* A2 a2 */\
- "pmaddwd 64(%2), %%mm2 \n\t" /* -C7R3+C3R1 -C7r3+C3r1 */\
- "paddd %%mm5, %%mm7 \n\t" /* B0 b0 */\
- "movq 72(%2), %%mm5 \n\t" /* -C5 -C1 -C5 -C1 */\
- "pmaddwd %%mm3, %%mm5 \n\t" /* -C5R7-C1R5 -C5r7-C1r5 */\
- "paddd %%mm4, %%mm7 \n\t" /* A0+B0 a0+b0 */\
- "paddd %%mm4, %%mm4 \n\t" /* 2A0 2a0 */\
- "psubd %%mm7, %%mm4 \n\t" /* A0-B0 a0-b0 */\
- "paddd %%mm2, %%mm5 \n\t" /* B1 b1 */\
- "psrad $" #shift ", %%mm7 \n\t"\
- "psrad $" #shift ", %%mm4 \n\t"\
- "movq %%mm1, %%mm2 \n\t" /* A1 a1 */\
- "paddd %%mm5, %%mm1 \n\t" /* A1+B1 a1+b1 */\
- "psubd %%mm5, %%mm2 \n\t" /* A1-B1 a1-b1 */\
- "psrad $" #shift ", %%mm1 \n\t"\
- "psrad $" #shift ", %%mm2 \n\t"\
- "packssdw %%mm1, %%mm7 \n\t" /* A1+B1 a1+b1 A0+B0 a0+b0 */\
- "packssdw %%mm4, %%mm2 \n\t" /* A0-B0 a0-b0 A1-B1 a1-b1 */\
- "movq %%mm7, " #dst " \n\t"\
- "movq " #src1 ", %%mm1 \n\t" /* R3 R1 r3 r1 */\
- "movq 80(%2), %%mm4 \n\t" /* -C1 C5 -C1 C5 */\
- "movq %%mm2, 24+" #dst " \n\t"\
- "pmaddwd %%mm1, %%mm4 \n\t" /* -C1R3+C5R1 -C1r3+C5r1 */\
- "movq 88(%2), %%mm7 \n\t" /* C3 C7 C3 C7 */\
- "pmaddwd 96(%2), %%mm1 \n\t" /* -C5R3+C7R1 -C5r3+C7r1 */\
- "pmaddwd %%mm3, %%mm7 \n\t" /* C3R7+C7R5 C3r7+C7r5 */\
- "movq %%mm0, %%mm2 \n\t" /* A2 a2 */\
- "pmaddwd 104(%2), %%mm3 \n\t" /* -C1R7+C3R5 -C1r7+C3r5 */\
- "paddd %%mm7, %%mm4 \n\t" /* B2 b2 */\
- "paddd %%mm4, %%mm2 \n\t" /* A2+B2 a2+b2 */\
- "psubd %%mm4, %%mm0 \n\t" /* a2-B2 a2-b2 */\
- "psrad $" #shift ", %%mm2 \n\t"\
- "psrad $" #shift ", %%mm0 \n\t"\
- "movq %%mm6, %%mm4 \n\t" /* A3 a3 */\
- "paddd %%mm1, %%mm3 \n\t" /* B3 b3 */\
- "paddd %%mm3, %%mm6 \n\t" /* A3+B3 a3+b3 */\
- "psubd %%mm3, %%mm4 \n\t" /* a3-B3 a3-b3 */\
- "psrad $" #shift ", %%mm6 \n\t"\
- "packssdw %%mm6, %%mm2 \n\t" /* A3+B3 a3+b3 A2+B2 a2+b2 */\
- "movq %%mm2, 8+" #dst " \n\t"\
- "psrad $" #shift ", %%mm4 \n\t"\
- "packssdw %%mm0, %%mm4 \n\t" /* A2-B2 a2-b2 A3-B3 a3-b3 */\
- "movq %%mm4, 16+" #dst " \n\t"\
-
-#define ROW_IDCT(src0, src4, src1, src5, dst, rounder, shift) \
- "movq " #src0 ", %%mm0 \n\t" /* R4 R0 r4 r0 */\
- "movq " #src4 ", %%mm1 \n\t" /* R6 R2 r6 r2 */\
- "movq " #src1 ", %%mm2 \n\t" /* R3 R1 r3 r1 */\
- "movq " #src5 ", %%mm3 \n\t" /* R7 R5 r7 r5 */\
- "movq 16(%2), %%mm4 \n\t" /* C4 C4 C4 C4 */\
- "pmaddwd %%mm0, %%mm4 \n\t" /* C4R4+C4R0 C4r4+C4r0 */\
- "movq 24(%2), %%mm5 \n\t" /* -C4 C4 -C4 C4 */\
- "pmaddwd %%mm5, %%mm0 \n\t" /* -C4R4+C4R0 -C4r4+C4r0 */\
- "movq 32(%2), %%mm5 \n\t" /* C6 C2 C6 C2 */\
- "pmaddwd %%mm1, %%mm5 \n\t" /* C6R6+C2R2 C6r6+C2r2 */\
- "movq 40(%2), %%mm6 \n\t" /* -C2 C6 -C2 C6 */\
- "pmaddwd %%mm6, %%mm1 \n\t" /* -C2R6+C6R2 -C2r6+C6r2 */\
- "movq 48(%2), %%mm7 \n\t" /* C3 C1 C3 C1 */\
- "pmaddwd %%mm2, %%mm7 \n\t" /* C3R3+C1R1 C3r3+C1r1 */\
- #rounder ", %%mm4 \n\t"\
- "movq %%mm4, %%mm6 \n\t" /* C4R4+C4R0 C4r4+C4r0 */\
- "paddd %%mm5, %%mm4 \n\t" /* A0 a0 */\
- "psubd %%mm5, %%mm6 \n\t" /* A3 a3 */\
- "movq 56(%2), %%mm5 \n\t" /* C7 C5 C7 C5 */\
- "pmaddwd %%mm3, %%mm5 \n\t" /* C7R7+C5R5 C7r7+C5r5 */\
- #rounder ", %%mm0 \n\t"\
- "paddd %%mm0, %%mm1 \n\t" /* A1 a1 */\
- "paddd %%mm0, %%mm0 \n\t" \
- "psubd %%mm1, %%mm0 \n\t" /* A2 a2 */\
- "pmaddwd 64(%2), %%mm2 \n\t" /* -C7R3+C3R1 -C7r3+C3r1 */\
- "paddd %%mm5, %%mm7 \n\t" /* B0 b0 */\
- "movq 72(%2), %%mm5 \n\t" /* -C5 -C1 -C5 -C1 */\
- "pmaddwd %%mm3, %%mm5 \n\t" /* -C5R7-C1R5 -C5r7-C1r5 */\
- "paddd %%mm4, %%mm7 \n\t" /* A0+B0 a0+b0 */\
- "paddd %%mm4, %%mm4 \n\t" /* 2A0 2a0 */\
- "psubd %%mm7, %%mm4 \n\t" /* A0-B0 a0-b0 */\
- "paddd %%mm2, %%mm5 \n\t" /* B1 b1 */\
- "psrad $" #shift ", %%mm7 \n\t"\
- "psrad $" #shift ", %%mm4 \n\t"\
- "movq %%mm1, %%mm2 \n\t" /* A1 a1 */\
- "paddd %%mm5, %%mm1 \n\t" /* A1+B1 a1+b1 */\
- "psubd %%mm5, %%mm2 \n\t" /* A1-B1 a1-b1 */\
- "psrad $" #shift ", %%mm1 \n\t"\
- "psrad $" #shift ", %%mm2 \n\t"\
- "packssdw %%mm1, %%mm7 \n\t" /* A1+B1 a1+b1 A0+B0 a0+b0 */\
- "packssdw %%mm4, %%mm2 \n\t" /* A0-B0 a0-b0 A1-B1 a1-b1 */\
- "movq %%mm7, " #dst " \n\t"\
- "movq " #src1 ", %%mm1 \n\t" /* R3 R1 r3 r1 */\
- "movq 80(%2), %%mm4 \n\t" /* -C1 C5 -C1 C5 */\
- "movq %%mm2, 24+" #dst " \n\t"\
- "pmaddwd %%mm1, %%mm4 \n\t" /* -C1R3+C5R1 -C1r3+C5r1 */\
- "movq 88(%2), %%mm7 \n\t" /* C3 C7 C3 C7 */\
- "pmaddwd 96(%2), %%mm1 \n\t" /* -C5R3+C7R1 -C5r3+C7r1 */\
- "pmaddwd %%mm3, %%mm7 \n\t" /* C3R7+C7R5 C3r7+C7r5 */\
- "movq %%mm0, %%mm2 \n\t" /* A2 a2 */\
- "pmaddwd 104(%2), %%mm3 \n\t" /* -C1R7+C3R5 -C1r7+C3r5 */\
- "paddd %%mm7, %%mm4 \n\t" /* B2 b2 */\
- "paddd %%mm4, %%mm2 \n\t" /* A2+B2 a2+b2 */\
- "psubd %%mm4, %%mm0 \n\t" /* a2-B2 a2-b2 */\
- "psrad $" #shift ", %%mm2 \n\t"\
- "psrad $" #shift ", %%mm0 \n\t"\
- "movq %%mm6, %%mm4 \n\t" /* A3 a3 */\
- "paddd %%mm1, %%mm3 \n\t" /* B3 b3 */\
- "paddd %%mm3, %%mm6 \n\t" /* A3+B3 a3+b3 */\
- "psubd %%mm3, %%mm4 \n\t" /* a3-B3 a3-b3 */\
- "psrad $" #shift ", %%mm6 \n\t"\
- "packssdw %%mm6, %%mm2 \n\t" /* A3+B3 a3+b3 A2+B2 a2+b2 */\
- "movq %%mm2, 8+" #dst " \n\t"\
- "psrad $" #shift ", %%mm4 \n\t"\
- "packssdw %%mm0, %%mm4 \n\t" /* A2-B2 a2-b2 A3-B3 a3-b3 */\
- "movq %%mm4, 16+" #dst " \n\t"\
-
-//IDCT( src0, src4, src1, src5, dst, rounder, shift)
-DC_COND_IDCT( 0(%0), 8(%0), 16(%0), 24(%0), 0(%1),paddd 8(%2), 11)
-Z_COND_IDCT( 32(%0), 40(%0), 48(%0), 56(%0), 32(%1),paddd (%2), 11, 4f)
-Z_COND_IDCT( 64(%0), 72(%0), 80(%0), 88(%0), 64(%1),paddd (%2), 11, 2f)
-Z_COND_IDCT( 96(%0),104(%0),112(%0),120(%0), 96(%1),paddd (%2), 11, 1f)
-
-#undef IDCT
-#define IDCT(src0, src4, src1, src5, dst, shift) \
- "movq " #src0 ", %%mm0 \n\t" /* R4 R0 r4 r0 */\
- "movq " #src4 ", %%mm1 \n\t" /* R6 R2 r6 r2 */\
- "movq " #src1 ", %%mm2 \n\t" /* R3 R1 r3 r1 */\
- "movq " #src5 ", %%mm3 \n\t" /* R7 R5 r7 r5 */\
- "movq 16(%2), %%mm4 \n\t" /* C4 C4 C4 C4 */\
- "pmaddwd %%mm0, %%mm4 \n\t" /* C4R4+C4R0 C4r4+C4r0 */\
- "movq 24(%2), %%mm5 \n\t" /* -C4 C4 -C4 C4 */\
- "pmaddwd %%mm5, %%mm0 \n\t" /* -C4R4+C4R0 -C4r4+C4r0 */\
- "movq 32(%2), %%mm5 \n\t" /* C6 C2 C6 C2 */\
- "pmaddwd %%mm1, %%mm5 \n\t" /* C6R6+C2R2 C6r6+C2r2 */\
- "movq 40(%2), %%mm6 \n\t" /* -C2 C6 -C2 C6 */\
- "pmaddwd %%mm6, %%mm1 \n\t" /* -C2R6+C6R2 -C2r6+C6r2 */\
- "movq %%mm4, %%mm6 \n\t" /* C4R4+C4R0 C4r4+C4r0 */\
- "movq 48(%2), %%mm7 \n\t" /* C3 C1 C3 C1 */\
- "pmaddwd %%mm2, %%mm7 \n\t" /* C3R3+C1R1 C3r3+C1r1 */\
- "paddd %%mm5, %%mm4 \n\t" /* A0 a0 */\
- "psubd %%mm5, %%mm6 \n\t" /* A3 a3 */\
- "movq %%mm0, %%mm5 \n\t" /* -C4R4+C4R0 -C4r4+C4r0 */\
- "paddd %%mm1, %%mm0 \n\t" /* A1 a1 */\
- "psubd %%mm1, %%mm5 \n\t" /* A2 a2 */\
- "movq 56(%2), %%mm1 \n\t" /* C7 C5 C7 C5 */\
- "pmaddwd %%mm3, %%mm1 \n\t" /* C7R7+C5R5 C7r7+C5r5 */\
- "pmaddwd 64(%2), %%mm2 \n\t" /* -C7R3+C3R1 -C7r3+C3r1 */\
- "paddd %%mm1, %%mm7 \n\t" /* B0 b0 */\
- "movq 72(%2), %%mm1 \n\t" /* -C5 -C1 -C5 -C1 */\
- "pmaddwd %%mm3, %%mm1 \n\t" /* -C5R7-C1R5 -C5r7-C1r5 */\
- "paddd %%mm4, %%mm7 \n\t" /* A0+B0 a0+b0 */\
- "paddd %%mm4, %%mm4 \n\t" /* 2A0 2a0 */\
- "psubd %%mm7, %%mm4 \n\t" /* A0-B0 a0-b0 */\
- "paddd %%mm2, %%mm1 \n\t" /* B1 b1 */\
- "psrad $" #shift ", %%mm7 \n\t"\
- "psrad $" #shift ", %%mm4 \n\t"\
- "movq %%mm0, %%mm2 \n\t" /* A1 a1 */\
- "paddd %%mm1, %%mm0 \n\t" /* A1+B1 a1+b1 */\
- "psubd %%mm1, %%mm2 \n\t" /* A1-B1 a1-b1 */\
- "psrad $" #shift ", %%mm0 \n\t"\
- "psrad $" #shift ", %%mm2 \n\t"\
- "packssdw %%mm7, %%mm7 \n\t" /* A0+B0 a0+b0 */\
- "movd %%mm7, " #dst " \n\t"\
- "packssdw %%mm0, %%mm0 \n\t" /* A1+B1 a1+b1 */\
- "movd %%mm0, 16+" #dst " \n\t"\
- "packssdw %%mm2, %%mm2 \n\t" /* A1-B1 a1-b1 */\
- "movd %%mm2, 96+" #dst " \n\t"\
- "packssdw %%mm4, %%mm4 \n\t" /* A0-B0 a0-b0 */\
- "movd %%mm4, 112+" #dst " \n\t"\
- "movq " #src1 ", %%mm0 \n\t" /* R3 R1 r3 r1 */\
- "movq 80(%2), %%mm4 \n\t" /* -C1 C5 -C1 C5 */\
- "pmaddwd %%mm0, %%mm4 \n\t" /* -C1R3+C5R1 -C1r3+C5r1 */\
- "movq 88(%2), %%mm7 \n\t" /* C3 C7 C3 C7 */\
- "pmaddwd 96(%2), %%mm0 \n\t" /* -C5R3+C7R1 -C5r3+C7r1 */\
- "pmaddwd %%mm3, %%mm7 \n\t" /* C3R7+C7R5 C3r7+C7r5 */\
- "movq %%mm5, %%mm2 \n\t" /* A2 a2 */\
- "pmaddwd 104(%2), %%mm3 \n\t" /* -C1R7+C3R5 -C1r7+C3r5 */\
- "paddd %%mm7, %%mm4 \n\t" /* B2 b2 */\
- "paddd %%mm4, %%mm2 \n\t" /* A2+B2 a2+b2 */\
- "psubd %%mm4, %%mm5 \n\t" /* a2-B2 a2-b2 */\
- "psrad $" #shift ", %%mm2 \n\t"\
- "psrad $" #shift ", %%mm5 \n\t"\
- "movq %%mm6, %%mm4 \n\t" /* A3 a3 */\
- "paddd %%mm0, %%mm3 \n\t" /* B3 b3 */\
- "paddd %%mm3, %%mm6 \n\t" /* A3+B3 a3+b3 */\
- "psubd %%mm3, %%mm4 \n\t" /* a3-B3 a3-b3 */\
- "psrad $" #shift ", %%mm6 \n\t"\
- "psrad $" #shift ", %%mm4 \n\t"\
- "packssdw %%mm2, %%mm2 \n\t" /* A2+B2 a2+b2 */\
- "packssdw %%mm6, %%mm6 \n\t" /* A3+B3 a3+b3 */\
- "movd %%mm2, 32+" #dst " \n\t"\
- "packssdw %%mm4, %%mm4 \n\t" /* A3-B3 a3-b3 */\
- "packssdw %%mm5, %%mm5 \n\t" /* A2-B2 a2-b2 */\
- "movd %%mm6, 48+" #dst " \n\t"\
- "movd %%mm4, 64+" #dst " \n\t"\
- "movd %%mm5, 80+" #dst " \n\t"
-
-
-//IDCT( src0, src4, src1, src5, dst, shift)
-IDCT( (%1), 64(%1), 32(%1), 96(%1), 0(%0), 20)
-IDCT( 8(%1), 72(%1), 40(%1), 104(%1), 4(%0), 20)
-IDCT( 16(%1), 80(%1), 48(%1), 112(%1), 8(%0), 20)
-IDCT( 24(%1), 88(%1), 56(%1), 120(%1), 12(%0), 20)
- "jmp 9f \n\t"
-
- "# .p2align 4 \n\t"\
- "4: \n\t"
-Z_COND_IDCT( 64(%0), 72(%0), 80(%0), 88(%0), 64(%1),paddd (%2), 11, 6f)
-Z_COND_IDCT( 96(%0),104(%0),112(%0),120(%0), 96(%1),paddd (%2), 11, 5f)
-
-#undef IDCT
-#define IDCT(src0, src4, src1, src5, dst, shift) \
- "movq " #src0 ", %%mm0 \n\t" /* R4 R0 r4 r0 */\
- "movq " #src4 ", %%mm1 \n\t" /* R6 R2 r6 r2 */\
- "movq " #src5 ", %%mm3 \n\t" /* R7 R5 r7 r5 */\
- "movq 16(%2), %%mm4 \n\t" /* C4 C4 C4 C4 */\
- "pmaddwd %%mm0, %%mm4 \n\t" /* C4R4+C4R0 C4r4+C4r0 */\
- "movq 24(%2), %%mm5 \n\t" /* -C4 C4 -C4 C4 */\
- "pmaddwd %%mm5, %%mm0 \n\t" /* -C4R4+C4R0 -C4r4+C4r0 */\
- "movq 32(%2), %%mm5 \n\t" /* C6 C2 C6 C2 */\
- "pmaddwd %%mm1, %%mm5 \n\t" /* C6R6+C2R2 C6r6+C2r2 */\
- "movq 40(%2), %%mm6 \n\t" /* -C2 C6 -C2 C6 */\
- "pmaddwd %%mm6, %%mm1 \n\t" /* -C2R6+C6R2 -C2r6+C6r2 */\
- "movq %%mm4, %%mm6 \n\t" /* C4R4+C4R0 C4r4+C4r0 */\
- "paddd %%mm5, %%mm4 \n\t" /* A0 a0 */\
- "psubd %%mm5, %%mm6 \n\t" /* A3 a3 */\
- "movq %%mm0, %%mm5 \n\t" /* -C4R4+C4R0 -C4r4+C4r0 */\
- "paddd %%mm1, %%mm0 \n\t" /* A1 a1 */\
- "psubd %%mm1, %%mm5 \n\t" /* A2 a2 */\
- "movq 56(%2), %%mm1 \n\t" /* C7 C5 C7 C5 */\
- "pmaddwd %%mm3, %%mm1 \n\t" /* C7R7+C5R5 C7r7+C5r5 */\
- "movq 72(%2), %%mm7 \n\t" /* -C5 -C1 -C5 -C1 */\
- "pmaddwd %%mm3, %%mm7 \n\t" /* -C5R7-C1R5 -C5r7-C1r5 */\
- "paddd %%mm4, %%mm1 \n\t" /* A0+B0 a0+b0 */\
- "paddd %%mm4, %%mm4 \n\t" /* 2A0 2a0 */\
- "psubd %%mm1, %%mm4 \n\t" /* A0-B0 a0-b0 */\
- "psrad $" #shift ", %%mm1 \n\t"\
- "psrad $" #shift ", %%mm4 \n\t"\
- "movq %%mm0, %%mm2 \n\t" /* A1 a1 */\
- "paddd %%mm7, %%mm0 \n\t" /* A1+B1 a1+b1 */\
- "psubd %%mm7, %%mm2 \n\t" /* A1-B1 a1-b1 */\
- "psrad $" #shift ", %%mm0 \n\t"\
- "psrad $" #shift ", %%mm2 \n\t"\
- "packssdw %%mm1, %%mm1 \n\t" /* A0+B0 a0+b0 */\
- "movd %%mm1, " #dst " \n\t"\
- "packssdw %%mm0, %%mm0 \n\t" /* A1+B1 a1+b1 */\
- "movd %%mm0, 16+" #dst " \n\t"\
- "packssdw %%mm2, %%mm2 \n\t" /* A1-B1 a1-b1 */\
- "movd %%mm2, 96+" #dst " \n\t"\
- "packssdw %%mm4, %%mm4 \n\t" /* A0-B0 a0-b0 */\
- "movd %%mm4, 112+" #dst " \n\t"\
- "movq 88(%2), %%mm1 \n\t" /* C3 C7 C3 C7 */\
- "pmaddwd %%mm3, %%mm1 \n\t" /* C3R7+C7R5 C3r7+C7r5 */\
- "movq %%mm5, %%mm2 \n\t" /* A2 a2 */\
- "pmaddwd 104(%2), %%mm3 \n\t" /* -C1R7+C3R5 -C1r7+C3r5 */\
- "paddd %%mm1, %%mm2 \n\t" /* A2+B2 a2+b2 */\
- "psubd %%mm1, %%mm5 \n\t" /* a2-B2 a2-b2 */\
- "psrad $" #shift ", %%mm2 \n\t"\
- "psrad $" #shift ", %%mm5 \n\t"\
- "movq %%mm6, %%mm1 \n\t" /* A3 a3 */\
- "paddd %%mm3, %%mm6 \n\t" /* A3+B3 a3+b3 */\
- "psubd %%mm3, %%mm1 \n\t" /* a3-B3 a3-b3 */\
- "psrad $" #shift ", %%mm6 \n\t"\
- "psrad $" #shift ", %%mm1 \n\t"\
- "packssdw %%mm2, %%mm2 \n\t" /* A2+B2 a2+b2 */\
- "packssdw %%mm6, %%mm6 \n\t" /* A3+B3 a3+b3 */\
- "movd %%mm2, 32+" #dst " \n\t"\
- "packssdw %%mm1, %%mm1 \n\t" /* A3-B3 a3-b3 */\
- "packssdw %%mm5, %%mm5 \n\t" /* A2-B2 a2-b2 */\
- "movd %%mm6, 48+" #dst " \n\t"\
- "movd %%mm1, 64+" #dst " \n\t"\
- "movd %%mm5, 80+" #dst " \n\t"
-
-//IDCT( src0, src4, src1, src5, dst, shift)
-IDCT( (%1), 64(%1), 32(%1), 96(%1), 0(%0), 20)
-IDCT( 8(%1), 72(%1), 40(%1), 104(%1), 4(%0), 20)
-IDCT( 16(%1), 80(%1), 48(%1), 112(%1), 8(%0), 20)
-IDCT( 24(%1), 88(%1), 56(%1), 120(%1), 12(%0), 20)
- "jmp 9f \n\t"
-
- "# .p2align 4 \n\t"\
- "6: \n\t"
-Z_COND_IDCT( 96(%0),104(%0),112(%0),120(%0), 96(%1),paddd (%2), 11, 7f)
-
-#undef IDCT
-#define IDCT(src0, src4, src1, src5, dst, shift) \
- "movq " #src0 ", %%mm0 \n\t" /* R4 R0 r4 r0 */\
- "movq " #src5 ", %%mm3 \n\t" /* R7 R5 r7 r5 */\
- "movq 16(%2), %%mm4 \n\t" /* C4 C4 C4 C4 */\
- "pmaddwd %%mm0, %%mm4 \n\t" /* C4R4+C4R0 C4r4+C4r0 */\
- "movq 24(%2), %%mm5 \n\t" /* -C4 C4 -C4 C4 */\
- "pmaddwd %%mm5, %%mm0 \n\t" /* -C4R4+C4R0 -C4r4+C4r0 */\
- "movq %%mm4, %%mm6 \n\t" /* C4R4+C4R0 C4r4+C4r0 */\
- "movq %%mm0, %%mm5 \n\t" /* -C4R4+C4R0 -C4r4+C4r0 */\
- "movq 56(%2), %%mm1 \n\t" /* C7 C5 C7 C5 */\
- "pmaddwd %%mm3, %%mm1 \n\t" /* C7R7+C5R5 C7r7+C5r5 */\
- "movq 72(%2), %%mm7 \n\t" /* -C5 -C1 -C5 -C1 */\
- "pmaddwd %%mm3, %%mm7 \n\t" /* -C5R7-C1R5 -C5r7-C1r5 */\
- "paddd %%mm4, %%mm1 \n\t" /* A0+B0 a0+b0 */\
- "paddd %%mm4, %%mm4 \n\t" /* 2A0 2a0 */\
- "psubd %%mm1, %%mm4 \n\t" /* A0-B0 a0-b0 */\
- "psrad $" #shift ", %%mm1 \n\t"\
- "psrad $" #shift ", %%mm4 \n\t"\
- "movq %%mm0, %%mm2 \n\t" /* A1 a1 */\
- "paddd %%mm7, %%mm0 \n\t" /* A1+B1 a1+b1 */\
- "psubd %%mm7, %%mm2 \n\t" /* A1-B1 a1-b1 */\
- "psrad $" #shift ", %%mm0 \n\t"\
- "psrad $" #shift ", %%mm2 \n\t"\
- "packssdw %%mm1, %%mm1 \n\t" /* A0+B0 a0+b0 */\
- "movd %%mm1, " #dst " \n\t"\
- "packssdw %%mm0, %%mm0 \n\t" /* A1+B1 a1+b1 */\
- "movd %%mm0, 16+" #dst " \n\t"\
- "packssdw %%mm2, %%mm2 \n\t" /* A1-B1 a1-b1 */\
- "movd %%mm2, 96+" #dst " \n\t"\
- "packssdw %%mm4, %%mm4 \n\t" /* A0-B0 a0-b0 */\
- "movd %%mm4, 112+" #dst " \n\t"\
- "movq 88(%2), %%mm1 \n\t" /* C3 C7 C3 C7 */\
- "pmaddwd %%mm3, %%mm1 \n\t" /* C3R7+C7R5 C3r7+C7r5 */\
- "movq %%mm5, %%mm2 \n\t" /* A2 a2 */\
- "pmaddwd 104(%2), %%mm3 \n\t" /* -C1R7+C3R5 -C1r7+C3r5 */\
- "paddd %%mm1, %%mm2 \n\t" /* A2+B2 a2+b2 */\
- "psubd %%mm1, %%mm5 \n\t" /* a2-B2 a2-b2 */\
- "psrad $" #shift ", %%mm2 \n\t"\
- "psrad $" #shift ", %%mm5 \n\t"\
- "movq %%mm6, %%mm1 \n\t" /* A3 a3 */\
- "paddd %%mm3, %%mm6 \n\t" /* A3+B3 a3+b3 */\
- "psubd %%mm3, %%mm1 \n\t" /* a3-B3 a3-b3 */\
- "psrad $" #shift ", %%mm6 \n\t"\
- "psrad $" #shift ", %%mm1 \n\t"\
- "packssdw %%mm2, %%mm2 \n\t" /* A2+B2 a2+b2 */\
- "packssdw %%mm6, %%mm6 \n\t" /* A3+B3 a3+b3 */\
- "movd %%mm2, 32+" #dst " \n\t"\
- "packssdw %%mm1, %%mm1 \n\t" /* A3-B3 a3-b3 */\
- "packssdw %%mm5, %%mm5 \n\t" /* A2-B2 a2-b2 */\
- "movd %%mm6, 48+" #dst " \n\t"\
- "movd %%mm1, 64+" #dst " \n\t"\
- "movd %%mm5, 80+" #dst " \n\t"
-
-
-//IDCT( src0, src4, src1, src5, dst, shift)
-IDCT( (%1), 64(%1), 32(%1), 96(%1), 0(%0), 20)
-IDCT( 8(%1), 72(%1), 40(%1), 104(%1), 4(%0), 20)
-IDCT( 16(%1), 80(%1), 48(%1), 112(%1), 8(%0), 20)
-IDCT( 24(%1), 88(%1), 56(%1), 120(%1), 12(%0), 20)
- "jmp 9f \n\t"
-
- "# .p2align 4 \n\t"\
- "2: \n\t"
-Z_COND_IDCT( 96(%0),104(%0),112(%0),120(%0), 96(%1),paddd (%2), 11, 3f)
-
-#undef IDCT
-#define IDCT(src0, src4, src1, src5, dst, shift) \
- "movq " #src0 ", %%mm0 \n\t" /* R4 R0 r4 r0 */\
- "movq " #src1 ", %%mm2 \n\t" /* R3 R1 r3 r1 */\
- "movq " #src5 ", %%mm3 \n\t" /* R7 R5 r7 r5 */\
- "movq 16(%2), %%mm4 \n\t" /* C4 C4 C4 C4 */\
- "pmaddwd %%mm0, %%mm4 \n\t" /* C4R4+C4R0 C4r4+C4r0 */\
- "movq 24(%2), %%mm5 \n\t" /* -C4 C4 -C4 C4 */\
- "pmaddwd %%mm5, %%mm0 \n\t" /* -C4R4+C4R0 -C4r4+C4r0 */\
- "movq %%mm4, %%mm6 \n\t" /* C4R4+C4R0 C4r4+C4r0 */\
- "movq 48(%2), %%mm7 \n\t" /* C3 C1 C3 C1 */\
- "pmaddwd %%mm2, %%mm7 \n\t" /* C3R3+C1R1 C3r3+C1r1 */\
- "movq %%mm0, %%mm5 \n\t" /* -C4R4+C4R0 -C4r4+C4r0 */\
- "movq 56(%2), %%mm1 \n\t" /* C7 C5 C7 C5 */\
- "pmaddwd %%mm3, %%mm1 \n\t" /* C7R7+C5R5 C7r7+C5r5 */\
- "pmaddwd 64(%2), %%mm2 \n\t" /* -C7R3+C3R1 -C7r3+C3r1 */\
- "paddd %%mm1, %%mm7 \n\t" /* B0 b0 */\
- "movq 72(%2), %%mm1 \n\t" /* -C5 -C1 -C5 -C1 */\
- "pmaddwd %%mm3, %%mm1 \n\t" /* -C5R7-C1R5 -C5r7-C1r5 */\
- "paddd %%mm4, %%mm7 \n\t" /* A0+B0 a0+b0 */\
- "paddd %%mm4, %%mm4 \n\t" /* 2A0 2a0 */\
- "psubd %%mm7, %%mm4 \n\t" /* A0-B0 a0-b0 */\
- "paddd %%mm2, %%mm1 \n\t" /* B1 b1 */\
- "psrad $" #shift ", %%mm7 \n\t"\
- "psrad $" #shift ", %%mm4 \n\t"\
- "movq %%mm0, %%mm2 \n\t" /* A1 a1 */\
- "paddd %%mm1, %%mm0 \n\t" /* A1+B1 a1+b1 */\
- "psubd %%mm1, %%mm2 \n\t" /* A1-B1 a1-b1 */\
- "psrad $" #shift ", %%mm0 \n\t"\
- "psrad $" #shift ", %%mm2 \n\t"\
- "packssdw %%mm7, %%mm7 \n\t" /* A0+B0 a0+b0 */\
- "movd %%mm7, " #dst " \n\t"\
- "packssdw %%mm0, %%mm0 \n\t" /* A1+B1 a1+b1 */\
- "movd %%mm0, 16+" #dst " \n\t"\
- "packssdw %%mm2, %%mm2 \n\t" /* A1-B1 a1-b1 */\
- "movd %%mm2, 96+" #dst " \n\t"\
- "packssdw %%mm4, %%mm4 \n\t" /* A0-B0 a0-b0 */\
- "movd %%mm4, 112+" #dst " \n\t"\
- "movq " #src1 ", %%mm0 \n\t" /* R3 R1 r3 r1 */\
- "movq 80(%2), %%mm4 \n\t" /* -C1 C5 -C1 C5 */\
- "pmaddwd %%mm0, %%mm4 \n\t" /* -C1R3+C5R1 -C1r3+C5r1 */\
- "movq 88(%2), %%mm7 \n\t" /* C3 C7 C3 C7 */\
- "pmaddwd 96(%2), %%mm0 \n\t" /* -C5R3+C7R1 -C5r3+C7r1 */\
- "pmaddwd %%mm3, %%mm7 \n\t" /* C3R7+C7R5 C3r7+C7r5 */\
- "movq %%mm5, %%mm2 \n\t" /* A2 a2 */\
- "pmaddwd 104(%2), %%mm3 \n\t" /* -C1R7+C3R5 -C1r7+C3r5 */\
- "paddd %%mm7, %%mm4 \n\t" /* B2 b2 */\
- "paddd %%mm4, %%mm2 \n\t" /* A2+B2 a2+b2 */\
- "psubd %%mm4, %%mm5 \n\t" /* a2-B2 a2-b2 */\
- "psrad $" #shift ", %%mm2 \n\t"\
- "psrad $" #shift ", %%mm5 \n\t"\
- "movq %%mm6, %%mm4 \n\t" /* A3 a3 */\
- "paddd %%mm0, %%mm3 \n\t" /* B3 b3 */\
- "paddd %%mm3, %%mm6 \n\t" /* A3+B3 a3+b3 */\
- "psubd %%mm3, %%mm4 \n\t" /* a3-B3 a3-b3 */\
- "psrad $" #shift ", %%mm6 \n\t"\
- "psrad $" #shift ", %%mm4 \n\t"\
- "packssdw %%mm2, %%mm2 \n\t" /* A2+B2 a2+b2 */\
- "packssdw %%mm6, %%mm6 \n\t" /* A3+B3 a3+b3 */\
- "movd %%mm2, 32+" #dst " \n\t"\
- "packssdw %%mm4, %%mm4 \n\t" /* A3-B3 a3-b3 */\
- "packssdw %%mm5, %%mm5 \n\t" /* A2-B2 a2-b2 */\
- "movd %%mm6, 48+" #dst " \n\t"\
- "movd %%mm4, 64+" #dst " \n\t"\
- "movd %%mm5, 80+" #dst " \n\t"
-
-//IDCT( src0, src4, src1, src5, dst, shift)
-IDCT( (%1), 64(%1), 32(%1), 96(%1), 0(%0), 20)
-IDCT( 8(%1), 72(%1), 40(%1), 104(%1), 4(%0), 20)
-IDCT( 16(%1), 80(%1), 48(%1), 112(%1), 8(%0), 20)
-IDCT( 24(%1), 88(%1), 56(%1), 120(%1), 12(%0), 20)
- "jmp 9f \n\t"
-
- "# .p2align 4 \n\t"\
- "3: \n\t"
-#undef IDCT
-#define IDCT(src0, src4, src1, src5, dst, shift) \
- "movq " #src0 ", %%mm0 \n\t" /* R4 R0 r4 r0 */\
- "movq " #src1 ", %%mm2 \n\t" /* R3 R1 r3 r1 */\
- "movq 16(%2), %%mm4 \n\t" /* C4 C4 C4 C4 */\
- "pmaddwd %%mm0, %%mm4 \n\t" /* C4R4+C4R0 C4r4+C4r0 */\
- "movq 24(%2), %%mm5 \n\t" /* -C4 C4 -C4 C4 */\
- "pmaddwd %%mm5, %%mm0 \n\t" /* -C4R4+C4R0 -C4r4+C4r0 */\
- "movq %%mm4, %%mm6 \n\t" /* C4R4+C4R0 C4r4+C4r0 */\
- "movq 48(%2), %%mm7 \n\t" /* C3 C1 C3 C1 */\
- "pmaddwd %%mm2, %%mm7 \n\t" /* C3R3+C1R1 C3r3+C1r1 */\
- "movq %%mm0, %%mm5 \n\t" /* -C4R4+C4R0 -C4r4+C4r0 */\
- "movq 64(%2), %%mm3 \n\t"\
- "pmaddwd %%mm2, %%mm3 \n\t" /* -C7R3+C3R1 -C7r3+C3r1 */\
- "paddd %%mm4, %%mm7 \n\t" /* A0+B0 a0+b0 */\
- "paddd %%mm4, %%mm4 \n\t" /* 2A0 2a0 */\
- "psubd %%mm7, %%mm4 \n\t" /* A0-B0 a0-b0 */\
- "psrad $" #shift ", %%mm7 \n\t"\
- "psrad $" #shift ", %%mm4 \n\t"\
- "movq %%mm0, %%mm1 \n\t" /* A1 a1 */\
- "paddd %%mm3, %%mm0 \n\t" /* A1+B1 a1+b1 */\
- "psubd %%mm3, %%mm1 \n\t" /* A1-B1 a1-b1 */\
- "psrad $" #shift ", %%mm0 \n\t"\
- "psrad $" #shift ", %%mm1 \n\t"\
- "packssdw %%mm7, %%mm7 \n\t" /* A0+B0 a0+b0 */\
- "movd %%mm7, " #dst " \n\t"\
- "packssdw %%mm0, %%mm0 \n\t" /* A1+B1 a1+b1 */\
- "movd %%mm0, 16+" #dst " \n\t"\
- "packssdw %%mm1, %%mm1 \n\t" /* A1-B1 a1-b1 */\
- "movd %%mm1, 96+" #dst " \n\t"\
- "packssdw %%mm4, %%mm4 \n\t" /* A0-B0 a0-b0 */\
- "movd %%mm4, 112+" #dst " \n\t"\
- "movq 80(%2), %%mm4 \n\t" /* -C1 C5 -C1 C5 */\
- "pmaddwd %%mm2, %%mm4 \n\t" /* -C1R3+C5R1 -C1r3+C5r1 */\
- "pmaddwd 96(%2), %%mm2 \n\t" /* -C5R3+C7R1 -C5r3+C7r1 */\
- "movq %%mm5, %%mm1 \n\t" /* A2 a2 */\
- "paddd %%mm4, %%mm1 \n\t" /* A2+B2 a2+b2 */\
- "psubd %%mm4, %%mm5 \n\t" /* a2-B2 a2-b2 */\
- "psrad $" #shift ", %%mm1 \n\t"\
- "psrad $" #shift ", %%mm5 \n\t"\
- "movq %%mm6, %%mm4 \n\t" /* A3 a3 */\
- "paddd %%mm2, %%mm6 \n\t" /* A3+B3 a3+b3 */\
- "psubd %%mm2, %%mm4 \n\t" /* a3-B3 a3-b3 */\
- "psrad $" #shift ", %%mm6 \n\t"\
- "psrad $" #shift ", %%mm4 \n\t"\
- "packssdw %%mm1, %%mm1 \n\t" /* A2+B2 a2+b2 */\
- "packssdw %%mm6, %%mm6 \n\t" /* A3+B3 a3+b3 */\
- "movd %%mm1, 32+" #dst " \n\t"\
- "packssdw %%mm4, %%mm4 \n\t" /* A3-B3 a3-b3 */\
- "packssdw %%mm5, %%mm5 \n\t" /* A2-B2 a2-b2 */\
- "movd %%mm6, 48+" #dst " \n\t"\
- "movd %%mm4, 64+" #dst " \n\t"\
- "movd %%mm5, 80+" #dst " \n\t"
-
-
-//IDCT( src0, src4, src1, src5, dst, shift)
-IDCT( (%1), 64(%1), 32(%1), 96(%1), 0(%0), 20)
-IDCT( 8(%1), 72(%1), 40(%1), 104(%1), 4(%0), 20)
-IDCT( 16(%1), 80(%1), 48(%1), 112(%1), 8(%0), 20)
-IDCT( 24(%1), 88(%1), 56(%1), 120(%1), 12(%0), 20)
- "jmp 9f \n\t"
-
- "# .p2align 4 \n\t"\
- "5: \n\t"
-#undef IDCT
-#define IDCT(src0, src4, src1, src5, dst, shift) \
- "movq " #src0 ", %%mm0 \n\t" /* R4 R0 r4 r0 */\
- "movq " #src4 ", %%mm1 \n\t" /* R6 R2 r6 r2 */\
- "movq 16(%2), %%mm4 \n\t" /* C4 C4 C4 C4 */\
- "pmaddwd %%mm0, %%mm4 \n\t" /* C4R4+C4R0 C4r4+C4r0 */\
- "movq 24(%2), %%mm5 \n\t" /* -C4 C4 -C4 C4 */\
- "pmaddwd %%mm5, %%mm0 \n\t" /* -C4R4+C4R0 -C4r4+C4r0 */\
- "movq 32(%2), %%mm5 \n\t" /* C6 C2 C6 C2 */\
- "pmaddwd %%mm1, %%mm5 \n\t" /* C6R6+C2R2 C6r6+C2r2 */\
- "movq 40(%2), %%mm6 \n\t" /* -C2 C6 -C2 C6 */\
- "pmaddwd %%mm6, %%mm1 \n\t" /* -C2R6+C6R2 -C2r6+C6r2 */\
- "movq %%mm4, %%mm6 \n\t" /* C4R4+C4R0 C4r4+C4r0 */\
- "paddd %%mm5, %%mm4 \n\t" /* A0 a0 */\
- "psubd %%mm5, %%mm6 \n\t" /* A3 a3 */\
- "movq %%mm0, %%mm5 \n\t" /* -C4R4+C4R0 -C4r4+C4r0 */\
- "paddd %%mm1, %%mm0 \n\t" /* A1 a1 */\
- "psubd %%mm1, %%mm5 \n\t" /* A2 a2 */\
- "movq 8+" #src0 ", %%mm2 \n\t" /* R4 R0 r4 r0 */\
- "movq 8+" #src4 ", %%mm3 \n\t" /* R6 R2 r6 r2 */\
- "movq 16(%2), %%mm1 \n\t" /* C4 C4 C4 C4 */\
- "pmaddwd %%mm2, %%mm1 \n\t" /* C4R4+C4R0 C4r4+C4r0 */\
- "movq 24(%2), %%mm7 \n\t" /* -C4 C4 -C4 C4 */\
- "pmaddwd %%mm7, %%mm2 \n\t" /* -C4R4+C4R0 -C4r4+C4r0 */\
- "movq 32(%2), %%mm7 \n\t" /* C6 C2 C6 C2 */\
- "pmaddwd %%mm3, %%mm7 \n\t" /* C6R6+C2R2 C6r6+C2r2 */\
- "pmaddwd 40(%2), %%mm3 \n\t" /* -C2R6+C6R2 -C2r6+C6r2 */\
- "paddd %%mm1, %%mm7 \n\t" /* A0 a0 */\
- "paddd %%mm1, %%mm1 \n\t" /* 2C0 2c0 */\
- "psubd %%mm7, %%mm1 \n\t" /* A3 a3 */\
- "paddd %%mm2, %%mm3 \n\t" /* A1 a1 */\
- "paddd %%mm2, %%mm2 \n\t" /* 2C1 2c1 */\
- "psubd %%mm3, %%mm2 \n\t" /* A2 a2 */\
- "psrad $" #shift ", %%mm4 \n\t"\
- "psrad $" #shift ", %%mm7 \n\t"\
- "psrad $" #shift ", %%mm3 \n\t"\
- "packssdw %%mm7, %%mm4 \n\t" /* A0 a0 */\
- "movq %%mm4, " #dst " \n\t"\
- "psrad $" #shift ", %%mm0 \n\t"\
- "packssdw %%mm3, %%mm0 \n\t" /* A1 a1 */\
- "movq %%mm0, 16+" #dst " \n\t"\
- "movq %%mm0, 96+" #dst " \n\t"\
- "movq %%mm4, 112+" #dst " \n\t"\
- "psrad $" #shift ", %%mm5 \n\t"\
- "psrad $" #shift ", %%mm6 \n\t"\
- "psrad $" #shift ", %%mm2 \n\t"\
- "packssdw %%mm2, %%mm5 \n\t" /* A2-B2 a2-b2 */\
- "movq %%mm5, 32+" #dst " \n\t"\
- "psrad $" #shift ", %%mm1 \n\t"\
- "packssdw %%mm1, %%mm6 \n\t" /* A3+B3 a3+b3 */\
- "movq %%mm6, 48+" #dst " \n\t"\
- "movq %%mm6, 64+" #dst " \n\t"\
- "movq %%mm5, 80+" #dst " \n\t"
-
-
-//IDCT( src0, src4, src1, src5, dst, shift)
-IDCT( 0(%1), 64(%1), 32(%1), 96(%1), 0(%0), 20)
-//IDCT( 8(%1), 72(%1), 40(%1), 104(%1), 4(%0), 20)
-IDCT( 16(%1), 80(%1), 48(%1), 112(%1), 8(%0), 20)
-//IDCT( 24(%1), 88(%1), 56(%1), 120(%1), 12(%0), 20)
- "jmp 9f \n\t"
-
-
- "# .p2align 4 \n\t"\
- "1: \n\t"
-#undef IDCT
-#define IDCT(src0, src4, src1, src5, dst, shift) \
- "movq " #src0 ", %%mm0 \n\t" /* R4 R0 r4 r0 */\
- "movq " #src4 ", %%mm1 \n\t" /* R6 R2 r6 r2 */\
- "movq " #src1 ", %%mm2 \n\t" /* R3 R1 r3 r1 */\
- "movq 16(%2), %%mm4 \n\t" /* C4 C4 C4 C4 */\
- "pmaddwd %%mm0, %%mm4 \n\t" /* C4R4+C4R0 C4r4+C4r0 */\
- "movq 24(%2), %%mm5 \n\t" /* -C4 C4 -C4 C4 */\
- "pmaddwd %%mm5, %%mm0 \n\t" /* -C4R4+C4R0 -C4r4+C4r0 */\
- "movq 32(%2), %%mm5 \n\t" /* C6 C2 C6 C2 */\
- "pmaddwd %%mm1, %%mm5 \n\t" /* C6R6+C2R2 C6r6+C2r2 */\
- "movq 40(%2), %%mm6 \n\t" /* -C2 C6 -C2 C6 */\
- "pmaddwd %%mm6, %%mm1 \n\t" /* -C2R6+C6R2 -C2r6+C6r2 */\
- "movq %%mm4, %%mm6 \n\t" /* C4R4+C4R0 C4r4+C4r0 */\
- "movq 48(%2), %%mm7 \n\t" /* C3 C1 C3 C1 */\
- "pmaddwd %%mm2, %%mm7 \n\t" /* C3R3+C1R1 C3r3+C1r1 */\
- "paddd %%mm5, %%mm4 \n\t" /* A0 a0 */\
- "psubd %%mm5, %%mm6 \n\t" /* A3 a3 */\
- "movq %%mm0, %%mm5 \n\t" /* -C4R4+C4R0 -C4r4+C4r0 */\
- "paddd %%mm1, %%mm0 \n\t" /* A1 a1 */\
- "psubd %%mm1, %%mm5 \n\t" /* A2 a2 */\
- "movq 64(%2), %%mm1 \n\t"\
- "pmaddwd %%mm2, %%mm1 \n\t" /* -C7R3+C3R1 -C7r3+C3r1 */\
- "paddd %%mm4, %%mm7 \n\t" /* A0+B0 a0+b0 */\
- "paddd %%mm4, %%mm4 \n\t" /* 2A0 2a0 */\
- "psubd %%mm7, %%mm4 \n\t" /* A0-B0 a0-b0 */\
- "psrad $" #shift ", %%mm7 \n\t"\
- "psrad $" #shift ", %%mm4 \n\t"\
- "movq %%mm0, %%mm3 \n\t" /* A1 a1 */\
- "paddd %%mm1, %%mm0 \n\t" /* A1+B1 a1+b1 */\
- "psubd %%mm1, %%mm3 \n\t" /* A1-B1 a1-b1 */\
- "psrad $" #shift ", %%mm0 \n\t"\
- "psrad $" #shift ", %%mm3 \n\t"\
- "packssdw %%mm7, %%mm7 \n\t" /* A0+B0 a0+b0 */\
- "movd %%mm7, " #dst " \n\t"\
- "packssdw %%mm0, %%mm0 \n\t" /* A1+B1 a1+b1 */\
- "movd %%mm0, 16+" #dst " \n\t"\
- "packssdw %%mm3, %%mm3 \n\t" /* A1-B1 a1-b1 */\
- "movd %%mm3, 96+" #dst " \n\t"\
- "packssdw %%mm4, %%mm4 \n\t" /* A0-B0 a0-b0 */\
- "movd %%mm4, 112+" #dst " \n\t"\
- "movq 80(%2), %%mm4 \n\t" /* -C1 C5 -C1 C5 */\
- "pmaddwd %%mm2, %%mm4 \n\t" /* -C1R3+C5R1 -C1r3+C5r1 */\
- "pmaddwd 96(%2), %%mm2 \n\t" /* -C5R3+C7R1 -C5r3+C7r1 */\
- "movq %%mm5, %%mm3 \n\t" /* A2 a2 */\
- "paddd %%mm4, %%mm3 \n\t" /* A2+B2 a2+b2 */\
- "psubd %%mm4, %%mm5 \n\t" /* a2-B2 a2-b2 */\
- "psrad $" #shift ", %%mm3 \n\t"\
- "psrad $" #shift ", %%mm5 \n\t"\
- "movq %%mm6, %%mm4 \n\t" /* A3 a3 */\
- "paddd %%mm2, %%mm6 \n\t" /* A3+B3 a3+b3 */\
- "psubd %%mm2, %%mm4 \n\t" /* a3-B3 a3-b3 */\
- "psrad $" #shift ", %%mm6 \n\t"\
- "packssdw %%mm3, %%mm3 \n\t" /* A2+B2 a2+b2 */\
- "movd %%mm3, 32+" #dst " \n\t"\
- "psrad $" #shift ", %%mm4 \n\t"\
- "packssdw %%mm6, %%mm6 \n\t" /* A3+B3 a3+b3 */\
- "movd %%mm6, 48+" #dst " \n\t"\
- "packssdw %%mm4, %%mm4 \n\t" /* A3-B3 a3-b3 */\
- "packssdw %%mm5, %%mm5 \n\t" /* A2-B2 a2-b2 */\
- "movd %%mm4, 64+" #dst " \n\t"\
- "movd %%mm5, 80+" #dst " \n\t"
-
-
-//IDCT( src0, src4, src1, src5, dst, shift)
-IDCT( (%1), 64(%1), 32(%1), 96(%1), 0(%0), 20)
-IDCT( 8(%1), 72(%1), 40(%1), 104(%1), 4(%0), 20)
-IDCT( 16(%1), 80(%1), 48(%1), 112(%1), 8(%0), 20)
-IDCT( 24(%1), 88(%1), 56(%1), 120(%1), 12(%0), 20)
- "jmp 9f \n\t"
-
-
- "# .p2align 4 \n\t"
- "7: \n\t"
-#undef IDCT
-#define IDCT(src0, src4, src1, src5, dst, shift) \
- "movq " #src0 ", %%mm0 \n\t" /* R4 R0 r4 r0 */\
- "movq 16(%2), %%mm4 \n\t" /* C4 C4 C4 C4 */\
- "pmaddwd %%mm0, %%mm4 \n\t" /* C4R4+C4R0 C4r4+C4r0 */\
- "movq 24(%2), %%mm5 \n\t" /* -C4 C4 -C4 C4 */\
- "pmaddwd %%mm5, %%mm0 \n\t" /* -C4R4+C4R0 -C4r4+C4r0 */\
- "psrad $" #shift ", %%mm4 \n\t"\
- "psrad $" #shift ", %%mm0 \n\t"\
- "movq 8+" #src0 ", %%mm2 \n\t" /* R4 R0 r4 r0 */\
- "movq 16(%2), %%mm1 \n\t" /* C4 C4 C4 C4 */\
- "pmaddwd %%mm2, %%mm1 \n\t" /* C4R4+C4R0 C4r4+C4r0 */\
- "movq 24(%2), %%mm7 \n\t" /* -C4 C4 -C4 C4 */\
- "pmaddwd %%mm7, %%mm2 \n\t" /* -C4R4+C4R0 -C4r4+C4r0 */\
- "movq 32(%2), %%mm7 \n\t" /* C6 C2 C6 C2 */\
- "psrad $" #shift ", %%mm1 \n\t"\
- "packssdw %%mm1, %%mm4 \n\t" /* A0 a0 */\
- "movq %%mm4, " #dst " \n\t"\
- "psrad $" #shift ", %%mm2 \n\t"\
- "packssdw %%mm2, %%mm0 \n\t" /* A1 a1 */\
- "movq %%mm0, 16+" #dst " \n\t"\
- "movq %%mm0, 96+" #dst " \n\t"\
- "movq %%mm4, 112+" #dst " \n\t"\
- "movq %%mm0, 32+" #dst " \n\t"\
- "movq %%mm4, 48+" #dst " \n\t"\
- "movq %%mm4, 64+" #dst " \n\t"\
- "movq %%mm0, 80+" #dst " \n\t"
-
-//IDCT( src0, src4, src1, src5, dst, shift)
-IDCT( 0(%1), 64(%1), 32(%1), 96(%1), 0(%0), 20)
-//IDCT( 8(%1), 72(%1), 40(%1), 104(%1), 4(%0), 20)
-IDCT( 16(%1), 80(%1), 48(%1), 112(%1), 8(%0), 20)
-//IDCT( 24(%1), 88(%1), 56(%1), 120(%1), 12(%0), 20)
-
-
-#endif
-
-/*
-Input
- 00 40 04 44 20 60 24 64
- 10 30 14 34 50 70 54 74
- 01 41 03 43 21 61 23 63
- 11 31 13 33 51 71 53 73
- 02 42 06 46 22 62 26 66
- 12 32 16 36 52 72 56 76
- 05 45 07 47 25 65 27 67
- 15 35 17 37 55 75 57 77
-
-Temp
- 00 04 10 14 20 24 30 34
- 40 44 50 54 60 64 70 74
- 01 03 11 13 21 23 31 33
- 41 43 51 53 61 63 71 73
- 02 06 12 16 22 26 32 36
- 42 46 52 56 62 66 72 76
- 05 07 15 17 25 27 35 37
- 45 47 55 57 65 67 75 77
-*/
-
-"9: \n\t"
- :: "r" (block), "r" (temp), "r" (coeffs)
- : "%eax"
- );
-}
-
-void ff_simple_idct_mmx(int16_t *block)
-{
- idct(block);
-}
-
-//FIXME merge add/put into the idct
-
-void ff_simple_idct_put_mmx(uint8_t *dest, int line_size, DCTELEM *block)
-{
- idct(block);
- ff_put_pixels_clamped_mmx(block, dest, line_size);
-}
-void ff_simple_idct_add_mmx(uint8_t *dest, int line_size, DCTELEM *block)
-{
- idct(block);
- ff_add_pixels_clamped_mmx(block, dest, line_size);
-}
diff --git a/gst-libs/ext/libav/libavcodec/x86/snowdsp.c b/gst-libs/ext/libav/libavcodec/x86/snowdsp.c
new file mode 100644
index 0000000..fb190d8
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/x86/snowdsp.c
@@ -0,0 +1,902 @@
+/*
+ * MMX and SSE2 optimized snow DSP utils
+ * Copyright (c) 2005-2006 Robert Edele <yartrebo@earthlink.net>
+ *
+ * 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
+ */
+
+#include "libavutil/cpu.h"
+#include "libavutil/x86/asm.h"
+#include "libavcodec/avcodec.h"
+#include "libavcodec/snow.h"
+#include "libavcodec/dwt.h"
+#include "dsputil_mmx.h"
+
+#if HAVE_INLINE_ASM
+
+static void ff_snow_horizontal_compose97i_sse2(IDWTELEM *b, IDWTELEM *temp, int width){
+ const int w2= (width+1)>>1;
+ const int w_l= (width>>1);
+ const int w_r= w2 - 1;
+ int i;
+
+ { // Lift 0
+ IDWTELEM * const ref = b + w2 - 1;
+ IDWTELEM b_0 = b[0]; //By allowing the first entry in b[0] to be calculated twice
+ // (the first time erroneously), we allow the SSE2 code to run an extra pass.
+ // The savings in code and time are well worth having to store this value and
+ // calculate b[0] correctly afterwards.
+
+ i = 0;
+ __asm__ volatile(
+ "pcmpeqd %%xmm7, %%xmm7 \n\t"
+ "pcmpeqd %%xmm3, %%xmm3 \n\t"
+ "psllw $1, %%xmm3 \n\t"
+ "paddw %%xmm7, %%xmm3 \n\t"
+ "psllw $13, %%xmm3 \n\t"
+ ::);
+ for(; i<w_l-15; i+=16){
+ __asm__ volatile(
+ "movdqu (%1), %%xmm1 \n\t"
+ "movdqu 16(%1), %%xmm5 \n\t"
+ "movdqu 2(%1), %%xmm2 \n\t"
+ "movdqu 18(%1), %%xmm6 \n\t"
+ "paddw %%xmm1, %%xmm2 \n\t"
+ "paddw %%xmm5, %%xmm6 \n\t"
+ "paddw %%xmm7, %%xmm2 \n\t"
+ "paddw %%xmm7, %%xmm6 \n\t"
+ "pmulhw %%xmm3, %%xmm2 \n\t"
+ "pmulhw %%xmm3, %%xmm6 \n\t"
+ "paddw (%0), %%xmm2 \n\t"
+ "paddw 16(%0), %%xmm6 \n\t"
+ "movdqa %%xmm2, (%0) \n\t"
+ "movdqa %%xmm6, 16(%0) \n\t"
+ :: "r"(&b[i]), "r"(&ref[i])
+ : "memory"
+ );
+ }
+ snow_horizontal_compose_lift_lead_out(i, b, b, ref, width, w_l, 0, W_DM, W_DO, W_DS);
+ b[0] = b_0 - ((W_DM * 2 * ref[1]+W_DO)>>W_DS);
+ }
+
+ { // Lift 1
+ IDWTELEM * const dst = b+w2;
+
+ i = 0;
+ for(; (((x86_reg)&dst[i]) & 0x1F) && i<w_r; i++){
+ dst[i] = dst[i] - (b[i] + b[i + 1]);
+ }
+ for(; i<w_r-15; i+=16){
+ __asm__ volatile(
+ "movdqu (%1), %%xmm1 \n\t"
+ "movdqu 16(%1), %%xmm5 \n\t"
+ "movdqu 2(%1), %%xmm2 \n\t"
+ "movdqu 18(%1), %%xmm6 \n\t"
+ "paddw %%xmm1, %%xmm2 \n\t"
+ "paddw %%xmm5, %%xmm6 \n\t"
+ "movdqa (%0), %%xmm0 \n\t"
+ "movdqa 16(%0), %%xmm4 \n\t"
+ "psubw %%xmm2, %%xmm0 \n\t"
+ "psubw %%xmm6, %%xmm4 \n\t"
+ "movdqa %%xmm0, (%0) \n\t"
+ "movdqa %%xmm4, 16(%0) \n\t"
+ :: "r"(&dst[i]), "r"(&b[i])
+ : "memory"
+ );
+ }
+ snow_horizontal_compose_lift_lead_out(i, dst, dst, b, width, w_r, 1, W_CM, W_CO, W_CS);
+ }
+
+ { // Lift 2
+ IDWTELEM * const ref = b+w2 - 1;
+ IDWTELEM b_0 = b[0];
+
+ i = 0;
+ __asm__ volatile(
+ "psllw $15, %%xmm7 \n\t"
+ "pcmpeqw %%xmm6, %%xmm6 \n\t"
+ "psrlw $13, %%xmm6 \n\t"
+ "paddw %%xmm7, %%xmm6 \n\t"
+ ::);
+ for(; i<w_l-15; i+=16){
+ __asm__ volatile(
+ "movdqu (%1), %%xmm0 \n\t"
+ "movdqu 16(%1), %%xmm4 \n\t"
+ "movdqu 2(%1), %%xmm1 \n\t"
+ "movdqu 18(%1), %%xmm5 \n\t" //FIXME try aligned reads and shifts
+ "paddw %%xmm6, %%xmm0 \n\t"
+ "paddw %%xmm6, %%xmm4 \n\t"
+ "paddw %%xmm7, %%xmm1 \n\t"
+ "paddw %%xmm7, %%xmm5 \n\t"
+ "pavgw %%xmm1, %%xmm0 \n\t"
+ "pavgw %%xmm5, %%xmm4 \n\t"
+ "psubw %%xmm7, %%xmm0 \n\t"
+ "psubw %%xmm7, %%xmm4 \n\t"
+ "psraw $1, %%xmm0 \n\t"
+ "psraw $1, %%xmm4 \n\t"
+ "movdqa (%0), %%xmm1 \n\t"
+ "movdqa 16(%0), %%xmm5 \n\t"
+ "paddw %%xmm1, %%xmm0 \n\t"
+ "paddw %%xmm5, %%xmm4 \n\t"
+ "psraw $2, %%xmm0 \n\t"
+ "psraw $2, %%xmm4 \n\t"
+ "paddw %%xmm1, %%xmm0 \n\t"
+ "paddw %%xmm5, %%xmm4 \n\t"
+ "movdqa %%xmm0, (%0) \n\t"
+ "movdqa %%xmm4, 16(%0) \n\t"
+ :: "r"(&b[i]), "r"(&ref[i])
+ : "memory"
+ );
+ }
+ snow_horizontal_compose_liftS_lead_out(i, b, b, ref, width, w_l);
+ b[0] = b_0 + ((2 * ref[1] + W_BO-1 + 4 * b_0) >> W_BS);
+ }
+
+ { // Lift 3
+ IDWTELEM * const src = b+w2;
+
+ i = 0;
+ for(; (((x86_reg)&temp[i]) & 0x1F) && i<w_r; i++){
+ temp[i] = src[i] - ((-W_AM*(b[i] + b[i+1]))>>W_AS);
+ }
+ for(; i<w_r-7; i+=8){
+ __asm__ volatile(
+ "movdqu 2(%1), %%xmm2 \n\t"
+ "movdqu 18(%1), %%xmm6 \n\t"
+ "paddw (%1), %%xmm2 \n\t"
+ "paddw 16(%1), %%xmm6 \n\t"
+ "movdqu (%0), %%xmm0 \n\t"
+ "movdqu 16(%0), %%xmm4 \n\t"
+ "paddw %%xmm2, %%xmm0 \n\t"
+ "paddw %%xmm6, %%xmm4 \n\t"
+ "psraw $1, %%xmm2 \n\t"
+ "psraw $1, %%xmm6 \n\t"
+ "paddw %%xmm0, %%xmm2 \n\t"
+ "paddw %%xmm4, %%xmm6 \n\t"
+ "movdqa %%xmm2, (%2) \n\t"
+ "movdqa %%xmm6, 16(%2) \n\t"
+ :: "r"(&src[i]), "r"(&b[i]), "r"(&temp[i])
+ : "memory"
+ );
+ }
+ snow_horizontal_compose_lift_lead_out(i, temp, src, b, width, w_r, 1, -W_AM, W_AO+1, W_AS);
+ }
+
+ {
+ snow_interleave_line_header(&i, width, b, temp);
+
+ for (; (i & 0x3E) != 0x3E; i-=2){
+ b[i+1] = temp[i>>1];
+ b[i] = b[i>>1];
+ }
+ for (i-=62; i>=0; i-=64){
+ __asm__ volatile(
+ "movdqa (%1), %%xmm0 \n\t"
+ "movdqa 16(%1), %%xmm2 \n\t"
+ "movdqa 32(%1), %%xmm4 \n\t"
+ "movdqa 48(%1), %%xmm6 \n\t"
+ "movdqa (%1), %%xmm1 \n\t"
+ "movdqa 16(%1), %%xmm3 \n\t"
+ "movdqa 32(%1), %%xmm5 \n\t"
+ "movdqa 48(%1), %%xmm7 \n\t"
+ "punpcklwd (%2), %%xmm0 \n\t"
+ "punpcklwd 16(%2), %%xmm2 \n\t"
+ "punpcklwd 32(%2), %%xmm4 \n\t"
+ "punpcklwd 48(%2), %%xmm6 \n\t"
+ "movdqa %%xmm0, (%0) \n\t"
+ "movdqa %%xmm2, 32(%0) \n\t"
+ "movdqa %%xmm4, 64(%0) \n\t"
+ "movdqa %%xmm6, 96(%0) \n\t"
+ "punpckhwd (%2), %%xmm1 \n\t"
+ "punpckhwd 16(%2), %%xmm3 \n\t"
+ "punpckhwd 32(%2), %%xmm5 \n\t"
+ "punpckhwd 48(%2), %%xmm7 \n\t"
+ "movdqa %%xmm1, 16(%0) \n\t"
+ "movdqa %%xmm3, 48(%0) \n\t"
+ "movdqa %%xmm5, 80(%0) \n\t"
+ "movdqa %%xmm7, 112(%0) \n\t"
+ :: "r"(&(b)[i]), "r"(&(b)[i>>1]), "r"(&(temp)[i>>1])
+ : "memory"
+ );
+ }
+ }
+}
+
+static void ff_snow_horizontal_compose97i_mmx(IDWTELEM *b, IDWTELEM *temp, int width){
+ const int w2= (width+1)>>1;
+ const int w_l= (width>>1);
+ const int w_r= w2 - 1;
+ int i;
+
+ { // Lift 0
+ IDWTELEM * const ref = b + w2 - 1;
+
+ i = 1;
+ b[0] = b[0] - ((W_DM * 2 * ref[1]+W_DO)>>W_DS);
+ __asm__ volatile(
+ "pcmpeqw %%mm7, %%mm7 \n\t"
+ "pcmpeqw %%mm3, %%mm3 \n\t"
+ "psllw $1, %%mm3 \n\t"
+ "paddw %%mm7, %%mm3 \n\t"
+ "psllw $13, %%mm3 \n\t"
+ ::);
+ for(; i<w_l-7; i+=8){
+ __asm__ volatile(
+ "movq (%1), %%mm2 \n\t"
+ "movq 8(%1), %%mm6 \n\t"
+ "paddw 2(%1), %%mm2 \n\t"
+ "paddw 10(%1), %%mm6 \n\t"
+ "paddw %%mm7, %%mm2 \n\t"
+ "paddw %%mm7, %%mm6 \n\t"
+ "pmulhw %%mm3, %%mm2 \n\t"
+ "pmulhw %%mm3, %%mm6 \n\t"
+ "paddw (%0), %%mm2 \n\t"
+ "paddw 8(%0), %%mm6 \n\t"
+ "movq %%mm2, (%0) \n\t"
+ "movq %%mm6, 8(%0) \n\t"
+ :: "r"(&b[i]), "r"(&ref[i])
+ : "memory"
+ );
+ }
+ snow_horizontal_compose_lift_lead_out(i, b, b, ref, width, w_l, 0, W_DM, W_DO, W_DS);
+ }
+
+ { // Lift 1
+ IDWTELEM * const dst = b+w2;
+
+ i = 0;
+ for(; i<w_r-7; i+=8){
+ __asm__ volatile(
+ "movq (%1), %%mm2 \n\t"
+ "movq 8(%1), %%mm6 \n\t"
+ "paddw 2(%1), %%mm2 \n\t"
+ "paddw 10(%1), %%mm6 \n\t"
+ "movq (%0), %%mm0 \n\t"
+ "movq 8(%0), %%mm4 \n\t"
+ "psubw %%mm2, %%mm0 \n\t"
+ "psubw %%mm6, %%mm4 \n\t"
+ "movq %%mm0, (%0) \n\t"
+ "movq %%mm4, 8(%0) \n\t"
+ :: "r"(&dst[i]), "r"(&b[i])
+ : "memory"
+ );
+ }
+ snow_horizontal_compose_lift_lead_out(i, dst, dst, b, width, w_r, 1, W_CM, W_CO, W_CS);
+ }
+
+ { // Lift 2
+ IDWTELEM * const ref = b+w2 - 1;
+
+ i = 1;
+ b[0] = b[0] + (((2 * ref[1] + W_BO) + 4 * b[0]) >> W_BS);
+ __asm__ volatile(
+ "psllw $15, %%mm7 \n\t"
+ "pcmpeqw %%mm6, %%mm6 \n\t"
+ "psrlw $13, %%mm6 \n\t"
+ "paddw %%mm7, %%mm6 \n\t"
+ ::);
+ for(; i<w_l-7; i+=8){
+ __asm__ volatile(
+ "movq (%1), %%mm0 \n\t"
+ "movq 8(%1), %%mm4 \n\t"
+ "movq 2(%1), %%mm1 \n\t"
+ "movq 10(%1), %%mm5 \n\t"
+ "paddw %%mm6, %%mm0 \n\t"
+ "paddw %%mm6, %%mm4 \n\t"
+ "paddw %%mm7, %%mm1 \n\t"
+ "paddw %%mm7, %%mm5 \n\t"
+ "pavgw %%mm1, %%mm0 \n\t"
+ "pavgw %%mm5, %%mm4 \n\t"
+ "psubw %%mm7, %%mm0 \n\t"
+ "psubw %%mm7, %%mm4 \n\t"
+ "psraw $1, %%mm0 \n\t"
+ "psraw $1, %%mm4 \n\t"
+ "movq (%0), %%mm1 \n\t"
+ "movq 8(%0), %%mm5 \n\t"
+ "paddw %%mm1, %%mm0 \n\t"
+ "paddw %%mm5, %%mm4 \n\t"
+ "psraw $2, %%mm0 \n\t"
+ "psraw $2, %%mm4 \n\t"
+ "paddw %%mm1, %%mm0 \n\t"
+ "paddw %%mm5, %%mm4 \n\t"
+ "movq %%mm0, (%0) \n\t"
+ "movq %%mm4, 8(%0) \n\t"
+ :: "r"(&b[i]), "r"(&ref[i])
+ : "memory"
+ );
+ }
+ snow_horizontal_compose_liftS_lead_out(i, b, b, ref, width, w_l);
+ }
+
+ { // Lift 3
+ IDWTELEM * const src = b+w2;
+ i = 0;
+
+ for(; i<w_r-7; i+=8){
+ __asm__ volatile(
+ "movq 2(%1), %%mm2 \n\t"
+ "movq 10(%1), %%mm6 \n\t"
+ "paddw (%1), %%mm2 \n\t"
+ "paddw 8(%1), %%mm6 \n\t"
+ "movq (%0), %%mm0 \n\t"
+ "movq 8(%0), %%mm4 \n\t"
+ "paddw %%mm2, %%mm0 \n\t"
+ "paddw %%mm6, %%mm4 \n\t"
+ "psraw $1, %%mm2 \n\t"
+ "psraw $1, %%mm6 \n\t"
+ "paddw %%mm0, %%mm2 \n\t"
+ "paddw %%mm4, %%mm6 \n\t"
+ "movq %%mm2, (%2) \n\t"
+ "movq %%mm6, 8(%2) \n\t"
+ :: "r"(&src[i]), "r"(&b[i]), "r"(&temp[i])
+ : "memory"
+ );
+ }
+ snow_horizontal_compose_lift_lead_out(i, temp, src, b, width, w_r, 1, -W_AM, W_AO+1, W_AS);
+ }
+
+ {
+ snow_interleave_line_header(&i, width, b, temp);
+
+ for (; (i & 0x1E) != 0x1E; i-=2){
+ b[i+1] = temp[i>>1];
+ b[i] = b[i>>1];
+ }
+ for (i-=30; i>=0; i-=32){
+ __asm__ volatile(
+ "movq (%1), %%mm0 \n\t"
+ "movq 8(%1), %%mm2 \n\t"
+ "movq 16(%1), %%mm4 \n\t"
+ "movq 24(%1), %%mm6 \n\t"
+ "movq (%1), %%mm1 \n\t"
+ "movq 8(%1), %%mm3 \n\t"
+ "movq 16(%1), %%mm5 \n\t"
+ "movq 24(%1), %%mm7 \n\t"
+ "punpcklwd (%2), %%mm0 \n\t"
+ "punpcklwd 8(%2), %%mm2 \n\t"
+ "punpcklwd 16(%2), %%mm4 \n\t"
+ "punpcklwd 24(%2), %%mm6 \n\t"
+ "movq %%mm0, (%0) \n\t"
+ "movq %%mm2, 16(%0) \n\t"
+ "movq %%mm4, 32(%0) \n\t"
+ "movq %%mm6, 48(%0) \n\t"
+ "punpckhwd (%2), %%mm1 \n\t"
+ "punpckhwd 8(%2), %%mm3 \n\t"
+ "punpckhwd 16(%2), %%mm5 \n\t"
+ "punpckhwd 24(%2), %%mm7 \n\t"
+ "movq %%mm1, 8(%0) \n\t"
+ "movq %%mm3, 24(%0) \n\t"
+ "movq %%mm5, 40(%0) \n\t"
+ "movq %%mm7, 56(%0) \n\t"
+ :: "r"(&b[i]), "r"(&b[i>>1]), "r"(&temp[i>>1])
+ : "memory"
+ );
+ }
+ }
+}
+
+#if HAVE_7REGS
+#define snow_vertical_compose_sse2_load_add(op,r,t0,t1,t2,t3)\
+ ""op" ("r",%%"REG_d"), %%"t0" \n\t"\
+ ""op" 16("r",%%"REG_d"), %%"t1" \n\t"\
+ ""op" 32("r",%%"REG_d"), %%"t2" \n\t"\
+ ""op" 48("r",%%"REG_d"), %%"t3" \n\t"
+
+#define snow_vertical_compose_sse2_load(r,t0,t1,t2,t3)\
+ snow_vertical_compose_sse2_load_add("movdqa",r,t0,t1,t2,t3)
+
+#define snow_vertical_compose_sse2_add(r,t0,t1,t2,t3)\
+ snow_vertical_compose_sse2_load_add("paddw",r,t0,t1,t2,t3)
+
+#define snow_vertical_compose_r2r_sub(s0,s1,s2,s3,t0,t1,t2,t3)\
+ "psubw %%"s0", %%"t0" \n\t"\
+ "psubw %%"s1", %%"t1" \n\t"\
+ "psubw %%"s2", %%"t2" \n\t"\
+ "psubw %%"s3", %%"t3" \n\t"
+
+#define snow_vertical_compose_sse2_store(w,s0,s1,s2,s3)\
+ "movdqa %%"s0", ("w",%%"REG_d") \n\t"\
+ "movdqa %%"s1", 16("w",%%"REG_d") \n\t"\
+ "movdqa %%"s2", 32("w",%%"REG_d") \n\t"\
+ "movdqa %%"s3", 48("w",%%"REG_d") \n\t"
+
+#define snow_vertical_compose_sra(n,t0,t1,t2,t3)\
+ "psraw $"n", %%"t0" \n\t"\
+ "psraw $"n", %%"t1" \n\t"\
+ "psraw $"n", %%"t2" \n\t"\
+ "psraw $"n", %%"t3" \n\t"
+
+#define snow_vertical_compose_r2r_add(s0,s1,s2,s3,t0,t1,t2,t3)\
+ "paddw %%"s0", %%"t0" \n\t"\
+ "paddw %%"s1", %%"t1" \n\t"\
+ "paddw %%"s2", %%"t2" \n\t"\
+ "paddw %%"s3", %%"t3" \n\t"
+
+#define snow_vertical_compose_r2r_pmulhw(s0,s1,s2,s3,t0,t1,t2,t3)\
+ "pmulhw %%"s0", %%"t0" \n\t"\
+ "pmulhw %%"s1", %%"t1" \n\t"\
+ "pmulhw %%"s2", %%"t2" \n\t"\
+ "pmulhw %%"s3", %%"t3" \n\t"
+
+#define snow_vertical_compose_sse2_move(s0,s1,s2,s3,t0,t1,t2,t3)\
+ "movdqa %%"s0", %%"t0" \n\t"\
+ "movdqa %%"s1", %%"t1" \n\t"\
+ "movdqa %%"s2", %%"t2" \n\t"\
+ "movdqa %%"s3", %%"t3" \n\t"
+
+static void ff_snow_vertical_compose97i_sse2(IDWTELEM *b0, IDWTELEM *b1, IDWTELEM *b2, IDWTELEM *b3, IDWTELEM *b4, IDWTELEM *b5, int width){
+ x86_reg i = width;
+
+ while(i & 0x1F)
+ {
+ i--;
+ b4[i] -= (W_DM*(b3[i] + b5[i])+W_DO)>>W_DS;
+ b3[i] -= (W_CM*(b2[i] + b4[i])+W_CO)>>W_CS;
+ b2[i] += (W_BM*(b1[i] + b3[i])+4*b2[i]+W_BO)>>W_BS;
+ b1[i] += (W_AM*(b0[i] + b2[i])+W_AO)>>W_AS;
+ }
+ i+=i;
+
+ __asm__ volatile (
+ "jmp 2f \n\t"
+ "1: \n\t"
+ snow_vertical_compose_sse2_load("%4","xmm0","xmm2","xmm4","xmm6")
+ snow_vertical_compose_sse2_add("%6","xmm0","xmm2","xmm4","xmm6")
+
+
+ "pcmpeqw %%xmm0, %%xmm0 \n\t"
+ "pcmpeqw %%xmm2, %%xmm2 \n\t"
+ "paddw %%xmm2, %%xmm2 \n\t"
+ "paddw %%xmm0, %%xmm2 \n\t"
+ "psllw $13, %%xmm2 \n\t"
+ snow_vertical_compose_r2r_add("xmm0","xmm0","xmm0","xmm0","xmm1","xmm3","xmm5","xmm7")
+ snow_vertical_compose_r2r_pmulhw("xmm2","xmm2","xmm2","xmm2","xmm1","xmm3","xmm5","xmm7")
+ snow_vertical_compose_sse2_add("%5","xmm1","xmm3","xmm5","xmm7")
+ snow_vertical_compose_sse2_store("%5","xmm1","xmm3","xmm5","xmm7")
+ snow_vertical_compose_sse2_load("%4","xmm0","xmm2","xmm4","xmm6")
+ snow_vertical_compose_sse2_add("%3","xmm1","xmm3","xmm5","xmm7")
+ snow_vertical_compose_r2r_sub("xmm1","xmm3","xmm5","xmm7","xmm0","xmm2","xmm4","xmm6")
+ snow_vertical_compose_sse2_store("%4","xmm0","xmm2","xmm4","xmm6")
+
+ "pcmpeqw %%xmm7, %%xmm7 \n\t"
+ "pcmpeqw %%xmm5, %%xmm5 \n\t"
+ "psllw $15, %%xmm7 \n\t"
+ "psrlw $13, %%xmm5 \n\t"
+ "paddw %%xmm7, %%xmm5 \n\t"
+ snow_vertical_compose_r2r_add("xmm5","xmm5","xmm5","xmm5","xmm0","xmm2","xmm4","xmm6")
+ "movq (%2,%%"REG_d"), %%xmm1 \n\t"
+ "movq 8(%2,%%"REG_d"), %%xmm3 \n\t"
+ "paddw %%xmm7, %%xmm1 \n\t"
+ "paddw %%xmm7, %%xmm3 \n\t"
+ "pavgw %%xmm1, %%xmm0 \n\t"
+ "pavgw %%xmm3, %%xmm2 \n\t"
+ "movq 16(%2,%%"REG_d"), %%xmm1 \n\t"
+ "movq 24(%2,%%"REG_d"), %%xmm3 \n\t"
+ "paddw %%xmm7, %%xmm1 \n\t"
+ "paddw %%xmm7, %%xmm3 \n\t"
+ "pavgw %%xmm1, %%xmm4 \n\t"
+ "pavgw %%xmm3, %%xmm6 \n\t"
+ snow_vertical_compose_r2r_sub("xmm7","xmm7","xmm7","xmm7","xmm0","xmm2","xmm4","xmm6")
+ snow_vertical_compose_sra("1","xmm0","xmm2","xmm4","xmm6")
+ snow_vertical_compose_sse2_add("%3","xmm0","xmm2","xmm4","xmm6")
+
+ snow_vertical_compose_sra("2","xmm0","xmm2","xmm4","xmm6")
+ snow_vertical_compose_sse2_add("%3","xmm0","xmm2","xmm4","xmm6")
+ snow_vertical_compose_sse2_store("%3","xmm0","xmm2","xmm4","xmm6")
+ snow_vertical_compose_sse2_add("%1","xmm0","xmm2","xmm4","xmm6")
+ snow_vertical_compose_sse2_move("xmm0","xmm2","xmm4","xmm6","xmm1","xmm3","xmm5","xmm7")
+ snow_vertical_compose_sra("1","xmm0","xmm2","xmm4","xmm6")
+ snow_vertical_compose_r2r_add("xmm1","xmm3","xmm5","xmm7","xmm0","xmm2","xmm4","xmm6")
+ snow_vertical_compose_sse2_add("%2","xmm0","xmm2","xmm4","xmm6")
+ snow_vertical_compose_sse2_store("%2","xmm0","xmm2","xmm4","xmm6")
+
+ "2: \n\t"
+ "sub $64, %%"REG_d" \n\t"
+ "jge 1b \n\t"
+ :"+d"(i)
+ :"r"(b0),"r"(b1),"r"(b2),"r"(b3),"r"(b4),"r"(b5));
+}
+
+#define snow_vertical_compose_mmx_load_add(op,r,t0,t1,t2,t3)\
+ ""op" ("r",%%"REG_d"), %%"t0" \n\t"\
+ ""op" 8("r",%%"REG_d"), %%"t1" \n\t"\
+ ""op" 16("r",%%"REG_d"), %%"t2" \n\t"\
+ ""op" 24("r",%%"REG_d"), %%"t3" \n\t"
+
+#define snow_vertical_compose_mmx_load(r,t0,t1,t2,t3)\
+ snow_vertical_compose_mmx_load_add("movq",r,t0,t1,t2,t3)
+
+#define snow_vertical_compose_mmx_add(r,t0,t1,t2,t3)\
+ snow_vertical_compose_mmx_load_add("paddw",r,t0,t1,t2,t3)
+
+#define snow_vertical_compose_mmx_store(w,s0,s1,s2,s3)\
+ "movq %%"s0", ("w",%%"REG_d") \n\t"\
+ "movq %%"s1", 8("w",%%"REG_d") \n\t"\
+ "movq %%"s2", 16("w",%%"REG_d") \n\t"\
+ "movq %%"s3", 24("w",%%"REG_d") \n\t"
+
+#define snow_vertical_compose_mmx_move(s0,s1,s2,s3,t0,t1,t2,t3)\
+ "movq %%"s0", %%"t0" \n\t"\
+ "movq %%"s1", %%"t1" \n\t"\
+ "movq %%"s2", %%"t2" \n\t"\
+ "movq %%"s3", %%"t3" \n\t"
+
+
+static void ff_snow_vertical_compose97i_mmx(IDWTELEM *b0, IDWTELEM *b1, IDWTELEM *b2, IDWTELEM *b3, IDWTELEM *b4, IDWTELEM *b5, int width){
+ x86_reg i = width;
+ while(i & 15)
+ {
+ i--;
+ b4[i] -= (W_DM*(b3[i] + b5[i])+W_DO)>>W_DS;
+ b3[i] -= (W_CM*(b2[i] + b4[i])+W_CO)>>W_CS;
+ b2[i] += (W_BM*(b1[i] + b3[i])+4*b2[i]+W_BO)>>W_BS;
+ b1[i] += (W_AM*(b0[i] + b2[i])+W_AO)>>W_AS;
+ }
+ i+=i;
+ __asm__ volatile(
+ "jmp 2f \n\t"
+ "1: \n\t"
+
+ snow_vertical_compose_mmx_load("%4","mm1","mm3","mm5","mm7")
+ snow_vertical_compose_mmx_add("%6","mm1","mm3","mm5","mm7")
+ "pcmpeqw %%mm0, %%mm0 \n\t"
+ "pcmpeqw %%mm2, %%mm2 \n\t"
+ "paddw %%mm2, %%mm2 \n\t"
+ "paddw %%mm0, %%mm2 \n\t"
+ "psllw $13, %%mm2 \n\t"
+ snow_vertical_compose_r2r_add("mm0","mm0","mm0","mm0","mm1","mm3","mm5","mm7")
+ snow_vertical_compose_r2r_pmulhw("mm2","mm2","mm2","mm2","mm1","mm3","mm5","mm7")
+ snow_vertical_compose_mmx_add("%5","mm1","mm3","mm5","mm7")
+ snow_vertical_compose_mmx_store("%5","mm1","mm3","mm5","mm7")
+ snow_vertical_compose_mmx_load("%4","mm0","mm2","mm4","mm6")
+ snow_vertical_compose_mmx_add("%3","mm1","mm3","mm5","mm7")
+ snow_vertical_compose_r2r_sub("mm1","mm3","mm5","mm7","mm0","mm2","mm4","mm6")
+ snow_vertical_compose_mmx_store("%4","mm0","mm2","mm4","mm6")
+ "pcmpeqw %%mm7, %%mm7 \n\t"
+ "pcmpeqw %%mm5, %%mm5 \n\t"
+ "psllw $15, %%mm7 \n\t"
+ "psrlw $13, %%mm5 \n\t"
+ "paddw %%mm7, %%mm5 \n\t"
+ snow_vertical_compose_r2r_add("mm5","mm5","mm5","mm5","mm0","mm2","mm4","mm6")
+ "movq (%2,%%"REG_d"), %%mm1 \n\t"
+ "movq 8(%2,%%"REG_d"), %%mm3 \n\t"
+ "paddw %%mm7, %%mm1 \n\t"
+ "paddw %%mm7, %%mm3 \n\t"
+ "pavgw %%mm1, %%mm0 \n\t"
+ "pavgw %%mm3, %%mm2 \n\t"
+ "movq 16(%2,%%"REG_d"), %%mm1 \n\t"
+ "movq 24(%2,%%"REG_d"), %%mm3 \n\t"
+ "paddw %%mm7, %%mm1 \n\t"
+ "paddw %%mm7, %%mm3 \n\t"
+ "pavgw %%mm1, %%mm4 \n\t"
+ "pavgw %%mm3, %%mm6 \n\t"
+ snow_vertical_compose_r2r_sub("mm7","mm7","mm7","mm7","mm0","mm2","mm4","mm6")
+ snow_vertical_compose_sra("1","mm0","mm2","mm4","mm6")
+ snow_vertical_compose_mmx_add("%3","mm0","mm2","mm4","mm6")
+
+ snow_vertical_compose_sra("2","mm0","mm2","mm4","mm6")
+ snow_vertical_compose_mmx_add("%3","mm0","mm2","mm4","mm6")
+ snow_vertical_compose_mmx_store("%3","mm0","mm2","mm4","mm6")
+ snow_vertical_compose_mmx_add("%1","mm0","mm2","mm4","mm6")
+ snow_vertical_compose_mmx_move("mm0","mm2","mm4","mm6","mm1","mm3","mm5","mm7")
+ snow_vertical_compose_sra("1","mm0","mm2","mm4","mm6")
+ snow_vertical_compose_r2r_add("mm1","mm3","mm5","mm7","mm0","mm2","mm4","mm6")
+ snow_vertical_compose_mmx_add("%2","mm0","mm2","mm4","mm6")
+ snow_vertical_compose_mmx_store("%2","mm0","mm2","mm4","mm6")
+
+ "2: \n\t"
+ "sub $32, %%"REG_d" \n\t"
+ "jge 1b \n\t"
+ :"+d"(i)
+ :"r"(b0),"r"(b1),"r"(b2),"r"(b3),"r"(b4),"r"(b5));
+}
+#endif //HAVE_7REGS
+
+#define snow_inner_add_yblock_sse2_header \
+ IDWTELEM * * dst_array = sb->line + src_y;\
+ x86_reg tmp;\
+ __asm__ volatile(\
+ "mov %7, %%"REG_c" \n\t"\
+ "mov %6, %2 \n\t"\
+ "mov %4, %%"REG_S" \n\t"\
+ "pxor %%xmm7, %%xmm7 \n\t" /* 0 */\
+ "pcmpeqd %%xmm3, %%xmm3 \n\t"\
+ "psllw $15, %%xmm3 \n\t"\
+ "psrlw $12, %%xmm3 \n\t" /* FRAC_BITS >> 1 */\
+ "1: \n\t"\
+ "mov %1, %%"REG_D" \n\t"\
+ "mov (%%"REG_D"), %%"REG_D" \n\t"\
+ "add %3, %%"REG_D" \n\t"
+
+#define snow_inner_add_yblock_sse2_start_8(out_reg1, out_reg2, ptr_offset, s_offset)\
+ "mov "PTR_SIZE"*"ptr_offset"(%%"REG_a"), %%"REG_d"; \n\t"\
+ "movq (%%"REG_d"), %%"out_reg1" \n\t"\
+ "movq (%%"REG_d", %%"REG_c"), %%"out_reg2" \n\t"\
+ "punpcklbw %%xmm7, %%"out_reg1" \n\t"\
+ "punpcklbw %%xmm7, %%"out_reg2" \n\t"\
+ "movq "s_offset"(%%"REG_S"), %%xmm0 \n\t"\
+ "movq "s_offset"+16(%%"REG_S"), %%xmm4 \n\t"\
+ "punpcklbw %%xmm7, %%xmm0 \n\t"\
+ "punpcklbw %%xmm7, %%xmm4 \n\t"\
+ "pmullw %%xmm0, %%"out_reg1" \n\t"\
+ "pmullw %%xmm4, %%"out_reg2" \n\t"
+
+#define snow_inner_add_yblock_sse2_start_16(out_reg1, out_reg2, ptr_offset, s_offset)\
+ "mov "PTR_SIZE"*"ptr_offset"(%%"REG_a"), %%"REG_d"; \n\t"\
+ "movq (%%"REG_d"), %%"out_reg1" \n\t"\
+ "movq 8(%%"REG_d"), %%"out_reg2" \n\t"\
+ "punpcklbw %%xmm7, %%"out_reg1" \n\t"\
+ "punpcklbw %%xmm7, %%"out_reg2" \n\t"\
+ "movq "s_offset"(%%"REG_S"), %%xmm0 \n\t"\
+ "movq "s_offset"+8(%%"REG_S"), %%xmm4 \n\t"\
+ "punpcklbw %%xmm7, %%xmm0 \n\t"\
+ "punpcklbw %%xmm7, %%xmm4 \n\t"\
+ "pmullw %%xmm0, %%"out_reg1" \n\t"\
+ "pmullw %%xmm4, %%"out_reg2" \n\t"
+
+#define snow_inner_add_yblock_sse2_accum_8(ptr_offset, s_offset) \
+ snow_inner_add_yblock_sse2_start_8("xmm2", "xmm6", ptr_offset, s_offset)\
+ "paddusw %%xmm2, %%xmm1 \n\t"\
+ "paddusw %%xmm6, %%xmm5 \n\t"
+
+#define snow_inner_add_yblock_sse2_accum_16(ptr_offset, s_offset) \
+ snow_inner_add_yblock_sse2_start_16("xmm2", "xmm6", ptr_offset, s_offset)\
+ "paddusw %%xmm2, %%xmm1 \n\t"\
+ "paddusw %%xmm6, %%xmm5 \n\t"
+
+#define snow_inner_add_yblock_sse2_end_common1\
+ "add $32, %%"REG_S" \n\t"\
+ "add %%"REG_c", %0 \n\t"\
+ "add %%"REG_c", "PTR_SIZE"*3(%%"REG_a");\n\t"\
+ "add %%"REG_c", "PTR_SIZE"*2(%%"REG_a");\n\t"\
+ "add %%"REG_c", "PTR_SIZE"*1(%%"REG_a");\n\t"\
+ "add %%"REG_c", (%%"REG_a") \n\t"
+
+#define snow_inner_add_yblock_sse2_end_common2\
+ "jnz 1b \n\t"\
+ :"+m"(dst8),"+m"(dst_array),"=&r"(tmp)\
+ :\
+ "rm"((x86_reg)(src_x<<1)),"m"(obmc),"a"(block),"m"(b_h),"m"(src_stride):\
+ "%"REG_c"","%"REG_S"","%"REG_D"","%"REG_d"");
+
+#define snow_inner_add_yblock_sse2_end_8\
+ "sal $1, %%"REG_c" \n\t"\
+ "addl $"PTR_SIZE"*2, %1 \n\t"\
+ snow_inner_add_yblock_sse2_end_common1\
+ "sar $1, %%"REG_c" \n\t"\
+ "sub $2, %2 \n\t"\
+ snow_inner_add_yblock_sse2_end_common2
+
+#define snow_inner_add_yblock_sse2_end_16\
+ "addl $"PTR_SIZE"*1, %1 \n\t"\
+ snow_inner_add_yblock_sse2_end_common1\
+ "dec %2 \n\t"\
+ snow_inner_add_yblock_sse2_end_common2
+
+static void inner_add_yblock_bw_8_obmc_16_bh_even_sse2(const uint8_t *obmc, const x86_reg obmc_stride, uint8_t * * block, int b_w, x86_reg b_h,
+ int src_x, int src_y, x86_reg src_stride, slice_buffer * sb, int add, uint8_t * dst8){
+snow_inner_add_yblock_sse2_header
+snow_inner_add_yblock_sse2_start_8("xmm1", "xmm5", "3", "0")
+snow_inner_add_yblock_sse2_accum_8("2", "8")
+snow_inner_add_yblock_sse2_accum_8("1", "128")
+snow_inner_add_yblock_sse2_accum_8("0", "136")
+
+ "mov %0, %%"REG_d" \n\t"
+ "movdqa (%%"REG_D"), %%xmm0 \n\t"
+ "movdqa %%xmm1, %%xmm2 \n\t"
+
+ "punpckhwd %%xmm7, %%xmm1 \n\t"
+ "punpcklwd %%xmm7, %%xmm2 \n\t"
+ "paddd %%xmm2, %%xmm0 \n\t"
+ "movdqa 16(%%"REG_D"), %%xmm2 \n\t"
+ "paddd %%xmm1, %%xmm2 \n\t"
+ "paddd %%xmm3, %%xmm0 \n\t"
+ "paddd %%xmm3, %%xmm2 \n\t"
+
+ "mov %1, %%"REG_D" \n\t"
+ "mov "PTR_SIZE"(%%"REG_D"), %%"REG_D";\n\t"
+ "add %3, %%"REG_D" \n\t"
+
+ "movdqa (%%"REG_D"), %%xmm4 \n\t"
+ "movdqa %%xmm5, %%xmm6 \n\t"
+ "punpckhwd %%xmm7, %%xmm5 \n\t"
+ "punpcklwd %%xmm7, %%xmm6 \n\t"
+ "paddd %%xmm6, %%xmm4 \n\t"
+ "movdqa 16(%%"REG_D"), %%xmm6 \n\t"
+ "paddd %%xmm5, %%xmm6 \n\t"
+ "paddd %%xmm3, %%xmm4 \n\t"
+ "paddd %%xmm3, %%xmm6 \n\t"
+
+ "psrad $8, %%xmm0 \n\t" /* FRAC_BITS. */
+ "psrad $8, %%xmm2 \n\t" /* FRAC_BITS. */
+ "packssdw %%xmm2, %%xmm0 \n\t"
+ "packuswb %%xmm7, %%xmm0 \n\t"
+ "movq %%xmm0, (%%"REG_d") \n\t"
+
+ "psrad $8, %%xmm4 \n\t" /* FRAC_BITS. */
+ "psrad $8, %%xmm6 \n\t" /* FRAC_BITS. */
+ "packssdw %%xmm6, %%xmm4 \n\t"
+ "packuswb %%xmm7, %%xmm4 \n\t"
+ "movq %%xmm4, (%%"REG_d",%%"REG_c");\n\t"
+snow_inner_add_yblock_sse2_end_8
+}
+
+static void inner_add_yblock_bw_16_obmc_32_sse2(const uint8_t *obmc, const x86_reg obmc_stride, uint8_t * * block, int b_w, x86_reg b_h,
+ int src_x, int src_y, x86_reg src_stride, slice_buffer * sb, int add, uint8_t * dst8){
+snow_inner_add_yblock_sse2_header
+snow_inner_add_yblock_sse2_start_16("xmm1", "xmm5", "3", "0")
+snow_inner_add_yblock_sse2_accum_16("2", "16")
+snow_inner_add_yblock_sse2_accum_16("1", "512")
+snow_inner_add_yblock_sse2_accum_16("0", "528")
+
+ "mov %0, %%"REG_d" \n\t"
+ "psrlw $4, %%xmm1 \n\t"
+ "psrlw $4, %%xmm5 \n\t"
+ "paddw (%%"REG_D"), %%xmm1 \n\t"
+ "paddw 16(%%"REG_D"), %%xmm5 \n\t"
+ "paddw %%xmm3, %%xmm1 \n\t"
+ "paddw %%xmm3, %%xmm5 \n\t"
+ "psraw $4, %%xmm1 \n\t" /* FRAC_BITS. */
+ "psraw $4, %%xmm5 \n\t" /* FRAC_BITS. */
+ "packuswb %%xmm5, %%xmm1 \n\t"
+
+ "movdqu %%xmm1, (%%"REG_d") \n\t"
+
+snow_inner_add_yblock_sse2_end_16
+}
+
+#define snow_inner_add_yblock_mmx_header \
+ IDWTELEM * * dst_array = sb->line + src_y;\
+ x86_reg tmp;\
+ __asm__ volatile(\
+ "mov %7, %%"REG_c" \n\t"\
+ "mov %6, %2 \n\t"\
+ "mov %4, %%"REG_S" \n\t"\
+ "pxor %%mm7, %%mm7 \n\t" /* 0 */\
+ "pcmpeqd %%mm3, %%mm3 \n\t"\
+ "psllw $15, %%mm3 \n\t"\
+ "psrlw $12, %%mm3 \n\t" /* FRAC_BITS >> 1 */\
+ "1: \n\t"\
+ "mov %1, %%"REG_D" \n\t"\
+ "mov (%%"REG_D"), %%"REG_D" \n\t"\
+ "add %3, %%"REG_D" \n\t"
+
+#define snow_inner_add_yblock_mmx_start(out_reg1, out_reg2, ptr_offset, s_offset, d_offset)\
+ "mov "PTR_SIZE"*"ptr_offset"(%%"REG_a"), %%"REG_d"; \n\t"\
+ "movd "d_offset"(%%"REG_d"), %%"out_reg1" \n\t"\
+ "movd "d_offset"+4(%%"REG_d"), %%"out_reg2" \n\t"\
+ "punpcklbw %%mm7, %%"out_reg1" \n\t"\
+ "punpcklbw %%mm7, %%"out_reg2" \n\t"\
+ "movd "s_offset"(%%"REG_S"), %%mm0 \n\t"\
+ "movd "s_offset"+4(%%"REG_S"), %%mm4 \n\t"\
+ "punpcklbw %%mm7, %%mm0 \n\t"\
+ "punpcklbw %%mm7, %%mm4 \n\t"\
+ "pmullw %%mm0, %%"out_reg1" \n\t"\
+ "pmullw %%mm4, %%"out_reg2" \n\t"
+
+#define snow_inner_add_yblock_mmx_accum(ptr_offset, s_offset, d_offset) \
+ snow_inner_add_yblock_mmx_start("mm2", "mm6", ptr_offset, s_offset, d_offset)\
+ "paddusw %%mm2, %%mm1 \n\t"\
+ "paddusw %%mm6, %%mm5 \n\t"
+
+#define snow_inner_add_yblock_mmx_mix(read_offset, write_offset)\
+ "mov %0, %%"REG_d" \n\t"\
+ "psrlw $4, %%mm1 \n\t"\
+ "psrlw $4, %%mm5 \n\t"\
+ "paddw "read_offset"(%%"REG_D"), %%mm1 \n\t"\
+ "paddw "read_offset"+8(%%"REG_D"), %%mm5 \n\t"\
+ "paddw %%mm3, %%mm1 \n\t"\
+ "paddw %%mm3, %%mm5 \n\t"\
+ "psraw $4, %%mm1 \n\t"\
+ "psraw $4, %%mm5 \n\t"\
+ "packuswb %%mm5, %%mm1 \n\t"\
+ "movq %%mm1, "write_offset"(%%"REG_d") \n\t"
+
+#define snow_inner_add_yblock_mmx_end(s_step)\
+ "add $"s_step", %%"REG_S" \n\t"\
+ "add %%"REG_c", "PTR_SIZE"*3(%%"REG_a");\n\t"\
+ "add %%"REG_c", "PTR_SIZE"*2(%%"REG_a");\n\t"\
+ "add %%"REG_c", "PTR_SIZE"*1(%%"REG_a");\n\t"\
+ "add %%"REG_c", (%%"REG_a") \n\t"\
+ "add"OPSIZE " $"PTR_SIZE"*1, %1 \n\t"\
+ "add %%"REG_c", %0 \n\t"\
+ "dec %2 \n\t"\
+ "jnz 1b \n\t"\
+ :"+m"(dst8),"+m"(dst_array),"=&r"(tmp)\
+ :\
+ "rm"((x86_reg)(src_x<<1)),"m"(obmc),"a"(block),"m"(b_h),"m"(src_stride):\
+ "%"REG_c"","%"REG_S"","%"REG_D"","%"REG_d"");
+
+static void inner_add_yblock_bw_8_obmc_16_mmx(const uint8_t *obmc, const x86_reg obmc_stride, uint8_t * * block, int b_w, x86_reg b_h,
+ int src_x, int src_y, x86_reg src_stride, slice_buffer * sb, int add, uint8_t * dst8){
+snow_inner_add_yblock_mmx_header
+snow_inner_add_yblock_mmx_start("mm1", "mm5", "3", "0", "0")
+snow_inner_add_yblock_mmx_accum("2", "8", "0")
+snow_inner_add_yblock_mmx_accum("1", "128", "0")
+snow_inner_add_yblock_mmx_accum("0", "136", "0")
+snow_inner_add_yblock_mmx_mix("0", "0")
+snow_inner_add_yblock_mmx_end("16")
+}
+
+static void inner_add_yblock_bw_16_obmc_32_mmx(const uint8_t *obmc, const x86_reg obmc_stride, uint8_t * * block, int b_w, x86_reg b_h,
+ int src_x, int src_y, x86_reg src_stride, slice_buffer * sb, int add, uint8_t * dst8){
+snow_inner_add_yblock_mmx_header
+snow_inner_add_yblock_mmx_start("mm1", "mm5", "3", "0", "0")
+snow_inner_add_yblock_mmx_accum("2", "16", "0")
+snow_inner_add_yblock_mmx_accum("1", "512", "0")
+snow_inner_add_yblock_mmx_accum("0", "528", "0")
+snow_inner_add_yblock_mmx_mix("0", "0")
+
+snow_inner_add_yblock_mmx_start("mm1", "mm5", "3", "8", "8")
+snow_inner_add_yblock_mmx_accum("2", "24", "8")
+snow_inner_add_yblock_mmx_accum("1", "520", "8")
+snow_inner_add_yblock_mmx_accum("0", "536", "8")
+snow_inner_add_yblock_mmx_mix("16", "8")
+snow_inner_add_yblock_mmx_end("32")
+}
+
+static void ff_snow_inner_add_yblock_sse2(const uint8_t *obmc, const int obmc_stride, uint8_t * * block, int b_w, int b_h,
+ int src_x, int src_y, int src_stride, slice_buffer * sb, int add, uint8_t * dst8){
+
+ if (b_w == 16)
+ inner_add_yblock_bw_16_obmc_32_sse2(obmc, obmc_stride, block, b_w, b_h, src_x,src_y, src_stride, sb, add, dst8);
+ else if (b_w == 8 && obmc_stride == 16) {
+ if (!(b_h & 1))
+ inner_add_yblock_bw_8_obmc_16_bh_even_sse2(obmc, obmc_stride, block, b_w, b_h, src_x,src_y, src_stride, sb, add, dst8);
+ else
+ inner_add_yblock_bw_8_obmc_16_mmx(obmc, obmc_stride, block, b_w, b_h, src_x,src_y, src_stride, sb, add, dst8);
+ } else
+ ff_snow_inner_add_yblock(obmc, obmc_stride, block, b_w, b_h, src_x,src_y, src_stride, sb, add, dst8);
+}
+
+static void ff_snow_inner_add_yblock_mmx(const uint8_t *obmc, const int obmc_stride, uint8_t * * block, int b_w, int b_h,
+ int src_x, int src_y, int src_stride, slice_buffer * sb, int add, uint8_t * dst8){
+ if (b_w == 16)
+ inner_add_yblock_bw_16_obmc_32_mmx(obmc, obmc_stride, block, b_w, b_h, src_x,src_y, src_stride, sb, add, dst8);
+ else if (b_w == 8 && obmc_stride == 16)
+ inner_add_yblock_bw_8_obmc_16_mmx(obmc, obmc_stride, block, b_w, b_h, src_x,src_y, src_stride, sb, add, dst8);
+ else
+ ff_snow_inner_add_yblock(obmc, obmc_stride, block, b_w, b_h, src_x,src_y, src_stride, sb, add, dst8);
+}
+
+#endif /* HAVE_INLINE_ASM */
+
+void ff_dwt_init_x86(DWTContext *c)
+{
+#if HAVE_INLINE_ASM
+ int mm_flags = av_get_cpu_flags();
+
+ if (mm_flags & AV_CPU_FLAG_MMX) {
+ if(mm_flags & AV_CPU_FLAG_SSE2 & 0){
+ c->horizontal_compose97i = ff_snow_horizontal_compose97i_sse2;
+#if HAVE_7REGS
+ c->vertical_compose97i = ff_snow_vertical_compose97i_sse2;
+#endif
+ c->inner_add_yblock = ff_snow_inner_add_yblock_sse2;
+ }
+ else{
+ if (mm_flags & AV_CPU_FLAG_MMXEXT) {
+ c->horizontal_compose97i = ff_snow_horizontal_compose97i_mmx;
+#if HAVE_7REGS
+ c->vertical_compose97i = ff_snow_vertical_compose97i_mmx;
+#endif
+ }
+ c->inner_add_yblock = ff_snow_inner_add_yblock_mmx;
+ }
+ }
+#endif /* HAVE_INLINE_ASM */
+}
diff --git a/gst-libs/ext/libav/libavcodec/x86/snowdsp_mmx.c b/gst-libs/ext/libav/libavcodec/x86/snowdsp_mmx.c
deleted file mode 100644
index 3e6bc99..0000000
--- a/gst-libs/ext/libav/libavcodec/x86/snowdsp_mmx.c
+++ /dev/null
@@ -1,898 +0,0 @@
-/*
- * MMX and SSE2 optimized snow DSP utils
- * Copyright (c) 2005-2006 Robert Edele <yartrebo@earthlink.net>
- *
- * 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
- */
-
-#include "libavutil/cpu.h"
-#include "libavutil/x86_cpu.h"
-#include "libavcodec/avcodec.h"
-#include "libavcodec/snow.h"
-#include "libavcodec/dwt.h"
-#include "dsputil_mmx.h"
-
-static void ff_snow_horizontal_compose97i_sse2(IDWTELEM *b, int width){
- const int w2= (width+1)>>1;
- DECLARE_ALIGNED(16, IDWTELEM, temp)[width>>1];
- const int w_l= (width>>1);
- const int w_r= w2 - 1;
- int i;
-
- { // Lift 0
- IDWTELEM * const ref = b + w2 - 1;
- IDWTELEM b_0 = b[0]; //By allowing the first entry in b[0] to be calculated twice
- // (the first time erroneously), we allow the SSE2 code to run an extra pass.
- // The savings in code and time are well worth having to store this value and
- // calculate b[0] correctly afterwards.
-
- i = 0;
- __asm__ volatile(
- "pcmpeqd %%xmm7, %%xmm7 \n\t"
- "pcmpeqd %%xmm3, %%xmm3 \n\t"
- "psllw $1, %%xmm3 \n\t"
- "paddw %%xmm7, %%xmm3 \n\t"
- "psllw $13, %%xmm3 \n\t"
- ::);
- for(; i<w_l-15; i+=16){
- __asm__ volatile(
- "movdqu (%1), %%xmm1 \n\t"
- "movdqu 16(%1), %%xmm5 \n\t"
- "movdqu 2(%1), %%xmm2 \n\t"
- "movdqu 18(%1), %%xmm6 \n\t"
- "paddw %%xmm1, %%xmm2 \n\t"
- "paddw %%xmm5, %%xmm6 \n\t"
- "paddw %%xmm7, %%xmm2 \n\t"
- "paddw %%xmm7, %%xmm6 \n\t"
- "pmulhw %%xmm3, %%xmm2 \n\t"
- "pmulhw %%xmm3, %%xmm6 \n\t"
- "paddw (%0), %%xmm2 \n\t"
- "paddw 16(%0), %%xmm6 \n\t"
- "movdqa %%xmm2, (%0) \n\t"
- "movdqa %%xmm6, 16(%0) \n\t"
- :: "r"(&b[i]), "r"(&ref[i])
- : "memory"
- );
- }
- snow_horizontal_compose_lift_lead_out(i, b, b, ref, width, w_l, 0, W_DM, W_DO, W_DS);
- b[0] = b_0 - ((W_DM * 2 * ref[1]+W_DO)>>W_DS);
- }
-
- { // Lift 1
- IDWTELEM * const dst = b+w2;
-
- i = 0;
- for(; (((x86_reg)&dst[i]) & 0x1F) && i<w_r; i++){
- dst[i] = dst[i] - (b[i] + b[i + 1]);
- }
- for(; i<w_r-15; i+=16){
- __asm__ volatile(
- "movdqu (%1), %%xmm1 \n\t"
- "movdqu 16(%1), %%xmm5 \n\t"
- "movdqu 2(%1), %%xmm2 \n\t"
- "movdqu 18(%1), %%xmm6 \n\t"
- "paddw %%xmm1, %%xmm2 \n\t"
- "paddw %%xmm5, %%xmm6 \n\t"
- "movdqa (%0), %%xmm0 \n\t"
- "movdqa 16(%0), %%xmm4 \n\t"
- "psubw %%xmm2, %%xmm0 \n\t"
- "psubw %%xmm6, %%xmm4 \n\t"
- "movdqa %%xmm0, (%0) \n\t"
- "movdqa %%xmm4, 16(%0) \n\t"
- :: "r"(&dst[i]), "r"(&b[i])
- : "memory"
- );
- }
- snow_horizontal_compose_lift_lead_out(i, dst, dst, b, width, w_r, 1, W_CM, W_CO, W_CS);
- }
-
- { // Lift 2
- IDWTELEM * const ref = b+w2 - 1;
- IDWTELEM b_0 = b[0];
-
- i = 0;
- __asm__ volatile(
- "psllw $15, %%xmm7 \n\t"
- "pcmpeqw %%xmm6, %%xmm6 \n\t"
- "psrlw $13, %%xmm6 \n\t"
- "paddw %%xmm7, %%xmm6 \n\t"
- ::);
- for(; i<w_l-15; i+=16){
- __asm__ volatile(
- "movdqu (%1), %%xmm0 \n\t"
- "movdqu 16(%1), %%xmm4 \n\t"
- "movdqu 2(%1), %%xmm1 \n\t"
- "movdqu 18(%1), %%xmm5 \n\t" //FIXME try aligned reads and shifts
- "paddw %%xmm6, %%xmm0 \n\t"
- "paddw %%xmm6, %%xmm4 \n\t"
- "paddw %%xmm7, %%xmm1 \n\t"
- "paddw %%xmm7, %%xmm5 \n\t"
- "pavgw %%xmm1, %%xmm0 \n\t"
- "pavgw %%xmm5, %%xmm4 \n\t"
- "psubw %%xmm7, %%xmm0 \n\t"
- "psubw %%xmm7, %%xmm4 \n\t"
- "psraw $1, %%xmm0 \n\t"
- "psraw $1, %%xmm4 \n\t"
- "movdqa (%0), %%xmm1 \n\t"
- "movdqa 16(%0), %%xmm5 \n\t"
- "paddw %%xmm1, %%xmm0 \n\t"
- "paddw %%xmm5, %%xmm4 \n\t"
- "psraw $2, %%xmm0 \n\t"
- "psraw $2, %%xmm4 \n\t"
- "paddw %%xmm1, %%xmm0 \n\t"
- "paddw %%xmm5, %%xmm4 \n\t"
- "movdqa %%xmm0, (%0) \n\t"
- "movdqa %%xmm4, 16(%0) \n\t"
- :: "r"(&b[i]), "r"(&ref[i])
- : "memory"
- );
- }
- snow_horizontal_compose_liftS_lead_out(i, b, b, ref, width, w_l);
- b[0] = b_0 + ((2 * ref[1] + W_BO-1 + 4 * b_0) >> W_BS);
- }
-
- { // Lift 3
- IDWTELEM * const src = b+w2;
-
- i = 0;
- for(; (((x86_reg)&temp[i]) & 0x1F) && i<w_r; i++){
- temp[i] = src[i] - ((-W_AM*(b[i] + b[i+1]))>>W_AS);
- }
- for(; i<w_r-7; i+=8){
- __asm__ volatile(
- "movdqu 2(%1), %%xmm2 \n\t"
- "movdqu 18(%1), %%xmm6 \n\t"
- "paddw (%1), %%xmm2 \n\t"
- "paddw 16(%1), %%xmm6 \n\t"
- "movdqu (%0), %%xmm0 \n\t"
- "movdqu 16(%0), %%xmm4 \n\t"
- "paddw %%xmm2, %%xmm0 \n\t"
- "paddw %%xmm6, %%xmm4 \n\t"
- "psraw $1, %%xmm2 \n\t"
- "psraw $1, %%xmm6 \n\t"
- "paddw %%xmm0, %%xmm2 \n\t"
- "paddw %%xmm4, %%xmm6 \n\t"
- "movdqa %%xmm2, (%2) \n\t"
- "movdqa %%xmm6, 16(%2) \n\t"
- :: "r"(&src[i]), "r"(&b[i]), "r"(&temp[i])
- : "memory"
- );
- }
- snow_horizontal_compose_lift_lead_out(i, temp, src, b, width, w_r, 1, -W_AM, W_AO+1, W_AS);
- }
-
- {
- snow_interleave_line_header(&i, width, b, temp);
-
- for (; (i & 0x3E) != 0x3E; i-=2){
- b[i+1] = temp[i>>1];
- b[i] = b[i>>1];
- }
- for (i-=62; i>=0; i-=64){
- __asm__ volatile(
- "movdqa (%1), %%xmm0 \n\t"
- "movdqa 16(%1), %%xmm2 \n\t"
- "movdqa 32(%1), %%xmm4 \n\t"
- "movdqa 48(%1), %%xmm6 \n\t"
- "movdqa (%1), %%xmm1 \n\t"
- "movdqa 16(%1), %%xmm3 \n\t"
- "movdqa 32(%1), %%xmm5 \n\t"
- "movdqa 48(%1), %%xmm7 \n\t"
- "punpcklwd (%2), %%xmm0 \n\t"
- "punpcklwd 16(%2), %%xmm2 \n\t"
- "punpcklwd 32(%2), %%xmm4 \n\t"
- "punpcklwd 48(%2), %%xmm6 \n\t"
- "movdqa %%xmm0, (%0) \n\t"
- "movdqa %%xmm2, 32(%0) \n\t"
- "movdqa %%xmm4, 64(%0) \n\t"
- "movdqa %%xmm6, 96(%0) \n\t"
- "punpckhwd (%2), %%xmm1 \n\t"
- "punpckhwd 16(%2), %%xmm3 \n\t"
- "punpckhwd 32(%2), %%xmm5 \n\t"
- "punpckhwd 48(%2), %%xmm7 \n\t"
- "movdqa %%xmm1, 16(%0) \n\t"
- "movdqa %%xmm3, 48(%0) \n\t"
- "movdqa %%xmm5, 80(%0) \n\t"
- "movdqa %%xmm7, 112(%0) \n\t"
- :: "r"(&(b)[i]), "r"(&(b)[i>>1]), "r"(&(temp)[i>>1])
- : "memory"
- );
- }
- }
-}
-
-static void ff_snow_horizontal_compose97i_mmx(IDWTELEM *b, int width){
- const int w2= (width+1)>>1;
- IDWTELEM temp[width >> 1];
- const int w_l= (width>>1);
- const int w_r= w2 - 1;
- int i;
-
- { // Lift 0
- IDWTELEM * const ref = b + w2 - 1;
-
- i = 1;
- b[0] = b[0] - ((W_DM * 2 * ref[1]+W_DO)>>W_DS);
- __asm__ volatile(
- "pcmpeqw %%mm7, %%mm7 \n\t"
- "pcmpeqw %%mm3, %%mm3 \n\t"
- "psllw $1, %%mm3 \n\t"
- "paddw %%mm7, %%mm3 \n\t"
- "psllw $13, %%mm3 \n\t"
- ::);
- for(; i<w_l-7; i+=8){
- __asm__ volatile(
- "movq (%1), %%mm2 \n\t"
- "movq 8(%1), %%mm6 \n\t"
- "paddw 2(%1), %%mm2 \n\t"
- "paddw 10(%1), %%mm6 \n\t"
- "paddw %%mm7, %%mm2 \n\t"
- "paddw %%mm7, %%mm6 \n\t"
- "pmulhw %%mm3, %%mm2 \n\t"
- "pmulhw %%mm3, %%mm6 \n\t"
- "paddw (%0), %%mm2 \n\t"
- "paddw 8(%0), %%mm6 \n\t"
- "movq %%mm2, (%0) \n\t"
- "movq %%mm6, 8(%0) \n\t"
- :: "r"(&b[i]), "r"(&ref[i])
- : "memory"
- );
- }
- snow_horizontal_compose_lift_lead_out(i, b, b, ref, width, w_l, 0, W_DM, W_DO, W_DS);
- }
-
- { // Lift 1
- IDWTELEM * const dst = b+w2;
-
- i = 0;
- for(; i<w_r-7; i+=8){
- __asm__ volatile(
- "movq (%1), %%mm2 \n\t"
- "movq 8(%1), %%mm6 \n\t"
- "paddw 2(%1), %%mm2 \n\t"
- "paddw 10(%1), %%mm6 \n\t"
- "movq (%0), %%mm0 \n\t"
- "movq 8(%0), %%mm4 \n\t"
- "psubw %%mm2, %%mm0 \n\t"
- "psubw %%mm6, %%mm4 \n\t"
- "movq %%mm0, (%0) \n\t"
- "movq %%mm4, 8(%0) \n\t"
- :: "r"(&dst[i]), "r"(&b[i])
- : "memory"
- );
- }
- snow_horizontal_compose_lift_lead_out(i, dst, dst, b, width, w_r, 1, W_CM, W_CO, W_CS);
- }
-
- { // Lift 2
- IDWTELEM * const ref = b+w2 - 1;
-
- i = 1;
- b[0] = b[0] + (((2 * ref[1] + W_BO) + 4 * b[0]) >> W_BS);
- __asm__ volatile(
- "psllw $15, %%mm7 \n\t"
- "pcmpeqw %%mm6, %%mm6 \n\t"
- "psrlw $13, %%mm6 \n\t"
- "paddw %%mm7, %%mm6 \n\t"
- ::);
- for(; i<w_l-7; i+=8){
- __asm__ volatile(
- "movq (%1), %%mm0 \n\t"
- "movq 8(%1), %%mm4 \n\t"
- "movq 2(%1), %%mm1 \n\t"
- "movq 10(%1), %%mm5 \n\t"
- "paddw %%mm6, %%mm0 \n\t"
- "paddw %%mm6, %%mm4 \n\t"
- "paddw %%mm7, %%mm1 \n\t"
- "paddw %%mm7, %%mm5 \n\t"
- "pavgw %%mm1, %%mm0 \n\t"
- "pavgw %%mm5, %%mm4 \n\t"
- "psubw %%mm7, %%mm0 \n\t"
- "psubw %%mm7, %%mm4 \n\t"
- "psraw $1, %%mm0 \n\t"
- "psraw $1, %%mm4 \n\t"
- "movq (%0), %%mm1 \n\t"
- "movq 8(%0), %%mm5 \n\t"
- "paddw %%mm1, %%mm0 \n\t"
- "paddw %%mm5, %%mm4 \n\t"
- "psraw $2, %%mm0 \n\t"
- "psraw $2, %%mm4 \n\t"
- "paddw %%mm1, %%mm0 \n\t"
- "paddw %%mm5, %%mm4 \n\t"
- "movq %%mm0, (%0) \n\t"
- "movq %%mm4, 8(%0) \n\t"
- :: "r"(&b[i]), "r"(&ref[i])
- : "memory"
- );
- }
- snow_horizontal_compose_liftS_lead_out(i, b, b, ref, width, w_l);
- }
-
- { // Lift 3
- IDWTELEM * const src = b+w2;
- i = 0;
-
- for(; i<w_r-7; i+=8){
- __asm__ volatile(
- "movq 2(%1), %%mm2 \n\t"
- "movq 10(%1), %%mm6 \n\t"
- "paddw (%1), %%mm2 \n\t"
- "paddw 8(%1), %%mm6 \n\t"
- "movq (%0), %%mm0 \n\t"
- "movq 8(%0), %%mm4 \n\t"
- "paddw %%mm2, %%mm0 \n\t"
- "paddw %%mm6, %%mm4 \n\t"
- "psraw $1, %%mm2 \n\t"
- "psraw $1, %%mm6 \n\t"
- "paddw %%mm0, %%mm2 \n\t"
- "paddw %%mm4, %%mm6 \n\t"
- "movq %%mm2, (%2) \n\t"
- "movq %%mm6, 8(%2) \n\t"
- :: "r"(&src[i]), "r"(&b[i]), "r"(&temp[i])
- : "memory"
- );
- }
- snow_horizontal_compose_lift_lead_out(i, temp, src, b, width, w_r, 1, -W_AM, W_AO+1, W_AS);
- }
-
- {
- snow_interleave_line_header(&i, width, b, temp);
-
- for (; (i & 0x1E) != 0x1E; i-=2){
- b[i+1] = temp[i>>1];
- b[i] = b[i>>1];
- }
- for (i-=30; i>=0; i-=32){
- __asm__ volatile(
- "movq (%1), %%mm0 \n\t"
- "movq 8(%1), %%mm2 \n\t"
- "movq 16(%1), %%mm4 \n\t"
- "movq 24(%1), %%mm6 \n\t"
- "movq (%1), %%mm1 \n\t"
- "movq 8(%1), %%mm3 \n\t"
- "movq 16(%1), %%mm5 \n\t"
- "movq 24(%1), %%mm7 \n\t"
- "punpcklwd (%2), %%mm0 \n\t"
- "punpcklwd 8(%2), %%mm2 \n\t"
- "punpcklwd 16(%2), %%mm4 \n\t"
- "punpcklwd 24(%2), %%mm6 \n\t"
- "movq %%mm0, (%0) \n\t"
- "movq %%mm2, 16(%0) \n\t"
- "movq %%mm4, 32(%0) \n\t"
- "movq %%mm6, 48(%0) \n\t"
- "punpckhwd (%2), %%mm1 \n\t"
- "punpckhwd 8(%2), %%mm3 \n\t"
- "punpckhwd 16(%2), %%mm5 \n\t"
- "punpckhwd 24(%2), %%mm7 \n\t"
- "movq %%mm1, 8(%0) \n\t"
- "movq %%mm3, 24(%0) \n\t"
- "movq %%mm5, 40(%0) \n\t"
- "movq %%mm7, 56(%0) \n\t"
- :: "r"(&b[i]), "r"(&b[i>>1]), "r"(&temp[i>>1])
- : "memory"
- );
- }
- }
-}
-
-#if HAVE_7REGS
-#define snow_vertical_compose_sse2_load_add(op,r,t0,t1,t2,t3)\
- ""op" ("r",%%"REG_d"), %%"t0" \n\t"\
- ""op" 16("r",%%"REG_d"), %%"t1" \n\t"\
- ""op" 32("r",%%"REG_d"), %%"t2" \n\t"\
- ""op" 48("r",%%"REG_d"), %%"t3" \n\t"
-
-#define snow_vertical_compose_sse2_load(r,t0,t1,t2,t3)\
- snow_vertical_compose_sse2_load_add("movdqa",r,t0,t1,t2,t3)
-
-#define snow_vertical_compose_sse2_add(r,t0,t1,t2,t3)\
- snow_vertical_compose_sse2_load_add("paddw",r,t0,t1,t2,t3)
-
-#define snow_vertical_compose_r2r_sub(s0,s1,s2,s3,t0,t1,t2,t3)\
- "psubw %%"s0", %%"t0" \n\t"\
- "psubw %%"s1", %%"t1" \n\t"\
- "psubw %%"s2", %%"t2" \n\t"\
- "psubw %%"s3", %%"t3" \n\t"
-
-#define snow_vertical_compose_sse2_store(w,s0,s1,s2,s3)\
- "movdqa %%"s0", ("w",%%"REG_d") \n\t"\
- "movdqa %%"s1", 16("w",%%"REG_d") \n\t"\
- "movdqa %%"s2", 32("w",%%"REG_d") \n\t"\
- "movdqa %%"s3", 48("w",%%"REG_d") \n\t"
-
-#define snow_vertical_compose_sra(n,t0,t1,t2,t3)\
- "psraw $"n", %%"t0" \n\t"\
- "psraw $"n", %%"t1" \n\t"\
- "psraw $"n", %%"t2" \n\t"\
- "psraw $"n", %%"t3" \n\t"
-
-#define snow_vertical_compose_r2r_add(s0,s1,s2,s3,t0,t1,t2,t3)\
- "paddw %%"s0", %%"t0" \n\t"\
- "paddw %%"s1", %%"t1" \n\t"\
- "paddw %%"s2", %%"t2" \n\t"\
- "paddw %%"s3", %%"t3" \n\t"
-
-#define snow_vertical_compose_r2r_pmulhw(s0,s1,s2,s3,t0,t1,t2,t3)\
- "pmulhw %%"s0", %%"t0" \n\t"\
- "pmulhw %%"s1", %%"t1" \n\t"\
- "pmulhw %%"s2", %%"t2" \n\t"\
- "pmulhw %%"s3", %%"t3" \n\t"
-
-#define snow_vertical_compose_sse2_move(s0,s1,s2,s3,t0,t1,t2,t3)\
- "movdqa %%"s0", %%"t0" \n\t"\
- "movdqa %%"s1", %%"t1" \n\t"\
- "movdqa %%"s2", %%"t2" \n\t"\
- "movdqa %%"s3", %%"t3" \n\t"
-
-static void ff_snow_vertical_compose97i_sse2(IDWTELEM *b0, IDWTELEM *b1, IDWTELEM *b2, IDWTELEM *b3, IDWTELEM *b4, IDWTELEM *b5, int width){
- x86_reg i = width;
-
- while(i & 0x1F)
- {
- i--;
- b4[i] -= (W_DM*(b3[i] + b5[i])+W_DO)>>W_DS;
- b3[i] -= (W_CM*(b2[i] + b4[i])+W_CO)>>W_CS;
- b2[i] += (W_BM*(b1[i] + b3[i])+4*b2[i]+W_BO)>>W_BS;
- b1[i] += (W_AM*(b0[i] + b2[i])+W_AO)>>W_AS;
- }
- i+=i;
-
- __asm__ volatile (
- "jmp 2f \n\t"
- "1: \n\t"
- snow_vertical_compose_sse2_load("%4","xmm0","xmm2","xmm4","xmm6")
- snow_vertical_compose_sse2_add("%6","xmm0","xmm2","xmm4","xmm6")
-
-
- "pcmpeqw %%xmm0, %%xmm0 \n\t"
- "pcmpeqw %%xmm2, %%xmm2 \n\t"
- "paddw %%xmm2, %%xmm2 \n\t"
- "paddw %%xmm0, %%xmm2 \n\t"
- "psllw $13, %%xmm2 \n\t"
- snow_vertical_compose_r2r_add("xmm0","xmm0","xmm0","xmm0","xmm1","xmm3","xmm5","xmm7")
- snow_vertical_compose_r2r_pmulhw("xmm2","xmm2","xmm2","xmm2","xmm1","xmm3","xmm5","xmm7")
- snow_vertical_compose_sse2_add("%5","xmm1","xmm3","xmm5","xmm7")
- snow_vertical_compose_sse2_store("%5","xmm1","xmm3","xmm5","xmm7")
- snow_vertical_compose_sse2_load("%4","xmm0","xmm2","xmm4","xmm6")
- snow_vertical_compose_sse2_add("%3","xmm1","xmm3","xmm5","xmm7")
- snow_vertical_compose_r2r_sub("xmm1","xmm3","xmm5","xmm7","xmm0","xmm2","xmm4","xmm6")
- snow_vertical_compose_sse2_store("%4","xmm0","xmm2","xmm4","xmm6")
-
- "pcmpeqw %%xmm7, %%xmm7 \n\t"
- "pcmpeqw %%xmm5, %%xmm5 \n\t"
- "psllw $15, %%xmm7 \n\t"
- "psrlw $13, %%xmm5 \n\t"
- "paddw %%xmm7, %%xmm5 \n\t"
- snow_vertical_compose_r2r_add("xmm5","xmm5","xmm5","xmm5","xmm0","xmm2","xmm4","xmm6")
- "movq (%2,%%"REG_d"), %%xmm1 \n\t"
- "movq 8(%2,%%"REG_d"), %%xmm3 \n\t"
- "paddw %%xmm7, %%xmm1 \n\t"
- "paddw %%xmm7, %%xmm3 \n\t"
- "pavgw %%xmm1, %%xmm0 \n\t"
- "pavgw %%xmm3, %%xmm2 \n\t"
- "movq 16(%2,%%"REG_d"), %%xmm1 \n\t"
- "movq 24(%2,%%"REG_d"), %%xmm3 \n\t"
- "paddw %%xmm7, %%xmm1 \n\t"
- "paddw %%xmm7, %%xmm3 \n\t"
- "pavgw %%xmm1, %%xmm4 \n\t"
- "pavgw %%xmm3, %%xmm6 \n\t"
- snow_vertical_compose_r2r_sub("xmm7","xmm7","xmm7","xmm7","xmm0","xmm2","xmm4","xmm6")
- snow_vertical_compose_sra("1","xmm0","xmm2","xmm4","xmm6")
- snow_vertical_compose_sse2_add("%3","xmm0","xmm2","xmm4","xmm6")
-
- snow_vertical_compose_sra("2","xmm0","xmm2","xmm4","xmm6")
- snow_vertical_compose_sse2_add("%3","xmm0","xmm2","xmm4","xmm6")
- snow_vertical_compose_sse2_store("%3","xmm0","xmm2","xmm4","xmm6")
- snow_vertical_compose_sse2_add("%1","xmm0","xmm2","xmm4","xmm6")
- snow_vertical_compose_sse2_move("xmm0","xmm2","xmm4","xmm6","xmm1","xmm3","xmm5","xmm7")
- snow_vertical_compose_sra("1","xmm0","xmm2","xmm4","xmm6")
- snow_vertical_compose_r2r_add("xmm1","xmm3","xmm5","xmm7","xmm0","xmm2","xmm4","xmm6")
- snow_vertical_compose_sse2_add("%2","xmm0","xmm2","xmm4","xmm6")
- snow_vertical_compose_sse2_store("%2","xmm0","xmm2","xmm4","xmm6")
-
- "2: \n\t"
- "sub $64, %%"REG_d" \n\t"
- "jge 1b \n\t"
- :"+d"(i)
- :"r"(b0),"r"(b1),"r"(b2),"r"(b3),"r"(b4),"r"(b5));
-}
-
-#define snow_vertical_compose_mmx_load_add(op,r,t0,t1,t2,t3)\
- ""op" ("r",%%"REG_d"), %%"t0" \n\t"\
- ""op" 8("r",%%"REG_d"), %%"t1" \n\t"\
- ""op" 16("r",%%"REG_d"), %%"t2" \n\t"\
- ""op" 24("r",%%"REG_d"), %%"t3" \n\t"
-
-#define snow_vertical_compose_mmx_load(r,t0,t1,t2,t3)\
- snow_vertical_compose_mmx_load_add("movq",r,t0,t1,t2,t3)
-
-#define snow_vertical_compose_mmx_add(r,t0,t1,t2,t3)\
- snow_vertical_compose_mmx_load_add("paddw",r,t0,t1,t2,t3)
-
-#define snow_vertical_compose_mmx_store(w,s0,s1,s2,s3)\
- "movq %%"s0", ("w",%%"REG_d") \n\t"\
- "movq %%"s1", 8("w",%%"REG_d") \n\t"\
- "movq %%"s2", 16("w",%%"REG_d") \n\t"\
- "movq %%"s3", 24("w",%%"REG_d") \n\t"
-
-#define snow_vertical_compose_mmx_move(s0,s1,s2,s3,t0,t1,t2,t3)\
- "movq %%"s0", %%"t0" \n\t"\
- "movq %%"s1", %%"t1" \n\t"\
- "movq %%"s2", %%"t2" \n\t"\
- "movq %%"s3", %%"t3" \n\t"
-
-
-static void ff_snow_vertical_compose97i_mmx(IDWTELEM *b0, IDWTELEM *b1, IDWTELEM *b2, IDWTELEM *b3, IDWTELEM *b4, IDWTELEM *b5, int width){
- x86_reg i = width;
- while(i & 15)
- {
- i--;
- b4[i] -= (W_DM*(b3[i] + b5[i])+W_DO)>>W_DS;
- b3[i] -= (W_CM*(b2[i] + b4[i])+W_CO)>>W_CS;
- b2[i] += (W_BM*(b1[i] + b3[i])+4*b2[i]+W_BO)>>W_BS;
- b1[i] += (W_AM*(b0[i] + b2[i])+W_AO)>>W_AS;
- }
- i+=i;
- __asm__ volatile(
- "jmp 2f \n\t"
- "1: \n\t"
-
- snow_vertical_compose_mmx_load("%4","mm1","mm3","mm5","mm7")
- snow_vertical_compose_mmx_add("%6","mm1","mm3","mm5","mm7")
- "pcmpeqw %%mm0, %%mm0 \n\t"
- "pcmpeqw %%mm2, %%mm2 \n\t"
- "paddw %%mm2, %%mm2 \n\t"
- "paddw %%mm0, %%mm2 \n\t"
- "psllw $13, %%mm2 \n\t"
- snow_vertical_compose_r2r_add("mm0","mm0","mm0","mm0","mm1","mm3","mm5","mm7")
- snow_vertical_compose_r2r_pmulhw("mm2","mm2","mm2","mm2","mm1","mm3","mm5","mm7")
- snow_vertical_compose_mmx_add("%5","mm1","mm3","mm5","mm7")
- snow_vertical_compose_mmx_store("%5","mm1","mm3","mm5","mm7")
- snow_vertical_compose_mmx_load("%4","mm0","mm2","mm4","mm6")
- snow_vertical_compose_mmx_add("%3","mm1","mm3","mm5","mm7")
- snow_vertical_compose_r2r_sub("mm1","mm3","mm5","mm7","mm0","mm2","mm4","mm6")
- snow_vertical_compose_mmx_store("%4","mm0","mm2","mm4","mm6")
- "pcmpeqw %%mm7, %%mm7 \n\t"
- "pcmpeqw %%mm5, %%mm5 \n\t"
- "psllw $15, %%mm7 \n\t"
- "psrlw $13, %%mm5 \n\t"
- "paddw %%mm7, %%mm5 \n\t"
- snow_vertical_compose_r2r_add("mm5","mm5","mm5","mm5","mm0","mm2","mm4","mm6")
- "movq (%2,%%"REG_d"), %%mm1 \n\t"
- "movq 8(%2,%%"REG_d"), %%mm3 \n\t"
- "paddw %%mm7, %%mm1 \n\t"
- "paddw %%mm7, %%mm3 \n\t"
- "pavgw %%mm1, %%mm0 \n\t"
- "pavgw %%mm3, %%mm2 \n\t"
- "movq 16(%2,%%"REG_d"), %%mm1 \n\t"
- "movq 24(%2,%%"REG_d"), %%mm3 \n\t"
- "paddw %%mm7, %%mm1 \n\t"
- "paddw %%mm7, %%mm3 \n\t"
- "pavgw %%mm1, %%mm4 \n\t"
- "pavgw %%mm3, %%mm6 \n\t"
- snow_vertical_compose_r2r_sub("mm7","mm7","mm7","mm7","mm0","mm2","mm4","mm6")
- snow_vertical_compose_sra("1","mm0","mm2","mm4","mm6")
- snow_vertical_compose_mmx_add("%3","mm0","mm2","mm4","mm6")
-
- snow_vertical_compose_sra("2","mm0","mm2","mm4","mm6")
- snow_vertical_compose_mmx_add("%3","mm0","mm2","mm4","mm6")
- snow_vertical_compose_mmx_store("%3","mm0","mm2","mm4","mm6")
- snow_vertical_compose_mmx_add("%1","mm0","mm2","mm4","mm6")
- snow_vertical_compose_mmx_move("mm0","mm2","mm4","mm6","mm1","mm3","mm5","mm7")
- snow_vertical_compose_sra("1","mm0","mm2","mm4","mm6")
- snow_vertical_compose_r2r_add("mm1","mm3","mm5","mm7","mm0","mm2","mm4","mm6")
- snow_vertical_compose_mmx_add("%2","mm0","mm2","mm4","mm6")
- snow_vertical_compose_mmx_store("%2","mm0","mm2","mm4","mm6")
-
- "2: \n\t"
- "sub $32, %%"REG_d" \n\t"
- "jge 1b \n\t"
- :"+d"(i)
- :"r"(b0),"r"(b1),"r"(b2),"r"(b3),"r"(b4),"r"(b5));
-}
-#endif //HAVE_7REGS
-
-#define snow_inner_add_yblock_sse2_header \
- IDWTELEM * * dst_array = sb->line + src_y;\
- x86_reg tmp;\
- __asm__ volatile(\
- "mov %7, %%"REG_c" \n\t"\
- "mov %6, %2 \n\t"\
- "mov %4, %%"REG_S" \n\t"\
- "pxor %%xmm7, %%xmm7 \n\t" /* 0 */\
- "pcmpeqd %%xmm3, %%xmm3 \n\t"\
- "psllw $15, %%xmm3 \n\t"\
- "psrlw $12, %%xmm3 \n\t" /* FRAC_BITS >> 1 */\
- "1: \n\t"\
- "mov %1, %%"REG_D" \n\t"\
- "mov (%%"REG_D"), %%"REG_D" \n\t"\
- "add %3, %%"REG_D" \n\t"
-
-#define snow_inner_add_yblock_sse2_start_8(out_reg1, out_reg2, ptr_offset, s_offset)\
- "mov "PTR_SIZE"*"ptr_offset"(%%"REG_a"), %%"REG_d"; \n\t"\
- "movq (%%"REG_d"), %%"out_reg1" \n\t"\
- "movq (%%"REG_d", %%"REG_c"), %%"out_reg2" \n\t"\
- "punpcklbw %%xmm7, %%"out_reg1" \n\t"\
- "punpcklbw %%xmm7, %%"out_reg2" \n\t"\
- "movq "s_offset"(%%"REG_S"), %%xmm0 \n\t"\
- "movq "s_offset"+16(%%"REG_S"), %%xmm4 \n\t"\
- "punpcklbw %%xmm7, %%xmm0 \n\t"\
- "punpcklbw %%xmm7, %%xmm4 \n\t"\
- "pmullw %%xmm0, %%"out_reg1" \n\t"\
- "pmullw %%xmm4, %%"out_reg2" \n\t"
-
-#define snow_inner_add_yblock_sse2_start_16(out_reg1, out_reg2, ptr_offset, s_offset)\
- "mov "PTR_SIZE"*"ptr_offset"(%%"REG_a"), %%"REG_d"; \n\t"\
- "movq (%%"REG_d"), %%"out_reg1" \n\t"\
- "movq 8(%%"REG_d"), %%"out_reg2" \n\t"\
- "punpcklbw %%xmm7, %%"out_reg1" \n\t"\
- "punpcklbw %%xmm7, %%"out_reg2" \n\t"\
- "movq "s_offset"(%%"REG_S"), %%xmm0 \n\t"\
- "movq "s_offset"+8(%%"REG_S"), %%xmm4 \n\t"\
- "punpcklbw %%xmm7, %%xmm0 \n\t"\
- "punpcklbw %%xmm7, %%xmm4 \n\t"\
- "pmullw %%xmm0, %%"out_reg1" \n\t"\
- "pmullw %%xmm4, %%"out_reg2" \n\t"
-
-#define snow_inner_add_yblock_sse2_accum_8(ptr_offset, s_offset) \
- snow_inner_add_yblock_sse2_start_8("xmm2", "xmm6", ptr_offset, s_offset)\
- "paddusw %%xmm2, %%xmm1 \n\t"\
- "paddusw %%xmm6, %%xmm5 \n\t"
-
-#define snow_inner_add_yblock_sse2_accum_16(ptr_offset, s_offset) \
- snow_inner_add_yblock_sse2_start_16("xmm2", "xmm6", ptr_offset, s_offset)\
- "paddusw %%xmm2, %%xmm1 \n\t"\
- "paddusw %%xmm6, %%xmm5 \n\t"
-
-#define snow_inner_add_yblock_sse2_end_common1\
- "add $32, %%"REG_S" \n\t"\
- "add %%"REG_c", %0 \n\t"\
- "add %%"REG_c", "PTR_SIZE"*3(%%"REG_a");\n\t"\
- "add %%"REG_c", "PTR_SIZE"*2(%%"REG_a");\n\t"\
- "add %%"REG_c", "PTR_SIZE"*1(%%"REG_a");\n\t"\
- "add %%"REG_c", (%%"REG_a") \n\t"
-
-#define snow_inner_add_yblock_sse2_end_common2\
- "jnz 1b \n\t"\
- :"+m"(dst8),"+m"(dst_array),"=&r"(tmp)\
- :\
- "rm"((x86_reg)(src_x<<1)),"m"(obmc),"a"(block),"m"(b_h),"m"(src_stride):\
- "%"REG_c"","%"REG_S"","%"REG_D"","%"REG_d"");
-
-#define snow_inner_add_yblock_sse2_end_8\
- "sal $1, %%"REG_c" \n\t"\
- "add $"PTR_SIZE"*2, %1 \n\t"\
- snow_inner_add_yblock_sse2_end_common1\
- "sar $1, %%"REG_c" \n\t"\
- "sub $2, %2 \n\t"\
- snow_inner_add_yblock_sse2_end_common2
-
-#define snow_inner_add_yblock_sse2_end_16\
- "add $"PTR_SIZE"*1, %1 \n\t"\
- snow_inner_add_yblock_sse2_end_common1\
- "dec %2 \n\t"\
- snow_inner_add_yblock_sse2_end_common2
-
-static void inner_add_yblock_bw_8_obmc_16_bh_even_sse2(const uint8_t *obmc, const x86_reg obmc_stride, uint8_t * * block, int b_w, x86_reg b_h,
- int src_x, int src_y, x86_reg src_stride, slice_buffer * sb, int add, uint8_t * dst8){
-snow_inner_add_yblock_sse2_header
-snow_inner_add_yblock_sse2_start_8("xmm1", "xmm5", "3", "0")
-snow_inner_add_yblock_sse2_accum_8("2", "8")
-snow_inner_add_yblock_sse2_accum_8("1", "128")
-snow_inner_add_yblock_sse2_accum_8("0", "136")
-
- "mov %0, %%"REG_d" \n\t"
- "movdqa (%%"REG_D"), %%xmm0 \n\t"
- "movdqa %%xmm1, %%xmm2 \n\t"
-
- "punpckhwd %%xmm7, %%xmm1 \n\t"
- "punpcklwd %%xmm7, %%xmm2 \n\t"
- "paddd %%xmm2, %%xmm0 \n\t"
- "movdqa 16(%%"REG_D"), %%xmm2 \n\t"
- "paddd %%xmm1, %%xmm2 \n\t"
- "paddd %%xmm3, %%xmm0 \n\t"
- "paddd %%xmm3, %%xmm2 \n\t"
-
- "mov %1, %%"REG_D" \n\t"
- "mov "PTR_SIZE"(%%"REG_D"), %%"REG_D";\n\t"
- "add %3, %%"REG_D" \n\t"
-
- "movdqa (%%"REG_D"), %%xmm4 \n\t"
- "movdqa %%xmm5, %%xmm6 \n\t"
- "punpckhwd %%xmm7, %%xmm5 \n\t"
- "punpcklwd %%xmm7, %%xmm6 \n\t"
- "paddd %%xmm6, %%xmm4 \n\t"
- "movdqa 16(%%"REG_D"), %%xmm6 \n\t"
- "paddd %%xmm5, %%xmm6 \n\t"
- "paddd %%xmm3, %%xmm4 \n\t"
- "paddd %%xmm3, %%xmm6 \n\t"
-
- "psrad $8, %%xmm0 \n\t" /* FRAC_BITS. */
- "psrad $8, %%xmm2 \n\t" /* FRAC_BITS. */
- "packssdw %%xmm2, %%xmm0 \n\t"
- "packuswb %%xmm7, %%xmm0 \n\t"
- "movq %%xmm0, (%%"REG_d") \n\t"
-
- "psrad $8, %%xmm4 \n\t" /* FRAC_BITS. */
- "psrad $8, %%xmm6 \n\t" /* FRAC_BITS. */
- "packssdw %%xmm6, %%xmm4 \n\t"
- "packuswb %%xmm7, %%xmm4 \n\t"
- "movq %%xmm4, (%%"REG_d",%%"REG_c");\n\t"
-snow_inner_add_yblock_sse2_end_8
-}
-
-static void inner_add_yblock_bw_16_obmc_32_sse2(const uint8_t *obmc, const x86_reg obmc_stride, uint8_t * * block, int b_w, x86_reg b_h,
- int src_x, int src_y, x86_reg src_stride, slice_buffer * sb, int add, uint8_t * dst8){
-snow_inner_add_yblock_sse2_header
-snow_inner_add_yblock_sse2_start_16("xmm1", "xmm5", "3", "0")
-snow_inner_add_yblock_sse2_accum_16("2", "16")
-snow_inner_add_yblock_sse2_accum_16("1", "512")
-snow_inner_add_yblock_sse2_accum_16("0", "528")
-
- "mov %0, %%"REG_d" \n\t"
- "psrlw $4, %%xmm1 \n\t"
- "psrlw $4, %%xmm5 \n\t"
- "paddw (%%"REG_D"), %%xmm1 \n\t"
- "paddw 16(%%"REG_D"), %%xmm5 \n\t"
- "paddw %%xmm3, %%xmm1 \n\t"
- "paddw %%xmm3, %%xmm5 \n\t"
- "psraw $4, %%xmm1 \n\t" /* FRAC_BITS. */
- "psraw $4, %%xmm5 \n\t" /* FRAC_BITS. */
- "packuswb %%xmm5, %%xmm1 \n\t"
-
- "movdqu %%xmm1, (%%"REG_d") \n\t"
-
-snow_inner_add_yblock_sse2_end_16
-}
-
-#define snow_inner_add_yblock_mmx_header \
- IDWTELEM * * dst_array = sb->line + src_y;\
- x86_reg tmp;\
- __asm__ volatile(\
- "mov %7, %%"REG_c" \n\t"\
- "mov %6, %2 \n\t"\
- "mov %4, %%"REG_S" \n\t"\
- "pxor %%mm7, %%mm7 \n\t" /* 0 */\
- "pcmpeqd %%mm3, %%mm3 \n\t"\
- "psllw $15, %%mm3 \n\t"\
- "psrlw $12, %%mm3 \n\t" /* FRAC_BITS >> 1 */\
- "1: \n\t"\
- "mov %1, %%"REG_D" \n\t"\
- "mov (%%"REG_D"), %%"REG_D" \n\t"\
- "add %3, %%"REG_D" \n\t"
-
-#define snow_inner_add_yblock_mmx_start(out_reg1, out_reg2, ptr_offset, s_offset, d_offset)\
- "mov "PTR_SIZE"*"ptr_offset"(%%"REG_a"), %%"REG_d"; \n\t"\
- "movd "d_offset"(%%"REG_d"), %%"out_reg1" \n\t"\
- "movd "d_offset"+4(%%"REG_d"), %%"out_reg2" \n\t"\
- "punpcklbw %%mm7, %%"out_reg1" \n\t"\
- "punpcklbw %%mm7, %%"out_reg2" \n\t"\
- "movd "s_offset"(%%"REG_S"), %%mm0 \n\t"\
- "movd "s_offset"+4(%%"REG_S"), %%mm4 \n\t"\
- "punpcklbw %%mm7, %%mm0 \n\t"\
- "punpcklbw %%mm7, %%mm4 \n\t"\
- "pmullw %%mm0, %%"out_reg1" \n\t"\
- "pmullw %%mm4, %%"out_reg2" \n\t"
-
-#define snow_inner_add_yblock_mmx_accum(ptr_offset, s_offset, d_offset) \
- snow_inner_add_yblock_mmx_start("mm2", "mm6", ptr_offset, s_offset, d_offset)\
- "paddusw %%mm2, %%mm1 \n\t"\
- "paddusw %%mm6, %%mm5 \n\t"
-
-#define snow_inner_add_yblock_mmx_mix(read_offset, write_offset)\
- "mov %0, %%"REG_d" \n\t"\
- "psrlw $4, %%mm1 \n\t"\
- "psrlw $4, %%mm5 \n\t"\
- "paddw "read_offset"(%%"REG_D"), %%mm1 \n\t"\
- "paddw "read_offset"+8(%%"REG_D"), %%mm5 \n\t"\
- "paddw %%mm3, %%mm1 \n\t"\
- "paddw %%mm3, %%mm5 \n\t"\
- "psraw $4, %%mm1 \n\t"\
- "psraw $4, %%mm5 \n\t"\
- "packuswb %%mm5, %%mm1 \n\t"\
- "movq %%mm1, "write_offset"(%%"REG_d") \n\t"
-
-#define snow_inner_add_yblock_mmx_end(s_step)\
- "add $"s_step", %%"REG_S" \n\t"\
- "add %%"REG_c", "PTR_SIZE"*3(%%"REG_a");\n\t"\
- "add %%"REG_c", "PTR_SIZE"*2(%%"REG_a");\n\t"\
- "add %%"REG_c", "PTR_SIZE"*1(%%"REG_a");\n\t"\
- "add %%"REG_c", (%%"REG_a") \n\t"\
- "add"OPSIZE " $"PTR_SIZE"*1, %1 \n\t"\
- "add %%"REG_c", %0 \n\t"\
- "dec %2 \n\t"\
- "jnz 1b \n\t"\
- :"+m"(dst8),"+m"(dst_array),"=&r"(tmp)\
- :\
- "rm"((x86_reg)(src_x<<1)),"m"(obmc),"a"(block),"m"(b_h),"m"(src_stride):\
- "%"REG_c"","%"REG_S"","%"REG_D"","%"REG_d"");
-
-static void inner_add_yblock_bw_8_obmc_16_mmx(const uint8_t *obmc, const x86_reg obmc_stride, uint8_t * * block, int b_w, x86_reg b_h,
- int src_x, int src_y, x86_reg src_stride, slice_buffer * sb, int add, uint8_t * dst8){
-snow_inner_add_yblock_mmx_header
-snow_inner_add_yblock_mmx_start("mm1", "mm5", "3", "0", "0")
-snow_inner_add_yblock_mmx_accum("2", "8", "0")
-snow_inner_add_yblock_mmx_accum("1", "128", "0")
-snow_inner_add_yblock_mmx_accum("0", "136", "0")
-snow_inner_add_yblock_mmx_mix("0", "0")
-snow_inner_add_yblock_mmx_end("16")
-}
-
-static void inner_add_yblock_bw_16_obmc_32_mmx(const uint8_t *obmc, const x86_reg obmc_stride, uint8_t * * block, int b_w, x86_reg b_h,
- int src_x, int src_y, x86_reg src_stride, slice_buffer * sb, int add, uint8_t * dst8){
-snow_inner_add_yblock_mmx_header
-snow_inner_add_yblock_mmx_start("mm1", "mm5", "3", "0", "0")
-snow_inner_add_yblock_mmx_accum("2", "16", "0")
-snow_inner_add_yblock_mmx_accum("1", "512", "0")
-snow_inner_add_yblock_mmx_accum("0", "528", "0")
-snow_inner_add_yblock_mmx_mix("0", "0")
-
-snow_inner_add_yblock_mmx_start("mm1", "mm5", "3", "8", "8")
-snow_inner_add_yblock_mmx_accum("2", "24", "8")
-snow_inner_add_yblock_mmx_accum("1", "520", "8")
-snow_inner_add_yblock_mmx_accum("0", "536", "8")
-snow_inner_add_yblock_mmx_mix("16", "8")
-snow_inner_add_yblock_mmx_end("32")
-}
-
-static void ff_snow_inner_add_yblock_sse2(const uint8_t *obmc, const int obmc_stride, uint8_t * * block, int b_w, int b_h,
- int src_x, int src_y, int src_stride, slice_buffer * sb, int add, uint8_t * dst8){
-
- if (b_w == 16)
- inner_add_yblock_bw_16_obmc_32_sse2(obmc, obmc_stride, block, b_w, b_h, src_x,src_y, src_stride, sb, add, dst8);
- else if (b_w == 8 && obmc_stride == 16) {
- if (!(b_h & 1))
- inner_add_yblock_bw_8_obmc_16_bh_even_sse2(obmc, obmc_stride, block, b_w, b_h, src_x,src_y, src_stride, sb, add, dst8);
- else
- inner_add_yblock_bw_8_obmc_16_mmx(obmc, obmc_stride, block, b_w, b_h, src_x,src_y, src_stride, sb, add, dst8);
- } else
- ff_snow_inner_add_yblock(obmc, obmc_stride, block, b_w, b_h, src_x,src_y, src_stride, sb, add, dst8);
-}
-
-static void ff_snow_inner_add_yblock_mmx(const uint8_t *obmc, const int obmc_stride, uint8_t * * block, int b_w, int b_h,
- int src_x, int src_y, int src_stride, slice_buffer * sb, int add, uint8_t * dst8){
- if (b_w == 16)
- inner_add_yblock_bw_16_obmc_32_mmx(obmc, obmc_stride, block, b_w, b_h, src_x,src_y, src_stride, sb, add, dst8);
- else if (b_w == 8 && obmc_stride == 16)
- inner_add_yblock_bw_8_obmc_16_mmx(obmc, obmc_stride, block, b_w, b_h, src_x,src_y, src_stride, sb, add, dst8);
- else
- ff_snow_inner_add_yblock(obmc, obmc_stride, block, b_w, b_h, src_x,src_y, src_stride, sb, add, dst8);
-}
-
-void ff_dwt_init_x86(DWTContext *c)
-{
- int mm_flags = av_get_cpu_flags();
-
- if (mm_flags & AV_CPU_FLAG_MMX) {
- if(mm_flags & AV_CPU_FLAG_SSE2 & 0){
- c->horizontal_compose97i = ff_snow_horizontal_compose97i_sse2;
-#if HAVE_7REGS
- c->vertical_compose97i = ff_snow_vertical_compose97i_sse2;
-#endif
- c->inner_add_yblock = ff_snow_inner_add_yblock_sse2;
- }
- else{
- if(mm_flags & AV_CPU_FLAG_MMX2){
- c->horizontal_compose97i = ff_snow_horizontal_compose97i_mmx;
-#if HAVE_7REGS
- c->vertical_compose97i = ff_snow_vertical_compose97i_mmx;
-#endif
- }
- c->inner_add_yblock = ff_snow_inner_add_yblock_mmx;
- }
- }
-}
diff --git a/gst-libs/ext/libav/libavcodec/x86/vc1dsp.asm b/gst-libs/ext/libav/libavcodec/x86/vc1dsp.asm
new file mode 100644
index 0000000..adf08d7
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/x86/vc1dsp.asm
@@ -0,0 +1,317 @@
+;******************************************************************************
+;* VC1 deblocking optimizations
+;* Copyright (c) 2009 David Conrad
+;*
+;* 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
+;******************************************************************************
+
+%include "libavutil/x86/x86util.asm"
+
+cextern pw_4
+cextern pw_5
+
+section .text
+
+; dst_low, dst_high (src), zero
+; zero-extends one vector from 8 to 16 bits
+%macro UNPACK_8TO16 4
+ mova m%2, m%3
+ punpckh%1 m%3, m%4
+ punpckl%1 m%2, m%4
+%endmacro
+
+%macro STORE_4_WORDS 6
+%if cpuflag(sse4)
+ pextrw %1, %5, %6+0
+ pextrw %2, %5, %6+1
+ pextrw %3, %5, %6+2
+ pextrw %4, %5, %6+3
+%else
+ movd %6d, %5
+%if mmsize==16
+ psrldq %5, 4
+%else
+ psrlq %5, 32
+%endif
+ mov %1, %6w
+ shr %6, 16
+ mov %2, %6w
+ movd %6d, %5
+ mov %3, %6w
+ shr %6, 16
+ mov %4, %6w
+%endif
+%endmacro
+
+; in: p1 p0 q0 q1, clobbers p0
+; out: p1 = (2*(p1 - q1) - 5*(p0 - q0) + 4) >> 3
+%macro VC1_LOOP_FILTER_A0 4
+ psubw %1, %4
+ psubw %2, %3
+ paddw %1, %1
+ pmullw %2, [pw_5]
+ psubw %1, %2
+ paddw %1, [pw_4]
+ psraw %1, 3
+%endmacro
+
+; in: p0 q0 a0 a1 a2
+; m0 m1 m7 m6 m5
+; %1: size
+; out: m0=p0' m1=q0'
+%macro VC1_FILTER 1
+ PABSW m4, m7
+ PABSW m3, m6
+ PABSW m2, m5
+ mova m6, m4
+ pminsw m3, m2
+ pcmpgtw m6, m3 ; if (a2 < a0 || a1 < a0)
+ psubw m3, m4
+ pmullw m3, [pw_5] ; 5*(a3 - a0)
+ PABSW m2, m3
+ psraw m2, 3 ; abs(d/8)
+ pxor m7, m3 ; d_sign ^= a0_sign
+
+ pxor m5, m5
+ movd m3, r2d
+%if %1 > 4
+ punpcklbw m3, m3
+%endif
+ punpcklbw m3, m5
+ pcmpgtw m3, m4 ; if (a0 < pq)
+ pand m6, m3
+
+ mova m3, m0
+ psubw m3, m1
+ PABSW m4, m3
+ psraw m4, 1
+ pxor m3, m7 ; d_sign ^ clip_sign
+ psraw m3, 15
+ pminsw m2, m4 ; min(d, clip)
+ pcmpgtw m4, m5
+ pand m6, m4 ; filt3 (C return value)
+
+; each set of 4 pixels is not filtered if the 3rd is not
+%if mmsize==16
+ pshuflw m4, m6, 0xaa
+%if %1 > 4
+ pshufhw m4, m4, 0xaa
+%endif
+%else
+ pshufw m4, m6, 0xaa
+%endif
+ pandn m3, m4
+ pand m2, m6
+ pand m3, m2 ; d final
+
+ psraw m7, 15
+ pxor m3, m7
+ psubw m3, m7
+ psubw m0, m3
+ paddw m1, m3
+ packuswb m0, m0
+ packuswb m1, m1
+%endmacro
+
+; 1st param: size of filter
+; 2nd param: mov suffix equivalent to the filter size
+%macro VC1_V_LOOP_FILTER 2
+ pxor m5, m5
+ mov%2 m6, [r4]
+ mov%2 m4, [r4+r1]
+ mov%2 m7, [r4+2*r1]
+ mov%2 m0, [r4+r3]
+ punpcklbw m6, m5
+ punpcklbw m4, m5
+ punpcklbw m7, m5
+ punpcklbw m0, m5
+
+ VC1_LOOP_FILTER_A0 m6, m4, m7, m0
+ mov%2 m1, [r0]
+ mov%2 m2, [r0+r1]
+ punpcklbw m1, m5
+ punpcklbw m2, m5
+ mova m4, m0
+ VC1_LOOP_FILTER_A0 m7, m4, m1, m2
+ mov%2 m3, [r0+2*r1]
+ mov%2 m4, [r0+r3]
+ punpcklbw m3, m5
+ punpcklbw m4, m5
+ mova m5, m1
+ VC1_LOOP_FILTER_A0 m5, m2, m3, m4
+
+ VC1_FILTER %1
+ mov%2 [r4+r3], m0
+ mov%2 [r0], m1
+%endmacro
+
+; 1st param: size of filter
+; NOTE: UNPACK_8TO16 this number of 8 bit numbers are in half a register
+; 2nd (optional) param: temp register to use for storing words
+%macro VC1_H_LOOP_FILTER 1-2
+%if %1 == 4
+ movq m0, [r0 -4]
+ movq m1, [r0+ r1-4]
+ movq m2, [r0+2*r1-4]
+ movq m3, [r0+ r3-4]
+ TRANSPOSE4x4B 0, 1, 2, 3, 4
+%else
+ movq m0, [r0 -4]
+ movq m4, [r0+ r1-4]
+ movq m1, [r0+2*r1-4]
+ movq m5, [r0+ r3-4]
+ movq m2, [r4 -4]
+ movq m6, [r4+ r1-4]
+ movq m3, [r4+2*r1-4]
+ movq m7, [r4+ r3-4]
+ punpcklbw m0, m4
+ punpcklbw m1, m5
+ punpcklbw m2, m6
+ punpcklbw m3, m7
+ TRANSPOSE4x4W 0, 1, 2, 3, 4
+%endif
+ pxor m5, m5
+
+ UNPACK_8TO16 bw, 6, 0, 5
+ UNPACK_8TO16 bw, 7, 1, 5
+ VC1_LOOP_FILTER_A0 m6, m0, m7, m1
+ UNPACK_8TO16 bw, 4, 2, 5
+ mova m0, m1 ; m0 = p0
+ VC1_LOOP_FILTER_A0 m7, m1, m4, m2
+ UNPACK_8TO16 bw, 1, 3, 5
+ mova m5, m4
+ VC1_LOOP_FILTER_A0 m5, m2, m1, m3
+ SWAP 1, 4 ; m1 = q0
+
+ VC1_FILTER %1
+ punpcklbw m0, m1
+%if %0 > 1
+ STORE_4_WORDS [r0-1], [r0+r1-1], [r0+2*r1-1], [r0+r3-1], m0, %2
+%if %1 > 4
+ psrldq m0, 4
+ STORE_4_WORDS [r4-1], [r4+r1-1], [r4+2*r1-1], [r4+r3-1], m0, %2
+%endif
+%else
+ STORE_4_WORDS [r0-1], [r0+r1-1], [r0+2*r1-1], [r0+r3-1], m0, 0
+ STORE_4_WORDS [r4-1], [r4+r1-1], [r4+2*r1-1], [r4+r3-1], m0, 4
+%endif
+%endmacro
+
+
+%macro START_V_FILTER 0
+ mov r4, r0
+ lea r3, [4*r1]
+ sub r4, r3
+ lea r3, [r1+2*r1]
+ imul r2, 0x01010101
+%endmacro
+
+%macro START_H_FILTER 1
+ lea r3, [r1+2*r1]
+%if %1 > 4
+ lea r4, [r0+4*r1]
+%endif
+ imul r2, 0x01010101
+%endmacro
+
+%macro VC1_LF 0
+cglobal vc1_v_loop_filter_internal
+ VC1_V_LOOP_FILTER 4, d
+ ret
+
+cglobal vc1_h_loop_filter_internal
+ VC1_H_LOOP_FILTER 4, r4
+ ret
+
+; void ff_vc1_v_loop_filter4_mmxext(uint8_t *src, int stride, int pq)
+cglobal vc1_v_loop_filter4, 3,5,0
+ START_V_FILTER
+ call vc1_v_loop_filter_internal
+ RET
+
+; void ff_vc1_h_loop_filter4_mmxext(uint8_t *src, int stride, int pq)
+cglobal vc1_h_loop_filter4, 3,5,0
+ START_H_FILTER 4
+ call vc1_h_loop_filter_internal
+ RET
+
+; void ff_vc1_v_loop_filter8_mmxext(uint8_t *src, int stride, int pq)
+cglobal vc1_v_loop_filter8, 3,5,0
+ START_V_FILTER
+ call vc1_v_loop_filter_internal
+ add r4, 4
+ add r0, 4
+ call vc1_v_loop_filter_internal
+ RET
+
+; void ff_vc1_h_loop_filter8_mmxext(uint8_t *src, int stride, int pq)
+cglobal vc1_h_loop_filter8, 3,5,0
+ START_H_FILTER 4
+ call vc1_h_loop_filter_internal
+ lea r0, [r0+4*r1]
+ call vc1_h_loop_filter_internal
+ RET
+%endmacro
+
+INIT_MMX mmxext
+VC1_LF
+
+INIT_XMM sse2
+; void ff_vc1_v_loop_filter8_sse2(uint8_t *src, int stride, int pq)
+cglobal vc1_v_loop_filter8, 3,5,8
+ START_V_FILTER
+ VC1_V_LOOP_FILTER 8, q
+ RET
+
+; void ff_vc1_h_loop_filter8_sse2(uint8_t *src, int stride, int pq)
+cglobal vc1_h_loop_filter8, 3,6,8
+ START_H_FILTER 8
+ VC1_H_LOOP_FILTER 8, r5
+ RET
+
+INIT_MMX ssse3
+; void ff_vc1_v_loop_filter4_ssse3(uint8_t *src, int stride, int pq)
+cglobal vc1_v_loop_filter4, 3,5,0
+ START_V_FILTER
+ VC1_V_LOOP_FILTER 4, d
+ RET
+
+; void ff_vc1_h_loop_filter4_ssse3(uint8_t *src, int stride, int pq)
+cglobal vc1_h_loop_filter4, 3,5,0
+ START_H_FILTER 4
+ VC1_H_LOOP_FILTER 4, r4
+ RET
+
+INIT_XMM ssse3
+; void ff_vc1_v_loop_filter8_ssse3(uint8_t *src, int stride, int pq)
+cglobal vc1_v_loop_filter8, 3,5,8
+ START_V_FILTER
+ VC1_V_LOOP_FILTER 8, q
+ RET
+
+; void ff_vc1_h_loop_filter8_ssse3(uint8_t *src, int stride, int pq)
+cglobal vc1_h_loop_filter8, 3,6,8
+ START_H_FILTER 8
+ VC1_H_LOOP_FILTER 8, r5
+ RET
+
+INIT_XMM sse4
+; void ff_vc1_h_loop_filter8_sse4(uint8_t *src, int stride, int pq)
+cglobal vc1_h_loop_filter8, 3,5,8
+ START_H_FILTER 8
+ VC1_H_LOOP_FILTER 8
+ RET
diff --git a/gst-libs/ext/libav/libavcodec/x86/vc1dsp.h b/gst-libs/ext/libav/libavcodec/x86/vc1dsp.h
new file mode 100644
index 0000000..9b6c8ad
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/x86/vc1dsp.h
@@ -0,0 +1,29 @@
+/*
+ * VC-1 and WMV3 decoder - X86 DSP init functions
+ *
+ * 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
+ */
+
+#ifndef AVCODEC_X86_VC1DSP_H
+#define AVCODEC_X86_VC1DSP_H
+
+#include "libavcodec/vc1dsp.h"
+
+void ff_vc1dsp_init_mmx(VC1DSPContext *dsp);
+void ff_vc1dsp_init_mmxext(VC1DSPContext *dsp);
+
+#endif /* AVCODEC_X86_VC1DSP_H */
diff --git a/gst-libs/ext/libav/libavcodec/x86/vc1dsp_init.c b/gst-libs/ext/libav/libavcodec/x86/vc1dsp_init.c
new file mode 100644
index 0000000..230d06f
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/x86/vc1dsp_init.c
@@ -0,0 +1,123 @@
+/*
+ * VC-1 and WMV3 - DSP functions MMX-optimized
+ * Copyright (c) 2007 Christophe GISQUET <christophe.gisquet@free.fr>
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#include "libavutil/cpu.h"
+#include "libavutil/x86/cpu.h"
+#include "libavcodec/vc1dsp.h"
+#include "vc1dsp.h"
+#include "config.h"
+
+#define LOOP_FILTER(EXT) \
+void ff_vc1_v_loop_filter4_ ## EXT(uint8_t *src, int stride, int pq); \
+void ff_vc1_h_loop_filter4_ ## EXT(uint8_t *src, int stride, int pq); \
+void ff_vc1_v_loop_filter8_ ## EXT(uint8_t *src, int stride, int pq); \
+void ff_vc1_h_loop_filter8_ ## EXT(uint8_t *src, int stride, int pq); \
+\
+static void vc1_v_loop_filter16_ ## EXT(uint8_t *src, int stride, int pq) \
+{ \
+ ff_vc1_v_loop_filter8_ ## EXT(src, stride, pq); \
+ ff_vc1_v_loop_filter8_ ## EXT(src+8, stride, pq); \
+} \
+\
+static void vc1_h_loop_filter16_ ## EXT(uint8_t *src, int stride, int pq) \
+{ \
+ ff_vc1_h_loop_filter8_ ## EXT(src, stride, pq); \
+ ff_vc1_h_loop_filter8_ ## EXT(src+8*stride, stride, pq); \
+}
+
+#if HAVE_YASM
+LOOP_FILTER(mmxext)
+LOOP_FILTER(sse2)
+LOOP_FILTER(ssse3)
+
+void ff_vc1_h_loop_filter8_sse4(uint8_t *src, int stride, int pq);
+
+static void vc1_h_loop_filter16_sse4(uint8_t *src, int stride, int pq)
+{
+ ff_vc1_h_loop_filter8_sse4(src, stride, pq);
+ ff_vc1_h_loop_filter8_sse4(src+8*stride, stride, pq);
+}
+#endif /* HAVE_YASM */
+
+void ff_put_vc1_chroma_mc8_nornd_mmx (uint8_t *dst, uint8_t *src,
+ int stride, int h, int x, int y);
+void ff_avg_vc1_chroma_mc8_nornd_mmxext(uint8_t *dst, uint8_t *src,
+ int stride, int h, int x, int y);
+void ff_avg_vc1_chroma_mc8_nornd_3dnow(uint8_t *dst, uint8_t *src,
+ int stride, int h, int x, int y);
+void ff_put_vc1_chroma_mc8_nornd_ssse3(uint8_t *dst, uint8_t *src,
+ int stride, int h, int x, int y);
+void ff_avg_vc1_chroma_mc8_nornd_ssse3(uint8_t *dst, uint8_t *src,
+ int stride, int h, int x, int y);
+
+
+av_cold void ff_vc1dsp_init_x86(VC1DSPContext *dsp)
+{
+ int mm_flags = av_get_cpu_flags();
+
+ if (INLINE_MMX(mm_flags))
+ ff_vc1dsp_init_mmx(dsp);
+
+ if (INLINE_MMXEXT(mm_flags))
+ ff_vc1dsp_init_mmxext(dsp);
+
+#define ASSIGN_LF(EXT) \
+ dsp->vc1_v_loop_filter4 = ff_vc1_v_loop_filter4_ ## EXT; \
+ dsp->vc1_h_loop_filter4 = ff_vc1_h_loop_filter4_ ## EXT; \
+ dsp->vc1_v_loop_filter8 = ff_vc1_v_loop_filter8_ ## EXT; \
+ dsp->vc1_h_loop_filter8 = ff_vc1_h_loop_filter8_ ## EXT; \
+ dsp->vc1_v_loop_filter16 = vc1_v_loop_filter16_ ## EXT; \
+ dsp->vc1_h_loop_filter16 = vc1_h_loop_filter16_ ## EXT
+
+#if HAVE_YASM
+ if (mm_flags & AV_CPU_FLAG_MMX) {
+ dsp->put_no_rnd_vc1_chroma_pixels_tab[0] = ff_put_vc1_chroma_mc8_nornd_mmx;
+ }
+
+ if (mm_flags & AV_CPU_FLAG_MMXEXT) {
+ ASSIGN_LF(mmxext);
+ dsp->avg_no_rnd_vc1_chroma_pixels_tab[0] = ff_avg_vc1_chroma_mc8_nornd_mmxext;
+ } else if (mm_flags & AV_CPU_FLAG_3DNOW) {
+ dsp->avg_no_rnd_vc1_chroma_pixels_tab[0] = ff_avg_vc1_chroma_mc8_nornd_3dnow;
+ }
+
+ if (mm_flags & AV_CPU_FLAG_SSE2) {
+ dsp->vc1_v_loop_filter8 = ff_vc1_v_loop_filter8_sse2;
+ dsp->vc1_h_loop_filter8 = ff_vc1_h_loop_filter8_sse2;
+ dsp->vc1_v_loop_filter16 = vc1_v_loop_filter16_sse2;
+ dsp->vc1_h_loop_filter16 = vc1_h_loop_filter16_sse2;
+ }
+ if (mm_flags & AV_CPU_FLAG_SSSE3) {
+ ASSIGN_LF(ssse3);
+ dsp->put_no_rnd_vc1_chroma_pixels_tab[0] = ff_put_vc1_chroma_mc8_nornd_ssse3;
+ dsp->avg_no_rnd_vc1_chroma_pixels_tab[0] = ff_avg_vc1_chroma_mc8_nornd_ssse3;
+ }
+ if (mm_flags & AV_CPU_FLAG_SSE4) {
+ dsp->vc1_h_loop_filter8 = ff_vc1_h_loop_filter8_sse4;
+ dsp->vc1_h_loop_filter16 = vc1_h_loop_filter16_sse4;
+ }
+#endif /* HAVE_YASM */
+}
diff --git a/gst-libs/ext/libav/libavcodec/x86/vc1dsp_mmx.c b/gst-libs/ext/libav/libavcodec/x86/vc1dsp_mmx.c
index a525aee..b02582f 100644
--- a/gst-libs/ext/libav/libavcodec/x86/vc1dsp_mmx.c
+++ b/gst-libs/ext/libav/libavcodec/x86/vc1dsp_mmx.c
@@ -25,10 +25,16 @@
*/
#include "libavutil/cpu.h"
-#include "libavutil/x86_cpu.h"
+#include "libavutil/internal.h"
+#include "libavutil/mem.h"
+#include "libavutil/x86/asm.h"
+#include "libavutil/x86/cpu.h"
#include "libavcodec/dsputil.h"
#include "dsputil_mmx.h"
#include "libavcodec/vc1dsp.h"
+#include "vc1dsp.h"
+
+#if HAVE_INLINE_ASM
#define OP_PUT(S,D)
#define OP_AVG(S,D) "pavgb " #S ", " #D " \n\t"
@@ -461,7 +467,10 @@ VC1_MSPEL_MC(avg_)
static void put_vc1_mspel_mc ## a ## b ## _mmx(uint8_t *dst, const uint8_t *src, int stride, int rnd) { \
put_vc1_mspel_mc(dst, src, stride, a, b, rnd); \
}\
-static void avg_vc1_mspel_mc ## a ## b ## _mmx2(uint8_t *dst, const uint8_t *src, int stride, int rnd) { \
+static void avg_vc1_mspel_mc ## a ## b ## _mmxext(uint8_t *dst, \
+ const uint8_t *src, \
+ int stride, int rnd) \
+{ \
avg_vc1_mspel_mc(dst, src, stride, a, b, rnd); \
}
@@ -484,7 +493,8 @@ DECLARE_FUNCTION(3, 1)
DECLARE_FUNCTION(3, 2)
DECLARE_FUNCTION(3, 3)
-static void vc1_inv_trans_4x4_dc_mmx2(uint8_t *dest, int linesize, DCTELEM *block)
+static void vc1_inv_trans_4x4_dc_mmxext(uint8_t *dest, int linesize,
+ DCTELEM *block)
{
int dc = block[0];
dc = (17 * dc + 4) >> 3;
@@ -522,7 +532,8 @@ static void vc1_inv_trans_4x4_dc_mmx2(uint8_t *dest, int linesize, DCTELEM *bloc
);
}
-static void vc1_inv_trans_4x8_dc_mmx2(uint8_t *dest, int linesize, DCTELEM *block)
+static void vc1_inv_trans_4x8_dc_mmxext(uint8_t *dest, int linesize,
+ DCTELEM *block)
{
int dc = block[0];
dc = (17 * dc + 4) >> 3;
@@ -583,7 +594,8 @@ static void vc1_inv_trans_4x8_dc_mmx2(uint8_t *dest, int linesize, DCTELEM *bloc
);
}
-static void vc1_inv_trans_8x4_dc_mmx2(uint8_t *dest, int linesize, DCTELEM *block)
+static void vc1_inv_trans_8x4_dc_mmxext(uint8_t *dest, int linesize,
+ DCTELEM *block)
{
int dc = block[0];
dc = ( 3 * dc + 1) >> 1;
@@ -621,7 +633,8 @@ static void vc1_inv_trans_8x4_dc_mmx2(uint8_t *dest, int linesize, DCTELEM *bloc
);
}
-static void vc1_inv_trans_8x8_dc_mmx2(uint8_t *dest, int linesize, DCTELEM *block)
+static void vc1_inv_trans_8x8_dc_mmxext(uint8_t *dest, int linesize,
+ DCTELEM *block)
{
int dc = block[0];
dc = (3 * dc + 1) >> 1;
@@ -682,56 +695,8 @@ static void vc1_inv_trans_8x8_dc_mmx2(uint8_t *dest, int linesize, DCTELEM *bloc
);
}
-#define LOOP_FILTER(EXT) \
-void ff_vc1_v_loop_filter4_ ## EXT(uint8_t *src, int stride, int pq); \
-void ff_vc1_h_loop_filter4_ ## EXT(uint8_t *src, int stride, int pq); \
-void ff_vc1_v_loop_filter8_ ## EXT(uint8_t *src, int stride, int pq); \
-void ff_vc1_h_loop_filter8_ ## EXT(uint8_t *src, int stride, int pq); \
-\
-static void vc1_v_loop_filter16_ ## EXT(uint8_t *src, int stride, int pq) \
-{ \
- ff_vc1_v_loop_filter8_ ## EXT(src, stride, pq); \
- ff_vc1_v_loop_filter8_ ## EXT(src+8, stride, pq); \
-} \
-\
-static void vc1_h_loop_filter16_ ## EXT(uint8_t *src, int stride, int pq) \
-{ \
- ff_vc1_h_loop_filter8_ ## EXT(src, stride, pq); \
- ff_vc1_h_loop_filter8_ ## EXT(src+8*stride, stride, pq); \
-}
-
-#if HAVE_YASM
-LOOP_FILTER(mmx)
-LOOP_FILTER(mmx2)
-LOOP_FILTER(sse2)
-LOOP_FILTER(ssse3)
-
-void ff_vc1_h_loop_filter8_sse4(uint8_t *src, int stride, int pq);
-
-static void vc1_h_loop_filter16_sse4(uint8_t *src, int stride, int pq)
+av_cold void ff_vc1dsp_init_mmx(VC1DSPContext *dsp)
{
- ff_vc1_h_loop_filter8_sse4(src, stride, pq);
- ff_vc1_h_loop_filter8_sse4(src+8*stride, stride, pq);
-}
-
-#endif
-
-void ff_put_vc1_chroma_mc8_mmx_nornd (uint8_t *dst, uint8_t *src,
- int stride, int h, int x, int y);
-void ff_avg_vc1_chroma_mc8_mmx2_nornd (uint8_t *dst, uint8_t *src,
- int stride, int h, int x, int y);
-void ff_avg_vc1_chroma_mc8_3dnow_nornd(uint8_t *dst, uint8_t *src,
- int stride, int h, int x, int y);
-void ff_put_vc1_chroma_mc8_ssse3_nornd(uint8_t *dst, uint8_t *src,
- int stride, int h, int x, int y);
-void ff_avg_vc1_chroma_mc8_ssse3_nornd(uint8_t *dst, uint8_t *src,
- int stride, int h, int x, int y);
-
-void ff_vc1dsp_init_mmx(VC1DSPContext *dsp)
-{
- int mm_flags = av_get_cpu_flags();
-
- if (mm_flags & AV_CPU_FLAG_MMX) {
dsp->put_vc1_mspel_pixels_tab[ 0] = ff_put_vc1_mspel_mc00_mmx;
dsp->put_vc1_mspel_pixels_tab[ 4] = put_vc1_mspel_mc01_mmx;
dsp->put_vc1_mspel_pixels_tab[ 8] = put_vc1_mspel_mc02_mmx;
@@ -751,70 +716,33 @@ void ff_vc1dsp_init_mmx(VC1DSPContext *dsp)
dsp->put_vc1_mspel_pixels_tab[ 7] = put_vc1_mspel_mc31_mmx;
dsp->put_vc1_mspel_pixels_tab[11] = put_vc1_mspel_mc32_mmx;
dsp->put_vc1_mspel_pixels_tab[15] = put_vc1_mspel_mc33_mmx;
- }
-
- if (mm_flags & AV_CPU_FLAG_MMX2){
- dsp->avg_vc1_mspel_pixels_tab[ 0] = ff_avg_vc1_mspel_mc00_mmx2;
- dsp->avg_vc1_mspel_pixels_tab[ 4] = avg_vc1_mspel_mc01_mmx2;
- dsp->avg_vc1_mspel_pixels_tab[ 8] = avg_vc1_mspel_mc02_mmx2;
- dsp->avg_vc1_mspel_pixels_tab[12] = avg_vc1_mspel_mc03_mmx2;
-
- dsp->avg_vc1_mspel_pixels_tab[ 1] = avg_vc1_mspel_mc10_mmx2;
- dsp->avg_vc1_mspel_pixels_tab[ 5] = avg_vc1_mspel_mc11_mmx2;
- dsp->avg_vc1_mspel_pixels_tab[ 9] = avg_vc1_mspel_mc12_mmx2;
- dsp->avg_vc1_mspel_pixels_tab[13] = avg_vc1_mspel_mc13_mmx2;
-
- dsp->avg_vc1_mspel_pixels_tab[ 2] = avg_vc1_mspel_mc20_mmx2;
- dsp->avg_vc1_mspel_pixels_tab[ 6] = avg_vc1_mspel_mc21_mmx2;
- dsp->avg_vc1_mspel_pixels_tab[10] = avg_vc1_mspel_mc22_mmx2;
- dsp->avg_vc1_mspel_pixels_tab[14] = avg_vc1_mspel_mc23_mmx2;
-
- dsp->avg_vc1_mspel_pixels_tab[ 3] = avg_vc1_mspel_mc30_mmx2;
- dsp->avg_vc1_mspel_pixels_tab[ 7] = avg_vc1_mspel_mc31_mmx2;
- dsp->avg_vc1_mspel_pixels_tab[11] = avg_vc1_mspel_mc32_mmx2;
- dsp->avg_vc1_mspel_pixels_tab[15] = avg_vc1_mspel_mc33_mmx2;
-
- dsp->vc1_inv_trans_8x8_dc = vc1_inv_trans_8x8_dc_mmx2;
- dsp->vc1_inv_trans_4x8_dc = vc1_inv_trans_4x8_dc_mmx2;
- dsp->vc1_inv_trans_8x4_dc = vc1_inv_trans_8x4_dc_mmx2;
- dsp->vc1_inv_trans_4x4_dc = vc1_inv_trans_4x4_dc_mmx2;
- }
-
-#define ASSIGN_LF(EXT) \
- dsp->vc1_v_loop_filter4 = ff_vc1_v_loop_filter4_ ## EXT; \
- dsp->vc1_h_loop_filter4 = ff_vc1_h_loop_filter4_ ## EXT; \
- dsp->vc1_v_loop_filter8 = ff_vc1_v_loop_filter8_ ## EXT; \
- dsp->vc1_h_loop_filter8 = ff_vc1_h_loop_filter8_ ## EXT; \
- dsp->vc1_v_loop_filter16 = vc1_v_loop_filter16_ ## EXT; \
- dsp->vc1_h_loop_filter16 = vc1_h_loop_filter16_ ## EXT
-
-#if HAVE_YASM
- if (mm_flags & AV_CPU_FLAG_MMX) {
- ASSIGN_LF(mmx);
- dsp->put_no_rnd_vc1_chroma_pixels_tab[0]= ff_put_vc1_chroma_mc8_mmx_nornd;
- }
- return;
- if (mm_flags & AV_CPU_FLAG_MMX2) {
- ASSIGN_LF(mmx2);
- dsp->avg_no_rnd_vc1_chroma_pixels_tab[0]= ff_avg_vc1_chroma_mc8_mmx2_nornd;
- } else if (mm_flags & AV_CPU_FLAG_3DNOW) {
- dsp->avg_no_rnd_vc1_chroma_pixels_tab[0]= ff_avg_vc1_chroma_mc8_3dnow_nornd;
- }
-
- if (mm_flags & AV_CPU_FLAG_SSE2) {
- dsp->vc1_v_loop_filter8 = ff_vc1_v_loop_filter8_sse2;
- dsp->vc1_h_loop_filter8 = ff_vc1_h_loop_filter8_sse2;
- dsp->vc1_v_loop_filter16 = vc1_v_loop_filter16_sse2;
- dsp->vc1_h_loop_filter16 = vc1_h_loop_filter16_sse2;
- }
- if (mm_flags & AV_CPU_FLAG_SSSE3) {
- ASSIGN_LF(ssse3);
- dsp->put_no_rnd_vc1_chroma_pixels_tab[0]= ff_put_vc1_chroma_mc8_ssse3_nornd;
- dsp->avg_no_rnd_vc1_chroma_pixels_tab[0]= ff_avg_vc1_chroma_mc8_ssse3_nornd;
- }
- if (mm_flags & AV_CPU_FLAG_SSE4) {
- dsp->vc1_h_loop_filter8 = ff_vc1_h_loop_filter8_sse4;
- dsp->vc1_h_loop_filter16 = vc1_h_loop_filter16_sse4;
- }
-#endif
}
+
+av_cold void ff_vc1dsp_init_mmxext(VC1DSPContext *dsp)
+{
+ dsp->avg_vc1_mspel_pixels_tab[ 0] = ff_avg_vc1_mspel_mc00_mmxext;
+ dsp->avg_vc1_mspel_pixels_tab[ 4] = avg_vc1_mspel_mc01_mmxext;
+ dsp->avg_vc1_mspel_pixels_tab[ 8] = avg_vc1_mspel_mc02_mmxext;
+ dsp->avg_vc1_mspel_pixels_tab[12] = avg_vc1_mspel_mc03_mmxext;
+
+ dsp->avg_vc1_mspel_pixels_tab[ 1] = avg_vc1_mspel_mc10_mmxext;
+ dsp->avg_vc1_mspel_pixels_tab[ 5] = avg_vc1_mspel_mc11_mmxext;
+ dsp->avg_vc1_mspel_pixels_tab[ 9] = avg_vc1_mspel_mc12_mmxext;
+ dsp->avg_vc1_mspel_pixels_tab[13] = avg_vc1_mspel_mc13_mmxext;
+
+ dsp->avg_vc1_mspel_pixels_tab[ 2] = avg_vc1_mspel_mc20_mmxext;
+ dsp->avg_vc1_mspel_pixels_tab[ 6] = avg_vc1_mspel_mc21_mmxext;
+ dsp->avg_vc1_mspel_pixels_tab[10] = avg_vc1_mspel_mc22_mmxext;
+ dsp->avg_vc1_mspel_pixels_tab[14] = avg_vc1_mspel_mc23_mmxext;
+
+ dsp->avg_vc1_mspel_pixels_tab[ 3] = avg_vc1_mspel_mc30_mmxext;
+ dsp->avg_vc1_mspel_pixels_tab[ 7] = avg_vc1_mspel_mc31_mmxext;
+ dsp->avg_vc1_mspel_pixels_tab[11] = avg_vc1_mspel_mc32_mmxext;
+ dsp->avg_vc1_mspel_pixels_tab[15] = avg_vc1_mspel_mc33_mmxext;
+
+ dsp->vc1_inv_trans_8x8_dc = vc1_inv_trans_8x8_dc_mmxext;
+ dsp->vc1_inv_trans_4x8_dc = vc1_inv_trans_4x8_dc_mmxext;
+ dsp->vc1_inv_trans_8x4_dc = vc1_inv_trans_8x4_dc_mmxext;
+ dsp->vc1_inv_trans_4x4_dc = vc1_inv_trans_4x4_dc_mmxext;
+}
+#endif /* HAVE_INLINE_ASM */
diff --git a/gst-libs/ext/libav/libavcodec/x86/vc1dsp_yasm.asm b/gst-libs/ext/libav/libavcodec/x86/vc1dsp_yasm.asm
deleted file mode 100644
index 66f61db..0000000
--- a/gst-libs/ext/libav/libavcodec/x86/vc1dsp_yasm.asm
+++ /dev/null
@@ -1,330 +0,0 @@
-;******************************************************************************
-;* VC1 deblocking optimizations
-;* Copyright (c) 2009 David Conrad
-;*
-;* 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
-;******************************************************************************
-
-%include "x86inc.asm"
-%include "x86util.asm"
-
-cextern pw_4
-cextern pw_5
-
-section .text
-
-; dst_low, dst_high (src), zero
-; zero-extends one vector from 8 to 16 bits
-%macro UNPACK_8TO16 4
- mova m%2, m%3
- punpckh%1 m%3, m%4
- punpckl%1 m%2, m%4
-%endmacro
-
-%macro STORE_4_WORDS_MMX 6
- movd %6d, %5
-%if mmsize==16
- psrldq %5, 4
-%else
- psrlq %5, 32
-%endif
- mov %1, %6w
- shr %6, 16
- mov %2, %6w
- movd %6d, %5
- mov %3, %6w
- shr %6, 16
- mov %4, %6w
-%endmacro
-
-%macro STORE_4_WORDS_SSE4 6
- pextrw %1, %5, %6+0
- pextrw %2, %5, %6+1
- pextrw %3, %5, %6+2
- pextrw %4, %5, %6+3
-%endmacro
-
-; in: p1 p0 q0 q1, clobbers p0
-; out: p1 = (2*(p1 - q1) - 5*(p0 - q0) + 4) >> 3
-%macro VC1_LOOP_FILTER_A0 4
- psubw %1, %4
- psubw %2, %3
- paddw %1, %1
- pmullw %2, [pw_5]
- psubw %1, %2
- paddw %1, [pw_4]
- psraw %1, 3
-%endmacro
-
-; in: p0 q0 a0 a1 a2
-; m0 m1 m7 m6 m5
-; %1: size
-; out: m0=p0' m1=q0'
-%macro VC1_FILTER 1
- PABSW m4, m7
- PABSW m3, m6
- PABSW m2, m5
- mova m6, m4
- pminsw m3, m2
- pcmpgtw m6, m3 ; if (a2 < a0 || a1 < a0)
- psubw m3, m4
- pmullw m3, [pw_5] ; 5*(a3 - a0)
- PABSW m2, m3
- psraw m2, 3 ; abs(d/8)
- pxor m7, m3 ; d_sign ^= a0_sign
-
- pxor m5, m5
- movd m3, r2d
-%if %1 > 4
- punpcklbw m3, m3
-%endif
- punpcklbw m3, m5
- pcmpgtw m3, m4 ; if (a0 < pq)
- pand m6, m3
-
- mova m3, m0
- psubw m3, m1
- PABSW m4, m3
- psraw m4, 1
- pxor m3, m7 ; d_sign ^ clip_sign
- psraw m3, 15
- pminsw m2, m4 ; min(d, clip)
- pcmpgtw m4, m5
- pand m6, m4 ; filt3 (C return value)
-
-; each set of 4 pixels is not filtered if the 3rd is not
-%if mmsize==16
- pshuflw m4, m6, 0xaa
-%if %1 > 4
- pshufhw m4, m4, 0xaa
-%endif
-%else
- pshufw m4, m6, 0xaa
-%endif
- pandn m3, m4
- pand m2, m6
- pand m3, m2 ; d final
-
- PSIGNW m3, m7
- psubw m0, m3
- paddw m1, m3
- packuswb m0, m0
- packuswb m1, m1
-%endmacro
-
-; 1st param: size of filter
-; 2nd param: mov suffix equivalent to the filter size
-%macro VC1_V_LOOP_FILTER 2
- pxor m5, m5
- mov%2 m6, [r4]
- mov%2 m4, [r4+r1]
- mov%2 m7, [r4+2*r1]
- mov%2 m0, [r4+r3]
- punpcklbw m6, m5
- punpcklbw m4, m5
- punpcklbw m7, m5
- punpcklbw m0, m5
-
- VC1_LOOP_FILTER_A0 m6, m4, m7, m0
- mov%2 m1, [r0]
- mov%2 m2, [r0+r1]
- punpcklbw m1, m5
- punpcklbw m2, m5
- mova m4, m0
- VC1_LOOP_FILTER_A0 m7, m4, m1, m2
- mov%2 m3, [r0+2*r1]
- mov%2 m4, [r0+r3]
- punpcklbw m3, m5
- punpcklbw m4, m5
- mova m5, m1
- VC1_LOOP_FILTER_A0 m5, m2, m3, m4
-
- VC1_FILTER %1
- mov%2 [r4+r3], m0
- mov%2 [r0], m1
-%endmacro
-
-; 1st param: size of filter
-; NOTE: UNPACK_8TO16 this number of 8 bit numbers are in half a register
-; 2nd (optional) param: temp register to use for storing words
-%macro VC1_H_LOOP_FILTER 1-2
-%if %1 == 4
- movq m0, [r0 -4]
- movq m1, [r0+ r1-4]
- movq m2, [r0+2*r1-4]
- movq m3, [r0+ r3-4]
- TRANSPOSE4x4B 0, 1, 2, 3, 4
-%else
- movq m0, [r0 -4]
- movq m4, [r0+ r1-4]
- movq m1, [r0+2*r1-4]
- movq m5, [r0+ r3-4]
- movq m2, [r4 -4]
- movq m6, [r4+ r1-4]
- movq m3, [r4+2*r1-4]
- movq m7, [r4+ r3-4]
- punpcklbw m0, m4
- punpcklbw m1, m5
- punpcklbw m2, m6
- punpcklbw m3, m7
- TRANSPOSE4x4W 0, 1, 2, 3, 4
-%endif
- pxor m5, m5
-
- UNPACK_8TO16 bw, 6, 0, 5
- UNPACK_8TO16 bw, 7, 1, 5
- VC1_LOOP_FILTER_A0 m6, m0, m7, m1
- UNPACK_8TO16 bw, 4, 2, 5
- mova m0, m1 ; m0 = p0
- VC1_LOOP_FILTER_A0 m7, m1, m4, m2
- UNPACK_8TO16 bw, 1, 3, 5
- mova m5, m4
- VC1_LOOP_FILTER_A0 m5, m2, m1, m3
- SWAP 1, 4 ; m1 = q0
-
- VC1_FILTER %1
- punpcklbw m0, m1
-%if %0 > 1
- STORE_4_WORDS_MMX [r0-1], [r0+r1-1], [r0+2*r1-1], [r0+r3-1], m0, %2
-%if %1 > 4
- psrldq m0, 4
- STORE_4_WORDS_MMX [r4-1], [r4+r1-1], [r4+2*r1-1], [r4+r3-1], m0, %2
-%endif
-%else
- STORE_4_WORDS_SSE4 [r0-1], [r0+r1-1], [r0+2*r1-1], [r0+r3-1], m0, 0
- STORE_4_WORDS_SSE4 [r4-1], [r4+r1-1], [r4+2*r1-1], [r4+r3-1], m0, 4
-%endif
-%endmacro
-
-
-%macro START_V_FILTER 0
- mov r4, r0
- lea r3, [4*r1]
- sub r4, r3
- lea r3, [r1+2*r1]
- imul r2, 0x01010101
-%endmacro
-
-%macro START_H_FILTER 1
- lea r3, [r1+2*r1]
-%if %1 > 4
- lea r4, [r0+4*r1]
-%endif
- imul r2, 0x01010101
-%endmacro
-
-; I do not know why the sign extension is needed...
-%macro PSIGNW_SRA_MMX 2
- psraw %2, 15
- PSIGNW_MMX %1, %2
-%endmacro
-
-
-%macro VC1_LF_MMX 1
-INIT_MMX
-cglobal vc1_v_loop_filter_internal_%1
- VC1_V_LOOP_FILTER 4, d
- ret
-
-cglobal vc1_h_loop_filter_internal_%1
- VC1_H_LOOP_FILTER 4, r4
- ret
-
-; void ff_vc1_v_loop_filter4_mmx2(uint8_t *src, int stride, int pq)
-cglobal vc1_v_loop_filter4_%1, 3,5,0
- START_V_FILTER
- call vc1_v_loop_filter_internal_%1
- RET
-
-; void ff_vc1_h_loop_filter4_mmx2(uint8_t *src, int stride, int pq)
-cglobal vc1_h_loop_filter4_%1, 3,5,0
- START_H_FILTER 4
- call vc1_h_loop_filter_internal_%1
- RET
-
-; void ff_vc1_v_loop_filter8_mmx2(uint8_t *src, int stride, int pq)
-cglobal vc1_v_loop_filter8_%1, 3,5,0
- START_V_FILTER
- call vc1_v_loop_filter_internal_%1
- add r4, 4
- add r0, 4
- call vc1_v_loop_filter_internal_%1
- RET
-
-; void ff_vc1_h_loop_filter8_mmx2(uint8_t *src, int stride, int pq)
-cglobal vc1_h_loop_filter8_%1, 3,5,0
- START_H_FILTER 4
- call vc1_h_loop_filter_internal_%1
- lea r0, [r0+4*r1]
- call vc1_h_loop_filter_internal_%1
- RET
-%endmacro
-
-%define PABSW PABSW_MMX
-%define PSIGNW PSIGNW_SRA_MMX
-VC1_LF_MMX mmx
-
-%define PABSW PABSW_MMX2
-VC1_LF_MMX mmx2
-
-INIT_XMM
-; void ff_vc1_v_loop_filter8_sse2(uint8_t *src, int stride, int pq)
-cglobal vc1_v_loop_filter8_sse2, 3,5,8
- START_V_FILTER
- VC1_V_LOOP_FILTER 8, q
- RET
-
-; void ff_vc1_h_loop_filter8_sse2(uint8_t *src, int stride, int pq)
-cglobal vc1_h_loop_filter8_sse2, 3,6,8
- START_H_FILTER 8
- VC1_H_LOOP_FILTER 8, r5
- RET
-
-%define PABSW PABSW_SSSE3
-%define PSIGNW PSIGNW_SSSE3
-
-INIT_MMX
-; void ff_vc1_v_loop_filter4_ssse3(uint8_t *src, int stride, int pq)
-cglobal vc1_v_loop_filter4_ssse3, 3,5,0
- START_V_FILTER
- VC1_V_LOOP_FILTER 4, d
- RET
-
-; void ff_vc1_h_loop_filter4_ssse3(uint8_t *src, int stride, int pq)
-cglobal vc1_h_loop_filter4_ssse3, 3,5,0
- START_H_FILTER 4
- VC1_H_LOOP_FILTER 4, r4
- RET
-
-INIT_XMM
-; void ff_vc1_v_loop_filter8_ssse3(uint8_t *src, int stride, int pq)
-cglobal vc1_v_loop_filter8_ssse3, 3,5,8
- START_V_FILTER
- VC1_V_LOOP_FILTER 8, q
- RET
-
-; void ff_vc1_h_loop_filter8_ssse3(uint8_t *src, int stride, int pq)
-cglobal vc1_h_loop_filter8_ssse3, 3,6,8
- START_H_FILTER 8
- VC1_H_LOOP_FILTER 8, r5
- RET
-
-; void ff_vc1_h_loop_filter8_sse4(uint8_t *src, int stride, int pq)
-cglobal vc1_h_loop_filter8_sse4, 3,5,8
- START_H_FILTER 8
- VC1_H_LOOP_FILTER 8
- RET
diff --git a/gst-libs/ext/libav/libavcodec/x86/videodsp.asm b/gst-libs/ext/libav/libavcodec/x86/videodsp.asm
new file mode 100644
index 0000000..19b910b
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/x86/videodsp.asm
@@ -0,0 +1,612 @@
+;******************************************************************************
+;* Core video DSP functions
+;* Copyright (c) 2012 Ronald S. Bultje <rsbultje@gmail.com>
+;*
+;* 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
+;******************************************************************************
+
+%include "libavutil/x86/x86util.asm"
+
+SECTION .text
+
+; extern void ff_emu_edge_core(uint8_t *buf, const uint8_t *src, x86_reg linesize,
+; x86_reg start_y, x86_reg end_y, x86_reg block_h,
+; x86_reg start_x, x86_reg end_x, x86_reg block_w);
+;
+; The actual function itself is below. It basically wraps a very simple
+; w = end_x - start_x
+; if (w) {
+; if (w > 22) {
+; jump to the slow loop functions
+; } else {
+; jump to the fast loop functions
+; }
+; }
+;
+; ... and then the same for left/right extend also. See below for loop
+; function implementations. Fast are fixed-width, slow is variable-width
+
+%macro EMU_EDGE_FUNC 0
+%if ARCH_X86_64
+%define w_reg r7
+cglobal emu_edge_core, 6, 9, 1
+ mov r8, r5 ; save block_h
+%else
+%define w_reg r6
+cglobal emu_edge_core, 2, 7, 0
+ mov r4, r4m ; end_y
+ mov r5, r5m ; block_h
+%endif
+
+ ; start with vertical extend (top/bottom) and body pixel copy
+ mov w_reg, r7m
+ sub w_reg, r6m ; w = start_x - end_x
+ sub r5, r4
+%if ARCH_X86_64
+ sub r4, r3
+%else
+ sub r4, dword r3m
+%endif
+ cmp w_reg, 22
+ jg .slow_v_extend_loop
+%if ARCH_X86_32
+ mov r2, r2m ; linesize
+%endif
+ sal w_reg, 7 ; w * 128
+%ifdef PIC
+ lea rax, [.emuedge_v_extend_1 - (.emuedge_v_extend_2 - .emuedge_v_extend_1)]
+ add w_reg, rax
+%else
+ lea w_reg, [.emuedge_v_extend_1 - (.emuedge_v_extend_2 - .emuedge_v_extend_1)+w_reg]
+%endif
+ call w_reg ; fast top extend, body copy and bottom extend
+.v_extend_end:
+
+ ; horizontal extend (left/right)
+ mov w_reg, r6m ; start_x
+ sub r0, w_reg
+%if ARCH_X86_64
+ mov r3, r0 ; backup of buf+block_h*linesize
+ mov r5, r8
+%else
+ mov r0m, r0 ; backup of buf+block_h*linesize
+ mov r5, r5m
+%endif
+ test w_reg, w_reg
+ jz .right_extend
+ cmp w_reg, 22
+ jg .slow_left_extend_loop
+ mov r1, w_reg
+ dec w_reg
+ ; FIXME we can do a if size == 1 here if that makes any speed difference, test me
+ sar w_reg, 1
+ sal w_reg, 6
+ ; r0=buf+block_h*linesize,r7(64)/r6(32)=start_x offset for funcs
+ ; r6(rax)/r3(ebx)=val,r2=linesize,r1=start_x,r5=block_h
+%ifdef PIC
+ lea rax, [.emuedge_extend_left_2]
+ add w_reg, rax
+%else
+ lea w_reg, [.emuedge_extend_left_2+w_reg]
+%endif
+ call w_reg
+
+ ; now r3(64)/r0(32)=buf,r2=linesize,r8/r5=block_h,r6/r3=val, r7/r6=end_x, r1=block_w
+.right_extend:
+%if ARCH_X86_32
+ mov r0, r0m
+ mov r5, r5m
+%endif
+ mov w_reg, r7m ; end_x
+ mov r1, r8m ; block_w
+ mov r4, r1
+ sub r1, w_reg
+ jz .h_extend_end ; if (end_x == block_w) goto h_extend_end
+ cmp r1, 22
+ jg .slow_right_extend_loop
+ dec r1
+ ; FIXME we can do a if size == 1 here if that makes any speed difference, test me
+ sar r1, 1
+ sal r1, 6
+%ifdef PIC
+ lea rax, [.emuedge_extend_right_2]
+ add r1, rax
+%else
+ lea r1, [.emuedge_extend_right_2+r1]
+%endif
+ call r1
+.h_extend_end:
+ RET
+
+%if ARCH_X86_64
+%define vall al
+%define valh ah
+%define valw ax
+%define valw2 r7w
+%define valw3 r3w
+%if WIN64
+%define valw4 r7w
+%else ; unix64
+%define valw4 r3w
+%endif
+%define vald eax
+%else
+%define vall bl
+%define valh bh
+%define valw bx
+%define valw2 r6w
+%define valw3 valw2
+%define valw4 valw3
+%define vald ebx
+%define stack_offset 0x14
+%endif
+
+%endmacro
+
+; macro to read/write a horizontal number of pixels (%2) to/from registers
+; on x86-64, - fills xmm0-15 for consecutive sets of 16 pixels
+; - if (%2 & 15 == 8) fills the last 8 bytes into rax
+; - else if (%2 & 8) fills 8 bytes into mm0
+; - if (%2 & 7 == 4) fills the last 4 bytes into rax
+; - else if (%2 & 4) fills 4 bytes into mm0-1
+; - if (%2 & 3 == 3) fills 2 bytes into r7/r3, and 1 into eax
+; (note that we're using r3 for body/bottom because it's a shorter
+; opcode, and then the loop fits in 128 bytes)
+; - else fills remaining bytes into rax
+; on x86-32, - fills mm0-7 for consecutive sets of 8 pixels
+; - if (%2 & 7 == 4) fills 4 bytes into ebx
+; - else if (%2 & 4) fills 4 bytes into mm0-7
+; - if (%2 & 3 == 3) fills 2 bytes into r6, and 1 into ebx
+; - else fills remaining bytes into ebx
+; writing data out is in the same way
+%macro READ_NUM_BYTES 2
+%assign %%src_off 0 ; offset in source buffer
+%assign %%smidx 0 ; mmx register idx
+%assign %%sxidx 0 ; xmm register idx
+
+%if cpuflag(sse)
+%rep %2/16
+ movups xmm %+ %%sxidx, [r1+%%src_off]
+%assign %%src_off %%src_off+16
+%assign %%sxidx %%sxidx+1
+%endrep ; %2/16
+%endif
+
+%if ARCH_X86_64
+%if (%2-%%src_off) == 8
+ mov rax, [r1+%%src_off]
+%assign %%src_off %%src_off+8
+%endif ; (%2-%%src_off) == 8
+%endif ; x86-64
+
+%rep (%2-%%src_off)/8
+ movq mm %+ %%smidx, [r1+%%src_off]
+%assign %%src_off %%src_off+8
+%assign %%smidx %%smidx+1
+%endrep ; (%2-%%dst_off)/8
+
+%if (%2-%%src_off) == 4
+ mov vald, [r1+%%src_off]
+%elif (%2-%%src_off) & 4
+ movd mm %+ %%smidx, [r1+%%src_off]
+%assign %%src_off %%src_off+4
+%endif ; (%2-%%src_off) ==/& 4
+
+%if (%2-%%src_off) == 1
+ mov vall, [r1+%%src_off]
+%elif (%2-%%src_off) == 2
+ mov valw, [r1+%%src_off]
+%elif (%2-%%src_off) == 3
+%ifidn %1, top
+ mov valw2, [r1+%%src_off]
+%elifidn %1, body
+ mov valw3, [r1+%%src_off]
+%elifidn %1, bottom
+ mov valw4, [r1+%%src_off]
+%endif ; %1 ==/!= top
+ mov vall, [r1+%%src_off+2]
+%endif ; (%2-%%src_off) == 1/2/3
+%endmacro ; READ_NUM_BYTES
+
+%macro WRITE_NUM_BYTES 2
+%assign %%dst_off 0 ; offset in destination buffer
+%assign %%dmidx 0 ; mmx register idx
+%assign %%dxidx 0 ; xmm register idx
+
+%if cpuflag(sse)
+%rep %2/16
+ movups [r0+%%dst_off], xmm %+ %%dxidx
+%assign %%dst_off %%dst_off+16
+%assign %%dxidx %%dxidx+1
+%endrep ; %2/16
+%endif
+
+%if ARCH_X86_64
+%if (%2-%%dst_off) == 8
+ mov [r0+%%dst_off], rax
+%assign %%dst_off %%dst_off+8
+%endif ; (%2-%%dst_off) == 8
+%endif ; x86-64
+
+%rep (%2-%%dst_off)/8
+ movq [r0+%%dst_off], mm %+ %%dmidx
+%assign %%dst_off %%dst_off+8
+%assign %%dmidx %%dmidx+1
+%endrep ; (%2-%%dst_off)/8
+
+%if (%2-%%dst_off) == 4
+ mov [r0+%%dst_off], vald
+%elif (%2-%%dst_off) & 4
+ movd [r0+%%dst_off], mm %+ %%dmidx
+%assign %%dst_off %%dst_off+4
+%endif ; (%2-%%dst_off) ==/& 4
+
+%if (%2-%%dst_off) == 1
+ mov [r0+%%dst_off], vall
+%elif (%2-%%dst_off) == 2
+ mov [r0+%%dst_off], valw
+%elif (%2-%%dst_off) == 3
+%ifidn %1, top
+ mov [r0+%%dst_off], valw2
+%elifidn %1, body
+ mov [r0+%%dst_off], valw3
+%elifidn %1, bottom
+ mov [r0+%%dst_off], valw4
+%endif ; %1 ==/!= top
+ mov [r0+%%dst_off+2], vall
+%endif ; (%2-%%dst_off) == 1/2/3
+%endmacro ; WRITE_NUM_BYTES
+
+; vertical top/bottom extend and body copy fast loops
+; these are function pointers to set-width line copy functions, i.e.
+; they read a fixed number of pixels into set registers, and write
+; those out into the destination buffer
+; r0=buf,r1=src,r2=linesize,r3(64)/r3m(32)=start_x,r4=end_y,r5=block_h
+; r6(eax/64)/r3(ebx/32)=val_reg
+%macro VERTICAL_EXTEND 0
+%assign %%n 1
+%rep 22
+ALIGN 128
+.emuedge_v_extend_ %+ %%n:
+ ; extend pixels above body
+%if ARCH_X86_64
+ test r3 , r3 ; if (!start_y)
+ jz .emuedge_copy_body_ %+ %%n %+ _loop ; goto body
+%else ; ARCH_X86_32
+ cmp dword r3m, 0
+ je .emuedge_copy_body_ %+ %%n %+ _loop
+%endif ; ARCH_X86_64/32
+ READ_NUM_BYTES top, %%n ; read bytes
+.emuedge_extend_top_ %+ %%n %+ _loop: ; do {
+ WRITE_NUM_BYTES top, %%n ; write bytes
+ add r0 , r2 ; dst += linesize
+%if ARCH_X86_64
+ dec r3d
+%else ; ARCH_X86_32
+ dec dword r3m
+%endif ; ARCH_X86_64/32
+ jnz .emuedge_extend_top_ %+ %%n %+ _loop ; } while (--start_y)
+
+ ; copy body pixels
+.emuedge_copy_body_ %+ %%n %+ _loop: ; do {
+ READ_NUM_BYTES body, %%n ; read bytes
+ WRITE_NUM_BYTES body, %%n ; write bytes
+ add r0 , r2 ; dst += linesize
+ add r1 , r2 ; src += linesize
+ dec r4d
+ jnz .emuedge_copy_body_ %+ %%n %+ _loop ; } while (--end_y)
+
+ ; copy bottom pixels
+ test r5 , r5 ; if (!block_h)
+ jz .emuedge_v_extend_end_ %+ %%n ; goto end
+ sub r1 , r2 ; src -= linesize
+ READ_NUM_BYTES bottom, %%n ; read bytes
+.emuedge_extend_bottom_ %+ %%n %+ _loop: ; do {
+ WRITE_NUM_BYTES bottom, %%n ; write bytes
+ add r0 , r2 ; dst += linesize
+ dec r5d
+ jnz .emuedge_extend_bottom_ %+ %%n %+ _loop ; } while (--block_h)
+
+.emuedge_v_extend_end_ %+ %%n:
+%if ARCH_X86_64
+ ret
+%else ; ARCH_X86_32
+ rep ret
+%endif ; ARCH_X86_64/32
+%assign %%n %%n+1
+%endrep
+%endmacro VERTICAL_EXTEND
+
+; left/right (horizontal) fast extend functions
+; these are essentially identical to the vertical extend ones above,
+; just left/right separated because number of pixels to extend is
+; obviously not the same on both sides.
+; for reading, pixels are placed in eax (x86-64) or ebx (x86-64) in the
+; lowest two bytes of the register (so val*0x0101), and are splatted
+; into each byte of mm0 as well if n_pixels >= 8
+
+%macro READ_V_PIXEL 2
+ mov vall, %2
+ mov valh, vall
+%if %1 >= 8
+ movd mm0, vald
+%if cpuflag(mmxext)
+ pshufw mm0, mm0, 0
+%else ; mmx
+ punpcklwd mm0, mm0
+ punpckldq mm0, mm0
+%endif ; sse
+%endif ; %1 >= 8
+%endmacro
+
+%macro WRITE_V_PIXEL 2
+%assign %%dst_off 0
+%rep %1/8
+ movq [%2+%%dst_off], mm0
+%assign %%dst_off %%dst_off+8
+%endrep
+%if %1 & 4
+%if %1 >= 8
+ movd [%2+%%dst_off], mm0
+%else ; %1 < 8
+ mov [%2+%%dst_off] , valw
+ mov [%2+%%dst_off+2], valw
+%endif ; %1 >=/< 8
+%assign %%dst_off %%dst_off+4
+%endif ; %1 & 4
+%if %1&2
+ mov [%2+%%dst_off], valw
+%endif ; %1 & 2
+%endmacro
+
+; r0=buf+block_h*linesize, r1=start_x, r2=linesize, r5=block_h, r6/r3=val
+%macro LEFT_EXTEND 0
+%assign %%n 2
+%rep 11
+ALIGN 64
+.emuedge_extend_left_ %+ %%n: ; do {
+ sub r0, r2 ; dst -= linesize
+ READ_V_PIXEL %%n, [r0+r1] ; read pixels
+ WRITE_V_PIXEL %%n, r0 ; write pixels
+ dec r5
+ jnz .emuedge_extend_left_ %+ %%n ; } while (--block_h)
+%if ARCH_X86_64
+ ret
+%else ; ARCH_X86_32
+ rep ret
+%endif ; ARCH_X86_64/32
+%assign %%n %%n+2
+%endrep
+%endmacro ; LEFT_EXTEND
+
+; r3/r0=buf+block_h*linesize, r2=linesize, r8/r5=block_h, r0/r6=end_x, r6/r3=val
+%macro RIGHT_EXTEND 0
+%assign %%n 2
+%rep 11
+ALIGN 64
+.emuedge_extend_right_ %+ %%n: ; do {
+%if ARCH_X86_64
+ sub r3, r2 ; dst -= linesize
+ READ_V_PIXEL %%n, [r3+w_reg-1] ; read pixels
+ WRITE_V_PIXEL %%n, r3+r4-%%n ; write pixels
+ dec r8
+%else ; ARCH_X86_32
+ sub r0, r2 ; dst -= linesize
+ READ_V_PIXEL %%n, [r0+w_reg-1] ; read pixels
+ WRITE_V_PIXEL %%n, r0+r4-%%n ; write pixels
+ dec r5
+%endif ; ARCH_X86_64/32
+ jnz .emuedge_extend_right_ %+ %%n ; } while (--block_h)
+%if ARCH_X86_64
+ ret
+%else ; ARCH_X86_32
+ rep ret
+%endif ; ARCH_X86_64/32
+%assign %%n %%n+2
+%endrep
+
+%if ARCH_X86_32
+%define stack_offset 0x10
+%endif
+%endmacro ; RIGHT_EXTEND
+
+; below follow the "slow" copy/extend functions, these act on a non-fixed
+; width specified in a register, and run a loop to copy the full amount
+; of bytes. They are optimized for copying of large amounts of pixels per
+; line, so they unconditionally splat data into mm registers to copy 8
+; bytes per loop iteration. It could be considered to use xmm for x86-64
+; also, but I haven't optimized this as much (i.e. FIXME)
+%macro V_COPY_NPX 4-5
+%if %0 == 4
+ test w_reg, %4
+ jz .%1_skip_%4_px
+%else ; %0 == 5
+.%1_%4_px_loop:
+%endif
+ %3 %2, [r1+cnt_reg]
+ %3 [r0+cnt_reg], %2
+ add cnt_reg, %4
+%if %0 == 5
+ sub w_reg, %4
+ test w_reg, %5
+ jnz .%1_%4_px_loop
+%endif
+.%1_skip_%4_px:
+%endmacro
+
+%macro V_COPY_ROW 2
+%ifidn %1, bottom
+ sub r1, linesize
+%endif
+.%1_copy_loop:
+ xor cnt_reg, cnt_reg
+%if notcpuflag(sse)
+%define linesize r2m
+ V_COPY_NPX %1, mm0, movq, 8, 0xFFFFFFF8
+%else ; sse
+ V_COPY_NPX %1, xmm0, movups, 16, 0xFFFFFFF0
+%if ARCH_X86_64
+%define linesize r2
+ V_COPY_NPX %1, rax , mov, 8
+%else ; ARCH_X86_32
+%define linesize r2m
+ V_COPY_NPX %1, mm0, movq, 8
+%endif ; ARCH_X86_64/32
+%endif ; sse
+ V_COPY_NPX %1, vald, mov, 4
+ V_COPY_NPX %1, valw, mov, 2
+ V_COPY_NPX %1, vall, mov, 1
+ mov w_reg, cnt_reg
+%ifidn %1, body
+ add r1, linesize
+%endif
+ add r0, linesize
+ dec %2
+ jnz .%1_copy_loop
+%endmacro
+
+%macro SLOW_V_EXTEND 0
+.slow_v_extend_loop:
+; r0=buf,r1=src,r2(64)/r2m(32)=linesize,r3(64)/r3m(32)=start_x,r4=end_y,r5=block_h
+; r8(64)/r3(later-64)/r2(32)=cnt_reg,r6(64)/r3(32)=val_reg,r7(64)/r6(32)=w=end_x-start_x
+%if ARCH_X86_64
+ push r8 ; save old value of block_h
+ test r3, r3
+%define cnt_reg r8
+ jz .do_body_copy ; if (!start_y) goto do_body_copy
+ V_COPY_ROW top, r3
+%else
+ cmp dword r3m, 0
+%define cnt_reg r2
+ je .do_body_copy ; if (!start_y) goto do_body_copy
+ V_COPY_ROW top, dword r3m
+%endif
+
+.do_body_copy:
+ V_COPY_ROW body, r4
+
+%if ARCH_X86_64
+ pop r8 ; restore old value of block_h
+%define cnt_reg r3
+%endif
+ test r5, r5
+%if ARCH_X86_64
+ jz .v_extend_end
+%else
+ jz .skip_bottom_extend
+%endif
+ V_COPY_ROW bottom, r5
+%if ARCH_X86_32
+.skip_bottom_extend:
+ mov r2, r2m
+%endif
+ jmp .v_extend_end
+%endmacro
+
+%macro SLOW_LEFT_EXTEND 0
+.slow_left_extend_loop:
+; r0=buf+block_h*linesize,r2=linesize,r6(64)/r3(32)=val,r5=block_h,r4=cntr,r7/r6=start_x
+ mov r4, 8
+ sub r0, linesize
+ READ_V_PIXEL 8, [r0+w_reg]
+.left_extend_8px_loop:
+ movq [r0+r4-8], mm0
+ add r4, 8
+ cmp r4, w_reg
+ jle .left_extend_8px_loop
+ sub r4, 8
+ cmp r4, w_reg
+ jge .left_extend_loop_end
+.left_extend_2px_loop:
+ mov [r0+r4], valw
+ add r4, 2
+ cmp r4, w_reg
+ jl .left_extend_2px_loop
+.left_extend_loop_end:
+ dec r5
+ jnz .slow_left_extend_loop
+%if ARCH_X86_32
+ mov r2, r2m
+%endif
+ jmp .right_extend
+%endmacro
+
+%macro SLOW_RIGHT_EXTEND 0
+.slow_right_extend_loop:
+; r3(64)/r0(32)=buf+block_h*linesize,r2=linesize,r4=block_w,r8(64)/r5(32)=block_h,
+; r7(64)/r6(32)=end_x,r6/r3=val,r1=cntr
+%if ARCH_X86_64
+%define buf_reg r3
+%define bh_reg r8
+%else
+%define buf_reg r0
+%define bh_reg r5
+%endif
+ lea r1, [r4-8]
+ sub buf_reg, linesize
+ READ_V_PIXEL 8, [buf_reg+w_reg-1]
+.right_extend_8px_loop:
+ movq [buf_reg+r1], mm0
+ sub r1, 8
+ cmp r1, w_reg
+ jge .right_extend_8px_loop
+ add r1, 8
+ cmp r1, w_reg
+ je .right_extend_loop_end
+.right_extend_2px_loop:
+ sub r1, 2
+ mov [buf_reg+r1], valw
+ cmp r1, w_reg
+ jg .right_extend_2px_loop
+.right_extend_loop_end:
+ dec bh_reg
+ jnz .slow_right_extend_loop
+ jmp .h_extend_end
+%endmacro
+
+%macro emu_edge 1
+INIT_XMM %1
+EMU_EDGE_FUNC
+VERTICAL_EXTEND
+LEFT_EXTEND
+RIGHT_EXTEND
+SLOW_V_EXTEND
+SLOW_LEFT_EXTEND
+SLOW_RIGHT_EXTEND
+%endmacro
+
+emu_edge sse
+%if ARCH_X86_32
+emu_edge mmx
+%endif
+
+%macro PREFETCH_FN 1
+cglobal prefetch, 3, 3, 0, buf, stride, h
+.loop:
+ %1 [bufq]
+ add bufq, strideq
+ dec hd
+ jg .loop
+ REP_RET
+%endmacro
+
+INIT_MMX mmxext
+PREFETCH_FN prefetcht0
+%if ARCH_X86_32
+INIT_MMX 3dnow
+PREFETCH_FN prefetch
+%endif
diff --git a/gst-libs/ext/libav/libavcodec/x86/videodsp_init.c b/gst-libs/ext/libav/libavcodec/x86/videodsp_init.c
new file mode 100644
index 0000000..07a0324
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/x86/videodsp_init.c
@@ -0,0 +1,119 @@
+/*
+ * Copyright (C) 2012 Ronald S. Bultje
+ *
+ * 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
+ */
+
+#include "config.h"
+#include "libavutil/common.h"
+#include "libavutil/cpu.h"
+#include "libavutil/mem.h"
+#include "libavutil/x86/asm.h"
+#include "libavcodec/videodsp.h"
+
+#if HAVE_YASM
+typedef void emu_edge_core_func(uint8_t *buf, const uint8_t *src,
+ x86_reg linesize, x86_reg start_y,
+ x86_reg end_y, x86_reg block_h,
+ x86_reg start_x, x86_reg end_x,
+ x86_reg block_w);
+extern emu_edge_core_func ff_emu_edge_core_mmx;
+extern emu_edge_core_func ff_emu_edge_core_sse;
+
+static av_always_inline void emulated_edge_mc(uint8_t *buf, const uint8_t *src,
+ ptrdiff_t linesize,
+ int block_w, int block_h,
+ int src_x, int src_y,
+ int w, int h,
+ emu_edge_core_func *core_fn)
+{
+ int start_y, start_x, end_y, end_x, src_y_add = 0;
+
+ if (src_y >= h) {
+ src_y_add = h - 1 - src_y;
+ src_y = h - 1;
+ } else if (src_y <= -block_h) {
+ src_y_add = 1 - block_h - src_y;
+ src_y = 1 - block_h;
+ }
+ if (src_x >= w) {
+ src += w - 1 - src_x;
+ src_x = w - 1;
+ } else if (src_x <= -block_w) {
+ src += 1 - block_w - src_x;
+ src_x = 1 - block_w;
+ }
+
+ start_y = FFMAX(0, -src_y);
+ start_x = FFMAX(0, -src_x);
+ end_y = FFMIN(block_h, h-src_y);
+ end_x = FFMIN(block_w, w-src_x);
+ assert(start_x < end_x && block_w > 0);
+ assert(start_y < end_y && block_h > 0);
+
+ // fill in the to-be-copied part plus all above/below
+ src += (src_y_add + start_y) * linesize + start_x;
+ buf += start_x;
+ core_fn(buf, src, linesize, start_y, end_y,
+ block_h, start_x, end_x, block_w);
+}
+
+#if ARCH_X86_32
+static av_noinline void emulated_edge_mc_mmx(uint8_t *buf, const uint8_t *src,
+ ptrdiff_t linesize,
+ int block_w, int block_h,
+ int src_x, int src_y, int w, int h)
+{
+ emulated_edge_mc(buf, src, linesize, block_w, block_h, src_x, src_y,
+ w, h, &ff_emu_edge_core_mmx);
+}
+#endif
+
+static av_noinline void emulated_edge_mc_sse(uint8_t *buf, const uint8_t *src,
+ ptrdiff_t linesize,
+ int block_w, int block_h,
+ int src_x, int src_y, int w, int h)
+{
+ emulated_edge_mc(buf, src, linesize, block_w, block_h, src_x, src_y,
+ w, h, &ff_emu_edge_core_sse);
+}
+#endif /* HAVE_YASM */
+
+void ff_prefetch_mmxext(uint8_t *buf, ptrdiff_t stride, int h);
+void ff_prefetch_3dnow(uint8_t *buf, ptrdiff_t stride, int h);
+
+void ff_videodsp_init_x86(VideoDSPContext *ctx, int bpc)
+{
+#if HAVE_YASM
+ int mm_flags = av_get_cpu_flags();
+
+#if ARCH_X86_32
+ if (bpc <= 8 && mm_flags & AV_CPU_FLAG_MMX) {
+ ctx->emulated_edge_mc = emulated_edge_mc_mmx;
+ }
+ if (mm_flags & AV_CPU_FLAG_3DNOW) {
+ ctx->prefetch = ff_prefetch_3dnow;
+ }
+#endif /* ARCH_X86_32 */
+ if (mm_flags & AV_CPU_FLAG_MMXEXT) {
+ ctx->prefetch = ff_prefetch_mmxext;
+ }
+ if (bpc <= 8 && mm_flags & AV_CPU_FLAG_SSE) {
+ ctx->emulated_edge_mc = emulated_edge_mc_sse;
+ }
+#endif /* HAVE_YASM */
+}
diff --git a/gst-libs/ext/libav/libavcodec/x86/vp3dsp.asm b/gst-libs/ext/libav/libavcodec/x86/vp3dsp.asm
index 2357438..fc1e776 100644
--- a/gst-libs/ext/libav/libavcodec/x86/vp3dsp.asm
+++ b/gst-libs/ext/libav/libavcodec/x86/vp3dsp.asm
@@ -19,8 +19,7 @@
;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
;******************************************************************************
-%include "x86inc.asm"
-%include "x86util.asm"
+%include "libavutil/x86/x86util.asm"
; MMX-optimized functions cribbed from the original VP3 source code.
@@ -38,13 +37,11 @@ cextern pb_1
cextern pb_3
cextern pb_7
cextern pb_1F
+cextern pb_80
cextern pb_81
cextern pw_8
-cextern put_signed_pixels_clamped_mmx
-cextern add_pixels_clamped_mmx
-
SECTION .text
; this is off by one or two for some cases when filter_limit is greater than 63
@@ -104,9 +101,9 @@ SECTION .text
mov [r0+r3 -1], r2w
%endmacro
-INIT_MMX
-cglobal vp3_v_loop_filter_mmx2, 3, 4
-%ifdef ARCH_X86_64
+INIT_MMX mmxext
+cglobal vp3_v_loop_filter, 3, 4
+%if ARCH_X86_64
movsxd r1, r1d
%endif
mov r3, r1
@@ -122,8 +119,8 @@ cglobal vp3_v_loop_filter_mmx2, 3, 4
movq [r0 ], m3
RET
-cglobal vp3_h_loop_filter_mmx2, 3, 4
-%ifdef ARCH_X86_64
+cglobal vp3_h_loop_filter, 3, 4
+%if ARCH_X86_64
movsxd r1, r1d
%endif
lea r3, [r1*3]
@@ -356,38 +353,6 @@ cglobal vp3_h_loop_filter_mmx2, 3, 4
movq I(2), m2
%endmacro
-%macro VP3_IDCT_mmx 1
- ; eax = quantized input
- ; ebx = dequantizer matrix
- ; ecx = IDCT constants
- ; M(I) = ecx + MaskOffset(0) + I * 8
- ; C(I) = ecx + CosineOffset(32) + (I-1) * 8
- ; edx = output
- ; r0..r7 = mm0..mm7
-%define OC_8 [pw_8]
-%define C(x) [vp3_idct_data+16*(x-1)]
-
- ; at this point, function has completed dequantization + dezigzag +
- ; partial transposition; now do the idct itself
-%define I(x) [%1+16* x ]
-%define J(x) [%1+16*(x-4)+8]
- RowIDCT
- Transpose
-
-%define I(x) [%1+16* x +64]
-%define J(x) [%1+16*(x-4)+72]
- RowIDCT
- Transpose
-
-%define I(x) [%1+16*x]
-%define J(x) [%1+16*x]
- ColumnIDCT
-
-%define I(x) [%1+16*x+8]
-%define J(x) [%1+16*x+8]
- ColumnIDCT
-%endmacro
-
%macro VP3_1D_IDCT_SSE2 0
movdqa m2, I(3) ; xmm2 = i3
movdqa m6, C(3) ; xmm6 = c3
@@ -503,14 +468,15 @@ cglobal vp3_h_loop_filter_mmx2, 3, 4
movdqa O(7), m%8
%endmacro
-%macro VP3_IDCT_sse2 1
+%macro VP3_IDCT 1
+%if mmsize == 16
%define I(x) [%1+16*x]
%define O(x) [%1+16*x]
%define C(x) [vp3_idct_data+16*(x-1)]
%define SHIFT(x)
%define ADD(x)
VP3_1D_IDCT_SSE2
-%ifdef ARCH_X86_64
+%if ARCH_X86_64
TRANSPOSE8x8W 0, 1, 2, 3, 4, 5, 6, 7, 8
%else
TRANSPOSE8x8W 0, 1, 2, 3, 4, 5, 6, 7, [%1], [%1+16]
@@ -521,62 +487,132 @@ cglobal vp3_h_loop_filter_mmx2, 3, 4
%define ADD(x) paddsw x, [pw_8]
VP3_1D_IDCT_SSE2
PUT_BLOCK 0, 1, 2, 3, 4, 5, 6, 7
+%else ; mmsize == 8
+ ; eax = quantized input
+ ; ebx = dequantizer matrix
+ ; ecx = IDCT constants
+ ; M(I) = ecx + MaskOffset(0) + I * 8
+ ; C(I) = ecx + CosineOffset(32) + (I-1) * 8
+ ; edx = output
+ ; r0..r7 = mm0..mm7
+%define OC_8 [pw_8]
+%define C(x) [vp3_idct_data+16*(x-1)]
+
+ ; at this point, function has completed dequantization + dezigzag +
+ ; partial transposition; now do the idct itself
+%define I(x) [%1+16* x ]
+%define J(x) [%1+16*(x-4)+8]
+ RowIDCT
+ Transpose
+
+%define I(x) [%1+16* x +64]
+%define J(x) [%1+16*(x-4)+72]
+ RowIDCT
+ Transpose
+
+%define I(x) [%1+16*x]
+%define J(x) [%1+16*x]
+ ColumnIDCT
+
+%define I(x) [%1+16*x+8]
+%define J(x) [%1+16*x+8]
+ ColumnIDCT
+%endif ; mmsize == 16/8
%endmacro
-%macro vp3_idct_funcs 3
-cglobal vp3_idct_%1, 1, 1, %2
- VP3_IDCT_%1 r0
- RET
+%macro vp3_idct_funcs 0
+cglobal vp3_idct_put, 3, 4, 9
+ VP3_IDCT r2
-cglobal vp3_idct_put_%1, 3, %3, %2
- VP3_IDCT_%1 r2
-%ifdef ARCH_X86_64
- mov r3, r2
- mov r2, r1
- mov r1, r0
- mov r0, r3
+ movsxdifnidn r1, r1d
+ mova m4, [pb_80]
+ lea r3, [r1*3]
+%assign %%i 0
+%rep 16/mmsize
+ mova m0, [r2+mmsize*0+%%i]
+ mova m1, [r2+mmsize*2+%%i]
+ mova m2, [r2+mmsize*4+%%i]
+ mova m3, [r2+mmsize*6+%%i]
+ packsswb m0, [r2+mmsize*1+%%i]
+ packsswb m1, [r2+mmsize*3+%%i]
+ packsswb m2, [r2+mmsize*5+%%i]
+ packsswb m3, [r2+mmsize*7+%%i]
+ paddb m0, m4
+ paddb m1, m4
+ paddb m2, m4
+ paddb m3, m4
+ movq [r0 ], m0
+%if mmsize == 8
+ movq [r0+r1 ], m1
+ movq [r0+r1*2], m2
+ movq [r0+r3 ], m3
%else
- mov r0m, r2
- mov r1m, r0
- mov r2m, r1
+ movhps [r0+r1 ], m0
+ movq [r0+r1*2], m1
+ movhps [r0+r3 ], m1
%endif
-%ifdef WIN64
- call put_signed_pixels_clamped_mmx
- RET
-%else
- jmp put_signed_pixels_clamped_mmx
+%if %%i == 0
+ lea r0, [r0+r1*4]
%endif
-
-cglobal vp3_idct_add_%1, 3, %3, %2
- VP3_IDCT_%1 r2
-%ifdef ARCH_X86_64
- mov r3, r2
- mov r2, r1
- mov r1, r0
- mov r0, r3
-%else
- mov r0m, r2
- mov r1m, r0
- mov r2m, r1
+%if mmsize == 16
+ movq [r0 ], m2
+ movhps [r0+r1 ], m2
+ movq [r0+r1*2], m3
+ movhps [r0+r3 ], m3
%endif
-%ifdef WIN64
- call add_pixels_clamped_mmx
+%assign %%i %%i+64
+%endrep
RET
-%else
- jmp add_pixels_clamped_mmx
+
+cglobal vp3_idct_add, 3, 4, 9
+ VP3_IDCT r2
+
+ mov r3, 4
+ pxor m4, m4
+ movsxdifnidn r1, r1d
+.loop:
+ movq m0, [r0]
+ movq m1, [r0+r1]
+%if mmsize == 8
+ mova m2, m0
+ mova m3, m1
+%endif
+ punpcklbw m0, m4
+ punpcklbw m1, m4
+%if mmsize == 8
+ punpckhbw m2, m4
+ punpckhbw m3, m4
+%endif
+ paddsw m0, [r2+ 0]
+ paddsw m1, [r2+16]
+%if mmsize == 8
+ paddsw m2, [r2+ 8]
+ paddsw m3, [r2+24]
+ packuswb m0, m2
+ packuswb m1, m3
+%else ; mmsize == 16
+ packuswb m0, m1
%endif
+ movq [r0 ], m0
+%if mmsize == 8
+ movq [r0+r1], m1
+%else ; mmsize == 16
+ movhps [r0+r1], m0
+%endif
+ lea r0, [r0+r1*2]
+ add r2, 32
+ dec r3
+ jg .loop
+ RET
%endmacro
-%ifdef ARCH_X86_64
-%define REGS 4
-%else
-%define REGS 3
+%if ARCH_X86_32
+INIT_MMX mmx
+vp3_idct_funcs
%endif
-INIT_MMX
-vp3_idct_funcs mmx, 0, REGS
-INIT_XMM
-vp3_idct_funcs sse2, 9, REGS
-%undef REGS
+
+INIT_XMM sse2
+vp3_idct_funcs
%macro DC_ADD 0
movq m2, [r0 ]
@@ -597,9 +633,9 @@ vp3_idct_funcs sse2, 9, REGS
movq [r0+r3 ], m5
%endmacro
-INIT_MMX
-cglobal vp3_idct_dc_add_mmx2, 3, 4
-%ifdef ARCH_X86_64
+INIT_MMX mmxext
+cglobal vp3_idct_dc_add, 3, 4
+%if ARCH_X86_64
movsxd r1, r1d
%endif
lea r3, [r1*3]
diff --git a/gst-libs/ext/libav/libavcodec/x86/vp3dsp_init.c b/gst-libs/ext/libav/libavcodec/x86/vp3dsp_init.c
new file mode 100644
index 0000000..bbe74ba
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/x86/vp3dsp_init.c
@@ -0,0 +1,68 @@
+/*
+ * 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
+ */
+
+#include <stdint.h>
+
+#include "libavutil/attributes.h"
+#include "libavutil/cpu.h"
+#include "libavutil/x86/cpu.h"
+#include "libavcodec/avcodec.h"
+#include "libavcodec/vp3dsp.h"
+#include "config.h"
+
+void ff_vp3_idct_put_mmx(uint8_t *dest, int line_size, DCTELEM *block);
+void ff_vp3_idct_add_mmx(uint8_t *dest, int line_size, DCTELEM *block);
+
+void ff_vp3_idct_put_sse2(uint8_t *dest, int line_size, DCTELEM *block);
+void ff_vp3_idct_add_sse2(uint8_t *dest, int line_size, DCTELEM *block);
+
+void ff_vp3_idct_dc_add_mmxext(uint8_t *dest, int line_size,
+ const DCTELEM *block);
+
+void ff_vp3_v_loop_filter_mmxext(uint8_t *src, int stride,
+ int *bounding_values);
+void ff_vp3_h_loop_filter_mmxext(uint8_t *src, int stride,
+ int *bounding_values);
+
+av_cold void ff_vp3dsp_init_x86(VP3DSPContext *c, int flags)
+{
+ int cpuflags = av_get_cpu_flags();
+
+#if ARCH_X86_32
+ if (EXTERNAL_MMX(cpuflags)) {
+ c->idct_put = ff_vp3_idct_put_mmx;
+ c->idct_add = ff_vp3_idct_add_mmx;
+ c->idct_perm = FF_PARTTRANS_IDCT_PERM;
+ }
+#endif
+
+ if (EXTERNAL_MMXEXT(cpuflags)) {
+ c->idct_dc_add = ff_vp3_idct_dc_add_mmxext;
+
+ if (!(flags & CODEC_FLAG_BITEXACT)) {
+ c->v_loop_filter = ff_vp3_v_loop_filter_mmxext;
+ c->h_loop_filter = ff_vp3_h_loop_filter_mmxext;
+ }
+ }
+
+ if (EXTERNAL_SSE2(cpuflags)) {
+ c->idct_put = ff_vp3_idct_put_sse2;
+ c->idct_add = ff_vp3_idct_add_sse2;
+ c->idct_perm = FF_TRANSPOSE_IDCT_PERM;
+ }
+}
diff --git a/gst-libs/ext/libav/libavcodec/x86/vp56_arith.h b/gst-libs/ext/libav/libavcodec/x86/vp56_arith.h
index be2dd30..0a69368 100644
--- a/gst-libs/ext/libav/libavcodec/x86/vp56_arith.h
+++ b/gst-libs/ext/libav/libavcodec/x86/vp56_arith.h
@@ -24,7 +24,7 @@
#ifndef AVCODEC_X86_VP56_ARITH_H
#define AVCODEC_X86_VP56_ARITH_H
-#if HAVE_FAST_CMOV
+#if HAVE_INLINE_ASM && HAVE_FAST_CMOV
#define vp56_rac_get_prob vp56_rac_get_prob
static av_always_inline int vp56_rac_get_prob(VP56RangeCoder *c, uint8_t prob)
{
diff --git a/gst-libs/ext/libav/libavcodec/x86/vp56dsp.asm b/gst-libs/ext/libav/libavcodec/x86/vp56dsp.asm
index c70ed60..80f8ca5 100644
--- a/gst-libs/ext/libav/libavcodec/x86/vp56dsp.asm
+++ b/gst-libs/ext/libav/libavcodec/x86/vp56dsp.asm
@@ -20,14 +20,14 @@
;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
;******************************************************************************
-%include "x86inc.asm"
-%include "x86util.asm"
+%include "libavutil/x86/x86util.asm"
cextern pw_64
SECTION .text
-%macro DIAG4_MMX 6
+%macro DIAG4 6
+%if mmsize == 8
movq m0, [%1+%2]
movq m1, [%1+%3]
movq m3, m0
@@ -64,9 +64,7 @@ SECTION .text
psraw m3, 7
packuswb m0, m3
movq [%6], m0
-%endmacro
-
-%macro DIAG4_SSE2 6
+%else ; mmsize == 16
movq m0, [%1+%2]
movq m1, [%1+%3]
punpcklbw m0, m7
@@ -86,9 +84,11 @@ SECTION .text
psraw m0, 7
packuswb m0, m0
movq [%6], m0
+%endif ; mmsize == 8/16
%endmacro
-%macro SPLAT4REGS_MMX 0
+%macro SPLAT4REGS 0
+%if mmsize == 8
movq m5, m3
punpcklwd m3, m3
movq m4, m3
@@ -102,9 +102,7 @@ SECTION .text
movq [rsp+8*12], m4
movq [rsp+8*13], m5
movq [rsp+8*14], m2
-%endmacro
-
-%macro SPLAT4REGS_SSE2 0
+%else ; mmsize == 16
pshuflw m4, m3, 0x0
pshuflw m5, m3, 0x55
pshuflw m6, m3, 0xAA
@@ -113,21 +111,22 @@ SECTION .text
punpcklqdq m5, m5
punpcklqdq m6, m6
punpcklqdq m3, m3
+%endif ; mmsize == 8/16
%endmacro
-%macro vp6_filter_diag4 2
+%macro vp6_filter_diag4 0
; void ff_vp6_filter_diag4_<opt>(uint8_t *dst, uint8_t *src, int stride,
; const int16_t h_weight[4], const int16_t v_weights[4])
-cglobal vp6_filter_diag4_%1, 5, 7, %2
+cglobal vp6_filter_diag4, 5, 7, 8
mov r5, rsp ; backup stack pointer
and rsp, ~(mmsize-1) ; align stack
-%ifidn %1, sse2
+%if mmsize == 16
sub rsp, 8*11
%else
sub rsp, 8*15
movq m6, [pw_64]
%endif
-%ifdef ARCH_X86_64
+%if ARCH_X86_64
movsxd r2, r2d
%endif
@@ -139,7 +138,7 @@ cglobal vp6_filter_diag4_%1, 5, 7, %2
mov r3, rsp
mov r6, 11
-.nextrow
+.nextrow:
DIAG4 r1, -1, 0, 1, 2, r3
add r3, 8
add r1, r2
@@ -151,7 +150,7 @@ cglobal vp6_filter_diag4_%1, 5, 7, %2
lea r3, [rsp+8]
mov r6, 8
-.nextcol
+.nextcol:
DIAG4 r3, -8, 0, 8, 16, r0
add r3, 8
add r0, r2
@@ -162,12 +161,10 @@ cglobal vp6_filter_diag4_%1, 5, 7, %2
RET
%endmacro
-INIT_MMX
-%define DIAG4 DIAG4_MMX
-%define SPLAT4REGS SPLAT4REGS_MMX
-vp6_filter_diag4 mmx, 0
+%if ARCH_X86_32
+INIT_MMX mmx
+vp6_filter_diag4
+%endif
-INIT_XMM
-%define DIAG4 DIAG4_SSE2
-%define SPLAT4REGS SPLAT4REGS_SSE2
-vp6_filter_diag4 sse2, 8
+INIT_XMM sse2
+vp6_filter_diag4
diff --git a/gst-libs/ext/libav/libavcodec/x86/vp56dsp_init.c b/gst-libs/ext/libav/libavcodec/x86/vp56dsp_init.c
index 2989281..3b49df6 100644
--- a/gst-libs/ext/libav/libavcodec/x86/vp56dsp_init.c
+++ b/gst-libs/ext/libav/libavcodec/x86/vp56dsp_init.c
@@ -21,7 +21,8 @@
*/
#include "libavutil/cpu.h"
-#include "libavutil/x86_cpu.h"
+#include "libavutil/x86/asm.h"
+#include "libavutil/x86/cpu.h"
#include "libavcodec/dsputil.h"
#include "libavcodec/vp56dsp.h"
@@ -30,19 +31,19 @@ void ff_vp6_filter_diag4_mmx(uint8_t *dst, uint8_t *src, int stride,
void ff_vp6_filter_diag4_sse2(uint8_t *dst, uint8_t *src, int stride,
const int16_t *h_weights,const int16_t *v_weights);
-av_cold void ff_vp56dsp_init_x86(VP56DSPContext* c, enum CodecID codec)
+av_cold void ff_vp56dsp_init_x86(VP56DSPContext* c, enum AVCodecID codec)
{
-#if HAVE_YASM
int mm_flags = av_get_cpu_flags();
- if (CONFIG_VP6_DECODER && codec == CODEC_ID_VP6) {
- if (mm_flags & AV_CPU_FLAG_MMX) {
+ if (CONFIG_VP6_DECODER && codec == AV_CODEC_ID_VP6) {
+#if ARCH_X86_32
+ if (EXTERNAL_MMX(mm_flags)) {
c->vp6_filter_diag4 = ff_vp6_filter_diag4_mmx;
}
+#endif
- if (mm_flags & AV_CPU_FLAG_SSE2) {
+ if (EXTERNAL_SSE2(mm_flags)) {
c->vp6_filter_diag4 = ff_vp6_filter_diag4_sse2;
}
}
-#endif
}
diff --git a/gst-libs/ext/libav/libavcodec/x86/vp8dsp-init.c b/gst-libs/ext/libav/libavcodec/x86/vp8dsp-init.c
deleted file mode 100644
index f5e89fa..0000000
--- a/gst-libs/ext/libav/libavcodec/x86/vp8dsp-init.c
+++ /dev/null
@@ -1,402 +0,0 @@
-/*
- * VP8 DSP functions x86-optimized
- * Copyright (c) 2010 Ronald S. Bultje <rsbultje@gmail.com>
- * Copyright (c) 2010 Jason Garrett-Glaser <darkshikari@gmail.com>
- *
- * 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
- */
-
-#include "libavutil/cpu.h"
-#include "libavutil/x86_cpu.h"
-#include "libavcodec/vp8dsp.h"
-
-#if HAVE_YASM
-
-/*
- * MC functions
- */
-extern void ff_put_vp8_epel4_h4_mmxext(uint8_t *dst, int dststride,
- uint8_t *src, int srcstride,
- int height, int mx, int my);
-extern void ff_put_vp8_epel4_h6_mmxext(uint8_t *dst, int dststride,
- uint8_t *src, int srcstride,
- int height, int mx, int my);
-extern void ff_put_vp8_epel4_v4_mmxext(uint8_t *dst, int dststride,
- uint8_t *src, int srcstride,
- int height, int mx, int my);
-extern void ff_put_vp8_epel4_v6_mmxext(uint8_t *dst, int dststride,
- uint8_t *src, int srcstride,
- int height, int mx, int my);
-
-extern void ff_put_vp8_epel8_h4_sse2 (uint8_t *dst, int dststride,
- uint8_t *src, int srcstride,
- int height, int mx, int my);
-extern void ff_put_vp8_epel8_h6_sse2 (uint8_t *dst, int dststride,
- uint8_t *src, int srcstride,
- int height, int mx, int my);
-extern void ff_put_vp8_epel8_v4_sse2 (uint8_t *dst, int dststride,
- uint8_t *src, int srcstride,
- int height, int mx, int my);
-extern void ff_put_vp8_epel8_v6_sse2 (uint8_t *dst, int dststride,
- uint8_t *src, int srcstride,
- int height, int mx, int my);
-
-extern void ff_put_vp8_epel4_h4_ssse3 (uint8_t *dst, int dststride,
- uint8_t *src, int srcstride,
- int height, int mx, int my);
-extern void ff_put_vp8_epel4_h6_ssse3 (uint8_t *dst, int dststride,
- uint8_t *src, int srcstride,
- int height, int mx, int my);
-extern void ff_put_vp8_epel4_v4_ssse3 (uint8_t *dst, int dststride,
- uint8_t *src, int srcstride,
- int height, int mx, int my);
-extern void ff_put_vp8_epel4_v6_ssse3 (uint8_t *dst, int dststride,
- uint8_t *src, int srcstride,
- int height, int mx, int my);
-extern void ff_put_vp8_epel8_h4_ssse3 (uint8_t *dst, int dststride,
- uint8_t *src, int srcstride,
- int height, int mx, int my);
-extern void ff_put_vp8_epel8_h6_ssse3 (uint8_t *dst, int dststride,
- uint8_t *src, int srcstride,
- int height, int mx, int my);
-extern void ff_put_vp8_epel8_v4_ssse3 (uint8_t *dst, int dststride,
- uint8_t *src, int srcstride,
- int height, int mx, int my);
-extern void ff_put_vp8_epel8_v6_ssse3 (uint8_t *dst, int dststride,
- uint8_t *src, int srcstride,
- int height, int mx, int my);
-
-extern void ff_put_vp8_bilinear4_h_mmxext(uint8_t *dst, int dststride,
- uint8_t *src, int srcstride,
- int height, int mx, int my);
-extern void ff_put_vp8_bilinear8_h_sse2 (uint8_t *dst, int dststride,
- uint8_t *src, int srcstride,
- int height, int mx, int my);
-extern void ff_put_vp8_bilinear4_h_ssse3 (uint8_t *dst, int dststride,
- uint8_t *src, int srcstride,
- int height, int mx, int my);
-extern void ff_put_vp8_bilinear8_h_ssse3 (uint8_t *dst, int dststride,
- uint8_t *src, int srcstride,
- int height, int mx, int my);
-
-extern void ff_put_vp8_bilinear4_v_mmxext(uint8_t *dst, int dststride,
- uint8_t *src, int srcstride,
- int height, int mx, int my);
-extern void ff_put_vp8_bilinear8_v_sse2 (uint8_t *dst, int dststride,
- uint8_t *src, int srcstride,
- int height, int mx, int my);
-extern void ff_put_vp8_bilinear4_v_ssse3 (uint8_t *dst, int dststride,
- uint8_t *src, int srcstride,
- int height, int mx, int my);
-extern void ff_put_vp8_bilinear8_v_ssse3 (uint8_t *dst, int dststride,
- uint8_t *src, int srcstride,
- int height, int mx, int my);
-
-
-extern void ff_put_vp8_pixels8_mmx (uint8_t *dst, int dststride,
- uint8_t *src, int srcstride,
- int height, int mx, int my);
-extern void ff_put_vp8_pixels16_mmx(uint8_t *dst, int dststride,
- uint8_t *src, int srcstride,
- int height, int mx, int my);
-extern void ff_put_vp8_pixels16_sse(uint8_t *dst, int dststride,
- uint8_t *src, int srcstride,
- int height, int mx, int my);
-
-#define TAP_W16(OPT, FILTERTYPE, TAPTYPE) \
-static void ff_put_vp8_ ## FILTERTYPE ## 16_ ## TAPTYPE ## _ ## OPT( \
- uint8_t *dst, int dststride, uint8_t *src, \
- int srcstride, int height, int mx, int my) \
-{ \
- ff_put_vp8_ ## FILTERTYPE ## 8_ ## TAPTYPE ## _ ## OPT( \
- dst, dststride, src, srcstride, height, mx, my); \
- ff_put_vp8_ ## FILTERTYPE ## 8_ ## TAPTYPE ## _ ## OPT( \
- dst + 8, dststride, src + 8, srcstride, height, mx, my); \
-}
-#define TAP_W8(OPT, FILTERTYPE, TAPTYPE) \
-static void ff_put_vp8_ ## FILTERTYPE ## 8_ ## TAPTYPE ## _ ## OPT( \
- uint8_t *dst, int dststride, uint8_t *src, \
- int srcstride, int height, int mx, int my) \
-{ \
- ff_put_vp8_ ## FILTERTYPE ## 4_ ## TAPTYPE ## _ ## OPT( \
- dst, dststride, src, srcstride, height, mx, my); \
- ff_put_vp8_ ## FILTERTYPE ## 4_ ## TAPTYPE ## _ ## OPT( \
- dst + 4, dststride, src + 4, srcstride, height, mx, my); \
-}
-
-TAP_W8 (mmxext, epel, h4)
-TAP_W8 (mmxext, epel, h6)
-TAP_W16(mmxext, epel, h6)
-TAP_W8 (mmxext, epel, v4)
-TAP_W8 (mmxext, epel, v6)
-TAP_W16(mmxext, epel, v6)
-TAP_W8 (mmxext, bilinear, h)
-TAP_W16(mmxext, bilinear, h)
-TAP_W8 (mmxext, bilinear, v)
-TAP_W16(mmxext, bilinear, v)
-
-TAP_W16(sse2, epel, h6)
-TAP_W16(sse2, epel, v6)
-TAP_W16(sse2, bilinear, h)
-TAP_W16(sse2, bilinear, v)
-
-TAP_W16(ssse3, epel, h6)
-TAP_W16(ssse3, epel, v6)
-TAP_W16(ssse3, bilinear, h)
-TAP_W16(ssse3, bilinear, v)
-
-#define HVTAP(OPT, ALIGN, TAPNUMX, TAPNUMY, SIZE, MAXHEIGHT) \
-static void ff_put_vp8_epel ## SIZE ## _h ## TAPNUMX ## v ## TAPNUMY ## _ ## OPT( \
- uint8_t *dst, int dststride, uint8_t *src, \
- int srcstride, int height, int mx, int my) \
-{ \
- DECLARE_ALIGNED(ALIGN, uint8_t, tmp)[SIZE * (MAXHEIGHT + TAPNUMY - 1)]; \
- uint8_t *tmpptr = tmp + SIZE * (TAPNUMY / 2 - 1); \
- src -= srcstride * (TAPNUMY / 2 - 1); \
- ff_put_vp8_epel ## SIZE ## _h ## TAPNUMX ## _ ## OPT( \
- tmp, SIZE, src, srcstride, height + TAPNUMY - 1, mx, my); \
- ff_put_vp8_epel ## SIZE ## _v ## TAPNUMY ## _ ## OPT( \
- dst, dststride, tmpptr, SIZE, height, mx, my); \
-}
-
-#define HVTAPMMX(x, y) \
-HVTAP(mmxext, 8, x, y, 4, 8) \
-HVTAP(mmxext, 8, x, y, 8, 16)
-
-HVTAPMMX(4, 4)
-HVTAPMMX(4, 6)
-HVTAPMMX(6, 4)
-HVTAPMMX(6, 6)
-HVTAP(mmxext, 8, 6, 6, 16, 16)
-
-#define HVTAPSSE2(x, y, w) \
-HVTAP(sse2, 16, x, y, w, 16) \
-HVTAP(ssse3, 16, x, y, w, 16)
-
-HVTAPSSE2(4, 4, 8)
-HVTAPSSE2(4, 6, 8)
-HVTAPSSE2(6, 4, 8)
-HVTAPSSE2(6, 6, 8)
-HVTAPSSE2(6, 6, 16)
-
-HVTAP(ssse3, 16, 4, 4, 4, 8)
-HVTAP(ssse3, 16, 4, 6, 4, 8)
-HVTAP(ssse3, 16, 6, 4, 4, 8)
-HVTAP(ssse3, 16, 6, 6, 4, 8)
-
-#define HVBILIN(OPT, ALIGN, SIZE, MAXHEIGHT) \
-static void ff_put_vp8_bilinear ## SIZE ## _hv_ ## OPT( \
- uint8_t *dst, int dststride, uint8_t *src, \
- int srcstride, int height, int mx, int my) \
-{ \
- DECLARE_ALIGNED(ALIGN, uint8_t, tmp)[SIZE * (MAXHEIGHT + 2)]; \
- ff_put_vp8_bilinear ## SIZE ## _h_ ## OPT( \
- tmp, SIZE, src, srcstride, height + 1, mx, my); \
- ff_put_vp8_bilinear ## SIZE ## _v_ ## OPT( \
- dst, dststride, tmp, SIZE, height, mx, my); \
-}
-
-HVBILIN(mmxext, 8, 4, 8)
-HVBILIN(mmxext, 8, 8, 16)
-HVBILIN(mmxext, 8, 16, 16)
-HVBILIN(sse2, 8, 8, 16)
-HVBILIN(sse2, 8, 16, 16)
-HVBILIN(ssse3, 8, 4, 8)
-HVBILIN(ssse3, 8, 8, 16)
-HVBILIN(ssse3, 8, 16, 16)
-
-extern void ff_vp8_idct_dc_add_mmx(uint8_t *dst, DCTELEM block[16], int stride);
-extern void ff_vp8_idct_dc_add_sse4(uint8_t *dst, DCTELEM block[16], int stride);
-extern void ff_vp8_idct_dc_add4y_mmx(uint8_t *dst, DCTELEM block[4][16], int stride);
-extern void ff_vp8_idct_dc_add4y_sse2(uint8_t *dst, DCTELEM block[4][16], int stride);
-extern void ff_vp8_idct_dc_add4uv_mmx(uint8_t *dst, DCTELEM block[2][16], int stride);
-extern void ff_vp8_luma_dc_wht_mmx(DCTELEM block[4][4][16], DCTELEM dc[16]);
-extern void ff_vp8_luma_dc_wht_sse(DCTELEM block[4][4][16], DCTELEM dc[16]);
-extern void ff_vp8_idct_add_mmx(uint8_t *dst, DCTELEM block[16], int stride);
-extern void ff_vp8_idct_add_sse(uint8_t *dst, DCTELEM block[16], int stride);
-
-#define DECLARE_LOOP_FILTER(NAME)\
-extern void ff_vp8_v_loop_filter_simple_ ## NAME(uint8_t *dst, int stride, int flim);\
-extern void ff_vp8_h_loop_filter_simple_ ## NAME(uint8_t *dst, int stride, int flim);\
-extern void ff_vp8_v_loop_filter16y_inner_ ## NAME (uint8_t *dst, int stride,\
- int e, int i, int hvt);\
-extern void ff_vp8_h_loop_filter16y_inner_ ## NAME (uint8_t *dst, int stride,\
- int e, int i, int hvt);\
-extern void ff_vp8_v_loop_filter8uv_inner_ ## NAME (uint8_t *dstU, uint8_t *dstV,\
- int s, int e, int i, int hvt);\
-extern void ff_vp8_h_loop_filter8uv_inner_ ## NAME (uint8_t *dstU, uint8_t *dstV,\
- int s, int e, int i, int hvt);\
-extern void ff_vp8_v_loop_filter16y_mbedge_ ## NAME(uint8_t *dst, int stride,\
- int e, int i, int hvt);\
-extern void ff_vp8_h_loop_filter16y_mbedge_ ## NAME(uint8_t *dst, int stride,\
- int e, int i, int hvt);\
-extern void ff_vp8_v_loop_filter8uv_mbedge_ ## NAME(uint8_t *dstU, uint8_t *dstV,\
- int s, int e, int i, int hvt);\
-extern void ff_vp8_h_loop_filter8uv_mbedge_ ## NAME(uint8_t *dstU, uint8_t *dstV,\
- int s, int e, int i, int hvt);
-
-DECLARE_LOOP_FILTER(mmx)
-DECLARE_LOOP_FILTER(mmxext)
-DECLARE_LOOP_FILTER(sse2)
-DECLARE_LOOP_FILTER(ssse3)
-DECLARE_LOOP_FILTER(sse4)
-
-#endif
-
-#define VP8_LUMA_MC_FUNC(IDX, SIZE, OPT) \
- c->put_vp8_epel_pixels_tab[IDX][0][2] = ff_put_vp8_epel ## SIZE ## _h6_ ## OPT; \
- c->put_vp8_epel_pixels_tab[IDX][2][0] = ff_put_vp8_epel ## SIZE ## _v6_ ## OPT; \
- c->put_vp8_epel_pixels_tab[IDX][2][2] = ff_put_vp8_epel ## SIZE ## _h6v6_ ## OPT
-
-#define VP8_MC_FUNC(IDX, SIZE, OPT) \
- c->put_vp8_epel_pixels_tab[IDX][0][1] = ff_put_vp8_epel ## SIZE ## _h4_ ## OPT; \
- c->put_vp8_epel_pixels_tab[IDX][1][0] = ff_put_vp8_epel ## SIZE ## _v4_ ## OPT; \
- c->put_vp8_epel_pixels_tab[IDX][1][1] = ff_put_vp8_epel ## SIZE ## _h4v4_ ## OPT; \
- c->put_vp8_epel_pixels_tab[IDX][1][2] = ff_put_vp8_epel ## SIZE ## _h6v4_ ## OPT; \
- c->put_vp8_epel_pixels_tab[IDX][2][1] = ff_put_vp8_epel ## SIZE ## _h4v6_ ## OPT; \
- VP8_LUMA_MC_FUNC(IDX, SIZE, OPT)
-
-#define VP8_BILINEAR_MC_FUNC(IDX, SIZE, OPT) \
- c->put_vp8_bilinear_pixels_tab[IDX][0][1] = ff_put_vp8_bilinear ## SIZE ## _h_ ## OPT; \
- c->put_vp8_bilinear_pixels_tab[IDX][0][2] = ff_put_vp8_bilinear ## SIZE ## _h_ ## OPT; \
- c->put_vp8_bilinear_pixels_tab[IDX][1][0] = ff_put_vp8_bilinear ## SIZE ## _v_ ## OPT; \
- c->put_vp8_bilinear_pixels_tab[IDX][1][1] = ff_put_vp8_bilinear ## SIZE ## _hv_ ## OPT; \
- c->put_vp8_bilinear_pixels_tab[IDX][1][2] = ff_put_vp8_bilinear ## SIZE ## _hv_ ## OPT; \
- c->put_vp8_bilinear_pixels_tab[IDX][2][0] = ff_put_vp8_bilinear ## SIZE ## _v_ ## OPT; \
- c->put_vp8_bilinear_pixels_tab[IDX][2][1] = ff_put_vp8_bilinear ## SIZE ## _hv_ ## OPT; \
- c->put_vp8_bilinear_pixels_tab[IDX][2][2] = ff_put_vp8_bilinear ## SIZE ## _hv_ ## OPT
-
-
-av_cold void ff_vp8dsp_init_x86(VP8DSPContext* c)
-{
-#if HAVE_YASM
- int mm_flags = av_get_cpu_flags();
-
- if (mm_flags & AV_CPU_FLAG_MMX) {
- c->vp8_idct_dc_add = ff_vp8_idct_dc_add_mmx;
- c->vp8_idct_dc_add4y = ff_vp8_idct_dc_add4y_mmx;
- c->vp8_idct_dc_add4uv = ff_vp8_idct_dc_add4uv_mmx;
- c->vp8_idct_add = ff_vp8_idct_add_mmx;
- c->vp8_luma_dc_wht = ff_vp8_luma_dc_wht_mmx;
- c->put_vp8_epel_pixels_tab[0][0][0] =
- c->put_vp8_bilinear_pixels_tab[0][0][0] = ff_put_vp8_pixels16_mmx;
- c->put_vp8_epel_pixels_tab[1][0][0] =
- c->put_vp8_bilinear_pixels_tab[1][0][0] = ff_put_vp8_pixels8_mmx;
-
- c->vp8_v_loop_filter_simple = ff_vp8_v_loop_filter_simple_mmx;
- c->vp8_h_loop_filter_simple = ff_vp8_h_loop_filter_simple_mmx;
-
- c->vp8_v_loop_filter16y_inner = ff_vp8_v_loop_filter16y_inner_mmx;
- c->vp8_h_loop_filter16y_inner = ff_vp8_h_loop_filter16y_inner_mmx;
- c->vp8_v_loop_filter8uv_inner = ff_vp8_v_loop_filter8uv_inner_mmx;
- c->vp8_h_loop_filter8uv_inner = ff_vp8_h_loop_filter8uv_inner_mmx;
-
- c->vp8_v_loop_filter16y = ff_vp8_v_loop_filter16y_mbedge_mmx;
- c->vp8_h_loop_filter16y = ff_vp8_h_loop_filter16y_mbedge_mmx;
- c->vp8_v_loop_filter8uv = ff_vp8_v_loop_filter8uv_mbedge_mmx;
- c->vp8_h_loop_filter8uv = ff_vp8_h_loop_filter8uv_mbedge_mmx;
- }
-
- /* note that 4-tap width=16 functions are missing because w=16
- * is only used for luma, and luma is always a copy or sixtap. */
- if (mm_flags & AV_CPU_FLAG_MMX2) {
- VP8_LUMA_MC_FUNC(0, 16, mmxext);
- VP8_MC_FUNC(1, 8, mmxext);
- VP8_MC_FUNC(2, 4, mmxext);
- VP8_BILINEAR_MC_FUNC(0, 16, mmxext);
- VP8_BILINEAR_MC_FUNC(1, 8, mmxext);
- VP8_BILINEAR_MC_FUNC(2, 4, mmxext);
-
- c->vp8_v_loop_filter_simple = ff_vp8_v_loop_filter_simple_mmxext;
- c->vp8_h_loop_filter_simple = ff_vp8_h_loop_filter_simple_mmxext;
-
- c->vp8_v_loop_filter16y_inner = ff_vp8_v_loop_filter16y_inner_mmxext;
- c->vp8_h_loop_filter16y_inner = ff_vp8_h_loop_filter16y_inner_mmxext;
- c->vp8_v_loop_filter8uv_inner = ff_vp8_v_loop_filter8uv_inner_mmxext;
- c->vp8_h_loop_filter8uv_inner = ff_vp8_h_loop_filter8uv_inner_mmxext;
-
- c->vp8_v_loop_filter16y = ff_vp8_v_loop_filter16y_mbedge_mmxext;
- c->vp8_h_loop_filter16y = ff_vp8_h_loop_filter16y_mbedge_mmxext;
- c->vp8_v_loop_filter8uv = ff_vp8_v_loop_filter8uv_mbedge_mmxext;
- c->vp8_h_loop_filter8uv = ff_vp8_h_loop_filter8uv_mbedge_mmxext;
- }
-
- if (mm_flags & AV_CPU_FLAG_SSE) {
- c->vp8_idct_add = ff_vp8_idct_add_sse;
- c->vp8_luma_dc_wht = ff_vp8_luma_dc_wht_sse;
- c->put_vp8_epel_pixels_tab[0][0][0] =
- c->put_vp8_bilinear_pixels_tab[0][0][0] = ff_put_vp8_pixels16_sse;
- }
-
- if (mm_flags & (AV_CPU_FLAG_SSE2|AV_CPU_FLAG_SSE2SLOW)) {
- VP8_LUMA_MC_FUNC(0, 16, sse2);
- VP8_MC_FUNC(1, 8, sse2);
- VP8_BILINEAR_MC_FUNC(0, 16, sse2);
- VP8_BILINEAR_MC_FUNC(1, 8, sse2);
-
- c->vp8_v_loop_filter_simple = ff_vp8_v_loop_filter_simple_sse2;
-
- c->vp8_v_loop_filter16y_inner = ff_vp8_v_loop_filter16y_inner_sse2;
- c->vp8_v_loop_filter8uv_inner = ff_vp8_v_loop_filter8uv_inner_sse2;
-
- c->vp8_v_loop_filter16y = ff_vp8_v_loop_filter16y_mbedge_sse2;
- c->vp8_v_loop_filter8uv = ff_vp8_v_loop_filter8uv_mbedge_sse2;
- }
-
- if (mm_flags & AV_CPU_FLAG_SSE2) {
- c->vp8_idct_dc_add4y = ff_vp8_idct_dc_add4y_sse2;
-
- c->vp8_h_loop_filter_simple = ff_vp8_h_loop_filter_simple_sse2;
-
- c->vp8_h_loop_filter16y_inner = ff_vp8_h_loop_filter16y_inner_sse2;
- c->vp8_h_loop_filter8uv_inner = ff_vp8_h_loop_filter8uv_inner_sse2;
-
- c->vp8_h_loop_filter16y = ff_vp8_h_loop_filter16y_mbedge_sse2;
- c->vp8_h_loop_filter8uv = ff_vp8_h_loop_filter8uv_mbedge_sse2;
- }
-
- if (mm_flags & AV_CPU_FLAG_SSSE3) {
- VP8_LUMA_MC_FUNC(0, 16, ssse3);
- VP8_MC_FUNC(1, 8, ssse3);
- VP8_MC_FUNC(2, 4, ssse3);
- VP8_BILINEAR_MC_FUNC(0, 16, ssse3);
- VP8_BILINEAR_MC_FUNC(1, 8, ssse3);
- VP8_BILINEAR_MC_FUNC(2, 4, ssse3);
-
- c->vp8_v_loop_filter_simple = ff_vp8_v_loop_filter_simple_ssse3;
- c->vp8_h_loop_filter_simple = ff_vp8_h_loop_filter_simple_ssse3;
-
- c->vp8_v_loop_filter16y_inner = ff_vp8_v_loop_filter16y_inner_ssse3;
- c->vp8_h_loop_filter16y_inner = ff_vp8_h_loop_filter16y_inner_ssse3;
- c->vp8_v_loop_filter8uv_inner = ff_vp8_v_loop_filter8uv_inner_ssse3;
- c->vp8_h_loop_filter8uv_inner = ff_vp8_h_loop_filter8uv_inner_ssse3;
-
- c->vp8_v_loop_filter16y = ff_vp8_v_loop_filter16y_mbedge_ssse3;
- c->vp8_h_loop_filter16y = ff_vp8_h_loop_filter16y_mbedge_ssse3;
- c->vp8_v_loop_filter8uv = ff_vp8_v_loop_filter8uv_mbedge_ssse3;
- c->vp8_h_loop_filter8uv = ff_vp8_h_loop_filter8uv_mbedge_ssse3;
- }
-
- if (mm_flags & AV_CPU_FLAG_SSE4) {
- c->vp8_idct_dc_add = ff_vp8_idct_dc_add_sse4;
-
- c->vp8_h_loop_filter_simple = ff_vp8_h_loop_filter_simple_sse4;
- c->vp8_h_loop_filter16y = ff_vp8_h_loop_filter16y_mbedge_sse4;
- c->vp8_h_loop_filter8uv = ff_vp8_h_loop_filter8uv_mbedge_sse4;
- }
-#endif
-}
diff --git a/gst-libs/ext/libav/libavcodec/x86/vp8dsp.asm b/gst-libs/ext/libav/libavcodec/x86/vp8dsp.asm
index 7d9ebc9..af8403e 100644
--- a/gst-libs/ext/libav/libavcodec/x86/vp8dsp.asm
+++ b/gst-libs/ext/libav/libavcodec/x86/vp8dsp.asm
@@ -20,8 +20,7 @@
;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
;******************************************************************************
-%include "x86inc.asm"
-%include "x86util.asm"
+%include "libavutil/x86/x86util.asm"
SECTION_RODATA
@@ -116,23 +115,25 @@ bilinear_filter_vb_m: times 8 db 7, 1
times 8 db 1, 7
%ifdef PIC
-%define fourtap_filter_hw r11
-%define sixtap_filter_hw r11
-%define fourtap_filter_hb r11
-%define sixtap_filter_hb r11
-%define fourtap_filter_v r11
-%define sixtap_filter_v r11
-%define bilinear_filter_vw r11
-%define bilinear_filter_vb r11
+%define fourtap_filter_hw picregq
+%define sixtap_filter_hw picregq
+%define fourtap_filter_hb picregq
+%define sixtap_filter_hb picregq
+%define fourtap_filter_v picregq
+%define sixtap_filter_v picregq
+%define bilinear_filter_vw picregq
+%define bilinear_filter_vb picregq
+%define npicregs 1
%else
-%define fourtap_filter_hw fourtap_filter_hw_m
-%define sixtap_filter_hw sixtap_filter_hw_m
-%define fourtap_filter_hb fourtap_filter_hb_m
-%define sixtap_filter_hb sixtap_filter_hb_m
-%define fourtap_filter_v fourtap_filter_v_m
-%define sixtap_filter_v sixtap_filter_v_m
+%define fourtap_filter_hw fourtap_filter_hw_m
+%define sixtap_filter_hw sixtap_filter_hw_m
+%define fourtap_filter_hb fourtap_filter_hb_m
+%define sixtap_filter_hb sixtap_filter_hb_m
+%define fourtap_filter_v fourtap_filter_v_m
+%define sixtap_filter_v sixtap_filter_v_m
%define bilinear_filter_vw bilinear_filter_vw_m
%define bilinear_filter_vb bilinear_filter_vb_m
+%define npicregs 0
%endif
filter_h2_shuf: db 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8
@@ -142,6 +143,8 @@ filter_h6_shuf1: db 0, 5, 1, 6, 2, 7, 3, 8, 4, 9, 5, 10, 6, 11, 7, 12
filter_h6_shuf2: db 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9
filter_h6_shuf3: db 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11
+pw_256: times 8 dw 256
+
pw_20091: times 4 dw 20091
pw_17734: times 4 dw 17734
@@ -173,26 +176,26 @@ SECTION .text
; int height, int mx, int my);
;-----------------------------------------------------------------------------
-%macro FILTER_SSSE3 3
-cglobal put_vp8_epel%1_h6_ssse3, 6, 6, %2
- lea r5d, [r5*3]
+%macro FILTER_SSSE3 1
+cglobal put_vp8_epel%1_h6, 6, 6 + npicregs, 8, dst, dststride, src, srcstride, height, mx, picreg
+ lea mxd, [mxq*3]
mova m3, [filter_h6_shuf2]
mova m4, [filter_h6_shuf3]
%ifdef PIC
- lea r11, [sixtap_filter_hb_m]
+ lea picregq, [sixtap_filter_hb_m]
%endif
- mova m5, [sixtap_filter_hb+r5*8-48] ; set up 6tap filter in bytes
- mova m6, [sixtap_filter_hb+r5*8-32]
- mova m7, [sixtap_filter_hb+r5*8-16]
+ mova m5, [sixtap_filter_hb+mxq*8-48] ; set up 6tap filter in bytes
+ mova m6, [sixtap_filter_hb+mxq*8-32]
+ mova m7, [sixtap_filter_hb+mxq*8-16]
-.nextrow
- movu m0, [r2-2]
+.nextrow:
+ movu m0, [srcq-2]
mova m1, m0
mova m2, m0
-%ifidn %1, 4
+%if mmsize == 8
; For epel4, we need 9 bytes, but only 8 get loaded; to compensate, do the
; shuffle with a memory operand
- punpcklbw m0, [r2+3]
+ punpcklbw m0, [srcq+3]
%else
pshufb m0, [filter_h6_shuf1]
%endif
@@ -203,67 +206,65 @@ cglobal put_vp8_epel%1_h6_ssse3, 6, 6, %2
pmaddubsw m2, m7
paddsw m0, m1
paddsw m0, m2
- paddsw m0, [pw_64]
- psraw m0, 7
+ pmulhrsw m0, [pw_256]
packuswb m0, m0
- movh [r0], m0 ; store
+ movh [dstq], m0 ; store
; go to next line
- add r0, r1
- add r2, r3
- dec r4d ; next row
+ add dstq, dststrideq
+ add srcq, srcstrideq
+ dec heightd ; next row
jg .nextrow
REP_RET
-cglobal put_vp8_epel%1_h4_ssse3, 6, 6, %3
- shl r5d, 4
- mova m2, [pw_64]
+cglobal put_vp8_epel%1_h4, 6, 6 + npicregs, 7, dst, dststride, src, srcstride, height, mx, picreg
+ shl mxd, 4
+ mova m2, [pw_256]
mova m3, [filter_h2_shuf]
mova m4, [filter_h4_shuf]
%ifdef PIC
- lea r11, [fourtap_filter_hb_m]
+ lea picregq, [fourtap_filter_hb_m]
%endif
- mova m5, [fourtap_filter_hb+r5-16] ; set up 4tap filter in bytes
- mova m6, [fourtap_filter_hb+r5]
+ mova m5, [fourtap_filter_hb+mxq-16] ; set up 4tap filter in bytes
+ mova m6, [fourtap_filter_hb+mxq]
-.nextrow
- movu m0, [r2-1]
+.nextrow:
+ movu m0, [srcq-1]
mova m1, m0
pshufb m0, m3
pshufb m1, m4
pmaddubsw m0, m5
pmaddubsw m1, m6
- paddsw m0, m2
paddsw m0, m1
- psraw m0, 7
+ pmulhrsw m0, m2
packuswb m0, m0
- movh [r0], m0 ; store
+ movh [dstq], m0 ; store
; go to next line
- add r0, r1
- add r2, r3
- dec r4d ; next row
+ add dstq, dststrideq
+ add srcq, srcstrideq
+ dec heightd ; next row
jg .nextrow
REP_RET
-cglobal put_vp8_epel%1_v4_ssse3, 7, 7, %2
- shl r6d, 4
+cglobal put_vp8_epel%1_v4, 7, 7, 8, dst, dststride, src, srcstride, height, picreg, my
+ shl myd, 4
%ifdef PIC
- lea r11, [fourtap_filter_hb_m]
+ lea picregq, [fourtap_filter_hb_m]
%endif
- mova m5, [fourtap_filter_hb+r6-16]
- mova m6, [fourtap_filter_hb+r6]
- mova m7, [pw_64]
+ mova m5, [fourtap_filter_hb+myq-16]
+ mova m6, [fourtap_filter_hb+myq]
+ mova m7, [pw_256]
; read 3 lines
- sub r2, r3
- movh m0, [r2]
- movh m1, [r2+ r3]
- movh m2, [r2+2*r3]
- add r2, r3
-
-.nextrow
- movh m3, [r2+2*r3] ; read new row
+ sub srcq, srcstrideq
+ movh m0, [srcq]
+ movh m1, [srcq+ srcstrideq]
+ movh m2, [srcq+2*srcstrideq]
+ add srcq, srcstrideq
+
+.nextrow:
+ movh m3, [srcq+2*srcstrideq] ; read new row
mova m4, m0
mova m0, m1
punpcklbw m4, m1
@@ -273,84 +274,83 @@ cglobal put_vp8_epel%1_v4_ssse3, 7, 7, %2
pmaddubsw m2, m6
paddsw m4, m2
mova m2, m3
- paddsw m4, m7
- psraw m4, 7
+ pmulhrsw m4, m7
packuswb m4, m4
- movh [r0], m4
+ movh [dstq], m4
; go to next line
- add r0, r1
- add r2, r3
- dec r4d ; next row
+ add dstq, dststrideq
+ add srcq, srcstrideq
+ dec heightd ; next row
jg .nextrow
REP_RET
-cglobal put_vp8_epel%1_v6_ssse3, 7, 7, %2
- lea r6d, [r6*3]
+cglobal put_vp8_epel%1_v6, 7, 7, 8, dst, dststride, src, srcstride, height, picreg, my
+ lea myd, [myq*3]
%ifdef PIC
- lea r11, [sixtap_filter_hb_m]
+ lea picregq, [sixtap_filter_hb_m]
%endif
- lea r6, [sixtap_filter_hb+r6*8]
+ lea myq, [sixtap_filter_hb+myq*8]
; read 5 lines
- sub r2, r3
- sub r2, r3
- movh m0, [r2]
- movh m1, [r2+r3]
- movh m2, [r2+r3*2]
- lea r2, [r2+r3*2]
- add r2, r3
- movh m3, [r2]
- movh m4, [r2+r3]
-
-.nextrow
- movh m5, [r2+2*r3] ; read new row
+ sub srcq, srcstrideq
+ sub srcq, srcstrideq
+ movh m0, [srcq]
+ movh m1, [srcq+srcstrideq]
+ movh m2, [srcq+srcstrideq*2]
+ lea srcq, [srcq+srcstrideq*2]
+ add srcq, srcstrideq
+ movh m3, [srcq]
+ movh m4, [srcq+srcstrideq]
+
+.nextrow:
+ movh m5, [srcq+2*srcstrideq] ; read new row
mova m6, m0
punpcklbw m6, m5
mova m0, m1
punpcklbw m1, m2
mova m7, m3
punpcklbw m7, m4
- pmaddubsw m6, [r6-48]
- pmaddubsw m1, [r6-32]
- pmaddubsw m7, [r6-16]
+ pmaddubsw m6, [myq-48]
+ pmaddubsw m1, [myq-32]
+ pmaddubsw m7, [myq-16]
paddsw m6, m1
paddsw m6, m7
mova m1, m2
- paddsw m6, [pw_64]
mova m2, m3
- psraw m6, 7
+ pmulhrsw m6, [pw_256]
mova m3, m4
packuswb m6, m6
mova m4, m5
- movh [r0], m6
+ movh [dstq], m6
; go to next line
- add r0, r1
- add r2, r3
- dec r4d ; next row
+ add dstq, dststrideq
+ add srcq, srcstrideq
+ dec heightd ; next row
jg .nextrow
REP_RET
%endmacro
-INIT_MMX
-FILTER_SSSE3 4, 0, 0
-INIT_XMM
-FILTER_SSSE3 8, 8, 7
+INIT_MMX ssse3
+FILTER_SSSE3 4
+INIT_XMM ssse3
+FILTER_SSSE3 8
; 4x4 block, H-only 4-tap filter
-cglobal put_vp8_epel4_h4_mmxext, 6, 6
- shl r5d, 4
+INIT_MMX mmxext
+cglobal put_vp8_epel4_h4, 6, 6 + npicregs, 0, dst, dststride, src, srcstride, height, mx, picreg
+ shl mxd, 4
%ifdef PIC
- lea r11, [fourtap_filter_hw_m]
+ lea picregq, [fourtap_filter_hw_m]
%endif
- movq mm4, [fourtap_filter_hw+r5-16] ; set up 4tap filter in words
- movq mm5, [fourtap_filter_hw+r5]
+ movq mm4, [fourtap_filter_hw+mxq-16] ; set up 4tap filter in words
+ movq mm5, [fourtap_filter_hw+mxq]
movq mm7, [pw_64]
pxor mm6, mm6
-.nextrow
- movq mm1, [r2-1] ; (ABCDEFGH) load 8 horizontal pixels
+.nextrow:
+ movq mm1, [srcq-1] ; (ABCDEFGH) load 8 horizontal pixels
; first set of 2 pixels
movq mm2, mm1 ; byte ABCD..
@@ -376,29 +376,30 @@ cglobal put_vp8_epel4_h4_mmxext, 6, 6
paddsw mm3, mm7 ; rounding
psraw mm3, 7
packuswb mm3, mm6 ; clip and word->bytes
- movd [r0], mm3 ; store
+ movd [dstq], mm3 ; store
; go to next line
- add r0, r1
- add r2, r3
- dec r4d ; next row
+ add dstq, dststrideq
+ add srcq, srcstrideq
+ dec heightd ; next row
jg .nextrow
REP_RET
; 4x4 block, H-only 6-tap filter
-cglobal put_vp8_epel4_h6_mmxext, 6, 6
- lea r5d, [r5*3]
+INIT_MMX mmxext
+cglobal put_vp8_epel4_h6, 6, 6 + npicregs, 0, dst, dststride, src, srcstride, height, mx, picreg
+ lea mxd, [mxq*3]
%ifdef PIC
- lea r11, [sixtap_filter_hw_m]
+ lea picregq, [sixtap_filter_hw_m]
%endif
- movq mm4, [sixtap_filter_hw+r5*8-48] ; set up 4tap filter in words
- movq mm5, [sixtap_filter_hw+r5*8-32]
- movq mm6, [sixtap_filter_hw+r5*8-16]
+ movq mm4, [sixtap_filter_hw+mxq*8-48] ; set up 4tap filter in words
+ movq mm5, [sixtap_filter_hw+mxq*8-32]
+ movq mm6, [sixtap_filter_hw+mxq*8-16]
movq mm7, [pw_64]
pxor mm3, mm3
-.nextrow
- movq mm1, [r2-2] ; (ABCDEFGH) load 8 horizontal pixels
+.nextrow:
+ movq mm1, [srcq-2] ; (ABCDEFGH) load 8 horizontal pixels
; first set of 2 pixels
movq mm2, mm1 ; byte ABCD..
@@ -418,7 +419,7 @@ cglobal put_vp8_epel4_h6_mmxext, 6, 6
paddd mm1, mm2 ; finish 1st 2px
; second set of 2 pixels, use backup of above
- movd mm2, [r2+3] ; byte FGHI (prevent overreads)
+ movd mm2, [srcq+3] ; byte FGHI (prevent overreads)
pmaddwd mm0, mm4 ; multiply 1st backed up 2px with F0/F1
pmaddwd mm3, mm5 ; multiply 2nd backed up 2px with F2/F3
paddd mm0, mm3 ; add to 2nd 2px cache
@@ -433,35 +434,35 @@ cglobal put_vp8_epel4_h6_mmxext, 6, 6
paddsw mm1, mm7 ; rounding
psraw mm1, 7
packuswb mm1, mm3 ; clip and word->bytes
- movd [r0], mm1 ; store
+ movd [dstq], mm1 ; store
; go to next line
- add r0, r1
- add r2, r3
- dec r4d ; next row
+ add dstq, dststrideq
+ add srcq, srcstrideq
+ dec heightd ; next row
jg .nextrow
REP_RET
-INIT_XMM
-cglobal put_vp8_epel8_h4_sse2, 6, 6, 10
- shl r5d, 5
+INIT_XMM sse2
+cglobal put_vp8_epel8_h4, 6, 6 + npicregs, 10, dst, dststride, src, srcstride, height, mx, picreg
+ shl mxd, 5
%ifdef PIC
- lea r11, [fourtap_filter_v_m]
+ lea picregq, [fourtap_filter_v_m]
%endif
- lea r5, [fourtap_filter_v+r5-32]
+ lea mxq, [fourtap_filter_v+mxq-32]
pxor m7, m7
mova m4, [pw_64]
- mova m5, [r5+ 0]
- mova m6, [r5+16]
+ mova m5, [mxq+ 0]
+ mova m6, [mxq+16]
%ifdef m8
- mova m8, [r5+32]
- mova m9, [r5+48]
-%endif
-.nextrow
- movq m0, [r2-1]
- movq m1, [r2-0]
- movq m2, [r2+1]
- movq m3, [r2+2]
+ mova m8, [mxq+32]
+ mova m9, [mxq+48]
+%endif
+.nextrow:
+ movq m0, [srcq-1]
+ movq m1, [srcq-0]
+ movq m2, [srcq+1]
+ movq m3, [srcq+2]
punpcklbw m0, m7
punpcklbw m1, m7
punpcklbw m2, m7
@@ -472,8 +473,8 @@ cglobal put_vp8_epel8_h4_sse2, 6, 6, 10
pmullw m2, m8
pmullw m3, m9
%else
- pmullw m2, [r5+32]
- pmullw m3, [r5+48]
+ pmullw m2, [mxq+32]
+ pmullw m3, [mxq+48]
%endif
paddsw m0, m1
paddsw m2, m3
@@ -481,39 +482,40 @@ cglobal put_vp8_epel8_h4_sse2, 6, 6, 10
paddsw m0, m4
psraw m0, 7
packuswb m0, m7
- movh [r0], m0 ; store
+ movh [dstq], m0 ; store
; go to next line
- add r0, r1
- add r2, r3
- dec r4d ; next row
+ add dstq, dststrideq
+ add srcq, srcstrideq
+ dec heightd ; next row
jg .nextrow
REP_RET
-cglobal put_vp8_epel8_h6_sse2, 6, 6, 14
- lea r5d, [r5*3]
- shl r5d, 4
+INIT_XMM sse2
+cglobal put_vp8_epel8_h6, 6, 6 + npicregs, 14, dst, dststride, src, srcstride, height, mx, picreg
+ lea mxd, [mxq*3]
+ shl mxd, 4
%ifdef PIC
- lea r11, [sixtap_filter_v_m]
+ lea picregq, [sixtap_filter_v_m]
%endif
- lea r5, [sixtap_filter_v+r5-96]
+ lea mxq, [sixtap_filter_v+mxq-96]
pxor m7, m7
mova m6, [pw_64]
%ifdef m8
- mova m8, [r5+ 0]
- mova m9, [r5+16]
- mova m10, [r5+32]
- mova m11, [r5+48]
- mova m12, [r5+64]
- mova m13, [r5+80]
-%endif
-.nextrow
- movq m0, [r2-2]
- movq m1, [r2-1]
- movq m2, [r2-0]
- movq m3, [r2+1]
- movq m4, [r2+2]
- movq m5, [r2+3]
+ mova m8, [mxq+ 0]
+ mova m9, [mxq+16]
+ mova m10, [mxq+32]
+ mova m11, [mxq+48]
+ mova m12, [mxq+64]
+ mova m13, [mxq+80]
+%endif
+.nextrow:
+ movq m0, [srcq-2]
+ movq m1, [srcq-1]
+ movq m2, [srcq-0]
+ movq m3, [srcq+1]
+ movq m4, [srcq+2]
+ movq m5, [srcq+3]
punpcklbw m0, m7
punpcklbw m1, m7
punpcklbw m2, m7
@@ -528,12 +530,12 @@ cglobal put_vp8_epel8_h6_sse2, 6, 6, 14
pmullw m4, m12
pmullw m5, m13
%else
- pmullw m0, [r5+ 0]
- pmullw m1, [r5+16]
- pmullw m2, [r5+32]
- pmullw m3, [r5+48]
- pmullw m4, [r5+64]
- pmullw m5, [r5+80]
+ pmullw m0, [mxq+ 0]
+ pmullw m1, [mxq+16]
+ pmullw m2, [mxq+32]
+ pmullw m3, [mxq+48]
+ pmullw m4, [mxq+64]
+ pmullw m5, [mxq+80]
%endif
paddsw m1, m4
paddsw m0, m5
@@ -543,52 +545,52 @@ cglobal put_vp8_epel8_h6_sse2, 6, 6, 14
paddsw m0, m6
psraw m0, 7
packuswb m0, m7
- movh [r0], m0 ; store
+ movh [dstq], m0 ; store
; go to next line
- add r0, r1
- add r2, r3
- dec r4d ; next row
+ add dstq, dststrideq
+ add srcq, srcstrideq
+ dec heightd ; next row
jg .nextrow
REP_RET
-%macro FILTER_V 3
+%macro FILTER_V 1
; 4x4 block, V-only 4-tap filter
-cglobal put_vp8_epel%2_v4_%1, 7, 7, %3
- shl r6d, 5
+cglobal put_vp8_epel%1_v4, 7, 7, 8, dst, dststride, src, srcstride, height, picreg, my
+ shl myd, 5
%ifdef PIC
- lea r11, [fourtap_filter_v_m]
+ lea picregq, [fourtap_filter_v_m]
%endif
- lea r6, [fourtap_filter_v+r6-32]
+ lea myq, [fourtap_filter_v+myq-32]
mova m6, [pw_64]
pxor m7, m7
- mova m5, [r6+48]
+ mova m5, [myq+48]
; read 3 lines
- sub r2, r3
- movh m0, [r2]
- movh m1, [r2+ r3]
- movh m2, [r2+2*r3]
- add r2, r3
+ sub srcq, srcstrideq
+ movh m0, [srcq]
+ movh m1, [srcq+ srcstrideq]
+ movh m2, [srcq+2*srcstrideq]
+ add srcq, srcstrideq
punpcklbw m0, m7
punpcklbw m1, m7
punpcklbw m2, m7
-.nextrow
+.nextrow:
; first calculate negative taps (to prevent losing positive overflows)
- movh m4, [r2+2*r3] ; read new row
+ movh m4, [srcq+2*srcstrideq] ; read new row
punpcklbw m4, m7
mova m3, m4
- pmullw m0, [r6+0]
+ pmullw m0, [myq+0]
pmullw m4, m5
paddsw m4, m0
; then calculate positive taps
mova m0, m1
- pmullw m1, [r6+16]
+ pmullw m1, [myq+16]
paddsw m4, m1
mova m1, m2
- pmullw m2, [r6+32]
+ pmullw m2, [myq+32]
paddsw m4, m2
mova m2, m3
@@ -596,101 +598,100 @@ cglobal put_vp8_epel%2_v4_%1, 7, 7, %3
paddsw m4, m6
psraw m4, 7
packuswb m4, m7
- movh [r0], m4
+ movh [dstq], m4
; go to next line
- add r0, r1
- add r2, r3
- dec r4d ; next row
+ add dstq, dststrideq
+ add srcq, srcstrideq
+ dec heightd ; next row
jg .nextrow
REP_RET
; 4x4 block, V-only 6-tap filter
-cglobal put_vp8_epel%2_v6_%1, 7, 7, %3
- shl r6d, 4
- lea r6, [r6*3]
+cglobal put_vp8_epel%1_v6, 7, 7, 8, dst, dststride, src, srcstride, height, picreg, my
+ shl myd, 4
+ lea myq, [myq*3]
%ifdef PIC
- lea r11, [sixtap_filter_v_m]
+ lea picregq, [sixtap_filter_v_m]
%endif
- lea r6, [sixtap_filter_v+r6-96]
+ lea myq, [sixtap_filter_v+myq-96]
pxor m7, m7
; read 5 lines
- sub r2, r3
- sub r2, r3
- movh m0, [r2]
- movh m1, [r2+r3]
- movh m2, [r2+r3*2]
- lea r2, [r2+r3*2]
- add r2, r3
- movh m3, [r2]
- movh m4, [r2+r3]
+ sub srcq, srcstrideq
+ sub srcq, srcstrideq
+ movh m0, [srcq]
+ movh m1, [srcq+srcstrideq]
+ movh m2, [srcq+srcstrideq*2]
+ lea srcq, [srcq+srcstrideq*2]
+ add srcq, srcstrideq
+ movh m3, [srcq]
+ movh m4, [srcq+srcstrideq]
punpcklbw m0, m7
punpcklbw m1, m7
punpcklbw m2, m7
punpcklbw m3, m7
punpcklbw m4, m7
-.nextrow
+.nextrow:
; first calculate negative taps (to prevent losing positive overflows)
mova m5, m1
- pmullw m5, [r6+16]
+ pmullw m5, [myq+16]
mova m6, m4
- pmullw m6, [r6+64]
+ pmullw m6, [myq+64]
paddsw m6, m5
; then calculate positive taps
- movh m5, [r2+2*r3] ; read new row
+ movh m5, [srcq+2*srcstrideq] ; read new row
punpcklbw m5, m7
- pmullw m0, [r6+0]
+ pmullw m0, [myq+0]
paddsw m6, m0
mova m0, m1
mova m1, m2
- pmullw m2, [r6+32]
+ pmullw m2, [myq+32]
paddsw m6, m2
mova m2, m3
- pmullw m3, [r6+48]
+ pmullw m3, [myq+48]
paddsw m6, m3
mova m3, m4
mova m4, m5
- pmullw m5, [r6+80]
+ pmullw m5, [myq+80]
paddsw m6, m5
; round/clip/store
paddsw m6, [pw_64]
psraw m6, 7
packuswb m6, m7
- movh [r0], m6
+ movh [dstq], m6
; go to next line
- add r0, r1
- add r2, r3
- dec r4d ; next row
+ add dstq, dststrideq
+ add srcq, srcstrideq
+ dec heightd ; next row
jg .nextrow
REP_RET
%endmacro
-INIT_MMX
-FILTER_V mmxext, 4, 0
-INIT_XMM
-FILTER_V sse2, 8, 8
+INIT_MMX mmxext
+FILTER_V 4
+INIT_XMM sse2
+FILTER_V 8
-%macro FILTER_BILINEAR 3
-cglobal put_vp8_bilinear%2_v_%1, 7,7,%3
- mov r5d, 8*16
- shl r6d, 4
- sub r5d, r6d
+%macro FILTER_BILINEAR 1
+cglobal put_vp8_bilinear%1_v, 7, 7, 7, dst, dststride, src, srcstride, height, picreg, my
+ shl myd, 4
%ifdef PIC
- lea r11, [bilinear_filter_vw_m]
+ lea picregq, [bilinear_filter_vw_m]
%endif
pxor m6, m6
- mova m4, [bilinear_filter_vw+r5-16]
- mova m5, [bilinear_filter_vw+r6-16]
-.nextrow
- movh m0, [r2+r3*0]
- movh m1, [r2+r3*1]
- movh m3, [r2+r3*2]
+ mova m5, [bilinear_filter_vw+myq-1*16]
+ neg myq
+ mova m4, [bilinear_filter_vw+myq+7*16]
+.nextrow:
+ movh m0, [srcq+srcstrideq*0]
+ movh m1, [srcq+srcstrideq*1]
+ movh m3, [srcq+srcstrideq*2]
punpcklbw m0, m6
punpcklbw m1, m6
punpcklbw m3, m6
@@ -705,38 +706,37 @@ cglobal put_vp8_bilinear%2_v_%1, 7,7,%3
psraw m2, 2
pavgw m0, m6
pavgw m2, m6
-%ifidn %1, mmxext
+%if mmsize == 8
packuswb m0, m0
packuswb m2, m2
- movh [r0+r1*0], m0
- movh [r0+r1*1], m2
+ movh [dstq+dststrideq*0], m0
+ movh [dstq+dststrideq*1], m2
%else
packuswb m0, m2
- movh [r0+r1*0], m0
- movhps [r0+r1*1], m0
+ movh [dstq+dststrideq*0], m0
+ movhps [dstq+dststrideq*1], m0
%endif
- lea r0, [r0+r1*2]
- lea r2, [r2+r3*2]
- sub r4d, 2
+ lea dstq, [dstq+dststrideq*2]
+ lea srcq, [srcq+srcstrideq*2]
+ sub heightd, 2
jg .nextrow
REP_RET
-cglobal put_vp8_bilinear%2_h_%1, 7,7,%3
- mov r6d, 8*16
- shl r5d, 4
- sub r6d, r5d
+cglobal put_vp8_bilinear%1_h, 6, 6 + npicregs, 7, dst, dststride, src, srcstride, height, mx, picreg
+ shl mxd, 4
%ifdef PIC
- lea r11, [bilinear_filter_vw_m]
+ lea picregq, [bilinear_filter_vw_m]
%endif
pxor m6, m6
- mova m4, [bilinear_filter_vw+r6-16]
- mova m5, [bilinear_filter_vw+r5-16]
-.nextrow
- movh m0, [r2+r3*0+0]
- movh m1, [r2+r3*0+1]
- movh m2, [r2+r3*1+0]
- movh m3, [r2+r3*1+1]
+ mova m5, [bilinear_filter_vw+mxq-1*16]
+ neg mxq
+ mova m4, [bilinear_filter_vw+mxq+7*16]
+.nextrow:
+ movh m0, [srcq+srcstrideq*0+0]
+ movh m1, [srcq+srcstrideq*0+1]
+ movh m2, [srcq+srcstrideq*1+0]
+ movh m3, [srcq+srcstrideq*1+1]
punpcklbw m0, m6
punpcklbw m1, m6
punpcklbw m2, m6
@@ -751,41 +751,41 @@ cglobal put_vp8_bilinear%2_h_%1, 7,7,%3
psraw m2, 2
pavgw m0, m6
pavgw m2, m6
-%ifidn %1, mmxext
+%if mmsize == 8
packuswb m0, m0
packuswb m2, m2
- movh [r0+r1*0], m0
- movh [r0+r1*1], m2
+ movh [dstq+dststrideq*0], m0
+ movh [dstq+dststrideq*1], m2
%else
packuswb m0, m2
- movh [r0+r1*0], m0
- movhps [r0+r1*1], m0
+ movh [dstq+dststrideq*0], m0
+ movhps [dstq+dststrideq*1], m0
%endif
- lea r0, [r0+r1*2]
- lea r2, [r2+r3*2]
- sub r4d, 2
+ lea dstq, [dstq+dststrideq*2]
+ lea srcq, [srcq+srcstrideq*2]
+ sub heightd, 2
jg .nextrow
REP_RET
%endmacro
-INIT_MMX
-FILTER_BILINEAR mmxext, 4, 0
-INIT_XMM
-FILTER_BILINEAR sse2, 8, 7
+INIT_MMX mmxext
+FILTER_BILINEAR 4
+INIT_XMM sse2
+FILTER_BILINEAR 8
%macro FILTER_BILINEAR_SSSE3 1
-cglobal put_vp8_bilinear%1_v_ssse3, 7,7
- shl r6d, 4
+cglobal put_vp8_bilinear%1_v, 7, 7, 5, dst, dststride, src, srcstride, height, picreg, my
+ shl myd, 4
%ifdef PIC
- lea r11, [bilinear_filter_vb_m]
+ lea picregq, [bilinear_filter_vb_m]
%endif
pxor m4, m4
- mova m3, [bilinear_filter_vb+r6-16]
-.nextrow
- movh m0, [r2+r3*0]
- movh m1, [r2+r3*1]
- movh m2, [r2+r3*2]
+ mova m3, [bilinear_filter_vb+myq-16]
+.nextrow:
+ movh m0, [srcq+srcstrideq*0]
+ movh m1, [srcq+srcstrideq*1]
+ movh m2, [srcq+srcstrideq*2]
punpcklbw m0, m1
punpcklbw m1, m2
pmaddubsw m0, m3
@@ -797,31 +797,31 @@ cglobal put_vp8_bilinear%1_v_ssse3, 7,7
%if mmsize==8
packuswb m0, m0
packuswb m1, m1
- movh [r0+r1*0], m0
- movh [r0+r1*1], m1
+ movh [dstq+dststrideq*0], m0
+ movh [dstq+dststrideq*1], m1
%else
packuswb m0, m1
- movh [r0+r1*0], m0
- movhps [r0+r1*1], m0
+ movh [dstq+dststrideq*0], m0
+ movhps [dstq+dststrideq*1], m0
%endif
- lea r0, [r0+r1*2]
- lea r2, [r2+r3*2]
- sub r4d, 2
+ lea dstq, [dstq+dststrideq*2]
+ lea srcq, [srcq+srcstrideq*2]
+ sub heightd, 2
jg .nextrow
REP_RET
-cglobal put_vp8_bilinear%1_h_ssse3, 7,7
- shl r5d, 4
+cglobal put_vp8_bilinear%1_h, 6, 6 + npicregs, 5, dst, dststride, src, srcstride, height, mx, picreg
+ shl mxd, 4
%ifdef PIC
- lea r11, [bilinear_filter_vb_m]
+ lea picregq, [bilinear_filter_vb_m]
%endif
pxor m4, m4
mova m2, [filter_h2_shuf]
- mova m3, [bilinear_filter_vb+r5-16]
-.nextrow
- movu m0, [r2+r3*0]
- movu m1, [r2+r3*1]
+ mova m3, [bilinear_filter_vb+mxq-16]
+.nextrow:
+ movu m0, [srcq+srcstrideq*0]
+ movu m1, [srcq+srcstrideq*1]
pshufb m0, m2
pshufb m1, m2
pmaddubsw m0, m3
@@ -833,63 +833,68 @@ cglobal put_vp8_bilinear%1_h_ssse3, 7,7
%if mmsize==8
packuswb m0, m0
packuswb m1, m1
- movh [r0+r1*0], m0
- movh [r0+r1*1], m1
+ movh [dstq+dststrideq*0], m0
+ movh [dstq+dststrideq*1], m1
%else
packuswb m0, m1
- movh [r0+r1*0], m0
- movhps [r0+r1*1], m0
+ movh [dstq+dststrideq*0], m0
+ movhps [dstq+dststrideq*1], m0
%endif
- lea r0, [r0+r1*2]
- lea r2, [r2+r3*2]
- sub r4d, 2
+ lea dstq, [dstq+dststrideq*2]
+ lea srcq, [srcq+srcstrideq*2]
+ sub heightd, 2
jg .nextrow
REP_RET
%endmacro
-INIT_MMX
+INIT_MMX ssse3
FILTER_BILINEAR_SSSE3 4
-INIT_XMM
+INIT_XMM ssse3
FILTER_BILINEAR_SSSE3 8
-cglobal put_vp8_pixels8_mmx, 5,5
+INIT_MMX mmx
+cglobal put_vp8_pixels8, 5, 5, 0, dst, dststride, src, srcstride, height
.nextrow:
- movq mm0, [r2+r3*0]
- movq mm1, [r2+r3*1]
- lea r2, [r2+r3*2]
- movq [r0+r1*0], mm0
- movq [r0+r1*1], mm1
- lea r0, [r0+r1*2]
- sub r4d, 2
+ movq mm0, [srcq+srcstrideq*0]
+ movq mm1, [srcq+srcstrideq*1]
+ lea srcq, [srcq+srcstrideq*2]
+ movq [dstq+dststrideq*0], mm0
+ movq [dstq+dststrideq*1], mm1
+ lea dstq, [dstq+dststrideq*2]
+ sub heightd, 2
jg .nextrow
REP_RET
-cglobal put_vp8_pixels16_mmx, 5,5
+%if ARCH_X86_32
+INIT_MMX mmx
+cglobal put_vp8_pixels16, 5, 5, 0, dst, dststride, src, srcstride, height
.nextrow:
- movq mm0, [r2+r3*0+0]
- movq mm1, [r2+r3*0+8]
- movq mm2, [r2+r3*1+0]
- movq mm3, [r2+r3*1+8]
- lea r2, [r2+r3*2]
- movq [r0+r1*0+0], mm0
- movq [r0+r1*0+8], mm1
- movq [r0+r1*1+0], mm2
- movq [r0+r1*1+8], mm3
- lea r0, [r0+r1*2]
- sub r4d, 2
+ movq mm0, [srcq+srcstrideq*0+0]
+ movq mm1, [srcq+srcstrideq*0+8]
+ movq mm2, [srcq+srcstrideq*1+0]
+ movq mm3, [srcq+srcstrideq*1+8]
+ lea srcq, [srcq+srcstrideq*2]
+ movq [dstq+dststrideq*0+0], mm0
+ movq [dstq+dststrideq*0+8], mm1
+ movq [dstq+dststrideq*1+0], mm2
+ movq [dstq+dststrideq*1+8], mm3
+ lea dstq, [dstq+dststrideq*2]
+ sub heightd, 2
jg .nextrow
REP_RET
+%endif
-cglobal put_vp8_pixels16_sse, 5,5,2
+INIT_XMM sse
+cglobal put_vp8_pixels16, 5, 5, 2, dst, dststride, src, srcstride, height
.nextrow:
- movups xmm0, [r2+r3*0]
- movups xmm1, [r2+r3*1]
- lea r2, [r2+r3*2]
- movaps [r0+r1*0], xmm0
- movaps [r0+r1*1], xmm1
- lea r0, [r0+r1*2]
- sub r4d, 2
+ movups xmm0, [srcq+srcstrideq*0]
+ movups xmm1, [srcq+srcstrideq*1]
+ lea srcq, [srcq+srcstrideq*2]
+ movaps [dstq+dststrideq*0], xmm0
+ movaps [dstq+dststrideq*1], xmm1
+ lea dstq, [dstq+dststrideq*2]
+ sub heightd, 2
jg .nextrow
REP_RET
@@ -898,10 +903,10 @@ cglobal put_vp8_pixels16_sse, 5,5,2
;-----------------------------------------------------------------------------
%macro ADD_DC 4
- %4 m2, [r0+%3]
- %4 m3, [r0+r2+%3]
- %4 m4, [r1+%3]
- %4 m5, [r1+r2+%3]
+ %4 m2, [dst1q+%3]
+ %4 m3, [dst1q+strideq+%3]
+ %4 m4, [dst2q+%3]
+ %4 m5, [dst2q+strideq+%3]
paddusb m2, %1
paddusb m3, %1
paddusb m4, %1
@@ -910,22 +915,22 @@ cglobal put_vp8_pixels16_sse, 5,5,2
psubusb m3, %2
psubusb m4, %2
psubusb m5, %2
- %4 [r0+%3], m2
- %4 [r0+r2+%3], m3
- %4 [r1+%3], m4
- %4 [r1+r2+%3], m5
+ %4 [dst1q+%3], m2
+ %4 [dst1q+strideq+%3], m3
+ %4 [dst2q+%3], m4
+ %4 [dst2q+strideq+%3], m5
%endmacro
-INIT_MMX
-cglobal vp8_idct_dc_add_mmx, 3, 3
+INIT_MMX mmx
+cglobal vp8_idct_dc_add, 3, 3, 0, dst, block, stride
; load data
- movd m0, [r1]
+ movd m0, [blockq]
; calculate DC
paddw m0, [pw_4]
pxor m1, m1
psraw m0, 3
- movd [r1], m1
+ movd [blockq], m1
psubw m1, m0
packuswb m0, m0
packuswb m1, m1
@@ -935,24 +940,26 @@ cglobal vp8_idct_dc_add_mmx, 3, 3
punpcklwd m1, m1
; add DC
- lea r1, [r0+r2*2]
+ DEFINE_ARGS dst1, dst2, stride
+ lea dst2q, [dst1q+strideq*2]
ADD_DC m0, m1, 0, movh
RET
-INIT_XMM
-cglobal vp8_idct_dc_add_sse4, 3, 3, 6
+INIT_XMM sse4
+cglobal vp8_idct_dc_add, 3, 3, 6, dst, block, stride
; load data
- movd m0, [r1]
+ movd m0, [blockq]
pxor m1, m1
; calculate DC
paddw m0, [pw_4]
- movd [r1], m1
- lea r1, [r0+r2*2]
- movd m2, [r0]
- movd m3, [r0+r2]
- movd m4, [r1]
- movd m5, [r1+r2]
+ movd [blockq], m1
+ DEFINE_ARGS dst1, dst2, stride
+ lea dst2q, [dst1q+strideq*2]
+ movd m2, [dst1q]
+ movd m3, [dst1q+strideq]
+ movd m4, [dst2q]
+ movd m5, [dst2q+strideq]
psraw m0, 3
pshuflw m0, m0, 0
punpcklqdq m0, m0
@@ -963,32 +970,33 @@ cglobal vp8_idct_dc_add_sse4, 3, 3, 6
paddw m2, m0
paddw m4, m0
packuswb m2, m4
- movd [r0], m2
- pextrd [r0+r2], m2, 1
- pextrd [r1], m2, 2
- pextrd [r1+r2], m2, 3
+ movd [dst1q], m2
+ pextrd [dst1q+strideq], m2, 1
+ pextrd [dst2q], m2, 2
+ pextrd [dst2q+strideq], m2, 3
RET
;-----------------------------------------------------------------------------
; void vp8_idct_dc_add4y_<opt>(uint8_t *dst, DCTELEM block[4][16], int stride);
;-----------------------------------------------------------------------------
-INIT_MMX
-cglobal vp8_idct_dc_add4y_mmx, 3, 3
+%if ARCH_X86_32
+INIT_MMX mmx
+cglobal vp8_idct_dc_add4y, 3, 3, 0, dst, block, stride
; load data
- movd m0, [r1+32*0] ; A
- movd m1, [r1+32*2] ; C
- punpcklwd m0, [r1+32*1] ; A B
- punpcklwd m1, [r1+32*3] ; C D
+ movd m0, [blockq+32*0] ; A
+ movd m1, [blockq+32*2] ; C
+ punpcklwd m0, [blockq+32*1] ; A B
+ punpcklwd m1, [blockq+32*3] ; C D
punpckldq m0, m1 ; A B C D
pxor m6, m6
; calculate DC
paddw m0, [pw_4]
- movd [r1+32*0], m6
- movd [r1+32*1], m6
- movd [r1+32*2], m6
- movd [r1+32*3], m6
+ movd [blockq+32*0], m6
+ movd [blockq+32*1], m6
+ movd [blockq+32*2], m6
+ movd [blockq+32*3], m6
psraw m0, 3
psubw m6, m0
packuswb m0, m0
@@ -1003,27 +1011,29 @@ cglobal vp8_idct_dc_add4y_mmx, 3, 3
punpckhbw m7, m7 ; CCCCDDDD
; add DC
- lea r1, [r0+r2*2]
+ DEFINE_ARGS dst1, dst2, stride
+ lea dst2q, [dst1q+strideq*2]
ADD_DC m0, m6, 0, mova
ADD_DC m1, m7, 8, mova
RET
+%endif
-INIT_XMM
-cglobal vp8_idct_dc_add4y_sse2, 3, 3, 6
+INIT_XMM sse2
+cglobal vp8_idct_dc_add4y, 3, 3, 6, dst, block, stride
; load data
- movd m0, [r1+32*0] ; A
- movd m1, [r1+32*2] ; C
- punpcklwd m0, [r1+32*1] ; A B
- punpcklwd m1, [r1+32*3] ; C D
+ movd m0, [blockq+32*0] ; A
+ movd m1, [blockq+32*2] ; C
+ punpcklwd m0, [blockq+32*1] ; A B
+ punpcklwd m1, [blockq+32*3] ; C D
punpckldq m0, m1 ; A B C D
pxor m1, m1
; calculate DC
paddw m0, [pw_4]
- movd [r1+32*0], m1
- movd [r1+32*1], m1
- movd [r1+32*2], m1
- movd [r1+32*3], m1
+ movd [blockq+32*0], m1
+ movd [blockq+32*1], m1
+ movd [blockq+32*2], m1
+ movd [blockq+32*3], m1
psraw m0, 3
psubw m1, m0
packuswb m0, m0
@@ -1034,7 +1044,8 @@ cglobal vp8_idct_dc_add4y_sse2, 3, 3, 6
punpcklbw m1, m1
; add DC
- lea r1, [r0+r2*2]
+ DEFINE_ARGS dst1, dst2, stride
+ lea dst2q, [dst1q+strideq*2]
ADD_DC m0, m1, 0, mova
RET
@@ -1042,22 +1053,22 @@ cglobal vp8_idct_dc_add4y_sse2, 3, 3, 6
; void vp8_idct_dc_add4uv_<opt>(uint8_t *dst, DCTELEM block[4][16], int stride);
;-----------------------------------------------------------------------------
-INIT_MMX
-cglobal vp8_idct_dc_add4uv_mmx, 3, 3
+INIT_MMX mmx
+cglobal vp8_idct_dc_add4uv, 3, 3, 0, dst, block, stride
; load data
- movd m0, [r1+32*0] ; A
- movd m1, [r1+32*2] ; C
- punpcklwd m0, [r1+32*1] ; A B
- punpcklwd m1, [r1+32*3] ; C D
+ movd m0, [blockq+32*0] ; A
+ movd m1, [blockq+32*2] ; C
+ punpcklwd m0, [blockq+32*1] ; A B
+ punpcklwd m1, [blockq+32*3] ; C D
punpckldq m0, m1 ; A B C D
pxor m6, m6
; calculate DC
paddw m0, [pw_4]
- movd [r1+32*0], m6
- movd [r1+32*1], m6
- movd [r1+32*2], m6
- movd [r1+32*3], m6
+ movd [blockq+32*0], m6
+ movd [blockq+32*1], m6
+ movd [blockq+32*2], m6
+ movd [blockq+32*3], m6
psraw m0, 3
psubw m6, m0
packuswb m0, m0
@@ -1072,10 +1083,11 @@ cglobal vp8_idct_dc_add4uv_mmx, 3, 3
punpckhbw m7, m7 ; CCCCDDDD
; add DC
- lea r1, [r0+r2*2]
+ DEFINE_ARGS dst1, dst2, stride
+ lea dst2q, [dst1q+strideq*2]
ADD_DC m0, m6, 0, mova
- lea r0, [r0+r2*4]
- lea r1, [r1+r2*4]
+ lea dst1q, [dst1q+strideq*4]
+ lea dst2q, [dst2q+strideq*4]
ADD_DC m1, m7, 0, mova
RET
@@ -1114,26 +1126,25 @@ cglobal vp8_idct_dc_add4uv_mmx, 3, 3
SWAP %4, %3
%endmacro
-INIT_MMX
-%macro VP8_IDCT_ADD 1
-cglobal vp8_idct_add_%1, 3, 3
+%macro VP8_IDCT_ADD 0
+cglobal vp8_idct_add, 3, 3, 0, dst, block, stride
; load block data
- movq m0, [r1+ 0]
- movq m1, [r1+ 8]
- movq m2, [r1+16]
- movq m3, [r1+24]
+ movq m0, [blockq+ 0]
+ movq m1, [blockq+ 8]
+ movq m2, [blockq+16]
+ movq m3, [blockq+24]
movq m6, [pw_20091]
movq m7, [pw_17734]
-%ifidn %1, sse
+%if cpuflag(sse)
xorps xmm0, xmm0
- movaps [r1+ 0], xmm0
- movaps [r1+16], xmm0
+ movaps [blockq+ 0], xmm0
+ movaps [blockq+16], xmm0
%else
pxor m4, m4
- movq [r1+ 0], m4
- movq [r1+ 8], m4
- movq [r1+16], m4
- movq [r1+24], m4
+ movq [blockq+ 0], m4
+ movq [blockq+ 8], m4
+ movq [blockq+16], m4
+ movq [blockq+24], m4
%endif
; actual IDCT
@@ -1145,39 +1156,44 @@ cglobal vp8_idct_add_%1, 3, 3
; store
pxor m4, m4
- lea r1, [r0+2*r2]
- STORE_DIFFx2 m0, m1, m6, m7, m4, 3, r0, r2
- STORE_DIFFx2 m2, m3, m6, m7, m4, 3, r1, r2
+ DEFINE_ARGS dst1, dst2, stride
+ lea dst2q, [dst1q+2*strideq]
+ STORE_DIFFx2 m0, m1, m6, m7, m4, 3, dst1q, strideq
+ STORE_DIFFx2 m2, m3, m6, m7, m4, 3, dst2q, strideq
RET
%endmacro
-VP8_IDCT_ADD mmx
-VP8_IDCT_ADD sse
+%if ARCH_X86_32
+INIT_MMX mmx
+VP8_IDCT_ADD
+%endif
+INIT_MMX sse
+VP8_IDCT_ADD
;-----------------------------------------------------------------------------
; void vp8_luma_dc_wht_mmxext(DCTELEM block[4][4][16], DCTELEM dc[16])
;-----------------------------------------------------------------------------
%macro SCATTER_WHT 3
- movd r1d, m%1
- movd r2d, m%2
- mov [r0+2*16*(0+%3)], r1w
- mov [r0+2*16*(1+%3)], r2w
- shr r1d, 16
- shr r2d, 16
+ movd dc1d, m%1
+ movd dc2d, m%2
+ mov [blockq+2*16*(0+%3)], dc1w
+ mov [blockq+2*16*(1+%3)], dc2w
+ shr dc1d, 16
+ shr dc2d, 16
psrlq m%1, 32
psrlq m%2, 32
- mov [r0+2*16*(4+%3)], r1w
- mov [r0+2*16*(5+%3)], r2w
- movd r1d, m%1
- movd r2d, m%2
- mov [r0+2*16*(8+%3)], r1w
- mov [r0+2*16*(9+%3)], r2w
- shr r1d, 16
- shr r2d, 16
- mov [r0+2*16*(12+%3)], r1w
- mov [r0+2*16*(13+%3)], r2w
+ mov [blockq+2*16*(4+%3)], dc1w
+ mov [blockq+2*16*(5+%3)], dc2w
+ movd dc1d, m%1
+ movd dc2d, m%2
+ mov [blockq+2*16*(8+%3)], dc1w
+ mov [blockq+2*16*(9+%3)], dc2w
+ shr dc1d, 16
+ shr dc2d, 16
+ mov [blockq+2*16*(12+%3)], dc1w
+ mov [blockq+2*16*(13+%3)], dc2w
%endmacro
%macro HADAMARD4_1D 4
@@ -1186,22 +1202,22 @@ VP8_IDCT_ADD sse
SWAP %1, %4, %3
%endmacro
-%macro VP8_DC_WHT 1
-cglobal vp8_luma_dc_wht_%1, 2,3
- movq m0, [r1]
- movq m1, [r1+8]
- movq m2, [r1+16]
- movq m3, [r1+24]
-%ifidn %1, sse
+%macro VP8_DC_WHT 0
+cglobal vp8_luma_dc_wht, 2, 3, 0, block, dc1, dc2
+ movq m0, [dc1q]
+ movq m1, [dc1q+8]
+ movq m2, [dc1q+16]
+ movq m3, [dc1q+24]
+%if cpuflag(sse)
xorps xmm0, xmm0
- movaps [r1+ 0], xmm0
- movaps [r1+16], xmm0
+ movaps [dc1q+ 0], xmm0
+ movaps [dc1q+16], xmm0
%else
pxor m4, m4
- movq [r1+ 0], m4
- movq [r1+ 8], m4
- movq [r1+16], m4
- movq [r1+24], m4
+ movq [dc1q+ 0], m4
+ movq [dc1q+ 8], m4
+ movq [dc1q+16], m4
+ movq [dc1q+24], m4
%endif
HADAMARD4_1D 0, 1, 2, 3
TRANSPOSE4x4W 0, 1, 2, 3, 4
@@ -1216,9 +1232,12 @@ cglobal vp8_luma_dc_wht_%1, 2,3
RET
%endmacro
-INIT_MMX
-VP8_DC_WHT mmx
-VP8_DC_WHT sse
+%if ARCH_X86_32
+INIT_MMX mmx
+VP8_DC_WHT
+%endif
+INIT_MMX sse
+VP8_DC_WHT
;-----------------------------------------------------------------------------
; void vp8_h/v_loop_filter_simple_<opt>(uint8_t *dst, int stride, int flim);
@@ -1406,7 +1425,17 @@ VP8_DC_WHT sse
add %4, %5
%endmacro
-%macro WRITE_8W_SSE2 5
+%macro WRITE_8W 5
+%if cpuflag(sse4)
+ pextrw [%3+%4*4], %1, 0
+ pextrw [%2+%4*4], %1, 1
+ pextrw [%3+%4*2], %1, 2
+ pextrw [%3+%4 ], %1, 3
+ pextrw [%3 ], %1, 4
+ pextrw [%2 ], %1, 5
+ pextrw [%2+%5 ], %1, 6
+ pextrw [%2+%5*2], %1, 7
+%else
movd %2d, %1
psrldq %1, 4
mov [%3+%4*4], %2w
@@ -1432,79 +1461,47 @@ VP8_DC_WHT sse
mov [%3+%5 ], %2w
shr %2, 16
mov [%3+%5*2], %2w
+%endif
%endmacro
-%macro WRITE_8W_SSE4 5
- pextrw [%3+%4*4], %1, 0
- pextrw [%2+%4*4], %1, 1
- pextrw [%3+%4*2], %1, 2
- pextrw [%3+%4 ], %1, 3
- pextrw [%3 ], %1, 4
- pextrw [%2 ], %1, 5
- pextrw [%2+%5 ], %1, 6
- pextrw [%2+%5*2], %1, 7
-%endmacro
-
-%macro SPLATB_REG_MMX 2-3
- movd %1, %2d
- punpcklbw %1, %1
- punpcklwd %1, %1
- punpckldq %1, %1
-%endmacro
-
-%macro SPLATB_REG_MMXEXT 2-3
- movd %1, %2d
- punpcklbw %1, %1
- pshufw %1, %1, 0x0
-%endmacro
-
-%macro SPLATB_REG_SSE2 2-3
- movd %1, %2d
- punpcklbw %1, %1
- pshuflw %1, %1, 0x0
- punpcklqdq %1, %1
-%endmacro
-
-%macro SPLATB_REG_SSSE3 3
- movd %1, %2d
- pshufb %1, %3
-%endmacro
-
-%macro SIMPLE_LOOPFILTER 4
-cglobal vp8_%2_loop_filter_simple_%1, 3, %3, %4
+%macro SIMPLE_LOOPFILTER 2
+cglobal vp8_%1_loop_filter_simple, 3, %2, 8, dst, stride, flim, cntr
%if mmsize == 8 ; mmx/mmxext
- mov r3, 2
+ mov cntrq, 2
%endif
-%ifnidn %1, sse2
-%if mmsize == 16
+%if cpuflag(ssse3)
pxor m0, m0
%endif
-%endif
- SPLATB_REG m7, r2, m0 ; splat "flim" into register
+ SPLATB_REG m7, flim, m0 ; splat "flim" into register
; set up indexes to address 4 rows
- mov r2, r1
- neg r1
-%ifidn %2, h
- lea r0, [r0+4*r2-2]
+%if mmsize == 8
+ DEFINE_ARGS dst1, mstride, stride, cntr, dst2
+%else
+ DEFINE_ARGS dst1, mstride, stride, dst3, dst2
+%endif
+ mov strideq, mstrideq
+ neg mstrideq
+%ifidn %1, h
+ lea dst1q, [dst1q+4*strideq-2]
%endif
%if mmsize == 8 ; mmx / mmxext
-.next8px
+.next8px:
%endif
-%ifidn %2, v
+%ifidn %1, v
; read 4 half/full rows of pixels
- mova m0, [r0+r1*2] ; p1
- mova m1, [r0+r1] ; p0
- mova m2, [r0] ; q0
- mova m3, [r0+r2] ; q1
+ mova m0, [dst1q+mstrideq*2] ; p1
+ mova m1, [dst1q+mstrideq] ; p0
+ mova m2, [dst1q] ; q0
+ mova m3, [dst1q+ strideq] ; q1
%else ; h
- lea r4, [r0+r2]
+ lea dst2q, [dst1q+ strideq]
%if mmsize == 8 ; mmx/mmxext
- READ_8x4_INTERLEAVED 0, 1, 2, 3, 4, 5, 6, r0, r4, r1, r2
+ READ_8x4_INTERLEAVED 0, 1, 2, 3, 4, 5, 6, dst1q, dst2q, mstrideq, strideq
%else ; sse2
- READ_16x4_INTERLEAVED 0, 1, 2, 3, 4, 5, 6, r0, r4, r1, r2, r3
+ READ_16x4_INTERLEAVED 0, 1, 2, 3, 4, 5, 6, dst1q, dst2q, mstrideq, strideq, dst3q
%endif
TRANSPOSE4x4W 0, 1, 2, 3, 4
%endif
@@ -1573,36 +1570,36 @@ cglobal vp8_%2_loop_filter_simple_%1, 3, %3, %4
psubusb m6, m3 ; p0+f2
; store
-%ifidn %2, v
- mova [r0], m4
- mova [r0+r1], m6
+%ifidn %1, v
+ mova [dst1q], m4
+ mova [dst1q+mstrideq], m6
%else ; h
- inc r0
+ inc dst1q
SBUTTERFLY bw, 6, 4, 0
%if mmsize == 16 ; sse2
-%ifidn %1, sse4
- inc r4
+%if cpuflag(sse4)
+ inc dst2q
%endif
- WRITE_8W m6, r4, r0, r1, r2
- lea r4, [r3+r1+1]
-%ifidn %1, sse4
- inc r3
+ WRITE_8W m6, dst2q, dst1q, mstrideq, strideq
+ lea dst2q, [dst3q+mstrideq+1]
+%if cpuflag(sse4)
+ inc dst3q
%endif
- WRITE_8W m4, r3, r4, r1, r2
+ WRITE_8W m4, dst3q, dst2q, mstrideq, strideq
%else ; mmx/mmxext
- WRITE_2x4W m6, m4, r4, r0, r1, r2
+ WRITE_2x4W m6, m4, dst2q, dst1q, mstrideq, strideq
%endif
%endif
%if mmsize == 8 ; mmx/mmxext
; next 8 pixels
-%ifidn %2, v
- add r0, 8 ; advance 8 cols = pixels
+%ifidn %1, v
+ add dst1q, 8 ; advance 8 cols = pixels
%else ; h
- lea r0, [r0+r2*8-1] ; advance 8 rows = lines
+ lea dst1q, [dst1q+strideq*8-1] ; advance 8 rows = lines
%endif
- dec r3
+ dec cntrq
jg .next8px
REP_RET
%else ; sse2
@@ -1610,199 +1607,177 @@ cglobal vp8_%2_loop_filter_simple_%1, 3, %3, %4
%endif
%endmacro
-INIT_MMX
-%define SPLATB_REG SPLATB_REG_MMX
-SIMPLE_LOOPFILTER mmx, v, 4, 0
-SIMPLE_LOOPFILTER mmx, h, 5, 0
-%define SPLATB_REG SPLATB_REG_MMXEXT
-SIMPLE_LOOPFILTER mmxext, v, 4, 0
-SIMPLE_LOOPFILTER mmxext, h, 5, 0
-INIT_XMM
-%define SPLATB_REG SPLATB_REG_SSE2
-%define WRITE_8W WRITE_8W_SSE2
-SIMPLE_LOOPFILTER sse2, v, 3, 8
-SIMPLE_LOOPFILTER sse2, h, 5, 8
-%define SPLATB_REG SPLATB_REG_SSSE3
-SIMPLE_LOOPFILTER ssse3, v, 3, 8
-SIMPLE_LOOPFILTER ssse3, h, 5, 8
-%define WRITE_8W WRITE_8W_SSE4
-SIMPLE_LOOPFILTER sse4, h, 5, 8
+%if ARCH_X86_32
+INIT_MMX mmx
+SIMPLE_LOOPFILTER v, 4
+SIMPLE_LOOPFILTER h, 5
+INIT_MMX mmxext
+SIMPLE_LOOPFILTER v, 4
+SIMPLE_LOOPFILTER h, 5
+%endif
+
+INIT_XMM sse2
+SIMPLE_LOOPFILTER v, 3
+SIMPLE_LOOPFILTER h, 5
+INIT_XMM ssse3
+SIMPLE_LOOPFILTER v, 3
+SIMPLE_LOOPFILTER h, 5
+INIT_XMM sse4
+SIMPLE_LOOPFILTER h, 5
;-----------------------------------------------------------------------------
; void vp8_h/v_loop_filter<size>_inner_<opt>(uint8_t *dst, [uint8_t *v,] int stride,
; int flimE, int flimI, int hev_thr);
;-----------------------------------------------------------------------------
-%macro INNER_LOOPFILTER 5
-%if %4 == 8 ; chroma
-cglobal vp8_%2_loop_filter8uv_inner_%1, 6, %3, %5
-%define dst8_reg r1
-%define mstride_reg r2
-%define E_reg r3
-%define I_reg r4
-%define hev_thr_reg r5
+%macro INNER_LOOPFILTER 2
+%define stack_size 0
+%ifndef m8 ; stack layout: [0]=E, [1]=I, [2]=hev_thr
+%ifidn %1, v ; [3]=hev() result
+%define stack_size mmsize * -4
+%else ; h ; extra storage space for transposes
+%define stack_size mmsize * -5
+%endif
+%endif
+
+%if %2 == 8 ; chroma
+cglobal vp8_%1_loop_filter8uv_inner, 6, 6, 13, stack_size, dst, dst8, stride, flimE, flimI, hevthr
%else ; luma
-cglobal vp8_%2_loop_filter16y_inner_%1, 5, %3, %5
-%define mstride_reg r1
-%define E_reg r2
-%define I_reg r3
-%define hev_thr_reg r4
-%ifdef m8 ; x86-64, sse2
-%define dst8_reg r4
-%elif mmsize == 16 ; x86-32, sse2
-%define dst8_reg r5
-%else ; x86-32, mmx/mmxext
-%define cnt_reg r5
-%endif
-%endif
-%define dst_reg r0
-%define stride_reg E_reg
-%define dst2_reg I_reg
-%ifndef m8
-%define stack_reg hev_thr_reg
+cglobal vp8_%1_loop_filter16y_inner, 5, 5, 13, stack_size, dst, stride, flimE, flimI, hevthr
%endif
-%ifnidn %1, sse2
-%if mmsize == 16
+%if cpuflag(ssse3)
pxor m7, m7
%endif
-%endif
-%ifndef m8 ; mmx/mmxext or sse2 on x86-32
+%ifndef m8
; splat function arguments
- SPLATB_REG m0, E_reg, m7 ; E
- SPLATB_REG m1, I_reg, m7 ; I
- SPLATB_REG m2, hev_thr_reg, m7 ; hev_thresh
-
- ; align stack
- mov stack_reg, rsp ; backup stack pointer
- and rsp, ~(mmsize-1) ; align stack
-%ifidn %2, v
- sub rsp, mmsize * 4 ; stack layout: [0]=E, [1]=I, [2]=hev_thr
- ; [3]=hev() result
-%else ; h
- sub rsp, mmsize * 5 ; extra storage space for transposes
-%endif
-
-%define flim_E [rsp]
-%define flim_I [rsp+mmsize]
-%define hev_thr [rsp+mmsize*2]
-%define mask_res [rsp+mmsize*3]
-%define p0backup [rsp+mmsize*3]
-%define q0backup [rsp+mmsize*4]
-
- mova flim_E, m0
- mova flim_I, m1
- mova hev_thr, m2
-
-%else ; sse2 on x86-64
-
-%define flim_E m9
-%define flim_I m10
-%define hev_thr m11
-%define mask_res m12
-%define p0backup m12
-%define q0backup m8
+ SPLATB_REG m0, flimEq, m7 ; E
+ SPLATB_REG m1, flimIq, m7 ; I
+ SPLATB_REG m2, hevthrq, m7 ; hev_thresh
+
+%define m_flimE [rsp]
+%define m_flimI [rsp+mmsize]
+%define m_hevthr [rsp+mmsize*2]
+%define m_maskres [rsp+mmsize*3]
+%define m_p0backup [rsp+mmsize*3]
+%define m_q0backup [rsp+mmsize*4]
+
+ mova m_flimE, m0
+ mova m_flimI, m1
+ mova m_hevthr, m2
+%else
+%define m_flimE m9
+%define m_flimI m10
+%define m_hevthr m11
+%define m_maskres m12
+%define m_p0backup m12
+%define m_q0backup m8
; splat function arguments
- SPLATB_REG flim_E, E_reg, m7 ; E
- SPLATB_REG flim_I, I_reg, m7 ; I
- SPLATB_REG hev_thr, hev_thr_reg, m7 ; hev_thresh
+ SPLATB_REG m_flimE, flimEq, m7 ; E
+ SPLATB_REG m_flimI, flimIq, m7 ; I
+ SPLATB_REG m_hevthr, hevthrq, m7 ; hev_thresh
%endif
-%if mmsize == 8 && %4 == 16 ; mmx/mmxext
- mov cnt_reg, 2
+%if %2 == 8 ; chroma
+ DEFINE_ARGS dst1, dst8, mstride, stride, dst2
+%elif mmsize == 8
+ DEFINE_ARGS dst1, mstride, stride, dst2, cntr
+ mov cntrq, 2
+%else
+ DEFINE_ARGS dst1, mstride, stride, dst2, dst8
%endif
- mov stride_reg, mstride_reg
- neg mstride_reg
-%ifidn %2, h
- lea dst_reg, [dst_reg + stride_reg*4-4]
-%if %4 == 8
- lea dst8_reg, [dst8_reg+ stride_reg*4-4]
+ mov strideq, mstrideq
+ neg mstrideq
+%ifidn %1, h
+ lea dst1q, [dst1q+strideq*4-4]
+%if %2 == 8 ; chroma
+ lea dst8q, [dst8q+strideq*4-4]
%endif
%endif
%if mmsize == 8
-.next8px
+.next8px:
%endif
; read
- lea dst2_reg, [dst_reg + stride_reg]
-%ifidn %2, v
-%if %4 == 8 && mmsize == 16
+ lea dst2q, [dst1q+strideq]
+%ifidn %1, v
+%if %2 == 8 && mmsize == 16
%define movrow movh
%else
%define movrow mova
%endif
- movrow m0, [dst_reg +mstride_reg*4] ; p3
- movrow m1, [dst2_reg+mstride_reg*4] ; p2
- movrow m2, [dst_reg +mstride_reg*2] ; p1
- movrow m5, [dst2_reg] ; q1
- movrow m6, [dst2_reg+ stride_reg] ; q2
- movrow m7, [dst2_reg+ stride_reg*2] ; q3
-%if mmsize == 16 && %4 == 8
- movhps m0, [dst8_reg+mstride_reg*4]
- movhps m2, [dst8_reg+mstride_reg*2]
- add dst8_reg, stride_reg
- movhps m1, [dst8_reg+mstride_reg*4]
- movhps m5, [dst8_reg]
- movhps m6, [dst8_reg+ stride_reg]
- movhps m7, [dst8_reg+ stride_reg*2]
- add dst8_reg, mstride_reg
+ movrow m0, [dst1q+mstrideq*4] ; p3
+ movrow m1, [dst2q+mstrideq*4] ; p2
+ movrow m2, [dst1q+mstrideq*2] ; p1
+ movrow m5, [dst2q] ; q1
+ movrow m6, [dst2q+ strideq*1] ; q2
+ movrow m7, [dst2q+ strideq*2] ; q3
+%if mmsize == 16 && %2 == 8
+ movhps m0, [dst8q+mstrideq*4]
+ movhps m2, [dst8q+mstrideq*2]
+ add dst8q, strideq
+ movhps m1, [dst8q+mstrideq*4]
+ movhps m5, [dst8q]
+ movhps m6, [dst8q+ strideq ]
+ movhps m7, [dst8q+ strideq*2]
+ add dst8q, mstrideq
%endif
%elif mmsize == 8 ; mmx/mmxext (h)
; read 8 rows of 8px each
- movu m0, [dst_reg +mstride_reg*4]
- movu m1, [dst2_reg+mstride_reg*4]
- movu m2, [dst_reg +mstride_reg*2]
- movu m3, [dst_reg +mstride_reg]
- movu m4, [dst_reg]
- movu m5, [dst2_reg]
- movu m6, [dst2_reg+ stride_reg]
+ movu m0, [dst1q+mstrideq*4]
+ movu m1, [dst2q+mstrideq*4]
+ movu m2, [dst1q+mstrideq*2]
+ movu m3, [dst1q+mstrideq ]
+ movu m4, [dst1q]
+ movu m5, [dst2q]
+ movu m6, [dst2q+ strideq ]
; 8x8 transpose
TRANSPOSE4x4B 0, 1, 2, 3, 7
- mova q0backup, m1
- movu m7, [dst2_reg+ stride_reg*2]
+ mova m_q0backup, m1
+ movu m7, [dst2q+ strideq*2]
TRANSPOSE4x4B 4, 5, 6, 7, 1
SBUTTERFLY dq, 0, 4, 1 ; p3/p2
SBUTTERFLY dq, 2, 6, 1 ; q0/q1
SBUTTERFLY dq, 3, 7, 1 ; q2/q3
- mova m1, q0backup
- mova q0backup, m2 ; store q0
+ mova m1, m_q0backup
+ mova m_q0backup, m2 ; store q0
SBUTTERFLY dq, 1, 5, 2 ; p1/p0
- mova p0backup, m5 ; store p0
+ mova m_p0backup, m5 ; store p0
SWAP 1, 4
SWAP 2, 4
SWAP 6, 3
SWAP 5, 3
%else ; sse2 (h)
-%if %4 == 16
- lea dst8_reg, [dst_reg + stride_reg*8]
+%if %2 == 16
+ lea dst8q, [dst1q+ strideq*8]
%endif
; read 16 rows of 8px each, interleave
- movh m0, [dst_reg +mstride_reg*4]
- movh m1, [dst8_reg+mstride_reg*4]
- movh m2, [dst_reg +mstride_reg*2]
- movh m5, [dst8_reg+mstride_reg*2]
- movh m3, [dst_reg +mstride_reg]
- movh m6, [dst8_reg+mstride_reg]
- movh m4, [dst_reg]
- movh m7, [dst8_reg]
+ movh m0, [dst1q+mstrideq*4]
+ movh m1, [dst8q+mstrideq*4]
+ movh m2, [dst1q+mstrideq*2]
+ movh m5, [dst8q+mstrideq*2]
+ movh m3, [dst1q+mstrideq ]
+ movh m6, [dst8q+mstrideq ]
+ movh m4, [dst1q]
+ movh m7, [dst8q]
punpcklbw m0, m1 ; A/I
punpcklbw m2, m5 ; C/K
punpcklbw m3, m6 ; D/L
punpcklbw m4, m7 ; E/M
- add dst8_reg, stride_reg
- movh m1, [dst2_reg+mstride_reg*4]
- movh m6, [dst8_reg+mstride_reg*4]
- movh m5, [dst2_reg]
- movh m7, [dst8_reg]
+ add dst8q, strideq
+ movh m1, [dst2q+mstrideq*4]
+ movh m6, [dst8q+mstrideq*4]
+ movh m5, [dst2q]
+ movh m7, [dst8q]
punpcklbw m1, m6 ; B/J
punpcklbw m5, m7 ; F/N
- movh m6, [dst2_reg+ stride_reg]
- movh m7, [dst8_reg+ stride_reg]
+ movh m6, [dst2q+ strideq ]
+ movh m7, [dst8q+ strideq ]
punpcklbw m6, m7 ; G/O
; 8x16 transpose
@@ -1810,10 +1785,10 @@ cglobal vp8_%2_loop_filter16y_inner_%1, 5, %3, %5
%ifdef m8
SWAP 1, 8
%else
- mova q0backup, m1
+ mova m_q0backup, m1
%endif
- movh m7, [dst2_reg+ stride_reg*2]
- movh m1, [dst8_reg+ stride_reg*2]
+ movh m7, [dst2q+ strideq*2]
+ movh m1, [dst8q+ strideq*2]
punpcklbw m7, m1 ; H/P
TRANSPOSE4x4B 4, 5, 6, 7, 1
SBUTTERFLY dq, 0, 4, 1 ; p3/p2
@@ -1823,14 +1798,14 @@ cglobal vp8_%2_loop_filter16y_inner_%1, 5, %3, %5
SWAP 1, 8
SWAP 2, 8
%else
- mova m1, q0backup
- mova q0backup, m2 ; store q0
+ mova m1, m_q0backup
+ mova m_q0backup, m2 ; store q0
%endif
SBUTTERFLY dq, 1, 5, 2 ; p1/p0
%ifdef m12
SWAP 5, 12
%else
- mova p0backup, m5 ; store p0
+ mova m_p0backup, m5 ; store p0
%endif
SWAP 1, 4
SWAP 2, 4
@@ -1863,8 +1838,8 @@ cglobal vp8_%2_loop_filter16y_inner_%1, 5, %3, %5
psubusb m6, m5 ; q2-q1
por m6, m4 ; abs(q2-q1)
-%ifidn %1, mmx
- mova m4, flim_I
+%if notcpuflag(mmxext)
+ mova m4, m_flimI
pxor m3, m3
psubusb m0, m4
psubusb m1, m4
@@ -1885,15 +1860,15 @@ cglobal vp8_%2_loop_filter16y_inner_%1, 5, %3, %5
; normal_limit and high_edge_variance for p1-p0, q1-q0
SWAP 7, 3 ; now m7 is zero
-%ifidn %2, v
- movrow m3, [dst_reg +mstride_reg] ; p0
-%if mmsize == 16 && %4 == 8
- movhps m3, [dst8_reg+mstride_reg]
+%ifidn %1, v
+ movrow m3, [dst1q+mstrideq ] ; p0
+%if mmsize == 16 && %2 == 8
+ movhps m3, [dst8q+mstrideq ]
%endif
%elifdef m12
SWAP 3, 12
%else
- mova m3, p0backup
+ mova m3, m_p0backup
%endif
mova m1, m2
@@ -1903,29 +1878,29 @@ cglobal vp8_%2_loop_filter16y_inner_%1, 5, %3, %5
psubusb m1, m3 ; p1-p0
psubusb m6, m2 ; p0-p1
por m1, m6 ; abs(p1-p0)
-%ifidn %1, mmx
+%if notcpuflag(mmxext)
mova m6, m1
psubusb m1, m4
- psubusb m6, hev_thr
+ psubusb m6, m_hevthr
pcmpeqb m1, m7 ; abs(p1-p0) <= I
pcmpeqb m6, m7 ; abs(p1-p0) <= hev_thresh
pand m0, m1
- mova mask_res, m6
+ mova m_maskres, m6
%else ; mmxext/sse2
pmaxub m0, m1 ; max_I
SWAP 1, 4 ; max_hev_thresh
%endif
SWAP 6, 4 ; now m6 is I
-%ifidn %2, v
- movrow m4, [dst_reg] ; q0
-%if mmsize == 16 && %4 == 8
- movhps m4, [dst8_reg]
+%ifidn %1, v
+ movrow m4, [dst1q] ; q0
+%if mmsize == 16 && %2 == 8
+ movhps m4, [dst8q]
%endif
%elifdef m8
SWAP 4, 8
%else
- mova m4, q0backup
+ mova m4, m_q0backup
%endif
mova m1, m4
SWAP 1, 4
@@ -1934,29 +1909,29 @@ cglobal vp8_%2_loop_filter16y_inner_%1, 5, %3, %5
psubusb m1, m5 ; q0-q1
psubusb m7, m4 ; q1-q0
por m1, m7 ; abs(q1-q0)
-%ifidn %1, mmx
+%if notcpuflag(mmxext)
mova m7, m1
psubusb m1, m6
- psubusb m7, hev_thr
+ psubusb m7, m_hevthr
pxor m6, m6
pcmpeqb m1, m6 ; abs(q1-q0) <= I
pcmpeqb m7, m6 ; abs(q1-q0) <= hev_thresh
- mova m6, mask_res
+ mova m6, m_maskres
pand m0, m1 ; abs([pq][321]-[pq][210]) <= I
pand m6, m7
%else ; mmxext/sse2
pxor m7, m7
pmaxub m0, m1
pmaxub m6, m1
- psubusb m0, flim_I
- psubusb m6, hev_thr
+ psubusb m0, m_flimI
+ psubusb m6, m_hevthr
pcmpeqb m0, m7 ; max(abs(..)) <= I
pcmpeqb m6, m7 ; !(max(abs..) > thresh)
%endif
%ifdef m12
SWAP 6, 12
%else
- mova mask_res, m6 ; !(abs(p1-p0) > hev_t || abs(q1-q0) > hev_t)
+ mova m_maskres, m6 ; !(abs(p1-p0) > hev_t || abs(q1-q0) > hev_t)
%endif
; simple_limit
@@ -1980,28 +1955,28 @@ cglobal vp8_%2_loop_filter16y_inner_%1, 5, %3, %5
pand m7, [pb_FE]
psrlq m7, 1 ; abs(q1-p1)/2
paddusb m7, m1 ; abs(q0-p0)*2+abs(q1-p1)/2
- psubusb m7, flim_E
+ psubusb m7, m_flimE
pcmpeqb m7, m6 ; abs(q0-p0)*2+abs(q1-p1)/2 <= E
pand m0, m7 ; normal_limit result
; filter_common; at this point, m2-m5=p1-q1 and m0 is filter_mask
%ifdef m8 ; x86-64 && sse2
mova m8, [pb_80]
-%define pb_80_var m8
+%define m_pb_80 m8
%else ; x86-32 or mmx/mmxext
-%define pb_80_var [pb_80]
+%define m_pb_80 [pb_80]
%endif
mova m1, m4
mova m7, m3
- pxor m1, pb_80_var
- pxor m7, pb_80_var
+ pxor m1, m_pb_80
+ pxor m7, m_pb_80
psubsb m1, m7 ; (signed) q0-p0
mova m6, m2
mova m7, m5
- pxor m6, pb_80_var
- pxor m7, pb_80_var
+ pxor m6, m_pb_80
+ pxor m7, m_pb_80
psubsb m6, m7 ; (signed) p1-q1
- mova m7, mask_res
+ mova m7, m_maskres
pandn m7, m6
paddsb m7, m1
paddsb m7, m1
@@ -2040,16 +2015,16 @@ cglobal vp8_%2_loop_filter16y_inner_%1, 5, %3, %5
%ifdef m12
SWAP 6, 12
%else
- mova m6, mask_res
+ mova m6, m_maskres
%endif
-%ifidn %1, mmx
+%if notcpuflag(mmxext)
mova m7, [pb_1]
%else ; mmxext/sse2
pxor m7, m7
%endif
pand m0, m6
pand m1, m6
-%ifidn %1, mmx
+%if notcpuflag(mmxext)
paddusb m0, m7
pand m1, [pb_FE]
pandn m7, m0
@@ -2067,286 +2042,249 @@ cglobal vp8_%2_loop_filter16y_inner_%1, 5, %3, %5
paddusb m2, m0 ; p1+a
; store
-%ifidn %2, v
- movrow [dst_reg +mstride_reg*2], m2
- movrow [dst_reg +mstride_reg ], m3
- movrow [dst_reg], m4
- movrow [dst_reg + stride_reg ], m5
-%if mmsize == 16 && %4 == 8
- movhps [dst8_reg+mstride_reg*2], m2
- movhps [dst8_reg+mstride_reg ], m3
- movhps [dst8_reg], m4
- movhps [dst8_reg+ stride_reg ], m5
+%ifidn %1, v
+ movrow [dst1q+mstrideq*2], m2
+ movrow [dst1q+mstrideq ], m3
+ movrow [dst1q], m4
+ movrow [dst1q+ strideq ], m5
+%if mmsize == 16 && %2 == 8
+ movhps [dst8q+mstrideq*2], m2
+ movhps [dst8q+mstrideq ], m3
+ movhps [dst8q], m4
+ movhps [dst8q+ strideq ], m5
%endif
%else ; h
- add dst_reg, 2
- add dst2_reg, 2
+ add dst1q, 2
+ add dst2q, 2
; 4x8/16 transpose
TRANSPOSE4x4B 2, 3, 4, 5, 6
%if mmsize == 8 ; mmx/mmxext (h)
- WRITE_4x2D 2, 3, 4, 5, dst_reg, dst2_reg, mstride_reg, stride_reg
+ WRITE_4x2D 2, 3, 4, 5, dst1q, dst2q, mstrideq, strideq
%else ; sse2 (h)
- lea dst8_reg, [dst8_reg+mstride_reg+2]
- WRITE_4x4D 2, 3, 4, 5, dst_reg, dst2_reg, dst8_reg, mstride_reg, stride_reg, %4
+ lea dst8q, [dst8q+mstrideq +2]
+ WRITE_4x4D 2, 3, 4, 5, dst1q, dst2q, dst8q, mstrideq, strideq, %2
%endif
%endif
%if mmsize == 8
-%if %4 == 8 ; chroma
-%ifidn %2, h
- sub dst_reg, 2
+%if %2 == 8 ; chroma
+%ifidn %1, h
+ sub dst1q, 2
%endif
- cmp dst_reg, dst8_reg
- mov dst_reg, dst8_reg
+ cmp dst1q, dst8q
+ mov dst1q, dst8q
jnz .next8px
%else
-%ifidn %2, h
- lea dst_reg, [dst_reg + stride_reg*8-2]
+%ifidn %1, h
+ lea dst1q, [dst1q+ strideq*8-2]
%else ; v
- add dst_reg, 8
+ add dst1q, 8
%endif
- dec cnt_reg
+ dec cntrq
jg .next8px
%endif
-%endif
-
-%ifndef m8 ; sse2 on x86-32 or mmx/mmxext
- mov rsp, stack_reg ; restore stack pointer
-%endif
+ REP_RET
+%else ; mmsize == 16
RET
+%endif
%endmacro
-INIT_MMX
-%define SPLATB_REG SPLATB_REG_MMX
-INNER_LOOPFILTER mmx, v, 6, 16, 0
-INNER_LOOPFILTER mmx, h, 6, 16, 0
-INNER_LOOPFILTER mmx, v, 6, 8, 0
-INNER_LOOPFILTER mmx, h, 6, 8, 0
-
-%define SPLATB_REG SPLATB_REG_MMXEXT
-INNER_LOOPFILTER mmxext, v, 6, 16, 0
-INNER_LOOPFILTER mmxext, h, 6, 16, 0
-INNER_LOOPFILTER mmxext, v, 6, 8, 0
-INNER_LOOPFILTER mmxext, h, 6, 8, 0
-
-INIT_XMM
-%define SPLATB_REG SPLATB_REG_SSE2
-INNER_LOOPFILTER sse2, v, 5, 16, 13
-%ifdef m8
-INNER_LOOPFILTER sse2, h, 5, 16, 13
-%else
-INNER_LOOPFILTER sse2, h, 6, 16, 13
-%endif
-INNER_LOOPFILTER sse2, v, 6, 8, 13
-INNER_LOOPFILTER sse2, h, 6, 8, 13
+%if ARCH_X86_32
+INIT_MMX mmx
+INNER_LOOPFILTER v, 16
+INNER_LOOPFILTER h, 16
+INNER_LOOPFILTER v, 8
+INNER_LOOPFILTER h, 8
-%define SPLATB_REG SPLATB_REG_SSSE3
-INNER_LOOPFILTER ssse3, v, 5, 16, 13
-%ifdef m8
-INNER_LOOPFILTER ssse3, h, 5, 16, 13
-%else
-INNER_LOOPFILTER ssse3, h, 6, 16, 13
+INIT_MMX mmxext
+INNER_LOOPFILTER v, 16
+INNER_LOOPFILTER h, 16
+INNER_LOOPFILTER v, 8
+INNER_LOOPFILTER h, 8
%endif
-INNER_LOOPFILTER ssse3, v, 6, 8, 13
-INNER_LOOPFILTER ssse3, h, 6, 8, 13
+
+INIT_XMM sse2
+INNER_LOOPFILTER v, 16
+INNER_LOOPFILTER h, 16
+INNER_LOOPFILTER v, 8
+INNER_LOOPFILTER h, 8
+
+INIT_XMM ssse3
+INNER_LOOPFILTER v, 16
+INNER_LOOPFILTER h, 16
+INNER_LOOPFILTER v, 8
+INNER_LOOPFILTER h, 8
;-----------------------------------------------------------------------------
; void vp8_h/v_loop_filter<size>_mbedge_<opt>(uint8_t *dst, [uint8_t *v,] int stride,
; int flimE, int flimI, int hev_thr);
;-----------------------------------------------------------------------------
-%macro MBEDGE_LOOPFILTER 5
-%if %4 == 8 ; chroma
-cglobal vp8_%2_loop_filter8uv_mbedge_%1, 6, %3, %5
-%define dst8_reg r1
-%define mstride_reg r2
-%define E_reg r3
-%define I_reg r4
-%define hev_thr_reg r5
-%else ; luma
-cglobal vp8_%2_loop_filter16y_mbedge_%1, 5, %3, %5
-%define mstride_reg r1
-%define E_reg r2
-%define I_reg r3
-%define hev_thr_reg r4
-%ifdef m8 ; x86-64, sse2
-%define dst8_reg r4
-%elif mmsize == 16 ; x86-32, sse2
-%define dst8_reg r5
-%else ; x86-32, mmx/mmxext
-%define cnt_reg r5
-%endif
-%endif
-%define dst_reg r0
-%define stride_reg E_reg
-%define dst2_reg I_reg
-%ifndef m8
-%define stack_reg hev_thr_reg
+%macro MBEDGE_LOOPFILTER 2
+%define stack_size 0
+%ifndef m8 ; stack layout: [0]=E, [1]=I, [2]=hev_thr
+%if mmsize == 16 ; [3]=hev() result
+ ; [4]=filter tmp result
+ ; [5]/[6] = p2/q2 backup
+ ; [7]=lim_res sign result
+%define stack_size mmsize * -7
+%else ; 8 ; extra storage space for transposes
+%define stack_size mmsize * -8
%endif
-
-%define ssse3_or_higher 0
-%ifnidn %1, sse2
-%if mmsize == 16
-%define ssse3_or_higher 1
%endif
+
+%if %2 == 8 ; chroma
+cglobal vp8_%1_loop_filter8uv_mbedge, 6, 6, 15, stack_size, dst1, dst8, stride, flimE, flimI, hevthr
+%else ; luma
+cglobal vp8_%1_loop_filter16y_mbedge, 5, 5, 15, stack_size, dst1, stride, flimE, flimI, hevthr
%endif
-%if ssse3_or_higher
+%if cpuflag(ssse3)
pxor m7, m7
%endif
-%ifndef m8 ; mmx/mmxext or sse2 on x86-32
+%ifndef m8
; splat function arguments
- SPLATB_REG m0, E_reg, m7 ; E
- SPLATB_REG m1, I_reg, m7 ; I
- SPLATB_REG m2, hev_thr_reg, m7 ; hev_thresh
-
- ; align stack
- mov stack_reg, rsp ; backup stack pointer
- and rsp, ~(mmsize-1) ; align stack
-%if mmsize == 16
- sub rsp, mmsize * 7
-%else
- sub rsp, mmsize * 8 ; stack layout: [0]=E, [1]=I, [2]=hev_thr
- ; [3]=hev() result
- ; [4]=filter tmp result
- ; [5]/[6] = p2/q2 backup
- ; [7]=lim_res sign result
-%endif
-
-%define flim_E [rsp]
-%define flim_I [rsp+mmsize]
-%define hev_thr [rsp+mmsize*2]
-%define mask_res [rsp+mmsize*3]
-%define lim_res [rsp+mmsize*4]
-%define p0backup [rsp+mmsize*3]
-%define q0backup [rsp+mmsize*4]
-%define p2backup [rsp+mmsize*5]
-%define q2backup [rsp+mmsize*6]
+ SPLATB_REG m0, flimEq, m7 ; E
+ SPLATB_REG m1, flimIq, m7 ; I
+ SPLATB_REG m2, hevthrq, m7 ; hev_thresh
+
+%define m_flimE [rsp]
+%define m_flimI [rsp+mmsize]
+%define m_hevthr [rsp+mmsize*2]
+%define m_maskres [rsp+mmsize*3]
+%define m_limres [rsp+mmsize*4]
+%define m_p0backup [rsp+mmsize*3]
+%define m_q0backup [rsp+mmsize*4]
+%define m_p2backup [rsp+mmsize*5]
+%define m_q2backup [rsp+mmsize*6]
%if mmsize == 16
-%define lim_sign [rsp]
+%define m_limsign [rsp]
%else
-%define lim_sign [rsp+mmsize*7]
+%define m_limsign [rsp+mmsize*7]
%endif
- mova flim_E, m0
- mova flim_I, m1
- mova hev_thr, m2
-
+ mova m_flimE, m0
+ mova m_flimI, m1
+ mova m_hevthr, m2
%else ; sse2 on x86-64
-
-%define flim_E m9
-%define flim_I m10
-%define hev_thr m11
-%define mask_res m12
-%define lim_res m8
-%define p0backup m12
-%define q0backup m8
-%define p2backup m13
-%define q2backup m14
-%define lim_sign m9
+%define m_flimE m9
+%define m_flimI m10
+%define m_hevthr m11
+%define m_maskres m12
+%define m_limres m8
+%define m_p0backup m12
+%define m_q0backup m8
+%define m_p2backup m13
+%define m_q2backup m14
+%define m_limsign m9
; splat function arguments
- SPLATB_REG flim_E, E_reg, m7 ; E
- SPLATB_REG flim_I, I_reg, m7 ; I
- SPLATB_REG hev_thr, hev_thr_reg, m7 ; hev_thresh
+ SPLATB_REG m_flimE, flimEq, m7 ; E
+ SPLATB_REG m_flimI, flimIq, m7 ; I
+ SPLATB_REG m_hevthr, hevthrq, m7 ; hev_thresh
%endif
-%if mmsize == 8 && %4 == 16 ; mmx/mmxext
- mov cnt_reg, 2
+%if %2 == 8 ; chroma
+ DEFINE_ARGS dst1, dst8, mstride, stride, dst2
+%elif mmsize == 8
+ DEFINE_ARGS dst1, mstride, stride, dst2, cntr
+ mov cntrq, 2
+%else
+ DEFINE_ARGS dst1, mstride, stride, dst2, dst8
%endif
- mov stride_reg, mstride_reg
- neg mstride_reg
-%ifidn %2, h
- lea dst_reg, [dst_reg + stride_reg*4-4]
-%if %4 == 8
- lea dst8_reg, [dst8_reg+ stride_reg*4-4]
+ mov strideq, mstrideq
+ neg mstrideq
+%ifidn %1, h
+ lea dst1q, [dst1q+strideq*4-4]
+%if %2 == 8 ; chroma
+ lea dst8q, [dst8q+strideq*4-4]
%endif
%endif
%if mmsize == 8
-.next8px
+.next8px:
%endif
; read
- lea dst2_reg, [dst_reg + stride_reg]
-%ifidn %2, v
-%if %4 == 8 && mmsize == 16
+ lea dst2q, [dst1q+ strideq ]
+%ifidn %1, v
+%if %2 == 8 && mmsize == 16
%define movrow movh
%else
%define movrow mova
%endif
- movrow m0, [dst_reg +mstride_reg*4] ; p3
- movrow m1, [dst2_reg+mstride_reg*4] ; p2
- movrow m2, [dst_reg +mstride_reg*2] ; p1
- movrow m5, [dst2_reg] ; q1
- movrow m6, [dst2_reg+ stride_reg] ; q2
- movrow m7, [dst2_reg+ stride_reg*2] ; q3
-%if mmsize == 16 && %4 == 8
- movhps m0, [dst8_reg+mstride_reg*4]
- movhps m2, [dst8_reg+mstride_reg*2]
- add dst8_reg, stride_reg
- movhps m1, [dst8_reg+mstride_reg*4]
- movhps m5, [dst8_reg]
- movhps m6, [dst8_reg+ stride_reg]
- movhps m7, [dst8_reg+ stride_reg*2]
- add dst8_reg, mstride_reg
+ movrow m0, [dst1q+mstrideq*4] ; p3
+ movrow m1, [dst2q+mstrideq*4] ; p2
+ movrow m2, [dst1q+mstrideq*2] ; p1
+ movrow m5, [dst2q] ; q1
+ movrow m6, [dst2q+ strideq ] ; q2
+ movrow m7, [dst2q+ strideq*2] ; q3
+%if mmsize == 16 && %2 == 8
+ movhps m0, [dst8q+mstrideq*4]
+ movhps m2, [dst8q+mstrideq*2]
+ add dst8q, strideq
+ movhps m1, [dst8q+mstrideq*4]
+ movhps m5, [dst8q]
+ movhps m6, [dst8q+ strideq ]
+ movhps m7, [dst8q+ strideq*2]
+ add dst8q, mstrideq
%endif
%elif mmsize == 8 ; mmx/mmxext (h)
; read 8 rows of 8px each
- movu m0, [dst_reg +mstride_reg*4]
- movu m1, [dst2_reg+mstride_reg*4]
- movu m2, [dst_reg +mstride_reg*2]
- movu m3, [dst_reg +mstride_reg]
- movu m4, [dst_reg]
- movu m5, [dst2_reg]
- movu m6, [dst2_reg+ stride_reg]
+ movu m0, [dst1q+mstrideq*4]
+ movu m1, [dst2q+mstrideq*4]
+ movu m2, [dst1q+mstrideq*2]
+ movu m3, [dst1q+mstrideq ]
+ movu m4, [dst1q]
+ movu m5, [dst2q]
+ movu m6, [dst2q+ strideq ]
; 8x8 transpose
TRANSPOSE4x4B 0, 1, 2, 3, 7
- mova q0backup, m1
- movu m7, [dst2_reg+ stride_reg*2]
+ mova m_q0backup, m1
+ movu m7, [dst2q+ strideq*2]
TRANSPOSE4x4B 4, 5, 6, 7, 1
SBUTTERFLY dq, 0, 4, 1 ; p3/p2
SBUTTERFLY dq, 2, 6, 1 ; q0/q1
SBUTTERFLY dq, 3, 7, 1 ; q2/q3
- mova m1, q0backup
- mova q0backup, m2 ; store q0
+ mova m1, m_q0backup
+ mova m_q0backup, m2 ; store q0
SBUTTERFLY dq, 1, 5, 2 ; p1/p0
- mova p0backup, m5 ; store p0
+ mova m_p0backup, m5 ; store p0
SWAP 1, 4
SWAP 2, 4
SWAP 6, 3
SWAP 5, 3
%else ; sse2 (h)
-%if %4 == 16
- lea dst8_reg, [dst_reg + stride_reg*8]
+%if %2 == 16
+ lea dst8q, [dst1q+ strideq*8 ]
%endif
; read 16 rows of 8px each, interleave
- movh m0, [dst_reg +mstride_reg*4]
- movh m1, [dst8_reg+mstride_reg*4]
- movh m2, [dst_reg +mstride_reg*2]
- movh m5, [dst8_reg+mstride_reg*2]
- movh m3, [dst_reg +mstride_reg]
- movh m6, [dst8_reg+mstride_reg]
- movh m4, [dst_reg]
- movh m7, [dst8_reg]
+ movh m0, [dst1q+mstrideq*4]
+ movh m1, [dst8q+mstrideq*4]
+ movh m2, [dst1q+mstrideq*2]
+ movh m5, [dst8q+mstrideq*2]
+ movh m3, [dst1q+mstrideq ]
+ movh m6, [dst8q+mstrideq ]
+ movh m4, [dst1q]
+ movh m7, [dst8q]
punpcklbw m0, m1 ; A/I
punpcklbw m2, m5 ; C/K
punpcklbw m3, m6 ; D/L
punpcklbw m4, m7 ; E/M
- add dst8_reg, stride_reg
- movh m1, [dst2_reg+mstride_reg*4]
- movh m6, [dst8_reg+mstride_reg*4]
- movh m5, [dst2_reg]
- movh m7, [dst8_reg]
+ add dst8q, strideq
+ movh m1, [dst2q+mstrideq*4]
+ movh m6, [dst8q+mstrideq*4]
+ movh m5, [dst2q]
+ movh m7, [dst8q]
punpcklbw m1, m6 ; B/J
punpcklbw m5, m7 ; F/N
- movh m6, [dst2_reg+ stride_reg]
- movh m7, [dst8_reg+ stride_reg]
+ movh m6, [dst2q+ strideq ]
+ movh m7, [dst8q+ strideq ]
punpcklbw m6, m7 ; G/O
; 8x16 transpose
@@ -2354,10 +2292,10 @@ cglobal vp8_%2_loop_filter16y_mbedge_%1, 5, %3, %5
%ifdef m8
SWAP 1, 8
%else
- mova q0backup, m1
+ mova m_q0backup, m1
%endif
- movh m7, [dst2_reg+ stride_reg*2]
- movh m1, [dst8_reg+ stride_reg*2]
+ movh m7, [dst2q+ strideq*2]
+ movh m1, [dst8q+ strideq*2]
punpcklbw m7, m1 ; H/P
TRANSPOSE4x4B 4, 5, 6, 7, 1
SBUTTERFLY dq, 0, 4, 1 ; p3/p2
@@ -2367,14 +2305,14 @@ cglobal vp8_%2_loop_filter16y_mbedge_%1, 5, %3, %5
SWAP 1, 8
SWAP 2, 8
%else
- mova m1, q0backup
- mova q0backup, m2 ; store q0
+ mova m1, m_q0backup
+ mova m_q0backup, m2 ; store q0
%endif
SBUTTERFLY dq, 1, 5, 2 ; p1/p0
%ifdef m12
SWAP 5, 12
%else
- mova p0backup, m5 ; store p0
+ mova m_p0backup, m5 ; store p0
%endif
SWAP 1, 4
SWAP 2, 4
@@ -2392,7 +2330,7 @@ cglobal vp8_%2_loop_filter16y_mbedge_%1, 5, %3, %5
mova m4, m2
SWAP 4, 2
psubusb m4, m1 ; p1-p2
- mova p2backup, m1
+ mova m_p2backup, m1
psubusb m1, m2 ; p2-p1
por m1, m4 ; abs(p2-p1)
@@ -2405,12 +2343,12 @@ cglobal vp8_%2_loop_filter16y_mbedge_%1, 5, %3, %5
mova m4, m5
SWAP 4, 5
psubusb m4, m6 ; q1-q2
- mova q2backup, m6
+ mova m_q2backup, m6
psubusb m6, m5 ; q2-q1
por m6, m4 ; abs(q2-q1)
-%ifidn %1, mmx
- mova m4, flim_I
+%if notcpuflag(mmxext)
+ mova m4, m_flimI
pxor m3, m3
psubusb m0, m4
psubusb m1, m4
@@ -2431,15 +2369,15 @@ cglobal vp8_%2_loop_filter16y_mbedge_%1, 5, %3, %5
; normal_limit and high_edge_variance for p1-p0, q1-q0
SWAP 7, 3 ; now m7 is zero
-%ifidn %2, v
- movrow m3, [dst_reg +mstride_reg] ; p0
-%if mmsize == 16 && %4 == 8
- movhps m3, [dst8_reg+mstride_reg]
+%ifidn %1, v
+ movrow m3, [dst1q+mstrideq ] ; p0
+%if mmsize == 16 && %2 == 8
+ movhps m3, [dst8q+mstrideq ]
%endif
%elifdef m12
SWAP 3, 12
%else
- mova m3, p0backup
+ mova m3, m_p0backup
%endif
mova m1, m2
@@ -2449,29 +2387,29 @@ cglobal vp8_%2_loop_filter16y_mbedge_%1, 5, %3, %5
psubusb m1, m3 ; p1-p0
psubusb m6, m2 ; p0-p1
por m1, m6 ; abs(p1-p0)
-%ifidn %1, mmx
+%if notcpuflag(mmxext)
mova m6, m1
psubusb m1, m4
- psubusb m6, hev_thr
+ psubusb m6, m_hevthr
pcmpeqb m1, m7 ; abs(p1-p0) <= I
pcmpeqb m6, m7 ; abs(p1-p0) <= hev_thresh
pand m0, m1
- mova mask_res, m6
+ mova m_maskres, m6
%else ; mmxext/sse2
pmaxub m0, m1 ; max_I
SWAP 1, 4 ; max_hev_thresh
%endif
SWAP 6, 4 ; now m6 is I
-%ifidn %2, v
- movrow m4, [dst_reg] ; q0
-%if mmsize == 16 && %4 == 8
- movhps m4, [dst8_reg]
+%ifidn %1, v
+ movrow m4, [dst1q] ; q0
+%if mmsize == 16 && %2 == 8
+ movhps m4, [dst8q]
%endif
%elifdef m8
SWAP 4, 8
%else
- mova m4, q0backup
+ mova m4, m_q0backup
%endif
mova m1, m4
SWAP 1, 4
@@ -2480,29 +2418,29 @@ cglobal vp8_%2_loop_filter16y_mbedge_%1, 5, %3, %5
psubusb m1, m5 ; q0-q1
psubusb m7, m4 ; q1-q0
por m1, m7 ; abs(q1-q0)
-%ifidn %1, mmx
+%if notcpuflag(mmxext)
mova m7, m1
psubusb m1, m6
- psubusb m7, hev_thr
+ psubusb m7, m_hevthr
pxor m6, m6
pcmpeqb m1, m6 ; abs(q1-q0) <= I
pcmpeqb m7, m6 ; abs(q1-q0) <= hev_thresh
- mova m6, mask_res
+ mova m6, m_maskres
pand m0, m1 ; abs([pq][321]-[pq][210]) <= I
pand m6, m7
%else ; mmxext/sse2
pxor m7, m7
pmaxub m0, m1
pmaxub m6, m1
- psubusb m0, flim_I
- psubusb m6, hev_thr
+ psubusb m0, m_flimI
+ psubusb m6, m_hevthr
pcmpeqb m0, m7 ; max(abs(..)) <= I
pcmpeqb m6, m7 ; !(max(abs..) > thresh)
%endif
%ifdef m12
SWAP 6, 12
%else
- mova mask_res, m6 ; !(abs(p1-p0) > hev_t || abs(q1-q0) > hev_t)
+ mova m_maskres, m6 ; !(abs(p1-p0) > hev_t || abs(q1-q0) > hev_t)
%endif
; simple_limit
@@ -2526,39 +2464,39 @@ cglobal vp8_%2_loop_filter16y_mbedge_%1, 5, %3, %5
pand m7, [pb_FE]
psrlq m7, 1 ; abs(q1-p1)/2
paddusb m7, m1 ; abs(q0-p0)*2+abs(q1-p1)/2
- psubusb m7, flim_E
+ psubusb m7, m_flimE
pcmpeqb m7, m6 ; abs(q0-p0)*2+abs(q1-p1)/2 <= E
pand m0, m7 ; normal_limit result
; filter_common; at this point, m2-m5=p1-q1 and m0 is filter_mask
%ifdef m8 ; x86-64 && sse2
mova m8, [pb_80]
-%define pb_80_var m8
+%define m_pb_80 m8
%else ; x86-32 or mmx/mmxext
-%define pb_80_var [pb_80]
+%define m_pb_80 [pb_80]
%endif
mova m1, m4
mova m7, m3
- pxor m1, pb_80_var
- pxor m7, pb_80_var
+ pxor m1, m_pb_80
+ pxor m7, m_pb_80
psubsb m1, m7 ; (signed) q0-p0
mova m6, m2
mova m7, m5
- pxor m6, pb_80_var
- pxor m7, pb_80_var
+ pxor m6, m_pb_80
+ pxor m7, m_pb_80
psubsb m6, m7 ; (signed) p1-q1
- mova m7, mask_res
+ mova m7, m_maskres
paddsb m6, m1
paddsb m6, m1
paddsb m6, m1
pand m6, m0
%ifdef m8
- mova lim_res, m6 ; 3*(qp-p0)+(p1-q1) masked for filter_mbedge
- pand lim_res, m7
+ mova m_limres, m6 ; 3*(qp-p0)+(p1-q1) masked for filter_mbedge
+ pand m_limres, m7
%else
mova m0, m6
pand m0, m7
- mova lim_res, m0
+ mova m_limres, m0
%endif
pandn m7, m6 ; 3*(q0-p0)+(p1-q1) masked for filter_common
@@ -2592,7 +2530,7 @@ cglobal vp8_%2_loop_filter16y_mbedge_%1, 5, %3, %5
paddusb m4, m1 ; q0-f1
; filter_mbedge (m2-m5 = p1-q1; lim_res carries w)
-%if ssse3_or_higher
+%if cpuflag(ssse3)
mova m7, [pb_1]
%else
mova m7, [pw_63]
@@ -2600,23 +2538,23 @@ cglobal vp8_%2_loop_filter16y_mbedge_%1, 5, %3, %5
%ifdef m8
SWAP 1, 8
%else
- mova m1, lim_res
+ mova m1, m_limres
%endif
pxor m0, m0
mova m6, m1
pcmpgtb m0, m1 ; which are negative
-%if ssse3_or_higher
+%if cpuflag(ssse3)
punpcklbw m6, m7 ; interleave with "1" for rounding
punpckhbw m1, m7
%else
punpcklbw m6, m0 ; signed byte->word
punpckhbw m1, m0
%endif
- mova lim_sign, m0
-%if ssse3_or_higher
+ mova m_limsign, m0
+%if cpuflag(ssse3)
mova m7, [pb_27_63]
%ifndef m8
- mova lim_res, m1
+ mova m_limres, m1
%endif
%ifdef m10
SWAP 0, 10 ; don't lose lim_sign copy
@@ -2629,11 +2567,11 @@ cglobal vp8_%2_loop_filter16y_mbedge_%1, 5, %3, %5
%ifdef m10
SWAP 0, 10
%else
- mova m0, lim_sign
+ mova m0, m_limsign
%endif
%else
- mova mask_res, m6 ; backup for later in filter
- mova lim_res, m1
+ mova m_maskres, m6 ; backup for later in filter
+ mova m_limres, m1
pmullw m6, [pw_27]
pmullw m1, [pw_27]
paddw m6, m7
@@ -2646,7 +2584,7 @@ cglobal vp8_%2_loop_filter16y_mbedge_%1, 5, %3, %5
psubb m1, m6
pand m1, m0 ; -a0
pandn m0, m6 ; +a0
-%if ssse3_or_higher
+%if cpuflag(ssse3)
mova m6, [pb_18_63] ; pipelining
%endif
psubusb m3, m1
@@ -2654,12 +2592,12 @@ cglobal vp8_%2_loop_filter16y_mbedge_%1, 5, %3, %5
paddusb m3, m0 ; p0+a0
psubusb m4, m0 ; q0-a0
-%if ssse3_or_higher
+%if cpuflag(ssse3)
SWAP 6, 7
%ifdef m10
SWAP 1, 10
%else
- mova m1, lim_res
+ mova m1, m_limres
%endif
mova m0, m7
pmaddubsw m7, m6
@@ -2669,16 +2607,16 @@ cglobal vp8_%2_loop_filter16y_mbedge_%1, 5, %3, %5
%ifdef m10
SWAP 0, 10
%endif
- mova m0, lim_sign
+ mova m0, m_limsign
%else
- mova m6, mask_res
- mova m1, lim_res
+ mova m6, m_maskres
+ mova m1, m_limres
pmullw m6, [pw_18]
pmullw m1, [pw_18]
paddw m6, m7
paddw m1, m7
%endif
- mova m0, lim_sign
+ mova m0, m_limsign
psraw m6, 7
psraw m1, 7
packsswb m6, m1 ; a1
@@ -2686,7 +2624,7 @@ cglobal vp8_%2_loop_filter16y_mbedge_%1, 5, %3, %5
psubb m1, m6
pand m1, m0 ; -a1
pandn m0, m6 ; +a1
-%if ssse3_or_higher
+%if cpuflag(ssse3)
mova m6, [pb_9_63]
%endif
psubusb m2, m1
@@ -2694,12 +2632,12 @@ cglobal vp8_%2_loop_filter16y_mbedge_%1, 5, %3, %5
paddusb m2, m0 ; p1+a1
psubusb m5, m0 ; q1-a1
-%if ssse3_or_higher
+%if cpuflag(ssse3)
SWAP 6, 7
%ifdef m10
SWAP 1, 10
%else
- mova m1, lim_res
+ mova m1, m_limres
%endif
mova m0, m7
pmaddubsw m7, m6
@@ -2711,8 +2649,8 @@ cglobal vp8_%2_loop_filter16y_mbedge_%1, 5, %3, %5
SWAP 6, 12
SWAP 1, 8
%else
- mova m6, mask_res
- mova m1, lim_res
+ mova m6, m_maskres
+ mova m1, m_limres
%endif
pmullw m6, [pw_9]
pmullw m1, [pw_9]
@@ -2722,7 +2660,7 @@ cglobal vp8_%2_loop_filter16y_mbedge_%1, 5, %3, %5
%ifdef m9
SWAP 7, 9
%else
- mova m7, lim_sign
+ mova m7, m_limsign
%endif
psraw m6, 7
psraw m1, 7
@@ -2735,8 +2673,8 @@ cglobal vp8_%2_loop_filter16y_mbedge_%1, 5, %3, %5
SWAP 1, 13
SWAP 6, 14
%else
- mova m1, p2backup
- mova m6, q2backup
+ mova m1, m_p2backup
+ mova m6, m_q2backup
%endif
psubusb m1, m0
paddusb m6, m0
@@ -2744,115 +2682,100 @@ cglobal vp8_%2_loop_filter16y_mbedge_%1, 5, %3, %5
psubusb m6, m7 ; q1-a1
; store
-%ifidn %2, v
- movrow [dst2_reg+mstride_reg*4], m1
- movrow [dst_reg +mstride_reg*2], m2
- movrow [dst_reg +mstride_reg ], m3
- movrow [dst_reg], m4
- movrow [dst2_reg], m5
- movrow [dst2_reg+ stride_reg ], m6
-%if mmsize == 16 && %4 == 8
- add dst8_reg, mstride_reg
- movhps [dst8_reg+mstride_reg*2], m1
- movhps [dst8_reg+mstride_reg ], m2
- movhps [dst8_reg], m3
- add dst8_reg, stride_reg
- movhps [dst8_reg], m4
- movhps [dst8_reg+ stride_reg ], m5
- movhps [dst8_reg+ stride_reg*2], m6
+%ifidn %1, v
+ movrow [dst2q+mstrideq*4], m1
+ movrow [dst1q+mstrideq*2], m2
+ movrow [dst1q+mstrideq ], m3
+ movrow [dst1q], m4
+ movrow [dst2q], m5
+ movrow [dst2q+ strideq ], m6
+%if mmsize == 16 && %2 == 8
+ add dst8q, mstrideq
+ movhps [dst8q+mstrideq*2], m1
+ movhps [dst8q+mstrideq ], m2
+ movhps [dst8q], m3
+ add dst8q, strideq
+ movhps [dst8q], m4
+ movhps [dst8q+ strideq ], m5
+ movhps [dst8q+ strideq*2], m6
%endif
%else ; h
- inc dst_reg
- inc dst2_reg
+ inc dst1q
+ inc dst2q
; 4x8/16 transpose
- TRANSPOSE4x4B 1, 2, 3, 4, 0
- SBUTTERFLY bw, 5, 6, 0
+ TRANSPOSE4x4B 1, 2, 3, 4, 0
+ SBUTTERFLY bw, 5, 6, 0
%if mmsize == 8 ; mmx/mmxext (h)
- WRITE_4x2D 1, 2, 3, 4, dst_reg, dst2_reg, mstride_reg, stride_reg
- add dst_reg, 4
- WRITE_2x4W m5, m6, dst2_reg, dst_reg, mstride_reg, stride_reg
+ WRITE_4x2D 1, 2, 3, 4, dst1q, dst2q, mstrideq, strideq
+ add dst1q, 4
+ WRITE_2x4W m5, m6, dst2q, dst1q, mstrideq, strideq
%else ; sse2 (h)
- lea dst8_reg, [dst8_reg+mstride_reg+1]
- WRITE_4x4D 1, 2, 3, 4, dst_reg, dst2_reg, dst8_reg, mstride_reg, stride_reg, %4
- lea dst_reg, [dst2_reg+mstride_reg+4]
- lea dst8_reg, [dst8_reg+mstride_reg+4]
-%ifidn %1, sse4
- add dst2_reg, 4
+ lea dst8q, [dst8q+mstrideq+1]
+ WRITE_4x4D 1, 2, 3, 4, dst1q, dst2q, dst8q, mstrideq, strideq, %2
+ lea dst1q, [dst2q+mstrideq+4]
+ lea dst8q, [dst8q+mstrideq+4]
+%if cpuflag(sse4)
+ add dst2q, 4
%endif
- WRITE_8W m5, dst2_reg, dst_reg, mstride_reg, stride_reg
-%ifidn %1, sse4
- lea dst2_reg, [dst8_reg+ stride_reg]
+ WRITE_8W m5, dst2q, dst1q, mstrideq, strideq
+%if cpuflag(sse4)
+ lea dst2q, [dst8q+ strideq ]
%endif
- WRITE_8W m6, dst2_reg, dst8_reg, mstride_reg, stride_reg
+ WRITE_8W m6, dst2q, dst8q, mstrideq, strideq
%endif
%endif
%if mmsize == 8
-%if %4 == 8 ; chroma
-%ifidn %2, h
- sub dst_reg, 5
+%if %2 == 8 ; chroma
+%ifidn %1, h
+ sub dst1q, 5
%endif
- cmp dst_reg, dst8_reg
- mov dst_reg, dst8_reg
+ cmp dst1q, dst8q
+ mov dst1q, dst8q
jnz .next8px
%else
-%ifidn %2, h
- lea dst_reg, [dst_reg + stride_reg*8-5]
+%ifidn %1, h
+ lea dst1q, [dst1q+ strideq*8-5]
%else ; v
- add dst_reg, 8
+ add dst1q, 8
%endif
- dec cnt_reg
+ dec cntrq
jg .next8px
%endif
-%endif
-
-%ifndef m8 ; sse2 on x86-32 or mmx/mmxext
- mov rsp, stack_reg ; restore stack pointer
-%endif
+ REP_RET
+%else ; mmsize == 16
RET
-%endmacro
-
-INIT_MMX
-%define SPLATB_REG SPLATB_REG_MMX
-MBEDGE_LOOPFILTER mmx, v, 6, 16, 0
-MBEDGE_LOOPFILTER mmx, h, 6, 16, 0
-MBEDGE_LOOPFILTER mmx, v, 6, 8, 0
-MBEDGE_LOOPFILTER mmx, h, 6, 8, 0
-
-%define SPLATB_REG SPLATB_REG_MMXEXT
-MBEDGE_LOOPFILTER mmxext, v, 6, 16, 0
-MBEDGE_LOOPFILTER mmxext, h, 6, 16, 0
-MBEDGE_LOOPFILTER mmxext, v, 6, 8, 0
-MBEDGE_LOOPFILTER mmxext, h, 6, 8, 0
-
-INIT_XMM
-%define SPLATB_REG SPLATB_REG_SSE2
-%define WRITE_8W WRITE_8W_SSE2
-MBEDGE_LOOPFILTER sse2, v, 5, 16, 15
-%ifdef m8
-MBEDGE_LOOPFILTER sse2, h, 5, 16, 15
-%else
-MBEDGE_LOOPFILTER sse2, h, 6, 16, 15
%endif
-MBEDGE_LOOPFILTER sse2, v, 6, 8, 15
-MBEDGE_LOOPFILTER sse2, h, 6, 8, 15
-
-%define SPLATB_REG SPLATB_REG_SSSE3
-MBEDGE_LOOPFILTER ssse3, v, 5, 16, 15
-%ifdef m8
-MBEDGE_LOOPFILTER ssse3, h, 5, 16, 15
-%else
-MBEDGE_LOOPFILTER ssse3, h, 6, 16, 15
-%endif
-MBEDGE_LOOPFILTER ssse3, v, 6, 8, 15
-MBEDGE_LOOPFILTER ssse3, h, 6, 8, 15
+%endmacro
-%define WRITE_8W WRITE_8W_SSE4
-%ifdef m8
-MBEDGE_LOOPFILTER sse4, h, 5, 16, 15
-%else
-MBEDGE_LOOPFILTER sse4, h, 6, 16, 15
-%endif
-MBEDGE_LOOPFILTER sse4, h, 6, 8, 15
+%if ARCH_X86_32
+INIT_MMX mmx
+MBEDGE_LOOPFILTER v, 16
+MBEDGE_LOOPFILTER h, 16
+MBEDGE_LOOPFILTER v, 8
+MBEDGE_LOOPFILTER h, 8
+
+INIT_MMX mmxext
+MBEDGE_LOOPFILTER v, 16
+MBEDGE_LOOPFILTER h, 16
+MBEDGE_LOOPFILTER v, 8
+MBEDGE_LOOPFILTER h, 8
+%endif
+
+INIT_XMM sse2
+MBEDGE_LOOPFILTER v, 16
+MBEDGE_LOOPFILTER h, 16
+MBEDGE_LOOPFILTER v, 8
+MBEDGE_LOOPFILTER h, 8
+
+INIT_XMM ssse3
+MBEDGE_LOOPFILTER v, 16
+MBEDGE_LOOPFILTER h, 16
+MBEDGE_LOOPFILTER v, 8
+MBEDGE_LOOPFILTER h, 8
+
+INIT_XMM sse4
+MBEDGE_LOOPFILTER h, 16
+MBEDGE_LOOPFILTER h, 8
diff --git a/gst-libs/ext/libav/libavcodec/x86/vp8dsp_init.c b/gst-libs/ext/libav/libavcodec/x86/vp8dsp_init.c
new file mode 100644
index 0000000..a9d3541
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/x86/vp8dsp_init.c
@@ -0,0 +1,442 @@
+/*
+ * VP8 DSP functions x86-optimized
+ * Copyright (c) 2010 Ronald S. Bultje <rsbultje@gmail.com>
+ * Copyright (c) 2010 Jason Garrett-Glaser <darkshikari@gmail.com>
+ *
+ * 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
+ */
+
+#include "libavutil/cpu.h"
+#include "libavutil/mem.h"
+#include "libavutil/x86/asm.h"
+#include "libavcodec/vp8dsp.h"
+
+#if HAVE_YASM
+
+/*
+ * MC functions
+ */
+extern void ff_put_vp8_epel4_h4_mmxext(uint8_t *dst, ptrdiff_t dststride,
+ uint8_t *src, ptrdiff_t srcstride,
+ int height, int mx, int my);
+extern void ff_put_vp8_epel4_h6_mmxext(uint8_t *dst, ptrdiff_t dststride,
+ uint8_t *src, ptrdiff_t srcstride,
+ int height, int mx, int my);
+extern void ff_put_vp8_epel4_v4_mmxext(uint8_t *dst, ptrdiff_t dststride,
+ uint8_t *src, ptrdiff_t srcstride,
+ int height, int mx, int my);
+extern void ff_put_vp8_epel4_v6_mmxext(uint8_t *dst, ptrdiff_t dststride,
+ uint8_t *src, ptrdiff_t srcstride,
+ int height, int mx, int my);
+
+extern void ff_put_vp8_epel8_h4_sse2 (uint8_t *dst, ptrdiff_t dststride,
+ uint8_t *src, ptrdiff_t srcstride,
+ int height, int mx, int my);
+extern void ff_put_vp8_epel8_h6_sse2 (uint8_t *dst, ptrdiff_t dststride,
+ uint8_t *src, ptrdiff_t srcstride,
+ int height, int mx, int my);
+extern void ff_put_vp8_epel8_v4_sse2 (uint8_t *dst, ptrdiff_t dststride,
+ uint8_t *src, ptrdiff_t srcstride,
+ int height, int mx, int my);
+extern void ff_put_vp8_epel8_v6_sse2 (uint8_t *dst, ptrdiff_t dststride,
+ uint8_t *src, ptrdiff_t srcstride,
+ int height, int mx, int my);
+
+extern void ff_put_vp8_epel4_h4_ssse3 (uint8_t *dst, ptrdiff_t dststride,
+ uint8_t *src, ptrdiff_t srcstride,
+ int height, int mx, int my);
+extern void ff_put_vp8_epel4_h6_ssse3 (uint8_t *dst, ptrdiff_t dststride,
+ uint8_t *src, ptrdiff_t srcstride,
+ int height, int mx, int my);
+extern void ff_put_vp8_epel4_v4_ssse3 (uint8_t *dst, ptrdiff_t dststride,
+ uint8_t *src, ptrdiff_t srcstride,
+ int height, int mx, int my);
+extern void ff_put_vp8_epel4_v6_ssse3 (uint8_t *dst, ptrdiff_t dststride,
+ uint8_t *src, ptrdiff_t srcstride,
+ int height, int mx, int my);
+extern void ff_put_vp8_epel8_h4_ssse3 (uint8_t *dst, ptrdiff_t dststride,
+ uint8_t *src, ptrdiff_t srcstride,
+ int height, int mx, int my);
+extern void ff_put_vp8_epel8_h6_ssse3 (uint8_t *dst, ptrdiff_t dststride,
+ uint8_t *src, ptrdiff_t srcstride,
+ int height, int mx, int my);
+extern void ff_put_vp8_epel8_v4_ssse3 (uint8_t *dst, ptrdiff_t dststride,
+ uint8_t *src, ptrdiff_t srcstride,
+ int height, int mx, int my);
+extern void ff_put_vp8_epel8_v6_ssse3 (uint8_t *dst, ptrdiff_t dststride,
+ uint8_t *src, ptrdiff_t srcstride,
+ int height, int mx, int my);
+
+extern void ff_put_vp8_bilinear4_h_mmxext(uint8_t *dst, ptrdiff_t dststride,
+ uint8_t *src, ptrdiff_t srcstride,
+ int height, int mx, int my);
+extern void ff_put_vp8_bilinear8_h_sse2 (uint8_t *dst, ptrdiff_t dststride,
+ uint8_t *src, ptrdiff_t srcstride,
+ int height, int mx, int my);
+extern void ff_put_vp8_bilinear4_h_ssse3 (uint8_t *dst, ptrdiff_t dststride,
+ uint8_t *src, ptrdiff_t srcstride,
+ int height, int mx, int my);
+extern void ff_put_vp8_bilinear8_h_ssse3 (uint8_t *dst, ptrdiff_t dststride,
+ uint8_t *src, ptrdiff_t srcstride,
+ int height, int mx, int my);
+
+extern void ff_put_vp8_bilinear4_v_mmxext(uint8_t *dst, ptrdiff_t dststride,
+ uint8_t *src, ptrdiff_t srcstride,
+ int height, int mx, int my);
+extern void ff_put_vp8_bilinear8_v_sse2 (uint8_t *dst, ptrdiff_t dststride,
+ uint8_t *src, ptrdiff_t srcstride,
+ int height, int mx, int my);
+extern void ff_put_vp8_bilinear4_v_ssse3 (uint8_t *dst, ptrdiff_t dststride,
+ uint8_t *src, ptrdiff_t srcstride,
+ int height, int mx, int my);
+extern void ff_put_vp8_bilinear8_v_ssse3 (uint8_t *dst, ptrdiff_t dststride,
+ uint8_t *src, ptrdiff_t srcstride,
+ int height, int mx, int my);
+
+
+extern void ff_put_vp8_pixels8_mmx (uint8_t *dst, ptrdiff_t dststride,
+ uint8_t *src, ptrdiff_t srcstride,
+ int height, int mx, int my);
+extern void ff_put_vp8_pixels16_mmx(uint8_t *dst, ptrdiff_t dststride,
+ uint8_t *src, ptrdiff_t srcstride,
+ int height, int mx, int my);
+extern void ff_put_vp8_pixels16_sse(uint8_t *dst, ptrdiff_t dststride,
+ uint8_t *src, ptrdiff_t srcstride,
+ int height, int mx, int my);
+
+#define TAP_W16(OPT, FILTERTYPE, TAPTYPE) \
+static void ff_put_vp8_ ## FILTERTYPE ## 16_ ## TAPTYPE ## _ ## OPT( \
+ uint8_t *dst, ptrdiff_t dststride, uint8_t *src, \
+ ptrdiff_t srcstride, int height, int mx, int my) \
+{ \
+ ff_put_vp8_ ## FILTERTYPE ## 8_ ## TAPTYPE ## _ ## OPT( \
+ dst, dststride, src, srcstride, height, mx, my); \
+ ff_put_vp8_ ## FILTERTYPE ## 8_ ## TAPTYPE ## _ ## OPT( \
+ dst + 8, dststride, src + 8, srcstride, height, mx, my); \
+}
+#define TAP_W8(OPT, FILTERTYPE, TAPTYPE) \
+static void ff_put_vp8_ ## FILTERTYPE ## 8_ ## TAPTYPE ## _ ## OPT( \
+ uint8_t *dst, ptrdiff_t dststride, uint8_t *src, \
+ ptrdiff_t srcstride, int height, int mx, int my) \
+{ \
+ ff_put_vp8_ ## FILTERTYPE ## 4_ ## TAPTYPE ## _ ## OPT( \
+ dst, dststride, src, srcstride, height, mx, my); \
+ ff_put_vp8_ ## FILTERTYPE ## 4_ ## TAPTYPE ## _ ## OPT( \
+ dst + 4, dststride, src + 4, srcstride, height, mx, my); \
+}
+
+#if ARCH_X86_32
+TAP_W8 (mmxext, epel, h4)
+TAP_W8 (mmxext, epel, h6)
+TAP_W16(mmxext, epel, h6)
+TAP_W8 (mmxext, epel, v4)
+TAP_W8 (mmxext, epel, v6)
+TAP_W16(mmxext, epel, v6)
+TAP_W8 (mmxext, bilinear, h)
+TAP_W16(mmxext, bilinear, h)
+TAP_W8 (mmxext, bilinear, v)
+TAP_W16(mmxext, bilinear, v)
+#endif
+
+TAP_W16(sse2, epel, h6)
+TAP_W16(sse2, epel, v6)
+TAP_W16(sse2, bilinear, h)
+TAP_W16(sse2, bilinear, v)
+
+TAP_W16(ssse3, epel, h6)
+TAP_W16(ssse3, epel, v6)
+TAP_W16(ssse3, bilinear, h)
+TAP_W16(ssse3, bilinear, v)
+
+#define HVTAP(OPT, ALIGN, TAPNUMX, TAPNUMY, SIZE, MAXHEIGHT) \
+static void ff_put_vp8_epel ## SIZE ## _h ## TAPNUMX ## v ## TAPNUMY ## _ ## OPT( \
+ uint8_t *dst, ptrdiff_t dststride, uint8_t *src, \
+ ptrdiff_t srcstride, int height, int mx, int my) \
+{ \
+ DECLARE_ALIGNED(ALIGN, uint8_t, tmp)[SIZE * (MAXHEIGHT + TAPNUMY - 1)]; \
+ uint8_t *tmpptr = tmp + SIZE * (TAPNUMY / 2 - 1); \
+ src -= srcstride * (TAPNUMY / 2 - 1); \
+ ff_put_vp8_epel ## SIZE ## _h ## TAPNUMX ## _ ## OPT( \
+ tmp, SIZE, src, srcstride, height + TAPNUMY - 1, mx, my); \
+ ff_put_vp8_epel ## SIZE ## _v ## TAPNUMY ## _ ## OPT( \
+ dst, dststride, tmpptr, SIZE, height, mx, my); \
+}
+
+#if ARCH_X86_32
+#define HVTAPMMX(x, y) \
+HVTAP(mmxext, 8, x, y, 4, 8) \
+HVTAP(mmxext, 8, x, y, 8, 16)
+
+HVTAP(mmxext, 8, 6, 6, 16, 16)
+#else
+#define HVTAPMMX(x, y) \
+HVTAP(mmxext, 8, x, y, 4, 8)
+#endif
+
+HVTAPMMX(4, 4)
+HVTAPMMX(4, 6)
+HVTAPMMX(6, 4)
+HVTAPMMX(6, 6)
+
+#define HVTAPSSE2(x, y, w) \
+HVTAP(sse2, 16, x, y, w, 16) \
+HVTAP(ssse3, 16, x, y, w, 16)
+
+HVTAPSSE2(4, 4, 8)
+HVTAPSSE2(4, 6, 8)
+HVTAPSSE2(6, 4, 8)
+HVTAPSSE2(6, 6, 8)
+HVTAPSSE2(6, 6, 16)
+
+HVTAP(ssse3, 16, 4, 4, 4, 8)
+HVTAP(ssse3, 16, 4, 6, 4, 8)
+HVTAP(ssse3, 16, 6, 4, 4, 8)
+HVTAP(ssse3, 16, 6, 6, 4, 8)
+
+#define HVBILIN(OPT, ALIGN, SIZE, MAXHEIGHT) \
+static void ff_put_vp8_bilinear ## SIZE ## _hv_ ## OPT( \
+ uint8_t *dst, ptrdiff_t dststride, uint8_t *src, \
+ ptrdiff_t srcstride, int height, int mx, int my) \
+{ \
+ DECLARE_ALIGNED(ALIGN, uint8_t, tmp)[SIZE * (MAXHEIGHT + 2)]; \
+ ff_put_vp8_bilinear ## SIZE ## _h_ ## OPT( \
+ tmp, SIZE, src, srcstride, height + 1, mx, my); \
+ ff_put_vp8_bilinear ## SIZE ## _v_ ## OPT( \
+ dst, dststride, tmp, SIZE, height, mx, my); \
+}
+
+HVBILIN(mmxext, 8, 4, 8)
+#if ARCH_X86_32
+HVBILIN(mmxext, 8, 8, 16)
+HVBILIN(mmxext, 8, 16, 16)
+#endif
+HVBILIN(sse2, 8, 8, 16)
+HVBILIN(sse2, 8, 16, 16)
+HVBILIN(ssse3, 8, 4, 8)
+HVBILIN(ssse3, 8, 8, 16)
+HVBILIN(ssse3, 8, 16, 16)
+
+extern void ff_vp8_idct_dc_add_mmx(uint8_t *dst, DCTELEM block[16],
+ ptrdiff_t stride);
+extern void ff_vp8_idct_dc_add_sse4(uint8_t *dst, DCTELEM block[16],
+ ptrdiff_t stride);
+extern void ff_vp8_idct_dc_add4y_mmx(uint8_t *dst, DCTELEM block[4][16],
+ ptrdiff_t stride);
+extern void ff_vp8_idct_dc_add4y_sse2(uint8_t *dst, DCTELEM block[4][16],
+ ptrdiff_t stride);
+extern void ff_vp8_idct_dc_add4uv_mmx(uint8_t *dst, DCTELEM block[2][16],
+ ptrdiff_t stride);
+extern void ff_vp8_luma_dc_wht_mmx(DCTELEM block[4][4][16], DCTELEM dc[16]);
+extern void ff_vp8_luma_dc_wht_sse(DCTELEM block[4][4][16], DCTELEM dc[16]);
+extern void ff_vp8_idct_add_mmx(uint8_t *dst, DCTELEM block[16],
+ ptrdiff_t stride);
+extern void ff_vp8_idct_add_sse(uint8_t *dst, DCTELEM block[16],
+ ptrdiff_t stride);
+
+#define DECLARE_LOOP_FILTER(NAME)\
+extern void ff_vp8_v_loop_filter_simple_ ## NAME(uint8_t *dst, \
+ ptrdiff_t stride, \
+ int flim);\
+extern void ff_vp8_h_loop_filter_simple_ ## NAME(uint8_t *dst, \
+ ptrdiff_t stride, \
+ int flim);\
+extern void ff_vp8_v_loop_filter16y_inner_ ## NAME (uint8_t *dst, \
+ ptrdiff_t stride,\
+ int e, int i, int hvt);\
+extern void ff_vp8_h_loop_filter16y_inner_ ## NAME (uint8_t *dst, \
+ ptrdiff_t stride,\
+ int e, int i, int hvt);\
+extern void ff_vp8_v_loop_filter8uv_inner_ ## NAME (uint8_t *dstU, \
+ uint8_t *dstV,\
+ ptrdiff_t s, \
+ int e, int i, int hvt);\
+extern void ff_vp8_h_loop_filter8uv_inner_ ## NAME (uint8_t *dstU, \
+ uint8_t *dstV,\
+ ptrdiff_t s, \
+ int e, int i, int hvt);\
+extern void ff_vp8_v_loop_filter16y_mbedge_ ## NAME(uint8_t *dst, \
+ ptrdiff_t stride,\
+ int e, int i, int hvt);\
+extern void ff_vp8_h_loop_filter16y_mbedge_ ## NAME(uint8_t *dst, \
+ ptrdiff_t stride,\
+ int e, int i, int hvt);\
+extern void ff_vp8_v_loop_filter8uv_mbedge_ ## NAME(uint8_t *dstU, \
+ uint8_t *dstV,\
+ ptrdiff_t s, \
+ int e, int i, int hvt);\
+extern void ff_vp8_h_loop_filter8uv_mbedge_ ## NAME(uint8_t *dstU, \
+ uint8_t *dstV,\
+ ptrdiff_t s, \
+ int e, int i, int hvt);
+
+DECLARE_LOOP_FILTER(mmx)
+DECLARE_LOOP_FILTER(mmxext)
+DECLARE_LOOP_FILTER(sse2)
+DECLARE_LOOP_FILTER(ssse3)
+DECLARE_LOOP_FILTER(sse4)
+
+#endif /* HAVE_YASM */
+
+#define VP8_LUMA_MC_FUNC(IDX, SIZE, OPT) \
+ c->put_vp8_epel_pixels_tab[IDX][0][2] = ff_put_vp8_epel ## SIZE ## _h6_ ## OPT; \
+ c->put_vp8_epel_pixels_tab[IDX][2][0] = ff_put_vp8_epel ## SIZE ## _v6_ ## OPT; \
+ c->put_vp8_epel_pixels_tab[IDX][2][2] = ff_put_vp8_epel ## SIZE ## _h6v6_ ## OPT
+
+#define VP8_MC_FUNC(IDX, SIZE, OPT) \
+ c->put_vp8_epel_pixels_tab[IDX][0][1] = ff_put_vp8_epel ## SIZE ## _h4_ ## OPT; \
+ c->put_vp8_epel_pixels_tab[IDX][1][0] = ff_put_vp8_epel ## SIZE ## _v4_ ## OPT; \
+ c->put_vp8_epel_pixels_tab[IDX][1][1] = ff_put_vp8_epel ## SIZE ## _h4v4_ ## OPT; \
+ c->put_vp8_epel_pixels_tab[IDX][1][2] = ff_put_vp8_epel ## SIZE ## _h6v4_ ## OPT; \
+ c->put_vp8_epel_pixels_tab[IDX][2][1] = ff_put_vp8_epel ## SIZE ## _h4v6_ ## OPT; \
+ VP8_LUMA_MC_FUNC(IDX, SIZE, OPT)
+
+#define VP8_BILINEAR_MC_FUNC(IDX, SIZE, OPT) \
+ c->put_vp8_bilinear_pixels_tab[IDX][0][1] = ff_put_vp8_bilinear ## SIZE ## _h_ ## OPT; \
+ c->put_vp8_bilinear_pixels_tab[IDX][0][2] = ff_put_vp8_bilinear ## SIZE ## _h_ ## OPT; \
+ c->put_vp8_bilinear_pixels_tab[IDX][1][0] = ff_put_vp8_bilinear ## SIZE ## _v_ ## OPT; \
+ c->put_vp8_bilinear_pixels_tab[IDX][1][1] = ff_put_vp8_bilinear ## SIZE ## _hv_ ## OPT; \
+ c->put_vp8_bilinear_pixels_tab[IDX][1][2] = ff_put_vp8_bilinear ## SIZE ## _hv_ ## OPT; \
+ c->put_vp8_bilinear_pixels_tab[IDX][2][0] = ff_put_vp8_bilinear ## SIZE ## _v_ ## OPT; \
+ c->put_vp8_bilinear_pixels_tab[IDX][2][1] = ff_put_vp8_bilinear ## SIZE ## _hv_ ## OPT; \
+ c->put_vp8_bilinear_pixels_tab[IDX][2][2] = ff_put_vp8_bilinear ## SIZE ## _hv_ ## OPT
+
+
+av_cold void ff_vp8dsp_init_x86(VP8DSPContext* c)
+{
+#if HAVE_YASM
+ int mm_flags = av_get_cpu_flags();
+
+ if (mm_flags & AV_CPU_FLAG_MMX) {
+ c->vp8_idct_dc_add = ff_vp8_idct_dc_add_mmx;
+ c->vp8_idct_dc_add4uv = ff_vp8_idct_dc_add4uv_mmx;
+#if ARCH_X86_32
+ c->vp8_idct_dc_add4y = ff_vp8_idct_dc_add4y_mmx;
+ c->vp8_idct_add = ff_vp8_idct_add_mmx;
+ c->vp8_luma_dc_wht = ff_vp8_luma_dc_wht_mmx;
+ c->put_vp8_epel_pixels_tab[0][0][0] =
+ c->put_vp8_bilinear_pixels_tab[0][0][0] = ff_put_vp8_pixels16_mmx;
+#endif
+ c->put_vp8_epel_pixels_tab[1][0][0] =
+ c->put_vp8_bilinear_pixels_tab[1][0][0] = ff_put_vp8_pixels8_mmx;
+
+#if ARCH_X86_32
+ c->vp8_v_loop_filter_simple = ff_vp8_v_loop_filter_simple_mmx;
+ c->vp8_h_loop_filter_simple = ff_vp8_h_loop_filter_simple_mmx;
+
+ c->vp8_v_loop_filter16y_inner = ff_vp8_v_loop_filter16y_inner_mmx;
+ c->vp8_h_loop_filter16y_inner = ff_vp8_h_loop_filter16y_inner_mmx;
+ c->vp8_v_loop_filter8uv_inner = ff_vp8_v_loop_filter8uv_inner_mmx;
+ c->vp8_h_loop_filter8uv_inner = ff_vp8_h_loop_filter8uv_inner_mmx;
+
+ c->vp8_v_loop_filter16y = ff_vp8_v_loop_filter16y_mbedge_mmx;
+ c->vp8_h_loop_filter16y = ff_vp8_h_loop_filter16y_mbedge_mmx;
+ c->vp8_v_loop_filter8uv = ff_vp8_v_loop_filter8uv_mbedge_mmx;
+ c->vp8_h_loop_filter8uv = ff_vp8_h_loop_filter8uv_mbedge_mmx;
+#endif
+ }
+
+ /* note that 4-tap width=16 functions are missing because w=16
+ * is only used for luma, and luma is always a copy or sixtap. */
+ if (mm_flags & AV_CPU_FLAG_MMXEXT) {
+ VP8_MC_FUNC(2, 4, mmxext);
+ VP8_BILINEAR_MC_FUNC(2, 4, mmxext);
+#if ARCH_X86_32
+ VP8_LUMA_MC_FUNC(0, 16, mmxext);
+ VP8_MC_FUNC(1, 8, mmxext);
+ VP8_BILINEAR_MC_FUNC(0, 16, mmxext);
+ VP8_BILINEAR_MC_FUNC(1, 8, mmxext);
+
+ c->vp8_v_loop_filter_simple = ff_vp8_v_loop_filter_simple_mmxext;
+ c->vp8_h_loop_filter_simple = ff_vp8_h_loop_filter_simple_mmxext;
+
+ c->vp8_v_loop_filter16y_inner = ff_vp8_v_loop_filter16y_inner_mmxext;
+ c->vp8_h_loop_filter16y_inner = ff_vp8_h_loop_filter16y_inner_mmxext;
+ c->vp8_v_loop_filter8uv_inner = ff_vp8_v_loop_filter8uv_inner_mmxext;
+ c->vp8_h_loop_filter8uv_inner = ff_vp8_h_loop_filter8uv_inner_mmxext;
+
+ c->vp8_v_loop_filter16y = ff_vp8_v_loop_filter16y_mbedge_mmxext;
+ c->vp8_h_loop_filter16y = ff_vp8_h_loop_filter16y_mbedge_mmxext;
+ c->vp8_v_loop_filter8uv = ff_vp8_v_loop_filter8uv_mbedge_mmxext;
+ c->vp8_h_loop_filter8uv = ff_vp8_h_loop_filter8uv_mbedge_mmxext;
+#endif
+ }
+
+ if (mm_flags & AV_CPU_FLAG_SSE) {
+ c->vp8_idct_add = ff_vp8_idct_add_sse;
+ c->vp8_luma_dc_wht = ff_vp8_luma_dc_wht_sse;
+ c->put_vp8_epel_pixels_tab[0][0][0] =
+ c->put_vp8_bilinear_pixels_tab[0][0][0] = ff_put_vp8_pixels16_sse;
+ }
+
+ if (mm_flags & (AV_CPU_FLAG_SSE2|AV_CPU_FLAG_SSE2SLOW)) {
+ VP8_LUMA_MC_FUNC(0, 16, sse2);
+ VP8_MC_FUNC(1, 8, sse2);
+ VP8_BILINEAR_MC_FUNC(0, 16, sse2);
+ VP8_BILINEAR_MC_FUNC(1, 8, sse2);
+
+ c->vp8_v_loop_filter_simple = ff_vp8_v_loop_filter_simple_sse2;
+
+ c->vp8_v_loop_filter16y_inner = ff_vp8_v_loop_filter16y_inner_sse2;
+ c->vp8_v_loop_filter8uv_inner = ff_vp8_v_loop_filter8uv_inner_sse2;
+
+ c->vp8_v_loop_filter16y = ff_vp8_v_loop_filter16y_mbedge_sse2;
+ c->vp8_v_loop_filter8uv = ff_vp8_v_loop_filter8uv_mbedge_sse2;
+ }
+
+ if (mm_flags & AV_CPU_FLAG_SSE2) {
+ c->vp8_idct_dc_add4y = ff_vp8_idct_dc_add4y_sse2;
+
+ c->vp8_h_loop_filter_simple = ff_vp8_h_loop_filter_simple_sse2;
+
+ c->vp8_h_loop_filter16y_inner = ff_vp8_h_loop_filter16y_inner_sse2;
+ c->vp8_h_loop_filter8uv_inner = ff_vp8_h_loop_filter8uv_inner_sse2;
+
+ c->vp8_h_loop_filter16y = ff_vp8_h_loop_filter16y_mbedge_sse2;
+ c->vp8_h_loop_filter8uv = ff_vp8_h_loop_filter8uv_mbedge_sse2;
+ }
+
+ if (mm_flags & AV_CPU_FLAG_SSSE3) {
+ VP8_LUMA_MC_FUNC(0, 16, ssse3);
+ VP8_MC_FUNC(1, 8, ssse3);
+ VP8_MC_FUNC(2, 4, ssse3);
+ VP8_BILINEAR_MC_FUNC(0, 16, ssse3);
+ VP8_BILINEAR_MC_FUNC(1, 8, ssse3);
+ VP8_BILINEAR_MC_FUNC(2, 4, ssse3);
+
+ c->vp8_v_loop_filter_simple = ff_vp8_v_loop_filter_simple_ssse3;
+ c->vp8_h_loop_filter_simple = ff_vp8_h_loop_filter_simple_ssse3;
+
+ c->vp8_v_loop_filter16y_inner = ff_vp8_v_loop_filter16y_inner_ssse3;
+ c->vp8_h_loop_filter16y_inner = ff_vp8_h_loop_filter16y_inner_ssse3;
+ c->vp8_v_loop_filter8uv_inner = ff_vp8_v_loop_filter8uv_inner_ssse3;
+ c->vp8_h_loop_filter8uv_inner = ff_vp8_h_loop_filter8uv_inner_ssse3;
+
+ c->vp8_v_loop_filter16y = ff_vp8_v_loop_filter16y_mbedge_ssse3;
+ c->vp8_h_loop_filter16y = ff_vp8_h_loop_filter16y_mbedge_ssse3;
+ c->vp8_v_loop_filter8uv = ff_vp8_v_loop_filter8uv_mbedge_ssse3;
+ c->vp8_h_loop_filter8uv = ff_vp8_h_loop_filter8uv_mbedge_ssse3;
+ }
+
+ if (mm_flags & AV_CPU_FLAG_SSE4) {
+ c->vp8_idct_dc_add = ff_vp8_idct_dc_add_sse4;
+
+ c->vp8_h_loop_filter_simple = ff_vp8_h_loop_filter_simple_sse4;
+ c->vp8_h_loop_filter16y = ff_vp8_h_loop_filter16y_mbedge_sse4;
+ c->vp8_h_loop_filter8uv = ff_vp8_h_loop_filter8uv_mbedge_sse4;
+ }
+#endif /* HAVE_YASM */
+}
diff --git a/gst-libs/ext/libav/libavcodec/x86/w64xmmtest.c b/gst-libs/ext/libav/libavcodec/x86/w64xmmtest.c
new file mode 100644
index 0000000..f6e3de9
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/x86/w64xmmtest.c
@@ -0,0 +1,80 @@
+/*
+ * check XMM registers for clobbers on Win64
+ * Copyright (c) 2012 Ronald S. Bultje <rsbultje@gmail.com>
+ *
+ * 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
+ */
+
+#include "libavcodec/avcodec.h"
+#include "libavutil/x86/w64xmmtest.h"
+
+wrap(avcodec_open2(AVCodecContext *avctx,
+ AVCodec *codec,
+ AVDictionary **options))
+{
+ testxmmclobbers(avcodec_open2, avctx, codec, options);
+}
+
+wrap(avcodec_decode_audio4(AVCodecContext *avctx,
+ AVFrame *frame,
+ int *got_frame_ptr,
+ AVPacket *avpkt))
+{
+ testxmmclobbers(avcodec_decode_audio4, avctx, frame,
+ got_frame_ptr, avpkt);
+}
+
+wrap(avcodec_decode_video2(AVCodecContext *avctx,
+ AVFrame *picture,
+ int *got_picture_ptr,
+ AVPacket *avpkt))
+{
+ testxmmclobbers(avcodec_decode_video2, avctx, picture,
+ got_picture_ptr, avpkt);
+}
+
+wrap(avcodec_decode_subtitle2(AVCodecContext *avctx,
+ AVSubtitle *sub,
+ int *got_sub_ptr,
+ AVPacket *avpkt))
+{
+ testxmmclobbers(avcodec_decode_subtitle2, avctx, sub,
+ got_sub_ptr, avpkt);
+}
+
+wrap(avcodec_encode_audio2(AVCodecContext *avctx,
+ AVPacket *avpkt,
+ const AVFrame *frame,
+ int *got_packet_ptr))
+{
+ testxmmclobbers(avcodec_encode_audio2, avctx, avpkt, frame,
+ got_packet_ptr);
+}
+
+wrap(avcodec_encode_video(AVCodecContext *avctx,
+ uint8_t *buf, int buf_size,
+ const AVFrame *pict))
+{
+ testxmmclobbers(avcodec_encode_video, avctx, buf, buf_size, pict);
+}
+
+wrap(avcodec_encode_subtitle(AVCodecContext *avctx,
+ uint8_t *buf, int buf_size,
+ const AVSubtitle *sub))
+{
+ testxmmclobbers(avcodec_encode_subtitle, avctx, buf, buf_size, sub);
+}
diff --git a/gst-libs/ext/libav/libavcodec/xan.c b/gst-libs/ext/libav/libavcodec/xan.c
index 4c4721a..8c90bb6 100644
--- a/gst-libs/ext/libav/libavcodec/xan.c
+++ b/gst-libs/ext/libav/libavcodec/xan.c
@@ -33,12 +33,12 @@
#include <string.h>
#include "libavutil/intreadwrite.h"
+#include "libavutil/mem.h"
#include "avcodec.h"
#include "bytestream.h"
#define BITSTREAM_READER_LE
#include "get_bits.h"
-// for av_memcpy_backptr
-#include "libavutil/lzo.h"
+#include "internal.h"
#define RUNTIME_GAMMA 0
@@ -79,7 +79,7 @@ static av_cold int xan_decode_init(AVCodecContext *avctx)
s->avctx = avctx;
s->frame_size = 0;
- avctx->pix_fmt = PIX_FMT_PAL8;
+ avctx->pix_fmt = AV_PIX_FMT_PAL8;
s->buffer1_size = avctx->width * avctx->height;
s->buffer1 = av_malloc(s->buffer1_size);
@@ -493,74 +493,73 @@ static const uint8_t gamma_lookup[256] = {
#endif
static int xan_decode_frame(AVCodecContext *avctx,
- void *data, int *data_size,
+ void *data, int *got_frame,
AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
int ret, buf_size = avpkt->size;
XanContext *s = avctx->priv_data;
-
- if (avctx->codec->id == CODEC_ID_XAN_WC3) {
- const uint8_t *buf_end = buf + buf_size;
- int tag = 0;
- while (buf_end - buf > 8 && tag != VGA__TAG) {
- unsigned *tmpptr;
- uint32_t new_pal;
- int size;
- int i;
- tag = bytestream_get_le32(&buf);
- size = bytestream_get_be32(&buf);
- size = FFMIN(size, buf_end - buf);
- switch (tag) {
- case PALT_TAG:
- if (size < PALETTE_SIZE)
- return AVERROR_INVALIDDATA;
- if (s->palettes_count >= PALETTES_MAX)
- return AVERROR_INVALIDDATA;
- tmpptr = av_realloc(s->palettes,
- (s->palettes_count + 1) * AVPALETTE_SIZE);
- if (!tmpptr)
- return AVERROR(ENOMEM);
- s->palettes = tmpptr;
- tmpptr += s->palettes_count * AVPALETTE_COUNT;
- for (i = 0; i < PALETTE_COUNT; i++) {
+ const uint8_t *buf_end = buf + buf_size;
+ int tag = 0;
+
+ while (buf_end - buf > 8 && tag != VGA__TAG) {
+ unsigned *tmpptr;
+ uint32_t new_pal;
+ int size;
+ int i;
+ tag = bytestream_get_le32(&buf);
+ size = bytestream_get_be32(&buf);
+ size = FFMIN(size, buf_end - buf);
+ switch (tag) {
+ case PALT_TAG:
+ if (size < PALETTE_SIZE)
+ return AVERROR_INVALIDDATA;
+ if (s->palettes_count >= PALETTES_MAX)
+ return AVERROR_INVALIDDATA;
+ tmpptr = av_realloc(s->palettes,
+ (s->palettes_count + 1) * AVPALETTE_SIZE);
+ if (!tmpptr)
+ return AVERROR(ENOMEM);
+ s->palettes = tmpptr;
+ tmpptr += s->palettes_count * AVPALETTE_COUNT;
+ for (i = 0; i < PALETTE_COUNT; i++) {
#if RUNTIME_GAMMA
- int r = gamma_corr(*buf++);
- int g = gamma_corr(*buf++);
- int b = gamma_corr(*buf++);
+ int r = gamma_corr(*buf++);
+ int g = gamma_corr(*buf++);
+ int b = gamma_corr(*buf++);
#else
- int r = gamma_lookup[*buf++];
- int g = gamma_lookup[*buf++];
- int b = gamma_lookup[*buf++];
+ int r = gamma_lookup[*buf++];
+ int g = gamma_lookup[*buf++];
+ int b = gamma_lookup[*buf++];
#endif
- *tmpptr++ = (r << 16) | (g << 8) | b;
- }
- s->palettes_count++;
- break;
- case SHOT_TAG:
- if (size < 4)
- return AVERROR_INVALIDDATA;
- new_pal = bytestream_get_le32(&buf);
- if (new_pal < s->palettes_count) {
- s->cur_palette = new_pal;
- } else
- av_log(avctx, AV_LOG_ERROR, "Invalid palette selected\n");
- break;
- case VGA__TAG:
- break;
- default:
- buf += size;
- break;
+ *tmpptr++ = (r << 16) | (g << 8) | b;
}
+ s->palettes_count++;
+ break;
+ case SHOT_TAG:
+ if (size < 4)
+ return AVERROR_INVALIDDATA;
+ new_pal = bytestream_get_le32(&buf);
+ if (new_pal < s->palettes_count) {
+ s->cur_palette = new_pal;
+ } else
+ av_log(avctx, AV_LOG_ERROR, "Invalid palette selected\n");
+ break;
+ case VGA__TAG:
+ break;
+ default:
+ buf += size;
+ break;
}
- buf_size = buf_end - buf;
}
+ buf_size = buf_end - buf;
+
if (s->palettes_count <= 0) {
av_log(s->avctx, AV_LOG_ERROR, "No palette found\n");
return AVERROR_INVALIDDATA;
}
- if ((ret = avctx->get_buffer(avctx, &s->current_frame))) {
+ if ((ret = ff_get_buffer(avctx, &s->current_frame))) {
av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return ret;
}
@@ -582,7 +581,7 @@ static int xan_decode_frame(AVCodecContext *avctx,
if (s->last_frame.data[0])
avctx->release_buffer(avctx, &s->last_frame);
- *data_size = sizeof(AVFrame);
+ *got_frame = 1;
*(AVFrame*)data = s->current_frame;
/* shuffle frames */
@@ -612,7 +611,7 @@ static av_cold int xan_decode_end(AVCodecContext *avctx)
AVCodec ff_xan_wc3_decoder = {
.name = "xan_wc3",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_XAN_WC3,
+ .id = AV_CODEC_ID_XAN_WC3,
.priv_data_size = sizeof(XanContext),
.init = xan_decode_init,
.close = xan_decode_end,
diff --git a/gst-libs/ext/libav/libavcodec/xbmenc.c b/gst-libs/ext/libav/libavcodec/xbmenc.c
new file mode 100644
index 0000000..e12debe
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/xbmenc.c
@@ -0,0 +1,87 @@
+/*
+ * XBM image format
+ *
+ * Copyright (c) 2012 Paul B Mahol
+ *
+ * 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
+ */
+
+#include "avcodec.h"
+#include "internal.h"
+#include "mathops.h"
+
+static av_cold int xbm_encode_init(AVCodecContext *avctx)
+{
+ avctx->coded_frame = avcodec_alloc_frame();
+ if (!avctx->coded_frame)
+ return AVERROR(ENOMEM);
+ avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I;
+
+ return 0;
+}
+
+static int xbm_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
+ const AVFrame *p, int *got_packet)
+{
+ int i, j, ret, size, linesize;
+ uint8_t *ptr, *buf;
+
+ linesize = (avctx->width + 7) / 8;
+ size = avctx->height * (linesize * 7 + 2) + 110;
+ if ((ret = ff_alloc_packet(pkt, size)) < 0) {
+ av_log(avctx, AV_LOG_ERROR, "Error getting output packet.\n");
+ return ret;
+ }
+
+ buf = pkt->data;
+ ptr = p->data[0];
+
+ buf += snprintf(buf, 32, "#define image_width %u\n", avctx->width);
+ buf += snprintf(buf, 33, "#define image_height %u\n", avctx->height);
+ buf += snprintf(buf, 40, "static unsigned char image_bits[] = {\n");
+ for (i = 0; i < avctx->height; i++) {
+ for (j = 0; j < linesize; j++)
+ buf += snprintf(buf, 7, " 0x%02X,", ff_reverse[*ptr++]);
+ ptr += p->linesize[0] - linesize;
+ buf += snprintf(buf, 2, "\n");
+ }
+ buf += snprintf(buf, 5, " };\n");
+
+ pkt->size = buf - pkt->data;
+ pkt->flags |= AV_PKT_FLAG_KEY;
+ *got_packet = 1;
+ return 0;
+}
+
+static av_cold int xbm_encode_close(AVCodecContext *avctx)
+{
+ av_freep(&avctx->coded_frame);
+
+ return 0;
+}
+
+AVCodec ff_xbm_encoder = {
+ .name = "xbm",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .id = AV_CODEC_ID_XBM,
+ .init = xbm_encode_init,
+ .encode2 = xbm_encode_frame,
+ .close = xbm_encode_close,
+ .pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_MONOWHITE,
+ AV_PIX_FMT_NONE },
+ .long_name = NULL_IF_CONFIG_SMALL("XBM (X BitMap) image"),
+};
diff --git a/gst-libs/ext/libav/libavcodec/xl.c b/gst-libs/ext/libav/libavcodec/xl.c
index 0ebc946..1cadeab 100644
--- a/gst-libs/ext/libav/libavcodec/xl.c
+++ b/gst-libs/ext/libav/libavcodec/xl.c
@@ -24,8 +24,10 @@
* Miro VideoXL codec.
*/
+#include "libavutil/common.h"
#include "libavutil/intreadwrite.h"
#include "avcodec.h"
+#include "internal.h"
typedef struct VideoXLContext{
AVCodecContext *avctx;
@@ -39,13 +41,13 @@ static const int xl_table[32] = {
120, 121, 122, 123, 124, 125, 126, 127};
static int decode_frame(AVCodecContext *avctx,
- void *data, int *data_size,
+ void *data, int *got_frame,
AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
VideoXLContext * const a = avctx->priv_data;
- AVFrame * const p= (AVFrame*)&a->pic;
+ AVFrame * const p = &a->pic;
uint8_t *Y, *U, *V;
int i, j;
int stride;
@@ -56,7 +58,7 @@ static int decode_frame(AVCodecContext *avctx,
avctx->release_buffer(avctx, p);
p->reference = 0;
- if(avctx->get_buffer(avctx, p) < 0){
+ if(ff_get_buffer(avctx, p) < 0){
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return -1;
}
@@ -120,7 +122,7 @@ static int decode_frame(AVCodecContext *avctx,
V += a->pic.linesize[2];
}
- *data_size = sizeof(AVFrame);
+ *got_frame = 1;
*(AVFrame*)data = a->pic;
return buf_size;
@@ -129,7 +131,7 @@ static int decode_frame(AVCodecContext *avctx,
static av_cold int decode_init(AVCodecContext *avctx){
// VideoXLContext * const a = avctx->priv_data;
- avctx->pix_fmt= PIX_FMT_YUV411P;
+ avctx->pix_fmt= AV_PIX_FMT_YUV411P;
return 0;
}
@@ -147,11 +149,11 @@ static av_cold int decode_end(AVCodecContext *avctx){
AVCodec ff_xl_decoder = {
.name = "xl",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_VIXL,
+ .id = AV_CODEC_ID_VIXL,
.priv_data_size = sizeof(VideoXLContext),
.init = decode_init,
.close = decode_end,
.decode = decode_frame,
.capabilities = CODEC_CAP_DR1,
- .long_name = NULL_IF_CONFIG_SMALL("Miro VideoXL"),
+ .long_name = NULL_IF_CONFIG_SMALL("Miro VideoXL"),
};
diff --git a/gst-libs/ext/libav/libavcodec/xsubdec.c b/gst-libs/ext/libav/libavcodec/xsubdec.c
index af87388..11e1d57 100644
--- a/gst-libs/ext/libav/libavcodec/xsubdec.c
+++ b/gst-libs/ext/libav/libavcodec/xsubdec.c
@@ -26,7 +26,7 @@
#include "bytestream.h"
static av_cold int decode_init(AVCodecContext *avctx) {
- avctx->pix_fmt = PIX_FMT_PAL8;
+ avctx->pix_fmt = AV_PIX_FMT_PAL8;
return 0;
}
@@ -53,7 +53,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
AVSubtitle *sub = data;
const uint8_t *buf_end = buf + buf_size;
uint8_t *bitmap;
- int w, h, x, y, rlelen, i;
+ int w, h, x, y, i;
int64_t packet_time = 0;
GetBitContext gb;
@@ -86,7 +86,11 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
// skip bottom right position, it gives no new information
bytestream_get_le16(&buf);
bytestream_get_le16(&buf);
- rlelen = bytestream_get_le16(&buf);
+ // The following value is supposed to indicate the start offset
+ // (relative to the palette) of the data for the second field,
+ // however there are files in which it has a bogus value and thus
+ // we just ignore it
+ bytestream_get_le16(&buf);
// allocate sub and set values
sub->rects = av_mallocz(sizeof(*sub->rects));
@@ -108,8 +112,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
((uint32_t*)sub->rects[0]->pict.data[1])[i] |= 0xff000000;
// process RLE-compressed data
- rlelen = FFMIN(rlelen, buf_end - buf);
- init_get_bits(&gb, buf, rlelen * 8);
+ init_get_bits(&gb, buf, (buf_end - buf) * 8);
bitmap = sub->rects[0]->pict.data[0];
for (y = 0; y < h; y++) {
// interlaced: do odd lines
@@ -136,7 +139,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
AVCodec ff_xsub_decoder = {
.name = "xsub",
.type = AVMEDIA_TYPE_SUBTITLE,
- .id = CODEC_ID_XSUB,
+ .id = AV_CODEC_ID_XSUB,
.init = decode_init,
.decode = decode_frame,
.long_name = NULL_IF_CONFIG_SMALL("XSUB"),
diff --git a/gst-libs/ext/libav/libavcodec/xsubenc.c b/gst-libs/ext/libav/libavcodec/xsubenc.c
index bd66f86..816e651 100644
--- a/gst-libs/ext/libav/libavcodec/xsubenc.c
+++ b/gst-libs/ext/libav/libavcodec/xsubenc.c
@@ -111,9 +111,8 @@ static int make_tc(uint64_t ms, int *tc)
}
static int xsub_encode(AVCodecContext *avctx, unsigned char *buf,
- int bufsize, void *data)
+ int bufsize, const AVSubtitle *h)
{
- AVSubtitle *h = data;
uint64_t startTime = h->pts / 1000; // FIXME: need better solution...
uint64_t endTime = startTime + h->end_display_time - h->start_display_time;
int start_tc[4], end_tc[4];
@@ -211,10 +210,10 @@ static av_cold int xsub_encoder_init(AVCodecContext *avctx)
}
AVCodec ff_xsub_encoder = {
- .name = "xsub",
- .type = AVMEDIA_TYPE_SUBTITLE,
- .id = CODEC_ID_XSUB,
- .init = xsub_encoder_init,
- .encode = xsub_encode,
- .long_name = NULL_IF_CONFIG_SMALL("DivX subtitles (XSUB)"),
+ .name = "xsub",
+ .type = AVMEDIA_TYPE_SUBTITLE,
+ .id = AV_CODEC_ID_XSUB,
+ .init = xsub_encoder_init,
+ .encode_sub = xsub_encode,
+ .long_name = NULL_IF_CONFIG_SMALL("DivX subtitles (XSUB)"),
};
diff --git a/gst-libs/ext/libav/libavcodec/xvmc.h b/gst-libs/ext/libav/libavcodec/xvmc.h
index 1239015..1f77e4e 100644
--- a/gst-libs/ext/libav/libavcodec/xvmc.h
+++ b/gst-libs/ext/libav/libavcodec/xvmc.h
@@ -21,10 +21,23 @@
#ifndef AVCODEC_XVMC_H
#define AVCODEC_XVMC_H
+/**
+ * @file
+ * @ingroup lavc_codec_hwaccel_xvmc
+ * Public libavcodec XvMC header.
+ */
+
#include <X11/extensions/XvMC.h>
#include "avcodec.h"
+/**
+ * @defgroup lavc_codec_hwaccel_xvmc XvMC
+ * @ingroup lavc_codec_hwaccel
+ *
+ * @{
+ */
+
#define AV_XVMC_ID 0x1DC711C0 /**< special value to ensure that regular pixel routines haven't corrupted the struct
the number is 1337 speak for the letters IDCT MCo (motion compensation) */
@@ -134,7 +147,7 @@ struct xvmc_pix_fmt {
*/
int filled_mv_blocks_num;
- /** Number of the the next free data block; one data block consists of
+ /** Number of the next free data block; one data block consists of
64 short values in the data_blocks array.
All blocks before this one have already been claimed by placing their
position into the corresponding block description structure field,
@@ -148,4 +161,8 @@ struct xvmc_pix_fmt {
int next_free_data_block_num;
};
+/**
+ * @}
+ */
+
#endif /* AVCODEC_XVMC_H */
diff --git a/gst-libs/ext/libav/libavcodec/xwd.h b/gst-libs/ext/libav/libavcodec/xwd.h
new file mode 100644
index 0000000..f41e2cd
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/xwd.h
@@ -0,0 +1,41 @@
+/*
+ * XWD image format
+ *
+ * Copyright (c) 2012 Paul B Mahol
+ *
+ * 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
+ */
+
+#ifndef AVCODEC_XWD_H
+#define AVCODEC_XWD_H
+
+#define XWD_VERSION 7
+#define XWD_HEADER_SIZE 100
+#define XWD_CMAP_SIZE 12
+
+#define XWD_XY_BITMAP 0
+#define XWD_XY_PIXMAP 1
+#define XWD_Z_PIXMAP 2
+
+#define XWD_STATIC_GRAY 0
+#define XWD_GRAY_SCALE 1
+#define XWD_STATIC_COLOR 2
+#define XWD_PSEUDO_COLOR 3
+#define XWD_TRUE_COLOR 4
+#define XWD_DIRECT_COLOR 5
+
+#endif /* AVCODEC_XWD_H */
diff --git a/gst-libs/ext/libav/libavcodec/xwddec.c b/gst-libs/ext/libav/libavcodec/xwddec.c
new file mode 100644
index 0000000..274e4fa
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/xwddec.c
@@ -0,0 +1,270 @@
+/*
+ * XWD image format
+ *
+ * Copyright (c) 2012 Paul B Mahol
+ *
+ * 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
+ */
+
+#include "libavutil/imgutils.h"
+#include "avcodec.h"
+#include "bytestream.h"
+#include "internal.h"
+#include "xwd.h"
+
+static av_cold int xwd_decode_init(AVCodecContext *avctx)
+{
+ avctx->coded_frame = avcodec_alloc_frame();
+ if (!avctx->coded_frame)
+ return AVERROR(ENOMEM);
+
+ return 0;
+}
+
+static int xwd_decode_frame(AVCodecContext *avctx, void *data,
+ int *got_frame, AVPacket *avpkt)
+{
+ AVFrame *p = avctx->coded_frame;
+ const uint8_t *buf = avpkt->data;
+ int i, ret, buf_size = avpkt->size;
+ uint32_t version, header_size, vclass, ncolors;
+ uint32_t xoffset, be, bpp, lsize, rsize;
+ uint32_t pixformat, pixdepth, bunit, bitorder, bpad;
+ uint32_t rgb[3];
+ uint8_t *ptr;
+ GetByteContext gb;
+
+ if (buf_size < XWD_HEADER_SIZE)
+ return AVERROR_INVALIDDATA;
+
+ bytestream2_init(&gb, buf, buf_size);
+ header_size = bytestream2_get_be32u(&gb);
+
+ version = bytestream2_get_be32u(&gb);
+ if (version != XWD_VERSION) {
+ av_log(avctx, AV_LOG_ERROR, "unsupported version\n");
+ return AVERROR_INVALIDDATA;
+ }
+
+ if (buf_size < header_size || header_size < XWD_HEADER_SIZE) {
+ av_log(avctx, AV_LOG_ERROR, "invalid header size\n");
+ return AVERROR_INVALIDDATA;
+ }
+
+ pixformat = bytestream2_get_be32u(&gb);
+ pixdepth = bytestream2_get_be32u(&gb);
+ avctx->width = bytestream2_get_be32u(&gb);
+ avctx->height = bytestream2_get_be32u(&gb);
+ xoffset = bytestream2_get_be32u(&gb);
+ be = bytestream2_get_be32u(&gb);
+ bunit = bytestream2_get_be32u(&gb);
+ bitorder = bytestream2_get_be32u(&gb);
+ bpad = bytestream2_get_be32u(&gb);
+ bpp = bytestream2_get_be32u(&gb);
+ lsize = bytestream2_get_be32u(&gb);
+ vclass = bytestream2_get_be32u(&gb);
+ rgb[0] = bytestream2_get_be32u(&gb);
+ rgb[1] = bytestream2_get_be32u(&gb);
+ rgb[2] = bytestream2_get_be32u(&gb);
+ bytestream2_skipu(&gb, 8);
+ ncolors = bytestream2_get_be32u(&gb);
+ bytestream2_skipu(&gb, header_size - (XWD_HEADER_SIZE - 20));
+
+ av_log(avctx, AV_LOG_DEBUG, "pixformat %d, pixdepth %d, bunit %d, bitorder %d, bpad %d\n",
+ pixformat, pixdepth, bunit, bitorder, bpad);
+ av_log(avctx, AV_LOG_DEBUG, "vclass %d, ncolors %d, bpp %d, be %d, lsize %d, xoffset %d\n",
+ vclass, ncolors, bpp, be, lsize, xoffset);
+ av_log(avctx, AV_LOG_DEBUG, "red %0x, green %0x, blue %0x\n", rgb[0], rgb[1], rgb[2]);
+
+ if (pixformat > XWD_Z_PIXMAP) {
+ av_log(avctx, AV_LOG_ERROR, "invalid pixmap format\n");
+ return AVERROR_INVALIDDATA;
+ }
+
+ if (pixdepth == 0 || pixdepth > 32) {
+ av_log(avctx, AV_LOG_ERROR, "invalid pixmap depth\n");
+ return AVERROR_INVALIDDATA;
+ }
+
+ if (xoffset) {
+ av_log_ask_for_sample(avctx, "unsupported xoffset %d\n", xoffset);
+ return AVERROR_PATCHWELCOME;
+ }
+
+ if (be > 1) {
+ av_log(avctx, AV_LOG_ERROR, "invalid byte order\n");
+ return AVERROR_INVALIDDATA;
+ }
+
+ if (bitorder > 1) {
+ av_log(avctx, AV_LOG_ERROR, "invalid bitmap bit order\n");
+ return AVERROR_INVALIDDATA;
+ }
+
+ if (bunit != 8 && bunit != 16 && bunit != 32) {
+ av_log(avctx, AV_LOG_ERROR, "invalid bitmap unit\n");
+ return AVERROR_INVALIDDATA;
+ }
+
+ if (bpad != 8 && bpad != 16 && bpad != 32) {
+ av_log(avctx, AV_LOG_ERROR, "invalid bitmap scan-line pad\n");
+ return AVERROR_INVALIDDATA;
+ }
+
+ if (bpp == 0 || bpp > 32) {
+ av_log(avctx, AV_LOG_ERROR, "invalid bits per pixel\n");
+ return AVERROR_INVALIDDATA;
+ }
+
+ if (ncolors > 256) {
+ av_log(avctx, AV_LOG_ERROR, "invalid number of entries in colormap\n");
+ return AVERROR_INVALIDDATA;
+ }
+
+ if ((ret = av_image_check_size(avctx->width, avctx->height, 0, NULL)) < 0)
+ return ret;
+
+ rsize = FFALIGN(avctx->width * bpp, bpad) / 8;
+ if (lsize < rsize) {
+ av_log(avctx, AV_LOG_ERROR, "invalid bytes per scan-line\n");
+ return AVERROR_INVALIDDATA;
+ }
+
+ if (bytestream2_get_bytes_left(&gb) < ncolors * XWD_CMAP_SIZE + avctx->height * lsize) {
+ av_log(avctx, AV_LOG_ERROR, "input buffer too small\n");
+ return AVERROR_INVALIDDATA;
+ }
+
+ if (pixformat != XWD_Z_PIXMAP) {
+ av_log(avctx, AV_LOG_ERROR, "pixmap format %d unsupported\n", pixformat);
+ return AVERROR_PATCHWELCOME;
+ }
+
+ avctx->pix_fmt = AV_PIX_FMT_NONE;
+ switch (vclass) {
+ case XWD_STATIC_GRAY:
+ case XWD_GRAY_SCALE:
+ if (bpp != 1)
+ return AVERROR_INVALIDDATA;
+ if (pixdepth == 1)
+ avctx->pix_fmt = AV_PIX_FMT_MONOWHITE;
+ break;
+ case XWD_STATIC_COLOR:
+ case XWD_PSEUDO_COLOR:
+ if (bpp == 8)
+ avctx->pix_fmt = AV_PIX_FMT_PAL8;
+ break;
+ case XWD_TRUE_COLOR:
+ case XWD_DIRECT_COLOR:
+ if (bpp != 16 && bpp != 24 && bpp != 32)
+ return AVERROR_INVALIDDATA;
+ if (bpp == 16 && pixdepth == 15) {
+ if (rgb[0] == 0x7C00 && rgb[1] == 0x3E0 && rgb[2] == 0x1F)
+ avctx->pix_fmt = be ? AV_PIX_FMT_RGB555BE : AV_PIX_FMT_RGB555LE;
+ else if (rgb[0] == 0x1F && rgb[1] == 0x3E0 && rgb[2] == 0x7C00)
+ avctx->pix_fmt = be ? AV_PIX_FMT_BGR555BE : AV_PIX_FMT_BGR555LE;
+ } else if (bpp == 16 && pixdepth == 16) {
+ if (rgb[0] == 0xF800 && rgb[1] == 0x7E0 && rgb[2] == 0x1F)
+ avctx->pix_fmt = be ? AV_PIX_FMT_RGB565BE : AV_PIX_FMT_RGB565LE;
+ else if (rgb[0] == 0x1F && rgb[1] == 0x7E0 && rgb[2] == 0xF800)
+ avctx->pix_fmt = be ? AV_PIX_FMT_BGR565BE : AV_PIX_FMT_BGR565LE;
+ } else if (bpp == 24) {
+ if (rgb[0] == 0xFF0000 && rgb[1] == 0xFF00 && rgb[2] == 0xFF)
+ avctx->pix_fmt = be ? AV_PIX_FMT_RGB24 : AV_PIX_FMT_BGR24;
+ else if (rgb[0] == 0xFF && rgb[1] == 0xFF00 && rgb[2] == 0xFF0000)
+ avctx->pix_fmt = be ? AV_PIX_FMT_BGR24 : AV_PIX_FMT_RGB24;
+ } else if (bpp == 32) {
+ if (rgb[0] == 0xFF0000 && rgb[1] == 0xFF00 && rgb[2] == 0xFF)
+ avctx->pix_fmt = be ? AV_PIX_FMT_ARGB : AV_PIX_FMT_BGRA;
+ else if (rgb[0] == 0xFF && rgb[1] == 0xFF00 && rgb[2] == 0xFF0000)
+ avctx->pix_fmt = be ? AV_PIX_FMT_ABGR : AV_PIX_FMT_RGBA;
+ }
+ bytestream2_skipu(&gb, ncolors * XWD_CMAP_SIZE);
+ break;
+ default:
+ av_log(avctx, AV_LOG_ERROR, "invalid visual class\n");
+ return AVERROR_INVALIDDATA;
+ }
+
+ if (avctx->pix_fmt == AV_PIX_FMT_NONE) {
+ av_log_ask_for_sample(avctx, "unknown file: bpp %d, pixdepth %d, vclass %d\n", bpp, pixdepth, vclass);
+ return AVERROR_PATCHWELCOME;
+ }
+
+ if (p->data[0])
+ avctx->release_buffer(avctx, p);
+
+ p->reference = 0;
+ if ((ret = ff_get_buffer(avctx, p)) < 0) {
+ av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
+ return ret;
+ }
+
+ p->key_frame = 1;
+ p->pict_type = AV_PICTURE_TYPE_I;
+
+ if (avctx->pix_fmt == AV_PIX_FMT_PAL8) {
+ uint32_t *dst = (uint32_t *)p->data[1];
+ uint8_t red, green, blue;
+
+ for (i = 0; i < ncolors; i++) {
+
+ bytestream2_skipu(&gb, 4); // skip colormap entry number
+ red = bytestream2_get_byteu(&gb);
+ bytestream2_skipu(&gb, 1);
+ green = bytestream2_get_byteu(&gb);
+ bytestream2_skipu(&gb, 1);
+ blue = bytestream2_get_byteu(&gb);
+ bytestream2_skipu(&gb, 3); // skip bitmask flag and padding
+
+ dst[i] = red << 16 | green << 8 | blue;
+ }
+ }
+
+ ptr = p->data[0];
+ for (i = 0; i < avctx->height; i++) {
+ bytestream2_get_bufferu(&gb, ptr, rsize);
+ bytestream2_skipu(&gb, lsize - rsize);
+ ptr += p->linesize[0];
+ }
+
+ *got_frame = 1;
+ *(AVFrame *)data = *p;
+
+ return buf_size;
+}
+
+static av_cold int xwd_decode_close(AVCodecContext *avctx)
+{
+ if (avctx->coded_frame->data[0])
+ avctx->release_buffer(avctx, avctx->coded_frame);
+
+ av_freep(&avctx->coded_frame);
+
+ return 0;
+}
+
+AVCodec ff_xwd_decoder = {
+ .name = "xwd",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .id = AV_CODEC_ID_XWD,
+ .init = xwd_decode_init,
+ .close = xwd_decode_close,
+ .decode = xwd_decode_frame,
+ .capabilities = CODEC_CAP_DR1,
+ .long_name = NULL_IF_CONFIG_SMALL("XWD (X Window Dump) image"),
+};
diff --git a/gst-libs/ext/libav/libavcodec/xwdenc.c b/gst-libs/ext/libav/libavcodec/xwdenc.c
new file mode 100644
index 0000000..c9a2a56
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/xwdenc.c
@@ -0,0 +1,252 @@
+/*
+ * XWD image format
+ *
+ * Copyright (c) 2012 Paul B Mahol
+ *
+ * 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
+ */
+
+#include "libavutil/intreadwrite.h"
+#include "libavutil/pixdesc.h"
+#include "avcodec.h"
+#include "bytestream.h"
+#include "internal.h"
+#include "xwd.h"
+
+#define WINDOW_NAME "lavcxwdenc"
+#define WINDOW_NAME_SIZE 11
+
+static av_cold int xwd_encode_init(AVCodecContext *avctx)
+{
+ avctx->coded_frame = avcodec_alloc_frame();
+ if (!avctx->coded_frame)
+ return AVERROR(ENOMEM);
+
+ return 0;
+}
+
+static int xwd_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
+ const AVFrame *p, int *got_packet)
+{
+ enum AVPixelFormat pix_fmt = avctx->pix_fmt;
+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
+ uint32_t pixdepth, bpp, bpad, ncolors = 0, lsize, vclass, be = 0;
+ uint32_t rgb[3] = { 0 }, bitorder = 0;
+ uint32_t header_size;
+ int i, out_size, ret;
+ uint8_t *ptr, *buf;
+
+ pixdepth = av_get_bits_per_pixel(desc);
+ if (desc->flags & PIX_FMT_BE)
+ be = 1;
+ switch (pix_fmt) {
+ case AV_PIX_FMT_ARGB:
+ case AV_PIX_FMT_BGRA:
+ case AV_PIX_FMT_RGBA:
+ case AV_PIX_FMT_ABGR:
+ if (pix_fmt == AV_PIX_FMT_ARGB ||
+ pix_fmt == AV_PIX_FMT_ABGR)
+ be = 1;
+ if (pix_fmt == AV_PIX_FMT_ABGR ||
+ pix_fmt == AV_PIX_FMT_RGBA) {
+ rgb[0] = 0xFF;
+ rgb[1] = 0xFF00;
+ rgb[2] = 0xFF0000;
+ } else {
+ rgb[0] = 0xFF0000;
+ rgb[1] = 0xFF00;
+ rgb[2] = 0xFF;
+ }
+ bpp = 32;
+ pixdepth = 24;
+ vclass = XWD_TRUE_COLOR;
+ bpad = 32;
+ break;
+ case AV_PIX_FMT_BGR24:
+ case AV_PIX_FMT_RGB24:
+ if (pix_fmt == AV_PIX_FMT_RGB24)
+ be = 1;
+ bpp = 24;
+ vclass = XWD_TRUE_COLOR;
+ bpad = 32;
+ rgb[0] = 0xFF0000;
+ rgb[1] = 0xFF00;
+ rgb[2] = 0xFF;
+ break;
+ case AV_PIX_FMT_RGB565LE:
+ case AV_PIX_FMT_RGB565BE:
+ case AV_PIX_FMT_BGR565LE:
+ case AV_PIX_FMT_BGR565BE:
+ if (pix_fmt == AV_PIX_FMT_BGR565LE ||
+ pix_fmt == AV_PIX_FMT_BGR565BE) {
+ rgb[0] = 0x1F;
+ rgb[1] = 0x7E0;
+ rgb[2] = 0xF800;
+ } else {
+ rgb[0] = 0xF800;
+ rgb[1] = 0x7E0;
+ rgb[2] = 0x1F;
+ }
+ bpp = 16;
+ vclass = XWD_TRUE_COLOR;
+ bpad = 16;
+ break;
+ case AV_PIX_FMT_RGB555LE:
+ case AV_PIX_FMT_RGB555BE:
+ case AV_PIX_FMT_BGR555LE:
+ case AV_PIX_FMT_BGR555BE:
+ if (pix_fmt == AV_PIX_FMT_BGR555LE ||
+ pix_fmt == AV_PIX_FMT_BGR555BE) {
+ rgb[0] = 0x1F;
+ rgb[1] = 0x3E0;
+ rgb[2] = 0x7C00;
+ } else {
+ rgb[0] = 0x7C00;
+ rgb[1] = 0x3E0;
+ rgb[2] = 0x1F;
+ }
+ bpp = 16;
+ vclass = XWD_TRUE_COLOR;
+ bpad = 16;
+ break;
+ case AV_PIX_FMT_RGB8:
+ case AV_PIX_FMT_BGR8:
+ case AV_PIX_FMT_RGB4_BYTE:
+ case AV_PIX_FMT_BGR4_BYTE:
+ case AV_PIX_FMT_PAL8:
+ bpp = 8;
+ vclass = XWD_PSEUDO_COLOR;
+ bpad = 8;
+ ncolors = 256;
+ break;
+ case AV_PIX_FMT_MONOWHITE:
+ be = 1;
+ bitorder = 1;
+ bpp = 1;
+ bpad = 8;
+ vclass = XWD_STATIC_GRAY;
+ break;
+ default:
+ av_log(avctx, AV_LOG_INFO, "unsupported pixel format\n");
+ return AVERROR(EINVAL);
+ }
+
+ lsize = FFALIGN(bpp * avctx->width, bpad) / 8;
+ header_size = XWD_HEADER_SIZE + WINDOW_NAME_SIZE;
+ out_size = header_size + ncolors * XWD_CMAP_SIZE + avctx->height * lsize;
+
+ if ((ret = ff_alloc_packet(pkt, out_size)) < 0) {
+ av_log(avctx, AV_LOG_ERROR, "output buffer too small\n");
+ return ret;
+ }
+ buf = pkt->data;
+
+ avctx->coded_frame->key_frame = 1;
+ avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I;
+
+ bytestream_put_be32(&buf, header_size);
+ bytestream_put_be32(&buf, XWD_VERSION); // file version
+ bytestream_put_be32(&buf, XWD_Z_PIXMAP); // pixmap format
+ bytestream_put_be32(&buf, pixdepth); // pixmap depth in pixels
+ bytestream_put_be32(&buf, avctx->width); // pixmap width in pixels
+ bytestream_put_be32(&buf, avctx->height); // pixmap height in pixels
+ bytestream_put_be32(&buf, 0); // bitmap x offset
+ bytestream_put_be32(&buf, be); // byte order
+ bytestream_put_be32(&buf, 32); // bitmap unit
+ bytestream_put_be32(&buf, bitorder); // bit-order of image data
+ bytestream_put_be32(&buf, bpad); // bitmap scan-line pad in bits
+ bytestream_put_be32(&buf, bpp); // bits per pixel
+ bytestream_put_be32(&buf, lsize); // bytes per scan-line
+ bytestream_put_be32(&buf, vclass); // visual class
+ bytestream_put_be32(&buf, rgb[0]); // red mask
+ bytestream_put_be32(&buf, rgb[1]); // green mask
+ bytestream_put_be32(&buf, rgb[2]); // blue mask
+ bytestream_put_be32(&buf, 8); // size of each bitmask in bits
+ bytestream_put_be32(&buf, ncolors); // number of colors
+ bytestream_put_be32(&buf, ncolors); // number of entries in color map
+ bytestream_put_be32(&buf, avctx->width); // window width
+ bytestream_put_be32(&buf, avctx->height); // window height
+ bytestream_put_be32(&buf, 0); // window upper left X coordinate
+ bytestream_put_be32(&buf, 0); // window upper left Y coordinate
+ bytestream_put_be32(&buf, 0); // window border width
+ bytestream_put_buffer(&buf, WINDOW_NAME, WINDOW_NAME_SIZE);
+
+ for (i = 0; i < ncolors; i++) {
+ uint32_t val;
+ uint8_t red, green, blue;
+
+ val = AV_RN32A(p->data[1] + i * 4);
+ red = (val >> 16) & 0xFF;
+ green = (val >> 8) & 0xFF;
+ blue = val & 0xFF;
+
+ bytestream_put_be32(&buf, i); // colormap entry number
+ bytestream_put_be16(&buf, red << 8);
+ bytestream_put_be16(&buf, green << 8);
+ bytestream_put_be16(&buf, blue << 8);
+ bytestream_put_byte(&buf, 0x7); // bitmask flag
+ bytestream_put_byte(&buf, 0); // padding
+ }
+
+ ptr = p->data[0];
+ for (i = 0; i < avctx->height; i++) {
+ bytestream_put_buffer(&buf, ptr, lsize);
+ ptr += p->linesize[0];
+ }
+
+ pkt->flags |= AV_PKT_FLAG_KEY;
+ *got_packet = 1;
+ return 0;
+}
+
+static av_cold int xwd_encode_close(AVCodecContext *avctx)
+{
+ av_freep(&avctx->coded_frame);
+
+ return 0;
+}
+
+AVCodec ff_xwd_encoder = {
+ .name = "xwd",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .id = AV_CODEC_ID_XWD,
+ .init = xwd_encode_init,
+ .encode2 = xwd_encode_frame,
+ .close = xwd_encode_close,
+ .pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_BGRA,
+ AV_PIX_FMT_RGBA,
+ AV_PIX_FMT_ARGB,
+ AV_PIX_FMT_ABGR,
+ AV_PIX_FMT_RGB24,
+ AV_PIX_FMT_BGR24,
+ AV_PIX_FMT_RGB565BE,
+ AV_PIX_FMT_RGB565LE,
+ AV_PIX_FMT_BGR565BE,
+ AV_PIX_FMT_BGR565LE,
+ AV_PIX_FMT_RGB555BE,
+ AV_PIX_FMT_RGB555LE,
+ AV_PIX_FMT_BGR555BE,
+ AV_PIX_FMT_BGR555LE,
+ AV_PIX_FMT_RGB8,
+ AV_PIX_FMT_BGR8,
+ AV_PIX_FMT_RGB4_BYTE,
+ AV_PIX_FMT_BGR4_BYTE,
+ AV_PIX_FMT_PAL8,
+ AV_PIX_FMT_MONOWHITE,
+ AV_PIX_FMT_NONE },
+ .long_name = NULL_IF_CONFIG_SMALL("XWD (X Window Dump) image"),
+};
diff --git a/gst-libs/ext/libav/libavcodec/xxan.c b/gst-libs/ext/libav/libavcodec/xxan.c
index 59e1229..84ffdec 100644
--- a/gst-libs/ext/libav/libavcodec/xxan.c
+++ b/gst-libs/ext/libav/libavcodec/xxan.c
@@ -22,11 +22,10 @@
#include "avcodec.h"
#include "libavutil/intreadwrite.h"
+#include "libavutil/mem.h"
#include "bytestream.h"
#define BITSTREAM_READER_LE
#include "get_bits.h"
-// for av_memcpy_backptr
-#include "libavutil/lzo.h"
typedef struct XanContext {
AVCodecContext *avctx;
@@ -44,7 +43,12 @@ static av_cold int xan_decode_init(AVCodecContext *avctx)
s->avctx = avctx;
- avctx->pix_fmt = PIX_FMT_YUV420P;
+ avctx->pix_fmt = AV_PIX_FMT_YUV420P;
+
+ if (avctx->height < 8) {
+ av_log(avctx, AV_LOG_ERROR, "Invalid frame height: %d.\n", avctx->height);
+ return AVERROR(EINVAL);
+ }
s->buffer_size = avctx->width * avctx->height;
s->y_buffer = av_malloc(s->buffer_size);
@@ -62,42 +66,42 @@ static av_cold int xan_decode_init(AVCodecContext *avctx)
static int xan_unpack_luma(XanContext *s,
uint8_t *dst, const int dst_size)
{
- int tree_size, eof;
- int bits, mask;
- int tree_root, node;
- const uint8_t *dst_end = dst + dst_size;
- GetByteContext tree = s->gb;
- int start_off = bytestream2_tell(&tree);
-
- tree_size = bytestream2_get_byte(&s->gb);
- eof = bytestream2_get_byte(&s->gb);
- tree_root = eof + tree_size;
- bytestream2_skip(&s->gb, tree_size * 2);
-
- node = tree_root;
- bits = bytestream2_get_byte(&s->gb);
- mask = 0x80;
- for (;;) {
- int bit = !!(bits & mask);
- mask >>= 1;
- bytestream2_seek(&tree, start_off + node*2 + bit - eof * 2, SEEK_SET);
- node = bytestream2_get_byte(&tree);
- if (node == eof)
- break;
- if (node < eof) {
- *dst++ = node;
- if (dst > dst_end)
- break;
- node = tree_root;
- }
- if (!mask) {
- if (bytestream2_get_bytes_left(&s->gb) <= 0)
- break;
- bits = bytestream2_get_byteu(&s->gb);
- mask = 0x80;
- }
- }
- return dst != dst_end ? AVERROR_INVALIDDATA : 0;
+ int tree_size, eof;
+ int bits, mask;
+ int tree_root, node;
+ const uint8_t *dst_end = dst + dst_size;
+ GetByteContext tree = s->gb;
+ int start_off = bytestream2_tell(&tree);
+
+ tree_size = bytestream2_get_byte(&s->gb);
+ eof = bytestream2_get_byte(&s->gb);
+ tree_root = eof + tree_size;
+ bytestream2_skip(&s->gb, tree_size * 2);
+
+ node = tree_root;
+ bits = bytestream2_get_byte(&s->gb);
+ mask = 0x80;
+ for (;;) {
+ int bit = !!(bits & mask);
+ mask >>= 1;
+ bytestream2_seek(&tree, start_off + node*2 + bit - eof * 2, SEEK_SET);
+ node = bytestream2_get_byte(&tree);
+ if (node == eof)
+ break;
+ if (node < eof) {
+ *dst++ = node;
+ if (dst > dst_end)
+ break;
+ node = tree_root;
+ }
+ if (!mask) {
+ if (bytestream2_get_bytes_left(&s->gb) <= 0)
+ break;
+ bits = bytestream2_get_byteu(&s->gb);
+ mask = 0x80;
+ }
+ }
+ return dst != dst_end ? AVERROR_INVALIDDATA : 0;
}
/* almost the same as in xan_wc3 decoder */
@@ -211,6 +215,10 @@ static int xan_decode_chroma(AVCodecContext *avctx, unsigned chroma_off)
U += s->pic.linesize[1];
V += s->pic.linesize[2];
}
+ if (avctx->height & 1) {
+ memcpy(U, U - s->pic.linesize[1], avctx->width >> 1);
+ memcpy(V, V - s->pic.linesize[2], avctx->width >> 1);
+ }
} else {
uint8_t *U2 = U + s->pic.linesize[1];
uint8_t *V2 = V + s->pic.linesize[2];
@@ -231,6 +239,12 @@ static int xan_decode_chroma(AVCodecContext *avctx, unsigned chroma_off)
U2 += s->pic.linesize[1] * 2;
V2 += s->pic.linesize[2] * 2;
}
+ if (avctx->height & 3) {
+ int lines = ((avctx->height + 1) >> 1) - (avctx->height >> 2) * 2;
+
+ memcpy(U, U - lines * s->pic.linesize[1], lines * s->pic.linesize[1]);
+ memcpy(V, V - lines * s->pic.linesize[2], lines * s->pic.linesize[2]);
+ }
}
return 0;
@@ -290,11 +304,8 @@ static int xan_decode_frame_type0(AVCodecContext *avctx)
}
if (corr_off) {
- int corr_end, dec_size;
+ int dec_size;
- corr_end = (s->gb.buffer_end - s->gb.buffer_start);
- if (chroma_off > corr_off)
- corr_end = chroma_off;
bytestream2_seek(&s->gb, 8 + corr_off, SEEK_SET);
dec_size = xan_unpack(s, s->scratch_buffer, s->buffer_size / 2);
if (dec_size < 0)
@@ -361,7 +372,7 @@ static int xan_decode_frame_type1(AVCodecContext *avctx)
}
static int xan_decode_frame(AVCodecContext *avctx,
- void *data, int *data_size,
+ void *data, int *got_frame,
AVPacket *avpkt)
{
XanContext *s = avctx->priv_data;
@@ -393,7 +404,7 @@ static int xan_decode_frame(AVCodecContext *avctx,
if (ret)
return ret;
- *data_size = sizeof(AVFrame);
+ *got_frame = 1;
*(AVFrame*)data = s->pic;
return avpkt->size;
@@ -415,12 +426,11 @@ static av_cold int xan_decode_end(AVCodecContext *avctx)
AVCodec ff_xan_wc4_decoder = {
.name = "xan_wc4",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_XAN_WC4,
+ .id = AV_CODEC_ID_XAN_WC4,
.priv_data_size = sizeof(XanContext),
.init = xan_decode_init,
.close = xan_decode_end,
.decode = xan_decode_frame,
.capabilities = CODEC_CAP_DR1,
- .long_name = NULL_IF_CONFIG_SMALL("Wing Commander IV / Xxan"),
+ .long_name = NULL_IF_CONFIG_SMALL("Wing Commander IV / Xxan"),
};
-
diff --git a/gst-libs/ext/libav/libavcodec/yop.c b/gst-libs/ext/libav/libavcodec/yop.c
index 3c2d8b8..e02b9bf 100644
--- a/gst-libs/ext/libav/libavcodec/yop.c
+++ b/gst-libs/ext/libav/libavcodec/yop.c
@@ -27,6 +27,7 @@
#include "avcodec.h"
#include "get_bits.h"
+#include "internal.h"
typedef struct YopDecContext {
AVFrame frame;
@@ -35,10 +36,10 @@ typedef struct YopDecContext {
int num_pal_colors;
int first_color[2];
int frame_data_length;
- int row_pos;
uint8_t *low_nibble;
uint8_t *srcptr;
+ uint8_t *src_end;
uint8_t *dstptr;
uint8_t *dstbuf;
} YopDecContext;
@@ -89,7 +90,12 @@ static av_cold int yop_decode_init(AVCodecContext *avctx)
return -1;
}
- avctx->pix_fmt = PIX_FMT_PAL8;
+ if (avctx->extradata_size < 3) {
+ av_log(avctx, AV_LOG_ERROR, "Missing or incomplete extradata.\n");
+ return AVERROR_INVALIDDATA;
+ }
+
+ avctx->pix_fmt = AV_PIX_FMT_PAL8;
s->num_pal_colors = avctx->extradata[0];
s->first_color[0] = avctx->extradata[1];
@@ -118,8 +124,13 @@ static av_cold int yop_decode_close(AVCodecContext *avctx)
* @param s codec context
* @param tag the tag that was in the nibble
*/
-static void yop_paint_block(YopDecContext *s, int tag)
+static int yop_paint_block(YopDecContext *s, int tag)
{
+ if (s->src_end - s->srcptr < paint_lut[tag][3]) {
+ av_log(s->avctx, AV_LOG_ERROR, "Packet too small.\n");
+ return AVERROR_INVALIDDATA;
+ }
+
s->dstptr[0] = s->srcptr[0];
s->dstptr[1] = s->srcptr[paint_lut[tag][0]];
s->dstptr[s->frame.linesize[0]] = s->srcptr[paint_lut[tag][1]];
@@ -127,6 +138,7 @@ static void yop_paint_block(YopDecContext *s, int tag)
// The number of src bytes consumed is in the last part of the lut entry.
s->srcptr += paint_lut[tag][3];
+ return 0;
}
/**
@@ -172,44 +184,32 @@ static uint8_t yop_get_next_nibble(YopDecContext *s)
return ret;
}
-/**
- * Take s->dstptr to the next macroblock in sequence.
- */
-static void yop_next_macroblock(YopDecContext *s)
-{
- // If we are advancing to the next row of macroblocks
- if (s->row_pos == s->frame.linesize[0] - 2) {
- s->dstptr += s->frame.linesize[0];
- s->row_pos = 0;
- }else {
- s->row_pos += 2;
- }
- s->dstptr += 2;
-}
-
-static int yop_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
+static int yop_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
AVPacket *avpkt)
{
YopDecContext *s = avctx->priv_data;
int tag, firstcolor, is_odd_frame;
- int ret, i;
+ int ret, i, x, y;
uint32_t *palette;
+ if (avpkt->size < 4 + 3 * s->num_pal_colors) {
+ av_log(avctx, AV_LOG_ERROR, "Packet too small.\n");
+ return AVERROR_INVALIDDATA;
+ }
+
if (s->frame.data[0])
avctx->release_buffer(avctx, &s->frame);
- ret = avctx->get_buffer(avctx, &s->frame);
+ ret = ff_get_buffer(avctx, &s->frame);
if (ret < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return ret;
}
- s->frame.linesize[0] = avctx->width;
-
s->dstbuf = s->frame.data[0];
s->dstptr = s->frame.data[0];
s->srcptr = avpkt->data + 4;
- s->row_pos = 0;
+ s->src_end = avpkt->data + avpkt->size;
s->low_nibble = NULL;
is_odd_frame = avpkt->data[0];
@@ -223,26 +223,33 @@ static int yop_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
s->frame.palette_has_changed = 1;
- while (s->dstptr - s->dstbuf <
- avctx->width * avctx->height &&
- s->srcptr - avpkt->data < avpkt->size) {
-
- tag = yop_get_next_nibble(s);
+ for (y = 0; y < avctx->height; y += 2) {
+ for (x = 0; x < avctx->width; x += 2) {
+ if (s->srcptr - avpkt->data >= avpkt->size) {
+ av_log(avctx, AV_LOG_ERROR, "Packet too small.\n");
+ return AVERROR_INVALIDDATA;
+ }
- if (tag != 0xf) {
- yop_paint_block(s, tag);
- }else {
tag = yop_get_next_nibble(s);
- ret = yop_copy_previous_block(s, tag);
- if (ret < 0) {
- avctx->release_buffer(avctx, &s->frame);
- return ret;
+
+ if (tag != 0xf) {
+ ret = yop_paint_block(s, tag);
+ if (ret < 0)
+ return ret;
+ } else {
+ tag = yop_get_next_nibble(s);
+ ret = yop_copy_previous_block(s, tag);
+ if (ret < 0) {
+ avctx->release_buffer(avctx, &s->frame);
+ return ret;
+ }
}
+ s->dstptr += 2;
}
- yop_next_macroblock(s);
+ s->dstptr += 2*s->frame.linesize[0] - x;
}
- *data_size = sizeof(AVFrame);
+ *got_frame = 1;
*(AVFrame *) data = s->frame;
return avpkt->size;
}
@@ -250,10 +257,11 @@ static int yop_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
AVCodec ff_yop_decoder = {
.name = "yop",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_YOP,
+ .id = AV_CODEC_ID_YOP,
.priv_data_size = sizeof(YopDecContext),
.init = yop_decode_init,
.close = yop_decode_close,
.decode = yop_decode_frame,
- .long_name = NULL_IF_CONFIG_SMALL("Psygnosis YOP Video"),
+ .long_name = NULL_IF_CONFIG_SMALL("Psygnosis YOP Video"),
+ .capabilities = CODEC_CAP_DR1,
};
diff --git a/gst-libs/ext/libav/libavcodec/zerocodec.c b/gst-libs/ext/libav/libavcodec/zerocodec.c
new file mode 100644
index 0000000..8122cca
--- /dev/null
+++ b/gst-libs/ext/libav/libavcodec/zerocodec.c
@@ -0,0 +1,168 @@
+/*
+ * ZeroCodec Decoder
+ *
+ * Copyright (c) 2012, Derek Buitenhuis
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <zlib.h>
+
+#include "avcodec.h"
+#include "internal.h"
+#include "libavutil/common.h"
+
+typedef struct {
+ AVFrame previous_frame;
+ z_stream zstream;
+} ZeroCodecContext;
+
+static int zerocodec_decode_frame(AVCodecContext *avctx, void *data,
+ int *got_frame, AVPacket *avpkt)
+{
+ ZeroCodecContext *zc = avctx->priv_data;
+ AVFrame *pic = avctx->coded_frame;
+ AVFrame *prev_pic = &zc->previous_frame;
+ z_stream *zstream = &zc->zstream;
+ uint8_t *prev = prev_pic->data[0];
+ uint8_t *dst;
+ int i, j, zret;
+
+ pic->reference = 3;
+
+ if (avpkt->flags & AV_PKT_FLAG_KEY) {
+ pic->key_frame = 1;
+ pic->pict_type = AV_PICTURE_TYPE_I;
+ } else {
+ if (!prev) {
+ av_log(avctx, AV_LOG_ERROR, "Missing reference frame.\n");
+ return AVERROR_INVALIDDATA;
+ }
+
+ prev += (avctx->height - 1) * prev_pic->linesize[0];
+
+ pic->key_frame = 0;
+ pic->pict_type = AV_PICTURE_TYPE_P;
+ }
+
+ zret = inflateReset(zstream);
+ if (zret != Z_OK) {
+ av_log(avctx, AV_LOG_ERROR, "Could not reset inflate: %d.\n", zret);
+ return AVERROR_INVALIDDATA;
+ }
+
+ if (ff_get_buffer(avctx, pic) < 0) {
+ av_log(avctx, AV_LOG_ERROR, "Could not allocate buffer.\n");
+ return AVERROR(ENOMEM);
+ }
+
+ zstream->next_in = avpkt->data;
+ zstream->avail_in = avpkt->size;
+
+ dst = pic->data[0] + (avctx->height - 1) * pic->linesize[0];
+
+ /**
+ * ZeroCodec has very simple interframe compression. If a value
+ * is the same as the previous frame, set it to 0.
+ */
+
+ for (i = 0; i < avctx->height; i++) {
+ zstream->next_out = dst;
+ zstream->avail_out = avctx->width << 1;
+
+ zret = inflate(zstream, Z_SYNC_FLUSH);
+ if (zret != Z_OK && zret != Z_STREAM_END) {
+ avctx->release_buffer(avctx, pic);
+ av_log(avctx, AV_LOG_ERROR,
+ "Inflate failed with return code: %d.\n", zret);
+ return AVERROR_INVALIDDATA;
+ }
+
+ if (!(avpkt->flags & AV_PKT_FLAG_KEY))
+ for (j = 0; j < avctx->width << 1; j++)
+ dst[j] += prev[j] & -!dst[j];
+
+ prev -= prev_pic->linesize[0];
+ dst -= pic->linesize[0];
+ }
+
+ /* Release the previous buffer if need be */
+ if (prev_pic->data[0])
+ avctx->release_buffer(avctx, prev_pic);
+
+ *got_frame = 1;
+ *(AVFrame *)data = *pic;
+
+ /* Store the previous frame for use later.
+ * FFSWAP ensures that e.g. pic->data is NULLed. */
+ FFSWAP(AVFrame, *pic, *prev_pic);
+
+ return avpkt->size;
+}
+
+static av_cold int zerocodec_decode_close(AVCodecContext *avctx)
+{
+ ZeroCodecContext *zc = avctx->priv_data;
+ AVFrame *prev_pic = &zc->previous_frame;
+
+ inflateEnd(&zc->zstream);
+
+ /* Release last frame */
+ if (prev_pic->data[0])
+ avctx->release_buffer(avctx, prev_pic);
+
+ av_freep(&avctx->coded_frame);
+
+ return 0;
+}
+
+static av_cold int zerocodec_decode_init(AVCodecContext *avctx)
+{
+ ZeroCodecContext *zc = avctx->priv_data;
+ z_stream *zstream = &zc->zstream;
+ int zret;
+
+ avctx->pix_fmt = AV_PIX_FMT_UYVY422;
+ avctx->bits_per_raw_sample = 8;
+
+ zstream->zalloc = Z_NULL;
+ zstream->zfree = Z_NULL;
+ zstream->opaque = Z_NULL;
+
+ zret = inflateInit(zstream);
+ if (zret != Z_OK) {
+ av_log(avctx, AV_LOG_ERROR, "Could not initialize inflate: %d.\n", zret);
+ return AVERROR(ENOMEM);
+ }
+
+ avctx->coded_frame = avcodec_alloc_frame();
+ if (!avctx->coded_frame) {
+ av_log(avctx, AV_LOG_ERROR, "Could not allocate frame buffer.\n");
+ zerocodec_decode_close(avctx);
+ return AVERROR(ENOMEM);
+ }
+
+ return 0;
+}
+
+AVCodec ff_zerocodec_decoder = {
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "zerocodec",
+ .id = AV_CODEC_ID_ZEROCODEC,
+ .priv_data_size = sizeof(ZeroCodecContext),
+ .init = zerocodec_decode_init,
+ .decode = zerocodec_decode_frame,
+ .close = zerocodec_decode_close,
+ .capabilities = CODEC_CAP_DR1,
+ .long_name = NULL_IF_CONFIG_SMALL("ZeroCodec Lossless Video"),
+};
diff --git a/gst-libs/ext/libav/libavcodec/zmbv.c b/gst-libs/ext/libav/libavcodec/zmbv.c
index a36a844..c92e553 100644
--- a/gst-libs/ext/libav/libavcodec/zmbv.c
+++ b/gst-libs/ext/libav/libavcodec/zmbv.c
@@ -27,8 +27,10 @@
#include <stdio.h>
#include <stdlib.h>
+#include "libavutil/common.h"
#include "libavutil/intreadwrite.h"
#include "avcodec.h"
+#include "internal.h"
#include <zlib.h>
@@ -396,23 +398,24 @@ static int zmbv_decode_intra(ZmbvContext *c)
return 0;
}
-static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt)
+static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
ZmbvContext * const c = avctx->priv_data;
int zret = Z_OK; // Zlib return code
int len = buf_size;
- int hi_ver, lo_ver;
+ int hi_ver, lo_ver, ret;
+ uint8_t *tmp;
if (c->pic.data[0])
avctx->release_buffer(avctx, &c->pic);
c->pic.reference = 1;
c->pic.buffer_hints = FF_BUFFER_HINTS_VALID;
- if (avctx->get_buffer(avctx, &c->pic) < 0) {
+ if ((ret = ff_get_buffer(avctx, &c->pic)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
- return -1;
+ return ret;
}
/* parse header */
@@ -425,6 +428,8 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
c->fmt = buf[3];
c->bw = buf[4];
c->bh = buf[5];
+ c->decode_intra = NULL;
+ c->decode_xor = NULL;
buf += 6;
len -= 6;
@@ -432,19 +437,19 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
"Flags=%X ver=%i.%i comp=%i fmt=%i blk=%ix%i\n",
c->flags,hi_ver,lo_ver,c->comp,c->fmt,c->bw,c->bh);
if (hi_ver != 0 || lo_ver != 1) {
- av_log(avctx, AV_LOG_ERROR, "Unsupported version %i.%i\n",
- hi_ver, lo_ver);
- return -1;
+ av_log_ask_for_sample(avctx, "Unsupported version %i.%i\n",
+ hi_ver, lo_ver);
+ return AVERROR_PATCHWELCOME;
}
if (c->bw == 0 || c->bh == 0) {
- av_log(avctx, AV_LOG_ERROR, "Unsupported block size %ix%i\n",
- c->bw, c->bh);
- return -1;
+ av_log_ask_for_sample(avctx, "Unsupported block size %ix%i\n",
+ c->bw, c->bh);
+ return AVERROR_PATCHWELCOME;
}
if (c->comp != 0 && c->comp != 1) {
- av_log(avctx, AV_LOG_ERROR, "Unsupported compression type %i\n",
- c->comp);
- return -1;
+ av_log_ask_for_sample(avctx, "Unsupported compression type %i\n",
+ c->comp);
+ return AVERROR_PATCHWELCOME;
}
switch (c->fmt) {
@@ -474,38 +479,48 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
default:
c->decode_intra = NULL;
c->decode_xor = NULL;
- av_log(avctx, AV_LOG_ERROR,
- "Unsupported (for now) format %i\n", c->fmt);
- return -1;
+ av_log_ask_for_sample(avctx, "Unsupported (for now) format %i\n",
+ c->fmt);
+ return AVERROR_PATCHWELCOME;
}
zret = inflateReset(&c->zstream);
if (zret != Z_OK) {
av_log(avctx, AV_LOG_ERROR, "Inflate reset error: %d\n", zret);
return -1;
- }
-
- c->cur = av_realloc(c->cur, avctx->width * avctx->height * (c->bpp / 8));
- c->prev = av_realloc(c->prev, avctx->width * avctx->height * (c->bpp / 8));
- c->bx = (c->width + c->bw - 1) / c->bw;
- c->by = (c->height+ c->bh - 1) / c->bh;
- }
-
- if (c->decode_intra == NULL) {
- av_log(avctx, AV_LOG_ERROR, "Error! Got no format or no keyframe!\n");
- return -1;
- }
-
- if (c->comp == 0) { //Uncompressed data
- memcpy(c->decomp_buf, buf, len);
- c->decomp_size = 1;
- } else { // ZLIB-compressed data
+ }
+
+ tmp = av_realloc(c->cur, avctx->width * avctx->height * (c->bpp / 8));
+ if (!tmp)
+ return AVERROR(ENOMEM);
+ c->cur = tmp;
+ tmp = av_realloc(c->prev, avctx->width * avctx->height * (c->bpp / 8));
+ if (!tmp)
+ return AVERROR(ENOMEM);
+ c->prev = tmp;
+ c->bx = (c->width + c->bw - 1) / c->bw;
+ c->by = (c->height + c->bh - 1) / c->bh;
+ }
+
+ if (c->decode_intra == NULL) {
+ av_log(avctx, AV_LOG_ERROR, "Error! Got no format or no keyframe!\n");
+ return AVERROR_INVALIDDATA;
+ }
+
+ if (c->comp == 0) { //Uncompressed data
+ memcpy(c->decomp_buf, buf, len);
+ c->decomp_size = 1;
+ } else { // ZLIB-compressed data
c->zstream.total_in = c->zstream.total_out = 0;
c->zstream.next_in = buf;
c->zstream.avail_in = len;
c->zstream.next_out = c->decomp_buf;
c->zstream.avail_out = c->decomp_size;
- inflate(&c->zstream, Z_FINISH);
+ zret = inflate(&c->zstream, Z_SYNC_FLUSH);
+ if (zret != Z_OK && zret != Z_STREAM_END) {
+ av_log(avctx, AV_LOG_ERROR, "inflate error %d\n", zret);
+ return AVERROR_INVALIDDATA;
+ }
c->decomp_len = c->zstream.total_out;
}
if (c->flags & ZMBV_KEYFRAME) {
@@ -586,20 +601,13 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
}
FFSWAP(uint8_t *, c->cur, c->prev);
}
- *data_size = sizeof(AVFrame);
+ *got_frame = 1;
*(AVFrame*)data = c->pic;
/* always report that the buffer was completely consumed */
return buf_size;
}
-
-
-/*
- *
- * Init zmbv decoder
- *
- */
static av_cold int decode_init(AVCodecContext *avctx)
{
ZmbvContext * const c = avctx->priv_data;
@@ -615,7 +623,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
// Needed if zlib unused or init aborted before inflateInit
memset(&c->zstream, 0, sizeof(z_stream));
- avctx->pix_fmt = PIX_FMT_RGB24;
+ avctx->pix_fmt = AV_PIX_FMT_RGB24;
c->decomp_size = (avctx->width + 255) * 4 * (avctx->height + 64);
/* Allocate decompression buffer */
@@ -623,7 +631,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
if ((c->decomp_buf = av_malloc(c->decomp_size)) == NULL) {
av_log(avctx, AV_LOG_ERROR,
"Can't allocate decompression buffer.\n");
- return 1;
+ return AVERROR(ENOMEM);
}
}
@@ -633,19 +641,12 @@ static av_cold int decode_init(AVCodecContext *avctx)
zret = inflateInit(&c->zstream);
if (zret != Z_OK) {
av_log(avctx, AV_LOG_ERROR, "Inflate init error: %d\n", zret);
- return 1;
+ return -1;
}
return 0;
}
-
-
-/*
- *
- * Uninit zmbv decoder
- *
- */
static av_cold int decode_end(AVCodecContext *avctx)
{
ZmbvContext * const c = avctx->priv_data;
@@ -664,12 +665,11 @@ static av_cold int decode_end(AVCodecContext *avctx)
AVCodec ff_zmbv_decoder = {
.name = "zmbv",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_ZMBV,
+ .id = AV_CODEC_ID_ZMBV,
.priv_data_size = sizeof(ZmbvContext),
.init = decode_init,
.close = decode_end,
.decode = decode_frame,
.capabilities = CODEC_CAP_DR1,
- .long_name = NULL_IF_CONFIG_SMALL("Zip Motion Blocks Video"),
+ .long_name = NULL_IF_CONFIG_SMALL("Zip Motion Blocks Video"),
};
-
diff --git a/gst-libs/ext/libav/libavcodec/zmbvenc.c b/gst-libs/ext/libav/libavcodec/zmbvenc.c
index 75fcffe..9ac7d6d 100644
--- a/gst-libs/ext/libav/libavcodec/zmbvenc.c
+++ b/gst-libs/ext/libav/libavcodec/zmbvenc.c
@@ -27,8 +27,10 @@
#include <stdio.h>
#include <stdlib.h>
+#include "libavutil/common.h"
#include "libavutil/intreadwrite.h"
#include "avcodec.h"
+#include "internal.h"
#include <zlib.h>
@@ -115,19 +117,18 @@ static int zmbv_me(ZmbvEncContext *c, uint8_t *src, int sstride, uint8_t *prev,
return bv;
}
-static int encode_frame(AVCodecContext *avctx, uint8_t *buf, int buf_size, void *data)
+static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
+ const AVFrame *pict, int *got_packet)
{
ZmbvEncContext * const c = avctx->priv_data;
- AVFrame *pict = data;
AVFrame * const p = &c->pic;
- uint8_t *src, *prev;
+ uint8_t *src, *prev, *buf;
uint32_t *palptr;
- int len = 0;
int keyframe, chpal;
int fl;
- int work_size = 0;
+ int work_size = 0, pkt_size;
int bw, bh;
- int i, j;
+ int i, j, ret;
keyframe = !c->curfrm;
c->curfrm++;
@@ -138,17 +139,6 @@ static int encode_frame(AVCodecContext *avctx, uint8_t *buf, int buf_size, void
p->key_frame= keyframe;
chpal = !keyframe && memcmp(p->data[1], c->pal2, 1024);
- fl = (keyframe ? ZMBV_KEYFRAME : 0) | (chpal ? ZMBV_DELTAPAL : 0);
- *buf++ = fl; len++;
- if(keyframe){
- deflateReset(&c->zstream);
- *buf++ = 0; len++; // hi ver
- *buf++ = 1; len++; // lo ver
- *buf++ = 1; len++; // comp
- *buf++ = 4; len++; // format - 8bpp
- *buf++ = ZMBV_BLOCK; len++; // block width
- *buf++ = ZMBV_BLOCK; len++; // block height
- }
palptr = (uint32_t*)p->data[1];
src = p->data[0];
prev = c->prev;
@@ -223,6 +213,9 @@ static int encode_frame(AVCodecContext *avctx, uint8_t *buf, int buf_size, void
src += p->linesize[0];
}
+ if (keyframe)
+ deflateReset(&c->zstream);
+
c->zstream.next_in = c->work_buf;
c->zstream.avail_in = work_size;
c->zstream.total_in = 0;
@@ -235,8 +228,29 @@ static int encode_frame(AVCodecContext *avctx, uint8_t *buf, int buf_size, void
return -1;
}
+ pkt_size = c->zstream.total_out + 1 + 6*keyframe;
+ if ((ret = ff_alloc_packet(pkt, pkt_size)) < 0) {
+ av_log(avctx, AV_LOG_ERROR, "Error getting packet of size %d.\n", pkt_size);
+ return ret;
+ }
+ buf = pkt->data;
+
+ fl = (keyframe ? ZMBV_KEYFRAME : 0) | (chpal ? ZMBV_DELTAPAL : 0);
+ *buf++ = fl;
+ if (keyframe) {
+ *buf++ = 0; // hi ver
+ *buf++ = 1; // lo ver
+ *buf++ = 1; // comp
+ *buf++ = 4; // format - 8bpp
+ *buf++ = ZMBV_BLOCK; // block width
+ *buf++ = ZMBV_BLOCK; // block height
+ }
memcpy(buf, c->comp_buf, c->zstream.total_out);
- return len + c->zstream.total_out;
+
+ pkt->flags |= AV_PKT_FLAG_KEY*keyframe;
+ *got_packet = 1;
+
+ return 0;
}
@@ -265,7 +279,7 @@ static av_cold int encode_init(AVCodecContext *avctx)
lvl = avctx->compression_level;
if(lvl < 0 || lvl > 9){
av_log(avctx, AV_LOG_ERROR, "Compression level should be 0-9, not %i\n", lvl);
- return -1;
+ return AVERROR(EINVAL);
}
// Needed if zlib unused or init aborted before deflateInit
@@ -274,7 +288,7 @@ static av_cold int encode_init(AVCodecContext *avctx)
((avctx->width + ZMBV_BLOCK - 1) / ZMBV_BLOCK) * ((avctx->height + ZMBV_BLOCK - 1) / ZMBV_BLOCK) * 2 + 4;
if ((c->work_buf = av_malloc(c->comp_size)) == NULL) {
av_log(avctx, AV_LOG_ERROR, "Can't allocate work buffer.\n");
- return -1;
+ return AVERROR(ENOMEM);
}
/* Conservative upper bound taken from zlib v1.2.1 source via lcl.c */
c->comp_size = c->comp_size + ((c->comp_size + 7) >> 3) +
@@ -283,12 +297,12 @@ static av_cold int encode_init(AVCodecContext *avctx)
/* Allocate compression buffer */
if ((c->comp_buf = av_malloc(c->comp_size)) == NULL) {
av_log(avctx, AV_LOG_ERROR, "Can't allocate compression buffer.\n");
- return -1;
+ return AVERROR(ENOMEM);
}
c->pstride = FFALIGN(avctx->width, 16);
if ((c->prev = av_malloc(c->pstride * avctx->height)) == NULL) {
av_log(avctx, AV_LOG_ERROR, "Can't allocate picture.\n");
- return -1;
+ return AVERROR(ENOMEM);
}
c->zstream.zalloc = Z_NULL;
@@ -300,7 +314,7 @@ static av_cold int encode_init(AVCodecContext *avctx)
return -1;
}
- avctx->coded_frame = (AVFrame*)&c->pic;
+ avctx->coded_frame = &c->pic;
return 0;
}
@@ -326,11 +340,11 @@ static av_cold int encode_end(AVCodecContext *avctx)
AVCodec ff_zmbv_encoder = {
.name = "zmbv",
.type = AVMEDIA_TYPE_VIDEO,
- .id = CODEC_ID_ZMBV,
+ .id = AV_CODEC_ID_ZMBV,
.priv_data_size = sizeof(ZmbvEncContext),
.init = encode_init,
- .encode = encode_frame,
+ .encode2 = encode_frame,
.close = encode_end,
- .pix_fmts = (const enum PixelFormat[]){PIX_FMT_PAL8, PIX_FMT_NONE},
- .long_name = NULL_IF_CONFIG_SMALL("Zip Motion Blocks Video"),
+ .pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_PAL8, AV_PIX_FMT_NONE },
+ .long_name = NULL_IF_CONFIG_SMALL("Zip Motion Blocks Video"),
};
diff --git a/gst-libs/ext/libav/libavdevice/Makefile b/gst-libs/ext/libav/libavdevice/Makefile
index 1a1e2f1..76d11c1 100644
--- a/gst-libs/ext/libav/libavdevice/Makefile
+++ b/gst-libs/ext/libav/libavdevice/Makefile
@@ -1,9 +1,11 @@
NAME = avdevice
FFLIBS = avformat avcodec avutil
-HEADERS = avdevice.h
+HEADERS = avdevice.h \
+ version.h \
-OBJS = alldevices.o avdevice.o
+OBJS = alldevices.o \
+ avdevice.o \
# input/output devices
OBJS-$(CONFIG_ALSA_INDEV) += alsa-audio-common.o \
@@ -20,9 +22,8 @@ OBJS-$(CONFIG_PULSE_INDEV) += pulse.o
OBJS-$(CONFIG_SNDIO_INDEV) += sndio_common.o sndio_dec.o
OBJS-$(CONFIG_SNDIO_OUTDEV) += sndio_common.o sndio_enc.o
OBJS-$(CONFIG_V4L2_INDEV) += v4l2.o
-OBJS-$(CONFIG_V4L_INDEV) += v4l.o
OBJS-$(CONFIG_VFWCAP_INDEV) += vfwcap.o
-OBJS-$(CONFIG_X11_GRAB_DEVICE_INDEV) += x11grab.o
+OBJS-$(CONFIG_X11GRAB_INDEV) += x11grab.o
# external libraries
OBJS-$(CONFIG_LIBCDIO_INDEV) += libcdio.o
diff --git a/gst-libs/ext/libav/libavdevice/alldevices.c b/gst-libs/ext/libav/libavdevice/alldevices.c
index e65644b..155f7a8 100644
--- a/gst-libs/ext/libav/libavdevice/alldevices.c
+++ b/gst-libs/ext/libav/libavdevice/alldevices.c
@@ -22,13 +22,21 @@
#include "libavformat/avformat.h"
#include "avdevice.h"
-#define REGISTER_OUTDEV(X,x) { \
- extern AVOutputFormat ff_##x##_muxer; \
- if(CONFIG_##X##_OUTDEV) av_register_output_format(&ff_##x##_muxer); }
-#define REGISTER_INDEV(X,x) { \
- extern AVInputFormat ff_##x##_demuxer; \
- if(CONFIG_##X##_INDEV) av_register_input_format(&ff_##x##_demuxer); }
-#define REGISTER_INOUTDEV(X,x) REGISTER_OUTDEV(X,x); REGISTER_INDEV(X,x)
+#define REGISTER_OUTDEV(X, x) \
+ { \
+ extern AVOutputFormat ff_##x##_muxer; \
+ if (CONFIG_##X##_OUTDEV) \
+ av_register_output_format(&ff_##x##_muxer); \
+ }
+
+#define REGISTER_INDEV(X, x) \
+ { \
+ extern AVInputFormat ff_##x##_demuxer; \
+ if (CONFIG_##X##_INDEV) \
+ av_register_input_format(&ff_##x##_demuxer); \
+ }
+
+#define REGISTER_INOUTDEV(X, x) REGISTER_OUTDEV(X, x); REGISTER_INDEV(X, x)
void avdevice_register_all(void)
{
@@ -39,22 +47,19 @@ void avdevice_register_all(void)
initialized = 1;
/* devices */
- REGISTER_INOUTDEV (ALSA, alsa);
- REGISTER_INDEV (BKTR, bktr);
- REGISTER_INDEV (DV1394, dv1394);
- REGISTER_INDEV (FBDEV, fbdev);
- REGISTER_INDEV (JACK, jack);
- REGISTER_INOUTDEV (OSS, oss);
- REGISTER_INDEV (PULSE, pulse);
- REGISTER_INOUTDEV (SNDIO, sndio);
- REGISTER_INDEV (V4L2, v4l2);
-#if FF_API_V4L
- REGISTER_INDEV (V4L, v4l);
-#endif
- REGISTER_INDEV (VFWCAP, vfwcap);
- REGISTER_INDEV (X11_GRAB_DEVICE, x11_grab_device);
+ REGISTER_INOUTDEV(ALSA, alsa);
+ REGISTER_INDEV (BKTR, bktr);
+ REGISTER_INDEV (DV1394, dv1394);
+ REGISTER_INDEV (FBDEV, fbdev);
+ REGISTER_INDEV (JACK, jack);
+ REGISTER_INOUTDEV(OSS, oss);
+ REGISTER_INDEV (PULSE, pulse);
+ REGISTER_INOUTDEV(SNDIO, sndio);
+ REGISTER_INDEV (V4L2, v4l2);
+ REGISTER_INDEV (VFWCAP, vfwcap);
+ REGISTER_INDEV (X11GRAB, x11grab);
/* external libraries */
- REGISTER_INDEV (LIBCDIO, libcdio);
- REGISTER_INDEV (LIBDC1394, libdc1394);
+ REGISTER_INDEV (LIBCDIO, libcdio);
+ REGISTER_INDEV (LIBDC1394, libdc1394);
}
diff --git a/gst-libs/ext/libav/libavdevice/alsa-audio-common.c b/gst-libs/ext/libav/libavdevice/alsa-audio-common.c
index cfee28c..21f1594 100644
--- a/gst-libs/ext/libav/libavdevice/alsa-audio-common.c
+++ b/gst-libs/ext/libav/libavdevice/alsa-audio-common.c
@@ -31,33 +31,33 @@
#include <alsa/asoundlib.h>
#include "libavformat/avformat.h"
#include "libavutil/avassert.h"
-#include "libavutil/audioconvert.h"
+#include "libavutil/channel_layout.h"
#include "alsa-audio.h"
static av_cold snd_pcm_format_t codec_id_to_pcm_format(int codec_id)
{
switch(codec_id) {
- case CODEC_ID_PCM_F64LE: return SND_PCM_FORMAT_FLOAT64_LE;
- case CODEC_ID_PCM_F64BE: return SND_PCM_FORMAT_FLOAT64_BE;
- case CODEC_ID_PCM_F32LE: return SND_PCM_FORMAT_FLOAT_LE;
- case CODEC_ID_PCM_F32BE: return SND_PCM_FORMAT_FLOAT_BE;
- case CODEC_ID_PCM_S32LE: return SND_PCM_FORMAT_S32_LE;
- case CODEC_ID_PCM_S32BE: return SND_PCM_FORMAT_S32_BE;
- case CODEC_ID_PCM_U32LE: return SND_PCM_FORMAT_U32_LE;
- case CODEC_ID_PCM_U32BE: return SND_PCM_FORMAT_U32_BE;
- case CODEC_ID_PCM_S24LE: return SND_PCM_FORMAT_S24_3LE;
- case CODEC_ID_PCM_S24BE: return SND_PCM_FORMAT_S24_3BE;
- case CODEC_ID_PCM_U24LE: return SND_PCM_FORMAT_U24_3LE;
- case CODEC_ID_PCM_U24BE: return SND_PCM_FORMAT_U24_3BE;
- case CODEC_ID_PCM_S16LE: return SND_PCM_FORMAT_S16_LE;
- case CODEC_ID_PCM_S16BE: return SND_PCM_FORMAT_S16_BE;
- case CODEC_ID_PCM_U16LE: return SND_PCM_FORMAT_U16_LE;
- case CODEC_ID_PCM_U16BE: return SND_PCM_FORMAT_U16_BE;
- case CODEC_ID_PCM_S8: return SND_PCM_FORMAT_S8;
- case CODEC_ID_PCM_U8: return SND_PCM_FORMAT_U8;
- case CODEC_ID_PCM_MULAW: return SND_PCM_FORMAT_MU_LAW;
- case CODEC_ID_PCM_ALAW: return SND_PCM_FORMAT_A_LAW;
+ case AV_CODEC_ID_PCM_F64LE: return SND_PCM_FORMAT_FLOAT64_LE;
+ case AV_CODEC_ID_PCM_F64BE: return SND_PCM_FORMAT_FLOAT64_BE;
+ case AV_CODEC_ID_PCM_F32LE: return SND_PCM_FORMAT_FLOAT_LE;
+ case AV_CODEC_ID_PCM_F32BE: return SND_PCM_FORMAT_FLOAT_BE;
+ case AV_CODEC_ID_PCM_S32LE: return SND_PCM_FORMAT_S32_LE;
+ case AV_CODEC_ID_PCM_S32BE: return SND_PCM_FORMAT_S32_BE;
+ case AV_CODEC_ID_PCM_U32LE: return SND_PCM_FORMAT_U32_LE;
+ case AV_CODEC_ID_PCM_U32BE: return SND_PCM_FORMAT_U32_BE;
+ case AV_CODEC_ID_PCM_S24LE: return SND_PCM_FORMAT_S24_3LE;
+ case AV_CODEC_ID_PCM_S24BE: return SND_PCM_FORMAT_S24_3BE;
+ case AV_CODEC_ID_PCM_U24LE: return SND_PCM_FORMAT_U24_3LE;
+ case AV_CODEC_ID_PCM_U24BE: return SND_PCM_FORMAT_U24_3BE;
+ case AV_CODEC_ID_PCM_S16LE: return SND_PCM_FORMAT_S16_LE;
+ case AV_CODEC_ID_PCM_S16BE: return SND_PCM_FORMAT_S16_BE;
+ case AV_CODEC_ID_PCM_U16LE: return SND_PCM_FORMAT_U16_LE;
+ case AV_CODEC_ID_PCM_U16BE: return SND_PCM_FORMAT_U16_BE;
+ case AV_CODEC_ID_PCM_S8: return SND_PCM_FORMAT_S8;
+ case AV_CODEC_ID_PCM_U8: return SND_PCM_FORMAT_U8;
+ case AV_CODEC_ID_PCM_MULAW: return SND_PCM_FORMAT_MU_LAW;
+ case AV_CODEC_ID_PCM_ALAW: return SND_PCM_FORMAT_A_LAW;
default: return SND_PCM_FORMAT_UNKNOWN;
}
}
@@ -156,20 +156,20 @@ static av_cold int find_reorder_func(AlsaData *s, int codec_id, uint64_t layout,
return 0;
switch (codec_id) {
- case CODEC_ID_PCM_S8:
- case CODEC_ID_PCM_U8:
- case CODEC_ID_PCM_ALAW:
- case CODEC_ID_PCM_MULAW: format = FORMAT_I8; break;
- case CODEC_ID_PCM_S16LE:
- case CODEC_ID_PCM_S16BE:
- case CODEC_ID_PCM_U16LE:
- case CODEC_ID_PCM_U16BE: format = FORMAT_I16; break;
- case CODEC_ID_PCM_S32LE:
- case CODEC_ID_PCM_S32BE:
- case CODEC_ID_PCM_U32LE:
- case CODEC_ID_PCM_U32BE: format = FORMAT_I32; break;
- case CODEC_ID_PCM_F32LE:
- case CODEC_ID_PCM_F32BE: format = FORMAT_F32; break;
+ case AV_CODEC_ID_PCM_S8:
+ case AV_CODEC_ID_PCM_U8:
+ case AV_CODEC_ID_PCM_ALAW:
+ case AV_CODEC_ID_PCM_MULAW: format = FORMAT_I8; break;
+ case AV_CODEC_ID_PCM_S16LE:
+ case AV_CODEC_ID_PCM_S16BE:
+ case AV_CODEC_ID_PCM_U16LE:
+ case AV_CODEC_ID_PCM_U16BE: format = FORMAT_I16; break;
+ case AV_CODEC_ID_PCM_S32LE:
+ case AV_CODEC_ID_PCM_S32BE:
+ case AV_CODEC_ID_PCM_U32LE:
+ case AV_CODEC_ID_PCM_U32BE: format = FORMAT_I32; break;
+ case AV_CODEC_ID_PCM_F32LE:
+ case AV_CODEC_ID_PCM_F32BE: format = FORMAT_F32; break;
default: return AVERROR(ENOSYS);
}
@@ -185,7 +185,7 @@ static av_cold int find_reorder_func(AlsaData *s, int codec_id, uint64_t layout,
av_cold int ff_alsa_open(AVFormatContext *ctx, snd_pcm_stream_t mode,
unsigned int *sample_rate,
- int channels, enum CodecID *codec_id)
+ int channels, enum AVCodecID *codec_id)
{
AlsaData *s = ctx->priv_data;
const char *audio_device;
@@ -199,7 +199,7 @@ av_cold int ff_alsa_open(AVFormatContext *ctx, snd_pcm_stream_t mode,
if (ctx->filename[0] == 0) audio_device = "default";
else audio_device = ctx->filename;
- if (*codec_id == CODEC_ID_NONE)
+ if (*codec_id == AV_CODEC_ID_NONE)
*codec_id = DEFAULT_CODEC_ID;
format = codec_id_to_pcm_format(*codec_id);
if (format == SND_PCM_FORMAT_UNKNOWN) {
diff --git a/gst-libs/ext/libav/libavdevice/alsa-audio-dec.c b/gst-libs/ext/libav/libavdevice/alsa-audio-dec.c
index 5344b19..5b32ed9 100644
--- a/gst-libs/ext/libav/libavdevice/alsa-audio-dec.c
+++ b/gst-libs/ext/libav/libavdevice/alsa-audio-dec.c
@@ -52,13 +52,12 @@
#include "alsa-audio.h"
-static av_cold int audio_read_header(AVFormatContext *s1,
- AVFormatParameters *ap)
+static av_cold int audio_read_header(AVFormatContext *s1)
{
AlsaData *s = s1->priv_data;
AVStream *st;
int ret;
- enum CodecID codec_id;
+ enum AVCodecID codec_id;
snd_pcm_sw_params_t *sw_params;
st = avformat_new_stream(s1, NULL);
@@ -152,8 +151,8 @@ static int audio_read_packet(AVFormatContext *s1, AVPacket *pkt)
}
static const AVOption options[] = {
- { "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 },
+ { "sample_rate", "", offsetof(AlsaData, sample_rate), AV_OPT_TYPE_INT, {.i64 = 48000}, 1, INT_MAX, AV_OPT_FLAG_DECODING_PARAM },
+ { "channels", "", offsetof(AlsaData, channels), AV_OPT_TYPE_INT, {.i64 = 2}, 1, INT_MAX, AV_OPT_FLAG_DECODING_PARAM },
{ NULL },
};
diff --git a/gst-libs/ext/libav/libavdevice/alsa-audio-enc.c b/gst-libs/ext/libav/libavdevice/alsa-audio-enc.c
index 95887c1..bb4575f 100644
--- a/gst-libs/ext/libav/libavdevice/alsa-audio-enc.c
+++ b/gst-libs/ext/libav/libavdevice/alsa-audio-enc.c
@@ -47,7 +47,7 @@ static av_cold int audio_write_header(AVFormatContext *s1)
AlsaData *s = s1->priv_data;
AVStream *st;
unsigned int sample_rate;
- enum CodecID codec_id;
+ enum AVCodecID codec_id;
int res;
st = s1->streams[0];
@@ -106,7 +106,7 @@ AVOutputFormat ff_alsa_muxer = {
.long_name = NULL_IF_CONFIG_SMALL("ALSA audio output"),
.priv_data_size = sizeof(AlsaData),
.audio_codec = DEFAULT_CODEC_ID,
- .video_codec = CODEC_ID_NONE,
+ .video_codec = AV_CODEC_ID_NONE,
.write_header = audio_write_header,
.write_packet = audio_write_packet,
.write_trailer = ff_alsa_close,
diff --git a/gst-libs/ext/libav/libavdevice/alsa-audio.h b/gst-libs/ext/libav/libavdevice/alsa-audio.h
index ee43463..26eaee6 100644
--- a/gst-libs/ext/libav/libavdevice/alsa-audio.h
+++ b/gst-libs/ext/libav/libavdevice/alsa-audio.h
@@ -38,11 +38,11 @@
/* XXX: we make the assumption that the soundcard accepts this format */
/* XXX: find better solution with "preinit" method, needed also in
other formats */
-#define DEFAULT_CODEC_ID AV_NE(CODEC_ID_PCM_S16BE, CODEC_ID_PCM_S16LE)
+#define DEFAULT_CODEC_ID AV_NE(AV_CODEC_ID_PCM_S16BE, AV_CODEC_ID_PCM_S16LE)
#define ALSA_BUFFER_SIZE_MAX 32768
-typedef struct {
+typedef struct AlsaData {
AVClass *class;
snd_pcm_t *h;
int frame_size; ///< preferred size for reads and writes
@@ -62,15 +62,15 @@ typedef struct {
* @param sample_rate in: requested sample rate;
* out: actually selected sample rate
* @param channels number of channels
- * @param codec_id in: requested CodecID or CODEC_ID_NONE;
- * out: actually selected CodecID, changed only if
- * CODEC_ID_NONE was requested
+ * @param codec_id in: requested AVCodecID or AV_CODEC_ID_NONE;
+ * out: actually selected AVCodecID, changed only if
+ * AV_CODEC_ID_NONE was requested
*
* @return 0 if OK, AVERROR_xxx on error
*/
int ff_alsa_open(AVFormatContext *s, snd_pcm_stream_t mode,
unsigned int *sample_rate,
- int channels, enum CodecID *codec_id);
+ int channels, enum AVCodecID *codec_id);
/**
* Close the ALSA PCM.
diff --git a/gst-libs/ext/libav/libavdevice/avdevice.c b/gst-libs/ext/libav/libavdevice/avdevice.c
index 4813a3d..5a5c762 100644
--- a/gst-libs/ext/libav/libavdevice/avdevice.c
+++ b/gst-libs/ext/libav/libavdevice/avdevice.c
@@ -17,6 +17,7 @@
*/
#include "avdevice.h"
+#include "config.h"
unsigned avdevice_version(void)
{
diff --git a/gst-libs/ext/libav/libavdevice/avdevice.h b/gst-libs/ext/libav/libavdevice/avdevice.h
index e6c86cb..39166a5 100644
--- a/gst-libs/ext/libav/libavdevice/avdevice.h
+++ b/gst-libs/ext/libav/libavdevice/avdevice.h
@@ -19,6 +19,8 @@
#ifndef AVDEVICE_AVDEVICE_H
#define AVDEVICE_AVDEVICE_H
+#include "version.h"
+
/**
* @file
* @ingroup lavd
@@ -34,31 +36,13 @@
* (de)muxers in libavdevice are of the AVFMT_NOFILE type (they use their own
* I/O functions). The filename passed to avformat_open_input() often does not
* refer to an actually existing file, but has some special device-specific
- * meaning - e.g. for the x11grab device it is the display name.
+ * meaning - e.g. for x11grab it is the display name.
*
* To use libavdevice, simply call avdevice_register_all() to register all
* compiled muxers and demuxers. They all use standard libavformat API.
* @}
*/
-#include "libavutil/avutil.h"
-
-#define LIBAVDEVICE_VERSION_MAJOR 53
-#define LIBAVDEVICE_VERSION_MINOR 2
-#define LIBAVDEVICE_VERSION_MICRO 0
-
-#define LIBAVDEVICE_VERSION_INT AV_VERSION_INT(LIBAVDEVICE_VERSION_MAJOR, \
- LIBAVDEVICE_VERSION_MINOR, \
- LIBAVDEVICE_VERSION_MICRO)
-#define LIBAVDEVICE_VERSION AV_VERSION(LIBAVDEVICE_VERSION_MAJOR, \
- LIBAVDEVICE_VERSION_MINOR, \
- LIBAVDEVICE_VERSION_MICRO)
-#define LIBAVDEVICE_BUILD LIBAVDEVICE_VERSION_INT
-
-#ifndef FF_API_V4L
-#define FF_API_V4L (LIBAVDEVICE_VERSION_MAJOR < 54)
-#endif
-
/**
* Return the LIBAVDEVICE_VERSION_INT constant.
*/
@@ -81,4 +65,3 @@ const char *avdevice_license(void);
void avdevice_register_all(void);
#endif /* AVDEVICE_AVDEVICE_H */
-
diff --git a/gst-libs/ext/libav/libavdevice/bktr.c b/gst-libs/ext/libav/libavdevice/bktr.c
index 8abe5ef..d0122d3 100644
--- a/gst-libs/ext/libav/libavdevice/bktr.c
+++ b/gst-libs/ext/libav/libavdevice/bktr.c
@@ -102,7 +102,7 @@ static av_cold int bktr_init(const char *video_device, int width, int height,
long ioctl_frequency;
char *arg;
int c;
- struct sigaction act, old;
+ struct sigaction act = { 0 }, old;
if (idev < 0 || idev > 4)
{
@@ -131,7 +131,6 @@ static av_cold int bktr_init(const char *video_device, int width, int height,
frequency = 0.0;
}
- memset(&act, 0, sizeof(act));
sigemptyset(&act.sa_mask);
act.sa_handler = catchsignal;
sigaction(SIGUSR1, &act, &old);
@@ -243,7 +242,7 @@ static int grab_read_packet(AVFormatContext *s1, AVPacket *pkt)
return video_buf_size;
}
-static int grab_read_header(AVFormatContext *s1, AVFormatParameters *ap)
+static int grab_read_header(AVFormatContext *s1)
{
VideoData *s = s1->priv_data;
AVStream *st;
@@ -283,8 +282,8 @@ static int grab_read_header(AVFormatContext *s1, AVFormatParameters *ap)
s->per_frame = ((uint64_t)1000000 * framerate.den) / framerate.num;
st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
- st->codec->pix_fmt = PIX_FMT_YUV420P;
- st->codec->codec_id = CODEC_ID_RAWVIDEO;
+ st->codec->pix_fmt = AV_PIX_FMT_YUV420P;
+ st->codec->codec_id = AV_CODEC_ID_RAWVIDEO;
st->codec->width = width;
st->codec->height = height;
st->codec->time_base.den = framerate.num;
@@ -325,13 +324,13 @@ 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), 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" },
+ { "standard", "", offsetof(VideoData, standard), AV_OPT_TYPE_INT, {.i64 = VIDEO_FORMAT}, PAL, NTSCJ, AV_OPT_FLAG_DECODING_PARAM, "standard" },
+ { "PAL", "", 0, AV_OPT_TYPE_CONST, {.i64 = PAL}, 0, 0, AV_OPT_FLAG_DECODING_PARAM, "standard" },
+ { "NTSC", "", 0, AV_OPT_TYPE_CONST, {.i64 = NTSC}, 0, 0, AV_OPT_FLAG_DECODING_PARAM, "standard" },
+ { "SECAM", "", 0, AV_OPT_TYPE_CONST, {.i64 = SECAM}, 0, 0, AV_OPT_FLAG_DECODING_PARAM, "standard" },
+ { "PALN", "", 0, AV_OPT_TYPE_CONST, {.i64 = PALN}, 0, 0, AV_OPT_FLAG_DECODING_PARAM, "standard" },
+ { "PALM", "", 0, AV_OPT_TYPE_CONST, {.i64 = PALM}, 0, 0, AV_OPT_FLAG_DECODING_PARAM, "standard" },
+ { "NTSCJ", "", 0, AV_OPT_TYPE_CONST, {.i64 = 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/gst-libs/ext/libav/libavdevice/dv1394.c b/gst-libs/ext/libav/libavdevice/dv1394.c
index 69e59ec..ce8efa6 100644
--- a/gst-libs/ext/libav/libavdevice/dv1394.c
+++ b/gst-libs/ext/libav/libavdevice/dv1394.c
@@ -26,8 +26,6 @@
#include <poll.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
-#include <sys/time.h>
-#include <time.h>
#include "libavutil/log.h"
#include "libavutil/opt.h"
@@ -81,7 +79,7 @@ static int dv1394_start(struct dv1394_data *dv)
return 0;
}
-static int dv1394_read_header(AVFormatContext * context, AVFormatParameters * ap)
+static int dv1394_read_header(AVFormatContext * context)
{
struct dv1394_data *dv = context->priv_data;
@@ -213,10 +211,10 @@ static int dv1394_close(AVFormatContext * context)
}
static const AVOption options[] = {
- { "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 },
+ { "standard", "", offsetof(struct dv1394_data, format), AV_OPT_TYPE_INT, {.i64 = DV1394_NTSC}, DV1394_NTSC, DV1394_PAL, AV_OPT_FLAG_DECODING_PARAM, "standard" },
+ { "PAL", "", 0, AV_OPT_TYPE_CONST, {.i64 = DV1394_PAL}, 0, 0, AV_OPT_FLAG_DECODING_PARAM, "standard" },
+ { "NTSC", "", 0, AV_OPT_TYPE_CONST, {.i64 = DV1394_NTSC}, 0, 0, AV_OPT_FLAG_DECODING_PARAM, "standard" },
+ { "channel", "", offsetof(struct dv1394_data, channel), AV_OPT_TYPE_INT, {.i64 = DV1394_DEFAULT_CHANNEL}, 0, INT_MAX, AV_OPT_FLAG_DECODING_PARAM },
{ NULL },
};
diff --git a/gst-libs/ext/libav/libavdevice/dv1394.h b/gst-libs/ext/libav/libavdevice/dv1394.h
index 5ccc68a..9710ff5 100644
--- a/gst-libs/ext/libav/libavdevice/dv1394.h
+++ b/gst-libs/ext/libav/libavdevice/dv1394.h
@@ -175,7 +175,8 @@
if(status.dropped_frames > 0) {
reset_dv1394();
} else {
- for(int i = 0; i < status.n_clear_frames; i++) {
+ int i;
+ for (i = 0; i < status.n_clear_frames; i++) {
copy_DV_frame();
}
}
@@ -185,7 +186,7 @@
where copy_DV_frame() reads or writes on the dv1394 file descriptor
(read/write mode) or copies data to/from the mmap ringbuffer and
then calls ioctl(DV1394_SUBMIT_FRAMES) to notify dv1394 that new
- frames are availble (mmap mode).
+ frames are available (mmap mode).
reset_dv1394() is called in the event of a buffer
underflow/overflow or a halt in the DV stream (e.g. due to a 1394
diff --git a/gst-libs/ext/libav/libavdevice/fbdev.c b/gst-libs/ext/libav/libavdevice/fbdev.c
index 7444f47..7680b29 100644
--- a/gst-libs/ext/libav/libavdevice/fbdev.c
+++ b/gst-libs/ext/libav/libavdevice/fbdev.c
@@ -32,7 +32,6 @@
#include <unistd.h>
#include <fcntl.h>
#include <sys/ioctl.h>
-#include <sys/time.h>
#include <sys/mman.h>
#include <time.h>
#include <linux/fb.h>
@@ -40,6 +39,7 @@
#include "libavutil/log.h"
#include "libavutil/mem.h"
#include "libavutil/opt.h"
+#include "libavutil/time.h"
#include "libavutil/parseutils.h"
#include "libavutil/pixdesc.h"
#include "libavformat/avformat.h"
@@ -48,20 +48,20 @@
struct rgb_pixfmt_map_entry {
int bits_per_pixel;
int red_offset, green_offset, blue_offset, alpha_offset;
- enum PixelFormat pixfmt;
+ enum AVPixelFormat pixfmt;
};
static struct rgb_pixfmt_map_entry rgb_pixfmt_map[] = {
// bpp, red_offset, green_offset, blue_offset, alpha_offset, pixfmt
- { 32, 0, 8, 16, 24, PIX_FMT_RGBA },
- { 32, 16, 8, 0, 24, PIX_FMT_BGRA },
- { 32, 8, 16, 24, 0, PIX_FMT_ARGB },
- { 32, 3, 2, 8, 0, PIX_FMT_ABGR },
- { 24, 0, 8, 16, 0, PIX_FMT_RGB24 },
- { 24, 16, 8, 0, 0, PIX_FMT_BGR24 },
+ { 32, 0, 8, 16, 24, AV_PIX_FMT_RGBA },
+ { 32, 16, 8, 0, 24, AV_PIX_FMT_BGRA },
+ { 32, 8, 16, 24, 0, AV_PIX_FMT_ARGB },
+ { 32, 3, 2, 8, 0, AV_PIX_FMT_ABGR },
+ { 24, 0, 8, 16, 0, AV_PIX_FMT_RGB24 },
+ { 24, 16, 8, 0, 0, AV_PIX_FMT_BGR24 },
};
-static enum PixelFormat get_pixfmt_from_fb_varinfo(struct fb_var_screeninfo *varinfo)
+static enum AVPixelFormat get_pixfmt_from_fb_varinfo(struct fb_var_screeninfo *varinfo)
{
int i;
@@ -74,7 +74,7 @@ static enum PixelFormat get_pixfmt_from_fb_varinfo(struct fb_var_screeninfo *var
return entry->pixfmt;
}
- return PIX_FMT_NONE;
+ return AV_PIX_FMT_NONE;
}
typedef struct {
@@ -95,12 +95,11 @@ typedef struct {
uint8_t *data; ///< framebuffer data
} FBDevContext;
-av_cold static int fbdev_read_header(AVFormatContext *avctx,
- AVFormatParameters *ap)
+static av_cold int fbdev_read_header(AVFormatContext *avctx)
{
FBDevContext *fbdev = avctx->priv_data;
AVStream *st = NULL;
- enum PixelFormat pix_fmt;
+ enum AVPixelFormat pix_fmt;
int ret, flags = O_RDONLY;
ret = av_parse_video_rate(&fbdev->framerate_q, fbdev->framerate);
@@ -140,7 +139,7 @@ av_cold static int fbdev_read_header(AVFormatContext *avctx,
}
pix_fmt = get_pixfmt_from_fb_varinfo(&fbdev->varinfo);
- if (pix_fmt == PIX_FMT_NONE) {
+ if (pix_fmt == AV_PIX_FMT_NONE) {
ret = AVERROR(EINVAL);
av_log(avctx, AV_LOG_ERROR,
"Framebuffer pixel format not supported.\n");
@@ -161,7 +160,7 @@ av_cold static int fbdev_read_header(AVFormatContext *avctx,
}
st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
- st->codec->codec_id = CODEC_ID_RAWVIDEO;
+ st->codec->codec_id = AV_CODEC_ID_RAWVIDEO;
st->codec->width = fbdev->width;
st->codec->height = fbdev->height;
st->codec->pix_fmt = pix_fmt;
@@ -172,7 +171,7 @@ av_cold static int fbdev_read_header(AVFormatContext *avctx,
av_log(avctx, AV_LOG_INFO,
"w:%d h:%d bpp:%d pixfmt:%s fps:%d/%d bit_rate:%d\n",
fbdev->width, fbdev->height, fbdev->varinfo.bits_per_pixel,
- av_pix_fmt_descriptors[pix_fmt].name,
+ av_get_pix_fmt_name(pix_fmt),
fbdev->framerate_q.num, fbdev->framerate_q.den,
st->codec->bit_rate);
return 0;
@@ -234,7 +233,7 @@ static int fbdev_read_packet(AVFormatContext *avctx, AVPacket *pkt)
return fbdev->frame_size;
}
-av_cold static int fbdev_read_close(AVFormatContext *avctx)
+static av_cold int fbdev_read_close(AVFormatContext *avctx)
{
FBDevContext *fbdev = avctx->priv_data;
diff --git a/gst-libs/ext/libav/libavdevice/jack_audio.c b/gst-libs/ext/libav/libavdevice/jack_audio.c
index e68559e..280f24d 100644
--- a/gst-libs/ext/libav/libavdevice/jack_audio.c
+++ b/gst-libs/ext/libav/libavdevice/jack_audio.c
@@ -27,6 +27,7 @@
#include "libavutil/log.h"
#include "libavutil/fifo.h"
#include "libavutil/opt.h"
+#include "libavutil/time.h"
#include "libavcodec/avcodec.h"
#include "libavformat/avformat.h"
#include "libavformat/internal.h"
@@ -91,7 +92,13 @@ static int process_callback(jack_nframes_t nframes, void *arg)
/* Copy and interleave audio data from the JACK buffer into the packet */
for (i = 0; i < self->nports; i++) {
+ #if HAVE_JACK_PORT_GET_LATENCY_RANGE
+ jack_latency_range_t range;
+ jack_port_get_latency_range(self->ports[i], JackCaptureLatency, &range);
+ latency += range.max;
+ #else
latency += jack_port_get_total_latency(self->client, self->ports[i]);
+ #endif
buffer = jack_port_get_buffer(self->ports[i], self->buffer_size);
for (j = 0; j < self->buffer_size; j++)
pkt_data[j * self->nports + i] = buffer[j];
@@ -221,7 +228,7 @@ static void stop_jack(JackData *self)
ff_timefilter_destroy(self->timefilter);
}
-static int audio_read_header(AVFormatContext *context, AVFormatParameters *params)
+static int audio_read_header(AVFormatContext *context)
{
JackData *self = context->priv_data;
AVStream *stream;
@@ -238,9 +245,9 @@ static int audio_read_header(AVFormatContext *context, AVFormatParameters *param
stream->codec->codec_type = AVMEDIA_TYPE_AUDIO;
#if HAVE_BIGENDIAN
- stream->codec->codec_id = CODEC_ID_PCM_F32BE;
+ stream->codec->codec_id = AV_CODEC_ID_PCM_F32BE;
#else
- stream->codec->codec_id = CODEC_ID_PCM_F32LE;
+ stream->codec->codec_id = AV_CODEC_ID_PCM_F32LE;
#endif
stream->codec->sample_rate = self->sample_rate;
stream->codec->channels = self->nports;
@@ -315,7 +322,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), AV_OPT_TYPE_INT, { 2 }, 1, INT_MAX, AV_OPT_FLAG_DECODING_PARAM },
+ { "channels", "Number of audio channels.", OFFSET(nports), AV_OPT_TYPE_INT, { .i64 = 2 }, 1, INT_MAX, AV_OPT_FLAG_DECODING_PARAM },
{ NULL },
};
diff --git a/gst-libs/ext/libav/libavdevice/libcdio.c b/gst-libs/ext/libav/libavdevice/libcdio.c
index e00272c..06ddb4a 100644
--- a/gst-libs/ext/libav/libavdevice/libcdio.c
+++ b/gst-libs/ext/libav/libavdevice/libcdio.c
@@ -23,8 +23,15 @@
* libcdio CD grabbing
*/
+#include "config.h"
+
+#if HAVE_CDIO_PARANOIA_H
#include <cdio/cdda.h>
#include <cdio/paranoia.h>
+#elif HAVE_CDIO_PARANOIA_PARANOIA_H
+#include <cdio/paranoia/cdda.h>
+#include <cdio/paranoia/paranoia.h>
+#endif
#include "libavutil/log.h"
#include "libavutil/mem.h"
@@ -33,10 +40,8 @@
#include "libavformat/avformat.h"
#include "libavformat/internal.h"
-/* cdio returns some malloced strings that need to be free()d */
-#undef free
-
typedef struct CDIOContext {
+ AVClass *class;
cdrom_drive_t *drive;
cdrom_paranoia_t *paranoia;
int32_t last_sector;
@@ -46,7 +51,7 @@ typedef struct CDIOContext {
int paranoia_mode;
} CDIOContext;
-static av_cold int read_header(AVFormatContext *ctx, AVFormatParameters *ap)
+static av_cold int read_header(AVFormatContext *ctx)
{
CDIOContext *s = ctx->priv_data;
AVStream *st;
@@ -82,9 +87,9 @@ static av_cold int read_header(AVFormatContext *ctx, AVFormatParameters *ap)
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
if (s->drive->bigendianp)
- st->codec->codec_id = CODEC_ID_PCM_S16BE;
+ st->codec->codec_id = AV_CODEC_ID_PCM_S16BE;
else
- st->codec->codec_id = CODEC_ID_PCM_S16LE;
+ st->codec->codec_id = AV_CODEC_ID_PCM_S16LE;
st->codec->sample_rate = 44100;
st->codec->channels = 2;
if (s->drive->audio_last_sector != CDIO_INVALID_LSN &&
@@ -159,11 +164,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), 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" },
+ { "speed", "Drive reading speed.", OFFSET(speed), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, DEC },
+ { "paranoia_mode", "Error recovery mode.", OFFSET(paranoia_mode), AV_OPT_TYPE_FLAGS, { .i64 = 0 }, INT_MIN, INT_MAX, DEC, "paranoia_mode" },
+ { "verify", "Verify data integrity in overlap area", 0, AV_OPT_TYPE_CONST, { .i64 = PARANOIA_MODE_VERIFY }, 0, 0, DEC, "paranoia_mode" },
+ { "overlap", "Perform overlapped reads.", 0, AV_OPT_TYPE_CONST, { .i64 = PARANOIA_MODE_OVERLAP }, 0, 0, DEC, "paranoia_mode" },
+ { "neverskip", "Do not skip failed reads.", 0, AV_OPT_TYPE_CONST, { .i64 = PARANOIA_MODE_NEVERSKIP }, 0, 0, DEC, "paranoia_mode" },
{ NULL },
};
diff --git a/gst-libs/ext/libav/libavdevice/libdc1394.c b/gst-libs/ext/libav/libavdevice/libdc1394.c
index ac4bb09..f030e3e 100644
--- a/gst-libs/ext/libav/libavdevice/libdc1394.c
+++ b/gst-libs/ext/libav/libavdevice/libdc1394.c
@@ -48,8 +48,6 @@
#define DC1394_FRAMERATE_240 FRAMERATE_240
#endif
-#undef free
-
typedef struct dc1394_data {
AVClass *class;
#if HAVE_LIBDC1394_1
@@ -73,12 +71,12 @@ typedef struct dc1394_data {
struct dc1394_frame_format {
int width;
int height;
- enum PixelFormat pix_fmt;
+ enum AVPixelFormat pix_fmt;
int frame_size_id;
} dc1394_frame_formats[] = {
- { 320, 240, PIX_FMT_UYVY422, DC1394_VIDEO_MODE_320x240_YUV422 },
- { 640, 480, PIX_FMT_UYYVYY411, DC1394_VIDEO_MODE_640x480_YUV411 },
- { 640, 480, PIX_FMT_UYVY422, DC1394_VIDEO_MODE_640x480_YUV422 },
+ { 320, 240, AV_PIX_FMT_UYVY422, DC1394_VIDEO_MODE_320x240_YUV422 },
+ { 640, 480, AV_PIX_FMT_UYYVYY411, DC1394_VIDEO_MODE_640x480_YUV411 },
+ { 640, 480, AV_PIX_FMT_UYVY422, DC1394_VIDEO_MODE_640x480_YUV422 },
{ 0, 0, 0, 0 } /* gotta be the last one */
};
@@ -101,7 +99,7 @@ struct dc1394_frame_rate {
#define DEC AV_OPT_FLAG_DECODING_PARAM
static const AVOption options[] = {
#if HAVE_LIBDC1394_1
- { "channel", "", offsetof(dc1394_data, channel), AV_OPT_TYPE_INT, {.dbl = 0}, 0, INT_MAX, AV_OPT_FLAG_DECODING_PARAM },
+ { "channel", "", offsetof(dc1394_data, channel), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, AV_OPT_FLAG_DECODING_PARAM },
#endif
{ "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 },
@@ -117,19 +115,19 @@ static const AVClass libdc1394_class = {
};
-static inline int dc1394_read_common(AVFormatContext *c, AVFormatParameters *ap,
+static inline int dc1394_read_common(AVFormatContext *c,
struct dc1394_frame_format **select_fmt, struct dc1394_frame_rate **select_fps)
{
dc1394_data* dc1394 = c->priv_data;
AVStream* vst;
struct dc1394_frame_format *fmt;
struct dc1394_frame_rate *fps;
- enum PixelFormat pix_fmt;
+ enum AVPixelFormat pix_fmt;
int width, height;
AVRational framerate;
int ret = 0;
- if ((pix_fmt = av_get_pix_fmt(dc1394->pixel_format)) == PIX_FMT_NONE) {
+ if ((pix_fmt = av_get_pix_fmt(dc1394->pixel_format)) == AV_PIX_FMT_NONE) {
av_log(c, AV_LOG_ERROR, "No such pixel format: %s.\n", dc1394->pixel_format);
ret = AVERROR(EINVAL);
goto out;
@@ -168,7 +166,7 @@ static inline int dc1394_read_common(AVFormatContext *c, AVFormatParameters *ap,
}
avpriv_set_pts_info(vst, 64, 1, 1000);
vst->codec->codec_type = AVMEDIA_TYPE_VIDEO;
- vst->codec->codec_id = CODEC_ID_RAWVIDEO;
+ vst->codec->codec_id = AV_CODEC_ID_RAWVIDEO;
vst->codec->time_base.den = framerate.num;
vst->codec->time_base.num = framerate.den;
vst->codec->width = fmt->width;
@@ -191,7 +189,7 @@ out:
}
#if HAVE_LIBDC1394_1
-static int dc1394_v1_read_header(AVFormatContext *c, AVFormatParameters * ap)
+static int dc1394_v1_read_header(AVFormatContext *c)
{
dc1394_data* dc1394 = c->priv_data;
AVStream* vst;
@@ -200,7 +198,7 @@ static int dc1394_v1_read_header(AVFormatContext *c, AVFormatParameters * ap)
struct dc1394_frame_format *fmt = NULL;
struct dc1394_frame_rate *fps = NULL;
- if (dc1394_read_common(c,ap,&fmt,&fps) != 0)
+ if (dc1394_read_common(c, &fmt, &fps) != 0)
return -1;
/* Now let us prep the hardware. */
@@ -285,7 +283,7 @@ static int dc1394_v1_close(AVFormatContext * context)
}
#elif HAVE_LIBDC1394_2
-static int dc1394_v2_read_header(AVFormatContext *c, AVFormatParameters * ap)
+static int dc1394_v2_read_header(AVFormatContext *c)
{
dc1394_data* dc1394 = c->priv_data;
dc1394camera_list_t *list;
@@ -293,7 +291,7 @@ static int dc1394_v2_read_header(AVFormatContext *c, AVFormatParameters * ap)
struct dc1394_frame_format *fmt = NULL;
struct dc1394_frame_rate *fps = NULL;
- if (dc1394_read_common(c,ap,&fmt,&fps) != 0)
+ if (dc1394_read_common(c, &fmt, &fps) != 0)
return -1;
/* Now let us prep the hardware. */
diff --git a/gst-libs/ext/libav/libavdevice/oss_audio.c b/gst-libs/ext/libav/libavdevice/oss_audio.c
index 308fc0d..e3b9d67 100644
--- a/gst-libs/ext/libav/libavdevice/oss_audio.c
+++ b/gst-libs/ext/libav/libavdevice/oss_audio.c
@@ -33,11 +33,10 @@
#include <unistd.h>
#include <fcntl.h>
#include <sys/ioctl.h>
-#include <sys/time.h>
-#include <sys/select.h>
#include "libavutil/log.h"
#include "libavutil/opt.h"
+#include "libavutil/time.h"
#include "libavcodec/avcodec.h"
#include "libavformat/avformat.h"
#include "libavformat/internal.h"
@@ -50,7 +49,7 @@ typedef struct {
int sample_rate;
int channels;
int frame_size; /* in bytes ! */
- enum CodecID codec_id;
+ enum AVCodecID codec_id;
unsigned int flip_left : 1;
uint8_t buffer[AUDIO_BLOCK_SIZE];
int buffer_ptr;
@@ -105,10 +104,10 @@ static int audio_open(AVFormatContext *s1, int is_output, const char *audio_devi
switch(tmp) {
case AFMT_S16_LE:
- s->codec_id = CODEC_ID_PCM_S16LE;
+ s->codec_id = AV_CODEC_ID_PCM_S16LE;
break;
case AFMT_S16_BE:
- s->codec_id = CODEC_ID_PCM_S16BE;
+ s->codec_id = AV_CODEC_ID_PCM_S16BE;
break;
default:
av_log(s1, AV_LOG_ERROR, "Soundcard does not support 16 bit sample format\n");
@@ -204,7 +203,7 @@ static int audio_write_trailer(AVFormatContext *s1)
/* grab support */
-static int audio_read_header(AVFormatContext *s1, AVFormatParameters *ap)
+static int audio_read_header(AVFormatContext *s1)
{
AudioData *s = s1->priv_data;
AVStream *st;
@@ -283,8 +282,8 @@ static int audio_read_close(AVFormatContext *s1)
#if CONFIG_OSS_INDEV
static const AVOption options[] = {
- { "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 },
+ { "sample_rate", "", offsetof(AudioData, sample_rate), AV_OPT_TYPE_INT, {.i64 = 48000}, 1, INT_MAX, AV_OPT_FLAG_DECODING_PARAM },
+ { "channels", "", offsetof(AudioData, channels), AV_OPT_TYPE_INT, {.i64 = 2}, 1, INT_MAX, AV_OPT_FLAG_DECODING_PARAM },
{ NULL },
};
@@ -297,7 +296,7 @@ static const AVClass oss_demuxer_class = {
AVInputFormat ff_oss_demuxer = {
.name = "oss",
- .long_name = NULL_IF_CONFIG_SMALL("Open Sound System capture"),
+ .long_name = NULL_IF_CONFIG_SMALL("OSS (Open Sound System) capture"),
.priv_data_size = sizeof(AudioData),
.read_header = audio_read_header,
.read_packet = audio_read_packet,
@@ -310,13 +309,13 @@ AVInputFormat ff_oss_demuxer = {
#if CONFIG_OSS_OUTDEV
AVOutputFormat ff_oss_muxer = {
.name = "oss",
- .long_name = NULL_IF_CONFIG_SMALL("Open Sound System playback"),
+ .long_name = NULL_IF_CONFIG_SMALL("OSS (Open Sound System) playback"),
.priv_data_size = sizeof(AudioData),
/* XXX: we make the assumption that the soundcard accepts this format */
/* XXX: find better solution with "preinit" method, needed also in
other formats */
- .audio_codec = AV_NE(CODEC_ID_PCM_S16BE, CODEC_ID_PCM_S16LE),
- .video_codec = CODEC_ID_NONE,
+ .audio_codec = AV_NE(AV_CODEC_ID_PCM_S16BE, AV_CODEC_ID_PCM_S16LE),
+ .video_codec = AV_CODEC_ID_NONE,
.write_header = audio_write_header,
.write_packet = audio_write_packet,
.write_trailer = audio_write_trailer,
diff --git a/gst-libs/ext/libav/libavdevice/pulse.c b/gst-libs/ext/libav/libavdevice/pulse.c
index bffe391..a8e710d 100644
--- a/gst-libs/ext/libav/libavdevice/pulse.c
+++ b/gst-libs/ext/libav/libavdevice/pulse.c
@@ -33,7 +33,7 @@
#include "libavformat/internal.h"
#include "libavutil/opt.h"
-#define DEFAULT_CODEC_ID AV_NE(CODEC_ID_PCM_S16BE, CODEC_ID_PCM_S16LE)
+#define DEFAULT_CODEC_ID AV_NE(AV_CODEC_ID_PCM_S16BE, AV_CODEC_ID_PCM_S16LE)
typedef struct PulseData {
AVClass *class;
@@ -51,30 +51,29 @@ typedef struct PulseData {
static pa_sample_format_t codec_id_to_pulse_format(int codec_id) {
switch (codec_id) {
- case CODEC_ID_PCM_U8: return PA_SAMPLE_U8;
- case CODEC_ID_PCM_ALAW: return PA_SAMPLE_ALAW;
- case CODEC_ID_PCM_MULAW: return PA_SAMPLE_ULAW;
- case CODEC_ID_PCM_S16LE: return PA_SAMPLE_S16LE;
- case CODEC_ID_PCM_S16BE: return PA_SAMPLE_S16BE;
- case CODEC_ID_PCM_F32LE: return PA_SAMPLE_FLOAT32LE;
- case CODEC_ID_PCM_F32BE: return PA_SAMPLE_FLOAT32BE;
- case CODEC_ID_PCM_S32LE: return PA_SAMPLE_S32LE;
- case CODEC_ID_PCM_S32BE: return PA_SAMPLE_S32BE;
- case CODEC_ID_PCM_S24LE: return PA_SAMPLE_S24LE;
- case CODEC_ID_PCM_S24BE: return PA_SAMPLE_S24BE;
+ case AV_CODEC_ID_PCM_U8: return PA_SAMPLE_U8;
+ case AV_CODEC_ID_PCM_ALAW: return PA_SAMPLE_ALAW;
+ case AV_CODEC_ID_PCM_MULAW: return PA_SAMPLE_ULAW;
+ case AV_CODEC_ID_PCM_S16LE: return PA_SAMPLE_S16LE;
+ case AV_CODEC_ID_PCM_S16BE: return PA_SAMPLE_S16BE;
+ case AV_CODEC_ID_PCM_F32LE: return PA_SAMPLE_FLOAT32LE;
+ case AV_CODEC_ID_PCM_F32BE: return PA_SAMPLE_FLOAT32BE;
+ case AV_CODEC_ID_PCM_S32LE: return PA_SAMPLE_S32LE;
+ case AV_CODEC_ID_PCM_S32BE: return PA_SAMPLE_S32BE;
+ case AV_CODEC_ID_PCM_S24LE: return PA_SAMPLE_S24LE;
+ case AV_CODEC_ID_PCM_S24BE: return PA_SAMPLE_S24BE;
default: return PA_SAMPLE_INVALID;
}
}
-static av_cold int pulse_read_header(AVFormatContext *s,
- AVFormatParameters *ap)
+static av_cold int pulse_read_header(AVFormatContext *s)
{
PulseData *pd = s->priv_data;
AVStream *st;
char *device = NULL;
int ret;
- enum CodecID codec_id =
- s->audio_codec_id == CODEC_ID_NONE ? DEFAULT_CODEC_ID : s->audio_codec_id;
+ enum AVCodecID codec_id =
+ s->audio_codec_id == AV_CODEC_ID_NONE ? DEFAULT_CODEC_ID : s->audio_codec_id;
const pa_sample_spec ss = { codec_id_to_pulse_format(codec_id),
pd->sample_rate,
pd->channels };
@@ -165,10 +164,10 @@ static const AVOption options[] = {
{ "server", "pulse server name", OFFSET(server), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, D },
{ "name", "application name", OFFSET(name), AV_OPT_TYPE_STRING, {.str = "libav"}, 0, 0, D },
{ "stream_name", "stream description", OFFSET(stream_name), AV_OPT_TYPE_STRING, {.str = "record"}, 0, 0, D },
- { "sample_rate", "sample rate in Hz", OFFSET(sample_rate), AV_OPT_TYPE_INT, {.dbl = 48000}, 1, INT_MAX, D },
- { "channels", "number of audio channels", OFFSET(channels), AV_OPT_TYPE_INT, {.dbl = 2}, 1, INT_MAX, D },
- { "frame_size", "number of bytes per frame", OFFSET(frame_size), AV_OPT_TYPE_INT, {.dbl = 1024}, 1, INT_MAX, D },
- { "fragment_size", "buffering size, affects latency and cpu usage", OFFSET(fragment_size), AV_OPT_TYPE_INT, {.dbl = -1}, -1, INT_MAX, D },
+ { "sample_rate", "sample rate in Hz", OFFSET(sample_rate), AV_OPT_TYPE_INT, {.i64 = 48000}, 1, INT_MAX, D },
+ { "channels", "number of audio channels", OFFSET(channels), AV_OPT_TYPE_INT, {.i64 = 2}, 1, INT_MAX, D },
+ { "frame_size", "number of bytes per frame", OFFSET(frame_size), AV_OPT_TYPE_INT, {.i64 = 1024}, 1, INT_MAX, D },
+ { "fragment_size", "buffering size, affects latency and cpu usage", OFFSET(fragment_size), AV_OPT_TYPE_INT, {.i64 = -1}, -1, INT_MAX, D },
{ NULL },
};
diff --git a/gst-libs/ext/libav/libavdevice/sndio_common.c b/gst-libs/ext/libav/libavdevice/sndio_common.c
index 56c37c7..1bea6c5 100644
--- a/gst-libs/ext/libav/libavdevice/sndio_common.c
+++ b/gst-libs/ext/libav/libavdevice/sndio_common.c
@@ -84,7 +84,7 @@ av_cold int ff_sndio_open(AVFormatContext *s1, int is_output,
}
}
- s->codec_id = par.le ? CODEC_ID_PCM_S16LE : CODEC_ID_PCM_S16BE;
+ s->codec_id = par.le ? AV_CODEC_ID_PCM_S16LE : AV_CODEC_ID_PCM_S16BE;
s->channels = is_output ? par.pchan : par.rchan;
s->sample_rate = par.rate;
s->bps = par.bps;
diff --git a/gst-libs/ext/libav/libavdevice/sndio_common.h b/gst-libs/ext/libav/libavdevice/sndio_common.h
index e23b96d..2f70213 100644
--- a/gst-libs/ext/libav/libavdevice/sndio_common.h
+++ b/gst-libs/ext/libav/libavdevice/sndio_common.h
@@ -28,10 +28,10 @@
#include "libavformat/avformat.h"
#include "libavutil/log.h"
-typedef struct {
+typedef struct SndioData {
AVClass *class;
struct sio_hdl *hdl;
- enum CodecID codec_id;
+ enum AVCodecID codec_id;
int64_t hwpos;
int64_t softpos;
uint8_t *buffer;
diff --git a/gst-libs/ext/libav/libavdevice/sndio_dec.c b/gst-libs/ext/libav/libavdevice/sndio_dec.c
index cc74c38..a29a088 100644
--- a/gst-libs/ext/libav/libavdevice/sndio_dec.c
+++ b/gst-libs/ext/libav/libavdevice/sndio_dec.c
@@ -28,8 +28,7 @@
#include "sndio_common.h"
-static av_cold int audio_read_header(AVFormatContext *s1,
- AVFormatParameters *ap)
+static av_cold int audio_read_header(AVFormatContext *s1)
{
SndioData *s = s1->priv_data;
AVStream *st;
@@ -94,8 +93,8 @@ static av_cold int audio_read_close(AVFormatContext *s1)
}
static const AVOption options[] = {
- { "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 },
+ { "sample_rate", "", offsetof(SndioData, sample_rate), AV_OPT_TYPE_INT, {.i64 = 48000}, 1, INT_MAX, AV_OPT_FLAG_DECODING_PARAM },
+ { "channels", "", offsetof(SndioData, channels), AV_OPT_TYPE_INT, {.i64 = 2}, 1, INT_MAX, AV_OPT_FLAG_DECODING_PARAM },
{ NULL },
};
diff --git a/gst-libs/ext/libav/libavdevice/sndio_enc.c b/gst-libs/ext/libav/libavdevice/sndio_enc.c
index 49a52b3..6f69b9e 100644
--- a/gst-libs/ext/libav/libavdevice/sndio_enc.c
+++ b/gst-libs/ext/libav/libavdevice/sndio_enc.c
@@ -84,8 +84,8 @@ AVOutputFormat ff_sndio_muxer = {
/* XXX: we make the assumption that the soundcard accepts this format */
/* XXX: find better solution with "preinit" method, needed also in
other formats */
- .audio_codec = AV_NE(CODEC_ID_PCM_S16BE, CODEC_ID_PCM_S16LE),
- .video_codec = CODEC_ID_NONE,
+ .audio_codec = AV_NE(AV_CODEC_ID_PCM_S16BE, AV_CODEC_ID_PCM_S16LE),
+ .video_codec = AV_CODEC_ID_NONE,
.write_header = audio_write_header,
.write_packet = audio_write_packet,
.write_trailer = audio_write_trailer,
diff --git a/gst-libs/ext/libav/libavdevice/timefilter.c b/gst-libs/ext/libav/libavdevice/timefilter.c
index 136661a..8b98d33 100644
--- a/gst-libs/ext/libav/libavdevice/timefilter.c
+++ b/gst-libs/ext/libav/libavdevice/timefilter.c
@@ -22,14 +22,14 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-
+#include "libavutil/common.h"
+#include "libavutil/mem.h"
#include "config.h"
#include "timefilter.h"
-#include "libavutil/mem.h"
struct TimeFilter {
- /// Delay Locked Loop data. These variables refer to mathematical
- /// concepts described in: http://www.kokkinizita.net/papers/usingdll.pdf
+ // Delay Locked Loop data. These variables refer to mathematical
+ // concepts described in: http://www.kokkinizita.net/papers/usingdll.pdf
double cycle_time;
double feedback2_factor;
double feedback3_factor;
@@ -37,12 +37,14 @@ struct TimeFilter {
int count;
};
-TimeFilter * ff_timefilter_new(double clock_period, double feedback2_factor, double feedback3_factor)
+TimeFilter *ff_timefilter_new(double clock_period,
+ double feedback2_factor,
+ double feedback3_factor)
{
- TimeFilter *self = av_mallocz(sizeof(TimeFilter));
- self->clock_period = clock_period;
- self->feedback2_factor = feedback2_factor;
- self->feedback3_factor = feedback3_factor;
+ TimeFilter *self = av_mallocz(sizeof(TimeFilter));
+ self->clock_period = clock_period;
+ self->feedback2_factor = feedback2_factor;
+ self->feedback3_factor = feedback3_factor;
return self;
}
@@ -53,22 +55,19 @@ void ff_timefilter_destroy(TimeFilter *self)
void ff_timefilter_reset(TimeFilter *self)
{
- self->count = 0;
+ self->count = 0;
}
double ff_timefilter_update(TimeFilter *self, double system_time, double period)
{
self->count++;
- if (self->count==1) {
- /// init loop
- self->cycle_time = system_time;
+ if (self->count == 1) {
+ self->cycle_time = system_time;
} else {
double loop_error;
- self->cycle_time += self->clock_period * period;
- /// calculate loop error
- loop_error = system_time - self->cycle_time;
+ self->cycle_time += self->clock_period * period;
+ loop_error = system_time - self->cycle_time;
- /// update loop
self->cycle_time += FFMAX(self->feedback2_factor, 1.0 / self->count) * loop_error;
self->clock_period += self->feedback3_factor * loop_error / period;
}
@@ -79,65 +78,57 @@ double ff_timefilter_update(TimeFilter *self, double system_time, double period)
#include "libavutil/lfg.h"
#define LFG_MAX ((1LL << 32) - 1)
-#undef printf
-
int main(void)
{
AVLFG prng;
- double n0,n1;
+ double n0, n1;
#define SAMPLES 1000
double ideal[SAMPLES];
double samples[SAMPLES];
-#if 1
- for(n0= 0; n0<40; n0=2*n0+1){
- for(n1= 0; n1<10; n1=2*n1+1){
-#else
- {{
- n0=7;
- n1=1;
-#endif
- double best_error= 1000000000;
- double bestpar0=1;
- double bestpar1=0.001;
+ for (n0 = 0; n0 < 40; n0 = 2 * n0 + 1) {
+ for (n1 = 0; n1 < 10; n1 = 2 * n1 + 1) {
+ double best_error = 1000000000;
+ double bestpar0 = 1;
+ double bestpar1 = 0.001;
int better, i;
av_lfg_init(&prng, 123);
- for(i=0; i<SAMPLES; i++){
- ideal[i] = 10 + i + n1*i/(1000);
- samples[i] = ideal[i] + n0 * (av_lfg_get(&prng) - LFG_MAX / 2)
- / (LFG_MAX * 10LL);
+ for (i = 0; i < SAMPLES; i++) {
+ ideal[i] = 10 + i + n1 * i / (1000);
+ samples[i] = ideal[i] + n0 * (av_lfg_get(&prng) - LFG_MAX / 2) / (LFG_MAX * 10LL);
}
- do{
+ do {
double par0, par1;
- better=0;
- for(par0= bestpar0*0.8; par0<=bestpar0*1.21; par0+=bestpar0*0.05){
- for(par1= bestpar1*0.8; par1<=bestpar1*1.21; par1+=bestpar1*0.05){
- double error=0;
- TimeFilter *tf= ff_timefilter_new(1, par0, par1);
- for(i=0; i<SAMPLES; i++){
+ better = 0;
+ for (par0 = bestpar0 * 0.8; par0 <= bestpar0 * 1.21; par0 += bestpar0 * 0.05) {
+ for (par1 = bestpar1 * 0.8; par1 <= bestpar1 * 1.21; par1 += bestpar1 * 0.05) {
+ double error = 0;
+ TimeFilter *tf = ff_timefilter_new(1, par0, par1);
+ for (i = 0; i < SAMPLES; i++) {
double filtered;
- filtered= ff_timefilter_update(tf, samples[i], 1);
- error += (filtered - ideal[i]) * (filtered - ideal[i]);
+ filtered = ff_timefilter_update(tf, samples[i], 1);
+ error += (filtered - ideal[i]) * (filtered - ideal[i]);
}
ff_timefilter_destroy(tf);
- if(error < best_error){
- best_error= error;
- bestpar0= par0;
- bestpar1= par1;
- better=1;
+ if (error < best_error) {
+ best_error = error;
+ bestpar0 = par0;
+ bestpar1 = par1;
+ better = 1;
}
}
}
- }while(better);
+ } while (better);
#if 0
- double lastfil=9;
- TimeFilter *tf= ff_timefilter_new(1, bestpar0, bestpar1);
- for(i=0; i<SAMPLES; i++){
+ double lastfil = 9;
+ TimeFilter *tf = ff_timefilter_new(1, bestpar0, bestpar1);
+ for (i = 0; i < SAMPLES; i++) {
double filtered;
- filtered= ff_timefilter_update(tf, samples[i], 1);
- printf("%f %f %f %f\n", i - samples[i] + 10, filtered - samples[i], samples[FFMAX(i, 1)] - samples[FFMAX(i-1, 0)], filtered - lastfil);
- lastfil= filtered;
+ filtered = ff_timefilter_update(tf, samples[i], 1);
+ printf("%f %f %f %f\n", i - samples[i] + 10, filtered - samples[i],
+ samples[FFMAX(i, 1)] - samples[FFMAX(i - 1, 0)], filtered - lastfil);
+ lastfil = filtered;
}
ff_timefilter_destroy(tf);
#else
diff --git a/gst-libs/ext/libav/libavdevice/v4l.c b/gst-libs/ext/libav/libavdevice/v4l.c
deleted file mode 100644
index bdfee2d..0000000
--- a/gst-libs/ext/libav/libavdevice/v4l.c
+++ /dev/null
@@ -1,366 +0,0 @@
-/*
- * Linux video grab interface
- * Copyright (c) 2000,2001 Fabrice Bellard
- *
- * 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
- */
-
-#include "avdevice.h"
-
-#if FF_API_V4L
-
-#undef __STRICT_ANSI__ //workaround due to broken kernel headers
-#include "config.h"
-#include "libavutil/rational.h"
-#include "libavutil/imgutils.h"
-#include "libavutil/log.h"
-#include "libavutil/opt.h"
-#include "libavformat/avformat.h"
-#include "libavformat/internal.h"
-#include "libavcodec/dsputil.h"
-#include <unistd.h>
-#include <fcntl.h>
-#include <sys/ioctl.h>
-#include <sys/mman.h>
-#include <sys/time.h>
-#define _LINUX_TIME_H 1
-#include <linux/videodev.h>
-#include <time.h>
-
-typedef struct {
- AVClass *class;
- int fd;
- int frame_format; /* see VIDEO_PALETTE_xxx */
- int use_mmap;
- AVRational time_base;
- int64_t time_frame;
- int frame_size;
- struct video_capability video_cap;
- struct video_audio audio_saved;
- struct video_window video_win;
- uint8_t *video_buf;
- struct video_mbuf gb_buffers;
- struct video_mmap gb_buf;
- int gb_frame;
- int standard;
-} VideoData;
-
-static const struct {
- int palette;
- int depth;
- enum PixelFormat pix_fmt;
-} video_formats [] = {
- {.palette = VIDEO_PALETTE_YUV420P, .depth = 12, .pix_fmt = PIX_FMT_YUV420P },
- {.palette = VIDEO_PALETTE_YUV422, .depth = 16, .pix_fmt = PIX_FMT_YUYV422 },
- {.palette = VIDEO_PALETTE_UYVY, .depth = 16, .pix_fmt = PIX_FMT_UYVY422 },
- {.palette = VIDEO_PALETTE_YUYV, .depth = 16, .pix_fmt = PIX_FMT_YUYV422 },
- /* NOTE: v4l uses BGR24, not RGB24 */
- {.palette = VIDEO_PALETTE_RGB24, .depth = 24, .pix_fmt = PIX_FMT_BGR24 },
- {.palette = VIDEO_PALETTE_RGB565, .depth = 16, .pix_fmt = PIX_FMT_BGR565 },
- {.palette = VIDEO_PALETTE_GREY, .depth = 8, .pix_fmt = PIX_FMT_GRAY8 },
-};
-
-
-static int grab_read_header(AVFormatContext *s1, AVFormatParameters *ap)
-{
- VideoData *s = s1->priv_data;
- AVStream *st;
- int video_fd;
- int desired_palette, desired_depth;
- struct video_tuner tuner;
- struct video_audio audio;
- struct video_picture pict;
- int j;
- int vformat_num = FF_ARRAY_ELEMS(video_formats);
-
- av_log(s1, AV_LOG_WARNING, "V4L input device is deprecated and will be removed in the next release.");
-
- if (ap->time_base.den <= 0) {
- av_log(s1, AV_LOG_ERROR, "Wrong time base (%d)\n", ap->time_base.den);
- return -1;
- }
- s->time_base = ap->time_base;
-
- s->video_win.width = ap->width;
- s->video_win.height = ap->height;
-
- st = avformat_new_stream(s1, NULL);
- if (!st)
- return AVERROR(ENOMEM);
- avpriv_set_pts_info(st, 64, 1, 1000000); /* 64 bits pts in us */
-
- video_fd = open(s1->filename, O_RDWR);
- if (video_fd < 0) {
- av_log(s1, AV_LOG_ERROR, "%s: %s\n", s1->filename, strerror(errno));
- goto fail;
- }
-
- if (ioctl(video_fd, VIDIOCGCAP, &s->video_cap) < 0) {
- av_log(s1, AV_LOG_ERROR, "VIDIOCGCAP: %s\n", strerror(errno));
- goto fail;
- }
-
- if (!(s->video_cap.type & VID_TYPE_CAPTURE)) {
- av_log(s1, AV_LOG_ERROR, "Fatal: grab device does not handle capture\n");
- goto fail;
- }
-
- /* no values set, autodetect them */
- if (s->video_win.width <= 0 || s->video_win.height <= 0) {
- if (ioctl(video_fd, VIDIOCGWIN, &s->video_win, sizeof(s->video_win)) < 0) {
- av_log(s1, AV_LOG_ERROR, "VIDIOCGWIN: %s\n", strerror(errno));
- goto fail;
- }
- }
-
- if(av_image_check_size(s->video_win.width, s->video_win.height, 0, s1) < 0)
- return -1;
-
- desired_palette = -1;
- desired_depth = -1;
- for (j = 0; j < vformat_num; j++) {
- if (ap->pix_fmt == video_formats[j].pix_fmt) {
- desired_palette = video_formats[j].palette;
- desired_depth = video_formats[j].depth;
- break;
- }
- }
-
- /* set tv standard */
- if (!ioctl(video_fd, VIDIOCGTUNER, &tuner)) {
- tuner.mode = s->standard;
- ioctl(video_fd, VIDIOCSTUNER, &tuner);
- }
-
- /* unmute audio */
- audio.audio = 0;
- ioctl(video_fd, VIDIOCGAUDIO, &audio);
- memcpy(&s->audio_saved, &audio, sizeof(audio));
- audio.flags &= ~VIDEO_AUDIO_MUTE;
- ioctl(video_fd, VIDIOCSAUDIO, &audio);
-
- ioctl(video_fd, VIDIOCGPICT, &pict);
- av_dlog(s1, "v4l: colour=%d hue=%d brightness=%d constrast=%d whiteness=%d\n",
- pict.colour, pict.hue, pict.brightness, pict.contrast, pict.whiteness);
- /* try to choose a suitable video format */
- pict.palette = desired_palette;
- pict.depth= desired_depth;
- if (desired_palette == -1 || ioctl(video_fd, VIDIOCSPICT, &pict) < 0) {
- for (j = 0; j < vformat_num; j++) {
- pict.palette = video_formats[j].palette;
- pict.depth = video_formats[j].depth;
- if (-1 != ioctl(video_fd, VIDIOCSPICT, &pict))
- break;
- }
- if (j >= vformat_num)
- goto fail1;
- }
-
- if (ioctl(video_fd, VIDIOCGMBUF, &s->gb_buffers) < 0) {
- /* try to use read based access */
- int val;
-
- s->video_win.x = 0;
- s->video_win.y = 0;
- s->video_win.chromakey = -1;
- s->video_win.flags = 0;
-
- if (ioctl(video_fd, VIDIOCSWIN, s->video_win) < 0) {
- av_log(s1, AV_LOG_ERROR, "VIDIOCSWIN: %s\n", strerror(errno));
- goto fail;
- }
-
- s->frame_format = pict.palette;
-
- val = 1;
- if (ioctl(video_fd, VIDIOCCAPTURE, &val) < 0) {
- av_log(s1, AV_LOG_ERROR, "VIDIOCCAPTURE: %s\n", strerror(errno));
- goto fail;
- }
-
- s->time_frame = av_gettime() * s->time_base.den / s->time_base.num;
- s->use_mmap = 0;
- } else {
- s->video_buf = mmap(0, s->gb_buffers.size, PROT_READ|PROT_WRITE, MAP_SHARED, video_fd, 0);
- if ((unsigned char*)-1 == s->video_buf) {
- s->video_buf = mmap(0, s->gb_buffers.size, PROT_READ|PROT_WRITE, MAP_PRIVATE, video_fd, 0);
- if ((unsigned char*)-1 == s->video_buf) {
- av_log(s1, AV_LOG_ERROR, "mmap: %s\n", strerror(errno));
- goto fail;
- }
- }
- s->gb_frame = 0;
- s->time_frame = av_gettime() * s->time_base.den / s->time_base.num;
-
- /* start to grab the first frame */
- s->gb_buf.frame = s->gb_frame % s->gb_buffers.frames;
- s->gb_buf.height = s->video_win.height;
- s->gb_buf.width = s->video_win.width;
- s->gb_buf.format = pict.palette;
-
- if (ioctl(video_fd, VIDIOCMCAPTURE, &s->gb_buf) < 0) {
- if (errno != EAGAIN) {
- fail1:
- av_log(s1, AV_LOG_ERROR, "VIDIOCMCAPTURE: %s\n", strerror(errno));
- } else {
- av_log(s1, AV_LOG_ERROR, "Fatal: grab device does not receive any video signal\n");
- }
- goto fail;
- }
- for (j = 1; j < s->gb_buffers.frames; j++) {
- s->gb_buf.frame = j;
- ioctl(video_fd, VIDIOCMCAPTURE, &s->gb_buf);
- }
- s->frame_format = s->gb_buf.format;
- s->use_mmap = 1;
- }
-
- for (j = 0; j < vformat_num; j++) {
- if (s->frame_format == video_formats[j].palette) {
- s->frame_size = s->video_win.width * s->video_win.height * video_formats[j].depth / 8;
- st->codec->pix_fmt = video_formats[j].pix_fmt;
- break;
- }
- }
-
- if (j >= vformat_num)
- goto fail;
-
- s->fd = video_fd;
-
- st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
- st->codec->codec_id = CODEC_ID_RAWVIDEO;
- st->codec->width = s->video_win.width;
- st->codec->height = s->video_win.height;
- st->codec->time_base = s->time_base;
- st->codec->bit_rate = s->frame_size * 1/av_q2d(st->codec->time_base) * 8;
-
- return 0;
- fail:
- if (video_fd >= 0)
- close(video_fd);
- return AVERROR(EIO);
-}
-
-static int v4l_mm_read_picture(VideoData *s, uint8_t *buf)
-{
- uint8_t *ptr;
-
- while (ioctl(s->fd, VIDIOCSYNC, &s->gb_frame) < 0 &&
- (errno == EAGAIN || errno == EINTR));
-
- ptr = s->video_buf + s->gb_buffers.offsets[s->gb_frame];
- memcpy(buf, ptr, s->frame_size);
-
- /* Setup to capture the next frame */
- s->gb_buf.frame = s->gb_frame;
- if (ioctl(s->fd, VIDIOCMCAPTURE, &s->gb_buf) < 0) {
- if (errno == EAGAIN)
- av_log(NULL, AV_LOG_ERROR, "Cannot Sync\n");
- else
- av_log(NULL, AV_LOG_ERROR, "VIDIOCMCAPTURE: %s\n", strerror(errno));
- return AVERROR(EIO);
- }
-
- /* This is now the grabbing frame */
- s->gb_frame = (s->gb_frame + 1) % s->gb_buffers.frames;
-
- return s->frame_size;
-}
-
-static int grab_read_packet(AVFormatContext *s1, AVPacket *pkt)
-{
- VideoData *s = s1->priv_data;
- int64_t curtime, delay;
- struct timespec ts;
-
- /* Calculate the time of the next frame */
- s->time_frame += INT64_C(1000000);
-
- /* wait based on the frame rate */
- for(;;) {
- curtime = av_gettime();
- delay = s->time_frame * s->time_base.num / s->time_base.den - curtime;
- if (delay <= 0) {
- if (delay < INT64_C(-1000000) * s->time_base.num / s->time_base.den) {
- /* printf("grabbing is %d frames late (dropping)\n", (int) -(delay / 16666)); */
- s->time_frame += INT64_C(1000000);
- }
- break;
- }
- ts.tv_sec = delay / 1000000;
- ts.tv_nsec = (delay % 1000000) * 1000;
- nanosleep(&ts, NULL);
- }
-
- if (av_new_packet(pkt, s->frame_size) < 0)
- return AVERROR(EIO);
-
- pkt->pts = curtime;
-
- /* read one frame */
- if (s->use_mmap) {
- return v4l_mm_read_picture(s, pkt->data);
- } else {
- if (read(s->fd, pkt->data, pkt->size) != pkt->size)
- return AVERROR(EIO);
- return s->frame_size;
- }
-}
-
-static int grab_read_close(AVFormatContext *s1)
-{
- VideoData *s = s1->priv_data;
-
- if (s->use_mmap)
- munmap(s->video_buf, s->gb_buffers.size);
-
- /* mute audio. we must force it because the BTTV driver does not
- return its state correctly */
- s->audio_saved.flags |= VIDEO_AUDIO_MUTE;
- ioctl(s->fd, VIDIOCSAUDIO, &s->audio_saved);
-
- close(s->fd);
- return 0;
-}
-
-static const AVOption options[] = {
- { "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 },
-};
-
-static const AVClass v4l_class = {
- .class_name = "V4L indev",
- .item_name = av_default_item_name,
- .option = options,
- .version = LIBAVUTIL_VERSION_INT,
-};
-
-AVInputFormat ff_v4l_demuxer = {
- .name = "video4linux",
- .long_name = NULL_IF_CONFIG_SMALL("Video4Linux device grab"),
- .priv_data_size = sizeof(VideoData),
- .read_header = grab_read_header,
- .read_packet = grab_read_packet,
- .read_close = grab_read_close,
- .flags = AVFMT_NOFILE,
- .priv_class = &v4l_class,
-};
-#endif /* FF_API_V4L */
diff --git a/gst-libs/ext/libav/libavdevice/v4l2.c b/gst-libs/ext/libav/libavdevice/v4l2.c
index 191decd..9e71f1d 100644
--- a/gst-libs/ext/libav/libavdevice/v4l2.c
+++ b/gst-libs/ext/libav/libavdevice/v4l2.c
@@ -7,7 +7,7 @@
* (http://v4l2spec.bytesex.org/v4l2spec/capture.c)
*
* Thanks to Michael Niedermayer for providing the mapping between
- * V4L2_PIX_FMT_* and PIX_FMT_*
+ * V4L2_PIX_FMT_* and AV_PIX_FMT_*
*
*
* This file is part of Libav.
@@ -42,7 +42,6 @@
#else
#include <linux/videodev2.h>
#endif
-#include <time.h>
#include "libavutil/imgutils.h"
#include "libavutil/log.h"
#include "libavutil/opt.h"
@@ -85,28 +84,28 @@ struct buff_data {
};
struct fmt_map {
- enum PixelFormat ff_fmt;
- enum CodecID codec_id;
+ enum AVPixelFormat ff_fmt;
+ enum AVCodecID codec_id;
uint32_t v4l2_fmt;
};
static struct fmt_map fmt_conversion_table[] = {
//ff_fmt codec_id v4l2_fmt
- { PIX_FMT_YUV420P, CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_YUV420 },
- { PIX_FMT_YUV422P, CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_YUV422P },
- { PIX_FMT_YUYV422, CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_YUYV },
- { PIX_FMT_UYVY422, CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_UYVY },
- { PIX_FMT_YUV411P, CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_YUV411P },
- { PIX_FMT_YUV410P, CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_YUV410 },
- { PIX_FMT_RGB555, CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_RGB555 },
- { PIX_FMT_RGB565, CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_RGB565 },
- { PIX_FMT_BGR24, CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_BGR24 },
- { PIX_FMT_RGB24, CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_RGB24 },
- { PIX_FMT_BGRA, CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_BGR32 },
- { PIX_FMT_GRAY8, CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_GREY },
- { PIX_FMT_NV12, CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_NV12 },
- { PIX_FMT_NONE, CODEC_ID_MJPEG, V4L2_PIX_FMT_MJPEG },
- { PIX_FMT_NONE, CODEC_ID_MJPEG, V4L2_PIX_FMT_JPEG },
+ { AV_PIX_FMT_YUV420P, AV_CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_YUV420 },
+ { AV_PIX_FMT_YUV422P, AV_CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_YUV422P },
+ { AV_PIX_FMT_YUYV422, AV_CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_YUYV },
+ { AV_PIX_FMT_UYVY422, AV_CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_UYVY },
+ { AV_PIX_FMT_YUV411P, AV_CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_YUV411P },
+ { AV_PIX_FMT_YUV410P, AV_CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_YUV410 },
+ { AV_PIX_FMT_RGB555, AV_CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_RGB555 },
+ { AV_PIX_FMT_RGB565, AV_CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_RGB565 },
+ { AV_PIX_FMT_BGR24, AV_CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_BGR24 },
+ { AV_PIX_FMT_RGB24, AV_CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_RGB24 },
+ { AV_PIX_FMT_BGRA, AV_CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_BGR32 },
+ { AV_PIX_FMT_GRAY8, AV_CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_GREY },
+ { AV_PIX_FMT_NV12, AV_CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_NV12 },
+ { AV_PIX_FMT_NONE, AV_CODEC_ID_MJPEG, V4L2_PIX_FMT_MJPEG },
+ { AV_PIX_FMT_NONE, AV_CODEC_ID_MJPEG, V4L2_PIX_FMT_JPEG },
};
static int device_open(AVFormatContext *ctx)
@@ -221,14 +220,14 @@ static int first_field(int fd)
return 1;
}
-static uint32_t fmt_ff2v4l(enum PixelFormat pix_fmt, enum CodecID codec_id)
+static uint32_t fmt_ff2v4l(enum AVPixelFormat pix_fmt, enum AVCodecID codec_id)
{
int i;
for (i = 0; i < FF_ARRAY_ELEMS(fmt_conversion_table); i++) {
- if ((codec_id == CODEC_ID_NONE ||
+ if ((codec_id == AV_CODEC_ID_NONE ||
fmt_conversion_table[i].codec_id == codec_id) &&
- (pix_fmt == PIX_FMT_NONE ||
+ (pix_fmt == AV_PIX_FMT_NONE ||
fmt_conversion_table[i].ff_fmt == pix_fmt)) {
return fmt_conversion_table[i].v4l2_fmt;
}
@@ -237,7 +236,7 @@ static uint32_t fmt_ff2v4l(enum PixelFormat pix_fmt, enum CodecID codec_id)
return 0;
}
-static enum PixelFormat fmt_v4l2ff(uint32_t v4l2_fmt, enum CodecID codec_id)
+static enum AVPixelFormat fmt_v4l2ff(uint32_t v4l2_fmt, enum AVCodecID codec_id)
{
int i;
@@ -248,10 +247,10 @@ static enum PixelFormat fmt_v4l2ff(uint32_t v4l2_fmt, enum CodecID codec_id)
}
}
- return PIX_FMT_NONE;
+ return AV_PIX_FMT_NONE;
}
-static enum CodecID fmt_v4l2codec(uint32_t v4l2_fmt)
+static enum AVCodecID fmt_v4l2codec(uint32_t v4l2_fmt)
{
int i;
@@ -261,7 +260,7 @@ static enum CodecID fmt_v4l2codec(uint32_t v4l2_fmt)
}
}
- return CODEC_ID_NONE;
+ return AV_CODEC_ID_NONE;
}
#if HAVE_STRUCT_V4L2_FRMIVALENUM_DISCRETE
@@ -295,8 +294,8 @@ static void list_formats(AVFormatContext *ctx, int fd, int type)
struct v4l2_fmtdesc vfd = { .type = V4L2_BUF_TYPE_VIDEO_CAPTURE };
while(!ioctl(fd, VIDIOC_ENUM_FMT, &vfd)) {
- enum CodecID codec_id = fmt_v4l2codec(vfd.pixelformat);
- enum PixelFormat pix_fmt = fmt_v4l2ff(vfd.pixelformat, codec_id);
+ enum AVCodecID codec_id = fmt_v4l2codec(vfd.pixelformat);
+ enum AVPixelFormat pix_fmt = fmt_v4l2ff(vfd.pixelformat, codec_id);
vfd.index++;
@@ -543,7 +542,7 @@ static void mmap_close(struct video_data *s)
av_free(s->buf_len);
}
-static int v4l2_set_parameters(AVFormatContext *s1, AVFormatParameters *ap)
+static int v4l2_set_parameters(AVFormatContext *s1)
{
struct video_data *s = s1->priv_data;
struct v4l2_input input = { 0 };
@@ -646,10 +645,10 @@ static int v4l2_set_parameters(AVFormatContext *s1, AVFormatParameters *ap)
}
static uint32_t device_try_init(AVFormatContext *s1,
- enum PixelFormat pix_fmt,
+ enum AVPixelFormat pix_fmt,
int *width,
int *height,
- enum CodecID *codec_id)
+ enum AVCodecID *codec_id)
{
uint32_t desired_format = fmt_ff2v4l(pix_fmt, s1->video_codec_id);
@@ -659,7 +658,7 @@ static uint32_t device_try_init(AVFormatContext *s1,
desired_format = 0;
for (i = 0; i<FF_ARRAY_ELEMS(fmt_conversion_table); i++) {
- if (s1->video_codec_id == CODEC_ID_NONE ||
+ if (s1->video_codec_id == AV_CODEC_ID_NONE ||
fmt_conversion_table[i].codec_id == s1->video_codec_id) {
desired_format = fmt_conversion_table[i].v4l2_fmt;
if (device_init(s1, width, height, desired_format) >= 0) {
@@ -672,20 +671,20 @@ static uint32_t device_try_init(AVFormatContext *s1,
if (desired_format != 0) {
*codec_id = fmt_v4l2codec(desired_format);
- assert(*codec_id != CODEC_ID_NONE);
+ assert(*codec_id != AV_CODEC_ID_NONE);
}
return desired_format;
}
-static int v4l2_read_header(AVFormatContext *s1, AVFormatParameters *ap)
+static int v4l2_read_header(AVFormatContext *s1)
{
struct video_data *s = s1->priv_data;
AVStream *st;
int res = 0;
uint32_t desired_format;
- enum CodecID codec_id;
- enum PixelFormat pix_fmt = PIX_FMT_NONE;
+ enum AVCodecID codec_id;
+ enum AVPixelFormat pix_fmt = AV_PIX_FMT_NONE;
st = avformat_new_stream(s1, NULL);
if (!st) {
@@ -722,7 +721,7 @@ static int v4l2_read_header(AVFormatContext *s1, AVFormatParameters *ap)
pix_fmt = av_get_pix_fmt(s->pixel_format);
- if (pix_fmt == PIX_FMT_NONE && !codec) {
+ if (pix_fmt == AV_PIX_FMT_NONE && !codec) {
av_log(s1, AV_LOG_ERROR, "No such input format: %s.\n",
s->pixel_format);
@@ -766,7 +765,7 @@ static int v4l2_read_header(AVFormatContext *s1, AVFormatParameters *ap)
s->frame_format = desired_format;
- if ((res = v4l2_set_parameters(s1, ap) < 0))
+ if ((res = v4l2_set_parameters(s1) < 0))
goto out;
st->codec->pix_fmt = fmt_v4l2ff(desired_format, codec_id);
@@ -783,7 +782,7 @@ static int v4l2_read_header(AVFormatContext *s1, AVFormatParameters *ap)
st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
st->codec->codec_id = codec_id;
- if (codec_id == CODEC_ID_RAWVIDEO)
+ if (codec_id == AV_CODEC_ID_RAWVIDEO)
st->codec->codec_tag =
avcodec_pix_fmt_to_codec_tag(st->codec->pix_fmt);
st->codec->width = s->width;
@@ -827,15 +826,15 @@ static int v4l2_read_close(AVFormatContext *s1)
#define DEC AV_OPT_FLAG_DECODING_PARAM
static const AVOption options[] = {
{ "standard", "TV standard, used only by analog frame grabber", OFFSET(standard), AV_OPT_TYPE_STRING, {.str = NULL }, 0, 0, DEC },
- { "channel", "TV channel, used only by frame grabber", OFFSET(channel), AV_OPT_TYPE_INT, {.dbl = 0 }, 0, INT_MAX, DEC },
+ { "channel", "TV channel, used only by frame grabber", OFFSET(channel), AV_OPT_TYPE_INT, {.i64 = 0 }, 0, INT_MAX, 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", "Preferred pixel format", OFFSET(pixel_format), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, DEC },
{ "input_format", "Preferred pixel format (for raw video) or codec name", OFFSET(pixel_format), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, DEC },
{ "framerate", "", OFFSET(framerate), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, DEC },
- { "list_formats", "List available formats and exit", OFFSET(list_format), AV_OPT_TYPE_INT, {.dbl = 0 }, 0, INT_MAX, DEC, "list_formats" },
- { "all", "Show all available formats", OFFSET(list_format), AV_OPT_TYPE_CONST, {.dbl = V4L_ALLFORMATS }, 0, INT_MAX, DEC, "list_formats" },
- { "raw", "Show only non-compressed formats", OFFSET(list_format), AV_OPT_TYPE_CONST, {.dbl = V4L_RAWFORMATS }, 0, INT_MAX, DEC, "list_formats" },
- { "compressed", "Show only compressed formats", OFFSET(list_format), AV_OPT_TYPE_CONST, {.dbl = V4L_COMPFORMATS }, 0, INT_MAX, DEC, "list_formats" },
+ { "list_formats", "List available formats and exit", OFFSET(list_format), AV_OPT_TYPE_INT, {.i64 = 0 }, 0, INT_MAX, DEC, "list_formats" },
+ { "all", "Show all available formats", OFFSET(list_format), AV_OPT_TYPE_CONST, {.i64 = V4L_ALLFORMATS }, 0, INT_MAX, DEC, "list_formats" },
+ { "raw", "Show only non-compressed formats", OFFSET(list_format), AV_OPT_TYPE_CONST, {.i64 = V4L_RAWFORMATS }, 0, INT_MAX, DEC, "list_formats" },
+ { "compressed", "Show only compressed formats", OFFSET(list_format), AV_OPT_TYPE_CONST, {.i64 = V4L_COMPFORMATS }, 0, INT_MAX, DEC, "list_formats" },
{ NULL },
};
diff --git a/gst-libs/ext/libav/libavdevice/version.h b/gst-libs/ext/libav/libavdevice/version.h
new file mode 100644
index 0000000..52b47db
--- /dev/null
+++ b/gst-libs/ext/libav/libavdevice/version.h
@@ -0,0 +1,48 @@
+/*
+ * 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
+ */
+
+#ifndef AVDEVICE_VERSION_H
+#define AVDEVICE_VERSION_H
+
+/**
+ * @file
+ * @ingroup lavd
+ * Libavdevice version macros
+ */
+
+#include "libavutil/avutil.h"
+
+#define LIBAVDEVICE_VERSION_MAJOR 53
+#define LIBAVDEVICE_VERSION_MINOR 2
+#define LIBAVDEVICE_VERSION_MICRO 0
+
+#define LIBAVDEVICE_VERSION_INT AV_VERSION_INT(LIBAVDEVICE_VERSION_MAJOR, \
+ LIBAVDEVICE_VERSION_MINOR, \
+ LIBAVDEVICE_VERSION_MICRO)
+#define LIBAVDEVICE_VERSION AV_VERSION(LIBAVDEVICE_VERSION_MAJOR, \
+ LIBAVDEVICE_VERSION_MINOR, \
+ LIBAVDEVICE_VERSION_MICRO)
+#define LIBAVDEVICE_BUILD LIBAVDEVICE_VERSION_INT
+
+/**
+ * FF_API_* defines may be placed below to indicate public API that will be
+ * dropped at a future version bump. The defines themselves are not part of
+ * the public API and may change, break or disappear at any time.
+ */
+
+#endif /* AVDEVICE_VERSION_H */
diff --git a/gst-libs/ext/libav/libavdevice/vfwcap.c b/gst-libs/ext/libav/libavdevice/vfwcap.c
index b5baee3..fea85fc 100644
--- a/gst-libs/ext/libav/libavdevice/vfwcap.c
+++ b/gst-libs/ext/libav/libavdevice/vfwcap.c
@@ -47,44 +47,44 @@ struct vfw_ctx {
char *framerate; /**< Set by a private option. */
};
-static enum PixelFormat vfw_pixfmt(DWORD biCompression, WORD biBitCount)
+static enum AVPixelFormat vfw_pixfmt(DWORD biCompression, WORD biBitCount)
{
switch(biCompression) {
case MKTAG('U', 'Y', 'V', 'Y'):
- return PIX_FMT_UYVY422;
+ return AV_PIX_FMT_UYVY422;
case MKTAG('Y', 'U', 'Y', '2'):
- return PIX_FMT_YUYV422;
+ return AV_PIX_FMT_YUYV422;
case MKTAG('I', '4', '2', '0'):
- return PIX_FMT_YUV420P;
+ return AV_PIX_FMT_YUV420P;
case BI_RGB:
switch(biBitCount) { /* 1-8 are untested */
case 1:
- return PIX_FMT_MONOWHITE;
+ return AV_PIX_FMT_MONOWHITE;
case 4:
- return PIX_FMT_RGB4;
+ return AV_PIX_FMT_RGB4;
case 8:
- return PIX_FMT_RGB8;
+ return AV_PIX_FMT_RGB8;
case 16:
- return PIX_FMT_RGB555;
+ return AV_PIX_FMT_RGB555;
case 24:
- return PIX_FMT_BGR24;
+ return AV_PIX_FMT_BGR24;
case 32:
- return PIX_FMT_RGB32;
+ return AV_PIX_FMT_RGB32;
}
}
- return PIX_FMT_NONE;
+ return AV_PIX_FMT_NONE;
}
-static enum CodecID vfw_codecid(DWORD biCompression)
+static enum AVCodecID vfw_codecid(DWORD biCompression)
{
switch(biCompression) {
case MKTAG('d', 'v', 's', 'd'):
- return CODEC_ID_DVVIDEO;
+ return AV_CODEC_ID_DVVIDEO;
case MKTAG('M', 'J', 'P', 'G'):
case MKTAG('m', 'j', 'p', 'g'):
- return CODEC_ID_MJPEG;
+ return AV_CODEC_ID_MJPEG;
}
- return CODEC_ID_NONE;
+ return AV_CODEC_ID_NONE;
}
#define dstruct(pctx, sname, var, type) \
@@ -238,7 +238,7 @@ static int vfw_read_close(AVFormatContext *s)
return 0;
}
-static int vfw_read_header(AVFormatContext *s, AVFormatParameters *ap)
+static int vfw_read_header(AVFormatContext *s)
{
struct vfw_ctx *ctx = s->priv_data;
AVCodecContext *codec;
@@ -376,9 +376,9 @@ static int vfw_read_header(AVFormatContext *s, AVFormatParameters *ap)
codec->width = bi->bmiHeader.biWidth;
codec->height = bi->bmiHeader.biHeight;
codec->pix_fmt = vfw_pixfmt(biCompression, biBitCount);
- if(codec->pix_fmt == PIX_FMT_NONE) {
+ if(codec->pix_fmt == AV_PIX_FMT_NONE) {
codec->codec_id = vfw_codecid(biCompression);
- if(codec->codec_id == CODEC_ID_NONE) {
+ if(codec->codec_id == AV_CODEC_ID_NONE) {
av_log(s, AV_LOG_ERROR, "Unknown compression type. "
"Please report verbose (-v 9) debug information.\n");
vfw_read_close(s);
@@ -386,7 +386,7 @@ static int vfw_read_header(AVFormatContext *s, AVFormatParameters *ap)
}
codec->bits_per_coded_sample = biBitCount;
} else {
- codec->codec_id = CODEC_ID_RAWVIDEO;
+ codec->codec_id = AV_CODEC_ID_RAWVIDEO;
if(biCompression == BI_RGB) {
codec->bits_per_coded_sample = biBitCount;
codec->extradata = av_malloc(9 + FF_INPUT_BUFFER_PADDING_SIZE);
diff --git a/gst-libs/ext/libav/libavdevice/x11grab.c b/gst-libs/ext/libav/libavdevice/x11grab.c
index 9d12b2f..8edbf7b 100644
--- a/gst-libs/ext/libav/libavdevice/x11grab.c
+++ b/gst-libs/ext/libav/libavdevice/x11grab.c
@@ -42,6 +42,7 @@
#include "libavutil/log.h"
#include "libavutil/opt.h"
#include "libavutil/parseutils.h"
+#include "libavutil/time.h"
#include <time.h>
#include <X11/X.h>
#include <X11/Xlib.h>
@@ -56,8 +57,7 @@
/**
* X11 Device Demuxer context
*/
-struct x11_grab
-{
+struct x11grab {
const AVClass *class; /**< Class for private options. */
int frame_size; /**< Size in bytes of a grabbed frame */
AVRational time_base; /**< Time base */
@@ -85,10 +85,10 @@ struct x11_grab
/**
* Draw grabbing region window
*
- * @param s x11_grab context
+ * @param s x11grab context
*/
static void
-x11grab_draw_region_win(struct x11_grab *s)
+x11grab_draw_region_win(struct x11grab *s)
{
Display *dpy = s->dpy;
int screen;
@@ -110,10 +110,10 @@ x11grab_draw_region_win(struct x11_grab *s)
/**
* Initialize grabbing region window
*
- * @param s x11_grab context
+ * @param s x11grab context
*/
static void
-x11grab_region_win_init(struct x11_grab *s)
+x11grab_region_win_init(struct x11grab *s)
{
Display *dpy = s->dpy;
int screen;
@@ -146,7 +146,6 @@ x11grab_region_win_init(struct x11_grab *s)
* Initialize the x11 grab device demuxer (public device demuxer API).
*
* @param s1 Context from avformat core
- * @param ap Parameters from avformat core
* @return <ul>
* <li>AVERROR(ENOMEM) no memory left</li>
* <li>AVERROR(EIO) other failure case</li>
@@ -154,12 +153,12 @@ x11grab_region_win_init(struct x11_grab *s)
* </ul>
*/
static int
-x11grab_read_header(AVFormatContext *s1, AVFormatParameters *ap)
+x11grab_read_header(AVFormatContext *s1)
{
- struct x11_grab *x11grab = s1->priv_data;
+ struct x11grab *x11grab = s1->priv_data;
Display *dpy;
AVStream *st = NULL;
- enum PixelFormat input_pixfmt;
+ enum AVPixelFormat input_pixfmt;
XImage *image;
int x_off = 0;
int y_off = 0;
@@ -170,6 +169,9 @@ x11grab_read_header(AVFormatContext *s1, AVFormatParameters *ap)
AVRational framerate;
param = av_strdup(s1->filename);
+ if (!param)
+ goto out;
+
offset = strchr(param, '+');
if (offset) {
sscanf(offset, "%d,%d", &x_off, &y_off);
@@ -257,19 +259,19 @@ x11grab_read_header(AVFormatContext *s1, AVFormatParameters *ap)
switch (image->bits_per_pixel) {
case 8:
av_log (s1, AV_LOG_DEBUG, "8 bit palette\n");
- input_pixfmt = PIX_FMT_PAL8;
+ input_pixfmt = AV_PIX_FMT_PAL8;
break;
case 16:
if ( image->red_mask == 0xf800 &&
image->green_mask == 0x07e0 &&
image->blue_mask == 0x001f ) {
av_log (s1, AV_LOG_DEBUG, "16 bit RGB565\n");
- input_pixfmt = PIX_FMT_RGB565;
+ input_pixfmt = AV_PIX_FMT_RGB565;
} else if (image->red_mask == 0x7c00 &&
image->green_mask == 0x03e0 &&
image->blue_mask == 0x001f ) {
av_log(s1, AV_LOG_DEBUG, "16 bit RGB555\n");
- input_pixfmt = PIX_FMT_RGB555;
+ input_pixfmt = AV_PIX_FMT_RGB555;
} else {
av_log(s1, AV_LOG_ERROR, "RGB ordering at image depth %i not supported ... aborting\n", image->bits_per_pixel);
av_log(s1, AV_LOG_ERROR, "color masks: r 0x%.6lx g 0x%.6lx b 0x%.6lx\n", image->red_mask, image->green_mask, image->blue_mask);
@@ -281,11 +283,11 @@ x11grab_read_header(AVFormatContext *s1, AVFormatParameters *ap)
if ( image->red_mask == 0xff0000 &&
image->green_mask == 0x00ff00 &&
image->blue_mask == 0x0000ff ) {
- input_pixfmt = PIX_FMT_BGR24;
+ input_pixfmt = AV_PIX_FMT_BGR24;
} else if ( image->red_mask == 0x0000ff &&
image->green_mask == 0x00ff00 &&
image->blue_mask == 0xff0000 ) {
- input_pixfmt = PIX_FMT_RGB24;
+ input_pixfmt = AV_PIX_FMT_RGB24;
} else {
av_log(s1, AV_LOG_ERROR,"rgb ordering at image depth %i not supported ... aborting\n", image->bits_per_pixel);
av_log(s1, AV_LOG_ERROR, "color masks: r 0x%.6lx g 0x%.6lx b 0x%.6lx\n", image->red_mask, image->green_mask, image->blue_mask);
@@ -294,7 +296,7 @@ x11grab_read_header(AVFormatContext *s1, AVFormatParameters *ap)
}
break;
case 32:
- input_pixfmt = PIX_FMT_RGB32;
+ input_pixfmt = AV_PIX_FMT_RGB32;
break;
default:
av_log(s1, AV_LOG_ERROR, "image depth %i not supported ... aborting\n", image->bits_per_pixel);
@@ -312,7 +314,7 @@ x11grab_read_header(AVFormatContext *s1, AVFormatParameters *ap)
x11grab->use_shm = use_shm;
st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
- st->codec->codec_id = CODEC_ID_RAWVIDEO;
+ st->codec->codec_id = AV_CODEC_ID_RAWVIDEO;
st->codec->width = x11grab->width;
st->codec->height = x11grab->height;
st->codec->pix_fmt = input_pixfmt;
@@ -320,6 +322,7 @@ x11grab_read_header(AVFormatContext *s1, AVFormatParameters *ap)
st->codec->bit_rate = x11grab->frame_size * 1/av_q2d(x11grab->time_base) * 8;
out:
+ av_free(param);
return ret;
}
@@ -331,7 +334,7 @@ out:
* coordinates
*/
static void
-paint_mouse_pointer(XImage *image, struct x11_grab *s)
+paint_mouse_pointer(XImage *image, struct x11grab *s)
{
int x_off = s->x_off;
int y_off = s->y_off;
@@ -445,7 +448,7 @@ xget_zpixmap(Display *dpy, Drawable d, XImage *image, int x, int y)
static int
x11grab_read_packet(AVFormatContext *s1, AVPacket *pkt)
{
- struct x11_grab *s = s1->priv_data;
+ struct x11grab *s = s1->priv_data;
Display *dpy = s->dpy;
XImage *image = s->image;
int x_off = s->x_off;
@@ -555,7 +558,7 @@ x11grab_read_packet(AVFormatContext *s1, AVPacket *pkt)
static int
x11grab_read_close(AVFormatContext *s1)
{
- struct x11_grab *x11grab = s1->priv_data;
+ struct x11grab *x11grab = s1->priv_data;
/* Detach cleanly from shared mem */
if (x11grab->use_shm) {
@@ -579,16 +582,16 @@ x11grab_read_close(AVFormatContext *s1)
return 0;
}
-#define OFFSET(x) offsetof(struct x11_grab, x)
+#define OFFSET(x) offsetof(struct x11grab, 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), 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 },
+ { "draw_mouse", "Draw the mouse pointer.", OFFSET(draw_mouse), AV_OPT_TYPE_INT, { .i64 = 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), 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 },
+ OFFSET(follow_mouse), AV_OPT_TYPE_INT, { .i64 = 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, { .i64 = -1 }, INT_MIN, INT_MAX, DEC, "follow_mouse" },
+ { "show_region", "Show the grabbing region.", OFFSET(show_region), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, DEC },
{ NULL },
};
@@ -600,10 +603,10 @@ static const AVClass x11_class = {
};
/** x11 grabber device demuxer declaration */
-AVInputFormat ff_x11_grab_device_demuxer = {
+AVInputFormat ff_x11grab_demuxer = {
.name = "x11grab",
.long_name = NULL_IF_CONFIG_SMALL("X11grab"),
- .priv_data_size = sizeof(struct x11_grab),
+ .priv_data_size = sizeof(struct x11grab),
.read_header = x11grab_read_header,
.read_packet = x11grab_read_packet,
.read_close = x11grab_read_close,
diff --git a/gst-libs/ext/libav/libavfilter/Makefile b/gst-libs/ext/libav/libavfilter/Makefile
index 09865c1..4a3331a 100644
--- a/gst-libs/ext/libav/libavfilter/Makefile
+++ b/gst-libs/ext/libav/libavfilter/Makefile
@@ -1,20 +1,40 @@
NAME = avfilter
FFLIBS = avutil
+FFLIBS-$(CONFIG_ASYNCTS_FILTER) += avresample
FFLIBS-$(CONFIG_MOVIE_FILTER) += avformat avcodec
-FFLIBS-$(CONFIG_SCALE_FILTER) += swscale
+FFLIBS-$(CONFIG_RESAMPLE_FILTER) += avresample
+FFLIBS-$(CONFIG_SCALE_FILTER) += swscale
-HEADERS = avfilter.h avfiltergraph.h buffersrc.h version.h vsrc_buffer.h
+HEADERS = avfilter.h \
+ avfiltergraph.h \
+ buffersink.h \
+ buffersrc.h \
+ version.h \
OBJS = allfilters.o \
+ audio.o \
avfilter.o \
avfiltergraph.o \
- defaults.o \
+ buffer.o \
+ buffersink.o \
+ buffersrc.o \
drawutils.o \
+ fifo.o \
formats.o \
graphparser.o \
- vsrc_buffer.o
+ video.o \
+OBJS-$(CONFIG_AFORMAT_FILTER) += af_aformat.o
+OBJS-$(CONFIG_AMIX_FILTER) += af_amix.o
OBJS-$(CONFIG_ANULL_FILTER) += af_anull.o
+OBJS-$(CONFIG_ASHOWINFO_FILTER) += af_ashowinfo.o
+OBJS-$(CONFIG_ASPLIT_FILTER) += split.o
+OBJS-$(CONFIG_ASYNCTS_FILTER) += af_asyncts.o
+OBJS-$(CONFIG_CHANNELMAP_FILTER) += af_channelmap.o
+OBJS-$(CONFIG_CHANNELSPLIT_FILTER) += af_channelsplit.o
+OBJS-$(CONFIG_JOIN_FILTER) += af_join.o
+OBJS-$(CONFIG_RESAMPLE_FILTER) += af_resample.o
+OBJS-$(CONFIG_VOLUME_FILTER) += af_volume.o
OBJS-$(CONFIG_ANULLSRC_FILTER) += asrc_anullsrc.o
@@ -30,8 +50,8 @@ OBJS-$(CONFIG_DRAWBOX_FILTER) += vf_drawbox.o
OBJS-$(CONFIG_DRAWTEXT_FILTER) += vf_drawtext.o
OBJS-$(CONFIG_FADE_FILTER) += vf_fade.o
OBJS-$(CONFIG_FIELDORDER_FILTER) += vf_fieldorder.o
-OBJS-$(CONFIG_FIFO_FILTER) += vf_fifo.o
OBJS-$(CONFIG_FORMAT_FILTER) += vf_format.o
+OBJS-$(CONFIG_FPS_FILTER) += vf_fps.o
OBJS-$(CONFIG_FREI0R_FILTER) += vf_frei0r.o
OBJS-$(CONFIG_GRADFUN_FILTER) += vf_gradfun.o
OBJS-$(CONFIG_HFLIP_FILTER) += vf_hflip.o
@@ -53,8 +73,7 @@ OBJS-$(CONFIG_SETPTS_FILTER) += vf_setpts.o
OBJS-$(CONFIG_SETSAR_FILTER) += vf_aspect.o
OBJS-$(CONFIG_SETTB_FILTER) += vf_settb.o
OBJS-$(CONFIG_SHOWINFO_FILTER) += vf_showinfo.o
-OBJS-$(CONFIG_SLICIFY_FILTER) += vf_slicify.o
-OBJS-$(CONFIG_SPLIT_FILTER) += vf_split.o
+OBJS-$(CONFIG_SPLIT_FILTER) += split.o
OBJS-$(CONFIG_TRANSPOSE_FILTER) += vf_transpose.o
OBJS-$(CONFIG_UNSHARP_FILTER) += vf_unsharp.o
OBJS-$(CONFIG_VFLIP_FILTER) += vf_vflip.o
@@ -69,8 +88,5 @@ OBJS-$(CONFIG_TESTSRC_FILTER) += vsrc_testsrc.o
OBJS-$(CONFIG_NULLSINK_FILTER) += vsink_nullsink.o
--include $(SRC_PATH)/$(SUBDIR)$(ARCH)/Makefile
-
-DIRS = x86
-
-TOOLS = graph2dot lavfi-showfiltfmts
+TOOLS = graph2dot
+TESTPROGS = filtfmts
diff --git a/gst-libs/ext/libav/libavfilter/af_aformat.c b/gst-libs/ext/libav/libavfilter/af_aformat.c
new file mode 100644
index 0000000..2059cf2
--- /dev/null
+++ b/gst-libs/ext/libav/libavfilter/af_aformat.c
@@ -0,0 +1,160 @@
+/*
+ * Copyright (c) 2011 Mina Nagy Zaki
+ *
+ * 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
+ * format audio filter
+ */
+
+#include "libavutil/avstring.h"
+#include "libavutil/channel_layout.h"
+#include "libavutil/common.h"
+#include "libavutil/opt.h"
+
+#include "audio.h"
+#include "avfilter.h"
+#include "formats.h"
+#include "internal.h"
+
+typedef struct AFormatContext {
+ const AVClass *class;
+
+ AVFilterFormats *formats;
+ AVFilterFormats *sample_rates;
+ AVFilterChannelLayouts *channel_layouts;
+
+ char *formats_str;
+ char *sample_rates_str;
+ char *channel_layouts_str;
+} AFormatContext;
+
+#define OFFSET(x) offsetof(AFormatContext, x)
+#define A AV_OPT_FLAG_AUDIO_PARAM
+static const AVOption options[] = {
+ { "sample_fmts", "A comma-separated list of sample formats.", OFFSET(formats_str), AV_OPT_TYPE_STRING, .flags = A },
+ { "sample_rates", "A comma-separated list of sample rates.", OFFSET(sample_rates_str), AV_OPT_TYPE_STRING, .flags = A },
+ { "channel_layouts", "A comma-separated list of channel layouts.", OFFSET(channel_layouts_str), AV_OPT_TYPE_STRING, .flags = A },
+ { NULL },
+};
+
+static const AVClass aformat_class = {
+ .class_name = "aformat filter",
+ .item_name = av_default_item_name,
+ .option = options,
+ .version = LIBAVUTIL_VERSION_INT,
+};
+
+#define PARSE_FORMATS(str, type, list, add_to_list, get_fmt, none, desc) \
+do { \
+ char *next, *cur = str; \
+ while (cur) { \
+ type fmt; \
+ next = strchr(cur, ','); \
+ if (next) \
+ *next++ = 0; \
+ \
+ if ((fmt = get_fmt(cur)) == none) { \
+ av_log(ctx, AV_LOG_ERROR, "Error parsing " desc ": %s.\n", cur);\
+ ret = AVERROR(EINVAL); \
+ goto fail; \
+ } \
+ add_to_list(&list, fmt); \
+ \
+ cur = next; \
+ } \
+} while (0)
+
+static int get_sample_rate(const char *samplerate)
+{
+ int ret = strtol(samplerate, NULL, 0);
+ return FFMAX(ret, 0);
+}
+
+static av_cold int init(AVFilterContext *ctx, const char *args)
+{
+ AFormatContext *s = ctx->priv;
+ int ret;
+
+ if (!args) {
+ av_log(ctx, AV_LOG_ERROR, "No parameters supplied.\n");
+ return AVERROR(EINVAL);
+ }
+
+ s->class = &aformat_class;
+ av_opt_set_defaults(s);
+
+ if ((ret = av_set_options_string(s, args, "=", ":")) < 0) {
+ av_log(ctx, AV_LOG_ERROR, "Error parsing options string '%s'.\n", args);
+ return ret;
+ }
+
+ PARSE_FORMATS(s->formats_str, enum AVSampleFormat, s->formats,
+ ff_add_format, av_get_sample_fmt, AV_SAMPLE_FMT_NONE, "sample format");
+ PARSE_FORMATS(s->sample_rates_str, int, s->sample_rates, ff_add_format,
+ get_sample_rate, 0, "sample rate");
+ PARSE_FORMATS(s->channel_layouts_str, uint64_t, s->channel_layouts,
+ ff_add_channel_layout, av_get_channel_layout, 0,
+ "channel layout");
+
+fail:
+ av_opt_free(s);
+ return ret;
+}
+
+static int query_formats(AVFilterContext *ctx)
+{
+ AFormatContext *s = ctx->priv;
+
+ ff_set_common_formats(ctx, s->formats ? s->formats :
+ ff_all_formats(AVMEDIA_TYPE_AUDIO));
+ ff_set_common_samplerates(ctx, s->sample_rates ? s->sample_rates :
+ ff_all_samplerates());
+ ff_set_common_channel_layouts(ctx, s->channel_layouts ? s->channel_layouts :
+ ff_all_channel_layouts());
+
+ return 0;
+}
+
+static const AVFilterPad avfilter_af_aformat_inputs[] = {
+ {
+ .name = "default",
+ .type = AVMEDIA_TYPE_AUDIO,
+ },
+ { NULL }
+};
+
+static const AVFilterPad avfilter_af_aformat_outputs[] = {
+ {
+ .name = "default",
+ .type = AVMEDIA_TYPE_AUDIO
+ },
+ { NULL }
+};
+
+AVFilter avfilter_af_aformat = {
+ .name = "aformat",
+ .description = NULL_IF_CONFIG_SMALL("Convert the input audio to one of the specified formats."),
+ .init = init,
+ .query_formats = query_formats,
+ .priv_size = sizeof(AFormatContext),
+
+ .inputs = avfilter_af_aformat_inputs,
+ .outputs = avfilter_af_aformat_outputs,
+};
diff --git a/gst-libs/ext/libav/libavfilter/af_amix.c b/gst-libs/ext/libav/libavfilter/af_amix.c
new file mode 100644
index 0000000..c2fb158
--- /dev/null
+++ b/gst-libs/ext/libav/libavfilter/af_amix.c
@@ -0,0 +1,573 @@
+/*
+ * Audio Mix Filter
+ * Copyright (c) 2012 Justin Ruggles <justin.ruggles@gmail.com>
+ *
+ * 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
+ * Audio Mix Filter
+ *
+ * Mixes audio from multiple sources into a single output. The channel layout,
+ * sample rate, and sample format will be the same for all inputs and the
+ * output.
+ */
+
+#include "libavutil/audio_fifo.h"
+#include "libavutil/avassert.h"
+#include "libavutil/avstring.h"
+#include "libavutil/channel_layout.h"
+#include "libavutil/common.h"
+#include "libavutil/float_dsp.h"
+#include "libavutil/mathematics.h"
+#include "libavutil/opt.h"
+#include "libavutil/samplefmt.h"
+
+#include "audio.h"
+#include "avfilter.h"
+#include "formats.h"
+#include "internal.h"
+
+#define INPUT_OFF 0 /**< input has reached EOF */
+#define INPUT_ON 1 /**< input is active */
+#define INPUT_INACTIVE 2 /**< input is on, but is currently inactive */
+
+#define DURATION_LONGEST 0
+#define DURATION_SHORTEST 1
+#define DURATION_FIRST 2
+
+
+typedef struct FrameInfo {
+ int nb_samples;
+ int64_t pts;
+ struct FrameInfo *next;
+} FrameInfo;
+
+/**
+ * Linked list used to store timestamps and frame sizes of all frames in the
+ * FIFO for the first input.
+ *
+ * This is needed to keep timestamps synchronized for the case where multiple
+ * input frames are pushed to the filter for processing before a frame is
+ * requested by the output link.
+ */
+typedef struct FrameList {
+ int nb_frames;
+ int nb_samples;
+ FrameInfo *list;
+ FrameInfo *end;
+} FrameList;
+
+static void frame_list_clear(FrameList *frame_list)
+{
+ if (frame_list) {
+ while (frame_list->list) {
+ FrameInfo *info = frame_list->list;
+ frame_list->list = info->next;
+ av_free(info);
+ }
+ frame_list->nb_frames = 0;
+ frame_list->nb_samples = 0;
+ frame_list->end = NULL;
+ }
+}
+
+static int frame_list_next_frame_size(FrameList *frame_list)
+{
+ if (!frame_list->list)
+ return 0;
+ return frame_list->list->nb_samples;
+}
+
+static int64_t frame_list_next_pts(FrameList *frame_list)
+{
+ if (!frame_list->list)
+ return AV_NOPTS_VALUE;
+ return frame_list->list->pts;
+}
+
+static void frame_list_remove_samples(FrameList *frame_list, int nb_samples)
+{
+ if (nb_samples >= frame_list->nb_samples) {
+ frame_list_clear(frame_list);
+ } else {
+ int samples = nb_samples;
+ while (samples > 0) {
+ FrameInfo *info = frame_list->list;
+ av_assert0(info != NULL);
+ if (info->nb_samples <= samples) {
+ samples -= info->nb_samples;
+ frame_list->list = info->next;
+ if (!frame_list->list)
+ frame_list->end = NULL;
+ frame_list->nb_frames--;
+ frame_list->nb_samples -= info->nb_samples;
+ av_free(info);
+ } else {
+ info->nb_samples -= samples;
+ info->pts += samples;
+ frame_list->nb_samples -= samples;
+ samples = 0;
+ }
+ }
+ }
+}
+
+static int frame_list_add_frame(FrameList *frame_list, int nb_samples, int64_t pts)
+{
+ FrameInfo *info = av_malloc(sizeof(*info));
+ if (!info)
+ return AVERROR(ENOMEM);
+ info->nb_samples = nb_samples;
+ info->pts = pts;
+ info->next = NULL;
+
+ if (!frame_list->list) {
+ frame_list->list = info;
+ frame_list->end = info;
+ } else {
+ av_assert0(frame_list->end != NULL);
+ frame_list->end->next = info;
+ frame_list->end = info;
+ }
+ frame_list->nb_frames++;
+ frame_list->nb_samples += nb_samples;
+
+ return 0;
+}
+
+
+typedef struct MixContext {
+ const AVClass *class; /**< class for AVOptions */
+ AVFloatDSPContext fdsp;
+
+ int nb_inputs; /**< number of inputs */
+ int active_inputs; /**< number of input currently active */
+ int duration_mode; /**< mode for determining duration */
+ float dropout_transition; /**< transition time when an input drops out */
+
+ int nb_channels; /**< number of channels */
+ int sample_rate; /**< sample rate */
+ int planar;
+ AVAudioFifo **fifos; /**< audio fifo for each input */
+ uint8_t *input_state; /**< current state of each input */
+ float *input_scale; /**< mixing scale factor for each input */
+ float scale_norm; /**< normalization factor for all inputs */
+ int64_t next_pts; /**< calculated pts for next output frame */
+ FrameList *frame_list; /**< list of frame info for the first input */
+} MixContext;
+
+#define OFFSET(x) offsetof(MixContext, x)
+#define A AV_OPT_FLAG_AUDIO_PARAM
+static const AVOption options[] = {
+ { "inputs", "Number of inputs.",
+ OFFSET(nb_inputs), AV_OPT_TYPE_INT, { .i64 = 2 }, 1, 32, A },
+ { "duration", "How to determine the end-of-stream.",
+ OFFSET(duration_mode), AV_OPT_TYPE_INT, { .i64 = DURATION_LONGEST }, 0, 2, A, "duration" },
+ { "longest", "Duration of longest input.", 0, AV_OPT_TYPE_CONST, { .i64 = DURATION_LONGEST }, INT_MIN, INT_MAX, A, "duration" },
+ { "shortest", "Duration of shortest input.", 0, AV_OPT_TYPE_CONST, { .i64 = DURATION_SHORTEST }, INT_MIN, INT_MAX, A, "duration" },
+ { "first", "Duration of first input.", 0, AV_OPT_TYPE_CONST, { .i64 = DURATION_FIRST }, INT_MIN, INT_MAX, A, "duration" },
+ { "dropout_transition", "Transition time, in seconds, for volume "
+ "renormalization when an input stream ends.",
+ OFFSET(dropout_transition), AV_OPT_TYPE_FLOAT, { .dbl = 2.0 }, 0, INT_MAX, A },
+ { NULL },
+};
+
+static const AVClass amix_class = {
+ .class_name = "amix filter",
+ .item_name = av_default_item_name,
+ .option = options,
+ .version = LIBAVUTIL_VERSION_INT,
+};
+
+
+/**
+ * Update the scaling factors to apply to each input during mixing.
+ *
+ * This balances the full volume range between active inputs and handles
+ * volume transitions when EOF is encountered on an input but mixing continues
+ * with the remaining inputs.
+ */
+static void calculate_scales(MixContext *s, int nb_samples)
+{
+ int i;
+
+ if (s->scale_norm > s->active_inputs) {
+ s->scale_norm -= nb_samples / (s->dropout_transition * s->sample_rate);
+ s->scale_norm = FFMAX(s->scale_norm, s->active_inputs);
+ }
+
+ for (i = 0; i < s->nb_inputs; i++) {
+ if (s->input_state[i] == INPUT_ON)
+ s->input_scale[i] = 1.0f / s->scale_norm;
+ else
+ s->input_scale[i] = 0.0f;
+ }
+}
+
+static int config_output(AVFilterLink *outlink)
+{
+ AVFilterContext *ctx = outlink->src;
+ MixContext *s = ctx->priv;
+ int i;
+ char buf[64];
+
+ s->planar = av_sample_fmt_is_planar(outlink->format);
+ s->sample_rate = outlink->sample_rate;
+ outlink->time_base = (AVRational){ 1, outlink->sample_rate };
+ s->next_pts = AV_NOPTS_VALUE;
+
+ s->frame_list = av_mallocz(sizeof(*s->frame_list));
+ if (!s->frame_list)
+ return AVERROR(ENOMEM);
+
+ s->fifos = av_mallocz(s->nb_inputs * sizeof(*s->fifos));
+ if (!s->fifos)
+ return AVERROR(ENOMEM);
+
+ s->nb_channels = av_get_channel_layout_nb_channels(outlink->channel_layout);
+ for (i = 0; i < s->nb_inputs; i++) {
+ s->fifos[i] = av_audio_fifo_alloc(outlink->format, s->nb_channels, 1024);
+ if (!s->fifos[i])
+ return AVERROR(ENOMEM);
+ }
+
+ s->input_state = av_malloc(s->nb_inputs);
+ if (!s->input_state)
+ return AVERROR(ENOMEM);
+ memset(s->input_state, INPUT_ON, s->nb_inputs);
+ s->active_inputs = s->nb_inputs;
+
+ s->input_scale = av_mallocz(s->nb_inputs * sizeof(*s->input_scale));
+ if (!s->input_scale)
+ return AVERROR(ENOMEM);
+ s->scale_norm = s->active_inputs;
+ calculate_scales(s, 0);
+
+ av_get_channel_layout_string(buf, sizeof(buf), -1, outlink->channel_layout);
+
+ av_log(ctx, AV_LOG_VERBOSE,
+ "inputs:%d fmt:%s srate:%d cl:%s\n", s->nb_inputs,
+ av_get_sample_fmt_name(outlink->format), outlink->sample_rate, buf);
+
+ return 0;
+}
+
+/**
+ * Read samples from the input FIFOs, mix, and write to the output link.
+ */
+static int output_frame(AVFilterLink *outlink, int nb_samples)
+{
+ AVFilterContext *ctx = outlink->src;
+ MixContext *s = ctx->priv;
+ AVFilterBufferRef *out_buf, *in_buf;
+ int i;
+
+ calculate_scales(s, nb_samples);
+
+ out_buf = ff_get_audio_buffer(outlink, AV_PERM_WRITE, nb_samples);
+ if (!out_buf)
+ return AVERROR(ENOMEM);
+
+ in_buf = ff_get_audio_buffer(outlink, AV_PERM_WRITE, nb_samples);
+ if (!in_buf) {
+ avfilter_unref_buffer(out_buf);
+ return AVERROR(ENOMEM);
+ }
+
+ for (i = 0; i < s->nb_inputs; i++) {
+ if (s->input_state[i] == INPUT_ON) {
+ int planes, plane_size, p;
+
+ av_audio_fifo_read(s->fifos[i], (void **)in_buf->extended_data,
+ nb_samples);
+
+ planes = s->planar ? s->nb_channels : 1;
+ plane_size = nb_samples * (s->planar ? 1 : s->nb_channels);
+ plane_size = FFALIGN(plane_size, 16);
+
+ for (p = 0; p < planes; p++) {
+ s->fdsp.vector_fmac_scalar((float *)out_buf->extended_data[p],
+ (float *) in_buf->extended_data[p],
+ s->input_scale[i], plane_size);
+ }
+ }
+ }
+ avfilter_unref_buffer(in_buf);
+
+ out_buf->pts = s->next_pts;
+ if (s->next_pts != AV_NOPTS_VALUE)
+ s->next_pts += nb_samples;
+
+ return ff_filter_frame(outlink, out_buf);
+}
+
+/**
+ * Returns the smallest number of samples available in the input FIFOs other
+ * than that of the first input.
+ */
+static int get_available_samples(MixContext *s)
+{
+ int i;
+ int available_samples = INT_MAX;
+
+ av_assert0(s->nb_inputs > 1);
+
+ for (i = 1; i < s->nb_inputs; i++) {
+ int nb_samples;
+ if (s->input_state[i] == INPUT_OFF)
+ continue;
+ nb_samples = av_audio_fifo_size(s->fifos[i]);
+ available_samples = FFMIN(available_samples, nb_samples);
+ }
+ if (available_samples == INT_MAX)
+ return 0;
+ return available_samples;
+}
+
+/**
+ * Requests a frame, if needed, from each input link other than the first.
+ */
+static int request_samples(AVFilterContext *ctx, int min_samples)
+{
+ MixContext *s = ctx->priv;
+ int i, ret;
+
+ av_assert0(s->nb_inputs > 1);
+
+ for (i = 1; i < s->nb_inputs; i++) {
+ ret = 0;
+ if (s->input_state[i] == INPUT_OFF)
+ continue;
+ while (!ret && av_audio_fifo_size(s->fifos[i]) < min_samples)
+ ret = ff_request_frame(ctx->inputs[i]);
+ if (ret == AVERROR_EOF) {
+ if (av_audio_fifo_size(s->fifos[i]) == 0) {
+ s->input_state[i] = INPUT_OFF;
+ continue;
+ }
+ } else if (ret < 0)
+ return ret;
+ }
+ return 0;
+}
+
+/**
+ * Calculates the number of active inputs and determines EOF based on the
+ * duration option.
+ *
+ * @return 0 if mixing should continue, or AVERROR_EOF if mixing should stop.
+ */
+static int calc_active_inputs(MixContext *s)
+{
+ int i;
+ int active_inputs = 0;
+ for (i = 0; i < s->nb_inputs; i++)
+ active_inputs += !!(s->input_state[i] != INPUT_OFF);
+ s->active_inputs = active_inputs;
+
+ if (!active_inputs ||
+ (s->duration_mode == DURATION_FIRST && s->input_state[0] == INPUT_OFF) ||
+ (s->duration_mode == DURATION_SHORTEST && active_inputs != s->nb_inputs))
+ return AVERROR_EOF;
+ return 0;
+}
+
+static int request_frame(AVFilterLink *outlink)
+{
+ AVFilterContext *ctx = outlink->src;
+ MixContext *s = ctx->priv;
+ int ret;
+ int wanted_samples, available_samples;
+
+ ret = calc_active_inputs(s);
+ if (ret < 0)
+ return ret;
+
+ if (s->input_state[0] == INPUT_OFF) {
+ ret = request_samples(ctx, 1);
+ if (ret < 0)
+ return ret;
+
+ ret = calc_active_inputs(s);
+ if (ret < 0)
+ return ret;
+
+ available_samples = get_available_samples(s);
+ if (!available_samples)
+ return AVERROR(EAGAIN);
+
+ return output_frame(outlink, available_samples);
+ }
+
+ if (s->frame_list->nb_frames == 0) {
+ ret = ff_request_frame(ctx->inputs[0]);
+ if (ret == AVERROR_EOF) {
+ s->input_state[0] = INPUT_OFF;
+ if (s->nb_inputs == 1)
+ return AVERROR_EOF;
+ else
+ return AVERROR(EAGAIN);
+ } else if (ret < 0)
+ return ret;
+ }
+ av_assert0(s->frame_list->nb_frames > 0);
+
+ wanted_samples = frame_list_next_frame_size(s->frame_list);
+
+ if (s->active_inputs > 1) {
+ ret = request_samples(ctx, wanted_samples);
+ if (ret < 0)
+ return ret;
+
+ ret = calc_active_inputs(s);
+ if (ret < 0)
+ return ret;
+ }
+
+ if (s->active_inputs > 1) {
+ available_samples = get_available_samples(s);
+ if (!available_samples)
+ return AVERROR(EAGAIN);
+ available_samples = FFMIN(available_samples, wanted_samples);
+ } else {
+ available_samples = wanted_samples;
+ }
+
+ s->next_pts = frame_list_next_pts(s->frame_list);
+ frame_list_remove_samples(s->frame_list, available_samples);
+
+ return output_frame(outlink, available_samples);
+}
+
+static int filter_frame(AVFilterLink *inlink, AVFilterBufferRef *buf)
+{
+ AVFilterContext *ctx = inlink->dst;
+ MixContext *s = ctx->priv;
+ AVFilterLink *outlink = ctx->outputs[0];
+ int i, ret = 0;
+
+ for (i = 0; i < ctx->nb_inputs; i++)
+ if (ctx->inputs[i] == inlink)
+ break;
+ if (i >= ctx->nb_inputs) {
+ av_log(ctx, AV_LOG_ERROR, "unknown input link\n");
+ ret = AVERROR(EINVAL);
+ goto fail;
+ }
+
+ if (i == 0) {
+ int64_t pts = av_rescale_q(buf->pts, inlink->time_base,
+ outlink->time_base);
+ ret = frame_list_add_frame(s->frame_list, buf->audio->nb_samples, pts);
+ if (ret < 0)
+ goto fail;
+ }
+
+ ret = av_audio_fifo_write(s->fifos[i], (void **)buf->extended_data,
+ buf->audio->nb_samples);
+
+fail:
+ avfilter_unref_buffer(buf);
+
+ return ret;
+}
+
+static int init(AVFilterContext *ctx, const char *args)
+{
+ MixContext *s = ctx->priv;
+ int i, ret;
+
+ s->class = &amix_class;
+ av_opt_set_defaults(s);
+
+ if ((ret = av_set_options_string(s, args, "=", ":")) < 0) {
+ av_log(ctx, AV_LOG_ERROR, "Error parsing options string '%s'.\n", args);
+ return ret;
+ }
+ av_opt_free(s);
+
+ for (i = 0; i < s->nb_inputs; i++) {
+ char name[32];
+ AVFilterPad pad = { 0 };
+
+ snprintf(name, sizeof(name), "input%d", i);
+ pad.type = AVMEDIA_TYPE_AUDIO;
+ pad.name = av_strdup(name);
+ pad.filter_frame = filter_frame;
+
+ ff_insert_inpad(ctx, i, &pad);
+ }
+
+ avpriv_float_dsp_init(&s->fdsp, 0);
+
+ return 0;
+}
+
+static void uninit(AVFilterContext *ctx)
+{
+ int i;
+ MixContext *s = ctx->priv;
+
+ if (s->fifos) {
+ for (i = 0; i < s->nb_inputs; i++)
+ av_audio_fifo_free(s->fifos[i]);
+ av_freep(&s->fifos);
+ }
+ frame_list_clear(s->frame_list);
+ av_freep(&s->frame_list);
+ av_freep(&s->input_state);
+ av_freep(&s->input_scale);
+
+ for (i = 0; i < ctx->nb_inputs; i++)
+ av_freep(&ctx->input_pads[i].name);
+}
+
+static int query_formats(AVFilterContext *ctx)
+{
+ AVFilterFormats *formats = NULL;
+ ff_add_format(&formats, AV_SAMPLE_FMT_FLT);
+ ff_add_format(&formats, AV_SAMPLE_FMT_FLTP);
+ ff_set_common_formats(ctx, formats);
+ ff_set_common_channel_layouts(ctx, ff_all_channel_layouts());
+ ff_set_common_samplerates(ctx, ff_all_samplerates());
+ return 0;
+}
+
+static const AVFilterPad avfilter_af_amix_outputs[] = {
+ {
+ .name = "default",
+ .type = AVMEDIA_TYPE_AUDIO,
+ .config_props = config_output,
+ .request_frame = request_frame
+ },
+ { NULL }
+};
+
+AVFilter avfilter_af_amix = {
+ .name = "amix",
+ .description = NULL_IF_CONFIG_SMALL("Audio mixing."),
+ .priv_size = sizeof(MixContext),
+
+ .init = init,
+ .uninit = uninit,
+ .query_formats = query_formats,
+
+ .inputs = NULL,
+ .outputs = avfilter_af_amix_outputs,
+};
diff --git a/gst-libs/ext/libav/libavfilter/af_anull.c b/gst-libs/ext/libav/libavfilter/af_anull.c
index e2bed36..a791064 100644
--- a/gst-libs/ext/libav/libavfilter/af_anull.c
+++ b/gst-libs/ext/libav/libavfilter/af_anull.c
@@ -21,7 +21,27 @@
* null audio filter
*/
+#include "audio.h"
#include "avfilter.h"
+#include "internal.h"
+#include "libavutil/internal.h"
+
+static const AVFilterPad avfilter_af_anull_inputs[] = {
+ {
+ .name = "default",
+ .type = AVMEDIA_TYPE_AUDIO,
+ .get_audio_buffer = ff_null_get_audio_buffer,
+ },
+ { NULL }
+};
+
+static const AVFilterPad avfilter_af_anull_outputs[] = {
+ {
+ .name = "default",
+ .type = AVMEDIA_TYPE_AUDIO,
+ },
+ { NULL }
+};
AVFilter avfilter_af_anull = {
.name = "anull",
@@ -29,13 +49,7 @@ AVFilter avfilter_af_anull = {
.priv_size = 0,
- .inputs = (AVFilterPad[]) {{ .name = "default",
- .type = AVMEDIA_TYPE_AUDIO,
- .get_audio_buffer = avfilter_null_get_audio_buffer,
- .filter_samples = avfilter_null_filter_samples },
- { .name = NULL}},
+ .inputs = avfilter_af_anull_inputs,
- .outputs = (AVFilterPad[]) {{ .name = "default",
- .type = AVMEDIA_TYPE_AUDIO, },
- { .name = NULL}},
+ .outputs = avfilter_af_anull_outputs,
};
diff --git a/gst-libs/ext/libav/libavfilter/af_ashowinfo.c b/gst-libs/ext/libav/libavfilter/af_ashowinfo.c
new file mode 100644
index 0000000..c8e830e
--- /dev/null
+++ b/gst-libs/ext/libav/libavfilter/af_ashowinfo.c
@@ -0,0 +1,137 @@
+/*
+ * Copyright (c) 2011 Stefano Sabatini
+ *
+ * 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
+ * filter for showing textual audio frame information
+ */
+
+#include <inttypes.h>
+#include <stddef.h>
+
+#include "libavutil/adler32.h"
+#include "libavutil/channel_layout.h"
+#include "libavutil/common.h"
+#include "libavutil/mem.h"
+#include "libavutil/samplefmt.h"
+
+#include "audio.h"
+#include "avfilter.h"
+#include "internal.h"
+
+typedef struct AShowInfoContext {
+ /**
+ * Scratch space for individual plane checksums for planar audio
+ */
+ uint32_t *plane_checksums;
+
+ /**
+ * Frame counter
+ */
+ uint64_t frame;
+} AShowInfoContext;
+
+static int config_input(AVFilterLink *inlink)
+{
+ AShowInfoContext *s = inlink->dst->priv;
+ int channels = av_get_channel_layout_nb_channels(inlink->channel_layout);
+ s->plane_checksums = av_malloc(channels * sizeof(*s->plane_checksums));
+ if (!s->plane_checksums)
+ return AVERROR(ENOMEM);
+
+ return 0;
+}
+
+static void uninit(AVFilterContext *ctx)
+{
+ AShowInfoContext *s = ctx->priv;
+ av_freep(&s->plane_checksums);
+}
+
+static int filter_frame(AVFilterLink *inlink, AVFilterBufferRef *buf)
+{
+ AVFilterContext *ctx = inlink->dst;
+ AShowInfoContext *s = ctx->priv;
+ char chlayout_str[128];
+ uint32_t checksum = 0;
+ int channels = av_get_channel_layout_nb_channels(buf->audio->channel_layout);
+ int planar = av_sample_fmt_is_planar(buf->format);
+ int block_align = av_get_bytes_per_sample(buf->format) * (planar ? 1 : channels);
+ int data_size = buf->audio->nb_samples * block_align;
+ int planes = planar ? channels : 1;
+ int i;
+
+ for (i = 0; i < planes; i++) {
+ uint8_t *data = buf->extended_data[i];
+
+ s->plane_checksums[i] = av_adler32_update(0, data, data_size);
+ checksum = i ? av_adler32_update(checksum, data, data_size) :
+ s->plane_checksums[0];
+ }
+
+ av_get_channel_layout_string(chlayout_str, sizeof(chlayout_str), -1,
+ buf->audio->channel_layout);
+
+ av_log(ctx, AV_LOG_INFO,
+ "n:%"PRIu64" pts:%"PRId64" pts_time:%f "
+ "fmt:%s chlayout:%s rate:%d nb_samples:%d "
+ "checksum:%08X ",
+ s->frame, buf->pts, buf->pts * av_q2d(inlink->time_base),
+ av_get_sample_fmt_name(buf->format), chlayout_str,
+ buf->audio->sample_rate, buf->audio->nb_samples,
+ checksum);
+
+ av_log(ctx, AV_LOG_INFO, "plane_checksums: [ ");
+ for (i = 0; i < planes; i++)
+ av_log(ctx, AV_LOG_INFO, "%08X ", s->plane_checksums[i]);
+ av_log(ctx, AV_LOG_INFO, "]\n");
+
+ s->frame++;
+ return ff_filter_frame(inlink->dst->outputs[0], buf);
+}
+
+static const AVFilterPad inputs[] = {
+ {
+ .name = "default",
+ .type = AVMEDIA_TYPE_AUDIO,
+ .get_audio_buffer = ff_null_get_audio_buffer,
+ .config_props = config_input,
+ .filter_frame = filter_frame,
+ .min_perms = AV_PERM_READ,
+ },
+ { NULL },
+};
+
+static const AVFilterPad outputs[] = {
+ {
+ .name = "default",
+ .type = AVMEDIA_TYPE_AUDIO,
+ },
+ { NULL },
+};
+
+AVFilter avfilter_af_ashowinfo = {
+ .name = "ashowinfo",
+ .description = NULL_IF_CONFIG_SMALL("Show textual information for each audio frame."),
+ .priv_size = sizeof(AShowInfoContext),
+ .uninit = uninit,
+ .inputs = inputs,
+ .outputs = outputs,
+};
diff --git a/gst-libs/ext/libav/libavfilter/af_asyncts.c b/gst-libs/ext/libav/libavfilter/af_asyncts.c
new file mode 100644
index 0000000..3ebe3b5
--- /dev/null
+++ b/gst-libs/ext/libav/libavfilter/af_asyncts.c
@@ -0,0 +1,319 @@
+/*
+ * 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
+ */
+
+#include "libavresample/avresample.h"
+#include "libavutil/audio_fifo.h"
+#include "libavutil/common.h"
+#include "libavutil/mathematics.h"
+#include "libavutil/opt.h"
+#include "libavutil/samplefmt.h"
+
+#include "audio.h"
+#include "avfilter.h"
+#include "internal.h"
+
+typedef struct ASyncContext {
+ const AVClass *class;
+
+ AVAudioResampleContext *avr;
+ int64_t pts; ///< timestamp in samples of the first sample in fifo
+ int min_delta; ///< pad/trim min threshold in samples
+ int first_frame; ///< 1 until filter_frame() has processed at least 1 frame with a pts != AV_NOPTS_VALUE
+ int64_t first_pts; ///< user-specified first expected pts, in samples
+
+ /* options */
+ int resample;
+ float min_delta_sec;
+ int max_comp;
+
+ /* set by filter_frame() to signal an output frame to request_frame() */
+ int got_output;
+} ASyncContext;
+
+#define OFFSET(x) offsetof(ASyncContext, x)
+#define A AV_OPT_FLAG_AUDIO_PARAM
+static const AVOption options[] = {
+ { "compensate", "Stretch/squeeze the data to make it match the timestamps", OFFSET(resample), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, A },
+ { "min_delta", "Minimum difference between timestamps and audio data "
+ "(in seconds) to trigger padding/trimmin the data.", OFFSET(min_delta_sec), AV_OPT_TYPE_FLOAT, { .dbl = 0.1 }, 0, INT_MAX, A },
+ { "max_comp", "Maximum compensation in samples per second.", OFFSET(max_comp), AV_OPT_TYPE_INT, { .i64 = 500 }, 0, INT_MAX, A },
+ { "first_pts", "Assume the first pts should be this value.", OFFSET(first_pts), AV_OPT_TYPE_INT64, { .i64 = AV_NOPTS_VALUE }, INT64_MIN, INT64_MAX, A },
+ { NULL },
+};
+
+static const AVClass async_class = {
+ .class_name = "asyncts filter",
+ .item_name = av_default_item_name,
+ .option = options,
+ .version = LIBAVUTIL_VERSION_INT,
+};
+
+static int init(AVFilterContext *ctx, const char *args)
+{
+ ASyncContext *s = ctx->priv;
+ int ret;
+
+ s->class = &async_class;
+ av_opt_set_defaults(s);
+
+ if ((ret = av_set_options_string(s, args, "=", ":")) < 0) {
+ av_log(ctx, AV_LOG_ERROR, "Error parsing options string '%s'.\n", args);
+ return ret;
+ }
+ av_opt_free(s);
+
+ s->pts = AV_NOPTS_VALUE;
+ s->first_frame = 1;
+
+ return 0;
+}
+
+static void uninit(AVFilterContext *ctx)
+{
+ ASyncContext *s = ctx->priv;
+
+ if (s->avr) {
+ avresample_close(s->avr);
+ avresample_free(&s->avr);
+ }
+}
+
+static int config_props(AVFilterLink *link)
+{
+ ASyncContext *s = link->src->priv;
+ int ret;
+
+ s->min_delta = s->min_delta_sec * link->sample_rate;
+ link->time_base = (AVRational){1, link->sample_rate};
+
+ s->avr = avresample_alloc_context();
+ if (!s->avr)
+ return AVERROR(ENOMEM);
+
+ av_opt_set_int(s->avr, "in_channel_layout", link->channel_layout, 0);
+ av_opt_set_int(s->avr, "out_channel_layout", link->channel_layout, 0);
+ av_opt_set_int(s->avr, "in_sample_fmt", link->format, 0);
+ av_opt_set_int(s->avr, "out_sample_fmt", link->format, 0);
+ av_opt_set_int(s->avr, "in_sample_rate", link->sample_rate, 0);
+ av_opt_set_int(s->avr, "out_sample_rate", link->sample_rate, 0);
+
+ if (s->resample)
+ av_opt_set_int(s->avr, "force_resampling", 1, 0);
+
+ if ((ret = avresample_open(s->avr)) < 0)
+ return ret;
+
+ return 0;
+}
+
+/* get amount of data currently buffered, in samples */
+static int64_t get_delay(ASyncContext *s)
+{
+ return avresample_available(s->avr) + avresample_get_delay(s->avr);
+}
+
+static void handle_trimming(AVFilterContext *ctx)
+{
+ ASyncContext *s = ctx->priv;
+
+ if (s->pts < s->first_pts) {
+ int delta = FFMIN(s->first_pts - s->pts, avresample_available(s->avr));
+ av_log(ctx, AV_LOG_VERBOSE, "Trimming %d samples from start\n",
+ delta);
+ avresample_read(s->avr, NULL, delta);
+ s->pts += delta;
+ } else if (s->first_frame)
+ s->pts = s->first_pts;
+}
+
+static int request_frame(AVFilterLink *link)
+{
+ AVFilterContext *ctx = link->src;
+ ASyncContext *s = ctx->priv;
+ int ret = 0;
+ int nb_samples;
+
+ s->got_output = 0;
+ while (ret >= 0 && !s->got_output)
+ ret = ff_request_frame(ctx->inputs[0]);
+
+ /* flush the fifo */
+ if (ret == AVERROR_EOF) {
+ if (s->first_pts != AV_NOPTS_VALUE)
+ handle_trimming(ctx);
+
+ if (nb_samples = get_delay(s)) {
+ AVFilterBufferRef *buf = ff_get_audio_buffer(link, AV_PERM_WRITE,
+ nb_samples);
+ if (!buf)
+ return AVERROR(ENOMEM);
+ ret = avresample_convert(s->avr, buf->extended_data,
+ buf->linesize[0], nb_samples, NULL, 0, 0);
+ if (ret <= 0) {
+ avfilter_unref_bufferp(&buf);
+ return (ret < 0) ? ret : AVERROR_EOF;
+ }
+
+ buf->pts = s->pts;
+ return ff_filter_frame(link, buf);
+ }
+ }
+
+ return ret;
+}
+
+static int write_to_fifo(ASyncContext *s, AVFilterBufferRef *buf)
+{
+ int ret = avresample_convert(s->avr, NULL, 0, 0, buf->extended_data,
+ buf->linesize[0], buf->audio->nb_samples);
+ avfilter_unref_buffer(buf);
+ return ret;
+}
+
+static int filter_frame(AVFilterLink *inlink, AVFilterBufferRef *buf)
+{
+ AVFilterContext *ctx = inlink->dst;
+ ASyncContext *s = ctx->priv;
+ AVFilterLink *outlink = ctx->outputs[0];
+ int nb_channels = av_get_channel_layout_nb_channels(buf->audio->channel_layout);
+ int64_t pts = (buf->pts == AV_NOPTS_VALUE) ? buf->pts :
+ av_rescale_q(buf->pts, inlink->time_base, outlink->time_base);
+ int out_size, ret;
+ int64_t delta;
+
+ /* buffer data until we get the next timestamp */
+ if (s->pts == AV_NOPTS_VALUE || pts == AV_NOPTS_VALUE) {
+ if (pts != AV_NOPTS_VALUE) {
+ s->pts = pts - get_delay(s);
+ }
+ return write_to_fifo(s, buf);
+ }
+
+ if (s->first_pts != AV_NOPTS_VALUE) {
+ handle_trimming(ctx);
+ if (!avresample_available(s->avr))
+ return write_to_fifo(s, buf);
+ }
+
+ /* when we have two timestamps, compute how many samples would we have
+ * to add/remove to get proper sync between data and timestamps */
+ delta = pts - s->pts - get_delay(s);
+ out_size = avresample_available(s->avr);
+
+ if (labs(delta) > s->min_delta ||
+ (s->first_frame && delta && s->first_pts != AV_NOPTS_VALUE)) {
+ av_log(ctx, AV_LOG_VERBOSE, "Discontinuity - %"PRId64" samples.\n", delta);
+ out_size = av_clipl_int32((int64_t)out_size + delta);
+ } else {
+ if (s->resample) {
+ int comp = av_clip(delta, -s->max_comp, s->max_comp);
+ av_log(ctx, AV_LOG_VERBOSE, "Compensating %d samples per second.\n", comp);
+ avresample_set_compensation(s->avr, comp, inlink->sample_rate);
+ }
+ delta = 0;
+ }
+
+ if (out_size > 0) {
+ AVFilterBufferRef *buf_out = ff_get_audio_buffer(outlink, AV_PERM_WRITE,
+ out_size);
+ if (!buf_out) {
+ ret = AVERROR(ENOMEM);
+ goto fail;
+ }
+
+ if (s->first_frame && delta > 0) {
+ int planar = av_sample_fmt_is_planar(buf_out->format);
+ int planes = planar ? nb_channels : 1;
+ int block_size = av_get_bytes_per_sample(buf_out->format) *
+ (planar ? 1 : nb_channels);
+
+ int ch;
+
+ av_samples_set_silence(buf_out->extended_data, 0, delta,
+ nb_channels, buf->format);
+
+ for (ch = 0; ch < planes; ch++)
+ buf_out->extended_data[ch] += delta * block_size;
+
+ avresample_read(s->avr, buf_out->extended_data, out_size);
+
+ for (ch = 0; ch < planes; ch++)
+ buf_out->extended_data[ch] -= delta * block_size;
+ } else {
+ avresample_read(s->avr, buf_out->extended_data, out_size);
+
+ if (delta > 0) {
+ av_samples_set_silence(buf_out->extended_data, out_size - delta,
+ delta, nb_channels, buf->format);
+ }
+ }
+ buf_out->pts = s->pts;
+ ret = ff_filter_frame(outlink, buf_out);
+ if (ret < 0)
+ goto fail;
+ s->got_output = 1;
+ } else if (avresample_available(s->avr)) {
+ av_log(ctx, AV_LOG_WARNING, "Non-monotonous timestamps, dropping "
+ "whole buffer.\n");
+ }
+
+ /* drain any remaining buffered data */
+ avresample_read(s->avr, NULL, avresample_available(s->avr));
+
+ s->pts = pts - avresample_get_delay(s->avr);
+ ret = avresample_convert(s->avr, NULL, 0, 0, buf->extended_data,
+ buf->linesize[0], buf->audio->nb_samples);
+
+ s->first_frame = 0;
+fail:
+ avfilter_unref_buffer(buf);
+
+ return ret;
+}
+
+static const AVFilterPad avfilter_af_asyncts_inputs[] = {
+ {
+ .name = "default",
+ .type = AVMEDIA_TYPE_AUDIO,
+ .filter_frame = filter_frame,
+ },
+ { NULL }
+};
+
+static const AVFilterPad avfilter_af_asyncts_outputs[] = {
+ {
+ .name = "default",
+ .type = AVMEDIA_TYPE_AUDIO,
+ .config_props = config_props,
+ .request_frame = request_frame
+ },
+ { NULL }
+};
+
+AVFilter avfilter_af_asyncts = {
+ .name = "asyncts",
+ .description = NULL_IF_CONFIG_SMALL("Sync audio data to timestamps"),
+
+ .init = init,
+ .uninit = uninit,
+
+ .priv_size = sizeof(ASyncContext),
+
+ .inputs = avfilter_af_asyncts_inputs,
+ .outputs = avfilter_af_asyncts_outputs,
+};
diff --git a/gst-libs/ext/libav/libavfilter/af_channelmap.c b/gst-libs/ext/libav/libavfilter/af_channelmap.c
new file mode 100644
index 0000000..c4b87da
--- /dev/null
+++ b/gst-libs/ext/libav/libavfilter/af_channelmap.c
@@ -0,0 +1,424 @@
+/*
+ * Copyright (c) 2012 Google, Inc.
+ *
+ * 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
+ * audio channel mapping filter
+ */
+
+#include <ctype.h>
+
+#include "libavutil/avstring.h"
+#include "libavutil/channel_layout.h"
+#include "libavutil/common.h"
+#include "libavutil/mathematics.h"
+#include "libavutil/opt.h"
+#include "libavutil/samplefmt.h"
+
+#include "audio.h"
+#include "avfilter.h"
+#include "formats.h"
+#include "internal.h"
+
+struct ChannelMap {
+ uint64_t in_channel;
+ uint64_t out_channel;
+ int in_channel_idx;
+ int out_channel_idx;
+};
+
+enum MappingMode {
+ MAP_NONE,
+ MAP_ONE_INT,
+ MAP_ONE_STR,
+ MAP_PAIR_INT_INT,
+ MAP_PAIR_INT_STR,
+ MAP_PAIR_STR_INT,
+ MAP_PAIR_STR_STR
+};
+
+#define MAX_CH 64
+typedef struct ChannelMapContext {
+ const AVClass *class;
+ AVFilterChannelLayouts *channel_layouts;
+ char *mapping_str;
+ char *channel_layout_str;
+ uint64_t output_layout;
+ struct ChannelMap map[MAX_CH];
+ int nch;
+ enum MappingMode mode;
+} ChannelMapContext;
+
+#define OFFSET(x) offsetof(ChannelMapContext, x)
+#define A AV_OPT_FLAG_AUDIO_PARAM
+static const AVOption options[] = {
+ { "map", "A comma-separated list of input channel numbers in output order.",
+ OFFSET(mapping_str), AV_OPT_TYPE_STRING, .flags = A },
+ { "channel_layout", "Output channel layout.",
+ OFFSET(channel_layout_str), AV_OPT_TYPE_STRING, .flags = A },
+ { NULL },
+};
+
+static const AVClass channelmap_class = {
+ .class_name = "channel map filter",
+ .item_name = av_default_item_name,
+ .option = options,
+ .version = LIBAVUTIL_VERSION_INT,
+};
+
+static char* split(char *message, char delim) {
+ char *next = strchr(message, delim);
+ if (next)
+ *next++ = '\0';
+ return next;
+}
+
+static int get_channel_idx(char **map, int *ch, char delim, int max_ch)
+{
+ char *next = split(*map, delim);
+ int len;
+ int n = 0;
+ if (!next && delim == '-')
+ return AVERROR(EINVAL);
+ len = strlen(*map);
+ sscanf(*map, "%d%n", ch, &n);
+ if (n != len)
+ return AVERROR(EINVAL);
+ if (*ch < 0 || *ch > max_ch)
+ return AVERROR(EINVAL);
+ *map = next;
+ return 0;
+}
+
+static int get_channel(char **map, uint64_t *ch, char delim)
+{
+ char *next = split(*map, delim);
+ if (!next && delim == '-')
+ return AVERROR(EINVAL);
+ *ch = av_get_channel_layout(*map);
+ if (av_get_channel_layout_nb_channels(*ch) != 1)
+ return AVERROR(EINVAL);
+ *map = next;
+ return 0;
+}
+
+static av_cold int channelmap_init(AVFilterContext *ctx, const char *args)
+{
+ ChannelMapContext *s = ctx->priv;
+ int ret;
+ char *mapping;
+ int map_entries = 0;
+ char buf[256];
+ enum MappingMode mode;
+ uint64_t out_ch_mask = 0;
+ int i;
+
+ if (!args) {
+ av_log(ctx, AV_LOG_ERROR, "No parameters supplied.\n");
+ return AVERROR(EINVAL);
+ }
+
+ s->class = &channelmap_class;
+ av_opt_set_defaults(s);
+
+ if ((ret = av_set_options_string(s, args, "=", ":")) < 0) {
+ av_log(ctx, AV_LOG_ERROR, "Error parsing options string '%s'.\n", args);
+ return ret;
+ }
+
+ mapping = s->mapping_str;
+
+ if (!mapping) {
+ mode = MAP_NONE;
+ } else {
+ char *dash = strchr(mapping, '-');
+ if (!dash) { // short mapping
+ if (isdigit(*mapping))
+ mode = MAP_ONE_INT;
+ else
+ mode = MAP_ONE_STR;
+ } else if (isdigit(*mapping)) {
+ if (isdigit(*(dash+1)))
+ mode = MAP_PAIR_INT_INT;
+ else
+ mode = MAP_PAIR_INT_STR;
+ } else {
+ if (isdigit(*(dash+1)))
+ mode = MAP_PAIR_STR_INT;
+ else
+ mode = MAP_PAIR_STR_STR;
+ }
+ }
+
+ if (mode != MAP_NONE) {
+ char *comma = mapping;
+ map_entries = 1;
+ while ((comma = strchr(comma, ','))) {
+ if (*++comma) // Allow trailing comma
+ map_entries++;
+ }
+ }
+
+ if (map_entries > MAX_CH) {
+ av_log(ctx, AV_LOG_ERROR, "Too many channels mapped: '%d'.\n", map_entries);
+ ret = AVERROR(EINVAL);
+ goto fail;
+ }
+
+ for (i = 0; i < map_entries; i++) {
+ int in_ch_idx = -1, out_ch_idx = -1;
+ uint64_t in_ch = 0, out_ch = 0;
+ static const char err[] = "Failed to parse channel map\n";
+ switch (mode) {
+ case MAP_ONE_INT:
+ if (get_channel_idx(&mapping, &in_ch_idx, ',', MAX_CH) < 0) {
+ ret = AVERROR(EINVAL);
+ av_log(ctx, AV_LOG_ERROR, err);
+ goto fail;
+ }
+ s->map[i].in_channel_idx = in_ch_idx;
+ s->map[i].out_channel_idx = i;
+ break;
+ case MAP_ONE_STR:
+ if (!get_channel(&mapping, &in_ch, ',')) {
+ av_log(ctx, AV_LOG_ERROR, err);
+ ret = AVERROR(EINVAL);
+ goto fail;
+ }
+ s->map[i].in_channel = in_ch;
+ s->map[i].out_channel_idx = i;
+ break;
+ case MAP_PAIR_INT_INT:
+ if (get_channel_idx(&mapping, &in_ch_idx, '-', MAX_CH) < 0 ||
+ get_channel_idx(&mapping, &out_ch_idx, ',', MAX_CH) < 0) {
+ av_log(ctx, AV_LOG_ERROR, err);
+ ret = AVERROR(EINVAL);
+ goto fail;
+ }
+ s->map[i].in_channel_idx = in_ch_idx;
+ s->map[i].out_channel_idx = out_ch_idx;
+ break;
+ case MAP_PAIR_INT_STR:
+ if (get_channel_idx(&mapping, &in_ch_idx, '-', MAX_CH) < 0 ||
+ get_channel(&mapping, &out_ch, ',') < 0 ||
+ out_ch & out_ch_mask) {
+ av_log(ctx, AV_LOG_ERROR, err);
+ ret = AVERROR(EINVAL);
+ goto fail;
+ }
+ s->map[i].in_channel_idx = in_ch_idx;
+ s->map[i].out_channel = out_ch;
+ out_ch_mask |= out_ch;
+ break;
+ case MAP_PAIR_STR_INT:
+ if (get_channel(&mapping, &in_ch, '-') < 0 ||
+ get_channel_idx(&mapping, &out_ch_idx, ',', MAX_CH) < 0) {
+ av_log(ctx, AV_LOG_ERROR, err);
+ ret = AVERROR(EINVAL);
+ goto fail;
+ }
+ s->map[i].in_channel = in_ch;
+ s->map[i].out_channel_idx = out_ch_idx;
+ break;
+ case MAP_PAIR_STR_STR:
+ if (get_channel(&mapping, &in_ch, '-') < 0 ||
+ get_channel(&mapping, &out_ch, ',') < 0 ||
+ out_ch & out_ch_mask) {
+ av_log(ctx, AV_LOG_ERROR, err);
+ ret = AVERROR(EINVAL);
+ goto fail;
+ }
+ s->map[i].in_channel = in_ch;
+ s->map[i].out_channel = out_ch;
+ out_ch_mask |= out_ch;
+ break;
+ }
+ }
+ s->mode = mode;
+ s->nch = map_entries;
+ s->output_layout = out_ch_mask ? out_ch_mask :
+ av_get_default_channel_layout(map_entries);
+
+ if (s->channel_layout_str) {
+ uint64_t fmt;
+ if ((fmt = av_get_channel_layout(s->channel_layout_str)) == 0) {
+ av_log(ctx, AV_LOG_ERROR, "Error parsing channel layout: '%s'.\n",
+ s->channel_layout_str);
+ ret = AVERROR(EINVAL);
+ goto fail;
+ }
+ if (mode == MAP_NONE) {
+ int i;
+ s->nch = av_get_channel_layout_nb_channels(fmt);
+ for (i = 0; i < s->nch; i++) {
+ s->map[i].in_channel_idx = i;
+ s->map[i].out_channel_idx = i;
+ }
+ } else if (out_ch_mask && out_ch_mask != fmt) {
+ av_get_channel_layout_string(buf, sizeof(buf), 0, out_ch_mask);
+ av_log(ctx, AV_LOG_ERROR,
+ "Output channel layout '%s' does not match the list of channel mapped: '%s'.\n",
+ s->channel_layout_str, buf);
+ ret = AVERROR(EINVAL);
+ goto fail;
+ } else if (s->nch != av_get_channel_layout_nb_channels(fmt)) {
+ av_log(ctx, AV_LOG_ERROR,
+ "Output channel layout %s does not match the number of channels mapped %d.\n",
+ s->channel_layout_str, s->nch);
+ ret = AVERROR(EINVAL);
+ goto fail;
+ }
+ s->output_layout = fmt;
+ }
+ ff_add_channel_layout(&s->channel_layouts, s->output_layout);
+
+ if (mode == MAP_PAIR_INT_STR || mode == MAP_PAIR_STR_STR) {
+ for (i = 0; i < s->nch; i++) {
+ s->map[i].out_channel_idx = av_get_channel_layout_channel_index(
+ s->output_layout, s->map[i].out_channel);
+ }
+ }
+
+fail:
+ av_opt_free(s);
+ return ret;
+}
+
+static int channelmap_query_formats(AVFilterContext *ctx)
+{
+ ChannelMapContext *s = ctx->priv;
+
+ ff_set_common_formats(ctx, ff_planar_sample_fmts());
+ ff_set_common_samplerates(ctx, ff_all_samplerates());
+ ff_channel_layouts_ref(ff_all_channel_layouts(), &ctx->inputs[0]->out_channel_layouts);
+ ff_channel_layouts_ref(s->channel_layouts, &ctx->outputs[0]->in_channel_layouts);
+
+ return 0;
+}
+
+static int channelmap_filter_frame(AVFilterLink *inlink, AVFilterBufferRef *buf)
+{
+ AVFilterContext *ctx = inlink->dst;
+ AVFilterLink *outlink = ctx->outputs[0];
+ const ChannelMapContext *s = ctx->priv;
+ const int nch_in = av_get_channel_layout_nb_channels(inlink->channel_layout);
+ const int nch_out = s->nch;
+ int ch;
+ uint8_t *source_planes[MAX_CH];
+
+ memcpy(source_planes, buf->extended_data,
+ nch_in * sizeof(source_planes[0]));
+
+ if (nch_out > nch_in) {
+ if (nch_out > FF_ARRAY_ELEMS(buf->data)) {
+ uint8_t **new_extended_data =
+ av_mallocz(nch_out * sizeof(*buf->extended_data));
+ if (!new_extended_data) {
+ avfilter_unref_buffer(buf);
+ return AVERROR(ENOMEM);
+ }
+ if (buf->extended_data == buf->data) {
+ buf->extended_data = new_extended_data;
+ } else {
+ av_free(buf->extended_data);
+ buf->extended_data = new_extended_data;
+ }
+ } else if (buf->extended_data != buf->data) {
+ av_free(buf->extended_data);
+ buf->extended_data = buf->data;
+ }
+ }
+
+ for (ch = 0; ch < nch_out; ch++) {
+ buf->extended_data[s->map[ch].out_channel_idx] =
+ source_planes[s->map[ch].in_channel_idx];
+ }
+
+ if (buf->data != buf->extended_data)
+ memcpy(buf->data, buf->extended_data,
+ FFMIN(FF_ARRAY_ELEMS(buf->data), nch_out) * sizeof(buf->data[0]));
+
+ return ff_filter_frame(outlink, buf);
+}
+
+static int channelmap_config_input(AVFilterLink *inlink)
+{
+ AVFilterContext *ctx = inlink->dst;
+ ChannelMapContext *s = ctx->priv;
+ int nb_channels = av_get_channel_layout_nb_channels(inlink->channel_layout);
+ int i, err = 0;
+ const char *channel_name;
+ char layout_name[256];
+
+ for (i = 0; i < s->nch; i++) {
+ if (s->mode == MAP_PAIR_STR_INT || s->mode == MAP_PAIR_STR_STR) {
+ s->map[i].in_channel_idx = av_get_channel_layout_channel_index(
+ inlink->channel_layout, s->map[i].in_channel);
+ }
+
+ if (s->map[i].in_channel_idx < 0 ||
+ s->map[i].in_channel_idx >= nb_channels) {
+ av_get_channel_layout_string(layout_name, sizeof(layout_name),
+ 0, inlink->channel_layout);
+ if (s->map[i].in_channel) {
+ channel_name = av_get_channel_name(s->map[i].in_channel);
+ av_log(ctx, AV_LOG_ERROR,
+ "input channel '%s' not available from input layout '%s'\n",
+ channel_name, layout_name);
+ } else {
+ av_log(ctx, AV_LOG_ERROR,
+ "input channel #%d not available from input layout '%s'\n",
+ s->map[i].in_channel_idx, layout_name);
+ }
+ err = AVERROR(EINVAL);
+ }
+ }
+
+ return err;
+}
+
+static const AVFilterPad avfilter_af_channelmap_inputs[] = {
+ {
+ .name = "default",
+ .type = AVMEDIA_TYPE_AUDIO,
+ .filter_frame = channelmap_filter_frame,
+ .config_props = channelmap_config_input
+ },
+ { NULL }
+};
+
+static const AVFilterPad avfilter_af_channelmap_outputs[] = {
+ {
+ .name = "default",
+ .type = AVMEDIA_TYPE_AUDIO
+ },
+ { NULL }
+};
+
+AVFilter avfilter_af_channelmap = {
+ .name = "channelmap",
+ .description = NULL_IF_CONFIG_SMALL("Remap audio channels."),
+ .init = channelmap_init,
+ .query_formats = channelmap_query_formats,
+ .priv_size = sizeof(ChannelMapContext),
+
+ .inputs = avfilter_af_channelmap_inputs,
+ .outputs = avfilter_af_channelmap_outputs,
+};
diff --git a/gst-libs/ext/libav/libavfilter/af_channelsplit.c b/gst-libs/ext/libav/libavfilter/af_channelsplit.c
new file mode 100644
index 0000000..cc379f3
--- /dev/null
+++ b/gst-libs/ext/libav/libavfilter/af_channelsplit.c
@@ -0,0 +1,158 @@
+/*
+ * 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
+ * Channel split filter
+ *
+ * Split an audio stream into per-channel streams.
+ */
+
+#include "libavutil/channel_layout.h"
+#include "libavutil/internal.h"
+#include "libavutil/opt.h"
+
+#include "audio.h"
+#include "avfilter.h"
+#include "formats.h"
+#include "internal.h"
+
+typedef struct ChannelSplitContext {
+ const AVClass *class;
+
+ uint64_t channel_layout;
+ char *channel_layout_str;
+} ChannelSplitContext;
+
+#define OFFSET(x) offsetof(ChannelSplitContext, x)
+#define A AV_OPT_FLAG_AUDIO_PARAM
+static const AVOption options[] = {
+ { "channel_layout", "Input channel layout.", OFFSET(channel_layout_str), AV_OPT_TYPE_STRING, { .str = "stereo" }, .flags = A },
+ { NULL },
+};
+
+static const AVClass channelsplit_class = {
+ .class_name = "channelsplit filter",
+ .item_name = av_default_item_name,
+ .option = options,
+ .version = LIBAVUTIL_VERSION_INT,
+};
+
+static int init(AVFilterContext *ctx, const char *arg)
+{
+ ChannelSplitContext *s = ctx->priv;
+ int nb_channels;
+ int ret = 0, i;
+
+ s->class = &channelsplit_class;
+ av_opt_set_defaults(s);
+ if ((ret = av_set_options_string(s, arg, "=", ":")) < 0) {
+ av_log(ctx, AV_LOG_ERROR, "Error parsing options string '%s'.\n", arg);
+ return ret;
+ }
+ if (!(s->channel_layout = av_get_channel_layout(s->channel_layout_str))) {
+ av_log(ctx, AV_LOG_ERROR, "Error parsing channel layout '%s'.\n",
+ s->channel_layout_str);
+ ret = AVERROR(EINVAL);
+ goto fail;
+ }
+
+ nb_channels = av_get_channel_layout_nb_channels(s->channel_layout);
+ for (i = 0; i < nb_channels; i++) {
+ uint64_t channel = av_channel_layout_extract_channel(s->channel_layout, i);
+ AVFilterPad pad = { 0 };
+
+ pad.type = AVMEDIA_TYPE_AUDIO;
+ pad.name = av_get_channel_name(channel);
+
+ ff_insert_outpad(ctx, i, &pad);
+ }
+
+fail:
+ av_opt_free(s);
+ return ret;
+}
+
+static int query_formats(AVFilterContext *ctx)
+{
+ ChannelSplitContext *s = ctx->priv;
+ AVFilterChannelLayouts *in_layouts = NULL;
+ int i;
+
+ ff_set_common_formats (ctx, ff_planar_sample_fmts());
+ ff_set_common_samplerates(ctx, ff_all_samplerates());
+
+ ff_add_channel_layout(&in_layouts, s->channel_layout);
+ ff_channel_layouts_ref(in_layouts, &ctx->inputs[0]->out_channel_layouts);
+
+ for (i = 0; i < ctx->nb_outputs; i++) {
+ AVFilterChannelLayouts *out_layouts = NULL;
+ uint64_t channel = av_channel_layout_extract_channel(s->channel_layout, i);
+
+ ff_add_channel_layout(&out_layouts, channel);
+ ff_channel_layouts_ref(out_layouts, &ctx->outputs[i]->in_channel_layouts);
+ }
+
+ return 0;
+}
+
+static int filter_frame(AVFilterLink *inlink, AVFilterBufferRef *buf)
+{
+ AVFilterContext *ctx = inlink->dst;
+ int i, ret = 0;
+
+ for (i = 0; i < ctx->nb_outputs; i++) {
+ AVFilterBufferRef *buf_out = avfilter_ref_buffer(buf, ~AV_PERM_WRITE);
+
+ if (!buf_out) {
+ ret = AVERROR(ENOMEM);
+ break;
+ }
+
+ buf_out->data[0] = buf_out->extended_data[0] = buf_out->extended_data[i];
+ buf_out->audio->channel_layout =
+ av_channel_layout_extract_channel(buf->audio->channel_layout, i);
+
+ ret = ff_filter_frame(ctx->outputs[i], buf_out);
+ if (ret < 0)
+ break;
+ }
+ avfilter_unref_buffer(buf);
+ return ret;
+}
+
+static const AVFilterPad avfilter_af_channelsplit_inputs[] = {
+ {
+ .name = "default",
+ .type = AVMEDIA_TYPE_AUDIO,
+ .filter_frame = filter_frame,
+ },
+ { NULL }
+};
+
+AVFilter avfilter_af_channelsplit = {
+ .name = "channelsplit",
+ .description = NULL_IF_CONFIG_SMALL("Split audio into per-channel streams"),
+ .priv_size = sizeof(ChannelSplitContext),
+
+ .init = init,
+ .query_formats = query_formats,
+
+ .inputs = avfilter_af_channelsplit_inputs,
+ .outputs = NULL,
+};
diff --git a/gst-libs/ext/libav/libavfilter/af_join.c b/gst-libs/ext/libav/libavfilter/af_join.c
new file mode 100644
index 0000000..2b715d5
--- /dev/null
+++ b/gst-libs/ext/libav/libavfilter/af_join.c
@@ -0,0 +1,510 @@
+/*
+ *
+ * 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
+ * Audio join filter
+ *
+ * Join multiple audio inputs as different channels in
+ * a single output
+ */
+
+#include "libavutil/avassert.h"
+#include "libavutil/channel_layout.h"
+#include "libavutil/common.h"
+#include "libavutil/opt.h"
+
+#include "audio.h"
+#include "avfilter.h"
+#include "formats.h"
+#include "internal.h"
+
+typedef struct ChannelMap {
+ int input; ///< input stream index
+ int in_channel_idx; ///< index of in_channel in the input stream data
+ uint64_t in_channel; ///< layout describing the input channel
+ uint64_t out_channel; ///< layout describing the output channel
+} ChannelMap;
+
+typedef struct JoinContext {
+ const AVClass *class;
+
+ int inputs;
+ char *map;
+ char *channel_layout_str;
+ uint64_t channel_layout;
+
+ int nb_channels;
+ ChannelMap *channels;
+
+ /**
+ * Temporary storage for input frames, until we get one on each input.
+ */
+ AVFilterBufferRef **input_frames;
+
+ /**
+ * Temporary storage for data pointers, for assembling the output buffer.
+ */
+ uint8_t **data;
+} JoinContext;
+
+/**
+ * To avoid copying the data from input buffers, this filter creates
+ * a custom output buffer that stores references to all inputs and
+ * unrefs them on free.
+ */
+typedef struct JoinBufferPriv {
+ AVFilterBufferRef **in_buffers;
+ int nb_in_buffers;
+} JoinBufferPriv;
+
+#define OFFSET(x) offsetof(JoinContext, x)
+#define A AV_OPT_FLAG_AUDIO_PARAM
+static const AVOption join_options[] = {
+ { "inputs", "Number of input streams.", OFFSET(inputs), AV_OPT_TYPE_INT, { .i64 = 2 }, 1, INT_MAX, A },
+ { "channel_layout", "Channel layout of the "
+ "output stream.", OFFSET(channel_layout_str), AV_OPT_TYPE_STRING, {.str = "stereo"}, 0, 0, A },
+ { "map", "A comma-separated list of channels maps in the format "
+ "'input_stream.input_channel-output_channel.",
+ OFFSET(map), AV_OPT_TYPE_STRING, .flags = A },
+ { NULL },
+};
+
+static const AVClass join_class = {
+ .class_name = "join filter",
+ .item_name = av_default_item_name,
+ .option = join_options,
+ .version = LIBAVUTIL_VERSION_INT,
+};
+
+static int filter_frame(AVFilterLink *link, AVFilterBufferRef *buf)
+{
+ AVFilterContext *ctx = link->dst;
+ JoinContext *s = ctx->priv;
+ int i;
+
+ for (i = 0; i < ctx->nb_inputs; i++)
+ if (link == ctx->inputs[i])
+ break;
+ av_assert0(i < ctx->nb_inputs);
+ av_assert0(!s->input_frames[i]);
+ s->input_frames[i] = buf;
+
+ return 0;
+}
+
+static int parse_maps(AVFilterContext *ctx)
+{
+ JoinContext *s = ctx->priv;
+ char *cur = s->map;
+
+ while (cur && *cur) {
+ char *sep, *next, *p;
+ uint64_t in_channel = 0, out_channel = 0;
+ int input_idx, out_ch_idx, in_ch_idx;
+
+ next = strchr(cur, ',');
+ if (next)
+ *next++ = 0;
+
+ /* split the map into input and output parts */
+ if (!(sep = strchr(cur, '-'))) {
+ av_log(ctx, AV_LOG_ERROR, "Missing separator '-' in channel "
+ "map '%s'\n", cur);
+ return AVERROR(EINVAL);
+ }
+ *sep++ = 0;
+
+#define PARSE_CHANNEL(str, var, inout) \
+ if (!(var = av_get_channel_layout(str))) { \
+ av_log(ctx, AV_LOG_ERROR, "Invalid " inout " channel: %s.\n", str);\
+ return AVERROR(EINVAL); \
+ } \
+ if (av_get_channel_layout_nb_channels(var) != 1) { \
+ av_log(ctx, AV_LOG_ERROR, "Channel map describes more than one " \
+ inout " channel.\n"); \
+ return AVERROR(EINVAL); \
+ }
+
+ /* parse output channel */
+ PARSE_CHANNEL(sep, out_channel, "output");
+ if (!(out_channel & s->channel_layout)) {
+ av_log(ctx, AV_LOG_ERROR, "Output channel '%s' is not present in "
+ "requested channel layout.\n", sep);
+ return AVERROR(EINVAL);
+ }
+
+ out_ch_idx = av_get_channel_layout_channel_index(s->channel_layout,
+ out_channel);
+ if (s->channels[out_ch_idx].input >= 0) {
+ av_log(ctx, AV_LOG_ERROR, "Multiple maps for output channel "
+ "'%s'.\n", sep);
+ return AVERROR(EINVAL);
+ }
+
+ /* parse input channel */
+ input_idx = strtol(cur, &cur, 0);
+ if (input_idx < 0 || input_idx >= s->inputs) {
+ av_log(ctx, AV_LOG_ERROR, "Invalid input stream index: %d.\n",
+ input_idx);
+ return AVERROR(EINVAL);
+ }
+
+ if (*cur)
+ cur++;
+
+ in_ch_idx = strtol(cur, &p, 0);
+ if (p == cur) {
+ /* channel specifier is not a number,
+ * try to parse as channel name */
+ PARSE_CHANNEL(cur, in_channel, "input");
+ }
+
+ s->channels[out_ch_idx].input = input_idx;
+ if (in_channel)
+ s->channels[out_ch_idx].in_channel = in_channel;
+ else
+ s->channels[out_ch_idx].in_channel_idx = in_ch_idx;
+
+ cur = next;
+ }
+ return 0;
+}
+
+static int join_init(AVFilterContext *ctx, const char *args)
+{
+ JoinContext *s = ctx->priv;
+ int ret, i;
+
+ s->class = &join_class;
+ av_opt_set_defaults(s);
+ if ((ret = av_set_options_string(s, args, "=", ":")) < 0) {
+ av_log(ctx, AV_LOG_ERROR, "Error parsing options string '%s'.\n", args);
+ return ret;
+ }
+
+ if (!(s->channel_layout = av_get_channel_layout(s->channel_layout_str))) {
+ av_log(ctx, AV_LOG_ERROR, "Error parsing channel layout '%s'.\n",
+ s->channel_layout_str);
+ ret = AVERROR(EINVAL);
+ goto fail;
+ }
+
+ s->nb_channels = av_get_channel_layout_nb_channels(s->channel_layout);
+ s->channels = av_mallocz(sizeof(*s->channels) * s->nb_channels);
+ s->data = av_mallocz(sizeof(*s->data) * s->nb_channels);
+ s->input_frames = av_mallocz(sizeof(*s->input_frames) * s->inputs);
+ if (!s->channels || !s->data || !s->input_frames) {
+ ret = AVERROR(ENOMEM);
+ goto fail;
+ }
+
+ for (i = 0; i < s->nb_channels; i++) {
+ s->channels[i].out_channel = av_channel_layout_extract_channel(s->channel_layout, i);
+ s->channels[i].input = -1;
+ }
+
+ if ((ret = parse_maps(ctx)) < 0)
+ goto fail;
+
+ for (i = 0; i < s->inputs; i++) {
+ char name[32];
+ AVFilterPad pad = { 0 };
+
+ snprintf(name, sizeof(name), "input%d", i);
+ pad.type = AVMEDIA_TYPE_AUDIO;
+ pad.name = av_strdup(name);
+ pad.filter_frame = filter_frame;
+
+ pad.needs_fifo = 1;
+
+ ff_insert_inpad(ctx, i, &pad);
+ }
+
+fail:
+ av_opt_free(s);
+ return ret;
+}
+
+static void join_uninit(AVFilterContext *ctx)
+{
+ JoinContext *s = ctx->priv;
+ int i;
+
+ for (i = 0; i < ctx->nb_inputs; i++) {
+ av_freep(&ctx->input_pads[i].name);
+ avfilter_unref_bufferp(&s->input_frames[i]);
+ }
+
+ av_freep(&s->channels);
+ av_freep(&s->data);
+ av_freep(&s->input_frames);
+}
+
+static int join_query_formats(AVFilterContext *ctx)
+{
+ JoinContext *s = ctx->priv;
+ AVFilterChannelLayouts *layouts = NULL;
+ int i;
+
+ ff_add_channel_layout(&layouts, s->channel_layout);
+ ff_channel_layouts_ref(layouts, &ctx->outputs[0]->in_channel_layouts);
+
+ for (i = 0; i < ctx->nb_inputs; i++)
+ ff_channel_layouts_ref(ff_all_channel_layouts(),
+ &ctx->inputs[i]->out_channel_layouts);
+
+ ff_set_common_formats (ctx, ff_planar_sample_fmts());
+ ff_set_common_samplerates(ctx, ff_all_samplerates());
+
+ return 0;
+}
+
+static void guess_map_matching(AVFilterContext *ctx, ChannelMap *ch,
+ uint64_t *inputs)
+{
+ int i;
+
+ for (i = 0; i < ctx->nb_inputs; i++) {
+ AVFilterLink *link = ctx->inputs[i];
+
+ if (ch->out_channel & link->channel_layout &&
+ !(ch->out_channel & inputs[i])) {
+ ch->input = i;
+ ch->in_channel = ch->out_channel;
+ inputs[i] |= ch->out_channel;
+ return;
+ }
+ }
+}
+
+static void guess_map_any(AVFilterContext *ctx, ChannelMap *ch,
+ uint64_t *inputs)
+{
+ int i;
+
+ for (i = 0; i < ctx->nb_inputs; i++) {
+ AVFilterLink *link = ctx->inputs[i];
+
+ if ((inputs[i] & link->channel_layout) != link->channel_layout) {
+ uint64_t unused = link->channel_layout & ~inputs[i];
+
+ ch->input = i;
+ ch->in_channel = av_channel_layout_extract_channel(unused, 0);
+ inputs[i] |= ch->in_channel;
+ return;
+ }
+ }
+}
+
+static int join_config_output(AVFilterLink *outlink)
+{
+ AVFilterContext *ctx = outlink->src;
+ JoinContext *s = ctx->priv;
+ uint64_t *inputs; // nth element tracks which channels are used from nth input
+ int i, ret = 0;
+
+ /* initialize inputs to user-specified mappings */
+ if (!(inputs = av_mallocz(sizeof(*inputs) * ctx->nb_inputs)))
+ return AVERROR(ENOMEM);
+ for (i = 0; i < s->nb_channels; i++) {
+ ChannelMap *ch = &s->channels[i];
+ AVFilterLink *inlink;
+
+ if (ch->input < 0)
+ continue;
+
+ inlink = ctx->inputs[ch->input];
+
+ if (!ch->in_channel)
+ ch->in_channel = av_channel_layout_extract_channel(inlink->channel_layout,
+ ch->in_channel_idx);
+
+ if (!(ch->in_channel & inlink->channel_layout)) {
+ av_log(ctx, AV_LOG_ERROR, "Requested channel %s is not present in "
+ "input stream #%d.\n", av_get_channel_name(ch->in_channel),
+ ch->input);
+ ret = AVERROR(EINVAL);
+ goto fail;
+ }
+
+ inputs[ch->input] |= ch->in_channel;
+ }
+
+ /* guess channel maps when not explicitly defined */
+ /* first try unused matching channels */
+ for (i = 0; i < s->nb_channels; i++) {
+ ChannelMap *ch = &s->channels[i];
+
+ if (ch->input < 0)
+ guess_map_matching(ctx, ch, inputs);
+ }
+
+ /* if the above failed, try to find _any_ unused input channel */
+ for (i = 0; i < s->nb_channels; i++) {
+ ChannelMap *ch = &s->channels[i];
+
+ if (ch->input < 0)
+ guess_map_any(ctx, ch, inputs);
+
+ if (ch->input < 0) {
+ av_log(ctx, AV_LOG_ERROR, "Could not find input channel for "
+ "output channel '%s'.\n",
+ av_get_channel_name(ch->out_channel));
+ goto fail;
+ }
+
+ ch->in_channel_idx = av_get_channel_layout_channel_index(ctx->inputs[ch->input]->channel_layout,
+ ch->in_channel);
+ }
+
+ /* print mappings */
+ av_log(ctx, AV_LOG_VERBOSE, "mappings: ");
+ for (i = 0; i < s->nb_channels; i++) {
+ ChannelMap *ch = &s->channels[i];
+ av_log(ctx, AV_LOG_VERBOSE, "%d.%s => %s ", ch->input,
+ av_get_channel_name(ch->in_channel),
+ av_get_channel_name(ch->out_channel));
+ }
+ av_log(ctx, AV_LOG_VERBOSE, "\n");
+
+ for (i = 0; i < ctx->nb_inputs; i++) {
+ if (!inputs[i])
+ av_log(ctx, AV_LOG_WARNING, "No channels are used from input "
+ "stream %d.\n", i);
+ }
+
+fail:
+ av_freep(&inputs);
+ return ret;
+}
+
+static void join_free_buffer(AVFilterBuffer *buf)
+{
+ JoinBufferPriv *priv = buf->priv;
+
+ if (priv) {
+ int i;
+
+ for (i = 0; i < priv->nb_in_buffers; i++)
+ avfilter_unref_bufferp(&priv->in_buffers[i]);
+
+ av_freep(&priv->in_buffers);
+ av_freep(&buf->priv);
+ }
+
+ if (buf->extended_data != buf->data)
+ av_freep(&buf->extended_data);
+ av_freep(&buf);
+}
+
+static int join_request_frame(AVFilterLink *outlink)
+{
+ AVFilterContext *ctx = outlink->src;
+ JoinContext *s = ctx->priv;
+ AVFilterBufferRef *buf;
+ JoinBufferPriv *priv;
+ int linesize = INT_MAX;
+ int perms = ~0;
+ int nb_samples = 0;
+ int i, j, ret;
+
+ /* get a frame on each input */
+ for (i = 0; i < ctx->nb_inputs; i++) {
+ AVFilterLink *inlink = ctx->inputs[i];
+
+ if (!s->input_frames[i] &&
+ (ret = ff_request_frame(inlink)) < 0)
+ return ret;
+
+ /* request the same number of samples on all inputs */
+ if (i == 0) {
+ nb_samples = s->input_frames[0]->audio->nb_samples;
+
+ for (j = 1; !i && j < ctx->nb_inputs; j++)
+ ctx->inputs[j]->request_samples = nb_samples;
+ }
+ }
+
+ for (i = 0; i < s->nb_channels; i++) {
+ ChannelMap *ch = &s->channels[i];
+ AVFilterBufferRef *cur_buf = s->input_frames[ch->input];
+
+ s->data[i] = cur_buf->extended_data[ch->in_channel_idx];
+ linesize = FFMIN(linesize, cur_buf->linesize[0]);
+ perms &= cur_buf->perms;
+ }
+
+ av_assert0(nb_samples > 0);
+ buf = avfilter_get_audio_buffer_ref_from_arrays(s->data, linesize, perms,
+ nb_samples, outlink->format,
+ outlink->channel_layout);
+ if (!buf)
+ return AVERROR(ENOMEM);
+
+ buf->buf->free = join_free_buffer;
+ buf->pts = s->input_frames[0]->pts;
+
+ if (!(priv = av_mallocz(sizeof(*priv))))
+ goto fail;
+ if (!(priv->in_buffers = av_mallocz(sizeof(*priv->in_buffers) * ctx->nb_inputs)))
+ goto fail;
+
+ for (i = 0; i < ctx->nb_inputs; i++)
+ priv->in_buffers[i] = s->input_frames[i];
+ priv->nb_in_buffers = ctx->nb_inputs;
+ buf->buf->priv = priv;
+
+ ret = ff_filter_frame(outlink, buf);
+
+ memset(s->input_frames, 0, sizeof(*s->input_frames) * ctx->nb_inputs);
+
+ return ret;
+
+fail:
+ avfilter_unref_buffer(buf);
+ if (priv)
+ av_freep(&priv->in_buffers);
+ av_freep(&priv);
+ return AVERROR(ENOMEM);
+}
+
+static const AVFilterPad avfilter_af_join_outputs[] = {
+ {
+ .name = "default",
+ .type = AVMEDIA_TYPE_AUDIO,
+ .config_props = join_config_output,
+ .request_frame = join_request_frame,
+ },
+ { NULL }
+};
+
+AVFilter avfilter_af_join = {
+ .name = "join",
+ .description = NULL_IF_CONFIG_SMALL("Join multiple audio streams into "
+ "multi-channel output"),
+ .priv_size = sizeof(JoinContext),
+
+ .init = join_init,
+ .uninit = join_uninit,
+ .query_formats = join_query_formats,
+
+ .inputs = NULL,
+ .outputs = avfilter_af_join_outputs,
+};
diff --git a/gst-libs/ext/libav/libavfilter/af_resample.c b/gst-libs/ext/libav/libavfilter/af_resample.c
new file mode 100644
index 0000000..c712b46
--- /dev/null
+++ b/gst-libs/ext/libav/libavfilter/af_resample.c
@@ -0,0 +1,272 @@
+/*
+ *
+ * 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
+ * sample format and channel layout conversion audio filter
+ */
+
+#include "libavutil/avassert.h"
+#include "libavutil/avstring.h"
+#include "libavutil/common.h"
+#include "libavutil/mathematics.h"
+#include "libavutil/opt.h"
+
+#include "libavresample/avresample.h"
+
+#include "audio.h"
+#include "avfilter.h"
+#include "formats.h"
+#include "internal.h"
+
+typedef struct ResampleContext {
+ AVAudioResampleContext *avr;
+
+ int64_t next_pts;
+
+ /* set by filter_frame() to signal an output frame to request_frame() */
+ int got_output;
+} ResampleContext;
+
+static av_cold void uninit(AVFilterContext *ctx)
+{
+ ResampleContext *s = ctx->priv;
+
+ if (s->avr) {
+ avresample_close(s->avr);
+ avresample_free(&s->avr);
+ }
+}
+
+static int query_formats(AVFilterContext *ctx)
+{
+ AVFilterLink *inlink = ctx->inputs[0];
+ AVFilterLink *outlink = ctx->outputs[0];
+
+ AVFilterFormats *in_formats = ff_all_formats(AVMEDIA_TYPE_AUDIO);
+ AVFilterFormats *out_formats = ff_all_formats(AVMEDIA_TYPE_AUDIO);
+ AVFilterFormats *in_samplerates = ff_all_samplerates();
+ AVFilterFormats *out_samplerates = ff_all_samplerates();
+ AVFilterChannelLayouts *in_layouts = ff_all_channel_layouts();
+ AVFilterChannelLayouts *out_layouts = ff_all_channel_layouts();
+
+ ff_formats_ref(in_formats, &inlink->out_formats);
+ ff_formats_ref(out_formats, &outlink->in_formats);
+
+ ff_formats_ref(in_samplerates, &inlink->out_samplerates);
+ ff_formats_ref(out_samplerates, &outlink->in_samplerates);
+
+ ff_channel_layouts_ref(in_layouts, &inlink->out_channel_layouts);
+ ff_channel_layouts_ref(out_layouts, &outlink->in_channel_layouts);
+
+ return 0;
+}
+
+static int config_output(AVFilterLink *outlink)
+{
+ AVFilterContext *ctx = outlink->src;
+ AVFilterLink *inlink = ctx->inputs[0];
+ ResampleContext *s = ctx->priv;
+ char buf1[64], buf2[64];
+ int ret;
+
+ if (s->avr) {
+ avresample_close(s->avr);
+ avresample_free(&s->avr);
+ }
+
+ if (inlink->channel_layout == outlink->channel_layout &&
+ inlink->sample_rate == outlink->sample_rate &&
+ (inlink->format == outlink->format ||
+ (av_get_channel_layout_nb_channels(inlink->channel_layout) == 1 &&
+ av_get_channel_layout_nb_channels(outlink->channel_layout) == 1 &&
+ av_get_planar_sample_fmt(inlink->format) ==
+ av_get_planar_sample_fmt(outlink->format))))
+ return 0;
+
+ if (!(s->avr = avresample_alloc_context()))
+ return AVERROR(ENOMEM);
+
+ av_opt_set_int(s->avr, "in_channel_layout", inlink ->channel_layout, 0);
+ av_opt_set_int(s->avr, "out_channel_layout", outlink->channel_layout, 0);
+ av_opt_set_int(s->avr, "in_sample_fmt", inlink ->format, 0);
+ av_opt_set_int(s->avr, "out_sample_fmt", outlink->format, 0);
+ av_opt_set_int(s->avr, "in_sample_rate", inlink ->sample_rate, 0);
+ av_opt_set_int(s->avr, "out_sample_rate", outlink->sample_rate, 0);
+
+ if ((ret = avresample_open(s->avr)) < 0)
+ return ret;
+
+ outlink->time_base = (AVRational){ 1, outlink->sample_rate };
+ s->next_pts = AV_NOPTS_VALUE;
+
+ av_get_channel_layout_string(buf1, sizeof(buf1),
+ -1, inlink ->channel_layout);
+ av_get_channel_layout_string(buf2, sizeof(buf2),
+ -1, outlink->channel_layout);
+ av_log(ctx, AV_LOG_VERBOSE,
+ "fmt:%s srate:%d cl:%s -> fmt:%s srate:%d cl:%s\n",
+ av_get_sample_fmt_name(inlink ->format), inlink ->sample_rate, buf1,
+ av_get_sample_fmt_name(outlink->format), outlink->sample_rate, buf2);
+
+ return 0;
+}
+
+static int request_frame(AVFilterLink *outlink)
+{
+ AVFilterContext *ctx = outlink->src;
+ ResampleContext *s = ctx->priv;
+ int ret = 0;
+
+ s->got_output = 0;
+ while (ret >= 0 && !s->got_output)
+ ret = ff_request_frame(ctx->inputs[0]);
+
+ /* flush the lavr delay buffer */
+ if (ret == AVERROR_EOF && s->avr) {
+ AVFilterBufferRef *buf;
+ int nb_samples = av_rescale_rnd(avresample_get_delay(s->avr),
+ outlink->sample_rate,
+ ctx->inputs[0]->sample_rate,
+ AV_ROUND_UP);
+
+ if (!nb_samples)
+ return ret;
+
+ buf = ff_get_audio_buffer(outlink, AV_PERM_WRITE, nb_samples);
+ if (!buf)
+ return AVERROR(ENOMEM);
+
+ ret = avresample_convert(s->avr, buf->extended_data,
+ buf->linesize[0], nb_samples,
+ NULL, 0, 0);
+ if (ret <= 0) {
+ avfilter_unref_buffer(buf);
+ return (ret == 0) ? AVERROR_EOF : ret;
+ }
+
+ buf->pts = s->next_pts;
+ return ff_filter_frame(outlink, buf);
+ }
+ return ret;
+}
+
+static int filter_frame(AVFilterLink *inlink, AVFilterBufferRef *buf)
+{
+ AVFilterContext *ctx = inlink->dst;
+ ResampleContext *s = ctx->priv;
+ AVFilterLink *outlink = ctx->outputs[0];
+ int ret;
+
+ if (s->avr) {
+ AVFilterBufferRef *buf_out;
+ int delay, nb_samples;
+
+ /* maximum possible samples lavr can output */
+ delay = avresample_get_delay(s->avr);
+ nb_samples = av_rescale_rnd(buf->audio->nb_samples + delay,
+ outlink->sample_rate, inlink->sample_rate,
+ AV_ROUND_UP);
+
+ buf_out = ff_get_audio_buffer(outlink, AV_PERM_WRITE, nb_samples);
+ if (!buf_out) {
+ ret = AVERROR(ENOMEM);
+ goto fail;
+ }
+
+ ret = avresample_convert(s->avr, buf_out->extended_data,
+ buf_out->linesize[0], nb_samples,
+ buf->extended_data, buf->linesize[0],
+ buf->audio->nb_samples);
+ if (ret <= 0) {
+ avfilter_unref_buffer(buf_out);
+ if (ret < 0)
+ goto fail;
+ }
+
+ av_assert0(!avresample_available(s->avr));
+
+ if (s->next_pts == AV_NOPTS_VALUE) {
+ if (buf->pts == AV_NOPTS_VALUE) {
+ av_log(ctx, AV_LOG_WARNING, "First timestamp is missing, "
+ "assuming 0.\n");
+ s->next_pts = 0;
+ } else
+ s->next_pts = av_rescale_q(buf->pts, inlink->time_base,
+ outlink->time_base);
+ }
+
+ if (ret > 0) {
+ buf_out->audio->nb_samples = ret;
+ if (buf->pts != AV_NOPTS_VALUE) {
+ buf_out->pts = av_rescale_q(buf->pts, inlink->time_base,
+ outlink->time_base) -
+ av_rescale(delay, outlink->sample_rate,
+ inlink->sample_rate);
+ } else
+ buf_out->pts = s->next_pts;
+
+ s->next_pts = buf_out->pts + buf_out->audio->nb_samples;
+
+ ret = ff_filter_frame(outlink, buf_out);
+ s->got_output = 1;
+ }
+
+fail:
+ avfilter_unref_buffer(buf);
+ } else {
+ buf->format = outlink->format;
+ ret = ff_filter_frame(outlink, buf);
+ s->got_output = 1;
+ }
+
+ return ret;
+}
+
+static const AVFilterPad avfilter_af_resample_inputs[] = {
+ {
+ .name = "default",
+ .type = AVMEDIA_TYPE_AUDIO,
+ .filter_frame = filter_frame,
+ .min_perms = AV_PERM_READ
+ },
+ { NULL }
+};
+
+static const AVFilterPad avfilter_af_resample_outputs[] = {
+ {
+ .name = "default",
+ .type = AVMEDIA_TYPE_AUDIO,
+ .config_props = config_output,
+ .request_frame = request_frame
+ },
+ { NULL }
+};
+
+AVFilter avfilter_af_resample = {
+ .name = "resample",
+ .description = NULL_IF_CONFIG_SMALL("Audio resampling and conversion."),
+ .priv_size = sizeof(ResampleContext),
+
+ .uninit = uninit,
+ .query_formats = query_formats,
+
+ .inputs = avfilter_af_resample_inputs,
+ .outputs = avfilter_af_resample_outputs,
+};
diff --git a/gst-libs/ext/libav/libavfilter/af_volume.c b/gst-libs/ext/libav/libavfilter/af_volume.c
new file mode 100644
index 0000000..3f3ad47
--- /dev/null
+++ b/gst-libs/ext/libav/libavfilter/af_volume.c
@@ -0,0 +1,317 @@
+/*
+ * Copyright (c) 2011 Stefano Sabatini
+ * Copyright (c) 2012 Justin Ruggles <justin.ruggles@gmail.com>
+ *
+ * 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
+ * audio volume filter
+ */
+
+#include "libavutil/audioconvert.h"
+#include "libavutil/common.h"
+#include "libavutil/eval.h"
+#include "libavutil/float_dsp.h"
+#include "libavutil/opt.h"
+#include "audio.h"
+#include "avfilter.h"
+#include "formats.h"
+#include "internal.h"
+#include "af_volume.h"
+
+static const char *precision_str[] = {
+ "fixed", "float", "double"
+};
+
+#define OFFSET(x) offsetof(VolumeContext, x)
+#define A AV_OPT_FLAG_AUDIO_PARAM
+
+static const AVOption options[] = {
+ { "volume", "Volume adjustment.",
+ OFFSET(volume), AV_OPT_TYPE_DOUBLE, { .dbl = 1.0 }, 0, 0x7fffff, A },
+ { "precision", "Mathematical precision.",
+ OFFSET(precision), AV_OPT_TYPE_INT, { .i64 = PRECISION_FLOAT }, PRECISION_FIXED, PRECISION_DOUBLE, A, "precision" },
+ { "fixed", "8-bit fixed-point.", 0, AV_OPT_TYPE_CONST, { .i64 = PRECISION_FIXED }, INT_MIN, INT_MAX, A, "precision" },
+ { "float", "32-bit floating-point.", 0, AV_OPT_TYPE_CONST, { .i64 = PRECISION_FLOAT }, INT_MIN, INT_MAX, A, "precision" },
+ { "double", "64-bit floating-point.", 0, AV_OPT_TYPE_CONST, { .i64 = PRECISION_DOUBLE }, INT_MIN, INT_MAX, A, "precision" },
+ { NULL },
+};
+
+static const AVClass volume_class = {
+ .class_name = "volume filter",
+ .item_name = av_default_item_name,
+ .option = options,
+ .version = LIBAVUTIL_VERSION_INT,
+};
+
+static av_cold int init(AVFilterContext *ctx, const char *args)
+{
+ VolumeContext *vol = ctx->priv;
+ int ret;
+
+ vol->class = &volume_class;
+ av_opt_set_defaults(vol);
+
+ if ((ret = av_set_options_string(vol, args, "=", ":")) < 0) {
+ av_log(ctx, AV_LOG_ERROR, "Error parsing options string '%s'.\n", args);
+ return ret;
+ }
+
+ if (vol->precision == PRECISION_FIXED) {
+ vol->volume_i = (int)(vol->volume * 256 + 0.5);
+ vol->volume = vol->volume_i / 256.0;
+ av_log(ctx, AV_LOG_VERBOSE, "volume:(%d/256)(%f)(%1.2fdB) precision:fixed\n",
+ vol->volume_i, vol->volume, 20.0*log(vol->volume)/M_LN10);
+ } else {
+ av_log(ctx, AV_LOG_VERBOSE, "volume:(%f)(%1.2fdB) precision:%s\n",
+ vol->volume, 20.0*log(vol->volume)/M_LN10,
+ precision_str[vol->precision]);
+ }
+
+ av_opt_free(vol);
+ return ret;
+}
+
+static int query_formats(AVFilterContext *ctx)
+{
+ VolumeContext *vol = ctx->priv;
+ AVFilterFormats *formats = NULL;
+ AVFilterChannelLayouts *layouts;
+ static const enum AVSampleFormat sample_fmts[][7] = {
+ /* PRECISION_FIXED */
+ {
+ AV_SAMPLE_FMT_U8,
+ AV_SAMPLE_FMT_U8P,
+ AV_SAMPLE_FMT_S16,
+ AV_SAMPLE_FMT_S16P,
+ AV_SAMPLE_FMT_S32,
+ AV_SAMPLE_FMT_S32P,
+ AV_SAMPLE_FMT_NONE
+ },
+ /* PRECISION_FLOAT */
+ {
+ AV_SAMPLE_FMT_FLT,
+ AV_SAMPLE_FMT_FLTP,
+ AV_SAMPLE_FMT_NONE
+ },
+ /* PRECISION_DOUBLE */
+ {
+ AV_SAMPLE_FMT_DBL,
+ AV_SAMPLE_FMT_DBLP,
+ AV_SAMPLE_FMT_NONE
+ }
+ };
+
+ layouts = ff_all_channel_layouts();
+ if (!layouts)
+ return AVERROR(ENOMEM);
+ ff_set_common_channel_layouts(ctx, layouts);
+
+ formats = ff_make_format_list(sample_fmts[vol->precision]);
+ if (!formats)
+ return AVERROR(ENOMEM);
+ ff_set_common_formats(ctx, formats);
+
+ formats = ff_all_samplerates();
+ if (!formats)
+ return AVERROR(ENOMEM);
+ ff_set_common_samplerates(ctx, formats);
+
+ return 0;
+}
+
+static inline void scale_samples_u8(uint8_t *dst, const uint8_t *src,
+ int nb_samples, int volume)
+{
+ int i;
+ for (i = 0; i < nb_samples; i++)
+ dst[i] = av_clip_uint8(((((int64_t)src[i] - 128) * volume + 128) >> 8) + 128);
+}
+
+static inline void scale_samples_u8_small(uint8_t *dst, const uint8_t *src,
+ int nb_samples, int volume)
+{
+ int i;
+ for (i = 0; i < nb_samples; i++)
+ dst[i] = av_clip_uint8((((src[i] - 128) * volume + 128) >> 8) + 128);
+}
+
+static inline void scale_samples_s16(uint8_t *dst, const uint8_t *src,
+ int nb_samples, int volume)
+{
+ int i;
+ int16_t *smp_dst = (int16_t *)dst;
+ const int16_t *smp_src = (const int16_t *)src;
+ for (i = 0; i < nb_samples; i++)
+ smp_dst[i] = av_clip_int16(((int64_t)smp_src[i] * volume + 128) >> 8);
+}
+
+static inline void scale_samples_s16_small(uint8_t *dst, const uint8_t *src,
+ int nb_samples, int volume)
+{
+ int i;
+ int16_t *smp_dst = (int16_t *)dst;
+ const int16_t *smp_src = (const int16_t *)src;
+ for (i = 0; i < nb_samples; i++)
+ smp_dst[i] = av_clip_int16((smp_src[i] * volume + 128) >> 8);
+}
+
+static inline void scale_samples_s32(uint8_t *dst, const uint8_t *src,
+ int nb_samples, int volume)
+{
+ int i;
+ int32_t *smp_dst = (int32_t *)dst;
+ const int32_t *smp_src = (const int32_t *)src;
+ for (i = 0; i < nb_samples; i++)
+ smp_dst[i] = av_clipl_int32((((int64_t)smp_src[i] * volume + 128) >> 8));
+}
+
+
+
+static void volume_init(VolumeContext *vol)
+{
+ vol->samples_align = 1;
+
+ switch (av_get_packed_sample_fmt(vol->sample_fmt)) {
+ case AV_SAMPLE_FMT_U8:
+ if (vol->volume_i < 0x1000000)
+ vol->scale_samples = scale_samples_u8_small;
+ else
+ vol->scale_samples = scale_samples_u8;
+ break;
+ case AV_SAMPLE_FMT_S16:
+ if (vol->volume_i < 0x10000)
+ vol->scale_samples = scale_samples_s16_small;
+ else
+ vol->scale_samples = scale_samples_s16;
+ break;
+ case AV_SAMPLE_FMT_S32:
+ vol->scale_samples = scale_samples_s32;
+ break;
+ case AV_SAMPLE_FMT_FLT:
+ avpriv_float_dsp_init(&vol->fdsp, 0);
+ vol->samples_align = 4;
+ break;
+ case AV_SAMPLE_FMT_DBL:
+ avpriv_float_dsp_init(&vol->fdsp, 0);
+ vol->samples_align = 8;
+ break;
+ }
+
+ if (ARCH_X86)
+ ff_volume_init_x86(vol);
+}
+
+static int config_output(AVFilterLink *outlink)
+{
+ AVFilterContext *ctx = outlink->src;
+ VolumeContext *vol = ctx->priv;
+ AVFilterLink *inlink = ctx->inputs[0];
+
+ vol->sample_fmt = inlink->format;
+ vol->channels = av_get_channel_layout_nb_channels(inlink->channel_layout);
+ vol->planes = av_sample_fmt_is_planar(inlink->format) ? vol->channels : 1;
+
+ volume_init(vol);
+
+ return 0;
+}
+
+static int filter_frame(AVFilterLink *inlink, AVFilterBufferRef *buf)
+{
+ VolumeContext *vol = inlink->dst->priv;
+ AVFilterLink *outlink = inlink->dst->outputs[0];
+ int nb_samples = buf->audio->nb_samples;
+ AVFilterBufferRef *out_buf;
+
+ if (vol->volume == 1.0 || vol->volume_i == 256)
+ return ff_filter_frame(outlink, buf);
+
+ /* do volume scaling in-place if input buffer is writable */
+ if (buf->perms & AV_PERM_WRITE) {
+ out_buf = buf;
+ } else {
+ out_buf = ff_get_audio_buffer(inlink, AV_PERM_WRITE, nb_samples);
+ if (!out_buf)
+ return AVERROR(ENOMEM);
+ out_buf->pts = buf->pts;
+ }
+
+ if (vol->precision != PRECISION_FIXED || vol->volume_i > 0) {
+ int p, plane_samples;
+
+ if (av_sample_fmt_is_planar(buf->format))
+ plane_samples = FFALIGN(nb_samples, vol->samples_align);
+ else
+ plane_samples = FFALIGN(nb_samples * vol->channels, vol->samples_align);
+
+ if (vol->precision == PRECISION_FIXED) {
+ for (p = 0; p < vol->planes; p++) {
+ vol->scale_samples(out_buf->extended_data[p],
+ buf->extended_data[p], plane_samples,
+ vol->volume_i);
+ }
+ } else if (av_get_packed_sample_fmt(vol->sample_fmt) == AV_SAMPLE_FMT_FLT) {
+ for (p = 0; p < vol->planes; p++) {
+ vol->fdsp.vector_fmul_scalar((float *)out_buf->extended_data[p],
+ (const float *)buf->extended_data[p],
+ vol->volume, plane_samples);
+ }
+ } else {
+ for (p = 0; p < vol->planes; p++) {
+ vol->fdsp.vector_dmul_scalar((double *)out_buf->extended_data[p],
+ (const double *)buf->extended_data[p],
+ vol->volume, plane_samples);
+ }
+ }
+ }
+
+ if (buf != out_buf)
+ avfilter_unref_buffer(buf);
+
+ return ff_filter_frame(outlink, out_buf);
+}
+
+static const AVFilterPad avfilter_af_volume_inputs[] = {
+ {
+ .name = "default",
+ .type = AVMEDIA_TYPE_AUDIO,
+ .filter_frame = filter_frame,
+ },
+ { NULL }
+};
+
+static const AVFilterPad avfilter_af_volume_outputs[] = {
+ {
+ .name = "default",
+ .type = AVMEDIA_TYPE_AUDIO,
+ .config_props = config_output,
+ },
+ { NULL }
+};
+
+AVFilter avfilter_af_volume = {
+ .name = "volume",
+ .description = NULL_IF_CONFIG_SMALL("Change input volume."),
+ .query_formats = query_formats,
+ .priv_size = sizeof(VolumeContext),
+ .init = init,
+ .inputs = avfilter_af_volume_inputs,
+ .outputs = avfilter_af_volume_outputs,
+};
diff --git a/gst-libs/ext/libav/libavfilter/af_volume.h b/gst-libs/ext/libav/libavfilter/af_volume.h
new file mode 100644
index 0000000..a1883ed
--- /dev/null
+++ b/gst-libs/ext/libav/libavfilter/af_volume.h
@@ -0,0 +1,55 @@
+/*
+ * 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
+ * audio volume filter
+ */
+
+#ifndef AVFILTER_AF_VOLUME_H
+#define AVFILTER_AF_VOLUME_H
+
+#include "libavutil/common.h"
+#include "libavutil/float_dsp.h"
+#include "libavutil/opt.h"
+#include "libavutil/samplefmt.h"
+
+enum PrecisionType {
+ PRECISION_FIXED = 0,
+ PRECISION_FLOAT,
+ PRECISION_DOUBLE,
+};
+
+typedef struct VolumeContext {
+ const AVClass *class;
+ AVFloatDSPContext fdsp;
+ enum PrecisionType precision;
+ double volume;
+ int volume_i;
+ int channels;
+ int planes;
+ enum AVSampleFormat sample_fmt;
+
+ void (*scale_samples)(uint8_t *dst, const uint8_t *src, int nb_samples,
+ int volume);
+ int samples_align;
+} VolumeContext;
+
+void ff_volume_init_x86(VolumeContext *vol);
+
+#endif /* AVFILTER_AF_VOLUME_H */
diff --git a/gst-libs/ext/libav/libavfilter/allfilters.c b/gst-libs/ext/libav/libavfilter/allfilters.c
index ba66941..f3ce91c 100644
--- a/gst-libs/ext/libav/libavfilter/allfilters.c
+++ b/gst-libs/ext/libav/libavfilter/allfilters.c
@@ -20,11 +20,21 @@
*/
#include "avfilter.h"
+#include "config.h"
-#define REGISTER_FILTER(X,x,y) { \
- extern AVFilter avfilter_##y##_##x ; \
- if(CONFIG_##X##_FILTER ) avfilter_register(&avfilter_##y##_##x ); }
+#define REGISTER_FILTER(X, x, y) \
+ { \
+ extern AVFilter avfilter_##y##_##x; \
+ if (CONFIG_##X##_FILTER) \
+ avfilter_register(&avfilter_##y##_##x); \
+ }
+
+#define REGISTER_FILTER_UNCONDITIONAL(x) \
+ { \
+ extern AVFilter avfilter_##x; \
+ avfilter_register(&avfilter_##x); \
+ }
void avfilter_register_all(void)
{
@@ -34,64 +44,76 @@ void avfilter_register_all(void)
return;
initialized = 1;
- REGISTER_FILTER (ANULL, anull, af);
+ REGISTER_FILTER(AFORMAT, aformat, af);
+ REGISTER_FILTER(AMIX, amix, af);
+ REGISTER_FILTER(ANULL, anull, af);
+ REGISTER_FILTER(ASHOWINFO, ashowinfo, af);
+ REGISTER_FILTER(ASPLIT, asplit, af);
+ REGISTER_FILTER(ASYNCTS, asyncts, af);
+ REGISTER_FILTER(CHANNELMAP, channelmap, af);
+ REGISTER_FILTER(CHANNELSPLIT, channelsplit, af);
+ REGISTER_FILTER(JOIN, join, af);
+ REGISTER_FILTER(RESAMPLE, resample, af);
+ REGISTER_FILTER(VOLUME, volume, af);
- REGISTER_FILTER (ANULLSRC, anullsrc, asrc);
+ REGISTER_FILTER(ANULLSRC, anullsrc, asrc);
- REGISTER_FILTER (ANULLSINK, anullsink, asink);
+ REGISTER_FILTER(ANULLSINK, anullsink, asink);
- REGISTER_FILTER (BLACKFRAME, blackframe, vf);
- REGISTER_FILTER (BOXBLUR, boxblur, vf);
- REGISTER_FILTER (COPY, copy, vf);
- REGISTER_FILTER (CROP, crop, vf);
- REGISTER_FILTER (CROPDETECT, cropdetect, vf);
- REGISTER_FILTER (DELOGO, delogo, vf);
- REGISTER_FILTER (DRAWBOX, drawbox, vf);
- REGISTER_FILTER (DRAWTEXT, drawtext, vf);
- REGISTER_FILTER (FADE, fade, vf);
- REGISTER_FILTER (FIELDORDER, fieldorder, vf);
- REGISTER_FILTER (FIFO, fifo, vf);
- REGISTER_FILTER (FORMAT, format, vf);
- REGISTER_FILTER (FREI0R, frei0r, vf);
- REGISTER_FILTER (GRADFUN, gradfun, vf);
- REGISTER_FILTER (HFLIP, hflip, vf);
- REGISTER_FILTER (HQDN3D, hqdn3d, vf);
- REGISTER_FILTER (LUT, lut, vf);
- REGISTER_FILTER (LUTRGB, lutrgb, vf);
- REGISTER_FILTER (LUTYUV, lutyuv, vf);
- REGISTER_FILTER (NEGATE, negate, vf);
- REGISTER_FILTER (NOFORMAT, noformat, vf);
- REGISTER_FILTER (NULL, null, vf);
- REGISTER_FILTER (OCV, ocv, vf);
- REGISTER_FILTER (OVERLAY, overlay, vf);
- REGISTER_FILTER (PAD, pad, vf);
- REGISTER_FILTER (PIXDESCTEST, pixdesctest, vf);
- REGISTER_FILTER (SCALE, scale, vf);
- REGISTER_FILTER (SELECT, select, vf);
- REGISTER_FILTER (SETDAR, setdar, vf);
- REGISTER_FILTER (SETPTS, setpts, vf);
- REGISTER_FILTER (SETSAR, setsar, vf);
- REGISTER_FILTER (SETTB, settb, vf);
- REGISTER_FILTER (SHOWINFO, showinfo, vf);
- REGISTER_FILTER (SLICIFY, slicify, vf);
- REGISTER_FILTER (SPLIT, split, vf);
- REGISTER_FILTER (TRANSPOSE, transpose, vf);
- REGISTER_FILTER (UNSHARP, unsharp, vf);
- REGISTER_FILTER (VFLIP, vflip, vf);
- REGISTER_FILTER (YADIF, yadif, vf);
+ REGISTER_FILTER(BLACKFRAME, blackframe, vf);
+ REGISTER_FILTER(BOXBLUR, boxblur, vf);
+ REGISTER_FILTER(COPY, copy, vf);
+ REGISTER_FILTER(CROP, crop, vf);
+ REGISTER_FILTER(CROPDETECT, cropdetect, vf);
+ REGISTER_FILTER(DELOGO, delogo, vf);
+ REGISTER_FILTER(DRAWBOX, drawbox, vf);
+ REGISTER_FILTER(DRAWTEXT, drawtext, vf);
+ REGISTER_FILTER(FADE, fade, vf);
+ REGISTER_FILTER(FIELDORDER, fieldorder, vf);
+ REGISTER_FILTER(FORMAT, format, vf);
+ REGISTER_FILTER(FPS, fps, vf);
+ REGISTER_FILTER(FREI0R, frei0r, vf);
+ REGISTER_FILTER(GRADFUN, gradfun, vf);
+ REGISTER_FILTER(HFLIP, hflip, vf);
+ REGISTER_FILTER(HQDN3D, hqdn3d, vf);
+ REGISTER_FILTER(LUT, lut, vf);
+ REGISTER_FILTER(LUTRGB, lutrgb, vf);
+ REGISTER_FILTER(LUTYUV, lutyuv, vf);
+ REGISTER_FILTER(NEGATE, negate, vf);
+ REGISTER_FILTER(NOFORMAT, noformat, vf);
+ REGISTER_FILTER(NULL, null, vf);
+ REGISTER_FILTER(OCV, ocv, vf);
+ REGISTER_FILTER(OVERLAY, overlay, vf);
+ REGISTER_FILTER(PAD, pad, vf);
+ REGISTER_FILTER(PIXDESCTEST, pixdesctest, vf);
+ REGISTER_FILTER(SCALE, scale, vf);
+ REGISTER_FILTER(SELECT, select, vf);
+ REGISTER_FILTER(SETDAR, setdar, vf);
+ REGISTER_FILTER(SETPTS, setpts, vf);
+ REGISTER_FILTER(SETSAR, setsar, vf);
+ REGISTER_FILTER(SETTB, settb, vf);
+ REGISTER_FILTER(SHOWINFO, showinfo, vf);
+ REGISTER_FILTER(SPLIT, split, vf);
+ REGISTER_FILTER(TRANSPOSE, transpose, vf);
+ REGISTER_FILTER(UNSHARP, unsharp, vf);
+ REGISTER_FILTER(VFLIP, vflip, vf);
+ REGISTER_FILTER(YADIF, yadif, vf);
- REGISTER_FILTER (COLOR, color, vsrc);
- REGISTER_FILTER (FREI0R, frei0r_src, vsrc);
- REGISTER_FILTER (MOVIE, movie, vsrc);
- REGISTER_FILTER (NULLSRC, nullsrc, vsrc);
- REGISTER_FILTER (RGBTESTSRC, rgbtestsrc, vsrc);
- REGISTER_FILTER (TESTSRC, testsrc, vsrc);
+ REGISTER_FILTER(COLOR, color, vsrc);
+ REGISTER_FILTER(FREI0R, frei0r_src, vsrc);
+ REGISTER_FILTER(MOVIE, movie, vsrc);
+ REGISTER_FILTER(NULLSRC, nullsrc, vsrc);
+ REGISTER_FILTER(RGBTESTSRC, rgbtestsrc, vsrc);
+ REGISTER_FILTER(TESTSRC, testsrc, vsrc);
- REGISTER_FILTER (NULLSINK, nullsink, vsink);
+ REGISTER_FILTER(NULLSINK, nullsink, vsink);
- /* vsrc_buffer is a part of public API => registered unconditionally */
- {
- extern AVFilter avfilter_vsrc_buffer;
- avfilter_register(&avfilter_vsrc_buffer);
- }
+ /* those filters are part of public or internal API => registered
+ * unconditionally */
+ REGISTER_FILTER_UNCONDITIONAL(asrc_abuffer);
+ REGISTER_FILTER_UNCONDITIONAL(vsrc_buffer);
+ REGISTER_FILTER_UNCONDITIONAL(asink_abuffer);
+ REGISTER_FILTER_UNCONDITIONAL(vsink_buffer);
+ REGISTER_FILTER_UNCONDITIONAL(af_afifo);
+ REGISTER_FILTER_UNCONDITIONAL(vf_fifo);
}
diff --git a/gst-libs/ext/libav/libavfilter/asink_anullsink.c b/gst-libs/ext/libav/libavfilter/asink_anullsink.c
index 3a505e7..ede54c0 100644
--- a/gst-libs/ext/libav/libavfilter/asink_anullsink.c
+++ b/gst-libs/ext/libav/libavfilter/asink_anullsink.c
@@ -16,9 +16,24 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "libavutil/internal.h"
#include "avfilter.h"
+#include "internal.h"
-static void null_filter_samples(AVFilterLink *link, AVFilterBufferRef *samplesref) { }
+static int null_filter_frame(AVFilterLink *link, AVFilterBufferRef *samplesref)
+{
+ avfilter_unref_bufferp(&samplesref);
+ return 0;
+}
+
+static const AVFilterPad avfilter_asink_anullsink_inputs[] = {
+ {
+ .name = "default",
+ .type = AVMEDIA_TYPE_AUDIO,
+ .filter_frame = null_filter_frame,
+ },
+ { NULL },
+};
AVFilter avfilter_asink_anullsink = {
.name = "anullsink",
@@ -26,13 +41,6 @@ AVFilter avfilter_asink_anullsink = {
.priv_size = 0,
- .inputs = (AVFilterPad[]) {
- {
- .name = "default",
- .type = AVMEDIA_TYPE_AUDIO,
- .filter_samples = null_filter_samples,
- },
- { .name = NULL},
- },
- .outputs = (AVFilterPad[]) {{ .name = NULL }},
+ .inputs = avfilter_asink_anullsink_inputs,
+ .outputs = NULL,
};
diff --git a/gst-libs/ext/libav/libavfilter/asrc_anullsrc.c b/gst-libs/ext/libav/libavfilter/asrc_anullsrc.c
index 8e99012..4cbaa81 100644
--- a/gst-libs/ext/libav/libavfilter/asrc_anullsrc.c
+++ b/gst-libs/ext/libav/libavfilter/asrc_anullsrc.c
@@ -21,15 +21,20 @@
* null audio source
*/
+#include <inttypes.h>
+#include <stdio.h>
+
+#include "libavutil/channel_layout.h"
+#include "libavutil/internal.h"
#include "avfilter.h"
-#include "libavutil/audioconvert.h"
+#include "internal.h"
typedef struct {
uint64_t channel_layout;
int64_t sample_rate;
} ANullContext;
-static int init(AVFilterContext *ctx, const char *args, void *opaque)
+static int init(AVFilterContext *ctx, const char *args)
{
ANullContext *priv = ctx->priv;
char channel_layout_str[128] = "";
@@ -67,7 +72,7 @@ static int config_props(AVFilterLink *outlink)
chans_nb = av_get_channel_layout_nb_channels(priv->channel_layout);
av_get_channel_layout_string(buf, sizeof(buf), chans_nb, priv->channel_layout);
- av_log(outlink->src, AV_LOG_INFO,
+ av_log(outlink->src, AV_LOG_VERBOSE,
"sample_rate:%"PRId64 " channel_layout:%"PRId64 " channel_layout_description:'%s'\n",
priv->sample_rate, priv->channel_layout, buf);
@@ -79,6 +84,16 @@ static int request_frame(AVFilterLink *link)
return -1;
}
+static const AVFilterPad avfilter_asrc_anullsrc_outputs[] = {
+ {
+ .name = "default",
+ .type = AVMEDIA_TYPE_AUDIO,
+ .config_props = config_props,
+ .request_frame = request_frame,
+ },
+ { NULL }
+};
+
AVFilter avfilter_asrc_anullsrc = {
.name = "anullsrc",
.description = NULL_IF_CONFIG_SMALL("Null audio source, never return audio frames."),
@@ -86,11 +101,7 @@ AVFilter avfilter_asrc_anullsrc = {
.init = init,
.priv_size = sizeof(ANullContext),
- .inputs = (AVFilterPad[]) {{ .name = NULL}},
+ .inputs = NULL,
- .outputs = (AVFilterPad[]) {{ .name = "default",
- .type = AVMEDIA_TYPE_AUDIO,
- .config_props = config_props,
- .request_frame = request_frame, },
- { .name = NULL}},
+ .outputs = avfilter_asrc_anullsrc_outputs,
};
diff --git a/gst-libs/ext/libav/libavfilter/audio.c b/gst-libs/ext/libav/libavfilter/audio.c
new file mode 100644
index 0000000..bbe12b2
--- /dev/null
+++ b/gst-libs/ext/libav/libavfilter/audio.c
@@ -0,0 +1,148 @@
+/*
+ * 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
+ */
+
+#include "libavutil/channel_layout.h"
+#include "libavutil/common.h"
+
+#include "audio.h"
+#include "avfilter.h"
+#include "internal.h"
+
+AVFilterBufferRef *ff_null_get_audio_buffer(AVFilterLink *link, int perms,
+ int nb_samples)
+{
+ return ff_get_audio_buffer(link->dst->outputs[0], perms, nb_samples);
+}
+
+AVFilterBufferRef *ff_default_get_audio_buffer(AVFilterLink *link, int perms,
+ int nb_samples)
+{
+ AVFilterBufferRef *samplesref = NULL;
+ uint8_t **data;
+ int planar = av_sample_fmt_is_planar(link->format);
+ int nb_channels = av_get_channel_layout_nb_channels(link->channel_layout);
+ int planes = planar ? nb_channels : 1;
+ int linesize;
+
+ if (!(data = av_mallocz(sizeof(*data) * planes)))
+ goto fail;
+
+ if (av_samples_alloc(data, &linesize, nb_channels, nb_samples, link->format, 0) < 0)
+ goto fail;
+
+ samplesref = avfilter_get_audio_buffer_ref_from_arrays(data, linesize, perms,
+ nb_samples, link->format,
+ link->channel_layout);
+ if (!samplesref)
+ goto fail;
+
+ av_freep(&data);
+
+fail:
+ if (data)
+ av_freep(&data[0]);
+ av_freep(&data);
+ return samplesref;
+}
+
+AVFilterBufferRef *ff_get_audio_buffer(AVFilterLink *link, int perms,
+ int nb_samples)
+{
+ AVFilterBufferRef *ret = NULL;
+
+ if (link->dstpad->get_audio_buffer)
+ ret = link->dstpad->get_audio_buffer(link, perms, nb_samples);
+
+ if (!ret)
+ ret = ff_default_get_audio_buffer(link, perms, nb_samples);
+
+ if (ret)
+ ret->type = AVMEDIA_TYPE_AUDIO;
+
+ return ret;
+}
+
+AVFilterBufferRef* avfilter_get_audio_buffer_ref_from_arrays(uint8_t **data,
+ int linesize,int perms,
+ int nb_samples,
+ enum AVSampleFormat sample_fmt,
+ uint64_t channel_layout)
+{
+ int planes;
+ AVFilterBuffer *samples = av_mallocz(sizeof(*samples));
+ AVFilterBufferRef *samplesref = av_mallocz(sizeof(*samplesref));
+
+ if (!samples || !samplesref)
+ goto fail;
+
+ samplesref->buf = samples;
+ samplesref->buf->free = ff_avfilter_default_free_buffer;
+ if (!(samplesref->audio = av_mallocz(sizeof(*samplesref->audio))))
+ goto fail;
+
+ samplesref->audio->nb_samples = nb_samples;
+ samplesref->audio->channel_layout = channel_layout;
+ samplesref->audio->planar = av_sample_fmt_is_planar(sample_fmt);
+
+ planes = samplesref->audio->planar ? av_get_channel_layout_nb_channels(channel_layout) : 1;
+
+ /* make sure the buffer gets read permission or it's useless for output */
+ samplesref->perms = perms | AV_PERM_READ;
+
+ samples->refcount = 1;
+ samplesref->type = AVMEDIA_TYPE_AUDIO;
+ samplesref->format = sample_fmt;
+
+ memcpy(samples->data, data,
+ FFMIN(FF_ARRAY_ELEMS(samples->data), planes)*sizeof(samples->data[0]));
+ memcpy(samplesref->data, samples->data, sizeof(samples->data));
+
+ samples->linesize[0] = samplesref->linesize[0] = linesize;
+
+ if (planes > FF_ARRAY_ELEMS(samples->data)) {
+ samples-> extended_data = av_mallocz(sizeof(*samples->extended_data) *
+ planes);
+ samplesref->extended_data = av_mallocz(sizeof(*samplesref->extended_data) *
+ planes);
+
+ if (!samples->extended_data || !samplesref->extended_data)
+ goto fail;
+
+ memcpy(samples-> extended_data, data, sizeof(*data)*planes);
+ memcpy(samplesref->extended_data, data, sizeof(*data)*planes);
+ } else {
+ samples->extended_data = samples->data;
+ samplesref->extended_data = samplesref->data;
+ }
+
+ samplesref->pts = AV_NOPTS_VALUE;
+
+ return samplesref;
+
+fail:
+ if (samples && samples->extended_data != samples->data)
+ av_freep(&samples->extended_data);
+ if (samplesref) {
+ av_freep(&samplesref->audio);
+ if (samplesref->extended_data != samplesref->data)
+ av_freep(&samplesref->extended_data);
+ }
+ av_freep(&samplesref);
+ av_freep(&samples);
+ return NULL;
+}
diff --git a/gst-libs/ext/libav/libavfilter/audio.h b/gst-libs/ext/libav/libavfilter/audio.h
new file mode 100644
index 0000000..a377503
--- /dev/null
+++ b/gst-libs/ext/libav/libavfilter/audio.h
@@ -0,0 +1,45 @@
+/*
+ * 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
+ */
+
+#ifndef AVFILTER_AUDIO_H
+#define AVFILTER_AUDIO_H
+
+#include "avfilter.h"
+
+/** default handler for get_audio_buffer() for audio inputs */
+AVFilterBufferRef *ff_default_get_audio_buffer(AVFilterLink *link, int perms,
+ int nb_samples);
+
+/** get_audio_buffer() handler for filters which simply pass audio along */
+AVFilterBufferRef *ff_null_get_audio_buffer(AVFilterLink *link, int perms,
+ int nb_samples);
+
+/**
+ * Request an audio samples buffer with a specific set of permissions.
+ *
+ * @param link the output link to the filter from which the buffer will
+ * be requested
+ * @param perms the required access permissions
+ * @param nb_samples the number of samples per channel
+ * @return A reference to the samples. This must be unreferenced with
+ * avfilter_unref_buffer when you are finished with it.
+ */
+AVFilterBufferRef *ff_get_audio_buffer(AVFilterLink *link, int perms,
+ int nb_samples);
+
+#endif /* AVFILTER_AUDIO_H */
diff --git a/gst-libs/ext/libav/libavfilter/avfilter.c b/gst-libs/ext/libav/libavfilter/avfilter.c
index d426591..93302cc 100644
--- a/gst-libs/ext/libav/libavfilter/avfilter.c
+++ b/gst-libs/ext/libav/libavfilter/avfilter.c
@@ -21,13 +21,18 @@
/* #define DEBUG */
+#include "libavutil/channel_layout.h"
+#include "libavutil/common.h"
+#include "libavutil/imgutils.h"
#include "libavutil/pixdesc.h"
#include "libavutil/rational.h"
-#include "libavutil/audioconvert.h"
-#include "libavutil/imgutils.h"
-#include "libavcodec/avcodec.h"
+#include "libavutil/samplefmt.h"
+
+#include "audio.h"
#include "avfilter.h"
+#include "formats.h"
#include "internal.h"
+#include "video.h"
unsigned avfilter_version(void) {
return LIBAVFILTER_VERSION_INT;
@@ -44,46 +49,9 @@ const char *avfilter_license(void)
return LICENSE_PREFIX LIBAV_LICENSE + sizeof(LICENSE_PREFIX) - 1;
}
-AVFilterBufferRef *avfilter_ref_buffer(AVFilterBufferRef *ref, int pmask)
-{
- AVFilterBufferRef *ret = av_malloc(sizeof(AVFilterBufferRef));
- if (!ret)
- return NULL;
- *ret = *ref;
- if (ref->type == AVMEDIA_TYPE_VIDEO) {
- ret->video = av_malloc(sizeof(AVFilterBufferRefVideoProps));
- if (!ret->video) {
- av_free(ret);
- return NULL;
- }
- *ret->video = *ref->video;
- } else if (ref->type == AVMEDIA_TYPE_AUDIO) {
- ret->audio = av_malloc(sizeof(AVFilterBufferRefAudioProps));
- if (!ret->audio) {
- av_free(ret);
- return NULL;
- }
- *ret->audio = *ref->audio;
- }
- ret->perms &= pmask;
- ret->buf->refcount ++;
- return ret;
-}
-
-void avfilter_unref_buffer(AVFilterBufferRef *ref)
-{
- if (!ref)
- return;
- if (!(--ref->buf->refcount))
- ref->buf->free(ref->buf);
- av_free(ref->video);
- av_free(ref->audio);
- av_free(ref);
-}
-
-void avfilter_insert_pad(unsigned idx, unsigned *count, size_t padidx_off,
- AVFilterPad **pads, AVFilterLink ***links,
- AVFilterPad *newpad)
+void ff_insert_pad(unsigned idx, unsigned *count, size_t padidx_off,
+ AVFilterPad **pads, AVFilterLink ***links,
+ AVFilterPad *newpad)
{
unsigned i;
@@ -107,8 +75,8 @@ int avfilter_link(AVFilterContext *src, unsigned srcpad,
{
AVFilterLink *link;
- if (src->output_count <= srcpad || dst->input_count <= dstpad ||
- src->outputs[srcpad] || dst->inputs[dstpad])
+ if (src->nb_outputs <= srcpad || dst->nb_inputs <= dstpad ||
+ src->outputs[srcpad] || dst->inputs[dstpad])
return -1;
if (src->output_pads[srcpad].type != dst->input_pads[dstpad].type) {
@@ -126,7 +94,7 @@ int avfilter_link(AVFilterContext *src, unsigned srcpad,
link->srcpad = &src->output_pads[srcpad];
link->dstpad = &dst->input_pads[dstpad];
link->type = src->output_pads[srcpad].type;
- assert(PIX_FMT_NONE == -1 && AV_SAMPLE_FMT_NONE == -1);
+ assert(AV_PIX_FMT_NONE == -1 && AV_SAMPLE_FMT_NONE == -1);
link->format = -1;
return 0;
@@ -138,7 +106,7 @@ int avfilter_insert_filter(AVFilterLink *link, AVFilterContext *filt,
int ret;
unsigned dstpad_idx = link->dstpad - link->dst->input_pads;
- av_log(link->dst, AV_LOG_INFO, "auto-inserting filter '%s' "
+ av_log(link->dst, AV_LOG_VERBOSE, "auto-inserting filter '%s' "
"between the filter '%s' and the filter '%s'\n",
filt->name, link->src->name, link->dst->name);
@@ -157,8 +125,14 @@ int avfilter_insert_filter(AVFilterLink *link, AVFilterContext *filt,
/* if any information on supported media formats already exists on the
* link, we need to preserve that */
if (link->out_formats)
- avfilter_formats_changeref(&link->out_formats,
+ ff_formats_changeref(&link->out_formats,
&filt->outputs[filt_dstpad_idx]->out_formats);
+ if (link->out_samplerates)
+ ff_formats_changeref(&link->out_samplerates,
+ &filt->outputs[filt_dstpad_idx]->out_samplerates);
+ if (link->out_channel_layouts)
+ ff_channel_layouts_changeref(&link->out_channel_layouts,
+ &filt->outputs[filt_dstpad_idx]->out_channel_layouts);
return 0;
}
@@ -169,7 +143,7 @@ int avfilter_config_links(AVFilterContext *filter)
unsigned i;
int ret;
- for (i = 0; i < filter->input_count; i ++) {
+ for (i = 0; i < filter->nb_inputs; i ++) {
AVFilterLink *link = filter->inputs[i];
if (!link) continue;
@@ -186,28 +160,50 @@ int avfilter_config_links(AVFilterContext *filter)
if ((ret = avfilter_config_links(link->src)) < 0)
return ret;
- if (!(config_link = link->srcpad->config_props))
- config_link = avfilter_default_config_output_link;
- if ((ret = config_link(link)) < 0)
+ if (!(config_link = link->srcpad->config_props)) {
+ if (link->src->nb_inputs != 1) {
+ av_log(link->src, AV_LOG_ERROR, "Source filters and filters "
+ "with more than one input "
+ "must set config_props() "
+ "callbacks on all outputs\n");
+ return AVERROR(EINVAL);
+ }
+ } else if ((ret = config_link(link)) < 0) {
+ av_log(link->src, AV_LOG_ERROR,
+ "Failed to configure output pad on %s\n",
+ link->src->name);
return ret;
+ }
if (link->time_base.num == 0 && link->time_base.den == 0)
- link->time_base = link->src && link->src->input_count ?
+ link->time_base = link->src && link->src->nb_inputs ?
link->src->inputs[0]->time_base : AV_TIME_BASE_Q;
- if (link->sample_aspect_ratio.num == 0 && link->sample_aspect_ratio.den == 0)
- link->sample_aspect_ratio = link->src->input_count ?
- link->src->inputs[0]->sample_aspect_ratio : (AVRational){1,1};
-
- if (link->sample_rate == 0 && link->src && link->src->input_count)
- link->sample_rate = link->src->inputs[0]->sample_rate;
-
- if (link->channel_layout == 0 && link->src && link->src->input_count)
- link->channel_layout = link->src->inputs[0]->channel_layout;
+ if (link->type == AVMEDIA_TYPE_VIDEO) {
+ if (!link->sample_aspect_ratio.num && !link->sample_aspect_ratio.den)
+ link->sample_aspect_ratio = link->src->nb_inputs ?
+ link->src->inputs[0]->sample_aspect_ratio : (AVRational){1,1};
+
+ if (link->src->nb_inputs) {
+ if (!link->w)
+ link->w = link->src->inputs[0]->w;
+ if (!link->h)
+ link->h = link->src->inputs[0]->h;
+ } else if (!link->w || !link->h) {
+ av_log(link->src, AV_LOG_ERROR,
+ "Video source filters must set their output link's "
+ "width and height\n");
+ return AVERROR(EINVAL);
+ }
+ }
if ((config_link = link->dstpad->config_props))
- if ((ret = config_link(link)) < 0)
+ if ((ret = config_link(link)) < 0) {
+ av_log(link->src, AV_LOG_ERROR,
+ "Failed to configure input pad on %s\n",
+ link->dst->name);
return ret;
+ }
link->init_state = AVLINK_INIT;
}
@@ -216,57 +212,13 @@ int avfilter_config_links(AVFilterContext *filter)
return 0;
}
-#ifdef DEBUG
-static char *ff_get_ref_perms_string(char *buf, size_t buf_size, int perms)
-{
- snprintf(buf, buf_size, "%s%s%s%s%s%s",
- perms & AV_PERM_READ ? "r" : "",
- perms & AV_PERM_WRITE ? "w" : "",
- perms & AV_PERM_PRESERVE ? "p" : "",
- perms & AV_PERM_REUSE ? "u" : "",
- perms & AV_PERM_REUSE2 ? "U" : "",
- perms & AV_PERM_NEG_LINESIZES ? "n" : "");
- return buf;
-}
-#endif
-
-static void ff_dlog_ref(void *ctx, AVFilterBufferRef *ref, int end)
-{
- av_unused char buf[16];
- av_dlog(ctx,
- "ref[%p buf:%p refcount:%d perms:%s data:%p linesize[%d, %d, %d, %d] pts:%"PRId64" pos:%"PRId64,
- ref, ref->buf, ref->buf->refcount, ff_get_ref_perms_string(buf, sizeof(buf), ref->perms), ref->data[0],
- ref->linesize[0], ref->linesize[1], ref->linesize[2], ref->linesize[3],
- ref->pts, ref->pos);
-
- if (ref->video) {
- av_dlog(ctx, " a:%d/%d s:%dx%d i:%c iskey:%d type:%c",
- ref->video->pixel_aspect.num, ref->video->pixel_aspect.den,
- ref->video->w, ref->video->h,
- !ref->video->interlaced ? 'P' : /* Progressive */
- ref->video->top_field_first ? 'T' : 'B', /* Top / Bottom */
- ref->video->key_frame,
- av_get_picture_type_char(ref->video->pict_type));
- }
- if (ref->audio) {
- av_dlog(ctx, " cl:%"PRId64"d sn:%d s:%d sr:%d p:%d",
- ref->audio->channel_layout,
- ref->audio->nb_samples,
- ref->audio->size,
- ref->audio->sample_rate,
- ref->audio->planar);
- }
-
- av_dlog(ctx, "]%s", end ? "\n" : "");
-}
-
-static void ff_dlog_link(void *ctx, AVFilterLink *link, int end)
+void ff_dlog_link(void *ctx, AVFilterLink *link, int end)
{
if (link->type == AVMEDIA_TYPE_VIDEO) {
av_dlog(ctx,
"link[%p s:%dx%d fmt:%-16s %-16s->%-16s]%s",
link, link->w, link->h,
- av_pix_fmt_descriptors[link->format].name,
+ av_get_pix_fmt_name(link->format),
link->src ? link->src->filter->name : "",
link->dst ? link->dst->filter->name : "",
end ? "\n" : "");
@@ -275,7 +227,7 @@ static void ff_dlog_link(void *ctx, AVFilterLink *link, int end)
av_get_channel_layout_string(buf, sizeof(buf), -1, link->channel_layout);
av_dlog(ctx,
- "link[%p r:%"PRId64" cl:%s fmt:%-16s %-16s->%-16s]%s",
+ "link[%p r:%d cl:%s fmt:%-16s %-16s->%-16s]%s",
link, link->sample_rate, buf,
av_get_sample_fmt_name(link->format),
link->src ? link->src->filter->name : "",
@@ -284,243 +236,35 @@ static void ff_dlog_link(void *ctx, AVFilterLink *link, int end)
}
}
-#define FF_DPRINTF_START(ctx, func) av_dlog(NULL, "%-16s: ", #func)
-
-AVFilterBufferRef *avfilter_get_video_buffer(AVFilterLink *link, int perms, int w, int h)
-{
- AVFilterBufferRef *ret = NULL;
-
- av_unused char buf[16];
- FF_DPRINTF_START(NULL, get_video_buffer); ff_dlog_link(NULL, link, 0);
- av_dlog(NULL, " perms:%s w:%d h:%d\n", ff_get_ref_perms_string(buf, sizeof(buf), perms), w, h);
-
- if (link->dstpad->get_video_buffer)
- ret = link->dstpad->get_video_buffer(link, perms, w, h);
-
- if (!ret)
- ret = avfilter_default_get_video_buffer(link, perms, w, h);
-
- if (ret)
- ret->type = AVMEDIA_TYPE_VIDEO;
-
- FF_DPRINTF_START(NULL, get_video_buffer); ff_dlog_link(NULL, link, 0); av_dlog(NULL, " returning "); ff_dlog_ref(NULL, ret, 1);
-
- return ret;
-}
-
-AVFilterBufferRef *
-avfilter_get_video_buffer_ref_from_arrays(uint8_t *data[4], int linesize[4], int perms,
- int w, int h, enum PixelFormat format)
-{
- AVFilterBuffer *pic = av_mallocz(sizeof(AVFilterBuffer));
- AVFilterBufferRef *picref = av_mallocz(sizeof(AVFilterBufferRef));
-
- if (!pic || !picref)
- goto fail;
-
- picref->buf = pic;
- picref->buf->free = ff_avfilter_default_free_buffer;
- if (!(picref->video = av_mallocz(sizeof(AVFilterBufferRefVideoProps))))
- goto fail;
-
- pic->w = picref->video->w = w;
- pic->h = picref->video->h = h;
-
- /* make sure the buffer gets read permission or it's useless for output */
- picref->perms = perms | AV_PERM_READ;
-
- pic->refcount = 1;
- picref->type = AVMEDIA_TYPE_VIDEO;
- pic->format = picref->format = format;
-
- memcpy(pic->data, data, 4*sizeof(data[0]));
- memcpy(pic->linesize, linesize, 4*sizeof(linesize[0]));
- memcpy(picref->data, pic->data, sizeof(picref->data));
- memcpy(picref->linesize, pic->linesize, sizeof(picref->linesize));
-
- return picref;
-
-fail:
- if (picref && picref->video)
- av_free(picref->video);
- av_free(picref);
- av_free(pic);
- return NULL;
-}
-
-AVFilterBufferRef *avfilter_get_audio_buffer(AVFilterLink *link, int perms,
- enum AVSampleFormat sample_fmt, int size,
- uint64_t channel_layout, int planar)
-{
- AVFilterBufferRef *ret = NULL;
-
- if (link->dstpad->get_audio_buffer)
- ret = link->dstpad->get_audio_buffer(link, perms, sample_fmt, size, channel_layout, planar);
-
- if (!ret)
- ret = avfilter_default_get_audio_buffer(link, perms, sample_fmt, size, channel_layout, planar);
-
- if (ret)
- ret->type = AVMEDIA_TYPE_AUDIO;
-
- return ret;
-}
-
-int avfilter_request_frame(AVFilterLink *link)
+int ff_request_frame(AVFilterLink *link)
{
FF_DPRINTF_START(NULL, request_frame); ff_dlog_link(NULL, link, 1);
if (link->srcpad->request_frame)
return link->srcpad->request_frame(link);
else if (link->src->inputs[0])
- return avfilter_request_frame(link->src->inputs[0]);
+ return ff_request_frame(link->src->inputs[0]);
else return -1;
}
-int avfilter_poll_frame(AVFilterLink *link)
+int ff_poll_frame(AVFilterLink *link)
{
int i, min = INT_MAX;
if (link->srcpad->poll_frame)
return link->srcpad->poll_frame(link);
- for (i = 0; i < link->src->input_count; i++) {
+ for (i = 0; i < link->src->nb_inputs; i++) {
int val;
if (!link->src->inputs[i])
return -1;
- val = avfilter_poll_frame(link->src->inputs[i]);
+ val = ff_poll_frame(link->src->inputs[i]);
min = FFMIN(min, val);
}
return min;
}
-/* XXX: should we do the duplicating of the picture ref here, instead of
- * forcing the source filter to do it? */
-void avfilter_start_frame(AVFilterLink *link, AVFilterBufferRef *picref)
-{
- void (*start_frame)(AVFilterLink *, AVFilterBufferRef *);
- AVFilterPad *dst = link->dstpad;
- int perms = picref->perms;
-
- FF_DPRINTF_START(NULL, start_frame); ff_dlog_link(NULL, link, 0); av_dlog(NULL, " "); ff_dlog_ref(NULL, picref, 1);
-
- if (!(start_frame = dst->start_frame))
- start_frame = avfilter_default_start_frame;
-
- if (picref->linesize[0] < 0)
- perms |= AV_PERM_NEG_LINESIZES;
- /* prepare to copy the picture if it has insufficient permissions */
- if ((dst->min_perms & perms) != dst->min_perms || dst->rej_perms & perms) {
- av_log(link->dst, AV_LOG_DEBUG,
- "frame copy needed (have perms %x, need %x, reject %x)\n",
- picref->perms,
- link->dstpad->min_perms, link->dstpad->rej_perms);
-
- link->cur_buf = avfilter_get_video_buffer(link, dst->min_perms, link->w, link->h);
- link->src_buf = picref;
- avfilter_copy_buffer_ref_props(link->cur_buf, link->src_buf);
- }
- else
- link->cur_buf = picref;
-
- start_frame(link, link->cur_buf);
-}
-
-void avfilter_end_frame(AVFilterLink *link)
-{
- void (*end_frame)(AVFilterLink *);
-
- if (!(end_frame = link->dstpad->end_frame))
- end_frame = avfilter_default_end_frame;
-
- end_frame(link);
-
- /* unreference the source picture if we're feeding the destination filter
- * a copied version dues to permission issues */
- if (link->src_buf) {
- avfilter_unref_buffer(link->src_buf);
- link->src_buf = NULL;
- }
-}
-
-void avfilter_draw_slice(AVFilterLink *link, int y, int h, int slice_dir)
-{
- uint8_t *src[4], *dst[4];
- int i, j, vsub;
- void (*draw_slice)(AVFilterLink *, int, int, int);
-
- FF_DPRINTF_START(NULL, draw_slice); ff_dlog_link(NULL, link, 0); av_dlog(NULL, " y:%d h:%d dir:%d\n", y, h, slice_dir);
-
- /* copy the slice if needed for permission reasons */
- if (link->src_buf) {
- vsub = av_pix_fmt_descriptors[link->format].log2_chroma_h;
-
- for (i = 0; i < 4; i++) {
- if (link->src_buf->data[i]) {
- src[i] = link->src_buf-> data[i] +
- (y >> (i==1 || i==2 ? vsub : 0)) * link->src_buf-> linesize[i];
- dst[i] = link->cur_buf->data[i] +
- (y >> (i==1 || i==2 ? vsub : 0)) * link->cur_buf->linesize[i];
- } else
- src[i] = dst[i] = NULL;
- }
-
- for (i = 0; i < 4; i++) {
- int planew =
- av_image_get_linesize(link->format, link->cur_buf->video->w, i);
-
- if (!src[i]) continue;
-
- for (j = 0; j < h >> (i==1 || i==2 ? vsub : 0); j++) {
- memcpy(dst[i], src[i], planew);
- src[i] += link->src_buf->linesize[i];
- dst[i] += link->cur_buf->linesize[i];
- }
- }
- }
-
- if (!(draw_slice = link->dstpad->draw_slice))
- draw_slice = avfilter_default_draw_slice;
- draw_slice(link, y, h, slice_dir);
-}
-
-void avfilter_filter_samples(AVFilterLink *link, AVFilterBufferRef *samplesref)
-{
- void (*filter_samples)(AVFilterLink *, AVFilterBufferRef *);
- AVFilterPad *dst = link->dstpad;
-
- FF_DPRINTF_START(NULL, filter_samples); ff_dlog_link(NULL, link, 1);
-
- if (!(filter_samples = dst->filter_samples))
- filter_samples = avfilter_default_filter_samples;
-
- /* prepare to copy the samples if the buffer has insufficient permissions */
- if ((dst->min_perms & samplesref->perms) != dst->min_perms ||
- dst->rej_perms & samplesref->perms) {
-
- av_log(link->dst, AV_LOG_DEBUG,
- "Copying audio data in avfilter (have perms %x, need %x, reject %x)\n",
- samplesref->perms, link->dstpad->min_perms, link->dstpad->rej_perms);
-
- link->cur_buf = avfilter_default_get_audio_buffer(link, dst->min_perms,
- samplesref->format,
- samplesref->audio->size,
- samplesref->audio->channel_layout,
- samplesref->audio->planar);
- link->cur_buf->pts = samplesref->pts;
- link->cur_buf->audio->sample_rate = samplesref->audio->sample_rate;
-
- /* Copy actual data into new samples buffer */
- memcpy(link->cur_buf->data[0], samplesref->data[0], samplesref->audio->size);
-
- avfilter_unref_buffer(samplesref);
- } else
- link->cur_buf = samplesref;
-
- filter_samples(link, link->cur_buf);
-}
-
#define MAX_REGISTERED_AVFILTERS_NB 64
static AVFilter *registered_avfilters[MAX_REGISTERED_AVFILTERS_NB + 1];
@@ -562,6 +306,9 @@ static int pad_count(const AVFilterPad *pads)
{
int count;
+ if (!pads)
+ return 0;
+
for(count = 0; pads->name; count ++) pads ++;
return count;
}
@@ -600,27 +347,31 @@ int avfilter_open(AVFilterContext **filter_ctx, AVFilter *filter, const char *in
goto err;
}
- ret->input_count = pad_count(filter->inputs);
- if (ret->input_count) {
- ret->input_pads = av_malloc(sizeof(AVFilterPad) * ret->input_count);
+ ret->nb_inputs = pad_count(filter->inputs);
+ if (ret->nb_inputs ) {
+ ret->input_pads = av_malloc(sizeof(AVFilterPad) * ret->nb_inputs);
if (!ret->input_pads)
goto err;
- memcpy(ret->input_pads, filter->inputs, sizeof(AVFilterPad) * ret->input_count);
- ret->inputs = av_mallocz(sizeof(AVFilterLink*) * ret->input_count);
+ memcpy(ret->input_pads, filter->inputs, sizeof(AVFilterPad) * ret->nb_inputs);
+ ret->inputs = av_mallocz(sizeof(AVFilterLink*) * ret->nb_inputs);
if (!ret->inputs)
goto err;
}
- ret->output_count = pad_count(filter->outputs);
- if (ret->output_count) {
- ret->output_pads = av_malloc(sizeof(AVFilterPad) * ret->output_count);
+ ret->nb_outputs = pad_count(filter->outputs);
+ if (ret->nb_outputs) {
+ ret->output_pads = av_malloc(sizeof(AVFilterPad) * ret->nb_outputs);
if (!ret->output_pads)
goto err;
- memcpy(ret->output_pads, filter->outputs, sizeof(AVFilterPad) * ret->output_count);
- ret->outputs = av_mallocz(sizeof(AVFilterLink*) * ret->output_count);
+ memcpy(ret->output_pads, filter->outputs, sizeof(AVFilterPad) * ret->nb_outputs);
+ ret->outputs = av_mallocz(sizeof(AVFilterLink*) * ret->nb_outputs);
if (!ret->outputs)
goto err;
}
+#if FF_API_FOO_COUNT
+ ret->output_count = ret->nb_outputs;
+ ret->input_count = ret->nb_inputs;
+#endif
*filter_ctx = ret;
return 0;
@@ -628,10 +379,10 @@ int avfilter_open(AVFilterContext **filter_ctx, AVFilter *filter, const char *in
err:
av_freep(&ret->inputs);
av_freep(&ret->input_pads);
- ret->input_count = 0;
+ ret->nb_inputs = 0;
av_freep(&ret->outputs);
av_freep(&ret->output_pads);
- ret->output_count = 0;
+ ret->nb_outputs = 0;
av_freep(&ret->priv);
av_free(ret);
return AVERROR(ENOMEM);
@@ -645,21 +396,29 @@ void avfilter_free(AVFilterContext *filter)
if (filter->filter->uninit)
filter->filter->uninit(filter);
- for (i = 0; i < filter->input_count; i++) {
+ for (i = 0; i < filter->nb_inputs; i++) {
if ((link = filter->inputs[i])) {
if (link->src)
link->src->outputs[link->srcpad - link->src->output_pads] = NULL;
- avfilter_formats_unref(&link->in_formats);
- avfilter_formats_unref(&link->out_formats);
+ ff_formats_unref(&link->in_formats);
+ ff_formats_unref(&link->out_formats);
+ ff_formats_unref(&link->in_samplerates);
+ ff_formats_unref(&link->out_samplerates);
+ ff_channel_layouts_unref(&link->in_channel_layouts);
+ ff_channel_layouts_unref(&link->out_channel_layouts);
}
av_freep(&link);
}
- for (i = 0; i < filter->output_count; i++) {
+ for (i = 0; i < filter->nb_outputs; i++) {
if ((link = filter->outputs[i])) {
if (link->dst)
link->dst->inputs[link->dstpad - link->dst->input_pads] = NULL;
- avfilter_formats_unref(&link->in_formats);
- avfilter_formats_unref(&link->out_formats);
+ ff_formats_unref(&link->in_formats);
+ ff_formats_unref(&link->out_formats);
+ ff_formats_unref(&link->in_samplerates);
+ ff_formats_unref(&link->out_samplerates);
+ ff_channel_layouts_unref(&link->in_channel_layouts);
+ ff_channel_layouts_unref(&link->out_channel_layouts);
}
av_freep(&link);
}
@@ -678,25 +437,81 @@ int avfilter_init_filter(AVFilterContext *filter, const char *args, void *opaque
int ret=0;
if (filter->filter->init)
- ret = filter->filter->init(filter, args, opaque);
+ ret = filter->filter->init(filter, args);
return ret;
}
-int avfilter_copy_frame_props(AVFilterBufferRef *dst, const AVFrame *src)
+const char *avfilter_pad_get_name(AVFilterPad *pads, int pad_idx)
{
- if (dst->type != AVMEDIA_TYPE_VIDEO)
- return AVERROR(EINVAL);
+ return pads[pad_idx].name;
+}
- dst->pts = src->pts;
- dst->format = src->format;
+enum AVMediaType avfilter_pad_get_type(AVFilterPad *pads, int pad_idx)
+{
+ return pads[pad_idx].type;
+}
- dst->video->w = src->width;
- dst->video->h = src->height;
- dst->video->pixel_aspect = src->sample_aspect_ratio;
- dst->video->interlaced = src->interlaced_frame;
- dst->video->top_field_first = src->top_field_first;
- dst->video->key_frame = src->key_frame;
- dst->video->pict_type = src->pict_type;
+static int default_filter_frame(AVFilterLink *link, AVFilterBufferRef *frame)
+{
+ return ff_filter_frame(link->dst->outputs[0], frame);
+}
- return 0;
+int ff_filter_frame(AVFilterLink *link, AVFilterBufferRef *frame)
+{
+ int (*filter_frame)(AVFilterLink *, AVFilterBufferRef *);
+ AVFilterPad *dst = link->dstpad;
+ AVFilterBufferRef *out;
+ int perms = frame->perms;
+
+ FF_DPRINTF_START(NULL, filter_frame);
+ ff_dlog_link(NULL, link, 1);
+
+ if (!(filter_frame = dst->filter_frame))
+ filter_frame = default_filter_frame;
+
+ if (frame->linesize[0] < 0)
+ perms |= AV_PERM_NEG_LINESIZES;
+ /* prepare to copy the frame if the buffer has insufficient permissions */
+ if ((dst->min_perms & perms) != dst->min_perms ||
+ dst->rej_perms & perms) {
+ av_log(link->dst, AV_LOG_DEBUG,
+ "Copying data in avfilter (have perms %x, need %x, reject %x)\n",
+ perms, link->dstpad->min_perms, link->dstpad->rej_perms);
+
+ switch (link->type) {
+ case AVMEDIA_TYPE_VIDEO:
+ out = ff_get_video_buffer(link, dst->min_perms,
+ link->w, link->h);
+ break;
+ case AVMEDIA_TYPE_AUDIO:
+ out = ff_get_audio_buffer(link, dst->min_perms,
+ frame->audio->nb_samples);
+ break;
+ default: return AVERROR(EINVAL);
+ }
+ if (!out) {
+ avfilter_unref_buffer(frame);
+ return AVERROR(ENOMEM);
+ }
+ avfilter_copy_buffer_ref_props(out, frame);
+
+ switch (link->type) {
+ case AVMEDIA_TYPE_VIDEO:
+ av_image_copy(out->data, out->linesize, frame->data, frame->linesize,
+ frame->format, frame->video->w, frame->video->h);
+ break;
+ case AVMEDIA_TYPE_AUDIO:
+ av_samples_copy(out->extended_data, frame->extended_data,
+ 0, 0, frame->audio->nb_samples,
+ av_get_channel_layout_nb_channels(frame->audio->channel_layout),
+ frame->format);
+ break;
+ default: return AVERROR(EINVAL);
+ }
+
+ avfilter_unref_buffer(frame);
+ } else
+ out = frame;
+
+ return filter_frame(link, out);
}
diff --git a/gst-libs/ext/libav/libavfilter/avfilter.h b/gst-libs/ext/libav/libavfilter/avfilter.h
index 068c50b..c5f8d56 100644
--- a/gst-libs/ext/libav/libavfilter/avfilter.h
+++ b/gst-libs/ext/libav/libavfilter/avfilter.h
@@ -52,6 +52,7 @@ const char *avfilter_license(void);
typedef struct AVFilterContext AVFilterContext;
typedef struct AVFilterLink AVFilterLink;
typedef struct AVFilterPad AVFilterPad;
+typedef struct AVFilterFormats AVFilterFormats;
/**
* A reference-counted buffer data type used by the filter system. Filters
@@ -60,9 +61,23 @@ typedef struct AVFilterPad AVFilterPad;
*/
typedef struct AVFilterBuffer {
uint8_t *data[8]; ///< buffer data for each plane/channel
- int linesize[8]; ///< number of bytes per line
- unsigned refcount; ///< number of references to this buffer
+ /**
+ * pointers to the data planes/channels.
+ *
+ * For video, this should simply point to data[].
+ *
+ * For planar audio, each channel has a separate data pointer, and
+ * linesize[0] contains the size of each channel buffer.
+ * For packed audio, there is just one data pointer, and linesize[0]
+ * contains the total size of the buffer for all channels.
+ *
+ * Note: Both data and extended_data will always be set, but for planar
+ * audio with more channels that can fit in data, extended_data must be used
+ * in order to access all channels.
+ */
+ uint8_t **extended_data;
+ int linesize[8]; ///< number of bytes per line
/** private data to be used by a custom free function */
void *priv;
@@ -76,6 +91,7 @@ typedef struct AVFilterBuffer {
int format; ///< media format
int w, h; ///< width and height of the allocated buffer
+ unsigned refcount; ///< number of references to this buffer
} AVFilterBuffer;
#define AV_PERM_READ 0x01 ///< can read from the buffer
@@ -93,8 +109,7 @@ typedef struct AVFilterBuffer {
typedef struct AVFilterBufferRefAudioProps {
uint64_t channel_layout; ///< channel layout of audio buffer
int nb_samples; ///< number of audio samples
- int size; ///< audio buffer size
- uint32_t sample_rate; ///< audio buffer sample rate
+ int sample_rate; ///< audio buffer sample rate
int planar; ///< audio buffer - planar or packed
} AVFilterBufferRefAudioProps;
@@ -124,8 +139,25 @@ typedef struct AVFilterBufferRefVideoProps {
typedef struct AVFilterBufferRef {
AVFilterBuffer *buf; ///< the buffer that this is a reference to
uint8_t *data[8]; ///< picture/audio data for each plane
+ /**
+ * pointers to the data planes/channels.
+ *
+ * For video, this should simply point to data[].
+ *
+ * For planar audio, each channel has a separate data pointer, and
+ * linesize[0] contains the size of each channel buffer.
+ * For packed audio, there is just one data pointer, and linesize[0]
+ * contains the total size of the buffer for all channels.
+ *
+ * Note: Both data and extended_data will always be set, but for planar
+ * audio with more channels that can fit in data, extended_data must be used
+ * in order to access all channels.
+ */
+ uint8_t **extended_data;
int linesize[8]; ///< number of bytes per line
- int format; ///< media format
+
+ AVFilterBufferRefVideoProps *video; ///< video buffer specific properties
+ AVFilterBufferRefAudioProps *audio; ///< audio buffer specific properties
/**
* presentation timestamp. The time unit may change during
@@ -135,28 +167,17 @@ typedef struct AVFilterBufferRef {
int64_t pts;
int64_t pos; ///< byte position in stream, -1 if unknown
+ int format; ///< media format
+
int perms; ///< permissions, see the AV_PERM_* flags
enum AVMediaType type; ///< media type of buffer data
- AVFilterBufferRefVideoProps *video; ///< video buffer specific properties
- AVFilterBufferRefAudioProps *audio; ///< audio buffer specific properties
} AVFilterBufferRef;
/**
* Copy properties of src to dst, without copying the actual data
*/
-static inline void avfilter_copy_buffer_ref_props(AVFilterBufferRef *dst, AVFilterBufferRef *src)
-{
- // copy common properties
- dst->pts = src->pts;
- dst->pos = src->pos;
-
- switch (src->type) {
- case AVMEDIA_TYPE_VIDEO: *dst->video = *src->video; break;
- case AVMEDIA_TYPE_AUDIO: *dst->audio = *src->audio; break;
- default: break;
- }
-}
+void avfilter_copy_buffer_ref_props(AVFilterBufferRef *dst, AVFilterBufferRef *src);
/**
* Add a new reference to a buffer.
@@ -174,140 +195,29 @@ AVFilterBufferRef *avfilter_ref_buffer(AVFilterBufferRef *ref, int pmask);
* buffer, the buffer itself is also automatically freed.
*
* @param ref reference to the buffer, may be NULL
- */
-void avfilter_unref_buffer(AVFilterBufferRef *ref);
-
-/**
- * A list of supported formats for one end of a filter link. This is used
- * during the format negotiation process to try to pick the best format to
- * use to minimize the number of necessary conversions. Each filter gives a
- * list of the formats supported by each input and output pad. The list
- * given for each pad need not be distinct - they may be references to the
- * same list of formats, as is often the case when a filter supports multiple
- * formats, but will always output the same format as it is given in input.
- *
- * In this way, a list of possible input formats and a list of possible
- * output formats are associated with each link. When a set of formats is
- * negotiated over a link, the input and output lists are merged to form a
- * new list containing only the common elements of each list. In the case
- * that there were no common elements, a format conversion is necessary.
- * Otherwise, the lists are merged, and all other links which reference
- * either of the format lists involved in the merge are also affected.
- *
- * For example, consider the filter chain:
- * filter (a) --> (b) filter (b) --> (c) filter
- *
- * where the letters in parenthesis indicate a list of formats supported on
- * the input or output of the link. Suppose the lists are as follows:
- * (a) = {A, B}
- * (b) = {A, B, C}
- * (c) = {B, C}
- *
- * First, the first link's lists are merged, yielding:
- * filter (a) --> (a) filter (a) --> (c) filter
- *
- * Notice that format list (b) now refers to the same list as filter list (a).
- * Next, the lists for the second link are merged, yielding:
- * filter (a) --> (a) filter (a) --> (a) filter
- *
- * where (a) = {B}.
- *
- * Unfortunately, when the format lists at the two ends of a link are merged,
- * we must ensure that all links which reference either pre-merge format list
- * get updated as well. Therefore, we have the format list structure store a
- * pointer to each of the pointers to itself.
- */
-typedef struct AVFilterFormats {
- unsigned format_count; ///< number of formats
- int *formats; ///< list of media formats
-
- unsigned refcount; ///< number of references to this list
- struct AVFilterFormats ***refs; ///< references to this list
-} AVFilterFormats;
-
-/**
- * Create a list of supported formats. This is intended for use in
- * AVFilter->query_formats().
- *
- * @param fmts list of media formats, terminated by -1
- * @return the format list, with no existing references
- */
-AVFilterFormats *avfilter_make_format_list(const int *fmts);
-
-/**
- * Add fmt to the list of media formats contained in *avff.
- * If *avff is NULL the function allocates the filter formats struct
- * and puts its pointer in *avff.
- *
- * @return a non negative value in case of success, or a negative
- * value corresponding to an AVERROR code in case of error
- */
-int avfilter_add_format(AVFilterFormats **avff, int fmt);
-
-/**
- * Return a list of all formats supported by Libav for the given media type.
- */
-AVFilterFormats *avfilter_all_formats(enum AVMediaType type);
-
-/**
- * Return a format list which contains the intersection of the formats of
- * a and b. Also, all the references of a, all the references of b, and
- * a and b themselves will be deallocated.
- *
- * If a and b do not share any common formats, neither is modified, and NULL
- * is returned.
- */
-AVFilterFormats *avfilter_merge_formats(AVFilterFormats *a, AVFilterFormats *b);
-
-/**
- * Add *ref as a new reference to formats.
- * That is the pointers will point like in the ascii art below:
- * ________
- * |formats |<--------.
- * | ____ | ____|___________________
- * | |refs| | | __|_
- * | |* * | | | | | | AVFilterLink
- * | |* *--------->|*ref|
- * | |____| | | |____|
- * |________| |________________________
- */
-void avfilter_formats_ref(AVFilterFormats *formats, AVFilterFormats **ref);
-
-/**
- * If *ref is non-NULL, remove *ref as a reference to the format list
- * it currently points to, deallocates that list if this was the last
- * reference, and sets *ref to NULL.
*
- * Before After
- * ________ ________ NULL
- * |formats |<--------. |formats | ^
- * | ____ | ____|________________ | ____ | ____|________________
- * | |refs| | | __|_ | |refs| | | __|_
- * | |* * | | | | | | AVFilterLink | |* * | | | | | | AVFilterLink
- * | |* *--------->|*ref| | |* | | | |*ref|
- * | |____| | | |____| | |____| | | |____|
- * |________| |_____________________ |________| |_____________________
+ * @note it is recommended to use avfilter_unref_bufferp() instead of this
+ * function
*/
-void avfilter_formats_unref(AVFilterFormats **ref);
+void avfilter_unref_buffer(AVFilterBufferRef *ref);
/**
+ * Remove a reference to a buffer and set the pointer to NULL.
+ * If this is the last reference to the buffer, the buffer itself
+ * is also automatically freed.
*
- * Before After
- * ________ ________
- * |formats |<---------. |formats |<---------.
- * | ____ | ___|___ | ____ | ___|___
- * | |refs| | | | | | |refs| | | | | NULL
- * | |* *--------->|*oldref| | |* *--------->|*newref| ^
- * | |* * | | |_______| | |* * | | |_______| ___|___
- * | |____| | | |____| | | | |
- * |________| |________| |*oldref|
- * |_______|
+ * @param ref pointer to the buffer reference
*/
-void avfilter_formats_changeref(AVFilterFormats **oldref,
- AVFilterFormats **newref);
+void avfilter_unref_bufferp(AVFilterBufferRef **ref);
+#if FF_API_AVFILTERPAD_PUBLIC
/**
* A filter pad used for either input or output.
+ *
+ * @warning this struct will be removed from public API.
+ * users should call avfilter_pad_get_name() and avfilter_pad_get_type()
+ * to access the name and type fields; there should be no need to access
+ * any other fields from outside of libavfilter.
*/
struct AVFilterPad {
/**
@@ -318,8 +228,7 @@ struct AVFilterPad {
const char *name;
/**
- * AVFilterPad type. Only video supported now, hopefully someone will
- * add audio in the future.
+ * AVFilterPad type.
*/
enum AVMediaType type;
@@ -344,13 +253,9 @@ struct AVFilterPad {
int rej_perms;
/**
- * Callback called before passing the first slice of a new frame. If
- * NULL, the filter layer will default to storing a reference to the
- * picture inside the link structure.
- *
- * Input video pads only.
+ * @deprecated unused
*/
- void (*start_frame)(AVFilterLink *link, AVFilterBufferRef *picref);
+ int (*start_frame)(AVFilterLink *link, AVFilterBufferRef *picref);
/**
* Callback function to get a video buffer. If NULL, the filter system will
@@ -367,33 +272,29 @@ struct AVFilterPad {
* Input audio pads only.
*/
AVFilterBufferRef *(*get_audio_buffer)(AVFilterLink *link, int perms,
- enum AVSampleFormat sample_fmt, int size,
- uint64_t channel_layout, int planar);
+ int nb_samples);
/**
- * Callback called after the slices of a frame are completely sent. If
- * NULL, the filter layer will default to releasing the reference stored
- * in the link structure during start_frame().
- *
- * Input video pads only.
+ * @deprecated unused
*/
- void (*end_frame)(AVFilterLink *link);
+ int (*end_frame)(AVFilterLink *link);
/**
- * Slice drawing callback. This is where a filter receives video data
- * and should do its processing.
- *
- * Input video pads only.
+ * @deprecated unused
*/
- void (*draw_slice)(AVFilterLink *link, int y, int height, int slice_dir);
+ int (*draw_slice)(AVFilterLink *link, int y, int height, int slice_dir);
/**
- * Samples filtering callback. This is where a filter receives audio data
- * and should do its processing.
+ * Filtering callback. This is where a filter receives a frame with
+ * audio/video data and should do its processing.
*
- * Input audio pads only.
+ * Input pads only.
+ *
+ * @return >= 0 on success, a negative AVERROR on error. This function
+ * must ensure that samplesref is properly unreferenced on error if it
+ * hasn't been passed on to another filter.
*/
- void (*filter_samples)(AVFilterLink *link, AVFilterBufferRef *samplesref);
+ int (*filter_frame)(AVFilterLink *link, AVFilterBufferRef *frame);
/**
* Frame poll callback. This returns the number of immediately available
@@ -402,7 +303,7 @@ struct AVFilterPad {
*
* Defaults to just calling the source poll_frame() method.
*
- * Output video pads only.
+ * Output pads only.
*/
int (*poll_frame)(AVFilterLink *link);
@@ -411,7 +312,7 @@ struct AVFilterPad {
* frame being output over the given link. This should return zero on
* success, and another value on error.
*
- * Output video pads only.
+ * Output pads only.
*/
int (*request_frame)(AVFilterLink *link);
@@ -430,65 +331,38 @@ struct AVFilterPad {
* and another value on error.
*/
int (*config_props)(AVFilterLink *link);
-};
-
-/** default handler for start_frame() for video inputs */
-void avfilter_default_start_frame(AVFilterLink *link, AVFilterBufferRef *picref);
-/** default handler for draw_slice() for video inputs */
-void avfilter_default_draw_slice(AVFilterLink *link, int y, int h, int slice_dir);
-
-/** default handler for end_frame() for video inputs */
-void avfilter_default_end_frame(AVFilterLink *link);
-
-/** default handler for filter_samples() for audio inputs */
-void avfilter_default_filter_samples(AVFilterLink *link, AVFilterBufferRef *samplesref);
-
-/** default handler for config_props() for audio/video outputs */
-int avfilter_default_config_output_link(AVFilterLink *link);
-
-/** default handler for config_props() for audio/video inputs */
-int avfilter_default_config_input_link (AVFilterLink *link);
-
-/** default handler for get_video_buffer() for video inputs */
-AVFilterBufferRef *avfilter_default_get_video_buffer(AVFilterLink *link,
- int perms, int w, int h);
-
-/** default handler for get_audio_buffer() for audio inputs */
-AVFilterBufferRef *avfilter_default_get_audio_buffer(AVFilterLink *link, int perms,
- enum AVSampleFormat sample_fmt, int size,
- uint64_t channel_layout, int planar);
+ /**
+ * The filter expects a fifo to be inserted on its input link,
+ * typically because it has a delay.
+ *
+ * input pads only.
+ */
+ int needs_fifo;
+};
+#endif
/**
- * A helper for query_formats() which sets all links to the same list of
- * formats. If there are no links hooked to this filter, the list of formats is
- * freed.
+ * Get the name of an AVFilterPad.
+ *
+ * @param pads an array of AVFilterPads
+ * @param pad_idx index of the pad in the array it; is the caller's
+ * responsibility to ensure the index is valid
+ *
+ * @return name of the pad_idx'th pad in pads
*/
-void avfilter_set_common_formats(AVFilterContext *ctx, AVFilterFormats *formats);
-
-/** Default handler for query_formats() */
-int avfilter_default_query_formats(AVFilterContext *ctx);
-
-/** start_frame() handler for filters which simply pass video along */
-void avfilter_null_start_frame(AVFilterLink *link, AVFilterBufferRef *picref);
-
-/** draw_slice() handler for filters which simply pass video along */
-void avfilter_null_draw_slice(AVFilterLink *link, int y, int h, int slice_dir);
-
-/** end_frame() handler for filters which simply pass video along */
-void avfilter_null_end_frame(AVFilterLink *link);
-
-/** filter_samples() handler for filters which simply pass audio along */
-void avfilter_null_filter_samples(AVFilterLink *link, AVFilterBufferRef *samplesref);
+const char *avfilter_pad_get_name(AVFilterPad *pads, int pad_idx);
-/** get_video_buffer() handler for filters which simply pass video along */
-AVFilterBufferRef *avfilter_null_get_video_buffer(AVFilterLink *link,
- int perms, int w, int h);
-
-/** get_audio_buffer() handler for filters which simply pass audio along */
-AVFilterBufferRef *avfilter_null_get_audio_buffer(AVFilterLink *link, int perms,
- enum AVSampleFormat sample_fmt, int size,
- uint64_t channel_layout, int planar);
+/**
+ * Get the type of an AVFilterPad.
+ *
+ * @param pads an array of AVFilterPads
+ * @param pad_idx index of the pad in the array; it is the caller's
+ * responsibility to ensure the index is valid
+ *
+ * @return type of the pad_idx'th pad in pads
+ */
+enum AVMediaType avfilter_pad_get_type(AVFilterPad *pads, int pad_idx);
/**
* Filter definition. This defines the pads a filter contains, and all the
@@ -497,15 +371,28 @@ AVFilterBufferRef *avfilter_null_get_audio_buffer(AVFilterLink *link, int perms,
typedef struct AVFilter {
const char *name; ///< filter name
- int priv_size; ///< size of private data to allocate for the filter
+ /**
+ * A description for the filter. You should use the
+ * NULL_IF_CONFIG_SMALL() macro to define it.
+ */
+ const char *description;
+
+ const AVFilterPad *inputs; ///< NULL terminated list of inputs. NULL if none
+ const AVFilterPad *outputs; ///< NULL terminated list of outputs. NULL if none
+
+ /*****************************************************************
+ * All fields below this line are not part of the public API. They
+ * may not be used outside of libavfilter and can be changed and
+ * removed at will.
+ * New public fields should be added right above.
+ *****************************************************************
+ */
/**
* Filter initialization function. Args contains the user-supplied
* parameters. FIXME: maybe an AVOption-based system would be better?
- * opaque is data provided by the code requesting creation of the filter,
- * and is used to pass data to the filter.
*/
- int (*init)(AVFilterContext *ctx, const char *args, void *opaque);
+ int (*init)(AVFilterContext *ctx, const char *args);
/**
* Filter uninitialization function. Should deallocate any memory held
@@ -524,14 +411,7 @@ typedef struct AVFilter {
*/
int (*query_formats)(AVFilterContext *);
- const AVFilterPad *inputs; ///< NULL terminated list of inputs. NULL if none
- const AVFilterPad *outputs; ///< NULL terminated list of outputs. NULL if none
-
- /**
- * A description for the filter. You should use the
- * NULL_IF_CONFIG_SMALL() macro to define it.
- */
- const char *description;
+ int priv_size; ///< size of private data to allocate for the filter
} AVFilter;
/** An instance of a filter */
@@ -542,13 +422,19 @@ struct AVFilterContext {
char *name; ///< name of this filter instance
- unsigned input_count; ///< number of input pads
AVFilterPad *input_pads; ///< array of input pads
AVFilterLink **inputs; ///< array of pointers to input links
+#if FF_API_FOO_COUNT
+ unsigned input_count; ///< @deprecated use nb_inputs
+#endif
+ unsigned nb_inputs; ///< number of input pads
- unsigned output_count; ///< number of output pads
AVFilterPad *output_pads; ///< array of output pads
AVFilterLink **outputs; ///< array of pointers to output links
+#if FF_API_FOO_COUNT
+ unsigned output_count; ///< @deprecated use nb_outputs
+#endif
+ unsigned nb_outputs; ///< number of output pads
void *priv; ///< private data for use by the filter
};
@@ -567,13 +453,6 @@ struct AVFilterLink {
AVFilterContext *dst; ///< dest filter
AVFilterPad *dstpad; ///< input pad on the dest filter
- /** stage of the initialization of the link properties (dimensions, etc) */
- enum {
- AVLINK_UNINIT = 0, ///< not started
- AVLINK_STARTINIT, ///< started, but incomplete
- AVLINK_INIT ///< complete
- } init_state;
-
enum AVMediaType type; ///< filter media type
/* These parameters apply only to video */
@@ -581,12 +460,28 @@ struct AVFilterLink {
int h; ///< agreed upon image height
AVRational sample_aspect_ratio; ///< agreed upon sample aspect ratio
/* These two parameters apply only to audio */
- uint64_t channel_layout; ///< channel layout of current buffer (see libavutil/audioconvert.h)
- int64_t sample_rate; ///< samples per second
+ uint64_t channel_layout; ///< channel layout of current buffer (see libavutil/channel_layout.h)
+ int sample_rate; ///< samples per second
int format; ///< agreed upon media format
/**
+ * Define the time base used by the PTS of the frames/samples
+ * which will pass through this link.
+ * During the configuration stage, each filter is supposed to
+ * change only the output timebase, while the timebase of the
+ * input link is assumed to be an unchangeable property.
+ */
+ AVRational time_base;
+
+ /*****************************************************************
+ * All fields below this line are not part of the public API. They
+ * may not be used outside of libavfilter and can be changed and
+ * removed at will.
+ * New public fields should be added right above.
+ *****************************************************************
+ */
+ /**
* Lists of formats supported by the input and output filters respectively.
* These lists are used for negotiating the format to actually be used,
* which will be loaded into the format member, above, when chosen.
@@ -595,25 +490,29 @@ struct AVFilterLink {
AVFilterFormats *out_formats;
/**
- * The buffer reference currently being sent across the link by the source
- * filter. This is used internally by the filter system to allow
- * automatic copying of buffers which do not have sufficient permissions
- * for the destination. This should not be accessed directly by the
- * filters.
+ * Lists of channel layouts and sample rates used for automatic
+ * negotiation.
*/
- AVFilterBufferRef *src_buf;
-
- AVFilterBufferRef *cur_buf;
- AVFilterBufferRef *out_buf;
+ AVFilterFormats *in_samplerates;
+ AVFilterFormats *out_samplerates;
+ struct AVFilterChannelLayouts *in_channel_layouts;
+ struct AVFilterChannelLayouts *out_channel_layouts;
/**
- * Define the time base used by the PTS of the frames/samples
- * which will pass through this link.
- * During the configuration stage, each filter is supposed to
- * change only the output timebase, while the timebase of the
- * input link is assumed to be an unchangeable property.
+ * Audio only, the destination filter sets this to a non-zero value to
+ * request that buffers with the given number of samples should be sent to
+ * it. AVFilterPad.needs_fifo must also be set on the corresponding input
+ * pad.
+ * Last buffer before EOF will be padded with silence.
*/
- AVRational time_base;
+ int request_samples;
+
+ /** stage of the initialization of the link properties (dimensions, etc) */
+ enum {
+ AVLINK_UNINIT = 0, ///< not started
+ AVLINK_STARTINIT, ///< started, but incomplete
+ AVLINK_INIT ///< complete
+ } init_state;
};
/**
@@ -637,20 +536,6 @@ int avfilter_link(AVFilterContext *src, unsigned srcpad,
int avfilter_config_links(AVFilterContext *filter);
/**
- * Request a picture buffer with a specific set of permissions.
- *
- * @param link the output link to the filter from which the buffer will
- * be requested
- * @param perms the required access permissions
- * @param w the minimum width of the buffer to allocate
- * @param h the minimum height of the buffer to allocate
- * @return A reference to the buffer. This must be unreferenced with
- * avfilter_unref_buffer when you are finished with it.
- */
-AVFilterBufferRef *avfilter_get_video_buffer(AVFilterLink *link, int perms,
- int w, int h);
-
-/**
* Create a buffer reference wrapped around an already allocated image
* buffer.
*
@@ -663,86 +548,25 @@ AVFilterBufferRef *avfilter_get_video_buffer(AVFilterLink *link, int perms,
*/
AVFilterBufferRef *
avfilter_get_video_buffer_ref_from_arrays(uint8_t *data[4], int linesize[4], int perms,
- int w, int h, enum PixelFormat format);
+ int w, int h, enum AVPixelFormat format);
/**
- * Request an audio samples buffer with a specific set of permissions.
+ * Create an audio buffer reference wrapped around an already
+ * allocated samples buffer.
*
- * @param link the output link to the filter from which the buffer will
- * be requested
+ * @param data pointers to the samples plane buffers
+ * @param linesize linesize for the samples plane buffers
* @param perms the required access permissions
+ * @param nb_samples number of samples per channel
* @param sample_fmt the format of each sample in the buffer to allocate
- * @param size the buffer size in bytes
- * @param channel_layout the number and type of channels per sample in the buffer to allocate
- * @param planar audio data layout - planar or packed
- * @return A reference to the samples. This must be unreferenced with
- * avfilter_unref_buffer when you are finished with it.
- */
-AVFilterBufferRef *avfilter_get_audio_buffer(AVFilterLink *link, int perms,
- enum AVSampleFormat sample_fmt, int size,
- uint64_t channel_layout, int planar);
-
-/**
- * Request an input frame from the filter at the other end of the link.
- *
- * @param link the input link
- * @return zero on success
- */
-int avfilter_request_frame(AVFilterLink *link);
-
-/**
- * Poll a frame from the filter chain.
- *
- * @param link the input link
- * @return the number of immediately available frames, a negative
- * number in case of error
- */
-int avfilter_poll_frame(AVFilterLink *link);
-
-/**
- * Notify the next filter of the start of a frame.
- *
- * @param link the output link the frame will be sent over
- * @param picref A reference to the frame about to be sent. The data for this
- * frame need only be valid once draw_slice() is called for that
- * portion. The receiving filter will free this reference when
- * it no longer needs it.
- */
-void avfilter_start_frame(AVFilterLink *link, AVFilterBufferRef *picref);
-
-/**
- * Notifie the next filter that the current frame has finished.
- *
- * @param link the output link the frame was sent over
- */
-void avfilter_end_frame(AVFilterLink *link);
-
-/**
- * Send a slice to the next filter.
- *
- * Slices have to be provided in sequential order, either in
- * top-bottom or bottom-top order. If slices are provided in
- * non-sequential order the behavior of the function is undefined.
- *
- * @param link the output link over which the frame is being sent
- * @param y offset in pixels from the top of the image for this slice
- * @param h height of this slice in pixels
- * @param slice_dir the assumed direction for sending slices,
- * from the top slice to the bottom slice if the value is 1,
- * from the bottom slice to the top slice if the value is -1,
- * for other values the behavior of the function is undefined.
+ * @param channel_layout the channel layout of the buffer
*/
-void avfilter_draw_slice(AVFilterLink *link, int y, int h, int slice_dir);
-
-/**
- * Send a buffer of audio samples to the next filter.
- *
- * @param link the output link over which the audio samples are being sent
- * @param samplesref a reference to the buffer of audio samples being sent. The
- * receiving filter will free this reference when it no longer
- * needs it or pass it on to the next filter.
- */
-void avfilter_filter_samples(AVFilterLink *link, AVFilterBufferRef *samplesref);
+AVFilterBufferRef *avfilter_get_audio_buffer_ref_from_arrays(uint8_t **data,
+ int linesize,
+ int perms,
+ int nb_samples,
+ enum AVSampleFormat sample_fmt,
+ uint64_t channel_layout);
/** Initialize the filter system. Register all builtin filters. */
void avfilter_register_all(void);
@@ -822,44 +646,19 @@ int avfilter_insert_filter(AVFilterLink *link, AVFilterContext *filt,
unsigned filt_srcpad_idx, unsigned filt_dstpad_idx);
/**
- * Insert a new pad.
+ * Copy the frame properties of src to dst, without copying the actual
+ * image data.
*
- * @param idx Insertion point. Pad is inserted at the end if this point
- * is beyond the end of the list of pads.
- * @param count Pointer to the number of pads in the list
- * @param padidx_off Offset within an AVFilterLink structure to the element
- * to increment when inserting a new pad causes link
- * numbering to change
- * @param pads Pointer to the pointer to the beginning of the list of pads
- * @param links Pointer to the pointer to the beginning of the list of links
- * @param newpad The new pad to add. A copy is made when adding.
+ * @return 0 on success, a negative number on error.
*/
-void avfilter_insert_pad(unsigned idx, unsigned *count, size_t padidx_off,
- AVFilterPad **pads, AVFilterLink ***links,
- AVFilterPad *newpad);
-
-/** Insert a new input pad for the filter. */
-static inline void avfilter_insert_inpad(AVFilterContext *f, unsigned index,
- AVFilterPad *p)
-{
- avfilter_insert_pad(index, &f->input_count, offsetof(AVFilterLink, dstpad),
- &f->input_pads, &f->inputs, p);
-}
-
-/** Insert a new output pad for the filter. */
-static inline void avfilter_insert_outpad(AVFilterContext *f, unsigned index,
- AVFilterPad *p)
-{
- avfilter_insert_pad(index, &f->output_count, offsetof(AVFilterLink, srcpad),
- &f->output_pads, &f->outputs, p);
-}
+int avfilter_copy_frame_props(AVFilterBufferRef *dst, const AVFrame *src);
/**
- * Copy the frame properties of src to dst, without copying the actual
- * image data.
+ * Copy the frame properties and data pointers of src to dst, without copying
+ * the actual data.
*
* @return 0 on success, a negative number on error.
*/
-int avfilter_copy_frame_props(AVFilterBufferRef *dst, const AVFrame *src);
+int avfilter_copy_buf_props(AVFrame *dst, const AVFilterBufferRef *src);
#endif /* AVFILTER_AVFILTER_H */
diff --git a/gst-libs/ext/libav/libavfilter/avfiltergraph.c b/gst-libs/ext/libav/libavfilter/avfiltergraph.c
index 8ed38f0..d27b1b2 100644
--- a/gst-libs/ext/libav/libavfilter/avfiltergraph.c
+++ b/gst-libs/ext/libav/libavfilter/avfiltergraph.c
@@ -23,14 +23,29 @@
#include <ctype.h>
#include <string.h>
+#include "libavutil/avassert.h"
#include "libavutil/avstring.h"
+#include "libavutil/channel_layout.h"
+#include "libavutil/common.h"
+#include "libavutil/log.h"
#include "avfilter.h"
#include "avfiltergraph.h"
+#include "formats.h"
#include "internal.h"
+static const AVClass filtergraph_class = {
+ .class_name = "AVFilterGraph",
+ .item_name = av_default_item_name,
+ .version = LIBAVUTIL_VERSION_INT,
+};
+
AVFilterGraph *avfilter_graph_alloc(void)
{
- return av_mallocz(sizeof(AVFilterGraph));
+ AVFilterGraph *ret = av_mallocz(sizeof(AVFilterGraph));
+ if (!ret)
+ return NULL;
+ ret->av_class = &filtergraph_class;
+ return ret;
}
void avfilter_graph_free(AVFilterGraph **graph)
@@ -78,7 +93,15 @@ fail:
return ret;
}
-int ff_avfilter_graph_check_validity(AVFilterGraph *graph, AVClass *log_ctx)
+/**
+ * Check for the validity of graph.
+ *
+ * A graph is considered valid if all its input and output pads are
+ * connected.
+ *
+ * @return 0 in case of success, a negative value otherwise
+ */
+static int graph_check_validity(AVFilterGraph *graph, AVClass *log_ctx)
{
AVFilterContext *filt;
int i, j;
@@ -86,7 +109,7 @@ int ff_avfilter_graph_check_validity(AVFilterGraph *graph, AVClass *log_ctx)
for (i = 0; i < graph->filter_count; i++) {
filt = graph->filters[i];
- for (j = 0; j < filt->input_count; j++) {
+ for (j = 0; j < filt->nb_inputs; j++) {
if (!filt->inputs[j] || !filt->inputs[j]->src) {
av_log(log_ctx, AV_LOG_ERROR,
"Input pad \"%s\" for the filter \"%s\" of type \"%s\" not connected to any source\n",
@@ -95,7 +118,7 @@ int ff_avfilter_graph_check_validity(AVFilterGraph *graph, AVClass *log_ctx)
}
}
- for (j = 0; j < filt->output_count; j++) {
+ for (j = 0; j < filt->nb_outputs; j++) {
if (!filt->outputs[j] || !filt->outputs[j]->dst) {
av_log(log_ctx, AV_LOG_ERROR,
"Output pad \"%s\" for the filter \"%s\" of type \"%s\" not connected to any destination\n",
@@ -108,7 +131,12 @@ int ff_avfilter_graph_check_validity(AVFilterGraph *graph, AVClass *log_ctx)
return 0;
}
-int ff_avfilter_graph_config_links(AVFilterGraph *graph, AVClass *log_ctx)
+/**
+ * Configure all the links of graphctx.
+ *
+ * @return 0 in case of success, a negative value otherwise
+ */
+static int graph_config_links(AVFilterGraph *graph, AVClass *log_ctx)
{
AVFilterContext *filt;
int i, ret;
@@ -116,7 +144,7 @@ int ff_avfilter_graph_config_links(AVFilterGraph *graph, AVClass *log_ctx)
for (i=0; i < graph->filter_count; i++) {
filt = graph->filters[i];
- if (!filt->output_count) {
+ if (!filt->nb_outputs) {
if ((ret = avfilter_config_links(filt)))
return ret;
}
@@ -139,29 +167,58 @@ AVFilterContext *avfilter_graph_get_filter(AVFilterGraph *graph, char *name)
static int query_formats(AVFilterGraph *graph, AVClass *log_ctx)
{
int i, j, ret;
- int scaler_count = 0;
- char inst_name[30];
+ int scaler_count = 0, resampler_count = 0;
/* ask all the sub-filters for their supported media formats */
for (i = 0; i < graph->filter_count; i++) {
if (graph->filters[i]->filter->query_formats)
graph->filters[i]->filter->query_formats(graph->filters[i]);
else
- avfilter_default_query_formats(graph->filters[i]);
+ ff_default_query_formats(graph->filters[i]);
}
/* go through and merge as many format lists as possible */
for (i = 0; i < graph->filter_count; i++) {
AVFilterContext *filter = graph->filters[i];
- for (j = 0; j < filter->input_count; j++) {
+ for (j = 0; j < filter->nb_inputs; j++) {
AVFilterLink *link = filter->inputs[j];
- if (link && link->in_formats != link->out_formats) {
- if (!avfilter_merge_formats(link->in_formats,
- link->out_formats)) {
- AVFilterContext *scale;
- char scale_args[256];
- /* couldn't merge format lists. auto-insert scale filter */
+ int convert_needed = 0;
+
+ if (!link)
+ continue;
+
+ if (link->in_formats != link->out_formats &&
+ !ff_merge_formats(link->in_formats,
+ link->out_formats))
+ convert_needed = 1;
+ if (link->type == AVMEDIA_TYPE_AUDIO) {
+ if (link->in_channel_layouts != link->out_channel_layouts &&
+ !ff_merge_channel_layouts(link->in_channel_layouts,
+ link->out_channel_layouts))
+ convert_needed = 1;
+ if (link->in_samplerates != link->out_samplerates &&
+ !ff_merge_samplerates(link->in_samplerates,
+ link->out_samplerates))
+ convert_needed = 1;
+ }
+
+ if (convert_needed) {
+ AVFilterContext *convert;
+ AVFilter *filter;
+ AVFilterLink *inlink, *outlink;
+ char scale_args[256];
+ char inst_name[30];
+
+ /* couldn't merge format lists. auto-insert conversion filter */
+ switch (link->type) {
+ case AVMEDIA_TYPE_VIDEO:
+ if (!(filter = avfilter_get_by_name("scale"))) {
+ av_log(log_ctx, AV_LOG_ERROR, "'scale' filter "
+ "not present, cannot convert pixel formats.\n");
+ return AVERROR(EINVAL);
+ }
+
snprintf(inst_name, sizeof(inst_name), "auto-inserted scaler %d",
scaler_count++);
av_strlcpy(scale_args, "0:0", sizeof(scale_args));
@@ -169,22 +226,55 @@ static int query_formats(AVFilterGraph *graph, AVClass *log_ctx)
av_strlcat(scale_args, ":", sizeof(scale_args));
av_strlcat(scale_args, graph->scale_sws_opts, sizeof(scale_args));
}
- if ((ret = avfilter_graph_create_filter(&scale, avfilter_get_by_name("scale"),
- inst_name, scale_args, NULL, graph)) < 0)
- return ret;
- if ((ret = avfilter_insert_filter(link, scale, 0, 0)) < 0)
+ if ((ret = avfilter_graph_create_filter(&convert, filter,
+ inst_name, scale_args, NULL,
+ graph)) < 0)
return ret;
-
- scale->filter->query_formats(scale);
- if (((link = scale-> inputs[0]) &&
- !avfilter_merge_formats(link->in_formats, link->out_formats)) ||
- ((link = scale->outputs[0]) &&
- !avfilter_merge_formats(link->in_formats, link->out_formats))) {
- av_log(log_ctx, AV_LOG_ERROR,
- "Impossible to convert between the formats supported by the filter "
- "'%s' and the filter '%s'\n", link->src->name, link->dst->name);
+ break;
+ case AVMEDIA_TYPE_AUDIO:
+ if (!(filter = avfilter_get_by_name("resample"))) {
+ av_log(log_ctx, AV_LOG_ERROR, "'resample' filter "
+ "not present, cannot convert audio formats.\n");
return AVERROR(EINVAL);
}
+
+ snprintf(inst_name, sizeof(inst_name), "auto-inserted resampler %d",
+ resampler_count++);
+ if ((ret = avfilter_graph_create_filter(&convert, filter,
+ inst_name, NULL, NULL, graph)) < 0)
+ return ret;
+ break;
+ default:
+ return AVERROR(EINVAL);
+ }
+
+ if ((ret = avfilter_insert_filter(link, convert, 0, 0)) < 0)
+ return ret;
+
+ convert->filter->query_formats(convert);
+ inlink = convert->inputs[0];
+ outlink = convert->outputs[0];
+ if (!ff_merge_formats( inlink->in_formats, inlink->out_formats) ||
+ !ff_merge_formats(outlink->in_formats, outlink->out_formats))
+ ret |= AVERROR(ENOSYS);
+ if (inlink->type == AVMEDIA_TYPE_AUDIO &&
+ (!ff_merge_samplerates(inlink->in_samplerates,
+ inlink->out_samplerates) ||
+ !ff_merge_channel_layouts(inlink->in_channel_layouts,
+ inlink->out_channel_layouts)))
+ ret |= AVERROR(ENOSYS);
+ if (outlink->type == AVMEDIA_TYPE_AUDIO &&
+ (!ff_merge_samplerates(outlink->in_samplerates,
+ outlink->out_samplerates) ||
+ !ff_merge_channel_layouts(outlink->in_channel_layouts,
+ outlink->out_channel_layouts)))
+ ret |= AVERROR(ENOSYS);
+
+ if (ret < 0) {
+ av_log(log_ctx, AV_LOG_ERROR,
+ "Impossible to convert between the formats supported by the filter "
+ "'%s' and the filter '%s'\n", link->src->name, link->dst->name);
+ return ret;
}
}
}
@@ -193,33 +283,357 @@ static int query_formats(AVFilterGraph *graph, AVClass *log_ctx)
return 0;
}
-static void pick_format(AVFilterLink *link)
+static int pick_format(AVFilterLink *link)
{
if (!link || !link->in_formats)
- return;
+ return 0;
link->in_formats->format_count = 1;
link->format = link->in_formats->formats[0];
- avfilter_formats_unref(&link->in_formats);
- avfilter_formats_unref(&link->out_formats);
+ if (link->type == AVMEDIA_TYPE_AUDIO) {
+ if (!link->in_samplerates->format_count) {
+ av_log(link->src, AV_LOG_ERROR, "Cannot select sample rate for"
+ " the link between filters %s and %s.\n", link->src->name,
+ link->dst->name);
+ return AVERROR(EINVAL);
+ }
+ link->in_samplerates->format_count = 1;
+ link->sample_rate = link->in_samplerates->formats[0];
+
+ if (!link->in_channel_layouts->nb_channel_layouts) {
+ av_log(link->src, AV_LOG_ERROR, "Cannot select channel layout for"
+ "the link between filters %s and %s.\n", link->src->name,
+ link->dst->name);
+ return AVERROR(EINVAL);
+ }
+ link->in_channel_layouts->nb_channel_layouts = 1;
+ link->channel_layout = link->in_channel_layouts->channel_layouts[0];
+ }
+
+ ff_formats_unref(&link->in_formats);
+ ff_formats_unref(&link->out_formats);
+ ff_formats_unref(&link->in_samplerates);
+ ff_formats_unref(&link->out_samplerates);
+ ff_channel_layouts_unref(&link->in_channel_layouts);
+ ff_channel_layouts_unref(&link->out_channel_layouts);
+
+ return 0;
}
-static void pick_formats(AVFilterGraph *graph)
+#define REDUCE_FORMATS(fmt_type, list_type, list, var, nb, add_format) \
+do { \
+ for (i = 0; i < filter->nb_inputs; i++) { \
+ AVFilterLink *link = filter->inputs[i]; \
+ fmt_type fmt; \
+ \
+ if (!link->out_ ## list || link->out_ ## list->nb != 1) \
+ continue; \
+ fmt = link->out_ ## list->var[0]; \
+ \
+ for (j = 0; j < filter->nb_outputs; j++) { \
+ AVFilterLink *out_link = filter->outputs[j]; \
+ list_type *fmts; \
+ \
+ if (link->type != out_link->type || \
+ out_link->in_ ## list->nb == 1) \
+ continue; \
+ fmts = out_link->in_ ## list; \
+ \
+ if (!out_link->in_ ## list->nb) { \
+ add_format(&out_link->in_ ##list, fmt); \
+ break; \
+ } \
+ \
+ for (k = 0; k < out_link->in_ ## list->nb; k++) \
+ if (fmts->var[k] == fmt) { \
+ fmts->var[0] = fmt; \
+ fmts->nb = 1; \
+ ret = 1; \
+ break; \
+ } \
+ } \
+ } \
+} while (0)
+
+static int reduce_formats_on_filter(AVFilterContext *filter)
{
+ int i, j, k, ret = 0;
+
+ REDUCE_FORMATS(int, AVFilterFormats, formats, formats,
+ format_count, ff_add_format);
+ REDUCE_FORMATS(int, AVFilterFormats, samplerates, formats,
+ format_count, ff_add_format);
+ REDUCE_FORMATS(uint64_t, AVFilterChannelLayouts, channel_layouts,
+ channel_layouts, nb_channel_layouts, ff_add_channel_layout);
+
+ return ret;
+}
+
+static void reduce_formats(AVFilterGraph *graph)
+{
+ int i, reduced;
+
+ do {
+ reduced = 0;
+
+ for (i = 0; i < graph->filter_count; i++)
+ reduced |= reduce_formats_on_filter(graph->filters[i]);
+ } while (reduced);
+}
+
+static void swap_samplerates_on_filter(AVFilterContext *filter)
+{
+ AVFilterLink *link = NULL;
+ int sample_rate;
int i, j;
+ for (i = 0; i < filter->nb_inputs; i++) {
+ link = filter->inputs[i];
+
+ if (link->type == AVMEDIA_TYPE_AUDIO &&
+ link->out_samplerates->format_count == 1)
+ break;
+ }
+ if (i == filter->nb_inputs)
+ return;
+
+ sample_rate = link->out_samplerates->formats[0];
+
+ for (i = 0; i < filter->nb_outputs; i++) {
+ AVFilterLink *outlink = filter->outputs[i];
+ int best_idx, best_diff = INT_MAX;
+
+ if (outlink->type != AVMEDIA_TYPE_AUDIO ||
+ outlink->in_samplerates->format_count < 2)
+ continue;
+
+ for (j = 0; j < outlink->in_samplerates->format_count; j++) {
+ int diff = abs(sample_rate - outlink->in_samplerates->formats[j]);
+
+ if (diff < best_diff) {
+ best_diff = diff;
+ best_idx = j;
+ }
+ }
+ FFSWAP(int, outlink->in_samplerates->formats[0],
+ outlink->in_samplerates->formats[best_idx]);
+ }
+}
+
+static void swap_samplerates(AVFilterGraph *graph)
+{
+ int i;
+
+ for (i = 0; i < graph->filter_count; i++)
+ swap_samplerates_on_filter(graph->filters[i]);
+}
+
+#define CH_CENTER_PAIR (AV_CH_FRONT_LEFT_OF_CENTER | AV_CH_FRONT_RIGHT_OF_CENTER)
+#define CH_FRONT_PAIR (AV_CH_FRONT_LEFT | AV_CH_FRONT_RIGHT)
+#define CH_STEREO_PAIR (AV_CH_STEREO_LEFT | AV_CH_STEREO_RIGHT)
+#define CH_WIDE_PAIR (AV_CH_WIDE_LEFT | AV_CH_WIDE_RIGHT)
+#define CH_SIDE_PAIR (AV_CH_SIDE_LEFT | AV_CH_SIDE_RIGHT)
+#define CH_DIRECT_PAIR (AV_CH_SURROUND_DIRECT_LEFT | AV_CH_SURROUND_DIRECT_RIGHT)
+#define CH_BACK_PAIR (AV_CH_BACK_LEFT | AV_CH_BACK_RIGHT)
+
+/* allowable substitutions for channel pairs when comparing layouts,
+ * ordered by priority for both values */
+static const uint64_t ch_subst[][2] = {
+ { CH_FRONT_PAIR, CH_CENTER_PAIR },
+ { CH_FRONT_PAIR, CH_WIDE_PAIR },
+ { CH_FRONT_PAIR, AV_CH_FRONT_CENTER },
+ { CH_CENTER_PAIR, CH_FRONT_PAIR },
+ { CH_CENTER_PAIR, CH_WIDE_PAIR },
+ { CH_CENTER_PAIR, AV_CH_FRONT_CENTER },
+ { CH_WIDE_PAIR, CH_FRONT_PAIR },
+ { CH_WIDE_PAIR, CH_CENTER_PAIR },
+ { CH_WIDE_PAIR, AV_CH_FRONT_CENTER },
+ { AV_CH_FRONT_CENTER, CH_FRONT_PAIR },
+ { AV_CH_FRONT_CENTER, CH_CENTER_PAIR },
+ { AV_CH_FRONT_CENTER, CH_WIDE_PAIR },
+ { CH_SIDE_PAIR, CH_DIRECT_PAIR },
+ { CH_SIDE_PAIR, CH_BACK_PAIR },
+ { CH_SIDE_PAIR, AV_CH_BACK_CENTER },
+ { CH_BACK_PAIR, CH_DIRECT_PAIR },
+ { CH_BACK_PAIR, CH_SIDE_PAIR },
+ { CH_BACK_PAIR, AV_CH_BACK_CENTER },
+ { AV_CH_BACK_CENTER, CH_BACK_PAIR },
+ { AV_CH_BACK_CENTER, CH_DIRECT_PAIR },
+ { AV_CH_BACK_CENTER, CH_SIDE_PAIR },
+};
+
+static void swap_channel_layouts_on_filter(AVFilterContext *filter)
+{
+ AVFilterLink *link = NULL;
+ int i, j, k;
+
+ for (i = 0; i < filter->nb_inputs; i++) {
+ link = filter->inputs[i];
+
+ if (link->type == AVMEDIA_TYPE_AUDIO &&
+ link->out_channel_layouts->nb_channel_layouts == 1)
+ break;
+ }
+ if (i == filter->nb_inputs)
+ return;
+
+ for (i = 0; i < filter->nb_outputs; i++) {
+ AVFilterLink *outlink = filter->outputs[i];
+ int best_idx = -1, best_score = INT_MIN, best_count_diff = INT_MAX;
+
+ if (outlink->type != AVMEDIA_TYPE_AUDIO ||
+ outlink->in_channel_layouts->nb_channel_layouts < 2)
+ continue;
+
+ for (j = 0; j < outlink->in_channel_layouts->nb_channel_layouts; j++) {
+ uint64_t in_chlayout = link->out_channel_layouts->channel_layouts[0];
+ uint64_t out_chlayout = outlink->in_channel_layouts->channel_layouts[j];
+ int in_channels = av_get_channel_layout_nb_channels(in_chlayout);
+ int out_channels = av_get_channel_layout_nb_channels(out_chlayout);
+ int count_diff = out_channels - in_channels;
+ int matched_channels, extra_channels;
+ int score = 0;
+
+ /* channel substitution */
+ for (k = 0; k < FF_ARRAY_ELEMS(ch_subst); k++) {
+ uint64_t cmp0 = ch_subst[k][0];
+ uint64_t cmp1 = ch_subst[k][1];
+ if (( in_chlayout & cmp0) && (!(out_chlayout & cmp0)) &&
+ (out_chlayout & cmp1) && (!( in_chlayout & cmp1))) {
+ in_chlayout &= ~cmp0;
+ out_chlayout &= ~cmp1;
+ /* add score for channel match, minus a deduction for
+ having to do the substitution */
+ score += 10 * av_get_channel_layout_nb_channels(cmp1) - 2;
+ }
+ }
+
+ /* no penalty for LFE channel mismatch */
+ if ( (in_chlayout & AV_CH_LOW_FREQUENCY) &&
+ (out_chlayout & AV_CH_LOW_FREQUENCY))
+ score += 10;
+ in_chlayout &= ~AV_CH_LOW_FREQUENCY;
+ out_chlayout &= ~AV_CH_LOW_FREQUENCY;
+
+ matched_channels = av_get_channel_layout_nb_channels(in_chlayout &
+ out_chlayout);
+ extra_channels = av_get_channel_layout_nb_channels(out_chlayout &
+ (~in_chlayout));
+ score += 10 * matched_channels - 5 * extra_channels;
+
+ if (score > best_score ||
+ (count_diff < best_count_diff && score == best_score)) {
+ best_score = score;
+ best_idx = j;
+ best_count_diff = count_diff;
+ }
+ }
+ av_assert0(best_idx >= 0);
+ FFSWAP(uint64_t, outlink->in_channel_layouts->channel_layouts[0],
+ outlink->in_channel_layouts->channel_layouts[best_idx]);
+ }
+
+}
+
+static void swap_channel_layouts(AVFilterGraph *graph)
+{
+ int i;
+
+ for (i = 0; i < graph->filter_count; i++)
+ swap_channel_layouts_on_filter(graph->filters[i]);
+}
+
+static void swap_sample_fmts_on_filter(AVFilterContext *filter)
+{
+ AVFilterLink *link = NULL;
+ int format, bps;
+ int i, j;
+
+ for (i = 0; i < filter->nb_inputs; i++) {
+ link = filter->inputs[i];
+
+ if (link->type == AVMEDIA_TYPE_AUDIO &&
+ link->out_formats->format_count == 1)
+ break;
+ }
+ if (i == filter->nb_inputs)
+ return;
+
+ format = link->out_formats->formats[0];
+ bps = av_get_bytes_per_sample(format);
+
+ for (i = 0; i < filter->nb_outputs; i++) {
+ AVFilterLink *outlink = filter->outputs[i];
+ int best_idx = -1, best_score = INT_MIN;
+
+ if (outlink->type != AVMEDIA_TYPE_AUDIO ||
+ outlink->in_formats->format_count < 2)
+ continue;
+
+ for (j = 0; j < outlink->in_formats->format_count; j++) {
+ int out_format = outlink->in_formats->formats[j];
+ int out_bps = av_get_bytes_per_sample(out_format);
+ int score;
+
+ if (av_get_packed_sample_fmt(out_format) == format ||
+ av_get_planar_sample_fmt(out_format) == format) {
+ best_idx = j;
+ break;
+ }
+
+ /* for s32 and float prefer double to prevent loss of information */
+ if (bps == 4 && out_bps == 8) {
+ best_idx = j;
+ break;
+ }
+
+ /* prefer closest higher or equal bps */
+ score = -abs(out_bps - bps);
+ if (out_bps >= bps)
+ score += INT_MAX/2;
+
+ if (score > best_score) {
+ best_score = score;
+ best_idx = j;
+ }
+ }
+ av_assert0(best_idx >= 0);
+ FFSWAP(int, outlink->in_formats->formats[0],
+ outlink->in_formats->formats[best_idx]);
+ }
+}
+
+static void swap_sample_fmts(AVFilterGraph *graph)
+{
+ int i;
+
+ for (i = 0; i < graph->filter_count; i++)
+ swap_sample_fmts_on_filter(graph->filters[i]);
+
+}
+
+static int pick_formats(AVFilterGraph *graph)
+{
+ int i, j, ret;
+
for (i = 0; i < graph->filter_count; i++) {
AVFilterContext *filter = graph->filters[i];
- for (j = 0; j < filter->input_count; j++)
- pick_format(filter->inputs[j]);
- for (j = 0; j < filter->output_count; j++)
- pick_format(filter->outputs[j]);
+ for (j = 0; j < filter->nb_inputs; j++)
+ if ((ret = pick_format(filter->inputs[j])) < 0)
+ return ret;
+ for (j = 0; j < filter->nb_outputs; j++)
+ if ((ret = pick_format(filter->outputs[j])) < 0)
+ return ret;
}
+ return 0;
}
-int ff_avfilter_graph_config_formats(AVFilterGraph *graph, AVClass *log_ctx)
+/**
+ * Configure the formats of all the links in the graph.
+ */
+static int graph_config_formats(AVFilterGraph *graph, AVClass *log_ctx)
{
int ret;
@@ -228,8 +642,56 @@ int ff_avfilter_graph_config_formats(AVFilterGraph *graph, AVClass *log_ctx)
return ret;
/* Once everything is merged, it's possible that we'll still have
- * multiple valid media format choices. We pick the first one. */
- pick_formats(graph);
+ * multiple valid media format choices. We try to minimize the amount
+ * of format conversion inside filters */
+ reduce_formats(graph);
+
+ /* for audio filters, ensure the best format, sample rate and channel layout
+ * is selected */
+ swap_sample_fmts(graph);
+ swap_samplerates(graph);
+ swap_channel_layouts(graph);
+
+ if ((ret = pick_formats(graph)) < 0)
+ return ret;
+
+ return 0;
+}
+
+static int graph_insert_fifos(AVFilterGraph *graph, AVClass *log_ctx)
+{
+ AVFilterContext *f;
+ int i, j, ret;
+ int fifo_count = 0;
+
+ for (i = 0; i < graph->filter_count; i++) {
+ f = graph->filters[i];
+
+ for (j = 0; j < f->nb_inputs; j++) {
+ AVFilterLink *link = f->inputs[j];
+ AVFilterContext *fifo_ctx;
+ AVFilter *fifo;
+ char name[32];
+
+ if (!link->dstpad->needs_fifo)
+ continue;
+
+ fifo = f->inputs[j]->type == AVMEDIA_TYPE_VIDEO ?
+ avfilter_get_by_name("fifo") :
+ avfilter_get_by_name("afifo");
+
+ snprintf(name, sizeof(name), "auto-inserted fifo %d", fifo_count++);
+
+ ret = avfilter_graph_create_filter(&fifo_ctx, fifo, name, NULL,
+ NULL, graph);
+ if (ret < 0)
+ return ret;
+
+ ret = avfilter_insert_filter(link, fifo_ctx, 0, 0);
+ if (ret < 0)
+ return ret;
+ }
+ }
return 0;
}
@@ -238,11 +700,13 @@ int avfilter_graph_config(AVFilterGraph *graphctx, void *log_ctx)
{
int ret;
- if ((ret = ff_avfilter_graph_check_validity(graphctx, log_ctx)))
+ if ((ret = graph_check_validity(graphctx, log_ctx)))
+ return ret;
+ if ((ret = graph_insert_fifos(graphctx, log_ctx)) < 0)
return ret;
- if ((ret = ff_avfilter_graph_config_formats(graphctx, log_ctx)))
+ if ((ret = graph_config_formats(graphctx, log_ctx)))
return ret;
- if ((ret = ff_avfilter_graph_config_links(graphctx, log_ctx)))
+ if ((ret = graph_config_links(graphctx, log_ctx)))
return ret;
return 0;
diff --git a/gst-libs/ext/libav/libavfilter/avfiltergraph.h b/gst-libs/ext/libav/libavfilter/avfiltergraph.h
index f9cf5cd..7c4672d 100644
--- a/gst-libs/ext/libav/libavfilter/avfiltergraph.h
+++ b/gst-libs/ext/libav/libavfilter/avfiltergraph.h
@@ -23,8 +23,10 @@
#define AVFILTER_AVFILTERGRAPH_H
#include "avfilter.h"
+#include "libavutil/log.h"
typedef struct AVFilterGraph {
+ const AVClass *av_class;
unsigned filter_count;
AVFilterContext **filters;
@@ -87,11 +89,11 @@ void avfilter_graph_free(AVFilterGraph **graph);
/**
* A linked-list of the inputs/outputs of the filter chain.
*
- * This is mainly useful for avfilter_graph_parse(), since this
- * function may accept a description of a graph with not connected
- * input/output pads. This struct specifies, per each not connected
- * pad contained in the graph, the filter context and the pad index
- * required for establishing a link.
+ * This is mainly useful for avfilter_graph_parse() / avfilter_graph_parse2(),
+ * where it is used to communicate open (unlinked) inputs and outputs from and
+ * to the caller.
+ * This struct specifies, per each not connected pad contained in the graph, the
+ * filter context and the pad index required for establishing a link.
*/
typedef struct AVFilterInOut {
/** unique name for this input/output in the list */
@@ -108,6 +110,19 @@ typedef struct AVFilterInOut {
} AVFilterInOut;
/**
+ * Allocate a single AVFilterInOut entry.
+ * Must be freed with avfilter_inout_free().
+ * @return allocated AVFilterInOut on success, NULL on failure.
+ */
+AVFilterInOut *avfilter_inout_alloc(void);
+
+/**
+ * Free the supplied list of AVFilterInOut and set *inout to NULL.
+ * If *inout is NULL, do nothing.
+ */
+void avfilter_inout_free(AVFilterInOut **inout);
+
+/**
* Add a graph described by a string to a graph.
*
* @param graph the filter graph where to link the parsed graph context
@@ -120,4 +135,38 @@ int avfilter_graph_parse(AVFilterGraph *graph, const char *filters,
AVFilterInOut *inputs, AVFilterInOut *outputs,
void *log_ctx);
+/**
+ * Add a graph described by a string to a graph.
+ *
+ * @param[in] graph the filter graph where to link the parsed graph context
+ * @param[in] filters string to be parsed
+ * @param[out] inputs a linked list of all free (unlinked) inputs of the
+ * parsed graph will be returned here. It is to be freed
+ * by the caller using avfilter_inout_free().
+ * @param[out] outputs a linked list of all free (unlinked) outputs of the
+ * parsed graph will be returned here. It is to be freed by the
+ * caller using avfilter_inout_free().
+ * @return zero on success, a negative AVERROR code on error
+ *
+ * @note the difference between avfilter_graph_parse2() and
+ * avfilter_graph_parse() is that in avfilter_graph_parse(), the caller provides
+ * the lists of inputs and outputs, which therefore must be known before calling
+ * the function. On the other hand, avfilter_graph_parse2() \em returns the
+ * inputs and outputs that are left unlinked after parsing the graph and the
+ * caller then deals with them. Another difference is that in
+ * avfilter_graph_parse(), the inputs parameter describes inputs of the
+ * <em>already existing</em> part of the graph; i.e. from the point of view of
+ * the newly created part, they are outputs. Similarly the outputs parameter
+ * describes outputs of the already existing filters, which are provided as
+ * inputs to the parsed filters.
+ * avfilter_graph_parse2() takes the opposite approach -- it makes no reference
+ * whatsoever to already existing parts of the graph and the inputs parameter
+ * will on return contain inputs of the newly parsed part of the graph.
+ * Analogously the outputs parameter will contain outputs of the newly created
+ * filters.
+ */
+int avfilter_graph_parse2(AVFilterGraph *graph, const char *filters,
+ AVFilterInOut **inputs,
+ AVFilterInOut **outputs);
+
#endif /* AVFILTER_AVFILTERGRAPH_H */
diff --git a/gst-libs/ext/libav/libavfilter/buffer.c b/gst-libs/ext/libav/libavfilter/buffer.c
new file mode 100644
index 0000000..8eb3ce3
--- /dev/null
+++ b/gst-libs/ext/libav/libavfilter/buffer.c
@@ -0,0 +1,175 @@
+/*
+ * 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
+ */
+
+#include "libavutil/channel_layout.h"
+#include "libavutil/common.h"
+#include "libavcodec/avcodec.h"
+
+#include "avfilter.h"
+#include "internal.h"
+
+/* TODO: buffer pool. see comment for avfilter_default_get_video_buffer() */
+void ff_avfilter_default_free_buffer(AVFilterBuffer *ptr)
+{
+ if (ptr->extended_data != ptr->data)
+ av_freep(&ptr->extended_data);
+ av_free(ptr->data[0]);
+ av_free(ptr);
+}
+
+AVFilterBufferRef *avfilter_ref_buffer(AVFilterBufferRef *ref, int pmask)
+{
+ AVFilterBufferRef *ret = av_malloc(sizeof(AVFilterBufferRef));
+ if (!ret)
+ return NULL;
+ *ret = *ref;
+ if (ref->type == AVMEDIA_TYPE_VIDEO) {
+ ret->video = av_malloc(sizeof(AVFilterBufferRefVideoProps));
+ if (!ret->video) {
+ av_free(ret);
+ return NULL;
+ }
+ *ret->video = *ref->video;
+ ret->extended_data = ret->data;
+ } else if (ref->type == AVMEDIA_TYPE_AUDIO) {
+ ret->audio = av_malloc(sizeof(AVFilterBufferRefAudioProps));
+ if (!ret->audio) {
+ av_free(ret);
+ return NULL;
+ }
+ *ret->audio = *ref->audio;
+
+ if (ref->extended_data != ref->data) {
+ int nb_channels = av_get_channel_layout_nb_channels(ref->audio->channel_layout);
+ if (!(ret->extended_data = av_malloc(sizeof(*ret->extended_data) *
+ nb_channels))) {
+ av_freep(&ret->audio);
+ av_freep(&ret);
+ return NULL;
+ }
+ memcpy(ret->extended_data, ref->extended_data,
+ sizeof(*ret->extended_data) * nb_channels);
+ } else
+ ret->extended_data = ret->data;
+ }
+ ret->perms &= pmask;
+ ret->buf->refcount ++;
+ return ret;
+}
+
+void avfilter_unref_buffer(AVFilterBufferRef *ref)
+{
+ if (!ref)
+ return;
+ if (!(--ref->buf->refcount))
+ ref->buf->free(ref->buf);
+ if (ref->extended_data != ref->data)
+ av_freep(&ref->extended_data);
+ av_free(ref->video);
+ av_free(ref->audio);
+ av_free(ref);
+}
+
+void avfilter_unref_bufferp(AVFilterBufferRef **ref)
+{
+ avfilter_unref_buffer(*ref);
+ *ref = NULL;
+}
+
+int avfilter_copy_frame_props(AVFilterBufferRef *dst, const AVFrame *src)
+{
+ dst->pts = src->pts;
+ dst->format = src->format;
+
+ switch (dst->type) {
+ case AVMEDIA_TYPE_VIDEO:
+ dst->video->w = src->width;
+ dst->video->h = src->height;
+ dst->video->pixel_aspect = src->sample_aspect_ratio;
+ dst->video->interlaced = src->interlaced_frame;
+ dst->video->top_field_first = src->top_field_first;
+ dst->video->key_frame = src->key_frame;
+ dst->video->pict_type = src->pict_type;
+ break;
+ case AVMEDIA_TYPE_AUDIO:
+ dst->audio->sample_rate = src->sample_rate;
+ dst->audio->channel_layout = src->channel_layout;
+ break;
+ default:
+ return AVERROR(EINVAL);
+ }
+
+ return 0;
+}
+
+int avfilter_copy_buf_props(AVFrame *dst, const AVFilterBufferRef *src)
+{
+ int planes, nb_channels;
+
+ memcpy(dst->data, src->data, sizeof(dst->data));
+ memcpy(dst->linesize, src->linesize, sizeof(dst->linesize));
+
+ dst->pts = src->pts;
+ dst->format = src->format;
+
+ switch (src->type) {
+ case AVMEDIA_TYPE_VIDEO:
+ dst->width = src->video->w;
+ dst->height = src->video->h;
+ dst->sample_aspect_ratio = src->video->pixel_aspect;
+ dst->interlaced_frame = src->video->interlaced;
+ dst->top_field_first = src->video->top_field_first;
+ dst->key_frame = src->video->key_frame;
+ dst->pict_type = src->video->pict_type;
+ break;
+ case AVMEDIA_TYPE_AUDIO:
+ nb_channels = av_get_channel_layout_nb_channels(src->audio->channel_layout);
+ planes = av_sample_fmt_is_planar(src->format) ? nb_channels : 1;
+
+ if (planes > FF_ARRAY_ELEMS(dst->data)) {
+ dst->extended_data = av_mallocz(planes * sizeof(*dst->extended_data));
+ if (!dst->extended_data)
+ return AVERROR(ENOMEM);
+ memcpy(dst->extended_data, src->extended_data,
+ planes * sizeof(*dst->extended_data));
+ } else
+ dst->extended_data = dst->data;
+
+ dst->sample_rate = src->audio->sample_rate;
+ dst->channel_layout = src->audio->channel_layout;
+ dst->nb_samples = src->audio->nb_samples;
+ break;
+ default:
+ return AVERROR(EINVAL);
+ }
+
+ return 0;
+}
+
+void avfilter_copy_buffer_ref_props(AVFilterBufferRef *dst, AVFilterBufferRef *src)
+{
+ // copy common properties
+ dst->pts = src->pts;
+ dst->pos = src->pos;
+
+ switch (src->type) {
+ case AVMEDIA_TYPE_VIDEO: *dst->video = *src->video; break;
+ case AVMEDIA_TYPE_AUDIO: *dst->audio = *src->audio; break;
+ default: break;
+ }
+}
diff --git a/gst-libs/ext/libav/libavfilter/buffersink.c b/gst-libs/ext/libav/libavfilter/buffersink.c
new file mode 100644
index 0000000..a315cb3
--- /dev/null
+++ b/gst-libs/ext/libav/libavfilter/buffersink.c
@@ -0,0 +1,182 @@
+/*
+ * Copyright (c) 2011 Stefano Sabatini
+ *
+ * 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
+ * buffer sink
+ */
+
+#include "libavutil/audio_fifo.h"
+#include "libavutil/avassert.h"
+#include "libavutil/channel_layout.h"
+#include "libavutil/common.h"
+#include "libavutil/mathematics.h"
+
+#include "audio.h"
+#include "avfilter.h"
+#include "buffersink.h"
+#include "internal.h"
+
+typedef struct {
+ AVFilterBufferRef *cur_buf; ///< last buffer delivered on the sink
+ AVAudioFifo *audio_fifo; ///< FIFO for audio samples
+ int64_t next_pts; ///< interpolating audio pts
+} BufferSinkContext;
+
+static av_cold void uninit(AVFilterContext *ctx)
+{
+ BufferSinkContext *sink = ctx->priv;
+
+ if (sink->audio_fifo)
+ av_audio_fifo_free(sink->audio_fifo);
+}
+
+static int filter_frame(AVFilterLink *link, AVFilterBufferRef *buf)
+{
+ BufferSinkContext *s = link->dst->priv;
+
+ av_assert0(!s->cur_buf);
+ s->cur_buf = buf;
+
+ return 0;
+}
+
+int av_buffersink_read(AVFilterContext *ctx, AVFilterBufferRef **buf)
+{
+ BufferSinkContext *s = ctx->priv;
+ AVFilterLink *link = ctx->inputs[0];
+ int ret;
+
+ if (!buf)
+ return ff_poll_frame(ctx->inputs[0]);
+
+ if ((ret = ff_request_frame(link)) < 0)
+ return ret;
+
+ if (!s->cur_buf)
+ return AVERROR(EINVAL);
+
+ *buf = s->cur_buf;
+ s->cur_buf = NULL;
+
+ return 0;
+}
+
+static int read_from_fifo(AVFilterContext *ctx, AVFilterBufferRef **pbuf,
+ int nb_samples)
+{
+ BufferSinkContext *s = ctx->priv;
+ AVFilterLink *link = ctx->inputs[0];
+ AVFilterBufferRef *buf;
+
+ if (!(buf = ff_get_audio_buffer(link, AV_PERM_WRITE, nb_samples)))
+ return AVERROR(ENOMEM);
+ av_audio_fifo_read(s->audio_fifo, (void**)buf->extended_data, nb_samples);
+
+ buf->pts = s->next_pts;
+ s->next_pts += av_rescale_q(nb_samples, (AVRational){1, link->sample_rate},
+ link->time_base);
+
+ *pbuf = buf;
+ return 0;
+
+}
+
+int av_buffersink_read_samples(AVFilterContext *ctx, AVFilterBufferRef **pbuf,
+ int nb_samples)
+{
+ BufferSinkContext *s = ctx->priv;
+ AVFilterLink *link = ctx->inputs[0];
+ int ret = 0;
+
+ if (!s->audio_fifo) {
+ int nb_channels = av_get_channel_layout_nb_channels(link->channel_layout);
+ if (!(s->audio_fifo = av_audio_fifo_alloc(link->format, nb_channels, nb_samples)))
+ return AVERROR(ENOMEM);
+ }
+
+ while (ret >= 0) {
+ AVFilterBufferRef *buf;
+
+ if (av_audio_fifo_size(s->audio_fifo) >= nb_samples)
+ return read_from_fifo(ctx, pbuf, nb_samples);
+
+ ret = av_buffersink_read(ctx, &buf);
+ if (ret == AVERROR_EOF && av_audio_fifo_size(s->audio_fifo))
+ return read_from_fifo(ctx, pbuf, av_audio_fifo_size(s->audio_fifo));
+ else if (ret < 0)
+ return ret;
+
+ if (buf->pts != AV_NOPTS_VALUE) {
+ s->next_pts = buf->pts -
+ av_rescale_q(av_audio_fifo_size(s->audio_fifo),
+ (AVRational){ 1, link->sample_rate },
+ link->time_base);
+ }
+
+ ret = av_audio_fifo_write(s->audio_fifo, (void**)buf->extended_data,
+ buf->audio->nb_samples);
+ avfilter_unref_buffer(buf);
+ }
+
+ return ret;
+}
+
+static const AVFilterPad avfilter_vsink_buffer_inputs[] = {
+ {
+ .name = "default",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .filter_frame = filter_frame,
+ .min_perms = AV_PERM_READ,
+ .needs_fifo = 1
+ },
+ { NULL }
+};
+
+AVFilter avfilter_vsink_buffer = {
+ .name = "buffersink",
+ .description = NULL_IF_CONFIG_SMALL("Buffer video frames, and make them available to the end of the filter graph."),
+ .priv_size = sizeof(BufferSinkContext),
+ .uninit = uninit,
+
+ .inputs = avfilter_vsink_buffer_inputs,
+ .outputs = NULL,
+};
+
+static const AVFilterPad avfilter_asink_abuffer_inputs[] = {
+ {
+ .name = "default",
+ .type = AVMEDIA_TYPE_AUDIO,
+ .filter_frame = filter_frame,
+ .min_perms = AV_PERM_READ,
+ .needs_fifo = 1
+ },
+ { NULL }
+};
+
+AVFilter avfilter_asink_abuffer = {
+ .name = "abuffersink",
+ .description = NULL_IF_CONFIG_SMALL("Buffer audio frames, and make them available to the end of the filter graph."),
+ .priv_size = sizeof(BufferSinkContext),
+ .uninit = uninit,
+
+ .inputs = avfilter_asink_abuffer_inputs,
+ .outputs = NULL,
+};
diff --git a/gst-libs/ext/libav/libavfilter/buffersink.h b/gst-libs/ext/libav/libavfilter/buffersink.h
new file mode 100644
index 0000000..e358ac3
--- /dev/null
+++ b/gst-libs/ext/libav/libavfilter/buffersink.h
@@ -0,0 +1,62 @@
+/*
+ * 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
+ */
+
+#ifndef AVFILTER_BUFFERSINK_H
+#define AVFILTER_BUFFERSINK_H
+
+/**
+ * @file
+ * memory buffer sink API
+ */
+
+#include "avfilter.h"
+
+/**
+ * Get a buffer with filtered data from sink and put it in buf.
+ *
+ * @param ctx pointer to a context of a buffersink or abuffersink AVFilter.
+ * @param buf pointer to the buffer will be written here if buf is non-NULL. buf
+ * must be freed by the caller using avfilter_unref_buffer().
+ * Buf may also be NULL to query whether a buffer is ready to be
+ * output.
+ *
+ * @return >= 0 in case of success, a negative AVERROR code in case of
+ * failure.
+ */
+int av_buffersink_read(AVFilterContext *ctx, AVFilterBufferRef **buf);
+
+/**
+ * Same as av_buffersink_read, but with the ability to specify the number of
+ * samples read. This function is less efficient than av_buffersink_read(),
+ * because it copies the data around.
+ *
+ * @param ctx pointer to a context of the abuffersink AVFilter.
+ * @param buf pointer to the buffer will be written here if buf is non-NULL. buf
+ * must be freed by the caller using avfilter_unref_buffer(). buf
+ * will contain exactly nb_samples audio samples, except at the end
+ * of stream, when it can contain less than nb_samples.
+ * Buf may also be NULL to query whether a buffer is ready to be
+ * output.
+ *
+ * @warning do not mix this function with av_buffersink_read(). Use only one or
+ * the other with a single sink, not both.
+ */
+int av_buffersink_read_samples(AVFilterContext *ctx, AVFilterBufferRef **buf,
+ int nb_samples);
+
+#endif /* AVFILTER_BUFFERSINK_H */
diff --git a/gst-libs/ext/libav/libavfilter/buffersrc.c b/gst-libs/ext/libav/libavfilter/buffersrc.c
new file mode 100644
index 0000000..3cee68d
--- /dev/null
+++ b/gst-libs/ext/libav/libavfilter/buffersrc.c
@@ -0,0 +1,390 @@
+/*
+ * Copyright (c) 2008 Vitor Sessak
+ *
+ * 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
+ * memory buffer source filter
+ */
+
+#include "libavutil/channel_layout.h"
+#include "libavutil/common.h"
+#include "libavutil/fifo.h"
+#include "libavutil/imgutils.h"
+#include "libavutil/opt.h"
+#include "libavutil/samplefmt.h"
+#include "audio.h"
+#include "avfilter.h"
+#include "buffersrc.h"
+#include "formats.h"
+#include "internal.h"
+#include "video.h"
+
+typedef struct {
+ const AVClass *class;
+ AVFifoBuffer *fifo;
+ AVRational time_base; ///< time_base to set in the output link
+
+ /* video only */
+ int h, w;
+ enum AVPixelFormat pix_fmt;
+ AVRational pixel_aspect;
+
+ /* audio only */
+ int sample_rate;
+ enum AVSampleFormat sample_fmt;
+ char *sample_fmt_str;
+ uint64_t channel_layout;
+ char *channel_layout_str;
+
+ int eof;
+} BufferSourceContext;
+
+#define CHECK_VIDEO_PARAM_CHANGE(s, c, width, height, format)\
+ if (c->w != width || c->h != height || c->pix_fmt != format) {\
+ av_log(s, AV_LOG_ERROR, "Changing frame properties on the fly is not supported.\n");\
+ return AVERROR(EINVAL);\
+ }
+
+#define CHECK_AUDIO_PARAM_CHANGE(s, c, srate, ch_layout, format)\
+ if (c->sample_fmt != format || c->sample_rate != srate ||\
+ c->channel_layout != ch_layout) {\
+ av_log(s, AV_LOG_ERROR, "Changing frame properties on the fly is not supported.\n");\
+ return AVERROR(EINVAL);\
+ }
+
+int av_buffersrc_write_frame(AVFilterContext *buffer_filter, const AVFrame *frame)
+{
+ BufferSourceContext *c = buffer_filter->priv;
+ AVFilterBufferRef *buf;
+ int ret;
+
+ if (!frame) {
+ c->eof = 1;
+ return 0;
+ } else if (c->eof)
+ return AVERROR(EINVAL);
+
+ if (!av_fifo_space(c->fifo) &&
+ (ret = av_fifo_realloc2(c->fifo, av_fifo_size(c->fifo) +
+ sizeof(buf))) < 0)
+ return ret;
+
+ switch (buffer_filter->outputs[0]->type) {
+ case AVMEDIA_TYPE_VIDEO:
+ CHECK_VIDEO_PARAM_CHANGE(buffer_filter, c, frame->width, frame->height,
+ frame->format);
+ buf = ff_get_video_buffer(buffer_filter->outputs[0], AV_PERM_WRITE,
+ c->w, c->h);
+ if (!buf)
+ return AVERROR(ENOMEM);
+
+ av_image_copy(buf->data, buf->linesize, frame->data, frame->linesize,
+ c->pix_fmt, c->w, c->h);
+ break;
+ case AVMEDIA_TYPE_AUDIO:
+ CHECK_AUDIO_PARAM_CHANGE(buffer_filter, c, frame->sample_rate, frame->channel_layout,
+ frame->format);
+ buf = ff_get_audio_buffer(buffer_filter->outputs[0], AV_PERM_WRITE,
+ frame->nb_samples);
+ if (!buf)
+ return AVERROR(ENOMEM);
+
+ av_samples_copy(buf->extended_data, frame->extended_data,
+ 0, 0, frame->nb_samples,
+ av_get_channel_layout_nb_channels(frame->channel_layout),
+ frame->format);
+ break;
+ default:
+ return AVERROR(EINVAL);
+ }
+
+ avfilter_copy_frame_props(buf, frame);
+
+ if ((ret = av_fifo_generic_write(c->fifo, &buf, sizeof(buf), NULL)) < 0) {
+ avfilter_unref_buffer(buf);
+ return ret;
+ }
+
+ return 0;
+}
+
+int av_buffersrc_buffer(AVFilterContext *s, AVFilterBufferRef *buf)
+{
+ BufferSourceContext *c = s->priv;
+ int ret;
+
+ if (!buf) {
+ c->eof = 1;
+ return 0;
+ } else if (c->eof)
+ return AVERROR(EINVAL);
+
+ if (!av_fifo_space(c->fifo) &&
+ (ret = av_fifo_realloc2(c->fifo, av_fifo_size(c->fifo) +
+ sizeof(buf))) < 0)
+ return ret;
+
+ switch (s->outputs[0]->type) {
+ case AVMEDIA_TYPE_VIDEO:
+ CHECK_VIDEO_PARAM_CHANGE(s, c, buf->video->w, buf->video->h, buf->format);
+ break;
+ case AVMEDIA_TYPE_AUDIO:
+ CHECK_AUDIO_PARAM_CHANGE(s, c, buf->audio->sample_rate, buf->audio->channel_layout,
+ buf->format);
+ break;
+ default:
+ return AVERROR(EINVAL);
+ }
+
+ if ((ret = av_fifo_generic_write(c->fifo, &buf, sizeof(buf), NULL)) < 0)
+ return ret;
+
+ return 0;
+}
+
+static av_cold int init_video(AVFilterContext *ctx, const char *args)
+{
+ BufferSourceContext *c = ctx->priv;
+ char pix_fmt_str[128];
+ int n = 0;
+
+ if (!args ||
+ (n = sscanf(args, "%d:%d:%127[^:]:%d:%d:%d:%d", &c->w, &c->h, pix_fmt_str,
+ &c->time_base.num, &c->time_base.den,
+ &c->pixel_aspect.num, &c->pixel_aspect.den)) != 7) {
+ av_log(ctx, AV_LOG_ERROR, "Expected 7 arguments, but %d found in '%s'\n", n, args);
+ return AVERROR(EINVAL);
+ }
+ if ((c->pix_fmt = av_get_pix_fmt(pix_fmt_str)) == AV_PIX_FMT_NONE) {
+ char *tail;
+ c->pix_fmt = strtol(pix_fmt_str, &tail, 10);
+ if (*tail || c->pix_fmt < 0 || c->pix_fmt >= AV_PIX_FMT_NB) {
+ av_log(ctx, AV_LOG_ERROR, "Invalid pixel format string '%s'\n", pix_fmt_str);
+ return AVERROR(EINVAL);
+ }
+ }
+
+ if (!(c->fifo = av_fifo_alloc(sizeof(AVFilterBufferRef*))))
+ return AVERROR(ENOMEM);
+
+ av_log(ctx, AV_LOG_VERBOSE, "w:%d h:%d pixfmt:%s\n", c->w, c->h, av_get_pix_fmt_name(c->pix_fmt));
+ return 0;
+}
+
+#define OFFSET(x) offsetof(BufferSourceContext, x)
+#define A AV_OPT_FLAG_AUDIO_PARAM
+static const AVOption audio_options[] = {
+ { "time_base", NULL, OFFSET(time_base), AV_OPT_TYPE_RATIONAL, { .dbl = 0 }, 0, INT_MAX, A },
+ { "sample_rate", NULL, OFFSET(sample_rate), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, A },
+ { "sample_fmt", NULL, OFFSET(sample_fmt_str), AV_OPT_TYPE_STRING, .flags = A },
+ { "channel_layout", NULL, OFFSET(channel_layout_str), AV_OPT_TYPE_STRING, .flags = A },
+ { NULL },
+};
+
+static const AVClass abuffer_class = {
+ .class_name = "abuffer source",
+ .item_name = av_default_item_name,
+ .option = audio_options,
+ .version = LIBAVUTIL_VERSION_INT,
+};
+
+static av_cold int init_audio(AVFilterContext *ctx, const char *args)
+{
+ BufferSourceContext *s = ctx->priv;
+ int ret = 0;
+
+ s->class = &abuffer_class;
+ av_opt_set_defaults(s);
+
+ if ((ret = av_set_options_string(s, args, "=", ":")) < 0) {
+ av_log(ctx, AV_LOG_ERROR, "Error parsing options string: %s.\n", args);
+ goto fail;
+ }
+
+ s->sample_fmt = av_get_sample_fmt(s->sample_fmt_str);
+ if (s->sample_fmt == AV_SAMPLE_FMT_NONE) {
+ av_log(ctx, AV_LOG_ERROR, "Invalid sample format %s.\n",
+ s->sample_fmt_str);
+ ret = AVERROR(EINVAL);
+ goto fail;
+ }
+
+ s->channel_layout = av_get_channel_layout(s->channel_layout_str);
+ if (!s->channel_layout) {
+ av_log(ctx, AV_LOG_ERROR, "Invalid channel layout %s.\n",
+ s->channel_layout_str);
+ ret = AVERROR(EINVAL);
+ goto fail;
+ }
+
+ if (!(s->fifo = av_fifo_alloc(sizeof(AVFilterBufferRef*)))) {
+ ret = AVERROR(ENOMEM);
+ goto fail;
+ }
+
+ if (!s->time_base.num)
+ s->time_base = (AVRational){1, s->sample_rate};
+
+ av_log(ctx, AV_LOG_VERBOSE, "tb:%d/%d samplefmt:%s samplerate: %d "
+ "ch layout:%s\n", s->time_base.num, s->time_base.den, s->sample_fmt_str,
+ s->sample_rate, s->channel_layout_str);
+
+fail:
+ av_opt_free(s);
+ return ret;
+}
+
+static av_cold void uninit(AVFilterContext *ctx)
+{
+ BufferSourceContext *s = ctx->priv;
+ while (s->fifo && av_fifo_size(s->fifo)) {
+ AVFilterBufferRef *buf;
+ av_fifo_generic_read(s->fifo, &buf, sizeof(buf), NULL);
+ avfilter_unref_buffer(buf);
+ }
+ av_fifo_free(s->fifo);
+ s->fifo = NULL;
+}
+
+static int query_formats(AVFilterContext *ctx)
+{
+ BufferSourceContext *c = ctx->priv;
+ AVFilterChannelLayouts *channel_layouts = NULL;
+ AVFilterFormats *formats = NULL;
+ AVFilterFormats *samplerates = NULL;
+
+ switch (ctx->outputs[0]->type) {
+ case AVMEDIA_TYPE_VIDEO:
+ ff_add_format(&formats, c->pix_fmt);
+ ff_set_common_formats(ctx, formats);
+ break;
+ case AVMEDIA_TYPE_AUDIO:
+ ff_add_format(&formats, c->sample_fmt);
+ ff_set_common_formats(ctx, formats);
+
+ ff_add_format(&samplerates, c->sample_rate);
+ ff_set_common_samplerates(ctx, samplerates);
+
+ ff_add_channel_layout(&channel_layouts, c->channel_layout);
+ ff_set_common_channel_layouts(ctx, channel_layouts);
+ break;
+ default:
+ return AVERROR(EINVAL);
+ }
+
+ return 0;
+}
+
+static int config_props(AVFilterLink *link)
+{
+ BufferSourceContext *c = link->src->priv;
+
+ switch (link->type) {
+ case AVMEDIA_TYPE_VIDEO:
+ link->w = c->w;
+ link->h = c->h;
+ link->sample_aspect_ratio = c->pixel_aspect;
+ break;
+ case AVMEDIA_TYPE_AUDIO:
+ link->channel_layout = c->channel_layout;
+ link->sample_rate = c->sample_rate;
+ break;
+ default:
+ return AVERROR(EINVAL);
+ }
+
+ link->time_base = c->time_base;
+ return 0;
+}
+
+static int request_frame(AVFilterLink *link)
+{
+ BufferSourceContext *c = link->src->priv;
+ AVFilterBufferRef *buf;
+ int ret = 0;
+
+ if (!av_fifo_size(c->fifo)) {
+ if (c->eof)
+ return AVERROR_EOF;
+ return AVERROR(EAGAIN);
+ }
+ av_fifo_generic_read(c->fifo, &buf, sizeof(buf), NULL);
+
+ ff_filter_frame(link, buf);
+
+ return ret;
+}
+
+static int poll_frame(AVFilterLink *link)
+{
+ BufferSourceContext *c = link->src->priv;
+ int size = av_fifo_size(c->fifo);
+ if (!size && c->eof)
+ return AVERROR_EOF;
+ return size/sizeof(AVFilterBufferRef*);
+}
+
+static const AVFilterPad avfilter_vsrc_buffer_outputs[] = {
+ {
+ .name = "default",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .request_frame = request_frame,
+ .poll_frame = poll_frame,
+ .config_props = config_props,
+ },
+ { NULL }
+};
+
+AVFilter avfilter_vsrc_buffer = {
+ .name = "buffer",
+ .description = NULL_IF_CONFIG_SMALL("Buffer video frames, and make them accessible to the filterchain."),
+ .priv_size = sizeof(BufferSourceContext),
+ .query_formats = query_formats,
+
+ .init = init_video,
+ .uninit = uninit,
+
+ .inputs = NULL,
+ .outputs = avfilter_vsrc_buffer_outputs,
+};
+
+static const AVFilterPad avfilter_asrc_abuffer_outputs[] = {
+ {
+ .name = "default",
+ .type = AVMEDIA_TYPE_AUDIO,
+ .request_frame = request_frame,
+ .poll_frame = poll_frame,
+ .config_props = config_props,
+ },
+ { NULL }
+};
+
+AVFilter avfilter_asrc_abuffer = {
+ .name = "abuffer",
+ .description = NULL_IF_CONFIG_SMALL("Buffer audio frames, and make them accessible to the filterchain."),
+ .priv_size = sizeof(BufferSourceContext),
+ .query_formats = query_formats,
+
+ .init = init_audio,
+ .uninit = uninit,
+
+ .inputs = NULL,
+ .outputs = avfilter_asrc_abuffer_outputs,
+};
diff --git a/gst-libs/ext/libav/libavfilter/buffersrc.h b/gst-libs/ext/libav/libavfilter/buffersrc.h
index bd82c06..452c691 100644
--- a/gst-libs/ext/libav/libavfilter/buffersrc.h
+++ b/gst-libs/ext/libav/libavfilter/buffersrc.h
@@ -32,7 +32,19 @@
*
* @param buf buffer containing frame data to be passed down the filtergraph.
* This function will take ownership of buf, the user must not free it.
+ * A NULL buf signals EOF -- i.e. no more frames will be sent to this filter.
*/
int av_buffersrc_buffer(AVFilterContext *s, AVFilterBufferRef *buf);
+/**
+ * Add a frame to the buffer source.
+ *
+ * @param s an instance of the buffersrc filter.
+ * @param frame frame to be added.
+ *
+ * @warning frame data will be memcpy()ed, which may be a big performance
+ * hit. Use av_buffersrc_buffer() to avoid copying the data.
+ */
+int av_buffersrc_write_frame(AVFilterContext *s, const AVFrame *frame);
+
#endif /* AVFILTER_BUFFERSRC_H */
diff --git a/gst-libs/ext/libav/libavfilter/defaults.c b/gst-libs/ext/libav/libavfilter/defaults.c
deleted file mode 100644
index 4c7e878..0000000
--- a/gst-libs/ext/libav/libavfilter/defaults.c
+++ /dev/null
@@ -1,300 +0,0 @@
-/*
- * Filter layer - default implementations
- * Copyright (c) 2007 Bobby Bingham
- *
- * 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
- */
-
-#include "libavutil/audioconvert.h"
-#include "libavutil/imgutils.h"
-#include "libavutil/samplefmt.h"
-#include "avfilter.h"
-#include "internal.h"
-
-/* TODO: buffer pool. see comment for avfilter_default_get_video_buffer() */
-void ff_avfilter_default_free_buffer(AVFilterBuffer *ptr)
-{
- av_free(ptr->data[0]);
- av_free(ptr);
-}
-
-/* TODO: set the buffer's priv member to a context structure for the whole
- * filter chain. This will allow for a buffer pool instead of the constant
- * alloc & free cycle currently implemented. */
-AVFilterBufferRef *avfilter_default_get_video_buffer(AVFilterLink *link, int perms, int w, int h)
-{
- int linesize[4];
- uint8_t *data[4];
- AVFilterBufferRef *picref = NULL;
-
- // +2 is needed for swscaler, +16 to be SIMD-friendly
- if (av_image_alloc(data, linesize, w, h, link->format, 16) < 0)
- return NULL;
-
- picref = avfilter_get_video_buffer_ref_from_arrays(data, linesize,
- perms, w, h, link->format);
- if (!picref) {
- av_free(data[0]);
- return NULL;
- }
-
- return picref;
-}
-
-AVFilterBufferRef *avfilter_default_get_audio_buffer(AVFilterLink *link, int perms,
- enum AVSampleFormat sample_fmt, int size,
- uint64_t channel_layout, int planar)
-{
- AVFilterBuffer *samples = av_mallocz(sizeof(AVFilterBuffer));
- AVFilterBufferRef *ref = NULL;
- int i, sample_size, chans_nb, bufsize, per_channel_size, step_size = 0;
- char *buf;
-
- if (!samples || !(ref = av_mallocz(sizeof(AVFilterBufferRef))))
- goto fail;
-
- ref->buf = samples;
- ref->format = sample_fmt;
-
- ref->audio = av_mallocz(sizeof(AVFilterBufferRefAudioProps));
- if (!ref->audio)
- goto fail;
-
- ref->audio->channel_layout = channel_layout;
- ref->audio->size = size;
- ref->audio->planar = planar;
-
- /* make sure the buffer gets read permission or it's useless for output */
- ref->perms = perms | AV_PERM_READ;
-
- samples->refcount = 1;
- samples->free = ff_avfilter_default_free_buffer;
-
- sample_size = av_get_bytes_per_sample(sample_fmt);
- chans_nb = av_get_channel_layout_nb_channels(channel_layout);
-
- per_channel_size = size/chans_nb;
- ref->audio->nb_samples = per_channel_size/sample_size;
-
- /* Set the number of bytes to traverse to reach next sample of a particular channel:
- * For planar, this is simply the sample size.
- * For packed, this is the number of samples * sample_size.
- */
- for (i = 0; i < chans_nb; i++)
- samples->linesize[i] = planar > 0 ? per_channel_size : sample_size;
- memset(&samples->linesize[chans_nb], 0, (8-chans_nb) * sizeof(samples->linesize[0]));
-
- /* Calculate total buffer size, round to multiple of 16 to be SIMD friendly */
- bufsize = (size + 15)&~15;
- buf = av_malloc(bufsize);
- if (!buf)
- goto fail;
-
- /* For planar, set the start point of each channel's data within the buffer
- * For packed, set the start point of the entire buffer only
- */
- samples->data[0] = buf;
- if (buf && planar) {
- for (i = 1; i < chans_nb; i++) {
- step_size += per_channel_size;
- samples->data[i] = buf + step_size;
- }
- } else {
- for (i = 1; i < chans_nb; i++)
- samples->data[i] = buf;
- }
-
- memset(&samples->data[chans_nb], 0, (8-chans_nb) * sizeof(samples->data[0]));
-
- memcpy(ref->data, samples->data, sizeof(ref->data));
- memcpy(ref->linesize, samples->linesize, sizeof(ref->linesize));
-
- return ref;
-
-fail:
- if (ref)
- av_free(ref->audio);
- av_free(ref);
- av_free(samples);
- return NULL;
-}
-
-void avfilter_default_start_frame(AVFilterLink *inlink, AVFilterBufferRef *picref)
-{
- AVFilterLink *outlink = NULL;
-
- if (inlink->dst->output_count)
- outlink = inlink->dst->outputs[0];
-
- if (outlink) {
- outlink->out_buf = avfilter_get_video_buffer(outlink, AV_PERM_WRITE, outlink->w, outlink->h);
- avfilter_copy_buffer_ref_props(outlink->out_buf, picref);
- avfilter_start_frame(outlink, avfilter_ref_buffer(outlink->out_buf, ~0));
- }
-}
-
-void avfilter_default_draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir)
-{
- AVFilterLink *outlink = NULL;
-
- if (inlink->dst->output_count)
- outlink = inlink->dst->outputs[0];
-
- if (outlink)
- avfilter_draw_slice(outlink, y, h, slice_dir);
-}
-
-void avfilter_default_end_frame(AVFilterLink *inlink)
-{
- AVFilterLink *outlink = NULL;
-
- if (inlink->dst->output_count)
- outlink = inlink->dst->outputs[0];
-
- avfilter_unref_buffer(inlink->cur_buf);
- inlink->cur_buf = NULL;
-
- if (outlink) {
- if (outlink->out_buf) {
- avfilter_unref_buffer(outlink->out_buf);
- outlink->out_buf = NULL;
- }
- avfilter_end_frame(outlink);
- }
-}
-
-/* FIXME: samplesref is same as link->cur_buf. Need to consider removing the redundant parameter. */
-void avfilter_default_filter_samples(AVFilterLink *inlink, AVFilterBufferRef *samplesref)
-{
- AVFilterLink *outlink = NULL;
-
- if (inlink->dst->output_count)
- outlink = inlink->dst->outputs[0];
-
- if (outlink) {
- outlink->out_buf = avfilter_default_get_audio_buffer(inlink, AV_PERM_WRITE, samplesref->format,
- samplesref->audio->size,
- samplesref->audio->channel_layout,
- samplesref->audio->planar);
- outlink->out_buf->pts = samplesref->pts;
- outlink->out_buf->audio->sample_rate = samplesref->audio->sample_rate;
- avfilter_filter_samples(outlink, avfilter_ref_buffer(outlink->out_buf, ~0));
- avfilter_unref_buffer(outlink->out_buf);
- outlink->out_buf = NULL;
- }
- avfilter_unref_buffer(samplesref);
- inlink->cur_buf = NULL;
-}
-
-/**
- * default config_link() implementation for output video links to simplify
- * the implementation of one input one output video filters */
-int avfilter_default_config_output_link(AVFilterLink *link)
-{
- if (link->src->input_count && link->src->inputs[0]) {
- if (link->type == AVMEDIA_TYPE_VIDEO) {
- link->w = link->src->inputs[0]->w;
- link->h = link->src->inputs[0]->h;
- link->time_base = link->src->inputs[0]->time_base;
- } else if (link->type == AVMEDIA_TYPE_AUDIO) {
- link->channel_layout = link->src->inputs[0]->channel_layout;
- link->sample_rate = link->src->inputs[0]->sample_rate;
- }
- } else {
- /* XXX: any non-simple filter which would cause this branch to be taken
- * really should implement its own config_props() for this link. */
- return -1;
- }
-
- return 0;
-}
-
-/**
- * A helper for query_formats() which sets all links to the same list of
- * formats. If there are no links hooked to this filter, the list of formats is
- * freed.
- *
- * FIXME: this will need changed for filters with a mix of pad types
- * (video + audio, etc)
- */
-void avfilter_set_common_formats(AVFilterContext *ctx, AVFilterFormats *formats)
-{
- int count = 0, i;
-
- for (i = 0; i < ctx->input_count; i++) {
- if (ctx->inputs[i]) {
- avfilter_formats_ref(formats, &ctx->inputs[i]->out_formats);
- count++;
- }
- }
- for (i = 0; i < ctx->output_count; i++) {
- if (ctx->outputs[i]) {
- avfilter_formats_ref(formats, &ctx->outputs[i]->in_formats);
- count++;
- }
- }
-
- if (!count) {
- av_free(formats->formats);
- av_free(formats->refs);
- av_free(formats);
- }
-}
-
-int avfilter_default_query_formats(AVFilterContext *ctx)
-{
- enum AVMediaType type = ctx->inputs && ctx->inputs [0] ? ctx->inputs [0]->type :
- ctx->outputs && ctx->outputs[0] ? ctx->outputs[0]->type :
- AVMEDIA_TYPE_VIDEO;
-
- avfilter_set_common_formats(ctx, avfilter_all_formats(type));
- return 0;
-}
-
-void avfilter_null_start_frame(AVFilterLink *link, AVFilterBufferRef *picref)
-{
- avfilter_start_frame(link->dst->outputs[0], picref);
-}
-
-void avfilter_null_draw_slice(AVFilterLink *link, int y, int h, int slice_dir)
-{
- avfilter_draw_slice(link->dst->outputs[0], y, h, slice_dir);
-}
-
-void avfilter_null_end_frame(AVFilterLink *link)
-{
- avfilter_end_frame(link->dst->outputs[0]);
-}
-
-void avfilter_null_filter_samples(AVFilterLink *link, AVFilterBufferRef *samplesref)
-{
- avfilter_filter_samples(link->dst->outputs[0], samplesref);
-}
-
-AVFilterBufferRef *avfilter_null_get_video_buffer(AVFilterLink *link, int perms, int w, int h)
-{
- return avfilter_get_video_buffer(link->dst->outputs[0], perms, w, h);
-}
-
-AVFilterBufferRef *avfilter_null_get_audio_buffer(AVFilterLink *link, int perms,
- enum AVSampleFormat sample_fmt, int size,
- uint64_t channel_layout, int packed)
-{
- return avfilter_get_audio_buffer(link->dst->outputs[0], perms, sample_fmt,
- size, channel_layout, packed);
-}
-
diff --git a/gst-libs/ext/libav/libavfilter/drawutils.c b/gst-libs/ext/libav/libavfilter/drawutils.c
index 6aaf5c5..e837760 100644
--- a/gst-libs/ext/libav/libavfilter/drawutils.c
+++ b/gst-libs/ext/libav/libavfilter/drawutils.c
@@ -16,30 +16,33 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <string.h>
+
#include "libavutil/avutil.h"
#include "libavutil/colorspace.h"
+#include "libavutil/mem.h"
#include "libavutil/pixdesc.h"
#include "drawutils.h"
enum { RED = 0, GREEN, BLUE, ALPHA };
int ff_fill_line_with_color(uint8_t *line[4], int pixel_step[4], int w, uint8_t dst_color[4],
- enum PixelFormat pix_fmt, uint8_t rgba_color[4],
+ enum AVPixelFormat pix_fmt, uint8_t rgba_color[4],
int *is_packed_rgba, uint8_t rgba_map_ptr[4])
{
uint8_t rgba_map[4] = {0};
int i;
- const AVPixFmtDescriptor *pix_desc = &av_pix_fmt_descriptors[pix_fmt];
+ const AVPixFmtDescriptor *pix_desc = av_pix_fmt_desc_get(pix_fmt);
int hsub = pix_desc->log2_chroma_w;
*is_packed_rgba = 1;
switch (pix_fmt) {
- case PIX_FMT_ARGB: rgba_map[ALPHA] = 0; rgba_map[RED ] = 1; rgba_map[GREEN] = 2; rgba_map[BLUE ] = 3; break;
- case PIX_FMT_ABGR: rgba_map[ALPHA] = 0; rgba_map[BLUE ] = 1; rgba_map[GREEN] = 2; rgba_map[RED ] = 3; break;
- case PIX_FMT_RGBA:
- case PIX_FMT_RGB24: rgba_map[RED ] = 0; rgba_map[GREEN] = 1; rgba_map[BLUE ] = 2; rgba_map[ALPHA] = 3; break;
- case PIX_FMT_BGRA:
- case PIX_FMT_BGR24: rgba_map[BLUE ] = 0; rgba_map[GREEN] = 1; rgba_map[RED ] = 2; rgba_map[ALPHA] = 3; break;
+ case AV_PIX_FMT_ARGB: rgba_map[ALPHA] = 0; rgba_map[RED ] = 1; rgba_map[GREEN] = 2; rgba_map[BLUE ] = 3; break;
+ case AV_PIX_FMT_ABGR: rgba_map[ALPHA] = 0; rgba_map[BLUE ] = 1; rgba_map[GREEN] = 2; rgba_map[RED ] = 3; break;
+ case AV_PIX_FMT_RGBA:
+ case AV_PIX_FMT_RGB24: rgba_map[RED ] = 0; rgba_map[GREEN] = 1; rgba_map[BLUE ] = 2; rgba_map[ALPHA] = 3; break;
+ case AV_PIX_FMT_BGRA:
+ case AV_PIX_FMT_BGR24: rgba_map[BLUE ] = 0; rgba_map[GREEN] = 1; rgba_map[RED ] = 2; rgba_map[ALPHA] = 3; break;
default:
*is_packed_rgba = 0;
}
diff --git a/gst-libs/ext/libav/libavfilter/drawutils.h b/gst-libs/ext/libav/libavfilter/drawutils.h
index 7b11c06..73f482e 100644
--- a/gst-libs/ext/libav/libavfilter/drawutils.h
+++ b/gst-libs/ext/libav/libavfilter/drawutils.h
@@ -29,7 +29,7 @@
int ff_fill_line_with_color(uint8_t *line[4], int pixel_step[4], int w,
uint8_t dst_color[4],
- enum PixelFormat pix_fmt, uint8_t rgba_color[4],
+ enum AVPixelFormat pix_fmt, uint8_t rgba_color[4],
int *is_packed_rgba, uint8_t rgba_map[4]);
void ff_draw_rectangle(uint8_t *dst[4], int dst_linesize[4],
diff --git a/gst-libs/ext/libav/libavfilter/fifo.c b/gst-libs/ext/libav/libavfilter/fifo.c
new file mode 100644
index 0000000..3faa84f
--- /dev/null
+++ b/gst-libs/ext/libav/libavfilter/fifo.c
@@ -0,0 +1,309 @@
+/*
+ * Copyright (c) 2007 Bobby Bingham
+ *
+ * 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
+ * FIFO buffering filter
+ */
+
+#include "libavutil/avassert.h"
+#include "libavutil/channel_layout.h"
+#include "libavutil/common.h"
+#include "libavutil/mathematics.h"
+#include "libavutil/samplefmt.h"
+
+#include "audio.h"
+#include "avfilter.h"
+#include "internal.h"
+#include "video.h"
+
+typedef struct Buf {
+ AVFilterBufferRef *buf;
+ struct Buf *next;
+} Buf;
+
+typedef struct {
+ Buf root;
+ Buf *last; ///< last buffered frame
+
+ /**
+ * When a specific number of output samples is requested, the partial
+ * buffer is stored here
+ */
+ AVFilterBufferRef *buf_out;
+ int allocated_samples; ///< number of samples buf_out was allocated for
+} FifoContext;
+
+static av_cold int init(AVFilterContext *ctx, const char *args)
+{
+ FifoContext *fifo = ctx->priv;
+ fifo->last = &fifo->root;
+
+ return 0;
+}
+
+static av_cold void uninit(AVFilterContext *ctx)
+{
+ FifoContext *fifo = ctx->priv;
+ Buf *buf, *tmp;
+
+ for (buf = fifo->root.next; buf; buf = tmp) {
+ tmp = buf->next;
+ avfilter_unref_bufferp(&buf->buf);
+ av_free(buf);
+ }
+
+ avfilter_unref_bufferp(&fifo->buf_out);
+}
+
+static int add_to_queue(AVFilterLink *inlink, AVFilterBufferRef *buf)
+{
+ FifoContext *fifo = inlink->dst->priv;
+
+ fifo->last->next = av_mallocz(sizeof(Buf));
+ if (!fifo->last->next) {
+ avfilter_unref_buffer(buf);
+ return AVERROR(ENOMEM);
+ }
+
+ fifo->last = fifo->last->next;
+ fifo->last->buf = buf;
+
+ return 0;
+}
+
+static void queue_pop(FifoContext *s)
+{
+ Buf *tmp = s->root.next->next;
+ if (s->last == s->root.next)
+ s->last = &s->root;
+ av_freep(&s->root.next);
+ s->root.next = tmp;
+}
+
+/**
+ * Move data pointers and pts offset samples forward.
+ */
+static void buffer_offset(AVFilterLink *link, AVFilterBufferRef *buf,
+ int offset)
+{
+ int nb_channels = av_get_channel_layout_nb_channels(link->channel_layout);
+ int planar = av_sample_fmt_is_planar(link->format);
+ int planes = planar ? nb_channels : 1;
+ int block_align = av_get_bytes_per_sample(link->format) * (planar ? 1 : nb_channels);
+ int i;
+
+ av_assert0(buf->audio->nb_samples > offset);
+
+ for (i = 0; i < planes; i++)
+ buf->extended_data[i] += block_align*offset;
+ if (buf->data != buf->extended_data)
+ memcpy(buf->data, buf->extended_data,
+ FFMIN(planes, FF_ARRAY_ELEMS(buf->data)) * sizeof(*buf->data));
+ buf->linesize[0] -= block_align*offset;
+ buf->audio->nb_samples -= offset;
+
+ if (buf->pts != AV_NOPTS_VALUE) {
+ buf->pts += av_rescale_q(offset, (AVRational){1, link->sample_rate},
+ link->time_base);
+ }
+}
+
+static int calc_ptr_alignment(AVFilterBufferRef *buf)
+{
+ int planes = av_sample_fmt_is_planar(buf->format) ?
+ av_get_channel_layout_nb_channels(buf->audio->channel_layout) : 1;
+ int min_align = 128;
+ int p;
+
+ for (p = 0; p < planes; p++) {
+ int cur_align = 128;
+ while ((intptr_t)buf->extended_data[p] % cur_align)
+ cur_align >>= 1;
+ if (cur_align < min_align)
+ min_align = cur_align;
+ }
+ return min_align;
+}
+
+static int return_audio_frame(AVFilterContext *ctx)
+{
+ AVFilterLink *link = ctx->outputs[0];
+ FifoContext *s = ctx->priv;
+ AVFilterBufferRef *head = s->root.next->buf;
+ AVFilterBufferRef *buf_out;
+ int ret;
+
+ if (!s->buf_out &&
+ head->audio->nb_samples >= link->request_samples &&
+ calc_ptr_alignment(head) >= 32) {
+ if (head->audio->nb_samples == link->request_samples) {
+ buf_out = head;
+ queue_pop(s);
+ } else {
+ buf_out = avfilter_ref_buffer(head, AV_PERM_READ);
+ if (!buf_out)
+ return AVERROR(ENOMEM);
+
+ buf_out->audio->nb_samples = link->request_samples;
+ buffer_offset(link, head, link->request_samples);
+ }
+ } else {
+ int nb_channels = av_get_channel_layout_nb_channels(link->channel_layout);
+
+ if (!s->buf_out) {
+ s->buf_out = ff_get_audio_buffer(link, AV_PERM_WRITE,
+ link->request_samples);
+ if (!s->buf_out)
+ return AVERROR(ENOMEM);
+
+ s->buf_out->audio->nb_samples = 0;
+ s->buf_out->pts = head->pts;
+ s->allocated_samples = link->request_samples;
+ } else if (link->request_samples != s->allocated_samples) {
+ av_log(ctx, AV_LOG_ERROR, "request_samples changed before the "
+ "buffer was returned.\n");
+ return AVERROR(EINVAL);
+ }
+
+ while (s->buf_out->audio->nb_samples < s->allocated_samples) {
+ int len;
+
+ if (!s->root.next &&
+ (ret = ff_request_frame(ctx->inputs[0])) < 0) {
+ if (ret == AVERROR_EOF) {
+ av_samples_set_silence(s->buf_out->extended_data,
+ s->buf_out->audio->nb_samples,
+ s->allocated_samples -
+ s->buf_out->audio->nb_samples,
+ nb_channels, link->format);
+ s->buf_out->audio->nb_samples = s->allocated_samples;
+ break;
+ }
+ return ret;
+ }
+ head = s->root.next->buf;
+
+ len = FFMIN(s->allocated_samples - s->buf_out->audio->nb_samples,
+ head->audio->nb_samples);
+
+ av_samples_copy(s->buf_out->extended_data, head->extended_data,
+ s->buf_out->audio->nb_samples, 0, len, nb_channels,
+ link->format);
+ s->buf_out->audio->nb_samples += len;
+
+ if (len == head->audio->nb_samples) {
+ avfilter_unref_buffer(head);
+ queue_pop(s);
+ } else {
+ buffer_offset(link, head, len);
+ }
+ }
+ buf_out = s->buf_out;
+ s->buf_out = NULL;
+ }
+ return ff_filter_frame(link, buf_out);
+}
+
+static int request_frame(AVFilterLink *outlink)
+{
+ FifoContext *fifo = outlink->src->priv;
+ int ret = 0;
+
+ if (!fifo->root.next) {
+ if ((ret = ff_request_frame(outlink->src->inputs[0])) < 0)
+ return ret;
+ }
+
+ if (outlink->request_samples) {
+ return return_audio_frame(outlink->src);
+ } else {
+ ret = ff_filter_frame(outlink, fifo->root.next->buf);
+ queue_pop(fifo);
+ }
+
+ return ret;
+}
+
+static const AVFilterPad avfilter_vf_fifo_inputs[] = {
+ {
+ .name = "default",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .get_video_buffer = ff_null_get_video_buffer,
+ .filter_frame = add_to_queue,
+ .rej_perms = AV_PERM_REUSE2,
+ },
+ { NULL }
+};
+
+static const AVFilterPad avfilter_vf_fifo_outputs[] = {
+ {
+ .name = "default",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .request_frame = request_frame,
+ },
+ { NULL }
+};
+
+AVFilter avfilter_vf_fifo = {
+ .name = "fifo",
+ .description = NULL_IF_CONFIG_SMALL("Buffer input images and send them when they are requested."),
+
+ .init = init,
+ .uninit = uninit,
+
+ .priv_size = sizeof(FifoContext),
+
+ .inputs = avfilter_vf_fifo_inputs,
+ .outputs = avfilter_vf_fifo_outputs,
+};
+
+static const AVFilterPad avfilter_af_afifo_inputs[] = {
+ {
+ .name = "default",
+ .type = AVMEDIA_TYPE_AUDIO,
+ .get_audio_buffer = ff_null_get_audio_buffer,
+ .filter_frame = add_to_queue,
+ .rej_perms = AV_PERM_REUSE2,
+ },
+ { NULL }
+};
+
+static const AVFilterPad avfilter_af_afifo_outputs[] = {
+ {
+ .name = "default",
+ .type = AVMEDIA_TYPE_AUDIO,
+ .request_frame = request_frame,
+ },
+ { NULL }
+};
+
+AVFilter avfilter_af_afifo = {
+ .name = "afifo",
+ .description = NULL_IF_CONFIG_SMALL("Buffer input frames and send them when they are requested."),
+
+ .init = init,
+ .uninit = uninit,
+
+ .priv_size = sizeof(FifoContext),
+
+ .inputs = avfilter_af_afifo_inputs,
+ .outputs = avfilter_af_afifo_outputs,
+};
diff --git a/gst-libs/ext/libav/libavfilter/filtfmts.c b/gst-libs/ext/libav/libavfilter/filtfmts.c
new file mode 100644
index 0000000..480b277
--- /dev/null
+++ b/gst-libs/ext/libav/libavfilter/filtfmts.c
@@ -0,0 +1,104 @@
+/*
+ * Copyright (c) 2009 Stefano Sabatini
+ *
+ * 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
+ */
+
+#include <stdio.h>
+
+#include "libavformat/avformat.h"
+#include "libavutil/pixdesc.h"
+#include "libavfilter/avfilter.h"
+#include "libavfilter/formats.h"
+
+int main(int argc, char **argv)
+{
+ AVFilter *filter;
+ AVFilterContext *filter_ctx;
+ const char *filter_name;
+ const char *filter_args = NULL;
+ int i, j;
+
+ av_log_set_level(AV_LOG_DEBUG);
+
+ if (!argv[1]) {
+ fprintf(stderr, "Missing filter name as argument\n");
+ return 1;
+ }
+
+ filter_name = argv[1];
+ if (argv[2])
+ filter_args = argv[2];
+
+ avfilter_register_all();
+
+ /* get a corresponding filter and open it */
+ if (!(filter = avfilter_get_by_name(filter_name))) {
+ fprintf(stderr, "Unrecognized filter with name '%s'\n", filter_name);
+ return 1;
+ }
+
+ if (avfilter_open(&filter_ctx, filter, NULL) < 0) {
+ fprintf(stderr, "Impossible to open filter with name '%s'\n",
+ filter_name);
+ return 1;
+ }
+ if (avfilter_init_filter(filter_ctx, filter_args, NULL) < 0) {
+ fprintf(stderr, "Impossible to init filter '%s' with arguments '%s'\n",
+ filter_name, filter_args);
+ return 1;
+ }
+
+ /* create a link for each of the input pads */
+ for (i = 0; i < filter_ctx->input_count; i++) {
+ AVFilterLink *link = av_mallocz(sizeof(AVFilterLink));
+ link->type = filter_ctx->filter->inputs[i].type;
+ filter_ctx->inputs[i] = link;
+ }
+ for (i = 0; i < filter_ctx->output_count; i++) {
+ AVFilterLink *link = av_mallocz(sizeof(AVFilterLink));
+ link->type = filter_ctx->filter->outputs[i].type;
+ filter_ctx->outputs[i] = link;
+ }
+
+ if (filter->query_formats)
+ filter->query_formats(filter_ctx);
+ else
+ ff_default_query_formats(filter_ctx);
+
+ /* print the supported formats in input */
+ for (i = 0; i < filter_ctx->input_count; i++) {
+ AVFilterFormats *fmts = filter_ctx->inputs[i]->out_formats;
+ for (j = 0; j < fmts->format_count; j++)
+ printf("INPUT[%d] %s: %s\n",
+ i, filter_ctx->filter->inputs[i].name,
+ av_get_pix_fmt_name(fmts->formats[j]));
+ }
+
+ /* print the supported formats in output */
+ for (i = 0; i < filter_ctx->output_count; i++) {
+ AVFilterFormats *fmts = filter_ctx->outputs[i]->in_formats;
+ for (j = 0; j < fmts->format_count; j++)
+ printf("OUTPUT[%d] %s: %s\n",
+ i, filter_ctx->filter->outputs[i].name,
+ av_get_pix_fmt_name(fmts->formats[j]));
+ }
+
+ avfilter_free(filter_ctx);
+ fflush(stdout);
+ return 0;
+}
diff --git a/gst-libs/ext/libav/libavfilter/formats.c b/gst-libs/ext/libav/libavfilter/formats.c
index 7eca639..3b890d2 100644
--- a/gst-libs/ext/libav/libavfilter/formats.c
+++ b/gst-libs/ext/libav/libavfilter/formats.c
@@ -19,75 +19,150 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "libavutil/common.h"
#include "libavutil/pixdesc.h"
#include "avfilter.h"
#include "internal.h"
+#include "formats.h"
/**
* Add all refs from a to ret and destroy a.
*/
-static void merge_ref(AVFilterFormats *ret, AVFilterFormats *a)
-{
- int i;
-
- for(i = 0; i < a->refcount; i ++) {
- ret->refs[ret->refcount] = a->refs[i];
- *ret->refs[ret->refcount++] = ret;
- }
-
- av_free(a->refs);
- av_free(a->formats);
- av_free(a);
-}
+#define MERGE_REF(ret, a, fmts, type, fail) \
+do { \
+ type ***tmp; \
+ int i; \
+ \
+ if (!(tmp = av_realloc(ret->refs, \
+ sizeof(*tmp) * (ret->refcount + a->refcount)))) \
+ goto fail; \
+ ret->refs = tmp; \
+ \
+ for (i = 0; i < a->refcount; i ++) { \
+ ret->refs[ret->refcount] = a->refs[i]; \
+ *ret->refs[ret->refcount++] = ret; \
+ } \
+ \
+ av_freep(&a->refs); \
+ av_freep(&a->fmts); \
+ av_freep(&a); \
+} while (0)
-AVFilterFormats *avfilter_merge_formats(AVFilterFormats *a, AVFilterFormats *b)
+/**
+ * Add all formats common for a and b to ret, copy the refs and destroy
+ * a and b.
+ */
+#define MERGE_FORMATS(ret, a, b, fmts, nb, type, fail) \
+do { \
+ int i, j, k = 0, count = FFMIN(a->nb, b->nb); \
+ \
+ if (!(ret = av_mallocz(sizeof(*ret)))) \
+ goto fail; \
+ \
+ if (count) { \
+ if (!(ret->fmts = av_malloc(sizeof(*ret->fmts) * count))) \
+ goto fail; \
+ for (i = 0; i < a->nb; i++) \
+ for (j = 0; j < b->nb; j++) \
+ if (a->fmts[i] == b->fmts[j]) \
+ ret->fmts[k++] = a->fmts[i]; \
+ \
+ ret->nb = k; \
+ } \
+ /* check that there was at least one common format */ \
+ if (!ret->nb) \
+ goto fail; \
+ \
+ MERGE_REF(ret, a, fmts, type, fail); \
+ MERGE_REF(ret, b, fmts, type, fail); \
+} while (0)
+
+AVFilterFormats *ff_merge_formats(AVFilterFormats *a, AVFilterFormats *b)
{
- AVFilterFormats *ret;
- unsigned i, j, k = 0, m_count;
+ AVFilterFormats *ret = NULL;
if (a == b)
return a;
- ret = av_mallocz(sizeof(AVFilterFormats));
-
- /* merge list of formats */
- m_count = FFMIN(a->format_count, b->format_count);
- if (m_count) {
- ret->formats = av_malloc(sizeof(*ret->formats) * m_count);
- for(i = 0; i < a->format_count; i ++)
- for(j = 0; j < b->format_count; j ++)
- if(a->formats[i] == b->formats[j])
- ret->formats[k++] = a->formats[i];
+ MERGE_FORMATS(ret, a, b, formats, format_count, AVFilterFormats, fail);
- ret->format_count = k;
+ return ret;
+fail:
+ if (ret) {
+ av_freep(&ret->refs);
+ av_freep(&ret->formats);
}
- /* check that there was at least one common format */
- if(!ret->format_count) {
- av_free(ret->formats);
- av_free(ret);
- return NULL;
+ av_freep(&ret);
+ return NULL;
+}
+
+AVFilterFormats *ff_merge_samplerates(AVFilterFormats *a,
+ AVFilterFormats *b)
+{
+ AVFilterFormats *ret = NULL;
+
+ if (a == b) return a;
+
+ if (a->format_count && b->format_count) {
+ MERGE_FORMATS(ret, a, b, formats, format_count, AVFilterFormats, fail);
+ } else if (a->format_count) {
+ MERGE_REF(a, b, formats, AVFilterFormats, fail);
+ ret = a;
+ } else {
+ MERGE_REF(b, a, formats, AVFilterFormats, fail);
+ ret = b;
}
- ret->refs = av_malloc(sizeof(AVFilterFormats**)*(a->refcount+b->refcount));
+ return ret;
+fail:
+ if (ret) {
+ av_freep(&ret->refs);
+ av_freep(&ret->formats);
+ }
+ av_freep(&ret);
+ return NULL;
+}
- merge_ref(ret, a);
- merge_ref(ret, b);
+AVFilterChannelLayouts *ff_merge_channel_layouts(AVFilterChannelLayouts *a,
+ AVFilterChannelLayouts *b)
+{
+ AVFilterChannelLayouts *ret = NULL;
+
+ if (a == b) return a;
+
+ if (a->nb_channel_layouts && b->nb_channel_layouts) {
+ MERGE_FORMATS(ret, a, b, channel_layouts, nb_channel_layouts,
+ AVFilterChannelLayouts, fail);
+ } else if (a->nb_channel_layouts) {
+ MERGE_REF(a, b, channel_layouts, AVFilterChannelLayouts, fail);
+ ret = a;
+ } else {
+ MERGE_REF(b, a, channel_layouts, AVFilterChannelLayouts, fail);
+ ret = b;
+ }
return ret;
+fail:
+ if (ret) {
+ av_freep(&ret->refs);
+ av_freep(&ret->channel_layouts);
+ }
+ av_freep(&ret);
+ return NULL;
}
int ff_fmt_is_in(int fmt, const int *fmts)
{
const int *p;
- for (p = fmts; *p != PIX_FMT_NONE; p++) {
+ for (p = fmts; *p != AV_PIX_FMT_NONE; p++) {
if (fmt == *p)
return 1;
}
return 0;
}
-AVFilterFormats *avfilter_make_format_list(const int *fmts)
+AVFilterFormats *ff_make_format_list(const int *fmts)
{
AVFilterFormats *formats;
int count;
@@ -95,7 +170,7 @@ AVFilterFormats *avfilter_make_format_list(const int *fmts)
for (count = 0; fmts[count] != -1; count++)
;
- formats = av_mallocz(sizeof(AVFilterFormats));
+ formats = av_mallocz(sizeof(*formats));
if (count)
formats->formats = av_malloc(sizeof(*formats->formats) * count);
formats->format_count = count;
@@ -104,84 +179,216 @@ AVFilterFormats *avfilter_make_format_list(const int *fmts)
return formats;
}
-int avfilter_add_format(AVFilterFormats **avff, int fmt)
+#define ADD_FORMAT(f, fmt, type, list, nb) \
+do { \
+ type *fmts; \
+ \
+ if (!(*f) && !(*f = av_mallocz(sizeof(**f)))) \
+ return AVERROR(ENOMEM); \
+ \
+ fmts = av_realloc((*f)->list, \
+ sizeof(*(*f)->list) * ((*f)->nb + 1));\
+ if (!fmts) \
+ return AVERROR(ENOMEM); \
+ \
+ (*f)->list = fmts; \
+ (*f)->list[(*f)->nb++] = fmt; \
+ return 0; \
+} while (0)
+
+int ff_add_format(AVFilterFormats **avff, int fmt)
{
- int *fmts;
-
- if (!(*avff) && !(*avff = av_mallocz(sizeof(AVFilterFormats))))
- return AVERROR(ENOMEM);
-
- fmts = av_realloc((*avff)->formats,
- sizeof(*(*avff)->formats) * ((*avff)->format_count+1));
- if (!fmts)
- return AVERROR(ENOMEM);
+ ADD_FORMAT(avff, fmt, int, formats, format_count);
+}
- (*avff)->formats = fmts;
- (*avff)->formats[(*avff)->format_count++] = fmt;
- return 0;
+int ff_add_channel_layout(AVFilterChannelLayouts **l, uint64_t channel_layout)
+{
+ ADD_FORMAT(l, channel_layout, uint64_t, channel_layouts, nb_channel_layouts);
}
-AVFilterFormats *avfilter_all_formats(enum AVMediaType type)
+AVFilterFormats *ff_all_formats(enum AVMediaType type)
{
AVFilterFormats *ret = NULL;
int fmt;
- int num_formats = type == AVMEDIA_TYPE_VIDEO ? PIX_FMT_NB :
+ int num_formats = type == AVMEDIA_TYPE_VIDEO ? AV_PIX_FMT_NB :
type == AVMEDIA_TYPE_AUDIO ? AV_SAMPLE_FMT_NB : 0;
- for (fmt = 0; fmt < num_formats; fmt++)
+ for (fmt = 0; fmt < num_formats; fmt++) {
+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(fmt);
if ((type != AVMEDIA_TYPE_VIDEO) ||
- (type == AVMEDIA_TYPE_VIDEO && !(av_pix_fmt_descriptors[fmt].flags & PIX_FMT_HWACCEL)))
- avfilter_add_format(&ret, fmt);
+ (type == AVMEDIA_TYPE_VIDEO && !(desc->flags & PIX_FMT_HWACCEL)))
+ ff_add_format(&ret, fmt);
+ }
+
+ return ret;
+}
+
+AVFilterFormats *ff_planar_sample_fmts(void)
+{
+ AVFilterFormats *ret = NULL;
+ int fmt;
+
+ for (fmt = 0; fmt < AV_SAMPLE_FMT_NB; fmt++)
+ if (av_sample_fmt_is_planar(fmt))
+ ff_add_format(&ret, fmt);
return ret;
}
-void avfilter_formats_ref(AVFilterFormats *f, AVFilterFormats **ref)
+AVFilterFormats *ff_all_samplerates(void)
{
- *ref = f;
- f->refs = av_realloc(f->refs, sizeof(AVFilterFormats**) * ++f->refcount);
- f->refs[f->refcount-1] = ref;
+ AVFilterFormats *ret = av_mallocz(sizeof(*ret));
+ return ret;
}
-static int find_ref_index(AVFilterFormats **ref)
+AVFilterChannelLayouts *ff_all_channel_layouts(void)
{
- int i;
- for(i = 0; i < (*ref)->refcount; i ++)
- if((*ref)->refs[i] == ref)
- return i;
- return -1;
+ AVFilterChannelLayouts *ret = av_mallocz(sizeof(*ret));
+ return ret;
}
-void avfilter_formats_unref(AVFilterFormats **ref)
+#define FORMATS_REF(f, ref) \
+do { \
+ *ref = f; \
+ f->refs = av_realloc(f->refs, sizeof(*f->refs) * ++f->refcount); \
+ f->refs[f->refcount-1] = ref; \
+} while (0)
+
+void ff_channel_layouts_ref(AVFilterChannelLayouts *f, AVFilterChannelLayouts **ref)
{
- int idx;
+ FORMATS_REF(f, ref);
+}
- if (!*ref)
- return;
+void ff_formats_ref(AVFilterFormats *f, AVFilterFormats **ref)
+{
+ FORMATS_REF(f, ref);
+}
- idx = find_ref_index(ref);
+#define FIND_REF_INDEX(ref, idx) \
+do { \
+ int i; \
+ for (i = 0; i < (*ref)->refcount; i ++) \
+ if((*ref)->refs[i] == ref) { \
+ idx = i; \
+ break; \
+ } \
+} while (0)
+
+#define FORMATS_UNREF(ref, list) \
+do { \
+ int idx = -1; \
+ \
+ if (!*ref) \
+ return; \
+ \
+ FIND_REF_INDEX(ref, idx); \
+ \
+ if (idx >= 0) \
+ memmove((*ref)->refs + idx, (*ref)->refs + idx + 1, \
+ sizeof(*(*ref)->refs) * ((*ref)->refcount - idx - 1)); \
+ \
+ if(!--(*ref)->refcount) { \
+ av_free((*ref)->list); \
+ av_free((*ref)->refs); \
+ av_free(*ref); \
+ } \
+ *ref = NULL; \
+} while (0)
+
+void ff_formats_unref(AVFilterFormats **ref)
+{
+ FORMATS_UNREF(ref, formats);
+}
- if(idx >= 0)
- memmove((*ref)->refs + idx, (*ref)->refs + idx+1,
- sizeof(AVFilterFormats**) * ((*ref)->refcount-idx-1));
+void ff_channel_layouts_unref(AVFilterChannelLayouts **ref)
+{
+ FORMATS_UNREF(ref, channel_layouts);
+}
- if(!--(*ref)->refcount) {
- av_free((*ref)->formats);
- av_free((*ref)->refs);
- av_free(*ref);
- }
- *ref = NULL;
+#define FORMATS_CHANGEREF(oldref, newref) \
+do { \
+ int idx = -1; \
+ \
+ FIND_REF_INDEX(oldref, idx); \
+ \
+ if (idx >= 0) { \
+ (*oldref)->refs[idx] = newref; \
+ *newref = *oldref; \
+ *oldref = NULL; \
+ } \
+} while (0)
+
+void ff_channel_layouts_changeref(AVFilterChannelLayouts **oldref,
+ AVFilterChannelLayouts **newref)
+{
+ FORMATS_CHANGEREF(oldref, newref);
}
-void avfilter_formats_changeref(AVFilterFormats **oldref,
- AVFilterFormats **newref)
+void ff_formats_changeref(AVFilterFormats **oldref, AVFilterFormats **newref)
{
- int idx = find_ref_index(oldref);
+ FORMATS_CHANGEREF(oldref, newref);
+}
- if(idx >= 0) {
- (*oldref)->refs[idx] = newref;
- *newref = *oldref;
- *oldref = NULL;
- }
+#define SET_COMMON_FORMATS(ctx, fmts, in_fmts, out_fmts, ref, list) \
+{ \
+ int count = 0, i; \
+ \
+ for (i = 0; i < ctx->nb_inputs; i++) { \
+ if (ctx->inputs[i]) { \
+ ref(fmts, &ctx->inputs[i]->out_fmts); \
+ count++; \
+ } \
+ } \
+ for (i = 0; i < ctx->nb_outputs; i++) { \
+ if (ctx->outputs[i]) { \
+ ref(fmts, &ctx->outputs[i]->in_fmts); \
+ count++; \
+ } \
+ } \
+ \
+ if (!count) { \
+ av_freep(&fmts->list); \
+ av_freep(&fmts->refs); \
+ av_freep(&fmts); \
+ } \
}
+void ff_set_common_channel_layouts(AVFilterContext *ctx,
+ AVFilterChannelLayouts *layouts)
+{
+ SET_COMMON_FORMATS(ctx, layouts, in_channel_layouts, out_channel_layouts,
+ ff_channel_layouts_ref, channel_layouts);
+}
+
+void ff_set_common_samplerates(AVFilterContext *ctx,
+ AVFilterFormats *samplerates)
+{
+ SET_COMMON_FORMATS(ctx, samplerates, in_samplerates, out_samplerates,
+ ff_formats_ref, formats);
+}
+
+/**
+ * A helper for query_formats() which sets all links to the same list of
+ * formats. If there are no links hooked to this filter, the list of formats is
+ * freed.
+ */
+void ff_set_common_formats(AVFilterContext *ctx, AVFilterFormats *formats)
+{
+ SET_COMMON_FORMATS(ctx, formats, in_formats, out_formats,
+ ff_formats_ref, formats);
+}
+
+int ff_default_query_formats(AVFilterContext *ctx)
+{
+ enum AVMediaType type = ctx->inputs && ctx->inputs [0] ? ctx->inputs [0]->type :
+ ctx->outputs && ctx->outputs[0] ? ctx->outputs[0]->type :
+ AVMEDIA_TYPE_VIDEO;
+
+ ff_set_common_formats(ctx, ff_all_formats(type));
+ if (type == AVMEDIA_TYPE_AUDIO) {
+ ff_set_common_channel_layouts(ctx, ff_all_channel_layouts());
+ ff_set_common_samplerates(ctx, ff_all_samplerates());
+ }
+
+ return 0;
+}
diff --git a/gst-libs/ext/libav/libavfilter/formats.h b/gst-libs/ext/libav/libavfilter/formats.h
new file mode 100644
index 0000000..0e1628c
--- /dev/null
+++ b/gst-libs/ext/libav/libavfilter/formats.h
@@ -0,0 +1,221 @@
+/*
+ * 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
+ */
+
+#ifndef AVFILTER_FORMATS_H
+#define AVFILTER_FORMATS_H
+
+#include "avfilter.h"
+
+/**
+ * A list of supported formats for one end of a filter link. This is used
+ * during the format negotiation process to try to pick the best format to
+ * use to minimize the number of necessary conversions. Each filter gives a
+ * list of the formats supported by each input and output pad. The list
+ * given for each pad need not be distinct - they may be references to the
+ * same list of formats, as is often the case when a filter supports multiple
+ * formats, but will always output the same format as it is given in input.
+ *
+ * In this way, a list of possible input formats and a list of possible
+ * output formats are associated with each link. When a set of formats is
+ * negotiated over a link, the input and output lists are merged to form a
+ * new list containing only the common elements of each list. In the case
+ * that there were no common elements, a format conversion is necessary.
+ * Otherwise, the lists are merged, and all other links which reference
+ * either of the format lists involved in the merge are also affected.
+ *
+ * For example, consider the filter chain:
+ * filter (a) --> (b) filter (b) --> (c) filter
+ *
+ * where the letters in parenthesis indicate a list of formats supported on
+ * the input or output of the link. Suppose the lists are as follows:
+ * (a) = {A, B}
+ * (b) = {A, B, C}
+ * (c) = {B, C}
+ *
+ * First, the first link's lists are merged, yielding:
+ * filter (a) --> (a) filter (a) --> (c) filter
+ *
+ * Notice that format list (b) now refers to the same list as filter list (a).
+ * Next, the lists for the second link are merged, yielding:
+ * filter (a) --> (a) filter (a) --> (a) filter
+ *
+ * where (a) = {B}.
+ *
+ * Unfortunately, when the format lists at the two ends of a link are merged,
+ * we must ensure that all links which reference either pre-merge format list
+ * get updated as well. Therefore, we have the format list structure store a
+ * pointer to each of the pointers to itself.
+ */
+struct AVFilterFormats {
+ unsigned format_count; ///< number of formats
+ int *formats; ///< list of media formats
+
+ unsigned refcount; ///< number of references to this list
+ struct AVFilterFormats ***refs; ///< references to this list
+};
+
+typedef struct AVFilterChannelLayouts {
+ uint64_t *channel_layouts; ///< list of channel layouts
+ int nb_channel_layouts; ///< number of channel layouts
+
+ unsigned refcount; ///< number of references to this list
+ struct AVFilterChannelLayouts ***refs; ///< references to this list
+} AVFilterChannelLayouts;
+
+/**
+ * Return a channel layouts/samplerates list which contains the intersection of
+ * the layouts/samplerates of a and b. Also, all the references of a, all the
+ * references of b, and a and b themselves will be deallocated.
+ *
+ * If a and b do not share any common elements, neither is modified, and NULL
+ * is returned.
+ */
+AVFilterChannelLayouts *ff_merge_channel_layouts(AVFilterChannelLayouts *a,
+ AVFilterChannelLayouts *b);
+AVFilterFormats *ff_merge_samplerates(AVFilterFormats *a,
+ AVFilterFormats *b);
+
+/**
+ * Construct an empty AVFilterChannelLayouts/AVFilterFormats struct --
+ * representing any channel layout/sample rate.
+ */
+AVFilterChannelLayouts *ff_all_channel_layouts(void);
+AVFilterFormats *ff_all_samplerates(void);
+
+/**
+ * A helper for query_formats() which sets all links to the same list of channel
+ * layouts/sample rates. If there are no links hooked to this filter, the list
+ * is freed.
+ */
+void ff_set_common_channel_layouts(AVFilterContext *ctx,
+ AVFilterChannelLayouts *layouts);
+void ff_set_common_samplerates(AVFilterContext *ctx,
+ AVFilterFormats *samplerates);
+
+/**
+ * A helper for query_formats() which sets all links to the same list of
+ * formats. If there are no links hooked to this filter, the list of formats is
+ * freed.
+ */
+void ff_set_common_formats(AVFilterContext *ctx, AVFilterFormats *formats);
+
+int ff_add_channel_layout(AVFilterChannelLayouts **l, uint64_t channel_layout);
+
+/**
+ * Add *ref as a new reference to f.
+ */
+void ff_channel_layouts_ref(AVFilterChannelLayouts *f,
+ AVFilterChannelLayouts **ref);
+
+/**
+ * Remove a reference to a channel layouts list.
+ */
+void ff_channel_layouts_unref(AVFilterChannelLayouts **ref);
+
+void ff_channel_layouts_changeref(AVFilterChannelLayouts **oldref,
+ AVFilterChannelLayouts **newref);
+
+int ff_default_query_formats(AVFilterContext *ctx);
+
+
+/**
+ * Create a list of supported formats. This is intended for use in
+ * AVFilter->query_formats().
+ *
+ * @param fmts list of media formats, terminated by -1
+ * @return the format list, with no existing references
+ */
+AVFilterFormats *ff_make_format_list(const int *fmts);
+
+/**
+ * Add fmt to the list of media formats contained in *avff.
+ * If *avff is NULL the function allocates the filter formats struct
+ * and puts its pointer in *avff.
+ *
+ * @return a non negative value in case of success, or a negative
+ * value corresponding to an AVERROR code in case of error
+ */
+int ff_add_format(AVFilterFormats **avff, int fmt);
+
+/**
+ * Return a list of all formats supported by Libav for the given media type.
+ */
+AVFilterFormats *ff_all_formats(enum AVMediaType type);
+
+/**
+ * Construct a formats list containing all planar sample formats.
+ */
+AVFilterFormats *ff_planar_sample_fmts(void);
+
+/**
+ * Return a format list which contains the intersection of the formats of
+ * a and b. Also, all the references of a, all the references of b, and
+ * a and b themselves will be deallocated.
+ *
+ * If a and b do not share any common formats, neither is modified, and NULL
+ * is returned.
+ */
+AVFilterFormats *ff_merge_formats(AVFilterFormats *a, AVFilterFormats *b);
+
+/**
+ * Add *ref as a new reference to formats.
+ * That is the pointers will point like in the ascii art below:
+ * ________
+ * |formats |<--------.
+ * | ____ | ____|___________________
+ * | |refs| | | __|_
+ * | |* * | | | | | | AVFilterLink
+ * | |* *--------->|*ref|
+ * | |____| | | |____|
+ * |________| |________________________
+ */
+void ff_formats_ref(AVFilterFormats *formats, AVFilterFormats **ref);
+
+/**
+ * If *ref is non-NULL, remove *ref as a reference to the format list
+ * it currently points to, deallocates that list if this was the last
+ * reference, and sets *ref to NULL.
+ *
+ * Before After
+ * ________ ________ NULL
+ * |formats |<--------. |formats | ^
+ * | ____ | ____|________________ | ____ | ____|________________
+ * | |refs| | | __|_ | |refs| | | __|_
+ * | |* * | | | | | | AVFilterLink | |* * | | | | | | AVFilterLink
+ * | |* *--------->|*ref| | |* | | | |*ref|
+ * | |____| | | |____| | |____| | | |____|
+ * |________| |_____________________ |________| |_____________________
+ */
+void ff_formats_unref(AVFilterFormats **ref);
+
+/**
+ *
+ * Before After
+ * ________ ________
+ * |formats |<---------. |formats |<---------.
+ * | ____ | ___|___ | ____ | ___|___
+ * | |refs| | | | | | |refs| | | | | NULL
+ * | |* *--------->|*oldref| | |* *--------->|*newref| ^
+ * | |* * | | |_______| | |* * | | |_______| ___|___
+ * | |____| | | |____| | | | |
+ * |________| |________| |*oldref|
+ * |_______|
+ */
+void ff_formats_changeref(AVFilterFormats **oldref, AVFilterFormats **newref);
+
+#endif /* AVFILTER_FORMATS_H */
diff --git a/gst-libs/ext/libav/libavfilter/gradfun.h b/gst-libs/ext/libav/libavfilter/gradfun.h
index 6b192a3..876579a 100644
--- a/gst-libs/ext/libav/libavfilter/gradfun.h
+++ b/gst-libs/ext/libav/libavfilter/gradfun.h
@@ -25,7 +25,7 @@
#include "avfilter.h"
/// Holds instance-specific information for gradfun.
-typedef struct {
+typedef struct GradFunContext {
int thresh; ///< threshold for gradient algorithm
int radius; ///< blur radius
int chroma_w; ///< width of the chroma planes
@@ -37,12 +37,9 @@ typedef struct {
void (*blur_line) (uint16_t *dc, uint16_t *buf, uint16_t *buf1, uint8_t *src, int src_linesize, int width);
} GradFunContext;
+void ff_gradfun_init_x86(GradFunContext *gf);
+
void ff_gradfun_filter_line_c(uint8_t *dst, uint8_t *src, uint16_t *dc, int width, int thresh, const uint16_t *dithers);
void ff_gradfun_blur_line_c(uint16_t *dc, uint16_t *buf, uint16_t *buf1, uint8_t *src, int src_linesize, int width);
-void ff_gradfun_filter_line_mmx2(uint8_t *dst, uint8_t *src, uint16_t *dc, int width, int thresh, const uint16_t *dithers);
-void ff_gradfun_filter_line_ssse3(uint8_t *dst, uint8_t *src, uint16_t *dc, int width, int thresh, const uint16_t *dithers);
-
-void ff_gradfun_blur_line_sse2(uint16_t *dc, uint16_t *buf, uint16_t *buf1, uint8_t *src, int src_linesize, int width);
-
#endif /* AVFILTER_GRADFUN_H */
diff --git a/gst-libs/ext/libav/libavfilter/graphparser.c b/gst-libs/ext/libav/libavfilter/graphparser.c
index 94f291d..7ce60c1 100644
--- a/gst-libs/ext/libav/libavfilter/graphparser.c
+++ b/gst-libs/ext/libav/libavfilter/graphparser.c
@@ -22,8 +22,10 @@
#include <ctype.h>
#include <string.h>
+#include <stdio.h>
#include "libavutil/avstring.h"
+#include "libavutil/mem.h"
#include "avfilter.h"
#include "avfiltergraph.h"
@@ -171,13 +173,18 @@ static int parse_filter(AVFilterContext **filt_ctx, const char **buf, AVFilterGr
return ret;
}
-static void free_inout(AVFilterInOut *head)
+AVFilterInOut *avfilter_inout_alloc(void)
{
- while (head) {
- AVFilterInOut *next = head->next;
- av_free(head->name);
- av_free(head);
- head = next;
+ return av_mallocz(sizeof(AVFilterInOut));
+}
+
+void avfilter_inout_free(AVFilterInOut **inout)
+{
+ while (*inout) {
+ AVFilterInOut *next = (*inout)->next;
+ av_freep(&(*inout)->name);
+ av_freep(inout);
+ *inout = next;
}
}
@@ -185,13 +192,15 @@ static AVFilterInOut *extract_inout(const char *label, AVFilterInOut **links)
{
AVFilterInOut *ret;
- while (*links && strcmp((*links)->name, label))
+ while (*links && (!(*links)->name || strcmp((*links)->name, label)))
links = &((*links)->next);
ret = *links;
- if (ret)
+ if (ret) {
*links = ret->next;
+ ret->next = NULL;
+ }
return ret;
}
@@ -202,32 +211,43 @@ static void insert_inout(AVFilterInOut **inouts, AVFilterInOut *element)
*inouts = element;
}
+static void append_inout(AVFilterInOut **inouts, AVFilterInOut **element)
+{
+ while (*inouts && (*inouts)->next)
+ inouts = &((*inouts)->next);
+
+ if (!*inouts)
+ *inouts = *element;
+ else
+ (*inouts)->next = *element;
+ *element = NULL;
+}
+
static int link_filter_inouts(AVFilterContext *filt_ctx,
AVFilterInOut **curr_inputs,
AVFilterInOut **open_inputs, void *log_ctx)
{
- int pad = filt_ctx->input_count, ret;
+ int pad, ret;
- while (pad--) {
+ for (pad = 0; pad < filt_ctx->nb_inputs; pad++) {
AVFilterInOut *p = *curr_inputs;
- if (!p) {
- av_log(log_ctx, AV_LOG_ERROR,
- "Not enough inputs specified for the \"%s\" filter.\n",
- filt_ctx->filter->name);
- return AVERROR(EINVAL);
- }
- *curr_inputs = (*curr_inputs)->next;
+ if (p) {
+ *curr_inputs = (*curr_inputs)->next;
+ p->next = NULL;
+ } else if (!(p = av_mallocz(sizeof(*p))))
+ return AVERROR(ENOMEM);
if (p->filter_ctx) {
- if ((ret = link_filter(p->filter_ctx, p->pad_idx, filt_ctx, pad, log_ctx)) < 0)
- return ret;
+ ret = link_filter(p->filter_ctx, p->pad_idx, filt_ctx, pad, log_ctx);
av_free(p->name);
av_free(p);
+ if (ret < 0)
+ return ret;
} else {
p->filter_ctx = filt_ctx;
p->pad_idx = pad;
- insert_inout(open_inputs, p);
+ append_inout(open_inputs, &p);
}
}
@@ -238,7 +258,7 @@ static int link_filter_inouts(AVFilterContext *filt_ctx,
return AVERROR(EINVAL);
}
- pad = filt_ctx->output_count;
+ pad = filt_ctx->nb_outputs;
while (pad--) {
AVFilterInOut *currlinkn = av_mallocz(sizeof(AVFilterInOut));
if (!currlinkn)
@@ -254,6 +274,7 @@ static int link_filter_inouts(AVFilterContext *filt_ctx,
static int parse_inputs(const char **buf, AVFilterInOut **curr_inputs,
AVFilterInOut **open_outputs, void *log_ctx)
{
+ AVFilterInOut *parsed_inputs = NULL;
int pad = 0;
while (**buf == '[') {
@@ -270,18 +291,23 @@ static int parse_inputs(const char **buf, AVFilterInOut **curr_inputs,
av_free(name);
} else {
/* Not in the list, so add it as an input */
- if (!(match = av_mallocz(sizeof(AVFilterInOut))))
+ if (!(match = av_mallocz(sizeof(AVFilterInOut)))) {
+ av_free(name);
return AVERROR(ENOMEM);
+ }
match->name = name;
match->pad_idx = pad;
}
- insert_inout(curr_inputs, match);
+ append_inout(&parsed_inputs, &match);
*buf += strspn(*buf, WHITESPACES);
pad++;
}
+ append_inout(&parsed_inputs, curr_inputs);
+ *curr_inputs = parsed_inputs;
+
return pad;
}
@@ -296,24 +322,27 @@ static int parse_outputs(const char **buf, AVFilterInOut **curr_inputs,
AVFilterInOut *match;
AVFilterInOut *input = *curr_inputs;
+
+ if (!name)
+ return AVERROR(EINVAL);
+
if (!input) {
av_log(log_ctx, AV_LOG_ERROR,
- "No output pad can be associated to link label '%s'.\n",
- name);
+ "No output pad can be associated to link label '%s'.\n", name);
+ av_free(name);
return AVERROR(EINVAL);
}
*curr_inputs = (*curr_inputs)->next;
- if (!name)
- return AVERROR(EINVAL);
-
/* First check if the label is not in the open_inputs list */
match = extract_inout(name, open_inputs);
if (match) {
if ((ret = link_filter(input->filter_ctx, input->pad_idx,
- match->filter_ctx, match->pad_idx, log_ctx)) < 0)
+ match->filter_ctx, match->pad_idx, log_ctx)) < 0) {
+ av_free(name);
return ret;
+ }
av_free(match->name);
av_free(name);
av_free(match);
@@ -330,77 +359,156 @@ static int parse_outputs(const char **buf, AVFilterInOut **curr_inputs,
return pad;
}
-int avfilter_graph_parse(AVFilterGraph *graph, const char *filters,
- AVFilterInOut *open_inputs,
- AVFilterInOut *open_outputs, void *log_ctx)
+static int parse_sws_flags(const char **buf, AVFilterGraph *graph)
+{
+ char *p = strchr(*buf, ';');
+
+ if (strncmp(*buf, "sws_flags=", 10))
+ return 0;
+
+ if (!p) {
+ av_log(graph, AV_LOG_ERROR, "sws_flags not terminated with ';'.\n");
+ return AVERROR(EINVAL);
+ }
+
+ *buf += 4; // keep the 'flags=' part
+
+ av_freep(&graph->scale_sws_opts);
+ if (!(graph->scale_sws_opts = av_mallocz(p - *buf + 1)))
+ return AVERROR(ENOMEM);
+ av_strlcpy(graph->scale_sws_opts, *buf, p - *buf + 1);
+
+ *buf = p + 1;
+ return 0;
+}
+
+int avfilter_graph_parse2(AVFilterGraph *graph, const char *filters,
+ AVFilterInOut **inputs,
+ AVFilterInOut **outputs)
{
int index = 0, ret;
char chr = 0;
- AVFilterInOut *curr_inputs = NULL;
+ AVFilterInOut *curr_inputs = NULL, *open_inputs = NULL, *open_outputs = NULL;
+
+ filters += strspn(filters, WHITESPACES);
+
+ if ((ret = parse_sws_flags(&filters, graph)) < 0)
+ goto fail;
do {
AVFilterContext *filter;
- const char *filterchain = filters;
filters += strspn(filters, WHITESPACES);
- if ((ret = parse_inputs(&filters, &curr_inputs, &open_outputs, log_ctx)) < 0)
+ if ((ret = parse_inputs(&filters, &curr_inputs, &open_outputs, graph)) < 0)
goto fail;
- if ((ret = parse_filter(&filter, &filters, graph, index, log_ctx)) < 0)
+ if ((ret = parse_filter(&filter, &filters, graph, index, graph)) < 0)
goto fail;
- if (filter->input_count == 1 && !curr_inputs && !index) {
- /* First input can be omitted if it is "[in]" */
- const char *tmp = "[in]";
- if ((ret = parse_inputs(&tmp, &curr_inputs, &open_outputs, log_ctx)) < 0)
- goto fail;
- }
- if ((ret = link_filter_inouts(filter, &curr_inputs, &open_inputs, log_ctx)) < 0)
+ if ((ret = link_filter_inouts(filter, &curr_inputs, &open_inputs, graph)) < 0)
goto fail;
if ((ret = parse_outputs(&filters, &curr_inputs, &open_inputs, &open_outputs,
- log_ctx)) < 0)
+ graph)) < 0)
goto fail;
filters += strspn(filters, WHITESPACES);
chr = *filters++;
- if (chr == ';' && curr_inputs) {
- av_log(log_ctx, AV_LOG_ERROR,
- "Invalid filterchain containing an unlabelled output pad: \"%s\"\n",
- filterchain);
- ret = AVERROR(EINVAL);
- goto fail;
- }
+ if (chr == ';' && curr_inputs)
+ append_inout(&open_outputs, &curr_inputs);
index++;
} while (chr == ',' || chr == ';');
if (chr) {
- av_log(log_ctx, AV_LOG_ERROR,
+ av_log(graph, AV_LOG_ERROR,
"Unable to parse graph description substring: \"%s\"\n",
filters - 1);
ret = AVERROR(EINVAL);
goto fail;
}
- if (open_inputs && !strcmp(open_inputs->name, "out") && curr_inputs) {
- /* Last output can be omitted if it is "[out]" */
- const char *tmp = "[out]";
- if ((ret = parse_outputs(&tmp, &curr_inputs, &open_inputs, &open_outputs,
- log_ctx)) < 0)
- goto fail;
- }
+ append_inout(&open_outputs, &curr_inputs);
+ *inputs = open_inputs;
+ *outputs = open_outputs;
return 0;
fail:
for (; graph->filter_count > 0; graph->filter_count--)
avfilter_free(graph->filters[graph->filter_count - 1]);
av_freep(&graph->filters);
- free_inout(open_inputs);
- free_inout(open_outputs);
- free_inout(curr_inputs);
+ avfilter_inout_free(&open_inputs);
+ avfilter_inout_free(&open_outputs);
+ avfilter_inout_free(&curr_inputs);
+
+ *inputs = NULL;
+ *outputs = NULL;
+
+ return ret;
+}
+
+int avfilter_graph_parse(AVFilterGraph *graph, const char *filters,
+ AVFilterInOut *open_inputs,
+ AVFilterInOut *open_outputs, void *log_ctx)
+{
+ int ret;
+ AVFilterInOut *cur, *match, *inputs = NULL, *outputs = NULL;
+
+ if ((ret = avfilter_graph_parse2(graph, filters, &inputs, &outputs)) < 0)
+ goto fail;
+
+ /* First input can be omitted if it is "[in]" */
+ if (inputs && !inputs->name)
+ inputs->name = av_strdup("in");
+ for (cur = inputs; cur; cur = cur->next) {
+ if (!cur->name) {
+ av_log(log_ctx, AV_LOG_ERROR,
+ "Not enough inputs specified for the \"%s\" filter.\n",
+ cur->filter_ctx->filter->name);
+ ret = AVERROR(EINVAL);
+ goto fail;
+ }
+ if (!(match = extract_inout(cur->name, &open_outputs)))
+ continue;
+ ret = avfilter_link(match->filter_ctx, match->pad_idx,
+ cur->filter_ctx, cur->pad_idx);
+ avfilter_inout_free(&match);
+ if (ret < 0)
+ goto fail;
+ }
+
+ /* Last output can be omitted if it is "[out]" */
+ if (outputs && !outputs->name)
+ outputs->name = av_strdup("out");
+ for (cur = outputs; cur; cur = cur->next) {
+ if (!cur->name) {
+ av_log(log_ctx, AV_LOG_ERROR,
+ "Invalid filterchain containing an unlabelled output pad: \"%s\"\n",
+ filters);
+ ret = AVERROR(EINVAL);
+ goto fail;
+ }
+ if (!(match = extract_inout(cur->name, &open_inputs)))
+ continue;
+ ret = avfilter_link(cur->filter_ctx, cur->pad_idx,
+ match->filter_ctx, match->pad_idx);
+ avfilter_inout_free(&match);
+ if (ret < 0)
+ goto fail;
+ }
+
+ fail:
+ if (ret < 0) {
+ for (; graph->filter_count > 0; graph->filter_count--)
+ avfilter_free(graph->filters[graph->filter_count - 1]);
+ av_freep(&graph->filters);
+ }
+ avfilter_inout_free(&inputs);
+ avfilter_inout_free(&outputs);
+ avfilter_inout_free(&open_inputs);
+ avfilter_inout_free(&open_outputs);
return ret;
}
diff --git a/gst-libs/ext/libav/libavfilter/internal.h b/gst-libs/ext/libav/libavfilter/internal.h
index 0630e9b..216a355 100644
--- a/gst-libs/ext/libav/libavfilter/internal.h
+++ b/gst-libs/ext/libav/libavfilter/internal.h
@@ -25,34 +25,196 @@
*/
#include "avfilter.h"
-#include "avfiltergraph.h"
+#if !FF_API_AVFILTERPAD_PUBLIC
/**
- * Check for the validity of graph.
- *
- * A graph is considered valid if all its input and output pads are
- * connected.
- *
- * @return 0 in case of success, a negative value otherwise
+ * A filter pad used for either input or output.
*/
-int ff_avfilter_graph_check_validity(AVFilterGraph *graphctx, AVClass *log_ctx);
+struct AVFilterPad {
+ /**
+ * Pad name. The name is unique among inputs and among outputs, but an
+ * input may have the same name as an output. This may be NULL if this
+ * pad has no need to ever be referenced by name.
+ */
+ const char *name;
+
+ /**
+ * AVFilterPad type.
+ */
+ enum AVMediaType type;
+
+ /**
+ * Minimum required permissions on incoming buffers. Any buffer with
+ * insufficient permissions will be automatically copied by the filter
+ * system to a new buffer which provides the needed access permissions.
+ *
+ * Input pads only.
+ */
+ int min_perms;
+
+ /**
+ * Permissions which are not accepted on incoming buffers. Any buffer
+ * which has any of these permissions set will be automatically copied
+ * by the filter system to a new buffer which does not have those
+ * permissions. This can be used to easily disallow buffers with
+ * AV_PERM_REUSE.
+ *
+ * Input pads only.
+ */
+ int rej_perms;
+
+ /**
+ * Callback function to get a video buffer. If NULL, the filter system will
+ * use avfilter_default_get_video_buffer().
+ *
+ * Input video pads only.
+ */
+ AVFilterBufferRef *(*get_video_buffer)(AVFilterLink *link, int perms, int w, int h);
+
+ /**
+ * Callback function to get an audio buffer. If NULL, the filter system will
+ * use avfilter_default_get_audio_buffer().
+ *
+ * Input audio pads only.
+ */
+ AVFilterBufferRef *(*get_audio_buffer)(AVFilterLink *link, int perms,
+ int nb_samples);
+
+ /**
+ * Filtering callback. This is where a filter receives a frame with
+ * audio/video data and should do its processing.
+ *
+ * Input pads only.
+ *
+ * @return >= 0 on success, a negative AVERROR on error. This function
+ * must ensure that samplesref is properly unreferenced on error if it
+ * hasn't been passed on to another filter.
+ */
+ int (*filter_frame)(AVFilterLink *link, AVFilterBufferRef *frame);
+
+ /**
+ * Frame poll callback. This returns the number of immediately available
+ * samples. It should return a positive value if the next request_frame()
+ * is guaranteed to return one frame (with no delay).
+ *
+ * Defaults to just calling the source poll_frame() method.
+ *
+ * Output pads only.
+ */
+ int (*poll_frame)(AVFilterLink *link);
+
+ /**
+ * Frame request callback. A call to this should result in at least one
+ * frame being output over the given link. This should return zero on
+ * success, and another value on error.
+ *
+ * Output pads only.
+ */
+ int (*request_frame)(AVFilterLink *link);
+
+ /**
+ * Link configuration callback.
+ *
+ * For output pads, this should set the link properties such as
+ * width/height. This should NOT set the format property - that is
+ * negotiated between filters by the filter system using the
+ * query_formats() callback before this function is called.
+ *
+ * For input pads, this should check the properties of the link, and update
+ * the filter's internal state as necessary.
+ *
+ * For both input and output filters, this should return zero on success,
+ * and another value on error.
+ */
+ int (*config_props)(AVFilterLink *link);
+
+ /**
+ * The filter expects a fifo to be inserted on its input link,
+ * typically because it has a delay.
+ *
+ * input pads only.
+ */
+ int needs_fifo;
+};
+#endif
+
+/** default handler for freeing audio/video buffer when there are no references left */
+void ff_avfilter_default_free_buffer(AVFilterBuffer *buf);
+
+/** Tell is a format is contained in the provided list terminated by -1. */
+int ff_fmt_is_in(int fmt, const int *fmts);
+
+#define FF_DPRINTF_START(ctx, func) av_dlog(NULL, "%-16s: ", #func)
+
+void ff_dlog_link(void *ctx, AVFilterLink *link, int end);
/**
- * Configure all the links of graphctx.
+ * Insert a new pad.
*
- * @return 0 in case of success, a negative value otherwise
+ * @param idx Insertion point. Pad is inserted at the end if this point
+ * is beyond the end of the list of pads.
+ * @param count Pointer to the number of pads in the list
+ * @param padidx_off Offset within an AVFilterLink structure to the element
+ * to increment when inserting a new pad causes link
+ * numbering to change
+ * @param pads Pointer to the pointer to the beginning of the list of pads
+ * @param links Pointer to the pointer to the beginning of the list of links
+ * @param newpad The new pad to add. A copy is made when adding.
*/
-int ff_avfilter_graph_config_links(AVFilterGraph *graphctx, AVClass *log_ctx);
+void ff_insert_pad(unsigned idx, unsigned *count, size_t padidx_off,
+ AVFilterPad **pads, AVFilterLink ***links,
+ AVFilterPad *newpad);
+
+/** Insert a new input pad for the filter. */
+static inline void ff_insert_inpad(AVFilterContext *f, unsigned index,
+ AVFilterPad *p)
+{
+ ff_insert_pad(index, &f->nb_inputs, offsetof(AVFilterLink, dstpad),
+ &f->input_pads, &f->inputs, p);
+#if FF_API_FOO_COUNT
+ f->input_count = f->nb_inputs;
+#endif
+}
+
+/** Insert a new output pad for the filter. */
+static inline void ff_insert_outpad(AVFilterContext *f, unsigned index,
+ AVFilterPad *p)
+{
+ ff_insert_pad(index, &f->nb_outputs, offsetof(AVFilterLink, srcpad),
+ &f->output_pads, &f->outputs, p);
+#if FF_API_FOO_COUNT
+ f->output_count = f->nb_outputs;
+#endif
+}
/**
- * Configure the formats of all the links in the graph.
+ * Poll a frame from the filter chain.
+ *
+ * @param link the input link
+ * @return the number of immediately available frames, a negative
+ * number in case of error
*/
-int ff_avfilter_graph_config_formats(AVFilterGraph *graphctx, AVClass *log_ctx);
+int ff_poll_frame(AVFilterLink *link);
-/** default handler for freeing audio/video buffer when there are no references left */
-void ff_avfilter_default_free_buffer(AVFilterBuffer *buf);
+/**
+ * Request an input frame from the filter at the other end of the link.
+ *
+ * @param link the input link
+ * @return zero on success
+ */
+int ff_request_frame(AVFilterLink *link);
-/** Tell is a format is contained in the provided list terminated by -1. */
-int ff_fmt_is_in(int fmt, const int *fmts);
+/**
+ * Send a frame of data to the next filter.
+ *
+ * @param link the output link over which the data is being sent
+ * @param frame a reference to the buffer of data being sent. The
+ * receiving filter will free this reference when it no longer
+ * needs it or pass it on to the next filter.
+ *
+ * @return >= 0 on success, a negative AVERROR on error. The receiving filter
+ * is responsible for unreferencing frame in case of error.
+ */
+int ff_filter_frame(AVFilterLink *link, AVFilterBufferRef *frame);
#endif /* AVFILTER_INTERNAL_H */
diff --git a/gst-libs/ext/libav/libavfilter/split.c b/gst-libs/ext/libav/libavfilter/split.c
new file mode 100644
index 0000000..c1e1669
--- /dev/null
+++ b/gst-libs/ext/libav/libavfilter/split.c
@@ -0,0 +1,130 @@
+/*
+ * Copyright (c) 2007 Bobby Bingham
+ *
+ * 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
+ * audio and video splitter
+ */
+
+#include <stdio.h>
+
+#include "libavutil/internal.h"
+#include "libavutil/mem.h"
+#include "avfilter.h"
+#include "audio.h"
+#include "internal.h"
+#include "video.h"
+
+static int split_init(AVFilterContext *ctx, const char *args)
+{
+ int i, nb_outputs = 2;
+
+ if (args) {
+ nb_outputs = strtol(args, NULL, 0);
+ if (nb_outputs <= 0) {
+ av_log(ctx, AV_LOG_ERROR, "Invalid number of outputs specified: %d.\n",
+ nb_outputs);
+ return AVERROR(EINVAL);
+ }
+ }
+
+ for (i = 0; i < nb_outputs; i++) {
+ char name[32];
+ AVFilterPad pad = { 0 };
+
+ snprintf(name, sizeof(name), "output%d", i);
+ pad.type = ctx->filter->inputs[0].type;
+ pad.name = av_strdup(name);
+
+ ff_insert_outpad(ctx, i, &pad);
+ }
+
+ return 0;
+}
+
+static void split_uninit(AVFilterContext *ctx)
+{
+ int i;
+
+ for (i = 0; i < ctx->nb_outputs; i++)
+ av_freep(&ctx->output_pads[i].name);
+}
+
+static int filter_frame(AVFilterLink *inlink, AVFilterBufferRef *frame)
+{
+ AVFilterContext *ctx = inlink->dst;
+ int i, ret = 0;
+
+ for (i = 0; i < ctx->nb_outputs; i++) {
+ AVFilterBufferRef *buf_out = avfilter_ref_buffer(frame, ~AV_PERM_WRITE);
+ if (!buf_out) {
+ ret = AVERROR(ENOMEM);
+ break;
+ }
+
+ ret = ff_filter_frame(ctx->outputs[i], buf_out);
+ if (ret < 0)
+ break;
+ }
+ avfilter_unref_bufferp(&frame);
+ return ret;
+}
+
+static const AVFilterPad avfilter_vf_split_inputs[] = {
+ {
+ .name = "default",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .get_video_buffer = ff_null_get_video_buffer,
+ .filter_frame = filter_frame,
+ },
+ { NULL }
+};
+
+AVFilter avfilter_vf_split = {
+ .name = "split",
+ .description = NULL_IF_CONFIG_SMALL("Pass on the input to two outputs."),
+
+ .init = split_init,
+ .uninit = split_uninit,
+
+ .inputs = avfilter_vf_split_inputs,
+ .outputs = NULL,
+};
+
+static const AVFilterPad avfilter_af_asplit_inputs[] = {
+ {
+ .name = "default",
+ .type = AVMEDIA_TYPE_AUDIO,
+ .get_audio_buffer = ff_null_get_audio_buffer,
+ .filter_frame = filter_frame,
+ },
+ { NULL }
+};
+
+AVFilter avfilter_af_asplit = {
+ .name = "asplit",
+ .description = NULL_IF_CONFIG_SMALL("Pass on the audio input to N audio outputs."),
+
+ .init = split_init,
+ .uninit = split_uninit,
+
+ .inputs = avfilter_af_asplit_inputs,
+ .outputs = NULL,
+};
diff --git a/gst-libs/ext/libav/libavfilter/version.h b/gst-libs/ext/libav/libavfilter/version.h
index 09d6700..c09d44b 100644
--- a/gst-libs/ext/libav/libavfilter/version.h
+++ b/gst-libs/ext/libav/libavfilter/version.h
@@ -28,8 +28,8 @@
#include "libavutil/avutil.h"
-#define LIBAVFILTER_VERSION_MAJOR 2
-#define LIBAVFILTER_VERSION_MINOR 15
+#define LIBAVFILTER_VERSION_MAJOR 3
+#define LIBAVFILTER_VERSION_MINOR 3
#define LIBAVFILTER_VERSION_MICRO 0
#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
@@ -40,4 +40,17 @@
LIBAVFILTER_VERSION_MICRO)
#define LIBAVFILTER_BUILD LIBAVFILTER_VERSION_INT
-#endif // AVFILTER_VERSION_H
+/**
+ * FF_API_* defines may be placed below to indicate public API that will be
+ * dropped at a future version bump. The defines themselves are not part of
+ * the public API and may change, break or disappear at any time.
+ */
+
+#ifndef FF_API_AVFILTERPAD_PUBLIC
+#define FF_API_AVFILTERPAD_PUBLIC (LIBAVFILTER_VERSION_MAJOR < 4)
+#endif
+#ifndef FF_API_FOO_COUNT
+#define FF_API_FOO_COUNT (LIBAVFILTER_VERSION_MAJOR < 4)
+#endif
+
+#endif /* AVFILTER_VERSION_H */
diff --git a/gst-libs/ext/libav/libavfilter/vf_aspect.c b/gst-libs/ext/libav/libavfilter/vf_aspect.c
index b43aa86..d7e851c 100644
--- a/gst-libs/ext/libav/libavfilter/vf_aspect.c
+++ b/gst-libs/ext/libav/libavfilter/vf_aspect.c
@@ -23,14 +23,17 @@
* aspect ratio modification video filters
*/
+#include "libavutil/common.h"
#include "libavutil/mathematics.h"
#include "avfilter.h"
+#include "internal.h"
+#include "video.h"
typedef struct {
AVRational aspect;
} AspectContext;
-static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
+static av_cold int init(AVFilterContext *ctx, const char *args)
{
AspectContext *aspect = ctx->priv;
double ratio;
@@ -58,16 +61,16 @@ static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
if (aspect->aspect.den == 0)
aspect->aspect = (AVRational) {0, 1};
- av_log(ctx, AV_LOG_INFO, "a:%d/%d\n", aspect->aspect.num, aspect->aspect.den);
+ av_log(ctx, AV_LOG_VERBOSE, "a:%d/%d\n", aspect->aspect.num, aspect->aspect.den);
return 0;
}
-static void start_frame(AVFilterLink *link, AVFilterBufferRef *picref)
+static int filter_frame(AVFilterLink *link, AVFilterBufferRef *frame)
{
AspectContext *aspect = link->dst->priv;
- picref->video->pixel_aspect = aspect->aspect;
- avfilter_start_frame(link->dst->outputs[0], picref);
+ frame->video->pixel_aspect = aspect->aspect;
+ return ff_filter_frame(link->dst->outputs[0], frame);
}
#if CONFIG_SETDAR_FILTER
@@ -81,7 +84,7 @@ static int setdar_config_props(AVFilterLink *inlink)
aspect->aspect.num * inlink->h,
aspect->aspect.den * inlink->w, 100);
- av_log(inlink->dst, AV_LOG_INFO, "w:%d h:%d -> dar:%d/%d sar:%d/%d\n",
+ av_log(inlink->dst, AV_LOG_VERBOSE, "w:%d h:%d -> dar:%d/%d sar:%d/%d\n",
inlink->w, inlink->h, dar.num, dar.den, aspect->aspect.num, aspect->aspect.den);
inlink->sample_aspect_ratio = aspect->aspect;
@@ -89,6 +92,25 @@ static int setdar_config_props(AVFilterLink *inlink)
return 0;
}
+static const AVFilterPad avfilter_vf_setdar_inputs[] = {
+ {
+ .name = "default",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .config_props = setdar_config_props,
+ .get_video_buffer = ff_null_get_video_buffer,
+ .filter_frame = filter_frame,
+ },
+ { NULL }
+};
+
+static const AVFilterPad avfilter_vf_setdar_outputs[] = {
+ {
+ .name = "default",
+ .type = AVMEDIA_TYPE_VIDEO,
+ },
+ { NULL }
+};
+
AVFilter avfilter_vf_setdar = {
.name = "setdar",
.description = NULL_IF_CONFIG_SMALL("Set the frame display aspect ratio."),
@@ -97,17 +119,9 @@ AVFilter avfilter_vf_setdar = {
.priv_size = sizeof(AspectContext),
- .inputs = (AVFilterPad[]) {{ .name = "default",
- .type = AVMEDIA_TYPE_VIDEO,
- .config_props = setdar_config_props,
- .get_video_buffer = avfilter_null_get_video_buffer,
- .start_frame = start_frame,
- .end_frame = avfilter_null_end_frame },
- { .name = NULL}},
-
- .outputs = (AVFilterPad[]) {{ .name = "default",
- .type = AVMEDIA_TYPE_VIDEO, },
- { .name = NULL}},
+ .inputs = avfilter_vf_setdar_inputs,
+
+ .outputs = avfilter_vf_setdar_outputs,
};
#endif /* CONFIG_SETDAR_FILTER */
@@ -122,6 +136,25 @@ static int setsar_config_props(AVFilterLink *inlink)
return 0;
}
+static const AVFilterPad avfilter_vf_setsar_inputs[] = {
+ {
+ .name = "default",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .config_props = setsar_config_props,
+ .get_video_buffer = ff_null_get_video_buffer,
+ .filter_frame = filter_frame,
+ },
+ { NULL }
+};
+
+static const AVFilterPad avfilter_vf_setsar_outputs[] = {
+ {
+ .name = "default",
+ .type = AVMEDIA_TYPE_VIDEO,
+ },
+ { NULL }
+};
+
AVFilter avfilter_vf_setsar = {
.name = "setsar",
.description = NULL_IF_CONFIG_SMALL("Set the pixel sample aspect ratio."),
@@ -130,17 +163,8 @@ AVFilter avfilter_vf_setsar = {
.priv_size = sizeof(AspectContext),
- .inputs = (AVFilterPad[]) {{ .name = "default",
- .type = AVMEDIA_TYPE_VIDEO,
- .config_props = setsar_config_props,
- .get_video_buffer = avfilter_null_get_video_buffer,
- .start_frame = start_frame,
- .end_frame = avfilter_null_end_frame },
- { .name = NULL}},
-
- .outputs = (AVFilterPad[]) {{ .name = "default",
- .type = AVMEDIA_TYPE_VIDEO, },
- { .name = NULL}},
+ .inputs = avfilter_vf_setsar_inputs,
+
+ .outputs = avfilter_vf_setsar_outputs,
};
#endif /* CONFIG_SETSAR_FILTER */
-
diff --git a/gst-libs/ext/libav/libavfilter/vf_blackframe.c b/gst-libs/ext/libav/libavfilter/vf_blackframe.c
index 770eec9..275ebb2 100644
--- a/gst-libs/ext/libav/libavfilter/vf_blackframe.c
+++ b/gst-libs/ext/libav/libavfilter/vf_blackframe.c
@@ -27,7 +27,14 @@
* Ported from MPlayer libmpcodecs/vf_blackframe.c.
*/
+#include <stdio.h>
+#include <inttypes.h>
+
+#include "libavutil/internal.h"
#include "avfilter.h"
+#include "formats.h"
+#include "internal.h"
+#include "video.h"
typedef struct {
unsigned int bamount; ///< black amount
@@ -38,17 +45,17 @@ typedef struct {
static int query_formats(AVFilterContext *ctx)
{
- static const enum PixelFormat pix_fmts[] = {
- PIX_FMT_YUV410P, PIX_FMT_YUV420P, PIX_FMT_GRAY8, PIX_FMT_NV12,
- PIX_FMT_NV21, PIX_FMT_YUV444P, PIX_FMT_YUV422P, PIX_FMT_YUV411P,
- PIX_FMT_NONE
+ static const enum AVPixelFormat pix_fmts[] = {
+ AV_PIX_FMT_YUV410P, AV_PIX_FMT_YUV420P, AV_PIX_FMT_GRAY8, AV_PIX_FMT_NV12,
+ AV_PIX_FMT_NV21, AV_PIX_FMT_YUV444P, AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUV411P,
+ AV_PIX_FMT_NONE
};
- avfilter_set_common_formats(ctx, avfilter_make_format_list(pix_fmts));
+ ff_set_common_formats(ctx, ff_make_format_list(pix_fmts));
return 0;
}
-static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
+static av_cold int init(AVFilterContext *ctx, const char *args)
{
BlackFrameContext *blackframe = ctx->priv;
@@ -60,7 +67,7 @@ static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
if (args)
sscanf(args, "%u:%u", &blackframe->bamount, &blackframe->bthresh);
- av_log(ctx, AV_LOG_INFO, "bamount:%u bthresh:%u\n",
+ av_log(ctx, AV_LOG_VERBOSE, "bamount:%u bthresh:%u\n",
blackframe->bamount, blackframe->bthresh);
if (blackframe->bamount > 100 || blackframe->bthresh > 255) {
@@ -71,41 +78,49 @@ static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
return 0;
}
-static void draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir)
+static int filter_frame(AVFilterLink *inlink, AVFilterBufferRef *frame)
{
AVFilterContext *ctx = inlink->dst;
BlackFrameContext *blackframe = ctx->priv;
- AVFilterBufferRef *picref = inlink->cur_buf;
int x, i;
- uint8_t *p = picref->data[0] + y * picref->linesize[0];
+ int pblack = 0;
+ uint8_t *p = frame->data[0];
- for (i = 0; i < h; i++) {
+ for (i = 0; i < frame->video->h; i++) {
for (x = 0; x < inlink->w; x++)
blackframe->nblack += p[x] < blackframe->bthresh;
- p += picref->linesize[0];
+ p += frame->linesize[0];
}
- avfilter_draw_slice(ctx->outputs[0], y, h, slice_dir);
-}
-
-static void end_frame(AVFilterLink *inlink)
-{
- AVFilterContext *ctx = inlink->dst;
- BlackFrameContext *blackframe = ctx->priv;
- AVFilterBufferRef *picref = inlink->cur_buf;
- int pblack = 0;
-
pblack = blackframe->nblack * 100 / (inlink->w * inlink->h);
if (pblack >= blackframe->bamount)
av_log(ctx, AV_LOG_INFO, "frame:%u pblack:%u pos:%"PRId64" pts:%"PRId64" t:%f\n",
- blackframe->frame, pblack, picref->pos, picref->pts,
- picref->pts == AV_NOPTS_VALUE ? -1 : picref->pts * av_q2d(inlink->time_base));
+ blackframe->frame, pblack, frame->pos, frame->pts,
+ frame->pts == AV_NOPTS_VALUE ? -1 : frame->pts * av_q2d(inlink->time_base));
blackframe->frame++;
blackframe->nblack = 0;
- avfilter_end_frame(inlink->dst->outputs[0]);
+ return ff_filter_frame(inlink->dst->outputs[0], frame);
}
+static const AVFilterPad avfilter_vf_blackframe_inputs[] = {
+ {
+ .name = "default",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .get_video_buffer = ff_null_get_video_buffer,
+ .filter_frame = filter_frame,
+ },
+ { NULL }
+};
+
+static const AVFilterPad avfilter_vf_blackframe_outputs[] = {
+ {
+ .name = "default",
+ .type = AVMEDIA_TYPE_VIDEO
+ },
+ { NULL }
+};
+
AVFilter avfilter_vf_blackframe = {
.name = "blackframe",
.description = NULL_IF_CONFIG_SMALL("Detect frames that are (almost) black."),
@@ -115,15 +130,7 @@ AVFilter avfilter_vf_blackframe = {
.query_formats = query_formats,
- .inputs = (AVFilterPad[]) {{ .name = "default",
- .type = AVMEDIA_TYPE_VIDEO,
- .draw_slice = draw_slice,
- .get_video_buffer = avfilter_null_get_video_buffer,
- .start_frame = avfilter_null_start_frame,
- .end_frame = end_frame, },
- { .name = NULL}},
-
- .outputs = (AVFilterPad[]) {{ .name = "default",
- .type = AVMEDIA_TYPE_VIDEO },
- { .name = NULL}},
+ .inputs = avfilter_vf_blackframe_inputs,
+
+ .outputs = avfilter_vf_blackframe_outputs,
};
diff --git a/gst-libs/ext/libav/libavfilter/vf_boxblur.c b/gst-libs/ext/libav/libavfilter/vf_boxblur.c
index a314f5c..d72c602 100644
--- a/gst-libs/ext/libav/libavfilter/vf_boxblur.c
+++ b/gst-libs/ext/libav/libavfilter/vf_boxblur.c
@@ -26,11 +26,15 @@
*/
#include "libavutil/avstring.h"
+#include "libavutil/common.h"
#include "libavutil/eval.h"
#include "libavutil/pixdesc.h"
#include "avfilter.h"
+#include "formats.h"
+#include "internal.h"
+#include "video.h"
-static const char *var_names[] = {
+static const char *const var_names[] = {
"w",
"h",
"cw",
@@ -74,7 +78,7 @@ typedef struct {
#define V 2
#define A 3
-static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
+static av_cold int init(AVFilterContext *ctx, const char *args)
{
BoxBlurContext *boxblur = ctx->priv;
int e;
@@ -120,22 +124,22 @@ static av_cold void uninit(AVFilterContext *ctx)
static int query_formats(AVFilterContext *ctx)
{
- enum PixelFormat pix_fmts[] = {
- PIX_FMT_YUV444P, PIX_FMT_YUV422P, PIX_FMT_YUV420P,
- PIX_FMT_YUV411P, PIX_FMT_YUV410P, PIX_FMT_YUVA420P,
- PIX_FMT_YUV440P, PIX_FMT_GRAY8,
- PIX_FMT_YUVJ444P, PIX_FMT_YUVJ422P, PIX_FMT_YUVJ420P,
- PIX_FMT_YUVJ440P,
- PIX_FMT_NONE
+ enum AVPixelFormat pix_fmts[] = {
+ AV_PIX_FMT_YUV444P, AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUV420P,
+ AV_PIX_FMT_YUV411P, AV_PIX_FMT_YUV410P, AV_PIX_FMT_YUVA420P,
+ AV_PIX_FMT_YUV440P, AV_PIX_FMT_GRAY8,
+ AV_PIX_FMT_YUVJ444P, AV_PIX_FMT_YUVJ422P, AV_PIX_FMT_YUVJ420P,
+ AV_PIX_FMT_YUVJ440P,
+ AV_PIX_FMT_NONE
};
- avfilter_set_common_formats(ctx, avfilter_make_format_list(pix_fmts));
+ ff_set_common_formats(ctx, ff_make_format_list(pix_fmts));
return 0;
}
static int config_input(AVFilterLink *inlink)
{
- const AVPixFmtDescriptor *desc = &av_pix_fmt_descriptors[inlink->format];
+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format);
AVFilterContext *ctx = inlink->dst;
BoxBlurContext *boxblur = ctx->priv;
int w = inlink->w, h = inlink->h;
@@ -303,33 +307,60 @@ static void vblur(uint8_t *dst, int dst_linesize, const uint8_t *src, int src_li
h, radius, power, temp);
}
-static void draw_slice(AVFilterLink *inlink, int y0, int h0, int slice_dir)
+static int filter_frame(AVFilterLink *inlink, AVFilterBufferRef *in)
{
AVFilterContext *ctx = inlink->dst;
BoxBlurContext *boxblur = ctx->priv;
AVFilterLink *outlink = inlink->dst->outputs[0];
- AVFilterBufferRef *inpicref = inlink ->cur_buf;
- AVFilterBufferRef *outpicref = outlink->out_buf;
+ AVFilterBufferRef *out;
int plane;
- int cw = inlink->w >> boxblur->hsub, ch = h0 >> boxblur->vsub;
+ int cw = inlink->w >> boxblur->hsub, ch = in->video->h >> boxblur->vsub;
int w[4] = { inlink->w, cw, cw, inlink->w };
- int h[4] = { h0, ch, ch, h0 };
+ int h[4] = { in->video->h, ch, ch, in->video->h };
- for (plane = 0; inpicref->data[plane] && plane < 4; plane++)
- hblur(outpicref->data[plane], outpicref->linesize[plane],
- inpicref ->data[plane], inpicref ->linesize[plane],
+ out = ff_get_video_buffer(outlink, AV_PERM_WRITE, outlink->w, outlink->h);
+ if (!out) {
+ avfilter_unref_bufferp(&in);
+ return AVERROR(ENOMEM);
+ }
+ avfilter_copy_buffer_ref_props(out, in);
+
+ for (plane = 0; in->data[plane] && plane < 4; plane++)
+ hblur(out->data[plane], out->linesize[plane],
+ in ->data[plane], in ->linesize[plane],
w[plane], h[plane], boxblur->radius[plane], boxblur->power[plane],
boxblur->temp);
- for (plane = 0; inpicref->data[plane] && plane < 4; plane++)
- vblur(outpicref->data[plane], outpicref->linesize[plane],
- outpicref->data[plane], outpicref->linesize[plane],
+ for (plane = 0; in->data[plane] && plane < 4; plane++)
+ vblur(out->data[plane], out->linesize[plane],
+ out->data[plane], out->linesize[plane],
w[plane], h[plane], boxblur->radius[plane], boxblur->power[plane],
boxblur->temp);
- avfilter_draw_slice(outlink, y0, h0, slice_dir);
+ avfilter_unref_bufferp(&in);
+
+ return ff_filter_frame(outlink, out);
}
+static const AVFilterPad avfilter_vf_boxblur_inputs[] = {
+ {
+ .name = "default",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .config_props = config_input,
+ .filter_frame = filter_frame,
+ .min_perms = AV_PERM_READ
+ },
+ { NULL }
+};
+
+static const AVFilterPad avfilter_vf_boxblur_outputs[] = {
+ {
+ .name = "default",
+ .type = AVMEDIA_TYPE_VIDEO,
+ },
+ { NULL }
+};
+
AVFilter avfilter_vf_boxblur = {
.name = "boxblur",
.description = NULL_IF_CONFIG_SMALL("Blur the input."),
@@ -338,13 +369,6 @@ AVFilter avfilter_vf_boxblur = {
.uninit = uninit,
.query_formats = query_formats,
- .inputs = (AVFilterPad[]) {{ .name = "default",
- .type = AVMEDIA_TYPE_VIDEO,
- .config_props = config_input,
- .draw_slice = draw_slice,
- .min_perms = AV_PERM_READ },
- { .name = NULL}},
- .outputs = (AVFilterPad[]) {{ .name = "default",
- .type = AVMEDIA_TYPE_VIDEO, },
- { .name = NULL}},
+ .inputs = avfilter_vf_boxblur_inputs,
+ .outputs = avfilter_vf_boxblur_outputs,
};
diff --git a/gst-libs/ext/libav/libavfilter/vf_copy.c b/gst-libs/ext/libav/libavfilter/vf_copy.c
index 705ad1e..8ece5cf 100644
--- a/gst-libs/ext/libav/libavfilter/vf_copy.c
+++ b/gst-libs/ext/libav/libavfilter/vf_copy.c
@@ -21,20 +21,33 @@
* copy video filter
*/
+#include "libavutil/internal.h"
#include "avfilter.h"
+#include "internal.h"
+#include "video.h"
+
+static const AVFilterPad avfilter_vf_copy_inputs[] = {
+ {
+ .name = "default",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .get_video_buffer = ff_null_get_video_buffer,
+ .rej_perms = ~0
+ },
+ { NULL }
+};
+
+static const AVFilterPad avfilter_vf_copy_outputs[] = {
+ {
+ .name = "default",
+ .type = AVMEDIA_TYPE_VIDEO,
+ },
+ { NULL }
+};
AVFilter avfilter_vf_copy = {
.name = "copy",
.description = NULL_IF_CONFIG_SMALL("Copy the input video unchanged to the output."),
- .inputs = (AVFilterPad[]) {{ .name = "default",
- .type = AVMEDIA_TYPE_VIDEO,
- .get_video_buffer = avfilter_null_get_video_buffer,
- .start_frame = avfilter_null_start_frame,
- .end_frame = avfilter_null_end_frame,
- .rej_perms = ~0 },
- { .name = NULL}},
- .outputs = (AVFilterPad[]) {{ .name = "default",
- .type = AVMEDIA_TYPE_VIDEO, },
- { .name = NULL}},
+ .inputs = avfilter_vf_copy_inputs,
+ .outputs = avfilter_vf_copy_outputs,
};
diff --git a/gst-libs/ext/libav/libavfilter/vf_crop.c b/gst-libs/ext/libav/libavfilter/vf_crop.c
index 0880d4e..981dfd6 100644
--- a/gst-libs/ext/libav/libavfilter/vf_crop.c
+++ b/gst-libs/ext/libav/libavfilter/vf_crop.c
@@ -25,14 +25,20 @@
/* #define DEBUG */
+#include <stdio.h>
+
#include "avfilter.h"
+#include "formats.h"
+#include "internal.h"
+#include "video.h"
#include "libavutil/eval.h"
#include "libavutil/avstring.h"
+#include "libavutil/internal.h"
#include "libavutil/libm.h"
#include "libavutil/imgutils.h"
#include "libavutil/mathematics.h"
-static const char *var_names[] = {
+static const char *const var_names[] = {
"E",
"PHI",
"PI",
@@ -79,38 +85,38 @@ typedef struct {
static int query_formats(AVFilterContext *ctx)
{
- static const enum PixelFormat pix_fmts[] = {
- PIX_FMT_RGB48BE, PIX_FMT_RGB48LE,
- PIX_FMT_BGR48BE, PIX_FMT_BGR48LE,
- PIX_FMT_ARGB, PIX_FMT_RGBA,
- PIX_FMT_ABGR, PIX_FMT_BGRA,
- PIX_FMT_RGB24, PIX_FMT_BGR24,
- PIX_FMT_RGB565BE, PIX_FMT_RGB565LE,
- PIX_FMT_RGB555BE, PIX_FMT_RGB555LE,
- PIX_FMT_BGR565BE, PIX_FMT_BGR565LE,
- PIX_FMT_BGR555BE, PIX_FMT_BGR555LE,
- PIX_FMT_GRAY16BE, PIX_FMT_GRAY16LE,
- PIX_FMT_YUV420P16LE, PIX_FMT_YUV420P16BE,
- PIX_FMT_YUV422P16LE, PIX_FMT_YUV422P16BE,
- PIX_FMT_YUV444P16LE, PIX_FMT_YUV444P16BE,
- PIX_FMT_YUV444P, PIX_FMT_YUV422P,
- PIX_FMT_YUV420P, PIX_FMT_YUV411P,
- PIX_FMT_YUV410P, PIX_FMT_YUV440P,
- PIX_FMT_YUVJ444P, PIX_FMT_YUVJ422P,
- PIX_FMT_YUVJ420P, PIX_FMT_YUVJ440P,
- PIX_FMT_YUVA420P,
- PIX_FMT_RGB8, PIX_FMT_BGR8,
- PIX_FMT_RGB4_BYTE, PIX_FMT_BGR4_BYTE,
- PIX_FMT_PAL8, PIX_FMT_GRAY8,
- PIX_FMT_NONE
+ static const enum AVPixelFormat pix_fmts[] = {
+ AV_PIX_FMT_RGB48BE, AV_PIX_FMT_RGB48LE,
+ AV_PIX_FMT_BGR48BE, AV_PIX_FMT_BGR48LE,
+ AV_PIX_FMT_ARGB, AV_PIX_FMT_RGBA,
+ AV_PIX_FMT_ABGR, AV_PIX_FMT_BGRA,
+ AV_PIX_FMT_RGB24, AV_PIX_FMT_BGR24,
+ AV_PIX_FMT_RGB565BE, AV_PIX_FMT_RGB565LE,
+ AV_PIX_FMT_RGB555BE, AV_PIX_FMT_RGB555LE,
+ AV_PIX_FMT_BGR565BE, AV_PIX_FMT_BGR565LE,
+ AV_PIX_FMT_BGR555BE, AV_PIX_FMT_BGR555LE,
+ AV_PIX_FMT_GRAY16BE, AV_PIX_FMT_GRAY16LE,
+ AV_PIX_FMT_YUV420P16LE, AV_PIX_FMT_YUV420P16BE,
+ AV_PIX_FMT_YUV422P16LE, AV_PIX_FMT_YUV422P16BE,
+ AV_PIX_FMT_YUV444P16LE, AV_PIX_FMT_YUV444P16BE,
+ AV_PIX_FMT_YUV444P, AV_PIX_FMT_YUV422P,
+ AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV411P,
+ AV_PIX_FMT_YUV410P, AV_PIX_FMT_YUV440P,
+ AV_PIX_FMT_YUVJ444P, AV_PIX_FMT_YUVJ422P,
+ AV_PIX_FMT_YUVJ420P, AV_PIX_FMT_YUVJ440P,
+ AV_PIX_FMT_YUVA420P,
+ AV_PIX_FMT_RGB8, AV_PIX_FMT_BGR8,
+ AV_PIX_FMT_RGB4_BYTE, AV_PIX_FMT_BGR4_BYTE,
+ AV_PIX_FMT_PAL8, AV_PIX_FMT_GRAY8,
+ AV_PIX_FMT_NONE
};
- avfilter_set_common_formats(ctx, avfilter_make_format_list(pix_fmts));
+ ff_set_common_formats(ctx, ff_make_format_list(pix_fmts));
return 0;
}
-static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
+static av_cold int init(AVFilterContext *ctx, const char *args)
{
CropContext *crop = ctx->priv;
@@ -152,7 +158,7 @@ static int config_input(AVFilterLink *link)
{
AVFilterContext *ctx = link->dst;
CropContext *crop = ctx->priv;
- const AVPixFmtDescriptor *pix_desc = &av_pix_fmt_descriptors[link->format];
+ const AVPixFmtDescriptor *pix_desc = av_pix_fmt_desc_get(link->format);
int ret;
const char *expr;
double res;
@@ -171,8 +177,8 @@ static int config_input(AVFilterLink *link)
crop->var_values[VAR_POS] = NAN;
av_image_fill_max_pixsteps(crop->max_step, NULL, pix_desc);
- crop->hsub = av_pix_fmt_descriptors[link->format].log2_chroma_w;
- crop->vsub = av_pix_fmt_descriptors[link->format].log2_chroma_h;
+ crop->hsub = pix_desc->log2_chroma_w;
+ crop->vsub = pix_desc->log2_chroma_h;
if ((ret = av_expr_parse_and_eval(&res, (expr = crop->ow_expr),
var_names, crop->var_values,
@@ -204,7 +210,7 @@ static int config_input(AVFilterLink *link)
NULL, NULL, NULL, NULL, 0, ctx)) < 0)
return AVERROR(EINVAL);
- av_log(ctx, AV_LOG_INFO, "w:%d h:%d -> w:%d h:%d\n",
+ av_log(ctx, AV_LOG_VERBOSE, "w:%d h:%d -> w:%d h:%d\n",
link->w, link->h, crop->w, crop->h);
if (crop->w <= 0 || crop->h <= 0 ||
@@ -237,20 +243,19 @@ static int config_output(AVFilterLink *link)
return 0;
}
-static void start_frame(AVFilterLink *link, AVFilterBufferRef *picref)
+static int filter_frame(AVFilterLink *link, AVFilterBufferRef *frame)
{
AVFilterContext *ctx = link->dst;
CropContext *crop = ctx->priv;
- AVFilterBufferRef *ref2;
+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(link->format);
int i;
- ref2 = avfilter_ref_buffer(picref, ~0);
- ref2->video->w = crop->w;
- ref2->video->h = crop->h;
+ frame->video->w = crop->w;
+ frame->video->h = crop->h;
- crop->var_values[VAR_T] = picref->pts == AV_NOPTS_VALUE ?
- NAN : picref->pts * av_q2d(link->time_base);
- crop->var_values[VAR_POS] = picref->pos == -1 ? NAN : picref->pos;
+ crop->var_values[VAR_T] = frame->pts == AV_NOPTS_VALUE ?
+ NAN : frame->pts * av_q2d(link->time_base);
+ crop->var_values[VAR_POS] = frame->pos == -1 ? NAN : frame->pos;
crop->var_values[VAR_X] = av_expr_eval(crop->x_pexpr, crop->var_values, NULL);
crop->var_values[VAR_Y] = av_expr_eval(crop->y_pexpr, crop->var_values, NULL);
crop->var_values[VAR_X] = av_expr_eval(crop->x_pexpr, crop->var_values, NULL);
@@ -269,53 +274,48 @@ static void start_frame(AVFilterLink *link, AVFilterBufferRef *picref)
(int)crop->var_values[VAR_N], crop->var_values[VAR_T], crop->x,
crop->y, crop->x+crop->w, crop->y+crop->h);
- ref2->data[0] += crop->y * ref2->linesize[0];
- ref2->data[0] += crop->x * crop->max_step[0];
+ frame->data[0] += crop->y * frame->linesize[0];
+ frame->data[0] += crop->x * crop->max_step[0];
- if (!(av_pix_fmt_descriptors[link->format].flags & PIX_FMT_PAL)) {
+ if (!(desc->flags & PIX_FMT_PAL || desc->flags & PIX_FMT_PSEUDOPAL)) {
for (i = 1; i < 3; i ++) {
- if (ref2->data[i]) {
- ref2->data[i] += (crop->y >> crop->vsub) * ref2->linesize[i];
- ref2->data[i] += (crop->x * crop->max_step[i]) >> crop->hsub;
+ if (frame->data[i]) {
+ frame->data[i] += (crop->y >> crop->vsub) * frame->linesize[i];
+ frame->data[i] += (crop->x * crop->max_step[i]) >> crop->hsub;
}
}
}
/* alpha plane */
- if (ref2->data[3]) {
- ref2->data[3] += crop->y * ref2->linesize[3];
- ref2->data[3] += crop->x * crop->max_step[3];
+ if (frame->data[3]) {
+ frame->data[3] += crop->y * frame->linesize[3];
+ frame->data[3] += crop->x * crop->max_step[3];
}
- avfilter_start_frame(link->dst->outputs[0], ref2);
-}
-
-static void draw_slice(AVFilterLink *link, int y, int h, int slice_dir)
-{
- AVFilterContext *ctx = link->dst;
- CropContext *crop = ctx->priv;
-
- if (y >= crop->y + crop->h || y + h <= crop->y)
- return;
-
- if (y < crop->y) {
- h -= crop->y - y;
- y = crop->y;
- }
- if (y + h > crop->y + crop->h)
- h = crop->y + crop->h - y;
+ crop->var_values[VAR_N] += 1.0;
- avfilter_draw_slice(ctx->outputs[0], y - crop->y, h, slice_dir);
+ return ff_filter_frame(link->dst->outputs[0], frame);
}
-static void end_frame(AVFilterLink *link)
-{
- CropContext *crop = link->dst->priv;
+static const AVFilterPad avfilter_vf_crop_inputs[] = {
+ {
+ .name = "default",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .filter_frame = filter_frame,
+ .get_video_buffer = ff_null_get_video_buffer,
+ .config_props = config_input,
+ },
+ { NULL }
+};
- crop->var_values[VAR_N] += 1.0;
- avfilter_unref_buffer(link->cur_buf);
- avfilter_end_frame(link->dst->outputs[0]);
-}
+static const AVFilterPad avfilter_vf_crop_outputs[] = {
+ {
+ .name = "default",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .config_props = config_output,
+ },
+ { NULL }
+};
AVFilter avfilter_vf_crop = {
.name = "crop",
@@ -327,16 +327,6 @@ AVFilter avfilter_vf_crop = {
.init = init,
.uninit = uninit,
- .inputs = (AVFilterPad[]) {{ .name = "default",
- .type = AVMEDIA_TYPE_VIDEO,
- .start_frame = start_frame,
- .draw_slice = draw_slice,
- .end_frame = end_frame,
- .get_video_buffer = avfilter_null_get_video_buffer,
- .config_props = config_input, },
- { .name = NULL}},
- .outputs = (AVFilterPad[]) {{ .name = "default",
- .type = AVMEDIA_TYPE_VIDEO,
- .config_props = config_output, },
- { .name = NULL}},
+ .inputs = avfilter_vf_crop_inputs,
+ .outputs = avfilter_vf_crop_outputs,
};
diff --git a/gst-libs/ext/libav/libavfilter/vf_cropdetect.c b/gst-libs/ext/libav/libavfilter/vf_cropdetect.c
index 34b5dc9..eebd8bc 100644
--- a/gst-libs/ext/libav/libavfilter/vf_cropdetect.c
+++ b/gst-libs/ext/libav/libavfilter/vf_cropdetect.c
@@ -23,8 +23,14 @@
* Ported from MPlayer libmpcodecs/vf_cropdetect.c.
*/
+#include <stdio.h>
+
#include "libavutil/imgutils.h"
+#include "libavutil/internal.h"
#include "avfilter.h"
+#include "formats.h"
+#include "internal.h"
+#include "video.h"
typedef struct {
int x1, y1, x2, y2;
@@ -37,16 +43,16 @@ typedef struct {
static int query_formats(AVFilterContext *ctx)
{
- static const enum PixelFormat pix_fmts[] = {
- PIX_FMT_YUV420P, PIX_FMT_YUVJ420P,
- PIX_FMT_YUV422P, PIX_FMT_YUVJ422P,
- PIX_FMT_YUV444P, PIX_FMT_YUVJ444P,
- PIX_FMT_YUV411P, PIX_FMT_GRAY8,
- PIX_FMT_NV12, PIX_FMT_NV21,
- PIX_FMT_NONE
+ static const enum AVPixelFormat pix_fmts[] = {
+ AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUVJ420P,
+ AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUVJ422P,
+ AV_PIX_FMT_YUV444P, AV_PIX_FMT_YUVJ444P,
+ AV_PIX_FMT_YUV411P, AV_PIX_FMT_GRAY8,
+ AV_PIX_FMT_NV12, AV_PIX_FMT_NV21,
+ AV_PIX_FMT_NONE
};
- avfilter_set_common_formats(ctx, avfilter_make_format_list(pix_fmts));
+ ff_set_common_formats(ctx, ff_make_format_list(pix_fmts));
return 0;
}
@@ -77,7 +83,7 @@ static int checkline(void *ctx, const unsigned char *src, int stride, int len, i
return total;
}
-static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
+static av_cold int init(AVFilterContext *ctx, const char *args)
{
CropDetectContext *cd = ctx->priv;
@@ -89,7 +95,7 @@ static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
if (args)
sscanf(args, "%d:%d:%d", &cd->limit, &cd->round, &cd->reset_count);
- av_log(ctx, AV_LOG_INFO, "limit:%d round:%d reset_count:%d\n",
+ av_log(ctx, AV_LOG_VERBOSE, "limit:%d round:%d reset_count:%d\n",
cd->limit, cd->round, cd->reset_count);
return 0;
@@ -101,7 +107,7 @@ static int config_input(AVFilterLink *inlink)
CropDetectContext *cd = ctx->priv;
av_image_fill_max_pixsteps(cd->max_pixsteps, NULL,
- &av_pix_fmt_descriptors[inlink->format]);
+ av_pix_fmt_desc_get(inlink->format));
cd->x1 = inlink->w - 1;
cd->y1 = inlink->h - 1;
@@ -111,11 +117,10 @@ static int config_input(AVFilterLink *inlink)
return 0;
}
-static void end_frame(AVFilterLink *inlink)
+static int filter_frame(AVFilterLink *inlink, AVFilterBufferRef *frame)
{
AVFilterContext *ctx = inlink->dst;
CropDetectContext *cd = ctx->priv;
- AVFilterBufferRef *picref = inlink->cur_buf;
int bpp = cd->max_pixsteps[0];
int w, h, x, y, shrink_by;
@@ -123,36 +128,36 @@ static void end_frame(AVFilterLink *inlink)
if (++cd->frame_nb > 0) {
// Reset the crop area every reset_count frames, if reset_count is > 0
if (cd->reset_count > 0 && cd->frame_nb > cd->reset_count) {
- cd->x1 = picref->video->w-1;
- cd->y1 = picref->video->h-1;
+ cd->x1 = frame->video->w-1;
+ cd->y1 = frame->video->h-1;
cd->x2 = 0;
cd->y2 = 0;
cd->frame_nb = 1;
}
for (y = 0; y < cd->y1; y++) {
- if (checkline(ctx, picref->data[0] + picref->linesize[0] * y, bpp, picref->video->w, bpp) > cd->limit) {
+ if (checkline(ctx, frame->data[0] + frame->linesize[0] * y, bpp, frame->video->w, bpp) > cd->limit) {
cd->y1 = y;
break;
}
}
- for (y = picref->video->h-1; y > cd->y2; y--) {
- if (checkline(ctx, picref->data[0] + picref->linesize[0] * y, bpp, picref->video->w, bpp) > cd->limit) {
+ for (y = frame->video->h-1; y > cd->y2; y--) {
+ if (checkline(ctx, frame->data[0] + frame->linesize[0] * y, bpp, frame->video->w, bpp) > cd->limit) {
cd->y2 = y;
break;
}
}
for (y = 0; y < cd->x1; y++) {
- if (checkline(ctx, picref->data[0] + bpp*y, picref->linesize[0], picref->video->h, bpp) > cd->limit) {
+ if (checkline(ctx, frame->data[0] + bpp*y, frame->linesize[0], frame->video->h, bpp) > cd->limit) {
cd->x1 = y;
break;
}
}
- for (y = picref->video->w-1; y > cd->x2; y--) {
- if (checkline(ctx, picref->data[0] + bpp*y, picref->linesize[0], picref->video->h, bpp) > cd->limit) {
+ for (y = frame->video->w-1; y > cd->x2; y--) {
+ if (checkline(ctx, frame->data[0] + bpp*y, frame->linesize[0], frame->video->h, bpp) > cd->limit) {
cd->x2 = y;
break;
}
@@ -183,14 +188,33 @@ static void end_frame(AVFilterLink *inlink)
av_log(ctx, AV_LOG_INFO,
"x1:%d x2:%d y1:%d y2:%d w:%d h:%d x:%d y:%d pos:%"PRId64" pts:%"PRId64" t:%f crop=%d:%d:%d:%d\n",
- cd->x1, cd->x2, cd->y1, cd->y2, w, h, x, y, picref->pos, picref->pts,
- picref->pts == AV_NOPTS_VALUE ? -1 : picref->pts * av_q2d(inlink->time_base),
+ cd->x1, cd->x2, cd->y1, cd->y2, w, h, x, y, frame->pos, frame->pts,
+ frame->pts == AV_NOPTS_VALUE ? -1 : frame->pts * av_q2d(inlink->time_base),
w, h, x, y);
}
- avfilter_end_frame(inlink->dst->outputs[0]);
+ return ff_filter_frame(inlink->dst->outputs[0], frame);
}
+static const AVFilterPad avfilter_vf_cropdetect_inputs[] = {
+ {
+ .name = "default",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .config_props = config_input,
+ .get_video_buffer = ff_null_get_video_buffer,
+ .filter_frame = filter_frame,
+ },
+ { NULL }
+};
+
+static const AVFilterPad avfilter_vf_cropdetect_outputs[] = {
+ {
+ .name = "default",
+ .type = AVMEDIA_TYPE_VIDEO
+ },
+ { NULL }
+};
+
AVFilter avfilter_vf_cropdetect = {
.name = "cropdetect",
.description = NULL_IF_CONFIG_SMALL("Auto-detect crop size."),
@@ -200,15 +224,7 @@ AVFilter avfilter_vf_cropdetect = {
.query_formats = query_formats,
- .inputs = (AVFilterPad[]) {{ .name = "default",
- .type = AVMEDIA_TYPE_VIDEO,
- .config_props = config_input,
- .get_video_buffer = avfilter_null_get_video_buffer,
- .start_frame = avfilter_null_start_frame,
- .end_frame = end_frame, },
- { .name = NULL}},
-
- .outputs = (AVFilterPad[]) {{ .name = "default",
- .type = AVMEDIA_TYPE_VIDEO },
- { .name = NULL}},
+ .inputs = avfilter_vf_cropdetect_inputs,
+
+ .outputs = avfilter_vf_cropdetect_outputs,
};
diff --git a/gst-libs/ext/libav/libavfilter/vf_delogo.c b/gst-libs/ext/libav/libavfilter/vf_delogo.c
index ca31568..af479c2 100644
--- a/gst-libs/ext/libav/libavfilter/vf_delogo.c
+++ b/gst-libs/ext/libav/libavfilter/vf_delogo.c
@@ -25,10 +25,14 @@
* Ported from MPlayer libmpcodecs/vf_delogo.c.
*/
+#include "libavutil/common.h"
#include "libavutil/imgutils.h"
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
#include "avfilter.h"
+#include "formats.h"
+#include "internal.h"
+#include "video.h"
/**
* Apply a simple delogo algorithm to the image in dst and put the
@@ -76,12 +80,12 @@ static void apply_delogo(uint8_t *dst, int dst_linesize,
topright = src+logo_y1 * src_linesize+logo_x2-1;
botleft = src+(logo_y2-1) * src_linesize+logo_x1;
- dst += (logo_y1+1)*dst_linesize;
- src += (logo_y1+1)*src_linesize;
-
if (!direct)
av_image_copy_plane(dst, dst_linesize, src, src_linesize, w, h);
+ dst += (logo_y1 + 1) * dst_linesize;
+ src += (logo_y1 + 1) * src_linesize;
+
for (y = logo_y1+1; y < logo_y2-1; y++) {
for (x = logo_x1+1,
xdst = dst+logo_x1+1,
@@ -134,13 +138,13 @@ typedef struct {
#define OFFSET(x) offsetof(DelogoContext, x)
static const AVOption delogo_options[]= {
- {"x", "set logo x position", OFFSET(x), FF_OPT_TYPE_INT, {-1}, -1, INT_MAX },
- {"y", "set logo y position", OFFSET(y), FF_OPT_TYPE_INT, {-1}, -1, INT_MAX },
- {"w", "set logo width", OFFSET(w), FF_OPT_TYPE_INT, {-1}, -1, INT_MAX },
- {"h", "set logo height", OFFSET(h), FF_OPT_TYPE_INT, {-1}, -1, INT_MAX },
- {"band", "set delogo area band size", OFFSET(band), FF_OPT_TYPE_INT, { 4}, -1, INT_MAX },
- {"t", "set delogo area band size", OFFSET(band), FF_OPT_TYPE_INT, { 4}, -1, INT_MAX },
- {"show", "show delogo area", OFFSET(show), FF_OPT_TYPE_INT, { 0}, 0, 1 },
+ {"x", "set logo x position", OFFSET(x), AV_OPT_TYPE_INT, {.i64 = -1}, -1, INT_MAX },
+ {"y", "set logo y position", OFFSET(y), AV_OPT_TYPE_INT, {.i64 = -1}, -1, INT_MAX },
+ {"w", "set logo width", OFFSET(w), AV_OPT_TYPE_INT, {.i64 = -1}, -1, INT_MAX },
+ {"h", "set logo height", OFFSET(h), AV_OPT_TYPE_INT, {.i64 = -1}, -1, INT_MAX },
+ {"band", "set delogo area band size", OFFSET(band), AV_OPT_TYPE_INT, {.i64 = 4}, -1, INT_MAX },
+ {"t", "set delogo area band size", OFFSET(band), AV_OPT_TYPE_INT, {.i64 = 4}, -1, INT_MAX },
+ {"show", "show delogo area", OFFSET(show), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1 },
{NULL},
};
@@ -157,18 +161,18 @@ static const AVClass delogo_class = {
static int query_formats(AVFilterContext *ctx)
{
- enum PixelFormat pix_fmts[] = {
- PIX_FMT_YUV444P, PIX_FMT_YUV422P, PIX_FMT_YUV420P,
- PIX_FMT_YUV411P, PIX_FMT_YUV410P, PIX_FMT_YUV440P,
- PIX_FMT_YUVA420P, PIX_FMT_GRAY8,
- PIX_FMT_NONE
+ enum AVPixelFormat pix_fmts[] = {
+ AV_PIX_FMT_YUV444P, AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUV420P,
+ AV_PIX_FMT_YUV411P, AV_PIX_FMT_YUV410P, AV_PIX_FMT_YUV440P,
+ AV_PIX_FMT_YUVA420P, AV_PIX_FMT_GRAY8,
+ AV_PIX_FMT_NONE
};
- avfilter_set_common_formats(ctx, avfilter_make_format_list(pix_fmts));
+ ff_set_common_formats(ctx, ff_make_format_list(pix_fmts));
return 0;
}
-static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
+static av_cold int init(AVFilterContext *ctx, const char *args)
{
DelogoContext *delogo = ctx->priv;
int ret = 0;
@@ -211,43 +215,38 @@ static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
return 0;
}
-static void start_frame(AVFilterLink *inlink, AVFilterBufferRef *inpicref)
-{
- AVFilterLink *outlink = inlink->dst->outputs[0];
- AVFilterBufferRef *outpicref;
-
- if (inpicref->perms & AV_PERM_PRESERVE) {
- outpicref = avfilter_get_video_buffer(outlink, AV_PERM_WRITE,
- outlink->w, outlink->h);
- avfilter_copy_buffer_ref_props(outpicref, inpicref);
- outpicref->video->w = outlink->w;
- outpicref->video->h = outlink->h;
- } else
- outpicref = inpicref;
-
- outlink->out_buf = outpicref;
- avfilter_start_frame(outlink, avfilter_ref_buffer(outpicref, ~0));
-}
-
-static void null_draw_slice(AVFilterLink *link, int y, int h, int slice_dir) { }
-
-static void end_frame(AVFilterLink *inlink)
+static int filter_frame(AVFilterLink *inlink, AVFilterBufferRef *in)
{
DelogoContext *delogo = inlink->dst->priv;
AVFilterLink *outlink = inlink->dst->outputs[0];
- AVFilterBufferRef *inpicref = inlink ->cur_buf;
- AVFilterBufferRef *outpicref = outlink->out_buf;
- int direct = inpicref == outpicref;
- int hsub0 = av_pix_fmt_descriptors[inlink->format].log2_chroma_w;
- int vsub0 = av_pix_fmt_descriptors[inlink->format].log2_chroma_h;
+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format);
+ AVFilterBufferRef *out;
+ int hsub0 = desc->log2_chroma_w;
+ int vsub0 = desc->log2_chroma_h;
+ int direct = 0;
int plane;
- for (plane = 0; plane < 4 && inpicref->data[plane]; plane++) {
+ if ((in->perms & AV_PERM_WRITE) && !(in->perms & AV_PERM_PRESERVE)) {
+ direct = 1;
+ out = in;
+ } else {
+ out = ff_get_video_buffer(outlink, AV_PERM_WRITE, outlink->w, outlink->h);
+ if (!out) {
+ avfilter_unref_bufferp(&in);
+ return AVERROR(ENOMEM);
+ }
+
+ avfilter_copy_buffer_ref_props(out, in);
+ out->video->w = outlink->w;
+ out->video->h = outlink->h;
+ }
+
+ for (plane = 0; plane < 4 && in->data[plane]; plane++) {
int hsub = plane == 1 || plane == 2 ? hsub0 : 0;
int vsub = plane == 1 || plane == 2 ? vsub0 : 0;
- apply_delogo(outpicref->data[plane], outpicref->linesize[plane],
- inpicref ->data[plane], inpicref ->linesize[plane],
+ apply_delogo(out->data[plane], out->linesize[plane],
+ in ->data[plane], in ->linesize[plane],
inlink->w>>hsub, inlink->h>>vsub,
delogo->x>>hsub, delogo->y>>vsub,
delogo->w>>hsub, delogo->h>>vsub,
@@ -255,13 +254,32 @@ static void end_frame(AVFilterLink *inlink)
delogo->show, direct);
}
- avfilter_draw_slice(outlink, 0, inlink->h, 1);
- avfilter_end_frame(outlink);
- avfilter_unref_buffer(inpicref);
if (!direct)
- avfilter_unref_buffer(outpicref);
+ avfilter_unref_bufferp(&in);
+
+ return ff_filter_frame(outlink, out);
}
+static const AVFilterPad avfilter_vf_delogo_inputs[] = {
+ {
+ .name = "default",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .get_video_buffer = ff_null_get_video_buffer,
+ .filter_frame = filter_frame,
+ .min_perms = AV_PERM_WRITE | AV_PERM_READ,
+ .rej_perms = AV_PERM_PRESERVE
+ },
+ { NULL }
+};
+
+static const AVFilterPad avfilter_vf_delogo_outputs[] = {
+ {
+ .name = "default",
+ .type = AVMEDIA_TYPE_VIDEO,
+ },
+ { NULL }
+};
+
AVFilter avfilter_vf_delogo = {
.name = "delogo",
.description = NULL_IF_CONFIG_SMALL("Remove logo from input video."),
@@ -269,16 +287,6 @@ AVFilter avfilter_vf_delogo = {
.init = init,
.query_formats = query_formats,
- .inputs = (AVFilterPad[]) {{ .name = "default",
- .type = AVMEDIA_TYPE_VIDEO,
- .get_video_buffer = avfilter_null_get_video_buffer,
- .start_frame = start_frame,
- .draw_slice = null_draw_slice,
- .end_frame = end_frame,
- .min_perms = AV_PERM_WRITE | AV_PERM_READ,
- .rej_perms = AV_PERM_PRESERVE },
- { .name = NULL}},
- .outputs = (AVFilterPad[]) {{ .name = "default",
- .type = AVMEDIA_TYPE_VIDEO, },
- { .name = NULL}},
+ .inputs = avfilter_vf_delogo_inputs,
+ .outputs = avfilter_vf_delogo_outputs,
};
diff --git a/gst-libs/ext/libav/libavfilter/vf_drawbox.c b/gst-libs/ext/libav/libavfilter/vf_drawbox.c
index ab5cb03..c47422e 100644
--- a/gst-libs/ext/libav/libavfilter/vf_drawbox.c
+++ b/gst-libs/ext/libav/libavfilter/vf_drawbox.c
@@ -25,9 +25,13 @@
*/
#include "libavutil/colorspace.h"
+#include "libavutil/common.h"
#include "libavutil/pixdesc.h"
#include "libavutil/parseutils.h"
#include "avfilter.h"
+#include "formats.h"
+#include "internal.h"
+#include "video.h"
enum { Y, U, V, A };
@@ -37,7 +41,7 @@ typedef struct {
int vsub, hsub; ///< chroma subsampling
} DrawBoxContext;
-static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
+static av_cold int init(AVFilterContext *ctx, const char *args)
{
DrawBoxContext *drawbox= ctx->priv;
char color_str[1024] = "black";
@@ -62,50 +66,50 @@ static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
static int query_formats(AVFilterContext *ctx)
{
- enum PixelFormat pix_fmts[] = {
- PIX_FMT_YUV444P, PIX_FMT_YUV422P, PIX_FMT_YUV420P,
- PIX_FMT_YUV411P, PIX_FMT_YUV410P,
- PIX_FMT_YUVJ444P, PIX_FMT_YUVJ422P, PIX_FMT_YUVJ420P,
- PIX_FMT_YUV440P, PIX_FMT_YUVJ440P,
- PIX_FMT_NONE
+ enum AVPixelFormat pix_fmts[] = {
+ AV_PIX_FMT_YUV444P, AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUV420P,
+ AV_PIX_FMT_YUV411P, AV_PIX_FMT_YUV410P,
+ AV_PIX_FMT_YUVJ444P, AV_PIX_FMT_YUVJ422P, AV_PIX_FMT_YUVJ420P,
+ AV_PIX_FMT_YUV440P, AV_PIX_FMT_YUVJ440P,
+ AV_PIX_FMT_NONE
};
- avfilter_set_common_formats(ctx, avfilter_make_format_list(pix_fmts));
+ ff_set_common_formats(ctx, ff_make_format_list(pix_fmts));
return 0;
}
static int config_input(AVFilterLink *inlink)
{
DrawBoxContext *drawbox = inlink->dst->priv;
+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format);
- drawbox->hsub = av_pix_fmt_descriptors[inlink->format].log2_chroma_w;
- drawbox->vsub = av_pix_fmt_descriptors[inlink->format].log2_chroma_h;
+ drawbox->hsub = desc->log2_chroma_w;
+ drawbox->vsub = desc->log2_chroma_h;
if (drawbox->w == 0) drawbox->w = inlink->w;
if (drawbox->h == 0) drawbox->h = inlink->h;
- av_log(inlink->dst, AV_LOG_INFO, "x:%d y:%d w:%d h:%d color:0x%02X%02X%02X%02X\n",
+ av_log(inlink->dst, AV_LOG_VERBOSE, "x:%d y:%d w:%d h:%d color:0x%02X%02X%02X%02X\n",
drawbox->w, drawbox->y, drawbox->w, drawbox->h,
drawbox->yuv_color[Y], drawbox->yuv_color[U], drawbox->yuv_color[V], drawbox->yuv_color[A]);
return 0;
}
-static void draw_slice(AVFilterLink *inlink, int y0, int h, int slice_dir)
+static int filter_frame(AVFilterLink *inlink, AVFilterBufferRef *frame)
{
DrawBoxContext *drawbox = inlink->dst->priv;
int plane, x, y, xb = drawbox->x, yb = drawbox->y;
unsigned char *row[4];
- AVFilterBufferRef *picref = inlink->cur_buf;
- for (y = FFMAX(yb, y0); y < (y0 + h) && y < (yb + drawbox->h); y++) {
- row[0] = picref->data[0] + y * picref->linesize[0];
+ for (y = FFMAX(yb, 0); y < frame->video->h && y < (yb + drawbox->h); y++) {
+ row[0] = frame->data[0] + y * frame->linesize[0];
for (plane = 1; plane < 3; plane++)
- row[plane] = picref->data[plane] +
- picref->linesize[plane] * (y >> drawbox->vsub);
+ row[plane] = frame->data[plane] +
+ frame->linesize[plane] * (y >> drawbox->vsub);
- for (x = FFMAX(xb, 0); x < (xb + drawbox->w) && x < picref->video->w; x++) {
+ for (x = FFMAX(xb, 0); x < (xb + drawbox->w) && x < frame->video->w; x++) {
double alpha = (double)drawbox->yuv_color[A] / 255;
if ((y - yb < 3) || (yb + drawbox->h - y < 4) ||
@@ -117,9 +121,30 @@ static void draw_slice(AVFilterLink *inlink, int y0, int h, int slice_dir)
}
}
- avfilter_draw_slice(inlink->dst->outputs[0], y0, h, 1);
+ return ff_filter_frame(inlink->dst->outputs[0], frame);
}
+static const AVFilterPad avfilter_vf_drawbox_inputs[] = {
+ {
+ .name = "default",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .config_props = config_input,
+ .get_video_buffer = ff_null_get_video_buffer,
+ .filter_frame = filter_frame,
+ .min_perms = AV_PERM_WRITE | AV_PERM_READ,
+ .rej_perms = AV_PERM_PRESERVE
+ },
+ { NULL }
+};
+
+static const AVFilterPad avfilter_vf_drawbox_outputs[] = {
+ {
+ .name = "default",
+ .type = AVMEDIA_TYPE_VIDEO,
+ },
+ { NULL }
+};
+
AVFilter avfilter_vf_drawbox = {
.name = "drawbox",
.description = NULL_IF_CONFIG_SMALL("Draw a colored box on the input video."),
@@ -127,17 +152,6 @@ AVFilter avfilter_vf_drawbox = {
.init = init,
.query_formats = query_formats,
- .inputs = (AVFilterPad[]) {{ .name = "default",
- .type = AVMEDIA_TYPE_VIDEO,
- .config_props = config_input,
- .get_video_buffer = avfilter_null_get_video_buffer,
- .start_frame = avfilter_null_start_frame,
- .draw_slice = draw_slice,
- .end_frame = avfilter_null_end_frame,
- .min_perms = AV_PERM_WRITE | AV_PERM_READ,
- .rej_perms = AV_PERM_PRESERVE },
- { .name = NULL}},
- .outputs = (AVFilterPad[]) {{ .name = "default",
- .type = AVMEDIA_TYPE_VIDEO, },
- { .name = NULL}},
+ .inputs = avfilter_vf_drawbox_inputs,
+ .outputs = avfilter_vf_drawbox_outputs,
};
diff --git a/gst-libs/ext/libav/libavfilter/vf_drawtext.c b/gst-libs/ext/libav/libavfilter/vf_drawtext.c
index dcde542..f8800d2 100644
--- a/gst-libs/ext/libav/libavfilter/vf_drawtext.c
+++ b/gst-libs/ext/libav/libavfilter/vf_drawtext.c
@@ -30,6 +30,7 @@
#include <time.h>
#include "libavutil/colorspace.h"
+#include "libavutil/common.h"
#include "libavutil/file.h"
#include "libavutil/eval.h"
#include "libavutil/opt.h"
@@ -41,15 +42,16 @@
#include "libavutil/lfg.h"
#include "avfilter.h"
#include "drawutils.h"
-
-#undef time
+#include "formats.h"
+#include "internal.h"
+#include "video.h"
#include <ft2build.h>
#include <freetype/config/ftheader.h>
#include FT_FREETYPE_H
#include FT_GLYPH_H
-static const char *var_names[] = {
+static const char *const var_names[] = {
"E",
"PHI",
"PI",
@@ -64,8 +66,8 @@ static const char *var_names[] = {
NULL
};
-static const char *fun2_names[] = {
- "rand",
+static const char *const fun2_names[] = {
+ "rand"
};
static double drand(void *opaque, double min, double max)
@@ -122,6 +124,7 @@ typedef struct {
short int draw_box; ///< draw box around text - true or false
int use_kerning; ///< font kerning is used - true/false
int tabsize; ///< tab size
+ int fix_bounds; ///< do we let it go out of frame bounds - t/f
FT_Library library; ///< freetype font library handle
FT_Face face; ///< freetype font face handle
@@ -149,32 +152,34 @@ static const AVOption drawtext_options[]= {
{"fontcolor","set foreground color", OFFSET(fontcolor_string), AV_OPT_TYPE_STRING, {.str=NULL}, CHAR_MIN, CHAR_MAX },
{"boxcolor", "set box color", OFFSET(boxcolor_string), AV_OPT_TYPE_STRING, {.str=NULL}, CHAR_MIN, CHAR_MAX },
{"shadowcolor", "set shadow color", OFFSET(shadowcolor_string), AV_OPT_TYPE_STRING, {.str=NULL}, 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, 72 },
+{"box", "set box", OFFSET(draw_box), AV_OPT_TYPE_INT, {.i64=0}, 0, 1 },
+{"fontsize", "set font size", OFFSET(fontsize), AV_OPT_TYPE_INT, {.i64=16}, 1, 72 },
{"x", "set x", OFFSET(x_expr), AV_OPT_TYPE_STRING, {.str="0"}, CHAR_MIN, CHAR_MAX },
{"y", "set y", 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 },
+{"shadowx", "set x", OFFSET(shadowx), AV_OPT_TYPE_INT, {.i64=0}, INT_MIN, INT_MAX },
+{"shadowy", "set y", OFFSET(shadowy), AV_OPT_TYPE_INT, {.i64=0}, INT_MIN, INT_MAX },
+{"tabsize", "set tab size", OFFSET(tabsize), AV_OPT_TYPE_INT, {.i64=4}, 0, INT_MAX },
{"draw", "if false do not draw", OFFSET(d_expr), AV_OPT_TYPE_STRING, {.str="1"}, CHAR_MIN, CHAR_MAX },
+{"fix_bounds", "if true, check and fix text coords to avoid clipping",
+ OFFSET(fix_bounds), AV_OPT_TYPE_INT, {.i64=1}, 0, 1 },
/* 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, {FT_LOAD_DEFAULT}, INT_MIN, INT_MAX, 0, "ft_load_flags" },
-{"no_scale", "set no_scale", 0, AV_OPT_TYPE_CONST, {FT_LOAD_NO_SCALE}, INT_MIN, INT_MAX, 0, "ft_load_flags" },
-{"no_hinting", "set no_hinting", 0, AV_OPT_TYPE_CONST, {FT_LOAD_NO_HINTING}, INT_MIN, INT_MAX, 0, "ft_load_flags" },
-{"render", "set render", 0, AV_OPT_TYPE_CONST, {FT_LOAD_RENDER}, INT_MIN, INT_MAX, 0, "ft_load_flags" },
-{"no_bitmap", "set no_bitmap", 0, AV_OPT_TYPE_CONST, {FT_LOAD_NO_BITMAP}, INT_MIN, INT_MAX, 0, "ft_load_flags" },
-{"vertical_layout", "set vertical_layout", 0, AV_OPT_TYPE_CONST, {FT_LOAD_VERTICAL_LAYOUT}, INT_MIN, INT_MAX, 0, "ft_load_flags" },
-{"force_autohint", "set force_autohint", 0, AV_OPT_TYPE_CONST, {FT_LOAD_FORCE_AUTOHINT}, INT_MIN, INT_MAX, 0, "ft_load_flags" },
-{"crop_bitmap", "set crop_bitmap", 0, AV_OPT_TYPE_CONST, {FT_LOAD_CROP_BITMAP}, INT_MIN, INT_MAX, 0, "ft_load_flags" },
-{"pedantic", "set pedantic", 0, AV_OPT_TYPE_CONST, {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, {FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH}, INT_MIN, INT_MAX, 0, "ft_load_flags" },
-{"no_recurse", "set no_recurse", 0, AV_OPT_TYPE_CONST, {FT_LOAD_NO_RECURSE}, INT_MIN, INT_MAX, 0, "ft_load_flags" },
-{"ignore_transform", "set ignore_transform", 0, AV_OPT_TYPE_CONST, {FT_LOAD_IGNORE_TRANSFORM}, INT_MIN, INT_MAX, 0, "ft_load_flags" },
-{"monochrome", "set monochrome", 0, AV_OPT_TYPE_CONST, {FT_LOAD_MONOCHROME}, INT_MIN, INT_MAX, 0, "ft_load_flags" },
-{"linear_design", "set linear_design", 0, AV_OPT_TYPE_CONST, {FT_LOAD_LINEAR_DESIGN}, INT_MIN, INT_MAX, 0, "ft_load_flags" },
-{"no_autohint", "set no_autohint", 0, AV_OPT_TYPE_CONST, {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, {.i64=FT_LOAD_DEFAULT|FT_LOAD_RENDER}, 0, INT_MAX, 0, "ft_load_flags" },
+{"default", "set default", 0, AV_OPT_TYPE_CONST, {.i64 = FT_LOAD_DEFAULT}, INT_MIN, INT_MAX, 0, "ft_load_flags" },
+{"no_scale", "set no_scale", 0, AV_OPT_TYPE_CONST, {.i64 = FT_LOAD_NO_SCALE}, INT_MIN, INT_MAX, 0, "ft_load_flags" },
+{"no_hinting", "set no_hinting", 0, AV_OPT_TYPE_CONST, {.i64 = FT_LOAD_NO_HINTING}, INT_MIN, INT_MAX, 0, "ft_load_flags" },
+{"render", "set render", 0, AV_OPT_TYPE_CONST, {.i64 = FT_LOAD_RENDER}, INT_MIN, INT_MAX, 0, "ft_load_flags" },
+{"no_bitmap", "set no_bitmap", 0, AV_OPT_TYPE_CONST, {.i64 = FT_LOAD_NO_BITMAP}, INT_MIN, INT_MAX, 0, "ft_load_flags" },
+{"vertical_layout", "set vertical_layout", 0, AV_OPT_TYPE_CONST, {.i64 = FT_LOAD_VERTICAL_LAYOUT}, INT_MIN, INT_MAX, 0, "ft_load_flags" },
+{"force_autohint", "set force_autohint", 0, AV_OPT_TYPE_CONST, {.i64 = FT_LOAD_FORCE_AUTOHINT}, INT_MIN, INT_MAX, 0, "ft_load_flags" },
+{"crop_bitmap", "set crop_bitmap", 0, AV_OPT_TYPE_CONST, {.i64 = FT_LOAD_CROP_BITMAP}, INT_MIN, INT_MAX, 0, "ft_load_flags" },
+{"pedantic", "set pedantic", 0, AV_OPT_TYPE_CONST, {.i64 = 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, {.i64 = FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH}, INT_MIN, INT_MAX, 0, "ft_load_flags" },
+{"no_recurse", "set no_recurse", 0, AV_OPT_TYPE_CONST, {.i64 = FT_LOAD_NO_RECURSE}, INT_MIN, INT_MAX, 0, "ft_load_flags" },
+{"ignore_transform", "set ignore_transform", 0, AV_OPT_TYPE_CONST, {.i64 = FT_LOAD_IGNORE_TRANSFORM}, INT_MIN, INT_MAX, 0, "ft_load_flags" },
+{"monochrome", "set monochrome", 0, AV_OPT_TYPE_CONST, {.i64 = FT_LOAD_MONOCHROME}, INT_MIN, INT_MAX, 0, "ft_load_flags" },
+{"linear_design", "set linear_design", 0, AV_OPT_TYPE_CONST, {.i64 = FT_LOAD_LINEAR_DESIGN}, INT_MIN, INT_MAX, 0, "ft_load_flags" },
+{"no_autohint", "set no_autohint", 0, AV_OPT_TYPE_CONST, {.i64 = FT_LOAD_NO_AUTOHINT}, INT_MIN, INT_MAX, 0, "ft_load_flags" },
{NULL},
};
@@ -256,7 +261,7 @@ static int load_glyph(AVFilterContext *ctx, Glyph **glyph_ptr, uint32_t code)
FT_Glyph_Get_CBox(*glyph->glyph, ft_glyph_bbox_pixels, &glyph->bbox);
/* cache the newly created glyph */
- if (!(node = av_mallocz(av_tree_node_size))) {
+ if (!(node = av_tree_node_alloc())) {
ret = AVERROR(ENOMEM);
goto error;
}
@@ -274,7 +279,7 @@ error:
return ret;
}
-static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
+static av_cold int init(AVFilterContext *ctx, const char *args)
{
int err;
DrawTextContext *dtext = ctx->priv;
@@ -382,17 +387,17 @@ static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
static int query_formats(AVFilterContext *ctx)
{
- static const enum PixelFormat pix_fmts[] = {
- PIX_FMT_ARGB, PIX_FMT_RGBA,
- PIX_FMT_ABGR, PIX_FMT_BGRA,
- PIX_FMT_RGB24, PIX_FMT_BGR24,
- PIX_FMT_YUV420P, PIX_FMT_YUV444P,
- PIX_FMT_YUV422P, PIX_FMT_YUV411P,
- PIX_FMT_YUV410P, PIX_FMT_YUV440P,
- PIX_FMT_NONE
+ static const enum AVPixelFormat pix_fmts[] = {
+ AV_PIX_FMT_ARGB, AV_PIX_FMT_RGBA,
+ AV_PIX_FMT_ABGR, AV_PIX_FMT_BGRA,
+ AV_PIX_FMT_RGB24, AV_PIX_FMT_BGR24,
+ AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV444P,
+ AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUV411P,
+ AV_PIX_FMT_YUV410P, AV_PIX_FMT_YUV440P,
+ AV_PIX_FMT_NONE
};
- avfilter_set_common_formats(ctx, avfilter_make_format_list(pix_fmts));
+ ff_set_common_formats(ctx, ff_make_format_list(pix_fmts));
return 0;
}
@@ -492,9 +497,11 @@ static int dtext_prepare_text(AVFilterContext *ctx)
/* get glyph */
dummy.code = code;
glyph = av_tree_find(dtext->glyphs, &dummy, glyph_cmp, NULL);
- if (!glyph)
+ if (!glyph) {
ret = load_glyph(ctx, &glyph, code);
- if (ret) return ret;
+ if (ret)
+ return ret;
+ }
y_min = FFMIN(glyph->bbox.yMin, y_min);
y_max = FFMAX(glyph->bbox.yMax, y_max);
@@ -548,7 +555,9 @@ static int dtext_prepare_text(AVFilterContext *ctx)
y = FFMIN(y + text_height, height - 1);
dtext->w = str_w;
+ dtext->var_values[VAR_TEXT_W] = dtext->var_values[VAR_TW] = dtext->w;
dtext->h = y;
+ dtext->var_values[VAR_TEXT_H] = dtext->var_values[VAR_TH] = dtext->h;
return 0;
}
@@ -558,7 +567,7 @@ static int config_input(AVFilterLink *inlink)
{
AVFilterContext *ctx = inlink->dst;
DrawTextContext *dtext = ctx->priv;
- const AVPixFmtDescriptor *pix_desc = &av_pix_fmt_descriptors[inlink->format];
+ const AVPixFmtDescriptor *pix_desc = av_pix_fmt_desc_get(inlink->format);
int ret;
dtext->hsub = pix_desc->log2_chroma_w;
@@ -781,8 +790,6 @@ static int draw_text(AVFilterContext *ctx, AVFilterBufferRef *picref,
return 0;
}
-static void null_draw_slice(AVFilterLink *link, int y, int h, int slice_dir) { }
-
static inline int normalize_double(int *n, double d)
{
int ret = 0;
@@ -798,19 +805,20 @@ static inline int normalize_double(int *n, double d)
return ret;
}
-static void start_frame(AVFilterLink *inlink, AVFilterBufferRef *inpicref)
+static int filter_frame(AVFilterLink *inlink, AVFilterBufferRef *frame)
{
AVFilterContext *ctx = inlink->dst;
DrawTextContext *dtext = ctx->priv;
- int fail = 0;
+ int ret = 0;
- if (dtext_prepare_text(ctx) < 0) {
+ if ((ret = dtext_prepare_text(ctx)) < 0) {
av_log(ctx, AV_LOG_ERROR, "Can't draw text\n");
- fail = 1;
+ avfilter_unref_bufferp(&frame);
+ return ret;
}
- dtext->var_values[VAR_T] = inpicref->pts == AV_NOPTS_VALUE ?
- NAN : inpicref->pts * av_q2d(inlink->time_base);
+ dtext->var_values[VAR_T] = frame->pts == AV_NOPTS_VALUE ?
+ NAN : frame->pts * av_q2d(inlink->time_base);
dtext->var_values[VAR_X] =
av_expr_eval(dtext->x_pexpr, dtext->var_values, &dtext->prng);
dtext->var_values[VAR_Y] =
@@ -818,18 +826,19 @@ static void start_frame(AVFilterLink *inlink, AVFilterBufferRef *inpicref)
dtext->var_values[VAR_X] =
av_expr_eval(dtext->x_pexpr, dtext->var_values, &dtext->prng);
- dtext->draw = fail ? 0 :
- av_expr_eval(dtext->d_pexpr, dtext->var_values, &dtext->prng);
+ dtext->draw = av_expr_eval(dtext->d_pexpr, dtext->var_values, &dtext->prng);
normalize_double(&dtext->x, dtext->var_values[VAR_X]);
normalize_double(&dtext->y, dtext->var_values[VAR_Y]);
- if (dtext->x < 0) dtext->x = 0;
- if (dtext->y < 0) dtext->y = 0;
- if ((unsigned)dtext->x + (unsigned)dtext->w > inlink->w)
- dtext->x = inlink->w - dtext->w;
- if ((unsigned)dtext->y + (unsigned)dtext->h > inlink->h)
- dtext->y = inlink->h - dtext->h;
+ if (dtext->fix_bounds) {
+ if (dtext->x < 0) dtext->x = 0;
+ if (dtext->y < 0) dtext->y = 0;
+ if ((unsigned)dtext->x + (unsigned)dtext->w > inlink->w)
+ dtext->x = inlink->w - dtext->w;
+ if ((unsigned)dtext->y + (unsigned)dtext->h > inlink->h)
+ dtext->y = inlink->h - dtext->h;
+ }
dtext->x &= ~((1 << dtext->hsub) - 1);
dtext->y &= ~((1 << dtext->vsub) - 1);
@@ -838,24 +847,36 @@ static void start_frame(AVFilterLink *inlink, AVFilterBufferRef *inpicref)
(int)dtext->var_values[VAR_N], dtext->var_values[VAR_T],
dtext->x, dtext->y, dtext->x+dtext->w, dtext->y+dtext->h);
- avfilter_start_frame(inlink->dst->outputs[0], inpicref);
-}
-
-static void end_frame(AVFilterLink *inlink)
-{
- AVFilterLink *outlink = inlink->dst->outputs[0];
- AVFilterBufferRef *picref = inlink->cur_buf;
- DrawTextContext *dtext = inlink->dst->priv;
-
if (dtext->draw)
- draw_text(inlink->dst, picref, picref->video->w, picref->video->h);
+ draw_text(inlink->dst, frame, frame->video->w, frame->video->h);
dtext->var_values[VAR_N] += 1.0;
- avfilter_draw_slice(outlink, 0, picref->video->h, 1);
- avfilter_end_frame(outlink);
+ return ff_filter_frame(inlink->dst->outputs[0], frame);
}
+static const AVFilterPad avfilter_vf_drawtext_inputs[] = {
+ {
+ .name = "default",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .get_video_buffer = ff_null_get_video_buffer,
+ .filter_frame = filter_frame,
+ .config_props = config_input,
+ .min_perms = AV_PERM_WRITE |
+ AV_PERM_READ,
+ .rej_perms = AV_PERM_PRESERVE
+ },
+ { NULL }
+};
+
+static const AVFilterPad avfilter_vf_drawtext_outputs[] = {
+ {
+ .name = "default",
+ .type = AVMEDIA_TYPE_VIDEO,
+ },
+ { NULL }
+};
+
AVFilter avfilter_vf_drawtext = {
.name = "drawtext",
.description = NULL_IF_CONFIG_SMALL("Draw text on top of video frames using libfreetype library."),
@@ -864,18 +885,6 @@ AVFilter avfilter_vf_drawtext = {
.uninit = uninit,
.query_formats = query_formats,
- .inputs = (AVFilterPad[]) {{ .name = "default",
- .type = AVMEDIA_TYPE_VIDEO,
- .get_video_buffer = avfilter_null_get_video_buffer,
- .start_frame = start_frame,
- .draw_slice = null_draw_slice,
- .end_frame = end_frame,
- .config_props = config_input,
- .min_perms = AV_PERM_WRITE |
- AV_PERM_READ,
- .rej_perms = AV_PERM_PRESERVE },
- { .name = NULL}},
- .outputs = (AVFilterPad[]) {{ .name = "default",
- .type = AVMEDIA_TYPE_VIDEO, },
- { .name = NULL}},
+ .inputs = avfilter_vf_drawtext_inputs,
+ .outputs = avfilter_vf_drawtext_outputs,
};
diff --git a/gst-libs/ext/libav/libavfilter/vf_fade.c b/gst-libs/ext/libav/libavfilter/vf_fade.c
index 9f748b8..f609db1 100644
--- a/gst-libs/ext/libav/libavfilter/vf_fade.c
+++ b/gst-libs/ext/libav/libavfilter/vf_fade.c
@@ -25,8 +25,12 @@
* based heavily on vf_negate.c by Bobby Bingham
*/
+#include "libavutil/common.h"
#include "libavutil/pixdesc.h"
#include "avfilter.h"
+#include "formats.h"
+#include "internal.h"
+#include "video.h"
typedef struct {
int factor, fade_per_frame;
@@ -34,7 +38,7 @@ typedef struct {
int hsub, vsub, bpp;
} FadeContext;
-static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
+static av_cold int init(AVFilterContext *ctx, const char *args)
{
FadeContext *fade = ctx->priv;
unsigned int nb_frames;
@@ -61,7 +65,7 @@ static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
}
fade->stop_frame = fade->start_frame + nb_frames;
- av_log(ctx, AV_LOG_INFO,
+ av_log(ctx, AV_LOG_VERBOSE,
"type:%s start_frame:%d nb_frames:%d\n",
in_out, fade->start_frame, nb_frames);
return 0;
@@ -69,23 +73,23 @@ static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
static int query_formats(AVFilterContext *ctx)
{
- static const enum PixelFormat pix_fmts[] = {
- PIX_FMT_YUV444P, PIX_FMT_YUV422P, PIX_FMT_YUV420P,
- PIX_FMT_YUV411P, PIX_FMT_YUV410P,
- PIX_FMT_YUVJ444P, PIX_FMT_YUVJ422P, PIX_FMT_YUVJ420P,
- PIX_FMT_YUV440P, PIX_FMT_YUVJ440P,
- PIX_FMT_RGB24, PIX_FMT_BGR24,
- PIX_FMT_NONE
+ static const enum AVPixelFormat pix_fmts[] = {
+ AV_PIX_FMT_YUV444P, AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUV420P,
+ AV_PIX_FMT_YUV411P, AV_PIX_FMT_YUV410P,
+ AV_PIX_FMT_YUVJ444P, AV_PIX_FMT_YUVJ422P, AV_PIX_FMT_YUVJ420P,
+ AV_PIX_FMT_YUV440P, AV_PIX_FMT_YUVJ440P,
+ AV_PIX_FMT_RGB24, AV_PIX_FMT_BGR24,
+ AV_PIX_FMT_NONE
};
- avfilter_set_common_formats(ctx, avfilter_make_format_list(pix_fmts));
+ ff_set_common_formats(ctx, ff_make_format_list(pix_fmts));
return 0;
}
static int config_props(AVFilterLink *inlink)
{
FadeContext *fade = inlink->dst->priv;
- const AVPixFmtDescriptor *pixdesc = &av_pix_fmt_descriptors[inlink->format];
+ const AVPixFmtDescriptor *pixdesc = av_pix_fmt_desc_get(inlink->format);
fade->hsub = pixdesc->log2_chroma_w;
fade->vsub = pixdesc->log2_chroma_h;
@@ -94,17 +98,16 @@ static int config_props(AVFilterLink *inlink)
return 0;
}
-static void draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir)
+static int filter_frame(AVFilterLink *inlink, AVFilterBufferRef *frame)
{
FadeContext *fade = inlink->dst->priv;
- AVFilterBufferRef *outpic = inlink->cur_buf;
uint8_t *p;
int i, j, plane;
if (fade->factor < UINT16_MAX) {
/* luma or rgb plane */
- for (i = 0; i < h; i++) {
- p = outpic->data[0] + (y+i) * outpic->linesize[0];
+ for (i = 0; i < frame->video->h; i++) {
+ p = frame->data[0] + i * frame->linesize[0];
for (j = 0; j < inlink->w * fade->bpp; j++) {
/* fade->factor is using 16 lower-order bits for decimal
* places. 32768 = 1 << 15, it is an integer representation
@@ -114,11 +117,11 @@ static void draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir)
}
}
- if (outpic->data[1] && outpic->data[2]) {
+ if (frame->data[1] && frame->data[2]) {
/* chroma planes */
for (plane = 1; plane < 3; plane++) {
- for (i = 0; i < h; i++) {
- p = outpic->data[plane] + ((y+i) >> fade->vsub) * outpic->linesize[plane];
+ for (i = 0; i < frame->video->h; i++) {
+ p = frame->data[plane] + (i >> fade->vsub) * frame->linesize[plane];
for (j = 0; j < inlink->w >> fade->hsub; j++) {
/* 8421367 = ((128 << 1) + 1) << 15. It is an integer
* representation of 128.5. The .5 is for rounding
@@ -131,22 +134,36 @@ static void draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir)
}
}
- avfilter_draw_slice(inlink->dst->outputs[0], y, h, slice_dir);
-}
-
-static void end_frame(AVFilterLink *inlink)
-{
- FadeContext *fade = inlink->dst->priv;
-
- avfilter_end_frame(inlink->dst->outputs[0]);
-
if (fade->frame_index >= fade->start_frame &&
fade->frame_index <= fade->stop_frame)
fade->factor += fade->fade_per_frame;
fade->factor = av_clip_uint16(fade->factor);
fade->frame_index++;
+
+ return ff_filter_frame(inlink->dst->outputs[0], frame);
}
+static const AVFilterPad avfilter_vf_fade_inputs[] = {
+ {
+ .name = "default",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .config_props = config_props,
+ .get_video_buffer = ff_null_get_video_buffer,
+ .filter_frame = filter_frame,
+ .min_perms = AV_PERM_READ | AV_PERM_WRITE,
+ .rej_perms = AV_PERM_PRESERVE,
+ },
+ { NULL }
+};
+
+static const AVFilterPad avfilter_vf_fade_outputs[] = {
+ {
+ .name = "default",
+ .type = AVMEDIA_TYPE_VIDEO,
+ },
+ { NULL }
+};
+
AVFilter avfilter_vf_fade = {
.name = "fade",
.description = NULL_IF_CONFIG_SMALL("Fade in/out input video"),
@@ -154,17 +171,6 @@ AVFilter avfilter_vf_fade = {
.priv_size = sizeof(FadeContext),
.query_formats = query_formats,
- .inputs = (AVFilterPad[]) {{ .name = "default",
- .type = AVMEDIA_TYPE_VIDEO,
- .config_props = config_props,
- .get_video_buffer = avfilter_null_get_video_buffer,
- .start_frame = avfilter_null_start_frame,
- .draw_slice = draw_slice,
- .end_frame = end_frame,
- .min_perms = AV_PERM_READ | AV_PERM_WRITE,
- .rej_perms = AV_PERM_PRESERVE, },
- { .name = NULL}},
- .outputs = (AVFilterPad[]) {{ .name = "default",
- .type = AVMEDIA_TYPE_VIDEO, },
- { .name = NULL}},
+ .inputs = avfilter_vf_fade_inputs,
+ .outputs = avfilter_vf_fade_outputs,
};
diff --git a/gst-libs/ext/libav/libavfilter/vf_fieldorder.c b/gst-libs/ext/libav/libavfilter/vf_fieldorder.c
index 444dffb..5f0cc3b 100644
--- a/gst-libs/ext/libav/libavfilter/vf_fieldorder.c
+++ b/gst-libs/ext/libav/libavfilter/vf_fieldorder.c
@@ -25,9 +25,16 @@
/* #define DEBUG */
+#include <stdio.h>
+#include <string.h>
+
#include "libavutil/imgutils.h"
+#include "libavutil/internal.h"
#include "libavutil/pixdesc.h"
#include "avfilter.h"
+#include "formats.h"
+#include "internal.h"
+#include "video.h"
typedef struct
{
@@ -35,7 +42,7 @@ typedef struct
int line_size[4]; ///< bytes of pixel data per line for each plane
} FieldOrderContext;
-static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
+static av_cold int init(AVFilterContext *ctx, const char *args)
{
FieldOrderContext *fieldorder = ctx->priv;
@@ -55,7 +62,7 @@ static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
return AVERROR(EINVAL);
}
- av_log(ctx, AV_LOG_INFO, "output field order: %s\n",
+ av_log(ctx, AV_LOG_VERBOSE, "output field order: %s\n",
fieldorder->dst_tff ? tff : bff);
return 0;
@@ -64,24 +71,25 @@ static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
static int query_formats(AVFilterContext *ctx)
{
AVFilterFormats *formats;
- enum PixelFormat pix_fmt;
+ enum AVPixelFormat pix_fmt;
int ret;
/** accept any input pixel format that is not hardware accelerated, not
* a bitstream format, and does not have vertically sub-sampled chroma */
if (ctx->inputs[0]) {
formats = NULL;
- for (pix_fmt = 0; pix_fmt < PIX_FMT_NB; pix_fmt++)
- if (!( av_pix_fmt_descriptors[pix_fmt].flags & PIX_FMT_HWACCEL
- || av_pix_fmt_descriptors[pix_fmt].flags & PIX_FMT_BITSTREAM)
- && av_pix_fmt_descriptors[pix_fmt].nb_components
- && !av_pix_fmt_descriptors[pix_fmt].log2_chroma_h
- && (ret = avfilter_add_format(&formats, pix_fmt)) < 0) {
- avfilter_formats_unref(&formats);
+ for (pix_fmt = 0; pix_fmt < AV_PIX_FMT_NB; pix_fmt++) {
+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
+ if (!(desc->flags & PIX_FMT_HWACCEL ||
+ desc->flags & PIX_FMT_BITSTREAM) &&
+ desc->nb_components && !desc->log2_chroma_h &&
+ (ret = ff_add_format(&formats, pix_fmt)) < 0) {
+ ff_formats_unref(&formats);
return ret;
}
- avfilter_formats_ref(formats, &ctx->inputs[0]->out_formats);
- avfilter_formats_ref(formats, &ctx->outputs[0]->in_formats);
+ }
+ ff_formats_ref(formats, &ctx->inputs[0]->out_formats);
+ ff_formats_ref(formats, &ctx->outputs[0]->in_formats);
}
return 0;
@@ -110,125 +118,92 @@ static AVFilterBufferRef *get_video_buffer(AVFilterLink *inlink, int perms, int
AVFilterContext *ctx = inlink->dst;
AVFilterLink *outlink = ctx->outputs[0];
- return avfilter_get_video_buffer(outlink, perms, w, h);
+ return ff_get_video_buffer(outlink, perms, w, h);
}
-static void start_frame(AVFilterLink *inlink, AVFilterBufferRef *inpicref)
+static int filter_frame(AVFilterLink *inlink, AVFilterBufferRef *frame)
{
- AVFilterContext *ctx = inlink->dst;
- AVFilterLink *outlink = ctx->outputs[0];
-
- AVFilterBufferRef *outpicref;
-
- outpicref = avfilter_ref_buffer(inpicref, ~0);
- outlink->out_buf = outpicref;
-
- avfilter_start_frame(outlink, outpicref);
-}
-
-static void draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir)
-{
- AVFilterContext *ctx = inlink->dst;
- FieldOrderContext *fieldorder = ctx->priv;
- AVFilterLink *outlink = ctx->outputs[0];
-
- AVFilterBufferRef *inpicref = inlink->cur_buf;
-
- /** can only currently do slices if this filter is doing nothing
- * because this filter is moving picture content, the output
- * slice will contain different video lines than the input slice
- * and that complexity will be added later */
- if ( !inpicref->video->interlaced
- || inpicref->video->top_field_first == fieldorder->dst_tff) {
- avfilter_draw_slice(outlink, y, h, slice_dir);
- }
-}
-
-static void end_frame(AVFilterLink *inlink)
-{
- AVFilterContext *ctx = inlink->dst;
- FieldOrderContext *fieldorder = ctx->priv;
- AVFilterLink *outlink = ctx->outputs[0];
-
- AVFilterBufferRef *inpicref = inlink->cur_buf;
- AVFilterBufferRef *outpicref = outlink->out_buf;
-
- int h, plane, line_step, line_size, line;
- uint8_t *cpy_src, *cpy_dst;
-
- if ( inpicref->video->interlaced
- && inpicref->video->top_field_first != fieldorder->dst_tff) {
- av_dlog(ctx,
- "picture will move %s one line\n",
- fieldorder->dst_tff ? "up" : "down");
- h = inpicref->video->h;
- for (plane = 0; plane < 4 && inpicref->data[plane]; plane++) {
- line_step = inpicref->linesize[plane];
- line_size = fieldorder->line_size[plane];
- cpy_src = inpicref->data[plane];
- cpy_dst = outpicref->data[plane];
- if (fieldorder->dst_tff) {
- /** Move every line up one line, working from
- * the top to the bottom of the frame.
- * The original top line is lost.
- * The new last line is created as a copy of the
- * penultimate line from that field. */
- for (line = 0; line < h; line++) {
- if (1 + line < outpicref->video->h) {
- memcpy(cpy_dst, cpy_src + line_step, line_size);
- } else {
- memcpy(cpy_dst, cpy_src - line_step - line_step, line_size);
- }
- cpy_src += line_step;
- cpy_dst += line_step;
+ AVFilterContext *ctx = inlink->dst;
+ FieldOrderContext *s = ctx->priv;
+ AVFilterLink *outlink = ctx->outputs[0];
+ int h, plane, line_step, line_size, line;
+ uint8_t *data;
+
+ if (!frame->video->interlaced ||
+ frame->video->top_field_first == s->dst_tff)
+ return ff_filter_frame(outlink, frame);
+
+ av_dlog(ctx,
+ "picture will move %s one line\n",
+ s->dst_tff ? "up" : "down");
+ h = frame->video->h;
+ for (plane = 0; plane < 4 && frame->data[plane]; plane++) {
+ line_step = frame->linesize[plane];
+ line_size = s->line_size[plane];
+ data = frame->data[plane];
+ if (s->dst_tff) {
+ /** Move every line up one line, working from
+ * the top to the bottom of the frame.
+ * The original top line is lost.
+ * The new last line is created as a copy of the
+ * penultimate line from that field. */
+ for (line = 0; line < h; line++) {
+ if (1 + line < frame->video->h) {
+ memcpy(data, data + line_step, line_size);
+ } else {
+ memcpy(data, data - line_step - line_step, line_size);
}
- } else {
- /** Move every line down one line, working from
- * the bottom to the top of the frame.
- * The original bottom line is lost.
- * The new first line is created as a copy of the
- * second line from that field. */
- cpy_src += (h - 1) * line_step;
- cpy_dst += (h - 1) * line_step;
- for (line = h - 1; line >= 0 ; line--) {
- if (line > 0) {
- memcpy(cpy_dst, cpy_src - line_step, line_size);
- } else {
- memcpy(cpy_dst, cpy_src + line_step + line_step, line_size);
- }
- cpy_src -= line_step;
- cpy_dst -= line_step;
+ data += line_step;
+ }
+ } else {
+ /** Move every line down one line, working from
+ * the bottom to the top of the frame.
+ * The original bottom line is lost.
+ * The new first line is created as a copy of the
+ * second line from that field. */
+ data += (h - 1) * line_step;
+ for (line = h - 1; line >= 0 ; line--) {
+ if (line > 0) {
+ memcpy(data, data - line_step, line_size);
+ } else {
+ memcpy(data, data + line_step + line_step, line_size);
}
+ data -= line_step;
}
}
- outpicref->video->top_field_first = fieldorder->dst_tff;
- avfilter_draw_slice(outlink, 0, h, 1);
- } else {
- av_dlog(ctx,
- "not interlaced or field order already correct\n");
}
+ frame->video->top_field_first = s->dst_tff;
- avfilter_end_frame(outlink);
- avfilter_unref_buffer(inpicref);
+ return ff_filter_frame(outlink, frame);
}
+static const AVFilterPad avfilter_vf_fieldorder_inputs[] = {
+ {
+ .name = "default",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .config_props = config_input,
+ .get_video_buffer = get_video_buffer,
+ .filter_frame = filter_frame,
+ .min_perms = AV_PERM_READ | AV_PERM_WRITE,
+ .rej_perms = AV_PERM_REUSE2 | AV_PERM_PRESERVE,
+ },
+ { NULL }
+};
+
+static const AVFilterPad avfilter_vf_fieldorder_outputs[] = {
+ {
+ .name = "default",
+ .type = AVMEDIA_TYPE_VIDEO,
+ },
+ { NULL }
+};
+
AVFilter avfilter_vf_fieldorder = {
.name = "fieldorder",
.description = NULL_IF_CONFIG_SMALL("Set the field order."),
.init = init,
.priv_size = sizeof(FieldOrderContext),
.query_formats = query_formats,
- .inputs = (AVFilterPad[]) {{ .name = "default",
- .type = AVMEDIA_TYPE_VIDEO,
- .config_props = config_input,
- .start_frame = start_frame,
- .get_video_buffer = get_video_buffer,
- .draw_slice = draw_slice,
- .end_frame = end_frame,
- .min_perms = AV_PERM_READ,
- .rej_perms = AV_PERM_REUSE2|AV_PERM_PRESERVE,},
- { .name = NULL}},
- .outputs = (AVFilterPad[]) {{ .name = "default",
- .type = AVMEDIA_TYPE_VIDEO, },
- { .name = NULL}},
+ .inputs = avfilter_vf_fieldorder_inputs,
+ .outputs = avfilter_vf_fieldorder_outputs,
};
diff --git a/gst-libs/ext/libav/libavfilter/vf_fifo.c b/gst-libs/ext/libav/libavfilter/vf_fifo.c
deleted file mode 100644
index 836cce2..0000000
--- a/gst-libs/ext/libav/libavfilter/vf_fifo.c
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * Copyright (c) 2007 Bobby Bingham
- *
- * 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
- * FIFO buffering video filter
- */
-
-#include "avfilter.h"
-
-typedef struct BufPic {
- AVFilterBufferRef *picref;
- struct BufPic *next;
-} BufPic;
-
-typedef struct {
- BufPic root;
- BufPic *last; ///< last buffered picture
-} FifoContext;
-
-static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
-{
- FifoContext *fifo = ctx->priv;
- fifo->last = &fifo->root;
-
- av_log(ctx, AV_LOG_INFO, "\n");
- return 0;
-}
-
-static av_cold void uninit(AVFilterContext *ctx)
-{
- FifoContext *fifo = ctx->priv;
- BufPic *pic, *tmp;
-
- for (pic = fifo->root.next; pic; pic = tmp) {
- tmp = pic->next;
- avfilter_unref_buffer(pic->picref);
- av_free(pic);
- }
-}
-
-static void start_frame(AVFilterLink *inlink, AVFilterBufferRef *picref)
-{
- FifoContext *fifo = inlink->dst->priv;
-
- fifo->last->next = av_mallocz(sizeof(BufPic));
- fifo->last = fifo->last->next;
- fifo->last->picref = picref;
-}
-
-static void end_frame(AVFilterLink *inlink) { }
-
-static void draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir) { }
-
-static int request_frame(AVFilterLink *outlink)
-{
- FifoContext *fifo = outlink->src->priv;
- BufPic *tmp;
- int ret;
-
- if (!fifo->root.next) {
- if ((ret = avfilter_request_frame(outlink->src->inputs[0]) < 0))
- return ret;
- }
-
- /* by doing this, we give ownership of the reference to the next filter,
- * so we don't have to worry about dereferencing it ourselves. */
- avfilter_start_frame(outlink, fifo->root.next->picref);
- avfilter_draw_slice (outlink, 0, outlink->h, 1);
- avfilter_end_frame (outlink);
-
- if (fifo->last == fifo->root.next)
- fifo->last = &fifo->root;
- tmp = fifo->root.next->next;
- av_free(fifo->root.next);
- fifo->root.next = tmp;
-
- return 0;
-}
-
-AVFilter avfilter_vf_fifo = {
- .name = "fifo",
- .description = NULL_IF_CONFIG_SMALL("Buffer input images and send them when they are requested."),
-
- .init = init,
- .uninit = uninit,
-
- .priv_size = sizeof(FifoContext),
-
- .inputs = (AVFilterPad[]) {{ .name = "default",
- .type = AVMEDIA_TYPE_VIDEO,
- .get_video_buffer= avfilter_null_get_video_buffer,
- .start_frame = start_frame,
- .draw_slice = draw_slice,
- .end_frame = end_frame,
- .rej_perms = AV_PERM_REUSE2, },
- { .name = NULL}},
- .outputs = (AVFilterPad[]) {{ .name = "default",
- .type = AVMEDIA_TYPE_VIDEO,
- .request_frame = request_frame, },
- { .name = NULL}},
-};
diff --git a/gst-libs/ext/libav/libavfilter/vf_format.c b/gst-libs/ext/libav/libavfilter/vf_format.c
index 0b0d094..7e4a26e 100644
--- a/gst-libs/ext/libav/libavfilter/vf_format.c
+++ b/gst-libs/ext/libav/libavfilter/vf_format.c
@@ -23,26 +23,33 @@
* format and noformat video filters
*/
+#include <string.h>
+
+#include "libavutil/internal.h"
+#include "libavutil/mem.h"
#include "libavutil/pixdesc.h"
#include "avfilter.h"
+#include "formats.h"
+#include "internal.h"
+#include "video.h"
typedef struct {
/**
* List of flags telling if a given image format has been listed
* as argument to the filter.
*/
- int listed_pix_fmt_flags[PIX_FMT_NB];
+ int listed_pix_fmt_flags[AV_PIX_FMT_NB];
} FormatContext;
-#define PIX_FMT_NAME_MAXSIZE 32
+#define AV_PIX_FMT_NAME_MAXSIZE 32
-static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
+static av_cold int init(AVFilterContext *ctx, const char *args)
{
FormatContext *format = ctx->priv;
const char *cur, *sep;
- char pix_fmt_name[PIX_FMT_NAME_MAXSIZE];
+ char pix_fmt_name[AV_PIX_FMT_NAME_MAXSIZE];
int pix_fmt_name_len;
- enum PixelFormat pix_fmt;
+ enum AVPixelFormat pix_fmt;
/* parse the list of formats */
for (cur = args; cur; cur = sep ? sep+1 : NULL) {
@@ -50,7 +57,7 @@ static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
pix_fmt_name_len = strlen(cur);
else
pix_fmt_name_len = sep - cur;
- if (pix_fmt_name_len >= PIX_FMT_NAME_MAXSIZE) {
+ if (pix_fmt_name_len >= AV_PIX_FMT_NAME_MAXSIZE) {
av_log(ctx, AV_LOG_ERROR, "Format name too long\n");
return -1;
}
@@ -59,7 +66,7 @@ static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
pix_fmt_name[pix_fmt_name_len] = 0;
pix_fmt = av_get_pix_fmt(pix_fmt_name);
- if (pix_fmt == PIX_FMT_NONE) {
+ if (pix_fmt == AV_PIX_FMT_NONE) {
av_log(ctx, AV_LOG_ERROR, "Unknown pixel format: %s\n", pix_fmt_name);
return -1;
}
@@ -73,12 +80,12 @@ static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
static AVFilterFormats *make_format_list(FormatContext *format, int flag)
{
AVFilterFormats *formats;
- enum PixelFormat pix_fmt;
+ enum AVPixelFormat pix_fmt;
formats = av_mallocz(sizeof(AVFilterFormats));
- formats->formats = av_malloc(sizeof(enum PixelFormat) * PIX_FMT_NB);
+ formats->formats = av_malloc(sizeof(enum AVPixelFormat) * AV_PIX_FMT_NB);
- for (pix_fmt = 0; pix_fmt < PIX_FMT_NB; pix_fmt++)
+ for (pix_fmt = 0; pix_fmt < AV_PIX_FMT_NB; pix_fmt++)
if (format->listed_pix_fmt_flags[pix_fmt] == flag)
formats->formats[formats->format_count++] = pix_fmt;
@@ -88,10 +95,27 @@ static AVFilterFormats *make_format_list(FormatContext *format, int flag)
#if CONFIG_FORMAT_FILTER
static int query_formats_format(AVFilterContext *ctx)
{
- avfilter_set_common_formats(ctx, make_format_list(ctx->priv, 1));
+ ff_set_common_formats(ctx, make_format_list(ctx->priv, 1));
return 0;
}
+static const AVFilterPad avfilter_vf_format_inputs[] = {
+ {
+ .name = "default",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .get_video_buffer = ff_null_get_video_buffer,
+ },
+ { NULL }
+};
+
+static const AVFilterPad avfilter_vf_format_outputs[] = {
+ {
+ .name = "default",
+ .type = AVMEDIA_TYPE_VIDEO
+ },
+ { NULL }
+};
+
AVFilter avfilter_vf_format = {
.name = "format",
.description = NULL_IF_CONFIG_SMALL("Convert the input video to one of the specified pixel formats."),
@@ -102,26 +126,35 @@ AVFilter avfilter_vf_format = {
.priv_size = sizeof(FormatContext),
- .inputs = (AVFilterPad[]) {{ .name = "default",
- .type = AVMEDIA_TYPE_VIDEO,
- .get_video_buffer= avfilter_null_get_video_buffer,
- .start_frame = avfilter_null_start_frame,
- .draw_slice = avfilter_null_draw_slice,
- .end_frame = avfilter_null_end_frame, },
- { .name = NULL}},
- .outputs = (AVFilterPad[]) {{ .name = "default",
- .type = AVMEDIA_TYPE_VIDEO },
- { .name = NULL}},
+ .inputs = avfilter_vf_format_inputs,
+ .outputs = avfilter_vf_format_outputs,
};
#endif /* CONFIG_FORMAT_FILTER */
#if CONFIG_NOFORMAT_FILTER
static int query_formats_noformat(AVFilterContext *ctx)
{
- avfilter_set_common_formats(ctx, make_format_list(ctx->priv, 0));
+ ff_set_common_formats(ctx, make_format_list(ctx->priv, 0));
return 0;
}
+static const AVFilterPad avfilter_vf_noformat_inputs[] = {
+ {
+ .name = "default",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .get_video_buffer = ff_null_get_video_buffer,
+ },
+ { NULL }
+};
+
+static const AVFilterPad avfilter_vf_noformat_outputs[] = {
+ {
+ .name = "default",
+ .type = AVMEDIA_TYPE_VIDEO
+ },
+ { NULL }
+};
+
AVFilter avfilter_vf_noformat = {
.name = "noformat",
.description = NULL_IF_CONFIG_SMALL("Force libavfilter not to use any of the specified pixel formats for the input to the next filter."),
@@ -132,16 +165,7 @@ AVFilter avfilter_vf_noformat = {
.priv_size = sizeof(FormatContext),
- .inputs = (AVFilterPad[]) {{ .name = "default",
- .type = AVMEDIA_TYPE_VIDEO,
- .get_video_buffer= avfilter_null_get_video_buffer,
- .start_frame = avfilter_null_start_frame,
- .draw_slice = avfilter_null_draw_slice,
- .end_frame = avfilter_null_end_frame, },
- { .name = NULL}},
- .outputs = (AVFilterPad[]) {{ .name = "default",
- .type = AVMEDIA_TYPE_VIDEO },
- { .name = NULL}},
+ .inputs = avfilter_vf_noformat_inputs,
+ .outputs = avfilter_vf_noformat_outputs,
};
#endif /* CONFIG_NOFORMAT_FILTER */
-
diff --git a/gst-libs/ext/libav/libavfilter/vf_fps.c b/gst-libs/ext/libav/libavfilter/vf_fps.c
new file mode 100644
index 0000000..dc20114
--- /dev/null
+++ b/gst-libs/ext/libav/libavfilter/vf_fps.c
@@ -0,0 +1,295 @@
+/*
+ * 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
+ * a filter enforcing given constant framerate
+ */
+
+#include "libavutil/common.h"
+#include "libavutil/fifo.h"
+#include "libavutil/mathematics.h"
+#include "libavutil/opt.h"
+#include "libavutil/parseutils.h"
+
+#include "avfilter.h"
+#include "internal.h"
+#include "video.h"
+
+typedef struct FPSContext {
+ const AVClass *class;
+
+ AVFifoBuffer *fifo; ///< store frames until we get two successive timestamps
+
+ /* timestamps in input timebase */
+ int64_t first_pts; ///< pts of the first frame that arrived on this filter
+ int64_t pts; ///< pts of the first frame currently in the fifo
+
+ AVRational framerate; ///< target framerate
+ char *fps; ///< a string describing target framerate
+
+ /* statistics */
+ int frames_in; ///< number of frames on input
+ int frames_out; ///< number of frames on output
+ int dup; ///< number of frames duplicated
+ int drop; ///< number of framed dropped
+} FPSContext;
+
+#define OFFSET(x) offsetof(FPSContext, x)
+#define V AV_OPT_FLAG_VIDEO_PARAM
+static const AVOption options[] = {
+ { "fps", "A string describing desired output framerate", OFFSET(fps), AV_OPT_TYPE_STRING, { .str = "25" }, .flags = V },
+ { NULL },
+};
+
+static const AVClass class = {
+ .class_name = "FPS filter",
+ .item_name = av_default_item_name,
+ .option = options,
+ .version = LIBAVUTIL_VERSION_INT,
+};
+
+static av_cold int init(AVFilterContext *ctx, const char *args)
+{
+ FPSContext *s = ctx->priv;
+ int ret;
+
+ s->class = &class;
+ av_opt_set_defaults(s);
+
+ if ((ret = av_set_options_string(s, args, "=", ":")) < 0) {
+ av_log(ctx, AV_LOG_ERROR, "Error parsing the options string %s.\n",
+ args);
+ return ret;
+ }
+
+ if ((ret = av_parse_video_rate(&s->framerate, s->fps)) < 0) {
+ av_log(ctx, AV_LOG_ERROR, "Error parsing framerate %s.\n", s->fps);
+ return ret;
+ }
+ av_opt_free(s);
+
+ if (!(s->fifo = av_fifo_alloc(2*sizeof(AVFilterBufferRef*))))
+ return AVERROR(ENOMEM);
+
+ av_log(ctx, AV_LOG_VERBOSE, "fps=%d/%d\n", s->framerate.num, s->framerate.den);
+ return 0;
+}
+
+static void flush_fifo(AVFifoBuffer *fifo)
+{
+ while (av_fifo_size(fifo)) {
+ AVFilterBufferRef *tmp;
+ av_fifo_generic_read(fifo, &tmp, sizeof(tmp), NULL);
+ avfilter_unref_buffer(tmp);
+ }
+}
+
+static av_cold void uninit(AVFilterContext *ctx)
+{
+ FPSContext *s = ctx->priv;
+ if (s->fifo) {
+ flush_fifo(s->fifo);
+ av_fifo_free(s->fifo);
+ }
+
+ av_log(ctx, AV_LOG_VERBOSE, "%d frames in, %d frames out; %d frames dropped, "
+ "%d frames duplicated.\n", s->frames_in, s->frames_out, s->drop, s->dup);
+}
+
+static int config_props(AVFilterLink* link)
+{
+ FPSContext *s = link->src->priv;
+
+ link->time_base = (AVRational){ s->framerate.den, s->framerate.num };
+ link->w = link->src->inputs[0]->w;
+ link->h = link->src->inputs[0]->h;
+ s->pts = AV_NOPTS_VALUE;
+
+ return 0;
+}
+
+static int request_frame(AVFilterLink *outlink)
+{
+ AVFilterContext *ctx = outlink->src;
+ FPSContext *s = ctx->priv;
+ int frames_out = s->frames_out;
+ int ret = 0;
+
+ while (ret >= 0 && s->frames_out == frames_out)
+ ret = ff_request_frame(ctx->inputs[0]);
+
+ /* flush the fifo */
+ if (ret == AVERROR_EOF && av_fifo_size(s->fifo)) {
+ int i;
+ for (i = 0; av_fifo_size(s->fifo); i++) {
+ AVFilterBufferRef *buf;
+
+ av_fifo_generic_read(s->fifo, &buf, sizeof(buf), NULL);
+ buf->pts = av_rescale_q(s->first_pts, ctx->inputs[0]->time_base,
+ outlink->time_base) + s->frames_out;
+
+ if ((ret = ff_filter_frame(outlink, buf)) < 0)
+ return ret;
+
+ s->frames_out++;
+ }
+ return 0;
+ }
+
+ return ret;
+}
+
+static int write_to_fifo(AVFifoBuffer *fifo, AVFilterBufferRef *buf)
+{
+ int ret;
+
+ if (!av_fifo_space(fifo) &&
+ (ret = av_fifo_realloc2(fifo, 2*av_fifo_size(fifo)))) {
+ avfilter_unref_bufferp(&buf);
+ return ret;
+ }
+
+ av_fifo_generic_write(fifo, &buf, sizeof(buf), NULL);
+ return 0;
+}
+
+static int filter_frame(AVFilterLink *inlink, AVFilterBufferRef *buf)
+{
+ AVFilterContext *ctx = inlink->dst;
+ FPSContext *s = ctx->priv;
+ AVFilterLink *outlink = ctx->outputs[0];
+ int64_t delta;
+ int i, ret;
+
+ s->frames_in++;
+ /* discard frames until we get the first timestamp */
+ if (s->pts == AV_NOPTS_VALUE) {
+ if (buf->pts != AV_NOPTS_VALUE) {
+ ret = write_to_fifo(s->fifo, buf);
+ if (ret < 0)
+ return ret;
+
+ s->first_pts = s->pts = buf->pts;
+ } else {
+ av_log(ctx, AV_LOG_WARNING, "Discarding initial frame(s) with no "
+ "timestamp.\n");
+ avfilter_unref_buffer(buf);
+ s->drop++;
+ }
+ return 0;
+ }
+
+ /* now wait for the next timestamp */
+ if (buf->pts == AV_NOPTS_VALUE) {
+ return write_to_fifo(s->fifo, buf);
+ }
+
+ /* number of output frames */
+ delta = av_rescale_q(buf->pts - s->pts, inlink->time_base,
+ outlink->time_base);
+
+ if (delta < 1) {
+ /* drop the frame and everything buffered except the first */
+ AVFilterBufferRef *tmp;
+ int drop = av_fifo_size(s->fifo)/sizeof(AVFilterBufferRef*);
+
+ av_log(ctx, AV_LOG_DEBUG, "Dropping %d frame(s).\n", drop);
+ s->drop += drop;
+
+ av_fifo_generic_read(s->fifo, &tmp, sizeof(tmp), NULL);
+ flush_fifo(s->fifo);
+ ret = write_to_fifo(s->fifo, tmp);
+
+ avfilter_unref_buffer(buf);
+ return ret;
+ }
+
+ /* can output >= 1 frames */
+ for (i = 0; i < delta; i++) {
+ AVFilterBufferRef *buf_out;
+ av_fifo_generic_read(s->fifo, &buf_out, sizeof(buf_out), NULL);
+
+ /* duplicate the frame if needed */
+ if (!av_fifo_size(s->fifo) && i < delta - 1) {
+ AVFilterBufferRef *dup = avfilter_ref_buffer(buf_out, AV_PERM_READ);
+
+ av_log(ctx, AV_LOG_DEBUG, "Duplicating frame.\n");
+ if (dup)
+ ret = write_to_fifo(s->fifo, dup);
+ else
+ ret = AVERROR(ENOMEM);
+
+ if (ret < 0) {
+ avfilter_unref_bufferp(&buf_out);
+ avfilter_unref_bufferp(&buf);
+ return ret;
+ }
+
+ s->dup++;
+ }
+
+ buf_out->pts = av_rescale_q(s->first_pts, inlink->time_base,
+ outlink->time_base) + s->frames_out;
+
+ if ((ret = ff_filter_frame(outlink, buf_out)) < 0) {
+ avfilter_unref_bufferp(&buf);
+ return ret;
+ }
+
+ s->frames_out++;
+ }
+ flush_fifo(s->fifo);
+
+ ret = write_to_fifo(s->fifo, buf);
+ s->pts = s->first_pts + av_rescale_q(s->frames_out, outlink->time_base, inlink->time_base);
+
+ return ret;
+}
+
+static const AVFilterPad avfilter_vf_fps_inputs[] = {
+ {
+ .name = "default",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .filter_frame = filter_frame,
+ },
+ { NULL }
+};
+
+static const AVFilterPad avfilter_vf_fps_outputs[] = {
+ {
+ .name = "default",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .request_frame = request_frame,
+ .config_props = config_props
+ },
+ { NULL }
+};
+
+AVFilter avfilter_vf_fps = {
+ .name = "fps",
+ .description = NULL_IF_CONFIG_SMALL("Force constant framerate"),
+
+ .init = init,
+ .uninit = uninit,
+
+ .priv_size = sizeof(FPSContext),
+
+ .inputs = avfilter_vf_fps_inputs,
+ .outputs = avfilter_vf_fps_outputs,
+};
diff --git a/gst-libs/ext/libav/libavfilter/vf_frei0r.c b/gst-libs/ext/libav/libavfilter/vf_frei0r.c
index 455e24a..955d0b9 100644
--- a/gst-libs/ext/libav/libavfilter/vf_frei0r.c
+++ b/gst-libs/ext/libav/libavfilter/vf_frei0r.c
@@ -26,11 +26,20 @@
#include <dlfcn.h>
#include <frei0r.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include "config.h"
#include "libavutil/avstring.h"
#include "libavutil/imgutils.h"
+#include "libavutil/internal.h"
#include "libavutil/mathematics.h"
+#include "libavutil/mem.h"
#include "libavutil/parseutils.h"
#include "avfilter.h"
+#include "formats.h"
+#include "internal.h"
+#include "video.h"
typedef f0r_instance_t (*f0r_construct_f)(unsigned int width, unsigned int height);
typedef void (*f0r_destruct_f)(f0r_instance_t instance);
@@ -143,7 +152,7 @@ static int set_params(AVFilterContext *ctx, const char *params)
return ret;
}
- av_log(ctx, AV_LOG_INFO,
+ av_log(ctx, AV_LOG_VERBOSE,
"idx:%d name:'%s' type:%s explanation:'%s' ",
i, info.name,
info.type == F0R_PARAM_BOOL ? "bool" :
@@ -154,7 +163,7 @@ static int set_params(AVFilterContext *ctx, const char *params)
info.explanation);
#ifdef DEBUG
- av_log(ctx, AV_LOG_INFO, "value:");
+ av_log(ctx, AV_LOG_DEBUG, "value:");
switch (info.type) {
void *v;
double d;
@@ -165,31 +174,31 @@ static int set_params(AVFilterContext *ctx, const char *params)
case F0R_PARAM_BOOL:
v = &d;
frei0r->get_param_value(frei0r->instance, v, i);
- av_log(ctx, AV_LOG_INFO, "%s", d >= 0.5 && d <= 1.0 ? "y" : "n");
+ av_log(ctx, AV_LOG_DEBUG, "%s", d >= 0.5 && d <= 1.0 ? "y" : "n");
break;
case F0R_PARAM_DOUBLE:
v = &d;
frei0r->get_param_value(frei0r->instance, v, i);
- av_log(ctx, AV_LOG_INFO, "%f", d);
+ av_log(ctx, AV_LOG_DEBUG, "%f", d);
break;
case F0R_PARAM_COLOR:
v = &col;
frei0r->get_param_value(frei0r->instance, v, i);
- av_log(ctx, AV_LOG_INFO, "%f/%f/%f", col.r, col.g, col.b);
+ av_log(ctx, AV_LOG_DEBUG, "%f/%f/%f", col.r, col.g, col.b);
break;
case F0R_PARAM_POSITION:
v = &pos;
frei0r->get_param_value(frei0r->instance, v, i);
- av_log(ctx, AV_LOG_INFO, "%lf/%lf", pos.x, pos.y);
+ av_log(ctx, AV_LOG_DEBUG, "%f/%f", pos.x, pos.y);
break;
default: /* F0R_PARAM_STRING */
v = s;
frei0r->get_param_value(frei0r->instance, v, i);
- av_log(ctx, AV_LOG_INFO, "'%s'\n", s);
+ av_log(ctx, AV_LOG_DEBUG, "'%s'\n", s);
break;
}
#endif
- av_log(ctx, AV_LOG_INFO, "\n");
+ av_log(ctx, AV_LOG_VERBOSE, "\n");
}
return 0;
@@ -263,7 +272,7 @@ static av_cold int frei0r_init(AVFilterContext *ctx,
return AVERROR(EINVAL);
}
- av_log(ctx, AV_LOG_INFO,
+ av_log(ctx, AV_LOG_VERBOSE,
"name:%s author:'%s' explanation:'%s' color_model:%s "
"frei0r_version:%d version:%d.%d num_params:%d\n",
pi->name, pi->author, pi->explanation,
@@ -275,7 +284,7 @@ static av_cold int frei0r_init(AVFilterContext *ctx,
return 0;
}
-static av_cold int filter_init(AVFilterContext *ctx, const char *args, void *opaque)
+static av_cold int filter_init(AVFilterContext *ctx, const char *args)
{
Frei0rContext *frei0r = ctx->priv;
char dl_name[1024], c;
@@ -320,41 +329,64 @@ static int query_formats(AVFilterContext *ctx)
AVFilterFormats *formats = NULL;
if (frei0r->plugin_info.color_model == F0R_COLOR_MODEL_BGRA8888) {
- avfilter_add_format(&formats, PIX_FMT_BGRA);
+ ff_add_format(&formats, AV_PIX_FMT_BGRA);
} else if (frei0r->plugin_info.color_model == F0R_COLOR_MODEL_RGBA8888) {
- avfilter_add_format(&formats, PIX_FMT_RGBA);
+ ff_add_format(&formats, AV_PIX_FMT_RGBA);
} else { /* F0R_COLOR_MODEL_PACKED32 */
- static const enum PixelFormat pix_fmts[] = {
- PIX_FMT_BGRA, PIX_FMT_ARGB, PIX_FMT_ABGR, PIX_FMT_ARGB, PIX_FMT_NONE
+ static const enum AVPixelFormat pix_fmts[] = {
+ AV_PIX_FMT_BGRA, AV_PIX_FMT_ARGB, AV_PIX_FMT_ABGR, AV_PIX_FMT_ARGB, AV_PIX_FMT_NONE
};
- formats = avfilter_make_format_list(pix_fmts);
+ formats = ff_make_format_list(pix_fmts);
}
if (!formats)
return AVERROR(ENOMEM);
- avfilter_set_common_formats(ctx, formats);
+ ff_set_common_formats(ctx, formats);
return 0;
}
-static void null_draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir) { }
-
-static void end_frame(AVFilterLink *inlink)
+static int filter_frame(AVFilterLink *inlink, AVFilterBufferRef *in)
{
Frei0rContext *frei0r = inlink->dst->priv;
AVFilterLink *outlink = inlink->dst->outputs[0];
- AVFilterBufferRef *inpicref = inlink->cur_buf;
- AVFilterBufferRef *outpicref = outlink->out_buf;
-
- frei0r->update(frei0r->instance, inpicref->pts * av_q2d(inlink->time_base) * 1000,
- (const uint32_t *)inpicref->data[0],
- (uint32_t *)outpicref->data[0]);
- avfilter_unref_buffer(inpicref);
- avfilter_draw_slice(outlink, 0, outlink->h, 1);
- avfilter_end_frame(outlink);
- avfilter_unref_buffer(outpicref);
+ AVFilterBufferRef *out;
+
+ out = ff_get_video_buffer(outlink, AV_PERM_WRITE, outlink->w, outlink->h);
+ if (!out) {
+ avfilter_unref_bufferp(&in);
+ return AVERROR(ENOMEM);
+ }
+ avfilter_copy_buffer_ref_props(out, in);
+
+ frei0r->update(frei0r->instance, in->pts * av_q2d(inlink->time_base) * 1000,
+ (const uint32_t *)in->data[0],
+ (uint32_t *)out->data[0]);
+
+ avfilter_unref_bufferp(&in);
+
+ return ff_filter_frame(outlink, out);
}
+static const AVFilterPad avfilter_vf_frei0r_inputs[] = {
+ {
+ .name = "default",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .config_props = config_input_props,
+ .filter_frame = filter_frame,
+ .min_perms = AV_PERM_READ
+ },
+ { NULL }
+};
+
+static const AVFilterPad avfilter_vf_frei0r_outputs[] = {
+ {
+ .name = "default",
+ .type = AVMEDIA_TYPE_VIDEO,
+ },
+ { NULL }
+};
+
AVFilter avfilter_vf_frei0r = {
.name = "frei0r",
.description = NULL_IF_CONFIG_SMALL("Apply a frei0r effect."),
@@ -365,20 +397,12 @@ AVFilter avfilter_vf_frei0r = {
.priv_size = sizeof(Frei0rContext),
- .inputs = (AVFilterPad[]) {{ .name = "default",
- .type = AVMEDIA_TYPE_VIDEO,
- .draw_slice = null_draw_slice,
- .config_props = config_input_props,
- .end_frame = end_frame,
- .min_perms = AV_PERM_READ },
- { .name = NULL}},
-
- .outputs = (AVFilterPad[]) {{ .name = "default",
- .type = AVMEDIA_TYPE_VIDEO, },
- { .name = NULL}},
+ .inputs = avfilter_vf_frei0r_inputs,
+
+ .outputs = avfilter_vf_frei0r_outputs,
};
-static av_cold int source_init(AVFilterContext *ctx, const char *args, void *opaque)
+static av_cold int source_init(AVFilterContext *ctx, const char *args)
{
Frei0rContext *frei0r = ctx->priv;
char dl_name[1024], c;
@@ -430,21 +454,31 @@ static int source_config_props(AVFilterLink *outlink)
static int source_request_frame(AVFilterLink *outlink)
{
Frei0rContext *frei0r = outlink->src->priv;
- AVFilterBufferRef *picref = avfilter_get_video_buffer(outlink, AV_PERM_WRITE, outlink->w, outlink->h);
+ AVFilterBufferRef *picref = ff_get_video_buffer(outlink, AV_PERM_WRITE, outlink->w, outlink->h);
+
+ if (!picref)
+ return AVERROR(ENOMEM);
+
picref->video->pixel_aspect = (AVRational) {1, 1};
picref->pts = frei0r->pts++;
picref->pos = -1;
- avfilter_start_frame(outlink, avfilter_ref_buffer(picref, ~0));
frei0r->update(frei0r->instance, av_rescale_q(picref->pts, frei0r->time_base, (AVRational){1,1000}),
NULL, (uint32_t *)picref->data[0]);
- avfilter_draw_slice(outlink, 0, outlink->h, 1);
- avfilter_end_frame(outlink);
- avfilter_unref_buffer(picref);
- return 0;
+ return ff_filter_frame(outlink, picref);
}
+static const AVFilterPad avfilter_vsrc_frei0r_src_outputs[] = {
+ {
+ .name = "default",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .request_frame = source_request_frame,
+ .config_props = source_config_props
+ },
+ { NULL }
+};
+
AVFilter avfilter_vsrc_frei0r_src = {
.name = "frei0r_src",
.description = NULL_IF_CONFIG_SMALL("Generate a frei0r source."),
@@ -455,11 +489,7 @@ AVFilter avfilter_vsrc_frei0r_src = {
.query_formats = query_formats,
- .inputs = (AVFilterPad[]) {{ .name = NULL}},
+ .inputs = NULL,
- .outputs = (AVFilterPad[]) {{ .name = "default",
- .type = AVMEDIA_TYPE_VIDEO,
- .request_frame = source_request_frame,
- .config_props = source_config_props },
- { .name = NULL}},
+ .outputs = avfilter_vsrc_frei0r_src_outputs,
};
diff --git a/gst-libs/ext/libav/libavfilter/vf_gradfun.c b/gst-libs/ext/libav/libavfilter/vf_gradfun.c
index c6663c4..79e1490 100644
--- a/gst-libs/ext/libav/libavfilter/vf_gradfun.c
+++ b/gst-libs/ext/libav/libavfilter/vf_gradfun.c
@@ -33,10 +33,14 @@
*/
#include "libavutil/imgutils.h"
+#include "libavutil/common.h"
#include "libavutil/cpu.h"
#include "libavutil/pixdesc.h"
#include "avfilter.h"
+#include "formats.h"
#include "gradfun.h"
+#include "internal.h"
+#include "video.h"
DECLARE_ALIGNED(16, static const uint16_t, dither)[8][8] = {
{0x00,0x60,0x18,0x78,0x06,0x66,0x1E,0x7E},
@@ -115,12 +119,11 @@ static void filter(GradFunContext *ctx, uint8_t *dst, uint8_t *src, int width, i
}
}
-static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
+static av_cold int init(AVFilterContext *ctx, const char *args)
{
GradFunContext *gf = ctx->priv;
float thresh = 1.2;
int radius = 16;
- av_unused int cpu_flags = av_get_cpu_flags();
if (args)
sscanf(args, "%f:%d", &thresh, &radius);
@@ -132,14 +135,10 @@ static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
gf->blur_line = ff_gradfun_blur_line_c;
gf->filter_line = ff_gradfun_filter_line_c;
- if (HAVE_MMX && cpu_flags & AV_CPU_FLAG_MMX2)
- gf->filter_line = ff_gradfun_filter_line_mmx2;
- if (HAVE_SSSE3 && cpu_flags & AV_CPU_FLAG_SSSE3)
- gf->filter_line = ff_gradfun_filter_line_ssse3;
- if (HAVE_SSE && cpu_flags & AV_CPU_FLAG_SSE2)
- gf->blur_line = ff_gradfun_blur_line_sse2;
+ if (ARCH_X86)
+ ff_gradfun_init_x86(gf);
- av_log(ctx, AV_LOG_INFO, "threshold:%.2f radius:%d\n", thresh, gf->radius);
+ av_log(ctx, AV_LOG_VERBOSE, "threshold:%.2f radius:%d\n", thresh, gf->radius);
return 0;
}
@@ -152,15 +151,15 @@ static av_cold void uninit(AVFilterContext *ctx)
static int query_formats(AVFilterContext *ctx)
{
- static const enum PixelFormat pix_fmts[] = {
- PIX_FMT_YUV410P, PIX_FMT_YUV420P,
- PIX_FMT_GRAY8, PIX_FMT_NV12,
- PIX_FMT_NV21, PIX_FMT_YUV444P,
- PIX_FMT_YUV422P, PIX_FMT_YUV411P,
- PIX_FMT_NONE
+ static const enum AVPixelFormat pix_fmts[] = {
+ AV_PIX_FMT_YUV410P, AV_PIX_FMT_YUV420P,
+ AV_PIX_FMT_GRAY8, AV_PIX_FMT_NV12,
+ AV_PIX_FMT_NV21, AV_PIX_FMT_YUV444P,
+ AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUV411P,
+ AV_PIX_FMT_NONE
};
- avfilter_set_common_formats(ctx, avfilter_make_format_list(pix_fmts));
+ ff_set_common_formats(ctx, ff_make_format_list(pix_fmts));
return 0;
}
@@ -168,8 +167,9 @@ static int query_formats(AVFilterContext *ctx)
static int config_input(AVFilterLink *inlink)
{
GradFunContext *gf = inlink->dst->priv;
- int hsub = av_pix_fmt_descriptors[inlink->format].log2_chroma_w;
- int vsub = av_pix_fmt_descriptors[inlink->format].log2_chroma_h;
+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format);
+ int hsub = desc->log2_chroma_w;
+ int vsub = desc->log2_chroma_h;
gf->buf = av_mallocz((FFALIGN(inlink->w, 16) * (gf->radius + 1) / 2 + 32) * sizeof(uint16_t));
if (!gf->buf)
@@ -182,34 +182,30 @@ static int config_input(AVFilterLink *inlink)
return 0;
}
-static void start_frame(AVFilterLink *inlink, AVFilterBufferRef *inpicref)
-{
- AVFilterLink *outlink = inlink->dst->outputs[0];
- AVFilterBufferRef *outpicref;
-
- if (inpicref->perms & AV_PERM_PRESERVE) {
- outpicref = avfilter_get_video_buffer(outlink, AV_PERM_WRITE, outlink->w, outlink->h);
- avfilter_copy_buffer_ref_props(outpicref, inpicref);
- outpicref->video->w = outlink->w;
- outpicref->video->h = outlink->h;
- } else
- outpicref = inpicref;
-
- outlink->out_buf = outpicref;
- avfilter_start_frame(outlink, avfilter_ref_buffer(outpicref, ~0));
-}
-
-static void null_draw_slice(AVFilterLink *link, int y, int h, int slice_dir) { }
-
-static void end_frame(AVFilterLink *inlink)
+static int filter_frame(AVFilterLink *inlink, AVFilterBufferRef *in)
{
GradFunContext *gf = inlink->dst->priv;
- AVFilterBufferRef *inpic = inlink->cur_buf;
AVFilterLink *outlink = inlink->dst->outputs[0];
- AVFilterBufferRef *outpic = outlink->out_buf;
- int p;
+ AVFilterBufferRef *out;
+ int p, direct;
+
+ if ((in->perms & AV_PERM_WRITE) && !(in->perms & AV_PERM_PRESERVE)) {
+ direct = 1;
+ out = in;
+ } else {
+ direct = 0;
+ out = ff_get_video_buffer(outlink, AV_PERM_WRITE, outlink->w, outlink->h);
+ if (!out) {
+ avfilter_unref_bufferp(&in);
+ return AVERROR(ENOMEM);
+ }
- for (p = 0; p < 4 && inpic->data[p]; p++) {
+ avfilter_copy_buffer_ref_props(out, in);
+ out->video->w = outlink->w;
+ out->video->h = outlink->h;
+ }
+
+ for (p = 0; p < 4 && in->data[p]; p++) {
int w = inlink->w;
int h = inlink->h;
int r = gf->radius;
@@ -220,18 +216,36 @@ static void end_frame(AVFilterLink *inlink)
}
if (FFMIN(w, h) > 2 * r)
- filter(gf, outpic->data[p], inpic->data[p], w, h, outpic->linesize[p], inpic->linesize[p], r);
- else if (outpic->data[p] != inpic->data[p])
- av_image_copy_plane(outpic->data[p], outpic->linesize[p], inpic->data[p], inpic->linesize[p], w, h);
+ filter(gf, out->data[p], in->data[p], w, h, out->linesize[p], in->linesize[p], r);
+ else if (out->data[p] != in->data[p])
+ av_image_copy_plane(out->data[p], out->linesize[p], in->data[p], in->linesize[p], w, h);
}
- avfilter_draw_slice(outlink, 0, inlink->h, 1);
- avfilter_end_frame(outlink);
- avfilter_unref_buffer(inpic);
- if (outpic != inpic)
- avfilter_unref_buffer(outpic);
+ if (!direct)
+ avfilter_unref_bufferp(&in);
+
+ return ff_filter_frame(outlink, out);
}
+static const AVFilterPad avfilter_vf_gradfun_inputs[] = {
+ {
+ .name = "default",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .config_props = config_input,
+ .filter_frame = filter_frame,
+ .min_perms = AV_PERM_READ,
+ },
+ { NULL }
+};
+
+static const AVFilterPad avfilter_vf_gradfun_outputs[] = {
+ {
+ .name = "default",
+ .type = AVMEDIA_TYPE_VIDEO,
+ },
+ { NULL }
+};
+
AVFilter avfilter_vf_gradfun = {
.name = "gradfun",
.description = NULL_IF_CONFIG_SMALL("Debands video quickly using gradients."),
@@ -240,15 +254,6 @@ AVFilter avfilter_vf_gradfun = {
.uninit = uninit,
.query_formats = query_formats,
- .inputs = (AVFilterPad[]) {{ .name = "default",
- .type = AVMEDIA_TYPE_VIDEO,
- .config_props = config_input,
- .start_frame = start_frame,
- .draw_slice = null_draw_slice,
- .end_frame = end_frame,
- .min_perms = AV_PERM_READ, },
- { .name = NULL}},
- .outputs = (AVFilterPad[]) {{ .name = "default",
- .type = AVMEDIA_TYPE_VIDEO, },
- { .name = NULL}},
+ .inputs = avfilter_vf_gradfun_inputs,
+ .outputs = avfilter_vf_gradfun_outputs,
};
diff --git a/gst-libs/ext/libav/libavfilter/vf_hflip.c b/gst-libs/ext/libav/libavfilter/vf_hflip.c
index fb8911f..85a1d92 100644
--- a/gst-libs/ext/libav/libavfilter/vf_hflip.c
+++ b/gst-libs/ext/libav/libavfilter/vf_hflip.c
@@ -24,8 +24,14 @@
* horizontal flip filter
*/
+#include <string.h>
+
#include "avfilter.h"
+#include "formats.h"
+#include "internal.h"
+#include "video.h"
#include "libavutil/pixdesc.h"
+#include "libavutil/internal.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/imgutils.h"
@@ -36,70 +42,76 @@ typedef struct {
static int query_formats(AVFilterContext *ctx)
{
- static const enum PixelFormat pix_fmts[] = {
- PIX_FMT_RGB48BE, PIX_FMT_RGB48LE,
- PIX_FMT_BGR48BE, PIX_FMT_BGR48LE,
- PIX_FMT_ARGB, PIX_FMT_RGBA,
- PIX_FMT_ABGR, PIX_FMT_BGRA,
- PIX_FMT_RGB24, PIX_FMT_BGR24,
- PIX_FMT_RGB565BE, PIX_FMT_RGB565LE,
- PIX_FMT_RGB555BE, PIX_FMT_RGB555LE,
- PIX_FMT_BGR565BE, PIX_FMT_BGR565LE,
- PIX_FMT_BGR555BE, PIX_FMT_BGR555LE,
- PIX_FMT_GRAY16BE, PIX_FMT_GRAY16LE,
- PIX_FMT_YUV420P16LE, PIX_FMT_YUV420P16BE,
- PIX_FMT_YUV422P16LE, PIX_FMT_YUV422P16BE,
- PIX_FMT_YUV444P16LE, PIX_FMT_YUV444P16BE,
- PIX_FMT_YUV444P, PIX_FMT_YUV422P,
- PIX_FMT_YUV420P, PIX_FMT_YUV411P,
- PIX_FMT_YUV410P, PIX_FMT_YUV440P,
- PIX_FMT_YUVJ444P, PIX_FMT_YUVJ422P,
- PIX_FMT_YUVJ420P, PIX_FMT_YUVJ440P,
- PIX_FMT_YUVA420P,
- PIX_FMT_RGB8, PIX_FMT_BGR8,
- PIX_FMT_RGB4_BYTE, PIX_FMT_BGR4_BYTE,
- PIX_FMT_PAL8, PIX_FMT_GRAY8,
- PIX_FMT_NONE
+ static const enum AVPixelFormat pix_fmts[] = {
+ AV_PIX_FMT_RGB48BE, AV_PIX_FMT_RGB48LE,
+ AV_PIX_FMT_BGR48BE, AV_PIX_FMT_BGR48LE,
+ AV_PIX_FMT_ARGB, AV_PIX_FMT_RGBA,
+ AV_PIX_FMT_ABGR, AV_PIX_FMT_BGRA,
+ AV_PIX_FMT_RGB24, AV_PIX_FMT_BGR24,
+ AV_PIX_FMT_RGB565BE, AV_PIX_FMT_RGB565LE,
+ AV_PIX_FMT_RGB555BE, AV_PIX_FMT_RGB555LE,
+ AV_PIX_FMT_BGR565BE, AV_PIX_FMT_BGR565LE,
+ AV_PIX_FMT_BGR555BE, AV_PIX_FMT_BGR555LE,
+ AV_PIX_FMT_GRAY16BE, AV_PIX_FMT_GRAY16LE,
+ AV_PIX_FMT_YUV420P16LE, AV_PIX_FMT_YUV420P16BE,
+ AV_PIX_FMT_YUV422P16LE, AV_PIX_FMT_YUV422P16BE,
+ AV_PIX_FMT_YUV444P16LE, AV_PIX_FMT_YUV444P16BE,
+ AV_PIX_FMT_YUV444P, AV_PIX_FMT_YUV422P,
+ AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV411P,
+ AV_PIX_FMT_YUV410P, AV_PIX_FMT_YUV440P,
+ AV_PIX_FMT_YUVJ444P, AV_PIX_FMT_YUVJ422P,
+ AV_PIX_FMT_YUVJ420P, AV_PIX_FMT_YUVJ440P,
+ AV_PIX_FMT_YUVA420P,
+ AV_PIX_FMT_RGB8, AV_PIX_FMT_BGR8,
+ AV_PIX_FMT_RGB4_BYTE, AV_PIX_FMT_BGR4_BYTE,
+ AV_PIX_FMT_PAL8, AV_PIX_FMT_GRAY8,
+ AV_PIX_FMT_NONE
};
- avfilter_set_common_formats(ctx, avfilter_make_format_list(pix_fmts));
+ ff_set_common_formats(ctx, ff_make_format_list(pix_fmts));
return 0;
}
static int config_props(AVFilterLink *inlink)
{
FlipContext *flip = inlink->dst->priv;
- const AVPixFmtDescriptor *pix_desc = &av_pix_fmt_descriptors[inlink->format];
+ const AVPixFmtDescriptor *pix_desc = av_pix_fmt_desc_get(inlink->format);
av_image_fill_max_pixsteps(flip->max_step, NULL, pix_desc);
- flip->hsub = av_pix_fmt_descriptors[inlink->format].log2_chroma_w;
- flip->vsub = av_pix_fmt_descriptors[inlink->format].log2_chroma_h;
+ flip->hsub = pix_desc->log2_chroma_w;
+ flip->vsub = pix_desc->log2_chroma_h;
return 0;
}
-static void draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir)
+static int filter_frame(AVFilterLink *inlink, AVFilterBufferRef *in)
{
- FlipContext *flip = inlink->dst->priv;
- AVFilterBufferRef *inpic = inlink->cur_buf;
- AVFilterBufferRef *outpic = inlink->dst->outputs[0]->out_buf;
+ AVFilterContext *ctx = inlink->dst;
+ FlipContext *flip = ctx->priv;
+ AVFilterLink *outlink = ctx->outputs[0];
+ AVFilterBufferRef *out;
uint8_t *inrow, *outrow;
int i, j, plane, step, hsub, vsub;
- for (plane = 0; plane < 4 && inpic->data[plane]; plane++) {
+ out = ff_get_video_buffer(outlink, AV_PERM_WRITE, outlink->w, outlink->h);
+ if (!out) {
+ avfilter_unref_bufferp(&in);
+ return AVERROR(ENOMEM);
+ }
+ avfilter_copy_buffer_ref_props(out, in);
+
+ for (plane = 0; plane < 4 && in->data[plane]; plane++) {
step = flip->max_step[plane];
hsub = (plane == 1 || plane == 2) ? flip->hsub : 0;
vsub = (plane == 1 || plane == 2) ? flip->vsub : 0;
- outrow = outpic->data[plane] + (y>>vsub) * outpic->linesize[plane];
- inrow = inpic ->data[plane] + (y>>vsub) * inpic ->linesize[plane] + ((inlink->w >> hsub) - 1) * step;
- for (i = 0; i < h>>vsub; i++) {
+ outrow = out->data[plane];
+ inrow = in ->data[plane] + ((inlink->w >> hsub) - 1) * step;
+ for (i = 0; i < in->video->h >> vsub; i++) {
switch (step) {
case 1:
- {
for (j = 0; j < (inlink->w >> hsub); j++)
outrow[j] = inrow[-j];
- }
break;
case 2:
@@ -136,27 +148,40 @@ static void draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir)
memcpy(outrow + j*step, inrow - j*step, step);
}
- inrow += inpic ->linesize[plane];
- outrow += outpic->linesize[plane];
+ inrow += in ->linesize[plane];
+ outrow += out->linesize[plane];
}
}
- avfilter_draw_slice(inlink->dst->outputs[0], y, h, slice_dir);
+ avfilter_unref_bufferp(&in);
+ return ff_filter_frame(outlink, out);
}
+static const AVFilterPad avfilter_vf_hflip_inputs[] = {
+ {
+ .name = "default",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .filter_frame = filter_frame,
+ .config_props = config_props,
+ .min_perms = AV_PERM_READ,
+ },
+ { NULL }
+};
+
+static const AVFilterPad avfilter_vf_hflip_outputs[] = {
+ {
+ .name = "default",
+ .type = AVMEDIA_TYPE_VIDEO,
+ },
+ { NULL }
+};
+
AVFilter avfilter_vf_hflip = {
.name = "hflip",
.description = NULL_IF_CONFIG_SMALL("Horizontally flip the input video."),
.priv_size = sizeof(FlipContext),
.query_formats = query_formats,
- .inputs = (AVFilterPad[]) {{ .name = "default",
- .type = AVMEDIA_TYPE_VIDEO,
- .draw_slice = draw_slice,
- .config_props = config_props,
- .min_perms = AV_PERM_READ, },
- { .name = NULL}},
- .outputs = (AVFilterPad[]) {{ .name = "default",
- .type = AVMEDIA_TYPE_VIDEO, },
- { .name = NULL}},
+ .inputs = avfilter_vf_hflip_inputs,
+ .outputs = avfilter_vf_hflip_outputs,
};
diff --git a/gst-libs/ext/libav/libavfilter/vf_hqdn3d.c b/gst-libs/ext/libav/libavfilter/vf_hqdn3d.c
index 2e9a895..e2d90d5 100644
--- a/gst-libs/ext/libav/libavfilter/vf_hqdn3d.c
+++ b/gst-libs/ext/libav/libavfilter/vf_hqdn3d.c
@@ -1,6 +1,7 @@
/*
* Copyright (c) 2003 Daniel Moreno <comac AT comac DOT darktech DOT org>
* Copyright (c) 2010 Baptiste Coudurier
+ * Copyright (c) 2012 Loren Merritt
*
* This file is part of Libav, ported from MPlayer.
*
@@ -25,230 +26,225 @@
* libmpcodecs/vf_hqdn3d.c.
*/
+#include "libavutil/common.h"
#include "libavutil/pixdesc.h"
+#include "libavutil/intreadwrite.h"
#include "avfilter.h"
+#include "formats.h"
+#include "internal.h"
+#include "video.h"
typedef struct {
- int Coefs[4][512*16];
- unsigned int *Line;
- unsigned short *Frame[3];
+ int16_t *coefs[4];
+ uint16_t *line;
+ uint16_t *frame_prev[3];
+ double strength[4];
int hsub, vsub;
+ int depth;
+ void (*denoise_row[17])(uint8_t *src, uint8_t *dst, uint16_t *line_ant, uint16_t *frame_ant, ptrdiff_t w, int16_t *spatial, int16_t *temporal);
} HQDN3DContext;
-static inline unsigned int LowPassMul(unsigned int PrevMul, unsigned int CurrMul, int *Coef)
-{
- // int dMul= (PrevMul&0xFFFFFF)-(CurrMul&0xFFFFFF);
- int dMul= PrevMul-CurrMul;
- unsigned int d=((dMul+0x10007FF)>>12);
- return CurrMul + Coef[d];
-}
+void ff_hqdn3d_row_8_x86(uint8_t *src, uint8_t *dst, uint16_t *line_ant, uint16_t *frame_ant, ptrdiff_t w, int16_t *spatial, int16_t *temporal);
+void ff_hqdn3d_row_9_x86(uint8_t *src, uint8_t *dst, uint16_t *line_ant, uint16_t *frame_ant, ptrdiff_t w, int16_t *spatial, int16_t *temporal);
+void ff_hqdn3d_row_10_x86(uint8_t *src, uint8_t *dst, uint16_t *line_ant, uint16_t *frame_ant, ptrdiff_t w, int16_t *spatial, int16_t *temporal);
+void ff_hqdn3d_row_16_x86(uint8_t *src, uint8_t *dst, uint16_t *line_ant, uint16_t *frame_ant, ptrdiff_t w, int16_t *spatial, int16_t *temporal);
+
+#define LUT_BITS (depth==16 ? 8 : 4)
+#define LOAD(x) (((depth == 8 ? src[x] : AV_RN16A(src + (x) * 2)) << (16 - depth))\
+ + (((1 << (16 - depth)) - 1) >> 1))
+#define STORE(x,val) (depth == 8 ? dst[x] = (val) >> (16 - depth) : \
+ AV_WN16A(dst + (x) * 2, (val) >> (16 - depth)))
-static void deNoiseTemporal(unsigned char *FrameSrc,
- unsigned char *FrameDest,
- unsigned short *FrameAnt,
- int W, int H, int sStride, int dStride,
- int *Temporal)
+av_always_inline
+static uint32_t lowpass(int prev, int cur, int16_t *coef, int depth)
{
- long X, Y;
- unsigned int PixelDst;
-
- for (Y = 0; Y < H; Y++) {
- for (X = 0; X < W; X++) {
- PixelDst = LowPassMul(FrameAnt[X]<<8, FrameSrc[X]<<16, Temporal);
- FrameAnt[X] = ((PixelDst+0x1000007F)>>8);
- FrameDest[X]= ((PixelDst+0x10007FFF)>>16);
- }
- FrameSrc += sStride;
- FrameDest += dStride;
- FrameAnt += W;
- }
+ int d = (prev - cur) >> (8 - LUT_BITS);
+ return cur + coef[d];
}
-static void deNoiseSpacial(unsigned char *Frame,
- unsigned char *FrameDest,
- unsigned int *LineAnt,
- int W, int H, int sStride, int dStride,
- int *Horizontal, int *Vertical)
+av_always_inline
+static void denoise_temporal(uint8_t *src, uint8_t *dst,
+ uint16_t *frame_ant,
+ int w, int h, int sstride, int dstride,
+ int16_t *temporal, int depth)
{
- long X, Y;
- long sLineOffs = 0, dLineOffs = 0;
- unsigned int PixelAnt;
- unsigned int PixelDst;
-
- /* First pixel has no left nor top neighbor. */
- PixelDst = LineAnt[0] = PixelAnt = Frame[0]<<16;
- FrameDest[0]= ((PixelDst+0x10007FFF)>>16);
-
- /* First line has no top neighbor, only left. */
- for (X = 1; X < W; X++) {
- PixelDst = LineAnt[X] = LowPassMul(PixelAnt, Frame[X]<<16, Horizontal);
- FrameDest[X]= ((PixelDst+0x10007FFF)>>16);
- }
+ long x, y;
+ uint32_t tmp;
+
+ temporal += 256 << LUT_BITS;
- for (Y = 1; Y < H; Y++) {
- unsigned int PixelAnt;
- sLineOffs += sStride, dLineOffs += dStride;
- /* First pixel on each line doesn't have previous pixel */
- PixelAnt = Frame[sLineOffs]<<16;
- PixelDst = LineAnt[0] = LowPassMul(LineAnt[0], PixelAnt, Vertical);
- FrameDest[dLineOffs]= ((PixelDst+0x10007FFF)>>16);
-
- for (X = 1; X < W; X++) {
- unsigned int PixelDst;
- /* The rest are normal */
- PixelAnt = LowPassMul(PixelAnt, Frame[sLineOffs+X]<<16, Horizontal);
- PixelDst = LineAnt[X] = LowPassMul(LineAnt[X], PixelAnt, Vertical);
- FrameDest[dLineOffs+X]= ((PixelDst+0x10007FFF)>>16);
+ for (y = 0; y < h; y++) {
+ for (x = 0; x < w; x++) {
+ frame_ant[x] = tmp = lowpass(frame_ant[x], LOAD(x), temporal, depth);
+ STORE(x, tmp);
}
+ src += sstride;
+ dst += dstride;
+ frame_ant += w;
}
}
-static void deNoise(unsigned char *Frame,
- unsigned char *FrameDest,
- unsigned int *LineAnt,
- unsigned short **FrameAntPtr,
- int W, int H, int sStride, int dStride,
- int *Horizontal, int *Vertical, int *Temporal)
+av_always_inline
+static void denoise_spatial(HQDN3DContext *hqdn3d,
+ uint8_t *src, uint8_t *dst,
+ uint16_t *line_ant, uint16_t *frame_ant,
+ int w, int h, int sstride, int dstride,
+ int16_t *spatial, int16_t *temporal, int depth)
{
- long X, Y;
- long sLineOffs = 0, dLineOffs = 0;
- unsigned int PixelAnt;
- unsigned int PixelDst;
- unsigned short* FrameAnt=(*FrameAntPtr);
-
- if (!FrameAnt) {
- (*FrameAntPtr) = FrameAnt = av_malloc(W*H*sizeof(unsigned short));
- for (Y = 0; Y < H; Y++) {
- unsigned short* dst=&FrameAnt[Y*W];
- unsigned char* src=Frame+Y*sStride;
- for (X = 0; X < W; X++) dst[X]=src[X]<<8;
- }
- }
+ long x, y;
+ uint32_t pixel_ant;
+ uint32_t tmp;
- if (!Horizontal[0] && !Vertical[0]) {
- deNoiseTemporal(Frame, FrameDest, FrameAnt,
- W, H, sStride, dStride, Temporal);
- return;
- }
- if (!Temporal[0]) {
- deNoiseSpacial(Frame, FrameDest, LineAnt,
- W, H, sStride, dStride, Horizontal, Vertical);
- return;
- }
-
- /* First pixel has no left nor top neighbor. Only previous frame */
- LineAnt[0] = PixelAnt = Frame[0]<<16;
- PixelDst = LowPassMul(FrameAnt[0]<<8, PixelAnt, Temporal);
- FrameAnt[0] = ((PixelDst+0x1000007F)>>8);
- FrameDest[0]= ((PixelDst+0x10007FFF)>>16);
+ spatial += 256 << LUT_BITS;
+ temporal += 256 << LUT_BITS;
- /* First line has no top neighbor. Only left one for each pixel and
+ /* First line has no top neighbor. Only left one for each tmp and
* last frame */
- for (X = 1; X < W; X++) {
- LineAnt[X] = PixelAnt = LowPassMul(PixelAnt, Frame[X]<<16, Horizontal);
- PixelDst = LowPassMul(FrameAnt[X]<<8, PixelAnt, Temporal);
- FrameAnt[X] = ((PixelDst+0x1000007F)>>8);
- FrameDest[X]= ((PixelDst+0x10007FFF)>>16);
+ pixel_ant = LOAD(0);
+ for (x = 0; x < w; x++) {
+ line_ant[x] = tmp = pixel_ant = lowpass(pixel_ant, LOAD(x), spatial, depth);
+ frame_ant[x] = tmp = lowpass(frame_ant[x], tmp, temporal, depth);
+ STORE(x, tmp);
}
- for (Y = 1; Y < H; Y++) {
- unsigned int PixelAnt;
- unsigned short* LinePrev=&FrameAnt[Y*W];
- sLineOffs += sStride, dLineOffs += dStride;
- /* First pixel on each line doesn't have previous pixel */
- PixelAnt = Frame[sLineOffs]<<16;
- LineAnt[0] = LowPassMul(LineAnt[0], PixelAnt, Vertical);
- PixelDst = LowPassMul(LinePrev[0]<<8, LineAnt[0], Temporal);
- LinePrev[0] = ((PixelDst+0x1000007F)>>8);
- FrameDest[dLineOffs]= ((PixelDst+0x10007FFF)>>16);
-
- for (X = 1; X < W; X++) {
- unsigned int PixelDst;
- /* The rest are normal */
- PixelAnt = LowPassMul(PixelAnt, Frame[sLineOffs+X]<<16, Horizontal);
- LineAnt[X] = LowPassMul(LineAnt[X], PixelAnt, Vertical);
- PixelDst = LowPassMul(LinePrev[X]<<8, LineAnt[X], Temporal);
- LinePrev[X] = ((PixelDst+0x1000007F)>>8);
- FrameDest[dLineOffs+X]= ((PixelDst+0x10007FFF)>>16);
+ for (y = 1; y < h; y++) {
+ src += sstride;
+ dst += dstride;
+ frame_ant += w;
+ if (hqdn3d->denoise_row[depth]) {
+ hqdn3d->denoise_row[depth](src, dst, line_ant, frame_ant, w, spatial, temporal);
+ continue;
+ }
+ pixel_ant = LOAD(0);
+ for (x = 0; x < w-1; x++) {
+ line_ant[x] = tmp = lowpass(line_ant[x], pixel_ant, spatial, depth);
+ pixel_ant = lowpass(pixel_ant, LOAD(x+1), spatial, depth);
+ frame_ant[x] = tmp = lowpass(frame_ant[x], tmp, temporal, depth);
+ STORE(x, tmp);
}
+ line_ant[x] = tmp = lowpass(line_ant[x], pixel_ant, spatial, depth);
+ frame_ant[x] = tmp = lowpass(frame_ant[x], tmp, temporal, depth);
+ STORE(x, tmp);
}
}
-static void PrecalcCoefs(int *Ct, double Dist25)
+av_always_inline
+static void denoise_depth(HQDN3DContext *hqdn3d,
+ uint8_t *src, uint8_t *dst,
+ uint16_t *line_ant, uint16_t **frame_ant_ptr,
+ int w, int h, int sstride, int dstride,
+ int16_t *spatial, int16_t *temporal, int depth)
{
- int i;
- double Gamma, Simil, C;
+ // FIXME: For 16bit depth, frame_ant could be a pointer to the previous
+ // filtered frame rather than a separate buffer.
+ long x, y;
+ uint16_t *frame_ant = *frame_ant_ptr;
+ if (!frame_ant) {
+ uint8_t *frame_src = src;
+ *frame_ant_ptr = frame_ant = av_malloc(w*h*sizeof(uint16_t));
+ for (y = 0; y < h; y++, src += sstride, frame_ant += w)
+ for (x = 0; x < w; x++)
+ frame_ant[x] = LOAD(x);
+ src = frame_src;
+ frame_ant = *frame_ant_ptr;
+ }
- Gamma = log(0.25) / log(1.0 - Dist25/255.0 - 0.00001);
+ if (spatial[0])
+ denoise_spatial(hqdn3d, src, dst, line_ant, frame_ant,
+ w, h, sstride, dstride, spatial, temporal, depth);
+ else
+ denoise_temporal(src, dst, frame_ant,
+ w, h, sstride, dstride, temporal, depth);
+}
+
+#define denoise(...) \
+ switch (hqdn3d->depth) {\
+ case 8: denoise_depth(__VA_ARGS__, 8); break;\
+ case 9: denoise_depth(__VA_ARGS__, 9); break;\
+ case 10: denoise_depth(__VA_ARGS__, 10); break;\
+ case 16: denoise_depth(__VA_ARGS__, 16); break;\
+ }
- for (i = -255*16; i <= 255*16; i++) {
- Simil = 1.0 - FFABS(i) / (16*255.0);
- C = pow(Simil, Gamma) * 65536.0 * i / 16.0;
- Ct[16*256+i] = lrint(C);
+static int16_t *precalc_coefs(double dist25, int depth)
+{
+ int i;
+ double gamma, simil, C;
+ int16_t *ct = av_malloc((512<<LUT_BITS)*sizeof(int16_t));
+ if (!ct)
+ return NULL;
+
+ gamma = log(0.25) / log(1.0 - FFMIN(dist25,252.0)/255.0 - 0.00001);
+
+ for (i = -255<<LUT_BITS; i <= 255<<LUT_BITS; i++) {
+ double f = ((i<<(9-LUT_BITS)) + (1<<(8-LUT_BITS)) - 1) / 512.0; // midpoint of the bin
+ simil = 1.0 - FFABS(f) / 255.0;
+ C = pow(simil, gamma) * 256.0 * f;
+ ct[(256<<LUT_BITS)+i] = lrint(C);
}
- Ct[0] = !!Dist25;
+ ct[0] = !!dist25;
+ return ct;
}
#define PARAM1_DEFAULT 4.0
#define PARAM2_DEFAULT 3.0
#define PARAM3_DEFAULT 6.0
-static int init(AVFilterContext *ctx, const char *args, void *opaque)
+static int init(AVFilterContext *ctx, const char *args)
{
HQDN3DContext *hqdn3d = ctx->priv;
- double LumSpac, LumTmp, ChromSpac, ChromTmp;
- double Param1, Param2, Param3, Param4;
+ double lum_spac, lum_tmp, chrom_spac, chrom_tmp;
+ double param1, param2, param3, param4;
- LumSpac = PARAM1_DEFAULT;
- ChromSpac = PARAM2_DEFAULT;
- LumTmp = PARAM3_DEFAULT;
- ChromTmp = LumTmp * ChromSpac / LumSpac;
+ lum_spac = PARAM1_DEFAULT;
+ chrom_spac = PARAM2_DEFAULT;
+ lum_tmp = PARAM3_DEFAULT;
+ chrom_tmp = lum_tmp * chrom_spac / lum_spac;
if (args) {
switch (sscanf(args, "%lf:%lf:%lf:%lf",
- &Param1, &Param2, &Param3, &Param4)) {
+ &param1, &param2, &param3, &param4)) {
case 1:
- LumSpac = Param1;
- ChromSpac = PARAM2_DEFAULT * Param1 / PARAM1_DEFAULT;
- LumTmp = PARAM3_DEFAULT * Param1 / PARAM1_DEFAULT;
- ChromTmp = LumTmp * ChromSpac / LumSpac;
+ lum_spac = param1;
+ chrom_spac = PARAM2_DEFAULT * param1 / PARAM1_DEFAULT;
+ lum_tmp = PARAM3_DEFAULT * param1 / PARAM1_DEFAULT;
+ chrom_tmp = lum_tmp * chrom_spac / lum_spac;
break;
case 2:
- LumSpac = Param1;
- ChromSpac = Param2;
- LumTmp = PARAM3_DEFAULT * Param1 / PARAM1_DEFAULT;
- ChromTmp = LumTmp * ChromSpac / LumSpac;
+ lum_spac = param1;
+ chrom_spac = param2;
+ lum_tmp = PARAM3_DEFAULT * param1 / PARAM1_DEFAULT;
+ chrom_tmp = lum_tmp * chrom_spac / lum_spac;
break;
case 3:
- LumSpac = Param1;
- ChromSpac = Param2;
- LumTmp = Param3;
- ChromTmp = LumTmp * ChromSpac / LumSpac;
+ lum_spac = param1;
+ chrom_spac = param2;
+ lum_tmp = param3;
+ chrom_tmp = lum_tmp * chrom_spac / lum_spac;
break;
case 4:
- LumSpac = Param1;
- ChromSpac = Param2;
- LumTmp = Param3;
- ChromTmp = Param4;
+ lum_spac = param1;
+ chrom_spac = param2;
+ lum_tmp = param3;
+ chrom_tmp = param4;
break;
}
}
- av_log(ctx, AV_LOG_INFO, "ls:%lf cs:%lf lt:%lf ct:%lf\n",
- LumSpac, ChromSpac, LumTmp, ChromTmp);
- if (LumSpac < 0 || ChromSpac < 0 || isnan(ChromTmp)) {
+ hqdn3d->strength[0] = lum_spac;
+ hqdn3d->strength[1] = lum_tmp;
+ hqdn3d->strength[2] = chrom_spac;
+ hqdn3d->strength[3] = chrom_tmp;
+
+ av_log(ctx, AV_LOG_VERBOSE, "ls:%f cs:%f lt:%f ct:%f\n",
+ lum_spac, chrom_spac, lum_tmp, chrom_tmp);
+ if (lum_spac < 0 || chrom_spac < 0 || isnan(chrom_tmp)) {
av_log(ctx, AV_LOG_ERROR,
"Invalid negative value for luma or chroma spatial strength, "
"or resulting value for chroma temporal strength is nan.\n");
return AVERROR(EINVAL);
}
- PrecalcCoefs(hqdn3d->Coefs[0], LumSpac);
- PrecalcCoefs(hqdn3d->Coefs[1], LumTmp);
- PrecalcCoefs(hqdn3d->Coefs[2], ChromSpac);
- PrecalcCoefs(hqdn3d->Coefs[3], ChromTmp);
-
return 0;
}
@@ -256,19 +252,42 @@ static void uninit(AVFilterContext *ctx)
{
HQDN3DContext *hqdn3d = ctx->priv;
- av_freep(&hqdn3d->Line);
- av_freep(&hqdn3d->Frame[0]);
- av_freep(&hqdn3d->Frame[1]);
- av_freep(&hqdn3d->Frame[2]);
+ av_freep(&hqdn3d->coefs[0]);
+ av_freep(&hqdn3d->coefs[1]);
+ av_freep(&hqdn3d->coefs[2]);
+ av_freep(&hqdn3d->coefs[3]);
+ av_freep(&hqdn3d->line);
+ av_freep(&hqdn3d->frame_prev[0]);
+ av_freep(&hqdn3d->frame_prev[1]);
+ av_freep(&hqdn3d->frame_prev[2]);
}
static int query_formats(AVFilterContext *ctx)
{
- static const enum PixelFormat pix_fmts[] = {
- PIX_FMT_YUV420P, PIX_FMT_YUV422P, PIX_FMT_YUV411P, PIX_FMT_NONE
+ static const enum AVPixelFormat pix_fmts[] = {
+ AV_PIX_FMT_YUV420P,
+ AV_PIX_FMT_YUV422P,
+ AV_PIX_FMT_YUV444P,
+ AV_PIX_FMT_YUV410P,
+ AV_PIX_FMT_YUV411P,
+ AV_PIX_FMT_YUV440P,
+ AV_PIX_FMT_YUVJ420P,
+ AV_PIX_FMT_YUVJ422P,
+ AV_PIX_FMT_YUVJ444P,
+ AV_PIX_FMT_YUVJ440P,
+ AV_NE( AV_PIX_FMT_YUV420P9BE, AV_PIX_FMT_YUV420P9LE ),
+ AV_NE( AV_PIX_FMT_YUV422P9BE, AV_PIX_FMT_YUV422P9LE ),
+ AV_NE( AV_PIX_FMT_YUV444P9BE, AV_PIX_FMT_YUV444P9LE ),
+ AV_NE( AV_PIX_FMT_YUV420P10BE, AV_PIX_FMT_YUV420P10LE ),
+ AV_NE( AV_PIX_FMT_YUV422P10BE, AV_PIX_FMT_YUV422P10LE ),
+ AV_NE( AV_PIX_FMT_YUV444P10BE, AV_PIX_FMT_YUV444P10LE ),
+ AV_NE( AV_PIX_FMT_YUV420P16BE, AV_PIX_FMT_YUV420P16LE ),
+ AV_NE( AV_PIX_FMT_YUV422P16BE, AV_PIX_FMT_YUV422P16LE ),
+ AV_NE( AV_PIX_FMT_YUV444P16BE, AV_PIX_FMT_YUV444P16LE ),
+ AV_PIX_FMT_NONE
};
- avfilter_set_common_formats(ctx, avfilter_make_format_list(pix_fmts));
+ ff_set_common_formats(ctx, ff_make_format_list(pix_fmts));
return 0;
}
@@ -276,53 +295,89 @@ static int query_formats(AVFilterContext *ctx)
static int config_input(AVFilterLink *inlink)
{
HQDN3DContext *hqdn3d = inlink->dst->priv;
+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format);
+ int i;
- hqdn3d->hsub = av_pix_fmt_descriptors[inlink->format].log2_chroma_w;
- hqdn3d->vsub = av_pix_fmt_descriptors[inlink->format].log2_chroma_h;
+ hqdn3d->hsub = desc->log2_chroma_w;
+ hqdn3d->vsub = desc->log2_chroma_h;
+ hqdn3d->depth = desc->comp[0].depth_minus1+1;
- hqdn3d->Line = av_malloc(inlink->w * sizeof(*hqdn3d->Line));
- if (!hqdn3d->Line)
+ hqdn3d->line = av_malloc(inlink->w * sizeof(*hqdn3d->line));
+ if (!hqdn3d->line)
return AVERROR(ENOMEM);
+ for (i = 0; i < 4; i++) {
+ hqdn3d->coefs[i] = precalc_coefs(hqdn3d->strength[i], hqdn3d->depth);
+ if (!hqdn3d->coefs[i])
+ return AVERROR(ENOMEM);
+ }
+
+#if HAVE_YASM
+ hqdn3d->denoise_row[ 8] = ff_hqdn3d_row_8_x86;
+ hqdn3d->denoise_row[ 9] = ff_hqdn3d_row_9_x86;
+ hqdn3d->denoise_row[10] = ff_hqdn3d_row_10_x86;
+ hqdn3d->denoise_row[16] = ff_hqdn3d_row_16_x86;
+#endif
+
return 0;
}
-static void null_draw_slice(AVFilterLink *link, int y, int h, int slice_dir) { }
-
-static void end_frame(AVFilterLink *inlink)
+static int filter_frame(AVFilterLink *inlink, AVFilterBufferRef *in)
{
HQDN3DContext *hqdn3d = inlink->dst->priv;
AVFilterLink *outlink = inlink->dst->outputs[0];
- AVFilterBufferRef *inpic = inlink ->cur_buf;
- AVFilterBufferRef *outpic = outlink->out_buf;
- int cw = inpic->video->w >> hqdn3d->hsub;
- int ch = inpic->video->h >> hqdn3d->vsub;
-
- deNoise(inpic->data[0], outpic->data[0],
- hqdn3d->Line, &hqdn3d->Frame[0], inpic->video->w, inpic->video->h,
- inpic->linesize[0], outpic->linesize[0],
- hqdn3d->Coefs[0],
- hqdn3d->Coefs[0],
- hqdn3d->Coefs[1]);
- deNoise(inpic->data[1], outpic->data[1],
- hqdn3d->Line, &hqdn3d->Frame[1], cw, ch,
- inpic->linesize[1], outpic->linesize[1],
- hqdn3d->Coefs[2],
- hqdn3d->Coefs[2],
- hqdn3d->Coefs[3]);
- deNoise(inpic->data[2], outpic->data[2],
- hqdn3d->Line, &hqdn3d->Frame[2], cw, ch,
- inpic->linesize[2], outpic->linesize[2],
- hqdn3d->Coefs[2],
- hqdn3d->Coefs[2],
- hqdn3d->Coefs[3]);
-
- avfilter_draw_slice(outlink, 0, inpic->video->h, 1);
- avfilter_end_frame(outlink);
- avfilter_unref_buffer(inpic);
- avfilter_unref_buffer(outpic);
+ AVFilterBufferRef *out;
+ int direct, c;
+
+ if ((in->perms & AV_PERM_WRITE) && !(in->perms & AV_PERM_PRESERVE)) {
+ direct = 1;
+ out = in;
+ } else {
+ direct = 0;
+ out = ff_get_video_buffer(outlink, AV_PERM_WRITE, outlink->w, outlink->h);
+ if (!out) {
+ avfilter_unref_bufferp(&in);
+ return AVERROR(ENOMEM);
+ }
+
+ avfilter_copy_buffer_ref_props(out, in);
+ out->video->w = outlink->w;
+ out->video->h = outlink->h;
+ }
+
+ for (c = 0; c < 3; c++) {
+ denoise(hqdn3d, in->data[c], out->data[c],
+ hqdn3d->line, &hqdn3d->frame_prev[c],
+ in->video->w >> (!!c * hqdn3d->hsub),
+ in->video->h >> (!!c * hqdn3d->vsub),
+ in->linesize[c], out->linesize[c],
+ hqdn3d->coefs[c?2:0], hqdn3d->coefs[c?3:1]);
+ }
+
+ if (!direct)
+ avfilter_unref_bufferp(&in);
+
+ return ff_filter_frame(outlink, out);
}
+static const AVFilterPad avfilter_vf_hqdn3d_inputs[] = {
+ {
+ .name = "default",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .config_props = config_input,
+ .filter_frame = filter_frame,
+ },
+ { NULL }
+};
+
+static const AVFilterPad avfilter_vf_hqdn3d_outputs[] = {
+ {
+ .name = "default",
+ .type = AVMEDIA_TYPE_VIDEO
+ },
+ { NULL }
+};
+
AVFilter avfilter_vf_hqdn3d = {
.name = "hqdn3d",
.description = NULL_IF_CONFIG_SMALL("Apply a High Quality 3D Denoiser."),
@@ -332,14 +387,7 @@ AVFilter avfilter_vf_hqdn3d = {
.uninit = uninit,
.query_formats = query_formats,
- .inputs = (AVFilterPad[]) {{ .name = "default",
- .type = AVMEDIA_TYPE_VIDEO,
- .draw_slice = null_draw_slice,
- .config_props = config_input,
- .end_frame = end_frame },
- { .name = NULL}},
+ .inputs = avfilter_vf_hqdn3d_inputs,
- .outputs = (AVFilterPad[]) {{ .name = "default",
- .type = AVMEDIA_TYPE_VIDEO },
- { .name = NULL}},
+ .outputs = avfilter_vf_hqdn3d_outputs,
};
diff --git a/gst-libs/ext/libav/libavfilter/vf_libopencv.c b/gst-libs/ext/libav/libavfilter/vf_libopencv.c
index 6e343af..e558a4a 100644
--- a/gst-libs/ext/libav/libavfilter/vf_libopencv.c
+++ b/gst-libs/ext/libav/libavfilter/vf_libopencv.c
@@ -28,17 +28,21 @@
#include <opencv/cv.h>
#include <opencv/cxcore.h>
#include "libavutil/avstring.h"
+#include "libavutil/common.h"
#include "libavutil/file.h"
#include "avfilter.h"
+#include "formats.h"
+#include "internal.h"
+#include "video.h"
-static void fill_iplimage_from_picref(IplImage *img, const AVFilterBufferRef *picref, enum PixelFormat pixfmt)
+static void fill_iplimage_from_picref(IplImage *img, const AVFilterBufferRef *picref, enum AVPixelFormat pixfmt)
{
IplImage *tmpimg;
int depth, channels_nb;
- if (pixfmt == PIX_FMT_GRAY8) { depth = IPL_DEPTH_8U; channels_nb = 1; }
- else if (pixfmt == PIX_FMT_BGRA) { depth = IPL_DEPTH_8U; channels_nb = 4; }
- else if (pixfmt == PIX_FMT_BGR24) { depth = IPL_DEPTH_8U; channels_nb = 3; }
+ if (pixfmt == AV_PIX_FMT_GRAY8) { depth = IPL_DEPTH_8U; channels_nb = 1; }
+ else if (pixfmt == AV_PIX_FMT_BGRA) { depth = IPL_DEPTH_8U; channels_nb = 4; }
+ else if (pixfmt == AV_PIX_FMT_BGR24) { depth = IPL_DEPTH_8U; channels_nb = 3; }
else return;
tmpimg = cvCreateImageHeader((CvSize){picref->video->w, picref->video->h}, depth, channels_nb);
@@ -49,7 +53,7 @@ static void fill_iplimage_from_picref(IplImage *img, const AVFilterBufferRef *pi
img->widthStep = picref->linesize[0];
}
-static void fill_picref_from_iplimage(AVFilterBufferRef *picref, const IplImage *img, enum PixelFormat pixfmt)
+static void fill_picref_from_iplimage(AVFilterBufferRef *picref, const IplImage *img, enum AVPixelFormat pixfmt)
{
picref->linesize[0] = img->widthStep;
picref->data[0] = img->imageData;
@@ -57,19 +61,17 @@ static void fill_picref_from_iplimage(AVFilterBufferRef *picref, const IplImage
static int query_formats(AVFilterContext *ctx)
{
- static const enum PixelFormat pix_fmts[] = {
- PIX_FMT_BGR24, PIX_FMT_BGRA, PIX_FMT_GRAY8, PIX_FMT_NONE
+ static const enum AVPixelFormat pix_fmts[] = {
+ AV_PIX_FMT_BGR24, AV_PIX_FMT_BGRA, AV_PIX_FMT_GRAY8, AV_PIX_FMT_NONE
};
- avfilter_set_common_formats(ctx, avfilter_make_format_list(pix_fmts));
+ ff_set_common_formats(ctx, ff_make_format_list(pix_fmts));
return 0;
}
-static void null_draw_slice(AVFilterLink *link, int y, int h, int slice_dir) { }
-
typedef struct {
const char *name;
- int (*init)(AVFilterContext *ctx, const char *args, void *opaque);
+ int (*init)(AVFilterContext *ctx, const char *args);
void (*uninit)(AVFilterContext *ctx);
void (*end_frame_filter)(AVFilterContext *ctx, IplImage *inimg, IplImage *outimg);
void *priv;
@@ -81,7 +83,7 @@ typedef struct {
double param3, param4;
} SmoothContext;
-static av_cold int smooth_init(AVFilterContext *ctx, const char *args, void *opaque)
+static av_cold int smooth_init(AVFilterContext *ctx, const char *args)
{
OCVContext *ocv = ctx->priv;
SmoothContext *smooth = ocv->priv;
@@ -101,7 +103,7 @@ static av_cold int smooth_init(AVFilterContext *ctx, const char *args, void *opa
else if (!strcmp(type_str, "gaussian" )) smooth->type = CV_GAUSSIAN;
else if (!strcmp(type_str, "bilateral" )) smooth->type = CV_BILATERAL;
else {
- av_log(ctx, AV_LOG_ERROR, "Smoothing type '%s' unknown\n.", type_str);
+ av_log(ctx, AV_LOG_ERROR, "Smoothing type '%s' unknown.\n", type_str);
return AVERROR(EINVAL);
}
@@ -119,7 +121,7 @@ static av_cold int smooth_init(AVFilterContext *ctx, const char *args, void *opa
return AVERROR(EINVAL);
}
- av_log(ctx, AV_LOG_INFO, "type:%s param1:%d param2:%d param3:%f param4:%f\n",
+ av_log(ctx, AV_LOG_VERBOSE, "type:%s param1:%d param2:%d param3:%f param4:%f\n",
type_str, smooth->param1, smooth->param2, smooth->param3, smooth->param4);
return 0;
}
@@ -215,7 +217,7 @@ static int parse_iplconvkernel(IplConvKernel **kernel, char *buf, void *log_ctx)
return ret;
} else {
av_log(log_ctx, AV_LOG_ERROR,
- "Shape unspecified or type '%s' unknown\n.", shape_str);
+ "Shape unspecified or type '%s' unknown.\n", shape_str);
return AVERROR(EINVAL);
}
@@ -237,7 +239,7 @@ static int parse_iplconvkernel(IplConvKernel **kernel, char *buf, void *log_ctx)
if (!*kernel)
return AVERROR(ENOMEM);
- av_log(log_ctx, AV_LOG_INFO, "Structuring element: w:%d h:%d x:%d y:%d shape:%s\n",
+ av_log(log_ctx, AV_LOG_VERBOSE, "Structuring element: w:%d h:%d x:%d y:%d shape:%s\n",
rows, cols, anchor_x, anchor_y, shape_str);
return 0;
}
@@ -247,7 +249,7 @@ typedef struct {
IplConvKernel *kernel;
} DilateContext;
-static av_cold int dilate_init(AVFilterContext *ctx, const char *args, void *opaque)
+static av_cold int dilate_init(AVFilterContext *ctx, const char *args)
{
OCVContext *ocv = ctx->priv;
DilateContext *dilate = ocv->priv;
@@ -267,7 +269,7 @@ static av_cold int dilate_init(AVFilterContext *ctx, const char *args, void *opa
av_free(kernel_str);
sscanf(buf, ":%d", &dilate->nb_iterations);
- av_log(ctx, AV_LOG_INFO, "iterations_nb:%d\n", dilate->nb_iterations);
+ av_log(ctx, AV_LOG_VERBOSE, "iterations_nb:%d\n", dilate->nb_iterations);
if (dilate->nb_iterations <= 0) {
av_log(ctx, AV_LOG_ERROR, "Invalid non-positive value '%d' for nb_iterations\n",
dilate->nb_iterations);
@@ -301,7 +303,7 @@ static void erode_end_frame_filter(AVFilterContext *ctx, IplImage *inimg, IplIma
typedef struct {
const char *name;
size_t priv_size;
- int (*init)(AVFilterContext *ctx, const char *args, void *opaque);
+ int (*init)(AVFilterContext *ctx, const char *args);
void (*uninit)(AVFilterContext *ctx);
void (*end_frame_filter)(AVFilterContext *ctx, IplImage *inimg, IplImage *outimg);
} OCVFilterEntry;
@@ -312,7 +314,7 @@ static OCVFilterEntry ocv_filter_entries[] = {
{ "smooth", sizeof(SmoothContext), smooth_init, NULL, smooth_end_frame_filter },
};
-static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
+static av_cold int init(AVFilterContext *ctx, const char *args)
{
OCVContext *ocv = ctx->priv;
char name[128], priv_args[1024];
@@ -331,7 +333,7 @@ static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
if (!(ocv->priv = av_mallocz(entry->priv_size)))
return AVERROR(ENOMEM);
- return ocv->init(ctx, priv_args, opaque);
+ return ocv->init(ctx, priv_args);
}
}
@@ -349,26 +351,49 @@ static av_cold void uninit(AVFilterContext *ctx)
memset(ocv, 0, sizeof(*ocv));
}
-static void end_frame(AVFilterLink *inlink)
+static int filter_frame(AVFilterLink *inlink, AVFilterBufferRef *in)
{
AVFilterContext *ctx = inlink->dst;
OCVContext *ocv = ctx->priv;
AVFilterLink *outlink= inlink->dst->outputs[0];
- AVFilterBufferRef *inpicref = inlink ->cur_buf;
- AVFilterBufferRef *outpicref = outlink->out_buf;
+ AVFilterBufferRef *out;
IplImage inimg, outimg;
- fill_iplimage_from_picref(&inimg , inpicref , inlink->format);
- fill_iplimage_from_picref(&outimg, outpicref, inlink->format);
+ out = ff_get_video_buffer(outlink, AV_PERM_WRITE, outlink->w, outlink->h);
+ if (!out) {
+ avfilter_unref_bufferp(&in);
+ return AVERROR(ENOMEM);
+ }
+ avfilter_copy_buffer_ref_props(out, in);
+
+ fill_iplimage_from_picref(&inimg , in , inlink->format);
+ fill_iplimage_from_picref(&outimg, out, inlink->format);
ocv->end_frame_filter(ctx, &inimg, &outimg);
- fill_picref_from_iplimage(outpicref, &outimg, inlink->format);
+ fill_picref_from_iplimage(out, &outimg, inlink->format);
+
+ avfilter_unref_bufferp(&in);
- avfilter_unref_buffer(inpicref);
- avfilter_draw_slice(outlink, 0, outlink->h, 1);
- avfilter_end_frame(outlink);
- avfilter_unref_buffer(outpicref);
+ return ff_filter_frame(outlink, out);
}
+static const AVFilterPad avfilter_vf_ocv_inputs[] = {
+ {
+ .name = "default",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .filter_frame = filter_frame,
+ .min_perms = AV_PERM_READ
+ },
+ { NULL }
+};
+
+static const AVFilterPad avfilter_vf_ocv_outputs[] = {
+ {
+ .name = "default",
+ .type = AVMEDIA_TYPE_VIDEO,
+ },
+ { NULL }
+};
+
AVFilter avfilter_vf_ocv = {
.name = "ocv",
.description = NULL_IF_CONFIG_SMALL("Apply transform using libopencv."),
@@ -379,14 +404,7 @@ AVFilter avfilter_vf_ocv = {
.init = init,
.uninit = uninit,
- .inputs = (AVFilterPad[]) {{ .name = "default",
- .type = AVMEDIA_TYPE_VIDEO,
- .draw_slice = null_draw_slice,
- .end_frame = end_frame,
- .min_perms = AV_PERM_READ },
- { .name = NULL}},
+ .inputs = avfilter_vf_ocv_inputs,
- .outputs = (AVFilterPad[]) {{ .name = "default",
- .type = AVMEDIA_TYPE_VIDEO, },
- { .name = NULL}},
+ .outputs = avfilter_vf_ocv_outputs,
};
diff --git a/gst-libs/ext/libav/libavfilter/vf_lut.c b/gst-libs/ext/libav/libavfilter/vf_lut.c
index 7f3e913..f265795 100644
--- a/gst-libs/ext/libav/libavfilter/vf_lut.c
+++ b/gst-libs/ext/libav/libavfilter/vf_lut.c
@@ -24,14 +24,17 @@
* value, and apply it to input video.
*/
+#include "libavutil/common.h"
#include "libavutil/eval.h"
#include "libavutil/mathematics.h"
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
#include "avfilter.h"
+#include "formats.h"
#include "internal.h"
+#include "video.h"
-static const char *var_names[] = {
+static const char *const var_names[] = {
"E",
"PHI",
"PI",
@@ -83,17 +86,17 @@ typedef struct {
#define OFFSET(x) offsetof(LutContext, x)
static const AVOption lut_options[] = {
- {"c0", "set component #0 expression", OFFSET(comp_expr_str[0]), FF_OPT_TYPE_STRING, {.str="val"}, CHAR_MIN, CHAR_MAX},
- {"c1", "set component #1 expression", OFFSET(comp_expr_str[1]), FF_OPT_TYPE_STRING, {.str="val"}, CHAR_MIN, CHAR_MAX},
- {"c2", "set component #2 expression", OFFSET(comp_expr_str[2]), FF_OPT_TYPE_STRING, {.str="val"}, CHAR_MIN, CHAR_MAX},
- {"c3", "set component #3 expression", OFFSET(comp_expr_str[3]), FF_OPT_TYPE_STRING, {.str="val"}, CHAR_MIN, CHAR_MAX},
- {"y", "set Y expression", OFFSET(comp_expr_str[Y]), FF_OPT_TYPE_STRING, {.str="val"}, CHAR_MIN, CHAR_MAX},
- {"u", "set U expression", OFFSET(comp_expr_str[U]), FF_OPT_TYPE_STRING, {.str="val"}, CHAR_MIN, CHAR_MAX},
- {"v", "set V expression", OFFSET(comp_expr_str[V]), FF_OPT_TYPE_STRING, {.str="val"}, CHAR_MIN, CHAR_MAX},
- {"r", "set R expression", OFFSET(comp_expr_str[R]), FF_OPT_TYPE_STRING, {.str="val"}, CHAR_MIN, CHAR_MAX},
- {"g", "set G expression", OFFSET(comp_expr_str[G]), FF_OPT_TYPE_STRING, {.str="val"}, CHAR_MIN, CHAR_MAX},
- {"b", "set B expression", OFFSET(comp_expr_str[B]), FF_OPT_TYPE_STRING, {.str="val"}, CHAR_MIN, CHAR_MAX},
- {"a", "set A expression", OFFSET(comp_expr_str[A]), FF_OPT_TYPE_STRING, {.str="val"}, CHAR_MIN, CHAR_MAX},
+ {"c0", "set component #0 expression", OFFSET(comp_expr_str[0]), AV_OPT_TYPE_STRING, {.str="val"}, CHAR_MIN, CHAR_MAX},
+ {"c1", "set component #1 expression", OFFSET(comp_expr_str[1]), AV_OPT_TYPE_STRING, {.str="val"}, CHAR_MIN, CHAR_MAX},
+ {"c2", "set component #2 expression", OFFSET(comp_expr_str[2]), AV_OPT_TYPE_STRING, {.str="val"}, CHAR_MIN, CHAR_MAX},
+ {"c3", "set component #3 expression", OFFSET(comp_expr_str[3]), AV_OPT_TYPE_STRING, {.str="val"}, CHAR_MIN, CHAR_MAX},
+ {"y", "set Y expression", OFFSET(comp_expr_str[Y]), AV_OPT_TYPE_STRING, {.str="val"}, CHAR_MIN, CHAR_MAX},
+ {"u", "set U expression", OFFSET(comp_expr_str[U]), AV_OPT_TYPE_STRING, {.str="val"}, CHAR_MIN, CHAR_MAX},
+ {"v", "set V expression", OFFSET(comp_expr_str[V]), AV_OPT_TYPE_STRING, {.str="val"}, CHAR_MIN, CHAR_MAX},
+ {"r", "set R expression", OFFSET(comp_expr_str[R]), AV_OPT_TYPE_STRING, {.str="val"}, CHAR_MIN, CHAR_MAX},
+ {"g", "set G expression", OFFSET(comp_expr_str[G]), AV_OPT_TYPE_STRING, {.str="val"}, CHAR_MIN, CHAR_MAX},
+ {"b", "set B expression", OFFSET(comp_expr_str[B]), AV_OPT_TYPE_STRING, {.str="val"}, CHAR_MIN, CHAR_MAX},
+ {"a", "set A expression", OFFSET(comp_expr_str[A]), AV_OPT_TYPE_STRING, {.str="val"}, CHAR_MIN, CHAR_MAX},
{NULL},
};
@@ -108,7 +111,7 @@ static const AVClass lut_class = {
lut_options
};
-static int init(AVFilterContext *ctx, const char *args, void *opaque)
+static int init(AVFilterContext *ctx, const char *args)
{
LutContext *lut = ctx->priv;
int ret;
@@ -141,29 +144,29 @@ static av_cold void uninit(AVFilterContext *ctx)
}
#define YUV_FORMATS \
- PIX_FMT_YUV444P, PIX_FMT_YUV422P, PIX_FMT_YUV420P, \
- PIX_FMT_YUV411P, PIX_FMT_YUV410P, PIX_FMT_YUV440P, \
- PIX_FMT_YUVA420P, \
- PIX_FMT_YUVJ444P, PIX_FMT_YUVJ422P, PIX_FMT_YUVJ420P, \
- PIX_FMT_YUVJ440P
+ AV_PIX_FMT_YUV444P, AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUV420P, \
+ AV_PIX_FMT_YUV411P, AV_PIX_FMT_YUV410P, AV_PIX_FMT_YUV440P, \
+ AV_PIX_FMT_YUVA420P, \
+ AV_PIX_FMT_YUVJ444P, AV_PIX_FMT_YUVJ422P, AV_PIX_FMT_YUVJ420P, \
+ AV_PIX_FMT_YUVJ440P
#define RGB_FORMATS \
- PIX_FMT_ARGB, PIX_FMT_RGBA, \
- PIX_FMT_ABGR, PIX_FMT_BGRA, \
- PIX_FMT_RGB24, PIX_FMT_BGR24
+ AV_PIX_FMT_ARGB, AV_PIX_FMT_RGBA, \
+ AV_PIX_FMT_ABGR, AV_PIX_FMT_BGRA, \
+ AV_PIX_FMT_RGB24, AV_PIX_FMT_BGR24
-static enum PixelFormat yuv_pix_fmts[] = { YUV_FORMATS, PIX_FMT_NONE };
-static enum PixelFormat rgb_pix_fmts[] = { RGB_FORMATS, PIX_FMT_NONE };
-static enum PixelFormat all_pix_fmts[] = { RGB_FORMATS, YUV_FORMATS, PIX_FMT_NONE };
+static enum AVPixelFormat yuv_pix_fmts[] = { YUV_FORMATS, AV_PIX_FMT_NONE };
+static enum AVPixelFormat rgb_pix_fmts[] = { RGB_FORMATS, AV_PIX_FMT_NONE };
+static enum AVPixelFormat all_pix_fmts[] = { RGB_FORMATS, YUV_FORMATS, AV_PIX_FMT_NONE };
static int query_formats(AVFilterContext *ctx)
{
LutContext *lut = ctx->priv;
- enum PixelFormat *pix_fmts = lut->is_rgb ? rgb_pix_fmts :
+ enum AVPixelFormat *pix_fmts = lut->is_rgb ? rgb_pix_fmts :
lut->is_yuv ? yuv_pix_fmts : all_pix_fmts;
- avfilter_set_common_formats(ctx, avfilter_make_format_list(pix_fmts));
+ ff_set_common_formats(ctx, ff_make_format_list(pix_fmts));
return 0;
}
@@ -209,7 +212,7 @@ static int config_props(AVFilterLink *inlink)
{
AVFilterContext *ctx = inlink->dst;
LutContext *lut = ctx->priv;
- const AVPixFmtDescriptor *desc = &av_pix_fmt_descriptors[inlink->format];
+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format);
int min[4], max[4];
int val, comp, ret;
@@ -220,13 +223,13 @@ static int config_props(AVFilterLink *inlink)
lut->var_values[VAR_H] = inlink->h;
switch (inlink->format) {
- case PIX_FMT_YUV410P:
- case PIX_FMT_YUV411P:
- case PIX_FMT_YUV420P:
- case PIX_FMT_YUV422P:
- case PIX_FMT_YUV440P:
- case PIX_FMT_YUV444P:
- case PIX_FMT_YUVA420P:
+ case AV_PIX_FMT_YUV410P:
+ case AV_PIX_FMT_YUV411P:
+ case AV_PIX_FMT_YUV420P:
+ case AV_PIX_FMT_YUV422P:
+ case AV_PIX_FMT_YUV440P:
+ case AV_PIX_FMT_YUV444P:
+ case AV_PIX_FMT_YUVA420P:
min[Y] = min[U] = min[V] = 16;
max[Y] = 235;
max[U] = max[V] = 240;
@@ -243,12 +246,12 @@ static int config_props(AVFilterLink *inlink)
if (lut->is_rgb) {
switch (inlink->format) {
- case PIX_FMT_ARGB: lut->rgba_map[A] = 0; lut->rgba_map[R] = 1; lut->rgba_map[G] = 2; lut->rgba_map[B] = 3; break;
- case PIX_FMT_ABGR: lut->rgba_map[A] = 0; lut->rgba_map[B] = 1; lut->rgba_map[G] = 2; lut->rgba_map[R] = 3; break;
- case PIX_FMT_RGBA:
- case PIX_FMT_RGB24: lut->rgba_map[R] = 0; lut->rgba_map[G] = 1; lut->rgba_map[B] = 2; lut->rgba_map[A] = 3; break;
- case PIX_FMT_BGRA:
- case PIX_FMT_BGR24: lut->rgba_map[B] = 0; lut->rgba_map[G] = 1; lut->rgba_map[R] = 2; lut->rgba_map[A] = 3; break;
+ case AV_PIX_FMT_ARGB: lut->rgba_map[A] = 0; lut->rgba_map[R] = 1; lut->rgba_map[G] = 2; lut->rgba_map[B] = 3; break;
+ case AV_PIX_FMT_ABGR: lut->rgba_map[A] = 0; lut->rgba_map[B] = 1; lut->rgba_map[G] = 2; lut->rgba_map[R] = 3; break;
+ case AV_PIX_FMT_RGBA:
+ case AV_PIX_FMT_RGB24: lut->rgba_map[R] = 0; lut->rgba_map[G] = 1; lut->rgba_map[B] = 2; lut->rgba_map[A] = 3; break;
+ case AV_PIX_FMT_BGRA:
+ case AV_PIX_FMT_BGR24: lut->rgba_map[B] = 0; lut->rgba_map[G] = 1; lut->rgba_map[R] = 2; lut->rgba_map[A] = 3; break;
}
lut->step = av_get_bits_per_pixel(desc) >> 3;
}
@@ -292,22 +295,28 @@ static int config_props(AVFilterLink *inlink)
return 0;
}
-static void draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir)
+static int filter_frame(AVFilterLink *inlink, AVFilterBufferRef *in)
{
AVFilterContext *ctx = inlink->dst;
LutContext *lut = ctx->priv;
AVFilterLink *outlink = ctx->outputs[0];
- AVFilterBufferRef *inpic = inlink ->cur_buf;
- AVFilterBufferRef *outpic = outlink->out_buf;
+ AVFilterBufferRef *out;
uint8_t *inrow, *outrow, *inrow0, *outrow0;
int i, j, k, plane;
+ out = ff_get_video_buffer(outlink, AV_PERM_WRITE, outlink->w, outlink->h);
+ if (!out) {
+ avfilter_unref_bufferp(&in);
+ return AVERROR(ENOMEM);
+ }
+ avfilter_copy_buffer_ref_props(out, in);
+
if (lut->is_rgb) {
/* packed */
- inrow0 = inpic ->data[0] + y * inpic ->linesize[0];
- outrow0 = outpic->data[0] + y * outpic->linesize[0];
+ inrow0 = in ->data[0];
+ outrow0 = out->data[0];
- for (i = 0; i < h; i ++) {
+ for (i = 0; i < in->video->h; i ++) {
inrow = inrow0;
outrow = outrow0;
for (j = 0; j < inlink->w; j++) {
@@ -316,30 +325,44 @@ static void draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir)
outrow += lut->step;
inrow += lut->step;
}
- inrow0 += inpic ->linesize[0];
- outrow0 += outpic->linesize[0];
+ inrow0 += in ->linesize[0];
+ outrow0 += out->linesize[0];
}
} else {
/* planar */
- for (plane = 0; plane < 4 && inpic->data[plane]; plane++) {
+ for (plane = 0; plane < 4 && in->data[plane]; plane++) {
int vsub = plane == 1 || plane == 2 ? lut->vsub : 0;
int hsub = plane == 1 || plane == 2 ? lut->hsub : 0;
- inrow = inpic ->data[plane] + (y>>vsub) * inpic ->linesize[plane];
- outrow = outpic->data[plane] + (y>>vsub) * outpic->linesize[plane];
+ inrow = in ->data[plane];
+ outrow = out->data[plane];
- for (i = 0; i < h>>vsub; i ++) {
+ for (i = 0; i < in->video->h >> vsub; i ++) {
for (j = 0; j < inlink->w>>hsub; j++)
outrow[j] = lut->lut[plane][inrow[j]];
- inrow += inpic ->linesize[plane];
- outrow += outpic->linesize[plane];
+ inrow += in ->linesize[plane];
+ outrow += out->linesize[plane];
}
}
}
- avfilter_draw_slice(outlink, y, h, slice_dir);
+ avfilter_unref_bufferp(&in);
+ return ff_filter_frame(outlink, out);
}
+static const AVFilterPad inputs[] = {
+ { .name = "default",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .filter_frame = filter_frame,
+ .config_props = config_props,
+ .min_perms = AV_PERM_READ, },
+ { .name = NULL}
+};
+static const AVFilterPad outputs[] = {
+ { .name = "default",
+ .type = AVMEDIA_TYPE_VIDEO, },
+ { .name = NULL}
+};
#define DEFINE_LUT_FILTER(name_, description_, init_) \
AVFilter avfilter_vf_##name_ = { \
.name = #name_, \
@@ -350,15 +373,8 @@ static void draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir)
.uninit = uninit, \
.query_formats = query_formats, \
\
- .inputs = (AVFilterPad[]) {{ .name = "default", \
- .type = AVMEDIA_TYPE_VIDEO, \
- .draw_slice = draw_slice, \
- .config_props = config_props, \
- .min_perms = AV_PERM_READ, }, \
- { .name = NULL}}, \
- .outputs = (AVFilterPad[]) {{ .name = "default", \
- .type = AVMEDIA_TYPE_VIDEO, }, \
- { .name = NULL}}, \
+ .inputs = inputs, \
+ .outputs = outputs, \
}
#if CONFIG_LUT_FILTER
@@ -373,7 +389,7 @@ DEFINE_LUT_FILTER(lutrgb, "Compute and apply a lookup table to the RGB input vid
#if CONFIG_NEGATE_FILTER
-static int negate_init(AVFilterContext *ctx, const char *args, void *opaque)
+static int negate_init(AVFilterContext *ctx, const char *args)
{
LutContext *lut = ctx->priv;
char lut_params[64];
@@ -386,7 +402,7 @@ static int negate_init(AVFilterContext *ctx, const char *args, void *opaque)
snprintf(lut_params, sizeof(lut_params), "c0=negval:c1=negval:c2=negval:a=%s",
lut->negate_alpha ? "negval" : "val");
- return init(ctx, lut_params, opaque);
+ return init(ctx, lut_params);
}
DEFINE_LUT_FILTER(negate, "Negate input video.", negate_init);
diff --git a/gst-libs/ext/libav/libavfilter/vf_null.c b/gst-libs/ext/libav/libavfilter/vf_null.c
index 8414c5f..a7abb7a 100644
--- a/gst-libs/ext/libav/libavfilter/vf_null.c
+++ b/gst-libs/ext/libav/libavfilter/vf_null.c
@@ -21,7 +21,27 @@
* null video filter
*/
+#include "libavutil/internal.h"
#include "avfilter.h"
+#include "internal.h"
+#include "video.h"
+
+static const AVFilterPad avfilter_vf_null_inputs[] = {
+ {
+ .name = "default",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .get_video_buffer = ff_null_get_video_buffer,
+ },
+ { NULL }
+};
+
+static const AVFilterPad avfilter_vf_null_outputs[] = {
+ {
+ .name = "default",
+ .type = AVMEDIA_TYPE_VIDEO,
+ },
+ { NULL }
+};
AVFilter avfilter_vf_null = {
.name = "null",
@@ -29,14 +49,7 @@ AVFilter avfilter_vf_null = {
.priv_size = 0,
- .inputs = (AVFilterPad[]) {{ .name = "default",
- .type = AVMEDIA_TYPE_VIDEO,
- .get_video_buffer = avfilter_null_get_video_buffer,
- .start_frame = avfilter_null_start_frame,
- .end_frame = avfilter_null_end_frame },
- { .name = NULL}},
+ .inputs = avfilter_vf_null_inputs,
- .outputs = (AVFilterPad[]) {{ .name = "default",
- .type = AVMEDIA_TYPE_VIDEO, },
- { .name = NULL}},
+ .outputs = avfilter_vf_null_outputs,
};
diff --git a/gst-libs/ext/libav/libavfilter/vf_overlay.c b/gst-libs/ext/libav/libavfilter/vf_overlay.c
index 39b2375..8741d48 100644
--- a/gst-libs/ext/libav/libavfilter/vf_overlay.c
+++ b/gst-libs/ext/libav/libavfilter/vf_overlay.c
@@ -26,14 +26,18 @@
*/
#include "avfilter.h"
+#include "formats.h"
+#include "libavutil/common.h"
#include "libavutil/eval.h"
#include "libavutil/avstring.h"
+#include "libavutil/avassert.h"
#include "libavutil/pixdesc.h"
#include "libavutil/imgutils.h"
#include "libavutil/mathematics.h"
#include "internal.h"
+#include "video.h"
-static const char *var_names[] = {
+static const char *const var_names[] = {
"E",
"PHI",
"PI",
@@ -61,15 +65,16 @@ enum var_name {
typedef struct {
int x, y; ///< position of overlayed picture
- AVFilterBufferRef *overpicref;
-
int max_plane_step[4]; ///< steps per pixel for each plane
int hsub, vsub; ///< chroma subsampling values
char x_expr[256], y_expr[256];
+
+ AVFilterBufferRef *main;
+ AVFilterBufferRef *over_prev, *over_next;
} OverlayContext;
-static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
+static av_cold int init(AVFilterContext *ctx, const char *args)
{
OverlayContext *over = ctx->priv;
@@ -84,22 +89,23 @@ static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
static av_cold void uninit(AVFilterContext *ctx)
{
- OverlayContext *over = ctx->priv;
+ OverlayContext *s = ctx->priv;
- if (over->overpicref)
- avfilter_unref_buffer(over->overpicref);
+ avfilter_unref_bufferp(&s->main);
+ avfilter_unref_bufferp(&s->over_prev);
+ avfilter_unref_bufferp(&s->over_next);
}
static int query_formats(AVFilterContext *ctx)
{
- const enum PixelFormat inout_pix_fmts[] = { PIX_FMT_YUV420P, PIX_FMT_NONE };
- const enum PixelFormat blend_pix_fmts[] = { PIX_FMT_YUVA420P, PIX_FMT_NONE };
- AVFilterFormats *inout_formats = avfilter_make_format_list(inout_pix_fmts);
- AVFilterFormats *blend_formats = avfilter_make_format_list(blend_pix_fmts);
+ const enum AVPixelFormat inout_pix_fmts[] = { AV_PIX_FMT_YUV420P, AV_PIX_FMT_NONE };
+ const enum AVPixelFormat blend_pix_fmts[] = { AV_PIX_FMT_YUVA420P, AV_PIX_FMT_NONE };
+ AVFilterFormats *inout_formats = ff_make_format_list(inout_pix_fmts);
+ AVFilterFormats *blend_formats = ff_make_format_list(blend_pix_fmts);
- avfilter_formats_ref(inout_formats, &ctx->inputs [MAIN ]->out_formats);
- avfilter_formats_ref(blend_formats, &ctx->inputs [OVERLAY]->out_formats);
- avfilter_formats_ref(inout_formats, &ctx->outputs[MAIN ]->in_formats );
+ ff_formats_ref(inout_formats, &ctx->inputs [MAIN ]->out_formats);
+ ff_formats_ref(blend_formats, &ctx->inputs [OVERLAY]->out_formats);
+ ff_formats_ref(inout_formats, &ctx->outputs[MAIN ]->in_formats );
return 0;
}
@@ -107,7 +113,7 @@ static int query_formats(AVFilterContext *ctx)
static int config_input_main(AVFilterLink *inlink)
{
OverlayContext *over = inlink->dst->priv;
- const AVPixFmtDescriptor *pix_desc = &av_pix_fmt_descriptors[inlink->format];
+ const AVPixFmtDescriptor *pix_desc = av_pix_fmt_desc_get(inlink->format);
av_image_fill_max_pixsteps(over->max_plane_step, NULL, pix_desc);
over->hsub = pix_desc->log2_chroma_w;
@@ -149,13 +155,13 @@ static int config_input_overlay(AVFilterLink *inlink)
goto fail;
over->x = res;
- av_log(ctx, AV_LOG_INFO,
+ av_log(ctx, AV_LOG_VERBOSE,
"main w:%d h:%d fmt:%s overlay x:%d y:%d w:%d h:%d fmt:%s\n",
ctx->inputs[MAIN]->w, ctx->inputs[MAIN]->h,
- av_pix_fmt_descriptors[ctx->inputs[MAIN]->format].name,
+ av_get_pix_fmt_name(ctx->inputs[MAIN]->format),
over->x, over->y,
ctx->inputs[OVERLAY]->w, ctx->inputs[OVERLAY]->h,
- av_pix_fmt_descriptors[ctx->inputs[OVERLAY]->format].name);
+ av_get_pix_fmt_name(ctx->inputs[OVERLAY]->format));
if (over->x < 0 || over->y < 0 ||
over->x + var_values[VAR_OVERLAY_W] > var_values[VAR_MAIN_W] ||
@@ -179,91 +185,36 @@ fail:
static int config_output(AVFilterLink *outlink)
{
AVFilterContext *ctx = outlink->src;
- int exact;
- // common timebase computation:
- AVRational tb1 = ctx->inputs[MAIN ]->time_base;
- AVRational tb2 = ctx->inputs[OVERLAY]->time_base;
- AVRational *tb = &ctx->outputs[0]->time_base;
- exact = av_reduce(&tb->num, &tb->den,
- av_gcd((int64_t)tb1.num * tb2.den,
- (int64_t)tb2.num * tb1.den),
- (int64_t)tb1.den * tb2.den, INT_MAX);
- av_log(ctx, AV_LOG_INFO,
- "main_tb:%d/%d overlay_tb:%d/%d -> tb:%d/%d exact:%d\n",
- tb1.num, tb1.den, tb2.num, tb2.den, tb->num, tb->den, exact);
- if (!exact)
- av_log(ctx, AV_LOG_WARNING,
- "Timestamp conversion inexact, timestamp information loss may occurr\n");
outlink->w = ctx->inputs[MAIN]->w;
outlink->h = ctx->inputs[MAIN]->h;
+ outlink->time_base = ctx->inputs[MAIN]->time_base;
return 0;
}
-static AVFilterBufferRef *get_video_buffer(AVFilterLink *link, int perms, int w, int h)
-{
- return avfilter_get_video_buffer(link->dst->outputs[0], perms, w, h);
-}
-
-static void start_frame(AVFilterLink *inlink, AVFilterBufferRef *inpicref)
-{
- AVFilterBufferRef *outpicref = avfilter_ref_buffer(inpicref, ~0);
- AVFilterContext *ctx = inlink->dst;
- OverlayContext *over = ctx->priv;
-
- inlink->dst->outputs[0]->out_buf = outpicref;
- outpicref->pts = av_rescale_q(outpicref->pts, ctx->inputs[MAIN]->time_base,
- ctx->outputs[0]->time_base);
-
- if (!over->overpicref || over->overpicref->pts < outpicref->pts) {
- AVFilterBufferRef *old = over->overpicref;
- over->overpicref = NULL;
- avfilter_request_frame(ctx->inputs[OVERLAY]);
- if (over->overpicref) {
- if (old)
- avfilter_unref_buffer(old);
- } else
- over->overpicref = old;
- }
-
- avfilter_start_frame(inlink->dst->outputs[0], outpicref);
-}
-
-static void start_frame_overlay(AVFilterLink *inlink, AVFilterBufferRef *inpicref)
-{
- AVFilterContext *ctx = inlink->dst;
- OverlayContext *over = ctx->priv;
-
- over->overpicref = inpicref;
- over->overpicref->pts = av_rescale_q(inpicref->pts, ctx->inputs[OVERLAY]->time_base,
- ctx->outputs[0]->time_base);
-}
-
-static void blend_slice(AVFilterContext *ctx,
+static void blend_frame(AVFilterContext *ctx,
AVFilterBufferRef *dst, AVFilterBufferRef *src,
- int x, int y, int w, int h,
- int slice_y, int slice_w, int slice_h)
+ int x, int y)
{
OverlayContext *over = ctx->priv;
int i, j, k;
int width, height;
- int overlay_end_y = y+h;
- int slice_end_y = slice_y+slice_h;
+ int overlay_end_y = y + src->video->h;
int end_y, start_y;
- width = FFMIN(slice_w - x, w);
- end_y = FFMIN(slice_end_y, overlay_end_y);
- start_y = FFMAX(y, slice_y);
+ width = FFMIN(dst->video->w - x, src->video->w);
+ end_y = FFMIN(dst->video->h, overlay_end_y);
+ start_y = FFMAX(y, 0);
height = end_y - start_y;
- if (dst->format == PIX_FMT_BGR24 || dst->format == PIX_FMT_RGB24) {
+ if (dst->format == AV_PIX_FMT_BGR24 || dst->format == AV_PIX_FMT_RGB24) {
uint8_t *dp = dst->data[0] + x * 3 + start_y * dst->linesize[0];
uint8_t *sp = src->data[0];
- int b = dst->format == PIX_FMT_BGR24 ? 2 : 0;
- int r = dst->format == PIX_FMT_BGR24 ? 0 : 2;
- if (slice_y > y)
- sp += (slice_y - y) * src->linesize[0];
+ int b = dst->format == AV_PIX_FMT_BGR24 ? 2 : 0;
+ int r = dst->format == AV_PIX_FMT_BGR24 ? 0 : 2;
+ if (y < 0)
+ sp += -y * src->linesize[0];
for (i = 0; i < height; i++) {
uint8_t *d = dp, *s = sp;
for (j = 0; j < width; j++) {
@@ -286,9 +237,9 @@ static void blend_slice(AVFilterContext *ctx,
uint8_t *ap = src->data[3];
int wp = FFALIGN(width, 1<<hsub) >> hsub;
int hp = FFALIGN(height, 1<<vsub) >> vsub;
- if (slice_y > y) {
- sp += ((slice_y - y) >> vsub) * src->linesize[i];
- ap += (slice_y - y) * src->linesize[3];
+ if (y < 0) {
+ sp += ((-y) >> vsub) * src->linesize[i];
+ ap += -y * src->linesize[3];
}
for (j = 0; j < hp; j++) {
uint8_t *d = dp, *s = sp, *a = ap;
@@ -318,32 +269,126 @@ static void blend_slice(AVFilterContext *ctx,
}
}
-static void draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir)
+static int filter_frame_main(AVFilterLink *inlink, AVFilterBufferRef *frame)
+{
+ OverlayContext *s = inlink->dst->priv;
+
+ av_assert0(!s->main);
+ s->main = frame;
+
+ return 0;
+}
+
+static int filter_frame_overlay(AVFilterLink *inlink, AVFilterBufferRef *frame)
{
- AVFilterContext *ctx = inlink->dst;
+ OverlayContext *s = inlink->dst->priv;
+
+ av_assert0(!s->over_next);
+ s->over_next = frame;
+
+ return 0;
+}
+
+static int output_frame(AVFilterContext *ctx)
+{
+ OverlayContext *s = ctx->priv;
AVFilterLink *outlink = ctx->outputs[0];
- AVFilterBufferRef *outpicref = outlink->out_buf;
- OverlayContext *over = ctx->priv;
+ int ret = ff_filter_frame(outlink, s->main);
+ s->main = NULL;
- if (over->overpicref &&
- !(over->x >= outpicref->video->w || over->y >= outpicref->video->h ||
- y+h < over->y || y >= over->y + over->overpicref->video->h)) {
- blend_slice(ctx, outpicref, over->overpicref, over->x, over->y,
- over->overpicref->video->w, over->overpicref->video->h,
- y, outpicref->video->w, h);
- }
- avfilter_draw_slice(outlink, y, h, slice_dir);
+ return ret;
}
-static void end_frame(AVFilterLink *inlink)
+static int handle_overlay_eof(AVFilterContext *ctx)
{
- avfilter_end_frame(inlink->dst->outputs[0]);
- avfilter_unref_buffer(inlink->cur_buf);
+ OverlayContext *s = ctx->priv;
+ if (s->over_prev)
+ blend_frame(ctx, s->main, s->over_prev, s->x, s->y);
+ return output_frame(ctx);
}
-static void null_draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir) { }
+static int request_frame(AVFilterLink *outlink)
+{
+ AVFilterContext *ctx = outlink->src;
+ OverlayContext *s = ctx->priv;
+ AVRational tb_main = ctx->inputs[MAIN]->time_base;
+ AVRational tb_over = ctx->inputs[OVERLAY]->time_base;
+ int ret = 0;
+
+ /* get a frame on the main input */
+ if (!s->main) {
+ ret = ff_request_frame(ctx->inputs[MAIN]);
+ if (ret < 0)
+ return ret;
+ }
-static void null_end_frame(AVFilterLink *inlink) { }
+ /* get a new frame on the overlay input, on EOF
+ * reuse previous */
+ if (!s->over_next) {
+ ret = ff_request_frame(ctx->inputs[OVERLAY]);
+ if (ret == AVERROR_EOF)
+ return handle_overlay_eof(ctx);
+ else if (ret < 0)
+ return ret;
+ }
+
+ while (s->main->pts != AV_NOPTS_VALUE &&
+ s->over_next->pts != AV_NOPTS_VALUE &&
+ av_compare_ts(s->over_next->pts, tb_over, s->main->pts, tb_main) < 0) {
+ avfilter_unref_bufferp(&s->over_prev);
+ FFSWAP(AVFilterBufferRef*, s->over_prev, s->over_next);
+
+ ret = ff_request_frame(ctx->inputs[OVERLAY]);
+ if (ret == AVERROR_EOF)
+ return handle_overlay_eof(ctx);
+ else if (ret < 0)
+ return ret;
+ }
+
+ if (s->main->pts == AV_NOPTS_VALUE ||
+ s->over_next->pts == AV_NOPTS_VALUE ||
+ !av_compare_ts(s->over_next->pts, tb_over, s->main->pts, tb_main)) {
+ blend_frame(ctx, s->main, s->over_next, s->x, s->y);
+ avfilter_unref_bufferp(&s->over_prev);
+ FFSWAP(AVFilterBufferRef*, s->over_prev, s->over_next);
+ } else if (s->over_prev) {
+ blend_frame(ctx, s->main, s->over_prev, s->x, s->y);
+ }
+
+ return output_frame(ctx);
+}
+
+static const AVFilterPad avfilter_vf_overlay_inputs[] = {
+ {
+ .name = "main",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .config_props = config_input_main,
+ .filter_frame = filter_frame_main,
+ .min_perms = AV_PERM_READ,
+ .rej_perms = AV_PERM_REUSE2 | AV_PERM_PRESERVE,
+ .needs_fifo = 1,
+ },
+ {
+ .name = "overlay",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .config_props = config_input_overlay,
+ .filter_frame = filter_frame_overlay,
+ .min_perms = AV_PERM_READ,
+ .rej_perms = AV_PERM_REUSE2,
+ .needs_fifo = 1,
+ },
+ { NULL }
+};
+
+static const AVFilterPad avfilter_vf_overlay_outputs[] = {
+ {
+ .name = "default",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .config_props = config_output,
+ .request_frame = request_frame,
+ },
+ { NULL }
+};
AVFilter avfilter_vf_overlay = {
.name = "overlay",
@@ -356,26 +401,6 @@ AVFilter avfilter_vf_overlay = {
.query_formats = query_formats,
- .inputs = (AVFilterPad[]) {{ .name = "main",
- .type = AVMEDIA_TYPE_VIDEO,
- .start_frame = start_frame,
- .get_video_buffer= get_video_buffer,
- .config_props = config_input_main,
- .draw_slice = draw_slice,
- .end_frame = end_frame,
- .min_perms = AV_PERM_READ,
- .rej_perms = AV_PERM_REUSE2|AV_PERM_PRESERVE, },
- { .name = "overlay",
- .type = AVMEDIA_TYPE_VIDEO,
- .start_frame = start_frame_overlay,
- .config_props = config_input_overlay,
- .draw_slice = null_draw_slice,
- .end_frame = null_end_frame,
- .min_perms = AV_PERM_READ,
- .rej_perms = AV_PERM_REUSE2, },
- { .name = NULL}},
- .outputs = (AVFilterPad[]) {{ .name = "default",
- .type = AVMEDIA_TYPE_VIDEO,
- .config_props = config_output, },
- { .name = NULL}},
+ .inputs = avfilter_vf_overlay_inputs,
+ .outputs = avfilter_vf_overlay_outputs,
};
diff --git a/gst-libs/ext/libav/libavfilter/vf_pad.c b/gst-libs/ext/libav/libavfilter/vf_pad.c
index 0b60d5b..f1a890e 100644
--- a/gst-libs/ext/libav/libavfilter/vf_pad.c
+++ b/gst-libs/ext/libav/libavfilter/vf_pad.c
@@ -25,7 +25,11 @@
*/
#include "avfilter.h"
+#include "formats.h"
+#include "internal.h"
+#include "video.h"
#include "libavutil/avstring.h"
+#include "libavutil/common.h"
#include "libavutil/eval.h"
#include "libavutil/pixdesc.h"
#include "libavutil/colorspace.h"
@@ -35,7 +39,7 @@
#include "libavutil/mathematics.h"
#include "drawutils.h"
-static const char *var_names[] = {
+static const char *const var_names[] = {
"PI",
"PHI",
"E",
@@ -69,22 +73,22 @@ enum var_name {
static int query_formats(AVFilterContext *ctx)
{
- static const enum PixelFormat pix_fmts[] = {
- PIX_FMT_ARGB, PIX_FMT_RGBA,
- PIX_FMT_ABGR, PIX_FMT_BGRA,
- PIX_FMT_RGB24, PIX_FMT_BGR24,
-
- PIX_FMT_YUV444P, PIX_FMT_YUV422P,
- PIX_FMT_YUV420P, PIX_FMT_YUV411P,
- PIX_FMT_YUV410P, PIX_FMT_YUV440P,
- PIX_FMT_YUVJ444P, PIX_FMT_YUVJ422P,
- PIX_FMT_YUVJ420P, PIX_FMT_YUVJ440P,
- PIX_FMT_YUVA420P,
-
- PIX_FMT_NONE
+ static const enum AVPixelFormat pix_fmts[] = {
+ AV_PIX_FMT_ARGB, AV_PIX_FMT_RGBA,
+ AV_PIX_FMT_ABGR, AV_PIX_FMT_BGRA,
+ AV_PIX_FMT_RGB24, AV_PIX_FMT_BGR24,
+
+ AV_PIX_FMT_YUV444P, AV_PIX_FMT_YUV422P,
+ AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV411P,
+ AV_PIX_FMT_YUV410P, AV_PIX_FMT_YUV440P,
+ AV_PIX_FMT_YUVJ444P, AV_PIX_FMT_YUVJ422P,
+ AV_PIX_FMT_YUVJ420P, AV_PIX_FMT_YUVJ440P,
+ AV_PIX_FMT_YUVA420P,
+
+ AV_PIX_FMT_NONE
};
- avfilter_set_common_formats(ctx, avfilter_make_format_list(pix_fmts));
+ ff_set_common_formats(ctx, ff_make_format_list(pix_fmts));
return 0;
}
@@ -102,10 +106,9 @@ typedef struct {
uint8_t *line[4];
int line_step[4];
int hsub, vsub; ///< chroma subsampling values
- int needs_copy;
} PadContext;
-static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
+static av_cold int init(AVFilterContext *ctx, const char *args)
{
PadContext *pad = ctx->priv;
char color_string[128] = "black";
@@ -140,7 +143,7 @@ static int config_input(AVFilterLink *inlink)
{
AVFilterContext *ctx = inlink->dst;
PadContext *pad = ctx->priv;
- const AVPixFmtDescriptor *pix_desc = &av_pix_fmt_descriptors[inlink->format];
+ const AVPixFmtDescriptor *pix_desc = av_pix_fmt_desc_get(inlink->format);
uint8_t rgba_color[4];
int ret, is_packed_rgba;
double var_values[VARS_NB], res;
@@ -217,7 +220,7 @@ static int config_input(AVFilterLink *inlink)
ff_fill_line_with_color(pad->line, pad->line_step, pad->w, pad->color,
inlink->format, rgba_color, &is_packed_rgba, NULL);
- av_log(ctx, AV_LOG_INFO, "w:%d h:%d -> w:%d h:%d x:%d y:%d color:0x%02X%02X%02X%02X[%s]\n",
+ av_log(ctx, AV_LOG_VERBOSE, "w:%d h:%d -> w:%d h:%d x:%d y:%d color:0x%02X%02X%02X%02X[%s]\n",
inlink->w, inlink->h, pad->w, pad->h, pad->x, pad->y,
pad->color[0], pad->color[1], pad->color[2], pad->color[3],
is_packed_rgba ? "rgba" : "yuva");
@@ -254,11 +257,14 @@ static AVFilterBufferRef *get_video_buffer(AVFilterLink *inlink, int perms, int
{
PadContext *pad = inlink->dst->priv;
- AVFilterBufferRef *picref = avfilter_get_video_buffer(inlink->dst->outputs[0], perms,
- w + (pad->w - pad->in_w),
- h + (pad->h - pad->in_h));
+ AVFilterBufferRef *picref = ff_get_video_buffer(inlink->dst->outputs[0], perms,
+ w + (pad->w - pad->in_w),
+ h + (pad->h - pad->in_h));
int plane;
+ if (!picref)
+ return NULL;
+
picref->video->w = w;
picref->video->h = h;
@@ -296,117 +302,107 @@ static int does_clip(PadContext *pad, AVFilterBufferRef *outpicref, int plane, i
return 0;
}
-static void start_frame(AVFilterLink *inlink, AVFilterBufferRef *inpicref)
+static int filter_frame(AVFilterLink *inlink, AVFilterBufferRef *in)
{
PadContext *pad = inlink->dst->priv;
- AVFilterBufferRef *outpicref = avfilter_ref_buffer(inpicref, ~0);
- AVFilterBufferRef *for_next_filter;
- int plane;
+ AVFilterBufferRef *out = avfilter_ref_buffer(in, ~0);
+ int plane, needs_copy;
+
+ if (!out) {
+ avfilter_unref_bufferp(&in);
+ return AVERROR(ENOMEM);
+ }
- for (plane = 0; plane < 4 && outpicref->data[plane]; plane++) {
+ for (plane = 0; plane < 4 && out->data[plane]; plane++) {
int hsub = (plane == 1 || plane == 2) ? pad->hsub : 0;
int vsub = (plane == 1 || plane == 2) ? pad->vsub : 0;
- av_assert0(outpicref->buf->w>0 && outpicref->buf->h>0);
+ av_assert0(out->buf->w > 0 && out->buf->h > 0);
- if(outpicref->format != outpicref->buf->format) //unsupported currently
+ if (out->format != out->buf->format) //unsupported currently
break;
- outpicref->data[plane] -= (pad->x >> hsub) * pad ->line_step[plane]
- + (pad->y >> vsub) * outpicref->linesize [plane];
+ out->data[plane] -= (pad->x >> hsub) * pad->line_step[plane] +
+ (pad->y >> vsub) * out->linesize [plane];
- if( does_clip(pad, outpicref, plane, hsub, vsub, 0, 0)
- || does_clip(pad, outpicref, plane, hsub, vsub, 0, pad->h-1)
- || does_clip(pad, outpicref, plane, hsub, vsub, pad->w-1, 0)
- || does_clip(pad, outpicref, plane, hsub, vsub, pad->w-1, pad->h-1)
- )
+ if (does_clip(pad, out, plane, hsub, vsub, 0, 0) ||
+ does_clip(pad, out, plane, hsub, vsub, 0, pad->h - 1) ||
+ does_clip(pad, out, plane, hsub, vsub, pad->w - 1, 0) ||
+ does_clip(pad, out, plane, hsub, vsub, pad->w - 1, pad->h - 1))
break;
}
- pad->needs_copy= plane < 4 && outpicref->data[plane];
- if(pad->needs_copy){
+ needs_copy = plane < 4 && out->data[plane];
+ if (needs_copy) {
av_log(inlink->dst, AV_LOG_DEBUG, "Direct padding impossible allocating new frame\n");
- avfilter_unref_buffer(outpicref);
- outpicref = avfilter_get_video_buffer(inlink->dst->outputs[0], AV_PERM_WRITE | AV_PERM_NEG_LINESIZES,
- FFMAX(inlink->w, pad->w),
- FFMAX(inlink->h, pad->h));
- avfilter_copy_buffer_ref_props(outpicref, inpicref);
+ avfilter_unref_buffer(out);
+ out = ff_get_video_buffer(inlink->dst->outputs[0], AV_PERM_WRITE | AV_PERM_NEG_LINESIZES,
+ FFMAX(inlink->w, pad->w),
+ FFMAX(inlink->h, pad->h));
+ if (!out) {
+ avfilter_unref_bufferp(&in);
+ return AVERROR(ENOMEM);
+ }
+
+ avfilter_copy_buffer_ref_props(out, in);
}
- inlink->dst->outputs[0]->out_buf = outpicref;
-
- outpicref->video->w = pad->w;
- outpicref->video->h = pad->h;
-
- for_next_filter = avfilter_ref_buffer(outpicref, ~0);
- avfilter_start_frame(inlink->dst->outputs[0], for_next_filter);
-}
-
-static void end_frame(AVFilterLink *link)
-{
- avfilter_end_frame(link->dst->outputs[0]);
- avfilter_unref_buffer(link->dst->outputs[0]->out_buf);
- avfilter_unref_buffer(link->cur_buf);
-}
+ out->video->w = pad->w;
+ out->video->h = pad->h;
-static void draw_send_bar_slice(AVFilterLink *link, int y, int h, int slice_dir, int before_slice)
-{
- PadContext *pad = link->dst->priv;
- int bar_y, bar_h = 0;
-
- if (slice_dir * before_slice == 1 && y == pad->y) {
- /* top bar */
- bar_y = 0;
- bar_h = pad->y;
- } else if (slice_dir * before_slice == -1 && (y + h) == (pad->y + pad->in_h)) {
- /* bottom bar */
- bar_y = pad->y + pad->in_h;
- bar_h = pad->h - pad->in_h - pad->y;
+ /* top bar */
+ if (pad->y) {
+ ff_draw_rectangle(out->data, out->linesize,
+ pad->line, pad->line_step, pad->hsub, pad->vsub,
+ 0, 0, pad->w, pad->y);
}
- if (bar_h) {
- ff_draw_rectangle(link->dst->outputs[0]->out_buf->data,
- link->dst->outputs[0]->out_buf->linesize,
+ /* bottom bar */
+ if (pad->h > pad->y + pad->in_h) {
+ ff_draw_rectangle(out->data, out->linesize,
pad->line, pad->line_step, pad->hsub, pad->vsub,
- 0, bar_y, pad->w, bar_h);
- avfilter_draw_slice(link->dst->outputs[0], bar_y, bar_h, slice_dir);
+ 0, pad->y + pad->in_h, pad->w, pad->h - pad->y - pad->in_h);
}
-}
-
-static void draw_slice(AVFilterLink *link, int y, int h, int slice_dir)
-{
- PadContext *pad = link->dst->priv;
- AVFilterBufferRef *outpic = link->dst->outputs[0]->out_buf;
- AVFilterBufferRef *inpic = link->cur_buf;
-
- y += pad->y;
-
- y &= ~((1 << pad->vsub) - 1);
- h &= ~((1 << pad->vsub) - 1);
-
- if (!h)
- return;
- draw_send_bar_slice(link, y, h, slice_dir, 1);
/* left border */
- ff_draw_rectangle(outpic->data, outpic->linesize, pad->line, pad->line_step,
- pad->hsub, pad->vsub, 0, y, pad->x, h);
-
- if(pad->needs_copy){
- ff_copy_rectangle(outpic->data, outpic->linesize,
- inpic->data, inpic->linesize, pad->line_step,
- pad->hsub, pad->vsub,
- pad->x, y, y-pad->y, inpic->video->w, h);
+ ff_draw_rectangle(out->data, out->linesize, pad->line, pad->line_step,
+ pad->hsub, pad->vsub, 0, pad->y, pad->x, in->video->h);
+
+ if (needs_copy) {
+ ff_copy_rectangle(out->data, out->linesize, in->data, in->linesize,
+ pad->line_step, pad->hsub, pad->vsub,
+ pad->x, pad->y, 0, in->video->w, in->video->h);
}
/* right border */
- ff_draw_rectangle(outpic->data, outpic->linesize,
+ ff_draw_rectangle(out->data, out->linesize,
pad->line, pad->line_step, pad->hsub, pad->vsub,
- pad->x + pad->in_w, y, pad->w - pad->x - pad->in_w, h);
- avfilter_draw_slice(link->dst->outputs[0], y, h, slice_dir);
+ pad->x + pad->in_w, pad->y, pad->w - pad->x - pad->in_w,
+ in->video->h);
- draw_send_bar_slice(link, y, h, slice_dir, -1);
+ avfilter_unref_bufferp(&in);
+ return ff_filter_frame(inlink->dst->outputs[0], out);
}
+static const AVFilterPad avfilter_vf_pad_inputs[] = {
+ {
+ .name = "default",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .config_props = config_input,
+ .get_video_buffer = get_video_buffer,
+ .filter_frame = filter_frame,
+ },
+ { NULL }
+};
+
+static const AVFilterPad avfilter_vf_pad_outputs[] = {
+ {
+ .name = "default",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .config_props = config_output,
+ },
+ { NULL }
+};
+
AVFilter avfilter_vf_pad = {
.name = "pad",
.description = NULL_IF_CONFIG_SMALL("Pad input image to width:height[:x:y[:color]] (default x and y: 0, default color: black)."),
@@ -416,17 +412,7 @@ AVFilter avfilter_vf_pad = {
.uninit = uninit,
.query_formats = query_formats,
- .inputs = (AVFilterPad[]) {{ .name = "default",
- .type = AVMEDIA_TYPE_VIDEO,
- .config_props = config_input,
- .get_video_buffer = get_video_buffer,
- .start_frame = start_frame,
- .draw_slice = draw_slice,
- .end_frame = end_frame, },
- { .name = NULL}},
-
- .outputs = (AVFilterPad[]) {{ .name = "default",
- .type = AVMEDIA_TYPE_VIDEO,
- .config_props = config_output, },
- { .name = NULL}},
+ .inputs = avfilter_vf_pad_inputs,
+
+ .outputs = avfilter_vf_pad_outputs,
};
diff --git a/gst-libs/ext/libav/libavfilter/vf_pixdesctest.c b/gst-libs/ext/libav/libavfilter/vf_pixdesctest.c
index 344f664..a1e982c 100644
--- a/gst-libs/ext/libav/libavfilter/vf_pixdesctest.c
+++ b/gst-libs/ext/libav/libavfilter/vf_pixdesctest.c
@@ -23,8 +23,11 @@
* pixdesc test filter
*/
+#include "libavutil/common.h"
#include "libavutil/pixdesc.h"
#include "avfilter.h"
+#include "internal.h"
+#include "video.h"
typedef struct {
const AVPixFmtDescriptor *pix_desc;
@@ -41,7 +44,7 @@ static int config_props(AVFilterLink *inlink)
{
PixdescTestContext *priv = inlink->dst->priv;
- priv->pix_desc = &av_pix_fmt_descriptors[inlink->format];
+ priv->pix_desc = av_pix_fmt_desc_get(inlink->format);
if (!(priv->line = av_malloc(sizeof(*priv->line) * inlink->w)))
return AVERROR(ENOMEM);
@@ -49,65 +52,79 @@ static int config_props(AVFilterLink *inlink)
return 0;
}
-static void start_frame(AVFilterLink *inlink, AVFilterBufferRef *picref)
+static int filter_frame(AVFilterLink *inlink, AVFilterBufferRef *in)
{
PixdescTestContext *priv = inlink->dst->priv;
AVFilterLink *outlink = inlink->dst->outputs[0];
- AVFilterBufferRef *outpicref;
- int i;
+ AVFilterBufferRef *out;
+ int i, c, w = inlink->w, h = inlink->h;
- outlink->out_buf = avfilter_get_video_buffer(outlink, AV_PERM_WRITE,
- outlink->w, outlink->h);
- outpicref = outlink->out_buf;
- avfilter_copy_buffer_ref_props(outpicref, picref);
+ out = ff_get_video_buffer(outlink, AV_PERM_WRITE,
+ outlink->w, outlink->h);
+ if (!out) {
+ avfilter_unref_bufferp(&in);
+ return AVERROR(ENOMEM);
+ }
+
+ avfilter_copy_buffer_ref_props(out, in);
for (i = 0; i < 4; i++) {
int h = outlink->h;
h = i == 1 || i == 2 ? h>>priv->pix_desc->log2_chroma_h : h;
- if (outpicref->data[i]) {
- uint8_t *data = outpicref->data[i] +
- (outpicref->linesize[i] > 0 ? 0 : outpicref->linesize[i] * (h-1));
- memset(data, 0, FFABS(outpicref->linesize[i]) * h);
+ if (out->data[i]) {
+ uint8_t *data = out->data[i] +
+ (out->linesize[i] > 0 ? 0 : out->linesize[i] * (h-1));
+ memset(data, 0, FFABS(out->linesize[i]) * h);
}
}
/* copy palette */
- if (priv->pix_desc->flags & PIX_FMT_PAL)
- memcpy(outpicref->data[1], outpicref->data[1], 256*4);
-
- avfilter_start_frame(outlink, avfilter_ref_buffer(outpicref, ~0));
-}
-
-static void draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir)
-{
- PixdescTestContext *priv = inlink->dst->priv;
- AVFilterBufferRef *inpic = inlink->cur_buf;
- AVFilterBufferRef *outpic = inlink->dst->outputs[0]->out_buf;
- int i, c, w = inlink->w;
+ if (priv->pix_desc->flags & PIX_FMT_PAL ||
+ priv->pix_desc->flags & PIX_FMT_PSEUDOPAL)
+ memcpy(out->data[1], in->data[1], 256*4);
for (c = 0; c < priv->pix_desc->nb_components; c++) {
int w1 = c == 1 || c == 2 ? w>>priv->pix_desc->log2_chroma_w : w;
int h1 = c == 1 || c == 2 ? h>>priv->pix_desc->log2_chroma_h : h;
- int y1 = c == 1 || c == 2 ? y>>priv->pix_desc->log2_chroma_h : y;
- for (i = y1; i < y1 + h1; i++) {
+ for (i = 0; i < h1; i++) {
av_read_image_line(priv->line,
- inpic->data,
- inpic->linesize,
+ in->data,
+ in->linesize,
priv->pix_desc,
0, i, c, w1, 0);
av_write_image_line(priv->line,
- outpic->data,
- outpic->linesize,
+ out->data,
+ out->linesize,
priv->pix_desc,
0, i, c, w1);
}
}
- avfilter_draw_slice(inlink->dst->outputs[0], y, h, slice_dir);
+ avfilter_unref_bufferp(&in);
+ return ff_filter_frame(outlink, out);
}
+static const AVFilterPad avfilter_vf_pixdesctest_inputs[] = {
+ {
+ .name = "default",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .filter_frame = filter_frame,
+ .config_props = config_props,
+ .min_perms = AV_PERM_READ,
+ },
+ { NULL }
+};
+
+static const AVFilterPad avfilter_vf_pixdesctest_outputs[] = {
+ {
+ .name = "default",
+ .type = AVMEDIA_TYPE_VIDEO,
+ },
+ { NULL }
+};
+
AVFilter avfilter_vf_pixdesctest = {
.name = "pixdesctest",
.description = NULL_IF_CONFIG_SMALL("Test pixel format definitions."),
@@ -115,15 +132,7 @@ AVFilter avfilter_vf_pixdesctest = {
.priv_size = sizeof(PixdescTestContext),
.uninit = uninit,
- .inputs = (AVFilterPad[]) {{ .name = "default",
- .type = AVMEDIA_TYPE_VIDEO,
- .start_frame = start_frame,
- .draw_slice = draw_slice,
- .config_props = config_props,
- .min_perms = AV_PERM_READ, },
- { .name = NULL}},
-
- .outputs = (AVFilterPad[]) {{ .name = "default",
- .type = AVMEDIA_TYPE_VIDEO, },
- { .name = NULL}},
+ .inputs = avfilter_vf_pixdesctest_inputs,
+
+ .outputs = avfilter_vf_pixdesctest_outputs,
};
diff --git a/gst-libs/ext/libav/libavfilter/vf_scale.c b/gst-libs/ext/libav/libavfilter/vf_scale.c
index ec69d7b..7f189a2 100644
--- a/gst-libs/ext/libav/libavfilter/vf_scale.c
+++ b/gst-libs/ext/libav/libavfilter/vf_scale.c
@@ -23,14 +23,22 @@
* scale video filter
*/
+#include <stdio.h>
+#include <string.h>
+
#include "avfilter.h"
+#include "formats.h"
+#include "internal.h"
+#include "video.h"
#include "libavutil/avstring.h"
#include "libavutil/eval.h"
+#include "libavutil/internal.h"
#include "libavutil/mathematics.h"
+#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
#include "libswscale/swscale.h"
-static const char *var_names[] = {
+static const char *const var_names[] = {
"PI",
"PHI",
"E",
@@ -79,7 +87,7 @@ typedef struct {
char h_expr[256]; ///< height expression string
} ScaleContext;
-static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
+static av_cold int init(AVFilterContext *ctx, const char *args)
{
ScaleContext *scale = ctx->priv;
const char *p;
@@ -91,7 +99,15 @@ static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
if (args) {
sscanf(args, "%255[^:]:%255[^:]", scale->w_expr, scale->h_expr);
p = strstr(args,"flags=");
- if (p) scale->flags = strtoul(p+6, NULL, 0);
+ if (p) {
+ const AVClass *class = sws_get_class();
+ const AVOption *o = av_opt_find(&class, "sws_flags", NULL, 0,
+ AV_OPT_SEARCH_FAKE_OBJ);
+ int ret = av_opt_eval_flags(&class, o, p + 6, &scale->flags);
+
+ if (ret < 0)
+ return ret;
+ }
}
return 0;
@@ -107,28 +123,28 @@ static av_cold void uninit(AVFilterContext *ctx)
static int query_formats(AVFilterContext *ctx)
{
AVFilterFormats *formats;
- enum PixelFormat pix_fmt;
+ enum AVPixelFormat pix_fmt;
int ret;
if (ctx->inputs[0]) {
formats = NULL;
- for (pix_fmt = 0; pix_fmt < PIX_FMT_NB; pix_fmt++)
+ for (pix_fmt = 0; pix_fmt < AV_PIX_FMT_NB; pix_fmt++)
if ( sws_isSupportedInput(pix_fmt)
- && (ret = avfilter_add_format(&formats, pix_fmt)) < 0) {
- avfilter_formats_unref(&formats);
+ && (ret = ff_add_format(&formats, pix_fmt)) < 0) {
+ ff_formats_unref(&formats);
return ret;
}
- avfilter_formats_ref(formats, &ctx->inputs[0]->out_formats);
+ ff_formats_ref(formats, &ctx->inputs[0]->out_formats);
}
if (ctx->outputs[0]) {
formats = NULL;
- for (pix_fmt = 0; pix_fmt < PIX_FMT_NB; pix_fmt++)
+ for (pix_fmt = 0; pix_fmt < AV_PIX_FMT_NB; pix_fmt++)
if ( sws_isSupportedOutput(pix_fmt)
- && (ret = avfilter_add_format(&formats, pix_fmt)) < 0) {
- avfilter_formats_unref(&formats);
+ && (ret = ff_add_format(&formats, pix_fmt)) < 0) {
+ ff_formats_unref(&formats);
return ret;
}
- avfilter_formats_ref(formats, &ctx->outputs[0]->in_formats);
+ ff_formats_ref(formats, &ctx->outputs[0]->in_formats);
}
return 0;
@@ -139,6 +155,7 @@ static int config_props(AVFilterLink *outlink)
AVFilterContext *ctx = outlink->src;
AVFilterLink *inlink = outlink->src->inputs[0];
ScaleContext *scale = ctx->priv;
+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format);
int64_t w, h;
double var_values[VARS_NB], res;
char *expr;
@@ -154,8 +171,8 @@ static int config_props(AVFilterLink *outlink)
var_values[VAR_DAR] = var_values[VAR_A] = (double) inlink->w / inlink->h;
var_values[VAR_SAR] = inlink->sample_aspect_ratio.num ?
(double) inlink->sample_aspect_ratio.num / inlink->sample_aspect_ratio.den : 1;
- var_values[VAR_HSUB] = 1<<av_pix_fmt_descriptors[inlink->format].log2_chroma_w;
- var_values[VAR_VSUB] = 1<<av_pix_fmt_descriptors[inlink->format].log2_chroma_h;
+ var_values[VAR_HSUB] = 1 << desc->log2_chroma_w;
+ var_values[VAR_VSUB] = 1 << desc->log2_chroma_h;
/* evaluate width and height */
av_expr_parse_and_eval(&res, (expr = scale->w_expr),
@@ -203,20 +220,26 @@ static int config_props(AVFilterLink *outlink)
outlink->h = h;
/* TODO: make algorithm configurable */
- av_log(ctx, AV_LOG_INFO, "w:%d h:%d fmt:%s -> w:%d h:%d fmt:%s flags:0x%0x\n",
- inlink ->w, inlink ->h, av_pix_fmt_descriptors[ inlink->format].name,
- outlink->w, outlink->h, av_pix_fmt_descriptors[outlink->format].name,
+ av_log(ctx, AV_LOG_VERBOSE, "w:%d h:%d fmt:%s -> w:%d h:%d fmt:%s flags:0x%0x\n",
+ inlink ->w, inlink ->h, av_get_pix_fmt_name(inlink->format),
+ outlink->w, outlink->h, av_get_pix_fmt_name(outlink->format),
scale->flags);
- scale->input_is_pal = av_pix_fmt_descriptors[inlink->format].flags & PIX_FMT_PAL;
+ scale->input_is_pal = desc->flags & PIX_FMT_PAL ||
+ desc->flags & PIX_FMT_PSEUDOPAL;
if (scale->sws)
sws_freeContext(scale->sws);
- scale->sws = sws_getContext(inlink ->w, inlink ->h, inlink ->format,
- outlink->w, outlink->h, outlink->format,
- scale->flags, NULL, NULL, NULL);
- if (!scale->sws)
- return AVERROR(EINVAL);
+ if (inlink->w == outlink->w && inlink->h == outlink->h &&
+ inlink->format == outlink->format)
+ scale->sws = NULL;
+ else {
+ scale->sws = sws_getContext(inlink ->w, inlink ->h, inlink ->format,
+ outlink->w, outlink->h, outlink->format,
+ scale->flags, NULL, NULL, NULL);
+ if (!scale->sws)
+ return AVERROR(EINVAL);
+ }
if (inlink->sample_aspect_ratio.num)
@@ -234,59 +257,60 @@ fail:
return ret;
}
-static void start_frame(AVFilterLink *link, AVFilterBufferRef *picref)
+static int filter_frame(AVFilterLink *link, AVFilterBufferRef *in)
{
ScaleContext *scale = link->dst->priv;
AVFilterLink *outlink = link->dst->outputs[0];
- AVFilterBufferRef *outpicref;
+ AVFilterBufferRef *out;
+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(link->format);
+
+ if (!scale->sws)
+ return ff_filter_frame(outlink, in);
- scale->hsub = av_pix_fmt_descriptors[link->format].log2_chroma_w;
- scale->vsub = av_pix_fmt_descriptors[link->format].log2_chroma_h;
+ scale->hsub = desc->log2_chroma_w;
+ scale->vsub = desc->log2_chroma_h;
- outpicref = avfilter_get_video_buffer(outlink, AV_PERM_WRITE, outlink->w, outlink->h);
- avfilter_copy_buffer_ref_props(outpicref, picref);
- outpicref->video->w = outlink->w;
- outpicref->video->h = outlink->h;
+ out = ff_get_video_buffer(outlink, AV_PERM_WRITE, outlink->w, outlink->h);
+ if (!out) {
+ avfilter_unref_bufferp(&in);
+ return AVERROR(ENOMEM);
+ }
- outlink->out_buf = outpicref;
+ avfilter_copy_buffer_ref_props(out, in);
+ out->video->w = outlink->w;
+ out->video->h = outlink->h;
- av_reduce(&outpicref->video->pixel_aspect.num, &outpicref->video->pixel_aspect.den,
- (int64_t)picref->video->pixel_aspect.num * outlink->h * link->w,
- (int64_t)picref->video->pixel_aspect.den * outlink->w * link->h,
+ av_reduce(&out->video->pixel_aspect.num, &out->video->pixel_aspect.den,
+ (int64_t)in->video->pixel_aspect.num * outlink->h * link->w,
+ (int64_t)in->video->pixel_aspect.den * outlink->w * link->h,
INT_MAX);
- scale->slice_y = 0;
- avfilter_start_frame(outlink, avfilter_ref_buffer(outpicref, ~0));
-}
+ sws_scale(scale->sws, in->data, in->linesize, 0, in->video->h,
+ out->data, out->linesize);
-static void draw_slice(AVFilterLink *link, int y, int h, int slice_dir)
-{
- ScaleContext *scale = link->dst->priv;
- int out_h;
- AVFilterBufferRef *cur_pic = link->cur_buf;
- const uint8_t *data[4];
-
- if (scale->slice_y == 0 && slice_dir == -1)
- scale->slice_y = link->dst->outputs[0]->h;
-
- data[0] = cur_pic->data[0] + y * cur_pic->linesize[0];
- data[1] = scale->input_is_pal ?
- cur_pic->data[1] :
- cur_pic->data[1] + (y>>scale->vsub) * cur_pic->linesize[1];
- data[2] = cur_pic->data[2] + (y>>scale->vsub) * cur_pic->linesize[2];
- data[3] = cur_pic->data[3] + y * cur_pic->linesize[3];
-
- out_h = sws_scale(scale->sws, data, cur_pic->linesize, y, h,
- link->dst->outputs[0]->out_buf->data,
- link->dst->outputs[0]->out_buf->linesize);
-
- if (slice_dir == -1)
- scale->slice_y -= out_h;
- avfilter_draw_slice(link->dst->outputs[0], scale->slice_y, out_h, slice_dir);
- if (slice_dir == 1)
- scale->slice_y += out_h;
+ avfilter_unref_bufferp(&in);
+ return ff_filter_frame(outlink, out);
}
+static const AVFilterPad avfilter_vf_scale_inputs[] = {
+ {
+ .name = "default",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .filter_frame = filter_frame,
+ .min_perms = AV_PERM_READ,
+ },
+ { NULL }
+};
+
+static const AVFilterPad avfilter_vf_scale_outputs[] = {
+ {
+ .name = "default",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .config_props = config_props,
+ },
+ { NULL }
+};
+
AVFilter avfilter_vf_scale = {
.name = "scale",
.description = NULL_IF_CONFIG_SMALL("Scale the input video to width:height size and/or convert the image format."),
@@ -298,14 +322,6 @@ AVFilter avfilter_vf_scale = {
.priv_size = sizeof(ScaleContext),
- .inputs = (AVFilterPad[]) {{ .name = "default",
- .type = AVMEDIA_TYPE_VIDEO,
- .start_frame = start_frame,
- .draw_slice = draw_slice,
- .min_perms = AV_PERM_READ, },
- { .name = NULL}},
- .outputs = (AVFilterPad[]) {{ .name = "default",
- .type = AVMEDIA_TYPE_VIDEO,
- .config_props = config_props, },
- { .name = NULL}},
+ .inputs = avfilter_vf_scale_inputs,
+ .outputs = avfilter_vf_scale_outputs,
};
diff --git a/gst-libs/ext/libav/libavfilter/vf_select.c b/gst-libs/ext/libav/libavfilter/vf_select.c
index 0ec443a..674151d 100644
--- a/gst-libs/ext/libav/libavfilter/vf_select.c
+++ b/gst-libs/ext/libav/libavfilter/vf_select.c
@@ -25,10 +25,13 @@
#include "libavutil/eval.h"
#include "libavutil/fifo.h"
+#include "libavutil/internal.h"
#include "libavutil/mathematics.h"
#include "avfilter.h"
+#include "internal.h"
+#include "video.h"
-static const char *var_names[] = {
+static const char *const var_names[] = {
"E", ///< Euler number
"PHI", ///< golden ratio
"PI", ///< greek pi
@@ -120,7 +123,7 @@ typedef struct {
AVFifoBuffer *pending_frames; ///< FIFO buffer of video frames
} SelectContext;
-static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
+static av_cold int init(AVFilterContext *ctx, const char *args)
{
SelectContext *select = ctx->priv;
int ret;
@@ -225,45 +228,28 @@ static int select_frame(AVFilterContext *ctx, AVFilterBufferRef *picref)
return res;
}
-static void start_frame(AVFilterLink *inlink, AVFilterBufferRef *picref)
+static int filter_frame(AVFilterLink *inlink, AVFilterBufferRef *frame)
{
SelectContext *select = inlink->dst->priv;
- select->select = select_frame(inlink->dst, picref);
+ select->select = select_frame(inlink->dst, frame);
if (select->select) {
/* frame was requested through poll_frame */
if (select->cache_frames) {
- if (!av_fifo_space(select->pending_frames))
+ if (!av_fifo_space(select->pending_frames)) {
av_log(inlink->dst, AV_LOG_ERROR,
"Buffering limit reached, cannot cache more frames\n");
- else
- av_fifo_generic_write(select->pending_frames, &picref,
- sizeof(picref), NULL);
- return;
+ avfilter_unref_bufferp(&frame);
+ } else
+ av_fifo_generic_write(select->pending_frames, &frame,
+ sizeof(frame), NULL);
+ return 0;
}
- avfilter_start_frame(inlink->dst->outputs[0], avfilter_ref_buffer(picref, ~0));
+ return ff_filter_frame(inlink->dst->outputs[0], frame);
}
-}
-
-static void draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir)
-{
- SelectContext *select = inlink->dst->priv;
-
- if (select->select && !select->cache_frames)
- avfilter_draw_slice(inlink->dst->outputs[0], y, h, slice_dir);
-}
-
-static void end_frame(AVFilterLink *inlink)
-{
- SelectContext *select = inlink->dst->priv;
- AVFilterBufferRef *picref = inlink->cur_buf;
- if (select->select) {
- if (select->cache_frames)
- return;
- avfilter_end_frame(inlink->dst->outputs[0]);
- }
- avfilter_unref_buffer(picref);
+ avfilter_unref_bufferp(&frame);
+ return 0;
}
static int request_frame(AVFilterLink *outlink)
@@ -275,16 +261,13 @@ static int request_frame(AVFilterLink *outlink)
if (av_fifo_size(select->pending_frames)) {
AVFilterBufferRef *picref;
+
av_fifo_generic_read(select->pending_frames, &picref, sizeof(picref), NULL);
- avfilter_start_frame(outlink, avfilter_ref_buffer(picref, ~0));
- avfilter_draw_slice(outlink, 0, outlink->h, 1);
- avfilter_end_frame(outlink);
- avfilter_unref_buffer(picref);
- return 0;
+ return ff_filter_frame(outlink, picref);
}
while (!select->select) {
- int ret = avfilter_request_frame(inlink);
+ int ret = ff_request_frame(inlink);
if (ret < 0)
return ret;
}
@@ -299,12 +282,12 @@ static int poll_frame(AVFilterLink *outlink)
int count, ret;
if (!av_fifo_size(select->pending_frames)) {
- if ((count = avfilter_poll_frame(inlink)) <= 0)
+ if ((count = ff_poll_frame(inlink)) <= 0)
return count;
/* request frame from input, and apply select condition to it */
select->cache_frames = 1;
while (count-- && av_fifo_space(select->pending_frames)) {
- ret = avfilter_request_frame(inlink);
+ ret = ff_request_frame(inlink);
if (ret < 0)
break;
}
@@ -329,6 +312,27 @@ static av_cold void uninit(AVFilterContext *ctx)
select->pending_frames = NULL;
}
+static const AVFilterPad avfilter_vf_select_inputs[] = {
+ {
+ .name = "default",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .get_video_buffer = ff_null_get_video_buffer,
+ .config_props = config_input,
+ .filter_frame = filter_frame,
+ },
+ { NULL }
+};
+
+static const AVFilterPad avfilter_vf_select_outputs[] = {
+ {
+ .name = "default",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .poll_frame = poll_frame,
+ .request_frame = request_frame,
+ },
+ { NULL }
+};
+
AVFilter avfilter_vf_select = {
.name = "select",
.description = NULL_IF_CONFIG_SMALL("Select frames to pass in output."),
@@ -337,17 +341,6 @@ AVFilter avfilter_vf_select = {
.priv_size = sizeof(SelectContext),
- .inputs = (AVFilterPad[]) {{ .name = "default",
- .type = AVMEDIA_TYPE_VIDEO,
- .get_video_buffer = avfilter_null_get_video_buffer,
- .config_props = config_input,
- .start_frame = start_frame,
- .draw_slice = draw_slice,
- .end_frame = end_frame },
- { .name = NULL }},
- .outputs = (AVFilterPad[]) {{ .name = "default",
- .type = AVMEDIA_TYPE_VIDEO,
- .poll_frame = poll_frame,
- .request_frame = request_frame, },
- { .name = NULL}},
+ .inputs = avfilter_vf_select_inputs,
+ .outputs = avfilter_vf_select_outputs,
};
diff --git a/gst-libs/ext/libav/libavfilter/vf_setpts.c b/gst-libs/ext/libav/libavfilter/vf_setpts.c
index f265092..0c4881e 100644
--- a/gst-libs/ext/libav/libavfilter/vf_setpts.c
+++ b/gst-libs/ext/libav/libavfilter/vf_setpts.c
@@ -27,10 +27,13 @@
/* #define DEBUG */
#include "libavutil/eval.h"
+#include "libavutil/internal.h"
#include "libavutil/mathematics.h"
#include "avfilter.h"
+#include "internal.h"
+#include "video.h"
-static const char *var_names[] = {
+static const char *const var_names[] = {
"E", ///< Euler number
"INTERLACED", ///< tell if the current frame is interlaced
"N", ///< frame number (starting at zero)
@@ -65,7 +68,7 @@ typedef struct {
double var_values[VAR_VARS_NB];
} SetPTSContext;
-static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
+static av_cold int init(AVFilterContext *ctx, const char *args)
{
SetPTSContext *setpts = ctx->priv;
int ret;
@@ -92,43 +95,43 @@ static int config_input(AVFilterLink *inlink)
setpts->var_values[VAR_TB] = av_q2d(inlink->time_base);
- av_log(inlink->src, AV_LOG_INFO, "TB:%f\n", setpts->var_values[VAR_TB]);
+ av_log(inlink->src, AV_LOG_VERBOSE, "TB:%f\n", setpts->var_values[VAR_TB]);
return 0;
}
#define D2TS(d) (isnan(d) ? AV_NOPTS_VALUE : (int64_t)(d))
#define TS2D(ts) ((ts) == AV_NOPTS_VALUE ? NAN : (double)(ts))
-static void start_frame(AVFilterLink *inlink, AVFilterBufferRef *inpicref)
+static int filter_frame(AVFilterLink *inlink, AVFilterBufferRef *frame)
{
SetPTSContext *setpts = inlink->dst->priv;
+ int64_t in_pts = frame->pts;
double d;
- AVFilterBufferRef *outpicref = avfilter_ref_buffer(inpicref, ~0);
if (isnan(setpts->var_values[VAR_STARTPTS]))
- setpts->var_values[VAR_STARTPTS] = TS2D(inpicref->pts);
+ setpts->var_values[VAR_STARTPTS] = TS2D(frame->pts);
- setpts->var_values[VAR_INTERLACED] = inpicref->video->interlaced;
- setpts->var_values[VAR_PTS ] = TS2D(inpicref->pts);
- setpts->var_values[VAR_POS ] = inpicref->pos == -1 ? NAN : inpicref->pos;
+ setpts->var_values[VAR_INTERLACED] = frame->video->interlaced;
+ setpts->var_values[VAR_PTS ] = TS2D(frame->pts);
+ setpts->var_values[VAR_POS ] = frame->pos == -1 ? NAN : frame->pos;
d = av_expr_eval(setpts->expr, setpts->var_values, NULL);
- outpicref->pts = D2TS(d);
+ frame->pts = D2TS(d);
#ifdef DEBUG
av_log(inlink->dst, AV_LOG_DEBUG,
"n:%"PRId64" interlaced:%d pos:%"PRId64" pts:%"PRId64" t:%f -> pts:%"PRId64" t:%f\n",
(int64_t)setpts->var_values[VAR_N],
(int)setpts->var_values[VAR_INTERLACED],
- inpicref ->pos,
- inpicref ->pts, inpicref ->pts * av_q2d(inlink->time_base),
- outpicref->pts, outpicref->pts * av_q2d(inlink->time_base));
+ frame->pos, in_pts, in_pts * av_q2d(inlink->time_base),
+ frame->pts, frame->pts * av_q2d(inlink->time_base));
#endif
+
setpts->var_values[VAR_N] += 1.0;
- setpts->var_values[VAR_PREV_INPTS ] = TS2D(inpicref ->pts);
- setpts->var_values[VAR_PREV_OUTPTS] = TS2D(outpicref->pts);
- avfilter_start_frame(inlink->dst->outputs[0], outpicref);
+ setpts->var_values[VAR_PREV_INPTS ] = TS2D(in_pts);
+ setpts->var_values[VAR_PREV_OUTPTS] = TS2D(frame->pts);
+ return ff_filter_frame(inlink->dst->outputs[0], frame);
}
static av_cold void uninit(AVFilterContext *ctx)
@@ -138,6 +141,25 @@ static av_cold void uninit(AVFilterContext *ctx)
setpts->expr = NULL;
}
+static const AVFilterPad avfilter_vf_setpts_inputs[] = {
+ {
+ .name = "default",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .get_video_buffer = ff_null_get_video_buffer,
+ .config_props = config_input,
+ .filter_frame = filter_frame,
+ },
+ { NULL }
+};
+
+static const AVFilterPad avfilter_vf_setpts_outputs[] = {
+ {
+ .name = "default",
+ .type = AVMEDIA_TYPE_VIDEO,
+ },
+ { NULL }
+};
+
AVFilter avfilter_vf_setpts = {
.name = "setpts",
.description = NULL_IF_CONFIG_SMALL("Set PTS for the output video frame."),
@@ -146,13 +168,6 @@ AVFilter avfilter_vf_setpts = {
.priv_size = sizeof(SetPTSContext),
- .inputs = (AVFilterPad[]) {{ .name = "default",
- .type = AVMEDIA_TYPE_VIDEO,
- .get_video_buffer = avfilter_null_get_video_buffer,
- .config_props = config_input,
- .start_frame = start_frame, },
- { .name = NULL }},
- .outputs = (AVFilterPad[]) {{ .name = "default",
- .type = AVMEDIA_TYPE_VIDEO, },
- { .name = NULL}},
+ .inputs = avfilter_vf_setpts_inputs,
+ .outputs = avfilter_vf_setpts_outputs,
};
diff --git a/gst-libs/ext/libav/libavfilter/vf_settb.c b/gst-libs/ext/libav/libavfilter/vf_settb.c
index eeb4353..a572072 100644
--- a/gst-libs/ext/libav/libavfilter/vf_settb.c
+++ b/gst-libs/ext/libav/libavfilter/vf_settb.c
@@ -23,14 +23,19 @@
* Set timebase for the output link.
*/
+#include <inttypes.h>
+#include <stdio.h>
+
#include "libavutil/avstring.h"
#include "libavutil/eval.h"
+#include "libavutil/internal.h"
#include "libavutil/mathematics.h"
#include "libavutil/rational.h"
#include "avfilter.h"
#include "internal.h"
+#include "video.h"
-static const char *var_names[] = {
+static const char *const var_names[] = {
"E",
"PHI",
"PI",
@@ -53,7 +58,7 @@ typedef struct {
double var_values[VAR_VARS_NB];
} SetTBContext;
-static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
+static av_cold int init(AVFilterContext *ctx, const char *args)
{
SetTBContext *settb = ctx->priv;
av_strlcpy(settb->tb_expr, "intb", sizeof(settb->tb_expr));
@@ -96,31 +101,48 @@ static int config_output_props(AVFilterLink *outlink)
}
outlink->time_base = time_base;
- av_log(outlink->src, AV_LOG_INFO, "tb:%d/%d -> tb:%d/%d\n",
+ av_log(outlink->src, AV_LOG_VERBOSE, "tb:%d/%d -> tb:%d/%d\n",
inlink ->time_base.num, inlink ->time_base.den,
outlink->time_base.num, outlink->time_base.den);
return 0;
}
-static void start_frame(AVFilterLink *inlink, AVFilterBufferRef *picref)
+static int filter_frame(AVFilterLink *inlink, AVFilterBufferRef *frame)
{
AVFilterContext *ctx = inlink->dst;
AVFilterLink *outlink = ctx->outputs[0];
- AVFilterBufferRef *picref2 = picref;
if (av_cmp_q(inlink->time_base, outlink->time_base)) {
- picref2 = avfilter_ref_buffer(picref, ~0);
- picref2->pts = av_rescale_q(picref->pts, inlink->time_base, outlink->time_base);
+ int64_t orig_pts = frame->pts;
+ frame->pts = av_rescale_q(frame->pts, inlink->time_base, outlink->time_base);
av_log(ctx, AV_LOG_DEBUG, "tb:%d/%d pts:%"PRId64" -> tb:%d/%d pts:%"PRId64"\n",
- inlink ->time_base.num, inlink ->time_base.den, picref ->pts,
- outlink->time_base.num, outlink->time_base.den, picref2->pts);
- avfilter_unref_buffer(picref);
+ inlink ->time_base.num, inlink ->time_base.den, orig_pts,
+ outlink->time_base.num, outlink->time_base.den, frame->pts);
}
- avfilter_start_frame(outlink, picref2);
+ return ff_filter_frame(outlink, frame);
}
+static const AVFilterPad avfilter_vf_settb_inputs[] = {
+ {
+ .name = "default",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .get_video_buffer = ff_null_get_video_buffer,
+ .filter_frame = filter_frame,
+ },
+ { NULL }
+};
+
+static const AVFilterPad avfilter_vf_settb_outputs[] = {
+ {
+ .name = "default",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .config_props = config_output_props,
+ },
+ { NULL }
+};
+
AVFilter avfilter_vf_settb = {
.name = "settb",
.description = NULL_IF_CONFIG_SMALL("Set timebase for the output link."),
@@ -128,15 +150,7 @@ AVFilter avfilter_vf_settb = {
.priv_size = sizeof(SetTBContext),
- .inputs = (AVFilterPad[]) {{ .name = "default",
- .type = AVMEDIA_TYPE_VIDEO,
- .get_video_buffer = avfilter_null_get_video_buffer,
- .start_frame = start_frame,
- .end_frame = avfilter_null_end_frame },
- { .name = NULL }},
-
- .outputs = (AVFilterPad[]) {{ .name = "default",
- .type = AVMEDIA_TYPE_VIDEO,
- .config_props = config_output_props, },
- { .name = NULL}},
+ .inputs = avfilter_vf_settb_inputs,
+
+ .outputs = avfilter_vf_settb_outputs,
};
diff --git a/gst-libs/ext/libav/libavfilter/vf_showinfo.c b/gst-libs/ext/libav/libavfilter/vf_showinfo.c
index aa2a7f1..c89b028 100644
--- a/gst-libs/ext/libav/libavfilter/vf_showinfo.c
+++ b/gst-libs/ext/libav/libavfilter/vf_showinfo.c
@@ -24,37 +24,40 @@
#include "libavutil/adler32.h"
#include "libavutil/imgutils.h"
+#include "libavutil/internal.h"
#include "libavutil/pixdesc.h"
#include "avfilter.h"
+#include "internal.h"
+#include "video.h"
typedef struct {
unsigned int frame;
} ShowInfoContext;
-static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
+static av_cold int init(AVFilterContext *ctx, const char *args)
{
ShowInfoContext *showinfo = ctx->priv;
showinfo->frame = 0;
return 0;
}
-static void end_frame(AVFilterLink *inlink)
+static int filter_frame(AVFilterLink *inlink, AVFilterBufferRef *frame)
{
AVFilterContext *ctx = inlink->dst;
ShowInfoContext *showinfo = ctx->priv;
- AVFilterBufferRef *picref = inlink->cur_buf;
+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format);
uint32_t plane_checksum[4] = {0}, checksum = 0;
- int i, plane, vsub = av_pix_fmt_descriptors[inlink->format].log2_chroma_h;
+ int i, plane, vsub = desc->log2_chroma_h;
- for (plane = 0; picref->data[plane] && plane < 4; plane++) {
- size_t linesize = av_image_get_linesize(picref->format, picref->video->w, plane);
- uint8_t *data = picref->data[plane];
+ for (plane = 0; frame->data[plane] && plane < 4; plane++) {
+ size_t linesize = av_image_get_linesize(frame->format, frame->video->w, plane);
+ uint8_t *data = frame->data[plane];
int h = plane == 1 || plane == 2 ? inlink->h >> vsub : inlink->h;
for (i = 0; i < h; i++) {
plane_checksum[plane] = av_adler32_update(plane_checksum[plane], data, linesize);
checksum = av_adler32_update(checksum, data, linesize);
- data += picref->linesize[plane];
+ data += frame->linesize[plane];
}
}
@@ -63,20 +66,39 @@ static void end_frame(AVFilterLink *inlink)
"fmt:%s sar:%d/%d s:%dx%d i:%c iskey:%d type:%c "
"checksum:%u plane_checksum:[%u %u %u %u]\n",
showinfo->frame,
- picref->pts, picref->pts * av_q2d(inlink->time_base), picref->pos,
- av_pix_fmt_descriptors[picref->format].name,
- picref->video->pixel_aspect.num, picref->video->pixel_aspect.den,
- picref->video->w, picref->video->h,
- !picref->video->interlaced ? 'P' : /* Progressive */
- picref->video->top_field_first ? 'T' : 'B', /* Top / Bottom */
- picref->video->key_frame,
- av_get_picture_type_char(picref->video->pict_type),
+ frame->pts, frame->pts * av_q2d(inlink->time_base), frame->pos,
+ desc->name,
+ frame->video->pixel_aspect.num, frame->video->pixel_aspect.den,
+ frame->video->w, frame->video->h,
+ !frame->video->interlaced ? 'P' : /* Progressive */
+ frame->video->top_field_first ? 'T' : 'B', /* Top / Bottom */
+ frame->video->key_frame,
+ av_get_picture_type_char(frame->video->pict_type),
checksum, plane_checksum[0], plane_checksum[1], plane_checksum[2], plane_checksum[3]);
showinfo->frame++;
- avfilter_end_frame(inlink->dst->outputs[0]);
+ return ff_filter_frame(inlink->dst->outputs[0], frame);
}
+static const AVFilterPad avfilter_vf_showinfo_inputs[] = {
+ {
+ .name = "default",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .get_video_buffer = ff_null_get_video_buffer,
+ .filter_frame = filter_frame,
+ .min_perms = AV_PERM_READ,
+ },
+ { NULL }
+};
+
+static const AVFilterPad avfilter_vf_showinfo_outputs[] = {
+ {
+ .name = "default",
+ .type = AVMEDIA_TYPE_VIDEO
+ },
+ { NULL }
+};
+
AVFilter avfilter_vf_showinfo = {
.name = "showinfo",
.description = NULL_IF_CONFIG_SMALL("Show textual information for each video frame."),
@@ -84,15 +106,7 @@ AVFilter avfilter_vf_showinfo = {
.priv_size = sizeof(ShowInfoContext),
.init = init,
- .inputs = (AVFilterPad[]) {{ .name = "default",
- .type = AVMEDIA_TYPE_VIDEO,
- .get_video_buffer = avfilter_null_get_video_buffer,
- .start_frame = avfilter_null_start_frame,
- .end_frame = end_frame,
- .min_perms = AV_PERM_READ, },
- { .name = NULL}},
+ .inputs = avfilter_vf_showinfo_inputs,
- .outputs = (AVFilterPad[]) {{ .name = "default",
- .type = AVMEDIA_TYPE_VIDEO },
- { .name = NULL}},
+ .outputs = avfilter_vf_showinfo_outputs,
};
diff --git a/gst-libs/ext/libav/libavfilter/vf_slicify.c b/gst-libs/ext/libav/libavfilter/vf_slicify.c
deleted file mode 100644
index cc56fe8..0000000
--- a/gst-libs/ext/libav/libavfilter/vf_slicify.c
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Copyright (c) 2007 Bobby Bingham
- *
- * 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
- * video slicing filter
- */
-
-#include "avfilter.h"
-#include "libavutil/pixdesc.h"
-
-typedef struct {
- int h; ///< output slice height
- int vshift; ///< vertical chroma subsampling shift
- uint32_t lcg_state; ///< LCG state used to compute random slice height
- int use_random_h; ///< enable the use of random slice height values
-} SliceContext;
-
-static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
-{
- SliceContext *slice = ctx->priv;
-
- slice->h = 16;
- if (args) {
- if (!strcmp(args, "random")) {
- slice->use_random_h = 1;
- } else {
- sscanf(args, "%d", &slice->h);
- }
- }
- return 0;
-}
-
-static int config_props(AVFilterLink *link)
-{
- SliceContext *slice = link->dst->priv;
-
- slice->vshift = av_pix_fmt_descriptors[link->format].log2_chroma_h;
-
- return 0;
-}
-
-static void start_frame(AVFilterLink *link, AVFilterBufferRef *picref)
-{
- SliceContext *slice = link->dst->priv;
-
- if (slice->use_random_h) {
- slice->lcg_state = slice->lcg_state * 1664525 + 1013904223;
- slice->h = 8 + (uint64_t)slice->lcg_state * 25 / UINT32_MAX;
- }
-
- /* ensure that slices play nice with chroma subsampling, and enforce
- * a reasonable minimum size for the slices */
- slice->h = FFMAX(8, slice->h & (-1 << slice->vshift));
-
- av_log(link->dst, AV_LOG_DEBUG, "h:%d\n", slice->h);
-
- avfilter_start_frame(link->dst->outputs[0], picref);
-}
-
-static void draw_slice(AVFilterLink *link, int y, int h, int slice_dir)
-{
- SliceContext *slice = link->dst->priv;
- int y2;
-
- if (slice_dir == 1) {
- for (y2 = y; y2 + slice->h <= y + h; y2 += slice->h)
- avfilter_draw_slice(link->dst->outputs[0], y2, slice->h, slice_dir);
-
- if (y2 < y + h)
- avfilter_draw_slice(link->dst->outputs[0], y2, y + h - y2, slice_dir);
- } else if (slice_dir == -1) {
- for (y2 = y + h; y2 - slice->h >= y; y2 -= slice->h)
- avfilter_draw_slice(link->dst->outputs[0], y2 - slice->h, slice->h, slice_dir);
-
- if (y2 > y)
- avfilter_draw_slice(link->dst->outputs[0], y, y2 - y, slice_dir);
- }
-}
-
-AVFilter avfilter_vf_slicify = {
- .name = "slicify",
- .description = NULL_IF_CONFIG_SMALL("Pass the images of input video on to next video filter as multiple slices."),
-
- .init = init,
-
- .priv_size = sizeof(SliceContext),
-
- .inputs = (AVFilterPad[]) {{ .name = "default",
- .type = AVMEDIA_TYPE_VIDEO,
- .get_video_buffer = avfilter_null_get_video_buffer,
- .start_frame = start_frame,
- .draw_slice = draw_slice,
- .config_props = config_props,
- .end_frame = avfilter_null_end_frame, },
- { .name = NULL}},
- .outputs = (AVFilterPad[]) {{ .name = "default",
- .type = AVMEDIA_TYPE_VIDEO, },
- { .name = NULL}},
-};
diff --git a/gst-libs/ext/libav/libavfilter/vf_split.c b/gst-libs/ext/libav/libavfilter/vf_split.c
deleted file mode 100644
index 54fdd21..0000000
--- a/gst-libs/ext/libav/libavfilter/vf_split.c
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright (c) 2007 Bobby Bingham
- *
- * 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
- * Video splitter
- */
-
-#include "avfilter.h"
-
-static void start_frame(AVFilterLink *inlink, AVFilterBufferRef *picref)
-{
- avfilter_start_frame(inlink->dst->outputs[0],
- avfilter_ref_buffer(picref, ~AV_PERM_WRITE));
- avfilter_start_frame(inlink->dst->outputs[1],
- avfilter_ref_buffer(picref, ~AV_PERM_WRITE));
-}
-
-static void draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir)
-{
- avfilter_draw_slice(inlink->dst->outputs[0], y, h, slice_dir);
- avfilter_draw_slice(inlink->dst->outputs[1], y, h, slice_dir);
-}
-
-static void end_frame(AVFilterLink *inlink)
-{
- avfilter_end_frame(inlink->dst->outputs[0]);
- avfilter_end_frame(inlink->dst->outputs[1]);
-
- avfilter_unref_buffer(inlink->cur_buf);
-}
-
-AVFilter avfilter_vf_split = {
- .name = "split",
- .description = NULL_IF_CONFIG_SMALL("Pass on the input to two outputs."),
-
- .inputs = (AVFilterPad[]) {{ .name = "default",
- .type = AVMEDIA_TYPE_VIDEO,
- .get_video_buffer= avfilter_null_get_video_buffer,
- .start_frame = start_frame,
- .draw_slice = draw_slice,
- .end_frame = end_frame, },
- { .name = NULL}},
- .outputs = (AVFilterPad[]) {{ .name = "output1",
- .type = AVMEDIA_TYPE_VIDEO, },
- { .name = "output2",
- .type = AVMEDIA_TYPE_VIDEO, },
- { .name = NULL}},
-};
diff --git a/gst-libs/ext/libav/libavfilter/vf_transpose.c b/gst-libs/ext/libav/libavfilter/vf_transpose.c
index a0ec67c..d7a1739 100644
--- a/gst-libs/ext/libav/libavfilter/vf_transpose.c
+++ b/gst-libs/ext/libav/libavfilter/vf_transpose.c
@@ -25,10 +25,16 @@
* Based on MPlayer libmpcodecs/vf_rotate.c.
*/
+#include <stdio.h>
+
#include "libavutil/intreadwrite.h"
#include "libavutil/pixdesc.h"
#include "libavutil/imgutils.h"
+#include "libavutil/internal.h"
#include "avfilter.h"
+#include "formats.h"
+#include "internal.h"
+#include "video.h"
typedef struct {
int hsub, vsub;
@@ -41,7 +47,7 @@ typedef struct {
int dir;
} TransContext;
-static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
+static av_cold int init(AVFilterContext *ctx, const char *args)
{
TransContext *trans = ctx->priv;
trans->dir = 0;
@@ -59,31 +65,31 @@ static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
static int query_formats(AVFilterContext *ctx)
{
- enum PixelFormat pix_fmts[] = {
- PIX_FMT_ARGB, PIX_FMT_RGBA,
- PIX_FMT_ABGR, PIX_FMT_BGRA,
- PIX_FMT_RGB24, PIX_FMT_BGR24,
- PIX_FMT_RGB565BE, PIX_FMT_RGB565LE,
- PIX_FMT_RGB555BE, PIX_FMT_RGB555LE,
- PIX_FMT_BGR565BE, PIX_FMT_BGR565LE,
- PIX_FMT_BGR555BE, PIX_FMT_BGR555LE,
- PIX_FMT_GRAY16BE, PIX_FMT_GRAY16LE,
- PIX_FMT_YUV420P16LE, PIX_FMT_YUV420P16BE,
- PIX_FMT_YUV422P16LE, PIX_FMT_YUV422P16BE,
- PIX_FMT_YUV444P16LE, PIX_FMT_YUV444P16BE,
- PIX_FMT_NV12, PIX_FMT_NV21,
- PIX_FMT_RGB8, PIX_FMT_BGR8,
- PIX_FMT_RGB4_BYTE, PIX_FMT_BGR4_BYTE,
- PIX_FMT_YUV444P, PIX_FMT_YUV422P,
- PIX_FMT_YUV420P, PIX_FMT_YUVJ420P,
- PIX_FMT_YUV411P, PIX_FMT_YUV410P,
- PIX_FMT_YUVJ444P, PIX_FMT_YUVJ422P,
- PIX_FMT_YUV440P, PIX_FMT_YUVJ440P,
- PIX_FMT_YUVA420P, PIX_FMT_GRAY8,
- PIX_FMT_NONE
+ enum AVPixelFormat pix_fmts[] = {
+ AV_PIX_FMT_ARGB, AV_PIX_FMT_RGBA,
+ AV_PIX_FMT_ABGR, AV_PIX_FMT_BGRA,
+ AV_PIX_FMT_RGB24, AV_PIX_FMT_BGR24,
+ AV_PIX_FMT_RGB565BE, AV_PIX_FMT_RGB565LE,
+ AV_PIX_FMT_RGB555BE, AV_PIX_FMT_RGB555LE,
+ AV_PIX_FMT_BGR565BE, AV_PIX_FMT_BGR565LE,
+ AV_PIX_FMT_BGR555BE, AV_PIX_FMT_BGR555LE,
+ AV_PIX_FMT_GRAY16BE, AV_PIX_FMT_GRAY16LE,
+ AV_PIX_FMT_YUV420P16LE, AV_PIX_FMT_YUV420P16BE,
+ AV_PIX_FMT_YUV422P16LE, AV_PIX_FMT_YUV422P16BE,
+ AV_PIX_FMT_YUV444P16LE, AV_PIX_FMT_YUV444P16BE,
+ AV_PIX_FMT_NV12, AV_PIX_FMT_NV21,
+ AV_PIX_FMT_RGB8, AV_PIX_FMT_BGR8,
+ AV_PIX_FMT_RGB4_BYTE, AV_PIX_FMT_BGR4_BYTE,
+ AV_PIX_FMT_YUV444P, AV_PIX_FMT_YUV422P,
+ AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUVJ420P,
+ AV_PIX_FMT_YUV411P, AV_PIX_FMT_YUV410P,
+ AV_PIX_FMT_YUVJ444P, AV_PIX_FMT_YUVJ422P,
+ AV_PIX_FMT_YUV440P, AV_PIX_FMT_YUVJ440P,
+ AV_PIX_FMT_YUVA420P, AV_PIX_FMT_GRAY8,
+ AV_PIX_FMT_NONE
};
- avfilter_set_common_formats(ctx, avfilter_make_format_list(pix_fmts));
+ ff_set_common_formats(ctx, ff_make_format_list(pix_fmts));
return 0;
}
@@ -92,12 +98,13 @@ static int config_props_output(AVFilterLink *outlink)
AVFilterContext *ctx = outlink->src;
TransContext *trans = ctx->priv;
AVFilterLink *inlink = ctx->inputs[0];
- const AVPixFmtDescriptor *pixdesc = &av_pix_fmt_descriptors[outlink->format];
+ const AVPixFmtDescriptor *desc_out = av_pix_fmt_desc_get(outlink->format);
+ const AVPixFmtDescriptor *desc_in = av_pix_fmt_desc_get(inlink->format);
- trans->hsub = av_pix_fmt_descriptors[inlink->format].log2_chroma_w;
- trans->vsub = av_pix_fmt_descriptors[inlink->format].log2_chroma_h;
+ trans->hsub = desc_in->log2_chroma_w;
+ trans->vsub = desc_in->log2_chroma_h;
- av_image_fill_max_pixsteps(trans->pixsteps, NULL, pixdesc);
+ av_image_fill_max_pixsteps(trans->pixsteps, NULL, desc_out);
outlink->w = inlink->h;
outlink->h = inlink->w;
@@ -107,94 +114,109 @@ static int config_props_output(AVFilterLink *outlink)
} else
outlink->sample_aspect_ratio = inlink->sample_aspect_ratio;
- av_log(ctx, AV_LOG_INFO, "w:%d h:%d dir:%d -> w:%d h:%d rotation:%s vflip:%d\n",
+ av_log(ctx, AV_LOG_VERBOSE, "w:%d h:%d dir:%d -> w:%d h:%d rotation:%s vflip:%d\n",
inlink->w, inlink->h, trans->dir, outlink->w, outlink->h,
trans->dir == 1 || trans->dir == 3 ? "clockwise" : "counterclockwise",
trans->dir == 0 || trans->dir == 3);
return 0;
}
-static void start_frame(AVFilterLink *inlink, AVFilterBufferRef *picref)
+static int filter_frame(AVFilterLink *inlink, AVFilterBufferRef *in)
{
AVFilterLink *outlink = inlink->dst->outputs[0];
+ TransContext *trans = inlink->dst->priv;
+ AVFilterBufferRef *out;
+ int plane;
- outlink->out_buf = avfilter_get_video_buffer(outlink, AV_PERM_WRITE,
- outlink->w, outlink->h);
- outlink->out_buf->pts = picref->pts;
-
- if (picref->video->pixel_aspect.num == 0) {
- outlink->out_buf->video->pixel_aspect = picref->video->pixel_aspect;
- } else {
- outlink->out_buf->video->pixel_aspect.num = picref->video->pixel_aspect.den;
- outlink->out_buf->video->pixel_aspect.den = picref->video->pixel_aspect.num;
+ out = ff_get_video_buffer(outlink, AV_PERM_WRITE, outlink->w, outlink->h);
+ if (!out) {
+ avfilter_unref_bufferp(&in);
+ return AVERROR(ENOMEM);
}
- avfilter_start_frame(outlink, avfilter_ref_buffer(outlink->out_buf, ~0));
-}
+ out->pts = in->pts;
-static void end_frame(AVFilterLink *inlink)
-{
- TransContext *trans = inlink->dst->priv;
- AVFilterBufferRef *inpic = inlink->cur_buf;
- AVFilterBufferRef *outpic = inlink->dst->outputs[0]->out_buf;
- AVFilterLink *outlink = inlink->dst->outputs[0];
- int plane;
+ if (in->video->pixel_aspect.num == 0) {
+ out->video->pixel_aspect = in->video->pixel_aspect;
+ } else {
+ out->video->pixel_aspect.num = in->video->pixel_aspect.den;
+ out->video->pixel_aspect.den = in->video->pixel_aspect.num;
+ }
- for (plane = 0; outpic->data[plane]; plane++) {
+ for (plane = 0; out->data[plane]; plane++) {
int hsub = plane == 1 || plane == 2 ? trans->hsub : 0;
int vsub = plane == 1 || plane == 2 ? trans->vsub : 0;
int pixstep = trans->pixsteps[plane];
- int inh = inpic->video->h>>vsub;
- int outw = outpic->video->w>>hsub;
- int outh = outpic->video->h>>vsub;
- uint8_t *out, *in;
- int outlinesize, inlinesize;
+ int inh = in->video->h>>vsub;
+ int outw = out->video->w>>hsub;
+ int outh = out->video->h>>vsub;
+ uint8_t *dst, *src;
+ int dstlinesize, srclinesize;
int x, y;
- out = outpic->data[plane]; outlinesize = outpic->linesize[plane];
- in = inpic ->data[plane]; inlinesize = inpic ->linesize[plane];
+ dst = out->data[plane];
+ dstlinesize = out->linesize[plane];
+ src = in->data[plane];
+ srclinesize = in->linesize[plane];
if (trans->dir&1) {
- in += inpic->linesize[plane] * (inh-1);
- inlinesize *= -1;
+ src += in->linesize[plane] * (inh-1);
+ srclinesize *= -1;
}
if (trans->dir&2) {
- out += outpic->linesize[plane] * (outh-1);
- outlinesize *= -1;
+ dst += out->linesize[plane] * (outh-1);
+ dstlinesize *= -1;
}
for (y = 0; y < outh; y++) {
switch (pixstep) {
case 1:
for (x = 0; x < outw; x++)
- out[x] = in[x*inlinesize + y];
+ dst[x] = src[x*srclinesize + y];
break;
case 2:
for (x = 0; x < outw; x++)
- *((uint16_t *)(out + 2*x)) = *((uint16_t *)(in + x*inlinesize + y*2));
+ *((uint16_t *)(dst + 2*x)) = *((uint16_t *)(src + x*srclinesize + y*2));
break;
case 3:
for (x = 0; x < outw; x++) {
- int32_t v = AV_RB24(in + x*inlinesize + y*3);
- AV_WB24(out + 3*x, v);
+ int32_t v = AV_RB24(src + x*srclinesize + y*3);
+ AV_WB24(dst + 3*x, v);
}
break;
case 4:
for (x = 0; x < outw; x++)
- *((uint32_t *)(out + 4*x)) = *((uint32_t *)(in + x*inlinesize + y*4));
+ *((uint32_t *)(dst + 4*x)) = *((uint32_t *)(src + x*srclinesize + y*4));
break;
}
- out += outlinesize;
+ dst += dstlinesize;
}
}
- avfilter_unref_buffer(inpic);
- avfilter_draw_slice(outlink, 0, outpic->video->h, 1);
- avfilter_end_frame(outlink);
- avfilter_unref_buffer(outpic);
+ avfilter_unref_bufferp(&in);
+ return ff_filter_frame(outlink, out);
}
+static const AVFilterPad avfilter_vf_transpose_inputs[] = {
+ {
+ .name = "default",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .filter_frame = filter_frame,
+ .min_perms = AV_PERM_READ,
+ },
+ { NULL }
+};
+
+static const AVFilterPad avfilter_vf_transpose_outputs[] = {
+ {
+ .name = "default",
+ .config_props = config_props_output,
+ .type = AVMEDIA_TYPE_VIDEO,
+ },
+ { NULL }
+};
+
AVFilter avfilter_vf_transpose = {
.name = "transpose",
.description = NULL_IF_CONFIG_SMALL("Transpose input video."),
@@ -204,14 +226,6 @@ AVFilter avfilter_vf_transpose = {
.query_formats = query_formats,
- .inputs = (AVFilterPad[]) {{ .name = "default",
- .type = AVMEDIA_TYPE_VIDEO,
- .start_frame = start_frame,
- .end_frame = end_frame,
- .min_perms = AV_PERM_READ, },
- { .name = NULL}},
- .outputs = (AVFilterPad[]) {{ .name = "default",
- .config_props = config_props_output,
- .type = AVMEDIA_TYPE_VIDEO, },
- { .name = NULL}},
+ .inputs = avfilter_vf_transpose_inputs,
+ .outputs = avfilter_vf_transpose_outputs,
};
diff --git a/gst-libs/ext/libav/libavfilter/vf_unsharp.c b/gst-libs/ext/libav/libavfilter/vf_unsharp.c
index a40df13..b446937 100644
--- a/gst-libs/ext/libav/libavfilter/vf_unsharp.c
+++ b/gst-libs/ext/libav/libavfilter/vf_unsharp.c
@@ -37,6 +37,9 @@
*/
#include "avfilter.h"
+#include "formats.h"
+#include "internal.h"
+#include "video.h"
#include "libavutil/common.h"
#include "libavutil/mem.h"
#include "libavutil/pixdesc.h"
@@ -103,8 +106,8 @@ static void apply_unsharp( uint8_t *dst, int dst_stride,
tmp1 = sc[z + 1][x + fp->steps_x] + tmp2; sc[z + 1][x + fp->steps_x] = tmp2;
}
if (x >= fp->steps_x && y >= fp->steps_y) {
- uint8_t* srx = src - fp->steps_y * src_stride + x - fp->steps_x;
- uint8_t* dsx = dst - fp->steps_y * dst_stride + x - fp->steps_x;
+ const uint8_t *srx = src - fp->steps_y * src_stride + x - fp->steps_x;
+ uint8_t *dsx = dst - fp->steps_y * dst_stride + x - fp->steps_x;
res = (int32_t)*srx + ((((int32_t) * srx - (int32_t)((tmp1 + fp->halfscale) >> fp->scalebits)) * fp->amount) >> 16);
*dsx = av_clip_uint8(res);
@@ -129,7 +132,7 @@ static void set_filter_param(FilterParam *fp, int msize_x, int msize_y, double a
fp->halfscale = 1 << (fp->scalebits - 1);
}
-static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
+static av_cold int init(AVFilterContext *ctx, const char *args)
{
UnsharpContext *unsharp = ctx->priv;
int lmsize_x = 5, cmsize_x = 5;
@@ -156,13 +159,13 @@ static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
static int query_formats(AVFilterContext *ctx)
{
- enum PixelFormat pix_fmts[] = {
- PIX_FMT_YUV420P, PIX_FMT_YUV422P, PIX_FMT_YUV444P, PIX_FMT_YUV410P,
- PIX_FMT_YUV411P, PIX_FMT_YUV440P, PIX_FMT_YUVJ420P, PIX_FMT_YUVJ422P,
- PIX_FMT_YUVJ444P, PIX_FMT_YUVJ440P, PIX_FMT_NONE
+ enum AVPixelFormat pix_fmts[] = {
+ AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUV444P, AV_PIX_FMT_YUV410P,
+ AV_PIX_FMT_YUV411P, AV_PIX_FMT_YUV440P, AV_PIX_FMT_YUVJ420P, AV_PIX_FMT_YUVJ422P,
+ AV_PIX_FMT_YUVJ444P, AV_PIX_FMT_YUVJ440P, AV_PIX_FMT_NONE
};
- avfilter_set_common_formats(ctx, avfilter_make_format_list(pix_fmts));
+ ff_set_common_formats(ctx, ff_make_format_list(pix_fmts));
return 0;
}
@@ -174,7 +177,7 @@ static void init_filter_param(AVFilterContext *ctx, FilterParam *fp, const char
effect = fp->amount == 0 ? "none" : fp->amount < 0 ? "blur" : "sharpen";
- av_log(ctx, AV_LOG_INFO, "effect:%s type:%s msize_x:%d msize_y:%d amount:%0.2f\n",
+ av_log(ctx, AV_LOG_VERBOSE, "effect:%s type:%s msize_x:%d msize_y:%d amount:%0.2f\n",
effect, effect_type, fp->msize_x, fp->msize_y, fp->amount / 65535.0);
for (z = 0; z < 2 * fp->steps_y; z++)
@@ -184,9 +187,10 @@ static void init_filter_param(AVFilterContext *ctx, FilterParam *fp, const char
static int config_props(AVFilterLink *link)
{
UnsharpContext *unsharp = link->dst->priv;
+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(link->format);
- unsharp->hsub = av_pix_fmt_descriptors[link->format].log2_chroma_w;
- unsharp->vsub = av_pix_fmt_descriptors[link->format].log2_chroma_h;
+ unsharp->hsub = desc->log2_chroma_w;
+ unsharp->vsub = desc->log2_chroma_h;
init_filter_param(link->dst, &unsharp->luma, "luma", link->w);
init_filter_param(link->dst, &unsharp->chroma, "chroma", SHIFTUP(link->w, unsharp->hsub));
@@ -210,27 +214,47 @@ static av_cold void uninit(AVFilterContext *ctx)
free_filter_param(&unsharp->chroma);
}
-static void end_frame(AVFilterLink *link)
+static int filter_frame(AVFilterLink *link, AVFilterBufferRef *in)
{
UnsharpContext *unsharp = link->dst->priv;
- AVFilterBufferRef *in = link->cur_buf;
- AVFilterBufferRef *out = link->dst->outputs[0]->out_buf;
+ AVFilterLink *outlink = link->dst->outputs[0];
+ AVFilterBufferRef *out;
int cw = SHIFTUP(link->w, unsharp->hsub);
int ch = SHIFTUP(link->h, unsharp->vsub);
+ out = ff_get_video_buffer(outlink, AV_PERM_WRITE, outlink->w, outlink->h);
+ if (!out) {
+ avfilter_unref_bufferp(&in);
+ return AVERROR(ENOMEM);
+ }
+ avfilter_copy_buffer_ref_props(out, in);
+
apply_unsharp(out->data[0], out->linesize[0], in->data[0], in->linesize[0], link->w, link->h, &unsharp->luma);
apply_unsharp(out->data[1], out->linesize[1], in->data[1], in->linesize[1], cw, ch, &unsharp->chroma);
apply_unsharp(out->data[2], out->linesize[2], in->data[2], in->linesize[2], cw, ch, &unsharp->chroma);
- avfilter_unref_buffer(in);
- avfilter_draw_slice(link->dst->outputs[0], 0, link->h, 1);
- avfilter_end_frame(link->dst->outputs[0]);
- avfilter_unref_buffer(out);
+ avfilter_unref_bufferp(&in);
+ return ff_filter_frame(outlink, out);
}
-static void draw_slice(AVFilterLink *link, int y, int h, int slice_dir)
-{
-}
+static const AVFilterPad avfilter_vf_unsharp_inputs[] = {
+ {
+ .name = "default",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .filter_frame = filter_frame,
+ .config_props = config_props,
+ .min_perms = AV_PERM_READ,
+ },
+ { NULL }
+};
+
+static const AVFilterPad avfilter_vf_unsharp_outputs[] = {
+ {
+ .name = "default",
+ .type = AVMEDIA_TYPE_VIDEO,
+ },
+ { NULL }
+};
AVFilter avfilter_vf_unsharp = {
.name = "unsharp",
@@ -242,15 +266,7 @@ AVFilter avfilter_vf_unsharp = {
.uninit = uninit,
.query_formats = query_formats,
- .inputs = (AVFilterPad[]) {{ .name = "default",
- .type = AVMEDIA_TYPE_VIDEO,
- .draw_slice = draw_slice,
- .end_frame = end_frame,
- .config_props = config_props,
- .min_perms = AV_PERM_READ, },
- { .name = NULL}},
-
- .outputs = (AVFilterPad[]) {{ .name = "default",
- .type = AVMEDIA_TYPE_VIDEO, },
- { .name = NULL}},
+ .inputs = avfilter_vf_unsharp_inputs,
+
+ .outputs = avfilter_vf_unsharp_outputs,
};
diff --git a/gst-libs/ext/libav/libavfilter/vf_vflip.c b/gst-libs/ext/libav/libavfilter/vf_vflip.c
index 09ba303..5e6e965 100644
--- a/gst-libs/ext/libav/libavfilter/vf_vflip.c
+++ b/gst-libs/ext/libav/libavfilter/vf_vflip.c
@@ -23,8 +23,11 @@
* video vertical flip filter
*/
+#include "libavutil/internal.h"
#include "libavutil/pixdesc.h"
#include "avfilter.h"
+#include "internal.h"
+#include "video.h"
typedef struct {
int vsub; ///< vertical chroma subsampling
@@ -33,8 +36,9 @@ typedef struct {
static int config_input(AVFilterLink *link)
{
FlipContext *flip = link->dst->priv;
+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(link->format);
- flip->vsub = av_pix_fmt_descriptors[link->format].log2_chroma_h;
+ flip->vsub = desc->log2_chroma_h;
return 0;
}
@@ -47,9 +51,12 @@ static AVFilterBufferRef *get_video_buffer(AVFilterLink *link, int perms,
int i;
if (!(perms & AV_PERM_NEG_LINESIZES))
- return avfilter_default_get_video_buffer(link, perms, w, h);
+ return ff_default_get_video_buffer(link, perms, w, h);
+
+ picref = ff_get_video_buffer(link->dst->outputs[0], perms, w, h);
+ if (!picref)
+ return NULL;
- picref = avfilter_get_video_buffer(link->dst->outputs[0], perms, w, h);
for (i = 0; i < 4; i ++) {
int vsub = i == 1 || i == 2 ? flip->vsub : 0;
@@ -62,30 +69,40 @@ static AVFilterBufferRef *get_video_buffer(AVFilterLink *link, int perms,
return picref;
}
-static void start_frame(AVFilterLink *link, AVFilterBufferRef *inpicref)
+static int filter_frame(AVFilterLink *link, AVFilterBufferRef *frame)
{
FlipContext *flip = link->dst->priv;
- AVFilterBufferRef *outpicref = avfilter_ref_buffer(inpicref, ~0);
int i;
for (i = 0; i < 4; i ++) {
int vsub = i == 1 || i == 2 ? flip->vsub : 0;
- if (outpicref->data[i]) {
- outpicref->data[i] += ((link->h >> vsub)-1) * outpicref->linesize[i];
- outpicref->linesize[i] = -outpicref->linesize[i];
+ if (frame->data[i]) {
+ frame->data[i] += ((link->h >> vsub)-1) * frame->linesize[i];
+ frame->linesize[i] = -frame->linesize[i];
}
}
- avfilter_start_frame(link->dst->outputs[0], outpicref);
+ return ff_filter_frame(link->dst->outputs[0], frame);
}
+static const AVFilterPad avfilter_vf_vflip_inputs[] = {
+ {
+ .name = "default",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .get_video_buffer = get_video_buffer,
+ .filter_frame = filter_frame,
+ .config_props = config_input,
+ },
+ { NULL }
+};
-static void draw_slice(AVFilterLink *link, int y, int h, int slice_dir)
-{
- AVFilterContext *ctx = link->dst;
-
- avfilter_draw_slice(ctx->outputs[0], link->h - (y+h), h, -1 * slice_dir);
-}
+static const AVFilterPad avfilter_vf_vflip_outputs[] = {
+ {
+ .name = "default",
+ .type = AVMEDIA_TYPE_VIDEO,
+ },
+ { NULL }
+};
AVFilter avfilter_vf_vflip = {
.name = "vflip",
@@ -93,14 +110,6 @@ AVFilter avfilter_vf_vflip = {
.priv_size = sizeof(FlipContext),
- .inputs = (AVFilterPad[]) {{ .name = "default",
- .type = AVMEDIA_TYPE_VIDEO,
- .get_video_buffer = get_video_buffer,
- .start_frame = start_frame,
- .draw_slice = draw_slice,
- .config_props = config_input, },
- { .name = NULL}},
- .outputs = (AVFilterPad[]) {{ .name = "default",
- .type = AVMEDIA_TYPE_VIDEO, },
- { .name = NULL}},
+ .inputs = avfilter_vf_vflip_inputs,
+ .outputs = avfilter_vf_vflip_outputs,
};
diff --git a/gst-libs/ext/libav/libavfilter/vf_yadif.c b/gst-libs/ext/libav/libavfilter/vf_yadif.c
index ca2adb2..db9c71c 100644
--- a/gst-libs/ext/libav/libavfilter/vf_yadif.c
+++ b/gst-libs/ext/libav/libavfilter/vf_yadif.c
@@ -23,45 +23,15 @@
#include "libavutil/common.h"
#include "libavutil/pixdesc.h"
#include "avfilter.h"
+#include "formats.h"
+#include "internal.h"
+#include "video.h"
#include "yadif.h"
#undef NDEBUG
#include <assert.h>
-typedef struct {
- /**
- * 0: send 1 frame for each frame
- * 1: send 1 frame for each field
- * 2: like 0 but skips spatial interlacing check
- * 3: like 1 but skips spatial interlacing check
- */
- int mode;
-
- /**
- * 0: top field first
- * 1: bottom field first
- * -1: auto-detection
- */
- int parity;
-
- int frame_pending;
-
- /**
- * 0: deinterlace all frames
- * 1: only deinterlace frames marked as interlaced
- */
- int auto_enable;
-
- AVFilterBufferRef *cur;
- AVFilterBufferRef *next;
- AVFilterBufferRef *prev;
- AVFilterBufferRef *out;
- void (*filter_line)(uint8_t *dst,
- uint8_t *prev, uint8_t *cur, uint8_t *next,
- int w, int prefs, int mrefs, int parity, int mode);
-
- const AVPixFmtDescriptor *csp;
-} YADIFContext;
+#define PERM_RWP AV_PERM_WRITE | AV_PERM_PRESERVE | AV_PERM_REUSE
#define CHECK(j)\
{ int score = FFABS(cur[mrefs-1+(j)] - cur[prefs-1-(j)])\
@@ -79,19 +49,19 @@ typedef struct {
int temporal_diff0 = FFABS(prev2[0] - next2[0]); \
int temporal_diff1 =(FFABS(prev[mrefs] - c) + FFABS(prev[prefs] - e) )>>1; \
int temporal_diff2 =(FFABS(next[mrefs] - c) + FFABS(next[prefs] - e) )>>1; \
- int diff = FFMAX3(temporal_diff0>>1, temporal_diff1, temporal_diff2); \
- int spatial_pred = (c+e)>>1; \
- int spatial_score = FFABS(cur[mrefs-1] - cur[prefs-1]) + FFABS(c-e) \
- + FFABS(cur[mrefs+1] - cur[prefs+1]) - 1; \
+ int diff = FFMAX3(temporal_diff0 >> 1, temporal_diff1, temporal_diff2); \
+ int spatial_pred = (c+e) >> 1; \
+ int spatial_score = FFABS(cur[mrefs - 1] - cur[prefs - 1]) + FFABS(c-e) \
+ + FFABS(cur[mrefs + 1] - cur[prefs + 1]) - 1; \
\
CHECK(-1) CHECK(-2) }} }} \
CHECK( 1) CHECK( 2) }} }} \
\
if (mode < 2) { \
- int b = (prev2[2*mrefs] + next2[2*mrefs])>>1; \
- int f = (prev2[2*prefs] + next2[2*prefs])>>1; \
- int max = FFMAX3(d-e, d-c, FFMIN(b-c, f-e)); \
- int min = FFMIN3(d-e, d-c, FFMAX(b-c, f-e)); \
+ int b = (prev2[2 * mrefs] + next2[2 * mrefs])>>1; \
+ int f = (prev2[2 * prefs] + next2[2 * prefs])>>1; \
+ int max = FFMAX3(d - e, d - c, FFMIN(b - c, f - e)); \
+ int min = FFMIN3(d - e, d - c, FFMAX(b - c, f - e)); \
\
diff = FFMAX3(diff, min, -max); \
} \
@@ -124,7 +94,8 @@ static void filter_line_c(uint8_t *dst,
static void filter_line_c_16bit(uint16_t *dst,
uint16_t *prev, uint16_t *cur, uint16_t *next,
- int w, int prefs, int mrefs, int parity, int mode)
+ int w, int prefs, int mrefs, int parity,
+ int mode)
{
int x;
uint16_t *prev2 = parity ? prev : cur ;
@@ -155,31 +126,34 @@ static void filter(AVFilterContext *ctx, AVFilterBufferRef *dstpic,
for (y = 0; y < h; y++) {
if ((y ^ parity) & 1) {
- uint8_t *prev = &yadif->prev->data[i][y*refs];
- uint8_t *cur = &yadif->cur ->data[i][y*refs];
- uint8_t *next = &yadif->next->data[i][y*refs];
- uint8_t *dst = &dstpic->data[i][y*dstpic->linesize[i]];
- int mode = y==1 || y+2==h ? 2 : yadif->mode;
- yadif->filter_line(dst, prev, cur, next, w, y+1<h ? refs : -refs, y ? -refs : refs, parity ^ tff, mode);
+ uint8_t *prev = &yadif->prev->data[i][y * refs];
+ uint8_t *cur = &yadif->cur ->data[i][y * refs];
+ uint8_t *next = &yadif->next->data[i][y * refs];
+ uint8_t *dst = &dstpic->data[i][y * dstpic->linesize[i]];
+ int mode = y == 1 || y + 2 == h ? 2 : yadif->mode;
+ yadif->filter_line(dst, prev, cur, next, w,
+ y + 1 < h ? refs : -refs,
+ y ? -refs : refs,
+ parity ^ tff, mode);
} else {
- memcpy(&dstpic->data[i][y*dstpic->linesize[i]],
- &yadif->cur->data[i][y*refs], w*df);
+ memcpy(&dstpic->data[i][y * dstpic->linesize[i]],
+ &yadif->cur->data[i][y * refs], w * df);
}
}
}
-#if HAVE_MMX
- __asm__ volatile("emms \n\t" : : : "memory");
-#endif
+
+ emms_c();
}
-static AVFilterBufferRef *get_video_buffer(AVFilterLink *link, int perms, int w, int h)
+static AVFilterBufferRef *get_video_buffer(AVFilterLink *link, int perms,
+ int w, int h)
{
AVFilterBufferRef *picref;
- int width = FFALIGN(w, 32);
- int height= FFALIGN(h+2, 32);
+ int width = FFALIGN(w, 32);
+ int height = FFALIGN(h + 2, 32);
int i;
- picref = avfilter_default_get_video_buffer(link, perms, width, height);
+ picref = ff_default_get_video_buffer(link, perms, width, height);
picref->video->w = w;
picref->video->h = h;
@@ -190,51 +164,52 @@ static AVFilterBufferRef *get_video_buffer(AVFilterLink *link, int perms, int w,
return picref;
}
-static void return_frame(AVFilterContext *ctx, int is_second)
+static int return_frame(AVFilterContext *ctx, int is_second)
{
YADIFContext *yadif = ctx->priv;
- AVFilterLink *link= ctx->outputs[0];
- int tff;
+ AVFilterLink *link = ctx->outputs[0];
+ int tff, ret;
if (yadif->parity == -1) {
tff = yadif->cur->video->interlaced ?
- yadif->cur->video->top_field_first : 1;
+ yadif->cur->video->top_field_first : 1;
} else {
- tff = yadif->parity^1;
+ tff = yadif->parity ^ 1;
}
if (is_second) {
- yadif->out = avfilter_get_video_buffer(link, AV_PERM_WRITE | AV_PERM_PRESERVE |
- AV_PERM_REUSE, link->w, link->h);
+ yadif->out = ff_get_video_buffer(link, PERM_RWP, link->w, link->h);
+ if (!yadif->out)
+ return AVERROR(ENOMEM);
+
avfilter_copy_buffer_ref_props(yadif->out, yadif->cur);
yadif->out->video->interlaced = 0;
}
if (!yadif->csp)
- yadif->csp = &av_pix_fmt_descriptors[link->format];
+ yadif->csp = av_pix_fmt_desc_get(link->format);
if (yadif->csp->comp[0].depth_minus1 / 8 == 1)
yadif->filter_line = filter_line_c_16bit;
filter(ctx, yadif->out, tff ^ !is_second, tff);
if (is_second) {
- if (yadif->next->pts != AV_NOPTS_VALUE &&
- yadif->cur->pts != AV_NOPTS_VALUE) {
- yadif->out->pts =
- (yadif->next->pts&yadif->cur->pts) +
- ((yadif->next->pts^yadif->cur->pts)>>1);
+ int64_t cur_pts = yadif->cur->pts;
+ int64_t next_pts = yadif->next->pts;
+
+ if (next_pts != AV_NOPTS_VALUE && cur_pts != AV_NOPTS_VALUE) {
+ yadif->out->pts = cur_pts + next_pts;
} else {
yadif->out->pts = AV_NOPTS_VALUE;
}
- avfilter_start_frame(ctx->outputs[0], yadif->out);
}
- avfilter_draw_slice(ctx->outputs[0], 0, link->h, 1);
- avfilter_end_frame(ctx->outputs[0]);
+ ret = ff_filter_frame(ctx->outputs[0], yadif->out);
yadif->frame_pending = (yadif->mode&1) && !is_second;
+ return ret;
}
-static void start_frame(AVFilterLink *link, AVFilterBufferRef *picref)
+static int filter_frame(AVFilterLink *link, AVFilterBufferRef *picref)
{
AVFilterContext *ctx = link->dst;
YADIFContext *yadif = ctx->priv;
@@ -249,42 +224,35 @@ static void start_frame(AVFilterLink *link, AVFilterBufferRef *picref)
yadif->next = picref;
if (!yadif->cur)
- return;
+ return 0;
if (yadif->auto_enable && !yadif->cur->video->interlaced) {
yadif->out = avfilter_ref_buffer(yadif->cur, AV_PERM_READ);
- avfilter_unref_buffer(yadif->prev);
- yadif->prev = NULL;
- avfilter_start_frame(ctx->outputs[0], yadif->out);
- return;
+ if (!yadif->out)
+ return AVERROR(ENOMEM);
+
+ avfilter_unref_bufferp(&yadif->prev);
+ if (yadif->out->pts != AV_NOPTS_VALUE)
+ yadif->out->pts *= 2;
+ return ff_filter_frame(ctx->outputs[0], yadif->out);
}
- if (!yadif->prev)
- yadif->prev = avfilter_ref_buffer(yadif->cur, AV_PERM_READ);
+ if (!yadif->prev &&
+ !(yadif->prev = avfilter_ref_buffer(yadif->cur, AV_PERM_READ)))
+ return AVERROR(ENOMEM);
- yadif->out = avfilter_get_video_buffer(ctx->outputs[0], AV_PERM_WRITE | AV_PERM_PRESERVE |
- AV_PERM_REUSE, link->w, link->h);
+ yadif->out = ff_get_video_buffer(ctx->outputs[0], PERM_RWP,
+ link->w, link->h);
+ if (!yadif->out)
+ return AVERROR(ENOMEM);
avfilter_copy_buffer_ref_props(yadif->out, yadif->cur);
yadif->out->video->interlaced = 0;
- avfilter_start_frame(ctx->outputs[0], yadif->out);
-}
-static void end_frame(AVFilterLink *link)
-{
- AVFilterContext *ctx = link->dst;
- YADIFContext *yadif = ctx->priv;
-
- if (!yadif->out)
- return;
+ if (yadif->out->pts != AV_NOPTS_VALUE)
+ yadif->out->pts *= 2;
- if (yadif->auto_enable && !yadif->cur->video->interlaced) {
- avfilter_draw_slice(ctx->outputs[0], 0, link->h, 1);
- avfilter_end_frame(ctx->outputs[0]);
- return;
- }
-
- return_frame(ctx, 0);
+ return return_frame(ctx, 0);
}
static int request_frame(AVFilterLink *link)
@@ -300,8 +268,25 @@ static int request_frame(AVFilterLink *link)
do {
int ret;
- if ((ret = avfilter_request_frame(link->src->inputs[0])))
+ if (yadif->eof)
+ return AVERROR_EOF;
+
+ ret = ff_request_frame(link->src->inputs[0]);
+
+ if (ret == AVERROR_EOF && yadif->next) {
+ AVFilterBufferRef *next =
+ avfilter_ref_buffer(yadif->next, AV_PERM_READ);
+
+ if (!next)
+ return AVERROR(ENOMEM);
+
+ next->pts = yadif->next->pts * 2 - yadif->cur->pts;
+
+ filter_frame(link->src->inputs[0], next);
+ yadif->eof = 1;
+ } else if (ret < 0) {
return ret;
+ }
} while (!yadif->cur);
return 0;
@@ -315,12 +300,17 @@ static int poll_frame(AVFilterLink *link)
if (yadif->frame_pending)
return 1;
- val = avfilter_poll_frame(link->src->inputs[0]);
+ val = ff_poll_frame(link->src->inputs[0]);
+ if (val <= 0)
+ return val;
- if (val==1 && !yadif->next) { //FIXME change API to not requre this red tape
- if ((ret = avfilter_request_frame(link->src->inputs[0])) < 0)
+ //FIXME change API to not requre this red tape
+ if (val == 1 && !yadif->next) {
+ if ((ret = ff_request_frame(link->src->inputs[0])) < 0)
return ret;
- val = avfilter_poll_frame(link->src->inputs[0]);
+ val = ff_poll_frame(link->src->inputs[0]);
+ if (val <= 0)
+ return val;
}
assert(yadif->next || !val);
@@ -334,67 +324,95 @@ static av_cold void uninit(AVFilterContext *ctx)
{
YADIFContext *yadif = ctx->priv;
- if (yadif->prev) avfilter_unref_buffer(yadif->prev);
- if (yadif->cur ) avfilter_unref_buffer(yadif->cur );
- if (yadif->next) avfilter_unref_buffer(yadif->next);
+ if (yadif->prev) avfilter_unref_bufferp(&yadif->prev);
+ if (yadif->cur ) avfilter_unref_bufferp(&yadif->cur );
+ if (yadif->next) avfilter_unref_bufferp(&yadif->next);
}
static int query_formats(AVFilterContext *ctx)
{
- static const enum PixelFormat pix_fmts[] = {
- PIX_FMT_YUV420P,
- PIX_FMT_YUV422P,
- PIX_FMT_YUV444P,
- PIX_FMT_YUV410P,
- PIX_FMT_YUV411P,
- PIX_FMT_GRAY8,
- PIX_FMT_YUVJ420P,
- PIX_FMT_YUVJ422P,
- PIX_FMT_YUVJ444P,
- AV_NE( PIX_FMT_GRAY16BE, PIX_FMT_GRAY16LE ),
- PIX_FMT_YUV440P,
- PIX_FMT_YUVJ440P,
- AV_NE( PIX_FMT_YUV420P10BE, PIX_FMT_YUV420P10LE ),
- AV_NE( PIX_FMT_YUV422P10BE, PIX_FMT_YUV422P10LE ),
- AV_NE( PIX_FMT_YUV444P10BE, PIX_FMT_YUV444P10LE ),
- AV_NE( PIX_FMT_YUV420P16BE, PIX_FMT_YUV420P16LE ),
- AV_NE( PIX_FMT_YUV422P16BE, PIX_FMT_YUV422P16LE ),
- AV_NE( PIX_FMT_YUV444P16BE, PIX_FMT_YUV444P16LE ),
- PIX_FMT_YUVA420P,
- PIX_FMT_NONE
+ static const enum AVPixelFormat pix_fmts[] = {
+ AV_PIX_FMT_YUV420P,
+ AV_PIX_FMT_YUV422P,
+ AV_PIX_FMT_YUV444P,
+ AV_PIX_FMT_YUV410P,
+ AV_PIX_FMT_YUV411P,
+ AV_PIX_FMT_GRAY8,
+ AV_PIX_FMT_YUVJ420P,
+ AV_PIX_FMT_YUVJ422P,
+ AV_PIX_FMT_YUVJ444P,
+ AV_NE( AV_PIX_FMT_GRAY16BE, AV_PIX_FMT_GRAY16LE ),
+ AV_PIX_FMT_YUV440P,
+ AV_PIX_FMT_YUVJ440P,
+ AV_NE( AV_PIX_FMT_YUV420P10BE, AV_PIX_FMT_YUV420P10LE ),
+ AV_NE( AV_PIX_FMT_YUV422P10BE, AV_PIX_FMT_YUV422P10LE ),
+ AV_NE( AV_PIX_FMT_YUV444P10BE, AV_PIX_FMT_YUV444P10LE ),
+ AV_NE( AV_PIX_FMT_YUV420P16BE, AV_PIX_FMT_YUV420P16LE ),
+ AV_NE( AV_PIX_FMT_YUV422P16BE, AV_PIX_FMT_YUV422P16LE ),
+ AV_NE( AV_PIX_FMT_YUV444P16BE, AV_PIX_FMT_YUV444P16LE ),
+ AV_PIX_FMT_YUVA420P,
+ AV_PIX_FMT_NONE
};
- avfilter_set_common_formats(ctx, avfilter_make_format_list(pix_fmts));
+ ff_set_common_formats(ctx, ff_make_format_list(pix_fmts));
return 0;
}
-static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
+static av_cold int init(AVFilterContext *ctx, const char *args)
{
YADIFContext *yadif = ctx->priv;
- av_unused int cpu_flags = av_get_cpu_flags();
yadif->mode = 0;
yadif->parity = -1;
yadif->auto_enable = 0;
yadif->csp = NULL;
- if (args) sscanf(args, "%d:%d:%d", &yadif->mode, &yadif->parity, &yadif->auto_enable);
+ if (args)
+ sscanf(args, "%d:%d:%d",
+ &yadif->mode, &yadif->parity, &yadif->auto_enable);
yadif->filter_line = filter_line_c;
- if (HAVE_SSSE3 && cpu_flags & AV_CPU_FLAG_SSSE3)
- yadif->filter_line = ff_yadif_filter_line_ssse3;
- else if (HAVE_SSE && cpu_flags & AV_CPU_FLAG_SSE2)
- yadif->filter_line = ff_yadif_filter_line_sse2;
- else if (HAVE_MMX && cpu_flags & AV_CPU_FLAG_MMX)
- yadif->filter_line = ff_yadif_filter_line_mmx;
- av_log(ctx, AV_LOG_INFO, "mode:%d parity:%d auto_enable:%d\n", yadif->mode, yadif->parity, yadif->auto_enable);
+ if (ARCH_X86)
+ ff_yadif_init_x86(yadif);
+
+ av_log(ctx, AV_LOG_VERBOSE, "mode:%d parity:%d auto_enable:%d\n",
+ yadif->mode, yadif->parity, yadif->auto_enable);
+
+ return 0;
+}
+
+static int config_props(AVFilterLink *link)
+{
+ link->time_base.num = link->src->inputs[0]->time_base.num;
+ link->time_base.den = link->src->inputs[0]->time_base.den * 2;
+ link->w = link->src->inputs[0]->w;
+ link->h = link->src->inputs[0]->h;
return 0;
}
-static void null_draw_slice(AVFilterLink *link, int y, int h, int slice_dir) { }
+static const AVFilterPad avfilter_vf_yadif_inputs[] = {
+ {
+ .name = "default",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .get_video_buffer = get_video_buffer,
+ .filter_frame = filter_frame,
+ },
+ { NULL }
+};
+
+static const AVFilterPad avfilter_vf_yadif_outputs[] = {
+ {
+ .name = "default",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .poll_frame = poll_frame,
+ .request_frame = request_frame,
+ .config_props = config_props,
+ },
+ { NULL }
+};
AVFilter avfilter_vf_yadif = {
.name = "yadif",
@@ -405,17 +423,7 @@ AVFilter avfilter_vf_yadif = {
.uninit = uninit,
.query_formats = query_formats,
- .inputs = (AVFilterPad[]) {{ .name = "default",
- .type = AVMEDIA_TYPE_VIDEO,
- .start_frame = start_frame,
- .get_video_buffer = get_video_buffer,
- .draw_slice = null_draw_slice,
- .end_frame = end_frame, },
- { .name = NULL}},
-
- .outputs = (AVFilterPad[]) {{ .name = "default",
- .type = AVMEDIA_TYPE_VIDEO,
- .poll_frame = poll_frame,
- .request_frame = request_frame, },
- { .name = NULL}},
+ .inputs = avfilter_vf_yadif_inputs,
+
+ .outputs = avfilter_vf_yadif_outputs,
};
diff --git a/gst-libs/ext/libav/libavfilter/video.c b/gst-libs/ext/libav/libavfilter/video.c
new file mode 100644
index 0000000..cb68ca4
--- /dev/null
+++ b/gst-libs/ext/libav/libavfilter/video.c
@@ -0,0 +1,165 @@
+/*
+ * 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
+ */
+
+#include <string.h>
+#include <stdio.h>
+
+#include "libavutil/imgutils.h"
+#include "libavutil/mem.h"
+
+#include "avfilter.h"
+#include "internal.h"
+#include "video.h"
+
+#ifdef DEBUG
+static char *ff_get_ref_perms_string(char *buf, size_t buf_size, int perms)
+{
+ snprintf(buf, buf_size, "%s%s%s%s%s%s",
+ perms & AV_PERM_READ ? "r" : "",
+ perms & AV_PERM_WRITE ? "w" : "",
+ perms & AV_PERM_PRESERVE ? "p" : "",
+ perms & AV_PERM_REUSE ? "u" : "",
+ perms & AV_PERM_REUSE2 ? "U" : "",
+ perms & AV_PERM_NEG_LINESIZES ? "n" : "");
+ return buf;
+}
+#endif
+
+static void ff_dlog_ref(void *ctx, AVFilterBufferRef *ref, int end)
+{
+ av_unused char buf[16];
+ av_dlog(ctx,
+ "ref[%p buf:%p refcount:%d perms:%s data:%p linesize[%d, %d, %d, %d] pts:%"PRId64" pos:%"PRId64,
+ ref, ref->buf, ref->buf->refcount, ff_get_ref_perms_string(buf, sizeof(buf), ref->perms), ref->data[0],
+ ref->linesize[0], ref->linesize[1], ref->linesize[2], ref->linesize[3],
+ ref->pts, ref->pos);
+
+ if (ref->video) {
+ av_dlog(ctx, " a:%d/%d s:%dx%d i:%c iskey:%d type:%c",
+ ref->video->pixel_aspect.num, ref->video->pixel_aspect.den,
+ ref->video->w, ref->video->h,
+ !ref->video->interlaced ? 'P' : /* Progressive */
+ ref->video->top_field_first ? 'T' : 'B', /* Top / Bottom */
+ ref->video->key_frame,
+ av_get_picture_type_char(ref->video->pict_type));
+ }
+ if (ref->audio) {
+ av_dlog(ctx, " cl:%"PRId64"d n:%d r:%d p:%d",
+ ref->audio->channel_layout,
+ ref->audio->nb_samples,
+ ref->audio->sample_rate,
+ ref->audio->planar);
+ }
+
+ av_dlog(ctx, "]%s", end ? "\n" : "");
+}
+
+AVFilterBufferRef *ff_null_get_video_buffer(AVFilterLink *link, int perms, int w, int h)
+{
+ return ff_get_video_buffer(link->dst->outputs[0], perms, w, h);
+}
+
+/* TODO: set the buffer's priv member to a context structure for the whole
+ * filter chain. This will allow for a buffer pool instead of the constant
+ * alloc & free cycle currently implemented. */
+AVFilterBufferRef *ff_default_get_video_buffer(AVFilterLink *link, int perms, int w, int h)
+{
+ int linesize[4];
+ uint8_t *data[4];
+ AVFilterBufferRef *picref = NULL;
+
+ // +2 is needed for swscaler, +16 to be SIMD-friendly
+ if (av_image_alloc(data, linesize, w, h, link->format, 16) < 0)
+ return NULL;
+
+ picref = avfilter_get_video_buffer_ref_from_arrays(data, linesize,
+ perms, w, h, link->format);
+ if (!picref) {
+ av_free(data[0]);
+ return NULL;
+ }
+
+ return picref;
+}
+
+AVFilterBufferRef *
+avfilter_get_video_buffer_ref_from_arrays(uint8_t *data[4], int linesize[4], int perms,
+ int w, int h, enum AVPixelFormat format)
+{
+ AVFilterBuffer *pic = av_mallocz(sizeof(AVFilterBuffer));
+ AVFilterBufferRef *picref = av_mallocz(sizeof(AVFilterBufferRef));
+
+ if (!pic || !picref)
+ goto fail;
+
+ picref->buf = pic;
+ picref->buf->free = ff_avfilter_default_free_buffer;
+ if (!(picref->video = av_mallocz(sizeof(AVFilterBufferRefVideoProps))))
+ goto fail;
+
+ pic->w = picref->video->w = w;
+ pic->h = picref->video->h = h;
+
+ /* make sure the buffer gets read permission or it's useless for output */
+ picref->perms = perms | AV_PERM_READ;
+
+ pic->refcount = 1;
+ picref->type = AVMEDIA_TYPE_VIDEO;
+ pic->format = picref->format = format;
+
+ memcpy(pic->data, data, 4*sizeof(data[0]));
+ memcpy(pic->linesize, linesize, 4*sizeof(linesize[0]));
+ memcpy(picref->data, pic->data, sizeof(picref->data));
+ memcpy(picref->linesize, pic->linesize, sizeof(picref->linesize));
+
+ pic-> extended_data = pic->data;
+ picref->extended_data = picref->data;
+
+ picref->pts = AV_NOPTS_VALUE;
+
+ return picref;
+
+fail:
+ if (picref && picref->video)
+ av_free(picref->video);
+ av_free(picref);
+ av_free(pic);
+ return NULL;
+}
+
+AVFilterBufferRef *ff_get_video_buffer(AVFilterLink *link, int perms, int w, int h)
+{
+ AVFilterBufferRef *ret = NULL;
+
+ av_unused char buf[16];
+ FF_DPRINTF_START(NULL, get_video_buffer); ff_dlog_link(NULL, link, 0);
+ av_dlog(NULL, " perms:%s w:%d h:%d\n", ff_get_ref_perms_string(buf, sizeof(buf), perms), w, h);
+
+ if (link->dstpad->get_video_buffer)
+ ret = link->dstpad->get_video_buffer(link, perms, w, h);
+
+ if (!ret)
+ ret = ff_default_get_video_buffer(link, perms, w, h);
+
+ if (ret)
+ ret->type = AVMEDIA_TYPE_VIDEO;
+
+ FF_DPRINTF_START(NULL, get_video_buffer); ff_dlog_link(NULL, link, 0); av_dlog(NULL, " returning "); ff_dlog_ref(NULL, ret, 1);
+
+ return ret;
+}
diff --git a/gst-libs/ext/libav/libavfilter/video.h b/gst-libs/ext/libav/libavfilter/video.h
new file mode 100644
index 0000000..be93810
--- /dev/null
+++ b/gst-libs/ext/libav/libavfilter/video.h
@@ -0,0 +1,42 @@
+/*
+ * 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
+ */
+
+#ifndef AVFILTER_VIDEO_H
+#define AVFILTER_VIDEO_H
+
+#include "avfilter.h"
+
+AVFilterBufferRef *ff_default_get_video_buffer(AVFilterLink *link,
+ int perms, int w, int h);
+AVFilterBufferRef *ff_null_get_video_buffer(AVFilterLink *link, int perms, int w, int h);
+
+/**
+ * Request a picture buffer with a specific set of permissions.
+ *
+ * @param link the output link to the filter from which the buffer will
+ * be requested
+ * @param perms the required access permissions
+ * @param w the minimum width of the buffer to allocate
+ * @param h the minimum height of the buffer to allocate
+ * @return A reference to the buffer. This must be unreferenced with
+ * avfilter_unref_buffer when you are finished with it.
+ */
+AVFilterBufferRef *ff_get_video_buffer(AVFilterLink *link, int perms,
+ int w, int h);
+
+#endif /* AVFILTER_VIDEO_H */
diff --git a/gst-libs/ext/libav/libavfilter/vsink_nullsink.c b/gst-libs/ext/libav/libavfilter/vsink_nullsink.c
index bdfcb8a..71d2b3e 100644
--- a/gst-libs/ext/libav/libavfilter/vsink_nullsink.c
+++ b/gst-libs/ext/libav/libavfilter/vsink_nullsink.c
@@ -17,14 +17,23 @@
*/
#include "avfilter.h"
+#include "internal.h"
+#include "libavutil/internal.h"
-static void start_frame(AVFilterLink *link, AVFilterBufferRef *picref)
+static int filter_frame(AVFilterLink *link, AVFilterBufferRef *frame)
{
+ avfilter_unref_bufferp(&frame);
+ return 0;
}
-static void end_frame(AVFilterLink *link)
-{
-}
+static const AVFilterPad avfilter_vsink_nullsink_inputs[] = {
+ {
+ .name = "default",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .filter_frame = filter_frame,
+ },
+ { NULL },
+};
AVFilter avfilter_vsink_nullsink = {
.name = "nullsink",
@@ -32,14 +41,6 @@ AVFilter avfilter_vsink_nullsink = {
.priv_size = 0,
- .inputs = (AVFilterPad[]) {
- {
- .name = "default",
- .type = AVMEDIA_TYPE_VIDEO,
- .start_frame = start_frame,
- .end_frame = end_frame,
- },
- { .name = NULL},
- },
- .outputs = (AVFilterPad[]) {{ .name = NULL }},
+ .inputs = avfilter_vsink_nullsink_inputs,
+ .outputs = NULL,
};
diff --git a/gst-libs/ext/libav/libavfilter/vsrc_buffer.c b/gst-libs/ext/libav/libavfilter/vsrc_buffer.c
deleted file mode 100644
index e5b96a6..0000000
--- a/gst-libs/ext/libav/libavfilter/vsrc_buffer.c
+++ /dev/null
@@ -1,187 +0,0 @@
-/*
- * Copyright (c) 2008 Vitor Sessak
- *
- * 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
- * memory buffer source filter
- */
-
-#include "avfilter.h"
-#include "buffersrc.h"
-#include "vsrc_buffer.h"
-#include "libavutil/imgutils.h"
-
-typedef struct {
- AVFilterBufferRef *buf;
- int h, w;
- enum PixelFormat pix_fmt;
- AVRational time_base; ///< time_base to set in the output link
- AVRational pixel_aspect;
-} BufferSourceContext;
-
-#define CHECK_PARAM_CHANGE(s, c, width, height, format)\
- if (c->w != width || c->h != height || c->pix_fmt != format) {\
- av_log(s, AV_LOG_ERROR, "Changing frame properties on the fly is not supported.\n");\
- return AVERROR(EINVAL);\
- }
-
-int av_vsrc_buffer_add_frame(AVFilterContext *buffer_filter, AVFrame *frame,
- int64_t pts, AVRational pixel_aspect)
-{
- BufferSourceContext *c = buffer_filter->priv;
-
- if (c->buf) {
- av_log(buffer_filter, AV_LOG_ERROR,
- "Buffering several frames is not supported. "
- "Please consume all available frames before adding a new one.\n"
- );
- //return -1;
- }
-
- CHECK_PARAM_CHANGE(buffer_filter, c, frame->width, frame->height, frame->format);
-
- c->buf = avfilter_get_video_buffer(buffer_filter->outputs[0], AV_PERM_WRITE,
- c->w, c->h);
- av_image_copy(c->buf->data, c->buf->linesize, frame->data, frame->linesize,
- c->pix_fmt, c->w, c->h);
-
- avfilter_copy_frame_props(c->buf, frame);
- c->buf->pts = pts;
- c->buf->video->pixel_aspect = pixel_aspect;
-
- return 0;
-}
-
-int av_buffersrc_buffer(AVFilterContext *s, AVFilterBufferRef *buf)
-{
- BufferSourceContext *c = s->priv;
-
- if (c->buf) {
- av_log(s, AV_LOG_ERROR,
- "Buffering several frames is not supported. "
- "Please consume all available frames before adding a new one.\n"
- );
- return AVERROR(EINVAL);
- }
-
- CHECK_PARAM_CHANGE(s, c, buf->video->w, buf->video->h, buf->format);
-
- c->buf = buf;
-
- return 0;
-}
-
-static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
-{
- BufferSourceContext *c = ctx->priv;
- char pix_fmt_str[128];
- int n = 0;
-
- if (!args ||
- (n = sscanf(args, "%d:%d:%127[^:]:%d:%d:%d:%d", &c->w, &c->h, pix_fmt_str,
- &c->time_base.num, &c->time_base.den,
- &c->pixel_aspect.num, &c->pixel_aspect.den)) != 7) {
- av_log(ctx, AV_LOG_ERROR, "Expected 7 arguments, but %d found in '%s'\n", n, args);
- return AVERROR(EINVAL);
- }
- if ((c->pix_fmt = av_get_pix_fmt(pix_fmt_str)) == PIX_FMT_NONE) {
- char *tail;
- c->pix_fmt = strtol(pix_fmt_str, &tail, 10);
- if (*tail || c->pix_fmt < 0 || c->pix_fmt >= PIX_FMT_NB) {
- av_log(ctx, AV_LOG_ERROR, "Invalid pixel format string '%s'\n", pix_fmt_str);
- return AVERROR(EINVAL);
- }
- }
-
- av_log(ctx, AV_LOG_INFO, "w:%d h:%d pixfmt:%s\n", c->w, c->h, av_pix_fmt_descriptors[c->pix_fmt].name);
- return 0;
-}
-
-static av_cold void uninit(AVFilterContext *ctx)
-{
- BufferSourceContext *s = ctx->priv;
- if (s->buf)
- avfilter_unref_buffer(s->buf);
- s->buf = NULL;
-}
-
-static int query_formats(AVFilterContext *ctx)
-{
- BufferSourceContext *c = ctx->priv;
- enum PixelFormat pix_fmts[] = { c->pix_fmt, PIX_FMT_NONE };
-
- avfilter_set_common_formats(ctx, avfilter_make_format_list(pix_fmts));
- return 0;
-}
-
-static int config_props(AVFilterLink *link)
-{
- BufferSourceContext *c = link->src->priv;
-
- link->w = c->w;
- link->h = c->h;
- link->sample_aspect_ratio = c->pixel_aspect;
- link->time_base = c->time_base;
-
- return 0;
-}
-
-static int request_frame(AVFilterLink *link)
-{
- BufferSourceContext *c = link->src->priv;
-
- if (!c->buf) {
- av_log(link->src, AV_LOG_ERROR,
- "request_frame() called with no available frame!\n");
- //return -1;
- }
-
- avfilter_start_frame(link, avfilter_ref_buffer(c->buf, ~0));
- avfilter_draw_slice(link, 0, link->h, 1);
- avfilter_end_frame(link);
- avfilter_unref_buffer(c->buf);
- c->buf = NULL;
-
- return 0;
-}
-
-static int poll_frame(AVFilterLink *link)
-{
- BufferSourceContext *c = link->src->priv;
- return !!c->buf;
-}
-
-AVFilter avfilter_vsrc_buffer = {
- .name = "buffer",
- .description = NULL_IF_CONFIG_SMALL("Buffer video frames, and make them accessible to the filterchain."),
- .priv_size = sizeof(BufferSourceContext),
- .query_formats = query_formats,
-
- .init = init,
- .uninit = uninit,
-
- .inputs = (AVFilterPad[]) {{ .name = NULL }},
- .outputs = (AVFilterPad[]) {{ .name = "default",
- .type = AVMEDIA_TYPE_VIDEO,
- .request_frame = request_frame,
- .poll_frame = poll_frame,
- .config_props = config_props, },
- { .name = NULL}},
-};
diff --git a/gst-libs/ext/libav/libavfilter/vsrc_buffer.h b/gst-libs/ext/libav/libavfilter/vsrc_buffer.h
deleted file mode 100644
index 13a209c..0000000
--- a/gst-libs/ext/libav/libavfilter/vsrc_buffer.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (c) 2008 Vitor Sessak
- *
- * 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
- */
-
-#ifndef AVFILTER_VSRC_BUFFER_H
-#define AVFILTER_VSRC_BUFFER_H
-
-/**
- * @file
- * memory buffer source API for video
- */
-
-#include "libavcodec/avcodec.h" /* AVFrame */
-#include "avfilter.h"
-
-int av_vsrc_buffer_add_frame(AVFilterContext *buffer_filter, AVFrame *frame,
- int64_t pts, AVRational pixel_aspect);
-
-#endif /* AVFILTER_VSRC_BUFFER_H */
diff --git a/gst-libs/ext/libav/libavfilter/vsrc_color.c b/gst-libs/ext/libav/libavfilter/vsrc_color.c
index 94b5a29..c0a4e1c 100644
--- a/gst-libs/ext/libav/libavfilter/vsrc_color.c
+++ b/gst-libs/ext/libav/libavfilter/vsrc_color.c
@@ -23,11 +23,19 @@
* color source
*/
+#include <stdio.h>
+#include <string.h>
+
#include "avfilter.h"
+#include "formats.h"
+#include "internal.h"
+#include "video.h"
#include "libavutil/pixdesc.h"
#include "libavutil/colorspace.h"
#include "libavutil/imgutils.h"
+#include "libavutil/internal.h"
#include "libavutil/mathematics.h"
+#include "libavutil/mem.h"
#include "libavutil/parseutils.h"
#include "drawutils.h"
@@ -41,7 +49,7 @@ typedef struct {
uint64_t pts;
} ColorContext;
-static av_cold int color_init(AVFilterContext *ctx, const char *args, void *opaque)
+static av_cold int color_init(AVFilterContext *ctx, const char *args)
{
ColorContext *color = ctx->priv;
char color_string[128] = "black";
@@ -85,22 +93,22 @@ static av_cold void color_uninit(AVFilterContext *ctx)
static int query_formats(AVFilterContext *ctx)
{
- static const enum PixelFormat pix_fmts[] = {
- PIX_FMT_ARGB, PIX_FMT_RGBA,
- PIX_FMT_ABGR, PIX_FMT_BGRA,
- PIX_FMT_RGB24, PIX_FMT_BGR24,
-
- PIX_FMT_YUV444P, PIX_FMT_YUV422P,
- PIX_FMT_YUV420P, PIX_FMT_YUV411P,
- PIX_FMT_YUV410P, PIX_FMT_YUV440P,
- PIX_FMT_YUVJ444P, PIX_FMT_YUVJ422P,
- PIX_FMT_YUVJ420P, PIX_FMT_YUVJ440P,
- PIX_FMT_YUVA420P,
-
- PIX_FMT_NONE
+ static const enum AVPixelFormat pix_fmts[] = {
+ AV_PIX_FMT_ARGB, AV_PIX_FMT_RGBA,
+ AV_PIX_FMT_ABGR, AV_PIX_FMT_BGRA,
+ AV_PIX_FMT_RGB24, AV_PIX_FMT_BGR24,
+
+ AV_PIX_FMT_YUV444P, AV_PIX_FMT_YUV422P,
+ AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV411P,
+ AV_PIX_FMT_YUV410P, AV_PIX_FMT_YUV440P,
+ AV_PIX_FMT_YUVJ444P, AV_PIX_FMT_YUVJ422P,
+ AV_PIX_FMT_YUVJ420P, AV_PIX_FMT_YUVJ440P,
+ AV_PIX_FMT_YUVA420P,
+
+ AV_PIX_FMT_NONE
};
- avfilter_set_common_formats(ctx, avfilter_make_format_list(pix_fmts));
+ ff_set_common_formats(ctx, ff_make_format_list(pix_fmts));
return 0;
}
@@ -110,7 +118,7 @@ static int color_config_props(AVFilterLink *inlink)
ColorContext *color = ctx->priv;
uint8_t rgba_color[4];
int is_packed_rgba;
- const AVPixFmtDescriptor *pix_desc = &av_pix_fmt_descriptors[inlink->format];
+ const AVPixFmtDescriptor *pix_desc = av_pix_fmt_desc_get(inlink->format);
color->hsub = pix_desc->log2_chroma_w;
color->vsub = pix_desc->log2_chroma_h;
@@ -124,7 +132,7 @@ static int color_config_props(AVFilterLink *inlink)
ff_fill_line_with_color(color->line, color->line_step, color->w, color->color,
inlink->format, rgba_color, &is_packed_rgba, NULL);
- av_log(ctx, AV_LOG_INFO, "w:%d h:%d r:%d/%d color:0x%02x%02x%02x%02x[%s]\n",
+ av_log(ctx, AV_LOG_VERBOSE, "w:%d h:%d r:%d/%d color:0x%02x%02x%02x%02x[%s]\n",
color->w, color->h, color->time_base.den, color->time_base.num,
color->color[0], color->color[1], color->color[2], color->color[3],
is_packed_rgba ? "rgba" : "yuva");
@@ -138,22 +146,31 @@ static int color_config_props(AVFilterLink *inlink)
static int color_request_frame(AVFilterLink *link)
{
ColorContext *color = link->src->priv;
- AVFilterBufferRef *picref = avfilter_get_video_buffer(link, AV_PERM_WRITE, color->w, color->h);
+ AVFilterBufferRef *picref = ff_get_video_buffer(link, AV_PERM_WRITE, color->w, color->h);
+
+ if (!picref)
+ return AVERROR(ENOMEM);
+
picref->video->pixel_aspect = (AVRational) {1, 1};
picref->pts = color->pts++;
picref->pos = -1;
- avfilter_start_frame(link, avfilter_ref_buffer(picref, ~0));
ff_draw_rectangle(picref->data, picref->linesize,
color->line, color->line_step, color->hsub, color->vsub,
0, 0, color->w, color->h);
- avfilter_draw_slice(link, 0, color->h, 1);
- avfilter_end_frame(link);
- avfilter_unref_buffer(picref);
-
- return 0;
+ return ff_filter_frame(link, picref);
}
+static const AVFilterPad avfilter_vsrc_color_outputs[] = {
+ {
+ .name = "default",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .request_frame = color_request_frame,
+ .config_props = color_config_props
+ },
+ { NULL }
+};
+
AVFilter avfilter_vsrc_color = {
.name = "color",
.description = NULL_IF_CONFIG_SMALL("Provide an uniformly colored input, syntax is: [color[:size[:rate]]]"),
@@ -164,11 +181,7 @@ AVFilter avfilter_vsrc_color = {
.query_formats = query_formats,
- .inputs = (AVFilterPad[]) {{ .name = NULL}},
+ .inputs = NULL,
- .outputs = (AVFilterPad[]) {{ .name = "default",
- .type = AVMEDIA_TYPE_VIDEO,
- .request_frame = color_request_frame,
- .config_props = color_config_props },
- { .name = NULL}},
+ .outputs = avfilter_vsrc_color_outputs,
};
diff --git a/gst-libs/ext/libav/libavfilter/vsrc_movie.c b/gst-libs/ext/libav/libavfilter/vsrc_movie.c
index 4ac079c..0023d55 100644
--- a/gst-libs/ext/libav/libavfilter/vsrc_movie.c
+++ b/gst-libs/ext/libav/libavfilter/vsrc_movie.c
@@ -36,6 +36,9 @@
#include "libavutil/imgutils.h"
#include "libavformat/avformat.h"
#include "avfilter.h"
+#include "formats.h"
+#include "internal.h"
+#include "video.h"
typedef struct {
const AVClass *class;
@@ -59,8 +62,8 @@ typedef struct {
static const AVOption movie_options[]= {
{"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 },
+{"stream_index", "set stream index", OFFSET(stream_index), AV_OPT_TYPE_INT, {.i64 = -1}, -1, INT_MAX },
+{"si", "set stream index", OFFSET(stream_index), AV_OPT_TYPE_INT, {.i64 = -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},
@@ -152,14 +155,14 @@ static int movie_init(AVFilterContext *ctx)
movie->w = movie->codec_ctx->width;
movie->h = movie->codec_ctx->height;
- av_log(ctx, AV_LOG_INFO, "seek_point:%"PRIi64" format_name:%s file_name:%s stream_index:%d\n",
+ av_log(ctx, AV_LOG_VERBOSE, "seek_point:%"PRIi64" format_name:%s file_name:%s stream_index:%d\n",
movie->seek_point, movie->format_name, movie->file_name,
movie->stream_index);
return 0;
}
-static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
+static av_cold int init(AVFilterContext *ctx, const char *args)
{
MovieContext *movie = ctx->priv;
int ret;
@@ -194,15 +197,15 @@ static av_cold void uninit(AVFilterContext *ctx)
if (movie->format_ctx)
avformat_close_input(&movie->format_ctx);
avfilter_unref_buffer(movie->picref);
- av_freep(&movie->frame);
+ avcodec_free_frame(&movie->frame);
}
static int query_formats(AVFilterContext *ctx)
{
MovieContext *movie = ctx->priv;
- enum PixelFormat pix_fmts[] = { movie->codec_ctx->pix_fmt, PIX_FMT_NONE };
+ enum AVPixelFormat pix_fmts[] = { movie->codec_ctx->pix_fmt, AV_PIX_FMT_NONE };
- avfilter_set_common_formats(ctx, avfilter_make_format_list(pix_fmts));
+ ff_set_common_formats(ctx, ff_make_format_list(pix_fmts));
return 0;
}
@@ -235,8 +238,8 @@ static int movie_get_frame(AVFilterLink *outlink)
if (frame_decoded) {
/* FIXME: avoid the memcpy */
- movie->picref = avfilter_get_video_buffer(outlink, AV_PERM_WRITE | AV_PERM_PRESERVE |
- AV_PERM_REUSE2, outlink->w, outlink->h);
+ movie->picref = ff_get_video_buffer(outlink, AV_PERM_WRITE | AV_PERM_PRESERVE |
+ AV_PERM_REUSE2, outlink->w, outlink->h);
av_image_copy(movie->picref->data, movie->picref->linesize,
movie->frame->data, movie->frame->linesize,
movie->picref->format, outlink->w, outlink->h);
@@ -252,7 +255,7 @@ static int movie_get_frame(AVFilterLink *outlink)
if (!movie->frame->sample_aspect_ratio.num)
movie->picref->video->pixel_aspect = st->sample_aspect_ratio;
av_dlog(outlink->src,
- "movie_get_frame(): file:'%s' pts:%"PRId64" time:%lf pos:%"PRId64" aspect:%d/%d\n",
+ "movie_get_frame(): file:'%s' pts:%"PRId64" time:%f pos:%"PRId64" aspect:%d/%d\n",
movie->file_name, movie->picref->pts,
(double)movie->picref->pts * av_q2d(st->time_base),
movie->picref->pos,
@@ -276,7 +279,6 @@ static int movie_get_frame(AVFilterLink *outlink)
static int request_frame(AVFilterLink *outlink)
{
- AVFilterBufferRef *outpicref;
MovieContext *movie = outlink->src->priv;
int ret;
@@ -285,16 +287,22 @@ static int request_frame(AVFilterLink *outlink)
if ((ret = movie_get_frame(outlink)) < 0)
return ret;
- outpicref = avfilter_ref_buffer(movie->picref, ~0);
- avfilter_start_frame(outlink, outpicref);
- avfilter_draw_slice(outlink, 0, outlink->h, 1);
- avfilter_end_frame(outlink);
- avfilter_unref_buffer(movie->picref);
+ ret = ff_filter_frame(outlink, movie->picref);
movie->picref = NULL;
- return 0;
+ return ret;
}
+static const AVFilterPad avfilter_vsrc_movie_outputs[] = {
+ {
+ .name = "default",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .request_frame = request_frame,
+ .config_props = config_output_props,
+ },
+ { NULL }
+};
+
AVFilter avfilter_vsrc_movie = {
.name = "movie",
.description = NULL_IF_CONFIG_SMALL("Read from a movie source."),
@@ -303,10 +311,6 @@ AVFilter avfilter_vsrc_movie = {
.uninit = uninit,
.query_formats = query_formats,
- .inputs = (AVFilterPad[]) {{ .name = NULL }},
- .outputs = (AVFilterPad[]) {{ .name = "default",
- .type = AVMEDIA_TYPE_VIDEO,
- .request_frame = request_frame,
- .config_props = config_output_props, },
- { .name = NULL}},
+ .inputs = NULL,
+ .outputs = avfilter_vsrc_movie_outputs,
};
diff --git a/gst-libs/ext/libav/libavfilter/vsrc_nullsrc.c b/gst-libs/ext/libav/libavfilter/vsrc_nullsrc.c
index dfd56fa..79f6d4b 100644
--- a/gst-libs/ext/libav/libavfilter/vsrc_nullsrc.c
+++ b/gst-libs/ext/libav/libavfilter/vsrc_nullsrc.c
@@ -21,13 +21,18 @@
* null video source
*/
+#include <stdio.h>
+
#include "libavutil/avstring.h"
#include "libavutil/eval.h"
+#include "libavutil/internal.h"
#include "libavutil/mathematics.h"
#include "libavutil/parseutils.h"
#include "avfilter.h"
+#include "formats.h"
+#include "internal.h"
-static const char *var_names[] = {
+static const char *const var_names[] = {
"E",
"PHI",
"PI",
@@ -49,7 +54,7 @@ typedef struct {
double var_values[VAR_VARS_NB];
} NullContext;
-static int init(AVFilterContext *ctx, const char *args, void *opaque)
+static int init(AVFilterContext *ctx, const char *args)
{
NullContext *priv = ctx->priv;
@@ -98,7 +103,7 @@ static int config_props(AVFilterLink *outlink)
outlink->h = priv->h;
outlink->time_base = tb;
- av_log(outlink->src, AV_LOG_INFO, "w:%d h:%d tb:%d/%d\n", priv->w, priv->h,
+ av_log(outlink->src, AV_LOG_VERBOSE, "w:%d h:%d tb:%d/%d\n", priv->w, priv->h,
tb.num, tb.den);
return 0;
@@ -109,6 +114,16 @@ static int request_frame(AVFilterLink *link)
return -1;
}
+static const AVFilterPad avfilter_vsrc_nullsrc_outputs[] = {
+ {
+ .name = "default",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .config_props = config_props,
+ .request_frame = request_frame,
+ },
+ { NULL }
+};
+
AVFilter avfilter_vsrc_nullsrc = {
.name = "nullsrc",
.description = NULL_IF_CONFIG_SMALL("Null video source, never return images."),
@@ -116,15 +131,7 @@ AVFilter avfilter_vsrc_nullsrc = {
.init = init,
.priv_size = sizeof(NullContext),
- .inputs = (AVFilterPad[]) {{ .name = NULL}},
+ .inputs = NULL,
- .outputs = (AVFilterPad[]) {
- {
- .name = "default",
- .type = AVMEDIA_TYPE_VIDEO,
- .config_props = config_props,
- .request_frame = request_frame,
- },
- { .name = NULL}
- },
+ .outputs = avfilter_vsrc_nullsrc_outputs,
};
diff --git a/gst-libs/ext/libav/libavfilter/vsrc_testsrc.c b/gst-libs/ext/libav/libavfilter/vsrc_testsrc.c
index 0f5596b..632bd27 100644
--- a/gst-libs/ext/libav/libavfilter/vsrc_testsrc.c
+++ b/gst-libs/ext/libav/libavfilter/vsrc_testsrc.c
@@ -32,11 +32,15 @@
#include <float.h>
+#include "libavutil/common.h"
#include "libavutil/mathematics.h"
#include "libavutil/opt.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/parseutils.h"
#include "avfilter.h"
+#include "formats.h"
+#include "internal.h"
+#include "video.h"
typedef struct {
const AVClass *class;
@@ -58,16 +62,16 @@ typedef struct {
#define OFFSET(x) offsetof(TestSourceContext, x)
static const AVOption testsrc_options[] = {
- { "size", "set video size", OFFSET(size), FF_OPT_TYPE_STRING, {.str = "320x240"}},
- { "s", "set video size", OFFSET(size), FF_OPT_TYPE_STRING, {.str = "320x240"}},
- { "rate", "set video rate", OFFSET(rate), FF_OPT_TYPE_STRING, {.str = "25"}, },
- { "r", "set video rate", OFFSET(rate), FF_OPT_TYPE_STRING, {.str = "25"}, },
- { "duration", "set video duration", OFFSET(duration), FF_OPT_TYPE_STRING, {.str = NULL}, },
- { "sar", "set video sample aspect ratio", OFFSET(sar), FF_OPT_TYPE_RATIONAL, {1}, 0, INT_MAX },
+ { "size", "set video size", OFFSET(size), AV_OPT_TYPE_STRING, {.str = "320x240"}},
+ { "s", "set video size", OFFSET(size), AV_OPT_TYPE_STRING, {.str = "320x240"}},
+ { "rate", "set video rate", OFFSET(rate), AV_OPT_TYPE_STRING, {.str = "25"}, },
+ { "r", "set video rate", OFFSET(rate), AV_OPT_TYPE_STRING, {.str = "25"}, },
+ { "duration", "set video duration", OFFSET(duration), AV_OPT_TYPE_STRING, {.str = NULL}, },
+ { "sar", "set video sample aspect ratio", OFFSET(sar), AV_OPT_TYPE_RATIONAL, {.dbl = 1}, 0, INT_MAX },
{ NULL },
};
-static av_cold int init_common(AVFilterContext *ctx, const char *args, void *opaque)
+static av_cold int init_common(AVFilterContext *ctx, const char *args)
{
TestSourceContext *test = ctx->priv;
AVRational frame_rate_q;
@@ -130,8 +134,10 @@ static int request_frame(AVFilterLink *outlink)
if (test->max_pts >= 0 && test->pts > test->max_pts)
return AVERROR_EOF;
- picref = avfilter_get_video_buffer(outlink, AV_PERM_WRITE,
- test->w, test->h);
+ picref = ff_get_video_buffer(outlink, AV_PERM_WRITE, test->w, test->h);
+ if (!picref)
+ return AVERROR(ENOMEM);
+
picref->pts = test->pts++;
picref->pos = -1;
picref->video->key_frame = 1;
@@ -141,12 +147,7 @@ static int request_frame(AVFilterLink *outlink)
test->nb_frame++;
test->fill_picture_fn(outlink->src, picref);
- avfilter_start_frame(outlink, avfilter_ref_buffer(picref, ~0));
- avfilter_draw_slice(outlink, 0, picref->video->h, 1);
- avfilter_end_frame(outlink);
- avfilter_unref_buffer(picref);
-
- return 0;
+ return ff_filter_frame(outlink, picref);
}
#if CONFIG_TESTSRC_FILTER
@@ -334,24 +335,34 @@ static void test_fill_picture(AVFilterContext *ctx, AVFilterBufferRef *picref)
}
}
-static av_cold int test_init(AVFilterContext *ctx, const char *args, void *opaque)
+static av_cold int test_init(AVFilterContext *ctx, const char *args)
{
TestSourceContext *test = ctx->priv;
test->class = &testsrc_class;
test->fill_picture_fn = test_fill_picture;
- return init_common(ctx, args, opaque);
+ return init_common(ctx, args);
}
static int test_query_formats(AVFilterContext *ctx)
{
- static const enum PixelFormat pix_fmts[] = {
- PIX_FMT_RGB24, PIX_FMT_NONE
+ static const enum AVPixelFormat pix_fmts[] = {
+ AV_PIX_FMT_RGB24, AV_PIX_FMT_NONE
};
- avfilter_set_common_formats(ctx, avfilter_make_format_list(pix_fmts));
+ ff_set_common_formats(ctx, ff_make_format_list(pix_fmts));
return 0;
}
+static const AVFilterPad avfilter_vsrc_testsrc_outputs[] = {
+ {
+ .name = "default",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .request_frame = request_frame,
+ .config_props = config_props,
+ },
+ { NULL }
+};
+
AVFilter avfilter_vsrc_testsrc = {
.name = "testsrc",
.description = NULL_IF_CONFIG_SMALL("Generate test pattern."),
@@ -360,13 +371,9 @@ AVFilter avfilter_vsrc_testsrc = {
.query_formats = test_query_formats,
- .inputs = (AVFilterPad[]) {{ .name = NULL}},
+ .inputs = NULL,
- .outputs = (AVFilterPad[]) {{ .name = "default",
- .type = AVMEDIA_TYPE_VIDEO,
- .request_frame = request_frame,
- .config_props = config_props, },
- { .name = NULL }},
+ .outputs = avfilter_vsrc_testsrc_outputs,
};
#endif /* CONFIG_TESTSRC_FILTER */
@@ -390,29 +397,29 @@ static const AVClass rgbtestsrc_class = {
#define A 3
static void rgbtest_put_pixel(uint8_t *dst, int dst_linesize,
- int x, int y, int r, int g, int b, enum PixelFormat fmt,
+ int x, int y, int r, int g, int b, enum AVPixelFormat fmt,
int rgba_map[4])
{
int32_t v;
uint8_t *p;
switch (fmt) {
- case PIX_FMT_BGR444: ((uint16_t*)(dst + y*dst_linesize))[x] = ((r >> 4) << 8) | ((g >> 4) << 4) | (b >> 4); break;
- case PIX_FMT_RGB444: ((uint16_t*)(dst + y*dst_linesize))[x] = ((b >> 4) << 8) | ((g >> 4) << 4) | (r >> 4); break;
- case PIX_FMT_BGR555: ((uint16_t*)(dst + y*dst_linesize))[x] = ((r>>3)<<10) | ((g>>3)<<5) | (b>>3); break;
- case PIX_FMT_RGB555: ((uint16_t*)(dst + y*dst_linesize))[x] = ((b>>3)<<10) | ((g>>3)<<5) | (r>>3); break;
- case PIX_FMT_BGR565: ((uint16_t*)(dst + y*dst_linesize))[x] = ((r>>3)<<11) | ((g>>2)<<5) | (b>>3); break;
- case PIX_FMT_RGB565: ((uint16_t*)(dst + y*dst_linesize))[x] = ((b>>3)<<11) | ((g>>2)<<5) | (r>>3); break;
- case PIX_FMT_RGB24:
- case PIX_FMT_BGR24:
+ case AV_PIX_FMT_BGR444: ((uint16_t*)(dst + y*dst_linesize))[x] = ((r >> 4) << 8) | ((g >> 4) << 4) | (b >> 4); break;
+ case AV_PIX_FMT_RGB444: ((uint16_t*)(dst + y*dst_linesize))[x] = ((b >> 4) << 8) | ((g >> 4) << 4) | (r >> 4); break;
+ case AV_PIX_FMT_BGR555: ((uint16_t*)(dst + y*dst_linesize))[x] = ((r>>3)<<10) | ((g>>3)<<5) | (b>>3); break;
+ case AV_PIX_FMT_RGB555: ((uint16_t*)(dst + y*dst_linesize))[x] = ((b>>3)<<10) | ((g>>3)<<5) | (r>>3); break;
+ case AV_PIX_FMT_BGR565: ((uint16_t*)(dst + y*dst_linesize))[x] = ((r>>3)<<11) | ((g>>2)<<5) | (b>>3); break;
+ case AV_PIX_FMT_RGB565: ((uint16_t*)(dst + y*dst_linesize))[x] = ((b>>3)<<11) | ((g>>2)<<5) | (r>>3); break;
+ case AV_PIX_FMT_RGB24:
+ case AV_PIX_FMT_BGR24:
v = (r << (rgba_map[R]*8)) + (g << (rgba_map[G]*8)) + (b << (rgba_map[B]*8));
p = dst + 3*x + y*dst_linesize;
AV_WL24(p, v);
break;
- case PIX_FMT_RGBA:
- case PIX_FMT_BGRA:
- case PIX_FMT_ARGB:
- case PIX_FMT_ABGR:
+ case AV_PIX_FMT_RGBA:
+ case AV_PIX_FMT_BGRA:
+ case AV_PIX_FMT_ARGB:
+ case AV_PIX_FMT_ABGR:
v = (r << (rgba_map[R]*8)) + (g << (rgba_map[G]*8)) + (b << (rgba_map[B]*8));
p = dst + 4*x + y*dst_linesize;
AV_WL32(p, v);
@@ -440,26 +447,26 @@ static void rgbtest_fill_picture(AVFilterContext *ctx, AVFilterBufferRef *picref
}
}
-static av_cold int rgbtest_init(AVFilterContext *ctx, const char *args, void *opaque)
+static av_cold int rgbtest_init(AVFilterContext *ctx, const char *args)
{
TestSourceContext *test = ctx->priv;
test->class = &rgbtestsrc_class;
test->fill_picture_fn = rgbtest_fill_picture;
- return init_common(ctx, args, opaque);
+ return init_common(ctx, args);
}
static int rgbtest_query_formats(AVFilterContext *ctx)
{
- static const enum PixelFormat pix_fmts[] = {
- PIX_FMT_RGBA, PIX_FMT_ARGB, PIX_FMT_BGRA, PIX_FMT_ABGR,
- PIX_FMT_BGR24, PIX_FMT_RGB24,
- PIX_FMT_RGB444, PIX_FMT_BGR444,
- PIX_FMT_RGB565, PIX_FMT_BGR565,
- PIX_FMT_RGB555, PIX_FMT_BGR555,
- PIX_FMT_NONE
+ static const enum AVPixelFormat pix_fmts[] = {
+ AV_PIX_FMT_RGBA, AV_PIX_FMT_ARGB, AV_PIX_FMT_BGRA, AV_PIX_FMT_ABGR,
+ AV_PIX_FMT_BGR24, AV_PIX_FMT_RGB24,
+ AV_PIX_FMT_RGB444, AV_PIX_FMT_BGR444,
+ AV_PIX_FMT_RGB565, AV_PIX_FMT_BGR565,
+ AV_PIX_FMT_RGB555, AV_PIX_FMT_BGR555,
+ AV_PIX_FMT_NONE
};
- avfilter_set_common_formats(ctx, avfilter_make_format_list(pix_fmts));
+ ff_set_common_formats(ctx, ff_make_format_list(pix_fmts));
return 0;
}
@@ -468,17 +475,27 @@ static int rgbtest_config_props(AVFilterLink *outlink)
TestSourceContext *test = outlink->src->priv;
switch (outlink->format) {
- case PIX_FMT_ARGB: test->rgba_map[A] = 0; test->rgba_map[R] = 1; test->rgba_map[G] = 2; test->rgba_map[B] = 3; break;
- case PIX_FMT_ABGR: test->rgba_map[A] = 0; test->rgba_map[B] = 1; test->rgba_map[G] = 2; test->rgba_map[R] = 3; break;
- case PIX_FMT_RGBA:
- case PIX_FMT_RGB24: test->rgba_map[R] = 0; test->rgba_map[G] = 1; test->rgba_map[B] = 2; test->rgba_map[A] = 3; break;
- case PIX_FMT_BGRA:
- case PIX_FMT_BGR24: test->rgba_map[B] = 0; test->rgba_map[G] = 1; test->rgba_map[R] = 2; test->rgba_map[A] = 3; break;
+ case AV_PIX_FMT_ARGB: test->rgba_map[A] = 0; test->rgba_map[R] = 1; test->rgba_map[G] = 2; test->rgba_map[B] = 3; break;
+ case AV_PIX_FMT_ABGR: test->rgba_map[A] = 0; test->rgba_map[B] = 1; test->rgba_map[G] = 2; test->rgba_map[R] = 3; break;
+ case AV_PIX_FMT_RGBA:
+ case AV_PIX_FMT_RGB24: test->rgba_map[R] = 0; test->rgba_map[G] = 1; test->rgba_map[B] = 2; test->rgba_map[A] = 3; break;
+ case AV_PIX_FMT_BGRA:
+ case AV_PIX_FMT_BGR24: test->rgba_map[B] = 0; test->rgba_map[G] = 1; test->rgba_map[R] = 2; test->rgba_map[A] = 3; break;
}
return config_props(outlink);
}
+static const AVFilterPad avfilter_vsrc_rgbtestsrc_outputs[] = {
+ {
+ .name = "default",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .request_frame = request_frame,
+ .config_props = rgbtest_config_props,
+ },
+ { NULL }
+};
+
AVFilter avfilter_vsrc_rgbtestsrc = {
.name = "rgbtestsrc",
.description = NULL_IF_CONFIG_SMALL("Generate RGB test pattern."),
@@ -487,13 +504,9 @@ AVFilter avfilter_vsrc_rgbtestsrc = {
.query_formats = rgbtest_query_formats,
- .inputs = (AVFilterPad[]) {{ .name = NULL}},
+ .inputs = NULL,
- .outputs = (AVFilterPad[]) {{ .name = "default",
- .type = AVMEDIA_TYPE_VIDEO,
- .request_frame = request_frame,
- .config_props = rgbtest_config_props, },
- { .name = NULL }},
+ .outputs = avfilter_vsrc_rgbtestsrc_outputs,
};
#endif /* CONFIG_RGBTESTSRC_FILTER */
diff --git a/gst-libs/ext/libav/libavfilter/x86/Makefile b/gst-libs/ext/libav/libavfilter/x86/Makefile
index e98693d..0f08e39 100644
--- a/gst-libs/ext/libav/libavfilter/x86/Makefile
+++ b/gst-libs/ext/libav/libavfilter/x86/Makefile
@@ -1,2 +1,6 @@
-MMX-OBJS-$(CONFIG_YADIF_FILTER) += x86/yadif.o
-MMX-OBJS-$(CONFIG_GRADFUN_FILTER) += x86/gradfun.o
+OBJS-$(CONFIG_GRADFUN_FILTER) += x86/gradfun.o
+OBJS-$(CONFIG_VOLUME_FILTER) += x86/af_volume_init.o
+OBJS-$(CONFIG_YADIF_FILTER) += x86/yadif.o
+
+YASM-OBJS-$(CONFIG_HQDN3D_FILTER) += x86/hqdn3d.o
+YASM-OBJS-$(CONFIG_VOLUME_FILTER) += x86/af_volume.o
diff --git a/gst-libs/ext/libav/libavfilter/x86/af_volume.asm b/gst-libs/ext/libav/libavfilter/x86/af_volume.asm
new file mode 100644
index 0000000..4e5ad22
--- /dev/null
+++ b/gst-libs/ext/libav/libavfilter/x86/af_volume.asm
@@ -0,0 +1,138 @@
+;*****************************************************************************
+;* x86-optimized functions for volume filter
+;* Copyright (c) 2012 Justin Ruggles <justin.ruggles@gmail.com>
+;*
+;* 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
+;******************************************************************************
+
+%include "libavutil/x86/x86util.asm"
+
+SECTION_RODATA 32
+
+pd_1_256: times 4 dq 0x3F70000000000000
+pd_int32_max: times 4 dq 0x41DFFFFFFFC00000
+pw_1: times 8 dw 1
+pw_128: times 8 dw 128
+pq_128: times 2 dq 128
+
+SECTION_TEXT
+
+;------------------------------------------------------------------------------
+; void ff_scale_samples_s16(uint8_t *dst, const uint8_t *src, int len,
+; int volume)
+;------------------------------------------------------------------------------
+
+INIT_XMM sse2
+cglobal scale_samples_s16, 4,4,4, dst, src, len, volume
+ movd m0, volumem
+ pshuflw m0, m0, 0
+ punpcklwd m0, [pw_1]
+ mova m1, [pw_128]
+ lea lenq, [lend*2-mmsize]
+.loop:
+ ; dst[i] = av_clip_int16((src[i] * volume + 128) >> 8);
+ mova m2, [srcq+lenq]
+ punpcklwd m3, m2, m1
+ punpckhwd m2, m1
+ pmaddwd m3, m0
+ pmaddwd m2, m0
+ psrad m3, 8
+ psrad m2, 8
+ packssdw m3, m2
+ mova [dstq+lenq], m3
+ sub lenq, mmsize
+ jge .loop
+ REP_RET
+
+;------------------------------------------------------------------------------
+; void ff_scale_samples_s32(uint8_t *dst, const uint8_t *src, int len,
+; int volume)
+;------------------------------------------------------------------------------
+
+%macro SCALE_SAMPLES_S32 0
+cglobal scale_samples_s32, 4,4,4, dst, src, len, volume
+%if ARCH_X86_32 && cpuflag(avx)
+ vbroadcastss xmm2, volumem
+%else
+ movd xmm2, volumed
+ pshufd xmm2, xmm2, 0
+%endif
+ CVTDQ2PD m2, xmm2
+ mulpd m2, m2, [pd_1_256]
+ mova m3, [pd_int32_max]
+ lea lenq, [lend*4-mmsize]
+.loop:
+ CVTDQ2PD m0, [srcq+lenq ]
+ CVTDQ2PD m1, [srcq+lenq+mmsize/2]
+ mulpd m0, m0, m2
+ mulpd m1, m1, m2
+ minpd m0, m0, m3
+ minpd m1, m1, m3
+ cvtpd2dq xmm0, m0
+ cvtpd2dq xmm1, m1
+%if cpuflag(avx)
+ vmovdqa [dstq+lenq ], xmm0
+ vmovdqa [dstq+lenq+mmsize/2], xmm1
+%else
+ movq [dstq+lenq ], xmm0
+ movq [dstq+lenq+mmsize/2], xmm1
+%endif
+ sub lenq, mmsize
+ jge .loop
+ REP_RET
+%endmacro
+
+INIT_XMM sse2
+%define CVTDQ2PD cvtdq2pd
+SCALE_SAMPLES_S32
+%define CVTDQ2PD vcvtdq2pd
+INIT_YMM avx
+SCALE_SAMPLES_S32
+%undef CVTDQ2PD
+
+; NOTE: This is not bit-identical with the C version because it clips to
+; [-INT_MAX, INT_MAX] instead of [INT_MIN, INT_MAX]
+
+INIT_XMM ssse3, atom
+cglobal scale_samples_s32, 4,4,8, dst, src, len, volume
+ movd m4, volumem
+ pshufd m4, m4, 0
+ mova m5, [pq_128]
+ pxor m6, m6
+ lea lenq, [lend*4-mmsize]
+.loop:
+ ; src[i] = av_clipl_int32((src[i] * volume + 128) >> 8);
+ mova m7, [srcq+lenq]
+ pabsd m3, m7
+ pshufd m0, m3, q0100
+ pshufd m1, m3, q0302
+ pmuludq m0, m4
+ pmuludq m1, m4
+ paddq m0, m5
+ paddq m1, m5
+ psrlq m0, 7
+ psrlq m1, 7
+ shufps m2, m0, m1, q3131
+ shufps m0, m0, m1, q2020
+ pcmpgtd m2, m6
+ por m0, m2
+ psrld m0, 1
+ psignd m0, m7
+ mova [dstq+lenq], m0
+ sub lenq, mmsize
+ jge .loop
+ REP_RET
diff --git a/gst-libs/ext/libav/libavfilter/x86/af_volume_init.c b/gst-libs/ext/libav/libavfilter/x86/af_volume_init.c
new file mode 100644
index 0000000..02bedd2
--- /dev/null
+++ b/gst-libs/ext/libav/libavfilter/x86/af_volume_init.c
@@ -0,0 +1,59 @@
+/*
+ * 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
+ */
+
+#include "config.h"
+#include "libavutil/cpu.h"
+#include "libavutil/samplefmt.h"
+#include "libavutil/x86/cpu.h"
+#include "libavfilter/af_volume.h"
+
+void ff_scale_samples_s16_sse2(uint8_t *dst, const uint8_t *src, int len,
+ int volume);
+
+void ff_scale_samples_s32_sse2(uint8_t *dst, const uint8_t *src, int len,
+ int volume);
+void ff_scale_samples_s32_ssse3_atom(uint8_t *dst, const uint8_t *src, int len,
+ int volume);
+void ff_scale_samples_s32_avx(uint8_t *dst, const uint8_t *src, int len,
+ int volume);
+
+void ff_volume_init_x86(VolumeContext *vol)
+{
+ int mm_flags = av_get_cpu_flags();
+ enum AVSampleFormat sample_fmt = av_get_packed_sample_fmt(vol->sample_fmt);
+
+ if (sample_fmt == AV_SAMPLE_FMT_S16) {
+ if (EXTERNAL_SSE2(mm_flags) && vol->volume_i < 32768) {
+ vol->scale_samples = ff_scale_samples_s16_sse2;
+ vol->samples_align = 8;
+ }
+ } else if (sample_fmt == AV_SAMPLE_FMT_S32) {
+ if (EXTERNAL_SSE2(mm_flags)) {
+ vol->scale_samples = ff_scale_samples_s32_sse2;
+ vol->samples_align = 4;
+ }
+ if (EXTERNAL_SSSE3(mm_flags) && mm_flags & AV_CPU_FLAG_ATOM) {
+ vol->scale_samples = ff_scale_samples_s32_ssse3_atom;
+ vol->samples_align = 4;
+ }
+ if (EXTERNAL_AVX(mm_flags)) {
+ vol->scale_samples = ff_scale_samples_s32_avx;
+ vol->samples_align = 8;
+ }
+ }
+}
diff --git a/gst-libs/ext/libav/libavfilter/x86/gradfun.c b/gst-libs/ext/libav/libavfilter/x86/gradfun.c
index ff3b19d..b4ca86c 100644
--- a/gst-libs/ext/libav/libavfilter/x86/gradfun.c
+++ b/gst-libs/ext/libav/libavfilter/x86/gradfun.c
@@ -18,16 +18,22 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "libavutil/attributes.h"
#include "libavutil/cpu.h"
-#include "libavutil/x86_cpu.h"
+#include "libavutil/mem.h"
+#include "libavutil/x86/asm.h"
#include "libavfilter/gradfun.h"
+#if HAVE_INLINE_ASM
+
DECLARE_ALIGNED(16, static const uint16_t, pw_7f)[8] = {0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F};
DECLARE_ALIGNED(16, static const uint16_t, pw_ff)[8] = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF};
-void ff_gradfun_filter_line_mmx2(uint8_t *dst, uint8_t *src, uint16_t *dc, int width, int thresh, const uint16_t *dithers)
+#if HAVE_MMXEXT_INLINE
+static void gradfun_filter_line_mmxext(uint8_t *dst, uint8_t *src, uint16_t *dc,
+ int width, int thresh,
+ const uint16_t *dithers)
{
-#if HAVE_MMX
intptr_t x;
if (width & 3) {
x = width & ~3;
@@ -70,12 +76,12 @@ void ff_gradfun_filter_line_mmx2(uint8_t *dst, uint8_t *src, uint16_t *dc, int w
"rm"(thresh), "m"(*dithers), "m"(*pw_7f)
:"memory"
);
-#endif
}
+#endif
-void ff_gradfun_filter_line_ssse3(uint8_t *dst, uint8_t *src, uint16_t *dc, int width, int thresh, const uint16_t *dithers)
+#if HAVE_SSSE3_INLINE
+static void gradfun_filter_line_ssse3(uint8_t *dst, uint8_t *src, uint16_t *dc, int width, int thresh, const uint16_t *dithers)
{
-#if HAVE_SSSE3
intptr_t x;
if (width & 7) {
// could be 10% faster if I somehow eliminated this
@@ -117,12 +123,12 @@ void ff_gradfun_filter_line_ssse3(uint8_t *dst, uint8_t *src, uint16_t *dc, int
"rm"(thresh), "m"(*dithers), "m"(*pw_7f)
:"memory"
);
-#endif // HAVE_SSSE3
}
+#endif /* HAVE_SSSE3_INLINE */
-void ff_gradfun_blur_line_sse2(uint16_t *dc, uint16_t *buf, uint16_t *buf1, uint8_t *src, int src_linesize, int width)
+#if HAVE_SSE2_INLINE
+static void gradfun_blur_line_sse2(uint16_t *dc, uint16_t *buf, uint16_t *buf1, uint8_t *src, int src_linesize, int width)
{
-#if HAVE_SSE
#define BLURV(load)\
intptr_t x = -2*width;\
__asm__ volatile(\
@@ -160,5 +166,25 @@ void ff_gradfun_blur_line_sse2(uint16_t *dc, uint16_t *buf, uint16_t *buf1, uint
} else {
BLURV("movdqa");
}
-#endif // HAVE_SSE
+}
+#endif /* HAVE_SSE2_INLINE */
+
+#endif /* HAVE_INLINE_ASM */
+
+av_cold void ff_gradfun_init_x86(GradFunContext *gf)
+{
+ int cpu_flags = av_get_cpu_flags();
+
+#if HAVE_MMXEXT_INLINE
+ if (cpu_flags & AV_CPU_FLAG_MMXEXT)
+ gf->filter_line = gradfun_filter_line_mmxext;
+#endif
+#if HAVE_SSSE3_INLINE
+ if (cpu_flags & AV_CPU_FLAG_SSSE3)
+ gf->filter_line = gradfun_filter_line_ssse3;
+#endif
+#if HAVE_SSE2_INLINE
+ if (cpu_flags & AV_CPU_FLAG_SSE2)
+ gf->blur_line = gradfun_blur_line_sse2;
+#endif
}
diff --git a/gst-libs/ext/libav/libavfilter/x86/hqdn3d.asm b/gst-libs/ext/libav/libavfilter/x86/hqdn3d.asm
new file mode 100644
index 0000000..02632a1
--- /dev/null
+++ b/gst-libs/ext/libav/libavfilter/x86/hqdn3d.asm
@@ -0,0 +1,106 @@
+;******************************************************************************
+;* Copyright (c) 2012 Loren Merritt
+;*
+;* 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
+;******************************************************************************
+
+%include "libavutil/x86/x86util.asm"
+
+SECTION .text
+
+%macro LOWPASS 3 ; prevsample, cursample, lut
+ sub %1q, %2q
+%if lut_bits != 8
+ sar %1q, 8-lut_bits
+%endif
+ movsx %1d, word [%3q+%1q*2]
+ add %1d, %2d
+%endmacro
+
+%macro LOAD 3 ; dstreg, x, bitdepth
+%if %3 == 8
+ movzx %1, byte [srcq+%2]
+%else
+ movzx %1, word [srcq+(%2)*2]
+%endif
+%if %3 != 16
+ shl %1, 16-%3
+ add %1, (1<<(15-%3))-1
+%endif
+%endmacro
+
+%macro HQDN3D_ROW 1 ; bitdepth
+%if ARCH_X86_64
+cglobal hqdn3d_row_%1_x86, 7,10,0, src, dst, lineant, frameant, width, spatial, temporal, pixelant, t0, t1
+%else
+cglobal hqdn3d_row_%1_x86, 7,7,0, src, dst, lineant, frameant, width, spatial, temporal
+%endif
+ %assign bytedepth (%1+7)>>3
+ %assign lut_bits 4+4*(%1/16)
+ dec widthq
+ lea srcq, [srcq+widthq*bytedepth]
+ lea dstq, [dstq+widthq*bytedepth]
+ lea frameantq, [frameantq+widthq*2]
+ lea lineantq, [lineantq+widthq*2]
+ neg widthq
+ %define xq widthq
+%if ARCH_X86_32
+ mov dstmp, dstq
+ mov srcmp, srcq
+ mov frameantmp, frameantq
+ mov lineantmp, lineantq
+ %define dstq r0
+ %define frameantq r0
+ %define lineantq r0
+ %define pixelantq r1
+ %define pixelantd r1d
+ DECLARE_REG_TMP 2,3
+%endif
+ LOAD pixelantd, xq, %1
+ALIGN 16
+.loop:
+ movifnidn srcq, srcmp
+ LOAD t0d, xq+1, %1 ; skip on the last iteration to avoid overread
+.loop2:
+ movifnidn lineantq, lineantmp
+ movzx t1d, word [lineantq+xq*2]
+ LOWPASS t1, pixelant, spatial
+ mov [lineantq+xq*2], t1w
+ LOWPASS pixelant, t0, spatial
+ movifnidn frameantq, frameantmp
+ movzx t0d, word [frameantq+xq*2]
+ LOWPASS t0, t1, temporal
+ mov [frameantq+xq*2], t0w
+ movifnidn dstq, dstmp
+%if %1 != 16
+ shr t0d, 16-%1 ; could eliminate this by storing from t0h, but only with some contraints on register allocation
+%endif
+%if %1 == 8
+ mov [dstq+xq], t0b
+%else
+ mov [dstq+xq*2], t0w
+%endif
+ inc xq
+ jl .loop
+ je .loop2
+ REP_RET
+%endmacro ; HQDN3D_ROW
+
+HQDN3D_ROW 8
+HQDN3D_ROW 9
+HQDN3D_ROW 10
+HQDN3D_ROW 16
diff --git a/gst-libs/ext/libav/libavfilter/x86/yadif.c b/gst-libs/ext/libav/libavfilter/x86/yadif.c
index 7cd7e19..ab1d282 100644
--- a/gst-libs/ext/libav/libavfilter/x86/yadif.c
+++ b/gst-libs/ext/libav/libavfilter/x86/yadif.c
@@ -18,16 +18,21 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+#include "libavutil/attributes.h"
#include "libavutil/cpu.h"
-#include "libavutil/x86_cpu.h"
+#include "libavutil/internal.h"
+#include "libavutil/mem.h"
+#include "libavutil/x86/asm.h"
#include "libavcodec/x86/dsputil_mmx.h"
#include "libavfilter/yadif.h"
+#if HAVE_INLINE_ASM
+
DECLARE_ASM_CONST(16, const xmm_reg, pb_1) = {0x0101010101010101ULL, 0x0101010101010101ULL};
DECLARE_ASM_CONST(16, const xmm_reg, pw_1) = {0x0001000100010001ULL, 0x0001000100010001ULL};
-#if HAVE_SSSE3
-#define COMPILE_TEMPLATE_SSE 1
+#if HAVE_SSSE3_INLINE
+#define COMPILE_TEMPLATE_SSE2 1
#define COMPILE_TEMPLATE_SSSE3 1
#undef RENAME
#define RENAME(a) a ## _ssse3
@@ -35,15 +40,35 @@ DECLARE_ASM_CONST(16, const xmm_reg, pw_1) = {0x0001000100010001ULL, 0x000100010
#undef COMPILE_TEMPLATE_SSSE3
#endif
-#if HAVE_SSE
+#if HAVE_SSE2_INLINE
#undef RENAME
#define RENAME(a) a ## _sse2
#include "yadif_template.c"
-#undef COMPILE_TEMPLATE_SSE
+#undef COMPILE_TEMPLATE_SSE2
#endif
-#if HAVE_MMX
+#if HAVE_MMXEXT_INLINE
#undef RENAME
-#define RENAME(a) a ## _mmx
+#define RENAME(a) a ## _mmxext
#include "yadif_template.c"
#endif
+
+#endif /* HAVE_INLINE_ASM */
+
+av_cold void ff_yadif_init_x86(YADIFContext *yadif)
+{
+ int cpu_flags = av_get_cpu_flags();
+
+#if HAVE_MMXEXT_INLINE
+ if (cpu_flags & AV_CPU_FLAG_MMXEXT)
+ yadif->filter_line = yadif_filter_line_mmxext;
+#endif
+#if HAVE_SSE2_INLINE
+ if (cpu_flags & AV_CPU_FLAG_SSE2)
+ yadif->filter_line = yadif_filter_line_sse2;
+#endif
+#if HAVE_SSSE3_INLINE
+ if (cpu_flags & AV_CPU_FLAG_SSSE3)
+ yadif->filter_line = yadif_filter_line_ssse3;
+#endif
+}
diff --git a/gst-libs/ext/libav/libavfilter/x86/yadif_template.c b/gst-libs/ext/libav/libavfilter/x86/yadif_template.c
index 962a7c7..02b0c9f 100644
--- a/gst-libs/ext/libav/libavfilter/x86/yadif_template.c
+++ b/gst-libs/ext/libav/libavfilter/x86/yadif_template.c
@@ -18,7 +18,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#ifdef COMPILE_TEMPLATE_SSE
+#ifdef COMPILE_TEMPLATE_SSE2
#define MM "%%xmm"
#define MOV "movq"
#define MOVQ "movdqa"
@@ -103,14 +103,11 @@
"por "MM"5, "MM"3 \n\t"\
MOVQ" "MM"3, "MM"1 \n\t"
-void RENAME(ff_yadif_filter_line)(uint8_t *dst,
- uint8_t *prev, uint8_t *cur, uint8_t *next,
- int w, int prefs, int mrefs, int parity, int mode)
+static void RENAME(yadif_filter_line)(uint8_t *dst, uint8_t *prev, uint8_t *cur,
+ uint8_t *next, int w, int prefs,
+ int mrefs, int parity, int mode)
{
- DECLARE_ALIGNED(16, uint8_t, tmp0[16]);
- DECLARE_ALIGNED(16, uint8_t, tmp1[16]);
- DECLARE_ALIGNED(16, uint8_t, tmp2[16]);
- DECLARE_ALIGNED(16, uint8_t, tmp3[16]);
+ DECLARE_ALIGNED(16, uint8_t, tmp)[16*4];
int x;
#define FILTER\
@@ -124,9 +121,9 @@ void RENAME(ff_yadif_filter_line)(uint8_t *dst,
MOVQ" "MM"3, "MM"4 \n\t"\
"paddw "MM"2, "MM"3 \n\t"\
"psraw $1, "MM"3 \n\t" /* d = (prev2[x] + next2[x])>>1 */\
- MOVQ" "MM"0, %[tmp0] \n\t" /* c */\
- MOVQ" "MM"3, %[tmp1] \n\t" /* d */\
- MOVQ" "MM"1, %[tmp2] \n\t" /* e */\
+ MOVQ" "MM"0, (%[tmp]) \n\t" /* c */\
+ MOVQ" "MM"3, 16(%[tmp]) \n\t" /* d */\
+ MOVQ" "MM"1, 32(%[tmp]) \n\t" /* e */\
"psubw "MM"4, "MM"2 \n\t"\
PABS( MM"4", MM"2") /* temporal_diff0 */\
LOAD("(%[prev],%[mrefs])", MM"3") /* prev[x-refs] */\
@@ -148,7 +145,7 @@ void RENAME(ff_yadif_filter_line)(uint8_t *dst,
"paddw "MM"4, "MM"3 \n\t" /* temporal_diff2 */\
"psrlw $1, "MM"3 \n\t"\
"pmaxsw "MM"3, "MM"2 \n\t"\
- MOVQ" "MM"2, %[tmp3] \n\t" /* diff */\
+ MOVQ" "MM"2, 48(%[tmp]) \n\t" /* diff */\
\
"paddw "MM"0, "MM"1 \n\t"\
"paddw "MM"0, "MM"0 \n\t"\
@@ -179,7 +176,7 @@ void RENAME(ff_yadif_filter_line)(uint8_t *dst,
CHECK2\
\
/* if(p->mode<2) ... */\
- MOVQ" %[tmp3], "MM"6 \n\t" /* diff */\
+ MOVQ" 48(%[tmp]), "MM"6 \n\t" /* diff */\
"cmpl $2, %[mode] \n\t"\
"jge 1f \n\t"\
LOAD("(%["prev2"],%[mrefs],2)", MM"2") /* prev2[x-2*refs] */\
@@ -190,9 +187,9 @@ void RENAME(ff_yadif_filter_line)(uint8_t *dst,
"paddw "MM"5, "MM"3 \n\t"\
"psrlw $1, "MM"2 \n\t" /* b */\
"psrlw $1, "MM"3 \n\t" /* f */\
- MOVQ" %[tmp0], "MM"4 \n\t" /* c */\
- MOVQ" %[tmp1], "MM"5 \n\t" /* d */\
- MOVQ" %[tmp2], "MM"7 \n\t" /* e */\
+ MOVQ" (%[tmp]), "MM"4 \n\t" /* c */\
+ MOVQ" 16(%[tmp]), "MM"5 \n\t" /* d */\
+ MOVQ" 32(%[tmp]), "MM"7 \n\t" /* e */\
"psubw "MM"4, "MM"2 \n\t" /* b-c */\
"psubw "MM"7, "MM"3 \n\t" /* f-e */\
MOVQ" "MM"5, "MM"0 \n\t"\
@@ -211,7 +208,7 @@ void RENAME(ff_yadif_filter_line)(uint8_t *dst,
"pmaxsw "MM"4, "MM"6 \n\t" /* diff= MAX3(diff, min, -max); */\
"1: \n\t"\
\
- MOVQ" %[tmp1], "MM"2 \n\t" /* d */\
+ MOVQ" 16(%[tmp]), "MM"2 \n\t" /* d */\
MOVQ" "MM"2, "MM"3 \n\t"\
"psubw "MM"6, "MM"2 \n\t" /* d-diff */\
"paddw "MM"6, "MM"3 \n\t" /* d+diff */\
@@ -219,16 +216,13 @@ void RENAME(ff_yadif_filter_line)(uint8_t *dst,
"pminsw "MM"3, "MM"1 \n\t" /* d = clip(spatial_pred, d-diff, d+diff); */\
"packuswb "MM"1, "MM"1 \n\t"\
\
- :[tmp0]"=m"(tmp0),\
- [tmp1]"=m"(tmp1),\
- [tmp2]"=m"(tmp2),\
- [tmp3]"=m"(tmp3)\
- :[prev] "r"(prev),\
+ ::[prev] "r"(prev),\
[cur] "r"(cur),\
[next] "r"(next),\
[prefs]"r"((x86_reg)prefs),\
[mrefs]"r"((x86_reg)mrefs),\
- [mode] "g"(mode)\
+ [mode] "g"(mode),\
+ [tmp] "r"(tmp)\
);\
__asm__ volatile(MOV" "MM"1, %0" :"=m"(*dst));\
dst += STEP;\
@@ -265,4 +259,3 @@ void RENAME(ff_yadif_filter_line)(uint8_t *dst,
#undef CHECK1
#undef CHECK2
#undef FILTER
-
diff --git a/gst-libs/ext/libav/libavfilter/yadif.h b/gst-libs/ext/libav/libavfilter/yadif.h
index d658b68..06b39c6 100644
--- a/gst-libs/ext/libav/libavfilter/yadif.h
+++ b/gst-libs/ext/libav/libavfilter/yadif.h
@@ -19,18 +19,45 @@
#ifndef AVFILTER_YADIF_H
#define AVFILTER_YADIF_H
+#include "libavutil/pixdesc.h"
#include "avfilter.h"
-void ff_yadif_filter_line_mmx(uint8_t *dst,
- uint8_t *prev, uint8_t *cur, uint8_t *next,
- int w, int prefs, int mrefs, int parity, int mode);
+typedef struct YADIFContext {
+ /**
+ * 0: send 1 frame for each frame
+ * 1: send 1 frame for each field
+ * 2: like 0 but skips spatial interlacing check
+ * 3: like 1 but skips spatial interlacing check
+ */
+ int mode;
-void ff_yadif_filter_line_sse2(uint8_t *dst,
- uint8_t *prev, uint8_t *cur, uint8_t *next,
- int w, int prefs, int mrefs, int parity, int mode);
+ /**
+ * 0: top field first
+ * 1: bottom field first
+ * -1: auto-detection
+ */
+ int parity;
-void ff_yadif_filter_line_ssse3(uint8_t *dst,
- uint8_t *prev, uint8_t *cur, uint8_t *next,
- int w, int prefs, int mrefs, int parity, int mode);
+ int frame_pending;
+
+ /**
+ * 0: deinterlace all frames
+ * 1: only deinterlace frames marked as interlaced
+ */
+ int auto_enable;
+
+ AVFilterBufferRef *cur;
+ AVFilterBufferRef *next;
+ AVFilterBufferRef *prev;
+ AVFilterBufferRef *out;
+ void (*filter_line)(uint8_t *dst,
+ uint8_t *prev, uint8_t *cur, uint8_t *next,
+ int w, int prefs, int mrefs, int parity, int mode);
+
+ const AVPixFmtDescriptor *csp;
+ int eof;
+} YADIFContext;
+
+void ff_yadif_init_x86(YADIFContext *yadif);
#endif /* AVFILTER_YADIF_H */
diff --git a/gst-libs/ext/libav/libavformat/4xm.c b/gst-libs/ext/libav/libavformat/4xm.c
index ccbe3ad..c0b3914 100644
--- a/gst-libs/ext/libav/libavformat/4xm.c
+++ b/gst-libs/ext/libav/libavformat/4xm.c
@@ -57,7 +57,7 @@
#define GET_LIST_HEADER() \
fourcc_tag = avio_rl32(pb); \
- size = avio_rl32(pb); \
+ size = avio_rl32(pb); \
if (fourcc_tag != LIST_TAG) \
return AVERROR_INVALIDDATA; \
fourcc_tag = avio_rl32(pb);
@@ -72,8 +72,6 @@ typedef struct AudioTrack {
} AudioTrack;
typedef struct FourxmDemuxContext {
- int width;
- int height;
int video_stream_index;
int track_count;
AudioTrack *tracks;
@@ -91,8 +89,107 @@ static int fourxm_probe(AVProbeData *p)
return AVPROBE_SCORE_MAX;
}
-static int fourxm_read_header(AVFormatContext *s,
- AVFormatParameters *ap)
+static int parse_vtrk(AVFormatContext *s,
+ FourxmDemuxContext *fourxm, uint8_t *buf, int size,
+ int left)
+{
+ AVStream *st;
+ /* check that there is enough data */
+ if (size != vtrk_SIZE || left < size + 8) {
+ return AVERROR_INVALIDDATA;
+ }
+
+ /* allocate a new AVStream */
+ st = avformat_new_stream(s, NULL);
+ if (!st)
+ return AVERROR(ENOMEM);
+
+ avpriv_set_pts_info(st, 60, 1, fourxm->fps);
+
+ fourxm->video_stream_index = st->index;
+
+ st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
+ st->codec->codec_id = AV_CODEC_ID_4XM;
+ st->codec->extradata_size = 4;
+ st->codec->extradata = av_malloc(4);
+ AV_WL32(st->codec->extradata, AV_RL32(buf + 16));
+ st->codec->width = AV_RL32(buf + 36);
+ st->codec->height = AV_RL32(buf + 40);
+
+ return 0;
+}
+
+
+static int parse_strk(AVFormatContext *s,
+ FourxmDemuxContext *fourxm, uint8_t *buf, int size,
+ int left)
+{
+ AVStream *st;
+ int track;
+ /* check that there is enough data */
+ if (size != strk_SIZE || left < size + 8)
+ return AVERROR_INVALIDDATA;
+
+ track = AV_RL32(buf + 8);
+
+ if ((unsigned)track >= UINT_MAX / sizeof(AudioTrack) - 1) {
+ av_log(s, AV_LOG_ERROR, "current_track too large\n");
+ return AVERROR_INVALIDDATA;
+ }
+ if (track + 1 > fourxm->track_count) {
+ AudioTrack *tmp = av_realloc(fourxm->tracks,
+ (track + 1) * sizeof(AudioTrack));
+ if (!tmp)
+ return AVERROR(ENOMEM);
+ fourxm->tracks = tmp;
+ memset(&fourxm->tracks[fourxm->track_count], 0,
+ sizeof(AudioTrack) * (track + 1 - fourxm->track_count));
+ fourxm->track_count = track + 1;
+ }
+ fourxm->tracks[track].adpcm = AV_RL32(buf + 12);
+ fourxm->tracks[track].channels = AV_RL32(buf + 36);
+ fourxm->tracks[track].sample_rate = AV_RL32(buf + 40);
+ fourxm->tracks[track].bits = AV_RL32(buf + 44);
+ fourxm->tracks[track].audio_pts = 0;
+
+ if (fourxm->tracks[track].channels <= 0 ||
+ fourxm->tracks[track].sample_rate <= 0 ||
+ fourxm->tracks[track].bits < 0) {
+ av_log(s, AV_LOG_ERROR, "audio header invalid\n");
+ return AVERROR_INVALIDDATA;
+ }
+ /* allocate a new AVStream */
+ st = avformat_new_stream(s, NULL);
+ if (!st)
+ return AVERROR(ENOMEM);
+
+ st->id = track;
+ avpriv_set_pts_info(st, 60, 1, fourxm->tracks[track].sample_rate);
+
+ fourxm->tracks[track].stream_index = st->index;
+
+ st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
+ st->codec->codec_tag = 0;
+ st->codec->channels = fourxm->tracks[track].channels;
+ st->codec->sample_rate = fourxm->tracks[track].sample_rate;
+ st->codec->bits_per_coded_sample = fourxm->tracks[track].bits;
+ st->codec->bit_rate = st->codec->channels *
+ st->codec->sample_rate *
+ st->codec->bits_per_coded_sample;
+ st->codec->block_align = st->codec->channels *
+ st->codec->bits_per_coded_sample;
+
+ if (fourxm->tracks[track].adpcm){
+ st->codec->codec_id = AV_CODEC_ID_ADPCM_4XM;
+ } else if (st->codec->bits_per_coded_sample == 8) {
+ st->codec->codec_id = AV_CODEC_ID_PCM_U8;
+ } else
+ st->codec->codec_id = AV_CODEC_ID_PCM_S16LE;
+
+ return 0;
+}
+
+static int fourxm_read_header(AVFormatContext *s)
{
AVIOContext *pb = s->pb;
unsigned int fourcc_tag;
@@ -101,11 +198,10 @@ static int fourxm_read_header(AVFormatContext *s,
FourxmDemuxContext *fourxm = s->priv_data;
unsigned char *header;
int i, ret;
- AVStream *st;
fourxm->track_count = 0;
- fourxm->tracks = NULL;
- fourxm->fps = 1.0;
+ fourxm->tracks = NULL;
+ fourxm->fps = 1.0;
/* skip the first 3 32-bit numbers */
avio_skip(pb, 12);
@@ -120,7 +216,7 @@ static int fourxm_read_header(AVFormatContext *s,
header = av_malloc(header_size);
if (!header)
return AVERROR(ENOMEM);
- if (avio_read(pb, header, header_size) != header_size){
+ if (avio_read(pb, header, header_size) != header_size) {
av_free(header);
return AVERROR(EIO);
}
@@ -128,109 +224,33 @@ static int fourxm_read_header(AVFormatContext *s,
/* take the lazy approach and search for any and all vtrk and strk chunks */
for (i = 0; i < header_size - 8; i++) {
fourcc_tag = AV_RL32(&header[i]);
- size = AV_RL32(&header[i + 4]);
+ size = AV_RL32(&header[i + 4]);
if (fourcc_tag == std__TAG) {
- fourxm->fps = av_int2float(AV_RL32(&header[i + 12]));
- } else if (fourcc_tag == vtrk_TAG) {
- /* check that there is enough data */
- if (size != vtrk_SIZE) {
- ret= AVERROR_INVALIDDATA;
+ if (header_size - i < 16) {
+ ret = AVERROR_INVALIDDATA;
goto fail;
}
- fourxm->width = AV_RL32(&header[i + 36]);
- fourxm->height = AV_RL32(&header[i + 40]);
-
- /* allocate a new AVStream */
- st = avformat_new_stream(s, NULL);
- if (!st){
- ret= AVERROR(ENOMEM);
+ fourxm->fps = av_int2float(AV_RL32(&header[i + 12]));
+ } else if (fourcc_tag == vtrk_TAG) {
+ if ((ret = parse_vtrk(s, fourxm, header + i, size,
+ header_size - i)) < 0)
goto fail;
- }
- avpriv_set_pts_info(st, 60, 1, fourxm->fps);
-
- fourxm->video_stream_index = st->index;
-
- st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
- st->codec->codec_id = CODEC_ID_4XM;
- st->codec->extradata_size = 4;
- st->codec->extradata = av_malloc(4);
- AV_WL32(st->codec->extradata, AV_RL32(&header[i + 16]));
- st->codec->width = fourxm->width;
- st->codec->height = fourxm->height;
i += 8 + size;
} else if (fourcc_tag == strk_TAG) {
- int current_track;
- /* check that there is enough data */
- if (size != strk_SIZE) {
- ret= AVERROR_INVALIDDATA;
- goto fail;
- }
- current_track = AV_RL32(&header[i + 8]);
- if((unsigned)current_track >= UINT_MAX / sizeof(AudioTrack) - 1){
- av_log(s, AV_LOG_ERROR, "current_track too large\n");
- ret= -1;
+ if ((ret = parse_strk(s, fourxm, header + i, size,
+ header_size - i)) < 0)
goto fail;
- }
- if (current_track + 1 > fourxm->track_count) {
- fourxm->tracks = av_realloc(fourxm->tracks,
- (current_track + 1) * sizeof(AudioTrack));
- if (!fourxm->tracks) {
- ret = AVERROR(ENOMEM);
- goto fail;
- }
- memset(&fourxm->tracks[fourxm->track_count], 0,
- sizeof(AudioTrack) * (current_track + 1 - fourxm->track_count));
- fourxm->track_count = current_track + 1;
- }
- fourxm->tracks[current_track].adpcm = AV_RL32(&header[i + 12]);
- fourxm->tracks[current_track].channels = AV_RL32(&header[i + 36]);
- fourxm->tracks[current_track].sample_rate = AV_RL32(&header[i + 40]);
- fourxm->tracks[current_track].bits = AV_RL32(&header[i + 44]);
- fourxm->tracks[current_track].audio_pts = 0;
- if( fourxm->tracks[current_track].channels <= 0
- || fourxm->tracks[current_track].sample_rate <= 0
- || fourxm->tracks[current_track].bits < 0){
- av_log(s, AV_LOG_ERROR, "audio header invalid\n");
- ret= -1;
- goto fail;
- }
- i += 8 + size;
- /* allocate a new AVStream */
- st = avformat_new_stream(s, NULL);
- if (!st){
- ret= AVERROR(ENOMEM);
- goto fail;
- }
-
- st->id = current_track;
- avpriv_set_pts_info(st, 60, 1, fourxm->tracks[current_track].sample_rate);
-
- fourxm->tracks[current_track].stream_index = st->index;
-
- st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
- st->codec->codec_tag = 0;
- st->codec->channels = fourxm->tracks[current_track].channels;
- st->codec->sample_rate = fourxm->tracks[current_track].sample_rate;
- st->codec->bits_per_coded_sample = fourxm->tracks[current_track].bits;
- st->codec->bit_rate = st->codec->channels * st->codec->sample_rate *
- st->codec->bits_per_coded_sample;
- st->codec->block_align = st->codec->channels * st->codec->bits_per_coded_sample;
- if (fourxm->tracks[current_track].adpcm){
- st->codec->codec_id = CODEC_ID_ADPCM_4XM;
- }else if (st->codec->bits_per_coded_sample == 8){
- st->codec->codec_id = CODEC_ID_PCM_U8;
- }else
- st->codec->codec_id = CODEC_ID_PCM_S16LE;
+ i += 8 + size;
}
}
/* skip over the LIST-MOVI chunk (which is where the stream should be */
GET_LIST_HEADER();
- if (fourcc_tag != MOVI_TAG){
- ret= AVERROR_INVALIDDATA;
+ if (fourcc_tag != MOVI_TAG) {
+ ret = AVERROR_INVALIDDATA;
goto fail;
}
@@ -249,7 +269,7 @@ static int fourxm_read_packet(AVFormatContext *s,
AVPacket *pkt)
{
FourxmDemuxContext *fourxm = s->priv_data;
- AVIOContext *pb = s->pb;
+ AVIOContext *pb = s->pb;
unsigned int fourcc_tag;
unsigned int size;
int ret = 0;
@@ -259,18 +279,16 @@ static int fourxm_read_packet(AVFormatContext *s,
int audio_frame_count;
while (!packet_read) {
-
if ((ret = avio_read(s->pb, header, 8)) < 0)
return ret;
fourcc_tag = AV_RL32(&header[0]);
- size = AV_RL32(&header[4]);
+ size = AV_RL32(&header[4]);
if (pb->eof_reached)
return AVERROR(EIO);
switch (fourcc_tag) {
-
case LIST_TAG:
/* this is a good time to bump the video pts */
- fourxm->video_pts ++;
+ fourxm->video_pts++;
/* skip the LIST-* tag and move on to the next fourcc */
avio_rl32(pb);
@@ -287,45 +305,43 @@ static int fourxm_read_packet(AVFormatContext *s,
if (size + 8 < size || av_new_packet(pkt, size + 8))
return AVERROR(EIO);
pkt->stream_index = fourxm->video_stream_index;
- pkt->pts = fourxm->video_pts;
- pkt->pos = avio_tell(s->pb);
+ pkt->pts = fourxm->video_pts;
+ pkt->pos = avio_tell(s->pb);
memcpy(pkt->data, header, 8);
ret = avio_read(s->pb, &pkt->data[8], size);
- if (ret < 0){
+ if (ret < 0) {
av_free_packet(pkt);
- }else
+ } else
packet_read = 1;
break;
case snd__TAG:
track_number = avio_rl32(pb);
avio_skip(pb, 4);
- size-=8;
+ size -= 8;
- if (track_number < fourxm->track_count && fourxm->tracks[track_number].channels>0) {
- ret= av_get_packet(s->pb, pkt, size);
- if(ret<0)
+ if (track_number < fourxm->track_count &&
+ fourxm->tracks[track_number].channels > 0) {
+ ret = av_get_packet(s->pb, pkt, size);
+ if (ret < 0)
return AVERROR(EIO);
pkt->stream_index =
fourxm->tracks[track_number].stream_index;
- pkt->pts = fourxm->tracks[track_number].audio_pts;
+ pkt->pts = fourxm->tracks[track_number].audio_pts;
packet_read = 1;
/* pts accounting */
audio_frame_count = size;
if (fourxm->tracks[track_number].adpcm)
- audio_frame_count -=
- 2 * (fourxm->tracks[track_number].channels);
- audio_frame_count /=
- fourxm->tracks[track_number].channels;
- if (fourxm->tracks[track_number].adpcm){
+ audio_frame_count -= 2 * (fourxm->tracks[track_number].channels);
+ audio_frame_count /= fourxm->tracks[track_number].channels;
+ if (fourxm->tracks[track_number].adpcm) {
audio_frame_count *= 2;
- }else
+ } else
audio_frame_count /=
- (fourxm->tracks[track_number].bits / 8);
+ (fourxm->tracks[track_number].bits / 8);
fourxm->tracks[track_number].audio_pts += audio_frame_count;
-
} else {
avio_skip(pb, size);
}
@@ -350,7 +366,7 @@ static int fourxm_read_close(AVFormatContext *s)
AVInputFormat ff_fourxm_demuxer = {
.name = "4xm",
- .long_name = NULL_IF_CONFIG_SMALL("4X Technologies format"),
+ .long_name = NULL_IF_CONFIG_SMALL("4X Technologies"),
.priv_data_size = sizeof(FourxmDemuxContext),
.read_probe = fourxm_probe,
.read_header = fourxm_read_header,
diff --git a/gst-libs/ext/libav/libavformat/Makefile b/gst-libs/ext/libav/libavformat/Makefile
index c850bf4..14e3e1e 100644
--- a/gst-libs/ext/libav/libavformat/Makefile
+++ b/gst-libs/ext/libav/libavformat/Makefile
@@ -1,13 +1,19 @@
NAME = avformat
FFLIBS = avcodec avutil
-HEADERS = avformat.h avio.h version.h
+HEADERS = avformat.h \
+ avio.h \
+ version.h \
OBJS = allformats.o \
+ avio.o \
+ aviobuf.o \
cutils.o \
id3v1.o \
id3v2.o \
+ log2_tab.o \
metadata.o \
+ mux.o \
options.o \
os_support.o \
riff.o \
@@ -16,9 +22,29 @@ OBJS = allformats.o \
utils.o \
OBJS-$(CONFIG_NETWORK) += network.o
+OBJS-$(CONFIG_RTPDEC) += rdt.o \
+ rtp.o \
+ rtpdec.o \
+ rtpdec_amr.o \
+ rtpdec_asf.o \
+ rtpdec_g726.o \
+ rtpdec_h263.o \
+ rtpdec_h263_rfc2190.o \
+ rtpdec_h264.o \
+ rtpdec_ilbc.o \
+ rtpdec_jpeg.o \
+ rtpdec_latm.o \
+ rtpdec_mpeg4.o \
+ rtpdec_qcelp.o \
+ rtpdec_qdm2.o \
+ rtpdec_qt.o \
+ rtpdec_svq3.o \
+ rtpdec_vp8.o \
+ rtpdec_xiph.o
+OBJS-$(CONFIG_RTPENC_CHAIN) += rtpenc_chain.o rtp.o
# muxers/demuxers
-OBJS-$(CONFIG_A64_MUXER) += a64.o
+OBJS-$(CONFIG_A64_MUXER) += a64.o rawenc.o
OBJS-$(CONFIG_AAC_DEMUXER) += aacdec.o rawdec.o
OBJS-$(CONFIG_AC3_DEMUXER) += ac3dec.o rawdec.o
OBJS-$(CONFIG_AC3_MUXER) += rawenc.o
@@ -32,8 +58,7 @@ OBJS-$(CONFIG_AMR_DEMUXER) += amr.o
OBJS-$(CONFIG_AMR_MUXER) += amr.o
OBJS-$(CONFIG_ANM_DEMUXER) += anm.o
OBJS-$(CONFIG_APC_DEMUXER) += apc.o
-OBJS-$(CONFIG_APE_DEMUXER) += ape.o apetag.o
-OBJS-$(CONFIG_APPLEHTTP_DEMUXER) += applehttp.o
+OBJS-$(CONFIG_APE_DEMUXER) += ape.o apetag.o img2.o
OBJS-$(CONFIG_ASF_DEMUXER) += asfdec.o asf.o asfcrypt.o \
avlanguage.o
OBJS-$(CONFIG_ASF_MUXER) += asfenc.o asf.o
@@ -44,7 +69,7 @@ OBJS-$(CONFIG_AU_MUXER) += au.o
OBJS-$(CONFIG_AVI_DEMUXER) += avidec.o
OBJS-$(CONFIG_AVI_MUXER) += avienc.o
OBJS-$(CONFIG_AVISYNTH) += avisynth.o
-OBJS-$(CONFIG_AVM2_MUXER) += swfenc.o
+OBJS-$(CONFIG_AVM2_MUXER) += swfenc.o swf.o
OBJS-$(CONFIG_AVS_DEMUXER) += avs.o vocdec.o voc.o
OBJS-$(CONFIG_BETHSOFTVID_DEMUXER) += bethsoftvid.o
OBJS-$(CONFIG_BFI_DEMUXER) += bfi.o
@@ -56,6 +81,7 @@ OBJS-$(CONFIG_CAF_DEMUXER) += cafdec.o caf.o mov.o mov_chan.o \
OBJS-$(CONFIG_CAVSVIDEO_DEMUXER) += cavsvideodec.o rawdec.o
OBJS-$(CONFIG_CAVSVIDEO_MUXER) += rawenc.o
OBJS-$(CONFIG_CDG_DEMUXER) += cdg.o
+OBJS-$(CONFIG_CDXL_DEMUXER) += cdxl.o
OBJS-$(CONFIG_CRC_MUXER) += crcenc.o
OBJS-$(CONFIG_DAUD_DEMUXER) += daud.o
OBJS-$(CONFIG_DAUD_MUXER) += daud.o
@@ -89,26 +115,31 @@ OBJS-$(CONFIG_FLIC_DEMUXER) += flic.o
OBJS-$(CONFIG_FLV_DEMUXER) += flvdec.o
OBJS-$(CONFIG_FLV_MUXER) += flvenc.o avc.o
OBJS-$(CONFIG_FOURXM_DEMUXER) += 4xm.o
-OBJS-$(CONFIG_FRAMECRC_MUXER) += framecrcenc.o
-OBJS-$(CONFIG_FRAMEMD5_MUXER) += md5enc.o
+OBJS-$(CONFIG_FRAMECRC_MUXER) += framecrcenc.o framehash.o
+OBJS-$(CONFIG_FRAMEMD5_MUXER) += md5enc.o framehash.o
OBJS-$(CONFIG_GIF_MUXER) += gif.o
OBJS-$(CONFIG_GSM_DEMUXER) += gsmdec.o
OBJS-$(CONFIG_GXF_DEMUXER) += gxf.o
OBJS-$(CONFIG_GXF_MUXER) += gxfenc.o audiointerleave.o
-OBJS-$(CONFIG_G722_DEMUXER) += rawdec.o
+OBJS-$(CONFIG_G722_DEMUXER) += g722.o rawdec.o
OBJS-$(CONFIG_G722_MUXER) += rawenc.o
+OBJS-$(CONFIG_G723_1_DEMUXER) += g723_1.o
OBJS-$(CONFIG_H261_DEMUXER) += h261dec.o rawdec.o
OBJS-$(CONFIG_H261_MUXER) += rawenc.o
OBJS-$(CONFIG_H263_DEMUXER) += h263dec.o rawdec.o
OBJS-$(CONFIG_H263_MUXER) += rawenc.o
OBJS-$(CONFIG_H264_DEMUXER) += h264dec.o rawdec.o
OBJS-$(CONFIG_H264_MUXER) += rawenc.o
+OBJS-$(CONFIG_HLS_DEMUXER) += hls.o
+OBJS-$(CONFIG_HLS_MUXER) += hlsenc.o mpegtsenc.o
OBJS-$(CONFIG_IDCIN_DEMUXER) += idcin.o
OBJS-$(CONFIG_IFF_DEMUXER) += iff.o
-OBJS-$(CONFIG_IMAGE2_DEMUXER) += img2.o
-OBJS-$(CONFIG_IMAGE2_MUXER) += img2.o
-OBJS-$(CONFIG_IMAGE2PIPE_DEMUXER) += img2.o
-OBJS-$(CONFIG_IMAGE2PIPE_MUXER) += img2.o
+OBJS-$(CONFIG_ILBC_DEMUXER) += ilbc.o
+OBJS-$(CONFIG_ILBC_MUXER) += ilbc.o
+OBJS-$(CONFIG_IMAGE2_DEMUXER) += img2dec.o img2.o
+OBJS-$(CONFIG_IMAGE2_MUXER) += img2enc.o img2.o
+OBJS-$(CONFIG_IMAGE2PIPE_DEMUXER) += img2dec.o img2.o
+OBJS-$(CONFIG_IMAGE2PIPE_MUXER) += img2enc.o img2.o
OBJS-$(CONFIG_INGENIENT_DEMUXER) += ingenientdec.o rawdec.o
OBJS-$(CONFIG_IPMOVIE_DEMUXER) += ipmovie.o
OBJS-$(CONFIG_ISS_DEMUXER) += iss.o
@@ -122,8 +153,8 @@ OBJS-$(CONFIG_LMLM4_DEMUXER) += lmlm4.o
OBJS-$(CONFIG_LXF_DEMUXER) += lxfdec.o
OBJS-$(CONFIG_M4V_DEMUXER) += m4vdec.o rawdec.o
OBJS-$(CONFIG_M4V_MUXER) += rawenc.o
-OBJS-$(CONFIG_MATROSKA_DEMUXER) += matroskadec.o matroska.o \
- isom.o rmdec.o rm.o
+OBJS-$(CONFIG_MATROSKA_DEMUXER) += matroskadec.o matroska.o \
+ isom.o rmsipr.o
OBJS-$(CONFIG_MATROSKA_MUXER) += matroskaenc.o matroska.o \
isom.o avc.o \
flacenc_header.o avlanguage.o
@@ -137,13 +168,12 @@ OBJS-$(CONFIG_MMF_DEMUXER) += mmf.o pcm.o
OBJS-$(CONFIG_MMF_MUXER) += mmf.o
OBJS-$(CONFIG_MOV_DEMUXER) += mov.o isom.o mov_chan.o
OBJS-$(CONFIG_MOV_MUXER) += movenc.o isom.o avc.o \
- movenchint.o rtpenc_chain.o \
- mov_chan.o
-OBJS-$(CONFIG_MP2_MUXER) += mp3enc.o rawenc.o
+ movenchint.o mov_chan.o
+OBJS-$(CONFIG_MP2_MUXER) += mp3enc.o rawenc.o id3v2enc.o
OBJS-$(CONFIG_MP3_DEMUXER) += mp3dec.o
OBJS-$(CONFIG_MP3_MUXER) += mp3enc.o rawenc.o id3v2enc.o
-OBJS-$(CONFIG_MPC_DEMUXER) += mpc.o apetag.o
-OBJS-$(CONFIG_MPC8_DEMUXER) += mpc8.o
+OBJS-$(CONFIG_MPC_DEMUXER) += mpc.o apetag.o img2.o
+OBJS-$(CONFIG_MPC8_DEMUXER) += mpc8.o apetag.o img2.o
OBJS-$(CONFIG_MPEG1SYSTEM_MUXER) += mpegenc.o
OBJS-$(CONFIG_MPEG1VCD_MUXER) += mpegenc.o
OBJS-$(CONFIG_MPEG2DVD_MUXER) += mpegenc.o
@@ -153,7 +183,7 @@ OBJS-$(CONFIG_MPEG1VIDEO_MUXER) += rawenc.o
OBJS-$(CONFIG_MPEG2VIDEO_MUXER) += rawenc.o
OBJS-$(CONFIG_MPEGPS_DEMUXER) += mpeg.o
OBJS-$(CONFIG_MPEGTS_DEMUXER) += mpegts.o isom.o
-OBJS-$(CONFIG_MPEGTS_MUXER) += mpegtsenc.o adtsenc.o
+OBJS-$(CONFIG_MPEGTS_MUXER) += mpegtsenc.o
OBJS-$(CONFIG_MPEGVIDEO_DEMUXER) += mpegvideodec.o rawdec.o
OBJS-$(CONFIG_MPJPEG_MUXER) += mpjpeg.o
OBJS-$(CONFIG_MSNWC_TCP_DEMUXER) += msnwc_tcp.o
@@ -182,54 +212,54 @@ OBJS-$(CONFIG_OGG_MUXER) += oggenc.o \
vorbiscomment.o
OBJS-$(CONFIG_OMA_DEMUXER) += omadec.o pcm.o oma.o
OBJS-$(CONFIG_OMA_MUXER) += omaenc.o rawenc.o oma.o id3v2enc.o
-OBJS-$(CONFIG_PCM_ALAW_DEMUXER) += pcmdec.o pcm.o rawdec.o
+OBJS-$(CONFIG_PCM_ALAW_DEMUXER) += pcmdec.o pcm.o
OBJS-$(CONFIG_PCM_ALAW_MUXER) += pcmenc.o rawenc.o
-OBJS-$(CONFIG_PCM_F32BE_DEMUXER) += pcmdec.o pcm.o rawdec.o
+OBJS-$(CONFIG_PCM_F32BE_DEMUXER) += pcmdec.o pcm.o
OBJS-$(CONFIG_PCM_F32BE_MUXER) += pcmenc.o rawenc.o
-OBJS-$(CONFIG_PCM_F32LE_DEMUXER) += pcmdec.o pcm.o rawdec.o
+OBJS-$(CONFIG_PCM_F32LE_DEMUXER) += pcmdec.o pcm.o
OBJS-$(CONFIG_PCM_F32LE_MUXER) += pcmenc.o rawenc.o
-OBJS-$(CONFIG_PCM_F64BE_DEMUXER) += pcmdec.o pcm.o rawdec.o
+OBJS-$(CONFIG_PCM_F64BE_DEMUXER) += pcmdec.o pcm.o
OBJS-$(CONFIG_PCM_F64BE_MUXER) += pcmenc.o rawenc.o
-OBJS-$(CONFIG_PCM_F64LE_DEMUXER) += pcmdec.o pcm.o rawdec.o
+OBJS-$(CONFIG_PCM_F64LE_DEMUXER) += pcmdec.o pcm.o
OBJS-$(CONFIG_PCM_F64LE_MUXER) += pcmenc.o rawenc.o
-OBJS-$(CONFIG_PCM_MULAW_DEMUXER) += pcmdec.o pcm.o rawdec.o
+OBJS-$(CONFIG_PCM_MULAW_DEMUXER) += pcmdec.o pcm.o
OBJS-$(CONFIG_PCM_MULAW_MUXER) += pcmenc.o rawenc.o
-OBJS-$(CONFIG_PCM_S16BE_DEMUXER) += pcmdec.o pcm.o rawdec.o
+OBJS-$(CONFIG_PCM_S16BE_DEMUXER) += pcmdec.o pcm.o
OBJS-$(CONFIG_PCM_S16BE_MUXER) += pcmenc.o rawenc.o
-OBJS-$(CONFIG_PCM_S16LE_DEMUXER) += pcmdec.o pcm.o rawdec.o
+OBJS-$(CONFIG_PCM_S16LE_DEMUXER) += pcmdec.o pcm.o
OBJS-$(CONFIG_PCM_S16LE_MUXER) += pcmenc.o rawenc.o
-OBJS-$(CONFIG_PCM_S24BE_DEMUXER) += pcmdec.o pcm.o rawdec.o
+OBJS-$(CONFIG_PCM_S24BE_DEMUXER) += pcmdec.o pcm.o
OBJS-$(CONFIG_PCM_S24BE_MUXER) += pcmenc.o rawenc.o
-OBJS-$(CONFIG_PCM_S24LE_DEMUXER) += pcmdec.o pcm.o rawdec.o
+OBJS-$(CONFIG_PCM_S24LE_DEMUXER) += pcmdec.o pcm.o
OBJS-$(CONFIG_PCM_S24LE_MUXER) += pcmenc.o rawenc.o
-OBJS-$(CONFIG_PCM_S32BE_DEMUXER) += pcmdec.o pcm.o rawdec.o
+OBJS-$(CONFIG_PCM_S32BE_DEMUXER) += pcmdec.o pcm.o
OBJS-$(CONFIG_PCM_S32BE_MUXER) += pcmenc.o rawenc.o
-OBJS-$(CONFIG_PCM_S32LE_DEMUXER) += pcmdec.o pcm.o rawdec.o
+OBJS-$(CONFIG_PCM_S32LE_DEMUXER) += pcmdec.o pcm.o
OBJS-$(CONFIG_PCM_S32LE_MUXER) += pcmenc.o rawenc.o
-OBJS-$(CONFIG_PCM_S8_DEMUXER) += pcmdec.o pcm.o rawdec.o
+OBJS-$(CONFIG_PCM_S8_DEMUXER) += pcmdec.o pcm.o
OBJS-$(CONFIG_PCM_S8_MUXER) += pcmenc.o rawenc.o
-OBJS-$(CONFIG_PCM_U16BE_DEMUXER) += pcmdec.o pcm.o rawdec.o
+OBJS-$(CONFIG_PCM_U16BE_DEMUXER) += pcmdec.o pcm.o
OBJS-$(CONFIG_PCM_U16BE_MUXER) += pcmenc.o rawenc.o
-OBJS-$(CONFIG_PCM_U16LE_DEMUXER) += pcmdec.o pcm.o rawdec.o
+OBJS-$(CONFIG_PCM_U16LE_DEMUXER) += pcmdec.o pcm.o
OBJS-$(CONFIG_PCM_U16LE_MUXER) += pcmenc.o rawenc.o
-OBJS-$(CONFIG_PCM_U24BE_DEMUXER) += pcmdec.o pcm.o rawdec.o
+OBJS-$(CONFIG_PCM_U24BE_DEMUXER) += pcmdec.o pcm.o
OBJS-$(CONFIG_PCM_U24BE_MUXER) += pcmenc.o rawenc.o
-OBJS-$(CONFIG_PCM_U24LE_DEMUXER) += pcmdec.o pcm.o rawdec.o
+OBJS-$(CONFIG_PCM_U24LE_DEMUXER) += pcmdec.o pcm.o
OBJS-$(CONFIG_PCM_U24LE_MUXER) += pcmenc.o rawenc.o
-OBJS-$(CONFIG_PCM_U32BE_DEMUXER) += pcmdec.o pcm.o rawdec.o
+OBJS-$(CONFIG_PCM_U32BE_DEMUXER) += pcmdec.o pcm.o
OBJS-$(CONFIG_PCM_U32BE_MUXER) += pcmenc.o rawenc.o
-OBJS-$(CONFIG_PCM_U32LE_DEMUXER) += pcmdec.o pcm.o rawdec.o
+OBJS-$(CONFIG_PCM_U32LE_DEMUXER) += pcmdec.o pcm.o
OBJS-$(CONFIG_PCM_U32LE_MUXER) += pcmenc.o rawenc.o
-OBJS-$(CONFIG_PCM_U8_DEMUXER) += pcmdec.o pcm.o rawdec.o
+OBJS-$(CONFIG_PCM_U8_DEMUXER) += pcmdec.o pcm.o
OBJS-$(CONFIG_PCM_U8_MUXER) += pcmenc.o rawenc.o
OBJS-$(CONFIG_PMP_DEMUXER) += pmpdec.o
OBJS-$(CONFIG_PVA_DEMUXER) += pva.o
OBJS-$(CONFIG_QCP_DEMUXER) += qcp.o
OBJS-$(CONFIG_R3D_DEMUXER) += r3d.o
-OBJS-$(CONFIG_RAWVIDEO_DEMUXER) += rawvideodec.o rawdec.o
+OBJS-$(CONFIG_RAWVIDEO_DEMUXER) += rawvideodec.o
OBJS-$(CONFIG_RAWVIDEO_MUXER) += rawenc.o
OBJS-$(CONFIG_RL2_DEMUXER) += rl2.o
-OBJS-$(CONFIG_RM_DEMUXER) += rmdec.o rm.o
+OBJS-$(CONFIG_RM_DEMUXER) += rmdec.o rm.o rmsipr.o
OBJS-$(CONFIG_RM_MUXER) += rmenc.o rm.o
OBJS-$(CONFIG_ROQ_DEMUXER) += idroqdec.o
OBJS-$(CONFIG_ROQ_MUXER) += idroqenc.o rawenc.o
@@ -241,33 +271,20 @@ OBJS-$(CONFIG_RTP_MUXER) += rtp.o \
rtpenc_latm.o \
rtpenc_amr.o \
rtpenc_h263.o \
+ rtpenc_h263_rfc2190.o \
+ rtpenc_jpeg.o \
rtpenc_mpv.o \
rtpenc.o \
rtpenc_h264.o \
rtpenc_vp8.o \
rtpenc_xiph.o \
avc.o
-OBJS-$(CONFIG_RTPDEC) += rdt.o \
- rtp.o \
- rtpdec.o \
- rtpdec_amr.o \
- rtpdec_asf.o \
- rtpdec_g726.o \
- rtpdec_h263.o \
- rtpdec_h264.o \
- rtpdec_latm.o \
- rtpdec_mpeg4.o \
- rtpdec_qcelp.o \
- rtpdec_qdm2.o \
- rtpdec_qt.o \
- rtpdec_svq3.o \
- rtpdec_vp8.o \
- rtpdec_xiph.o
-OBJS-$(CONFIG_RTSP_DEMUXER) += rtsp.o rtspdec.o httpauth.o
+OBJS-$(CONFIG_RTSP_DEMUXER) += rtsp.o rtspdec.o httpauth.o \
+ urldecode.o
OBJS-$(CONFIG_RTSP_MUXER) += rtsp.o rtspenc.o httpauth.o \
- rtpenc_chain.o
+ urldecode.o
OBJS-$(CONFIG_SAP_DEMUXER) += sapdec.o
-OBJS-$(CONFIG_SAP_MUXER) += sapenc.o rtpenc_chain.o
+OBJS-$(CONFIG_SAP_MUXER) += sapenc.o
OBJS-$(CONFIG_SDP_DEMUXER) += rtsp.o
OBJS-$(CONFIG_SEGAFILM_DEMUXER) += segafilm.o
OBJS-$(CONFIG_SEGMENT_MUXER) += segment.o
@@ -276,6 +293,7 @@ OBJS-$(CONFIG_SIFF_DEMUXER) += siff.o
OBJS-$(CONFIG_SMACKER_DEMUXER) += smacker.o
OBJS-$(CONFIG_SMJPEG_DEMUXER) += smjpegdec.o smjpeg.o
OBJS-$(CONFIG_SMJPEG_MUXER) += smjpegenc.o smjpeg.o
+OBJS-$(CONFIG_SMOOTHSTREAMING_MUXER) += smoothstreamingenc.o isom.o
OBJS-$(CONFIG_SOL_DEMUXER) += sol.o pcm.o
OBJS-$(CONFIG_SOX_DEMUXER) += soxdec.o pcm.o
OBJS-$(CONFIG_SOX_MUXER) += soxenc.o
@@ -284,8 +302,9 @@ OBJS-$(CONFIG_SPDIF_MUXER) += spdif.o spdifenc.o
OBJS-$(CONFIG_SRT_DEMUXER) += srtdec.o
OBJS-$(CONFIG_SRT_MUXER) += rawenc.o
OBJS-$(CONFIG_STR_DEMUXER) += psxstr.o
-OBJS-$(CONFIG_SWF_DEMUXER) += swfdec.o
-OBJS-$(CONFIG_SWF_MUXER) += swfenc.o
+OBJS-$(CONFIG_SWF_DEMUXER) += swfdec.o swf.o
+OBJS-$(CONFIG_SWF_MUXER) += swfenc.o swf.o
+OBJS-$(CONFIG_TAK_DEMUXER) += takdec.o apetag.o img2.o rawdec.o
OBJS-$(CONFIG_THP_DEMUXER) += thp.o
OBJS-$(CONFIG_TIERTEXSEQ_DEMUXER) += tiertexseq.o
OBJS-$(CONFIG_TMV_DEMUXER) += tmv.o
@@ -301,18 +320,18 @@ OBJS-$(CONFIG_VMD_DEMUXER) += sierravmd.o
OBJS-$(CONFIG_VOC_DEMUXER) += vocdec.o voc.o
OBJS-$(CONFIG_VOC_MUXER) += vocenc.o voc.o
OBJS-$(CONFIG_VQF_DEMUXER) += vqf.o
-OBJS-$(CONFIG_W64_DEMUXER) += wav.o pcm.o
-OBJS-$(CONFIG_WAV_DEMUXER) += wav.o pcm.o
-OBJS-$(CONFIG_WAV_MUXER) += wav.o
+OBJS-$(CONFIG_W64_DEMUXER) += wavdec.o pcm.o
+OBJS-$(CONFIG_WAV_DEMUXER) += wavdec.o pcm.o
+OBJS-$(CONFIG_WAV_MUXER) += wavenc.o
OBJS-$(CONFIG_WC3_DEMUXER) += wc3movie.o
OBJS-$(CONFIG_WEBM_MUXER) += matroskaenc.o matroska.o \
isom.o avc.o \
flacenc_header.o avlanguage.o
-OBJS-$(CONFIG_WSAUD_DEMUXER) += westwood.o
-OBJS-$(CONFIG_WSVQA_DEMUXER) += westwood.o
+OBJS-$(CONFIG_WSAUD_DEMUXER) += westwood_aud.o
+OBJS-$(CONFIG_WSVQA_DEMUXER) += westwood_vqa.o
OBJS-$(CONFIG_WTV_DEMUXER) += wtv.o asfdec.o asf.o asfcrypt.o \
avlanguage.o mpegts.o isom.o
-OBJS-$(CONFIG_WV_DEMUXER) += wv.o apetag.o
+OBJS-$(CONFIG_WV_DEMUXER) += wv.o apetag.o img2.o
OBJS-$(CONFIG_XA_DEMUXER) += xa.o
OBJS-$(CONFIG_XMV_DEMUXER) += xmv.o
OBJS-$(CONFIG_XWMA_DEMUXER) += xwma.o
@@ -321,39 +340,48 @@ OBJS-$(CONFIG_YUV4MPEGPIPE_MUXER) += yuv4mpeg.o
OBJS-$(CONFIG_YUV4MPEGPIPE_DEMUXER) += yuv4mpeg.o
# external libraries
-OBJS-$(CONFIG_LIBNUT_DEMUXER) += libnut.o
-OBJS-$(CONFIG_LIBNUT_MUXER) += libnut.o
+OBJS-$(CONFIG_LIBRTMP) += librtmp.o
# protocols I/O
-OBJS+= avio.o aviobuf.o
-
-OBJS-$(CONFIG_APPLEHTTP_PROTOCOL) += applehttpproto.o
+OBJS-$(CONFIG_APPLEHTTP_PROTOCOL) += hlsproto.o
OBJS-$(CONFIG_CONCAT_PROTOCOL) += concat.o
OBJS-$(CONFIG_CRYPTO_PROTOCOL) += crypto.o
+OBJS-$(CONFIG_FFRTMPCRYPT_PROTOCOL) += rtmpcrypt.o rtmpdh.o
+OBJS-$(CONFIG_FFRTMPHTTP_PROTOCOL) += rtmphttp.o
OBJS-$(CONFIG_FILE_PROTOCOL) += file.o
OBJS-$(CONFIG_GOPHER_PROTOCOL) += gopher.o
-OBJS-$(CONFIG_HTTP_PROTOCOL) += http.o httpauth.o
-OBJS-$(CONFIG_HTTPPROXY_PROTOCOL) += http.o httpauth.o
-OBJS-$(CONFIG_HTTPS_PROTOCOL) += http.o httpauth.o
+OBJS-$(CONFIG_HLS_PROTOCOL) += hlsproto.o
+OBJS-$(CONFIG_HTTP_PROTOCOL) += http.o httpauth.o urldecode.o
+OBJS-$(CONFIG_HTTPPROXY_PROTOCOL) += http.o httpauth.o urldecode.o
+OBJS-$(CONFIG_HTTPS_PROTOCOL) += http.o httpauth.o urldecode.o
OBJS-$(CONFIG_MMSH_PROTOCOL) += mmsh.o mms.o asf.o
OBJS-$(CONFIG_MMST_PROTOCOL) += mmst.o mms.o asf.o
OBJS-$(CONFIG_MD5_PROTOCOL) += md5proto.o
OBJS-$(CONFIG_PIPE_PROTOCOL) += file.o
-
-# external or internal rtmp
-RTMP-OBJS-$(CONFIG_LIBRTMP) = librtmp.o
-RTMP-OBJS-$(!CONFIG_LIBRTMP) = rtmpproto.o rtmppkt.o
-OBJS-$(CONFIG_RTMP_PROTOCOL) += $(RTMP-OBJS-yes)
-
+OBJS-$(CONFIG_RTMP_PROTOCOL) += rtmpproto.o rtmppkt.o
+OBJS-$(CONFIG_RTMPE_PROTOCOL) += rtmpproto.o rtmppkt.o
+OBJS-$(CONFIG_RTMPS_PROTOCOL) += rtmpproto.o rtmppkt.o
+OBJS-$(CONFIG_RTMPT_PROTOCOL) += rtmpproto.o rtmppkt.o
+OBJS-$(CONFIG_RTMPTE_PROTOCOL) += rtmpproto.o rtmppkt.o
+OBJS-$(CONFIG_RTMPTS_PROTOCOL) += rtmpproto.o rtmppkt.o
OBJS-$(CONFIG_RTP_PROTOCOL) += rtpproto.o
+OBJS-$(CONFIG_SCTP_PROTOCOL) += sctp.o
OBJS-$(CONFIG_TCP_PROTOCOL) += tcp.o
OBJS-$(CONFIG_TLS_PROTOCOL) += tls.o
OBJS-$(CONFIG_UDP_PROTOCOL) += udp.o
+SKIPHEADERS-$(CONFIG_FFRTMPCRYPT_PROTOCOL) += rtmpdh.h
SKIPHEADERS-$(CONFIG_NETWORK) += network.h rtsp.h
-EXAMPLES = metadata output
-TESTPROGS = seek
-TOOLS = aviocat pktdumper probetest
+EXAMPLES = metadata \
+ output \
+
+TESTPROGS = seek \
+ url \
+
+TOOLS = aviocat \
+ ismindex \
+ pktdumper \
+ probetest \
-$(SUBDIR)output-example$(EXESUF): ELIBS = -lswscale
+$(SUBDIR)output-example$(EXESUF): ELIBS = $(patsubst %,$(LD_LIB),swscale)
diff --git a/gst-libs/ext/libav/libavformat/a64.c b/gst-libs/ext/libav/libavformat/a64.c
index 3cea50b..15a0475 100644
--- a/gst-libs/ext/libav/libavformat/a64.c
+++ b/gst-libs/ext/libav/libavformat/a64.c
@@ -23,17 +23,11 @@
#include "libavcodec/a64enc.h"
#include "libavcodec/bytestream.h"
#include "avformat.h"
-
-typedef struct A64MuxerContext {
- int interleaved;
- AVPacket prev_pkt;
- int prev_frame_count;
-} A64MuxerContext;
+#include "rawenc.h"
static int a64_write_header(struct AVFormatContext *s)
{
AVCodecContext *avctx = s->streams[0]->codec;
- A64MuxerContext *c = s->priv_data;
uint8_t header[5] = {
0x00, //load
0x40, //address
@@ -41,14 +35,13 @@ static int a64_write_header(struct AVFormatContext *s)
0x00, //charset_lifetime (multi only)
0x00 //fps in 50/fps;
};
- c->interleaved = 0;
switch (avctx->codec->id) {
- case CODEC_ID_A64_MULTI:
+ case AV_CODEC_ID_A64_MULTI:
header[2] = 0x00;
header[3] = AV_RB32(avctx->extradata+0);
header[4] = 2;
break;
- case CODEC_ID_A64_MULTI5:
+ case AV_CODEC_ID_A64_MULTI5:
header[2] = 0x01;
header[3] = AV_RB32(avctx->extradata+0);
header[4] = 3;
@@ -57,119 +50,14 @@ static int a64_write_header(struct AVFormatContext *s)
return AVERROR(EINVAL);
}
avio_write(s->pb, header, 2);
- c->prev_pkt.size = 0;
- c->prev_frame_count = 0;
- return 0;
-}
-
-static int a64_write_packet(struct AVFormatContext *s, AVPacket *pkt)
-{
- AVCodecContext *avctx = s->streams[0]->codec;
- A64MuxerContext *c = s->priv_data;
- int i, j;
- int ch_chunksize;
- int lifetime;
- int frame_count;
- int charset_size;
- int frame_size;
- int num_frames;
-
- /* fetch values from extradata */
- switch (avctx->codec->id) {
- case CODEC_ID_A64_MULTI:
- case CODEC_ID_A64_MULTI5:
- if(c->interleaved) {
- /* Write interleaved, means we insert chunks of the future charset before each current frame.
- * Reason: if we load 1 charset + corresponding frames in one block on c64, we need to store
- * them first and then display frame by frame to keep in sync. Thus we would read and write
- * the data for colram from/to ram first and waste too much time. If we interleave and send the
- * charset beforehand, we assemble a new charset chunk by chunk, write current screen data to
- * screen-ram to be displayed and decode the colram directly to colram-location $d800 during
- * the overscan, while reading directly from source.
- * This is the only way so far, to achieve 25fps on c64 */
- if(avctx->extradata) {
- /* fetch values from extradata */
- lifetime = AV_RB32(avctx->extradata + 0);
- frame_count = AV_RB32(avctx->extradata + 4);
- charset_size = AV_RB32(avctx->extradata + 8);
- frame_size = AV_RB32(avctx->extradata + 12);
-
- /* TODO: sanity checks? */
- } else {
- av_log(avctx, AV_LOG_ERROR, "extradata not set\n");
- return AVERROR(EINVAL);
- }
-
- ch_chunksize=charset_size/lifetime;
- /* TODO: check if charset/size is % lifetime, but maybe check in codec */
-
- if(pkt->data) num_frames = lifetime;
- else num_frames = c->prev_frame_count;
-
- for(i = 0; i < num_frames; i++) {
- if(pkt->data) {
- /* if available, put newest charset chunk into buffer */
- avio_write(s->pb, pkt->data + ch_chunksize * i, ch_chunksize);
- } else {
- /* a bit ugly, but is there an alternative to put many zeros? */
- for(j = 0; j < ch_chunksize; j++) avio_w8(s->pb, 0);
- }
-
- if(c->prev_pkt.data) {
- /* put frame (screen + colram) from last packet into buffer */
- avio_write(s->pb, c->prev_pkt.data + charset_size + frame_size * i, frame_size);
- } else {
- /* a bit ugly, but is there an alternative to put many zeros? */
- for(j = 0; j < frame_size; j++) avio_w8(s->pb, 0);
- }
- }
-
- /* backup current packet for next turn */
- if(pkt->data) {
- /* no backup packet yet? create one! */
- if(!c->prev_pkt.data) av_new_packet(&c->prev_pkt, pkt->size);
- /* we have a packet and data is big enough, reuse it */
- if(c->prev_pkt.data && c->prev_pkt.size >= pkt->size) {
- memcpy(c->prev_pkt.data, pkt->data, pkt->size);
- c->prev_pkt.size = pkt->size;
- } else {
- av_log(avctx, AV_LOG_ERROR, "Too less memory for prev_pkt.\n");
- return AVERROR(ENOMEM);
- }
- }
-
- c->prev_frame_count = frame_count;
- break;
- }
- default:
- /* Write things as is. Nice for self-contained frames from non-multicolor modes or if played
- * directly from ram and not from a streaming device (rrnet/mmc) */
- if(pkt) avio_write(s->pb, pkt->data, pkt->size);
- break;
- }
-
- avio_flush(s->pb);
- return 0;
-}
-
-static int a64_write_trailer(struct AVFormatContext *s)
-{
- A64MuxerContext *c = s->priv_data;
- AVPacket pkt = {0};
- /* need to flush last packet? */
- if(c->interleaved) a64_write_packet(s, &pkt);
- /* discard backed up packet */
- if(c->prev_pkt.data) av_destruct_packet(&c->prev_pkt);
return 0;
}
AVOutputFormat ff_a64_muxer = {
- .name = "a64",
- .long_name = NULL_IF_CONFIG_SMALL("a64 - video for Commodore 64"),
- .extensions = "a64, A64",
- .priv_data_size = sizeof (A64Context),
- .video_codec = CODEC_ID_A64_MULTI,
- .write_header = a64_write_header,
- .write_packet = a64_write_packet,
- .write_trailer = a64_write_trailer
+ .name = "a64",
+ .long_name = NULL_IF_CONFIG_SMALL("a64 - video for Commodore 64"),
+ .extensions = "a64, A64",
+ .video_codec = AV_CODEC_ID_A64_MULTI,
+ .write_header = a64_write_header,
+ .write_packet = ff_raw_write_packet,
};
diff --git a/gst-libs/ext/libav/libavformat/aacdec.c b/gst-libs/ext/libav/libavformat/aacdec.c
index 25c5910..6f9763f 100644
--- a/gst-libs/ext/libav/libavformat/aacdec.c
+++ b/gst-libs/ext/libav/libavformat/aacdec.c
@@ -61,8 +61,7 @@ static int adts_aac_probe(AVProbeData *p)
else return 0;
}
-static int adts_aac_read_header(AVFormatContext *s,
- AVFormatParameters *ap)
+static int adts_aac_read_header(AVFormatContext *s)
{
AVStream *st;
@@ -71,7 +70,7 @@ static int adts_aac_read_header(AVFormatContext *s,
return AVERROR(ENOMEM);
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
- st->codec->codec_id = s->iformat->value;
+ st->codec->codec_id = s->iformat->raw_codec_id;
st->need_parsing = AVSTREAM_PARSE_FULL;
ff_id3v1_read(s);
@@ -84,11 +83,11 @@ static int adts_aac_read_header(AVFormatContext *s,
AVInputFormat ff_aac_demuxer = {
.name = "aac",
- .long_name = NULL_IF_CONFIG_SMALL("raw ADTS AAC"),
+ .long_name = NULL_IF_CONFIG_SMALL("raw ADTS AAC (Advanced Audio Coding)"),
.read_probe = adts_aac_probe,
.read_header = adts_aac_read_header,
.read_packet = ff_raw_read_partial_packet,
- .flags= AVFMT_GENERIC_INDEX,
- .extensions = "aac",
- .value = CODEC_ID_AAC,
+ .flags = AVFMT_GENERIC_INDEX,
+ .extensions = "aac",
+ .raw_codec_id = AV_CODEC_ID_AAC,
};
diff --git a/gst-libs/ext/libav/libavformat/ac3dec.c b/gst-libs/ext/libav/libavformat/ac3dec.c
index ca6aee3..d3f2ec2 100644
--- a/gst-libs/ext/libav/libavformat/ac3dec.c
+++ b/gst-libs/ext/libav/libavformat/ac3dec.c
@@ -24,13 +24,13 @@
#include "avformat.h"
#include "rawdec.h"
-static int ac3_eac3_probe(AVProbeData *p, enum CodecID expected_codec_id)
+static int ac3_eac3_probe(AVProbeData *p, enum AVCodecID expected_codec_id)
{
int max_frames, first_frames = 0, frames;
uint8_t *buf, *buf2, *end;
AC3HeaderInfo hdr;
GetBitContext gbc;
- enum CodecID codec_id = CODEC_ID_AC3;
+ enum AVCodecID codec_id = AV_CODEC_ID_AC3;
max_frames = 0;
buf = p->buf;
@@ -47,7 +47,7 @@ static int ac3_eac3_probe(AVProbeData *p, enum CodecID expected_codec_id)
av_crc(av_crc_get_table(AV_CRC_16_ANSI), 0, buf2 + 2, hdr.frame_size - 2))
break;
if (hdr.bitstream_id > 10)
- codec_id = CODEC_ID_EAC3;
+ codec_id = AV_CODEC_ID_EAC3;
buf2 += hdr.frame_size;
}
max_frames = FFMAX(max_frames, frames);
@@ -57,17 +57,37 @@ static int ac3_eac3_probe(AVProbeData *p, enum CodecID expected_codec_id)
if(codec_id != expected_codec_id) return 0;
// keep this in sync with mp3 probe, both need to avoid
// issues with MPEG-files!
- if (first_frames>=4) return AVPROBE_SCORE_MAX/2+1;
- else if(max_frames>500)return AVPROBE_SCORE_MAX/2;
- else if(max_frames>=4) return AVPROBE_SCORE_MAX/4;
- else if(max_frames>=1) return 1;
- else return 0;
+ if (first_frames >= 4) return AVPROBE_SCORE_MAX / 2 + 1;
+
+ if (max_frames) {
+ int pes = 0, i;
+ unsigned int code = -1;
+
+#define VIDEO_ID 0x000001e0
+#define AUDIO_ID 0x000001c0
+ /* do a search for mpegps headers to be able to properly bias
+ * towards mpegps if we detect this stream as both. */
+ for (i = 0; i<p->buf_size; i++) {
+ code = (code << 8) + p->buf[i];
+ if ((code & 0xffffff00) == 0x100) {
+ if ((code & 0x1f0) == VIDEO_ID) pes++;
+ else if((code & 0x1e0) == AUDIO_ID) pes++;
+ }
+ }
+
+ if (pes)
+ max_frames = (max_frames + pes - 1) / pes;
+ }
+ if (max_frames > 500) return AVPROBE_SCORE_MAX / 2;
+ else if (max_frames >= 4) return AVPROBE_SCORE_MAX / 4;
+ else if (max_frames >= 1) return 1;
+ else return 0;
}
#if CONFIG_AC3_DEMUXER
static int ac3_probe(AVProbeData *p)
{
- return ac3_eac3_probe(p, CODEC_ID_AC3);
+ return ac3_eac3_probe(p, AV_CODEC_ID_AC3);
}
AVInputFormat ff_ac3_demuxer = {
@@ -78,14 +98,14 @@ AVInputFormat ff_ac3_demuxer = {
.read_packet = ff_raw_read_partial_packet,
.flags= AVFMT_GENERIC_INDEX,
.extensions = "ac3",
- .value = CODEC_ID_AC3,
+ .raw_codec_id = AV_CODEC_ID_AC3,
};
#endif
#if CONFIG_EAC3_DEMUXER
static int eac3_probe(AVProbeData *p)
{
- return ac3_eac3_probe(p, CODEC_ID_EAC3);
+ return ac3_eac3_probe(p, AV_CODEC_ID_EAC3);
}
AVInputFormat ff_eac3_demuxer = {
@@ -94,8 +114,8 @@ AVInputFormat ff_eac3_demuxer = {
.read_probe = eac3_probe,
.read_header = ff_raw_audio_read_header,
.read_packet = ff_raw_read_partial_packet,
- .flags= AVFMT_GENERIC_INDEX,
- .extensions = "eac3",
- .value = CODEC_ID_EAC3,
+ .flags = AVFMT_GENERIC_INDEX,
+ .extensions = "eac3",
+ .raw_codec_id = AV_CODEC_ID_EAC3,
};
#endif
diff --git a/gst-libs/ext/libav/libavformat/adts.h b/gst-libs/ext/libav/libavformat/adts.h
deleted file mode 100644
index 78b42c7..0000000
--- a/gst-libs/ext/libav/libavformat/adts.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * ADTS muxer.
- * Copyright (c) 2006 Baptiste Coudurier <baptiste.coudurier@smartjog.com>
- * Mans Rullgard <mans@mansr.com>
- *
- * 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
- */
-
-#ifndef AVFORMAT_ADTS_H
-#define AVFORMAT_ADTS_H
-
-#include "avformat.h"
-#include "libavcodec/mpeg4audio.h"
-
-#define ADTS_HEADER_SIZE 7
-
-typedef struct {
- int write_adts;
- int objecttype;
- int sample_rate_index;
- int channel_conf;
- int pce_size;
- uint8_t pce_data[MAX_PCE_SIZE];
-} ADTSContext;
-
-int ff_adts_write_frame_header(ADTSContext *ctx, uint8_t *buf,
- int size, int pce_size);
-int ff_adts_decode_extradata(AVFormatContext *s, ADTSContext *adts,
- uint8_t *buf, int size);
-
-#endif /* AVFORMAT_ADTS_H */
diff --git a/gst-libs/ext/libav/libavformat/adtsenc.c b/gst-libs/ext/libav/libavformat/adtsenc.c
index ef3d8e2..0c91944 100644
--- a/gst-libs/ext/libav/libavformat/adtsenc.c
+++ b/gst-libs/ext/libav/libavformat/adtsenc.c
@@ -25,11 +25,21 @@
#include "libavcodec/avcodec.h"
#include "libavcodec/mpeg4audio.h"
#include "avformat.h"
-#include "adts.h"
+
+#define ADTS_HEADER_SIZE 7
+
+typedef struct {
+ int write_adts;
+ int objecttype;
+ int sample_rate_index;
+ int channel_conf;
+ int pce_size;
+ uint8_t pce_data[MAX_PCE_SIZE];
+} ADTSContext;
#define ADTS_MAX_FRAME_BYTES ((1 << 13) - 1)
-int ff_adts_decode_extradata(AVFormatContext *s, ADTSContext *adts, uint8_t *buf, int size)
+static int adts_decode_extradata(AVFormatContext *s, ADTSContext *adts, uint8_t *buf, int size)
{
GetBitContext gb;
PutBitContext pb;
@@ -84,14 +94,14 @@ static int adts_write_header(AVFormatContext *s)
AVCodecContext *avc = s->streams[0]->codec;
if (avc->extradata_size > 0 &&
- ff_adts_decode_extradata(s, adts, avc->extradata, avc->extradata_size) < 0)
+ adts_decode_extradata(s, adts, avc->extradata, avc->extradata_size) < 0)
return -1;
return 0;
}
-int ff_adts_write_frame_header(ADTSContext *ctx,
- uint8_t *buf, int size, int pce_size)
+static int adts_write_frame_header(ADTSContext *ctx,
+ uint8_t *buf, int size, int pce_size)
{
PutBitContext pb;
@@ -137,7 +147,7 @@ static int adts_write_packet(AVFormatContext *s, AVPacket *pkt)
if (!pkt->size)
return 0;
if (adts->write_adts) {
- int err = ff_adts_write_frame_header(adts, buf, pkt->size,
+ int err = adts_write_frame_header(adts, buf, pkt->size,
adts->pce_size);
if (err < 0)
return err;
@@ -155,12 +165,12 @@ static int adts_write_packet(AVFormatContext *s, AVPacket *pkt)
AVOutputFormat ff_adts_muxer = {
.name = "adts",
- .long_name = NULL_IF_CONFIG_SMALL("ADTS AAC"),
+ .long_name = NULL_IF_CONFIG_SMALL("ADTS AAC (Advanced Audio Coding)"),
.mime_type = "audio/aac",
.extensions = "aac,adts",
.priv_data_size = sizeof(ADTSContext),
- .audio_codec = CODEC_ID_AAC,
- .video_codec = CODEC_ID_NONE,
+ .audio_codec = AV_CODEC_ID_AAC,
+ .video_codec = AV_CODEC_ID_NONE,
.write_header = adts_write_header,
.write_packet = adts_write_packet,
};
diff --git a/gst-libs/ext/libav/libavformat/adxdec.c b/gst-libs/ext/libav/libavformat/adxdec.c
index ab11d83..49e1930 100644
--- a/gst-libs/ext/libav/libavformat/adxdec.c
+++ b/gst-libs/ext/libav/libavformat/adxdec.c
@@ -62,7 +62,7 @@ static int adx_read_packet(AVFormatContext *s, AVPacket *pkt)
return 0;
}
-static int adx_read_header(AVFormatContext *s, AVFormatParameters *ap)
+static int adx_read_header(AVFormatContext *s)
{
ADXDemuxerContext *c = s->priv_data;
AVCodecContext *avctx;
@@ -94,7 +94,7 @@ static int adx_read_header(AVFormatContext *s, AVFormatParameters *ap)
return ret;
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
- st->codec->codec_id = s->iformat->value;
+ st->codec->codec_id = s->iformat->raw_codec_id;
avpriv_set_pts_info(st, 64, BLOCK_SAMPLES, avctx->sample_rate);
@@ -108,6 +108,6 @@ AVInputFormat ff_adx_demuxer = {
.read_header = adx_read_header,
.read_packet = adx_read_packet,
.extensions = "adx",
- .value = CODEC_ID_ADPCM_ADX,
+ .raw_codec_id = AV_CODEC_ID_ADPCM_ADX,
.flags = AVFMT_GENERIC_INDEX,
};
diff --git a/gst-libs/ext/libav/libavformat/aea.c b/gst-libs/ext/libav/libavformat/aea.c
index b33b45f..7675009 100644
--- a/gst-libs/ext/libav/libavformat/aea.c
+++ b/gst-libs/ext/libav/libavformat/aea.c
@@ -20,10 +20,10 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "libavutil/channel_layout.h"
+#include "libavutil/intreadwrite.h"
#include "avformat.h"
#include "pcm.h"
-#include "libavutil/intreadwrite.h"
-#include "libavutil/audioconvert.h"
#define AT1_SU_SIZE 212
@@ -54,8 +54,7 @@ static int aea_read_probe(AVProbeData *p)
return 0;
}
-static int aea_read_header(AVFormatContext *s,
- AVFormatParameters *ap)
+static int aea_read_header(AVFormatContext *s)
{
AVStream *st = avformat_new_stream(s, NULL);
if (!st)
@@ -68,7 +67,7 @@ static int aea_read_header(AVFormatContext *s,
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
- st->codec->codec_id = CODEC_ID_ATRAC1;
+ st->codec->codec_id = AV_CODEC_ID_ATRAC1;
st->codec->sample_rate = 44100;
st->codec->bit_rate = 292000;
@@ -100,8 +99,7 @@ AVInputFormat ff_aea_demuxer = {
.read_probe = aea_read_probe,
.read_header = aea_read_header,
.read_packet = aea_read_packet,
- .read_seek = pcm_read_seek,
- .flags= AVFMT_GENERIC_INDEX,
- .extensions = "aea",
+ .read_seek = ff_pcm_read_seek,
+ .flags = AVFMT_GENERIC_INDEX,
+ .extensions = "aea",
};
-
diff --git a/gst-libs/ext/libav/libavformat/aiff.h b/gst-libs/ext/libav/libavformat/aiff.h
index 3190a22..f88f957 100644
--- a/gst-libs/ext/libav/libavformat/aiff.h
+++ b/gst-libs/ext/libav/libavformat/aiff.h
@@ -28,27 +28,27 @@
#define AVFORMAT_AIFF_H
#include "avformat.h"
-#include "riff.h"
+#include "internal.h"
static const AVCodecTag ff_codec_aiff_tags[] = {
- { CODEC_ID_PCM_S16BE, MKTAG('N','O','N','E') },
- { CODEC_ID_PCM_S8, MKTAG('N','O','N','E') },
- { CODEC_ID_PCM_S24BE, MKTAG('N','O','N','E') },
- { CODEC_ID_PCM_S32BE, MKTAG('N','O','N','E') },
- { CODEC_ID_PCM_F32BE, MKTAG('f','l','3','2') },
- { CODEC_ID_PCM_F64BE, MKTAG('f','l','6','4') },
- { CODEC_ID_PCM_ALAW, MKTAG('a','l','a','w') },
- { CODEC_ID_PCM_MULAW, MKTAG('u','l','a','w') },
- { CODEC_ID_MACE3, MKTAG('M','A','C','3') },
- { CODEC_ID_MACE6, MKTAG('M','A','C','6') },
- { CODEC_ID_GSM, MKTAG('G','S','M',' ') },
- { CODEC_ID_ADPCM_G726, MKTAG('G','7','2','6') },
- { CODEC_ID_PCM_S16BE, MKTAG('t','w','o','s') },
- { CODEC_ID_PCM_S16LE, MKTAG('s','o','w','t') },
- { CODEC_ID_ADPCM_IMA_QT, MKTAG('i','m','a','4') },
- { CODEC_ID_QDM2, MKTAG('Q','D','M','2') },
- { CODEC_ID_QCELP, MKTAG('Q','c','l','p') },
- { CODEC_ID_NONE, 0 },
+ { AV_CODEC_ID_PCM_S16BE, MKTAG('N','O','N','E') },
+ { AV_CODEC_ID_PCM_S8, MKTAG('N','O','N','E') },
+ { AV_CODEC_ID_PCM_S24BE, MKTAG('N','O','N','E') },
+ { AV_CODEC_ID_PCM_S32BE, MKTAG('N','O','N','E') },
+ { AV_CODEC_ID_PCM_F32BE, MKTAG('f','l','3','2') },
+ { AV_CODEC_ID_PCM_F64BE, MKTAG('f','l','6','4') },
+ { AV_CODEC_ID_PCM_ALAW, MKTAG('a','l','a','w') },
+ { AV_CODEC_ID_PCM_MULAW, MKTAG('u','l','a','w') },
+ { AV_CODEC_ID_MACE3, MKTAG('M','A','C','3') },
+ { AV_CODEC_ID_MACE6, MKTAG('M','A','C','6') },
+ { AV_CODEC_ID_GSM, MKTAG('G','S','M',' ') },
+ { AV_CODEC_ID_ADPCM_G726, MKTAG('G','7','2','6') },
+ { AV_CODEC_ID_PCM_S16BE, MKTAG('t','w','o','s') },
+ { AV_CODEC_ID_PCM_S16LE, MKTAG('s','o','w','t') },
+ { AV_CODEC_ID_ADPCM_IMA_QT, MKTAG('i','m','a','4') },
+ { AV_CODEC_ID_QDM2, MKTAG('Q','D','M','2') },
+ { AV_CODEC_ID_QCELP, MKTAG('Q','c','l','p') },
+ { AV_CODEC_ID_NONE, 0 },
};
#endif /* AVFORMAT_AIFF_H */
diff --git a/gst-libs/ext/libav/libavformat/aiffdec.c b/gst-libs/ext/libav/libavformat/aiffdec.c
index 88e1e68..6243bcb 100644
--- a/gst-libs/ext/libav/libavformat/aiffdec.c
+++ b/gst-libs/ext/libav/libavformat/aiffdec.c
@@ -31,21 +31,22 @@
typedef struct {
int64_t data_end;
+ int block_duration;
} AIFFInputContext;
-static enum CodecID aiff_codec_get_id(int bps)
+static enum AVCodecID aiff_codec_get_id(int bps)
{
if (bps <= 8)
- return CODEC_ID_PCM_S8;
+ return AV_CODEC_ID_PCM_S8;
if (bps <= 16)
- return CODEC_ID_PCM_S16BE;
+ return AV_CODEC_ID_PCM_S16BE;
if (bps <= 24)
- return CODEC_ID_PCM_S24BE;
+ return AV_CODEC_ID_PCM_S24BE;
if (bps <= 32)
- return CODEC_ID_PCM_S32BE;
+ return AV_CODEC_ID_PCM_S32BE;
/* bigger than 32 isn't allowed */
- return CODEC_ID_NONE;
+ return AV_CODEC_ID_NONE;
}
/* returns the size of the found tag */
@@ -85,9 +86,12 @@ static void get_meta(AVFormatContext *s, const char *key, int size)
}
/* Returns the number of sound data frames or negative on error */
-static unsigned int get_aiff_header(AVIOContext *pb, AVCodecContext *codec,
- int size, unsigned version)
+static unsigned int get_aiff_header(AVFormatContext *s, int size,
+ unsigned version)
{
+ AVIOContext *pb = s->pb;
+ AVCodecContext *codec = s->streams[0]->codec;
+ AIFFInputContext *aiff = s->priv_data;
int exp;
uint64_t val;
double sample_rate;
@@ -106,44 +110,47 @@ static unsigned int get_aiff_header(AVIOContext *pb, AVCodecContext *codec,
codec->sample_rate = sample_rate;
size -= 18;
- /* Got an AIFF-C? */
+ /* get codec id for AIFF-C */
if (version == AIFF_C_VERSION1) {
codec->codec_tag = avio_rl32(pb);
codec->codec_id = ff_codec_get_id(ff_codec_aiff_tags, codec->codec_tag);
+ size -= 4;
+ }
+ if (version != AIFF_C_VERSION1 || codec->codec_id == AV_CODEC_ID_PCM_S16BE) {
+ codec->codec_id = aiff_codec_get_id(codec->bits_per_coded_sample);
+ codec->bits_per_coded_sample = av_get_bits_per_sample(codec->codec_id);
+ aiff->block_duration = 1;
+ } else {
switch (codec->codec_id) {
- case CODEC_ID_PCM_S16BE:
- codec->codec_id = aiff_codec_get_id(codec->bits_per_coded_sample);
- codec->bits_per_coded_sample = av_get_bits_per_sample(codec->codec_id);
+ case AV_CODEC_ID_PCM_F32BE:
+ case AV_CODEC_ID_PCM_F64BE:
+ case AV_CODEC_ID_PCM_S16LE:
+ case AV_CODEC_ID_PCM_ALAW:
+ case AV_CODEC_ID_PCM_MULAW:
+ aiff->block_duration = 1;
break;
- case CODEC_ID_ADPCM_IMA_QT:
+ case AV_CODEC_ID_ADPCM_IMA_QT:
codec->block_align = 34*codec->channels;
- codec->frame_size = 64;
break;
- case CODEC_ID_MACE3:
+ case AV_CODEC_ID_MACE3:
codec->block_align = 2*codec->channels;
- codec->frame_size = 6;
break;
- case CODEC_ID_MACE6:
+ case AV_CODEC_ID_MACE6:
codec->block_align = 1*codec->channels;
- codec->frame_size = 6;
break;
- case CODEC_ID_GSM:
+ case AV_CODEC_ID_GSM:
codec->block_align = 33;
- codec->frame_size = 160;
break;
- case CODEC_ID_QCELP:
+ case AV_CODEC_ID_QCELP:
codec->block_align = 35;
- codec->frame_size= 160;
break;
default:
break;
}
- size -= 4;
- } else {
- /* Need the codec type */
- codec->codec_id = aiff_codec_get_id(codec->bits_per_coded_sample);
- codec->bits_per_coded_sample = av_get_bits_per_sample(codec->codec_id);
+ if (codec->block_align > 0)
+ aiff->block_duration = av_get_audio_frame_duration(codec,
+ codec->block_align);
}
/* Block align needs to be computed in all cases, as the definition
@@ -151,8 +158,10 @@ static unsigned int get_aiff_header(AVIOContext *pb, AVCodecContext *codec,
if (!codec->block_align)
codec->block_align = (codec->bits_per_coded_sample * codec->channels) >> 3;
- codec->bit_rate = (codec->frame_size ? codec->sample_rate/codec->frame_size :
- codec->sample_rate) * (codec->block_align << 3);
+ if (aiff->block_duration) {
+ codec->bit_rate = codec->sample_rate * (codec->block_align << 3) /
+ aiff->block_duration;
+ }
/* Chunk is over */
if (size)
@@ -174,8 +183,7 @@ static int aiff_probe(AVProbeData *p)
}
/* aiff input */
-static int aiff_read_header(AVFormatContext *s,
- AVFormatParameters *ap)
+static int aiff_read_header(AVFormatContext *s)
{
int size, filesize;
int64_t offset = 0;
@@ -214,7 +222,7 @@ static int aiff_read_header(AVFormatContext *s,
switch (tag) {
case MKTAG('C', 'O', 'M', 'M'): /* Common chunk */
/* Then for the complete header info */
- st->nb_frames = get_aiff_header(pb, st->codec, size, version);
+ st->nb_frames = get_aiff_header(s, size, version);
if (st->nb_frames < 0)
return st->nb_frames;
if (offset > 0) // COMM is after SSND
@@ -273,8 +281,7 @@ got_sound:
/* Now positioned, get the sound data start and end */
avpriv_set_pts_info(st, 64, 1, st->codec->sample_rate);
st->start_time = 0;
- st->duration = st->codec->frame_size ?
- st->nb_frames * st->codec->frame_size : st->nb_frames;
+ st->duration = st->nb_frames * aiff->block_duration;
/* Position the stream at the first block */
avio_seek(pb, offset, SEEK_SET);
@@ -309,6 +316,7 @@ static int aiff_read_packet(AVFormatContext *s,
/* Only one stream in an AIFF file */
pkt->stream_index = 0;
+ pkt->duration = (res / st->codec->block_align) * aiff->block_duration;
return 0;
}
@@ -319,6 +327,6 @@ AVInputFormat ff_aiff_demuxer = {
.read_probe = aiff_probe,
.read_header = aiff_read_header,
.read_packet = aiff_read_packet,
- .read_seek = pcm_read_seek,
- .codec_tag= (const AVCodecTag* const []){ff_codec_aiff_tags, 0},
+ .read_seek = ff_pcm_read_seek,
+ .codec_tag = (const AVCodecTag* const []){ ff_codec_aiff_tags, 0 },
};
diff --git a/gst-libs/ext/libav/libavformat/aiffenc.c b/gst-libs/ext/libav/libavformat/aiffenc.c
index 2916d26..abcc424 100644
--- a/gst-libs/ext/libav/libavformat/aiffenc.c
+++ b/gst-libs/ext/libav/libavformat/aiffenc.c
@@ -155,10 +155,10 @@ AVOutputFormat ff_aiff_muxer = {
.mime_type = "audio/aiff",
.extensions = "aif,aiff,afc,aifc",
.priv_data_size = sizeof(AIFFOutputContext),
- .audio_codec = CODEC_ID_PCM_S16BE,
- .video_codec = CODEC_ID_NONE,
+ .audio_codec = AV_CODEC_ID_PCM_S16BE,
+ .video_codec = AV_CODEC_ID_NONE,
.write_header = aiff_write_header,
.write_packet = aiff_write_packet,
.write_trailer = aiff_write_trailer,
- .codec_tag= (const AVCodecTag* const []){ff_codec_aiff_tags, 0},
+ .codec_tag = (const AVCodecTag* const []){ ff_codec_aiff_tags, 0 },
};
diff --git a/gst-libs/ext/libav/libavformat/allformats.c b/gst-libs/ext/libav/libavformat/allformats.c
index 481d2c1..34cf566 100644
--- a/gst-libs/ext/libav/libavformat/allformats.c
+++ b/gst-libs/ext/libav/libavformat/allformats.c
@@ -18,24 +18,36 @@
* License along with Libav; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+
#include "avformat.h"
#include "rtp.h"
#include "rdt.h"
#include "url.h"
+#include "version.h"
-#define REGISTER_MUXER(X,x) { \
- extern AVOutputFormat ff_##x##_muxer; \
- if(CONFIG_##X##_MUXER) av_register_output_format(&ff_##x##_muxer); }
+#define REGISTER_MUXER(X, x) \
+ { \
+ extern AVOutputFormat ff_##x##_muxer; \
+ if (CONFIG_##X##_MUXER) \
+ av_register_output_format(&ff_##x##_muxer); \
+ }
-#define REGISTER_DEMUXER(X,x) { \
- extern AVInputFormat ff_##x##_demuxer; \
- if(CONFIG_##X##_DEMUXER) av_register_input_format(&ff_##x##_demuxer); }
+#define REGISTER_DEMUXER(X, x) \
+ { \
+ extern AVInputFormat ff_##x##_demuxer; \
+ if (CONFIG_##X##_DEMUXER) \
+ av_register_input_format(&ff_##x##_demuxer); \
+ }
-#define REGISTER_MUXDEMUX(X,x) REGISTER_MUXER(X,x); REGISTER_DEMUXER(X,x)
+#define REGISTER_MUXDEMUX(X, x) REGISTER_MUXER(X, x); REGISTER_DEMUXER(X, x)
-#define REGISTER_PROTOCOL(X,x) { \
- extern URLProtocol ff_##x##_protocol; \
- if(CONFIG_##X##_PROTOCOL) ffurl_register_protocol(&ff_##x##_protocol, sizeof(ff_##x##_protocol)); }
+#define REGISTER_PROTOCOL(X, x) \
+ { \
+ extern URLProtocol ff_##x##_protocol; \
+ if (CONFIG_##X##_PROTOCOL) \
+ ffurl_register_protocol(&ff_##x##_protocol, \
+ sizeof(ff_##x##_protocol)); \
+ }
void av_register_all(void)
{
@@ -48,219 +60,234 @@ void av_register_all(void)
avcodec_register_all();
/* (de)muxers */
- REGISTER_MUXER (A64, a64);
- REGISTER_DEMUXER (AAC, aac);
- REGISTER_MUXDEMUX (AC3, ac3);
- REGISTER_MUXER (ADTS, adts);
- REGISTER_MUXDEMUX (ADX, adx);
- REGISTER_DEMUXER (AEA, aea);
- REGISTER_MUXDEMUX (AIFF, aiff);
- REGISTER_MUXDEMUX (AMR, amr);
- REGISTER_DEMUXER (ANM, anm);
- REGISTER_DEMUXER (APC, apc);
- REGISTER_DEMUXER (APE, ape);
- REGISTER_DEMUXER (APPLEHTTP, applehttp);
- REGISTER_MUXDEMUX (ASF, asf);
- REGISTER_MUXDEMUX (ASS, ass);
- REGISTER_MUXER (ASF_STREAM, asf_stream);
- REGISTER_MUXDEMUX (AU, au);
- REGISTER_MUXDEMUX (AVI, avi);
- REGISTER_DEMUXER (AVISYNTH, avisynth);
- REGISTER_MUXER (AVM2, avm2);
- REGISTER_DEMUXER (AVS, avs);
- REGISTER_DEMUXER (BETHSOFTVID, bethsoftvid);
- REGISTER_DEMUXER (BFI, bfi);
- REGISTER_DEMUXER (BINK, bink);
- REGISTER_DEMUXER (BMV, bmv);
- REGISTER_DEMUXER (C93, c93);
- REGISTER_DEMUXER (CAF, caf);
- REGISTER_MUXDEMUX (CAVSVIDEO, cavsvideo);
- REGISTER_DEMUXER (CDG, cdg);
- REGISTER_MUXER (CRC, crc);
- REGISTER_MUXDEMUX (DAUD, daud);
- REGISTER_DEMUXER (DFA, dfa);
- REGISTER_MUXDEMUX (DIRAC, dirac);
- REGISTER_MUXDEMUX (DNXHD, dnxhd);
- REGISTER_DEMUXER (DSICIN, dsicin);
- REGISTER_MUXDEMUX (DTS, dts);
- REGISTER_MUXDEMUX (DV, dv);
- REGISTER_DEMUXER (DXA, dxa);
- REGISTER_DEMUXER (EA, ea);
- REGISTER_DEMUXER (EA_CDATA, ea_cdata);
- REGISTER_MUXDEMUX (EAC3, eac3);
- REGISTER_MUXDEMUX (FFM, ffm);
- REGISTER_MUXDEMUX (FFMETADATA, ffmetadata);
- REGISTER_MUXDEMUX (FILMSTRIP, filmstrip);
- REGISTER_MUXDEMUX (FLAC, flac);
- REGISTER_DEMUXER (FLIC, flic);
- REGISTER_MUXDEMUX (FLV, flv);
- REGISTER_DEMUXER (FOURXM, fourxm);
- REGISTER_MUXER (FRAMECRC, framecrc);
- REGISTER_MUXER (FRAMEMD5, framemd5);
- REGISTER_MUXDEMUX (G722, g722);
- REGISTER_MUXER (GIF, gif);
- REGISTER_DEMUXER (GSM, gsm);
- REGISTER_MUXDEMUX (GXF, gxf);
- REGISTER_MUXDEMUX (H261, h261);
- REGISTER_MUXDEMUX (H263, h263);
- REGISTER_MUXDEMUX (H264, h264);
- REGISTER_DEMUXER (IDCIN, idcin);
- REGISTER_DEMUXER (IFF, iff);
- REGISTER_MUXDEMUX (IMAGE2, image2);
- REGISTER_MUXDEMUX (IMAGE2PIPE, image2pipe);
- REGISTER_DEMUXER (INGENIENT, ingenient);
- REGISTER_DEMUXER (IPMOVIE, ipmovie);
- REGISTER_MUXER (IPOD, ipod);
- REGISTER_DEMUXER (ISS, iss);
- REGISTER_DEMUXER (IV8, iv8);
- REGISTER_MUXDEMUX (IVF, ivf);
- REGISTER_DEMUXER (JV, jv);
- REGISTER_MUXDEMUX (LATM, latm);
- REGISTER_DEMUXER (LMLM4, lmlm4);
- REGISTER_DEMUXER (LXF, lxf);
- REGISTER_MUXDEMUX (M4V, m4v);
- REGISTER_MUXER (MD5, md5);
- REGISTER_MUXDEMUX (MATROSKA, matroska);
- REGISTER_MUXER (MATROSKA_AUDIO, matroska_audio);
- REGISTER_MUXDEMUX (MJPEG, mjpeg);
- REGISTER_MUXDEMUX (MLP, mlp);
- REGISTER_DEMUXER (MM, mm);
- REGISTER_MUXDEMUX (MMF, mmf);
- REGISTER_MUXDEMUX (MOV, mov);
- REGISTER_MUXER (MP2, mp2);
- REGISTER_MUXDEMUX (MP3, mp3);
- REGISTER_MUXER (MP4, mp4);
- REGISTER_DEMUXER (MPC, mpc);
- REGISTER_DEMUXER (MPC8, mpc8);
- REGISTER_MUXER (MPEG1SYSTEM, mpeg1system);
- REGISTER_MUXER (MPEG1VCD, mpeg1vcd);
- REGISTER_MUXER (MPEG1VIDEO, mpeg1video);
- REGISTER_MUXER (MPEG2DVD, mpeg2dvd);
- REGISTER_MUXER (MPEG2SVCD, mpeg2svcd);
- REGISTER_MUXER (MPEG2VIDEO, mpeg2video);
- REGISTER_MUXER (MPEG2VOB, mpeg2vob);
- REGISTER_DEMUXER (MPEGPS, mpegps);
- REGISTER_MUXDEMUX (MPEGTS, mpegts);
- REGISTER_DEMUXER (MPEGTSRAW, mpegtsraw);
- REGISTER_DEMUXER (MPEGVIDEO, mpegvideo);
- REGISTER_MUXER (MPJPEG, mpjpeg);
- REGISTER_DEMUXER (MSNWC_TCP, msnwc_tcp);
- REGISTER_DEMUXER (MTV, mtv);
- REGISTER_DEMUXER (MVI, mvi);
- REGISTER_MUXDEMUX (MXF, mxf);
- REGISTER_MUXER (MXF_D10, mxf_d10);
- REGISTER_DEMUXER (MXG, mxg);
- REGISTER_DEMUXER (NC, nc);
- REGISTER_DEMUXER (NSV, nsv);
- REGISTER_MUXER (NULL, null);
- REGISTER_MUXDEMUX (NUT, nut);
- REGISTER_DEMUXER (NUV, nuv);
- REGISTER_MUXDEMUX (OGG, ogg);
- REGISTER_MUXDEMUX (OMA, oma);
- REGISTER_MUXDEMUX (PCM_ALAW, pcm_alaw);
- REGISTER_MUXDEMUX (PCM_MULAW, pcm_mulaw);
- REGISTER_MUXDEMUX (PCM_F64BE, pcm_f64be);
- REGISTER_MUXDEMUX (PCM_F64LE, pcm_f64le);
- REGISTER_MUXDEMUX (PCM_F32BE, pcm_f32be);
- REGISTER_MUXDEMUX (PCM_F32LE, pcm_f32le);
- REGISTER_MUXDEMUX (PCM_S32BE, pcm_s32be);
- REGISTER_MUXDEMUX (PCM_S32LE, pcm_s32le);
- REGISTER_MUXDEMUX (PCM_S24BE, pcm_s24be);
- REGISTER_MUXDEMUX (PCM_S24LE, pcm_s24le);
- REGISTER_MUXDEMUX (PCM_S16BE, pcm_s16be);
- REGISTER_MUXDEMUX (PCM_S16LE, pcm_s16le);
- REGISTER_MUXDEMUX (PCM_S8, pcm_s8);
- REGISTER_MUXDEMUX (PCM_U32BE, pcm_u32be);
- REGISTER_MUXDEMUX (PCM_U32LE, pcm_u32le);
- REGISTER_MUXDEMUX (PCM_U24BE, pcm_u24be);
- REGISTER_MUXDEMUX (PCM_U24LE, pcm_u24le);
- REGISTER_MUXDEMUX (PCM_U16BE, pcm_u16be);
- REGISTER_MUXDEMUX (PCM_U16LE, pcm_u16le);
- REGISTER_MUXDEMUX (PCM_U8, pcm_u8);
- REGISTER_DEMUXER (PMP, pmp);
- REGISTER_MUXER (PSP, psp);
- REGISTER_DEMUXER (PVA, pva);
- REGISTER_DEMUXER (QCP, qcp);
- REGISTER_DEMUXER (R3D, r3d);
- REGISTER_MUXDEMUX (RAWVIDEO, rawvideo);
- REGISTER_DEMUXER (RL2, rl2);
- REGISTER_MUXDEMUX (RM, rm);
- REGISTER_MUXDEMUX (ROQ, roq);
- REGISTER_DEMUXER (RPL, rpl);
- REGISTER_MUXDEMUX (RSO, rso);
- REGISTER_MUXDEMUX (RTP, rtp);
- REGISTER_MUXDEMUX (RTSP, rtsp);
- REGISTER_MUXDEMUX (SAP, sap);
- REGISTER_DEMUXER (SDP, sdp);
+ REGISTER_MUXER (A64, a64);
+ REGISTER_DEMUXER (AAC, aac);
+ REGISTER_MUXDEMUX(AC3, ac3);
+ REGISTER_MUXER (ADTS, adts);
+ REGISTER_MUXDEMUX(ADX, adx);
+ REGISTER_DEMUXER (AEA, aea);
+ REGISTER_MUXDEMUX(AIFF, aiff);
+ REGISTER_MUXDEMUX(AMR, amr);
+ REGISTER_DEMUXER (ANM, anm);
+ REGISTER_DEMUXER (APC, apc);
+ REGISTER_DEMUXER (APE, ape);
+ REGISTER_MUXDEMUX(ASF, asf);
+ REGISTER_MUXDEMUX(ASS, ass);
+ REGISTER_MUXER (ASF_STREAM, asf_stream);
+ REGISTER_MUXDEMUX(AU, au);
+ REGISTER_MUXDEMUX(AVI, avi);
+ REGISTER_DEMUXER (AVISYNTH, avisynth);
+ REGISTER_MUXER (AVM2, avm2);
+ REGISTER_DEMUXER (AVS, avs);
+ REGISTER_DEMUXER (BETHSOFTVID, bethsoftvid);
+ REGISTER_DEMUXER (BFI, bfi);
+ REGISTER_DEMUXER (BINK, bink);
+ REGISTER_DEMUXER (BMV, bmv);
+ REGISTER_DEMUXER (C93, c93);
+ REGISTER_DEMUXER (CAF, caf);
+ REGISTER_MUXDEMUX(CAVSVIDEO, cavsvideo);
+ REGISTER_DEMUXER (CDG, cdg);
+ REGISTER_DEMUXER (CDXL, cdxl);
+ REGISTER_MUXER (CRC, crc);
+ REGISTER_MUXDEMUX(DAUD, daud);
+ REGISTER_DEMUXER (DFA, dfa);
+ REGISTER_MUXDEMUX(DIRAC, dirac);
+ REGISTER_MUXDEMUX(DNXHD, dnxhd);
+ REGISTER_DEMUXER (DSICIN, dsicin);
+ REGISTER_MUXDEMUX(DTS, dts);
+ REGISTER_MUXDEMUX(DV, dv);
+ REGISTER_DEMUXER (DXA, dxa);
+ REGISTER_DEMUXER (EA, ea);
+ REGISTER_DEMUXER (EA_CDATA, ea_cdata);
+ REGISTER_MUXDEMUX(EAC3, eac3);
+ REGISTER_MUXDEMUX(FFM, ffm);
+ REGISTER_MUXDEMUX(FFMETADATA, ffmetadata);
+ REGISTER_MUXDEMUX(FILMSTRIP, filmstrip);
+ REGISTER_MUXDEMUX(FLAC, flac);
+ REGISTER_DEMUXER (FLIC, flic);
+ REGISTER_MUXDEMUX(FLV, flv);
+ REGISTER_DEMUXER (FOURXM, fourxm);
+ REGISTER_MUXER (FRAMECRC, framecrc);
+ REGISTER_MUXER (FRAMEMD5, framemd5);
+ REGISTER_MUXDEMUX(G722, g722);
+ REGISTER_DEMUXER (G723_1, g723_1);
+ REGISTER_MUXER (GIF, gif);
+ REGISTER_DEMUXER (GSM, gsm);
+ REGISTER_MUXDEMUX(GXF, gxf);
+ REGISTER_MUXDEMUX(H261, h261);
+ REGISTER_MUXDEMUX(H263, h263);
+ REGISTER_MUXDEMUX(H264, h264);
+ REGISTER_MUXDEMUX(HLS, hls);
+ REGISTER_DEMUXER (IDCIN, idcin);
+ REGISTER_DEMUXER (IFF, iff);
+ REGISTER_MUXDEMUX(ILBC, ilbc);
+ REGISTER_MUXDEMUX(IMAGE2, image2);
+ REGISTER_MUXDEMUX(IMAGE2PIPE, image2pipe);
+ REGISTER_DEMUXER (INGENIENT, ingenient);
+ REGISTER_DEMUXER (IPMOVIE, ipmovie);
+ REGISTER_MUXER (IPOD, ipod);
+ REGISTER_MUXER (ISMV, ismv);
+ REGISTER_DEMUXER (ISS, iss);
+ REGISTER_DEMUXER (IV8, iv8);
+ REGISTER_MUXDEMUX(IVF, ivf);
+ REGISTER_DEMUXER (JV, jv);
+ REGISTER_MUXDEMUX(LATM, latm);
+ REGISTER_DEMUXER (LMLM4, lmlm4);
+ REGISTER_DEMUXER (LXF, lxf);
+ REGISTER_MUXDEMUX(M4V, m4v);
+ REGISTER_MUXER (MD5, md5);
+ REGISTER_MUXDEMUX(MATROSKA, matroska);
+ REGISTER_MUXER (MATROSKA_AUDIO, matroska_audio);
+ REGISTER_MUXDEMUX(MJPEG, mjpeg);
+ REGISTER_MUXDEMUX(MLP, mlp);
+ REGISTER_DEMUXER (MM, mm);
+ REGISTER_MUXDEMUX(MMF, mmf);
+ REGISTER_MUXDEMUX(MOV, mov);
+ REGISTER_MUXER (MP2, mp2);
+ REGISTER_MUXDEMUX(MP3, mp3);
+ REGISTER_MUXER (MP4, mp4);
+ REGISTER_DEMUXER (MPC, mpc);
+ REGISTER_DEMUXER (MPC8, mpc8);
+ REGISTER_MUXER (MPEG1SYSTEM, mpeg1system);
+ REGISTER_MUXER (MPEG1VCD, mpeg1vcd);
+ REGISTER_MUXER (MPEG1VIDEO, mpeg1video);
+ REGISTER_MUXER (MPEG2DVD, mpeg2dvd);
+ REGISTER_MUXER (MPEG2SVCD, mpeg2svcd);
+ REGISTER_MUXER (MPEG2VIDEO, mpeg2video);
+ REGISTER_MUXER (MPEG2VOB, mpeg2vob);
+ REGISTER_DEMUXER (MPEGPS, mpegps);
+ REGISTER_MUXDEMUX(MPEGTS, mpegts);
+ REGISTER_DEMUXER (MPEGTSRAW, mpegtsraw);
+ REGISTER_DEMUXER (MPEGVIDEO, mpegvideo);
+ REGISTER_MUXER (MPJPEG, mpjpeg);
+ REGISTER_DEMUXER (MSNWC_TCP, msnwc_tcp);
+ REGISTER_DEMUXER (MTV, mtv);
+ REGISTER_DEMUXER (MVI, mvi);
+ REGISTER_MUXDEMUX(MXF, mxf);
+ REGISTER_MUXER (MXF_D10, mxf_d10);
+ REGISTER_DEMUXER (MXG, mxg);
+ REGISTER_DEMUXER (NC, nc);
+ REGISTER_DEMUXER (NSV, nsv);
+ REGISTER_MUXER (NULL, null);
+ REGISTER_MUXDEMUX(NUT, nut);
+ REGISTER_DEMUXER (NUV, nuv);
+ REGISTER_MUXDEMUX(OGG, ogg);
+ REGISTER_MUXDEMUX(OMA, oma);
+ REGISTER_MUXDEMUX(PCM_ALAW, pcm_alaw);
+ REGISTER_MUXDEMUX(PCM_MULAW, pcm_mulaw);
+ REGISTER_MUXDEMUX(PCM_F64BE, pcm_f64be);
+ REGISTER_MUXDEMUX(PCM_F64LE, pcm_f64le);
+ REGISTER_MUXDEMUX(PCM_F32BE, pcm_f32be);
+ REGISTER_MUXDEMUX(PCM_F32LE, pcm_f32le);
+ REGISTER_MUXDEMUX(PCM_S32BE, pcm_s32be);
+ REGISTER_MUXDEMUX(PCM_S32LE, pcm_s32le);
+ REGISTER_MUXDEMUX(PCM_S24BE, pcm_s24be);
+ REGISTER_MUXDEMUX(PCM_S24LE, pcm_s24le);
+ REGISTER_MUXDEMUX(PCM_S16BE, pcm_s16be);
+ REGISTER_MUXDEMUX(PCM_S16LE, pcm_s16le);
+ REGISTER_MUXDEMUX(PCM_S8, pcm_s8);
+ REGISTER_MUXDEMUX(PCM_U32BE, pcm_u32be);
+ REGISTER_MUXDEMUX(PCM_U32LE, pcm_u32le);
+ REGISTER_MUXDEMUX(PCM_U24BE, pcm_u24be);
+ REGISTER_MUXDEMUX(PCM_U24LE, pcm_u24le);
+ REGISTER_MUXDEMUX(PCM_U16BE, pcm_u16be);
+ REGISTER_MUXDEMUX(PCM_U16LE, pcm_u16le);
+ REGISTER_MUXDEMUX(PCM_U8, pcm_u8);
+ REGISTER_DEMUXER (PMP, pmp);
+ REGISTER_MUXER (PSP, psp);
+ REGISTER_DEMUXER (PVA, pva);
+ REGISTER_DEMUXER (QCP, qcp);
+ REGISTER_DEMUXER (R3D, r3d);
+ REGISTER_MUXDEMUX(RAWVIDEO, rawvideo);
+ REGISTER_DEMUXER (RL2, rl2);
+ REGISTER_MUXDEMUX(RM, rm);
+ REGISTER_MUXDEMUX(ROQ, roq);
+ REGISTER_DEMUXER (RPL, rpl);
+ REGISTER_MUXDEMUX(RSO, rso);
+ REGISTER_MUXDEMUX(RTP, rtp);
+ REGISTER_MUXDEMUX(RTSP, rtsp);
+ REGISTER_MUXDEMUX(SAP, sap);
+ REGISTER_DEMUXER (SDP, sdp);
#if CONFIG_RTPDEC
av_register_rtp_dynamic_payload_handlers();
av_register_rdt_dynamic_payload_handlers();
#endif
- REGISTER_DEMUXER (SEGAFILM, segafilm);
- REGISTER_MUXER (SEGMENT, segment);
- REGISTER_DEMUXER (SHORTEN, shorten);
- REGISTER_DEMUXER (SIFF, siff);
- REGISTER_DEMUXER (SMACKER, smacker);
- REGISTER_MUXDEMUX (SMJPEG, smjpeg);
- REGISTER_DEMUXER (SOL, sol);
- REGISTER_MUXDEMUX (SOX, sox);
- REGISTER_MUXDEMUX (SPDIF, spdif);
- REGISTER_MUXDEMUX (SRT, srt);
- REGISTER_DEMUXER (STR, str);
- REGISTER_MUXDEMUX (SWF, swf);
- REGISTER_MUXER (TG2, tg2);
- REGISTER_MUXER (TGP, tgp);
- REGISTER_DEMUXER (THP, thp);
- REGISTER_DEMUXER (TIERTEXSEQ, tiertexseq);
- REGISTER_DEMUXER (TMV, tmv);
- REGISTER_MUXDEMUX (TRUEHD, truehd);
- REGISTER_DEMUXER (TTA, tta);
- REGISTER_DEMUXER (TXD, txd);
- REGISTER_DEMUXER (TTY, tty);
- REGISTER_DEMUXER (VC1, vc1);
- REGISTER_MUXDEMUX (VC1T, vc1t);
- REGISTER_DEMUXER (VMD, vmd);
- REGISTER_MUXDEMUX (VOC, voc);
- REGISTER_DEMUXER (VQF, vqf);
- REGISTER_DEMUXER (W64, w64);
- REGISTER_MUXDEMUX (WAV, wav);
- REGISTER_DEMUXER (WC3, wc3);
- REGISTER_MUXER (WEBM, webm);
- REGISTER_DEMUXER (WSAUD, wsaud);
- REGISTER_DEMUXER (WSVQA, wsvqa);
- REGISTER_DEMUXER (WTV, wtv);
- REGISTER_DEMUXER (WV, wv);
- REGISTER_DEMUXER (XA, xa);
- REGISTER_DEMUXER (XMV, xmv);
- REGISTER_DEMUXER (XWMA, xwma);
- REGISTER_DEMUXER (YOP, yop);
- REGISTER_MUXDEMUX (YUV4MPEGPIPE, yuv4mpegpipe);
-
- /* external libraries */
- REGISTER_MUXDEMUX (LIBNUT, libnut);
+ REGISTER_DEMUXER (SEGAFILM, segafilm);
+ REGISTER_MUXER (SEGMENT, segment);
+ REGISTER_DEMUXER (SHORTEN, shorten);
+ REGISTER_DEMUXER (SIFF, siff);
+ REGISTER_DEMUXER (SMACKER, smacker);
+ REGISTER_MUXDEMUX(SMJPEG, smjpeg);
+ REGISTER_MUXER (SMOOTHSTREAMING, smoothstreaming);
+ REGISTER_DEMUXER (SOL, sol);
+ REGISTER_MUXDEMUX(SOX, sox);
+ REGISTER_MUXDEMUX(SPDIF, spdif);
+ REGISTER_MUXDEMUX(SRT, srt);
+ REGISTER_DEMUXER (STR, str);
+ REGISTER_MUXDEMUX(SWF, swf);
+ REGISTER_DEMUXER (TAK, tak);
+ REGISTER_MUXER (TG2, tg2);
+ REGISTER_MUXER (TGP, tgp);
+ REGISTER_DEMUXER (THP, thp);
+ REGISTER_DEMUXER (TIERTEXSEQ, tiertexseq);
+ REGISTER_DEMUXER (TMV, tmv);
+ REGISTER_MUXDEMUX(TRUEHD, truehd);
+ REGISTER_DEMUXER (TTA, tta);
+ REGISTER_DEMUXER (TXD, txd);
+ REGISTER_DEMUXER (TTY, tty);
+ REGISTER_DEMUXER (VC1, vc1);
+ REGISTER_MUXDEMUX(VC1T, vc1t);
+ REGISTER_DEMUXER (VMD, vmd);
+ REGISTER_MUXDEMUX(VOC, voc);
+ REGISTER_DEMUXER (VQF, vqf);
+ REGISTER_DEMUXER (W64, w64);
+ REGISTER_MUXDEMUX(WAV, wav);
+ REGISTER_DEMUXER (WC3, wc3);
+ REGISTER_MUXER (WEBM, webm);
+ REGISTER_DEMUXER (WSAUD, wsaud);
+ REGISTER_DEMUXER (WSVQA, wsvqa);
+ REGISTER_DEMUXER (WTV, wtv);
+ REGISTER_DEMUXER (WV, wv);
+ REGISTER_DEMUXER (XA, xa);
+ REGISTER_DEMUXER (XMV, xmv);
+ REGISTER_DEMUXER (XWMA, xwma);
+ REGISTER_DEMUXER (YOP, yop);
+ REGISTER_MUXDEMUX(YUV4MPEGPIPE, yuv4mpegpipe);
/* protocols */
- REGISTER_PROTOCOL (APPLEHTTP, applehttp);
- REGISTER_PROTOCOL (CONCAT, concat);
- REGISTER_PROTOCOL (CRYPTO, crypto);
- REGISTER_PROTOCOL (FILE, file);
- REGISTER_PROTOCOL (GOPHER, gopher);
- REGISTER_PROTOCOL (HTTP, http);
- REGISTER_PROTOCOL (HTTPPROXY, httpproxy);
- REGISTER_PROTOCOL (HTTPS, https);
- REGISTER_PROTOCOL (MMSH, mmsh);
- REGISTER_PROTOCOL (MMST, mmst);
- REGISTER_PROTOCOL (MD5, md5);
- REGISTER_PROTOCOL (PIPE, pipe);
- REGISTER_PROTOCOL (RTMP, rtmp);
-#if CONFIG_LIBRTMP
- REGISTER_PROTOCOL (RTMP, rtmpt);
- REGISTER_PROTOCOL (RTMP, rtmpe);
- REGISTER_PROTOCOL (RTMP, rtmpte);
- REGISTER_PROTOCOL (RTMP, rtmps);
+#if FF_API_APPLEHTTP_PROTO
+ REGISTER_PROTOCOL(APPLEHTTP, applehttp);
#endif
- REGISTER_PROTOCOL (RTP, rtp);
- REGISTER_PROTOCOL (TCP, tcp);
- REGISTER_PROTOCOL (TLS, tls);
- REGISTER_PROTOCOL (UDP, udp);
+ REGISTER_PROTOCOL(CONCAT, concat);
+ REGISTER_PROTOCOL(CRYPTO, crypto);
+ REGISTER_PROTOCOL(FFRTMPCRYPT, ffrtmpcrypt);
+ REGISTER_PROTOCOL(FFRTMPHTTP, ffrtmphttp);
+ REGISTER_PROTOCOL(FILE, file);
+ REGISTER_PROTOCOL(GOPHER, gopher);
+ REGISTER_PROTOCOL(HLS, hls);
+ REGISTER_PROTOCOL(HTTP, http);
+ REGISTER_PROTOCOL(HTTPPROXY, httpproxy);
+ REGISTER_PROTOCOL(HTTPS, https);
+ REGISTER_PROTOCOL(MMSH, mmsh);
+ REGISTER_PROTOCOL(MMST, mmst);
+ REGISTER_PROTOCOL(MD5, md5);
+ REGISTER_PROTOCOL(PIPE, pipe);
+ REGISTER_PROTOCOL(RTMP, rtmp);
+ REGISTER_PROTOCOL(RTMPE, rtmpe);
+ REGISTER_PROTOCOL(RTMPS, rtmps);
+ REGISTER_PROTOCOL(RTMPT, rtmpt);
+ REGISTER_PROTOCOL(RTMPTE, rtmpte);
+ REGISTER_PROTOCOL(RTMPTS, rtmpts);
+ REGISTER_PROTOCOL(RTP, rtp);
+ REGISTER_PROTOCOL(SCTP, sctp);
+ REGISTER_PROTOCOL(TCP, tcp);
+ REGISTER_PROTOCOL(TLS, tls);
+ REGISTER_PROTOCOL(UDP, udp);
+
+ /* external libraries */
+ REGISTER_PROTOCOL(LIBRTMP, librtmp);
+ REGISTER_PROTOCOL(LIBRTMPE, librtmpe);
+ REGISTER_PROTOCOL(LIBRTMPS, librtmps);
+ REGISTER_PROTOCOL(LIBRTMPT, librtmpt);
+ REGISTER_PROTOCOL(LIBRTMPTE, librtmpte);
}
diff --git a/gst-libs/ext/libav/libavformat/amr.c b/gst-libs/ext/libav/libavformat/amr.c
index b52ac49..ba91d7c 100644
--- a/gst-libs/ext/libav/libavformat/amr.c
+++ b/gst-libs/ext/libav/libavformat/amr.c
@@ -25,30 +25,27 @@ Write and read amr data according to RFC3267, http://www.ietf.org/rfc/rfc3267.tx
Only mono files are supported.
*/
+
+#include "libavutil/channel_layout.h"
#include "avformat.h"
#include "internal.h"
-static const char AMR_header [] = "#!AMR\n";
-static const char AMRWB_header [] = "#!AMR-WB\n";
+static const char AMR_header[] = "#!AMR\n";
+static const char AMRWB_header[] = "#!AMR-WB\n";
#if CONFIG_AMR_MUXER
static int amr_write_header(AVFormatContext *s)
{
- AVIOContext *pb = s->pb;
+ AVIOContext *pb = s->pb;
AVCodecContext *enc = s->streams[0]->codec;
s->priv_data = NULL;
- if (enc->codec_id == CODEC_ID_AMR_NB)
- {
+ if (enc->codec_id == AV_CODEC_ID_AMR_NB) {
avio_write(pb, AMR_header, sizeof(AMR_header) - 1); /* magic number */
- }
- else if(enc->codec_id == CODEC_ID_AMR_WB)
- {
+ } else if (enc->codec_id == AV_CODEC_ID_AMR_WB) {
avio_write(pb, AMRWB_header, sizeof(AMRWB_header) - 1); /* magic number */
- }
- else
- {
+ } else {
return -1;
}
avio_flush(pb);
@@ -65,19 +62,18 @@ static int amr_write_packet(AVFormatContext *s, AVPacket *pkt)
static int amr_probe(AVProbeData *p)
{
- //Only check for "#!AMR" which could be amr-wb, amr-nb.
- //This will also trigger multichannel files: "#!AMR_MC1.0\n" and
- //"#!AMR-WB_MC1.0\n" (not supported)
+ // Only check for "#!AMR" which could be amr-wb, amr-nb.
+ // This will also trigger multichannel files: "#!AMR_MC1.0\n" and
+ // "#!AMR-WB_MC1.0\n" (not supported)
- if(memcmp(p->buf,AMR_header,5)==0)
+ if (!memcmp(p->buf, AMR_header, 5))
return AVPROBE_SCORE_MAX;
else
return 0;
}
/* amr input */
-static int amr_read_header(AVFormatContext *s,
- AVFormatParameters *ap)
+static int amr_read_header(AVFormatContext *s)
{
AVIOContext *pb = s->pb;
AVStream *st;
@@ -87,85 +83,72 @@ static int amr_read_header(AVFormatContext *s,
st = avformat_new_stream(s, NULL);
if (!st)
- {
return AVERROR(ENOMEM);
- }
- if(memcmp(header,AMR_header,6)!=0)
- {
- avio_read(pb, header+6, 3);
- if(memcmp(header,AMRWB_header,9)!=0)
- {
+ if (memcmp(header, AMR_header, 6)) {
+ avio_read(pb, header + 6, 3);
+ if (memcmp(header, AMRWB_header, 9)) {
return -1;
}
- st->codec->codec_tag = MKTAG('s', 'a', 'w', 'b');
- st->codec->codec_id = CODEC_ID_AMR_WB;
+ st->codec->codec_tag = MKTAG('s', 'a', 'w', 'b');
+ st->codec->codec_id = AV_CODEC_ID_AMR_WB;
st->codec->sample_rate = 16000;
- st->codec->frame_size = 320;
- }
- else
- {
- st->codec->codec_tag = MKTAG('s', 'a', 'm', 'r');
- st->codec->codec_id = CODEC_ID_AMR_NB;
+ } else {
+ st->codec->codec_tag = MKTAG('s', 'a', 'm', 'r');
+ st->codec->codec_id = AV_CODEC_ID_AMR_NB;
st->codec->sample_rate = 8000;
- st->codec->frame_size = 160;
}
- st->codec->channels = 1;
+ st->codec->channels = 1;
+ st->codec->channel_layout = AV_CH_LAYOUT_MONO;
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
avpriv_set_pts_info(st, 64, 1, st->codec->sample_rate);
return 0;
}
-static int amr_read_packet(AVFormatContext *s,
- AVPacket *pkt)
+static int amr_read_packet(AVFormatContext *s, AVPacket *pkt)
{
AVCodecContext *enc = s->streams[0]->codec;
int read, size = 0, toc, mode;
int64_t pos = avio_tell(s->pb);
- if (s->pb->eof_reached)
- {
+ if (s->pb->eof_reached) {
return AVERROR(EIO);
}
-//FIXME this is wrong, this should rather be in a AVParset
- toc=avio_r8(s->pb);
+ // FIXME this is wrong, this should rather be in a AVParset
+ toc = avio_r8(s->pb);
mode = (toc >> 3) & 0x0F;
- if (enc->codec_id == CODEC_ID_AMR_NB)
- {
- static const uint8_t packed_size[16] = {12, 13, 15, 17, 19, 20, 26, 31, 5, 0, 0, 0, 0, 0, 0, 0};
+ if (enc->codec_id == AV_CODEC_ID_AMR_NB) {
+ static const uint8_t packed_size[16] = {
+ 12, 13, 15, 17, 19, 20, 26, 31, 5, 0, 0, 0, 0, 0, 0, 0
+ };
- size=packed_size[mode]+1;
- }
- else if(enc->codec_id == CODEC_ID_AMR_WB)
- {
- static uint8_t packed_size[16] = {18, 24, 33, 37, 41, 47, 51, 59, 61, 6, 6, 0, 0, 0, 1, 1};
+ size = packed_size[mode] + 1;
+ } else if (enc->codec_id == AV_CODEC_ID_AMR_WB) {
+ static const uint8_t packed_size[16] = {
+ 18, 24, 33, 37, 41, 47, 51, 59, 61, 6, 6, 0, 0, 0, 1, 1
+ };
- size=packed_size[mode];
- }
- else
- {
+ size = packed_size[mode];
+ } else {
assert(0);
}
- if ( (size==0) || av_new_packet(pkt, size))
- {
+ if (!size || av_new_packet(pkt, size))
return AVERROR(EIO);
- }
/* Both AMR formats have 50 frames per second */
s->streams[0]->codec->bit_rate = size*8*50;
pkt->stream_index = 0;
- pkt->pos = pos;
- pkt->data[0]=toc;
- pkt->duration= enc->codec_id == CODEC_ID_AMR_NB ? 160 : 320;
- read = avio_read(s->pb, pkt->data+1, size-1);
+ pkt->pos = pos;
+ pkt->data[0] = toc;
+ pkt->duration = enc->codec_id == AV_CODEC_ID_AMR_NB ? 160 : 320;
+ read = avio_read(s->pb, pkt->data + 1, size - 1);
- if (read != size-1)
- {
+ if (read != size - 1) {
av_free_packet(pkt);
return AVERROR(EIO);
}
@@ -176,22 +159,22 @@ static int amr_read_packet(AVFormatContext *s,
#if CONFIG_AMR_DEMUXER
AVInputFormat ff_amr_demuxer = {
.name = "amr",
- .long_name = NULL_IF_CONFIG_SMALL("3GPP AMR file format"),
+ .long_name = NULL_IF_CONFIG_SMALL("3GPP AMR"),
.read_probe = amr_probe,
.read_header = amr_read_header,
.read_packet = amr_read_packet,
- .flags = AVFMT_GENERIC_INDEX,
+ .flags = AVFMT_GENERIC_INDEX,
};
#endif
#if CONFIG_AMR_MUXER
AVOutputFormat ff_amr_muxer = {
.name = "amr",
- .long_name = NULL_IF_CONFIG_SMALL("3GPP AMR file format"),
+ .long_name = NULL_IF_CONFIG_SMALL("3GPP AMR"),
.mime_type = "audio/amr",
.extensions = "amr",
- .audio_codec = CODEC_ID_AMR_NB,
- .video_codec = CODEC_ID_NONE,
+ .audio_codec = AV_CODEC_ID_AMR_NB,
+ .video_codec = AV_CODEC_ID_NONE,
.write_header = amr_write_header,
.write_packet = amr_write_packet,
};
diff --git a/gst-libs/ext/libav/libavformat/anm.c b/gst-libs/ext/libav/libavformat/anm.c
index 7ceb2d8..7e52e83 100644
--- a/gst-libs/ext/libav/libavformat/anm.c
+++ b/gst-libs/ext/libav/libavformat/anm.c
@@ -76,8 +76,7 @@ static int find_record(const AnmDemuxContext *anm, int record)
return AVERROR_INVALIDDATA;
}
-static int read_header(AVFormatContext *s,
- AVFormatParameters *ap)
+static int read_header(AVFormatContext *s)
{
AnmDemuxContext *anm = s->priv_data;
AVIOContext *pb = s->pb;
@@ -87,7 +86,7 @@ static int read_header(AVFormatContext *s,
avio_skip(pb, 4); /* magic number */
if (avio_rl16(pb) != MAX_PAGES) {
av_log_ask_for_sample(s, "max_pages != " AV_STRINGIFY(MAX_PAGES) "\n");
- return AVERROR_INVALIDDATA;
+ return AVERROR_PATCHWELCOME;
}
anm->nb_pages = avio_rl16(pb);
@@ -102,7 +101,7 @@ static int read_header(AVFormatContext *s,
if (!st)
return AVERROR(ENOMEM);
st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
- st->codec->codec_id = CODEC_ID_ANM;
+ st->codec->codec_id = AV_CODEC_ID_ANM;
st->codec->codec_tag = 0; /* no fourcc */
st->codec->width = avio_rl16(pb);
st->codec->height = avio_rl16(pb);
@@ -167,7 +166,7 @@ static int read_header(AVFormatContext *s,
invalid:
av_log_ask_for_sample(s, NULL);
- ret = AVERROR_INVALIDDATA;
+ ret = AVERROR_PATCHWELCOME;
fail:
return ret;
diff --git a/gst-libs/ext/libav/libavformat/apc.c b/gst-libs/ext/libav/libavformat/apc.c
index 2383950..0b6c583 100644
--- a/gst-libs/ext/libav/libavformat/apc.c
+++ b/gst-libs/ext/libav/libavformat/apc.c
@@ -20,6 +20,8 @@
*/
#include <string.h>
+
+#include "libavutil/channel_layout.h"
#include "avformat.h"
static int apc_probe(AVProbeData *p)
@@ -30,7 +32,7 @@ static int apc_probe(AVProbeData *p)
return 0;
}
-static int apc_read_header(AVFormatContext *s, AVFormatParameters *ap)
+static int apc_read_header(AVFormatContext *s)
{
AVIOContext *pb = s->pb;
AVStream *st;
@@ -44,7 +46,7 @@ static int apc_read_header(AVFormatContext *s, AVFormatParameters *ap)
return AVERROR(ENOMEM);
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
- st->codec->codec_id = CODEC_ID_ADPCM_IMA_WS;
+ st->codec->codec_id = AV_CODEC_ID_ADPCM_IMA_APC;
avio_rl32(pb); /* number of samples */
st->codec->sample_rate = avio_rl32(pb);
@@ -58,9 +60,13 @@ static int apc_read_header(AVFormatContext *s, AVFormatParameters *ap)
/* initial predictor values for adpcm decoder */
avio_read(pb, st->codec->extradata, 2 * 4);
- st->codec->channels = 1;
- if (avio_rl32(pb))
- st->codec->channels = 2;
+ if (avio_rl32(pb)) {
+ st->codec->channels = 2;
+ st->codec->channel_layout = AV_CH_LAYOUT_STEREO;
+ } else {
+ st->codec->channels = 1;
+ st->codec->channel_layout = AV_CH_LAYOUT_MONO;
+ }
st->codec->bits_per_coded_sample = 4;
st->codec->bit_rate = st->codec->bits_per_coded_sample * st->codec->channels
@@ -82,7 +88,7 @@ static int apc_read_packet(AVFormatContext *s, AVPacket *pkt)
AVInputFormat ff_apc_demuxer = {
.name = "apc",
- .long_name = NULL_IF_CONFIG_SMALL("CRYO APC format"),
+ .long_name = NULL_IF_CONFIG_SMALL("CRYO APC"),
.read_probe = apc_probe,
.read_header = apc_read_header,
.read_packet = apc_read_packet,
diff --git a/gst-libs/ext/libav/libavformat/ape.c b/gst-libs/ext/libav/libavformat/ape.c
index a60626e..d67e684 100644
--- a/gst-libs/ext/libav/libavformat/ape.c
+++ b/gst-libs/ext/libav/libavformat/ape.c
@@ -152,15 +152,15 @@ static void ape_dumpinfo(AVFormatContext * s, APEContext * ape_ctx)
#endif
}
-static int ape_read_header(AVFormatContext * s, AVFormatParameters * ap)
+static int ape_read_header(AVFormatContext * s)
{
AVIOContext *pb = s->pb;
APEContext *ape = s->priv_data;
AVStream *st;
uint32_t tag;
int i;
- int total_blocks;
- int64_t pts;
+ int total_blocks, final_size = 0;
+ int64_t pts, file_size;
/* Skip any leading junk such as id3v2 tags */
ape->junklength = avio_tell(pb);
@@ -289,8 +289,17 @@ static int ape_read_header(AVFormatContext * s, AVFormatParameters * ap)
ape->frames[i - 1].size = ape->frames[i].pos - ape->frames[i - 1].pos;
ape->frames[i].skip = (ape->frames[i].pos - ape->frames[0].pos) & 3;
}
- ape->frames[ape->totalframes - 1].size = ape->finalframeblocks * 4;
ape->frames[ape->totalframes - 1].nblocks = ape->finalframeblocks;
+ /* calculate final packet size from total file size, if available */
+ file_size = avio_size(pb);
+ if (file_size > 0) {
+ final_size = file_size - ape->frames[ape->totalframes - 1].pos -
+ ape->wavtaillength;
+ final_size -= final_size & 3;
+ }
+ if (file_size <= 0 || final_size <= 0)
+ final_size = ape->finalframeblocks * 8;
+ ape->frames[ape->totalframes - 1].size = final_size;
for (i = 0; i < ape->totalframes; i++) {
if(ape->frames[i].skip){
@@ -303,12 +312,6 @@ static int ape_read_header(AVFormatContext * s, AVFormatParameters * ap)
ape_dumpinfo(s, ape);
- /* try to read APE tags */
- if (pb->seekable) {
- ff_ape_parse_tag(s);
- avio_seek(pb, 0, SEEK_SET);
- }
-
av_log(s, AV_LOG_DEBUG, "Decoding file - v%d.%02d, compression level %"PRIu16"\n",
ape->fileversion / 1000, (ape->fileversion % 1000) / 10,
ape->compressiontype);
@@ -321,12 +324,11 @@ static int ape_read_header(AVFormatContext * s, AVFormatParameters * ap)
total_blocks = (ape->totalframes == 0) ? 0 : ((ape->totalframes - 1) * ape->blocksperframe) + ape->finalframeblocks;
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
- st->codec->codec_id = CODEC_ID_APE;
+ st->codec->codec_id = AV_CODEC_ID_APE;
st->codec->codec_tag = MKTAG('A', 'P', 'E', ' ');
st->codec->channels = ape->channels;
st->codec->sample_rate = ape->samplerate;
st->codec->bits_per_coded_sample = ape->bps;
- st->codec->frame_size = MAC_SUBFRAME_SIZE;
st->nb_frames = ape->totalframes;
st->start_time = 0;
@@ -346,6 +348,12 @@ static int ape_read_header(AVFormatContext * s, AVFormatParameters * ap)
pts += ape->blocksperframe / MAC_SUBFRAME_SIZE;
}
+ /* try to read APE tags */
+ if (pb->seekable) {
+ ff_ape_parse_tag(s);
+ avio_seek(pb, 0, SEEK_SET);
+ }
+
return 0;
}
@@ -357,11 +365,12 @@ static int ape_read_packet(AVFormatContext * s, AVPacket * pkt)
uint32_t extra_size = 8;
if (s->pb->eof_reached)
- return AVERROR(EIO);
- if (ape->currentframe > ape->totalframes)
- return AVERROR(EIO);
+ return AVERROR_EOF;
+ if (ape->currentframe >= ape->totalframes)
+ return AVERROR_EOF;
- avio_seek (s->pb, ape->frames[ape->currentframe].pos, SEEK_SET);
+ if (avio_seek(s->pb, ape->frames[ape->currentframe].pos, SEEK_SET) < 0)
+ return AVERROR(EIO);
/* Calculate how many blocks there are in this frame */
if (ape->currentframe == (ape->totalframes - 1))
@@ -369,6 +378,14 @@ static int ape_read_packet(AVFormatContext * s, AVPacket * pkt)
else
nblocks = ape->blocksperframe;
+ if (ape->frames[ape->currentframe].size <= 0 ||
+ ape->frames[ape->currentframe].size > INT_MAX - extra_size) {
+ av_log(s, AV_LOG_ERROR, "invalid packet size: %d\n",
+ ape->frames[ape->currentframe].size);
+ ape->currentframe++;
+ return AVERROR(EIO);
+ }
+
if (av_new_packet(pkt, ape->frames[ape->currentframe].size + extra_size) < 0)
return AVERROR(ENOMEM);
@@ -406,6 +423,8 @@ static int ape_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp
if (index < 0)
return -1;
+ if (avio_seek(s->pb, st->index_entries[index].pos, SEEK_SET) < 0)
+ return -1;
ape->currentframe = index;
return 0;
}
@@ -419,5 +438,5 @@ AVInputFormat ff_ape_demuxer = {
.read_packet = ape_read_packet,
.read_close = ape_read_close,
.read_seek = ape_read_seek,
- .extensions = "ape,apl,mac"
+ .extensions = "ape,apl,mac",
};
diff --git a/gst-libs/ext/libav/libavformat/apetag.c b/gst-libs/ext/libav/libavformat/apetag.c
index 2390bfa..bb8b2df 100644
--- a/gst-libs/ext/libav/libavformat/apetag.c
+++ b/gst-libs/ext/libav/libavformat/apetag.c
@@ -24,21 +24,23 @@
#include "libavutil/dict.h"
#include "avformat.h"
#include "apetag.h"
+#include "internal.h"
#define APE_TAG_VERSION 2000
#define APE_TAG_FOOTER_BYTES 32
#define APE_TAG_FLAG_CONTAINS_HEADER (1 << 31)
#define APE_TAG_FLAG_IS_HEADER (1 << 29)
+#define APE_TAG_FLAG_IS_BINARY (1 << 1)
static int ape_tag_read_field(AVFormatContext *s)
{
AVIOContext *pb = s->pb;
uint8_t key[1024], *value;
- uint32_t size;
+ uint32_t size, flags;
int i, c;
size = avio_rl32(pb); /* field size */
- avio_skip(pb, 4); /* field flags */
+ flags = avio_rl32(pb); /* field flags */
for (i = 0; i < sizeof(key) - 1; i++) {
c = avio_r8(pb);
if (c < 0x20 || c > 0x7E)
@@ -53,59 +55,117 @@ static int ape_tag_read_field(AVFormatContext *s)
}
if (size >= UINT_MAX)
return -1;
- value = av_malloc(size+1);
- if (!value)
- return AVERROR(ENOMEM);
- avio_read(pb, value, size);
- value[size] = 0;
- av_dict_set(&s->metadata, key, value, AV_DICT_DONT_STRDUP_VAL);
+ if (flags & APE_TAG_FLAG_IS_BINARY) {
+ uint8_t filename[1024];
+ enum AVCodecID id;
+ AVStream *st = avformat_new_stream(s, NULL);
+ if (!st)
+ return AVERROR(ENOMEM);
+
+ size -= avio_get_str(pb, size, filename, sizeof(filename));
+ if (size <= 0) {
+ av_log(s, AV_LOG_WARNING, "Skipping binary tag '%s'.\n", key);
+ return 0;
+ }
+
+ av_dict_set(&st->metadata, key, filename, 0);
+
+ if ((id = ff_guess_image2_codec(filename)) != AV_CODEC_ID_NONE) {
+ AVPacket pkt;
+ int ret;
+
+ ret = av_get_packet(s->pb, &pkt, size);
+ if (ret < 0) {
+ av_log(s, AV_LOG_ERROR, "Error reading cover art.\n");
+ return ret;
+ }
+
+ st->disposition |= AV_DISPOSITION_ATTACHED_PIC;
+ st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
+ st->codec->codec_id = id;
+
+ st->attached_pic = pkt;
+ st->attached_pic.stream_index = st->index;
+ st->attached_pic.flags |= AV_PKT_FLAG_KEY;
+ } else {
+ st->codec->extradata = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE);
+ if (!st->codec->extradata)
+ return AVERROR(ENOMEM);
+ if (avio_read(pb, st->codec->extradata, size) != size) {
+ av_freep(&st->codec->extradata);
+ return AVERROR(EIO);
+ }
+ st->codec->extradata_size = size;
+ st->codec->codec_type = AVMEDIA_TYPE_ATTACHMENT;
+ }
+ } else {
+ value = av_malloc(size+1);
+ if (!value)
+ return AVERROR(ENOMEM);
+ c = avio_read(pb, value, size);
+ if (c < 0) {
+ av_free(value);
+ return c;
+ }
+ value[c] = 0;
+ av_dict_set(&s->metadata, key, value, AV_DICT_DONT_STRDUP_VAL);
+ }
return 0;
}
-void ff_ape_parse_tag(AVFormatContext *s)
+int64_t ff_ape_parse_tag(AVFormatContext *s)
{
AVIOContext *pb = s->pb;
int64_t file_size = avio_size(pb);
uint32_t val, fields, tag_bytes;
uint8_t buf[8];
+ int64_t tag_start;
int i;
if (file_size < APE_TAG_FOOTER_BYTES)
- return;
+ return 0;
avio_seek(pb, file_size - APE_TAG_FOOTER_BYTES, SEEK_SET);
avio_read(pb, buf, 8); /* APETAGEX */
if (strncmp(buf, "APETAGEX", 8)) {
- return;
+ return 0;
}
val = avio_rl32(pb); /* APE tag version */
if (val > APE_TAG_VERSION) {
av_log(s, AV_LOG_ERROR, "Unsupported tag version. (>=%d)\n", APE_TAG_VERSION);
- return;
+ return 0;
}
tag_bytes = avio_rl32(pb); /* tag size */
if (tag_bytes - APE_TAG_FOOTER_BYTES > (1024 * 1024 * 16)) {
av_log(s, AV_LOG_ERROR, "Tag size is way too big\n");
- return;
+ return 0;
}
+ if (tag_bytes > file_size - APE_TAG_FOOTER_BYTES) {
+ av_log(s, AV_LOG_ERROR, "Invalid tag size %u.\n", tag_bytes);
+ return 0;
+ }
+ tag_start = file_size - tag_bytes - APE_TAG_FOOTER_BYTES;
+
fields = avio_rl32(pb); /* number of fields */
if (fields > 65536) {
av_log(s, AV_LOG_ERROR, "Too many tag fields (%d)\n", fields);
- return;
+ return 0;
}
val = avio_rl32(pb); /* flags */
if (val & APE_TAG_FLAG_IS_HEADER) {
av_log(s, AV_LOG_ERROR, "APE Tag is a header\n");
- return;
+ return 0;
}
avio_seek(pb, file_size - tag_bytes, SEEK_SET);
for (i=0; i<fields; i++)
if (ape_tag_read_field(s) < 0) break;
+
+ return tag_start;
}
diff --git a/gst-libs/ext/libav/libavformat/apetag.h b/gst-libs/ext/libav/libavformat/apetag.h
index 9a39d02..279972f 100644
--- a/gst-libs/ext/libav/libavformat/apetag.h
+++ b/gst-libs/ext/libav/libavformat/apetag.h
@@ -27,7 +27,9 @@
/**
* Read and parse an APE tag
+ *
+ * @return offset of the tag start in the file
*/
-void ff_ape_parse_tag(AVFormatContext *s);
+int64_t ff_ape_parse_tag(AVFormatContext *s);
-#endif /* AVFORMAT_ID3V2_H */
+#endif /* AVFORMAT_APETAG_H */
diff --git a/gst-libs/ext/libav/libavformat/applehttp.c b/gst-libs/ext/libav/libavformat/applehttp.c
deleted file mode 100644
index f62e2d0..0000000
--- a/gst-libs/ext/libav/libavformat/applehttp.c
+++ /dev/null
@@ -1,711 +0,0 @@
-/*
- * Apple HTTP Live Streaming demuxer
- * Copyright (c) 2010 Martin Storsjo
- *
- * 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
- * Apple HTTP Live Streaming demuxer
- * http://tools.ietf.org/html/draft-pantos-http-live-streaming
- */
-
-#include "libavutil/avstring.h"
-#include "libavutil/intreadwrite.h"
-#include "libavutil/mathematics.h"
-#include "libavutil/opt.h"
-#include "libavutil/dict.h"
-#include "avformat.h"
-#include "internal.h"
-#include <unistd.h>
-#include "avio_internal.h"
-#include "url.h"
-
-#define INITIAL_BUFFER_SIZE 32768
-
-/*
- * An apple http stream consists of a playlist with media segment files,
- * played sequentially. There may be several playlists with the same
- * video content, in different bandwidth variants, that are played in
- * parallel (preferrably only one bandwidth variant at a time). In this case,
- * the user supplied the url to a main playlist that only lists the variant
- * playlists.
- *
- * If the main playlist doesn't point at any variants, we still create
- * one anonymous toplevel variant for this, to maintain the structure.
- */
-
-enum KeyType {
- KEY_NONE,
- KEY_AES_128,
-};
-
-struct segment {
- int duration;
- char url[MAX_URL_SIZE];
- char key[MAX_URL_SIZE];
- enum KeyType key_type;
- uint8_t iv[16];
-};
-
-/*
- * Each variant has its own demuxer. If it currently is active,
- * it has an open AVIOContext too, and potentially an AVPacket
- * containing the next packet from this stream.
- */
-struct variant {
- int bandwidth;
- char url[MAX_URL_SIZE];
- AVIOContext pb;
- uint8_t* read_buffer;
- URLContext *input;
- AVFormatContext *parent;
- int index;
- AVFormatContext *ctx;
- AVPacket pkt;
- int stream_offset;
-
- int finished;
- int target_duration;
- int start_seq_no;
- int n_segments;
- struct segment **segments;
- int needed, cur_needed;
- int cur_seq_no;
- int64_t last_load_time;
-
- char key_url[MAX_URL_SIZE];
- uint8_t key[16];
-};
-
-typedef struct AppleHTTPContext {
- int n_variants;
- struct variant **variants;
- int cur_seq_no;
- int end_of_segment;
- int first_packet;
- int64_t first_timestamp;
- AVIOInterruptCB *interrupt_callback;
-} AppleHTTPContext;
-
-static int read_chomp_line(AVIOContext *s, char *buf, int maxlen)
-{
- int len = ff_get_line(s, buf, maxlen);
- while (len > 0 && isspace(buf[len - 1]))
- buf[--len] = '\0';
- return len;
-}
-
-static void free_segment_list(struct variant *var)
-{
- int i;
- for (i = 0; i < var->n_segments; i++)
- av_free(var->segments[i]);
- av_freep(&var->segments);
- var->n_segments = 0;
-}
-
-static void free_variant_list(AppleHTTPContext *c)
-{
- int i;
- for (i = 0; i < c->n_variants; i++) {
- struct variant *var = c->variants[i];
- free_segment_list(var);
- av_free_packet(&var->pkt);
- av_free(var->pb.buffer);
- if (var->input)
- ffurl_close(var->input);
- if (var->ctx) {
- var->ctx->pb = NULL;
- avformat_close_input(&var->ctx);
- }
- av_free(var);
- }
- av_freep(&c->variants);
- c->n_variants = 0;
-}
-
-/*
- * Used to reset a statically allocated AVPacket to a clean slate,
- * containing no data.
- */
-static void reset_packet(AVPacket *pkt)
-{
- av_init_packet(pkt);
- pkt->data = NULL;
-}
-
-static struct variant *new_variant(AppleHTTPContext *c, int bandwidth,
- const char *url, const char *base)
-{
- struct variant *var = av_mallocz(sizeof(struct variant));
- if (!var)
- return NULL;
- reset_packet(&var->pkt);
- var->bandwidth = bandwidth;
- ff_make_absolute_url(var->url, sizeof(var->url), base, url);
- dynarray_add(&c->variants, &c->n_variants, var);
- return var;
-}
-
-struct variant_info {
- char bandwidth[20];
-};
-
-static void handle_variant_args(struct variant_info *info, const char *key,
- int key_len, char **dest, int *dest_len)
-{
- if (!strncmp(key, "BANDWIDTH=", key_len)) {
- *dest = info->bandwidth;
- *dest_len = sizeof(info->bandwidth);
- }
-}
-
-struct key_info {
- char uri[MAX_URL_SIZE];
- char method[10];
- char iv[35];
-};
-
-static void handle_key_args(struct key_info *info, const char *key,
- int key_len, char **dest, int *dest_len)
-{
- if (!strncmp(key, "METHOD=", key_len)) {
- *dest = info->method;
- *dest_len = sizeof(info->method);
- } else if (!strncmp(key, "URI=", key_len)) {
- *dest = info->uri;
- *dest_len = sizeof(info->uri);
- } else if (!strncmp(key, "IV=", key_len)) {
- *dest = info->iv;
- *dest_len = sizeof(info->iv);
- }
-}
-
-static int parse_playlist(AppleHTTPContext *c, const char *url,
- struct variant *var, AVIOContext *in)
-{
- int ret = 0, duration = 0, is_segment = 0, is_variant = 0, bandwidth = 0;
- enum KeyType key_type = KEY_NONE;
- uint8_t iv[16] = "";
- int has_iv = 0;
- char key[MAX_URL_SIZE] = "";
- char line[1024];
- const char *ptr;
- int close_in = 0;
-
- if (!in) {
- close_in = 1;
- if ((ret = avio_open2(&in, url, AVIO_FLAG_READ,
- c->interrupt_callback, NULL)) < 0)
- return ret;
- }
-
- read_chomp_line(in, line, sizeof(line));
- if (strcmp(line, "#EXTM3U")) {
- ret = AVERROR_INVALIDDATA;
- goto fail;
- }
-
- if (var) {
- free_segment_list(var);
- var->finished = 0;
- }
- while (!in->eof_reached) {
- read_chomp_line(in, line, sizeof(line));
- if (av_strstart(line, "#EXT-X-STREAM-INF:", &ptr)) {
- struct variant_info info = {{0}};
- is_variant = 1;
- ff_parse_key_value(ptr, (ff_parse_key_val_cb) handle_variant_args,
- &info);
- bandwidth = atoi(info.bandwidth);
- } else if (av_strstart(line, "#EXT-X-KEY:", &ptr)) {
- struct key_info info = {{0}};
- ff_parse_key_value(ptr, (ff_parse_key_val_cb) handle_key_args,
- &info);
- key_type = KEY_NONE;
- has_iv = 0;
- if (!strcmp(info.method, "AES-128"))
- key_type = KEY_AES_128;
- if (!strncmp(info.iv, "0x", 2) || !strncmp(info.iv, "0X", 2)) {
- ff_hex_to_data(iv, info.iv + 2);
- has_iv = 1;
- }
- av_strlcpy(key, info.uri, sizeof(key));
- } else if (av_strstart(line, "#EXT-X-TARGETDURATION:", &ptr)) {
- if (!var) {
- var = new_variant(c, 0, url, NULL);
- if (!var) {
- ret = AVERROR(ENOMEM);
- goto fail;
- }
- }
- var->target_duration = atoi(ptr);
- } else if (av_strstart(line, "#EXT-X-MEDIA-SEQUENCE:", &ptr)) {
- if (!var) {
- var = new_variant(c, 0, url, NULL);
- if (!var) {
- ret = AVERROR(ENOMEM);
- goto fail;
- }
- }
- var->start_seq_no = atoi(ptr);
- } else if (av_strstart(line, "#EXT-X-ENDLIST", &ptr)) {
- if (var)
- var->finished = 1;
- } else if (av_strstart(line, "#EXTINF:", &ptr)) {
- is_segment = 1;
- duration = atoi(ptr);
- } else if (av_strstart(line, "#", NULL)) {
- continue;
- } else if (line[0]) {
- if (is_variant) {
- if (!new_variant(c, bandwidth, line, url)) {
- ret = AVERROR(ENOMEM);
- goto fail;
- }
- is_variant = 0;
- bandwidth = 0;
- }
- if (is_segment) {
- struct segment *seg;
- if (!var) {
- var = new_variant(c, 0, url, NULL);
- if (!var) {
- ret = AVERROR(ENOMEM);
- goto fail;
- }
- }
- seg = av_malloc(sizeof(struct segment));
- if (!seg) {
- ret = AVERROR(ENOMEM);
- goto fail;
- }
- seg->duration = duration;
- seg->key_type = key_type;
- if (has_iv) {
- memcpy(seg->iv, iv, sizeof(iv));
- } else {
- int seq = var->start_seq_no + var->n_segments;
- memset(seg->iv, 0, sizeof(seg->iv));
- AV_WB32(seg->iv + 12, seq);
- }
- ff_make_absolute_url(seg->key, sizeof(seg->key), url, key);
- ff_make_absolute_url(seg->url, sizeof(seg->url), url, line);
- dynarray_add(&var->segments, &var->n_segments, seg);
- is_segment = 0;
- }
- }
- }
- if (var)
- var->last_load_time = av_gettime();
-
-fail:
- if (close_in)
- avio_close(in);
- return ret;
-}
-
-static int open_input(struct variant *var)
-{
- struct segment *seg = var->segments[var->cur_seq_no - var->start_seq_no];
- if (seg->key_type == KEY_NONE) {
- return ffurl_open(&var->input, seg->url, AVIO_FLAG_READ,
- &var->parent->interrupt_callback, NULL);
- } else if (seg->key_type == KEY_AES_128) {
- char iv[33], key[33], url[MAX_URL_SIZE];
- int ret;
- if (strcmp(seg->key, var->key_url)) {
- URLContext *uc;
- if (ffurl_open(&uc, seg->key, AVIO_FLAG_READ,
- &var->parent->interrupt_callback, NULL) == 0) {
- if (ffurl_read_complete(uc, var->key, sizeof(var->key))
- != sizeof(var->key)) {
- av_log(NULL, AV_LOG_ERROR, "Unable to read key file %s\n",
- seg->key);
- }
- ffurl_close(uc);
- } else {
- av_log(NULL, AV_LOG_ERROR, "Unable to open key file %s\n",
- seg->key);
- }
- av_strlcpy(var->key_url, seg->key, sizeof(var->key_url));
- }
- ff_data_to_hex(iv, seg->iv, sizeof(seg->iv), 0);
- ff_data_to_hex(key, var->key, sizeof(var->key), 0);
- iv[32] = key[32] = '\0';
- if (strstr(seg->url, "://"))
- snprintf(url, sizeof(url), "crypto+%s", seg->url);
- else
- snprintf(url, sizeof(url), "crypto:%s", seg->url);
- if ((ret = ffurl_alloc(&var->input, url, AVIO_FLAG_READ,
- &var->parent->interrupt_callback)) < 0)
- return ret;
- 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, NULL)) < 0) {
- ffurl_close(var->input);
- var->input = NULL;
- return ret;
- }
- return 0;
- }
- return AVERROR(ENOSYS);
-}
-
-static int read_data(void *opaque, uint8_t *buf, int buf_size)
-{
- struct variant *v = opaque;
- AppleHTTPContext *c = v->parent->priv_data;
- int ret, i;
-
-restart:
- if (!v->input) {
- /* If this is a live stream and the reload interval has elapsed since
- * the last playlist reload, reload the variant playlists now. */
- int64_t reload_interval = v->n_segments > 0 ?
- v->segments[v->n_segments - 1]->duration :
- v->target_duration;
- reload_interval *= 1000000;
-
-reload:
- if (!v->finished &&
- av_gettime() - v->last_load_time >= reload_interval) {
- if ((ret = parse_playlist(c, v->url, v, NULL)) < 0)
- return ret;
- /* If we need to reload the playlist again below (if
- * there's still no more segments), switch to a reload
- * interval of half the target duration. */
- reload_interval = v->target_duration * 500000;
- }
- if (v->cur_seq_no < v->start_seq_no) {
- av_log(NULL, AV_LOG_WARNING,
- "skipping %d segments ahead, expired from playlists\n",
- v->start_seq_no - v->cur_seq_no);
- v->cur_seq_no = v->start_seq_no;
- }
- if (v->cur_seq_no >= v->start_seq_no + v->n_segments) {
- if (v->finished)
- return AVERROR_EOF;
- while (av_gettime() - v->last_load_time < reload_interval) {
- if (ff_check_interrupt(c->interrupt_callback))
- return AVERROR_EXIT;
- usleep(100*1000);
- }
- /* Enough time has elapsed since the last reload */
- goto reload;
- }
-
- ret = open_input(v);
- if (ret < 0)
- return ret;
- }
- ret = ffurl_read(v->input, buf, buf_size);
- if (ret > 0)
- return ret;
- if (ret < 0 && ret != AVERROR_EOF)
- return ret;
- ffurl_close(v->input);
- v->input = NULL;
- v->cur_seq_no++;
-
- c->end_of_segment = 1;
- c->cur_seq_no = v->cur_seq_no;
-
- if (v->ctx && v->ctx->nb_streams) {
- v->needed = 0;
- for (i = v->stream_offset; i < v->stream_offset + v->ctx->nb_streams;
- i++) {
- if (v->parent->streams[i]->discard < AVDISCARD_ALL)
- v->needed = 1;
- }
- }
- if (!v->needed) {
- av_log(v->parent, AV_LOG_INFO, "No longer receiving variant %d\n",
- v->index);
- return AVERROR_EOF;
- }
- goto restart;
-}
-
-static int applehttp_read_header(AVFormatContext *s, AVFormatParameters *ap)
-{
- AppleHTTPContext *c = s->priv_data;
- int ret = 0, i, j, stream_offset = 0;
-
- c->interrupt_callback = &s->interrupt_callback;
-
- if ((ret = parse_playlist(c, s->filename, NULL, s->pb)) < 0)
- goto fail;
-
- if (c->n_variants == 0) {
- av_log(NULL, AV_LOG_WARNING, "Empty playlist\n");
- ret = AVERROR_EOF;
- goto fail;
- }
- /* If the playlist only contained variants, parse each individual
- * variant playlist. */
- if (c->n_variants > 1 || c->variants[0]->n_segments == 0) {
- for (i = 0; i < c->n_variants; i++) {
- struct variant *v = c->variants[i];
- if ((ret = parse_playlist(c, v->url, v, NULL)) < 0)
- goto fail;
- }
- }
-
- if (c->variants[0]->n_segments == 0) {
- av_log(NULL, AV_LOG_WARNING, "Empty playlist\n");
- ret = AVERROR_EOF;
- goto fail;
- }
-
- /* If this isn't a live stream, calculate the total duration of the
- * stream. */
- if (c->variants[0]->finished) {
- int64_t duration = 0;
- for (i = 0; i < c->variants[0]->n_segments; i++)
- duration += c->variants[0]->segments[i]->duration;
- s->duration = duration * AV_TIME_BASE;
- }
-
- /* Open the demuxer for each variant */
- for (i = 0; i < c->n_variants; i++) {
- struct variant *v = c->variants[i];
- AVInputFormat *in_fmt = NULL;
- char bitrate_str[20];
- if (v->n_segments == 0)
- continue;
-
- if (!(v->ctx = avformat_alloc_context())) {
- ret = AVERROR(ENOMEM);
- goto fail;
- }
-
- v->index = i;
- v->needed = 1;
- v->parent = s;
-
- /* If this is a live stream with more than 3 segments, start at the
- * third last segment. */
- v->cur_seq_no = v->start_seq_no;
- if (!v->finished && v->n_segments > 3)
- v->cur_seq_no = v->start_seq_no + v->n_segments - 3;
-
- v->read_buffer = av_malloc(INITIAL_BUFFER_SIZE);
- ffio_init_context(&v->pb, v->read_buffer, INITIAL_BUFFER_SIZE, 0, v,
- read_data, NULL, NULL);
- v->pb.seekable = 0;
- ret = av_probe_input_buffer(&v->pb, &in_fmt, v->segments[0]->url,
- NULL, 0, 0);
- if (ret < 0) {
- /* Free the ctx - it isn't initialized properly at this point,
- * so avformat_close_input shouldn't be called. If
- * avformat_open_input fails below, it frees and zeros the
- * context, so it doesn't need any special treatment like this. */
- avformat_free_context(v->ctx);
- v->ctx = NULL;
- goto fail;
- }
- v->ctx->pb = &v->pb;
- ret = avformat_open_input(&v->ctx, v->segments[0]->url, in_fmt, NULL);
- if (ret < 0)
- goto fail;
- v->stream_offset = stream_offset;
- snprintf(bitrate_str, sizeof(bitrate_str), "%d", v->bandwidth);
- /* Create new AVStreams for each stream in this variant */
- for (j = 0; j < v->ctx->nb_streams; j++) {
- AVStream *st = avformat_new_stream(s, NULL);
- if (!st) {
- ret = AVERROR(ENOMEM);
- goto fail;
- }
- st->id = i;
- avcodec_copy_context(st->codec, v->ctx->streams[j]->codec);
- if (v->bandwidth)
- av_dict_set(&st->metadata, "variant_bitrate", bitrate_str,
- 0);
- }
- stream_offset += v->ctx->nb_streams;
- }
-
- c->first_packet = 1;
- c->first_timestamp = AV_NOPTS_VALUE;
-
- return 0;
-fail:
- free_variant_list(c);
- return ret;
-}
-
-static int recheck_discard_flags(AVFormatContext *s, int first)
-{
- AppleHTTPContext *c = s->priv_data;
- int i, changed = 0;
-
- /* Check if any new streams are needed */
- for (i = 0; i < c->n_variants; i++)
- c->variants[i]->cur_needed = 0;;
-
- for (i = 0; i < s->nb_streams; i++) {
- AVStream *st = s->streams[i];
- struct variant *var = c->variants[s->streams[i]->id];
- if (st->discard < AVDISCARD_ALL)
- var->cur_needed = 1;
- }
- for (i = 0; i < c->n_variants; i++) {
- struct variant *v = c->variants[i];
- if (v->cur_needed && !v->needed) {
- v->needed = 1;
- changed = 1;
- v->cur_seq_no = c->cur_seq_no;
- v->pb.eof_reached = 0;
- av_log(s, AV_LOG_INFO, "Now receiving variant %d\n", i);
- } else if (first && !v->cur_needed && v->needed) {
- if (v->input)
- ffurl_close(v->input);
- v->input = NULL;
- v->needed = 0;
- changed = 1;
- av_log(s, AV_LOG_INFO, "No longer receiving variant %d\n", i);
- }
- }
- return changed;
-}
-
-static int applehttp_read_packet(AVFormatContext *s, AVPacket *pkt)
-{
- AppleHTTPContext *c = s->priv_data;
- int ret, i, minvariant = -1;
-
- if (c->first_packet) {
- recheck_discard_flags(s, 1);
- c->first_packet = 0;
- }
-
-start:
- c->end_of_segment = 0;
- for (i = 0; i < c->n_variants; i++) {
- struct variant *var = c->variants[i];
- /* Make sure we've got one buffered packet from each open variant
- * stream */
- if (var->needed && !var->pkt.data) {
- ret = av_read_frame(var->ctx, &var->pkt);
- if (ret < 0) {
- if (!var->pb.eof_reached)
- return ret;
- reset_packet(&var->pkt);
- } else {
- if (c->first_timestamp == AV_NOPTS_VALUE)
- c->first_timestamp = var->pkt.dts;
- }
- }
- /* Check if this stream has the packet with the lowest dts */
- if (var->pkt.data) {
- if (minvariant < 0 ||
- var->pkt.dts < c->variants[minvariant]->pkt.dts)
- minvariant = i;
- }
- }
- if (c->end_of_segment) {
- if (recheck_discard_flags(s, 0))
- goto start;
- }
- /* If we got a packet, return it */
- if (minvariant >= 0) {
- *pkt = c->variants[minvariant]->pkt;
- pkt->stream_index += c->variants[minvariant]->stream_offset;
- reset_packet(&c->variants[minvariant]->pkt);
- return 0;
- }
- return AVERROR_EOF;
-}
-
-static int applehttp_close(AVFormatContext *s)
-{
- AppleHTTPContext *c = s->priv_data;
-
- free_variant_list(c);
- return 0;
-}
-
-static int applehttp_read_seek(AVFormatContext *s, int stream_index,
- int64_t timestamp, int flags)
-{
- AppleHTTPContext *c = s->priv_data;
- int i, j, ret;
-
- if ((flags & AVSEEK_FLAG_BYTE) || !c->variants[0]->finished)
- return AVERROR(ENOSYS);
-
- timestamp = av_rescale_rnd(timestamp, 1, stream_index >= 0 ?
- s->streams[stream_index]->time_base.den :
- AV_TIME_BASE, flags & AVSEEK_FLAG_BACKWARD ?
- AV_ROUND_DOWN : AV_ROUND_UP);
- ret = AVERROR(EIO);
- for (i = 0; i < c->n_variants; i++) {
- /* Reset reading */
- struct variant *var = c->variants[i];
- int64_t pos = c->first_timestamp == AV_NOPTS_VALUE ? 0 :
- av_rescale_rnd(c->first_timestamp, 1,
- stream_index >= 0 ? s->streams[stream_index]->time_base.den : AV_TIME_BASE,
- flags & AVSEEK_FLAG_BACKWARD ? AV_ROUND_DOWN : AV_ROUND_UP);
- if (var->input) {
- ffurl_close(var->input);
- var->input = NULL;
- }
- av_free_packet(&var->pkt);
- reset_packet(&var->pkt);
- var->pb.eof_reached = 0;
-
- /* Locate the segment that contains the target timestamp */
- for (j = 0; j < var->n_segments; j++) {
- if (timestamp >= pos &&
- timestamp < pos + var->segments[j]->duration) {
- var->cur_seq_no = var->start_seq_no + j;
- ret = 0;
- break;
- }
- pos += var->segments[j]->duration;
- }
- }
- return ret;
-}
-
-static int applehttp_probe(AVProbeData *p)
-{
- /* Require #EXTM3U at the start, and either one of the ones below
- * somewhere for a proper match. */
- if (strncmp(p->buf, "#EXTM3U", 7))
- return 0;
- if (strstr(p->buf, "#EXT-X-STREAM-INF:") ||
- strstr(p->buf, "#EXT-X-TARGETDURATION:") ||
- strstr(p->buf, "#EXT-X-MEDIA-SEQUENCE:"))
- return AVPROBE_SCORE_MAX;
- return 0;
-}
-
-AVInputFormat ff_applehttp_demuxer = {
- .name = "applehttp",
- .long_name = NULL_IF_CONFIG_SMALL("Apple HTTP Live Streaming format"),
- .priv_data_size = sizeof(AppleHTTPContext),
- .read_probe = applehttp_probe,
- .read_header = applehttp_read_header,
- .read_packet = applehttp_read_packet,
- .read_close = applehttp_close,
- .read_seek = applehttp_read_seek,
-};
diff --git a/gst-libs/ext/libav/libavformat/applehttpproto.c b/gst-libs/ext/libav/libavformat/applehttpproto.c
deleted file mode 100644
index 46758ba..0000000
--- a/gst-libs/ext/libav/libavformat/applehttpproto.c
+++ /dev/null
@@ -1,313 +0,0 @@
-/*
- * Apple HTTP Live Streaming Protocol Handler
- * Copyright (c) 2010 Martin Storsjo
- *
- * 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
- * Apple HTTP Live Streaming Protocol Handler
- * http://tools.ietf.org/html/draft-pantos-http-live-streaming
- */
-
-#include "libavutil/avstring.h"
-#include "avformat.h"
-#include "internal.h"
-#include "url.h"
-#include <unistd.h>
-
-/*
- * An apple http stream consists of a playlist with media segment files,
- * played sequentially. There may be several playlists with the same
- * video content, in different bandwidth variants, that are played in
- * parallel (preferrably only one bandwidth variant at a time). In this case,
- * the user supplied the url to a main playlist that only lists the variant
- * playlists.
- *
- * If the main playlist doesn't point at any variants, we still create
- * one anonymous toplevel variant for this, to maintain the structure.
- */
-
-struct segment {
- int duration;
- char url[MAX_URL_SIZE];
-};
-
-struct variant {
- int bandwidth;
- char url[MAX_URL_SIZE];
-};
-
-typedef struct AppleHTTPContext {
- char playlisturl[MAX_URL_SIZE];
- int target_duration;
- int start_seq_no;
- int finished;
- int n_segments;
- struct segment **segments;
- int n_variants;
- struct variant **variants;
- int cur_seq_no;
- URLContext *seg_hd;
- int64_t last_load_time;
-} AppleHTTPContext;
-
-static int read_chomp_line(AVIOContext *s, char *buf, int maxlen)
-{
- int len = ff_get_line(s, buf, maxlen);
- while (len > 0 && isspace(buf[len - 1]))
- buf[--len] = '\0';
- return len;
-}
-
-static void free_segment_list(AppleHTTPContext *s)
-{
- int i;
- for (i = 0; i < s->n_segments; i++)
- av_free(s->segments[i]);
- av_freep(&s->segments);
- s->n_segments = 0;
-}
-
-static void free_variant_list(AppleHTTPContext *s)
-{
- int i;
- for (i = 0; i < s->n_variants; i++)
- av_free(s->variants[i]);
- av_freep(&s->variants);
- s->n_variants = 0;
-}
-
-struct variant_info {
- char bandwidth[20];
-};
-
-static void handle_variant_args(struct variant_info *info, const char *key,
- int key_len, char **dest, int *dest_len)
-{
- if (!strncmp(key, "BANDWIDTH=", key_len)) {
- *dest = info->bandwidth;
- *dest_len = sizeof(info->bandwidth);
- }
-}
-
-static int parse_playlist(URLContext *h, const char *url)
-{
- AppleHTTPContext *s = h->priv_data;
- AVIOContext *in;
- int ret = 0, duration = 0, is_segment = 0, is_variant = 0, bandwidth = 0;
- char line[1024];
- const char *ptr;
-
- if ((ret = avio_open2(&in, url, AVIO_FLAG_READ,
- &h->interrupt_callback, NULL)) < 0)
- return ret;
-
- read_chomp_line(in, line, sizeof(line));
- if (strcmp(line, "#EXTM3U"))
- return AVERROR_INVALIDDATA;
-
- free_segment_list(s);
- s->finished = 0;
- while (!in->eof_reached) {
- read_chomp_line(in, line, sizeof(line));
- if (av_strstart(line, "#EXT-X-STREAM-INF:", &ptr)) {
- struct variant_info info = {{0}};
- is_variant = 1;
- ff_parse_key_value(ptr, (ff_parse_key_val_cb) handle_variant_args,
- &info);
- bandwidth = atoi(info.bandwidth);
- } else if (av_strstart(line, "#EXT-X-TARGETDURATION:", &ptr)) {
- s->target_duration = atoi(ptr);
- } else if (av_strstart(line, "#EXT-X-MEDIA-SEQUENCE:", &ptr)) {
- s->start_seq_no = atoi(ptr);
- } else if (av_strstart(line, "#EXT-X-ENDLIST", &ptr)) {
- s->finished = 1;
- } else if (av_strstart(line, "#EXTINF:", &ptr)) {
- is_segment = 1;
- duration = atoi(ptr);
- } else if (av_strstart(line, "#", NULL)) {
- continue;
- } else if (line[0]) {
- if (is_segment) {
- struct segment *seg = av_malloc(sizeof(struct segment));
- if (!seg) {
- ret = AVERROR(ENOMEM);
- goto fail;
- }
- seg->duration = duration;
- ff_make_absolute_url(seg->url, sizeof(seg->url), url, line);
- dynarray_add(&s->segments, &s->n_segments, seg);
- is_segment = 0;
- } else if (is_variant) {
- struct variant *var = av_malloc(sizeof(struct variant));
- if (!var) {
- ret = AVERROR(ENOMEM);
- goto fail;
- }
- var->bandwidth = bandwidth;
- ff_make_absolute_url(var->url, sizeof(var->url), url, line);
- dynarray_add(&s->variants, &s->n_variants, var);
- is_variant = 0;
- }
- }
- }
- s->last_load_time = av_gettime();
-
-fail:
- avio_close(in);
- return ret;
-}
-
-static int applehttp_close(URLContext *h)
-{
- AppleHTTPContext *s = h->priv_data;
-
- free_segment_list(s);
- free_variant_list(s);
- ffurl_close(s->seg_hd);
- return 0;
-}
-
-static int applehttp_open(URLContext *h, const char *uri, int flags)
-{
- AppleHTTPContext *s = h->priv_data;
- int ret, i;
- const char *nested_url;
-
- if (flags & AVIO_FLAG_WRITE)
- return AVERROR(ENOSYS);
-
- h->is_streamed = 1;
-
- if (av_strstart(uri, "applehttp+", &nested_url)) {
- av_strlcpy(s->playlisturl, nested_url, sizeof(s->playlisturl));
- } else if (av_strstart(uri, "applehttp://", &nested_url)) {
- av_strlcpy(s->playlisturl, "http://", sizeof(s->playlisturl));
- av_strlcat(s->playlisturl, nested_url, sizeof(s->playlisturl));
- } else {
- av_log(h, AV_LOG_ERROR, "Unsupported url %s\n", uri);
- ret = AVERROR(EINVAL);
- goto fail;
- }
-
- if ((ret = parse_playlist(h, s->playlisturl)) < 0)
- goto fail;
-
- if (s->n_segments == 0 && s->n_variants > 0) {
- int max_bandwidth = 0, maxvar = -1;
- for (i = 0; i < s->n_variants; i++) {
- if (s->variants[i]->bandwidth > max_bandwidth || i == 0) {
- max_bandwidth = s->variants[i]->bandwidth;
- maxvar = i;
- }
- }
- av_strlcpy(s->playlisturl, s->variants[maxvar]->url,
- sizeof(s->playlisturl));
- if ((ret = parse_playlist(h, s->playlisturl)) < 0)
- goto fail;
- }
-
- if (s->n_segments == 0) {
- av_log(h, AV_LOG_WARNING, "Empty playlist\n");
- ret = AVERROR(EIO);
- goto fail;
- }
- s->cur_seq_no = s->start_seq_no;
- if (!s->finished && s->n_segments >= 3)
- s->cur_seq_no = s->start_seq_no + s->n_segments - 3;
-
- return 0;
-
-fail:
- applehttp_close(h);
- return ret;
-}
-
-static int applehttp_read(URLContext *h, uint8_t *buf, int size)
-{
- AppleHTTPContext *s = h->priv_data;
- const char *url;
- int ret;
- int64_t reload_interval;
-
-start:
- if (s->seg_hd) {
- ret = ffurl_read(s->seg_hd, buf, size);
- if (ret > 0)
- return ret;
- }
- if (s->seg_hd) {
- ffurl_close(s->seg_hd);
- s->seg_hd = NULL;
- s->cur_seq_no++;
- }
- reload_interval = s->n_segments > 0 ?
- s->segments[s->n_segments - 1]->duration :
- s->target_duration;
- reload_interval *= 1000000;
-retry:
- if (!s->finished) {
- int64_t now = av_gettime();
- if (now - s->last_load_time >= reload_interval) {
- if ((ret = parse_playlist(h, s->playlisturl)) < 0)
- return ret;
- /* If we need to reload the playlist again below (if
- * there's still no more segments), switch to a reload
- * interval of half the target duration. */
- reload_interval = s->target_duration * 500000;
- }
- }
- if (s->cur_seq_no < s->start_seq_no) {
- av_log(h, AV_LOG_WARNING,
- "skipping %d segments ahead, expired from playlist\n",
- s->start_seq_no - s->cur_seq_no);
- s->cur_seq_no = s->start_seq_no;
- }
- if (s->cur_seq_no - s->start_seq_no >= s->n_segments) {
- if (s->finished)
- return AVERROR_EOF;
- while (av_gettime() - s->last_load_time < reload_interval) {
- if (ff_check_interrupt(&h->interrupt_callback))
- return AVERROR_EXIT;
- usleep(100*1000);
- }
- goto retry;
- }
- url = s->segments[s->cur_seq_no - s->start_seq_no]->url,
- av_log(h, AV_LOG_DEBUG, "opening %s\n", url);
- ret = ffurl_open(&s->seg_hd, url, AVIO_FLAG_READ,
- &h->interrupt_callback, NULL);
- if (ret < 0) {
- if (ff_check_interrupt(&h->interrupt_callback))
- return AVERROR_EXIT;
- av_log(h, AV_LOG_WARNING, "Unable to open %s\n", url);
- s->cur_seq_no++;
- goto retry;
- }
- goto start;
-}
-
-URLProtocol ff_applehttp_protocol = {
- .name = "applehttp",
- .url_open = applehttp_open,
- .url_read = applehttp_read,
- .url_close = applehttp_close,
- .flags = URL_PROTOCOL_FLAG_NESTED_SCHEME,
- .priv_data_size = sizeof(AppleHTTPContext),
-};
diff --git a/gst-libs/ext/libav/libavformat/asf.h b/gst-libs/ext/libav/libavformat/asf.h
index b72445d..1d94a2c 100644
--- a/gst-libs/ext/libav/libavformat/asf.h
+++ b/gst-libs/ext/libav/libavformat/asf.h
@@ -27,7 +27,7 @@
#define PACKET_SIZE 3200
-typedef struct {
+typedef struct ASFStream {
int num;
unsigned char seq;
/* use for reading */
@@ -50,7 +50,7 @@ typedef struct {
typedef uint8_t ff_asf_guid[16];
-typedef struct {
+typedef struct ASFMainHeader {
ff_asf_guid guid; ///< generated by client computer
uint64_t file_size; /**< in bytes
* invalid if broadcasting */
@@ -76,7 +76,7 @@ typedef struct {
} ASFMainHeader;
-typedef struct {
+typedef struct ASFIndex {
uint32_t packet_number;
uint16_t packet_count;
} ASFIndex;
diff --git a/gst-libs/ext/libav/libavformat/asfcrypt.c b/gst-libs/ext/libav/libavformat/asfcrypt.c
index aea3d4f..6c48a19 100644
--- a/gst-libs/ext/libav/libavformat/asfcrypt.c
+++ b/gst-libs/ext/libav/libavformat/asfcrypt.c
@@ -140,7 +140,7 @@ void ff_asfcrypt_dec(const uint8_t key[20], uint8_t *data, int len) {
struct AVRC4 rc4;
int num_qwords = len >> 3;
uint8_t *qwords = data;
- uint64_t rc4buff[8];
+ uint64_t rc4buff[8] = { 0 };
uint64_t packetkey;
uint32_t ms_keys[12];
uint64_t ms_state;
@@ -151,7 +151,6 @@ void ff_asfcrypt_dec(const uint8_t key[20], uint8_t *data, int len) {
return;
}
- memset(rc4buff, 0, sizeof(rc4buff));
av_rc4_init(&rc4, key, 12 * 8, 1);
av_rc4_crypt(&rc4, (uint8_t *)rc4buff, NULL, sizeof(rc4buff), NULL, 1);
multiswap_init((uint8_t *)rc4buff, ms_keys);
diff --git a/gst-libs/ext/libav/libavformat/asfdec.c b/gst-libs/ext/libav/libavformat/asfdec.c
index 3b48788..c6b322d 100644
--- a/gst-libs/ext/libav/libavformat/asfdec.c
+++ b/gst-libs/ext/libav/libavformat/asfdec.c
@@ -21,21 +21,24 @@
//#define DEBUG
+#include "libavutil/attributes.h"
#include "libavutil/bswap.h"
#include "libavutil/common.h"
#include "libavutil/avstring.h"
#include "libavutil/dict.h"
#include "libavutil/mathematics.h"
-#include "libavcodec/mpegaudio.h"
+#include "libavutil/opt.h"
#include "avformat.h"
#include "internal.h"
#include "avio_internal.h"
+#include "id3v2.h"
#include "riff.h"
#include "asf.h"
#include "asfcrypt.h"
#include "avlanguage.h"
typedef struct {
+ const AVClass *class;
int asfid2avid[128]; ///< conversion table from asf ID 2 AVStream ID
ASFStream streams[128]; ///< it's max number and it's not that big
uint32_t stream_bitrates[128]; ///< max number of streams, bitrate for each (for streaming)
@@ -73,8 +76,22 @@ typedef struct {
int stream_index;
ASFStream* asf_st; ///< currently decoded stream
+
+ int no_resync_search;
} ASFContext;
+static const AVOption options[] = {
+ {"no_resync_search", "Don't try to resynchronize by looking for a certain optional start code", offsetof(ASFContext, no_resync_search), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1, AV_OPT_FLAG_DECODING_PARAM },
+ { NULL },
+};
+
+static const AVClass asf_class = {
+ .class_name = "asf demuxer",
+ .item_name = av_default_item_name,
+ .option = options,
+ .version = LIBAVUTIL_VERSION_INT,
+};
+
#undef NDEBUG
#include <assert.h>
@@ -158,6 +175,101 @@ static int get_value(AVIOContext *pb, int type){
}
}
+/* MSDN claims that this should be "compatible with the ID3 frame, APIC",
+ * but in reality this is only loosely similar */
+static int asf_read_picture(AVFormatContext *s, int len)
+{
+ AVPacket pkt = { 0 };
+ const CodecMime *mime = ff_id3v2_mime_tags;
+ enum AVCodecID id = AV_CODEC_ID_NONE;
+ char mimetype[64];
+ uint8_t *desc = NULL;
+ ASFStream *ast = NULL;
+ AVStream *st = NULL;
+ int ret, type, picsize, desc_len;
+
+ /* type + picsize + mime + desc */
+ if (len < 1 + 4 + 2 + 2) {
+ av_log(s, AV_LOG_ERROR, "Invalid attached picture size: %d.\n", len);
+ return AVERROR_INVALIDDATA;
+ }
+
+ /* picture type */
+ type = avio_r8(s->pb);
+ len--;
+ if (type >= FF_ARRAY_ELEMS(ff_id3v2_picture_types) || type < 0) {
+ av_log(s, AV_LOG_WARNING, "Unknown attached picture type: %d.\n", type);
+ type = 0;
+ }
+
+ /* picture data size */
+ picsize = avio_rl32(s->pb);
+ len -= 4;
+
+ /* picture MIME type */
+ len -= avio_get_str16le(s->pb, len, mimetype, sizeof(mimetype));
+ while (mime->id != AV_CODEC_ID_NONE) {
+ if (!strncmp(mime->str, mimetype, sizeof(mimetype))) {
+ id = mime->id;
+ break;
+ }
+ mime++;
+ }
+ if (id == AV_CODEC_ID_NONE) {
+ av_log(s, AV_LOG_ERROR, "Unknown attached picture mimetype: %s.\n",
+ mimetype);
+ return 0;
+ }
+
+ if (picsize >= len) {
+ av_log(s, AV_LOG_ERROR, "Invalid attached picture data size: %d >= %d.\n",
+ picsize, len);
+ return AVERROR_INVALIDDATA;
+ }
+
+ /* picture description */
+ desc_len = (len - picsize) * 2 + 1;
+ desc = av_malloc(desc_len);
+ if (!desc)
+ return AVERROR(ENOMEM);
+ len -= avio_get_str16le(s->pb, len - picsize, desc, desc_len);
+
+ ret = av_get_packet(s->pb, &pkt, picsize);
+ if (ret < 0)
+ goto fail;
+
+ st = avformat_new_stream(s, NULL);
+ ast = av_mallocz(sizeof(*ast));
+ if (!st || !ast) {
+ ret = AVERROR(ENOMEM);
+ goto fail;
+ }
+ st->priv_data = ast;
+
+ st->disposition |= AV_DISPOSITION_ATTACHED_PIC;
+ st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
+ st->codec->codec_id = id;
+
+ st->attached_pic = pkt;
+ st->attached_pic.stream_index = st->index;
+ st->attached_pic.flags |= AV_PKT_FLAG_KEY;
+
+ if (*desc)
+ av_dict_set(&st->metadata, "title", desc, AV_DICT_DONT_STRDUP_VAL);
+ else
+ av_freep(&desc);
+
+ av_dict_set(&st->metadata, "comment", ff_id3v2_picture_types[type], 0);
+
+ return 0;
+
+fail:
+ av_freep(&ast);
+ av_freep(&desc);
+ av_free_packet(&pkt);
+ return ret;
+}
+
static void get_tag(AVFormatContext *s, const char *key, int type, int len)
{
char *value;
@@ -175,6 +287,9 @@ static void get_tag(AVFormatContext *s, const char *key, int type, int len)
} else if (type > 1 && type <= 5) { // boolean or DWORD or QWORD or WORD
uint64_t num = get_value(s->pb, type);
snprintf(value, len, "%"PRIu64, num);
+ } else if (type == 1 && !strcmp(key, "WM/Picture")) { // handle cover art
+ asf_read_picture(s, len);
+ goto finish;
} else {
av_log(s, AV_LOG_DEBUG, "Unsupported value type %d in tag %s.\n", type, key);
goto finish;
@@ -256,7 +371,7 @@ static int asf_read_stream_properties(AVFormatContext *s, int64_t size)
type = AVMEDIA_TYPE_VIDEO;
} else if (!ff_guidcmp(&g, &ff_asf_jfif_media)) {
type = AVMEDIA_TYPE_VIDEO;
- st->codec->codec_id = CODEC_ID_MJPEG;
+ st->codec->codec_id = AV_CODEC_ID_MJPEG;
} else if (!ff_guidcmp(&g, &ff_asf_command_stream)) {
type = AVMEDIA_TYPE_DATA;
} else if (!ff_guidcmp(&g, &ff_asf_ext_stream_embed_stream_header)) {
@@ -297,10 +412,10 @@ static int asf_read_stream_properties(AVFormatContext *s, int64_t size)
if (is_dvr_ms_audio) {
// codec_id and codec_tag are unreliable in dvr_ms
// files. Set them later by probing stream.
- st->codec->codec_id = CODEC_ID_PROBE;
+ st->codec->codec_id = AV_CODEC_ID_PROBE;
st->codec->codec_tag = 0;
}
- if (st->codec->codec_id == CODEC_ID_AAC) {
+ if (st->codec->codec_id == AV_CODEC_ID_AAC) {
st->need_parsing = AVSTREAM_PARSE_NONE;
} else {
st->need_parsing = AVSTREAM_PARSE_FULL;
@@ -314,34 +429,12 @@ static int asf_read_stream_properties(AVFormatContext *s, int64_t size)
avio_rl16(pb); //ds_data_size
avio_r8(pb); //ds_silence_data
}
- //printf("Descrambling: ps:%d cs:%d ds:%d s:%d sd:%d\n",
- // asf_st->ds_packet_size, asf_st->ds_chunk_size,
- // asf_st->ds_data_size, asf_st->ds_span, asf_st->ds_silence_data);
if (asf_st->ds_span > 1) {
if (!asf_st->ds_chunk_size
|| (asf_st->ds_packet_size/asf_st->ds_chunk_size <= 1)
|| asf_st->ds_packet_size % asf_st->ds_chunk_size)
asf_st->ds_span = 0; // disable descrambling
}
- switch (st->codec->codec_id) {
- case CODEC_ID_MP3:
- st->codec->frame_size = MPA_FRAME_SIZE;
- break;
- case CODEC_ID_PCM_S16LE:
- case CODEC_ID_PCM_S16BE:
- case CODEC_ID_PCM_U16LE:
- case CODEC_ID_PCM_U16BE:
- case CODEC_ID_PCM_S8:
- case CODEC_ID_PCM_U8:
- case CODEC_ID_PCM_ALAW:
- case CODEC_ID_PCM_MULAW:
- st->codec->frame_size = 1;
- break;
- default:
- /* This is probably wrong, but it prevents a crash later */
- st->codec->frame_size = 1;
- break;
- }
} else if (type == AVMEDIA_TYPE_VIDEO &&
size - (avio_tell(pb) - pos1 + 24) >= 51) {
avio_rl32(pb);
@@ -356,7 +449,6 @@ static int asf_read_stream_properties(AVFormatContext *s, int64_t size)
st->codec->bits_per_coded_sample = avio_rl16(pb); /* depth */
tag1 = avio_rl32(pb);
avio_skip(pb, 20);
- // av_log(s, AV_LOG_DEBUG, "size:%d tsize:%d sizeX:%d\n", size, total_size, sizeX);
if (sizeX > 40) {
st->codec->extradata_size = sizeX - 40;
st->codec->extradata = av_mallocz(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
@@ -367,8 +459,8 @@ static int asf_read_stream_properties(AVFormatContext *s, int64_t size)
/* This code assumes that extradata contains only palette */
/* This is true for all paletted codecs implemented in libavcodec */
if (st->codec->extradata_size && (st->codec->bits_per_coded_sample <= 8)) {
- int av_unused i;
#if HAVE_BIGENDIAN
+ int i;
for (i = 0; i < FFMIN(st->codec->extradata_size, AVPALETTE_SIZE)/4; i++)
asf_st->palette[i] = av_bswap32(((uint32_t*)st->codec->extradata)[i]);
#else
@@ -388,7 +480,7 @@ static int asf_read_stream_properties(AVFormatContext *s, int64_t size)
av_freep(&st->codec->extradata);
st->codec->extradata_size=0;
}
- if(st->codec->codec_id == CODEC_ID_H264)
+ if(st->codec->codec_id == AV_CODEC_ID_H264)
st->need_parsing = AVSTREAM_PARSE_FULL_ONCE;
}
pos2 = avio_tell(pb);
@@ -527,16 +619,18 @@ static int asf_read_metadata(AVFormatContext *s, int64_t size)
for(i=0;i<n;i++) {
char name[1024];
+ int av_unused value_type;
avio_rl16(pb); //lang_list_index
stream_num= avio_rl16(pb);
name_len= avio_rl16(pb);
- avio_skip(pb, 2); /* value_type */
+ value_type = avio_rl16(pb); /* value_type */
value_len= avio_rl32(pb);
if ((ret = avio_get_str16le(pb, name_len, name, sizeof(name))) < name_len)
avio_skip(pb, name_len - ret);
- //av_log(s, AV_LOG_ERROR, "%d %d %d %d %d <%s>\n", i, stream_num, name_len, value_type, value_len, name);
+ av_dlog(s, "%d %d %d %d %d <%s>\n",
+ i, stream_num, name_len, value_type, value_len, name);
value_num= avio_rl16(pb);//we should use get_value() here but it does not work 2 is le16 here but le32 elsewhere
avio_skip(pb, value_len - 2);
@@ -582,7 +676,7 @@ static int asf_read_marker(AVFormatContext *s, int64_t size)
return 0;
}
-static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap)
+static int asf_read_header(AVFormatContext *s)
{
ASFContext *asf = s->priv_data;
ff_asf_guid g;
@@ -602,9 +696,7 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap)
uint64_t gpos= avio_tell(pb);
ff_get_guid(pb, &g);
gsize = avio_rl64(pb);
- av_dlog(s, "%08"PRIx64": ", gpos);
print_guid(&g);
- av_dlog(s, " size=0x%"PRIx64"\n", gsize);
if (!ff_guidcmp(&g, &ff_asf_data_header)) {
asf->data_object_offset = avio_tell(pb);
// if not streaming, gsize is not unlimited (how?), and there is enough space in the file..
@@ -685,7 +777,9 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap)
&st->sample_aspect_ratio.den,
asf->dar[0].num, asf->dar[0].den, INT_MAX);
-//av_log(s, AV_LOG_INFO, "i=%d, st->codec->codec_type:%d, dar %d:%d sar=%d:%d\n", i, st->codec->codec_type, dar[i].num, dar[i].den, st->sample_aspect_ratio.num, st->sample_aspect_ratio.den);
+ av_dlog(s, "i=%d, st->codec->codec_type:%d, asf->dar %d:%d sar=%d:%d\n",
+ i, st->codec->codec_type, asf->dar[i].num, asf->dar[i].den,
+ st->sample_aspect_ratio.num, st->sample_aspect_ratio.den);
// copy and convert language codes to the frontend
if (asf->streams[i].stream_language_index < 128) {
@@ -729,7 +823,9 @@ static int ff_asf_get_packet(AVFormatContext *s, AVIOContext *pb)
// if we do not know packet size, allow skipping up to 32 kB
off= 32768;
- if (s->packet_size > 0)
+ if (asf->no_resync_search)
+ off = 3;
+ else if (s->packet_size > 0)
off= (avio_tell(pb) - s->data_offset) % s->packet_size + 3;
c=d=e=-1;
@@ -825,7 +921,9 @@ static int asf_read_frame_header(AVFormatContext *s, AVIOContext *pb){
DO_2BITS(asf->packet_property >> 4, asf->packet_seq, 0);
DO_2BITS(asf->packet_property >> 2, asf->packet_frag_offset, 0);
DO_2BITS(asf->packet_property, asf->packet_replic_size, 0);
-//printf("key:%d stream:%d seq:%d offset:%d replic_size:%d\n", asf->packet_key_frame, asf->stream_index, asf->packet_seq, //asf->packet_frag_offset, asf->packet_replic_size);
+ av_dlog(asf, "key:%d stream:%d seq:%d offset:%d replic_size:%d\n",
+ asf->packet_key_frame, asf->stream_index, asf->packet_seq,
+ asf->packet_frag_offset, asf->packet_replic_size);
if (asf->packet_replic_size >= 8) {
asf->packet_obj_size = avio_rl32(pb);
if(asf->packet_obj_size >= (1<<24) || asf->packet_obj_size <= 0){
@@ -834,9 +932,6 @@ static int asf_read_frame_header(AVFormatContext *s, AVIOContext *pb){
}
asf->packet_frag_timestamp = avio_rl32(pb); // timestamp
if(asf->packet_replic_size >= 8+38+4){
-// for(i=0; i<asf->packet_replic_size-8; i++)
-// av_log(s, AV_LOG_DEBUG, "%02X ",avio_r8(pb));
-// av_log(s, AV_LOG_DEBUG, "\n");
avio_skip(pb, 10);
ts0= avio_rl64(pb);
avio_skip(pb, 8);;
@@ -875,14 +970,12 @@ static int asf_read_frame_header(AVFormatContext *s, AVIOContext *pb){
asf->packet_padsize -= diff;
}
}
- //printf("Fragsize %d\n", asf->packet_frag_size);
} else {
if (rsize > asf->packet_size_left) {
av_log(s, AV_LOG_ERROR, "packet_replic_size is invalid\n");
return -1;
}
asf->packet_frag_size = asf->packet_size_left - rsize;
- //printf("Using rest %d %d %d\n", asf->packet_frag_size, asf->packet_size_left, rsize);
}
if (asf->packet_replic_size == 1) {
asf->packet_multi_size = asf->packet_frag_size;
@@ -890,7 +983,6 @@ static int asf_read_frame_header(AVFormatContext *s, AVIOContext *pb){
return -1;
}
asf->packet_size_left -= rsize;
- //printf("___objsize____ %d %d rs:%d\n", asf->packet_obj_size, asf->packet_frag_offset, rsize);
return 0;
}
@@ -910,14 +1002,15 @@ static int ff_asf_parse_packet(AVFormatContext *s, AVIOContext *pb, AVPacket *pk
ASFStream *asf_st = 0;
for (;;) {
int ret;
- if(pb->eof_reached)
+
+ if (pb->eof_reached)
return AVERROR_EOF;
- if (asf->packet_size_left < FRAME_HEADER_SIZE
- || asf->packet_segments < 1) {
- //asf->packet_size_left <= asf->packet_padsize) {
+
+ if (asf->packet_size_left < FRAME_HEADER_SIZE ||
+ asf->packet_segments < 1) {
int ret = asf->packet_size_left + asf->packet_padsize;
- //printf("PacketLeftSize:%d Pad:%d Pos:%"PRId64"\n", asf->packet_size_left, asf->packet_padsize, avio_tell(pb));
- assert(ret>=0);
+
+ assert(ret >= 0);
/* fail safe */
avio_skip(pb, ret);
@@ -928,19 +1021,19 @@ static int ff_asf_parse_packet(AVFormatContext *s, AVIOContext *pb, AVPacket *pk
return 1;
}
if (asf->packet_time_start == 0) {
- if(asf_read_frame_header(s, pb) < 0){
- asf->packet_segments= 0;
+ if (asf_read_frame_header(s, pb) < 0) {
+ asf->packet_segments = 0;
continue;
}
- if (asf->stream_index < 0
- || s->streams[asf->stream_index]->discard >= AVDISCARD_ALL
- || (!asf->packet_key_frame && s->streams[asf->stream_index]->discard >= AVDISCARD_NONKEY)
- ) {
+ if (asf->stream_index < 0 ||
+ s->streams[asf->stream_index]->discard >= AVDISCARD_ALL ||
+ (!asf->packet_key_frame &&
+ s->streams[asf->stream_index]->discard >= AVDISCARD_NONKEY)) {
asf->packet_time_start = 0;
/* unhandled packet (should not happen) */
avio_skip(pb, asf->packet_frag_size);
asf->packet_size_left -= asf->packet_frag_size;
- if(asf->stream_index < 0)
+ if (asf->stream_index < 0)
av_log(s, AV_LOG_ERROR, "ff asf skip %d (unknown stream)\n", asf->packet_frag_size);
continue;
}
@@ -951,43 +1044,42 @@ static int ff_asf_parse_packet(AVFormatContext *s, AVIOContext *pb, AVPacket *pk
if (asf->packet_replic_size == 1) {
// frag_offset is here used as the beginning timestamp
asf->packet_frag_timestamp = asf->packet_time_start;
- asf->packet_time_start += asf->packet_time_delta;
- asf->packet_obj_size = asf->packet_frag_size = avio_r8(pb);
+ asf->packet_time_start += asf->packet_time_delta;
+ asf->packet_obj_size = asf->packet_frag_size = avio_r8(pb);
asf->packet_size_left--;
asf->packet_multi_size--;
- if (asf->packet_multi_size < asf->packet_obj_size)
- {
+ if (asf->packet_multi_size < asf->packet_obj_size) {
asf->packet_time_start = 0;
avio_skip(pb, asf->packet_multi_size);
asf->packet_size_left -= asf->packet_multi_size;
continue;
}
asf->packet_multi_size -= asf->packet_obj_size;
- //printf("COMPRESS size %d %d %d ms:%d\n", asf->packet_obj_size, asf->packet_frag_timestamp, asf->packet_size_left, asf->packet_multi_size);
}
- if( /*asf->packet_frag_size == asf->packet_obj_size*/
- asf_st->frag_offset + asf->packet_frag_size <= asf_st->pkt.size
- && asf_st->frag_offset + asf->packet_frag_size > asf->packet_obj_size){
+ if (asf_st->frag_offset + asf->packet_frag_size <= asf_st->pkt.size &&
+ asf_st->frag_offset + asf->packet_frag_size > asf->packet_obj_size) {
av_log(s, AV_LOG_INFO, "ignoring invalid packet_obj_size (%d %d %d %d)\n",
- asf_st->frag_offset, asf->packet_frag_size,
- asf->packet_obj_size, asf_st->pkt.size);
- asf->packet_obj_size= asf_st->pkt.size;
+ asf_st->frag_offset, asf->packet_frag_size,
+ asf->packet_obj_size, asf_st->pkt.size);
+ asf->packet_obj_size = asf_st->pkt.size;
}
- if ( asf_st->pkt.size != asf->packet_obj_size
- || asf_st->frag_offset + asf->packet_frag_size > asf_st->pkt.size) { //FIXME is this condition sufficient?
- if(asf_st->pkt.data){
- av_log(s, AV_LOG_INFO, "freeing incomplete packet size %d, new %d\n", asf_st->pkt.size, asf->packet_obj_size);
+ if (asf_st->pkt.size != asf->packet_obj_size ||
+ //FIXME is this condition sufficient?
+ asf_st->frag_offset + asf->packet_frag_size > asf_st->pkt.size) {
+ if (asf_st->pkt.data) {
+ av_log(s, AV_LOG_INFO, "freeing incomplete packet size %d, "
+ "new %d\n", asf_st->pkt.size, asf->packet_obj_size);
asf_st->frag_offset = 0;
av_free_packet(&asf_st->pkt);
}
/* new packet */
av_new_packet(&asf_st->pkt, asf->packet_obj_size);
- asf_st->seq = asf->packet_seq;
- asf_st->pkt.dts = asf->packet_frag_timestamp - asf->hdr.preroll;
+ asf_st->seq = asf->packet_seq;
+ asf_st->pkt.dts = asf->packet_frag_timestamp - asf->hdr.preroll;
asf_st->pkt.stream_index = asf->stream_index;
- asf_st->pkt.pos =
- asf_st->packet_pos= asf->packet_pos;
+ asf_st->pkt.pos = asf_st->packet_pos = asf->packet_pos;
+
if (asf_st->pkt.data && asf_st->palette_changed) {
uint8_t *pal;
pal = av_packet_new_side_data(&asf_st->pkt, AV_PKT_DATA_PALETTE,
@@ -999,9 +1091,11 @@ static int ff_asf_parse_packet(AVFormatContext *s, AVIOContext *pb, AVPacket *pk
asf_st->palette_changed = 0;
}
}
-//printf("new packet: stream:%d key:%d packet_key:%d audio:%d size:%d\n",
-//asf->stream_index, asf->packet_key_frame, asf_st->pkt.flags & AV_PKT_FLAG_KEY,
-//s->streams[asf->stream_index]->codec->codec_type == AVMEDIA_TYPE_AUDIO, asf->packet_obj_size);
+ av_dlog(asf, "new packet: stream:%d key:%d packet_key:%d audio:%d size:%d\n",
+ asf->stream_index, asf->packet_key_frame,
+ asf_st->pkt.flags & AV_PKT_FLAG_KEY,
+ s->streams[asf->stream_index]->codec->codec_type == AVMEDIA_TYPE_AUDIO,
+ asf->packet_obj_size);
if (s->streams[asf->stream_index]->codec->codec_type == AVMEDIA_TYPE_AUDIO)
asf->packet_key_frame = 1;
if (asf->packet_key_frame)
@@ -1009,25 +1103,26 @@ static int ff_asf_parse_packet(AVFormatContext *s, AVIOContext *pb, AVPacket *pk
}
/* read data */
- //printf("READ PACKET s:%d os:%d o:%d,%d l:%d DATA:%p\n",
- // s->packet_size, asf_st->pkt.size, asf->packet_frag_offset,
- // asf_st->frag_offset, asf->packet_frag_size, asf_st->pkt.data);
+ av_dlog(asf, "READ PACKET s:%d os:%d o:%d,%d l:%d DATA:%p\n",
+ s->packet_size, asf_st->pkt.size, asf->packet_frag_offset,
+ asf_st->frag_offset, asf->packet_frag_size, asf_st->pkt.data);
asf->packet_size_left -= asf->packet_frag_size;
if (asf->packet_size_left < 0)
continue;
- if( asf->packet_frag_offset >= asf_st->pkt.size
- || asf->packet_frag_size > asf_st->pkt.size - asf->packet_frag_offset){
+ if (asf->packet_frag_offset >= asf_st->pkt.size ||
+ asf->packet_frag_size > asf_st->pkt.size - asf->packet_frag_offset) {
av_log(s, AV_LOG_ERROR, "packet fragment position invalid %u,%u not in %u\n",
- asf->packet_frag_offset, asf->packet_frag_size, asf_st->pkt.size);
+ asf->packet_frag_offset, asf->packet_frag_size, asf_st->pkt.size);
continue;
}
ret = avio_read(pb, asf_st->pkt.data + asf->packet_frag_offset,
- asf->packet_frag_size);
+ asf->packet_frag_size);
if (ret != asf->packet_frag_size) {
if (ret < 0 || asf->packet_frag_offset + ret == 0)
return ret < 0 ? ret : AVERROR_EOF;
+
if (asf_st->ds_span > 1) {
// scrambling, we can either drop it completely or fill the remainder
// TODO: should we fill the whole packet instead of just the current
@@ -1035,9 +1130,10 @@ static int ff_asf_parse_packet(AVFormatContext *s, AVIOContext *pb, AVPacket *pk
memset(asf_st->pkt.data + asf->packet_frag_offset + ret, 0,
asf->packet_frag_size - ret);
ret = asf->packet_frag_size;
- } else
+ } else {
// no scrambling, so we can return partial packets
av_shrink_packet(&asf_st->pkt, asf->packet_frag_offset + ret);
+ }
}
if (s->key && s->keylen == 20)
ff_asfcrypt_dec(s->key, asf_st->pkt.data + asf->packet_frag_offset,
@@ -1046,11 +1142,11 @@ static int ff_asf_parse_packet(AVFormatContext *s, AVIOContext *pb, AVPacket *pk
/* test if whole packet is read */
if (asf_st->frag_offset == asf_st->pkt.size) {
//workaround for macroshit radio DVR-MS files
- if( s->streams[asf->stream_index]->codec->codec_id == CODEC_ID_MPEG2VIDEO
- && asf_st->pkt.size > 100){
+ if (s->streams[asf->stream_index]->codec->codec_id == AV_CODEC_ID_MPEG2VIDEO &&
+ asf_st->pkt.size > 100) {
int i;
- for(i=0; i<asf_st->pkt.size && !asf_st->pkt.data[i]; i++);
- if(i == asf_st->pkt.size){
+ for (i = 0; i < asf_st->pkt.size && !asf_st->pkt.data[i]; i++);
+ if (i == asf_st->pkt.size) {
av_log(s, AV_LOG_DEBUG, "discarding ms fart\n");
asf_st->frag_offset = 0;
av_free_packet(&asf_st->pkt);
@@ -1060,40 +1156,39 @@ static int ff_asf_parse_packet(AVFormatContext *s, AVIOContext *pb, AVPacket *pk
/* return packet */
if (asf_st->ds_span > 1) {
- if(asf_st->pkt.size != asf_st->ds_packet_size * asf_st->ds_span){
- av_log(s, AV_LOG_ERROR, "pkt.size != ds_packet_size * ds_span (%d %d %d)\n", asf_st->pkt.size, asf_st->ds_packet_size, asf_st->ds_span);
- }else{
- /* packet descrambling */
- uint8_t *newdata = av_malloc(asf_st->pkt.size + FF_INPUT_BUFFER_PADDING_SIZE);
- if (newdata) {
- int offset = 0;
- memset(newdata + asf_st->pkt.size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
- while (offset < asf_st->pkt.size) {
- int off = offset / asf_st->ds_chunk_size;
- int row = off / asf_st->ds_span;
- int col = off % asf_st->ds_span;
- int idx = row + col * asf_st->ds_packet_size / asf_st->ds_chunk_size;
- //printf("off:%d row:%d col:%d idx:%d\n", off, row, col, idx);
-
- assert(offset + asf_st->ds_chunk_size <= asf_st->pkt.size);
- assert(idx+1 <= asf_st->pkt.size / asf_st->ds_chunk_size);
- memcpy(newdata + offset,
- asf_st->pkt.data + idx * asf_st->ds_chunk_size,
- asf_st->ds_chunk_size);
- offset += asf_st->ds_chunk_size;
+ if(asf_st->pkt.size != asf_st->ds_packet_size * asf_st->ds_span) {
+ av_log(s, AV_LOG_ERROR, "pkt.size != ds_packet_size * "
+ "ds_span (%d %d %d)\n", asf_st->pkt.size,
+ asf_st->ds_packet_size, asf_st->ds_span);
+ } else {
+ /* packet descrambling */
+ uint8_t *newdata = av_malloc(asf_st->pkt.size + FF_INPUT_BUFFER_PADDING_SIZE);
+ if (newdata) {
+ int offset = 0;
+ memset(newdata + asf_st->pkt.size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
+ while (offset < asf_st->pkt.size) {
+ int off = offset / asf_st->ds_chunk_size;
+ int row = off / asf_st->ds_span;
+ int col = off % asf_st->ds_span;
+ int idx = row + col * asf_st->ds_packet_size / asf_st->ds_chunk_size;
+ assert(offset + asf_st->ds_chunk_size <= asf_st->pkt.size);
+ assert(idx+1 <= asf_st->pkt.size / asf_st->ds_chunk_size);
+ memcpy(newdata + offset,
+ asf_st->pkt.data + idx * asf_st->ds_chunk_size,
+ asf_st->ds_chunk_size);
+ offset += asf_st->ds_chunk_size;
+ }
+ av_free(asf_st->pkt.data);
+ asf_st->pkt.data = newdata;
}
- av_free(asf_st->pkt.data);
- asf_st->pkt.data = newdata;
}
- }
}
- asf_st->frag_offset = 0;
- *pkt= asf_st->pkt;
- //printf("packet %d %d\n", asf_st->pkt.size, asf->packet_frag_size);
- asf_st->pkt.size = 0;
- asf_st->pkt.data = 0;
+ asf_st->frag_offset = 0;
+ *pkt = asf_st->pkt;
+ asf_st->pkt.size = 0;
+ asf_st->pkt.data = 0;
asf_st->pkt.side_data_elems = 0;
- asf_st->pkt.side_data = NULL;
+ asf_st->pkt.side_data = NULL;
break; // packet completed
}
}
@@ -1178,7 +1273,6 @@ static int64_t asf_read_pts(AVFormatContext *s, int stream_index, int64_t *ppos,
*ppos= pos;
avio_seek(s->pb, pos, SEEK_SET);
-//printf("asf_read_pts\n");
asf_reset_header(s);
for(;;){
if (asf_read_packet(s, pkt) < 0){
@@ -1206,8 +1300,6 @@ static int64_t asf_read_pts(AVFormatContext *s, int stream_index, int64_t *ppos,
}
*ppos= pos;
-//printf("found keyframe at %"PRId64" stream %d stamp:%"PRId64"\n", *ppos, stream_index, pts);
-
return pts;
}
@@ -1255,7 +1347,7 @@ static void asf_build_simple_index(AVFormatContext *s, int stream_index)
last_pos=pos;
}
}
- asf->index_read= 1;
+ asf->index_read= ict > 0;
}
avio_seek(s->pb, current_pos, SEEK_SET);
}
@@ -1304,7 +1396,7 @@ static int asf_read_seek(AVFormatContext *s, int stream_index, int64_t pts, int
AVInputFormat ff_asf_demuxer = {
.name = "asf",
- .long_name = NULL_IF_CONFIG_SMALL("ASF format"),
+ .long_name = NULL_IF_CONFIG_SMALL("ASF (Advanced / Active Streaming Format)"),
.priv_data_size = sizeof(ASFContext),
.read_probe = asf_probe,
.read_header = asf_read_header,
@@ -1312,5 +1404,6 @@ AVInputFormat ff_asf_demuxer = {
.read_close = asf_read_close,
.read_seek = asf_read_seek,
.read_timestamp = asf_read_pts,
- .flags = AVFMT_NOBINSEARCH | AVFMT_NOGENSEARCH,
+ .flags = AVFMT_NOBINSEARCH | AVFMT_NOGENSEARCH,
+ .priv_class = &asf_class,
};
diff --git a/gst-libs/ext/libav/libavformat/asfenc.c b/gst-libs/ext/libav/libavformat/asfenc.c
index 1cfc857..5c820be 100644
--- a/gst-libs/ext/libav/libavformat/asfenc.c
+++ b/gst-libs/ext/libav/libavformat/asfenc.c
@@ -216,10 +216,10 @@ typedef struct {
} ASFContext;
static const AVCodecTag codec_asf_bmp_tags[] = {
- { CODEC_ID_MPEG4, MKTAG('M', 'P', '4', 'S') },
- { CODEC_ID_MPEG4, MKTAG('M', '4', 'S', '2') },
- { CODEC_ID_MSMPEG4V3, MKTAG('M', 'P', '4', '3') },
- { CODEC_ID_NONE, 0 },
+ { AV_CODEC_ID_MPEG4, MKTAG('M', 'P', '4', 'S') },
+ { AV_CODEC_ID_MPEG4, MKTAG('M', '4', 'S', '2') },
+ { AV_CODEC_ID_MSMPEG4V3, MKTAG('M', 'P', '4', '3') },
+ { AV_CODEC_ID_NONE, 0 },
};
#define PREROLL_TIME 3100
@@ -316,7 +316,7 @@ static int asf_write_header1(AVFormatContext *s, int64_t file_size, int64_t data
duration = asf->duration + PREROLL_TIME * 10000;
has_title = tags[0] || tags[1] || tags[2] || tags[3] || tags[4];
- metadata_count = s->metadata ? s->metadata->count : 0;
+ metadata_count = av_dict_count(s->metadata);
bit_rate = 0;
for(n=0;n<s->nb_streams;n++) {
@@ -446,7 +446,7 @@ static int asf_write_header1(AVFormatContext *s, int64_t file_size, int64_t data
}
/* ERROR Correction */
avio_w8(pb, 0x01);
- if(enc->codec_id == CODEC_ID_ADPCM_G726 || !enc->block_align){
+ if(enc->codec_id == AV_CODEC_ID_ADPCM_G726 || !enc->block_align){
avio_wl16(pb, 0x0190);
avio_wl16(pb, 0x0190);
}else{
@@ -489,7 +489,7 @@ static int asf_write_header1(AVFormatContext *s, int64_t file_size, int64_t data
else
avio_wl16(pb, -1);
- if(enc->codec_id == CODEC_ID_WMAV2)
+ if(enc->codec_id == AV_CODEC_ID_WMAV2)
desc = "Windows Media Audio V8";
else
desc = p ? p->name : enc->codec_name;
@@ -872,7 +872,6 @@ static int asf_write_trailer(AVFormatContext *s)
asf_write_header1(s, file_size, data_size - asf->data_offset);
}
- avio_flush(s->pb);
av_free(asf->index_ptr);
return 0;
}
@@ -880,41 +879,37 @@ static int asf_write_trailer(AVFormatContext *s)
#if CONFIG_ASF_MUXER
AVOutputFormat ff_asf_muxer = {
.name = "asf",
- .long_name = NULL_IF_CONFIG_SMALL("ASF format"),
+ .long_name = NULL_IF_CONFIG_SMALL("ASF (Advanced / Active Streaming Format)"),
.mime_type = "video/x-ms-asf",
.extensions = "asf,wmv,wma",
.priv_data_size = sizeof(ASFContext),
-#if CONFIG_LIBMP3LAME
- .audio_codec = CODEC_ID_MP3,
-#else
- .audio_codec = CODEC_ID_MP2,
-#endif
- .video_codec = CODEC_ID_MSMPEG4V3,
+ .audio_codec = CONFIG_LIBMP3LAME ? AV_CODEC_ID_MP3 : AV_CODEC_ID_MP2,
+ .video_codec = AV_CODEC_ID_MSMPEG4V3,
.write_header = asf_write_header,
.write_packet = asf_write_packet,
.write_trailer = asf_write_trailer,
- .flags = AVFMT_GLOBALHEADER,
- .codec_tag= (const AVCodecTag* const []){codec_asf_bmp_tags, ff_codec_bmp_tags, ff_codec_wav_tags, 0},
+ .flags = AVFMT_GLOBALHEADER,
+ .codec_tag = (const AVCodecTag* const []){
+ codec_asf_bmp_tags, ff_codec_bmp_tags, ff_codec_wav_tags, 0
+ },
};
#endif
#if CONFIG_ASF_STREAM_MUXER
AVOutputFormat ff_asf_stream_muxer = {
.name = "asf_stream",
- .long_name = NULL_IF_CONFIG_SMALL("ASF format"),
+ .long_name = NULL_IF_CONFIG_SMALL("ASF (Advanced / Active Streaming Format)"),
.mime_type = "video/x-ms-asf",
.extensions = "asf,wmv,wma",
.priv_data_size = sizeof(ASFContext),
-#if CONFIG_LIBMP3LAME
- .audio_codec = CODEC_ID_MP3,
-#else
- .audio_codec = CODEC_ID_MP2,
-#endif
- .video_codec = CODEC_ID_MSMPEG4V3,
+ .audio_codec = CONFIG_LIBMP3LAME ? AV_CODEC_ID_MP3 : AV_CODEC_ID_MP2,
+ .video_codec = AV_CODEC_ID_MSMPEG4V3,
.write_header = asf_write_stream_header,
.write_packet = asf_write_packet,
.write_trailer = asf_write_trailer,
- .flags = AVFMT_GLOBALHEADER,
- .codec_tag= (const AVCodecTag* const []){codec_asf_bmp_tags, ff_codec_bmp_tags, ff_codec_wav_tags, 0},
+ .flags = AVFMT_GLOBALHEADER,
+ .codec_tag = (const AVCodecTag* const []){
+ codec_asf_bmp_tags, ff_codec_bmp_tags, ff_codec_wav_tags, 0
+ },
};
#endif //CONFIG_ASF_STREAM_MUXER
diff --git a/gst-libs/ext/libav/libavformat/assdec.c b/gst-libs/ext/libav/libavformat/assdec.c
index b100f2c..0041ca4 100644
--- a/gst-libs/ext/libav/libavformat/assdec.c
+++ b/gst-libs/ext/libav/libavformat/assdec.c
@@ -60,7 +60,7 @@ static int64_t get_pts(const uint8_t *p)
if(sscanf(p, "%*[^,],%d:%d:%d%*c%d", &hour, &min, &sec, &hsec) != 4)
return AV_NOPTS_VALUE;
-// av_log(NULL, AV_LOG_ERROR, "%d %d %d %d %d [%s]\n", i, hour, min, sec, hsec, p);
+ av_dlog(NULL, "%d %d %d %d [%s]\n", hour, min, sec, hsec, p);
min+= 60*hour;
sec+= 60*min;
@@ -68,12 +68,13 @@ static int64_t get_pts(const uint8_t *p)
return sec*100+hsec;
}
-static int event_cmp(uint8_t **a, uint8_t **b)
+static int event_cmp(const void *_a, const void *_b)
{
+ const uint8_t *const *a = _a, *const *b = _b;
return get_pts(*a) - get_pts(*b);
}
-static int read_header(AVFormatContext *s, AVFormatParameters *ap)
+static int read_header(AVFormatContext *s)
{
int i, len, header_remaining;
ASSContext *ass = s->priv_data;
@@ -88,7 +89,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap)
return -1;
avpriv_set_pts_info(st, 64, 1, 100);
st->codec->codec_type = AVMEDIA_TYPE_SUBTITLE;
- st->codec->codec_id= CODEC_ID_SSA;
+ st->codec->codec_id= AV_CODEC_ID_SSA;
header_remaining= INT_MAX;
dst[0] = &st->codec->extradata;
@@ -131,7 +132,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap)
p++;
}
- qsort(ass->event, ass->event_count, sizeof(*ass->event), (void*)event_cmp);
+ qsort(ass->event, ass->event_count, sizeof(*ass->event), event_cmp);
return 0;
@@ -205,7 +206,7 @@ static int read_seek2(AVFormatContext *s, int stream_index,
AVInputFormat ff_ass_demuxer = {
.name = "ass",
- .long_name = NULL_IF_CONFIG_SMALL("Advanced SubStation Alpha subtitle format"),
+ .long_name = NULL_IF_CONFIG_SMALL("SSA (SubStation Alpha) subtitle"),
.priv_data_size = sizeof(ASSContext),
.read_probe = probe,
.read_header = read_header,
diff --git a/gst-libs/ext/libav/libavformat/assenc.c b/gst-libs/ext/libav/libavformat/assenc.c
index c53af16..5bf2e20 100644
--- a/gst-libs/ext/libav/libavformat/assenc.c
+++ b/gst-libs/ext/libav/libavformat/assenc.c
@@ -31,7 +31,7 @@ static int write_header(AVFormatContext *s)
AVCodecContext *avctx= s->streams[0]->codec;
uint8_t *last= NULL;
- if(s->nb_streams != 1 || avctx->codec_id != CODEC_ID_SSA){
+ if(s->nb_streams != 1 || avctx->codec_id != AV_CODEC_ID_SSA){
av_log(s, AV_LOG_ERROR, "Exactly one ASS/SSA stream is needed.\n");
return -1;
}
@@ -72,18 +72,16 @@ static int write_trailer(AVFormatContext *s)
avio_write(s->pb, avctx->extradata + ass->extra_index,
avctx->extradata_size - ass->extra_index);
- avio_flush(s->pb);
-
return 0;
}
AVOutputFormat ff_ass_muxer = {
.name = "ass",
- .long_name = NULL_IF_CONFIG_SMALL("Advanced SubStation Alpha subtitle format"),
+ .long_name = NULL_IF_CONFIG_SMALL("SSA (SubStation Alpha) subtitle"),
.mime_type = "text/x-ssa",
.extensions = "ass,ssa",
.priv_data_size = sizeof(ASSContext),
- .subtitle_codec = CODEC_ID_SSA,
+ .subtitle_codec = AV_CODEC_ID_SSA,
.write_header = write_header,
.write_packet = write_packet,
.write_trailer = write_trailer,
diff --git a/gst-libs/ext/libav/libavformat/au.c b/gst-libs/ext/libav/libavformat/au.c
index c6fb8db..8f9a3fa 100644
--- a/gst-libs/ext/libav/libavformat/au.c
+++ b/gst-libs/ext/libav/libavformat/au.c
@@ -31,81 +31,21 @@
#include "internal.h"
#include "avio_internal.h"
#include "pcm.h"
-#include "riff.h"
-
-/* if we don't know the size in advance */
-#define AU_UNKNOWN_SIZE ((uint32_t)(~0))
/* The libavcodec codecs we support, and the IDs they have in the file */
static const AVCodecTag codec_au_tags[] = {
- { CODEC_ID_PCM_MULAW, 1 },
- { CODEC_ID_PCM_S8, 2 },
- { CODEC_ID_PCM_S16BE, 3 },
- { CODEC_ID_PCM_S24BE, 4 },
- { CODEC_ID_PCM_S32BE, 5 },
- { CODEC_ID_PCM_F32BE, 6 },
- { CODEC_ID_PCM_F64BE, 7 },
- { CODEC_ID_PCM_ALAW, 27 },
- { CODEC_ID_NONE, 0 },
+ { AV_CODEC_ID_PCM_MULAW, 1 },
+ { AV_CODEC_ID_PCM_S8, 2 },
+ { AV_CODEC_ID_PCM_S16BE, 3 },
+ { AV_CODEC_ID_PCM_S24BE, 4 },
+ { AV_CODEC_ID_PCM_S32BE, 5 },
+ { AV_CODEC_ID_PCM_F32BE, 6 },
+ { AV_CODEC_ID_PCM_F64BE, 7 },
+ { AV_CODEC_ID_PCM_ALAW, 27 },
+ { AV_CODEC_ID_NONE, 0 },
};
-#if CONFIG_AU_MUXER
-/* AUDIO_FILE header */
-static int put_au_header(AVIOContext *pb, AVCodecContext *enc)
-{
- if(!enc->codec_tag)
- return -1;
- ffio_wfourcc(pb, ".snd"); /* magic number */
- avio_wb32(pb, 24); /* header size */
- avio_wb32(pb, AU_UNKNOWN_SIZE); /* data size */
- avio_wb32(pb, (uint32_t)enc->codec_tag); /* codec ID */
- avio_wb32(pb, enc->sample_rate);
- avio_wb32(pb, (uint32_t)enc->channels);
- return 0;
-}
-
-static int au_write_header(AVFormatContext *s)
-{
- AVIOContext *pb = s->pb;
-
- s->priv_data = NULL;
-
- /* format header */
- if (put_au_header(pb, s->streams[0]->codec) < 0) {
- return -1;
- }
-
- avio_flush(pb);
-
- return 0;
-}
-
-static int au_write_packet(AVFormatContext *s, AVPacket *pkt)
-{
- AVIOContext *pb = s->pb;
- avio_write(pb, pkt->data, pkt->size);
- return 0;
-}
-
-static int au_write_trailer(AVFormatContext *s)
-{
- AVIOContext *pb = s->pb;
- int64_t file_size;
-
- if (s->pb->seekable) {
-
- /* update file size */
- file_size = avio_tell(pb);
- avio_seek(pb, 8, SEEK_SET);
- avio_wb32(pb, (uint32_t)(file_size - 24));
- avio_seek(pb, file_size, SEEK_SET);
-
- avio_flush(pb);
- }
-
- return 0;
-}
-#endif /* CONFIG_AU_MUXER */
+#if CONFIG_AU_DEMUXER
static int au_probe(AVProbeData *p)
{
@@ -118,14 +58,13 @@ static int au_probe(AVProbeData *p)
}
/* au input */
-static int au_read_header(AVFormatContext *s,
- AVFormatParameters *ap)
+static int au_read_header(AVFormatContext *s)
{
int size;
unsigned int tag;
AVIOContext *pb = s->pb;
unsigned int id, channels, rate;
- enum CodecID codec;
+ enum AVCodecID codec;
AVStream *st;
/* check ".snd" header */
@@ -143,6 +82,11 @@ static int au_read_header(AVFormatContext *s,
if (!av_get_bits_per_sample(codec)) {
av_log_ask_for_sample(s, "could not determine bits per sample\n");
+ return AVERROR_PATCHWELCOME;
+ }
+
+ if (channels == 0 || channels > 64) {
+ av_log(s, AV_LOG_ERROR, "Invalid number of channels %d\n", channels);
return AVERROR_INVALIDDATA;
}
@@ -184,29 +128,88 @@ static int au_read_packet(AVFormatContext *s,
return 0;
}
-#if CONFIG_AU_DEMUXER
AVInputFormat ff_au_demuxer = {
.name = "au",
- .long_name = NULL_IF_CONFIG_SMALL("SUN AU format"),
+ .long_name = NULL_IF_CONFIG_SMALL("Sun AU"),
.read_probe = au_probe,
.read_header = au_read_header,
.read_packet = au_read_packet,
- .read_seek = pcm_read_seek,
- .codec_tag= (const AVCodecTag* const []){codec_au_tags, 0},
+ .read_seek = ff_pcm_read_seek,
+ .codec_tag = (const AVCodecTag* const []){ codec_au_tags, 0 },
};
-#endif
+#endif /* CONFIG_AU_DEMUXER */
#if CONFIG_AU_MUXER
+
+/* if we don't know the size in advance */
+#define AU_UNKNOWN_SIZE ((uint32_t)(~0))
+
+/* AUDIO_FILE header */
+static int put_au_header(AVIOContext *pb, AVCodecContext *enc)
+{
+ if(!enc->codec_tag)
+ return -1;
+ ffio_wfourcc(pb, ".snd"); /* magic number */
+ avio_wb32(pb, 24); /* header size */
+ avio_wb32(pb, AU_UNKNOWN_SIZE); /* data size */
+ avio_wb32(pb, (uint32_t)enc->codec_tag); /* codec ID */
+ avio_wb32(pb, enc->sample_rate);
+ avio_wb32(pb, (uint32_t)enc->channels);
+ return 0;
+}
+
+static int au_write_header(AVFormatContext *s)
+{
+ AVIOContext *pb = s->pb;
+
+ s->priv_data = NULL;
+
+ /* format header */
+ if (put_au_header(pb, s->streams[0]->codec) < 0) {
+ return -1;
+ }
+
+ avio_flush(pb);
+
+ return 0;
+}
+
+static int au_write_packet(AVFormatContext *s, AVPacket *pkt)
+{
+ AVIOContext *pb = s->pb;
+ avio_write(pb, pkt->data, pkt->size);
+ return 0;
+}
+
+static int au_write_trailer(AVFormatContext *s)
+{
+ AVIOContext *pb = s->pb;
+ int64_t file_size;
+
+ if (s->pb->seekable) {
+
+ /* update file size */
+ file_size = avio_tell(pb);
+ avio_seek(pb, 8, SEEK_SET);
+ avio_wb32(pb, (uint32_t)(file_size - 24));
+ avio_seek(pb, file_size, SEEK_SET);
+
+ avio_flush(pb);
+ }
+
+ return 0;
+}
+
AVOutputFormat ff_au_muxer = {
.name = "au",
- .long_name = NULL_IF_CONFIG_SMALL("SUN AU format"),
+ .long_name = NULL_IF_CONFIG_SMALL("Sun AU"),
.mime_type = "audio/basic",
.extensions = "au",
- .audio_codec = CODEC_ID_PCM_S16BE,
- .video_codec = CODEC_ID_NONE,
+ .audio_codec = AV_CODEC_ID_PCM_S16BE,
+ .video_codec = AV_CODEC_ID_NONE,
.write_header = au_write_header,
.write_packet = au_write_packet,
.write_trailer = au_write_trailer,
- .codec_tag= (const AVCodecTag* const []){codec_au_tags, 0},
+ .codec_tag = (const AVCodecTag* const []){ codec_au_tags, 0 },
};
-#endif //CONFIG_AU_MUXER
+#endif /* CONFIG_AU_MUXER */
diff --git a/gst-libs/ext/libav/libavformat/audiointerleave.c b/gst-libs/ext/libav/libavformat/audiointerleave.c
index e48f826..5df0bb0 100644
--- a/gst-libs/ext/libav/libavformat/audiointerleave.c
+++ b/gst-libs/ext/libav/libavformat/audiointerleave.c
@@ -130,5 +130,5 @@ int ff_audio_rechunk_interleave(AVFormatContext *s, AVPacket *out, AVPacket *pkt
}
}
- return get_packet(s, out, pkt, flush);
+ return get_packet(s, out, NULL, flush);
}
diff --git a/gst-libs/ext/libav/libavformat/audiointerleave.h b/gst-libs/ext/libav/libavformat/audiointerleave.h
index af29629..9c7b548 100644
--- a/gst-libs/ext/libav/libavformat/audiointerleave.h
+++ b/gst-libs/ext/libav/libavformat/audiointerleave.h
@@ -26,7 +26,7 @@
#include "libavutil/fifo.h"
#include "avformat.h"
-typedef struct {
+typedef struct AudioInterleaveContext {
AVFifoBuffer *fifo;
unsigned fifo_size; ///< size of currently allocated FIFO
uint64_t dts; ///< current dts
diff --git a/gst-libs/ext/libav/libavformat/avc.c b/gst-libs/ext/libav/libavformat/avc.c
index b0c511e..2fd5ac8 100644
--- a/gst-libs/ext/libav/libavformat/avc.c
+++ b/gst-libs/ext/libav/libavformat/avc.c
@@ -160,3 +160,34 @@ int ff_isom_write_avcc(AVIOContext *pb, const uint8_t *data, int len)
}
return 0;
}
+
+int ff_avc_write_annexb_extradata(const uint8_t *in, uint8_t **buf, int *size)
+{
+ uint16_t sps_size, pps_size;
+ uint8_t *out;
+ int out_size;
+
+ *buf = NULL;
+ if (*size >= 4 && (AV_RB32(in) == 0x00000001 || AV_RB24(in) == 0x000001))
+ return 0;
+ if (*size < 11 || in[0] != 1)
+ return AVERROR_INVALIDDATA;
+
+ sps_size = AV_RB16(&in[6]);
+ if (11 + sps_size > *size)
+ return AVERROR_INVALIDDATA;
+ pps_size = AV_RB16(&in[9 + sps_size]);
+ if (11 + sps_size + pps_size > *size)
+ return AVERROR_INVALIDDATA;
+ out_size = 8 + sps_size + pps_size;
+ out = av_mallocz(out_size);
+ if (!out)
+ return AVERROR(ENOMEM);
+ AV_WB32(&out[0], 0x00000001);
+ memcpy(out + 4, &in[8], sps_size);
+ AV_WB32(&out[4 + sps_size], 0x00000001);
+ memcpy(out + 8 + sps_size, &in[11 + sps_size], pps_size);
+ *buf = out;
+ *size = out_size;
+ return 0;
+}
diff --git a/gst-libs/ext/libav/libavformat/avc.h b/gst-libs/ext/libav/libavformat/avc.h
index 5612212..579756e 100644
--- a/gst-libs/ext/libav/libavformat/avc.h
+++ b/gst-libs/ext/libav/libavformat/avc.h
@@ -29,5 +29,6 @@ int ff_avc_parse_nal_units(AVIOContext *s, const uint8_t *buf, int size);
int ff_avc_parse_nal_units_buf(const uint8_t *buf_in, uint8_t **buf, int *size);
int ff_isom_write_avcc(AVIOContext *pb, const uint8_t *data, int len);
const uint8_t *ff_avc_find_startcode(const uint8_t *p, const uint8_t *end);
+int ff_avc_write_annexb_extradata(const uint8_t *in, uint8_t **buf, int *size);
#endif /* AVFORMAT_AVC_H */
diff --git a/gst-libs/ext/libav/libavformat/avformat.h b/gst-libs/ext/libav/libavformat/avformat.h
index 22a89d3..149b66f 100644
--- a/gst-libs/ext/libav/libavformat/avformat.h
+++ b/gst-libs/ext/libav/libavformat/avformat.h
@@ -66,11 +66,23 @@
* set by user for input, always set by user for output (unless you are dealing
* with an AVFMT_NOFILE format).
*
+ * @section lavf_options Passing options to (de)muxers
+ * Lavf allows to configure muxers and demuxers using the @ref avoptions
+ * mechanism. Generic (format-independent) libavformat options are provided by
+ * AVFormatContext, they can be examined from a user program by calling
+ * av_opt_next() / av_opt_find() on an allocated AVFormatContext (or its AVClass
+ * from avformat_get_class()). Private (format-specific) options are provided by
+ * AVFormatContext.priv_data if and only if AVInputFormat.priv_class /
+ * AVOutputFormat.priv_class of the corresponding format struct is non-NULL.
+ * Further options may be provided by the @ref AVFormatContext.pb "I/O context",
+ * if its AVClass is non-NULL, and the protocols layer. See the discussion on
+ * nesting in @ref avoptions documentation to learn how to access those.
+ *
* @defgroup lavf_decoding Demuxing
* @{
* Demuxers read a media file and split it into chunks of data (@em packets). A
- * @ref AVPacket "packet" contains one or more frames which belong a single
- * elementary stream. In lavf API this process is represented by the
+ * @ref AVPacket "packet" contains one or more encoded frames which belongs to a
+ * single elementary stream. In the lavf API this process is represented by the
* avformat_open_input() function for opening a file, av_read_frame() for
* reading a single packet and finally avformat_close_input(), which does the
* cleanup.
@@ -100,10 +112,61 @@
* your reading callbacks to it. Then set the @em pb field of your
* AVFormatContext to newly created AVIOContext.
*
+ * Since the format of the opened file is in general not known until after
+ * avformat_open_input() has returned, it is not possible to set demuxer private
+ * options on a preallocated context. Instead, the options should be passed to
+ * avformat_open_input() wrapped in an AVDictionary:
+ * @code
+ * AVDictionary *options = NULL;
+ * av_dict_set(&options, "video_size", "640x480", 0);
+ * av_dict_set(&options, "pixel_format", "rgb24", 0);
+ *
+ * if (avformat_open_input(&s, url, NULL, &options) < 0)
+ * abort();
+ * av_dict_free(&options);
+ * @endcode
+ * This code passes the private options 'video_size' and 'pixel_format' to the
+ * demuxer. They would be necessary for e.g. the rawvideo demuxer, since it
+ * cannot know how to interpret raw video data otherwise. If the format turns
+ * out to be something different than raw video, those options will not be
+ * recognized by the demuxer and therefore will not be applied. Such unrecognized
+ * options are then returned in the options dictionary (recognized options are
+ * consumed). The calling program can handle such unrecognized options as it
+ * wishes, e.g.
+ * @code
+ * AVDictionaryEntry *e;
+ * if (e = av_dict_get(options, "", NULL, AV_DICT_IGNORE_SUFFIX)) {
+ * fprintf(stderr, "Option %s not recognized by the demuxer.\n", e->key);
+ * abort();
+ * }
+ * @endcode
+ *
* After you have finished reading the file, you must close it with
* avformat_close_input(). It will free everything associated with the file.
*
* @section lavf_decoding_read Reading from an opened file
+ * Reading data from an opened AVFormatContext is done by repeatedly calling
+ * av_read_frame() on it. Each call, if successful, will return an AVPacket
+ * containing encoded data for one AVStream, identified by
+ * AVPacket.stream_index. This packet may be passed straight into the libavcodec
+ * decoding functions avcodec_decode_video2(), avcodec_decode_audio4() or
+ * avcodec_decode_subtitle2() if the caller wishes to decode the data.
+ *
+ * AVPacket.pts, AVPacket.dts and AVPacket.duration timing information will be
+ * set if known. They may also be unset (i.e. AV_NOPTS_VALUE for
+ * pts/dts, 0 for duration) if the stream does not provide them. The timing
+ * information will be in AVStream.time_base units, i.e. it has to be
+ * multiplied by the timebase to convert them to seconds.
+ *
+ * If AVPacket.destruct is set on the returned packet, then the packet is
+ * allocated dynamically and the user may keep it indefinitely.
+ * Otherwise, if AVPacket.destruct is NULL, the packet data is backed by a
+ * static storage somewhere inside the demuxer and the packet is only valid
+ * until the next av_read_frame() call or closing the file. If the caller
+ * requires a longer lifetime, av_dup_packet() will make an av_malloc()ed copy
+ * of it.
+ * In both cases, the packet must be freed with av_free_packet() when it is no
+ * longer needed.
*
* @section lavf_decoding_seek Seeking
* @}
@@ -144,6 +207,10 @@
#include "avio.h"
#include "libavformat/version.h"
+#if FF_API_AV_GETTIME
+#include "libavutil/time.h"
+#endif
+
struct AVFormatContext;
@@ -220,74 +287,6 @@ struct AVFormatContext;
* @}
*/
-#if FF_API_OLD_METADATA2
-/**
- * @defgroup old_metadata Old metadata API
- * The following functions are deprecated, use
- * their equivalents from libavutil/dict.h instead.
- * @{
- */
-
-#define AV_METADATA_MATCH_CASE AV_DICT_MATCH_CASE
-#define AV_METADATA_IGNORE_SUFFIX AV_DICT_IGNORE_SUFFIX
-#define AV_METADATA_DONT_STRDUP_KEY AV_DICT_DONT_STRDUP_KEY
-#define AV_METADATA_DONT_STRDUP_VAL AV_DICT_DONT_STRDUP_VAL
-#define AV_METADATA_DONT_OVERWRITE AV_DICT_DONT_OVERWRITE
-
-typedef attribute_deprecated AVDictionary AVMetadata;
-typedef attribute_deprecated AVDictionaryEntry AVMetadataTag;
-
-typedef struct AVMetadataConv AVMetadataConv;
-
-/**
- * Get a metadata element with matching key.
- *
- * @param prev Set to the previous matching element to find the next.
- * If set to NULL the first matching element is returned.
- * @param flags Allows case as well as suffix-insensitive comparisons.
- * @return Found tag or NULL, changing key or value leads to undefined behavior.
- */
-attribute_deprecated AVDictionaryEntry *
-av_metadata_get(AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags);
-
-/**
- * Set the given tag in *pm, overwriting an existing tag.
- *
- * @param pm pointer to a pointer to a metadata struct. If *pm is NULL
- * a metadata struct is allocated and put in *pm.
- * @param key tag key to add to *pm (will be av_strduped depending on flags)
- * @param value tag value to add to *pm (will be av_strduped depending on flags).
- * Passing a NULL value will cause an existing tag to be deleted.
- * @return >= 0 on success otherwise an error code <0
- */
-attribute_deprecated int av_metadata_set2(AVDictionary **pm, const char *key, const char *value, int flags);
-
-/**
- * This function is provided for compatibility reason and currently does nothing.
- */
-attribute_deprecated void av_metadata_conv(struct AVFormatContext *ctx, const AVMetadataConv *d_conv,
- const AVMetadataConv *s_conv);
-
-/**
- * Copy metadata from one AVDictionary struct into another.
- * @param dst pointer to a pointer to a AVDictionary struct. If *dst is NULL,
- * this function will allocate a struct for you and put it in *dst
- * @param src pointer to source AVDictionary struct
- * @param flags flags to use when setting metadata in *dst
- * @note metadata is read using the AV_DICT_IGNORE_SUFFIX flag
- */
-attribute_deprecated void av_metadata_copy(AVDictionary **dst, AVDictionary *src, int flags);
-
-/**
- * Free all the memory allocated for an AVDictionary struct.
- */
-attribute_deprecated void av_metadata_free(AVDictionary **m);
-/**
- * @}
- */
-#endif
-
-
/* packet functions */
@@ -345,25 +344,6 @@ typedef struct AVProbeData {
#define AVPROBE_SCORE_MAX 100 ///< maximum score, half of that is used for file-extension-based detection
#define AVPROBE_PADDING_SIZE 32 ///< extra allocated bytes at the end of the probe buffer
-typedef struct AVFormatParameters {
-#if FF_API_FORMAT_PARAMETERS
- attribute_deprecated AVRational time_base;
- attribute_deprecated int sample_rate;
- attribute_deprecated int channels;
- attribute_deprecated int width;
- attribute_deprecated int height;
- attribute_deprecated enum PixelFormat pix_fmt;
- attribute_deprecated int channel; /**< Used to select DV channel. */
- attribute_deprecated const char *standard; /**< deprecated, use demuxer-specific options instead. */
- attribute_deprecated unsigned int mpeg2ts_raw:1; /**< deprecated, use mpegtsraw demuxer */
- /**< deprecated, use mpegtsraw demuxer-specific options instead */
- attribute_deprecated unsigned int mpeg2ts_compute_pcr:1;
- attribute_deprecated unsigned int initial_pause:1; /**< Do not begin to play the stream
- immediately (RTSP only). */
- attribute_deprecated unsigned int prealloced_context:1;
-#endif
-} AVFormatParameters;
-
/// Demuxer will use avio_open, no opened file should be provided by the caller.
#define AVFMT_NOFILE 0x0001
#define AVFMT_NEEDNUMBER 0x0002 /**< Needs '%d' in filename. */
@@ -380,6 +360,10 @@ typedef struct AVFormatParameters {
#define AVFMT_NOBINSEARCH 0x2000 /**< Format does not allow to fallback to binary search via read_timestamp */
#define AVFMT_NOGENSEARCH 0x4000 /**< Format does not allow to fallback to generic search */
#define AVFMT_NO_BYTE_SEEK 0x8000 /**< Format does not allow seeking by bytes */
+#define AVFMT_ALLOW_FLUSH 0x10000 /**< Format allows flushing. If not set, the muxer will not receive a NULL packet in the write_packet function. */
+#define AVFMT_TS_NONSTRICT 0x20000 /**< Format does not require strictly
+ increasing timestamps, but they must
+ still be monotonic */
/**
* @addtogroup lavf_encoding
@@ -395,53 +379,62 @@ typedef struct AVOutputFormat {
const char *long_name;
const char *mime_type;
const char *extensions; /**< comma-separated filename extensions */
- /**
- * size of private data so that it can be allocated in the wrapper
- */
- int priv_data_size;
/* output support */
- enum CodecID audio_codec; /**< default audio codec */
- enum CodecID video_codec; /**< default video codec */
- int (*write_header)(struct AVFormatContext *);
- int (*write_packet)(struct AVFormatContext *, AVPacket *pkt);
- int (*write_trailer)(struct AVFormatContext *);
+ enum AVCodecID audio_codec; /**< default audio codec */
+ enum AVCodecID video_codec; /**< default video codec */
+ enum AVCodecID subtitle_codec; /**< default subtitle codec */
/**
* can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER, AVFMT_RAWPICTURE,
* AVFMT_GLOBALHEADER, AVFMT_NOTIMESTAMPS, AVFMT_VARIABLE_FPS,
- * AVFMT_NODIMENSIONS, AVFMT_NOSTREAMS
+ * AVFMT_NODIMENSIONS, AVFMT_NOSTREAMS, AVFMT_ALLOW_FLUSH,
+ * AVFMT_TS_NONSTRICT
*/
int flags;
- /**
- * Currently only used to set pixel format if not YUV420P.
- */
- int (*set_parameters)(struct AVFormatContext *, AVFormatParameters *);
- int (*interleave_packet)(struct AVFormatContext *, AVPacket *out,
- AVPacket *in, int flush);
/**
* List of supported codec_id-codec_tag pairs, ordered by "better
- * choice first". The arrays are all terminated by CODEC_ID_NONE.
+ * choice first". The arrays are all terminated by AV_CODEC_ID_NONE.
*/
const struct AVCodecTag * const *codec_tag;
- enum CodecID subtitle_codec; /**< default subtitle codec */
-
-#if FF_API_OLD_METADATA2
- const AVMetadataConv *metadata_conv;
-#endif
const AVClass *priv_class; ///< AVClass for the private context
+ /*****************************************************************
+ * No fields below this line are part of the public API. They
+ * may not be used outside of libavformat and can be changed and
+ * removed at will.
+ * New public fields should be added right above.
+ *****************************************************************
+ */
+ struct AVOutputFormat *next;
+ /**
+ * size of private data so that it can be allocated in the wrapper
+ */
+ int priv_data_size;
+
+ int (*write_header)(struct AVFormatContext *);
+ /**
+ * Write a packet. If AVFMT_ALLOW_FLUSH is set in flags,
+ * pkt can be NULL in order to flush data buffered in the muxer.
+ * When flushing, return 0 if there still is more data to flush,
+ * or 1 if everything was flushed and there is no more buffered
+ * data.
+ */
+ int (*write_packet)(struct AVFormatContext *, AVPacket *pkt);
+ int (*write_trailer)(struct AVFormatContext *);
+ /**
+ * Currently only used to set pixel format if not YUV420P.
+ */
+ int (*interleave_packet)(struct AVFormatContext *, AVPacket *out,
+ AVPacket *in, int flush);
/**
* Test if the given codec can be stored in this container.
*
* @return 1 if the codec is supported, 0 if it is not.
* A negative number if unknown.
*/
- int (*query_codec)(enum CodecID id, int std_compliance);
-
- /* private fields */
- struct AVOutputFormat *next;
+ int (*query_codec)(enum AVCodecID id, int std_compliance);
} AVOutputFormat;
/**
* @}
@@ -466,6 +459,38 @@ typedef struct AVInputFormat {
const char *long_name;
/**
+ * Can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER, AVFMT_SHOW_IDS,
+ * AVFMT_GENERIC_INDEX, AVFMT_TS_DISCONT, AVFMT_NOBINSEARCH,
+ * AVFMT_NOGENSEARCH, AVFMT_NO_BYTE_SEEK.
+ */
+ int flags;
+
+ /**
+ * If extensions are defined, then no probe is done. You should
+ * usually not use extension format guessing because it is not
+ * reliable enough
+ */
+ const char *extensions;
+
+ const struct AVCodecTag * const *codec_tag;
+
+ const AVClass *priv_class; ///< AVClass for the private context
+
+ /*****************************************************************
+ * No fields below this line are part of the public API. They
+ * may not be used outside of libavformat and can be changed and
+ * removed at will.
+ * New public fields should be added right above.
+ *****************************************************************
+ */
+ struct AVInputFormat *next;
+
+ /**
+ * Raw demuxers store their codec ID here.
+ */
+ int raw_codec_id;
+
+ /**
* Size of private data so that it can be allocated in the wrapper.
*/
int priv_data_size;
@@ -479,16 +504,14 @@ typedef struct AVInputFormat {
/**
* Read the format header and initialize the AVFormatContext
- * structure. Return 0 if OK. 'ap' if non-NULL contains
- * additional parameters. Only used in raw format right
- * now. 'av_new_stream' should be called to create new streams.
+ * structure. Return 0 if OK. Only used in raw format right
+ * now. 'avformat_new_stream' should be called to create new streams.
*/
- int (*read_header)(struct AVFormatContext *,
- AVFormatParameters *ap);
+ int (*read_header)(struct AVFormatContext *);
/**
* Read one packet and put it in 'pkt'. pts and flags are also
- * set. 'av_new_stream' can be called only if the flag
+ * set. 'avformat_new_stream' can be called only if the flag
* AVFMTCTX_NOHEADER is used and only in the calling thread (not in a
* background thread).
* @return 0 on success, < 0 on error.
@@ -522,25 +545,6 @@ typedef struct AVInputFormat {
int64_t *pos, int64_t pos_limit);
/**
- * Can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER, AVFMT_SHOW_IDS,
- * AVFMT_GENERIC_INDEX, AVFMT_TS_DISCONT, AVFMT_NOBINSEARCH,
- * AVFMT_NOGENSEARCH, AVFMT_NO_BYTE_SEEK.
- */
- int flags;
-
- /**
- * If extensions are defined, then no probe is done. You should
- * usually not use extension format guessing because it is not
- * reliable enough
- */
- const char *extensions;
-
- /**
- * General purpose read-only value that the format can use.
- */
- int value;
-
- /**
* Start/resume playing - only meaningful if using a network-based format
* (RTSP).
*/
@@ -552,8 +556,6 @@ typedef struct AVInputFormat {
*/
int (*read_pause)(struct AVFormatContext *);
- const struct AVCodecTag * const *codec_tag;
-
/**
* Seek to timestamp ts.
* Seeking will be done so that the point from which all active streams
@@ -561,15 +563,6 @@ typedef struct AVInputFormat {
* Active streams are all streams that have AVStream.discard < AVDISCARD_ALL.
*/
int (*read_seek2)(struct AVFormatContext *s, int stream_index, int64_t min_ts, int64_t ts, int64_t max_ts, int flags);
-
-#if FF_API_OLD_METADATA2
- const AVMetadataConv *metadata_conv;
-#endif
-
- const AVClass *priv_class; ///< AVClass for the private context
-
- /* private fields */
- struct AVInputFormat *next;
} AVInputFormat;
/**
* @}
@@ -608,6 +601,13 @@ typedef struct AVIndexEntry {
#define AV_DISPOSITION_HEARING_IMPAIRED 0x0080 /**< stream for hearing impaired audiences */
#define AV_DISPOSITION_VISUAL_IMPAIRED 0x0100 /**< stream for visual impaired audiences */
#define AV_DISPOSITION_CLEAN_EFFECTS 0x0200 /**< stream without voice */
+/**
+ * The stream is stored in the file as an attached picture/"cover art" (e.g.
+ * APIC frame in ID3v2). The single packet associated with it will be returned
+ * among the first few packets read from the file unless seeking takes place.
+ * It can also be accessed at any time in AVStream.attached_pic.
+ */
+#define AV_DISPOSITION_ATTACHED_PIC 0x0400
/**
* Stream structure.
@@ -618,8 +618,25 @@ typedef struct AVIndexEntry {
*/
typedef struct AVStream {
int index; /**< stream index in AVFormatContext */
- int id; /**< format-specific stream ID */
- AVCodecContext *codec; /**< codec context */
+ /**
+ * Format-specific stream ID.
+ * decoding: set by libavformat
+ * encoding: set by the user, replaced by libavformat if left unset
+ */
+ int id;
+ /**
+ * Codec context associated with this stream. Allocated and freed by
+ * libavformat.
+ *
+ * - decoding: The demuxer exports codec information stored in the headers
+ * here.
+ * - encoding: The user sets codec information, the muxer writes it to the
+ * output. Mandatory fields as specified in AVCodecContext
+ * documentation must be set even if this AVCodecContext is
+ * not actually used for encoding.
+ */
+ AVCodecContext *codec;
+#if FF_API_R_FRAME_RATE
/**
* Real base framerate of the stream.
* This is the lowest framerate with which all timestamps can be
@@ -629,12 +646,8 @@ typedef struct AVStream {
* approximately 3600 or 1800 timer ticks, then r_frame_rate will be 50/1.
*/
AVRational r_frame_rate;
- void *priv_data;
-
-#if FF_API_REORDER_PRIVATE
- /* internal data used in av_find_stream_info() */
- int64_t first_dts;
#endif
+ void *priv_data;
/**
* encoding: pts generation when outputting stream
@@ -643,29 +656,14 @@ typedef struct AVStream {
/**
* This is the fundamental unit of time (in seconds) in terms
- * of which frame timestamps are represented. For fixed-fps content,
- * time base should be 1/framerate and timestamp increments should be 1.
+ * of which frame timestamps are represented.
+ *
* decoding: set by libavformat
- * encoding: set by libavformat in av_write_header
+ * encoding: set by libavformat in avformat_write_header. The muxer may use the
+ * user-provided value of @ref AVCodecContext.time_base "codec->time_base"
+ * as a hint.
*/
AVRational time_base;
-#if FF_API_REORDER_PRIVATE
- int pts_wrap_bits; /**< number of bits in pts (used for wrapping control) */
-#endif
-#if FF_API_STREAM_COPY
- /* ffmpeg.c private use */
- attribute_deprecated int stream_copy; /**< If set, just copy stream. */
-#endif
- enum AVDiscard discard; ///< Selects which packets can be discarded at will and do not need to be demuxed.
-
-#if FF_API_AVSTREAM_QUALITY
- //FIXME move stuff to a flags field?
- /**
- * Quality, as it has been removed from AVCodecContext and put in AVVideoFrame.
- * MN: dunno if that is the right place for it
- */
- attribute_deprecated float quality;
-#endif
/**
* Decoding: pts of the first frame of the stream, in stream time base.
@@ -682,30 +680,11 @@ typedef struct AVStream {
*/
int64_t duration;
-#if FF_API_REORDER_PRIVATE
- /* av_read_frame() support */
- enum AVStreamParseType need_parsing;
- struct AVCodecParserContext *parser;
-
- int64_t cur_dts;
- int last_IP_duration;
- int64_t last_IP_pts;
- /* av_seek_frame() support */
- AVIndexEntry *index_entries; /**< Only used if the format does not
- support seeking natively. */
- int nb_index_entries;
- unsigned int index_entries_allocated_size;
-#endif
-
int64_t nb_frames; ///< number of frames in this stream if known or 0
int disposition; /**< AV_DISPOSITION_* bit field */
-#if FF_API_REORDER_PRIVATE
- AVProbeData probe_data;
-#define MAX_REORDER_DELAY 16
- int64_t pts_buffer[MAX_REORDER_DELAY+1];
-#endif
+ enum AVDiscard discard; ///< Selects which packets can be discarded at will and do not need to be demuxed.
/**
* sample aspect ratio (0 if unknown)
@@ -716,42 +695,19 @@ typedef struct AVStream {
AVDictionary *metadata;
-#if FF_API_REORDER_PRIVATE
- /* Intended mostly for av_read_frame() support. Not supposed to be used by */
- /* external applications; try to use something else if at all possible. */
- const uint8_t *cur_ptr;
- int cur_len;
- AVPacket cur_pkt;
-
- // Timestamp generation support:
- /**
- * Timestamp corresponding to the last dts sync point.
- *
- * Initialized when AVCodecParserContext.dts_sync_point >= 0 and
- * a DTS is received from the underlying container. Otherwise set to
- * AV_NOPTS_VALUE by default.
- */
- int64_t reference_dts;
-
/**
- * Number of packets to buffer for codec probing
- * NOT PART OF PUBLIC API
- */
-#define MAX_PROBE_PACKETS 2500
- int probe_packets;
-
- /**
- * last packet in packet_buffer for this stream when muxing.
- * Used internally, NOT PART OF PUBLIC API, do not read or
- * write from outside of libav*
+ * Average framerate
*/
- struct AVPacketList *last_in_packet_buffer;
-#endif
+ AVRational avg_frame_rate;
/**
- * Average framerate
+ * For streams with AV_DISPOSITION_ATTACHED_PIC disposition, this packet
+ * will contain the attached picture.
+ *
+ * decoding: set by libavformat, must not be modified by the caller.
+ * encoding: unused
*/
- AVRational avg_frame_rate;
+ AVPacket attached_pic;
/*****************************************************************
* All fields below this line are not part of the public API. They
@@ -762,26 +718,30 @@ typedef struct AVStream {
*/
/**
- * Number of frames that have been demuxed during av_find_stream_info()
- */
- int codec_info_nb_frames;
-
- /**
* Stream information used internally by av_find_stream_info()
*/
#define MAX_STD_TIMEBASES (60*12+5)
struct {
+#if FF_API_R_FRAME_RATE
int64_t last_dts;
int64_t duration_gcd;
int duration_count;
double duration_error[MAX_STD_TIMEBASES];
- int64_t codec_info_duration;
+#endif
int nb_decoded_frames;
+ int found_decoder;
+
+ /**
+ * Those are used for average framerate estimation.
+ */
+ int64_t fps_first_dts;
+ int fps_first_dts_idx;
+ int64_t fps_last_dts;
+ int fps_last_dts_idx;
+
} *info;
-#if !FF_API_REORDER_PRIVATE
- const uint8_t *cur_ptr;
- int cur_len;
- AVPacket cur_pkt;
+
+ int pts_wrap_bits; /**< number of bits in pts (used for wrapping control) */
// Timestamp generation support:
/**
@@ -794,8 +754,8 @@ typedef struct AVStream {
int64_t reference_dts;
int64_t first_dts;
int64_t cur_dts;
- int last_IP_duration;
int64_t last_IP_pts;
+ int last_IP_duration;
/**
* Number of packets to buffer for codec probing
@@ -804,23 +764,26 @@ typedef struct AVStream {
int probe_packets;
/**
+ * Number of frames that have been demuxed during av_find_stream_info()
+ */
+ int codec_info_nb_frames;
+
+ /* av_read_frame() support */
+ enum AVStreamParseType need_parsing;
+ struct AVCodecParserContext *parser;
+
+ /**
* last packet in packet_buffer for this stream when muxing.
*/
struct AVPacketList *last_in_packet_buffer;
AVProbeData probe_data;
#define MAX_REORDER_DELAY 16
int64_t pts_buffer[MAX_REORDER_DELAY+1];
- /* av_read_frame() support */
- enum AVStreamParseType need_parsing;
- struct AVCodecParserContext *parser;
AVIndexEntry *index_entries; /**< Only used if the format does not
support seeking natively. */
int nb_index_entries;
unsigned int index_entries_allocated_size;
-
- int pts_wrap_bits; /**< number of bits in pts (used for wrapping control) */
-#endif
} AVStream;
#define AV_PROGRAM_RUNNING 1
@@ -880,7 +843,7 @@ typedef struct AVFormatContext {
*/
void *priv_data;
- /*
+ /**
* I/O context.
*
* decoding: either set by the user before avformat_open_input() (then
@@ -893,6 +856,9 @@ typedef struct AVFormatContext {
*/
AVIOContext *pb;
+ /* stream info */
+ int ctx_flags; /**< Format-specific flags, see AVFMTCTX_xx */
+
/**
* A list of all streams in the file. New streams are created with
* avformat_new_stream().
@@ -906,24 +872,6 @@ typedef struct AVFormatContext {
AVStream **streams;
char filename[1024]; /**< input or output filename */
- /* stream info */
-#if FF_API_TIMESTAMP
- /**
- * @deprecated use 'creation_time' metadata tag instead
- */
- attribute_deprecated int64_t timestamp;
-#endif
-
- int ctx_flags; /**< Format-specific flags, see AVFMTCTX_xx */
-#if FF_API_REORDER_PRIVATE
- /* private data for pts handling (do not modify directly). */
- /**
- * This buffer is only needed when packets were already buffered but
- * not decoded, for example to get the codec parameters in MPEG
- * streams.
- */
- struct AVPacketList *packet_buffer;
-#endif
/**
* Decoding: position of the first frame of the component, in
@@ -940,13 +888,6 @@ typedef struct AVFormatContext {
*/
int64_t duration;
-#if FF_API_FILESIZE
- /**
- * decoding: total file size, 0 if unknown
- */
- attribute_deprecated int64_t file_size;
-#endif
-
/**
* Decoding: total stream bitrate in bit/s, 0 if not
* available. Never set it directly if the file_size and the
@@ -954,37 +895,9 @@ typedef struct AVFormatContext {
*/
int bit_rate;
-#if FF_API_REORDER_PRIVATE
- /* av_read_frame() support */
- AVStream *cur_st;
-
- /* av_seek_frame() support */
- int64_t data_offset; /**< offset of the first packet */
-#endif
-
-#if FF_API_MUXRATE
- /**
- * use mpeg muxer private options instead
- */
- attribute_deprecated int mux_rate;
-#endif
unsigned int packet_size;
-#if FF_API_PRELOAD
- attribute_deprecated int preload;
-#endif
int max_delay;
-#if FF_API_LOOP_OUTPUT
-#define AVFMT_NOOUTPUTLOOP -1
-#define AVFMT_INFINITEOUTPUTLOOP 0
- /**
- * number of times to loop output in formats that support it
- *
- * @deprecated use the 'loop' private option in the gif muxer.
- */
- attribute_deprecated int loop_output;
-#endif
-
int flags;
#define AVFMT_FLAG_GENPTS 0x0001 ///< Generate missing pts even if it requires parsing future frames.
#define AVFMT_FLAG_IGNIDX 0x0002 ///< Ignore index.
@@ -992,19 +905,10 @@ typedef struct AVFormatContext {
#define AVFMT_FLAG_IGNDTS 0x0008 ///< Ignore DTS on frames that contain both DTS & PTS
#define AVFMT_FLAG_NOFILLIN 0x0010 ///< Do not infer any values from other values, just return what is stored in the container
#define AVFMT_FLAG_NOPARSE 0x0020 ///< Do not use AVParsers, you also must set AVFMT_FLAG_NOFILLIN as the fillin code works on frames and no parsing -> no frames. Also seeking to frames can not work if parsing to find frame boundaries has been disabled
-#if FF_API_FLAG_RTP_HINT
-#define AVFMT_FLAG_RTP_HINT 0x0040 ///< Deprecated, use the -movflags rtphint muxer specific AVOption instead
-#endif
+#define AVFMT_FLAG_NOBUFFER 0x0040 ///< Do not buffer frames when possible
#define AVFMT_FLAG_CUSTOM_IO 0x0080 ///< The caller has supplied a custom AVIOContext, don't avio_close() it.
#define AVFMT_FLAG_DISCARD_CORRUPT 0x0100 ///< Discard frames marked corrupted
-#if FF_API_LOOP_INPUT
- /**
- * @deprecated, use the 'loop' img2 demuxer private option.
- */
- attribute_deprecated int loop_input;
-#endif
-
/**
* decoding: size of data to probe; encoding: unused.
*/
@@ -1026,19 +930,19 @@ typedef struct AVFormatContext {
* Forced video codec_id.
* Demuxing: Set by user.
*/
- enum CodecID video_codec_id;
+ enum AVCodecID video_codec_id;
/**
* Forced audio codec_id.
* Demuxing: Set by user.
*/
- enum CodecID audio_codec_id;
+ enum AVCodecID audio_codec_id;
/**
* Forced subtitle codec_id.
* Demuxing: Set by user.
*/
- enum CodecID subtitle_codec_id;
+ enum AVCodecID subtitle_codec_id;
/**
* Maximum amount of memory in bytes to use for the index of each stream.
@@ -1061,36 +965,8 @@ typedef struct AVFormatContext {
unsigned int nb_chapters;
AVChapter **chapters;
- /**
- * Flags to enable debugging.
- */
- int debug;
-#define FF_FDEBUG_TS 0x0001
-
-#if FF_API_REORDER_PRIVATE
- /**
- * Raw packets from the demuxer, prior to parsing and decoding.
- * This buffer is used for buffering packets until the codec can
- * be identified, as parsing cannot be done without knowing the
- * codec.
- */
- struct AVPacketList *raw_packet_buffer;
- struct AVPacketList *raw_packet_buffer_end;
-
- struct AVPacketList *packet_buffer_end;
-#endif
-
AVDictionary *metadata;
-#if FF_API_REORDER_PRIVATE
- /**
- * Remaining size available for raw_packet_buffer, in bytes.
- * NOT PART OF PUBLIC API
- */
-#define RAW_PACKET_BUFFER_SIZE 2500000
- int raw_packet_buffer_remaining_size;
-#endif
-
/**
* Start time of the stream in real world time, in microseconds
* since the unix epoch (00:00 1st January 1970). That is, pts=0
@@ -1124,6 +1000,11 @@ typedef struct AVFormatContext {
*/
AVIOInterruptCB interrupt_callback;
+ /**
+ * Flags to enable debugging.
+ */
+ int debug;
+#define FF_FDEBUG_TS 0x0001
/*****************************************************************
* All fields below this line are not part of the public API. They
* may not be used outside of libavformat and can be changed and
@@ -1131,7 +1012,18 @@ typedef struct AVFormatContext {
* New public fields should be added right above.
*****************************************************************
*/
-#if !FF_API_REORDER_PRIVATE
+
+ /**
+ * This buffer is only needed when packets were already buffered but
+ * not decoded, for example to get the codec parameters in MPEG
+ * streams.
+ */
+ struct AVPacketList *packet_buffer;
+ struct AVPacketList *packet_buffer_end;
+
+ /* av_seek_frame() support */
+ int64_t data_offset; /**< offset of the first packet */
+
/**
* Raw packets from the demuxer, prior to parsing and decoding.
* This buffer is used for buffering packets until the codec can
@@ -1141,25 +1033,15 @@ typedef struct AVFormatContext {
struct AVPacketList *raw_packet_buffer;
struct AVPacketList *raw_packet_buffer_end;
/**
+ * Packets split by the parser get queued here.
+ */
+ struct AVPacketList *parse_queue;
+ struct AVPacketList *parse_queue_end;
+ /**
* Remaining size available for raw_packet_buffer, in bytes.
*/
#define RAW_PACKET_BUFFER_SIZE 2500000
int raw_packet_buffer_remaining_size;
-
- /**
- * This buffer is only needed when packets were already buffered but
- * not decoded, for example to get the codec parameters in MPEG
- * streams.
- */
- struct AVPacketList *packet_buffer;
- struct AVPacketList *packet_buffer_end;
-
- /* av_read_frame() support */
- AVStream *cur_st;
-
- /* av_seek_frame() support */
- int64_t data_offset; /**< offset of the first packet */
-#endif
} AVFormatContext;
typedef struct AVPacketList {
@@ -1280,17 +1162,6 @@ AVProgram *av_new_program(AVFormatContext *s, int id);
*/
-#if FF_API_GUESS_IMG2_CODEC
-attribute_deprecated enum CodecID av_guess_image2_codec(const char *filename);
-#endif
-
-#if FF_API_PKT_DUMP
-attribute_deprecated void av_pkt_dump(FILE *f, AVPacket *pkt, int dump_payload);
-attribute_deprecated void av_pkt_dump_log(void *avcl, int level, AVPacket *pkt,
- int dump_payload);
-#endif
-
-
/**
* @addtogroup lavf_decoding
* @{
@@ -1341,36 +1212,6 @@ int av_probe_input_buffer(AVIOContext *pb, AVInputFormat **fmt,
const char *filename, void *logctx,
unsigned int offset, unsigned int max_probe_size);
-#if FF_API_FORMAT_PARAMETERS
-/**
- * Allocate all the structures needed to read an input stream.
- * This does not open the needed codecs for decoding the stream[s].
- * @deprecated use avformat_open_input instead.
- */
-attribute_deprecated int av_open_input_stream(AVFormatContext **ic_ptr,
- AVIOContext *pb, const char *filename,
- AVInputFormat *fmt, AVFormatParameters *ap);
-
-/**
- * Open a media file as input. The codecs are not opened. Only the file
- * header (if present) is read.
- *
- * @param ic_ptr The opened media file handle is put here.
- * @param filename filename to open
- * @param fmt If non-NULL, force the file format to use.
- * @param buf_size optional buffer size (zero if default is OK)
- * @param ap Additional parameters needed when opening the file
- * (NULL if default).
- * @return 0 if OK, AVERROR_xxx otherwise
- *
- * @deprecated use avformat_open_input instead.
- */
-attribute_deprecated int av_open_input_file(AVFormatContext **ic_ptr, const char *filename,
- AVInputFormat *fmt,
- int buf_size,
- AVFormatParameters *ap);
-#endif
-
/**
* Open an input stream and read the header. The codecs are not opened.
* The stream must be closed with av_close_input_file().
@@ -1392,26 +1233,6 @@ attribute_deprecated int av_open_input_file(AVFormatContext **ic_ptr, const char
*/
int avformat_open_input(AVFormatContext **ps, const char *filename, AVInputFormat *fmt, AVDictionary **options);
-#if FF_API_FORMAT_PARAMETERS
-/**
- * Read packets of a media file to get stream information. This
- * is useful for file formats with no headers such as MPEG. This
- * function also computes the real framerate in case of MPEG-2 repeat
- * frame mode.
- * The logical file position is not changed by this function;
- * examined packets may be buffered for later processing.
- *
- * @param ic media file handle
- * @return >=0 if OK, AVERROR_xxx on error
- * @todo Let the user decide somehow what information is needed so that
- * we do not waste time getting stuff the user does not need.
- *
- * @deprecated use avformat_find_stream_info.
- */
-attribute_deprecated
-int av_find_stream_info(AVFormatContext *ic);
-#endif
-
/**
* Read packets of a media file to get stream information. This
* is useful for file formats with no headers such as MPEG. This
@@ -1466,7 +1287,11 @@ int av_find_best_stream(AVFormatContext *ic,
AVCodec **decoder_ret,
int flags);
+#if FF_API_READ_PACKET
/**
+ * @deprecated use AVFMT_FLAG_NOFILLIN | AVFMT_FLAG_NOPARSE to read raw
+ * unprocessed packets
+ *
* Read a transport packet from a media file.
*
* This function is obsolete and should never be used.
@@ -1476,7 +1301,9 @@ int av_find_best_stream(AVFormatContext *ic,
* @param pkt is filled
* @return 0 if OK, AVERROR_xxx on error
*/
+attribute_deprecated
int av_read_packet(AVFormatContext *s, AVPacket *pkt);
+#endif
/**
* Return the next frame of a stream.
@@ -1486,13 +1313,13 @@ int av_read_packet(AVFormatContext *s, AVPacket *pkt);
* omit invalid data between valid frames so as to give the decoder the maximum
* information possible for decoding.
*
- * The returned packet is valid
- * until the next av_read_frame() or until av_close_input_file() and
- * must be freed with av_free_packet. For video, the packet contains
- * exactly one frame. For audio, it contains an integer number of
- * frames if each frame has a known fixed size (e.g. PCM or ADPCM
- * data). If the audio frames have a variable size (e.g. MPEG audio),
- * then it contains one frame.
+ * If pkt->destruct is NULL, then the packet is valid until the next
+ * av_read_frame() or until av_close_input_file(). Otherwise the packet is valid
+ * indefinitely. In both cases the packet must be freed with
+ * av_free_packet when it is no longer needed. For video, the packet contains
+ * exactly one frame. For audio, it contains an integer number of frames if each
+ * frame has a known fixed size (e.g. PCM or ADPCM data). If the audio frames
+ * have a variable size (e.g. MPEG audio), then it contains one frame.
*
* pkt->pts, pkt->dts and pkt->duration are always set to correct
* values in AVStream.time_base units (and guessed if the format cannot
@@ -1559,16 +1386,6 @@ int av_read_play(AVFormatContext *s);
*/
int av_read_pause(AVFormatContext *s);
-#if FF_API_FORMAT_PARAMETERS
-/**
- * Free a AVFormatContext allocated by av_open_input_stream.
- * @param s context to free
- * @deprecated use av_close_input_file()
- */
-attribute_deprecated
-void av_close_input_stream(AVFormatContext *s);
-#endif
-
#if FF_API_CLOSE_INPUT_FILE
/**
* @deprecated use avformat_close_input()
@@ -1589,57 +1406,11 @@ void avformat_close_input(AVFormatContext **s);
* @}
*/
-#if FF_API_NEW_STREAM
-/**
- * Add a new stream to a media file.
- *
- * Can only be called in the read_header() function. If the flag
- * AVFMTCTX_NOHEADER is in the format context, then new streams
- * can be added in read_packet too.
- *
- * @param s media file handle
- * @param id file-format-dependent stream ID
- */
-attribute_deprecated
-AVStream *av_new_stream(AVFormatContext *s, int id);
-#endif
-
-#if FF_API_SET_PTS_INFO
-/**
- * @deprecated this function is not supposed to be called outside of lavf
- */
-attribute_deprecated
-void av_set_pts_info(AVStream *s, int pts_wrap_bits,
- unsigned int pts_num, unsigned int pts_den);
-#endif
-
#define AVSEEK_FLAG_BACKWARD 1 ///< seek backward
#define AVSEEK_FLAG_BYTE 2 ///< seeking based on position in bytes
#define AVSEEK_FLAG_ANY 4 ///< seek to any frame, even non-keyframes
#define AVSEEK_FLAG_FRAME 8 ///< seeking based on frame number
-#if FF_API_SEEK_PUBLIC
-attribute_deprecated
-int av_seek_frame_binary(AVFormatContext *s, int stream_index,
- int64_t target_ts, int flags);
-attribute_deprecated
-void av_update_cur_dts(AVFormatContext *s, AVStream *ref_st, int64_t timestamp);
-attribute_deprecated
-int64_t av_gen_search(AVFormatContext *s, int stream_index,
- int64_t target_ts, int64_t pos_min,
- int64_t pos_max, int64_t pos_limit,
- int64_t ts_min, int64_t ts_max,
- int flags, int64_t *ts_ret,
- int64_t (*read_timestamp)(struct AVFormatContext *, int , int64_t *, int64_t ));
-#endif
-
-#if FF_API_FORMAT_PARAMETERS
-/**
- * @deprecated pass the options to avformat_write_header directly.
- */
-attribute_deprecated int av_set_parameters(AVFormatContext *s, AVFormatParameters *ap);
-#endif
-
/**
* @addtogroup lavf_encoding
* @{
@@ -1661,21 +1432,6 @@ attribute_deprecated int av_set_parameters(AVFormatContext *s, AVFormatParameter
*/
int avformat_write_header(AVFormatContext *s, AVDictionary **options);
-#if FF_API_FORMAT_PARAMETERS
-/**
- * Allocate the stream private data and write the stream header to an
- * output media file.
- * @note: this sets stream time-bases, if possible to stream->codec->time_base
- * but for some formats it might also be some other time base
- *
- * @param s media file handle
- * @return 0 if OK, AVERROR_xxx on error
- *
- * @deprecated use avformat_write_header.
- */
-attribute_deprecated int av_write_header(AVFormatContext *s);
-#endif
-
/**
* Write a packet to an output media file.
*
@@ -1685,8 +1441,12 @@ attribute_deprecated int av_write_header(AVFormatContext *s);
*
* @param s media file handle
* @param pkt The packet, which contains the stream_index, buf/buf_size,
- dts/pts, ...
- * @return < 0 on error, = 0 if OK, 1 if end of stream wanted
+ * dts/pts, ...
+ * This can be NULL (at any time, not just at the end), in
+ * order to immediately flush data buffered within the muxer,
+ * for muxers that buffer up data internally before writing it
+ * to the output.
+ * @return < 0 on error, = 0 if OK, 1 if flushed and there is no more data to flush
*/
int av_write_frame(AVFormatContext *s, AVPacket *pkt);
@@ -1705,6 +1465,8 @@ int av_write_frame(AVFormatContext *s, AVPacket *pkt);
* ownership of the data and will free it when it sees fit using the packet's
* @ref AVPacket.destruct "destruct" field. The caller must not access the data
* after this function returns, as it may already be freed.
+ * This can be NULL (at any time, not just at the end), to flush the
+ * interleaving queues.
* Packet's @ref AVPacket.stream_index "stream_index" field must be set to the
* index of the corresponding stream in @ref AVFormatContext.streams
* "s.streams".
@@ -1716,29 +1478,21 @@ int av_write_frame(AVFormatContext *s, AVPacket *pkt);
*/
int av_interleaved_write_frame(AVFormatContext *s, AVPacket *pkt);
+#if FF_API_INTERLEAVE_PACKET
/**
- * Interleave a packet per dts in an output media file.
- *
- * Packets with pkt->destruct == av_destruct_packet will be freed inside this
- * function, so they cannot be used after it. Note that calling av_free_packet()
- * on them is still safe.
- *
- * @param s media file handle
- * @param out the interleaved packet will be output here
- * @param pkt the input packet
- * @param flush 1 if no further packets are available as input and all
- * remaining packets should be output
- * @return 1 if a packet was output, 0 if no packet could be output,
- * < 0 if an error occurred
+ * @deprecated this function was never meant to be called by the user
+ * programs.
*/
+attribute_deprecated
int av_interleave_packet_per_dts(AVFormatContext *s, AVPacket *out,
AVPacket *pkt, int flush);
+#endif
/**
* Write the stream trailer to an output media file and free the
* file private data.
*
- * May only be called after a successful call to av_write_header.
+ * May only be called after a successful call to avformat_write_header.
*
* @param s media file handle
* @return 0 if OK, AVERROR_xxx on error
@@ -1764,7 +1518,7 @@ AVOutputFormat *av_guess_format(const char *short_name,
/**
* Guess the codec ID based upon muxer and filename.
*/
-enum CodecID av_guess_codec(AVOutputFormat *fmt, const char *short_name,
+enum AVCodecID av_guess_codec(AVOutputFormat *fmt, const char *short_name,
const char *filename, const char *mime_type,
enum AVMediaType type);
@@ -1778,7 +1532,7 @@ enum CodecID av_guess_codec(AVOutputFormat *fmt, const char *short_name,
* @ingroup libavf
* @{
*
- * Miscelaneous utility functions related to both muxing and demuxing
+ * Miscellaneous utility functions related to both muxing and demuxing
* (or neither).
*/
@@ -1791,7 +1545,7 @@ enum CodecID av_guess_codec(AVOutputFormat *fmt, const char *short_name,
*
* @see av_hex_dump_log, av_pkt_dump2, av_pkt_dump_log2
*/
-void av_hex_dump(FILE *f, uint8_t *buf, int size);
+void av_hex_dump(FILE *f, const uint8_t *buf, int size);
/**
* Send a nice hexadecimal dump of a buffer to the log.
@@ -1805,7 +1559,7 @@ void av_hex_dump(FILE *f, uint8_t *buf, int size);
*
* @see av_hex_dump, av_pkt_dump2, av_pkt_dump_log2
*/
-void av_hex_dump_log(void *avcl, int level, uint8_t *buf, int size);
+void av_hex_dump_log(void *avcl, int level, const uint8_t *buf, int size);
/**
* Send a nice dump of a packet to the specified file stream.
@@ -1833,13 +1587,13 @@ void av_pkt_dump_log2(void *avcl, int level, AVPacket *pkt, int dump_payload,
AVStream *st);
/**
- * Get the CodecID for the given codec tag tag.
- * If no codec id is found returns CODEC_ID_NONE.
+ * Get the AVCodecID for the given codec tag tag.
+ * If no codec id is found returns AV_CODEC_ID_NONE.
*
* @param tags list of supported codec_id-codec_tag pairs, as stored
* in AVInputFormat.codec_tag and AVOutputFormat.codec_tag
*/
-enum CodecID av_codec_get_id(const struct AVCodecTag * const *tags, unsigned int tag);
+enum AVCodecID av_codec_get_id(const struct AVCodecTag * const *tags, unsigned int tag);
/**
* Get the codec tag for the given codec id id.
@@ -1848,7 +1602,7 @@ enum CodecID av_codec_get_id(const struct AVCodecTag * const *tags, unsigned int
* @param tags list of supported codec_id-codec_tag pairs, as stored
* in AVInputFormat.codec_tag and AVOutputFormat.codec_tag
*/
-unsigned int av_codec_get_tag(const struct AVCodecTag * const *tags, enum CodecID id);
+unsigned int av_codec_get_tag(const struct AVCodecTag * const *tags, enum AVCodecID id);
int av_find_default_stream_index(AVFormatContext *s);
@@ -1898,42 +1652,12 @@ void av_url_split(char *proto, int proto_size,
char *path, int path_size,
const char *url);
-#if FF_API_DUMP_FORMAT
-attribute_deprecated void dump_format(AVFormatContext *ic,
- int index,
- const char *url,
- int is_output);
-#endif
void av_dump_format(AVFormatContext *ic,
int index,
const char *url,
int is_output);
-#if FF_API_PARSE_DATE
-/**
- * Parse datestr and return a corresponding number of microseconds.
- *
- * @param datestr String representing a date or a duration.
- * See av_parse_time() for the syntax of the provided string.
- * @deprecated in favor of av_parse_time()
- */
-attribute_deprecated
-int64_t parse_date(const char *datestr, int duration);
-#endif
-
-/**
- * Get the current time in microseconds.
- */
-int64_t av_gettime(void);
-
-#if FF_API_FIND_INFO_TAG
-/**
- * @deprecated use av_find_info_tag in libavutil instead.
- */
-attribute_deprecated int find_info_tag(char *arg, int arg_size, const char *tag1, const char *info);
-#endif
-
/**
* Return in 'buf' the path with '%d' replaced by a number.
*
@@ -1960,6 +1684,9 @@ int av_filename_number_test(const char *filename);
/**
* Generate an SDP for an RTP session.
*
+ * Note, this overwrites the id values of AVStreams in the muxer contexts
+ * for getting unique dynamic payload types.
+ *
* @param ac array of AVFormatContexts describing the RTP streams. If the
* array is composed by only one context, such context can contain
* multiple AVStreams (one AVStream per RTP stream). Otherwise,
@@ -1973,10 +1700,6 @@ int av_filename_number_test(const char *filename);
*/
int av_sdp_create(AVFormatContext *ac[], int n_files, char *buf, int size);
-#if FF_API_SDP_CREATE
-attribute_deprecated int avf_sdp_create(AVFormatContext *ac[], int n_files, char *buff, int size);
-#endif
-
/**
* Return a positive value if the given filename has one of the given
* extensions, 0 otherwise.
@@ -1993,26 +1716,26 @@ int av_match_ext(const char *filename, const char *extensions);
* @return 1 if codec with ID codec_id can be stored in ofmt, 0 if it cannot.
* A negative number if this information is not available.
*/
-int avformat_query_codec(AVOutputFormat *ofmt, enum CodecID codec_id, int std_compliance);
+int avformat_query_codec(AVOutputFormat *ofmt, enum AVCodecID codec_id, int std_compliance);
/**
* @defgroup riff_fourcc RIFF FourCCs
* @{
- * Get the tables mapping RIFF FourCCs to libavcodec CodecIDs. The tables are
+ * Get the tables mapping RIFF FourCCs to libavcodec AVCodecIDs. The tables are
* meant to be passed to av_codec_get_id()/av_codec_get_tag() as in the
* following code:
* @code
* uint32_t tag = MKTAG('H', '2', '6', '4');
* const struct AVCodecTag *table[] = { avformat_get_riff_video_tags(), 0 };
- * enum CodecID id = av_codec_get_id(table, tag);
+ * enum AVCodecID id = av_codec_get_id(table, tag);
* @endcode
*/
/**
- * @return the table mapping RIFF FourCCs for video to libavcodec CodecID.
+ * @return the table mapping RIFF FourCCs for video to libavcodec AVCodecID.
*/
const struct AVCodecTag *avformat_get_riff_video_tags(void);
/**
- * @return the table mapping RIFF FourCCs for audio to CodecID.
+ * @return the table mapping RIFF FourCCs for audio to AVCodecID.
*/
const struct AVCodecTag *avformat_get_riff_audio_tags(void);
/**
diff --git a/gst-libs/ext/libav/libavformat/avidec.c b/gst-libs/ext/libav/libavformat/avidec.c
index af6ee8e..a3af5cf 100644
--- a/gst-libs/ext/libav/libavformat/avidec.c
+++ b/gst-libs/ext/libav/libavformat/avidec.c
@@ -39,8 +39,8 @@ typedef struct AVIStream {
int remaining;
int packet_size;
- int scale;
- int rate;
+ uint32_t scale;
+ uint32_t rate;
int sample_size; /* size of one sample (or packet) (in the rate/scale sense) in bytes */
int64_t cum_len; /* temporary storage (used during seek) */
@@ -325,7 +325,7 @@ static void avi_read_nikon(AVFormatContext *s, uint64_t end)
}
}
-static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
+static int avi_read_header(AVFormatContext *s)
{
AVIContext *avi = s->priv_data;
AVIOContext *pb = s->pb;
@@ -513,7 +513,8 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
avio_rl32(pb); /* quality */
ast->sample_size = avio_rl32(pb); /* sample ssize */
ast->cum_len *= FFMAX(1, ast->sample_size);
-// av_log(s, AV_LOG_DEBUG, "%d %d %d %d\n", ast->rate, ast->scale, ast->start, ast->sample_size);
+ av_dlog(s, "%"PRIu32" %"PRIu32" %d\n",
+ ast->rate, ast->scale, ast->sample_size);
switch(tag1) {
case MKTAG('v', 'i', 'd', 's'):
@@ -554,7 +555,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
st->codec->width=avih_width;
st->codec->height=avih_height;
st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
- st->codec->codec_id = CODEC_ID_AMV;
+ st->codec->codec_id = AV_CODEC_ID_AMV;
avio_skip(pb, size);
break;
}
@@ -563,7 +564,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
if (tag1 == MKTAG('D', 'X', 'S', 'B') || tag1 == MKTAG('D','X','S','A')) {
st->codec->codec_type = AVMEDIA_TYPE_SUBTITLE;
st->codec->codec_tag = tag1;
- st->codec->codec_id = CODEC_ID_XSUB;
+ st->codec->codec_id = AV_CODEC_ID_XSUB;
break;
}
@@ -608,7 +609,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
if(tag1 == MKTAG('A', 'V', 'R', 'n') &&
st->codec->extradata_size >= 31 &&
!memcmp(&st->codec->extradata[28], "1:1", 3))
- st->codec->codec_id = CODEC_ID_RAWVIDEO;
+ st->codec->codec_id = AV_CODEC_ID_RAWVIDEO;
if(st->codec->codec_tag==0 && st->codec->height > 0 && st->codec->extradata_size < 1U<<30){
st->codec->extradata_size+= 9;
@@ -637,26 +638,26 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
/* ADTS header is in extradata, AAC without header must be
* stored as exact frames. Parser not needed and it will
* fail. */
- if (st->codec->codec_id == CODEC_ID_AAC && st->codec->extradata_size)
+ if (st->codec->codec_id == AV_CODEC_ID_AAC && st->codec->extradata_size)
st->need_parsing = AVSTREAM_PARSE_NONE;
/* AVI files with Xan DPCM audio (wrongly) declare PCM
* audio in the header but have Axan as stream_code_tag. */
if (st->codec->stream_codec_tag == AV_RL32("Axan")){
- st->codec->codec_id = CODEC_ID_XAN_DPCM;
+ st->codec->codec_id = AV_CODEC_ID_XAN_DPCM;
st->codec->codec_tag = 0;
}
if (amv_file_format){
- st->codec->codec_id = CODEC_ID_ADPCM_IMA_AMV;
+ st->codec->codec_id = AV_CODEC_ID_ADPCM_IMA_AMV;
ast->dshow_block_align = 0;
}
break;
case AVMEDIA_TYPE_SUBTITLE:
st->codec->codec_type = AVMEDIA_TYPE_SUBTITLE;
- st->codec->codec_id = CODEC_ID_PROBE;
+ st->codec->codec_id = AV_CODEC_ID_PROBE;
break;
default:
st->codec->codec_type = AVMEDIA_TYPE_DATA;
- st->codec->codec_id= CODEC_ID_NONE;
+ st->codec->codec_id= AV_CODEC_ID_NONE;
st->codec->codec_tag= 0;
avio_skip(pb, size);
break;
@@ -690,7 +691,9 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
if(active_aspect.num && active_aspect.den && active.num && active.den){
st->sample_aspect_ratio= av_div_q(active_aspect, active);
-//av_log(s, AV_LOG_ERROR, "vprp %d/%d %d/%d\n", active_aspect.num, active_aspect.den, active.num, active.den);
+ av_dlog(s, "vprp %d/%d %d/%d\n",
+ active_aspect.num, active_aspect.den,
+ active.num, active.den);
}
size -= 9*4;
}
@@ -782,7 +785,7 @@ static int read_gab2_sub(AVStream *st, AVPacket *pkt) {
ast->sub_ctx->pb = pb;
if (!avformat_open_input(&ast->sub_ctx, "", sub_demuxer, NULL)) {
- av_read_packet(ast->sub_ctx, &ast->sub_pkt);
+ ff_read_packet(ast->sub_ctx, &ast->sub_pkt);
*st->codec = *ast->sub_ctx->streams[0]->codec;
ast->sub_ctx->streams[0]->codec->extradata = NULL;
time_base = ast->sub_ctx->streams[0]->time_base;
@@ -824,7 +827,7 @@ static AVStream *get_subtitle_pkt(AVFormatContext *s, AVStream *next_st,
ast = sub_st->priv_data;
*pkt = ast->sub_pkt;
pkt->stream_index = sub_st->index;
- if (av_read_packet(ast->sub_ctx, &ast->sub_pkt) < 0)
+ if (ff_read_packet(ast->sub_ctx, &ast->sub_pkt) < 0)
ast->sub_pkt.data = NULL;
}
return sub_st;
@@ -860,7 +863,8 @@ start_sync:
size= d[4] + (d[5]<<8) + (d[6]<<16) + (d[7]<<24);
n= get_stream_idx(d+2);
-//av_log(s, AV_LOG_DEBUG, "%X %X %X %X %X %X %X %X %"PRId64" %d %d\n", d[0], d[1], d[2], d[3], d[4], d[5], d[6], d[7], i, size, n);
+ av_dlog(s, "%X %X %X %X %X %X %X %X %"PRId64" %u %d\n",
+ d[0], d[1], d[2], d[3], d[4], d[5], d[6], d[7], i, size, n);
if(i + (uint64_t)size > avi->fsize || d[0] > 127)
continue;
@@ -870,7 +874,6 @@ start_sync:
||(d[0] == 'J' && d[1] == 'U' && d[2] == 'N' && d[3] == 'K')
||(d[0] == 'i' && d[1] == 'd' && d[2] == 'x' && d[3] == '1')){
avio_skip(pb, size);
-//av_log(s, AV_LOG_DEBUG, "SKIP\n");
goto start_sync;
}
@@ -944,7 +947,6 @@ start_sync:
if (exit_early)
return 0;
-//av_log(s, AV_LOG_DEBUG, "OK\n");
if(d[2]*256+d[3] == ast->prefix)
ast->prefix_count++;
else{
@@ -1005,7 +1007,8 @@ static int avi_read_packet(AVFormatContext *s, AVPacket *pkt)
ts = av_rescale_q(ts, st->time_base, (AVRational){FFMAX(1, ast->sample_size), AV_TIME_BASE});
-// av_log(s, AV_LOG_DEBUG, "%"PRId64" %d/%d %"PRId64"\n", ts, st->time_base.num, st->time_base.den, ast->frame_offset);
+ av_dlog(s, "%"PRId64" %d/%d %"PRId64"\n", ts,
+ st->time_base.num, st->time_base.den, ast->frame_offset);
if(ts < best_ts){
best_ts= ts;
best_st= st;
@@ -1025,12 +1028,10 @@ static int avi_read_packet(AVFormatContext *s, AVPacket *pkt)
best_ast->frame_offset= best_st->index_entries[i].timestamp;
}
-// av_log(s, AV_LOG_DEBUG, "%d\n", i);
if(i>=0){
int64_t pos= best_st->index_entries[i].pos;
pos += best_ast->packet_size - best_ast->remaining;
avio_seek(s->pb, pos + 8, SEEK_SET);
-// av_log(s, AV_LOG_DEBUG, "pos=%"PRId64"\n", pos);
assert(best_ast->remaining <= best_ast->packet_size);
@@ -1096,7 +1097,9 @@ resync:
// pkt->dts += ast->start;
if(ast->sample_size)
pkt->dts /= ast->sample_size;
-//av_log(s, AV_LOG_DEBUG, "dts:%"PRId64" offset:%"PRId64" %d/%d smpl_siz:%d base:%d st:%d size:%d\n", pkt->dts, ast->frame_offset, ast->scale, ast->rate, ast->sample_size, AV_TIME_BASE, avi->stream_index, size);
+ av_dlog(s, "dts:%"PRId64" offset:%"PRId64" %d/%d smpl_siz:%d base:%d st:%d size:%d\n",
+ pkt->dts, ast->frame_offset, ast->scale, ast->rate,
+ ast->sample_size, AV_TIME_BASE, avi->stream_index, size);
pkt->stream_index = avi->stream_index;
if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
@@ -1268,7 +1271,7 @@ static void seek_subtitle(AVStream *st, AVStream *st2, int64_t timestamp)
av_free_packet(&ast2->sub_pkt);
if (avformat_seek_file(ast2->sub_ctx, 0, INT64_MIN, ts2, ts2, 0) >= 0 ||
avformat_seek_file(ast2->sub_ctx, 0, ts2, ts2, INT64_MAX, 0) >= 0)
- av_read_packet(ast2->sub_ctx, &ast2->sub_pkt);
+ ff_read_packet(ast2->sub_ctx, &ast2->sub_pkt);
}
static int avi_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int flags)
@@ -1296,7 +1299,8 @@ static int avi_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp
pos = st->index_entries[index].pos;
timestamp = st->index_entries[index].timestamp / FFMAX(ast->sample_size, 1);
-// av_log(s, AV_LOG_DEBUG, "XX %"PRId64" %d %"PRId64"\n", timestamp, index, st->index_entries[index].timestamp);
+ av_dlog(s, "XX %"PRId64" %d %"PRId64"\n",
+ timestamp, index, st->index_entries[index].timestamp);
if (CONFIG_DV_DEMUXER && avi->dv_demux) {
/* One and only one real stream for DV in AVI, and it has video */
@@ -1306,7 +1310,7 @@ static int avi_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp
/* Feed the DV video stream version of the timestamp to the */
/* DV demux so it can synthesize correct timestamps. */
- dv_offset_reset(avi->dv_demux, timestamp);
+ ff_dv_offset_reset(avi->dv_demux, timestamp);
avio_seek(s->pb, pos, SEEK_SET);
avi->stream_index= -1;
@@ -1344,7 +1348,8 @@ static int avi_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp
index++;
}
-// av_log(s, AV_LOG_DEBUG, "%"PRId64" %d %"PRId64"\n", timestamp, index, st2->index_entries[index].timestamp);
+ av_dlog(s, "%"PRId64" %d %"PRId64"\n",
+ timestamp, index, st2->index_entries[index].timestamp);
/* extract the current frame number */
ast2->frame_offset = st2->index_entries[index].timestamp;
}
@@ -1393,7 +1398,7 @@ static int avi_probe(AVProbeData *p)
AVInputFormat ff_avi_demuxer = {
.name = "avi",
- .long_name = NULL_IF_CONFIG_SMALL("AVI format"),
+ .long_name = NULL_IF_CONFIG_SMALL("AVI (Audio Video Interleaved)"),
.priv_data_size = sizeof(AVIContext),
.read_probe = avi_probe,
.read_header = avi_read_header,
diff --git a/gst-libs/ext/libav/libavformat/avienc.c b/gst-libs/ext/libav/libavformat/avienc.c
index 2a23c21..9d1f510 100644
--- a/gst-libs/ext/libav/libavformat/avienc.c
+++ b/gst-libs/ext/libav/libavformat/avienc.c
@@ -105,19 +105,6 @@ static char* avi_stream2fourcc(char* tag, int index, enum AVMediaType type)
return tag;
}
-static void avi_write_info_tag(AVIOContext *pb, const char *tag, const char *str)
-{
- int len = strlen(str);
- if (len > 0) {
- len++;
- ffio_wfourcc(pb, tag);
- avio_wl32(pb, len);
- avio_put_str(pb, str);
- if (len & 1)
- avio_w8(pb, 0);
- }
-}
-
static int avi_write_counters(AVFormatContext* s, int riff_id)
{
AVIOContext *pb = s->pb;
@@ -234,7 +221,7 @@ static int avi_write_header(AVFormatContext *s)
case AVMEDIA_TYPE_SUBTITLE:
// XSUB subtitles behave like video tracks, other subtitles
// are not (yet) supported.
- if (stream->codec_id != CODEC_ID_XSUB) {
+ if (stream->codec_id != AV_CODEC_ID_XSUB) {
av_log(s, AV_LOG_ERROR, "Subtitle streams other than DivX XSUB are not supported by the AVI muxer.\n");
return AVERROR_PATCHWELCOME;
}
@@ -244,7 +231,7 @@ static int avi_write_header(AVFormatContext *s)
case AVMEDIA_TYPE_DATA : ffio_wfourcc(pb, "dats"); break;
}
if(stream->codec_type == AVMEDIA_TYPE_VIDEO ||
- stream->codec_id == CODEC_ID_XSUB)
+ stream->codec_id == AV_CODEC_ID_XSUB)
avio_wl32(pb, stream->codec_tag);
else
avio_wl32(pb, 1);
@@ -286,7 +273,7 @@ static int avi_write_header(AVFormatContext *s)
case AVMEDIA_TYPE_SUBTITLE:
// XSUB subtitles behave like video tracks, other subtitles
// are not (yet) supported.
- if (stream->codec_id != CODEC_ID_XSUB) break;
+ if (stream->codec_id != AV_CODEC_ID_XSUB) break;
case AVMEDIA_TYPE_VIDEO:
ff_put_bmp_header(pb, stream, ff_codec_bmp_tags, 0);
break;
@@ -300,7 +287,7 @@ static int avi_write_header(AVFormatContext *s)
}
ff_end_tag(pb, strf);
if ((t = av_dict_get(s->streams[i]->metadata, "title", NULL, 0))) {
- avi_write_info_tag(s->pb, "strn", t->value);
+ ff_riff_write_info_tag(s->pb, "strn", t->value);
t = NULL;
}
}
@@ -377,14 +364,7 @@ static int avi_write_header(AVFormatContext *s)
ff_end_tag(pb, list1);
- list2 = ff_start_tag(pb, "LIST");
- ffio_wfourcc(pb, "INFO");
- ff_metadata_conv(&s->metadata, ff_riff_info_conv, NULL);
- for (i = 0; *ff_riff_tags[i]; i++) {
- if ((t = av_dict_get(s->metadata, ff_riff_tags[i], NULL, AV_DICT_MATCH_CASE)))
- avi_write_info_tag(s->pb, t->key, t->value);
- }
- ff_end_tag(pb, list2);
+ ff_riff_write_info(s);
/* some padding for easier tag editing */
list2 = ff_start_tag(pb, "JUNK");
@@ -520,7 +500,6 @@ static int avi_write_packet(AVFormatContext *s, AVPacket *pkt)
AVCodecContext *enc= s->streams[stream_index]->codec;
int size= pkt->size;
-// av_log(s, AV_LOG_DEBUG, "%"PRId64" %d %d\n", pkt->dts, avi->packet_count[stream_index], stream_index);
while(enc->block_align==0 && pkt->dts != AV_NOPTS_VALUE && pkt->dts > avist->packet_count){
AVPacket empty_packet;
@@ -529,7 +508,6 @@ static int avi_write_packet(AVFormatContext *s, AVPacket *pkt)
empty_packet.data= NULL;
empty_packet.stream_index= stream_index;
avi_write_packet(s, &empty_packet);
-// av_log(s, AV_LOG_DEBUG, "dup %"PRId64" %d\n", pkt->dts, avi->packet_count[stream_index]);
}
avist->packet_count++;
@@ -615,7 +593,7 @@ static int avi_write_trailer(AVFormatContext *s)
if (nb_frames < avist->packet_count)
nb_frames = avist->packet_count;
} else {
- if (stream->codec_id == CODEC_ID_MP2 || stream->codec_id == CODEC_ID_MP3) {
+ if (stream->codec_id == AV_CODEC_ID_MP2 || stream->codec_id == AV_CODEC_ID_MP3) {
nb_frames += avist->packet_count;
}
}
@@ -626,7 +604,6 @@ static int avi_write_trailer(AVFormatContext *s)
avi_write_counters(s, avi->riff_id);
}
}
- avio_flush(pb);
for (i=0; i<s->nb_streams; i++) {
AVIStream *avist= s->streams[i]->priv_data;
@@ -641,19 +618,17 @@ static int avi_write_trailer(AVFormatContext *s)
AVOutputFormat ff_avi_muxer = {
.name = "avi",
- .long_name = NULL_IF_CONFIG_SMALL("AVI format"),
+ .long_name = NULL_IF_CONFIG_SMALL("AVI (Audio Video Interleaved)"),
.mime_type = "video/x-msvideo",
.extensions = "avi",
.priv_data_size = sizeof(AVIContext),
-#if CONFIG_LIBMP3LAME_ENCODER
- .audio_codec = CODEC_ID_MP3,
-#else
- .audio_codec = CODEC_ID_AC3,
-#endif
- .video_codec = CODEC_ID_MPEG4,
+ .audio_codec = CONFIG_LIBMP3LAME ? AV_CODEC_ID_MP3 : AV_CODEC_ID_AC3,
+ .video_codec = AV_CODEC_ID_MPEG4,
.write_header = avi_write_header,
.write_packet = avi_write_packet,
.write_trailer = avi_write_trailer,
- .codec_tag= (const AVCodecTag* const []){ff_codec_bmp_tags, ff_codec_wav_tags, 0},
- .flags= AVFMT_VARIABLE_FPS,
+ .codec_tag = (const AVCodecTag* const []){
+ ff_codec_bmp_tags, ff_codec_wav_tags, 0
+ },
+ .flags = AVFMT_VARIABLE_FPS,
};
diff --git a/gst-libs/ext/libav/libavformat/avio.c b/gst-libs/ext/libav/libavformat/avio.c
index ee4dfb6..a43b241 100644
--- a/gst-libs/ext/libav/libavformat/avio.c
+++ b/gst-libs/ext/libav/libavformat/avio.c
@@ -19,11 +19,10 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include <unistd.h>
-
#include "libavutil/avstring.h"
#include "libavutil/dict.h"
#include "libavutil/opt.h"
+#include "libavutil/time.h"
#include "os_support.h"
#include "avformat.h"
#if CONFIG_NETWORK
@@ -84,25 +83,13 @@ const AVClass ffurl_context_class = {
/*@}*/
-#if FF_API_OLD_INTERRUPT_CB
-static int default_interrupt_cb(void);
-int (*url_interrupt_cb)(void) = default_interrupt_cb;
-#endif
-
-#if FF_API_OLD_AVIO
-URLProtocol *av_protocol_next(URLProtocol *p)
-{
- return ffurl_protocol_next(p);
-}
-#endif
-
const char *avio_enum_protocols(void **opaque, int output)
{
- URLProtocol **p = opaque;
- *p = ffurl_protocol_next(*p);
- if (!*p) return NULL;
- if ((output && (*p)->url_write) || (!output && (*p)->url_read))
- return (*p)->name;
+ URLProtocol *p;
+ *opaque = ffurl_protocol_next(*opaque);
+ if (!(p = *opaque)) return NULL;
+ if ((output && p->url_write) || (!output && p->url_read))
+ return p->name;
return avio_enum_protocols(opaque, output);
}
@@ -168,9 +155,7 @@ static int url_alloc_for_protocol (URLContext **puc, struct URLProtocol *up,
int ffurl_connect(URLContext* uc, AVDictionary **options)
{
int err =
-#if !FF_API_OLD_AVIO
uc->prot->url_open2 ? uc->prot->url_open2(uc, uc->filename, uc->flags, options) :
-#endif
uc->prot->url_open(uc, uc->filename, uc->flags);
if (err)
return err;
@@ -183,81 +168,6 @@ int ffurl_connect(URLContext* uc, AVDictionary **options)
return 0;
}
-#if FF_API_OLD_AVIO
-int url_open_protocol (URLContext **puc, struct URLProtocol *up,
- const char *filename, int flags)
-{
- int ret;
-
- ret = url_alloc_for_protocol(puc, up, filename, flags, NULL);
- if (ret)
- goto fail;
- ret = ffurl_connect(*puc, NULL);
- if (!ret)
- return 0;
- fail:
- ffurl_close(*puc);
- *puc = NULL;
- return ret;
-}
-int url_alloc(URLContext **puc, const char *filename, int flags)
-{
- return ffurl_alloc(puc, filename, flags, NULL);
-}
-int url_connect(URLContext* uc)
-{
- return ffurl_connect(uc, NULL);
-}
-int url_open(URLContext **puc, const char *filename, int flags)
-{
- return ffurl_open(puc, filename, flags, NULL, NULL);
-}
-int url_read(URLContext *h, unsigned char *buf, int size)
-{
- return ffurl_read(h, buf, size);
-}
-int url_read_complete(URLContext *h, unsigned char *buf, int size)
-{
- return ffurl_read_complete(h, buf, size);
-}
-int url_write(URLContext *h, const unsigned char *buf, int size)
-{
- return ffurl_write(h, buf, size);
-}
-int64_t url_seek(URLContext *h, int64_t pos, int whence)
-{
- return ffurl_seek(h, pos, whence);
-}
-int url_close(URLContext *h)
-{
- return ffurl_close(h);
-}
-int64_t url_filesize(URLContext *h)
-{
- return ffurl_size(h);
-}
-int url_get_file_handle(URLContext *h)
-{
- return ffurl_get_file_handle(h);
-}
-int url_get_max_packet_size(URLContext *h)
-{
- return h->max_packet_size;
-}
-void url_get_filename(URLContext *h, char *buf, int buf_size)
-{
- av_strlcpy(buf, h->filename, buf_size);
-}
-void url_set_interrupt_cb(URLInterruptCB *interrupt_cb)
-{
- avio_set_interrupt_cb(interrupt_cb);
-}
-int av_register_protocol2(URLProtocol *protocol, int size)
-{
- return ffurl_register_protocol(protocol, size);
-}
-#endif
-
#define URL_SCHEME_CHARS \
"abcdefghijklmnopqrstuvwxyz" \
"ABCDEFGHIJKLMNOPQRSTUVWXYZ" \
@@ -326,7 +236,7 @@ static inline int retry_transfer_wrapper(URLContext *h, unsigned char *buf, int
if (fast_retries)
fast_retries--;
else
- usleep(1000);
+ av_usleep(1000);
} else if (ret < 1)
return ret < 0 ? ret : len;
if (ret)
@@ -393,17 +303,6 @@ int ffurl_close(URLContext *h)
return ret;
}
-#if FF_API_OLD_AVIO
-int url_exist(const char *filename)
-{
- URLContext *h;
- if (ffurl_open(&h, filename, AVIO_FLAG_READ, NULL, NULL) < 0)
- return 0;
- ffurl_close(h);
- return 1;
-}
-#endif
-
int avio_check(const char *url, int flags)
{
URLContext *h;
@@ -445,45 +344,32 @@ int ffurl_get_file_handle(URLContext *h)
return h->prot->url_get_file_handle(h);
}
-#if FF_API_OLD_INTERRUPT_CB
-static int default_interrupt_cb(void)
+int ffurl_get_multi_file_handle(URLContext *h, int **handles, int *numhandles)
{
- return 0;
+ if (!h->prot->url_get_multi_file_handle) {
+ if (!h->prot->url_get_file_handle)
+ return AVERROR(ENOSYS);
+ *handles = av_malloc(sizeof(*handles));
+ if (!*handles)
+ return AVERROR(ENOMEM);
+ *numhandles = 1;
+ *handles[0] = h->prot->url_get_file_handle(h);
+ return 0;
+ }
+ return h->prot->url_get_multi_file_handle(h, handles, numhandles);
}
-void avio_set_interrupt_cb(int (*interrupt_cb)(void))
+int ffurl_shutdown(URLContext *h, int flags)
{
- if (!interrupt_cb)
- interrupt_cb = default_interrupt_cb;
- url_interrupt_cb = interrupt_cb;
+ if (!h->prot->url_shutdown)
+ return AVERROR(EINVAL);
+ return h->prot->url_shutdown(h, flags);
}
-#endif
int ff_check_interrupt(AVIOInterruptCB *cb)
{
int ret;
if (cb && cb->callback && (ret = cb->callback(cb->opaque)))
return ret;
-#if FF_API_OLD_INTERRUPT_CB
- return url_interrupt_cb();
-#else
return 0;
-#endif
}
-
-#if FF_API_OLD_AVIO
-int av_url_read_pause(URLContext *h, int pause)
-{
- if (!h->prot->url_read_pause)
- return AVERROR(ENOSYS);
- return h->prot->url_read_pause(h, pause);
-}
-
-int64_t av_url_read_seek(URLContext *h,
- int stream_index, int64_t timestamp, int flags)
-{
- if (!h->prot->url_read_seek)
- return AVERROR(ENOSYS);
- return h->prot->url_read_seek(h, stream_index, timestamp, flags);
-}
-#endif
diff --git a/gst-libs/ext/libav/libavformat/avio.h b/gst-libs/ext/libav/libavformat/avio.h
index 78935d9..b6d3cb3 100644
--- a/gst-libs/ext/libav/libavformat/avio.h
+++ b/gst-libs/ext/libav/libavformat/avio.h
@@ -48,7 +48,7 @@
* new elements have been added after this struct in AVFormatContext
* or AVIOContext.
*/
-typedef struct {
+typedef struct AVIOInterruptCB {
int (*callback)(void*);
void *opaque;
} AVIOInterruptCB;
@@ -65,8 +65,7 @@ typedef struct {
* when implementing custom I/O. Normally these are set to the
* function pointers specified in avio_alloc_context()
*/
-typedef struct {
-#if !FF_API_OLD_AVIO
+typedef struct AVIOContext {
/**
* A class for private options.
*
@@ -79,8 +78,7 @@ typedef struct {
* warning -- this field can be NULL, be sure to not pass this AVIOContext
* to any av_opt_* functions in that case.
*/
- AVClass *av_class;
-#endif
+ const AVClass *av_class;
unsigned char *buffer; /**< Start of the buffer. */
int buffer_size; /**< Maximum buffer size */
unsigned char *buf_ptr; /**< Current position in the buffer */
@@ -97,9 +95,6 @@ typedef struct {
int must_flush; /**< true if the next seek should flush */
int eof_reached; /**< true if eof reached */
int write_flag; /**< true if open for writing */
-#if FF_API_OLD_AVIO
- attribute_deprecated int is_streamed;
-#endif
int max_packet_size;
unsigned long checksum;
unsigned char *checksum_ptr;
@@ -124,262 +119,6 @@ typedef struct {
/* unbuffered I/O */
-#if FF_API_OLD_AVIO
-/**
- * URL Context.
- * New fields can be added to the end with minor version bumps.
- * Removal, reordering and changes to existing fields require a major
- * version bump.
- * sizeof(URLContext) must not be used outside libav*.
- * @deprecated This struct will be made private
- */
-typedef struct URLContext {
- const AVClass *av_class; ///< information for av_log(). Set by url_open().
- struct URLProtocol *prot;
- int flags;
- int is_streamed; /**< true if streamed (no seek possible), default = false */
- int max_packet_size; /**< if non zero, the stream is packetized with this max packet size */
- void *priv_data;
- char *filename; /**< specified URL */
- int is_connected;
- AVIOInterruptCB interrupt_callback;
-} URLContext;
-
-#define URL_PROTOCOL_FLAG_NESTED_SCHEME 1 /*< The protocol name can be the first part of a nested protocol scheme */
-#define URL_PROTOCOL_FLAG_NETWORK 2 /*< The protocol uses network */
-
-/**
- * @deprecated This struct is to be made private. Use the higher-level
- * AVIOContext-based API instead.
- */
-typedef struct URLProtocol {
- const char *name;
- int (*url_open)(URLContext *h, const char *url, int flags);
- int (*url_read)(URLContext *h, unsigned char *buf, int size);
- int (*url_write)(URLContext *h, const unsigned char *buf, int size);
- int64_t (*url_seek)(URLContext *h, int64_t pos, int whence);
- int (*url_close)(URLContext *h);
- struct URLProtocol *next;
- int (*url_read_pause)(URLContext *h, int pause);
- int64_t (*url_read_seek)(URLContext *h, int stream_index,
- int64_t timestamp, int flags);
- int (*url_get_file_handle)(URLContext *h);
- int priv_data_size;
- const AVClass *priv_data_class;
- int flags;
- int (*url_check)(URLContext *h, int mask);
-} URLProtocol;
-
-typedef struct URLPollEntry {
- URLContext *handle;
- int events;
- int revents;
-} URLPollEntry;
-
-/* not implemented */
-attribute_deprecated int url_poll(URLPollEntry *poll_table, int n, int timeout);
-
-/**
- * @name URL open modes
- * The flags argument to url_open and cosins must be one of the following
- * constants, optionally ORed with other flags.
- * @{
- */
-#define URL_RDONLY 1 /**< read-only */
-#define URL_WRONLY 2 /**< write-only */
-#define URL_RDWR (URL_RDONLY|URL_WRONLY) /**< read-write */
-/**
- * @}
- */
-
-/**
- * Use non-blocking mode.
- * If this flag is set, operations on the context will return
- * AVERROR(EAGAIN) if they can not be performed immediately.
- * If this flag is not set, operations on the context will never return
- * AVERROR(EAGAIN).
- * Note that this flag does not affect the opening/connecting of the
- * context. Connecting a protocol will always block if necessary (e.g. on
- * network protocols) but never hang (e.g. on busy devices).
- * Warning: non-blocking protocols is work-in-progress; this flag may be
- * silently ignored.
- */
-#define URL_FLAG_NONBLOCK 8
-
-typedef int URLInterruptCB(void);
-extern URLInterruptCB *url_interrupt_cb;
-
-/**
- * @defgroup old_url_funcs Old url_* functions
- * The following functions are deprecated. Use the buffered API based on #AVIOContext instead.
- * @{
- * @ingroup lavf_io
- */
-attribute_deprecated int url_open_protocol (URLContext **puc, struct URLProtocol *up,
- const char *url, int flags);
-attribute_deprecated int url_alloc(URLContext **h, const char *url, int flags);
-attribute_deprecated int url_connect(URLContext *h);
-attribute_deprecated int url_open(URLContext **h, const char *url, int flags);
-attribute_deprecated int url_read(URLContext *h, unsigned char *buf, int size);
-attribute_deprecated int url_read_complete(URLContext *h, unsigned char *buf, int size);
-attribute_deprecated int url_write(URLContext *h, const unsigned char *buf, int size);
-attribute_deprecated int64_t url_seek(URLContext *h, int64_t pos, int whence);
-attribute_deprecated int url_close(URLContext *h);
-attribute_deprecated int64_t url_filesize(URLContext *h);
-attribute_deprecated int url_get_file_handle(URLContext *h);
-attribute_deprecated int url_get_max_packet_size(URLContext *h);
-attribute_deprecated void url_get_filename(URLContext *h, char *buf, int buf_size);
-attribute_deprecated int av_url_read_pause(URLContext *h, int pause);
-attribute_deprecated int64_t av_url_read_seek(URLContext *h, int stream_index,
- int64_t timestamp, int flags);
-attribute_deprecated void url_set_interrupt_cb(int (*interrupt_cb)(void));
-/**
- * If protocol is NULL, returns the first registered protocol,
- * if protocol is non-NULL, returns the next registered protocol after protocol,
- * or NULL if protocol is the last one.
- */
-attribute_deprecated URLProtocol *av_protocol_next(URLProtocol *p);
-/**
- * Register the URLProtocol protocol.
- *
- * @param size the size of the URLProtocol struct referenced
- */
-attribute_deprecated int av_register_protocol2(URLProtocol *protocol, int size);
-/**
- * @}
- */
-
-
-typedef attribute_deprecated AVIOContext ByteIOContext;
-
-attribute_deprecated int init_put_byte(AVIOContext *s,
- unsigned char *buffer,
- int buffer_size,
- int write_flag,
- void *opaque,
- int (*read_packet)(void *opaque, uint8_t *buf, int buf_size),
- int (*write_packet)(void *opaque, uint8_t *buf, int buf_size),
- int64_t (*seek)(void *opaque, int64_t offset, int whence));
-attribute_deprecated AVIOContext *av_alloc_put_byte(
- unsigned char *buffer,
- int buffer_size,
- int write_flag,
- void *opaque,
- int (*read_packet)(void *opaque, uint8_t *buf, int buf_size),
- int (*write_packet)(void *opaque, uint8_t *buf, int buf_size),
- int64_t (*seek)(void *opaque, int64_t offset, int whence));
-
-/**
- * @defgroup old_avio_funcs Old put_/get_*() functions
- * The following functions are deprecated. Use the "avio_"-prefixed functions instead.
- * @{
- * @ingroup lavf_io
- */
-attribute_deprecated int get_buffer(AVIOContext *s, unsigned char *buf, int size);
-attribute_deprecated int get_partial_buffer(AVIOContext *s, unsigned char *buf, int size);
-attribute_deprecated int get_byte(AVIOContext *s);
-attribute_deprecated unsigned int get_le16(AVIOContext *s);
-attribute_deprecated unsigned int get_le24(AVIOContext *s);
-attribute_deprecated unsigned int get_le32(AVIOContext *s);
-attribute_deprecated uint64_t get_le64(AVIOContext *s);
-attribute_deprecated unsigned int get_be16(AVIOContext *s);
-attribute_deprecated unsigned int get_be24(AVIOContext *s);
-attribute_deprecated unsigned int get_be32(AVIOContext *s);
-attribute_deprecated uint64_t get_be64(AVIOContext *s);
-
-attribute_deprecated void put_byte(AVIOContext *s, int b);
-attribute_deprecated void put_nbyte(AVIOContext *s, int b, int count);
-attribute_deprecated void put_buffer(AVIOContext *s, const unsigned char *buf, int size);
-attribute_deprecated void put_le64(AVIOContext *s, uint64_t val);
-attribute_deprecated void put_be64(AVIOContext *s, uint64_t val);
-attribute_deprecated void put_le32(AVIOContext *s, unsigned int val);
-attribute_deprecated void put_be32(AVIOContext *s, unsigned int val);
-attribute_deprecated void put_le24(AVIOContext *s, unsigned int val);
-attribute_deprecated void put_be24(AVIOContext *s, unsigned int val);
-attribute_deprecated void put_le16(AVIOContext *s, unsigned int val);
-attribute_deprecated void put_be16(AVIOContext *s, unsigned int val);
-attribute_deprecated void put_tag(AVIOContext *s, const char *tag);
-/**
- * @}
- */
-
-attribute_deprecated int av_url_read_fpause(AVIOContext *h, int pause);
-attribute_deprecated int64_t av_url_read_fseek (AVIOContext *h, int stream_index,
- int64_t timestamp, int flags);
-
-/**
- * @defgroup old_url_f_funcs Old url_f* functions
- * The following functions are deprecated, use the "avio_"-prefixed functions instead.
- * @{
- * @ingroup lavf_io
- */
-attribute_deprecated int url_fopen( AVIOContext **s, const char *url, int flags);
-attribute_deprecated int url_fclose(AVIOContext *s);
-attribute_deprecated int64_t url_fseek(AVIOContext *s, int64_t offset, int whence);
-attribute_deprecated int url_fskip(AVIOContext *s, int64_t offset);
-attribute_deprecated int64_t url_ftell(AVIOContext *s);
-attribute_deprecated int64_t url_fsize(AVIOContext *s);
-#define URL_EOF (-1)
-attribute_deprecated int url_fgetc(AVIOContext *s);
-attribute_deprecated int url_setbufsize(AVIOContext *s, int buf_size);
-attribute_deprecated int url_fprintf(AVIOContext *s, const char *fmt, ...) av_printf_format(2, 3);
-attribute_deprecated void put_flush_packet(AVIOContext *s);
-attribute_deprecated int url_open_dyn_buf(AVIOContext **s);
-attribute_deprecated int url_open_dyn_packet_buf(AVIOContext **s, int max_packet_size);
-attribute_deprecated int url_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer);
-attribute_deprecated int url_fdopen(AVIOContext **s, URLContext *h);
-/**
- * @}
- */
-
-/**
- * @deprecated use AVIOContext.eof_reached
- */
-attribute_deprecated int url_feof(AVIOContext *s);
-attribute_deprecated int url_ferror(AVIOContext *s);
-
-attribute_deprecated int udp_set_remote_url(URLContext *h, const char *uri);
-attribute_deprecated int udp_get_local_port(URLContext *h);
-
-attribute_deprecated void init_checksum(AVIOContext *s,
- unsigned long (*update_checksum)(unsigned long c, const uint8_t *p, unsigned int len),
- unsigned long checksum);
-attribute_deprecated unsigned long get_checksum(AVIOContext *s);
-attribute_deprecated void put_strz(AVIOContext *s, const char *buf);
-/** @note unlike fgets, the EOL character is not returned and a whole
- line is parsed. return NULL if first char read was EOF */
-attribute_deprecated char *url_fgets(AVIOContext *s, char *buf, int buf_size);
-/**
- * @deprecated use avio_get_str instead
- */
-attribute_deprecated char *get_strz(AVIOContext *s, char *buf, int maxlen);
-/**
- * @deprecated Use AVIOContext.seekable field directly.
- */
-attribute_deprecated static inline int url_is_streamed(AVIOContext *s)
-{
- return !s->seekable;
-}
-attribute_deprecated URLContext *url_fileno(AVIOContext *s);
-
-/**
- * @deprecated use AVIOContext.max_packet_size directly.
- */
-attribute_deprecated int url_fget_max_packet_size(AVIOContext *s);
-
-attribute_deprecated int url_open_buf(AVIOContext **s, uint8_t *buf, int buf_size, int flags);
-
-/** return the written or read size */
-attribute_deprecated int url_close_buf(AVIOContext *s);
-
-/**
- * Return a non-zero value if the resource indicated by url
- * exists, 0 otherwise.
- * @deprecated Use avio_check instead.
- */
-attribute_deprecated int url_exist(const char *url);
-#endif // FF_API_OLD_AVIO
-
/**
* Return AVIO_FLAG_* access flags corresponding to the access permissions
* of the resource in url, or a negative value corresponding to an
@@ -394,18 +133,6 @@ attribute_deprecated int url_exist(const char *url);
*/
int avio_check(const char *url, int flags);
-#if FF_API_OLD_INTERRUPT_CB
-/**
- * The callback is called in blocking functions to test regulary if
- * asynchronous interruption is needed. AVERROR_EXIT is returned
- * in this case by the interrupted function. 'NULL' means no interrupt
- * callback is given.
- * @deprecated Use interrupt_callback in AVFormatContext/avio_open2
- * instead.
- */
-attribute_deprecated void avio_set_interrupt_cb(int (*interrupt_cb)(void));
-#endif
-
/**
* Allocate and initialize an AVIOContext for buffered I/O. It must be later
* freed with av_free().
@@ -622,11 +349,29 @@ int avio_open2(AVIOContext **s, const char *url, int flags,
* Close the resource accessed by the AVIOContext s and free it.
* This function can only be used if s was opened by avio_open().
*
+ * The internal buffer is automatically flushed before closing the
+ * resource.
+ *
* @return 0 on success, an AVERROR < 0 on error.
+ * @see avio_closep
*/
int avio_close(AVIOContext *s);
/**
+ * Close the resource accessed by the AVIOContext *s, free it
+ * and set the pointer pointing to it to NULL.
+ * This function can only be used if s was opened by avio_open().
+ *
+ * The internal buffer is automatically flushed before closing the
+ * resource.
+ *
+ * @return 0 on success, an AVERROR < 0 on error.
+ * @see avio_close
+ */
+int avio_closep(AVIOContext **s);
+
+
+/**
* Open a write only memory stream.
*
* @param s new IO context
diff --git a/gst-libs/ext/libav/libavformat/avio_internal.h b/gst-libs/ext/libav/libavformat/avio_internal.h
index f2ccc36..3da2fc8 100644
--- a/gst-libs/ext/libav/libavformat/avio_internal.h
+++ b/gst-libs/ext/libav/libavformat/avio_internal.h
@@ -81,7 +81,7 @@ unsigned long ff_crc04C11DB7_update(unsigned long checksum, const uint8_t *buf,
/**
* Open a write only packetized memory stream with a maximum packet
* size of 'max_packet_size'. The stream is stored in a memory buffer
- * with a big endian 4 byte header giving the packet size in bytes.
+ * with a big-endian 4 byte header giving the packet size in bytes.
*
* @param s new IO context
* @param max_packet_size maximum packet size (must be > 0)
diff --git a/gst-libs/ext/libav/libavformat/aviobuf.c b/gst-libs/ext/libav/libavformat/aviobuf.c
index 6cd2cef..d2eaf36 100644
--- a/gst-libs/ext/libav/libavformat/aviobuf.c
+++ b/gst-libs/ext/libav/libavformat/aviobuf.c
@@ -40,7 +40,6 @@
*/
#define SHORT_SEEK_THRESHOLD 4096
-#if !FF_API_OLD_AVIO
static void *ffio_url_child_next(void *obj, void *prev)
{
AVIOContext *s = obj;
@@ -64,7 +63,7 @@ const AVClass ffio_url_class = {
.child_next = ffio_url_child_next,
.child_class_next = ffio_url_child_class_next,
};
-#endif
+
static void fill_buffer(AVIOContext *s);
static int url_resetbuf(AVIOContext *s, int flags);
@@ -77,59 +76,33 @@ int ffio_init_context(AVIOContext *s,
int (*write_packet)(void *opaque, uint8_t *buf, int buf_size),
int64_t (*seek)(void *opaque, int64_t offset, int whence))
{
- s->buffer = buffer;
+ s->buffer = buffer;
s->buffer_size = buffer_size;
- s->buf_ptr = buffer;
- s->opaque = opaque;
+ s->buf_ptr = buffer;
+ s->opaque = opaque;
+
url_resetbuf(s, write_flag ? AVIO_FLAG_WRITE : AVIO_FLAG_READ);
- s->write_packet = write_packet;
- s->read_packet = read_packet;
- s->seek = seek;
- s->pos = 0;
- s->must_flush = 0;
- s->eof_reached = 0;
- s->error = 0;
-#if FF_API_OLD_AVIO
- s->is_streamed = 0;
-#endif
- s->seekable = AVIO_SEEKABLE_NORMAL;
+
+ s->write_packet = write_packet;
+ s->read_packet = read_packet;
+ s->seek = seek;
+ s->pos = 0;
+ s->must_flush = 0;
+ s->eof_reached = 0;
+ s->error = 0;
+ s->seekable = AVIO_SEEKABLE_NORMAL;
s->max_packet_size = 0;
- s->update_checksum= NULL;
- if(!read_packet && !write_flag){
- s->pos = buffer_size;
+ s->update_checksum = NULL;
+
+ if (!read_packet && !write_flag) {
+ s->pos = buffer_size;
s->buf_end = s->buffer + buffer_size;
}
s->read_pause = NULL;
s->read_seek = NULL;
- return 0;
-}
-#if FF_API_OLD_AVIO
-int init_put_byte(AVIOContext *s,
- unsigned char *buffer,
- int buffer_size,
- int write_flag,
- void *opaque,
- int (*read_packet)(void *opaque, uint8_t *buf, int buf_size),
- int (*write_packet)(void *opaque, uint8_t *buf, int buf_size),
- int64_t (*seek)(void *opaque, int64_t offset, int whence))
-{
- return ffio_init_context(s, buffer, buffer_size, write_flag, opaque,
- read_packet, write_packet, seek);
-}
-AVIOContext *av_alloc_put_byte(
- unsigned char *buffer,
- int buffer_size,
- int write_flag,
- void *opaque,
- int (*read_packet)(void *opaque, uint8_t *buf, int buf_size),
- int (*write_packet)(void *opaque, uint8_t *buf, int buf_size),
- int64_t (*seek)(void *opaque, int64_t offset, int whence))
-{
- return avio_alloc_context(buffer, buffer_size, write_flag, opaque,
- read_packet, write_packet, seek);
+ return 0;
}
-#endif
AVIOContext *avio_alloc_context(
unsigned char *buffer,
@@ -151,15 +124,17 @@ AVIOContext *avio_alloc_context(
static void flush_buffer(AVIOContext *s)
{
if (s->buf_ptr > s->buffer) {
- if (s->write_packet && !s->error){
- int ret= s->write_packet(s->opaque, s->buffer, s->buf_ptr - s->buffer);
- if(ret < 0){
+ if (s->write_packet && !s->error) {
+ int ret = s->write_packet(s->opaque, s->buffer,
+ s->buf_ptr - s->buffer);
+ if (ret < 0) {
s->error = ret;
}
}
- if(s->update_checksum){
- s->checksum= s->update_checksum(s->checksum, s->checksum_ptr, s->buf_ptr - s->checksum_ptr);
- s->checksum_ptr= s->buffer;
+ if (s->update_checksum) {
+ s->checksum = s->update_checksum(s->checksum, s->checksum_ptr,
+ s->buf_ptr - s->checksum_ptr);
+ s->checksum_ptr = s->buffer;
}
s->pos += s->buf_ptr - s->buffer;
}
@@ -246,12 +221,10 @@ int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
} else {
int64_t res;
-#if CONFIG_MUXERS || CONFIG_NETWORK
if (s->write_flag) {
flush_buffer(s);
s->must_flush = 1;
}
-#endif /* CONFIG_MUXERS || CONFIG_NETWORK */
if (!s->seek)
return AVERROR(EPIPE);
if ((res = s->seek(s->opaque, offset, SEEK_SET)) < 0)
@@ -265,30 +238,17 @@ int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
return offset;
}
-#if FF_API_OLD_AVIO
-int url_fskip(AVIOContext *s, int64_t offset)
-{
- int64_t ret = avio_seek(s, offset, SEEK_CUR);
- return ret < 0 ? ret : 0;
-}
-
-int64_t url_ftell(AVIOContext *s)
-{
- return avio_seek(s, 0, SEEK_CUR);
-}
-#endif
-
int64_t avio_size(AVIOContext *s)
{
int64_t size;
- if(!s)
+ if (!s)
return AVERROR(EINVAL);
if (!s->seek)
return AVERROR(ENOSYS);
size = s->seek(s->opaque, 0, AVSEEK_SIZE);
- if(size<0){
+ if (size < 0) {
if ((size = s->seek(s->opaque, -1, SEEK_END)) < 0)
return size;
size++;
@@ -297,22 +257,6 @@ int64_t avio_size(AVIOContext *s)
return size;
}
-#if FF_API_OLD_AVIO
-int url_feof(AVIOContext *s)
-{
- if(!s)
- return 0;
- return s->eof_reached;
-}
-
-int url_ferror(AVIOContext *s)
-{
- if(!s)
- return 0;
- return s->error;
-}
-#endif
-
void avio_wl32(AVIOContext *s, unsigned int val)
{
avio_w8(s, val);
@@ -329,143 +273,6 @@ void avio_wb32(AVIOContext *s, unsigned int val)
avio_w8(s, val);
}
-#if FF_API_OLD_AVIO
-void put_strz(AVIOContext *s, const char *str)
-{
- avio_put_str(s, str);
-}
-
-#define GET(name, type) \
- type get_be ##name(AVIOContext *s) \
-{\
- return avio_rb ##name(s);\
-}\
- type get_le ##name(AVIOContext *s) \
-{\
- return avio_rl ##name(s);\
-}
-
-GET(16, unsigned int)
-GET(24, unsigned int)
-GET(32, unsigned int)
-GET(64, uint64_t)
-
-#undef GET
-
-#define PUT(name, type ) \
- void put_le ##name(AVIOContext *s, type val)\
-{\
- avio_wl ##name(s, val);\
-}\
- void put_be ##name(AVIOContext *s, type val)\
-{\
- avio_wb ##name(s, val);\
-}
-
-PUT(16, unsigned int)
-PUT(24, unsigned int)
-PUT(32, unsigned int)
-PUT(64, uint64_t)
-#undef PUT
-
-int get_byte(AVIOContext *s)
-{
- return avio_r8(s);
-}
-int get_buffer(AVIOContext *s, unsigned char *buf, int size)
-{
- return avio_read(s, buf, size);
-}
-int get_partial_buffer(AVIOContext *s, unsigned char *buf, int size)
-{
- return ffio_read_partial(s, buf, size);
-}
-void put_byte(AVIOContext *s, int val)
-{
- avio_w8(s, val);
-}
-void put_buffer(AVIOContext *s, const unsigned char *buf, int size)
-{
- avio_write(s, buf, size);
-}
-void put_nbyte(AVIOContext *s, int b, int count)
-{
- ffio_fill(s, b, count);
-}
-
-int url_fopen(AVIOContext **s, const char *filename, int flags)
-{
- return avio_open(s, filename, flags);
-}
-int url_fclose(AVIOContext *s)
-{
- return avio_close(s);
-}
-int64_t url_fseek(AVIOContext *s, int64_t offset, int whence)
-{
- return avio_seek(s, offset, whence);
-}
-int64_t url_fsize(AVIOContext *s)
-{
- return avio_size(s);
-}
-int url_setbufsize(AVIOContext *s, int buf_size)
-{
- return ffio_set_buf_size(s, buf_size);
-}
-int url_fprintf(AVIOContext *s, const char *fmt, ...)
-{
- va_list ap;
- char buf[4096];
- int ret;
-
- va_start(ap, fmt);
- ret = vsnprintf(buf, sizeof(buf), fmt, ap);
- va_end(ap);
- avio_write(s, buf, strlen(buf));
- return ret;
-}
-void put_flush_packet(AVIOContext *s)
-{
- avio_flush(s);
-}
-int av_url_read_fpause(AVIOContext *s, int pause)
-{
- return avio_pause(s, pause);
-}
-int64_t av_url_read_fseek(AVIOContext *s, int stream_index,
- int64_t timestamp, int flags)
-{
- return avio_seek_time(s, stream_index, timestamp, flags);
-}
-void init_checksum(AVIOContext *s,
- unsigned long (*update_checksum)(unsigned long c, const uint8_t *p, unsigned int len),
- unsigned long checksum)
-{
- ffio_init_checksum(s, update_checksum, checksum);
-}
-unsigned long get_checksum(AVIOContext *s)
-{
- return ffio_get_checksum(s);
-}
-int url_open_dyn_buf(AVIOContext **s)
-{
- return avio_open_dyn_buf(s);
-}
-int url_open_dyn_packet_buf(AVIOContext **s, int max_packet_size)
-{
- return ffio_open_dyn_packet_buf(s, max_packet_size);
-}
-int url_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer)
-{
- return avio_close_dyn_buf(s, pbuffer);
-}
-int url_fdopen(AVIOContext **s, URLContext *h)
-{
- return ffio_fdopen(s, h);
-}
-#endif
-
int avio_put_str(AVIOContext *s, const char *str)
{
int len = 1;
@@ -487,29 +294,31 @@ int avio_put_str16le(AVIOContext *s, const char *str)
uint16_t tmp;
GET_UTF8(ch, *q++, break;)
- PUT_UTF16(ch, tmp, avio_wl16(s, tmp);ret += 2;)
+ PUT_UTF16(ch, tmp, avio_wl16(s, tmp); ret += 2;)
}
avio_wl16(s, 0);
ret += 2;
return ret;
}
-int ff_get_v_length(uint64_t val){
- int i=1;
+int ff_get_v_length(uint64_t val)
+{
+ int i = 1;
- while(val>>=7)
+ while (val >>= 7)
i++;
return i;
}
-void ff_put_v(AVIOContext *bc, uint64_t val){
- int i= ff_get_v_length(val);
+void ff_put_v(AVIOContext *bc, uint64_t val)
+{
+ int i = ff_get_v_length(val);
- while(--i>0)
- avio_w8(bc, 128 | (val>>(7*i)));
+ while (--i > 0)
+ avio_w8(bc, 128 | (val >> (7 * i)));
- avio_w8(bc, val&127);
+ avio_w8(bc, val & 127);
}
void avio_wl64(AVIOContext *s, uint64_t val)
@@ -548,24 +357,18 @@ void avio_wb24(AVIOContext *s, unsigned int val)
avio_w8(s, val);
}
-#if FF_API_OLD_AVIO
-void put_tag(AVIOContext *s, const char *tag)
-{
- while (*tag) {
- avio_w8(s, *tag++);
- }
-}
-#endif
-
/* Input stream */
static void fill_buffer(AVIOContext *s)
{
- uint8_t *dst= !s->max_packet_size && s->buf_end - s->buffer < s->buffer_size ? s->buf_end : s->buffer;
- int len= s->buffer_size - (dst - s->buffer);
- int max_buffer_size = s->max_packet_size ? s->max_packet_size : IO_BUFFER_SIZE;
+ uint8_t *dst = !s->max_packet_size &&
+ s->buf_end - s->buffer < s->buffer_size ?
+ s->buf_end : s->buffer;
+ int len = s->buffer_size - (dst - s->buffer);
+ int max_buffer_size = s->max_packet_size ?
+ s->max_packet_size : IO_BUFFER_SIZE;
- /* can't fill the buffer without read_packet, just set EOF if appropiate */
+ /* can't fill the buffer without read_packet, just set EOF if appropriate */
if (!s->read_packet && s->buf_ptr >= s->buf_end)
s->eof_reached = 1;
@@ -573,10 +376,11 @@ static void fill_buffer(AVIOContext *s)
if (s->eof_reached)
return;
- if(s->update_checksum && dst == s->buffer){
- if(s->buf_end > s->checksum_ptr)
- s->checksum= s->update_checksum(s->checksum, s->checksum_ptr, s->buf_end - s->checksum_ptr);
- s->checksum_ptr= s->buffer;
+ if (s->update_checksum && dst == s->buffer) {
+ if (s->buf_end > s->checksum_ptr)
+ s->checksum = s->update_checksum(s->checksum, s->checksum_ptr,
+ s->buf_end - s->checksum_ptr);
+ s->checksum_ptr = s->buffer;
}
/* make buffer smaller in case it ended up large after probing */
@@ -587,7 +391,7 @@ static void fill_buffer(AVIOContext *s)
len = s->buffer_size;
}
- if(s->read_packet)
+ if (s->read_packet)
len = s->read_packet(s->opaque, dst, len);
else
len = 0;
@@ -595,8 +399,8 @@ static void fill_buffer(AVIOContext *s)
/* do not modify buffer if EOF reached so that a seek back can
be done without rereading data */
s->eof_reached = 1;
- if(len<0)
- s->error= len;
+ if (len < 0)
+ s->error = len;
} else {
s->pos += len;
s->buf_ptr = dst;
@@ -612,8 +416,9 @@ unsigned long ff_crc04C11DB7_update(unsigned long checksum, const uint8_t *buf,
unsigned long ffio_get_checksum(AVIOContext *s)
{
- s->checksum= s->update_checksum(s->checksum, s->checksum_ptr, s->buf_ptr - s->checksum_ptr);
- s->update_checksum= NULL;
+ s->checksum = s->update_checksum(s->checksum, s->checksum_ptr,
+ s->buf_ptr - s->checksum_ptr);
+ s->update_checksum = NULL;
return s->checksum;
}
@@ -621,10 +426,10 @@ void ffio_init_checksum(AVIOContext *s,
unsigned long (*update_checksum)(unsigned long c, const uint8_t *p, unsigned int len),
unsigned long checksum)
{
- s->update_checksum= update_checksum;
- if(s->update_checksum){
- s->checksum= checksum;
- s->checksum_ptr= s->buf_ptr;
+ s->update_checksum = update_checksum;
+ if (s->update_checksum) {
+ s->checksum = checksum;
+ s->checksum_ptr = s->buf_ptr;
}
}
@@ -638,17 +443,6 @@ int avio_r8(AVIOContext *s)
return 0;
}
-#if FF_API_OLD_AVIO
-int url_fgetc(AVIOContext *s)
-{
- if (s->buf_ptr >= s->buf_end)
- fill_buffer(s);
- if (s->buf_ptr < s->buf_end)
- return *s->buf_ptr++;
- return URL_EOF;
-}
-#endif
-
int avio_read(AVIOContext *s, unsigned char *buf, int size)
{
int len, size1;
@@ -658,7 +452,7 @@ int avio_read(AVIOContext *s, unsigned char *buf, int size)
len = s->buf_end - s->buf_ptr;
if (len > size)
len = size;
- if (len == 0) {
+ if (len == 0 || s->write_flag) {
if(size > s->buffer_size && !s->update_checksum){
if(s->read_packet)
len = s->read_packet(s->opaque, buf, size);
@@ -676,7 +470,7 @@ int avio_read(AVIOContext *s, unsigned char *buf, int size)
s->buf_ptr = s->buffer;
s->buf_end = s->buffer/* + len*/;
}
- }else{
+ } else {
fill_buffer(s);
len = s->buf_end - s->buf_ptr;
if (len == 0)
@@ -700,11 +494,25 @@ int ffio_read_partial(AVIOContext *s, unsigned char *buf, int size)
{
int len;
- if(size<0)
+ if (size < 0)
return -1;
+ if (s->read_packet && s->write_flag) {
+ len = s->read_packet(s->opaque, buf, size);
+ if (len > 0)
+ s->pos += len;
+ return len;
+ }
+
len = s->buf_end - s->buf_ptr;
if (len == 0) {
+ /* Reset the buf_end pointer to the start of the buffer, to make sure
+ * the fill_buffer call tries to read as much data as fits into the
+ * full buffer, instead of just what space is left after buf_end.
+ * This avoids returning partial packets at the end of the buffer,
+ * for packet based inputs.
+ */
+ s->buf_end = s->buf_ptr = s->buffer;
fill_buffer(s);
len = s->buf_end - s->buf_ptr;
}
@@ -774,14 +582,6 @@ unsigned int avio_rb32(AVIOContext *s)
return val;
}
-#if FF_API_OLD_AVIO
-char *get_strz(AVIOContext *s, char *buf, int maxlen)
-{
- avio_get_str(s, INT_MAX, buf, maxlen);
- return buf;
-}
-#endif
-
int ff_get_line(AVIOContext *s, char *buf, int maxlen)
{
int i = 0;
@@ -879,18 +679,13 @@ int ffio_fdopen(AVIOContext **s, URLContext *h)
av_free(buffer);
return AVERROR(ENOMEM);
}
-#if FF_API_OLD_AVIO
- (*s)->is_streamed = h->is_streamed;
-#endif
(*s)->seekable = h->is_streamed ? 0 : AVIO_SEEKABLE_NORMAL;
(*s)->max_packet_size = max_packet_size;
if(h->prot) {
(*s)->read_pause = (int (*)(void *, int))h->prot->url_read_pause;
(*s)->read_seek = (int64_t (*)(void *, int, int64_t, int))h->prot->url_read_seek;
}
-#if !FF_API_OLD_AVIO
(*s)->av_class = &ffio_url_class;
-#endif
return 0;
}
@@ -986,19 +781,24 @@ int avio_open2(AVIOContext **s, const char *filename, int flags,
int avio_close(AVIOContext *s)
{
- URLContext *h = s->opaque;
+ URLContext *h;
- av_free(s->buffer);
+ if (!s)
+ return 0;
+
+ avio_flush(s);
+ h = s->opaque;
+ av_freep(&s->buffer);
av_free(s);
return ffurl_close(h);
}
-#if FF_API_OLD_AVIO
-URLContext *url_fileno(AVIOContext *s)
+int avio_closep(AVIOContext **s)
{
- return s->opaque;
+ int ret = avio_close(*s);
+ *s = NULL;
+ return ret;
}
-#endif
int avio_printf(AVIOContext *s, const char *fmt, ...)
{
@@ -1013,34 +813,6 @@ int avio_printf(AVIOContext *s, const char *fmt, ...)
return ret;
}
-#if FF_API_OLD_AVIO
-char *url_fgets(AVIOContext *s, char *buf, int buf_size)
-{
- int c;
- char *q;
-
- c = avio_r8(s);
- if (s->eof_reached)
- return NULL;
- q = buf;
- for(;;) {
- if (s->eof_reached || c == '\n')
- break;
- if ((q - buf) < buf_size - 1)
- *q++ = c;
- c = avio_r8(s);
- }
- if (buf_size > 0)
- *q = '\0';
- return buf;
-}
-
-int url_fget_max_packet_size(AVIOContext *s)
-{
- return s->max_packet_size;
-}
-#endif
-
int avio_pause(AVIOContext *s, int pause)
{
if (!s->read_pause)
@@ -1056,7 +828,7 @@ int64_t avio_seek_time(AVIOContext *s, int stream_index,
if (!s->read_seek)
return AVERROR(ENOSYS);
ret = s->read_seek(h, stream_index, timestamp, flags);
- if(ret >= 0) {
+ if (ret >= 0) {
int64_t pos;
s->buf_ptr = s->buf_end; // Flush buffer
pos = s->seek(h, 0, SEEK_CUR);
@@ -1068,29 +840,6 @@ int64_t avio_seek_time(AVIOContext *s, int stream_index,
return ret;
}
-/* buffer handling */
-#if FF_API_OLD_AVIO
-int url_open_buf(AVIOContext **s, uint8_t *buf, int buf_size, int flags)
-{
- int ret;
- *s = av_mallocz(sizeof(AVIOContext));
- if(!*s)
- return AVERROR(ENOMEM);
- ret = ffio_init_context(*s, buf, buf_size,
- flags & AVIO_FLAG_WRITE,
- NULL, NULL, NULL, NULL);
- if(ret != 0)
- av_freep(s);
- return ret;
-}
-
-int url_close_buf(AVIOContext *s)
-{
- avio_flush(s);
- return s->buf_ptr - s->buffer;
-}
-#endif
-
/* output in a dynamic buffer */
typedef struct DynBuffer {
@@ -1108,7 +857,7 @@ static int dyn_buf_write(void *opaque, uint8_t *buf, int buf_size)
/* reallocate buffer if needed */
new_size = d->pos + buf_size;
new_allocated_size = d->allocated_size;
- if(new_size < d->pos || new_size > INT_MAX/2)
+ if (new_size < d->pos || new_size > INT_MAX/2)
return -1;
while (new_size > new_allocated_size) {
if (!new_allocated_size)
@@ -1137,8 +886,8 @@ static int dyn_packet_buf_write(void *opaque, uint8_t *buf, int buf_size)
/* packetized write: output the header */
AV_WB32(buf1, buf_size);
- ret= dyn_buf_write(opaque, buf1, 4);
- if(ret < 0)
+ ret = dyn_buf_write(opaque, buf1, 4);
+ if (ret < 0)
return ret;
/* then the data */
@@ -1164,7 +913,7 @@ static int url_open_dyn_buf_internal(AVIOContext **s, int max_packet_size)
DynBuffer *d;
unsigned io_buffer_size = max_packet_size ? max_packet_size : 1024;
- if(sizeof(DynBuffer) + io_buffer_size < io_buffer_size)
+ if (sizeof(DynBuffer) + io_buffer_size < io_buffer_size)
return -1;
d = av_mallocz(sizeof(DynBuffer) + io_buffer_size);
if (!d)
diff --git a/gst-libs/ext/libav/libavformat/avisynth.c b/gst-libs/ext/libav/libavformat/avisynth.c
index 9449c1b..d31c427 100644
--- a/gst-libs/ext/libav/libavformat/avisynth.c
+++ b/gst-libs/ext/libav/libavformat/avisynth.c
@@ -41,7 +41,7 @@ typedef struct {
int next_stream;
} AVISynthContext;
-static int avisynth_read_header(AVFormatContext *s, AVFormatParameters *ap)
+static int avisynth_read_header(AVFormatContext *s)
{
AVISynthContext *avs = s->priv_data;
HRESULT res;
@@ -49,10 +49,15 @@ static int avisynth_read_header(AVFormatContext *s, AVFormatParameters *ap)
DWORD id;
AVStream *st;
AVISynthStream *stream;
+ wchar_t filename_wchar[1024] = { 0 };
+ char filename_char[1024] = { 0 };
AVIFileInit();
- res = AVIFileOpen(&avs->file, s->filename, OF_READ|OF_SHARE_DENY_WRITE, NULL);
+ /* avisynth can't accept UTF-8 filename */
+ MultiByteToWideChar(CP_UTF8, 0, s->filename, -1, filename_wchar, 1024);
+ WideCharToMultiByte(CP_THREAD_ACP, 0, filename_wchar, -1, filename_char, 1024, NULL, NULL);
+ res = AVIFileOpen(&avs->file, filename_char, OF_READ|OF_SHARE_DENY_WRITE, NULL);
if (res != S_OK)
{
av_log(s, AV_LOG_ERROR, "AVIFileOpen failed with error %ld", res);
@@ -115,8 +120,11 @@ static int avisynth_read_header(AVFormatContext *s, AVFormatParameters *ap)
st = avformat_new_stream(s, NULL);
st->id = id;
st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
- st->r_frame_rate.num = stream->info.dwRate;
- st->r_frame_rate.den = stream->info.dwScale;
+ st->avg_frame_rate.num = stream->info.dwRate;
+ st->avg_frame_rate.den = stream->info.dwScale;
+#if FF_API_R_FRAME_RATE
+ st->r_frame_rate = st->avg_frame_rate;
+#endif
st->codec->width = imgfmt.bmiHeader.biWidth;
st->codec->height = imgfmt.bmiHeader.biHeight;
diff --git a/gst-libs/ext/libav/libavformat/avs.c b/gst-libs/ext/libav/libavformat/avs.c
index c6ccbb2..a6a90dd 100644
--- a/gst-libs/ext/libav/libavformat/avs.c
+++ b/gst-libs/ext/libav/libavformat/avs.c
@@ -55,7 +55,7 @@ static int avs_probe(AVProbeData * p)
return 0;
}
-static int avs_read_header(AVFormatContext * s, AVFormatParameters * ap)
+static int avs_read_header(AVFormatContext * s)
{
AvsFormat *avs = s->priv_data;
@@ -124,7 +124,7 @@ static int avs_read_audio_packet(AVFormatContext * s, AVPacket * pkt)
int ret, size;
size = avio_tell(s->pb);
- ret = voc_get_packet(s, pkt, avs->st_audio, avs->remaining_audio_size);
+ ret = ff_voc_get_packet(s, pkt, avs->st_audio, avs->remaining_audio_size);
size = avio_tell(s->pb) - size;
avs->remaining_audio_size -= size;
@@ -183,13 +183,15 @@ static int avs_read_packet(AVFormatContext * s, AVPacket * pkt)
if (avs->st_video == NULL)
return AVERROR(ENOMEM);
avs->st_video->codec->codec_type = AVMEDIA_TYPE_VIDEO;
- avs->st_video->codec->codec_id = CODEC_ID_AVS;
+ avs->st_video->codec->codec_id = AV_CODEC_ID_AVS;
avs->st_video->codec->width = avs->width;
avs->st_video->codec->height = avs->height;
avs->st_video->codec->bits_per_coded_sample=avs->bits_per_sample;
avs->st_video->nb_frames = avs->nb_frames;
- avs->st_video->codec->time_base = (AVRational) {
- 1, avs->fps};
+#if FF_API_R_FRAME_RATE
+ avs->st_video->r_frame_rate =
+#endif
+ avs->st_video->avg_frame_rate = (AVRational){avs->fps, 1};
}
return avs_read_video_packet(s, pkt, type, sub_type, size,
palette, palette_size);
@@ -221,7 +223,7 @@ static int avs_read_close(AVFormatContext * s)
AVInputFormat ff_avs_demuxer = {
.name = "avs",
- .long_name = NULL_IF_CONFIG_SMALL("AVS format"),
+ .long_name = NULL_IF_CONFIG_SMALL("AVS"),
.priv_data_size = sizeof(AvsFormat),
.read_probe = avs_probe,
.read_header = avs_read_header,
diff --git a/gst-libs/ext/libav/libavformat/bethsoftvid.c b/gst-libs/ext/libav/libavformat/bethsoftvid.c
index 7705fcb..f41ef52 100644
--- a/gst-libs/ext/libav/libavformat/bethsoftvid.c
+++ b/gst-libs/ext/libav/libavformat/bethsoftvid.c
@@ -27,22 +27,29 @@
* @see http://www.svatopluk.com/andux/docs/dfvid.html
*/
+#include "libavutil/channel_layout.h"
#include "libavutil/intreadwrite.h"
#include "avformat.h"
#include "internal.h"
#include "libavcodec/bethsoftvideo.h"
+#define BVID_PALETTE_SIZE 3 * 256
+
+#define DEFAULT_SAMPLE_RATE 11111
+
typedef struct BVID_DemuxContext
{
int nframes;
+ int sample_rate; /**< audio sample rate */
+ int width; /**< video width */
+ int height; /**< video height */
/** delay value between frames, added to individual frame delay.
* custom units, which will be added to other custom units (~=16ms according
* to free, unofficial documentation) */
int bethsoft_global_delay;
-
- /** video presentation time stamp.
- * delay = 16 milliseconds * (global_delay + per_frame_delay) */
- int video_pts;
+ int video_index; /**< video stream index */
+ int audio_index; /**< audio stream index */
+ uint8_t *palette;
int is_finished;
@@ -50,19 +57,17 @@ typedef struct BVID_DemuxContext
static int vid_probe(AVProbeData *p)
{
- // little endian VID tag, file starts with "VID\0"
+ // little-endian VID tag, file starts with "VID\0"
if (AV_RL32(p->buf) != MKTAG('V', 'I', 'D', 0))
return 0;
return AVPROBE_SCORE_MAX;
}
-static int vid_read_header(AVFormatContext *s,
- AVFormatParameters *ap)
+static int vid_read_header(AVFormatContext *s)
{
BVID_DemuxContext *vid = s->priv_data;
AVIOContext *pb = s->pb;
- AVStream *stream;
/* load main header. Contents:
* bytes: 'V' 'I' 'D'
@@ -70,43 +75,50 @@ static int vid_read_header(AVFormatContext *s,
*/
avio_skip(pb, 5);
vid->nframes = avio_rl16(pb);
-
- stream = avformat_new_stream(s, NULL);
- if (!stream)
- return AVERROR(ENOMEM);
- avpriv_set_pts_info(stream, 32, 1, 60); // 16 ms increments, i.e. 60 fps
- stream->codec->codec_type = AVMEDIA_TYPE_VIDEO;
- stream->codec->codec_id = CODEC_ID_BETHSOFTVID;
- stream->codec->width = avio_rl16(pb);
- stream->codec->height = avio_rl16(pb);
- stream->codec->pix_fmt = PIX_FMT_PAL8;
+ vid->width = avio_rl16(pb);
+ vid->height = avio_rl16(pb);
vid->bethsoft_global_delay = avio_rl16(pb);
avio_rl16(pb);
- // done with video codec, set up audio codec
- stream = avformat_new_stream(s, NULL);
- if (!stream)
- return AVERROR(ENOMEM);
- stream->codec->codec_type = AVMEDIA_TYPE_AUDIO;
- stream->codec->codec_id = CODEC_ID_PCM_U8;
- stream->codec->channels = 1;
- stream->codec->sample_rate = 11025;
- stream->codec->bits_per_coded_sample = 8;
- stream->codec->bit_rate = stream->codec->channels * stream->codec->sample_rate * stream->codec->bits_per_coded_sample;
+ // wait until the first packet to create each stream
+ vid->video_index = -1;
+ vid->audio_index = -1;
+ vid->sample_rate = DEFAULT_SAMPLE_RATE;
+ s->ctx_flags |= AVFMTCTX_NOHEADER;
return 0;
}
#define BUFFER_PADDING_SIZE 1000
static int read_frame(BVID_DemuxContext *vid, AVIOContext *pb, AVPacket *pkt,
- uint8_t block_type, AVFormatContext *s, int npixels)
+ uint8_t block_type, AVFormatContext *s)
{
uint8_t * vidbuf_start = NULL;
int vidbuf_nbytes = 0;
int code;
int bytes_copied = 0;
- int position;
+ int position, duration, npixels;
unsigned int vidbuf_capacity;
+ int ret = 0;
+ AVStream *st;
+
+ if (vid->video_index < 0) {
+ st = avformat_new_stream(s, NULL);
+ if (!st)
+ return AVERROR(ENOMEM);
+ vid->video_index = st->index;
+ if (vid->audio_index < 0) {
+ av_log_ask_for_sample(s, "No audio packet before first video "
+ "packet. Using default video time base.\n");
+ }
+ avpriv_set_pts_info(st, 64, 185, vid->sample_rate);
+ st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
+ st->codec->codec_id = AV_CODEC_ID_BETHSOFTVID;
+ st->codec->width = vid->width;
+ st->codec->height = vid->height;
+ }
+ st = s->streams[vid->video_index];
+ npixels = st->codec->width * st->codec->height;
vidbuf_start = av_malloc(vidbuf_capacity = BUFFER_PADDING_SIZE);
if(!vidbuf_start)
@@ -117,13 +129,15 @@ static int read_frame(BVID_DemuxContext *vid, AVIOContext *pb, AVPacket *pkt,
vidbuf_start[vidbuf_nbytes++] = block_type;
- // get the video delay (next int16), and set the presentation time
- vid->video_pts += vid->bethsoft_global_delay + avio_rl16(pb);
+ // get the current packet duration
+ duration = vid->bethsoft_global_delay + avio_rl16(pb);
// set the y offset if it exists (decoder header data should be in data section)
if(block_type == VIDEO_YOFF_P_FRAME){
- if(avio_read(pb, &vidbuf_start[vidbuf_nbytes], 2) != 2)
+ if (avio_read(pb, &vidbuf_start[vidbuf_nbytes], 2) != 2) {
+ ret = AVERROR(EIO);
goto fail;
+ }
vidbuf_nbytes += 2;
}
@@ -139,8 +153,10 @@ static int read_frame(BVID_DemuxContext *vid, AVIOContext *pb, AVPacket *pkt,
if(block_type == VIDEO_I_FRAME)
vidbuf_start[vidbuf_nbytes++] = avio_r8(pb);
} else if(code){ // plain sequence
- if(avio_read(pb, &vidbuf_start[vidbuf_nbytes], code) != code)
+ if (avio_read(pb, &vidbuf_start[vidbuf_nbytes], code) != code) {
+ ret = AVERROR(EIO);
goto fail;
+ }
vidbuf_nbytes += code;
}
bytes_copied += code & 0x7F;
@@ -150,25 +166,37 @@ static int read_frame(BVID_DemuxContext *vid, AVIOContext *pb, AVPacket *pkt,
avio_seek(pb, -1, SEEK_CUR);
break;
}
- if(bytes_copied > npixels)
+ if (bytes_copied > npixels) {
+ ret = AVERROR_INVALIDDATA;
goto fail;
+ }
} while(code);
// copy data into packet
- if(av_new_packet(pkt, vidbuf_nbytes) < 0)
+ if ((ret = av_new_packet(pkt, vidbuf_nbytes)) < 0)
goto fail;
memcpy(pkt->data, vidbuf_start, vidbuf_nbytes);
av_free(vidbuf_start);
pkt->pos = position;
- pkt->stream_index = 0; // use the video decoder, which was initialized as the first stream
- pkt->pts = vid->video_pts;
+ pkt->stream_index = vid->video_index;
+ pkt->duration = duration;
+ if (block_type == VIDEO_I_FRAME)
+ pkt->flags |= AV_PKT_FLAG_KEY;
+
+ /* if there is a new palette available, add it to packet side data */
+ if (vid->palette) {
+ uint8_t *pdata = av_packet_new_side_data(pkt, AV_PKT_DATA_PALETTE,
+ BVID_PALETTE_SIZE);
+ memcpy(pdata, vid->palette, BVID_PALETTE_SIZE);
+ av_freep(&vid->palette);
+ }
vid->nframes--; // used to check if all the frames were read
- return vidbuf_nbytes;
+ return 0;
fail:
av_free(vidbuf_start);
- return -1;
+ return ret;
}
static int vid_read_packet(AVFormatContext *s,
@@ -186,31 +214,55 @@ static int vid_read_packet(AVFormatContext *s,
block_type = avio_r8(pb);
switch(block_type){
case PALETTE_BLOCK:
- avio_seek(pb, -1, SEEK_CUR); // include block type
- ret_value = av_get_packet(pb, pkt, 3 * 256 + 1);
- if(ret_value != 3 * 256 + 1){
- av_free_packet(pkt);
+ if (vid->palette) {
+ av_log(s, AV_LOG_WARNING, "discarding unused palette\n");
+ av_freep(&vid->palette);
+ }
+ vid->palette = av_malloc(BVID_PALETTE_SIZE);
+ if (!vid->palette)
+ return AVERROR(ENOMEM);
+ if (avio_read(pb, vid->palette, BVID_PALETTE_SIZE) != BVID_PALETTE_SIZE) {
+ av_freep(&vid->palette);
return AVERROR(EIO);
}
- pkt->stream_index = 0;
- return ret_value;
+ return vid_read_packet(s, pkt);
case FIRST_AUDIO_BLOCK:
avio_rl16(pb);
// soundblaster DAC used for sample rate, as on specification page (link above)
- s->streams[1]->codec->sample_rate = 1000000 / (256 - avio_r8(pb));
- s->streams[1]->codec->bit_rate = s->streams[1]->codec->channels * s->streams[1]->codec->sample_rate * s->streams[1]->codec->bits_per_coded_sample;
+ vid->sample_rate = 1000000 / (256 - avio_r8(pb));
case AUDIO_BLOCK:
+ if (vid->audio_index < 0) {
+ AVStream *st = avformat_new_stream(s, NULL);
+ if (!st)
+ return AVERROR(ENOMEM);
+ vid->audio_index = st->index;
+ st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
+ st->codec->codec_id = AV_CODEC_ID_PCM_U8;
+ st->codec->channels = 1;
+ st->codec->channel_layout = AV_CH_LAYOUT_MONO;
+ st->codec->bits_per_coded_sample = 8;
+ st->codec->sample_rate = vid->sample_rate;
+ st->codec->bit_rate = 8 * st->codec->sample_rate;
+ st->start_time = 0;
+ avpriv_set_pts_info(st, 64, 1, vid->sample_rate);
+ }
audio_length = avio_rl16(pb);
- ret_value = av_get_packet(pb, pkt, audio_length);
- pkt->stream_index = 1;
- return ret_value != audio_length ? AVERROR(EIO) : ret_value;
+ if ((ret_value = av_get_packet(pb, pkt, audio_length)) != audio_length) {
+ if (ret_value < 0)
+ return ret_value;
+ av_log(s, AV_LOG_ERROR, "incomplete audio block\n");
+ return AVERROR(EIO);
+ }
+ pkt->stream_index = vid->audio_index;
+ pkt->duration = audio_length;
+ pkt->flags |= AV_PKT_FLAG_KEY;
+ return 0;
case VIDEO_P_FRAME:
case VIDEO_YOFF_P_FRAME:
case VIDEO_I_FRAME:
- return read_frame(vid, pb, pkt, block_type, s,
- s->streams[0]->codec->width * s->streams[0]->codec->height);
+ return read_frame(vid, pb, pkt, block_type, s);
case EOF_BLOCK:
if(vid->nframes != 0)
@@ -219,15 +271,24 @@ static int vid_read_packet(AVFormatContext *s,
return AVERROR(EIO);
default:
av_log(s, AV_LOG_ERROR, "unknown block (character = %c, decimal = %d, hex = %x)!!!\n",
- block_type, block_type, block_type); return -1;
+ block_type, block_type, block_type);
+ return AVERROR_INVALIDDATA;
}
}
+static int vid_read_close(AVFormatContext *s)
+{
+ BVID_DemuxContext *vid = s->priv_data;
+ av_freep(&vid->palette);
+ return 0;
+}
+
AVInputFormat ff_bethsoftvid_demuxer = {
.name = "bethsoftvid",
- .long_name = NULL_IF_CONFIG_SMALL("Bethesda Softworks VID format"),
+ .long_name = NULL_IF_CONFIG_SMALL("Bethesda Softworks VID"),
.priv_data_size = sizeof(BVID_DemuxContext),
.read_probe = vid_probe,
.read_header = vid_read_header,
.read_packet = vid_read_packet,
+ .read_close = vid_read_close,
};
diff --git a/gst-libs/ext/libav/libavformat/bfi.c b/gst-libs/ext/libav/libavformat/bfi.c
index bb02e85..e60bbf4 100644
--- a/gst-libs/ext/libav/libavformat/bfi.c
+++ b/gst-libs/ext/libav/libavformat/bfi.c
@@ -26,6 +26,7 @@
* @see http://wiki.multimedia.cx/index.php?title=BFI
*/
+#include "libavutil/channel_layout.h"
#include "libavutil/intreadwrite.h"
#include "avformat.h"
#include "internal.h"
@@ -47,7 +48,7 @@ static int bfi_probe(AVProbeData * p)
return 0;
}
-static int bfi_read_header(AVFormatContext * s, AVFormatParameters * ap)
+static int bfi_read_header(AVFormatContext * s)
{
BFIContext *bfi = s->priv_data;
AVIOContext *pb = s->pb;
@@ -89,13 +90,14 @@ static int bfi_read_header(AVFormatContext * s, AVFormatParameters * ap)
/* Set up the video codec... */
avpriv_set_pts_info(vstream, 32, 1, fps);
vstream->codec->codec_type = AVMEDIA_TYPE_VIDEO;
- vstream->codec->codec_id = CODEC_ID_BFI;
- vstream->codec->pix_fmt = PIX_FMT_PAL8;
+ vstream->codec->codec_id = AV_CODEC_ID_BFI;
+ vstream->codec->pix_fmt = AV_PIX_FMT_PAL8;
/* Set up the audio codec now... */
astream->codec->codec_type = AVMEDIA_TYPE_AUDIO;
- astream->codec->codec_id = CODEC_ID_PCM_U8;
+ astream->codec->codec_id = AV_CODEC_ID_PCM_U8;
astream->codec->channels = 1;
+ astream->codec->channel_layout = AV_CH_LAYOUT_MONO;
astream->codec->bits_per_coded_sample = 8;
astream->codec->bit_rate =
astream->codec->sample_rate * astream->codec->bits_per_coded_sample;
diff --git a/gst-libs/ext/libav/libavformat/bink.c b/gst-libs/ext/libav/libavformat/bink.c
index ecf6905..5d3de14 100644
--- a/gst-libs/ext/libav/libavformat/bink.c
+++ b/gst-libs/ext/libav/libavformat/bink.c
@@ -28,6 +28,7 @@
* http://wiki.multimedia.cx/index.php?title=Bink_Container
*/
+#include "libavutil/channel_layout.h"
#include "libavutil/intreadwrite.h"
#include "avformat.h"
#include "internal.h"
@@ -68,7 +69,7 @@ static int probe(AVProbeData *p)
return 0;
}
-static int read_header(AVFormatContext *s, AVFormatParameters *ap)
+static int read_header(AVFormatContext *s)
{
BinkDemuxContext *bink = s->priv_data;
AVIOContext *pb = s->pb;
@@ -113,7 +114,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap)
avpriv_set_pts_info(vst, 64, fps_den, fps_num);
vst->codec->codec_type = AVMEDIA_TYPE_VIDEO;
- vst->codec->codec_id = CODEC_ID_BINKVIDEO;
+ vst->codec->codec_id = AV_CODEC_ID_BINKVIDEO;
vst->codec->extradata = av_mallocz(4 + FF_INPUT_BUFFER_PADDING_SIZE);
vst->codec->extradata_size = 4;
avio_read(pb, vst->codec->extradata, 4);
@@ -140,8 +141,14 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap)
avpriv_set_pts_info(ast, 64, 1, ast->codec->sample_rate);
flags = avio_rl16(pb);
ast->codec->codec_id = flags & BINK_AUD_USEDCT ?
- CODEC_ID_BINKAUDIO_DCT : CODEC_ID_BINKAUDIO_RDFT;
- ast->codec->channels = flags & BINK_AUD_STEREO ? 2 : 1;
+ AV_CODEC_ID_BINKAUDIO_DCT : AV_CODEC_ID_BINKAUDIO_RDFT;
+ if (flags & BINK_AUD_STEREO) {
+ ast->codec->channels = 2;
+ ast->codec->channel_layout = AV_CH_LAYOUT_STEREO;
+ } else {
+ ast->codec->channels = 1;
+ ast->codec->channel_layout = AV_CH_LAYOUT_MONO;
+ }
ast->codec->extradata = av_mallocz(4 + FF_INPUT_BUFFER_PADDING_SIZE);
if (!ast->codec->extradata)
return AVERROR(ENOMEM);
@@ -257,7 +264,9 @@ static int read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, in
return -1;
/* seek to the first frame */
- avio_seek(s->pb, vst->index_entries[0].pos, SEEK_SET);
+ if (avio_seek(s->pb, vst->index_entries[0].pos, SEEK_SET) < 0)
+ return -1;
+
bink->video_pts = 0;
memset(bink->audio_pts, 0, sizeof(bink->audio_pts));
bink->current_track = -1;
diff --git a/gst-libs/ext/libav/libavformat/bmv.c b/gst-libs/ext/libav/libavformat/bmv.c
index 1077efa..ce157e8 100644
--- a/gst-libs/ext/libav/libavformat/bmv.c
+++ b/gst-libs/ext/libav/libavformat/bmv.c
@@ -19,6 +19,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "libavutil/channel_layout.h"
#include "avformat.h"
#include "internal.h"
@@ -38,7 +39,7 @@ typedef struct BMVContext {
int64_t audio_pos;
} BMVContext;
-static int bmv_read_header(AVFormatContext *s, AVFormatParameters *ap)
+static int bmv_read_header(AVFormatContext *s)
{
AVStream *st, *ast;
BMVContext *c = s->priv_data;
@@ -47,17 +48,18 @@ static int bmv_read_header(AVFormatContext *s, AVFormatParameters *ap)
if (!st)
return AVERROR(ENOMEM);
st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
- st->codec->codec_id = CODEC_ID_BMV_VIDEO;
+ st->codec->codec_id = AV_CODEC_ID_BMV_VIDEO;
st->codec->width = 640;
st->codec->height = 429;
- st->codec->pix_fmt = PIX_FMT_PAL8;
+ st->codec->pix_fmt = AV_PIX_FMT_PAL8;
avpriv_set_pts_info(st, 16, 1, 12);
ast = avformat_new_stream(s, 0);
if (!ast)
return AVERROR(ENOMEM);
ast->codec->codec_type = AVMEDIA_TYPE_AUDIO;
- ast->codec->codec_id = CODEC_ID_BMV_AUDIO;
+ ast->codec->codec_id = AV_CODEC_ID_BMV_AUDIO;
ast->codec->channels = 2;
+ ast->codec->channel_layout = AV_CH_LAYOUT_STEREO;
ast->codec->sample_rate = 22050;
avpriv_set_pts_info(ast, 16, 1, 22050);
@@ -133,5 +135,5 @@ AVInputFormat ff_bmv_demuxer = {
.read_header = bmv_read_header,
.read_packet = bmv_read_packet,
.read_close = bmv_read_close,
- .extensions = "bmv"
+ .extensions = "bmv",
};
diff --git a/gst-libs/ext/libav/libavformat/c93.c b/gst-libs/ext/libav/libavformat/c93.c
index d82086d..3f2a98f 100644
--- a/gst-libs/ext/libav/libavformat/c93.c
+++ b/gst-libs/ext/libav/libavformat/c93.c
@@ -57,8 +57,7 @@ static int probe(AVProbeData *p)
return AVPROBE_SCORE_MAX;
}
-static int read_header(AVFormatContext *s,
- AVFormatParameters *ap)
+static int read_header(AVFormatContext *s)
{
AVStream *video;
AVIOContext *pb = s->pb;
@@ -85,7 +84,7 @@ static int read_header(AVFormatContext *s,
return AVERROR(ENOMEM);
video->codec->codec_type = AVMEDIA_TYPE_VIDEO;
- video->codec->codec_id = CODEC_ID_C93;
+ video->codec->codec_id = AV_CODEC_ID_C93;
video->codec->width = 320;
video->codec->height = 192;
/* 4:3 320x200 with 8 empty lines */
@@ -124,7 +123,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
c93->audio->codec->codec_type = AVMEDIA_TYPE_AUDIO;
}
avio_skip(pb, 26); /* VOC header */
- ret = voc_get_packet(s, pkt, c93->audio, datasize - 26);
+ ret = ff_voc_get_packet(s, pkt, c93->audio, datasize - 26);
if (ret > 0) {
pkt->stream_index = 1;
pkt->flags |= AV_PKT_FLAG_KEY;
diff --git a/gst-libs/ext/libav/libavformat/caf.c b/gst-libs/ext/libav/libavformat/caf.c
index c204c90..cf128d5 100644
--- a/gst-libs/ext/libav/libavformat/caf.c
+++ b/gst-libs/ext/libav/libavformat/caf.c
@@ -32,27 +32,27 @@
* Known codec tags for CAF
*/
const AVCodecTag ff_codec_caf_tags[] = {
- { CODEC_ID_AAC, MKBETAG('a','a','c',' ') },
- { CODEC_ID_AC3, MKBETAG('a','c','-','3') },
- { CODEC_ID_ALAC, MKBETAG('a','l','a','c') },
+ { AV_CODEC_ID_AAC, MKBETAG('a','a','c',' ') },
+ { AV_CODEC_ID_AC3, MKBETAG('a','c','-','3') },
+ { AV_CODEC_ID_ALAC, MKBETAG('a','l','a','c') },
/* FIXME: use DV demuxer, as done in MOV */
- /*{ CODEC_ID_DVAUDIO, MKBETAG('v','d','v','a') },*/
- /*{ CODEC_ID_DVAUDIO, MKBETAG('d','v','c','a') },*/
- { CODEC_ID_ADPCM_IMA_QT, MKBETAG('i','m','a','4') },
- { CODEC_ID_MACE3, MKBETAG('M','A','C','3') },
- { CODEC_ID_MACE6, MKBETAG('M','A','C','6') },
- { CODEC_ID_MP3, MKBETAG('.','m','p','3') },
- { CODEC_ID_MP2, MKBETAG('.','m','p','2') },
- { CODEC_ID_MP1, MKBETAG('.','m','p','1') },
- { CODEC_ID_PCM_ALAW, MKBETAG('a','l','a','w') },
- { CODEC_ID_PCM_MULAW, MKBETAG('u','l','a','w') },
- { CODEC_ID_QCELP, MKBETAG('Q','c','l','p') },
- { CODEC_ID_QDM2, MKBETAG('Q','D','M','2') },
- { CODEC_ID_QDM2, MKBETAG('Q','D','M','C') },
+ /*{ AV_CODEC_ID_DVAUDIO, MKBETAG('v','d','v','a') },*/
+ /*{ AV_CODEC_ID_DVAUDIO, MKBETAG('d','v','c','a') },*/
+ { AV_CODEC_ID_ADPCM_IMA_QT, MKBETAG('i','m','a','4') },
+ { AV_CODEC_ID_MACE3, MKBETAG('M','A','C','3') },
+ { AV_CODEC_ID_MACE6, MKBETAG('M','A','C','6') },
+ { AV_CODEC_ID_MP3, MKBETAG('.','m','p','3') },
+ { AV_CODEC_ID_MP2, MKBETAG('.','m','p','2') },
+ { AV_CODEC_ID_MP1, MKBETAG('.','m','p','1') },
+ { AV_CODEC_ID_PCM_ALAW, MKBETAG('a','l','a','w') },
+ { AV_CODEC_ID_PCM_MULAW, MKBETAG('u','l','a','w') },
+ { AV_CODEC_ID_QCELP, MKBETAG('Q','c','l','p') },
+ { AV_CODEC_ID_QDM2, MKBETAG('Q','D','M','2') },
+ { AV_CODEC_ID_QDM2, MKBETAG('Q','D','M','C') },
/* currently unsupported codecs */
/*{ AC-3 over S/PDIF MKBETAG('c','a','c','3') },*/
/*{ MPEG4CELP MKBETAG('c','e','l','p') },*/
/*{ MPEG4HVXC MKBETAG('h','v','x','c') },*/
/*{ MPEG4TwinVQ MKBETAG('t','w','v','q') },*/
- { CODEC_ID_NONE, 0 },
+ { AV_CODEC_ID_NONE, 0 },
};
diff --git a/gst-libs/ext/libav/libavformat/cafdec.c b/gst-libs/ext/libav/libavformat/cafdec.c
index 4efc40f..6950eb2 100644
--- a/gst-libs/ext/libav/libavformat/cafdec.c
+++ b/gst-libs/ext/libav/libavformat/cafdec.c
@@ -27,8 +27,8 @@
#include "avformat.h"
#include "internal.h"
-#include "riff.h"
#include "isom.h"
+#include "mov_chan.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/intfloat.h"
#include "libavutil/dict.h"
@@ -102,7 +102,7 @@ static int read_kuki_chunk(AVFormatContext *s, int64_t size)
if (size < 0 || size > INT_MAX - FF_INPUT_BUFFER_PADDING_SIZE)
return -1;
- if (st->codec->codec_id == CODEC_ID_AAC) {
+ if (st->codec->codec_id == AV_CODEC_ID_AAC) {
/* The magic cookie format for AAC is an mp4 esds atom.
The lavc AAC decoder requires the data from the codec specific
description as extradata input. */
@@ -113,26 +113,48 @@ static int read_kuki_chunk(AVFormatContext *s, int64_t size)
ff_mov_read_esds(s, pb, atom);
skip = size - (avio_tell(pb) - strt);
if (skip < 0 || !st->codec->extradata ||
- st->codec->codec_id != CODEC_ID_AAC) {
+ st->codec->codec_id != AV_CODEC_ID_AAC) {
av_log(s, AV_LOG_ERROR, "invalid AAC magic cookie\n");
return AVERROR_INVALIDDATA;
}
avio_skip(pb, skip);
- } else if (st->codec->codec_id == CODEC_ID_ALAC) {
+ } else if (st->codec->codec_id == AV_CODEC_ID_ALAC) {
#define ALAC_PREAMBLE 12
#define ALAC_HEADER 36
- if (size < ALAC_PREAMBLE + ALAC_HEADER) {
+#define ALAC_NEW_KUKI 24
+ uint8_t preamble[12];
+ if (size < ALAC_NEW_KUKI) {
av_log(s, AV_LOG_ERROR, "invalid ALAC magic cookie\n");
avio_skip(pb, size);
return AVERROR_INVALIDDATA;
}
- avio_skip(pb, ALAC_PREAMBLE);
+ avio_read(pb, preamble, ALAC_PREAMBLE);
+
st->codec->extradata = av_mallocz(ALAC_HEADER + FF_INPUT_BUFFER_PADDING_SIZE);
if (!st->codec->extradata)
return AVERROR(ENOMEM);
- avio_read(pb, st->codec->extradata, ALAC_HEADER);
+
+ /* For the old style cookie, we skip 12 bytes, then read 36 bytes.
+ * The new style cookie only contains the last 24 bytes of what was
+ * 36 bytes in the old style cookie, so we fabricate the first 12 bytes
+ * in that case to maintain compatibility. */
+ if (!memcmp(&preamble[4], "frmaalac", 8)) {
+ if (size < ALAC_PREAMBLE + ALAC_HEADER) {
+ av_log(s, AV_LOG_ERROR, "invalid ALAC magic cookie\n");
+ av_freep(&st->codec->extradata);
+ return AVERROR_INVALIDDATA;
+ }
+ avio_read(pb, st->codec->extradata, ALAC_HEADER);
+ avio_skip(pb, size - ALAC_PREAMBLE - ALAC_HEADER);
+ } else {
+ AV_WB32(st->codec->extradata, 36);
+ memcpy(&st->codec->extradata[4], "alac", 4);
+ AV_WB32(&st->codec->extradata[8], 0);
+ memcpy(&st->codec->extradata[12], preamble, 12);
+ avio_read(pb, &st->codec->extradata[24], ALAC_NEW_KUKI - 12);
+ avio_skip(pb, size - ALAC_NEW_KUKI);
+ }
st->codec->extradata_size = ALAC_HEADER;
- avio_skip(pb, size - ALAC_PREAMBLE - ALAC_HEADER);
} else {
st->codec->extradata = av_mallocz(size + FF_INPUT_BUFFER_PADDING_SIZE);
if (!st->codec->extradata)
@@ -150,8 +172,8 @@ static int read_pakt_chunk(AVFormatContext *s, int64_t size)
AVIOContext *pb = s->pb;
AVStream *st = s->streams[0];
CaffContext *caf = s->priv_data;
- int64_t pos = 0, ccount;
- int num_packets, i;
+ int64_t pos = 0, ccount, num_packets;
+ int i;
ccount = avio_tell(pb);
@@ -170,10 +192,11 @@ static int read_pakt_chunk(AVFormatContext *s, int64_t size)
st->duration += caf->frames_per_packet ? caf->frames_per_packet : ff_mp4_read_descr_len(pb);
}
- if (avio_tell(pb) - ccount != size) {
+ if (avio_tell(pb) - ccount > size) {
av_log(s, AV_LOG_ERROR, "error reading packet table\n");
- return -1;
+ return AVERROR_INVALIDDATA;
}
+ avio_skip(pb, ccount + size - avio_tell(pb));
caf->num_bytes = pos;
return 0;
@@ -194,8 +217,7 @@ static void read_info_chunk(AVFormatContext *s, int64_t size)
}
}
-static int read_header(AVFormatContext *s,
- AVFormatParameters *ap)
+static int read_header(AVFormatContext *s)
{
AVIOContext *pb = s->pb;
CaffContext *caf = s->priv_data;
@@ -244,6 +266,11 @@ static int read_header(AVFormatContext *s,
found_data = 1;
break;
+ case MKBETAG('c','h','a','n'):
+ if ((ret = ff_mov_read_chan(s, s->pb, st, size)) < 0)
+ return ret;
+ break;
+
/* magic cookie chunk */
case MKBETAG('k','u','k','i'):
if (read_kuki_chunk(s, size))
@@ -359,7 +386,7 @@ static int read_seek(AVFormatContext *s, int stream_index,
{
AVStream *st = s->streams[0];
CaffContext *caf = s->priv_data;
- int64_t pos;
+ int64_t pos, packet_cnt, frame_cnt;
timestamp = FFMAX(timestamp, 0);
@@ -368,27 +395,32 @@ static int read_seek(AVFormatContext *s, int stream_index,
pos = caf->bytes_per_packet * timestamp / caf->frames_per_packet;
if (caf->data_size > 0)
pos = FFMIN(pos, caf->data_size);
- caf->packet_cnt = pos / caf->bytes_per_packet;
- caf->frame_cnt = caf->frames_per_packet * caf->packet_cnt;
+ packet_cnt = pos / caf->bytes_per_packet;
+ frame_cnt = caf->frames_per_packet * packet_cnt;
} else if (st->nb_index_entries) {
- caf->packet_cnt = av_index_search_timestamp(st, timestamp, flags);
- caf->frame_cnt = st->index_entries[caf->packet_cnt].timestamp;
- pos = st->index_entries[caf->packet_cnt].pos;
+ packet_cnt = av_index_search_timestamp(st, timestamp, flags);
+ frame_cnt = st->index_entries[packet_cnt].timestamp;
+ pos = st->index_entries[packet_cnt].pos;
} else {
return -1;
}
- avio_seek(s->pb, pos + caf->data_start, SEEK_SET);
+ if (avio_seek(s->pb, pos + caf->data_start, SEEK_SET) < 0)
+ return -1;
+
+ caf->packet_cnt = packet_cnt;
+ caf->frame_cnt = frame_cnt;
+
return 0;
}
AVInputFormat ff_caf_demuxer = {
.name = "caf",
- .long_name = NULL_IF_CONFIG_SMALL("Apple Core Audio Format"),
+ .long_name = NULL_IF_CONFIG_SMALL("Apple CAF (Core Audio Format)"),
.priv_data_size = sizeof(CaffContext),
.read_probe = probe,
.read_header = read_header,
.read_packet = read_packet,
.read_seek = read_seek,
- .codec_tag = (const AVCodecTag*[]){ff_codec_caf_tags, 0},
+ .codec_tag = (const AVCodecTag* const []){ ff_codec_caf_tags, 0 },
};
diff --git a/gst-libs/ext/libav/libavformat/cavsvideodec.c b/gst-libs/ext/libav/libavformat/cavsvideodec.c
index 9aa9413..ed9cdb2 100644
--- a/gst-libs/ext/libav/libavformat/cavsvideodec.c
+++ b/gst-libs/ext/libav/libavformat/cavsvideodec.c
@@ -65,4 +65,4 @@ static int cavsvideo_probe(AVProbeData *p)
return 0;
}
-FF_DEF_RAWVIDEO_DEMUXER(cavsvideo, "raw Chinese AVS video", cavsvideo_probe, NULL, CODEC_ID_CAVS)
+FF_DEF_RAWVIDEO_DEMUXER(cavsvideo, "raw Chinese AVS (Audio Video Standard)", cavsvideo_probe, NULL, AV_CODEC_ID_CAVS)
diff --git a/gst-libs/ext/libav/libavformat/cdg.c b/gst-libs/ext/libav/libavformat/cdg.c
index 0980df7..974880a 100644
--- a/gst-libs/ext/libav/libavformat/cdg.c
+++ b/gst-libs/ext/libav/libavformat/cdg.c
@@ -26,7 +26,7 @@
#define CDG_COMMAND 0x09
#define CDG_MASK 0x3F
-static int read_header(AVFormatContext *s, AVFormatParameters *ap)
+static int read_header(AVFormatContext *s)
{
AVStream *vst;
int ret;
@@ -36,7 +36,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap)
return AVERROR(ENOMEM);
vst->codec->codec_type = AVMEDIA_TYPE_VIDEO;
- vst->codec->codec_id = CODEC_ID_CDGRAPHICS;
+ vst->codec->codec_id = AV_CODEC_ID_CDGRAPHICS;
/// 75 sectors/sec * 4 packets/sector = 300 packets/sec
avpriv_set_pts_info(vst, 32, 1, 300);
@@ -65,8 +65,8 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
AVInputFormat ff_cdg_demuxer = {
.name = "cdg",
- .long_name = NULL_IF_CONFIG_SMALL("CD Graphics Format"),
+ .long_name = NULL_IF_CONFIG_SMALL("CD Graphics"),
.read_header = read_header,
.read_packet = read_packet,
- .extensions = "cdg"
+ .extensions = "cdg",
};
diff --git a/gst-libs/ext/libav/libavformat/cdxl.c b/gst-libs/ext/libav/libavformat/cdxl.c
new file mode 100644
index 0000000..a2cba52
--- /dev/null
+++ b/gst-libs/ext/libav/libavformat/cdxl.c
@@ -0,0 +1,188 @@
+/*
+ * CDXL demuxer
+ * Copyright (c) 2011-2012 Paul B Mahol
+ *
+ * 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
+ */
+
+#include "libavutil/channel_layout.h"
+#include "libavutil/intreadwrite.h"
+#include "libavutil/parseutils.h"
+#include "libavutil/opt.h"
+#include "avformat.h"
+#include "internal.h"
+
+#define CDXL_HEADER_SIZE 32
+
+typedef struct CDXLDemuxContext {
+ AVClass *class;
+ int sample_rate;
+ char *framerate;
+ AVRational fps;
+ int read_chunk;
+ uint8_t header[CDXL_HEADER_SIZE];
+ int video_stream_index;
+ int audio_stream_index;
+} CDXLDemuxContext;
+
+static int cdxl_read_header(AVFormatContext *s)
+{
+ CDXLDemuxContext *cdxl = s->priv_data;
+ int ret;
+
+ if (cdxl->framerate && (ret = av_parse_video_rate(&cdxl->fps, cdxl->framerate)) < 0) {
+ av_log(s, AV_LOG_ERROR,
+ "Could not parse framerate: %s.\n", cdxl->framerate);
+ return ret;
+ }
+
+ cdxl->read_chunk = 0;
+ cdxl->video_stream_index = -1;
+ cdxl->audio_stream_index = -1;
+
+ s->ctx_flags |= AVFMTCTX_NOHEADER;
+
+ return 0;
+}
+
+static int cdxl_read_packet(AVFormatContext *s, AVPacket *pkt)
+{
+ CDXLDemuxContext *cdxl = s->priv_data;
+ AVIOContext *pb = s->pb;
+ uint32_t current_size, video_size, image_size;
+ uint16_t audio_size, palette_size, width, height;
+ int64_t pos;
+ int ret;
+
+ if (pb->eof_reached)
+ return AVERROR_EOF;
+
+ pos = avio_tell(pb);
+ if (!cdxl->read_chunk &&
+ avio_read(pb, cdxl->header, CDXL_HEADER_SIZE) != CDXL_HEADER_SIZE)
+ return AVERROR_EOF;
+ if (cdxl->header[0] != 1) {
+ av_log(s, AV_LOG_ERROR, "non-standard cdxl file\n");
+ return AVERROR_INVALIDDATA;
+ }
+
+ current_size = AV_RB32(&cdxl->header[2]);
+ width = AV_RB16(&cdxl->header[14]);
+ height = AV_RB16(&cdxl->header[16]);
+ palette_size = AV_RB16(&cdxl->header[20]);
+ audio_size = AV_RB16(&cdxl->header[22]);
+ image_size = FFALIGN(width, 16) * height * cdxl->header[19] / 8;
+ video_size = palette_size + image_size;
+
+ if (palette_size > 512)
+ return AVERROR_INVALIDDATA;
+ if (current_size < (uint64_t)audio_size + video_size + CDXL_HEADER_SIZE)
+ return AVERROR_INVALIDDATA;
+
+ if (cdxl->read_chunk && audio_size) {
+ if (cdxl->audio_stream_index == -1) {
+ AVStream *st = avformat_new_stream(s, NULL);
+ if (!st)
+ return AVERROR(ENOMEM);
+
+ st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
+ st->codec->codec_tag = 0;
+ st->codec->codec_id = AV_CODEC_ID_PCM_S8;
+ if (cdxl->header[1] & 0x10) {
+ st->codec->channels = 2;
+ st->codec->channel_layout = AV_CH_LAYOUT_STEREO;
+ } else {
+ st->codec->channels = 1;
+ st->codec->channel_layout = AV_CH_LAYOUT_MONO;
+ }
+ st->codec->sample_rate = cdxl->sample_rate;
+ st->start_time = 0;
+ cdxl->audio_stream_index = st->index;
+ avpriv_set_pts_info(st, 64, 1, cdxl->sample_rate);
+ }
+
+ ret = av_get_packet(pb, pkt, audio_size);
+ if (ret < 0)
+ return ret;
+ pkt->stream_index = cdxl->audio_stream_index;
+ pkt->pos = pos;
+ pkt->duration = audio_size;
+ cdxl->read_chunk = 0;
+ } else {
+ if (cdxl->video_stream_index == -1) {
+ AVStream *st = avformat_new_stream(s, NULL);
+ if (!st)
+ return AVERROR(ENOMEM);
+
+ st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
+ st->codec->codec_tag = 0;
+ st->codec->codec_id = AV_CODEC_ID_CDXL;
+ st->codec->width = width;
+ st->codec->height = height;
+ st->start_time = 0;
+ cdxl->video_stream_index = st->index;
+ if (cdxl->framerate)
+ avpriv_set_pts_info(st, 64, cdxl->fps.den, cdxl->fps.num);
+ else
+ avpriv_set_pts_info(st, 64, 1, cdxl->sample_rate);
+ }
+
+ if (av_new_packet(pkt, video_size + CDXL_HEADER_SIZE) < 0)
+ return AVERROR(ENOMEM);
+ memcpy(pkt->data, cdxl->header, CDXL_HEADER_SIZE);
+ ret = avio_read(pb, pkt->data + CDXL_HEADER_SIZE, video_size);
+ if (ret < 0) {
+ av_free_packet(pkt);
+ return ret;
+ }
+ av_shrink_packet(pkt, CDXL_HEADER_SIZE + ret);
+ pkt->stream_index = cdxl->video_stream_index;
+ pkt->flags |= AV_PKT_FLAG_KEY;
+ pkt->pos = pos;
+ pkt->duration = cdxl->framerate ? 1 : audio_size ? audio_size : 220;
+ cdxl->read_chunk = audio_size;
+ }
+
+ if (!cdxl->read_chunk)
+ avio_skip(pb, current_size - audio_size - video_size - CDXL_HEADER_SIZE);
+ return ret;
+}
+
+#define OFFSET(x) offsetof(CDXLDemuxContext, x)
+static const AVOption cdxl_options[] = {
+ { "sample_rate", "", OFFSET(sample_rate), AV_OPT_TYPE_INT, { .i64 = 11025 }, 1, INT_MAX, AV_OPT_FLAG_DECODING_PARAM },
+ { "framerate", "", OFFSET(framerate), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, AV_OPT_FLAG_DECODING_PARAM },
+ { NULL },
+};
+
+static const AVClass cdxl_demuxer_class = {
+ .class_name = "CDXL demuxer",
+ .item_name = av_default_item_name,
+ .option = cdxl_options,
+ .version = LIBAVUTIL_VERSION_INT,
+};
+
+AVInputFormat ff_cdxl_demuxer = {
+ .name = "cdxl",
+ .long_name = NULL_IF_CONFIG_SMALL("Commodore CDXL video"),
+ .priv_data_size = sizeof(CDXLDemuxContext),
+ .read_header = cdxl_read_header,
+ .read_packet = cdxl_read_packet,
+ .extensions = "cdxl,xl",
+ .flags = AVFMT_GENERIC_INDEX,
+ .priv_class = &cdxl_demuxer_class,
+};
diff --git a/gst-libs/ext/libav/libavformat/crcenc.c b/gst-libs/ext/libav/libavformat/crcenc.c
index c67fd09..3b30cc9 100644
--- a/gst-libs/ext/libav/libavformat/crcenc.c
+++ b/gst-libs/ext/libav/libavformat/crcenc.c
@@ -50,17 +50,17 @@ static int crc_write_trailer(struct AVFormatContext *s)
snprintf(buf, sizeof(buf), "CRC=0x%08x\n", crc->crcval);
avio_write(s->pb, buf, strlen(buf));
- avio_flush(s->pb);
+
return 0;
}
AVOutputFormat ff_crc_muxer = {
.name = "crc",
- .long_name = NULL_IF_CONFIG_SMALL("CRC testing format"),
+ .long_name = NULL_IF_CONFIG_SMALL("CRC testing"),
.extensions = "",
.priv_data_size = sizeof(CRCState),
- .audio_codec = CODEC_ID_PCM_S16LE,
- .video_codec = CODEC_ID_RAWVIDEO,
+ .audio_codec = AV_CODEC_ID_PCM_S16LE,
+ .video_codec = AV_CODEC_ID_RAWVIDEO,
.write_header = crc_write_header,
.write_packet = crc_write_packet,
.write_trailer = crc_write_trailer,
diff --git a/gst-libs/ext/libav/libavformat/crypto.c b/gst-libs/ext/libav/libavformat/crypto.c
index 7095360..3bc33f2 100644
--- a/gst-libs/ext/libav/libavformat/crypto.c
+++ b/gst-libs/ext/libav/libavformat/crypto.c
@@ -48,7 +48,7 @@ typedef struct {
#define D AV_OPT_FLAG_DECODING_PARAM
static const AVOption options[] = {
{"key", "AES decryption key", OFFSET(key), AV_OPT_TYPE_BINARY, .flags = D },
- {"iv", "AES decryption initialization vector", OFFSET(iv), AV_OPT_TYPE_BINARY, .flags = D },
+ {"iv", "AES decryption initialization vector", OFFSET(iv), AV_OPT_TYPE_BINARY, .flags = D },
{ NULL }
};
@@ -87,7 +87,7 @@ static int crypto_open(URLContext *h, const char *uri, int flags)
av_log(h, AV_LOG_ERROR, "Unable to open input\n");
goto err;
}
- c->aes = av_mallocz(av_aes_size);
+ c->aes = av_aes_alloc();
if (!c->aes) {
ret = AVERROR(ENOMEM);
goto err;
diff --git a/gst-libs/ext/libav/libavformat/cutils.c b/gst-libs/ext/libav/libavformat/cutils.c
index 9955244..f58e152 100644
--- a/gst-libs/ext/libav/libavformat/cutils.c
+++ b/gst-libs/ext/libav/libavformat/cutils.c
@@ -47,7 +47,7 @@ void ff_dynarray_add(intptr_t **tab_ptr, int *nb_ptr, intptr_t elem)
/* This is our own gmtime_r. It differs from its POSIX counterpart in a
couple of places, though. */
-struct tm *brktimegm(time_t secs, struct tm *tm)
+struct tm *ff_brktimegm(time_t secs, struct tm *tm)
{
int days, y, ny, m;
int md[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
diff --git a/gst-libs/ext/libav/libavformat/daud.c b/gst-libs/ext/libav/libavformat/daud.c
index 9deca33..3ceb958 100644
--- a/gst-libs/ext/libav/libavformat/daud.c
+++ b/gst-libs/ext/libav/libavformat/daud.c
@@ -18,16 +18,19 @@
* License along with Libav; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+
+#include "libavutil/channel_layout.h"
#include "avformat.h"
-static int daud_header(AVFormatContext *s, AVFormatParameters *ap) {
+static int daud_header(AVFormatContext *s) {
AVStream *st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
- st->codec->codec_id = CODEC_ID_PCM_S24DAUD;
+ st->codec->codec_id = AV_CODEC_ID_PCM_S24DAUD;
st->codec->codec_tag = MKTAG('d', 'a', 'u', 'd');
st->codec->channels = 6;
+ st->codec->channel_layout = AV_CH_LAYOUT_5POINT1;
st->codec->sample_rate = 96000;
st->codec->bit_rate = 3 * 6 * 96000 * 8;
st->codec->block_align = 3 * 6;
@@ -72,20 +75,20 @@ static int daud_write_packet(struct AVFormatContext *s, AVPacket *pkt)
#if CONFIG_DAUD_DEMUXER
AVInputFormat ff_daud_demuxer = {
.name = "daud",
- .long_name = NULL_IF_CONFIG_SMALL("D-Cinema audio format"),
+ .long_name = NULL_IF_CONFIG_SMALL("D-Cinema audio"),
.read_header = daud_header,
.read_packet = daud_packet,
- .extensions = "302",
+ .extensions = "302",
};
#endif
#if CONFIG_DAUD_MUXER
AVOutputFormat ff_daud_muxer = {
.name = "daud",
- .long_name = NULL_IF_CONFIG_SMALL("D-Cinema audio format"),
+ .long_name = NULL_IF_CONFIG_SMALL("D-Cinema audio"),
.extensions = "302",
- .audio_codec = CODEC_ID_PCM_S24DAUD,
- .video_codec = CODEC_ID_NONE,
+ .audio_codec = AV_CODEC_ID_PCM_S24DAUD,
+ .video_codec = AV_CODEC_ID_NONE,
.write_header = daud_write_header,
.write_packet = daud_write_packet,
.flags = AVFMT_NOTIMESTAMPS,
diff --git a/gst-libs/ext/libav/libavformat/dfa.c b/gst-libs/ext/libav/libavformat/dfa.c
index ac49b61..fa32d1f 100644
--- a/gst-libs/ext/libav/libavformat/dfa.c
+++ b/gst-libs/ext/libav/libavformat/dfa.c
@@ -31,8 +31,7 @@ static int dfa_probe(AVProbeData *p)
return AVPROBE_SCORE_MAX;
}
-static int dfa_read_header(AVFormatContext *s,
- AVFormatParameters *ap)
+static int dfa_read_header(AVFormatContext *s)
{
AVIOContext *pb = s->pb;
AVStream *st;
@@ -51,7 +50,7 @@ static int dfa_read_header(AVFormatContext *s,
return AVERROR(ENOMEM);
st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
- st->codec->codec_id = CODEC_ID_DFA;
+ st->codec->codec_id = AV_CODEC_ID_DFA;
st->codec->width = avio_rl16(pb);
st->codec->height = avio_rl16(pb);
mspf = avio_rl32(pb);
@@ -115,5 +114,5 @@ AVInputFormat ff_dfa_demuxer = {
.read_probe = dfa_probe,
.read_header = dfa_read_header,
.read_packet = dfa_read_packet,
- .flags = AVFMT_GENERIC_INDEX,
+ .flags = AVFMT_GENERIC_INDEX,
};
diff --git a/gst-libs/ext/libav/libavformat/diracdec.c b/gst-libs/ext/libav/libavformat/diracdec.c
index 8cbd5b5..f275212 100644
--- a/gst-libs/ext/libav/libavformat/diracdec.c
+++ b/gst-libs/ext/libav/libavformat/diracdec.c
@@ -31,4 +31,4 @@ static int dirac_probe(AVProbeData *p)
return 0;
}
-FF_DEF_RAWVIDEO_DEMUXER(dirac, "raw Dirac", dirac_probe, NULL, CODEC_ID_DIRAC)
+FF_DEF_RAWVIDEO_DEMUXER(dirac, "raw Dirac", dirac_probe, NULL, AV_CODEC_ID_DIRAC)
diff --git a/gst-libs/ext/libav/libavformat/dnxhddec.c b/gst-libs/ext/libav/libavformat/dnxhddec.c
index 2aa8017..8bb6814 100644
--- a/gst-libs/ext/libav/libavformat/dnxhddec.c
+++ b/gst-libs/ext/libav/libavformat/dnxhddec.c
@@ -42,4 +42,4 @@ static int dnxhd_probe(AVProbeData *p)
return AVPROBE_SCORE_MAX;
}
-FF_DEF_RAWVIDEO_DEMUXER(dnxhd, "raw DNxHD (SMPTE VC-3)", dnxhd_probe, NULL, CODEC_ID_DNXHD)
+FF_DEF_RAWVIDEO_DEMUXER(dnxhd, "raw DNxHD (SMPTE VC-3)", dnxhd_probe, NULL, AV_CODEC_ID_DNXHD)
diff --git a/gst-libs/ext/libav/libavformat/dsicin.c b/gst-libs/ext/libav/libavformat/dsicin.c
index 801ca6a..ecc8c0b 100644
--- a/gst-libs/ext/libav/libavformat/dsicin.c
+++ b/gst-libs/ext/libav/libavformat/dsicin.c
@@ -24,6 +24,7 @@
* Delphine Software International CIN file demuxer
*/
+#include "libavutil/channel_layout.h"
#include "libavutil/intreadwrite.h"
#include "avformat.h"
#include "internal.h"
@@ -91,7 +92,7 @@ static int cin_read_file_header(CinDemuxContext *cin, AVIOContext *pb) {
return 0;
}
-static int cin_read_header(AVFormatContext *s, AVFormatParameters *ap)
+static int cin_read_header(AVFormatContext *s)
{
int rc;
CinDemuxContext *cin = s->priv_data;
@@ -115,7 +116,7 @@ static int cin_read_header(AVFormatContext *s, AVFormatParameters *ap)
avpriv_set_pts_info(st, 32, 1, 12);
cin->video_stream_index = st->index;
st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
- st->codec->codec_id = CODEC_ID_DSICINVIDEO;
+ st->codec->codec_id = AV_CODEC_ID_DSICINVIDEO;
st->codec->codec_tag = 0; /* no fourcc */
st->codec->width = hdr->video_frame_width;
st->codec->height = hdr->video_frame_height;
@@ -128,9 +129,10 @@ static int cin_read_header(AVFormatContext *s, AVFormatParameters *ap)
avpriv_set_pts_info(st, 32, 1, 22050);
cin->audio_stream_index = st->index;
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
- st->codec->codec_id = CODEC_ID_DSICINAUDIO;
+ st->codec->codec_id = AV_CODEC_ID_DSICINAUDIO;
st->codec->codec_tag = 0; /* no tag */
st->codec->channels = 1;
+ st->codec->channel_layout = AV_CH_LAYOUT_MONO;
st->codec->sample_rate = 22050;
st->codec->bits_per_coded_sample = 8;
st->codec->bit_rate = st->codec->sample_rate * st->codec->bits_per_coded_sample * st->codec->channels;
@@ -219,7 +221,7 @@ static int cin_read_packet(AVFormatContext *s, AVPacket *pkt)
AVInputFormat ff_dsicin_demuxer = {
.name = "dsicin",
- .long_name = NULL_IF_CONFIG_SMALL("Delphine Software International CIN format"),
+ .long_name = NULL_IF_CONFIG_SMALL("Delphine Software International CIN"),
.priv_data_size = sizeof(CinDemuxContext),
.read_probe = cin_probe,
.read_header = cin_read_header,
diff --git a/gst-libs/ext/libav/libavformat/dtsdec.c b/gst-libs/ext/libav/libavformat/dtsdec.c
index d61855d..28cccd3 100644
--- a/gst-libs/ext/libav/libavformat/dtsdec.c
+++ b/gst-libs/ext/libav/libavformat/dtsdec.c
@@ -71,7 +71,7 @@ AVInputFormat ff_dts_demuxer = {
.read_probe = dts_probe,
.read_header = ff_raw_audio_read_header,
.read_packet = ff_raw_read_partial_packet,
- .flags= AVFMT_GENERIC_INDEX,
- .extensions = "dts",
- .value = CODEC_ID_DTS,
+ .flags = AVFMT_GENERIC_INDEX,
+ .extensions = "dts",
+ .raw_codec_id = AV_CODEC_ID_DTS,
};
diff --git a/gst-libs/ext/libav/libavformat/dv.c b/gst-libs/ext/libav/libavformat/dv.c
index 65d0f87..1730972 100644
--- a/gst-libs/ext/libav/libavformat/dv.c
+++ b/gst-libs/ext/libav/libavformat/dv.c
@@ -31,7 +31,9 @@
#include <time.h>
#include "avformat.h"
#include "internal.h"
+#include "libavcodec/dv_profile.h"
#include "libavcodec/dvdata.h"
+#include "libavutil/channel_layout.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/mathematics.h"
#include "dv.h"
@@ -94,6 +96,10 @@ static const uint8_t* dv_extract_pack(uint8_t* frame, enum dv_pack_type t)
return frame[offs] == t ? &frame[offs] : NULL;
}
+static const int dv_audio_frequency[3] = {
+ 48000, 44100, 32000,
+};
+
/*
* There's a couple of assumptions being made here:
* 1. By default we silence erroneous (0x8000/16bit 0x800/12bit) audio samples.
@@ -225,24 +231,25 @@ static int dv_extract_audio_info(DVDemuxContext* c, uint8_t* frame)
/* Dynamic handling of the audio streams in DV */
for (i = 0; i < ach; i++) {
- if (!c->ast[i]) {
- c->ast[i] = avformat_new_stream(c->fctx, NULL);
- if (!c->ast[i])
- break;
- avpriv_set_pts_info(c->ast[i], 64, 1, 30000);
- c->ast[i]->codec->codec_type = AVMEDIA_TYPE_AUDIO;
- c->ast[i]->codec->codec_id = CODEC_ID_PCM_S16LE;
-
- av_init_packet(&c->audio_pkt[i]);
- c->audio_pkt[i].size = 0;
- c->audio_pkt[i].data = c->audio_buf[i];
- c->audio_pkt[i].stream_index = c->ast[i]->index;
- c->audio_pkt[i].flags |= AV_PKT_FLAG_KEY;
- }
- c->ast[i]->codec->sample_rate = dv_audio_frequency[freq];
- c->ast[i]->codec->channels = 2;
- c->ast[i]->codec->bit_rate = 2 * dv_audio_frequency[freq] * 16;
- c->ast[i]->start_time = 0;
+ if (!c->ast[i]) {
+ c->ast[i] = avformat_new_stream(c->fctx, NULL);
+ if (!c->ast[i])
+ break;
+ avpriv_set_pts_info(c->ast[i], 64, 1, 30000);
+ c->ast[i]->codec->codec_type = AVMEDIA_TYPE_AUDIO;
+ c->ast[i]->codec->codec_id = AV_CODEC_ID_PCM_S16LE;
+
+ av_init_packet(&c->audio_pkt[i]);
+ c->audio_pkt[i].size = 0;
+ c->audio_pkt[i].data = c->audio_buf[i];
+ c->audio_pkt[i].stream_index = c->ast[i]->index;
+ c->audio_pkt[i].flags |= AV_PKT_FLAG_KEY;
+ }
+ c->ast[i]->codec->sample_rate = dv_audio_frequency[freq];
+ c->ast[i]->codec->channels = 2;
+ c->ast[i]->codec->channel_layout = AV_CH_LAYOUT_STEREO;
+ c->ast[i]->codec->bit_rate = 2 * dv_audio_frequency[freq] * 16;
+ c->ast[i]->start_time = 0;
}
c->ach = i;
@@ -260,7 +267,7 @@ static int dv_extract_video_info(DVDemuxContext *c, uint8_t* frame)
avctx = c->vst->codec;
avpriv_set_pts_info(c->vst, 64, c->sys->time_base.num,
- c->sys->time_base.den);
+ c->sys->time_base.den);
avctx->time_base= c->sys->time_base;
if (!avctx->width){
avctx->width = c->sys->width;
@@ -272,7 +279,7 @@ static int dv_extract_video_info(DVDemuxContext *c, uint8_t* frame)
vsc_pack = dv_extract_pack(frame, dv_video_control);
apt = frame[4] & 0x07;
is16_9 = (vsc_pack && ((vsc_pack[2] & 0x07) == 0x02 ||
- (!apt && (vsc_pack[2] & 0x07) == 0x07)));
+ (!apt && (vsc_pack[2] & 0x07) == 0x07)));
c->vst->sample_aspect_ratio = c->sys->sar[is16_9];
avctx->bit_rate = av_rescale_q(c->sys->frame_size, (AVRational){8,1},
c->sys->time_base);
@@ -299,15 +306,9 @@ DVDemuxContext* avpriv_dv_init_demux(AVFormatContext *s)
return NULL;
}
- c->sys = NULL;
- c->fctx = s;
- memset(c->ast, 0, sizeof(c->ast));
- c->ach = 0;
- c->frames = 0;
- c->abytes = 0;
-
+ c->fctx = s;
c->vst->codec->codec_type = AVMEDIA_TYPE_VIDEO;
- c->vst->codec->codec_id = CODEC_ID_DVVIDEO;
+ c->vst->codec->codec_id = AV_CODEC_ID_DVVIDEO;
c->vst->codec->bit_rate = 25000000;
c->vst->start_time = 0;
@@ -320,12 +321,12 @@ int avpriv_dv_get_packet(DVDemuxContext *c, AVPacket *pkt)
int i;
for (i = 0; i < c->ach; i++) {
- if (c->ast[i] && c->audio_pkt[i].size) {
- *pkt = c->audio_pkt[i];
- c->audio_pkt[i].size = 0;
- size = pkt->size;
- break;
- }
+ if (c->ast[i] && c->audio_pkt[i].size) {
+ *pkt = c->audio_pkt[i];
+ c->audio_pkt[i].size = 0;
+ size = pkt->size;
+ break;
+ }
}
return size;
@@ -340,16 +341,16 @@ int avpriv_dv_produce_packet(DVDemuxContext *c, AVPacket *pkt,
if (buf_size < DV_PROFILE_BYTES ||
!(c->sys = avpriv_dv_frame_profile(c->sys, buf, buf_size)) ||
buf_size < c->sys->frame_size) {
- return -1; /* Broken frame, or not enough data */
+ return -1; /* Broken frame, or not enough data */
}
/* Queueing audio packet */
/* FIXME: in case of no audio/bad audio we have to do something */
size = dv_extract_audio_info(c, buf);
for (i = 0; i < c->ach; i++) {
- c->audio_pkt[i].size = size;
- c->audio_pkt[i].pts = c->abytes * 30000*8 / c->ast[i]->codec->bit_rate;
- ppcm[i] = c->audio_buf[i];
+ c->audio_pkt[i].size = size;
+ c->audio_pkt[i].pts = c->abytes * 30000 * 8 / c->ast[i]->codec->bit_rate;
+ ppcm[i] = c->audio_buf[i];
}
if (c->ach)
dv_extract_audio(buf, ppcm, c->sys);
@@ -373,7 +374,7 @@ int avpriv_dv_produce_packet(DVDemuxContext *c, AVPacket *pkt,
pkt->data = buf;
pkt->size = size;
pkt->flags |= AV_PKT_FLAG_KEY;
- pkt->stream_index = c->vst->id;
+ pkt->stream_index = c->vst->index;
pkt->pts = c->frames;
c->frames++;
@@ -398,7 +399,7 @@ static int64_t dv_frame_offset(AVFormatContext *s, DVDemuxContext *c,
return offset + s->data_offset;
}
-void dv_offset_reset(DVDemuxContext *c, int64_t frame_offset)
+void ff_dv_offset_reset(DVDemuxContext *c, int64_t frame_offset)
{
c->frames= frame_offset;
if (c->ach)
@@ -417,8 +418,7 @@ typedef struct RawDVContext {
uint8_t buf[DV_MAX_FRAME_SIZE];
} RawDVContext;
-static int dv_read_header(AVFormatContext *s,
- AVFormatParameters *ap)
+static int dv_read_header(AVFormatContext *s)
{
unsigned state, marker_pos = 0;
RawDVContext *c = s->priv_data;
@@ -488,10 +488,11 @@ static int dv_read_seek(AVFormatContext *s, int stream_index,
DVDemuxContext *c = r->dv_demux;
int64_t offset = dv_frame_offset(s, c, timestamp, flags);
- dv_offset_reset(c, offset / c->sys->frame_size);
+ if (avio_seek(s->pb, offset, SEEK_SET) < 0)
+ return -1;
- offset = avio_seek(s->pb, offset, SEEK_SET);
- return (offset < 0) ? offset : 0;
+ ff_dv_offset_reset(c, offset / c->sys->frame_size);
+ return 0;
}
static int dv_read_close(AVFormatContext *s)
@@ -537,13 +538,13 @@ static int dv_probe(AVProbeData *p)
#if CONFIG_DV_DEMUXER
AVInputFormat ff_dv_demuxer = {
.name = "dv",
- .long_name = NULL_IF_CONFIG_SMALL("DV video format"),
+ .long_name = NULL_IF_CONFIG_SMALL("DV (Digital Video)"),
.priv_data_size = sizeof(RawDVContext),
.read_probe = dv_probe,
.read_header = dv_read_header,
.read_packet = dv_read_packet,
.read_close = dv_read_close,
.read_seek = dv_read_seek,
- .extensions = "dv,dif",
+ .extensions = "dv,dif",
};
#endif
diff --git a/gst-libs/ext/libav/libavformat/dv.h b/gst-libs/ext/libav/libavformat/dv.h
index b4bb10d..e8b2d37 100644
--- a/gst-libs/ext/libav/libavformat/dv.h
+++ b/gst-libs/ext/libav/libavformat/dv.h
@@ -34,7 +34,7 @@ typedef struct DVDemuxContext DVDemuxContext;
DVDemuxContext* avpriv_dv_init_demux(AVFormatContext* s);
int avpriv_dv_get_packet(DVDemuxContext*, AVPacket *);
int avpriv_dv_produce_packet(DVDemuxContext*, AVPacket*, uint8_t*, int);
-void dv_offset_reset(DVDemuxContext *c, int64_t frame_offset);
+void ff_dv_offset_reset(DVDemuxContext *c, int64_t frame_offset);
typedef struct DVMuxContext DVMuxContext;
diff --git a/gst-libs/ext/libav/libavformat/dvenc.c b/gst-libs/ext/libav/libavformat/dvenc.c
index bffad44..a991cc6 100644
--- a/gst-libs/ext/libav/libavformat/dvenc.c
+++ b/gst-libs/ext/libav/libavformat/dvenc.c
@@ -32,11 +32,14 @@
#include "avformat.h"
#include "internal.h"
+#include "libavcodec/dv_profile.h"
#include "libavcodec/dvdata.h"
#include "dv.h"
#include "libavutil/fifo.h"
#include "libavutil/mathematics.h"
+#define MAX_AUDIO_FRAME_SIZE 192000 // 1 second of 48khz 32bit audio
+
struct DVMuxContext {
const DVprofile* sys; /* current DV profile, e.g.: 525/60, 625/50 */
int n_ast; /* number of stereo audio streams (up to 2) */
@@ -44,9 +47,9 @@ struct DVMuxContext {
AVFifoBuffer *audio_data[2]; /* FIFO for storing excessive amounts of PCM */
int frames; /* current frame number */
int64_t start_time; /* recording start time */
- int has_audio; /* frame under contruction has audio */
- int has_video; /* frame under contruction has video */
- uint8_t frame_buf[DV_MAX_FRAME_SIZE]; /* frame under contruction */
+ int has_audio; /* frame under construction has audio */
+ int has_video; /* frame under construction has video */
+ uint8_t frame_buf[DV_MAX_FRAME_SIZE]; /* frame under construction */
};
static const int dv_aaux_packs_dist[12][9] = {
@@ -82,7 +85,7 @@ static int dv_write_pack(enum dv_pack_type pack_id, DVMuxContext *c, uint8_t* bu
case dv_timecode:
ct = (time_t)av_rescale_rnd(c->frames, c->sys->time_base.num,
c->sys->time_base.den, AV_ROUND_DOWN);
- brktimegm(ct, &tc);
+ ff_brktimegm(ct, &tc);
/*
* LTC drop-frame frame counter drops two frames (0 and 1) every
* minute, unless it is exactly divisible by 10
@@ -134,7 +137,7 @@ static int dv_write_pack(enum dv_pack_type pack_id, DVMuxContext *c, uint8_t* bu
(1 << 3) | /* recording mode: 1 -- original */
7;
buf[3] = (1 << 7) | /* direction: 1 -- forward */
- (c->sys->pix_fmt == PIX_FMT_YUV420P ? 0x20 : /* speed */
+ (c->sys->pix_fmt == AV_PIX_FMT_YUV420P ? 0x20 : /* speed */
c->sys->ltc_divisor * 4);
buf[4] = (1 << 7) | /* reserved -- always 1 */
0x7f; /* genre category */
@@ -143,7 +146,7 @@ static int dv_write_pack(enum dv_pack_type pack_id, DVMuxContext *c, uint8_t* bu
case dv_video_recdate: /* VAUX recording date */
ct = c->start_time + av_rescale_rnd(c->frames, c->sys->time_base.num,
c->sys->time_base.den, AV_ROUND_DOWN);
- brktimegm(ct, &tc);
+ ff_brktimegm(ct, &tc);
buf[1] = 0xff; /* ds, tm, tens of time zone, units of time zone */
/* 0xff is very likely to be "unknown" */
buf[2] = (3 << 6) | /* reserved -- always 1 */
@@ -159,7 +162,7 @@ static int dv_write_pack(enum dv_pack_type pack_id, DVMuxContext *c, uint8_t* bu
case dv_video_rectime: /* VAUX recording time */
ct = c->start_time + av_rescale_rnd(c->frames, c->sys->time_base.num,
c->sys->time_base.den, AV_ROUND_DOWN);
- brktimegm(ct, &tc);
+ ff_brktimegm(ct, &tc);
buf[1] = (3 << 6) | /* reserved -- always 1 */
0x3f; /* tens of frame, units of frame: 0x3f - "unknown" ? */
buf[2] = (1 << 7) | /* reserved -- always 1 */
@@ -254,7 +257,7 @@ static int dv_assemble_frame(DVMuxContext *c, AVStream* st,
for (i = 0; i < c->n_ast && st != c->ast[i]; i++);
/* FIXME: we have to have more sensible approach than this one */
- if (av_fifo_size(c->audio_data[i]) + data_size >= 100*AVCODEC_MAX_AUDIO_FRAME_SIZE)
+ if (av_fifo_size(c->audio_data[i]) + data_size >= 100*MAX_AUDIO_FRAME_SIZE)
av_log(st->codec, AV_LOG_ERROR, "Can't process DV frame #%d. Insufficient video data or severe sync problem.\n", c->frames);
av_fifo_generic_write(c->audio_data[i], data, data_size, NULL);
@@ -317,10 +320,10 @@ static DVMuxContext* dv_init_mux(AVFormatContext* s)
}
/* Some checks -- DV format is very picky about its incoming streams */
- if (!vst || vst->codec->codec_id != CODEC_ID_DVVIDEO)
+ if (!vst || vst->codec->codec_id != AV_CODEC_ID_DVVIDEO)
goto bail_out;
for (i=0; i<c->n_ast; i++) {
- if (c->ast[i] && (c->ast[i]->codec->codec_id != CODEC_ID_PCM_S16LE ||
+ if (c->ast[i] && (c->ast[i]->codec->codec_id != AV_CODEC_ID_PCM_S16LE ||
c->ast[i]->codec->sample_rate != 48000 ||
c->ast[i]->codec->channels != 2))
goto bail_out;
@@ -338,16 +341,11 @@ static DVMuxContext* dv_init_mux(AVFormatContext* s)
c->frames = 0;
c->has_audio = 0;
c->has_video = 0;
-#if FF_API_TIMESTAMP
- if (s->timestamp)
- c->start_time = s->timestamp;
- else
-#endif
if (t = av_dict_get(s->metadata, "creation_time", NULL, 0))
c->start_time = ff_iso8601_to_unix_time(t->value);
for (i=0; i < c->n_ast; i++) {
- if (c->ast[i] && !(c->audio_data[i]=av_fifo_alloc(100*AVCODEC_MAX_AUDIO_FRAME_SIZE))) {
+ if (c->ast[i] && !(c->audio_data[i]=av_fifo_alloc(100*MAX_AUDIO_FRAME_SIZE))) {
while (i > 0) {
i--;
av_fifo_free(c->audio_data[i]);
@@ -409,11 +407,11 @@ static int dv_write_trailer(struct AVFormatContext *s)
AVOutputFormat ff_dv_muxer = {
.name = "dv",
- .long_name = NULL_IF_CONFIG_SMALL("DV video format"),
+ .long_name = NULL_IF_CONFIG_SMALL("DV (Digital Video)"),
.extensions = "dv",
.priv_data_size = sizeof(DVMuxContext),
- .audio_codec = CODEC_ID_PCM_S16LE,
- .video_codec = CODEC_ID_DVVIDEO,
+ .audio_codec = AV_CODEC_ID_PCM_S16LE,
+ .video_codec = AV_CODEC_ID_DVVIDEO,
.write_header = dv_write_header,
.write_packet = dv_write_packet,
.write_trailer = dv_write_trailer,
diff --git a/gst-libs/ext/libav/libavformat/dxa.c b/gst-libs/ext/libav/libavformat/dxa.c
index 0cc803d..a1b85fe 100644
--- a/gst-libs/ext/libav/libavformat/dxa.c
+++ b/gst-libs/ext/libav/libavformat/dxa.c
@@ -51,7 +51,7 @@ static int dxa_probe(AVProbeData *p)
return 0;
}
-static int dxa_read_header(AVFormatContext *s, AVFormatParameters *ap)
+static int dxa_read_header(AVFormatContext *s)
{
AVIOContext *pb = s->pb;
DXAContext *c = s->priv_data;
@@ -107,6 +107,8 @@ static int dxa_read_header(AVFormatContext *s, AVFormatParameters *ap)
ret = ff_get_wav_header(pb, ast->codec, fsize);
if (ret < 0)
return ret;
+ if (ast->codec->sample_rate > 0)
+ avpriv_set_pts_info(ast, 64, 1, ast->codec->sample_rate);
// find 'data' chunk
while(avio_tell(pb) < c->vidpos && !pb->eof_reached){
tag = avio_rl32(pb);
@@ -124,7 +126,7 @@ static int dxa_read_header(AVFormatContext *s, AVFormatParameters *ap)
/* now we are ready: build format streams */
st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
- st->codec->codec_id = CODEC_ID_DXA;
+ st->codec->codec_id = AV_CODEC_ID_DXA;
st->codec->width = w;
st->codec->height = h;
av_reduce(&den, &num, den, num, (1UL<<31)-1);
diff --git a/gst-libs/ext/libav/libavformat/eacdata.c b/gst-libs/ext/libav/libavformat/eacdata.c
index 8fe144e..b56ba1c 100644
--- a/gst-libs/ext/libav/libavformat/eacdata.c
+++ b/gst-libs/ext/libav/libavformat/eacdata.c
@@ -45,7 +45,7 @@ static int cdata_probe(AVProbeData *p)
return 0;
}
-static int cdata_read_header(AVFormatContext *s, AVFormatParameters *ap)
+static int cdata_read_header(AVFormatContext *s)
{
CdataDemuxContext *cdata = s->priv_data;
AVIOContext *pb = s->pb;
@@ -70,7 +70,7 @@ static int cdata_read_header(AVFormatContext *s, AVFormatParameters *ap)
return AVERROR(ENOMEM);
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
st->codec->codec_tag = 0; /* no fourcc */
- st->codec->codec_id = CODEC_ID_ADPCM_EA_XAS;
+ st->codec->codec_id = AV_CODEC_ID_ADPCM_EA_XAS;
st->codec->channels = cdata->channels;
st->codec->sample_rate = sample_rate;
avpriv_set_pts_info(st, 64, 1, sample_rate);
diff --git a/gst-libs/ext/libav/libavformat/electronicarts.c b/gst-libs/ext/libav/libavformat/electronicarts.c
index 0113683..ae2fda0 100644
--- a/gst-libs/ext/libav/libavformat/electronicarts.c
+++ b/gst-libs/ext/libav/libavformat/electronicarts.c
@@ -63,14 +63,13 @@
typedef struct EaDemuxContext {
int big_endian;
- enum CodecID video_codec;
+ enum AVCodecID video_codec;
AVRational time_base;
int width, height;
int video_stream_index;
- enum CodecID audio_codec;
+ enum AVCodecID audio_codec;
int audio_stream_index;
- int audio_frame_counter;
int bytes;
int sample_rate;
@@ -175,25 +174,25 @@ static int process_audio_header_elements(AVFormatContext *s)
}
switch (compression_type) {
- case 0: ea->audio_codec = CODEC_ID_PCM_S16LE; break;
- case 7: ea->audio_codec = CODEC_ID_ADPCM_EA; break;
+ case 0: ea->audio_codec = AV_CODEC_ID_PCM_S16LE; break;
+ case 7: ea->audio_codec = AV_CODEC_ID_ADPCM_EA; break;
case -1:
switch (revision) {
- case 1: ea->audio_codec = CODEC_ID_ADPCM_EA_R1; break;
- case 2: ea->audio_codec = CODEC_ID_ADPCM_EA_R2; break;
- case 3: ea->audio_codec = CODEC_ID_ADPCM_EA_R3; break;
+ case 1: ea->audio_codec = AV_CODEC_ID_ADPCM_EA_R1; break;
+ case 2: ea->audio_codec = AV_CODEC_ID_ADPCM_EA_R2; break;
+ case 3: ea->audio_codec = AV_CODEC_ID_ADPCM_EA_R3; break;
case -1: break;
default:
av_log(s, AV_LOG_ERROR, "unsupported stream type; revision=%i\n", revision);
return 0;
}
switch (revision2) {
- case 8: ea->audio_codec = CODEC_ID_PCM_S16LE_PLANAR; break;
- case 10: ea->audio_codec = CODEC_ID_ADPCM_EA_R2; break;
- case 16: ea->audio_codec = CODEC_ID_MP3; break;
+ case 8: ea->audio_codec = AV_CODEC_ID_PCM_S16LE_PLANAR; break;
+ case 10: ea->audio_codec = AV_CODEC_ID_ADPCM_EA_R2; break;
+ case 16: ea->audio_codec = AV_CODEC_ID_MP3; break;
case -1: break;
default:
- ea->audio_codec = CODEC_ID_NONE;
+ ea->audio_codec = AV_CODEC_ID_NONE;
av_log(s, AV_LOG_ERROR, "unsupported stream type; revision2=%i\n", revision2);
return 0;
}
@@ -228,12 +227,12 @@ static int process_audio_header_eacs(AVFormatContext *s)
switch (compression_type) {
case 0:
switch (ea->bytes) {
- case 1: ea->audio_codec = CODEC_ID_PCM_S8; break;
- case 2: ea->audio_codec = CODEC_ID_PCM_S16LE; break;
+ case 1: ea->audio_codec = AV_CODEC_ID_PCM_S8; break;
+ case 2: ea->audio_codec = AV_CODEC_ID_PCM_S16LE; break;
}
break;
- case 1: ea->audio_codec = CODEC_ID_PCM_MULAW; ea->bytes = 1; break;
- case 2: ea->audio_codec = CODEC_ID_ADPCM_IMA_EA_EACS; break;
+ case 1: ea->audio_codec = AV_CODEC_ID_PCM_MULAW; ea->bytes = 1; break;
+ case 2: ea->audio_codec = AV_CODEC_ID_ADPCM_IMA_EA_EACS; break;
default:
av_log (s, AV_LOG_ERROR, "unsupported stream type; audio compression_type=%i\n", compression_type);
}
@@ -253,7 +252,7 @@ static int process_audio_header_sead(AVFormatContext *s)
ea->sample_rate = avio_rl32(pb);
ea->bytes = avio_rl32(pb); /* 1=8-bit, 2=16-bit */
ea->num_channels = avio_rl32(pb);
- ea->audio_codec = CODEC_ID_ADPCM_IMA_EA_SEAD;
+ ea->audio_codec = AV_CODEC_ID_ADPCM_IMA_EA_SEAD;
return 1;
}
@@ -266,7 +265,7 @@ static int process_video_header_mdec(AVFormatContext *s)
ea->width = avio_rl16(pb);
ea->height = avio_rl16(pb);
ea->time_base = (AVRational){1,15};
- ea->video_codec = CODEC_ID_MDEC;
+ ea->video_codec = AV_CODEC_ID_MDEC;
return 1;
}
@@ -278,11 +277,25 @@ static int process_video_header_vp6(AVFormatContext *s)
avio_skip(pb, 16);
ea->time_base.den = avio_rl32(pb);
ea->time_base.num = avio_rl32(pb);
- ea->video_codec = CODEC_ID_VP6;
+ ea->video_codec = AV_CODEC_ID_VP6;
return 1;
}
+static int process_video_header_cmv(AVFormatContext *s)
+{
+ EaDemuxContext *ea = s->priv_data;
+ int fps;
+
+ avio_skip(s->pb, 10);
+ fps = avio_rl16(s->pb);
+ if (fps)
+ ea->time_base = (AVRational){1, fps};
+ ea->video_codec = AV_CODEC_ID_CMV;
+
+ return 0;
+}
+
/*
* Process EA file header
* Returns 1 if the EA file is valid and successfully opened, 0 otherwise
@@ -330,13 +343,12 @@ static int process_ea_header(AVFormatContext *s) {
break;
case MVIh_TAG :
- ea->video_codec = CODEC_ID_CMV;
- ea->time_base = (AVRational){0,0};
+ err = process_video_header_cmv(s);
break;
case kVGT_TAG:
- ea->video_codec = CODEC_ID_TGV;
- ea->time_base = (AVRational){0,0};
+ ea->video_codec = AV_CODEC_ID_TGV;
+ ea->time_base = (AVRational){1, 15};
break;
case mTCD_TAG :
@@ -344,20 +356,20 @@ static int process_ea_header(AVFormatContext *s) {
break;
case MPCh_TAG:
- ea->video_codec = CODEC_ID_MPEG2VIDEO;
+ ea->video_codec = AV_CODEC_ID_MPEG2VIDEO;
break;
case pQGT_TAG:
case TGQs_TAG:
- ea->video_codec = CODEC_ID_TGQ;
+ ea->video_codec = AV_CODEC_ID_TGQ;
break;
case pIQT_TAG:
- ea->video_codec = CODEC_ID_TQI;
+ ea->video_codec = AV_CODEC_ID_TQI;
break;
case MADk_TAG :
- ea->video_codec = CODEC_ID_MAD;
+ ea->video_codec = AV_CODEC_ID_MAD;
break;
case MVhd_TAG :
@@ -400,8 +412,7 @@ static int ea_probe(AVProbeData *p)
return AVPROBE_SCORE_MAX;
}
-static int ea_read_header(AVFormatContext *s,
- AVFormatParameters *ap)
+static int ea_read_header(AVFormatContext *s)
{
EaDemuxContext *ea = s->priv_data;
AVStream *st;
@@ -418,9 +429,13 @@ static int ea_read_header(AVFormatContext *s,
st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
st->codec->codec_id = ea->video_codec;
st->codec->codec_tag = 0; /* no fourcc */
- st->codec->time_base = ea->time_base;
st->codec->width = ea->width;
st->codec->height = ea->height;
+ avpriv_set_pts_info(st, 33, ea->time_base.num, ea->time_base.den);
+#if FF_API_R_FRAME_RATE
+ st->r_frame_rate =
+#endif
+ st->avg_frame_rate = (AVRational){ea->time_base.den, ea->time_base.num};
}
if (ea->audio_codec) {
@@ -436,7 +451,7 @@ static int ea_read_header(AVFormatContext *s,
}
if (ea->bytes <= 0) {
av_log(s, AV_LOG_ERROR, "Invalid number of bytes per sample: %d\n", ea->bytes);
- ea->audio_codec = CODEC_ID_NONE;
+ ea->audio_codec = AV_CODEC_ID_NONE;
return 1;
}
@@ -455,7 +470,7 @@ static int ea_read_header(AVFormatContext *s,
st->codec->bits_per_coded_sample / 4;
st->codec->block_align = st->codec->channels*st->codec->bits_per_coded_sample;
ea->audio_stream_index = st->index;
- ea->audio_frame_counter = 0;
+ st->start_time = 0;
}
return 1;
@@ -494,8 +509,8 @@ static int ea_read_packet(AVFormatContext *s,
if (!ea->audio_codec) {
avio_skip(pb, chunk_size);
break;
- } else if (ea->audio_codec == CODEC_ID_PCM_S16LE_PLANAR ||
- ea->audio_codec == CODEC_ID_MP3) {
+ } else if (ea->audio_codec == AV_CODEC_ID_PCM_S16LE_PLANAR ||
+ ea->audio_codec == AV_CODEC_ID_MP3) {
num_samples = avio_rl32(pb);
avio_skip(pb, 8);
chunk_size -= 12;
@@ -504,24 +519,26 @@ static int ea_read_packet(AVFormatContext *s,
if (ret < 0)
return ret;
pkt->stream_index = ea->audio_stream_index;
- pkt->pts = 90000;
- pkt->pts *= ea->audio_frame_counter;
- pkt->pts /= ea->sample_rate;
switch (ea->audio_codec) {
- case CODEC_ID_ADPCM_EA:
- /* 2 samples/byte, 1 or 2 samples per frame depending
- * on stereo; chunk also has 12-byte header */
- ea->audio_frame_counter += ((chunk_size - 12) * 2) /
- ea->num_channels;
+ case AV_CODEC_ID_ADPCM_EA:
+ case AV_CODEC_ID_ADPCM_EA_R1:
+ case AV_CODEC_ID_ADPCM_EA_R2:
+ case AV_CODEC_ID_ADPCM_IMA_EA_EACS:
+ pkt->duration = AV_RL32(pkt->data);
+ break;
+ case AV_CODEC_ID_ADPCM_EA_R3:
+ pkt->duration = AV_RB32(pkt->data);
+ break;
+ case AV_CODEC_ID_ADPCM_IMA_EA_SEAD:
+ pkt->duration = ret * 2 / ea->num_channels;
break;
- case CODEC_ID_PCM_S16LE_PLANAR:
- case CODEC_ID_MP3:
- ea->audio_frame_counter += num_samples;
+ case AV_CODEC_ID_PCM_S16LE_PLANAR:
+ case AV_CODEC_ID_MP3:
+ pkt->duration = num_samples;
break;
default:
- ea->audio_frame_counter += chunk_size /
- (ea->bytes * ea->num_channels);
+ pkt->duration = chunk_size / (ea->bytes * ea->num_channels);
}
packet_read = 1;
@@ -581,7 +598,7 @@ get_video_packet:
AVInputFormat ff_ea_demuxer = {
.name = "ea",
- .long_name = NULL_IF_CONFIG_SMALL("Electronic Arts Multimedia Format"),
+ .long_name = NULL_IF_CONFIG_SMALL("Electronic Arts Multimedia"),
.priv_data_size = sizeof(EaDemuxContext),
.read_probe = ea_probe,
.read_header = ea_read_header,
diff --git a/gst-libs/ext/libav/libavformat/ffm.h b/gst-libs/ext/libav/libavformat/ffm.h
index 6ce5e04..70c3e88 100644
--- a/gst-libs/ext/libav/libavformat/ffm.h
+++ b/gst-libs/ext/libav/libavformat/ffm.h
@@ -56,8 +56,4 @@ typedef struct FFMContext {
uint8_t packet[FFM_PACKET_SIZE];
} FFMContext;
-int64_t ffm_read_write_index(int fd);
-int ffm_write_write_index(int fd, int64_t pos);
-void ffm_set_write_index(AVFormatContext *s, int64_t pos, int64_t file_size);
-
#endif /* AVFORMAT_FFM_H */
diff --git a/gst-libs/ext/libav/libavformat/ffmdec.c b/gst-libs/ext/libav/libavformat/ffmdec.c
index 9cee3ad..e6730eb 100644
--- a/gst-libs/ext/libav/libavformat/ffmdec.c
+++ b/gst-libs/ext/libav/libavformat/ffmdec.c
@@ -24,39 +24,6 @@
#include "avformat.h"
#include "internal.h"
#include "ffm.h"
-#if CONFIG_AVSERVER
-#include <unistd.h>
-
-int64_t ffm_read_write_index(int fd)
-{
- uint8_t buf[8];
-
- lseek(fd, 8, SEEK_SET);
- if (read(fd, buf, 8) != 8)
- return AVERROR(EIO);
- return AV_RB64(buf);
-}
-
-int ffm_write_write_index(int fd, int64_t pos)
-{
- uint8_t buf[8];
- int i;
-
- for(i=0;i<8;i++)
- buf[i] = (pos >> (56 - i * 8)) & 0xff;
- lseek(fd, 8, SEEK_SET);
- if (write(fd, buf, 8) != 8)
- return AVERROR(EIO);
- return 8;
-}
-
-void ffm_set_write_index(AVFormatContext *s, int64_t pos, int64_t file_size)
-{
- FFMContext *ffm = s->priv_data;
- ffm->write_index = pos;
- ffm->file_size = file_size;
-}
-#endif // CONFIG_AVSERVER
static int ffm_is_avail_data(AVFormatContext *s, int size)
{
@@ -167,7 +134,7 @@ static int ffm_read_data(AVFormatContext *s,
/* ensure that acutal seeking happens between FFM_PACKET_SIZE
and file_size - FFM_PACKET_SIZE */
-static void ffm_seek1(AVFormatContext *s, int64_t pos1)
+static int64_t ffm_seek1(AVFormatContext *s, int64_t pos1)
{
FFMContext *ffm = s->priv_data;
AVIOContext *pb = s->pb;
@@ -176,7 +143,7 @@ static void ffm_seek1(AVFormatContext *s, int64_t pos1)
pos = FFMIN(pos1, ffm->file_size - FFM_PACKET_SIZE);
pos = FFMAX(pos, FFM_PACKET_SIZE);
av_dlog(s, "seek to %"PRIx64" -> %"PRIx64"\n", pos1, pos);
- avio_seek(pb, pos, SEEK_SET);
+ return avio_seek(pb, pos, SEEK_SET);
}
static int64_t get_dts(AVFormatContext *s, int64_t pos)
@@ -240,9 +207,6 @@ static void adjust_write_index(AVFormatContext *s)
ffm->write_index += pos_max;
}
- //printf("Adjusted write index from %"PRId64" to %"PRId64": pts=%0.6f\n", orig_write_index, ffm->write_index, pts / 1000000.);
- //printf("pts range %0.6f - %0.6f\n", get_dts(s, 0) / 1000000. , get_dts(s, ffm->file_size - 2 * FFM_PACKET_SIZE) / 1000000. );
-
end:
avio_seek(pb, ptr, SEEK_SET);
}
@@ -259,7 +223,7 @@ static int ffm_close(AVFormatContext *s)
}
-static int ffm_read_header(AVFormatContext *s, AVFormatParameters *ap)
+static int ffm_read_header(AVFormatContext *s)
{
FFMContext *ffm = s->priv_data;
AVStream *st;
@@ -332,8 +296,6 @@ static int ffm_read_header(AVFormatContext *s, AVFormatParameters *ap)
codec->dct_algo = avio_rb32(pb);
codec->strict_std_compliance = avio_rb32(pb);
codec->max_b_frames = avio_rb32(pb);
- codec->luma_elim_threshold = avio_rb32(pb);
- codec->chroma_elim_threshold = avio_rb32(pb);
codec->mpeg_quant = avio_rb32(pb);
codec->intra_dc_precision = avio_rb32(pb);
codec->me_method = avio_rb32(pb);
@@ -359,7 +321,6 @@ static int ffm_read_header(AVFormatContext *s, AVFormatParameters *ap)
codec->sample_rate = avio_rb32(pb);
codec->channels = avio_rl16(pb);
codec->frame_size = avio_rl16(pb);
- codec->sample_fmt = (int16_t) avio_rl16(pb);
break;
default:
goto fail;
@@ -487,7 +448,8 @@ static int ffm_seek(AVFormatContext *s, int stream_index, int64_t wanted_pts, in
pos = (flags & AVSEEK_FLAG_BACKWARD) ? pos_min : pos_max;
found:
- ffm_seek1(s, pos);
+ if (ffm_seek1(s, pos) < 0)
+ return -1;
/* reset read state */
ffm->read_state = READ_HEADER;
@@ -509,7 +471,7 @@ static int ffm_probe(AVProbeData *p)
AVInputFormat ff_ffm_demuxer = {
.name = "ffm",
- .long_name = NULL_IF_CONFIG_SMALL("FFM (AVserver live feed) format"),
+ .long_name = NULL_IF_CONFIG_SMALL("FFM (AVserver live feed)"),
.priv_data_size = sizeof(FFMContext),
.read_probe = ffm_probe,
.read_header = ffm_read_header,
diff --git a/gst-libs/ext/libav/libavformat/ffmenc.c b/gst-libs/ext/libav/libavformat/ffmenc.c
index b8d3d31..386487f 100644
--- a/gst-libs/ext/libav/libavformat/ffmenc.c
+++ b/gst-libs/ext/libav/libavformat/ffmenc.c
@@ -19,6 +19,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <assert.h>
+
#include "libavutil/intreadwrite.h"
#include "libavutil/intfloat.h"
#include "avformat.h"
@@ -34,8 +36,7 @@ static void flush_packet(AVFormatContext *s)
fill_size = ffm->packet_end - ffm->packet_ptr;
memset(ffm->packet_ptr, 0, fill_size);
- if (avio_tell(pb) % ffm->packet_size)
- av_abort();
+ assert(avio_tell(pb) % ffm->packet_size == 0);
/* put header */
avio_wb16(pb, PACKET_ID);
@@ -144,8 +145,6 @@ static int ffm_write_header(AVFormatContext *s)
avio_wb32(pb, codec->dct_algo);
avio_wb32(pb, codec->strict_std_compliance);
avio_wb32(pb, codec->max_b_frames);
- avio_wb32(pb, codec->luma_elim_threshold);
- avio_wb32(pb, codec->chroma_elim_threshold);
avio_wb32(pb, codec->mpeg_quant);
avio_wb32(pb, codec->intra_dc_precision);
avio_wb32(pb, codec->me_method);
@@ -171,7 +170,6 @@ static int ffm_write_header(AVFormatContext *s)
avio_wb32(pb, codec->sample_rate);
avio_wl16(pb, codec->channels);
avio_wl16(pb, codec->frame_size);
- avio_wl16(pb, codec->sample_fmt);
break;
default:
return -1;
@@ -227,26 +225,23 @@ static int ffm_write_packet(AVFormatContext *s, AVPacket *pkt)
static int ffm_write_trailer(AVFormatContext *s)
{
- AVIOContext *pb = s->pb;
FFMContext *ffm = s->priv_data;
/* flush packets */
if (ffm->packet_ptr > ffm->packet)
flush_packet(s);
- avio_flush(pb);
-
return 0;
}
AVOutputFormat ff_ffm_muxer = {
.name = "ffm",
- .long_name = NULL_IF_CONFIG_SMALL("FFM (AVserver live feed) format"),
+ .long_name = NULL_IF_CONFIG_SMALL("FFM (AVserver live feed)"),
.mime_type = "",
.extensions = "ffm",
.priv_data_size = sizeof(FFMContext),
- .audio_codec = CODEC_ID_MP2,
- .video_codec = CODEC_ID_MPEG1VIDEO,
+ .audio_codec = AV_CODEC_ID_MP2,
+ .video_codec = AV_CODEC_ID_MPEG1VIDEO,
.write_header = ffm_write_header,
.write_packet = ffm_write_packet,
.write_trailer = ffm_write_trailer,
diff --git a/gst-libs/ext/libav/libavformat/ffmetadec.c b/gst-libs/ext/libav/libavformat/ffmetadec.c
index 21e5ee9..7dbf7ed 100644
--- a/gst-libs/ext/libav/libavformat/ffmetadec.c
+++ b/gst-libs/ext/libav/libavformat/ffmetadec.c
@@ -123,7 +123,7 @@ static int read_tag(uint8_t *line, AVDictionary **m)
return 0;
}
-static int read_header(AVFormatContext *s, AVFormatParameters *ap)
+static int read_header(AVFormatContext *s)
{
AVDictionary **m = &s->metadata;
uint8_t line[1024];
@@ -138,7 +138,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap)
return -1;
st->codec->codec_type = AVMEDIA_TYPE_DATA;
- st->codec->codec_id = CODEC_ID_FFMETADATA;
+ st->codec->codec_id = AV_CODEC_ID_FFMETADATA;
m = &st->metadata;
} else if (!memcmp(line, ID_CHAPTER, strlen(ID_CHAPTER))) {
@@ -168,7 +168,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
AVInputFormat ff_ffmetadata_demuxer = {
.name = "ffmetadata",
- .long_name = NULL_IF_CONFIG_SMALL("FFmpeg metadata in text format"),
+ .long_name = NULL_IF_CONFIG_SMALL("FFmpeg metadata in text"),
.read_probe = probe,
.read_header = read_header,
.read_packet = read_packet,
diff --git a/gst-libs/ext/libav/libavformat/ffmetaenc.c b/gst-libs/ext/libav/libavformat/ffmetaenc.c
index 0aadb8a..19fe6c9 100644
--- a/gst-libs/ext/libav/libavformat/ffmetaenc.c
+++ b/gst-libs/ext/libav/libavformat/ffmetaenc.c
@@ -80,8 +80,6 @@ static int write_trailer(AVFormatContext *s)
write_tags(s->pb, ch->metadata);
}
- avio_flush(s->pb);
-
return 0;
}
@@ -92,7 +90,7 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt)
AVOutputFormat ff_ffmetadata_muxer = {
.name = "ffmetadata",
- .long_name = NULL_IF_CONFIG_SMALL("FFmpeg metadata in text format"),
+ .long_name = NULL_IF_CONFIG_SMALL("FFmpeg metadata in text"),
.extensions = "ffmeta",
.write_header = write_header,
.write_packet = write_packet,
diff --git a/gst-libs/ext/libav/libavformat/file.c b/gst-libs/ext/libav/libavformat/file.c
index cca9ec1..c552a9e 100644
--- a/gst-libs/ext/libav/libavformat/file.c
+++ b/gst-libs/ext/libav/libavformat/file.c
@@ -20,12 +20,15 @@
*/
#include "libavutil/avstring.h"
+#include "libavutil/opt.h"
#include "avformat.h"
#include <fcntl.h>
-#if HAVE_SETMODE
+#if HAVE_IO_H
#include <io.h>
#endif
+#if HAVE_UNISTD_H
#include <unistd.h>
+#endif
#include <sys/stat.h>
#include <stdlib.h>
#include "os_support.h"
@@ -34,21 +37,40 @@
/* standard file protocol */
+typedef struct FileContext {
+ const AVClass *class;
+ int fd;
+ int trunc;
+} FileContext;
+
+static const AVOption file_options[] = {
+ { "truncate", "Truncate existing files on write", offsetof(FileContext, trunc), AV_OPT_TYPE_INT, { .i64 = 1 }, 0, 1, AV_OPT_FLAG_ENCODING_PARAM },
+ { NULL }
+};
+
+static const AVClass file_class = {
+ .class_name = "file",
+ .item_name = av_default_item_name,
+ .option = file_options,
+ .version = LIBAVUTIL_VERSION_INT,
+};
+
static int file_read(URLContext *h, unsigned char *buf, int size)
{
- int fd = (intptr_t) h->priv_data;
- return read(fd, buf, size);
+ FileContext *c = h->priv_data;
+ return read(c->fd, buf, size);
}
static int file_write(URLContext *h, const unsigned char *buf, int size)
{
- int fd = (intptr_t) h->priv_data;
- return write(fd, buf, size);
+ FileContext *c = h->priv_data;
+ return write(c->fd, buf, size);
}
static int file_get_handle(URLContext *h)
{
- return (intptr_t) h->priv_data;
+ FileContext *c = h->priv_data;
+ return c->fd;
}
static int file_check(URLContext *h, int mask)
@@ -68,15 +90,20 @@ static int file_check(URLContext *h, int mask)
static int file_open(URLContext *h, const char *filename, int flags)
{
+ FileContext *c = h->priv_data;
int access;
int fd;
av_strstart(filename, "file:", &filename);
if (flags & AVIO_FLAG_WRITE && flags & AVIO_FLAG_READ) {
- access = O_CREAT | O_TRUNC | O_RDWR;
+ access = O_CREAT | O_RDWR;
+ if (c->trunc)
+ access |= O_TRUNC;
} else if (flags & AVIO_FLAG_WRITE) {
- access = O_CREAT | O_TRUNC | O_WRONLY;
+ access = O_CREAT | O_WRONLY;
+ if (c->trunc)
+ access |= O_TRUNC;
} else {
access = O_RDONLY;
}
@@ -86,26 +113,32 @@ static int file_open(URLContext *h, const char *filename, int flags)
fd = open(filename, access, 0666);
if (fd == -1)
return AVERROR(errno);
- h->priv_data = (void *) (intptr_t) fd;
+ c->fd = fd;
return 0;
}
/* XXX: use llseek */
static int64_t file_seek(URLContext *h, int64_t pos, int whence)
{
- int fd = (intptr_t) h->priv_data;
+ FileContext *c = h->priv_data;
+ int64_t ret;
+
if (whence == AVSEEK_SIZE) {
struct stat st;
- int ret = fstat(fd, &st);
+
+ ret = fstat(c->fd, &st);
return ret < 0 ? AVERROR(errno) : st.st_size;
}
- return lseek(fd, pos, whence);
+
+ ret = lseek(c->fd, pos, whence);
+
+ return ret < 0 ? AVERROR(errno) : ret;
}
static int file_close(URLContext *h)
{
- int fd = (intptr_t) h->priv_data;
- return close(fd);
+ FileContext *c = h->priv_data;
+ return close(c->fd);
}
URLProtocol ff_file_protocol = {
@@ -117,6 +150,8 @@ URLProtocol ff_file_protocol = {
.url_close = file_close,
.url_get_file_handle = file_get_handle,
.url_check = file_check,
+ .priv_data_size = sizeof(FileContext),
+ .priv_data_class = &file_class,
};
#endif /* CONFIG_FILE_PROTOCOL */
@@ -125,6 +160,7 @@ URLProtocol ff_file_protocol = {
static int pipe_open(URLContext *h, const char *filename, int flags)
{
+ FileContext *c = h->priv_data;
int fd;
char *final;
av_strstart(filename, "pipe:", &filename);
@@ -140,7 +176,7 @@ static int pipe_open(URLContext *h, const char *filename, int flags)
#if HAVE_SETMODE
setmode(fd, O_BINARY);
#endif
- h->priv_data = (void *) (intptr_t) fd;
+ c->fd = fd;
h->is_streamed = 1;
return 0;
}
@@ -152,6 +188,7 @@ URLProtocol ff_pipe_protocol = {
.url_write = file_write,
.url_get_file_handle = file_get_handle,
.url_check = file_check,
+ .priv_data_size = sizeof(FileContext),
};
#endif /* CONFIG_PIPE_PROTOCOL */
diff --git a/gst-libs/ext/libav/libavformat/filmstripdec.c b/gst-libs/ext/libav/libavformat/filmstripdec.c
index 648fb4f..97cecfa 100644
--- a/gst-libs/ext/libav/libavformat/filmstripdec.c
+++ b/gst-libs/ext/libav/libavformat/filmstripdec.c
@@ -34,8 +34,7 @@ typedef struct {
int leading;
} FilmstripDemuxContext;
-static int read_header(AVFormatContext *s,
- AVFormatParameters *ap)
+static int read_header(AVFormatContext *s)
{
FilmstripDemuxContext *film = s->priv_data;
AVIOContext *pb = s->pb;
@@ -57,13 +56,13 @@ static int read_header(AVFormatContext *s,
st->nb_frames = avio_rb32(pb);
if (avio_rb16(pb) != 0) {
av_log_ask_for_sample(s, "unsupported packing method\n");
- return AVERROR_INVALIDDATA;
+ return AVERROR_PATCHWELCOME;
}
avio_skip(pb, 2);
st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
- st->codec->codec_id = CODEC_ID_RAWVIDEO;
- st->codec->pix_fmt = PIX_FMT_RGBA;
+ st->codec->codec_id = AV_CODEC_ID_RAWVIDEO;
+ st->codec->pix_fmt = AV_PIX_FMT_RGBA;
st->codec->codec_tag = 0; /* no fourcc */
st->codec->width = avio_rb16(pb);
st->codec->height = avio_rb16(pb);
@@ -95,7 +94,8 @@ static int read_packet(AVFormatContext *s,
static int read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int flags)
{
AVStream *st = s->streams[stream_index];
- avio_seek(s->pb, FFMAX(timestamp, 0) * st->codec->width * st->codec->height * 4, SEEK_SET);
+ if (avio_seek(s->pb, FFMAX(timestamp, 0) * st->codec->width * st->codec->height * 4, SEEK_SET) < 0)
+ return -1;
return 0;
}
@@ -106,5 +106,5 @@ AVInputFormat ff_filmstrip_demuxer = {
.read_header = read_header,
.read_packet = read_packet,
.read_seek = read_seek,
- .extensions = "flm",
+ .extensions = "flm",
};
diff --git a/gst-libs/ext/libav/libavformat/filmstripenc.c b/gst-libs/ext/libav/libavformat/filmstripenc.c
index 0e55408..90d9a76 100644
--- a/gst-libs/ext/libav/libavformat/filmstripenc.c
+++ b/gst-libs/ext/libav/libavformat/filmstripenc.c
@@ -35,8 +35,8 @@ typedef struct {
static int write_header(AVFormatContext *s)
{
- if (s->streams[0]->codec->pix_fmt != PIX_FMT_RGBA) {
- av_log(s, AV_LOG_ERROR, "only PIX_FMT_RGBA is supported\n");
+ if (s->streams[0]->codec->pix_fmt != AV_PIX_FMT_RGBA) {
+ av_log(s, AV_LOG_ERROR, "only AV_PIX_FMT_RGBA is supported\n");
return AVERROR_INVALIDDATA;
}
return 0;
@@ -67,7 +67,7 @@ static int write_trailer(AVFormatContext *s)
avio_wb16(pb, 1/av_q2d(st->codec->time_base));
for (i = 0; i < 16; i++)
avio_w8(pb, 0x00); // reserved
- avio_flush(pb);
+
return 0;
}
@@ -76,8 +76,8 @@ AVOutputFormat ff_filmstrip_muxer = {
.long_name = NULL_IF_CONFIG_SMALL("Adobe Filmstrip"),
.extensions = "flm",
.priv_data_size = sizeof(FilmstripMuxContext),
- .audio_codec = CODEC_ID_NONE,
- .video_codec = CODEC_ID_RAWVIDEO,
+ .audio_codec = AV_CODEC_ID_NONE,
+ .video_codec = AV_CODEC_ID_RAWVIDEO,
.write_header = write_header,
.write_packet = write_packet,
.write_trailer = write_trailer,
diff --git a/gst-libs/ext/libav/libavformat/flacdec.c b/gst-libs/ext/libav/libavformat/flacdec.c
index 92957b6..fcacf19 100644
--- a/gst-libs/ext/libav/libavformat/flacdec.c
+++ b/gst-libs/ext/libav/libavformat/flacdec.c
@@ -21,14 +21,141 @@
#include "libavcodec/flac.h"
#include "avformat.h"
+#include "id3v2.h"
#include "internal.h"
#include "rawdec.h"
#include "oggdec.h"
#include "vorbiscomment.h"
#include "libavcodec/bytestream.h"
-static int flac_read_header(AVFormatContext *s,
- AVFormatParameters *ap)
+static int parse_picture(AVFormatContext *s, uint8_t *buf, int buf_size)
+{
+ const CodecMime *mime = ff_id3v2_mime_tags;
+ enum AVCodecID id = AV_CODEC_ID_NONE;
+ uint8_t mimetype[64], *desc = NULL, *data = NULL;
+ AVIOContext *pb = NULL;
+ AVStream *st;
+ int type, width, height;
+ int len, ret = 0;
+
+ pb = avio_alloc_context(buf, buf_size, 0, NULL, NULL, NULL, NULL);
+ if (!pb)
+ return AVERROR(ENOMEM);
+
+ /* read the picture type */
+ type = avio_rb32(pb);
+ if (type >= FF_ARRAY_ELEMS(ff_id3v2_picture_types) || type < 0) {
+ av_log(s, AV_LOG_ERROR, "Invalid picture type: %d.\n", type);
+ if (s->error_recognition & AV_EF_EXPLODE) {
+ ret = AVERROR_INVALIDDATA;
+ goto fail;
+ }
+ type = 0;
+ }
+
+ /* picture mimetype */
+ len = avio_rb32(pb);
+ if (len <= 0 ||
+ avio_read(pb, mimetype, FFMIN(len, sizeof(mimetype) - 1)) != len) {
+ av_log(s, AV_LOG_ERROR, "Could not read mimetype from an attached "
+ "picture.\n");
+ if (s->error_recognition & AV_EF_EXPLODE)
+ ret = AVERROR_INVALIDDATA;
+ goto fail;
+ }
+ mimetype[len] = 0;
+
+ while (mime->id != AV_CODEC_ID_NONE) {
+ if (!strncmp(mime->str, mimetype, sizeof(mimetype))) {
+ id = mime->id;
+ break;
+ }
+ mime++;
+ }
+ if (id == AV_CODEC_ID_NONE) {
+ av_log(s, AV_LOG_ERROR, "Unknown attached picture mimetype: %s.\n",
+ mimetype);
+ if (s->error_recognition & AV_EF_EXPLODE)
+ ret = AVERROR_INVALIDDATA;
+ goto fail;
+ }
+
+ /* picture description */
+ len = avio_rb32(pb);
+ if (len > 0) {
+ if (!(desc = av_malloc(len + 1))) {
+ ret = AVERROR(ENOMEM);
+ goto fail;
+ }
+
+ if (avio_read(pb, desc, len) != len) {
+ av_log(s, AV_LOG_ERROR, "Error reading attached picture description.\n");
+ if (s->error_recognition & AV_EF_EXPLODE)
+ ret = AVERROR(EIO);
+ goto fail;
+ }
+ desc[len] = 0;
+ }
+
+ /* picture metadata */
+ width = avio_rb32(pb);
+ height = avio_rb32(pb);
+ avio_skip(pb, 8);
+
+ /* picture data */
+ len = avio_rb32(pb);
+ if (len <= 0) {
+ av_log(s, AV_LOG_ERROR, "Invalid attached picture size: %d.\n", len);
+ if (s->error_recognition & AV_EF_EXPLODE)
+ ret = AVERROR_INVALIDDATA;
+ goto fail;
+ }
+ if (!(data = av_malloc(len))) {
+ ret = AVERROR(ENOMEM);
+ goto fail;
+ }
+ if (avio_read(pb, data, len) != len) {
+ av_log(s, AV_LOG_ERROR, "Error reading attached picture data.\n");
+ if (s->error_recognition & AV_EF_EXPLODE)
+ ret = AVERROR(EIO);
+ goto fail;
+ }
+
+ st = avformat_new_stream(s, NULL);
+ if (!st) {
+ ret = AVERROR(ENOMEM);
+ goto fail;
+ }
+
+ av_init_packet(&st->attached_pic);
+ st->attached_pic.data = data;
+ st->attached_pic.size = len;
+ st->attached_pic.destruct = av_destruct_packet;
+ st->attached_pic.stream_index = st->index;
+ st->attached_pic.flags |= AV_PKT_FLAG_KEY;
+
+ st->disposition |= AV_DISPOSITION_ATTACHED_PIC;
+ st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
+ st->codec->codec_id = id;
+ st->codec->width = width;
+ st->codec->height = height;
+ av_dict_set(&st->metadata, "comment", ff_id3v2_picture_types[type], 0);
+ if (desc)
+ av_dict_set(&st->metadata, "title", desc, AV_DICT_DONT_STRDUP_VAL);
+
+ av_freep(&pb);
+
+ return 0;
+
+fail:
+ av_freep(&desc);
+ av_freep(&data);
+ av_freep(&pb);
+ return ret;
+
+}
+
+static int flac_read_header(AVFormatContext *s)
{
int ret, metadata_last=0, metadata_type, metadata_size, found_streaminfo=0;
uint8_t header[4];
@@ -37,7 +164,7 @@ static int flac_read_header(AVFormatContext *s,
if (!st)
return AVERROR(ENOMEM);
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
- st->codec->codec_id = CODEC_ID_FLAC;
+ st->codec->codec_id = AV_CODEC_ID_FLAC;
st->need_parsing = AVSTREAM_PARSE_FULL;
/* the parameters will be extracted from the compressed bitstream */
@@ -56,6 +183,7 @@ static int flac_read_header(AVFormatContext *s,
/* allocate and read metadata block for supported types */
case FLAC_METADATA_TYPE_STREAMINFO:
case FLAC_METADATA_TYPE_CUESHEET:
+ case FLAC_METADATA_TYPE_PICTURE:
case FLAC_METADATA_TYPE_VORBIS_COMMENT:
buffer = av_mallocz(metadata_size + FF_INPUT_BUFFER_PADDING_SIZE);
if (!buffer) {
@@ -122,6 +250,13 @@ static int flac_read_header(AVFormatContext *s,
offset += ti * 12;
avpriv_new_chapter(s, track, st->time_base, start, AV_NOPTS_VALUE, isrc);
}
+ } else if (metadata_type == FLAC_METADATA_TYPE_PICTURE) {
+ ret = parse_picture(s, buffer, metadata_size);
+ av_freep(&buffer);
+ if (ret < 0) {
+ av_log(s, AV_LOG_ERROR, "Error parsing attached picture.\n");
+ return ret;
+ }
} else {
/* STREAMINFO must be the first block */
if (!found_streaminfo) {
@@ -154,7 +289,7 @@ AVInputFormat ff_flac_demuxer = {
.read_probe = flac_probe,
.read_header = flac_read_header,
.read_packet = ff_raw_read_partial_packet,
- .flags= AVFMT_GENERIC_INDEX,
- .extensions = "flac",
- .value = CODEC_ID_FLAC,
+ .flags = AVFMT_GENERIC_INDEX,
+ .extensions = "flac",
+ .raw_codec_id = AV_CODEC_ID_FLAC,
};
diff --git a/gst-libs/ext/libav/libavformat/flacenc.c b/gst-libs/ext/libav/libavformat/flacenc.c
index 725dc71..b770623 100644
--- a/gst-libs/ext/libav/libavformat/flacenc.c
+++ b/gst-libs/ext/libav/libavformat/flacenc.c
@@ -122,10 +122,10 @@ AVOutputFormat ff_flac_muxer = {
.long_name = NULL_IF_CONFIG_SMALL("raw FLAC"),
.mime_type = "audio/x-flac",
.extensions = "flac",
- .audio_codec = CODEC_ID_FLAC,
- .video_codec = CODEC_ID_NONE,
+ .audio_codec = AV_CODEC_ID_FLAC,
+ .video_codec = AV_CODEC_ID_NONE,
.write_header = flac_write_header,
.write_packet = flac_write_packet,
.write_trailer = flac_write_trailer,
- .flags= AVFMT_NOTIMESTAMPS,
+ .flags = AVFMT_NOTIMESTAMPS,
};
diff --git a/gst-libs/ext/libav/libavformat/flic.c b/gst-libs/ext/libav/libavformat/flic.c
index 7edc46e..2eb6f05 100644
--- a/gst-libs/ext/libav/libavformat/flic.c
+++ b/gst-libs/ext/libav/libavformat/flic.c
@@ -31,8 +31,8 @@
* special FLIs from the PC games "Magic Carpet" and "X-COM: Terror from the Deep".
*/
+#include "libavutil/channel_layout.h"
#include "libavutil/intreadwrite.h"
-#include "libavutil/audioconvert.h"
#include "avformat.h"
#include "internal.h"
@@ -83,8 +83,7 @@ static int flic_probe(AVProbeData *p)
return AVPROBE_SCORE_MAX;
}
-static int flic_read_header(AVFormatContext *s,
- AVFormatParameters *ap)
+static int flic_read_header(AVFormatContext *s)
{
FlicDemuxContext *flic = s->priv_data;
AVIOContext *pb = s->pb;
@@ -111,7 +110,7 @@ static int flic_read_header(AVFormatContext *s,
return AVERROR(ENOMEM);
flic->video_stream_index = st->index;
st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
- st->codec->codec_id = CODEC_ID_FLIC;
+ st->codec->codec_id = AV_CODEC_ID_FLIC;
st->codec->codec_tag = 0; /* no fourcc */
st->codec->width = AV_RL16(&header[0x08]);
st->codec->height = AV_RL16(&header[0x0A]);
@@ -155,7 +154,7 @@ static int flic_read_header(AVFormatContext *s,
/* all audio frames are the same size, so use the size of the first chunk for block_align */
ast->codec->block_align = AV_RL32(&preamble[0]);
ast->codec->codec_type = AVMEDIA_TYPE_AUDIO;
- ast->codec->codec_id = CODEC_ID_PCM_U8;
+ ast->codec->codec_id = AV_CODEC_ID_PCM_U8;
ast->codec->codec_tag = 0;
ast->codec->sample_rate = FLIC_TFTD_SAMPLE_RATE;
ast->codec->channels = 1;
@@ -263,7 +262,7 @@ static int flic_read_packet(AVFormatContext *s,
AVInputFormat ff_flic_demuxer = {
.name = "flic",
- .long_name = NULL_IF_CONFIG_SMALL("FLI/FLC/FLX animation format"),
+ .long_name = NULL_IF_CONFIG_SMALL("FLI/FLC/FLX animation"),
.priv_data_size = sizeof(FlicDemuxContext),
.read_probe = flic_probe,
.read_header = flic_read_header,
diff --git a/gst-libs/ext/libav/libavformat/flv.h b/gst-libs/ext/libav/libavformat/flv.h
index 6418b27..fe0fc90 100644
--- a/gst-libs/ext/libav/libavformat/flv.h
+++ b/gst-libs/ext/libav/libavformat/flv.h
@@ -82,6 +82,8 @@ enum {
FLV_CODECID_NELLYMOSER_16KHZ_MONO = 4 << FLV_AUDIO_CODECID_OFFSET,
FLV_CODECID_NELLYMOSER_8KHZ_MONO = 5 << FLV_AUDIO_CODECID_OFFSET,
FLV_CODECID_NELLYMOSER = 6 << FLV_AUDIO_CODECID_OFFSET,
+ FLV_CODECID_PCM_ALAW = 7 << FLV_AUDIO_CODECID_OFFSET,
+ FLV_CODECID_PCM_MULAW = 8 << FLV_AUDIO_CODECID_OFFSET,
FLV_CODECID_AAC = 10<< FLV_AUDIO_CODECID_OFFSET,
FLV_CODECID_SPEEX = 11<< FLV_AUDIO_CODECID_OFFSET,
};
diff --git a/gst-libs/ext/libav/libavformat/flvdec.c b/gst-libs/ext/libav/libavformat/flvdec.c
index 2f770b3..2f68653 100644
--- a/gst-libs/ext/libav/libavformat/flvdec.c
+++ b/gst-libs/ext/libav/libavformat/flvdec.c
@@ -25,7 +25,9 @@
*/
#include "libavutil/avstring.h"
+#include "libavutil/channel_layout.h"
#include "libavutil/dict.h"
+#include "libavutil/opt.h"
#include "libavutil/intfloat.h"
#include "libavutil/mathematics.h"
#include "libavcodec/bytestream.h"
@@ -39,12 +41,22 @@
#define KEYFRAMES_TIMESTAMP_TAG "times"
#define KEYFRAMES_BYTEOFFSET_TAG "filepositions"
+#define VALIDATE_INDEX_TS_THRESH 2500
+
typedef struct {
+ const AVClass *class; ///< Class for private options.
+ int trust_metadata; ///< configure streams according onMetaData
int wrong_dts; ///< wrong dts due to negative cts
uint8_t *new_extradata[2];
int new_extradata_size[2];
int last_sample_rate;
int last_channels;
+ struct {
+ int64_t dts;
+ int64_t pos;
+ } validate_index[2];
+ int validate_next;
+ int validate_count;
} FLVContext;
static int flv_probe(AVProbeData *p)
@@ -58,36 +70,103 @@ static int flv_probe(AVProbeData *p)
return 0;
}
+static AVStream *create_stream(AVFormatContext *s, int codec_type)
+{
+ AVStream *st = avformat_new_stream(s, NULL);
+ if (!st)
+ return NULL;
+ st->codec->codec_type = codec_type;
+ avpriv_set_pts_info(st, 32, 1, 1000); /* 32 bit pts in ms */
+ return st;
+}
+static int flv_same_audio_codec(AVCodecContext *acodec, int flags)
+{
+ int bits_per_coded_sample = (flags & FLV_AUDIO_SAMPLESIZE_MASK) ? 16 : 8;
+ int flv_codecid = flags & FLV_AUDIO_CODECID_MASK;
+ int codec_id;
+
+ if (!acodec->codec_id && !acodec->codec_tag)
+ return 1;
+
+ if (acodec->bits_per_coded_sample != bits_per_coded_sample)
+ return 0;
+
+ switch(flv_codecid) {
+ //no distinction between S16 and S8 PCM codec flags
+ case FLV_CODECID_PCM:
+ codec_id = bits_per_coded_sample == 8 ? AV_CODEC_ID_PCM_U8 :
+#if HAVE_BIGENDIAN
+ AV_CODEC_ID_PCM_S16BE;
+#else
+ AV_CODEC_ID_PCM_S16LE;
+#endif
+ return codec_id == acodec->codec_id;
+ case FLV_CODECID_PCM_LE:
+ codec_id = bits_per_coded_sample == 8 ? AV_CODEC_ID_PCM_U8 : AV_CODEC_ID_PCM_S16LE;
+ return codec_id == acodec->codec_id;
+ case FLV_CODECID_AAC:
+ return acodec->codec_id == AV_CODEC_ID_AAC;
+ case FLV_CODECID_ADPCM:
+ return acodec->codec_id == AV_CODEC_ID_ADPCM_SWF;
+ case FLV_CODECID_SPEEX:
+ return acodec->codec_id == AV_CODEC_ID_SPEEX;
+ case FLV_CODECID_MP3:
+ return acodec->codec_id == AV_CODEC_ID_MP3;
+ case FLV_CODECID_NELLYMOSER_8KHZ_MONO:
+ case FLV_CODECID_NELLYMOSER_16KHZ_MONO:
+ case FLV_CODECID_NELLYMOSER:
+ return acodec->codec_id == AV_CODEC_ID_NELLYMOSER;
+ case FLV_CODECID_PCM_MULAW:
+ return acodec->sample_rate == 8000 &&
+ acodec->codec_id == AV_CODEC_ID_PCM_MULAW;
+ case FLV_CODECID_PCM_ALAW:
+ return acodec->sample_rate = 8000 &&
+ acodec->codec_id == AV_CODEC_ID_PCM_ALAW;
+ default:
+ return acodec->codec_tag == (flv_codecid >> FLV_AUDIO_CODECID_OFFSET);
+ }
+
+ return 0;
+}
+
static void flv_set_audio_codec(AVFormatContext *s, AVStream *astream, AVCodecContext *acodec, int flv_codecid) {
switch(flv_codecid) {
//no distinction between S16 and S8 PCM codec flags
case FLV_CODECID_PCM:
- acodec->codec_id = acodec->bits_per_coded_sample == 8 ? CODEC_ID_PCM_U8 :
+ acodec->codec_id = acodec->bits_per_coded_sample == 8 ? AV_CODEC_ID_PCM_U8 :
#if HAVE_BIGENDIAN
- CODEC_ID_PCM_S16BE;
+ AV_CODEC_ID_PCM_S16BE;
#else
- CODEC_ID_PCM_S16LE;
+ AV_CODEC_ID_PCM_S16LE;
#endif
break;
case FLV_CODECID_PCM_LE:
- acodec->codec_id = acodec->bits_per_coded_sample == 8 ? CODEC_ID_PCM_U8 : CODEC_ID_PCM_S16LE; break;
- case FLV_CODECID_AAC : acodec->codec_id = CODEC_ID_AAC; break;
- case FLV_CODECID_ADPCM: acodec->codec_id = CODEC_ID_ADPCM_SWF; break;
+ acodec->codec_id = acodec->bits_per_coded_sample == 8 ? AV_CODEC_ID_PCM_U8 : AV_CODEC_ID_PCM_S16LE; break;
+ case FLV_CODECID_AAC : acodec->codec_id = AV_CODEC_ID_AAC; break;
+ case FLV_CODECID_ADPCM: acodec->codec_id = AV_CODEC_ID_ADPCM_SWF; break;
case FLV_CODECID_SPEEX:
- acodec->codec_id = CODEC_ID_SPEEX;
+ acodec->codec_id = AV_CODEC_ID_SPEEX;
acodec->sample_rate = 16000;
break;
- case FLV_CODECID_MP3 : acodec->codec_id = CODEC_ID_MP3 ; astream->need_parsing = AVSTREAM_PARSE_FULL; break;
+ case FLV_CODECID_MP3 : acodec->codec_id = AV_CODEC_ID_MP3 ; astream->need_parsing = AVSTREAM_PARSE_FULL; break;
case FLV_CODECID_NELLYMOSER_8KHZ_MONO:
acodec->sample_rate = 8000; //in case metadata does not otherwise declare samplerate
- acodec->codec_id = CODEC_ID_NELLYMOSER;
+ acodec->codec_id = AV_CODEC_ID_NELLYMOSER;
break;
case FLV_CODECID_NELLYMOSER_16KHZ_MONO:
acodec->sample_rate = 16000;
- acodec->codec_id = CODEC_ID_NELLYMOSER;
+ acodec->codec_id = AV_CODEC_ID_NELLYMOSER;
break;
case FLV_CODECID_NELLYMOSER:
- acodec->codec_id = CODEC_ID_NELLYMOSER;
+ acodec->codec_id = AV_CODEC_ID_NELLYMOSER;
+ break;
+ case FLV_CODECID_PCM_MULAW:
+ acodec->sample_rate = 8000;
+ acodec->codec_id = AV_CODEC_ID_PCM_MULAW;
+ break;
+ case FLV_CODECID_PCM_ALAW:
+ acodec->sample_rate = 8000;
+ acodec->codec_id = AV_CODEC_ID_PCM_ALAW;
break;
default:
av_log(s, AV_LOG_INFO, "Unsupported audio codec (%x)\n", flv_codecid >> FLV_AUDIO_CODECID_OFFSET);
@@ -95,24 +174,57 @@ static void flv_set_audio_codec(AVFormatContext *s, AVStream *astream, AVCodecCo
}
}
-static int flv_set_video_codec(AVFormatContext *s, AVStream *vstream, int flv_codecid) {
+static int flv_same_video_codec(AVCodecContext *vcodec, int flags)
+{
+ int flv_codecid = flags & FLV_VIDEO_CODECID_MASK;
+
+ if (!vcodec->codec_id && !vcodec->codec_tag)
+ return 1;
+
+ switch (flv_codecid) {
+ case FLV_CODECID_H263:
+ return vcodec->codec_id == AV_CODEC_ID_FLV1;
+ case FLV_CODECID_SCREEN:
+ return vcodec->codec_id == AV_CODEC_ID_FLASHSV;
+ case FLV_CODECID_SCREEN2:
+ return vcodec->codec_id == AV_CODEC_ID_FLASHSV2;
+ case FLV_CODECID_VP6:
+ return vcodec->codec_id == AV_CODEC_ID_VP6F;
+ case FLV_CODECID_VP6A:
+ return vcodec->codec_id == AV_CODEC_ID_VP6A;
+ case FLV_CODECID_H264:
+ return vcodec->codec_id == AV_CODEC_ID_H264;
+ default:
+ return vcodec->codec_tag == flv_codecid;
+ }
+
+ return 0;
+}
+
+static int flv_set_video_codec(AVFormatContext *s, AVStream *vstream, int flv_codecid, int read) {
AVCodecContext *vcodec = vstream->codec;
switch(flv_codecid) {
- case FLV_CODECID_H263 : vcodec->codec_id = CODEC_ID_FLV1 ; break;
- case FLV_CODECID_SCREEN: vcodec->codec_id = CODEC_ID_FLASHSV; break;
- case FLV_CODECID_SCREEN2: vcodec->codec_id = CODEC_ID_FLASHSV2; break;
- case FLV_CODECID_VP6 : vcodec->codec_id = CODEC_ID_VP6F ;
+ case FLV_CODECID_H263 : vcodec->codec_id = AV_CODEC_ID_FLV1 ; break;
+ case FLV_CODECID_SCREEN: vcodec->codec_id = AV_CODEC_ID_FLASHSV; break;
+ case FLV_CODECID_SCREEN2: vcodec->codec_id = AV_CODEC_ID_FLASHSV2; break;
+ case FLV_CODECID_VP6 : vcodec->codec_id = AV_CODEC_ID_VP6F ;
case FLV_CODECID_VP6A :
if(flv_codecid == FLV_CODECID_VP6A)
- vcodec->codec_id = CODEC_ID_VP6A;
- if(vcodec->extradata_size != 1) {
- vcodec->extradata_size = 1;
- vcodec->extradata = av_malloc(1);
+ vcodec->codec_id = AV_CODEC_ID_VP6A;
+ if (read) {
+ if (vcodec->extradata_size != 1) {
+ vcodec->extradata = av_malloc(1);
+ if (vcodec->extradata)
+ vcodec->extradata_size = 1;
+ }
+ if (vcodec->extradata)
+ vcodec->extradata[0] = avio_r8(s->pb);
+ else
+ avio_skip(s->pb, 1);
}
- vcodec->extradata[0] = avio_r8(s->pb);
return 1; // 1 byte body size adjustment for flv_read_packet()
case FLV_CODECID_H264:
- vcodec->codec_id = CODEC_ID_H264;
+ vcodec->codec_id = AV_CODEC_ID_H264;
return 3; // not 4, reading packet type will consume one byte
default:
av_log(s, AV_LOG_INFO, "Unsupported video codec (%x)\n", flv_codecid);
@@ -137,6 +249,7 @@ static int amf_get_string(AVIOContext *ioc, char *buffer, int buffsize) {
}
static int parse_keyframes_index(AVFormatContext *s, AVIOContext *ioc, AVStream *vstream, int64_t max_pos) {
+ FLVContext *flv = s->priv_data;
unsigned int arraylen = 0, timeslen = 0, fileposlen = 0, i;
double num_val;
char str_val[256];
@@ -144,18 +257,9 @@ static int parse_keyframes_index(AVFormatContext *s, AVIOContext *ioc, AVStream
int64_t *filepositions = NULL;
int ret = AVERROR(ENOSYS);
int64_t initial_pos = avio_tell(ioc);
- AVDictionaryEntry *creator = av_dict_get(s->metadata, "metadatacreator",
- NULL, 0);
-
- if (creator && !strcmp(creator->value, "MEGA")) {
- /* Files with this metadatacreator tag seem to have filepositions
- * pointing at the 4 trailer bytes of the previous packet,
- * which isn't the norm (nor what we expect here, nor what
- * jwplayer + lighttpd expect, nor what flvtool2 produces).
- * Just ignore the index in this case, instead of risking trying
- * to adjust it to something that might or might not work. */
+
+ if (s->flags & AVFMT_FLAG_IGNIDX)
return 0;
- }
while (avio_tell(ioc) < max_pos - 2 && amf_get_string(ioc, str_val, sizeof(str_val)) > 0) {
int64_t* current_array;
@@ -203,10 +307,17 @@ static int parse_keyframes_index(AVFormatContext *s, AVIOContext *ioc, AVStream
}
}
- if (!ret && timeslen == fileposlen)
- for (i = 0; i < fileposlen; i++)
- av_add_index_entry(vstream, filepositions[i], times[i]*1000, 0, 0, AVINDEX_KEYFRAME);
- else
+ if (!ret && timeslen == fileposlen) {
+ for (i = 0; i < fileposlen; i++) {
+ av_add_index_entry(vstream, filepositions[i], times[i]*1000,
+ 0, 0, AVINDEX_KEYFRAME);
+ if (i < 2) {
+ flv->validate_index[i].pos = filepositions[i];
+ flv->validate_index[i].dts = times[i] * 1000;
+ flv->validate_count = i + 1;
+ }
+ }
+ } else
av_log(s, AV_LOG_WARNING, "Invalid keyframes object, skipping.\n");
finish:
@@ -221,6 +332,7 @@ finish:
static int amf_parse_object(AVFormatContext *s, AVStream *astream, AVStream *vstream, const char *key, int64_t max_pos, int depth) {
AVCodecContext *acodec, *vcodec;
+ FLVContext *flv = s->priv_data;
AVIOContext *ioc;
AMFDataType amf_type;
char str_val[256];
@@ -240,22 +352,18 @@ static int amf_parse_object(AVFormatContext *s, AVStream *astream, AVStream *vst
if(amf_get_string(ioc, str_val, sizeof(str_val)) < 0)
return -1;
break;
- case AMF_DATA_TYPE_OBJECT: {
- unsigned int keylen;
-
+ case AMF_DATA_TYPE_OBJECT:
if ((vstream || astream) && key && !strcmp(KEYFRAMES_TAG, key) && depth == 1)
if (parse_keyframes_index(s, ioc, vstream ? vstream : astream,
max_pos) < 0)
return -1;
- while(avio_tell(ioc) < max_pos - 2 && (keylen = avio_rb16(ioc))) {
- avio_skip(ioc, keylen); //skip key string
- if(amf_parse_object(s, NULL, NULL, NULL, max_pos, depth + 1) < 0)
+ while (avio_tell(ioc) < max_pos - 2 && amf_get_string(ioc, str_val, sizeof(str_val)) > 0) {
+ if (amf_parse_object(s, astream, vstream, str_val, max_pos, depth + 1) < 0)
return -1; //if we couldn't skip, bomb out.
}
if(avio_r8(ioc) != AMF_END_OF_OBJECT)
return -1;
- }
break;
case AMF_DATA_TYPE_NULL:
case AMF_DATA_TYPE_UNDEFINED:
@@ -292,13 +400,43 @@ 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 (amf_type == AMF_DATA_TYPE_NUMBER || amf_type == AMF_DATA_TYPE_BOOL) {
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 (!strcmp(key, "datastream")) {
+ AVStream *st = create_stream(s, AVMEDIA_TYPE_DATA);
+ if (!st)
+ return AVERROR(ENOMEM);
+ st->codec->codec_id = AV_CODEC_ID_TEXT;
+ } else if (flv->trust_metadata) {
+ if (!strcmp(key, "videocodecid") && vcodec) {
+ flv_set_video_codec(s, vstream, num_val, 0);
+ } else
+ if (!strcmp(key, "audiocodecid") && acodec) {
+ int id = ((int)num_val) << FLV_AUDIO_CODECID_OFFSET;
+ flv_set_audio_codec(s, astream, acodec, id);
+ } else
+ if (!strcmp(key, "audiosamplerate") && acodec) {
+ acodec->sample_rate = num_val;
+ } else if (!strcmp(key, "audiosamplesize") && acodec) {
+ acodec->bits_per_coded_sample = num_val;
+ } else if (!strcmp(key, "stereo") && acodec) {
+ acodec->channels = num_val + 1;
+ acodec->channel_layout = acodec->channels == 2 ?
+ AV_CH_LAYOUT_STEREO :
+ AV_CH_LAYOUT_MONO;
+ } else
+ if (!strcmp(key, "width") && vcodec) {
+ vcodec->width = num_val;
+ } else
+ if (!strcmp(key, "height") && vcodec) {
+ vcodec->height = num_val;
+ }
+ }
}
if (!strcmp(key, "duration") ||
@@ -341,7 +479,14 @@ static int flv_read_metabody(AVFormatContext *s, int64_t next_pos) {
//first object needs to be "onMetaData" string
type = avio_r8(ioc);
- if(type != AMF_DATA_TYPE_STRING || amf_get_string(ioc, buffer, sizeof(buffer)) < 0 || strcmp(buffer, "onMetaData"))
+ if (type != AMF_DATA_TYPE_STRING ||
+ amf_get_string(ioc, buffer, sizeof(buffer)) < 0)
+ return -1;
+
+ if (!strcmp(buffer, "onTextData"))
+ return 1;
+
+ if (strcmp(buffer, "onMetaData"))
return -1;
//find the streams now so that amf_parse_object doesn't need to do the lookup every time it is called.
@@ -358,18 +503,7 @@ static int flv_read_metabody(AVFormatContext *s, int64_t next_pos) {
return 0;
}
-static AVStream *create_stream(AVFormatContext *s, int is_audio){
- AVStream *st = avformat_new_stream(s, NULL);
- if (!st)
- return NULL;
- st->id = is_audio;
- st->codec->codec_type = is_audio ? AVMEDIA_TYPE_AUDIO : AVMEDIA_TYPE_VIDEO;
- avpriv_set_pts_info(st, 32, 1, 1000); /* 32 bit pts in ms */
- return st;
-}
-
-static int flv_read_header(AVFormatContext *s,
- AVFormatParameters *ap)
+static int flv_read_header(AVFormatContext *s)
{
int offset, flags;
@@ -382,16 +516,14 @@ static int flv_read_header(AVFormatContext *s,
av_log(s, AV_LOG_WARNING, "Broken FLV file, which says no streams present, this might fail\n");
}
- if((flags & (FLV_HEADER_FLAG_HASVIDEO|FLV_HEADER_FLAG_HASAUDIO))
- != (FLV_HEADER_FLAG_HASVIDEO|FLV_HEADER_FLAG_HASAUDIO))
- s->ctx_flags |= AVFMTCTX_NOHEADER;
+ s->ctx_flags |= AVFMTCTX_NOHEADER;
if(flags & FLV_HEADER_FLAG_HASVIDEO){
- if(!create_stream(s, 0))
+ if(!create_stream(s, AVMEDIA_TYPE_VIDEO))
return AVERROR(ENOMEM);
}
if(flags & FLV_HEADER_FLAG_HASAUDIO){
- if(!create_stream(s, 1))
+ if(!create_stream(s, AVMEDIA_TYPE_AUDIO))
return AVERROR(ENOMEM);
}
@@ -435,6 +567,81 @@ static int flv_queue_extradata(FLVContext *flv, AVIOContext *pb, int stream,
return 0;
}
+static void clear_index_entries(AVFormatContext *s, int64_t pos)
+{
+ int i, j, out;
+ av_log(s, AV_LOG_WARNING, "Found invalid index entries, clearing the index.\n");
+ for (i = 0; i < s->nb_streams; i++) {
+ AVStream *st = s->streams[i];
+ /* Remove all index entries that point to >= pos */
+ out = 0;
+ for (j = 0; j < st->nb_index_entries; j++) {
+ if (st->index_entries[j].pos < pos)
+ st->index_entries[out++] = st->index_entries[j];
+ }
+ st->nb_index_entries = out;
+ }
+}
+
+
+static int flv_data_packet(AVFormatContext *s, AVPacket *pkt,
+ int64_t dts, int64_t next)
+{
+ int ret = AVERROR_INVALIDDATA, i;
+ AVIOContext *pb = s->pb;
+ AVStream *st = NULL;
+ AMFDataType type;
+ char buf[20];
+ int length;
+
+ type = avio_r8(pb);
+ if (type == AMF_DATA_TYPE_MIXEDARRAY)
+ avio_seek(pb, 4, SEEK_CUR);
+ else if (type != AMF_DATA_TYPE_OBJECT)
+ goto out;
+
+ amf_get_string(pb, buf, sizeof(buf));
+ if (strcmp(buf, "type") || avio_r8(pb) != AMF_DATA_TYPE_STRING)
+ goto out;
+
+ amf_get_string(pb, buf, sizeof(buf));
+ //FIXME parse it as codec_id
+ amf_get_string(pb, buf, sizeof(buf));
+ if (strcmp(buf, "text") || avio_r8(pb) != AMF_DATA_TYPE_STRING)
+ goto out;
+
+ length = avio_rb16(pb);
+ ret = av_get_packet(s->pb, pkt, length);
+ if (ret < 0) {
+ ret = AVERROR(EIO);
+ goto out;
+ }
+
+ for (i = 0; i < s->nb_streams; i++) {
+ st = s->streams[i];
+ if (st->codec->codec_type == AVMEDIA_TYPE_DATA)
+ break;
+ }
+
+ if (i == s->nb_streams) {
+ st = create_stream(s, AVMEDIA_TYPE_DATA);
+ if (!st)
+ goto out;
+ st->codec->codec_id = AV_CODEC_ID_TEXT;
+ }
+
+ pkt->dts = dts;
+ pkt->pts = dts;
+ pkt->size = ret;
+
+ pkt->stream_index = st->index;
+ pkt->flags |= AV_PKT_FLAG_KEY;
+
+ avio_seek(s->pb, next + 4, SEEK_SET);
+out:
+ return ret;
+}
+
static int flv_read_packet(AVFormatContext *s, AVPacket *pkt)
{
FLVContext *flv = s->priv_data;
@@ -456,6 +663,22 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt)
avio_skip(s->pb, 3); /* stream id, always 0 */
flags = 0;
+ if (flv->validate_next < flv->validate_count) {
+ int64_t validate_pos = flv->validate_index[flv->validate_next].pos;
+ if (pos == validate_pos) {
+ if (FFABS(dts - flv->validate_index[flv->validate_next].dts) <=
+ VALIDATE_INDEX_TS_THRESH) {
+ flv->validate_next++;
+ } else {
+ clear_index_entries(s, validate_pos);
+ flv->validate_count = 0;
+ }
+ } else if (pos > validate_pos) {
+ clear_index_entries(s, validate_pos);
+ flv->validate_count = 0;
+ }
+ }
+
if(size == 0)
continue;
@@ -473,7 +696,9 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt)
goto skip;
} else {
if (type == FLV_TAG_TYPE_META && size > 13+1+4)
- flv_read_metabody(s, next);
+ if (flv_read_metabody(s, next) > 0) {
+ return flv_data_packet(s, pkt, dts, next);
+ }
else /* skip packet */
av_log(s, AV_LOG_DEBUG, "skipping flv packet: type %d, size %d, flags %d\n", type, size, flags);
skip:
@@ -488,13 +713,20 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt)
/* now find stream */
for(i=0;i<s->nb_streams;i++) {
st = s->streams[i];
- if (st->id == is_audio)
- break;
+ if (is_audio && st->codec->codec_type == AVMEDIA_TYPE_AUDIO) {
+ if (flv_same_audio_codec(st->codec, flags)) {
+ break;
+ }
+ } else
+ if (!is_audio && st->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
+ if (flv_same_video_codec(st->codec, flags)) {
+ break;
+ }
+ }
}
if(i == s->nb_streams){
- av_log(s, AV_LOG_ERROR, "invalid stream\n");
- st= create_stream(s, is_audio);
- s->ctx_flags &= ~AVFMTCTX_NOHEADER;
+ st = create_stream(s,
+ is_audio ? AVMEDIA_TYPE_AUDIO : AVMEDIA_TYPE_VIDEO);
}
av_dlog(s, "%d %X %d \n", is_audio, flags, st->discard);
if( (st->discard >= AVDISCARD_NONKEY && !((flags & FLV_VIDEO_FRAMETYPE_MASK) == FLV_FRAME_KEY || is_audio))
@@ -532,13 +764,15 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt)
bits_per_coded_sample = (flags & FLV_AUDIO_SAMPLESIZE_MASK) ? 16 : 8;
if(!st->codec->channels || !st->codec->sample_rate || !st->codec->bits_per_coded_sample) {
st->codec->channels = channels;
+ st->codec->channel_layout = channels == 1 ? AV_CH_LAYOUT_MONO :
+ AV_CH_LAYOUT_STEREO;
st->codec->sample_rate = sample_rate;
st->codec->bits_per_coded_sample = bits_per_coded_sample;
}
if(!st->codec->codec_id){
flv_set_audio_codec(s, st, st->codec, flags & FLV_AUDIO_CODECID_MASK);
- flv->last_sample_rate = st->codec->sample_rate;
- flv->last_channels = st->codec->channels;
+ flv->last_sample_rate = sample_rate = st->codec->sample_rate;
+ flv->last_channels = channels = st->codec->channels;
} else {
AVCodecContext ctx;
ctx.sample_rate = sample_rate;
@@ -546,14 +780,14 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt)
sample_rate = ctx.sample_rate;
}
}else{
- size -= flv_set_video_codec(s, st, flags & FLV_VIDEO_CODECID_MASK);
+ size -= flv_set_video_codec(s, st, flags & FLV_VIDEO_CODECID_MASK, 1);
}
- if (st->codec->codec_id == CODEC_ID_AAC ||
- st->codec->codec_id == CODEC_ID_H264) {
+ if (st->codec->codec_id == AV_CODEC_ID_AAC ||
+ st->codec->codec_id == AV_CODEC_ID_H264) {
int type = avio_r8(s->pb);
size--;
- if (st->codec->codec_id == CODEC_ID_H264) {
+ if (st->codec->codec_id == AV_CODEC_ID_H264) {
int32_t cts = (avio_rb24(s->pb)+0xff800000)^0xff800000; // sign extension
pts = dts + cts;
if (cts < 0) { // dts are wrong
@@ -572,11 +806,12 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt)
}
if ((ret = flv_get_extradata(s, st, size)) < 0)
return ret;
- if (st->codec->codec_id == CODEC_ID_AAC) {
+ if (st->codec->codec_id == AV_CODEC_ID_AAC) {
MPEG4AudioConfig cfg;
avpriv_mpeg4audio_get_config(&cfg, st->codec->extradata,
st->codec->extradata_size * 8, 1);
st->codec->channels = cfg.channels;
+ st->codec->channel_layout = 0;
if (cfg.ext_sample_rate)
st->codec->sample_rate = cfg.ext_sample_rate;
else
@@ -634,48 +869,34 @@ leave:
static int flv_read_seek(AVFormatContext *s, int stream_index,
int64_t ts, int flags)
{
+ FLVContext *flv = s->priv_data;
+ flv->validate_count = 0;
return avio_seek_time(s->pb, stream_index, ts, flags);
}
-#if 0 /* don't know enough to implement this */
-static int flv_read_seek2(AVFormatContext *s, int stream_index,
- int64_t min_ts, int64_t ts, int64_t max_ts, int flags)
-{
- int ret = AVERROR(ENOSYS);
-
- if (ts - min_ts > (uint64_t)(max_ts - ts)) flags |= AVSEEK_FLAG_BACKWARD;
-
- if (!s->pb->seekable) {
- if (stream_index < 0) {
- stream_index = av_find_default_stream_index(s);
- if (stream_index < 0)
- return -1;
-
- /* timestamp for default must be expressed in AV_TIME_BASE units */
- ts = av_rescale_rnd(ts, 1000, AV_TIME_BASE,
- flags & AVSEEK_FLAG_BACKWARD ? AV_ROUND_DOWN : AV_ROUND_UP);
- }
- ret = avio_seek_time(s->pb, stream_index, ts, flags);
- }
+#define OFFSET(x) offsetof(FLVContext, x)
+#define VD AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_DECODING_PARAM
+static const AVOption options[] = {
+ { "flv_metadata", "Allocate streams according the onMetaData array", OFFSET(trust_metadata), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, VD},
+ { NULL }
+};
- if (ret == AVERROR(ENOSYS))
- ret = av_seek_frame(s, stream_index, ts, flags);
- return ret;
-}
-#endif
+static const AVClass class = {
+ .class_name = "flvdec",
+ .item_name = av_default_item_name,
+ .option = options,
+ .version = LIBAVUTIL_VERSION_INT,
+};
AVInputFormat ff_flv_demuxer = {
.name = "flv",
- .long_name = NULL_IF_CONFIG_SMALL("FLV format"),
+ .long_name = NULL_IF_CONFIG_SMALL("FLV (Flash Video)"),
.priv_data_size = sizeof(FLVContext),
.read_probe = flv_probe,
.read_header = flv_read_header,
.read_packet = flv_read_packet,
- .read_seek = flv_read_seek,
-#if 0
- .read_seek2 = flv_read_seek2,
-#endif
- .read_close = flv_read_close,
- .extensions = "flv",
- .value = CODEC_ID_FLV1,
+ .read_seek = flv_read_seek,
+ .read_close = flv_read_close,
+ .extensions = "flv",
+ .priv_class = &class,
};
diff --git a/gst-libs/ext/libav/libavformat/flvenc.c b/gst-libs/ext/libav/libavformat/flvenc.c
index 623bea7..ff6d14a 100644
--- a/gst-libs/ext/libav/libavformat/flvenc.c
+++ b/gst-libs/ext/libav/libavformat/flvenc.c
@@ -19,41 +19,43 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "libavutil/dict.h"
#include "libavutil/intfloat.h"
+#include "avc.h"
#include "avformat.h"
#include "flv.h"
#include "internal.h"
-#include "avc.h"
#include "metadata.h"
-#include "libavutil/dict.h"
#undef NDEBUG
#include <assert.h>
static const AVCodecTag flv_video_codec_ids[] = {
- {CODEC_ID_FLV1, FLV_CODECID_H263 },
- {CODEC_ID_FLASHSV, FLV_CODECID_SCREEN},
- {CODEC_ID_FLASHSV2, FLV_CODECID_SCREEN2},
- {CODEC_ID_VP6F, FLV_CODECID_VP6 },
- {CODEC_ID_VP6, FLV_CODECID_VP6 },
- {CODEC_ID_H264, FLV_CODECID_H264 },
- {CODEC_ID_NONE, 0}
+ { AV_CODEC_ID_FLV1, FLV_CODECID_H263 },
+ { AV_CODEC_ID_FLASHSV, FLV_CODECID_SCREEN },
+ { AV_CODEC_ID_FLASHSV2, FLV_CODECID_SCREEN2 },
+ { AV_CODEC_ID_VP6F, FLV_CODECID_VP6 },
+ { AV_CODEC_ID_VP6, FLV_CODECID_VP6 },
+ { AV_CODEC_ID_H264, FLV_CODECID_H264 },
+ { AV_CODEC_ID_NONE, 0 }
};
static const AVCodecTag flv_audio_codec_ids[] = {
- {CODEC_ID_MP3, FLV_CODECID_MP3 >> FLV_AUDIO_CODECID_OFFSET},
- {CODEC_ID_PCM_U8, FLV_CODECID_PCM >> FLV_AUDIO_CODECID_OFFSET},
- {CODEC_ID_PCM_S16BE, FLV_CODECID_PCM >> FLV_AUDIO_CODECID_OFFSET},
- {CODEC_ID_PCM_S16LE, FLV_CODECID_PCM_LE >> FLV_AUDIO_CODECID_OFFSET},
- {CODEC_ID_ADPCM_SWF, FLV_CODECID_ADPCM >> FLV_AUDIO_CODECID_OFFSET},
- {CODEC_ID_AAC, FLV_CODECID_AAC >> FLV_AUDIO_CODECID_OFFSET},
- {CODEC_ID_NELLYMOSER, FLV_CODECID_NELLYMOSER >> FLV_AUDIO_CODECID_OFFSET},
- {CODEC_ID_SPEEX, FLV_CODECID_SPEEX >> FLV_AUDIO_CODECID_OFFSET},
- {CODEC_ID_NONE, 0}
+ { AV_CODEC_ID_MP3, FLV_CODECID_MP3 >> FLV_AUDIO_CODECID_OFFSET },
+ { AV_CODEC_ID_PCM_U8, FLV_CODECID_PCM >> FLV_AUDIO_CODECID_OFFSET },
+ { AV_CODEC_ID_PCM_S16BE, FLV_CODECID_PCM >> FLV_AUDIO_CODECID_OFFSET },
+ { AV_CODEC_ID_PCM_S16LE, FLV_CODECID_PCM_LE >> FLV_AUDIO_CODECID_OFFSET },
+ { AV_CODEC_ID_ADPCM_SWF, FLV_CODECID_ADPCM >> FLV_AUDIO_CODECID_OFFSET },
+ { AV_CODEC_ID_AAC, FLV_CODECID_AAC >> FLV_AUDIO_CODECID_OFFSET },
+ { AV_CODEC_ID_NELLYMOSER, FLV_CODECID_NELLYMOSER >> FLV_AUDIO_CODECID_OFFSET },
+ { AV_CODEC_ID_PCM_MULAW, FLV_CODECID_PCM_MULAW >> FLV_AUDIO_CODECID_OFFSET },
+ { AV_CODEC_ID_PCM_ALAW, FLV_CODECID_PCM_ALAW >> FLV_AUDIO_CODECID_OFFSET },
+ { AV_CODEC_ID_SPEEX, FLV_CODECID_SPEEX >> FLV_AUDIO_CODECID_OFFSET },
+ { AV_CODEC_ID_NONE, 0 }
};
typedef struct FLVContext {
- int reserved;
+ int reserved;
int64_t duration_offset;
int64_t filesize_offset;
int64_t duration;
@@ -64,79 +66,89 @@ typedef struct FLVStreamContext {
int64_t last_ts; ///< last timestamp for each stream
} FLVStreamContext;
-static int get_audio_flags(AVCodecContext *enc){
- int flags = (enc->bits_per_coded_sample == 16) ? FLV_SAMPLESSIZE_16BIT : FLV_SAMPLESSIZE_8BIT;
+static int get_audio_flags(AVFormatContext *s, AVCodecContext *enc)
+{
+ int flags = (enc->bits_per_coded_sample == 16) ? FLV_SAMPLESSIZE_16BIT
+ : FLV_SAMPLESSIZE_8BIT;
- if (enc->codec_id == CODEC_ID_AAC) // specs force these parameters
- return FLV_CODECID_AAC | FLV_SAMPLERATE_44100HZ | FLV_SAMPLESSIZE_16BIT | FLV_STEREO;
- else if (enc->codec_id == CODEC_ID_SPEEX) {
+ if (enc->codec_id == AV_CODEC_ID_AAC) // specs force these parameters
+ return FLV_CODECID_AAC | FLV_SAMPLERATE_44100HZ |
+ FLV_SAMPLESSIZE_16BIT | FLV_STEREO;
+ else if (enc->codec_id == AV_CODEC_ID_SPEEX) {
if (enc->sample_rate != 16000) {
- av_log(enc, AV_LOG_ERROR, "flv only supports wideband (16kHz) Speex audio\n");
+ av_log(s, AV_LOG_ERROR,
+ "flv only supports wideband (16kHz) Speex audio\n");
return -1;
}
if (enc->channels != 1) {
- av_log(enc, AV_LOG_ERROR, "flv only supports mono Speex audio\n");
+ av_log(s, AV_LOG_ERROR, "flv only supports mono Speex audio\n");
return -1;
}
return FLV_CODECID_SPEEX | FLV_SAMPLERATE_11025HZ | FLV_SAMPLESSIZE_16BIT;
} else {
- switch (enc->sample_rate) {
- case 44100:
+ switch (enc->sample_rate) {
+ case 44100:
flags |= FLV_SAMPLERATE_44100HZ;
break;
- case 22050:
+ case 22050:
flags |= FLV_SAMPLERATE_22050HZ;
break;
- case 11025:
+ case 11025:
flags |= FLV_SAMPLERATE_11025HZ;
break;
- case 16000: //nellymoser only
- case 8000: //nellymoser only
- case 5512: //not mp3
- if(enc->codec_id != CODEC_ID_MP3){
+ case 16000: // nellymoser only
+ case 8000: // nellymoser only
+ case 5512: // not MP3
+ if (enc->codec_id != AV_CODEC_ID_MP3) {
flags |= FLV_SAMPLERATE_SPECIAL;
break;
}
default:
- av_log(enc, AV_LOG_ERROR, "flv does not support that sample rate, choose from (44100, 22050, 11025).\n");
+ av_log(s, AV_LOG_ERROR,
+ "flv does not support that sample rate, "
+ "choose from (44100, 22050, 11025).\n");
return -1;
- }
+ }
}
- if (enc->channels > 1) {
+ if (enc->channels > 1)
flags |= FLV_STEREO;
- }
- switch(enc->codec_id){
- case CODEC_ID_MP3:
+ switch (enc->codec_id) {
+ case AV_CODEC_ID_MP3:
flags |= FLV_CODECID_MP3 | FLV_SAMPLESSIZE_16BIT;
break;
- case CODEC_ID_PCM_U8:
+ case AV_CODEC_ID_PCM_U8:
flags |= FLV_CODECID_PCM | FLV_SAMPLESSIZE_8BIT;
break;
- case CODEC_ID_PCM_S16BE:
+ case AV_CODEC_ID_PCM_S16BE:
flags |= FLV_CODECID_PCM | FLV_SAMPLESSIZE_16BIT;
break;
- case CODEC_ID_PCM_S16LE:
+ case AV_CODEC_ID_PCM_S16LE:
flags |= FLV_CODECID_PCM_LE | FLV_SAMPLESSIZE_16BIT;
break;
- case CODEC_ID_ADPCM_SWF:
- flags |= FLV_CODECID_ADPCM | FLV_SAMPLESSIZE_16BIT;
+ case AV_CODEC_ID_ADPCM_SWF:
+ flags |= FLV_CODECID_ADPCM | FLV_SAMPLESSIZE_16BIT;
break;
- case CODEC_ID_NELLYMOSER:
- if (enc->sample_rate == 8000) {
- flags |= FLV_CODECID_NELLYMOSER_8KHZ_MONO | FLV_SAMPLESSIZE_16BIT;
- } else if (enc->sample_rate == 16000) {
+ case AV_CODEC_ID_NELLYMOSER:
+ if (enc->sample_rate == 8000)
+ flags |= FLV_CODECID_NELLYMOSER_8KHZ_MONO | FLV_SAMPLESSIZE_16BIT;
+ else if (enc->sample_rate == 16000)
flags |= FLV_CODECID_NELLYMOSER_16KHZ_MONO | FLV_SAMPLESSIZE_16BIT;
- } else {
- flags |= FLV_CODECID_NELLYMOSER | FLV_SAMPLESSIZE_16BIT;
- }
+ else
+ flags |= FLV_CODECID_NELLYMOSER | FLV_SAMPLESSIZE_16BIT;
+ break;
+ case AV_CODEC_ID_PCM_MULAW:
+ flags = FLV_CODECID_PCM_MULAW | FLV_SAMPLERATE_SPECIAL | FLV_SAMPLESSIZE_16BIT;
+ break;
+ case AV_CODEC_ID_PCM_ALAW:
+ flags = FLV_CODECID_PCM_ALAW | FLV_SAMPLERATE_SPECIAL | FLV_SAMPLESSIZE_16BIT;
break;
case 0:
- flags |= enc->codec_tag<<4;
+ flags |= enc->codec_tag << 4;
break;
default:
- av_log(enc, AV_LOG_ERROR, "codec not compatible with flv\n");
+ av_log(s, AV_LOG_ERROR, "codec not compatible with flv\n");
return -1;
}
@@ -150,16 +162,17 @@ static void put_amf_string(AVIOContext *pb, const char *str)
avio_write(pb, str, len);
}
-static void put_avc_eos_tag(AVIOContext *pb, unsigned ts) {
+static void put_avc_eos_tag(AVIOContext *pb, unsigned ts)
+{
avio_w8(pb, FLV_TAG_TYPE_VIDEO);
- avio_wb24(pb, 5); /* Tag Data Size */
- avio_wb24(pb, ts); /* lower 24 bits of timestamp in ms*/
- avio_w8(pb, (ts >> 24) & 0x7F); /* MSB of ts in ms*/
- avio_wb24(pb, 0); /* StreamId = 0 */
- avio_w8(pb, 23); /* ub[4] FrameType = 1, ub[4] CodecId = 7 */
- avio_w8(pb, 2); /* AVC end of sequence */
- avio_wb24(pb, 0); /* Always 0 for AVC EOS. */
- avio_wb32(pb, 16); /* Size of FLV tag */
+ avio_wb24(pb, 5); /* Tag Data Size */
+ avio_wb24(pb, ts); /* lower 24 bits of timestamp in ms */
+ avio_w8(pb, (ts >> 24) & 0x7F); /* MSB of ts in ms */
+ avio_wb24(pb, 0); /* StreamId = 0 */
+ avio_w8(pb, 23); /* ub[4] FrameType = 1, ub[4] CodecId = 7 */
+ avio_w8(pb, 2); /* AVC end of sequence */
+ avio_wb24(pb, 0); /* Always 0 for AVC EOS. */
+ avio_wb32(pb, 16); /* Size of FLV tag */
}
static void put_amf_double(AVIOContext *pb, double d)
@@ -168,7 +181,8 @@ static void put_amf_double(AVIOContext *pb, double d)
avio_wb64(pb, av_double2int(d));
}
-static void put_amf_bool(AVIOContext *pb, int b) {
+static void put_amf_bool(AVIOContext *pb, int b)
+{
avio_w8(pb, AMF_DATA_TYPE_BOOL);
avio_w8(pb, !!b);
}
@@ -177,30 +191,44 @@ static int flv_write_header(AVFormatContext *s)
{
AVIOContext *pb = s->pb;
FLVContext *flv = s->priv_data;
- AVCodecContext *audio_enc = NULL, *video_enc = NULL;
+ AVCodecContext *audio_enc = NULL, *video_enc = NULL, *data_enc = NULL;
int i, metadata_count = 0;
double framerate = 0.0;
int64_t metadata_size_pos, data_size, metadata_count_pos;
AVDictionaryEntry *tag = NULL;
- for(i=0; i<s->nb_streams; i++){
+ for (i = 0; i < s->nb_streams; i++) {
AVCodecContext *enc = s->streams[i]->codec;
FLVStreamContext *sc;
- if (enc->codec_type == AVMEDIA_TYPE_VIDEO) {
- if (s->streams[i]->r_frame_rate.den && s->streams[i]->r_frame_rate.num) {
- framerate = av_q2d(s->streams[i]->r_frame_rate);
+ switch (enc->codec_type) {
+ case AVMEDIA_TYPE_VIDEO:
+ if (s->streams[i]->avg_frame_rate.den &&
+ s->streams[i]->avg_frame_rate.num) {
+ framerate = av_q2d(s->streams[i]->avg_frame_rate);
} else {
- framerate = 1/av_q2d(s->streams[i]->codec->time_base);
+ framerate = 1 / av_q2d(s->streams[i]->codec->time_base);
}
video_enc = enc;
- if(enc->codec_tag == 0) {
- av_log(enc, AV_LOG_ERROR, "video codec not compatible with flv\n");
+ if (enc->codec_tag == 0) {
+ av_log(s, AV_LOG_ERROR, "video codec not compatible with flv\n");
return -1;
}
- } else {
+ break;
+ case AVMEDIA_TYPE_AUDIO:
audio_enc = enc;
- if(get_audio_flags(enc)<0)
- return -1;
+ if (get_audio_flags(s, enc) < 0)
+ return AVERROR_INVALIDDATA;
+ break;
+ case AVMEDIA_TYPE_DATA:
+ if (enc->codec_id != AV_CODEC_ID_TEXT) {
+ av_log(s, AV_LOG_ERROR, "codec not compatible with flv\n");
+ return AVERROR_INVALIDDATA;
+ }
+ data_enc = enc;
+ break;
+ default:
+ av_log(s, AV_LOG_ERROR, "codec not compatible with flv\n");
+ return -1;
}
avpriv_set_pts_info(s->streams[i], 32, 1, 1000); /* 32 bit pts in ms */
@@ -210,32 +238,32 @@ static int flv_write_header(AVFormatContext *s)
s->streams[i]->priv_data = sc;
sc->last_ts = -1;
}
+
flv->delay = AV_NOPTS_VALUE;
avio_write(pb, "FLV", 3);
- avio_w8(pb,1);
- avio_w8(pb, FLV_HEADER_FLAG_HASAUDIO * !!audio_enc
- + FLV_HEADER_FLAG_HASVIDEO * !!video_enc);
- avio_wb32(pb,9);
- avio_wb32(pb,0);
-
- for(i=0; i<s->nb_streams; i++){
- if(s->streams[i]->codec->codec_tag == 5){
- avio_w8(pb,8); // message type
- avio_wb24(pb,0); // include flags
- avio_wb24(pb,0); // time stamp
- avio_wb32(pb,0); // reserved
- avio_wb32(pb,11); // size
- flv->reserved=5;
+ avio_w8(pb, 1);
+ avio_w8(pb, FLV_HEADER_FLAG_HASAUDIO * !!audio_enc +
+ FLV_HEADER_FLAG_HASVIDEO * !!video_enc);
+ avio_wb32(pb, 9);
+ avio_wb32(pb, 0);
+
+ for (i = 0; i < s->nb_streams; i++)
+ if (s->streams[i]->codec->codec_tag == 5) {
+ avio_w8(pb, 8); // message type
+ avio_wb24(pb, 0); // include flags
+ avio_wb24(pb, 0); // time stamp
+ avio_wb32(pb, 0); // reserved
+ avio_wb32(pb, 11); // size
+ flv->reserved = 5;
}
- }
/* write meta_tag */
- avio_w8(pb, 18); // tag type META
- metadata_size_pos= avio_tell(pb);
- avio_wb24(pb, 0); // size of data part (sum of all parts below)
- avio_wb24(pb, 0); // time stamp
- avio_wb32(pb, 0); // reserved
+ avio_w8(pb, 18); // tag type META
+ metadata_size_pos = avio_tell(pb);
+ avio_wb24(pb, 0); // size of data part (sum of all parts below)
+ avio_wb24(pb, 0); // timestamp
+ avio_wb32(pb, 0); // reserved
/* now data of data_size size */
@@ -246,14 +274,20 @@ static int flv_write_header(AVFormatContext *s)
/* mixed array (hash) with size and string/type/data tuples */
avio_w8(pb, AMF_DATA_TYPE_MIXEDARRAY);
metadata_count_pos = avio_tell(pb);
- metadata_count = 5*!!video_enc + 5*!!audio_enc + 2; // +2 for duration and file size
+ metadata_count = 5 * !!video_enc +
+ 5 * !!audio_enc +
+ 1 * !!data_enc +
+ 2; // +2 for duration and file size
+
avio_wb32(pb, metadata_count);
put_amf_string(pb, "duration");
flv->duration_offset= avio_tell(pb);
- put_amf_double(pb, s->duration / AV_TIME_BASE); // fill in the guessed duration, it'll be corrected later if incorrect
- if(video_enc){
+ // fill in the guessed duration, it'll be corrected later if incorrect
+ put_amf_double(pb, s->duration / AV_TIME_BASE);
+
+ if (video_enc) {
put_amf_string(pb, "width");
put_amf_double(pb, video_enc->width);
@@ -270,7 +304,7 @@ static int flv_write_header(AVFormatContext *s)
put_amf_double(pb, video_enc->codec_tag);
}
- if(audio_enc){
+ if (audio_enc) {
put_amf_string(pb, "audiodatarate");
put_amf_double(pb, audio_enc->bit_rate / 1024.0);
@@ -278,7 +312,7 @@ static int flv_write_header(AVFormatContext *s)
put_amf_double(pb, audio_enc->sample_rate);
put_amf_string(pb, "audiosamplesize");
- put_amf_double(pb, audio_enc->codec_id == CODEC_ID_PCM_U8 ? 8 : 16);
+ put_amf_double(pb, audio_enc->codec_id == AV_CODEC_ID_PCM_U8 ? 8 : 16);
put_amf_string(pb, "stereo");
put_amf_bool(pb, audio_enc->channels == 2);
@@ -287,6 +321,11 @@ static int flv_write_header(AVFormatContext *s)
put_amf_double(pb, audio_enc->codec_tag);
}
+ if (data_enc) {
+ put_amf_string(pb, "datastream");
+ put_amf_double(pb, 0.0);
+ }
+
while ((tag = av_dict_get(s->metadata, "", tag, AV_DICT_IGNORE_SUFFIX))) {
put_amf_string(pb, tag->key);
avio_w8(pb, AMF_DATA_TYPE_STRING);
@@ -295,14 +334,14 @@ static int flv_write_header(AVFormatContext *s)
}
put_amf_string(pb, "filesize");
- flv->filesize_offset= avio_tell(pb);
+ flv->filesize_offset = avio_tell(pb);
put_amf_double(pb, 0); // delayed write
put_amf_string(pb, "");
avio_w8(pb, AMF_END_OF_OBJECT);
/* write total size of tag */
- data_size= avio_tell(pb) - metadata_size_pos - 10;
+ data_size = avio_tell(pb) - metadata_size_pos - 10;
avio_seek(pb, metadata_count_pos, SEEK_SET);
avio_wb32(pb, metadata_count);
@@ -314,17 +353,17 @@ static int flv_write_header(AVFormatContext *s)
for (i = 0; i < s->nb_streams; i++) {
AVCodecContext *enc = s->streams[i]->codec;
- if (enc->codec_id == CODEC_ID_AAC || enc->codec_id == CODEC_ID_H264) {
+ if (enc->codec_id == AV_CODEC_ID_AAC || enc->codec_id == AV_CODEC_ID_H264) {
int64_t pos;
avio_w8(pb, enc->codec_type == AVMEDIA_TYPE_VIDEO ?
- FLV_TAG_TYPE_VIDEO : FLV_TAG_TYPE_AUDIO);
+ FLV_TAG_TYPE_VIDEO : FLV_TAG_TYPE_AUDIO);
avio_wb24(pb, 0); // size patched later
avio_wb24(pb, 0); // ts
- avio_w8(pb, 0); // ts ext
+ avio_w8(pb, 0); // ts ext
avio_wb24(pb, 0); // streamid
pos = avio_tell(pb);
- if (enc->codec_id == CODEC_ID_AAC) {
- avio_w8(pb, get_audio_flags(enc));
+ if (enc->codec_id == AV_CODEC_ID_AAC) {
+ avio_w8(pb, get_audio_flags(s, enc));
avio_w8(pb, 0); // AAC sequence header
avio_write(pb, enc->extradata, enc->extradata_size);
} else {
@@ -357,18 +396,21 @@ static int flv_write_trailer(AVFormatContext *s)
AVCodecContext *enc = s->streams[i]->codec;
FLVStreamContext *sc = s->streams[i]->priv_data;
if (enc->codec_type == AVMEDIA_TYPE_VIDEO &&
- enc->codec_id == CODEC_ID_H264) {
+ enc->codec_id == AV_CODEC_ID_H264)
put_avc_eos_tag(pb, sc->last_ts);
- }
}
file_size = avio_tell(pb);
/* update information */
- avio_seek(pb, flv->duration_offset, SEEK_SET);
- put_amf_double(pb, flv->duration / (double)1000);
- avio_seek(pb, flv->filesize_offset, SEEK_SET);
- put_amf_double(pb, file_size);
+ if (avio_seek(pb, flv->duration_offset, SEEK_SET) < 0)
+ av_log(s, AV_LOG_WARNING, "Failed to update header with correct duration.\n");
+ else
+ put_amf_double(pb, flv->duration / (double)1000);
+ if (avio_seek(pb, flv->filesize_offset, SEEK_SET) < 0)
+ av_log(s, AV_LOG_WARNING, "Failed to update header with correct filesize.\n");
+ else
+ put_amf_double(pb, file_size);
avio_seek(pb, file_size, SEEK_SET);
return 0;
@@ -376,94 +418,124 @@ static int flv_write_trailer(AVFormatContext *s)
static int flv_write_packet(AVFormatContext *s, AVPacket *pkt)
{
- AVIOContext *pb = s->pb;
- AVCodecContext *enc = s->streams[pkt->stream_index]->codec;
- FLVContext *flv = s->priv_data;
+ AVIOContext *pb = s->pb;
+ AVCodecContext *enc = s->streams[pkt->stream_index]->codec;
+ FLVContext *flv = s->priv_data;
FLVStreamContext *sc = s->streams[pkt->stream_index]->priv_data;
unsigned ts;
- int size= pkt->size;
- uint8_t *data= NULL;
- int flags, flags_size;
-
-// av_log(s, AV_LOG_DEBUG, "type:%d pts: %"PRId64" size:%d\n", enc->codec_type, timestamp, size);
-
- if(enc->codec_id == CODEC_ID_VP6 || enc->codec_id == CODEC_ID_VP6F ||
- enc->codec_id == CODEC_ID_AAC)
- flags_size= 2;
- else if(enc->codec_id == CODEC_ID_H264)
- flags_size= 5;
+ int size = pkt->size;
+ uint8_t *data = NULL;
+ int flags = 0, flags_size;
+
+ if (enc->codec_id == AV_CODEC_ID_VP6 || enc->codec_id == AV_CODEC_ID_VP6F ||
+ enc->codec_id == AV_CODEC_ID_AAC)
+ flags_size = 2;
+ else if (enc->codec_id == AV_CODEC_ID_H264)
+ flags_size = 5;
else
- flags_size= 1;
+ flags_size = 1;
- if (enc->codec_type == AVMEDIA_TYPE_VIDEO) {
+ switch (enc->codec_type) {
+ case AVMEDIA_TYPE_VIDEO:
avio_w8(pb, FLV_TAG_TYPE_VIDEO);
flags = enc->codec_tag;
- if(flags == 0) {
- av_log(enc, AV_LOG_ERROR, "video codec %X not compatible with flv\n",enc->codec_id);
+ if (flags == 0) {
+ av_log(s, AV_LOG_ERROR,
+ "video codec %X not compatible with flv\n",
+ enc->codec_id);
return -1;
}
flags |= pkt->flags & AV_PKT_FLAG_KEY ? FLV_FRAME_KEY : FLV_FRAME_INTER;
- } else {
- assert(enc->codec_type == AVMEDIA_TYPE_AUDIO);
- flags = get_audio_flags(enc);
+ break;
+ case AVMEDIA_TYPE_AUDIO:
+ flags = get_audio_flags(s, enc);
assert(size);
avio_w8(pb, FLV_TAG_TYPE_AUDIO);
+ break;
+ case AVMEDIA_TYPE_DATA:
+ avio_w8(pb, FLV_TAG_TYPE_META);
+ break;
+ default:
+ return AVERROR(EINVAL);
}
- if (enc->codec_id == CODEC_ID_H264) {
+ if (enc->codec_id == AV_CODEC_ID_H264)
/* check if extradata looks like MP4 */
- if (enc->extradata_size > 0 && *(uint8_t*)enc->extradata != 1) {
+ if (enc->extradata_size > 0 && *(uint8_t*)enc->extradata != 1)
if (ff_avc_parse_nal_units_buf(pkt->data, &data, &size) < 0)
return -1;
- }
- }
+
if (flv->delay == AV_NOPTS_VALUE)
flv->delay = -pkt->dts;
+
if (pkt->dts < -flv->delay) {
- av_log(s, AV_LOG_WARNING, "Packets are not in the proper order with "
- "respect to DTS\n");
+ av_log(s, AV_LOG_WARNING,
+ "Packets are not in the proper order with respect to DTS\n");
return AVERROR(EINVAL);
}
ts = pkt->dts + flv->delay; // add delay to force positive dts
/* check Speex packet duration */
- if (enc->codec_id == CODEC_ID_SPEEX && ts - sc->last_ts > 160) {
+ if (enc->codec_id == AV_CODEC_ID_SPEEX && ts - sc->last_ts > 160)
av_log(s, AV_LOG_WARNING, "Warning: Speex stream has more than "
"8 frames per packet. Adobe Flash "
"Player cannot handle this!\n");
- }
if (sc->last_ts < ts)
sc->last_ts = ts;
- avio_wb24(pb,size + flags_size);
- avio_wb24(pb,ts);
- avio_w8(pb,(ts >> 24) & 0x7F); // timestamps are 32bits _signed_
- avio_wb24(pb,flv->reserved);
- avio_w8(pb,flags);
- if (enc->codec_id == CODEC_ID_VP6)
- avio_w8(pb,0);
- if (enc->codec_id == CODEC_ID_VP6F)
- avio_w8(pb, enc->extradata_size ? enc->extradata[0] : 0);
- else if (enc->codec_id == CODEC_ID_AAC)
- avio_w8(pb,1); // AAC raw
- else if (enc->codec_id == CODEC_ID_H264) {
- avio_w8(pb,1); // AVC NALU
- avio_wb24(pb,pkt->pts - pkt->dts);
- }
+ avio_wb24(pb, size + flags_size);
+ avio_wb24(pb, ts);
+ avio_w8(pb, (ts >> 24) & 0x7F); // timestamps are 32 bits _signed_
+ avio_wb24(pb, flv->reserved);
- avio_write(pb, data ? data : pkt->data, size);
+ if (enc->codec_type == AVMEDIA_TYPE_DATA) {
+ int data_size;
+ int metadata_size_pos = avio_tell(pb);
+ avio_w8(pb, AMF_DATA_TYPE_STRING);
+ put_amf_string(pb, "onTextData");
+ avio_w8(pb, AMF_DATA_TYPE_MIXEDARRAY);
+ avio_wb32(pb, 2);
+ put_amf_string(pb, "type");
+ avio_w8(pb, AMF_DATA_TYPE_STRING);
+ put_amf_string(pb, "Text");
+ put_amf_string(pb, "text");
+ avio_w8(pb, AMF_DATA_TYPE_STRING);
+ put_amf_string(pb, pkt->data);
+ put_amf_string(pb, "");
+ avio_w8(pb, AMF_END_OF_OBJECT);
+ /* write total size of tag */
+ data_size = avio_tell(pb) - metadata_size_pos;
+ avio_seek(pb, metadata_size_pos - 10, SEEK_SET);
+ avio_wb24(pb, data_size);
+ avio_seek(pb, data_size + 10 - 3, SEEK_CUR);
+ avio_wb32(pb, data_size + 11);
+ } else {
+ avio_w8(pb,flags);
+ if (enc->codec_id == AV_CODEC_ID_VP6)
+ avio_w8(pb, 0);
+ if (enc->codec_id == AV_CODEC_ID_VP6F)
+ avio_w8(pb, enc->extradata_size ? enc->extradata[0] : 0);
+ else if (enc->codec_id == AV_CODEC_ID_AAC)
+ avio_w8(pb, 1); // AAC raw
+ else if (enc->codec_id == AV_CODEC_ID_H264) {
+ avio_w8(pb, 1); // AVC NALU
+ avio_wb24(pb, pkt->pts - pkt->dts);
+ }
- avio_wb32(pb,size+flags_size+11); // previous tag size
- flv->duration = FFMAX(flv->duration, pkt->pts + flv->delay + pkt->duration);
+ avio_write(pb, data ? data : pkt->data, size);
- avio_flush(pb);
+ avio_wb32(pb, size + flags_size + 11); // previous tag size
+ flv->duration = FFMAX(flv->duration,
+ pkt->pts + flv->delay + pkt->duration);
+ }
+ avio_flush(pb);
av_free(data);
return pb->error;
@@ -471,19 +543,18 @@ static int flv_write_packet(AVFormatContext *s, AVPacket *pkt)
AVOutputFormat ff_flv_muxer = {
.name = "flv",
- .long_name = NULL_IF_CONFIG_SMALL("FLV format"),
+ .long_name = NULL_IF_CONFIG_SMALL("FLV (Flash Video)"),
.mime_type = "video/x-flv",
.extensions = "flv",
.priv_data_size = sizeof(FLVContext),
-#if CONFIG_LIBMP3LAME
- .audio_codec = CODEC_ID_MP3,
-#else // CONFIG_LIBMP3LAME
- .audio_codec = CODEC_ID_ADPCM_SWF,
-#endif // CONFIG_LIBMP3LAME
- .video_codec = CODEC_ID_FLV1,
+ .audio_codec = CONFIG_LIBMP3LAME ? AV_CODEC_ID_MP3 : AV_CODEC_ID_ADPCM_SWF,
+ .video_codec = AV_CODEC_ID_FLV1,
.write_header = flv_write_header,
.write_packet = flv_write_packet,
.write_trailer = flv_write_trailer,
- .codec_tag= (const AVCodecTag* const []){flv_video_codec_ids, flv_audio_codec_ids, 0},
- .flags= AVFMT_GLOBALHEADER | AVFMT_VARIABLE_FPS,
+ .codec_tag = (const AVCodecTag* const []) {
+ flv_video_codec_ids, flv_audio_codec_ids, 0
+ },
+ .flags = AVFMT_GLOBALHEADER | AVFMT_VARIABLE_FPS |
+ AVFMT_TS_NONSTRICT,
};
diff --git a/gst-libs/ext/libav/libavformat/framecrcenc.c b/gst-libs/ext/libav/libavformat/framecrcenc.c
index d845e79..de6fa2b 100644
--- a/gst-libs/ext/libav/libavformat/framecrcenc.c
+++ b/gst-libs/ext/libav/libavformat/framecrcenc.c
@@ -21,13 +21,15 @@
#include "libavutil/adler32.h"
#include "avformat.h"
+#include "internal.h"
static int framecrc_write_packet(struct AVFormatContext *s, AVPacket *pkt)
{
uint32_t crc = av_adler32_update(0, pkt->data, pkt->size);
char buf[256];
- snprintf(buf, sizeof(buf), "%d, %"PRId64", %d, 0x%08x\n", pkt->stream_index, pkt->dts, pkt->size, crc);
+ snprintf(buf, sizeof(buf), "%d, %10"PRId64", %10"PRId64", %8d, %8d, 0x%08x\n",
+ pkt->stream_index, pkt->dts, pkt->pts, pkt->duration, pkt->size, crc);
avio_write(s->pb, buf, strlen(buf));
avio_flush(s->pb);
return 0;
@@ -35,10 +37,11 @@ static int framecrc_write_packet(struct AVFormatContext *s, AVPacket *pkt)
AVOutputFormat ff_framecrc_muxer = {
.name = "framecrc",
- .long_name = NULL_IF_CONFIG_SMALL("framecrc testing format"),
+ .long_name = NULL_IF_CONFIG_SMALL("framecrc testing"),
.extensions = "",
- .audio_codec = CODEC_ID_PCM_S16LE,
- .video_codec = CODEC_ID_RAWVIDEO,
+ .audio_codec = AV_CODEC_ID_PCM_S16LE,
+ .video_codec = AV_CODEC_ID_RAWVIDEO,
+ .write_header = ff_framehash_write_header,
.write_packet = framecrc_write_packet,
- .flags = AVFMT_VARIABLE_FPS,
+ .flags = AVFMT_VARIABLE_FPS | AVFMT_TS_NONSTRICT,
};
diff --git a/gst-libs/ext/libav/libavformat/framehash.c b/gst-libs/ext/libav/libavformat/framehash.c
new file mode 100644
index 0000000..28e9e84
--- /dev/null
+++ b/gst-libs/ext/libav/libavformat/framehash.c
@@ -0,0 +1,33 @@
+/*
+ * Common functions for the frame{crc,md5} muxers
+ *
+ * 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
+ */
+
+#include "internal.h"
+
+int ff_framehash_write_header(AVFormatContext *s)
+{
+ int i;
+ for (i = 0; i < s->nb_streams; i++) {
+ AVStream *st = s->streams[i];
+ avpriv_set_pts_info(st, 64, st->codec->time_base.num, st->codec->time_base.den);
+ avio_printf(s->pb, "#tb %d: %d/%d\n", i, st->time_base.num, st->time_base.den);
+ avio_flush(s->pb);
+ }
+ return 0;
+}
diff --git a/gst-libs/ext/libav/libavformat/g722.c b/gst-libs/ext/libav/libavformat/g722.c
new file mode 100644
index 0000000..8052939
--- /dev/null
+++ b/gst-libs/ext/libav/libavformat/g722.c
@@ -0,0 +1,56 @@
+/*
+ * g722 raw demuxer
+ * Copyright (c) 2010 Martin Storsjo
+ *
+ * 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
+ */
+
+#include "avformat.h"
+#include "internal.h"
+#include "rawdec.h"
+
+static int g722_read_header(AVFormatContext *s)
+{
+ AVStream *st;
+
+ st = avformat_new_stream(s, NULL);
+ if (!st)
+ return AVERROR(ENOMEM);
+
+ st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
+ st->codec->codec_id = AV_CODEC_ID_ADPCM_G722;
+ st->codec->sample_rate = 16000;
+ st->codec->channels = 1;
+
+ st->codec->bits_per_coded_sample =
+ av_get_bits_per_sample(st->codec->codec_id);
+
+ assert(st->codec->bits_per_coded_sample > 0);
+
+ avpriv_set_pts_info(st, 64, 1, st->codec->sample_rate);
+ return 0;
+}
+
+AVInputFormat ff_g722_demuxer = {
+ .name = "g722",
+ .long_name = NULL_IF_CONFIG_SMALL("raw G.722"),
+ .read_header = g722_read_header,
+ .read_packet = ff_raw_read_partial_packet,
+ .flags = AVFMT_GENERIC_INDEX,
+ .extensions = "g722,722",
+ .raw_codec_id = AV_CODEC_ID_ADPCM_G722,
+};
diff --git a/gst-libs/ext/libav/libavformat/g723_1.c b/gst-libs/ext/libav/libavformat/g723_1.c
new file mode 100644
index 0000000..0b92702
--- /dev/null
+++ b/gst-libs/ext/libav/libavformat/g723_1.c
@@ -0,0 +1,85 @@
+/*
+ * G.723.1 demuxer
+ * Copyright (c) 2010 Mohamed Naufal Basheer
+ *
+ * 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
+ * G.723.1 demuxer
+ */
+
+#include "libavutil/channel_layout.h"
+#include "avformat.h"
+#include "internal.h"
+
+static const uint8_t frame_size[4] = { 24, 20, 4, 1 };
+
+static int g723_1_init(AVFormatContext *s)
+{
+ AVStream *st;
+
+ st = avformat_new_stream(s, NULL);
+ if (!st)
+ return AVERROR(ENOMEM);
+
+ st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
+ st->codec->codec_id = AV_CODEC_ID_G723_1;
+ st->codec->channel_layout = AV_CH_LAYOUT_MONO;
+ st->codec->channels = 1;
+ st->codec->sample_rate = 8000;
+
+ avpriv_set_pts_info(st, 64, 1, st->codec->sample_rate);
+ st->start_time = 0;
+
+ return 0;
+}
+
+static int g723_1_read_packet(AVFormatContext *s, AVPacket *pkt)
+{
+ int size, byte, ret;
+
+ pkt->pos = avio_tell(s->pb);
+ byte = avio_r8(s->pb);
+ size = frame_size[byte & 3];
+
+ ret = av_new_packet(pkt, size);
+ if (ret < 0)
+ return ret;
+
+ pkt->data[0] = byte;
+ pkt->duration = 240;
+ pkt->stream_index = 0;
+
+ ret = avio_read(s->pb, pkt->data + 1, size - 1);
+ if (ret < size - 1) {
+ av_free_packet(pkt);
+ return ret < 0 ? ret : AVERROR_EOF;
+ }
+
+ return pkt->size;
+}
+
+AVInputFormat ff_g723_1_demuxer = {
+ .name = "g723_1",
+ .long_name = NULL_IF_CONFIG_SMALL("G.723.1"),
+ .read_header = g723_1_init,
+ .read_packet = g723_1_read_packet,
+ .extensions = "tco",
+ .flags = AVFMT_GENERIC_INDEX
+};
diff --git a/gst-libs/ext/libav/libavformat/gif.c b/gst-libs/ext/libav/libavformat/gif.c
index 3ef7ebe..eb2db46 100644
--- a/gst-libs/ext/libav/libavformat/gif.c
+++ b/gst-libs/ext/libav/libavformat/gif.c
@@ -53,7 +53,9 @@
#define GIF_CHUNKS 100
/* slows down the decoding (and some browsers don't like it) */
-/* update on the 'some browsers don't like it issue from above: this was probably due to missing 'Data Sub-block Terminator' (byte 19) in the app_header */
+/* update on the 'some browsers don't like it issue from above:
+ * this was probably due to missing 'Data Sub-block Terminator'
+ * (byte 19) in the app_header */
#define GIF_ADD_APP_HEADER // required to enable looping of animated gif
typedef struct {
@@ -65,8 +67,15 @@ typedef struct {
/* we use the standard 216 color palette */
/* this script was used to create the palette:
- * for r in 00 33 66 99 cc ff; do for g in 00 33 66 99 cc ff; do echo -n " "; for b in 00 33 66 99 cc ff; do
- * echo -n "{ 0x$r, 0x$g, 0x$b }, "; done; echo ""; done; done
+ * for r in 00 33 66 99 cc ff; do
+ * for g in 00 33 66 99 cc ff; do
+ * echo -n " "
+ * for b in 00 33 66 99 cc ff; do
+ * echo -n "{ 0x$r, 0x$g, 0x$b }, "
+ * done
+ * echo ""
+ * done
+ * done
*/
static const rgb_triplet gif_clut[216] = {
@@ -109,9 +118,8 @@ static const rgb_triplet gif_clut[216] = {
};
/* GIF header */
-static int gif_image_write_header(AVIOContext *pb,
- int width, int height, int loop_count,
- uint32_t *palette)
+static int gif_image_write_header(AVIOContext *pb, int width, int height,
+ int loop_count, uint32_t *palette)
{
int i;
unsigned int v;
@@ -127,44 +135,45 @@ static int gif_image_write_header(AVIOContext *pb,
/* the global palette */
if (!palette) {
- avio_write(pb, (const unsigned char *)gif_clut, 216*3);
- for(i=0;i<((256-216)*3);i++)
+ avio_write(pb, (const unsigned char *)gif_clut, 216 * 3);
+ for (i = 0; i < ((256 - 216) * 3); i++)
avio_w8(pb, 0);
} else {
- for(i=0;i<256;i++) {
+ for (i = 0; i < 256; i++) {
v = palette[i];
avio_w8(pb, (v >> 16) & 0xff);
- avio_w8(pb, (v >> 8) & 0xff);
- avio_w8(pb, (v) & 0xff);
+ avio_w8(pb, (v >> 8) & 0xff);
+ avio_w8(pb, (v) & 0xff);
}
}
- /* update: this is the 'NETSCAPE EXTENSION' that allows for looped animated gif
- see http://members.aol.com/royalef/gifabout.htm#net-extension
-
- byte 1 : 33 (hex 0x21) GIF Extension code
- byte 2 : 255 (hex 0xFF) Application Extension Label
- byte 3 : 11 (hex (0x0B) Length of Application Block
- (eleven bytes of data to follow)
- bytes 4 to 11 : "NETSCAPE"
- bytes 12 to 14 : "2.0"
- byte 15 : 3 (hex 0x03) Length of Data Sub-Block
- (three bytes of data to follow)
- byte 16 : 1 (hex 0x01)
- bytes 17 to 18 : 0 to 65535, an unsigned integer in
- lo-hi byte format. This indicate the
- number of iterations the loop should
- be executed.
- bytes 19 : 0 (hex 0x00) a Data Sub-block Terminator
- */
+ /* update: this is the 'NETSCAPE EXTENSION' that allows for looped animated
+ * GIF, see http://members.aol.com/royalef/gifabout.htm#net-extension
+ *
+ * byte 1 : 33 (hex 0x21) GIF Extension code
+ * byte 2 : 255 (hex 0xFF) Application Extension Label
+ * byte 3 : 11 (hex (0x0B) Length of Application Block
+ * (eleven bytes of data to follow)
+ * bytes 4 to 11 : "NETSCAPE"
+ * bytes 12 to 14 : "2.0"
+ * byte 15 : 3 (hex 0x03) Length of Data Sub-Block
+ * (three bytes of data to follow)
+ * byte 16 : 1 (hex 0x01)
+ * bytes 17 to 18 : 0 to 65535, an unsigned integer in
+ * lo-hi byte format. This indicate the
+ * number of iterations the loop should
+ * be executed.
+ * bytes 19 : 0 (hex 0x00) a Data Sub-block Terminator
+ */
/* application extension header */
#ifdef GIF_ADD_APP_HEADER
if (loop_count >= 0 && loop_count <= 65535) {
- avio_w8(pb, 0x21);
- avio_w8(pb, 0xff);
- avio_w8(pb, 0x0b);
- avio_write(pb, "NETSCAPE2.0", sizeof("NETSCAPE2.0") - 1); // bytes 4 to 14
+ avio_w8(pb, 0x21);
+ avio_w8(pb, 0xff);
+ avio_w8(pb, 0x0b);
+ // bytes 4 to 14
+ avio_write(pb, "NETSCAPE2.0", sizeof("NETSCAPE2.0") - 1);
avio_w8(pb, 0x03); // byte 15
avio_w8(pb, 0x01); // byte 16
avio_wl16(pb, (uint16_t)loop_count);
@@ -180,7 +189,6 @@ static inline unsigned char gif_clut_index(uint8_t r, uint8_t g, uint8_t b)
return (((r) / 47) % 6) * 6 * 6 + (((g) / 47) % 6) * 6 + (((b) / 47) % 6);
}
-
static int gif_image_write_image(AVIOContext *pb,
int x1, int y1, int width, int height,
const uint8_t *buf, int linesize, int pix_fmt)
@@ -201,45 +209,44 @@ static int gif_image_write_image(AVIOContext *pb,
avio_w8(pb, 0x08);
- left= width * height;
+ left = width * height;
init_put_bits(&p, buffer, 130);
/*
- * the thing here is the bitstream is written as little packets, with a size byte before
- * but it's still the same bitstream between packets (no flush !)
+ * the thing here is the bitstream is written as little packets, with a size
+ * byte before but it's still the same bitstream between packets (no flush !)
*/
ptr = buf;
- w = width;
- while(left>0) {
-
+ w = width;
+ while (left > 0) {
put_bits(&p, 9, 0x0100); /* clear code */
- for(i=(left<GIF_CHUNKS)?left:GIF_CHUNKS;i;i--) {
- if (pix_fmt == PIX_FMT_RGB24) {
- v = gif_clut_index(ptr[0], ptr[1], ptr[2]);
- ptr+=3;
+ for (i = (left < GIF_CHUNKS) ? left : GIF_CHUNKS; i; i--) {
+ if (pix_fmt == AV_PIX_FMT_RGB24) {
+ v = gif_clut_index(ptr[0], ptr[1], ptr[2]);
+ ptr += 3;
} else {
v = *ptr++;
}
put_bits(&p, 9, v);
if (--w == 0) {
- w = width;
+ w = width;
buf += linesize;
- ptr = buf;
+ ptr = buf;
}
}
- if(left<=GIF_CHUNKS) {
+ if (left <= GIF_CHUNKS) {
put_bits(&p, 9, 0x101); /* end of stream */
flush_put_bits(&p);
}
- if(put_bits_ptr(&p) - p.buf > 0) {
+ if (put_bits_ptr(&p) - p.buf > 0) {
avio_w8(pb, put_bits_ptr(&p) - p.buf); /* byte count of the packet */
avio_write(pb, p.buf, put_bits_ptr(&p) - p.buf); /* the actual buffer */
p.buf_ptr = p.buf; /* dequeue the bytes off the bitstream */
}
- left-=GIF_CHUNKS;
+ left -= GIF_CHUNKS;
}
avio_w8(pb, 0x00); /* end of image block */
@@ -261,14 +268,14 @@ static int gif_write_header(AVFormatContext *s)
int i, width, height /*, rate*/;
/* XXX: do we reject audio streams or just ignore them ?
- if(s->nb_streams > 1)
- return -1;
-*/
- gif->time = 0;
+ * if (s->nb_streams > 1)
+ * return -1;
+ */
+ gif->time = 0;
gif->file_time = 0;
video_enc = NULL;
- for(i=0;i<s->nb_streams;i++) {
+ for (i = 0; i < s->nb_streams; i++) {
enc = s->streams[i]->codec;
if (enc->codec_type != AVMEDIA_TYPE_AUDIO)
video_enc = enc;
@@ -278,29 +285,25 @@ static int gif_write_header(AVFormatContext *s)
av_free(gif);
return -1;
} else {
- width = video_enc->width;
+ width = video_enc->width;
height = video_enc->height;
// rate = video_enc->time_base.den;
}
- if (video_enc->pix_fmt != PIX_FMT_RGB24) {
- av_log(s, AV_LOG_ERROR, "ERROR: gif only handles the rgb24 pixel format. Use -pix_fmt rgb24.\n");
+ if (video_enc->pix_fmt != AV_PIX_FMT_RGB24) {
+ av_log(s, AV_LOG_ERROR,
+ "ERROR: gif only handles the rgb24 pixel format. Use -pix_fmt rgb24.\n");
return AVERROR(EIO);
}
-#if FF_API_LOOP_OUTPUT
- if (s->loop_output)
- gif->loop = s->loop_output;
-#endif
-
gif_image_write_header(pb, width, height, gif->loop, NULL);
avio_flush(s->pb);
return 0;
}
-static int gif_write_video(AVFormatContext *s,
- AVCodecContext *enc, const uint8_t *buf, int size)
+static int gif_write_video(AVFormatContext *s, AVCodecContext *enc,
+ const uint8_t *buf, int size)
{
AVIOContext *pb = s->pb;
int jiffies;
@@ -316,7 +319,7 @@ static int gif_write_video(AVFormatContext *s,
/* XXX: should use delay, in order to be more accurate */
/* instead of using the same rounded value each time */
/* XXX: don't even remember if I really use it for now */
- jiffies = (70*enc->time_base.num/enc->time_base.den) - 1;
+ jiffies = (70 * enc->time_base.num / enc->time_base.den) - 1;
avio_wl16(pb, jiffies);
@@ -324,7 +327,7 @@ static int gif_write_video(AVFormatContext *s,
avio_w8(pb, 0x00);
gif_image_write_image(pb, 0, 0, enc->width, enc->height,
- buf, enc->width * 3, PIX_FMT_RGB24);
+ buf, enc->width * 3, AV_PIX_FMT_RGB24);
avio_flush(s->pb);
return 0;
@@ -344,14 +347,15 @@ static int gif_write_trailer(AVFormatContext *s)
AVIOContext *pb = s->pb;
avio_w8(pb, 0x3b);
- avio_flush(s->pb);
+
return 0;
}
#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), AV_OPT_TYPE_INT, {0}, 0, 65535, ENC },
+ { "loop", "Number of times to loop the output.", OFFSET(loop),
+ AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 65535, ENC },
{ NULL },
};
@@ -363,15 +367,15 @@ static const AVClass gif_muxer_class = {
};
AVOutputFormat ff_gif_muxer = {
- .name = "gif",
- .long_name = NULL_IF_CONFIG_SMALL("GIF Animation"),
- .mime_type = "image/gif",
- .extensions = "gif",
- .priv_data_size = sizeof(GIFContext),
- .audio_codec = CODEC_ID_NONE,
- .video_codec = CODEC_ID_RAWVIDEO,
- .write_header = gif_write_header,
- .write_packet = gif_write_packet,
- .write_trailer = gif_write_trailer,
- .priv_class = &gif_muxer_class,
+ .name = "gif",
+ .long_name = NULL_IF_CONFIG_SMALL("GIF Animation"),
+ .mime_type = "image/gif",
+ .extensions = "gif",
+ .priv_data_size = sizeof(GIFContext),
+ .audio_codec = AV_CODEC_ID_NONE,
+ .video_codec = AV_CODEC_ID_RAWVIDEO,
+ .write_header = gif_write_header,
+ .write_packet = gif_write_packet,
+ .write_trailer = gif_write_trailer,
+ .priv_class = &gif_muxer_class,
};
diff --git a/gst-libs/ext/libav/libavformat/gsmdec.c b/gst-libs/ext/libav/libavformat/gsmdec.c
index 443f820..f9ecbaf 100644
--- a/gst-libs/ext/libav/libavformat/gsmdec.c
+++ b/gst-libs/ext/libav/libavformat/gsmdec.c
@@ -19,6 +19,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "libavutil/channel_layout.h"
#include "libavutil/mathematics.h"
#include "libavutil/opt.h"
#include "avformat.h"
@@ -54,7 +55,7 @@ static int gsm_read_packet(AVFormatContext *s, AVPacket *pkt)
return 0;
}
-static int gsm_read_header(AVFormatContext *s, AVFormatParameters *ap)
+static int gsm_read_header(AVFormatContext *s)
{
GSMDemuxerContext *c = s->priv_data;
AVStream *st = avformat_new_stream(s, NULL);
@@ -62,8 +63,9 @@ static int gsm_read_header(AVFormatContext *s, AVFormatParameters *ap)
return AVERROR(ENOMEM);
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
- st->codec->codec_id = s->iformat->value;
+ st->codec->codec_id = s->iformat->raw_codec_id;
st->codec->channels = 1;
+ st->codec->channel_layout = AV_CH_LAYOUT_MONO;
st->codec->sample_rate = c->sample_rate;
st->codec->bit_rate = GSM_BLOCK_SIZE * 8 * c->sample_rate / GSM_BLOCK_SAMPLES;
@@ -74,7 +76,7 @@ static int gsm_read_header(AVFormatContext *s, AVFormatParameters *ap)
static const AVOption options[] = {
{ "sample_rate", "", offsetof(GSMDemuxerContext, sample_rate),
- AV_OPT_TYPE_INT, {.dbl = GSM_SAMPLE_RATE}, 1, INT_MAX / GSM_BLOCK_SIZE,
+ AV_OPT_TYPE_INT, {.i64 = GSM_SAMPLE_RATE}, 1, INT_MAX / GSM_BLOCK_SIZE,
AV_OPT_FLAG_DECODING_PARAM },
{ NULL },
};
@@ -94,6 +96,6 @@ AVInputFormat ff_gsm_demuxer = {
.read_packet = gsm_read_packet,
.flags = AVFMT_GENERIC_INDEX,
.extensions = "gsm",
- .value = CODEC_ID_GSM,
+ .raw_codec_id = AV_CODEC_ID_GSM,
.priv_class = &class,
};
diff --git a/gst-libs/ext/libav/libavformat/gxf.c b/gst-libs/ext/libav/libavformat/gxf.c
index ebc4eea..6feb3c3 100644
--- a/gst-libs/ext/libav/libavformat/gxf.c
+++ b/gst-libs/ext/libav/libavformat/gxf.c
@@ -19,10 +19,12 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "libavutil/channel_layout.h"
#include "libavutil/common.h"
#include "avformat.h"
#include "internal.h"
#include "gxf.h"
+#include "libavcodec/mpeg12data.h"
struct gxf_stream_info {
int64_t first_field;
@@ -89,35 +91,36 @@ static int get_sindex(AVFormatContext *s, int id, int format) {
case 3:
case 4:
st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
- st->codec->codec_id = CODEC_ID_MJPEG;
+ st->codec->codec_id = AV_CODEC_ID_MJPEG;
break;
case 13:
case 15:
st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
- st->codec->codec_id = CODEC_ID_DVVIDEO;
+ st->codec->codec_id = AV_CODEC_ID_DVVIDEO;
break;
case 14:
case 16:
st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
- st->codec->codec_id = CODEC_ID_DVVIDEO;
+ st->codec->codec_id = AV_CODEC_ID_DVVIDEO;
break;
case 11:
case 12:
case 20:
st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
- st->codec->codec_id = CODEC_ID_MPEG2VIDEO;
+ st->codec->codec_id = AV_CODEC_ID_MPEG2VIDEO;
st->need_parsing = AVSTREAM_PARSE_HEADERS; //get keyframe flag etc.
break;
case 22:
case 23:
st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
- st->codec->codec_id = CODEC_ID_MPEG1VIDEO;
+ st->codec->codec_id = AV_CODEC_ID_MPEG1VIDEO;
st->need_parsing = AVSTREAM_PARSE_HEADERS; //get keyframe flag etc.
break;
case 9:
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
- st->codec->codec_id = CODEC_ID_PCM_S24LE;
+ st->codec->codec_id = AV_CODEC_ID_PCM_S24LE;
st->codec->channels = 1;
+ st->codec->channel_layout = AV_CH_LAYOUT_MONO;
st->codec->sample_rate = 48000;
st->codec->bit_rate = 3 * 1 * 48000 * 8;
st->codec->block_align = 3 * 1;
@@ -125,8 +128,9 @@ static int get_sindex(AVFormatContext *s, int id, int format) {
break;
case 10:
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
- st->codec->codec_id = CODEC_ID_PCM_S16LE;
+ st->codec->codec_id = AV_CODEC_ID_PCM_S16LE;
st->codec->channels = 1;
+ st->codec->channel_layout = AV_CH_LAYOUT_MONO;
st->codec->sample_rate = 48000;
st->codec->bit_rate = 2 * 1 * 48000 * 8;
st->codec->block_align = 2 * 1;
@@ -134,8 +138,9 @@ static int get_sindex(AVFormatContext *s, int id, int format) {
break;
case 17:
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
- st->codec->codec_id = CODEC_ID_AC3;
+ st->codec->codec_id = AV_CODEC_ID_AC3;
st->codec->channels = 2;
+ st->codec->channel_layout = AV_CH_LAYOUT_STEREO;
st->codec->sample_rate = 48000;
break;
// timecode tracks:
@@ -143,11 +148,11 @@ static int get_sindex(AVFormatContext *s, int id, int format) {
case 8:
case 24:
st->codec->codec_type = AVMEDIA_TYPE_DATA;
- st->codec->codec_id = CODEC_ID_NONE;
+ st->codec->codec_id = AV_CODEC_ID_NONE;
break;
default:
st->codec->codec_type = AVMEDIA_TYPE_UNKNOWN;
- st->codec->codec_id = CODEC_ID_NONE;
+ st->codec->codec_id = AV_CODEC_ID_NONE;
break;
}
return s->nb_streams - 1;
@@ -179,15 +184,26 @@ static void gxf_material_tags(AVIOContext *pb, int *len, struct gxf_stream_info
}
}
+static const AVRational frame_rate_tab[] = {
+ { 60, 1},
+ {60000, 1001},
+ { 50, 1},
+ { 30, 1},
+ {30000, 1001},
+ { 25, 1},
+ { 24, 1},
+ {24000, 1001},
+ { 0, 0},
+};
+
/**
* @brief convert fps tag value to AVRational fps
* @param fps fps value from tag
* @return fps as AVRational, or 0 / 0 if unknown
*/
static AVRational fps_tag2avr(int32_t fps) {
- extern const AVRational avpriv_frame_rate_tab[];
if (fps < 1 || fps > 9) fps = 9;
- return avpriv_frame_rate_tab[9 - fps]; // values have opposite order
+ return frame_rate_tab[fps - 1];
}
/**
@@ -259,7 +275,7 @@ static void gxf_read_index(AVFormatContext *s, int pkt_len) {
avio_skip(pb, pkt_len);
}
-static int gxf_header(AVFormatContext *s, AVFormatParameters *ap) {
+static int gxf_header(AVFormatContext *s) {
AVIOContext *pb = s->pb;
GXFPktType pkt_type;
int map_len;
@@ -459,8 +475,8 @@ static int gxf_packet(AVFormatContext *s, AVPacket *pkt) {
avio_rb32(pb); // "timeline" field number
avio_r8(pb); // flags
avio_r8(pb); // reserved
- if (st->codec->codec_id == CODEC_ID_PCM_S24LE ||
- st->codec->codec_id == CODEC_ID_PCM_S16LE) {
+ if (st->codec->codec_id == AV_CODEC_ID_PCM_S24LE ||
+ st->codec->codec_id == AV_CODEC_ID_PCM_S16LE) {
int first = field_info >> 16;
int last = field_info & 0xffff; // last is exclusive
int bps = av_get_bits_per_sample(st->codec->codec_id)>>3;
@@ -478,7 +494,7 @@ static int gxf_packet(AVFormatContext *s, AVPacket *pkt) {
pkt->dts = field_nr;
//set duration manually for DV or else lavf misdetects the frame rate
- if (st->codec->codec_id == CODEC_ID_DVVIDEO)
+ if (st->codec->codec_id == AV_CODEC_ID_DVVIDEO)
pkt->duration = si->fields_per_frame;
return ret;
@@ -525,7 +541,7 @@ static int64_t gxf_read_timestamp(AVFormatContext *s, int stream_index,
AVInputFormat ff_gxf_demuxer = {
.name = "gxf",
- .long_name = NULL_IF_CONFIG_SMALL("GXF format"),
+ .long_name = NULL_IF_CONFIG_SMALL("GXF (General eXchange Format)"),
.priv_data_size = sizeof(struct gxf_stream_info),
.read_probe = gxf_probe,
.read_header = gxf_header,
diff --git a/gst-libs/ext/libav/libavformat/gxfenc.c b/gst-libs/ext/libav/libavformat/gxfenc.c
index 124064f..128122f 100644
--- a/gst-libs/ext/libav/libavformat/gxfenc.c
+++ b/gst-libs/ext/libav/libavformat/gxfenc.c
@@ -24,7 +24,6 @@
#include "avformat.h"
#include "internal.h"
#include "gxf.h"
-#include "riff.h"
#include "audiointerleave.h"
#define GXF_AUDIO_PACKET_SIZE 65536
@@ -81,22 +80,22 @@ static const struct {
};
static const AVCodecTag gxf_media_types[] = {
- { CODEC_ID_MJPEG , 3 }, /* NTSC */
- { CODEC_ID_MJPEG , 4 }, /* PAL */
- { CODEC_ID_PCM_S24LE , 9 },
- { CODEC_ID_PCM_S16LE , 10 },
- { CODEC_ID_MPEG2VIDEO, 11 }, /* NTSC */
- { CODEC_ID_MPEG2VIDEO, 12 }, /* PAL */
- { CODEC_ID_DVVIDEO , 13 }, /* NTSC */
- { CODEC_ID_DVVIDEO , 14 }, /* PAL */
- { CODEC_ID_DVVIDEO , 15 }, /* 50M NTSC */
- { CODEC_ID_DVVIDEO , 16 }, /* 50M PAL */
- { CODEC_ID_AC3 , 17 },
- //{ CODEC_ID_NONE, , 18 }, /* Non compressed 24 bit audio */
- { CODEC_ID_MPEG2VIDEO, 20 }, /* MPEG HD */
- { CODEC_ID_MPEG1VIDEO, 22 }, /* NTSC */
- { CODEC_ID_MPEG1VIDEO, 23 }, /* PAL */
- { CODEC_ID_NONE, 0 },
+ { AV_CODEC_ID_MJPEG , 3 }, /* NTSC */
+ { AV_CODEC_ID_MJPEG , 4 }, /* PAL */
+ { AV_CODEC_ID_PCM_S24LE , 9 },
+ { AV_CODEC_ID_PCM_S16LE , 10 },
+ { AV_CODEC_ID_MPEG2VIDEO, 11 }, /* NTSC */
+ { AV_CODEC_ID_MPEG2VIDEO, 12 }, /* PAL */
+ { AV_CODEC_ID_DVVIDEO , 13 }, /* NTSC */
+ { AV_CODEC_ID_DVVIDEO , 14 }, /* PAL */
+ { AV_CODEC_ID_DVVIDEO , 15 }, /* 50M NTSC */
+ { AV_CODEC_ID_DVVIDEO , 16 }, /* 50M PAL */
+ { AV_CODEC_ID_AC3 , 17 },
+ //{ AV_CODEC_ID_NONE, , 18 }, /* Non compressed 24 bit audio */
+ { AV_CODEC_ID_MPEG2VIDEO, 20 }, /* MPEG HD */
+ { AV_CODEC_ID_MPEG1VIDEO, 22 }, /* NTSC */
+ { AV_CODEC_ID_MPEG1VIDEO, 23 }, /* PAL */
+ { AV_CODEC_ID_NONE, 0 },
};
#define SERVER_PATH "EXT:/PDR/default/"
@@ -192,7 +191,7 @@ static int gxf_write_mpeg_auxiliary(AVIOContext *pb, AVStream *st)
size = snprintf(buffer, 1024, "Ver 1\nBr %.6f\nIpg 1\nPpi %d\nBpiop %d\n"
"Pix 0\nCf %d\nCg %d\nSl %d\nnl16 %d\nVi 1\nf1 1\n",
(float)st->codec->bit_rate, sc->p_per_gop, sc->b_per_i_or_p,
- st->codec->pix_fmt == PIX_FMT_YUV422P ? 2 : 1, sc->first_gop_closed == 1,
+ st->codec->pix_fmt == AV_PIX_FMT_YUV422P ? 2 : 1, sc->first_gop_closed == 1,
starting_line, (st->codec->height + 15) / 16);
avio_w8(pb, TRACK_MPG_AUX);
avio_w8(pb, size + 1);
@@ -399,11 +398,6 @@ static int gxf_write_umf_material_description(AVFormatContext *s)
AVDictionaryEntry *t;
uint32_t timecode;
-#if FF_API_TIMESTAMP
- if (s->timestamp)
- timestamp = s->timestamp;
- else
-#endif
if (t = av_dict_get(s->metadata, "creation_time", NULL, 0))
timestamp = ff_iso8601_to_unix_time(t->value);
@@ -476,7 +470,7 @@ static int gxf_write_umf_media_mpeg(AVIOContext *pb, AVStream *st)
{
GXFStreamContext *sc = st->priv_data;
- if (st->codec->pix_fmt == PIX_FMT_YUV422P)
+ if (st->codec->pix_fmt == AV_PIX_FMT_YUV422P)
avio_wl32(pb, 2);
else
avio_wl32(pb, 1); /* default to 420 */
@@ -485,9 +479,9 @@ static int gxf_write_umf_media_mpeg(AVIOContext *pb, AVStream *st)
avio_wl32(pb, 1); /* I picture per GOP */
avio_wl32(pb, sc->p_per_gop);
avio_wl32(pb, sc->b_per_i_or_p);
- if (st->codec->codec_id == CODEC_ID_MPEG2VIDEO)
+ if (st->codec->codec_id == AV_CODEC_ID_MPEG2VIDEO)
avio_wl32(pb, 2);
- else if (st->codec->codec_id == CODEC_ID_MPEG1VIDEO)
+ else if (st->codec->codec_id == AV_CODEC_ID_MPEG1VIDEO)
avio_wl32(pb, 1);
else
avio_wl32(pb, 0);
@@ -529,17 +523,6 @@ static int gxf_write_umf_media_audio(AVIOContext *pb, GXFStreamContext *sc)
return 32;
}
-#if 0
-static int gxf_write_umf_media_mjpeg(AVIOContext *pb, GXFStreamContext *sc)
-{
- avio_wb64(pb, 0); /* FIXME FLOAT max chroma quant level */
- avio_wb64(pb, 0); /* FIXME FLOAT max luma quant level */
- avio_wb64(pb, 0); /* FIXME FLOAT min chroma quant level */
- avio_wb64(pb, 0); /* FIXME FLOAT min luma quant level */
- return 32;
-}
-#endif
-
static int gxf_write_umf_media_description(AVFormatContext *s)
{
GXFContext *gxf = s->priv_data;
@@ -581,14 +564,14 @@ static int gxf_write_umf_media_description(AVFormatContext *s)
else {
AVStream *st = s->streams[i];
switch (st->codec->codec_id) {
- case CODEC_ID_MPEG1VIDEO:
- case CODEC_ID_MPEG2VIDEO:
+ case AV_CODEC_ID_MPEG1VIDEO:
+ case AV_CODEC_ID_MPEG2VIDEO:
gxf_write_umf_media_mpeg(pb, st);
break;
- case CODEC_ID_PCM_S16LE:
+ case AV_CODEC_ID_PCM_S16LE:
gxf_write_umf_media_audio(pb, sc);
break;
- case CODEC_ID_DVVIDEO:
+ case AV_CODEC_ID_DVVIDEO:
gxf_write_umf_media_dv(pb, sc);
break;
}
@@ -663,7 +646,7 @@ static int gxf_write_header(AVFormatContext *s)
sc->media_type = ff_codec_get_tag(gxf_media_types, st->codec->codec_id);
if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO) {
- if (st->codec->codec_id != CODEC_ID_PCM_S16LE) {
+ if (st->codec->codec_id != AV_CODEC_ID_PCM_S16LE) {
av_log(s, AV_LOG_ERROR, "only 16 BIT PCM LE allowed for now\n");
return -1;
}
@@ -716,25 +699,25 @@ static int gxf_write_header(AVFormatContext *s)
vsc = sc;
switch (st->codec->codec_id) {
- case CODEC_ID_MJPEG:
+ case AV_CODEC_ID_MJPEG:
sc->track_type = 1;
gxf->flags |= 0x00004000;
media_info = 'J';
break;
- case CODEC_ID_MPEG1VIDEO:
+ case AV_CODEC_ID_MPEG1VIDEO:
sc->track_type = 9;
gxf->mpeg_tracks++;
media_info = 'L';
break;
- case CODEC_ID_MPEG2VIDEO:
+ case AV_CODEC_ID_MPEG2VIDEO:
sc->first_gop_closed = -1;
sc->track_type = 4;
gxf->mpeg_tracks++;
gxf->flags |= 0x00008000;
media_info = 'M';
break;
- case CODEC_ID_DVVIDEO:
- if (st->codec->pix_fmt == PIX_FMT_YUV422P) {
+ case AV_CODEC_ID_DVVIDEO:
+ if (st->codec->pix_fmt == AV_PIX_FMT_YUV422P) {
sc->media_type += 2;
sc->track_type = 6;
gxf->flags |= 0x00002000;
@@ -846,7 +829,7 @@ static int gxf_write_media_preamble(AVFormatContext *s, AVPacket *pkt, int size)
if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO) {
avio_wb16(pb, 0);
avio_wb16(pb, size / 2);
- } else if (st->codec->codec_id == CODEC_ID_MPEG2VIDEO) {
+ } else if (st->codec->codec_id == AV_CODEC_ID_MPEG2VIDEO) {
int frame_type = gxf_parse_mpeg_frame(sc, pkt->data, pkt->size);
if (frame_type == AV_PICTURE_TYPE_I) {
avio_w8(pb, 0x0d);
@@ -859,7 +842,7 @@ static int gxf_write_media_preamble(AVFormatContext *s, AVPacket *pkt, int size)
sc->pframes++;
}
avio_wb24(pb, size);
- } else if (st->codec->codec_id == CODEC_ID_DVVIDEO) {
+ } else if (st->codec->codec_id == AV_CODEC_ID_DVVIDEO) {
avio_w8(pb, size / 4096);
avio_wb24(pb, 0);
} else
@@ -880,7 +863,7 @@ static int gxf_write_packet(AVFormatContext *s, AVPacket *pkt)
int packet_start_offset = avio_tell(pb) / 1024;
gxf_write_packet_header(pb, PKT_MEDIA);
- if (st->codec->codec_id == CODEC_ID_MPEG2VIDEO && pkt->size % 4) /* MPEG-2 frames must be padded */
+ if (st->codec->codec_id == AV_CODEC_ID_MPEG2VIDEO && pkt->size % 4) /* MPEG-2 frames must be padded */
padding = 4 - pkt->size % 4;
else if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO)
padding = GXF_AUDIO_PACKET_SIZE - pkt->size;
@@ -941,16 +924,16 @@ static int gxf_interleave_packet(AVFormatContext *s, AVPacket *out, AVPacket *pk
if (pkt && s->streams[pkt->stream_index]->codec->codec_type == AVMEDIA_TYPE_VIDEO)
pkt->duration = 2; // enforce 2 fields
return ff_audio_rechunk_interleave(s, out, pkt, flush,
- av_interleave_packet_per_dts, gxf_compare_field_nb);
+ ff_interleave_packet_per_dts, gxf_compare_field_nb);
}
AVOutputFormat ff_gxf_muxer = {
.name = "gxf",
- .long_name = NULL_IF_CONFIG_SMALL("GXF format"),
+ .long_name = NULL_IF_CONFIG_SMALL("GXF (General eXchange Format)"),
.extensions = "gxf",
.priv_data_size = sizeof(GXFContext),
- .audio_codec = CODEC_ID_PCM_S16LE,
- .video_codec = CODEC_ID_MPEG2VIDEO,
+ .audio_codec = AV_CODEC_ID_PCM_S16LE,
+ .video_codec = AV_CODEC_ID_MPEG2VIDEO,
.write_header = gxf_write_header,
.write_packet = gxf_write_packet,
.write_trailer = gxf_write_trailer,
diff --git a/gst-libs/ext/libav/libavformat/h261dec.c b/gst-libs/ext/libav/libavformat/h261dec.c
index 1b416d4..9b9e3f4 100644
--- a/gst-libs/ext/libav/libavformat/h261dec.c
+++ b/gst-libs/ext/libav/libavformat/h261dec.c
@@ -62,4 +62,4 @@ static int h261_probe(AVProbeData *p)
return 0;
}
-FF_DEF_RAWVIDEO_DEMUXER(h261, "raw H.261", h261_probe, "h261", CODEC_ID_H261)
+FF_DEF_RAWVIDEO_DEMUXER(h261, "raw H.261", h261_probe, "h261", AV_CODEC_ID_H261)
diff --git a/gst-libs/ext/libav/libavformat/h263dec.c b/gst-libs/ext/libav/libavformat/h263dec.c
index b9185cb..101ef51 100644
--- a/gst-libs/ext/libav/libavformat/h263dec.c
+++ b/gst-libs/ext/libav/libavformat/h263dec.c
@@ -55,8 +55,6 @@ static int h263_probe(AVProbeData *p)
last_gn= gn;
}
}
-//av_log(NULL, AV_LOG_ERROR, "h263_probe: psc:%d invalid:%d res_change:%d\n", valid_psc, invalid_psc, res_change);
-//h263_probe: psc:3 invalid:0 res_change:0 (1588/recent_ffmpeg_parses_mpg_incorrectly.mpg)
if(valid_psc > 2*invalid_psc + 2*res_change + 3){
return 50;
}else if(valid_psc > 2*invalid_psc)
@@ -64,4 +62,4 @@ static int h263_probe(AVProbeData *p)
return 0;
}
-FF_DEF_RAWVIDEO_DEMUXER(h263, "raw H.263", h263_probe, NULL, CODEC_ID_H263)
+FF_DEF_RAWVIDEO_DEMUXER(h263, "raw H.263", h263_probe, NULL, AV_CODEC_ID_H263)
diff --git a/gst-libs/ext/libav/libavformat/h264dec.c b/gst-libs/ext/libav/libavformat/h264dec.c
index f908647..0c85bae 100644
--- a/gst-libs/ext/libav/libavformat/h264dec.c
+++ b/gst-libs/ext/libav/libavformat/h264dec.c
@@ -54,7 +54,7 @@ static int h264_probe(AVProbeData *p)
case 1: sli++; break;
case 5: idr++; break;
case 7:
- if(p->buf[i+2]&0x0F)
+ if (p->buf[i + 2] & 0x03)
return 0;
sps++;
break;
@@ -67,4 +67,4 @@ static int h264_probe(AVProbeData *p)
return 0;
}
-FF_DEF_RAWVIDEO_DEMUXER(h264 , "raw H.264 video format", h264_probe, "h26l,h264,264", CODEC_ID_H264)
+FF_DEF_RAWVIDEO_DEMUXER(h264 , "raw H.264 video", h264_probe, "h26l,h264,264", AV_CODEC_ID_H264)
diff --git a/gst-libs/ext/libav/libavformat/hls.c b/gst-libs/ext/libav/libavformat/hls.c
new file mode 100644
index 0000000..4c0e0c0
--- /dev/null
+++ b/gst-libs/ext/libav/libavformat/hls.c
@@ -0,0 +1,752 @@
+/*
+ * Apple HTTP Live Streaming demuxer
+ * Copyright (c) 2010 Martin Storsjo
+ *
+ * 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
+ * Apple HTTP Live Streaming demuxer
+ * http://tools.ietf.org/html/draft-pantos-http-live-streaming
+ */
+
+#include "libavutil/avstring.h"
+#include "libavutil/intreadwrite.h"
+#include "libavutil/mathematics.h"
+#include "libavutil/opt.h"
+#include "libavutil/dict.h"
+#include "libavutil/time.h"
+#include "avformat.h"
+#include "internal.h"
+#include "avio_internal.h"
+#include "url.h"
+
+#define INITIAL_BUFFER_SIZE 32768
+
+/*
+ * An apple http stream consists of a playlist with media segment files,
+ * played sequentially. There may be several playlists with the same
+ * video content, in different bandwidth variants, that are played in
+ * parallel (preferably only one bandwidth variant at a time). In this case,
+ * the user supplied the url to a main playlist that only lists the variant
+ * playlists.
+ *
+ * If the main playlist doesn't point at any variants, we still create
+ * one anonymous toplevel variant for this, to maintain the structure.
+ */
+
+enum KeyType {
+ KEY_NONE,
+ KEY_AES_128,
+};
+
+struct segment {
+ int duration;
+ char url[MAX_URL_SIZE];
+ char key[MAX_URL_SIZE];
+ enum KeyType key_type;
+ uint8_t iv[16];
+};
+
+/*
+ * Each variant has its own demuxer. If it currently is active,
+ * it has an open AVIOContext too, and potentially an AVPacket
+ * containing the next packet from this stream.
+ */
+struct variant {
+ int bandwidth;
+ char url[MAX_URL_SIZE];
+ AVIOContext pb;
+ uint8_t* read_buffer;
+ URLContext *input;
+ AVFormatContext *parent;
+ int index;
+ AVFormatContext *ctx;
+ AVPacket pkt;
+ int stream_offset;
+
+ int finished;
+ int target_duration;
+ int start_seq_no;
+ int n_segments;
+ struct segment **segments;
+ int needed, cur_needed;
+ int cur_seq_no;
+ int64_t last_load_time;
+
+ char key_url[MAX_URL_SIZE];
+ uint8_t key[16];
+};
+
+typedef struct HLSContext {
+ int n_variants;
+ struct variant **variants;
+ int cur_seq_no;
+ int end_of_segment;
+ int first_packet;
+ int64_t first_timestamp;
+ int64_t seek_timestamp;
+ int seek_flags;
+ AVIOInterruptCB *interrupt_callback;
+} HLSContext;
+
+static int read_chomp_line(AVIOContext *s, char *buf, int maxlen)
+{
+ int len = ff_get_line(s, buf, maxlen);
+ while (len > 0 && isspace(buf[len - 1]))
+ buf[--len] = '\0';
+ return len;
+}
+
+static void free_segment_list(struct variant *var)
+{
+ int i;
+ for (i = 0; i < var->n_segments; i++)
+ av_free(var->segments[i]);
+ av_freep(&var->segments);
+ var->n_segments = 0;
+}
+
+static void free_variant_list(HLSContext *c)
+{
+ int i;
+ for (i = 0; i < c->n_variants; i++) {
+ struct variant *var = c->variants[i];
+ free_segment_list(var);
+ av_free_packet(&var->pkt);
+ av_free(var->pb.buffer);
+ if (var->input)
+ ffurl_close(var->input);
+ if (var->ctx) {
+ var->ctx->pb = NULL;
+ avformat_close_input(&var->ctx);
+ }
+ av_free(var);
+ }
+ av_freep(&c->variants);
+ c->n_variants = 0;
+}
+
+/*
+ * Used to reset a statically allocated AVPacket to a clean slate,
+ * containing no data.
+ */
+static void reset_packet(AVPacket *pkt)
+{
+ av_init_packet(pkt);
+ pkt->data = NULL;
+}
+
+static struct variant *new_variant(HLSContext *c, int bandwidth,
+ const char *url, const char *base)
+{
+ struct variant *var = av_mallocz(sizeof(struct variant));
+ if (!var)
+ return NULL;
+ reset_packet(&var->pkt);
+ var->bandwidth = bandwidth;
+ ff_make_absolute_url(var->url, sizeof(var->url), base, url);
+ dynarray_add(&c->variants, &c->n_variants, var);
+ return var;
+}
+
+struct variant_info {
+ char bandwidth[20];
+};
+
+static void handle_variant_args(struct variant_info *info, const char *key,
+ int key_len, char **dest, int *dest_len)
+{
+ if (!strncmp(key, "BANDWIDTH=", key_len)) {
+ *dest = info->bandwidth;
+ *dest_len = sizeof(info->bandwidth);
+ }
+}
+
+struct key_info {
+ char uri[MAX_URL_SIZE];
+ char method[10];
+ char iv[35];
+};
+
+static void handle_key_args(struct key_info *info, const char *key,
+ int key_len, char **dest, int *dest_len)
+{
+ if (!strncmp(key, "METHOD=", key_len)) {
+ *dest = info->method;
+ *dest_len = sizeof(info->method);
+ } else if (!strncmp(key, "URI=", key_len)) {
+ *dest = info->uri;
+ *dest_len = sizeof(info->uri);
+ } else if (!strncmp(key, "IV=", key_len)) {
+ *dest = info->iv;
+ *dest_len = sizeof(info->iv);
+ }
+}
+
+static int parse_playlist(HLSContext *c, const char *url,
+ struct variant *var, AVIOContext *in)
+{
+ int ret = 0, duration = 0, is_segment = 0, is_variant = 0, bandwidth = 0;
+ enum KeyType key_type = KEY_NONE;
+ uint8_t iv[16] = "";
+ int has_iv = 0;
+ char key[MAX_URL_SIZE] = "";
+ char line[1024];
+ const char *ptr;
+ int close_in = 0;
+
+ if (!in) {
+ close_in = 1;
+ if ((ret = avio_open2(&in, url, AVIO_FLAG_READ,
+ c->interrupt_callback, NULL)) < 0)
+ return ret;
+ }
+
+ read_chomp_line(in, line, sizeof(line));
+ if (strcmp(line, "#EXTM3U")) {
+ ret = AVERROR_INVALIDDATA;
+ goto fail;
+ }
+
+ if (var) {
+ free_segment_list(var);
+ var->finished = 0;
+ }
+ while (!in->eof_reached) {
+ read_chomp_line(in, line, sizeof(line));
+ if (av_strstart(line, "#EXT-X-STREAM-INF:", &ptr)) {
+ struct variant_info info = {{0}};
+ is_variant = 1;
+ ff_parse_key_value(ptr, (ff_parse_key_val_cb) handle_variant_args,
+ &info);
+ bandwidth = atoi(info.bandwidth);
+ } else if (av_strstart(line, "#EXT-X-KEY:", &ptr)) {
+ struct key_info info = {{0}};
+ ff_parse_key_value(ptr, (ff_parse_key_val_cb) handle_key_args,
+ &info);
+ key_type = KEY_NONE;
+ has_iv = 0;
+ if (!strcmp(info.method, "AES-128"))
+ key_type = KEY_AES_128;
+ if (!strncmp(info.iv, "0x", 2) || !strncmp(info.iv, "0X", 2)) {
+ ff_hex_to_data(iv, info.iv + 2);
+ has_iv = 1;
+ }
+ av_strlcpy(key, info.uri, sizeof(key));
+ } else if (av_strstart(line, "#EXT-X-TARGETDURATION:", &ptr)) {
+ if (!var) {
+ var = new_variant(c, 0, url, NULL);
+ if (!var) {
+ ret = AVERROR(ENOMEM);
+ goto fail;
+ }
+ }
+ var->target_duration = atoi(ptr);
+ } else if (av_strstart(line, "#EXT-X-MEDIA-SEQUENCE:", &ptr)) {
+ if (!var) {
+ var = new_variant(c, 0, url, NULL);
+ if (!var) {
+ ret = AVERROR(ENOMEM);
+ goto fail;
+ }
+ }
+ var->start_seq_no = atoi(ptr);
+ } else if (av_strstart(line, "#EXT-X-ENDLIST", &ptr)) {
+ if (var)
+ var->finished = 1;
+ } else if (av_strstart(line, "#EXTINF:", &ptr)) {
+ is_segment = 1;
+ duration = atoi(ptr);
+ } else if (av_strstart(line, "#", NULL)) {
+ continue;
+ } else if (line[0]) {
+ if (is_variant) {
+ if (!new_variant(c, bandwidth, line, url)) {
+ ret = AVERROR(ENOMEM);
+ goto fail;
+ }
+ is_variant = 0;
+ bandwidth = 0;
+ }
+ if (is_segment) {
+ struct segment *seg;
+ if (!var) {
+ var = new_variant(c, 0, url, NULL);
+ if (!var) {
+ ret = AVERROR(ENOMEM);
+ goto fail;
+ }
+ }
+ seg = av_malloc(sizeof(struct segment));
+ if (!seg) {
+ ret = AVERROR(ENOMEM);
+ goto fail;
+ }
+ seg->duration = duration;
+ seg->key_type = key_type;
+ if (has_iv) {
+ memcpy(seg->iv, iv, sizeof(iv));
+ } else {
+ int seq = var->start_seq_no + var->n_segments;
+ memset(seg->iv, 0, sizeof(seg->iv));
+ AV_WB32(seg->iv + 12, seq);
+ }
+ ff_make_absolute_url(seg->key, sizeof(seg->key), url, key);
+ ff_make_absolute_url(seg->url, sizeof(seg->url), url, line);
+ dynarray_add(&var->segments, &var->n_segments, seg);
+ is_segment = 0;
+ }
+ }
+ }
+ if (var)
+ var->last_load_time = av_gettime();
+
+fail:
+ if (close_in)
+ avio_close(in);
+ return ret;
+}
+
+static int open_input(struct variant *var)
+{
+ struct segment *seg = var->segments[var->cur_seq_no - var->start_seq_no];
+ if (seg->key_type == KEY_NONE) {
+ return ffurl_open(&var->input, seg->url, AVIO_FLAG_READ,
+ &var->parent->interrupt_callback, NULL);
+ } else if (seg->key_type == KEY_AES_128) {
+ char iv[33], key[33], url[MAX_URL_SIZE];
+ int ret;
+ if (strcmp(seg->key, var->key_url)) {
+ URLContext *uc;
+ if (ffurl_open(&uc, seg->key, AVIO_FLAG_READ,
+ &var->parent->interrupt_callback, NULL) == 0) {
+ if (ffurl_read_complete(uc, var->key, sizeof(var->key))
+ != sizeof(var->key)) {
+ av_log(NULL, AV_LOG_ERROR, "Unable to read key file %s\n",
+ seg->key);
+ }
+ ffurl_close(uc);
+ } else {
+ av_log(NULL, AV_LOG_ERROR, "Unable to open key file %s\n",
+ seg->key);
+ }
+ av_strlcpy(var->key_url, seg->key, sizeof(var->key_url));
+ }
+ ff_data_to_hex(iv, seg->iv, sizeof(seg->iv), 0);
+ ff_data_to_hex(key, var->key, sizeof(var->key), 0);
+ iv[32] = key[32] = '\0';
+ if (strstr(seg->url, "://"))
+ snprintf(url, sizeof(url), "crypto+%s", seg->url);
+ else
+ snprintf(url, sizeof(url), "crypto:%s", seg->url);
+ if ((ret = ffurl_alloc(&var->input, url, AVIO_FLAG_READ,
+ &var->parent->interrupt_callback)) < 0)
+ return ret;
+ 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, NULL)) < 0) {
+ ffurl_close(var->input);
+ var->input = NULL;
+ return ret;
+ }
+ return 0;
+ }
+ return AVERROR(ENOSYS);
+}
+
+static int read_data(void *opaque, uint8_t *buf, int buf_size)
+{
+ struct variant *v = opaque;
+ HLSContext *c = v->parent->priv_data;
+ int ret, i;
+
+restart:
+ if (!v->input) {
+ /* If this is a live stream and the reload interval has elapsed since
+ * the last playlist reload, reload the variant playlists now. */
+ int64_t reload_interval = v->n_segments > 0 ?
+ v->segments[v->n_segments - 1]->duration :
+ v->target_duration;
+ reload_interval *= 1000000;
+
+reload:
+ if (!v->finished &&
+ av_gettime() - v->last_load_time >= reload_interval) {
+ if ((ret = parse_playlist(c, v->url, v, NULL)) < 0)
+ return ret;
+ /* If we need to reload the playlist again below (if
+ * there's still no more segments), switch to a reload
+ * interval of half the target duration. */
+ reload_interval = v->target_duration * 500000;
+ }
+ if (v->cur_seq_no < v->start_seq_no) {
+ av_log(NULL, AV_LOG_WARNING,
+ "skipping %d segments ahead, expired from playlists\n",
+ v->start_seq_no - v->cur_seq_no);
+ v->cur_seq_no = v->start_seq_no;
+ }
+ if (v->cur_seq_no >= v->start_seq_no + v->n_segments) {
+ if (v->finished)
+ return AVERROR_EOF;
+ while (av_gettime() - v->last_load_time < reload_interval) {
+ if (ff_check_interrupt(c->interrupt_callback))
+ return AVERROR_EXIT;
+ av_usleep(100*1000);
+ }
+ /* Enough time has elapsed since the last reload */
+ goto reload;
+ }
+
+ ret = open_input(v);
+ if (ret < 0)
+ return ret;
+ }
+ ret = ffurl_read(v->input, buf, buf_size);
+ if (ret > 0)
+ return ret;
+ ffurl_close(v->input);
+ v->input = NULL;
+ v->cur_seq_no++;
+
+ c->end_of_segment = 1;
+ c->cur_seq_no = v->cur_seq_no;
+
+ if (v->ctx && v->ctx->nb_streams) {
+ v->needed = 0;
+ for (i = v->stream_offset; i < v->stream_offset + v->ctx->nb_streams;
+ i++) {
+ if (v->parent->streams[i]->discard < AVDISCARD_ALL)
+ v->needed = 1;
+ }
+ }
+ if (!v->needed) {
+ av_log(v->parent, AV_LOG_INFO, "No longer receiving variant %d\n",
+ v->index);
+ return AVERROR_EOF;
+ }
+ goto restart;
+}
+
+static int hls_read_header(AVFormatContext *s)
+{
+ HLSContext *c = s->priv_data;
+ int ret = 0, i, j, stream_offset = 0;
+
+ c->interrupt_callback = &s->interrupt_callback;
+
+ if ((ret = parse_playlist(c, s->filename, NULL, s->pb)) < 0)
+ goto fail;
+
+ if (c->n_variants == 0) {
+ av_log(NULL, AV_LOG_WARNING, "Empty playlist\n");
+ ret = AVERROR_EOF;
+ goto fail;
+ }
+ /* If the playlist only contained variants, parse each individual
+ * variant playlist. */
+ if (c->n_variants > 1 || c->variants[0]->n_segments == 0) {
+ for (i = 0; i < c->n_variants; i++) {
+ struct variant *v = c->variants[i];
+ if ((ret = parse_playlist(c, v->url, v, NULL)) < 0)
+ goto fail;
+ }
+ }
+
+ if (c->variants[0]->n_segments == 0) {
+ av_log(NULL, AV_LOG_WARNING, "Empty playlist\n");
+ ret = AVERROR_EOF;
+ goto fail;
+ }
+
+ /* If this isn't a live stream, calculate the total duration of the
+ * stream. */
+ if (c->variants[0]->finished) {
+ int64_t duration = 0;
+ for (i = 0; i < c->variants[0]->n_segments; i++)
+ duration += c->variants[0]->segments[i]->duration;
+ s->duration = duration * AV_TIME_BASE;
+ }
+
+ /* Open the demuxer for each variant */
+ for (i = 0; i < c->n_variants; i++) {
+ struct variant *v = c->variants[i];
+ AVInputFormat *in_fmt = NULL;
+ char bitrate_str[20];
+ if (v->n_segments == 0)
+ continue;
+
+ if (!(v->ctx = avformat_alloc_context())) {
+ ret = AVERROR(ENOMEM);
+ goto fail;
+ }
+
+ v->index = i;
+ v->needed = 1;
+ v->parent = s;
+
+ /* If this is a live stream with more than 3 segments, start at the
+ * third last segment. */
+ v->cur_seq_no = v->start_seq_no;
+ if (!v->finished && v->n_segments > 3)
+ v->cur_seq_no = v->start_seq_no + v->n_segments - 3;
+
+ v->read_buffer = av_malloc(INITIAL_BUFFER_SIZE);
+ ffio_init_context(&v->pb, v->read_buffer, INITIAL_BUFFER_SIZE, 0, v,
+ read_data, NULL, NULL);
+ v->pb.seekable = 0;
+ ret = av_probe_input_buffer(&v->pb, &in_fmt, v->segments[0]->url,
+ NULL, 0, 0);
+ if (ret < 0) {
+ /* Free the ctx - it isn't initialized properly at this point,
+ * so avformat_close_input shouldn't be called. If
+ * avformat_open_input fails below, it frees and zeros the
+ * context, so it doesn't need any special treatment like this. */
+ avformat_free_context(v->ctx);
+ v->ctx = NULL;
+ goto fail;
+ }
+ v->ctx->pb = &v->pb;
+ ret = avformat_open_input(&v->ctx, v->segments[0]->url, in_fmt, NULL);
+ if (ret < 0)
+ goto fail;
+ v->stream_offset = stream_offset;
+ snprintf(bitrate_str, sizeof(bitrate_str), "%d", v->bandwidth);
+ /* Create new AVStreams for each stream in this variant */
+ for (j = 0; j < v->ctx->nb_streams; j++) {
+ AVStream *st = avformat_new_stream(s, NULL);
+ if (!st) {
+ ret = AVERROR(ENOMEM);
+ goto fail;
+ }
+ st->id = i;
+ avcodec_copy_context(st->codec, v->ctx->streams[j]->codec);
+ if (v->bandwidth)
+ av_dict_set(&st->metadata, "variant_bitrate", bitrate_str,
+ 0);
+ }
+ stream_offset += v->ctx->nb_streams;
+ }
+
+ c->first_packet = 1;
+ c->first_timestamp = AV_NOPTS_VALUE;
+ c->seek_timestamp = AV_NOPTS_VALUE;
+
+ return 0;
+fail:
+ free_variant_list(c);
+ return ret;
+}
+
+static int recheck_discard_flags(AVFormatContext *s, int first)
+{
+ HLSContext *c = s->priv_data;
+ int i, changed = 0;
+
+ /* Check if any new streams are needed */
+ for (i = 0; i < c->n_variants; i++)
+ c->variants[i]->cur_needed = 0;;
+
+ for (i = 0; i < s->nb_streams; i++) {
+ AVStream *st = s->streams[i];
+ struct variant *var = c->variants[s->streams[i]->id];
+ if (st->discard < AVDISCARD_ALL)
+ var->cur_needed = 1;
+ }
+ for (i = 0; i < c->n_variants; i++) {
+ struct variant *v = c->variants[i];
+ if (v->cur_needed && !v->needed) {
+ v->needed = 1;
+ changed = 1;
+ v->cur_seq_no = c->cur_seq_no;
+ v->pb.eof_reached = 0;
+ av_log(s, AV_LOG_INFO, "Now receiving variant %d\n", i);
+ } else if (first && !v->cur_needed && v->needed) {
+ if (v->input)
+ ffurl_close(v->input);
+ v->input = NULL;
+ v->needed = 0;
+ changed = 1;
+ av_log(s, AV_LOG_INFO, "No longer receiving variant %d\n", i);
+ }
+ }
+ return changed;
+}
+
+static int hls_read_packet(AVFormatContext *s, AVPacket *pkt)
+{
+ HLSContext *c = s->priv_data;
+ int ret, i, minvariant = -1;
+
+ if (c->first_packet) {
+ recheck_discard_flags(s, 1);
+ c->first_packet = 0;
+ }
+
+start:
+ c->end_of_segment = 0;
+ for (i = 0; i < c->n_variants; i++) {
+ struct variant *var = c->variants[i];
+ /* Make sure we've got one buffered packet from each open variant
+ * stream */
+ if (var->needed && !var->pkt.data) {
+ while (1) {
+ int64_t ts_diff;
+ AVStream *st;
+ ret = av_read_frame(var->ctx, &var->pkt);
+ if (ret < 0) {
+ if (!var->pb.eof_reached)
+ return ret;
+ reset_packet(&var->pkt);
+ break;
+ } else {
+ if (c->first_timestamp == AV_NOPTS_VALUE)
+ c->first_timestamp = var->pkt.dts;
+ }
+
+ if (c->seek_timestamp == AV_NOPTS_VALUE)
+ break;
+
+ if (var->pkt.dts == AV_NOPTS_VALUE) {
+ c->seek_timestamp = AV_NOPTS_VALUE;
+ break;
+ }
+
+ st = var->ctx->streams[var->pkt.stream_index];
+ ts_diff = av_rescale_rnd(var->pkt.dts, AV_TIME_BASE,
+ st->time_base.den, AV_ROUND_DOWN) -
+ c->seek_timestamp;
+ if (ts_diff >= 0 && (c->seek_flags & AVSEEK_FLAG_ANY ||
+ var->pkt.flags & AV_PKT_FLAG_KEY)) {
+ c->seek_timestamp = AV_NOPTS_VALUE;
+ break;
+ }
+ }
+ }
+ /* Check if this stream has the packet with the lowest dts */
+ if (var->pkt.data) {
+ if (minvariant < 0 ||
+ var->pkt.dts < c->variants[minvariant]->pkt.dts)
+ minvariant = i;
+ }
+ }
+ if (c->end_of_segment) {
+ if (recheck_discard_flags(s, 0))
+ goto start;
+ }
+ /* If we got a packet, return it */
+ if (minvariant >= 0) {
+ *pkt = c->variants[minvariant]->pkt;
+ pkt->stream_index += c->variants[minvariant]->stream_offset;
+ reset_packet(&c->variants[minvariant]->pkt);
+ return 0;
+ }
+ return AVERROR_EOF;
+}
+
+static int hls_close(AVFormatContext *s)
+{
+ HLSContext *c = s->priv_data;
+
+ free_variant_list(c);
+ return 0;
+}
+
+static int hls_read_seek(AVFormatContext *s, int stream_index,
+ int64_t timestamp, int flags)
+{
+ HLSContext *c = s->priv_data;
+ int i, j, ret;
+
+ if ((flags & AVSEEK_FLAG_BYTE) || !c->variants[0]->finished)
+ return AVERROR(ENOSYS);
+
+ c->seek_flags = flags;
+ c->seek_timestamp = stream_index < 0 ? timestamp :
+ av_rescale_rnd(timestamp, AV_TIME_BASE,
+ s->streams[stream_index]->time_base.den,
+ flags & AVSEEK_FLAG_BACKWARD ?
+ AV_ROUND_DOWN : AV_ROUND_UP);
+ timestamp = av_rescale_rnd(timestamp, 1, stream_index >= 0 ?
+ s->streams[stream_index]->time_base.den :
+ AV_TIME_BASE, flags & AVSEEK_FLAG_BACKWARD ?
+ AV_ROUND_DOWN : AV_ROUND_UP);
+ if (s->duration < c->seek_timestamp) {
+ c->seek_timestamp = AV_NOPTS_VALUE;
+ return AVERROR(EIO);
+ }
+
+ ret = AVERROR(EIO);
+ for (i = 0; i < c->n_variants; i++) {
+ /* Reset reading */
+ struct variant *var = c->variants[i];
+ int64_t pos = c->first_timestamp == AV_NOPTS_VALUE ? 0 :
+ av_rescale_rnd(c->first_timestamp, 1,
+ stream_index >= 0 ? s->streams[stream_index]->time_base.den : AV_TIME_BASE,
+ flags & AVSEEK_FLAG_BACKWARD ? AV_ROUND_DOWN : AV_ROUND_UP);
+ if (var->input) {
+ ffurl_close(var->input);
+ var->input = NULL;
+ }
+ av_free_packet(&var->pkt);
+ reset_packet(&var->pkt);
+ var->pb.eof_reached = 0;
+ /* Clear any buffered data */
+ var->pb.buf_end = var->pb.buf_ptr = var->pb.buffer;
+ /* Reset the pos, to let the mpegts demuxer know we've seeked. */
+ var->pb.pos = 0;
+
+ /* Locate the segment that contains the target timestamp */
+ for (j = 0; j < var->n_segments; j++) {
+ if (timestamp >= pos &&
+ timestamp < pos + var->segments[j]->duration) {
+ var->cur_seq_no = var->start_seq_no + j;
+ ret = 0;
+ break;
+ }
+ pos += var->segments[j]->duration;
+ }
+ if (ret)
+ c->seek_timestamp = AV_NOPTS_VALUE;
+ }
+ return ret;
+}
+
+static int hls_probe(AVProbeData *p)
+{
+ /* Require #EXTM3U at the start, and either one of the ones below
+ * somewhere for a proper match. */
+ if (strncmp(p->buf, "#EXTM3U", 7))
+ return 0;
+ if (strstr(p->buf, "#EXT-X-STREAM-INF:") ||
+ strstr(p->buf, "#EXT-X-TARGETDURATION:") ||
+ strstr(p->buf, "#EXT-X-MEDIA-SEQUENCE:"))
+ return AVPROBE_SCORE_MAX;
+ return 0;
+}
+
+AVInputFormat ff_hls_demuxer = {
+ .name = "hls,applehttp",
+ .long_name = NULL_IF_CONFIG_SMALL("Apple HTTP Live Streaming"),
+ .priv_data_size = sizeof(HLSContext),
+ .read_probe = hls_probe,
+ .read_header = hls_read_header,
+ .read_packet = hls_read_packet,
+ .read_close = hls_close,
+ .read_seek = hls_read_seek,
+};
diff --git a/gst-libs/ext/libav/libavformat/hlsenc.c b/gst-libs/ext/libav/libavformat/hlsenc.c
new file mode 100644
index 0000000..c4c0217
--- /dev/null
+++ b/gst-libs/ext/libav/libavformat/hlsenc.c
@@ -0,0 +1,340 @@
+/*
+ * Apple HTTP Live Streaming segmenter
+ * Copyright (c) 2012, Luca Barbato
+ *
+ * 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
+ */
+
+#include <float.h>
+
+#include "libavutil/mathematics.h"
+#include "libavutil/parseutils.h"
+#include "libavutil/avstring.h"
+#include "libavutil/opt.h"
+#include "libavutil/log.h"
+
+#include "avformat.h"
+#include "internal.h"
+
+typedef struct ListEntry {
+ char name[1024];
+ int duration;
+ struct ListEntry *next;
+} ListEntry;
+
+typedef struct HLSContext {
+ const AVClass *class; // Class for private options.
+ unsigned number;
+ int64_t sequence;
+ AVOutputFormat *oformat;
+ AVFormatContext *avf;
+ float time; // Set by a private option.
+ int size; // Set by a private option.
+ int wrap; // Set by a private option.
+ int64_t recording_time;
+ int has_video;
+ int64_t start_pts;
+ int64_t end_pts;
+ int nb_entries;
+ ListEntry *list;
+ ListEntry *end_list;
+ char *basename;
+ AVIOContext *pb;
+} HLSContext;
+
+static int hls_mux_init(AVFormatContext *s)
+{
+ HLSContext *hls = s->priv_data;
+ AVFormatContext *oc;
+ int i;
+
+ hls->avf = oc = avformat_alloc_context();
+ if (!oc)
+ return AVERROR(ENOMEM);
+
+ oc->oformat = hls->oformat;
+ oc->interrupt_callback = s->interrupt_callback;
+
+ for (i = 0; i < s->nb_streams; i++) {
+ AVStream *st;
+ if (!(st = avformat_new_stream(oc, NULL)))
+ return AVERROR(ENOMEM);
+ avcodec_copy_context(st->codec, s->streams[i]->codec);
+ st->sample_aspect_ratio = s->streams[i]->sample_aspect_ratio;
+ }
+
+ return 0;
+}
+
+static int append_entry(HLSContext *hls, uint64_t duration)
+{
+ ListEntry *en = av_malloc(sizeof(*en));
+
+ if (!en)
+ return AVERROR(ENOMEM);
+
+ av_strlcpy(en->name, av_basename(hls->avf->filename), sizeof(en->name));
+
+ en->duration = duration;
+ en->next = NULL;
+
+ if (!hls->list)
+ hls->list = en;
+ else
+ hls->end_list->next = en;
+
+ hls->end_list = en;
+
+ if (hls->nb_entries >= hls->size) {
+ en = hls->list;
+ hls->list = en->next;
+ av_free(en);
+ } else
+ hls->nb_entries++;
+
+ hls->sequence++;
+
+ return 0;
+}
+
+static void free_entries(HLSContext *hls)
+{
+ ListEntry *p = hls->list, *en;
+
+ while(p) {
+ en = p;
+ p = p->next;
+ av_free(en);
+ }
+}
+
+static int hls_window(AVFormatContext *s, int last)
+{
+ HLSContext *hls = s->priv_data;
+ ListEntry *en;
+ int target_duration = 0;
+ int ret = 0;
+
+ if ((ret = avio_open2(&hls->pb, s->filename, AVIO_FLAG_WRITE,
+ &s->interrupt_callback, NULL)) < 0)
+ goto fail;
+
+ for (en = hls->list; en; en = en->next) {
+ if (target_duration < en->duration)
+ target_duration = en->duration;
+ }
+
+ avio_printf(hls->pb, "#EXTM3U\n");
+ avio_printf(hls->pb, "#EXT-X-VERSION:3\n");
+ avio_printf(hls->pb, "#EXT-X-TARGETDURATION:%d\n", target_duration);
+ avio_printf(hls->pb, "#EXT-X-MEDIA-SEQUENCE:%"PRId64"\n",
+ FFMAX(0, hls->sequence - hls->size));
+
+ for (en = hls->list; en; en = en->next) {
+ avio_printf(hls->pb, "#EXTINF:%d,\n", en->duration);
+ avio_printf(hls->pb, "%s\n", en->name);
+ }
+
+ if (last)
+ avio_printf(hls->pb, "#EXT-X-ENDLIST\n");
+
+fail:
+ avio_closep(&hls->pb);
+ return ret;
+}
+
+static int hls_start(AVFormatContext *s)
+{
+ HLSContext *c = s->priv_data;
+ AVFormatContext *oc = c->avf;
+ int err = 0;
+
+ if (c->wrap)
+ c->number %= c->wrap;
+
+ if (av_get_frame_filename(oc->filename, sizeof(oc->filename),
+ c->basename, c->number++) < 0)
+ return AVERROR(EINVAL);
+
+ if ((err = avio_open2(&oc->pb, oc->filename, AVIO_FLAG_WRITE,
+ &s->interrupt_callback, NULL)) < 0)
+ return err;
+
+ if (oc->oformat->priv_class && oc->priv_data)
+ av_opt_set(oc->priv_data, "mpegts_flags", "resend_headers", 0);
+
+ return 0;
+}
+
+static int hls_write_header(AVFormatContext *s)
+{
+ HLSContext *hls = s->priv_data;
+ int ret, i;
+ char *p;
+ const char *pattern = "%d.ts";
+ int basename_size = strlen(s->filename) + strlen(pattern) + 1;
+
+ hls->number = 0;
+
+ hls->recording_time = hls->time * AV_TIME_BASE;
+ hls->start_pts = AV_NOPTS_VALUE;
+
+ for (i = 0; i < s->nb_streams; i++)
+ hls->has_video +=
+ s->streams[i]->codec->codec_type == AVMEDIA_TYPE_VIDEO;
+
+ if (hls->has_video > 1)
+ av_log(s, AV_LOG_WARNING,
+ "More than a single video stream present, "
+ "expect issues decoding it.\n");
+
+ hls->oformat = av_guess_format("mpegts", NULL, NULL);
+
+ if (!hls->oformat) {
+ ret = AVERROR_MUXER_NOT_FOUND;
+ goto fail;
+ }
+
+ hls->basename = av_malloc(basename_size);
+
+ if (!hls->basename) {
+ ret = AVERROR(ENOMEM);
+ goto fail;
+ }
+
+ strcpy(hls->basename, s->filename);
+
+ p = strrchr(hls->basename, '.');
+
+ if (p)
+ *p = '\0';
+
+ av_strlcat(hls->basename, pattern, basename_size);
+
+ if ((ret = hls_mux_init(s)) < 0)
+ goto fail;
+
+ if ((ret = hls_start(s)) < 0)
+ goto fail;
+
+ if ((ret = avformat_write_header(hls->avf, NULL)) < 0)
+ return ret;
+
+
+fail:
+ if (ret) {
+ av_free(hls->basename);
+ if (hls->avf)
+ avformat_free_context(hls->avf);
+ }
+ return ret;
+}
+
+static int hls_write_packet(AVFormatContext *s, AVPacket *pkt)
+{
+ HLSContext *hls = s->priv_data;
+ AVFormatContext *oc = hls->avf;
+ AVStream *st = s->streams[pkt->stream_index];
+ int64_t end_pts = hls->recording_time * hls->number;
+ int ret, can_split = 1;
+
+ if (hls->start_pts == AV_NOPTS_VALUE) {
+ hls->start_pts = pkt->pts;
+ hls->end_pts = pkt->pts;
+ }
+
+ if (hls->has_video) {
+ can_split = st->codec->codec_type == AVMEDIA_TYPE_VIDEO &&
+ pkt->flags & AV_PKT_FLAG_KEY;
+ }
+
+ if (can_split && av_compare_ts(pkt->pts - hls->start_pts, st->time_base,
+ end_pts, AV_TIME_BASE_Q) >= 0) {
+ ret = append_entry(hls, av_rescale(pkt->pts - hls->end_pts,
+ st->time_base.num,
+ st->time_base.den));
+ if (ret)
+ return ret;
+
+ hls->end_pts = pkt->pts;
+
+ av_write_frame(oc, NULL); /* Flush any buffered data */
+ avio_close(oc->pb);
+
+ ret = hls_start(s);
+
+ if (ret)
+ return ret;
+
+ oc = hls->avf;
+
+ if ((ret = hls_window(s, 0)) < 0)
+ return ret;
+ }
+
+ ret = ff_write_chained(oc, pkt->stream_index, pkt, s);
+
+ return ret;
+}
+
+static int hls_write_trailer(struct AVFormatContext *s)
+{
+ HLSContext *hls = s->priv_data;
+ AVFormatContext *oc = hls->avf;
+
+ av_write_trailer(oc);
+ avio_closep(&oc->pb);
+ avformat_free_context(oc);
+ av_free(hls->basename);
+ hls_window(s, 1);
+
+ free_entries(hls);
+ avio_close(hls->pb);
+ return 0;
+}
+
+#define OFFSET(x) offsetof(HLSContext, x)
+#define E AV_OPT_FLAG_ENCODING_PARAM
+static const AVOption options[] = {
+ { "start_number", "first number in the sequence", OFFSET(number), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, E},
+ {"hls_time", "segment length in seconds", OFFSET(time), AV_OPT_TYPE_FLOAT, {.dbl = 2}, 0, FLT_MAX, E},
+ {"hls_list_size", "maximum number of playlist entries", OFFSET(size), AV_OPT_TYPE_INT, {.i64 = 5}, 0, INT_MAX, E},
+ {"hls_wrap", "number after which the index wraps", OFFSET(wrap), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, E},
+ { NULL },
+};
+
+static const AVClass hls_class = {
+ .class_name = "hls muxer",
+ .item_name = av_default_item_name,
+ .option = options,
+ .version = LIBAVUTIL_VERSION_INT,
+};
+
+
+AVOutputFormat ff_hls_muxer = {
+ .name = "hls",
+ .long_name = NULL_IF_CONFIG_SMALL("Apple HTTP Live Streaming"),
+ .extensions = "m3u8",
+ .priv_data_size = sizeof(HLSContext),
+ .audio_codec = AV_CODEC_ID_MP2,
+ .video_codec = AV_CODEC_ID_MPEG2VIDEO,
+ .flags = AVFMT_NOFILE | AVFMT_ALLOW_FLUSH,
+ .write_header = hls_write_header,
+ .write_packet = hls_write_packet,
+ .write_trailer = hls_write_trailer,
+ .priv_class = &hls_class,
+};
diff --git a/gst-libs/ext/libav/libavformat/hlsproto.c b/gst-libs/ext/libav/libavformat/hlsproto.c
new file mode 100644
index 0000000..b750501
--- /dev/null
+++ b/gst-libs/ext/libav/libavformat/hlsproto.c
@@ -0,0 +1,347 @@
+/*
+ * Apple HTTP Live Streaming Protocol Handler
+ * Copyright (c) 2010 Martin Storsjo
+ *
+ * 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
+ * Apple HTTP Live Streaming Protocol Handler
+ * http://tools.ietf.org/html/draft-pantos-http-live-streaming
+ */
+
+#include "libavutil/avstring.h"
+#include "libavutil/time.h"
+#include "avformat.h"
+#include "internal.h"
+#include "url.h"
+#include "version.h"
+
+/*
+ * An apple http stream consists of a playlist with media segment files,
+ * played sequentially. There may be several playlists with the same
+ * video content, in different bandwidth variants, that are played in
+ * parallel (preferably only one bandwidth variant at a time). In this case,
+ * the user supplied the url to a main playlist that only lists the variant
+ * playlists.
+ *
+ * If the main playlist doesn't point at any variants, we still create
+ * one anonymous toplevel variant for this, to maintain the structure.
+ */
+
+struct segment {
+ int duration;
+ char url[MAX_URL_SIZE];
+};
+
+struct variant {
+ int bandwidth;
+ char url[MAX_URL_SIZE];
+};
+
+typedef struct HLSContext {
+ char playlisturl[MAX_URL_SIZE];
+ int target_duration;
+ int start_seq_no;
+ int finished;
+ int n_segments;
+ struct segment **segments;
+ int n_variants;
+ struct variant **variants;
+ int cur_seq_no;
+ URLContext *seg_hd;
+ int64_t last_load_time;
+} HLSContext;
+
+static int read_chomp_line(AVIOContext *s, char *buf, int maxlen)
+{
+ int len = ff_get_line(s, buf, maxlen);
+ while (len > 0 && isspace(buf[len - 1]))
+ buf[--len] = '\0';
+ return len;
+}
+
+static void free_segment_list(HLSContext *s)
+{
+ int i;
+ for (i = 0; i < s->n_segments; i++)
+ av_free(s->segments[i]);
+ av_freep(&s->segments);
+ s->n_segments = 0;
+}
+
+static void free_variant_list(HLSContext *s)
+{
+ int i;
+ for (i = 0; i < s->n_variants; i++)
+ av_free(s->variants[i]);
+ av_freep(&s->variants);
+ s->n_variants = 0;
+}
+
+struct variant_info {
+ char bandwidth[20];
+};
+
+static void handle_variant_args(struct variant_info *info, const char *key,
+ int key_len, char **dest, int *dest_len)
+{
+ if (!strncmp(key, "BANDWIDTH=", key_len)) {
+ *dest = info->bandwidth;
+ *dest_len = sizeof(info->bandwidth);
+ }
+}
+
+static int parse_playlist(URLContext *h, const char *url)
+{
+ HLSContext *s = h->priv_data;
+ AVIOContext *in;
+ int ret = 0, duration = 0, is_segment = 0, is_variant = 0, bandwidth = 0;
+ char line[1024];
+ const char *ptr;
+
+ if ((ret = avio_open2(&in, url, AVIO_FLAG_READ,
+ &h->interrupt_callback, NULL)) < 0)
+ return ret;
+
+ read_chomp_line(in, line, sizeof(line));
+ if (strcmp(line, "#EXTM3U"))
+ return AVERROR_INVALIDDATA;
+
+ free_segment_list(s);
+ s->finished = 0;
+ while (!in->eof_reached) {
+ read_chomp_line(in, line, sizeof(line));
+ if (av_strstart(line, "#EXT-X-STREAM-INF:", &ptr)) {
+ struct variant_info info = {{0}};
+ is_variant = 1;
+ ff_parse_key_value(ptr, (ff_parse_key_val_cb) handle_variant_args,
+ &info);
+ bandwidth = atoi(info.bandwidth);
+ } else if (av_strstart(line, "#EXT-X-TARGETDURATION:", &ptr)) {
+ s->target_duration = atoi(ptr);
+ } else if (av_strstart(line, "#EXT-X-MEDIA-SEQUENCE:", &ptr)) {
+ s->start_seq_no = atoi(ptr);
+ } else if (av_strstart(line, "#EXT-X-ENDLIST", &ptr)) {
+ s->finished = 1;
+ } else if (av_strstart(line, "#EXTINF:", &ptr)) {
+ is_segment = 1;
+ duration = atoi(ptr);
+ } else if (av_strstart(line, "#", NULL)) {
+ continue;
+ } else if (line[0]) {
+ if (is_segment) {
+ struct segment *seg = av_malloc(sizeof(struct segment));
+ if (!seg) {
+ ret = AVERROR(ENOMEM);
+ goto fail;
+ }
+ seg->duration = duration;
+ ff_make_absolute_url(seg->url, sizeof(seg->url), url, line);
+ dynarray_add(&s->segments, &s->n_segments, seg);
+ is_segment = 0;
+ } else if (is_variant) {
+ struct variant *var = av_malloc(sizeof(struct variant));
+ if (!var) {
+ ret = AVERROR(ENOMEM);
+ goto fail;
+ }
+ var->bandwidth = bandwidth;
+ ff_make_absolute_url(var->url, sizeof(var->url), url, line);
+ dynarray_add(&s->variants, &s->n_variants, var);
+ is_variant = 0;
+ }
+ }
+ }
+ s->last_load_time = av_gettime();
+
+fail:
+ avio_close(in);
+ return ret;
+}
+
+static int hls_close(URLContext *h)
+{
+ HLSContext *s = h->priv_data;
+
+ free_segment_list(s);
+ free_variant_list(s);
+ ffurl_close(s->seg_hd);
+ return 0;
+}
+
+static int hls_open(URLContext *h, const char *uri, int flags)
+{
+ HLSContext *s = h->priv_data;
+ int ret, i;
+ const char *nested_url;
+
+ if (flags & AVIO_FLAG_WRITE)
+ return AVERROR(ENOSYS);
+
+ h->is_streamed = 1;
+
+ if (av_strstart(uri, "hls+", &nested_url)) {
+ av_strlcpy(s->playlisturl, nested_url, sizeof(s->playlisturl));
+ } else if (av_strstart(uri, "hls://", &nested_url)) {
+ av_log(h, AV_LOG_ERROR,
+ "No nested protocol specified. Specify e.g. hls+http://%s\n",
+ nested_url);
+ ret = AVERROR(EINVAL);
+ goto fail;
+#if FF_API_APPLEHTTP_PROTO
+ } else if (av_strstart(uri, "applehttp+", &nested_url)) {
+ av_strlcpy(s->playlisturl, nested_url, sizeof(s->playlisturl));
+ av_log(h, AV_LOG_WARNING,
+ "The applehttp protocol is deprecated, use hls+%s as url "
+ "instead.\n", nested_url);
+ } else if (av_strstart(uri, "applehttp://", &nested_url)) {
+ av_strlcpy(s->playlisturl, "http://", sizeof(s->playlisturl));
+ av_strlcat(s->playlisturl, nested_url, sizeof(s->playlisturl));
+ av_log(h, AV_LOG_WARNING,
+ "The applehttp protocol is deprecated, use hls+http://%s as url "
+ "instead.\n", nested_url);
+#endif
+ } else {
+ av_log(h, AV_LOG_ERROR, "Unsupported url %s\n", uri);
+ ret = AVERROR(EINVAL);
+ goto fail;
+ }
+ av_log(h, AV_LOG_WARNING,
+ "Using the hls protocol is discouraged, please try using the "
+ "hls demuxer instead. The hls demuxer should be more complete "
+ "and work as well as the protocol implementation. (If not, "
+ "please report it.) To use the demuxer, simply use %s as url.\n",
+ s->playlisturl);
+
+ if ((ret = parse_playlist(h, s->playlisturl)) < 0)
+ goto fail;
+
+ if (s->n_segments == 0 && s->n_variants > 0) {
+ int max_bandwidth = 0, maxvar = -1;
+ for (i = 0; i < s->n_variants; i++) {
+ if (s->variants[i]->bandwidth > max_bandwidth || i == 0) {
+ max_bandwidth = s->variants[i]->bandwidth;
+ maxvar = i;
+ }
+ }
+ av_strlcpy(s->playlisturl, s->variants[maxvar]->url,
+ sizeof(s->playlisturl));
+ if ((ret = parse_playlist(h, s->playlisturl)) < 0)
+ goto fail;
+ }
+
+ if (s->n_segments == 0) {
+ av_log(h, AV_LOG_WARNING, "Empty playlist\n");
+ ret = AVERROR(EIO);
+ goto fail;
+ }
+ s->cur_seq_no = s->start_seq_no;
+ if (!s->finished && s->n_segments >= 3)
+ s->cur_seq_no = s->start_seq_no + s->n_segments - 3;
+
+ return 0;
+
+fail:
+ hls_close(h);
+ return ret;
+}
+
+static int hls_read(URLContext *h, uint8_t *buf, int size)
+{
+ HLSContext *s = h->priv_data;
+ const char *url;
+ int ret;
+ int64_t reload_interval;
+
+start:
+ if (s->seg_hd) {
+ ret = ffurl_read(s->seg_hd, buf, size);
+ if (ret > 0)
+ return ret;
+ }
+ if (s->seg_hd) {
+ ffurl_close(s->seg_hd);
+ s->seg_hd = NULL;
+ s->cur_seq_no++;
+ }
+ reload_interval = s->n_segments > 0 ?
+ s->segments[s->n_segments - 1]->duration :
+ s->target_duration;
+ reload_interval *= 1000000;
+retry:
+ if (!s->finished) {
+ int64_t now = av_gettime();
+ if (now - s->last_load_time >= reload_interval) {
+ if ((ret = parse_playlist(h, s->playlisturl)) < 0)
+ return ret;
+ /* If we need to reload the playlist again below (if
+ * there's still no more segments), switch to a reload
+ * interval of half the target duration. */
+ reload_interval = s->target_duration * 500000;
+ }
+ }
+ if (s->cur_seq_no < s->start_seq_no) {
+ av_log(h, AV_LOG_WARNING,
+ "skipping %d segments ahead, expired from playlist\n",
+ s->start_seq_no - s->cur_seq_no);
+ s->cur_seq_no = s->start_seq_no;
+ }
+ if (s->cur_seq_no - s->start_seq_no >= s->n_segments) {
+ if (s->finished)
+ return AVERROR_EOF;
+ while (av_gettime() - s->last_load_time < reload_interval) {
+ if (ff_check_interrupt(&h->interrupt_callback))
+ return AVERROR_EXIT;
+ av_usleep(100*1000);
+ }
+ goto retry;
+ }
+ url = s->segments[s->cur_seq_no - s->start_seq_no]->url,
+ av_log(h, AV_LOG_DEBUG, "opening %s\n", url);
+ ret = ffurl_open(&s->seg_hd, url, AVIO_FLAG_READ,
+ &h->interrupt_callback, NULL);
+ if (ret < 0) {
+ if (ff_check_interrupt(&h->interrupt_callback))
+ return AVERROR_EXIT;
+ av_log(h, AV_LOG_WARNING, "Unable to open %s\n", url);
+ s->cur_seq_no++;
+ goto retry;
+ }
+ goto start;
+}
+
+#if FF_API_APPLEHTTP_PROTO
+URLProtocol ff_applehttp_protocol = {
+ .name = "applehttp",
+ .url_open = hls_open,
+ .url_read = hls_read,
+ .url_close = hls_close,
+ .flags = URL_PROTOCOL_FLAG_NESTED_SCHEME,
+ .priv_data_size = sizeof(HLSContext),
+};
+#endif
+
+URLProtocol ff_hls_protocol = {
+ .name = "hls",
+ .url_open = hls_open,
+ .url_read = hls_read,
+ .url_close = hls_close,
+ .flags = URL_PROTOCOL_FLAG_NESTED_SCHEME,
+ .priv_data_size = sizeof(HLSContext),
+};
diff --git a/gst-libs/ext/libav/libavformat/http.c b/gst-libs/ext/libav/libavformat/http.c
index eea8ded..9666ca3 100644
--- a/gst-libs/ext/libav/libavformat/http.c
+++ b/gst-libs/ext/libav/libavformat/http.c
@@ -21,7 +21,6 @@
#include "libavutil/avstring.h"
#include "avformat.h"
-#include <unistd.h>
#include "internal.h"
#include "network.h"
#include "http.h"
@@ -33,8 +32,11 @@
/* XXX: POST protocol is not completely implemented because avconv uses
only a subset of it. */
-/* used for protocol handling */
-#define BUFFER_SIZE 1024
+/* The IO buffer size is unrelated to the max URL size in itself, but needs
+ * to be large enough to fit the full request headers (including long
+ * path names).
+ */
+#define BUFFER_SIZE MAX_URL_SIZE
#define MAX_REDIRECTS 8
typedef struct {
@@ -51,14 +53,21 @@ typedef struct {
char *headers;
int willclose; /**< Set if the server correctly handles Connection: close and will close the connection after feeding us the content. */
int chunked_post;
+ int end_chunked_post; /**< A flag which indicates if the end of chunked encoding has been sent. */
+ int end_header; /**< A flag which indicates we have finished to read POST reply. */
+ int multiple_requests; /**< A flag which indicates if we use persistent connections. */
+ uint8_t *post_data;
+ int post_datalen;
} HTTPContext;
#define OFFSET(x) offsetof(HTTPContext, x)
#define D AV_OPT_FLAG_DECODING_PARAM
#define E AV_OPT_FLAG_ENCODING_PARAM
static const AVOption options[] = {
-{"chunked_post", "use chunked transfer-encoding for posts", OFFSET(chunked_post), AV_OPT_TYPE_INT, {.dbl = 1}, 0, 1, E },
+{"chunked_post", "use chunked transfer-encoding for posts", OFFSET(chunked_post), AV_OPT_TYPE_INT, {.i64 = 1}, 0, 1, E },
{"headers", "custom HTTP headers, can override built in default headers", OFFSET(headers), AV_OPT_TYPE_STRING, { 0 }, 0, 0, D|E },
+{"multiple_requests", "use persistent connections", OFFSET(multiple_requests), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1, D|E },
+{"post_data", "custom HTTP post data", OFFSET(post_data), AV_OPT_TYPE_BINARY, .flags = D|E },
{NULL}
};
#define HTTP_CLASS(flavor)\
@@ -91,12 +100,11 @@ static int http_open_cnx(URLContext *h)
const char *path, *proxy_path, *lower_proto = "tcp", *local_path;
char hostname[1024], hoststr[1024], proto[10];
char auth[1024], proxyauth[1024] = "";
- char path1[1024];
- char buf[1024], urlbuf[1024];
- int port, use_proxy, err, location_changed = 0, redirects = 0;
+ char path1[MAX_URL_SIZE];
+ char buf[1024], urlbuf[MAX_URL_SIZE];
+ int port, use_proxy, err, location_changed = 0, redirects = 0, attempts = 0;
HTTPAuthType cur_auth_type, cur_proxy_auth_type;
HTTPContext *s = h->priv_data;
- URLContext *hd = NULL;
proxy_path = getenv("http_proxy");
use_proxy = (proxy_path != NULL) && !getenv("no_proxy") &&
@@ -135,27 +143,33 @@ static int http_open_cnx(URLContext *h)
}
ff_url_join(buf, sizeof(buf), lower_proto, NULL, hostname, port, NULL);
- err = ffurl_open(&hd, buf, AVIO_FLAG_READ_WRITE,
- &h->interrupt_callback, NULL);
- if (err < 0)
- goto fail;
- s->hd = hd;
+ if (!s->hd) {
+ err = ffurl_open(&s->hd, buf, AVIO_FLAG_READ_WRITE,
+ &h->interrupt_callback, NULL);
+ if (err < 0)
+ goto fail;
+ }
+
cur_auth_type = s->auth_state.auth_type;
cur_proxy_auth_type = s->auth_state.auth_type;
if (http_connect(h, path, local_path, hoststr, auth, proxyauth, &location_changed) < 0)
goto fail;
+ attempts++;
if (s->http_code == 401) {
- if (cur_auth_type == HTTP_AUTH_NONE && s->auth_state.auth_type != HTTP_AUTH_NONE) {
- ffurl_close(hd);
+ if ((cur_auth_type == HTTP_AUTH_NONE || s->auth_state.stale) &&
+ s->auth_state.auth_type != HTTP_AUTH_NONE && attempts < 4) {
+ ffurl_close(s->hd);
+ s->hd = NULL;
goto redo;
} else
goto fail;
}
if (s->http_code == 407) {
- if (cur_proxy_auth_type == HTTP_AUTH_NONE &&
- s->proxy_auth_state.auth_type != HTTP_AUTH_NONE) {
- ffurl_close(hd);
+ if ((cur_proxy_auth_type == HTTP_AUTH_NONE || s->proxy_auth_state.stale) &&
+ s->proxy_auth_state.auth_type != HTTP_AUTH_NONE && attempts < 4) {
+ ffurl_close(s->hd);
+ s->hd = NULL;
goto redo;
} else
goto fail;
@@ -163,20 +177,35 @@ static int http_open_cnx(URLContext *h)
if ((s->http_code == 301 || s->http_code == 302 || s->http_code == 303 || s->http_code == 307)
&& location_changed == 1) {
/* url moved, get next */
- ffurl_close(hd);
+ ffurl_close(s->hd);
+ s->hd = NULL;
if (redirects++ >= MAX_REDIRECTS)
return AVERROR(EIO);
+ /* Restart the authentication process with the new target, which
+ * might use a different auth mechanism. */
+ memset(&s->auth_state, 0, sizeof(s->auth_state));
+ attempts = 0;
location_changed = 0;
goto redo;
}
return 0;
fail:
- if (hd)
- ffurl_close(hd);
+ if (s->hd)
+ ffurl_close(s->hd);
s->hd = NULL;
return AVERROR(EIO);
}
+int ff_http_do_new_request(URLContext *h, const char *uri)
+{
+ HTTPContext *s = h->priv_data;
+
+ s->off = 0;
+ av_strlcpy(s->location, uri, sizeof(s->location));
+
+ return http_open_cnx(h);
+}
+
static int http_open(URLContext *h, const char *uri, int flags)
{
HTTPContext *s = h->priv_data;
@@ -200,7 +229,7 @@ static int http_getc(HTTPContext *s)
if (s->buf_ptr >= s->buf_end) {
len = ffurl_read(s->hd, s->buffer, BUFFER_SIZE);
if (len < 0) {
- return AVERROR(EIO);
+ return len;
} else if (len == 0) {
return -1;
} else {
@@ -220,7 +249,7 @@ static int http_get_line(HTTPContext *s, char *line, int line_size)
for(;;) {
ch = http_getc(s);
if (ch < 0)
- return AVERROR(EIO);
+ return ch;
if (ch == '\n') {
/* process line */
if (q > line && q[-1] == '\r')
@@ -242,8 +271,10 @@ static int process_line(URLContext *h, char *line, int line_count,
char *tag, *p, *end;
/* end of header */
- if (line[0] == '\0')
+ if (line[0] == '\0') {
+ s->end_header = 1;
return 0;
+ }
p = line;
if (line_count == 0) {
@@ -277,18 +308,18 @@ static int process_line(URLContext *h, char *line, int line_count,
while (isspace(*p))
p++;
if (!av_strcasecmp(tag, "Location")) {
- strcpy(s->location, p);
+ av_strlcpy(s->location, p, sizeof(s->location));
*new_location = 1;
} else if (!av_strcasecmp (tag, "Content-Length") && s->filesize == -1) {
- s->filesize = atoll(p);
+ s->filesize = strtoll(p, NULL, 10);
} else if (!av_strcasecmp (tag, "Content-Range")) {
/* "bytes $from-$to/$document_size" */
const char *slash;
if (!strncmp (p, "bytes ", 6)) {
p += 6;
- s->off = atoll(p);
+ s->off = strtoll(p, NULL, 10);
if ((slash = strchr(p, '/')) && strlen(slash) > 0)
- s->filesize = atoll(slash+1);
+ s->filesize = strtoll(slash+1, NULL, 10);
}
h->is_streamed = 0; /* we _can_ in fact seek */
} else if (!av_strcasecmp(tag, "Accept-Ranges") && !strncmp(p, "bytes", 5)) {
@@ -318,13 +349,37 @@ static inline int has_header(const char *str, const char *header)
return av_stristart(str, header + 2, NULL) || av_stristr(str, header);
}
+static int http_read_header(URLContext *h, int *new_location)
+{
+ HTTPContext *s = h->priv_data;
+ char line[MAX_URL_SIZE];
+ int err = 0;
+
+ s->chunksize = -1;
+
+ for (;;) {
+ if ((err = http_get_line(s, line, sizeof(line))) < 0)
+ return err;
+
+ av_dlog(NULL, "header='%s'\n", line);
+
+ err = process_line(h, line, s->line_count, new_location);
+ if (err < 0)
+ return err;
+ if (err == 0)
+ break;
+ s->line_count++;
+ }
+
+ return err;
+}
+
static int http_connect(URLContext *h, const char *path, const char *local_path,
const char *hoststr, const char *auth,
const char *proxyauth, int *new_location)
{
HTTPContext *s = h->priv_data;
int post, err;
- char line[1024];
char headers[1024] = "";
char *authstr = NULL, *proxyauthstr = NULL;
int64_t off = s->off;
@@ -334,6 +389,14 @@ static int http_connect(URLContext *h, const char *path, const char *local_path,
/* send http header */
post = h->flags & AVIO_FLAG_WRITE;
+
+ if (s->post_data) {
+ /* force POST method and disable chunked encoding when
+ * custom HTTP post data is set */
+ post = 1;
+ s->chunked_post = 0;
+ }
+
method = post ? "POST" : "GET";
authstr = ff_http_auth_create_response(&s->auth_state, auth, local_path,
method);
@@ -350,12 +413,23 @@ static int http_connect(URLContext *h, const char *path, const char *local_path,
if (!has_header(s->headers, "\r\nRange: ") && !post)
len += av_strlcatf(headers + len, sizeof(headers) - len,
"Range: bytes=%"PRId64"-\r\n", s->off);
- if (!has_header(s->headers, "\r\nConnection: "))
- len += av_strlcpy(headers + len, "Connection: close\r\n",
- sizeof(headers)-len);
+
+ if (!has_header(s->headers, "\r\nConnection: ")) {
+ if (s->multiple_requests) {
+ len += av_strlcpy(headers + len, "Connection: keep-alive\r\n",
+ sizeof(headers) - len);
+ } else {
+ len += av_strlcpy(headers + len, "Connection: close\r\n",
+ sizeof(headers) - len);
+ }
+ }
+
if (!has_header(s->headers, "\r\nHost: "))
len += av_strlcatf(headers + len, sizeof(headers) - len,
"Host: %s\r\n", hoststr);
+ if (!has_header(s->headers, "\r\nContent-Length: ") && s->post_data)
+ len += av_strlcatf(headers + len, sizeof(headers) - len,
+ "Content-Length: %d\r\n", s->post_datalen);
/* now add in custom headers */
if (s->headers)
@@ -377,8 +451,12 @@ static int http_connect(URLContext *h, const char *path, const char *local_path,
av_freep(&authstr);
av_freep(&proxyauthstr);
- if (ffurl_write(s->hd, s->buffer, strlen(s->buffer)) < 0)
- return AVERROR(EIO);
+ if ((err = ffurl_write(s->hd, s->buffer, strlen(s->buffer))) < 0)
+ return err;
+
+ if (s->post_data)
+ if ((err = ffurl_write(s->hd, s->post_data, s->post_datalen)) < 0)
+ return err;
/* init input buffer */
s->buf_ptr = s->buffer;
@@ -387,29 +465,20 @@ static int http_connect(URLContext *h, const char *path, const char *local_path,
s->off = 0;
s->filesize = -1;
s->willclose = 0;
- if (post) {
+ s->end_chunked_post = 0;
+ s->end_header = 0;
+ if (post && !s->post_data) {
/* Pretend that it did work. We didn't read any header yet, since
* we've still to send the POST data, but the code calling this
* function will check http_code after we return. */
s->http_code = 200;
return 0;
}
- s->chunksize = -1;
/* wait for header */
- for(;;) {
- if (http_get_line(s, line, sizeof(line)) < 0)
- return AVERROR(EIO);
-
- av_dlog(NULL, "header='%s'\n", line);
-
- err = process_line(h, line, s->line_count, new_location);
- if (err < 0)
- return err;
- if (err == 0)
- break;
- s->line_count++;
- }
+ err = http_read_header(h, new_location);
+ if (err < 0)
+ return err;
return (off == s->off) ? 0 : -1;
}
@@ -442,6 +511,16 @@ static int http_buf_read(URLContext *h, uint8_t *buf, int size)
static int http_read(URLContext *h, uint8_t *buf, int size)
{
HTTPContext *s = h->priv_data;
+ int err, new_location;
+
+ if (!s->hd)
+ return AVERROR_EOF;
+
+ if (s->end_chunked_post && !s->end_header) {
+ err = http_read_header(h, &new_location);
+ if (err < 0)
+ return err;
+ }
if (s->chunksize >= 0) {
if (!s->chunksize) {
@@ -449,8 +528,8 @@ static int http_read(URLContext *h, uint8_t *buf, int size)
for(;;) {
do {
- if (http_get_line(s, line, sizeof(line)) < 0)
- return AVERROR(EIO);
+ if ((err = http_get_line(s, line, sizeof(line))) < 0)
+ return err;
} while (!*line); /* skip CR LF from last chunk */
s->chunksize = strtoll(line, NULL, 16);
@@ -494,16 +573,30 @@ static int http_write(URLContext *h, const uint8_t *buf, int size)
return size;
}
-static int http_close(URLContext *h)
+static int http_shutdown(URLContext *h, int flags)
{
int ret = 0;
char footer[] = "0\r\n\r\n";
HTTPContext *s = h->priv_data;
/* signal end of chunked encoding if used */
- if ((h->flags & AVIO_FLAG_WRITE) && s->chunked_post) {
+ if ((flags & AVIO_FLAG_WRITE) && s->chunked_post) {
ret = ffurl_write(s->hd, footer, sizeof(footer) - 1);
ret = ret > 0 ? 0 : ret;
+ s->end_chunked_post = 1;
+ }
+
+ return ret;
+}
+
+static int http_close(URLContext *h)
+{
+ int ret = 0;
+ HTTPContext *s = h->priv_data;
+
+ if (!s->end_chunked_post) {
+ /* Close the write direction by sending the end of chunked encoding. */
+ ret = http_shutdown(h, h->flags);
}
if (s->hd)
@@ -563,6 +656,7 @@ URLProtocol ff_http_protocol = {
.url_seek = http_seek,
.url_close = http_close,
.url_get_file_handle = http_get_file_handle,
+ .url_shutdown = http_shutdown,
.priv_data_size = sizeof(HTTPContext),
.priv_data_class = &http_context_class,
.flags = URL_PROTOCOL_FLAG_NETWORK,
@@ -577,6 +671,7 @@ URLProtocol ff_https_protocol = {
.url_seek = http_seek,
.url_close = http_close,
.url_get_file_handle = http_get_file_handle,
+ .url_shutdown = http_shutdown,
.priv_data_size = sizeof(HTTPContext),
.priv_data_class = &https_context_class,
.flags = URL_PROTOCOL_FLAG_NETWORK,
@@ -597,10 +692,11 @@ static int http_proxy_open(URLContext *h, const char *uri, int flags)
HTTPContext *s = h->priv_data;
char hostname[1024], hoststr[1024];
char auth[1024], pathbuf[1024], *path;
- char line[1024], lower_url[100];
- int port, ret = 0;
+ char lower_url[100];
+ int port, ret = 0, attempts = 0;
HTTPAuthType cur_auth_type;
char *authstr;
+ int new_loc;
h->is_streamed = 1;
@@ -641,32 +737,23 @@ redo:
s->filesize = -1;
cur_auth_type = s->proxy_auth_state.auth_type;
- for (;;) {
- int new_loc;
- // Note: This uses buffering, potentially reading more than the
- // HTTP header. If tunneling a protocol where the server starts
- // the conversation, we might buffer part of that here, too.
- // Reading that requires using the proper ffurl_read() function
- // on this URLContext, not using the fd directly (as the tls
- // protocol does). This shouldn't be an issue for tls though,
- // since the client starts the conversation there, so there
- // is no extra data that we might buffer up here.
- if (http_get_line(s, line, sizeof(line)) < 0) {
- ret = AVERROR(EIO);
- goto fail;
- }
-
- av_dlog(h, "header='%s'\n", line);
+ /* Note: This uses buffering, potentially reading more than the
+ * HTTP header. If tunneling a protocol where the server starts
+ * the conversation, we might buffer part of that here, too.
+ * Reading that requires using the proper ffurl_read() function
+ * on this URLContext, not using the fd directly (as the tls
+ * protocol does). This shouldn't be an issue for tls though,
+ * since the client starts the conversation there, so there
+ * is no extra data that we might buffer up here.
+ */
+ ret = http_read_header(h, &new_loc);
+ if (ret < 0)
+ goto fail;
- ret = process_line(h, line, s->line_count, &new_loc);
- if (ret < 0)
- goto fail;
- if (ret == 0)
- break;
- s->line_count++;
- }
- if (s->http_code == 407 && cur_auth_type == HTTP_AUTH_NONE &&
- s->proxy_auth_state.auth_type != HTTP_AUTH_NONE) {
+ attempts++;
+ if (s->http_code == 407 &&
+ (cur_auth_type == HTTP_AUTH_NONE || s->proxy_auth_state.stale) &&
+ s->proxy_auth_state.auth_type != HTTP_AUTH_NONE && attempts < 2) {
ffurl_close(s->hd);
s->hd = NULL;
goto redo;
diff --git a/gst-libs/ext/libav/libavformat/http.h b/gst-libs/ext/libav/libavformat/http.h
index 8dfb192..f0d9d4a 100644
--- a/gst-libs/ext/libav/libavformat/http.h
+++ b/gst-libs/ext/libav/libavformat/http.h
@@ -35,4 +35,14 @@
*/
void ff_http_init_auth_state(URLContext *dest, const URLContext *src);
+/**
+ * Send a new HTTP request, reusing the old connection.
+ *
+ * @param h pointer to the ressource
+ * @param uri uri used to perform the request
+ * @return a negative value if an error condition occurred, 0
+ * otherwise
+ */
+int ff_http_do_new_request(URLContext *h, const char *uri);
+
#endif /* AVFORMAT_HTTP_H */
diff --git a/gst-libs/ext/libav/libavformat/httpauth.c b/gst-libs/ext/libav/libavformat/httpauth.c
index c8b8ace..774ee21 100644
--- a/gst-libs/ext/libav/libavformat/httpauth.c
+++ b/gst-libs/ext/libav/libavformat/httpauth.c
@@ -25,6 +25,7 @@
#include "internal.h"
#include "libavutil/random_seed.h"
#include "libavutil/md5.h"
+#include "urldecode.h"
#include "avformat.h"
#include <ctype.h>
@@ -57,6 +58,9 @@ static void handle_digest_params(HTTPAuthState *state, const char *key,
} else if (!strncmp(key, "qop=", key_len)) {
*dest = digest->qop;
*dest_len = sizeof(digest->qop);
+ } else if (!strncmp(key, "stale=", key_len)) {
+ *dest = digest->stale;
+ *dest_len = sizeof(digest->stale);
}
}
@@ -93,6 +97,7 @@ void ff_http_auth_handle_header(HTTPAuthState *state, const char *key,
state->auth_type <= HTTP_AUTH_BASIC) {
state->auth_type = HTTP_AUTH_BASIC;
state->realm[0] = 0;
+ state->stale = 0;
ff_parse_key_value(p, (ff_parse_key_val_cb) handle_basic_params,
state);
} else if (av_stristart(value, "Digest ", &p) &&
@@ -100,10 +105,13 @@ void ff_http_auth_handle_header(HTTPAuthState *state, const char *key,
state->auth_type = HTTP_AUTH_DIGEST;
memset(&state->digest_params, 0, sizeof(DigestParams));
state->realm[0] = 0;
+ state->stale = 0;
ff_parse_key_value(p, (ff_parse_key_val_cb) handle_digest_params,
state);
choose_qop(state->digest_params.qop,
sizeof(state->digest_params.qop));
+ if (!av_strcasecmp(state->digest_params.stale, "true"))
+ state->stale = 1;
}
} else if (!strcmp(key, "Authentication-Info")) {
ff_parse_key_value(value, (ff_parse_key_val_cb) handle_digest_update,
@@ -151,7 +159,7 @@ static char *make_digest_auth(HTTPAuthState *state, const char *username,
ff_data_to_hex(cnonce, (const uint8_t*) cnonce_buf, sizeof(cnonce_buf), 1);
cnonce[2*sizeof(cnonce_buf)] = 0;
- md5ctx = av_malloc(av_md5_size);
+ md5ctx = av_md5_alloc();
if (!md5ctx)
return NULL;
@@ -237,22 +245,35 @@ char *ff_http_auth_create_response(HTTPAuthState *state, const char *auth,
{
char *authstr = NULL;
+ /* Clear the stale flag, we assume the auth is ok now. It is reset
+ * by the server headers if there's a new issue. */
+ state->stale = 0;
if (!auth || !strchr(auth, ':'))
return NULL;
if (state->auth_type == HTTP_AUTH_BASIC) {
- int auth_b64_len = AV_BASE64_SIZE(strlen(auth));
- int len = auth_b64_len + 30;
- char *ptr;
+ int auth_b64_len, len;
+ char *ptr, *decoded_auth = ff_urldecode(auth);
+
+ if (!decoded_auth)
+ return NULL;
+
+ auth_b64_len = AV_BASE64_SIZE(strlen(decoded_auth));
+ len = auth_b64_len + 30;
+
authstr = av_malloc(len);
- if (!authstr)
+ if (!authstr) {
+ av_free(decoded_auth);
return NULL;
+ }
+
snprintf(authstr, len, "Authorization: Basic ");
ptr = authstr + strlen(authstr);
- av_base64_encode(ptr, auth_b64_len, auth, strlen(auth));
+ av_base64_encode(ptr, auth_b64_len, decoded_auth, strlen(decoded_auth));
av_strlcat(ptr, "\r\n", len - (ptr - authstr));
+ av_free(decoded_auth);
} else if (state->auth_type == HTTP_AUTH_DIGEST) {
- char *username = av_strdup(auth), *password;
+ char *username = ff_urldecode(auth), *password;
if (!username)
return NULL;
@@ -265,4 +286,3 @@ char *ff_http_auth_create_response(HTTPAuthState *state, const char *auth,
}
return authstr;
}
-
diff --git a/gst-libs/ext/libav/libavformat/httpauth.h b/gst-libs/ext/libav/libavformat/httpauth.h
index d2a4a55..99bf43f 100644
--- a/gst-libs/ext/libav/libavformat/httpauth.h
+++ b/gst-libs/ext/libav/libavformat/httpauth.h
@@ -32,7 +32,7 @@ typedef enum HTTPAuthType {
HTTP_AUTH_DIGEST, /**< HTTP 1.1 Digest auth from RFC 2617 */
} HTTPAuthType;
-typedef struct {
+typedef struct DigestParams {
char nonce[300]; /**< Server specified nonce */
char algorithm[10]; /**< Server specified digest algorithm */
char qop[30]; /**< Quality of protection, containing the one
@@ -41,6 +41,9 @@ typedef struct {
char opaque[300]; /**< A server-specified string that should be
* included in authentication responses, not
* included in the actual digest calculation. */
+ char stale[10]; /**< The server indicated that the auth was ok,
+ * but needs to be redone with a new, non-stale
+ * nonce. */
int nc; /**< Nonce count, the number of earlier replies
* where this particular nonce has been used. */
} DigestParams;
@@ -49,7 +52,7 @@ typedef struct {
* HTTP Authentication state structure. Must be zero-initialized
* before used with the functions below.
*/
-typedef struct {
+typedef struct HTTPAuthState {
/**
* The currently chosen auth type.
*/
@@ -62,6 +65,10 @@ typedef struct {
* The parameters specifiec to digest authentication.
*/
DigestParams digest_params;
+ /**
+ * Auth ok, but needs to be resent with a new nonce.
+ */
+ int stale;
} HTTPAuthState;
void ff_http_auth_handle_header(HTTPAuthState *state, const char *key,
diff --git a/gst-libs/ext/libav/libavformat/id3v1.h b/gst-libs/ext/libav/libavformat/id3v1.h
index 4842f16..7107073 100644
--- a/gst-libs/ext/libav/libavformat/id3v1.h
+++ b/gst-libs/ext/libav/libavformat/id3v1.h
@@ -39,4 +39,3 @@ extern const char * const ff_id3v1_genre_str[ID3v1_GENRE_MAX + 1];
void ff_id3v1_read(AVFormatContext *s);
#endif /* AVFORMAT_ID3V1_H */
-
diff --git a/gst-libs/ext/libav/libavformat/id3v2.c b/gst-libs/ext/libav/libavformat/id3v2.c
index f69ac03..5cc17c4 100644
--- a/gst-libs/ext/libav/libavformat/id3v2.c
+++ b/gst-libs/ext/libav/libavformat/id3v2.c
@@ -25,6 +25,7 @@
#include "libavutil/intreadwrite.h"
#include "libavutil/dict.h"
#include "avio_internal.h"
+#include "internal.h"
const AVMetadataConv ff_id3v2_34_metadata_conv[] = {
{ "TALB", "album"},
@@ -86,6 +87,42 @@ const char ff_id3v2_3_tags[][4] = {
{ 0 },
};
+const char *ff_id3v2_picture_types[21] = {
+ "Other",
+ "32x32 pixels 'file icon'",
+ "Other file icon",
+ "Cover (front)",
+ "Cover (back)",
+ "Leaflet page",
+ "Media (e.g. label side of CD)",
+ "Lead artist/lead performer/soloist",
+ "Artist/performer",
+ "Conductor",
+ "Band/Orchestra",
+ "Composer",
+ "Lyricist/text writer",
+ "Recording Location",
+ "During recording",
+ "During performance",
+ "Movie/video screen capture",
+ "A bright coloured fish",
+ "Illustration",
+ "Band/artist logotype",
+ "Publisher/Studio logotype",
+};
+
+const CodecMime ff_id3v2_mime_tags[] = {
+ {"image/gif" , AV_CODEC_ID_GIF},
+ {"image/jpeg", AV_CODEC_ID_MJPEG},
+ {"image/jpg", AV_CODEC_ID_MJPEG},
+ {"image/png" , AV_CODEC_ID_PNG},
+ {"image/tiff", AV_CODEC_ID_TIFF},
+ {"image/bmp", AV_CODEC_ID_BMP},
+ {"JPG", AV_CODEC_ID_MJPEG}, /* ID3v2.2 */
+ {"PNG" , AV_CODEC_ID_PNG}, /* ID3v2.2 */
+ {"", AV_CODEC_ID_NONE},
+};
+
int ff_id3v2_match(const uint8_t *buf, const char * magic)
{
return buf[0] == magic[0] &&
@@ -225,7 +262,7 @@ static int decode_str(AVFormatContext *s, AVIOContext *pb, int encoding,
static void read_ttag(AVFormatContext *s, AVIOContext *pb, int taglen, const char *key)
{
uint8_t *dst;
- int encoding, dict_flags = AV_DICT_DONT_OVERWRITE;
+ int encoding, dict_flags = AV_DICT_DONT_OVERWRITE | AV_DICT_DONT_STRDUP_VAL;
unsigned genre;
if (taglen < 1)
@@ -243,7 +280,7 @@ static void read_ttag(AVFormatContext *s, AVIOContext *pb, int taglen, const cha
&& (sscanf(dst, "(%d)", &genre) == 1 || sscanf(dst, "%d", &genre) == 1)
&& genre <= ID3v1_GENRE_MAX) {
av_freep(&dst);
- dst = ff_id3v1_genre_str[genre];
+ dst = av_strdup(ff_id3v1_genre_str[genre]);
} else if (!(strcmp(key, "TXXX") && strcmp(key, "TXX"))) {
/* dst now contains the key, need to get value */
key = dst;
@@ -252,10 +289,9 @@ static void read_ttag(AVFormatContext *s, AVIOContext *pb, int taglen, const cha
av_freep(&key);
return;
}
- dict_flags |= AV_DICT_DONT_STRDUP_VAL | AV_DICT_DONT_STRDUP_KEY;
- }
- else if (*dst)
- dict_flags |= AV_DICT_DONT_STRDUP_VAL;
+ dict_flags |= AV_DICT_DONT_STRDUP_KEY;
+ } else if (!*dst)
+ av_freep(&dst);
if (dst)
av_dict_set(&s->metadata, key, dst, dict_flags);
@@ -381,6 +417,85 @@ finish:
av_dict_set(m, "date", date, 0);
}
+static void free_apic(void *obj)
+{
+ ID3v2ExtraMetaAPIC *apic = obj;
+ av_freep(&apic->data);
+ av_freep(&apic->description);
+ av_freep(&apic);
+}
+
+static void read_apic(AVFormatContext *s, AVIOContext *pb, int taglen, char *tag, ID3v2ExtraMeta **extra_meta)
+{
+ int enc, pic_type;
+ char mimetype[64];
+ const CodecMime *mime = ff_id3v2_mime_tags;
+ enum AVCodecID id = AV_CODEC_ID_NONE;
+ ID3v2ExtraMetaAPIC *apic = NULL;
+ ID3v2ExtraMeta *new_extra = NULL;
+ int64_t end = avio_tell(pb) + taglen;
+
+ if (taglen <= 4)
+ goto fail;
+
+ new_extra = av_mallocz(sizeof(*new_extra));
+ apic = av_mallocz(sizeof(*apic));
+ if (!new_extra || !apic)
+ goto fail;
+
+ enc = avio_r8(pb);
+ taglen--;
+
+ /* mimetype */
+ taglen -= avio_get_str(pb, taglen, mimetype, sizeof(mimetype));
+ while (mime->id != AV_CODEC_ID_NONE) {
+ if (!av_strncasecmp(mime->str, mimetype, sizeof(mimetype))) {
+ id = mime->id;
+ break;
+ }
+ mime++;
+ }
+ if (id == AV_CODEC_ID_NONE) {
+ av_log(s, AV_LOG_WARNING, "Unknown attached picture mimetype: %s, skipping.\n", mimetype);
+ goto fail;
+ }
+ apic->id = id;
+
+ /* picture type */
+ pic_type = avio_r8(pb);
+ taglen--;
+ if (pic_type < 0 || pic_type >= FF_ARRAY_ELEMS(ff_id3v2_picture_types)) {
+ av_log(s, AV_LOG_WARNING, "Unknown attached picture type %d.\n", pic_type);
+ pic_type = 0;
+ }
+ apic->type = ff_id3v2_picture_types[pic_type];
+
+ /* description and picture data */
+ if (decode_str(s, pb, enc, &apic->description, &taglen) < 0) {
+ av_log(s, AV_LOG_ERROR, "Error decoding attached picture description.\n");
+ goto fail;
+ }
+
+ apic->len = taglen;
+ apic->data = av_malloc(taglen + FF_INPUT_BUFFER_PADDING_SIZE);
+ if (!apic->data || avio_read(pb, apic->data, taglen) != taglen)
+ goto fail;
+ memset(apic->data + taglen, 0, FF_INPUT_BUFFER_PADDING_SIZE);
+
+ new_extra->tag = "APIC";
+ new_extra->data = apic;
+ new_extra->next = *extra_meta;
+ *extra_meta = new_extra;
+
+ return;
+
+fail:
+ if (apic)
+ free_apic(apic);
+ av_freep(&new_extra);
+ avio_seek(pb, end, SEEK_SET);
+}
+
typedef struct ID3v2EMFunc {
const char *tag3;
const char *tag4;
@@ -390,6 +505,7 @@ typedef struct ID3v2EMFunc {
static const ID3v2EMFunc id3v2_extra_meta_funcs[] = {
{ "GEO", "GEOB", read_geobtag, free_geobtag },
+ { "PIC", "APIC", read_apic, free_apic },
{ NULL }
};
@@ -553,7 +669,7 @@ seek:
return;
}
-void ff_id3v2_read_all(AVFormatContext *s, const char *magic, ID3v2ExtraMeta **extra_meta)
+void ff_id3v2_read(AVFormatContext *s, const char *magic, ID3v2ExtraMeta **extra_meta)
{
int len, ret;
uint8_t buf[ID3v2_HEADER_SIZE];
@@ -584,11 +700,6 @@ void ff_id3v2_read_all(AVFormatContext *s, const char *magic, ID3v2ExtraMeta **e
merge_date(&s->metadata);
}
-void ff_id3v2_read(AVFormatContext *s, const char *magic)
-{
- ff_id3v2_read_all(s, magic, NULL);
-}
-
void ff_id3v2_free_extra_meta(ID3v2ExtraMeta **extra_meta)
{
ID3v2ExtraMeta *current = *extra_meta, *next;
@@ -602,3 +713,38 @@ void ff_id3v2_free_extra_meta(ID3v2ExtraMeta **extra_meta)
current = next;
}
}
+
+int ff_id3v2_parse_apic(AVFormatContext *s, ID3v2ExtraMeta **extra_meta)
+{
+ ID3v2ExtraMeta *cur;
+
+ for (cur = *extra_meta; cur; cur = cur->next) {
+ ID3v2ExtraMetaAPIC *apic;
+ AVStream *st;
+
+ if (strcmp(cur->tag, "APIC"))
+ continue;
+ apic = cur->data;
+
+ if (!(st = avformat_new_stream(s, NULL)))
+ return AVERROR(ENOMEM);
+
+ st->disposition |= AV_DISPOSITION_ATTACHED_PIC;
+ st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
+ st->codec->codec_id = apic->id;
+ av_dict_set(&st->metadata, "title", apic->description, 0);
+ av_dict_set(&st->metadata, "comment", apic->type, 0);
+
+ av_init_packet(&st->attached_pic);
+ st->attached_pic.data = apic->data;
+ st->attached_pic.size = apic->len;
+ st->attached_pic.destruct = av_destruct_packet;
+ st->attached_pic.stream_index = st->index;
+ st->attached_pic.flags |= AV_PKT_FLAG_KEY;
+
+ apic->data = NULL;
+ apic->len = 0;
+ }
+
+ return 0;
+}
diff --git a/gst-libs/ext/libav/libavformat/id3v2.h b/gst-libs/ext/libav/libavformat/id3v2.h
index a296e03..cb2fb02 100644
--- a/gst-libs/ext/libav/libavformat/id3v2.h
+++ b/gst-libs/ext/libav/libavformat/id3v2.h
@@ -24,6 +24,7 @@
#include <stdint.h>
#include "avformat.h"
+#include "internal.h"
#include "metadata.h"
#define ID3v2_HEADER_SIZE 10
@@ -45,6 +46,12 @@ enum ID3v2Encoding {
ID3v2_ENCODING_UTF8 = 3,
};
+typedef struct ID3v2EncContext {
+ int version; ///< ID3v2 minor version, either 3 or 4
+ int64_t size_pos; ///< offset of the tag total size
+ int len; ///< size of the tag written so far
+} ID3v2EncContext;
+
typedef struct ID3v2ExtraMeta {
const char *tag;
void *data;
@@ -59,6 +66,14 @@ typedef struct ID3v2ExtraMetaGEOB {
uint8_t *data;
} ID3v2ExtraMetaGEOB;
+typedef struct ID3v2ExtraMetaAPIC {
+ uint8_t *data;
+ int len;
+ const char *type;
+ uint8_t *description;
+ enum AVCodecID id;
+} ID3v2ExtraMetaAPIC;
+
/**
* Detect ID3v2 Header.
* @param buf must be ID3v2_HEADER_SIZE byte long
@@ -75,24 +90,40 @@ int ff_id3v2_match(const uint8_t *buf, const char *magic);
int ff_id3v2_tag_len(const uint8_t *buf);
/**
- * Read an ID3v2 tag (text tags only)
+ * Read an ID3v2 tag, including supported extra metadata
+ * @param extra_meta If not NULL, extra metadata is parsed into a list of
+ * ID3v2ExtraMeta structs and *extra_meta points to the head of the list
*/
-void ff_id3v2_read(AVFormatContext *s, const char *magic);
+void ff_id3v2_read(AVFormatContext *s, const char *magic, ID3v2ExtraMeta **extra_meta);
/**
- * Read an ID3v2 tag, including supported extra metadata (currently only GEOB)
- * @param extra_meta If not NULL, extra metadata is parsed into a list of
- * ID3v2ExtraMeta structs and *extra_meta points to the head of the list
+ * Initialize an ID3v2 tag.
+ */
+void ff_id3v2_start(ID3v2EncContext *id3, AVIOContext *pb, int id3v2_version,
+ const char *magic);
+
+/**
+ * Convert and write all global metadata from s into an ID3v2 tag.
+ */
+int ff_id3v2_write_metadata(AVFormatContext *s, ID3v2EncContext *id3);
+
+/**
+ * Write an attached picture from pkt into an ID3v2 tag.
+ */
+int ff_id3v2_write_apic(AVFormatContext *s, ID3v2EncContext *id3, AVPacket *pkt);
+
+/**
+ * Finalize an opened ID3v2 tag.
*/
-void ff_id3v2_read_all(AVFormatContext *s, const char *magic, ID3v2ExtraMeta **extra_meta);
+void ff_id3v2_finish(ID3v2EncContext *id3, AVIOContext *pb);
/**
- * Write an ID3v2 tag.
+ * Write an ID3v2 tag containing all global metadata from s.
* @param id3v2_version Subversion of ID3v2; supported values are 3 and 4
* @param magic magic bytes to identify the header
* If in doubt, use ID3v2_DEFAULT_MAGIC.
*/
-int ff_id3v2_write(struct AVFormatContext *s, int id3v2_version, const char *magic);
+int ff_id3v2_write_simple(struct AVFormatContext *s, int id3v2_version, const char *magic);
/**
* Free memory allocated parsing special (non-text) metadata.
@@ -100,6 +131,12 @@ int ff_id3v2_write(struct AVFormatContext *s, int id3v2_version, const char *mag
*/
void ff_id3v2_free_extra_meta(ID3v2ExtraMeta **extra_meta);
+/**
+ * Create a stream for each APIC (attached picture) extracted from the
+ * ID3v2 header.
+ */
+int ff_id3v2_parse_apic(AVFormatContext *s, ID3v2ExtraMeta **extra_meta);
+
extern const AVMetadataConv ff_id3v2_34_metadata_conv[];
extern const AVMetadataConv ff_id3v2_4_metadata_conv[];
@@ -120,4 +157,8 @@ extern const char ff_id3v2_4_tags[][4];
*/
extern const char ff_id3v2_3_tags[][4];
+extern const CodecMime ff_id3v2_mime_tags[];
+
+extern const char *ff_id3v2_picture_types[21];
+
#endif /* AVFORMAT_ID3V2_H */
diff --git a/gst-libs/ext/libav/libavformat/id3v2enc.c b/gst-libs/ext/libav/libavformat/id3v2enc.c
index 36c73bf..df00f05 100644
--- a/gst-libs/ext/libav/libavformat/id3v2enc.c
+++ b/gst-libs/ext/libav/libavformat/id3v2enc.c
@@ -19,6 +19,7 @@
*/
#include <stdint.h>
+#include <string.h>
#include "libavutil/dict.h"
#include "libavutil/intreadwrite.h"
@@ -26,12 +27,12 @@
#include "avio.h"
#include "id3v2.h"
-static void id3v2_put_size(AVFormatContext *s, int size)
+static void id3v2_put_size(AVIOContext *pb, int size)
{
- avio_w8(s->pb, size >> 21 & 0x7f);
- avio_w8(s->pb, size >> 14 & 0x7f);
- avio_w8(s->pb, size >> 7 & 0x7f);
- avio_w8(s->pb, size & 0x7f);
+ avio_w8(pb, size >> 21 & 0x7f);
+ avio_w8(pb, size >> 14 & 0x7f);
+ avio_w8(pb, size >> 7 & 0x7f);
+ avio_w8(pb, size & 0x7f);
}
static int string_is_ascii(const uint8_t *str)
@@ -40,17 +41,30 @@ static int string_is_ascii(const uint8_t *str)
return !*str;
}
+static void id3v2_encode_string(AVIOContext *pb, const uint8_t *str,
+ enum ID3v2Encoding enc)
+{
+ int (*put)(AVIOContext*, const char*);
+
+ if (enc == ID3v2_ENCODING_UTF16BOM) {
+ avio_wl16(pb, 0xFEFF); /* BOM */
+ put = avio_put_str16le;
+ } else
+ put = avio_put_str;
+
+ put(pb, str);
+}
+
/**
* Write a text frame with one (normal frames) or two (TXXX frames) strings
* according to encoding (only UTF-8 or UTF-16+BOM supported).
* @return number of bytes written or a negative error code.
*/
-static int id3v2_put_ttag(AVFormatContext *s, const char *str1, const char *str2,
+static int id3v2_put_ttag(ID3v2EncContext *id3, AVIOContext *avioc, const char *str1, const char *str2,
uint32_t tag, enum ID3v2Encoding enc)
{
int len;
uint8_t *pb;
- int (*put)(AVIOContext*, const char*);
AVIOContext *dyn_buf;
if (avio_open_dyn_buf(&dyn_buf) < 0)
return AVERROR(ENOMEM);
@@ -62,28 +76,26 @@ static int id3v2_put_ttag(AVFormatContext *s, const char *str1, const char *str2
enc = ID3v2_ENCODING_ISO8859;
avio_w8(dyn_buf, enc);
- if (enc == ID3v2_ENCODING_UTF16BOM) {
- avio_wl16(dyn_buf, 0xFEFF); /* BOM */
- put = avio_put_str16le;
- } else
- put = avio_put_str;
-
- put(dyn_buf, str1);
+ id3v2_encode_string(dyn_buf, str1, enc);
if (str2)
- put(dyn_buf, str2);
+ id3v2_encode_string(dyn_buf, str2, enc);
len = avio_close_dyn_buf(dyn_buf, &pb);
- avio_wb32(s->pb, tag);
- id3v2_put_size(s, len);
- avio_wb16(s->pb, 0);
- avio_write(s->pb, pb, len);
+ avio_wb32(avioc, tag);
+ /* ID3v2.3 frame size is not synchsafe */
+ if (id3->version == 3)
+ avio_wb32(avioc, len);
+ else
+ id3v2_put_size(avioc, len);
+ avio_wb16(avioc, 0);
+ avio_write(avioc, pb, len);
av_freep(&pb);
return len + ID3v2_HEADER_SIZE;
}
-static int id3v2_check_write_tag(AVFormatContext *s, AVDictionaryEntry *t, const char table[][4],
- enum ID3v2Encoding enc)
+static int id3v2_check_write_tag(ID3v2EncContext *id3, AVIOContext *pb, AVDictionaryEntry *t,
+ const char table[][4], enum ID3v2Encoding enc)
{
uint32_t tag;
int i;
@@ -93,54 +105,139 @@ static int id3v2_check_write_tag(AVFormatContext *s, AVDictionaryEntry *t, const
tag = AV_RB32(t->key);
for (i = 0; *table[i]; i++)
if (tag == AV_RB32(table[i]))
- return id3v2_put_ttag(s, t->value, NULL, tag, enc);
+ return id3v2_put_ttag(id3, pb, t->value, NULL, tag, enc);
return -1;
}
-int ff_id3v2_write(struct AVFormatContext *s, int id3v2_version,
- const char *magic)
+void ff_id3v2_start(ID3v2EncContext *id3, AVIOContext *pb, int id3v2_version,
+ const char *magic)
{
- int64_t size_pos, cur_pos;
- AVDictionaryEntry *t = NULL;
+ id3->version = id3v2_version;
- int totlen = 0, enc = id3v2_version == 3 ? ID3v2_ENCODING_UTF16BOM :
- ID3v2_ENCODING_UTF8;
-
-
- avio_wb32(s->pb, MKBETAG(magic[0], magic[1], magic[2], id3v2_version));
- avio_w8(s->pb, 0);
- avio_w8(s->pb, 0); /* flags */
+ avio_wb32(pb, MKBETAG(magic[0], magic[1], magic[2], id3v2_version));
+ avio_w8(pb, 0);
+ avio_w8(pb, 0); /* flags */
/* reserve space for size */
- size_pos = avio_tell(s->pb);
- avio_wb32(s->pb, 0);
+ id3->size_pos = avio_tell(pb);
+ avio_wb32(pb, 0);
+}
+
+int ff_id3v2_write_metadata(AVFormatContext *s, ID3v2EncContext *id3)
+{
+ AVDictionaryEntry *t = NULL;
+ int enc = id3->version == 3 ? ID3v2_ENCODING_UTF16BOM :
+ ID3v2_ENCODING_UTF8;
ff_metadata_conv(&s->metadata, ff_id3v2_34_metadata_conv, NULL);
- if (id3v2_version == 4)
+ if (id3->version == 4)
ff_metadata_conv(&s->metadata, ff_id3v2_4_metadata_conv, NULL);
while ((t = av_dict_get(s->metadata, "", t, AV_DICT_IGNORE_SUFFIX))) {
int ret;
- if ((ret = id3v2_check_write_tag(s, t, ff_id3v2_tags, enc)) > 0) {
- totlen += ret;
+ if ((ret = id3v2_check_write_tag(id3, s->pb, t, ff_id3v2_tags, enc)) > 0) {
+ id3->len += ret;
continue;
}
- if ((ret = id3v2_check_write_tag(s, t, id3v2_version == 3 ?
+ if ((ret = id3v2_check_write_tag(id3, s->pb, t, id3->version == 3 ?
ff_id3v2_3_tags : ff_id3v2_4_tags, enc)) > 0) {
- totlen += ret;
+ id3->len += ret;
continue;
}
/* unknown tag, write as TXXX frame */
- if ((ret = id3v2_put_ttag(s, t->key, t->value, MKBETAG('T', 'X', 'X', 'X'), enc)) < 0)
+ if ((ret = id3v2_put_ttag(id3, s->pb, t->key, t->value, MKBETAG('T', 'X', 'X', 'X'), enc)) < 0)
return ret;
- totlen += ret;
+ id3->len += ret;
+ }
+
+ return 0;
+}
+
+int ff_id3v2_write_apic(AVFormatContext *s, ID3v2EncContext *id3, AVPacket *pkt)
+{
+ AVStream *st = s->streams[pkt->stream_index];
+ AVDictionaryEntry *e;
+
+ AVIOContext *dyn_buf;
+ uint8_t *buf;
+ const CodecMime *mime = ff_id3v2_mime_tags;
+ const char *mimetype = NULL, *desc = "";
+ int enc = id3->version == 3 ? ID3v2_ENCODING_UTF16BOM :
+ ID3v2_ENCODING_UTF8;
+ int i, len, type = 0;
+
+ /* get the mimetype*/
+ while (mime->id != AV_CODEC_ID_NONE) {
+ if (mime->id == st->codec->codec_id) {
+ mimetype = mime->str;
+ break;
+ }
+ mime++;
+ }
+ if (!mimetype) {
+ av_log(s, AV_LOG_ERROR, "No mimetype is known for stream %d, cannot "
+ "write an attached picture.\n", st->index);
+ return AVERROR(EINVAL);
}
- cur_pos = avio_tell(s->pb);
- avio_seek(s->pb, size_pos, SEEK_SET);
- id3v2_put_size(s, totlen);
- avio_seek(s->pb, cur_pos, SEEK_SET);
+ /* get the picture type */
+ e = av_dict_get(st->metadata, "comment", NULL, 0);
+ for (i = 0; e && i < FF_ARRAY_ELEMS(ff_id3v2_picture_types); i++) {
+ if (strstr(ff_id3v2_picture_types[i], e->value) == ff_id3v2_picture_types[i]) {
+ type = i;
+ break;
+ }
+ }
+
+ /* get the description */
+ if ((e = av_dict_get(st->metadata, "title", NULL, 0)))
+ desc = e->value;
+
+ /* start writing */
+ if (avio_open_dyn_buf(&dyn_buf) < 0)
+ return AVERROR(ENOMEM);
+
+ avio_w8(dyn_buf, enc);
+ avio_put_str(dyn_buf, mimetype);
+ avio_w8(dyn_buf, type);
+ id3v2_encode_string(dyn_buf, desc, enc);
+ avio_write(dyn_buf, pkt->data, pkt->size);
+ len = avio_close_dyn_buf(dyn_buf, &buf);
+
+ avio_wb32(s->pb, MKBETAG('A', 'P', 'I', 'C'));
+ if (id3->version == 3)
+ avio_wb32(s->pb, len);
+ else
+ id3v2_put_size(s->pb, len);
+ avio_wb16(s->pb, 0);
+ avio_write(s->pb, buf, len);
+ av_freep(&buf);
+
+ id3->len += len + ID3v2_HEADER_SIZE;
+
+ return 0;
+}
+
+void ff_id3v2_finish(ID3v2EncContext *id3, AVIOContext *pb)
+{
+ int64_t cur_pos = avio_tell(pb);
+ avio_seek(pb, id3->size_pos, SEEK_SET);
+ id3v2_put_size(pb, id3->len);
+ avio_seek(pb, cur_pos, SEEK_SET);
+}
+
+int ff_id3v2_write_simple(struct AVFormatContext *s, int id3v2_version,
+ const char *magic)
+{
+ ID3v2EncContext id3 = { 0 };
+ int ret;
+
+ ff_id3v2_start(&id3, s->pb, id3v2_version, magic);
+ if ((ret = ff_id3v2_write_metadata(s, &id3)) < 0)
+ return ret;
+ ff_id3v2_finish(&id3, s->pb);
+
return 0;
}
diff --git a/gst-libs/ext/libav/libavformat/idcin.c b/gst-libs/ext/libav/libavformat/idcin.c
index b26f2aa..fde8666 100644
--- a/gst-libs/ext/libav/libavformat/idcin.c
+++ b/gst-libs/ext/libav/libavformat/idcin.c
@@ -138,8 +138,7 @@ static int idcin_probe(AVProbeData *p)
return AVPROBE_SCORE_MAX / 2;
}
-static int idcin_read_header(AVFormatContext *s,
- AVFormatParameters *ap)
+static int idcin_read_header(AVFormatContext *s)
{
AVIOContext *pb = s->pb;
IdcinDemuxContext *idcin = s->priv_data;
@@ -160,7 +159,7 @@ static int idcin_read_header(AVFormatContext *s,
avpriv_set_pts_info(st, 33, 1, IDCIN_FPS);
idcin->video_stream_index = st->index;
st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
- st->codec->codec_id = CODEC_ID_IDCIN;
+ st->codec->codec_id = AV_CODEC_ID_IDCIN;
st->codec->codec_tag = 0; /* no fourcc */
st->codec->width = width;
st->codec->height = height;
@@ -188,9 +187,9 @@ static int idcin_read_header(AVFormatContext *s,
st->codec->bit_rate = sample_rate * bytes_per_sample * 8 * channels;
st->codec->block_align = bytes_per_sample * channels;
if (bytes_per_sample == 1)
- st->codec->codec_id = CODEC_ID_PCM_U8;
+ st->codec->codec_id = AV_CODEC_ID_PCM_U8;
else
- st->codec->codec_id = CODEC_ID_PCM_S16LE;
+ st->codec->codec_id = AV_CODEC_ID_PCM_S16LE;
if (sample_rate % 14 != 0) {
idcin->audio_chunk_size1 = (sample_rate / 14) *
@@ -294,7 +293,7 @@ static int idcin_read_packet(AVFormatContext *s,
AVInputFormat ff_idcin_demuxer = {
.name = "idcin",
- .long_name = NULL_IF_CONFIG_SMALL("id Cinematic format"),
+ .long_name = NULL_IF_CONFIG_SMALL("id Cinematic"),
.priv_data_size = sizeof(IdcinDemuxContext),
.read_probe = idcin_probe,
.read_header = idcin_read_header,
diff --git a/gst-libs/ext/libav/libavformat/idroqdec.c b/gst-libs/ext/libav/libavformat/idroqdec.c
index d63c395..eeaafec 100644
--- a/gst-libs/ext/libav/libavformat/idroqdec.c
+++ b/gst-libs/ext/libav/libavformat/idroqdec.c
@@ -27,6 +27,7 @@
* http://www.csse.monash.edu.au/~timf/
*/
+#include "libavutil/channel_layout.h"
#include "libavutil/intreadwrite.h"
#include "avformat.h"
#include "internal.h"
@@ -66,8 +67,7 @@ static int roq_probe(AVProbeData *p)
return AVPROBE_SCORE_MAX;
}
-static int roq_read_header(AVFormatContext *s,
- AVFormatParameters *ap)
+static int roq_read_header(AVFormatContext *s)
{
RoqDemuxContext *roq = s->priv_data;
AVIOContext *pb = s->pb;
@@ -128,7 +128,7 @@ static int roq_read_packet(AVFormatContext *s,
avpriv_set_pts_info(st, 63, 1, roq->frame_rate);
roq->video_stream_index = st->index;
st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
- st->codec->codec_id = CODEC_ID_ROQ;
+ st->codec->codec_id = AV_CODEC_ID_ROQ;
st->codec->codec_tag = 0; /* no fourcc */
if (avio_read(pb, preamble, RoQ_CHUNK_PREAMBLE_SIZE) != RoQ_CHUNK_PREAMBLE_SIZE)
@@ -174,9 +174,16 @@ static int roq_read_packet(AVFormatContext *s,
avpriv_set_pts_info(st, 32, 1, RoQ_AUDIO_SAMPLE_RATE);
roq->audio_stream_index = st->index;
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
- st->codec->codec_id = CODEC_ID_ROQ_DPCM;
+ st->codec->codec_id = AV_CODEC_ID_ROQ_DPCM;
st->codec->codec_tag = 0; /* no tag */
- st->codec->channels = roq->audio_channels = chunk_type == RoQ_SOUND_STEREO ? 2 : 1;
+ if (chunk_type == RoQ_SOUND_STEREO) {
+ st->codec->channels = 2;
+ st->codec->channel_layout = AV_CH_LAYOUT_STEREO;
+ } else {
+ st->codec->channels = 1;
+ st->codec->channel_layout = AV_CH_LAYOUT_MONO;
+ }
+ roq->audio_channels = st->codec->channels;
st->codec->sample_rate = RoQ_AUDIO_SAMPLE_RATE;
st->codec->bits_per_coded_sample = 16;
st->codec->bit_rate = st->codec->channels * st->codec->sample_rate *
@@ -218,8 +225,8 @@ static int roq_read_packet(AVFormatContext *s,
}
AVInputFormat ff_roq_demuxer = {
- .name = "RoQ",
- .long_name = NULL_IF_CONFIG_SMALL("id RoQ format"),
+ .name = "roq",
+ .long_name = NULL_IF_CONFIG_SMALL("id RoQ"),
.priv_data_size = sizeof(RoqDemuxContext),
.read_probe = roq_probe,
.read_header = roq_read_header,
diff --git a/gst-libs/ext/libav/libavformat/idroqenc.c b/gst-libs/ext/libav/libavformat/idroqenc.c
index 266a731..2ce4d7d 100644
--- a/gst-libs/ext/libav/libavformat/idroqenc.c
+++ b/gst-libs/ext/libav/libavformat/idroqenc.c
@@ -36,11 +36,11 @@ static int roq_write_header(struct AVFormatContext *s)
}
AVOutputFormat ff_roq_muxer = {
- .name = "RoQ",
- .long_name = NULL_IF_CONFIG_SMALL("raw id RoQ format"),
+ .name = "roq",
+ .long_name = NULL_IF_CONFIG_SMALL("raw id RoQ"),
.extensions = "roq",
- .audio_codec = CODEC_ID_ROQ_DPCM,
- .video_codec = CODEC_ID_ROQ,
+ .audio_codec = AV_CODEC_ID_ROQ_DPCM,
+ .video_codec = AV_CODEC_ID_ROQ,
.write_header = roq_write_header,
.write_packet = ff_raw_write_packet,
};
diff --git a/gst-libs/ext/libav/libavformat/iff.c b/gst-libs/ext/libav/libavformat/iff.c
index 4552985..79f5f16 100644
--- a/gst-libs/ext/libav/libavformat/iff.c
+++ b/gst-libs/ext/libav/libavformat/iff.c
@@ -29,6 +29,7 @@
* http://wiki.multimedia.cx/index.php?title=IFF
*/
+#include "libavutil/channel_layout.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/dict.h"
#include "avformat.h"
@@ -107,8 +108,7 @@ static int iff_probe(AVProbeData *p)
return 0;
}
-static int iff_read_header(AVFormatContext *s,
- AVFormatParameters *ap)
+static int iff_read_header(AVFormatContext *s)
{
IffDemuxContext *iff = s->priv_data;
AVIOContext *pb = s->pb;
@@ -121,6 +121,7 @@ static int iff_read_header(AVFormatContext *s,
return AVERROR(ENOMEM);
st->codec->channels = 1;
+ st->codec->channel_layout = AV_CH_LAYOUT_MONO;
avio_skip(pb, 8);
// codec_tag used by ByteRun1 decoder to distinguish progressive (PBM) and interlaced (ILBM) content
st->codec->codec_tag = avio_rl32(pb);
@@ -155,7 +156,13 @@ static int iff_read_header(AVFormatContext *s,
case ID_CHAN:
if (data_size < 4)
return AVERROR_INVALIDDATA;
- st->codec->channels = (avio_rb32(pb) < 6) ? 1 : 2;
+ if (avio_rb32(pb) < 6) {
+ st->codec->channels = 1;
+ st->codec->channel_layout = AV_CH_LAYOUT_MONO;
+ } else {
+ st->codec->channels = 2;
+ st->codec->channel_layout = AV_CH_LAYOUT_STEREO;
+ }
break;
case ID_CMAP:
@@ -226,13 +233,13 @@ static int iff_read_header(AVFormatContext *s,
switch(compression) {
case COMP_NONE:
- st->codec->codec_id = CODEC_ID_PCM_S8_PLANAR;
+ st->codec->codec_id = AV_CODEC_ID_PCM_S8_PLANAR;
break;
case COMP_FIB:
- st->codec->codec_id = CODEC_ID_8SVX_FIB;
+ st->codec->codec_id = AV_CODEC_ID_8SVX_FIB;
break;
case COMP_EXP:
- st->codec->codec_id = CODEC_ID_8SVX_EXP;
+ st->codec->codec_id = AV_CODEC_ID_8SVX_EXP;
break;
default:
av_log(s, AV_LOG_ERROR, "unknown compression method\n");
@@ -247,10 +254,10 @@ static int iff_read_header(AVFormatContext *s,
case AVMEDIA_TYPE_VIDEO:
switch (compression) {
case BITMAP_RAW:
- st->codec->codec_id = CODEC_ID_IFF_ILBM;
+ st->codec->codec_id = AV_CODEC_ID_IFF_ILBM;
break;
case BITMAP_BYTERUN1:
- st->codec->codec_id = CODEC_ID_IFF_BYTERUN1;
+ st->codec->codec_id = AV_CODEC_ID_IFF_BYTERUN1;
break;
default:
av_log(s, AV_LOG_ERROR, "unknown compression method\n");
@@ -287,8 +294,8 @@ static int iff_read_packet(AVFormatContext *s,
}
AVInputFormat ff_iff_demuxer = {
- .name = "IFF",
- .long_name = NULL_IF_CONFIG_SMALL("IFF format"),
+ .name = "iff",
+ .long_name = NULL_IF_CONFIG_SMALL("IFF (Interchange File Format)"),
.priv_data_size = sizeof(IffDemuxContext),
.read_probe = iff_probe,
.read_header = iff_read_header,
diff --git a/gst-libs/ext/libav/libavformat/ilbc.c b/gst-libs/ext/libav/libavformat/ilbc.c
new file mode 100644
index 0000000..c01eb6f
--- /dev/null
+++ b/gst-libs/ext/libav/libavformat/ilbc.c
@@ -0,0 +1,141 @@
+/*
+ * iLBC storage file format
+ * Copyright (c) 2012 Martin Storsjo
+ *
+ * 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
+ */
+
+#include "avformat.h"
+#include "internal.h"
+
+static const char mode20_header[] = "#!iLBC20\n";
+static const char mode30_header[] = "#!iLBC30\n";
+
+static int ilbc_write_header(AVFormatContext *s)
+{
+ AVIOContext *pb = s->pb;
+ AVCodecContext *enc;
+
+ if (s->nb_streams != 1) {
+ av_log(s, AV_LOG_ERROR, "Unsupported number of streams\n");
+ return AVERROR(EINVAL);
+ }
+ enc = s->streams[0]->codec;
+
+ if (enc->codec_id != AV_CODEC_ID_ILBC) {
+ av_log(s, AV_LOG_ERROR, "Unsupported codec\n");
+ return AVERROR(EINVAL);
+ }
+
+ if (enc->block_align == 50) {
+ avio_write(pb, mode30_header, sizeof(mode30_header) - 1);
+ } else if (enc->block_align == 38) {
+ avio_write(pb, mode20_header, sizeof(mode20_header) - 1);
+ } else {
+ av_log(s, AV_LOG_ERROR, "Unsupported mode\n");
+ return AVERROR(EINVAL);
+ }
+ avio_flush(pb);
+ return 0;
+}
+
+static int ilbc_write_packet(AVFormatContext *s, AVPacket *pkt)
+{
+ avio_write(s->pb, pkt->data, pkt->size);
+ avio_flush(s->pb);
+ return 0;
+}
+
+static int ilbc_probe(AVProbeData *p)
+{
+ // Only check for "#!iLBC" which matches both formats
+ if (!memcmp(p->buf, mode20_header, 6))
+ return AVPROBE_SCORE_MAX;
+ else
+ return 0;
+}
+
+static int ilbc_read_header(AVFormatContext *s)
+{
+ AVIOContext *pb = s->pb;
+ AVStream *st;
+ uint8_t header[9];
+
+ avio_read(pb, header, 9);
+
+ st = avformat_new_stream(s, NULL);
+ if (!st)
+ return AVERROR(ENOMEM);
+ st->codec->codec_id = AV_CODEC_ID_ILBC;
+ st->codec->sample_rate = 8000;
+ st->codec->channels = 1;
+ st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
+ st->start_time = 0;
+ avpriv_set_pts_info(st, 64, 1, st->codec->sample_rate);
+ if (!memcmp(header, mode20_header, sizeof(mode20_header) - 1)) {
+ st->codec->block_align = 38;
+ st->codec->bit_rate = 15200;
+ } else if (!memcmp(header, mode30_header, sizeof(mode30_header) - 1)) {
+ st->codec->block_align = 50;
+ st->codec->bit_rate = 13333;
+ } else {
+ av_log(s, AV_LOG_ERROR, "Unrecognized iLBC file header\n");
+ return AVERROR_INVALIDDATA;
+ }
+
+ return 0;
+}
+
+static int ilbc_read_packet(AVFormatContext *s,
+ AVPacket *pkt)
+{
+ AVCodecContext *enc = s->streams[0]->codec;
+ int ret;
+
+ if ((ret = av_new_packet(pkt, enc->block_align)) < 0)
+ return ret;
+
+ pkt->stream_index = 0;
+ pkt->pos = avio_tell(s->pb);
+ pkt->duration = enc->block_align == 38 ? 160 : 240;
+ if ((ret = avio_read(s->pb, pkt->data, enc->block_align)) != enc->block_align) {
+ av_free_packet(pkt);
+ return ret < 0 ? ret : AVERROR(EIO);
+ }
+
+ return 0;
+}
+
+AVInputFormat ff_ilbc_demuxer = {
+ .name = "ilbc",
+ .long_name = NULL_IF_CONFIG_SMALL("iLBC storage"),
+ .read_probe = ilbc_probe,
+ .read_header = ilbc_read_header,
+ .read_packet = ilbc_read_packet,
+ .flags = AVFMT_GENERIC_INDEX,
+};
+
+AVOutputFormat ff_ilbc_muxer = {
+ .name = "ilbc",
+ .long_name = NULL_IF_CONFIG_SMALL("iLBC storage"),
+ .mime_type = "audio/iLBC",
+ .extensions = "lbc",
+ .audio_codec = AV_CODEC_ID_ILBC,
+ .write_header = ilbc_write_header,
+ .write_packet = ilbc_write_packet,
+ .flags = AVFMT_NOTIMESTAMPS,
+};
diff --git a/gst-libs/ext/libav/libavformat/img2.c b/gst-libs/ext/libav/libavformat/img2.c
index 2af561c..6ee8f81 100644
--- a/gst-libs/ext/libav/libavformat/img2.c
+++ b/gst-libs/ext/libav/libavformat/img2.c
@@ -20,103 +20,60 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "libavutil/intreadwrite.h"
#include "libavutil/avstring.h"
-#include "libavutil/log.h"
-#include "libavutil/opt.h"
-#include "libavutil/pixdesc.h"
-#include "libavutil/parseutils.h"
-#include "avformat.h"
-#include "avio_internal.h"
#include "internal.h"
typedef struct {
- const AVClass *class; /**< Class for private options. */
- int img_first;
- int img_last;
- int img_number;
- int img_count;
- int is_pipe;
- char path[1024];
- char *pixel_format; /**< Set by a private option. */
- char *video_size; /**< Set by a private option. */
- char *framerate; /**< Set by a private option. */
- int loop;
-} VideoData;
-
-typedef struct {
- enum CodecID id;
+ enum AVCodecID id;
const char *str;
} IdStrMap;
static const IdStrMap img_tags[] = {
- { CODEC_ID_MJPEG , "jpeg"},
- { CODEC_ID_MJPEG , "jpg"},
- { CODEC_ID_LJPEG , "ljpg"},
- { CODEC_ID_PNG , "png"},
- { CODEC_ID_PNG , "mng"},
- { CODEC_ID_PPM , "ppm"},
- { CODEC_ID_PPM , "pnm"},
- { CODEC_ID_PGM , "pgm"},
- { CODEC_ID_PGMYUV , "pgmyuv"},
- { CODEC_ID_PBM , "pbm"},
- { CODEC_ID_PAM , "pam"},
- { CODEC_ID_MPEG1VIDEO, "mpg1-img"},
- { CODEC_ID_MPEG2VIDEO, "mpg2-img"},
- { CODEC_ID_MPEG4 , "mpg4-img"},
- { CODEC_ID_FFV1 , "ffv1-img"},
- { CODEC_ID_RAWVIDEO , "y"},
- { CODEC_ID_BMP , "bmp"},
- { CODEC_ID_GIF , "gif"},
- { CODEC_ID_TARGA , "tga"},
- { CODEC_ID_TIFF , "tiff"},
- { CODEC_ID_TIFF , "tif"},
- { CODEC_ID_SGI , "sgi"},
- { CODEC_ID_PTX , "ptx"},
- { CODEC_ID_PCX , "pcx"},
- { CODEC_ID_SUNRAST , "sun"},
- { CODEC_ID_SUNRAST , "ras"},
- { CODEC_ID_SUNRAST , "rs"},
- { CODEC_ID_SUNRAST , "im1"},
- { CODEC_ID_SUNRAST , "im8"},
- { CODEC_ID_SUNRAST , "im24"},
- { CODEC_ID_SUNRAST , "sunras"},
- { CODEC_ID_JPEG2000 , "jp2"},
- { CODEC_ID_JPEG2000 , "jpc"},
- { CODEC_ID_DPX , "dpx"},
- { CODEC_ID_PICTOR , "pic"},
- { CODEC_ID_NONE , NULL}
-};
-
-static const int sizes[][2] = {
- { 640, 480 },
- { 720, 480 },
- { 720, 576 },
- { 352, 288 },
- { 352, 240 },
- { 160, 128 },
- { 512, 384 },
- { 640, 352 },
- { 640, 240 },
+ { AV_CODEC_ID_MJPEG, "jpeg" },
+ { AV_CODEC_ID_MJPEG, "jpg" },
+ { AV_CODEC_ID_LJPEG, "ljpg" },
+ { AV_CODEC_ID_PNG, "png" },
+ { AV_CODEC_ID_PNG, "mng" },
+ { AV_CODEC_ID_PPM, "ppm" },
+ { AV_CODEC_ID_PPM, "pnm" },
+ { AV_CODEC_ID_PGM, "pgm" },
+ { AV_CODEC_ID_PGMYUV, "pgmyuv" },
+ { AV_CODEC_ID_PBM, "pbm" },
+ { AV_CODEC_ID_PAM, "pam" },
+ { AV_CODEC_ID_MPEG1VIDEO, "mpg1-img" },
+ { AV_CODEC_ID_MPEG2VIDEO, "mpg2-img" },
+ { AV_CODEC_ID_MPEG4, "mpg4-img" },
+ { AV_CODEC_ID_FFV1, "ffv1-img" },
+ { AV_CODEC_ID_RAWVIDEO, "y" },
+ { AV_CODEC_ID_BMP, "bmp" },
+ { AV_CODEC_ID_GIF, "gif" },
+ { AV_CODEC_ID_TARGA, "tga" },
+ { AV_CODEC_ID_TIFF, "tiff" },
+ { AV_CODEC_ID_TIFF, "tif" },
+ { AV_CODEC_ID_SGI, "sgi" },
+ { AV_CODEC_ID_PTX, "ptx" },
+ { AV_CODEC_ID_PCX, "pcx" },
+ { AV_CODEC_ID_SUNRAST, "sun" },
+ { AV_CODEC_ID_SUNRAST, "ras" },
+ { AV_CODEC_ID_SUNRAST, "rs" },
+ { AV_CODEC_ID_SUNRAST, "im1" },
+ { AV_CODEC_ID_SUNRAST, "im8" },
+ { AV_CODEC_ID_SUNRAST, "im24" },
+ { AV_CODEC_ID_SUNRAST, "sunras" },
+ { AV_CODEC_ID_JPEG2000, "jp2" },
+ { AV_CODEC_ID_JPEG2000, "jpc" },
+ { AV_CODEC_ID_DPX, "dpx" },
+ { AV_CODEC_ID_PICTOR, "pic" },
+ { AV_CODEC_ID_XBM, "xbm" },
+ { AV_CODEC_ID_XWD, "xwd" },
+ { AV_CODEC_ID_NONE, NULL }
};
-static int infer_size(int *width_ptr, int *height_ptr, int size)
+static enum AVCodecID av_str2id(const IdStrMap *tags, const char *str)
{
- int i;
-
- for(i=0;i<FF_ARRAY_ELEMS(sizes);i++) {
- if ((sizes[i][0] * sizes[i][1]) == size) {
- *width_ptr = sizes[i][0];
- *height_ptr = sizes[i][1];
- return 0;
- }
- }
- return -1;
-}
-static enum CodecID av_str2id(const IdStrMap *tags, const char *str)
-{
- str= strrchr(str, '.');
- if(!str) return CODEC_ID_NONE;
+ str = strrchr(str, '.');
+ if (!str)
+ return AV_CODEC_ID_NONE;
str++;
while (tags->id) {
@@ -125,398 +82,10 @@ static enum CodecID av_str2id(const IdStrMap *tags, const char *str)
tags++;
}
- return CODEC_ID_NONE;
-}
-
-/* return -1 if no image found */
-static int find_image_range(int *pfirst_index, int *plast_index,
- const char *path)
-{
- char buf[1024];
- int range, last_index, range1, first_index;
-
- /* find the first image */
- for(first_index = 0; first_index < 5; first_index++) {
- if (av_get_frame_filename(buf, sizeof(buf), path, first_index) < 0){
- *pfirst_index =
- *plast_index = 1;
- if (avio_check(buf, AVIO_FLAG_READ) > 0)
- return 0;
- return -1;
- }
- if (avio_check(buf, AVIO_FLAG_READ) > 0)
- break;
- }
- if (first_index == 5)
- goto fail;
-
- /* find the last image */
- last_index = first_index;
- for(;;) {
- range = 0;
- for(;;) {
- if (!range)
- range1 = 1;
- else
- range1 = 2 * range;
- if (av_get_frame_filename(buf, sizeof(buf), path,
- last_index + range1) < 0)
- goto fail;
- if (avio_check(buf, AVIO_FLAG_READ) <= 0)
- break;
- range = range1;
- /* just in case... */
- if (range >= (1 << 30))
- goto fail;
- }
- /* we are sure than image last_index + range exists */
- if (!range)
- break;
- last_index += range;
- }
- *pfirst_index = first_index;
- *plast_index = last_index;
- return 0;
- fail:
- return -1;
+ return AV_CODEC_ID_NONE;
}
-
-static int read_probe(AVProbeData *p)
-{
- if (p->filename && av_str2id(img_tags, p->filename)) {
- if (av_filename_number_test(p->filename))
- return AVPROBE_SCORE_MAX;
- else
- return AVPROBE_SCORE_MAX/2;
- }
- return 0;
-}
-
-enum CodecID ff_guess_image2_codec(const char *filename)
+enum AVCodecID ff_guess_image2_codec(const char *filename)
{
return av_str2id(img_tags, filename);
}
-
-#if FF_API_GUESS_IMG2_CODEC
-enum CodecID av_guess_image2_codec(const char *filename){
- return av_str2id(img_tags, filename);
-}
-#endif
-
-static int read_header(AVFormatContext *s1, AVFormatParameters *ap)
-{
- VideoData *s = s1->priv_data;
- int first_index, last_index, ret = 0;
- int width = 0, height = 0;
- AVStream *st;
- enum PixelFormat pix_fmt = PIX_FMT_NONE;
- AVRational framerate;
-
- s1->ctx_flags |= AVFMTCTX_NOHEADER;
-
- st = avformat_new_stream(s1, NULL);
- if (!st) {
- return AVERROR(ENOMEM);
- }
-
- if (s->pixel_format && (pix_fmt = av_get_pix_fmt(s->pixel_format)) == PIX_FMT_NONE) {
- av_log(s1, AV_LOG_ERROR, "No such pixel format: %s.\n", s->pixel_format);
- return AVERROR(EINVAL);
- }
- if (s->video_size && (ret = av_parse_video_size(&width, &height, s->video_size)) < 0) {
- av_log(s, AV_LOG_ERROR, "Could not parse video size: %s.\n", s->video_size);
- return ret;
- }
- if ((ret = av_parse_video_rate(&framerate, s->framerate)) < 0) {
- av_log(s, AV_LOG_ERROR, "Could not parse framerate: %s.\n", s->framerate);
- return ret;
- }
-
-#if FF_API_LOOP_INPUT
- if (s1->loop_input)
- s->loop = s1->loop_input;
-#endif
-
- av_strlcpy(s->path, s1->filename, sizeof(s->path));
- s->img_number = 0;
- s->img_count = 0;
-
- /* find format */
- if (s1->iformat->flags & AVFMT_NOFILE)
- s->is_pipe = 0;
- else{
- s->is_pipe = 1;
- st->need_parsing = AVSTREAM_PARSE_FULL;
- }
-
- avpriv_set_pts_info(st, 60, framerate.den, framerate.num);
-
- if (width && height) {
- st->codec->width = width;
- st->codec->height = height;
- }
-
- if (!s->is_pipe) {
- if (find_image_range(&first_index, &last_index, s->path) < 0)
- return AVERROR(ENOENT);
- s->img_first = first_index;
- s->img_last = last_index;
- s->img_number = first_index;
- /* compute duration */
- st->start_time = 0;
- st->duration = last_index - first_index + 1;
- }
-
- if(s1->video_codec_id){
- st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
- st->codec->codec_id = s1->video_codec_id;
- }else if(s1->audio_codec_id){
- st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
- st->codec->codec_id = s1->audio_codec_id;
- }else{
- st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
- st->codec->codec_id = av_str2id(img_tags, s->path);
- }
- if(st->codec->codec_type == AVMEDIA_TYPE_VIDEO && pix_fmt != PIX_FMT_NONE)
- st->codec->pix_fmt = pix_fmt;
-
- return 0;
-}
-
-static int read_packet(AVFormatContext *s1, AVPacket *pkt)
-{
- VideoData *s = s1->priv_data;
- char filename[1024];
- int i;
- int size[3]={0}, ret[3]={0};
- AVIOContext *f[3];
- AVCodecContext *codec= s1->streams[0]->codec;
-
- if (!s->is_pipe) {
- /* loop over input */
- if (s->loop && s->img_number > s->img_last) {
- s->img_number = s->img_first;
- }
- if (s->img_number > s->img_last)
- return AVERROR_EOF;
- if (av_get_frame_filename(filename, sizeof(filename),
- s->path, s->img_number)<0 && s->img_number > 1)
- return AVERROR(EIO);
- for(i=0; i<3; i++){
- if (avio_open2(&f[i], filename, AVIO_FLAG_READ,
- &s1->interrupt_callback, NULL) < 0) {
- if(i==1)
- break;
- av_log(s1, AV_LOG_ERROR, "Could not open file : %s\n",filename);
- return AVERROR(EIO);
- }
- size[i]= avio_size(f[i]);
-
- if(codec->codec_id != CODEC_ID_RAWVIDEO)
- break;
- filename[ strlen(filename) - 1 ]= 'U' + i;
- }
-
- if(codec->codec_id == CODEC_ID_RAWVIDEO && !codec->width)
- infer_size(&codec->width, &codec->height, size[0]);
- } else {
- f[0] = s1->pb;
- if (f[0]->eof_reached)
- return AVERROR(EIO);
- size[0]= 4096;
- }
-
- av_new_packet(pkt, size[0] + size[1] + size[2]);
- pkt->stream_index = 0;
- pkt->flags |= AV_PKT_FLAG_KEY;
-
- pkt->size= 0;
- for(i=0; i<3; i++){
- if(size[i]){
- ret[i]= avio_read(f[i], pkt->data + pkt->size, size[i]);
- if (!s->is_pipe)
- avio_close(f[i]);
- if(ret[i]>0)
- pkt->size += ret[i];
- }
- }
-
- if (ret[0] <= 0 || ret[1]<0 || ret[2]<0) {
- av_free_packet(pkt);
- return AVERROR(EIO); /* signal EOF */
- } else {
- s->img_count++;
- s->img_number++;
- return 0;
- }
-}
-
-#if CONFIG_IMAGE2_MUXER || CONFIG_IMAGE2PIPE_MUXER
-/******************************************************/
-/* image output */
-
-static int write_header(AVFormatContext *s)
-{
- VideoData *img = s->priv_data;
-
- img->img_number = 1;
- av_strlcpy(img->path, s->filename, sizeof(img->path));
-
- /* find format */
- if (s->oformat->flags & AVFMT_NOFILE)
- img->is_pipe = 0;
- else
- img->is_pipe = 1;
-
- return 0;
-}
-
-static int write_packet(AVFormatContext *s, AVPacket *pkt)
-{
- VideoData *img = s->priv_data;
- AVIOContext *pb[3];
- char filename[1024];
- AVCodecContext *codec= s->streams[ pkt->stream_index ]->codec;
- int i;
-
- if (!img->is_pipe) {
- if (av_get_frame_filename(filename, sizeof(filename),
- img->path, img->img_number) < 0 && img->img_number>1) {
- av_log(s, AV_LOG_ERROR,
- "Could not get frame filename number %d from pattern '%s'\n",
- img->img_number, img->path);
- return AVERROR(EIO);
- }
- for(i=0; i<3; i++){
- if (avio_open2(&pb[i], filename, AVIO_FLAG_WRITE,
- &s->interrupt_callback, NULL) < 0) {
- av_log(s, AV_LOG_ERROR, "Could not open file : %s\n",filename);
- return AVERROR(EIO);
- }
-
- if(codec->codec_id != CODEC_ID_RAWVIDEO)
- break;
- filename[ strlen(filename) - 1 ]= 'U' + i;
- }
- } else {
- pb[0] = s->pb;
- }
-
- if(codec->codec_id == CODEC_ID_RAWVIDEO){
- int ysize = codec->width * codec->height;
- avio_write(pb[0], pkt->data , ysize);
- avio_write(pb[1], pkt->data + ysize, (pkt->size - ysize)/2);
- avio_write(pb[2], pkt->data + ysize +(pkt->size - ysize)/2, (pkt->size - ysize)/2);
- avio_flush(pb[1]);
- avio_flush(pb[2]);
- avio_close(pb[1]);
- avio_close(pb[2]);
- }else{
- if(av_str2id(img_tags, s->filename) == CODEC_ID_JPEG2000){
- AVStream *st = s->streams[0];
- if(st->codec->extradata_size > 8 &&
- AV_RL32(st->codec->extradata+4) == MKTAG('j','p','2','h')){
- if(pkt->size < 8 || AV_RL32(pkt->data+4) != MKTAG('j','p','2','c'))
- goto error;
- avio_wb32(pb[0], 12);
- ffio_wfourcc(pb[0], "jP ");
- avio_wb32(pb[0], 0x0D0A870A); // signature
- avio_wb32(pb[0], 20);
- ffio_wfourcc(pb[0], "ftyp");
- ffio_wfourcc(pb[0], "jp2 ");
- avio_wb32(pb[0], 0);
- ffio_wfourcc(pb[0], "jp2 ");
- avio_write(pb[0], st->codec->extradata, st->codec->extradata_size);
- }else if(pkt->size < 8 ||
- (!st->codec->extradata_size &&
- AV_RL32(pkt->data+4) != MKTAG('j','P',' ',' '))){ // signature
- error:
- av_log(s, AV_LOG_ERROR, "malformed JPEG 2000 codestream\n");
- return -1;
- }
- }
- avio_write(pb[0], pkt->data, pkt->size);
- }
- avio_flush(pb[0]);
- if (!img->is_pipe) {
- avio_close(pb[0]);
- }
-
- img->img_number++;
- return 0;
-}
-
-#endif /* CONFIG_IMAGE2_MUXER || CONFIG_IMAGE2PIPE_MUXER */
-
-#define OFFSET(x) offsetof(VideoData, x)
-#define DEC AV_OPT_FLAG_DECODING_PARAM
-static const AVOption options[] = {
- { "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 },
-};
-
-/* input */
-#if CONFIG_IMAGE2_DEMUXER
-static const AVClass img2_class = {
- .class_name = "image2 demuxer",
- .item_name = av_default_item_name,
- .option = options,
- .version = LIBAVUTIL_VERSION_INT,
-};
-AVInputFormat ff_image2_demuxer = {
- .name = "image2",
- .long_name = NULL_IF_CONFIG_SMALL("image2 sequence"),
- .priv_data_size = sizeof(VideoData),
- .read_probe = read_probe,
- .read_header = read_header,
- .read_packet = read_packet,
- .flags = AVFMT_NOFILE,
- .priv_class = &img2_class,
-};
-#endif
-#if CONFIG_IMAGE2PIPE_DEMUXER
-static const AVClass img2pipe_class = {
- .class_name = "image2pipe demuxer",
- .item_name = av_default_item_name,
- .option = options,
- .version = LIBAVUTIL_VERSION_INT,
-};
-AVInputFormat ff_image2pipe_demuxer = {
- .name = "image2pipe",
- .long_name = NULL_IF_CONFIG_SMALL("piped image2 sequence"),
- .priv_data_size = sizeof(VideoData),
- .read_header = read_header,
- .read_packet = read_packet,
- .priv_class = &img2pipe_class,
-};
-#endif
-
-/* output */
-#if CONFIG_IMAGE2_MUXER
-AVOutputFormat ff_image2_muxer = {
- .name = "image2",
- .long_name = NULL_IF_CONFIG_SMALL("image2 sequence"),
- .extensions = "bmp,dpx,jpeg,jpg,ljpg,pam,pbm,pcx,pgm,pgmyuv,png,"
- "ppm,sgi,tga,tif,tiff,jp2",
- .priv_data_size = sizeof(VideoData),
- .video_codec = CODEC_ID_MJPEG,
- .write_header = write_header,
- .write_packet = write_packet,
- .flags = AVFMT_NOTIMESTAMPS | AVFMT_NODIMENSIONS | AVFMT_NOFILE
-};
-#endif
-#if CONFIG_IMAGE2PIPE_MUXER
-AVOutputFormat ff_image2pipe_muxer = {
- .name = "image2pipe",
- .long_name = NULL_IF_CONFIG_SMALL("piped image2 sequence"),
- .priv_data_size = sizeof(VideoData),
- .video_codec = CODEC_ID_MJPEG,
- .write_header = write_header,
- .write_packet = write_packet,
- .flags = AVFMT_NOTIMESTAMPS | AVFMT_NODIMENSIONS
-};
-#endif
diff --git a/gst-libs/ext/libav/libavformat/img2dec.c b/gst-libs/ext/libav/libavformat/img2dec.c
new file mode 100644
index 0000000..1d437f5
--- /dev/null
+++ b/gst-libs/ext/libav/libavformat/img2dec.c
@@ -0,0 +1,334 @@
+/*
+ * Image format
+ * Copyright (c) 2000, 2001, 2002 Fabrice Bellard
+ * Copyright (c) 2004 Michael Niedermayer
+ *
+ * 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
+ */
+
+#include "libavutil/avstring.h"
+#include "libavutil/log.h"
+#include "libavutil/opt.h"
+#include "libavutil/pixdesc.h"
+#include "libavutil/parseutils.h"
+#include "avformat.h"
+#include "internal.h"
+
+typedef struct {
+ const AVClass *class; /**< Class for private options. */
+ int img_first;
+ int img_last;
+ int img_number;
+ int img_count;
+ int is_pipe;
+ char path[1024];
+ char *pixel_format; /**< Set by a private option. */
+ char *video_size; /**< Set by a private option. */
+ char *framerate; /**< Set by a private option. */
+ int loop;
+ int start_number;
+} VideoDemuxData;
+
+static const int sizes[][2] = {
+ { 640, 480 },
+ { 720, 480 },
+ { 720, 576 },
+ { 352, 288 },
+ { 352, 240 },
+ { 160, 128 },
+ { 512, 384 },
+ { 640, 352 },
+ { 640, 240 },
+};
+
+static int infer_size(int *width_ptr, int *height_ptr, int size)
+{
+ int i;
+
+ for (i = 0; i < FF_ARRAY_ELEMS(sizes); i++) {
+ if ((sizes[i][0] * sizes[i][1]) == size) {
+ *width_ptr = sizes[i][0];
+ *height_ptr = sizes[i][1];
+ return 0;
+ }
+ }
+
+ return -1;
+}
+
+/* return -1 if no image found */
+static int find_image_range(int *pfirst_index, int *plast_index,
+ const char *path, int max_start)
+{
+ char buf[1024];
+ int range, last_index, range1, first_index;
+
+ /* find the first image */
+ for (first_index = 0; first_index < max_start; first_index++) {
+ if (av_get_frame_filename(buf, sizeof(buf), path, first_index) < 0) {
+ *pfirst_index =
+ *plast_index = 1;
+ if (avio_check(buf, AVIO_FLAG_READ) > 0)
+ return 0;
+ return -1;
+ }
+ if (avio_check(buf, AVIO_FLAG_READ) > 0)
+ break;
+ }
+ if (first_index == 5)
+ goto fail;
+
+ /* find the last image */
+ last_index = first_index;
+ for (;;) {
+ range = 0;
+ for (;;) {
+ if (!range)
+ range1 = 1;
+ else
+ range1 = 2 * range;
+ if (av_get_frame_filename(buf, sizeof(buf), path,
+ last_index + range1) < 0)
+ goto fail;
+ if (avio_check(buf, AVIO_FLAG_READ) <= 0)
+ break;
+ range = range1;
+ /* just in case... */
+ if (range >= (1 << 30))
+ goto fail;
+ }
+ /* we are sure than image last_index + range exists */
+ if (!range)
+ break;
+ last_index += range;
+ }
+ *pfirst_index = first_index;
+ *plast_index = last_index;
+ return 0;
+
+fail:
+ return -1;
+}
+
+static int img_read_probe(AVProbeData *p)
+{
+ if (p->filename && ff_guess_image2_codec(p->filename)) {
+ if (av_filename_number_test(p->filename))
+ return AVPROBE_SCORE_MAX;
+ else
+ return AVPROBE_SCORE_MAX / 2;
+ }
+ return 0;
+}
+
+static int img_read_header(AVFormatContext *s1)
+{
+ VideoDemuxData *s = s1->priv_data;
+ int first_index, last_index, ret = 0;
+ int width = 0, height = 0;
+ AVStream *st;
+ enum AVPixelFormat pix_fmt = AV_PIX_FMT_NONE;
+ AVRational framerate;
+
+ s1->ctx_flags |= AVFMTCTX_NOHEADER;
+
+ st = avformat_new_stream(s1, NULL);
+ if (!st) {
+ return AVERROR(ENOMEM);
+ }
+
+ if (s->pixel_format &&
+ (pix_fmt = av_get_pix_fmt(s->pixel_format)) == AV_PIX_FMT_NONE) {
+ av_log(s1, AV_LOG_ERROR, "No such pixel format: %s.\n",
+ s->pixel_format);
+ return AVERROR(EINVAL);
+ }
+ if (s->video_size &&
+ (ret = av_parse_video_size(&width, &height, s->video_size)) < 0) {
+ av_log(s, AV_LOG_ERROR,
+ "Could not parse video size: %s.\n", s->video_size);
+ return ret;
+ }
+ if ((ret = av_parse_video_rate(&framerate, s->framerate)) < 0) {
+ av_log(s, AV_LOG_ERROR,
+ "Could not parse framerate: %s.\n", s->framerate);
+ return ret;
+ }
+
+ av_strlcpy(s->path, s1->filename, sizeof(s->path));
+ s->img_number = 0;
+ s->img_count = 0;
+
+ /* find format */
+ if (s1->iformat->flags & AVFMT_NOFILE)
+ s->is_pipe = 0;
+ else {
+ s->is_pipe = 1;
+ st->need_parsing = AVSTREAM_PARSE_FULL;
+ }
+
+ avpriv_set_pts_info(st, 60, framerate.den, framerate.num);
+
+ if (width && height) {
+ st->codec->width = width;
+ st->codec->height = height;
+ }
+
+ if (!s->is_pipe) {
+ if (find_image_range(&first_index, &last_index, s->path,
+ FFMAX(s->start_number, 5)) < 0)
+ return AVERROR(ENOENT);
+ s->img_first = first_index;
+ s->img_last = last_index;
+ s->img_number = first_index;
+ /* compute duration */
+ st->start_time = 0;
+ st->duration = last_index - first_index + 1;
+ }
+
+ if (s1->video_codec_id) {
+ st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
+ st->codec->codec_id = s1->video_codec_id;
+ } else if (s1->audio_codec_id) {
+ st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
+ st->codec->codec_id = s1->audio_codec_id;
+ } else {
+ st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
+ st->codec->codec_id = ff_guess_image2_codec(s->path);
+ }
+ if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO &&
+ pix_fmt != AV_PIX_FMT_NONE)
+ st->codec->pix_fmt = pix_fmt;
+
+ return 0;
+}
+
+static int img_read_packet(AVFormatContext *s1, AVPacket *pkt)
+{
+ VideoDemuxData *s = s1->priv_data;
+ char filename[1024];
+ int i;
+ int size[3] = { 0 }, ret[3] = { 0 };
+ AVIOContext *f[3] = { NULL };
+ AVCodecContext *codec = s1->streams[0]->codec;
+
+ if (!s->is_pipe) {
+ /* loop over input */
+ if (s->loop && s->img_number > s->img_last) {
+ s->img_number = s->img_first;
+ }
+ if (s->img_number > s->img_last)
+ return AVERROR_EOF;
+ if (av_get_frame_filename(filename, sizeof(filename),
+ s->path,
+ s->img_number) < 0 && s->img_number > 1)
+ return AVERROR(EIO);
+ for (i = 0; i < 3; i++) {
+ if (avio_open2(&f[i], filename, AVIO_FLAG_READ,
+ &s1->interrupt_callback, NULL) < 0) {
+ if (i >= 1)
+ break;
+ av_log(s1, AV_LOG_ERROR, "Could not open file : %s\n",
+ filename);
+ return AVERROR(EIO);
+ }
+ size[i] = avio_size(f[i]);
+
+ if (codec->codec_id != AV_CODEC_ID_RAWVIDEO)
+ break;
+ filename[strlen(filename) - 1] = 'U' + i;
+ }
+
+ if (codec->codec_id == AV_CODEC_ID_RAWVIDEO && !codec->width)
+ infer_size(&codec->width, &codec->height, size[0]);
+ } else {
+ f[0] = s1->pb;
+ if (f[0]->eof_reached)
+ return AVERROR(EIO);
+ size[0] = 4096;
+ }
+
+ av_new_packet(pkt, size[0] + size[1] + size[2]);
+ pkt->stream_index = 0;
+ pkt->flags |= AV_PKT_FLAG_KEY;
+
+ pkt->size = 0;
+ for (i = 0; i < 3; i++) {
+ if (f[i]) {
+ ret[i] = avio_read(f[i], pkt->data + pkt->size, size[i]);
+ if (!s->is_pipe)
+ avio_close(f[i]);
+ if (ret[i] > 0)
+ pkt->size += ret[i];
+ }
+ }
+
+ if (ret[0] <= 0 || ret[1] < 0 || ret[2] < 0) {
+ av_free_packet(pkt);
+ return AVERROR(EIO); /* signal EOF */
+ } else {
+ s->img_count++;
+ s->img_number++;
+ return 0;
+ }
+}
+
+#define OFFSET(x) offsetof(VideoDemuxData, x)
+#define DEC AV_OPT_FLAG_DECODING_PARAM
+static const AVOption options[] = {
+ { "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, { .i64 = 0 }, 0, 1, DEC },
+ { "start_number", "first number in the sequence", OFFSET(start_number), AV_OPT_TYPE_INT, { .i64 = 1 }, 1, INT_MAX, DEC },
+ { NULL },
+};
+
+#if CONFIG_IMAGE2_DEMUXER
+static const AVClass img2_class = {
+ .class_name = "image2 demuxer",
+ .item_name = av_default_item_name,
+ .option = options,
+ .version = LIBAVUTIL_VERSION_INT,
+};
+AVInputFormat ff_image2_demuxer = {
+ .name = "image2",
+ .long_name = NULL_IF_CONFIG_SMALL("image2 sequence"),
+ .priv_data_size = sizeof(VideoDemuxData),
+ .read_probe = img_read_probe,
+ .read_header = img_read_header,
+ .read_packet = img_read_packet,
+ .flags = AVFMT_NOFILE,
+ .priv_class = &img2_class,
+};
+#endif
+#if CONFIG_IMAGE2PIPE_DEMUXER
+static const AVClass img2pipe_class = {
+ .class_name = "image2pipe demuxer",
+ .item_name = av_default_item_name,
+ .option = options,
+ .version = LIBAVUTIL_VERSION_INT,
+};
+AVInputFormat ff_image2pipe_demuxer = {
+ .name = "image2pipe",
+ .long_name = NULL_IF_CONFIG_SMALL("piped image2 sequence"),
+ .priv_data_size = sizeof(VideoDemuxData),
+ .read_header = img_read_header,
+ .read_packet = img_read_packet,
+ .priv_class = &img2pipe_class,
+};
+#endif
diff --git a/gst-libs/ext/libav/libavformat/img2enc.c b/gst-libs/ext/libav/libavformat/img2enc.c
new file mode 100644
index 0000000..aed61d9
--- /dev/null
+++ b/gst-libs/ext/libav/libavformat/img2enc.c
@@ -0,0 +1,166 @@
+/*
+ * Image format
+ * Copyright (c) 2000, 2001, 2002 Fabrice Bellard
+ * Copyright (c) 2004 Michael Niedermayer
+ *
+ * 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
+ */
+
+#include "libavutil/intreadwrite.h"
+#include "libavutil/avstring.h"
+#include "libavutil/log.h"
+#include "avformat.h"
+#include "avio_internal.h"
+#include "internal.h"
+#include "libavutil/opt.h"
+
+typedef struct {
+ const AVClass *class; /**< Class for private options. */
+ int img_number;
+ int is_pipe;
+ char path[1024];
+} VideoMuxData;
+
+static int write_header(AVFormatContext *s)
+{
+ VideoMuxData *img = s->priv_data;
+
+ av_strlcpy(img->path, s->filename, sizeof(img->path));
+
+ /* find format */
+ if (s->oformat->flags & AVFMT_NOFILE)
+ img->is_pipe = 0;
+ else
+ img->is_pipe = 1;
+
+ return 0;
+}
+
+static int write_packet(AVFormatContext *s, AVPacket *pkt)
+{
+ VideoMuxData *img = s->priv_data;
+ AVIOContext *pb[3];
+ char filename[1024];
+ AVCodecContext *codec = s->streams[pkt->stream_index]->codec;
+ int i;
+
+ if (!img->is_pipe) {
+ if (av_get_frame_filename(filename, sizeof(filename),
+ img->path, img->img_number) < 0 && img->img_number > 1) {
+ av_log(s, AV_LOG_ERROR,
+ "Could not get frame filename number %d from pattern '%s'\n",
+ img->img_number, img->path);
+ return AVERROR(EIO);
+ }
+ for (i = 0; i < 3; i++) {
+ if (avio_open2(&pb[i], filename, AVIO_FLAG_WRITE,
+ &s->interrupt_callback, NULL) < 0) {
+ av_log(s, AV_LOG_ERROR, "Could not open file : %s\n", filename);
+ return AVERROR(EIO);
+ }
+
+ if (codec->codec_id != AV_CODEC_ID_RAWVIDEO)
+ break;
+ filename[strlen(filename) - 1] = 'U' + i;
+ }
+ } else {
+ pb[0] = s->pb;
+ }
+
+ if (codec->codec_id == AV_CODEC_ID_RAWVIDEO) {
+ int ysize = codec->width * codec->height;
+ avio_write(pb[0], pkt->data, ysize);
+ avio_write(pb[1], pkt->data + ysize, (pkt->size - ysize) / 2);
+ avio_write(pb[2], pkt->data + ysize + (pkt->size - ysize) / 2, (pkt->size - ysize) / 2);
+ avio_close(pb[1]);
+ avio_close(pb[2]);
+ } else {
+ if (ff_guess_image2_codec(s->filename) == AV_CODEC_ID_JPEG2000) {
+ AVStream *st = s->streams[0];
+ if (st->codec->extradata_size > 8 &&
+ AV_RL32(st->codec->extradata + 4) == MKTAG('j', 'p', '2', 'h')) {
+ if (pkt->size < 8 ||
+ AV_RL32(pkt->data + 4) != MKTAG('j', 'p', '2', 'c'))
+ goto error;
+ avio_wb32(pb[0], 12);
+ ffio_wfourcc(pb[0], "jP ");
+ avio_wb32(pb[0], 0x0D0A870A); // signature
+ avio_wb32(pb[0], 20);
+ ffio_wfourcc(pb[0], "ftyp");
+ ffio_wfourcc(pb[0], "jp2 ");
+ avio_wb32(pb[0], 0);
+ ffio_wfourcc(pb[0], "jp2 ");
+ avio_write(pb[0], st->codec->extradata, st->codec->extradata_size);
+ } else if (pkt->size < 8 ||
+ (!st->codec->extradata_size &&
+ AV_RL32(pkt->data + 4) != MKTAG('j', 'P', ' ', ' '))) { // signature
+error:
+ av_log(s, AV_LOG_ERROR, "malformed JPEG 2000 codestream\n");
+ return -1;
+ }
+ }
+ avio_write(pb[0], pkt->data, pkt->size);
+ }
+ avio_flush(pb[0]);
+ if (!img->is_pipe) {
+ avio_close(pb[0]);
+ }
+
+ img->img_number++;
+ return 0;
+}
+
+#define OFFSET(x) offsetof(VideoMuxData, x)
+#define ENC AV_OPT_FLAG_ENCODING_PARAM
+static const AVOption muxoptions[] = {
+ { "start_number", "first number in the sequence", OFFSET(img_number), AV_OPT_TYPE_INT, { .i64 = 1 }, 1, INT_MAX, ENC },
+ { NULL },
+};
+
+#if CONFIG_IMAGE2_MUXER
+static const AVClass img2mux_class = {
+ .class_name = "image2 muxer",
+ .item_name = av_default_item_name,
+ .option = muxoptions,
+ .version = LIBAVUTIL_VERSION_INT,
+};
+
+AVOutputFormat ff_image2_muxer = {
+ .name = "image2",
+ .long_name = NULL_IF_CONFIG_SMALL("image2 sequence"),
+ .extensions = "bmp,dpx,jpeg,jpg,ljpg,pam,pbm,pcx,pgm,pgmyuv,png,"
+ "ppm,sgi,tga,tif,tiff,jp2,xwd,sun,ras,rs,im1,im8,im24,"
+ "sunras,xbm",
+ .priv_data_size = sizeof(VideoMuxData),
+ .video_codec = AV_CODEC_ID_MJPEG,
+ .write_header = write_header,
+ .write_packet = write_packet,
+ .flags = AVFMT_NOTIMESTAMPS | AVFMT_NODIMENSIONS | AVFMT_NOFILE,
+ .priv_class = &img2mux_class,
+};
+#endif
+#if CONFIG_IMAGE2PIPE_MUXER
+AVOutputFormat ff_image2pipe_muxer = {
+ .name = "image2pipe",
+ .long_name = NULL_IF_CONFIG_SMALL("piped image2 sequence"),
+ .priv_data_size = sizeof(VideoMuxData),
+ .video_codec = AV_CODEC_ID_MJPEG,
+ .write_header = write_header,
+ .write_packet = write_packet,
+ .flags = AVFMT_NOTIMESTAMPS | AVFMT_NODIMENSIONS
+};
+#endif
diff --git a/gst-libs/ext/libav/libavformat/ingenientdec.c b/gst-libs/ext/libav/libavformat/ingenientdec.c
index 35ac649..42b29ef 100644
--- a/gst-libs/ext/libav/libavformat/ingenientdec.c
+++ b/gst-libs/ext/libav/libavformat/ingenientdec.c
@@ -66,8 +66,8 @@ AVInputFormat ff_ingenient_demuxer = {
.priv_data_size = sizeof(FFRawVideoDemuxerContext),
.read_header = ff_raw_video_read_header,
.read_packet = ingenient_read_packet,
- .flags= AVFMT_GENERIC_INDEX,
- .extensions = "cgi", // FIXME
- .value = CODEC_ID_MJPEG,
+ .flags = AVFMT_GENERIC_INDEX,
+ .extensions = "cgi", // FIXME
+ .raw_codec_id = AV_CODEC_ID_MJPEG,
.priv_class = &ingenient_demuxer_class,
};
diff --git a/gst-libs/ext/libav/libavformat/internal.h b/gst-libs/ext/libav/libavformat/internal.h
index 559e710..3ca2d8f 100644
--- a/gst-libs/ext/libav/libavformat/internal.h
+++ b/gst-libs/ext/libav/libavformat/internal.h
@@ -33,10 +33,15 @@
#endif
typedef struct AVCodecTag {
- enum CodecID id;
+ enum AVCodecID id;
unsigned int tag;
} AVCodecTag;
+typedef struct CodecMime{
+ char str[32];
+ enum AVCodecID id;
+} CodecMime;
+
void ff_dynarray_add(intptr_t **tab_ptr, int *nb_ptr, intptr_t elem);
#ifdef __GNUC__
@@ -54,7 +59,7 @@ do {\
} while(0)
#endif
-struct tm *brktimegm(time_t secs, struct tm *tm);
+struct tm *ff_brktimegm(time_t secs, struct tm *tm);
char *ff_data_to_hex(char *buf, const uint8_t *src, int size, int lowercase);
@@ -119,7 +124,8 @@ int ff_url_join(char *str, int size, const char *proto,
*
* @param buff the buffer to append the SDP fragment to
* @param size the size of the buff buffer
- * @param c the AVCodecContext of the media to describe
+ * @param st the AVStream of the media to describe
+ * @param idx the global stream index
* @param dest_addr the destination address of the media stream, may be NULL
* @param dest_type the destination address type, may be NULL
* @param port the destination port of the media stream, 0 if unknown
@@ -127,7 +133,7 @@ int ff_url_join(char *str, int size, const char *proto,
* @param fmt the AVFormatContext, which might contain options modifying
* the generated SDP
*/
-void ff_sdp_write_media(char *buff, int size, AVCodecContext *c,
+void ff_sdp_write_media(char *buff, int size, AVStream *st, int idx,
const char *dest_addr, const char *dest_type,
int port, int ttl, AVFormatContext *fmt);
@@ -246,7 +252,7 @@ void ff_reduce_index(AVFormatContext *s, int stream_index);
void ff_make_absolute_url(char *buf, int size, const char *base,
const char *rel);
-enum CodecID ff_guess_image2_codec(const char *filename);
+enum AVCodecID ff_guess_image2_codec(const char *filename);
/**
* Convert a date string in ISO8601 format to Unix timestamp.
@@ -287,14 +293,16 @@ int64_t ff_gen_search(AVFormatContext *s, int stream_index,
int64_t (*read_timestamp)(struct AVFormatContext *, int , int64_t *, int64_t ));
/**
- * Set the pts for a given stream. If the new values would be invalid
- * (<= 0), it leaves the AVStream unchanged.
+ * Set the time base and wrapping info for a given stream. This will be used
+ * to interpret the stream's timestamps. If the new time base is invalid
+ * (numerator or denominator are non-positive), it leaves the stream
+ * unchanged.
*
* @param s stream
* @param pts_wrap_bits number of bits effectively used by the pts
- * (used for wrap control, 33 is the value for MPEG)
- * @param pts_num numerator to convert to seconds (MPEG: 1)
- * @param pts_den denominator to convert to seconds (MPEG: 90000)
+ * (used for wrap control)
+ * @param pts_num time base numerator
+ * @param pts_den time base denominator
*/
void avpriv_set_pts_info(AVStream *s, int pts_wrap_bits,
unsigned int pts_num, unsigned int pts_den);
@@ -307,4 +315,64 @@ int ff_add_param_change(AVPacket *pkt, int32_t channels,
uint64_t channel_layout, int32_t sample_rate,
int32_t width, int32_t height);
+/**
+ * Set the timebase for each stream from the corresponding codec timebase and
+ * print it.
+ */
+int ff_framehash_write_header(AVFormatContext *s);
+
+/**
+ * Read a transport packet from a media file.
+ *
+ * @param s media file handle
+ * @param pkt is filled
+ * @return 0 if OK, AVERROR_xxx on error
+ */
+int ff_read_packet(AVFormatContext *s, AVPacket *pkt);
+
+/**
+ * Interleave a packet per dts in an output media file.
+ *
+ * Packets with pkt->destruct == av_destruct_packet will be freed inside this
+ * function, so they cannot be used after it. Note that calling av_free_packet()
+ * on them is still safe.
+ *
+ * @param s media file handle
+ * @param out the interleaved packet will be output here
+ * @param pkt the input packet
+ * @param flush 1 if no further packets are available as input and all
+ * remaining packets should be output
+ * @return 1 if a packet was output, 0 if no packet could be output,
+ * < 0 if an error occurred
+ */
+int ff_interleave_packet_per_dts(AVFormatContext *s, AVPacket *out,
+ AVPacket *pkt, int flush);
+
+/**
+ * Return the frame duration in seconds. Return 0 if not available.
+ */
+void ff_compute_frame_duration(int *pnum, int *pden, AVStream *st,
+ AVCodecParserContext *pc, AVPacket *pkt);
+
+int ff_get_audio_frame_size(AVCodecContext *enc, int size, int mux);
+
+unsigned int ff_codec_get_tag(const AVCodecTag *tags, enum AVCodecID id);
+
+enum AVCodecID ff_codec_get_id(const AVCodecTag *tags, unsigned int tag);
+
+/**
+ * Select a PCM codec based on the given parameters.
+ *
+ * @param bps bits-per-sample
+ * @param flt floating-point
+ * @param be big-endian
+ * @param sflags signed flags. each bit corresponds to one byte of bit depth.
+ * e.g. the 1st bit indicates if 8-bit should be signed or
+ * unsigned, the 2nd bit indicates if 16-bit should be signed or
+ * unsigned, etc... This is useful for formats such as WAVE where
+ * only 8-bit is unsigned and all other bit depths are signed.
+ * @return a PCM codec id or AV_CODEC_ID_NONE
+ */
+enum AVCodecID ff_get_pcm_codec_id(int bps, int flt, int be, int sflags);
+
#endif /* AVFORMAT_INTERNAL_H */
diff --git a/gst-libs/ext/libav/libavformat/ipmovie.c b/gst-libs/ext/libav/libavformat/ipmovie.c
index daa44b1..60ae939 100644
--- a/gst-libs/ext/libav/libavformat/ipmovie.c
+++ b/gst-libs/ext/libav/libavformat/ipmovie.c
@@ -32,6 +32,7 @@
* up and sending out the chunks.
*/
+#include "libavutil/channel_layout.h"
#include "libavutil/intreadwrite.h"
#include "avformat.h"
#include "internal.h"
@@ -94,7 +95,7 @@ typedef struct IPMVEContext {
unsigned int audio_bits;
unsigned int audio_channels;
unsigned int audio_sample_rate;
- enum CodecID audio_type;
+ enum AVCodecID audio_type;
unsigned int audio_frame_count;
int video_stream_index;
@@ -117,14 +118,14 @@ static int load_ipmovie_packet(IPMVEContext *s, AVIOContext *pb,
int chunk_type;
if (s->audio_chunk_offset) {
- if (s->audio_type == CODEC_ID_NONE) {
+ if (s->audio_type == AV_CODEC_ID_NONE) {
av_log(NULL, AV_LOG_ERROR, "Can not read audio packet before"
"audio codec is known\n");
return CHUNK_BAD;
}
/* adjust for PCM audio by skipping chunk header */
- if (s->audio_type != CODEC_ID_INTERPLAY_DPCM) {
+ if (s->audio_type != AV_CODEC_ID_INTERPLAY_DPCM) {
s->audio_chunk_offset += 6;
s->audio_chunk_size -= 6;
}
@@ -139,7 +140,7 @@ static int load_ipmovie_packet(IPMVEContext *s, AVIOContext *pb,
pkt->pts = s->audio_frame_count;
/* audio frame maintenance */
- if (s->audio_type != CODEC_ID_INTERPLAY_DPCM)
+ if (s->audio_type != AV_CODEC_ID_INTERPLAY_DPCM)
s->audio_frame_count +=
(s->audio_chunk_size / s->audio_channels / (s->audio_bits / 8));
else
@@ -356,15 +357,15 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb,
s->audio_bits = (((audio_flags >> 1) & 1) + 1) * 8;
/* bit 2 indicates compressed audio in version 1 opcode */
if ((opcode_version == 1) && (audio_flags & 0x4))
- s->audio_type = CODEC_ID_INTERPLAY_DPCM;
+ s->audio_type = AV_CODEC_ID_INTERPLAY_DPCM;
else if (s->audio_bits == 16)
- s->audio_type = CODEC_ID_PCM_S16LE;
+ s->audio_type = AV_CODEC_ID_PCM_S16LE;
else
- s->audio_type = CODEC_ID_PCM_U8;
+ s->audio_type = AV_CODEC_ID_PCM_U8;
av_dlog(NULL, "audio: %d bits, %d Hz, %s, %s format\n",
s->audio_bits, s->audio_sample_rate,
(s->audio_channels == 2) ? "stereo" : "mono",
- (s->audio_type == CODEC_ID_INTERPLAY_DPCM) ?
+ (s->audio_type == AV_CODEC_ID_INTERPLAY_DPCM) ?
"Interplay audio" : "PCM");
break;
@@ -535,8 +536,7 @@ static int ipmovie_probe(AVProbeData *p)
return 0;
}
-static int ipmovie_read_header(AVFormatContext *s,
- AVFormatParameters *ap)
+static int ipmovie_read_header(AVFormatContext *s)
{
IPMVEContext *ipmovie = s->priv_data;
AVIOContext *pb = s->pb;
@@ -574,7 +574,7 @@ static int ipmovie_read_header(AVFormatContext *s,
avio_seek(pb, -CHUNK_PREAMBLE_SIZE, SEEK_CUR);
if (chunk_type == CHUNK_VIDEO)
- ipmovie->audio_type = CODEC_ID_NONE; /* no audio */
+ ipmovie->audio_type = AV_CODEC_ID_NONE; /* no audio */
else if (process_ipmovie_chunk(ipmovie, pb, &pkt) != CHUNK_INIT_AUDIO)
return AVERROR_INVALIDDATA;
@@ -585,7 +585,7 @@ static int ipmovie_read_header(AVFormatContext *s,
avpriv_set_pts_info(st, 63, 1, 1000000);
ipmovie->video_stream_index = st->index;
st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
- st->codec->codec_id = CODEC_ID_INTERPLAY_VIDEO;
+ st->codec->codec_id = AV_CODEC_ID_INTERPLAY_VIDEO;
st->codec->codec_tag = 0; /* no fourcc */
st->codec->width = ipmovie->video_width;
st->codec->height = ipmovie->video_height;
@@ -601,11 +601,13 @@ static int ipmovie_read_header(AVFormatContext *s,
st->codec->codec_id = ipmovie->audio_type;
st->codec->codec_tag = 0; /* no tag */
st->codec->channels = ipmovie->audio_channels;
+ st->codec->channel_layout = st->codec->channels == 1 ? AV_CH_LAYOUT_MONO :
+ AV_CH_LAYOUT_STEREO;
st->codec->sample_rate = ipmovie->audio_sample_rate;
st->codec->bits_per_coded_sample = ipmovie->audio_bits;
st->codec->bit_rate = st->codec->channels * st->codec->sample_rate *
st->codec->bits_per_coded_sample;
- if (st->codec->codec_id == CODEC_ID_INTERPLAY_DPCM)
+ if (st->codec->codec_id == AV_CODEC_ID_INTERPLAY_DPCM)
st->codec->bit_rate /= 2;
st->codec->block_align = st->codec->channels * st->codec->bits_per_coded_sample;
}
@@ -637,7 +639,7 @@ static int ipmovie_read_packet(AVFormatContext *s,
AVInputFormat ff_ipmovie_demuxer = {
.name = "ipmovie",
- .long_name = NULL_IF_CONFIG_SMALL("Interplay MVE format"),
+ .long_name = NULL_IF_CONFIG_SMALL("Interplay MVE"),
.priv_data_size = sizeof(IPMVEContext),
.read_probe = ipmovie_probe,
.read_header = ipmovie_read_header,
diff --git a/gst-libs/ext/libav/libavformat/isom.c b/gst-libs/ext/libav/libavformat/isom.c
index 07f22ca..ccf4ca1 100644
--- a/gst-libs/ext/libav/libavformat/isom.c
+++ b/gst-libs/ext/libav/libavformat/isom.c
@@ -26,258 +26,261 @@
#include "avformat.h"
#include "internal.h"
#include "isom.h"
-#include "riff.h"
#include "libavcodec/mpeg4audio.h"
#include "libavcodec/mpegaudiodata.h"
/* http://www.mp4ra.org */
/* ordered by muxing preference */
const AVCodecTag ff_mp4_obj_type[] = {
- { CODEC_ID_MOV_TEXT , 0x08 },
- { CODEC_ID_MPEG4 , 0x20 },
- { CODEC_ID_H264 , 0x21 },
- { CODEC_ID_AAC , 0x40 },
- { CODEC_ID_MP4ALS , 0x40 }, /* 14496-3 ALS */
- { CODEC_ID_MPEG2VIDEO, 0x61 }, /* MPEG2 Main */
- { CODEC_ID_MPEG2VIDEO, 0x60 }, /* MPEG2 Simple */
- { CODEC_ID_MPEG2VIDEO, 0x62 }, /* MPEG2 SNR */
- { CODEC_ID_MPEG2VIDEO, 0x63 }, /* MPEG2 Spatial */
- { CODEC_ID_MPEG2VIDEO, 0x64 }, /* MPEG2 High */
- { CODEC_ID_MPEG2VIDEO, 0x65 }, /* MPEG2 422 */
- { CODEC_ID_AAC , 0x66 }, /* MPEG2 AAC Main */
- { CODEC_ID_AAC , 0x67 }, /* MPEG2 AAC Low */
- { CODEC_ID_AAC , 0x68 }, /* MPEG2 AAC SSR */
- { CODEC_ID_MP3 , 0x69 }, /* 13818-3 */
- { CODEC_ID_MP2 , 0x69 }, /* 11172-3 */
- { CODEC_ID_MPEG1VIDEO, 0x6A }, /* 11172-2 */
- { CODEC_ID_MP3 , 0x6B }, /* 11172-3 */
- { CODEC_ID_MJPEG , 0x6C }, /* 10918-1 */
- { CODEC_ID_PNG , 0x6D },
- { CODEC_ID_JPEG2000 , 0x6E }, /* 15444-1 */
- { CODEC_ID_VC1 , 0xA3 },
- { CODEC_ID_DIRAC , 0xA4 },
- { CODEC_ID_AC3 , 0xA5 },
- { CODEC_ID_DTS , 0xA9 }, /* mp4ra.org */
- { CODEC_ID_VORBIS , 0xDD }, /* non standard, gpac uses it */
- { CODEC_ID_DVD_SUBTITLE, 0xE0 }, /* non standard, see unsupported-embedded-subs-2.mp4 */
- { CODEC_ID_QCELP , 0xE1 },
- { CODEC_ID_MPEG4SYSTEMS, 0x01 },
- { CODEC_ID_MPEG4SYSTEMS, 0x02 },
- { CODEC_ID_NONE , 0 },
+ { AV_CODEC_ID_MOV_TEXT , 0x08 },
+ { AV_CODEC_ID_MPEG4 , 0x20 },
+ { AV_CODEC_ID_H264 , 0x21 },
+ { AV_CODEC_ID_AAC , 0x40 },
+ { AV_CODEC_ID_MP4ALS , 0x40 }, /* 14496-3 ALS */
+ { AV_CODEC_ID_MPEG2VIDEO , 0x61 }, /* MPEG2 Main */
+ { AV_CODEC_ID_MPEG2VIDEO , 0x60 }, /* MPEG2 Simple */
+ { AV_CODEC_ID_MPEG2VIDEO , 0x62 }, /* MPEG2 SNR */
+ { AV_CODEC_ID_MPEG2VIDEO , 0x63 }, /* MPEG2 Spatial */
+ { AV_CODEC_ID_MPEG2VIDEO , 0x64 }, /* MPEG2 High */
+ { AV_CODEC_ID_MPEG2VIDEO , 0x65 }, /* MPEG2 422 */
+ { AV_CODEC_ID_AAC , 0x66 }, /* MPEG2 AAC Main */
+ { AV_CODEC_ID_AAC , 0x67 }, /* MPEG2 AAC Low */
+ { AV_CODEC_ID_AAC , 0x68 }, /* MPEG2 AAC SSR */
+ { AV_CODEC_ID_MP3 , 0x69 }, /* 13818-3 */
+ { AV_CODEC_ID_MP2 , 0x69 }, /* 11172-3 */
+ { AV_CODEC_ID_MPEG1VIDEO , 0x6A }, /* 11172-2 */
+ { AV_CODEC_ID_MP3 , 0x6B }, /* 11172-3 */
+ { AV_CODEC_ID_MJPEG , 0x6C }, /* 10918-1 */
+ { AV_CODEC_ID_PNG , 0x6D },
+ { AV_CODEC_ID_JPEG2000 , 0x6E }, /* 15444-1 */
+ { AV_CODEC_ID_VC1 , 0xA3 },
+ { AV_CODEC_ID_DIRAC , 0xA4 },
+ { AV_CODEC_ID_AC3 , 0xA5 },
+ { AV_CODEC_ID_DTS , 0xA9 }, /* mp4ra.org */
+ { AV_CODEC_ID_VORBIS , 0xDD }, /* non standard, gpac uses it */
+ { AV_CODEC_ID_DVD_SUBTITLE, 0xE0 }, /* non standard, see unsupported-embedded-subs-2.mp4 */
+ { AV_CODEC_ID_QCELP , 0xE1 },
+ { AV_CODEC_ID_MPEG4SYSTEMS, 0x01 },
+ { AV_CODEC_ID_MPEG4SYSTEMS, 0x02 },
+ { AV_CODEC_ID_NONE , 0 },
};
-const AVCodecTag codec_movvideo_tags[] = {
-/* { CODEC_ID_, MKTAG('I', 'V', '5', '0') }, *//* Indeo 5.0 */
-
- { CODEC_ID_RAWVIDEO, MKTAG('r', 'a', 'w', ' ') }, /* Uncompressed RGB */
- { CODEC_ID_RAWVIDEO, MKTAG('y', 'u', 'v', '2') }, /* Uncompressed YUV422 */
- { CODEC_ID_RAWVIDEO, MKTAG('A', 'V', 'U', 'I') }, /* YUV with alpha-channel (AVID Uncompressed) */
- { CODEC_ID_RAWVIDEO, MKTAG('2', 'v', 'u', 'y') }, /* UNCOMPRESSED 8BIT 4:2:2 */
- { CODEC_ID_RAWVIDEO, MKTAG('y', 'u', 'v', 's') }, /* same as 2vuy but byte swapped */
-
- { CODEC_ID_RAWVIDEO, MKTAG('L', '5', '5', '5') },
- { CODEC_ID_RAWVIDEO, MKTAG('L', '5', '6', '5') },
- { CODEC_ID_RAWVIDEO, MKTAG('B', '5', '6', '5') },
- { CODEC_ID_RAWVIDEO, MKTAG('2', '4', 'B', 'G') },
- { CODEC_ID_RAWVIDEO, MKTAG('B', 'G', 'R', 'A') },
- { CODEC_ID_RAWVIDEO, MKTAG('R', 'G', 'B', 'A') },
- { CODEC_ID_RAWVIDEO, MKTAG('A', 'B', 'G', 'R') },
- { CODEC_ID_RAWVIDEO, MKTAG('b', '1', '6', 'g') },
- { CODEC_ID_RAWVIDEO, MKTAG('b', '4', '8', 'r') },
- { CODEC_ID_RAWVIDEO, MKTAG('D', 'V', 'O', 'O') }, /* Digital Voodoo SD 8 Bit */
-
- { CODEC_ID_R10K, MKTAG('R', '1', '0', 'k') }, /* UNCOMPRESSED 10BIT RGB */
- { CODEC_ID_R10K, MKTAG('R', '1', '0', 'g') }, /* UNCOMPRESSED 10BIT RGB */
- { CODEC_ID_R210, MKTAG('r', '2', '1', '0') }, /* UNCOMPRESSED 10BIT RGB */
- { CODEC_ID_V210, MKTAG('v', '2', '1', '0') }, /* UNCOMPRESSED 10BIT 4:2:2 */
- { CODEC_ID_V410, MKTAG('v', '4', '1', '0') }, /* UNCOMPRESSED 10BIT 4:4:4 */
-
- { CODEC_ID_MJPEG, MKTAG('j', 'p', 'e', 'g') }, /* PhotoJPEG */
- { CODEC_ID_MJPEG, MKTAG('m', 'j', 'p', 'a') }, /* Motion-JPEG (format A) */
- { CODEC_ID_MJPEG, MKTAG('A', 'V', 'D', 'J') }, /* MJPEG with alpha-channel (AVID JFIF meridien compressed) */
-/* { CODEC_ID_MJPEG, MKTAG('A', 'V', 'R', 'n') }, *//* MJPEG with alpha-channel (AVID ABVB/Truevision NuVista) */
- { CODEC_ID_MJPEG, MKTAG('d', 'm', 'b', '1') }, /* Motion JPEG OpenDML */
- { CODEC_ID_MJPEGB, MKTAG('m', 'j', 'p', 'b') }, /* Motion-JPEG (format B) */
-
- { CODEC_ID_SVQ1, MKTAG('S', 'V', 'Q', '1') }, /* Sorenson Video v1 */
- { CODEC_ID_SVQ1, MKTAG('s', 'v', 'q', '1') }, /* Sorenson Video v1 */
- { CODEC_ID_SVQ1, MKTAG('s', 'v', 'q', 'i') }, /* Sorenson Video v1 (from QT specs)*/
- { CODEC_ID_SVQ3, MKTAG('S', 'V', 'Q', '3') }, /* Sorenson Video v3 */
-
- { CODEC_ID_MPEG4, MKTAG('m', 'p', '4', 'v') },
- { CODEC_ID_MPEG4, MKTAG('D', 'I', 'V', 'X') }, /* OpenDiVX *//* sample files at http://heroinewarrior.com/xmovie.php3 use this tag */
- { CODEC_ID_MPEG4, MKTAG('X', 'V', 'I', 'D') },
- { CODEC_ID_MPEG4, MKTAG('3', 'I', 'V', '2') }, /* experimental: 3IVX files before ivx D4 4.5.1 */
-
- { CODEC_ID_H263, MKTAG('h', '2', '6', '3') }, /* H263 */
- { CODEC_ID_H263, MKTAG('s', '2', '6', '3') }, /* H263 ?? works */
-
- { CODEC_ID_DVVIDEO, MKTAG('d', 'v', 'c', 'p') }, /* DV PAL */
- { CODEC_ID_DVVIDEO, MKTAG('d', 'v', 'c', ' ') }, /* DV NTSC */
- { CODEC_ID_DVVIDEO, MKTAG('d', 'v', 'p', 'p') }, /* DVCPRO PAL produced by FCP */
- { CODEC_ID_DVVIDEO, MKTAG('d', 'v', '5', 'p') }, /* DVCPRO50 PAL produced by FCP */
- { CODEC_ID_DVVIDEO, MKTAG('d', 'v', '5', 'n') }, /* DVCPRO50 NTSC produced by FCP */
- { CODEC_ID_DVVIDEO, MKTAG('A', 'V', 'd', 'v') }, /* AVID DV */
- { CODEC_ID_DVVIDEO, MKTAG('A', 'V', 'd', '1') }, /* AVID DV100 */
- { CODEC_ID_DVVIDEO, MKTAG('d', 'v', 'h', 'q') }, /* DVCPRO HD 720p50 */
- { CODEC_ID_DVVIDEO, MKTAG('d', 'v', 'h', 'p') }, /* DVCPRO HD 720p60 */
- { CODEC_ID_DVVIDEO, MKTAG('d', 'v', 'h', '1') },
- { CODEC_ID_DVVIDEO, MKTAG('d', 'v', 'h', '2') },
- { CODEC_ID_DVVIDEO, MKTAG('d', 'v', 'h', '4') },
- { CODEC_ID_DVVIDEO, MKTAG('d', 'v', 'h', '5') }, /* DVCPRO HD 50i produced by FCP */
- { CODEC_ID_DVVIDEO, MKTAG('d', 'v', 'h', '6') }, /* DVCPRO HD 60i produced by FCP */
- { CODEC_ID_DVVIDEO, MKTAG('d', 'v', 'h', '3') }, /* DVCPRO HD 30p produced by FCP */
-
- { CODEC_ID_VP3, MKTAG('V', 'P', '3', '1') }, /* On2 VP3 */
- { CODEC_ID_RPZA, MKTAG('r', 'p', 'z', 'a') }, /* Apple Video (RPZA) */
- { CODEC_ID_CINEPAK, MKTAG('c', 'v', 'i', 'd') }, /* Cinepak */
- { CODEC_ID_8BPS, MKTAG('8', 'B', 'P', 'S') }, /* Planar RGB (8BPS) */
- { CODEC_ID_SMC, MKTAG('s', 'm', 'c', ' ') }, /* Apple Graphics (SMC) */
- { CODEC_ID_QTRLE, MKTAG('r', 'l', 'e', ' ') }, /* Apple Animation (RLE) */
- { CODEC_ID_MSRLE, MKTAG('W', 'R', 'L', 'E') },
- { CODEC_ID_QDRAW, MKTAG('q', 'd', 'r', 'w') }, /* QuickDraw */
-
- { CODEC_ID_RAWVIDEO, MKTAG('W', 'R', 'A', 'W') },
-
- { CODEC_ID_H264, MKTAG('a', 'v', 'c', '1') }, /* AVC-1/H.264 */
- { CODEC_ID_H264, MKTAG('a', 'i', '5', 'p') }, /* AVC-Intra 50M 720p24/30/60 */
- { CODEC_ID_H264, MKTAG('a', 'i', '5', 'q') }, /* AVC-Intra 50M 720p25/50 */
- { CODEC_ID_H264, MKTAG('a', 'i', '5', '2') }, /* AVC-Intra 50M 1080p25/50 */
- { CODEC_ID_H264, MKTAG('a', 'i', '5', '3') }, /* AVC-Intra 50M 1080p24/30/60 */
- { CODEC_ID_H264, MKTAG('a', 'i', '5', '5') }, /* AVC-Intra 50M 1080i50 */
- { CODEC_ID_H264, MKTAG('a', 'i', '5', '6') }, /* AVC-Intra 50M 1080i60 */
- { CODEC_ID_H264, MKTAG('a', 'i', '1', 'p') }, /* AVC-Intra 100M 720p24/30/60 */
- { CODEC_ID_H264, MKTAG('a', 'i', '1', 'q') }, /* AVC-Intra 100M 720p25/50 */
- { CODEC_ID_H264, MKTAG('a', 'i', '1', '2') }, /* AVC-Intra 100M 1080p25/50 */
- { CODEC_ID_H264, MKTAG('a', 'i', '1', '3') }, /* AVC-Intra 100M 1080p24/30/60 */
- { CODEC_ID_H264, MKTAG('a', 'i', '1', '5') }, /* AVC-Intra 100M 1080i50 */
- { CODEC_ID_H264, MKTAG('a', 'i', '1', '6') }, /* AVC-Intra 100M 1080i60 */
-
- { CODEC_ID_MPEG1VIDEO, MKTAG('m', '1', 'v', '1') }, /* Apple MPEG-1 Camcorder */
- { CODEC_ID_MPEG1VIDEO, MKTAG('m', 'p', 'e', 'g') }, /* MPEG */
- { CODEC_ID_MPEG2VIDEO, MKTAG('m', '2', 'v', '1') }, /* Apple MPEG-2 Camcorder */
- { CODEC_ID_MPEG2VIDEO, MKTAG('h', 'd', 'v', '1') }, /* MPEG2 HDV 720p30 */
- { CODEC_ID_MPEG2VIDEO, MKTAG('h', 'd', 'v', '2') }, /* MPEG2 HDV 1080i60 */
- { CODEC_ID_MPEG2VIDEO, MKTAG('h', 'd', 'v', '3') }, /* MPEG2 HDV 1080i50 */
- { CODEC_ID_MPEG2VIDEO, MKTAG('h', 'd', 'v', '4') }, /* MPEG2 HDV 720p24 */
- { CODEC_ID_MPEG2VIDEO, MKTAG('h', 'd', 'v', '5') }, /* MPEG2 HDV 720p25 */
- { CODEC_ID_MPEG2VIDEO, MKTAG('h', 'd', 'v', '6') }, /* MPEG2 HDV 1080p24 */
- { CODEC_ID_MPEG2VIDEO, MKTAG('h', 'd', 'v', '7') }, /* MPEG2 HDV 1080p25 */
- { CODEC_ID_MPEG2VIDEO, MKTAG('h', 'd', 'v', '8') }, /* MPEG2 HDV 1080p30 */
- { CODEC_ID_MPEG2VIDEO, MKTAG('h', 'd', 'v', '9') }, /* MPEG2 HDV 720p60 JVC */
- { CODEC_ID_MPEG2VIDEO, MKTAG('h', 'd', 'v', 'a') }, /* MPEG2 HDV 720p50 */
- { CODEC_ID_MPEG2VIDEO, MKTAG('m', 'x', '5', 'n') }, /* MPEG2 IMX NTSC 525/60 50mb/s produced by FCP */
- { CODEC_ID_MPEG2VIDEO, MKTAG('m', 'x', '5', 'p') }, /* MPEG2 IMX PAL 625/50 50mb/s produced by FCP */
- { CODEC_ID_MPEG2VIDEO, MKTAG('m', 'x', '4', 'n') }, /* MPEG2 IMX NTSC 525/60 40mb/s produced by FCP */
- { CODEC_ID_MPEG2VIDEO, MKTAG('m', 'x', '4', 'p') }, /* MPEG2 IMX PAL 625/50 40mb/s produced by FCP */
- { CODEC_ID_MPEG2VIDEO, MKTAG('m', 'x', '3', 'n') }, /* MPEG2 IMX NTSC 525/60 30mb/s produced by FCP */
- { CODEC_ID_MPEG2VIDEO, MKTAG('m', 'x', '3', 'p') }, /* MPEG2 IMX PAL 625/50 30mb/s produced by FCP */
- { CODEC_ID_MPEG2VIDEO, MKTAG('x', 'd', '5', '4') }, /* XDCAM HD422 720p24 CBR */
- { CODEC_ID_MPEG2VIDEO, MKTAG('x', 'd', '5', '5') }, /* XDCAM HD422 720p25 CBR */
- { CODEC_ID_MPEG2VIDEO, MKTAG('x', 'd', '5', '9') }, /* XDCAM HD422 720p60 CBR */
- { CODEC_ID_MPEG2VIDEO, MKTAG('x', 'd', '5', 'a') }, /* XDCAM HD422 720p50 CBR */
- { CODEC_ID_MPEG2VIDEO, MKTAG('x', 'd', '5', 'b') }, /* XDCAM HD422 1080i60 CBR */
- { CODEC_ID_MPEG2VIDEO, MKTAG('x', 'd', '5', 'c') }, /* XDCAM HD422 1080i50 CBR */
- { CODEC_ID_MPEG2VIDEO, MKTAG('x', 'd', '5', 'd') }, /* XDCAM HD422 1080p24 CBR */
- { CODEC_ID_MPEG2VIDEO, MKTAG('x', 'd', '5', 'e') }, /* XDCAM HD422 1080p25 CBR */
- { CODEC_ID_MPEG2VIDEO, MKTAG('x', 'd', '5', 'f') }, /* XDCAM HD422 1080p30 CBR */
- { CODEC_ID_MPEG2VIDEO, MKTAG('x', 'd', 'v', '1') }, /* XDCAM EX 720p30 VBR */
- { CODEC_ID_MPEG2VIDEO, MKTAG('x', 'd', 'v', '2') }, /* XDCAM HD 1080i60 */
- { CODEC_ID_MPEG2VIDEO, MKTAG('x', 'd', 'v', '3') }, /* XDCAM HD 1080i50 VBR */
- { CODEC_ID_MPEG2VIDEO, MKTAG('x', 'd', 'v', '4') }, /* XDCAM EX 720p24 VBR */
- { CODEC_ID_MPEG2VIDEO, MKTAG('x', 'd', 'v', '5') }, /* XDCAM EX 720p25 VBR */
- { CODEC_ID_MPEG2VIDEO, MKTAG('x', 'd', 'v', '6') }, /* XDCAM HD 1080p24 VBR */
- { CODEC_ID_MPEG2VIDEO, MKTAG('x', 'd', 'v', '7') }, /* XDCAM HD 1080p25 VBR */
- { CODEC_ID_MPEG2VIDEO, MKTAG('x', 'd', 'v', '8') }, /* XDCAM HD 1080p30 VBR */
- { CODEC_ID_MPEG2VIDEO, MKTAG('x', 'd', 'v', '9') }, /* XDCAM EX 720p60 VBR */
- { CODEC_ID_MPEG2VIDEO, MKTAG('x', 'd', 'v', 'a') }, /* XDCAM EX 720p50 VBR */
- { CODEC_ID_MPEG2VIDEO, MKTAG('x', 'd', 'v', 'b') }, /* XDCAM EX 1080i60 VBR */
- { CODEC_ID_MPEG2VIDEO, MKTAG('x', 'd', 'v', 'c') }, /* XDCAM EX 1080i50 VBR */
- { CODEC_ID_MPEG2VIDEO, MKTAG('x', 'd', 'v', 'd') }, /* XDCAM EX 1080p24 VBR */
- { CODEC_ID_MPEG2VIDEO, MKTAG('x', 'd', 'v', 'e') }, /* XDCAM EX 1080p25 VBR */
- { CODEC_ID_MPEG2VIDEO, MKTAG('x', 'd', 'v', 'f') }, /* XDCAM EX 1080p30 VBR */
- { CODEC_ID_MPEG2VIDEO, MKTAG('x', 'd', 'h', 'd') }, /* XDCAM HD 540p */
- { CODEC_ID_MPEG2VIDEO, MKTAG('x', 'd', 'h', '2') }, /* XDCAM HD422 540p */
- { CODEC_ID_MPEG2VIDEO, MKTAG('A', 'V', 'm', 'p') }, /* AVID IMX PAL */
-
- { CODEC_ID_JPEG2000, MKTAG('m', 'j', 'p', '2') }, /* JPEG 2000 produced by FCP */
-
- { CODEC_ID_TARGA, MKTAG('t', 'g', 'a', ' ') }, /* Truevision Targa */
- { CODEC_ID_TIFF, MKTAG('t', 'i', 'f', 'f') }, /* TIFF embedded in MOV */
- { CODEC_ID_GIF, MKTAG('g', 'i', 'f', ' ') }, /* embedded gif files as frames (usually one "click to play movie" frame) */
- { CODEC_ID_PNG, MKTAG('p', 'n', 'g', ' ') },
-
- { CODEC_ID_VC1, MKTAG('v', 'c', '-', '1') }, /* SMPTE RP 2025 */
- { CODEC_ID_CAVS, MKTAG('a', 'v', 's', '2') },
-
- { CODEC_ID_DIRAC, MKTAG('d', 'r', 'a', 'c') },
- { CODEC_ID_DNXHD, MKTAG('A', 'V', 'd', 'n') }, /* AVID DNxHD */
- { CODEC_ID_FLV1, MKTAG('H', '2', '6', '3') }, /* Flash Media Server */
- { CODEC_ID_MSMPEG4V3, MKTAG('3', 'I', 'V', 'D') }, /* 3ivx DivX Doctor */
- { CODEC_ID_RAWVIDEO, MKTAG('A', 'V', '1', 'x') }, /* AVID 1:1x */
- { CODEC_ID_RAWVIDEO, MKTAG('A', 'V', 'u', 'p') },
- { CODEC_ID_SGI, MKTAG('s', 'g', 'i', ' ') }, /* SGI */
- { CODEC_ID_DPX, MKTAG('d', 'p', 'x', ' ') }, /* DPX */
-
- { CODEC_ID_PRORES, MKTAG('a', 'p', 'c', 'h') }, /* Apple ProRes 422 High Quality */
- { CODEC_ID_PRORES, MKTAG('a', 'p', 'c', 'n') }, /* Apple ProRes 422 Standard Definition */
- { CODEC_ID_PRORES, MKTAG('a', 'p', 'c', 's') }, /* Apple ProRes 422 LT */
- { CODEC_ID_PRORES, MKTAG('a', 'p', 'c', 'o') }, /* Apple ProRes 422 Proxy */
- { CODEC_ID_PRORES, MKTAG('a', 'p', '4', 'h') }, /* Apple ProRes 4444 */
-
- { CODEC_ID_NONE, 0 },
+const AVCodecTag ff_codec_movvideo_tags[] = {
+/* { AV_CODEC_ID_, MKTAG('I', 'V', '5', '0') }, *//* Indeo 5.0 */
+
+ { AV_CODEC_ID_RAWVIDEO, MKTAG('r', 'a', 'w', ' ') }, /* Uncompressed RGB */
+ { AV_CODEC_ID_RAWVIDEO, MKTAG('y', 'u', 'v', '2') }, /* Uncompressed YUV422 */
+ { AV_CODEC_ID_RAWVIDEO, MKTAG('A', 'V', 'U', 'I') }, /* YUV with alpha-channel (AVID Uncompressed) */
+ { AV_CODEC_ID_RAWVIDEO, MKTAG('2', 'v', 'u', 'y') }, /* UNCOMPRESSED 8BIT 4:2:2 */
+ { AV_CODEC_ID_RAWVIDEO, MKTAG('y', 'u', 'v', 's') }, /* same as 2vuy but byte swapped */
+
+ { AV_CODEC_ID_RAWVIDEO, MKTAG('L', '5', '5', '5') },
+ { AV_CODEC_ID_RAWVIDEO, MKTAG('L', '5', '6', '5') },
+ { AV_CODEC_ID_RAWVIDEO, MKTAG('B', '5', '6', '5') },
+ { AV_CODEC_ID_RAWVIDEO, MKTAG('2', '4', 'B', 'G') },
+ { AV_CODEC_ID_RAWVIDEO, MKTAG('B', 'G', 'R', 'A') },
+ { AV_CODEC_ID_RAWVIDEO, MKTAG('R', 'G', 'B', 'A') },
+ { AV_CODEC_ID_RAWVIDEO, MKTAG('A', 'B', 'G', 'R') },
+ { AV_CODEC_ID_RAWVIDEO, MKTAG('b', '1', '6', 'g') },
+ { AV_CODEC_ID_RAWVIDEO, MKTAG('b', '4', '8', 'r') },
+ { AV_CODEC_ID_RAWVIDEO, MKTAG('D', 'V', 'O', 'O') }, /* Digital Voodoo SD 8 Bit */
+
+ { AV_CODEC_ID_R10K, MKTAG('R', '1', '0', 'k') }, /* UNCOMPRESSED 10BIT RGB */
+ { AV_CODEC_ID_R10K, MKTAG('R', '1', '0', 'g') }, /* UNCOMPRESSED 10BIT RGB */
+ { AV_CODEC_ID_R210, MKTAG('r', '2', '1', '0') }, /* UNCOMPRESSED 10BIT RGB */
+ { AV_CODEC_ID_V210, MKTAG('v', '2', '1', '0') }, /* UNCOMPRESSED 10BIT 4:2:2 */
+ { AV_CODEC_ID_V410, MKTAG('v', '4', '1', '0') }, /* UNCOMPRESSED 10BIT 4:4:4 */
+
+ { AV_CODEC_ID_MJPEG, MKTAG('j', 'p', 'e', 'g') }, /* PhotoJPEG */
+ { AV_CODEC_ID_MJPEG, MKTAG('m', 'j', 'p', 'a') }, /* Motion-JPEG (format A) */
+ { AV_CODEC_ID_MJPEG, MKTAG('A', 'V', 'D', 'J') }, /* MJPEG with alpha-channel (AVID JFIF meridien compressed) */
+/* { AV_CODEC_ID_MJPEG, MKTAG('A', 'V', 'R', 'n') }, *//* MJPEG with alpha-channel (AVID ABVB/Truevision NuVista) */
+ { AV_CODEC_ID_MJPEG, MKTAG('d', 'm', 'b', '1') }, /* Motion JPEG OpenDML */
+ { AV_CODEC_ID_MJPEGB, MKTAG('m', 'j', 'p', 'b') }, /* Motion-JPEG (format B) */
+
+ { AV_CODEC_ID_SVQ1, MKTAG('S', 'V', 'Q', '1') }, /* Sorenson Video v1 */
+ { AV_CODEC_ID_SVQ1, MKTAG('s', 'v', 'q', '1') }, /* Sorenson Video v1 */
+ { AV_CODEC_ID_SVQ1, MKTAG('s', 'v', 'q', 'i') }, /* Sorenson Video v1 (from QT specs)*/
+ { AV_CODEC_ID_SVQ3, MKTAG('S', 'V', 'Q', '3') }, /* Sorenson Video v3 */
+
+ { AV_CODEC_ID_MPEG4, MKTAG('m', 'p', '4', 'v') },
+ { AV_CODEC_ID_MPEG4, MKTAG('D', 'I', 'V', 'X') }, /* OpenDiVX *//* sample files at http://heroinewarrior.com/xmovie.php3 use this tag */
+ { AV_CODEC_ID_MPEG4, MKTAG('X', 'V', 'I', 'D') },
+ { AV_CODEC_ID_MPEG4, MKTAG('3', 'I', 'V', '2') }, /* experimental: 3IVX files before ivx D4 4.5.1 */
+
+ { AV_CODEC_ID_H263, MKTAG('h', '2', '6', '3') }, /* H263 */
+ { AV_CODEC_ID_H263, MKTAG('s', '2', '6', '3') }, /* H263 ?? works */
+
+ { AV_CODEC_ID_DVVIDEO, MKTAG('d', 'v', 'c', 'p') }, /* DV PAL */
+ { AV_CODEC_ID_DVVIDEO, MKTAG('d', 'v', 'c', ' ') }, /* DV NTSC */
+ { AV_CODEC_ID_DVVIDEO, MKTAG('d', 'v', 'p', 'p') }, /* DVCPRO PAL produced by FCP */
+ { AV_CODEC_ID_DVVIDEO, MKTAG('d', 'v', '5', 'p') }, /* DVCPRO50 PAL produced by FCP */
+ { AV_CODEC_ID_DVVIDEO, MKTAG('d', 'v', '5', 'n') }, /* DVCPRO50 NTSC produced by FCP */
+ { AV_CODEC_ID_DVVIDEO, MKTAG('A', 'V', 'd', 'v') }, /* AVID DV */
+ { AV_CODEC_ID_DVVIDEO, MKTAG('A', 'V', 'd', '1') }, /* AVID DV100 */
+ { AV_CODEC_ID_DVVIDEO, MKTAG('d', 'v', 'h', 'q') }, /* DVCPRO HD 720p50 */
+ { AV_CODEC_ID_DVVIDEO, MKTAG('d', 'v', 'h', 'p') }, /* DVCPRO HD 720p60 */
+ { AV_CODEC_ID_DVVIDEO, MKTAG('d', 'v', 'h', '1') },
+ { AV_CODEC_ID_DVVIDEO, MKTAG('d', 'v', 'h', '2') },
+ { AV_CODEC_ID_DVVIDEO, MKTAG('d', 'v', 'h', '4') },
+ { AV_CODEC_ID_DVVIDEO, MKTAG('d', 'v', 'h', '5') }, /* DVCPRO HD 50i produced by FCP */
+ { AV_CODEC_ID_DVVIDEO, MKTAG('d', 'v', 'h', '6') }, /* DVCPRO HD 60i produced by FCP */
+ { AV_CODEC_ID_DVVIDEO, MKTAG('d', 'v', 'h', '3') }, /* DVCPRO HD 30p produced by FCP */
+
+ { AV_CODEC_ID_VP3, MKTAG('V', 'P', '3', '1') }, /* On2 VP3 */
+ { AV_CODEC_ID_RPZA, MKTAG('r', 'p', 'z', 'a') }, /* Apple Video (RPZA) */
+ { AV_CODEC_ID_CINEPAK, MKTAG('c', 'v', 'i', 'd') }, /* Cinepak */
+ { AV_CODEC_ID_8BPS, MKTAG('8', 'B', 'P', 'S') }, /* Planar RGB (8BPS) */
+ { AV_CODEC_ID_SMC, MKTAG('s', 'm', 'c', ' ') }, /* Apple Graphics (SMC) */
+ { AV_CODEC_ID_QTRLE, MKTAG('r', 'l', 'e', ' ') }, /* Apple Animation (RLE) */
+ { AV_CODEC_ID_MSRLE, MKTAG('W', 'R', 'L', 'E') },
+ { AV_CODEC_ID_QDRAW, MKTAG('q', 'd', 'r', 'w') }, /* QuickDraw */
+
+ { AV_CODEC_ID_RAWVIDEO, MKTAG('W', 'R', 'A', 'W') },
+
+ { AV_CODEC_ID_H264, MKTAG('a', 'v', 'c', '1') }, /* AVC-1/H.264 */
+ { AV_CODEC_ID_H264, MKTAG('a', 'i', '5', 'p') }, /* AVC-Intra 50M 720p24/30/60 */
+ { AV_CODEC_ID_H264, MKTAG('a', 'i', '5', 'q') }, /* AVC-Intra 50M 720p25/50 */
+ { AV_CODEC_ID_H264, MKTAG('a', 'i', '5', '2') }, /* AVC-Intra 50M 1080p25/50 */
+ { AV_CODEC_ID_H264, MKTAG('a', 'i', '5', '3') }, /* AVC-Intra 50M 1080p24/30/60 */
+ { AV_CODEC_ID_H264, MKTAG('a', 'i', '5', '5') }, /* AVC-Intra 50M 1080i50 */
+ { AV_CODEC_ID_H264, MKTAG('a', 'i', '5', '6') }, /* AVC-Intra 50M 1080i60 */
+ { AV_CODEC_ID_H264, MKTAG('a', 'i', '1', 'p') }, /* AVC-Intra 100M 720p24/30/60 */
+ { AV_CODEC_ID_H264, MKTAG('a', 'i', '1', 'q') }, /* AVC-Intra 100M 720p25/50 */
+ { AV_CODEC_ID_H264, MKTAG('a', 'i', '1', '2') }, /* AVC-Intra 100M 1080p25/50 */
+ { AV_CODEC_ID_H264, MKTAG('a', 'i', '1', '3') }, /* AVC-Intra 100M 1080p24/30/60 */
+ { AV_CODEC_ID_H264, MKTAG('a', 'i', '1', '5') }, /* AVC-Intra 100M 1080i50 */
+ { AV_CODEC_ID_H264, MKTAG('a', 'i', '1', '6') }, /* AVC-Intra 100M 1080i60 */
+
+ { AV_CODEC_ID_MPEG1VIDEO, MKTAG('m', '1', 'v', '1') }, /* Apple MPEG-1 Camcorder */
+ { AV_CODEC_ID_MPEG1VIDEO, MKTAG('m', 'p', 'e', 'g') }, /* MPEG */
+ { AV_CODEC_ID_MPEG2VIDEO, MKTAG('m', '2', 'v', '1') }, /* Apple MPEG-2 Camcorder */
+ { AV_CODEC_ID_MPEG2VIDEO, MKTAG('h', 'd', 'v', '1') }, /* MPEG2 HDV 720p30 */
+ { AV_CODEC_ID_MPEG2VIDEO, MKTAG('h', 'd', 'v', '2') }, /* MPEG2 HDV 1080i60 */
+ { AV_CODEC_ID_MPEG2VIDEO, MKTAG('h', 'd', 'v', '3') }, /* MPEG2 HDV 1080i50 */
+ { AV_CODEC_ID_MPEG2VIDEO, MKTAG('h', 'd', 'v', '4') }, /* MPEG2 HDV 720p24 */
+ { AV_CODEC_ID_MPEG2VIDEO, MKTAG('h', 'd', 'v', '5') }, /* MPEG2 HDV 720p25 */
+ { AV_CODEC_ID_MPEG2VIDEO, MKTAG('h', 'd', 'v', '6') }, /* MPEG2 HDV 1080p24 */
+ { AV_CODEC_ID_MPEG2VIDEO, MKTAG('h', 'd', 'v', '7') }, /* MPEG2 HDV 1080p25 */
+ { AV_CODEC_ID_MPEG2VIDEO, MKTAG('h', 'd', 'v', '8') }, /* MPEG2 HDV 1080p30 */
+ { AV_CODEC_ID_MPEG2VIDEO, MKTAG('h', 'd', 'v', '9') }, /* MPEG2 HDV 720p60 JVC */
+ { AV_CODEC_ID_MPEG2VIDEO, MKTAG('h', 'd', 'v', 'a') }, /* MPEG2 HDV 720p50 */
+ { AV_CODEC_ID_MPEG2VIDEO, MKTAG('m', 'x', '5', 'n') }, /* MPEG2 IMX NTSC 525/60 50mb/s produced by FCP */
+ { AV_CODEC_ID_MPEG2VIDEO, MKTAG('m', 'x', '5', 'p') }, /* MPEG2 IMX PAL 625/50 50mb/s produced by FCP */
+ { AV_CODEC_ID_MPEG2VIDEO, MKTAG('m', 'x', '4', 'n') }, /* MPEG2 IMX NTSC 525/60 40mb/s produced by FCP */
+ { AV_CODEC_ID_MPEG2VIDEO, MKTAG('m', 'x', '4', 'p') }, /* MPEG2 IMX PAL 625/50 40mb/s produced by FCP */
+ { AV_CODEC_ID_MPEG2VIDEO, MKTAG('m', 'x', '3', 'n') }, /* MPEG2 IMX NTSC 525/60 30mb/s produced by FCP */
+ { AV_CODEC_ID_MPEG2VIDEO, MKTAG('m', 'x', '3', 'p') }, /* MPEG2 IMX PAL 625/50 30mb/s produced by FCP */
+ { AV_CODEC_ID_MPEG2VIDEO, MKTAG('x', 'd', '5', '4') }, /* XDCAM HD422 720p24 CBR */
+ { AV_CODEC_ID_MPEG2VIDEO, MKTAG('x', 'd', '5', '5') }, /* XDCAM HD422 720p25 CBR */
+ { AV_CODEC_ID_MPEG2VIDEO, MKTAG('x', 'd', '5', '9') }, /* XDCAM HD422 720p60 CBR */
+ { AV_CODEC_ID_MPEG2VIDEO, MKTAG('x', 'd', '5', 'a') }, /* XDCAM HD422 720p50 CBR */
+ { AV_CODEC_ID_MPEG2VIDEO, MKTAG('x', 'd', '5', 'b') }, /* XDCAM HD422 1080i60 CBR */
+ { AV_CODEC_ID_MPEG2VIDEO, MKTAG('x', 'd', '5', 'c') }, /* XDCAM HD422 1080i50 CBR */
+ { AV_CODEC_ID_MPEG2VIDEO, MKTAG('x', 'd', '5', 'd') }, /* XDCAM HD422 1080p24 CBR */
+ { AV_CODEC_ID_MPEG2VIDEO, MKTAG('x', 'd', '5', 'e') }, /* XDCAM HD422 1080p25 CBR */
+ { AV_CODEC_ID_MPEG2VIDEO, MKTAG('x', 'd', '5', 'f') }, /* XDCAM HD422 1080p30 CBR */
+ { AV_CODEC_ID_MPEG2VIDEO, MKTAG('x', 'd', 'v', '1') }, /* XDCAM EX 720p30 VBR */
+ { AV_CODEC_ID_MPEG2VIDEO, MKTAG('x', 'd', 'v', '2') }, /* XDCAM HD 1080i60 */
+ { AV_CODEC_ID_MPEG2VIDEO, MKTAG('x', 'd', 'v', '3') }, /* XDCAM HD 1080i50 VBR */
+ { AV_CODEC_ID_MPEG2VIDEO, MKTAG('x', 'd', 'v', '4') }, /* XDCAM EX 720p24 VBR */
+ { AV_CODEC_ID_MPEG2VIDEO, MKTAG('x', 'd', 'v', '5') }, /* XDCAM EX 720p25 VBR */
+ { AV_CODEC_ID_MPEG2VIDEO, MKTAG('x', 'd', 'v', '6') }, /* XDCAM HD 1080p24 VBR */
+ { AV_CODEC_ID_MPEG2VIDEO, MKTAG('x', 'd', 'v', '7') }, /* XDCAM HD 1080p25 VBR */
+ { AV_CODEC_ID_MPEG2VIDEO, MKTAG('x', 'd', 'v', '8') }, /* XDCAM HD 1080p30 VBR */
+ { AV_CODEC_ID_MPEG2VIDEO, MKTAG('x', 'd', 'v', '9') }, /* XDCAM EX 720p60 VBR */
+ { AV_CODEC_ID_MPEG2VIDEO, MKTAG('x', 'd', 'v', 'a') }, /* XDCAM EX 720p50 VBR */
+ { AV_CODEC_ID_MPEG2VIDEO, MKTAG('x', 'd', 'v', 'b') }, /* XDCAM EX 1080i60 VBR */
+ { AV_CODEC_ID_MPEG2VIDEO, MKTAG('x', 'd', 'v', 'c') }, /* XDCAM EX 1080i50 VBR */
+ { AV_CODEC_ID_MPEG2VIDEO, MKTAG('x', 'd', 'v', 'd') }, /* XDCAM EX 1080p24 VBR */
+ { AV_CODEC_ID_MPEG2VIDEO, MKTAG('x', 'd', 'v', 'e') }, /* XDCAM EX 1080p25 VBR */
+ { AV_CODEC_ID_MPEG2VIDEO, MKTAG('x', 'd', 'v', 'f') }, /* XDCAM EX 1080p30 VBR */
+ { AV_CODEC_ID_MPEG2VIDEO, MKTAG('x', 'd', 'h', 'd') }, /* XDCAM HD 540p */
+ { AV_CODEC_ID_MPEG2VIDEO, MKTAG('x', 'd', 'h', '2') }, /* XDCAM HD422 540p */
+ { AV_CODEC_ID_MPEG2VIDEO, MKTAG('A', 'V', 'm', 'p') }, /* AVID IMX PAL */
+
+ { AV_CODEC_ID_JPEG2000, MKTAG('m', 'j', 'p', '2') }, /* JPEG 2000 produced by FCP */
+
+ { AV_CODEC_ID_TARGA, MKTAG('t', 'g', 'a', ' ') }, /* Truevision Targa */
+ { AV_CODEC_ID_TIFF, MKTAG('t', 'i', 'f', 'f') }, /* TIFF embedded in MOV */
+ { AV_CODEC_ID_GIF, MKTAG('g', 'i', 'f', ' ') }, /* embedded gif files as frames (usually one "click to play movie" frame) */
+ { AV_CODEC_ID_PNG, MKTAG('p', 'n', 'g', ' ') },
+
+ { AV_CODEC_ID_VC1, MKTAG('v', 'c', '-', '1') }, /* SMPTE RP 2025 */
+ { AV_CODEC_ID_CAVS, MKTAG('a', 'v', 's', '2') },
+
+ { AV_CODEC_ID_DIRAC, MKTAG('d', 'r', 'a', 'c') },
+ { AV_CODEC_ID_DNXHD, MKTAG('A', 'V', 'd', 'n') }, /* AVID DNxHD */
+ { AV_CODEC_ID_H263, MKTAG('H', '2', '6', '3') },
+ { AV_CODEC_ID_MSMPEG4V3, MKTAG('3', 'I', 'V', 'D') }, /* 3ivx DivX Doctor */
+ { AV_CODEC_ID_RAWVIDEO, MKTAG('A', 'V', '1', 'x') }, /* AVID 1:1x */
+ { AV_CODEC_ID_RAWVIDEO, MKTAG('A', 'V', 'u', 'p') },
+ { AV_CODEC_ID_SGI, MKTAG('s', 'g', 'i', ' ') }, /* SGI */
+ { AV_CODEC_ID_DPX, MKTAG('d', 'p', 'x', ' ') }, /* DPX */
+
+ { AV_CODEC_ID_PRORES, MKTAG('a', 'p', 'c', 'h') }, /* Apple ProRes 422 High Quality */
+ { AV_CODEC_ID_PRORES, MKTAG('a', 'p', 'c', 'n') }, /* Apple ProRes 422 Standard Definition */
+ { AV_CODEC_ID_PRORES, MKTAG('a', 'p', 'c', 's') }, /* Apple ProRes 422 LT */
+ { AV_CODEC_ID_PRORES, MKTAG('a', 'p', 'c', 'o') }, /* Apple ProRes 422 Proxy */
+ { AV_CODEC_ID_PRORES, MKTAG('a', 'p', '4', 'h') }, /* Apple ProRes 4444 */
+
+ { AV_CODEC_ID_NONE, 0 },
};
-const AVCodecTag codec_movaudio_tags[] = {
- { CODEC_ID_AAC, MKTAG('m', 'p', '4', 'a') },
- { CODEC_ID_AC3, MKTAG('a', 'c', '-', '3') }, /* ETSI TS 102 366 Annex F */
- { CODEC_ID_AC3, MKTAG('s', 'a', 'c', '3') }, /* Nero Recode */
- { CODEC_ID_ADPCM_IMA_QT, MKTAG('i', 'm', 'a', '4') },
- { CODEC_ID_ALAC, MKTAG('a', 'l', 'a', 'c') },
- { CODEC_ID_AMR_NB, MKTAG('s', 'a', 'm', 'r') }, /* AMR-NB 3gp */
- { CODEC_ID_AMR_WB, MKTAG('s', 'a', 'w', 'b') }, /* AMR-WB 3gp */
- { CODEC_ID_DTS, MKTAG('d', 't', 's', 'c') }, /* mp4ra.org */
- { CODEC_ID_DTS, MKTAG('D', 'T', 'S', ' ') }, /* non-standard */
- { CODEC_ID_DVAUDIO, MKTAG('v', 'd', 'v', 'a') },
- { CODEC_ID_DVAUDIO, MKTAG('d', 'v', 'c', 'a') },
- { CODEC_ID_GSM, MKTAG('a', 'g', 's', 'm') },
- { CODEC_ID_MACE3, MKTAG('M', 'A', 'C', '3') },
- { CODEC_ID_MACE6, MKTAG('M', 'A', 'C', '6') },
- { CODEC_ID_MP1, MKTAG('.', 'm', 'p', '1') },
- { CODEC_ID_MP2, MKTAG('.', 'm', 'p', '2') },
- { CODEC_ID_MP3, MKTAG('.', 'm', 'p', '3') },
- { CODEC_ID_MP3, 0x6D730055 },
- { CODEC_ID_NELLYMOSER, MKTAG('n', 'm', 'o', 's') }, /* Flash Media Server */
- { CODEC_ID_PCM_ALAW, MKTAG('a', 'l', 'a', 'w') },
- { CODEC_ID_PCM_F32BE, MKTAG('f', 'l', '3', '2') },
- { CODEC_ID_PCM_F32LE, MKTAG('f', 'l', '3', '2') },
- { CODEC_ID_PCM_F64BE, MKTAG('f', 'l', '6', '4') },
- { CODEC_ID_PCM_F64LE, MKTAG('f', 'l', '6', '4') },
- { CODEC_ID_PCM_MULAW, MKTAG('u', 'l', 'a', 'w') },
- { CODEC_ID_PCM_S16BE, MKTAG('t', 'w', 'o', 's') },
- { CODEC_ID_PCM_S16LE, MKTAG('s', 'o', 'w', 't') },
- { CODEC_ID_PCM_S16LE, MKTAG('l', 'p', 'c', 'm') },
- { CODEC_ID_PCM_S24BE, MKTAG('i', 'n', '2', '4') },
- { CODEC_ID_PCM_S24LE, MKTAG('i', 'n', '2', '4') },
- { CODEC_ID_PCM_S32BE, MKTAG('i', 'n', '3', '2') },
- { CODEC_ID_PCM_S32LE, MKTAG('i', 'n', '3', '2') },
- { CODEC_ID_PCM_S8, MKTAG('s', 'o', 'w', 't') },
- { CODEC_ID_PCM_U8, MKTAG('r', 'a', 'w', ' ') },
- { CODEC_ID_PCM_U8, MKTAG('N', 'O', 'N', 'E') },
- { CODEC_ID_QCELP, MKTAG('Q', 'c', 'l', 'p') },
- { CODEC_ID_QCELP, MKTAG('Q', 'c', 'l', 'q') },
- { CODEC_ID_QCELP, MKTAG('s', 'q', 'c', 'p') }, /* ISO Media fourcc */
- { CODEC_ID_QDM2, MKTAG('Q', 'D', 'M', '2') },
- { CODEC_ID_QDMC, MKTAG('Q', 'D', 'M', 'C') },
- { CODEC_ID_SPEEX, MKTAG('s', 'p', 'e', 'x') }, /* Flash Media Server */
- { CODEC_ID_WMAV2, MKTAG('W', 'M', 'A', '2') },
- { CODEC_ID_NONE, 0 },
+const AVCodecTag ff_codec_movaudio_tags[] = {
+ { AV_CODEC_ID_AAC, MKTAG('m', 'p', '4', 'a') },
+ { AV_CODEC_ID_AC3, MKTAG('a', 'c', '-', '3') }, /* ETSI TS 102 366 Annex F */
+ { AV_CODEC_ID_AC3, MKTAG('s', 'a', 'c', '3') }, /* Nero Recode */
+ { AV_CODEC_ID_ADPCM_IMA_QT, MKTAG('i', 'm', 'a', '4') },
+ { AV_CODEC_ID_ALAC, MKTAG('a', 'l', 'a', 'c') },
+ { AV_CODEC_ID_AMR_NB, MKTAG('s', 'a', 'm', 'r') }, /* AMR-NB 3gp */
+ { AV_CODEC_ID_AMR_WB, MKTAG('s', 'a', 'w', 'b') }, /* AMR-WB 3gp */
+ { AV_CODEC_ID_DTS, MKTAG('d', 't', 's', 'c') }, /* DTS formats prior to DTS-HD */
+ { AV_CODEC_ID_DTS, MKTAG('d', 't', 's', 'h') }, /* DTS-HD audio formats */
+ { AV_CODEC_ID_DTS, MKTAG('d', 't', 's', 'l') }, /* DTS-HD Lossless formats */
+ { AV_CODEC_ID_DTS, MKTAG('D', 'T', 'S', ' ') }, /* non-standard */
+ { AV_CODEC_ID_EAC3, MKTAG('e', 'c', '-', '3') }, /* ETSI TS 102 366 Annex F (only valid in ISOBMFF) */
+ { AV_CODEC_ID_DVAUDIO, MKTAG('v', 'd', 'v', 'a') },
+ { AV_CODEC_ID_DVAUDIO, MKTAG('d', 'v', 'c', 'a') },
+ { AV_CODEC_ID_GSM, MKTAG('a', 'g', 's', 'm') },
+ { AV_CODEC_ID_ILBC, MKTAG('i', 'l', 'b', 'c') },
+ { AV_CODEC_ID_MACE3, MKTAG('M', 'A', 'C', '3') },
+ { AV_CODEC_ID_MACE6, MKTAG('M', 'A', 'C', '6') },
+ { AV_CODEC_ID_MP1, MKTAG('.', 'm', 'p', '1') },
+ { AV_CODEC_ID_MP2, MKTAG('.', 'm', 'p', '2') },
+ { AV_CODEC_ID_MP3, MKTAG('.', 'm', 'p', '3') },
+ { AV_CODEC_ID_MP3, 0x6D730055 },
+ { AV_CODEC_ID_NELLYMOSER, MKTAG('n', 'm', 'o', 's') }, /* Flash Media Server */
+ { AV_CODEC_ID_PCM_ALAW, MKTAG('a', 'l', 'a', 'w') },
+ { AV_CODEC_ID_PCM_F32BE, MKTAG('f', 'l', '3', '2') },
+ { AV_CODEC_ID_PCM_F32LE, MKTAG('f', 'l', '3', '2') },
+ { AV_CODEC_ID_PCM_F64BE, MKTAG('f', 'l', '6', '4') },
+ { AV_CODEC_ID_PCM_F64LE, MKTAG('f', 'l', '6', '4') },
+ { AV_CODEC_ID_PCM_MULAW, MKTAG('u', 'l', 'a', 'w') },
+ { AV_CODEC_ID_PCM_S16BE, MKTAG('t', 'w', 'o', 's') },
+ { AV_CODEC_ID_PCM_S16LE, MKTAG('s', 'o', 'w', 't') },
+ { AV_CODEC_ID_PCM_S16LE, MKTAG('l', 'p', 'c', 'm') },
+ { AV_CODEC_ID_PCM_S24BE, MKTAG('i', 'n', '2', '4') },
+ { AV_CODEC_ID_PCM_S24LE, MKTAG('i', 'n', '2', '4') },
+ { AV_CODEC_ID_PCM_S32BE, MKTAG('i', 'n', '3', '2') },
+ { AV_CODEC_ID_PCM_S32LE, MKTAG('i', 'n', '3', '2') },
+ { AV_CODEC_ID_PCM_S8, MKTAG('s', 'o', 'w', 't') },
+ { AV_CODEC_ID_PCM_U8, MKTAG('r', 'a', 'w', ' ') },
+ { AV_CODEC_ID_PCM_U8, MKTAG('N', 'O', 'N', 'E') },
+ { AV_CODEC_ID_QCELP, MKTAG('Q', 'c', 'l', 'p') },
+ { AV_CODEC_ID_QCELP, MKTAG('Q', 'c', 'l', 'q') },
+ { AV_CODEC_ID_QCELP, MKTAG('s', 'q', 'c', 'p') }, /* ISO Media fourcc */
+ { AV_CODEC_ID_QDM2, MKTAG('Q', 'D', 'M', '2') },
+ { AV_CODEC_ID_QDMC, MKTAG('Q', 'D', 'M', 'C') },
+ { AV_CODEC_ID_SPEEX, MKTAG('s', 'p', 'e', 'x') }, /* Flash Media Server */
+ { AV_CODEC_ID_WMAV2, MKTAG('W', 'M', 'A', '2') },
+ { AV_CODEC_ID_NONE, 0 },
};
const AVCodecTag ff_codec_movsubtitle_tags[] = {
- { CODEC_ID_MOV_TEXT, MKTAG('t', 'e', 'x', 't') },
- { CODEC_ID_MOV_TEXT, MKTAG('t', 'x', '3', 'g') },
- { CODEC_ID_NONE, 0 },
+ { AV_CODEC_ID_MOV_TEXT, MKTAG('t', 'e', 'x', 't') },
+ { AV_CODEC_ID_MOV_TEXT, MKTAG('t', 'x', '3', 'g') },
+ { AV_CODEC_ID_NONE, 0 },
};
/* map numeric codes from mdhd atom to ISO 639 */
@@ -394,12 +397,12 @@ void ff_mp4_parse_es_descr(AVIOContext *pb, int *es_id)
}
static const AVCodecTag mp4_audio_types[] = {
- { CODEC_ID_MP3ON4, AOT_PS }, /* old mp3on4 draft */
- { CODEC_ID_MP3ON4, AOT_L1 }, /* layer 1 */
- { CODEC_ID_MP3ON4, AOT_L2 }, /* layer 2 */
- { CODEC_ID_MP3ON4, AOT_L3 }, /* layer 3 */
- { CODEC_ID_MP4ALS, AOT_ALS }, /* MPEG-4 ALS */
- { CODEC_ID_NONE, AOT_NULL },
+ { AV_CODEC_ID_MP3ON4, AOT_PS }, /* old mp3on4 draft */
+ { AV_CODEC_ID_MP3ON4, AOT_L1 }, /* layer 1 */
+ { AV_CODEC_ID_MP3ON4, AOT_L2 }, /* layer 2 */
+ { AV_CODEC_ID_MP3ON4, AOT_L3 }, /* layer 3 */
+ { AV_CODEC_ID_MP4ALS, AOT_ALS }, /* MPEG-4 ALS */
+ { AV_CODEC_ID_NONE, AOT_NULL },
};
int ff_mp4_read_dec_config_descr(AVFormatContext *fc, AVStream *st, AVIOContext *pb)
@@ -424,7 +427,7 @@ int ff_mp4_read_dec_config_descr(AVFormatContext *fc, AVStream *st, AVIOContext
return AVERROR(ENOMEM);
avio_read(pb, st->codec->extradata, len);
st->codec->extradata_size = len;
- if (st->codec->codec_id == CODEC_ID_AAC) {
+ if (st->codec->codec_id == AV_CODEC_ID_AAC) {
MPEG4AudioConfig cfg;
avpriv_mpeg4audio_get_config(&cfg, st->codec->extradata,
st->codec->extradata_size * 8, 1);
@@ -441,7 +444,7 @@ int ff_mp4_read_dec_config_descr(AVFormatContext *fc, AVStream *st, AVIOContext
cfg.sample_rate, cfg.ext_sample_rate);
if (!(st->codec->codec_id = ff_codec_get_id(mp4_audio_types,
cfg.object_type)))
- st->codec->codec_id = CODEC_ID_AAC;
+ st->codec->codec_id = AV_CODEC_ID_AAC;
}
}
return 0;
diff --git a/gst-libs/ext/libav/libavformat/isom.h b/gst-libs/ext/libav/libavformat/isom.h
index e6d04dc..932b1d0 100644
--- a/gst-libs/ext/libav/libavformat/isom.h
+++ b/gst-libs/ext/libav/libavformat/isom.h
@@ -30,8 +30,8 @@
/* isom.c */
extern const AVCodecTag ff_mp4_obj_type[];
-extern const AVCodecTag codec_movvideo_tags[];
-extern const AVCodecTag codec_movaudio_tags[];
+extern const AVCodecTag ff_codec_movvideo_tags[];
+extern const AVCodecTag ff_codec_movaudio_tags[];
extern const AVCodecTag ff_codec_movsubtitle_tags[];
int ff_mov_iso639_to_lang(const char lang[4], int mp4);
@@ -42,18 +42,18 @@ int ff_mov_lang_to_iso639(unsigned code, char to[4]);
* Here we just use what is needed to read the chunks
*/
-typedef struct {
+typedef struct MOVStts {
int count;
int duration;
} MOVStts;
-typedef struct {
+typedef struct MOVStsc {
int first;
int count;
int id;
} MOVStsc;
-typedef struct {
+typedef struct MOVDref {
uint32_t type;
char *path;
char *dir;
@@ -62,14 +62,14 @@ typedef struct {
int16_t nlvl_to, nlvl_from;
} MOVDref;
-typedef struct {
+typedef struct MOVAtom {
uint32_t type;
int64_t size; /* total size (excluding the size and type fields) */
} MOVAtom;
struct MOVParseTableEntry;
-typedef struct {
+typedef struct MOVFragment {
unsigned track_id;
uint64_t base_data_offset;
uint64_t moof_offset;
@@ -79,7 +79,7 @@ typedef struct {
unsigned flags;
} MOVFragment;
-typedef struct {
+typedef struct MOVTrackExt {
unsigned track_id;
unsigned stsd_id;
unsigned duration;
@@ -87,6 +87,11 @@ typedef struct {
unsigned flags;
} MOVTrackExt;
+typedef struct MOVSbgp {
+ unsigned int count;
+ unsigned int index;
+} MOVSbgp;
+
typedef struct MOVStreamContext {
AVIOContext *pb;
int ffindex; ///< AVStream index
@@ -106,6 +111,7 @@ typedef struct MOVStreamContext {
unsigned int sample_size;
unsigned int sample_count;
int *sample_sizes;
+ int keyframe_absent;
unsigned int keyframe_count;
int *keyframes;
int time_scale;
@@ -125,6 +131,10 @@ typedef struct MOVStreamContext {
int dts_shift; ///< dts shift when ctts is negative
uint32_t palette[256];
int has_palette;
+ int64_t data_size;
+ int64_t track_end; ///< used for dts generation in fragmented movie files
+ unsigned int rap_group_count;
+ MOVSbgp *rap_group;
} MOVStreamContext;
typedef struct MOVContext {
@@ -141,6 +151,7 @@ typedef struct MOVContext {
unsigned trex_count;
int itunes_metadata; ///< metadata are itunes style
int chapter_track;
+ int64_t next_root_atom; ///< offset of the next root atom
} MOVContext;
int ff_mp4_read_descr_len(AVIOContext *pb);
@@ -155,8 +166,32 @@ void ff_mp4_parse_es_descr(AVIOContext *pb, int *es_id);
#define MP4DecSpecificDescrTag 0x05
#define MP4SLDescrTag 0x06
+#define MOV_TFHD_BASE_DATA_OFFSET 0x01
+#define MOV_TFHD_STSD_ID 0x02
+#define MOV_TFHD_DEFAULT_DURATION 0x08
+#define MOV_TFHD_DEFAULT_SIZE 0x10
+#define MOV_TFHD_DEFAULT_FLAGS 0x20
+#define MOV_TFHD_DURATION_IS_EMPTY 0x010000
+
+#define MOV_TRUN_DATA_OFFSET 0x01
+#define MOV_TRUN_FIRST_SAMPLE_FLAGS 0x04
+#define MOV_TRUN_SAMPLE_DURATION 0x100
+#define MOV_TRUN_SAMPLE_SIZE 0x200
+#define MOV_TRUN_SAMPLE_FLAGS 0x400
+#define MOV_TRUN_SAMPLE_CTS 0x800
+
+#define MOV_FRAG_SAMPLE_FLAG_DEGRADATION_PRIORITY_MASK 0x0000ffff
+#define MOV_FRAG_SAMPLE_FLAG_IS_NON_SYNC 0x00010000
+#define MOV_FRAG_SAMPLE_FLAG_PADDING_MASK 0x000e0000
+#define MOV_FRAG_SAMPLE_FLAG_REDUNDANCY_MASK 0x00300000
+#define MOV_FRAG_SAMPLE_FLAG_DEPENDED_MASK 0x00c00000
+#define MOV_FRAG_SAMPLE_FLAG_DEPENDS_MASK 0x03000000
+
+#define MOV_FRAG_SAMPLE_FLAG_DEPENDS_NO 0x02000000
+#define MOV_FRAG_SAMPLE_FLAG_DEPENDS_YES 0x01000000
+
int ff_mov_read_esds(AVFormatContext *fc, AVIOContext *pb, MOVAtom atom);
-enum CodecID ff_mov_get_lpcm_codec_id(int bps, int flags);
+enum AVCodecID ff_mov_get_lpcm_codec_id(int bps, int flags);
int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries);
diff --git a/gst-libs/ext/libav/libavformat/iss.c b/gst-libs/ext/libav/libavformat/iss.c
index ec6509c..3f7f4fe 100644
--- a/gst-libs/ext/libav/libavformat/iss.c
+++ b/gst-libs/ext/libav/libavformat/iss.c
@@ -26,6 +26,7 @@
* @see http://wiki.multimedia.cx/index.php?title=FunCom_ISS
*/
+#include "libavutil/channel_layout.h"
#include "avformat.h"
#include "internal.h"
#include "libavutil/avstring.h"
@@ -65,7 +66,7 @@ static int iss_probe(AVProbeData *p)
return AVPROBE_SCORE_MAX;
}
-static av_cold int iss_read_header(AVFormatContext *s, AVFormatParameters *ap)
+static av_cold int iss_read_header(AVFormatContext *s)
{
IssDemuxContext *iss = s->priv_data;
AVIOContext *pb = s->pb;
@@ -93,8 +94,14 @@ static av_cold int iss_read_header(AVFormatContext *s, AVFormatParameters *ap)
if (!st)
return AVERROR(ENOMEM);
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
- st->codec->codec_id = CODEC_ID_ADPCM_IMA_ISS;
- st->codec->channels = stereo ? 2 : 1;
+ st->codec->codec_id = AV_CODEC_ID_ADPCM_IMA_ISS;
+ if (stereo) {
+ st->codec->channels = 2;
+ st->codec->channel_layout = AV_CH_LAYOUT_STEREO;
+ } else {
+ st->codec->channels = 1;
+ st->codec->channel_layout = AV_CH_LAYOUT_MONO;
+ }
st->codec->sample_rate = 44100;
if(rate_divisor > 0)
st->codec->sample_rate /= rate_divisor;
@@ -123,11 +130,10 @@ static int iss_read_packet(AVFormatContext *s, AVPacket *pkt)
}
AVInputFormat ff_iss_demuxer = {
- .name = "ISS",
- .long_name = NULL_IF_CONFIG_SMALL("Funcom ISS format"),
+ .name = "iss",
+ .long_name = NULL_IF_CONFIG_SMALL("Funcom ISS"),
.priv_data_size = sizeof(IssDemuxContext),
.read_probe = iss_probe,
.read_header = iss_read_header,
.read_packet = iss_read_packet,
};
-
diff --git a/gst-libs/ext/libav/libavformat/iv8.c b/gst-libs/ext/libav/libavformat/iv8.c
index 4f25441..56909e3 100644
--- a/gst-libs/ext/libav/libavformat/iv8.c
+++ b/gst-libs/ext/libav/libavformat/iv8.c
@@ -37,7 +37,7 @@ static int probe(AVProbeData *p)
return 0;
}
-static int read_header(AVFormatContext *s, AVFormatParameters *ap)
+static int read_header(AVFormatContext *s)
{
AVStream *st;
@@ -46,7 +46,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap)
return AVERROR(ENOMEM);
st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
- st->codec->codec_id = CODEC_ID_MPEG4;
+ st->codec->codec_id = AV_CODEC_ID_MPEG4;
st->need_parsing = AVSTREAM_PARSE_FULL;
avpriv_set_pts_info(st, 64, 1, 90000);
@@ -110,10 +110,9 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
AVInputFormat ff_iv8_demuxer = {
.name = "iv8",
- .long_name = NULL_IF_CONFIG_SMALL("A format generated by IndigoVision 8000 video server"),
+ .long_name = NULL_IF_CONFIG_SMALL("IndigoVision 8000 video"),
.read_probe = probe,
.read_header = read_header,
.read_packet = read_packet,
- .flags= AVFMT_GENERIC_INDEX,
- .value = CODEC_ID_MPEG4,
+ .flags = AVFMT_GENERIC_INDEX,
};
diff --git a/gst-libs/ext/libav/libavformat/ivfdec.c b/gst-libs/ext/libav/libavformat/ivfdec.c
index 03f7995..b3555f4 100644
--- a/gst-libs/ext/libav/libavformat/ivfdec.c
+++ b/gst-libs/ext/libav/libavformat/ivfdec.c
@@ -32,7 +32,7 @@ static int probe(AVProbeData *p)
return 0;
}
-static int read_header(AVFormatContext *s, AVFormatParameters *ap)
+static int read_header(AVFormatContext *s)
{
AVStream *st;
AVRational time_base;
@@ -86,6 +86,6 @@ AVInputFormat ff_ivf_demuxer = {
.read_probe = probe,
.read_header = read_header,
.read_packet = read_packet,
- .flags= AVFMT_GENERIC_INDEX,
- .codec_tag = (const AVCodecTag*[]){ff_codec_bmp_tags, 0},
+ .flags = AVFMT_GENERIC_INDEX,
+ .codec_tag = (const AVCodecTag* const []){ ff_codec_bmp_tags, 0 },
};
diff --git a/gst-libs/ext/libav/libavformat/ivfenc.c b/gst-libs/ext/libav/libavformat/ivfenc.c
index 55ce586..e045597 100644
--- a/gst-libs/ext/libav/libavformat/ivfenc.c
+++ b/gst-libs/ext/libav/libavformat/ivfenc.c
@@ -30,7 +30,7 @@ static int ivf_write_header(AVFormatContext *s)
return AVERROR(EINVAL);
}
ctx = s->streams[0]->codec;
- if (ctx->codec_type != AVMEDIA_TYPE_VIDEO || ctx->codec_id != CODEC_ID_VP8) {
+ if (ctx->codec_type != AVMEDIA_TYPE_VIDEO || ctx->codec_id != AV_CODEC_ID_VP8) {
av_log(s, AV_LOG_ERROR, "Currently only VP8 is supported!\n");
return AVERROR(EINVAL);
}
@@ -59,11 +59,11 @@ static int ivf_write_packet(AVFormatContext *s, AVPacket *pkt)
}
AVOutputFormat ff_ivf_muxer = {
- .name = "ivf",
- .long_name = NULL_IF_CONFIG_SMALL("On2 IVF"),
- .extensions = "ivf",
- .audio_codec = CODEC_ID_NONE,
- .video_codec = CODEC_ID_VP8,
+ .name = "ivf",
+ .long_name = NULL_IF_CONFIG_SMALL("On2 IVF"),
+ .extensions = "ivf",
+ .audio_codec = AV_CODEC_ID_NONE,
+ .video_codec = AV_CODEC_ID_VP8,
.write_header = ivf_write_header,
.write_packet = ivf_write_packet,
};
diff --git a/gst-libs/ext/libav/libavformat/jvdec.c b/gst-libs/ext/libav/libavformat/jvdec.c
index c24b0c2..cf9df8c 100644
--- a/gst-libs/ext/libav/libavformat/jvdec.c
+++ b/gst-libs/ext/libav/libavformat/jvdec.c
@@ -25,6 +25,7 @@
* @author Peter Ross <pross@xvid.org>
*/
+#include "libavutil/channel_layout.h"
#include "libavutil/intreadwrite.h"
#include "avformat.h"
#include "internal.h"
@@ -58,8 +59,7 @@ static int read_probe(AVProbeData *pd)
return 0;
}
-static int read_header(AVFormatContext *s,
- AVFormatParameters *ap)
+static int read_header(AVFormatContext *s)
{
JVDemuxContext *jv = s->priv_data;
AVIOContext *pb = s->pb;
@@ -76,10 +76,11 @@ static int read_header(AVFormatContext *s,
return AVERROR(ENOMEM);
vst->codec->codec_type = AVMEDIA_TYPE_VIDEO;
- vst->codec->codec_id = CODEC_ID_JV;
+ vst->codec->codec_id = AV_CODEC_ID_JV;
vst->codec->codec_tag = 0; /* no fourcc */
vst->codec->width = avio_rl16(pb);
vst->codec->height = avio_rl16(pb);
+ vst->duration =
vst->nb_frames =
ast->nb_index_entries = avio_rl16(pb);
avpriv_set_pts_info(vst, 64, avio_rl16(pb), 1000);
@@ -87,10 +88,11 @@ static int read_header(AVFormatContext *s,
avio_skip(pb, 4);
ast->codec->codec_type = AVMEDIA_TYPE_AUDIO;
- ast->codec->codec_id = CODEC_ID_PCM_U8;
+ ast->codec->codec_id = AV_CODEC_ID_PCM_U8;
ast->codec->codec_tag = 0; /* no fourcc */
ast->codec->sample_rate = avio_rl16(pb);
ast->codec->channels = 1;
+ ast->codec->channel_layout = AV_CH_LAYOUT_MONO;
avpriv_set_pts_info(ast, 64, 1, ast->codec->sample_rate);
avio_skip(pb, 10);
@@ -208,10 +210,11 @@ static int read_seek(AVFormatContext *s, int stream_index,
if (i < 0 || i >= ast->nb_index_entries)
return 0;
+ if (avio_seek(s->pb, ast->index_entries[i].pos, SEEK_SET) < 0)
+ return -1;
jv->state = JV_AUDIO;
jv->pts = i;
- avio_seek(s->pb, ast->index_entries[i].pos, SEEK_SET);
return 0;
}
diff --git a/gst-libs/ext/libav/libavformat/latmenc.c b/gst-libs/ext/libav/libavformat/latmenc.c
index 423710d..7270292 100644
--- a/gst-libs/ext/libav/libavformat/latmenc.c
+++ b/gst-libs/ext/libav/libavformat/latmenc.c
@@ -37,7 +37,7 @@ typedef struct {
static const AVOption options[] = {
{"smc-interval", "StreamMuxConfig interval.",
- offsetof(LATMContext, mod), AV_OPT_TYPE_INT, {.dbl = 0x0014}, 0x0001, 0xffff, AV_OPT_FLAG_ENCODING_PARAM},
+ offsetof(LATMContext, mod), AV_OPT_TYPE_INT, {.i64 = 0x0014}, 0x0001, 0xffff, AV_OPT_FLAG_ENCODING_PARAM},
{NULL},
};
@@ -183,8 +183,8 @@ AVOutputFormat ff_latm_muxer = {
.mime_type = "audio/MP4A-LATM",
.extensions = "latm",
.priv_data_size = sizeof(LATMContext),
- .audio_codec = CODEC_ID_AAC,
- .video_codec = CODEC_ID_NONE,
+ .audio_codec = AV_CODEC_ID_AAC,
+ .video_codec = AV_CODEC_ID_NONE,
.write_header = latm_write_header,
.write_packet = latm_write_packet,
.priv_class = &latm_muxer_class,
diff --git a/gst-libs/ext/libav/libavformat/libavformat.v b/gst-libs/ext/libav/libavformat/libavformat.v
index c5dc982..6f11d60 100644
--- a/gst-libs/ext/libav/libavformat/libavformat.v
+++ b/gst-libs/ext/libav/libavformat/libavformat.v
@@ -1,29 +1,4 @@
LIBAVFORMAT_$MAJOR {
global: av*;
- #FIXME those are for avserver
- ff_inet_aton;
- ff_socket_nonblock;
- ffm_set_write_index;
- ffm_read_write_index;
- ffm_write_write_index;
- ff_rtsp_parse_line;
- ff_rtp_get_local_rtp_port;
- ff_rtp_get_local_rtcp_port;
- ffio_open_dyn_packet_buf;
- url_open;
- url_close;
- url_write;
- url_get_max_packet_size;
- #those are deprecated, remove on next bump
- find_info_tag;
- parse_date;
- dump_format;
- url_*;
- get_*;
- put_*;
- udp_set_remote_url;
- udp_get_local_port;
- init_checksum;
- init_put_byte;
local: *;
};
diff --git a/gst-libs/ext/libav/libavformat/libnut.c b/gst-libs/ext/libav/libavformat/libnut.c
deleted file mode 100644
index 56e8bfc..0000000
--- a/gst-libs/ext/libav/libavformat/libnut.c
+++ /dev/null
@@ -1,311 +0,0 @@
-/*
- * NUT (de)muxing via libnut
- * copyright (c) 2006 Oded Shimon <ods15@ods15.dyndns.org>
- *
- * 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
- * NUT demuxing and muxing via libnut.
- * @author Oded Shimon <ods15@ods15.dyndns.org>
- */
-
-#include "avformat.h"
-#include "internal.h"
-#include "riff.h"
-#include <libnut.h>
-
-#define ID_STRING "nut/multimedia container"
-#define ID_LENGTH (strlen(ID_STRING) + 1)
-
-typedef struct {
- nut_context_tt * nut;
- nut_stream_header_tt * s;
-} NUTContext;
-
-static const AVCodecTag nut_tags[] = {
- { CODEC_ID_MPEG4, MKTAG('m', 'p', '4', 'v') },
- { CODEC_ID_MP3, MKTAG('m', 'p', '3', ' ') },
- { CODEC_ID_VORBIS, MKTAG('v', 'r', 'b', 's') },
- { 0, 0 },
-};
-
-#if CONFIG_LIBNUT_MUXER
-static int av_write(void * h, size_t len, const uint8_t * buf) {
- AVIOContext * bc = h;
- avio_write(bc, buf, len);
- //avio_flush(bc);
- return len;
-}
-
-static int nut_write_header(AVFormatContext * avf) {
- NUTContext * priv = avf->priv_data;
- AVIOContext * bc = avf->pb;
- nut_muxer_opts_tt mopts = {
- .output = {
- .priv = bc,
- .write = av_write,
- },
- .alloc = { av_malloc, av_realloc, av_free },
- .write_index = 1,
- .realtime_stream = 0,
- .max_distance = 32768,
- .fti = NULL,
- };
- nut_stream_header_tt * s;
- int i;
-
- priv->s = s = av_mallocz((avf->nb_streams + 1) * sizeof*s);
-
- for (i = 0; i < avf->nb_streams; i++) {
- AVCodecContext * codec = avf->streams[i]->codec;
- int j;
- int fourcc = 0;
- int num, denom, ssize;
-
- s[i].type = codec->codec_type == AVMEDIA_TYPE_VIDEO ? NUT_VIDEO_CLASS : NUT_AUDIO_CLASS;
-
- if (codec->codec_tag) fourcc = codec->codec_tag;
- else fourcc = ff_codec_get_tag(nut_tags, codec->codec_id);
-
- if (!fourcc) {
- if (codec->codec_type == AVMEDIA_TYPE_VIDEO) fourcc = ff_codec_get_tag(ff_codec_bmp_tags, codec->codec_id);
- if (codec->codec_type == AVMEDIA_TYPE_AUDIO) fourcc = ff_codec_get_tag(ff_codec_wav_tags, codec->codec_id);
- }
-
- s[i].fourcc_len = 4;
- s[i].fourcc = av_malloc(s[i].fourcc_len);
- for (j = 0; j < s[i].fourcc_len; j++) s[i].fourcc[j] = (fourcc >> (j*8)) & 0xFF;
-
- ff_parse_specific_params(codec, &num, &ssize, &denom);
- avpriv_set_pts_info(avf->streams[i], 60, denom, num);
-
- s[i].time_base.num = denom;
- s[i].time_base.den = num;
-
- s[i].fixed_fps = 0;
- s[i].decode_delay = codec->has_b_frames;
- s[i].codec_specific_len = codec->extradata_size;
- s[i].codec_specific = codec->extradata;
-
- if (codec->codec_type == AVMEDIA_TYPE_VIDEO) {
- s[i].width = codec->width;
- s[i].height = codec->height;
- s[i].sample_width = 0;
- s[i].sample_height = 0;
- s[i].colorspace_type = 0;
- } else {
- s[i].samplerate_num = codec->sample_rate;
- s[i].samplerate_denom = 1;
- s[i].channel_count = codec->channels;
- }
- }
-
- s[avf->nb_streams].type = -1;
- priv->nut = nut_muxer_init(&mopts, s, NULL);
-
- return 0;
-}
-
-static int nut_write_packet(AVFormatContext * avf, AVPacket * pkt) {
- NUTContext * priv = avf->priv_data;
- nut_packet_tt p;
-
- p.len = pkt->size;
- p.stream = pkt->stream_index;
- p.pts = pkt->pts;
- p.flags = pkt->flags & AV_PKT_FLAG_KEY ? NUT_FLAG_KEY : 0;
- p.next_pts = 0;
-
- nut_write_frame_reorder(priv->nut, &p, pkt->data);
-
- return 0;
-}
-
-static int nut_write_trailer(AVFormatContext * avf) {
- AVIOContext * bc = avf->pb;
- NUTContext * priv = avf->priv_data;
- int i;
-
- nut_muxer_uninit_reorder(priv->nut);
- avio_flush(bc);
-
- for(i = 0; priv->s[i].type != -1; i++ ) av_freep(&priv->s[i].fourcc);
- av_freep(&priv->s);
-
- return 0;
-}
-
-AVOutputFormat ff_libnut_muxer = {
- .name = "libnut",
- .long_name = "nut format",
- .mime_type = "video/x-nut",
- .extensions = "nut",
- .priv_data_size = sizeof(NUTContext),
- .audio_codec = CODEC_ID_VORBIS,
- .video_codec = CODEC_ID_MPEG4,
- .write_header = nut_write_header,
- .write_packet = nut_write_packet,
- .write_trailer = nut_write_trailer,
- .flags = AVFMT_GLOBALHEADER,
-};
-#endif /* CONFIG_LIBNUT_MUXER */
-
-static int nut_probe(AVProbeData *p) {
- if (!memcmp(p->buf, ID_STRING, ID_LENGTH)) return AVPROBE_SCORE_MAX;
-
- return 0;
-}
-
-static size_t av_read(void * h, size_t len, uint8_t * buf) {
- AVIOContext * bc = h;
- return avio_read(bc, buf, len);
-}
-
-static off_t av_seek(void * h, long long pos, int whence) {
- AVIOContext * bc = h;
- if (whence == SEEK_END) {
- pos = avio_size(bc) + pos;
- whence = SEEK_SET;
- }
- return avio_seek(bc, pos, whence);
-}
-
-static int nut_read_header(AVFormatContext * avf, AVFormatParameters * ap) {
- NUTContext * priv = avf->priv_data;
- AVIOContext * bc = avf->pb;
- nut_demuxer_opts_tt dopts = {
- .input = {
- .priv = bc,
- .seek = av_seek,
- .read = av_read,
- .eof = NULL,
- .file_pos = 0,
- },
- .alloc = { av_malloc, av_realloc, av_free },
- .read_index = 1,
- .cache_syncpoints = 1,
- };
- nut_context_tt * nut = priv->nut = nut_demuxer_init(&dopts);
- nut_stream_header_tt * s;
- int ret, i;
-
- if ((ret = nut_read_headers(nut, &s, NULL))) {
- av_log(avf, AV_LOG_ERROR, " NUT error: %s\n", nut_error(ret));
- nut_demuxer_uninit(nut);
- return -1;
- }
-
- priv->s = s;
-
- for (i = 0; s[i].type != -1 && i < 2; i++) {
- AVStream * st = avformat_new_stream(avf, NULL);
- int j;
-
- for (j = 0; j < s[i].fourcc_len && j < 8; j++) st->codec->codec_tag |= s[i].fourcc[j]<<(j*8);
-
- st->codec->has_b_frames = s[i].decode_delay;
-
- st->codec->extradata_size = s[i].codec_specific_len;
- if (st->codec->extradata_size) {
- st->codec->extradata = av_mallocz(st->codec->extradata_size);
- memcpy(st->codec->extradata, s[i].codec_specific, st->codec->extradata_size);
- }
-
- avpriv_set_pts_info(avf->streams[i], 60, s[i].time_base.num, s[i].time_base.den);
- st->start_time = 0;
- st->duration = s[i].max_pts;
-
- st->codec->codec_id = ff_codec_get_id(nut_tags, st->codec->codec_tag);
-
- switch(s[i].type) {
- case NUT_AUDIO_CLASS:
- st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
- if (st->codec->codec_id == CODEC_ID_NONE) st->codec->codec_id = ff_codec_get_id(ff_codec_wav_tags, st->codec->codec_tag);
-
- st->codec->channels = s[i].channel_count;
- st->codec->sample_rate = s[i].samplerate_num / s[i].samplerate_denom;
- break;
- case NUT_VIDEO_CLASS:
- st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
- if (st->codec->codec_id == CODEC_ID_NONE) st->codec->codec_id = ff_codec_get_id(ff_codec_bmp_tags, st->codec->codec_tag);
-
- st->codec->width = s[i].width;
- st->codec->height = s[i].height;
- st->sample_aspect_ratio.num = s[i].sample_width;
- st->sample_aspect_ratio.den = s[i].sample_height;
- break;
- }
- if (st->codec->codec_id == CODEC_ID_NONE) av_log(avf, AV_LOG_ERROR, "Unknown codec?!\n");
- }
-
- return 0;
-}
-
-static int nut_read_packet(AVFormatContext * avf, AVPacket * pkt) {
- NUTContext * priv = avf->priv_data;
- nut_packet_tt pd;
- int ret;
-
- ret = nut_read_next_packet(priv->nut, &pd);
-
- if (ret || av_new_packet(pkt, pd.len) < 0) {
- if (ret != NUT_ERR_EOF)
- av_log(avf, AV_LOG_ERROR, " NUT error: %s\n", nut_error(ret));
- return -1;
- }
-
- if (pd.flags & NUT_FLAG_KEY) pkt->flags |= AV_PKT_FLAG_KEY;
- pkt->pts = pd.pts;
- pkt->stream_index = pd.stream;
- pkt->pos = avio_tell(avf->pb);
-
- ret = nut_read_frame(priv->nut, &pd.len, pkt->data);
-
- return ret;
-}
-
-static int nut_read_seek(AVFormatContext * avf, int stream_index, int64_t target_ts, int flags) {
- NUTContext * priv = avf->priv_data;
- int active_streams[] = { stream_index, -1 };
- double time_pos = target_ts * priv->s[stream_index].time_base.num / (double)priv->s[stream_index].time_base.den;
-
- if (nut_seek(priv->nut, time_pos, 2*!(flags & AVSEEK_FLAG_BACKWARD), active_streams)) return -1;
-
- return 0;
-}
-
-static int nut_read_close(AVFormatContext *s) {
- NUTContext * priv = s->priv_data;
-
- nut_demuxer_uninit(priv->nut);
-
- return 0;
-}
-
-AVInputFormat ff_libnut_demuxer = {
- .name = "libnut",
- .long_name = NULL_IF_CONFIG_SMALL("NUT format"),
- .priv_data_size = sizeof(NUTContext),
- .read_probe = nut_probe,
- .read_header = nut_read_header,
- .read_packet = nut_read_packet,
- .read_close = nut_read_close,
- .read_seek = nut_read_seek,
- .extensions = "nut",
-};
diff --git a/gst-libs/ext/libav/libavformat/librtmp.c b/gst-libs/ext/libav/libavformat/librtmp.c
index 2d028b0..7133bd6 100644
--- a/gst-libs/ext/libav/libavformat/librtmp.c
+++ b/gst-libs/ext/libav/libavformat/librtmp.c
@@ -24,13 +24,22 @@
* RTMP protocol based on http://rtmpdump.mplayerhq.hu/ librtmp
*/
+#include "libavutil/avstring.h"
#include "libavutil/mathematics.h"
+#include "libavutil/opt.h"
#include "avformat.h"
#include "url.h"
#include <librtmp/rtmp.h>
#include <librtmp/log.h>
+typedef struct LibRTMPContext {
+ const AVClass *class;
+ RTMP rtmp;
+ char *app;
+ char *playpath;
+} LibRTMPContext;
+
static void rtmp_log(int level, const char *fmt, va_list args)
{
switch (level) {
@@ -49,7 +58,8 @@ static void rtmp_log(int level, const char *fmt, va_list args)
static int rtmp_close(URLContext *s)
{
- RTMP *r = s->priv_data;
+ LibRTMPContext *ctx = s->priv_data;
+ RTMP *r = &ctx->rtmp;
RTMP_Close(r);
return 0;
@@ -69,24 +79,45 @@ static int rtmp_close(URLContext *s)
*/
static int rtmp_open(URLContext *s, const char *uri, int flags)
{
- RTMP *r = s->priv_data;
- int rc;
+ LibRTMPContext *ctx = s->priv_data;
+ RTMP *r = &ctx->rtmp;
+ int rc = 0, level;
+ char *filename = s->filename;
switch (av_log_get_level()) {
default:
- case AV_LOG_FATAL: rc = RTMP_LOGCRIT; break;
- case AV_LOG_ERROR: rc = RTMP_LOGERROR; break;
- case AV_LOG_WARNING: rc = RTMP_LOGWARNING; break;
- case AV_LOG_INFO: rc = RTMP_LOGINFO; break;
- case AV_LOG_VERBOSE: rc = RTMP_LOGDEBUG; break;
- case AV_LOG_DEBUG: rc = RTMP_LOGDEBUG2; break;
+ case AV_LOG_FATAL: level = RTMP_LOGCRIT; break;
+ case AV_LOG_ERROR: level = RTMP_LOGERROR; break;
+ case AV_LOG_WARNING: level = RTMP_LOGWARNING; break;
+ case AV_LOG_INFO: level = RTMP_LOGINFO; break;
+ case AV_LOG_VERBOSE: level = RTMP_LOGDEBUG; break;
+ case AV_LOG_DEBUG: level = RTMP_LOGDEBUG2; break;
}
- RTMP_LogSetLevel(rc);
+ RTMP_LogSetLevel(level);
RTMP_LogSetCallback(rtmp_log);
+ if (ctx->app || ctx->playpath) {
+ int len = strlen(s->filename) + 1;
+ if (ctx->app) len += strlen(ctx->app) + sizeof(" app=");
+ if (ctx->playpath) len += strlen(ctx->playpath) + sizeof(" playpath=");
+
+ if (!(filename = av_malloc(len)))
+ return AVERROR(ENOMEM);
+
+ av_strlcpy(filename, s->filename, len);
+ if (ctx->app) {
+ av_strlcat(filename, " app=", len);
+ av_strlcat(filename, ctx->app, len);
+ }
+ if (ctx->playpath) {
+ av_strlcat(filename, " playpath=", len);
+ av_strlcat(filename, ctx->playpath, len);
+ }
+ }
+
RTMP_Init(r);
- if (!RTMP_SetupURL(r, s->filename)) {
- rc = -1;
+ if (!RTMP_SetupURL(r, filename)) {
+ rc = AVERROR_UNKNOWN;
goto fail;
}
@@ -94,43 +125,49 @@ static int rtmp_open(URLContext *s, const char *uri, int flags)
RTMP_EnableWrite(r);
if (!RTMP_Connect(r, NULL) || !RTMP_ConnectStream(r, 0)) {
- rc = -1;
+ rc = AVERROR_UNKNOWN;
goto fail;
}
s->is_streamed = 1;
- return 0;
+ rc = 0;
fail:
+ if (filename != s->filename)
+ av_freep(&filename);
return rc;
}
static int rtmp_write(URLContext *s, const uint8_t *buf, int size)
{
- RTMP *r = s->priv_data;
+ LibRTMPContext *ctx = s->priv_data;
+ RTMP *r = &ctx->rtmp;
return RTMP_Write(r, buf, size);
}
static int rtmp_read(URLContext *s, uint8_t *buf, int size)
{
- RTMP *r = s->priv_data;
+ LibRTMPContext *ctx = s->priv_data;
+ RTMP *r = &ctx->rtmp;
return RTMP_Read(r, buf, size);
}
static int rtmp_read_pause(URLContext *s, int pause)
{
- RTMP *r = s->priv_data;
+ LibRTMPContext *ctx = s->priv_data;
+ RTMP *r = &ctx->rtmp;
if (!RTMP_Pause(r, pause))
- return -1;
+ return AVERROR_UNKNOWN;
return 0;
}
static int64_t rtmp_read_seek(URLContext *s, int stream_index,
int64_t timestamp, int flags)
{
- RTMP *r = s->priv_data;
+ LibRTMPContext *ctx = s->priv_data;
+ RTMP *r = &ctx->rtmp;
if (flags & AVSEEK_FLAG_BYTE)
return AVERROR(ENOSYS);
@@ -141,18 +178,37 @@ static int64_t rtmp_read_seek(URLContext *s, int stream_index,
flags & AVSEEK_FLAG_BACKWARD ? AV_ROUND_DOWN : AV_ROUND_UP);
if (!RTMP_SendSeek(r, timestamp))
- return -1;
+ return AVERROR_UNKNOWN;
return timestamp;
}
static int rtmp_get_file_handle(URLContext *s)
{
- RTMP *r = s->priv_data;
+ LibRTMPContext *ctx = s->priv_data;
+ RTMP *r = &ctx->rtmp;
return RTMP_Socket(r);
}
-URLProtocol ff_rtmp_protocol = {
+#define OFFSET(x) offsetof(LibRTMPContext, x)
+#define DEC AV_OPT_FLAG_DECODING_PARAM
+#define ENC AV_OPT_FLAG_ENCODING_PARAM
+static const AVOption options[] = {
+ {"rtmp_app", "Name of application to connect to on the RTMP server", OFFSET(app), AV_OPT_TYPE_STRING, {.str = NULL }, 0, 0, DEC|ENC},
+ {"rtmp_playpath", "Stream identifier to play or to publish", OFFSET(playpath), AV_OPT_TYPE_STRING, {.str = NULL }, 0, 0, DEC|ENC},
+ { NULL },
+};
+
+#define RTMP_CLASS(flavor)\
+static const AVClass lib ## flavor ## _class = {\
+ .class_name = "lib" #flavor " protocol",\
+ .item_name = av_default_item_name,\
+ .option = options,\
+ .version = LIBAVUTIL_VERSION_INT,\
+};
+
+RTMP_CLASS(rtmp)
+URLProtocol ff_librtmp_protocol = {
.name = "rtmp",
.url_open = rtmp_open,
.url_read = rtmp_read,
@@ -161,11 +217,13 @@ URLProtocol ff_rtmp_protocol = {
.url_read_pause = rtmp_read_pause,
.url_read_seek = rtmp_read_seek,
.url_get_file_handle = rtmp_get_file_handle,
- .priv_data_size = sizeof(RTMP),
+ .priv_data_size = sizeof(LibRTMPContext),
+ .priv_data_class = &librtmp_class,
.flags = URL_PROTOCOL_FLAG_NETWORK,
};
-URLProtocol ff_rtmpt_protocol = {
+RTMP_CLASS(rtmpt)
+URLProtocol ff_librtmpt_protocol = {
.name = "rtmpt",
.url_open = rtmp_open,
.url_read = rtmp_read,
@@ -174,11 +232,13 @@ URLProtocol ff_rtmpt_protocol = {
.url_read_pause = rtmp_read_pause,
.url_read_seek = rtmp_read_seek,
.url_get_file_handle = rtmp_get_file_handle,
- .priv_data_size = sizeof(RTMP),
+ .priv_data_size = sizeof(LibRTMPContext),
+ .priv_data_class = &librtmpt_class,
.flags = URL_PROTOCOL_FLAG_NETWORK,
};
-URLProtocol ff_rtmpe_protocol = {
+RTMP_CLASS(rtmpe)
+URLProtocol ff_librtmpe_protocol = {
.name = "rtmpe",
.url_open = rtmp_open,
.url_read = rtmp_read,
@@ -187,11 +247,13 @@ URLProtocol ff_rtmpe_protocol = {
.url_read_pause = rtmp_read_pause,
.url_read_seek = rtmp_read_seek,
.url_get_file_handle = rtmp_get_file_handle,
- .priv_data_size = sizeof(RTMP),
+ .priv_data_size = sizeof(LibRTMPContext),
+ .priv_data_class = &librtmpe_class,
.flags = URL_PROTOCOL_FLAG_NETWORK,
};
-URLProtocol ff_rtmpte_protocol = {
+RTMP_CLASS(rtmpte)
+URLProtocol ff_librtmpte_protocol = {
.name = "rtmpte",
.url_open = rtmp_open,
.url_read = rtmp_read,
@@ -200,11 +262,13 @@ URLProtocol ff_rtmpte_protocol = {
.url_read_pause = rtmp_read_pause,
.url_read_seek = rtmp_read_seek,
.url_get_file_handle = rtmp_get_file_handle,
- .priv_data_size = sizeof(RTMP),
+ .priv_data_size = sizeof(LibRTMPContext),
+ .priv_data_class = &librtmpte_class,
.flags = URL_PROTOCOL_FLAG_NETWORK,
};
-URLProtocol ff_rtmps_protocol = {
+RTMP_CLASS(rtmps)
+URLProtocol ff_librtmps_protocol = {
.name = "rtmps",
.url_open = rtmp_open,
.url_read = rtmp_read,
@@ -213,6 +277,7 @@ URLProtocol ff_rtmps_protocol = {
.url_read_pause = rtmp_read_pause,
.url_read_seek = rtmp_read_seek,
.url_get_file_handle = rtmp_get_file_handle,
- .priv_data_size = sizeof(RTMP),
+ .priv_data_size = sizeof(LibRTMPContext),
+ .priv_data_class = &librtmps_class,
.flags = URL_PROTOCOL_FLAG_NETWORK,
};
diff --git a/gst-libs/ext/libav/libavformat/lmlm4.c b/gst-libs/ext/libav/libavformat/lmlm4.c
index 5f26c4b..b67b68e 100644
--- a/gst-libs/ext/libav/libavformat/lmlm4.c
+++ b/gst-libs/ext/libav/libavformat/lmlm4.c
@@ -58,20 +58,20 @@ static int lmlm4_probe(AVProbeData * pd) {
return 0;
}
-static int lmlm4_read_header(AVFormatContext *s, AVFormatParameters *ap) {
+static int lmlm4_read_header(AVFormatContext *s) {
AVStream *st;
if (!(st = avformat_new_stream(s, NULL)))
return AVERROR(ENOMEM);
st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
- st->codec->codec_id = CODEC_ID_MPEG4;
+ st->codec->codec_id = AV_CODEC_ID_MPEG4;
st->need_parsing = AVSTREAM_PARSE_HEADERS;
avpriv_set_pts_info(st, 64, 1001, 30000);
if (!(st = avformat_new_stream(s, NULL)))
return AVERROR(ENOMEM);
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
- st->codec->codec_id = CODEC_ID_MP2;
+ st->codec->codec_id = AV_CODEC_ID_MP2;
st->need_parsing = AVSTREAM_PARSE_HEADERS;
/* the parameters will be extracted from the compressed bitstream */
@@ -120,7 +120,7 @@ static int lmlm4_read_packet(AVFormatContext *s, AVPacket *pkt) {
AVInputFormat ff_lmlm4_demuxer = {
.name = "lmlm4",
- .long_name = NULL_IF_CONFIG_SMALL("lmlm4 raw format"),
+ .long_name = NULL_IF_CONFIG_SMALL("raw lmlm4"),
.read_probe = lmlm4_probe,
.read_header = lmlm4_read_header,
.read_packet = lmlm4_read_packet,
diff --git a/gst-libs/ext/libav/libavformat/log2_tab.c b/gst-libs/ext/libav/libavformat/log2_tab.c
new file mode 100644
index 0000000..47a1df0
--- /dev/null
+++ b/gst-libs/ext/libav/libavformat/log2_tab.c
@@ -0,0 +1 @@
+#include "libavutil/log2_tab.c"
diff --git a/gst-libs/ext/libav/libavformat/lxfdec.c b/gst-libs/ext/libav/libavformat/lxfdec.c
index b3afa7e..a10dcca 100644
--- a/gst-libs/ext/libav/libavformat/lxfdec.c
+++ b/gst-libs/ext/libav/libavformat/lxfdec.c
@@ -22,7 +22,6 @@
#include "libavutil/intreadwrite.h"
#include "avformat.h"
#include "internal.h"
-#include "riff.h"
#define LXF_PACKET_HEADER_SIZE 60
#define LXF_HEADER_DATA_SIZE 120
@@ -32,17 +31,17 @@
#define LXF_MAX_AUDIO_PACKET (8008*15*4) ///< 15-channel 32-bit NTSC audio frame
static const AVCodecTag lxf_tags[] = {
- { CODEC_ID_MJPEG, 0 },
- { CODEC_ID_MPEG1VIDEO, 1 },
- { CODEC_ID_MPEG2VIDEO, 2 }, //MpMl, 4:2:0
- { CODEC_ID_MPEG2VIDEO, 3 }, //MpPl, 4:2:2
- { CODEC_ID_DVVIDEO, 4 }, //DV25
- { CODEC_ID_DVVIDEO, 5 }, //DVCPRO
- { CODEC_ID_DVVIDEO, 6 }, //DVCPRO50
- { CODEC_ID_RAWVIDEO, 7 }, //PIX_FMT_ARGB, where alpha is used for chroma keying
- { CODEC_ID_RAWVIDEO, 8 }, //16-bit chroma key
- { CODEC_ID_MPEG2VIDEO, 9 }, //4:2:2 CBP ("Constrained Bytes per Gop")
- { CODEC_ID_NONE, 0 },
+ { AV_CODEC_ID_MJPEG, 0 },
+ { AV_CODEC_ID_MPEG1VIDEO, 1 },
+ { AV_CODEC_ID_MPEG2VIDEO, 2 }, //MpMl, 4:2:0
+ { AV_CODEC_ID_MPEG2VIDEO, 3 }, //MpPl, 4:2:2
+ { AV_CODEC_ID_DVVIDEO, 4 }, //DV25
+ { AV_CODEC_ID_DVVIDEO, 5 }, //DVCPRO
+ { AV_CODEC_ID_DVVIDEO, 6 }, //DVCPRO50
+ { AV_CODEC_ID_RAWVIDEO, 7 }, //AV_PIX_FMT_ARGB, where alpha is used for chroma keying
+ { AV_CODEC_ID_RAWVIDEO, 8 }, //16-bit chroma key
+ { AV_CODEC_ID_MPEG2VIDEO, 9 }, //4:2:2 CBP ("Constrained Bytes per Gop")
+ { AV_CODEC_ID_NONE, 0 },
};
typedef struct {
@@ -159,10 +158,10 @@ static int get_packet_header(AVFormatContext *s, uint8_t *header, uint32_t *form
}
switch (st->codec->bits_per_coded_sample) {
- case 16: st->codec->codec_id = CODEC_ID_PCM_S16LE; break;
- case 20: st->codec->codec_id = CODEC_ID_PCM_LXF; break;
- case 24: st->codec->codec_id = CODEC_ID_PCM_S24LE; break;
- case 32: st->codec->codec_id = CODEC_ID_PCM_S32LE; break;
+ case 16: st->codec->codec_id = AV_CODEC_ID_PCM_S16LE; break;
+ case 20: st->codec->codec_id = AV_CODEC_ID_PCM_LXF; break;
+ case 24: st->codec->codec_id = AV_CODEC_ID_PCM_S24LE; break;
+ case 32: st->codec->codec_id = AV_CODEC_ID_PCM_S32LE; break;
default:
av_log(s, AV_LOG_WARNING,
"only 16-, 20-, 24- and 32-bit PCM currently supported\n");
@@ -196,7 +195,7 @@ static int get_packet_header(AVFormatContext *s, uint8_t *header, uint32_t *form
return ret;
}
-static int lxf_read_header(AVFormatContext *s, AVFormatParameters *ap)
+static int lxf_read_header(AVFormatContext *s)
{
LXFDemuxContext *lxf = s->priv_data;
AVIOContext *pb = s->pb;
@@ -314,7 +313,7 @@ static int lxf_read_packet(AVFormatContext *s, AVPacket *pkt)
return ret2;
//read non-20-bit audio data into lxf->temp so we can deplanarize it
- buf = ast && ast->codec->codec_id != CODEC_ID_PCM_LXF ? lxf->temp : pkt->data;
+ buf = ast && ast->codec->codec_id != AV_CODEC_ID_PCM_LXF ? lxf->temp : pkt->data;
if ((ret2 = avio_read(pb, buf, ret)) != ret) {
av_free_packet(pkt);
@@ -324,7 +323,7 @@ static int lxf_read_packet(AVFormatContext *s, AVPacket *pkt)
pkt->stream_index = stream;
if (ast) {
- if(ast->codec->codec_id != CODEC_ID_PCM_LXF)
+ if(ast->codec->codec_id != AV_CODEC_ID_PCM_LXF)
deplanarize(lxf, ast, pkt->data, ret);
} else {
//picture type (0 = closed I, 1 = open I, 2 = P, 3 = B)
@@ -339,11 +338,10 @@ static int lxf_read_packet(AVFormatContext *s, AVPacket *pkt)
AVInputFormat ff_lxf_demuxer = {
.name = "lxf",
- .long_name = NULL_IF_CONFIG_SMALL("VR native stream format (LXF)"),
+ .long_name = NULL_IF_CONFIG_SMALL("VR native stream (LXF)"),
.priv_data_size = sizeof(LXFDemuxContext),
.read_probe = lxf_probe,
.read_header = lxf_read_header,
.read_packet = lxf_read_packet,
.codec_tag = (const AVCodecTag* const []){lxf_tags, 0},
};
-
diff --git a/gst-libs/ext/libav/libavformat/m4vdec.c b/gst-libs/ext/libav/libavformat/m4vdec.c
index e856aad..4bee058 100644
--- a/gst-libs/ext/libav/libavformat/m4vdec.c
+++ b/gst-libs/ext/libav/libavformat/m4vdec.c
@@ -49,4 +49,4 @@ static int mpeg4video_probe(AVProbeData *probe_packet)
return 0;
}
-FF_DEF_RAWVIDEO_DEMUXER(m4v, "raw MPEG-4 video format", mpeg4video_probe, "m4v", CODEC_ID_MPEG4)
+FF_DEF_RAWVIDEO_DEMUXER(m4v, "raw MPEG-4 video", mpeg4video_probe, "m4v", AV_CODEC_ID_MPEG4)
diff --git a/gst-libs/ext/libav/libavformat/matroska.c b/gst-libs/ext/libav/libavformat/matroska.c
index b448af2..edb7ab7 100644
--- a/gst-libs/ext/libav/libavformat/matroska.c
+++ b/gst-libs/ext/libav/libavformat/matroska.c
@@ -22,76 +22,78 @@
#include "matroska.h"
const CodecTags ff_mkv_codec_tags[]={
- {"A_AAC" , CODEC_ID_AAC},
- {"A_AC3" , CODEC_ID_AC3},
- {"A_DTS" , CODEC_ID_DTS},
- {"A_EAC3" , CODEC_ID_EAC3},
- {"A_FLAC" , CODEC_ID_FLAC},
- {"A_MLP" , CODEC_ID_MLP},
- {"A_MPEG/L2" , CODEC_ID_MP2},
- {"A_MPEG/L1" , CODEC_ID_MP2},
- {"A_MPEG/L3" , CODEC_ID_MP3},
- {"A_PCM/FLOAT/IEEE" , CODEC_ID_PCM_F32LE},
- {"A_PCM/FLOAT/IEEE" , CODEC_ID_PCM_F64LE},
- {"A_PCM/INT/BIG" , CODEC_ID_PCM_S16BE},
- {"A_PCM/INT/BIG" , CODEC_ID_PCM_S24BE},
- {"A_PCM/INT/BIG" , CODEC_ID_PCM_S32BE},
- {"A_PCM/INT/LIT" , CODEC_ID_PCM_S16LE},
- {"A_PCM/INT/LIT" , CODEC_ID_PCM_S24LE},
- {"A_PCM/INT/LIT" , CODEC_ID_PCM_S32LE},
- {"A_PCM/INT/LIT" , CODEC_ID_PCM_U8},
- {"A_QUICKTIME/QDM2" , CODEC_ID_QDM2},
- {"A_REAL/14_4" , CODEC_ID_RA_144},
- {"A_REAL/28_8" , CODEC_ID_RA_288},
- {"A_REAL/ATRC" , CODEC_ID_ATRAC3},
- {"A_REAL/COOK" , CODEC_ID_COOK},
- {"A_REAL/SIPR" , CODEC_ID_SIPR},
- {"A_TRUEHD" , CODEC_ID_TRUEHD},
- {"A_TTA1" , CODEC_ID_TTA},
- {"A_VORBIS" , CODEC_ID_VORBIS},
- {"A_WAVPACK4" , CODEC_ID_WAVPACK},
+ {"A_AAC" , AV_CODEC_ID_AAC},
+ {"A_AC3" , AV_CODEC_ID_AC3},
+ {"A_ALAC" , AV_CODEC_ID_ALAC},
+ {"A_DTS" , AV_CODEC_ID_DTS},
+ {"A_EAC3" , AV_CODEC_ID_EAC3},
+ {"A_FLAC" , AV_CODEC_ID_FLAC},
+ {"A_MLP" , AV_CODEC_ID_MLP},
+ {"A_MPEG/L2" , AV_CODEC_ID_MP2},
+ {"A_MPEG/L1" , AV_CODEC_ID_MP2},
+ {"A_MPEG/L3" , AV_CODEC_ID_MP3},
+ {"A_PCM/FLOAT/IEEE" , AV_CODEC_ID_PCM_F32LE},
+ {"A_PCM/FLOAT/IEEE" , AV_CODEC_ID_PCM_F64LE},
+ {"A_PCM/INT/BIG" , AV_CODEC_ID_PCM_S16BE},
+ {"A_PCM/INT/BIG" , AV_CODEC_ID_PCM_S24BE},
+ {"A_PCM/INT/BIG" , AV_CODEC_ID_PCM_S32BE},
+ {"A_PCM/INT/LIT" , AV_CODEC_ID_PCM_S16LE},
+ {"A_PCM/INT/LIT" , AV_CODEC_ID_PCM_S24LE},
+ {"A_PCM/INT/LIT" , AV_CODEC_ID_PCM_S32LE},
+ {"A_PCM/INT/LIT" , AV_CODEC_ID_PCM_U8},
+ {"A_QUICKTIME/QDM2" , AV_CODEC_ID_QDM2},
+ {"A_REAL/14_4" , AV_CODEC_ID_RA_144},
+ {"A_REAL/28_8" , AV_CODEC_ID_RA_288},
+ {"A_REAL/ATRC" , AV_CODEC_ID_ATRAC3},
+ {"A_REAL/COOK" , AV_CODEC_ID_COOK},
+ {"A_REAL/SIPR" , AV_CODEC_ID_SIPR},
+ {"A_TRUEHD" , AV_CODEC_ID_TRUEHD},
+ {"A_TTA1" , AV_CODEC_ID_TTA},
+ {"A_VORBIS" , AV_CODEC_ID_VORBIS},
+ {"A_WAVPACK4" , AV_CODEC_ID_WAVPACK},
- {"S_TEXT/UTF8" , CODEC_ID_TEXT},
- {"S_TEXT/UTF8" , CODEC_ID_SRT},
- {"S_TEXT/ASCII" , CODEC_ID_TEXT},
- {"S_TEXT/ASS" , CODEC_ID_SSA},
- {"S_TEXT/SSA" , CODEC_ID_SSA},
- {"S_ASS" , CODEC_ID_SSA},
- {"S_SSA" , CODEC_ID_SSA},
- {"S_VOBSUB" , CODEC_ID_DVD_SUBTITLE},
- {"S_HDMV/PGS" , CODEC_ID_HDMV_PGS_SUBTITLE},
+ {"S_TEXT/UTF8" , AV_CODEC_ID_TEXT},
+ {"S_TEXT/UTF8" , AV_CODEC_ID_SRT},
+ {"S_TEXT/ASCII" , AV_CODEC_ID_TEXT},
+ {"S_TEXT/ASS" , AV_CODEC_ID_SSA},
+ {"S_TEXT/SSA" , AV_CODEC_ID_SSA},
+ {"S_ASS" , AV_CODEC_ID_SSA},
+ {"S_SSA" , AV_CODEC_ID_SSA},
+ {"S_VOBSUB" , AV_CODEC_ID_DVD_SUBTITLE},
+ {"S_HDMV/PGS" , AV_CODEC_ID_HDMV_PGS_SUBTITLE},
- {"V_DIRAC" , CODEC_ID_DIRAC},
- {"V_MJPEG" , CODEC_ID_MJPEG},
- {"V_MPEG1" , CODEC_ID_MPEG1VIDEO},
- {"V_MPEG2" , CODEC_ID_MPEG2VIDEO},
- {"V_MPEG4/ISO/ASP" , CODEC_ID_MPEG4},
- {"V_MPEG4/ISO/AP" , CODEC_ID_MPEG4},
- {"V_MPEG4/ISO/SP" , CODEC_ID_MPEG4},
- {"V_MPEG4/ISO/AVC" , CODEC_ID_H264},
- {"V_MPEG4/MS/V3" , CODEC_ID_MSMPEG4V3},
- {"V_REAL/RV10" , CODEC_ID_RV10},
- {"V_REAL/RV20" , CODEC_ID_RV20},
- {"V_REAL/RV30" , CODEC_ID_RV30},
- {"V_REAL/RV40" , CODEC_ID_RV40},
- {"V_SNOW" , CODEC_ID_SNOW},
- {"V_THEORA" , CODEC_ID_THEORA},
- {"V_UNCOMPRESSED" , CODEC_ID_RAWVIDEO},
- {"V_VP8" , CODEC_ID_VP8},
+ {"V_DIRAC" , AV_CODEC_ID_DIRAC},
+ {"V_MJPEG" , AV_CODEC_ID_MJPEG},
+ {"V_MPEG1" , AV_CODEC_ID_MPEG1VIDEO},
+ {"V_MPEG2" , AV_CODEC_ID_MPEG2VIDEO},
+ {"V_MPEG4/ISO/ASP" , AV_CODEC_ID_MPEG4},
+ {"V_MPEG4/ISO/AP" , AV_CODEC_ID_MPEG4},
+ {"V_MPEG4/ISO/SP" , AV_CODEC_ID_MPEG4},
+ {"V_MPEG4/ISO/AVC" , AV_CODEC_ID_H264},
+ {"V_MPEG4/MS/V3" , AV_CODEC_ID_MSMPEG4V3},
+ {"V_PRORES" , AV_CODEC_ID_PRORES},
+ {"V_REAL/RV10" , AV_CODEC_ID_RV10},
+ {"V_REAL/RV20" , AV_CODEC_ID_RV20},
+ {"V_REAL/RV30" , AV_CODEC_ID_RV30},
+ {"V_REAL/RV40" , AV_CODEC_ID_RV40},
+ {"V_SNOW" , AV_CODEC_ID_SNOW},
+ {"V_THEORA" , AV_CODEC_ID_THEORA},
+ {"V_UNCOMPRESSED" , AV_CODEC_ID_RAWVIDEO},
+ {"V_VP8" , AV_CODEC_ID_VP8},
- {"" , CODEC_ID_NONE}
+ {"" , AV_CODEC_ID_NONE}
};
const CodecMime ff_mkv_mime_tags[] = {
- {"text/plain" , CODEC_ID_TEXT},
- {"image/gif" , CODEC_ID_GIF},
- {"image/jpeg" , CODEC_ID_MJPEG},
- {"image/png" , CODEC_ID_PNG},
- {"image/tiff" , CODEC_ID_TIFF},
- {"application/x-truetype-font", CODEC_ID_TTF},
- {"application/x-font" , CODEC_ID_TTF},
+ {"text/plain" , AV_CODEC_ID_TEXT},
+ {"image/gif" , AV_CODEC_ID_GIF},
+ {"image/jpeg" , AV_CODEC_ID_MJPEG},
+ {"image/png" , AV_CODEC_ID_PNG},
+ {"image/tiff" , AV_CODEC_ID_TIFF},
+ {"application/x-truetype-font", AV_CODEC_ID_TTF},
+ {"application/x-font" , AV_CODEC_ID_TTF},
- {"" , CODEC_ID_NONE}
+ {"" , AV_CODEC_ID_NONE}
};
const AVMetadataConv ff_mkv_metadata_conv[] = {
diff --git a/gst-libs/ext/libav/libavformat/matroska.h b/gst-libs/ext/libav/libavformat/matroska.h
index 8e747e6..b1f7ae4 100644
--- a/gst-libs/ext/libav/libavformat/matroska.h
+++ b/gst-libs/ext/libav/libavformat/matroska.h
@@ -24,6 +24,7 @@
#include "libavcodec/avcodec.h"
#include "metadata.h"
+#include "internal.h"
/* EBML version supported */
#define EBML_VERSION 1
@@ -242,14 +243,9 @@ typedef enum {
typedef struct CodecTags{
char str[20];
- enum CodecID id;
+ enum AVCodecID id;
}CodecTags;
-typedef struct CodecMime{
- char str[32];
- enum CodecID id;
-}CodecMime;
-
/* max. depth in the EBML tree structure */
#define EBML_MAX_DEPTH 16
diff --git a/gst-libs/ext/libav/libavformat/matroskadec.c b/gst-libs/ext/libav/libavformat/matroskadec.c
index 891eb83..147c24c 100644
--- a/gst-libs/ext/libav/libavformat/matroskadec.c
+++ b/gst-libs/ext/libav/libavformat/matroskadec.c
@@ -35,8 +35,9 @@
/* For ff_codec_get_id(). */
#include "riff.h"
#include "isom.h"
-#include "rm.h"
+#include "rmsipr.h"
#include "matroska.h"
+#include "libavcodec/bytestream.h"
#include "libavcodec/mpeg4audio.h"
#include "libavutil/intfloat.h"
#include "libavutil/intreadwrite.h"
@@ -213,6 +214,11 @@ typedef struct {
} MatroskaLevel;
typedef struct {
+ uint64_t timecode;
+ EbmlList blocks;
+} MatroskaCluster;
+
+typedef struct {
AVFormatContext *ctx;
/* EBML stuff */
@@ -247,6 +253,13 @@ typedef struct {
/* File has a CUES element, but we defer parsing until it is needed. */
int cues_parsing_deferred;
+
+ int current_cluster_num_blocks;
+ int64_t current_cluster_pos;
+ MatroskaCluster current_cluster;
+
+ /* File has SSA subtitles which prevent incremental cluster parsing. */
+ int contains_ssa;
} MatroskaDemuxContext;
typedef struct {
@@ -256,11 +269,6 @@ typedef struct {
EbmlBin bin;
} MatroskaBlock;
-typedef struct {
- uint64_t timecode;
- EbmlList blocks;
-} MatroskaCluster;
-
static EbmlSyntax ebml_header[] = {
{ EBML_ID_EBMLREADVERSION, EBML_UINT, 0, offsetof(Ebml,version), {.u=EBML_VERSION} },
{ EBML_ID_EBMLMAXSIZELENGTH, EBML_UINT, 0, offsetof(Ebml,max_size), {.u=8} },
@@ -514,7 +522,39 @@ static EbmlSyntax matroska_clusters[] = {
{ 0 }
};
-static const char *matroska_doctypes[] = { "matroska", "webm" };
+static EbmlSyntax matroska_cluster_incremental_parsing[] = {
+ { MATROSKA_ID_CLUSTERTIMECODE,EBML_UINT,0, offsetof(MatroskaCluster,timecode) },
+ { MATROSKA_ID_BLOCKGROUP, EBML_NEST, sizeof(MatroskaBlock), offsetof(MatroskaCluster,blocks), {.n=matroska_blockgroup} },
+ { MATROSKA_ID_SIMPLEBLOCK, EBML_PASS, sizeof(MatroskaBlock), offsetof(MatroskaCluster,blocks), {.n=matroska_blockgroup} },
+ { MATROSKA_ID_CLUSTERPOSITION,EBML_NONE },
+ { MATROSKA_ID_CLUSTERPREVSIZE,EBML_NONE },
+ { MATROSKA_ID_INFO, EBML_NONE },
+ { MATROSKA_ID_CUES, EBML_NONE },
+ { MATROSKA_ID_TAGS, EBML_NONE },
+ { MATROSKA_ID_SEEKHEAD, EBML_NONE },
+ { MATROSKA_ID_CLUSTER, EBML_STOP },
+ { 0 }
+};
+
+static EbmlSyntax matroska_cluster_incremental[] = {
+ { MATROSKA_ID_CLUSTERTIMECODE,EBML_UINT,0, offsetof(MatroskaCluster,timecode) },
+ { MATROSKA_ID_BLOCKGROUP, EBML_STOP },
+ { MATROSKA_ID_SIMPLEBLOCK, EBML_STOP },
+ { MATROSKA_ID_CLUSTERPOSITION,EBML_NONE },
+ { MATROSKA_ID_CLUSTERPREVSIZE,EBML_NONE },
+ { 0 }
+};
+
+static EbmlSyntax matroska_clusters_incremental[] = {
+ { MATROSKA_ID_CLUSTER, EBML_NEST, 0, 0, {.n=matroska_cluster_incremental} },
+ { MATROSKA_ID_INFO, EBML_NONE },
+ { MATROSKA_ID_CUES, EBML_NONE },
+ { MATROSKA_ID_TAGS, EBML_NONE },
+ { MATROSKA_ID_SEEKHEAD, EBML_NONE },
+ { 0 }
+};
+
+static const char *const matroska_doctypes[] = { "matroska", "webm" };
/*
* Return: Whether we reached the end of a level in the hierarchy or not.
@@ -558,8 +598,9 @@ static int ebml_read_num(MatroskaDemuxContext *matroska, AVIOContext *pb,
av_log(matroska->ctx, AV_LOG_ERROR,
"Read error at pos. %"PRIu64" (0x%"PRIx64")\n",
pos, pos);
+ return pb->error ? pb->error : AVERROR(EIO);
}
- return AVERROR(EIO); /* EOS or actual I/O error */
+ return AVERROR_EOF;
}
/* get the length of the EBML number */
@@ -744,8 +785,11 @@ static int ebml_parse_id(MatroskaDemuxContext *matroska, EbmlSyntax *syntax,
matroska->num_levels > 0 &&
matroska->levels[matroska->num_levels-1].length == 0xffffffffffffff)
return 0; // we reached the end of an unknown size cluster
- if (!syntax[i].id && id != EBML_ID_VOID && id != EBML_ID_CRC32)
+ if (!syntax[i].id && id != EBML_ID_VOID && id != EBML_ID_CRC32) {
av_log(matroska->ctx, AV_LOG_INFO, "Unknown entry 0x%X\n", id);
+ if (matroska->ctx->error_recognition & AV_EF_EXPLODE)
+ return AVERROR_INVALIDDATA;
+ }
return ebml_parse_elem(matroska, &syntax[i], data);
}
@@ -942,27 +986,50 @@ static int matroska_decode_buffer(uint8_t** buf, int* buf_size,
uint8_t* data = *buf;
int isize = *buf_size;
uint8_t* pkt_data = NULL;
- uint8_t* newpktdata;
+ uint8_t av_unused *newpktdata;
int pkt_size = isize;
int result = 0;
int olen;
if (pkt_size >= 10000000)
- return -1;
+ return AVERROR_INVALIDDATA;
switch (encodings[0].compression.algo) {
- case MATROSKA_TRACK_ENCODING_COMP_HEADERSTRIP:
- return encodings[0].compression.settings.size;
+ case MATROSKA_TRACK_ENCODING_COMP_HEADERSTRIP: {
+ int header_size = encodings[0].compression.settings.size;
+ uint8_t *header = encodings[0].compression.settings.data;
+
+ if (!header_size)
+ return 0;
+
+ pkt_size = isize + header_size;
+ pkt_data = av_malloc(pkt_size);
+ if (!pkt_data)
+ return AVERROR(ENOMEM);
+
+ memcpy(pkt_data, header, header_size);
+ memcpy(pkt_data + header_size, data, isize);
+ break;
+ }
+#if CONFIG_LZO
case MATROSKA_TRACK_ENCODING_COMP_LZO:
do {
olen = pkt_size *= 3;
- pkt_data = av_realloc(pkt_data, pkt_size+AV_LZO_OUTPUT_PADDING);
+ newpktdata = av_realloc(pkt_data, pkt_size + AV_LZO_OUTPUT_PADDING);
+ if (!newpktdata) {
+ result = AVERROR(ENOMEM);
+ goto failed;
+ }
+ pkt_data = newpktdata;
result = av_lzo1x_decode(pkt_data, &olen, data, &isize);
} while (result==AV_LZO_OUTPUT_FULL && pkt_size<10000000);
- if (result)
+ if (result) {
+ result = AVERROR_INVALIDDATA;
goto failed;
+ }
pkt_size -= olen;
break;
+#endif
#if CONFIG_ZLIB
case MATROSKA_TRACK_ENCODING_COMP_ZLIB: {
z_stream zstream = {0};
@@ -984,8 +1051,13 @@ static int matroska_decode_buffer(uint8_t** buf, int* buf_size,
} while (result==Z_OK && pkt_size<10000000);
pkt_size = zstream.total_out;
inflateEnd(&zstream);
- if (result != Z_STREAM_END)
+ if (result != Z_STREAM_END) {
+ if (result == Z_MEM_ERROR)
+ result = AVERROR(ENOMEM);
+ else
+ result = AVERROR_INVALIDDATA;
goto failed;
+ }
break;
}
#endif
@@ -1010,13 +1082,18 @@ static int matroska_decode_buffer(uint8_t** buf, int* buf_size,
} while (result==BZ_OK && pkt_size<10000000);
pkt_size = bzstream.total_out_lo32;
BZ2_bzDecompressEnd(&bzstream);
- if (result != BZ_STREAM_END)
+ if (result != BZ_STREAM_END) {
+ if (result == BZ_MEM_ERROR)
+ result = AVERROR(ENOMEM);
+ else
+ result = AVERROR_INVALIDDATA;
goto failed;
+ }
break;
}
#endif
default:
- return -1;
+ return AVERROR_INVALIDDATA;
}
*buf = pkt_data;
@@ -1024,7 +1101,7 @@ static int matroska_decode_buffer(uint8_t** buf, int* buf_size,
return 0;
failed:
av_free(pkt_data);
- return -1;
+ return result;
}
static void matroska_fix_ass_packet(MatroskaDemuxContext *matroska,
@@ -1060,13 +1137,14 @@ static void matroska_fix_ass_packet(MatroskaDemuxContext *matroska,
static int matroska_merge_packets(AVPacket *out, AVPacket *in)
{
- void *newdata = av_realloc(out->data, out->size+in->size);
- if (!newdata)
- return AVERROR(ENOMEM);
- out->data = newdata;
- memcpy(out->data+out->size, in->data, in->size);
- out->size += in->size;
- av_destruct_packet(in);
+ int old_size = out->size;
+ int ret = av_grow_packet(out, in->size);
+ if (ret < 0)
+ return ret;
+
+ memcpy(out->data + old_size, in->data, in->size);
+
+ av_free_packet(in);
av_free(in);
return 0;
}
@@ -1272,7 +1350,7 @@ static int matroska_aac_sri(int samplerate)
return sri;
}
-static int matroska_read_header(AVFormatContext *s, AVFormatParameters *ap)
+static int matroska_read_header(AVFormatContext *s)
{
MatroskaDemuxContext *matroska = s->priv_data;
EbmlList *attachements_list = &matroska->attachments;
@@ -1303,6 +1381,10 @@ static int matroska_read_header(AVFormatContext *s, AVFormatParameters *ap)
break;
if (i >= FF_ARRAY_ELEMS(matroska_doctypes)) {
av_log(s, AV_LOG_WARNING, "Unknown EBML doctype '%s'\n", ebml.doctype);
+ if (matroska->ctx->error_recognition & AV_EF_EXPLODE) {
+ ebml_free(ebml_syntax, &ebml);
+ return AVERROR_INVALIDDATA;
+ }
}
ebml_free(ebml_syntax, &ebml);
@@ -1321,7 +1403,7 @@ static int matroska_read_header(AVFormatContext *s, AVFormatParameters *ap)
tracks = matroska->tracks.elem;
for (i=0; i < matroska->tracks.nb_elem; i++) {
MatroskaTrack *track = &tracks[i];
- enum CodecID codec_id = CODEC_ID_NONE;
+ enum AVCodecID codec_id = AV_CODEC_ID_NONE;
EbmlList *encodings_list = &tracks->encodings;
MatroskaTrackEncoding *encodings = encodings_list->elem;
uint8_t *extradata = NULL;
@@ -1342,7 +1424,7 @@ static int matroska_read_header(AVFormatContext *s, AVFormatParameters *ap)
continue;
if (track->type == MATROSKA_TRACK_TYPE_VIDEO) {
- if (!track->default_duration)
+ if (!track->default_duration && track->video.frame_rate > 0)
track->default_duration = 1000000000/track->video.frame_rate;
if (!track->video.display_width)
track->video.display_width = track->video.pixel_width;
@@ -1357,41 +1439,38 @@ static int matroska_read_header(AVFormatContext *s, AVFormatParameters *ap)
"Multiple combined encodings not supported");
} else if (encodings_list->nb_elem == 1) {
if (encodings[0].type ||
- (encodings[0].compression.algo != MATROSKA_TRACK_ENCODING_COMP_HEADERSTRIP &&
+ (
#if CONFIG_ZLIB
encodings[0].compression.algo != MATROSKA_TRACK_ENCODING_COMP_ZLIB &&
#endif
#if CONFIG_BZLIB
encodings[0].compression.algo != MATROSKA_TRACK_ENCODING_COMP_BZLIB &&
#endif
- encodings[0].compression.algo != MATROSKA_TRACK_ENCODING_COMP_LZO)) {
+#if CONFIG_LZO
+ encodings[0].compression.algo != MATROSKA_TRACK_ENCODING_COMP_LZO &&
+#endif
+ encodings[0].compression.algo != MATROSKA_TRACK_ENCODING_COMP_HEADERSTRIP)) {
encodings[0].scope = 0;
av_log(matroska->ctx, AV_LOG_ERROR,
"Unsupported encoding type");
} else if (track->codec_priv.size && encodings[0].scope&2) {
uint8_t *codec_priv = track->codec_priv.data;
- int offset = matroska_decode_buffer(&track->codec_priv.data,
- &track->codec_priv.size,
- track);
- if (offset < 0) {
+ int ret = matroska_decode_buffer(&track->codec_priv.data,
+ &track->codec_priv.size,
+ track);
+ if (ret < 0) {
track->codec_priv.data = NULL;
track->codec_priv.size = 0;
av_log(matroska->ctx, AV_LOG_ERROR,
"Failed to decode codec private data\n");
- } else if (offset > 0) {
- track->codec_priv.data = av_malloc(track->codec_priv.size + offset);
- memcpy(track->codec_priv.data,
- encodings[0].compression.settings.data, offset);
- memcpy(track->codec_priv.data+offset, codec_priv,
- track->codec_priv.size);
- track->codec_priv.size += offset;
}
+
if (codec_priv != track->codec_priv.data)
av_free(codec_priv);
}
}
- for(j=0; ff_mkv_codec_tags[j].id != CODEC_ID_NONE; j++){
+ for(j=0; ff_mkv_codec_tags[j].id != AV_CODEC_ID_NONE; j++){
if(!strncmp(ff_mkv_codec_tags[j].str, track->codec_id,
strlen(ff_mkv_codec_tags[j].str))){
codec_id= ff_mkv_codec_tags[j].id;
@@ -1415,7 +1494,7 @@ static int matroska_read_header(AVFormatContext *s, AVFormatParameters *ap)
&& track->codec_priv.data != NULL) {
int ret;
ffio_init_context(&b, track->codec_priv.data, track->codec_priv.size,
- 0, NULL, NULL, NULL, NULL);
+ AVIO_FLAG_READ, NULL, NULL, NULL, NULL);
ret = ff_get_wav_header(&b, st->codec, track->codec_priv.size);
if (ret < 0)
return ret;
@@ -1425,22 +1504,22 @@ static int matroska_read_header(AVFormatContext *s, AVFormatParameters *ap)
&& (track->codec_priv.size >= 86)
&& (track->codec_priv.data != NULL)) {
track->video.fourcc = AV_RL32(track->codec_priv.data);
- codec_id=ff_codec_get_id(codec_movvideo_tags, track->video.fourcc);
- } else if (codec_id == CODEC_ID_PCM_S16BE) {
+ codec_id=ff_codec_get_id(ff_codec_movvideo_tags, track->video.fourcc);
+ } else if (codec_id == AV_CODEC_ID_PCM_S16BE) {
switch (track->audio.bitdepth) {
- case 8: codec_id = CODEC_ID_PCM_U8; break;
- case 24: codec_id = CODEC_ID_PCM_S24BE; break;
- case 32: codec_id = CODEC_ID_PCM_S32BE; break;
+ case 8: codec_id = AV_CODEC_ID_PCM_U8; break;
+ case 24: codec_id = AV_CODEC_ID_PCM_S24BE; break;
+ case 32: codec_id = AV_CODEC_ID_PCM_S32BE; break;
}
- } else if (codec_id == CODEC_ID_PCM_S16LE) {
+ } else if (codec_id == AV_CODEC_ID_PCM_S16LE) {
switch (track->audio.bitdepth) {
- case 8: codec_id = CODEC_ID_PCM_U8; break;
- case 24: codec_id = CODEC_ID_PCM_S24LE; break;
- case 32: codec_id = CODEC_ID_PCM_S32LE; break;
+ case 8: codec_id = AV_CODEC_ID_PCM_U8; break;
+ case 24: codec_id = AV_CODEC_ID_PCM_S24LE; break;
+ case 32: codec_id = AV_CODEC_ID_PCM_S32LE; break;
}
- } else if (codec_id==CODEC_ID_PCM_F32LE && track->audio.bitdepth==64) {
- codec_id = CODEC_ID_PCM_F64LE;
- } else if (codec_id == CODEC_ID_AAC && !track->codec_priv.size) {
+ } else if (codec_id==AV_CODEC_ID_PCM_F32LE && track->audio.bitdepth==64) {
+ codec_id = AV_CODEC_ID_PCM_F64LE;
+ } else if (codec_id == AV_CODEC_ID_AAC && !track->codec_priv.size) {
int profile = matroska_aac_profile(track->codec_id);
int sri = matroska_aac_sri(track->audio.samplerate);
extradata = av_mallocz(5 + FF_INPUT_BUFFER_PADDING_SIZE);
@@ -1456,7 +1535,20 @@ static int matroska_read_header(AVFormatContext *s, AVFormatParameters *ap)
extradata_size = 5;
} else
extradata_size = 2;
- } else if (codec_id == CODEC_ID_TTA) {
+ } else if (codec_id == AV_CODEC_ID_ALAC && track->codec_priv.size) {
+ /* Only ALAC's magic cookie is stored in Matroska's track headers.
+ Create the "atom size", "tag", and "tag version" fields the
+ decoder expects manually. */
+ extradata_size = 12 + track->codec_priv.size;
+ extradata = av_mallocz(extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
+ if (extradata == NULL)
+ return AVERROR(ENOMEM);
+ AV_WB32(extradata, extradata_size);
+ memcpy(&extradata[4], "alac", 4);
+ AV_WB32(&extradata[8], 0);
+ memcpy(&extradata[12], track->codec_priv.data,
+ track->codec_priv.size);
+ } else if (codec_id == AV_CODEC_ID_TTA) {
extradata_size = 30;
extradata = av_mallocz(extradata_size);
if (extradata == NULL)
@@ -1469,14 +1561,14 @@ static int matroska_read_header(AVFormatContext *s, AVFormatParameters *ap)
avio_wl16(&b, track->audio.bitdepth);
avio_wl32(&b, track->audio.out_samplerate);
avio_wl32(&b, matroska->ctx->duration * track->audio.out_samplerate);
- } else if (codec_id == CODEC_ID_RV10 || codec_id == CODEC_ID_RV20 ||
- codec_id == CODEC_ID_RV30 || codec_id == CODEC_ID_RV40) {
+ } else if (codec_id == AV_CODEC_ID_RV10 || codec_id == AV_CODEC_ID_RV20 ||
+ codec_id == AV_CODEC_ID_RV30 || codec_id == AV_CODEC_ID_RV40) {
extradata_offset = 26;
- } else if (codec_id == CODEC_ID_RA_144) {
+ } else if (codec_id == AV_CODEC_ID_RA_144) {
track->audio.out_samplerate = 8000;
track->audio.channels = 1;
- } else if (codec_id == CODEC_ID_RA_288 || codec_id == CODEC_ID_COOK ||
- codec_id == CODEC_ID_ATRAC3 || codec_id == CODEC_ID_SIPR) {
+ } else if (codec_id == AV_CODEC_ID_RA_288 || codec_id == AV_CODEC_ID_COOK ||
+ codec_id == AV_CODEC_ID_ATRAC3 || codec_id == AV_CODEC_ID_SIPR) {
int flavor;
ffio_init_context(&b, track->codec_priv.data,track->codec_priv.size,
0, NULL, NULL, NULL, NULL);
@@ -1488,11 +1580,11 @@ static int matroska_read_header(AVFormatContext *s, AVFormatParameters *ap)
track->audio.frame_size = avio_rb16(&b);
track->audio.sub_packet_size = avio_rb16(&b);
track->audio.buf = av_malloc(track->audio.frame_size * track->audio.sub_packet_h);
- if (codec_id == CODEC_ID_RA_288) {
+ if (codec_id == AV_CODEC_ID_RA_288) {
st->codec->block_align = track->audio.coded_framesize;
track->codec_priv.size = 0;
} else {
- if (codec_id == CODEC_ID_SIPR && flavor < 4) {
+ if (codec_id == AV_CODEC_ID_SIPR && flavor < 4) {
const int sipr_bit_rate[4] = { 6504, 8496, 5000, 16000 };
track->audio.sub_packet_size = ff_sipr_subpk_size[flavor];
st->codec->bit_rate = sipr_bit_rate[flavor];
@@ -1503,9 +1595,9 @@ static int matroska_read_header(AVFormatContext *s, AVFormatParameters *ap)
}
track->codec_priv.size -= extradata_offset;
- if (codec_id == CODEC_ID_NONE)
+ if (codec_id == AV_CODEC_ID_NONE)
av_log(matroska->ctx, AV_LOG_INFO,
- "Unknown/unsupported CodecID %s.\n", track->codec_id);
+ "Unknown/unsupported AVCodecID %s.\n", track->codec_id);
if (track->time_scale < 0.01)
track->time_scale = 1.0;
@@ -1548,18 +1640,25 @@ static int matroska_read_header(AVFormatContext *s, AVFormatParameters *ap)
st->codec->height * track->video.display_width,
st->codec-> width * track->video.display_height,
255);
- if (st->codec->codec_id != CODEC_ID_H264)
+ if (st->codec->codec_id != AV_CODEC_ID_H264)
st->need_parsing = AVSTREAM_PARSE_HEADERS;
- if (track->default_duration)
- st->avg_frame_rate = av_d2q(1000000000.0/track->default_duration, INT_MAX);
+ if (track->default_duration) {
+ av_reduce(&st->avg_frame_rate.num, &st->avg_frame_rate.den,
+ 1000000000, track->default_duration, 30000);
+#if FF_API_R_FRAME_RATE
+ st->r_frame_rate = st->avg_frame_rate;
+#endif
+ }
} else if (track->type == MATROSKA_TRACK_TYPE_AUDIO) {
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
st->codec->sample_rate = track->audio.out_samplerate;
st->codec->channels = track->audio.channels;
- if (st->codec->codec_id != CODEC_ID_AAC)
+ if (st->codec->codec_id != AV_CODEC_ID_AAC)
st->need_parsing = AVSTREAM_PARSE_HEADERS;
} else if (track->type == MATROSKA_TRACK_TYPE_SUBTITLE) {
st->codec->codec_type = AVMEDIA_TYPE_SUBTITLE;
+ if (st->codec->codec_id == AV_CODEC_ID_SSA)
+ matroska->contains_ssa = 1;
}
}
@@ -1574,7 +1673,7 @@ static int matroska_read_header(AVFormatContext *s, AVFormatParameters *ap)
break;
av_dict_set(&st->metadata, "filename",attachements[j].filename, 0);
av_dict_set(&st->metadata, "mimetype", attachements[j].mime, 0);
- st->codec->codec_id = CODEC_ID_NONE;
+ st->codec->codec_id = AV_CODEC_ID_NONE;
st->codec->codec_type = AVMEDIA_TYPE_ATTACHMENT;
st->codec->extradata = av_malloc(attachements[j].bin.size);
if(st->codec->extradata == NULL)
@@ -1582,7 +1681,7 @@ static int matroska_read_header(AVFormatContext *s, AVFormatParameters *ap)
st->codec->extradata_size = attachements[j].bin.size;
memcpy(st->codec->extradata, attachements[j].bin.data, attachements[j].bin.size);
- for (i=0; ff_mkv_mime_tags[i].id != CODEC_ID_NONE; i++) {
+ for (i=0; ff_mkv_mime_tags[i].id != AV_CODEC_ID_NONE; i++) {
if (!strncmp(ff_mkv_mime_tags[i].str, attachements[j].mime,
strlen(ff_mkv_mime_tags[i].str))) {
st->codec->codec_id = ff_mkv_mime_tags[i].id;
@@ -1631,6 +1730,7 @@ static int matroska_deliver_packet(MatroskaDemuxContext *matroska,
matroska->packets = newpackets;
} else {
av_freep(&matroska->packets);
+ matroska->prev_pkt = NULL;
}
matroska->num_packets--;
return 0;
@@ -1644,6 +1744,7 @@ static int matroska_deliver_packet(MatroskaDemuxContext *matroska,
*/
static void matroska_clear_queue(MatroskaDemuxContext *matroska)
{
+ matroska->prev_pkt = NULL;
if (matroska->packets) {
int n;
for (n = 0; n < matroska->num_packets; n++) {
@@ -1655,24 +1756,265 @@ static void matroska_clear_queue(MatroskaDemuxContext *matroska)
}
}
+static int matroska_parse_laces(MatroskaDemuxContext *matroska, uint8_t **buf,
+ int* buf_size, int type,
+ uint32_t **lace_buf, int *laces)
+{
+ int res = 0, n, size = *buf_size;
+ uint8_t *data = *buf;
+ uint32_t *lace_size;
+
+ if (!type) {
+ *laces = 1;
+ *lace_buf = av_mallocz(sizeof(int));
+ if (!*lace_buf)
+ return AVERROR(ENOMEM);
+
+ *lace_buf[0] = size;
+ return 0;
+ }
+
+ assert(size > 0);
+ *laces = *data + 1;
+ data += 1;
+ size -= 1;
+ lace_size = av_mallocz(*laces * sizeof(int));
+ if (!lace_size)
+ return AVERROR(ENOMEM);
+
+ switch (type) {
+ case 0x1: /* Xiph lacing */ {
+ uint8_t temp;
+ uint32_t total = 0;
+ for (n = 0; res == 0 && n < *laces - 1; n++) {
+ while (1) {
+ if (size == 0) {
+ res = AVERROR_EOF;
+ break;
+ }
+ temp = *data;
+ lace_size[n] += temp;
+ data += 1;
+ size -= 1;
+ if (temp != 0xff)
+ break;
+ }
+ total += lace_size[n];
+ }
+ if (size <= total) {
+ res = AVERROR_INVALIDDATA;
+ break;
+ }
+
+ lace_size[n] = size - total;
+ break;
+ }
+
+ case 0x2: /* fixed-size lacing */
+ if (size % (*laces)) {
+ res = AVERROR_INVALIDDATA;
+ break;
+ }
+ for (n = 0; n < *laces; n++)
+ lace_size[n] = size / *laces;
+ break;
+
+ case 0x3: /* EBML lacing */ {
+ uint64_t num;
+ uint64_t total;
+ n = matroska_ebmlnum_uint(matroska, data, size, &num);
+ if (n < 0) {
+ av_log(matroska->ctx, AV_LOG_INFO,
+ "EBML block data error\n");
+ res = n;
+ break;
+ }
+ data += n;
+ size -= n;
+ total = lace_size[0] = num;
+ for (n = 1; res == 0 && n < *laces - 1; n++) {
+ int64_t snum;
+ int r;
+ r = matroska_ebmlnum_sint(matroska, data, size, &snum);
+ if (r < 0) {
+ av_log(matroska->ctx, AV_LOG_INFO,
+ "EBML block data error\n");
+ res = r;
+ break;
+ }
+ data += r;
+ size -= r;
+ lace_size[n] = lace_size[n - 1] + snum;
+ total += lace_size[n];
+ }
+ if (size <= total) {
+ res = AVERROR_INVALIDDATA;
+ break;
+ }
+ lace_size[*laces - 1] = size - total;
+ break;
+ }
+ }
+
+ *buf = data;
+ *lace_buf = lace_size;
+ *buf_size = size;
+
+ return res;
+}
+
+static int matroska_parse_rm_audio(MatroskaDemuxContext *matroska,
+ MatroskaTrack *track,
+ AVStream *st,
+ uint8_t *data, int size,
+ uint64_t timecode, uint64_t duration,
+ int64_t pos)
+{
+ int a = st->codec->block_align;
+ int sps = track->audio.sub_packet_size;
+ int cfs = track->audio.coded_framesize;
+ int h = track->audio.sub_packet_h;
+ int y = track->audio.sub_packet_cnt;
+ int w = track->audio.frame_size;
+ int x;
+
+ if (!track->audio.pkt_cnt) {
+ if (track->audio.sub_packet_cnt == 0)
+ track->audio.buf_timecode = timecode;
+ if (st->codec->codec_id == AV_CODEC_ID_RA_288) {
+ if (size < cfs * h / 2) {
+ av_log(matroska->ctx, AV_LOG_ERROR,
+ "Corrupt int4 RM-style audio packet size\n");
+ return AVERROR_INVALIDDATA;
+ }
+ for (x=0; x<h/2; x++)
+ memcpy(track->audio.buf+x*2*w+y*cfs,
+ data+x*cfs, cfs);
+ } else if (st->codec->codec_id == AV_CODEC_ID_SIPR) {
+ if (size < w) {
+ av_log(matroska->ctx, AV_LOG_ERROR,
+ "Corrupt sipr RM-style audio packet size\n");
+ return AVERROR_INVALIDDATA;
+ }
+ memcpy(track->audio.buf + y*w, data, w);
+ } else {
+ if (size < sps * w / sps) {
+ av_log(matroska->ctx, AV_LOG_ERROR,
+ "Corrupt generic RM-style audio packet size\n");
+ return AVERROR_INVALIDDATA;
+ }
+ for (x=0; x<w/sps; x++)
+ memcpy(track->audio.buf+sps*(h*x+((h+1)/2)*(y&1)+(y>>1)), data+x*sps, sps);
+ }
+
+ if (++track->audio.sub_packet_cnt >= h) {
+ if (st->codec->codec_id == AV_CODEC_ID_SIPR)
+ ff_rm_reorder_sipr_data(track->audio.buf, h, w);
+ track->audio.sub_packet_cnt = 0;
+ track->audio.pkt_cnt = h*w / a;
+ }
+ }
+
+ while (track->audio.pkt_cnt) {
+ AVPacket *pkt = av_mallocz(sizeof(AVPacket));
+ av_new_packet(pkt, a);
+ memcpy(pkt->data, track->audio.buf
+ + a * (h*w / a - track->audio.pkt_cnt--), a);
+ pkt->pts = track->audio.buf_timecode;
+ track->audio.buf_timecode = AV_NOPTS_VALUE;
+ pkt->pos = pos;
+ pkt->stream_index = st->index;
+ dynarray_add(&matroska->packets,&matroska->num_packets,pkt);
+ }
+
+ return 0;
+}
+static int matroska_parse_frame(MatroskaDemuxContext *matroska,
+ MatroskaTrack *track,
+ AVStream *st,
+ uint8_t *data, int pkt_size,
+ uint64_t timecode, uint64_t duration,
+ int64_t pos, int is_keyframe)
+{
+ MatroskaTrackEncoding *encodings = track->encodings.elem;
+ uint8_t *pkt_data = data;
+ int offset = 0, res;
+ AVPacket *pkt;
+
+ if (encodings && encodings->scope & 1) {
+ res = matroska_decode_buffer(&pkt_data, &pkt_size, track);
+ if (res < 0)
+ return res;
+ }
+
+ if (st->codec->codec_id == AV_CODEC_ID_PRORES)
+ offset = 8;
+
+ pkt = av_mallocz(sizeof(AVPacket));
+ /* XXX: prevent data copy... */
+ if (av_new_packet(pkt, pkt_size + offset) < 0) {
+ av_free(pkt);
+ return AVERROR(ENOMEM);
+ }
+
+ if (st->codec->codec_id == AV_CODEC_ID_PRORES) {
+ uint8_t *buf = pkt->data;
+ bytestream_put_be32(&buf, pkt_size);
+ bytestream_put_be32(&buf, MKBETAG('i', 'c', 'p', 'f'));
+ }
+
+ memcpy(pkt->data + offset, pkt_data, pkt_size);
+
+ if (pkt_data != data)
+ av_free(pkt_data);
+
+ pkt->flags = is_keyframe;
+ pkt->stream_index = st->index;
+
+ if (track->ms_compat)
+ pkt->dts = timecode;
+ else
+ pkt->pts = timecode;
+ pkt->pos = pos;
+ if (st->codec->codec_id == AV_CODEC_ID_TEXT)
+ pkt->convergence_duration = duration;
+ else if (track->type != MATROSKA_TRACK_TYPE_SUBTITLE)
+ pkt->duration = duration;
+
+ if (st->codec->codec_id == AV_CODEC_ID_SSA)
+ matroska_fix_ass_packet(matroska, pkt, duration);
+
+ if (matroska->prev_pkt &&
+ timecode != AV_NOPTS_VALUE &&
+ matroska->prev_pkt->pts == timecode &&
+ matroska->prev_pkt->stream_index == st->index &&
+ st->codec->codec_id == AV_CODEC_ID_SSA)
+ matroska_merge_packets(matroska->prev_pkt, pkt);
+ else {
+ dynarray_add(&matroska->packets,&matroska->num_packets,pkt);
+ matroska->prev_pkt = pkt;
+ }
+
+ return 0;
+}
+
static int matroska_parse_block(MatroskaDemuxContext *matroska, uint8_t *data,
int size, int64_t pos, uint64_t cluster_time,
- uint64_t duration, int is_keyframe,
+ uint64_t block_duration, int is_keyframe,
int64_t cluster_pos)
{
uint64_t timecode = AV_NOPTS_VALUE;
MatroskaTrack *track;
int res = 0;
AVStream *st;
- AVPacket *pkt;
int16_t block_time;
uint32_t *lace_size = NULL;
int n, flags, laces = 0;
- uint64_t num;
+ uint64_t num, duration;
if ((n = matroska_ebmlnum_uint(matroska, data, size, &num)) < 0) {
av_log(matroska->ctx, AV_LOG_ERROR, "EBML block data error\n");
- return res;
+ return n;
}
data += n;
size -= n;
@@ -1687,8 +2029,6 @@ static int matroska_parse_block(MatroskaDemuxContext *matroska, uint8_t *data,
st = track->stream;
if (st->discard >= AVDISCARD_ALL)
return res;
- if (duration == AV_NOPTS_VALUE)
- duration = track->default_duration / matroska->time_scale;
block_time = AV_RB16(data);
data += 2;
@@ -1705,7 +2045,6 @@ static int matroska_parse_block(MatroskaDemuxContext *matroska, uint8_t *data,
is_keyframe = 0; /* overlapping subtitles are not key frame */
if (is_keyframe)
av_add_index_entry(st, cluster_pos, timecode, 0,0,AVINDEX_KEYFRAME);
- track->end_timecode = FFMAX(track->end_timecode, timecode+duration);
}
if (matroska->skip_to_keyframe && track->type != MATROSKA_TRACK_TYPE_SUBTITLE) {
@@ -1714,221 +2053,123 @@ static int matroska_parse_block(MatroskaDemuxContext *matroska, uint8_t *data,
matroska->skip_to_keyframe = 0;
}
- switch ((flags & 0x06) >> 1) {
- case 0x0: /* no lacing */
- laces = 1;
- lace_size = av_mallocz(sizeof(int));
- lace_size[0] = size;
- break;
-
- case 0x1: /* Xiph lacing */
- case 0x2: /* fixed-size lacing */
- case 0x3: /* EBML lacing */
- assert(size>0); // size <=3 is checked before size-=3 above
- laces = (*data) + 1;
- data += 1;
- size -= 1;
- lace_size = av_mallocz(laces * sizeof(int));
-
- switch ((flags & 0x06) >> 1) {
- case 0x1: /* Xiph lacing */ {
- uint8_t temp;
- uint32_t total = 0;
- for (n = 0; res == 0 && n < laces - 1; n++) {
- while (1) {
- if (size == 0) {
- res = -1;
- break;
- }
- temp = *data;
- lace_size[n] += temp;
- data += 1;
- size -= 1;
- if (temp != 0xff)
- break;
- }
- total += lace_size[n];
- }
- lace_size[n] = size - total;
- break;
- }
+ res = matroska_parse_laces(matroska, &data, &size, (flags & 0x06) >> 1,
+ &lace_size, &laces);
- case 0x2: /* fixed-size lacing */
- for (n = 0; n < laces; n++)
- lace_size[n] = size / laces;
- break;
+ if (res)
+ goto end;
- case 0x3: /* EBML lacing */ {
- uint32_t total;
- n = matroska_ebmlnum_uint(matroska, data, size, &num);
- if (n < 0) {
- av_log(matroska->ctx, AV_LOG_INFO,
- "EBML block data error\n");
- break;
- }
- data += n;
- size -= n;
- total = lace_size[0] = num;
- for (n = 1; res == 0 && n < laces - 1; n++) {
- int64_t snum;
- int r;
- r = matroska_ebmlnum_sint(matroska, data, size, &snum);
- if (r < 0) {
- av_log(matroska->ctx, AV_LOG_INFO,
- "EBML block data error\n");
- break;
- }
- data += r;
- size -= r;
- lace_size[n] = lace_size[n - 1] + snum;
- total += lace_size[n];
- }
- lace_size[laces - 1] = size - total;
- break;
- }
- }
- break;
+ if (block_duration != AV_NOPTS_VALUE) {
+ duration = block_duration / laces;
+ if (block_duration != duration * laces) {
+ av_log(matroska->ctx, AV_LOG_WARNING,
+ "Incorrect block_duration, possibly corrupted container");
+ }
+ } else {
+ duration = track->default_duration / matroska->time_scale;
+ block_duration = duration * laces;
}
- if (res == 0) {
- for (n = 0; n < laces; n++) {
- if ((st->codec->codec_id == CODEC_ID_RA_288 ||
- st->codec->codec_id == CODEC_ID_COOK ||
- st->codec->codec_id == CODEC_ID_SIPR ||
- st->codec->codec_id == CODEC_ID_ATRAC3) &&
- st->codec->block_align && track->audio.sub_packet_size) {
- int a = st->codec->block_align;
- int sps = track->audio.sub_packet_size;
- int cfs = track->audio.coded_framesize;
- int h = track->audio.sub_packet_h;
- int y = track->audio.sub_packet_cnt;
- int w = track->audio.frame_size;
- int x;
-
- if (!track->audio.pkt_cnt) {
- if (track->audio.sub_packet_cnt == 0)
- track->audio.buf_timecode = timecode;
- if (st->codec->codec_id == CODEC_ID_RA_288) {
- if (size < cfs * h / 2) {
- av_log(matroska->ctx, AV_LOG_ERROR,
- "Corrupt int4 RM-style audio packet size\n");
- return AVERROR_INVALIDDATA;
- }
- for (x=0; x<h/2; x++)
- memcpy(track->audio.buf+x*2*w+y*cfs,
- data+x*cfs, cfs);
- } else if (st->codec->codec_id == CODEC_ID_SIPR) {
- if (size < w) {
- av_log(matroska->ctx, AV_LOG_ERROR,
- "Corrupt sipr RM-style audio packet size\n");
- return AVERROR_INVALIDDATA;
- }
- memcpy(track->audio.buf + y*w, data, w);
- } else {
- if (size < sps * w / sps) {
- av_log(matroska->ctx, AV_LOG_ERROR,
- "Corrupt generic RM-style audio packet size\n");
- return AVERROR_INVALIDDATA;
- }
- for (x=0; x<w/sps; x++)
- memcpy(track->audio.buf+sps*(h*x+((h+1)/2)*(y&1)+(y>>1)), data+x*sps, sps);
- }
-
- if (++track->audio.sub_packet_cnt >= h) {
- if (st->codec->codec_id == CODEC_ID_SIPR)
- ff_rm_reorder_sipr_data(track->audio.buf, h, w);
- track->audio.sub_packet_cnt = 0;
- track->audio.pkt_cnt = h*w / a;
- }
- }
- while (track->audio.pkt_cnt) {
- pkt = av_mallocz(sizeof(AVPacket));
- av_new_packet(pkt, a);
- memcpy(pkt->data, track->audio.buf
- + a * (h*w / a - track->audio.pkt_cnt--), a);
- pkt->pts = track->audio.buf_timecode;
- track->audio.buf_timecode = AV_NOPTS_VALUE;
- pkt->pos = pos;
- pkt->stream_index = st->index;
- dynarray_add(&matroska->packets,&matroska->num_packets,pkt);
- }
- } else {
- MatroskaTrackEncoding *encodings = track->encodings.elem;
- int offset = 0, pkt_size = lace_size[n];
- uint8_t *pkt_data = data;
-
- if (pkt_size > size) {
- av_log(matroska->ctx, AV_LOG_ERROR, "Invalid packet size\n");
- break;
- }
+ if (timecode != AV_NOPTS_VALUE)
+ track->end_timecode =
+ FFMAX(track->end_timecode, timecode + block_duration);
- if (encodings && encodings->scope & 1) {
- offset = matroska_decode_buffer(&pkt_data,&pkt_size, track);
- if (offset < 0)
- continue;
- }
+ for (n = 0; n < laces; n++) {
+ if ((st->codec->codec_id == AV_CODEC_ID_RA_288 ||
+ st->codec->codec_id == AV_CODEC_ID_COOK ||
+ st->codec->codec_id == AV_CODEC_ID_SIPR ||
+ st->codec->codec_id == AV_CODEC_ID_ATRAC3) &&
+ st->codec->block_align && track->audio.sub_packet_size) {
- pkt = av_mallocz(sizeof(AVPacket));
- /* XXX: prevent data copy... */
- if (av_new_packet(pkt, pkt_size+offset) < 0) {
- av_free(pkt);
- res = AVERROR(ENOMEM);
- break;
- }
- if (offset)
- memcpy (pkt->data, encodings->compression.settings.data, offset);
- memcpy (pkt->data+offset, pkt_data, pkt_size);
-
- if (pkt_data != data)
- av_free(pkt_data);
-
- if (n == 0)
- pkt->flags = is_keyframe;
- pkt->stream_index = st->index;
-
- if (track->ms_compat)
- pkt->dts = timecode;
- else
- pkt->pts = timecode;
- pkt->pos = pos;
- if (st->codec->codec_id == CODEC_ID_TEXT)
- pkt->convergence_duration = duration;
- else if (track->type != MATROSKA_TRACK_TYPE_SUBTITLE)
- pkt->duration = duration;
-
- if (st->codec->codec_id == CODEC_ID_SSA)
- matroska_fix_ass_packet(matroska, pkt, duration);
-
- if (matroska->prev_pkt &&
- timecode != AV_NOPTS_VALUE &&
- matroska->prev_pkt->pts == timecode &&
- matroska->prev_pkt->stream_index == st->index &&
- st->codec->codec_id == CODEC_ID_SSA)
- matroska_merge_packets(matroska->prev_pkt, pkt);
- else {
- dynarray_add(&matroska->packets,&matroska->num_packets,pkt);
- matroska->prev_pkt = pkt;
- }
- }
+ res = matroska_parse_rm_audio(matroska, track, st, data,
+ lace_size[n],
+ timecode, duration, pos);
+ if (res)
+ goto end;
- if (timecode != AV_NOPTS_VALUE)
- timecode = duration ? timecode + duration : AV_NOPTS_VALUE;
- data += lace_size[n];
- size -= lace_size[n];
+ } else {
+ res = matroska_parse_frame(matroska, track, st, data, lace_size[n],
+ timecode, duration,
+ pos, !n? is_keyframe : 0);
+ if (res)
+ goto end;
}
+
+ if (timecode != AV_NOPTS_VALUE)
+ timecode = duration ? timecode + duration : AV_NOPTS_VALUE;
+ data += lace_size[n];
}
+end:
av_free(lace_size);
return res;
}
+static int matroska_parse_cluster_incremental(MatroskaDemuxContext *matroska)
+{
+ EbmlList *blocks_list;
+ MatroskaBlock *blocks;
+ int i, res;
+ res = ebml_parse(matroska,
+ matroska_cluster_incremental_parsing,
+ &matroska->current_cluster);
+ if (res == 1) {
+ /* New Cluster */
+ if (matroska->current_cluster_pos)
+ ebml_level_end(matroska);
+ ebml_free(matroska_cluster, &matroska->current_cluster);
+ memset(&matroska->current_cluster, 0, sizeof(MatroskaCluster));
+ matroska->current_cluster_num_blocks = 0;
+ matroska->current_cluster_pos = avio_tell(matroska->ctx->pb);
+ matroska->prev_pkt = NULL;
+ /* sizeof the ID which was already read */
+ if (matroska->current_id)
+ matroska->current_cluster_pos -= 4;
+ res = ebml_parse(matroska,
+ matroska_clusters_incremental,
+ &matroska->current_cluster);
+ /* Try parsing the block again. */
+ if (res == 1)
+ res = ebml_parse(matroska,
+ matroska_cluster_incremental_parsing,
+ &matroska->current_cluster);
+ }
+
+ if (!res &&
+ matroska->current_cluster_num_blocks <
+ matroska->current_cluster.blocks.nb_elem) {
+ blocks_list = &matroska->current_cluster.blocks;
+ blocks = blocks_list->elem;
+
+ matroska->current_cluster_num_blocks = blocks_list->nb_elem;
+ i = blocks_list->nb_elem - 1;
+ if (blocks[i].bin.size > 0 && blocks[i].bin.data) {
+ int is_keyframe = blocks[i].non_simple ? !blocks[i].reference : -1;
+ if (!blocks[i].non_simple)
+ blocks[i].duration = AV_NOPTS_VALUE;
+ res = matroska_parse_block(matroska,
+ blocks[i].bin.data, blocks[i].bin.size,
+ blocks[i].bin.pos,
+ matroska->current_cluster.timecode,
+ blocks[i].duration, is_keyframe,
+ matroska->current_cluster_pos);
+ }
+ }
+
+ if (res < 0) matroska->done = 1;
+ return res;
+}
+
static int matroska_parse_cluster(MatroskaDemuxContext *matroska)
{
MatroskaCluster cluster = { 0 };
EbmlList *blocks_list;
MatroskaBlock *blocks;
int i, res;
- int64_t pos = avio_tell(matroska->ctx->pb);
+ int64_t pos;
+ if (!matroska->contains_ssa)
+ return matroska_parse_cluster_incremental(matroska);
+ pos = avio_tell(matroska->ctx->pb);
matroska->prev_pkt = NULL;
if (matroska->current_id)
pos -= 4; /* sizeof the ID which was already read */
@@ -1962,6 +2203,11 @@ static int matroska_read_packet(AVFormatContext *s, AVPacket *pkt)
ret = matroska_parse_cluster(matroska);
}
+ if (ret == AVERROR_INVALIDDATA && pkt->data) {
+ pkt->flags |= AV_PKT_FLAG_CORRUPT;
+ return 0;
+ }
+
return ret;
}
@@ -2033,6 +2279,7 @@ static int matroska_read_close(AVFormatContext *s)
for (n=0; n < matroska->tracks.nb_elem; n++)
if (tracks[n].type == MATROSKA_TRACK_TYPE_AUDIO)
av_free(tracks[n].audio.buf);
+ ebml_free(matroska_cluster, &matroska->current_cluster);
ebml_free(matroska_segment, matroska);
return 0;
@@ -2040,7 +2287,7 @@ static int matroska_read_close(AVFormatContext *s)
AVInputFormat ff_matroska_demuxer = {
.name = "matroska,webm",
- .long_name = NULL_IF_CONFIG_SMALL("Matroska/WebM file format"),
+ .long_name = NULL_IF_CONFIG_SMALL("Matroska / WebM"),
.priv_data_size = sizeof(MatroskaDemuxContext),
.read_probe = matroska_probe,
.read_header = matroska_read_header,
diff --git a/gst-libs/ext/libav/libavformat/matroskaenc.c b/gst-libs/ext/libav/libavformat/matroskaenc.c
index e93dd65..b37d10c 100644
--- a/gst-libs/ext/libav/libavformat/matroskaenc.c
+++ b/gst-libs/ext/libav/libavformat/matroskaenc.c
@@ -368,13 +368,13 @@ static int mkv_add_cuepoint(mkv_cues *cues, int stream, int64_t ts, int64_t clus
{
mkv_cuepoint *entries = cues->entries;
+ if (ts < 0)
+ return 0;
+
entries = av_realloc(entries, (cues->num_entries + 1) * sizeof(mkv_cuepoint));
if (entries == NULL)
return AVERROR(ENOMEM);
- if (ts < 0)
- return 0;
-
entries[cues->num_entries ].pts = ts;
entries[cues->num_entries ].tracknum = stream + 1;
entries[cues->num_entries++].cluster_pos = cluster_pos - cues->segment_offset;
@@ -423,7 +423,7 @@ static int put_xiph_codecpriv(AVFormatContext *s, AVIOContext *pb, AVCodecContex
int first_header_size;
int j;
- if (codec->codec_id == CODEC_ID_VORBIS)
+ if (codec->codec_id == AV_CODEC_ID_VORBIS)
first_header_size = 30;
else
first_header_size = 42;
@@ -469,18 +469,28 @@ static int mkv_write_codecprivate(AVFormatContext *s, AVIOContext *pb, AVCodecCo
return ret;
if (native_id) {
- if (codec->codec_id == CODEC_ID_VORBIS || codec->codec_id == CODEC_ID_THEORA)
+ if (codec->codec_id == AV_CODEC_ID_VORBIS || codec->codec_id == AV_CODEC_ID_THEORA)
ret = put_xiph_codecpriv(s, dyn_cp, codec);
- else if (codec->codec_id == CODEC_ID_FLAC)
+ else if (codec->codec_id == AV_CODEC_ID_FLAC)
ret = ff_flac_write_header(dyn_cp, codec, 1);
- else if (codec->codec_id == CODEC_ID_H264)
+ else if (codec->codec_id == AV_CODEC_ID_H264)
ret = ff_isom_write_avcc(dyn_cp, codec->extradata, codec->extradata_size);
+ else if (codec->codec_id == AV_CODEC_ID_ALAC) {
+ if (codec->extradata_size < 36) {
+ av_log(s, AV_LOG_ERROR,
+ "Invalid extradata found, ALAC expects a 36-byte "
+ "QuickTime atom.");
+ ret = AVERROR_INVALIDDATA;
+ } else
+ avio_write(dyn_cp, codec->extradata + 12,
+ codec->extradata_size - 12);
+ }
else if (codec->extradata_size)
avio_write(dyn_cp, codec->extradata, codec->extradata_size);
} else if (codec->codec_type == AVMEDIA_TYPE_VIDEO) {
if (qt_id) {
if (!codec->codec_tag)
- codec->codec_tag = ff_codec_get_tag(codec_movvideo_tags, codec->codec_id);
+ codec->codec_tag = ff_codec_get_tag(ff_codec_movvideo_tags, codec->codec_id);
if (codec->extradata_size)
avio_write(dyn_cp, codec->extradata, codec->extradata_size);
} else {
@@ -544,7 +554,7 @@ static int mkv_write_tracks(AVFormatContext *s)
if (!bit_depth)
bit_depth = av_get_bytes_per_sample(codec->sample_fmt) << 3;
- if (codec->codec_id == CODEC_ID_AAC)
+ if (codec->codec_id == AV_CODEC_ID_AAC)
get_aac_sample_rates(s, codec, &sample_rate, &output_sample_rate);
track = start_ebml_master(pb, MATROSKA_ID_TRACKENTRY, 0);
@@ -562,7 +572,7 @@ static int mkv_write_tracks(AVFormatContext *s)
// look for a codec ID string specific to mkv to use,
// if none are found, use AVI codes
- for (j = 0; ff_mkv_codec_tags[j].id != CODEC_ID_NONE; j++) {
+ for (j = 0; ff_mkv_codec_tags[j].id != AV_CODEC_ID_NONE; j++) {
if (ff_mkv_codec_tags[j].id == codec->codec_id) {
put_ebml_string(pb, MATROSKA_ID_CODECID, ff_mkv_codec_tags[j].str);
native_id = 1;
@@ -570,8 +580,8 @@ static int mkv_write_tracks(AVFormatContext *s)
}
}
- if (mkv->mode == MODE_WEBM && !(codec->codec_id == CODEC_ID_VP8 ||
- codec->codec_id == CODEC_ID_VORBIS)) {
+ if (mkv->mode == MODE_WEBM && !(codec->codec_id == AV_CODEC_ID_VP8 ||
+ codec->codec_id == AV_CODEC_ID_VORBIS)) {
av_log(s, AV_LOG_ERROR,
"Only VP8 video and Vorbis audio are supported for WebM.\n");
return AVERROR(EINVAL);
@@ -583,11 +593,11 @@ static int mkv_write_tracks(AVFormatContext *s)
put_ebml_uint(pb, MATROSKA_ID_TRACKDEFAULTDURATION, av_q2d(codec->time_base)*1E9);
if (!native_id &&
- ff_codec_get_tag(codec_movvideo_tags, codec->codec_id) &&
+ ff_codec_get_tag(ff_codec_movvideo_tags, codec->codec_id) &&
(!ff_codec_get_tag(ff_codec_bmp_tags, codec->codec_id)
- || codec->codec_id == CODEC_ID_SVQ1
- || codec->codec_id == CODEC_ID_SVQ3
- || codec->codec_id == CODEC_ID_CINEPAK))
+ || codec->codec_id == AV_CODEC_ID_SVQ1
+ || codec->codec_id == AV_CODEC_ID_SVQ3
+ || codec->codec_id == AV_CODEC_ID_CINEPAK))
qt_id = 1;
if (qt_id)
@@ -848,9 +858,9 @@ static int mkv_write_attachments(AVFormatContext *s)
put_ebml_string(pb, MATROSKA_ID_FILENAME, t->value);
if (t = av_dict_get(st->metadata, "mimetype", NULL, 0))
mimetype = t->value;
- else if (st->codec->codec_id != CODEC_ID_NONE ) {
+ else if (st->codec->codec_id != AV_CODEC_ID_NONE ) {
int i;
- for (i = 0; ff_mkv_mime_tags[i].id != CODEC_ID_NONE; i++)
+ for (i = 0; ff_mkv_mime_tags[i].id != AV_CODEC_ID_NONE; i++)
if (ff_mkv_mime_tags[i].id == st->codec->codec_id) {
mimetype = ff_mkv_mime_tags[i].str;
break;
@@ -1040,23 +1050,31 @@ static void mkv_write_block(AVFormatContext *s, AVIOContext *pb,
MatroskaMuxContext *mkv = s->priv_data;
AVCodecContext *codec = s->streams[pkt->stream_index]->codec;
uint8_t *data = NULL;
- int size = pkt->size;
+ int offset = 0, size = pkt->size;
int64_t ts = mkv->tracks[pkt->stream_index].write_dts ? pkt->dts : pkt->pts;
av_log(s, AV_LOG_DEBUG, "Writing block at offset %" PRIu64 ", size %d, "
"pts %" PRId64 ", dts %" PRId64 ", duration %d, flags %d\n",
avio_tell(pb), pkt->size, pkt->pts, pkt->dts, pkt->duration, flags);
- if (codec->codec_id == CODEC_ID_H264 && codec->extradata_size > 0 &&
+ if (codec->codec_id == AV_CODEC_ID_H264 && codec->extradata_size > 0 &&
(AV_RB24(codec->extradata) == 1 || AV_RB32(codec->extradata) == 1))
ff_avc_parse_nal_units_buf(pkt->data, &data, &size);
else
data = pkt->data;
+
+ if (codec->codec_id == AV_CODEC_ID_PRORES) {
+ /* Matroska specification requires to remove the first QuickTime atom
+ */
+ size -= 8;
+ offset = 8;
+ }
+
put_ebml_id(pb, blockid);
put_ebml_num(pb, size+4, 0);
avio_w8(pb, 0x80 | (pkt->stream_index + 1)); // this assumes stream_index is less than 126
avio_wb16(pb, ts - mkv->cluster_pts);
avio_w8(pb, flags);
- avio_write(pb, data, size);
+ avio_write(pb, data + offset, size);
if (data != pkt->data)
av_free(data);
}
@@ -1141,9 +1159,9 @@ static int mkv_write_packet_internal(AVFormatContext *s, AVPacket *pkt)
if (codec->codec_type != AVMEDIA_TYPE_SUBTITLE) {
mkv_write_block(s, pb, MATROSKA_ID_SIMPLEBLOCK, pkt, keyframe << 7);
- } else if (codec->codec_id == CODEC_ID_SSA) {
+ } else if (codec->codec_id == AV_CODEC_ID_SSA) {
duration = mkv_write_ass_blocks(s, pb, pkt);
- } else if (codec->codec_id == CODEC_ID_SRT) {
+ } else if (codec->codec_id == AV_CODEC_ID_SRT) {
duration = mkv_write_srt_blocks(s, pb, pkt);
} else {
ebml_master blockgroup = start_ebml_master(pb, MATROSKA_ID_BLOCKGROUP, mkv_blockgroup_size(pkt->size));
@@ -1265,14 +1283,14 @@ static int mkv_write_trailer(AVFormatContext *s)
av_freep(&mkv->cues->entries);
av_freep(&mkv->cues);
av_destruct_packet(&mkv->cur_audio_pkt);
- avio_flush(pb);
+
return 0;
}
-static int mkv_query_codec(enum CodecID codec_id, int std_compliance)
+static int mkv_query_codec(enum AVCodecID codec_id, int std_compliance)
{
int i;
- for (i = 0; ff_mkv_codec_tags[i].id != CODEC_ID_NONE; i++)
+ for (i = 0; ff_mkv_codec_tags[i].id != AV_CODEC_ID_NONE; i++)
if (ff_mkv_codec_tags[i].id == codec_id)
return 1;
@@ -1288,26 +1306,23 @@ static int mkv_query_codec(enum CodecID codec_id, int std_compliance)
#if CONFIG_MATROSKA_MUXER
AVOutputFormat ff_matroska_muxer = {
.name = "matroska",
- .long_name = NULL_IF_CONFIG_SMALL("Matroska file format"),
+ .long_name = NULL_IF_CONFIG_SMALL("Matroska"),
.mime_type = "video/x-matroska",
.extensions = "mkv",
.priv_data_size = sizeof(MatroskaMuxContext),
-#if CONFIG_LIBVORBIS_ENCODER
- .audio_codec = CODEC_ID_VORBIS,
-#else
- .audio_codec = CODEC_ID_AC3,
-#endif
-#if CONFIG_LIBX264_ENCODER
- .video_codec = CODEC_ID_H264,
-#else
- .video_codec = CODEC_ID_MPEG4,
-#endif
+ .audio_codec = CONFIG_LIBVORBIS_ENCODER ?
+ AV_CODEC_ID_VORBIS : AV_CODEC_ID_AC3,
+ .video_codec = CONFIG_LIBX264_ENCODER ?
+ AV_CODEC_ID_H264 : AV_CODEC_ID_MPEG4,
.write_header = mkv_write_header,
.write_packet = mkv_write_packet,
.write_trailer = mkv_write_trailer,
- .flags = AVFMT_GLOBALHEADER | AVFMT_VARIABLE_FPS,
- .codec_tag = (const AVCodecTag* const []){ff_codec_bmp_tags, ff_codec_wav_tags, 0},
- .subtitle_codec = CODEC_ID_SSA,
+ .flags = AVFMT_GLOBALHEADER | AVFMT_VARIABLE_FPS |
+ AVFMT_TS_NONSTRICT,
+ .codec_tag = (const AVCodecTag* const []){
+ ff_codec_bmp_tags, ff_codec_wav_tags, 0
+ },
+ .subtitle_codec = AV_CODEC_ID_SSA,
.query_codec = mkv_query_codec,
};
#endif
@@ -1315,36 +1330,34 @@ AVOutputFormat ff_matroska_muxer = {
#if CONFIG_WEBM_MUXER
AVOutputFormat ff_webm_muxer = {
.name = "webm",
- .long_name = NULL_IF_CONFIG_SMALL("WebM file format"),
+ .long_name = NULL_IF_CONFIG_SMALL("WebM"),
.mime_type = "video/webm",
.extensions = "webm",
.priv_data_size = sizeof(MatroskaMuxContext),
- .audio_codec = CODEC_ID_VORBIS,
- .video_codec = CODEC_ID_VP8,
+ .audio_codec = AV_CODEC_ID_VORBIS,
+ .video_codec = AV_CODEC_ID_VP8,
.write_header = mkv_write_header,
.write_packet = mkv_write_packet,
.write_trailer = mkv_write_trailer,
- .flags = AVFMT_GLOBALHEADER | AVFMT_VARIABLE_FPS,
+ .flags = AVFMT_GLOBALHEADER | AVFMT_VARIABLE_FPS |
+ AVFMT_TS_NONSTRICT,
};
#endif
#if CONFIG_MATROSKA_AUDIO_MUXER
AVOutputFormat ff_matroska_audio_muxer = {
.name = "matroska",
- .long_name = NULL_IF_CONFIG_SMALL("Matroska file format"),
+ .long_name = NULL_IF_CONFIG_SMALL("Matroska"),
.mime_type = "audio/x-matroska",
.extensions = "mka",
.priv_data_size = sizeof(MatroskaMuxContext),
-#if CONFIG_LIBVORBIS_ENCODER
- .audio_codec = CODEC_ID_VORBIS,
-#else
- .audio_codec = CODEC_ID_AC3,
-#endif
- .video_codec = CODEC_ID_NONE,
+ .audio_codec = CONFIG_LIBVORBIS_ENCODER ?
+ AV_CODEC_ID_VORBIS : AV_CODEC_ID_AC3,
+ .video_codec = AV_CODEC_ID_NONE,
.write_header = mkv_write_header,
.write_packet = mkv_write_packet,
.write_trailer = mkv_write_trailer,
- .flags = AVFMT_GLOBALHEADER,
- .codec_tag = (const AVCodecTag* const []){ff_codec_wav_tags, 0},
+ .flags = AVFMT_GLOBALHEADER | AVFMT_TS_NONSTRICT,
+ .codec_tag = (const AVCodecTag* const []){ ff_codec_wav_tags, 0 },
};
#endif
diff --git a/gst-libs/ext/libav/libavformat/md5enc.c b/gst-libs/ext/libav/libavformat/md5enc.c
index 4509c18..16412c9 100644
--- a/gst-libs/ext/libav/libavformat/md5enc.c
+++ b/gst-libs/ext/libav/libavformat/md5enc.c
@@ -21,14 +21,18 @@
#include "libavutil/md5.h"
#include "avformat.h"
+#include "internal.h"
-#define PRIVSIZE 512
+struct MD5Context {
+ struct AVMD5 *md5;
+};
static void md5_finish(struct AVFormatContext *s, char *buf)
{
+ struct MD5Context *c = s->priv_data;
uint8_t md5[16];
int i, offset = strlen(buf);
- av_md5_final(s->priv_data, md5);
+ av_md5_final(c->md5, md5);
for (i = 0; i < sizeof(md5); i++) {
snprintf(buf + offset, 3, "%02"PRIx8, md5[i]);
offset += 2;
@@ -43,35 +47,39 @@ static void md5_finish(struct AVFormatContext *s, char *buf)
#if CONFIG_MD5_MUXER
static int write_header(struct AVFormatContext *s)
{
- if (PRIVSIZE < av_md5_size) {
- av_log(s, AV_LOG_ERROR, "Insuffient size for md5 context\n");
- return -1;
- }
- av_md5_init(s->priv_data);
+ struct MD5Context *c = s->priv_data;
+ c->md5 = av_md5_alloc();
+ if (!c->md5)
+ return AVERROR(ENOMEM);
+ av_md5_init(c->md5);
return 0;
}
static int write_packet(struct AVFormatContext *s, AVPacket *pkt)
{
- av_md5_update(s->priv_data, pkt->data, pkt->size);
+ struct MD5Context *c = s->priv_data;
+ av_md5_update(c->md5, pkt->data, pkt->size);
return 0;
}
static int write_trailer(struct AVFormatContext *s)
{
+ struct MD5Context *c = s->priv_data;
char buf[64] = "MD5=";
md5_finish(s, buf);
+
+ av_freep(&c->md5);
return 0;
}
AVOutputFormat ff_md5_muxer = {
.name = "md5",
- .long_name = NULL_IF_CONFIG_SMALL("MD5 testing format"),
+ .long_name = NULL_IF_CONFIG_SMALL("MD5 testing"),
.extensions = "",
- .priv_data_size = PRIVSIZE,
- .audio_codec = CODEC_ID_PCM_S16LE,
- .video_codec = CODEC_ID_RAWVIDEO,
+ .priv_data_size = sizeof(struct MD5Context),
+ .audio_codec = AV_CODEC_ID_PCM_S16LE,
+ .video_codec = AV_CODEC_ID_RAWVIDEO,
.write_header = write_header,
.write_packet = write_packet,
.write_trailer = write_trailer,
@@ -80,29 +88,45 @@ AVOutputFormat ff_md5_muxer = {
#endif
#if CONFIG_FRAMEMD5_MUXER
+static int framemd5_write_header(struct AVFormatContext *s)
+{
+ struct MD5Context *c = s->priv_data;
+ c->md5 = av_md5_alloc();
+ if (!c->md5)
+ return AVERROR(ENOMEM);
+ return ff_framehash_write_header(s);
+}
+
static int framemd5_write_packet(struct AVFormatContext *s, AVPacket *pkt)
{
+ struct MD5Context *c = s->priv_data;
char buf[256];
- if (PRIVSIZE < av_md5_size) {
- av_log(s, AV_LOG_ERROR, "Insuffient size for md5 context\n");
- return -1;
- }
- av_md5_init(s->priv_data);
- av_md5_update(s->priv_data, pkt->data, pkt->size);
+ av_md5_init(c->md5);
+ av_md5_update(c->md5, pkt->data, pkt->size);
- snprintf(buf, sizeof(buf) - 64, "%d, %"PRId64", %d, ", pkt->stream_index, pkt->dts, pkt->size);
+ snprintf(buf, sizeof(buf) - 64, "%d, %10"PRId64", %10"PRId64", %8d, %8d, ",
+ pkt->stream_index, pkt->dts, pkt->pts, pkt->duration, pkt->size);
md5_finish(s, buf);
return 0;
}
+static int framemd5_write_trailer(struct AVFormatContext *s)
+{
+ struct MD5Context *c = s->priv_data;
+ av_freep(&c->md5);
+ return 0;
+}
+
AVOutputFormat ff_framemd5_muxer = {
.name = "framemd5",
- .long_name = NULL_IF_CONFIG_SMALL("Per-frame MD5 testing format"),
+ .long_name = NULL_IF_CONFIG_SMALL("Per-frame MD5 testing"),
.extensions = "",
- .priv_data_size = PRIVSIZE,
- .audio_codec = CODEC_ID_PCM_S16LE,
- .video_codec = CODEC_ID_RAWVIDEO,
+ .priv_data_size = sizeof(struct MD5Context),
+ .audio_codec = AV_CODEC_ID_PCM_S16LE,
+ .video_codec = AV_CODEC_ID_RAWVIDEO,
+ .write_header = framemd5_write_header,
.write_packet = framemd5_write_packet,
- .flags = AVFMT_VARIABLE_FPS,
+ .write_trailer = framemd5_write_trailer,
+ .flags = AVFMT_VARIABLE_FPS | AVFMT_TS_NONSTRICT,
};
#endif
diff --git a/gst-libs/ext/libav/libavformat/md5proto.c b/gst-libs/ext/libav/libavformat/md5proto.c
index 796b4ea..12ddde3 100644
--- a/gst-libs/ext/libav/libavformat/md5proto.c
+++ b/gst-libs/ext/libav/libavformat/md5proto.c
@@ -27,37 +27,41 @@
#include "avio.h"
#include "url.h"
-#define PRIV_SIZE 128
+struct MD5Context {
+ struct AVMD5 *md5;
+};
static int md5_open(URLContext *h, const char *filename, int flags)
{
- if (PRIV_SIZE < av_md5_size) {
- av_log(NULL, AV_LOG_ERROR, "Insuffient size for MD5 context\n");
- return -1;
- }
+ struct MD5Context *c = h->priv_data;
if (!(flags & AVIO_FLAG_WRITE))
return AVERROR(EINVAL);
- av_md5_init(h->priv_data);
+ c->md5 = av_md5_alloc();
+ if (!c->md5)
+ return AVERROR(ENOMEM);
+ av_md5_init(c->md5);
return 0;
}
static int md5_write(URLContext *h, const unsigned char *buf, int size)
{
- av_md5_update(h->priv_data, buf, size);
+ struct MD5Context *c = h->priv_data;
+ av_md5_update(c->md5, buf, size);
return size;
}
static int md5_close(URLContext *h)
{
+ struct MD5Context *c = h->priv_data;
const char *filename = h->filename;
uint8_t md5[16], buf[64];
URLContext *out;
int i, err = 0;
- av_md5_final(h->priv_data, md5);
+ av_md5_final(c->md5, md5);
for (i = 0; i < sizeof(md5); i++)
snprintf(buf + i*2, 3, "%02x", md5[i]);
buf[i*2] = '\n';
@@ -76,6 +80,8 @@ static int md5_close(URLContext *h)
err = AVERROR(errno);
}
+ av_freep(&c->md5);
+
return err;
}
@@ -85,5 +91,5 @@ URLProtocol ff_md5_protocol = {
.url_open = md5_open,
.url_write = md5_write,
.url_close = md5_close,
- .priv_data_size = PRIV_SIZE,
+ .priv_data_size = sizeof(struct MD5Context),
};
diff --git a/gst-libs/ext/libav/libavformat/metadata.c b/gst-libs/ext/libav/libavformat/metadata.c
index 7d85363..77fb298 100644
--- a/gst-libs/ext/libav/libavformat/metadata.c
+++ b/gst-libs/ext/libav/libavformat/metadata.c
@@ -23,35 +23,6 @@
#include "libavutil/dict.h"
#include "libavutil/avstring.h"
-#if FF_API_OLD_METADATA2
-AVDictionaryEntry *
-av_metadata_get(AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags)
-{
- return av_dict_get(m, key, prev, flags);
-}
-
-int av_metadata_set2(AVDictionary **pm, const char *key, const char *value, int flags)
-{
- return av_dict_set(pm, key, value, flags);
-}
-
-void av_metadata_conv(AVFormatContext *ctx, const AVMetadataConv *d_conv,
- const AVMetadataConv *s_conv)
-{
- return;
-}
-
-void av_metadata_free(AVDictionary **pm)
-{
- av_dict_free(pm);
-}
-
-void av_metadata_copy(AVDictionary **dst, AVDictionary *src, int flags)
-{
- av_dict_copy(dst, src, flags);
-}
-#endif
-
void ff_metadata_conv(AVDictionary **pm, const AVMetadataConv *d_conv,
const AVMetadataConv *s_conv)
{
@@ -97,4 +68,3 @@ void ff_metadata_conv_ctx(AVFormatContext *ctx, const AVMetadataConv *d_conv,
for (i=0; i<ctx->nb_programs; i++)
ff_metadata_conv(&ctx->programs[i]->metadata, d_conv, s_conv);
}
-
diff --git a/gst-libs/ext/libav/libavformat/metadata.h b/gst-libs/ext/libav/libavformat/metadata.h
index 33e0d1f..eee3ee4 100644
--- a/gst-libs/ext/libav/libavformat/metadata.h
+++ b/gst-libs/ext/libav/libavformat/metadata.h
@@ -31,13 +31,10 @@
#include "avformat.h"
#include "libavutil/dict.h"
-struct AVMetadataConv{
+typedef struct AVMetadataConv {
const char *native;
const char *generic;
-};
-#if !FF_API_OLD_METADATA2
-typedef struct AVMetadataConv AVMetadataConv;
-#endif
+} AVMetadataConv;
void ff_metadata_conv(AVDictionary **pm, const AVMetadataConv *d_conv,
const AVMetadataConv *s_conv);
diff --git a/gst-libs/ext/libav/libavformat/mm.c b/gst-libs/ext/libav/libavformat/mm.c
index 341cf26..83539fa 100644
--- a/gst-libs/ext/libav/libavformat/mm.c
+++ b/gst-libs/ext/libav/libavformat/mm.c
@@ -31,6 +31,7 @@
* http://wiki.multimedia.cx/index.php?title=American_Laser_Games_MM
*/
+#include "libavutil/channel_layout.h"
#include "libavutil/intreadwrite.h"
#include "avformat.h"
#include "internal.h"
@@ -81,8 +82,7 @@ static int probe(AVProbeData *p)
return AVPROBE_SCORE_MAX / 2;
}
-static int read_header(AVFormatContext *s,
- AVFormatParameters *ap)
+static int read_header(AVFormatContext *s)
{
MmDemuxContext *mm = s->priv_data;
AVIOContext *pb = s->pb;
@@ -110,7 +110,7 @@ static int read_header(AVFormatContext *s,
if (!st)
return AVERROR(ENOMEM);
st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
- st->codec->codec_id = CODEC_ID_MMVIDEO;
+ st->codec->codec_id = AV_CODEC_ID_MMVIDEO;
st->codec->codec_tag = 0; /* no fourcc */
st->codec->width = width;
st->codec->height = height;
@@ -123,8 +123,9 @@ static int read_header(AVFormatContext *s,
return AVERROR(ENOMEM);
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
st->codec->codec_tag = 0; /* no fourcc */
- st->codec->codec_id = CODEC_ID_PCM_U8;
+ st->codec->codec_id = AV_CODEC_ID_PCM_U8;
st->codec->channels = 1;
+ st->codec->channel_layout = AV_CH_LAYOUT_MONO;
st->codec->sample_rate = 8000;
avpriv_set_pts_info(st, 64, 1, 8000); /* 8000 hz */
}
@@ -189,7 +190,7 @@ static int read_packet(AVFormatContext *s,
AVInputFormat ff_mm_demuxer = {
.name = "mm",
- .long_name = NULL_IF_CONFIG_SMALL("American Laser Games MM format"),
+ .long_name = NULL_IF_CONFIG_SMALL("American Laser Games MM"),
.priv_data_size = sizeof(MmDemuxContext),
.read_probe = probe,
.read_header = read_header,
diff --git a/gst-libs/ext/libav/libavformat/mmf.c b/gst-libs/ext/libav/libavformat/mmf.c
index 8e4f2de..20570f2 100644
--- a/gst-libs/ext/libav/libavformat/mmf.c
+++ b/gst-libs/ext/libav/libavformat/mmf.c
@@ -18,6 +18,8 @@
* License along with Libav; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+
+#include "libavutil/channel_layout.h"
#include "avformat.h"
#include "internal.h"
#include "avio_internal.h"
@@ -180,8 +182,7 @@ static int mmf_probe(AVProbeData *p)
}
/* mmf input */
-static int mmf_read_header(AVFormatContext *s,
- AVFormatParameters *ap)
+static int mmf_read_header(AVFormatContext *s)
{
MMFContext *mmf = s->priv_data;
unsigned int tag;
@@ -247,9 +248,10 @@ static int mmf_read_header(AVFormatContext *s,
return AVERROR(ENOMEM);
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
- st->codec->codec_id = CODEC_ID_ADPCM_YAMAHA;
+ st->codec->codec_id = AV_CODEC_ID_ADPCM_YAMAHA;
st->codec->sample_rate = rate;
st->codec->channels = 1;
+ st->codec->channel_layout = AV_CH_LAYOUT_MONO;
st->codec->bits_per_coded_sample = 4;
st->codec->bit_rate = st->codec->sample_rate * st->codec->bits_per_coded_sample;
@@ -298,7 +300,7 @@ AVInputFormat ff_mmf_demuxer = {
.read_probe = mmf_probe,
.read_header = mmf_read_header,
.read_packet = mmf_read_packet,
- .read_seek = pcm_read_seek,
+ .read_seek = ff_pcm_read_seek,
};
#endif
#if CONFIG_MMF_MUXER
@@ -308,8 +310,8 @@ AVOutputFormat ff_mmf_muxer = {
.mime_type = "application/vnd.smaf",
.extensions = "mmf",
.priv_data_size = sizeof(MMFContext),
- .audio_codec = CODEC_ID_ADPCM_YAMAHA,
- .video_codec = CODEC_ID_NONE,
+ .audio_codec = AV_CODEC_ID_ADPCM_YAMAHA,
+ .video_codec = AV_CODEC_ID_NONE,
.write_header = mmf_write_header,
.write_packet = mmf_write_packet,
.write_trailer = mmf_write_trailer,
diff --git a/gst-libs/ext/libav/libavformat/mms.h b/gst-libs/ext/libav/libavformat/mms.h
index 5235581..e89da41 100644
--- a/gst-libs/ext/libav/libavformat/mms.h
+++ b/gst-libs/ext/libav/libavformat/mms.h
@@ -23,11 +23,11 @@
#include "url.h"
-typedef struct {
+typedef struct MMSStream {
int id;
}MMSStream;
-typedef struct {
+typedef struct MMSContext {
URLContext *mms_hd; ///< TCP connection handle
MMSStream *streams;
diff --git a/gst-libs/ext/libav/libavformat/mmst.c b/gst-libs/ext/libav/libavformat/mmst.c
index 93ad073..4b96f5d 100644
--- a/gst-libs/ext/libav/libavformat/mmst.c
+++ b/gst-libs/ext/libav/libavformat/mmst.c
@@ -144,7 +144,7 @@ static int send_command_packet(MMSTContext *mmst)
av_log(NULL, AV_LOG_ERROR,
"Failed to write data of length %d: %d (%s)\n",
exact_length, write_result,
- write_result < 0 ? strerror(write_result) :
+ write_result < 0 ? strerror(AVUNERROR(write_result)) :
"The server closed the connection");
return AVERROR(EIO);
}
@@ -246,7 +246,7 @@ static MMSSCPacketType get_tcp_server_response(MMSTContext *mmst)
if(read_result < 0) {
av_log(NULL, AV_LOG_ERROR,
"Error reading packet header: %d (%s)\n",
- read_result, strerror(read_result));
+ read_result, strerror(AVUNERROR(read_result)));
packet_type = SC_PKT_CANCEL;
} else {
av_log(NULL, AV_LOG_ERROR,
@@ -266,7 +266,7 @@ static MMSSCPacketType get_tcp_server_response(MMSTContext *mmst)
av_log(NULL, AV_LOG_ERROR,
"Reading command packet length failed: %d (%s)\n",
read_result,
- read_result < 0 ? strerror(read_result) :
+ read_result < 0 ? strerror(AVUNERROR(read_result)) :
"The server closed the connection");
return read_result < 0 ? read_result : AVERROR(EIO);
}
@@ -287,7 +287,7 @@ static MMSSCPacketType get_tcp_server_response(MMSTContext *mmst)
av_log(NULL, AV_LOG_ERROR,
"Reading pkt data (length=%d) failed: %d (%s)\n",
length_remaining, read_result,
- read_result < 0 ? strerror(read_result) :
+ read_result < 0 ? strerror(AVUNERROR(read_result)) :
"The server closed the connection");
return read_result < 0 ? read_result : AVERROR(EIO);
}
@@ -324,7 +324,7 @@ static MMSSCPacketType get_tcp_server_response(MMSTContext *mmst)
av_log(NULL, AV_LOG_ERROR,
"Failed to read packet data of size %d: %d (%s)\n",
length_remaining, read_result,
- read_result < 0 ? strerror(read_result) :
+ read_result < 0 ? strerror(AVUNERROR(read_result)) :
"The server closed the connection");
return read_result < 0 ? read_result : AVERROR(EIO);
}
diff --git a/gst-libs/ext/libav/libavformat/mov.c b/gst-libs/ext/libav/libavformat/mov.c
index 1dbf63f..7fe0548 100644
--- a/gst-libs/ext/libav/libavformat/mov.c
+++ b/gst-libs/ext/libav/libavformat/mov.c
@@ -25,7 +25,8 @@
//#define DEBUG
//#define MOV_EXPORT_ALL_METADATA
-#include "libavutil/audioconvert.h"
+#include "libavutil/attributes.h"
+#include "libavutil/channel_layout.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/intfloat.h"
#include "libavutil/mathematics.h"
@@ -63,17 +64,18 @@ typedef struct MOVParseTableEntry {
int (*parse)(MOVContext *ctx, AVIOContext *pb, MOVAtom atom);
} MOVParseTableEntry;
-static const MOVParseTableEntry mov_default_parse_table[];
+static int mov_read_default(MOVContext *c, AVIOContext *pb, MOVAtom atom);
static int mov_metadata_track_or_disc_number(MOVContext *c, AVIOContext *pb,
unsigned len, const char *key)
{
char buf[16];
- short current, total;
+ short current, total = 0;
avio_rb16(pb); // unknown
current = avio_rb16(pb);
- total = avio_rb16(pb);
+ if (len >= 6)
+ total = avio_rb16(pb);
if (!total)
snprintf(buf, sizeof(buf), "%d", current);
else
@@ -164,6 +166,48 @@ static int mov_read_mac_string(MOVContext *c, AVIOContext *pb, int len,
return p - dst;
}
+static int mov_read_covr(MOVContext *c, AVIOContext *pb, int type, int len)
+{
+ AVPacket pkt;
+ AVStream *st;
+ MOVStreamContext *sc;
+ enum AVCodecID id;
+ int ret;
+
+ switch (type) {
+ case 0xd: id = AV_CODEC_ID_MJPEG; break;
+ case 0xe: id = AV_CODEC_ID_PNG; break;
+ case 0x1b: id = AV_CODEC_ID_BMP; break;
+ default:
+ av_log(c->fc, AV_LOG_WARNING, "Unknown cover type: 0x%x.\n", type);
+ avio_skip(pb, len);
+ return 0;
+ }
+
+ st = avformat_new_stream(c->fc, NULL);
+ if (!st)
+ return AVERROR(ENOMEM);
+ sc = av_mallocz(sizeof(*sc));
+ if (!sc)
+ return AVERROR(ENOMEM);
+ st->priv_data = sc;
+
+ ret = av_get_packet(pb, &pkt, len);
+ if (ret < 0)
+ return ret;
+
+ st->disposition |= AV_DISPOSITION_ATTACHED_PIC;
+
+ st->attached_pic = pkt;
+ st->attached_pic.stream_index = st->index;
+ st->attached_pic.flags |= AV_PKT_FLAG_KEY;
+
+ st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
+ st->codec->codec_id = id;
+
+ return 0;
+}
+
static int mov_read_udta_string(MOVContext *c, AVIOContext *pb, MOVAtom atom)
{
#ifdef MOV_EXPORT_ALL_METADATA
@@ -171,8 +215,8 @@ static int mov_read_udta_string(MOVContext *c, AVIOContext *pb, MOVAtom atom)
#endif
char str[1024], key2[16], language[4] = {0};
const char *key = NULL;
- uint16_t str_size, langcode = 0;
- uint32_t data_type = 0;
+ uint16_t langcode = 0;
+ uint32_t data_type = 0, str_size;
int (*parse)(MOVContext*, AVIOContext*, unsigned, const char*) = NULL;
switch (atom.type) {
@@ -222,6 +266,14 @@ static int mov_read_udta_string(MOVContext *c, AVIOContext *pb, MOVAtom atom)
avio_rb32(pb); // unknown
str_size = data_size - 16;
atom.size -= 16;
+
+ if (atom.type == MKTAG('c', 'o', 'v', 'r')) {
+ int ret = mov_read_covr(c, pb, data_type, str_size);
+ if (ret < 0) {
+ av_log(c->fc, AV_LOG_ERROR, "Error parsing cover art.\n");
+ return ret;
+ }
+ }
} else return 0;
} else if (atom.size > 4 && key && !c->itunes_metadata) {
str_size = avio_rb16(pb); // string length
@@ -299,75 +351,7 @@ static int mov_read_chpl(MOVContext *c, AVIOContext *pb, MOVAtom atom)
return 0;
}
-static int mov_read_default(MOVContext *c, AVIOContext *pb, MOVAtom atom)
-{
- int64_t total_size = 0;
- MOVAtom a;
- int i;
-
- if (atom.size < 0)
- atom.size = INT64_MAX;
- while (total_size + 8 < atom.size && !pb->eof_reached) {
- int (*parse)(MOVContext*, AVIOContext*, MOVAtom) = NULL;
- a.size = atom.size;
- a.type=0;
- if (atom.size >= 8) {
- a.size = avio_rb32(pb);
- a.type = avio_rl32(pb);
- }
- av_dlog(c->fc, "type: %08x '%.4s' parent:'%.4s' sz: %"PRId64" %"PRId64" %"PRId64"\n",
- a.type, (char*)&a.type, (char*)&atom.type, a.size, total_size, atom.size);
- total_size += 8;
- if (a.size == 1) { /* 64 bit extended size */
- a.size = avio_rb64(pb) - 8;
- total_size += 8;
- }
- if (a.size == 0) {
- a.size = atom.size - total_size;
- if (a.size <= 8)
- break;
- }
- a.size -= 8;
- if (a.size < 0)
- break;
- a.size = FFMIN(a.size, atom.size - total_size);
-
- for (i = 0; mov_default_parse_table[i].type; i++)
- if (mov_default_parse_table[i].type == a.type) {
- parse = mov_default_parse_table[i].parse;
- break;
- }
-
- // container is user data
- if (!parse && (atom.type == MKTAG('u','d','t','a') ||
- atom.type == MKTAG('i','l','s','t')))
- parse = mov_read_udta_string;
-
- if (!parse) { /* skip leaf atoms data */
- avio_skip(pb, a.size);
- } else {
- int64_t start_pos = avio_tell(pb);
- int64_t left;
- int err = parse(c, pb, a);
- if (err < 0)
- return err;
- if (c->found_moov && c->found_mdat &&
- (!pb->seekable || start_pos + a.size == avio_size(pb)))
- return 0;
- left = a.size - avio_tell(pb) + start_pos;
- if (left > 0) /* skip garbage at atom end */
- avio_skip(pb, left);
- }
-
- total_size += a.size;
- }
-
- if (total_size < atom.size && atom.size < 0x7ffff)
- avio_skip(pb, atom.size - total_size);
-
- return 0;
-}
-
+#define MIN_DATA_ENTRY_BOX_SIZE 12
static int mov_read_dref(MOVContext *c, AVIOContext *pb, MOVAtom atom)
{
AVStream *st;
@@ -381,8 +365,10 @@ static int mov_read_dref(MOVContext *c, AVIOContext *pb, MOVAtom atom)
avio_rb32(pb); // version + flags
entries = avio_rb32(pb);
- if (entries >= UINT_MAX / sizeof(*sc->drefs))
+ if (entries > (atom.size - 1) / MIN_DATA_ENTRY_BOX_SIZE + 1 ||
+ entries >= UINT_MAX / sizeof(*sc->drefs))
return AVERROR_INVALIDDATA;
+ av_free(sc->drefs);
sc->drefs = av_mallocz(entries * sizeof(*sc->drefs));
if (!sc->drefs)
return AVERROR(ENOMEM);
@@ -432,6 +418,8 @@ static int mov_read_dref(MOVContext *c, AVIOContext *pb, MOVAtom atom)
avio_skip(pb, 16);
for (type = 0; type != -1 && avio_tell(pb) < next; ) {
+ if (pb->eof_reached)
+ return AVERROR_EOF;
type = avio_rb16(pb);
len = avio_rb16(pb);
av_log(c->fc, AV_LOG_DEBUG, "type %d, len %d\n", type, len);
@@ -498,7 +486,7 @@ static int mov_read_hdlr(MOVContext *c, AVIOContext *pb, MOVAtom atom)
else if (type == MKTAG('s','o','u','n'))
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
else if (type == MKTAG('m','1','a',' '))
- st->codec->codec_id = CODEC_ID_MP2;
+ st->codec->codec_id = AV_CODEC_ID_MP2;
else if ((type == MKTAG('s','u','b','p')) || (type == MKTAG('c','l','c','p')))
st->codec->codec_type = AVMEDIA_TYPE_SUBTITLE;
@@ -560,54 +548,46 @@ static int mov_read_dac3(MOVContext *c, AVIOContext *pb, MOVAtom atom)
return 0;
}
-static int mov_read_chan(MOVContext *c, AVIOContext *pb, MOVAtom atom)
+static int mov_read_dec3(MOVContext *c, AVIOContext *pb, MOVAtom atom)
{
AVStream *st;
- uint8_t version;
- uint32_t flags, layout_tag, bitmap, num_descr, label_mask;
- int i;
+ int eac3info, acmod, lfeon, bsmod;
if (c->fc->nb_streams < 1)
return 0;
st = c->fc->streams[c->fc->nb_streams-1];
- if (atom.size < 16)
- return 0;
+ /* No need to parse fields for additional independent substreams and its
+ * associated dependent substreams since libavcodec's E-AC-3 decoder
+ * does not support them yet. */
+ avio_rb16(pb); /* data_rate and num_ind_sub */
+ eac3info = avio_rb24(pb);
+ bsmod = (eac3info >> 12) & 0x1f;
+ acmod = (eac3info >> 9) & 0x7;
+ lfeon = (eac3info >> 8) & 0x1;
+ st->codec->channel_layout = avpriv_ac3_channel_layout_tab[acmod];
+ if (lfeon)
+ st->codec->channel_layout |= AV_CH_LOW_FREQUENCY;
+ st->codec->channels = av_get_channel_layout_nb_channels(st->codec->channel_layout);
+ st->codec->audio_service_type = bsmod;
+ if (st->codec->channels > 1 && bsmod == 0x7)
+ st->codec->audio_service_type = AV_AUDIO_SERVICE_TYPE_KARAOKE;
- version = avio_r8(pb);
- flags = avio_rb24(pb);
+ return 0;
+}
- layout_tag = avio_rb32(pb);
- bitmap = avio_rb32(pb);
- num_descr = avio_rb32(pb);
+static int mov_read_chan(MOVContext *c, AVIOContext *pb, MOVAtom atom)
+{
+ AVStream *st;
- if (atom.size < 16ULL + num_descr * 20ULL)
+ if (c->fc->nb_streams < 1)
return 0;
+ st = c->fc->streams[c->fc->nb_streams-1];
- av_dlog(c->fc, "chan: size=%ld version=%u flags=%u layout=%u bitmap=%u num_descr=%u\n",
- atom.size, version, flags, layout_tag, bitmap, num_descr);
-
- label_mask = 0;
- for (i = 0; i < num_descr; i++) {
- uint32_t label, cflags;
- label = avio_rb32(pb); // mChannelLabel
- cflags = avio_rb32(pb); // mChannelFlags
- avio_rl32(pb); // mCoordinates[0]
- avio_rl32(pb); // mCoordinates[1]
- avio_rl32(pb); // mCoordinates[2]
- if (layout_tag == 0) {
- uint32_t mask_incr = ff_mov_get_channel_label(label);
- if (mask_incr == 0) {
- label_mask = 0;
- break;
- }
- label_mask |= mask_incr;
- }
- }
- if (layout_tag == 0)
- st->codec->channel_layout = label_mask;
- else
- st->codec->channel_layout = ff_mov_get_channel_layout(layout_tag, bitmap);
+ if (atom.size < 16)
+ return 0;
+
+ ff_mov_read_chan(c->fc, pb, st, atom.size - 4);
return 0;
}
@@ -738,7 +718,7 @@ static int mov_read_mdhd(MOVContext *c, AVIOContext *pb, MOVAtom atom)
version = avio_r8(pb);
if (version > 1) {
- av_log_ask_for_sample(c, "unsupported version %d\n", version);
+ av_log_ask_for_sample(c->fc, "unsupported version %d\n", version);
return AVERROR_PATCHWELCOME;
}
avio_rb24(pb); /* flags */
@@ -837,17 +817,17 @@ static int mov_read_enda(MOVContext *c, AVIOContext *pb, MOVAtom atom)
av_dlog(c->fc, "enda %d\n", little_endian);
if (little_endian == 1) {
switch (st->codec->codec_id) {
- case CODEC_ID_PCM_S24BE:
- st->codec->codec_id = CODEC_ID_PCM_S24LE;
+ case AV_CODEC_ID_PCM_S24BE:
+ st->codec->codec_id = AV_CODEC_ID_PCM_S24LE;
break;
- case CODEC_ID_PCM_S32BE:
- st->codec->codec_id = CODEC_ID_PCM_S32LE;
+ case AV_CODEC_ID_PCM_S32BE:
+ st->codec->codec_id = AV_CODEC_ID_PCM_S32LE;
break;
- case CODEC_ID_PCM_F32BE:
- st->codec->codec_id = CODEC_ID_PCM_F32LE;
+ case AV_CODEC_ID_PCM_F32BE:
+ st->codec->codec_id = AV_CODEC_ID_PCM_F32LE;
break;
- case CODEC_ID_PCM_F64BE:
- st->codec->codec_id = CODEC_ID_PCM_F64LE;
+ case AV_CODEC_ID_PCM_F64BE:
+ st->codec->codec_id = AV_CODEC_ID_PCM_F64LE;
break;
default:
break;
@@ -926,7 +906,7 @@ static int mov_read_wave(MOVContext *c, AVIOContext *pb, MOVAtom atom)
if ((uint64_t)atom.size > (1<<30))
return AVERROR_INVALIDDATA;
- if (st->codec->codec_id == CODEC_ID_QDM2 || st->codec->codec_id == CODEC_ID_QDMC) {
+ if (st->codec->codec_id == AV_CODEC_ID_QDM2 || st->codec->codec_id == AV_CODEC_ID_QDMC) {
// pass all frma atom to codec, needed at least for QDMC and QDM2
av_free(st->codec->extradata);
st->codec->extradata = av_mallocz(atom.size + FF_INPUT_BUFFER_PADDING_SIZE);
@@ -959,7 +939,7 @@ static int mov_read_glbl(MOVContext *c, AVIOContext *pb, MOVAtom atom)
return AVERROR_INVALIDDATA;
if (atom.size >= 10) {
- // Broken files created by legacy versions of Libav and FFmpeg will
+ // Broken files created by legacy versions of libavformat will
// wrap a whole fiel atom inside of a glbl atom.
unsigned size = avio_rb32(pb);
unsigned type = avio_rl32(pb);
@@ -976,6 +956,32 @@ static int mov_read_glbl(MOVContext *c, AVIOContext *pb, MOVAtom atom)
return 0;
}
+static int mov_read_dvc1(MOVContext *c, AVIOContext *pb, MOVAtom atom)
+{
+ AVStream *st;
+ uint8_t profile_level;
+
+ if (c->fc->nb_streams < 1)
+ return 0;
+ st = c->fc->streams[c->fc->nb_streams-1];
+
+ if (atom.size >= (1<<28) || atom.size < 7)
+ return AVERROR_INVALIDDATA;
+
+ profile_level = avio_r8(pb);
+ if ((profile_level & 0xf0) != 0xc0)
+ return 0;
+
+ av_free(st->codec->extradata);
+ st->codec->extradata = av_mallocz(atom.size - 7 + FF_INPUT_BUFFER_PADDING_SIZE);
+ if (!st->codec->extradata)
+ return AVERROR(ENOMEM);
+ st->codec->extradata_size = atom.size - 7;
+ avio_seek(pb, 6, SEEK_CUR);
+ avio_read(pb, st->codec->extradata, st->codec->extradata_size);
+ return 0;
+}
+
/**
* An strf atom is a BITMAPINFOHEADER struct. This struct is 40 bytes itself,
* but can have extradata appended at the end after the 40 bytes belonging
@@ -1031,14 +1037,19 @@ static int mov_read_stco(MOVContext *c, AVIOContext *pb, MOVAtom atom)
sc->chunk_count = entries;
if (atom.type == MKTAG('s','t','c','o'))
- for (i=0; i<entries; i++)
+ for (i = 0; i < entries && !pb->eof_reached; i++)
sc->chunk_offsets[i] = avio_rb32(pb);
else if (atom.type == MKTAG('c','o','6','4'))
- for (i=0; i<entries; i++)
+ for (i = 0; i < entries && !pb->eof_reached; i++)
sc->chunk_offsets[i] = avio_rb64(pb);
else
return AVERROR_INVALIDDATA;
+ sc->chunk_count = i;
+
+ if (pb->eof_reached)
+ return AVERROR_EOF;
+
return 0;
}
@@ -1046,35 +1057,14 @@ static int mov_read_stco(MOVContext *c, AVIOContext *pb, MOVAtom atom)
* Compute codec id for 'lpcm' tag.
* See CoreAudioTypes and AudioStreamBasicDescription at Apple.
*/
-enum CodecID ff_mov_get_lpcm_codec_id(int bps, int flags)
+enum AVCodecID ff_mov_get_lpcm_codec_id(int bps, int flags)
{
- if (flags & 1) { // floating point
- if (flags & 2) { // big endian
- if (bps == 32) return CODEC_ID_PCM_F32BE;
- else if (bps == 64) return CODEC_ID_PCM_F64BE;
- } else {
- if (bps == 32) return CODEC_ID_PCM_F32LE;
- else if (bps == 64) return CODEC_ID_PCM_F64LE;
- }
- } else {
- if (flags & 2) {
- if (bps == 8)
- // signed integer
- if (flags & 4) return CODEC_ID_PCM_S8;
- else return CODEC_ID_PCM_U8;
- else if (bps == 16) return CODEC_ID_PCM_S16BE;
- else if (bps == 24) return CODEC_ID_PCM_S24BE;
- else if (bps == 32) return CODEC_ID_PCM_S32BE;
- } else {
- if (bps == 8)
- if (flags & 4) return CODEC_ID_PCM_S8;
- else return CODEC_ID_PCM_U8;
- else if (bps == 16) return CODEC_ID_PCM_S16LE;
- else if (bps == 24) return CODEC_ID_PCM_S24LE;
- else if (bps == 32) return CODEC_ID_PCM_S32LE;
- }
- }
- return CODEC_ID_NONE;
+ /* lpcm flags:
+ * 0x1 = float
+ * 0x2 = big-endian
+ * 0x4 = signed
+ */
+ return ff_get_pcm_codec_id(bps, flags & 1, flags & 2, flags & 4 ? -1 : 0);
}
int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries)
@@ -1088,24 +1078,29 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries)
st = c->fc->streams[c->fc->nb_streams-1];
sc = st->priv_data;
- for (pseudo_stream_id=0; pseudo_stream_id<entries; pseudo_stream_id++) {
+ for (pseudo_stream_id = 0;
+ pseudo_stream_id < entries && !pb->eof_reached;
+ pseudo_stream_id++) {
//Parsing Sample description table
- enum CodecID id;
+ enum AVCodecID id;
int dref_id = 1;
MOVAtom a = { AV_RL32("stsd") };
int64_t start_pos = avio_tell(pb);
- int size = avio_rb32(pb); /* size */
+ uint32_t size = avio_rb32(pb); /* size */
uint32_t format = avio_rl32(pb); /* data format */
if (size >= 16) {
avio_rb32(pb); /* reserved */
avio_rb16(pb); /* reserved */
dref_id = avio_rb16(pb);
+ } else {
+ av_log(c->fc, AV_LOG_ERROR, "invalid size %d in stsd\n", size);
+ return AVERROR_INVALIDDATA;
}
if (st->codec->codec_tag &&
st->codec->codec_tag != format &&
- (c->fc->video_codec_id ? ff_codec_get_id(codec_movvideo_tags, format) != c->fc->video_codec_id
+ (c->fc->video_codec_id ? ff_codec_get_id(ff_codec_movvideo_tags, format) != c->fc->video_codec_id
: st->codec->codec_tag != MKTAG('j','p','e','g'))
){
/* Multiple fourcc, we skip JPEG. This is not correct, we should
@@ -1123,7 +1118,7 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries)
sc->dref_id= dref_id;
st->codec->codec_tag = format;
- id = ff_codec_get_id(codec_movaudio_tags, format);
+ id = ff_codec_get_id(ff_codec_movaudio_tags, format);
if (id<=0 && ((format&0xFFFF) == 'm'+('s'<<8) || (format&0xFFFF) == 'T'+('S'<<8)))
id = ff_codec_get_id(ff_codec_wav_tags, av_bswap32(format)&0xFFFF);
@@ -1131,7 +1126,7 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries)
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
} else if (st->codec->codec_type != AVMEDIA_TYPE_AUDIO && /* do not overwrite codec type */
format && format != MKTAG('m','p','4','s')) { /* skip old asf mpeg4 tag */
- id = ff_codec_get_id(codec_movvideo_tags, format);
+ id = ff_codec_get_id(ff_codec_movvideo_tags, format);
if (id <= 0)
id = ff_codec_get_id(ff_codec_bmp_tags, format);
if (id > 0)
@@ -1150,6 +1145,7 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries)
if (st->codec->codec_type==AVMEDIA_TYPE_VIDEO) {
unsigned int color_depth, len;
int color_greyscale;
+ int color_table_id;
st->codec->codec_id = id;
avio_rb16(pb); /* version */
@@ -1175,11 +1171,15 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries)
/* codec_tag YV12 triggers an UV swap in rawdec.c */
if (!memcmp(st->codec->codec_name, "Planar Y'CbCr 8-bit 4:2:0", 25))
st->codec->codec_tag=MKTAG('I', '4', '2', '0');
+ /* Flash Media Server uses tag H263 with Sorenson Spark */
+ if (format == MKTAG('H','2','6','3') &&
+ !memcmp(st->codec->codec_name, "Sorenson H263", 13))
+ st->codec->codec_id = AV_CODEC_ID_FLV1;
st->codec->bits_per_coded_sample = avio_rb16(pb); /* depth */
- st->codec->color_table_id = avio_rb16(pb); /* colortable id */
+ color_table_id = avio_rb16(pb); /* colortable id */
av_dlog(c->fc, "depth %d, ctab id %d\n",
- st->codec->bits_per_coded_sample, st->codec->color_table_id);
+ st->codec->bits_per_coded_sample, color_table_id);
/* figure out the palette situation */
color_depth = st->codec->bits_per_coded_sample & 0x1F;
color_greyscale = st->codec->bits_per_coded_sample & 0x20;
@@ -1206,7 +1206,7 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries)
if (color_index < 0)
color_index = 0;
}
- } else if (st->codec->color_table_id) {
+ } else if (color_table_id) {
const uint8_t *color_table;
/* if flag bit 3 is set, use the default palette */
color_count = 1 << color_depth;
@@ -1290,34 +1290,34 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries)
}
switch (st->codec->codec_id) {
- case CODEC_ID_PCM_S8:
- case CODEC_ID_PCM_U8:
+ case AV_CODEC_ID_PCM_S8:
+ case AV_CODEC_ID_PCM_U8:
if (st->codec->bits_per_coded_sample == 16)
- st->codec->codec_id = CODEC_ID_PCM_S16BE;
+ st->codec->codec_id = AV_CODEC_ID_PCM_S16BE;
break;
- case CODEC_ID_PCM_S16LE:
- case CODEC_ID_PCM_S16BE:
+ case AV_CODEC_ID_PCM_S16LE:
+ case AV_CODEC_ID_PCM_S16BE:
if (st->codec->bits_per_coded_sample == 8)
- st->codec->codec_id = CODEC_ID_PCM_S8;
+ st->codec->codec_id = AV_CODEC_ID_PCM_S8;
else if (st->codec->bits_per_coded_sample == 24)
st->codec->codec_id =
- st->codec->codec_id == CODEC_ID_PCM_S16BE ?
- CODEC_ID_PCM_S24BE : CODEC_ID_PCM_S24LE;
+ st->codec->codec_id == AV_CODEC_ID_PCM_S16BE ?
+ AV_CODEC_ID_PCM_S24BE : AV_CODEC_ID_PCM_S24LE;
break;
/* set values for old format before stsd version 1 appeared */
- case CODEC_ID_MACE3:
+ case AV_CODEC_ID_MACE3:
sc->samples_per_frame = 6;
sc->bytes_per_frame = 2*st->codec->channels;
break;
- case CODEC_ID_MACE6:
+ case AV_CODEC_ID_MACE6:
sc->samples_per_frame = 6;
sc->bytes_per_frame = 1*st->codec->channels;
break;
- case CODEC_ID_ADPCM_IMA_QT:
+ case AV_CODEC_ID_ADPCM_IMA_QT:
sc->samples_per_frame = 64;
sc->bytes_per_frame = 34*st->codec->channels;
break;
- case CODEC_ID_GSM:
+ case AV_CODEC_ID_GSM:
sc->samples_per_frame = 160;
sc->bytes_per_frame = 33;
break;
@@ -1353,13 +1353,16 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries)
avio_skip(pb, a.size);
}
+ if (pb->eof_reached)
+ return AVERROR_EOF;
+
if (st->codec->codec_type==AVMEDIA_TYPE_AUDIO && st->codec->sample_rate==0 && sc->time_scale>1)
st->codec->sample_rate= sc->time_scale;
/* special codec parameters handling */
switch (st->codec->codec_id) {
#if CONFIG_DV_DEMUXER
- case CODEC_ID_DVAUDIO:
+ case AV_CODEC_ID_DVAUDIO:
c->dv_fctx = avformat_alloc_context();
c->dv_demux = avpriv_dv_init_demux(c->dv_fctx);
if (!c->dv_demux) {
@@ -1367,47 +1370,45 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries)
return AVERROR(ENOMEM);
}
sc->dv_audio_container = 1;
- st->codec->codec_id = CODEC_ID_PCM_S16LE;
+ st->codec->codec_id = AV_CODEC_ID_PCM_S16LE;
break;
#endif
/* no ifdef since parameters are always those */
- case CODEC_ID_QCELP:
+ case AV_CODEC_ID_QCELP:
// force sample rate for qcelp when not stored in mov
if (st->codec->codec_tag != MKTAG('Q','c','l','p'))
st->codec->sample_rate = 8000;
- st->codec->frame_size= 160;
st->codec->channels= 1; /* really needed */
break;
- case CODEC_ID_AMR_NB:
+ case AV_CODEC_ID_AMR_NB:
st->codec->channels= 1; /* really needed */
/* force sample rate for amr, stsd in 3gp does not store sample rate */
st->codec->sample_rate = 8000;
- /* force frame_size, too, samples_per_frame isn't always set properly */
- st->codec->frame_size = 160;
break;
- case CODEC_ID_AMR_WB:
+ case AV_CODEC_ID_AMR_WB:
st->codec->channels = 1;
st->codec->sample_rate = 16000;
- st->codec->frame_size = 320;
break;
- case CODEC_ID_MP2:
- case CODEC_ID_MP3:
+ case AV_CODEC_ID_MP2:
+ case AV_CODEC_ID_MP3:
st->codec->codec_type = AVMEDIA_TYPE_AUDIO; /* force type after stsd for m1a hdlr */
st->need_parsing = AVSTREAM_PARSE_FULL;
break;
- case CODEC_ID_GSM:
- case CODEC_ID_ADPCM_MS:
- case CODEC_ID_ADPCM_IMA_WAV:
- st->codec->frame_size = sc->samples_per_frame;
+ case AV_CODEC_ID_GSM:
+ case AV_CODEC_ID_ADPCM_MS:
+ case AV_CODEC_ID_ADPCM_IMA_WAV:
+ case AV_CODEC_ID_ILBC:
st->codec->block_align = sc->bytes_per_frame;
break;
- case CODEC_ID_ALAC:
+ case AV_CODEC_ID_ALAC:
if (st->codec->extradata_size == 36) {
- st->codec->frame_size = AV_RB32(st->codec->extradata+12);
st->codec->channels = AV_RB8 (st->codec->extradata+21);
st->codec->sample_rate = AV_RB32(st->codec->extradata+32);
}
break;
+ case AV_CODEC_ID_VC1:
+ st->need_parsing = AVSTREAM_PARSE_FULL;
+ break;
default:
break;
}
@@ -1451,13 +1452,18 @@ static int mov_read_stsc(MOVContext *c, AVIOContext *pb, MOVAtom atom)
sc->stsc_data = av_malloc(entries * sizeof(*sc->stsc_data));
if (!sc->stsc_data)
return AVERROR(ENOMEM);
- sc->stsc_count = entries;
- for (i=0; i<entries; i++) {
+ for (i = 0; i < entries && !pb->eof_reached; i++) {
sc->stsc_data[i].first = avio_rb32(pb);
sc->stsc_data[i].count = avio_rb32(pb);
sc->stsc_data[i].id = avio_rb32(pb);
}
+
+ sc->stsc_count = i;
+
+ if (pb->eof_reached)
+ return AVERROR_EOF;
+
return 0;
}
@@ -1480,13 +1486,17 @@ static int mov_read_stps(MOVContext *c, AVIOContext *pb, MOVAtom atom)
sc->stps_data = av_malloc(entries * sizeof(*sc->stps_data));
if (!sc->stps_data)
return AVERROR(ENOMEM);
- sc->stps_count = entries;
- for (i = 0; i < entries; i++) {
+ for (i = 0; i < entries && !pb->eof_reached; i++) {
sc->stps_data[i] = avio_rb32(pb);
//av_dlog(c->fc, "stps %d\n", sc->stps_data[i]);
}
+ sc->stps_count = i;
+
+ if (pb->eof_reached)
+ return AVERROR_EOF;
+
return 0;
}
@@ -1509,18 +1519,26 @@ static int mov_read_stss(MOVContext *c, AVIOContext *pb, MOVAtom atom)
av_dlog(c->fc, "keyframe_count = %d\n", entries);
if (!entries)
+ {
+ sc->keyframe_absent = 1;
return 0;
+ }
if (entries >= UINT_MAX / sizeof(int))
return AVERROR_INVALIDDATA;
sc->keyframes = av_malloc(entries * sizeof(int));
if (!sc->keyframes)
return AVERROR(ENOMEM);
- sc->keyframe_count = entries;
- for (i=0; i<entries; i++) {
+ for (i = 0; i < entries && !pb->eof_reached; i++) {
sc->keyframes[i] = avio_rb32(pb);
//av_dlog(c->fc, "keyframes[]=%d\n", sc->keyframes[i]);
}
+
+ sc->keyframe_count = i;
+
+ if (pb->eof_reached)
+ return AVERROR_EOF;
+
return 0;
}
@@ -1587,8 +1605,15 @@ static int mov_read_stsz(MOVContext *c, AVIOContext *pb, MOVAtom atom)
init_get_bits(&gb, buf, 8*num_bytes);
- for (i=0; i<entries; i++)
+ for (i = 0; i < entries && !pb->eof_reached; i++) {
sc->sample_sizes[i] = get_bits_long(&gb, field_size);
+ sc->data_size += sc->sample_sizes[i];
+ }
+
+ sc->sample_count = i;
+
+ if (pb->eof_reached)
+ return AVERROR_EOF;
av_free(buf);
return 0;
@@ -1623,9 +1648,7 @@ static int mov_read_stts(MOVContext *c, AVIOContext *pb, MOVAtom atom)
if (!sc->stts_data)
return AVERROR(ENOMEM);
- sc->stts_count = entries;
-
- for (i=0; i<entries; i++) {
+ for (i = 0; i < entries && !pb->eof_reached; i++) {
int sample_duration;
int sample_count;
@@ -1641,9 +1664,15 @@ static int mov_read_stts(MOVContext *c, AVIOContext *pb, MOVAtom atom)
total_sample_count+=sample_count;
}
+ sc->stts_count = i;
+
+ if (pb->eof_reached)
+ return AVERROR_EOF;
+
st->nb_frames= total_sample_count;
if (duration)
st->duration= duration;
+ sc->track_end = duration;
return 0;
}
@@ -1671,9 +1700,8 @@ static int mov_read_ctts(MOVContext *c, AVIOContext *pb, MOVAtom atom)
sc->ctts_data = av_malloc(entries * sizeof(*sc->ctts_data));
if (!sc->ctts_data)
return AVERROR(ENOMEM);
- sc->ctts_count = entries;
- for (i=0; i<entries; i++) {
+ for (i = 0; i < entries && !pb->eof_reached; i++) {
int count =avio_rb32(pb);
int duration =avio_rb32(pb);
@@ -1683,11 +1711,56 @@ static int mov_read_ctts(MOVContext *c, AVIOContext *pb, MOVAtom atom)
sc->dts_shift = FFMAX(sc->dts_shift, -duration);
}
+ sc->ctts_count = i;
+
+ if (pb->eof_reached)
+ return AVERROR_EOF;
+
av_dlog(c->fc, "dts shift %d\n", sc->dts_shift);
return 0;
}
+static int mov_read_sbgp(MOVContext *c, AVIOContext *pb, MOVAtom atom)
+{
+ AVStream *st;
+ MOVStreamContext *sc;
+ unsigned int i, entries;
+ uint8_t version;
+ uint32_t grouping_type;
+
+ if (c->fc->nb_streams < 1)
+ return 0;
+ st = c->fc->streams[c->fc->nb_streams-1];
+ sc = st->priv_data;
+
+ version = avio_r8(pb); /* version */
+ avio_rb24(pb); /* flags */
+ grouping_type = avio_rl32(pb);
+ if (grouping_type != MKTAG( 'r','a','p',' '))
+ return 0; /* only support 'rap ' grouping */
+ if (version == 1)
+ avio_rb32(pb); /* grouping_type_parameter */
+
+ entries = avio_rb32(pb);
+ if (!entries)
+ return 0;
+ if (entries >= UINT_MAX / sizeof(*sc->rap_group))
+ return AVERROR_INVALIDDATA;
+ sc->rap_group = av_malloc(entries * sizeof(*sc->rap_group));
+ if (!sc->rap_group)
+ return AVERROR(ENOMEM);
+
+ for (i = 0; i < entries && !pb->eof_reached; i++) {
+ sc->rap_group[i].count = avio_rb32(pb); /* sample_count */
+ sc->rap_group[i].index = avio_rb32(pb); /* group_description_index */
+ }
+
+ sc->rap_group_count = i;
+
+ return pb->eof_reached ? AVERROR_EOF : 0;
+}
+
static void mov_build_index(MOVContext *mov, AVStream *st)
{
MOVStreamContext *sc = st->priv_data;
@@ -1722,7 +1795,10 @@ static void mov_build_index(MOVContext *mov, AVStream *st)
unsigned int stts_sample = 0;
unsigned int sample_size;
unsigned int distance = 0;
- int key_off = sc->keyframes && sc->keyframes[0] == 1;
+ unsigned int rap_group_index = 0;
+ unsigned int rap_group_sample = 0;
+ int rap_group_present = sc->rap_group_count && sc->rap_group;
+ int key_off = (sc->keyframes && sc->keyframes[0] > 0) || (sc->stps_data && sc->stps_data[0] > 0);
current_dts -= sc->dts_shift;
@@ -1748,7 +1824,7 @@ static void mov_build_index(MOVContext *mov, AVStream *st)
return;
}
- if (!sc->keyframe_count || current_sample+key_off == sc->keyframes[stss_index]) {
+ if (!sc->keyframe_absent && (!sc->keyframe_count || current_sample+key_off == sc->keyframes[stss_index])) {
keyframe = 1;
if (stss_index + 1 < sc->keyframe_count)
stss_index++;
@@ -1757,6 +1833,14 @@ static void mov_build_index(MOVContext *mov, AVStream *st)
if (stps_index + 1 < sc->stps_count)
stps_index++;
}
+ if (rap_group_present && rap_group_index < sc->rap_group_count) {
+ if (sc->rap_group[rap_group_index].index > 0)
+ keyframe = 1;
+ if (++rap_group_sample == sc->rap_group[rap_group_index].count) {
+ rap_group_sample = 0;
+ rap_group_index++;
+ }
+ }
if (keyframe)
distance = 0;
sample_size = sc->sample_size > 0 ? sc->sample_size : sc->sample_sizes[current_sample];
@@ -1795,7 +1879,8 @@ static void mov_build_index(MOVContext *mov, AVStream *st)
unsigned count, chunk_count;
chunk_samples = sc->stsc_data[i].count;
- if (sc->samples_per_frame && chunk_samples % sc->samples_per_frame) {
+ if (i != sc->stsc_count - 1 &&
+ sc->samples_per_frame && chunk_samples % sc->samples_per_frame) {
av_log(mov->fc, AV_LOG_ERROR, "error unaligned chunk\n");
return;
}
@@ -1953,13 +2038,6 @@ static int mov_read_trak(MOVContext *c, AVIOContext *pb, MOVAtom atom)
avpriv_set_pts_info(st, 64, 1, sc->time_scale);
- if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO &&
- !st->codec->frame_size && sc->stts_count == 1) {
- st->codec->frame_size = av_rescale(sc->stts_data[0].duration,
- st->codec->sample_rate, sc->time_scale);
- av_dlog(c->fc, "frame size %d\n", st->codec->frame_size);
- }
-
mov_build_index(c, st);
if (sc->dref_id-1 < sc->drefs_count && sc->drefs[sc->dref_id-1].path) {
@@ -1980,23 +2058,26 @@ static int mov_read_trak(MOVContext *c, AVIOContext *pb, MOVAtom atom)
((double)st->codec->width * sc->height), INT_MAX);
}
- av_reduce(&st->avg_frame_rate.num, &st->avg_frame_rate.den,
- sc->time_scale*st->nb_frames, st->duration, INT_MAX);
+ if (st->duration != AV_NOPTS_VALUE)
+ av_reduce(&st->avg_frame_rate.num, &st->avg_frame_rate.den,
+ sc->time_scale*st->nb_frames, st->duration, INT_MAX);
+#if FF_API_R_FRAME_RATE
if (sc->stts_count == 1 || (sc->stts_count == 2 && sc->stts_data[1].count == 1))
av_reduce(&st->r_frame_rate.num, &st->r_frame_rate.den,
sc->time_scale, sc->stts_data[0].duration, INT_MAX);
+#endif
}
switch (st->codec->codec_id) {
#if CONFIG_H261_DECODER
- case CODEC_ID_H261:
+ case AV_CODEC_ID_H261:
#endif
#if CONFIG_H263_DECODER
- case CODEC_ID_H263:
+ case AV_CODEC_ID_H263:
#endif
#if CONFIG_MPEG4_DECODER
- case CODEC_ID_MPEG4:
+ case AV_CODEC_ID_MPEG4:
#endif
st->codec->width = 0; /* let decoder init width/height */
st->codec->height= 0;
@@ -2010,6 +2091,7 @@ static int mov_read_trak(MOVContext *c, AVIOContext *pb, MOVAtom atom)
av_freep(&sc->keyframes);
av_freep(&sc->stts_data);
av_freep(&sc->stps_data);
+ av_freep(&sc->rap_group);
return 0;
}
@@ -2143,14 +2225,16 @@ static int mov_read_tfhd(MOVContext *c, AVIOContext *pb, MOVAtom atom)
return AVERROR_INVALIDDATA;
}
- if (flags & 0x01) frag->base_data_offset = avio_rb64(pb);
- else frag->base_data_offset = frag->moof_offset;
- if (flags & 0x02) frag->stsd_id = avio_rb32(pb);
- else frag->stsd_id = trex->stsd_id;
+ frag->base_data_offset = flags & MOV_TFHD_BASE_DATA_OFFSET ?
+ avio_rb64(pb) : frag->moof_offset;
+ frag->stsd_id = flags & MOV_TFHD_STSD_ID ? avio_rb32(pb) : trex->stsd_id;
- frag->duration = flags & 0x08 ? avio_rb32(pb) : trex->duration;
- frag->size = flags & 0x10 ? avio_rb32(pb) : trex->size;
- frag->flags = flags & 0x20 ? avio_rb32(pb) : trex->flags;
+ frag->duration = flags & MOV_TFHD_DEFAULT_DURATION ?
+ avio_rb32(pb) : trex->duration;
+ frag->size = flags & MOV_TFHD_DEFAULT_SIZE ?
+ avio_rb32(pb) : trex->size;
+ frag->flags = flags & MOV_TFHD_DEFAULT_FLAGS ?
+ avio_rb32(pb) : trex->flags;
av_dlog(c->fc, "frag flags 0x%x\n", frag->flags);
return 0;
}
@@ -2192,7 +2276,7 @@ static int mov_read_trun(MOVContext *c, AVIOContext *pb, MOVAtom atom)
int64_t dts;
int data_offset = 0;
unsigned entries, first_sample_flags = frag->flags;
- int flags, distance, i;
+ int flags, distance, i, found_keyframe = 0;
for (i = 0; i < c->fc->nb_streams; i++) {
if (c->fc->streams[i]->id == frag->track_id) {
@@ -2236,26 +2320,32 @@ static int mov_read_trun(MOVContext *c, AVIOContext *pb, MOVAtom atom)
return AVERROR(ENOMEM);
sc->ctts_data = ctts_data;
- if (flags & 0x001) data_offset = avio_rb32(pb);
- if (flags & 0x004) first_sample_flags = avio_rb32(pb);
- dts = st->duration - sc->time_offset;
+ if (flags & MOV_TRUN_DATA_OFFSET) data_offset = avio_rb32(pb);
+ if (flags & MOV_TRUN_FIRST_SAMPLE_FLAGS) first_sample_flags = avio_rb32(pb);
+ dts = sc->track_end - sc->time_offset;
offset = frag->base_data_offset + data_offset;
distance = 0;
av_dlog(c->fc, "first sample flags 0x%x\n", first_sample_flags);
- for (i = 0; i < entries; i++) {
+ for (i = 0; i < entries && !pb->eof_reached; i++) {
unsigned sample_size = frag->size;
int sample_flags = i ? frag->flags : first_sample_flags;
unsigned sample_duration = frag->duration;
- int keyframe;
+ int keyframe = 0;
- if (flags & 0x100) sample_duration = avio_rb32(pb);
- if (flags & 0x200) sample_size = avio_rb32(pb);
- if (flags & 0x400) sample_flags = avio_rb32(pb);
+ if (flags & MOV_TRUN_SAMPLE_DURATION) sample_duration = avio_rb32(pb);
+ if (flags & MOV_TRUN_SAMPLE_SIZE) sample_size = avio_rb32(pb);
+ if (flags & MOV_TRUN_SAMPLE_FLAGS) sample_flags = avio_rb32(pb);
sc->ctts_data[sc->ctts_count].count = 1;
- sc->ctts_data[sc->ctts_count].duration = (flags & 0x800) ? avio_rb32(pb) : 0;
+ sc->ctts_data[sc->ctts_count].duration = (flags & MOV_TRUN_SAMPLE_CTS) ?
+ avio_rb32(pb) : 0;
sc->ctts_count++;
- if ((keyframe = st->codec->codec_type == AVMEDIA_TYPE_AUDIO ||
- (flags & 0x004 && !i && !sample_flags) || sample_flags & 0x2000000))
+ if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO)
+ keyframe = 1;
+ else if (!found_keyframe)
+ keyframe = found_keyframe =
+ !(sample_flags & (MOV_FRAG_SAMPLE_FLAG_IS_NON_SYNC |
+ MOV_FRAG_SAMPLE_FLAG_DEPENDS_YES));
+ if (keyframe)
distance = 0;
av_add_index_entry(st, offset, dts, sample_size, distance,
keyframe ? AVINDEX_KEYFRAME : 0);
@@ -2265,9 +2355,14 @@ static int mov_read_trun(MOVContext *c, AVIOContext *pb, MOVAtom atom)
distance++;
dts += sample_duration;
offset += sample_size;
+ sc->data_size += sample_size;
}
+
+ if (pb->eof_reached)
+ return AVERROR_EOF;
+
frag->moof_offset = offset;
- st->duration = dts + sc->time_offset;
+ st->duration = sc->track_end = dts + sc->time_offset;
return 0;
}
@@ -2434,13 +2529,89 @@ static const MOVParseTableEntry mov_default_parse_table[] = {
{ MKTAG('w','a','v','e'), mov_read_wave },
{ MKTAG('e','s','d','s'), mov_read_esds },
{ MKTAG('d','a','c','3'), mov_read_dac3 }, /* AC-3 info */
+{ MKTAG('d','e','c','3'), mov_read_dec3 }, /* EAC-3 info */
{ MKTAG('w','i','d','e'), mov_read_wide }, /* place holder */
{ MKTAG('w','f','e','x'), mov_read_wfex },
{ MKTAG('c','m','o','v'), mov_read_cmov },
{ MKTAG('c','h','a','n'), mov_read_chan }, /* channel layout */
+{ MKTAG('d','v','c','1'), mov_read_dvc1 },
+{ MKTAG('s','b','g','p'), mov_read_sbgp },
{ 0, NULL }
};
+static int mov_read_default(MOVContext *c, AVIOContext *pb, MOVAtom atom)
+{
+ int64_t total_size = 0;
+ MOVAtom a;
+ int i;
+
+ if (atom.size < 0)
+ atom.size = INT64_MAX;
+ while (total_size + 8 < atom.size && !pb->eof_reached) {
+ int (*parse)(MOVContext*, AVIOContext*, MOVAtom) = NULL;
+ a.size = atom.size;
+ a.type=0;
+ if (atom.size >= 8) {
+ a.size = avio_rb32(pb);
+ a.type = avio_rl32(pb);
+ }
+ av_dlog(c->fc, "type: %08x '%.4s' parent:'%.4s' sz: %"PRId64" %"PRId64" %"PRId64"\n",
+ a.type, (char*)&a.type, (char*)&atom.type, a.size, total_size, atom.size);
+ total_size += 8;
+ if (a.size == 1) { /* 64 bit extended size */
+ a.size = avio_rb64(pb) - 8;
+ total_size += 8;
+ }
+ if (a.size == 0) {
+ a.size = atom.size - total_size;
+ if (a.size <= 8)
+ break;
+ }
+ a.size -= 8;
+ if (a.size < 0)
+ break;
+ a.size = FFMIN(a.size, atom.size - total_size);
+
+ for (i = 0; mov_default_parse_table[i].type; i++)
+ if (mov_default_parse_table[i].type == a.type) {
+ parse = mov_default_parse_table[i].parse;
+ break;
+ }
+
+ // container is user data
+ if (!parse && (atom.type == MKTAG('u','d','t','a') ||
+ atom.type == MKTAG('i','l','s','t')))
+ parse = mov_read_udta_string;
+
+ if (!parse) { /* skip leaf atoms data */
+ avio_skip(pb, a.size);
+ } else {
+ int64_t start_pos = avio_tell(pb);
+ int64_t left;
+ int err = parse(c, pb, a);
+ if (err < 0)
+ return err;
+ if (c->found_moov && c->found_mdat &&
+ ((!pb->seekable || c->fc->flags & AVFMT_FLAG_IGNIDX) ||
+ start_pos + a.size == avio_size(pb))) {
+ if (!pb->seekable || c->fc->flags & AVFMT_FLAG_IGNIDX)
+ c->next_root_atom = start_pos + a.size;
+ return 0;
+ }
+ left = a.size - avio_tell(pb) + start_pos;
+ if (left > 0) /* skip garbage at atom end */
+ avio_skip(pb, left);
+ }
+
+ total_size += a.size;
+ }
+
+ if (total_size < atom.size && atom.size < 0x7ffff)
+ avio_skip(pb, atom.size - total_size);
+
+ return 0;
+}
+
static int mov_probe(AVProbeData *p)
{
unsigned int offset;
@@ -2555,7 +2726,40 @@ finish:
avio_seek(sc->pb, cur_pos, SEEK_SET);
}
-static int mov_read_header(AVFormatContext *s, AVFormatParameters *ap)
+static int mov_read_close(AVFormatContext *s)
+{
+ MOVContext *mov = s->priv_data;
+ int i, j;
+
+ for (i = 0; i < s->nb_streams; i++) {
+ AVStream *st = s->streams[i];
+ MOVStreamContext *sc = st->priv_data;
+
+ av_freep(&sc->ctts_data);
+ for (j = 0; j < sc->drefs_count; j++) {
+ av_freep(&sc->drefs[j].path);
+ av_freep(&sc->drefs[j].dir);
+ }
+ av_freep(&sc->drefs);
+ if (sc->pb && sc->pb != s->pb)
+ avio_close(sc->pb);
+ }
+
+ if (mov->dv_demux) {
+ for (i = 0; i < mov->dv_fctx->nb_streams; i++) {
+ av_freep(&mov->dv_fctx->streams[i]->codec);
+ av_freep(&mov->dv_fctx->streams[i]);
+ }
+ av_freep(&mov->dv_fctx);
+ av_freep(&mov->dv_demux);
+ }
+
+ av_freep(&mov->trex_data);
+
+ return 0;
+}
+
+static int mov_read_header(AVFormatContext *s)
{
MOVContext *mov = s->priv_data;
AVIOContext *pb = s->pb;
@@ -2572,10 +2776,12 @@ static int mov_read_header(AVFormatContext *s, AVFormatParameters *ap)
/* check MOV header */
if ((err = mov_read_default(mov, pb, atom)) < 0) {
av_log(s, AV_LOG_ERROR, "error reading header: %d\n", err);
+ mov_read_close(s);
return err;
}
if (!mov->found_moov) {
av_log(s, AV_LOG_ERROR, "moov atom not found\n");
+ mov_read_close(s);
return AVERROR_INVALIDDATA;
}
av_dlog(mov->fc, "on_parse_exit_offset=%"PRId64"\n", avio_tell(pb));
@@ -2583,6 +2789,16 @@ static int mov_read_header(AVFormatContext *s, AVFormatParameters *ap)
if (pb->seekable && mov->chapter_track > 0)
mov_read_chapters(s);
+ if (mov->trex_data) {
+ int i;
+ for (i = 0; i < s->nb_streams; i++) {
+ AVStream *st = s->streams[i];
+ MOVStreamContext *sc = st->priv_data;
+ if (st->duration)
+ st->codec->bit_rate = sc->data_size * 8 * sc->time_scale / st->duration;
+ }
+ }
+
return 0;
}
@@ -2623,8 +2839,11 @@ static int mov_read_packet(AVFormatContext *s, AVPacket *pkt)
sample = mov_find_next_sample(s, &st);
if (!sample) {
mov->found_mdat = 0;
- if (s->pb->seekable||
- mov_read_default(mov, s->pb, (MOVAtom){ AV_RL32("root"), INT64_MAX }) < 0 ||
+ if (!mov->next_root_atom)
+ return AVERROR_EOF;
+ avio_seek(s->pb, mov->next_root_atom, SEEK_SET);
+ mov->next_root_atom = 0;
+ if (mov_read_default(mov, s->pb, (MOVAtom){ AV_RL32("root"), INT64_MAX }) < 0 ||
s->pb->eof_reached)
return AVERROR_EOF;
av_dlog(s, "read fragments, offset 0x%"PRIx64"\n", avio_tell(s->pb));
@@ -2755,42 +2974,9 @@ static int mov_read_seek(AVFormatContext *s, int stream_index, int64_t sample_ti
return 0;
}
-static int mov_read_close(AVFormatContext *s)
-{
- MOVContext *mov = s->priv_data;
- int i, j;
-
- for (i = 0; i < s->nb_streams; i++) {
- AVStream *st = s->streams[i];
- MOVStreamContext *sc = st->priv_data;
-
- av_freep(&sc->ctts_data);
- for (j = 0; j < sc->drefs_count; j++) {
- av_freep(&sc->drefs[j].path);
- av_freep(&sc->drefs[j].dir);
- }
- av_freep(&sc->drefs);
- if (sc->pb && sc->pb != s->pb)
- avio_close(sc->pb);
- }
-
- if (mov->dv_demux) {
- for (i = 0; i < mov->dv_fctx->nb_streams; i++) {
- av_freep(&mov->dv_fctx->streams[i]->codec);
- av_freep(&mov->dv_fctx->streams[i]);
- }
- av_freep(&mov->dv_fctx);
- av_freep(&mov->dv_demux);
- }
-
- av_freep(&mov->trex_data);
-
- return 0;
-}
-
AVInputFormat ff_mov_demuxer = {
.name = "mov,mp4,m4a,3gp,3g2,mj2",
- .long_name = NULL_IF_CONFIG_SMALL("QuickTime/MPEG-4/Motion JPEG 2000 format"),
+ .long_name = NULL_IF_CONFIG_SMALL("QuickTime / MOV"),
.priv_data_size = sizeof(MOVContext),
.read_probe = mov_probe,
.read_header = mov_read_header,
diff --git a/gst-libs/ext/libav/libavformat/mov_chan.c b/gst-libs/ext/libav/libavformat/mov_chan.c
index 5728ebd..aa7ba10 100644
--- a/gst-libs/ext/libav/libavformat/mov_chan.c
+++ b/gst-libs/ext/libav/libavformat/mov_chan.c
@@ -25,7 +25,7 @@
#include <stdint.h>
-#include "libavutil/audioconvert.h"
+#include "libavutil/channel_layout.h"
#include "libavcodec/avcodec.h"
#include "mov_chan.h"
@@ -155,6 +155,7 @@ static const struct MovChannelLayoutMap mov_ch_layout_map_misc[] = {
static const struct MovChannelLayoutMap mov_ch_layout_map_1ch[] = {
{ MOV_CH_LAYOUT_MONO, AV_CH_LAYOUT_MONO }, // C
+ { 0, 0 },
};
static const struct MovChannelLayoutMap mov_ch_layout_map_2ch[] = {
@@ -413,14 +414,40 @@ static const enum MovChannelLayoutTag mov_ch_layouts_alac[] = {
0,
};
+static const enum MovChannelLayoutTag mov_ch_layouts_wav[] = {
+ MOV_CH_LAYOUT_MONO,
+ MOV_CH_LAYOUT_STEREO,
+ MOV_CH_LAYOUT_MATRIXSTEREO,
+ MOV_CH_LAYOUT_MPEG_3_0_A,
+ MOV_CH_LAYOUT_QUADRAPHONIC,
+ MOV_CH_LAYOUT_MPEG_5_0_A,
+ MOV_CH_LAYOUT_MPEG_5_1_A,
+ MOV_CH_LAYOUT_MPEG_6_1_A,
+ MOV_CH_LAYOUT_MPEG_7_1_A,
+ MOV_CH_LAYOUT_MPEG_7_1_C,
+ MOV_CH_LAYOUT_SMPTE_DTV,
+};
+
static const struct {
- enum CodecID codec_id;
+ enum AVCodecID codec_id;
const enum MovChannelLayoutTag *layouts;
} mov_codec_ch_layouts[] = {
- { CODEC_ID_AAC, mov_ch_layouts_aac },
- { CODEC_ID_AC3, mov_ch_layouts_ac3 },
- { CODEC_ID_ALAC, mov_ch_layouts_alac },
- { CODEC_ID_NONE, NULL },
+ { AV_CODEC_ID_AAC, mov_ch_layouts_aac },
+ { AV_CODEC_ID_AC3, mov_ch_layouts_ac3 },
+ { AV_CODEC_ID_ALAC, mov_ch_layouts_alac },
+ { AV_CODEC_ID_PCM_U8, mov_ch_layouts_wav },
+ { AV_CODEC_ID_PCM_S8, mov_ch_layouts_wav },
+ { AV_CODEC_ID_PCM_S16LE, mov_ch_layouts_wav },
+ { AV_CODEC_ID_PCM_S16BE, mov_ch_layouts_wav },
+ { AV_CODEC_ID_PCM_S24LE, mov_ch_layouts_wav },
+ { AV_CODEC_ID_PCM_S24BE, mov_ch_layouts_wav },
+ { AV_CODEC_ID_PCM_S32LE, mov_ch_layouts_wav },
+ { AV_CODEC_ID_PCM_S32BE, mov_ch_layouts_wav },
+ { AV_CODEC_ID_PCM_F32LE, mov_ch_layouts_wav },
+ { AV_CODEC_ID_PCM_F32BE, mov_ch_layouts_wav },
+ { AV_CODEC_ID_PCM_F64LE, mov_ch_layouts_wav },
+ { AV_CODEC_ID_PCM_F64BE, mov_ch_layouts_wav },
+ { AV_CODEC_ID_NONE, NULL },
};
uint64_t ff_mov_get_channel_layout(uint32_t tag, uint32_t bitmap)
@@ -450,7 +477,7 @@ uint64_t ff_mov_get_channel_layout(uint32_t tag, uint32_t bitmap)
return layout_map[i].layout;
}
-uint32_t ff_mov_get_channel_label(uint32_t label)
+static uint32_t mov_get_channel_label(uint32_t label)
{
if (label == 0)
return 0;
@@ -463,7 +490,7 @@ uint32_t ff_mov_get_channel_label(uint32_t label)
return 0;
}
-uint32_t ff_mov_get_channel_layout_tag(enum CodecID codec_id,
+uint32_t ff_mov_get_channel_layout_tag(enum AVCodecID codec_id,
uint64_t channel_layout,
uint32_t *bitmap)
{
@@ -472,11 +499,11 @@ uint32_t ff_mov_get_channel_layout_tag(enum CodecID codec_id,
const enum MovChannelLayoutTag *layouts = NULL;
/* find the layout list for the specified codec */
- for (i = 0; mov_codec_ch_layouts[i].codec_id != CODEC_ID_NONE; i++) {
+ for (i = 0; mov_codec_ch_layouts[i].codec_id != AV_CODEC_ID_NONE; i++) {
if (mov_codec_ch_layouts[i].codec_id == codec_id)
break;
}
- if (mov_codec_ch_layouts[i].codec_id != CODEC_ID_NONE)
+ if (mov_codec_ch_layouts[i].codec_id != AV_CODEC_ID_NONE)
layouts = mov_codec_ch_layouts[i].layouts;
if (layouts) {
@@ -491,7 +518,7 @@ uint32_t ff_mov_get_channel_layout_tag(enum CodecID codec_id,
/* find the layout tag for the specified channel layout */
for (i = 0; layouts[i] != 0; i++) {
- if (layouts[i] & 0xFFFF != channels)
+ if ((layouts[i] & 0xFFFF) != channels)
continue;
for (j = 0; layout_map[j].tag != 0; j++) {
if (layout_map[j].tag == layouts[i] &&
@@ -515,3 +542,48 @@ uint32_t ff_mov_get_channel_layout_tag(enum CodecID codec_id,
return tag;
}
+
+int ff_mov_read_chan(AVFormatContext *s, AVIOContext *pb, AVStream *st,
+ int64_t size)
+{
+ uint32_t layout_tag, bitmap, num_descr, label_mask;
+ int i;
+
+ if (size < 12)
+ return AVERROR_INVALIDDATA;
+
+ layout_tag = avio_rb32(pb);
+ bitmap = avio_rb32(pb);
+ num_descr = avio_rb32(pb);
+
+ av_dlog(s, "chan: layout=%u bitmap=%u num_descr=%u\n",
+ layout_tag, bitmap, num_descr);
+
+ if (size < 12ULL + num_descr * 20ULL)
+ return 0;
+
+ label_mask = 0;
+ for (i = 0; i < num_descr; i++) {
+ uint32_t label;
+ label = avio_rb32(pb); // mChannelLabel
+ avio_rb32(pb); // mChannelFlags
+ avio_rl32(pb); // mCoordinates[0]
+ avio_rl32(pb); // mCoordinates[1]
+ avio_rl32(pb); // mCoordinates[2]
+ if (layout_tag == 0) {
+ uint32_t mask_incr = mov_get_channel_label(label);
+ if (mask_incr == 0) {
+ label_mask = 0;
+ break;
+ }
+ label_mask |= mask_incr;
+ }
+ }
+ if (layout_tag == 0) {
+ if (label_mask)
+ st->codec->channel_layout = label_mask;
+ } else
+ st->codec->channel_layout = ff_mov_get_channel_layout(layout_tag, bitmap);
+
+ return 0;
+}
diff --git a/gst-libs/ext/libav/libavformat/mov_chan.h b/gst-libs/ext/libav/libavformat/mov_chan.h
index abb6916..3fae939 100644
--- a/gst-libs/ext/libav/libavformat/mov_chan.h
+++ b/gst-libs/ext/libav/libavformat/mov_chan.h
@@ -29,6 +29,7 @@
#include <stdint.h>
#include "libavcodec/avcodec.h"
+#include "avformat.h"
/**
* Get the channel layout for the specified channel layout tag.
@@ -40,14 +41,6 @@
uint64_t ff_mov_get_channel_layout(uint32_t tag, uint32_t bitmap);
/**
- * Get the channel layout for the specified channel layout tag.
- *
- * @param[in] tag channel label
- * @return channel layout mask fragment
- */
-uint32_t ff_mov_get_channel_label(uint32_t label);
-
-/**
* Get the channel layout tag for the specified codec id and channel layout.
* If the layout tag was not found, use a channel bitmap if possible.
*
@@ -56,8 +49,20 @@ uint32_t ff_mov_get_channel_label(uint32_t label);
* @param[out] bitmap channel bitmap
* @return channel layout tag
*/
-uint32_t ff_mov_get_channel_layout_tag(enum CodecID codec_id,
+uint32_t ff_mov_get_channel_layout_tag(enum AVCodecID codec_id,
uint64_t channel_layout,
uint32_t *bitmap);
+/**
+ * Read 'chan' tag from the input stream.
+ *
+ * @param s AVFormatContext
+ * @param pb AVIOContext
+ * @param st The stream to set codec values for
+ * @param size Remaining size in the 'chan' tag
+ * @return 0 if ok, or negative AVERROR code on failure
+ */
+int ff_mov_read_chan(AVFormatContext *s, AVIOContext *pb, AVStream *st,
+ int64_t size);
+
#endif /* AVFORMAT_MOV_CHAN_H */
diff --git a/gst-libs/ext/libav/libavformat/movenc.c b/gst-libs/ext/libav/libavformat/movenc.c
index 85b5667..3949520 100644
--- a/gst-libs/ext/libav/libavformat/movenc.c
+++ b/gst-libs/ext/libav/libavformat/movenc.c
@@ -30,6 +30,7 @@
#include "avc.h"
#include "libavcodec/get_bits.h"
#include "libavcodec/put_bits.h"
+#include "libavcodec/vc1.h"
#include "internal.h"
#include "libavutil/avstring.h"
#include "libavutil/intfloat.h"
@@ -43,12 +44,21 @@
#include <assert.h>
static const AVOption options[] = {
- { "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" },
+ { "movflags", "MOV muxer flags", offsetof(MOVMuxContext, flags), AV_OPT_TYPE_FLAGS, {.i64 = 0}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "movflags" },
+ { "rtphint", "Add RTP hint tracks", 0, AV_OPT_TYPE_CONST, {.i64 = FF_MOV_FLAG_RTP_HINT}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "movflags" },
+ { "empty_moov", "Make the initial moov atom empty (not supported by QuickTime)", 0, AV_OPT_TYPE_CONST, {.i64 = FF_MOV_FLAG_EMPTY_MOOV}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "movflags" },
+ { "frag_keyframe", "Fragment at video keyframes", 0, AV_OPT_TYPE_CONST, {.i64 = FF_MOV_FLAG_FRAG_KEYFRAME}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "movflags" },
+ { "separate_moof", "Write separate moof/mdat atoms for each track", 0, AV_OPT_TYPE_CONST, {.i64 = FF_MOV_FLAG_SEPARATE_MOOF}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "movflags" },
+ { "frag_custom", "Flush fragments on caller requests", 0, AV_OPT_TYPE_CONST, {.i64 = FF_MOV_FLAG_FRAG_CUSTOM}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "movflags" },
+ { "isml", "Create a live smooth streaming feed (for pushing to a publishing point)", 0, AV_OPT_TYPE_CONST, {.i64 = FF_MOV_FLAG_ISML}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "movflags" },
FF_RTP_FLAG_OPTS(MOVMuxContext, rtp_flags),
- { "skip_iods", "Skip writing iods atom.", offsetof(MOVMuxContext, iods_skip), AV_OPT_TYPE_INT, {.dbl = 0}, 0, 1, AV_OPT_FLAG_ENCODING_PARAM},
- { "iods_audio_profile", "iods audio profile atom.", offsetof(MOVMuxContext, iods_audio_profile), AV_OPT_TYPE_INT, {.dbl = -1}, -1, 255, AV_OPT_FLAG_ENCODING_PARAM},
- { "iods_video_profile", "iods video profile atom.", offsetof(MOVMuxContext, iods_video_profile), AV_OPT_TYPE_INT, {.dbl = -1}, -1, 255, AV_OPT_FLAG_ENCODING_PARAM},
+ { "skip_iods", "Skip writing iods atom.", offsetof(MOVMuxContext, iods_skip), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1, AV_OPT_FLAG_ENCODING_PARAM},
+ { "iods_audio_profile", "iods audio profile atom.", offsetof(MOVMuxContext, iods_audio_profile), AV_OPT_TYPE_INT, {.i64 = -1}, -1, 255, AV_OPT_FLAG_ENCODING_PARAM},
+ { "iods_video_profile", "iods video profile atom.", offsetof(MOVMuxContext, iods_video_profile), AV_OPT_TYPE_INT, {.i64 = -1}, -1, 255, AV_OPT_FLAG_ENCODING_PARAM},
+ { "frag_duration", "Maximum fragment duration", offsetof(MOVMuxContext, max_fragment_duration), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM},
+ { "min_frag_duration", "Minimum fragment duration", offsetof(MOVMuxContext, min_fragment_duration), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM},
+ { "frag_size", "Maximum fragment size", offsetof(MOVMuxContext, max_fragment_size), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM},
+ { "ism_lookahead", "Number of lookahead entries for ISM files", offsetof(MOVMuxContext, ism_lookahead), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM},
{ NULL },
};
@@ -61,7 +71,7 @@ static const AVClass flavor ## _muxer_class = {\
};
//FIXME support 64 bit variant with wide placeholders
-static int64_t updateSize(AVIOContext *pb, int64_t pos)
+static int64_t update_size(AVIOContext *pb, int64_t pos)
{
int64_t curpos = avio_tell(pb);
avio_seek(pb, pos, SEEK_SET);
@@ -87,11 +97,11 @@ static int mov_write_stco_tag(AVIOContext *pb, MOVTrack *track)
avio_wb32(pb, track->entry); /* entry count */
for (i=0; i<track->entry; i++) {
if(mode64 == 1)
- avio_wb64(pb, track->cluster[i].pos);
+ avio_wb64(pb, track->cluster[i].pos + track->data_offset);
else
- avio_wb32(pb, track->cluster[i].pos);
+ avio_wb32(pb, track->cluster[i].pos + track->data_offset);
}
- return updateSize(pb, pos);
+ return update_size(pb, pos);
}
/* Sample size atom */
@@ -113,8 +123,8 @@ static int mov_write_stsz_tag(AVIOContext *pb, MOVTrack *track)
oldtst = tst;
entries += track->cluster[i].entries;
}
- if (equalChunks) {
- int sSize = track->cluster[0].size/track->cluster[0].entries;
+ if (equalChunks && track->entry) {
+ int sSize = track->entry ? track->cluster[0].size/track->cluster[0].entries : 0;
sSize = FFMAX(1, sSize); // adpcm mono case could make sSize == 0
avio_wb32(pb, sSize); // sample size
avio_wb32(pb, entries); // sample count
@@ -129,7 +139,7 @@ static int mov_write_stsz_tag(AVIOContext *pb, MOVTrack *track)
}
}
}
- return updateSize(pb, pos);
+ return update_size(pb, pos);
}
/* Sample to chunk atom */
@@ -145,12 +155,12 @@ static int mov_write_stsc_tag(AVIOContext *pb, MOVTrack *track)
entryPos = avio_tell(pb);
avio_wb32(pb, track->entry); // entry count
for (i=0; i<track->entry; i++) {
- if(oldval != track->cluster[i].samplesInChunk)
+ if (oldval != track->cluster[i].samples_in_chunk)
{
avio_wb32(pb, i+1); // first chunk
- avio_wb32(pb, track->cluster[i].samplesInChunk); // samples per chunk
+ avio_wb32(pb, track->cluster[i].samples_in_chunk); // samples per chunk
avio_wb32(pb, 0x1); // sample description index
- oldval = track->cluster[i].samplesInChunk;
+ oldval = track->cluster[i].samples_in_chunk;
index++;
}
}
@@ -159,7 +169,7 @@ static int mov_write_stsc_tag(AVIOContext *pb, MOVTrack *track)
avio_wb32(pb, index); // rewrite size
avio_seek(pb, curpos, SEEK_SET);
- return updateSize(pb, pos);
+ return update_size(pb, pos);
}
/* Sync sample atom */
@@ -183,7 +193,7 @@ static int mov_write_stss_tag(AVIOContext *pb, MOVTrack *track, uint32_t flag)
avio_seek(pb, entryPos, SEEK_SET);
avio_wb32(pb, index); // rewrite size
avio_seek(pb, curpos, SEEK_SET);
- return updateSize(pb, pos);
+ return update_size(pb, pos);
}
static int mov_write_amr_tag(AVIOContext *pb, MOVTrack *track)
@@ -207,13 +217,13 @@ static int mov_write_ac3_tag(AVIOContext *pb, MOVTrack *track)
uint8_t buf[3];
int fscod, bsid, bsmod, acmod, lfeon, frmsizecod;
- if (track->vosLen < 7)
+ if (track->vos_len < 7)
return -1;
avio_wb32(pb, 11);
ffio_wfourcc(pb, "dac3");
- init_get_bits(&gbc, track->vosData+4, (track->vosLen-4) * 8);
+ init_get_bits(&gbc, track->vos_data + 4, (track->vos_len - 4) * 8);
fscod = get_bits(&gbc, 2);
frmsizecod = get_bits(&gbc, 6);
bsid = get_bits(&gbc, 5);
@@ -254,15 +264,7 @@ static int mov_write_extradata_tag(AVIOContext *pb, MOVTrack *track)
return track->enc->extradata_size;
}
-static int mov_write_enda_tag(AVIOContext *pb)
-{
- avio_wb32(pb, 10);
- ffio_wfourcc(pb, "enda");
- avio_wb16(pb, 1); /* little endian */
- return 10;
-}
-
-static void putDescr(AVIOContext *pb, int tag, unsigned int size)
+static void put_descr(AVIOContext *pb, int tag, unsigned int size)
{
int i = 3;
avio_w8(pb, tag);
@@ -274,23 +276,23 @@ static void putDescr(AVIOContext *pb, int tag, unsigned int size)
static int mov_write_esds_tag(AVIOContext *pb, MOVTrack *track) // Basic
{
int64_t pos = avio_tell(pb);
- int decoderSpecificInfoLen = track->vosLen ? 5+track->vosLen : 0;
+ int decoder_specific_info_len = track->vos_len ? 5 + track->vos_len : 0;
avio_wb32(pb, 0); // size
ffio_wfourcc(pb, "esds");
avio_wb32(pb, 0); // Version
// ES descriptor
- putDescr(pb, 0x03, 3 + 5+13 + decoderSpecificInfoLen + 5+1);
- avio_wb16(pb, track->trackID);
+ put_descr(pb, 0x03, 3 + 5+13 + decoder_specific_info_len + 5+1);
+ avio_wb16(pb, track->track_id);
avio_w8(pb, 0x00); // flags (= no flags)
// DecoderConfig descriptor
- putDescr(pb, 0x04, 13 + decoderSpecificInfoLen);
+ put_descr(pb, 0x04, 13 + decoder_specific_info_len);
// Object type indication
- if ((track->enc->codec_id == CODEC_ID_MP2 ||
- track->enc->codec_id == CODEC_ID_MP3) &&
+ if ((track->enc->codec_id == AV_CODEC_ID_MP2 ||
+ track->enc->codec_id == AV_CODEC_ID_MP3) &&
track->enc->sample_rate > 24000)
avio_w8(pb, 0x6B); // 11172-3
else
@@ -312,24 +314,16 @@ static int mov_write_esds_tag(AVIOContext *pb, MOVTrack *track) // Basic
else
avio_wb32(pb, track->enc->rc_max_rate); // avg bitrate
- if (track->vosLen) {
+ if (track->vos_len) {
// DecoderSpecific info descriptor
- putDescr(pb, 0x05, track->vosLen);
- avio_write(pb, track->vosData, track->vosLen);
+ put_descr(pb, 0x05, track->vos_len);
+ avio_write(pb, track->vos_data, track->vos_len);
}
// SL descriptor
- putDescr(pb, 0x06, 1);
+ put_descr(pb, 0x06, 1);
avio_w8(pb, 0x02);
- return updateSize(pb, pos);
-}
-
-static int mov_pcm_le_gt16(enum CodecID codec_id)
-{
- return codec_id == CODEC_ID_PCM_S24LE ||
- codec_id == CODEC_ID_PCM_S32LE ||
- codec_id == CODEC_ID_PCM_F32LE ||
- codec_id == CODEC_ID_PCM_F64LE;
+ return update_size(pb, pos);
}
static int mov_write_ms_tag(AVIOContext *pb, MOVTrack *track)
@@ -339,7 +333,16 @@ static int mov_write_ms_tag(AVIOContext *pb, MOVTrack *track)
avio_wl32(pb, track->tag); // store it byteswapped
track->enc->codec_tag = av_bswap16(track->tag >> 16);
ff_put_wav_header(pb, track->enc);
- return updateSize(pb, pos);
+ return update_size(pb, pos);
+}
+
+static int mov_write_wfex_tag(AVIOContext *pb, MOVTrack *track)
+{
+ int64_t pos = avio_tell(pb);
+ avio_wb32(pb, 0);
+ ffio_wfourcc(pb, "wfex");
+ ff_put_wav_header(pb, track->enc);
+ return update_size(pb, pos);
}
static int mov_write_chan_tag(AVIOContext *pb, MOVTrack *track)
@@ -364,7 +367,7 @@ static int mov_write_chan_tag(AVIOContext *pb, MOVTrack *track)
avio_wb32(pb, bitmap); // mChannelBitmap
avio_wb32(pb, 0); // mNumberChannelDescriptions
- return updateSize(pb, pos);
+ return update_size(pb, pos);
}
static int mov_write_wave_tag(AVIOContext *pb, MOVTrack *track)
@@ -378,69 +381,192 @@ static int mov_write_wave_tag(AVIOContext *pb, MOVTrack *track)
ffio_wfourcc(pb, "frma");
avio_wl32(pb, track->tag);
- if (track->enc->codec_id == CODEC_ID_AAC) {
+ if (track->enc->codec_id == AV_CODEC_ID_AAC) {
/* useless atom needed by mplayer, ipod, not needed by quicktime */
avio_wb32(pb, 12); /* size */
ffio_wfourcc(pb, "mp4a");
avio_wb32(pb, 0);
mov_write_esds_tag(pb, track);
- } else if (mov_pcm_le_gt16(track->enc->codec_id)) {
- mov_write_enda_tag(pb);
- } else if (track->enc->codec_id == CODEC_ID_AMR_NB) {
+ } else if (track->enc->codec_id == AV_CODEC_ID_AMR_NB) {
mov_write_amr_tag(pb, track);
- } else if (track->enc->codec_id == CODEC_ID_AC3) {
- mov_write_chan_tag(pb, track);
+ } else if (track->enc->codec_id == AV_CODEC_ID_AC3) {
mov_write_ac3_tag(pb, track);
- } else if (track->enc->codec_id == CODEC_ID_ALAC) {
+ } else if (track->enc->codec_id == AV_CODEC_ID_ALAC) {
mov_write_extradata_tag(pb, track);
- } else if (track->enc->codec_id == CODEC_ID_ADPCM_MS ||
- track->enc->codec_id == CODEC_ID_ADPCM_IMA_WAV) {
+ } else if (track->enc->codec_id == AV_CODEC_ID_ADPCM_MS ||
+ track->enc->codec_id == AV_CODEC_ID_ADPCM_IMA_WAV) {
mov_write_ms_tag(pb, track);
}
avio_wb32(pb, 8); /* size */
avio_wb32(pb, 0); /* null tag */
- return updateSize(pb, pos);
+ return update_size(pb, pos);
+}
+
+static int mov_write_dvc1_structs(MOVTrack *track, uint8_t *buf)
+{
+ uint8_t *unescaped;
+ const uint8_t *start, *next, *end = track->vos_data + track->vos_len;
+ int unescaped_size, seq_found = 0;
+ int level = 0, interlace = 0;
+ int packet_seq = track->vc1_info.packet_seq;
+ int packet_entry = track->vc1_info.packet_entry;
+ int slices = track->vc1_info.slices;
+ PutBitContext pbc;
+
+ if (track->start_dts == AV_NOPTS_VALUE) {
+ /* No packets written yet, vc1_info isn't authoritative yet. */
+ /* Assume inline sequence and entry headers. This will be
+ * overwritten at the end if the file is seekable. */
+ packet_seq = packet_entry = 1;
+ }
+
+ unescaped = av_mallocz(track->vos_len + FF_INPUT_BUFFER_PADDING_SIZE);
+ if (!unescaped)
+ return AVERROR(ENOMEM);
+ start = find_next_marker(track->vos_data, end);
+ for (next = start; next < end; start = next) {
+ GetBitContext gb;
+ int size;
+ next = find_next_marker(start + 4, end);
+ size = next - start - 4;
+ if (size <= 0)
+ continue;
+ unescaped_size = vc1_unescape_buffer(start + 4, size, unescaped);
+ init_get_bits(&gb, unescaped, 8 * unescaped_size);
+ if (AV_RB32(start) == VC1_CODE_SEQHDR) {
+ int profile = get_bits(&gb, 2);
+ if (profile != PROFILE_ADVANCED) {
+ av_free(unescaped);
+ return AVERROR(ENOSYS);
+ }
+ seq_found = 1;
+ level = get_bits(&gb, 3);
+ /* chromaformat, frmrtq_postproc, bitrtq_postproc, postprocflag,
+ * width, height */
+ skip_bits_long(&gb, 2 + 3 + 5 + 1 + 2*12);
+ skip_bits(&gb, 1); /* broadcast */
+ interlace = get_bits1(&gb);
+ skip_bits(&gb, 4); /* tfcntrflag, finterpflag, reserved, psf */
+ }
+ }
+ if (!seq_found) {
+ av_free(unescaped);
+ return AVERROR(ENOSYS);
+ }
+
+ init_put_bits(&pbc, buf, 7);
+ /* VC1DecSpecStruc */
+ put_bits(&pbc, 4, 12); /* profile - advanced */
+ put_bits(&pbc, 3, level);
+ put_bits(&pbc, 1, 0); /* reserved */
+ /* VC1AdvDecSpecStruc */
+ put_bits(&pbc, 3, level);
+ put_bits(&pbc, 1, 0); /* cbr */
+ put_bits(&pbc, 6, 0); /* reserved */
+ put_bits(&pbc, 1, !interlace); /* no interlace */
+ put_bits(&pbc, 1, !packet_seq); /* no multiple seq */
+ put_bits(&pbc, 1, !packet_entry); /* no multiple entry */
+ put_bits(&pbc, 1, !slices); /* no slice code */
+ put_bits(&pbc, 1, 0); /* no bframe */
+ put_bits(&pbc, 1, 0); /* reserved */
+ put_bits32(&pbc, track->enc->time_base.den); /* framerate */
+ flush_put_bits(&pbc);
+
+ av_free(unescaped);
+
+ return 0;
+}
+
+static int mov_write_dvc1_tag(AVIOContext *pb, MOVTrack *track)
+{
+ uint8_t buf[7] = { 0 };
+ int ret;
+
+ if ((ret = mov_write_dvc1_structs(track, buf)) < 0)
+ return ret;
+
+ avio_wb32(pb, track->vos_len + 8 + sizeof(buf));
+ ffio_wfourcc(pb, "dvc1");
+ track->vc1_info.struct_offset = avio_tell(pb);
+ avio_write(pb, buf, sizeof(buf));
+ avio_write(pb, track->vos_data, track->vos_len);
+
+ return 0;
}
static int mov_write_glbl_tag(AVIOContext *pb, MOVTrack *track)
{
- avio_wb32(pb, track->vosLen+8);
+ avio_wb32(pb, track->vos_len + 8);
ffio_wfourcc(pb, "glbl");
- avio_write(pb, track->vosData, track->vosLen);
- return 8+track->vosLen;
+ avio_write(pb, track->vos_data, track->vos_len);
+ return 8 + track->vos_len;
}
/**
* Compute flags for 'lpcm' tag.
* See CoreAudioTypes and AudioStreamBasicDescription at Apple.
*/
-static int mov_get_lpcm_flags(enum CodecID codec_id)
+static int mov_get_lpcm_flags(enum AVCodecID codec_id)
{
switch (codec_id) {
- case CODEC_ID_PCM_F32BE:
- case CODEC_ID_PCM_F64BE:
+ case AV_CODEC_ID_PCM_F32BE:
+ case AV_CODEC_ID_PCM_F64BE:
return 11;
- case CODEC_ID_PCM_F32LE:
- case CODEC_ID_PCM_F64LE:
+ case AV_CODEC_ID_PCM_F32LE:
+ case AV_CODEC_ID_PCM_F64LE:
return 9;
- case CODEC_ID_PCM_U8:
+ case AV_CODEC_ID_PCM_U8:
return 10;
- case CODEC_ID_PCM_S16BE:
- case CODEC_ID_PCM_S24BE:
- case CODEC_ID_PCM_S32BE:
+ case AV_CODEC_ID_PCM_S16BE:
+ case AV_CODEC_ID_PCM_S24BE:
+ case AV_CODEC_ID_PCM_S32BE:
return 14;
- case CODEC_ID_PCM_S8:
- case CODEC_ID_PCM_S16LE:
- case CODEC_ID_PCM_S24LE:
- case CODEC_ID_PCM_S32LE:
+ case AV_CODEC_ID_PCM_S8:
+ case AV_CODEC_ID_PCM_S16LE:
+ case AV_CODEC_ID_PCM_S24LE:
+ case AV_CODEC_ID_PCM_S32LE:
return 12;
default:
return 0;
}
}
+static int get_cluster_duration(MOVTrack *track, int cluster_idx)
+{
+ int64_t next_dts;
+
+ if (cluster_idx >= track->entry)
+ return 0;
+
+ if (cluster_idx + 1 == track->entry)
+ next_dts = track->track_duration + track->start_dts;
+ else
+ next_dts = track->cluster[cluster_idx + 1].dts;
+
+ return next_dts - track->cluster[cluster_idx].dts;
+}
+
+static int get_samples_per_packet(MOVTrack *track)
+{
+ int i, first_duration;
+
+ /* use 1 for raw PCM */
+ if (!track->audio_vbr)
+ return 1;
+
+ /* check to see if duration is constant for all clusters */
+ if (!track->entry)
+ return 0;
+ first_duration = get_cluster_duration(track, 0);
+ for (i = 1; i < track->entry; i++) {
+ if (get_cluster_duration(track, i) != first_duration)
+ return 0;
+ }
+ return first_duration;
+}
+
static int mov_write_audio_tag(AVIOContext *pb, MOVTrack *track)
{
int64_t pos = avio_tell(pb);
@@ -471,13 +597,13 @@ static int mov_write_audio_tag(AVIOContext *pb, MOVTrack *track)
avio_wb16(pb, 0);
avio_wb32(pb, 0x00010000);
avio_wb32(pb, 72);
- avio_wb64(pb, av_double2int(track->timescale));
+ avio_wb64(pb, av_double2int(track->enc->sample_rate));
avio_wb32(pb, track->enc->channels);
avio_wb32(pb, 0x7F000000);
avio_wb32(pb, av_get_bits_per_sample(track->enc->codec_id));
avio_wb32(pb, mov_get_lpcm_flags(track->enc->codec_id));
- avio_wb32(pb, track->sampleSize);
- avio_wb32(pb, track->audio_vbr ? track->enc->frame_size : 1);
+ avio_wb32(pb, track->sample_size);
+ avio_wb32(pb, get_samples_per_packet(track));
} else {
/* reserved for mp4/3gp */
avio_wb16(pb, 2);
@@ -485,31 +611,36 @@ static int mov_write_audio_tag(AVIOContext *pb, MOVTrack *track)
avio_wb16(pb, 0);
avio_wb16(pb, 0); /* packet size (= 0) */
- avio_wb16(pb, track->timescale); /* Time scale */
+ avio_wb16(pb, track->enc->sample_rate <= UINT16_MAX ?
+ track->enc->sample_rate : 0);
avio_wb16(pb, 0); /* Reserved */
}
if(track->mode == MODE_MOV &&
- (track->enc->codec_id == CODEC_ID_AAC ||
- track->enc->codec_id == CODEC_ID_AC3 ||
- track->enc->codec_id == CODEC_ID_AMR_NB ||
- track->enc->codec_id == CODEC_ID_ALAC ||
- track->enc->codec_id == CODEC_ID_ADPCM_MS ||
- track->enc->codec_id == CODEC_ID_ADPCM_IMA_WAV ||
- mov_pcm_le_gt16(track->enc->codec_id)))
+ (track->enc->codec_id == AV_CODEC_ID_AAC ||
+ track->enc->codec_id == AV_CODEC_ID_AC3 ||
+ track->enc->codec_id == AV_CODEC_ID_AMR_NB ||
+ track->enc->codec_id == AV_CODEC_ID_ALAC ||
+ track->enc->codec_id == AV_CODEC_ID_ADPCM_MS ||
+ track->enc->codec_id == AV_CODEC_ID_ADPCM_IMA_WAV))
mov_write_wave_tag(pb, track);
else if(track->tag == MKTAG('m','p','4','a'))
mov_write_esds_tag(pb, track);
- else if(track->enc->codec_id == CODEC_ID_AMR_NB)
+ else if(track->enc->codec_id == AV_CODEC_ID_AMR_NB)
mov_write_amr_tag(pb, track);
- else if(track->enc->codec_id == CODEC_ID_AC3)
+ else if(track->enc->codec_id == AV_CODEC_ID_AC3)
mov_write_ac3_tag(pb, track);
- else if(track->enc->codec_id == CODEC_ID_ALAC)
+ else if(track->enc->codec_id == AV_CODEC_ID_ALAC)
mov_write_extradata_tag(pb, track);
- else if(track->vosLen > 0)
+ else if (track->enc->codec_id == AV_CODEC_ID_WMAPRO)
+ mov_write_wfex_tag(pb, track);
+ else if (track->vos_len > 0)
mov_write_glbl_tag(pb, track);
- return updateSize(pb, pos);
+ if (track->mode == MODE_MOV && track->enc->codec_type == AVMEDIA_TYPE_AUDIO)
+ mov_write_chan_tag(pb, track);
+
+ return update_size(pb, pos);
}
static int mov_write_d263_tag(AVIOContext *pb)
@@ -543,8 +674,8 @@ static int mov_write_avcc_tag(AVIOContext *pb, MOVTrack *track)
avio_wb32(pb, 0);
ffio_wfourcc(pb, "avcC");
- ff_isom_write_avcc(pb, track->vosData, track->vosLen);
- return updateSize(pb, pos);
+ ff_isom_write_avcc(pb, track->vos_data, track->vos_len);
+ return update_size(pb, pos);
}
/* also used by all avid codecs (dv, imx, meridien) and their variants */
@@ -569,10 +700,10 @@ static int mov_write_avid_tag(AVIOContext *pb, MOVTrack *track)
ffio_wfourcc(pb, "ARES");
ffio_wfourcc(pb, "ARES");
ffio_wfourcc(pb, "0001");
- avio_wb32(pb, AV_RB32(track->vosData + 0x28)); /* dnxhd cid, some id ? */
+ avio_wb32(pb, AV_RB32(track->vos_data + 0x28)); /* dnxhd cid, some id ? */
avio_wb32(pb, track->enc->width);
/* values below are based on samples created with quicktime and avid codecs */
- if (track->vosData[5] & 2) { // interlaced
+ if (track->vos_data[5] & 2) { // interlaced
avio_wb32(pb, track->enc->height/2);
avio_wb32(pb, 2); /* unknown */
avio_wb32(pb, 0); /* unknown */
@@ -602,10 +733,11 @@ static int mp4_get_codec_tag(AVFormatContext *s, MOVTrack *track)
if (!ff_codec_get_tag(ff_mp4_obj_type, track->enc->codec_id))
return 0;
- if (track->enc->codec_id == CODEC_ID_H264) tag = MKTAG('a','v','c','1');
- else if (track->enc->codec_id == CODEC_ID_AC3) tag = MKTAG('a','c','-','3');
- else if (track->enc->codec_id == CODEC_ID_DIRAC) tag = MKTAG('d','r','a','c');
- else if (track->enc->codec_id == CODEC_ID_MOV_TEXT) tag = MKTAG('t','x','3','g');
+ if (track->enc->codec_id == AV_CODEC_ID_H264) tag = MKTAG('a','v','c','1');
+ else if (track->enc->codec_id == AV_CODEC_ID_AC3) tag = MKTAG('a','c','-','3');
+ else if (track->enc->codec_id == AV_CODEC_ID_DIRAC) tag = MKTAG('d','r','a','c');
+ else if (track->enc->codec_id == AV_CODEC_ID_MOV_TEXT) tag = MKTAG('t','x','3','g');
+ else if (track->enc->codec_id == AV_CODEC_ID_VC1) tag = MKTAG('v','c','-','1');
else if (track->enc->codec_type == AVMEDIA_TYPE_VIDEO) tag = MKTAG('m','p','4','v');
else if (track->enc->codec_type == AVMEDIA_TYPE_AUDIO) tag = MKTAG('m','p','4','a');
@@ -613,14 +745,14 @@ static int mp4_get_codec_tag(AVFormatContext *s, MOVTrack *track)
}
static const AVCodecTag codec_ipod_tags[] = {
- { CODEC_ID_H264, MKTAG('a','v','c','1') },
- { CODEC_ID_MPEG4, MKTAG('m','p','4','v') },
- { CODEC_ID_AAC, MKTAG('m','p','4','a') },
- { CODEC_ID_ALAC, MKTAG('a','l','a','c') },
- { CODEC_ID_AC3, MKTAG('a','c','-','3') },
- { CODEC_ID_MOV_TEXT, MKTAG('t','x','3','g') },
- { CODEC_ID_MOV_TEXT, MKTAG('t','e','x','t') },
- { CODEC_ID_NONE, 0 },
+ { AV_CODEC_ID_H264, MKTAG('a','v','c','1') },
+ { AV_CODEC_ID_MPEG4, MKTAG('m','p','4','v') },
+ { AV_CODEC_ID_AAC, MKTAG('m','p','4','a') },
+ { AV_CODEC_ID_ALAC, MKTAG('a','l','a','c') },
+ { AV_CODEC_ID_AC3, MKTAG('a','c','-','3') },
+ { AV_CODEC_ID_MOV_TEXT, MKTAG('t','x','3','g') },
+ { AV_CODEC_ID_MOV_TEXT, MKTAG('t','e','x','t') },
+ { AV_CODEC_ID_NONE, 0 },
};
static int ipod_get_codec_tag(AVFormatContext *s, MOVTrack *track)
@@ -646,10 +778,10 @@ static int mov_get_dv_codec_tag(AVFormatContext *s, MOVTrack *track)
if (track->enc->width == 720) /* SD */
if (track->enc->height == 480) /* NTSC */
- if (track->enc->pix_fmt == PIX_FMT_YUV422P) tag = MKTAG('d','v','5','n');
+ if (track->enc->pix_fmt == AV_PIX_FMT_YUV422P) tag = MKTAG('d','v','5','n');
else tag = MKTAG('d','v','c',' ');
- else if (track->enc->pix_fmt == PIX_FMT_YUV422P) tag = MKTAG('d','v','5','p');
- else if (track->enc->pix_fmt == PIX_FMT_YUV420P) tag = MKTAG('d','v','c','p');
+ else if (track->enc->pix_fmt == AV_PIX_FMT_YUV422P) tag = MKTAG('d','v','5','p');
+ else if (track->enc->pix_fmt == AV_PIX_FMT_YUV420P) tag = MKTAG('d','v','c','p');
else tag = MKTAG('d','v','p','p');
else if (track->enc->height == 720) /* HD 720 line */
if (track->enc->time_base.den == 50) tag = MKTAG('d','v','h','q');
@@ -666,24 +798,24 @@ static int mov_get_dv_codec_tag(AVFormatContext *s, MOVTrack *track)
}
static const struct {
- enum PixelFormat pix_fmt;
+ enum AVPixelFormat pix_fmt;
uint32_t tag;
unsigned bps;
} mov_pix_fmt_tags[] = {
- { PIX_FMT_YUYV422, MKTAG('y','u','v','s'), 0 },
- { PIX_FMT_UYVY422, MKTAG('2','v','u','y'), 0 },
- { PIX_FMT_RGB555BE,MKTAG('r','a','w',' '), 16 },
- { PIX_FMT_RGB555LE,MKTAG('L','5','5','5'), 16 },
- { PIX_FMT_RGB565LE,MKTAG('L','5','6','5'), 16 },
- { PIX_FMT_RGB565BE,MKTAG('B','5','6','5'), 16 },
- { PIX_FMT_GRAY16BE,MKTAG('b','1','6','g'), 16 },
- { PIX_FMT_RGB24, MKTAG('r','a','w',' '), 24 },
- { PIX_FMT_BGR24, MKTAG('2','4','B','G'), 24 },
- { PIX_FMT_ARGB, MKTAG('r','a','w',' '), 32 },
- { PIX_FMT_BGRA, MKTAG('B','G','R','A'), 32 },
- { PIX_FMT_RGBA, MKTAG('R','G','B','A'), 32 },
- { PIX_FMT_ABGR, MKTAG('A','B','G','R'), 32 },
- { PIX_FMT_RGB48BE, MKTAG('b','4','8','r'), 48 },
+ { AV_PIX_FMT_YUYV422, MKTAG('y','u','v','s'), 0 },
+ { AV_PIX_FMT_UYVY422, MKTAG('2','v','u','y'), 0 },
+ { AV_PIX_FMT_RGB555BE,MKTAG('r','a','w',' '), 16 },
+ { AV_PIX_FMT_RGB555LE,MKTAG('L','5','5','5'), 16 },
+ { AV_PIX_FMT_RGB565LE,MKTAG('L','5','6','5'), 16 },
+ { AV_PIX_FMT_RGB565BE,MKTAG('B','5','6','5'), 16 },
+ { AV_PIX_FMT_GRAY16BE,MKTAG('b','1','6','g'), 16 },
+ { AV_PIX_FMT_RGB24, MKTAG('r','a','w',' '), 24 },
+ { AV_PIX_FMT_BGR24, MKTAG('2','4','B','G'), 24 },
+ { AV_PIX_FMT_ARGB, MKTAG('r','a','w',' '), 32 },
+ { AV_PIX_FMT_BGRA, MKTAG('B','G','R','A'), 32 },
+ { AV_PIX_FMT_RGBA, MKTAG('R','G','B','A'), 32 },
+ { AV_PIX_FMT_ABGR, MKTAG('A','B','G','R'), 32 },
+ { AV_PIX_FMT_RGB48BE, MKTAG('b','4','8','r'), 48 },
};
static int mov_get_rawvideo_codec_tag(AVFormatContext *s, MOVTrack *track)
@@ -707,16 +839,16 @@ static int mov_get_codec_tag(AVFormatContext *s, MOVTrack *track)
int tag = track->enc->codec_tag;
if (!tag || (track->enc->strict_std_compliance >= FF_COMPLIANCE_NORMAL &&
- (track->enc->codec_id == CODEC_ID_DVVIDEO ||
- track->enc->codec_id == CODEC_ID_RAWVIDEO ||
- track->enc->codec_id == CODEC_ID_H263 ||
+ (track->enc->codec_id == AV_CODEC_ID_DVVIDEO ||
+ track->enc->codec_id == AV_CODEC_ID_RAWVIDEO ||
+ track->enc->codec_id == AV_CODEC_ID_H263 ||
av_get_bits_per_sample(track->enc->codec_id)))) { // pcm audio
- if (track->enc->codec_id == CODEC_ID_DVVIDEO)
+ if (track->enc->codec_id == AV_CODEC_ID_DVVIDEO)
tag = mov_get_dv_codec_tag(s, track);
- else if (track->enc->codec_id == CODEC_ID_RAWVIDEO)
+ else if (track->enc->codec_id == AV_CODEC_ID_RAWVIDEO)
tag = mov_get_rawvideo_codec_tag(s, track);
else if (track->enc->codec_type == AVMEDIA_TYPE_VIDEO) {
- tag = ff_codec_get_tag(codec_movvideo_tags, track->enc->codec_id);
+ tag = ff_codec_get_tag(ff_codec_movvideo_tags, track->enc->codec_id);
if (!tag) { // if no mac fcc found, try with Microsoft tags
tag = ff_codec_get_tag(ff_codec_bmp_tags, track->enc->codec_id);
if (tag)
@@ -724,7 +856,7 @@ static int mov_get_codec_tag(AVFormatContext *s, MOVTrack *track)
"the file may be unplayable!\n");
}
} else if (track->enc->codec_type == AVMEDIA_TYPE_AUDIO) {
- tag = ff_codec_get_tag(codec_movaudio_tags, track->enc->codec_id);
+ tag = ff_codec_get_tag(ff_codec_movaudio_tags, track->enc->codec_id);
if (!tag) { // if no mac fcc found, try with Microsoft tags
int ms_tag = ff_codec_get_tag(ff_codec_wav_tags, track->enc->codec_id);
if (ms_tag) {
@@ -741,23 +873,27 @@ static int mov_get_codec_tag(AVFormatContext *s, MOVTrack *track)
}
static const AVCodecTag codec_3gp_tags[] = {
- { CODEC_ID_H263, MKTAG('s','2','6','3') },
- { CODEC_ID_H264, MKTAG('a','v','c','1') },
- { CODEC_ID_MPEG4, MKTAG('m','p','4','v') },
- { CODEC_ID_AAC, MKTAG('m','p','4','a') },
- { CODEC_ID_AMR_NB, MKTAG('s','a','m','r') },
- { CODEC_ID_AMR_WB, MKTAG('s','a','w','b') },
- { CODEC_ID_MOV_TEXT, MKTAG('t','x','3','g') },
- { CODEC_ID_NONE, 0 },
+ { AV_CODEC_ID_H263, MKTAG('s','2','6','3') },
+ { AV_CODEC_ID_H264, MKTAG('a','v','c','1') },
+ { AV_CODEC_ID_MPEG4, MKTAG('m','p','4','v') },
+ { AV_CODEC_ID_AAC, MKTAG('m','p','4','a') },
+ { AV_CODEC_ID_AMR_NB, MKTAG('s','a','m','r') },
+ { AV_CODEC_ID_AMR_WB, MKTAG('s','a','w','b') },
+ { AV_CODEC_ID_MOV_TEXT, MKTAG('t','x','3','g') },
+ { AV_CODEC_ID_NONE, 0 },
};
static int mov_find_codec_tag(AVFormatContext *s, MOVTrack *track)
{
- int tag = track->enc->codec_tag;
+ int tag;
if (track->mode == MODE_MP4 || track->mode == MODE_PSP)
tag = mp4_get_codec_tag(s, track);
- else if (track->mode == MODE_IPOD)
+ else if (track->mode == MODE_ISM) {
+ tag = mp4_get_codec_tag(s, track);
+ if (!tag && track->enc->codec_id == AV_CODEC_ID_WMAPRO)
+ tag = MKTAG('w', 'm', 'a', ' ');
+ } else if (track->mode == MODE_IPOD)
tag = ipod_get_codec_tag(s, track);
else if (track->mode & MODE_3GP)
tag = ff_codec_get_tag(codec_3gp_tags, track->enc->codec_id);
@@ -812,7 +948,7 @@ static int mov_write_subtitle_tag(AVIOContext *pb, MOVTrack *track)
if (track->enc->extradata_size)
avio_write(pb, track->enc->extradata, track->enc->extradata_size);
- return updateSize(pb, pos);
+ return update_size(pb, pos);
}
static int mov_write_pasp_tag(AVIOContext *pb, MOVTrack *track)
@@ -831,7 +967,7 @@ static int mov_write_pasp_tag(AVIOContext *pb, MOVTrack *track)
static int mov_write_video_tag(AVIOContext *pb, MOVTrack *track)
{
int64_t pos = avio_tell(pb);
- char compressor_name[32];
+ char compressor_name[32] = { 0 };
avio_wb32(pb, 0); /* size */
avio_wl32(pb, track->tag); // store it byteswapped
@@ -843,7 +979,7 @@ static int mov_write_video_tag(AVIOContext *pb, MOVTrack *track)
avio_wb16(pb, 0); /* Codec stream revision (=0) */
if (track->mode == MODE_MOV) {
ffio_wfourcc(pb, "FFMP"); /* Vendor */
- if(track->enc->codec_id == CODEC_ID_RAWVIDEO) {
+ if(track->enc->codec_id == AV_CODEC_ID_RAWVIDEO) {
avio_wb32(pb, 0); /* Temporal Quality */
avio_wb32(pb, 0x400); /* Spatial Quality = lossless*/
} else {
@@ -862,7 +998,6 @@ static int mov_write_video_tag(AVIOContext *pb, MOVTrack *track)
avio_wb32(pb, 0); /* Data size (= 0) */
avio_wb16(pb, 1); /* Frame count (= 1) */
- memset(compressor_name,0,32);
/* FIXME not sure, ISO 14496-1 draft where it shall be set to 0 */
if (track->mode == MODE_MOV && track->enc->codec && track->enc->codec->name)
av_strlcpy(compressor_name,track->enc->codec->name,32);
@@ -876,19 +1011,21 @@ static int mov_write_video_tag(AVIOContext *pb, MOVTrack *track)
avio_wb16(pb, 0xffff); /* Reserved */
if(track->tag == MKTAG('m','p','4','v'))
mov_write_esds_tag(pb, track);
- else if(track->enc->codec_id == CODEC_ID_H263)
+ else if(track->enc->codec_id == AV_CODEC_ID_H263)
mov_write_d263_tag(pb);
- else if(track->enc->codec_id == CODEC_ID_SVQ3)
+ else if(track->enc->codec_id == AV_CODEC_ID_SVQ3)
mov_write_svq3_tag(pb);
- else if(track->enc->codec_id == CODEC_ID_DNXHD)
+ else if(track->enc->codec_id == AV_CODEC_ID_DNXHD)
mov_write_avid_tag(pb, track);
- else if(track->enc->codec_id == CODEC_ID_H264) {
+ else if(track->enc->codec_id == AV_CODEC_ID_H264) {
mov_write_avcc_tag(pb, track);
if(track->mode == MODE_IPOD)
mov_write_uuid_tag_ipod(pb);
} else if (track->enc->field_order != AV_FIELD_UNKNOWN)
mov_write_fiel_tag(pb, track);
- else if(track->vosLen > 0)
+ else if (track->enc->codec_id == AV_CODEC_ID_VC1 && track->vos_len > 0)
+ mov_write_dvc1_tag(pb, track);
+ else if (track->vos_len > 0)
mov_write_glbl_tag(pb, track);
if (track->enc->sample_aspect_ratio.den && track->enc->sample_aspect_ratio.num &&
@@ -896,7 +1033,7 @@ static int mov_write_video_tag(AVIOContext *pb, MOVTrack *track)
mov_write_pasp_tag(pb, track);
}
- return updateSize(pb, pos);
+ return update_size(pb, pos);
}
static int mov_write_rtp_tag(AVIOContext *pb, MOVTrack *track)
@@ -916,7 +1053,7 @@ static int mov_write_rtp_tag(AVIOContext *pb, MOVTrack *track)
ffio_wfourcc(pb, "tims");
avio_wb32(pb, track->timescale);
- return updateSize(pb, pos);
+ return update_size(pb, pos);
}
static int mov_write_stsd_tag(AVIOContext *pb, MOVTrack *track)
@@ -934,7 +1071,7 @@ static int mov_write_stsd_tag(AVIOContext *pb, MOVTrack *track)
mov_write_subtitle_tag(pb, track);
else if (track->enc->codec_tag == MKTAG('r','t','p',' '))
mov_write_rtp_tag(pb, track);
- return updateSize(pb, pos);
+ return update_size(pb, pos);
}
static int mov_write_ctts_tag(AVIOContext *pb, MOVTrack *track)
@@ -980,15 +1117,15 @@ static int mov_write_stts_tag(AVIOContext *pb, MOVTrack *track)
if (track->enc->codec_type == AVMEDIA_TYPE_AUDIO && !track->audio_vbr) {
stts_entries = av_malloc(sizeof(*stts_entries)); /* one entry */
- stts_entries[0].count = track->sampleCount;
+ stts_entries[0].count = track->sample_count;
stts_entries[0].duration = 1;
entries = 1;
} else {
- stts_entries = av_malloc(track->entry * sizeof(*stts_entries)); /* worst case */
+ stts_entries = track->entry ?
+ av_malloc(track->entry * sizeof(*stts_entries)) : /* worst case */
+ NULL;
for (i=0; i<track->entry; i++) {
- int64_t duration = i + 1 == track->entry ?
- track->trackDuration - track->cluster[i].dts + track->cluster[0].dts : /* readjusting */
- track->cluster[i+1].dts - track->cluster[i].dts;
+ int duration = get_cluster_duration(track, i);
if (i && duration == stts_entries[entries].duration) {
stts_entries[entries].count++; /* compress */
} else {
@@ -1035,7 +1172,7 @@ static int mov_write_stbl_tag(AVIOContext *pb, MOVTrack *track)
mov_write_stts_tag(pb, track);
if ((track->enc->codec_type == AVMEDIA_TYPE_VIDEO ||
track->enc->codec_tag == MKTAG('r','t','p',' ')) &&
- track->hasKeyframes && track->hasKeyframes < track->entry)
+ track->has_keyframes && track->has_keyframes < track->entry)
mov_write_stss_tag(pb, track, MOV_SYNC_SAMPLE);
if (track->mode == MODE_MOV && track->flags & MOV_TRACK_STPS)
mov_write_stss_tag(pb, track, MOV_PARTIAL_SYNC_SAMPLE);
@@ -1045,7 +1182,7 @@ static int mov_write_stbl_tag(AVIOContext *pb, MOVTrack *track)
mov_write_stsc_tag(pb, track);
mov_write_stsz_tag(pb, track);
mov_write_stco_tag(pb, track);
- return updateSize(pb, pos);
+ return update_size(pb, pos);
}
static int mov_write_dinf_tag(AVIOContext *pb)
@@ -1054,7 +1191,7 @@ static int mov_write_dinf_tag(AVIOContext *pb)
avio_wb32(pb, 0); /* size */
ffio_wfourcc(pb, "dinf");
mov_write_dref_tag(pb);
- return updateSize(pb, pos);
+ return update_size(pb, pos);
}
static int mov_write_nmhd_tag(AVIOContext *pb)
@@ -1140,7 +1277,7 @@ static int mov_write_hdlr_tag(AVIOContext *pb, MOVTrack *track)
avio_write(pb, descr, strlen(descr)); /* handler description */
if (track && track->mode != MODE_MOV)
avio_w8(pb, 0); /* c string */
- return updateSize(pb, pos);
+ return update_size(pb, pos);
}
static int mov_write_hmhd_tag(AVIOContext *pb)
@@ -1177,12 +1314,15 @@ static int mov_write_minf_tag(AVIOContext *pb, MOVTrack *track)
mov_write_hdlr_tag(pb, NULL);
mov_write_dinf_tag(pb);
mov_write_stbl_tag(pb, track);
- return updateSize(pb, pos);
+ return update_size(pb, pos);
}
static int mov_write_mdhd_tag(AVIOContext *pb, MOVTrack *track)
{
- int version = track->trackDuration < INT32_MAX ? 0 : 1;
+ int version = track->track_duration < INT32_MAX ? 0 : 1;
+
+ if (track->mode == MODE_ISM)
+ version = 1;
(version == 1) ? avio_wb32(pb, 44) : avio_wb32(pb, 32); /* size */
ffio_wfourcc(pb, "mdhd");
@@ -1196,7 +1336,10 @@ static int mov_write_mdhd_tag(AVIOContext *pb, MOVTrack *track)
avio_wb32(pb, track->time); /* modification time */
}
avio_wb32(pb, track->timescale); /* time scale (sample rate for audio) */
- (version == 1) ? avio_wb64(pb, track->trackDuration) : avio_wb32(pb, track->trackDuration); /* duration */
+ if (!track->entry)
+ (version == 1) ? avio_wb64(pb, UINT64_C(0xffffffffffffffff)) : avio_wb32(pb, 0xffffffff);
+ else
+ (version == 1) ? avio_wb64(pb, track->track_duration) : avio_wb32(pb, track->track_duration); /* duration */
avio_wb16(pb, track->language); /* language */
avio_wb16(pb, 0); /* reserved (quality) */
@@ -1218,15 +1361,18 @@ static int mov_write_mdia_tag(AVIOContext *pb, MOVTrack *track)
mov_write_mdhd_tag(pb, track);
mov_write_hdlr_tag(pb, track);
mov_write_minf_tag(pb, track);
- return updateSize(pb, pos);
+ return update_size(pb, pos);
}
static int mov_write_tkhd_tag(AVIOContext *pb, MOVTrack *track, AVStream *st)
{
- int64_t duration = av_rescale_rnd(track->trackDuration, MOV_TIMESCALE,
+ int64_t duration = av_rescale_rnd(track->track_duration, MOV_TIMESCALE,
track->timescale, AV_ROUND_UP);
int version = duration < INT32_MAX ? 0 : 1;
+ if (track->mode == MODE_ISM)
+ version = 1;
+
(version == 1) ? avio_wb32(pb, 104) : avio_wb32(pb, 92); /* size */
ffio_wfourcc(pb, "tkhd");
avio_w8(pb, version);
@@ -1238,9 +1384,12 @@ static int mov_write_tkhd_tag(AVIOContext *pb, MOVTrack *track, AVStream *st)
avio_wb32(pb, track->time); /* creation time */
avio_wb32(pb, track->time); /* modification time */
}
- avio_wb32(pb, track->trackID); /* track-id */
+ avio_wb32(pb, track->track_id); /* track-id */
avio_wb32(pb, 0); /* reserved */
- (version == 1) ? avio_wb64(pb, duration) : avio_wb32(pb, duration);
+ if (!track->entry)
+ (version == 1) ? avio_wb64(pb, UINT64_C(0xffffffffffffffff)) : avio_wb32(pb, 0xffffffff);
+ else
+ (version == 1) ? avio_wb64(pb, duration) : avio_wb32(pb, duration);
avio_wb32(pb, 0); /* reserved */
avio_wb32(pb, 0); /* reserved */
@@ -1307,13 +1456,13 @@ static int mov_write_tapt_tag(AVIOContext *pb, MOVTrack *track)
avio_wb32(pb, track->enc->width << 16);
avio_wb32(pb, track->enc->height << 16);
- return updateSize(pb, pos);
+ return update_size(pb, pos);
}
// This box seems important for the psp playback ... without it the movie seems to hang
static int mov_write_edts_tag(AVIOContext *pb, MOVTrack *track)
{
- int64_t duration = av_rescale_rnd(track->trackDuration, MOV_TIMESCALE,
+ int64_t duration = av_rescale_rnd(track->track_duration, MOV_TIMESCALE,
track->timescale, AV_ROUND_UP);
int version = duration < INT32_MAX ? 0 : 1;
int entry_size, entry_count, size;
@@ -1387,13 +1536,16 @@ static int mov_write_uuid_tag_psp(AVIOContext *pb, MOVTrack *mov)
return 0x34;
}
-static int mov_write_udta_sdp(AVIOContext *pb, AVFormatContext *ctx, int index)
+static int mov_write_udta_sdp(AVIOContext *pb, MOVTrack *track)
{
+
+ AVFormatContext *ctx = track->rtp_ctx;
char buf[1000] = "";
int len;
- ff_sdp_write_media(buf, sizeof(buf), ctx->streams[0]->codec, NULL, NULL, 0, 0, ctx);
- av_strlcatf(buf, sizeof(buf), "a=control:streamid=%d\r\n", index);
+ ff_sdp_write_media(buf, sizeof(buf), ctx->streams[0], track->src_track,
+ NULL, NULL, 0, 0, ctx);
+ av_strlcatf(buf, sizeof(buf), "a=control:streamid=%d\r\n", track->track_id);
len = strlen(buf);
avio_wb32(pb, len + 24);
@@ -1406,27 +1558,31 @@ static int mov_write_udta_sdp(AVIOContext *pb, AVFormatContext *ctx, int index)
return len + 24;
}
-static int mov_write_trak_tag(AVIOContext *pb, MOVTrack *track, AVStream *st)
+static int mov_write_trak_tag(AVIOContext *pb, MOVMuxContext *mov,
+ MOVTrack *track, AVStream *st)
{
int64_t pos = avio_tell(pb);
avio_wb32(pb, 0); /* size */
ffio_wfourcc(pb, "trak");
mov_write_tkhd_tag(pb, track, st);
- if (track->mode == MODE_PSP || track->flags & MOV_TRACK_CTTS || track->cluster[0].dts)
- mov_write_edts_tag(pb, track); // PSP Movies require edts box
+ if (track->mode == MODE_PSP || track->flags & MOV_TRACK_CTTS ||
+ (track->entry && track->cluster[0].dts)) {
+ if (!(mov->flags & FF_MOV_FLAG_FRAGMENT))
+ mov_write_edts_tag(pb, track); // PSP Movies require edts box
+ }
if (track->tref_tag)
mov_write_tref_tag(pb, track);
mov_write_mdia_tag(pb, track);
if (track->mode == MODE_PSP)
mov_write_uuid_tag_psp(pb,track); // PSP Movies require this uuid box
if (track->tag == MKTAG('r','t','p',' '))
- mov_write_udta_sdp(pb, track->rtp_ctx, track->trackID);
+ mov_write_udta_sdp(pb, track);
if (track->enc->codec_type == AVMEDIA_TYPE_VIDEO && track->mode == MODE_MOV) {
double sample_aspect_ratio = av_q2d(st->sample_aspect_ratio);
if (0.0 != sample_aspect_ratio && 1.0 != sample_aspect_ratio)
mov_write_tapt_tag(pb, track);
};
- return updateSize(pb, pos);
+ return update_size(pb, pos);
}
static int mov_write_iods_tag(AVIOContext *pb, MOVMuxContext *mov)
@@ -1448,36 +1604,60 @@ static int mov_write_iods_tag(AVIOContext *pb, MOVMuxContext *mov)
avio_wb32(pb, 0x0); /* size */
ffio_wfourcc(pb, "iods");
avio_wb32(pb, 0); /* version & flags */
- putDescr(pb, 0x10, 7);
+ put_descr(pb, 0x10, 7);
avio_wb16(pb, 0x004f);
avio_w8(pb, 0xff);
avio_w8(pb, 0xff);
avio_w8(pb, audio_profile);
avio_w8(pb, video_profile);
avio_w8(pb, 0xff);
- return updateSize(pb, pos);
+ return update_size(pb, pos);
+}
+
+static int mov_write_trex_tag(AVIOContext *pb, MOVTrack *track)
+{
+ avio_wb32(pb, 0x20); /* size */
+ ffio_wfourcc(pb, "trex");
+ avio_wb32(pb, 0); /* version & flags */
+ avio_wb32(pb, track->track_id); /* track ID */
+ avio_wb32(pb, 1); /* default sample description index */
+ avio_wb32(pb, 0); /* default sample duration */
+ avio_wb32(pb, 0); /* default sample size */
+ avio_wb32(pb, 0); /* default sample flags */
+ return 0;
+}
+
+static int mov_write_mvex_tag(AVIOContext *pb, MOVMuxContext *mov)
+{
+ int64_t pos = avio_tell(pb);
+ int i;
+ avio_wb32(pb, 0x0); /* size */
+ ffio_wfourcc(pb, "mvex");
+ for (i = 0; i < mov->nb_streams; i++)
+ mov_write_trex_tag(pb, &mov->tracks[i]);
+ return update_size(pb, pos);
}
static int mov_write_mvhd_tag(AVIOContext *pb, MOVMuxContext *mov)
{
- int maxTrackID = 1, i;
- int64_t maxTrackLenTemp, maxTrackLen = 0;
+ int max_track_id = 1, i;
+ int64_t max_track_len_temp, max_track_len = 0;
int version;
for (i=0; i<mov->nb_streams; i++) {
if(mov->tracks[i].entry > 0) {
- maxTrackLenTemp = av_rescale_rnd(mov->tracks[i].trackDuration,
- MOV_TIMESCALE,
- mov->tracks[i].timescale,
- AV_ROUND_UP);
- if(maxTrackLen < maxTrackLenTemp)
- maxTrackLen = maxTrackLenTemp;
- if(maxTrackID < mov->tracks[i].trackID)
- maxTrackID = mov->tracks[i].trackID;
+ max_track_len_temp = av_rescale_rnd(mov->tracks[i].track_duration,
+ MOV_TIMESCALE,
+ mov->tracks[i].timescale,
+ AV_ROUND_UP);
+ if (max_track_len < max_track_len_temp)
+ max_track_len = max_track_len_temp;
+ if (max_track_id < mov->tracks[i].track_id)
+ max_track_id = mov->tracks[i].track_id;
}
}
- version = maxTrackLen < UINT32_MAX ? 0 : 1;
+ version = max_track_len < UINT32_MAX ? 0 : 1;
(version == 1) ? avio_wb32(pb, 120) : avio_wb32(pb, 108); /* size */
ffio_wfourcc(pb, "mvhd");
avio_w8(pb, version);
@@ -1490,7 +1670,7 @@ static int mov_write_mvhd_tag(AVIOContext *pb, MOVMuxContext *mov)
avio_wb32(pb, mov->time); /* modification time */
}
avio_wb32(pb, MOV_TIMESCALE);
- (version == 1) ? avio_wb64(pb, maxTrackLen) : avio_wb32(pb, maxTrackLen); /* duration of longest track */
+ (version == 1) ? avio_wb64(pb, max_track_len) : avio_wb32(pb, max_track_len); /* duration of longest track */
avio_wb32(pb, 0x00010000); /* reserved (preferred rate) 1.0 = normal */
avio_wb16(pb, 0x0100); /* reserved (preferred volume) 1.0 = normal */
@@ -1515,7 +1695,7 @@ static int mov_write_mvhd_tag(AVIOContext *pb, MOVMuxContext *mov)
avio_wb32(pb, 0); /* reserved (selection time) */
avio_wb32(pb, 0); /* reserved (selection duration) */
avio_wb32(pb, 0); /* reserved (current time) */
- avio_wb32(pb, maxTrackID+1); /* Next track id */
+ avio_wb32(pb, max_track_id + 1); /* Next track id */
return 0x6c;
}
@@ -1562,7 +1742,7 @@ static int mov_write_string_tag(AVIOContext *pb, const char *name, const char *v
avio_wb32(pb, 0); /* size */
ffio_wfourcc(pb, name);
mov_write_string_data_tag(pb, value, lang, long_style);
- size= updateSize(pb, pos);
+ size = update_size(pb, pos);
}
return size;
}
@@ -1638,7 +1818,7 @@ static int mov_write_ilst_tag(AVIOContext *pb, MOVMuxContext *mov,
mov_write_string_metadata(s, pb, "tven", "episode_id",1);
mov_write_string_metadata(s, pb, "tvnn", "network" , 1);
mov_write_trkn_tag(pb, mov, s);
- return updateSize(pb, pos);
+ return update_size(pb, pos);
}
/* iTunes meta data tag */
@@ -1652,7 +1832,7 @@ static int mov_write_meta_tag(AVIOContext *pb, MOVMuxContext *mov,
avio_wb32(pb, 0);
mov_write_itunes_hdlr_tag(pb, mov, s);
mov_write_ilst_tag(pb, mov, s);
- size = updateSize(pb, pos);
+ size = update_size(pb, pos);
return size;
}
@@ -1702,7 +1882,7 @@ static int mov_write_3gp_udta_tag(AVIOContext *pb, AVFormatContext *s,
(t = av_dict_get(s->metadata, "track", NULL, 0)))
avio_w8(pb, atoi(t->value));
}
- return updateSize(pb, pos);
+ return update_size(pb, pos);
}
static int mov_write_chpl_tag(AVIOContext *pb, AVFormatContext *s)
@@ -1728,7 +1908,7 @@ static int mov_write_chpl_tag(AVIOContext *pb, AVFormatContext *s)
} else
avio_w8(pb, 0);
}
- return updateSize(pb, pos);
+ return update_size(pb, pos);
}
static int mov_write_udta_tag(AVIOContext *pb, MOVMuxContext *mov,
@@ -1825,11 +2005,10 @@ static int mov_write_uuidusmt_tag(AVIOContext *pb, AVFormatContext *s)
mov_write_psp_udta_tag(pb, LIBAVCODEC_IDENT, "eng", 0x04);
mov_write_psp_udta_tag(pb, title->value, "eng", 0x01);
-// snprintf(dt,32,"%04d/%02d/%02d %02d:%02d:%02d",t_st->tm_year+1900,t_st->tm_mon+1,t_st->tm_mday,t_st->tm_hour,t_st->tm_min,t_st->tm_sec);
mov_write_psp_udta_tag(pb, "2006/04/01 11:11:11", "und", 0x03);
- updateSize(pb, pos2);
- return updateSize(pb, pos);
+ update_size(pb, pos2);
+ return update_size(pb, pos);
}
return 0;
@@ -1844,22 +2023,23 @@ static int mov_write_moov_tag(AVIOContext *pb, MOVMuxContext *mov,
ffio_wfourcc(pb, "moov");
for (i=0; i<mov->nb_streams; i++) {
- if(mov->tracks[i].entry <= 0) continue;
+ if (mov->tracks[i].entry <= 0 && !(mov->flags & FF_MOV_FLAG_FRAGMENT))
+ continue;
mov->tracks[i].time = mov->time;
- mov->tracks[i].trackID = i+1;
+ mov->tracks[i].track_id = i+1;
}
if (mov->chapter_track)
for (i=0; i<s->nb_streams; i++) {
mov->tracks[i].tref_tag = MKTAG('c','h','a','p');
- mov->tracks[i].tref_id = mov->tracks[mov->chapter_track].trackID;
+ mov->tracks[i].tref_id = mov->tracks[mov->chapter_track].track_id;
}
for (i = 0; i < mov->nb_streams; i++) {
if (mov->tracks[i].tag == MKTAG('r','t','p',' ')) {
mov->tracks[i].tref_tag = MKTAG('h','i','n','t');
mov->tracks[i].tref_id =
- mov->tracks[mov->tracks[i].src_track].trackID;
+ mov->tracks[mov->tracks[i].src_track].track_id;
}
}
@@ -1867,17 +2047,410 @@ static int mov_write_moov_tag(AVIOContext *pb, MOVMuxContext *mov,
if (mov->mode != MODE_MOV && !mov->iods_skip)
mov_write_iods_tag(pb, mov);
for (i=0; i<mov->nb_streams; i++) {
- if(mov->tracks[i].entry > 0) {
- mov_write_trak_tag(pb, &(mov->tracks[i]), i < s->nb_streams ? s->streams[i] : NULL);
+ if (mov->tracks[i].entry > 0 || mov->flags & FF_MOV_FLAG_FRAGMENT) {
+ mov_write_trak_tag(pb, mov, &(mov->tracks[i]), i < s->nb_streams ? s->streams[i] : NULL);
}
}
+ if (mov->flags & FF_MOV_FLAG_FRAGMENT)
+ mov_write_mvex_tag(pb, mov); /* QuickTime requires trak to precede this */
if (mov->mode == MODE_PSP)
mov_write_uuidusmt_tag(pb, s);
else
mov_write_udta_tag(pb, mov, s);
- return updateSize(pb, pos);
+ return update_size(pb, pos);
+}
+
+static void param_write_int(AVIOContext *pb, const char *name, int value)
+{
+ avio_printf(pb, "<param name=\"%s\" value=\"%d\" valuetype=\"data\"/>\n", name, value);
+}
+
+static void param_write_string(AVIOContext *pb, const char *name, const char *value)
+{
+ avio_printf(pb, "<param name=\"%s\" value=\"%s\" valuetype=\"data\"/>\n", name, value);
+}
+
+static void param_write_hex(AVIOContext *pb, const char *name, const uint8_t *value, int len)
+{
+ char buf[150];
+ len = FFMIN(sizeof(buf)/2 - 1, len);
+ ff_data_to_hex(buf, value, len, 0);
+ buf[2*len] = '\0';
+ avio_printf(pb, "<param name=\"%s\" value=\"%s\" valuetype=\"data\"/>\n", name, buf);
+}
+
+static int mov_write_isml_manifest(AVIOContext *pb, MOVMuxContext *mov)
+{
+ int64_t pos = avio_tell(pb);
+ int i;
+ const uint8_t uuid[] = {
+ 0xa5, 0xd4, 0x0b, 0x30, 0xe8, 0x14, 0x11, 0xdd,
+ 0xba, 0x2f, 0x08, 0x00, 0x20, 0x0c, 0x9a, 0x66
+ };
+
+ avio_wb32(pb, 0);
+ ffio_wfourcc(pb, "uuid");
+ avio_write(pb, uuid, sizeof(uuid));
+ avio_wb32(pb, 0);
+
+ avio_printf(pb, "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n");
+ avio_printf(pb, "<smil xmlns=\"http://www.w3.org/2001/SMIL20/Language\">\n");
+ avio_printf(pb, "<head>\n");
+ avio_printf(pb, "<meta name=\"creator\" content=\"%s\" />\n",
+ LIBAVFORMAT_IDENT);
+ avio_printf(pb, "</head>\n");
+ avio_printf(pb, "<body>\n");
+ avio_printf(pb, "<switch>\n");
+ for (i = 0; i < mov->nb_streams; i++) {
+ MOVTrack *track = &mov->tracks[i];
+ const char *type;
+ /* track->track_id is initialized in write_moov, and thus isn't known
+ * here yet */
+ int track_id = i + 1;
+
+ if (track->enc->codec_type == AVMEDIA_TYPE_VIDEO) {
+ type = "video";
+ } else if (track->enc->codec_type == AVMEDIA_TYPE_AUDIO) {
+ type = "audio";
+ } else {
+ continue;
+ }
+ avio_printf(pb, "<%s systemBitrate=\"%d\">\n", type,
+ track->enc->bit_rate);
+ param_write_int(pb, "systemBitrate", track->enc->bit_rate);
+ param_write_int(pb, "trackID", track_id);
+ if (track->enc->codec_type == AVMEDIA_TYPE_VIDEO) {
+ if (track->enc->codec_id == AV_CODEC_ID_H264) {
+ uint8_t *ptr;
+ int size = track->enc->extradata_size;
+ if (!ff_avc_write_annexb_extradata(track->enc->extradata, &ptr,
+ &size)) {
+ param_write_hex(pb, "CodecPrivateData",
+ ptr ? ptr : track->enc->extradata,
+ size);
+ av_free(ptr);
+ }
+ param_write_string(pb, "FourCC", "H264");
+ } else if (track->enc->codec_id == AV_CODEC_ID_VC1) {
+ param_write_string(pb, "FourCC", "WVC1");
+ param_write_hex(pb, "CodecPrivateData", track->enc->extradata,
+ track->enc->extradata_size);
+ }
+ param_write_int(pb, "MaxWidth", track->enc->width);
+ param_write_int(pb, "MaxHeight", track->enc->height);
+ param_write_int(pb, "DisplayWidth", track->enc->width);
+ param_write_int(pb, "DisplayHeight", track->enc->height);
+ } else {
+ if (track->enc->codec_id == AV_CODEC_ID_AAC) {
+ param_write_string(pb, "FourCC", "AACL");
+ } else if (track->enc->codec_id == AV_CODEC_ID_WMAPRO) {
+ param_write_string(pb, "FourCC", "WMAP");
+ }
+ param_write_hex(pb, "CodecPrivateData", track->enc->extradata,
+ track->enc->extradata_size);
+ param_write_int(pb, "AudioTag", ff_codec_get_tag(ff_codec_wav_tags,
+ track->enc->codec_id));
+ param_write_int(pb, "Channels", track->enc->channels);
+ param_write_int(pb, "SamplingRate", track->enc->sample_rate);
+ param_write_int(pb, "BitsPerSample", 16);
+ param_write_int(pb, "PacketSize", track->enc->block_align ?
+ track->enc->block_align : 4);
+ }
+ avio_printf(pb, "</%s>\n", type);
+ }
+ avio_printf(pb, "</switch>\n");
+ avio_printf(pb, "</body>\n");
+ avio_printf(pb, "</smil>\n");
+
+ return update_size(pb, pos);
+}
+
+static int mov_write_mfhd_tag(AVIOContext *pb, MOVMuxContext *mov)
+{
+ avio_wb32(pb, 16);
+ ffio_wfourcc(pb, "mfhd");
+ avio_wb32(pb, 0);
+ avio_wb32(pb, mov->fragments);
+ return 0;
+}
+
+static int mov_write_tfhd_tag(AVIOContext *pb, MOVTrack *track,
+ int64_t moof_offset)
+{
+ int64_t pos = avio_tell(pb);
+ uint32_t flags = MOV_TFHD_DEFAULT_SIZE | MOV_TFHD_DEFAULT_DURATION |
+ MOV_TFHD_BASE_DATA_OFFSET;
+ if (!track->entry) {
+ flags |= MOV_TFHD_DURATION_IS_EMPTY;
+ } else {
+ flags |= MOV_TFHD_DEFAULT_FLAGS;
+ }
+
+ /* Don't set a default sample size, the silverlight player refuses
+ * to play files with that set. Don't set a default sample duration,
+ * WMP freaks out if it is set. */
+ if (track->mode == MODE_ISM)
+ flags &= ~(MOV_TFHD_DEFAULT_SIZE | MOV_TFHD_DEFAULT_DURATION);
+
+ avio_wb32(pb, 0); /* size placeholder */
+ ffio_wfourcc(pb, "tfhd");
+ avio_w8(pb, 0); /* version */
+ avio_wb24(pb, flags);
+
+ avio_wb32(pb, track->track_id); /* track-id */
+ if (flags & MOV_TFHD_BASE_DATA_OFFSET)
+ avio_wb64(pb, moof_offset);
+ if (flags & MOV_TFHD_DEFAULT_DURATION) {
+ track->default_duration = get_cluster_duration(track, 0);
+ avio_wb32(pb, track->default_duration);
+ }
+ if (flags & MOV_TFHD_DEFAULT_SIZE) {
+ track->default_size = track->entry ? track->cluster[0].size : 1;
+ avio_wb32(pb, track->default_size);
+ } else
+ track->default_size = -1;
+
+ if (flags & MOV_TFHD_DEFAULT_FLAGS) {
+ track->default_sample_flags =
+ track->enc->codec_type == AVMEDIA_TYPE_VIDEO ?
+ (MOV_FRAG_SAMPLE_FLAG_DEPENDS_YES | MOV_FRAG_SAMPLE_FLAG_IS_NON_SYNC) :
+ MOV_FRAG_SAMPLE_FLAG_DEPENDS_NO;
+ avio_wb32(pb, track->default_sample_flags);
+ }
+
+ return update_size(pb, pos);
+}
+
+static uint32_t get_sample_flags(MOVTrack *track, MOVIentry *entry)
+{
+ return entry->flags & MOV_SYNC_SAMPLE ? MOV_FRAG_SAMPLE_FLAG_DEPENDS_NO :
+ (MOV_FRAG_SAMPLE_FLAG_DEPENDS_YES | MOV_FRAG_SAMPLE_FLAG_IS_NON_SYNC);
+}
+
+static int mov_write_trun_tag(AVIOContext *pb, MOVTrack *track)
+{
+ int64_t pos = avio_tell(pb);
+ uint32_t flags = MOV_TRUN_DATA_OFFSET;
+ int i;
+
+ for (i = 0; i < track->entry; i++) {
+ if (get_cluster_duration(track, i) != track->default_duration)
+ flags |= MOV_TRUN_SAMPLE_DURATION;
+ if (track->cluster[i].size != track->default_size)
+ flags |= MOV_TRUN_SAMPLE_SIZE;
+ if (i > 0 && get_sample_flags(track, &track->cluster[i]) != track->default_sample_flags)
+ flags |= MOV_TRUN_SAMPLE_FLAGS;
+ }
+ if (!(flags & MOV_TRUN_SAMPLE_FLAGS))
+ flags |= MOV_TRUN_FIRST_SAMPLE_FLAGS;
+ if (track->flags & MOV_TRACK_CTTS)
+ flags |= MOV_TRUN_SAMPLE_CTS;
+
+ avio_wb32(pb, 0); /* size placeholder */
+ ffio_wfourcc(pb, "trun");
+ avio_w8(pb, 0); /* version */
+ avio_wb24(pb, flags);
+
+ avio_wb32(pb, track->entry); /* sample count */
+ track->moof_size_offset = avio_tell(pb);
+ avio_wb32(pb, 0); /* data offset */
+ if (flags & MOV_TRUN_FIRST_SAMPLE_FLAGS)
+ avio_wb32(pb, get_sample_flags(track, &track->cluster[0]));
+
+ for (i = 0; i < track->entry; i++) {
+ if (flags & MOV_TRUN_SAMPLE_DURATION)
+ avio_wb32(pb, get_cluster_duration(track, i));
+ if (flags & MOV_TRUN_SAMPLE_SIZE)
+ avio_wb32(pb, track->cluster[i].size);
+ if (flags & MOV_TRUN_SAMPLE_FLAGS)
+ avio_wb32(pb, get_sample_flags(track, &track->cluster[i]));
+ if (flags & MOV_TRUN_SAMPLE_CTS)
+ avio_wb32(pb, track->cluster[i].cts);
+ }
+
+ return update_size(pb, pos);
+}
+
+static int mov_write_tfxd_tag(AVIOContext *pb, MOVTrack *track)
+{
+ int64_t pos = avio_tell(pb);
+ const uint8_t uuid[] = {
+ 0x6d, 0x1d, 0x9b, 0x05, 0x42, 0xd5, 0x44, 0xe6,
+ 0x80, 0xe2, 0x14, 0x1d, 0xaf, 0xf7, 0x57, 0xb2
+ };
+
+ avio_wb32(pb, 0); /* size placeholder */
+ ffio_wfourcc(pb, "uuid");
+ avio_write(pb, uuid, sizeof(uuid));
+ avio_w8(pb, 1);
+ avio_wb24(pb, 0);
+ avio_wb64(pb, track->frag_start);
+ avio_wb64(pb, track->start_dts + track->track_duration -
+ track->cluster[0].dts);
+
+ return update_size(pb, pos);
+}
+
+static int mov_write_tfrf_tag(AVIOContext *pb, MOVMuxContext *mov,
+ MOVTrack *track, int entry)
+{
+ int n = track->nb_frag_info - 1 - entry, i;
+ int size = 8 + 16 + 4 + 1 + 16*n;
+ const uint8_t uuid[] = {
+ 0xd4, 0x80, 0x7e, 0xf2, 0xca, 0x39, 0x46, 0x95,
+ 0x8e, 0x54, 0x26, 0xcb, 0x9e, 0x46, 0xa7, 0x9f
+ };
+
+ if (entry < 0)
+ return 0;
+
+ avio_seek(pb, track->frag_info[entry].tfrf_offset, SEEK_SET);
+ avio_wb32(pb, size);
+ ffio_wfourcc(pb, "uuid");
+ avio_write(pb, uuid, sizeof(uuid));
+ avio_w8(pb, 1);
+ avio_wb24(pb, 0);
+ avio_w8(pb, n);
+ for (i = 0; i < n; i++) {
+ int index = entry + 1 + i;
+ avio_wb64(pb, track->frag_info[index].time);
+ avio_wb64(pb, track->frag_info[index].duration);
+ }
+ if (n < mov->ism_lookahead) {
+ int free_size = 16*(mov->ism_lookahead - n);
+ avio_wb32(pb, free_size);
+ ffio_wfourcc(pb, "free");
+ for (i = 0; i < free_size - 8; i++)
+ avio_w8(pb, 0);
+ }
+
+ return 0;
+}
+
+static int mov_write_tfrf_tags(AVIOContext *pb, MOVMuxContext *mov,
+ MOVTrack *track)
+{
+ int64_t pos = avio_tell(pb);
+ int i;
+ for (i = 0; i < mov->ism_lookahead; i++) {
+ /* Update the tfrf tag for the last ism_lookahead fragments,
+ * nb_frag_info - 1 is the next fragment to be written. */
+ mov_write_tfrf_tag(pb, mov, track, track->nb_frag_info - 2 - i);
+ }
+ avio_seek(pb, pos, SEEK_SET);
+ return 0;
+}
+
+static int mov_write_traf_tag(AVIOContext *pb, MOVMuxContext *mov,
+ MOVTrack *track, int64_t moof_offset)
+{
+ int64_t pos = avio_tell(pb);
+ avio_wb32(pb, 0); /* size placeholder */
+ ffio_wfourcc(pb, "traf");
+
+ mov_write_tfhd_tag(pb, track, moof_offset);
+ mov_write_trun_tag(pb, track);
+ if (mov->mode == MODE_ISM) {
+ mov_write_tfxd_tag(pb, track);
+
+ if (mov->ism_lookahead) {
+ int i, size = 16 + 4 + 1 + 16*mov->ism_lookahead;
+
+ track->tfrf_offset = avio_tell(pb);
+ avio_wb32(pb, 8 + size);
+ ffio_wfourcc(pb, "free");
+ for (i = 0; i < size; i++)
+ avio_w8(pb, 0);
+ }
+ }
+
+ return update_size(pb, pos);
+}
+
+static int mov_write_moof_tag(AVIOContext *pb, MOVMuxContext *mov, int tracks)
+{
+ int64_t pos = avio_tell(pb), end;
+ int i, moof_size;
+
+ avio_wb32(pb, 0); /* size placeholder */
+ ffio_wfourcc(pb, "moof");
+
+ mov_write_mfhd_tag(pb, mov);
+ for (i = 0; i < mov->nb_streams; i++) {
+ MOVTrack *track = &mov->tracks[i];
+ if (tracks >= 0 && i != tracks)
+ continue;
+ if (!track->entry)
+ continue;
+ mov_write_traf_tag(pb, mov, track, pos);
+ }
+
+ end = avio_tell(pb);
+ moof_size = end - pos;
+ for (i = 0; i < mov->nb_streams; i++) {
+ MOVTrack *track = &mov->tracks[i];
+ if (tracks >= 0 && i != tracks)
+ continue;
+ if (!track->entry)
+ continue;
+ avio_seek(pb, mov->tracks[i].moof_size_offset, SEEK_SET);
+ avio_wb32(pb, moof_size + 8 + mov->tracks[i].data_offset);
+ }
+ avio_seek(pb, end, SEEK_SET);
+
+ return update_size(pb, pos);
+}
+
+static int mov_write_tfra_tag(AVIOContext *pb, MOVTrack *track)
+{
+ int64_t pos = avio_tell(pb);
+ int i;
+
+ avio_wb32(pb, 0); /* size placeholder */
+ ffio_wfourcc(pb, "tfra");
+ avio_w8(pb, 1); /* version */
+ avio_wb24(pb, 0);
+
+ avio_wb32(pb, track->track_id);
+ avio_wb32(pb, 0); /* length of traf/trun/sample num */
+ avio_wb32(pb, track->nb_frag_info);
+ for (i = 0; i < track->nb_frag_info; i++) {
+ avio_wb64(pb, track->frag_info[i].time);
+ avio_wb64(pb, track->frag_info[i].offset);
+ avio_w8(pb, 1); /* traf number */
+ avio_w8(pb, 1); /* trun number */
+ avio_w8(pb, 1); /* sample number */
+ }
+
+ return update_size(pb, pos);
+}
+
+static int mov_write_mfra_tag(AVIOContext *pb, MOVMuxContext *mov)
+{
+ int64_t pos = avio_tell(pb);
+ int i;
+
+ avio_wb32(pb, 0); /* size placeholder */
+ ffio_wfourcc(pb, "mfra");
+ /* An empty mfra atom is enough to indicate to the publishing point that
+ * the stream has ended. */
+ if (mov->flags & FF_MOV_FLAG_ISML)
+ return update_size(pb, pos);
+
+ for (i = 0; i < mov->nb_streams; i++) {
+ MOVTrack *track = &mov->tracks[i];
+ if (track->nb_frag_info)
+ mov_write_tfra_tag(pb, track);
+ }
+
+ avio_wb32(pb, 16);
+ ffio_wfourcc(pb, "mfro");
+ avio_wb32(pb, 0); /* version + flags */
+ avio_wb32(pb, avio_tell(pb) + 4 - pos);
+
+ return update_size(pb, pos);
}
static int mov_write_mdat_tag(AVIOContext *pb, MOVMuxContext *mov)
@@ -1904,7 +2477,7 @@ static int mov_write_ftyp_tag(AVIOContext *pb, AVFormatContext *s)
AVStream *st = s->streams[i];
if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO)
has_video = 1;
- if (st->codec->codec_id == CODEC_ID_H264)
+ if (st->codec->codec_id == AV_CODEC_ID_H264)
has_h264 = 1;
}
@@ -1923,6 +2496,8 @@ static int mov_write_ftyp_tag(AVIOContext *pb, AVFormatContext *s)
ffio_wfourcc(pb, "isom");
else if (mov->mode == MODE_IPOD)
ffio_wfourcc(pb, has_video ? "M4V ":"M4A ");
+ else if (mov->mode == MODE_ISM)
+ ffio_wfourcc(pb, "isml");
else
ffio_wfourcc(pb, "qt ");
@@ -1930,7 +2505,10 @@ static int mov_write_ftyp_tag(AVIOContext *pb, AVFormatContext *s)
if(mov->mode == MODE_MOV)
ffio_wfourcc(pb, "qt ");
- else{
+ else if (mov->mode == MODE_ISM) {
+ ffio_wfourcc(pb, "piff");
+ ffio_wfourcc(pb, "iso2");
+ } else {
ffio_wfourcc(pb, "isom");
ffio_wfourcc(pb, "iso2");
if(has_h264)
@@ -1945,17 +2523,17 @@ static int mov_write_ftyp_tag(AVIOContext *pb, AVFormatContext *s)
ffio_wfourcc(pb, "MSNV");
else if (mov->mode == MODE_MP4)
ffio_wfourcc(pb, "mp41");
- return updateSize(pb, pos);
+ return update_size(pb, pos);
}
static void mov_write_uuidprof_tag(AVIOContext *pb, AVFormatContext *s)
{
- AVCodecContext *VideoCodec = s->streams[0]->codec;
- AVCodecContext *AudioCodec = s->streams[1]->codec;
- int AudioRate = AudioCodec->sample_rate;
- int FrameRate = ((VideoCodec->time_base.den) * (0x10000))/ (VideoCodec->time_base.num);
- int audio_kbitrate= AudioCodec->bit_rate / 1000;
- int video_kbitrate= FFMIN(VideoCodec->bit_rate / 1000, 800 - audio_kbitrate);
+ AVCodecContext *video_codec = s->streams[0]->codec;
+ AVCodecContext *audio_codec = s->streams[1]->codec;
+ int audio_rate = audio_codec->sample_rate;
+ int frame_rate = ((video_codec->time_base.den) * (0x10000))/ (video_codec->time_base.num);
+ int audio_kbitrate = audio_codec->bit_rate / 1000;
+ int video_kbitrate = FFMIN(video_codec->bit_rate / 1000, 800 - audio_kbitrate);
avio_wb32(pb, 0x94); /* size */
ffio_wfourcc(pb, "uuid");
@@ -1983,14 +2561,14 @@ static void mov_write_uuidprof_tag(AVIOContext *pb, AVFormatContext *s)
avio_wb32(pb, 0x0);
avio_wb32(pb, audio_kbitrate);
avio_wb32(pb, audio_kbitrate);
- avio_wb32(pb, AudioRate);
- avio_wb32(pb, AudioCodec->channels);
+ avio_wb32(pb, audio_rate);
+ avio_wb32(pb, audio_codec->channels);
avio_wb32(pb, 0x34); /* size */
ffio_wfourcc(pb, "VPRF"); /* video */
avio_wb32(pb, 0x0);
avio_wb32(pb, 0x1); /* TrackID */
- if (VideoCodec->codec_id == CODEC_ID_H264) {
+ if (video_codec->codec_id == AV_CODEC_ID_H264) {
ffio_wfourcc(pb, "avc1");
avio_wb16(pb, 0x014D);
avio_wb16(pb, 0x0015);
@@ -2002,10 +2580,10 @@ static void mov_write_uuidprof_tag(AVIOContext *pb, AVFormatContext *s)
avio_wb32(pb, 0x0);
avio_wb32(pb, video_kbitrate);
avio_wb32(pb, video_kbitrate);
- avio_wb32(pb, FrameRate);
- avio_wb32(pb, FrameRate);
- avio_wb16(pb, VideoCodec->width);
- avio_wb16(pb, VideoCodec->height);
+ avio_wb32(pb, frame_rate);
+ avio_wb32(pb, frame_rate);
+ avio_wb16(pb, video_codec->width);
+ avio_wb16(pb, video_codec->height);
avio_wb32(pb, 0x010001); /* ? */
}
@@ -2030,46 +2608,243 @@ static int mov_parse_mpeg2_frame(AVPacket *pkt, uint32_t *flags)
return 0;
}
+static void mov_parse_vc1_frame(AVPacket *pkt, MOVTrack *trk, int fragment)
+{
+ const uint8_t *start, *next, *end = pkt->data + pkt->size;
+ int seq = 0, entry = 0;
+ int key = pkt->flags & AV_PKT_FLAG_KEY;
+ start = find_next_marker(pkt->data, end);
+ for (next = start; next < end; start = next) {
+ next = find_next_marker(start + 4, end);
+ switch (AV_RB32(start)) {
+ case VC1_CODE_SEQHDR:
+ seq = 1;
+ break;
+ case VC1_CODE_ENTRYPOINT:
+ entry = 1;
+ break;
+ case VC1_CODE_SLICE:
+ trk->vc1_info.slices = 1;
+ break;
+ }
+ }
+ if (!trk->entry && !fragment) {
+ /* First packet in first fragment */
+ trk->vc1_info.first_packet_seq = seq;
+ trk->vc1_info.first_packet_entry = entry;
+ } else if ((seq && !trk->vc1_info.packet_seq) ||
+ (entry && !trk->vc1_info.packet_entry)) {
+ int i;
+ for (i = 0; i < trk->entry; i++)
+ trk->cluster[i].flags &= ~MOV_SYNC_SAMPLE;
+ trk->has_keyframes = 0;
+ if (seq)
+ trk->vc1_info.packet_seq = 1;
+ if (entry)
+ trk->vc1_info.packet_entry = 1;
+ if (!fragment) {
+ /* First fragment */
+ if ((!seq || trk->vc1_info.first_packet_seq) &&
+ (!entry || trk->vc1_info.first_packet_entry)) {
+ /* First packet had the same headers as this one, readd the
+ * sync sample flag. */
+ trk->cluster[0].flags |= MOV_SYNC_SAMPLE;
+ trk->has_keyframes = 1;
+ }
+ }
+ }
+ if (trk->vc1_info.packet_seq && trk->vc1_info.packet_entry)
+ key = seq && entry;
+ else if (trk->vc1_info.packet_seq)
+ key = seq;
+ else if (trk->vc1_info.packet_entry)
+ key = entry;
+ if (key) {
+ trk->cluster[trk->entry].flags |= MOV_SYNC_SAMPLE;
+ trk->has_keyframes++;
+ }
+}
+
+static int mov_flush_fragment(AVFormatContext *s)
+{
+ MOVMuxContext *mov = s->priv_data;
+ int i, first_track = -1;
+ int64_t mdat_size = 0;
+
+ if (!(mov->flags & FF_MOV_FLAG_FRAGMENT))
+ return 0;
+
+ if (!(mov->flags & FF_MOV_FLAG_EMPTY_MOOV) && mov->fragments == 0) {
+ int64_t pos = avio_tell(s->pb);
+ int ret;
+ AVIOContext *moov_buf;
+ uint8_t *buf;
+ int buf_size;
+
+ for (i = 0; i < mov->nb_streams; i++)
+ if (!mov->tracks[i].entry)
+ break;
+ /* Don't write the initial moov unless all tracks have data */
+ if (i < mov->nb_streams)
+ return 0;
+
+ if ((ret = avio_open_dyn_buf(&moov_buf)) < 0)
+ return ret;
+ mov_write_moov_tag(moov_buf, mov, s);
+ buf_size = avio_close_dyn_buf(moov_buf, &buf);
+ av_free(buf);
+ for (i = 0; i < mov->nb_streams; i++)
+ mov->tracks[i].data_offset = pos + buf_size + 8;
+
+ mov_write_moov_tag(s->pb, mov, s);
+
+ buf_size = avio_close_dyn_buf(mov->mdat_buf, &buf);
+ mov->mdat_buf = NULL;
+ avio_wb32(s->pb, buf_size + 8);
+ ffio_wfourcc(s->pb, "mdat");
+ avio_write(s->pb, buf, buf_size);
+ av_free(buf);
+
+ mov->fragments++;
+ mov->mdat_size = 0;
+ for (i = 0; i < mov->nb_streams; i++) {
+ if (mov->tracks[i].entry)
+ mov->tracks[i].frag_start += mov->tracks[i].start_dts +
+ mov->tracks[i].track_duration -
+ mov->tracks[i].cluster[0].dts;
+ mov->tracks[i].entry = 0;
+ }
+ avio_flush(s->pb);
+ return 0;
+ }
+
+ for (i = 0; i < mov->nb_streams; i++) {
+ MOVTrack *track = &mov->tracks[i];
+ if (mov->flags & FF_MOV_FLAG_SEPARATE_MOOF)
+ track->data_offset = 0;
+ else
+ track->data_offset = mdat_size;
+ if (!track->mdat_buf)
+ continue;
+ mdat_size += avio_tell(track->mdat_buf);
+ if (first_track < 0)
+ first_track = i;
+ }
+
+ if (!mdat_size)
+ return 0;
+
+ for (i = 0; i < mov->nb_streams; i++) {
+ MOVTrack *track = &mov->tracks[i];
+ int buf_size, write_moof = 1, moof_tracks = -1;
+ uint8_t *buf;
+ int64_t duration = 0;
+
+ if (track->entry)
+ duration = track->start_dts + track->track_duration -
+ track->cluster[0].dts;
+ if (mov->flags & FF_MOV_FLAG_SEPARATE_MOOF) {
+ if (!track->mdat_buf)
+ continue;
+ mdat_size = avio_tell(track->mdat_buf);
+ moof_tracks = i;
+ } else {
+ write_moof = i == first_track;
+ }
+
+ if (write_moof) {
+ MOVFragmentInfo *info;
+ avio_flush(s->pb);
+ track->nb_frag_info++;
+ track->frag_info = av_realloc(track->frag_info,
+ sizeof(*track->frag_info) *
+ track->nb_frag_info);
+ info = &track->frag_info[track->nb_frag_info - 1];
+ info->offset = avio_tell(s->pb);
+ info->time = mov->tracks[i].frag_start;
+ info->duration = duration;
+ mov_write_tfrf_tags(s->pb, mov, track);
+
+ mov_write_moof_tag(s->pb, mov, moof_tracks);
+ info->tfrf_offset = track->tfrf_offset;
+ mov->fragments++;
+
+ avio_wb32(s->pb, mdat_size + 8);
+ ffio_wfourcc(s->pb, "mdat");
+ }
+
+ if (track->entry)
+ track->frag_start += duration;
+ track->entry = 0;
+ if (!track->mdat_buf)
+ continue;
+ buf_size = avio_close_dyn_buf(track->mdat_buf, &buf);
+ track->mdat_buf = NULL;
+
+ avio_write(s->pb, buf, buf_size);
+ av_free(buf);
+ }
+
+ mov->mdat_size = 0;
+
+ avio_flush(s->pb);
+ return 0;
+}
+
int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt)
{
MOVMuxContext *mov = s->priv_data;
AVIOContext *pb = s->pb;
MOVTrack *trk = &mov->tracks[pkt->stream_index];
AVCodecContext *enc = trk->enc;
- unsigned int samplesInChunk = 0;
+ unsigned int samples_in_chunk = 0;
int size= pkt->size;
uint8_t *reformatted_data = NULL;
- if (!s->pb->seekable) return 0; /* Can't handle that */
- if (!size) return 0; /* Discard 0 sized packets */
+ if (mov->flags & FF_MOV_FLAG_FRAGMENT) {
+ int ret;
+ if (mov->fragments > 0) {
+ if (!trk->mdat_buf) {
+ if ((ret = avio_open_dyn_buf(&trk->mdat_buf)) < 0)
+ return ret;
+ }
+ pb = trk->mdat_buf;
+ } else {
+ if (!mov->mdat_buf) {
+ if ((ret = avio_open_dyn_buf(&mov->mdat_buf)) < 0)
+ return ret;
+ }
+ pb = mov->mdat_buf;
+ }
+ }
- if (enc->codec_id == CODEC_ID_AMR_NB) {
+ if (enc->codec_id == AV_CODEC_ID_AMR_NB) {
/* We must find out how many AMR blocks there are in one packet */
static uint16_t packed_size[16] =
{13, 14, 16, 18, 20, 21, 27, 32, 6, 0, 0, 0, 0, 0, 0, 1};
int len = 0;
- while (len < size && samplesInChunk < 100) {
+ while (len < size && samples_in_chunk < 100) {
len += packed_size[(pkt->data[len] >> 3) & 0x0F];
- samplesInChunk++;
+ samples_in_chunk++;
}
- if(samplesInChunk > 1){
+ if (samples_in_chunk > 1) {
av_log(s, AV_LOG_ERROR, "fatal error, input is not a single packet, implement a AVParser for it\n");
return -1;
}
- } else if (trk->sampleSize)
- samplesInChunk = size/trk->sampleSize;
+ } else if (trk->sample_size)
+ samples_in_chunk = size / trk->sample_size;
else
- samplesInChunk = 1;
+ samples_in_chunk = 1;
/* copy extradata if it exists */
- if (trk->vosLen == 0 && enc->extradata_size > 0) {
- trk->vosLen = enc->extradata_size;
- trk->vosData = av_malloc(trk->vosLen);
- memcpy(trk->vosData, enc->extradata, trk->vosLen);
+ if (trk->vos_len == 0 && enc->extradata_size > 0) {
+ trk->vos_len = enc->extradata_size;
+ trk->vos_data = av_malloc(trk->vos_len);
+ memcpy(trk->vos_data, enc->extradata, trk->vos_len);
}
- if (enc->codec_id == CODEC_ID_H264 && trk->vosLen > 0 && *(uint8_t *)trk->vosData != 1) {
+ if (enc->codec_id == AV_CODEC_ID_H264 && trk->vos_len > 0 && *(uint8_t *)trk->vos_data != 1) {
/* from x264 or from bytestream h264 */
/* nal reformating needed */
if (trk->hint_track >= 0 && trk->hint_track < mov->nb_streams) {
@@ -2083,14 +2858,14 @@ int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt)
avio_write(pb, pkt->data, size);
}
- if ((enc->codec_id == CODEC_ID_DNXHD ||
- enc->codec_id == CODEC_ID_AC3) && !trk->vosLen) {
+ if ((enc->codec_id == AV_CODEC_ID_DNXHD ||
+ enc->codec_id == AV_CODEC_ID_AC3) && !trk->vos_len) {
/* copy frame to create needed atoms */
- trk->vosLen = size;
- trk->vosData = av_malloc(size);
- if (!trk->vosData)
+ trk->vos_len = size;
+ trk->vos_data = av_malloc(size);
+ if (!trk->vos_data)
return AVERROR(ENOMEM);
- memcpy(trk->vosData, pkt->data, size);
+ memcpy(trk->vos_data, pkt->data, size);
}
if (!(trk->entry % MOV_INDEX_CLUSTER_SIZE)) {
@@ -2100,11 +2875,20 @@ int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt)
}
trk->cluster[trk->entry].pos = avio_tell(pb) - size;
- trk->cluster[trk->entry].samplesInChunk = samplesInChunk;
+ trk->cluster[trk->entry].samples_in_chunk = samples_in_chunk;
trk->cluster[trk->entry].size = size;
- trk->cluster[trk->entry].entries = samplesInChunk;
+ trk->cluster[trk->entry].entries = samples_in_chunk;
trk->cluster[trk->entry].dts = pkt->dts;
- trk->trackDuration = pkt->dts - trk->cluster[0].dts + pkt->duration;
+ if (!trk->entry && trk->start_dts != AV_NOPTS_VALUE) {
+ /* First packet of a new fragment. We already wrote the duration
+ * of the last packet of the previous fragment based on track_duration,
+ * which might not exactly match our dts. Therefore adjust the dts
+ * of this packet to be what the previous packets duration implies. */
+ trk->cluster[trk->entry].dts = trk->start_dts + trk->track_duration;
+ }
+ if (trk->start_dts == AV_NOPTS_VALUE)
+ trk->start_dts = pkt->dts;
+ trk->track_duration = pkt->dts - trk->start_dts + pkt->duration;
if (pkt->pts == AV_NOPTS_VALUE) {
av_log(s, AV_LOG_WARNING, "pts has no value\n");
@@ -2114,8 +2898,10 @@ int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt)
trk->flags |= MOV_TRACK_CTTS;
trk->cluster[trk->entry].cts = pkt->pts - pkt->dts;
trk->cluster[trk->entry].flags = 0;
- if (pkt->flags & AV_PKT_FLAG_KEY) {
- if (mov->mode == MODE_MOV && enc->codec_id == CODEC_ID_MPEG2VIDEO &&
+ if (enc->codec_id == AV_CODEC_ID_VC1) {
+ mov_parse_vc1_frame(pkt, trk, mov->fragments);
+ } else if (pkt->flags & AV_PKT_FLAG_KEY) {
+ if (mov->mode == MODE_MOV && enc->codec_id == AV_CODEC_ID_MPEG2VIDEO &&
trk->entry > 0) { // force sync sample for the first key frame
mov_parse_mpeg2_frame(pkt, &trk->cluster[trk->entry].flags);
if (trk->cluster[trk->entry].flags & MOV_PARTIAL_SYNC_SAMPLE)
@@ -2124,10 +2910,10 @@ int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt)
trk->cluster[trk->entry].flags = MOV_SYNC_SAMPLE;
}
if (trk->cluster[trk->entry].flags & MOV_SYNC_SAMPLE)
- trk->hasKeyframes++;
+ trk->has_keyframes++;
}
trk->entry++;
- trk->sampleCount += samplesInChunk;
+ trk->sample_count += samples_in_chunk;
mov->mdat_size += size;
avio_flush(pb);
@@ -2139,6 +2925,38 @@ int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt)
return 0;
}
+static int mov_write_packet(AVFormatContext *s, AVPacket *pkt)
+{
+ if (!pkt) {
+ mov_flush_fragment(s);
+ return 1;
+ } else {
+ MOVMuxContext *mov = s->priv_data;
+ MOVTrack *trk = &mov->tracks[pkt->stream_index];
+ AVCodecContext *enc = trk->enc;
+ int64_t frag_duration = 0;
+ int size = pkt->size;
+
+ if (!pkt->size) return 0; /* Discard 0 sized packets */
+
+ if (trk->entry)
+ frag_duration = av_rescale_q(pkt->dts - trk->cluster[0].dts,
+ s->streams[pkt->stream_index]->time_base,
+ AV_TIME_BASE_Q);
+ if ((mov->max_fragment_duration &&
+ frag_duration >= mov->max_fragment_duration) ||
+ (mov->max_fragment_size && mov->mdat_size + size >= mov->max_fragment_size) ||
+ (mov->flags & FF_MOV_FLAG_FRAG_KEYFRAME &&
+ enc->codec_type == AVMEDIA_TYPE_VIDEO &&
+ trk->entry && pkt->flags & AV_PKT_FLAG_KEY)) {
+ if (frag_duration >= mov->min_fragment_duration)
+ mov_flush_fragment(s);
+ }
+
+ return ff_mov_write_packet(s, pkt);
+ }
+}
+
// QuickTime chapters involve an additional text track with the chapter names
// as samples, and a tref pointing from the other tracks to the chapter one.
static void mov_create_chapter_track(AVFormatContext *s, int tracknum)
@@ -2181,7 +2999,20 @@ static int mov_write_header(AVFormatContext *s)
AVDictionaryEntry *t;
int i, hint_track = 0;
- if (!s->pb->seekable) {
+ /* Set the FRAGMENT flag if any of the fragmentation methods are
+ * enabled. */
+ if (mov->max_fragment_duration || mov->max_fragment_size ||
+ mov->flags & (FF_MOV_FLAG_EMPTY_MOOV |
+ FF_MOV_FLAG_FRAG_KEYFRAME |
+ FF_MOV_FLAG_FRAG_CUSTOM))
+ mov->flags |= FF_MOV_FLAG_FRAGMENT;
+
+ /* Non-seekable output is ok if using fragmentation. If ism_lookahead
+ * is enabled, we don't support non-seekable output at all. */
+ if (!s->pb->seekable &&
+ ((!(mov->flags & FF_MOV_FLAG_FRAGMENT) &&
+ !(s->oformat && !strcmp(s->oformat->name, "ismv")))
+ || mov->ism_lookahead)) {
av_log(s, AV_LOG_ERROR, "muxer does not support non seekable output\n");
return -1;
}
@@ -2195,6 +3026,7 @@ static int mov_write_header(AVFormatContext *s)
else if (!strcmp("mov", s->oformat->name)) mov->mode = MODE_MOV;
else if (!strcmp("psp", s->oformat->name)) mov->mode = MODE_PSP;
else if (!strcmp("ipod",s->oformat->name)) mov->mode = MODE_IPOD;
+ else if (!strcmp("ismv",s->oformat->name)) mov->mode = MODE_ISM;
mov_write_ftyp_tag(pb,s);
if (mov->mode == MODE_PSP) {
@@ -2210,14 +3042,6 @@ static int mov_write_header(AVFormatContext *s)
if (mov->mode & (MODE_MOV|MODE_IPOD) && s->nb_chapters)
mov->chapter_track = mov->nb_streams++;
-#if FF_API_FLAG_RTP_HINT
- if (s->flags & AVFMT_FLAG_RTP_HINT) {
- av_log(s, AV_LOG_WARNING, "The RTP_HINT flag is deprecated, enable it "
- "via the -movflags rtphint muxer option "
- "instead.\n");
- mov->flags |= FF_MOV_FLAG_RTP_HINT;
- }
-#endif
if (mov->flags & FF_MOV_FLAG_RTP_HINT) {
/* Add hint tracks for each audio and video stream */
hint_track = mov->nb_streams;
@@ -2253,6 +3077,7 @@ static int mov_write_header(AVFormatContext *s)
/* If hinting of this track is enabled by a later hint track,
* this is updated. */
track->hint_track = -1;
+ track->start_dts = AV_NOPTS_VALUE;
if(st->codec->codec_type == AVMEDIA_TYPE_VIDEO){
if (track->tag == MKTAG('m','x','3','p') || track->tag == MKTAG('m','x','3','n') ||
track->tag == MKTAG('m','x','4','p') || track->tag == MKTAG('m','x','4','n') ||
@@ -2271,50 +3096,58 @@ static int mov_write_header(AVFormatContext *s)
"or choose different container.\n");
}else if(st->codec->codec_type == AVMEDIA_TYPE_AUDIO){
track->timescale = st->codec->sample_rate;
- /* set sampleSize for PCM and ADPCM */
- if (av_get_bits_per_sample(st->codec->codec_id)) {
+ /* set sample_size for PCM and ADPCM */
+ if (av_get_bits_per_sample(st->codec->codec_id) ||
+ st->codec->codec_id == AV_CODEC_ID_ILBC) {
if (!st->codec->block_align) {
av_log(s, AV_LOG_ERROR, "track %d: codec block align is not set\n", i);
goto error;
}
- track->sampleSize = st->codec->block_align;
+ track->sample_size = st->codec->block_align;
}
/* set audio_vbr for compressed audio */
if (av_get_bits_per_sample(st->codec->codec_id) < 8) {
- if (!st->codec->frame_size) {
- av_log(s, AV_LOG_ERROR, "track %d: codec frame size is not set\n", i);
- goto error;
- }
track->audio_vbr = 1;
}
- if (track->mode != MODE_MOV) {
- if (track->timescale > UINT16_MAX) {
- av_log(s, AV_LOG_ERROR, "track %d: output format does not support "
- "sample rate %dhz\n", i, track->timescale);
- goto error;
- }
- if (track->enc->codec_id == CODEC_ID_MP3 && track->timescale < 16000) {
- av_log(s, AV_LOG_ERROR, "track %d: muxing mp3 at %dhz is not supported\n",
- i, track->enc->sample_rate);
- goto error;
- }
+ if (track->mode != MODE_MOV &&
+ track->enc->codec_id == AV_CODEC_ID_MP3 && track->timescale < 16000) {
+ av_log(s, AV_LOG_ERROR, "track %d: muxing mp3 at %dhz is not supported\n",
+ i, track->enc->sample_rate);
+ goto error;
}
}else if(st->codec->codec_type == AVMEDIA_TYPE_SUBTITLE){
track->timescale = st->codec->time_base.den;
}
if (!track->height)
track->height = st->codec->height;
+ /* The ism specific timescale isn't mandatory, but is assumed by
+ * some tools, such as mp4split. */
+ if (mov->mode == MODE_ISM)
+ track->timescale = 10000000;
avpriv_set_pts_info(st, 64, 1, track->timescale);
+
+ /* copy extradata if it exists */
+ if (st->codec->extradata_size) {
+ track->vos_len = st->codec->extradata_size;
+ track->vos_data = av_malloc(track->vos_len);
+ memcpy(track->vos_data, st->codec->extradata, track->vos_len);
+ }
}
- mov_write_mdat_tag(pb, mov);
+ if (mov->mode == MODE_ISM) {
+ /* If no fragmentation options have been set, set a default. */
+ if (!(mov->flags & (FF_MOV_FLAG_FRAG_KEYFRAME |
+ FF_MOV_FLAG_FRAG_CUSTOM)) &&
+ !mov->max_fragment_duration && !mov->max_fragment_size)
+ mov->max_fragment_duration = 5000000;
+ mov->flags |= FF_MOV_FLAG_EMPTY_MOOV | FF_MOV_FLAG_SEPARATE_MOOF |
+ FF_MOV_FLAG_FRAGMENT;
+ }
+
+ if (!(mov->flags & FF_MOV_FLAG_FRAGMENT))
+ mov_write_mdat_tag(pb, mov);
-#if FF_API_TIMESTAMP
- if (s->timestamp)
- mov->time = s->timestamp;
- else
-#endif
if (t = av_dict_get(s->metadata, "creation_time", NULL, 0))
mov->time = ff_iso8601_to_unix_time(t->value);
if (mov->time)
@@ -2337,6 +3170,14 @@ static int mov_write_header(AVFormatContext *s)
avio_flush(pb);
+ if (mov->flags & FF_MOV_FLAG_ISML)
+ mov_write_isml_manifest(pb, mov);
+
+ if (mov->flags & FF_MOV_FLAG_EMPTY_MOOV) {
+ mov_write_moov_tag(pb, mov, s);
+ mov->fragments++;
+ }
+
return 0;
error:
av_freep(&mov->tracks);
@@ -2352,20 +3193,27 @@ static int mov_write_trailer(AVFormatContext *s)
int64_t moov_pos = avio_tell(pb);
- /* Write size of mdat tag */
- if (mov->mdat_size+8 <= UINT32_MAX) {
- avio_seek(pb, mov->mdat_pos, SEEK_SET);
- avio_wb32(pb, mov->mdat_size+8);
+ if (!(mov->flags & FF_MOV_FLAG_FRAGMENT)) {
+ /* Write size of mdat tag */
+ if (mov->mdat_size + 8 <= UINT32_MAX) {
+ avio_seek(pb, mov->mdat_pos, SEEK_SET);
+ avio_wb32(pb, mov->mdat_size + 8);
+ } else {
+ /* overwrite 'wide' placeholder atom */
+ avio_seek(pb, mov->mdat_pos - 8, SEEK_SET);
+ /* special value: real atom size will be 64 bit value after
+ * tag field */
+ avio_wb32(pb, 1);
+ ffio_wfourcc(pb, "mdat");
+ avio_wb64(pb, mov->mdat_size + 16);
+ }
+ avio_seek(pb, moov_pos, SEEK_SET);
+
+ mov_write_moov_tag(pb, mov, s);
} else {
- /* overwrite 'wide' placeholder atom */
- avio_seek(pb, mov->mdat_pos - 8, SEEK_SET);
- avio_wb32(pb, 1); /* special value: real atom size will be 64 bit value after tag field */
- ffio_wfourcc(pb, "mdat");
- avio_wb64(pb, mov->mdat_size+16);
+ mov_flush_fragment(s);
+ mov_write_mfra_tag(pb, mov);
}
- avio_seek(pb, moov_pos, SEEK_SET);
-
- mov_write_moov_tag(pb, mov, s);
if (mov->chapter_track)
av_freep(&mov->tracks[mov->chapter_track].enc);
@@ -2373,14 +3221,24 @@ static int mov_write_trailer(AVFormatContext *s)
for (i=0; i<mov->nb_streams; i++) {
if (mov->tracks[i].tag == MKTAG('r','t','p',' '))
ff_mov_close_hinting(&mov->tracks[i]);
+ if (mov->flags & FF_MOV_FLAG_FRAGMENT &&
+ mov->tracks[i].vc1_info.struct_offset && s->pb->seekable) {
+ int64_t off = avio_tell(pb);
+ uint8_t buf[7];
+ if (mov_write_dvc1_structs(&mov->tracks[i], buf) >= 0) {
+ avio_seek(pb, mov->tracks[i].vc1_info.struct_offset, SEEK_SET);
+ avio_write(pb, buf, 7);
+ avio_seek(pb, off, SEEK_SET);
+ }
+ }
av_freep(&mov->tracks[i].cluster);
+ av_freep(&mov->tracks[i].frag_info);
- if(mov->tracks[i].vosLen) av_free(mov->tracks[i].vosData);
+ if (mov->tracks[i].vos_len)
+ av_free(mov->tracks[i].vos_data);
}
- avio_flush(pb);
-
av_freep(&mov->tracks);
return res;
@@ -2390,115 +3248,126 @@ static int mov_write_trailer(AVFormatContext *s)
MOV_CLASS(mov)
AVOutputFormat ff_mov_muxer = {
.name = "mov",
- .long_name = NULL_IF_CONFIG_SMALL("MOV format"),
+ .long_name = NULL_IF_CONFIG_SMALL("QuickTime / MOV"),
.extensions = "mov",
.priv_data_size = sizeof(MOVMuxContext),
- .audio_codec = CODEC_ID_AAC,
-#if CONFIG_LIBX264_ENCODER
- .video_codec = CODEC_ID_H264,
-#else
- .video_codec = CODEC_ID_MPEG4,
-#endif
+ .audio_codec = AV_CODEC_ID_AAC,
+ .video_codec = CONFIG_LIBX264_ENCODER ?
+ AV_CODEC_ID_H264 : AV_CODEC_ID_MPEG4,
.write_header = mov_write_header,
- .write_packet = ff_mov_write_packet,
+ .write_packet = mov_write_packet,
.write_trailer = mov_write_trailer,
- .flags = AVFMT_GLOBALHEADER,
- .codec_tag = (const AVCodecTag* const []){codec_movvideo_tags, codec_movaudio_tags, 0},
- .priv_class = &mov_muxer_class,
+ .flags = AVFMT_GLOBALHEADER | AVFMT_ALLOW_FLUSH,
+ .codec_tag = (const AVCodecTag* const []){
+ ff_codec_movvideo_tags, ff_codec_movaudio_tags, 0
+ },
+ .priv_class = &mov_muxer_class,
};
#endif
#if CONFIG_TGP_MUXER
MOV_CLASS(tgp)
AVOutputFormat ff_tgp_muxer = {
.name = "3gp",
- .long_name = NULL_IF_CONFIG_SMALL("3GP format"),
+ .long_name = NULL_IF_CONFIG_SMALL("3GP (3GPP file format)"),
.extensions = "3gp",
.priv_data_size = sizeof(MOVMuxContext),
- .audio_codec = CODEC_ID_AMR_NB,
- .video_codec = CODEC_ID_H263,
+ .audio_codec = AV_CODEC_ID_AMR_NB,
+ .video_codec = AV_CODEC_ID_H263,
.write_header = mov_write_header,
- .write_packet = ff_mov_write_packet,
+ .write_packet = mov_write_packet,
.write_trailer = mov_write_trailer,
- .flags = AVFMT_GLOBALHEADER,
- .codec_tag = (const AVCodecTag* const []){codec_3gp_tags, 0},
- .priv_class = &tgp_muxer_class,
+ .flags = AVFMT_GLOBALHEADER | AVFMT_ALLOW_FLUSH,
+ .codec_tag = (const AVCodecTag* const []){ codec_3gp_tags, 0 },
+ .priv_class = &tgp_muxer_class,
};
#endif
#if CONFIG_MP4_MUXER
MOV_CLASS(mp4)
AVOutputFormat ff_mp4_muxer = {
.name = "mp4",
- .long_name = NULL_IF_CONFIG_SMALL("MP4 format"),
+ .long_name = NULL_IF_CONFIG_SMALL("MP4 (MPEG-4 Part 14)"),
.mime_type = "application/mp4",
.extensions = "mp4",
.priv_data_size = sizeof(MOVMuxContext),
- .audio_codec = CODEC_ID_AAC,
-#if CONFIG_LIBX264_ENCODER
- .video_codec = CODEC_ID_H264,
-#else
- .video_codec = CODEC_ID_MPEG4,
-#endif
+ .audio_codec = AV_CODEC_ID_AAC,
+ .video_codec = CONFIG_LIBX264_ENCODER ?
+ AV_CODEC_ID_H264 : AV_CODEC_ID_MPEG4,
.write_header = mov_write_header,
- .write_packet = ff_mov_write_packet,
+ .write_packet = mov_write_packet,
.write_trailer = mov_write_trailer,
- .flags = AVFMT_GLOBALHEADER,
- .codec_tag = (const AVCodecTag* const []){ff_mp4_obj_type, 0},
- .priv_class = &mp4_muxer_class,
+ .flags = AVFMT_GLOBALHEADER | AVFMT_ALLOW_FLUSH,
+ .codec_tag = (const AVCodecTag* const []){ ff_mp4_obj_type, 0 },
+ .priv_class = &mp4_muxer_class,
};
#endif
#if CONFIG_PSP_MUXER
MOV_CLASS(psp)
AVOutputFormat ff_psp_muxer = {
.name = "psp",
- .long_name = NULL_IF_CONFIG_SMALL("PSP MP4 format"),
+ .long_name = NULL_IF_CONFIG_SMALL("PSP MP4 (MPEG-4 Part 14)"),
.extensions = "mp4,psp",
.priv_data_size = sizeof(MOVMuxContext),
- .audio_codec = CODEC_ID_AAC,
-#if CONFIG_LIBX264_ENCODER
- .video_codec = CODEC_ID_H264,
-#else
- .video_codec = CODEC_ID_MPEG4,
-#endif
+ .audio_codec = AV_CODEC_ID_AAC,
+ .video_codec = CONFIG_LIBX264_ENCODER ?
+ AV_CODEC_ID_H264 : AV_CODEC_ID_MPEG4,
.write_header = mov_write_header,
- .write_packet = ff_mov_write_packet,
+ .write_packet = mov_write_packet,
.write_trailer = mov_write_trailer,
- .flags = AVFMT_GLOBALHEADER,
- .codec_tag = (const AVCodecTag* const []){ff_mp4_obj_type, 0},
- .priv_class = &psp_muxer_class,
+ .flags = AVFMT_GLOBALHEADER | AVFMT_ALLOW_FLUSH,
+ .codec_tag = (const AVCodecTag* const []){ ff_mp4_obj_type, 0 },
+ .priv_class = &psp_muxer_class,
};
#endif
#if CONFIG_TG2_MUXER
MOV_CLASS(tg2)
AVOutputFormat ff_tg2_muxer = {
.name = "3g2",
- .long_name = NULL_IF_CONFIG_SMALL("3GP2 format"),
+ .long_name = NULL_IF_CONFIG_SMALL("3GP2 (3GPP2 file format)"),
.extensions = "3g2",
.priv_data_size = sizeof(MOVMuxContext),
- .audio_codec = CODEC_ID_AMR_NB,
- .video_codec = CODEC_ID_H263,
+ .audio_codec = AV_CODEC_ID_AMR_NB,
+ .video_codec = AV_CODEC_ID_H263,
.write_header = mov_write_header,
- .write_packet = ff_mov_write_packet,
+ .write_packet = mov_write_packet,
.write_trailer = mov_write_trailer,
- .flags = AVFMT_GLOBALHEADER,
- .codec_tag = (const AVCodecTag* const []){codec_3gp_tags, 0},
- .priv_class = &tg2_muxer_class,
+ .flags = AVFMT_GLOBALHEADER | AVFMT_ALLOW_FLUSH,
+ .codec_tag = (const AVCodecTag* const []){ codec_3gp_tags, 0 },
+ .priv_class = &tg2_muxer_class,
};
#endif
#if CONFIG_IPOD_MUXER
MOV_CLASS(ipod)
AVOutputFormat ff_ipod_muxer = {
.name = "ipod",
- .long_name = NULL_IF_CONFIG_SMALL("iPod H.264 MP4 format"),
+ .long_name = NULL_IF_CONFIG_SMALL("iPod H.264 MP4 (MPEG-4 Part 14)"),
.mime_type = "application/mp4",
.extensions = "m4v,m4a",
.priv_data_size = sizeof(MOVMuxContext),
- .audio_codec = CODEC_ID_AAC,
- .video_codec = CODEC_ID_H264,
+ .audio_codec = AV_CODEC_ID_AAC,
+ .video_codec = AV_CODEC_ID_H264,
+ .write_header = mov_write_header,
+ .write_packet = mov_write_packet,
+ .write_trailer = mov_write_trailer,
+ .flags = AVFMT_GLOBALHEADER | AVFMT_ALLOW_FLUSH,
+ .codec_tag = (const AVCodecTag* const []){ codec_ipod_tags, 0 },
+ .priv_class = &ipod_muxer_class,
+};
+#endif
+#if CONFIG_ISMV_MUXER
+MOV_CLASS(ismv)
+AVOutputFormat ff_ismv_muxer = {
+ .name = "ismv",
+ .long_name = NULL_IF_CONFIG_SMALL("ISMV/ISMA (Smooth Streaming)"),
+ .mime_type = "application/mp4",
+ .extensions = "ismv,isma",
+ .priv_data_size = sizeof(MOVMuxContext),
+ .audio_codec = AV_CODEC_ID_AAC,
+ .video_codec = AV_CODEC_ID_H264,
.write_header = mov_write_header,
- .write_packet = ff_mov_write_packet,
+ .write_packet = mov_write_packet,
.write_trailer = mov_write_trailer,
- .flags = AVFMT_GLOBALHEADER,
- .codec_tag = (const AVCodecTag* const []){codec_ipod_tags, 0},
- .priv_class = &ipod_muxer_class,
+ .flags = AVFMT_GLOBALHEADER | AVFMT_ALLOW_FLUSH,
+ .codec_tag = (const AVCodecTag* const []){ ff_mp4_obj_type, 0 },
+ .priv_class = &ismv_muxer_class,
};
#endif
diff --git a/gst-libs/ext/libav/libavformat/movenc.h b/gst-libs/ext/libav/libavformat/movenc.h
index 5595ac7..e20ef14 100644
--- a/gst-libs/ext/libav/libavformat/movenc.h
+++ b/gst-libs/ext/libav/libavformat/movenc.h
@@ -38,12 +38,13 @@
// avconv -i testinput.avi -f psp -r 14.985 -s 320x240 -b 768 -ar 24000 -ab 32 M4V00001.MP4
#define MODE_3G2 0x10
#define MODE_IPOD 0x20
+#define MODE_ISM 0x40
typedef struct MOVIentry {
uint64_t pos;
int64_t dts;
unsigned int size;
- unsigned int samplesInChunk;
+ unsigned int samples_in_chunk;
unsigned int entries;
int cts;
#define MOV_SYNC_SAMPLE 0x0001
@@ -59,36 +60,44 @@ typedef struct HintSample {
int own_data;
} HintSample;
-typedef struct {
+typedef struct HintSampleQueue {
int size;
int len;
HintSample *samples;
} HintSampleQueue;
+typedef struct MOVFragmentInfo {
+ int64_t offset;
+ int64_t time;
+ int64_t duration;
+ int64_t tfrf_offset;
+} MOVFragmentInfo;
+
typedef struct MOVIndex {
int mode;
int entry;
unsigned timescale;
uint64_t time;
- int64_t trackDuration;
- long sampleCount;
- long sampleSize;
- int hasKeyframes;
+ int64_t track_duration;
+ long sample_count;
+ long sample_size;
+ int has_keyframes;
#define MOV_TRACK_CTTS 0x0001
#define MOV_TRACK_STPS 0x0002
uint32_t flags;
int language;
- int trackID;
+ int track_id;
int tag; ///< stsd fourcc
AVCodecContext *enc;
- int vosLen;
- uint8_t *vosData;
+ int vos_len;
+ uint8_t *vos_data;
MOVIentry *cluster;
int audio_vbr;
int height; ///< active picture (w/o VBI) height for D-10/IMX
uint32_t tref_tag;
int tref_id; ///< trackID of the referenced track
+ int64_t start_dts;
int hint_track; ///< the track that hints this track, -1 if no hint track is set
int src_track; ///< the track that this hint track describes
@@ -97,7 +106,29 @@ typedef struct MOVIndex {
int64_t cur_rtp_ts_unwrapped;
uint32_t max_packet_size;
+ int64_t default_duration;
+ uint32_t default_sample_flags;
+ uint32_t default_size;
+
HintSampleQueue sample_queue;
+
+ AVIOContext *mdat_buf;
+ int64_t moof_size_offset;
+ int64_t data_offset;
+ int64_t frag_start;
+ int64_t tfrf_offset;
+
+ int nb_frag_info;
+ MOVFragmentInfo *frag_info;
+
+ struct {
+ int64_t struct_offset;
+ int first_packet_seq;
+ int first_packet_entry;
+ int packet_seq;
+ int packet_entry;
+ int slices;
+ } vc1_info;
} MOVTrack;
typedef struct MOVMuxContext {
@@ -115,9 +146,22 @@ typedef struct MOVMuxContext {
int iods_skip;
int iods_video_profile;
int iods_audio_profile;
+
+ int fragments;
+ int max_fragment_duration;
+ int min_fragment_duration;
+ int max_fragment_size;
+ int ism_lookahead;
+ AVIOContext *mdat_buf;
} MOVMuxContext;
#define FF_MOV_FLAG_RTP_HINT 1
+#define FF_MOV_FLAG_FRAGMENT 2
+#define FF_MOV_FLAG_EMPTY_MOOV 4
+#define FF_MOV_FLAG_FRAG_KEYFRAME 8
+#define FF_MOV_FLAG_SEPARATE_MOOF 16
+#define FF_MOV_FLAG_FRAG_CUSTOM 32
+#define FF_MOV_FLAG_ISML 64
int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt);
diff --git a/gst-libs/ext/libav/libavformat/movenchint.c b/gst-libs/ext/libav/libavformat/movenchint.c
index 9f5e621..02391b5 100644
--- a/gst-libs/ext/libav/libavformat/movenchint.c
+++ b/gst-libs/ext/libav/libavformat/movenchint.c
@@ -24,6 +24,7 @@
#include "internal.h"
#include "rtpenc_chain.h"
#include "avio_internal.h"
+#include "rtp.h"
int ff_mov_init_hinting(AVFormatContext *s, int index, int src_index)
{
@@ -42,9 +43,9 @@ int ff_mov_init_hinting(AVFormatContext *s, int index, int src_index)
track->enc->codec_type = AVMEDIA_TYPE_DATA;
track->enc->codec_tag = track->tag;
- track->rtp_ctx = ff_rtp_chain_mux_open(s, src_st, NULL,
- RTP_MAX_PACKET_SIZE);
- if (!track->rtp_ctx)
+ ret = ff_rtp_chain_mux_open(&track->rtp_ctx, s, src_st, NULL,
+ RTP_MAX_PACKET_SIZE, src_index);
+ if (ret < 0)
goto fail;
/* Copy the RTP AVStream timebase back to the hint AVStream */
@@ -332,7 +333,7 @@ static int write_hint_packets(AVIOContext *out, const uint8_t *data,
size -= 4;
if (packet_len > size || packet_len <= 12)
break;
- if (data[1] >= 200 && data[1] <= 204) {
+ if (RTP_PT_IS_RTCP(data[1])) {
/* RTCP packet, just skip */
data += packet_len;
size -= packet_len;
@@ -459,4 +460,3 @@ void ff_mov_close_hinting(MOVTrack *track) {
}
avformat_free_context(rtp_ctx);
}
-
diff --git a/gst-libs/ext/libav/libavformat/mp3dec.c b/gst-libs/ext/libav/libavformat/mp3dec.c
index 185d7b8..9da9aa8 100644
--- a/gst-libs/ext/libav/libavformat/mp3dec.c
+++ b/gst-libs/ext/libav/libavformat/mp3dec.c
@@ -29,6 +29,16 @@
#include "id3v1.h"
#include "libavcodec/mpegaudiodecheader.h"
+#define XING_FLAG_FRAMES 0x01
+#define XING_FLAG_SIZE 0x02
+#define XING_FLAG_TOC 0x04
+
+#define XING_TOC_COUNT 100
+
+typedef struct MP3DecContext {
+ int xing_toc;
+} MP3DecContext;
+
/* mp3 read */
static int mp3_read_probe(AVProbeData *p)
@@ -63,14 +73,56 @@ static int mp3_read_probe(AVProbeData *p)
}
// keep this in sync with ac3 probe, both need to avoid
// issues with MPEG-files!
- if (first_frames>=4) return AVPROBE_SCORE_MAX/2+1;
- else if(max_frames>500)return AVPROBE_SCORE_MAX/2;
- else if(max_frames>=4) return AVPROBE_SCORE_MAX/4;
- else if(max_frames>=1) return 1;
- else return 0;
+ if (first_frames >= 4) return AVPROBE_SCORE_MAX / 2 + 1;
+
+ if (max_frames) {
+ int pes = 0, i;
+ unsigned int code = -1;
+
+#define VIDEO_ID 0x000001e0
+#define AUDIO_ID 0x000001c0
+ /* do a search for mpegps headers to be able to properly bias
+ * towards mpegps if we detect this stream as both. */
+ for (i = 0; i<p->buf_size; i++) {
+ code = (code << 8) + p->buf[i];
+ if ((code & 0xffffff00) == 0x100) {
+ if ((code & 0x1f0) == VIDEO_ID) pes++;
+ else if((code & 0x1e0) == AUDIO_ID) pes++;
+ }
+ }
+
+ if (pes)
+ max_frames = (max_frames + pes - 1) / pes;
+ }
+ if (max_frames > 500) return AVPROBE_SCORE_MAX / 2;
+ else if (max_frames >= 4) return AVPROBE_SCORE_MAX / 4;
+ else if (max_frames >= 1) return 1;
+ else return 0;
//mpegps_mp3_unrecognized_format.mpg has max_frames=3
}
+static void read_xing_toc(AVFormatContext *s, int64_t filesize, int64_t duration)
+{
+ int i;
+ MP3DecContext *mp3 = s->priv_data;
+
+ if (!filesize &&
+ !(filesize = avio_size(s->pb))) {
+ av_log(s, AV_LOG_WARNING, "Cannot determine file size, skipping TOC table.\n");
+ return;
+ }
+
+ for (i = 0; i < XING_TOC_COUNT; i++) {
+ uint8_t b = avio_r8(s->pb);
+
+ av_add_index_entry(s->streams[0],
+ av_rescale(b, filesize, 256),
+ av_rescale(i, duration, XING_TOC_COUNT),
+ 0, 0, AVINDEX_KEYFRAME);
+ }
+ mp3->xing_toc = 1;
+}
+
/**
* Try to find Xing/Info/VBRI tags and compute duration from info therein
*/
@@ -82,6 +134,7 @@ static int mp3_parse_vbr_tags(AVFormatContext *s, AVStream *st, int64_t base)
const int64_t xing_offtbl[2][2] = {{32, 17}, {17,9}};
MPADecodeHeader c;
int vbrtag_size = 0;
+ int is_cbr;
v = avio_rb32(s->pb);
if(ff_mpa_check_header(v) < 0)
@@ -92,15 +145,21 @@ static int mp3_parse_vbr_tags(AVFormatContext *s, AVStream *st, int64_t base)
if(c.layer != 3)
return -1;
+ spf = c.lsf ? 576 : 1152; /* Samples per frame, layer 3 */
+
/* Check for Xing / Info tag */
avio_skip(s->pb, xing_offtbl[c.lsf == 1][c.nb_channels == 1]);
v = avio_rb32(s->pb);
- if(v == MKBETAG('X', 'i', 'n', 'g') || v == MKBETAG('I', 'n', 'f', 'o')) {
+ is_cbr = v == MKBETAG('I', 'n', 'f', 'o');
+ if (v == MKBETAG('X', 'i', 'n', 'g') || is_cbr) {
v = avio_rb32(s->pb);
- if(v & 0x1)
+ if(v & XING_FLAG_FRAMES)
frames = avio_rb32(s->pb);
- if(v & 0x2)
+ if(v & XING_FLAG_SIZE)
size = avio_rb32(s->pb);
+ if (v & XING_FLAG_TOC && frames)
+ read_xing_toc(s, size, av_rescale_q(frames, (AVRational){spf, c.sample_rate},
+ st->time_base));
}
/* Check for VBRI tag (always 32 bytes after end of mpegaudio header) */
@@ -111,8 +170,8 @@ static int mp3_parse_vbr_tags(AVFormatContext *s, AVStream *st, int64_t base)
if(avio_rb16(s->pb) == 1) {
/* skip delay and quality */
avio_skip(s->pb, 4);
- frames = avio_rb32(s->pb);
size = avio_rb32(s->pb);
+ frames = avio_rb32(s->pb);
}
}
@@ -122,18 +181,16 @@ static int mp3_parse_vbr_tags(AVFormatContext *s, AVStream *st, int64_t base)
/* Skip the vbr tag frame */
avio_seek(s->pb, base + vbrtag_size, SEEK_SET);
- spf = c.lsf ? 576 : 1152; /* Samples per frame, layer 3 */
if(frames)
st->duration = av_rescale_q(frames, (AVRational){spf, c.sample_rate},
st->time_base);
- if(size && frames)
+ if (size && frames && !is_cbr)
st->codec->bit_rate = av_rescale(size, 8 * c.sample_rate, frames * (int64_t)spf);
return 0;
}
-static int mp3_read_header(AVFormatContext *s,
- AVFormatParameters *ap)
+static int mp3_read_header(AVFormatContext *s)
{
AVStream *st;
int64_t off;
@@ -143,7 +200,7 @@ static int mp3_read_header(AVFormatContext *s,
return AVERROR(ENOMEM);
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
- st->codec->codec_id = CODEC_ID_MP3;
+ st->codec->codec_id = AV_CODEC_ID_MP3;
st->need_parsing = AVSTREAM_PARSE_FULL;
st->start_time = 0;
@@ -166,17 +223,13 @@ static int mp3_read_header(AVFormatContext *s,
static int mp3_read_packet(AVFormatContext *s, AVPacket *pkt)
{
- int ret, size;
- // AVStream *st = s->streams[0];
-
- size= MP3_PACKET_SIZE;
+ int ret;
- ret= av_get_packet(s->pb, pkt, size);
+ ret = av_get_packet(s->pb, pkt, MP3_PACKET_SIZE);
+ if (ret < 0)
+ return ret;
pkt->stream_index = 0;
- if (ret <= 0) {
- return AVERROR(EIO);
- }
if (ret > ID3v1_TAG_SIZE &&
memcmp(&pkt->data[ret - ID3v1_TAG_SIZE], "TAG", 3) == 0)
@@ -188,12 +241,46 @@ static int mp3_read_packet(AVFormatContext *s, AVPacket *pkt)
return ret;
}
+static int mp3_seek(AVFormatContext *s, int stream_index, int64_t timestamp,
+ int flags)
+{
+ MP3DecContext *mp3 = s->priv_data;
+ AVIndexEntry *ie;
+ AVStream *st = s->streams[0];
+ int64_t ret = av_index_search_timestamp(st, timestamp, flags);
+ uint32_t header = 0;
+
+ if (!mp3->xing_toc)
+ return AVERROR(ENOSYS);
+
+ if (ret < 0)
+ return ret;
+
+ ie = &st->index_entries[ret];
+ ret = avio_seek(s->pb, ie->pos, SEEK_SET);
+ if (ret < 0)
+ return ret;
+
+ while (!s->pb->eof_reached) {
+ header = (header << 8) + avio_r8(s->pb);
+ if (ff_mpa_check_header(header) >= 0) {
+ ff_update_cur_dts(s, st, ie->timestamp);
+ ret = avio_seek(s->pb, -4, SEEK_CUR);
+ return (ret >= 0) ? 0 : ret;
+ }
+ }
+
+ return AVERROR_EOF;
+}
+
AVInputFormat ff_mp3_demuxer = {
.name = "mp3",
- .long_name = NULL_IF_CONFIG_SMALL("MPEG audio layer 2/3"),
+ .long_name = NULL_IF_CONFIG_SMALL("MP2/3 (MPEG audio layer 2/3)"),
.read_probe = mp3_read_probe,
.read_header = mp3_read_header,
.read_packet = mp3_read_packet,
- .flags= AVFMT_GENERIC_INDEX,
- .extensions = "mp2,mp3,m2a", /* XXX: use probe */
+ .read_seek = mp3_seek,
+ .priv_data_size = sizeof(MP3DecContext),
+ .flags = AVFMT_GENERIC_INDEX,
+ .extensions = "mp2,mp3,m2a", /* XXX: use probe */
};
diff --git a/gst-libs/ext/libav/libavformat/mp3enc.c b/gst-libs/ext/libav/libavformat/mp3enc.c
index ce547ea..c969777 100644
--- a/gst-libs/ext/libav/libavformat/mp3enc.c
+++ b/gst-libs/ext/libav/libavformat/mp3enc.c
@@ -31,6 +31,7 @@
#include "libavutil/intreadwrite.h"
#include "libavutil/opt.h"
#include "libavutil/dict.h"
+#include "libavutil/avassert.h"
static int id3v1_set_string(AVFormatContext *s, const char *key,
uint8_t *buf, int buf_size)
@@ -73,31 +74,229 @@ static int id3v1_create_tag(AVFormatContext *s, uint8_t *buf)
return count;
}
+#define XING_NUM_BAGS 400
+#define XING_TOC_SIZE 100
+// maximum size of the xing frame: offset/Xing/flags/frames/size/TOC
+#define XING_MAX_SIZE (32 + 4 + 4 + 4 + 4 + XING_TOC_SIZE)
+
typedef struct MP3Context {
const AVClass *class;
+ ID3v2EncContext id3;
int id3v2_version;
int write_id3v1;
- int64_t nb_frames_offset;
+
+ /* xing header */
+ int64_t xing_offset;
+ int32_t frames;
+ int32_t size;
+ uint32_t want;
+ uint32_t seen;
+ uint32_t pos;
+ uint64_t bag[XING_NUM_BAGS];
+ int initial_bitrate;
+ int has_variable_bitrate;
+
+ /* index of the audio stream */
+ int audio_stream_idx;
+ /* number of attached pictures we still need to write */
+ int pics_to_write;
+
+ /* audio packets are queued here until we get all the attached pictures */
+ AVPacketList *queue, *queue_end;
} MP3Context;
+static const uint8_t xing_offtbl[2][2] = {{32, 17}, {17, 9}};
+
+/*
+ * Write an empty XING header and initialize respective data.
+ */
+static void mp3_write_xing(AVFormatContext *s)
+{
+ MP3Context *mp3 = s->priv_data;
+ AVCodecContext *codec = s->streams[mp3->audio_stream_idx]->codec;
+ int32_t header;
+ MPADecodeHeader mpah;
+ int srate_idx, i, channels;
+ int bitrate_idx;
+ int xing_offset;
+ int ver = 0;
+
+ if (!s->pb->seekable)
+ return;
+
+ for (i = 0; i < FF_ARRAY_ELEMS(avpriv_mpa_freq_tab); i++) {
+ const uint16_t base_freq = avpriv_mpa_freq_tab[i];
+
+ if (codec->sample_rate == base_freq) ver = 0x3; // MPEG 1
+ else if (codec->sample_rate == base_freq / 2) ver = 0x2; // MPEG 2
+ else if (codec->sample_rate == base_freq / 4) ver = 0x0; // MPEG 2.5
+ else continue;
+
+ srate_idx = i;
+ break;
+ }
+ if (i == FF_ARRAY_ELEMS(avpriv_mpa_freq_tab)) {
+ av_log(s, AV_LOG_WARNING, "Unsupported sample rate, not writing Xing "
+ "header.\n");
+ return;
+ }
+
+ switch (codec->channels) {
+ case 1: channels = MPA_MONO; break;
+ case 2: channels = MPA_STEREO; break;
+ default: av_log(s, AV_LOG_WARNING, "Unsupported number of channels, "
+ "not writing Xing header.\n");
+ return;
+ }
+
+ /* 64 kbps frame, should be large enough */
+ bitrate_idx = (ver == 3) ? 5 : 8;
+
+ /* dummy MPEG audio header */
+ header = 0xff << 24; // sync
+ header |= (0x7 << 5 | ver << 3 | 0x1 << 1 | 0x1) << 16; // sync/audio-version/layer 3/no crc*/
+ header |= (bitrate_idx << 4 | srate_idx << 2) << 8;
+ header |= channels << 6;
+ avio_wb32(s->pb, header);
+
+ avpriv_mpegaudio_decode_header(&mpah, header);
+
+ av_assert0(mpah.frame_size >= XING_MAX_SIZE);
+
+ xing_offset = xing_offtbl[ver != 3][codec->channels == 1];
+ ffio_fill(s->pb, 0, xing_offset);
+ mp3->xing_offset = avio_tell(s->pb);
+ ffio_wfourcc(s->pb, "Xing");
+ avio_wb32(s->pb, 0x01 | 0x02 | 0x04); // frames / size / TOC
+
+ mp3->size = mpah.frame_size;
+ mp3->want = 1;
+
+ avio_wb32(s->pb, 0); // frames
+ avio_wb32(s->pb, 0); // size
+
+ // TOC
+ for (i = 0; i < XING_TOC_SIZE; i++)
+ avio_w8(s->pb, 255 * i / XING_TOC_SIZE);
+
+ mpah.frame_size -= 4 + xing_offset + 4 + 4 + 4 + 4 + XING_TOC_SIZE;
+ ffio_fill(s->pb, 0, mpah.frame_size);
+}
+
+/*
+ * Add a frame to XING data.
+ * Following lame's "VbrTag.c".
+ */
+static void mp3_xing_add_frame(MP3Context *mp3, AVPacket *pkt)
+{
+ int i;
+
+ mp3->frames++;
+ mp3->seen++;
+ mp3->size += pkt->size;
+
+ if (mp3->want == mp3->seen) {
+ mp3->bag[mp3->pos] = mp3->size;
+
+ if (XING_NUM_BAGS == ++mp3->pos) {
+ /* shrink table to half size by throwing away each second bag. */
+ for (i = 1; i < XING_NUM_BAGS; i += 2)
+ mp3->bag[i / 2] = mp3->bag[i];
+
+ /* double wanted amount per bag. */
+ mp3->want *= 2;
+ /* adjust current position to half of table size. */
+ mp3->pos = XING_NUM_BAGS / 2;
+ }
+
+ mp3->seen = 0;
+ }
+}
+
+static int mp3_write_audio_packet(AVFormatContext *s, AVPacket *pkt)
+{
+ MP3Context *mp3 = s->priv_data;
+
+ if (mp3->xing_offset && pkt->size >= 4) {
+ MPADecodeHeader c;
+
+ avpriv_mpegaudio_decode_header(&c, AV_RB32(pkt->data));
+
+ if (!mp3->initial_bitrate)
+ mp3->initial_bitrate = c.bit_rate;
+ if ((c.bit_rate == 0) || (mp3->initial_bitrate != c.bit_rate))
+ mp3->has_variable_bitrate = 1;
+
+ mp3_xing_add_frame(mp3, pkt);
+ }
+
+ return ff_raw_write_packet(s, pkt);
+}
+
+static int mp3_queue_flush(AVFormatContext *s)
+{
+ MP3Context *mp3 = s->priv_data;
+ AVPacketList *pktl;
+ int ret = 0, write = 1;
+
+ ff_id3v2_finish(&mp3->id3, s->pb);
+ mp3_write_xing(s);
+
+ while ((pktl = mp3->queue)) {
+ if (write && (ret = mp3_write_audio_packet(s, &pktl->pkt)) < 0)
+ write = 0;
+ av_free_packet(&pktl->pkt);
+ mp3->queue = pktl->next;
+ av_freep(&pktl);
+ }
+ mp3->queue_end = NULL;
+ return ret;
+}
+
+static void mp3_update_xing(AVFormatContext *s)
+{
+ MP3Context *mp3 = s->priv_data;
+ int i;
+
+ /* replace "Xing" identification string with "Info" for CBR files. */
+ if (!mp3->has_variable_bitrate) {
+ avio_seek(s->pb, mp3->xing_offset, SEEK_SET);
+ ffio_wfourcc(s->pb, "Info");
+ }
+
+ avio_seek(s->pb, mp3->xing_offset + 8, SEEK_SET);
+ avio_wb32(s->pb, mp3->frames);
+ avio_wb32(s->pb, mp3->size);
+
+ avio_w8(s->pb, 0); // first toc entry has to be zero.
+
+ for (i = 1; i < XING_TOC_SIZE; ++i) {
+ int j = i * mp3->pos / XING_TOC_SIZE;
+ int seek_point = 256LL * mp3->bag[j] / mp3->size;
+ avio_w8(s->pb, FFMIN(seek_point, 255));
+ }
+
+ avio_seek(s->pb, 0, SEEK_END);
+}
+
static int mp3_write_trailer(struct AVFormatContext *s)
{
uint8_t buf[ID3v1_TAG_SIZE];
MP3Context *mp3 = s->priv_data;
- /* write the id3v1 tag */
- if (mp3 && mp3->write_id3v1 && id3v1_create_tag(s, buf) > 0) {
- avio_write(s->pb, buf, ID3v1_TAG_SIZE);
+ if (mp3->pics_to_write) {
+ av_log(s, AV_LOG_WARNING, "No packets were sent for some of the "
+ "attached pictures.\n");
+ mp3_queue_flush(s);
}
- /* write number of frames */
- if (mp3 && mp3->nb_frames_offset) {
- avio_seek(s->pb, mp3->nb_frames_offset, SEEK_SET);
- avio_wb32(s->pb, s->streams[0]->nb_frames);
- avio_seek(s->pb, 0, SEEK_END);
+ /* write the id3v1 tag */
+ if (mp3->write_id3v1 && id3v1_create_tag(s, buf) > 0) {
+ avio_write(s->pb, buf, ID3v1_TAG_SIZE);
}
- avio_flush(s->pb);
+ if (mp3->xing_offset)
+ mp3_update_xing(s);
return 0;
}
@@ -105,13 +304,13 @@ static int mp3_write_trailer(struct AVFormatContext *s)
#if CONFIG_MP2_MUXER
AVOutputFormat ff_mp2_muxer = {
.name = "mp2",
- .long_name = NULL_IF_CONFIG_SMALL("MPEG audio layer 2"),
+ .long_name = NULL_IF_CONFIG_SMALL("MP2 (MPEG audio layer 2)"),
.mime_type = "audio/x-mpeg",
.extensions = "mp2,m2a",
- .audio_codec = CODEC_ID_MP2,
- .video_codec = CODEC_ID_NONE,
+ .audio_codec = AV_CODEC_ID_MP2,
+ .video_codec = AV_CODEC_ID_NONE,
.write_packet = ff_raw_write_packet,
- .write_trailer = mp3_write_trailer,
+ .flags = AVFMT_NOTIMESTAMPS,
};
#endif
@@ -119,9 +318,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), AV_OPT_TYPE_INT, {.dbl = 4}, 3, 4, AV_OPT_FLAG_ENCODING_PARAM},
+ offsetof(MP3Context, id3v2_version), AV_OPT_TYPE_INT, {.i64 = 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), AV_OPT_TYPE_INT, {.dbl = 0}, 0, 1, AV_OPT_FLAG_ENCODING_PARAM},
+ offsetof(MP3Context, write_id3v1), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1, AV_OPT_FLAG_ENCODING_PARAM},
{ NULL },
};
@@ -132,50 +331,49 @@ static const AVClass mp3_muxer_class = {
.version = LIBAVUTIL_VERSION_INT,
};
-/* insert a dummy frame containing number of frames */
-static void mp3_write_xing(AVFormatContext *s)
+static int mp3_write_packet(AVFormatContext *s, AVPacket *pkt)
{
- AVCodecContext *codec = s->streams[0]->codec;
- MP3Context *mp3 = s->priv_data;
- int bitrate_idx = 1; // 32 kbps
- int64_t xing_offset = (codec->channels == 2) ? 32 : 17;
- int32_t header;
- MPADecodeHeader mpah;
- int srate_idx, i, channels;
+ MP3Context *mp3 = s->priv_data;
- for (i = 0; i < FF_ARRAY_ELEMS(avpriv_mpa_freq_tab); i++)
- if (avpriv_mpa_freq_tab[i] == codec->sample_rate) {
- srate_idx = i;
- break;
- }
- if (i == FF_ARRAY_ELEMS(avpriv_mpa_freq_tab)) {
- av_log(s, AV_LOG_ERROR, "Unsupported sample rate.\n");
- return;
- }
+ if (pkt->stream_index == mp3->audio_stream_idx) {
+ if (mp3->pics_to_write) {
+ /* buffer audio packets until we get all the pictures */
+ AVPacketList *pktl = av_mallocz(sizeof(*pktl));
+ if (!pktl)
+ return AVERROR(ENOMEM);
- switch (codec->channels) {
- case 1: channels = MPA_MONO; break;
- case 2: channels = MPA_STEREO; break;
- default: av_log(s, AV_LOG_ERROR, "Unsupported number of channels.\n"); return;
- }
+ pktl->pkt = *pkt;
+ pkt->destruct = NULL;
- /* dummy MPEG audio header */
- header = 0xff << 24; // sync
- header |= (0x7 << 5 | 0x3 << 3 | 0x1 << 1 | 0x1) << 16; // sync/mpeg-1/layer 3/no crc*/
- header |= (bitrate_idx << 4 | srate_idx << 2) << 8;
- header |= channels << 6;
- avio_wb32(s->pb, header);
+ if (mp3->queue_end)
+ mp3->queue_end->next = pktl;
+ else
+ mp3->queue = pktl;
+ mp3->queue_end = pktl;
+ } else
+ return mp3_write_audio_packet(s, pkt);
+ } else {
+ int ret;
- avpriv_mpegaudio_decode_header(&mpah, header);
+ /* warn only once for each stream */
+ if (s->streams[pkt->stream_index]->nb_frames == 1) {
+ av_log(s, AV_LOG_WARNING, "Got more than one picture in stream %d,"
+ " ignoring.\n", pkt->stream_index);
+ }
+ if (!mp3->pics_to_write || s->streams[pkt->stream_index]->nb_frames >= 1)
+ return 0;
- ffio_fill(s->pb, 0, xing_offset);
- ffio_wfourcc(s->pb, "Xing");
- avio_wb32(s->pb, 0x1); // only number of frames
- mp3->nb_frames_offset = avio_tell(s->pb);
- avio_wb32(s->pb, 0);
+ if ((ret = ff_id3v2_write_apic(s, &mp3->id3, pkt)) < 0)
+ return ret;
+ mp3->pics_to_write--;
- mpah.frame_size -= 4 + xing_offset + 4 + 4 + 4;
- ffio_fill(s->pb, 0, mpah.frame_size);
+ /* flush the buffered audio packets */
+ if (!mp3->pics_to_write &&
+ (ret = mp3_queue_flush(s)) < 0)
+ return ret;
+ }
+
+ return 0;
}
/**
@@ -185,30 +383,56 @@ static void mp3_write_xing(AVFormatContext *s)
static int mp3_write_header(struct AVFormatContext *s)
{
MP3Context *mp3 = s->priv_data;
- int ret;
+ int ret, i;
- ret = ff_id3v2_write(s, mp3->id3v2_version, ID3v2_DEFAULT_MAGIC);
+ /* check the streams -- we want exactly one audio and arbitrary number of
+ * video (attached pictures) */
+ mp3->audio_stream_idx = -1;
+ for (i = 0; i < s->nb_streams; i++) {
+ AVStream *st = s->streams[i];
+ if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO) {
+ if (mp3->audio_stream_idx >= 0 || st->codec->codec_id != AV_CODEC_ID_MP3) {
+ av_log(s, AV_LOG_ERROR, "Invalid audio stream. Exactly one MP3 "
+ "audio stream is required.\n");
+ return AVERROR(EINVAL);
+ }
+ mp3->audio_stream_idx = i;
+ } else if (st->codec->codec_type != AVMEDIA_TYPE_VIDEO) {
+ av_log(s, AV_LOG_ERROR, "Only audio streams and pictures are allowed in MP3.\n");
+ return AVERROR(EINVAL);
+ }
+ }
+ if (mp3->audio_stream_idx < 0) {
+ av_log(s, AV_LOG_ERROR, "No audio stream present.\n");
+ return AVERROR(EINVAL);
+ }
+ mp3->pics_to_write = s->nb_streams - 1;
+
+ ff_id3v2_start(&mp3->id3, s->pb, mp3->id3v2_version, ID3v2_DEFAULT_MAGIC);
+ ret = ff_id3v2_write_metadata(s, &mp3->id3);
if (ret < 0)
return ret;
- if (s->pb->seekable)
+ if (!mp3->pics_to_write) {
+ ff_id3v2_finish(&mp3->id3, s->pb);
mp3_write_xing(s);
+ }
return 0;
}
AVOutputFormat ff_mp3_muxer = {
.name = "mp3",
- .long_name = NULL_IF_CONFIG_SMALL("MPEG audio layer 3"),
+ .long_name = NULL_IF_CONFIG_SMALL("MP3 (MPEG audio layer 3)"),
.mime_type = "audio/x-mpeg",
.extensions = "mp3",
.priv_data_size = sizeof(MP3Context),
- .audio_codec = CODEC_ID_MP3,
- .video_codec = CODEC_ID_NONE,
+ .audio_codec = AV_CODEC_ID_MP3,
+ .video_codec = AV_CODEC_ID_PNG,
.write_header = mp3_write_header,
- .write_packet = ff_raw_write_packet,
+ .write_packet = mp3_write_packet,
.write_trailer = mp3_write_trailer,
.flags = AVFMT_NOTIMESTAMPS,
- .priv_class = &mp3_muxer_class,
+ .priv_class = &mp3_muxer_class,
};
#endif
diff --git a/gst-libs/ext/libav/libavformat/mpc.c b/gst-libs/ext/libav/libavformat/mpc.c
index 943121e..5e771ae 100644
--- a/gst-libs/ext/libav/libavformat/mpc.c
+++ b/gst-libs/ext/libav/libavformat/mpc.c
@@ -19,6 +19,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "libavutil/channel_layout.h"
#include "libavcodec/get_bits.h"
#include "avformat.h"
#include "internal.h"
@@ -52,24 +53,24 @@ static int mpc_probe(AVProbeData *p)
return 0;
}
-static int mpc_read_header(AVFormatContext *s, AVFormatParameters *ap)
+static int mpc_read_header(AVFormatContext *s)
{
MPCContext *c = s->priv_data;
AVStream *st;
if(avio_rl24(s->pb) != MKTAG('M', 'P', '+', 0)){
av_log(s, AV_LOG_ERROR, "Not a Musepack file\n");
- return -1;
+ return AVERROR_INVALIDDATA;
}
c->ver = avio_r8(s->pb);
if(c->ver != 0x07 && c->ver != 0x17){
av_log(s, AV_LOG_ERROR, "Can demux Musepack SV7, got version %02X\n", c->ver);
- return -1;
+ return AVERROR_INVALIDDATA;
}
c->fcount = avio_rl32(s->pb);
if((int64_t)c->fcount * sizeof(MPCFrame) >= UINT_MAX){
av_log(s, AV_LOG_ERROR, "Too many frames, seeking is not possible\n");
- return -1;
+ return AVERROR_INVALIDDATA;
}
if(c->fcount){
c->frames = av_malloc(c->fcount * sizeof(MPCFrame));
@@ -89,8 +90,9 @@ static int mpc_read_header(AVFormatContext *s, AVFormatParameters *ap)
if (!st)
return AVERROR(ENOMEM);
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
- st->codec->codec_id = CODEC_ID_MUSEPACK7;
+ st->codec->codec_id = AV_CODEC_ID_MUSEPACK7;
st->codec->channels = 2;
+ st->codec->channel_layout = AV_CH_LAYOUT_STEREO;
st->codec->bits_per_coded_sample = 16;
st->codec->extradata_size = 16;
@@ -122,7 +124,7 @@ static int mpc_read_packet(AVFormatContext *s, AVPacket *pkt)
int64_t pos;
if (c->curframe >= c->fcount && c->fcount)
- return -1;
+ return AVERROR_EOF;
if(c->curframe != c->lastframe + 1){
avio_seek(s->pb, c->frames[c->curframe].pos, SEEK_SET);
@@ -151,8 +153,8 @@ static int mpc_read_packet(AVFormatContext *s, AVPacket *pkt)
}
c->curbits = (curbits + size2) & 0x1F;
- if (av_new_packet(pkt, size) < 0)
- return AVERROR(EIO);
+ if ((ret = av_new_packet(pkt, size)) < 0)
+ return ret;
pkt->data[0] = curbits;
pkt->data[1] = (c->curframe > c->fcount) && c->fcount;
@@ -166,7 +168,7 @@ static int mpc_read_packet(AVFormatContext *s, AVPacket *pkt)
avio_seek(s->pb, -4, SEEK_CUR);
if(ret < size){
av_free_packet(pkt);
- return AVERROR(EIO);
+ return ret < 0 ? ret : AVERROR(EIO);
}
pkt->size = ret + 4;
@@ -214,7 +216,7 @@ static int mpc_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp
ret = av_read_frame(s, pkt);
if (ret < 0){
c->curframe = lastframe;
- return -1;
+ return ret;
}
av_free_packet(pkt);
}
@@ -231,5 +233,5 @@ AVInputFormat ff_mpc_demuxer = {
.read_packet = mpc_read_packet,
.read_close = mpc_read_close,
.read_seek = mpc_read_seek,
- .extensions = "mpc",
+ .extensions = "mpc",
};
diff --git a/gst-libs/ext/libav/libavformat/mpc8.c b/gst-libs/ext/libav/libavformat/mpc8.c
index d956049..f60a314 100644
--- a/gst-libs/ext/libav/libavformat/mpc8.c
+++ b/gst-libs/ext/libav/libavformat/mpc8.c
@@ -21,6 +21,7 @@
#include "libavcodec/get_bits.h"
#include "libavcodec/unary.h"
+#include "apetag.h"
#include "avformat.h"
#include "internal.h"
#include "avio_internal.h"
@@ -48,9 +49,10 @@ static const int mpc8_rate[8] = { 44100, 48000, 37800, 32000, -1, -1, -1, -1 };
typedef struct {
int ver;
- int frame;
int64_t header_pos;
int64_t samples;
+
+ int64_t apetag_start;
} MPCContext;
static inline int64_t bs_get_v(uint8_t **bs)
@@ -188,7 +190,7 @@ static void mpc8_handle_chunk(AVFormatContext *s, int tag, int64_t chunk_pos, in
}
}
-static int mpc8_read_header(AVFormatContext *s, AVFormatParameters *ap)
+static int mpc8_read_header(AVFormatContext *s)
{
MPCContext *c = s->priv_data;
AVIOContext *pb = s->pb;
@@ -199,7 +201,7 @@ static int mpc8_read_header(AVFormatContext *s, AVFormatParameters *ap)
c->header_pos = avio_tell(pb);
if(avio_rl32(pb) != TAG_MPCK){
av_log(s, AV_LOG_ERROR, "Not a Musepack8 file\n");
- return -1;
+ return AVERROR_INVALIDDATA;
}
while(!pb->eof_reached){
@@ -211,14 +213,14 @@ static int mpc8_read_header(AVFormatContext *s, AVFormatParameters *ap)
}
if(tag != TAG_STREAMHDR){
av_log(s, AV_LOG_ERROR, "Stream header not found\n");
- return -1;
+ return AVERROR_INVALIDDATA;
}
pos = avio_tell(pb);
avio_skip(pb, 4); //CRC
c->ver = avio_r8(pb);
if(c->ver != 8){
av_log(s, AV_LOG_ERROR, "Unknown stream version %d\n", c->ver);
- return -1;
+ return AVERROR_PATCHWELCOME;
}
c->samples = ffio_read_varlen(pb);
ffio_read_varlen(pb); //silence samples at the beginning
@@ -227,7 +229,7 @@ static int mpc8_read_header(AVFormatContext *s, AVFormatParameters *ap)
if (!st)
return AVERROR(ENOMEM);
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
- st->codec->codec_id = CODEC_ID_MUSEPACK8;
+ st->codec->codec_id = AV_CODEC_ID_MUSEPACK8;
st->codec->bits_per_coded_sample = 16;
st->codec->extradata_size = 2;
@@ -237,9 +239,16 @@ static int mpc8_read_header(AVFormatContext *s, AVFormatParameters *ap)
st->codec->channels = (st->codec->extradata[1] >> 4) + 1;
st->codec->sample_rate = mpc8_rate[st->codec->extradata[0] >> 5];
avpriv_set_pts_info(st, 32, 1152 << (st->codec->extradata[1]&3)*2, st->codec->sample_rate);
+ st->start_time = 0;
st->duration = c->samples / (1152 << (st->codec->extradata[1]&3)*2);
size -= avio_tell(pb) - pos;
+ if (pb->seekable) {
+ int64_t pos = avio_tell(s->pb);
+ c->apetag_start = ff_ape_parse_tag(s);
+ avio_seek(s->pb, pos, SEEK_SET);
+ }
+
return 0;
}
@@ -251,6 +260,11 @@ static int mpc8_read_packet(AVFormatContext *s, AVPacket *pkt)
while(!s->pb->eof_reached){
pos = avio_tell(s->pb);
+
+ /* don't return bogus packets with the ape tag data */
+ if (c->apetag_start && pos >= c->apetag_start)
+ return AVERROR_EOF;
+
mpc8_get_chunk_header(s->pb, &tag, &size);
if (size < 0)
return -1;
@@ -258,7 +272,7 @@ static int mpc8_read_packet(AVFormatContext *s, AVPacket *pkt)
if(av_get_packet(s->pb, pkt, size) < 0)
return AVERROR(ENOMEM);
pkt->stream_index = 0;
- pkt->pts = c->frame;
+ pkt->duration = 1;
return 0;
}
if(tag == TAG_STREAMEND)
@@ -271,12 +285,12 @@ static int mpc8_read_packet(AVFormatContext *s, AVPacket *pkt)
static int mpc8_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int flags)
{
AVStream *st = s->streams[stream_index];
- MPCContext *c = s->priv_data;
int index = av_index_search_timestamp(st, timestamp, flags);
if(index < 0) return -1;
- avio_seek(s->pb, st->index_entries[index].pos, SEEK_SET);
- c->frame = st->index_entries[index].timestamp;
+ if (avio_seek(s->pb, st->index_entries[index].pos, SEEK_SET) < 0)
+ return -1;
+ ff_update_cur_dts(s, st, st->index_entries[index].timestamp);
return 0;
}
diff --git a/gst-libs/ext/libav/libavformat/mpeg.c b/gst-libs/ext/libav/libavformat/mpeg.c
index f740a25..2d08b17 100644
--- a/gst-libs/ext/libav/libavformat/mpeg.c
+++ b/gst-libs/ext/libav/libavformat/mpeg.c
@@ -84,7 +84,6 @@ static int mpegps_probe(AVProbeData *p)
if(vid+audio > invalid) /* invalid VDR files nd short PES streams */
score= AVPROBE_SCORE_MAX/4;
-//av_log(NULL, AV_LOG_ERROR, "%d %d %d %d %d %d len:%d\n", sys, priv1, pspack,vid, audio, invalid, p->buf_size);
if(sys>invalid && sys*9 <= pspack*10)
return pspack > 2 ? AVPROBE_SCORE_MAX/2+2 : AVPROBE_SCORE_MAX/4; // +1 for .mpg
if(pspack > invalid && (priv1+vid+audio)*10 >= pspack*9)
@@ -104,8 +103,7 @@ typedef struct MpegDemuxContext {
int sofdec;
} MpegDemuxContext;
-static int mpegps_read_header(AVFormatContext *s,
- AVFormatParameters *ap)
+static int mpegps_read_header(AVFormatContext *s)
{
MpegDemuxContext *m = s->priv_data;
const char *sofdec = "Sofdec";
@@ -164,41 +162,6 @@ static int find_next_start_code(AVIOContext *pb, int *size_ptr,
return val;
}
-#if 0 /* unused, remove? */
-/* XXX: optimize */
-static int find_prev_start_code(AVIOContext *pb, int *size_ptr)
-{
- int64_t pos, pos_start;
- int max_size, start_code;
-
- max_size = *size_ptr;
- pos_start = avio_tell(pb);
-
- /* in order to go faster, we fill the buffer */
- pos = pos_start - 16386;
- if (pos < 0)
- pos = 0;
- avio_seek(pb, pos, SEEK_SET);
- avio_r8(pb);
-
- pos = pos_start;
- for(;;) {
- pos--;
- if (pos < 0 || (pos_start - pos) >= max_size) {
- start_code = -1;
- goto the_end;
- }
- avio_seek(pb, pos, SEEK_SET);
- start_code = avio_rb32(pb);
- if ((start_code & 0xffffff00) == 0x100)
- break;
- }
- the_end:
- *size_ptr = pos_start - pos;
- return start_code;
-}
-#endif
-
/**
* Extract stream types from a program stream map
* According to ISO/IEC 13818-1 ('MPEG-2 Systems') table 2-35
@@ -254,7 +217,6 @@ static int mpegps_read_pes_header(AVFormatContext *s,
size = MAX_SYNC_SIZE;
startcode = find_next_start_code(s->pb, &size, &m->header_state);
last_sync = avio_tell(s->pb);
- //printf("startcode=%x pos=0x%"PRIx64"\n", startcode, avio_tell(s->pb));
if (startcode < 0){
if(s->pb->eof_reached)
return AVERROR_EOF;
@@ -328,12 +290,6 @@ static int mpegps_read_pes_header(AVFormatContext *s,
}
} else if ((c & 0xc0) == 0x80) {
/* mpeg 2 PES */
-#if 0 /* some streams have this field set for no apparent reason */
- if ((c & 0x30) != 0) {
- /* Encrypted multiplex not handled */
- goto redo;
- }
-#endif
flags = avio_r8(s->pb);
header_len = avio_r8(s->pb);
len -= 2;
@@ -424,7 +380,7 @@ static int mpegps_read_packet(AVFormatContext *s,
MpegDemuxContext *m = s->priv_data;
AVStream *st;
int len, startcode, i, es_type, ret;
- enum CodecID codec_id = CODEC_ID_NONE;
+ enum AVCodecID codec_id = AV_CODEC_ID_NONE;
enum AVMediaType type;
int64_t pts, dts, dummy_pos; //dummy_pos is needed for the index building to work
uint8_t av_uninit(dvdaudio_substream_type);
@@ -450,26 +406,26 @@ static int mpegps_read_packet(AVFormatContext *s,
es_type = m->psm_es_type[startcode & 0xff];
if(es_type > 0 && es_type != STREAM_TYPE_PRIVATE_DATA){
if(es_type == STREAM_TYPE_VIDEO_MPEG1){
- codec_id = CODEC_ID_MPEG2VIDEO;
+ codec_id = AV_CODEC_ID_MPEG2VIDEO;
type = AVMEDIA_TYPE_VIDEO;
} else if(es_type == STREAM_TYPE_VIDEO_MPEG2){
- codec_id = CODEC_ID_MPEG2VIDEO;
+ codec_id = AV_CODEC_ID_MPEG2VIDEO;
type = AVMEDIA_TYPE_VIDEO;
} else if(es_type == STREAM_TYPE_AUDIO_MPEG1 ||
es_type == STREAM_TYPE_AUDIO_MPEG2){
- codec_id = CODEC_ID_MP3;
+ codec_id = AV_CODEC_ID_MP3;
type = AVMEDIA_TYPE_AUDIO;
} else if(es_type == STREAM_TYPE_AUDIO_AAC){
- codec_id = CODEC_ID_AAC;
+ codec_id = AV_CODEC_ID_AAC;
type = AVMEDIA_TYPE_AUDIO;
} else if(es_type == STREAM_TYPE_VIDEO_MPEG4){
- codec_id = CODEC_ID_MPEG4;
+ codec_id = AV_CODEC_ID_MPEG4;
type = AVMEDIA_TYPE_VIDEO;
} else if(es_type == STREAM_TYPE_VIDEO_H264){
- codec_id = CODEC_ID_H264;
+ codec_id = AV_CODEC_ID_H264;
type = AVMEDIA_TYPE_VIDEO;
} else if(es_type == STREAM_TYPE_AUDIO_AC3){
- codec_id = CODEC_ID_AC3;
+ codec_id = AV_CODEC_ID_AC3;
type = AVMEDIA_TYPE_AUDIO;
} else {
goto skip;
@@ -480,47 +436,47 @@ static int mpegps_read_packet(AVFormatContext *s,
avio_read(s->pb, buf, 8);
avio_seek(s->pb, -8, SEEK_CUR);
if(!memcmp(buf, avs_seqh, 4) && (buf[6] != 0 || buf[7] != 1))
- codec_id = CODEC_ID_CAVS;
+ codec_id = AV_CODEC_ID_CAVS;
else
- codec_id = CODEC_ID_PROBE;
+ codec_id = AV_CODEC_ID_PROBE;
type = AVMEDIA_TYPE_VIDEO;
} else if (startcode >= 0x1c0 && startcode <= 0x1df) {
type = AVMEDIA_TYPE_AUDIO;
- codec_id = m->sofdec > 0 ? CODEC_ID_ADPCM_ADX : CODEC_ID_MP2;
+ codec_id = m->sofdec > 0 ? AV_CODEC_ID_ADPCM_ADX : AV_CODEC_ID_MP2;
} else if (startcode >= 0x80 && startcode <= 0x87) {
type = AVMEDIA_TYPE_AUDIO;
- codec_id = CODEC_ID_AC3;
+ codec_id = AV_CODEC_ID_AC3;
} else if ( ( startcode >= 0x88 && startcode <= 0x8f)
||( startcode >= 0x98 && startcode <= 0x9f)) {
/* 0x90 - 0x97 is reserved for SDDS in DVD specs */
type = AVMEDIA_TYPE_AUDIO;
- codec_id = CODEC_ID_DTS;
+ codec_id = AV_CODEC_ID_DTS;
} else if (startcode >= 0xa0 && startcode <= 0xaf) {
type = AVMEDIA_TYPE_AUDIO;
- /* 16 bit form will be handled as CODEC_ID_PCM_S16BE */
- codec_id = CODEC_ID_PCM_DVD;
+ /* 16 bit form will be handled as AV_CODEC_ID_PCM_S16BE */
+ codec_id = AV_CODEC_ID_PCM_DVD;
} else if (startcode >= 0xb0 && startcode <= 0xbf) {
type = AVMEDIA_TYPE_AUDIO;
- codec_id = CODEC_ID_TRUEHD;
+ codec_id = AV_CODEC_ID_TRUEHD;
} else if (startcode >= 0xc0 && startcode <= 0xcf) {
/* Used for both AC-3 and E-AC-3 in EVOB files */
type = AVMEDIA_TYPE_AUDIO;
- codec_id = CODEC_ID_AC3;
+ codec_id = AV_CODEC_ID_AC3;
} else if (startcode >= 0x20 && startcode <= 0x3f) {
type = AVMEDIA_TYPE_SUBTITLE;
- codec_id = CODEC_ID_DVD_SUBTITLE;
+ codec_id = AV_CODEC_ID_DVD_SUBTITLE;
} else if (startcode >= 0xfd55 && startcode <= 0xfd5f) {
type = AVMEDIA_TYPE_VIDEO;
- codec_id = CODEC_ID_VC1;
+ codec_id = AV_CODEC_ID_VC1;
} else if (startcode == 0x1bd) {
// check dvd audio substream type
type = AVMEDIA_TYPE_AUDIO;
switch(dvdaudio_substream_type & 0xe0) {
- case 0xa0: codec_id = CODEC_ID_PCM_DVD;
+ case 0xa0: codec_id = AV_CODEC_ID_PCM_DVD;
break;
case 0x80: if((dvdaudio_substream_type & 0xf8) == 0x88)
- codec_id = CODEC_ID_DTS;
- else codec_id = CODEC_ID_AC3;
+ codec_id = AV_CODEC_ID_DTS;
+ else codec_id = AV_CODEC_ID_AC3;
break;
default: av_log(s, AV_LOG_ERROR, "Unknown 0x1bd sub-stream\n");
goto skip;
@@ -538,7 +494,7 @@ static int mpegps_read_packet(AVFormatContext *s,
st->id = startcode;
st->codec->codec_type = type;
st->codec->codec_id = codec_id;
- if (codec_id != CODEC_ID_PCM_S16BE)
+ if (codec_id != AV_CODEC_ID_PCM_S16BE)
st->need_parsing = AVSTREAM_PARSE_FULL;
found:
if(st->discard >= AVDISCARD_ALL)
@@ -563,7 +519,7 @@ static int mpegps_read_packet(AVFormatContext *s,
st->codec->sample_rate *
st->codec->bits_per_coded_sample;
if (st->codec->bits_per_coded_sample == 16)
- st->codec->codec_id = CODEC_ID_PCM_S16BE;
+ st->codec->codec_id = AV_CODEC_ID_PCM_S16BE;
else if (st->codec->bits_per_coded_sample == 28)
return AVERROR(EINVAL);
}
@@ -609,11 +565,11 @@ static int64_t mpegps_read_dts(AVFormatContext *s, int stream_index,
AVInputFormat ff_mpegps_demuxer = {
.name = "mpeg",
- .long_name = NULL_IF_CONFIG_SMALL("MPEG-PS format"),
+ .long_name = NULL_IF_CONFIG_SMALL("MPEG-PS (MPEG-2 Program Stream)"),
.priv_data_size = sizeof(MpegDemuxContext),
.read_probe = mpegps_probe,
.read_header = mpegps_read_header,
.read_packet = mpegps_read_packet,
.read_timestamp = mpegps_read_dts,
- .flags = AVFMT_SHOW_IDS|AVFMT_TS_DISCONT,
+ .flags = AVFMT_SHOW_IDS | AVFMT_TS_DISCONT,
};
diff --git a/gst-libs/ext/libav/libavformat/mpegenc.c b/gst-libs/ext/libav/libavformat/mpegenc.c
index b2ca35a..4f7bde8 100644
--- a/gst-libs/ext/libav/libavformat/mpegenc.c
+++ b/gst-libs/ext/libav/libavformat/mpegenc.c
@@ -318,6 +318,8 @@ static int mpeg_mux_init(AVFormatContext *ctx)
s->packet_size = ctx->packet_size;
} else
s->packet_size = 2048;
+ if (ctx->max_delay < 0) /* Not set by the caller */
+ ctx->max_delay = 0;
s->vcd_padding_bytes_written = 0;
s->vcd_padding_bitrate=0;
@@ -341,11 +343,11 @@ static int mpeg_mux_init(AVFormatContext *ctx)
switch(st->codec->codec_type) {
case AVMEDIA_TYPE_AUDIO:
- if (st->codec->codec_id == CODEC_ID_AC3) {
+ if (st->codec->codec_id == AV_CODEC_ID_AC3) {
stream->id = ac3_id++;
- } else if (st->codec->codec_id == CODEC_ID_DTS) {
+ } else if (st->codec->codec_id == AV_CODEC_ID_DTS) {
stream->id = dts_id++;
- } else if (st->codec->codec_id == CODEC_ID_PCM_S16BE) {
+ } else if (st->codec->codec_id == AV_CODEC_ID_PCM_S16BE) {
stream->id = lpcm_id++;
for(j = 0; j < 4; j++) {
if (lpcm_freq_tab[j] == st->codec->sample_rate)
@@ -376,14 +378,6 @@ static int mpeg_mux_init(AVFormatContext *ctx)
av_log(ctx, AV_LOG_WARNING, "VBV buffer size not set, muxing may fail\n");
stream->max_buffer_size = 230*1024; //FIXME this is probably too small as default
}
-#if 0
- /* see VCD standard, p. IV-7*/
- stream->max_buffer_size = 46 * 1024;
- else
- /* This value HAS to be used for SVCD (see SVCD standard, p. 26 V.2.3.2).
- Right now it is also used for everything else.*/
- stream->max_buffer_size = 230 * 1024;
-#endif
s->video_bound++;
break;
case AVMEDIA_TYPE_SUBTITLE:
@@ -421,11 +415,6 @@ static int mpeg_mux_init(AVFormatContext *ctx)
video_bitrate += codec_rate;
}
-#if FF_API_MUXRATE
- if(ctx->mux_rate){
- s->mux_rate= (ctx->mux_rate + (8 * 50) - 1) / (8 * 50);
- } else
-#endif
if (!s->mux_rate) {
/* we increase slightly the bitrate to take into account the
headers. XXX: compute it exactly */
@@ -534,92 +523,6 @@ static int get_vcd_padding_size(AVFormatContext *ctx, int64_t pts)
}
-#if 0 /* unused, remove? */
-/* return the exact available payload size for the next packet for
- stream 'stream_index'. 'pts' and 'dts' are only used to know if
- timestamps are needed in the packet header. */
-static int get_packet_payload_size(AVFormatContext *ctx, int stream_index,
- int64_t pts, int64_t dts)
-{
- MpegMuxContext *s = ctx->priv_data;
- int buf_index;
- StreamInfo *stream;
-
- stream = ctx->streams[stream_index]->priv_data;
-
- buf_index = 0;
- if (((s->packet_number % s->pack_header_freq) == 0)) {
- /* pack header size */
- if (s->is_mpeg2)
- buf_index += 14;
- else
- buf_index += 12;
-
- if (s->is_vcd) {
- /* there is exactly one system header for each stream in a VCD MPEG,
- One in the very first video packet and one in the very first
- audio packet (see VCD standard p. IV-7 and IV-8).*/
-
- if (stream->packet_number==0)
- /* The system headers refer only to the stream they occur in,
- so they have a constant size.*/
- buf_index += 15;
-
- } else {
- if ((s->packet_number % s->system_header_freq) == 0)
- buf_index += s->system_header_size;
- }
- }
-
- if ((s->is_vcd && stream->packet_number==0)
- || (s->is_svcd && s->packet_number==0))
- /* the first pack of each stream contains only the pack header,
- the system header and some padding (see VCD standard p. IV-6)
- Add the padding size, so that the actual payload becomes 0.*/
- buf_index += s->packet_size - buf_index;
- else {
- /* packet header size */
- buf_index += 6;
- if (s->is_mpeg2) {
- buf_index += 3;
- if (stream->packet_number==0)
- buf_index += 3; /* PES extension */
- buf_index += 1; /* obligatory stuffing byte */
- }
- if (pts != AV_NOPTS_VALUE) {
- if (dts != pts)
- buf_index += 5 + 5;
- else
- buf_index += 5;
-
- } else {
- if (!s->is_mpeg2)
- buf_index++;
- }
-
- if (stream->id < 0xc0) {
- /* AC-3/LPCM private data header */
- buf_index += 4;
- if (stream->id >= 0xa0) {
- int n;
- buf_index += 3;
- /* NOTE: we round the payload size to an integer number of
- LPCM samples */
- n = (s->packet_size - buf_index) % stream->lpcm_align;
- if (n)
- buf_index += (stream->lpcm_align - n);
- }
- }
-
- if (s->is_vcd && (stream->id & 0xe0) == AUDIO_ID)
- /* The VCD standard demands that 20 zero bytes follow
- each audio packet (see standard p. IV-8).*/
- buf_index+=20;
- }
- return s->packet_size - buf_index;
-}
-#endif
-
/* Write an MPEG padding packet header. */
static void put_padding_packet(AVFormatContext *ctx, AVIOContext *pb,int packet_bytes)
{
@@ -835,6 +738,12 @@ static int flush_packet(AVFormatContext *ctx, int stream_index,
if (stuffing_size < 0)
stuffing_size = 0;
+
+ if (startcode == PRIVATE_STREAM_1 && id >= 0xa0) {
+ if (payload_size < av_fifo_size(stream->fifo))
+ stuffing_size += payload_size % stream->lpcm_align;
+ }
+
if (stuffing_size > 16) { /*<=16 for MPEG-1, <=32 for MPEG-2*/
pad_packet_bytes += stuffing_size;
packet_size -= stuffing_size;
@@ -979,28 +888,6 @@ static void put_vcd_padding_sector(AVFormatContext *ctx)
s->packet_number++;
}
-#if 0 /* unused, remove? */
-static int64_t get_vcd_scr(AVFormatContext *ctx,int stream_index,int64_t pts)
-{
- MpegMuxContext *s = ctx->priv_data;
- int64_t scr;
-
- /* Since the data delivery rate is constant, SCR is computed
- using the formula C + i * 1200 where C is the start constant
- and i is the pack index.
- It is recommended that SCR 0 is at the beginning of the VCD front
- margin (a sequence of empty Form 2 sectors on the CD).
- It is recommended that the front margin is 30 sectors long, so
- we use C = 30*1200 = 36000
- (Note that even if the front margin is not 30 sectors the file
- will still be correct according to the standard. It just won't have
- the "recommended" value).*/
- scr = 36000 + s->packet_number * 1200;
-
- return scr;
-}
-#endif
-
static int remove_decoded_packets(AVFormatContext *ctx, int64_t scr){
// MpegMuxContext *s = ctx->priv_data;
int i;
@@ -1116,7 +1003,10 @@ retry:
}
if(timestamp_packet){
-//av_log(ctx, AV_LOG_DEBUG, "dts:%f pts:%f scr:%f stream:%d\n", timestamp_packet->dts/90000.0, timestamp_packet->pts/90000.0, scr/90000.0, best_i);
+ av_dlog(ctx, "dts:%f pts:%f scr:%f stream:%d\n",
+ timestamp_packet->dts / 90000.0,
+ timestamp_packet->pts / 90000.0,
+ scr / 90000.0, best_i);
es_size= flush_packet(ctx, best_i, timestamp_packet->pts, timestamp_packet->dts, scr, trailer_size);
}else{
assert(av_fifo_size(stream->fifo) == trailer_size);
@@ -1163,10 +1053,6 @@ static int mpeg_mux_write_packet(AVFormatContext *ctx, AVPacket *pkt)
int preload;
const int is_iframe = st->codec->codec_type == AVMEDIA_TYPE_VIDEO && (pkt->flags & AV_PKT_FLAG_KEY);
-#if FF_API_PRELOAD
- if (ctx->preload)
- s->preload = ctx->preload;
-#endif
preload = av_rescale(s->preload, 90000, AV_TIME_BASE);
pts= pkt->pts;
@@ -1179,7 +1065,9 @@ static int mpeg_mux_write_packet(AVFormatContext *ctx, AVPacket *pkt)
dts += 2*preload;
}
-//av_log(ctx, AV_LOG_DEBUG, "dts:%f pts:%f flags:%d stream:%d nopts:%d\n", dts/90000.0, pts/90000.0, pkt->flags, pkt->stream_index, pts != AV_NOPTS_VALUE);
+ av_dlog(ctx, "dts:%f pts:%f flags:%d stream:%d nopts:%d\n",
+ dts / 90000.0, pts / 90000.0, pkt->flags,
+ pkt->stream_index, pts != AV_NOPTS_VALUE);
if (!stream->premux_packet)
stream->next_packet = &stream->premux_packet;
*stream->next_packet=
@@ -1244,8 +1132,8 @@ static int mpeg_mux_end(AVFormatContext *ctx)
#define OFFSET(x) offsetof(MpegMuxContext, x)
#define E AV_OPT_FLAG_ENCODING_PARAM
static const AVOption options[] = {
- { "muxrate", NULL, OFFSET(mux_rate), AV_OPT_TYPE_INT, {0}, 0, INT_MAX, E },
- { "preload", "Initial demux-decode delay in microseconds.", OFFSET(preload), AV_OPT_TYPE_INT, {500000}, 0, INT_MAX, E},
+ { "muxrate", NULL, OFFSET(mux_rate), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, E },
+ { "preload", "Initial demux-decode delay in microseconds.", OFFSET(preload), AV_OPT_TYPE_INT, {.i64 = 500000}, 0, INT_MAX, E},
{ NULL },
};
@@ -1261,12 +1149,12 @@ static const AVClass flavor ## _class = {\
MPEGENC_CLASS(mpeg)
AVOutputFormat ff_mpeg1system_muxer = {
.name = "mpeg",
- .long_name = NULL_IF_CONFIG_SMALL("MPEG-1 System format"),
+ .long_name = NULL_IF_CONFIG_SMALL("MPEG-1 Systems / MPEG program stream"),
.mime_type = "video/mpeg",
.extensions = "mpg,mpeg",
.priv_data_size = sizeof(MpegMuxContext),
- .audio_codec = CODEC_ID_MP2,
- .video_codec = CODEC_ID_MPEG1VIDEO,
+ .audio_codec = AV_CODEC_ID_MP2,
+ .video_codec = AV_CODEC_ID_MPEG1VIDEO,
.write_header = mpeg_mux_init,
.write_packet = mpeg_mux_write_packet,
.write_trailer = mpeg_mux_end,
@@ -1277,11 +1165,11 @@ AVOutputFormat ff_mpeg1system_muxer = {
MPEGENC_CLASS(vcd)
AVOutputFormat ff_mpeg1vcd_muxer = {
.name = "vcd",
- .long_name = NULL_IF_CONFIG_SMALL("MPEG-1 System format (VCD)"),
+ .long_name = NULL_IF_CONFIG_SMALL("MPEG-1 Systems / MPEG program stream (VCD)"),
.mime_type = "video/mpeg",
.priv_data_size = sizeof(MpegMuxContext),
- .audio_codec = CODEC_ID_MP2,
- .video_codec = CODEC_ID_MPEG1VIDEO,
+ .audio_codec = AV_CODEC_ID_MP2,
+ .video_codec = AV_CODEC_ID_MPEG1VIDEO,
.write_header = mpeg_mux_init,
.write_packet = mpeg_mux_write_packet,
.write_trailer = mpeg_mux_end,
@@ -1292,12 +1180,12 @@ AVOutputFormat ff_mpeg1vcd_muxer = {
MPEGENC_CLASS(vob)
AVOutputFormat ff_mpeg2vob_muxer = {
.name = "vob",
- .long_name = NULL_IF_CONFIG_SMALL("MPEG-2 PS format (VOB)"),
+ .long_name = NULL_IF_CONFIG_SMALL("MPEG-2 PS (VOB)"),
.mime_type = "video/mpeg",
.extensions = "vob",
.priv_data_size = sizeof(MpegMuxContext),
- .audio_codec = CODEC_ID_MP2,
- .video_codec = CODEC_ID_MPEG2VIDEO,
+ .audio_codec = AV_CODEC_ID_MP2,
+ .video_codec = AV_CODEC_ID_MPEG2VIDEO,
.write_header = mpeg_mux_init,
.write_packet = mpeg_mux_write_packet,
.write_trailer = mpeg_mux_end,
@@ -1310,12 +1198,12 @@ AVOutputFormat ff_mpeg2vob_muxer = {
MPEGENC_CLASS(svcd)
AVOutputFormat ff_mpeg2svcd_muxer = {
.name = "svcd",
- .long_name = NULL_IF_CONFIG_SMALL("MPEG-2 PS format (VOB)"),
+ .long_name = NULL_IF_CONFIG_SMALL("MPEG-2 PS (SVCD)"),
.mime_type = "video/mpeg",
.extensions = "vob",
.priv_data_size = sizeof(MpegMuxContext),
- .audio_codec = CODEC_ID_MP2,
- .video_codec = CODEC_ID_MPEG2VIDEO,
+ .audio_codec = AV_CODEC_ID_MP2,
+ .video_codec = AV_CODEC_ID_MPEG2VIDEO,
.write_header = mpeg_mux_init,
.write_packet = mpeg_mux_write_packet,
.write_trailer = mpeg_mux_end,
@@ -1328,12 +1216,12 @@ AVOutputFormat ff_mpeg2svcd_muxer = {
MPEGENC_CLASS(dvd)
AVOutputFormat ff_mpeg2dvd_muxer = {
.name = "dvd",
- .long_name = NULL_IF_CONFIG_SMALL("MPEG-2 PS format (DVD VOB)"),
+ .long_name = NULL_IF_CONFIG_SMALL("MPEG-2 PS (DVD VOB)"),
.mime_type = "video/mpeg",
.extensions = "dvd",
.priv_data_size = sizeof(MpegMuxContext),
- .audio_codec = CODEC_ID_MP2,
- .video_codec = CODEC_ID_MPEG2VIDEO,
+ .audio_codec = AV_CODEC_ID_MP2,
+ .video_codec = AV_CODEC_ID_MPEG2VIDEO,
.write_header = mpeg_mux_init,
.write_packet = mpeg_mux_write_packet,
.write_trailer = mpeg_mux_end,
diff --git a/gst-libs/ext/libav/libavformat/mpegts.c b/gst-libs/ext/libav/libavformat/mpegts.c
index cc36e65..7c4d447 100644
--- a/gst-libs/ext/libav/libavformat/mpegts.c
+++ b/gst-libs/ext/libav/libavformat/mpegts.c
@@ -19,8 +19,6 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-//#define USE_SYNCPOINT_SEARCH
-
#include "libavutil/crc.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/log.h"
@@ -131,7 +129,7 @@ struct MpegTSContext {
static const AVOption options[] = {
{"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 },
+ {.i64 = 0}, 0, 1, AV_OPT_FLAG_DECODING_PARAM },
{ NULL },
};
@@ -413,7 +411,8 @@ static int get_packet_size(const uint8_t *buf, int size)
score = analyze(buf, size, TS_PACKET_SIZE, NULL);
dvhs_score = analyze(buf, size, TS_DVHS_PACKET_SIZE, NULL);
fec_score= analyze(buf, size, TS_FEC_PACKET_SIZE, NULL);
-// av_log(NULL, AV_LOG_DEBUG, "score: %d, dvhs_score: %d, fec_score: %d \n", score, dvhs_score, fec_score);
+ av_dlog(NULL, "score: %d, dvhs_score: %d, fec_score: %d \n",
+ score, dvhs_score, fec_score);
if (score > fec_score && score > dvhs_score) return TS_PACKET_SIZE;
else if(dvhs_score > score && dvhs_score > fec_score) return TS_DVHS_PACKET_SIZE;
@@ -511,54 +510,60 @@ static int parse_section_header(SectionHeader *h,
typedef struct {
uint32_t stream_type;
enum AVMediaType codec_type;
- enum CodecID codec_id;
+ enum AVCodecID codec_id;
} StreamType;
static const StreamType ISO_types[] = {
- { 0x01, AVMEDIA_TYPE_VIDEO, CODEC_ID_MPEG2VIDEO },
- { 0x02, AVMEDIA_TYPE_VIDEO, CODEC_ID_MPEG2VIDEO },
- { 0x03, AVMEDIA_TYPE_AUDIO, CODEC_ID_MP3 },
- { 0x04, AVMEDIA_TYPE_AUDIO, CODEC_ID_MP3 },
- { 0x0f, AVMEDIA_TYPE_AUDIO, CODEC_ID_AAC },
- { 0x10, AVMEDIA_TYPE_VIDEO, CODEC_ID_MPEG4 },
- { 0x11, AVMEDIA_TYPE_AUDIO, CODEC_ID_AAC_LATM }, /* LATM syntax */
- { 0x1b, AVMEDIA_TYPE_VIDEO, CODEC_ID_H264 },
- { 0xd1, AVMEDIA_TYPE_VIDEO, CODEC_ID_DIRAC },
- { 0xea, AVMEDIA_TYPE_VIDEO, CODEC_ID_VC1 },
+ { 0x01, AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_MPEG2VIDEO },
+ { 0x02, AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_MPEG2VIDEO },
+ { 0x03, AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_MP3 },
+ { 0x04, AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_MP3 },
+ { 0x0f, AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_AAC },
+ { 0x10, AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_MPEG4 },
+ { 0x11, AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_AAC_LATM }, /* LATM syntax */
+ { 0x1b, AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_H264 },
+ { 0xd1, AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_DIRAC },
+ { 0xea, AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_VC1 },
{ 0 },
};
static const StreamType HDMV_types[] = {
- { 0x80, AVMEDIA_TYPE_AUDIO, CODEC_ID_PCM_BLURAY },
- { 0x81, AVMEDIA_TYPE_AUDIO, CODEC_ID_AC3 },
- { 0x82, AVMEDIA_TYPE_AUDIO, CODEC_ID_DTS },
- { 0x83, AVMEDIA_TYPE_AUDIO, CODEC_ID_TRUEHD },
- { 0x84, AVMEDIA_TYPE_AUDIO, CODEC_ID_EAC3 },
- { 0x90, AVMEDIA_TYPE_SUBTITLE, CODEC_ID_HDMV_PGS_SUBTITLE },
+ { 0x80, AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_PCM_BLURAY },
+ { 0x81, AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_AC3 },
+ { 0x82, AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_DTS },
+ { 0x83, AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_TRUEHD },
+ { 0x84, AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_EAC3 },
+ { 0x85, AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_DTS }, /* DTS HD */
+ { 0x86, AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_DTS }, /* DTS HD MASTER*/
+ { 0x90, AVMEDIA_TYPE_SUBTITLE, AV_CODEC_ID_HDMV_PGS_SUBTITLE },
{ 0 },
};
/* ATSC ? */
static const StreamType MISC_types[] = {
- { 0x81, AVMEDIA_TYPE_AUDIO, CODEC_ID_AC3 },
- { 0x8a, AVMEDIA_TYPE_AUDIO, CODEC_ID_DTS },
+ { 0x81, AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_AC3 },
+ { 0x8a, AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_DTS },
{ 0 },
};
static const StreamType REGD_types[] = {
- { MKTAG('d','r','a','c'), AVMEDIA_TYPE_VIDEO, CODEC_ID_DIRAC },
- { MKTAG('A','C','-','3'), AVMEDIA_TYPE_AUDIO, CODEC_ID_AC3 },
- { MKTAG('B','S','S','D'), AVMEDIA_TYPE_AUDIO, CODEC_ID_S302M },
+ { MKTAG('d','r','a','c'), AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_DIRAC },
+ { MKTAG('A','C','-','3'), AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_AC3 },
+ { MKTAG('B','S','S','D'), AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_S302M },
+ { MKTAG('D','T','S','1'), AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_DTS },
+ { MKTAG('D','T','S','2'), AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_DTS },
+ { MKTAG('D','T','S','3'), AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_DTS },
+ { MKTAG('V','C','-','1'), AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_VC1 },
{ 0 },
};
/* descriptor present */
static const StreamType DESC_types[] = {
- { 0x6a, AVMEDIA_TYPE_AUDIO, CODEC_ID_AC3 }, /* AC-3 descriptor */
- { 0x7a, AVMEDIA_TYPE_AUDIO, CODEC_ID_EAC3 }, /* E-AC-3 descriptor */
- { 0x7b, AVMEDIA_TYPE_AUDIO, CODEC_ID_DTS },
- { 0x56, AVMEDIA_TYPE_SUBTITLE, CODEC_ID_DVB_TELETEXT },
- { 0x59, AVMEDIA_TYPE_SUBTITLE, CODEC_ID_DVB_SUBTITLE }, /* subtitling descriptor */
+ { 0x6a, AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_AC3 }, /* AC-3 descriptor */
+ { 0x7a, AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_EAC3 }, /* E-AC-3 descriptor */
+ { 0x7b, AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_DTS },
+ { 0x56, AVMEDIA_TYPE_SUBTITLE, AV_CODEC_ID_DVB_TELETEXT },
+ { 0x59, AVMEDIA_TYPE_SUBTITLE, AV_CODEC_ID_DVB_SUBTITLE }, /* subtitling descriptor */
{ 0 },
};
@@ -580,7 +585,7 @@ static int mpegts_set_stream_info(AVStream *st, PESContext *pes,
avpriv_set_pts_info(st, 33, 1, 90000);
st->priv_data = pes;
st->codec->codec_type = AVMEDIA_TYPE_DATA;
- st->codec->codec_id = CODEC_ID_NONE;
+ st->codec->codec_id = AV_CODEC_ID_NONE;
st->need_parsing = AVSTREAM_PARSE_FULL;
pes->st = st;
pes->stream_type = stream_type;
@@ -593,7 +598,7 @@ static int mpegts_set_stream_info(AVStream *st, PESContext *pes,
mpegts_find_stream_type(st, pes->stream_type, ISO_types);
if (prog_reg_desc == AV_RL32("HDMV") &&
- st->codec->codec_id == CODEC_ID_NONE) {
+ st->codec->codec_id == AV_CODEC_ID_NONE) {
mpegts_find_stream_type(st, pes->stream_type, HDMV_types);
if (pes->stream_type == 0x83) {
// HDMV TrueHD streams also contain an AC3 coded version of the
@@ -615,12 +620,12 @@ static int mpegts_set_stream_info(AVStream *st, PESContext *pes,
avpriv_set_pts_info(sub_st, 33, 1, 90000);
sub_st->priv_data = sub_pes;
sub_st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
- sub_st->codec->codec_id = CODEC_ID_AC3;
+ sub_st->codec->codec_id = AV_CODEC_ID_AC3;
sub_st->need_parsing = AVSTREAM_PARSE_FULL;
sub_pes->sub_st = pes->sub_st = sub_st;
}
}
- if (st->codec->codec_id == CODEC_ID_NONE)
+ if (st->codec->codec_id == AV_CODEC_ID_NONE)
mpegts_find_stream_type(st, pes->stream_type, MISC_types);
return 0;
@@ -660,19 +665,6 @@ static void new_pes_packet(PESContext *pes, AVPacket *pkt)
pes->flags = 0;
}
-static uint64_t get_bits64(GetBitContext *gb, int bits)
-{
- uint64_t ret = 0;
- while (bits > 17) {
- ret <<= 17;
- ret |= get_bits(gb, 17);
- bits -= 17;
- }
- ret <<= bits;
- ret |= get_bits(gb, bits);
- return ret;
-}
-
static int read_sl_header(PESContext *pes, SLConfigDescr *sl, const uint8_t *buf, int buf_size)
{
GetBitContext gb;
@@ -780,7 +772,8 @@ static int mpegts_push_data(MpegTSFilter *filter,
code = pes->header[3] | 0x100;
av_dlog(pes->stream, "pid=%x pes_code=%#x\n", pes->pid, code);
- if ((pes->st && pes->st->discard == AVDISCARD_ALL) ||
+ if ((pes->st && pes->st->discard == AVDISCARD_ALL &&
+ (!pes->sub_st || pes->sub_st->discard == AVDISCARD_ALL)) ||
code == 0x1be) /* padding_stream */
goto skip;
@@ -809,10 +802,10 @@ static int mpegts_push_data(MpegTSFilter *filter,
code != 0x1ff && code != 0x1f2 && /* program_stream_directory, DSMCC_stream */
code != 0x1f8) { /* ITU-T Rec. H.222.1 type E stream */
pes->state = MPEGTS_PESHEADER;
- if (pes->st->codec->codec_id == CODEC_ID_NONE) {
+ if (pes->st->codec->codec_id == AV_CODEC_ID_NONE) {
av_dlog(pes->stream, "pid=%x stream_type=%x probing\n",
pes->pid, pes->stream_type);
- pes->st->codec->codec_id = CODEC_ID_PROBE;
+ pes->st->codec->codec_id = AV_CODEC_ID_PROBE;
}
} else {
pes->state = MPEGTS_PAYLOAD;
@@ -1214,19 +1207,19 @@ static void m4sl_cb(MpegTSFilter *filter, const uint8_t *section, int section_le
ffio_init_context(&pb, mp4_descr[i].dec_config_descr,
mp4_descr[i].dec_config_descr_len, 0, NULL, NULL, NULL, NULL);
ff_mp4_read_dec_config_descr(s, st, &pb);
- if (st->codec->codec_id == CODEC_ID_AAC &&
+ if (st->codec->codec_id == AV_CODEC_ID_AAC &&
st->codec->extradata_size > 0)
st->need_parsing = 0;
- if (st->codec->codec_id == CODEC_ID_H264 &&
+ if (st->codec->codec_id == AV_CODEC_ID_H264 &&
st->codec->extradata_size > 0)
st->need_parsing = 0;
- if (st->codec->codec_id <= CODEC_ID_NONE) {
- } else if (st->codec->codec_id < CODEC_ID_FIRST_AUDIO) {
+ if (st->codec->codec_id <= AV_CODEC_ID_NONE) {
+ } else if (st->codec->codec_id < AV_CODEC_ID_FIRST_AUDIO) {
st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
- } else if (st->codec->codec_id < CODEC_ID_FIRST_SUBTITLE) {
+ } else if (st->codec->codec_id < AV_CODEC_ID_FIRST_SUBTITLE) {
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
- } else if (st->codec->codec_id < CODEC_ID_FIRST_UNKNOWN) {
+ } else if (st->codec->codec_id < AV_CODEC_ID_FIRST_UNKNOWN) {
st->codec->codec_type = AVMEDIA_TYPE_SUBTITLE;
}
}
@@ -1257,7 +1250,7 @@ int ff_parse_mpeg2_descriptor(AVFormatContext *fc, AVStream *st, int stream_type
av_dlog(fc, "tag: 0x%02x len=%d\n", desc_tag, desc_len);
- if (st->codec->codec_id == CODEC_ID_NONE &&
+ if (st->codec->codec_id == AV_CODEC_ID_NONE &&
stream_type == STREAM_TYPE_PRIVATE_DATA)
mpegts_find_stream_type(st, desc_tag, DESC_types);
@@ -1273,22 +1266,22 @@ int ff_parse_mpeg2_descriptor(AVFormatContext *fc, AVStream *st, int stream_type
ffio_init_context(&pb, mp4_descr[i].dec_config_descr,
mp4_descr[i].dec_config_descr_len, 0, NULL, NULL, NULL, NULL);
ff_mp4_read_dec_config_descr(fc, st, &pb);
- if (st->codec->codec_id == CODEC_ID_AAC &&
+ if (st->codec->codec_id == AV_CODEC_ID_AAC &&
st->codec->extradata_size > 0)
st->need_parsing = 0;
- if (st->codec->codec_id == CODEC_ID_MPEG4SYSTEMS)
+ if (st->codec->codec_id == AV_CODEC_ID_MPEG4SYSTEMS)
mpegts_open_section_filter(ts, pid, m4sl_cb, ts, 1);
}
break;
case 0x1F: /* FMC descriptor */
get16(pp, desc_end);
- if (mp4_descr_count > 0 && st->codec->codec_id == CODEC_ID_AAC_LATM &&
+ if (mp4_descr_count > 0 && st->codec->codec_id == AV_CODEC_ID_AAC_LATM &&
mp4_descr->dec_config_descr_len && mp4_descr->es_id == pid) {
AVIOContext pb;
ffio_init_context(&pb, mp4_descr->dec_config_descr,
mp4_descr->dec_config_descr_len, 0, NULL, NULL, NULL, NULL);
ff_mp4_read_dec_config_descr(fc, st, &pb);
- if (st->codec->codec_id == CODEC_ID_AAC &&
+ if (st->codec->codec_id == AV_CODEC_ID_AAC &&
st->codec->extradata_size > 0)
st->need_parsing = 0;
}
@@ -1349,8 +1342,7 @@ int ff_parse_mpeg2_descriptor(AVFormatContext *fc, AVStream *st, int stream_type
case 0x05: /* registration descriptor */
st->codec->codec_tag = bytestream_get_le32(pp);
av_dlog(fc, "reg_desc=%.4s\n", (char*)&st->codec->codec_tag);
- if (st->codec->codec_id == CODEC_ID_NONE &&
- stream_type == STREAM_TYPE_PRIVATE_DATA)
+ if (st->codec->codec_id == AV_CODEC_ID_NONE)
mpegts_find_stream_type(st, st->codec->codec_tag, REGD_types);
break;
default:
@@ -1376,7 +1368,7 @@ static void pmt_cb(MpegTSFilter *filter, const uint8_t *section, int section_len
int i;
av_dlog(ts->stream, "PMT: len %i\n", section_len);
- hex_dump_debug(ts->stream, (uint8_t *)section, section_len);
+ hex_dump_debug(ts->stream, section, section_len);
p_end = section + section_len - 4;
p = section;
@@ -1390,16 +1382,18 @@ static void pmt_cb(MpegTSFilter *filter, const uint8_t *section, int section_len
return;
clear_program(ts, h->id);
- pcr_pid = get16(&p, p_end) & 0x1fff;
+ pcr_pid = get16(&p, p_end);
if (pcr_pid < 0)
return;
+ pcr_pid &= 0x1fff;
add_pid_to_pmt(ts, h->id, pcr_pid);
av_dlog(ts->stream, "pcr_pid=0x%x\n", pcr_pid);
- program_info_length = get16(&p, p_end) & 0xfff;
+ program_info_length = get16(&p, p_end);
if (program_info_length < 0)
return;
+ program_info_length &= 0xfff;
while(program_info_length >= 2) {
uint8_t tag, len;
tag = get8(&p, p_end);
@@ -1437,9 +1431,10 @@ static void pmt_cb(MpegTSFilter *filter, const uint8_t *section, int section_len
stream_type = get8(&p, p_end);
if (stream_type < 0)
break;
- pid = get16(&p, p_end) & 0x1fff;
+ pid = get16(&p, p_end);
if (pid < 0)
break;
+ pid &= 0x1fff;
/* now create stream */
if (ts->pids[pid] && ts->pids[pid]->type == MPEGTS_PES) {
@@ -1477,9 +1472,10 @@ static void pmt_cb(MpegTSFilter *filter, const uint8_t *section, int section_len
ff_program_add_stream_index(ts->stream, h->id, st->index);
- desc_list_len = get16(&p, p_end) & 0xfff;
+ desc_list_len = get16(&p, p_end);
if (desc_list_len < 0)
break;
+ desc_list_len &= 0xfff;
desc_list_end = p + desc_list_len;
if (desc_list_end > p_end)
break;
@@ -1509,7 +1505,7 @@ static void pat_cb(MpegTSFilter *filter, const uint8_t *section, int section_len
int sid, pmt_pid;
av_dlog(ts->stream, "PAT:\n");
- hex_dump_debug(ts->stream, (uint8_t *)section, section_len);
+ hex_dump_debug(ts->stream, section, section_len);
p_end = section + section_len - 4;
p = section;
@@ -1523,9 +1519,10 @@ static void pat_cb(MpegTSFilter *filter, const uint8_t *section, int section_len
sid = get16(&p, p_end);
if (sid < 0)
break;
- pmt_pid = get16(&p, p_end) & 0x1fff;
+ pmt_pid = get16(&p, p_end);
if (pmt_pid < 0)
break;
+ pmt_pid &= 0x1fff;
av_dlog(ts->stream, "sid=0x%x pid=0x%x\n", sid, pmt_pid);
@@ -1552,7 +1549,7 @@ static void sdt_cb(MpegTSFilter *filter, const uint8_t *section, int section_len
char *name, *provider_name;
av_dlog(ts->stream, "SDT:\n");
- hex_dump_debug(ts->stream, (uint8_t *)section, section_len);
+ hex_dump_debug(ts->stream, section, section_len);
p_end = section + section_len - 4;
p = section;
@@ -1573,9 +1570,10 @@ static void sdt_cb(MpegTSFilter *filter, const uint8_t *section, int section_len
val = get8(&p, p_end);
if (val < 0)
break;
- desc_list_len = get16(&p, p_end) & 0xfff;
+ desc_list_len = get16(&p, p_end);
if (desc_list_len < 0)
break;
+ desc_list_len &= 0xfff;
desc_list_end = p + desc_list_len;
if (desc_list_end > p_end)
break;
@@ -1814,7 +1812,6 @@ static int handle_packets(MpegTSContext *ts, int nb_packets)
static int mpegts_probe(AVProbeData *p)
{
-#if 1
const int size= p->buf_size;
int score, fec_score, dvhs_score;
int check_count= size / TS_FEC_PACKET_SIZE;
@@ -1826,20 +1823,14 @@ static int mpegts_probe(AVProbeData *p)
score = analyze(p->buf, TS_PACKET_SIZE *check_count, TS_PACKET_SIZE , NULL)*CHECK_COUNT/check_count;
dvhs_score= analyze(p->buf, TS_DVHS_PACKET_SIZE*check_count, TS_DVHS_PACKET_SIZE, NULL)*CHECK_COUNT/check_count;
fec_score = analyze(p->buf, TS_FEC_PACKET_SIZE *check_count, TS_FEC_PACKET_SIZE , NULL)*CHECK_COUNT/check_count;
-// av_log(NULL, AV_LOG_DEBUG, "score: %d, dvhs_score: %d, fec_score: %d \n", score, dvhs_score, fec_score);
+ av_dlog(NULL, "score: %d, dvhs_score: %d, fec_score: %d \n",
+ score, dvhs_score, fec_score);
// we need a clear definition for the returned score otherwise things will become messy sooner or later
if (score > fec_score && score > dvhs_score && score > 6) return AVPROBE_SCORE_MAX + score - CHECK_COUNT;
else if(dvhs_score > score && dvhs_score > fec_score && dvhs_score > 6) return AVPROBE_SCORE_MAX + dvhs_score - CHECK_COUNT;
else if( fec_score > 6) return AVPROBE_SCORE_MAX + fec_score - CHECK_COUNT;
else return -1;
-#else
- /* only use the extension for safer guess */
- if (av_match_ext(p->filename, "ts"))
- return AVPROBE_SCORE_MAX;
- else
- return 0;
-#endif
}
/* return the 90kHz PCR and the extension for the 27MHz PCR. return
@@ -1871,8 +1862,7 @@ static int parse_pcr(int64_t *ppcr_high, int *ppcr_low,
return 0;
}
-static int mpegts_read_header(AVFormatContext *s,
- AVFormatParameters *ap)
+static int mpegts_read_header(AVFormatContext *s)
{
MpegTSContext *ts = s->priv_data;
AVIOContext *pb = s->pb;
@@ -1895,7 +1885,7 @@ static int mpegts_read_header(AVFormatContext *s,
/* normal demux */
/* first do a scan to get all the services */
- if (pb->seekable && avio_seek(pb, pos, SEEK_SET) < 0)
+ if (avio_seek(pb, pos, SEEK_SET) < 0 && pb->seekable)
av_log(s, AV_LOG_ERROR, "Unable to seek back to the start\n");
mpegts_open_section_filter(ts, SDT_PID, sdt_cb, ts, 1);
@@ -1924,7 +1914,7 @@ static int mpegts_read_header(AVFormatContext *s,
goto fail;
avpriv_set_pts_info(st, 60, 1, 27000000);
st->codec->codec_type = AVMEDIA_TYPE_DATA;
- st->codec->codec_id = CODEC_ID_MPEG2TS;
+ st->codec->codec_id = AV_CODEC_ID_MPEG2TS;
/* we iterate until we find two PCRs to estimate the bitrate */
pcr_pid = -1;
@@ -2016,6 +2006,7 @@ static int mpegts_read_packet(AVFormatContext *s,
MpegTSContext *ts = s->priv_data;
int ret, i;
+ pkt->size = -1;
ts->pkt = pkt;
ret = handle_packets(ts, 0);
if (ret < 0) {
@@ -2033,6 +2024,8 @@ static int mpegts_read_packet(AVFormatContext *s,
}
}
+ if (!ret && pkt->size < 0)
+ ret = AVERROR(EINTR);
return ret;
}
@@ -2088,92 +2081,6 @@ static int64_t mpegts_get_pcr(AVFormatContext *s, int stream_index,
return timestamp;
}
-#ifdef USE_SYNCPOINT_SEARCH
-
-static int read_seek2(AVFormatContext *s,
- int stream_index,
- int64_t min_ts,
- int64_t target_ts,
- int64_t max_ts,
- int flags)
-{
- int64_t pos;
-
- int64_t ts_ret, ts_adj;
- int stream_index_gen_search;
- AVStream *st;
- AVParserState *backup;
-
- backup = ff_store_parser_state(s);
-
- // detect direction of seeking for search purposes
- flags |= (target_ts - min_ts > (uint64_t)(max_ts - target_ts)) ?
- AVSEEK_FLAG_BACKWARD : 0;
-
- if (flags & AVSEEK_FLAG_BYTE) {
- // use position directly, we will search starting from it
- pos = target_ts;
- } else {
- // search for some position with good timestamp match
- if (stream_index < 0) {
- stream_index_gen_search = av_find_default_stream_index(s);
- if (stream_index_gen_search < 0) {
- ff_restore_parser_state(s, backup);
- return -1;
- }
-
- st = s->streams[stream_index_gen_search];
- // timestamp for default must be expressed in AV_TIME_BASE units
- ts_adj = av_rescale(target_ts,
- st->time_base.den,
- AV_TIME_BASE * (int64_t)st->time_base.num);
- } else {
- ts_adj = target_ts;
- stream_index_gen_search = stream_index;
- }
- pos = ff_gen_search(s, stream_index_gen_search, ts_adj,
- 0, INT64_MAX, -1,
- AV_NOPTS_VALUE,
- AV_NOPTS_VALUE,
- flags, &ts_ret, mpegts_get_pcr);
- if (pos < 0) {
- ff_restore_parser_state(s, backup);
- return -1;
- }
- }
-
- // search for actual matching keyframe/starting position for all streams
- if (ff_gen_syncpoint_search(s, stream_index, pos,
- min_ts, target_ts, max_ts,
- flags) < 0) {
- ff_restore_parser_state(s, backup);
- return -1;
- }
-
- ff_free_parser_state(s, backup);
- return 0;
-}
-
-static int read_seek(AVFormatContext *s, int stream_index, int64_t target_ts, int flags)
-{
- int ret;
- if (flags & AVSEEK_FLAG_BACKWARD) {
- flags &= ~AVSEEK_FLAG_BACKWARD;
- ret = read_seek2(s, stream_index, INT64_MIN, target_ts, target_ts, flags);
- if (ret < 0)
- // for compatibility reasons, seek to the best-fitting timestamp
- ret = read_seek2(s, stream_index, INT64_MIN, target_ts, INT64_MAX, flags);
- } else {
- ret = read_seek2(s, stream_index, target_ts, target_ts, INT64_MAX, flags);
- if (ret < 0)
- // for compatibility reasons, seek to the best-fitting timestamp
- ret = read_seek2(s, stream_index, INT64_MIN, target_ts, INT64_MAX, flags);
- }
- return ret;
-}
-
-#else
-
static int read_seek(AVFormatContext *s, int stream_index, int64_t target_ts, int flags){
MpegTSContext *ts = s->priv_data;
uint8_t buf[TS_PACKET_SIZE];
@@ -2197,8 +2104,6 @@ static int read_seek(AVFormatContext *s, int stream_index, int64_t target_ts, in
return 0;
}
-#endif
-
/**************************************************************/
/* parsing functions - called from other demuxers such as RTP */
@@ -2254,7 +2159,7 @@ void ff_mpegts_parse_close(MpegTSContext *ts)
AVInputFormat ff_mpegts_demuxer = {
.name = "mpegts",
- .long_name = NULL_IF_CONFIG_SMALL("MPEG-2 transport stream format"),
+ .long_name = NULL_IF_CONFIG_SMALL("MPEG-TS (MPEG-2 Transport Stream)"),
.priv_data_size = sizeof(MpegTSContext),
.read_probe = mpegts_probe,
.read_header = mpegts_read_header,
@@ -2262,24 +2167,18 @@ AVInputFormat ff_mpegts_demuxer = {
.read_close = mpegts_read_close,
.read_seek = read_seek,
.read_timestamp = mpegts_get_pcr,
- .flags = AVFMT_SHOW_IDS|AVFMT_TS_DISCONT,
-#ifdef USE_SYNCPOINT_SEARCH
- .read_seek2 = read_seek2,
-#endif
+ .flags = AVFMT_SHOW_IDS | AVFMT_TS_DISCONT,
};
AVInputFormat ff_mpegtsraw_demuxer = {
.name = "mpegtsraw",
- .long_name = NULL_IF_CONFIG_SMALL("MPEG-2 raw transport stream format"),
+ .long_name = NULL_IF_CONFIG_SMALL("raw MPEG-TS (MPEG-2 Transport Stream)"),
.priv_data_size = sizeof(MpegTSContext),
.read_header = mpegts_read_header,
.read_packet = mpegts_raw_read_packet,
.read_close = mpegts_read_close,
.read_seek = read_seek,
.read_timestamp = mpegts_get_pcr,
- .flags = AVFMT_SHOW_IDS|AVFMT_TS_DISCONT,
-#ifdef USE_SYNCPOINT_SEARCH
- .read_seek2 = read_seek2,
-#endif
- .priv_class = &mpegtsraw_class,
+ .flags = AVFMT_SHOW_IDS | AVFMT_TS_DISCONT,
+ .priv_class = &mpegtsraw_class,
};
diff --git a/gst-libs/ext/libav/libavformat/mpegts.h b/gst-libs/ext/libav/libavformat/mpegts.h
index e38f2e0..89544f0 100644
--- a/gst-libs/ext/libav/libavformat/mpegts.h
+++ b/gst-libs/ext/libav/libavformat/mpegts.h
@@ -65,7 +65,7 @@ int ff_mpegts_parse_packet(MpegTSContext *ts, AVPacket *pkt,
const uint8_t *buf, int len);
void ff_mpegts_parse_close(MpegTSContext *ts);
-typedef struct {
+typedef struct SLConfigDescr {
int use_au_start;
int use_au_end;
int use_rand_acc_pt;
@@ -82,7 +82,7 @@ typedef struct {
int packet_seq_num_len;
} SLConfigDescr;
-typedef struct {
+typedef struct Mp4Descr {
int es_id;
int dec_config_descr_len;
uint8_t *dec_config_descr;
@@ -96,10 +96,6 @@ typedef struct {
* @param stream_type STREAM_TYPE_xxx
* @param pp Descriptor buffer pointer
* @param desc_list_end End of buffer
- * @param mp4_dec_config_descr_len Length of 'mp4_dec_config_descr', or zero if not present
- * @param mp4_es_id
- * @param pid
- * @param mp4_dec_config_descr
* @return <0 to stop processing
*/
int ff_parse_mpeg2_descriptor(AVFormatContext *fc, AVStream *st, int stream_type,
diff --git a/gst-libs/ext/libav/libavformat/mpegtsenc.c b/gst-libs/ext/libav/libavformat/mpegtsenc.c
index 90f2232..29d83c6 100644
--- a/gst-libs/ext/libav/libavformat/mpegtsenc.c
+++ b/gst-libs/ext/libav/libavformat/mpegtsenc.c
@@ -28,7 +28,6 @@
#include "avformat.h"
#include "internal.h"
#include "mpegts.h"
-#include "adts.h"
#define PCR_TIME_BASE 27000000
@@ -76,6 +75,12 @@ typedef struct MpegTSWrite {
int pmt_start_pid;
int start_pid;
+
+ int reemit_pat_pmt; // backward compatibility
+
+#define MPEGTS_FLAG_REEMIT_PAT_PMT 0x01
+#define MPEGTS_FLAG_AAC_LATM 0x02
+ int flags;
} MpegTSWrite;
/* a PES packet header is generated every DEFAULT_PES_HEADER_FREQ packets */
@@ -84,18 +89,29 @@ typedef struct MpegTSWrite {
static const AVOption options[] = {
{ "mpegts_transport_stream_id", "Set transport_stream_id field.",
- offsetof(MpegTSWrite, transport_stream_id), AV_OPT_TYPE_INT, {.dbl = 0x0001 }, 0x0001, 0xffff, AV_OPT_FLAG_ENCODING_PARAM},
+ offsetof(MpegTSWrite, transport_stream_id), AV_OPT_TYPE_INT, {.i64 = 0x0001 }, 0x0001, 0xffff, AV_OPT_FLAG_ENCODING_PARAM},
{ "mpegts_original_network_id", "Set original_network_id field.",
- offsetof(MpegTSWrite, original_network_id), AV_OPT_TYPE_INT, {.dbl = 0x0001 }, 0x0001, 0xffff, AV_OPT_FLAG_ENCODING_PARAM},
+ offsetof(MpegTSWrite, original_network_id), AV_OPT_TYPE_INT, {.i64 = 0x0001 }, 0x0001, 0xffff, AV_OPT_FLAG_ENCODING_PARAM},
{ "mpegts_service_id", "Set service_id field.",
- offsetof(MpegTSWrite, service_id), AV_OPT_TYPE_INT, {.dbl = 0x0001 }, 0x0001, 0xffff, AV_OPT_FLAG_ENCODING_PARAM},
+ offsetof(MpegTSWrite, service_id), AV_OPT_TYPE_INT, {.i64 = 0x0001 }, 0x0001, 0xffff, AV_OPT_FLAG_ENCODING_PARAM},
{ "mpegts_pmt_start_pid", "Set the first pid of the PMT.",
- offsetof(MpegTSWrite, pmt_start_pid), AV_OPT_TYPE_INT, {.dbl = 0x1000 }, 0x1000, 0x1f00, AV_OPT_FLAG_ENCODING_PARAM},
+ offsetof(MpegTSWrite, pmt_start_pid), AV_OPT_TYPE_INT, {.i64 = 0x1000 }, 0x1000, 0x1f00, AV_OPT_FLAG_ENCODING_PARAM},
{ "mpegts_start_pid", "Set the first pid.",
- offsetof(MpegTSWrite, start_pid), AV_OPT_TYPE_INT, {.dbl = 0x0100 }, 0x0100, 0x0f00, AV_OPT_FLAG_ENCODING_PARAM},
- { "muxrate", NULL, offsetof(MpegTSWrite, mux_rate), AV_OPT_TYPE_INT, {1}, 0, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM},
+ offsetof(MpegTSWrite, start_pid), AV_OPT_TYPE_INT, {.i64 = 0x0100 }, 0x0100, 0x0f00, AV_OPT_FLAG_ENCODING_PARAM},
+ { "muxrate", NULL, offsetof(MpegTSWrite, mux_rate), AV_OPT_TYPE_INT, {.i64 = 1}, 0, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM},
{ "pes_payload_size", "Minimum PES packet payload in bytes",
- offsetof(MpegTSWrite, pes_payload_size), AV_OPT_TYPE_INT, {DEFAULT_PES_PAYLOAD_SIZE}, 0, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM},
+ offsetof(MpegTSWrite, pes_payload_size), AV_OPT_TYPE_INT, {.i64 = DEFAULT_PES_PAYLOAD_SIZE}, 0, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM},
+ { "mpegts_flags", "MPEG-TS muxing flags", offsetof(MpegTSWrite, flags), AV_OPT_TYPE_FLAGS, {.i64 = 0}, 0, INT_MAX,
+ AV_OPT_FLAG_ENCODING_PARAM, "mpegts_flags" },
+ { "resend_headers", "Reemit PAT/PMT before writing the next packet",
+ 0, AV_OPT_TYPE_CONST, {.i64 = MPEGTS_FLAG_REEMIT_PAT_PMT}, 0, INT_MAX,
+ AV_OPT_FLAG_ENCODING_PARAM, "mpegts_flags"},
+ { "latm", "Use LATM packetization for AAC",
+ 0, AV_OPT_TYPE_CONST, {.i64 = MPEGTS_FLAG_AAC_LATM}, 0, INT_MAX,
+ AV_OPT_FLAG_ENCODING_PARAM, "mpegts_flags"},
+ // backward compatibility
+ { "resend_headers", "Reemit PAT/PMT before writing the next packet",
+ offsetof(MpegTSWrite, reemit_pat_pmt), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM},
{ NULL },
};
@@ -210,7 +226,7 @@ typedef struct MpegTSWriteStream {
int64_t payload_dts;
int payload_flags;
uint8_t *payload;
- ADTSContext *adts;
+ AVFormatContext *amux;
} MpegTSWriteStream;
static void mpegts_write_pat(AVFormatContext *s)
@@ -232,7 +248,7 @@ static void mpegts_write_pat(AVFormatContext *s)
static void mpegts_write_pmt(AVFormatContext *s, MpegTSService *service)
{
- // MpegTSWrite *ts = s->priv_data;
+ MpegTSWrite *ts = s->priv_data;
uint8_t data[1012], *q, *desc_length_ptr, *program_info_length_ptr;
int val, stream_type, i;
@@ -253,30 +269,30 @@ static void mpegts_write_pmt(AVFormatContext *s, MpegTSService *service)
MpegTSWriteStream *ts_st = st->priv_data;
AVDictionaryEntry *lang = av_dict_get(st->metadata, "language", NULL,0);
switch(st->codec->codec_id) {
- case CODEC_ID_MPEG1VIDEO:
- case CODEC_ID_MPEG2VIDEO:
+ case AV_CODEC_ID_MPEG1VIDEO:
+ case AV_CODEC_ID_MPEG2VIDEO:
stream_type = STREAM_TYPE_VIDEO_MPEG2;
break;
- case CODEC_ID_MPEG4:
+ case AV_CODEC_ID_MPEG4:
stream_type = STREAM_TYPE_VIDEO_MPEG4;
break;
- case CODEC_ID_H264:
+ case AV_CODEC_ID_H264:
stream_type = STREAM_TYPE_VIDEO_H264;
break;
- case CODEC_ID_DIRAC:
+ case AV_CODEC_ID_DIRAC:
stream_type = STREAM_TYPE_VIDEO_DIRAC;
break;
- case CODEC_ID_MP2:
- case CODEC_ID_MP3:
+ case AV_CODEC_ID_MP2:
+ case AV_CODEC_ID_MP3:
stream_type = STREAM_TYPE_AUDIO_MPEG1;
break;
- case CODEC_ID_AAC:
- stream_type = STREAM_TYPE_AUDIO_AAC;
+ case AV_CODEC_ID_AAC:
+ stream_type = (ts->flags & MPEGTS_FLAG_AAC_LATM) ? STREAM_TYPE_AUDIO_AAC_LATM : STREAM_TYPE_AUDIO_AAC;
break;
- case CODEC_ID_AAC_LATM:
+ case AV_CODEC_ID_AAC_LATM:
stream_type = STREAM_TYPE_AUDIO_AAC_LATM;
break;
- case CODEC_ID_AC3:
+ case AV_CODEC_ID_AC3:
stream_type = STREAM_TYPE_AUDIO_AC3;
break;
default:
@@ -455,6 +471,10 @@ static int mpegts_write_header(AVFormatContext *s)
const char *service_name;
const char *provider_name;
int *pids;
+ int ret;
+
+ if (s->max_delay < 0) /* Not set by the caller */
+ s->max_delay = 0;
// round up to a whole number of TS packets
ts->pes_payload_size = (ts->pes_payload_size + 14 + 183) / 184 * 184 - 14;
@@ -492,12 +512,16 @@ static int mpegts_write_header(AVFormatContext *s)
st = s->streams[i];
avpriv_set_pts_info(st, 33, 1, 90000);
ts_st = av_mallocz(sizeof(MpegTSWriteStream));
- if (!ts_st)
+ if (!ts_st) {
+ ret = AVERROR(ENOMEM);
goto fail;
+ }
st->priv_data = ts_st;
ts_st->payload = av_mallocz(ts->pes_payload_size);
- if (!ts_st->payload)
+ if (!ts_st->payload) {
+ ret = AVERROR(ENOMEM);
goto fail;
+ }
ts_st->service = service;
/* MPEG pid values < 16 are reserved. Applications which set st->id in
* this range are assigned a calculated pid. */
@@ -507,15 +531,18 @@ static int mpegts_write_header(AVFormatContext *s)
ts_st->pid = st->id;
} else {
av_log(s, AV_LOG_ERROR, "Invalid stream id %d, must be less than 8191\n", st->id);
+ ret = AVERROR(EINVAL);
goto fail;
}
if (ts_st->pid == service->pmt.pid) {
av_log(s, AV_LOG_ERROR, "Duplicate stream id %d\n", ts_st->pid);
+ ret = AVERROR(EINVAL);
goto fail;
}
for (j = 0; j < i; j++)
if (pids[j] == ts_st->pid) {
av_log(s, AV_LOG_ERROR, "Duplicate stream id %d\n", ts_st->pid);
+ ret = AVERROR(EINVAL);
goto fail;
}
pids[i] = ts_st->pid;
@@ -529,13 +556,26 @@ static int mpegts_write_header(AVFormatContext *s)
service->pcr_pid = ts_st->pid;
pcr_st = st;
}
- if (st->codec->codec_id == CODEC_ID_AAC &&
- st->codec->extradata_size > 0) {
- ts_st->adts = av_mallocz(sizeof(*ts_st->adts));
- if (!ts_st->adts)
+ if (st->codec->codec_id == AV_CODEC_ID_AAC &&
+ st->codec->extradata_size > 0)
+ {
+ AVStream *ast;
+ ts_st->amux = avformat_alloc_context();
+ if (!ts_st->amux) {
+ ret = AVERROR(ENOMEM);
+ goto fail;
+ }
+ ts_st->amux->oformat = av_guess_format((ts->flags & MPEGTS_FLAG_AAC_LATM) ? "latm" : "adts", NULL, NULL);
+ if (!ts_st->amux->oformat) {
+ ret = AVERROR(EINVAL);
+ goto fail;
+ }
+ ast = avformat_new_stream(ts_st->amux, NULL);
+ ret = avcodec_copy_context(ast->codec, st->codec);
+ if (ret != 0)
goto fail;
- if (ff_adts_decode_extradata(s, ts_st->adts, st->codec->extradata,
- st->codec->extradata_size) < 0)
+ ret = avformat_write_header(ts_st->amux, NULL);
+ if (ret < 0)
goto fail;
}
}
@@ -549,11 +589,6 @@ static int mpegts_write_header(AVFormatContext *s)
service->pcr_pid = ts_st->pid;
}
-#if FF_API_MUXRATE
- if (s->mux_rate)
- ts->mux_rate = s->mux_rate;
-#endif
-
if (ts->mux_rate > 1) {
service->pcr_packet_period = (ts->mux_rate * PCR_RETRANS_TIME) /
(TS_PACKET_SIZE * 8 * 1000);
@@ -589,10 +624,10 @@ static int mpegts_write_header(AVFormatContext *s)
ts->sdt_packet_count = ts->sdt_packet_period-1;
if (ts->mux_rate == 1)
- av_log(s, AV_LOG_INFO, "muxrate VBR, ");
+ av_log(s, AV_LOG_VERBOSE, "muxrate VBR, ");
else
- av_log(s, AV_LOG_INFO, "muxrate %d, ", ts->mux_rate);
- av_log(s, AV_LOG_INFO, "pcr every %d pkts, "
+ av_log(s, AV_LOG_VERBOSE, "muxrate %d, ", ts->mux_rate);
+ av_log(s, AV_LOG_VERBOSE, "pcr every %d pkts, "
"sdt every %d, pat/pmt every %d pkts\n",
service->pcr_packet_period,
ts->sdt_packet_period, ts->pat_packet_period);
@@ -609,11 +644,14 @@ static int mpegts_write_header(AVFormatContext *s)
ts_st = st->priv_data;
if (ts_st) {
av_freep(&ts_st->payload);
- av_freep(&ts_st->adts);
+ if (ts_st->amux) {
+ avformat_free_context(ts_st->amux);
+ ts_st->amux = NULL;
+ }
}
av_freep(&st->priv_data);
}
- return -1;
+ return ret;
}
/* send SDT, PAT and PMT tables regulary */
@@ -823,14 +861,14 @@ static void mpegts_write_pes(AVFormatContext *s, AVStream *st,
*q++ = 0x01;
private_code = 0;
if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
- if (st->codec->codec_id == CODEC_ID_DIRAC) {
+ if (st->codec->codec_id == AV_CODEC_ID_DIRAC) {
*q++ = 0xfd;
} else
*q++ = 0xe0;
} else if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO &&
- (st->codec->codec_id == CODEC_ID_MP2 ||
- st->codec->codec_id == CODEC_ID_MP3 ||
- st->codec->codec_id == CODEC_ID_AAC)) {
+ (st->codec->codec_id == AV_CODEC_ID_MP2 ||
+ st->codec->codec_id == AV_CODEC_ID_MP3 ||
+ st->codec->codec_id == AV_CODEC_ID_AAC)) {
*q++ = 0xc0;
} else {
*q++ = 0xbd;
@@ -849,7 +887,7 @@ static void mpegts_write_pes(AVFormatContext *s, AVStream *st,
flags |= 0x40;
}
if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO &&
- st->codec->codec_id == CODEC_ID_DIRAC) {
+ st->codec->codec_id == AV_CODEC_ID_DIRAC) {
/* set PES_extension_flag */
pes_extension = 1;
flags |= 0x01;
@@ -883,7 +921,7 @@ static void mpegts_write_pes(AVFormatContext *s, AVStream *st,
write_pts(q, 1, dts);
q += 5;
}
- if (pes_extension && st->codec->codec_id == CODEC_ID_DIRAC) {
+ if (pes_extension && st->codec->codec_id == AV_CODEC_ID_DIRAC) {
flags = 0x01; /* set PES_extension_flag_2 */
*q++ = flags;
*q++ = 0x80 | 0x01; /* marker bit + extension length */
@@ -933,7 +971,7 @@ static void mpegts_write_pes(AVFormatContext *s, AVStream *st,
avio_flush(s->pb);
}
-static int mpegts_write_packet(AVFormatContext *s, AVPacket *pkt)
+static int mpegts_write_packet_internal(AVFormatContext *s, AVPacket *pkt)
{
AVStream *st = s->streams[pkt->stream_index];
int size = pkt->size;
@@ -944,6 +982,18 @@ static int mpegts_write_packet(AVFormatContext *s, AVPacket *pkt)
const uint64_t delay = av_rescale(s->max_delay, 90000, AV_TIME_BASE)*2;
int64_t dts = AV_NOPTS_VALUE, pts = AV_NOPTS_VALUE;
+ if (ts->reemit_pat_pmt) {
+ av_log(s, AV_LOG_WARNING, "resend_headers option is deprecated, use -mpegts_flags resend_headers\n");
+ ts->reemit_pat_pmt = 0;
+ ts->flags |= MPEGTS_FLAG_REEMIT_PAT_PMT;
+ }
+
+ if (ts->flags & MPEGTS_FLAG_REEMIT_PAT_PMT) {
+ ts->pat_packet_count = ts->pat_packet_period - 1;
+ ts->sdt_packet_count = ts->sdt_packet_period - 1;
+ ts->flags &= ~MPEGTS_FLAG_REEMIT_PAT_PMT;
+ }
+
if (pkt->pts != AV_NOPTS_VALUE)
pts = pkt->pts + delay;
if (pkt->dts != AV_NOPTS_VALUE)
@@ -951,30 +1001,30 @@ static int mpegts_write_packet(AVFormatContext *s, AVPacket *pkt)
if (ts_st->first_pts_check && pts == AV_NOPTS_VALUE) {
av_log(s, AV_LOG_ERROR, "first pts value must set\n");
- return -1;
+ return AVERROR(EINVAL);
}
ts_st->first_pts_check = 0;
- if (st->codec->codec_id == CODEC_ID_H264) {
+ if (st->codec->codec_id == AV_CODEC_ID_H264) {
const uint8_t *p = buf, *buf_end = p+size;
uint32_t state = -1;
if (pkt->size < 5 || AV_RB32(pkt->data) != 0x0000001) {
av_log(s, AV_LOG_ERROR, "H.264 bitstream malformed, "
- "no startcode found, use -vbsf h264_mp4toannexb\n");
- return -1;
+ "no startcode found, use -bsf h264_mp4toannexb\n");
+ return AVERROR(EINVAL);
}
do {
p = avpriv_mpv_find_start_code(p, buf_end, &state);
- //av_log(s, AV_LOG_INFO, "nal %d\n", state & 0x1f);
+ av_dlog(s, "nal %d\n", state & 0x1f);
} while (p < buf_end && (state & 0x1f) != 9 &&
(state & 0x1f) != 5 && (state & 0x1f) != 1);
if ((state & 0x1f) != 9) { // AUD NAL
data = av_malloc(pkt->size+6);
if (!data)
- return -1;
+ return AVERROR(ENOMEM);
memcpy(data+6, pkt->data, pkt->size);
AV_WB32(data, 0x00000001);
data[4] = 0x09;
@@ -982,36 +1032,38 @@ static int mpegts_write_packet(AVFormatContext *s, AVPacket *pkt)
buf = data;
size = pkt->size+6;
}
- } else if (st->codec->codec_id == CODEC_ID_AAC) {
- if (pkt->size < 2)
- return -1;
+ } else if (st->codec->codec_id == AV_CODEC_ID_AAC) {
+ if (pkt->size < 2) {
+ av_log(s, AV_LOG_ERROR, "AAC packet too short\n");
+ return AVERROR(EINVAL);
+ }
if ((AV_RB16(pkt->data) & 0xfff0) != 0xfff0) {
- ADTSContext *adts = ts_st->adts;
- int new_size, err;
- if (!adts) {
- av_log(s, AV_LOG_ERROR, "aac bitstream not in adts format "
+ int ret;
+ AVPacket pkt2;
+
+ if (!ts_st->amux) {
+ av_log(s, AV_LOG_ERROR, "AAC bitstream not in ADTS format "
"and extradata missing\n");
- return -1;
+ return AVERROR(EINVAL);
}
- new_size = ADTS_HEADER_SIZE+adts->pce_size+pkt->size;
- if ((unsigned)new_size >= INT_MAX)
- return -1;
- data = av_malloc(new_size);
- if (!data)
+
+ av_init_packet(&pkt2);
+ pkt2.data = pkt->data;
+ pkt2.size = pkt->size;
+ ret = avio_open_dyn_buf(&ts_st->amux->pb);
+ if (ret < 0)
return AVERROR(ENOMEM);
- err = ff_adts_write_frame_header(adts, data, pkt->size,
- adts->pce_size);
- if (err < 0) {
+
+ ret = av_write_frame(ts_st->amux, &pkt2);
+ if (ret < 0) {
+ avio_close_dyn_buf(ts_st->amux->pb, &data);
+ ts_st->amux->pb = NULL;
av_free(data);
- return err;
- }
- if (adts->pce_size) {
- memcpy(data+ADTS_HEADER_SIZE, adts->pce_data, adts->pce_size);
- adts->pce_size = 0;
+ return ret;
}
- memcpy(data+ADTS_HEADER_SIZE+adts->pce_size, pkt->data, pkt->size);
+ size = avio_close_dyn_buf(ts_st->amux->pb, &data);
+ ts_st->amux->pb = NULL;
buf = data;
- size = new_size;
}
}
@@ -1051,27 +1103,51 @@ static int mpegts_write_packet(AVFormatContext *s, AVPacket *pkt)
return 0;
}
-static int mpegts_write_end(AVFormatContext *s)
+static void mpegts_write_flush(AVFormatContext *s)
{
- MpegTSWrite *ts = s->priv_data;
- MpegTSWriteStream *ts_st;
- MpegTSService *service;
- AVStream *st;
int i;
/* flush current packets */
for(i = 0; i < s->nb_streams; i++) {
- st = s->streams[i];
- ts_st = st->priv_data;
+ AVStream *st = s->streams[i];
+ MpegTSWriteStream *ts_st = st->priv_data;
if (ts_st->payload_size > 0) {
mpegts_write_pes(s, st, ts_st->payload, ts_st->payload_size,
ts_st->payload_pts, ts_st->payload_dts,
ts_st->payload_flags & AV_PKT_FLAG_KEY);
+ ts_st->payload_size = 0;
}
- av_freep(&ts_st->payload);
- av_freep(&ts_st->adts);
}
avio_flush(s->pb);
+}
+
+static int mpegts_write_packet(AVFormatContext *s, AVPacket *pkt)
+{
+ if (!pkt) {
+ mpegts_write_flush(s);
+ return 1;
+ } else {
+ return mpegts_write_packet_internal(s, pkt);
+ }
+}
+
+static int mpegts_write_end(AVFormatContext *s)
+{
+ MpegTSWrite *ts = s->priv_data;
+ MpegTSService *service;
+ int i;
+
+ mpegts_write_flush(s);
+
+ for(i = 0; i < s->nb_streams; i++) {
+ AVStream *st = s->streams[i];
+ MpegTSWriteStream *ts_st = st->priv_data;
+ av_freep(&ts_st->payload);
+ if (ts_st->amux) {
+ avformat_free_context(ts_st->amux);
+ ts_st->amux = NULL;
+ }
+ }
for(i = 0; i < ts->nb_services; i++) {
service = ts->services[i];
@@ -1086,14 +1162,15 @@ static int mpegts_write_end(AVFormatContext *s)
AVOutputFormat ff_mpegts_muxer = {
.name = "mpegts",
- .long_name = NULL_IF_CONFIG_SMALL("MPEG-2 transport stream format"),
+ .long_name = NULL_IF_CONFIG_SMALL("MPEG-TS (MPEG-2 Transport Stream)"),
.mime_type = "video/x-mpegts",
.extensions = "ts,m2t",
.priv_data_size = sizeof(MpegTSWrite),
- .audio_codec = CODEC_ID_MP2,
- .video_codec = CODEC_ID_MPEG2VIDEO,
+ .audio_codec = AV_CODEC_ID_MP2,
+ .video_codec = AV_CODEC_ID_MPEG2VIDEO,
.write_header = mpegts_write_header,
.write_packet = mpegts_write_packet,
.write_trailer = mpegts_write_end,
- .priv_class = &mpegts_muxer_class,
+ .flags = AVFMT_ALLOW_FLUSH,
+ .priv_class = &mpegts_muxer_class,
};
diff --git a/gst-libs/ext/libav/libavformat/mpegvideodec.c b/gst-libs/ext/libav/libavformat/mpegvideodec.c
index 9fea117..87e5e03 100644
--- a/gst-libs/ext/libav/libavformat/mpegvideodec.c
+++ b/gst-libs/ext/libav/libavformat/mpegvideodec.c
@@ -55,4 +55,4 @@ static int mpegvideo_probe(AVProbeData *p)
return 0;
}
-FF_DEF_RAWVIDEO_DEMUXER(mpegvideo, "raw MPEG video", mpegvideo_probe, NULL, CODEC_ID_MPEG1VIDEO)
+FF_DEF_RAWVIDEO_DEMUXER(mpegvideo, "raw MPEG video", mpegvideo_probe, NULL, AV_CODEC_ID_MPEG1VIDEO)
diff --git a/gst-libs/ext/libav/libavformat/mpjpeg.c b/gst-libs/ext/libav/libavformat/mpjpeg.c
index 79cc272..6c8bd0c 100644
--- a/gst-libs/ext/libav/libavformat/mpjpeg.c
+++ b/gst-libs/ext/libav/libavformat/mpjpeg.c
@@ -55,11 +55,11 @@ static int mpjpeg_write_trailer(AVFormatContext *s)
AVOutputFormat ff_mpjpeg_muxer = {
.name = "mpjpeg",
- .long_name = NULL_IF_CONFIG_SMALL("MIME multipart JPEG format"),
+ .long_name = NULL_IF_CONFIG_SMALL("MIME multipart JPEG"),
.mime_type = "multipart/x-mixed-replace;boundary=" BOUNDARY_TAG,
.extensions = "mjpg",
- .audio_codec = CODEC_ID_NONE,
- .video_codec = CODEC_ID_MJPEG,
+ .audio_codec = AV_CODEC_ID_NONE,
+ .video_codec = AV_CODEC_ID_MJPEG,
.write_header = mpjpeg_write_header,
.write_packet = mpjpeg_write_packet,
.write_trailer = mpjpeg_write_trailer,
diff --git a/gst-libs/ext/libav/libavformat/msnwc_tcp.c b/gst-libs/ext/libav/libavformat/msnwc_tcp.c
index 7e76c07..b6d30fe 100644
--- a/gst-libs/ext/libav/libavformat/msnwc_tcp.c
+++ b/gst-libs/ext/libav/libavformat/msnwc_tcp.c
@@ -70,7 +70,7 @@ static int msnwc_tcp_probe(AVProbeData *p)
return -1;
}
-static int msnwc_tcp_read_header(AVFormatContext *ctx, AVFormatParameters *ap)
+static int msnwc_tcp_read_header(AVFormatContext *ctx)
{
AVIOContext *pb = ctx->pb;
AVCodecContext *codec;
@@ -82,7 +82,7 @@ static int msnwc_tcp_read_header(AVFormatContext *ctx, AVFormatParameters *ap)
codec = st->codec;
codec->codec_type = AVMEDIA_TYPE_VIDEO;
- codec->codec_id = CODEC_ID_MIMIC;
+ codec->codec_id = AV_CODEC_ID_MIMIC;
codec->codec_tag = MKTAG('M', 'L', '2', '0');
avpriv_set_pts_info(st, 32, 1, 1000);
diff --git a/gst-libs/ext/libav/libavformat/mtv.c b/gst-libs/ext/libav/libavformat/mtv.c
index 2243733..1566faa 100644
--- a/gst-libs/ext/libav/libavformat/mtv.c
+++ b/gst-libs/ext/libav/libavformat/mtv.c
@@ -75,7 +75,7 @@ static int mtv_probe(AVProbeData *p)
return AVPROBE_SCORE_MAX;
}
-static int mtv_read_header(AVFormatContext *s, AVFormatParameters *ap)
+static int mtv_read_header(AVFormatContext *s)
{
MTVDemuxContext *mtv = s->priv_data;
AVIOContext *pb = s->pb;
@@ -109,7 +109,7 @@ static int mtv_read_header(AVFormatContext *s, AVFormatParameters *ap)
if (audio_subsegments == 0) {
av_log_ask_for_sample(s, "MTV files without audio are not supported\n");
- return AVERROR_INVALIDDATA;
+ return AVERROR_PATCHWELCOME;
}
mtv->full_segment_size =
@@ -129,8 +129,8 @@ static int mtv_read_header(AVFormatContext *s, AVFormatParameters *ap)
avpriv_set_pts_info(st, 64, 1, mtv->video_fps);
st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
- st->codec->codec_id = CODEC_ID_RAWVIDEO;
- st->codec->pix_fmt = PIX_FMT_RGB565;
+ st->codec->codec_id = AV_CODEC_ID_RAWVIDEO;
+ st->codec->pix_fmt = AV_PIX_FMT_RGB565BE;
st->codec->width = mtv->img_width;
st->codec->height = mtv->img_height;
st->codec->sample_rate = mtv->video_fps;
@@ -145,7 +145,7 @@ static int mtv_read_header(AVFormatContext *s, AVFormatParameters *ap)
avpriv_set_pts_info(st, 64, 1, AUDIO_SAMPLING_RATE);
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
- st->codec->codec_id = CODEC_ID_MP3;
+ st->codec->codec_id = AV_CODEC_ID_MP3;
st->codec->bit_rate = mtv->audio_br;
st->need_parsing = AVSTREAM_PARSE_FULL;
@@ -163,9 +163,6 @@ static int mtv_read_packet(AVFormatContext *s, AVPacket *pkt)
MTVDemuxContext *mtv = s->priv_data;
AVIOContext *pb = s->pb;
int ret;
-#if !HAVE_BIGENDIAN
- int i;
-#endif
if((avio_tell(pb) - s->data_offset + mtv->img_segment_size) % mtv->full_segment_size)
{
@@ -184,17 +181,6 @@ static int mtv_read_packet(AVFormatContext *s, AVPacket *pkt)
if(ret < 0)
return ret;
-#if !HAVE_BIGENDIAN
-
- /* pkt->data is GGGRRRR BBBBBGGG
- * and we need RRRRRGGG GGGBBBBB
- * for PIX_FMT_RGB565 so here we
- * just swap bytes as they come
- */
-
- for(i=0;i<mtv->img_segment_size/2;i++)
- *((uint16_t *)pkt->data+i) = av_bswap16(*((uint16_t *)pkt->data+i));
-#endif
pkt->stream_index = 0;
}
@@ -202,8 +188,8 @@ static int mtv_read_packet(AVFormatContext *s, AVPacket *pkt)
}
AVInputFormat ff_mtv_demuxer = {
- .name = "MTV",
- .long_name = NULL_IF_CONFIG_SMALL("MTV format"),
+ .name = "mtv",
+ .long_name = NULL_IF_CONFIG_SMALL("MTV"),
.priv_data_size = sizeof(MTVDemuxContext),
.read_probe = mtv_probe,
.read_header = mtv_read_header,
diff --git a/gst-libs/ext/libav/libavformat/mux.c b/gst-libs/ext/libav/libavformat/mux.c
new file mode 100644
index 0000000..96eecb5
--- /dev/null
+++ b/gst-libs/ext/libav/libavformat/mux.c
@@ -0,0 +1,602 @@
+/*
+ * muxing functions for use within Libav
+ * Copyright (c) 2000, 2001, 2002 Fabrice Bellard
+ *
+ * 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
+ */
+
+/* #define DEBUG */
+
+#include "avformat.h"
+#include "avio_internal.h"
+#include "internal.h"
+#include "libavcodec/internal.h"
+#include "libavcodec/bytestream.h"
+#include "libavutil/opt.h"
+#include "libavutil/dict.h"
+#include "libavutil/pixdesc.h"
+#include "metadata.h"
+#include "id3v2.h"
+#include "libavutil/avassert.h"
+#include "libavutil/avstring.h"
+#include "libavutil/mathematics.h"
+#include "libavutil/parseutils.h"
+#include "libavutil/time.h"
+#include "riff.h"
+#include "audiointerleave.h"
+#include "url.h"
+#include <stdarg.h>
+#if CONFIG_NETWORK
+#include "network.h"
+#endif
+
+#undef NDEBUG
+#include <assert.h>
+
+/**
+ * @file
+ * muxing functions for use within Libav
+ */
+
+/* fraction handling */
+
+/**
+ * f = val + (num / den) + 0.5.
+ *
+ * 'num' is normalized so that it is such as 0 <= num < den.
+ *
+ * @param f fractional number
+ * @param val integer value
+ * @param num must be >= 0
+ * @param den must be >= 1
+ */
+static void frac_init(AVFrac *f, int64_t val, int64_t num, int64_t den)
+{
+ num += (den >> 1);
+ if (num >= den) {
+ val += num / den;
+ num = num % den;
+ }
+ f->val = val;
+ f->num = num;
+ f->den = den;
+}
+
+/**
+ * Fractional addition to f: f = f + (incr / f->den).
+ *
+ * @param f fractional number
+ * @param incr increment, can be positive or negative
+ */
+static void frac_add(AVFrac *f, int64_t incr)
+{
+ int64_t num, den;
+
+ num = f->num + incr;
+ den = f->den;
+ if (num < 0) {
+ f->val += num / den;
+ num = num % den;
+ if (num < 0) {
+ num += den;
+ f->val--;
+ }
+ } else if (num >= den) {
+ f->val += num / den;
+ num = num % den;
+ }
+ f->num = num;
+}
+
+static int validate_codec_tag(AVFormatContext *s, AVStream *st)
+{
+ const AVCodecTag *avctag;
+ int n;
+ enum AVCodecID id = AV_CODEC_ID_NONE;
+ unsigned int tag = 0;
+
+ /**
+ * Check that tag + id is in the table
+ * If neither is in the table -> OK
+ * If tag is in the table with another id -> FAIL
+ * If id is in the table with another tag -> FAIL unless strict < normal
+ */
+ for (n = 0; s->oformat->codec_tag[n]; n++) {
+ avctag = s->oformat->codec_tag[n];
+ while (avctag->id != AV_CODEC_ID_NONE) {
+ if (avpriv_toupper4(avctag->tag) == avpriv_toupper4(st->codec->codec_tag)) {
+ id = avctag->id;
+ if (id == st->codec->codec_id)
+ return 1;
+ }
+ if (avctag->id == st->codec->codec_id)
+ tag = avctag->tag;
+ avctag++;
+ }
+ }
+ if (id != AV_CODEC_ID_NONE)
+ return 0;
+ if (tag && (st->codec->strict_std_compliance >= FF_COMPLIANCE_NORMAL))
+ return 0;
+ return 1;
+}
+
+
+static int init_muxer(AVFormatContext *s, AVDictionary **options)
+{
+ int ret = 0, i;
+ AVStream *st;
+ AVDictionary *tmp = NULL;
+ AVCodecContext *codec = NULL;
+ AVOutputFormat *of = s->oformat;
+
+ if (options)
+ av_dict_copy(&tmp, *options, 0);
+
+ if ((ret = av_opt_set_dict(s, &tmp)) < 0)
+ goto fail;
+
+ // some sanity checks
+ if (s->nb_streams == 0 && !(of->flags & AVFMT_NOSTREAMS)) {
+ av_log(s, AV_LOG_ERROR, "no streams\n");
+ ret = AVERROR(EINVAL);
+ goto fail;
+ }
+
+ for (i = 0; i < s->nb_streams; i++) {
+ st = s->streams[i];
+ codec = st->codec;
+
+ switch (codec->codec_type) {
+ case AVMEDIA_TYPE_AUDIO:
+ if (codec->sample_rate <= 0) {
+ av_log(s, AV_LOG_ERROR, "sample rate not set\n");
+ ret = AVERROR(EINVAL);
+ goto fail;
+ }
+ if (!codec->block_align)
+ codec->block_align = codec->channels *
+ av_get_bits_per_sample(codec->codec_id) >> 3;
+ break;
+ case AVMEDIA_TYPE_VIDEO:
+ if (codec->time_base.num <= 0 ||
+ codec->time_base.den <= 0) { //FIXME audio too?
+ av_log(s, AV_LOG_ERROR, "time base not set\n");
+ ret = AVERROR(EINVAL);
+ goto fail;
+ }
+
+ if ((codec->width <= 0 || codec->height <= 0) &&
+ !(of->flags & AVFMT_NODIMENSIONS)) {
+ av_log(s, AV_LOG_ERROR, "dimensions not set\n");
+ ret = AVERROR(EINVAL);
+ goto fail;
+ }
+
+ if (av_cmp_q(st->sample_aspect_ratio,
+ codec->sample_aspect_ratio)) {
+ av_log(s, AV_LOG_ERROR, "Aspect ratio mismatch between muxer "
+ "(%d/%d) and encoder layer (%d/%d)\n",
+ st->sample_aspect_ratio.num, st->sample_aspect_ratio.den,
+ codec->sample_aspect_ratio.num,
+ codec->sample_aspect_ratio.den);
+ ret = AVERROR(EINVAL);
+ goto fail;
+ }
+ break;
+ }
+
+ if (of->codec_tag) {
+ if (codec->codec_tag &&
+ codec->codec_id == AV_CODEC_ID_RAWVIDEO &&
+ !av_codec_get_tag(of->codec_tag, codec->codec_id) &&
+ !validate_codec_tag(s, st)) {
+ // the current rawvideo encoding system ends up setting
+ // the wrong codec_tag for avi, we override it here
+ codec->codec_tag = 0;
+ }
+ if (codec->codec_tag) {
+ if (!validate_codec_tag(s, st)) {
+ char tagbuf[32];
+ av_get_codec_tag_string(tagbuf, sizeof(tagbuf), codec->codec_tag);
+ av_log(s, AV_LOG_ERROR,
+ "Tag %s/0x%08x incompatible with output codec id '%d'\n",
+ tagbuf, codec->codec_tag, codec->codec_id);
+ ret = AVERROR_INVALIDDATA;
+ goto fail;
+ }
+ } else
+ codec->codec_tag = av_codec_get_tag(of->codec_tag, codec->codec_id);
+ }
+
+ if (of->flags & AVFMT_GLOBALHEADER &&
+ !(codec->flags & CODEC_FLAG_GLOBAL_HEADER))
+ av_log(s, AV_LOG_WARNING,
+ "Codec for stream %d does not use global headers "
+ "but container format requires global headers\n", i);
+ }
+
+ if (!s->priv_data && of->priv_data_size > 0) {
+ s->priv_data = av_mallocz(of->priv_data_size);
+ if (!s->priv_data) {
+ ret = AVERROR(ENOMEM);
+ goto fail;
+ }
+ if (of->priv_class) {
+ *(const AVClass **)s->priv_data = of->priv_class;
+ av_opt_set_defaults(s->priv_data);
+ if ((ret = av_opt_set_dict(s->priv_data, &tmp)) < 0)
+ goto fail;
+ }
+ }
+
+ /* set muxer identification string */
+ if (s->nb_streams && !(s->streams[0]->codec->flags & CODEC_FLAG_BITEXACT)) {
+ av_dict_set(&s->metadata, "encoder", LIBAVFORMAT_IDENT, 0);
+ }
+
+ if (options) {
+ av_dict_free(options);
+ *options = tmp;
+ }
+
+ return 0;
+
+fail:
+ av_dict_free(&tmp);
+ return ret;
+}
+
+static int init_pts(AVFormatContext *s)
+{
+ int i;
+ AVStream *st;
+
+ /* init PTS generation */
+ for (i = 0; i < s->nb_streams; i++) {
+ int64_t den = AV_NOPTS_VALUE;
+ st = s->streams[i];
+
+ switch (st->codec->codec_type) {
+ case AVMEDIA_TYPE_AUDIO:
+ den = (int64_t)st->time_base.num * st->codec->sample_rate;
+ break;
+ case AVMEDIA_TYPE_VIDEO:
+ den = (int64_t)st->time_base.num * st->codec->time_base.den;
+ break;
+ default:
+ break;
+ }
+ if (den != AV_NOPTS_VALUE) {
+ if (den <= 0)
+ return AVERROR_INVALIDDATA;
+
+ frac_init(&st->pts, 0, 0, den);
+ }
+ }
+
+ return 0;
+}
+
+int avformat_write_header(AVFormatContext *s, AVDictionary **options)
+{
+ int ret = 0;
+
+ if (ret = init_muxer(s, options))
+ return ret;
+
+ if (s->oformat->write_header) {
+ ret = s->oformat->write_header(s);
+ if (ret < 0)
+ return ret;
+ }
+
+ if ((ret = init_pts(s) < 0))
+ return ret;
+
+ return 0;
+}
+
+//FIXME merge with compute_pkt_fields
+static int compute_pkt_fields2(AVFormatContext *s, AVStream *st, AVPacket *pkt)
+{
+ int delay = FFMAX(st->codec->has_b_frames, !!st->codec->max_b_frames);
+ int num, den, frame_size, i;
+
+ av_dlog(s, "compute_pkt_fields2: pts:%" PRId64 " dts:%" PRId64 " cur_dts:%" PRId64 " b:%d size:%d st:%d\n",
+ pkt->pts, pkt->dts, st->cur_dts, delay, pkt->size, pkt->stream_index);
+
+/* if(pkt->pts == AV_NOPTS_VALUE && pkt->dts == AV_NOPTS_VALUE)
+ * return AVERROR(EINVAL);*/
+
+ /* duration field */
+ if (pkt->duration == 0) {
+ ff_compute_frame_duration(&num, &den, st, NULL, pkt);
+ if (den && num) {
+ pkt->duration = av_rescale(1, num * (int64_t)st->time_base.den * st->codec->ticks_per_frame, den * (int64_t)st->time_base.num);
+ }
+ }
+
+ if (pkt->pts == AV_NOPTS_VALUE && pkt->dts != AV_NOPTS_VALUE && delay == 0)
+ pkt->pts = pkt->dts;
+
+ //XXX/FIXME this is a temporary hack until all encoders output pts
+ if ((pkt->pts == 0 || pkt->pts == AV_NOPTS_VALUE) && pkt->dts == AV_NOPTS_VALUE && !delay) {
+ pkt->dts =
+// pkt->pts= st->cur_dts;
+ pkt->pts = st->pts.val;
+ }
+
+ //calculate dts from pts
+ if (pkt->pts != AV_NOPTS_VALUE && pkt->dts == AV_NOPTS_VALUE && delay <= MAX_REORDER_DELAY) {
+ st->pts_buffer[0] = pkt->pts;
+ for (i = 1; i < delay + 1 && st->pts_buffer[i] == AV_NOPTS_VALUE; i++)
+ st->pts_buffer[i] = pkt->pts + (i - delay - 1) * pkt->duration;
+ for (i = 0; i<delay && st->pts_buffer[i] > st->pts_buffer[i + 1]; i++)
+ FFSWAP(int64_t, st->pts_buffer[i], st->pts_buffer[i + 1]);
+
+ pkt->dts = st->pts_buffer[0];
+ }
+
+ if (st->cur_dts && st->cur_dts != AV_NOPTS_VALUE &&
+ ((!(s->oformat->flags & AVFMT_TS_NONSTRICT) &&
+ st->cur_dts >= pkt->dts) || st->cur_dts > pkt->dts)) {
+ av_log(s, AV_LOG_ERROR,
+ "Application provided invalid, non monotonically increasing dts to muxer in stream %d: %" PRId64 " >= %" PRId64 "\n",
+ st->index, st->cur_dts, pkt->dts);
+ return AVERROR(EINVAL);
+ }
+ if (pkt->dts != AV_NOPTS_VALUE && pkt->pts != AV_NOPTS_VALUE && pkt->pts < pkt->dts) {
+ av_log(s, AV_LOG_ERROR, "pts < dts in stream %d\n", st->index);
+ return AVERROR(EINVAL);
+ }
+
+ av_dlog(s, "av_write_frame: pts2:%"PRId64" dts2:%"PRId64"\n",
+ pkt->pts, pkt->dts);
+ st->cur_dts = pkt->dts;
+ st->pts.val = pkt->dts;
+
+ /* update pts */
+ switch (st->codec->codec_type) {
+ case AVMEDIA_TYPE_AUDIO:
+ frame_size = ff_get_audio_frame_size(st->codec, pkt->size, 1);
+
+ /* HACK/FIXME, we skip the initial 0 size packets as they are most
+ * likely equal to the encoder delay, but it would be better if we
+ * had the real timestamps from the encoder */
+ if (frame_size >= 0 && (pkt->size || st->pts.num != st->pts.den >> 1 || st->pts.val)) {
+ frac_add(&st->pts, (int64_t)st->time_base.den * frame_size);
+ }
+ break;
+ case AVMEDIA_TYPE_VIDEO:
+ frac_add(&st->pts, (int64_t)st->time_base.den * st->codec->time_base.num);
+ break;
+ default:
+ break;
+ }
+ return 0;
+}
+
+int av_write_frame(AVFormatContext *s, AVPacket *pkt)
+{
+ int ret;
+
+ if (!pkt) {
+ if (s->oformat->flags & AVFMT_ALLOW_FLUSH)
+ return s->oformat->write_packet(s, pkt);
+ return 1;
+ }
+
+ ret = compute_pkt_fields2(s, s->streams[pkt->stream_index], pkt);
+
+ if (ret < 0 && !(s->oformat->flags & AVFMT_NOTIMESTAMPS))
+ return ret;
+
+ ret = s->oformat->write_packet(s, pkt);
+
+ if (ret >= 0)
+ s->streams[pkt->stream_index]->nb_frames++;
+ return ret;
+}
+
+void ff_interleave_add_packet(AVFormatContext *s, AVPacket *pkt,
+ int (*compare)(AVFormatContext *, AVPacket *, AVPacket *))
+{
+ AVPacketList **next_point, *this_pktl;
+
+ this_pktl = av_mallocz(sizeof(AVPacketList));
+ this_pktl->pkt = *pkt;
+ pkt->destruct = NULL; // do not free original but only the copy
+ av_dup_packet(&this_pktl->pkt); // duplicate the packet if it uses non-alloced memory
+
+ if (s->streams[pkt->stream_index]->last_in_packet_buffer) {
+ next_point = &(s->streams[pkt->stream_index]->last_in_packet_buffer->next);
+ } else
+ next_point = &s->packet_buffer;
+
+ if (*next_point) {
+ if (compare(s, &s->packet_buffer_end->pkt, pkt)) {
+ while (!compare(s, &(*next_point)->pkt, pkt))
+ next_point = &(*next_point)->next;
+ goto next_non_null;
+ } else {
+ next_point = &(s->packet_buffer_end->next);
+ }
+ }
+ assert(!*next_point);
+
+ s->packet_buffer_end = this_pktl;
+next_non_null:
+
+ this_pktl->next = *next_point;
+
+ s->streams[pkt->stream_index]->last_in_packet_buffer =
+ *next_point = this_pktl;
+}
+
+static int ff_interleave_compare_dts(AVFormatContext *s, AVPacket *next, AVPacket *pkt)
+{
+ AVStream *st = s->streams[pkt->stream_index];
+ AVStream *st2 = s->streams[next->stream_index];
+ int comp = av_compare_ts(next->dts, st2->time_base, pkt->dts,
+ st->time_base);
+
+ if (comp == 0)
+ return pkt->stream_index < next->stream_index;
+ return comp > 0;
+}
+
+int ff_interleave_packet_per_dts(AVFormatContext *s, AVPacket *out,
+ AVPacket *pkt, int flush)
+{
+ AVPacketList *pktl;
+ int stream_count = 0;
+ int i;
+
+ if (pkt) {
+ ff_interleave_add_packet(s, pkt, ff_interleave_compare_dts);
+ }
+
+ for (i = 0; i < s->nb_streams; i++)
+ stream_count += !!s->streams[i]->last_in_packet_buffer;
+
+ if (stream_count && (s->nb_streams == stream_count || flush)) {
+ pktl = s->packet_buffer;
+ *out = pktl->pkt;
+
+ s->packet_buffer = pktl->next;
+ if (!s->packet_buffer)
+ s->packet_buffer_end = NULL;
+
+ if (s->streams[out->stream_index]->last_in_packet_buffer == pktl)
+ s->streams[out->stream_index]->last_in_packet_buffer = NULL;
+ av_freep(&pktl);
+ return 1;
+ } else {
+ av_init_packet(out);
+ return 0;
+ }
+}
+
+#if FF_API_INTERLEAVE_PACKET
+int av_interleave_packet_per_dts(AVFormatContext *s, AVPacket *out,
+ AVPacket *pkt, int flush)
+{
+ return ff_interleave_packet_per_dts(s, out, pkt, flush);
+}
+
+#endif
+
+/**
+ * Interleave an AVPacket correctly so it can be muxed.
+ * @param out the interleaved packet will be output here
+ * @param in the input packet
+ * @param flush 1 if no further packets are available as input and all
+ * remaining packets should be output
+ * @return 1 if a packet was output, 0 if no packet could be output,
+ * < 0 if an error occurred
+ */
+static int interleave_packet(AVFormatContext *s, AVPacket *out, AVPacket *in, int flush)
+{
+ if (s->oformat->interleave_packet) {
+ int ret = s->oformat->interleave_packet(s, out, in, flush);
+ if (in)
+ av_free_packet(in);
+ return ret;
+ } else
+ return ff_interleave_packet_per_dts(s, out, in, flush);
+}
+
+int av_interleaved_write_frame(AVFormatContext *s, AVPacket *pkt)
+{
+ int ret, flush = 0;
+
+ if (pkt) {
+ AVStream *st = s->streams[pkt->stream_index];
+
+ //FIXME/XXX/HACK drop zero sized packets
+ if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO && pkt->size == 0)
+ return 0;
+
+ av_dlog(s, "av_interleaved_write_frame size:%d dts:%" PRId64 " pts:%" PRId64 "\n",
+ pkt->size, pkt->dts, pkt->pts);
+ if ((ret = compute_pkt_fields2(s, st, pkt)) < 0 && !(s->oformat->flags & AVFMT_NOTIMESTAMPS))
+ return ret;
+
+ if (pkt->dts == AV_NOPTS_VALUE && !(s->oformat->flags & AVFMT_NOTIMESTAMPS))
+ return AVERROR(EINVAL);
+ } else {
+ av_dlog(s, "av_interleaved_write_frame FLUSH\n");
+ flush = 1;
+ }
+
+ for (;; ) {
+ AVPacket opkt;
+ int ret = interleave_packet(s, &opkt, pkt, flush);
+ if (ret <= 0) //FIXME cleanup needed for ret<0 ?
+ return ret;
+
+ ret = s->oformat->write_packet(s, &opkt);
+ if (ret >= 0)
+ s->streams[opkt.stream_index]->nb_frames++;
+
+ av_free_packet(&opkt);
+ pkt = NULL;
+
+ if (ret < 0)
+ return ret;
+ }
+}
+
+int av_write_trailer(AVFormatContext *s)
+{
+ int ret, i;
+
+ for (;; ) {
+ AVPacket pkt;
+ ret = interleave_packet(s, &pkt, NULL, 1);
+ if (ret < 0) //FIXME cleanup needed for ret<0 ?
+ goto fail;
+ if (!ret)
+ break;
+
+ ret = s->oformat->write_packet(s, &pkt);
+ if (ret >= 0)
+ s->streams[pkt.stream_index]->nb_frames++;
+
+ av_free_packet(&pkt);
+
+ if (ret < 0)
+ goto fail;
+ }
+
+ if (s->oformat->write_trailer)
+ ret = s->oformat->write_trailer(s);
+
+ if (!(s->oformat->flags & AVFMT_NOFILE))
+ avio_flush(s->pb);
+
+fail:
+ for (i = 0; i < s->nb_streams; i++) {
+ av_freep(&s->streams[i]->priv_data);
+ av_freep(&s->streams[i]->index_entries);
+ }
+ if (s->oformat->priv_class)
+ av_opt_free(s->priv_data);
+ av_freep(&s->priv_data);
+ return ret;
+}
diff --git a/gst-libs/ext/libav/libavformat/mvi.c b/gst-libs/ext/libav/libavformat/mvi.c
index 4782aad..10ec8bb 100644
--- a/gst-libs/ext/libav/libavformat/mvi.c
+++ b/gst-libs/ext/libav/libavformat/mvi.c
@@ -19,6 +19,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "libavutil/channel_layout.h"
#include "avformat.h"
#include "internal.h"
@@ -36,7 +37,7 @@ typedef struct MviDemuxContext {
int video_frame_size;
} MviDemuxContext;
-static int read_header(AVFormatContext *s, AVFormatParameters *ap)
+static int read_header(AVFormatContext *s)
{
MviDemuxContext *mvi = s->priv_data;
AVIOContext *pb = s->pb;
@@ -79,14 +80,15 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap)
avpriv_set_pts_info(ast, 64, 1, ast->codec->sample_rate);
ast->codec->codec_type = AVMEDIA_TYPE_AUDIO;
- ast->codec->codec_id = CODEC_ID_PCM_U8;
+ ast->codec->codec_id = AV_CODEC_ID_PCM_U8;
ast->codec->channels = 1;
+ ast->codec->channel_layout = AV_CH_LAYOUT_MONO;
ast->codec->bits_per_coded_sample = 8;
ast->codec->bit_rate = ast->codec->sample_rate * 8;
avpriv_set_pts_info(vst, 64, msecs_per_frame, 1000000);
vst->codec->codec_type = AVMEDIA_TYPE_VIDEO;
- vst->codec->codec_id = CODEC_ID_MOTIONPIXELS;
+ vst->codec->codec_id = AV_CODEC_ID_MOTIONPIXELS;
mvi->get_int = (vst->codec->width * vst->codec->height < (1 << 16)) ? avio_rl16 : avio_rl24;
@@ -126,9 +128,9 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
AVInputFormat ff_mvi_demuxer = {
.name = "mvi",
- .long_name = NULL_IF_CONFIG_SMALL("Motion Pixels MVI format"),
+ .long_name = NULL_IF_CONFIG_SMALL("Motion Pixels MVI"),
.priv_data_size = sizeof(MviDemuxContext),
.read_header = read_header,
.read_packet = read_packet,
- .extensions = "mvi"
+ .extensions = "mvi",
};
diff --git a/gst-libs/ext/libav/libavformat/mxf.c b/gst-libs/ext/libav/libavformat/mxf.c
index e4d9fbd..040d8a2 100644
--- a/gst-libs/ext/libav/libavformat/mxf.c
+++ b/gst-libs/ext/libav/libavformat/mxf.c
@@ -33,30 +33,36 @@ const MXFCodecUL ff_mxf_data_definition_uls[] = {
const MXFCodecUL ff_mxf_codec_uls[] = {
/* PictureEssenceCoding */
- { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x03,0x04,0x01,0x02,0x02,0x01,0x01,0x11,0x00 }, 14, CODEC_ID_MPEG2VIDEO }, /* MP@ML Long GoP */
- { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x04,0x01,0x02,0x02,0x01,0x02,0x01,0x01 }, 14, CODEC_ID_MPEG2VIDEO }, /* D-10 50Mbps PAL */
- { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x03,0x04,0x01,0x02,0x02,0x01,0x03,0x03,0x00 }, 14, CODEC_ID_MPEG2VIDEO }, /* MP@HL Long GoP */
- { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x03,0x04,0x01,0x02,0x02,0x01,0x04,0x02,0x00 }, 14, CODEC_ID_MPEG2VIDEO }, /* 422P@HL I-Frame */
- { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x03,0x04,0x01,0x02,0x02,0x01,0x20,0x02,0x03 }, 14, CODEC_ID_MPEG4 }, /* XDCAM proxy_pal030926.mxf */
- { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x04,0x01,0x02,0x02,0x02,0x01,0x02,0x00 }, 13, CODEC_ID_DVVIDEO }, /* DV25 IEC PAL */
- { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x07,0x04,0x01,0x02,0x02,0x03,0x01,0x01,0x00 }, 14, CODEC_ID_JPEG2000 }, /* JPEG2000 Codestream */
- { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x04,0x01,0x02,0x01,0x7F,0x00,0x00,0x00 }, 13, CODEC_ID_RAWVIDEO }, /* Uncompressed */
- { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x04,0x01,0x02,0x02,0x03,0x02,0x00,0x00 }, 14, CODEC_ID_DNXHD }, /* SMPTE VC-3/DNxHD */
- { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x0A,0x04,0x01,0x02,0x02,0x01,0x32,0x00,0x00 }, 14, CODEC_ID_H264 }, /* H.264/MPEG-4 AVC Intra */
- { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x0A,0x04,0x01,0x02,0x01,0x01,0x02,0x02,0x00 }, 15, CODEC_ID_V210 }, /* V210 */
+ { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x03,0x04,0x01,0x02,0x02,0x01,0x01,0x11,0x00 }, 14, AV_CODEC_ID_MPEG2VIDEO }, /* MP@ML Long GoP */
+ { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x04,0x01,0x02,0x02,0x01,0x02,0x01,0x01 }, 14, AV_CODEC_ID_MPEG2VIDEO }, /* D-10 50Mbps PAL */
+ { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x03,0x04,0x01,0x02,0x02,0x01,0x03,0x03,0x00 }, 14, AV_CODEC_ID_MPEG2VIDEO }, /* MP@HL Long GoP */
+ { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x03,0x04,0x01,0x02,0x02,0x01,0x04,0x02,0x00 }, 14, AV_CODEC_ID_MPEG2VIDEO }, /* 422P@HL I-Frame */
+ { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x03,0x04,0x01,0x02,0x02,0x01,0x20,0x02,0x03 }, 14, AV_CODEC_ID_MPEG4 }, /* XDCAM proxy_pal030926.mxf */
+ { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x04,0x01,0x02,0x02,0x02,0x01,0x02,0x00 }, 13, AV_CODEC_ID_DVVIDEO }, /* DV25 IEC PAL */
+ { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x07,0x04,0x01,0x02,0x02,0x03,0x01,0x01,0x00 }, 14, AV_CODEC_ID_JPEG2000 }, /* JPEG2000 Codestream */
+ { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x04,0x01,0x02,0x01,0x7F,0x00,0x00,0x00 }, 13, AV_CODEC_ID_RAWVIDEO }, /* Uncompressed */
+ { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x04,0x01,0x02,0x02,0x03,0x02,0x00,0x00 }, 14, AV_CODEC_ID_DNXHD }, /* SMPTE VC-3/DNxHD */
+ { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x0A,0x04,0x01,0x02,0x02,0x01,0x32,0x00,0x00 }, 14, AV_CODEC_ID_H264 }, /* H.264/MPEG-4 AVC Intra */
+ { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x0A,0x04,0x01,0x02,0x01,0x01,0x02,0x02,0x00 }, 15, AV_CODEC_ID_V210 }, /* V210 */
/* SoundEssenceCompression */
- { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x04,0x02,0x02,0x01,0x00,0x00,0x00,0x00 }, 13, CODEC_ID_PCM_S16LE }, /* Uncompressed */
- { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x04,0x02,0x02,0x01,0x7F,0x00,0x00,0x00 }, 13, CODEC_ID_PCM_S16LE },
- { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x07,0x04,0x02,0x02,0x01,0x7E,0x00,0x00,0x00 }, 13, CODEC_ID_PCM_S16BE }, /* From Omneon MXF file */
- { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x04,0x04,0x02,0x02,0x02,0x03,0x01,0x01,0x00 }, 15, CODEC_ID_PCM_ALAW }, /* XDCAM Proxy C0023S01.mxf */
- { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x04,0x02,0x02,0x02,0x03,0x02,0x01,0x00 }, 15, CODEC_ID_AC3 },
- { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x04,0x02,0x02,0x02,0x03,0x02,0x05,0x00 }, 15, CODEC_ID_MP2 }, /* MP2 or MP3 */
- //{ { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x04,0x02,0x02,0x02,0x03,0x02,0x1C,0x00 }, 15, CODEC_ID_DOLBY_E }, /* Dolby-E */
- { { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }, 0, CODEC_ID_NONE },
+ { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x04,0x02,0x02,0x01,0x00,0x00,0x00,0x00 }, 13, AV_CODEC_ID_PCM_S16LE }, /* Uncompressed */
+ { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x04,0x02,0x02,0x01,0x7F,0x00,0x00,0x00 }, 13, AV_CODEC_ID_PCM_S16LE },
+ { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x07,0x04,0x02,0x02,0x01,0x7E,0x00,0x00,0x00 }, 13, AV_CODEC_ID_PCM_S16BE }, /* From Omneon MXF file */
+ { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x04,0x04,0x02,0x02,0x02,0x03,0x01,0x01,0x00 }, 15, AV_CODEC_ID_PCM_ALAW }, /* XDCAM Proxy C0023S01.mxf */
+ { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x04,0x02,0x02,0x02,0x03,0x02,0x01,0x00 }, 15, AV_CODEC_ID_AC3 },
+ { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x04,0x02,0x02,0x02,0x03,0x02,0x05,0x00 }, 15, AV_CODEC_ID_MP2 }, /* MP2 or MP3 */
+ //{ { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x04,0x02,0x02,0x02,0x03,0x02,0x1C,0x00 }, 15, AV_CODEC_ID_DOLBY_E }, /* Dolby-E */
+ { { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }, 0, AV_CODEC_ID_NONE },
+};
+
+const MXFCodecUL ff_mxf_pixel_format_uls[] = {
+ { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x0A,0x04,0x01,0x02,0x01,0x01,0x02,0x01,0x01 }, 16, AV_PIX_FMT_UYVY422 },
+ { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x0A,0x04,0x01,0x02,0x01,0x01,0x02,0x01,0x02 }, 16, AV_PIX_FMT_YUYV422 },
+ { { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }, 0, AV_PIX_FMT_NONE },
};
static const struct {
- enum PixelFormat pix_fmt;
+ enum AVPixelFormat pix_fmt;
const char data[16];
} ff_mxf_pixel_layouts[] = {
/**
@@ -68,24 +74,24 @@ static const struct {
* Note: Do not use these for encoding descriptors for little-endian formats until we
* get samples or official word from SMPTE on how/if those can be encoded.
*/
- {PIX_FMT_ABGR, {'A', 8, 'B', 8, 'G', 8, 'R', 8 }},
- {PIX_FMT_ARGB, {'A', 8, 'R', 8, 'G', 8, 'B', 8 }},
- {PIX_FMT_BGR24, {'B', 8, 'G', 8, 'R', 8 }},
- {PIX_FMT_BGRA, {'B', 8, 'G', 8, 'R', 8, 'A', 8 }},
- {PIX_FMT_RGB24, {'R', 8, 'G', 8, 'B', 8 }},
- {PIX_FMT_RGB444BE,{'F', 4, 'R', 4, 'G', 4, 'B', 4 }},
- {PIX_FMT_RGB48BE, {'R', 8, 'r', 8, 'G', 8, 'g', 8, 'B', 8, 'b', 8 }},
- {PIX_FMT_RGB48BE, {'R', 16, 'G', 16, 'B', 16 }},
- {PIX_FMT_RGB48LE, {'r', 8, 'R', 8, 'g', 8, 'G', 8, 'b', 8, 'B', 8 }},
- {PIX_FMT_RGB555BE,{'F', 1, 'R', 5, 'G', 5, 'B', 5 }},
- {PIX_FMT_RGB565BE,{'R', 5, 'G', 6, 'B', 5 }},
- {PIX_FMT_RGBA, {'R', 8, 'G', 8, 'B', 8, 'A', 8 }},
- {PIX_FMT_PAL8, {'P', 8 }},
+ {AV_PIX_FMT_ABGR, {'A', 8, 'B', 8, 'G', 8, 'R', 8 }},
+ {AV_PIX_FMT_ARGB, {'A', 8, 'R', 8, 'G', 8, 'B', 8 }},
+ {AV_PIX_FMT_BGR24, {'B', 8, 'G', 8, 'R', 8 }},
+ {AV_PIX_FMT_BGRA, {'B', 8, 'G', 8, 'R', 8, 'A', 8 }},
+ {AV_PIX_FMT_RGB24, {'R', 8, 'G', 8, 'B', 8 }},
+ {AV_PIX_FMT_RGB444BE,{'F', 4, 'R', 4, 'G', 4, 'B', 4 }},
+ {AV_PIX_FMT_RGB48BE, {'R', 8, 'r', 8, 'G', 8, 'g', 8, 'B', 8, 'b', 8 }},
+ {AV_PIX_FMT_RGB48BE, {'R', 16, 'G', 16, 'B', 16 }},
+ {AV_PIX_FMT_RGB48LE, {'r', 8, 'R', 8, 'g', 8, 'G', 8, 'b', 8, 'B', 8 }},
+ {AV_PIX_FMT_RGB555BE,{'F', 1, 'R', 5, 'G', 5, 'B', 5 }},
+ {AV_PIX_FMT_RGB565BE,{'R', 5, 'G', 6, 'B', 5 }},
+ {AV_PIX_FMT_RGBA, {'R', 8, 'G', 8, 'B', 8, 'A', 8 }},
+ {AV_PIX_FMT_PAL8, {'P', 8 }},
};
static const int num_pixel_layouts = FF_ARRAY_ELEMS(ff_mxf_pixel_layouts);
-int ff_mxf_decode_pixel_layout(const char pixel_layout[16], enum PixelFormat *pix_fmt)
+int ff_mxf_decode_pixel_layout(const char pixel_layout[16], enum AVPixelFormat *pix_fmt)
{
int x;
diff --git a/gst-libs/ext/libav/libavformat/mxf.h b/gst-libs/ext/libav/libavformat/mxf.h
index beb6628..773f30f 100644
--- a/gst-libs/ext/libav/libavformat/mxf.h
+++ b/gst-libs/ext/libav/libavformat/mxf.h
@@ -46,13 +46,21 @@ enum MXFMetadataSetType {
TypeBottom,// add metadata type before this
};
-typedef struct {
+enum MXFFrameLayout {
+ FullFrame = 0,
+ MixedFields,
+ OneField,
+ SegmentedFrame,
+ SeparateFields
+};
+
+typedef struct KLVPacket {
UID key;
int64_t offset;
uint64_t length;
} KLVPacket;
-typedef struct {
+typedef struct MXFCodecUL {
UID uid;
unsigned matching_len;
int id;
@@ -60,8 +68,9 @@ typedef struct {
extern const MXFCodecUL ff_mxf_data_definition_uls[];
extern const MXFCodecUL ff_mxf_codec_uls[];
+extern const MXFCodecUL ff_mxf_pixel_format_uls[];
-int ff_mxf_decode_pixel_layout(const char pixel_layout[16], enum PixelFormat *pix_fmt);
+int ff_mxf_decode_pixel_layout(const char pixel_layout[16], enum AVPixelFormat *pix_fmt);
#define PRINT_KEY(pc, s, x) av_dlog(pc, "%s %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X\n", s, \
(x)[0], (x)[1], (x)[2], (x)[3], (x)[4], (x)[5], (x)[6], (x)[7], (x)[8], (x)[9], (x)[10], (x)[11], (x)[12], (x)[13], (x)[14], (x)[15])
diff --git a/gst-libs/ext/libav/libavformat/mxfdec.c b/gst-libs/ext/libav/libavformat/mxfdec.c
index cb2ae86..18f7b26 100644
--- a/gst-libs/ext/libav/libavformat/mxfdec.c
+++ b/gst-libs/ext/libav/libavformat/mxfdec.c
@@ -52,6 +52,42 @@
#include "internal.h"
#include "mxf.h"
+typedef enum {
+ Header,
+ BodyPartition,
+ Footer
+} MXFPartitionType;
+
+typedef enum {
+ OP1a = 1,
+ OP1b,
+ OP1c,
+ OP2a,
+ OP2b,
+ OP2c,
+ OP3a,
+ OP3b,
+ OP3c,
+ OPAtom,
+ OPSonyOpt, /* FATE sample, violates the spec in places */
+} MXFOP;
+
+typedef struct {
+ int closed;
+ int complete;
+ MXFPartitionType type;
+ uint64_t previous_partition;
+ int index_sid;
+ int body_sid;
+ int64_t this_partition;
+ int64_t essence_offset; ///< absolute offset of essence
+ int64_t essence_length;
+ int32_t kag_size;
+ int64_t header_byte_count;
+ int64_t index_byte_count;
+ int pack_length;
+} MXFPartition;
+
typedef struct {
UID uid;
enum MXFMetadataSetType type;
@@ -85,6 +121,7 @@ typedef struct {
int track_id;
uint8_t track_number[4];
AVRational edit_rate;
+ int intra_only;
} MXFTrack;
typedef struct {
@@ -95,20 +132,34 @@ typedef struct {
AVRational sample_rate;
AVRational aspect_ratio;
int width;
- int height;
+ int height; /* Field height, not frame height */
+ int frame_layout; /* See MXFFrameLayout enum */
int channels;
int bits_per_sample;
+ unsigned int component_depth;
+ unsigned int horiz_subsampling;
+ unsigned int vert_subsampling;
UID *sub_descriptors_refs;
int sub_descriptors_count;
int linked_track_id;
uint8_t *extradata;
int extradata_size;
- enum PixelFormat pix_fmt;
+ enum AVPixelFormat pix_fmt;
} MXFDescriptor;
typedef struct {
UID uid;
enum MXFMetadataSetType type;
+ int edit_unit_byte_count;
+ int index_sid;
+ int body_sid;
+ AVRational index_edit_rate;
+ uint64_t index_start_position;
+ uint64_t index_duration;
+ int8_t *temporal_offset_entries;
+ int *flag_entries;
+ uint64_t *stream_offset_entries;
+ int nb_index_entries;
} MXFIndexTableSegment;
typedef struct {
@@ -126,7 +177,22 @@ typedef struct {
enum MXFMetadataSetType type;
} MXFMetadataSet;
+/* decoded index table */
+typedef struct {
+ int index_sid;
+ int body_sid;
+ int nb_ptses; /* number of PTSes or total duration of index */
+ int64_t first_dts; /* DTS = EditUnit + first_dts */
+ int64_t *ptses; /* maps EditUnit -> PTS */
+ int nb_segments;
+ MXFIndexTableSegment **segments; /* sorted by IndexStartPosition */
+ AVIndexEntry *fake_index; /* used for calling ff_index_search_timestamp() */
+} MXFIndexTable;
+
typedef struct {
+ MXFPartition *partitions;
+ unsigned partitions_count;
+ MXFOP op;
UID *packages_refs;
int packages_count;
MXFMetadataSet **metadata_sets;
@@ -135,6 +201,18 @@ typedef struct {
struct AVAES *aesc;
uint8_t *local_tags;
int local_tags_count;
+ uint64_t footer_partition;
+ KLVPacket current_klv_data;
+ int current_klv_index;
+ int run_in;
+ MXFPartition *current_partition;
+ int parsing_backward;
+ int64_t last_forward_tell;
+ int last_forward_partition;
+ int current_edit_unit;
+ int nb_index_tables;
+ MXFIndexTable *index_tables;
+ int edit_units_per_packet; ///< how many edit units to read at a time (PCM, OPAtom)
} MXFContext;
enum MXFWrappingScheme {
@@ -142,7 +220,8 @@ enum MXFWrappingScheme {
Clip,
};
-typedef int MXFMetadataReadFunc(void *arg, AVIOContext *pb, int tag, int size, UID uid);
+/* NOTE: klv_offset is not set (-1) for local keys */
+typedef int MXFMetadataReadFunc(void *arg, AVIOContext *pb, int tag, int size, UID uid, int64_t klv_offset);
typedef struct {
const UID key;
@@ -154,6 +233,8 @@ typedef struct {
/* partial keys to match */
static const uint8_t mxf_header_partition_pack_key[] = { 0x06,0x0e,0x2b,0x34,0x02,0x05,0x01,0x01,0x0d,0x01,0x02,0x01,0x01,0x02 };
static const uint8_t mxf_essence_element_key[] = { 0x06,0x0e,0x2b,0x34,0x01,0x02,0x01,0x01,0x0d,0x01,0x03,0x01 };
+static const uint8_t mxf_avid_essence_element_key[] = { 0x06,0x0e,0x2b,0x34,0x01,0x02,0x01,0x01,0x0e,0x04,0x03,0x01 };
+static const uint8_t mxf_system_item_key[] = { 0x06,0x0E,0x2B,0x34,0x02,0x05,0x01,0x01,0x0D,0x01,0x03,0x01,0x04 };
static const uint8_t mxf_klv_key[] = { 0x06,0x0e,0x2b,0x34 };
/* complete keys to match */
static const uint8_t mxf_crypto_source_container_ul[] = { 0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x09,0x06,0x01,0x01,0x02,0x02,0x00,0x00,0x00 };
@@ -259,7 +340,7 @@ static int mxf_decrypt_triplet(AVFormatContext *s, AVPacket *pkt, KLVPacket *klv
int index;
if (!mxf->aesc && s->key && s->keylen == 16) {
- mxf->aesc = av_malloc(av_aes_size);
+ mxf->aesc = av_aes_alloc();
if (!mxf->aesc)
return AVERROR(ENOMEM);
av_aes_init(mxf->aesc, s->key, 128, 1);
@@ -308,54 +389,7 @@ static int mxf_decrypt_triplet(AVFormatContext *s, AVPacket *pkt, KLVPacket *klv
return 0;
}
-static int mxf_read_packet(AVFormatContext *s, AVPacket *pkt)
-{
- KLVPacket klv;
-
- while (!s->pb->eof_reached) {
- int ret;
- if (klv_read_packet(&klv, s->pb) < 0)
- return -1;
- PRINT_KEY(s, "read packet", klv.key);
- av_dlog(s, "size %"PRIu64" offset %#"PRIx64"\n", klv.length, klv.offset);
- if (IS_KLV_KEY(klv.key, mxf_encrypted_triplet_key)) {
- ret = mxf_decrypt_triplet(s, pkt, &klv);
- if (ret < 0) {
- av_log(s, AV_LOG_ERROR, "invalid encoded triplet\n");
- return AVERROR_INVALIDDATA;
- }
- return 0;
- }
- if (IS_KLV_KEY(klv.key, mxf_essence_element_key)) {
- int index = mxf_get_stream_index(s, &klv);
- if (index < 0) {
- av_log(s, AV_LOG_ERROR, "error getting stream index %d\n", AV_RB32(klv.key+12));
- goto skip;
- }
- if (s->streams[index]->discard == AVDISCARD_ALL)
- goto skip;
- /* check for 8 channels AES3 element */
- if (klv.key[12] == 0x06 && klv.key[13] == 0x01 && klv.key[14] == 0x10) {
- if (mxf_get_d10_aes3_packet(s->pb, s->streams[index], pkt, klv.length) < 0) {
- av_log(s, AV_LOG_ERROR, "error reading D-10 aes3 frame\n");
- return AVERROR_INVALIDDATA;
- }
- } else {
- ret = av_get_packet(s->pb, pkt, klv.length);
- if (ret < 0)
- return ret;
- }
- pkt->stream_index = index;
- pkt->pos = klv.offset;
- return 0;
- } else
- skip:
- avio_skip(s->pb, klv.length);
- }
- return AVERROR_EOF;
-}
-
-static int mxf_read_primer_pack(void *arg, AVIOContext *pb, int tag, int size, UID uid)
+static int mxf_read_primer_pack(void *arg, AVIOContext *pb, int tag, int size, UID uid, int64_t klv_offset)
{
MXFContext *mxf = arg;
int item_num = avio_rb32(pb);
@@ -376,19 +410,158 @@ static int mxf_read_primer_pack(void *arg, AVIOContext *pb, int tag, int size, U
return 0;
}
+static int mxf_read_partition_pack(void *arg, AVIOContext *pb, int tag, int size, UID uid, int64_t klv_offset)
+{
+ MXFContext *mxf = arg;
+ MXFPartition *partition, *tmp_part;
+ UID op;
+ uint64_t footer_partition;
+ uint32_t nb_essence_containers;
+
+ if (mxf->partitions_count+1 >= UINT_MAX / sizeof(*mxf->partitions))
+ return AVERROR(ENOMEM);
+
+ tmp_part = av_realloc(mxf->partitions, (mxf->partitions_count + 1) * sizeof(*mxf->partitions));
+ if (!tmp_part)
+ return AVERROR(ENOMEM);
+ mxf->partitions = tmp_part;
+
+ if (mxf->parsing_backward) {
+ /* insert the new partition pack in the middle
+ * this makes the entries in mxf->partitions sorted by offset */
+ memmove(&mxf->partitions[mxf->last_forward_partition+1],
+ &mxf->partitions[mxf->last_forward_partition],
+ (mxf->partitions_count - mxf->last_forward_partition)*sizeof(*mxf->partitions));
+ partition = mxf->current_partition = &mxf->partitions[mxf->last_forward_partition];
+ } else {
+ mxf->last_forward_partition++;
+ partition = mxf->current_partition = &mxf->partitions[mxf->partitions_count];
+ }
+
+ memset(partition, 0, sizeof(*partition));
+ mxf->partitions_count++;
+ partition->pack_length = avio_tell(pb) - klv_offset + size;
+
+ switch(uid[13]) {
+ case 2:
+ partition->type = Header;
+ break;
+ case 3:
+ partition->type = BodyPartition;
+ break;
+ case 4:
+ partition->type = Footer;
+ break;
+ default:
+ av_log(mxf->fc, AV_LOG_ERROR, "unknown partition type %i\n", uid[13]);
+ return AVERROR_INVALIDDATA;
+ }
+
+ /* consider both footers to be closed (there is only Footer and CompleteFooter) */
+ partition->closed = partition->type == Footer || !(uid[14] & 1);
+ partition->complete = uid[14] > 2;
+ avio_skip(pb, 4);
+ partition->kag_size = avio_rb32(pb);
+ partition->this_partition = avio_rb64(pb);
+ partition->previous_partition = avio_rb64(pb);
+ footer_partition = avio_rb64(pb);
+ partition->header_byte_count = avio_rb64(pb);
+ partition->index_byte_count = avio_rb64(pb);
+ partition->index_sid = avio_rb32(pb);
+ avio_skip(pb, 8);
+ partition->body_sid = avio_rb32(pb);
+ avio_read(pb, op, sizeof(UID));
+ nb_essence_containers = avio_rb32(pb);
+
+ /* some files don'thave FooterPartition set in every partition */
+ if (footer_partition) {
+ if (mxf->footer_partition && mxf->footer_partition != footer_partition) {
+ av_log(mxf->fc, AV_LOG_ERROR,
+ "inconsistent FooterPartition value: %"PRIu64" != %"PRIu64"\n",
+ mxf->footer_partition, footer_partition);
+ } else {
+ mxf->footer_partition = footer_partition;
+ }
+ }
+
+ av_dlog(mxf->fc,
+ "PartitionPack: ThisPartition = 0x%"PRIX64
+ ", PreviousPartition = 0x%"PRIX64", "
+ "FooterPartition = 0x%"PRIX64", IndexSID = %i, BodySID = %i\n",
+ partition->this_partition,
+ partition->previous_partition, footer_partition,
+ partition->index_sid, partition->body_sid);
+
+ /* sanity check PreviousPartition if set */
+ if (partition->previous_partition &&
+ mxf->run_in + partition->previous_partition >= klv_offset) {
+ av_log(mxf->fc, AV_LOG_ERROR,
+ "PreviousPartition points to this partition or forward\n");
+ return AVERROR_INVALIDDATA;
+ }
+
+ if (op[12] == 1 && op[13] == 1) mxf->op = OP1a;
+ else if (op[12] == 1 && op[13] == 2) mxf->op = OP1b;
+ else if (op[12] == 1 && op[13] == 3) mxf->op = OP1c;
+ else if (op[12] == 2 && op[13] == 1) mxf->op = OP2a;
+ else if (op[12] == 2 && op[13] == 2) mxf->op = OP2b;
+ else if (op[12] == 2 && op[13] == 3) mxf->op = OP2c;
+ else if (op[12] == 3 && op[13] == 1) mxf->op = OP3a;
+ else if (op[12] == 3 && op[13] == 2) mxf->op = OP3b;
+ else if (op[12] == 3 && op[13] == 3) mxf->op = OP3c;
+ else if (op[12] == 64&& op[13] == 1) mxf->op = OPSonyOpt;
+ else if (op[12] == 0x10) {
+ /* SMPTE 390m: "There shall be exactly one essence container"
+ * The following block deals with files that violate this, namely:
+ * 2011_DCPTEST_24FPS.V.mxf - two ECs, OP1a
+ * abcdefghiv016f56415e.mxf - zero ECs, OPAtom, output by Avid AirSpeed */
+ if (nb_essence_containers != 1) {
+ MXFOP op = nb_essence_containers ? OP1a : OPAtom;
+
+ /* only nag once */
+ if (!mxf->op)
+ av_log(mxf->fc, AV_LOG_WARNING,
+ "\"OPAtom\" with %u ECs - assuming %s\n",
+ nb_essence_containers,
+ op == OP1a ? "OP1a" : "OPAtom");
+
+ mxf->op = op;
+ } else
+ mxf->op = OPAtom;
+ } else {
+ av_log(mxf->fc, AV_LOG_ERROR, "unknown operational pattern: %02xh %02xh - guessing OP1a\n", op[12], op[13]);
+ mxf->op = OP1a;
+ }
+
+ if (partition->kag_size <= 0 || partition->kag_size > (1 << 20)) {
+ av_log(mxf->fc, AV_LOG_WARNING, "invalid KAGSize %i - guessing ", partition->kag_size);
+
+ if (mxf->op == OPSonyOpt)
+ partition->kag_size = 512;
+ else
+ partition->kag_size = 1;
+
+ av_log(mxf->fc, AV_LOG_WARNING, "%i\n", partition->kag_size);
+ }
+
+ return 0;
+}
+
static int mxf_add_metadata_set(MXFContext *mxf, void *metadata_set)
{
+ MXFMetadataSet **tmp;
if (mxf->metadata_sets_count+1 >= UINT_MAX / sizeof(*mxf->metadata_sets))
return AVERROR(ENOMEM);
- mxf->metadata_sets = av_realloc(mxf->metadata_sets, (mxf->metadata_sets_count + 1) * sizeof(*mxf->metadata_sets));
- if (!mxf->metadata_sets)
+ tmp = av_realloc(mxf->metadata_sets, (mxf->metadata_sets_count + 1) * sizeof(*mxf->metadata_sets));
+ if (!tmp)
return AVERROR(ENOMEM);
+ mxf->metadata_sets = tmp;
mxf->metadata_sets[mxf->metadata_sets_count] = metadata_set;
mxf->metadata_sets_count++;
return 0;
}
-static int mxf_read_cryptographic_context(void *arg, AVIOContext *pb, int tag, int size, UID uid)
+static int mxf_read_cryptographic_context(void *arg, AVIOContext *pb, int tag, int size, UID uid, int64_t klv_offset)
{
MXFCryptoContext *cryptocontext = arg;
if (size != 16)
@@ -398,7 +571,7 @@ static int mxf_read_cryptographic_context(void *arg, AVIOContext *pb, int tag, i
return 0;
}
-static int mxf_read_content_storage(void *arg, AVIOContext *pb, int tag, int size, UID uid)
+static int mxf_read_content_storage(void *arg, AVIOContext *pb, int tag, int size, UID uid, int64_t klv_offset)
{
MXFContext *mxf = arg;
switch (tag) {
@@ -416,7 +589,7 @@ static int mxf_read_content_storage(void *arg, AVIOContext *pb, int tag, int siz
return 0;
}
-static int mxf_read_source_clip(void *arg, AVIOContext *pb, int tag, int size, UID uid)
+static int mxf_read_source_clip(void *arg, AVIOContext *pb, int tag, int size, UID uid, int64_t klv_offset)
{
MXFStructuralComponent *source_clip = arg;
switch(tag) {
@@ -438,7 +611,7 @@ static int mxf_read_source_clip(void *arg, AVIOContext *pb, int tag, int size, U
return 0;
}
-static int mxf_read_material_package(void *arg, AVIOContext *pb, int tag, int size, UID uid)
+static int mxf_read_material_package(void *arg, AVIOContext *pb, int tag, int size, UID uid, int64_t klv_offset)
{
MXFPackage *package = arg;
switch(tag) {
@@ -456,7 +629,7 @@ static int mxf_read_material_package(void *arg, AVIOContext *pb, int tag, int si
return 0;
}
-static int mxf_read_track(void *arg, AVIOContext *pb, int tag, int size, UID uid)
+static int mxf_read_track(void *arg, AVIOContext *pb, int tag, int size, UID uid, int64_t klv_offset)
{
MXFTrack *track = arg;
switch(tag) {
@@ -467,8 +640,8 @@ static int mxf_read_track(void *arg, AVIOContext *pb, int tag, int size, UID uid
avio_read(pb, track->track_number, 4);
break;
case 0x4B01:
- track->edit_rate.den = avio_rb32(pb);
track->edit_rate.num = avio_rb32(pb);
+ track->edit_rate.den = avio_rb32(pb);
break;
case 0x4803:
avio_read(pb, track->sequence_ref, 16);
@@ -477,7 +650,7 @@ static int mxf_read_track(void *arg, AVIOContext *pb, int tag, int size, UID uid
return 0;
}
-static int mxf_read_sequence(void *arg, AVIOContext *pb, int tag, int size, UID uid)
+static int mxf_read_sequence(void *arg, AVIOContext *pb, int tag, int size, UID uid, int64_t klv_offset)
{
MXFSequence *sequence = arg;
switch(tag) {
@@ -501,7 +674,7 @@ static int mxf_read_sequence(void *arg, AVIOContext *pb, int tag, int size, UID
return 0;
}
-static int mxf_read_source_package(void *arg, AVIOContext *pb, int tag, int size, UID uid)
+static int mxf_read_source_package(void *arg, AVIOContext *pb, int tag, int size, UID uid, int64_t klv_offset)
{
MXFPackage *package = arg;
switch(tag) {
@@ -527,15 +700,78 @@ static int mxf_read_source_package(void *arg, AVIOContext *pb, int tag, int size
return 0;
}
-static int mxf_read_index_table_segment(void *arg, AVIOContext *pb, int tag, int size, UID uid)
+static int mxf_read_index_entry_array(AVIOContext *pb, MXFIndexTableSegment *segment)
{
+ int i, length;
+
+ segment->nb_index_entries = avio_rb32(pb);
+ if (!segment->nb_index_entries)
+ return 0;
+ else if (segment->nb_index_entries < 0 ||
+ segment->nb_index_entries >
+ (INT_MAX / sizeof(*segment->stream_offset_entries)))
+ return AVERROR(ENOMEM);
+
+ length = avio_rb32(pb);
+
+ segment->temporal_offset_entries = av_mallocz(segment->nb_index_entries *
+ sizeof(*segment->temporal_offset_entries));
+ segment->flag_entries = av_mallocz(segment->nb_index_entries *
+ sizeof(*segment->flag_entries));
+ segment->stream_offset_entries = av_mallocz(segment->nb_index_entries *
+ sizeof(*segment->stream_offset_entries));
+
+ if (!segment->flag_entries || !segment->stream_offset_entries ||
+ !segment->temporal_offset_entries) {
+ av_freep(&segment->flag_entries);
+ av_freep(&segment->stream_offset_entries);
+ av_freep(&segment->temporal_offset_entries);
+ return AVERROR(ENOMEM);
+ }
+
+ for (i = 0; i < segment->nb_index_entries; i++) {
+ segment->temporal_offset_entries[i] = avio_r8(pb);
+ avio_r8(pb); /* KeyFrameOffset */
+ segment->flag_entries[i] = avio_r8(pb);
+ segment->stream_offset_entries[i] = avio_rb64(pb);
+ avio_skip(pb, length - 11);
+ }
+ return 0;
+}
+
+static int mxf_read_index_table_segment(void *arg, AVIOContext *pb, int tag, int size, UID uid, int64_t klv_offset)
+{
+ MXFIndexTableSegment *segment = arg;
switch(tag) {
- case 0x3F05: av_dlog(NULL, "EditUnitByteCount %d\n", avio_rb32(pb)); break;
- case 0x3F06: av_dlog(NULL, "IndexSID %d\n", avio_rb32(pb)); break;
- case 0x3F07: av_dlog(NULL, "BodySID %d\n", avio_rb32(pb)); break;
- case 0x3F0B: av_dlog(NULL, "IndexEditRate %d/%d\n", avio_rb32(pb), avio_rb32(pb)); break;
- case 0x3F0C: av_dlog(NULL, "IndexStartPosition %"PRIu64"\n", avio_rb64(pb)); break;
- case 0x3F0D: av_dlog(NULL, "IndexDuration %"PRIu64"\n", avio_rb64(pb)); break;
+ case 0x3F05:
+ segment->edit_unit_byte_count = avio_rb32(pb);
+ av_dlog(NULL, "EditUnitByteCount %d\n", segment->edit_unit_byte_count);
+ break;
+ case 0x3F06:
+ segment->index_sid = avio_rb32(pb);
+ av_dlog(NULL, "IndexSID %d\n", segment->index_sid);
+ break;
+ case 0x3F07:
+ segment->body_sid = avio_rb32(pb);
+ av_dlog(NULL, "BodySID %d\n", segment->body_sid);
+ break;
+ case 0x3F0A:
+ av_dlog(NULL, "IndexEntryArray found\n");
+ return mxf_read_index_entry_array(pb, segment);
+ case 0x3F0B:
+ segment->index_edit_rate.num = avio_rb32(pb);
+ segment->index_edit_rate.den = avio_rb32(pb);
+ av_dlog(NULL, "IndexEditRate %d/%d\n", segment->index_edit_rate.num,
+ segment->index_edit_rate.den);
+ break;
+ case 0x3F0C:
+ segment->index_start_position = avio_rb64(pb);
+ av_dlog(NULL, "IndexStartPosition %"PRId64"\n", segment->index_start_position);
+ break;
+ case 0x3F0D:
+ segment->index_duration = avio_rb64(pb);
+ av_dlog(NULL, "IndexDuration %"PRId64"\n", segment->index_duration);
+ break;
}
return 0;
}
@@ -559,9 +795,10 @@ static void mxf_read_pixel_layout(AVIOContext *pb, MXFDescriptor *descriptor)
ff_mxf_decode_pixel_layout(layout, &descriptor->pix_fmt);
}
-static int mxf_read_generic_descriptor(void *arg, AVIOContext *pb, int tag, int size, UID uid)
+static int mxf_read_generic_descriptor(void *arg, AVIOContext *pb, int tag, int size, UID uid, int64_t klv_offset)
{
MXFDescriptor *descriptor = arg;
+ descriptor->pix_fmt = AV_PIX_FMT_NONE;
switch(tag) {
case 0x3F01:
descriptor->sub_descriptors_count = avio_rb32(pb);
@@ -588,10 +825,22 @@ static int mxf_read_generic_descriptor(void *arg, AVIOContext *pb, int tag, int
case 0x3202:
descriptor->height = avio_rb32(pb);
break;
+ case 0x320C:
+ descriptor->frame_layout = avio_r8(pb);
+ break;
case 0x320E:
descriptor->aspect_ratio.num = avio_rb32(pb);
descriptor->aspect_ratio.den = avio_rb32(pb);
break;
+ case 0x3301:
+ descriptor->component_depth = avio_rb32(pb);
+ break;
+ case 0x3302:
+ descriptor->horiz_subsampling = avio_rb32(pb);
+ break;
+ case 0x3308:
+ descriptor->vert_subsampling = avio_rb32(pb);
+ break;
case 0x3D03:
descriptor->sample_rate.num = avio_rb32(pb);
descriptor->sample_rate.den = avio_rb32(pb);
@@ -661,22 +910,414 @@ static void *mxf_resolve_strong_ref(MXFContext *mxf, UID *strong_ref, enum MXFMe
return NULL;
}
-static const MXFCodecUL mxf_essence_container_uls[] = {
+static const MXFCodecUL mxf_picture_essence_container_uls[] = {
// video essence container uls
- { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x02,0x0D,0x01,0x03,0x01,0x02,0x04,0x60,0x01 }, 14, CODEC_ID_MPEG2VIDEO }, /* MPEG-ES Frame wrapped */
- { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x0D,0x01,0x03,0x01,0x02,0x02,0x41,0x01 }, 14, CODEC_ID_DVVIDEO }, /* DV 625 25mbps */
+ { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x02,0x0D,0x01,0x03,0x01,0x02,0x04,0x60,0x01 }, 14, AV_CODEC_ID_MPEG2VIDEO }, /* MPEG-ES Frame wrapped */
+ { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x0D,0x01,0x03,0x01,0x02,0x02,0x41,0x01 }, 14, AV_CODEC_ID_DVVIDEO }, /* DV 625 25mbps */
+ { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x0D,0x01,0x03,0x01,0x02,0x05,0x00,0x00 }, 14, AV_CODEC_ID_RAWVIDEO }, /* Uncompressed Picture */
+ { { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }, 0, AV_CODEC_ID_NONE },
+};
+
+/* EC ULs for intra-only formats */
+static const MXFCodecUL mxf_intra_only_essence_container_uls[] = {
+ { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x0D,0x01,0x03,0x01,0x02,0x01,0x00,0x00 }, 14, AV_CODEC_ID_MPEG2VIDEO }, /* MXF-GC SMPTE D-10 Mappings */
+ { { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }, 0, AV_CODEC_ID_NONE },
+};
+
+/* intra-only PictureEssenceCoding ULs, where no corresponding EC UL exists */
+static const MXFCodecUL mxf_intra_only_picture_essence_coding_uls[] = {
+ { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x0A,0x04,0x01,0x02,0x02,0x01,0x32,0x00,0x00 }, 14, AV_CODEC_ID_H264 }, /* H.264/MPEG-4 AVC Intra Profiles */
+ { { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }, 0, AV_CODEC_ID_NONE },
+};
+
+static const MXFCodecUL mxf_sound_essence_container_uls[] = {
// sound essence container uls
- { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x0D,0x01,0x03,0x01,0x02,0x06,0x01,0x00 }, 14, CODEC_ID_PCM_S16LE }, /* BWF Frame wrapped */
- { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x02,0x0D,0x01,0x03,0x01,0x02,0x04,0x40,0x01 }, 14, CODEC_ID_MP2 }, /* MPEG-ES Frame wrapped, 0x40 ??? stream id */
- { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x0D,0x01,0x03,0x01,0x02,0x01,0x01,0x01 }, 14, CODEC_ID_PCM_S16LE }, /* D-10 Mapping 50Mbps PAL Extended Template */
- { { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }, 0, CODEC_ID_NONE },
+ { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x0D,0x01,0x03,0x01,0x02,0x06,0x01,0x00 }, 14, AV_CODEC_ID_PCM_S16LE }, /* BWF Frame wrapped */
+ { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x02,0x0D,0x01,0x03,0x01,0x02,0x04,0x40,0x01 }, 14, AV_CODEC_ID_MP2 }, /* MPEG-ES Frame wrapped, 0x40 ??? stream id */
+ { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x0D,0x01,0x03,0x01,0x02,0x01,0x01,0x01 }, 14, AV_CODEC_ID_PCM_S16LE }, /* D-10 Mapping 50Mbps PAL Extended Template */
+ { { 0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0xFF,0x4B,0x46,0x41,0x41,0x00,0x0D,0x4D,0x4F }, 14, AV_CODEC_ID_PCM_S16LE }, /* 0001GL00.MXF.A1.mxf_opatom.mxf */
+ { { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }, 0, AV_CODEC_ID_NONE },
};
+static int mxf_get_sorted_table_segments(MXFContext *mxf, int *nb_sorted_segments, MXFIndexTableSegment ***sorted_segments)
+{
+ int i, j, nb_segments = 0;
+ MXFIndexTableSegment **unsorted_segments;
+ int last_body_sid = -1, last_index_sid = -1, last_index_start = -1;
+
+ /* count number of segments, allocate arrays and copy unsorted segments */
+ for (i = 0; i < mxf->metadata_sets_count; i++)
+ if (mxf->metadata_sets[i]->type == IndexTableSegment)
+ nb_segments++;
+
+ if (!nb_segments)
+ return AVERROR_INVALIDDATA;
+
+ *sorted_segments = av_mallocz(nb_segments * sizeof(**sorted_segments));
+ unsorted_segments = av_mallocz(nb_segments * sizeof(*unsorted_segments));
+ if (!*sorted_segments || !unsorted_segments) {
+ av_freep(sorted_segments);
+ av_free(unsorted_segments);
+ return AVERROR(ENOMEM);
+ }
+
+ for (i = j = 0; i < mxf->metadata_sets_count; i++)
+ if (mxf->metadata_sets[i]->type == IndexTableSegment)
+ unsorted_segments[j++] = (MXFIndexTableSegment*)mxf->metadata_sets[i];
+
+ *nb_sorted_segments = 0;
+
+ /* sort segments by {BodySID, IndexSID, IndexStartPosition}, remove duplicates while we're at it */
+ for (i = 0; i < nb_segments; i++) {
+ int best = -1, best_body_sid = -1, best_index_sid = -1, best_index_start = -1;
+
+ for (j = 0; j < nb_segments; j++) {
+ MXFIndexTableSegment *s = unsorted_segments[j];
+
+ /* Require larger BosySID, IndexSID or IndexStartPosition then the previous entry. This removes duplicates.
+ * We want the smallest values for the keys than what we currently have, unless this is the first such entry this time around.
+ */
+ if ((i == 0 || s->body_sid > last_body_sid || s->index_sid > last_index_sid || s->index_start_position > last_index_start) &&
+ (best == -1 || s->body_sid < best_body_sid || s->index_sid < best_index_sid || s->index_start_position < best_index_start)) {
+ best = j;
+ best_body_sid = s->body_sid;
+ best_index_sid = s->index_sid;
+ best_index_start = s->index_start_position;
+ }
+ }
+
+ /* no suitable entry found -> we're done */
+ if (best == -1)
+ break;
+
+ (*sorted_segments)[(*nb_sorted_segments)++] = unsorted_segments[best];
+ last_body_sid = best_body_sid;
+ last_index_sid = best_index_sid;
+ last_index_start = best_index_start;
+ }
+
+ av_free(unsorted_segments);
+
+ return 0;
+}
+
+/**
+ * Computes the absolute file offset of the given essence container offset
+ */
+static int mxf_absolute_bodysid_offset(MXFContext *mxf, int body_sid, int64_t offset, int64_t *offset_out)
+{
+ int x;
+ int64_t offset_in = offset; /* for logging */
+
+ for (x = 0; x < mxf->partitions_count; x++) {
+ MXFPartition *p = &mxf->partitions[x];
+
+ if (p->body_sid != body_sid)
+ continue;
+
+ if (offset < p->essence_length || !p->essence_length) {
+ *offset_out = p->essence_offset + offset;
+ return 0;
+ }
+
+ offset -= p->essence_length;
+ }
+
+ av_log(mxf->fc, AV_LOG_ERROR,
+ "failed to find absolute offset of %"PRIX64" in BodySID %i - partial file?\n",
+ offset_in, body_sid);
+
+ return AVERROR_INVALIDDATA;
+}
+
+/**
+ * Returns the end position of the essence container with given BodySID, or zero if unknown
+ */
+static int64_t mxf_essence_container_end(MXFContext *mxf, int body_sid)
+{
+ int x;
+ int64_t ret = 0;
+
+ for (x = 0; x < mxf->partitions_count; x++) {
+ MXFPartition *p = &mxf->partitions[x];
+
+ if (p->body_sid != body_sid)
+ continue;
+
+ if (!p->essence_length)
+ return 0;
+
+ ret = p->essence_offset + p->essence_length;
+ }
+
+ return ret;
+}
+
+/* EditUnit -> absolute offset */
+static int mxf_edit_unit_absolute_offset(MXFContext *mxf, MXFIndexTable *index_table, int64_t edit_unit, int64_t *edit_unit_out, int64_t *offset_out, int nag)
+{
+ int i;
+ int64_t offset_temp = 0;
+
+ for (i = 0; i < index_table->nb_segments; i++) {
+ MXFIndexTableSegment *s = index_table->segments[i];
+
+ edit_unit = FFMAX(edit_unit, s->index_start_position); /* clamp if trying to seek before start */
+
+ if (edit_unit < s->index_start_position + s->index_duration) {
+ int64_t index = edit_unit - s->index_start_position;
+
+ if (s->edit_unit_byte_count)
+ offset_temp += s->edit_unit_byte_count * index;
+ else if (s->nb_index_entries) {
+ if (s->nb_index_entries == 2 * s->index_duration + 1)
+ index *= 2; /* Avid index */
+
+ if (index < 0 || index >= s->nb_index_entries) {
+ av_log(mxf->fc, AV_LOG_ERROR, "IndexSID %i segment at %"PRId64" IndexEntryArray too small\n",
+ index_table->index_sid, s->index_start_position);
+ return AVERROR_INVALIDDATA;
+ }
+
+ offset_temp = s->stream_offset_entries[index];
+ } else {
+ av_log(mxf->fc, AV_LOG_ERROR, "IndexSID %i segment at %"PRId64" missing EditUnitByteCount and IndexEntryArray\n",
+ index_table->index_sid, s->index_start_position);
+ return AVERROR_INVALIDDATA;
+ }
+
+ if (edit_unit_out)
+ *edit_unit_out = edit_unit;
+
+ return mxf_absolute_bodysid_offset(mxf, index_table->body_sid, offset_temp, offset_out);
+ } else {
+ /* EditUnitByteCount == 0 for VBR indexes, which is fine since they use explicit StreamOffsets */
+ offset_temp += s->edit_unit_byte_count * s->index_duration;
+ }
+ }
+
+ if (nag)
+ av_log(mxf->fc, AV_LOG_ERROR, "failed to map EditUnit %"PRId64" in IndexSID %i to an offset\n", edit_unit, index_table->index_sid);
+
+ return AVERROR_INVALIDDATA;
+}
+
+static int mxf_compute_ptses_fake_index(MXFContext *mxf, MXFIndexTable *index_table)
+{
+ int i, j, x;
+ int8_t max_temporal_offset = -128;
+
+ /* first compute how many entries we have */
+ for (i = 0; i < index_table->nb_segments; i++) {
+ MXFIndexTableSegment *s = index_table->segments[i];
+
+ if (!s->nb_index_entries) {
+ index_table->nb_ptses = 0;
+ return 0; /* no TemporalOffsets */
+ }
+
+ index_table->nb_ptses += s->index_duration;
+ }
+
+ /* paranoid check */
+ if (index_table->nb_ptses <= 0)
+ return 0;
+
+ if (index_table->nb_ptses > INT_MAX / sizeof(AVIndexEntry))
+ return AVERROR(ENOMEM);
+
+ index_table->ptses = av_mallocz(index_table->nb_ptses *
+ sizeof(int64_t));
+ index_table->fake_index = av_mallocz(index_table->nb_ptses *
+ sizeof(AVIndexEntry));
+ if (!index_table->ptses || !index_table->fake_index) {
+ av_freep(&index_table->ptses);
+ return AVERROR(ENOMEM);
+ }
+
+ /* we may have a few bad TemporalOffsets
+ * make sure the corresponding PTSes don't have the bogus value 0 */
+ for (x = 0; x < index_table->nb_ptses; x++)
+ index_table->ptses[x] = AV_NOPTS_VALUE;
+
+ /**
+ * We have this:
+ *
+ * x TemporalOffset
+ * 0: 0
+ * 1: 1
+ * 2: 1
+ * 3: -2
+ * 4: 1
+ * 5: 1
+ * 6: -2
+ *
+ * We want to transform it into this:
+ *
+ * x DTS PTS
+ * 0: -1 0
+ * 1: 0 3
+ * 2: 1 1
+ * 3: 2 2
+ * 4: 3 6
+ * 5: 4 4
+ * 6: 5 5
+ *
+ * We do this by bucket sorting x by x+TemporalOffset[x] into mxf->ptses,
+ * then settings mxf->first_dts = -max(TemporalOffset[x]).
+ * The latter makes DTS <= PTS.
+ */
+ for (i = x = 0; i < index_table->nb_segments; i++) {
+ MXFIndexTableSegment *s = index_table->segments[i];
+ int index_delta = 1;
+ int n = s->nb_index_entries;
+
+ if (s->nb_index_entries == 2 * s->index_duration + 1) {
+ index_delta = 2; /* Avid index */
+ /* ignore the last entry - it's the size of the essence container */
+ n--;
+ }
+
+ for (j = 0; j < n; j += index_delta, x++) {
+ int offset = s->temporal_offset_entries[j] / index_delta;
+ int index = x + offset;
+
+ if (x >= index_table->nb_ptses) {
+ av_log(mxf->fc, AV_LOG_ERROR,
+ "x >= nb_ptses - IndexEntryCount %i < IndexDuration %"PRId64"?\n",
+ s->nb_index_entries, s->index_duration);
+ break;
+ }
+
+ index_table->fake_index[x].timestamp = x;
+ index_table->fake_index[x].flags = !(s->flag_entries[j] & 0x30) ? AVINDEX_KEYFRAME : 0;
+
+ if (index < 0 || index >= index_table->nb_ptses) {
+ av_log(mxf->fc, AV_LOG_ERROR,
+ "index entry %i + TemporalOffset %i = %i, which is out of bounds\n",
+ x, offset, index);
+ continue;
+ }
+
+ index_table->ptses[index] = x;
+ max_temporal_offset = FFMAX(max_temporal_offset, offset);
+ }
+ }
+
+ index_table->first_dts = -max_temporal_offset;
+
+ return 0;
+}
+
+/**
+ * Sorts and collects index table segments into index tables.
+ * Also computes PTSes if possible.
+ */
+static int mxf_compute_index_tables(MXFContext *mxf)
+{
+ int i, j, k, ret, nb_sorted_segments;
+ MXFIndexTableSegment **sorted_segments = NULL;
+
+ if ((ret = mxf_get_sorted_table_segments(mxf, &nb_sorted_segments, &sorted_segments)) ||
+ nb_sorted_segments <= 0) {
+ av_log(mxf->fc, AV_LOG_WARNING, "broken or empty index\n");
+ return 0;
+ }
+
+ /* sanity check and count unique BodySIDs/IndexSIDs */
+ for (i = 0; i < nb_sorted_segments; i++) {
+ if (i == 0 || sorted_segments[i-1]->index_sid != sorted_segments[i]->index_sid)
+ mxf->nb_index_tables++;
+ else if (sorted_segments[i-1]->body_sid != sorted_segments[i]->body_sid) {
+ av_log(mxf->fc, AV_LOG_ERROR, "found inconsistent BodySID\n");
+ ret = AVERROR_INVALIDDATA;
+ goto finish_decoding_index;
+ }
+ }
+
+ if (mxf->nb_index_tables > INT_MAX / sizeof(MXFIndexTable) ||
+ !(mxf->index_tables = av_mallocz(mxf->nb_index_tables *
+ sizeof(MXFIndexTable)))) {
+ av_log(mxf->fc, AV_LOG_ERROR, "failed to allocate index tables\n");
+ ret = AVERROR(ENOMEM);
+ goto finish_decoding_index;
+ }
+
+ /* distribute sorted segments to index tables */
+ for (i = j = 0; i < nb_sorted_segments; i++) {
+ if (i != 0 && sorted_segments[i-1]->index_sid != sorted_segments[i]->index_sid) {
+ /* next IndexSID */
+ j++;
+ }
+
+ mxf->index_tables[j].nb_segments++;
+ }
+
+ for (i = j = 0; j < mxf->nb_index_tables; i += mxf->index_tables[j++].nb_segments) {
+ MXFIndexTable *t = &mxf->index_tables[j];
+
+ if (t->nb_segments >
+ (INT_MAX / sizeof(MXFIndexTableSegment *)) ||
+ !(t->segments = av_mallocz(t->nb_segments *
+ sizeof(MXFIndexTableSegment*)))) {
+ av_log(mxf->fc, AV_LOG_ERROR, "failed to allocate IndexTableSegment"
+ " pointer array\n");
+ ret = AVERROR(ENOMEM);
+ goto finish_decoding_index;
+ }
+
+ if (sorted_segments[i]->index_start_position)
+ av_log(mxf->fc, AV_LOG_WARNING, "IndexSID %i starts at EditUnit %"PRId64" - seeking may not work as expected\n",
+ sorted_segments[i]->index_sid, sorted_segments[i]->index_start_position);
+
+ memcpy(t->segments, &sorted_segments[i], t->nb_segments * sizeof(MXFIndexTableSegment*));
+ t->index_sid = sorted_segments[i]->index_sid;
+ t->body_sid = sorted_segments[i]->body_sid;
+
+ if ((ret = mxf_compute_ptses_fake_index(mxf, t)) < 0)
+ goto finish_decoding_index;
+
+ /* fix zero IndexDurations */
+ for (k = 0; k < t->nb_segments; k++) {
+ if (t->segments[k]->index_duration)
+ continue;
+
+ if (t->nb_segments > 1)
+ av_log(mxf->fc, AV_LOG_WARNING, "IndexSID %i segment %i has zero IndexDuration and there's more than one segment\n",
+ t->index_sid, k);
+
+ if (mxf->fc->nb_streams <= 0) {
+ av_log(mxf->fc, AV_LOG_WARNING, "no streams?\n");
+ break;
+ }
+
+ /* assume the first stream's duration is reasonable
+ * leave index_duration = 0 on further segments in case we have any (unlikely)
+ */
+ t->segments[k]->index_duration = mxf->fc->streams[0]->duration;
+ break;
+ }
+ }
+
+ ret = 0;
+finish_decoding_index:
+ av_free(sorted_segments);
+ return ret;
+}
+
+static int mxf_is_intra_only(MXFDescriptor *d)
+{
+ return mxf_get_codec_ul(mxf_intra_only_essence_container_uls,
+ &d->essence_container_ul)->id != AV_CODEC_ID_NONE ||
+ mxf_get_codec_ul(mxf_intra_only_picture_essence_coding_uls,
+ &d->essence_codec_ul)->id != AV_CODEC_ID_NONE;
+}
+
static int mxf_parse_structural_metadata(MXFContext *mxf)
{
MXFPackage *material_package = NULL;
MXFPackage *temp_package = NULL;
- int i, j, k;
+ int i, j, k, ret;
av_dlog(mxf->fc, "metadata sets count %d\n", mxf->metadata_sets_count);
/* TODO: handle multiple material packages (OP3x) */
@@ -699,6 +1340,7 @@ static int mxf_parse_structural_metadata(MXFContext *mxf)
UID *essence_container_ul = NULL;
const MXFCodecUL *codec_ul = NULL;
const MXFCodecUL *container_ul = NULL;
+ const MXFCodecUL *pix_fmt_ul = NULL;
AVStream *st;
if (!(material_track = mxf_resolve_strong_ref(mxf, &material_package->tracks_refs[i], Track))) {
@@ -728,13 +1370,14 @@ static int mxf_parse_structural_metadata(MXFContext *mxf)
}
}
if (!source_package) {
- av_log(mxf->fc, AV_LOG_ERROR, "material track %d: no corresponding source package found\n", material_track->track_id);
+ av_dlog(mxf->fc, "material track %d: no corresponding source package found\n", material_track->track_id);
break;
}
for (k = 0; k < source_package->tracks_count; k++) {
if (!(temp_track = mxf_resolve_strong_ref(mxf, &source_package->tracks_refs[k], Track))) {
av_log(mxf->fc, AV_LOG_ERROR, "could not resolve source track strong ref\n");
- return AVERROR_INVALIDDATA;
+ ret = AVERROR_INVALIDDATA;
+ goto fail_and_free;
}
if (temp_track->track_id == component->source_track_id) {
source_track = temp_track;
@@ -746,13 +1389,27 @@ static int mxf_parse_structural_metadata(MXFContext *mxf)
break;
}
}
- if (!source_track)
+ if (!source_track || !component)
+ continue;
+
+ if (!(source_track->sequence = mxf_resolve_strong_ref(mxf, &source_track->sequence_ref, Sequence))) {
+ av_log(mxf->fc, AV_LOG_ERROR, "could not resolve source track sequence strong ref\n");
+ ret = AVERROR_INVALIDDATA;
+ goto fail_and_free;
+ }
+
+ /* 0001GL00.MXF.A1.mxf_opatom.mxf has the same SourcePackageID as 0001GL.MXF.V1.mxf_opatom.mxf
+ * This would result in both files appearing to have two streams. Work around this by sanity checking DataDefinition */
+ if (memcmp(material_track->sequence->data_definition_ul, source_track->sequence->data_definition_ul, 16)) {
+ av_log(mxf->fc, AV_LOG_ERROR, "material track %d: DataDefinition mismatch\n", material_track->track_id);
continue;
+ }
st = avformat_new_stream(mxf->fc, NULL);
if (!st) {
av_log(mxf->fc, AV_LOG_ERROR, "could not allocate stream\n");
- return AVERROR(ENOMEM);
+ ret = AVERROR(ENOMEM);
+ goto fail_and_free;
}
st->id = source_track->track_id;
st->priv_data = source_track;
@@ -760,12 +1417,7 @@ static int mxf_parse_structural_metadata(MXFContext *mxf)
if (st->duration == -1)
st->duration = AV_NOPTS_VALUE;
st->start_time = component->start_position;
- avpriv_set_pts_info(st, 64, material_track->edit_rate.num, material_track->edit_rate.den);
-
- if (!(source_track->sequence = mxf_resolve_strong_ref(mxf, &source_track->sequence_ref, Sequence))) {
- av_log(mxf->fc, AV_LOG_ERROR, "could not resolve source track sequence strong ref\n");
- return AVERROR_INVALIDDATA;
- }
+ avpriv_set_pts_info(st, 64, material_track->edit_rate.den, material_track->edit_rate.num);
PRINT_KEY(mxf->fc, "data definition ul", source_track->sequence->data_definition_ul);
codec_ul = mxf_get_codec_ul(ff_mxf_data_definition_uls, &source_track->sequence->data_definition_ul);
@@ -808,6 +1460,7 @@ static int mxf_parse_structural_metadata(MXFContext *mxf)
}
}
}
+
/* TODO: drop PictureEssenceCoding and SoundEssenceCompression, only check EssenceContainer */
codec_ul = mxf_get_codec_ul(ff_mxf_codec_uls, &descriptor->essence_codec_ul);
st->codec->codec_id = codec_ul->id;
@@ -816,46 +1469,105 @@ static int mxf_parse_structural_metadata(MXFContext *mxf)
st->codec->extradata_size = descriptor->extradata_size;
}
if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
- container_ul = mxf_get_codec_ul(mxf_essence_container_uls, essence_container_ul);
- if (st->codec->codec_id == CODEC_ID_NONE)
+ source_track->intra_only = mxf_is_intra_only(descriptor);
+ container_ul = mxf_get_codec_ul(mxf_picture_essence_container_uls, essence_container_ul);
+ if (st->codec->codec_id == AV_CODEC_ID_NONE)
st->codec->codec_id = container_ul->id;
st->codec->width = descriptor->width;
+ /* Field height, not frame height */
st->codec->height = descriptor->height;
- if (st->codec->codec_id == CODEC_ID_RAWVIDEO)
+ switch (descriptor->frame_layout) {
+ case SegmentedFrame:
+ /* This one is a weird layout I don't fully understand. */
+ av_log(mxf->fc, AV_LOG_INFO,
+ "SegmentedFrame layout isn't currently supported\n");
+ break;
+ case FullFrame:
+ break;
+ case OneField:
+ /* Every other line is stored and needs to be duplicated. */
+ av_log(mxf->fc, AV_LOG_INFO,
+ "OneField frame layout isn't currently supported\n");
+ break;
+ /* The correct thing to do here is fall through, but by
+ * breaking we might be able to decode some streams at half
+ * the vertical resolution, rather than not al all.
+ * It's also for compatibility with the old behavior. */
+ case SeparateFields:
+ case MixedFields:
+ /* Turn field height into frame height. */
+ st->codec->height *= 2;
+ default:
+ av_log(mxf->fc, AV_LOG_INFO,
+ "Unknown frame layout type: %d\n",
+ descriptor->frame_layout);
+ }
+ if (st->codec->codec_id == AV_CODEC_ID_RAWVIDEO) {
st->codec->pix_fmt = descriptor->pix_fmt;
+ if (st->codec->pix_fmt == AV_PIX_FMT_NONE) {
+ pix_fmt_ul = mxf_get_codec_ul(ff_mxf_pixel_format_uls,
+ &descriptor->essence_codec_ul);
+ st->codec->pix_fmt = pix_fmt_ul->id;
+ if (st->codec->pix_fmt == AV_PIX_FMT_NONE) {
+ /* support files created before RP224v10 by defaulting to UYVY422
+ if subsampling is 4:2:2 and component depth is 8-bit */
+ if (descriptor->horiz_subsampling == 2 &&
+ descriptor->vert_subsampling == 1 &&
+ descriptor->component_depth == 8) {
+ st->codec->pix_fmt = AV_PIX_FMT_UYVY422;
+ }
+ }
+ }
+ }
st->need_parsing = AVSTREAM_PARSE_HEADERS;
} else if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO) {
- container_ul = mxf_get_codec_ul(mxf_essence_container_uls, essence_container_ul);
- if (st->codec->codec_id == CODEC_ID_NONE)
+ container_ul = mxf_get_codec_ul(mxf_sound_essence_container_uls, essence_container_ul);
+ if (st->codec->codec_id == AV_CODEC_ID_NONE)
st->codec->codec_id = container_ul->id;
st->codec->channels = descriptor->channels;
st->codec->bits_per_coded_sample = descriptor->bits_per_sample;
- st->codec->sample_rate = descriptor->sample_rate.num / descriptor->sample_rate.den;
- /* TODO: implement CODEC_ID_RAWAUDIO */
- if (st->codec->codec_id == CODEC_ID_PCM_S16LE) {
+
+ if (descriptor->sample_rate.den > 0)
+ st->codec->sample_rate = descriptor->sample_rate.num / descriptor->sample_rate.den;
+
+ /* TODO: implement AV_CODEC_ID_RAWAUDIO */
+ if (st->codec->codec_id == AV_CODEC_ID_PCM_S16LE) {
if (descriptor->bits_per_sample > 16 && descriptor->bits_per_sample <= 24)
- st->codec->codec_id = CODEC_ID_PCM_S24LE;
+ st->codec->codec_id = AV_CODEC_ID_PCM_S24LE;
else if (descriptor->bits_per_sample == 32)
- st->codec->codec_id = CODEC_ID_PCM_S32LE;
- } else if (st->codec->codec_id == CODEC_ID_PCM_S16BE) {
+ st->codec->codec_id = AV_CODEC_ID_PCM_S32LE;
+ } else if (st->codec->codec_id == AV_CODEC_ID_PCM_S16BE) {
if (descriptor->bits_per_sample > 16 && descriptor->bits_per_sample <= 24)
- st->codec->codec_id = CODEC_ID_PCM_S24BE;
+ st->codec->codec_id = AV_CODEC_ID_PCM_S24BE;
else if (descriptor->bits_per_sample == 32)
- st->codec->codec_id = CODEC_ID_PCM_S32BE;
- } else if (st->codec->codec_id == CODEC_ID_MP2) {
+ st->codec->codec_id = AV_CODEC_ID_PCM_S32BE;
+ } else if (st->codec->codec_id == AV_CODEC_ID_MP2) {
st->need_parsing = AVSTREAM_PARSE_FULL;
}
}
if (st->codec->codec_type != AVMEDIA_TYPE_DATA && (*essence_container_ul)[15] > 0x01) {
- av_log(mxf->fc, AV_LOG_WARNING, "only frame wrapped mappings are correctly supported\n");
- st->need_parsing = AVSTREAM_PARSE_FULL;
+ /* TODO: decode timestamps */
+ st->need_parsing = AVSTREAM_PARSE_TIMESTAMPS;
}
}
- return 0;
+
+ ret = 0;
+fail_and_free:
+ return ret;
}
static const MXFMetadataReadTableEntry mxf_metadata_read_table[] = {
{ { 0x06,0x0E,0x2B,0x34,0x02,0x05,0x01,0x01,0x0d,0x01,0x02,0x01,0x01,0x05,0x01,0x00 }, mxf_read_primer_pack },
+ { { 0x06,0x0E,0x2B,0x34,0x02,0x05,0x01,0x01,0x0d,0x01,0x02,0x01,0x01,0x02,0x01,0x00 }, mxf_read_partition_pack },
+ { { 0x06,0x0E,0x2B,0x34,0x02,0x05,0x01,0x01,0x0d,0x01,0x02,0x01,0x01,0x02,0x02,0x00 }, mxf_read_partition_pack },
+ { { 0x06,0x0E,0x2B,0x34,0x02,0x05,0x01,0x01,0x0d,0x01,0x02,0x01,0x01,0x02,0x03,0x00 }, mxf_read_partition_pack },
+ { { 0x06,0x0E,0x2B,0x34,0x02,0x05,0x01,0x01,0x0d,0x01,0x02,0x01,0x01,0x02,0x04,0x00 }, mxf_read_partition_pack },
+ { { 0x06,0x0E,0x2B,0x34,0x02,0x05,0x01,0x01,0x0d,0x01,0x02,0x01,0x01,0x03,0x01,0x00 }, mxf_read_partition_pack },
+ { { 0x06,0x0E,0x2B,0x34,0x02,0x05,0x01,0x01,0x0d,0x01,0x02,0x01,0x01,0x03,0x02,0x00 }, mxf_read_partition_pack },
+ { { 0x06,0x0E,0x2B,0x34,0x02,0x05,0x01,0x01,0x0d,0x01,0x02,0x01,0x01,0x03,0x03,0x00 }, mxf_read_partition_pack },
+ { { 0x06,0x0E,0x2B,0x34,0x02,0x05,0x01,0x01,0x0d,0x01,0x02,0x01,0x01,0x03,0x04,0x00 }, mxf_read_partition_pack },
+ { { 0x06,0x0E,0x2B,0x34,0x02,0x05,0x01,0x01,0x0d,0x01,0x02,0x01,0x01,0x04,0x02,0x00 }, mxf_read_partition_pack },
+ { { 0x06,0x0E,0x2B,0x34,0x02,0x05,0x01,0x01,0x0d,0x01,0x02,0x01,0x01,0x04,0x04,0x00 }, mxf_read_partition_pack },
{ { 0x06,0x0E,0x2B,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x01,0x01,0x01,0x01,0x18,0x00 }, mxf_read_content_storage, 0, AnyType },
{ { 0x06,0x0E,0x2B,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x01,0x01,0x01,0x01,0x37,0x00 }, mxf_read_source_package, sizeof(MXFPackage), SourcePackage },
{ { 0x06,0x0E,0x2B,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x01,0x01,0x01,0x01,0x36,0x00 }, mxf_read_material_package, sizeof(MXFPackage), MaterialPackage },
@@ -883,7 +1595,7 @@ static int mxf_read_local_tags(MXFContext *mxf, KLVPacket *klv, MXFMetadataReadF
if (!ctx)
return AVERROR(ENOMEM);
- while (avio_tell(pb) + 4 < klv_end) {
+ while (avio_tell(pb) + 4 < klv_end && !pb->eof_reached) {
int ret;
int tag = avio_rb16(pb);
int size = avio_rb16(pb); /* KLV specified by 0x53 */
@@ -908,19 +1620,213 @@ static int mxf_read_local_tags(MXFContext *mxf, KLVPacket *klv, MXFMetadataReadF
}
if (ctx_size && tag == 0x3C0A)
avio_read(pb, ctx->uid, 16);
- else if ((ret = read_child(ctx, pb, tag, size, uid)) < 0)
+ else if ((ret = read_child(ctx, pb, tag, size, uid, -1)) < 0)
return ret;
- avio_seek(pb, next, SEEK_SET);
+ /* Accept the 64k local set limit being exceeded (Avid). Don't accept
+ * it extending past the end of the KLV though (zzuf5.mxf). */
+ if (avio_tell(pb) > klv_end) {
+ av_log(mxf->fc, AV_LOG_ERROR,
+ "local tag %#04x extends past end of local set @ %#"PRIx64"\n",
+ tag, klv->offset);
+ return AVERROR_INVALIDDATA;
+ } else if (avio_tell(pb) <= next) /* only seek forward, else this can loop for a long time */
+ avio_seek(pb, next, SEEK_SET);
}
if (ctx_size) ctx->type = type;
return ctx_size ? mxf_add_metadata_set(mxf, ctx) : 0;
}
-static int mxf_read_header(AVFormatContext *s, AVFormatParameters *ap)
+/**
+ * Seeks to the previous partition, if possible
+ * @return <= 0 if we should stop parsing, > 0 if we should keep going
+ */
+static int mxf_seek_to_previous_partition(MXFContext *mxf)
+{
+ AVIOContext *pb = mxf->fc->pb;
+
+ if (!mxf->current_partition ||
+ mxf->run_in + mxf->current_partition->previous_partition <= mxf->last_forward_tell)
+ return 0; /* we've parsed all partitions */
+
+ /* seek to previous partition */
+ avio_seek(pb, mxf->run_in + mxf->current_partition->previous_partition, SEEK_SET);
+ mxf->current_partition = NULL;
+
+ av_dlog(mxf->fc, "seeking to previous partition\n");
+
+ return 1;
+}
+
+/**
+ * Called when essence is encountered
+ * @return <= 0 if we should stop parsing, > 0 if we should keep going
+ */
+static int mxf_parse_handle_essence(MXFContext *mxf)
+{
+ AVIOContext *pb = mxf->fc->pb;
+ int64_t ret;
+
+ if (mxf->parsing_backward) {
+ return mxf_seek_to_previous_partition(mxf);
+ } else {
+ if (!mxf->footer_partition) {
+ av_dlog(mxf->fc, "no footer\n");
+ return 0;
+ }
+
+ av_dlog(mxf->fc, "seeking to footer\n");
+
+ /* remember where we were so we don't end up seeking further back than this */
+ mxf->last_forward_tell = avio_tell(pb);
+
+ if (!pb->seekable) {
+ av_log(mxf->fc, AV_LOG_INFO, "file is not seekable - not parsing footer\n");
+ return -1;
+ }
+
+ /* seek to footer partition and parse backward */
+ if ((ret = avio_seek(pb, mxf->run_in + mxf->footer_partition, SEEK_SET)) < 0) {
+ av_log(mxf->fc, AV_LOG_ERROR, "failed to seek to footer @ 0x%"PRIx64" (%"PRId64") - partial file?\n",
+ mxf->run_in + mxf->footer_partition, ret);
+ return ret;
+ }
+
+ mxf->current_partition = NULL;
+ mxf->parsing_backward = 1;
+ }
+
+ return 1;
+}
+
+/**
+ * Called when the next partition or EOF is encountered
+ * @return <= 0 if we should stop parsing, > 0 if we should keep going
+ */
+static int mxf_parse_handle_partition_or_eof(MXFContext *mxf)
+{
+ return mxf->parsing_backward ? mxf_seek_to_previous_partition(mxf) : 1;
+}
+
+/**
+ * Figure out the proper offset and length of the essence container
+ * in each partition
+ */
+static void mxf_compute_essence_containers(MXFContext *mxf)
+{
+ int x;
+
+ /* everything is already correct */
+ if (mxf->op == OPAtom)
+ return;
+
+ for (x = 0; x < mxf->partitions_count; x++) {
+ MXFPartition *p = &mxf->partitions[x];
+
+ if (!p->body_sid)
+ continue; /* BodySID == 0 -> no essence */
+
+ if (x >= mxf->partitions_count - 1)
+ break; /* last partition - can't compute length (and we don't need to) */
+
+ /* essence container spans to the next partition */
+ p->essence_length = mxf->partitions[x+1].this_partition - p->essence_offset;
+
+ if (p->essence_length < 0) {
+ /* next ThisPartition < essence_offset */
+ p->essence_length = 0;
+ av_log(mxf->fc, AV_LOG_ERROR,
+ "partition %i: bad ThisPartition = %"PRIX64"\n",
+ x+1, mxf->partitions[x+1].this_partition);
+ }
+ }
+}
+
+static int64_t round_to_kag(int64_t position, int kag_size)
+{
+ /* TODO: account for run-in? the spec isn't clear whether KAG should account for it */
+ /* NOTE: kag_size may be any integer between 1 - 2^10 */
+ int64_t ret = (position / kag_size) * kag_size;
+ return ret == position ? ret : ret + kag_size;
+}
+
+static inline void compute_partition_essence_offset(AVFormatContext *s,
+ MXFContext *mxf,
+ KLVPacket *klv)
+{
+ MXFPartition *cur_part = mxf->current_partition;
+ /* for OP1a we compute essence_offset
+ * for OPAtom we point essence_offset after the KL
+ * (usually op1a_essence_offset + 20 or 25)
+ * TODO: for OP1a we could eliminate this entire if statement, always
+ * stopping parsing at op1a_essence_offset
+ * for OPAtom we still need the actual essence_offset though
+ * (the KL's length can vary)
+ */
+ int64_t op1a_essence_offset =
+ round_to_kag(cur_part->this_partition + cur_part->pack_length,
+ cur_part->kag_size) +
+ round_to_kag(cur_part->header_byte_count, cur_part->kag_size) +
+ round_to_kag(cur_part->index_byte_count, cur_part->kag_size);
+
+ if (mxf->op == OPAtom) {
+ /* point essence_offset to the actual data
+ * OPAtom has all the essence in one big KLV
+ */
+ cur_part->essence_offset = avio_tell(s->pb);
+ cur_part->essence_length = klv->length;
+ } else {
+ /* NOTE: op1a_essence_offset may be less than to klv.offset
+ * (C0023S01.mxf) */
+ cur_part->essence_offset = op1a_essence_offset;
+ }
+}
+
+static int is_pcm(enum AVCodecID codec_id)
+{
+ /* we only care about "normal" PCM codecs until we get samples */
+ return codec_id >= AV_CODEC_ID_PCM_S16LE && codec_id < AV_CODEC_ID_PCM_S24DAUD;
+}
+
+/**
+ * Deal with the case where for some audio atoms EditUnitByteCount is
+ * very small (2, 4..). In those cases we should read more than one
+ * sample per call to mxf_read_packet().
+ */
+static void mxf_handle_small_eubc(AVFormatContext *s)
+{
+ MXFContext *mxf = s->priv_data;
+
+ /* assuming non-OPAtom == frame wrapped
+ * no sane writer would wrap 2 byte PCM packets with 20 byte headers.. */
+ if (mxf->op != OPAtom)
+ return;
+
+ /* expect PCM with exactly one index table segment and a small (< 32) EUBC */
+ if (s->nb_streams != 1 ||
+ s->streams[0]->codec->codec_type != AVMEDIA_TYPE_AUDIO ||
+ !is_pcm(s->streams[0]->codec->codec_id) ||
+ mxf->nb_index_tables != 1 ||
+ mxf->index_tables[0].nb_segments != 1 ||
+ mxf->index_tables[0].segments[0]->edit_unit_byte_count >= 32)
+ return;
+
+ /* arbitrarily default to 48 kHz PAL audio frame size */
+ /* TODO: We could compute this from the ratio between the audio
+ * and video edit rates for 48 kHz NTSC we could use the
+ * 1802-1802-1802-1802-1801 pattern. */
+ mxf->edit_units_per_packet = 1920;
+}
+
+static int mxf_read_header(AVFormatContext *s)
{
MXFContext *mxf = s->priv_data;
KLVPacket klv;
+ int64_t essence_offset = 0;
+ int ret;
+
+ mxf->last_forward_tell = INT64_MAX;
+ mxf->edit_units_per_packet = 1;
if (!mxf_read_sync(s->pb, mxf_header_partition_pack_key, 14)) {
av_log(s, AV_LOG_ERROR, "could not find header partition pack key\n");
@@ -928,19 +1834,51 @@ static int mxf_read_header(AVFormatContext *s, AVFormatParameters *ap)
}
avio_seek(s->pb, -14, SEEK_CUR);
mxf->fc = s;
+ mxf->run_in = avio_tell(s->pb);
+
while (!s->pb->eof_reached) {
- int ret;
const MXFMetadataReadTableEntry *metadata;
- if ((ret = klv_read_packet(&klv, s->pb)) < 0)
- return ret;
+ if (klv_read_packet(&klv, s->pb) < 0) {
+ /* EOF - seek to previous partition or stop */
+ if(mxf_parse_handle_partition_or_eof(mxf) <= 0)
+ break;
+ else
+ continue;
+ }
+
PRINT_KEY(s, "read header", klv.key);
av_dlog(s, "size %"PRIu64" offset %#"PRIx64"\n", klv.length, klv.offset);
if (IS_KLV_KEY(klv.key, mxf_encrypted_triplet_key) ||
- IS_KLV_KEY(klv.key, mxf_essence_element_key)) {
- /* FIXME avoid seek */
- avio_seek(s->pb, klv.offset, SEEK_SET);
- break;
+ IS_KLV_KEY(klv.key, mxf_essence_element_key) ||
+ IS_KLV_KEY(klv.key, mxf_avid_essence_element_key) ||
+ IS_KLV_KEY(klv.key, mxf_system_item_key)) {
+
+ if (!mxf->current_partition) {
+ av_log(mxf->fc, AV_LOG_ERROR,
+ "found essence prior to first PartitionPack\n");
+ return AVERROR_INVALIDDATA;
+ }
+
+ if (!mxf->current_partition->essence_offset) {
+ compute_partition_essence_offset(s, mxf, &klv);
+ }
+
+ if (!essence_offset)
+ essence_offset = klv.offset;
+
+ /* seek to footer, previous partition or stop */
+ if (mxf_parse_handle_essence(mxf) <= 0)
+ break;
+ continue;
+ } else if (!memcmp(klv.key, mxf_header_partition_pack_key, 13) &&
+ klv.key[13] >= 2 && klv.key[13] <= 4 && mxf->current_partition) {
+ /* next partition pack - keep going, seek to previous partition or stop */
+ if(mxf_parse_handle_partition_or_eof(mxf) <= 0)
+ break;
+ else if (mxf->parsing_backward)
+ continue;
+ /* we're still parsing forward. proceed to parsing this partition pack */
}
for (metadata = mxf_metadata_read_table; metadata->read; metadata++) {
@@ -948,8 +1886,19 @@ static int mxf_read_header(AVFormatContext *s, AVFormatParameters *ap)
int res;
if (klv.key[5] == 0x53) {
res = mxf_read_local_tags(mxf, &klv, metadata->read, metadata->ctx_size, metadata->type);
- } else
- res = metadata->read(mxf, s->pb, 0, 0, NULL);
+ } else {
+ uint64_t next = avio_tell(s->pb) + klv.length;
+ res = metadata->read(mxf, s->pb, 0, klv.length, klv.key, klv.offset);
+
+ /* only seek forward, else this can loop for a long time */
+ if (avio_tell(s->pb) > next) {
+ av_log(s, AV_LOG_ERROR, "read past end of KLV @ %#"PRIx64"\n",
+ klv.offset);
+ return AVERROR_INVALIDDATA;
+ }
+
+ avio_seek(s->pb, next, SEEK_SET);
+ }
if (res < 0) {
av_log(s, AV_LOG_ERROR, "error reading header metadata\n");
return res;
@@ -960,12 +1909,235 @@ static int mxf_read_header(AVFormatContext *s, AVFormatParameters *ap)
if (!metadata->read)
avio_skip(s->pb, klv.length);
}
- return mxf_parse_structural_metadata(mxf);
+ /* FIXME avoid seek */
+ if (!essence_offset) {
+ av_log(s, AV_LOG_ERROR, "no essence\n");
+ return AVERROR_INVALIDDATA;
+ }
+ avio_seek(s->pb, essence_offset, SEEK_SET);
+
+ mxf_compute_essence_containers(mxf);
+
+ /* we need to do this before computing the index tables
+ * to be able to fill in zero IndexDurations with st->duration */
+ if ((ret = mxf_parse_structural_metadata(mxf)) < 0)
+ return ret;
+
+ if ((ret = mxf_compute_index_tables(mxf)) < 0)
+ return ret;
+
+ if (mxf->nb_index_tables > 1) {
+ /* TODO: look up which IndexSID to use via EssenceContainerData */
+ av_log(mxf->fc, AV_LOG_INFO, "got %i index tables - only the first one (IndexSID %i) will be used\n",
+ mxf->nb_index_tables, mxf->index_tables[0].index_sid);
+ } else if (mxf->nb_index_tables == 0 && mxf->op == OPAtom) {
+ av_log(mxf->fc, AV_LOG_ERROR, "cannot demux OPAtom without an index\n");
+ return AVERROR_INVALIDDATA;
+ }
+
+ mxf_handle_small_eubc(s);
+
+ return 0;
}
+/**
+ * Sets mxf->current_edit_unit based on what offset we're currently at.
+ * @return next_ofs if OK, <0 on error
+ */
+static int64_t mxf_set_current_edit_unit(MXFContext *mxf, int64_t current_offset)
+{
+ int64_t last_ofs = -1, next_ofs = -1;
+ MXFIndexTable *t = &mxf->index_tables[0];
+
+ /* this is called from the OP1a demuxing logic, which means there
+ * may be no index tables */
+ if (mxf->nb_index_tables <= 0)
+ return -1;
+
+ /* find mxf->current_edit_unit so that the next edit unit starts ahead
+ * of current_offset */
+ while (mxf->current_edit_unit >= 0) {
+ if (mxf_edit_unit_absolute_offset(mxf, t, mxf->current_edit_unit + 1,
+ NULL, &next_ofs, 0) < 0)
+ return -1;
+
+ if (next_ofs <= last_ofs) {
+ /* large next_ofs didn't change or current_edit_unit wrapped
+ * around this fixes the infinite loop on zzuf3.mxf */
+ av_log(mxf->fc, AV_LOG_ERROR,
+ "next_ofs didn't change. not deriving packet timestamps\n");
+ return -1;
+ }
+
+ if (next_ofs > current_offset)
+ break;
+
+ last_ofs = next_ofs;
+ mxf->current_edit_unit++;
+ }
+
+ /* not checking mxf->current_edit_unit >= t->nb_ptses here since CBR files
+ * may lack IndexEntryArrays */
+ if (mxf->current_edit_unit < 0)
+ return -1;
+
+ return next_ofs;
+}
+
+static int mxf_read_packet_old(AVFormatContext *s, AVPacket *pkt)
+{
+ KLVPacket klv;
+ MXFContext *mxf = s->priv_data;
+
+ while (!s->pb->eof_reached) {
+ if (klv_read_packet(&klv, s->pb) < 0)
+ return -1;
+ PRINT_KEY(s, "read packet", klv.key);
+ av_dlog(s, "size %"PRIu64" offset %#"PRIx64"\n", klv.length, klv.offset);
+ if (IS_KLV_KEY(klv.key, mxf_encrypted_triplet_key)) {
+ int res = mxf_decrypt_triplet(s, pkt, &klv);
+ if (res < 0) {
+ av_log(s, AV_LOG_ERROR, "invalid encoded triplet\n");
+ return -1;
+ }
+ return 0;
+ }
+ if (IS_KLV_KEY(klv.key, mxf_essence_element_key) ||
+ IS_KLV_KEY(klv.key, mxf_avid_essence_element_key)) {
+ int index = mxf_get_stream_index(s, &klv);
+ int64_t next_ofs, next_klv;
+ AVStream *st;
+ MXFTrack *track;
+
+ if (index < 0) {
+ av_log(s, AV_LOG_ERROR, "error getting stream index %d\n", AV_RB32(klv.key+12));
+ goto skip;
+ }
+
+ st = s->streams[index];
+ track = st->priv_data;
+
+ if (s->streams[index]->discard == AVDISCARD_ALL)
+ goto skip;
+
+ next_klv = avio_tell(s->pb) + klv.length;
+ next_ofs = mxf_set_current_edit_unit(mxf, klv.offset);
+
+ if (next_ofs >= 0 && next_klv > next_ofs) {
+ /* if this check is hit then it's possible OPAtom was treated
+ * as OP1a truncate the packet since it's probably very large
+ * (>2 GiB is common) */
+ av_log_ask_for_sample(s,
+ "KLV for edit unit %i extends into next "
+ "edit unit - OPAtom misinterpreted as "
+ "OP1a?\n",
+ mxf->current_edit_unit);
+ klv.length = next_ofs - avio_tell(s->pb);
+ }
+
+ /* check for 8 channels AES3 element */
+ if (klv.key[12] == 0x06 && klv.key[13] == 0x01 && klv.key[14] == 0x10) {
+ if (mxf_get_d10_aes3_packet(s->pb, s->streams[index], pkt, klv.length) < 0) {
+ av_log(s, AV_LOG_ERROR, "error reading D-10 aes3 frame\n");
+ return -1;
+ }
+ } else {
+ int ret = av_get_packet(s->pb, pkt, klv.length);
+ if (ret < 0)
+ return ret;
+ }
+ pkt->stream_index = index;
+ pkt->pos = klv.offset;
+
+ if (s->streams[index]->codec->codec_type == AVMEDIA_TYPE_VIDEO && next_ofs >= 0) {
+ /* mxf->current_edit_unit good - see if we have an
+ * index table to derive timestamps from */
+ MXFIndexTable *t = &mxf->index_tables[0];
+
+ if (mxf->nb_index_tables >= 1 &&
+ mxf->current_edit_unit < t->nb_ptses) {
+ pkt->dts = mxf->current_edit_unit + t->first_dts;
+ pkt->pts = t->ptses[mxf->current_edit_unit];
+ } else if (track->intra_only) {
+ /* intra-only -> PTS = EditUnit.
+ * let utils.c figure out DTS since it can be
+ * < PTS if low_delay = 0 (Sony IMX30) */
+ pkt->pts = mxf->current_edit_unit;
+ }
+ }
+
+ /* seek for truncated packets */
+ avio_seek(s->pb, next_klv, SEEK_SET);
+
+ return 0;
+ } else
+ skip:
+ avio_skip(s->pb, klv.length);
+ }
+ return AVERROR_EOF;
+}
+
+static int mxf_read_packet(AVFormatContext *s, AVPacket *pkt)
+{
+ MXFContext *mxf = s->priv_data;
+ int ret, size;
+ int64_t ret64, pos, next_pos;
+ AVStream *st;
+ MXFIndexTable *t;
+ int edit_units;
+
+ if (mxf->op != OPAtom)
+ return mxf_read_packet_old(s, pkt);
+
+ /* OPAtom - clip wrapped demuxing */
+ /* NOTE: mxf_read_header() makes sure nb_index_tables > 0 for OPAtom */
+ st = s->streams[0];
+ t = &mxf->index_tables[0];
+
+ if (mxf->current_edit_unit >= st->duration)
+ return AVERROR_EOF;
+
+ edit_units = FFMIN(mxf->edit_units_per_packet, st->duration - mxf->current_edit_unit);
+
+ if ((ret = mxf_edit_unit_absolute_offset(mxf, t, mxf->current_edit_unit, NULL, &pos, 1)) < 0)
+ return ret;
+
+ /* compute size by finding the next edit unit or the end of the essence container
+ * not pretty, but it works */
+ if ((ret = mxf_edit_unit_absolute_offset(mxf, t, mxf->current_edit_unit + edit_units, NULL, &next_pos, 0)) < 0 &&
+ (next_pos = mxf_essence_container_end(mxf, t->body_sid)) <= 0) {
+ av_log(s, AV_LOG_ERROR, "unable to compute the size of the last packet\n");
+ return AVERROR_INVALIDDATA;
+ }
+
+ if ((size = next_pos - pos) <= 0) {
+ av_log(s, AV_LOG_ERROR, "bad size: %i\n", size);
+ return AVERROR_INVALIDDATA;
+ }
+
+ if ((ret64 = avio_seek(s->pb, pos, SEEK_SET)) < 0)
+ return ret64;
+
+ if ((ret = av_get_packet(s->pb, pkt, size)) != size)
+ return ret < 0 ? ret : AVERROR_EOF;
+
+ if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO && t->ptses &&
+ mxf->current_edit_unit >= 0 && mxf->current_edit_unit < t->nb_ptses) {
+ pkt->dts = mxf->current_edit_unit + t->first_dts;
+ pkt->pts = t->ptses[mxf->current_edit_unit];
+ }
+
+ pkt->stream_index = 0;
+ mxf->current_edit_unit += edit_units;
+
+ return 0;
+}
+
+
static int mxf_read_close(AVFormatContext *s)
{
MXFContext *mxf = s->priv_data;
+ MXFIndexTableSegment *seg;
int i;
av_freep(&mxf->packages_refs);
@@ -985,14 +2157,29 @@ static int mxf_read_close(AVFormatContext *s)
case MaterialPackage:
av_freep(&((MXFPackage *)mxf->metadata_sets[i])->tracks_refs);
break;
+ case IndexTableSegment:
+ seg = (MXFIndexTableSegment *)mxf->metadata_sets[i];
+ av_freep(&seg->temporal_offset_entries);
+ av_freep(&seg->flag_entries);
+ av_freep(&seg->stream_offset_entries);
+ break;
default:
break;
}
av_freep(&mxf->metadata_sets[i]);
}
+ av_freep(&mxf->partitions);
av_freep(&mxf->metadata_sets);
av_freep(&mxf->aesc);
av_freep(&mxf->local_tags);
+
+ for (i = 0; i < mxf->nb_index_tables; i++) {
+ av_freep(&mxf->index_tables[i].segments);
+ av_freep(&mxf->index_tables[i].ptses);
+ av_freep(&mxf->index_tables[i].fake_index);
+ }
+ av_freep(&mxf->index_tables);
+
return 0;
}
@@ -1018,20 +2205,51 @@ static int mxf_read_seek(AVFormatContext *s, int stream_index, int64_t sample_ti
{
AVStream *st = s->streams[stream_index];
int64_t seconds;
+ MXFContext* mxf = s->priv_data;
+ int64_t seekpos;
+ int ret;
+ MXFIndexTable *t;
+ if (mxf->nb_index_tables <= 0) {
if (!s->bit_rate)
return AVERROR_INVALIDDATA;
if (sample_time < 0)
sample_time = 0;
seconds = av_rescale(sample_time, st->time_base.num, st->time_base.den);
- avio_seek(s->pb, (s->bit_rate * seconds) >> 3, SEEK_SET);
+
+ if ((ret = avio_seek(s->pb, (s->bit_rate * seconds) >> 3, SEEK_SET)) < 0)
+ return ret;
ff_update_cur_dts(s, st, sample_time);
+ } else {
+ t = &mxf->index_tables[0];
+
+ /* clamp above zero, else ff_index_search_timestamp() returns negative
+ * this also means we allow seeking before the start */
+ sample_time = FFMAX(sample_time, 0);
+
+ if (t->fake_index) {
+ /* behave as if we have a proper index */
+ if ((sample_time = ff_index_search_timestamp(t->fake_index, t->nb_ptses, sample_time, flags)) < 0)
+ return sample_time;
+ } else {
+ /* no IndexEntryArray (one or more CBR segments)
+ * make sure we don't seek past the end */
+ sample_time = FFMIN(sample_time, st->duration - 1);
+ }
+
+ if ((ret = mxf_edit_unit_absolute_offset(mxf, t, sample_time, &sample_time, &seekpos, 1)) << 0)
+ return ret;
+
+ ff_update_cur_dts(s, st, sample_time);
+ mxf->current_edit_unit = sample_time;
+ avio_seek(s->pb, seekpos, SEEK_SET);
+ }
return 0;
}
AVInputFormat ff_mxf_demuxer = {
.name = "mxf",
- .long_name = NULL_IF_CONFIG_SMALL("Material eXchange Format"),
+ .long_name = NULL_IF_CONFIG_SMALL("MXF (Material eXchange Format)"),
.priv_data_size = sizeof(MXFContext),
.read_probe = mxf_probe,
.read_header = mxf_read_header,
diff --git a/gst-libs/ext/libav/libavformat/mxfenc.c b/gst-libs/ext/libav/libavformat/mxfenc.c
index 65935ab..995e411 100644
--- a/gst-libs/ext/libav/libavformat/mxfenc.c
+++ b/gst-libs/ext/libav/libavformat/mxfenc.c
@@ -82,13 +82,13 @@ typedef struct {
} MXFContainerEssenceEntry;
static const struct {
- enum CodecID id;
+ enum AVCodecID id;
int index;
} mxf_essence_mappings[] = {
- { CODEC_ID_MPEG2VIDEO, 0 },
- { CODEC_ID_PCM_S24LE, 1 },
- { CODEC_ID_PCM_S16LE, 1 },
- { CODEC_ID_NONE }
+ { AV_CODEC_ID_MPEG2VIDEO, 0 },
+ { AV_CODEC_ID_PCM_S24LE, 1 },
+ { AV_CODEC_ID_PCM_S16LE, 1 },
+ { AV_CODEC_ID_NONE }
};
static void mxf_write_wav_desc(AVFormatContext *s, AVStream *st);
@@ -366,7 +366,7 @@ static void klv_encode_ber4_length(AVIOContext *pb, int len)
/*
* Get essence container ul index
*/
-static int mxf_get_essence_container_ul_index(enum CodecID id)
+static int mxf_get_essence_container_ul_index(enum AVCodecID id)
{
int i;
for (i = 0; mxf_essence_mappings[i].id; i++)
@@ -1476,8 +1476,8 @@ static int mxf_write_header(AVFormatContext *s)
av_log(s, AV_LOG_ERROR, "MXF D-10 only support one audio track\n");
return -1;
}
- if (st->codec->codec_id != CODEC_ID_PCM_S16LE &&
- st->codec->codec_id != CODEC_ID_PCM_S24LE) {
+ if (st->codec->codec_id != AV_CODEC_ID_PCM_S16LE &&
+ st->codec->codec_id != AV_CODEC_ID_PCM_S24LE) {
av_log(s, AV_LOG_ERROR, "MXF D-10 only support 16 or 24 bits le audio\n");
}
sc->index = ((MXFStreamContext*)s->streams[0]->priv_data)->index + 1;
@@ -1519,11 +1519,6 @@ static int mxf_write_header(AVFormatContext *s)
sc->order = AV_RB32(sc->track_essence_element_key+12);
}
-#if FF_API_TIMESTAMP
- if (s->timestamp)
- timestamp = s->timestamp;
- else
-#endif
if (t = av_dict_get(s->metadata, "creation_time", NULL, 0))
timestamp = ff_iso8601_to_unix_time(t->value);
if (timestamp)
@@ -1657,7 +1652,7 @@ static void mxf_write_d10_audio_packet(AVFormatContext *s, AVStream *st, AVPacke
while (samples < end) {
for (i = 0; i < st->codec->channels; i++) {
uint32_t sample;
- if (st->codec->codec_id == CODEC_ID_PCM_S24LE) {
+ if (st->codec->codec_id == AV_CODEC_ID_PCM_S24LE) {
sample = AV_RL24(samples)<< 4;
samples += 3;
} else {
@@ -1688,7 +1683,7 @@ static int mxf_write_packet(AVFormatContext *s, AVPacket *pkt)
}
}
- if (st->codec->codec_id == CODEC_ID_MPEG2VIDEO) {
+ if (st->codec->codec_id == AV_CODEC_ID_MPEG2VIDEO) {
if (!mxf_parse_mpeg2_frame(s, st, pkt, &ie)) {
av_log(s, AV_LOG_ERROR, "could not get mpeg2 profile and level\n");
return -1;
@@ -1809,8 +1804,6 @@ static int mxf_write_footer(AVFormatContext *s)
}
}
- avio_flush(pb);
-
ff_audio_interleave_close(s);
av_freep(&mxf->index_entries);
@@ -1863,7 +1856,7 @@ static int mxf_interleave_get_packet(AVFormatContext *s, AVPacket *out, AVPacket
}
*out = pktl->pkt;
- //av_log(s, AV_LOG_DEBUG, "out st:%d dts:%lld\n", (*out).stream_index, (*out).dts);
+ av_dlog(s, "out st:%d dts:%lld\n", (*out).stream_index, (*out).dts);
s->packet_buffer = pktl->next;
if(s->streams[pktl->pkt.stream_index]->last_in_packet_buffer == pktl)
s->streams[pktl->pkt.stream_index]->last_in_packet_buffer= NULL;
@@ -1895,12 +1888,12 @@ static int mxf_interleave(AVFormatContext *s, AVPacket *out, AVPacket *pkt, int
AVOutputFormat ff_mxf_muxer = {
.name = "mxf",
- .long_name = NULL_IF_CONFIG_SMALL("Material eXchange Format"),
+ .long_name = NULL_IF_CONFIG_SMALL("MXF (Material eXchange Format)"),
.mime_type = "application/mxf",
.extensions = "mxf",
.priv_data_size = sizeof(MXFContext),
- .audio_codec = CODEC_ID_PCM_S16LE,
- .video_codec = CODEC_ID_MPEG2VIDEO,
+ .audio_codec = AV_CODEC_ID_PCM_S16LE,
+ .video_codec = AV_CODEC_ID_MPEG2VIDEO,
.write_header = mxf_write_header,
.write_packet = mxf_write_packet,
.write_trailer = mxf_write_footer,
@@ -1910,11 +1903,11 @@ AVOutputFormat ff_mxf_muxer = {
AVOutputFormat ff_mxf_d10_muxer = {
.name = "mxf_d10",
- .long_name = NULL_IF_CONFIG_SMALL("Material eXchange Format, D-10 Mapping"),
+ .long_name = NULL_IF_CONFIG_SMALL("MXF (Material eXchange Format) D-10 Mapping"),
.mime_type = "application/mxf",
.priv_data_size = sizeof(MXFContext),
- .audio_codec = CODEC_ID_PCM_S16LE,
- .video_codec = CODEC_ID_MPEG2VIDEO,
+ .audio_codec = AV_CODEC_ID_PCM_S16LE,
+ .video_codec = AV_CODEC_ID_MPEG2VIDEO,
.write_header = mxf_write_header,
.write_packet = mxf_write_packet,
.write_trailer = mxf_write_footer,
diff --git a/gst-libs/ext/libav/libavformat/mxg.c b/gst-libs/ext/libav/libavformat/mxg.c
index a740364..8959134 100644
--- a/gst-libs/ext/libav/libavformat/mxg.c
+++ b/gst-libs/ext/libav/libavformat/mxg.c
@@ -19,6 +19,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "libavutil/channel_layout.h"
#include "libavutil/intreadwrite.h"
#include "libavcodec/mjpeg.h"
#include "avformat.h"
@@ -37,7 +38,7 @@ typedef struct MXGContext {
unsigned int cache_size;
} MXGContext;
-static int mxg_read_header(AVFormatContext *s, AVFormatParameters *ap)
+static int mxg_read_header(AVFormatContext *s)
{
AVStream *video_st, *audio_st;
MXGContext *mxg = s->priv_data;
@@ -47,15 +48,16 @@ static int mxg_read_header(AVFormatContext *s, AVFormatParameters *ap)
if (!video_st)
return AVERROR(ENOMEM);
video_st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
- video_st->codec->codec_id = CODEC_ID_MXPEG;
+ video_st->codec->codec_id = AV_CODEC_ID_MXPEG;
avpriv_set_pts_info(video_st, 64, 1, 1000000);
audio_st = avformat_new_stream(s, NULL);
if (!audio_st)
return AVERROR(ENOMEM);
audio_st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
- audio_st->codec->codec_id = CODEC_ID_PCM_ALAW;
+ audio_st->codec->codec_id = AV_CODEC_ID_PCM_ALAW;
audio_st->codec->channels = 1;
+ audio_st->codec->channel_layout = AV_CH_LAYOUT_MONO;
audio_st->codec->sample_rate = 8000;
audio_st->codec->bits_per_coded_sample = 8;
audio_st->codec->block_align = 1;
@@ -240,11 +242,11 @@ static int mxg_close(struct AVFormatContext *s)
}
AVInputFormat ff_mxg_demuxer = {
- .name = "mxg",
- .long_name = NULL_IF_CONFIG_SMALL("MxPEG clip file format"),
+ .name = "mxg",
+ .long_name = NULL_IF_CONFIG_SMALL("MxPEG clip"),
.priv_data_size = sizeof(MXGContext),
- .read_header = mxg_read_header,
- .read_packet = mxg_read_packet,
- .read_close = mxg_close,
- .extensions = "mxg"
+ .read_header = mxg_read_header,
+ .read_packet = mxg_read_packet,
+ .read_close = mxg_close,
+ .extensions = "mxg",
};
diff --git a/gst-libs/ext/libav/libavformat/ncdec.c b/gst-libs/ext/libav/libavformat/ncdec.c
index ab1d302..40d8dac 100644
--- a/gst-libs/ext/libav/libavformat/ncdec.c
+++ b/gst-libs/ext/libav/libavformat/ncdec.c
@@ -44,7 +44,7 @@ static int nc_probe(AVProbeData *probe_packet)
return 0;
}
-static int nc_read_header(AVFormatContext *s, AVFormatParameters *ap)
+static int nc_read_header(AVFormatContext *s)
{
AVStream *st = avformat_new_stream(s, NULL);
@@ -52,7 +52,7 @@ static int nc_read_header(AVFormatContext *s, AVFormatParameters *ap)
return AVERROR(ENOMEM);
st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
- st->codec->codec_id = CODEC_ID_MPEG4;
+ st->codec->codec_id = AV_CODEC_ID_MPEG4;
st->need_parsing = AVSTREAM_PARSE_FULL;
avpriv_set_pts_info(st, 64, 1, 100);
@@ -93,9 +93,9 @@ static int nc_read_packet(AVFormatContext *s, AVPacket *pkt)
AVInputFormat ff_nc_demuxer = {
.name = "nc",
- .long_name = NULL_IF_CONFIG_SMALL("NC camera feed format"),
+ .long_name = NULL_IF_CONFIG_SMALL("NC camera feed"),
.read_probe = nc_probe,
.read_header = nc_read_header,
.read_packet = nc_read_packet,
- .extensions = "v",
+ .extensions = "v",
};
diff --git a/gst-libs/ext/libav/libavformat/network.c b/gst-libs/ext/libav/libavformat/network.c
index bfc34c7..1f6bc10 100644
--- a/gst-libs/ext/libav/libavformat/network.c
+++ b/gst-libs/ext/libav/libavformat/network.c
@@ -20,10 +20,9 @@
#include "network.h"
#include "libavcodec/internal.h"
+#include "libavutil/mem.h"
-#define THREADS (HAVE_PTHREADS || (defined(WIN32) && !defined(__MINGW32CE__)))
-
-#if THREADS
+#if HAVE_THREADS
#if HAVE_PTHREADS
#include <pthread.h>
#else
@@ -34,7 +33,7 @@
#if CONFIG_OPENSSL
#include <openssl/ssl.h>
static int openssl_init;
-#if THREADS
+#if HAVE_THREADS
#include <openssl/crypto.h>
#include "libavutil/avutil.h"
pthread_mutex_t *openssl_mutexes;
@@ -55,11 +54,9 @@ static unsigned long openssl_thread_id(void)
#endif
#if CONFIG_GNUTLS
#include <gnutls/gnutls.h>
-#if THREADS && GNUTLS_VERSION_NUMBER <= 0x020b00
+#if HAVE_THREADS && GNUTLS_VERSION_NUMBER <= 0x020b00
#include <gcrypt.h>
#include <errno.h>
-#undef malloc
-#undef free
GCRY_THREAD_OPTION_PTHREAD_IMPL;
#endif
#endif
@@ -71,7 +68,7 @@ void ff_tls_init(void)
if (!openssl_init) {
SSL_library_init();
SSL_load_error_strings();
-#if THREADS
+#if HAVE_THREADS
if (!CRYPTO_get_locking_callback()) {
int i;
openssl_mutexes = av_malloc(sizeof(pthread_mutex_t) * CRYPTO_num_locks());
@@ -87,7 +84,7 @@ void ff_tls_init(void)
openssl_init++;
#endif
#if CONFIG_GNUTLS
-#if THREADS && GNUTLS_VERSION_NUMBER < 0x020b00
+#if HAVE_THREADS && GNUTLS_VERSION_NUMBER < 0x020b00
if (gcry_control(GCRYCTL_ANY_INITIALIZATION_P) == 0)
gcry_control(GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread);
#endif
@@ -102,7 +99,7 @@ void ff_tls_deinit(void)
#if CONFIG_OPENSSL
openssl_init--;
if (!openssl_init) {
-#if THREADS
+#if HAVE_THREADS
if (CRYPTO_get_locking_callback() == openssl_lock) {
int i;
CRYPTO_set_locking_callback(NULL);
@@ -164,6 +161,14 @@ int ff_neterrno(void)
return AVERROR(EAGAIN);
case WSAEINTR:
return AVERROR(EINTR);
+ case WSAEPROTONOSUPPORT:
+ return AVERROR(EPROTONOSUPPORT);
+ case WSAETIMEDOUT:
+ return AVERROR(ETIMEDOUT);
+ case WSAECONNREFUSED:
+ return AVERROR(ECONNREFUSED);
+ case WSAEINPROGRESS:
+ return AVERROR(EINPROGRESS);
}
return -err;
}
@@ -182,4 +187,3 @@ int ff_is_multicast_address(struct sockaddr *addr)
return 0;
}
-
diff --git a/gst-libs/ext/libav/libavformat/network.h b/gst-libs/ext/libav/libavformat/network.h
index 72d01d2..5160767 100644
--- a/gst-libs/ext/libav/libavformat/network.h
+++ b/gst-libs/ext/libav/libavformat/network.h
@@ -22,19 +22,35 @@
#define AVFORMAT_NETWORK_H
#include <errno.h>
+#include <stdint.h>
#include "config.h"
#include "libavutil/error.h"
#include "os_support.h"
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
#if HAVE_WINSOCK2_H
#include <winsock2.h>
#include <ws2tcpip.h>
+#ifndef EPROTONOSUPPORT
#define EPROTONOSUPPORT WSAEPROTONOSUPPORT
+#endif
+#ifndef ETIMEDOUT
#define ETIMEDOUT WSAETIMEDOUT
+#endif
+#ifndef ECONNREFUSED
#define ECONNREFUSED WSAECONNREFUSED
+#endif
+#ifndef EINPROGRESS
#define EINPROGRESS WSAEINPROGRESS
+#endif
+
+#define getsockopt(a, b, c, d, e) getsockopt(a, b, c, (char*) d, e)
+#define setsockopt(a, b, c, d, e) setsockopt(a, b, c, (const char*) d, e)
int ff_neterrno(void);
#else
@@ -95,17 +111,33 @@ struct addrinfo {
#endif
/* getaddrinfo constants */
+#ifndef EAI_AGAIN
+#define EAI_AGAIN 2
+#endif
+#ifndef EAI_BADFLAGS
+#define EAI_BADFLAGS 3
+#endif
#ifndef EAI_FAIL
#define EAI_FAIL 4
#endif
-
#ifndef EAI_FAMILY
#define EAI_FAMILY 5
#endif
-
+#ifndef EAI_MEMORY
+#define EAI_MEMORY 6
+#endif
+#ifndef EAI_NODATA
+#define EAI_NODATA 7
+#endif
#ifndef EAI_NONAME
#define EAI_NONAME 8
#endif
+#ifndef EAI_SERVICE
+#define EAI_SERVICE 9
+#endif
+#ifndef EAI_SOCKTYPE
+#define EAI_SOCKTYPE 10
+#endif
#ifndef AI_PASSIVE
#define AI_PASSIVE 1
@@ -146,13 +178,24 @@ void ff_freeaddrinfo(struct addrinfo *res);
int ff_getnameinfo(const struct sockaddr *sa, int salen,
char *host, int hostlen,
char *serv, int servlen, int flags);
-const char *ff_gai_strerror(int ecode);
#define getaddrinfo ff_getaddrinfo
#define freeaddrinfo ff_freeaddrinfo
#define getnameinfo ff_getnameinfo
+#endif
+#if !HAVE_GETADDRINFO || HAVE_WINSOCK2_H
+const char *ff_gai_strerror(int ecode);
+#undef gai_strerror
#define gai_strerror ff_gai_strerror
#endif
+#ifndef INADDR_LOOPBACK
+#define INADDR_LOOPBACK 0x7f000001
+#endif
+
+#ifndef INET_ADDRSTRLEN
+#define INET_ADDRSTRLEN 16
+#endif
+
#ifndef INET6_ADDRSTRLEN
#define INET6_ADDRSTRLEN INET_ADDRSTRLEN
#endif
diff --git a/gst-libs/ext/libav/libavformat/nsvdec.c b/gst-libs/ext/libav/libavformat/nsvdec.c
index e5aaf33..4193ed2 100644
--- a/gst-libs/ext/libav/libavformat/nsvdec.c
+++ b/gst-libs/ext/libav/libavformat/nsvdec.c
@@ -19,10 +19,10 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "libavutil/attributes.h"
#include "libavutil/mathematics.h"
#include "avformat.h"
#include "internal.h"
-#include "riff.h"
#include "libavutil/dict.h"
//#define DEBUG_DUMP_INDEX // XXX dumbdriving-271.nsv breaks with it commented!!
@@ -186,31 +186,31 @@ typedef struct {
} NSVContext;
static const AVCodecTag nsv_codec_video_tags[] = {
- { CODEC_ID_VP3, MKTAG('V', 'P', '3', ' ') },
- { CODEC_ID_VP3, MKTAG('V', 'P', '3', '0') },
- { CODEC_ID_VP3, MKTAG('V', 'P', '3', '1') },
- { CODEC_ID_VP5, MKTAG('V', 'P', '5', ' ') },
- { CODEC_ID_VP5, MKTAG('V', 'P', '5', '0') },
- { CODEC_ID_VP6, MKTAG('V', 'P', '6', ' ') },
- { CODEC_ID_VP6, MKTAG('V', 'P', '6', '0') },
- { CODEC_ID_VP6, MKTAG('V', 'P', '6', '1') },
- { CODEC_ID_VP6, MKTAG('V', 'P', '6', '2') },
+ { AV_CODEC_ID_VP3, MKTAG('V', 'P', '3', ' ') },
+ { AV_CODEC_ID_VP3, MKTAG('V', 'P', '3', '0') },
+ { AV_CODEC_ID_VP3, MKTAG('V', 'P', '3', '1') },
+ { AV_CODEC_ID_VP5, MKTAG('V', 'P', '5', ' ') },
+ { AV_CODEC_ID_VP5, MKTAG('V', 'P', '5', '0') },
+ { AV_CODEC_ID_VP6, MKTAG('V', 'P', '6', ' ') },
+ { AV_CODEC_ID_VP6, MKTAG('V', 'P', '6', '0') },
+ { AV_CODEC_ID_VP6, MKTAG('V', 'P', '6', '1') },
+ { AV_CODEC_ID_VP6, MKTAG('V', 'P', '6', '2') },
/*
- { CODEC_ID_VP4, MKTAG('V', 'P', '4', ' ') },
- { CODEC_ID_VP4, MKTAG('V', 'P', '4', '0') },
+ { AV_CODEC_ID_VP4, MKTAG('V', 'P', '4', ' ') },
+ { AV_CODEC_ID_VP4, MKTAG('V', 'P', '4', '0') },
*/
- { CODEC_ID_MPEG4, MKTAG('X', 'V', 'I', 'D') }, /* cf sample xvid decoder from nsv_codec_sdk.zip */
- { CODEC_ID_RAWVIDEO, MKTAG('R', 'G', 'B', '3') },
- { CODEC_ID_NONE, 0 },
+ { AV_CODEC_ID_MPEG4, MKTAG('X', 'V', 'I', 'D') }, /* cf sample xvid decoder from nsv_codec_sdk.zip */
+ { AV_CODEC_ID_RAWVIDEO, MKTAG('R', 'G', 'B', '3') },
+ { AV_CODEC_ID_NONE, 0 },
};
static const AVCodecTag nsv_codec_audio_tags[] = {
- { CODEC_ID_MP3, MKTAG('M', 'P', '3', ' ') },
- { CODEC_ID_AAC, MKTAG('A', 'A', 'C', ' ') },
- { CODEC_ID_AAC, MKTAG('A', 'A', 'C', 'P') },
- { CODEC_ID_SPEEX, MKTAG('S', 'P', 'X', ' ') },
- { CODEC_ID_PCM_U16LE, MKTAG('P', 'C', 'M', ' ') },
- { CODEC_ID_NONE, 0 },
+ { AV_CODEC_ID_MP3, MKTAG('M', 'P', '3', ' ') },
+ { AV_CODEC_ID_AAC, MKTAG('A', 'A', 'C', ' ') },
+ { AV_CODEC_ID_AAC, MKTAG('A', 'A', 'C', 'P') },
+ { AV_CODEC_ID_SPEEX, MKTAG('S', 'P', 'X', ' ') },
+ { AV_CODEC_ID_PCM_U16LE, MKTAG('P', 'C', 'M', ' ') },
+ { AV_CODEC_ID_NONE, 0 },
};
//static int nsv_load_index(AVFormatContext *s);
@@ -252,7 +252,7 @@ static int nsv_resync(AVFormatContext *s)
nsv->state = NSV_FOUND_BEEF;
return 0;
}
- /* we read as big endian, thus the MK*BE* */
+ /* we read as big-endian, thus the MK*BE* */
if (v == TB_NSVF) { /* NSVf */
av_dlog(s, "NSV resynced on NSVf after %d bytes\n", i+1);
nsv->state = NSV_FOUND_NSVF;
@@ -269,7 +269,7 @@ static int nsv_resync(AVFormatContext *s)
return -1;
}
-static int nsv_parse_NSVf_header(AVFormatContext *s, AVFormatParameters *ap)
+static int nsv_parse_NSVf_header(AVFormatContext *s)
{
NSVContext *nsv = s->priv_data;
AVIOContext *pb = s->pb;
@@ -397,7 +397,7 @@ static int nsv_parse_NSVf_header(AVFormatContext *s, AVFormatParameters *ap)
return 0;
}
-static int nsv_parse_NSVs_header(AVFormatContext *s, AVFormatParameters *ap)
+static int nsv_parse_NSVs_header(AVFormatContext *s)
{
NSVContext *nsv = s->priv_data;
AVIOContext *pb = s->pb;
@@ -518,7 +518,7 @@ fail:
return -1;
}
-static int nsv_read_header(AVFormatContext *s, AVFormatParameters *ap)
+static int nsv_read_header(AVFormatContext *s)
{
NSVContext *nsv = s->priv_data;
int i, err;
@@ -533,13 +533,13 @@ static int nsv_read_header(AVFormatContext *s, AVFormatParameters *ap)
if (nsv_resync(s) < 0)
return -1;
if (nsv->state == NSV_FOUND_NSVF) {
- err = nsv_parse_NSVf_header(s, ap);
+ err = nsv_parse_NSVf_header(s);
if (err < 0)
return err;
}
/* we need the first NSVs also... */
if (nsv->state == NSV_FOUND_NSVS) {
- err = nsv_parse_NSVs_header(s, ap);
+ err = nsv_parse_NSVs_header(s);
if (err < 0)
return err;
break; /* we just want the first one */
@@ -566,7 +566,6 @@ static int nsv_read_chunk(AVFormatContext *s, int fill_header)
uint32_t vsize;
uint16_t asize;
uint16_t auxsize;
- uint32_t av_unused auxtag;
av_dlog(s, "%s(%d)\n", __FUNCTION__, fill_header);
@@ -582,7 +581,7 @@ null_chunk_retry:
if (err < 0)
return err;
if (nsv->state == NSV_FOUND_NSVS)
- err = nsv_parse_NSVs_header(s, NULL);
+ err = nsv_parse_NSVs_header(s);
if (err < 0)
return err;
if (nsv->state != NSV_HAS_READ_NSVS && nsv->state != NSV_FOUND_BEEF)
@@ -596,6 +595,7 @@ null_chunk_retry:
av_dlog(s, "NSV CHUNK %d aux, %u bytes video, %d bytes audio\n", auxcount, vsize, asize);
/* skip aux stuff */
for (i = 0; i < auxcount; i++) {
+ uint32_t av_unused auxtag;
auxsize = avio_rl16(pb);
auxtag = avio_rl32(pb);
av_dlog(s, "NSV aux data: '%c%c%c%c', %d bytes\n",
@@ -655,7 +655,7 @@ null_chunk_retry:
}
bps /= channels; // ???
if (bps == 8)
- st[NSV_ST_AUDIO]->codec->codec_id = CODEC_ID_PCM_U8;
+ st[NSV_ST_AUDIO]->codec->codec_id = AV_CODEC_ID_PCM_U8;
samplerate /= 4;/* UGH ??? XXX */
channels = 1;
st[NSV_ST_AUDIO]->codec->channels = channels;
@@ -720,7 +720,9 @@ static int nsv_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp
if(index < 0)
return -1;
- avio_seek(s->pb, st->index_entries[index].pos, SEEK_SET);
+ if (avio_seek(s->pb, st->index_entries[index].pos, SEEK_SET) < 0)
+ return -1;
+
nst->frame_offset = st->index_entries[index].timestamp;
nsv->state = NSV_UNSYNC;
return 0;
diff --git a/gst-libs/ext/libav/libavformat/nullenc.c b/gst-libs/ext/libav/libavformat/nullenc.c
index 9849f46..829f2a8 100644
--- a/gst-libs/ext/libav/libavformat/nullenc.c
+++ b/gst-libs/ext/libav/libavformat/nullenc.c
@@ -28,9 +28,9 @@ static int null_write_packet(struct AVFormatContext *s, AVPacket *pkt)
AVOutputFormat ff_null_muxer = {
.name = "null",
- .long_name = NULL_IF_CONFIG_SMALL("raw null video format"),
- .audio_codec = AV_NE(CODEC_ID_PCM_S16BE, CODEC_ID_PCM_S16LE),
- .video_codec = CODEC_ID_RAWVIDEO,
+ .long_name = NULL_IF_CONFIG_SMALL("raw null video"),
+ .audio_codec = AV_NE(AV_CODEC_ID_PCM_S16BE, AV_CODEC_ID_PCM_S16LE),
+ .video_codec = AV_CODEC_ID_RAWVIDEO,
.write_packet = null_write_packet,
- .flags = AVFMT_NOFILE | AVFMT_NOTIMESTAMPS | AVFMT_RAWPICTURE,
+ .flags = AVFMT_NOFILE | AVFMT_NOTIMESTAMPS | AVFMT_RAWPICTURE,
};
diff --git a/gst-libs/ext/libav/libavformat/nut.c b/gst-libs/ext/libav/libavformat/nut.c
index ac62d4f..196e04e 100644
--- a/gst-libs/ext/libav/libavformat/nut.c
+++ b/gst-libs/ext/libav/libavformat/nut.c
@@ -22,71 +22,136 @@
#include "libavutil/mathematics.h"
#include "libavutil/tree.h"
#include "nut.h"
+#include "riff.h"
#include "internal.h"
const AVCodecTag ff_nut_subtitle_tags[] = {
- { CODEC_ID_TEXT , MKTAG('U', 'T', 'F', '8') },
- { CODEC_ID_SSA , MKTAG('S', 'S', 'A', 0 ) },
- { CODEC_ID_DVD_SUBTITLE, MKTAG('D', 'V', 'D', 'S') },
- { CODEC_ID_DVB_SUBTITLE, MKTAG('D', 'V', 'B', 'S') },
- { CODEC_ID_NONE , 0 }
+ { AV_CODEC_ID_TEXT , MKTAG('U', 'T', 'F', '8') },
+ { AV_CODEC_ID_SSA , MKTAG('S', 'S', 'A', 0 ) },
+ { AV_CODEC_ID_DVD_SUBTITLE, MKTAG('D', 'V', 'D', 'S') },
+ { AV_CODEC_ID_DVB_SUBTITLE, MKTAG('D', 'V', 'B', 'S') },
+ { AV_CODEC_ID_NONE , 0 }
+};
+
+const AVCodecTag ff_nut_data_tags[] = {
+ { AV_CODEC_ID_TEXT , MKTAG('U', 'T', 'F', '8') },
+ { AV_CODEC_ID_NONE , 0 }
};
const AVCodecTag ff_nut_video_tags[] = {
- { CODEC_ID_RAWVIDEO, MKTAG('R', 'G', 'B', 15 ) },
- { CODEC_ID_RAWVIDEO, MKTAG('B', 'G', 'R', 15 ) },
- { CODEC_ID_RAWVIDEO, MKTAG('R', 'G', 'B', 16 ) },
- { CODEC_ID_RAWVIDEO, MKTAG('B', 'G', 'R', 16 ) },
- { CODEC_ID_RAWVIDEO, MKTAG(15 , 'B', 'G', 'R') },
- { CODEC_ID_RAWVIDEO, MKTAG(15 , 'R', 'G', 'B') },
- { CODEC_ID_RAWVIDEO, MKTAG(16 , 'B', 'G', 'R') },
- { CODEC_ID_RAWVIDEO, MKTAG(16 , 'R', 'G', 'B') },
- { CODEC_ID_RAWVIDEO, MKTAG('R', 'G', 'B', 12 ) },
- { CODEC_ID_RAWVIDEO, MKTAG('B', 'G', 'R', 12 ) },
- { CODEC_ID_RAWVIDEO, MKTAG(12 , 'B', 'G', 'R') },
- { CODEC_ID_RAWVIDEO, MKTAG(12 , 'R', 'G', 'B') },
- { CODEC_ID_RAWVIDEO, MKTAG('R', 'G', 'B', 'A') },
- { CODEC_ID_RAWVIDEO, MKTAG('B', 'G', 'R', 'A') },
- { CODEC_ID_RAWVIDEO, MKTAG('A', 'B', 'G', 'R') },
- { CODEC_ID_RAWVIDEO, MKTAG('A', 'R', 'G', 'B') },
- { CODEC_ID_RAWVIDEO, MKTAG('R', 'G', 'B', 24 ) },
- { CODEC_ID_RAWVIDEO, MKTAG('B', 'G', 'R', 24 ) },
- { CODEC_ID_RAWVIDEO, MKTAG('4', '1', '1', 'P') },
- { CODEC_ID_RAWVIDEO, MKTAG('4', '2', '2', 'P') },
- { CODEC_ID_RAWVIDEO, MKTAG('4', '2', '2', 'P') },
- { CODEC_ID_RAWVIDEO, MKTAG('4', '4', '0', 'P') },
- { CODEC_ID_RAWVIDEO, MKTAG('4', '4', '0', 'P') },
- { CODEC_ID_RAWVIDEO, MKTAG('4', '4', '4', 'P') },
- { CODEC_ID_RAWVIDEO, MKTAG('4', '4', '4', 'P') },
- { CODEC_ID_RAWVIDEO, MKTAG('B', '1', 'W', '0') },
- { CODEC_ID_RAWVIDEO, MKTAG('B', '0', 'W', '1') },
- { CODEC_ID_RAWVIDEO, MKTAG('B', 'G', 'R', 8 ) },
- { CODEC_ID_RAWVIDEO, MKTAG('R', 'G', 'B', 8 ) },
- { CODEC_ID_RAWVIDEO, MKTAG('B', 'G', 'R', 4 ) },
- { CODEC_ID_RAWVIDEO, MKTAG('R', 'G', 'B', 4 ) },
- { CODEC_ID_RAWVIDEO, MKTAG('B', '4', 'B', 'Y') },
- { CODEC_ID_RAWVIDEO, MKTAG('R', '4', 'B', 'Y') },
- { CODEC_ID_RAWVIDEO, MKTAG('B', 'G', 'R', 48 ) },
- { CODEC_ID_RAWVIDEO, MKTAG('R', 'G', 'B', 48 ) },
- { CODEC_ID_RAWVIDEO, MKTAG(48 , 'B', 'G', 'R') },
- { CODEC_ID_RAWVIDEO, MKTAG(48 , 'R', 'G', 'B') },
- { CODEC_ID_RAWVIDEO, MKTAG('Y', '3', 11 , 10 ) },
- { CODEC_ID_RAWVIDEO, MKTAG(10 , 11 , '3', 'Y') },
- { CODEC_ID_RAWVIDEO, MKTAG('Y', '3', 10 , 10 ) },
- { CODEC_ID_RAWVIDEO, MKTAG(10 , 10 , '3', 'Y') },
- { CODEC_ID_RAWVIDEO, MKTAG('Y', '3', 0 , 10 ) },
- { CODEC_ID_RAWVIDEO, MKTAG(10 , 0 , '3', 'Y') },
- { CODEC_ID_RAWVIDEO, MKTAG('Y', '1', 0 , 16 ) },
- { CODEC_ID_RAWVIDEO, MKTAG(16 , 0 , '1', 'Y') },
- { CODEC_ID_RAWVIDEO, MKTAG('Y', '3', 11 , 16 ) },
- { CODEC_ID_RAWVIDEO, MKTAG(16 , 11 , '3', 'Y') },
- { CODEC_ID_RAWVIDEO, MKTAG('Y', '3', 10 , 16 ) },
- { CODEC_ID_RAWVIDEO, MKTAG(16 , 10 , '3', 'Y') },
- { CODEC_ID_RAWVIDEO, MKTAG('Y', '3', 0 , 16 ) },
- { CODEC_ID_RAWVIDEO, MKTAG(16 , 0 , '3', 'Y') },
- { CODEC_ID_RAWVIDEO, MKTAG('Y', '4', 11 , 8 ) },
- { CODEC_ID_RAWVIDEO, MKTAG('Y', '2', 0 , 8 ) },
- { CODEC_ID_NONE , 0 }
+ { AV_CODEC_ID_RAWVIDEO, MKTAG('R', 'G', 'B', 15 ) },
+ { AV_CODEC_ID_RAWVIDEO, MKTAG('B', 'G', 'R', 15 ) },
+ { AV_CODEC_ID_RAWVIDEO, MKTAG('R', 'G', 'B', 16 ) },
+ { AV_CODEC_ID_RAWVIDEO, MKTAG('B', 'G', 'R', 16 ) },
+ { AV_CODEC_ID_RAWVIDEO, MKTAG(15 , 'B', 'G', 'R') },
+ { AV_CODEC_ID_RAWVIDEO, MKTAG(15 , 'R', 'G', 'B') },
+ { AV_CODEC_ID_RAWVIDEO, MKTAG(16 , 'B', 'G', 'R') },
+ { AV_CODEC_ID_RAWVIDEO, MKTAG(16 , 'R', 'G', 'B') },
+ { AV_CODEC_ID_RAWVIDEO, MKTAG('R', 'G', 'B', 12 ) },
+ { AV_CODEC_ID_RAWVIDEO, MKTAG('B', 'G', 'R', 12 ) },
+ { AV_CODEC_ID_RAWVIDEO, MKTAG(12 , 'B', 'G', 'R') },
+ { AV_CODEC_ID_RAWVIDEO, MKTAG(12 , 'R', 'G', 'B') },
+ { AV_CODEC_ID_RAWVIDEO, MKTAG('R', 'G', 'B', 'A') },
+ { AV_CODEC_ID_RAWVIDEO, MKTAG('B', 'G', 'R', 'A') },
+ { AV_CODEC_ID_RAWVIDEO, MKTAG('A', 'B', 'G', 'R') },
+ { AV_CODEC_ID_RAWVIDEO, MKTAG('A', 'R', 'G', 'B') },
+ { AV_CODEC_ID_RAWVIDEO, MKTAG('R', 'G', 'B', 24 ) },
+ { AV_CODEC_ID_RAWVIDEO, MKTAG('B', 'G', 'R', 24 ) },
+ { AV_CODEC_ID_RAWVIDEO, MKTAG('4', '1', '1', 'P') },
+ { AV_CODEC_ID_RAWVIDEO, MKTAG('4', '2', '2', 'P') },
+ { AV_CODEC_ID_RAWVIDEO, MKTAG('4', '2', '2', 'P') },
+ { AV_CODEC_ID_RAWVIDEO, MKTAG('4', '4', '0', 'P') },
+ { AV_CODEC_ID_RAWVIDEO, MKTAG('4', '4', '0', 'P') },
+ { AV_CODEC_ID_RAWVIDEO, MKTAG('4', '4', '4', 'P') },
+ { AV_CODEC_ID_RAWVIDEO, MKTAG('4', '4', '4', 'P') },
+ { AV_CODEC_ID_RAWVIDEO, MKTAG('B', '1', 'W', '0') },
+ { AV_CODEC_ID_RAWVIDEO, MKTAG('B', '0', 'W', '1') },
+ { AV_CODEC_ID_RAWVIDEO, MKTAG('B', 'G', 'R', 8 ) },
+ { AV_CODEC_ID_RAWVIDEO, MKTAG('R', 'G', 'B', 8 ) },
+ { AV_CODEC_ID_RAWVIDEO, MKTAG('B', 'G', 'R', 4 ) },
+ { AV_CODEC_ID_RAWVIDEO, MKTAG('R', 'G', 'B', 4 ) },
+ { AV_CODEC_ID_RAWVIDEO, MKTAG('B', '4', 'B', 'Y') },
+ { AV_CODEC_ID_RAWVIDEO, MKTAG('R', '4', 'B', 'Y') },
+ { AV_CODEC_ID_RAWVIDEO, MKTAG('B', 'G', 'R', 48 ) },
+ { AV_CODEC_ID_RAWVIDEO, MKTAG('R', 'G', 'B', 48 ) },
+ { AV_CODEC_ID_RAWVIDEO, MKTAG(48 , 'B', 'G', 'R') },
+ { AV_CODEC_ID_RAWVIDEO, MKTAG(48 , 'R', 'G', 'B') },
+ { AV_CODEC_ID_RAWVIDEO, MKTAG('Y', '3', 11 , 10 ) },
+ { AV_CODEC_ID_RAWVIDEO, MKTAG(10 , 11 , '3', 'Y') },
+ { AV_CODEC_ID_RAWVIDEO, MKTAG('Y', '3', 10 , 10 ) },
+ { AV_CODEC_ID_RAWVIDEO, MKTAG(10 , 10 , '3', 'Y') },
+ { AV_CODEC_ID_RAWVIDEO, MKTAG('Y', '3', 0 , 10 ) },
+ { AV_CODEC_ID_RAWVIDEO, MKTAG(10 , 0 , '3', 'Y') },
+ { AV_CODEC_ID_RAWVIDEO, MKTAG('Y', '1', 0 , 16 ) },
+ { AV_CODEC_ID_RAWVIDEO, MKTAG(16 , 0 , '1', 'Y') },
+ { AV_CODEC_ID_RAWVIDEO, MKTAG('Y', '3', 11 , 16 ) },
+ { AV_CODEC_ID_RAWVIDEO, MKTAG(16 , 11 , '3', 'Y') },
+ { AV_CODEC_ID_RAWVIDEO, MKTAG('Y', '3', 10 , 16 ) },
+ { AV_CODEC_ID_RAWVIDEO, MKTAG(16 , 10 , '3', 'Y') },
+ { AV_CODEC_ID_RAWVIDEO, MKTAG('Y', '3', 0 , 16 ) },
+ { AV_CODEC_ID_RAWVIDEO, MKTAG(16 , 0 , '3', 'Y') },
+ { AV_CODEC_ID_RAWVIDEO, MKTAG('Y', '4', 11 , 8 ) },
+ { AV_CODEC_ID_RAWVIDEO, MKTAG('Y', '2', 0 , 8 ) },
+
+ { AV_CODEC_ID_RAWVIDEO, MKTAG('Y', '1', 0 , 9 ) },
+ { AV_CODEC_ID_RAWVIDEO, MKTAG( 9 , 0 , '1', 'Y') },
+ { AV_CODEC_ID_RAWVIDEO, MKTAG('Y', '4', 11 , 9 ) },
+ { AV_CODEC_ID_RAWVIDEO, MKTAG( 9 , 11 , '4', 'Y') },
+ { AV_CODEC_ID_RAWVIDEO, MKTAG('Y', '4', 10 , 9 ) },
+ { AV_CODEC_ID_RAWVIDEO, MKTAG( 9 , 10 , '4', 'Y') },
+ { AV_CODEC_ID_RAWVIDEO, MKTAG('Y', '4', 0 , 9 ) },
+ { AV_CODEC_ID_RAWVIDEO, MKTAG( 9 , 0 , '4', 'Y') },
+
+ { AV_CODEC_ID_RAWVIDEO, MKTAG('Y', '1', 0 , 10 ) },
+ { AV_CODEC_ID_RAWVIDEO, MKTAG(10 , 0 , '1', 'Y') },
+ { AV_CODEC_ID_RAWVIDEO, MKTAG('Y', '4', 11 , 10 ) },
+ { AV_CODEC_ID_RAWVIDEO, MKTAG(10 , 11 , '4', 'Y') },
+ { AV_CODEC_ID_RAWVIDEO, MKTAG('Y', '4', 10 , 10 ) },
+ { AV_CODEC_ID_RAWVIDEO, MKTAG(10 , 10 , '4', 'Y') },
+ { AV_CODEC_ID_RAWVIDEO, MKTAG('Y', '4', 0 , 10 ) },
+ { AV_CODEC_ID_RAWVIDEO, MKTAG(10 , 0 , '4', 'Y') },
+
+ { AV_CODEC_ID_RAWVIDEO, MKTAG('Y', '1', 0 , 16 ) },
+ { AV_CODEC_ID_RAWVIDEO, MKTAG(16 , 0 , '1', 'Y') },
+ { AV_CODEC_ID_RAWVIDEO, MKTAG('Y', '4', 11 , 16 ) },
+ { AV_CODEC_ID_RAWVIDEO, MKTAG(16 , 11 , '4', 'Y') },
+ { AV_CODEC_ID_RAWVIDEO, MKTAG('Y', '4', 10 , 16 ) },
+ { AV_CODEC_ID_RAWVIDEO, MKTAG(16 , 10 , '4', 'Y') },
+ { AV_CODEC_ID_RAWVIDEO, MKTAG('Y', '4', 0 , 16 ) },
+ { AV_CODEC_ID_RAWVIDEO, MKTAG(16 , 0 , '4', 'Y') },
+
+ { AV_CODEC_ID_NONE , 0 }
+};
+
+const AVCodecTag ff_nut_audio_tags[] = {
+ { AV_CODEC_ID_PCM_ALAW, MKTAG('A', 'L', 'A', 'W') },
+ { AV_CODEC_ID_PCM_MULAW, MKTAG('U', 'L', 'A', 'W') },
+ { AV_CODEC_ID_PCM_F32BE, MKTAG(32 , 'D', 'F', 'P') },
+ { AV_CODEC_ID_PCM_F32LE, MKTAG('P', 'F', 'D', 32 ) },
+ { AV_CODEC_ID_PCM_F64BE, MKTAG(64 , 'D', 'F', 'P') },
+ { AV_CODEC_ID_PCM_F64LE, MKTAG('P', 'F', 'D', 64 ) },
+ { AV_CODEC_ID_PCM_S16BE, MKTAG(16 , 'D', 'S', 'P') },
+ { AV_CODEC_ID_PCM_S16LE, MKTAG('P', 'S', 'D', 16 ) },
+ { AV_CODEC_ID_PCM_S24BE, MKTAG(24 , 'D', 'S', 'P') },
+ { AV_CODEC_ID_PCM_S24LE, MKTAG('P', 'S', 'D', 24 ) },
+ { AV_CODEC_ID_PCM_S32BE, MKTAG(32 , 'D', 'S', 'P') },
+ { AV_CODEC_ID_PCM_S32LE, MKTAG('P', 'S', 'D', 32 ) },
+ { AV_CODEC_ID_PCM_S8, MKTAG('P', 'S', 'D', 8 ) },
+ { AV_CODEC_ID_PCM_U16BE, MKTAG(16 , 'D', 'U', 'P') },
+ { AV_CODEC_ID_PCM_U16LE, MKTAG('P', 'U', 'D', 16 ) },
+ { AV_CODEC_ID_PCM_U24BE, MKTAG(24 , 'D', 'U', 'P') },
+ { AV_CODEC_ID_PCM_U24LE, MKTAG('P', 'U', 'D', 24 ) },
+ { AV_CODEC_ID_PCM_U32BE, MKTAG(32 , 'D', 'U', 'P') },
+ { AV_CODEC_ID_PCM_U32LE, MKTAG('P', 'U', 'D', 32 ) },
+ { AV_CODEC_ID_PCM_U8, MKTAG('P', 'U', 'D', 8 ) },
+ { AV_CODEC_ID_PCM_S16LE_PLANAR, MKTAG('P', 'S', 'P', 16 ) },
+ { AV_CODEC_ID_MP3, MKTAG('M', 'P', '3', ' ') },
+ { AV_CODEC_ID_NONE, 0 }
+};
+
+const AVCodecTag * const ff_nut_codec_tags[] = {
+ ff_nut_video_tags, ff_nut_audio_tags, ff_nut_subtitle_tags,
+ ff_codec_bmp_tags, ff_codec_wav_tags, ff_nut_data_tags, 0
};
void ff_nut_reset_ts(NUTContext *nut, AVRational time_base, int64_t val){
@@ -116,7 +181,7 @@ int ff_nut_sp_pts_cmp(const Syncpoint *a, const Syncpoint *b){
void ff_nut_add_sp(NUTContext *nut, int64_t pos, int64_t back_ptr, int64_t ts){
Syncpoint *sp= av_mallocz(sizeof(Syncpoint));
- struct AVTreeNode *node= av_mallocz(av_tree_node_size);
+ struct AVTreeNode *node = av_tree_node_alloc();
sp->pos= pos;
sp->back_ptr= back_ptr;
diff --git a/gst-libs/ext/libav/libavformat/nut.h b/gst-libs/ext/libav/libavformat/nut.h
index 419b123..89b0248 100644
--- a/gst-libs/ext/libav/libavformat/nut.h
+++ b/gst-libs/ext/libav/libavformat/nut.h
@@ -26,7 +26,7 @@
//#include "libavutil/adler32.h"
//#include "libavcodec/mpegaudio.h"
#include "avformat.h"
-#include "riff.h"
+#include "internal.h"
#include "metadata.h"
#define MAIN_STARTCODE (0x7A561F5F04ADULL + (((uint64_t)('N'<<8) + 'M')<<48))
@@ -53,14 +53,14 @@ typedef enum{
FLAG_INVALID =8192, ///<if set, frame_code is invalid
} Flag;
-typedef struct {
+typedef struct Syncpoint {
uint64_t pos;
uint64_t back_ptr;
// uint64_t global_key_pts;
int64_t ts;
} Syncpoint;
-typedef struct {
+typedef struct FrameCode {
uint16_t flags;
uint8_t stream_id;
uint16_t size_mul;
@@ -70,7 +70,7 @@ typedef struct {
uint8_t header_idx;
} FrameCode;
-typedef struct {
+typedef struct StreamContext {
int last_flags;
int skip_until_key_frame;
int64_t last_pts;
@@ -81,11 +81,11 @@ typedef struct {
int decode_delay; //FIXME duplicate of has_b_frames
} StreamContext;
-typedef struct {
+typedef struct ChapterContext {
AVRational *time_base;
} ChapterContext;
-typedef struct {
+typedef struct NUTContext {
AVFormatContext *avf;
// int written_packet_size;
// int64_t packet_start;
@@ -105,8 +105,12 @@ typedef struct {
extern const AVCodecTag ff_nut_subtitle_tags[];
extern const AVCodecTag ff_nut_video_tags[];
+extern const AVCodecTag ff_nut_audio_tags[];
+extern const AVCodecTag ff_nut_data_tags[];
-typedef struct {
+extern const AVCodecTag * const ff_nut_codec_tags[];
+
+typedef struct Dispositions {
char str[9];
int flag;
} Dispositions;
diff --git a/gst-libs/ext/libav/libavformat/nutdec.c b/gst-libs/ext/libav/libavformat/nutdec.c
index 9cec89e..b705987 100644
--- a/gst-libs/ext/libav/libavformat/nutdec.c
+++ b/gst-libs/ext/libav/libavformat/nutdec.c
@@ -27,85 +27,94 @@
#include "libavutil/tree.h"
#include "avio_internal.h"
#include "nut.h"
+#include "riff.h"
#undef NDEBUG
#include <assert.h>
#define NUT_MAX_STREAMS 256 /* arbitrary sanity check value */
-static int get_str(AVIOContext *bc, char *string, unsigned int maxlen){
- unsigned int len= ffio_read_varlen(bc);
+static int get_str(AVIOContext *bc, char *string, unsigned int maxlen)
+{
+ unsigned int len = ffio_read_varlen(bc);
- if(len && maxlen)
+ if (len && maxlen)
avio_read(bc, string, FFMIN(len, maxlen));
- while(len > maxlen){
+ while (len > maxlen) {
avio_r8(bc);
len--;
}
- if(maxlen)
- string[FFMIN(len, maxlen-1)]= 0;
+ if (maxlen)
+ string[FFMIN(len, maxlen - 1)] = 0;
- if(maxlen == len)
+ if (maxlen == len)
return -1;
else
return 0;
}
-static int64_t get_s(AVIOContext *bc){
+static int64_t get_s(AVIOContext *bc)
+{
int64_t v = ffio_read_varlen(bc) + 1;
- if (v&1) return -(v>>1);
- else return (v>>1);
+ if (v & 1)
+ return -(v >> 1);
+ else
+ return (v >> 1);
}
-static uint64_t get_fourcc(AVIOContext *bc){
- unsigned int len= ffio_read_varlen(bc);
+static uint64_t get_fourcc(AVIOContext *bc)
+{
+ unsigned int len = ffio_read_varlen(bc);
- if (len==2) return avio_rl16(bc);
- else if(len==4) return avio_rl32(bc);
- else return -1;
+ if (len == 2)
+ return avio_rl16(bc);
+ else if (len == 4)
+ return avio_rl32(bc);
+ else
+ return -1;
}
#ifdef TRACE
-static inline uint64_t get_v_trace(AVIOContext *bc, char *file, char *func, int line){
- uint64_t v= ffio_read_varlen(bc);
+static inline uint64_t get_v_trace(AVIOContext *bc, const char *file,
+ const char *func, int line)
+{
+ uint64_t v = ffio_read_varlen(bc);
- av_log(NULL, AV_LOG_DEBUG, "get_v %5"PRId64" / %"PRIX64" in %s %s:%d\n", v, v, file, func, line);
+ av_log(NULL, AV_LOG_DEBUG, "get_v %5"PRId64" / %"PRIX64" in %s %s:%d\n",
+ v, v, file, func, line);
return v;
}
-static inline int64_t get_s_trace(AVIOContext *bc, char *file, char *func, int line){
- int64_t v= get_s(bc);
+static inline int64_t get_s_trace(AVIOContext *bc, const char *file,
+ const char *func, int line)
+{
+ int64_t v = get_s(bc);
- av_log(NULL, AV_LOG_DEBUG, "get_s %5"PRId64" / %"PRIX64" in %s %s:%d\n", v, v, file, func, line);
+ av_log(NULL, AV_LOG_DEBUG, "get_s %5"PRId64" / %"PRIX64" in %s %s:%d\n",
+ v, v, file, func, line);
return v;
}
-static inline uint64_t get_vb_trace(AVIOContext *bc, char *file, char *func, int line){
- uint64_t v= get_vb(bc);
-
- av_log(NULL, AV_LOG_DEBUG, "get_vb %5"PRId64" / %"PRIX64" in %s %s:%d\n", v, v, file, func, line);
- return v;
-}
-#define ffio_read_varlen(bc) get_v_trace(bc, __FILE__, __PRETTY_FUNCTION__, __LINE__)
-#define get_s(bc) get_s_trace(bc, __FILE__, __PRETTY_FUNCTION__, __LINE__)
-#define get_vb(bc) get_vb_trace(bc, __FILE__, __PRETTY_FUNCTION__, __LINE__)
+#define ffio_read_varlen(bc) get_v_trace(bc, __FILE__, __PRETTY_FUNCTION__, __LINE__)
+#define get_s(bc) get_s_trace(bc, __FILE__, __PRETTY_FUNCTION__, __LINE__)
#endif
-static int get_packetheader(NUTContext *nut, AVIOContext *bc, int calculate_checksum, uint64_t startcode)
+static int get_packetheader(NUTContext *nut, AVIOContext *bc,
+ int calculate_checksum, uint64_t startcode)
{
int64_t size;
-// start= avio_tell(bc) - 8;
+// start = avio_tell(bc) - 8;
- startcode= av_be2ne64(startcode);
- startcode= ff_crc04C11DB7_update(0, (uint8_t*)&startcode, 8);
+ startcode = av_be2ne64(startcode);
+ startcode = ff_crc04C11DB7_update(0, (uint8_t*) &startcode, 8);
ffio_init_checksum(bc, ff_crc04C11DB7_update, startcode);
- size= ffio_read_varlen(bc);
- if(size > 4096)
+ size = ffio_read_varlen(bc);
+ if (size > 4096)
avio_rb32(bc);
- if(ffio_get_checksum(bc) && size > 4096)
+ if (ffio_get_checksum(bc) && size > 4096)
return -1;
ffio_init_checksum(bc, calculate_checksum ? ff_crc04C11DB7_update : NULL, 0);
@@ -113,17 +122,19 @@ static int get_packetheader(NUTContext *nut, AVIOContext *bc, int calculate_chec
return size;
}
-static uint64_t find_any_startcode(AVIOContext *bc, int64_t pos){
- uint64_t state=0;
-
- if(pos >= 0)
- avio_seek(bc, pos, SEEK_SET); //note, this may fail if the stream is not seekable, but that should not matter, as in this case we simply start where we currently are
-
- while(!bc->eof_reached){
- state= (state<<8) | avio_r8(bc);
- if((state>>56) != 'N')
+static uint64_t find_any_startcode(AVIOContext *bc, int64_t pos)
+{
+ uint64_t state = 0;
+
+ if (pos >= 0)
+ /* Note, this may fail if the stream is not seekable, but that should
+ * not matter, as in this case we simply start where we currently are */
+ avio_seek(bc, pos, SEEK_SET);
+ while (!bc->eof_reached) {
+ state = (state << 8) | avio_r8(bc);
+ if ((state >> 56) != 'N')
continue;
- switch(state){
+ switch (state) {
case MAIN_STARTCODE:
case STREAM_STARTCODE:
case SYNCPOINT_STARTCODE:
@@ -142,20 +153,22 @@ static uint64_t find_any_startcode(AVIOContext *bc, int64_t pos){
* @param pos the start position of the search, or -1 if the current position
* @return the position of the startcode or -1 if not found
*/
-static int64_t find_startcode(AVIOContext *bc, uint64_t code, int64_t pos){
- for(;;){
- uint64_t startcode= find_any_startcode(bc, pos);
- if(startcode == code)
+static int64_t find_startcode(AVIOContext *bc, uint64_t code, int64_t pos)
+{
+ for (;;) {
+ uint64_t startcode = find_any_startcode(bc, pos);
+ if (startcode == code)
return avio_tell(bc) - 8;
- else if(startcode == 0)
+ else if (startcode == 0)
return -1;
- pos=-1;
+ pos = -1;
}
}
-static int nut_probe(AVProbeData *p){
+static int nut_probe(AVProbeData *p)
+{
int i;
- uint64_t code= 0;
+ uint64_t code = 0;
for (i = 0; i < p->buf_size; i++) {
code = (code << 8) | p->buf[i];
@@ -165,225 +178,260 @@ static int nut_probe(AVProbeData *p){
return 0;
}
-#define GET_V(dst, check) \
- tmp= ffio_read_varlen(bc);\
- if(!(check)){\
- av_log(s, AV_LOG_ERROR, "Error " #dst " is (%"PRId64")\n", tmp);\
- return -1;\
- }\
- dst= tmp;
-
-static int skip_reserved(AVIOContext *bc, int64_t pos){
+#define GET_V(dst, check) \
+ do { \
+ tmp = ffio_read_varlen(bc); \
+ if (!(check)) { \
+ av_log(s, AV_LOG_ERROR, "Error " #dst " is (%"PRId64")\n", tmp); \
+ return -1; \
+ } \
+ dst = tmp; \
+ } while (0)
+
+static int skip_reserved(AVIOContext *bc, int64_t pos)
+{
pos -= avio_tell(bc);
- if(pos<0){
+ if (pos < 0) {
avio_seek(bc, pos, SEEK_CUR);
return -1;
- }else{
- while(pos--)
+ } else {
+ while (pos--)
avio_r8(bc);
return 0;
}
}
-static int decode_main_header(NUTContext *nut){
- AVFormatContext *s= nut->avf;
- AVIOContext *bc = s->pb;
+static int decode_main_header(NUTContext *nut)
+{
+ AVFormatContext *s = nut->avf;
+ AVIOContext *bc = s->pb;
uint64_t tmp, end;
unsigned int stream_count;
- int i, j, tmp_stream, tmp_mul, tmp_pts, tmp_size, count, tmp_res, tmp_head_idx;
+ int i, j, count;
+ int tmp_stream, tmp_mul, tmp_pts, tmp_size, tmp_res, tmp_head_idx;
- end= get_packetheader(nut, bc, 1, MAIN_STARTCODE);
+ end = get_packetheader(nut, bc, 1, MAIN_STARTCODE);
end += avio_tell(bc);
- GET_V(tmp , tmp >=2 && tmp <= 3)
- GET_V(stream_count , tmp > 0 && tmp <= NUT_MAX_STREAMS)
+ GET_V(tmp, tmp >= 2 && tmp <= 3);
+ GET_V(stream_count, tmp > 0 && tmp <= NUT_MAX_STREAMS);
nut->max_distance = ffio_read_varlen(bc);
- if(nut->max_distance > 65536){
+ if (nut->max_distance > 65536) {
av_log(s, AV_LOG_DEBUG, "max_distance %d\n", nut->max_distance);
- nut->max_distance= 65536;
+ nut->max_distance = 65536;
}
- GET_V(nut->time_base_count, tmp>0 && tmp<INT_MAX / sizeof(AVRational))
- nut->time_base= av_malloc(nut->time_base_count * sizeof(AVRational));
+ GET_V(nut->time_base_count, tmp > 0 && tmp < INT_MAX / sizeof(AVRational));
+ nut->time_base = av_malloc(nut->time_base_count * sizeof(AVRational));
- for(i=0; i<nut->time_base_count; i++){
- GET_V(nut->time_base[i].num, tmp>0 && tmp<(1ULL<<31))
- GET_V(nut->time_base[i].den, tmp>0 && tmp<(1ULL<<31))
- if(av_gcd(nut->time_base[i].num, nut->time_base[i].den) != 1){
+ for (i = 0; i < nut->time_base_count; i++) {
+ GET_V(nut->time_base[i].num, tmp > 0 && tmp < (1ULL << 31));
+ GET_V(nut->time_base[i].den, tmp > 0 && tmp < (1ULL << 31));
+ if (av_gcd(nut->time_base[i].num, nut->time_base[i].den) != 1) {
av_log(s, AV_LOG_ERROR, "time base invalid\n");
return AVERROR_INVALIDDATA;
}
}
- tmp_pts=0;
- tmp_mul=1;
- tmp_stream=0;
- tmp_head_idx= 0;
- for(i=0; i<256;){
- int tmp_flags = ffio_read_varlen(bc);
- int tmp_fields= ffio_read_varlen(bc);
- if(tmp_fields>0) tmp_pts = get_s(bc);
- if(tmp_fields>1) tmp_mul = ffio_read_varlen(bc);
- if(tmp_fields>2) tmp_stream= ffio_read_varlen(bc);
- if(tmp_fields>3) tmp_size = ffio_read_varlen(bc);
- else tmp_size = 0;
- if(tmp_fields>4) tmp_res = ffio_read_varlen(bc);
- else tmp_res = 0;
- if(tmp_fields>5) count = ffio_read_varlen(bc);
- else count = tmp_mul - tmp_size;
- if(tmp_fields>6) get_s(bc);
- if(tmp_fields>7) tmp_head_idx= ffio_read_varlen(bc);
-
- while(tmp_fields-- > 8)
- ffio_read_varlen(bc);
-
- if(count == 0 || i+count > 256){
+ tmp_pts = 0;
+ tmp_mul = 1;
+ tmp_stream = 0;
+ tmp_head_idx = 0;
+ for (i = 0; i < 256;) {
+ int tmp_flags = ffio_read_varlen(bc);
+ int tmp_fields = ffio_read_varlen(bc);
+
+ if (tmp_fields > 0)
+ tmp_pts = get_s(bc);
+ if (tmp_fields > 1)
+ tmp_mul = ffio_read_varlen(bc);
+ if (tmp_fields > 2)
+ tmp_stream = ffio_read_varlen(bc);
+ if (tmp_fields > 3)
+ tmp_size = ffio_read_varlen(bc);
+ else
+ tmp_size = 0;
+ if (tmp_fields > 4)
+ tmp_res = ffio_read_varlen(bc);
+ else
+ tmp_res = 0;
+ if (tmp_fields > 5)
+ count = ffio_read_varlen(bc);
+ else
+ count = tmp_mul - tmp_size;
+ if (tmp_fields > 6)
+ get_s(bc);
+ if (tmp_fields > 7)
+ tmp_head_idx = ffio_read_varlen(bc);
+
+ while (tmp_fields-- > 8)
+ ffio_read_varlen(bc);
+
+ if (count == 0 || i + count > 256) {
av_log(s, AV_LOG_ERROR, "illegal count %d at %d\n", count, i);
return AVERROR_INVALIDDATA;
}
- if(tmp_stream >= stream_count){
+ if (tmp_stream >= stream_count) {
av_log(s, AV_LOG_ERROR, "illegal stream number\n");
return AVERROR_INVALIDDATA;
}
- for(j=0; j<count; j++,i++){
+ for (j = 0; j < count; j++, i++) {
if (i == 'N') {
- nut->frame_code[i].flags= FLAG_INVALID;
+ nut->frame_code[i].flags = FLAG_INVALID;
j--;
continue;
}
- nut->frame_code[i].flags = tmp_flags ;
- nut->frame_code[i].pts_delta = tmp_pts ;
- nut->frame_code[i].stream_id = tmp_stream;
- nut->frame_code[i].size_mul = tmp_mul ;
- nut->frame_code[i].size_lsb = tmp_size+j;
- nut->frame_code[i].reserved_count = tmp_res ;
- nut->frame_code[i].header_idx = tmp_head_idx;
+ nut->frame_code[i].flags = tmp_flags;
+ nut->frame_code[i].pts_delta = tmp_pts;
+ nut->frame_code[i].stream_id = tmp_stream;
+ nut->frame_code[i].size_mul = tmp_mul;
+ nut->frame_code[i].size_lsb = tmp_size + j;
+ nut->frame_code[i].reserved_count = tmp_res;
+ nut->frame_code[i].header_idx = tmp_head_idx;
}
}
assert(nut->frame_code['N'].flags == FLAG_INVALID);
- if(end > avio_tell(bc) + 4){
- int rem= 1024;
- GET_V(nut->header_count, tmp<128U)
+ if (end > avio_tell(bc) + 4) {
+ int rem = 1024;
+ GET_V(nut->header_count, tmp < 128U);
nut->header_count++;
- for(i=1; i<nut->header_count; i++){
- GET_V(nut->header_len[i], tmp>0 && tmp<256);
+ for (i = 1; i < nut->header_count; i++) {
+ uint8_t *hdr;
+ GET_V(nut->header_len[i], tmp > 0 && tmp < 256);
rem -= nut->header_len[i];
- if(rem < 0){
+ if (rem < 0) {
av_log(s, AV_LOG_ERROR, "invalid elision header\n");
return AVERROR_INVALIDDATA;
}
- nut->header[i]= av_malloc(nut->header_len[i]);
- avio_read(bc, nut->header[i], nut->header_len[i]);
+ hdr = av_malloc(nut->header_len[i]);
+ if (!hdr)
+ return AVERROR(ENOMEM);
+ avio_read(bc, hdr, nut->header_len[i]);
+ nut->header[i] = hdr;
}
- assert(nut->header_len[0]==0);
+ assert(nut->header_len[0] == 0);
}
- if(skip_reserved(bc, end) || ffio_get_checksum(bc)){
+ if (skip_reserved(bc, end) || ffio_get_checksum(bc)) {
av_log(s, AV_LOG_ERROR, "main header checksum mismatch\n");
return AVERROR_INVALIDDATA;
}
- nut->stream = av_mallocz(sizeof(StreamContext)*stream_count);
- for(i=0; i<stream_count; i++){
+ nut->stream = av_mallocz(sizeof(StreamContext) * stream_count);
+ for (i = 0; i < stream_count; i++)
avformat_new_stream(s, NULL);
- }
return 0;
}
-static int decode_stream_header(NUTContext *nut){
- AVFormatContext *s= nut->avf;
- AVIOContext *bc = s->pb;
+static int decode_stream_header(NUTContext *nut)
+{
+ AVFormatContext *s = nut->avf;
+ AVIOContext *bc = s->pb;
StreamContext *stc;
int class, stream_id;
uint64_t tmp, end;
AVStream *st;
- end= get_packetheader(nut, bc, 1, STREAM_STARTCODE);
+ end = get_packetheader(nut, bc, 1, STREAM_STARTCODE);
end += avio_tell(bc);
GET_V(stream_id, tmp < s->nb_streams && !nut->stream[tmp].time_base);
- stc= &nut->stream[stream_id];
-
- st = s->streams[stream_id];
+ stc = &nut->stream[stream_id];
+ st = s->streams[stream_id];
if (!st)
return AVERROR(ENOMEM);
- class = ffio_read_varlen(bc);
- tmp = get_fourcc(bc);
- st->codec->codec_tag= tmp;
- switch(class)
- {
- case 0:
- st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
- st->codec->codec_id = av_codec_get_id(
- (const AVCodecTag * const []) { ff_codec_bmp_tags, ff_nut_video_tags, 0 },
- tmp);
- break;
- case 1:
- st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
- st->codec->codec_id = ff_codec_get_id(ff_codec_wav_tags, tmp);
- break;
- case 2:
- st->codec->codec_type = AVMEDIA_TYPE_SUBTITLE;
- st->codec->codec_id = ff_codec_get_id(ff_nut_subtitle_tags, tmp);
- break;
- case 3:
- st->codec->codec_type = AVMEDIA_TYPE_DATA;
- break;
- default:
- av_log(s, AV_LOG_ERROR, "unknown stream class (%d)\n", class);
- return -1;
+ class = ffio_read_varlen(bc);
+ tmp = get_fourcc(bc);
+ st->codec->codec_tag = tmp;
+ switch (class) {
+ case 0:
+ st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
+ st->codec->codec_id = av_codec_get_id((const AVCodecTag * const []) {
+ ff_nut_video_tags,
+ ff_codec_bmp_tags,
+ 0
+ },
+ tmp);
+ break;
+ case 1:
+ st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
+ st->codec->codec_id = av_codec_get_id((const AVCodecTag * const []) {
+ ff_nut_audio_tags,
+ ff_codec_wav_tags,
+ 0
+ },
+ tmp);
+ break;
+ case 2:
+ st->codec->codec_type = AVMEDIA_TYPE_SUBTITLE;
+ st->codec->codec_id = ff_codec_get_id(ff_nut_subtitle_tags, tmp);
+ break;
+ case 3:
+ st->codec->codec_type = AVMEDIA_TYPE_DATA;
+ st->codec->codec_id = ff_codec_get_id(ff_nut_data_tags, tmp);
+ break;
+ default:
+ av_log(s, AV_LOG_ERROR, "unknown stream class (%d)\n", class);
+ return -1;
}
- if(class<3 && st->codec->codec_id == CODEC_ID_NONE)
- av_log(s, AV_LOG_ERROR, "Unknown codec tag '0x%04x' for stream number %d\n",
- (unsigned int)tmp, stream_id);
-
- GET_V(stc->time_base_id , tmp < nut->time_base_count);
- GET_V(stc->msb_pts_shift , tmp < 16);
- stc->max_pts_distance= ffio_read_varlen(bc);
- GET_V(stc->decode_delay , tmp < 1000); //sanity limit, raise this if Moore's law is true
- st->codec->has_b_frames= stc->decode_delay;
- ffio_read_varlen(bc); //stream flags
-
- GET_V(st->codec->extradata_size, tmp < (1<<30));
- if(st->codec->extradata_size){
- st->codec->extradata= av_mallocz(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
+ if (class < 3 && st->codec->codec_id == AV_CODEC_ID_NONE)
+ av_log(s, AV_LOG_ERROR,
+ "Unknown codec tag '0x%04x' for stream number %d\n",
+ (unsigned int) tmp, stream_id);
+
+ GET_V(stc->time_base_id, tmp < nut->time_base_count);
+ GET_V(stc->msb_pts_shift, tmp < 16);
+ stc->max_pts_distance = ffio_read_varlen(bc);
+ GET_V(stc->decode_delay, tmp < 1000); // sanity limit, raise this if Moore's law is true
+ st->codec->has_b_frames = stc->decode_delay;
+ ffio_read_varlen(bc); // stream flags
+
+ GET_V(st->codec->extradata_size, tmp < (1 << 30));
+ if (st->codec->extradata_size) {
+ st->codec->extradata = av_mallocz(st->codec->extradata_size +
+ FF_INPUT_BUFFER_PADDING_SIZE);
avio_read(bc, st->codec->extradata, st->codec->extradata_size);
}
- if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO){
- GET_V(st->codec->width , tmp > 0)
- GET_V(st->codec->height, tmp > 0)
- st->sample_aspect_ratio.num= ffio_read_varlen(bc);
- st->sample_aspect_ratio.den= ffio_read_varlen(bc);
- if((!st->sample_aspect_ratio.num) != (!st->sample_aspect_ratio.den)){
- av_log(s, AV_LOG_ERROR, "invalid aspect ratio %d/%d\n", st->sample_aspect_ratio.num, st->sample_aspect_ratio.den);
+ if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
+ GET_V(st->codec->width, tmp > 0);
+ GET_V(st->codec->height, tmp > 0);
+ st->sample_aspect_ratio.num = ffio_read_varlen(bc);
+ st->sample_aspect_ratio.den = ffio_read_varlen(bc);
+ if ((!st->sample_aspect_ratio.num) != (!st->sample_aspect_ratio.den)) {
+ av_log(s, AV_LOG_ERROR, "invalid aspect ratio %d/%d\n",
+ st->sample_aspect_ratio.num, st->sample_aspect_ratio.den);
return -1;
}
ffio_read_varlen(bc); /* csp type */
- }else if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO){
- GET_V(st->codec->sample_rate , tmp > 0)
+ } else if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO) {
+ GET_V(st->codec->sample_rate, tmp > 0);
ffio_read_varlen(bc); // samplerate_den
- GET_V(st->codec->channels, tmp > 0)
+ GET_V(st->codec->channels, tmp > 0);
}
- if(skip_reserved(bc, end) || ffio_get_checksum(bc)){
- av_log(s, AV_LOG_ERROR, "stream header %d checksum mismatch\n", stream_id);
+ if (skip_reserved(bc, end) || ffio_get_checksum(bc)) {
+ av_log(s, AV_LOG_ERROR,
+ "stream header %d checksum mismatch\n", stream_id);
return -1;
}
- stc->time_base= &nut->time_base[stc->time_base_id];
- avpriv_set_pts_info(s->streams[stream_id], 63, stc->time_base->num, stc->time_base->den);
+ stc->time_base = &nut->time_base[stc->time_base_id];
+ avpriv_set_pts_info(s->streams[stream_id], 63, stc->time_base->num,
+ stc->time_base->den);
return 0;
}
-static void set_disposition_bits(AVFormatContext* avf, char* value, int stream_id){
+static void set_disposition_bits(AVFormatContext *avf, char *value,
+ int stream_id)
+{
int flag = 0, i;
- for (i=0; ff_nut_dispositions[i].flag; ++i) {
+
+ for (i = 0; ff_nut_dispositions[i].flag; ++i)
if (!strcmp(ff_nut_dispositions[i].str, value))
flag = ff_nut_dispositions[i].flag;
- }
if (!flag)
av_log(avf, AV_LOG_INFO, "unknown disposition type '%s'\n", value);
for (i = 0; i < avf->nb_streams; ++i)
@@ -391,61 +439,63 @@ static void set_disposition_bits(AVFormatContext* avf, char* value, int stream_i
avf->streams[i]->disposition |= flag;
}
-static int decode_info_header(NUTContext *nut){
- AVFormatContext *s= nut->avf;
- AVIOContext *bc = s->pb;
+static int decode_info_header(NUTContext *nut)
+{
+ AVFormatContext *s = nut->avf;
+ AVIOContext *bc = s->pb;
uint64_t tmp, chapter_start, chapter_len;
unsigned int stream_id_plus1, count;
int chapter_id, i;
int64_t value, end;
char name[256], str_value[1024], type_str[256];
const char *type;
- AVChapter *chapter= NULL;
- AVStream *st= NULL;
+ AVChapter *chapter = NULL;
+ AVStream *st = NULL;
AVDictionary **metadata = NULL;
- end= get_packetheader(nut, bc, 1, INFO_STARTCODE);
+ end = get_packetheader(nut, bc, 1, INFO_STARTCODE);
end += avio_tell(bc);
- GET_V(stream_id_plus1, tmp <= s->nb_streams)
- chapter_id = get_s(bc);
- chapter_start= ffio_read_varlen(bc);
- chapter_len = ffio_read_varlen(bc);
- count = ffio_read_varlen(bc);
-
- if(chapter_id && !stream_id_plus1){
- int64_t start= chapter_start / nut->time_base_count;
- chapter= avpriv_new_chapter(s, chapter_id,
- nut->time_base[chapter_start % nut->time_base_count],
- start, start + chapter_len, NULL);
+ GET_V(stream_id_plus1, tmp <= s->nb_streams);
+ chapter_id = get_s(bc);
+ chapter_start = ffio_read_varlen(bc);
+ chapter_len = ffio_read_varlen(bc);
+ count = ffio_read_varlen(bc);
+
+ if (chapter_id && !stream_id_plus1) {
+ int64_t start = chapter_start / nut->time_base_count;
+ chapter = avpriv_new_chapter(s, chapter_id,
+ nut->time_base[chapter_start %
+ nut->time_base_count],
+ start, start + chapter_len, NULL);
metadata = &chapter->metadata;
- } else if(stream_id_plus1) {
- st= s->streams[stream_id_plus1 - 1];
+ } else if (stream_id_plus1) {
+ st = s->streams[stream_id_plus1 - 1];
metadata = &st->metadata;
} else
metadata = &s->metadata;
- for(i=0; i<count; i++){
+ for (i = 0; i < count; i++) {
get_str(bc, name, sizeof(name));
- value= get_s(bc);
- if(value == -1){
- type= "UTF-8";
+ value = get_s(bc);
+ if (value == -1) {
+ type = "UTF-8";
get_str(bc, str_value, sizeof(str_value));
- }else if(value == -2){
+ } else if (value == -2) {
get_str(bc, type_str, sizeof(type_str));
- type= type_str;
+ type = type_str;
get_str(bc, str_value, sizeof(str_value));
- }else if(value == -3){
- type= "s";
- value= get_s(bc);
- }else if(value == -4){
- type= "t";
- value= ffio_read_varlen(bc);
- }else if(value < -4){
- type= "r";
+ } else if (value == -3) {
+ type = "s";
+ value = get_s(bc);
+ } else if (value == -4) {
+ type = "t";
+ value = ffio_read_varlen(bc);
+ } else if (value < -4) {
+ type = "r";
get_s(bc);
- }else{
- type= "v";
+ } else {
+ type = "v";
}
if (stream_id_plus1 > s->nb_streams) {
@@ -453,203 +503,203 @@ static int decode_info_header(NUTContext *nut){
continue;
}
- if(!strcmp(type, "UTF-8")){
- if(chapter_id==0 && !strcmp(name, "Disposition")) {
+ if (!strcmp(type, "UTF-8")) {
+ if (chapter_id == 0 && !strcmp(name, "Disposition")) {
set_disposition_bits(s, str_value, stream_id_plus1 - 1);
continue;
}
- if(metadata && av_strcasecmp(name,"Uses")
- && av_strcasecmp(name,"Depends") && av_strcasecmp(name,"Replaces"))
+ if (metadata && av_strcasecmp(name, "Uses") &&
+ av_strcasecmp(name, "Depends") && av_strcasecmp(name, "Replaces"))
av_dict_set(metadata, name, str_value, 0);
}
}
- if(skip_reserved(bc, end) || ffio_get_checksum(bc)){
+ if (skip_reserved(bc, end) || ffio_get_checksum(bc)) {
av_log(s, AV_LOG_ERROR, "info header checksum mismatch\n");
return -1;
}
return 0;
}
-static int decode_syncpoint(NUTContext *nut, int64_t *ts, int64_t *back_ptr){
- AVFormatContext *s= nut->avf;
- AVIOContext *bc = s->pb;
+static int decode_syncpoint(NUTContext *nut, int64_t *ts, int64_t *back_ptr)
+{
+ AVFormatContext *s = nut->avf;
+ AVIOContext *bc = s->pb;
int64_t end, tmp;
- nut->last_syncpoint_pos= avio_tell(bc)-8;
+ nut->last_syncpoint_pos = avio_tell(bc) - 8;
- end= get_packetheader(nut, bc, 1, SYNCPOINT_STARTCODE);
+ end = get_packetheader(nut, bc, 1, SYNCPOINT_STARTCODE);
end += avio_tell(bc);
- tmp= ffio_read_varlen(bc);
- *back_ptr= nut->last_syncpoint_pos - 16*ffio_read_varlen(bc);
- if(*back_ptr < 0)
+ tmp = ffio_read_varlen(bc);
+ *back_ptr = nut->last_syncpoint_pos - 16 * ffio_read_varlen(bc);
+ if (*back_ptr < 0)
return -1;
- ff_nut_reset_ts(nut, nut->time_base[tmp % nut->time_base_count], tmp / nut->time_base_count);
+ ff_nut_reset_ts(nut, nut->time_base[tmp % nut->time_base_count],
+ tmp / nut->time_base_count);
- if(skip_reserved(bc, end) || ffio_get_checksum(bc)){
+ if (skip_reserved(bc, end) || ffio_get_checksum(bc)) {
av_log(s, AV_LOG_ERROR, "sync point checksum mismatch\n");
return -1;
}
- *ts= tmp / s->nb_streams * av_q2d(nut->time_base[tmp % s->nb_streams])*AV_TIME_BASE;
+ *ts = tmp / s->nb_streams *
+ av_q2d(nut->time_base[tmp % s->nb_streams]) * AV_TIME_BASE;
ff_nut_add_sp(nut, nut->last_syncpoint_pos, *back_ptr, *ts);
return 0;
}
-static int find_and_decode_index(NUTContext *nut){
- AVFormatContext *s= nut->avf;
- AVIOContext *bc = s->pb;
+static int find_and_decode_index(NUTContext *nut)
+{
+ AVFormatContext *s = nut->avf;
+ AVIOContext *bc = s->pb;
uint64_t tmp, end;
int i, j, syncpoint_count;
- int64_t filesize= avio_size(bc);
+ int64_t filesize = avio_size(bc);
int64_t *syncpoints;
int8_t *has_keyframe;
- int ret= -1;
+ int ret = -1;
- avio_seek(bc, filesize-12, SEEK_SET);
- avio_seek(bc, filesize-avio_rb64(bc), SEEK_SET);
- if(avio_rb64(bc) != INDEX_STARTCODE){
+ avio_seek(bc, filesize - 12, SEEK_SET);
+ avio_seek(bc, filesize - avio_rb64(bc), SEEK_SET);
+ if (avio_rb64(bc) != INDEX_STARTCODE) {
av_log(s, AV_LOG_ERROR, "no index at the end\n");
return -1;
}
- end= get_packetheader(nut, bc, 1, INDEX_STARTCODE);
+ end = get_packetheader(nut, bc, 1, INDEX_STARTCODE);
end += avio_tell(bc);
- ffio_read_varlen(bc); //max_pts
- GET_V(syncpoint_count, tmp < INT_MAX/8 && tmp > 0)
- syncpoints= av_malloc(sizeof(int64_t)*syncpoint_count);
- has_keyframe= av_malloc(sizeof(int8_t)*(syncpoint_count+1));
- for(i=0; i<syncpoint_count; i++){
+ ffio_read_varlen(bc); // max_pts
+ GET_V(syncpoint_count, tmp < INT_MAX / 8 && tmp > 0);
+ syncpoints = av_malloc(sizeof(int64_t) * syncpoint_count);
+ has_keyframe = av_malloc(sizeof(int8_t) * (syncpoint_count + 1));
+ for (i = 0; i < syncpoint_count; i++) {
syncpoints[i] = ffio_read_varlen(bc);
- if(syncpoints[i] <= 0)
+ if (syncpoints[i] <= 0)
goto fail;
- if(i)
- syncpoints[i] += syncpoints[i-1];
- }
-
- for(i=0; i<s->nb_streams; i++){
- int64_t last_pts= -1;
- for(j=0; j<syncpoint_count;){
- uint64_t x= ffio_read_varlen(bc);
- int type= x&1;
- int n= j;
- x>>=1;
- if(type){
- int flag= x&1;
- x>>=1;
- if(n+x >= syncpoint_count + 1){
+ if (i)
+ syncpoints[i] += syncpoints[i - 1];
+ }
+
+ for (i = 0; i < s->nb_streams; i++) {
+ int64_t last_pts = -1;
+ for (j = 0; j < syncpoint_count;) {
+ uint64_t x = ffio_read_varlen(bc);
+ int type = x & 1;
+ int n = j;
+ x >>= 1;
+ if (type) {
+ int flag = x & 1;
+ x >>= 1;
+ if (n + x >= syncpoint_count + 1) {
av_log(s, AV_LOG_ERROR, "index overflow A\n");
goto fail;
}
- while(x--)
- has_keyframe[n++]= flag;
- has_keyframe[n++]= !flag;
- }else{
- while(x != 1){
- if(n>=syncpoint_count + 1){
+ while (x--)
+ has_keyframe[n++] = flag;
+ has_keyframe[n++] = !flag;
+ } else {
+ while (x != 1) {
+ if (n >= syncpoint_count + 1) {
av_log(s, AV_LOG_ERROR, "index overflow B\n");
goto fail;
}
- has_keyframe[n++]= x&1;
- x>>=1;
+ has_keyframe[n++] = x & 1;
+ x >>= 1;
}
}
- if(has_keyframe[0]){
+ if (has_keyframe[0]) {
av_log(s, AV_LOG_ERROR, "keyframe before first syncpoint in index\n");
goto fail;
}
- assert(n<=syncpoint_count+1);
- for(; j<n && j<syncpoint_count; j++){
- if(has_keyframe[j]){
- uint64_t B, A= ffio_read_varlen(bc);
- if(!A){
- A= ffio_read_varlen(bc);
- B= ffio_read_varlen(bc);
- //eor_pts[j][i] = last_pts + A + B
- }else
- B= 0;
- av_add_index_entry(
- s->streams[i],
- 16*syncpoints[j-1],
- last_pts + A,
- 0,
- 0,
- AVINDEX_KEYFRAME);
+ assert(n <= syncpoint_count + 1);
+ for (; j < n && j < syncpoint_count; j++) {
+ if (has_keyframe[j]) {
+ uint64_t B, A = ffio_read_varlen(bc);
+ if (!A) {
+ A = ffio_read_varlen(bc);
+ B = ffio_read_varlen(bc);
+ // eor_pts[j][i] = last_pts + A + B
+ } else
+ B = 0;
+ av_add_index_entry(s->streams[i], 16 * syncpoints[j - 1],
+ last_pts + A, 0, 0, AVINDEX_KEYFRAME);
last_pts += A + B;
}
}
}
}
- if(skip_reserved(bc, end) || ffio_get_checksum(bc)){
+ if (skip_reserved(bc, end) || ffio_get_checksum(bc)) {
av_log(s, AV_LOG_ERROR, "index checksum mismatch\n");
goto fail;
}
- ret= 0;
+ ret = 0;
+
fail:
av_free(syncpoints);
av_free(has_keyframe);
return ret;
}
-static int nut_read_header(AVFormatContext *s, AVFormatParameters *ap)
+static int nut_read_header(AVFormatContext *s)
{
NUTContext *nut = s->priv_data;
AVIOContext *bc = s->pb;
int64_t pos;
int initialized_stream_count;
- nut->avf= s;
+ nut->avf = s;
/* main header */
- pos=0;
- do{
- pos= find_startcode(bc, MAIN_STARTCODE, pos)+1;
- if (pos<0+1){
+ pos = 0;
+ do {
+ pos = find_startcode(bc, MAIN_STARTCODE, pos) + 1;
+ if (pos < 0 + 1) {
av_log(s, AV_LOG_ERROR, "No main startcode found.\n");
return AVERROR_INVALIDDATA;
}
- }while(decode_main_header(nut) < 0);
+ } while (decode_main_header(nut) < 0);
/* stream headers */
- pos=0;
- for(initialized_stream_count=0; initialized_stream_count < s->nb_streams;){
- pos= find_startcode(bc, STREAM_STARTCODE, pos)+1;
- if (pos<0+1){
+ pos = 0;
+ for (initialized_stream_count = 0; initialized_stream_count < s->nb_streams;) {
+ pos = find_startcode(bc, STREAM_STARTCODE, pos) + 1;
+ if (pos < 0 + 1) {
av_log(s, AV_LOG_ERROR, "Not all stream headers found.\n");
return AVERROR_INVALIDDATA;
}
- if(decode_stream_header(nut) >= 0)
+ if (decode_stream_header(nut) >= 0)
initialized_stream_count++;
}
/* info headers */
- pos=0;
- for(;;){
- uint64_t startcode= find_any_startcode(bc, pos);
- pos= avio_tell(bc);
+ pos = 0;
+ for (;;) {
+ uint64_t startcode = find_any_startcode(bc, pos);
+ pos = avio_tell(bc);
- if(startcode==0){
+ if (startcode == 0) {
av_log(s, AV_LOG_ERROR, "EOF before video frames\n");
return AVERROR_INVALIDDATA;
- }else if(startcode == SYNCPOINT_STARTCODE){
- nut->next_startcode= startcode;
+ } else if (startcode == SYNCPOINT_STARTCODE) {
+ nut->next_startcode = startcode;
break;
- }else if(startcode != INFO_STARTCODE){
+ } else if (startcode != INFO_STARTCODE) {
continue;
}
decode_info_header(nut);
}
- s->data_offset= pos-8;
+ s->data_offset = pos - 8;
- if(bc->seekable){
- int64_t orig_pos= avio_tell(bc);
+ if (bc->seekable) {
+ int64_t orig_pos = avio_tell(bc);
find_and_decode_index(nut);
avio_seek(bc, orig_pos, SEEK_SET);
}
@@ -660,15 +710,19 @@ static int nut_read_header(AVFormatContext *s, AVFormatParameters *ap)
return 0;
}
-static int decode_frame_header(NUTContext *nut, int64_t *pts, int *stream_id, uint8_t *header_idx, int frame_code){
- AVFormatContext *s= nut->avf;
- AVIOContext *bc = s->pb;
+static int decode_frame_header(NUTContext *nut, int64_t *pts, int *stream_id,
+ uint8_t *header_idx, int frame_code)
+{
+ AVFormatContext *s = nut->avf;
+ AVIOContext *bc = s->pb;
StreamContext *stc;
int size, flags, size_mul, pts_delta, i, reserved_count;
uint64_t tmp;
- if(avio_tell(bc) > nut->last_syncpoint_pos + nut->max_distance){
- av_log(s, AV_LOG_ERROR, "Last frame must have been damaged %"PRId64" > %"PRId64" + %d\n", avio_tell(bc), nut->last_syncpoint_pos, nut->max_distance);
+ if (avio_tell(bc) > nut->last_syncpoint_pos + nut->max_distance) {
+ av_log(s, AV_LOG_ERROR,
+ "Last frame must have been damaged %"PRId64" > %"PRId64" + %d\n",
+ avio_tell(bc), nut->last_syncpoint_pos, nut->max_distance);
return AVERROR_INVALIDDATA;
}
@@ -680,86 +734,88 @@ static int decode_frame_header(NUTContext *nut, int64_t *pts, int *stream_id, ui
reserved_count = nut->frame_code[frame_code].reserved_count;
*header_idx = nut->frame_code[frame_code].header_idx;
- if(flags & FLAG_INVALID)
+ if (flags & FLAG_INVALID)
return AVERROR_INVALIDDATA;
- if(flags & FLAG_CODED)
+ if (flags & FLAG_CODED)
flags ^= ffio_read_varlen(bc);
- if(flags & FLAG_STREAM_ID){
- GET_V(*stream_id, tmp < s->nb_streams)
- }
- stc= &nut->stream[*stream_id];
- if(flags&FLAG_CODED_PTS){
- int coded_pts= ffio_read_varlen(bc);
-//FIXME check last_pts validity?
- if(coded_pts < (1<<stc->msb_pts_shift)){
- *pts=ff_lsb2full(stc, coded_pts);
- }else
- *pts=coded_pts - (1<<stc->msb_pts_shift);
- }else
- *pts= stc->last_pts + pts_delta;
- if(flags&FLAG_SIZE_MSB){
- size += size_mul*ffio_read_varlen(bc);
- }
- if(flags&FLAG_MATCH_TIME)
+ if (flags & FLAG_STREAM_ID) {
+ GET_V(*stream_id, tmp < s->nb_streams);
+ }
+ stc = &nut->stream[*stream_id];
+ if (flags & FLAG_CODED_PTS) {
+ int coded_pts = ffio_read_varlen(bc);
+ // FIXME check last_pts validity?
+ if (coded_pts < (1 << stc->msb_pts_shift)) {
+ *pts = ff_lsb2full(stc, coded_pts);
+ } else
+ *pts = coded_pts - (1 << stc->msb_pts_shift);
+ } else
+ *pts = stc->last_pts + pts_delta;
+ if (flags & FLAG_SIZE_MSB)
+ size += size_mul * ffio_read_varlen(bc);
+ if (flags & FLAG_MATCH_TIME)
get_s(bc);
- if(flags&FLAG_HEADER_IDX)
- *header_idx= ffio_read_varlen(bc);
- if(flags&FLAG_RESERVED)
- reserved_count= ffio_read_varlen(bc);
- for(i=0; i<reserved_count; i++)
+ if (flags & FLAG_HEADER_IDX)
+ *header_idx = ffio_read_varlen(bc);
+ if (flags & FLAG_RESERVED)
+ reserved_count = ffio_read_varlen(bc);
+ for (i = 0; i < reserved_count; i++)
ffio_read_varlen(bc);
- if(*header_idx >= (unsigned)nut->header_count){
+ if (*header_idx >= (unsigned)nut->header_count) {
av_log(s, AV_LOG_ERROR, "header_idx invalid\n");
return AVERROR_INVALIDDATA;
}
- if(size > 4096)
- *header_idx=0;
+ if (size > 4096)
+ *header_idx = 0;
size -= nut->header_len[*header_idx];
- if(flags&FLAG_CHECKSUM){
- avio_rb32(bc); //FIXME check this
- }else if(size > 2*nut->max_distance || FFABS(stc->last_pts - *pts) > stc->max_pts_distance){
+ if (flags & FLAG_CHECKSUM) {
+ avio_rb32(bc); // FIXME check this
+ } else if (size > 2 * nut->max_distance || FFABS(stc->last_pts - *pts) >
+ stc->max_pts_distance) {
av_log(s, AV_LOG_ERROR, "frame size > 2max_distance and no checksum\n");
return AVERROR_INVALIDDATA;
}
- stc->last_pts= *pts;
- stc->last_flags= flags;
+ stc->last_pts = *pts;
+ stc->last_flags = flags;
return size;
}
-static int decode_frame(NUTContext *nut, AVPacket *pkt, int frame_code){
- AVFormatContext *s= nut->avf;
- AVIOContext *bc = s->pb;
+static int decode_frame(NUTContext *nut, AVPacket *pkt, int frame_code)
+{
+ AVFormatContext *s = nut->avf;
+ AVIOContext *bc = s->pb;
int size, stream_id, discard;
int64_t pts, last_IP_pts;
StreamContext *stc;
uint8_t header_idx;
- size= decode_frame_header(nut, &pts, &stream_id, &header_idx, frame_code);
- if(size < 0)
+ size = decode_frame_header(nut, &pts, &stream_id, &header_idx, frame_code);
+ if (size < 0)
return size;
- stc= &nut->stream[stream_id];
+ stc = &nut->stream[stream_id];
if (stc->last_flags & FLAG_KEY)
- stc->skip_until_key_frame=0;
-
- discard= s->streams[ stream_id ]->discard;
- last_IP_pts= s->streams[ stream_id ]->last_IP_pts;
- if( (discard >= AVDISCARD_NONKEY && !(stc->last_flags & FLAG_KEY))
- ||(discard >= AVDISCARD_BIDIR && last_IP_pts != AV_NOPTS_VALUE && last_IP_pts > pts)
- || discard >= AVDISCARD_ALL
- || stc->skip_until_key_frame){
+ stc->skip_until_key_frame = 0;
+
+ discard = s->streams[stream_id]->discard;
+ last_IP_pts = s->streams[stream_id]->last_IP_pts;
+ if ((discard >= AVDISCARD_NONKEY && !(stc->last_flags & FLAG_KEY)) ||
+ (discard >= AVDISCARD_BIDIR && last_IP_pts != AV_NOPTS_VALUE &&
+ last_IP_pts > pts) ||
+ discard >= AVDISCARD_ALL ||
+ stc->skip_until_key_frame) {
avio_skip(bc, size);
return 1;
}
av_new_packet(pkt, size + nut->header_len[header_idx]);
memcpy(pkt->data, nut->header[header_idx], nut->header_len[header_idx]);
- pkt->pos= avio_tell(bc); //FIXME
+ pkt->pos = avio_tell(bc); // FIXME
avio_read(bc, pkt->data + nut->header_len[header_idx], size);
pkt->stream_index = stream_id;
@@ -774,135 +830,146 @@ static int nut_read_packet(AVFormatContext *s, AVPacket *pkt)
{
NUTContext *nut = s->priv_data;
AVIOContext *bc = s->pb;
- int i, frame_code=0, ret, skip;
+ int i, frame_code = 0, ret, skip;
int64_t ts, back_ptr;
- for(;;){
- int64_t pos= avio_tell(bc);
- uint64_t tmp= nut->next_startcode;
- nut->next_startcode=0;
+ for (;;) {
+ int64_t pos = avio_tell(bc);
+ uint64_t tmp = nut->next_startcode;
+ nut->next_startcode = 0;
- if(tmp){
- pos-=8;
- }else{
+ if (tmp) {
+ pos -= 8;
+ } else {
frame_code = avio_r8(bc);
- if(bc->eof_reached)
+ if (bc->eof_reached)
return -1;
- if(frame_code == 'N'){
- tmp= frame_code;
- for(i=1; i<8; i++)
- tmp = (tmp<<8) + avio_r8(bc);
+ if (frame_code == 'N') {
+ tmp = frame_code;
+ for (i = 1; i < 8; i++)
+ tmp = (tmp << 8) + avio_r8(bc);
}
}
- switch(tmp){
+ switch (tmp) {
case MAIN_STARTCODE:
case STREAM_STARTCODE:
case INDEX_STARTCODE:
- skip= get_packetheader(nut, bc, 0, tmp);
+ skip = get_packetheader(nut, bc, 0, tmp);
avio_skip(bc, skip);
break;
case INFO_STARTCODE:
- if(decode_info_header(nut)<0)
+ if (decode_info_header(nut) < 0)
goto resync;
break;
case SYNCPOINT_STARTCODE:
- if(decode_syncpoint(nut, &ts, &back_ptr)<0)
+ if (decode_syncpoint(nut, &ts, &back_ptr) < 0)
goto resync;
frame_code = avio_r8(bc);
case 0:
- ret= decode_frame(nut, pkt, frame_code);
- if(ret==0)
+ ret = decode_frame(nut, pkt, frame_code);
+ if (ret == 0)
return 0;
- else if(ret==1) //ok but discard packet
+ else if (ret == 1) // OK but discard packet
break;
default:
resync:
-av_log(s, AV_LOG_DEBUG, "syncing from %"PRId64"\n", pos);
- tmp= find_any_startcode(bc, nut->last_syncpoint_pos+1);
- if(tmp==0)
+ av_log(s, AV_LOG_DEBUG, "syncing from %"PRId64"\n", pos);
+ tmp = find_any_startcode(bc, nut->last_syncpoint_pos + 1);
+ if (tmp == 0)
return AVERROR_INVALIDDATA;
-av_log(s, AV_LOG_DEBUG, "sync\n");
- nut->next_startcode= tmp;
+ av_log(s, AV_LOG_DEBUG, "sync\n");
+ nut->next_startcode = tmp;
}
}
}
-static int64_t nut_read_timestamp(AVFormatContext *s, int stream_index, int64_t *pos_arg, int64_t pos_limit){
+static int64_t nut_read_timestamp(AVFormatContext *s, int stream_index,
+ int64_t *pos_arg, int64_t pos_limit)
+{
NUTContext *nut = s->priv_data;
AVIOContext *bc = s->pb;
int64_t pos, pts, back_ptr;
-av_log(s, AV_LOG_DEBUG, "read_timestamp(X,%d,%"PRId64",%"PRId64")\n", stream_index, *pos_arg, pos_limit);
+ av_log(s, AV_LOG_DEBUG, "read_timestamp(X,%d,%"PRId64",%"PRId64")\n",
+ stream_index, *pos_arg, pos_limit);
- pos= *pos_arg;
- do{
- pos= find_startcode(bc, SYNCPOINT_STARTCODE, pos)+1;
- if(pos < 1){
+ pos = *pos_arg;
+ do {
+ pos = find_startcode(bc, SYNCPOINT_STARTCODE, pos) + 1;
+ if (pos < 1) {
assert(nut->next_startcode == 0);
av_log(s, AV_LOG_ERROR, "read_timestamp failed.\n");
return AV_NOPTS_VALUE;
}
- }while(decode_syncpoint(nut, &pts, &back_ptr) < 0);
- *pos_arg = pos-1;
+ } while (decode_syncpoint(nut, &pts, &back_ptr) < 0);
+ *pos_arg = pos - 1;
assert(nut->last_syncpoint_pos == *pos_arg);
- av_log(s, AV_LOG_DEBUG, "return %"PRId64" %"PRId64"\n", pts,back_ptr );
- if (stream_index == -1) return pts;
- else if(stream_index == -2) return back_ptr;
+ av_log(s, AV_LOG_DEBUG, "return %"PRId64" %"PRId64"\n", pts, back_ptr);
+ if (stream_index == -1)
+ return pts;
+ else if (stream_index == -2)
+ return back_ptr;
-assert(0);
+ assert(0);
}
-static int read_seek(AVFormatContext *s, int stream_index, int64_t pts, int flags){
- NUTContext *nut = s->priv_data;
- AVStream *st= s->streams[stream_index];
- Syncpoint dummy={.ts= pts*av_q2d(st->time_base)*AV_TIME_BASE};
- Syncpoint nopts_sp= {.ts= AV_NOPTS_VALUE, .back_ptr= AV_NOPTS_VALUE};
- Syncpoint *sp, *next_node[2]= {&nopts_sp, &nopts_sp};
+static int read_seek(AVFormatContext *s, int stream_index,
+ int64_t pts, int flags)
+{
+ NUTContext *nut = s->priv_data;
+ AVStream *st = s->streams[stream_index];
+ Syncpoint dummy = { .ts = pts * av_q2d(st->time_base) * AV_TIME_BASE };
+ Syncpoint nopts_sp = { .ts = AV_NOPTS_VALUE, .back_ptr = AV_NOPTS_VALUE };
+ Syncpoint *sp, *next_node[2] = { &nopts_sp, &nopts_sp };
int64_t pos, pos2, ts;
int i;
- if(st->index_entries){
- int index= av_index_search_timestamp(st, pts, flags);
- if(index<0)
+ if (st->index_entries) {
+ int index = av_index_search_timestamp(st, pts, flags);
+ if (index < 0)
return -1;
- pos2= st->index_entries[index].pos;
- ts = st->index_entries[index].timestamp;
- }else{
+ pos2 = st->index_entries[index].pos;
+ ts = st->index_entries[index].timestamp;
+ } else {
av_tree_find(nut->syncpoints, &dummy, (void *) ff_nut_sp_pts_cmp,
(void **) next_node);
- av_log(s, AV_LOG_DEBUG, "%"PRIu64"-%"PRIu64" %"PRId64"-%"PRId64"\n", next_node[0]->pos, next_node[1]->pos,
- next_node[0]->ts , next_node[1]->ts);
- pos = ff_gen_search(s, -1, dummy.ts, next_node[0]->pos, next_node[1]->pos, next_node[1]->pos,
- next_node[0]->ts , next_node[1]->ts, AVSEEK_FLAG_BACKWARD, &ts, nut_read_timestamp);
-
- if(!(flags & AVSEEK_FLAG_BACKWARD)){
- dummy.pos= pos+16;
- next_node[1]= &nopts_sp;
+ av_log(s, AV_LOG_DEBUG, "%"PRIu64"-%"PRIu64" %"PRId64"-%"PRId64"\n",
+ next_node[0]->pos, next_node[1]->pos, next_node[0]->ts,
+ next_node[1]->ts);
+ pos = ff_gen_search(s, -1, dummy.ts, next_node[0]->pos,
+ next_node[1]->pos, next_node[1]->pos,
+ next_node[0]->ts, next_node[1]->ts,
+ AVSEEK_FLAG_BACKWARD, &ts, nut_read_timestamp);
+
+ if (!(flags & AVSEEK_FLAG_BACKWARD)) {
+ dummy.pos = pos + 16;
+ next_node[1] = &nopts_sp;
av_tree_find(nut->syncpoints, &dummy, (void *) ff_nut_sp_pos_cmp,
(void **) next_node);
- pos2 = ff_gen_search(s, -2, dummy.pos, next_node[0]->pos , next_node[1]->pos, next_node[1]->pos,
- next_node[0]->back_ptr, next_node[1]->back_ptr, flags, &ts, nut_read_timestamp);
- if(pos2>=0)
- pos= pos2;
- //FIXME dir but I think it does not matter
+ pos2 = ff_gen_search(s, -2, dummy.pos, next_node[0]->pos,
+ next_node[1]->pos, next_node[1]->pos,
+ next_node[0]->back_ptr, next_node[1]->back_ptr,
+ flags, &ts, nut_read_timestamp);
+ if (pos2 >= 0)
+ pos = pos2;
+ // FIXME dir but I think it does not matter
}
- dummy.pos= pos;
- sp= av_tree_find(nut->syncpoints, &dummy, (void *) ff_nut_sp_pos_cmp,
- NULL);
+ dummy.pos = pos;
+ sp = av_tree_find(nut->syncpoints, &dummy, (void *) ff_nut_sp_pos_cmp,
+ NULL);
assert(sp);
- pos2= sp->back_ptr - 15;
+ pos2 = sp->back_ptr - 15;
}
av_log(NULL, AV_LOG_DEBUG, "SEEKTO: %"PRId64"\n", pos2);
- pos= find_startcode(s->pb, SYNCPOINT_STARTCODE, pos2);
+ pos = find_startcode(s->pb, SYNCPOINT_STARTCODE, pos2);
avio_seek(s->pb, pos, SEEK_SET);
av_log(NULL, AV_LOG_DEBUG, "SP: %"PRId64"\n", pos);
- if(pos2 > pos || pos2 + 15 < pos){
+ if (pos2 > pos || pos2 + 15 < pos)
av_log(NULL, AV_LOG_ERROR, "no syncpoint at backptr pos\n");
- }
- for(i=0; i<s->nb_streams; i++)
- nut->stream[i].skip_until_key_frame=1;
+ for (i = 0; i < s->nb_streams; i++)
+ nut->stream[i].skip_until_key_frame = 1;
return 0;
}
@@ -915,23 +982,21 @@ static int nut_read_close(AVFormatContext *s)
av_freep(&nut->time_base);
av_freep(&nut->stream);
ff_nut_free_sp(nut);
- for(i = 1; i < nut->header_count; i++)
+ for (i = 1; i < nut->header_count; i++)
av_freep(&nut->header[i]);
return 0;
}
-#if CONFIG_NUT_DEMUXER
AVInputFormat ff_nut_demuxer = {
.name = "nut",
- .long_name = NULL_IF_CONFIG_SMALL("NUT format"),
+ .long_name = NULL_IF_CONFIG_SMALL("NUT"),
.priv_data_size = sizeof(NUTContext),
.read_probe = nut_probe,
.read_header = nut_read_header,
.read_packet = nut_read_packet,
.read_close = nut_read_close,
.read_seek = read_seek,
- .extensions = "nut",
- .codec_tag = (const AVCodecTag * const []) { ff_codec_bmp_tags, ff_nut_video_tags, ff_codec_wav_tags, ff_nut_subtitle_tags, 0 },
+ .extensions = "nut",
+ .codec_tag = ff_nut_codec_tags,
};
-#endif
diff --git a/gst-libs/ext/libav/libavformat/nutenc.c b/gst-libs/ext/libav/libavformat/nutenc.c
index ae1c2f1..df70f94 100644
--- a/gst-libs/ext/libav/libavformat/nutenc.c
+++ b/gst-libs/ext/libav/libavformat/nutenc.c
@@ -27,60 +27,70 @@
#include "nut.h"
#include "internal.h"
#include "avio_internal.h"
+#include "riff.h"
-static int find_expected_header(AVCodecContext *c, int size, int key_frame, uint8_t out[64]){
- int sample_rate= c->sample_rate;
+static int find_expected_header(AVCodecContext *c, int size, int key_frame,
+ uint8_t out[64])
+{
+ int sample_rate = c->sample_rate;
- if(size>4096)
+ if (size > 4096)
return 0;
AV_WB24(out, 1);
- if(c->codec_id == CODEC_ID_MPEG4){
- if(key_frame){
+ if (c->codec_id == AV_CODEC_ID_MPEG4) {
+ if (key_frame) {
return 3;
- }else{
- out[3]= 0xB6;
+ } else {
+ out[3] = 0xB6;
return 4;
}
- }else if(c->codec_id == CODEC_ID_MPEG1VIDEO || c->codec_id == CODEC_ID_MPEG2VIDEO){
+ } else if (c->codec_id == AV_CODEC_ID_MPEG1VIDEO ||
+ c->codec_id == AV_CODEC_ID_MPEG2VIDEO) {
return 3;
- }else if(c->codec_id == CODEC_ID_H264){
+ } else if (c->codec_id == AV_CODEC_ID_H264) {
return 3;
- }else if(c->codec_id == CODEC_ID_MP3 || c->codec_id == CODEC_ID_MP2){
+ } else if (c->codec_id == AV_CODEC_ID_MP3 ||
+ c->codec_id == AV_CODEC_ID_MP2) {
int lsf, mpeg25, sample_rate_index, bitrate_index, frame_size;
- int layer= c->codec_id == CODEC_ID_MP3 ? 3 : 2;
- unsigned int header= 0xFFF00000;
+ int layer = c->codec_id == AV_CODEC_ID_MP3 ? 3 : 2;
+ unsigned int header = 0xFFF00000;
- lsf = sample_rate < (24000+32000)/2;
- mpeg25 = sample_rate < (12000+16000)/2;
+ lsf = sample_rate < (24000 + 32000) / 2;
+ mpeg25 = sample_rate < (12000 + 16000) / 2;
sample_rate <<= lsf + mpeg25;
- if (sample_rate < (32000 + 44100)/2) sample_rate_index=2;
- else if(sample_rate < (44100 + 48000)/2) sample_rate_index=0;
- else sample_rate_index=1;
+ if (sample_rate < (32000 + 44100) / 2)
+ sample_rate_index = 2;
+ else if (sample_rate < (44100 + 48000) / 2)
+ sample_rate_index = 0;
+ else
+ sample_rate_index = 1;
- sample_rate= avpriv_mpa_freq_tab[sample_rate_index] >> (lsf + mpeg25);
+ sample_rate = avpriv_mpa_freq_tab[sample_rate_index] >> (lsf + mpeg25);
- for(bitrate_index=2; bitrate_index<30; bitrate_index++){
- frame_size = avpriv_mpa_bitrate_tab[lsf][layer-1][bitrate_index>>1];
- frame_size = (frame_size * 144000) / (sample_rate << lsf) + (bitrate_index&1);
+ for (bitrate_index = 2; bitrate_index < 30; bitrate_index++) {
+ frame_size =
+ avpriv_mpa_bitrate_tab[lsf][layer - 1][bitrate_index >> 1];
+ frame_size = (frame_size * 144000) / (sample_rate << lsf) +
+ (bitrate_index & 1);
- if(frame_size == size)
+ if (frame_size == size)
break;
}
- header |= (!lsf)<<19;
- header |= (4-layer)<<17;
- header |= 1<<16; //no crc
+ header |= (!lsf) << 19;
+ header |= (4 - layer) << 17;
+ header |= 1 << 16; //no crc
AV_WB32(out, header);
- if(size <= 0)
- return 2; //we guess there is no crc, if there is one the user clearly does not care about overhead
- if(bitrate_index == 30)
- return -1; //something is wrong ...
+ if (size <= 0)
+ return 2; //we guess there is no crc, if there is one the user clearly does not care about overhead
+ if (bitrate_index == 30)
+ return -1; //something is wrong ...
- header |= (bitrate_index>>1)<<12;
- header |= sample_rate_index<<10;
- header |= (bitrate_index&1)<<9;
+ header |= (bitrate_index >> 1) << 12;
+ header |= sample_rate_index << 10;
+ header |= (bitrate_index & 1) << 9;
return 2; //FIXME actually put the needed ones in build_elision_headers()
return 3; //we guess that the private bit is not set
@@ -89,187 +99,192 @@ static int find_expected_header(AVCodecContext *c, int size, int key_frame, uint
return 0;
}
-static int find_header_idx(AVFormatContext *s, AVCodecContext *c, int size, int frame_type){
+static int find_header_idx(AVFormatContext *s, AVCodecContext *c, int size,
+ int frame_type)
+{
NUTContext *nut = s->priv_data;
uint8_t out[64];
int i;
- int len= find_expected_header(c, size, frame_type, out);
+ int len = find_expected_header(c, size, frame_type, out);
-//av_log(NULL, AV_LOG_ERROR, "expected_h len=%d size=%d codec_id=%d\n", len, size, c->codec_id);
-
- for(i=1; i<nut->header_count; i++){
- if( len == nut->header_len[i]
- && !memcmp(out, nut->header[i], len)){
-// av_log(NULL, AV_LOG_ERROR, "found %d\n", i);
+ for (i = 1; i < nut->header_count; i++) {
+ if (len == nut->header_len[i] && !memcmp(out, nut->header[i], len)) {
return i;
}
}
-// av_log(NULL, AV_LOG_ERROR, "nothing found\n");
+
return 0;
}
-static void build_elision_headers(AVFormatContext *s){
+static void build_elision_headers(AVFormatContext *s)
+{
NUTContext *nut = s->priv_data;
int i;
//FIXME this is lame
//FIXME write a 2pass mode to find the maximal headers
- static const uint8_t headers[][5]={
- {3, 0x00, 0x00, 0x01},
- {4, 0x00, 0x00, 0x01, 0xB6},
- {2, 0xFF, 0xFA}, //mp3+crc
- {2, 0xFF, 0xFB}, //mp3
- {2, 0xFF, 0xFC}, //mp2+crc
- {2, 0xFF, 0xFD}, //mp2
+ static const uint8_t headers[][5] = {
+ { 3, 0x00, 0x00, 0x01 },
+ { 4, 0x00, 0x00, 0x01, 0xB6},
+ { 2, 0xFF, 0xFA }, //mp3+crc
+ { 2, 0xFF, 0xFB }, //mp3
+ { 2, 0xFF, 0xFC }, //mp2+crc
+ { 2, 0xFF, 0xFD }, //mp2
};
- nut->header_count= 7;
- for(i=1; i<nut->header_count; i++){
- nut->header_len[i]= headers[i-1][0];
- nut->header [i]= &headers[i-1][1];
+ nut->header_count = 7;
+ for (i = 1; i < nut->header_count; i++) {
+ nut->header_len[i] = headers[i - 1][0];
+ nut->header[i] = &headers[i - 1][1];
}
}
-static void build_frame_code(AVFormatContext *s){
+static void build_frame_code(AVFormatContext *s)
+{
NUTContext *nut = s->priv_data;
int key_frame, index, pred, stream_id;
- int start=1;
- int end= 254;
- int keyframe_0_esc= s->nb_streams > 2;
+ int start = 1;
+ int end = 254;
+ int keyframe_0_esc = s->nb_streams > 2;
int pred_table[10];
FrameCode *ft;
- ft= &nut->frame_code[start];
- ft->flags= FLAG_CODED;
- ft->size_mul=1;
- ft->pts_delta=1;
+ ft = &nut->frame_code[start];
+ ft->flags = FLAG_CODED;
+ ft->size_mul = 1;
+ ft->pts_delta = 1;
start++;
- if(keyframe_0_esc){
+ if (keyframe_0_esc) {
/* keyframe = 0 escape */
- FrameCode *ft= &nut->frame_code[start];
- ft->flags= FLAG_STREAM_ID | FLAG_SIZE_MSB | FLAG_CODED_PTS;
- ft->size_mul=1;
+ FrameCode *ft = &nut->frame_code[start];
+ ft->flags = FLAG_STREAM_ID | FLAG_SIZE_MSB | FLAG_CODED_PTS;
+ ft->size_mul = 1;
start++;
}
- for(stream_id= 0; stream_id<s->nb_streams; stream_id++){
- int start2= start + (end-start)*stream_id / s->nb_streams;
- int end2 = start + (end-start)*(stream_id+1) / s->nb_streams;
+ for (stream_id = 0; stream_id < s->nb_streams; stream_id++) {
+ int start2 = start + (end - start) * stream_id / s->nb_streams;
+ int end2 = start + (end - start) * (stream_id + 1) / s->nb_streams;
AVCodecContext *codec = s->streams[stream_id]->codec;
- int is_audio= codec->codec_type == AVMEDIA_TYPE_AUDIO;
- int intra_only= /*codec->intra_only || */is_audio;
+ int is_audio = codec->codec_type == AVMEDIA_TYPE_AUDIO;
+ int intra_only = /*codec->intra_only || */ is_audio;
int pred_count;
- for(key_frame=0; key_frame<2; key_frame++){
- if(intra_only && keyframe_0_esc && key_frame==0)
- continue;
-
- {
- FrameCode *ft= &nut->frame_code[start2];
- ft->flags= FLAG_KEY*key_frame;
- ft->flags|= FLAG_SIZE_MSB | FLAG_CODED_PTS;
- ft->stream_id= stream_id;
- ft->size_mul=1;
- if(is_audio)
- ft->header_idx= find_header_idx(s, codec, -1, key_frame);
+ for (key_frame = 0; key_frame < 2; key_frame++) {
+ if (!intra_only || !keyframe_0_esc || key_frame != 0) {
+ FrameCode *ft = &nut->frame_code[start2];
+ ft->flags = FLAG_KEY * key_frame;
+ ft->flags |= FLAG_SIZE_MSB | FLAG_CODED_PTS;
+ ft->stream_id = stream_id;
+ ft->size_mul = 1;
+ if (is_audio)
+ ft->header_idx = find_header_idx(s, codec, -1, key_frame);
start2++;
}
}
- key_frame= intra_only;
- if(is_audio){
- int frame_bytes= codec->frame_size*(int64_t)codec->bit_rate / (8*codec->sample_rate);
+ key_frame = intra_only;
+ if (is_audio) {
+ int frame_bytes = codec->frame_size * (int64_t)codec->bit_rate /
+ (8 * codec->sample_rate);
int pts;
- for(pts=0; pts<2; pts++){
- for(pred=0; pred<2; pred++){
- FrameCode *ft= &nut->frame_code[start2];
- ft->flags= FLAG_KEY*key_frame;
- ft->stream_id= stream_id;
- ft->size_mul=frame_bytes + 2;
- ft->size_lsb=frame_bytes + pred;
- ft->pts_delta=pts;
- ft->header_idx= find_header_idx(s, codec, frame_bytes + pred, key_frame);
+ for (pts = 0; pts < 2; pts++)
+ for (pred = 0; pred < 2; pred++) {
+ FrameCode *ft = &nut->frame_code[start2];
+ ft->flags = FLAG_KEY * key_frame;
+ ft->stream_id = stream_id;
+ ft->size_mul = frame_bytes + 2;
+ ft->size_lsb = frame_bytes + pred;
+ ft->pts_delta = pts;
+ ft->header_idx = find_header_idx(s, codec, frame_bytes + pred, key_frame);
start2++;
}
- }
- }else{
- FrameCode *ft= &nut->frame_code[start2];
- ft->flags= FLAG_KEY | FLAG_SIZE_MSB;
- ft->stream_id= stream_id;
- ft->size_mul=1;
- ft->pts_delta=1;
+ } else {
+ FrameCode *ft = &nut->frame_code[start2];
+ ft->flags = FLAG_KEY | FLAG_SIZE_MSB;
+ ft->stream_id = stream_id;
+ ft->size_mul = 1;
+ ft->pts_delta = 1;
start2++;
}
- if(codec->has_b_frames){
- pred_count=5;
- pred_table[0]=-2;
- pred_table[1]=-1;
- pred_table[2]=1;
- pred_table[3]=3;
- pred_table[4]=4;
- }else if(codec->codec_id == CODEC_ID_VORBIS){
- pred_count=3;
- pred_table[0]=2;
- pred_table[1]=9;
- pred_table[2]=16;
- }else{
- pred_count=1;
- pred_table[0]=1;
+ if (codec->has_b_frames) {
+ pred_count = 5;
+ pred_table[0] = -2;
+ pred_table[1] = -1;
+ pred_table[2] = 1;
+ pred_table[3] = 3;
+ pred_table[4] = 4;
+ } else if (codec->codec_id == AV_CODEC_ID_VORBIS) {
+ pred_count = 3;
+ pred_table[0] = 2;
+ pred_table[1] = 9;
+ pred_table[2] = 16;
+ } else {
+ pred_count = 1;
+ pred_table[0] = 1;
}
- for(pred=0; pred<pred_count; pred++){
- int start3= start2 + (end2-start2)*pred / pred_count;
- int end3 = start2 + (end2-start2)*(pred+1) / pred_count;
+ for (pred = 0; pred < pred_count; pred++) {
+ int start3 = start2 + (end2 - start2) * pred / pred_count;
+ int end3 = start2 + (end2 - start2) * (pred + 1) / pred_count;
- for(index=start3; index<end3; index++){
- FrameCode *ft= &nut->frame_code[index];
- ft->flags= FLAG_KEY*key_frame;
- ft->flags|= FLAG_SIZE_MSB;
- ft->stream_id= stream_id;
+ for (index = start3; index < end3; index++) {
+ FrameCode *ft = &nut->frame_code[index];
+ ft->flags = FLAG_KEY * key_frame;
+ ft->flags |= FLAG_SIZE_MSB;
+ ft->stream_id = stream_id;
//FIXME use single byte size and pred from last
- ft->size_mul= end3-start3;
- ft->size_lsb= index - start3;
- ft->pts_delta= pred_table[pred];
- if(is_audio)
- ft->header_idx= find_header_idx(s, codec, -1, key_frame);
+ ft->size_mul = end3 - start3;
+ ft->size_lsb = index - start3;
+ ft->pts_delta = pred_table[pred];
+ if (is_audio)
+ ft->header_idx = find_header_idx(s, codec, -1, key_frame);
}
}
}
- memmove(&nut->frame_code['N'+1], &nut->frame_code['N'], sizeof(FrameCode)*(255-'N'));
- nut->frame_code[ 0].flags=
- nut->frame_code[255].flags=
- nut->frame_code['N'].flags= FLAG_INVALID;
+ memmove(&nut->frame_code['N' + 1], &nut->frame_code['N'],
+ sizeof(FrameCode) * (255 - 'N'));
+ nut->frame_code[0].flags =
+ nut->frame_code[255].flags =
+ nut->frame_code['N'].flags = FLAG_INVALID;
}
-static void put_tt(NUTContext *nut, AVRational *time_base, AVIOContext *bc, uint64_t val){
+static void put_tt(NUTContext *nut, AVRational *time_base, AVIOContext *bc,
+ uint64_t val)
+{
val *= nut->time_base_count;
val += time_base - nut->time_base;
ff_put_v(bc, val);
}
-
/**
* Store a string as vb.
*/
-static void put_str(AVIOContext *bc, const char *string){
- int len= strlen(string);
+static void put_str(AVIOContext *bc, const char *string)
+{
+ int len = strlen(string);
ff_put_v(bc, len);
avio_write(bc, string, len);
}
-static void put_s(AVIOContext *bc, int64_t val){
- ff_put_v(bc, 2*FFABS(val) - (val>0));
+static void put_s(AVIOContext *bc, int64_t val)
+{
+ ff_put_v(bc, 2 * FFABS(val) - (val > 0));
}
#ifdef TRACE
-static inline void ff_put_v_trace(AVIOContext *bc, uint64_t v, char *file, char *func, int line){
+static inline void ff_put_v_trace(AVIOContext *bc, uint64_t v, const char *file,
+ const char *func, int line)
+{
av_log(NULL, AV_LOG_DEBUG, "ff_put_v %5"PRId64" / %"PRIX64" in %s %s:%d\n", v, v, file, func, line);
ff_put_v(bc, v);
}
-static inline void put_s_trace(AVIOContext *bc, int64_t v, char *file, char *func, int line){
+static inline void put_s_trace(AVIOContext *bc, int64_t v, const char *file,
+ const char *func, int line)
+{
av_log(NULL, AV_LOG_DEBUG, "put_s %5"PRId64" / %"PRIX64" in %s %s:%d\n", v, v, file, func, line);
put_s(bc, v);
@@ -279,29 +294,33 @@ static inline void put_s_trace(AVIOContext *bc, int64_t v, char *file, char *fun
#endif
//FIXME remove calculate_checksum
-static void put_packet(NUTContext *nut, AVIOContext *bc, AVIOContext *dyn_bc, int calculate_checksum, uint64_t startcode){
- uint8_t *dyn_buf=NULL;
- int dyn_size= avio_close_dyn_buf(dyn_bc, &dyn_buf);
- int forw_ptr= dyn_size + 4*calculate_checksum;
+static void put_packet(NUTContext *nut, AVIOContext *bc, AVIOContext *dyn_bc,
+ int calculate_checksum, uint64_t startcode)
+{
+ uint8_t *dyn_buf = NULL;
+ int dyn_size = avio_close_dyn_buf(dyn_bc, &dyn_buf);
+ int forw_ptr = dyn_size + 4 * calculate_checksum;
- if(forw_ptr > 4096)
+ if (forw_ptr > 4096)
ffio_init_checksum(bc, ff_crc04C11DB7_update, 0);
avio_wb64(bc, startcode);
ff_put_v(bc, forw_ptr);
- if(forw_ptr > 4096)
+ if (forw_ptr > 4096)
avio_wl32(bc, ffio_get_checksum(bc));
- if(calculate_checksum)
+ if (calculate_checksum)
ffio_init_checksum(bc, ff_crc04C11DB7_update, 0);
avio_write(bc, dyn_buf, dyn_size);
- if(calculate_checksum)
+ if (calculate_checksum)
avio_wl32(bc, ffio_get_checksum(bc));
av_free(dyn_buf);
}
-static void write_mainheader(NUTContext *nut, AVIOContext *bc){
- int i, j, tmp_pts, tmp_flags, tmp_stream, tmp_mul, tmp_size, tmp_fields, tmp_head_idx;
+static void write_mainheader(NUTContext *nut, AVIOContext *bc)
+{
+ int i, j, tmp_pts, tmp_flags, tmp_stream, tmp_mul, tmp_size, tmp_fields,
+ tmp_head_idx;
int64_t tmp_match;
ff_put_v(bc, 3); /* version */
@@ -309,81 +328,112 @@ static void write_mainheader(NUTContext *nut, AVIOContext *bc){
ff_put_v(bc, nut->max_distance);
ff_put_v(bc, nut->time_base_count);
- for(i=0; i<nut->time_base_count; i++){
+ for (i = 0; i < nut->time_base_count; i++) {
ff_put_v(bc, nut->time_base[i].num);
ff_put_v(bc, nut->time_base[i].den);
}
- tmp_pts=0;
- tmp_mul=1;
- tmp_stream=0;
- tmp_match= 1-(1LL<<62);
- tmp_head_idx= 0;
- for(i=0; i<256;){
- tmp_fields=0;
- tmp_size=0;
+ tmp_pts = 0;
+ tmp_mul = 1;
+ tmp_stream = 0;
+ tmp_match = 1 - (1LL << 62);
+ tmp_head_idx = 0;
+ for (i = 0; i < 256; ) {
+ tmp_fields = 0;
+ tmp_size = 0;
// tmp_res=0;
- if(tmp_pts != nut->frame_code[i].pts_delta) tmp_fields=1;
- if(tmp_mul != nut->frame_code[i].size_mul ) tmp_fields=2;
- if(tmp_stream != nut->frame_code[i].stream_id) tmp_fields=3;
- if(tmp_size != nut->frame_code[i].size_lsb ) tmp_fields=4;
+ if (tmp_pts != nut->frame_code[i].pts_delta)
+ tmp_fields = 1;
+ if (tmp_mul != nut->frame_code[i].size_mul)
+ tmp_fields = 2;
+ if (tmp_stream != nut->frame_code[i].stream_id)
+ tmp_fields = 3;
+ if (tmp_size != nut->frame_code[i].size_lsb)
+ tmp_fields = 4;
// if(tmp_res != nut->frame_code[i].res ) tmp_fields=5;
- if(tmp_head_idx!=nut->frame_code[i].header_idx)tmp_fields=8;
-
- tmp_pts = nut->frame_code[i].pts_delta;
- tmp_flags = nut->frame_code[i].flags;
- tmp_stream= nut->frame_code[i].stream_id;
- tmp_mul = nut->frame_code[i].size_mul;
- tmp_size = nut->frame_code[i].size_lsb;
+ if (tmp_head_idx != nut->frame_code[i].header_idx)
+ tmp_fields = 8;
+
+ tmp_pts = nut->frame_code[i].pts_delta;
+ tmp_flags = nut->frame_code[i].flags;
+ tmp_stream = nut->frame_code[i].stream_id;
+ tmp_mul = nut->frame_code[i].size_mul;
+ tmp_size = nut->frame_code[i].size_lsb;
// tmp_res = nut->frame_code[i].res;
- tmp_head_idx= nut->frame_code[i].header_idx;
+ tmp_head_idx = nut->frame_code[i].header_idx;
- for(j=0; i<256; j++,i++){
- if(i == 'N'){
+ for (j = 0; i < 256; j++, i++) {
+ if (i == 'N') {
j--;
continue;
}
- if(nut->frame_code[i].pts_delta != tmp_pts ) break;
- if(nut->frame_code[i].flags != tmp_flags ) break;
- if(nut->frame_code[i].stream_id != tmp_stream) break;
- if(nut->frame_code[i].size_mul != tmp_mul ) break;
- if(nut->frame_code[i].size_lsb != tmp_size+j) break;
-// if(nut->frame_code[i].res != tmp_res ) break;
- if(nut->frame_code[i].header_idx!= tmp_head_idx) break;
+ if (nut->frame_code[i].pts_delta != tmp_pts ||
+ nut->frame_code[i].flags != tmp_flags ||
+ nut->frame_code[i].stream_id != tmp_stream ||
+ nut->frame_code[i].size_mul != tmp_mul ||
+ nut->frame_code[i].size_lsb != tmp_size + j ||
+// nut->frame_code[i].res != tmp_res ||
+ nut->frame_code[i].header_idx != tmp_head_idx)
+ break;
}
- if(j != tmp_mul - tmp_size) tmp_fields=6;
+ if (j != tmp_mul - tmp_size)
+ tmp_fields = 6;
ff_put_v(bc, tmp_flags);
ff_put_v(bc, tmp_fields);
- if(tmp_fields>0) put_s(bc, tmp_pts);
- if(tmp_fields>1) ff_put_v(bc, tmp_mul);
- if(tmp_fields>2) ff_put_v(bc, tmp_stream);
- if(tmp_fields>3) ff_put_v(bc, tmp_size);
- if(tmp_fields>4) ff_put_v(bc, 0 /*tmp_res*/);
- if(tmp_fields>5) ff_put_v(bc, j);
- if(tmp_fields>6) ff_put_v(bc, tmp_match);
- if(tmp_fields>7) ff_put_v(bc, tmp_head_idx);
+ if (tmp_fields > 0)
+ put_s(bc, tmp_pts);
+ if (tmp_fields > 1)
+ ff_put_v(bc, tmp_mul);
+ if (tmp_fields > 2)
+ ff_put_v(bc, tmp_stream);
+ if (tmp_fields > 3)
+ ff_put_v(bc, tmp_size);
+ if (tmp_fields > 4)
+ ff_put_v(bc, 0 /*tmp_res*/);
+ if (tmp_fields > 5)
+ ff_put_v(bc, j);
+ if (tmp_fields > 6)
+ ff_put_v(bc, tmp_match);
+ if (tmp_fields > 7)
+ ff_put_v(bc, tmp_head_idx);
}
- ff_put_v(bc, nut->header_count-1);
- for(i=1; i<nut->header_count; i++){
+ ff_put_v(bc, nut->header_count - 1);
+ for (i = 1; i < nut->header_count; i++) {
ff_put_v(bc, nut->header_len[i]);
avio_write(bc, nut->header[i], nut->header_len[i]);
}
}
-static int write_streamheader(AVFormatContext *avctx, AVIOContext *bc, AVStream *st, int i){
- NUTContext *nut = avctx->priv_data;
+static int write_streamheader(AVFormatContext *avctx, AVIOContext *bc,
+ AVStream *st, int i)
+{
+ NUTContext *nut = avctx->priv_data;
AVCodecContext *codec = st->codec;
+ unsigned codec_tag = av_codec_get_tag(ff_nut_codec_tags, codec->codec_id);
+
ff_put_v(bc, i);
- switch(codec->codec_type){
- case AVMEDIA_TYPE_VIDEO: ff_put_v(bc, 0); break;
- case AVMEDIA_TYPE_AUDIO: ff_put_v(bc, 1); break;
- case AVMEDIA_TYPE_SUBTITLE: ff_put_v(bc, 2); break;
- default : ff_put_v(bc, 3); break;
+ switch (codec->codec_type) {
+ case AVMEDIA_TYPE_VIDEO:
+ ff_put_v(bc, 0);
+ break;
+ case AVMEDIA_TYPE_AUDIO:
+ ff_put_v(bc, 1);
+ break;
+ case AVMEDIA_TYPE_SUBTITLE:
+ ff_put_v(bc, 2);
+ break;
+ default:
+ ff_put_v(bc, 3);
+ break;
}
ff_put_v(bc, 4);
- if (codec->codec_tag){
- avio_wl32(bc, codec->codec_tag);
+
+ if (!codec_tag || codec->codec_id == AV_CODEC_ID_RAWVIDEO)
+ codec_tag = codec->codec_tag;
+
+ if (codec_tag) {
+ avio_wl32(bc, codec_tag);
} else {
av_log(avctx, AV_LOG_ERROR, "No codec tag defined for stream %d\n", i);
return AVERROR(EINVAL);
@@ -398,7 +448,7 @@ static int write_streamheader(AVFormatContext *avctx, AVIOContext *bc, AVStream
ff_put_v(bc, codec->extradata_size);
avio_write(bc, codec->extradata, codec->extradata_size);
- switch(codec->codec_type){
+ switch (codec->codec_type) {
case AVMEDIA_TYPE_AUDIO:
ff_put_v(bc, codec->sample_rate);
ff_put_v(bc, 1);
@@ -408,10 +458,11 @@ static int write_streamheader(AVFormatContext *avctx, AVIOContext *bc, AVStream
ff_put_v(bc, codec->width);
ff_put_v(bc, codec->height);
- if(st->sample_aspect_ratio.num<=0 || st->sample_aspect_ratio.den<=0){
+ if (st->sample_aspect_ratio.num <= 0 ||
+ st->sample_aspect_ratio.den <= 0) {
ff_put_v(bc, 0);
ff_put_v(bc, 0);
- }else{
+ } else {
ff_put_v(bc, st->sample_aspect_ratio.num);
ff_put_v(bc, st->sample_aspect_ratio.den);
}
@@ -423,21 +474,23 @@ static int write_streamheader(AVFormatContext *avctx, AVIOContext *bc, AVStream
return 0;
}
-static int add_info(AVIOContext *bc, const char *type, const char *value){
+static int add_info(AVIOContext *bc, const char *type, const char *value)
+{
put_str(bc, type);
put_s(bc, -1);
put_str(bc, value);
return 1;
}
-static int write_globalinfo(NUTContext *nut, AVIOContext *bc){
- AVFormatContext *s= nut->avf;
+static int write_globalinfo(NUTContext *nut, AVIOContext *bc)
+{
+ AVFormatContext *s = nut->avf;
AVDictionaryEntry *t = NULL;
AVIOContext *dyn_bc;
- uint8_t *dyn_buf=NULL;
- int count=0, dyn_size;
- int ret = avio_open_dyn_buf(&dyn_bc);
- if(ret < 0)
+ uint8_t *dyn_buf = NULL;
+ int count = 0, dyn_size;
+ int ret = avio_open_dyn_buf(&dyn_bc);
+ if (ret < 0)
return ret;
while ((t = av_dict_get(s->metadata, "", t, AV_DICT_IGNORE_SUFFIX)))
@@ -450,7 +503,7 @@ static int write_globalinfo(NUTContext *nut, AVIOContext *bc){
ff_put_v(bc, count);
- dyn_size= avio_close_dyn_buf(dyn_bc, &dyn_buf);
+ dyn_size = avio_close_dyn_buf(dyn_bc, &dyn_buf);
avio_write(bc, dyn_buf, dyn_size);
av_free(dyn_buf);
return 0;
@@ -490,9 +543,9 @@ static int write_streaminfo(NUTContext *nut, AVIOContext *bc, int stream_id){
static int write_chapter(NUTContext *nut, AVIOContext *bc, int id)
{
AVIOContext *dyn_bc;
- uint8_t *dyn_buf = NULL;
+ uint8_t *dyn_buf = NULL;
AVDictionaryEntry *t = NULL;
- AVChapter *ch = nut->avf->chapters[id];
+ AVChapter *ch = nut->avf->chapters[id];
int ret, dyn_size, count = 0;
ret = avio_open_dyn_buf(&dyn_bc);
@@ -515,7 +568,8 @@ static int write_chapter(NUTContext *nut, AVIOContext *bc, int id)
return 0;
}
-static int write_headers(AVFormatContext *avctx, AVIOContext *bc){
+static int write_headers(AVFormatContext *avctx, AVIOContext *bc)
+{
NUTContext *nut = avctx->priv_data;
AVIOContext *dyn_bc;
int i, ret;
@@ -523,29 +577,30 @@ static int write_headers(AVFormatContext *avctx, AVIOContext *bc){
ff_metadata_conv_ctx(avctx, ff_nut_metadata_conv, NULL);
ret = avio_open_dyn_buf(&dyn_bc);
- if(ret < 0)
+ if (ret < 0)
return ret;
write_mainheader(nut, dyn_bc);
put_packet(nut, bc, dyn_bc, 1, MAIN_STARTCODE);
- for (i=0; i < nut->avf->nb_streams; i++){
+ for (i = 0; i < nut->avf->nb_streams; i++) {
ret = avio_open_dyn_buf(&dyn_bc);
- if(ret < 0)
+ if (ret < 0)
return ret;
- if ((ret = write_streamheader(avctx, dyn_bc, nut->avf->streams[i], i)) < 0)
+ ret = write_streamheader(avctx, dyn_bc, nut->avf->streams[i], i);
+ if (ret < 0)
return ret;
put_packet(nut, bc, dyn_bc, 1, STREAM_STARTCODE);
}
ret = avio_open_dyn_buf(&dyn_bc);
- if(ret < 0)
+ if (ret < 0)
return ret;
write_globalinfo(nut, dyn_bc);
put_packet(nut, bc, dyn_bc, 1, INFO_STARTCODE);
for (i = 0; i < nut->avf->nb_streams; i++) {
ret = avio_open_dyn_buf(&dyn_bc);
- if(ret < 0)
+ if (ret < 0)
return ret;
ret = write_streaminfo(nut, dyn_bc, i);
if (ret < 0)
@@ -553,7 +608,7 @@ static int write_headers(AVFormatContext *avctx, AVIOContext *bc){
if (ret > 0)
put_packet(nut, bc, dyn_bc, 1, INFO_STARTCODE);
else {
- uint8_t* buf;
+ uint8_t *buf;
avio_close_dyn_buf(dyn_bc, &buf);
av_free(buf);
}
@@ -573,22 +628,23 @@ static int write_headers(AVFormatContext *avctx, AVIOContext *bc){
put_packet(nut, bc, dyn_bc, 1, INFO_STARTCODE);
}
- nut->last_syncpoint_pos= INT_MIN;
+ nut->last_syncpoint_pos = INT_MIN;
nut->header_count++;
return 0;
}
-static int nut_write_header(AVFormatContext *s){
+static int nut_write_header(AVFormatContext *s)
+{
NUTContext *nut = s->priv_data;
AVIOContext *bc = s->pb;
int i, j, ret;
- nut->avf= s;
+ nut->avf = s;
- nut->stream = av_mallocz(sizeof(StreamContext)*s->nb_streams);
+ nut->stream = av_mallocz(sizeof(StreamContext) * s->nb_streams);
if (s->nb_chapters)
- nut->chapter = av_mallocz(sizeof(ChapterContext)*s->nb_chapters);
- nut->time_base= av_mallocz(sizeof(AVRational )*(s->nb_streams +
+ nut->chapter = av_mallocz(sizeof(ChapterContext) * s->nb_chapters);
+ nut->time_base = av_mallocz(sizeof(AVRational) * (s->nb_streams +
s->nb_chapters));
if (!nut->stream || (s->nb_chapters && !nut->chapter) || !nut->time_base) {
av_freep(&nut->stream);
@@ -597,42 +653,42 @@ static int nut_write_header(AVFormatContext *s){
return AVERROR(ENOMEM);
}
- for(i=0; i<s->nb_streams; i++){
- AVStream *st= s->streams[i];
+ for (i = 0; i < s->nb_streams; i++) {
+ AVStream *st = s->streams[i];
int ssize;
AVRational time_base;
- ff_parse_specific_params(st->codec, &time_base.den, &ssize, &time_base.num);
+ ff_parse_specific_params(st->codec, &time_base.den, &ssize,
+ &time_base.num);
avpriv_set_pts_info(st, 64, time_base.num, time_base.den);
- for(j=0; j<nut->time_base_count; j++){
- if(!memcmp(&time_base, &nut->time_base[j], sizeof(AVRational))){
+ for (j = 0; j < nut->time_base_count; j++)
+ if (!memcmp(&time_base, &nut->time_base[j], sizeof(AVRational))) {
break;
}
- }
- nut->time_base[j]= time_base;
- nut->stream[i].time_base= &nut->time_base[j];
- if(j==nut->time_base_count)
+ nut->time_base[j] = time_base;
+ nut->stream[i].time_base = &nut->time_base[j];
+ if (j == nut->time_base_count)
nut->time_base_count++;
- if(INT64_C(1000) * time_base.num >= time_base.den)
+ if (INT64_C(1000) * time_base.num >= time_base.den)
nut->stream[i].msb_pts_shift = 7;
else
nut->stream[i].msb_pts_shift = 14;
- nut->stream[i].max_pts_distance= FFMAX(time_base.den, time_base.num) / time_base.num;
+ nut->stream[i].max_pts_distance =
+ FFMAX(time_base.den, time_base.num) / time_base.num;
}
for (i = 0; i < s->nb_chapters; i++) {
AVChapter *ch = s->chapters[i];
- for (j = 0; j < nut->time_base_count; j++) {
+ for (j = 0; j < nut->time_base_count; j++)
if (!memcmp(&ch->time_base, &nut->time_base[j], sizeof(AVRational)))
break;
- }
- nut->time_base[j] = ch->time_base;
+ nut->time_base[j] = ch->time_base;
nut->chapter[i].time_base = &nut->time_base[j];
- if(j == nut->time_base_count)
+ if (j == nut->time_base_count)
nut->time_base_count++;
}
@@ -654,186 +710,211 @@ static int nut_write_header(AVFormatContext *s){
return 0;
}
-static int get_needed_flags(NUTContext *nut, StreamContext *nus, FrameCode *fc, AVPacket *pkt){
- int flags= 0;
-
- if(pkt->flags & AV_PKT_FLAG_KEY ) flags |= FLAG_KEY;
- if(pkt->stream_index != fc->stream_id ) flags |= FLAG_STREAM_ID;
- if(pkt->size / fc->size_mul ) flags |= FLAG_SIZE_MSB;
- if(pkt->pts - nus->last_pts != fc->pts_delta) flags |= FLAG_CODED_PTS;
- if(pkt->size > 2*nut->max_distance ) flags |= FLAG_CHECKSUM;
- if(FFABS(pkt->pts - nus->last_pts)
- > nus->max_pts_distance) flags |= FLAG_CHECKSUM;
- if( pkt->size < nut->header_len[fc->header_idx]
- || (pkt->size > 4096 && fc->header_idx)
- || memcmp(pkt->data, nut->header[fc->header_idx], nut->header_len[fc->header_idx]))
- flags |= FLAG_HEADER_IDX;
+static int get_needed_flags(NUTContext *nut, StreamContext *nus, FrameCode *fc,
+ AVPacket *pkt)
+{
+ int flags = 0;
+
+ if (pkt->flags & AV_PKT_FLAG_KEY)
+ flags |= FLAG_KEY;
+ if (pkt->stream_index != fc->stream_id)
+ flags |= FLAG_STREAM_ID;
+ if (pkt->size / fc->size_mul)
+ flags |= FLAG_SIZE_MSB;
+ if (pkt->pts - nus->last_pts != fc->pts_delta)
+ flags |= FLAG_CODED_PTS;
+ if (pkt->size > 2 * nut->max_distance)
+ flags |= FLAG_CHECKSUM;
+ if (FFABS(pkt->pts - nus->last_pts) > nus->max_pts_distance)
+ flags |= FLAG_CHECKSUM;
+ if (pkt->size < nut->header_len[fc->header_idx] ||
+ (pkt->size > 4096 && fc->header_idx) ||
+ memcmp(pkt->data, nut->header[fc->header_idx],
+ nut->header_len[fc->header_idx]))
+ flags |= FLAG_HEADER_IDX;
return flags | (fc->flags & FLAG_CODED);
}
-static int find_best_header_idx(NUTContext *nut, AVPacket *pkt){
+static int find_best_header_idx(NUTContext *nut, AVPacket *pkt)
+{
int i;
- int best_i = 0;
- int best_len= 0;
+ int best_i = 0;
+ int best_len = 0;
- if(pkt->size > 4096)
+ if (pkt->size > 4096)
return 0;
- for(i=1; i<nut->header_count; i++){
- if( pkt->size >= nut->header_len[i]
- && nut->header_len[i] > best_len
- && !memcmp(pkt->data, nut->header[i], nut->header_len[i])){
- best_i= i;
- best_len= nut->header_len[i];
+ for (i = 1; i < nut->header_count; i++)
+ if (pkt->size >= nut->header_len[i]
+ && nut->header_len[i] > best_len
+ && !memcmp(pkt->data, nut->header[i], nut->header_len[i])) {
+ best_i = i;
+ best_len = nut->header_len[i];
}
- }
return best_i;
}
-static int nut_write_packet(AVFormatContext *s, AVPacket *pkt){
- NUTContext *nut = s->priv_data;
- StreamContext *nus= &nut->stream[pkt->stream_index];
- AVIOContext *bc = s->pb, *dyn_bc;
+static int nut_write_packet(AVFormatContext *s, AVPacket *pkt)
+{
+ NUTContext *nut = s->priv_data;
+ StreamContext *nus = &nut->stream[pkt->stream_index];
+ AVIOContext *bc = s->pb, *dyn_bc;
FrameCode *fc;
int64_t coded_pts;
- int best_length, frame_code, flags, needed_flags, i, header_idx, best_header_idx;
+ int best_length, frame_code, flags, needed_flags, i, header_idx,
+ best_header_idx;
int key_frame = !!(pkt->flags & AV_PKT_FLAG_KEY);
- int store_sp=0;
+ int store_sp = 0;
int ret;
- if(pkt->pts < 0)
- return -1;
+ if (pkt->pts < 0) {
+ av_log(s, AV_LOG_ERROR,
+ "Negative pts not supported stream %d, pts %"PRId64"\n",
+ pkt->stream_index, pkt->pts);
+ return AVERROR_INVALIDDATA;
+ }
- if(1LL<<(20+3*nut->header_count) <= avio_tell(bc))
+ if (1LL << (20 + 3 * nut->header_count) <= avio_tell(bc))
write_headers(s, bc);
- if(key_frame && !(nus->last_flags & FLAG_KEY))
- store_sp= 1;
+ if (key_frame && !(nus->last_flags & FLAG_KEY))
+ store_sp = 1;
- if(pkt->size + 30/*FIXME check*/ + avio_tell(bc) >= nut->last_syncpoint_pos + nut->max_distance)
- store_sp= 1;
+ if (pkt->size + 30 /*FIXME check*/ + avio_tell(bc) >=
+ nut->last_syncpoint_pos + nut->max_distance)
+ store_sp = 1;
//FIXME: Ensure store_sp is 1 in the first place.
- if(store_sp){
- Syncpoint *sp, dummy= {.pos= INT64_MAX};
+ if (store_sp) {
+ Syncpoint *sp, dummy = { .pos = INT64_MAX };
ff_nut_reset_ts(nut, *nus->time_base, pkt->dts);
- for(i=0; i<s->nb_streams; i++){
- AVStream *st= s->streams[i];
+ for (i = 0; i < s->nb_streams; i++) {
+ AVStream *st = s->streams[i];
int64_t dts_tb = av_rescale_rnd(pkt->dts,
nus->time_base->num * (int64_t)nut->stream[i].time_base->den,
nus->time_base->den * (int64_t)nut->stream[i].time_base->num,
AV_ROUND_DOWN);
- int index= av_index_search_timestamp(st, dts_tb, AVSEEK_FLAG_BACKWARD);
- if(index>=0) dummy.pos= FFMIN(dummy.pos, st->index_entries[index].pos);
+ int index = av_index_search_timestamp(st, dts_tb,
+ AVSEEK_FLAG_BACKWARD);
+ if (index >= 0)
+ dummy.pos = FFMIN(dummy.pos, st->index_entries[index].pos);
}
- if(dummy.pos == INT64_MAX)
- dummy.pos= 0;
- sp= av_tree_find(nut->syncpoints, &dummy, (void *) ff_nut_sp_pos_cmp,
- NULL);
+ if (dummy.pos == INT64_MAX)
+ dummy.pos = 0;
+ sp = av_tree_find(nut->syncpoints, &dummy, (void *)ff_nut_sp_pos_cmp,
+ NULL);
- nut->last_syncpoint_pos= avio_tell(bc);
- ret = avio_open_dyn_buf(&dyn_bc);
- if(ret < 0)
+ nut->last_syncpoint_pos = avio_tell(bc);
+ ret = avio_open_dyn_buf(&dyn_bc);
+ if (ret < 0)
return ret;
put_tt(nut, nus->time_base, dyn_bc, pkt->dts);
- ff_put_v(dyn_bc, sp ? (nut->last_syncpoint_pos - sp->pos)>>4 : 0);
+ ff_put_v(dyn_bc, sp ? (nut->last_syncpoint_pos - sp->pos) >> 4 : 0);
put_packet(nut, bc, dyn_bc, 1, SYNCPOINT_STARTCODE);
- ff_nut_add_sp(nut, nut->last_syncpoint_pos, 0/*unused*/, pkt->dts);
+ ff_nut_add_sp(nut, nut->last_syncpoint_pos, 0 /*unused*/, pkt->dts);
}
assert(nus->last_pts != AV_NOPTS_VALUE);
- coded_pts = pkt->pts & ((1<<nus->msb_pts_shift)-1);
- if(ff_lsb2full(nus, coded_pts) != pkt->pts)
- coded_pts= pkt->pts + (1<<nus->msb_pts_shift);
+ coded_pts = pkt->pts & ((1 << nus->msb_pts_shift) - 1);
+ if (ff_lsb2full(nus, coded_pts) != pkt->pts)
+ coded_pts = pkt->pts + (1 << nus->msb_pts_shift);
- best_header_idx= find_best_header_idx(nut, pkt);
+ best_header_idx = find_best_header_idx(nut, pkt);
- best_length=INT_MAX;
- frame_code= -1;
- for(i=0; i<256; i++){
- int length= 0;
- FrameCode *fc= &nut->frame_code[i];
- int flags= fc->flags;
+ best_length = INT_MAX;
+ frame_code = -1;
+ for (i = 0; i < 256; i++) {
+ int length = 0;
+ FrameCode *fc = &nut->frame_code[i];
+ int flags = fc->flags;
- if(flags & FLAG_INVALID)
+ if (flags & FLAG_INVALID)
continue;
- needed_flags= get_needed_flags(nut, nus, fc, pkt);
+ needed_flags = get_needed_flags(nut, nus, fc, pkt);
- if(flags & FLAG_CODED){
+ if (flags & FLAG_CODED) {
length++;
flags = needed_flags;
}
- if((flags & needed_flags) != needed_flags)
+ if ((flags & needed_flags) != needed_flags)
continue;
- if((flags ^ needed_flags) & FLAG_KEY)
+ if ((flags ^ needed_flags) & FLAG_KEY)
continue;
- if(flags & FLAG_STREAM_ID)
- length+= ff_get_v_length(pkt->stream_index);
+ if (flags & FLAG_STREAM_ID)
+ length += ff_get_v_length(pkt->stream_index);
- if(pkt->size % fc->size_mul != fc->size_lsb)
+ if (pkt->size % fc->size_mul != fc->size_lsb)
continue;
- if(flags & FLAG_SIZE_MSB)
+ if (flags & FLAG_SIZE_MSB)
length += ff_get_v_length(pkt->size / fc->size_mul);
- if(flags & FLAG_CHECKSUM)
- length+=4;
+ if (flags & FLAG_CHECKSUM)
+ length += 4;
- if(flags & FLAG_CODED_PTS)
+ if (flags & FLAG_CODED_PTS)
length += ff_get_v_length(coded_pts);
- if( (flags & FLAG_CODED)
- && nut->header_len[best_header_idx] > nut->header_len[fc->header_idx]+1){
+ if ((flags & FLAG_CODED)
+ && nut->header_len[best_header_idx] >
+ nut->header_len[fc->header_idx] + 1) {
flags |= FLAG_HEADER_IDX;
}
- if(flags & FLAG_HEADER_IDX){
+ if (flags & FLAG_HEADER_IDX) {
length += 1 - nut->header_len[best_header_idx];
- }else{
+ } else {
length -= nut->header_len[fc->header_idx];
}
- length*=4;
- length+= !(flags & FLAG_CODED_PTS);
- length+= !(flags & FLAG_CHECKSUM);
+ length *= 4;
+ length += !(flags & FLAG_CODED_PTS);
+ length += !(flags & FLAG_CHECKSUM);
- if(length < best_length){
- best_length= length;
- frame_code=i;
+ if (length < best_length) {
+ best_length = length;
+ frame_code = i;
}
}
assert(frame_code != -1);
- fc= &nut->frame_code[frame_code];
- flags= fc->flags;
- needed_flags= get_needed_flags(nut, nus, fc, pkt);
- header_idx= fc->header_idx;
+ fc = &nut->frame_code[frame_code];
+ flags = fc->flags;
+ needed_flags = get_needed_flags(nut, nus, fc, pkt);
+ header_idx = fc->header_idx;
ffio_init_checksum(bc, ff_crc04C11DB7_update, 0);
avio_w8(bc, frame_code);
- if(flags & FLAG_CODED){
- ff_put_v(bc, (flags^needed_flags) & ~(FLAG_CODED));
+ if (flags & FLAG_CODED) {
+ ff_put_v(bc, (flags ^ needed_flags) & ~(FLAG_CODED));
flags = needed_flags;
}
- if(flags & FLAG_STREAM_ID) ff_put_v(bc, pkt->stream_index);
- if(flags & FLAG_CODED_PTS) ff_put_v(bc, coded_pts);
- if(flags & FLAG_SIZE_MSB) ff_put_v(bc, pkt->size / fc->size_mul);
- if(flags & FLAG_HEADER_IDX) ff_put_v(bc, header_idx= best_header_idx);
-
- if(flags & FLAG_CHECKSUM) avio_wl32(bc, ffio_get_checksum(bc));
- else ffio_get_checksum(bc);
+ if (flags & FLAG_STREAM_ID)
+ ff_put_v(bc, pkt->stream_index);
+ if (flags & FLAG_CODED_PTS)
+ ff_put_v(bc, coded_pts);
+ if (flags & FLAG_SIZE_MSB)
+ ff_put_v(bc, pkt->size / fc->size_mul);
+ if (flags & FLAG_HEADER_IDX)
+ ff_put_v(bc, header_idx = best_header_idx);
+
+ if (flags & FLAG_CHECKSUM)
+ avio_wl32(bc, ffio_get_checksum(bc));
+ else
+ ffio_get_checksum(bc);
- avio_write(bc, pkt->data + nut->header_len[header_idx], pkt->size - nut->header_len[header_idx]);
- nus->last_flags= flags;
- nus->last_pts= pkt->pts;
+ avio_write(bc, pkt->data + nut->header_len[header_idx],
+ pkt->size - nut->header_len[header_idx]);
+ nus->last_flags = flags;
+ nus->last_pts = pkt->pts;
//FIXME just store one per syncpoint
- if(flags & FLAG_KEY)
+ if (flags & FLAG_KEY)
av_add_index_entry(
s->streams[pkt->stream_index],
nut->last_syncpoint_pos,
@@ -845,13 +926,14 @@ static int nut_write_packet(AVFormatContext *s, AVPacket *pkt){
return 0;
}
-static int nut_write_trailer(AVFormatContext *s){
- NUTContext *nut= s->priv_data;
- AVIOContext *bc= s->pb;
+static int nut_write_trailer(AVFormatContext *s)
+{
+ NUTContext *nut = s->priv_data;
+ AVIOContext *bc = s->pb;
- while(nut->header_count<3)
+ while (nut->header_count < 3)
write_headers(s, bc);
- avio_flush(bc);
+
ff_nut_free_sp(nut);
av_freep(&nut->stream);
av_freep(&nut->chapter);
@@ -862,21 +944,16 @@ static int nut_write_trailer(AVFormatContext *s){
AVOutputFormat ff_nut_muxer = {
.name = "nut",
- .long_name = NULL_IF_CONFIG_SMALL("NUT format"),
+ .long_name = NULL_IF_CONFIG_SMALL("NUT"),
.mime_type = "video/x-nut",
.extensions = "nut",
.priv_data_size = sizeof(NUTContext),
-#if CONFIG_LIBVORBIS
- .audio_codec = CODEC_ID_VORBIS,
-#elif CONFIG_LIBMP3LAME
- .audio_codec = CODEC_ID_MP3,
-#else
- .audio_codec = CODEC_ID_MP2,
-#endif
- .video_codec = CODEC_ID_MPEG4,
+ .audio_codec = CONFIG_LIBVORBIS ? AV_CODEC_ID_VORBIS :
+ CONFIG_LIBMP3LAME ? AV_CODEC_ID_MP3 : AV_CODEC_ID_MP2,
+ .video_codec = AV_CODEC_ID_MPEG4,
.write_header = nut_write_header,
.write_packet = nut_write_packet,
.write_trailer = nut_write_trailer,
- .flags = AVFMT_GLOBALHEADER | AVFMT_VARIABLE_FPS,
- .codec_tag = (const AVCodecTag * const []){ ff_codec_bmp_tags, ff_nut_video_tags, ff_codec_wav_tags, ff_nut_subtitle_tags, 0 },
+ .flags = AVFMT_GLOBALHEADER | AVFMT_VARIABLE_FPS,
+ .codec_tag = ff_nut_codec_tags,
};
diff --git a/gst-libs/ext/libav/libavformat/nuv.c b/gst-libs/ext/libav/libavformat/nuv.c
index 262c4c5..5e9666f 100644
--- a/gst-libs/ext/libav/libavformat/nuv.c
+++ b/gst-libs/ext/libav/libavformat/nuv.c
@@ -19,12 +19,19 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "libavutil/channel_layout.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/intfloat.h"
#include "avformat.h"
#include "internal.h"
#include "riff.h"
+static const AVCodecTag nuv_audio_tags[] = {
+ { AV_CODEC_ID_PCM_S16LE, MKTAG('R', 'A', 'W', 'A') },
+ { AV_CODEC_ID_MP3, MKTAG('L', 'A', 'M', 'E') },
+ { AV_CODEC_ID_NONE, 0 },
+};
+
typedef struct {
int v_id;
int a_id;
@@ -32,14 +39,15 @@ typedef struct {
} NUVContext;
typedef enum {
- NUV_VIDEO = 'V',
+ NUV_VIDEO = 'V',
NUV_EXTRADATA = 'D',
- NUV_AUDIO = 'A',
- NUV_SEEKP = 'R',
- NUV_MYTHEXT = 'X'
+ NUV_AUDIO = 'A',
+ NUV_SEEKP = 'R',
+ NUV_MYTHEXT = 'X'
} nuv_frametype;
-static int nuv_probe(AVProbeData *p) {
+static int nuv_probe(AVProbeData *p)
+{
if (!memcmp(p->buf, "NuppelVideo", 12))
return AVPROBE_SCORE_MAX;
if (!memcmp(p->buf, "MythTVVideo", 12))
@@ -55,91 +63,113 @@ static int nuv_probe(AVProbeData *p) {
* @param vst video stream of which to change parameters
* @param ast video stream of which to change parameters
* @param myth set if this is a MythTVVideo format file
- * @return 1 if all required codec data was found
+ * @return 0 or AVERROR code
*/
static int get_codec_data(AVIOContext *pb, AVStream *vst,
- AVStream *ast, int myth) {
+ AVStream *ast, int myth)
+{
nuv_frametype frametype;
+
if (!vst && !myth)
return 1; // no codec data needed
while (!pb->eof_reached) {
int size, subtype;
+
frametype = avio_r8(pb);
switch (frametype) {
- case NUV_EXTRADATA:
- subtype = avio_r8(pb);
- avio_skip(pb, 6);
- size = PKTSIZE(avio_rl32(pb));
- if (vst && subtype == 'R') {
- vst->codec->extradata_size = size;
- vst->codec->extradata = av_malloc(size);
- avio_read(pb, vst->codec->extradata, size);
- size = 0;
- if (!myth)
- return 1;
+ case NUV_EXTRADATA:
+ subtype = avio_r8(pb);
+ avio_skip(pb, 6);
+ size = PKTSIZE(avio_rl32(pb));
+ if (vst && subtype == 'R') {
+ if (vst->codec->extradata) {
+ av_freep(&vst->codec->extradata);
+ vst->codec->extradata_size = 0;
}
+ vst->codec->extradata = av_malloc(size);
+ if (!vst->codec->extradata)
+ return AVERROR(ENOMEM);
+ vst->codec->extradata_size = size;
+ avio_read(pb, vst->codec->extradata, size);
+ size = 0;
+ if (!myth)
+ return 0;
+ }
+ break;
+ case NUV_MYTHEXT:
+ avio_skip(pb, 7);
+ size = PKTSIZE(avio_rl32(pb));
+ if (size != 128 * 4)
break;
- case NUV_MYTHEXT:
- avio_skip(pb, 7);
- size = PKTSIZE(avio_rl32(pb));
- if (size != 128 * 4)
- break;
- avio_rl32(pb); // version
- if (vst) {
- vst->codec->codec_tag = avio_rl32(pb);
- vst->codec->codec_id =
- ff_codec_get_id(ff_codec_bmp_tags, vst->codec->codec_tag);
- if (vst->codec->codec_tag == MKTAG('R', 'J', 'P', 'G'))
- vst->codec->codec_id = CODEC_ID_NUV;
- } else
- avio_skip(pb, 4);
-
- if (ast) {
- ast->codec->codec_tag = avio_rl32(pb);
- ast->codec->sample_rate = avio_rl32(pb);
- ast->codec->bits_per_coded_sample = avio_rl32(pb);
- ast->codec->channels = avio_rl32(pb);
- ast->codec->codec_id =
- ff_wav_codec_get_id(ast->codec->codec_tag,
+ avio_rl32(pb); // version
+ if (vst) {
+ vst->codec->codec_tag = avio_rl32(pb);
+ vst->codec->codec_id =
+ ff_codec_get_id(ff_codec_bmp_tags, vst->codec->codec_tag);
+ if (vst->codec->codec_tag == MKTAG('R', 'J', 'P', 'G'))
+ vst->codec->codec_id = AV_CODEC_ID_NUV;
+ } else
+ avio_skip(pb, 4);
+
+ if (ast) {
+ int id;
+
+ ast->codec->codec_tag = avio_rl32(pb);
+ ast->codec->sample_rate = avio_rl32(pb);
+ ast->codec->bits_per_coded_sample = avio_rl32(pb);
+ ast->codec->channels = avio_rl32(pb);
+ ast->codec->channel_layout = 0;
+
+ id = ff_wav_codec_get_id(ast->codec->codec_tag,
ast->codec->bits_per_coded_sample);
- ast->need_parsing = AVSTREAM_PARSE_FULL;
- } else
- avio_skip(pb, 4 * 4);
+ if (id == AV_CODEC_ID_NONE) {
+ id = ff_codec_get_id(nuv_audio_tags, ast->codec->codec_tag);
+ if (id == AV_CODEC_ID_PCM_S16LE)
+ id = ff_get_pcm_codec_id(ast->codec->bits_per_coded_sample,
+ 0, 0, ~1);
+ }
+ ast->codec->codec_id = id;
- size -= 6 * 4;
- avio_skip(pb, size);
- return 1;
- case NUV_SEEKP:
- size = 11;
- break;
- default:
- avio_skip(pb, 7);
- size = PKTSIZE(avio_rl32(pb));
- break;
+ ast->need_parsing = AVSTREAM_PARSE_FULL;
+ } else
+ avio_skip(pb, 4 * 4);
+
+ size -= 6 * 4;
+ avio_skip(pb, size);
+ return 0;
+ case NUV_SEEKP:
+ size = 11;
+ break;
+ default:
+ avio_skip(pb, 7);
+ size = PKTSIZE(avio_rl32(pb));
+ break;
}
avio_skip(pb, size);
}
+
return 0;
}
-static int nuv_header(AVFormatContext *s, AVFormatParameters *ap) {
+static int nuv_header(AVFormatContext *s)
+{
NUVContext *ctx = s->priv_data;
AVIOContext *pb = s->pb;
char id_string[12];
double aspect, fps;
- int is_mythtv, width, height, v_packs, a_packs;
- int stream_nr = 0;
+ int is_mythtv, width, height, v_packs, a_packs, ret;
AVStream *vst = NULL, *ast = NULL;
+
avio_read(pb, id_string, 12);
is_mythtv = !memcmp(id_string, "MythTVVideo", 12);
- avio_skip(pb, 5); // version string
- avio_skip(pb, 3); // padding
- width = avio_rl32(pb);
+ avio_skip(pb, 5); // version string
+ avio_skip(pb, 3); // padding
+ width = avio_rl32(pb);
height = avio_rl32(pb);
- avio_rl32(pb); // unused, "desiredwidth"
- avio_rl32(pb); // unused, "desiredheight"
- avio_r8(pb); // 'P' == progressive, 'I' == interlaced
- avio_skip(pb, 3); // padding
+ avio_rl32(pb); // unused, "desiredwidth"
+ avio_rl32(pb); // unused, "desiredheight"
+ avio_r8(pb); // 'P' == progressive, 'I' == interlaced
+ avio_skip(pb, 3); // padding
aspect = av_int2double(avio_rl64(pb));
if (aspect > 0.9999 && aspect < 1.0001)
aspect = 4.0 / 3.0;
@@ -153,118 +183,135 @@ static int nuv_header(AVFormatContext *s, AVFormatParameters *ap) {
avio_rl32(pb); // keyframe distance (?)
if (v_packs) {
- ctx->v_id = stream_nr++;
vst = avformat_new_stream(s, NULL);
if (!vst)
return AVERROR(ENOMEM);
- vst->codec->codec_type = AVMEDIA_TYPE_VIDEO;
- vst->codec->codec_id = CODEC_ID_NUV;
- vst->codec->width = width;
- vst->codec->height = height;
+ ctx->v_id = vst->index;
+
+ vst->codec->codec_type = AVMEDIA_TYPE_VIDEO;
+ vst->codec->codec_id = AV_CODEC_ID_NUV;
+ vst->codec->width = width;
+ vst->codec->height = height;
vst->codec->bits_per_coded_sample = 10;
- vst->sample_aspect_ratio = av_d2q(aspect * height / width, 10000);
- vst->r_frame_rate = av_d2q(fps, 60000);
+ vst->sample_aspect_ratio = av_d2q(aspect * height / width,
+ 10000);
+#if FF_API_R_FRAME_RATE
+ vst->r_frame_rate =
+#endif
+ vst->avg_frame_rate = av_d2q(fps, 60000);
avpriv_set_pts_info(vst, 32, 1, 1000);
} else
ctx->v_id = -1;
if (a_packs) {
- ctx->a_id = stream_nr++;
ast = avformat_new_stream(s, NULL);
if (!ast)
return AVERROR(ENOMEM);
- ast->codec->codec_type = AVMEDIA_TYPE_AUDIO;
- ast->codec->codec_id = CODEC_ID_PCM_S16LE;
- ast->codec->channels = 2;
- ast->codec->sample_rate = 44100;
- ast->codec->bit_rate = 2 * 2 * 44100 * 8;
- ast->codec->block_align = 2 * 2;
+ ctx->a_id = ast->index;
+
+ ast->codec->codec_type = AVMEDIA_TYPE_AUDIO;
+ ast->codec->codec_id = AV_CODEC_ID_PCM_S16LE;
+ ast->codec->channels = 2;
+ ast->codec->channel_layout = AV_CH_LAYOUT_STEREO;
+ ast->codec->sample_rate = 44100;
+ ast->codec->bit_rate = 2 * 2 * 44100 * 8;
+ ast->codec->block_align = 2 * 2;
ast->codec->bits_per_coded_sample = 16;
avpriv_set_pts_info(ast, 32, 1, 1000);
} else
ctx->a_id = -1;
- get_codec_data(pb, vst, ast, is_mythtv);
- ctx->rtjpg_video = vst && vst->codec->codec_id == CODEC_ID_NUV;
+ if ((ret = get_codec_data(pb, vst, ast, is_mythtv)) < 0)
+ return ret;
+
+ ctx->rtjpg_video = vst && vst->codec->codec_id == AV_CODEC_ID_NUV;
+
return 0;
}
#define HDRSIZE 12
-static int nuv_packet(AVFormatContext *s, AVPacket *pkt) {
+static int nuv_packet(AVFormatContext *s, AVPacket *pkt)
+{
NUVContext *ctx = s->priv_data;
AVIOContext *pb = s->pb;
uint8_t hdr[HDRSIZE];
nuv_frametype frametype;
int ret, size;
+
while (!pb->eof_reached) {
int copyhdrsize = ctx->rtjpg_video ? HDRSIZE : 0;
- uint64_t pos = avio_tell(pb);
+ uint64_t pos = avio_tell(pb);
+
ret = avio_read(pb, hdr, HDRSIZE);
if (ret < HDRSIZE)
return ret < 0 ? ret : AVERROR(EIO);
+
frametype = hdr[0];
- size = PKTSIZE(AV_RL32(&hdr[8]));
+ size = PKTSIZE(AV_RL32(&hdr[8]));
+
switch (frametype) {
- case NUV_EXTRADATA:
- if (!ctx->rtjpg_video) {
- avio_skip(pb, size);
- break;
- }
- case NUV_VIDEO:
- if (ctx->v_id < 0) {
- av_log(s, AV_LOG_ERROR, "Video packet in file without video stream!\n");
- avio_skip(pb, size);
- break;
- }
- ret = av_new_packet(pkt, copyhdrsize + size);
- if (ret < 0)
- return ret;
- // HACK: we have no idea if it is a keyframe,
- // but if we mark none seeking will not work at all.
- pkt->flags |= AV_PKT_FLAG_KEY;
- pkt->pos = pos;
- pkt->pts = AV_RL32(&hdr[4]);
- pkt->stream_index = ctx->v_id;
- memcpy(pkt->data, hdr, copyhdrsize);
- ret = avio_read(pb, pkt->data + copyhdrsize, size);
- if (ret < 0) {
- av_free_packet(pkt);
- return ret;
- }
- if (ret < size)
- av_shrink_packet(pkt, copyhdrsize + ret);
- return 0;
- case NUV_AUDIO:
- if (ctx->a_id < 0) {
- av_log(s, AV_LOG_ERROR, "Audio packet in file without audio stream!\n");
- avio_skip(pb, size);
- break;
- }
- ret = av_get_packet(pb, pkt, size);
- pkt->flags |= AV_PKT_FLAG_KEY;
- pkt->pos = pos;
- pkt->pts = AV_RL32(&hdr[4]);
- pkt->stream_index = ctx->a_id;
- if (ret < 0) return ret;
- return 0;
- case NUV_SEEKP:
- // contains no data, size value is invalid
+ case NUV_EXTRADATA:
+ if (!ctx->rtjpg_video) {
+ avio_skip(pb, size);
break;
- default:
+ }
+ case NUV_VIDEO:
+ if (ctx->v_id < 0) {
+ av_log(s, AV_LOG_ERROR, "Video packet in file without video stream!\n");
avio_skip(pb, size);
break;
+ }
+ ret = av_new_packet(pkt, copyhdrsize + size);
+ if (ret < 0)
+ return ret;
+ // HACK: we have no idea if it is a keyframe,
+ // but if we mark none seeking will not work at all.
+ pkt->flags |= AV_PKT_FLAG_KEY;
+ pkt->pos = pos;
+ pkt->pts = AV_RL32(&hdr[4]);
+ pkt->stream_index = ctx->v_id;
+ memcpy(pkt->data, hdr, copyhdrsize);
+ ret = avio_read(pb, pkt->data + copyhdrsize, size);
+ if (ret < 0) {
+ av_free_packet(pkt);
+ return ret;
+ }
+ if (ret < size)
+ av_shrink_packet(pkt, copyhdrsize + ret);
+ return 0;
+ case NUV_AUDIO:
+ if (ctx->a_id < 0) {
+ av_log(s, AV_LOG_ERROR, "Audio packet in file without audio stream!\n");
+ avio_skip(pb, size);
+ break;
+ }
+ ret = av_get_packet(pb, pkt, size);
+ pkt->flags |= AV_PKT_FLAG_KEY;
+ pkt->pos = pos;
+ pkt->pts = AV_RL32(&hdr[4]);
+ pkt->stream_index = ctx->a_id;
+ if (ret < 0)
+ return ret;
+ return 0;
+ case NUV_SEEKP:
+ // contains no data, size value is invalid
+ break;
+ default:
+ avio_skip(pb, size);
+ break;
}
}
+
return AVERROR(EIO);
}
AVInputFormat ff_nuv_demuxer = {
.name = "nuv",
- .long_name = NULL_IF_CONFIG_SMALL("NuppelVideo format"),
+ .long_name = NULL_IF_CONFIG_SMALL("NuppelVideo"),
.priv_data_size = sizeof(NUVContext),
.read_probe = nuv_probe,
.read_header = nuv_header,
.read_packet = nuv_packet,
- .flags = AVFMT_GENERIC_INDEX,
+ .flags = AVFMT_GENERIC_INDEX,
};
diff --git a/gst-libs/ext/libav/libavformat/oggdec.c b/gst-libs/ext/libav/libavformat/oggdec.c
index 2a1c0a5..d8f89b8 100644
--- a/gst-libs/ext/libav/libavformat/oggdec.c
+++ b/gst-libs/ext/libav/libavformat/oggdec.c
@@ -60,18 +60,18 @@ static int ogg_save(AVFormatContext *s)
{
struct ogg *ogg = s->priv_data;
struct ogg_state *ost =
- av_malloc(sizeof (*ost) + (ogg->nstreams-1) * sizeof (*ogg->streams));
+ av_malloc(sizeof(*ost) + (ogg->nstreams - 1) * sizeof(*ogg->streams));
int i;
- ost->pos = avio_tell (s->pb);
- ost->curidx = ogg->curidx;
- ost->next = ogg->state;
+ ost->pos = avio_tell(s->pb);
+ ost->curidx = ogg->curidx;
+ ost->next = ogg->state;
ost->nstreams = ogg->nstreams;
memcpy(ost->streams, ogg->streams, ogg->nstreams * sizeof(*ogg->streams));
- for (i = 0; i < ogg->nstreams; i++){
+ for (i = 0; i < ogg->nstreams; i++) {
struct ogg_stream *os = ogg->streams + i;
- os->buf = av_mallocz (os->bufsize + FF_INPUT_BUFFER_PADDING_SIZE);
- memcpy (os->buf, ost->streams[i].buf, os->bufpos);
+ os->buf = av_mallocz(os->bufsize + FF_INPUT_BUFFER_PADDING_SIZE);
+ memcpy(os->buf, ost->streams[i].buf, os->bufpos);
}
ogg->state = ost;
@@ -91,17 +91,17 @@ static int ogg_restore(AVFormatContext *s, int discard)
ogg->state = ost->next;
- if (!discard){
+ if (!discard) {
struct ogg_stream *old_streams = ogg->streams;
for (i = 0; i < ogg->nstreams; i++)
- av_free (ogg->streams[i].buf);
+ av_free(ogg->streams[i].buf);
- avio_seek (bc, ost->pos, SEEK_SET);
- ogg->curidx = ost->curidx;
+ avio_seek(bc, ost->pos, SEEK_SET);
+ ogg->curidx = ost->curidx;
ogg->nstreams = ost->nstreams;
- ogg->streams = av_realloc (ogg->streams,
- ogg->nstreams * sizeof (*ogg->streams));
+ ogg->streams = av_realloc(ogg->streams,
+ ogg->nstreams * sizeof(*ogg->streams));
if (ogg->streams) {
memcpy(ogg->streams, ost->streams,
@@ -112,7 +112,7 @@ static int ogg_restore(AVFormatContext *s, int discard)
}
}
- av_free (ost);
+ av_free(ost);
return 0;
}
@@ -121,18 +121,18 @@ static int ogg_reset(struct ogg *ogg)
{
int i;
- for (i = 0; i < ogg->nstreams; i++){
+ for (i = 0; i < ogg->nstreams; i++) {
struct ogg_stream *os = ogg->streams + i;
- os->bufpos = 0;
- os->pstart = 0;
- os->psize = 0;
- os->granule = -1;
- os->lastpts = AV_NOPTS_VALUE;
- os->lastdts = AV_NOPTS_VALUE;
- os->sync_pos = -1;
- os->page_pos = 0;
- os->nsegs = 0;
- os->segp = 0;
+ os->bufpos = 0;
+ os->pstart = 0;
+ os->psize = 0;
+ os->granule = -1;
+ os->lastpts = AV_NOPTS_VALUE;
+ os->lastdts = AV_NOPTS_VALUE;
+ os->sync_pos = -1;
+ os->page_pos = 0;
+ os->nsegs = 0;
+ os->segp = 0;
os->incomplete = 0;
}
@@ -147,7 +147,7 @@ static const struct ogg_codec *ogg_find_codec(uint8_t *buf, int size)
for (i = 0; ogg_codecs[i]; i++)
if (size >= ogg_codecs[i]->magicsize &&
- !memcmp (buf, ogg_codecs[i]->magic, ogg_codecs[i]->magicsize))
+ !memcmp(buf, ogg_codecs[i]->magic, ogg_codecs[i]->magicsize))
return ogg_codecs[i];
return NULL;
@@ -155,25 +155,26 @@ static const struct ogg_codec *ogg_find_codec(uint8_t *buf, int size)
static int ogg_new_stream(AVFormatContext *s, uint32_t serial, int new_avstream)
{
-
struct ogg *ogg = s->priv_data;
- int idx = ogg->nstreams++;
+ int idx = ogg->nstreams++;
AVStream *st;
struct ogg_stream *os;
- os = av_realloc (ogg->streams, ogg->nstreams * sizeof (*ogg->streams));
+ os = av_realloc(ogg->streams, ogg->nstreams * sizeof(*ogg->streams));
if (!os)
return AVERROR(ENOMEM);
ogg->streams = os;
- memset (ogg->streams + idx, 0, sizeof (*ogg->streams));
- os = ogg->streams + idx;
- os->serial = serial;
- os->bufsize = DECODER_BUFFER_SIZE;
- os->buf = av_malloc(os->bufsize + FF_INPUT_BUFFER_PADDING_SIZE);
- os->header = -1;
+ memset(ogg->streams + idx, 0, sizeof(*ogg->streams));
+
+ os = ogg->streams + idx;
+ os->serial = serial;
+ os->bufsize = DECODER_BUFFER_SIZE;
+ os->buf = av_malloc(os->bufsize + FF_INPUT_BUFFER_PADDING_SIZE);
+ os->header = -1;
+ os->start_granule = OGG_NOGRANULE_VALUE;
if (new_avstream) {
st = avformat_new_stream(s, NULL);
@@ -192,11 +193,13 @@ static int ogg_new_buf(struct ogg *ogg, int idx)
struct ogg_stream *os = ogg->streams + idx;
uint8_t *nb = av_malloc(os->bufsize + FF_INPUT_BUFFER_PADDING_SIZE);
int size = os->bufpos - os->pstart;
- if(os->buf){
+
+ if (os->buf) {
memcpy(nb, os->buf + os->pstart, size);
av_free(os->buf);
}
- os->buf = nb;
+
+ os->buf = nb;
os->bufpos = size;
os->pstart = 0;
@@ -220,7 +223,7 @@ static int ogg_read_page(AVFormatContext *s, int *str)
if (ret < 4)
return ret < 0 ? ret : AVERROR_EOF;
- do{
+ do {
int c;
if (sync[sp & 3] == 'O' &&
@@ -229,37 +232,42 @@ static int ogg_read_page(AVFormatContext *s, int *str)
break;
c = avio_r8(bc);
+
if (bc->eof_reached)
return AVERROR_EOF;
+
sync[sp++ & 3] = c;
- }while (i++ < MAX_PAGE_SIZE);
+ } while (i++ < MAX_PAGE_SIZE);
- if (i >= MAX_PAGE_SIZE){
- av_log (s, AV_LOG_INFO, "ogg, can't find sync word\n");
+ if (i >= MAX_PAGE_SIZE) {
+ av_log(s, AV_LOG_INFO, "cannot find sync word\n");
return AVERROR_INVALIDDATA;
}
if (avio_r8(bc) != 0) /* version */
return AVERROR_INVALIDDATA;
- flags = avio_r8(bc);
- gp = avio_rl64 (bc);
- serial = avio_rl32 (bc);
+ flags = avio_r8(bc);
+ gp = avio_rl64(bc);
+ serial = avio_rl32(bc);
avio_skip(bc, 8); /* seq, crc */
- nsegs = avio_r8(bc);
+ nsegs = avio_r8(bc);
- idx = ogg_find_stream (ogg, serial);
- if (idx < 0){
+ idx = ogg_find_stream(ogg, serial);
+ if (idx < 0) {
if (ogg->headers) {
int n;
for (n = 0; n < ogg->nstreams; n++) {
av_freep(&ogg->streams[n].buf);
- if (!ogg->state || ogg->state->streams[n].private != ogg->streams[n].private)
+ if (!ogg->state ||
+ ogg->state->streams[n].private != ogg->streams[n].private)
av_freep(&ogg->streams[n].private);
}
+
ogg->curidx = -1;
ogg->nstreams = 0;
+
idx = ogg_new_stream(s, serial, 0);
} else {
idx = ogg_new_stream(s, serial, 1);
@@ -271,7 +279,7 @@ static int ogg_read_page(AVFormatContext *s, int *str)
os = ogg->streams + idx;
os->page_pos = avio_tell(bc) - 27;
- if(os->psize > 0)
+ if (os->psize > 0)
ogg_new_buf(ogg, idx);
ret = avio_read(bc, os->segments, nsegs);
@@ -279,15 +287,15 @@ static int ogg_read_page(AVFormatContext *s, int *str)
return ret < 0 ? ret : AVERROR_EOF;
os->nsegs = nsegs;
- os->segp = 0;
+ os->segp = 0;
size = 0;
for (i = 0; i < nsegs; i++)
size += os->segments[i];
- if (flags & OGG_FLAG_CONT || os->incomplete){
- if (!os->psize){
- while (os->segp < os->nsegs){
+ if (flags & OGG_FLAG_CONT || os->incomplete) {
+ if (!os->psize) {
+ while (os->segp < os->nsegs) {
int seg = os->segments[os->segp++];
os->pstart += seg;
if (seg < 255)
@@ -295,17 +303,17 @@ static int ogg_read_page(AVFormatContext *s, int *str)
}
os->sync_pos = os->page_pos;
}
- }else{
- os->psize = 0;
+ } else {
+ os->psize = 0;
os->sync_pos = os->page_pos;
}
- if (os->bufsize - os->bufpos < size){
- uint8_t *nb = av_malloc ((os->bufsize *= 2) + FF_INPUT_BUFFER_PADDING_SIZE);
+ if (os->bufsize - os->bufpos < size) {
+ uint8_t *nb = av_malloc((os->bufsize *= 2) + FF_INPUT_BUFFER_PADDING_SIZE);
if (!nb)
return AVERROR(ENOMEM);
- memcpy (nb, os->buf, os->bufpos);
- av_free (os->buf);
+ memcpy(nb, os->buf, os->bufpos);
+ av_free(os->buf);
os->buf = nb;
}
@@ -315,7 +323,7 @@ static int ogg_read_page(AVFormatContext *s, int *str)
os->bufpos += size;
os->granule = gp;
- os->flags = flags;
+ os->flags = flags;
memset(os->buf + os->bufpos, 0, FF_INPUT_BUFFER_PADDING_SIZE);
if (str)
@@ -331,14 +339,14 @@ static int ogg_packet(AVFormatContext *s, int *str, int *dstart, int *dsize,
int idx, i, ret;
struct ogg_stream *os;
int complete = 0;
- int segp = 0, psize = 0;
+ int segp = 0, psize = 0;
av_dlog(s, "ogg_packet: curidx=%i\n", ogg->curidx);
- do{
+ do {
idx = ogg->curidx;
- while (idx < 0){
+ while (idx < 0) {
ret = ogg_read_page(s, &idx);
if (ret < 0)
return ret;
@@ -349,50 +357,52 @@ static int ogg_packet(AVFormatContext *s, int *str, int *dstart, int *dsize,
av_dlog(s, "ogg_packet: idx=%d pstart=%d psize=%d segp=%d nsegs=%d\n",
idx, os->pstart, os->psize, os->segp, os->nsegs);
- if (!os->codec){
- if (os->header < 0){
- os->codec = ogg_find_codec (os->buf, os->bufpos);
- if (!os->codec){
+ if (!os->codec) {
+ if (os->header < 0) {
+ os->codec = ogg_find_codec(os->buf, os->bufpos);
+ if (!os->codec) {
av_log(s, AV_LOG_WARNING, "Codec not found\n");
os->header = 0;
return 0;
}
- }else{
+ } else {
return 0;
}
}
- segp = os->segp;
+ segp = os->segp;
psize = os->psize;
- while (os->segp < os->nsegs){
+ while (os->segp < os->nsegs) {
int ss = os->segments[os->segp++];
os->psize += ss;
- if (ss < 255){
+ if (ss < 255) {
complete = 1;
break;
}
}
- if (!complete && os->segp == os->nsegs){
- ogg->curidx = -1;
+ if (!complete && os->segp == os->nsegs) {
+ ogg->curidx = -1;
os->incomplete = 1;
}
- }while (!complete);
+ } while (!complete);
av_dlog(s, "ogg_packet: idx %i, frame size %i, start %i\n",
idx, os->psize, os->pstart);
if (os->granule == -1)
- av_log(s, AV_LOG_WARNING, "Page at %"PRId64" is missing granule\n", os->page_pos);
+ av_log(s, AV_LOG_WARNING,
+ "Page at %"PRId64" is missing granule\n",
+ os->page_pos);
- ogg->curidx = idx;
+ ogg->curidx = idx;
os->incomplete = 0;
if (os->header) {
- os->header = os->codec->header (s, idx);
- if (!os->header){
- os->segp = segp;
+ os->header = os->codec->header(s, idx);
+ if (!os->header) {
+ os->segp = segp;
os->psize = psize;
// We have reached the first non-header packet in this stream.
@@ -404,6 +414,7 @@ static int ogg_packet(AVFormatContext *s, int *str, int *dstart, int *dsize,
// compute the data_offset.
if (!s->data_offset)
s->data_offset = os->sync_pos;
+
for (i = 0; i < ogg->nstreams; i++) {
struct ogg_stream *cur_os = ogg->streams + i;
@@ -412,15 +423,16 @@ static int ogg_packet(AVFormatContext *s, int *str, int *dstart, int *dsize,
if (cur_os->incomplete)
s->data_offset = FFMIN(s->data_offset, cur_os->sync_pos);
}
- }else{
+ } else {
+ os->nb_header++;
os->pstart += os->psize;
- os->psize = 0;
+ os->psize = 0;
}
} else {
- os->pflags = 0;
+ os->pflags = 0;
os->pduration = 0;
if (os->codec && os->codec->packet)
- os->codec->packet (s, idx);
+ os->codec->packet(s, idx);
if (str)
*str = idx;
if (dstart)
@@ -429,8 +441,8 @@ static int ogg_packet(AVFormatContext *s, int *str, int *dstart, int *dsize,
*dsize = os->psize;
if (fpos)
*fpos = os->sync_pos;
- os->pstart += os->psize;
- os->psize = 0;
+ os->pstart += os->psize;
+ os->psize = 0;
os->sync_pos = os->page_pos;
}
@@ -452,14 +464,27 @@ static int ogg_packet(AVFormatContext *s, int *str, int *dstart, int *dsize,
static int ogg_get_headers(AVFormatContext *s)
{
struct ogg *ogg = s->priv_data;
- int ret;
+ int ret, i;
- do{
+ do {
ret = ogg_packet(s, NULL, NULL, NULL, NULL);
if (ret < 0)
return ret;
- }while (!ogg->headers);
+ } while (!ogg->headers);
+ for (i = 0; i < ogg->nstreams; i++) {
+ struct ogg_stream *os = ogg->streams + i;
+
+ if (os->codec && os->codec->nb_header &&
+ os->nb_header < os->codec->nb_header) {
+ av_log(s, AV_LOG_ERROR,
+ "Headers mismatch for stream %d\n", i);
+ return AVERROR_INVALIDDATA;
+ }
+ if (os->start_granule != OGG_NOGRANULE_VALUE)
+ os->lastpts = s->streams[i]->start_time =
+ ogg_gptopts(s, i, os->start_granule, NULL);
+ }
av_dlog(s, "found headers\n");
return 0;
@@ -471,7 +496,7 @@ static int ogg_get_length(AVFormatContext *s)
int i;
int64_t size, end;
- if(!s->pb->seekable)
+ if (!s->pb->seekable)
return 0;
// already set
@@ -479,24 +504,24 @@ static int ogg_get_length(AVFormatContext *s)
return 0;
size = avio_size(s->pb);
- if(size < 0)
+ if (size < 0)
return 0;
- end = size > MAX_PAGE_SIZE? size - MAX_PAGE_SIZE: 0;
+ end = size > MAX_PAGE_SIZE ? size - MAX_PAGE_SIZE : 0;
- ogg_save (s);
- avio_seek (s->pb, end, SEEK_SET);
+ ogg_save(s);
+ avio_seek(s->pb, end, SEEK_SET);
- while (!ogg_read_page (s, &i)){
+ while (!ogg_read_page(s, &i)) {
if (ogg->streams[i].granule != -1 && ogg->streams[i].granule != 0 &&
ogg->streams[i].codec) {
s->streams[i]->duration =
- ogg_gptopts (s, i, ogg->streams[i].granule, NULL);
+ ogg_gptopts(s, i, ogg->streams[i].granule, NULL);
if (s->streams[i]->start_time != AV_NOPTS_VALUE)
s->streams[i]->duration -= s->streams[i]->start_time;
}
}
- ogg_restore (s, 0);
+ ogg_restore(s, 0);
return 0;
}
@@ -535,7 +560,7 @@ static int ogg_read_header(AVFormatContext *s)
ogg->streams[i].codec = NULL;
//linear granulepos seek from end
- ogg_get_length (s);
+ ogg_get_length(s);
//fill the extradata in the per codec callbacks
return 0;
@@ -543,15 +568,15 @@ static int ogg_read_header(AVFormatContext *s)
static int64_t ogg_calc_pts(AVFormatContext *s, int idx, int64_t *dts)
{
- struct ogg *ogg = s->priv_data;
+ struct ogg *ogg = s->priv_data;
struct ogg_stream *os = ogg->streams + idx;
- int64_t pts = AV_NOPTS_VALUE;
+ int64_t pts = AV_NOPTS_VALUE;
if (dts)
*dts = AV_NOPTS_VALUE;
if (os->lastpts != AV_NOPTS_VALUE) {
- pts = os->lastpts;
+ pts = os->lastpts;
os->lastpts = AV_NOPTS_VALUE;
}
if (os->lastdts != AV_NOPTS_VALUE) {
@@ -581,14 +606,14 @@ static int ogg_read_packet(AVFormatContext *s, AVPacket *pkt)
//Get an ogg packet
retry:
- do{
+ do {
ret = ogg_packet(s, &idx, &pstart, &psize, &fpos);
if (ret < 0)
return ret;
- }while (idx < 0 || !s->streams[idx]);
+ } while (idx < 0 || !s->streams[idx]);
ogg = s->priv_data;
- os = ogg->streams + idx;
+ os = ogg->streams + idx;
// pflags might not be set until after this
pts = ogg_calc_pts(s, idx, &dts);
@@ -602,13 +627,13 @@ retry:
if (ret < 0)
return ret;
pkt->stream_index = idx;
- memcpy (pkt->data, os->buf + pstart, psize);
+ memcpy(pkt->data, os->buf + pstart, psize);
- pkt->pts = pts;
- pkt->dts = dts;
- pkt->flags = os->pflags;
+ pkt->pts = pts;
+ pkt->dts = dts;
+ pkt->flags = os->pflags;
pkt->duration = os->pduration;
- pkt->pos = fpos;
+ pkt->pos = fpos;
return psize;
}
@@ -618,12 +643,13 @@ static int64_t ogg_read_timestamp(AVFormatContext *s, int stream_index,
{
struct ogg *ogg = s->priv_data;
AVIOContext *bc = s->pb;
- int64_t pts = AV_NOPTS_VALUE;
- int i = -1;
+ int64_t pts = AV_NOPTS_VALUE;
+ int i = -1;
avio_seek(bc, *pos_arg, SEEK_SET);
ogg_reset(ogg);
- while (avio_tell(bc) < pos_limit && !ogg_packet(s, &i, NULL, NULL, pos_arg)) {
+ while (avio_tell(bc) < pos_limit &&
+ !ogg_packet(s, &i, NULL, NULL, pos_arg)) {
if (i == stream_index) {
struct ogg_stream *os = ogg->streams + stream_index;
pts = ogg_calc_pts(s, i, NULL);
@@ -640,7 +666,7 @@ static int64_t ogg_read_timestamp(AVFormatContext *s, int stream_index,
static int ogg_read_seek(AVFormatContext *s, int stream_index,
int64_t timestamp, int flags)
{
- struct ogg *ogg = s->priv_data;
+ struct ogg *ogg = s->priv_data;
struct ogg_stream *os = ogg->streams + stream_index;
int ret;
@@ -651,7 +677,7 @@ static int ogg_read_seek(AVFormatContext *s, int stream_index,
os->keyframe_seek = 1;
ret = ff_seek_frame_binary(s, stream_index, timestamp, flags);
- os = ogg->streams + stream_index;
+ os = ogg->streams + stream_index;
if (ret < 0)
os->keyframe_seek = 0;
return ret;
diff --git a/gst-libs/ext/libav/libavformat/oggdec.h b/gst-libs/ext/libav/libavformat/oggdec.h
index 1a702c3..d11ff9f 100644
--- a/gst-libs/ext/libav/libavformat/oggdec.h
+++ b/gst-libs/ext/libav/libavformat/oggdec.h
@@ -68,6 +68,7 @@ struct ogg_stream {
unsigned int pduration;
uint32_t serial;
uint64_t granule;
+ uint64_t start_granule;
int64_t lastpts;
int64_t lastdts;
int64_t sync_pos; ///< file offset of the first page needed to reconstruct the current packet
@@ -80,6 +81,7 @@ struct ogg_stream {
int incomplete; ///< whether we're expecting a continuation in the next page
int page_end; ///< current packet is the last one completed in the page
int keyframe_seek;
+ int nb_header; ///< set to the number of parsed headers
void *private;
};
@@ -103,6 +105,8 @@ struct ogg {
#define OGG_FLAG_BOS 2
#define OGG_FLAG_EOS 4
+#define OGG_NOGRANULE_VALUE -1ull
+
extern const struct ogg_codec ff_celt_codec;
extern const struct ogg_codec ff_dirac_codec;
extern const struct ogg_codec ff_flac_codec;
diff --git a/gst-libs/ext/libav/libavformat/oggenc.c b/gst-libs/ext/libav/libavformat/oggenc.c
index 33aba87..c1f22d1 100644
--- a/gst-libs/ext/libav/libavformat/oggenc.c
+++ b/gst-libs/ext/libav/libavformat/oggenc.c
@@ -21,6 +21,7 @@
#include "libavutil/crc.h"
#include "libavutil/mathematics.h"
+#include "libavutil/opt.h"
#include "libavutil/random_seed.h"
#include "libavcodec/xiph.h"
#include "libavcodec/bytestream.h"
@@ -63,9 +64,28 @@ typedef struct OGGPageList {
} OGGPageList;
typedef struct {
+ const AVClass *class;
OGGPageList *page_list;
+ int pref_size; ///< preferred page size (0 => fill all segments)
} OGGContext;
+#define OFFSET(x) offsetof(OGGContext, x)
+#define PARAM AV_OPT_FLAG_ENCODING_PARAM
+
+static const AVOption options[] = {
+ { "pagesize", "preferred page size in bytes",
+ OFFSET(pref_size), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, MAX_PAGE_SIZE, PARAM },
+ { NULL },
+};
+
+static const AVClass ogg_muxer_class = {
+ .class_name = "Ogg muxer",
+ .item_name = av_default_item_name,
+ .option = options,
+ .version = LIBAVUTIL_VERSION_INT,
+};
+
+
static void ogg_update_checksum(AVFormatContext *s, AVIOContext *pb, int64_t crc_offset)
{
int64_t pos = avio_tell(pb);
@@ -172,15 +192,17 @@ static int ogg_buffer_page(AVFormatContext *s, OGGStreamContext *oggstream)
}
static int ogg_buffer_data(AVFormatContext *s, AVStream *st,
- uint8_t *data, unsigned size, int64_t granule)
+ uint8_t *data, unsigned size, int64_t granule,
+ int header)
{
OGGStreamContext *oggstream = st->priv_data;
+ OGGContext *ogg = s->priv_data;
int total_segments = size / 255 + 1;
uint8_t *p = data;
int i, segments, len, flush = 0;
// Handles VFR by flushing page because this frame needs to have a timestamp
- if (st->codec->codec_id == CODEC_ID_THEORA &&
+ if (st->codec->codec_id == AV_CODEC_ID_THEORA && !header &&
ogg_granule_to_timestamp(oggstream, granule) >
ogg_granule_to_timestamp(oggstream, oggstream->last_granule) + 1) {
if (oggstream->page.granule != -1)
@@ -210,8 +232,9 @@ static int ogg_buffer_data(AVFormatContext *s, AVStream *st,
if (i == total_segments)
page->granule = granule;
- if (page->segments_count == 255) {
- ogg_buffer_page(s, oggstream);
+ if (!header && (page->segments_count == 255 ||
+ (ogg->pref_size > 0 && page->size >= ogg->pref_size))) {
+ ogg_buffer_page(s, oggstream);
}
}
@@ -313,6 +336,35 @@ static int ogg_build_speex_headers(AVCodecContext *avctx,
return 0;
}
+#define OPUS_HEADER_SIZE 19
+
+static int ogg_build_opus_headers(AVCodecContext *avctx,
+ OGGStreamContext *oggstream, int bitexact,
+ AVDictionary **m)
+{
+ uint8_t *p;
+
+ if (avctx->extradata_size < OPUS_HEADER_SIZE)
+ return -1;
+
+ /* first packet: Opus header */
+ p = av_mallocz(avctx->extradata_size);
+ if (!p)
+ return AVERROR(ENOMEM);
+ oggstream->header[0] = p;
+ oggstream->header_len[0] = avctx->extradata_size;
+ bytestream_put_buffer(&p, avctx->extradata, avctx->extradata_size);
+
+ /* second packet: VorbisComment */
+ p = ogg_write_vorbiscomment(8, bitexact, &oggstream->header_len[1], m, 0);
+ if (!p)
+ return AVERROR(ENOMEM);
+ oggstream->header[1] = p;
+ bytestream_put_buffer(&p, "OpusTags", 8);
+
+ return 0;
+}
+
static int ogg_write_header(AVFormatContext *s)
{
OGGStreamContext *oggstream;
@@ -323,13 +375,18 @@ static int ogg_write_header(AVFormatContext *s)
unsigned serial_num = i;
if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO)
- avpriv_set_pts_info(st, 64, 1, st->codec->sample_rate);
+ if (st->codec->codec_id == AV_CODEC_ID_OPUS)
+ /* Opus requires a fixed 48kHz clock */
+ avpriv_set_pts_info(st, 64, 1, 48000);
+ else
+ avpriv_set_pts_info(st, 64, 1, st->codec->sample_rate);
else if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO)
avpriv_set_pts_info(st, 64, st->codec->time_base.num, st->codec->time_base.den);
- if (st->codec->codec_id != CODEC_ID_VORBIS &&
- st->codec->codec_id != CODEC_ID_THEORA &&
- st->codec->codec_id != CODEC_ID_SPEEX &&
- st->codec->codec_id != CODEC_ID_FLAC) {
+ if (st->codec->codec_id != AV_CODEC_ID_VORBIS &&
+ st->codec->codec_id != AV_CODEC_ID_THEORA &&
+ st->codec->codec_id != AV_CODEC_ID_SPEEX &&
+ st->codec->codec_id != AV_CODEC_ID_FLAC &&
+ st->codec->codec_id != AV_CODEC_ID_OPUS) {
av_log(s, AV_LOG_ERROR, "Unsupported codec id in stream %d\n", i);
return -1;
}
@@ -353,7 +410,7 @@ static int ogg_write_header(AVFormatContext *s)
oggstream->serial_num = serial_num;
st->priv_data = oggstream;
- if (st->codec->codec_id == CODEC_ID_FLAC) {
+ if (st->codec->codec_id == AV_CODEC_ID_FLAC) {
int err = ogg_build_flac_headers(st->codec, oggstream,
st->codec->flags & CODEC_FLAG_BITEXACT,
&s->metadata);
@@ -362,7 +419,7 @@ static int ogg_write_header(AVFormatContext *s)
av_freep(&st->priv_data);
return err;
}
- } else if (st->codec->codec_id == CODEC_ID_SPEEX) {
+ } else if (st->codec->codec_id == AV_CODEC_ID_SPEEX) {
int err = ogg_build_speex_headers(st->codec, oggstream,
st->codec->flags & CODEC_FLAG_BITEXACT,
&s->metadata);
@@ -371,14 +428,23 @@ static int ogg_write_header(AVFormatContext *s)
av_freep(&st->priv_data);
return err;
}
+ } else if (st->codec->codec_id == AV_CODEC_ID_OPUS) {
+ int err = ogg_build_opus_headers(st->codec, oggstream,
+ st->codec->flags & CODEC_FLAG_BITEXACT,
+ &s->metadata);
+ if (err) {
+ av_log(s, AV_LOG_ERROR, "Error writing Opus headers\n");
+ av_freep(&st->priv_data);
+ return err;
+ }
} else {
uint8_t *p;
- const char *cstr = st->codec->codec_id == CODEC_ID_VORBIS ? "vorbis" : "theora";
- int header_type = st->codec->codec_id == CODEC_ID_VORBIS ? 3 : 0x81;
- int framing_bit = st->codec->codec_id == CODEC_ID_VORBIS ? 1 : 0;
+ const char *cstr = st->codec->codec_id == AV_CODEC_ID_VORBIS ? "vorbis" : "theora";
+ int header_type = st->codec->codec_id == AV_CODEC_ID_VORBIS ? 3 : 0x81;
+ int framing_bit = st->codec->codec_id == AV_CODEC_ID_VORBIS ? 1 : 0;
if (avpriv_split_xiph_headers(st->codec->extradata, st->codec->extradata_size,
- st->codec->codec_id == CODEC_ID_VORBIS ? 30 : 42,
+ st->codec->codec_id == AV_CODEC_ID_VORBIS ? 30 : 42,
oggstream->header, oggstream->header_len) < 0) {
av_log(s, AV_LOG_ERROR, "Extradata corrupted\n");
av_freep(&st->priv_data);
@@ -388,14 +454,14 @@ static int ogg_write_header(AVFormatContext *s)
p = ogg_write_vorbiscomment(7, st->codec->flags & CODEC_FLAG_BITEXACT,
&oggstream->header_len[1], &s->metadata,
framing_bit);
+ oggstream->header[1] = p;
if (!p)
return AVERROR(ENOMEM);
- oggstream->header[1] = p;
bytestream_put_byte(&p, header_type);
bytestream_put_buffer(&p, cstr, 6);
- if (st->codec->codec_id == CODEC_ID_THEORA) {
+ if (st->codec->codec_id == AV_CODEC_ID_THEORA) {
/** KFGSHIFT is the width of the less significant section of the granule position
The less significant section is the frame count since the last keyframe */
oggstream->kfgshift = ((oggstream->header[0][40]&3)<<3)|(oggstream->header[0][41]>>5);
@@ -409,7 +475,7 @@ static int ogg_write_header(AVFormatContext *s)
for (j = 0; j < s->nb_streams; j++) {
OGGStreamContext *oggstream = s->streams[j]->priv_data;
ogg_buffer_data(s, s->streams[j], oggstream->header[0],
- oggstream->header_len[0], 0);
+ oggstream->header_len[0], 0, 1);
oggstream->page.flags |= 2; // bos
ogg_buffer_page(s, oggstream);
}
@@ -419,7 +485,7 @@ static int ogg_write_header(AVFormatContext *s)
for (i = 1; i < 3; i++) {
if (oggstream && oggstream->header_len[i])
ogg_buffer_data(s, st, oggstream->header[i],
- oggstream->header_len[i], 0);
+ oggstream->header_len[i], 0, 1);
}
ogg_buffer_page(s, oggstream);
}
@@ -455,7 +521,7 @@ static int ogg_write_packet(AVFormatContext *s, AVPacket *pkt)
int ret;
int64_t granule;
- if (st->codec->codec_id == CODEC_ID_THEORA) {
+ if (st->codec->codec_id == AV_CODEC_ID_THEORA) {
int64_t pts = oggstream->vrev < 1 ? pkt->pts : pkt->pts + pkt->duration;
int pframe_count;
if (pkt->flags & AV_PKT_FLAG_KEY)
@@ -467,10 +533,12 @@ static int ogg_write_packet(AVFormatContext *s, AVPacket *pkt)
pframe_count = 0;
}
granule = (oggstream->last_kf_pts<<oggstream->kfgshift) | pframe_count;
- } else
+ } else if (st->codec->codec_id == AV_CODEC_ID_OPUS)
+ granule = pkt->pts + pkt->duration + av_rescale_q(st->codec->delay, (AVRational){ 1, st->codec->sample_rate }, st->time_base);
+ else
granule = pkt->pts + pkt->duration;
- ret = ogg_buffer_data(s, st, pkt->data, pkt->size, granule);
+ ret = ogg_buffer_data(s, st, pkt->data, pkt->size, granule, 0);
if (ret < 0)
return ret;
@@ -494,11 +562,12 @@ static int ogg_write_trailer(AVFormatContext *s)
for (i = 0; i < s->nb_streams; i++) {
AVStream *st = s->streams[i];
OGGStreamContext *oggstream = st->priv_data;
- if (st->codec->codec_id == CODEC_ID_FLAC ||
- st->codec->codec_id == CODEC_ID_SPEEX) {
+ if (st->codec->codec_id == AV_CODEC_ID_FLAC ||
+ st->codec->codec_id == AV_CODEC_ID_SPEEX ||
+ st->codec->codec_id == AV_CODEC_ID_OPUS) {
av_free(oggstream->header[0]);
- av_free(oggstream->header[1]);
}
+ av_freep(&oggstream->header[1]);
av_freep(&st->priv_data);
}
return 0;
@@ -508,11 +577,12 @@ AVOutputFormat ff_ogg_muxer = {
.name = "ogg",
.long_name = NULL_IF_CONFIG_SMALL("Ogg"),
.mime_type = "application/ogg",
- .extensions = "ogg,ogv,spx",
+ .extensions = "ogg,ogv,spx,opus",
.priv_data_size = sizeof(OGGContext),
- .audio_codec = CODEC_ID_FLAC,
- .video_codec = CODEC_ID_THEORA,
+ .audio_codec = AV_CODEC_ID_FLAC,
+ .video_codec = AV_CODEC_ID_THEORA,
.write_header = ogg_write_header,
.write_packet = ogg_write_packet,
.write_trailer = ogg_write_trailer,
+ .priv_class = &ogg_muxer_class,
};
diff --git a/gst-libs/ext/libav/libavformat/oggparsecelt.c b/gst-libs/ext/libav/libavformat/oggparsecelt.c
index 5f07de4..0deccc2 100644
--- a/gst-libs/ext/libav/libavformat/oggparsecelt.c
+++ b/gst-libs/ext/libav/libavformat/oggparsecelt.c
@@ -65,7 +65,7 @@ static int celt_header(AVFormatContext *s, int idx)
av_free(os->private);
av_free(st->codec->extradata);
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
- st->codec->codec_id = CODEC_ID_CELT;
+ st->codec->codec_id = AV_CODEC_ID_CELT;
st->codec->sample_rate = sample_rate;
st->codec->channels = nb_channels;
st->codec->frame_size = frame_size;
@@ -93,4 +93,5 @@ const struct ogg_codec ff_celt_codec = {
.magic = "CELT ",
.magicsize = 8,
.header = celt_header,
+ .nb_header = 2,
};
diff --git a/gst-libs/ext/libav/libavformat/oggparsedirac.c b/gst-libs/ext/libav/libavformat/oggparsedirac.c
index 8d3a802..55a0b59 100644
--- a/gst-libs/ext/libav/libavformat/oggparsedirac.c
+++ b/gst-libs/ext/libav/libavformat/oggparsedirac.c
@@ -33,7 +33,7 @@ static int dirac_header(AVFormatContext *s, int idx)
GetBitContext gb;
// already parsed the header
- if (st->codec->codec_id == CODEC_ID_DIRAC)
+ if (st->codec->codec_id == AV_CODEC_ID_DIRAC)
return 0;
init_get_bits(&gb, os->buf + os->pstart + 13, (os->psize - 13) * 8);
@@ -41,7 +41,7 @@ static int dirac_header(AVFormatContext *s, int idx)
return -1;
st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
- st->codec->codec_id = CODEC_ID_DIRAC;
+ st->codec->codec_id = AV_CODEC_ID_DIRAC;
// dirac in ogg always stores timestamps as though the video were interlaced
avpriv_set_pts_info(st, 64, st->codec->time_base.num, 2*st->codec->time_base.den);
return 1;
@@ -79,7 +79,7 @@ static int old_dirac_header(AVFormatContext *s, int idx)
return 0;
st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
- st->codec->codec_id = CODEC_ID_DIRAC;
+ st->codec->codec_id = AV_CODEC_ID_DIRAC;
avpriv_set_pts_info(st, 64, AV_RB32(buf+12), AV_RB32(buf+8));
return 1;
}
@@ -104,6 +104,7 @@ const struct ogg_codec ff_dirac_codec = {
.header = dirac_header,
.gptopts = dirac_gptopts,
.granule_is_start = 1,
+ .nb_header = 1,
};
const struct ogg_codec ff_old_dirac_codec = {
@@ -112,4 +113,5 @@ const struct ogg_codec ff_old_dirac_codec = {
.header = old_dirac_header,
.gptopts = old_dirac_gptopts,
.granule_is_start = 1,
+ .nb_header = 1,
};
diff --git a/gst-libs/ext/libav/libavformat/oggparseflac.c b/gst-libs/ext/libav/libavformat/oggparseflac.c
index b1d18ed..f59b400 100644
--- a/gst-libs/ext/libav/libavformat/oggparseflac.c
+++ b/gst-libs/ext/libav/libavformat/oggparseflac.c
@@ -59,7 +59,8 @@ flac_header (AVFormatContext * s, int idx)
avpriv_flac_parse_streaminfo(st->codec, &si, streaminfo_start);
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
- st->codec->codec_id = CODEC_ID_FLAC;
+ st->codec->codec_id = AV_CODEC_ID_FLAC;
+ st->need_parsing = AVSTREAM_PARSE_HEADERS;
st->codec->extradata =
av_malloc(FLAC_STREAMINFO_SIZE + FF_INPUT_BUFFER_PADDING_SIZE);
@@ -79,7 +80,7 @@ old_flac_header (AVFormatContext * s, int idx)
{
AVStream *st = s->streams[idx];
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
- st->codec->codec_id = CODEC_ID_FLAC;
+ st->codec->codec_id = AV_CODEC_ID_FLAC;
return 0;
}
@@ -87,11 +88,13 @@ old_flac_header (AVFormatContext * s, int idx)
const struct ogg_codec ff_flac_codec = {
.magic = "\177FLAC",
.magicsize = 5,
- .header = flac_header
+ .header = flac_header,
+ .nb_header = 2,
};
const struct ogg_codec ff_old_flac_codec = {
.magic = "fLaC",
.magicsize = 4,
- .header = old_flac_header
+ .header = old_flac_header,
+ .nb_header = 0,
};
diff --git a/gst-libs/ext/libav/libavformat/oggparseogm.c b/gst-libs/ext/libav/libavformat/oggparseogm.c
index 0a8a7c6..7b3cda2 100644
--- a/gst-libs/ext/libav/libavformat/oggparseogm.c
+++ b/gst-libs/ext/libav/libavformat/oggparseogm.c
@@ -56,7 +56,7 @@ ogm_header(AVFormatContext *s, int idx)
st->codec->codec_tag = tag;
} else if (*p == 't') {
st->codec->codec_type = AVMEDIA_TYPE_SUBTITLE;
- st->codec->codec_id = CODEC_ID_TEXT;
+ st->codec->codec_id = AV_CODEC_ID_TEXT;
p += 12;
} else {
uint8_t acid[5];
@@ -80,9 +80,7 @@ ogm_header(AVFormatContext *s, int idx)
if(st->codec->codec_type == AVMEDIA_TYPE_VIDEO){
st->codec->width = bytestream_get_le32(&p);
st->codec->height = bytestream_get_le32(&p);
- st->codec->time_base.den = spu * 10000000;
- st->codec->time_base.num = time_unit;
- avpriv_set_pts_info(st, 64, st->codec->time_base.num, st->codec->time_base.den);
+ avpriv_set_pts_info(st, 64, time_unit, spu * 10000000);
} else {
st->codec->channels = bytestream_get_le16(&p);
p += 2; /* block_align */
@@ -117,8 +115,7 @@ ogm_dshow_header(AVFormatContext *s, int idx)
if(t == 0x05589f80){
st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
st->codec->codec_id = ff_codec_get_id(ff_codec_bmp_tags, AV_RL32(p + 68));
- st->codec->time_base.den = 10000000;
- st->codec->time_base.num = AV_RL64(p + 164);
+ avpriv_set_pts_info(st, 64, AV_RL64(p + 164), 10000000);
st->codec->width = AV_RL32(p + 176);
st->codec->height = AV_RL32(p + 180);
} else if(t == 0x05589f81){
@@ -159,6 +156,7 @@ const struct ogg_codec ff_ogm_video_codec = {
.header = ogm_header,
.packet = ogm_packet,
.granule_is_start = 1,
+ .nb_header = 2,
};
const struct ogg_codec ff_ogm_audio_codec = {
@@ -167,6 +165,7 @@ const struct ogg_codec ff_ogm_audio_codec = {
.header = ogm_header,
.packet = ogm_packet,
.granule_is_start = 1,
+ .nb_header = 2,
};
const struct ogg_codec ff_ogm_text_codec = {
@@ -175,6 +174,7 @@ const struct ogg_codec ff_ogm_text_codec = {
.header = ogm_header,
.packet = ogm_packet,
.granule_is_start = 1,
+ .nb_header = 2,
};
const struct ogg_codec ff_ogm_old_codec = {
@@ -183,4 +183,5 @@ const struct ogg_codec ff_ogm_old_codec = {
.header = ogm_dshow_header,
.packet = ogm_packet,
.granule_is_start = 1,
+ .nb_header = 1,
};
diff --git a/gst-libs/ext/libav/libavformat/oggparseskeleton.c b/gst-libs/ext/libav/libavformat/oggparseskeleton.c
index 62dd14d..2de067d 100644
--- a/gst-libs/ext/libav/libavformat/oggparseskeleton.c
+++ b/gst-libs/ext/libav/libavformat/oggparseskeleton.c
@@ -30,7 +30,8 @@ static int skeleton_header(AVFormatContext *s, int idx)
AVStream *st = s->streams[idx];
uint8_t *buf = os->buf + os->pstart;
int version_major, version_minor;
- int64_t start_num, start_den, start_granule;
+ int64_t start_num, start_den;
+ uint64_t start_granule;
int target_idx, start_time;
strcpy(st->codec->codec_name, "skeleton");
@@ -73,9 +74,13 @@ static int skeleton_header(AVFormatContext *s, int idx)
target_idx = ogg_find_stream(ogg, AV_RL32(buf+12));
start_granule = AV_RL64(buf+36);
- if (target_idx >= 0 && start_granule != -1) {
- ogg->streams[target_idx].lastpts =
- s->streams[target_idx]->start_time = ogg_gptopts(s, target_idx, start_granule, NULL);
+ if (os->start_granule != OGG_NOGRANULE_VALUE) {
+ av_log_missing_feature(s,
+ "Multiple fisbone for the same stream", 0);
+ return 1;
+ }
+ if (target_idx >= 0 && start_granule != OGG_NOGRANULE_VALUE) {
+ os->start_granule = start_granule;
}
}
@@ -86,4 +91,5 @@ const struct ogg_codec ff_skeleton_codec = {
.magic = "fishead",
.magicsize = 8,
.header = skeleton_header,
+ .nb_header = 0,
};
diff --git a/gst-libs/ext/libav/libavformat/oggparsespeex.c b/gst-libs/ext/libav/libavformat/oggparsespeex.c
index 435ed0c..42480a3 100644
--- a/gst-libs/ext/libav/libavformat/oggparsespeex.c
+++ b/gst-libs/ext/libav/libavformat/oggparsespeex.c
@@ -25,6 +25,7 @@
#include <stdlib.h>
#include "libavutil/bswap.h"
#include "libavutil/avstring.h"
+#include "libavutil/channel_layout.h"
#include "libavcodec/get_bits.h"
#include "libavcodec/bytestream.h"
#include "avformat.h"
@@ -55,10 +56,16 @@ static int speex_header(AVFormatContext *s, int idx) {
if (spxp->seq == 0) {
int frames_per_packet;
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
- st->codec->codec_id = CODEC_ID_SPEEX;
+ st->codec->codec_id = AV_CODEC_ID_SPEEX;
st->codec->sample_rate = AV_RL32(p + 36);
st->codec->channels = AV_RL32(p + 48);
+ if (st->codec->channels < 1 || st->codec->channels > 2) {
+ av_log(s, AV_LOG_ERROR, "invalid channel count. Speex must be mono or stereo.\n");
+ return AVERROR_INVALIDDATA;
+ }
+ st->codec->channel_layout = st->codec->channels == 1 ? AV_CH_LAYOUT_MONO :
+ AV_CH_LAYOUT_STEREO;
spxp->packet_size = AV_RL32(p + 56);
frames_per_packet = AV_RL32(p + 64);
@@ -122,5 +129,6 @@ const struct ogg_codec ff_speex_codec = {
.magic = "Speex ",
.magicsize = 8,
.header = speex_header,
- .packet = speex_packet
+ .packet = speex_packet,
+ .nb_header = 2,
};
diff --git a/gst-libs/ext/libav/libavformat/oggparsetheora.c b/gst-libs/ext/libav/libavformat/oggparsetheora.c
index 993db3e..dfb73c9 100644
--- a/gst-libs/ext/libav/libavformat/oggparsetheora.c
+++ b/gst-libs/ext/libav/libavformat/oggparsetheora.c
@@ -53,9 +53,11 @@ theora_header (AVFormatContext * s, int idx)
os->private = thp;
}
- if (os->buf[os->pstart] == 0x80) {
+ switch (os->buf[os->pstart]) {
+ case 0x80: {
GetBitContext gb;
int width, height;
+ AVRational timebase;
init_get_bits(&gb, os->buf + os->pstart, os->psize*8);
@@ -85,14 +87,14 @@ theora_header (AVFormatContext * s, int idx)
skip_bits(&gb, 16);
}
- st->codec->time_base.den = get_bits_long(&gb, 32);
- st->codec->time_base.num = get_bits_long(&gb, 32);
- if (!(st->codec->time_base.num > 0 && st->codec->time_base.den > 0)) {
+ timebase.den = get_bits_long(&gb, 32);
+ timebase.num = get_bits_long(&gb, 32);
+ if (!(timebase.num > 0 && timebase.den > 0)) {
av_log(s, AV_LOG_WARNING, "Invalid time base in theora stream, assuming 25 FPS\n");
- st->codec->time_base.num = 1;
- st->codec->time_base.den = 25;
+ timebase.num = 1;
+ timebase.den = 25;
}
- avpriv_set_pts_info(st, 64, st->codec->time_base.num, st->codec->time_base.den);
+ avpriv_set_pts_info(st, 64, timebase.num, timebase.den);
st->sample_aspect_ratio.num = get_bits_long(&gb, 24);
st->sample_aspect_ratio.den = get_bits_long(&gb, 24);
@@ -106,11 +108,19 @@ theora_header (AVFormatContext * s, int idx)
thp->gpmask = (1 << thp->gpshift) - 1;
st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
- st->codec->codec_id = CODEC_ID_THEORA;
+ st->codec->codec_id = AV_CODEC_ID_THEORA;
st->need_parsing = AVSTREAM_PARSE_HEADERS;
- } else if (os->buf[os->pstart] == 0x83) {
- ff_vorbis_comment (s, &st->metadata, os->buf + os->pstart + 7, os->psize - 8);
+ }
+ break;
+ case 0x81:
+ ff_vorbis_comment(s, &st->metadata, os->buf + os->pstart + 7, os->psize - 8);
+ case 0x82:
+ if (!thp->version)
+ return -1;
+ break;
+ default:
+ return -1;
}
st->codec->extradata = av_realloc (st->codec->extradata,
@@ -130,8 +140,13 @@ theora_gptopts(AVFormatContext *ctx, int idx, uint64_t gp, int64_t *dts)
struct ogg *ogg = ctx->priv_data;
struct ogg_stream *os = ogg->streams + idx;
struct theora_params *thp = os->private;
- uint64_t iframe = gp >> thp->gpshift;
- uint64_t pframe = gp & thp->gpmask;
+ uint64_t iframe, pframe;
+
+ if (!thp)
+ return AV_NOPTS_VALUE;
+
+ iframe = gp >> thp->gpshift;
+ pframe = gp & thp->gpmask;
if (thp->version < 0x030201)
iframe++;
@@ -149,5 +164,6 @@ const struct ogg_codec ff_theora_codec = {
.magic = "\200theora",
.magicsize = 7,
.header = theora_header,
- .gptopts = theora_gptopts
+ .gptopts = theora_gptopts,
+ .nb_header = 3,
};
diff --git a/gst-libs/ext/libav/libavformat/oggparsevorbis.c b/gst-libs/ext/libav/libavformat/oggparsevorbis.c
index 7ec7a9e..bb41b52 100644
--- a/gst-libs/ext/libav/libavformat/oggparsevorbis.c
+++ b/gst-libs/ext/libav/libavformat/oggparsevorbis.c
@@ -28,6 +28,7 @@
#include "libavutil/dict.h"
#include "libavcodec/get_bits.h"
#include "libavcodec/bytestream.h"
+#include "libavcodec/vorbis_parser.h"
#include "avformat.h"
#include "internal.h"
#include "oggdec.h"
@@ -162,6 +163,9 @@ ff_vorbis_comment(AVFormatContext * as, AVDictionary **m, const uint8_t *buf, in
struct oggvorbis_private {
unsigned int len[3];
unsigned char *packet[3];
+ VorbisParseContext vp;
+ int64_t final_pts;
+ int final_duration;
};
@@ -260,7 +264,7 @@ vorbis_header (AVFormatContext * s, int idx)
return -1;
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
- st->codec->codec_id = CODEC_ID_VORBIS;
+ st->codec->codec_id = AV_CODEC_ID_VORBIS;
if (srate > 0) {
st->codec->sample_rate = srate;
@@ -278,17 +282,93 @@ vorbis_header (AVFormatContext * s, int idx)
}
}
} else {
+ int ret;
st->codec->extradata_size =
fixup_vorbis_headers(s, priv, &st->codec->extradata);
+ if ((ret = avpriv_vorbis_parse_extradata(st->codec, &priv->vp))) {
+ av_freep(&st->codec->extradata);
+ st->codec->extradata_size = 0;
+ return ret;
+ }
}
return 1;
}
+static int vorbis_packet(AVFormatContext *s, int idx)
+{
+ struct ogg *ogg = s->priv_data;
+ struct ogg_stream *os = ogg->streams + idx;
+ struct oggvorbis_private *priv = os->private;
+ int duration;
+
+ /* first packet handling
+ here we parse the duration of each packet in the first page and compare
+ the total duration to the page granule to find the encoder delay and
+ set the first timestamp */
+ if (!os->lastpts) {
+ int seg;
+ uint8_t *last_pkt = os->buf + os->pstart;
+ uint8_t *next_pkt = last_pkt;
+ int first_duration = 0;
+
+ avpriv_vorbis_parse_reset(&priv->vp);
+ duration = 0;
+ for (seg = 0; seg < os->nsegs; seg++) {
+ if (os->segments[seg] < 255) {
+ int d = avpriv_vorbis_parse_frame(&priv->vp, last_pkt, 1);
+ if (d < 0) {
+ duration = os->granule;
+ break;
+ }
+ if (!duration)
+ first_duration = d;
+ duration += d;
+ last_pkt = next_pkt + os->segments[seg];
+ }
+ next_pkt += os->segments[seg];
+ }
+ os->lastpts = os->lastdts = os->granule - duration;
+ s->streams[idx]->start_time = os->lastpts + first_duration;
+ if (s->streams[idx]->duration)
+ s->streams[idx]->duration -= s->streams[idx]->start_time;
+ s->streams[idx]->cur_dts = AV_NOPTS_VALUE;
+ priv->final_pts = AV_NOPTS_VALUE;
+ avpriv_vorbis_parse_reset(&priv->vp);
+ }
+
+ /* parse packet duration */
+ if (os->psize > 0) {
+ duration = avpriv_vorbis_parse_frame(&priv->vp, os->buf + os->pstart, 1);
+ if (duration <= 0) {
+ os->pflags |= AV_PKT_FLAG_CORRUPT;
+ return 0;
+ }
+ os->pduration = duration;
+ }
+
+ /* final packet handling
+ here we save the pts of the first packet in the final page, sum up all
+ packet durations in the final page except for the last one, and compare
+ to the page granule to find the duration of the final packet */
+ if (os->flags & OGG_FLAG_EOS) {
+ if (os->lastpts != AV_NOPTS_VALUE) {
+ priv->final_pts = os->lastpts;
+ priv->final_duration = 0;
+ }
+ if (os->segp == os->nsegs)
+ os->pduration = os->granule - priv->final_pts - priv->final_duration;
+ priv->final_duration += os->pduration;
+ }
+
+ return 0;
+}
+
const struct ogg_codec ff_vorbis_codec = {
.magic = "\001vorbis",
.magicsize = 7,
.header = vorbis_header,
+ .packet = vorbis_packet,
.cleanup= vorbis_cleanup,
.nb_header = 3,
};
diff --git a/gst-libs/ext/libav/libavformat/oma.c b/gst-libs/ext/libav/libavformat/oma.c
index be87647..aaaf0b2 100644
--- a/gst-libs/ext/libav/libavformat/oma.c
+++ b/gst-libs/ext/libav/libavformat/oma.c
@@ -25,9 +25,9 @@
const uint16_t ff_oma_srate_tab[8] = { 320, 441, 480, 882, 960, 0 };
const AVCodecTag ff_oma_codec_tags[] = {
- { CODEC_ID_ATRAC3, OMA_CODECID_ATRAC3 },
- { CODEC_ID_ATRAC3P, OMA_CODECID_ATRAC3P },
- { CODEC_ID_MP3, OMA_CODECID_MP3 },
- { CODEC_ID_PCM_S16BE, OMA_CODECID_LPCM },
+ { AV_CODEC_ID_ATRAC3, OMA_CODECID_ATRAC3 },
+ { AV_CODEC_ID_ATRAC3P, OMA_CODECID_ATRAC3P },
+ { AV_CODEC_ID_MP3, OMA_CODECID_MP3 },
+ { AV_CODEC_ID_PCM_S16BE, OMA_CODECID_LPCM },
{ 0 },
};
diff --git a/gst-libs/ext/libav/libavformat/omadec.c b/gst-libs/ext/libav/libavformat/omadec.c
index 48cc432..cd255c1 100644
--- a/gst-libs/ext/libav/libavformat/omadec.c
+++ b/gst-libs/ext/libav/libavformat/omadec.c
@@ -40,13 +40,13 @@
* CODEC SUPPORT: Only ATRAC3 codec is currently supported!
*/
+#include "libavutil/channel_layout.h"
#include "avformat.h"
#include "internal.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/des.h"
#include "oma.h"
#include "pcm.h"
-#include "riff.h"
#include "id3v2.h"
@@ -140,7 +140,7 @@ static int rprobe(AVFormatContext *s, uint8_t *enc_header, const uint8_t *r_val)
return memcmp(&enc_header[pos], oc->sm_val, 8) ? -1 : 0;
}
-static int nprobe(AVFormatContext *s, uint8_t *enc_header, const uint8_t *n_val)
+static int nprobe(AVFormatContext *s, uint8_t *enc_header, int size, const uint8_t *n_val)
{
OMAContext *oc = s->priv_data;
uint32_t pos, taglen, datalen;
@@ -159,6 +159,9 @@ static int nprobe(AVFormatContext *s, uint8_t *enc_header, const uint8_t *n_val)
taglen = AV_RB32(&enc_header[pos+32]);
datalen = AV_RB32(&enc_header[pos+36]) >> 4;
+ if(taglen + (((uint64_t)datalen)<<4) + 44 > size)
+ return -1;
+
pos += 44 + taglen;
av_des_init(&av_des, n_val, 192, 1);
@@ -229,14 +232,14 @@ static int decrypt_init(AVFormatContext *s, ID3v2ExtraMeta *em, uint8_t *header)
}
if (!memcmp(oc->r_val, (const uint8_t[8]){0}, 8) ||
rprobe(s, gdata, oc->r_val) < 0 &&
- nprobe(s, gdata, oc->n_val) < 0) {
+ nprobe(s, gdata, geob->datasize, oc->n_val) < 0) {
int i;
for (i = 0; i < FF_ARRAY_ELEMS(leaf_table); i += 2) {
uint8_t buf[16];
AV_WL64(buf, leaf_table[i]);
AV_WL64(&buf[8], leaf_table[i+1]);
kset(s, buf, buf, 16);
- if (!rprobe(s, gdata, oc->r_val) || !nprobe(s, gdata, oc->n_val))
+ if (!rprobe(s, gdata, oc->r_val) || !nprobe(s, gdata, geob->datasize, oc->n_val))
break;
}
if (i >= sizeof(leaf_table)) {
@@ -256,8 +259,7 @@ static int decrypt_init(AVFormatContext *s, ID3v2ExtraMeta *em, uint8_t *header)
return 0;
}
-static int oma_read_header(AVFormatContext *s,
- AVFormatParameters *ap)
+static int oma_read_header(AVFormatContext *s)
{
int ret, framesize, jsflag, samplerate;
uint32_t codec_params;
@@ -268,7 +270,7 @@ static int oma_read_header(AVFormatContext *s,
ID3v2ExtraMeta *extra_meta = NULL;
OMAContext *oc = s->priv_data;
- ff_id3v2_read_all(s, ID3v2_EA3_MAGIC, &extra_meta);
+ ff_id3v2_read(s, ID3v2_EA3_MAGIC, &extra_meta);
ret = avio_read(s->pb, buf, EA3_HEADER_SIZE);
if (ret < EA3_HEADER_SIZE)
return -1;
@@ -314,6 +316,7 @@ static int oma_read_header(AVFormatContext *s,
framesize = (codec_params & 0x3FF) * 8;
jsflag = (codec_params >> 17) & 1; /* get stereo coding mode, 1 for joint-stereo */
st->codec->channels = 2;
+ st->codec->channel_layout = AV_CH_LAYOUT_STEREO;
st->codec->sample_rate = samplerate;
st->codec->bit_rate = st->codec->sample_rate * framesize * 8 / 1024;
@@ -353,6 +356,7 @@ static int oma_read_header(AVFormatContext *s,
case OMA_CODECID_LPCM:
/* PCM 44.1 kHz 16 bit stereo big-endian */
st->codec->channels = 2;
+ st->codec->channel_layout = AV_CH_LAYOUT_STEREO;
st->codec->sample_rate = 44100;
framesize = 1024;
/* bit rate = sample rate x PCM block align (= 4) x 8 */
@@ -377,8 +381,10 @@ static int oma_read_packet(AVFormatContext *s, AVPacket *pkt)
int packet_size = s->streams[0]->codec->block_align;
int ret = av_get_packet(s->pb, pkt, packet_size);
- if (ret <= 0)
- return AVERROR(EIO);
+ if (ret < 0)
+ return ret;
+ if (!ret)
+ return AVERROR_EOF;
pkt->stream_index = 0;
@@ -422,7 +428,7 @@ static int oma_read_seek(struct AVFormatContext *s, int stream_index, int64_t ti
{
OMAContext *oc = s->priv_data;
- pcm_read_seek(s, stream_index, timestamp, flags);
+ ff_pcm_read_seek(s, stream_index, timestamp, flags);
if (oc->encrypted) {
/* readjust IV for CBC */
@@ -452,4 +458,3 @@ AVInputFormat ff_oma_demuxer = {
.extensions = "oma,omg,aa3",
.codec_tag = (const AVCodecTag* const []){ff_oma_codec_tags, 0},
};
-
diff --git a/gst-libs/ext/libav/libavformat/omaenc.c b/gst-libs/ext/libav/libavformat/omaenc.c
index e932b4b..ea28e10 100644
--- a/gst-libs/ext/libav/libavformat/omaenc.c
+++ b/gst-libs/ext/libav/libavformat/omaenc.c
@@ -49,7 +49,7 @@ static av_cold int oma_write_header(AVFormatContext *s)
}
/* Metadata; OpenMG does not support ID3v2.4 */
- ff_id3v2_write(s, 3, ID3v2_EA3_MAGIC);
+ ff_id3v2_write_simple(s, 3, ID3v2_EA3_MAGIC);
ffio_wfourcc(s->pb, "EA3\0");
avio_w8(s->pb, EA3_HEADER_SIZE >> 7);
@@ -98,7 +98,7 @@ AVOutputFormat ff_oma_muxer = {
.long_name = NULL_IF_CONFIG_SMALL("Sony OpenMG audio"),
.mime_type = "audio/x-oma",
.extensions = "oma",
- .audio_codec = CODEC_ID_ATRAC3,
+ .audio_codec = AV_CODEC_ID_ATRAC3,
.write_header = oma_write_header,
.write_packet = ff_raw_write_packet,
.codec_tag = (const AVCodecTag* const []){ff_oma_codec_tags, 0},
diff --git a/gst-libs/ext/libav/libavformat/options.c b/gst-libs/ext/libav/libavformat/options.c
index 7c75bf4..3399dd4 100644
--- a/gst-libs/ext/libav/libavformat/options.c
+++ b/gst-libs/ext/libav/libavformat/options.c
@@ -26,6 +26,8 @@
* Options definition for AVFormatContext.
*/
+#include "options_table.h"
+
static const char* format_to_name(void* ptr)
{
AVFormatContext* fc = (AVFormatContext*) ptr;
@@ -41,10 +43,8 @@ static void *format_child_next(void *obj, void *prev)
((s->iformat && s->iformat->priv_class) ||
s->oformat && s->oformat->priv_class))
return s->priv_data;
-#if !FF_API_OLD_AVIO
if (s->pb && s->pb->av_class && prev != s->pb)
return s->pb;
-#endif
return NULL;
}
@@ -54,11 +54,7 @@ static const AVClass *format_child_class_next(const AVClass *prev)
AVOutputFormat *ofmt = NULL;
if (!prev)
-#if !FF_API_OLD_AVIO
return &ffio_url_class;
-#else
- prev = (void *)&ifmt; // Dummy pointer;
-#endif
while ((ifmt = av_iformat_next(ifmt)))
if (ifmt->priv_class == prev)
@@ -80,51 +76,6 @@ static const AVClass *format_child_class_next(const AVClass *prev)
return NULL;
}
-#define OFFSET(x) offsetof(AVFormatContext,x)
-#define DEFAULT 0 //should be NAN but it does not work as it is not a constant in glibc as required by ANSI/ISO C
-//these names are too long to be readable
-#define E AV_OPT_FLAG_ENCODING_PARAM
-#define D AV_OPT_FLAG_DECODING_PARAM
-
-static const AVOption options[]={
-{"probesize", "set probing size", OFFSET(probesize), AV_OPT_TYPE_INT, {.dbl = 5000000 }, 32, INT_MAX, D},
-#if FF_API_MUXRATE
-{"muxrate", "set mux rate", OFFSET(mux_rate), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, 0, INT_MAX, E},
-#endif
-{"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, AV_OPT_TYPE_CONST, {.dbl = AVFMT_FLAG_RTP_HINT }, INT_MIN, INT_MAX, E, "fflags"},
-#endif
-{"discardcorrupt", "discard corrupted frames", 0, AV_OPT_TYPE_CONST, {.dbl = AVFMT_FLAG_DISCARD_CORRUPT }, INT_MIN, INT_MAX, D, "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},
-{"fpsprobesize", "number of frames used to probe fps", OFFSET(fps_probe_size), AV_OPT_TYPE_INT, {.dbl = -1}, -1, INT_MAX-1, D},
-/* this is a crutch for avconv, since it cannot deal with identically named options in different contexts.
- * to be removed when avconv is fixed */
-{"f_err_detect", "set error detection flags (deprecated; use err_detect, save via avconv)", OFFSET(error_recognition), AV_OPT_TYPE_FLAGS, {.dbl = AV_EF_CRCCHECK }, INT_MIN, INT_MAX, D, "err_detect"},
-{"err_detect", "set error detection flags", OFFSET(error_recognition), AV_OPT_TYPE_FLAGS, {.dbl = AV_EF_CRCCHECK }, INT_MIN, INT_MAX, D, "err_detect"},
-{"crccheck", "verify embedded CRCs", 0, AV_OPT_TYPE_CONST, {.dbl = AV_EF_CRCCHECK }, INT_MIN, INT_MAX, D, "err_detect"},
-{"bitstream", "detect bitstream specification deviations", 0, AV_OPT_TYPE_CONST, {.dbl = AV_EF_BITSTREAM }, INT_MIN, INT_MAX, D, "err_detect"},
-{"buffer", "detect improper bitstream length", 0, AV_OPT_TYPE_CONST, {.dbl = AV_EF_BUFFER }, INT_MIN, INT_MAX, D, "err_detect"},
-{"explode", "abort decoding on minor error detection", 0, AV_OPT_TYPE_CONST, {.dbl = AV_EF_EXPLODE }, INT_MIN, INT_MAX, D, "err_detect"},
-{NULL},
-};
-
-#undef E
-#undef D
-#undef DEFAULT
-
static const AVClass av_format_context_class = {
.class_name = "AVFormatContext",
.item_name = format_to_name,
diff --git a/gst-libs/ext/libav/libavformat/options_table.h b/gst-libs/ext/libav/libavformat/options_table.h
new file mode 100644
index 0000000..d1e2a0c
--- /dev/null
+++ b/gst-libs/ext/libav/libavformat/options_table.h
@@ -0,0 +1,68 @@
+/*
+ * 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
+ */
+
+#ifndef AVFORMAT_OPTIONS_TABLE_H
+#define AVFORMAT_OPTIONS_TABLE_H
+
+#include <limits.h>
+
+#include "libavutil/opt.h"
+#include "avformat.h"
+
+#define OFFSET(x) offsetof(AVFormatContext,x)
+#define DEFAULT 0 //should be NAN but it does not work as it is not a constant in glibc as required by ANSI/ISO C
+//these names are too long to be readable
+#define E AV_OPT_FLAG_ENCODING_PARAM
+#define D AV_OPT_FLAG_DECODING_PARAM
+
+static const AVOption options[]={
+{"probesize", "set probing size", OFFSET(probesize), AV_OPT_TYPE_INT, {.i64 = 5000000 }, 32, INT_MAX, D},
+{"packetsize", "set packet size", OFFSET(packet_size), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, 0, INT_MAX, E},
+{"fflags", NULL, OFFSET(flags), AV_OPT_TYPE_FLAGS, {.i64 = DEFAULT }, INT_MIN, INT_MAX, D|E, "fflags"},
+{"ignidx", "ignore index", 0, AV_OPT_TYPE_CONST, {.i64 = AVFMT_FLAG_IGNIDX }, INT_MIN, INT_MAX, D, "fflags"},
+{"genpts", "generate pts", 0, AV_OPT_TYPE_CONST, {.i64 = 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, {.i64 = AVFMT_FLAG_NOFILLIN }, INT_MIN, INT_MAX, D, "fflags"},
+{"noparse", "disable AVParsers, this needs nofillin too", 0, AV_OPT_TYPE_CONST, {.i64 = AVFMT_FLAG_NOPARSE }, INT_MIN, INT_MAX, D, "fflags"},
+{"igndts", "ignore dts", 0, AV_OPT_TYPE_CONST, {.i64 = AVFMT_FLAG_IGNDTS }, INT_MIN, INT_MAX, D, "fflags"},
+{"discardcorrupt", "discard corrupted frames", 0, AV_OPT_TYPE_CONST, {.i64 = AVFMT_FLAG_DISCARD_CORRUPT }, INT_MIN, INT_MAX, D, "fflags"},
+{"nobuffer", "reduce the latency introduced by optional buffering", 0, AV_OPT_TYPE_CONST, {.i64 = AVFMT_FLAG_NOBUFFER }, 0, INT_MAX, D, "fflags"},
+{"analyzeduration", "how many microseconds are analyzed to estimate duration", OFFSET(max_analyze_duration), AV_OPT_TYPE_INT, {.i64 = 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, {.i64 = 1<<20 }, 0, INT_MAX, D},
+{"rtbufsize", "max memory used for buffering real-time frames", OFFSET(max_picture_buffer), AV_OPT_TYPE_INT, {.i64 = 3041280 }, 0, INT_MAX, D}, /* defaults to 1s of 15fps 352x288 YUYV422 video */
+{"fdebug", "print specific debug info", OFFSET(debug), AV_OPT_TYPE_FLAGS, {.i64 = DEFAULT }, 0, INT_MAX, E|D, "fdebug"},
+{"ts", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = 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, {.i64 = -1 }, -1, INT_MAX, E|D},
+{"fpsprobesize", "number of frames used to probe fps", OFFSET(fps_probe_size), AV_OPT_TYPE_INT, {.i64 = -1}, -1, INT_MAX-1, D},
+/* this is a crutch for avconv, since it cannot deal with identically named options in different contexts.
+ * to be removed when avconv is fixed */
+{"f_err_detect", "set error detection flags (deprecated; use err_detect, save via avconv)", OFFSET(error_recognition), AV_OPT_TYPE_FLAGS, {.i64 = AV_EF_CRCCHECK }, INT_MIN, INT_MAX, D, "err_detect"},
+{"err_detect", "set error detection flags", OFFSET(error_recognition), AV_OPT_TYPE_FLAGS, {.i64 = AV_EF_CRCCHECK }, INT_MIN, INT_MAX, D, "err_detect"},
+{"crccheck", "verify embedded CRCs", 0, AV_OPT_TYPE_CONST, {.i64 = AV_EF_CRCCHECK }, INT_MIN, INT_MAX, D, "err_detect"},
+{"bitstream", "detect bitstream specification deviations", 0, AV_OPT_TYPE_CONST, {.i64 = AV_EF_BITSTREAM }, INT_MIN, INT_MAX, D, "err_detect"},
+{"buffer", "detect improper bitstream length", 0, AV_OPT_TYPE_CONST, {.i64 = AV_EF_BUFFER }, INT_MIN, INT_MAX, D, "err_detect"},
+{"explode", "abort decoding on minor error detection", 0, AV_OPT_TYPE_CONST, {.i64 = AV_EF_EXPLODE }, INT_MIN, INT_MAX, D, "err_detect"},
+{NULL},
+};
+
+#undef E
+#undef D
+#undef DEFAULT
+#undef OFFSET
+
+#endif /* AVFORMAT_OPTIONS_TABLE_H */
diff --git a/gst-libs/ext/libav/libavformat/os_support.c b/gst-libs/ext/libav/libavformat/os_support.c
index 889a005..451801f 100644
--- a/gst-libs/ext/libav/libavformat/os_support.c
+++ b/gst-libs/ext/libav/libavformat/os_support.c
@@ -28,9 +28,11 @@
#include "os_support.h"
#if defined(_WIN32) && !defined(__MINGW32CE__)
+#undef open
+#include <fcntl.h>
+#include <io.h>
#include <windows.h>
-#undef open
int ff_win32_open(const char *filename_utf8, int oflag, int pmode)
{
int fd;
@@ -57,9 +59,10 @@ int ff_win32_open(const char *filename_utf8, int oflag, int pmode)
#if CONFIG_NETWORK
#include <fcntl.h>
-#include <unistd.h>
#if !HAVE_POLL_H
+#if HAVE_SYS_TIME_H
#include <sys/time.h>
+#endif
#if HAVE_WINSOCK2_H
#include <winsock2.h>
#elif HAVE_SYS_SELECT_H
@@ -72,21 +75,22 @@ int ff_win32_open(const char *filename_utf8, int oflag, int pmode)
#if !HAVE_INET_ATON
#include <stdlib.h>
-int ff_inet_aton (const char * str, struct in_addr * add)
+int ff_inet_aton(const char *str, struct in_addr *add)
{
unsigned int add1 = 0, add2 = 0, add3 = 0, add4 = 0;
if (sscanf(str, "%d.%d.%d.%d", &add1, &add2, &add3, &add4) != 4)
return 0;
- if (!add1 || (add1|add2|add3|add4) > 255) return 0;
+ if (!add1 || (add1 | add2 | add3 | add4) > 255)
+ return 0;
add->s_addr = htonl((add1 << 24) + (add2 << 16) + (add3 << 8) + add4);
return 1;
}
#else
-int ff_inet_aton (const char * str, struct in_addr * add)
+int ff_inet_aton(const char *str, struct in_addr *add)
{
return inet_aton(str, add);
}
@@ -94,7 +98,7 @@ int ff_inet_aton (const char * str, struct in_addr * add)
#if !HAVE_GETADDRINFO
int ff_getaddrinfo(const char *node, const char *service,
- const struct addrinfo *hints, struct addrinfo **res)
+ const struct addrinfo *hints, struct addrinfo **res)
{
struct hostent *h = NULL;
struct addrinfo *ai;
@@ -111,7 +115,7 @@ int ff_getaddrinfo(const char *node, const char *service,
#endif
*res = NULL;
- sin = av_mallocz(sizeof(struct sockaddr_in));
+ sin = av_mallocz(sizeof(struct sockaddr_in));
if (!sin)
return EAI_FAIL;
sin->sin_family = AF_INET;
@@ -130,9 +134,9 @@ int ff_getaddrinfo(const char *node, const char *service,
memcpy(&sin->sin_addr, h->h_addr_list[0], sizeof(struct in_addr));
}
} else {
- if (hints && (hints->ai_flags & AI_PASSIVE)) {
+ if (hints && (hints->ai_flags & AI_PASSIVE))
sin->sin_addr.s_addr = INADDR_ANY;
- } else
+ else
sin->sin_addr.s_addr = INADDR_LOOPBACK;
}
@@ -147,16 +151,22 @@ int ff_getaddrinfo(const char *node, const char *service,
return EAI_FAIL;
}
- *res = ai;
- ai->ai_family = AF_INET;
+ *res = ai;
+ ai->ai_family = AF_INET;
ai->ai_socktype = hints ? hints->ai_socktype : 0;
switch (ai->ai_socktype) {
- case SOCK_STREAM: ai->ai_protocol = IPPROTO_TCP; break;
- case SOCK_DGRAM: ai->ai_protocol = IPPROTO_UDP; break;
- default: ai->ai_protocol = 0; break;
+ case SOCK_STREAM:
+ ai->ai_protocol = IPPROTO_TCP;
+ break;
+ case SOCK_DGRAM:
+ ai->ai_protocol = IPPROTO_UDP;
+ break;
+ default:
+ ai->ai_protocol = 0;
+ break;
}
- ai->ai_addr = (struct sockaddr *)sin;
+ ai->ai_addr = (struct sockaddr *)sin;
ai->ai_addrlen = sizeof(struct sockaddr_in);
if (hints && (hints->ai_flags & AI_CANONNAME))
ai->ai_canonname = h ? av_strdup(h->h_name) : NULL;
@@ -219,50 +229,73 @@ int ff_getnameinfo(const struct sockaddr *sa, int salen,
a = ntohl(sin->sin_addr.s_addr);
snprintf(host, hostlen, "%d.%d.%d.%d",
((a >> 24) & 0xff), ((a >> 16) & 0xff),
- ((a >> 8) & 0xff), ( a & 0xff));
+ ((a >> 8) & 0xff), (a & 0xff));
}
}
if (serv && servlen > 0) {
struct servent *ent = NULL;
+#if HAVE_GETSERVBYPORT
if (!(flags & NI_NUMERICSERV))
ent = getservbyport(sin->sin_port, flags & NI_DGRAM ? "udp" : "tcp");
+#endif
- if (ent) {
+ if (ent)
snprintf(serv, servlen, "%s", ent->s_name);
- } else
+ else
snprintf(serv, servlen, "%d", ntohs(sin->sin_port));
}
return 0;
}
+#endif /* !HAVE_GETADDRINFO */
+#if !HAVE_GETADDRINFO || HAVE_WINSOCK2_H
const char *ff_gai_strerror(int ecode)
{
- switch(ecode) {
- case EAI_FAIL : return "A non-recoverable error occurred";
- case EAI_FAMILY : return "The address family was not recognized or the address length was invalid for the specified family";
- case EAI_NONAME : return "The name does not resolve for the supplied parameters";
+ switch (ecode) {
+ case EAI_AGAIN:
+ return "Temporary failure in name resolution";
+ case EAI_BADFLAGS:
+ return "Invalid flags for ai_flags";
+ case EAI_FAIL:
+ return "A non-recoverable error occurred";
+ case EAI_FAMILY:
+ return "The address family was not recognized or the address "
+ "length was invalid for the specified family";
+ case EAI_MEMORY:
+ return "Memory allocation failure";
+#if EAI_NODATA != EAI_NONAME
+ case EAI_NODATA:
+ return "No address associated with hostname";
+#endif
+ case EAI_NONAME:
+ return "The name does not resolve for the supplied parameters";
+ case EAI_SERVICE:
+ return "servname not supported for ai_socktype";
+ case EAI_SOCKTYPE:
+ return "ai_socktype not supported";
}
return "Unknown error";
}
-#endif
+#endif /* !HAVE_GETADDRINFO || HAVE_WINSOCK2_H */
int ff_socket_nonblock(int socket, int enable)
{
#if HAVE_WINSOCK2_H
- return ioctlsocket(socket, FIONBIO, &enable);
+ u_long param = enable;
+ return ioctlsocket(socket, FIONBIO, &param);
#else
- if (enable)
- return fcntl(socket, F_SETFL, fcntl(socket, F_GETFL) | O_NONBLOCK);
- else
- return fcntl(socket, F_SETFL, fcntl(socket, F_GETFL) & ~O_NONBLOCK);
+ if (enable)
+ return fcntl(socket, F_SETFL, fcntl(socket, F_GETFL) | O_NONBLOCK);
+ else
+ return fcntl(socket, F_SETFL, fcntl(socket, F_GETFL) & ~O_NONBLOCK);
#endif
}
#if !HAVE_POLL_H
-int poll(struct pollfd *fds, nfds_t numfds, int timeout)
+int ff_poll(struct pollfd *fds, nfds_t numfds, int timeout)
{
fd_set read_set;
fd_set write_set;
@@ -282,8 +315,8 @@ int poll(struct pollfd *fds, nfds_t numfds, int timeout)
FD_ZERO(&write_set);
FD_ZERO(&exception_set);
- n = -1;
- for(i = 0; i < numfds; i++) {
+ n = 0;
+ for (i = 0; i < numfds; i++) {
if (fds[i].fd < 0)
continue;
#if !HAVE_WINSOCK2_H
@@ -293,38 +326,43 @@ int poll(struct pollfd *fds, nfds_t numfds, int timeout)
}
#endif
- if (fds[i].events & POLLIN) FD_SET(fds[i].fd, &read_set);
- if (fds[i].events & POLLOUT) FD_SET(fds[i].fd, &write_set);
- if (fds[i].events & POLLERR) FD_SET(fds[i].fd, &exception_set);
+ if (fds[i].events & POLLIN)
+ FD_SET(fds[i].fd, &read_set);
+ if (fds[i].events & POLLOUT)
+ FD_SET(fds[i].fd, &write_set);
+ if (fds[i].events & POLLERR)
+ FD_SET(fds[i].fd, &exception_set);
- if (fds[i].fd > n)
- n = fds[i].fd;
- };
+ if (fds[i].fd >= n)
+ n = fds[i].fd + 1;
+ }
- if (n == -1)
+ if (n == 0)
/* Hey!? Nothing to poll, in fact!!! */
return 0;
- if (timeout < 0)
- rc = select(n+1, &read_set, &write_set, &exception_set, NULL);
- else {
- struct timeval tv;
-
- tv.tv_sec = timeout / 1000;
+ if (timeout < 0) {
+ rc = select(n, &read_set, &write_set, &exception_set, NULL);
+ } else {
+ struct timeval tv;
+ tv.tv_sec = timeout / 1000;
tv.tv_usec = 1000 * (timeout % 1000);
- rc = select(n+1, &read_set, &write_set, &exception_set, &tv);
- };
+ rc = select(n, &read_set, &write_set, &exception_set, &tv);
+ }
if (rc < 0)
return rc;
- for(i = 0; i < numfds; i++) {
+ for (i = 0; i < numfds; i++) {
fds[i].revents = 0;
- if (FD_ISSET(fds[i].fd, &read_set)) fds[i].revents |= POLLIN;
- if (FD_ISSET(fds[i].fd, &write_set)) fds[i].revents |= POLLOUT;
- if (FD_ISSET(fds[i].fd, &exception_set)) fds[i].revents |= POLLERR;
- };
+ if (FD_ISSET(fds[i].fd, &read_set))
+ fds[i].revents |= POLLIN;
+ if (FD_ISSET(fds[i].fd, &write_set))
+ fds[i].revents |= POLLOUT;
+ if (FD_ISSET(fds[i].fd, &exception_set))
+ fds[i].revents |= POLLERR;
+ }
return rc;
}
diff --git a/gst-libs/ext/libav/libavformat/os_support.h b/gst-libs/ext/libav/libavformat/os_support.h
index 20c6d73..c5d3ab4 100644
--- a/gst-libs/ext/libav/libavformat/os_support.h
+++ b/gst-libs/ext/libav/libavformat/os_support.h
@@ -29,6 +29,8 @@
#include "config.h"
+#include <sys/stat.h>
+
#if defined(__MINGW32__) && !defined(__MINGW32CE__)
# include <fcntl.h>
# define lseek(f,p,w) _lseeki64((f), (p), (w))
@@ -36,6 +38,17 @@
# define fstat(f,s) _fstati64((f), (s))
#endif /* defined(__MINGW32__) && !defined(__MINGW32CE__) */
+#ifdef _WIN32
+#if HAVE_DIRECT_H
+#include <direct.h>
+#elif HAVE_IO_H
+#include <io.h>
+#endif
+#define mkdir(a, b) _mkdir(a)
+#else
+#include <sys/stat.h>
+#endif
+
static inline int is_dos_path(const char *path)
{
#if HAVE_DOS_PATHS
@@ -45,6 +58,25 @@ static inline int is_dos_path(const char *path)
return 0;
}
+#if defined(__OS2__) || defined(__Plan9__)
+#define SHUT_RD 0
+#define SHUT_WR 1
+#define SHUT_RDWR 2
+#endif
+
+#if defined(_WIN32)
+#define SHUT_RD SD_RECEIVE
+#define SHUT_WR SD_SEND
+#define SHUT_RDWR SD_BOTH
+
+#ifndef S_IRUSR
+#define S_IRUSR S_IREAD
+#endif
+#ifndef S_IWUSR
+#define S_IWUSR S_IWRITE
+#endif
+#endif
+
#if defined(_WIN32) && !defined(__MINGW32CE__)
int ff_win32_open(const char *filename, int oflag, int pmode);
#define open ff_win32_open
@@ -63,6 +95,10 @@ typedef int socklen_t;
#if !HAVE_POLL_H
typedef unsigned long nfds_t;
+#if HAVE_WINSOCK2_H
+#include <winsock2.h>
+#endif
+#if !HAVE_STRUCT_POLLFD
struct pollfd {
int fd;
short events; /* events to look for */
@@ -82,9 +118,11 @@ struct pollfd {
#define POLLERR 0x0004 /* errors pending */
#define POLLHUP 0x0080 /* disconnected */
#define POLLNVAL 0x1000 /* invalid file descriptor */
+#endif
-int poll(struct pollfd *fds, nfds_t numfds, int timeout);
+int ff_poll(struct pollfd *fds, nfds_t numfds, int timeout);
+#define poll ff_poll
#endif /* HAVE_POLL_H */
#endif /* CONFIG_NETWORK */
diff --git a/gst-libs/ext/libav/libavformat/output-example.c b/gst-libs/ext/libav/libavformat/output-example.c
index a1702cd..2f83990 100644
--- a/gst-libs/ext/libav/libavformat/output-example.c
+++ b/gst-libs/ext/libav/libavformat/output-example.c
@@ -38,13 +38,11 @@
#include "libavformat/avformat.h"
#include "libswscale/swscale.h"
-#undef exit
-
/* 5 seconds stream duration */
#define STREAM_DURATION 5.0
#define STREAM_FRAME_RATE 25 /* 25 images/s */
#define STREAM_NB_FRAMES ((int)(STREAM_DURATION * STREAM_FRAME_RATE))
-#define STREAM_PIX_FMT PIX_FMT_YUV420P /* default pix_fmt */
+#define STREAM_PIX_FMT AV_PIX_FMT_YUV420P /* default pix_fmt */
static int sws_flags = SWS_BICUBIC;
@@ -53,36 +51,40 @@ static int sws_flags = SWS_BICUBIC;
static float t, tincr, tincr2;
static int16_t *samples;
-static uint8_t *audio_outbuf;
-static int audio_outbuf_size;
static int audio_input_frame_size;
/*
* add an audio output stream
*/
-static AVStream *add_audio_stream(AVFormatContext *oc, enum CodecID codec_id)
+static AVStream *add_audio_stream(AVFormatContext *oc, enum AVCodecID codec_id)
{
AVCodecContext *c;
AVStream *st;
+ AVCodec *codec;
- st = av_new_stream(oc, 1);
+ /* find the audio encoder */
+ codec = avcodec_find_encoder(codec_id);
+ if (!codec) {
+ fprintf(stderr, "codec not found\n");
+ exit(1);
+ }
+
+ st = avformat_new_stream(oc, codec);
if (!st) {
fprintf(stderr, "Could not alloc stream\n");
exit(1);
}
c = st->codec;
- c->codec_id = codec_id;
- c->codec_type = AVMEDIA_TYPE_AUDIO;
/* put sample parameters */
- c->sample_fmt = AV_SAMPLE_FMT_S16;
- c->bit_rate = 64000;
+ c->sample_fmt = AV_SAMPLE_FMT_S16;
+ c->bit_rate = 64000;
c->sample_rate = 44100;
- c->channels = 2;
+ c->channels = 2;
// some formats want stream headers to be separate
- if(oc->oformat->flags & AVFMT_GLOBALHEADER)
+ if (oc->oformat->flags & AVFMT_GLOBALHEADER)
c->flags |= CODEC_FLAG_GLOBAL_HEADER;
return st;
@@ -91,65 +93,43 @@ static AVStream *add_audio_stream(AVFormatContext *oc, enum CodecID codec_id)
static void open_audio(AVFormatContext *oc, AVStream *st)
{
AVCodecContext *c;
- AVCodec *codec;
c = st->codec;
- /* find the audio encoder */
- codec = avcodec_find_encoder(c->codec_id);
- if (!codec) {
- fprintf(stderr, "codec not found\n");
- exit(1);
- }
-
/* open it */
- if (avcodec_open(c, codec) < 0) {
+ if (avcodec_open2(c, NULL, NULL) < 0) {
fprintf(stderr, "could not open codec\n");
exit(1);
}
/* init signal generator */
- t = 0;
+ t = 0;
tincr = 2 * M_PI * 110.0 / c->sample_rate;
/* increment frequency by 110 Hz per second */
tincr2 = 2 * M_PI * 110.0 / c->sample_rate / c->sample_rate;
- audio_outbuf_size = 10000;
- audio_outbuf = av_malloc(audio_outbuf_size);
-
- /* ugly hack for PCM codecs (will be removed ASAP with new PCM
- support to compute the input frame size in samples */
- if (c->frame_size <= 1) {
- audio_input_frame_size = audio_outbuf_size / c->channels;
- switch(st->codec->codec_id) {
- case CODEC_ID_PCM_S16LE:
- case CODEC_ID_PCM_S16BE:
- case CODEC_ID_PCM_U16LE:
- case CODEC_ID_PCM_U16BE:
- audio_input_frame_size >>= 1;
- break;
- default:
- break;
- }
- } else {
+ if (c->codec->capabilities & CODEC_CAP_VARIABLE_FRAME_SIZE)
+ audio_input_frame_size = 10000;
+ else
audio_input_frame_size = c->frame_size;
- }
- samples = av_malloc(audio_input_frame_size * 2 * c->channels);
+ samples = av_malloc(audio_input_frame_size *
+ av_get_bytes_per_sample(c->sample_fmt) *
+ c->channels);
}
-/* prepare a 16 bit dummy audio frame of 'frame_size' samples and
- 'nb_channels' channels */
+/* Prepare a 16 bit dummy audio frame of 'frame_size' samples and
+ * 'nb_channels' channels. */
static void get_audio_frame(int16_t *samples, int frame_size, int nb_channels)
{
int j, i, v;
int16_t *q;
q = samples;
- for(j=0;j<frame_size;j++) {
+ for (j = 0; j < frame_size; j++) {
v = (int)(sin(t) * 10000);
- for(i = 0; i < nb_channels; i++)
+ for (i = 0; i < nb_channels; i++)
*q++ = v;
- t += tincr;
+ t += tincr;
tincr += tincr2;
}
}
@@ -157,26 +137,33 @@ static void get_audio_frame(int16_t *samples, int frame_size, int nb_channels)
static void write_audio_frame(AVFormatContext *oc, AVStream *st)
{
AVCodecContext *c;
- AVPacket pkt;
- av_init_packet(&pkt);
+ AVPacket pkt = { 0 }; // data and size must be 0;
+ AVFrame *frame = avcodec_alloc_frame();
+ int got_packet;
+ av_init_packet(&pkt);
c = st->codec;
get_audio_frame(samples, audio_input_frame_size, c->channels);
+ frame->nb_samples = audio_input_frame_size;
+ avcodec_fill_audio_frame(frame, c->channels, c->sample_fmt,
+ (uint8_t *)samples,
+ audio_input_frame_size *
+ av_get_bytes_per_sample(c->sample_fmt) *
+ c->channels, 1);
- pkt.size= avcodec_encode_audio(c, audio_outbuf, audio_outbuf_size, samples);
+ avcodec_encode_audio2(c, &pkt, frame, &got_packet);
+ if (!got_packet)
+ return;
- if (c->coded_frame && c->coded_frame->pts != AV_NOPTS_VALUE)
- pkt.pts= av_rescale_q(c->coded_frame->pts, c->time_base, st->time_base);
- pkt.flags |= AV_PKT_FLAG_KEY;
- pkt.stream_index= st->index;
- pkt.data= audio_outbuf;
+ pkt.stream_index = st->index;
- /* write the compressed frame in the media file */
+ /* Write the compressed frame to the media file. */
if (av_interleaved_write_frame(oc, &pkt) != 0) {
fprintf(stderr, "Error while writing audio frame\n");
exit(1);
}
+ avcodec_free_frame(&frame);
}
static void close_audio(AVFormatContext *oc, AVStream *st)
@@ -184,7 +171,6 @@ static void close_audio(AVFormatContext *oc, AVStream *st)
avcodec_close(st->codec);
av_free(samples);
- av_free(audio_outbuf);
}
/**************************************************************/
@@ -194,53 +180,59 @@ static AVFrame *picture, *tmp_picture;
static uint8_t *video_outbuf;
static int frame_count, video_outbuf_size;
-/* add a video output stream */
-static AVStream *add_video_stream(AVFormatContext *oc, enum CodecID codec_id)
+/* Add a video output stream. */
+static AVStream *add_video_stream(AVFormatContext *oc, enum AVCodecID codec_id)
{
AVCodecContext *c;
AVStream *st;
+ AVCodec *codec;
+
+ /* find the video encoder */
+ codec = avcodec_find_encoder(codec_id);
+ if (!codec) {
+ fprintf(stderr, "codec not found\n");
+ exit(1);
+ }
- st = avformat_new_stream(oc, NULL);
+ st = avformat_new_stream(oc, codec);
if (!st) {
fprintf(stderr, "Could not alloc stream\n");
exit(1);
}
c = st->codec;
- c->codec_id = codec_id;
- c->codec_type = AVMEDIA_TYPE_VIDEO;
- /* put sample parameters */
+ /* Put sample parameters. */
c->bit_rate = 400000;
- /* resolution must be a multiple of two */
- c->width = 352;
- c->height = 288;
- /* time base: this is the fundamental unit of time (in seconds) in terms
- of which frame timestamps are represented. for fixed-fps content,
- timebase should be 1/framerate and timestamp increments should be
- identically 1. */
+ /* Resolution must be a multiple of two. */
+ c->width = 352;
+ c->height = 288;
+ /* timebase: This is the fundamental unit of time (in seconds) in terms
+ * of which frame timestamps are represented. For fixed-fps content,
+ * timebase should be 1/framerate and timestamp increments should be
+ * identical to 1. */
c->time_base.den = STREAM_FRAME_RATE;
c->time_base.num = 1;
- c->gop_size = 12; /* emit one intra frame every twelve frames at most */
- c->pix_fmt = STREAM_PIX_FMT;
- if (c->codec_id == CODEC_ID_MPEG2VIDEO) {
+ c->gop_size = 12; /* emit one intra frame every twelve frames at most */
+ c->pix_fmt = STREAM_PIX_FMT;
+ if (c->codec_id == AV_CODEC_ID_MPEG2VIDEO) {
/* just for testing, we also add B frames */
c->max_b_frames = 2;
}
- if (c->codec_id == CODEC_ID_MPEG1VIDEO){
+ if (c->codec_id == AV_CODEC_ID_MPEG1VIDEO) {
/* Needed to avoid using macroblocks in which some coeffs overflow.
- This does not happen with normal video, it just happens here as
- the motion of the chroma plane does not match the luma plane. */
- c->mb_decision=2;
+ * This does not happen with normal video, it just happens here as
+ * the motion of the chroma plane does not match the luma plane. */
+ c->mb_decision = 2;
}
- // some formats want stream headers to be separate
- if(oc->oformat->flags & AVFMT_GLOBALHEADER)
+ /* Some formats want stream headers to be separate. */
+ if (oc->oformat->flags & AVFMT_GLOBALHEADER)
c->flags |= CODEC_FLAG_GLOBAL_HEADER;
return st;
}
-static AVFrame *alloc_picture(enum PixelFormat pix_fmt, int width, int height)
+static AVFrame *alloc_picture(enum AVPixelFormat pix_fmt, int width, int height)
{
AVFrame *picture;
uint8_t *picture_buf;
@@ -249,7 +241,7 @@ static AVFrame *alloc_picture(enum PixelFormat pix_fmt, int width, int height)
picture = avcodec_alloc_frame();
if (!picture)
return NULL;
- size = avpicture_get_size(pix_fmt, width, height);
+ size = avpicture_get_size(pix_fmt, width, height);
picture_buf = av_malloc(size);
if (!picture_buf) {
av_free(picture);
@@ -262,49 +254,41 @@ static AVFrame *alloc_picture(enum PixelFormat pix_fmt, int width, int height)
static void open_video(AVFormatContext *oc, AVStream *st)
{
- AVCodec *codec;
AVCodecContext *c;
c = st->codec;
- /* find the video encoder */
- codec = avcodec_find_encoder(c->codec_id);
- if (!codec) {
- fprintf(stderr, "codec not found\n");
- exit(1);
- }
-
/* open the codec */
- if (avcodec_open(c, codec) < 0) {
+ if (avcodec_open2(c, NULL, NULL) < 0) {
fprintf(stderr, "could not open codec\n");
exit(1);
}
video_outbuf = NULL;
if (!(oc->oformat->flags & AVFMT_RAWPICTURE)) {
- /* allocate output buffer */
- /* XXX: API change will be done */
- /* buffers passed into lav* can be allocated any way you prefer,
- as long as they're aligned enough for the architecture, and
- they're freed appropriately (such as using av_free for buffers
- allocated with av_malloc) */
+ /* Allocate output buffer. */
+ /* XXX: API change will be done. */
+ /* Buffers passed into lav* can be allocated any way you prefer,
+ * as long as they're aligned enough for the architecture, and
+ * they're freed appropriately (such as using av_free for buffers
+ * allocated with av_malloc). */
video_outbuf_size = 200000;
- video_outbuf = av_malloc(video_outbuf_size);
+ video_outbuf = av_malloc(video_outbuf_size);
}
- /* allocate the encoded raw picture */
+ /* Allocate the encoded raw picture. */
picture = alloc_picture(c->pix_fmt, c->width, c->height);
if (!picture) {
fprintf(stderr, "Could not allocate picture\n");
exit(1);
}
- /* if the output format is not YUV420P, then a temporary YUV420P
- picture is needed too. It is then converted to the required
- output format */
+ /* If the output format is not YUV420P, then a temporary YUV420P
+ * picture is needed too. It is then converted to the required
+ * output format. */
tmp_picture = NULL;
- if (c->pix_fmt != PIX_FMT_YUV420P) {
- tmp_picture = alloc_picture(PIX_FMT_YUV420P, c->width, c->height);
+ if (c->pix_fmt != AV_PIX_FMT_YUV420P) {
+ tmp_picture = alloc_picture(AV_PIX_FMT_YUV420P, c->width, c->height);
if (!tmp_picture) {
fprintf(stderr, "Could not allocate temporary picture\n");
exit(1);
@@ -312,23 +296,22 @@ static void open_video(AVFormatContext *oc, AVStream *st)
}
}
-/* prepare a dummy image */
-static void fill_yuv_image(AVFrame *pict, int frame_index, int width, int height)
+/* Prepare a dummy image. */
+static void fill_yuv_image(AVFrame *pict, int frame_index,
+ int width, int height)
{
int x, y, i;
i = frame_index;
/* Y */
- for(y=0;y<height;y++) {
- for(x=0;x<width;x++) {
+ for (y = 0; y < height; y++)
+ for (x = 0; x < width; x++)
pict->data[0][y * pict->linesize[0] + x] = x + y + i * 3;
- }
- }
/* Cb and Cr */
- for(y=0;y<height/2;y++) {
- for(x=0;x<width/2;x++) {
+ for (y = 0; y < height / 2; y++) {
+ for (x = 0; x < width / 2; x++) {
pict->data[1][y * pict->linesize[1] + x] = 128 + y + i * 2;
pict->data[2][y * pict->linesize[2] + x] = 64 + x + i * 5;
}
@@ -344,21 +327,22 @@ static void write_video_frame(AVFormatContext *oc, AVStream *st)
c = st->codec;
if (frame_count >= STREAM_NB_FRAMES) {
- /* no more frame to compress. The codec has a latency of a few
- frames if using B frames, so we get the last frames by
- passing the same picture again */
+ /* No more frames to compress. The codec has a latency of a few
+ * frames if using B-frames, so we get the last frames by
+ * passing the same picture again. */
} else {
- if (c->pix_fmt != PIX_FMT_YUV420P) {
+ if (c->pix_fmt != AV_PIX_FMT_YUV420P) {
/* as we only generate a YUV420P picture, we must convert it
- to the codec pixel format if needed */
+ * to the codec pixel format if needed */
if (img_convert_ctx == NULL) {
img_convert_ctx = sws_getContext(c->width, c->height,
- PIX_FMT_YUV420P,
+ AV_PIX_FMT_YUV420P,
c->width, c->height,
c->pix_fmt,
sws_flags, NULL, NULL, NULL);
if (img_convert_ctx == NULL) {
- fprintf(stderr, "Cannot initialize the conversion context\n");
+ fprintf(stderr,
+ "Cannot initialize the conversion context\n");
exit(1);
}
}
@@ -370,36 +354,37 @@ static void write_video_frame(AVFormatContext *oc, AVStream *st)
}
}
-
if (oc->oformat->flags & AVFMT_RAWPICTURE) {
- /* raw video case. The API will change slightly in the near
- futur for that */
+ /* Raw video case - the API will change slightly in the near
+ * future for that. */
AVPacket pkt;
av_init_packet(&pkt);
- pkt.flags |= AV_PKT_FLAG_KEY;
- pkt.stream_index= st->index;
- pkt.data= (uint8_t *)picture;
- pkt.size= sizeof(AVPicture);
+ pkt.flags |= AV_PKT_FLAG_KEY;
+ pkt.stream_index = st->index;
+ pkt.data = (uint8_t *)picture;
+ pkt.size = sizeof(AVPicture);
ret = av_interleaved_write_frame(oc, &pkt);
} else {
/* encode the image */
- out_size = avcodec_encode_video(c, video_outbuf, video_outbuf_size, picture);
- /* if zero size, it means the image was buffered */
+ out_size = avcodec_encode_video(c, video_outbuf,
+ video_outbuf_size, picture);
+ /* If size is zero, it means the image was buffered. */
if (out_size > 0) {
AVPacket pkt;
av_init_packet(&pkt);
if (c->coded_frame->pts != AV_NOPTS_VALUE)
- pkt.pts= av_rescale_q(c->coded_frame->pts, c->time_base, st->time_base);
- if(c->coded_frame->key_frame)
+ pkt.pts = av_rescale_q(c->coded_frame->pts,
+ c->time_base, st->time_base);
+ if (c->coded_frame->key_frame)
pkt.flags |= AV_PKT_FLAG_KEY;
- pkt.stream_index= st->index;
- pkt.data= video_outbuf;
- pkt.size= out_size;
+ pkt.stream_index = st->index;
+ pkt.data = video_outbuf;
+ pkt.size = out_size;
- /* write the compressed frame in the media file */
+ /* Write the compressed frame to the media file. */
ret = av_interleaved_write_frame(oc, &pkt);
} else {
ret = 0;
@@ -436,7 +421,7 @@ int main(int argc, char **argv)
double audio_pts, video_pts;
int i;
- /* initialize libavcodec, and register all codecs and formats */
+ /* Initialize libavcodec, and register all codecs and formats. */
av_register_all();
if (argc != 2) {
@@ -450,8 +435,7 @@ int main(int argc, char **argv)
filename = argv[1];
- /* auto detect the output format from the name. default is
- mpeg. */
+ /* Autodetect the output format from the name. default is MPEG. */
fmt = av_guess_format(NULL, filename, NULL);
if (!fmt) {
printf("Could not deduce output format from file extension: using MPEG.\n");
@@ -462,7 +446,7 @@ int main(int argc, char **argv)
return 1;
}
- /* allocate the output media context */
+ /* Allocate the output media context. */
oc = avformat_alloc_context();
if (!oc) {
fprintf(stderr, "Memory error\n");
@@ -471,33 +455,26 @@ int main(int argc, char **argv)
oc->oformat = fmt;
snprintf(oc->filename, sizeof(oc->filename), "%s", filename);
- /* add the audio and video streams using the default format codecs
- and initialize the codecs */
+ /* Add the audio and video streams using the default format codecs
+ * and initialize the codecs. */
video_st = NULL;
audio_st = NULL;
- if (fmt->video_codec != CODEC_ID_NONE) {
+ if (fmt->video_codec != AV_CODEC_ID_NONE) {
video_st = add_video_stream(oc, fmt->video_codec);
}
- if (fmt->audio_codec != CODEC_ID_NONE) {
+ if (fmt->audio_codec != AV_CODEC_ID_NONE) {
audio_st = add_audio_stream(oc, fmt->audio_codec);
}
- /* set the output parameters (must be done even if no
- parameters). */
- if (av_set_parameters(oc, NULL) < 0) {
- fprintf(stderr, "Invalid output format parameters\n");
- return 1;
- }
-
- av_dump_format(oc, 0, filename, 1);
-
- /* now that all the parameters are set, we can open the audio and
- video codecs and allocate the necessary encode buffers */
+ /* Now that all the parameters are set, we can open the audio and
+ * video codecs and allocate the necessary encode buffers. */
if (video_st)
open_video(oc, video_st);
if (audio_st)
open_audio(oc, audio_st);
+ av_dump_format(oc, 0, filename, 1);
+
/* open the output file, if needed */
if (!(fmt->flags & AVFMT_NOFILE)) {
if (avio_open(&oc->pb, filename, AVIO_FLAG_WRITE) < 0) {
@@ -506,18 +483,19 @@ int main(int argc, char **argv)
}
}
- /* write the stream header, if any */
- av_write_header(oc);
+ /* Write the stream header, if any. */
+ avformat_write_header(oc, NULL);
- for(;;) {
- /* compute current audio and video time */
+ for (;;) {
+ /* Compute current audio and video time. */
if (audio_st)
audio_pts = (double)audio_st->pts.val * audio_st->time_base.num / audio_st->time_base.den;
else
audio_pts = 0.0;
if (video_st)
- video_pts = (double)video_st->pts.val * video_st->time_base.num / video_st->time_base.den;
+ video_pts = (double)video_st->pts.val * video_st->time_base.num /
+ video_st->time_base.den;
else
video_pts = 0.0;
@@ -533,28 +511,27 @@ int main(int argc, char **argv)
}
}
- /* write the trailer, if any. the trailer must be written
- * before you close the CodecContexts open when you wrote the
- * header; otherwise write_trailer may try to use memory that
- * was freed on av_codec_close() */
+ /* Write the trailer, if any. The trailer must be written before you
+ * close the CodecContexts open when you wrote the header; otherwise
+ * av_write_trailer() may try to use memory that was freed on
+ * av_codec_close(). */
av_write_trailer(oc);
- /* close each codec */
+ /* Close each codec. */
if (video_st)
close_video(oc, video_st);
if (audio_st)
close_audio(oc, audio_st);
- /* free the streams */
- for(i = 0; i < oc->nb_streams; i++) {
+ /* Free the streams. */
+ for (i = 0; i < oc->nb_streams; i++) {
av_freep(&oc->streams[i]->codec);
av_freep(&oc->streams[i]);
}
- if (!(fmt->flags & AVFMT_NOFILE)) {
- /* close the output file */
+ if (!(fmt->flags & AVFMT_NOFILE))
+ /* Close the output file. */
avio_close(oc->pb);
- }
/* free the stream */
av_free(oc);
diff --git a/gst-libs/ext/libav/libavformat/pcm.c b/gst-libs/ext/libav/libavformat/pcm.c
index 7d5fed5..892e8ca 100644
--- a/gst-libs/ext/libav/libavformat/pcm.c
+++ b/gst-libs/ext/libav/libavformat/pcm.c
@@ -23,8 +23,8 @@
#include "avformat.h"
#include "pcm.h"
-int pcm_read_seek(AVFormatContext *s,
- int stream_index, int64_t timestamp, int flags)
+int ff_pcm_read_seek(AVFormatContext *s,
+ int stream_index, int64_t timestamp, int flags)
{
AVStream *st;
int block_align, byte_rate;
diff --git a/gst-libs/ext/libav/libavformat/pcm.h b/gst-libs/ext/libav/libavformat/pcm.h
index 228df13..30cbc86 100644
--- a/gst-libs/ext/libav/libavformat/pcm.h
+++ b/gst-libs/ext/libav/libavformat/pcm.h
@@ -24,7 +24,7 @@
#include "avformat.h"
-int pcm_read_seek(AVFormatContext *s,
- int stream_index, int64_t timestamp, int flags);
+int ff_pcm_read_seek(AVFormatContext *s,
+ int stream_index, int64_t timestamp, int flags);
#endif /* AVFORMAT_PCM_H */
diff --git a/gst-libs/ext/libav/libavformat/pcmdec.c b/gst-libs/ext/libav/libavformat/pcmdec.c
index b61fb33..716d8b7 100644
--- a/gst-libs/ext/libav/libavformat/pcmdec.c
+++ b/gst-libs/ext/libav/libavformat/pcmdec.c
@@ -20,14 +20,47 @@
*/
#include "avformat.h"
-#include "rawdec.h"
+#include "internal.h"
#include "pcm.h"
#include "libavutil/log.h"
#include "libavutil/opt.h"
#define RAW_SAMPLES 1024
-static int raw_read_packet(AVFormatContext *s, AVPacket *pkt)
+typedef struct PCMAudioDemuxerContext {
+ AVClass *class;
+ int sample_rate;
+ int channels;
+} PCMAudioDemuxerContext;
+
+static int pcm_read_header(AVFormatContext *s)
+{
+ PCMAudioDemuxerContext *s1 = s->priv_data;
+ AVStream *st;
+
+ st = avformat_new_stream(s, NULL);
+ if (!st)
+ return AVERROR(ENOMEM);
+
+
+ st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
+ st->codec->codec_id = s->iformat->raw_codec_id;
+ st->codec->sample_rate = s1->sample_rate;
+ st->codec->channels = s1->channels;
+
+ st->codec->bits_per_coded_sample =
+ av_get_bits_per_sample(st->codec->codec_id);
+
+ assert(st->codec->bits_per_coded_sample > 0);
+
+ st->codec->block_align =
+ st->codec->bits_per_coded_sample * st->codec->channels / 8;
+
+ avpriv_set_pts_info(st, 64, 1, st->codec->sample_rate);
+ return 0;
+}
+
+static int pcm_read_packet(AVFormatContext *s, AVPacket *pkt)
{
int ret, size, bps;
// AVStream *st = s->streams[0];
@@ -49,8 +82,8 @@ static int raw_read_packet(AVFormatContext *s, AVPacket *pkt)
}
static const AVOption pcm_options[] = {
- { "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 },
+ { "sample_rate", "", offsetof(PCMAudioDemuxerContext, sample_rate), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, AV_OPT_FLAG_DECODING_PARAM },
+ { "channels", "", offsetof(PCMAudioDemuxerContext, channels), AV_OPT_TYPE_INT, {.i64 = 1}, 0, INT_MAX, AV_OPT_FLAG_DECODING_PARAM },
{ NULL },
};
@@ -64,72 +97,72 @@ static const AVClass name_ ## _demuxer_class = { \
AVInputFormat ff_pcm_ ## name_ ## _demuxer = { \
.name = #name_, \
.long_name = NULL_IF_CONFIG_SMALL(long_name_), \
- .priv_data_size = sizeof(RawAudioDemuxerContext), \
- .read_header = ff_raw_read_header, \
- .read_packet = raw_read_packet, \
- .read_seek = pcm_read_seek, \
+ .priv_data_size = sizeof(PCMAudioDemuxerContext), \
+ .read_header = pcm_read_header, \
+ .read_packet = pcm_read_packet, \
+ .read_seek = ff_pcm_read_seek, \
.flags = AVFMT_GENERIC_INDEX, \
.extensions = ext, \
- .value = codec, \
+ .raw_codec_id = codec, \
.priv_class = &name_ ## _demuxer_class, \
};
-PCMDEF(f64be, "PCM 64 bit floating-point big-endian format",
- NULL, CODEC_ID_PCM_F64BE)
+PCMDEF(f64be, "PCM 64-bit floating-point big-endian",
+ NULL, AV_CODEC_ID_PCM_F64BE)
-PCMDEF(f64le, "PCM 64 bit floating-point little-endian format",
- NULL, CODEC_ID_PCM_F64LE)
+PCMDEF(f64le, "PCM 64-bit floating-point little-endian",
+ NULL, AV_CODEC_ID_PCM_F64LE)
-PCMDEF(f32be, "PCM 32 bit floating-point big-endian format",
- NULL, CODEC_ID_PCM_F32BE)
+PCMDEF(f32be, "PCM 32-bit floating-point big-endian",
+ NULL, AV_CODEC_ID_PCM_F32BE)
-PCMDEF(f32le, "PCM 32 bit floating-point little-endian format",
- NULL, CODEC_ID_PCM_F32LE)
+PCMDEF(f32le, "PCM 32-bit floating-point little-endian",
+ NULL, AV_CODEC_ID_PCM_F32LE)
-PCMDEF(s32be, "PCM signed 32 bit big-endian format",
- NULL, CODEC_ID_PCM_S32BE)
+PCMDEF(s32be, "PCM signed 32-bit big-endian",
+ NULL, AV_CODEC_ID_PCM_S32BE)
-PCMDEF(s32le, "PCM signed 32 bit little-endian format",
- NULL, CODEC_ID_PCM_S32LE)
+PCMDEF(s32le, "PCM signed 32-bit little-endian",
+ NULL, AV_CODEC_ID_PCM_S32LE)
-PCMDEF(s24be, "PCM signed 24 bit big-endian format",
- NULL, CODEC_ID_PCM_S24BE)
+PCMDEF(s24be, "PCM signed 24-bit big-endian",
+ NULL, AV_CODEC_ID_PCM_S24BE)
-PCMDEF(s24le, "PCM signed 24 bit little-endian format",
- NULL, CODEC_ID_PCM_S24LE)
+PCMDEF(s24le, "PCM signed 24-bit little-endian",
+ NULL, AV_CODEC_ID_PCM_S24LE)
-PCMDEF(s16be, "PCM signed 16 bit big-endian format",
- AV_NE("sw", NULL), CODEC_ID_PCM_S16BE)
+PCMDEF(s16be, "PCM signed 16-bit big-endian",
+ AV_NE("sw", NULL), AV_CODEC_ID_PCM_S16BE)
-PCMDEF(s16le, "PCM signed 16 bit little-endian format",
- AV_NE(NULL, "sw"), CODEC_ID_PCM_S16LE)
+PCMDEF(s16le, "PCM signed 16-bit little-endian",
+ AV_NE(NULL, "sw"), AV_CODEC_ID_PCM_S16LE)
-PCMDEF(s8, "PCM signed 8 bit format",
- "sb", CODEC_ID_PCM_S8)
+PCMDEF(s8, "PCM signed 8-bit",
+ "sb", AV_CODEC_ID_PCM_S8)
-PCMDEF(u32be, "PCM unsigned 32 bit big-endian format",
- NULL, CODEC_ID_PCM_U32BE)
+PCMDEF(u32be, "PCM unsigned 32-bit big-endian",
+ NULL, AV_CODEC_ID_PCM_U32BE)
-PCMDEF(u32le, "PCM unsigned 32 bit little-endian format",
- NULL, CODEC_ID_PCM_U32LE)
+PCMDEF(u32le, "PCM unsigned 32-bit little-endian",
+ NULL, AV_CODEC_ID_PCM_U32LE)
-PCMDEF(u24be, "PCM unsigned 24 bit big-endian format",
- NULL, CODEC_ID_PCM_U24BE)
+PCMDEF(u24be, "PCM unsigned 24-bit big-endian",
+ NULL, AV_CODEC_ID_PCM_U24BE)
-PCMDEF(u24le, "PCM unsigned 24 bit little-endian format",
- NULL, CODEC_ID_PCM_U24LE)
+PCMDEF(u24le, "PCM unsigned 24-bit little-endian",
+ NULL, AV_CODEC_ID_PCM_U24LE)
-PCMDEF(u16be, "PCM unsigned 16 bit big-endian format",
- AV_NE("uw", NULL), CODEC_ID_PCM_U16BE)
+PCMDEF(u16be, "PCM unsigned 16-bit big-endian",
+ AV_NE("uw", NULL), AV_CODEC_ID_PCM_U16BE)
-PCMDEF(u16le, "PCM unsigned 16 bit little-endian format",
- AV_NE(NULL, "uw"), CODEC_ID_PCM_U16LE)
+PCMDEF(u16le, "PCM unsigned 16-bit little-endian",
+ AV_NE(NULL, "uw"), AV_CODEC_ID_PCM_U16LE)
-PCMDEF(u8, "PCM unsigned 8 bit format",
- "ub", CODEC_ID_PCM_U8)
+PCMDEF(u8, "PCM unsigned 8-bit",
+ "ub", AV_CODEC_ID_PCM_U8)
-PCMDEF(alaw, "PCM A-law format",
- "al", CODEC_ID_PCM_ALAW)
+PCMDEF(alaw, "PCM A-law",
+ "al", AV_CODEC_ID_PCM_ALAW)
-PCMDEF(mulaw, "PCM mu-law format",
- "ul", CODEC_ID_PCM_MULAW)
+PCMDEF(mulaw, "PCM mu-law",
+ "ul", AV_CODEC_ID_PCM_MULAW)
diff --git a/gst-libs/ext/libav/libavformat/pcmenc.c b/gst-libs/ext/libav/libavformat/pcmenc.c
index 553df1f..e45ab84 100644
--- a/gst-libs/ext/libav/libavformat/pcmenc.c
+++ b/gst-libs/ext/libav/libavformat/pcmenc.c
@@ -28,67 +28,67 @@ AVOutputFormat ff_pcm_ ## name_ ## _muxer = { \
.long_name = NULL_IF_CONFIG_SMALL(long_name_), \
.extensions = ext, \
.audio_codec = codec, \
- .video_codec = CODEC_ID_NONE, \
+ .video_codec = AV_CODEC_ID_NONE, \
.write_packet = ff_raw_write_packet, \
.flags = AVFMT_NOTIMESTAMPS, \
};
-PCMDEF(f64be, "PCM 64 bit floating-point big-endian format",
- NULL, CODEC_ID_PCM_F64BE)
+PCMDEF(f64be, "PCM 64-bit floating-point big-endian",
+ NULL, AV_CODEC_ID_PCM_F64BE)
-PCMDEF(f64le, "PCM 64 bit floating-point little-endian format",
- NULL, CODEC_ID_PCM_F64LE)
+PCMDEF(f64le, "PCM 64-bit floating-point little-endian",
+ NULL, AV_CODEC_ID_PCM_F64LE)
-PCMDEF(f32be, "PCM 32 bit floating-point big-endian format",
- NULL, CODEC_ID_PCM_F32BE)
+PCMDEF(f32be, "PCM 32-bit floating-point big-endian",
+ NULL, AV_CODEC_ID_PCM_F32BE)
-PCMDEF(f32le, "PCM 32 bit floating-point little-endian format",
- NULL, CODEC_ID_PCM_F32LE)
+PCMDEF(f32le, "PCM 32-bit floating-point little-endian",
+ NULL, AV_CODEC_ID_PCM_F32LE)
-PCMDEF(s32be, "PCM signed 32 bit big-endian format",
- NULL, CODEC_ID_PCM_S32BE)
+PCMDEF(s32be, "PCM signed 32-bit big-endian",
+ NULL, AV_CODEC_ID_PCM_S32BE)
-PCMDEF(s32le, "PCM signed 32 bit little-endian format",
- NULL, CODEC_ID_PCM_S32LE)
+PCMDEF(s32le, "PCM signed 32-bit little-endian",
+ NULL, AV_CODEC_ID_PCM_S32LE)
-PCMDEF(s24be, "PCM signed 24 bit big-endian format",
- NULL, CODEC_ID_PCM_S24BE)
+PCMDEF(s24be, "PCM signed 24-bit big-endian",
+ NULL, AV_CODEC_ID_PCM_S24BE)
-PCMDEF(s24le, "PCM signed 24 bit little-endian format",
- NULL, CODEC_ID_PCM_S24LE)
+PCMDEF(s24le, "PCM signed 24-bit little-endian",
+ NULL, AV_CODEC_ID_PCM_S24LE)
-PCMDEF(s16be, "PCM signed 16 bit big-endian format",
- AV_NE("sw", NULL), CODEC_ID_PCM_S16BE)
+PCMDEF(s16be, "PCM signed 16-bit big-endian",
+ AV_NE("sw", NULL), AV_CODEC_ID_PCM_S16BE)
-PCMDEF(s16le, "PCM signed 16 bit little-endian format",
- AV_NE(NULL, "sw"), CODEC_ID_PCM_S16LE)
+PCMDEF(s16le, "PCM signed 16-bit little-endian",
+ AV_NE(NULL, "sw"), AV_CODEC_ID_PCM_S16LE)
-PCMDEF(s8, "PCM signed 8 bit format",
- "sb", CODEC_ID_PCM_S8)
+PCMDEF(s8, "PCM signed 8-bit",
+ "sb", AV_CODEC_ID_PCM_S8)
-PCMDEF(u32be, "PCM unsigned 32 bit big-endian format",
- NULL, CODEC_ID_PCM_U32BE)
+PCMDEF(u32be, "PCM unsigned 32-bit big-endian",
+ NULL, AV_CODEC_ID_PCM_U32BE)
-PCMDEF(u32le, "PCM unsigned 32 bit little-endian format",
- NULL, CODEC_ID_PCM_U32LE)
+PCMDEF(u32le, "PCM unsigned 32-bit little-endian",
+ NULL, AV_CODEC_ID_PCM_U32LE)
-PCMDEF(u24be, "PCM unsigned 24 bit big-endian format",
- NULL, CODEC_ID_PCM_U24BE)
+PCMDEF(u24be, "PCM unsigned 24-bit big-endian",
+ NULL, AV_CODEC_ID_PCM_U24BE)
-PCMDEF(u24le, "PCM unsigned 24 bit little-endian format",
- NULL, CODEC_ID_PCM_U24LE)
+PCMDEF(u24le, "PCM unsigned 24-bit little-endian",
+ NULL, AV_CODEC_ID_PCM_U24LE)
-PCMDEF(u16be, "PCM unsigned 16 bit big-endian format",
- AV_NE("uw", NULL), CODEC_ID_PCM_U16BE)
+PCMDEF(u16be, "PCM unsigned 16-bit big-endian",
+ AV_NE("uw", NULL), AV_CODEC_ID_PCM_U16BE)
-PCMDEF(u16le, "PCM unsigned 16 bit little-endian format",
- AV_NE(NULL, "uw"), CODEC_ID_PCM_U16LE)
+PCMDEF(u16le, "PCM unsigned 16-bit little-endian",
+ AV_NE(NULL, "uw"), AV_CODEC_ID_PCM_U16LE)
-PCMDEF(u8, "PCM unsigned 8 bit format",
- "ub", CODEC_ID_PCM_U8)
+PCMDEF(u8, "PCM unsigned 8-bit",
+ "ub", AV_CODEC_ID_PCM_U8)
-PCMDEF(alaw, "PCM A-law format",
- "al", CODEC_ID_PCM_ALAW)
+PCMDEF(alaw, "PCM A-law",
+ "al", AV_CODEC_ID_PCM_ALAW)
-PCMDEF(mulaw, "PCM mu-law format",
- "ul", CODEC_ID_PCM_MULAW)
+PCMDEF(mulaw, "PCM mu-law",
+ "ul", AV_CODEC_ID_PCM_MULAW)
diff --git a/gst-libs/ext/libav/libavformat/pmpdec.c b/gst-libs/ext/libav/libavformat/pmpdec.c
index 96c7048..6cdce10 100644
--- a/gst-libs/ext/libav/libavformat/pmpdec.c
+++ b/gst-libs/ext/libav/libavformat/pmpdec.c
@@ -39,13 +39,13 @@ static int pmp_probe(AVProbeData *p)
return 0;
}
-static int pmp_header(AVFormatContext *s, AVFormatParameters *ap)
+static int pmp_header(AVFormatContext *s)
{
PMPContext *pmp = s->priv_data;
AVIOContext *pb = s->pb;
int tb_num, tb_den;
int index_cnt;
- int audio_codec_id = CODEC_ID_NONE;
+ int audio_codec_id = AV_CODEC_ID_NONE;
int srate, channels;
int i;
uint64_t pos;
@@ -56,10 +56,10 @@ static int pmp_header(AVFormatContext *s, AVFormatParameters *ap)
avio_skip(pb, 8);
switch (avio_rl32(pb)) {
case 0:
- vst->codec->codec_id = CODEC_ID_MPEG4;
+ vst->codec->codec_id = AV_CODEC_ID_MPEG4;
break;
case 1:
- vst->codec->codec_id = CODEC_ID_H264;
+ vst->codec->codec_id = AV_CODEC_ID_H264;
break;
default:
av_log(s, AV_LOG_ERROR, "Unsupported video format\n");
@@ -77,11 +77,11 @@ static int pmp_header(AVFormatContext *s, AVFormatParameters *ap)
switch (avio_rl32(pb)) {
case 0:
- audio_codec_id = CODEC_ID_MP3;
+ audio_codec_id = AV_CODEC_ID_MP3;
break;
case 1:
av_log(s, AV_LOG_WARNING, "AAC is not yet correctly supported\n");
- audio_codec_id = CODEC_ID_AAC;
+ audio_codec_id = AV_CODEC_ID_AAC;
break;
default:
av_log(s, AV_LOG_ERROR, "Unsupported audio format\n");
@@ -170,7 +170,7 @@ static int pmp_close(AVFormatContext *s)
AVInputFormat ff_pmp_demuxer = {
.name = "pmp",
- .long_name = NULL_IF_CONFIG_SMALL("Playstation Portable PMP format"),
+ .long_name = NULL_IF_CONFIG_SMALL("Playstation Portable PMP"),
.priv_data_size = sizeof(PMPContext),
.read_probe = pmp_probe,
.read_header = pmp_header,
diff --git a/gst-libs/ext/libav/libavformat/psxstr.c b/gst-libs/ext/libav/libavformat/psxstr.c
index d22de08..633d61d 100644
--- a/gst-libs/ext/libav/libavformat/psxstr.c
+++ b/gst-libs/ext/libav/libavformat/psxstr.c
@@ -29,6 +29,7 @@
* RIFF headers, followed by CD sectors.
*/
+#include "libavutil/channel_layout.h"
#include "libavutil/intreadwrite.h"
#include "avformat.h"
#include "internal.h"
@@ -96,8 +97,7 @@ static int str_probe(AVProbeData *p)
return 50;
}
-static int str_read_header(AVFormatContext *s,
- AVFormatParameters *ap)
+static int str_read_header(AVFormatContext *s)
{
AVIOContext *pb = s->pb;
StrDemuxContext *str = s->priv_data;
@@ -171,7 +171,7 @@ static int str_read_packet(AVFormatContext *s,
str->channels[channel].video_stream_index = st->index;
st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
- st->codec->codec_id = CODEC_ID_MDEC;
+ st->codec->codec_id = AV_CODEC_ID_MDEC;
st->codec->codec_tag = 0; /* no fourcc */
st->codec->width = AV_RL16(&sector[0x28]);
st->codec->height = AV_RL16(&sector[0x2A]);
@@ -218,14 +218,22 @@ static int str_read_packet(AVFormatContext *s,
str->channels[channel].audio_stream_index = st->index;
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
- st->codec->codec_id = CODEC_ID_ADPCM_XA;
+ st->codec->codec_id = AV_CODEC_ID_ADPCM_XA;
st->codec->codec_tag = 0; /* no fourcc */
- st->codec->channels = (fmt&1)?2:1;
+ if (fmt & 1) {
+ st->codec->channels = 2;
+ st->codec->channel_layout = AV_CH_LAYOUT_STEREO;
+ } else {
+ st->codec->channels = 1;
+ st->codec->channel_layout = AV_CH_LAYOUT_MONO;
+ }
st->codec->sample_rate = (fmt&4)?18900:37800;
// st->codec->bit_rate = 0; //FIXME;
st->codec->block_align = 128;
- avpriv_set_pts_info(st, 64, 128, st->codec->sample_rate);
+ avpriv_set_pts_info(st, 64, 18 * 224 / st->codec->channels,
+ st->codec->sample_rate);
+ st->start_time = 0;
}
pkt = ret_pkt;
if (av_new_packet(pkt, 2304))
@@ -234,6 +242,7 @@ static int str_read_packet(AVFormatContext *s,
pkt->stream_index =
str->channels[channel].audio_stream_index;
+ pkt->duration = 1;
return 0;
default:
av_log(s, AV_LOG_WARNING, "Unknown sector type %02X\n", sector[0x12]);
@@ -260,10 +269,11 @@ static int str_read_close(AVFormatContext *s)
AVInputFormat ff_str_demuxer = {
.name = "psxstr",
- .long_name = NULL_IF_CONFIG_SMALL("Sony Playstation STR format"),
+ .long_name = NULL_IF_CONFIG_SMALL("Sony Playstation STR"),
.priv_data_size = sizeof(StrDemuxContext),
.read_probe = str_probe,
.read_header = str_read_header,
.read_packet = str_read_packet,
.read_close = str_read_close,
+ .flags = AVFMT_NO_BYTE_SEEK,
};
diff --git a/gst-libs/ext/libav/libavformat/pva.c b/gst-libs/ext/libav/libavformat/pva.c
index 263fb5f..53041ba 100644
--- a/gst-libs/ext/libav/libavformat/pva.c
+++ b/gst-libs/ext/libav/libavformat/pva.c
@@ -41,13 +41,13 @@ static int pva_probe(AVProbeData * pd) {
return 0;
}
-static int pva_read_header(AVFormatContext *s, AVFormatParameters *ap) {
+static int pva_read_header(AVFormatContext *s) {
AVStream *st;
if (!(st = avformat_new_stream(s, NULL)))
return AVERROR(ENOMEM);
st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
- st->codec->codec_id = CODEC_ID_MPEG2VIDEO;
+ st->codec->codec_id = AV_CODEC_ID_MPEG2VIDEO;
st->need_parsing = AVSTREAM_PARSE_FULL;
avpriv_set_pts_info(st, 32, 1, 90000);
av_add_index_entry(st, 0, 0, 0, 0, AVINDEX_KEYFRAME);
@@ -55,7 +55,7 @@ static int pva_read_header(AVFormatContext *s, AVFormatParameters *ap) {
if (!(st = avformat_new_stream(s, NULL)))
return AVERROR(ENOMEM);
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
- st->codec->codec_id = CODEC_ID_MP2;
+ st->codec->codec_id = AV_CODEC_ID_MP2;
st->need_parsing = AVSTREAM_PARSE_FULL;
avpriv_set_pts_info(st, 33, 1, 90000);
av_add_index_entry(st, 0, 0, 0, 0, AVINDEX_KEYFRAME);
@@ -203,10 +203,10 @@ static int64_t pva_read_timestamp(struct AVFormatContext *s, int stream_index,
AVInputFormat ff_pva_demuxer = {
.name = "pva",
- .long_name = NULL_IF_CONFIG_SMALL("TechnoTrend PVA file and stream format"),
+ .long_name = NULL_IF_CONFIG_SMALL("TechnoTrend PVA"),
.priv_data_size = sizeof(PVAContext),
.read_probe = pva_probe,
.read_header = pva_read_header,
.read_packet = pva_read_packet,
- .read_timestamp = pva_read_timestamp
+ .read_timestamp = pva_read_timestamp,
};
diff --git a/gst-libs/ext/libav/libavformat/qcp.c b/gst-libs/ext/libav/libavformat/qcp.c
index 191e9dd..30d362f 100644
--- a/gst-libs/ext/libav/libavformat/qcp.c
+++ b/gst-libs/ext/libav/libavformat/qcp.c
@@ -27,6 +27,7 @@
* http://tools.ietf.org/html/rfc3625
*/
+#include "libavutil/channel_layout.h"
#include "libavutil/intreadwrite.h"
#include "avformat.h"
@@ -80,7 +81,7 @@ static int qcp_probe(AVProbeData *pd)
return 0;
}
-static int qcp_read_header(AVFormatContext *s, AVFormatParameters *ap)
+static int qcp_read_header(AVFormatContext *s)
{
AVIOContext *pb = s->pb;
QCPContext *c = s->priv_data;
@@ -96,9 +97,10 @@ static int qcp_read_header(AVFormatContext *s, AVFormatParameters *ap)
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
st->codec->channels = 1;
+ st->codec->channel_layout = AV_CH_LAYOUT_MONO;
avio_read(pb, buf, 16);
if (is_qcelp_13k_guid(buf)) {
- st->codec->codec_id = CODEC_ID_QCELP;
+ st->codec->codec_id = AV_CODEC_ID_QCELP;
} else if (!memcmp(buf, guid_evrc, 16)) {
av_log(s, AV_LOG_ERROR, "EVRC codec is not supported.\n");
return AVERROR_PATCHWELCOME;
@@ -188,7 +190,7 @@ static int qcp_read_packet(AVFormatContext *s, AVPacket *pkt)
AVInputFormat ff_qcp_demuxer = {
.name = "qcp",
- .long_name = NULL_IF_CONFIG_SMALL("QCP format"),
+ .long_name = NULL_IF_CONFIG_SMALL("QCP"),
.priv_data_size = sizeof(QCPContext),
.read_probe = qcp_probe,
.read_header = qcp_read_header,
diff --git a/gst-libs/ext/libav/libavformat/r3d.c b/gst-libs/ext/libav/libavformat/r3d.c
index 73e7398..a4cb20a 100644
--- a/gst-libs/ext/libav/libavformat/r3d.c
+++ b/gst-libs/ext/libav/libavformat/r3d.c
@@ -57,11 +57,12 @@ static int r3d_read_red1(AVFormatContext *s)
char filename[258];
int tmp;
int av_unused tmp2;
+ AVRational framerate;
if (!st)
return AVERROR(ENOMEM);
st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
- st->codec->codec_id = CODEC_ID_JPEG2000;
+ st->codec->codec_id = AV_CODEC_ID_JPEG2000;
tmp = avio_r8(s->pb); // major version
tmp2 = avio_r8(s->pb); // minor version
@@ -84,8 +85,14 @@ static int r3d_read_red1(AVFormatContext *s)
tmp = avio_rb16(s->pb); // unknown
av_dlog(s, "unknown2 %d\n", tmp);
- st->codec->time_base.den = avio_rb16(s->pb);
- st->codec->time_base.num = avio_rb16(s->pb);
+ framerate.num = avio_rb16(s->pb);
+ framerate.den = avio_rb16(s->pb);
+ if (framerate.num && framerate.den) {
+#if FF_API_R_FRAME_RATE
+ st->r_frame_rate =
+#endif
+ st->avg_frame_rate = framerate;
+ }
tmp = avio_r8(s->pb); // audio channels
av_dlog(s, "audio channels %d\n", tmp);
@@ -94,7 +101,7 @@ static int r3d_read_red1(AVFormatContext *s)
if (!ast)
return AVERROR(ENOMEM);
ast->codec->codec_type = AVMEDIA_TYPE_AUDIO;
- ast->codec->codec_id = CODEC_ID_PCM_S32BE;
+ ast->codec->codec_id = AV_CODEC_ID_PCM_S32BE;
ast->codec->channels = tmp;
avpriv_set_pts_info(ast, 32, 1, st->time_base.den);
}
@@ -107,7 +114,7 @@ static int r3d_read_red1(AVFormatContext *s)
av_dlog(s, "resolution %dx%d\n", st->codec->width, st->codec->height);
av_dlog(s, "timescale %d\n", st->time_base.den);
av_dlog(s, "frame rate %d/%d\n",
- st->codec->time_base.num, st->codec->time_base.den);
+ framerate.num, framerate.den);
return 0;
}
@@ -132,9 +139,11 @@ static int r3d_read_rdvo(AVFormatContext *s, Atom *atom)
av_dlog(s, "video offset %d: %#x\n", i, r3d->video_offsets[i]);
}
- if (st->codec->time_base.den)
- st->duration = (uint64_t)r3d->video_offsets_count*
- st->time_base.den*st->codec->time_base.num/st->codec->time_base.den;
+ if (st->avg_frame_rate.num)
+ st->duration = av_rescale_q(r3d->video_offsets_count,
+ (AVRational){st->avg_frame_rate.den,
+ st->avg_frame_rate.num},
+ st->time_base);
av_dlog(s, "duration %"PRId64"\n", st->duration);
return 0;
@@ -159,7 +168,7 @@ static void r3d_read_reos(AVFormatContext *s)
avio_skip(s->pb, 6*4);
}
-static int r3d_read_header(AVFormatContext *s, AVFormatParameters *ap)
+static int r3d_read_header(AVFormatContext *s)
{
R3DContext *r3d = s->priv_data;
Atom atom;
@@ -257,9 +266,9 @@ static int r3d_read_redv(AVFormatContext *s, AVPacket *pkt, Atom *atom)
pkt->stream_index = 0;
pkt->dts = dts;
- if (st->codec->time_base.den)
+ if (st->avg_frame_rate.num)
pkt->duration = (uint64_t)st->time_base.den*
- st->codec->time_base.num/st->codec->time_base.den;
+ st->avg_frame_rate.den/st->avg_frame_rate.num;
av_dlog(s, "pkt dts %"PRId64" duration %d\n", pkt->dts, pkt->duration);
return 0;
@@ -283,7 +292,7 @@ static int r3d_read_reda(AVFormatContext *s, AVPacket *pkt, Atom *atom)
tmp = avio_rb32(s->pb);
av_dlog(s, "packet num %d\n", tmp);
- tmp = avio_rb16(s->pb); // unkown
+ tmp = avio_rb16(s->pb); // unknown
av_dlog(s, "unknown %d\n", tmp);
tmp = avio_r8(s->pb); // major version
@@ -357,16 +366,17 @@ static int r3d_seek(AVFormatContext *s, int stream_index, int64_t sample_time, i
R3DContext *r3d = s->priv_data;
int frame_num;
- if (!st->codec->time_base.num || !st->time_base.den)
+ if (!st->avg_frame_rate.num)
return -1;
- frame_num = sample_time*st->codec->time_base.den/
- ((int64_t)st->codec->time_base.num*st->time_base.den);
+ frame_num = av_rescale_q(sample_time, st->time_base,
+ (AVRational){st->avg_frame_rate.den, st->avg_frame_rate.num});
av_dlog(s, "seek frame num %d timestamp %"PRId64"\n",
frame_num, sample_time);
if (frame_num < r3d->video_offsets_count) {
- avio_seek(s->pb, r3d->video_offsets_count, SEEK_SET);
+ if (avio_seek(s->pb, r3d->video_offsets_count, SEEK_SET) < 0)
+ return -1;
} else {
av_log(s, AV_LOG_ERROR, "could not seek to frame %d\n", frame_num);
return -1;
@@ -386,7 +396,7 @@ static int r3d_close(AVFormatContext *s)
AVInputFormat ff_r3d_demuxer = {
.name = "r3d",
- .long_name = NULL_IF_CONFIG_SMALL("REDCODE R3D format"),
+ .long_name = NULL_IF_CONFIG_SMALL("REDCODE R3D"),
.priv_data_size = sizeof(R3DContext),
.read_probe = r3d_probe,
.read_header = r3d_read_header,
diff --git a/gst-libs/ext/libav/libavformat/rawdec.c b/gst-libs/ext/libav/libavformat/rawdec.c
index 3e2dd05..5e95d10 100644
--- a/gst-libs/ext/libav/libavformat/rawdec.c
+++ b/gst-libs/ext/libav/libavformat/rawdec.c
@@ -28,76 +28,6 @@
#include "libavutil/parseutils.h"
#include "libavutil/pixdesc.h"
-/* raw input */
-int ff_raw_read_header(AVFormatContext *s, AVFormatParameters *ap)
-{
- AVStream *st;
- enum CodecID id;
-
- st = avformat_new_stream(s, NULL);
- if (!st)
- return AVERROR(ENOMEM);
-
- id = s->iformat->value;
- if (id == CODEC_ID_RAWVIDEO) {
- st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
- } else {
- st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
- }
- st->codec->codec_id = id;
-
- switch(st->codec->codec_type) {
- case AVMEDIA_TYPE_AUDIO: {
- RawAudioDemuxerContext *s1 = s->priv_data;
-
- st->codec->channels = 1;
-
- if (id == CODEC_ID_ADPCM_G722)
- st->codec->sample_rate = 16000;
-
- if (s1 && s1->sample_rate)
- st->codec->sample_rate = s1->sample_rate;
- if (s1 && s1->channels)
- st->codec->channels = s1->channels;
-
- st->codec->bits_per_coded_sample = av_get_bits_per_sample(st->codec->codec_id);
- assert(st->codec->bits_per_coded_sample > 0);
- st->codec->block_align = st->codec->bits_per_coded_sample*st->codec->channels/8;
- avpriv_set_pts_info(st, 64, 1, st->codec->sample_rate);
- break;
- }
- case AVMEDIA_TYPE_VIDEO: {
- FFRawVideoDemuxerContext *s1 = s->priv_data;
- int width = 0, height = 0, ret = 0;
- enum PixelFormat pix_fmt;
- AVRational framerate;
-
- if (s1->video_size && (ret = av_parse_video_size(&width, &height, s1->video_size)) < 0) {
- av_log(s, AV_LOG_ERROR, "Couldn't parse video size.\n");
- goto fail;
- }
- if ((pix_fmt = av_get_pix_fmt(s1->pixel_format)) == PIX_FMT_NONE) {
- av_log(s, AV_LOG_ERROR, "No such pixel format: %s.\n", s1->pixel_format);
- ret = AVERROR(EINVAL);
- goto fail;
- }
- if ((ret = av_parse_video_rate(&framerate, s1->framerate)) < 0) {
- av_log(s, AV_LOG_ERROR, "Could not parse framerate: %s.\n", s1->framerate);
- goto fail;
- }
- avpriv_set_pts_info(st, 64, framerate.den, framerate.num);
- st->codec->width = width;
- st->codec->height = height;
- st->codec->pix_fmt = pix_fmt;
-fail:
- return ret;
- }
- default:
- return -1;
- }
- return 0;
-}
-
#define RAW_PACKET_SIZE 1024
int ff_raw_read_partial_packet(AVFormatContext *s, AVPacket *pkt)
@@ -115,19 +45,22 @@ int ff_raw_read_partial_packet(AVFormatContext *s, AVPacket *pkt)
if (ret < 0) {
av_free_packet(pkt);
return ret;
+ } else if (ret < size) {
+ /* initialize end of packet for partial reads to avoid reading
+ * uninitialized data on allowed overreads */
+ memset(pkt->data + ret, 0, FF_INPUT_BUFFER_PADDING_SIZE);
}
pkt->size = ret;
return ret;
}
-int ff_raw_audio_read_header(AVFormatContext *s,
- AVFormatParameters *ap)
+int ff_raw_audio_read_header(AVFormatContext *s)
{
AVStream *st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
- st->codec->codec_id = s->iformat->value;
+ st->codec->codec_id = s->iformat->raw_codec_id;
st->need_parsing = AVSTREAM_PARSE_FULL;
st->start_time = 0;
/* the parameters will be extracted from the compressed bitstream */
@@ -136,8 +69,7 @@ int ff_raw_audio_read_header(AVFormatContext *s,
}
/* MPEG-1/H.263 input */
-int ff_raw_video_read_header(AVFormatContext *s,
- AVFormatParameters *ap)
+int ff_raw_video_read_header(AVFormatContext *s)
{
AVStream *st;
FFRawVideoDemuxerContext *s1 = s->priv_data;
@@ -152,7 +84,7 @@ int ff_raw_video_read_header(AVFormatContext *s,
}
st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
- st->codec->codec_id = s->iformat->value;
+ st->codec->codec_id = s->iformat->raw_codec_id;
st->need_parsing = AVSTREAM_PARSE_FULL;
if ((ret = av_parse_video_rate(&framerate, s1->framerate)) < 0) {
@@ -160,8 +92,11 @@ int ff_raw_video_read_header(AVFormatContext *s,
goto fail;
}
- st->r_frame_rate = st->avg_frame_rate = framerate;
- avpriv_set_pts_info(st, 64, 1, 1200000);
+#if FF_API_R_FRAME_RATE
+ st->r_frame_rate =
+#endif
+ st->avg_frame_rate = framerate;
+ avpriv_set_pts_info(st, 64, framerate.den, framerate.num);
fail:
return ret;
@@ -176,32 +111,20 @@ const AVOption ff_rawvideo_options[] = {
{ NULL },
};
-#if CONFIG_G722_DEMUXER
-AVInputFormat ff_g722_demuxer = {
- .name = "g722",
- .long_name = NULL_IF_CONFIG_SMALL("raw G.722"),
- .read_header = ff_raw_read_header,
- .read_packet = ff_raw_read_partial_packet,
- .flags= AVFMT_GENERIC_INDEX,
- .extensions = "g722,722",
- .value = CODEC_ID_ADPCM_G722,
-};
-#endif
-
#if CONFIG_LATM_DEMUXER
AVInputFormat ff_latm_demuxer = {
.name = "latm",
.long_name = NULL_IF_CONFIG_SMALL("raw LOAS/LATM"),
.read_header = ff_raw_audio_read_header,
.read_packet = ff_raw_read_partial_packet,
- .flags= AVFMT_GENERIC_INDEX,
- .extensions = "latm",
- .value = CODEC_ID_AAC_LATM,
+ .flags = AVFMT_GENERIC_INDEX,
+ .extensions = "latm",
+ .raw_codec_id = AV_CODEC_ID_AAC_LATM,
};
#endif
#if CONFIG_MJPEG_DEMUXER
-FF_DEF_RAWVIDEO_DEMUXER(mjpeg, "raw MJPEG video", NULL, "mjpg,mjpeg", CODEC_ID_MJPEG)
+FF_DEF_RAWVIDEO_DEMUXER(mjpeg, "raw MJPEG video", NULL, "mjpg,mjpeg", AV_CODEC_ID_MJPEG)
#endif
#if CONFIG_MLP_DEMUXER
@@ -210,9 +133,9 @@ AVInputFormat ff_mlp_demuxer = {
.long_name = NULL_IF_CONFIG_SMALL("raw MLP"),
.read_header = ff_raw_audio_read_header,
.read_packet = ff_raw_read_partial_packet,
- .flags= AVFMT_GENERIC_INDEX,
- .extensions = "mlp",
- .value = CODEC_ID_MLP,
+ .flags = AVFMT_GENERIC_INDEX,
+ .extensions = "mlp",
+ .raw_codec_id = AV_CODEC_ID_MLP,
};
#endif
@@ -222,9 +145,9 @@ AVInputFormat ff_truehd_demuxer = {
.long_name = NULL_IF_CONFIG_SMALL("raw TrueHD"),
.read_header = ff_raw_audio_read_header,
.read_packet = ff_raw_read_partial_packet,
- .flags= AVFMT_GENERIC_INDEX,
- .extensions = "thd",
- .value = CODEC_ID_TRUEHD,
+ .flags = AVFMT_GENERIC_INDEX,
+ .extensions = "thd",
+ .raw_codec_id = AV_CODEC_ID_TRUEHD,
};
#endif
@@ -235,11 +158,11 @@ AVInputFormat ff_shorten_demuxer = {
.read_header = ff_raw_audio_read_header,
.read_packet = ff_raw_read_partial_packet,
.flags = AVFMT_NOBINSEARCH | AVFMT_NOGENSEARCH | AVFMT_NO_BYTE_SEEK,
- .extensions = "shn",
- .value = CODEC_ID_SHORTEN,
+ .extensions = "shn",
+ .raw_codec_id = AV_CODEC_ID_SHORTEN,
};
#endif
#if CONFIG_VC1_DEMUXER
-FF_DEF_RAWVIDEO_DEMUXER(vc1, "raw VC-1", NULL, "vc1", CODEC_ID_VC1)
+FF_DEF_RAWVIDEO_DEMUXER(vc1, "raw VC-1", NULL, "vc1", AV_CODEC_ID_VC1)
#endif
diff --git a/gst-libs/ext/libav/libavformat/rawdec.h b/gst-libs/ext/libav/libavformat/rawdec.h
index 136f6c2..a548778 100644
--- a/gst-libs/ext/libav/libavformat/rawdec.h
+++ b/gst-libs/ext/libav/libavformat/rawdec.h
@@ -26,12 +26,6 @@
#include "libavutil/log.h"
#include "libavutil/opt.h"
-typedef struct RawAudioDemuxerContext {
- AVClass *class;
- int sample_rate;
- int channels;
-} RawAudioDemuxerContext;
-
typedef struct FFRawVideoDemuxerContext {
const AVClass *class; /**< Class for private options. */
char *video_size; /**< String describing video size, set by a private option. */
@@ -41,13 +35,11 @@ typedef struct FFRawVideoDemuxerContext {
extern const AVOption ff_rawvideo_options[];
-int ff_raw_read_header(AVFormatContext *s, AVFormatParameters *ap);
-
int ff_raw_read_partial_packet(AVFormatContext *s, AVPacket *pkt);
-int ff_raw_audio_read_header(AVFormatContext *s, AVFormatParameters *ap);
+int ff_raw_audio_read_header(AVFormatContext *s);
-int ff_raw_video_read_header(AVFormatContext *s, AVFormatParameters *ap);
+int ff_raw_video_read_header(AVFormatContext *s);
#define FF_RAWVIDEO_DEMUXER_CLASS(name)\
static const AVClass name ## _demuxer_class = {\
@@ -67,7 +59,7 @@ AVInputFormat ff_ ## shortname ## _demuxer = {\
.read_packet = ff_raw_read_partial_packet,\
.extensions = ext,\
.flags = AVFMT_GENERIC_INDEX,\
- .value = id,\
+ .raw_codec_id = id,\
.priv_data_size = sizeof(FFRawVideoDemuxerContext),\
.priv_class = &shortname ## _demuxer_class,\
};
diff --git a/gst-libs/ext/libav/libavformat/rawenc.c b/gst-libs/ext/libav/libavformat/rawenc.c
index 6e9f4b7..171c603 100644
--- a/gst-libs/ext/libav/libavformat/rawenc.c
+++ b/gst-libs/ext/libav/libavformat/rawenc.c
@@ -38,10 +38,10 @@ AVOutputFormat ff_ac3_muxer = {
.long_name = NULL_IF_CONFIG_SMALL("raw AC-3"),
.mime_type = "audio/x-ac3",
.extensions = "ac3",
- .audio_codec = CODEC_ID_AC3,
- .video_codec = CODEC_ID_NONE,
+ .audio_codec = AV_CODEC_ID_AC3,
+ .video_codec = AV_CODEC_ID_NONE,
.write_packet = ff_raw_write_packet,
- .flags= AVFMT_NOTIMESTAMPS,
+ .flags = AVFMT_NOTIMESTAMPS,
};
#endif
@@ -50,8 +50,20 @@ AVOutputFormat ff_adx_muxer = {
.name = "adx",
.long_name = NULL_IF_CONFIG_SMALL("CRI ADX"),
.extensions = "adx",
- .audio_codec = CODEC_ID_ADPCM_ADX,
- .video_codec = CODEC_ID_NONE,
+ .audio_codec = AV_CODEC_ID_ADPCM_ADX,
+ .video_codec = AV_CODEC_ID_NONE,
+ .write_packet = ff_raw_write_packet,
+ .flags = AVFMT_NOTIMESTAMPS,
+};
+#endif
+
+#if CONFIG_CAVSVIDEO_MUXER
+AVOutputFormat ff_cavsvideo_muxer = {
+ .name = "cavsvideo",
+ .long_name = NULL_IF_CONFIG_SMALL("raw Chinese AVS (Audio Video Standard) video"),
+ .extensions = "cavs",
+ .audio_codec = AV_CODEC_ID_NONE,
+ .video_codec = AV_CODEC_ID_CAVS,
.write_packet = ff_raw_write_packet,
.flags = AVFMT_NOTIMESTAMPS,
};
@@ -62,10 +74,10 @@ AVOutputFormat ff_dirac_muxer = {
.name = "dirac",
.long_name = NULL_IF_CONFIG_SMALL("raw Dirac"),
.extensions = "drc",
- .audio_codec = CODEC_ID_NONE,
- .video_codec = CODEC_ID_DIRAC,
+ .audio_codec = AV_CODEC_ID_NONE,
+ .video_codec = AV_CODEC_ID_DIRAC,
.write_packet = ff_raw_write_packet,
- .flags= AVFMT_NOTIMESTAMPS,
+ .flags = AVFMT_NOTIMESTAMPS,
};
#endif
@@ -74,10 +86,10 @@ AVOutputFormat ff_dnxhd_muxer = {
.name = "dnxhd",
.long_name = NULL_IF_CONFIG_SMALL("raw DNxHD (SMPTE VC-3)"),
.extensions = "dnxhd",
- .audio_codec = CODEC_ID_NONE,
- .video_codec = CODEC_ID_DNXHD,
+ .audio_codec = AV_CODEC_ID_NONE,
+ .video_codec = AV_CODEC_ID_DNXHD,
.write_packet = ff_raw_write_packet,
- .flags= AVFMT_NOTIMESTAMPS,
+ .flags = AVFMT_NOTIMESTAMPS,
};
#endif
@@ -87,10 +99,10 @@ AVOutputFormat ff_dts_muxer = {
.long_name = NULL_IF_CONFIG_SMALL("raw DTS"),
.mime_type = "audio/x-dca",
.extensions = "dts",
- .audio_codec = CODEC_ID_DTS,
- .video_codec = CODEC_ID_NONE,
+ .audio_codec = AV_CODEC_ID_DTS,
+ .video_codec = AV_CODEC_ID_NONE,
.write_packet = ff_raw_write_packet,
- .flags= AVFMT_NOTIMESTAMPS,
+ .flags = AVFMT_NOTIMESTAMPS,
};
#endif
@@ -100,10 +112,10 @@ AVOutputFormat ff_eac3_muxer = {
.long_name = NULL_IF_CONFIG_SMALL("raw E-AC-3"),
.mime_type = "audio/x-eac3",
.extensions = "eac3",
- .audio_codec = CODEC_ID_EAC3,
- .video_codec = CODEC_ID_NONE,
+ .audio_codec = AV_CODEC_ID_EAC3,
+ .video_codec = AV_CODEC_ID_NONE,
.write_packet = ff_raw_write_packet,
- .flags= AVFMT_NOTIMESTAMPS,
+ .flags = AVFMT_NOTIMESTAMPS,
};
#endif
@@ -113,10 +125,10 @@ AVOutputFormat ff_g722_muxer = {
.long_name = NULL_IF_CONFIG_SMALL("raw G.722"),
.mime_type = "audio/G722",
.extensions = "g722",
- .audio_codec = CODEC_ID_ADPCM_G722,
- .video_codec = CODEC_ID_NONE,
+ .audio_codec = AV_CODEC_ID_ADPCM_G722,
+ .video_codec = AV_CODEC_ID_NONE,
.write_packet = ff_raw_write_packet,
- .flags= AVFMT_NOTIMESTAMPS,
+ .flags = AVFMT_NOTIMESTAMPS,
};
#endif
@@ -126,10 +138,10 @@ AVOutputFormat ff_h261_muxer = {
.long_name = NULL_IF_CONFIG_SMALL("raw H.261"),
.mime_type = "video/x-h261",
.extensions = "h261",
- .audio_codec = CODEC_ID_NONE,
- .video_codec = CODEC_ID_H261,
+ .audio_codec = AV_CODEC_ID_NONE,
+ .video_codec = AV_CODEC_ID_H261,
.write_packet = ff_raw_write_packet,
- .flags= AVFMT_NOTIMESTAMPS,
+ .flags = AVFMT_NOTIMESTAMPS,
};
#endif
@@ -139,46 +151,34 @@ AVOutputFormat ff_h263_muxer = {
.long_name = NULL_IF_CONFIG_SMALL("raw H.263"),
.mime_type = "video/x-h263",
.extensions = "h263",
- .audio_codec = CODEC_ID_NONE,
- .video_codec = CODEC_ID_H263,
+ .audio_codec = AV_CODEC_ID_NONE,
+ .video_codec = AV_CODEC_ID_H263,
.write_packet = ff_raw_write_packet,
- .flags= AVFMT_NOTIMESTAMPS,
+ .flags = AVFMT_NOTIMESTAMPS,
};
#endif
#if CONFIG_H264_MUXER
AVOutputFormat ff_h264_muxer = {
.name = "h264",
- .long_name = NULL_IF_CONFIG_SMALL("raw H.264 video format"),
+ .long_name = NULL_IF_CONFIG_SMALL("raw H.264 video"),
.extensions = "h264",
- .audio_codec = CODEC_ID_NONE,
- .video_codec = CODEC_ID_H264,
- .write_packet = ff_raw_write_packet,
- .flags= AVFMT_NOTIMESTAMPS,
-};
-#endif
-
-#if CONFIG_CAVSVIDEO_MUXER
-AVOutputFormat ff_cavsvideo_muxer = {
- .name = "cavsvideo",
- .long_name = NULL_IF_CONFIG_SMALL("raw Chinese AVS video"),
- .extensions = "cavs",
- .audio_codec = CODEC_ID_NONE,
- .video_codec = CODEC_ID_CAVS,
+ .audio_codec = AV_CODEC_ID_NONE,
+ .video_codec = AV_CODEC_ID_H264,
.write_packet = ff_raw_write_packet,
- .flags= AVFMT_NOTIMESTAMPS,
+ .flags = AVFMT_NOTIMESTAMPS,
};
#endif
#if CONFIG_M4V_MUXER
AVOutputFormat ff_m4v_muxer = {
.name = "m4v",
- .long_name = NULL_IF_CONFIG_SMALL("raw MPEG-4 video format"),
+ .long_name = NULL_IF_CONFIG_SMALL("raw MPEG-4 video"),
.extensions = "m4v",
- .audio_codec = CODEC_ID_NONE,
- .video_codec = CODEC_ID_MPEG4,
+ .audio_codec = AV_CODEC_ID_NONE,
+ .video_codec = AV_CODEC_ID_MPEG4,
.write_packet = ff_raw_write_packet,
- .flags= AVFMT_NOTIMESTAMPS,
+ .flags = AVFMT_NOTIMESTAMPS,
};
#endif
@@ -188,10 +188,10 @@ AVOutputFormat ff_mjpeg_muxer = {
.long_name = NULL_IF_CONFIG_SMALL("raw MJPEG video"),
.mime_type = "video/x-mjpeg",
.extensions = "mjpg,mjpeg",
- .audio_codec = CODEC_ID_NONE,
- .video_codec = CODEC_ID_MJPEG,
+ .audio_codec = AV_CODEC_ID_NONE,
+ .video_codec = AV_CODEC_ID_MJPEG,
.write_packet = ff_raw_write_packet,
- .flags= AVFMT_NOTIMESTAMPS,
+ .flags = AVFMT_NOTIMESTAMPS,
};
#endif
@@ -200,34 +200,10 @@ AVOutputFormat ff_mlp_muxer = {
.name = "mlp",
.long_name = NULL_IF_CONFIG_SMALL("raw MLP"),
.extensions = "mlp",
- .audio_codec = CODEC_ID_MLP,
- .video_codec = CODEC_ID_NONE,
+ .audio_codec = AV_CODEC_ID_MLP,
+ .video_codec = AV_CODEC_ID_NONE,
.write_packet = ff_raw_write_packet,
- .flags= AVFMT_NOTIMESTAMPS,
-};
-#endif
-
-#if CONFIG_SRT_MUXER
-AVOutputFormat ff_srt_muxer = {
- .name = "srt",
- .long_name = NULL_IF_CONFIG_SMALL("SubRip subtitle format"),
- .mime_type = "application/x-subrip",
- .extensions = "srt",
- .write_packet = ff_raw_write_packet,
- .flags = AVFMT_NOTIMESTAMPS,
- .subtitle_codec = CODEC_ID_SRT,
-};
-#endif
-
-#if CONFIG_TRUEHD_MUXER
-AVOutputFormat ff_truehd_muxer = {
- .name = "truehd",
- .long_name = NULL_IF_CONFIG_SMALL("raw TrueHD"),
- .extensions = "thd",
- .audio_codec = CODEC_ID_TRUEHD,
- .video_codec = CODEC_ID_NONE,
- .write_packet = ff_raw_write_packet,
- .flags= AVFMT_NOTIMESTAMPS,
+ .flags = AVFMT_NOTIMESTAMPS,
};
#endif
@@ -237,10 +213,10 @@ AVOutputFormat ff_mpeg1video_muxer = {
.long_name = NULL_IF_CONFIG_SMALL("raw MPEG-1 video"),
.mime_type = "video/x-mpeg",
.extensions = "mpg,mpeg,m1v",
- .audio_codec = CODEC_ID_NONE,
- .video_codec = CODEC_ID_MPEG1VIDEO,
+ .audio_codec = AV_CODEC_ID_NONE,
+ .video_codec = AV_CODEC_ID_MPEG1VIDEO,
.write_packet = ff_raw_write_packet,
- .flags= AVFMT_NOTIMESTAMPS,
+ .flags = AVFMT_NOTIMESTAMPS,
};
#endif
@@ -249,21 +225,45 @@ AVOutputFormat ff_mpeg2video_muxer = {
.name = "mpeg2video",
.long_name = NULL_IF_CONFIG_SMALL("raw MPEG-2 video"),
.extensions = "m2v",
- .audio_codec = CODEC_ID_NONE,
- .video_codec = CODEC_ID_MPEG2VIDEO,
+ .audio_codec = AV_CODEC_ID_NONE,
+ .video_codec = AV_CODEC_ID_MPEG2VIDEO,
.write_packet = ff_raw_write_packet,
- .flags= AVFMT_NOTIMESTAMPS,
+ .flags = AVFMT_NOTIMESTAMPS,
};
#endif
#if CONFIG_RAWVIDEO_MUXER
AVOutputFormat ff_rawvideo_muxer = {
.name = "rawvideo",
- .long_name = NULL_IF_CONFIG_SMALL("raw video format"),
+ .long_name = NULL_IF_CONFIG_SMALL("raw video"),
.extensions = "yuv,rgb",
- .audio_codec = CODEC_ID_NONE,
- .video_codec = CODEC_ID_RAWVIDEO,
+ .audio_codec = AV_CODEC_ID_NONE,
+ .video_codec = AV_CODEC_ID_RAWVIDEO,
.write_packet = ff_raw_write_packet,
- .flags= AVFMT_NOTIMESTAMPS,
+ .flags = AVFMT_NOTIMESTAMPS,
+};
+#endif
+
+#if CONFIG_SRT_MUXER
+AVOutputFormat ff_srt_muxer = {
+ .name = "srt",
+ .long_name = NULL_IF_CONFIG_SMALL("SubRip subtitle"),
+ .mime_type = "application/x-subrip",
+ .extensions = "srt",
+ .write_packet = ff_raw_write_packet,
+ .flags = AVFMT_NOTIMESTAMPS,
+ .subtitle_codec = AV_CODEC_ID_SRT,
+};
+#endif
+
+#if CONFIG_TRUEHD_MUXER
+AVOutputFormat ff_truehd_muxer = {
+ .name = "truehd",
+ .long_name = NULL_IF_CONFIG_SMALL("raw TrueHD"),
+ .extensions = "thd",
+ .audio_codec = AV_CODEC_ID_TRUEHD,
+ .video_codec = AV_CODEC_ID_NONE,
+ .write_packet = ff_raw_write_packet,
+ .flags = AVFMT_NOTIMESTAMPS,
};
#endif
diff --git a/gst-libs/ext/libav/libavformat/rawvideodec.c b/gst-libs/ext/libav/libavformat/rawvideodec.c
index 6ca17d5..5f372c9 100644
--- a/gst-libs/ext/libav/libavformat/rawvideodec.c
+++ b/gst-libs/ext/libav/libavformat/rawvideodec.c
@@ -19,8 +19,63 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "libavutil/parseutils.h"
+#include "libavutil/pixdesc.h"
+#include "libavutil/opt.h"
+#include "internal.h"
#include "avformat.h"
-#include "rawdec.h"
+
+typedef struct RawVideoDemuxerContext {
+ const AVClass *class; /**< Class for private options. */
+ char *video_size; /**< String describing video size, set by a private option. */
+ char *pixel_format; /**< Set by a private option. */
+ char *framerate; /**< String describing framerate, set by a private option. */
+} RawVideoDemuxerContext;
+
+
+static int rawvideo_read_header(AVFormatContext *ctx)
+{
+ RawVideoDemuxerContext *s = ctx->priv_data;
+ int width = 0, height = 0, ret = 0;
+ enum AVPixelFormat pix_fmt;
+ AVRational framerate;
+ AVStream *st;
+
+ st = avformat_new_stream(ctx, NULL);
+ if (!st)
+ return AVERROR(ENOMEM);
+
+ st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
+
+ st->codec->codec_id = ctx->iformat->raw_codec_id;
+
+ if (s->video_size &&
+ (ret = av_parse_video_size(&width, &height, s->video_size)) < 0) {
+ av_log(ctx, AV_LOG_ERROR, "Couldn't parse video size.\n");
+ return ret;
+ }
+
+ if ((pix_fmt = av_get_pix_fmt(s->pixel_format)) == AV_PIX_FMT_NONE) {
+ av_log(ctx, AV_LOG_ERROR, "No such pixel format: %s.\n",
+ s->pixel_format);
+ return AVERROR(EINVAL);
+ }
+
+ if ((ret = av_parse_video_rate(&framerate, s->framerate)) < 0) {
+ av_log(ctx, AV_LOG_ERROR, "Could not parse framerate: %s.\n",
+ s->framerate);
+ return ret;
+ }
+
+ avpriv_set_pts_info(st, 64, framerate.den, framerate.num);
+
+ st->codec->width = width;
+ st->codec->height = height;
+ st->codec->pix_fmt = pix_fmt;
+
+ return 0;
+}
+
static int rawvideo_read_packet(AVFormatContext *s, AVPacket *pkt)
{
@@ -34,9 +89,8 @@ static int rawvideo_read_packet(AVFormatContext *s, AVPacket *pkt)
if (packet_size < 0)
return -1;
- ret= av_get_packet(s->pb, pkt, packet_size);
- pkt->pts=
- pkt->dts= pkt->pos / packet_size;
+ ret = av_get_packet(s->pb, pkt, packet_size);
+ pkt->pts = pkt->dts = pkt->pos / packet_size;
pkt->stream_index = 0;
if (ret < 0)
@@ -44,7 +98,7 @@ static int rawvideo_read_packet(AVFormatContext *s, AVPacket *pkt)
return 0;
}
-#define OFFSET(x) offsetof(FFRawVideoDemuxerContext, x)
+#define OFFSET(x) offsetof(RawVideoDemuxerContext, 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), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, DEC },
@@ -62,12 +116,12 @@ static const AVClass rawvideo_demuxer_class = {
AVInputFormat ff_rawvideo_demuxer = {
.name = "rawvideo",
- .long_name = NULL_IF_CONFIG_SMALL("raw video format"),
- .priv_data_size = sizeof(FFRawVideoDemuxerContext),
- .read_header = ff_raw_read_header,
+ .long_name = NULL_IF_CONFIG_SMALL("raw video"),
+ .priv_data_size = sizeof(RawVideoDemuxerContext),
+ .read_header = rawvideo_read_header,
.read_packet = rawvideo_read_packet,
- .flags= AVFMT_GENERIC_INDEX,
- .extensions = "yuv,cif,qcif,rgb",
- .value = CODEC_ID_RAWVIDEO,
- .priv_class = &rawvideo_demuxer_class,
+ .flags = AVFMT_GENERIC_INDEX,
+ .extensions = "yuv,cif,qcif,rgb",
+ .raw_codec_id = AV_CODEC_ID_RAWVIDEO,
+ .priv_class = &rawvideo_demuxer_class,
};
diff --git a/gst-libs/ext/libav/libavformat/rdt.c b/gst-libs/ext/libav/libavformat/rdt.c
index 207fc92..77c1c8c 100644
--- a/gst-libs/ext/libav/libavformat/rdt.c
+++ b/gst-libs/ext/libav/libavformat/rdt.c
@@ -293,7 +293,7 @@ ff_rdt_parse_header(const uint8_t *buf, int len,
static int
rdt_parse_packet (AVFormatContext *ctx, PayloadContext *rdt, AVStream *st,
AVPacket *pkt, uint32_t *timestamp,
- const uint8_t *buf, int len, int flags)
+ const uint8_t *buf, int len, uint16_t rtp_seq, int flags)
{
int seq = 1, res;
AVIOContext pb;
@@ -309,7 +309,7 @@ rdt_parse_packet (AVFormatContext *ctx, PayloadContext *rdt, AVStream *st,
if (res < 0)
return res;
if (res > 0) {
- if (st->codec->codec_id == CODEC_ID_AAC) {
+ if (st->codec->codec_id == AV_CODEC_ID_AAC) {
memcpy (rdt->buffer, buf + pos, len - pos);
rdt->rmctx->pb = avio_alloc_context (rdt->buffer, len - pos, 0,
NULL, NULL, NULL, NULL);
@@ -322,7 +322,7 @@ get_cache:
ff_rm_retrieve_cache (rdt->rmctx, rdt->rmctx->pb,
st, rdt->rmst[st->index], pkt);
if (rdt->audio_pkt_cnt == 0 &&
- st->codec->codec_id == CODEC_ID_AAC)
+ st->codec->codec_id == AV_CODEC_ID_AAC)
av_freep(&rdt->rmctx->pb);
}
pkt->stream_index = st->index;
@@ -348,7 +348,7 @@ ff_rdt_parse_packet(RDTDemuxContext *s, AVPacket *pkt,
timestamp= 0; ///< Should not be used if buf is NULL, but should be set to the timestamp of the packet returned....
rv= s->parse_packet(s->ic, s->dynamic_protocol_context,
s->streams[s->prev_stream_id],
- pkt, &timestamp, NULL, 0, flags);
+ pkt, &timestamp, NULL, 0, 0, flags);
return rv;
}
@@ -375,7 +375,7 @@ ff_rdt_parse_packet(RDTDemuxContext *s, AVPacket *pkt,
rv = s->parse_packet(s->ic, s->dynamic_protocol_context,
s->streams[s->prev_stream_id],
- pkt, &timestamp, buf, len, flags);
+ pkt, &timestamp, buf, len, 0, flags);
return rv;
}
@@ -432,9 +432,6 @@ rdt_parse_sdp_line (AVFormatContext *s, int st_index,
}
rdt->rmst[s->streams[n]->index] = ff_rm_alloc_rmstream();
rdt_load_mdpr(rdt, s->streams[n], (n - first) * 2);
-
- if (s->streams[n]->codec->codec_id == CODEC_ID_AAC)
- s->streams[n]->codec->frame_size = 1; // FIXME
}
}
@@ -554,7 +551,7 @@ rdt_free_context (PayloadContext *rdt)
static RTPDynamicProtocolHandler ff_rdt_ ## n ## _handler = { \
.enc_name = s, \
.codec_type = t, \
- .codec_id = CODEC_ID_NONE, \
+ .codec_id = AV_CODEC_ID_NONE, \
.parse_sdp_a_line = rdt_parse_sdp_line, \
.alloc = rdt_new_context, \
.free = rdt_free_context, \
diff --git a/gst-libs/ext/libav/libavformat/riff.c b/gst-libs/ext/libav/libavformat/riff.c
index 4caac80..e9463c0 100644
--- a/gst-libs/ext/libav/libavformat/riff.c
+++ b/gst-libs/ext/libav/libavformat/riff.c
@@ -1,5 +1,5 @@
/*
- * RIFF codec tags
+ * RIFF common functions and data
* Copyright (c) 2000 Fabrice Bellard
*
* This file is part of Libav.
@@ -29,318 +29,321 @@
/* Note: when encoding, the first matching tag is used, so order is
important if multiple tags possible for a given codec. */
const AVCodecTag ff_codec_bmp_tags[] = {
- { CODEC_ID_H264, MKTAG('H', '2', '6', '4') },
- { CODEC_ID_H264, MKTAG('h', '2', '6', '4') },
- { CODEC_ID_H264, MKTAG('X', '2', '6', '4') },
- { CODEC_ID_H264, MKTAG('x', '2', '6', '4') },
- { CODEC_ID_H264, MKTAG('a', 'v', 'c', '1') },
- { CODEC_ID_H264, MKTAG('D', 'A', 'V', 'C') },
- { CODEC_ID_H264, MKTAG('V', 'S', 'S', 'H') },
- { CODEC_ID_H263, MKTAG('H', '2', '6', '3') },
- { CODEC_ID_H263, MKTAG('X', '2', '6', '3') },
- { CODEC_ID_H263, MKTAG('T', '2', '6', '3') },
- { CODEC_ID_H263, MKTAG('L', '2', '6', '3') },
- { CODEC_ID_H263, MKTAG('V', 'X', '1', 'K') },
- { CODEC_ID_H263, MKTAG('Z', 'y', 'G', 'o') },
- { CODEC_ID_H263, MKTAG('M', '2', '6', '3') },
- { CODEC_ID_H263P, MKTAG('H', '2', '6', '3') },
- { CODEC_ID_H263I, MKTAG('I', '2', '6', '3') }, /* intel h263 */
- { CODEC_ID_H261, MKTAG('H', '2', '6', '1') },
- { CODEC_ID_H263P, MKTAG('U', '2', '6', '3') },
- { CODEC_ID_H263P, MKTAG('v', 'i', 'v', '1') },
- { CODEC_ID_MPEG4, MKTAG('F', 'M', 'P', '4') },
- { CODEC_ID_MPEG4, MKTAG('D', 'I', 'V', 'X') },
- { CODEC_ID_MPEG4, MKTAG('D', 'X', '5', '0') },
- { CODEC_ID_MPEG4, MKTAG('X', 'V', 'I', 'D') },
- { CODEC_ID_MPEG4, MKTAG('M', 'P', '4', 'S') },
- { CODEC_ID_MPEG4, MKTAG('M', '4', 'S', '2') },
- { CODEC_ID_MPEG4, MKTAG( 4 , 0 , 0 , 0 ) }, /* some broken avi use this */
- { CODEC_ID_MPEG4, MKTAG('D', 'I', 'V', '1') },
- { CODEC_ID_MPEG4, MKTAG('B', 'L', 'Z', '0') },
- { CODEC_ID_MPEG4, MKTAG('m', 'p', '4', 'v') },
- { CODEC_ID_MPEG4, MKTAG('U', 'M', 'P', '4') },
- { CODEC_ID_MPEG4, MKTAG('W', 'V', '1', 'F') },
- { CODEC_ID_MPEG4, MKTAG('S', 'E', 'D', 'G') },
- { CODEC_ID_MPEG4, MKTAG('R', 'M', 'P', '4') },
- { CODEC_ID_MPEG4, MKTAG('3', 'I', 'V', '2') },
- { CODEC_ID_MPEG4, MKTAG('W', 'A', 'W', 'V') }, /* WaWv MPEG-4 Video Codec */
- { CODEC_ID_MPEG4, MKTAG('F', 'F', 'D', 'S') },
- { CODEC_ID_MPEG4, MKTAG('F', 'V', 'F', 'W') },
- { CODEC_ID_MPEG4, MKTAG('D', 'C', 'O', 'D') },
- { CODEC_ID_MPEG4, MKTAG('M', 'V', 'X', 'M') },
- { CODEC_ID_MPEG4, MKTAG('P', 'M', '4', 'V') },
- { CODEC_ID_MPEG4, MKTAG('S', 'M', 'P', '4') },
- { CODEC_ID_MPEG4, MKTAG('D', 'X', 'G', 'M') },
- { CODEC_ID_MPEG4, MKTAG('V', 'I', 'D', 'M') },
- { CODEC_ID_MPEG4, MKTAG('M', '4', 'T', '3') },
- { CODEC_ID_MPEG4, MKTAG('G', 'E', 'O', 'X') },
- { CODEC_ID_MPEG4, MKTAG('H', 'D', 'X', '4') }, /* flipped video */
- { CODEC_ID_MPEG4, MKTAG('D', 'M', 'K', '2') },
- { CODEC_ID_MPEG4, MKTAG('D', 'I', 'G', 'I') },
- { CODEC_ID_MPEG4, MKTAG('I', 'N', 'M', 'C') },
- { CODEC_ID_MPEG4, MKTAG('E', 'P', 'H', 'V') }, /* Ephv MPEG-4 */
- { CODEC_ID_MPEG4, MKTAG('E', 'M', '4', 'A') },
- { CODEC_ID_MPEG4, MKTAG('M', '4', 'C', 'C') }, /* Divio MPEG-4 */
- { CODEC_ID_MPEG4, MKTAG('S', 'N', '4', '0') },
- { CODEC_ID_MPEG4, MKTAG('V', 'S', 'P', 'X') },
- { CODEC_ID_MPEG4, MKTAG('U', 'L', 'D', 'X') },
- { CODEC_ID_MPEG4, MKTAG('G', 'E', 'O', 'V') },
- { CODEC_ID_MPEG4, MKTAG('S', 'I', 'P', 'P') }, /* Samsung SHR-6040 */
- { CODEC_ID_MPEG4, MKTAG('X', 'V', 'I', 'X') },
- { CODEC_ID_MPEG4, MKTAG('D', 'r', 'e', 'X') },
- { CODEC_ID_MSMPEG4V3, MKTAG('M', 'P', '4', '3') },
- { CODEC_ID_MSMPEG4V3, MKTAG('D', 'I', 'V', '3') },
- { CODEC_ID_MSMPEG4V3, MKTAG('M', 'P', 'G', '3') },
- { CODEC_ID_MSMPEG4V3, MKTAG('D', 'I', 'V', '5') },
- { CODEC_ID_MSMPEG4V3, MKTAG('D', 'I', 'V', '6') },
- { CODEC_ID_MSMPEG4V3, MKTAG('D', 'I', 'V', '4') },
- { CODEC_ID_MSMPEG4V3, MKTAG('D', 'V', 'X', '3') },
- { CODEC_ID_MSMPEG4V3, MKTAG('A', 'P', '4', '1') },
- { CODEC_ID_MSMPEG4V3, MKTAG('C', 'O', 'L', '1') },
- { CODEC_ID_MSMPEG4V3, MKTAG('C', 'O', 'L', '0') },
- { CODEC_ID_MSMPEG4V2, MKTAG('M', 'P', '4', '2') },
- { CODEC_ID_MSMPEG4V2, MKTAG('D', 'I', 'V', '2') },
- { CODEC_ID_MSMPEG4V1, MKTAG('M', 'P', 'G', '4') },
- { CODEC_ID_MSMPEG4V1, MKTAG('M', 'P', '4', '1') },
- { CODEC_ID_WMV1, MKTAG('W', 'M', 'V', '1') },
- { CODEC_ID_WMV2, MKTAG('W', 'M', 'V', '2') },
- { CODEC_ID_DVVIDEO, MKTAG('d', 'v', 's', 'd') },
- { CODEC_ID_DVVIDEO, MKTAG('d', 'v', 'h', 'd') },
- { CODEC_ID_DVVIDEO, MKTAG('d', 'v', 'h', '1') },
- { CODEC_ID_DVVIDEO, MKTAG('d', 'v', 's', 'l') },
- { CODEC_ID_DVVIDEO, MKTAG('d', 'v', '2', '5') },
- { CODEC_ID_DVVIDEO, MKTAG('d', 'v', '5', '0') },
- { CODEC_ID_DVVIDEO, MKTAG('c', 'd', 'v', 'c') }, /* Canopus DV */
- { CODEC_ID_DVVIDEO, MKTAG('C', 'D', 'V', 'H') }, /* Canopus DV */
- { CODEC_ID_DVVIDEO, MKTAG('C', 'D', 'V', '5') }, /* Canopus DV */
- { CODEC_ID_DVVIDEO, MKTAG('d', 'v', 'c', ' ') },
- { CODEC_ID_DVVIDEO, MKTAG('d', 'v', 'c', 's') },
- { CODEC_ID_DVVIDEO, MKTAG('d', 'v', 'h', '1') },
- { CODEC_ID_MPEG1VIDEO, MKTAG('m', 'p', 'g', '1') },
- { CODEC_ID_MPEG1VIDEO, MKTAG('m', 'p', 'g', '2') },
- { CODEC_ID_MPEG2VIDEO, MKTAG('m', 'p', 'g', '2') },
- { CODEC_ID_MPEG2VIDEO, MKTAG('M', 'P', 'E', 'G') },
- { CODEC_ID_MPEG1VIDEO, MKTAG('P', 'I', 'M', '1') },
- { CODEC_ID_MPEG2VIDEO, MKTAG('P', 'I', 'M', '2') },
- { CODEC_ID_MPEG1VIDEO, MKTAG('V', 'C', 'R', '2') },
- { CODEC_ID_MPEG1VIDEO, MKTAG( 1 , 0 , 0 , 16) },
- { CODEC_ID_MPEG2VIDEO, MKTAG( 2 , 0 , 0 , 16) },
- { CODEC_ID_MPEG4, MKTAG( 4 , 0 , 0 , 16) },
- { CODEC_ID_MPEG2VIDEO, MKTAG('D', 'V', 'R', ' ') },
- { CODEC_ID_MPEG2VIDEO, MKTAG('M', 'M', 'E', 'S') },
- { CODEC_ID_MPEG2VIDEO, MKTAG('L', 'M', 'P', '2') }, /* Lead MPEG2 in avi */
- { CODEC_ID_MPEG2VIDEO, MKTAG('s', 'l', 'i', 'f') },
- { CODEC_ID_MPEG2VIDEO, MKTAG('E', 'M', '2', 'V') },
- { CODEC_ID_MPEG2VIDEO, MKTAG('M', '7', '0', '1') }, /* Matrox MPEG2 intra-only */
- { CODEC_ID_MPEG2VIDEO, MKTAG('m', 'p', 'g', 'v') },
- { CODEC_ID_MJPEG, MKTAG('M', 'J', 'P', 'G') },
- { CODEC_ID_MJPEG, MKTAG('L', 'J', 'P', 'G') },
- { CODEC_ID_MJPEG, MKTAG('d', 'm', 'b', '1') },
- { CODEC_ID_MJPEG, MKTAG('m', 'j', 'p', 'a') },
- { CODEC_ID_LJPEG, MKTAG('L', 'J', 'P', 'G') },
- { CODEC_ID_MJPEG, MKTAG('J', 'P', 'G', 'L') }, /* Pegasus lossless JPEG */
- { CODEC_ID_JPEGLS, MKTAG('M', 'J', 'L', 'S') }, /* JPEG-LS custom FOURCC for avi - encoder */
- { CODEC_ID_JPEGLS, MKTAG('M', 'J', 'P', 'G') },
- { CODEC_ID_MJPEG, MKTAG('M', 'J', 'L', 'S') }, /* JPEG-LS custom FOURCC for avi - decoder */
- { CODEC_ID_MJPEG, MKTAG('j', 'p', 'e', 'g') },
- { CODEC_ID_MJPEG, MKTAG('I', 'J', 'P', 'G') },
- { CODEC_ID_MJPEG, MKTAG('A', 'V', 'R', 'n') },
- { CODEC_ID_MJPEG, MKTAG('A', 'C', 'D', 'V') },
- { CODEC_ID_MJPEG, MKTAG('Q', 'I', 'V', 'G') },
- { CODEC_ID_MJPEG, MKTAG('S', 'L', 'M', 'J') }, /* SL M-JPEG */
- { CODEC_ID_MJPEG, MKTAG('C', 'J', 'P', 'G') }, /* Creative Webcam JPEG */
- { CODEC_ID_MJPEG, MKTAG('I', 'J', 'L', 'V') }, /* Intel JPEG Library Video Codec */
- { CODEC_ID_MJPEG, MKTAG('M', 'V', 'J', 'P') }, /* Midvid JPEG Video Codec */
- { CODEC_ID_MJPEG, MKTAG('A', 'V', 'I', '1') },
- { CODEC_ID_MJPEG, MKTAG('A', 'V', 'I', '2') },
- { CODEC_ID_MJPEG, MKTAG('M', 'T', 'S', 'J') },
- { CODEC_ID_MJPEG, MKTAG('Z', 'J', 'P', 'G') }, /* Paradigm Matrix M-JPEG Codec */
- { CODEC_ID_MJPEG, MKTAG('M', 'M', 'J', 'P') },
- { CODEC_ID_HUFFYUV, MKTAG('H', 'F', 'Y', 'U') },
- { CODEC_ID_FFVHUFF, MKTAG('F', 'F', 'V', 'H') },
- { CODEC_ID_CYUV, MKTAG('C', 'Y', 'U', 'V') },
- { CODEC_ID_RAWVIDEO, MKTAG( 0 , 0 , 0 , 0 ) },
- { CODEC_ID_RAWVIDEO, MKTAG( 3 , 0 , 0 , 0 ) },
- { CODEC_ID_RAWVIDEO, MKTAG('I', '4', '2', '0') },
- { CODEC_ID_RAWVIDEO, MKTAG('Y', 'U', 'Y', '2') },
- { CODEC_ID_RAWVIDEO, MKTAG('Y', '4', '2', '2') },
- { CODEC_ID_RAWVIDEO, MKTAG('V', '4', '2', '2') },
- { CODEC_ID_RAWVIDEO, MKTAG('Y', 'U', 'N', 'V') },
- { CODEC_ID_RAWVIDEO, MKTAG('U', 'Y', 'N', 'V') },
- { CODEC_ID_RAWVIDEO, MKTAG('U', 'Y', 'N', 'Y') },
- { CODEC_ID_RAWVIDEO, MKTAG('u', 'y', 'v', '1') },
- { CODEC_ID_RAWVIDEO, MKTAG('2', 'V', 'u', '1') },
- { CODEC_ID_RAWVIDEO, MKTAG('2', 'v', 'u', 'y') },
- { CODEC_ID_RAWVIDEO, MKTAG('y', 'u', 'v', 's') },
- { CODEC_ID_RAWVIDEO, MKTAG('y', 'u', 'v', '2') },
- { CODEC_ID_RAWVIDEO, MKTAG('P', '4', '2', '2') },
- { CODEC_ID_RAWVIDEO, MKTAG('Y', 'V', '1', '2') },
- { CODEC_ID_RAWVIDEO, MKTAG('Y', 'V', '1', '6') },
- { CODEC_ID_RAWVIDEO, MKTAG('Y', 'V', '2', '4') },
- { CODEC_ID_RAWVIDEO, MKTAG('U', 'Y', 'V', 'Y') },
- { CODEC_ID_RAWVIDEO, MKTAG('V', 'Y', 'U', 'Y') },
- { CODEC_ID_RAWVIDEO, MKTAG('I', 'Y', 'U', 'V') },
- { CODEC_ID_RAWVIDEO, MKTAG('Y', '8', '0', '0') },
- { CODEC_ID_RAWVIDEO, MKTAG('Y', '8', ' ', ' ') },
- { CODEC_ID_RAWVIDEO, MKTAG('H', 'D', 'Y', 'C') },
- { CODEC_ID_RAWVIDEO, MKTAG('Y', 'V', 'U', '9') },
- { CODEC_ID_RAWVIDEO, MKTAG('V', 'D', 'T', 'Z') }, /* SoftLab-NSK VideoTizer */
- { CODEC_ID_RAWVIDEO, MKTAG('Y', '4', '1', '1') },
- { CODEC_ID_RAWVIDEO, MKTAG('N', 'V', '1', '2') },
- { CODEC_ID_RAWVIDEO, MKTAG('N', 'V', '2', '1') },
- { CODEC_ID_RAWVIDEO, MKTAG('Y', '4', '1', 'B') },
- { CODEC_ID_RAWVIDEO, MKTAG('Y', '4', '2', 'B') },
- { CODEC_ID_RAWVIDEO, MKTAG('Y', 'U', 'V', '9') },
- { CODEC_ID_RAWVIDEO, MKTAG('Y', 'V', 'U', '9') },
- { CODEC_ID_RAWVIDEO, MKTAG('a', 'u', 'v', '2') },
- { CODEC_ID_FRWU, MKTAG('F', 'R', 'W', 'U') },
- { CODEC_ID_R10K, MKTAG('R', '1', '0', 'k') },
- { CODEC_ID_R210, MKTAG('r', '2', '1', '0') },
- { CODEC_ID_V210, MKTAG('v', '2', '1', '0') },
- { CODEC_ID_V410, MKTAG('v', '4', '1', '0') },
- { CODEC_ID_INDEO3, MKTAG('I', 'V', '3', '1') },
- { CODEC_ID_INDEO3, MKTAG('I', 'V', '3', '2') },
- { CODEC_ID_INDEO4, MKTAG('I', 'V', '4', '1') },
- { CODEC_ID_INDEO5, MKTAG('I', 'V', '5', '0') },
- { CODEC_ID_VP3, MKTAG('V', 'P', '3', '1') },
- { CODEC_ID_VP3, MKTAG('V', 'P', '3', '0') },
- { CODEC_ID_VP5, MKTAG('V', 'P', '5', '0') },
- { CODEC_ID_VP6, MKTAG('V', 'P', '6', '0') },
- { CODEC_ID_VP6, MKTAG('V', 'P', '6', '1') },
- { CODEC_ID_VP6, MKTAG('V', 'P', '6', '2') },
- { CODEC_ID_VP6F, MKTAG('V', 'P', '6', 'F') },
- { CODEC_ID_VP6F, MKTAG('F', 'L', 'V', '4') },
- { CODEC_ID_VP8, MKTAG('V', 'P', '8', '0') },
- { CODEC_ID_ASV1, MKTAG('A', 'S', 'V', '1') },
- { CODEC_ID_ASV2, MKTAG('A', 'S', 'V', '2') },
- { CODEC_ID_VCR1, MKTAG('V', 'C', 'R', '1') },
- { CODEC_ID_FFV1, MKTAG('F', 'F', 'V', '1') },
- { CODEC_ID_XAN_WC4, MKTAG('X', 'x', 'a', 'n') },
- { CODEC_ID_MIMIC, MKTAG('L', 'M', '2', '0') },
- { CODEC_ID_MSRLE, MKTAG('m', 'r', 'l', 'e') },
- { CODEC_ID_MSRLE, MKTAG( 1 , 0 , 0 , 0 ) },
- { CODEC_ID_MSRLE, MKTAG( 2 , 0 , 0 , 0 ) },
- { CODEC_ID_MSVIDEO1, MKTAG('M', 'S', 'V', 'C') },
- { CODEC_ID_MSVIDEO1, MKTAG('m', 's', 'v', 'c') },
- { CODEC_ID_MSVIDEO1, MKTAG('C', 'R', 'A', 'M') },
- { CODEC_ID_MSVIDEO1, MKTAG('c', 'r', 'a', 'm') },
- { CODEC_ID_MSVIDEO1, MKTAG('W', 'H', 'A', 'M') },
- { CODEC_ID_MSVIDEO1, MKTAG('w', 'h', 'a', 'm') },
- { CODEC_ID_CINEPAK, MKTAG('c', 'v', 'i', 'd') },
- { CODEC_ID_TRUEMOTION1, MKTAG('D', 'U', 'C', 'K') },
- { CODEC_ID_TRUEMOTION1, MKTAG('P', 'V', 'E', 'Z') },
- { CODEC_ID_MSZH, MKTAG('M', 'S', 'Z', 'H') },
- { CODEC_ID_ZLIB, MKTAG('Z', 'L', 'I', 'B') },
- { CODEC_ID_SNOW, MKTAG('S', 'N', 'O', 'W') },
- { CODEC_ID_4XM, MKTAG('4', 'X', 'M', 'V') },
- { CODEC_ID_FLV1, MKTAG('F', 'L', 'V', '1') },
- { CODEC_ID_FLASHSV, MKTAG('F', 'S', 'V', '1') },
- { CODEC_ID_SVQ1, MKTAG('s', 'v', 'q', '1') },
- { CODEC_ID_TSCC, MKTAG('t', 's', 'c', 'c') },
- { CODEC_ID_ULTI, MKTAG('U', 'L', 'T', 'I') },
- { CODEC_ID_VIXL, MKTAG('V', 'I', 'X', 'L') },
- { CODEC_ID_QPEG, MKTAG('Q', 'P', 'E', 'G') },
- { CODEC_ID_QPEG, MKTAG('Q', '1', '.', '0') },
- { CODEC_ID_QPEG, MKTAG('Q', '1', '.', '1') },
- { CODEC_ID_WMV3, MKTAG('W', 'M', 'V', '3') },
- { CODEC_ID_WMV3IMAGE, MKTAG('W', 'M', 'V', 'P') },
- { CODEC_ID_VC1, MKTAG('W', 'V', 'C', '1') },
- { CODEC_ID_VC1, MKTAG('W', 'M', 'V', 'A') },
- { CODEC_ID_VC1IMAGE, MKTAG('W', 'V', 'P', '2') },
- { CODEC_ID_LOCO, MKTAG('L', 'O', 'C', 'O') },
- { CODEC_ID_WNV1, MKTAG('W', 'N', 'V', '1') },
- { CODEC_ID_AASC, MKTAG('A', 'A', 'S', 'C') },
- { CODEC_ID_INDEO2, MKTAG('R', 'T', '2', '1') },
- { CODEC_ID_FRAPS, MKTAG('F', 'P', 'S', '1') },
- { CODEC_ID_THEORA, MKTAG('t', 'h', 'e', 'o') },
- { CODEC_ID_TRUEMOTION2, MKTAG('T', 'M', '2', '0') },
- { CODEC_ID_CSCD, MKTAG('C', 'S', 'C', 'D') },
- { CODEC_ID_ZMBV, MKTAG('Z', 'M', 'B', 'V') },
- { CODEC_ID_KMVC, MKTAG('K', 'M', 'V', 'C') },
- { CODEC_ID_CAVS, MKTAG('C', 'A', 'V', 'S') },
- { CODEC_ID_JPEG2000, MKTAG('m', 'j', 'p', '2') },
- { CODEC_ID_JPEG2000, MKTAG('M', 'J', '2', 'C') },
- { CODEC_ID_JPEG2000, MKTAG('L', 'J', '2', 'C') },
- { CODEC_ID_JPEG2000, MKTAG('L', 'J', '2', 'K') },
- { CODEC_ID_VMNC, MKTAG('V', 'M', 'n', 'c') },
- { CODEC_ID_TARGA, MKTAG('t', 'g', 'a', ' ') },
- { CODEC_ID_PNG, MKTAG('M', 'P', 'N', 'G') },
- { CODEC_ID_PNG, MKTAG('P', 'N', 'G', '1') },
- { CODEC_ID_CLJR, MKTAG('C', 'L', 'J', 'R') },
- { CODEC_ID_DIRAC, MKTAG('d', 'r', 'a', 'c') },
- { CODEC_ID_RPZA, MKTAG('a', 'z', 'p', 'r') },
- { CODEC_ID_RPZA, MKTAG('R', 'P', 'Z', 'A') },
- { CODEC_ID_RPZA, MKTAG('r', 'p', 'z', 'a') },
- { CODEC_ID_SP5X, MKTAG('S', 'P', '5', '4') },
- { CODEC_ID_AURA, MKTAG('A', 'U', 'R', 'A') },
- { CODEC_ID_AURA2, MKTAG('A', 'U', 'R', '2') },
- { CODEC_ID_DPX, MKTAG('d', 'p', 'x', ' ') },
- { CODEC_ID_KGV1, MKTAG('K', 'G', 'V', '1') },
- { CODEC_ID_LAGARITH, MKTAG('L', 'A', 'G', 'S') },
- { CODEC_ID_UTVIDEO, MKTAG('U', 'L', 'R', 'A') },
- { CODEC_ID_UTVIDEO, MKTAG('U', 'L', 'R', 'G') },
- { CODEC_ID_UTVIDEO, MKTAG('U', 'L', 'Y', '0') },
- { CODEC_ID_UTVIDEO, MKTAG('U', 'L', 'Y', '2') },
- { CODEC_ID_VBLE, MKTAG('V', 'B', 'L', 'E') },
- { CODEC_ID_DXTORY, MKTAG('x', 't', 'o', 'r') },
- { CODEC_ID_NONE, 0 }
+ { AV_CODEC_ID_H264, MKTAG('H', '2', '6', '4') },
+ { AV_CODEC_ID_H264, MKTAG('h', '2', '6', '4') },
+ { AV_CODEC_ID_H264, MKTAG('X', '2', '6', '4') },
+ { AV_CODEC_ID_H264, MKTAG('x', '2', '6', '4') },
+ { AV_CODEC_ID_H264, MKTAG('a', 'v', 'c', '1') },
+ { AV_CODEC_ID_H264, MKTAG('D', 'A', 'V', 'C') },
+ { AV_CODEC_ID_H264, MKTAG('V', 'S', 'S', 'H') },
+ { AV_CODEC_ID_H263, MKTAG('H', '2', '6', '3') },
+ { AV_CODEC_ID_H263, MKTAG('X', '2', '6', '3') },
+ { AV_CODEC_ID_H263, MKTAG('T', '2', '6', '3') },
+ { AV_CODEC_ID_H263, MKTAG('L', '2', '6', '3') },
+ { AV_CODEC_ID_H263, MKTAG('V', 'X', '1', 'K') },
+ { AV_CODEC_ID_H263, MKTAG('Z', 'y', 'G', 'o') },
+ { AV_CODEC_ID_H263, MKTAG('M', '2', '6', '3') },
+ { AV_CODEC_ID_H263P, MKTAG('H', '2', '6', '3') },
+ { AV_CODEC_ID_H263I, MKTAG('I', '2', '6', '3') }, /* intel h263 */
+ { AV_CODEC_ID_H261, MKTAG('H', '2', '6', '1') },
+ { AV_CODEC_ID_H263P, MKTAG('U', '2', '6', '3') },
+ { AV_CODEC_ID_H263P, MKTAG('v', 'i', 'v', '1') },
+ { AV_CODEC_ID_MPEG4, MKTAG('F', 'M', 'P', '4') },
+ { AV_CODEC_ID_MPEG4, MKTAG('D', 'I', 'V', 'X') },
+ { AV_CODEC_ID_MPEG4, MKTAG('D', 'X', '5', '0') },
+ { AV_CODEC_ID_MPEG4, MKTAG('X', 'V', 'I', 'D') },
+ { AV_CODEC_ID_MPEG4, MKTAG('M', 'P', '4', 'S') },
+ { AV_CODEC_ID_MPEG4, MKTAG('M', '4', 'S', '2') },
+ { AV_CODEC_ID_MPEG4, MKTAG( 4 , 0 , 0 , 0 ) }, /* some broken avi use this */
+ { AV_CODEC_ID_MPEG4, MKTAG('D', 'I', 'V', '1') },
+ { AV_CODEC_ID_MPEG4, MKTAG('B', 'L', 'Z', '0') },
+ { AV_CODEC_ID_MPEG4, MKTAG('m', 'p', '4', 'v') },
+ { AV_CODEC_ID_MPEG4, MKTAG('U', 'M', 'P', '4') },
+ { AV_CODEC_ID_MPEG4, MKTAG('W', 'V', '1', 'F') },
+ { AV_CODEC_ID_MPEG4, MKTAG('S', 'E', 'D', 'G') },
+ { AV_CODEC_ID_MPEG4, MKTAG('R', 'M', 'P', '4') },
+ { AV_CODEC_ID_MPEG4, MKTAG('3', 'I', 'V', '2') },
+ { AV_CODEC_ID_MPEG4, MKTAG('W', 'A', 'W', 'V') }, /* WaWv MPEG-4 Video Codec */
+ { AV_CODEC_ID_MPEG4, MKTAG('F', 'F', 'D', 'S') },
+ { AV_CODEC_ID_MPEG4, MKTAG('F', 'V', 'F', 'W') },
+ { AV_CODEC_ID_MPEG4, MKTAG('D', 'C', 'O', 'D') },
+ { AV_CODEC_ID_MPEG4, MKTAG('M', 'V', 'X', 'M') },
+ { AV_CODEC_ID_MPEG4, MKTAG('P', 'M', '4', 'V') },
+ { AV_CODEC_ID_MPEG4, MKTAG('S', 'M', 'P', '4') },
+ { AV_CODEC_ID_MPEG4, MKTAG('D', 'X', 'G', 'M') },
+ { AV_CODEC_ID_MPEG4, MKTAG('V', 'I', 'D', 'M') },
+ { AV_CODEC_ID_MPEG4, MKTAG('M', '4', 'T', '3') },
+ { AV_CODEC_ID_MPEG4, MKTAG('G', 'E', 'O', 'X') },
+ { AV_CODEC_ID_MPEG4, MKTAG('H', 'D', 'X', '4') }, /* flipped video */
+ { AV_CODEC_ID_MPEG4, MKTAG('D', 'M', 'K', '2') },
+ { AV_CODEC_ID_MPEG4, MKTAG('D', 'I', 'G', 'I') },
+ { AV_CODEC_ID_MPEG4, MKTAG('I', 'N', 'M', 'C') },
+ { AV_CODEC_ID_MPEG4, MKTAG('E', 'P', 'H', 'V') }, /* Ephv MPEG-4 */
+ { AV_CODEC_ID_MPEG4, MKTAG('E', 'M', '4', 'A') },
+ { AV_CODEC_ID_MPEG4, MKTAG('M', '4', 'C', 'C') }, /* Divio MPEG-4 */
+ { AV_CODEC_ID_MPEG4, MKTAG('S', 'N', '4', '0') },
+ { AV_CODEC_ID_MPEG4, MKTAG('V', 'S', 'P', 'X') },
+ { AV_CODEC_ID_MPEG4, MKTAG('U', 'L', 'D', 'X') },
+ { AV_CODEC_ID_MPEG4, MKTAG('G', 'E', 'O', 'V') },
+ { AV_CODEC_ID_MPEG4, MKTAG('S', 'I', 'P', 'P') }, /* Samsung SHR-6040 */
+ { AV_CODEC_ID_MPEG4, MKTAG('X', 'V', 'I', 'X') },
+ { AV_CODEC_ID_MPEG4, MKTAG('D', 'r', 'e', 'X') },
+ { AV_CODEC_ID_MSMPEG4V3, MKTAG('M', 'P', '4', '3') },
+ { AV_CODEC_ID_MSMPEG4V3, MKTAG('D', 'I', 'V', '3') },
+ { AV_CODEC_ID_MSMPEG4V3, MKTAG('M', 'P', 'G', '3') },
+ { AV_CODEC_ID_MSMPEG4V3, MKTAG('D', 'I', 'V', '5') },
+ { AV_CODEC_ID_MSMPEG4V3, MKTAG('D', 'I', 'V', '6') },
+ { AV_CODEC_ID_MSMPEG4V3, MKTAG('D', 'I', 'V', '4') },
+ { AV_CODEC_ID_MSMPEG4V3, MKTAG('D', 'V', 'X', '3') },
+ { AV_CODEC_ID_MSMPEG4V3, MKTAG('A', 'P', '4', '1') },
+ { AV_CODEC_ID_MSMPEG4V3, MKTAG('C', 'O', 'L', '1') },
+ { AV_CODEC_ID_MSMPEG4V3, MKTAG('C', 'O', 'L', '0') },
+ { AV_CODEC_ID_MSMPEG4V2, MKTAG('M', 'P', '4', '2') },
+ { AV_CODEC_ID_MSMPEG4V2, MKTAG('D', 'I', 'V', '2') },
+ { AV_CODEC_ID_MSMPEG4V1, MKTAG('M', 'P', 'G', '4') },
+ { AV_CODEC_ID_MSMPEG4V1, MKTAG('M', 'P', '4', '1') },
+ { AV_CODEC_ID_WMV1, MKTAG('W', 'M', 'V', '1') },
+ { AV_CODEC_ID_WMV2, MKTAG('W', 'M', 'V', '2') },
+ { AV_CODEC_ID_DVVIDEO, MKTAG('d', 'v', 's', 'd') },
+ { AV_CODEC_ID_DVVIDEO, MKTAG('d', 'v', 'h', 'd') },
+ { AV_CODEC_ID_DVVIDEO, MKTAG('d', 'v', 'h', '1') },
+ { AV_CODEC_ID_DVVIDEO, MKTAG('d', 'v', 's', 'l') },
+ { AV_CODEC_ID_DVVIDEO, MKTAG('d', 'v', '2', '5') },
+ { AV_CODEC_ID_DVVIDEO, MKTAG('d', 'v', '5', '0') },
+ { AV_CODEC_ID_DVVIDEO, MKTAG('c', 'd', 'v', 'c') }, /* Canopus DV */
+ { AV_CODEC_ID_DVVIDEO, MKTAG('C', 'D', 'V', 'H') }, /* Canopus DV */
+ { AV_CODEC_ID_DVVIDEO, MKTAG('C', 'D', 'V', '5') }, /* Canopus DV */
+ { AV_CODEC_ID_DVVIDEO, MKTAG('d', 'v', 'c', ' ') },
+ { AV_CODEC_ID_DVVIDEO, MKTAG('d', 'v', 'c', 's') },
+ { AV_CODEC_ID_DVVIDEO, MKTAG('d', 'v', 'h', '1') },
+ { AV_CODEC_ID_MPEG1VIDEO, MKTAG('m', 'p', 'g', '1') },
+ { AV_CODEC_ID_MPEG1VIDEO, MKTAG('m', 'p', 'g', '2') },
+ { AV_CODEC_ID_MPEG2VIDEO, MKTAG('m', 'p', 'g', '2') },
+ { AV_CODEC_ID_MPEG2VIDEO, MKTAG('M', 'P', 'E', 'G') },
+ { AV_CODEC_ID_MPEG1VIDEO, MKTAG('P', 'I', 'M', '1') },
+ { AV_CODEC_ID_MPEG2VIDEO, MKTAG('P', 'I', 'M', '2') },
+ { AV_CODEC_ID_MPEG1VIDEO, MKTAG('V', 'C', 'R', '2') },
+ { AV_CODEC_ID_MPEG1VIDEO, MKTAG( 1 , 0 , 0 , 16) },
+ { AV_CODEC_ID_MPEG2VIDEO, MKTAG( 2 , 0 , 0 , 16) },
+ { AV_CODEC_ID_MPEG4, MKTAG( 4 , 0 , 0 , 16) },
+ { AV_CODEC_ID_MPEG2VIDEO, MKTAG('D', 'V', 'R', ' ') },
+ { AV_CODEC_ID_MPEG2VIDEO, MKTAG('M', 'M', 'E', 'S') },
+ { AV_CODEC_ID_MPEG2VIDEO, MKTAG('L', 'M', 'P', '2') }, /* Lead MPEG2 in avi */
+ { AV_CODEC_ID_MPEG2VIDEO, MKTAG('s', 'l', 'i', 'f') },
+ { AV_CODEC_ID_MPEG2VIDEO, MKTAG('E', 'M', '2', 'V') },
+ { AV_CODEC_ID_MPEG2VIDEO, MKTAG('M', '7', '0', '1') }, /* Matrox MPEG2 intra-only */
+ { AV_CODEC_ID_MPEG2VIDEO, MKTAG('m', 'p', 'g', 'v') },
+ { AV_CODEC_ID_MJPEG, MKTAG('M', 'J', 'P', 'G') },
+ { AV_CODEC_ID_MJPEG, MKTAG('L', 'J', 'P', 'G') },
+ { AV_CODEC_ID_MJPEG, MKTAG('d', 'm', 'b', '1') },
+ { AV_CODEC_ID_MJPEG, MKTAG('m', 'j', 'p', 'a') },
+ { AV_CODEC_ID_LJPEG, MKTAG('L', 'J', 'P', 'G') },
+ { AV_CODEC_ID_MJPEG, MKTAG('J', 'P', 'G', 'L') }, /* Pegasus lossless JPEG */
+ { AV_CODEC_ID_JPEGLS, MKTAG('M', 'J', 'L', 'S') }, /* JPEG-LS custom FOURCC for avi - encoder */
+ { AV_CODEC_ID_JPEGLS, MKTAG('M', 'J', 'P', 'G') },
+ { AV_CODEC_ID_MJPEG, MKTAG('M', 'J', 'L', 'S') }, /* JPEG-LS custom FOURCC for avi - decoder */
+ { AV_CODEC_ID_MJPEG, MKTAG('j', 'p', 'e', 'g') },
+ { AV_CODEC_ID_MJPEG, MKTAG('I', 'J', 'P', 'G') },
+ { AV_CODEC_ID_MJPEG, MKTAG('A', 'V', 'R', 'n') },
+ { AV_CODEC_ID_MJPEG, MKTAG('A', 'C', 'D', 'V') },
+ { AV_CODEC_ID_MJPEG, MKTAG('Q', 'I', 'V', 'G') },
+ { AV_CODEC_ID_MJPEG, MKTAG('S', 'L', 'M', 'J') }, /* SL M-JPEG */
+ { AV_CODEC_ID_MJPEG, MKTAG('C', 'J', 'P', 'G') }, /* Creative Webcam JPEG */
+ { AV_CODEC_ID_MJPEG, MKTAG('I', 'J', 'L', 'V') }, /* Intel JPEG Library Video Codec */
+ { AV_CODEC_ID_MJPEG, MKTAG('M', 'V', 'J', 'P') }, /* Midvid JPEG Video Codec */
+ { AV_CODEC_ID_MJPEG, MKTAG('A', 'V', 'I', '1') },
+ { AV_CODEC_ID_MJPEG, MKTAG('A', 'V', 'I', '2') },
+ { AV_CODEC_ID_MJPEG, MKTAG('M', 'T', 'S', 'J') },
+ { AV_CODEC_ID_MJPEG, MKTAG('Z', 'J', 'P', 'G') }, /* Paradigm Matrix M-JPEG Codec */
+ { AV_CODEC_ID_MJPEG, MKTAG('M', 'M', 'J', 'P') },
+ { AV_CODEC_ID_HUFFYUV, MKTAG('H', 'F', 'Y', 'U') },
+ { AV_CODEC_ID_FFVHUFF, MKTAG('F', 'F', 'V', 'H') },
+ { AV_CODEC_ID_CYUV, MKTAG('C', 'Y', 'U', 'V') },
+ { AV_CODEC_ID_RAWVIDEO, MKTAG( 0 , 0 , 0 , 0 ) },
+ { AV_CODEC_ID_RAWVIDEO, MKTAG( 3 , 0 , 0 , 0 ) },
+ { AV_CODEC_ID_RAWVIDEO, MKTAG('I', '4', '2', '0') },
+ { AV_CODEC_ID_RAWVIDEO, MKTAG('Y', 'U', 'Y', '2') },
+ { AV_CODEC_ID_RAWVIDEO, MKTAG('Y', '4', '2', '2') },
+ { AV_CODEC_ID_RAWVIDEO, MKTAG('V', '4', '2', '2') },
+ { AV_CODEC_ID_RAWVIDEO, MKTAG('Y', 'U', 'N', 'V') },
+ { AV_CODEC_ID_RAWVIDEO, MKTAG('U', 'Y', 'N', 'V') },
+ { AV_CODEC_ID_RAWVIDEO, MKTAG('U', 'Y', 'N', 'Y') },
+ { AV_CODEC_ID_RAWVIDEO, MKTAG('u', 'y', 'v', '1') },
+ { AV_CODEC_ID_RAWVIDEO, MKTAG('2', 'V', 'u', '1') },
+ { AV_CODEC_ID_RAWVIDEO, MKTAG('2', 'v', 'u', 'y') },
+ { AV_CODEC_ID_RAWVIDEO, MKTAG('y', 'u', 'v', 's') },
+ { AV_CODEC_ID_RAWVIDEO, MKTAG('y', 'u', 'v', '2') },
+ { AV_CODEC_ID_RAWVIDEO, MKTAG('P', '4', '2', '2') },
+ { AV_CODEC_ID_RAWVIDEO, MKTAG('Y', 'V', '1', '2') },
+ { AV_CODEC_ID_RAWVIDEO, MKTAG('Y', 'V', '1', '6') },
+ { AV_CODEC_ID_RAWVIDEO, MKTAG('Y', 'V', '2', '4') },
+ { AV_CODEC_ID_RAWVIDEO, MKTAG('U', 'Y', 'V', 'Y') },
+ { AV_CODEC_ID_RAWVIDEO, MKTAG('V', 'Y', 'U', 'Y') },
+ { AV_CODEC_ID_RAWVIDEO, MKTAG('I', 'Y', 'U', 'V') },
+ { AV_CODEC_ID_RAWVIDEO, MKTAG('Y', '8', '0', '0') },
+ { AV_CODEC_ID_RAWVIDEO, MKTAG('Y', '8', ' ', ' ') },
+ { AV_CODEC_ID_RAWVIDEO, MKTAG('H', 'D', 'Y', 'C') },
+ { AV_CODEC_ID_RAWVIDEO, MKTAG('Y', 'V', 'U', '9') },
+ { AV_CODEC_ID_RAWVIDEO, MKTAG('V', 'D', 'T', 'Z') }, /* SoftLab-NSK VideoTizer */
+ { AV_CODEC_ID_RAWVIDEO, MKTAG('Y', '4', '1', '1') },
+ { AV_CODEC_ID_RAWVIDEO, MKTAG('N', 'V', '1', '2') },
+ { AV_CODEC_ID_RAWVIDEO, MKTAG('N', 'V', '2', '1') },
+ { AV_CODEC_ID_RAWVIDEO, MKTAG('Y', '4', '1', 'B') },
+ { AV_CODEC_ID_RAWVIDEO, MKTAG('Y', '4', '2', 'B') },
+ { AV_CODEC_ID_RAWVIDEO, MKTAG('Y', 'U', 'V', '9') },
+ { AV_CODEC_ID_RAWVIDEO, MKTAG('Y', 'V', 'U', '9') },
+ { AV_CODEC_ID_RAWVIDEO, MKTAG('a', 'u', 'v', '2') },
+ { AV_CODEC_ID_FRWU, MKTAG('F', 'R', 'W', 'U') },
+ { AV_CODEC_ID_R10K, MKTAG('R', '1', '0', 'k') },
+ { AV_CODEC_ID_R210, MKTAG('r', '2', '1', '0') },
+ { AV_CODEC_ID_V210, MKTAG('v', '2', '1', '0') },
+ { AV_CODEC_ID_V410, MKTAG('v', '4', '1', '0') },
+ { AV_CODEC_ID_INDEO3, MKTAG('I', 'V', '3', '1') },
+ { AV_CODEC_ID_INDEO3, MKTAG('I', 'V', '3', '2') },
+ { AV_CODEC_ID_INDEO4, MKTAG('I', 'V', '4', '1') },
+ { AV_CODEC_ID_INDEO5, MKTAG('I', 'V', '5', '0') },
+ { AV_CODEC_ID_VP3, MKTAG('V', 'P', '3', '1') },
+ { AV_CODEC_ID_VP3, MKTAG('V', 'P', '3', '0') },
+ { AV_CODEC_ID_VP5, MKTAG('V', 'P', '5', '0') },
+ { AV_CODEC_ID_VP6, MKTAG('V', 'P', '6', '0') },
+ { AV_CODEC_ID_VP6, MKTAG('V', 'P', '6', '1') },
+ { AV_CODEC_ID_VP6, MKTAG('V', 'P', '6', '2') },
+ { AV_CODEC_ID_VP6F, MKTAG('V', 'P', '6', 'F') },
+ { AV_CODEC_ID_VP6F, MKTAG('F', 'L', 'V', '4') },
+ { AV_CODEC_ID_VP8, MKTAG('V', 'P', '8', '0') },
+ { AV_CODEC_ID_ASV1, MKTAG('A', 'S', 'V', '1') },
+ { AV_CODEC_ID_ASV2, MKTAG('A', 'S', 'V', '2') },
+ { AV_CODEC_ID_VCR1, MKTAG('V', 'C', 'R', '1') },
+ { AV_CODEC_ID_FFV1, MKTAG('F', 'F', 'V', '1') },
+ { AV_CODEC_ID_XAN_WC4, MKTAG('X', 'x', 'a', 'n') },
+ { AV_CODEC_ID_MIMIC, MKTAG('L', 'M', '2', '0') },
+ { AV_CODEC_ID_MSRLE, MKTAG('m', 'r', 'l', 'e') },
+ { AV_CODEC_ID_MSRLE, MKTAG( 1 , 0 , 0 , 0 ) },
+ { AV_CODEC_ID_MSRLE, MKTAG( 2 , 0 , 0 , 0 ) },
+ { AV_CODEC_ID_MSVIDEO1, MKTAG('M', 'S', 'V', 'C') },
+ { AV_CODEC_ID_MSVIDEO1, MKTAG('m', 's', 'v', 'c') },
+ { AV_CODEC_ID_MSVIDEO1, MKTAG('C', 'R', 'A', 'M') },
+ { AV_CODEC_ID_MSVIDEO1, MKTAG('c', 'r', 'a', 'm') },
+ { AV_CODEC_ID_MSVIDEO1, MKTAG('W', 'H', 'A', 'M') },
+ { AV_CODEC_ID_MSVIDEO1, MKTAG('w', 'h', 'a', 'm') },
+ { AV_CODEC_ID_CINEPAK, MKTAG('c', 'v', 'i', 'd') },
+ { AV_CODEC_ID_TRUEMOTION1, MKTAG('D', 'U', 'C', 'K') },
+ { AV_CODEC_ID_TRUEMOTION1, MKTAG('P', 'V', 'E', 'Z') },
+ { AV_CODEC_ID_MSZH, MKTAG('M', 'S', 'Z', 'H') },
+ { AV_CODEC_ID_ZLIB, MKTAG('Z', 'L', 'I', 'B') },
+ { AV_CODEC_ID_SNOW, MKTAG('S', 'N', 'O', 'W') },
+ { AV_CODEC_ID_4XM, MKTAG('4', 'X', 'M', 'V') },
+ { AV_CODEC_ID_FLV1, MKTAG('F', 'L', 'V', '1') },
+ { AV_CODEC_ID_FLASHSV, MKTAG('F', 'S', 'V', '1') },
+ { AV_CODEC_ID_SVQ1, MKTAG('s', 'v', 'q', '1') },
+ { AV_CODEC_ID_TSCC, MKTAG('t', 's', 'c', 'c') },
+ { AV_CODEC_ID_ULTI, MKTAG('U', 'L', 'T', 'I') },
+ { AV_CODEC_ID_VIXL, MKTAG('V', 'I', 'X', 'L') },
+ { AV_CODEC_ID_QPEG, MKTAG('Q', 'P', 'E', 'G') },
+ { AV_CODEC_ID_QPEG, MKTAG('Q', '1', '.', '0') },
+ { AV_CODEC_ID_QPEG, MKTAG('Q', '1', '.', '1') },
+ { AV_CODEC_ID_WMV3, MKTAG('W', 'M', 'V', '3') },
+ { AV_CODEC_ID_WMV3IMAGE, MKTAG('W', 'M', 'V', 'P') },
+ { AV_CODEC_ID_VC1, MKTAG('W', 'V', 'C', '1') },
+ { AV_CODEC_ID_VC1, MKTAG('W', 'M', 'V', 'A') },
+ { AV_CODEC_ID_VC1IMAGE, MKTAG('W', 'V', 'P', '2') },
+ { AV_CODEC_ID_LOCO, MKTAG('L', 'O', 'C', 'O') },
+ { AV_CODEC_ID_WNV1, MKTAG('W', 'N', 'V', '1') },
+ { AV_CODEC_ID_AASC, MKTAG('A', 'A', 'S', 'C') },
+ { AV_CODEC_ID_INDEO2, MKTAG('R', 'T', '2', '1') },
+ { AV_CODEC_ID_FRAPS, MKTAG('F', 'P', 'S', '1') },
+ { AV_CODEC_ID_THEORA, MKTAG('t', 'h', 'e', 'o') },
+ { AV_CODEC_ID_TRUEMOTION2, MKTAG('T', 'M', '2', '0') },
+ { AV_CODEC_ID_CSCD, MKTAG('C', 'S', 'C', 'D') },
+ { AV_CODEC_ID_ZMBV, MKTAG('Z', 'M', 'B', 'V') },
+ { AV_CODEC_ID_KMVC, MKTAG('K', 'M', 'V', 'C') },
+ { AV_CODEC_ID_CAVS, MKTAG('C', 'A', 'V', 'S') },
+ { AV_CODEC_ID_JPEG2000, MKTAG('m', 'j', 'p', '2') },
+ { AV_CODEC_ID_JPEG2000, MKTAG('M', 'J', '2', 'C') },
+ { AV_CODEC_ID_JPEG2000, MKTAG('L', 'J', '2', 'C') },
+ { AV_CODEC_ID_JPEG2000, MKTAG('L', 'J', '2', 'K') },
+ { AV_CODEC_ID_VMNC, MKTAG('V', 'M', 'n', 'c') },
+ { AV_CODEC_ID_TARGA, MKTAG('t', 'g', 'a', ' ') },
+ { AV_CODEC_ID_PNG, MKTAG('M', 'P', 'N', 'G') },
+ { AV_CODEC_ID_PNG, MKTAG('P', 'N', 'G', '1') },
+ { AV_CODEC_ID_CLJR, MKTAG('C', 'L', 'J', 'R') },
+ { AV_CODEC_ID_DIRAC, MKTAG('d', 'r', 'a', 'c') },
+ { AV_CODEC_ID_RPZA, MKTAG('a', 'z', 'p', 'r') },
+ { AV_CODEC_ID_RPZA, MKTAG('R', 'P', 'Z', 'A') },
+ { AV_CODEC_ID_RPZA, MKTAG('r', 'p', 'z', 'a') },
+ { AV_CODEC_ID_SP5X, MKTAG('S', 'P', '5', '4') },
+ { AV_CODEC_ID_AURA, MKTAG('A', 'U', 'R', 'A') },
+ { AV_CODEC_ID_AURA2, MKTAG('A', 'U', 'R', '2') },
+ { AV_CODEC_ID_DPX, MKTAG('d', 'p', 'x', ' ') },
+ { AV_CODEC_ID_KGV1, MKTAG('K', 'G', 'V', '1') },
+ { AV_CODEC_ID_LAGARITH, MKTAG('L', 'A', 'G', 'S') },
+ { AV_CODEC_ID_UTVIDEO, MKTAG('U', 'L', 'R', 'A') },
+ { AV_CODEC_ID_UTVIDEO, MKTAG('U', 'L', 'R', 'G') },
+ { AV_CODEC_ID_UTVIDEO, MKTAG('U', 'L', 'Y', '0') },
+ { AV_CODEC_ID_UTVIDEO, MKTAG('U', 'L', 'Y', '2') },
+ { AV_CODEC_ID_VBLE, MKTAG('V', 'B', 'L', 'E') },
+ { AV_CODEC_ID_DXTORY, MKTAG('x', 't', 'o', 'r') },
+ { AV_CODEC_ID_ZEROCODEC, MKTAG('Z', 'E', 'C', 'O') },
+ { AV_CODEC_ID_MSS1, MKTAG('M', 'S', 'S', '1') },
+ { AV_CODEC_ID_MSA1, MKTAG('M', 'S', 'A', '1') },
+ { AV_CODEC_ID_TSCC2, MKTAG('T', 'S', 'C', '2') },
+ { AV_CODEC_ID_MTS2, MKTAG('M', 'T', 'S', '2') },
+ { AV_CODEC_ID_CLLC, MKTAG('C', 'L', 'L', 'C') },
+ { AV_CODEC_ID_MSS2, MKTAG('M', 'S', 'S', '2') },
+ { AV_CODEC_ID_SVQ3, MKTAG('S', 'V', 'Q', '3') },
+ { AV_CODEC_ID_NONE, 0 }
};
const AVCodecTag ff_codec_wav_tags[] = {
- { CODEC_ID_PCM_S16LE, 0x0001 },
- { CODEC_ID_PCM_U8, 0x0001 }, /* must come after s16le in this list */
- { CODEC_ID_PCM_S24LE, 0x0001 },
- { CODEC_ID_PCM_S32LE, 0x0001 },
- { CODEC_ID_ADPCM_MS, 0x0002 },
- { CODEC_ID_PCM_F32LE, 0x0003 },
- { CODEC_ID_PCM_F64LE, 0x0003 }, /* must come after f32le in this list */
- { CODEC_ID_PCM_ALAW, 0x0006 },
- { CODEC_ID_PCM_MULAW, 0x0007 },
- { CODEC_ID_WMAVOICE, 0x000A },
- { CODEC_ID_ADPCM_IMA_WAV, 0x0011 },
- { CODEC_ID_PCM_ZORK, 0x0011 }, /* must come after adpcm_ima_wav in this list */
- { CODEC_ID_ADPCM_YAMAHA, 0x0020 },
- { CODEC_ID_TRUESPEECH, 0x0022 },
- { CODEC_ID_GSM_MS, 0x0031 },
- { CODEC_ID_ADPCM_G726, 0x0045 },
- { CODEC_ID_MP2, 0x0050 },
- { CODEC_ID_MP3, 0x0055 },
- { CODEC_ID_AMR_NB, 0x0057 },
- { CODEC_ID_AMR_WB, 0x0058 },
- { CODEC_ID_ADPCM_IMA_DK4, 0x0061 }, /* rogue format number */
- { CODEC_ID_ADPCM_IMA_DK3, 0x0062 }, /* rogue format number */
- { CODEC_ID_ADPCM_IMA_WAV, 0x0069 },
- { CODEC_ID_VOXWARE, 0x0075 },
- { CODEC_ID_AAC, 0x00ff },
- { CODEC_ID_SIPR, 0x0130 },
- { CODEC_ID_WMAV1, 0x0160 },
- { CODEC_ID_WMAV2, 0x0161 },
- { CODEC_ID_WMAPRO, 0x0162 },
- { CODEC_ID_WMALOSSLESS, 0x0163 },
- { CODEC_ID_ADPCM_CT, 0x0200 },
- { CODEC_ID_ATRAC3, 0x0270 },
- { CODEC_ID_ADPCM_G722, 0x028F },
- { CODEC_ID_IMC, 0x0401 },
- { CODEC_ID_GSM_MS, 0x1500 },
- { CODEC_ID_TRUESPEECH, 0x1501 },
- { CODEC_ID_AAC, 0x1600 }, /* ADTS AAC */
- { CODEC_ID_AAC_LATM, 0x1602 },
- { CODEC_ID_AC3, 0x2000 },
- { CODEC_ID_DTS, 0x2001 },
- { CODEC_ID_PCM_MULAW, 0x6c75 },
- { CODEC_ID_AAC, 0x706d },
- { CODEC_ID_AAC, 0x4143 },
- { CODEC_ID_SPEEX, 0xA109 },
- { CODEC_ID_FLAC, 0xF1AC },
- { CODEC_ID_ADPCM_SWF, ('S'<<8)+'F' },
- { CODEC_ID_VORBIS, ('V'<<8)+'o' }, //HACK/FIXME, does vorbis in WAV/AVI have an (in)official id?
-
- /* FIXME: All of the IDs below are not 16 bit and thus illegal. */
- // for NuppelVideo (nuv.c)
- { CODEC_ID_PCM_S16LE, MKTAG('R', 'A', 'W', 'A') },
- { CODEC_ID_MP3, MKTAG('L', 'A', 'M', 'E') },
- { CODEC_ID_MP3, MKTAG('M', 'P', '3', ' ') },
- { CODEC_ID_NONE, 0 },
+ { AV_CODEC_ID_PCM_S16LE, 0x0001 },
+ { AV_CODEC_ID_PCM_U8, 0x0001 }, /* must come after s16le in this list */
+ { AV_CODEC_ID_PCM_S24LE, 0x0001 },
+ { AV_CODEC_ID_PCM_S32LE, 0x0001 },
+ { AV_CODEC_ID_ADPCM_MS, 0x0002 },
+ { AV_CODEC_ID_PCM_F32LE, 0x0003 },
+ { AV_CODEC_ID_PCM_F64LE, 0x0003 }, /* must come after f32le in this list */
+ { AV_CODEC_ID_PCM_ALAW, 0x0006 },
+ { AV_CODEC_ID_PCM_MULAW, 0x0007 },
+ { AV_CODEC_ID_WMAVOICE, 0x000A },
+ { AV_CODEC_ID_ADPCM_IMA_WAV, 0x0011 },
+ { AV_CODEC_ID_PCM_ZORK, 0x0011 }, /* must come after adpcm_ima_wav in this list */
+ { AV_CODEC_ID_ADPCM_YAMAHA, 0x0020 },
+ { AV_CODEC_ID_TRUESPEECH, 0x0022 },
+ { AV_CODEC_ID_GSM_MS, 0x0031 },
+ { AV_CODEC_ID_ADPCM_G726, 0x0045 },
+ { AV_CODEC_ID_MP2, 0x0050 },
+ { AV_CODEC_ID_MP3, 0x0055 },
+ { AV_CODEC_ID_AMR_NB, 0x0057 },
+ { AV_CODEC_ID_AMR_WB, 0x0058 },
+ { AV_CODEC_ID_ADPCM_IMA_DK4, 0x0061 }, /* rogue format number */
+ { AV_CODEC_ID_ADPCM_IMA_DK3, 0x0062 }, /* rogue format number */
+ { AV_CODEC_ID_ADPCM_IMA_WAV, 0x0069 },
+ { AV_CODEC_ID_VOXWARE, 0x0075 },
+ { AV_CODEC_ID_AAC, 0x00ff },
+ { AV_CODEC_ID_SIPR, 0x0130 },
+ { AV_CODEC_ID_WMAV1, 0x0160 },
+ { AV_CODEC_ID_WMAV2, 0x0161 },
+ { AV_CODEC_ID_WMAPRO, 0x0162 },
+ { AV_CODEC_ID_WMALOSSLESS, 0x0163 },
+ { AV_CODEC_ID_ADPCM_CT, 0x0200 },
+ { AV_CODEC_ID_ATRAC3, 0x0270 },
+ { AV_CODEC_ID_ADPCM_G722, 0x028F },
+ { AV_CODEC_ID_IMC, 0x0401 },
+ { AV_CODEC_ID_IAC, 0x0402 },
+ { AV_CODEC_ID_GSM_MS, 0x1500 },
+ { AV_CODEC_ID_TRUESPEECH, 0x1501 },
+ { AV_CODEC_ID_AAC, 0x1600 }, /* ADTS AAC */
+ { AV_CODEC_ID_AAC_LATM, 0x1602 },
+ { AV_CODEC_ID_AC3, 0x2000 },
+ { AV_CODEC_ID_DTS, 0x2001 },
+ { AV_CODEC_ID_PCM_MULAW, 0x6c75 },
+ { AV_CODEC_ID_AAC, 0x706d },
+ { AV_CODEC_ID_AAC, 0x4143 },
+ { AV_CODEC_ID_SPEEX, 0xA109 },
+ { AV_CODEC_ID_FLAC, 0xF1AC },
+ { AV_CODEC_ID_ADPCM_SWF, ('S'<<8)+'F' },
+ { AV_CODEC_ID_VORBIS, ('V'<<8)+'o' }, //HACK/FIXME, does vorbis in WAV/AVI have an (in)official id?
+ { AV_CODEC_ID_NONE, 0 },
};
const AVMetadataConv ff_riff_info_conv[] = {
@@ -358,13 +361,6 @@ const AVMetadataConv ff_riff_info_conv[] = {
{ 0 },
};
-const char ff_riff_tags[][5] = {
- "IARL", "IART", "ICMS", "ICMT", "ICOP", "ICRD", "ICRP", "IDIM", "IDPI",
- "IENG", "IGNR", "IKEY", "ILGT", "ILNG", "IMED", "INAM", "IPLT", "IPRD",
- "IPRT", "ISBJ", "ISFT", "ISHP", "ISRC", "ISRF", "ITCH",
- {0}
-};
-
#if CONFIG_MUXERS
int64_t ff_start_tag(AVIOContext *pb, const char *tag)
{
@@ -387,7 +383,7 @@ void ff_end_tag(AVIOContext *pb, int64_t start)
/* returns the size or -1 on error */
int ff_put_wav_header(AVIOContext *pb, AVCodecContext *enc)
{
- int bps, blkalign, bytespersec;
+ int bps, blkalign, bytespersec, frame_size;
int hdrsize = 18;
int waveformatextensible;
uint8_t temp[256];
@@ -396,6 +392,14 @@ int ff_put_wav_header(AVIOContext *pb, AVCodecContext *enc)
if(!enc->codec_tag || enc->codec_tag > 0xffff)
return -1;
+
+ /* We use the known constant frame size for the codec if known, otherwise
+ fallback to using AVCodecContext.frame_size, which is not as reliable
+ for indicating packet duration */
+ frame_size = av_get_audio_frame_duration(enc, 0);
+ if (!frame_size)
+ frame_size = enc->frame_size;
+
waveformatextensible = (enc->channels > 2 && enc->channel_layout)
|| enc->sample_rate > 48000
|| av_get_bits_per_sample(enc->codec_id) > 16;
@@ -407,7 +411,7 @@ int ff_put_wav_header(AVIOContext *pb, AVCodecContext *enc)
}
avio_wl16(pb, enc->channels);
avio_wl32(pb, enc->sample_rate);
- if (enc->codec_id == CODEC_ID_MP2 || enc->codec_id == CODEC_ID_MP3 || enc->codec_id == CODEC_ID_GSM_MS) {
+ if (enc->codec_id == AV_CODEC_ID_MP2 || enc->codec_id == AV_CODEC_ID_MP3 || enc->codec_id == AV_CODEC_ID_GSM_MS) {
bps = 0;
} else {
if (!(bps = av_get_bits_per_sample(enc->codec_id))) {
@@ -421,21 +425,23 @@ int ff_put_wav_header(AVIOContext *pb, AVCodecContext *enc)
av_log(enc, AV_LOG_WARNING, "requested bits_per_coded_sample (%d) and actually stored (%d) differ\n", enc->bits_per_coded_sample, bps);
}
- if (enc->codec_id == CODEC_ID_MP2 || enc->codec_id == CODEC_ID_MP3) {
- blkalign = enc->frame_size; //this is wrong, but it seems many demuxers do not work if this is set correctly
+ if (enc->codec_id == AV_CODEC_ID_MP2 || enc->codec_id == AV_CODEC_ID_MP3) {
+ /* this is wrong, but it seems many demuxers do not work if this is set
+ correctly */
+ blkalign = frame_size;
//blkalign = 144 * enc->bit_rate/enc->sample_rate;
- } else if (enc->codec_id == CODEC_ID_AC3) {
+ } else if (enc->codec_id == AV_CODEC_ID_AC3) {
blkalign = 3840; //maximum bytes per frame
} else if (enc->block_align != 0) { /* specified by the codec */
blkalign = enc->block_align;
} else
blkalign = bps * enc->channels / av_gcd(8, bps);
- if (enc->codec_id == CODEC_ID_PCM_U8 ||
- enc->codec_id == CODEC_ID_PCM_S24LE ||
- enc->codec_id == CODEC_ID_PCM_S32LE ||
- enc->codec_id == CODEC_ID_PCM_F32LE ||
- enc->codec_id == CODEC_ID_PCM_F64LE ||
- enc->codec_id == CODEC_ID_PCM_S16LE) {
+ if (enc->codec_id == AV_CODEC_ID_PCM_U8 ||
+ enc->codec_id == AV_CODEC_ID_PCM_S24LE ||
+ enc->codec_id == AV_CODEC_ID_PCM_S32LE ||
+ enc->codec_id == AV_CODEC_ID_PCM_F32LE ||
+ enc->codec_id == AV_CODEC_ID_PCM_F64LE ||
+ enc->codec_id == AV_CODEC_ID_PCM_S16LE) {
bytespersec = enc->sample_rate * blkalign;
} else {
bytespersec = enc->bit_rate / 8;
@@ -443,14 +449,14 @@ int ff_put_wav_header(AVIOContext *pb, AVCodecContext *enc)
avio_wl32(pb, bytespersec); /* bytes per second */
avio_wl16(pb, blkalign); /* block align */
avio_wl16(pb, bps); /* bits per sample */
- if (enc->codec_id == CODEC_ID_MP3) {
+ if (enc->codec_id == AV_CODEC_ID_MP3) {
hdrsize += 12;
bytestream_put_le16(&riff_extradata, 1); /* wID */
bytestream_put_le32(&riff_extradata, 2); /* fdwFlags */
bytestream_put_le16(&riff_extradata, 1152); /* nBlockSize */
bytestream_put_le16(&riff_extradata, 1); /* nFramesPerBlock */
bytestream_put_le16(&riff_extradata, 1393); /* nCodecDelay */
- } else if (enc->codec_id == CODEC_ID_MP2) {
+ } else if (enc->codec_id == AV_CODEC_ID_MP2) {
hdrsize += 22;
bytestream_put_le16(&riff_extradata, 2); /* fwHeadLayer */
bytestream_put_le32(&riff_extradata, enc->bit_rate); /* dwHeadBitrate */
@@ -460,9 +466,9 @@ int ff_put_wav_header(AVIOContext *pb, AVCodecContext *enc)
bytestream_put_le16(&riff_extradata, 16); /* fwHeadFlags */
bytestream_put_le32(&riff_extradata, 0); /* dwPTSLow */
bytestream_put_le32(&riff_extradata, 0); /* dwPTSHigh */
- } else if (enc->codec_id == CODEC_ID_GSM_MS || enc->codec_id == CODEC_ID_ADPCM_IMA_WAV) {
+ } else if (enc->codec_id == AV_CODEC_ID_GSM_MS || enc->codec_id == AV_CODEC_ID_ADPCM_IMA_WAV) {
hdrsize += 2;
- bytestream_put_le16(&riff_extradata, enc->frame_size); /* wSamplesPerBlock */
+ bytestream_put_le16(&riff_extradata, frame_size); /* wSamplesPerBlock */
} else if(enc->extradata_size){
riff_extradata_start= enc->extradata;
riff_extradata= enc->extradata + enc->extradata_size;
@@ -471,7 +477,7 @@ int ff_put_wav_header(AVIOContext *pb, AVCodecContext *enc)
if(waveformatextensible) { /* write WAVEFORMATEXTENSIBLE extensions */
hdrsize += 22;
avio_wl16(pb, riff_extradata - riff_extradata_start + 22); /* 22 is WAVEFORMATEXTENSIBLE size */
- avio_wl16(pb, enc->bits_per_coded_sample); /* ValidBitsPerSample || SamplesPerBlock || Reserved */
+ avio_wl16(pb, bps); /* ValidBitsPerSample || SamplesPerBlock || Reserved */
avio_wl32(pb, enc->channel_layout); /* dwChannelMask */
avio_wl32(pb, enc->codec_tag); /* GUID + next 3 */
avio_wl32(pb, 0x00100000);
@@ -512,6 +518,90 @@ void ff_put_bmp_header(AVIOContext *pb, AVCodecContext *enc, const AVCodecTag *t
if (!for_asf && enc->extradata_size & 1)
avio_w8(pb, 0);
}
+
+void ff_parse_specific_params(AVCodecContext *stream, int *au_rate, int *au_ssize, int *au_scale)
+{
+ int gcd;
+ int audio_frame_size;
+
+ /* We use the known constant frame size for the codec if known, otherwise
+ fallback to using AVCodecContext.frame_size, which is not as reliable
+ for indicating packet duration */
+ audio_frame_size = av_get_audio_frame_duration(stream, 0);
+ if (!audio_frame_size)
+ audio_frame_size = stream->frame_size;
+
+ *au_ssize= stream->block_align;
+ if (audio_frame_size && stream->sample_rate) {
+ *au_scale = audio_frame_size;
+ *au_rate= stream->sample_rate;
+ }else if(stream->codec_type == AVMEDIA_TYPE_VIDEO ||
+ stream->codec_type == AVMEDIA_TYPE_DATA ||
+ stream->codec_type == AVMEDIA_TYPE_SUBTITLE){
+ *au_scale= stream->time_base.num;
+ *au_rate = stream->time_base.den;
+ }else{
+ *au_scale= stream->block_align ? stream->block_align*8 : 8;
+ *au_rate = stream->bit_rate ? stream->bit_rate : 8*stream->sample_rate;
+ }
+ gcd= av_gcd(*au_scale, *au_rate);
+ *au_scale /= gcd;
+ *au_rate /= gcd;
+}
+
+void ff_riff_write_info_tag(AVIOContext *pb, const char *tag, const char *str)
+{
+ int len = strlen(str);
+ if (len > 0) {
+ len++;
+ ffio_wfourcc(pb, tag);
+ avio_wl32(pb, len);
+ avio_put_str(pb, str);
+ if (len & 1)
+ avio_w8(pb, 0);
+ }
+}
+
+static const char riff_tags[][5] = {
+ "IARL", "IART", "ICMS", "ICMT", "ICOP", "ICRD", "ICRP", "IDIM", "IDPI",
+ "IENG", "IGNR", "IKEY", "ILGT", "ILNG", "IMED", "INAM", "IPLT", "IPRD",
+ "IPRT", "ISBJ", "ISFT", "ISHP", "ISRC", "ISRF", "ITCH",
+ {0}
+};
+
+static int riff_has_valid_tags(AVFormatContext *s)
+{
+ int i;
+
+ for (i = 0; *riff_tags[i]; i++) {
+ if (av_dict_get(s->metadata, riff_tags[i], NULL, AV_DICT_MATCH_CASE))
+ return 1;
+ }
+
+ return 0;
+}
+
+void ff_riff_write_info(AVFormatContext *s)
+{
+ AVIOContext *pb = s->pb;
+ int i;
+ int64_t list_pos;
+ AVDictionaryEntry *t = NULL;
+
+ ff_metadata_conv(&s->metadata, ff_riff_info_conv, NULL);
+
+ /* writing empty LIST is not nice and may cause problems */
+ if (!riff_has_valid_tags(s))
+ return;
+
+ list_pos = ff_start_tag(pb, "LIST");
+ ffio_wfourcc(pb, "INFO");
+ for (i = 0; *riff_tags[i]; i++) {
+ if ((t = av_dict_get(s->metadata, riff_tags[i], NULL, AV_DICT_MATCH_CASE)))
+ ff_riff_write_info_tag(s->pb, t->key, t->value);
+ }
+ ff_end_tag(pb, list_pos);
+}
#endif //CONFIG_MUXERS
#if CONFIG_DEMUXERS
@@ -564,36 +654,33 @@ int ff_get_wav_header(AVIOContext *pb, AVCodecContext *codec, int size)
avio_skip(pb, size);
}
codec->codec_id = ff_wav_codec_get_id(id, codec->bits_per_coded_sample);
- if (codec->codec_id == CODEC_ID_AAC_LATM) {
+ if (codec->codec_id == AV_CODEC_ID_AAC_LATM) {
/* channels and sample_rate values are those prior to applying SBR and/or PS */
codec->channels = 0;
codec->sample_rate = 0;
}
/* override bits_per_coded_sample for G.726 */
- if (codec->codec_id == CODEC_ID_ADPCM_G726)
+ if (codec->codec_id == AV_CODEC_ID_ADPCM_G726)
codec->bits_per_coded_sample = codec->bit_rate / codec->sample_rate;
return 0;
}
-enum CodecID ff_wav_codec_get_id(unsigned int tag, int bps)
+enum AVCodecID ff_wav_codec_get_id(unsigned int tag, int bps)
{
- enum CodecID id;
+ enum AVCodecID id;
id = ff_codec_get_id(ff_codec_wav_tags, tag);
if (id <= 0)
return id;
- /* handle specific u8 codec */
- if (id == CODEC_ID_PCM_S16LE && bps == 8)
- id = CODEC_ID_PCM_U8;
- if (id == CODEC_ID_PCM_S16LE && bps == 24)
- id = CODEC_ID_PCM_S24LE;
- if (id == CODEC_ID_PCM_S16LE && bps == 32)
- id = CODEC_ID_PCM_S32LE;
- if (id == CODEC_ID_PCM_F32LE && bps == 64)
- id = CODEC_ID_PCM_F64LE;
- if (id == CODEC_ID_ADPCM_IMA_WAV && bps == 8)
- id = CODEC_ID_PCM_ZORK;
+
+ if (id == AV_CODEC_ID_PCM_S16LE)
+ id = ff_get_pcm_codec_id(bps, 0, 0, ~1);
+ else if (id == AV_CODEC_ID_PCM_F32LE)
+ id = ff_get_pcm_codec_id(bps, 1, 0, 0);
+
+ if (id == AV_CODEC_ID_ADPCM_IMA_WAV && bps == 8)
+ id = AV_CODEC_ID_PCM_ZORK;
return id;
}
@@ -613,29 +700,6 @@ int ff_get_bmp_header(AVIOContext *pb, AVStream *st)
avio_rl32(pb); /* ClrImportant */
return tag1;
}
-#endif // CONFIG_DEMUXERS
-
-void ff_parse_specific_params(AVCodecContext *stream, int *au_rate, int *au_ssize, int *au_scale)
-{
- int gcd;
-
- *au_ssize= stream->block_align;
- if(stream->frame_size && stream->sample_rate){
- *au_scale=stream->frame_size;
- *au_rate= stream->sample_rate;
- }else if(stream->codec_type == AVMEDIA_TYPE_VIDEO ||
- stream->codec_type == AVMEDIA_TYPE_DATA ||
- stream->codec_type == AVMEDIA_TYPE_SUBTITLE){
- *au_scale= stream->time_base.num;
- *au_rate = stream->time_base.den;
- }else{
- *au_scale= stream->block_align ? stream->block_align*8 : 8;
- *au_rate = stream->bit_rate ? stream->bit_rate : 8*stream->sample_rate;
- }
- gcd= av_gcd(*au_scale, *au_rate);
- *au_scale /= gcd;
- *au_rate /= gcd;
-}
int ff_read_riff_info(AVFormatContext *s, int64_t size)
{
@@ -653,13 +717,24 @@ int ff_read_riff_info(AVFormatContext *s, int64_t size)
chunk_code = avio_rl32(pb);
chunk_size = avio_rl32(pb);
+
if (chunk_size > end || end - chunk_size < cur || chunk_size == UINT_MAX) {
- av_log(s, AV_LOG_ERROR, "too big INFO subchunk\n");
- return AVERROR_INVALIDDATA;
+ av_log(s, AV_LOG_WARNING, "too big INFO subchunk\n");
+ break;
}
chunk_size += (chunk_size & 1);
+ if (!chunk_code) {
+ if (chunk_size)
+ avio_skip(pb, chunk_size);
+ else if (pb->eof_reached) {
+ av_log(s, AV_LOG_WARNING, "truncated file\n");
+ return AVERROR_EOF;
+ }
+ continue;
+ }
+
value = av_malloc(chunk_size + 1);
if (!value) {
av_log(s, AV_LOG_ERROR, "out of memory, unable to read INFO tag\n");
@@ -669,10 +744,9 @@ int ff_read_riff_info(AVFormatContext *s, int64_t size)
AV_WL32(key, chunk_code);
if (avio_read(pb, value, chunk_size) != chunk_size) {
- av_freep(key);
- av_freep(value);
- av_log(s, AV_LOG_ERROR, "premature end of file while reading INFO tag\n");
- return AVERROR_INVALIDDATA;
+ av_free(value);
+ av_log(s, AV_LOG_WARNING, "premature end of file while reading INFO tag\n");
+ break;
}
value[chunk_size] = 0;
@@ -682,3 +756,4 @@ int ff_read_riff_info(AVFormatContext *s, int64_t size)
return 0;
}
+#endif // CONFIG_DEMUXERS
diff --git a/gst-libs/ext/libav/libavformat/riff.h b/gst-libs/ext/libav/libavformat/riff.h
index 3bd309f..761f92e 100644
--- a/gst-libs/ext/libav/libavformat/riff.h
+++ b/gst-libs/ext/libav/libavformat/riff.h
@@ -1,5 +1,5 @@
/*
- * RIFF codec tags
+ * RIFF common functions and data
* copyright (c) 2000 Fabrice Bellard
*
* This file is part of Libav.
@@ -48,16 +48,24 @@ int ff_get_bmp_header(AVIOContext *pb, AVStream *st);
void ff_put_bmp_header(AVIOContext *pb, AVCodecContext *enc, const AVCodecTag *tags, int for_asf);
int ff_put_wav_header(AVIOContext *pb, AVCodecContext *enc);
-enum CodecID ff_wav_codec_get_id(unsigned int tag, int bps);
+enum AVCodecID ff_wav_codec_get_id(unsigned int tag, int bps);
int ff_get_wav_header(AVIOContext *pb, AVCodecContext *codec, int size);
extern const AVCodecTag ff_codec_bmp_tags[];
extern const AVCodecTag ff_codec_wav_tags[];
-unsigned int ff_codec_get_tag(const AVCodecTag *tags, enum CodecID id);
-enum CodecID ff_codec_get_id(const AVCodecTag *tags, unsigned int tag);
void ff_parse_specific_params(AVCodecContext *stream, int *au_rate, int *au_ssize, int *au_scale);
int ff_read_riff_info(AVFormatContext *s, int64_t size);
+/**
+ * Write all recognized RIFF tags from s->metadata
+ */
+void ff_riff_write_info(AVFormatContext *s);
+
+/**
+ * Write a single RIFF info tag
+ */
+void ff_riff_write_info_tag(AVIOContext *pb, const char *tag, const char *str);
+
#endif /* AVFORMAT_RIFF_H */
diff --git a/gst-libs/ext/libav/libavformat/rl2.c b/gst-libs/ext/libav/libavformat/rl2.c
index b2be7c0..ac0532f 100644
--- a/gst-libs/ext/libav/libavformat/rl2.c
+++ b/gst-libs/ext/libav/libavformat/rl2.c
@@ -69,11 +69,9 @@ static int rl2_probe(AVProbeData *p)
/**
* read rl2 header data and setup the avstreams
* @param s demuxer context
- * @param ap format parameters
* @return 0 on success, AVERROR otherwise
*/
-static av_cold int rl2_read_header(AVFormatContext *s,
- AVFormatParameters *ap)
+static av_cold int rl2_read_header(AVFormatContext *s)
{
AVIOContext *pb = s->pb;
AVStream *st;
@@ -116,7 +114,7 @@ static av_cold int rl2_read_header(AVFormatContext *s,
return AVERROR(ENOMEM);
st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
- st->codec->codec_id = CODEC_ID_RL2;
+ st->codec->codec_id = AV_CODEC_ID_RL2;
st->codec->codec_tag = 0; /* no fourcc */
st->codec->width = 320;
st->codec->height = 200;
@@ -145,7 +143,7 @@ static av_cold int rl2_read_header(AVFormatContext *s,
if (!st)
return AVERROR(ENOMEM);
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
- st->codec->codec_id = CODEC_ID_PCM_U8;
+ st->codec->codec_id = AV_CODEC_ID_PCM_U8;
st->codec->codec_tag = 1;
st->codec->channels = channels;
st->codec->bits_per_coded_sample = 8;
@@ -288,11 +286,10 @@ static int rl2_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp
AVInputFormat ff_rl2_demuxer = {
.name = "rl2",
- .long_name = NULL_IF_CONFIG_SMALL("RL2 format"),
+ .long_name = NULL_IF_CONFIG_SMALL("RL2"),
.priv_data_size = sizeof(Rl2DemuxContext),
.read_probe = rl2_probe,
.read_header = rl2_read_header,
.read_packet = rl2_read_packet,
.read_seek = rl2_read_seek,
};
-
diff --git a/gst-libs/ext/libav/libavformat/rm.c b/gst-libs/ext/libav/libavformat/rm.c
index 9c0ad4a..761be3f 100644
--- a/gst-libs/ext/libav/libavformat/rm.c
+++ b/gst-libs/ext/libav/libavformat/rm.c
@@ -29,18 +29,19 @@ const char * const ff_rm_metadata[4] = {
};
const AVCodecTag ff_rm_codec_tags[] = {
- { CODEC_ID_RV10, MKTAG('R','V','1','0') },
- { CODEC_ID_RV20, MKTAG('R','V','2','0') },
- { CODEC_ID_RV20, MKTAG('R','V','T','R') },
- { CODEC_ID_RV30, MKTAG('R','V','3','0') },
- { CODEC_ID_RV40, MKTAG('R','V','4','0') },
- { CODEC_ID_AC3, MKTAG('d','n','e','t') },
- { CODEC_ID_RA_144, MKTAG('l','p','c','J') },
- { CODEC_ID_RA_288, MKTAG('2','8','_','8') },
- { CODEC_ID_COOK, MKTAG('c','o','o','k') },
- { CODEC_ID_ATRAC3, MKTAG('a','t','r','c') },
- { CODEC_ID_SIPR, MKTAG('s','i','p','r') },
- { CODEC_ID_AAC, MKTAG('r','a','a','c') },
- { CODEC_ID_AAC, MKTAG('r','a','c','p') },
- { CODEC_ID_NONE },
+ { AV_CODEC_ID_RV10, MKTAG('R','V','1','0') },
+ { AV_CODEC_ID_RV20, MKTAG('R','V','2','0') },
+ { AV_CODEC_ID_RV20, MKTAG('R','V','T','R') },
+ { AV_CODEC_ID_RV30, MKTAG('R','V','3','0') },
+ { AV_CODEC_ID_RV40, MKTAG('R','V','4','0') },
+ { AV_CODEC_ID_AC3, MKTAG('d','n','e','t') },
+ { AV_CODEC_ID_RA_144, MKTAG('l','p','c','J') },
+ { AV_CODEC_ID_RA_288, MKTAG('2','8','_','8') },
+ { AV_CODEC_ID_COOK, MKTAG('c','o','o','k') },
+ { AV_CODEC_ID_ATRAC3, MKTAG('a','t','r','c') },
+ { AV_CODEC_ID_SIPR, MKTAG('s','i','p','r') },
+ { AV_CODEC_ID_AAC, MKTAG('r','a','a','c') },
+ { AV_CODEC_ID_AAC, MKTAG('r','a','c','p') },
+ { AV_CODEC_ID_RALF, MKTAG('L','S','D',':') },
+ { AV_CODEC_ID_NONE },
};
diff --git a/gst-libs/ext/libav/libavformat/rm.h b/gst-libs/ext/libav/libavformat/rm.h
index 9d104ad..a06ea01 100644
--- a/gst-libs/ext/libav/libavformat/rm.h
+++ b/gst-libs/ext/libav/libavformat/rm.h
@@ -26,7 +26,6 @@
#include "internal.h"
extern const char * const ff_rm_metadata[4];
-extern const unsigned char ff_sipr_subpk_size[4];
extern const AVCodecTag ff_rm_codec_tags[];
typedef struct RMStream RMStream;
@@ -93,11 +92,4 @@ int ff_rm_parse_packet (AVFormatContext *s, AVIOContext *pb,
int ff_rm_retrieve_cache (AVFormatContext *s, AVIOContext *pb,
AVStream *st, RMStream *rst, AVPacket *pkt);
-/**
- * Perform 4-bit block reordering for SIPR data.
- *
- * @param buf SIPR data
- */
-void ff_rm_reorder_sipr_data(uint8_t *buf, int sub_packet_h, int framesize);
-
#endif /* AVFORMAT_RM_H */
diff --git a/gst-libs/ext/libav/libavformat/rmdec.c b/gst-libs/ext/libav/libavformat/rmdec.c
index 405162e..3cf2c97 100644
--- a/gst-libs/ext/libav/libavformat/rmdec.c
+++ b/gst-libs/ext/libav/libavformat/rmdec.c
@@ -20,11 +20,12 @@
*/
#include "libavutil/avstring.h"
+#include "libavutil/channel_layout.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/dict.h"
#include "avformat.h"
#include "internal.h"
-#include "riff.h"
+#include "rmsipr.h"
#include "rm.h"
#define DEINT_ID_GENR MKTAG('g', 'e', 'n', 'r') ///< interleaving for Cooker/Atrac
@@ -59,21 +60,6 @@ typedef struct {
int audio_pkt_cnt; ///< Output packet counter
} RMDemuxContext;
-static const unsigned char sipr_swaps[38][2] = {
- { 0, 63 }, { 1, 22 }, { 2, 44 }, { 3, 90 },
- { 5, 81 }, { 7, 31 }, { 8, 86 }, { 9, 58 },
- { 10, 36 }, { 12, 68 }, { 13, 39 }, { 14, 73 },
- { 15, 53 }, { 16, 69 }, { 17, 57 }, { 19, 88 },
- { 20, 34 }, { 21, 71 }, { 24, 46 }, { 25, 94 },
- { 26, 54 }, { 28, 75 }, { 29, 50 }, { 32, 70 },
- { 33, 92 }, { 35, 74 }, { 38, 85 }, { 40, 56 },
- { 42, 87 }, { 43, 65 }, { 45, 59 }, { 48, 79 },
- { 49, 93 }, { 51, 89 }, { 55, 95 }, { 61, 76 },
- { 67, 83 }, { 77, 80 }
-};
-
-const unsigned char ff_sipr_subpk_size[4] = { 29, 19, 37, 20 };
-
static inline void get_strl(AVIOContext *pb, char *buf, int buf_size, int len)
{
int i;
@@ -154,8 +140,9 @@ static int rm_read_audio_stream_info(AVFormatContext *s, AVIOContext *pb,
avio_skip(pb, header_size + startpos - avio_tell(pb));
st->codec->sample_rate = 8000;
st->codec->channels = 1;
+ st->codec->channel_layout = AV_CH_LAYOUT_MONO;
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
- st->codec->codec_id = CODEC_ID_RA_144;
+ st->codec->codec_id = AV_CODEC_ID_RA_144;
ast->deint_id = DEINT_ID_INT0;
} else {
int flavor, sub_packet_h, coded_framesize, sub_packet_size;
@@ -196,17 +183,18 @@ static int rm_read_audio_stream_info(AVFormatContext *s, AVIOContext *pb,
st->codec->codec_tag);
switch (st->codec->codec_id) {
- case CODEC_ID_AC3:
+ case AV_CODEC_ID_AC3:
st->need_parsing = AVSTREAM_PARSE_FULL;
break;
- case CODEC_ID_RA_288:
+ case AV_CODEC_ID_RA_288:
st->codec->extradata_size= 0;
ast->audio_framesize = st->codec->block_align;
st->codec->block_align = coded_framesize;
break;
- case CODEC_ID_COOK:
- case CODEC_ID_ATRAC3:
- case CODEC_ID_SIPR:
+ case AV_CODEC_ID_COOK:
+ st->need_parsing = AVSTREAM_PARSE_HEADERS;
+ case AV_CODEC_ID_ATRAC3:
+ case AV_CODEC_ID_SIPR:
avio_rb16(pb); avio_r8(pb);
if (version == 5)
avio_r8(pb);
@@ -217,7 +205,7 @@ static int rm_read_audio_stream_info(AVFormatContext *s, AVIOContext *pb,
}
ast->audio_framesize = st->codec->block_align;
- if (st->codec->codec_id == CODEC_ID_SIPR) {
+ if (st->codec->codec_id == AV_CODEC_ID_SIPR) {
if (flavor > 3) {
av_log(s, AV_LOG_ERROR, "bad SIPR file flavor %d\n",
flavor);
@@ -234,7 +222,7 @@ static int rm_read_audio_stream_info(AVFormatContext *s, AVIOContext *pb,
if ((ret = rm_read_extradata(pb, st->codec, codecdata_length)) < 0)
return ret;
break;
- case CODEC_ID_AAC:
+ case AV_CODEC_ID_AAC:
avio_rb16(pb); avio_r8(pb);
if (version == 5)
avio_r8(pb);
@@ -310,6 +298,15 @@ ff_rm_read_mdpr_codecdata (AVFormatContext *s, AVIOContext *pb,
/* ra type header */
if (rm_read_audio_stream_info(s, pb, st, rst, 0))
return -1;
+ } else if (v == MKBETAG('L', 'S', 'D', ':')) {
+ avio_seek(pb, -4, SEEK_CUR);
+ if ((ret = rm_read_extradata(pb, st->codec, codec_data_size)) < 0)
+ return ret;
+
+ st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
+ st->codec->codec_tag = AV_RL32(st->codec->extradata);
+ st->codec->codec_id = ff_codec_get_id(ff_rm_codec_tags,
+ st->codec->codec_tag);
} else {
int fps;
if (avio_rl32(pb) != MKTAG('V', 'I', 'D', 'O')) {
@@ -320,8 +317,8 @@ ff_rm_read_mdpr_codecdata (AVFormatContext *s, AVIOContext *pb,
st->codec->codec_tag = avio_rl32(pb);
st->codec->codec_id = ff_codec_get_id(ff_rm_codec_tags,
st->codec->codec_tag);
-// av_log(s, AV_LOG_DEBUG, "%X %X\n", st->codec->codec_tag, MKTAG('R', 'V', '2', '0'));
- if (st->codec->codec_id == CODEC_ID_NONE)
+ av_dlog(s, "%X %X\n", st->codec->codec_tag, MKTAG('R', 'V', '2', '0'));
+ if (st->codec->codec_id == AV_CODEC_ID_NONE)
goto fail1;
st->codec->width = avio_rb16(pb);
st->codec->height = avio_rb16(pb);
@@ -334,9 +331,11 @@ ff_rm_read_mdpr_codecdata (AVFormatContext *s, AVIOContext *pb,
if ((ret = rm_read_extradata(pb, st->codec, codec_data_size - (avio_tell(pb) - codec_pos))) < 0)
return ret;
- av_reduce(&st->r_frame_rate.den, &st->r_frame_rate.num,
+ av_reduce(&st->avg_frame_rate.den, &st->avg_frame_rate.num,
0x10000, fps, (1 << 30) - 1);
- st->avg_frame_rate = st->r_frame_rate;
+#if FF_API_R_FRAME_RATE
+ st->r_frame_rate = st->avg_frame_rate;
+#endif
}
skip:
@@ -378,7 +377,7 @@ static int rm_read_index(AVFormatContext *s)
} else if ((avio_size(pb) - avio_tell(pb)) / 14 < n_pkts) {
av_log(s, AV_LOG_ERROR,
"Nr. of packets in packet index for stream index %d "
- "exceeds filesize (%"PRId64" at %"PRId64" = %d)\n",
+ "exceeds filesize (%"PRId64" at %"PRId64" = %"PRId64")\n",
str_id, avio_size(pb), avio_tell(pb),
(avio_size(pb) - avio_tell(pb)) / 14);
goto skip;
@@ -418,7 +417,7 @@ static int rm_read_header_old(AVFormatContext *s)
return rm_read_audio_stream_info(s, s->pb, st, st->priv_data, 1);
}
-static int rm_read_header(AVFormatContext *s, AVFormatParameters *ap)
+static int rm_read_header(AVFormatContext *s)
{
RMDemuxContext *rm = s->priv_data;
AVStream *st;
@@ -438,10 +437,8 @@ static int rm_read_header(AVFormatContext *s, AVFormatParameters *ap)
return AVERROR(EIO);
}
- avio_rb32(pb); /* header size */
- avio_rb16(pb);
- avio_rb32(pb);
- avio_rb32(pb); /* number of headers */
+ tag_size = avio_rb32(pb);
+ avio_skip(pb, tag_size - 8);
for(;;) {
if (pb->eof_reached)
@@ -700,7 +697,7 @@ rm_ac3_swap_bytes (AVStream *st, AVPacket *pkt)
uint8_t *ptr;
int j;
- if (st->codec->codec_id == CODEC_ID_AC3) {
+ if (st->codec->codec_id == AV_CODEC_ID_AC3) {
ptr = pkt->data;
for (j=0;j<pkt->size;j+=2) {
FFSWAP(int, ptr[0], ptr[1]);
@@ -709,32 +706,6 @@ rm_ac3_swap_bytes (AVStream *st, AVPacket *pkt)
}
}
-/**
- * Perform 4-bit block reordering for SIPR data.
- * @todo This can be optimized, e.g. use memcpy() if data blocks are aligned
- */
-void ff_rm_reorder_sipr_data(uint8_t *buf, int sub_packet_h, int framesize)
-{
- int n, bs = sub_packet_h * framesize * 2 / 96; // nibbles per subpacket
-
- for (n = 0; n < 38; n++) {
- int j;
- int i = bs * sipr_swaps[n][0];
- int o = bs * sipr_swaps[n][1];
-
- /* swap 4bit-nibbles of block 'i' with 'o' */
- for (j = 0; j < bs; j++, i++, o++) {
- int x = (buf[i >> 1] >> (4 * (i & 1))) & 0xF,
- y = (buf[o >> 1] >> (4 * (o & 1))) & 0xF;
-
- buf[o >> 1] = (x << (4 * (o & 1))) |
- (buf[o >> 1] & (0xF << (4 * !(o & 1))));
- buf[i >> 1] = (y << (4 * (i & 1))) |
- (buf[i >> 1] & (0xF << (4 * !(i & 1))));
- }
- }
-}
-
int
ff_rm_parse_packet (AVFormatContext *s, AVIOContext *pb,
AVStream *st, RMStream *ast, int len, AVPacket *pkt,
@@ -807,7 +778,7 @@ ff_rm_parse_packet (AVFormatContext *s, AVIOContext *pb,
#if 0
if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
- if(st->codec->codec_id == CODEC_ID_RV20){
+ if(st->codec->codec_id == AV_CODEC_ID_RV20){
int seq= 128*(pkt->data[2]&0x7F) + (pkt->data[3]>>1);
av_log(s, AV_LOG_DEBUG, "%d %"PRId64" %d\n", *timestamp, *timestamp*512LL/25, seq);
@@ -959,7 +930,8 @@ static int64_t rm_read_dts(AVFormatContext *s, int stream_index,
}
if((flags&2) && (seq&0x7F) == 1){
-// av_log(s, AV_LOG_DEBUG, "%d %d-%d %"PRId64" %d\n", flags, stream_index2, stream_index, dts, seq);
+ av_dlog(s, "%d %d-%d %"PRId64" %d\n",
+ flags, stream_index2, stream_index, dts, seq);
av_add_index_entry(st, pos, dts, 0, 0, AVINDEX_KEYFRAME);
if(stream_index2 == stream_index)
break;
@@ -973,7 +945,7 @@ static int64_t rm_read_dts(AVFormatContext *s, int stream_index,
AVInputFormat ff_rm_demuxer = {
.name = "rm",
- .long_name = NULL_IF_CONFIG_SMALL("RealMedia format"),
+ .long_name = NULL_IF_CONFIG_SMALL("RealMedia"),
.priv_data_size = sizeof(RMDemuxContext),
.read_probe = rm_probe,
.read_header = rm_read_header,
diff --git a/gst-libs/ext/libav/libavformat/rmenc.c b/gst-libs/ext/libav/libavformat/rmenc.c
index 0312d16..ed1ba7c 100644
--- a/gst-libs/ext/libav/libavformat/rmenc.c
+++ b/gst-libs/ext/libav/libavformat/rmenc.c
@@ -242,7 +242,7 @@ static int rv10_write_header(AVFormatContext *ctx,
/* video codec info */
avio_wb32(s,34); /* size */
ffio_wfourcc(s, "VIDO");
- if(stream->enc->codec_id == CODEC_ID_RV10)
+ if(stream->enc->codec_id == AV_CODEC_ID_RV10)
ffio_wfourcc(s,"RV10");
else
ffio_wfourcc(s,"RV20");
@@ -256,7 +256,7 @@ static int rv10_write_header(AVFormatContext *ctx,
/* Seems to be the codec version: only use basic H263. The next
versions seems to add a diffential DC coding as in
MPEG... nothing new under the sun */
- if(stream->enc->codec_id == CODEC_ID_RV10)
+ if(stream->enc->codec_id == AV_CODEC_ID_RV10)
avio_wb32(s,0x10000000);
else
avio_wb32(s,0x20103001);
@@ -359,7 +359,7 @@ static int rm_write_audio(AVFormatContext *s, const uint8_t *buf, int size, int
write_packet_header(s, stream, size, !!(flags & AV_PKT_FLAG_KEY));
- if (stream->enc->codec_id == CODEC_ID_AC3) {
+ if (stream->enc->codec_id == AV_CODEC_ID_AC3) {
/* for AC-3, the words seem to be reversed */
for(i=0;i<size;i+=2) {
buf1[i] = buf[i+1];
@@ -455,21 +455,21 @@ static int rm_write_trailer(AVFormatContext *s)
avio_wb32(pb, 0);
avio_wb32(pb, 0);
}
- avio_flush(pb);
+
return 0;
}
AVOutputFormat ff_rm_muxer = {
.name = "rm",
- .long_name = NULL_IF_CONFIG_SMALL("RealMedia format"),
+ .long_name = NULL_IF_CONFIG_SMALL("RealMedia"),
.mime_type = "application/vnd.rn-realmedia",
.extensions = "rm,ra",
.priv_data_size = sizeof(RMMuxContext),
- .audio_codec = CODEC_ID_AC3,
- .video_codec = CODEC_ID_RV10,
+ .audio_codec = AV_CODEC_ID_AC3,
+ .video_codec = AV_CODEC_ID_RV10,
.write_header = rm_write_header,
.write_packet = rm_write_packet,
.write_trailer = rm_write_trailer,
- .codec_tag= (const AVCodecTag* const []){ff_rm_codec_tags, 0},
+ .codec_tag = (const AVCodecTag* const []){ ff_rm_codec_tags, 0 },
};
diff --git a/gst-libs/ext/libav/libavformat/rmsipr.c b/gst-libs/ext/libav/libavformat/rmsipr.c
new file mode 100644
index 0000000..89fbd0e
--- /dev/null
+++ b/gst-libs/ext/libav/libavformat/rmsipr.c
@@ -0,0 +1,61 @@
+/*
+ * tables and functions for demuxing SIPR audio muxed RealMedia style
+ *
+ * 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
+ */
+
+#include <stdint.h>
+
+#include "rmsipr.h"
+
+const unsigned char ff_sipr_subpk_size[4] = { 29, 19, 37, 20 };
+
+static const unsigned char sipr_swaps[38][2] = {
+ { 0, 63 }, { 1, 22 }, { 2, 44 }, { 3, 90 },
+ { 5, 81 }, { 7, 31 }, { 8, 86 }, { 9, 58 },
+ { 10, 36 }, { 12, 68 }, { 13, 39 }, { 14, 73 },
+ { 15, 53 }, { 16, 69 }, { 17, 57 }, { 19, 88 },
+ { 20, 34 }, { 21, 71 }, { 24, 46 }, { 25, 94 },
+ { 26, 54 }, { 28, 75 }, { 29, 50 }, { 32, 70 },
+ { 33, 92 }, { 35, 74 }, { 38, 85 }, { 40, 56 },
+ { 42, 87 }, { 43, 65 }, { 45, 59 }, { 48, 79 },
+ { 49, 93 }, { 51, 89 }, { 55, 95 }, { 61, 76 },
+ { 67, 83 }, { 77, 80 }
+};
+
+/* This can be optimized, e.g. use memcpy() if data blocks are aligned. */
+void ff_rm_reorder_sipr_data(uint8_t *buf, int sub_packet_h, int framesize)
+{
+ int n, bs = sub_packet_h * framesize * 2 / 96; // nibbles per subpacket
+
+ for (n = 0; n < 38; n++) {
+ int j;
+ int i = bs * sipr_swaps[n][0];
+ int o = bs * sipr_swaps[n][1];
+
+ /* swap 4bit-nibbles of block 'i' with 'o' */
+ for (j = 0; j < bs; j++, i++, o++) {
+ int x = (buf[i >> 1] >> (4 * (i & 1))) & 0xF,
+ y = (buf[o >> 1] >> (4 * (o & 1))) & 0xF;
+
+ buf[o >> 1] = (x << (4 * (o & 1))) |
+ (buf[o >> 1] & (0xF << (4 * !(o & 1))));
+ buf[i >> 1] = (y << (4 * (i & 1))) |
+ (buf[i >> 1] & (0xF << (4 * !(i & 1))));
+ }
+ }
+}
diff --git a/gst-libs/ext/libav/libavformat/rmsipr.h b/gst-libs/ext/libav/libavformat/rmsipr.h
new file mode 100644
index 0000000..c8d3d0a
--- /dev/null
+++ b/gst-libs/ext/libav/libavformat/rmsipr.h
@@ -0,0 +1,35 @@
+/*
+ * tables and functions for demuxing SIPR audio muxed RealMedia style
+ *
+ * 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
+ */
+
+#ifndef AVFORMAT_RMSIPR_H
+#define AVFORMAT_RMSIPR_H
+
+#include <stdint.h>
+
+extern const unsigned char ff_sipr_subpk_size[4];
+
+/**
+ * Perform 4-bit block reordering for SIPR data.
+ *
+ * @param buf SIPR data
+ */
+void ff_rm_reorder_sipr_data(uint8_t *buf, int sub_packet_h, int framesize);
+
+#endif /* AVFORMAT_RMSIPR_H */
diff --git a/gst-libs/ext/libav/libavformat/rpl.c b/gst-libs/ext/libav/libavformat/rpl.c
index 0fa00f3..a5b1e6e 100644
--- a/gst-libs/ext/libav/libavformat/rpl.c
+++ b/gst-libs/ext/libav/libavformat/rpl.c
@@ -110,7 +110,7 @@ static AVRational read_fps(const char* line, int* error)
return result;
}
-static int rpl_read_header(AVFormatContext *s, AVFormatParameters *ap)
+static int rpl_read_header(AVFormatContext *s)
{
AVIOContext *pb = s->pb;
RPLContext *rpl = s->priv_data;
@@ -156,24 +156,24 @@ static int rpl_read_header(AVFormatContext *s, AVFormatParameters *ap)
switch (vst->codec->codec_tag) {
#if 0
case 122:
- vst->codec->codec_id = CODEC_ID_ESCAPE122;
+ vst->codec->codec_id = AV_CODEC_ID_ESCAPE122;
break;
#endif
case 124:
- vst->codec->codec_id = CODEC_ID_ESCAPE124;
+ vst->codec->codec_id = AV_CODEC_ID_ESCAPE124;
// The header is wrong here, at least sometimes
vst->codec->bits_per_coded_sample = 16;
break;
#if 0
case 130:
- vst->codec->codec_id = CODEC_ID_ESCAPE130;
+ vst->codec->codec_id = AV_CODEC_ID_ESCAPE130;
break;
#endif
default:
av_log(s, AV_LOG_WARNING,
"RPL video format %i not supported yet!\n",
vst->codec->codec_tag);
- vst->codec->codec_id = CODEC_ID_NONE;
+ vst->codec->codec_id = AV_CODEC_ID_NONE;
}
// Audio headers
@@ -199,12 +199,12 @@ static int rpl_read_header(AVFormatContext *s, AVFormatParameters *ap)
ast->codec->bits_per_coded_sample *
ast->codec->channels;
- ast->codec->codec_id = CODEC_ID_NONE;
+ ast->codec->codec_id = AV_CODEC_ID_NONE;
switch (audio_format) {
case 1:
if (ast->codec->bits_per_coded_sample == 16) {
// 16-bit audio is always signed
- ast->codec->codec_id = CODEC_ID_PCM_S16LE;
+ ast->codec->codec_id = AV_CODEC_ID_PCM_S16LE;
break;
}
// There are some other formats listed as legal per the spec;
@@ -214,15 +214,15 @@ static int rpl_read_header(AVFormatContext *s, AVFormatParameters *ap)
if (ast->codec->bits_per_coded_sample == 8) {
// The samples with this kind of audio that I have
// are all unsigned.
- ast->codec->codec_id = CODEC_ID_PCM_U8;
+ ast->codec->codec_id = AV_CODEC_ID_PCM_U8;
break;
} else if (ast->codec->bits_per_coded_sample == 4) {
- ast->codec->codec_id = CODEC_ID_ADPCM_IMA_EA_SEAD;
+ ast->codec->codec_id = AV_CODEC_ID_ADPCM_IMA_EA_SEAD;
break;
}
break;
}
- if (ast->codec->codec_id == CODEC_ID_NONE) {
+ if (ast->codec->codec_id == AV_CODEC_ID_NONE) {
av_log(s, AV_LOG_WARNING,
"RPL audio format %i not supported yet!\n",
audio_format);
@@ -353,7 +353,7 @@ static int rpl_read_packet(AVFormatContext *s, AVPacket *pkt)
AVInputFormat ff_rpl_demuxer = {
.name = "rpl",
- .long_name = NULL_IF_CONFIG_SMALL("RPL/ARMovie format"),
+ .long_name = NULL_IF_CONFIG_SMALL("RPL / ARMovie"),
.priv_data_size = sizeof(RPLContext),
.read_probe = rpl_probe,
.read_header = rpl_read_header,
diff --git a/gst-libs/ext/libav/libavformat/rso.c b/gst-libs/ext/libav/libavformat/rso.c
index fc39abc..4ce61e7 100644
--- a/gst-libs/ext/libav/libavformat/rso.c
+++ b/gst-libs/ext/libav/libavformat/rso.c
@@ -24,7 +24,7 @@
#include "rso.h"
const AVCodecTag ff_codec_rso_tags[] = {
- { CODEC_ID_PCM_U8, 0x0100 },
- { CODEC_ID_ADPCM_IMA_WAV, 0x0101 },
- { CODEC_ID_NONE, 0 },
+ { AV_CODEC_ID_PCM_U8, 0x0100 },
+ { AV_CODEC_ID_ADPCM_IMA_WAV, 0x0101 },
+ { AV_CODEC_ID_NONE, 0 },
};
diff --git a/gst-libs/ext/libav/libavformat/rsodec.c b/gst-libs/ext/libav/libavformat/rsodec.c
index 54a3faa..2d57a96 100644
--- a/gst-libs/ext/libav/libavformat/rsodec.c
+++ b/gst-libs/ext/libav/libavformat/rsodec.c
@@ -20,19 +20,19 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "libavutil/channel_layout.h"
#include "libavutil/intreadwrite.h"
#include "avformat.h"
#include "internal.h"
#include "pcm.h"
-#include "riff.h"
#include "rso.h"
-static int rso_read_header(AVFormatContext *s, AVFormatParameters *ap)
+static int rso_read_header(AVFormatContext *s)
{
AVIOContext *pb = s->pb;
int id, rate, bps;
unsigned int size;
- enum CodecID codec;
+ enum AVCodecID codec;
AVStream *st;
id = avio_rb16(pb);
@@ -42,7 +42,7 @@ static int rso_read_header(AVFormatContext *s, AVFormatParameters *ap)
codec = ff_codec_get_id(ff_codec_rso_tags, id);
- if (codec == CODEC_ID_ADPCM_IMA_WAV) {
+ if (codec == AV_CODEC_ID_ADPCM_IMA_WAV) {
av_log(s, AV_LOG_ERROR, "ADPCM in RSO not implemented\n");
return AVERROR_PATCHWELCOME;
}
@@ -50,7 +50,7 @@ static int rso_read_header(AVFormatContext *s, AVFormatParameters *ap)
bps = av_get_bits_per_sample(codec);
if (!bps) {
av_log_ask_for_sample(s, "could not determine bits per sample\n");
- return AVERROR_INVALIDDATA;
+ return AVERROR_PATCHWELCOME;
}
/* now we are ready: build format streams */
@@ -63,6 +63,7 @@ static int rso_read_header(AVFormatContext *s, AVFormatParameters *ap)
st->codec->codec_tag = id;
st->codec->codec_id = codec;
st->codec->channels = 1;
+ st->codec->channel_layout = AV_CH_LAYOUT_MONO;
st->codec->sample_rate = rate;
avpriv_set_pts_info(st, 64, 1, rate);
@@ -90,10 +91,10 @@ static int rso_read_packet(AVFormatContext *s, AVPacket *pkt)
AVInputFormat ff_rso_demuxer = {
.name = "rso",
- .long_name = NULL_IF_CONFIG_SMALL("Lego Mindstorms RSO format"),
+ .long_name = NULL_IF_CONFIG_SMALL("Lego Mindstorms RSO"),
.extensions = "rso",
.read_header = rso_read_header,
.read_packet = rso_read_packet,
- .read_seek = pcm_read_seek,
+ .read_seek = ff_pcm_read_seek,
.codec_tag = (const AVCodecTag* const []){ff_codec_rso_tags, 0},
};
diff --git a/gst-libs/ext/libav/libavformat/rsoenc.c b/gst-libs/ext/libav/libavformat/rsoenc.c
index f338d0d..cc76f9a 100644
--- a/gst-libs/ext/libav/libavformat/rsoenc.c
+++ b/gst-libs/ext/libav/libavformat/rsoenc.c
@@ -49,7 +49,7 @@ static int rso_write_header(AVFormatContext *s)
return AVERROR_INVALIDDATA;
}
- if (enc->codec_id == CODEC_ID_ADPCM_IMA_WAV) {
+ if (enc->codec_id == AV_CODEC_ID_ADPCM_IMA_WAV) {
av_log(s, AV_LOG_ERROR, "ADPCM in RSO not implemented\n");
return AVERROR_PATCHWELCOME;
}
@@ -95,17 +95,15 @@ static int rso_write_trailer(AVFormatContext *s)
avio_wb16(pb, coded_file_size);
avio_seek(pb, file_size, SEEK_SET);
- avio_flush(pb);
-
return 0;
}
AVOutputFormat ff_rso_muxer = {
.name = "rso",
- .long_name = NULL_IF_CONFIG_SMALL("Lego Mindstorms RSO format"),
+ .long_name = NULL_IF_CONFIG_SMALL("Lego Mindstorms RSO"),
.extensions = "rso",
- .audio_codec = CODEC_ID_PCM_U8,
- .video_codec = CODEC_ID_NONE,
+ .audio_codec = AV_CODEC_ID_PCM_U8,
+ .video_codec = AV_CODEC_ID_NONE,
.write_header = rso_write_header,
.write_packet = rso_write_packet,
.write_trailer = rso_write_trailer,
diff --git a/gst-libs/ext/libav/libavformat/rtmp.h b/gst-libs/ext/libav/libavformat/rtmp.h
index 45de73e..b9c5f1e 100644
--- a/gst-libs/ext/libav/libavformat/rtmp.h
+++ b/gst-libs/ext/libav/libavformat/rtmp.h
@@ -25,9 +25,13 @@
#include "avformat.h"
#define RTMP_DEFAULT_PORT 1935
+#define RTMPS_DEFAULT_PORT 443
#define RTMP_HANDSHAKE_PACKET_SIZE 1536
+#define HMAC_IPAD_VAL 0x36
+#define HMAC_OPAD_VAL 0x5C
+
/**
* emulated Flash client version - 9.0.124.2 on Linux
* @{
@@ -39,4 +43,29 @@
#define RTMP_CLIENT_VER4 2
/** @} */ //version defines
+/**
+ * Calculate HMAC-SHA2 digest for RTMP handshake packets.
+ *
+ * @param src input buffer
+ * @param len input buffer length (should be 1536)
+ * @param gap offset in buffer where 32 bytes should not be taken into account
+ * when calculating digest (since it will be used to store that digest)
+ * @param key digest key
+ * @param keylen digest key length
+ * @param dst buffer where calculated digest will be stored (32 bytes)
+ */
+int ff_rtmp_calc_digest(const uint8_t *src, int len, int gap,
+ const uint8_t *key, int keylen, uint8_t *dst);
+
+/**
+ * Calculate digest position for RTMP handshake packets.
+ *
+ * @param buf input buffer (should be 1536 bytes)
+ * @param off offset in buffer where to start calculating digest position
+ * @param mod_val value used for computing modulo
+ * @param add_val value added at the end (after computing modulo)
+ */
+int ff_rtmp_calc_digest_pos(const uint8_t *buf, int off, int mod_val,
+ int add_val);
+
#endif /* AVFORMAT_RTMP_H */
diff --git a/gst-libs/ext/libav/libavformat/rtmpcrypt.c b/gst-libs/ext/libav/libavformat/rtmpcrypt.c
new file mode 100644
index 0000000..dfdd029
--- /dev/null
+++ b/gst-libs/ext/libav/libavformat/rtmpcrypt.c
@@ -0,0 +1,336 @@
+/*
+ * RTMPE network protocol
+ * Copyright (c) 2008-2009 Andrej Stepanchuk
+ * Copyright (c) 2009-2010 Howard Chu
+ * Copyright (c) 2012 Samuel Pitoiset
+ *
+ * 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
+ * RTMPE protocol
+ */
+
+#include "libavutil/blowfish.h"
+#include "libavutil/intreadwrite.h"
+#include "libavutil/opt.h"
+#include "libavutil/rc4.h"
+#include "libavutil/xtea.h"
+
+#include "internal.h"
+#include "rtmp.h"
+#include "rtmpdh.h"
+#include "rtmpcrypt.h"
+#include "url.h"
+
+/* protocol handler context */
+typedef struct RTMPEContext {
+ const AVClass *class;
+ URLContext *stream; ///< TCP stream
+ FF_DH *dh; ///< Diffie-Hellman context
+ struct AVRC4 key_in; ///< RC4 key used for decrypt data
+ struct AVRC4 key_out; ///< RC4 key used for encrypt data
+ int handshaked; ///< flag indicating when the handshake is performed
+ int tunneling; ///< use a HTTP connection (RTMPTE)
+} RTMPEContext;
+
+static const uint8_t rtmpe8_keys[16][16] = {
+ { 0xbf, 0xf0, 0x34, 0xb2, 0x11, 0xd9, 0x08, 0x1f,
+ 0xcc, 0xdf, 0xb7, 0x95, 0x74, 0x8d, 0xe7, 0x32 },
+ { 0x08, 0x6a, 0x5e, 0xb6, 0x17, 0x43, 0x09, 0x0e,
+ 0x6e, 0xf0, 0x5a, 0xb8, 0xfe, 0x5a, 0x39, 0xe2 },
+ { 0x7b, 0x10, 0x95, 0x6f, 0x76, 0xce, 0x05, 0x21,
+ 0x23, 0x88, 0xa7, 0x3a, 0x44, 0x01, 0x49, 0xa1 },
+ { 0xa9, 0x43, 0xf3, 0x17, 0xeb, 0xf1, 0x1b, 0xb2,
+ 0xa6, 0x91, 0xa5, 0xee, 0x17, 0xf3, 0x63, 0x39 },
+ { 0x7a, 0x30, 0xe0, 0x0a, 0xb5, 0x29, 0xe2, 0x2c,
+ 0xa0, 0x87, 0xae, 0xa5, 0xc0, 0xcb, 0x79, 0xac },
+ { 0xbd, 0xce, 0x0c, 0x23, 0x2f, 0xeb, 0xde, 0xff,
+ 0x1c, 0xfa, 0xae, 0x16, 0x11, 0x23, 0x23, 0x9d },
+ { 0x55, 0xdd, 0x3f, 0x7b, 0x77, 0xe7, 0xe6, 0x2e,
+ 0x9b, 0xb8, 0xc4, 0x99, 0xc9, 0x48, 0x1e, 0xe4 },
+ { 0x40, 0x7b, 0xb6, 0xb4, 0x71, 0xe8, 0x91, 0x36,
+ 0xa7, 0xae, 0xbf, 0x55, 0xca, 0x33, 0xb8, 0x39 },
+ { 0xfc, 0xf6, 0xbd, 0xc3, 0xb6, 0x3c, 0x36, 0x97,
+ 0x7c, 0xe4, 0xf8, 0x25, 0x04, 0xd9, 0x59, 0xb2 },
+ { 0x28, 0xe0, 0x91, 0xfd, 0x41, 0x95, 0x4c, 0x4c,
+ 0x7f, 0xb7, 0xdb, 0x00, 0xe3, 0xa0, 0x66, 0xf8 },
+ { 0x57, 0x84, 0x5b, 0x76, 0x4f, 0x25, 0x1b, 0x03,
+ 0x46, 0xd4, 0x5b, 0xcd, 0xa2, 0xc3, 0x0d, 0x29 },
+ { 0x0a, 0xcc, 0xee, 0xf8, 0xda, 0x55, 0xb5, 0x46,
+ 0x03, 0x47, 0x34, 0x52, 0x58, 0x63, 0x71, 0x3b },
+ { 0xb8, 0x20, 0x75, 0xdc, 0xa7, 0x5f, 0x1f, 0xee,
+ 0xd8, 0x42, 0x68, 0xe8, 0xa7, 0x2a, 0x44, 0xcc },
+ { 0x07, 0xcf, 0x6e, 0x9e, 0xa1, 0x6d, 0x7b, 0x25,
+ 0x9f, 0xa7, 0xae, 0x6c, 0xd9, 0x2f, 0x56, 0x29 },
+ { 0xfe, 0xb1, 0xea, 0xe4, 0x8c, 0x8c, 0x3c, 0xe1,
+ 0x4e, 0x00, 0x64, 0xa7, 0x6a, 0x38, 0x7c, 0x2a },
+ { 0x89, 0x3a, 0x94, 0x27, 0xcc, 0x30, 0x13, 0xa2,
+ 0xf1, 0x06, 0x38, 0x5b, 0xa8, 0x29, 0xf9, 0x27 }
+};
+
+static const uint8_t rtmpe9_keys[16][24] = {
+ { 0x79, 0x34, 0x77, 0x4c, 0x67, 0xd1, 0x38, 0x3a, 0xdf, 0xb3, 0x56, 0xbe,
+ 0x8b, 0x7b, 0xd0, 0x24, 0x38, 0xe0, 0x73, 0x58, 0x41, 0x5d, 0x69, 0x67, },
+ { 0x46, 0xf6, 0xb4, 0xcc, 0x01, 0x93, 0xe3, 0xa1, 0x9e, 0x7d, 0x3c, 0x65,
+ 0x55, 0x86, 0xfd, 0x09, 0x8f, 0xf7, 0xb3, 0xc4, 0x6f, 0x41, 0xca, 0x5c, },
+ { 0x1a, 0xe7, 0xe2, 0xf3, 0xf9, 0x14, 0x79, 0x94, 0xc0, 0xd3, 0x97, 0x43,
+ 0x08, 0x7b, 0xb3, 0x84, 0x43, 0x2f, 0x9d, 0x84, 0x3f, 0x21, 0x01, 0x9b, },
+ { 0xd3, 0xe3, 0x54, 0xb0, 0xf7, 0x1d, 0xf6, 0x2b, 0x5a, 0x43, 0x4d, 0x04,
+ 0x83, 0x64, 0x3e, 0x0d, 0x59, 0x2f, 0x61, 0xcb, 0xb1, 0x6a, 0x59, 0x0d, },
+ { 0xc8, 0xc1, 0xe9, 0xb8, 0x16, 0x56, 0x99, 0x21, 0x7b, 0x5b, 0x36, 0xb7,
+ 0xb5, 0x9b, 0xdf, 0x06, 0x49, 0x2c, 0x97, 0xf5, 0x95, 0x48, 0x85, 0x7e, },
+ { 0xeb, 0xe5, 0xe6, 0x2e, 0xa4, 0xba, 0xd4, 0x2c, 0xf2, 0x16, 0xe0, 0x8f,
+ 0x66, 0x23, 0xa9, 0x43, 0x41, 0xce, 0x38, 0x14, 0x84, 0x95, 0x00, 0x53, },
+ { 0x66, 0xdb, 0x90, 0xf0, 0x3b, 0x4f, 0xf5, 0x6f, 0xe4, 0x9c, 0x20, 0x89,
+ 0x35, 0x5e, 0xd2, 0xb2, 0xc3, 0x9e, 0x9f, 0x7f, 0x63, 0xb2, 0x28, 0x81, },
+ { 0xbb, 0x20, 0xac, 0xed, 0x2a, 0x04, 0x6a, 0x19, 0x94, 0x98, 0x9b, 0xc8,
+ 0xff, 0xcd, 0x93, 0xef, 0xc6, 0x0d, 0x56, 0xa7, 0xeb, 0x13, 0xd9, 0x30, },
+ { 0xbc, 0xf2, 0x43, 0x82, 0x09, 0x40, 0x8a, 0x87, 0x25, 0x43, 0x6d, 0xe6,
+ 0xbb, 0xa4, 0xb9, 0x44, 0x58, 0x3f, 0x21, 0x7c, 0x99, 0xbb, 0x3f, 0x24, },
+ { 0xec, 0x1a, 0xaa, 0xcd, 0xce, 0xbd, 0x53, 0x11, 0xd2, 0xfb, 0x83, 0xb6,
+ 0xc3, 0xba, 0xab, 0x4f, 0x62, 0x79, 0xe8, 0x65, 0xa9, 0x92, 0x28, 0x76, },
+ { 0xc6, 0x0c, 0x30, 0x03, 0x91, 0x18, 0x2d, 0x7b, 0x79, 0xda, 0xe1, 0xd5,
+ 0x64, 0x77, 0x9a, 0x12, 0xc5, 0xb1, 0xd7, 0x91, 0x4f, 0x96, 0x4c, 0xa3, },
+ { 0xd7, 0x7c, 0x2a, 0xbf, 0xa6, 0xe7, 0x85, 0x7c, 0x45, 0xad, 0xff, 0x12,
+ 0x94, 0xd8, 0xde, 0xa4, 0x5c, 0x3d, 0x79, 0xa4, 0x44, 0x02, 0x5d, 0x22, },
+ { 0x16, 0x19, 0x0d, 0x81, 0x6a, 0x4c, 0xc7, 0xf8, 0xb8, 0xf9, 0x4e, 0xcd,
+ 0x2c, 0x9e, 0x90, 0x84, 0xb2, 0x08, 0x25, 0x60, 0xe1, 0x1e, 0xae, 0x18, },
+ { 0xe9, 0x7c, 0x58, 0x26, 0x1b, 0x51, 0x9e, 0x49, 0x82, 0x60, 0x61, 0xfc,
+ 0xa0, 0xa0, 0x1b, 0xcd, 0xf5, 0x05, 0xd6, 0xa6, 0x6d, 0x07, 0x88, 0xa3, },
+ { 0x2b, 0x97, 0x11, 0x8b, 0xd9, 0x4e, 0xd9, 0xdf, 0x20, 0xe3, 0x9c, 0x10,
+ 0xe6, 0xa1, 0x35, 0x21, 0x11, 0xf9, 0x13, 0x0d, 0x0b, 0x24, 0x65, 0xb2, },
+ { 0x53, 0x6a, 0x4c, 0x54, 0xac, 0x8b, 0x9b, 0xb8, 0x97, 0x29, 0xfc, 0x60,
+ 0x2c, 0x5b, 0x3a, 0x85, 0x68, 0xb5, 0xaa, 0x6a, 0x44, 0xcd, 0x3f, 0xa7, },
+};
+
+int ff_rtmpe_gen_pub_key(URLContext *h, uint8_t *buf)
+{
+ RTMPEContext *rt = h->priv_data;
+ int offset, ret;
+
+ if (!(rt->dh = ff_dh_init(1024)))
+ return AVERROR(ENOMEM);
+
+ offset = ff_rtmp_calc_digest_pos(buf, 768, 632, 8);
+ if (offset < 0)
+ return offset;
+
+ /* generate a Diffie-Hellmann public key */
+ if ((ret = ff_dh_generate_public_key(rt->dh)) < 0)
+ return ret;
+
+ /* write the public key into the handshake buffer */
+ if ((ret = ff_dh_write_public_key(rt->dh, buf + offset, 128)) < 0)
+ return ret;
+
+ return 0;
+}
+
+int ff_rtmpe_compute_secret_key(URLContext *h, const uint8_t *serverdata,
+ const uint8_t *clientdata, int type)
+{
+ RTMPEContext *rt = h->priv_data;
+ uint8_t secret_key[128], digest[32];
+ int server_pos, client_pos;
+ int ret;
+
+ if (type) {
+ if ((server_pos = ff_rtmp_calc_digest_pos(serverdata, 1532, 632, 772)) < 0)
+ return server_pos;
+ } else {
+ if ((server_pos = ff_rtmp_calc_digest_pos(serverdata, 768, 632, 8)) < 0)
+ return server_pos;
+ }
+
+ if ((client_pos = ff_rtmp_calc_digest_pos(clientdata, 768, 632, 8)) < 0)
+ return client_pos;
+
+ /* compute the shared secret secret in order to compute RC4 keys */
+ if ((ret = ff_dh_compute_shared_secret_key(rt->dh, serverdata + server_pos,
+ 128, secret_key)) < 0)
+ return ret;
+
+ /* set output key */
+ if ((ret = ff_rtmp_calc_digest(serverdata + server_pos, 128, 0, secret_key,
+ 128, digest)) < 0)
+ return ret;
+ av_rc4_init(&rt->key_out, digest, 16 * 8, 1);
+
+ /* set input key */
+ if ((ret = ff_rtmp_calc_digest(clientdata + client_pos, 128, 0, secret_key,
+ 128, digest)) < 0)
+ return ret;
+ av_rc4_init(&rt->key_in, digest, 16 * 8, 1);
+
+ return 0;
+}
+
+static void rtmpe8_sig(const uint8_t *in, uint8_t *out, int key_id)
+{
+ struct AVXTEA ctx;
+
+ av_xtea_init(&ctx, rtmpe8_keys[key_id]);
+ av_xtea_crypt(&ctx, out, in, 1, NULL, 0);
+}
+
+static void rtmpe9_sig(const uint8_t *in, uint8_t *out, int key_id)
+{
+ struct AVBlowfish ctx;
+ uint32_t xl, xr;
+
+ xl = AV_RL32(in);
+ xr = AV_RL32(in + 4);
+
+ av_blowfish_init(&ctx, rtmpe9_keys[key_id], 24);
+ av_blowfish_crypt_ecb(&ctx, &xl, &xr, 0);
+
+ AV_WL32(out, xl);
+ AV_WL32(out + 4, xr);
+}
+
+void ff_rtmpe_encrypt_sig(URLContext *h, uint8_t *sig, const uint8_t *digest,
+ int type)
+{
+ int i;
+
+ for (i = 0; i < 32; i += 8) {
+ if (type == 8) {
+ /* RTMPE type 8 uses XTEA on the signature */
+ rtmpe8_sig(sig + i, sig + i, digest[i] % 15);
+ } else if (type == 9) {
+ /* RTMPE type 9 uses Blowfish on the signature */
+ rtmpe9_sig(sig + i, sig + i, digest[i] % 15);
+ }
+ }
+}
+
+int ff_rtmpe_update_keystream(URLContext *h)
+{
+ RTMPEContext *rt = h->priv_data;
+ char buf[RTMP_HANDSHAKE_PACKET_SIZE];
+
+ /* skip past 1536 bytes of the RC4 bytestream */
+ av_rc4_crypt(&rt->key_in, buf, NULL, sizeof(buf), NULL, 1);
+ av_rc4_crypt(&rt->key_out, buf, NULL, sizeof(buf), NULL, 1);
+
+ /* the next requests will be encrypted using RC4 keys */
+ rt->handshaked = 1;
+
+ return 0;
+}
+
+static int rtmpe_close(URLContext *h)
+{
+ RTMPEContext *rt = h->priv_data;
+
+ ff_dh_free(rt->dh);
+ ffurl_close(rt->stream);
+
+ return 0;
+}
+
+static int rtmpe_open(URLContext *h, const char *uri, int flags)
+{
+ RTMPEContext *rt = h->priv_data;
+ char host[256], url[1024];
+ int ret, port;
+
+ av_url_split(NULL, 0, NULL, 0, host, sizeof(host), &port, NULL, 0, uri);
+
+ if (rt->tunneling) {
+ if (port < 0)
+ port = 80;
+ ff_url_join(url, sizeof(url), "ffrtmphttp", NULL, host, port, NULL);
+ } else {
+ if (port < 0)
+ port = 1935;
+ ff_url_join(url, sizeof(url), "tcp", NULL, host, port, NULL);
+ }
+
+ /* open the tcp or ffrtmphttp connection */
+ if ((ret = ffurl_open(&rt->stream, url, AVIO_FLAG_READ_WRITE,
+ &h->interrupt_callback, NULL)) < 0) {
+ rtmpe_close(h);
+ return ret;
+ }
+
+ return 0;
+}
+
+static int rtmpe_read(URLContext *h, uint8_t *buf, int size)
+{
+ RTMPEContext *rt = h->priv_data;
+ int ret;
+
+ rt->stream->flags |= h->flags & AVIO_FLAG_NONBLOCK;
+ ret = ffurl_read(rt->stream, buf, size);
+ rt->stream->flags &= ~AVIO_FLAG_NONBLOCK;
+
+ if (ret < 0 && ret != AVERROR_EOF)
+ return ret;
+
+ if (rt->handshaked && ret > 0) {
+ /* decrypt data received by the server */
+ av_rc4_crypt(&rt->key_in, buf, buf, ret, NULL, 1);
+ }
+
+ return ret;
+}
+
+static int rtmpe_write(URLContext *h, const uint8_t *buf, int size)
+{
+ RTMPEContext *rt = h->priv_data;
+ int ret;
+
+ if (rt->handshaked) {
+ /* encrypt data to send to the server */
+ av_rc4_crypt(&rt->key_out, buf, buf, size, NULL, 1);
+ }
+
+ if ((ret = ffurl_write(rt->stream, buf, size)) < 0)
+ return ret;
+
+ return size;
+}
+
+#define OFFSET(x) offsetof(RTMPEContext, x)
+#define DEC AV_OPT_FLAG_DECODING_PARAM
+
+static const AVOption ffrtmpcrypt_options[] = {
+ {"ffrtmpcrypt_tunneling", "Use a HTTP tunneling connection (RTMPTE).", OFFSET(tunneling), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1, DEC},
+ { NULL },
+};
+
+static const AVClass ffrtmpcrypt_class = {
+ .class_name = "ffrtmpcrypt",
+ .item_name = av_default_item_name,
+ .option = ffrtmpcrypt_options,
+ .version = LIBAVUTIL_VERSION_INT,
+};
+
+URLProtocol ff_ffrtmpcrypt_protocol = {
+ .name = "ffrtmpcrypt",
+ .url_open = rtmpe_open,
+ .url_read = rtmpe_read,
+ .url_write = rtmpe_write,
+ .url_close = rtmpe_close,
+ .priv_data_size = sizeof(RTMPEContext),
+ .flags = URL_PROTOCOL_FLAG_NETWORK,
+ .priv_data_class = &ffrtmpcrypt_class,
+};
diff --git a/gst-libs/ext/libav/libavformat/rtmpcrypt.h b/gst-libs/ext/libav/libavformat/rtmpcrypt.h
new file mode 100644
index 0000000..2799433
--- /dev/null
+++ b/gst-libs/ext/libav/libavformat/rtmpcrypt.h
@@ -0,0 +1,69 @@
+/*
+ * RTMPE encryption utilities
+ * Copyright (c) 2012 Samuel Pitoiset
+ *
+ * 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
+ */
+
+#ifndef AVFORMAT_RTMPCRYPT_H
+#define AVFORMAT_RTMPCRYPT_H
+
+#include <stdint.h>
+
+#include "url.h"
+
+/**
+ * Initialize the Diffie-Hellmann context and generate the public key.
+ *
+ * @param h an URLContext
+ * @param buf handshake data (1536 bytes)
+ * @return zero on success, negative value otherwise
+ */
+int ff_rtmpe_gen_pub_key(URLContext *h, uint8_t *buf);
+
+/**
+ * Compute the shared secret key and initialize the RC4 encryption.
+ *
+ * @param h an URLContext
+ * @param serverdata server data (1536 bytes)
+ * @param clientdata client data (1536 bytes)
+ * @param type the position of the server digest
+ * @return zero on success, negative value otherwise
+ */
+int ff_rtmpe_compute_secret_key(URLContext *h, const uint8_t *serverdata,
+ const uint8_t *clientdata, int type);
+
+/**
+ * Encrypt the signature.
+ *
+ * @param h an URLContext
+ * @param signature the signature to encrypt
+ * @param digest the digest used for finding the encryption key
+ * @param type type of encryption (8 for XTEA, 9 for Blowfish)
+ */
+void ff_rtmpe_encrypt_sig(URLContext *h, uint8_t *signature,
+ const uint8_t *digest, int type);
+
+/**
+ * Update the keystream and set RC4 keys for encryption.
+ *
+ * @param h an URLContext
+ * @return zero on success, negative value otherwise
+ */
+int ff_rtmpe_update_keystream(URLContext *h);
+
+#endif /* AVFORMAT_RTMPCRYPT_H */
diff --git a/gst-libs/ext/libav/libavformat/rtmpdh.c b/gst-libs/ext/libav/libavformat/rtmpdh.c
new file mode 100644
index 0000000..38c2f3d
--- /dev/null
+++ b/gst-libs/ext/libav/libavformat/rtmpdh.c
@@ -0,0 +1,339 @@
+/*
+ * RTMP Diffie-Hellmann utilities
+ * Copyright (c) 2009 Andrej Stepanchuk
+ * Copyright (c) 2009-2010 Howard Chu
+ * Copyright (c) 2012 Samuel Pitoiset
+ *
+ * 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
+ * RTMP Diffie-Hellmann utilities
+ */
+
+#include "config.h"
+#include "rtmpdh.h"
+#include "libavutil/random_seed.h"
+
+#define P1024 \
+ "FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD1" \
+ "29024E088A67CC74020BBEA63B139B22514A08798E3404DD" \
+ "EF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245" \
+ "E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7ED" \
+ "EE386BFB5A899FA5AE9F24117C4B1FE649286651ECE65381" \
+ "FFFFFFFFFFFFFFFF"
+
+#define Q1024 \
+ "7FFFFFFFFFFFFFFFE487ED5110B4611A62633145C06E0E68" \
+ "948127044533E63A0105DF531D89CD9128A5043CC71A026E" \
+ "F7CA8CD9E69D218D98158536F92F8A1BA7F09AB6B6A8E122" \
+ "F242DABB312F3F637A262174D31BF6B585FFAE5B7A035BF6" \
+ "F71C35FDAD44CFD2D74F9208BE258FF324943328F67329C0" \
+ "FFFFFFFFFFFFFFFF"
+
+#if CONFIG_NETTLE || CONFIG_GCRYPT
+#if CONFIG_NETTLE
+#define bn_new(bn) \
+ do { \
+ bn = av_malloc(sizeof(*bn)); \
+ if (bn) \
+ mpz_init2(bn, 1); \
+ } while (0)
+#define bn_free(bn) \
+ do { \
+ mpz_clear(bn); \
+ av_free(bn); \
+ } while (0)
+#define bn_set_word(bn, w) mpz_set_ui(bn, w)
+#define bn_cmp(a, b) mpz_cmp(a, b)
+#define bn_copy(to, from) mpz_set(to, from)
+#define bn_sub_word(bn, w) mpz_sub_ui(bn, bn, w)
+#define bn_cmp_1(bn) mpz_cmp_ui(bn, 1)
+#define bn_num_bytes(bn) (mpz_sizeinbase(bn, 2) + 7) / 8
+#define bn_bn2bin(bn, buf, len) nettle_mpz_get_str_256(len, buf, bn)
+#define bn_bin2bn(bn, buf, len) \
+ do { \
+ bn_new(bn); \
+ if (bn) \
+ nettle_mpz_set_str_256_u(bn, len, buf); \
+ } while (0)
+#define bn_hex2bn(bn, buf, ret) \
+ do { \
+ bn_new(bn); \
+ if (bn) \
+ ret = (mpz_set_str(bn, buf, 16) == 0); \
+ } while (0)
+#define bn_modexp(bn, y, q, p) mpz_powm(bn, y, q, p)
+#define bn_random(bn, num_bytes) \
+ do { \
+ gmp_randstate_t rs; \
+ gmp_randinit_mt(rs); \
+ gmp_randseed_ui(rs, av_get_random_seed()); \
+ mpz_urandomb(bn, rs, num_bytes); \
+ gmp_randclear(rs); \
+ } while (0)
+#elif CONFIG_GCRYPT
+#define bn_new(bn) bn = gcry_mpi_new(1)
+#define bn_free(bn) gcry_mpi_release(bn)
+#define bn_set_word(bn, w) gcry_mpi_set_ui(bn, w)
+#define bn_cmp(a, b) gcry_mpi_cmp(a, b)
+#define bn_copy(to, from) gcry_mpi_set(to, from)
+#define bn_sub_word(bn, w) gcry_mpi_sub_ui(bn, bn, w)
+#define bn_cmp_1(bn) gcry_mpi_cmp_ui(bn, 1)
+#define bn_num_bytes(bn) (gcry_mpi_get_nbits(bn) + 7) / 8
+#define bn_bn2bin(bn, buf, len) gcry_mpi_print(GCRYMPI_FMT_USG, buf, len, NULL, bn)
+#define bn_bin2bn(bn, buf, len) gcry_mpi_scan(&bn, GCRYMPI_FMT_USG, buf, len, NULL)
+#define bn_hex2bn(bn, buf, ret) ret = (gcry_mpi_scan(&bn, GCRYMPI_FMT_HEX, buf, 0, 0) == 0)
+#define bn_modexp(bn, y, q, p) gcry_mpi_powm(bn, y, q, p)
+#define bn_random(bn, num_bytes) gcry_mpi_randomize(bn, num_bytes, GCRY_WEAK_RANDOM)
+#endif
+
+#define MAX_BYTES 18000
+
+#define dh_new() av_malloc(sizeof(FF_DH))
+
+static FFBigNum dh_generate_key(FF_DH *dh)
+{
+ int num_bytes;
+
+ num_bytes = bn_num_bytes(dh->p) - 1;
+ if (num_bytes <= 0 || num_bytes > MAX_BYTES)
+ return NULL;
+
+ bn_new(dh->priv_key);
+ if (!dh->priv_key)
+ return NULL;
+ bn_random(dh->priv_key, num_bytes);
+
+ bn_new(dh->pub_key);
+ if (!dh->pub_key) {
+ bn_free(dh->priv_key);
+ return NULL;
+ }
+
+ bn_modexp(dh->pub_key, dh->g, dh->priv_key, dh->p);
+
+ return dh->pub_key;
+}
+
+static int dh_compute_key(FF_DH *dh, FFBigNum pub_key_bn,
+ uint32_t pub_key_len, uint8_t *secret_key)
+{
+ FFBigNum k;
+ int num_bytes;
+
+ num_bytes = bn_num_bytes(dh->p);
+ if (num_bytes <= 0 || num_bytes > MAX_BYTES)
+ return -1;
+
+ bn_new(k);
+ if (!k)
+ return -1;
+
+ bn_modexp(k, pub_key_bn, dh->priv_key, dh->p);
+ bn_bn2bin(k, secret_key, pub_key_len);
+ bn_free(k);
+
+ /* return the length of the shared secret key like DH_compute_key */
+ return pub_key_len;
+}
+
+void ff_dh_free(FF_DH *dh)
+{
+ bn_free(dh->p);
+ bn_free(dh->g);
+ bn_free(dh->pub_key);
+ bn_free(dh->priv_key);
+ av_free(dh);
+}
+#elif CONFIG_OPENSSL
+#define bn_new(bn) bn = BN_new()
+#define bn_free(bn) BN_free(bn)
+#define bn_set_word(bn, w) BN_set_word(bn, w)
+#define bn_cmp(a, b) BN_cmp(a, b)
+#define bn_copy(to, from) BN_copy(to, from)
+#define bn_sub_word(bn, w) BN_sub_word(bn, w)
+#define bn_cmp_1(bn) BN_cmp(bn, BN_value_one())
+#define bn_num_bytes(bn) BN_num_bytes(bn)
+#define bn_bn2bin(bn, buf, len) BN_bn2bin(bn, buf)
+#define bn_bin2bn(bn, buf, len) bn = BN_bin2bn(buf, len, 0)
+#define bn_hex2bn(bn, buf, ret) ret = BN_hex2bn(&bn, buf)
+#define bn_modexp(bn, y, q, p) \
+ do { \
+ BN_CTX *ctx = BN_CTX_new(); \
+ if (!ctx) \
+ return AVERROR(ENOMEM); \
+ if (!BN_mod_exp(bn, y, q, p, ctx)) { \
+ BN_CTX_free(ctx); \
+ return AVERROR(EINVAL); \
+ } \
+ BN_CTX_free(ctx); \
+ } while (0)
+
+#define dh_new() DH_new()
+#define dh_generate_key(dh) DH_generate_key(dh)
+#define dh_compute_key(dh, pub, len, secret) DH_compute_key(secret, pub, dh)
+
+void ff_dh_free(FF_DH *dh)
+{
+ DH_free(dh);
+}
+#endif
+
+static int dh_is_valid_public_key(FFBigNum y, FFBigNum p, FFBigNum q)
+{
+ FFBigNum bn = NULL;
+ int ret = AVERROR(EINVAL);
+
+ bn_new(bn);
+ if (!bn)
+ return AVERROR(ENOMEM);
+
+ /* y must lie in [2, p - 1] */
+ bn_set_word(bn, 1);
+ if (!bn_cmp(y, bn))
+ goto fail;
+
+ /* bn = p - 2 */
+ bn_copy(bn, p);
+ bn_sub_word(bn, 1);
+ if (!bn_cmp(y, bn))
+ goto fail;
+
+ /* Verify with Sophie-Germain prime
+ *
+ * This is a nice test to make sure the public key position is calculated
+ * correctly. This test will fail in about 50% of the cases if applied to
+ * random data.
+ */
+ /* y must fulfill y^q mod p = 1 */
+ bn_modexp(bn, y, q, p);
+
+ if (bn_cmp_1(bn))
+ goto fail;
+
+ ret = 0;
+fail:
+ bn_free(bn);
+
+ return ret;
+}
+
+av_cold FF_DH *ff_dh_init(int key_len)
+{
+ FF_DH *dh;
+ int ret;
+
+ if (!(dh = dh_new()))
+ return NULL;
+
+ bn_new(dh->g);
+ if (!dh->g)
+ goto fail;
+
+ bn_hex2bn(dh->p, P1024, ret);
+ if (!ret)
+ goto fail;
+
+ bn_set_word(dh->g, 2);
+ dh->length = key_len;
+
+ return dh;
+
+fail:
+ ff_dh_free(dh);
+
+ return NULL;
+}
+
+int ff_dh_generate_public_key(FF_DH *dh)
+{
+ int ret = 0;
+
+ while (!ret) {
+ FFBigNum q1 = NULL;
+
+ if (!dh_generate_key(dh))
+ return AVERROR(EINVAL);
+
+ bn_hex2bn(q1, Q1024, ret);
+ if (!ret)
+ return AVERROR(ENOMEM);
+
+ ret = dh_is_valid_public_key(dh->pub_key, dh->p, q1);
+ bn_free(q1);
+
+ if (!ret) {
+ /* the public key is valid */
+ break;
+ }
+ }
+
+ return ret;
+}
+
+int ff_dh_write_public_key(FF_DH *dh, uint8_t *pub_key, int pub_key_len)
+{
+ int len;
+
+ /* compute the length of the public key */
+ len = bn_num_bytes(dh->pub_key);
+ if (len <= 0 || len > pub_key_len)
+ return AVERROR(EINVAL);
+
+ /* convert the public key value into big-endian form */
+ memset(pub_key, 0, pub_key_len);
+ bn_bn2bin(dh->pub_key, pub_key + pub_key_len - len, len);
+
+ return 0;
+}
+
+int ff_dh_compute_shared_secret_key(FF_DH *dh, const uint8_t *pub_key,
+ int pub_key_len, uint8_t *secret_key)
+{
+ FFBigNum q1 = NULL, pub_key_bn = NULL;
+ int ret;
+
+ /* convert the big-endian form of the public key into a bignum */
+ bn_bin2bn(pub_key_bn, pub_key, pub_key_len);
+ if (!pub_key_bn)
+ return AVERROR(ENOMEM);
+
+ /* convert the string containing a hexadecimal number into a bignum */
+ bn_hex2bn(q1, Q1024, ret);
+ if (!ret) {
+ ret = AVERROR(ENOMEM);
+ goto fail;
+ }
+
+ /* when the public key is valid we have to compute the shared secret key */
+ if ((ret = dh_is_valid_public_key(pub_key_bn, dh->p, q1)) < 0) {
+ goto fail;
+ } else if ((ret = dh_compute_key(dh, pub_key_bn, pub_key_len,
+ secret_key)) < 0) {
+ ret = AVERROR(EINVAL);
+ goto fail;
+ }
+
+fail:
+ bn_free(pub_key_bn);
+ bn_free(q1);
+
+ return ret;
+}
+
diff --git a/gst-libs/ext/libav/libavformat/rtmpdh.h b/gst-libs/ext/libav/libavformat/rtmpdh.h
new file mode 100644
index 0000000..5de8bde
--- /dev/null
+++ b/gst-libs/ext/libav/libavformat/rtmpdh.h
@@ -0,0 +1,102 @@
+/*
+ * RTMP Diffie-Hellmann utilities
+ * Copyright (c) 2012 Samuel Pitoiset
+ *
+ * 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
+ */
+
+#ifndef AVFORMAT_RTMPDH_H
+#define AVFORMAT_RTMPDH_H
+
+#include "avformat.h"
+#include "config.h"
+
+#if CONFIG_NETTLE || CONFIG_GCRYPT
+#if CONFIG_NETTLE
+#include <gmp.h>
+#include <nettle/bignum.h>
+
+typedef mpz_ptr FFBigNum;
+#elif CONFIG_GCRYPT
+#include <gcrypt.h>
+
+typedef gcry_mpi_t FFBigNum;
+#endif
+
+typedef struct FF_DH {
+ FFBigNum p;
+ FFBigNum g;
+ FFBigNum pub_key;
+ FFBigNum priv_key;
+ long length;
+} FF_DH;
+
+#elif CONFIG_OPENSSL
+#include <openssl/bn.h>
+#include <openssl/dh.h>
+
+typedef BIGNUM *FFBigNum;
+typedef DH FF_DH;
+#endif
+
+/**
+ * Initialize a Diffie-Hellmann context.
+ *
+ * @param key_len length of the key
+ * @return a new Diffie-Hellmann context on success, NULL otherwise
+ */
+FF_DH *ff_dh_init(int key_len);
+
+/**
+ * Free a Diffie-Hellmann context.
+ *
+ * @param dh a Diffie-Hellmann context to free
+ */
+void ff_dh_free(FF_DH *dh);
+
+/**
+ * Generate a public key.
+ *
+ * @param dh a Diffie-Hellmann context
+ * @return zero on success, negative value otherwise
+ */
+int ff_dh_generate_public_key(FF_DH *dh);
+
+/**
+ * Write the public key into the given buffer.
+ *
+ * @param dh a Diffie-Hellmann context, containing the public key to write
+ * @param pub_key the buffer where the public key is written
+ * @param pub_key_len the length of the buffer
+ * @return zero on success, negative value otherwise
+ */
+int ff_dh_write_public_key(FF_DH *dh, uint8_t *pub_key, int pub_key_len);
+
+/**
+ * Compute the shared secret key from the private FF_DH value and the
+ * other party's public value.
+ *
+ * @param dh a Diffie-Hellmann context, containing the private key
+ * @param pub_key the buffer containing the public key
+ * @param pub_key_len the length of the buffer
+ * @param secret_key the buffer where the secret key is written
+ * @return length of the shared secret key on success, negative value otherwise
+ */
+int ff_dh_compute_shared_secret_key(FF_DH *dh, const uint8_t *pub_key,
+ int pub_key_len, uint8_t *secret_key);
+
+#endif /* AVFORMAT_RTMPDH_H */
diff --git a/gst-libs/ext/libav/libavformat/rtmphttp.c b/gst-libs/ext/libav/libavformat/rtmphttp.c
new file mode 100644
index 0000000..80a983b
--- /dev/null
+++ b/gst-libs/ext/libav/libavformat/rtmphttp.c
@@ -0,0 +1,276 @@
+/*
+ * RTMP HTTP network protocol
+ * Copyright (c) 2012 Samuel Pitoiset
+ *
+ * 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
+ * RTMP HTTP protocol
+ */
+
+#include "libavutil/avstring.h"
+#include "libavutil/intfloat.h"
+#include "libavutil/opt.h"
+#include "libavutil/time.h"
+#include "internal.h"
+#include "http.h"
+#include "rtmp.h"
+
+#define RTMPT_DEFAULT_PORT 80
+#define RTMPTS_DEFAULT_PORT RTMPS_DEFAULT_PORT
+
+/* protocol handler context */
+typedef struct RTMP_HTTPContext {
+ const AVClass *class;
+ URLContext *stream; ///< HTTP stream
+ char host[256]; ///< hostname of the server
+ int port; ///< port to connect (default is 80)
+ char client_id[64]; ///< client ID used for all requests except the first one
+ int seq; ///< sequence ID used for all requests
+ uint8_t *out_data; ///< output buffer
+ int out_size; ///< current output buffer size
+ int out_capacity; ///< current output buffer capacity
+ int initialized; ///< flag indicating when the http context is initialized
+ int finishing; ///< flag indicating when the client closes the connection
+ int nb_bytes_read; ///< number of bytes read since the last request
+ int tls; ///< use Transport Security Layer (RTMPTS)
+} RTMP_HTTPContext;
+
+static int rtmp_http_send_cmd(URLContext *h, const char *cmd)
+{
+ RTMP_HTTPContext *rt = h->priv_data;
+ char uri[2048];
+ uint8_t c;
+ int ret;
+
+ ff_url_join(uri, sizeof(uri), "http", NULL, rt->host, rt->port,
+ "/%s/%s/%d", cmd, rt->client_id, rt->seq++);
+
+ av_opt_set_bin(rt->stream->priv_data, "post_data", rt->out_data,
+ rt->out_size, 0);
+
+ /* send a new request to the server */
+ if ((ret = ff_http_do_new_request(rt->stream, uri)) < 0)
+ return ret;
+
+ /* re-init output buffer */
+ rt->out_size = 0;
+
+ /* read the first byte which contains the polling interval */
+ if ((ret = ffurl_read(rt->stream, &c, 1)) < 0)
+ return ret;
+
+ /* re-init the number of bytes read */
+ rt->nb_bytes_read = 0;
+
+ return ret;
+}
+
+static int rtmp_http_write(URLContext *h, const uint8_t *buf, int size)
+{
+ RTMP_HTTPContext *rt = h->priv_data;
+ void *ptr;
+
+ if (rt->out_size + size > rt->out_capacity) {
+ rt->out_capacity = (rt->out_size + size) * 2;
+ ptr = av_realloc(rt->out_data, rt->out_capacity);
+ if (!ptr)
+ return AVERROR(ENOMEM);
+ rt->out_data = ptr;
+ }
+
+ memcpy(rt->out_data + rt->out_size, buf, size);
+ rt->out_size += size;
+
+ return size;
+}
+
+static int rtmp_http_read(URLContext *h, uint8_t *buf, int size)
+{
+ RTMP_HTTPContext *rt = h->priv_data;
+ int ret, off = 0;
+
+ /* try to read at least 1 byte of data */
+ do {
+ ret = ffurl_read(rt->stream, buf + off, size);
+ if (ret < 0 && ret != AVERROR_EOF)
+ return ret;
+
+ if (ret == AVERROR_EOF) {
+ if (rt->finishing) {
+ /* Do not send new requests when the client wants to
+ * close the connection. */
+ return AVERROR(EAGAIN);
+ }
+
+ /* When the client has reached end of file for the last request,
+ * we have to send a new request if we have buffered data.
+ * Otherwise, we have to send an idle POST. */
+ if (rt->out_size > 0) {
+ if ((ret = rtmp_http_send_cmd(h, "send")) < 0)
+ return ret;
+ } else {
+ if (rt->nb_bytes_read == 0) {
+ /* Wait 50ms before retrying to read a server reply in
+ * order to reduce the number of idle requets. */
+ av_usleep(50000);
+ }
+
+ if ((ret = rtmp_http_write(h, "", 1)) < 0)
+ return ret;
+
+ if ((ret = rtmp_http_send_cmd(h, "idle")) < 0)
+ return ret;
+ }
+
+ if (h->flags & AVIO_FLAG_NONBLOCK) {
+ /* no incoming data to handle in nonblocking mode */
+ return AVERROR(EAGAIN);
+ }
+ } else {
+ off += ret;
+ size -= ret;
+ rt->nb_bytes_read += ret;
+ }
+ } while (off <= 0);
+
+ return off;
+}
+
+static int rtmp_http_close(URLContext *h)
+{
+ RTMP_HTTPContext *rt = h->priv_data;
+ uint8_t tmp_buf[2048];
+ int ret = 0;
+
+ if (rt->initialized) {
+ /* client wants to close the connection */
+ rt->finishing = 1;
+
+ do {
+ ret = rtmp_http_read(h, tmp_buf, sizeof(tmp_buf));
+ } while (ret > 0);
+
+ /* re-init output buffer before sending the close command */
+ rt->out_size = 0;
+
+ if ((ret = rtmp_http_write(h, "", 1)) == 1)
+ ret = rtmp_http_send_cmd(h, "close");
+ }
+
+ av_freep(&rt->out_data);
+ ffurl_close(rt->stream);
+
+ return ret;
+}
+
+static int rtmp_http_open(URLContext *h, const char *uri, int flags)
+{
+ RTMP_HTTPContext *rt = h->priv_data;
+ char headers[1024], url[1024];
+ int ret, off = 0;
+
+ av_url_split(NULL, 0, NULL, 0, rt->host, sizeof(rt->host), &rt->port,
+ NULL, 0, uri);
+
+ /* This is the first request that is sent to the server in order to
+ * register a client on the server and start a new session. The server
+ * replies with a unique id (usually a number) that is used by the client
+ * for all future requests.
+ * Note: the reply doesn't contain a value for the polling interval.
+ * A successful connect resets the consecutive index that is used
+ * in the URLs. */
+ if (rt->tls) {
+ if (rt->port < 0)
+ rt->port = RTMPTS_DEFAULT_PORT;
+ ff_url_join(url, sizeof(url), "https", NULL, rt->host, rt->port, "/open/1");
+ } else {
+ if (rt->port < 0)
+ rt->port = RTMPT_DEFAULT_PORT;
+ ff_url_join(url, sizeof(url), "http", NULL, rt->host, rt->port, "/open/1");
+ }
+
+ /* alloc the http context */
+ if ((ret = ffurl_alloc(&rt->stream, url, AVIO_FLAG_READ_WRITE, NULL)) < 0)
+ goto fail;
+
+ /* set options */
+ snprintf(headers, sizeof(headers),
+ "Cache-Control: no-cache\r\n"
+ "Content-type: application/x-fcs\r\n"
+ "User-Agent: Shockwave Flash\r\n");
+ av_opt_set(rt->stream->priv_data, "headers", headers, 0);
+ av_opt_set(rt->stream->priv_data, "multiple_requests", "1", 0);
+ av_opt_set_bin(rt->stream->priv_data, "post_data", "", 1, 0);
+
+ /* open the http context */
+ if ((ret = ffurl_connect(rt->stream, NULL)) < 0)
+ goto fail;
+
+ /* read the server reply which contains a unique ID */
+ for (;;) {
+ ret = ffurl_read(rt->stream, rt->client_id + off, sizeof(rt->client_id) - off);
+ if (ret == AVERROR_EOF)
+ break;
+ if (ret < 0)
+ goto fail;
+ off += ret;
+ if (off == sizeof(rt->client_id)) {
+ ret = AVERROR(EIO);
+ goto fail;
+ }
+ }
+ while (off > 0 && isspace(rt->client_id[off - 1]))
+ off--;
+ rt->client_id[off] = '\0';
+
+ /* http context is now initialized */
+ rt->initialized = 1;
+ return 0;
+
+fail:
+ rtmp_http_close(h);
+ return ret;
+}
+
+#define OFFSET(x) offsetof(RTMP_HTTPContext, x)
+#define DEC AV_OPT_FLAG_DECODING_PARAM
+
+static const AVOption ffrtmphttp_options[] = {
+ {"ffrtmphttp_tls", "Use a HTTPS tunneling connection (RTMPTS).", OFFSET(tls), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1, DEC},
+ { NULL },
+};
+
+static const AVClass ffrtmphttp_class = {
+ .class_name = "ffrtmphttp",
+ .item_name = av_default_item_name,
+ .option = ffrtmphttp_options,
+ .version = LIBAVUTIL_VERSION_INT,
+};
+
+URLProtocol ff_ffrtmphttp_protocol = {
+ .name = "ffrtmphttp",
+ .url_open = rtmp_http_open,
+ .url_read = rtmp_http_read,
+ .url_write = rtmp_http_write,
+ .url_close = rtmp_http_close,
+ .priv_data_size = sizeof(RTMP_HTTPContext),
+ .flags = URL_PROTOCOL_FLAG_NETWORK,
+ .priv_data_class= &ffrtmphttp_class,
+};
diff --git a/gst-libs/ext/libav/libavformat/rtmppkt.c b/gst-libs/ext/libav/libavformat/rtmppkt.c
index 8c455a0..aed188d 100644
--- a/gst-libs/ext/libav/libavformat/rtmppkt.c
+++ b/gst-libs/ext/libav/libavformat/rtmppkt.c
@@ -47,6 +47,19 @@ void ff_amf_write_string(uint8_t **dst, const char *str)
bytestream_put_buffer(dst, str, strlen(str));
}
+void ff_amf_write_string2(uint8_t **dst, const char *str1, const char *str2)
+{
+ int len1 = 0, len2 = 0;
+ if (str1)
+ len1 = strlen(str1);
+ if (str2)
+ len2 = strlen(str2);
+ bytestream_put_byte(dst, AMF_DATA_TYPE_STRING);
+ bytestream_put_be16(dst, len1 + len2);
+ bytestream_put_buffer(dst, str1, len1);
+ bytestream_put_buffer(dst, str2, len2);
+}
+
void ff_amf_write_null(uint8_t **dst)
{
bytestream_put_byte(dst, AMF_DATA_TYPE_NULL);
@@ -71,17 +84,73 @@ void ff_amf_write_object_end(uint8_t **dst)
bytestream_put_be24(dst, AMF_DATA_TYPE_OBJECT_END);
}
+int ff_amf_read_bool(GetByteContext *bc, int *val)
+{
+ if (bytestream2_get_byte(bc) != AMF_DATA_TYPE_BOOL)
+ return AVERROR_INVALIDDATA;
+ *val = bytestream2_get_byte(bc);
+ return 0;
+}
+
+int ff_amf_read_number(GetByteContext *bc, double *val)
+{
+ uint64_t read;
+ if (bytestream2_get_byte(bc) != AMF_DATA_TYPE_NUMBER)
+ return AVERROR_INVALIDDATA;
+ read = bytestream2_get_be64(bc);
+ *val = av_int2double(read);
+ return 0;
+}
+
+int ff_amf_read_string(GetByteContext *bc, uint8_t *str,
+ int strsize, int *length)
+{
+ int stringlen = 0;
+ int readsize;
+ if (bytestream2_get_byte(bc) != AMF_DATA_TYPE_STRING)
+ return AVERROR_INVALIDDATA;
+ stringlen = bytestream2_get_be16(bc);
+ if (stringlen + 1 > strsize)
+ return AVERROR(EINVAL);
+ readsize = bytestream2_get_buffer(bc, str, stringlen);
+ if (readsize != stringlen) {
+ av_log(NULL, AV_LOG_WARNING,
+ "Unable to read as many bytes as AMF string signaled\n");
+ }
+ str[readsize] = '\0';
+ *length = FFMIN(stringlen, readsize);
+ return 0;
+}
+
+int ff_amf_read_null(GetByteContext *bc)
+{
+ if (bytestream2_get_byte(bc) != AMF_DATA_TYPE_NULL)
+ return AVERROR_INVALIDDATA;
+ return 0;
+}
+
int ff_rtmp_packet_read(URLContext *h, RTMPPacket *p,
int chunk_size, RTMPPacket *prev_pkt)
{
- uint8_t hdr, t, buf[16];
+ uint8_t hdr;
+
+ if (ffurl_read(h, &hdr, 1) != 1)
+ return AVERROR(EIO);
+
+ return ff_rtmp_packet_read_internal(h, p, chunk_size, prev_pkt, hdr);
+}
+
+int ff_rtmp_packet_read_internal(URLContext *h, RTMPPacket *p, int chunk_size,
+ RTMPPacket *prev_pkt, uint8_t hdr)
+{
+
+ uint8_t t, buf[16];
int channel_id, timestamp, data_size, offset = 0;
uint32_t extra = 0;
enum RTMPPacketType type;
int size = 0;
+ int ret;
- if (ffurl_read(h, &hdr, 1) != 1)
- return AVERROR(EIO);
size++;
channel_id = hdr & 0x3F;
@@ -129,8 +198,9 @@ int ff_rtmp_packet_read(URLContext *h, RTMPPacket *p,
if (hdr != RTMP_PS_TWELVEBYTES)
timestamp += prev_pkt[channel_id].timestamp;
- if (ff_rtmp_packet_create(p, channel_id, type, timestamp, data_size))
- return -1;
+ if ((ret = ff_rtmp_packet_create(p, channel_id, type, timestamp,
+ data_size)) < 0)
+ return ret;
p->extra = extra;
// save history
prev_pkt[channel_id].channel_id = channel_id;
@@ -149,7 +219,10 @@ int ff_rtmp_packet_read(URLContext *h, RTMPPacket *p,
offset += chunk_size;
size += chunk_size;
if (data_size > 0) {
- ffurl_read_complete(h, &t, 1); //marker
+ if ((ret = ffurl_read_complete(h, &t, 1)) < 0) { // marker
+ ff_rtmp_packet_destroy(p);
+ return ret;
+ }
size++;
if (t != (0xC0 + channel_id))
return -1;
@@ -165,6 +238,7 @@ int ff_rtmp_packet_write(URLContext *h, RTMPPacket *pkt,
int mode = RTMP_PS_TWELVEBYTES;
int off = 0;
int size = 0;
+ int ret;
pkt->ts_delta = pkt->timestamp - prev_pkt[pkt->channel_id].timestamp;
@@ -216,15 +290,18 @@ int ff_rtmp_packet_write(URLContext *h, RTMPPacket *pkt,
}
prev_pkt[pkt->channel_id].extra = pkt->extra;
- ffurl_write(h, pkt_hdr, p-pkt_hdr);
+ if ((ret = ffurl_write(h, pkt_hdr, p - pkt_hdr)) < 0)
+ return ret;
size = p - pkt_hdr + pkt->data_size;
while (off < pkt->data_size) {
int towrite = FFMIN(chunk_size, pkt->data_size - off);
- ffurl_write(h, pkt->data + off, towrite);
+ if ((ret = ffurl_write(h, pkt->data + off, towrite)) < 0)
+ return ret;
off += towrite;
if (off < pkt->data_size) {
uint8_t marker = 0xC0 | pkt->channel_id;
- ffurl_write(h, &marker, 1);
+ if ((ret = ffurl_write(h, &marker, 1)) < 0)
+ return ret;
size++;
}
}
diff --git a/gst-libs/ext/libav/libavformat/rtmppkt.h b/gst-libs/ext/libav/libavformat/rtmppkt.h
index 8372484..276c560 100644
--- a/gst-libs/ext/libav/libavformat/rtmppkt.h
+++ b/gst-libs/ext/libav/libavformat/rtmppkt.h
@@ -22,6 +22,7 @@
#ifndef AVFORMAT_RTMPPKT_H
#define AVFORMAT_RTMPPKT_H
+#include "libavcodec/bytestream.h"
#include "avformat.h"
#include "url.h"
@@ -115,6 +116,19 @@ void ff_rtmp_packet_destroy(RTMPPacket *pkt);
*/
int ff_rtmp_packet_read(URLContext *h, RTMPPacket *p,
int chunk_size, RTMPPacket *prev_pkt);
+/**
+ * Read internal RTMP packet sent by the server.
+ *
+ * @param h reader context
+ * @param p packet
+ * @param chunk_size current chunk size
+ * @param prev_pkt previously read packet headers for all channels
+ * (may be needed for restoring incomplete packet header)
+ * @param c the first byte already read
+ * @return number of bytes read on success, negative value otherwise
+ */
+int ff_rtmp_packet_read_internal(URLContext *h, RTMPPacket *p, int chunk_size,
+ RTMPPacket *prev_pkt, uint8_t c);
/**
* Send RTMP packet to the server.
@@ -190,6 +204,15 @@ void ff_amf_write_number(uint8_t **dst, double num);
void ff_amf_write_string(uint8_t **dst, const char *str);
/**
+ * Write a string consisting of two parts in AMF format to a buffer.
+ *
+ * @param dst pointer to the input buffer (will be modified)
+ * @param str1 first string to write, may be null
+ * @param str2 second string to write, may be null
+ */
+void ff_amf_write_string2(uint8_t **dst, const char *str1, const char *str2);
+
+/**
* Write AMF NULL value to buffer.
*
* @param dst pointer to the input buffer (will be modified)
@@ -218,6 +241,48 @@ void ff_amf_write_field_name(uint8_t **dst, const char *str);
*/
void ff_amf_write_object_end(uint8_t **dst);
+/**
+ * Read AMF boolean value.
+ *
+ *@param[in,out] gbc GetByteContext initialized with AMF-formatted data
+ *@param[out] val 0 or 1
+ *@return 0 on success or an AVERROR code on failure
+*/
+int ff_amf_read_bool(GetByteContext *gbc, int *val);
+
+/**
+ * Read AMF number value.
+ *
+ *@param[in,out] gbc GetByteContext initialized with AMF-formatted data
+ *@param[out] val read value
+ *@return 0 on success or an AVERROR code on failure
+*/
+int ff_amf_read_number(GetByteContext *gbc, double *val);
+
+/**
+ * Read AMF string value.
+ *
+ * Appends a trailing null byte to output string in order to
+ * ease later parsing.
+ *
+ *@param[in,out] gbc GetByteContext initialized with AMF-formatted data
+ *@param[out] str read string
+ *@param[in] strsize buffer size available to store the read string
+ *@param[out] length read string length
+ *@return 0 on success or an AVERROR code on failure
+*/
+int ff_amf_read_string(GetByteContext *gbc, uint8_t *str,
+ int strsize, int *length);
+
+/**
+ * Read AMF NULL value.
+ *
+ *@param[in,out] gbc GetByteContext initialized with AMF-formatted data
+ *@return 0 on success or an AVERROR code on failure
+*/
+int ff_amf_read_null(GetByteContext *gbc);
+
+
/** @} */ // AMF funcs
#endif /* AVFORMAT_RTMPPKT_H */
diff --git a/gst-libs/ext/libav/libavformat/rtmpproto.c b/gst-libs/ext/libav/libavformat/rtmpproto.c
index 867969a..f25a79b 100644
--- a/gst-libs/ext/libav/libavformat/rtmpproto.c
+++ b/gst-libs/ext/libav/libavformat/rtmpproto.c
@@ -26,8 +26,12 @@
#include "libavcodec/bytestream.h"
#include "libavutil/avstring.h"
+#include "libavutil/base64.h"
#include "libavutil/intfloat.h"
#include "libavutil/lfg.h"
+#include "libavutil/md5.h"
+#include "libavutil/opt.h"
+#include "libavutil/random_seed.h"
#include "libavutil/sha.h"
#include "avformat.h"
#include "internal.h"
@@ -36,37 +40,56 @@
#include "flv.h"
#include "rtmp.h"
+#include "rtmpcrypt.h"
#include "rtmppkt.h"
#include "url.h"
+#if CONFIG_ZLIB
+#include <zlib.h>
+#endif
+
//#define DEBUG
+#define APP_MAX_LENGTH 128
+#define PLAYPATH_MAX_LENGTH 256
+#define TCURL_MAX_LENGTH 512
+#define FLASHVER_MAX_LENGTH 64
+#define RTMP_PKTDATA_DEFAULT_SIZE 4096
+
/** RTMP protocol handler state */
typedef enum {
STATE_START, ///< client has not done anything yet
STATE_HANDSHAKED, ///< client has performed handshake
- STATE_RELEASING, ///< client releasing stream before publish it (for output)
STATE_FCPUBLISH, ///< client FCPublishing stream (for output)
- STATE_CONNECTING, ///< client connected to server successfully
- STATE_READY, ///< client has sent all needed commands and waits for server reply
STATE_PLAYING, ///< client has started receiving multimedia data from server
STATE_PUBLISHING, ///< client has started sending multimedia data to server (for output)
+ STATE_RECEIVING, ///< received a publish command (for input)
STATE_STOPPED, ///< the broadcast has been stopped
} ClientState;
+typedef struct TrackedMethod {
+ char *name;
+ int id;
+} TrackedMethod;
+
/** protocol handler context */
typedef struct RTMPContext {
+ const AVClass *class;
URLContext* stream; ///< TCP stream used in interactions with RTMP server
RTMPPacket prev_pkt[2][RTMP_CHANNELS]; ///< packet history used when reading and sending packets
- int chunk_size; ///< size of the chunks RTMP packets are divided into
+ int in_chunk_size; ///< size of the chunks incoming RTMP packets are divided into
+ int out_chunk_size; ///< size of the chunks outgoing RTMP packets are divided into
int is_input; ///< input/output flag
- char playpath[256]; ///< path to filename to play (with possible "mp4:" prefix)
- char app[128]; ///< application
+ char *playpath; ///< stream identifier to play (with possible "mp4:" prefix)
+ int live; ///< 0: recorded, -1: live, -2: both
+ char *app; ///< name of application
+ char *conn; ///< append arbitrary AMF data to the Connect message
ClientState state; ///< current state
int main_channel_id; ///< an additional channel ID which is used for some invocations
uint8_t* flv_data; ///< buffer with data for demuxer
int flv_size; ///< current buffer size
int flv_off; ///< number of bytes read from current buffer
+ int flv_nb_packets; ///< number of flv packets published
RTMPPacket out_pkt; ///< rtmp packet, created from flv a/v or metadata (for output)
uint32_t client_report_size; ///< number of bytes after which client should report to server
uint32_t bytes_read; ///< number of bytes read from server
@@ -75,7 +98,31 @@ typedef struct RTMPContext {
uint8_t flv_header[11]; ///< partial incoming flv packet header
int flv_header_bytes; ///< number of initialized bytes in flv_header
int nb_invokes; ///< keeps track of invoke messages
- int create_stream_invoke; ///< invoke id for the create stream command
+ char* tcurl; ///< url of the target stream
+ char* flashver; ///< version of the flash plugin
+ char* swfhash; ///< SHA256 hash of the decompressed SWF file (32 bytes)
+ int swfhash_len; ///< length of the SHA256 hash
+ int swfsize; ///< size of the decompressed SWF file
+ char* swfurl; ///< url of the swf player
+ char* swfverify; ///< URL to player swf file, compute hash/size automatically
+ char swfverification[42]; ///< hash of the SWF verification
+ char* pageurl; ///< url of the web page
+ char* subscribe; ///< name of live stream to subscribe
+ int server_bw; ///< server bandwidth
+ int client_buffer_time; ///< client buffer time in ms
+ int flush_interval; ///< number of packets flushed in the same request (RTMPT only)
+ int encrypted; ///< use an encrypted connection (RTMPE only)
+ TrackedMethod*tracked_methods; ///< tracked methods buffer
+ int nb_tracked_methods; ///< number of tracked methods
+ int tracked_methods_size; ///< size of the tracked methods buffer
+ int listen; ///< listen mode flag
+ int listen_timeout; ///< listen timeout to wait for new connections
+ int nb_streamid; ///< The next stream id to return on createStream calls
+ char username[50];
+ char password[50];
+ char auth_params[500];
+ int do_reconnect;
+ int auth_tried;
} RTMPContext;
#define PLAYER_KEY_OPEN_PART_LEN 30 ///< length of partial key used for first client digest signing
@@ -101,69 +148,409 @@ static const uint8_t rtmp_server_key[] = {
0xE6, 0x36, 0xCF, 0xEB, 0x31, 0xAE
};
+static int add_tracked_method(RTMPContext *rt, const char *name, int id)
+{
+ void *ptr;
+
+ if (rt->nb_tracked_methods + 1 > rt->tracked_methods_size) {
+ rt->tracked_methods_size = (rt->nb_tracked_methods + 1) * 2;
+ ptr = av_realloc(rt->tracked_methods,
+ rt->tracked_methods_size * sizeof(*rt->tracked_methods));
+ if (!ptr)
+ return AVERROR(ENOMEM);
+ rt->tracked_methods = ptr;
+ }
+
+ rt->tracked_methods[rt->nb_tracked_methods].name = av_strdup(name);
+ if (!rt->tracked_methods[rt->nb_tracked_methods].name)
+ return AVERROR(ENOMEM);
+ rt->tracked_methods[rt->nb_tracked_methods].id = id;
+ rt->nb_tracked_methods++;
+
+ return 0;
+}
+
+static void del_tracked_method(RTMPContext *rt, int index)
+{
+ memmove(&rt->tracked_methods[index], &rt->tracked_methods[index + 1],
+ sizeof(*rt->tracked_methods) * (rt->nb_tracked_methods - index - 1));
+ rt->nb_tracked_methods--;
+}
+
+static int find_tracked_method(URLContext *s, RTMPPacket *pkt, int offset,
+ char **tracked_method)
+{
+ RTMPContext *rt = s->priv_data;
+ GetByteContext gbc;
+ double pkt_id;
+ int ret;
+ int i;
+
+ bytestream2_init(&gbc, pkt->data + offset, pkt->data_size - offset);
+ if ((ret = ff_amf_read_number(&gbc, &pkt_id)) < 0)
+ return ret;
+
+ for (i = 0; i < rt->nb_tracked_methods; i++) {
+ if (rt->tracked_methods[i].id != pkt_id)
+ continue;
+
+ *tracked_method = rt->tracked_methods[i].name;
+ del_tracked_method(rt, i);
+ break;
+ }
+
+ return 0;
+}
+
+static void free_tracked_methods(RTMPContext *rt)
+{
+ int i;
+
+ for (i = 0; i < rt->nb_tracked_methods; i ++)
+ av_free(rt->tracked_methods[i].name);
+ av_free(rt->tracked_methods);
+ rt->tracked_methods = NULL;
+ rt->tracked_methods_size = 0;
+ rt->nb_tracked_methods = 0;
+}
+
+static int rtmp_send_packet(RTMPContext *rt, RTMPPacket *pkt, int track)
+{
+ int ret;
+
+ if (pkt->type == RTMP_PT_INVOKE && track) {
+ GetByteContext gbc;
+ char name[128];
+ double pkt_id;
+ int len;
+
+ bytestream2_init(&gbc, pkt->data, pkt->data_size);
+ if ((ret = ff_amf_read_string(&gbc, name, sizeof(name), &len)) < 0)
+ goto fail;
+
+ if ((ret = ff_amf_read_number(&gbc, &pkt_id)) < 0)
+ goto fail;
+
+ if ((ret = add_tracked_method(rt, name, pkt_id)) < 0)
+ goto fail;
+ }
+
+ ret = ff_rtmp_packet_write(rt->stream, pkt, rt->out_chunk_size,
+ rt->prev_pkt[1]);
+fail:
+ ff_rtmp_packet_destroy(pkt);
+ return ret;
+}
+
+static int rtmp_write_amf_data(URLContext *s, char *param, uint8_t **p)
+{
+ char *field, *value;
+ char type;
+
+ /* The type must be B for Boolean, N for number, S for string, O for
+ * object, or Z for null. For Booleans the data must be either 0 or 1 for
+ * FALSE or TRUE, respectively. Likewise for Objects the data must be
+ * 0 or 1 to end or begin an object, respectively. Data items in subobjects
+ * may be named, by prefixing the type with 'N' and specifying the name
+ * before the value (ie. NB:myFlag:1). This option may be used multiple times
+ * to construct arbitrary AMF sequences. */
+ if (param[0] && param[1] == ':') {
+ type = param[0];
+ value = param + 2;
+ } else if (param[0] == 'N' && param[1] && param[2] == ':') {
+ type = param[1];
+ field = param + 3;
+ value = strchr(field, ':');
+ if (!value)
+ goto fail;
+ *value = '\0';
+ value++;
+
+ if (!field || !value)
+ goto fail;
+
+ ff_amf_write_field_name(p, field);
+ } else {
+ goto fail;
+ }
+
+ switch (type) {
+ case 'B':
+ ff_amf_write_bool(p, value[0] != '0');
+ break;
+ case 'S':
+ ff_amf_write_string(p, value);
+ break;
+ case 'N':
+ ff_amf_write_number(p, strtod(value, NULL));
+ break;
+ case 'Z':
+ ff_amf_write_null(p);
+ break;
+ case 'O':
+ if (value[0] != '0')
+ ff_amf_write_object_start(p);
+ else
+ ff_amf_write_object_end(p);
+ break;
+ default:
+ goto fail;
+ break;
+ }
+
+ return 0;
+
+fail:
+ av_log(s, AV_LOG_ERROR, "Invalid AMF parameter: %s\n", param);
+ return AVERROR(EINVAL);
+}
+
/**
* Generate 'connect' call and send it to the server.
*/
-static void gen_connect(URLContext *s, RTMPContext *rt, const char *proto,
- const char *host, int port)
+static int gen_connect(URLContext *s, RTMPContext *rt)
{
RTMPPacket pkt;
- uint8_t ver[64], *p;
- char tcurl[512];
+ uint8_t *p;
+ int ret;
+
+ if ((ret = ff_rtmp_packet_create(&pkt, RTMP_SYSTEM_CHANNEL, RTMP_PT_INVOKE,
+ 0, 4096)) < 0)
+ return ret;
- ff_rtmp_packet_create(&pkt, RTMP_SYSTEM_CHANNEL, RTMP_PT_INVOKE, 0, 4096);
p = pkt.data;
- ff_url_join(tcurl, sizeof(tcurl), proto, NULL, host, port, "/%s", rt->app);
ff_amf_write_string(&p, "connect");
ff_amf_write_number(&p, ++rt->nb_invokes);
ff_amf_write_object_start(&p);
ff_amf_write_field_name(&p, "app");
- ff_amf_write_string(&p, rt->app);
+ ff_amf_write_string2(&p, rt->app, rt->auth_params);
- if (rt->is_input) {
- snprintf(ver, sizeof(ver), "%s %d,%d,%d,%d", RTMP_CLIENT_PLATFORM, RTMP_CLIENT_VER1,
- RTMP_CLIENT_VER2, RTMP_CLIENT_VER3, RTMP_CLIENT_VER4);
- } else {
- snprintf(ver, sizeof(ver), "FMLE/3.0 (compatible; %s)", LIBAVFORMAT_IDENT);
+ if (!rt->is_input) {
ff_amf_write_field_name(&p, "type");
ff_amf_write_string(&p, "nonprivate");
}
ff_amf_write_field_name(&p, "flashVer");
- ff_amf_write_string(&p, ver);
+ ff_amf_write_string(&p, rt->flashver);
+
+ if (rt->swfurl) {
+ ff_amf_write_field_name(&p, "swfUrl");
+ ff_amf_write_string(&p, rt->swfurl);
+ }
+
ff_amf_write_field_name(&p, "tcUrl");
- ff_amf_write_string(&p, tcurl);
+ ff_amf_write_string2(&p, rt->tcurl, rt->auth_params);
if (rt->is_input) {
ff_amf_write_field_name(&p, "fpad");
ff_amf_write_bool(&p, 0);
ff_amf_write_field_name(&p, "capabilities");
ff_amf_write_number(&p, 15.0);
+
+ /* Tell the server we support all the audio codecs except
+ * SUPPORT_SND_INTEL (0x0008) and SUPPORT_SND_UNUSED (0x0010)
+ * which are unused in the RTMP protocol implementation. */
ff_amf_write_field_name(&p, "audioCodecs");
- ff_amf_write_number(&p, 1639.0);
+ ff_amf_write_number(&p, 4071.0);
ff_amf_write_field_name(&p, "videoCodecs");
ff_amf_write_number(&p, 252.0);
ff_amf_write_field_name(&p, "videoFunction");
ff_amf_write_number(&p, 1.0);
+
+ if (rt->pageurl) {
+ ff_amf_write_field_name(&p, "pageUrl");
+ ff_amf_write_string(&p, rt->pageurl);
+ }
+ }
+ ff_amf_write_object_end(&p);
+
+ if (rt->conn) {
+ char *param = rt->conn;
+
+ // Write arbitrary AMF data to the Connect message.
+ while (param != NULL) {
+ char *sep;
+ param += strspn(param, " ");
+ if (!*param)
+ break;
+ sep = strchr(param, ' ');
+ if (sep)
+ *sep = '\0';
+ if ((ret = rtmp_write_amf_data(s, param, &p)) < 0) {
+ // Invalid AMF parameter.
+ ff_rtmp_packet_destroy(&pkt);
+ return ret;
+ }
+
+ if (sep)
+ param = sep + 1;
+ else
+ break;
+ }
+ }
+
+ pkt.data_size = p - pkt.data;
+
+ return rtmp_send_packet(rt, &pkt, 1);
+}
+
+static int read_connect(URLContext *s, RTMPContext *rt)
+{
+ RTMPPacket pkt = { 0 };
+ uint8_t *p;
+ const uint8_t *cp;
+ int ret;
+ char command[64];
+ int stringlen;
+ double seqnum;
+ uint8_t tmpstr[256];
+ GetByteContext gbc;
+
+ if ((ret = ff_rtmp_packet_read(rt->stream, &pkt, rt->in_chunk_size,
+ rt->prev_pkt[1])) < 0)
+ return ret;
+ cp = pkt.data;
+ bytestream2_init(&gbc, cp, pkt.data_size);
+ if (ff_amf_read_string(&gbc, command, sizeof(command), &stringlen)) {
+ av_log(s, AV_LOG_ERROR, "Unable to read command string\n");
+ ff_rtmp_packet_destroy(&pkt);
+ return AVERROR_INVALIDDATA;
}
+ if (strcmp(command, "connect")) {
+ av_log(s, AV_LOG_ERROR, "Expecting connect, got %s\n", command);
+ ff_rtmp_packet_destroy(&pkt);
+ return AVERROR_INVALIDDATA;
+ }
+ ret = ff_amf_read_number(&gbc, &seqnum);
+ if (ret)
+ av_log(s, AV_LOG_WARNING, "SeqNum not found\n");
+ /* Here one could parse an AMF Object with data as flashVers and others. */
+ ret = ff_amf_get_field_value(gbc.buffer,
+ gbc.buffer + bytestream2_get_bytes_left(&gbc),
+ "app", tmpstr, sizeof(tmpstr));
+ if (ret)
+ av_log(s, AV_LOG_WARNING, "App field not found in connect\n");
+ if (!ret && strcmp(tmpstr, rt->app))
+ av_log(s, AV_LOG_WARNING, "App field don't match up: %s <-> %s\n",
+ tmpstr, rt->app);
+ ff_rtmp_packet_destroy(&pkt);
+
+ // Send Window Acknowledgement Size (as defined in speficication)
+ if ((ret = ff_rtmp_packet_create(&pkt, RTMP_NETWORK_CHANNEL,
+ RTMP_PT_SERVER_BW, 0, 4)) < 0)
+ return ret;
+ p = pkt.data;
+ bytestream_put_be32(&p, rt->server_bw);
+ pkt.data_size = p - pkt.data;
+ ret = ff_rtmp_packet_write(rt->stream, &pkt, rt->out_chunk_size,
+ rt->prev_pkt[1]);
+ ff_rtmp_packet_destroy(&pkt);
+ if (ret < 0)
+ return ret;
+ // Send Peer Bandwidth
+ if ((ret = ff_rtmp_packet_create(&pkt, RTMP_NETWORK_CHANNEL,
+ RTMP_PT_CLIENT_BW, 0, 5)) < 0)
+ return ret;
+ p = pkt.data;
+ bytestream_put_be32(&p, rt->server_bw);
+ bytestream_put_byte(&p, 2); // dynamic
+ pkt.data_size = p - pkt.data;
+ ret = ff_rtmp_packet_write(rt->stream, &pkt, rt->out_chunk_size,
+ rt->prev_pkt[1]);
+ ff_rtmp_packet_destroy(&pkt);
+ if (ret < 0)
+ return ret;
+
+ // Ping request
+ if ((ret = ff_rtmp_packet_create(&pkt, RTMP_NETWORK_CHANNEL,
+ RTMP_PT_PING, 0, 6)) < 0)
+ return ret;
+
+ p = pkt.data;
+ bytestream_put_be16(&p, 0); // 0 -> Stream Begin
+ bytestream_put_be32(&p, 0);
+ ret = ff_rtmp_packet_write(rt->stream, &pkt, rt->out_chunk_size,
+ rt->prev_pkt[1]);
+ ff_rtmp_packet_destroy(&pkt);
+ if (ret < 0)
+ return ret;
+
+ // Chunk size
+ if ((ret = ff_rtmp_packet_create(&pkt, RTMP_SYSTEM_CHANNEL,
+ RTMP_PT_CHUNK_SIZE, 0, 4)) < 0)
+ return ret;
+
+ p = pkt.data;
+ bytestream_put_be32(&p, rt->out_chunk_size);
+ ret = ff_rtmp_packet_write(rt->stream, &pkt, rt->out_chunk_size,
+ rt->prev_pkt[1]);
+ ff_rtmp_packet_destroy(&pkt);
+ if (ret < 0)
+ return ret;
+
+ // Send result_ NetConnection.Connect.Success to connect
+ if ((ret = ff_rtmp_packet_create(&pkt, RTMP_SYSTEM_CHANNEL,
+ RTMP_PT_INVOKE, 0,
+ RTMP_PKTDATA_DEFAULT_SIZE)) < 0)
+ return ret;
+
+ p = pkt.data;
+ ff_amf_write_string(&p, "_result");
+ ff_amf_write_number(&p, seqnum);
+
+ ff_amf_write_object_start(&p);
+ ff_amf_write_field_name(&p, "fmsVer");
+ ff_amf_write_string(&p, "FMS/3,0,1,123");
+ ff_amf_write_field_name(&p, "capabilities");
+ ff_amf_write_number(&p, 31);
+ ff_amf_write_object_end(&p);
+
+ ff_amf_write_object_start(&p);
+ ff_amf_write_field_name(&p, "level");
+ ff_amf_write_string(&p, "status");
+ ff_amf_write_field_name(&p, "code");
+ ff_amf_write_string(&p, "NetConnection.Connect.Success");
+ ff_amf_write_field_name(&p, "description");
+ ff_amf_write_string(&p, "Connection succeeded.");
+ ff_amf_write_field_name(&p, "objectEncoding");
+ ff_amf_write_number(&p, 0);
ff_amf_write_object_end(&p);
pkt.data_size = p - pkt.data;
+ ret = ff_rtmp_packet_write(rt->stream, &pkt, rt->out_chunk_size,
+ rt->prev_pkt[1]);
+ ff_rtmp_packet_destroy(&pkt);
+ if (ret < 0)
+ return ret;
- ff_rtmp_packet_write(rt->stream, &pkt, rt->chunk_size, rt->prev_pkt[1]);
+ if ((ret = ff_rtmp_packet_create(&pkt, RTMP_SYSTEM_CHANNEL,
+ RTMP_PT_INVOKE, 0, 30)) < 0)
+ return ret;
+ p = pkt.data;
+ ff_amf_write_string(&p, "onBWDone");
+ ff_amf_write_number(&p, 0);
+ ff_amf_write_null(&p);
+ ff_amf_write_number(&p, 8192);
+ pkt.data_size = p - pkt.data;
+ ret = ff_rtmp_packet_write(rt->stream, &pkt, rt->out_chunk_size,
+ rt->prev_pkt[1]);
ff_rtmp_packet_destroy(&pkt);
+
+ return ret;
}
/**
* Generate 'releaseStream' call and send it to the server. It should make
* the server release some channel for media streams.
*/
-static void gen_release_stream(URLContext *s, RTMPContext *rt)
+static int gen_release_stream(URLContext *s, RTMPContext *rt)
{
RTMPPacket pkt;
uint8_t *p;
+ int ret;
- ff_rtmp_packet_create(&pkt, RTMP_SYSTEM_CHANNEL, RTMP_PT_INVOKE, 0,
- 29 + strlen(rt->playpath));
+ if ((ret = ff_rtmp_packet_create(&pkt, RTMP_SYSTEM_CHANNEL, RTMP_PT_INVOKE,
+ 0, 29 + strlen(rt->playpath))) < 0)
+ return ret;
av_log(s, AV_LOG_DEBUG, "Releasing stream...\n");
p = pkt.data;
@@ -172,21 +559,22 @@ static void gen_release_stream(URLContext *s, RTMPContext *rt)
ff_amf_write_null(&p);
ff_amf_write_string(&p, rt->playpath);
- ff_rtmp_packet_write(rt->stream, &pkt, rt->chunk_size, rt->prev_pkt[1]);
- ff_rtmp_packet_destroy(&pkt);
+ return rtmp_send_packet(rt, &pkt, 1);
}
/**
* Generate 'FCPublish' call and send it to the server. It should make
* the server preapare for receiving media streams.
*/
-static void gen_fcpublish_stream(URLContext *s, RTMPContext *rt)
+static int gen_fcpublish_stream(URLContext *s, RTMPContext *rt)
{
RTMPPacket pkt;
uint8_t *p;
+ int ret;
- ff_rtmp_packet_create(&pkt, RTMP_SYSTEM_CHANNEL, RTMP_PT_INVOKE, 0,
- 25 + strlen(rt->playpath));
+ if ((ret = ff_rtmp_packet_create(&pkt, RTMP_SYSTEM_CHANNEL, RTMP_PT_INVOKE,
+ 0, 25 + strlen(rt->playpath))) < 0)
+ return ret;
av_log(s, AV_LOG_DEBUG, "FCPublish stream...\n");
p = pkt.data;
@@ -195,21 +583,22 @@ static void gen_fcpublish_stream(URLContext *s, RTMPContext *rt)
ff_amf_write_null(&p);
ff_amf_write_string(&p, rt->playpath);
- ff_rtmp_packet_write(rt->stream, &pkt, rt->chunk_size, rt->prev_pkt[1]);
- ff_rtmp_packet_destroy(&pkt);
+ return rtmp_send_packet(rt, &pkt, 1);
}
/**
* Generate 'FCUnpublish' call and send it to the server. It should make
* the server destroy stream.
*/
-static void gen_fcunpublish_stream(URLContext *s, RTMPContext *rt)
+static int gen_fcunpublish_stream(URLContext *s, RTMPContext *rt)
{
RTMPPacket pkt;
uint8_t *p;
+ int ret;
- ff_rtmp_packet_create(&pkt, RTMP_SYSTEM_CHANNEL, RTMP_PT_INVOKE, 0,
- 27 + strlen(rt->playpath));
+ if ((ret = ff_rtmp_packet_create(&pkt, RTMP_SYSTEM_CHANNEL, RTMP_PT_INVOKE,
+ 0, 27 + strlen(rt->playpath))) < 0)
+ return ret;
av_log(s, AV_LOG_DEBUG, "UnPublishing stream...\n");
p = pkt.data;
@@ -218,30 +607,31 @@ static void gen_fcunpublish_stream(URLContext *s, RTMPContext *rt)
ff_amf_write_null(&p);
ff_amf_write_string(&p, rt->playpath);
- ff_rtmp_packet_write(rt->stream, &pkt, rt->chunk_size, rt->prev_pkt[1]);
- ff_rtmp_packet_destroy(&pkt);
+ return rtmp_send_packet(rt, &pkt, 0);
}
/**
* Generate 'createStream' call and send it to the server. It should make
* the server allocate some channel for media streams.
*/
-static void gen_create_stream(URLContext *s, RTMPContext *rt)
+static int gen_create_stream(URLContext *s, RTMPContext *rt)
{
RTMPPacket pkt;
uint8_t *p;
+ int ret;
av_log(s, AV_LOG_DEBUG, "Creating stream...\n");
- ff_rtmp_packet_create(&pkt, RTMP_SYSTEM_CHANNEL, RTMP_PT_INVOKE, 0, 25);
+
+ if ((ret = ff_rtmp_packet_create(&pkt, RTMP_SYSTEM_CHANNEL, RTMP_PT_INVOKE,
+ 0, 25)) < 0)
+ return ret;
p = pkt.data;
ff_amf_write_string(&p, "createStream");
ff_amf_write_number(&p, ++rt->nb_invokes);
ff_amf_write_null(&p);
- rt->create_stream_invoke = rt->nb_invokes;
- ff_rtmp_packet_write(rt->stream, &pkt, rt->chunk_size, rt->prev_pkt[1]);
- ff_rtmp_packet_destroy(&pkt);
+ return rtmp_send_packet(rt, &pkt, 1);
}
@@ -249,13 +639,17 @@ static void gen_create_stream(URLContext *s, RTMPContext *rt)
* Generate 'deleteStream' call and send it to the server. It should make
* the server remove some channel for media streams.
*/
-static void gen_delete_stream(URLContext *s, RTMPContext *rt)
+static int gen_delete_stream(URLContext *s, RTMPContext *rt)
{
RTMPPacket pkt;
uint8_t *p;
+ int ret;
av_log(s, AV_LOG_DEBUG, "Deleting stream...\n");
- ff_rtmp_packet_create(&pkt, RTMP_SYSTEM_CHANNEL, RTMP_PT_INVOKE, 0, 34);
+
+ if ((ret = ff_rtmp_packet_create(&pkt, RTMP_SYSTEM_CHANNEL, RTMP_PT_INVOKE,
+ 0, 34)) < 0)
+ return ret;
p = pkt.data;
ff_amf_write_string(&p, "deleteStream");
@@ -263,22 +657,46 @@ static void gen_delete_stream(URLContext *s, RTMPContext *rt)
ff_amf_write_null(&p);
ff_amf_write_number(&p, rt->main_channel_id);
- ff_rtmp_packet_write(rt->stream, &pkt, rt->chunk_size, rt->prev_pkt[1]);
- ff_rtmp_packet_destroy(&pkt);
+ return rtmp_send_packet(rt, &pkt, 0);
+}
+
+/**
+ * Generate client buffer time and send it to the server.
+ */
+static int gen_buffer_time(URLContext *s, RTMPContext *rt)
+{
+ RTMPPacket pkt;
+ uint8_t *p;
+ int ret;
+
+ if ((ret = ff_rtmp_packet_create(&pkt, RTMP_NETWORK_CHANNEL, RTMP_PT_PING,
+ 1, 10)) < 0)
+ return ret;
+
+ p = pkt.data;
+ bytestream_put_be16(&p, 3);
+ bytestream_put_be32(&p, rt->main_channel_id);
+ bytestream_put_be32(&p, rt->client_buffer_time);
+
+ return rtmp_send_packet(rt, &pkt, 0);
}
/**
* Generate 'play' call and send it to the server, then ping the server
* to start actual playing.
*/
-static void gen_play(URLContext *s, RTMPContext *rt)
+static int gen_play(URLContext *s, RTMPContext *rt)
{
RTMPPacket pkt;
uint8_t *p;
+ int ret;
av_log(s, AV_LOG_DEBUG, "Sending play command for '%s'\n", rt->playpath);
- ff_rtmp_packet_create(&pkt, RTMP_VIDEO_CHANNEL, RTMP_PT_INVOKE, 0,
- 20 + strlen(rt->playpath));
+
+ if ((ret = ff_rtmp_packet_create(&pkt, RTMP_VIDEO_CHANNEL, RTMP_PT_INVOKE,
+ 0, 29 + strlen(rt->playpath))) < 0)
+ return ret;
+
pkt.extra = rt->main_channel_id;
p = pkt.data;
@@ -286,33 +704,26 @@ static void gen_play(URLContext *s, RTMPContext *rt)
ff_amf_write_number(&p, ++rt->nb_invokes);
ff_amf_write_null(&p);
ff_amf_write_string(&p, rt->playpath);
+ ff_amf_write_number(&p, rt->live);
- ff_rtmp_packet_write(rt->stream, &pkt, rt->chunk_size, rt->prev_pkt[1]);
- ff_rtmp_packet_destroy(&pkt);
-
- // set client buffer time disguised in ping packet
- ff_rtmp_packet_create(&pkt, RTMP_NETWORK_CHANNEL, RTMP_PT_PING, 1, 10);
-
- p = pkt.data;
- bytestream_put_be16(&p, 3);
- bytestream_put_be32(&p, 1);
- bytestream_put_be32(&p, 256); //TODO: what is a good value here?
-
- ff_rtmp_packet_write(rt->stream, &pkt, rt->chunk_size, rt->prev_pkt[1]);
- ff_rtmp_packet_destroy(&pkt);
+ return rtmp_send_packet(rt, &pkt, 1);
}
/**
* Generate 'publish' call and send it to the server.
*/
-static void gen_publish(URLContext *s, RTMPContext *rt)
+static int gen_publish(URLContext *s, RTMPContext *rt)
{
RTMPPacket pkt;
uint8_t *p;
+ int ret;
av_log(s, AV_LOG_DEBUG, "Sending publish command for '%s'\n", rt->playpath);
- ff_rtmp_packet_create(&pkt, RTMP_SOURCE_CHANNEL, RTMP_PT_INVOKE, 0,
- 30 + strlen(rt->playpath));
+
+ if ((ret = ff_rtmp_packet_create(&pkt, RTMP_SOURCE_CHANNEL, RTMP_PT_INVOKE,
+ 0, 30 + strlen(rt->playpath))) < 0)
+ return ret;
+
pkt.extra = rt->main_channel_id;
p = pkt.data;
@@ -322,64 +733,145 @@ static void gen_publish(URLContext *s, RTMPContext *rt)
ff_amf_write_string(&p, rt->playpath);
ff_amf_write_string(&p, "live");
- ff_rtmp_packet_write(rt->stream, &pkt, rt->chunk_size, rt->prev_pkt[1]);
- ff_rtmp_packet_destroy(&pkt);
+ return rtmp_send_packet(rt, &pkt, 1);
}
/**
* Generate ping reply and send it to the server.
*/
-static void gen_pong(URLContext *s, RTMPContext *rt, RTMPPacket *ppkt)
+static int gen_pong(URLContext *s, RTMPContext *rt, RTMPPacket *ppkt)
{
RTMPPacket pkt;
uint8_t *p;
+ int ret;
+
+ if (ppkt->data_size < 6) {
+ av_log(s, AV_LOG_ERROR, "Too short ping packet (%d)\n",
+ ppkt->data_size);
+ return AVERROR_INVALIDDATA;
+ }
+
+ if ((ret = ff_rtmp_packet_create(&pkt, RTMP_NETWORK_CHANNEL, RTMP_PT_PING,
+ ppkt->timestamp + 1, 6)) < 0)
+ return ret;
- ff_rtmp_packet_create(&pkt, RTMP_NETWORK_CHANNEL, RTMP_PT_PING, ppkt->timestamp + 1, 6);
p = pkt.data;
bytestream_put_be16(&p, 7);
bytestream_put_be32(&p, AV_RB32(ppkt->data+2));
- ff_rtmp_packet_write(rt->stream, &pkt, rt->chunk_size, rt->prev_pkt[1]);
- ff_rtmp_packet_destroy(&pkt);
+
+ return rtmp_send_packet(rt, &pkt, 0);
}
/**
- * Generate report on bytes read so far and send it to the server.
+ * Generate SWF verification message and send it to the server.
*/
-static void gen_bytes_read(URLContext *s, RTMPContext *rt, uint32_t ts)
+static int gen_swf_verification(URLContext *s, RTMPContext *rt)
{
RTMPPacket pkt;
uint8_t *p;
+ int ret;
+
+ av_log(s, AV_LOG_DEBUG, "Sending SWF verification...\n");
+ if ((ret = ff_rtmp_packet_create(&pkt, RTMP_NETWORK_CHANNEL, RTMP_PT_PING,
+ 0, 44)) < 0)
+ return ret;
- ff_rtmp_packet_create(&pkt, RTMP_NETWORK_CHANNEL, RTMP_PT_BYTES_READ, ts, 4);
p = pkt.data;
- bytestream_put_be32(&p, rt->bytes_read);
- ff_rtmp_packet_write(rt->stream, &pkt, rt->chunk_size, rt->prev_pkt[1]);
- ff_rtmp_packet_destroy(&pkt);
+ bytestream_put_be16(&p, 27);
+ memcpy(p, rt->swfverification, 42);
+
+ return rtmp_send_packet(rt, &pkt, 0);
+}
+
+/**
+ * Generate server bandwidth message and send it to the server.
+ */
+static int gen_server_bw(URLContext *s, RTMPContext *rt)
+{
+ RTMPPacket pkt;
+ uint8_t *p;
+ int ret;
+
+ if ((ret = ff_rtmp_packet_create(&pkt, RTMP_NETWORK_CHANNEL, RTMP_PT_SERVER_BW,
+ 0, 4)) < 0)
+ return ret;
+
+ p = pkt.data;
+ bytestream_put_be32(&p, rt->server_bw);
+
+ return rtmp_send_packet(rt, &pkt, 0);
}
-//TODO: Move HMAC code somewhere. Eventually.
-#define HMAC_IPAD_VAL 0x36
-#define HMAC_OPAD_VAL 0x5C
+/**
+ * Generate check bandwidth message and send it to the server.
+ */
+static int gen_check_bw(URLContext *s, RTMPContext *rt)
+{
+ RTMPPacket pkt;
+ uint8_t *p;
+ int ret;
+
+ if ((ret = ff_rtmp_packet_create(&pkt, RTMP_SYSTEM_CHANNEL, RTMP_PT_INVOKE,
+ 0, 21)) < 0)
+ return ret;
+
+ p = pkt.data;
+ ff_amf_write_string(&p, "_checkbw");
+ ff_amf_write_number(&p, ++rt->nb_invokes);
+ ff_amf_write_null(&p);
+
+ return rtmp_send_packet(rt, &pkt, 1);
+}
/**
- * Calculate HMAC-SHA2 digest for RTMP handshake packets.
- *
- * @param src input buffer
- * @param len input buffer length (should be 1536)
- * @param gap offset in buffer where 32 bytes should not be taken into account
- * when calculating digest (since it will be used to store that digest)
- * @param key digest key
- * @param keylen digest key length
- * @param dst buffer where calculated digest will be stored (32 bytes)
+ * Generate report on bytes read so far and send it to the server.
*/
-static void rtmp_calc_digest(const uint8_t *src, int len, int gap,
- const uint8_t *key, int keylen, uint8_t *dst)
+static int gen_bytes_read(URLContext *s, RTMPContext *rt, uint32_t ts)
+{
+ RTMPPacket pkt;
+ uint8_t *p;
+ int ret;
+
+ if ((ret = ff_rtmp_packet_create(&pkt, RTMP_NETWORK_CHANNEL, RTMP_PT_BYTES_READ,
+ ts, 4)) < 0)
+ return ret;
+
+ p = pkt.data;
+ bytestream_put_be32(&p, rt->bytes_read);
+
+ return rtmp_send_packet(rt, &pkt, 0);
+}
+
+static int gen_fcsubscribe_stream(URLContext *s, RTMPContext *rt,
+ const char *subscribe)
+{
+ RTMPPacket pkt;
+ uint8_t *p;
+ int ret;
+
+ if ((ret = ff_rtmp_packet_create(&pkt, RTMP_SYSTEM_CHANNEL, RTMP_PT_INVOKE,
+ 0, 27 + strlen(subscribe))) < 0)
+ return ret;
+
+ p = pkt.data;
+ ff_amf_write_string(&p, "FCSubscribe");
+ ff_amf_write_number(&p, ++rt->nb_invokes);
+ ff_amf_write_null(&p);
+ ff_amf_write_string(&p, subscribe);
+
+ return rtmp_send_packet(rt, &pkt, 1);
+}
+
+int ff_rtmp_calc_digest(const uint8_t *src, int len, int gap,
+ const uint8_t *key, int keylen, uint8_t *dst)
{
struct AVSHA *sha;
uint8_t hmac_buf[64+32] = {0};
int i;
- sha = av_mallocz(av_sha_size);
+ sha = av_sha_alloc();
+ if (!sha)
+ return AVERROR(ENOMEM);
if (keylen < 64) {
memcpy(hmac_buf, key, keylen);
@@ -408,6 +900,20 @@ static void rtmp_calc_digest(const uint8_t *src, int len, int gap,
av_sha_final(sha, dst);
av_free(sha);
+
+ return 0;
+}
+
+int ff_rtmp_calc_digest_pos(const uint8_t *buf, int off, int mod_val,
+ int add_val)
+{
+ int i, digest_pos = 0;
+
+ for (i = 0; i < 4; i++)
+ digest_pos += buf[i + off];
+ digest_pos = digest_pos % mod_val + add_val;
+
+ return digest_pos;
}
/**
@@ -415,19 +921,24 @@ static void rtmp_calc_digest(const uint8_t *src, int len, int gap,
* will be stored) into that packet.
*
* @param buf handshake data (1536 bytes)
+ * @param encrypted use an encrypted connection (RTMPE)
* @return offset to the digest inside input data
*/
-static int rtmp_handshake_imprint_with_digest(uint8_t *buf)
+static int rtmp_handshake_imprint_with_digest(uint8_t *buf, int encrypted)
{
- int i, digest_pos = 0;
+ int ret, digest_pos;
- for (i = 8; i < 12; i++)
- digest_pos += buf[i];
- digest_pos = (digest_pos % 728) + 12;
+ if (encrypted)
+ digest_pos = ff_rtmp_calc_digest_pos(buf, 772, 728, 776);
+ else
+ digest_pos = ff_rtmp_calc_digest_pos(buf, 8, 728, 12);
+
+ ret = ff_rtmp_calc_digest(buf, RTMP_HANDSHAKE_PACKET_SIZE, digest_pos,
+ rtmp_player_key, PLAYER_KEY_OPEN_PART_LEN,
+ buf + digest_pos);
+ if (ret < 0)
+ return ret;
- rtmp_calc_digest(buf, RTMP_HANDSHAKE_PACKET_SIZE, digest_pos,
- rtmp_player_key, PLAYER_KEY_OPEN_PART_LEN,
- buf + digest_pos);
return digest_pos;
}
@@ -440,21 +951,169 @@ static int rtmp_handshake_imprint_with_digest(uint8_t *buf)
*/
static int rtmp_validate_digest(uint8_t *buf, int off)
{
- int i, digest_pos = 0;
uint8_t digest[32];
+ int ret, digest_pos;
- for (i = 0; i < 4; i++)
- digest_pos += buf[i + off];
- digest_pos = (digest_pos % 728) + off + 4;
+ digest_pos = ff_rtmp_calc_digest_pos(buf, off, 728, off + 4);
+
+ ret = ff_rtmp_calc_digest(buf, RTMP_HANDSHAKE_PACKET_SIZE, digest_pos,
+ rtmp_server_key, SERVER_KEY_OPEN_PART_LEN,
+ digest);
+ if (ret < 0)
+ return ret;
- rtmp_calc_digest(buf, RTMP_HANDSHAKE_PACKET_SIZE, digest_pos,
- rtmp_server_key, SERVER_KEY_OPEN_PART_LEN,
- digest);
if (!memcmp(digest, buf + digest_pos, 32))
return digest_pos;
return 0;
}
+static int rtmp_calc_swf_verification(URLContext *s, RTMPContext *rt,
+ uint8_t *buf)
+{
+ uint8_t *p;
+ int ret;
+
+ if (rt->swfhash_len != 32) {
+ av_log(s, AV_LOG_ERROR,
+ "Hash of the decompressed SWF file is not 32 bytes long.\n");
+ return AVERROR(EINVAL);
+ }
+
+ p = &rt->swfverification[0];
+ bytestream_put_byte(&p, 1);
+ bytestream_put_byte(&p, 1);
+ bytestream_put_be32(&p, rt->swfsize);
+ bytestream_put_be32(&p, rt->swfsize);
+
+ if ((ret = ff_rtmp_calc_digest(rt->swfhash, 32, 0, buf, 32, p)) < 0)
+ return ret;
+
+ return 0;
+}
+
+#if CONFIG_ZLIB
+static int rtmp_uncompress_swfplayer(uint8_t *in_data, int64_t in_size,
+ uint8_t **out_data, int64_t *out_size)
+{
+ z_stream zs = { 0 };
+ void *ptr;
+ int size;
+ int ret = 0;
+
+ zs.avail_in = in_size;
+ zs.next_in = in_data;
+ ret = inflateInit(&zs);
+ if (ret != Z_OK)
+ return AVERROR_UNKNOWN;
+
+ do {
+ uint8_t tmp_buf[16384];
+
+ zs.avail_out = sizeof(tmp_buf);
+ zs.next_out = tmp_buf;
+
+ ret = inflate(&zs, Z_NO_FLUSH);
+ if (ret != Z_OK && ret != Z_STREAM_END) {
+ ret = AVERROR_UNKNOWN;
+ goto fail;
+ }
+
+ size = sizeof(tmp_buf) - zs.avail_out;
+ if (!(ptr = av_realloc(*out_data, *out_size + size))) {
+ ret = AVERROR(ENOMEM);
+ goto fail;
+ }
+ *out_data = ptr;
+
+ memcpy(*out_data + *out_size, tmp_buf, size);
+ *out_size += size;
+ } while (zs.avail_out == 0);
+
+fail:
+ inflateEnd(&zs);
+ return ret;
+}
+#endif
+
+static int rtmp_calc_swfhash(URLContext *s)
+{
+ RTMPContext *rt = s->priv_data;
+ uint8_t *in_data = NULL, *out_data = NULL, *swfdata;
+ int64_t in_size, out_size;
+ URLContext *stream;
+ char swfhash[32];
+ int swfsize;
+ int ret = 0;
+
+ /* Get the SWF player file. */
+ if ((ret = ffurl_open(&stream, rt->swfverify, AVIO_FLAG_READ,
+ &s->interrupt_callback, NULL)) < 0) {
+ av_log(s, AV_LOG_ERROR, "Cannot open connection %s.\n", rt->swfverify);
+ goto fail;
+ }
+
+ if ((in_size = ffurl_seek(stream, 0, AVSEEK_SIZE)) < 0) {
+ ret = AVERROR(EIO);
+ goto fail;
+ }
+
+ if (!(in_data = av_malloc(in_size))) {
+ ret = AVERROR(ENOMEM);
+ goto fail;
+ }
+
+ if ((ret = ffurl_read_complete(stream, in_data, in_size)) < 0)
+ goto fail;
+
+ if (in_size < 3) {
+ ret = AVERROR_INVALIDDATA;
+ goto fail;
+ }
+
+ if (!memcmp(in_data, "CWS", 3)) {
+ /* Decompress the SWF player file using Zlib. */
+ if (!(out_data = av_malloc(8))) {
+ ret = AVERROR(ENOMEM);
+ goto fail;
+ }
+ *in_data = 'F'; // magic stuff
+ memcpy(out_data, in_data, 8);
+ out_size = 8;
+
+#if CONFIG_ZLIB
+ if ((ret = rtmp_uncompress_swfplayer(in_data + 8, in_size - 8,
+ &out_data, &out_size)) < 0)
+ goto fail;
+#else
+ av_log(s, AV_LOG_ERROR,
+ "Zlib is required for decompressing the SWF player file.\n");
+ ret = AVERROR(EINVAL);
+ goto fail;
+#endif
+ swfsize = out_size;
+ swfdata = out_data;
+ } else {
+ swfsize = in_size;
+ swfdata = in_data;
+ }
+
+ /* Compute the SHA256 hash of the SWF player file. */
+ if ((ret = ff_rtmp_calc_digest(swfdata, swfsize, 0,
+ "Genuine Adobe Flash Player 001", 30,
+ swfhash)) < 0)
+ goto fail;
+
+ /* Set SWFVerification parameters. */
+ av_opt_set_bin(rt, "rtmp_swfhash", swfhash, 32, 0);
+ rt->swfsize = swfsize;
+
+fail:
+ av_freep(&in_data);
+ av_freep(&out_data);
+ ffurl_close(stream);
+ return ret;
+}
+
/**
* Perform handshake with the server by means of exchanging pseudorandom data
* signed with HMAC-SHA2 digest.
@@ -476,7 +1135,8 @@ static int rtmp_handshake(URLContext *s, RTMPContext *rt)
uint8_t serverdata[RTMP_HANDSHAKE_PACKET_SIZE+1];
int i;
int server_pos, client_pos;
- uint8_t digest[32];
+ uint8_t digest[32], signature[32];
+ int ret, type = 0;
av_log(s, AV_LOG_DEBUG, "Handshaking...\n");
@@ -484,59 +1144,919 @@ static int rtmp_handshake(URLContext *s, RTMPContext *rt)
// generate handshake packet - 1536 bytes of pseudorandom data
for (i = 9; i <= RTMP_HANDSHAKE_PACKET_SIZE; i++)
tosend[i] = av_lfg_get(&rnd) >> 24;
- client_pos = rtmp_handshake_imprint_with_digest(tosend + 1);
- ffurl_write(rt->stream, tosend, RTMP_HANDSHAKE_PACKET_SIZE + 1);
- i = ffurl_read_complete(rt->stream, serverdata, RTMP_HANDSHAKE_PACKET_SIZE + 1);
- if (i != RTMP_HANDSHAKE_PACKET_SIZE + 1) {
+ if (rt->encrypted && CONFIG_FFRTMPCRYPT_PROTOCOL) {
+ /* When the client wants to use RTMPE, we have to change the command
+ * byte to 0x06 which means to use encrypted data and we have to set
+ * the flash version to at least 9.0.115.0. */
+ tosend[0] = 6;
+ tosend[5] = 128;
+ tosend[6] = 0;
+ tosend[7] = 3;
+ tosend[8] = 2;
+
+ /* Initialize the Diffie-Hellmann context and generate the public key
+ * to send to the server. */
+ if ((ret = ff_rtmpe_gen_pub_key(rt->stream, tosend + 1)) < 0)
+ return ret;
+ }
+
+ client_pos = rtmp_handshake_imprint_with_digest(tosend + 1, rt->encrypted);
+ if (client_pos < 0)
+ return client_pos;
+
+ if ((ret = ffurl_write(rt->stream, tosend,
+ RTMP_HANDSHAKE_PACKET_SIZE + 1)) < 0) {
+ av_log(s, AV_LOG_ERROR, "Cannot write RTMP handshake request\n");
+ return ret;
+ }
+
+ if ((ret = ffurl_read_complete(rt->stream, serverdata,
+ RTMP_HANDSHAKE_PACKET_SIZE + 1)) < 0) {
av_log(s, AV_LOG_ERROR, "Cannot read RTMP handshake response\n");
- return -1;
+ return ret;
}
- i = ffurl_read_complete(rt->stream, clientdata, RTMP_HANDSHAKE_PACKET_SIZE);
- if (i != RTMP_HANDSHAKE_PACKET_SIZE) {
+
+ if ((ret = ffurl_read_complete(rt->stream, clientdata,
+ RTMP_HANDSHAKE_PACKET_SIZE)) < 0) {
av_log(s, AV_LOG_ERROR, "Cannot read RTMP handshake response\n");
- return -1;
+ return ret;
}
+ av_log(s, AV_LOG_DEBUG, "Type answer %d\n", serverdata[0]);
av_log(s, AV_LOG_DEBUG, "Server version %d.%d.%d.%d\n",
serverdata[5], serverdata[6], serverdata[7], serverdata[8]);
if (rt->is_input && serverdata[5] >= 3) {
server_pos = rtmp_validate_digest(serverdata + 1, 772);
+ if (server_pos < 0)
+ return server_pos;
+
if (!server_pos) {
+ type = 1;
server_pos = rtmp_validate_digest(serverdata + 1, 8);
+ if (server_pos < 0)
+ return server_pos;
+
if (!server_pos) {
av_log(s, AV_LOG_ERROR, "Server response validating failed\n");
- return -1;
+ return AVERROR(EIO);
}
}
- rtmp_calc_digest(tosend + 1 + client_pos, 32, 0,
- rtmp_server_key, sizeof(rtmp_server_key),
- digest);
- rtmp_calc_digest(clientdata, RTMP_HANDSHAKE_PACKET_SIZE-32, 0,
- digest, 32,
- digest);
- if (memcmp(digest, clientdata + RTMP_HANDSHAKE_PACKET_SIZE - 32, 32)) {
+ /* Generate SWFVerification token (SHA256 HMAC hash of decompressed SWF,
+ * key are the last 32 bytes of the server handshake. */
+ if (rt->swfsize) {
+ if ((ret = rtmp_calc_swf_verification(s, rt, serverdata + 1 +
+ RTMP_HANDSHAKE_PACKET_SIZE - 32)) < 0)
+ return ret;
+ }
+
+ ret = ff_rtmp_calc_digest(tosend + 1 + client_pos, 32, 0,
+ rtmp_server_key, sizeof(rtmp_server_key),
+ digest);
+ if (ret < 0)
+ return ret;
+
+ ret = ff_rtmp_calc_digest(clientdata, RTMP_HANDSHAKE_PACKET_SIZE - 32,
+ 0, digest, 32, signature);
+ if (ret < 0)
+ return ret;
+
+ if (rt->encrypted && CONFIG_FFRTMPCRYPT_PROTOCOL) {
+ /* Compute the shared secret key sent by the server and initialize
+ * the RC4 encryption. */
+ if ((ret = ff_rtmpe_compute_secret_key(rt->stream, serverdata + 1,
+ tosend + 1, type)) < 0)
+ return ret;
+
+ /* Encrypt the signature received by the server. */
+ ff_rtmpe_encrypt_sig(rt->stream, signature, digest, serverdata[0]);
+ }
+
+ if (memcmp(signature, clientdata + RTMP_HANDSHAKE_PACKET_SIZE - 32, 32)) {
av_log(s, AV_LOG_ERROR, "Signature mismatch\n");
- return -1;
+ return AVERROR(EIO);
}
for (i = 0; i < RTMP_HANDSHAKE_PACKET_SIZE; i++)
tosend[i] = av_lfg_get(&rnd) >> 24;
- rtmp_calc_digest(serverdata + 1 + server_pos, 32, 0,
- rtmp_player_key, sizeof(rtmp_player_key),
- digest);
- rtmp_calc_digest(tosend, RTMP_HANDSHAKE_PACKET_SIZE - 32, 0,
- digest, 32,
- tosend + RTMP_HANDSHAKE_PACKET_SIZE - 32);
+ ret = ff_rtmp_calc_digest(serverdata + 1 + server_pos, 32, 0,
+ rtmp_player_key, sizeof(rtmp_player_key),
+ digest);
+ if (ret < 0)
+ return ret;
+
+ ret = ff_rtmp_calc_digest(tosend, RTMP_HANDSHAKE_PACKET_SIZE - 32, 0,
+ digest, 32,
+ tosend + RTMP_HANDSHAKE_PACKET_SIZE - 32);
+ if (ret < 0)
+ return ret;
+
+ if (rt->encrypted && CONFIG_FFRTMPCRYPT_PROTOCOL) {
+ /* Encrypt the signature to be send to the server. */
+ ff_rtmpe_encrypt_sig(rt->stream, tosend +
+ RTMP_HANDSHAKE_PACKET_SIZE - 32, digest,
+ serverdata[0]);
+ }
// write reply back to the server
- ffurl_write(rt->stream, tosend, RTMP_HANDSHAKE_PACKET_SIZE);
+ if ((ret = ffurl_write(rt->stream, tosend,
+ RTMP_HANDSHAKE_PACKET_SIZE)) < 0)
+ return ret;
+
+ if (rt->encrypted && CONFIG_FFRTMPCRYPT_PROTOCOL) {
+ /* Set RC4 keys for encryption and update the keystreams. */
+ if ((ret = ff_rtmpe_update_keystream(rt->stream)) < 0)
+ return ret;
+ }
+ } else {
+ if (rt->encrypted && CONFIG_FFRTMPCRYPT_PROTOCOL) {
+ /* Compute the shared secret key sent by the server and initialize
+ * the RC4 encryption. */
+ if ((ret = ff_rtmpe_compute_secret_key(rt->stream, serverdata + 1,
+ tosend + 1, 1)) < 0)
+ return ret;
+
+ if (serverdata[0] == 9) {
+ /* Encrypt the signature received by the server. */
+ ff_rtmpe_encrypt_sig(rt->stream, signature, digest,
+ serverdata[0]);
+ }
+ }
+
+ if ((ret = ffurl_write(rt->stream, serverdata + 1,
+ RTMP_HANDSHAKE_PACKET_SIZE)) < 0)
+ return ret;
+
+ if (rt->encrypted && CONFIG_FFRTMPCRYPT_PROTOCOL) {
+ /* Set RC4 keys for encryption and update the keystreams. */
+ if ((ret = ff_rtmpe_update_keystream(rt->stream)) < 0)
+ return ret;
+ }
+ }
+
+ return 0;
+}
+
+static int rtmp_receive_hs_packet(RTMPContext* rt, uint32_t *first_int,
+ uint32_t *second_int, char *arraydata,
+ int size)
+{
+ int inoutsize;
+
+ inoutsize = ffurl_read_complete(rt->stream, arraydata,
+ RTMP_HANDSHAKE_PACKET_SIZE);
+ if (inoutsize <= 0)
+ return AVERROR(EIO);
+ if (inoutsize != RTMP_HANDSHAKE_PACKET_SIZE) {
+ av_log(rt, AV_LOG_ERROR, "Erroneous Message size %d"
+ " not following standard\n", (int)inoutsize);
+ return AVERROR(EINVAL);
+ }
+
+ *first_int = AV_RB32(arraydata);
+ *second_int = AV_RB32(arraydata + 4);
+ return 0;
+}
+
+static int rtmp_send_hs_packet(RTMPContext* rt, uint32_t first_int,
+ uint32_t second_int, char *arraydata, int size)
+{
+ int inoutsize;
+
+ AV_WB32(arraydata, first_int);
+ AV_WB32(arraydata + 4, first_int);
+ inoutsize = ffurl_write(rt->stream, arraydata,
+ RTMP_HANDSHAKE_PACKET_SIZE);
+ if (inoutsize != RTMP_HANDSHAKE_PACKET_SIZE) {
+ av_log(rt, AV_LOG_ERROR, "Unable to write answer\n");
+ return AVERROR(EIO);
+ }
+
+ return 0;
+}
+
+/**
+ * rtmp handshake server side
+ */
+static int rtmp_server_handshake(URLContext *s, RTMPContext *rt)
+{
+ uint8_t buffer[RTMP_HANDSHAKE_PACKET_SIZE];
+ uint32_t hs_epoch;
+ uint32_t hs_my_epoch;
+ uint8_t hs_c1[RTMP_HANDSHAKE_PACKET_SIZE];
+ uint8_t hs_s1[RTMP_HANDSHAKE_PACKET_SIZE];
+ uint32_t zeroes;
+ uint32_t temp = 0;
+ int randomidx = 0;
+ int inoutsize = 0;
+ int ret;
+
+ inoutsize = ffurl_read_complete(rt->stream, buffer, 1); // Receive C0
+ if (inoutsize <= 0) {
+ av_log(s, AV_LOG_ERROR, "Unable to read handshake\n");
+ return AVERROR(EIO);
+ }
+ // Check Version
+ if (buffer[0] != 3) {
+ av_log(s, AV_LOG_ERROR, "RTMP protocol version mismatch\n");
+ return AVERROR(EIO);
+ }
+ if (ffurl_write(rt->stream, buffer, 1) <= 0) { // Send S0
+ av_log(s, AV_LOG_ERROR,
+ "Unable to write answer - RTMP S0\n");
+ return AVERROR(EIO);
+ }
+ /* Receive C1 */
+ ret = rtmp_receive_hs_packet(rt, &hs_epoch, &zeroes, hs_c1,
+ RTMP_HANDSHAKE_PACKET_SIZE);
+ if (ret) {
+ av_log(s, AV_LOG_ERROR, "RTMP Handshake C1 Error\n");
+ return ret;
+ }
+ if (zeroes)
+ av_log(s, AV_LOG_WARNING, "Erroneous C1 Message zero != 0\n");
+ /* Send S1 */
+ /* By now same epoch will be sent */
+ hs_my_epoch = hs_epoch;
+ /* Generate random */
+ for (randomidx = 8; randomidx < (RTMP_HANDSHAKE_PACKET_SIZE);
+ randomidx += 4)
+ AV_WB32(hs_s1 + randomidx, av_get_random_seed());
+
+ ret = rtmp_send_hs_packet(rt, hs_my_epoch, 0, hs_s1,
+ RTMP_HANDSHAKE_PACKET_SIZE);
+ if (ret) {
+ av_log(s, AV_LOG_ERROR, "RTMP Handshake S1 Error\n");
+ return ret;
+ }
+ /* Send S2 */
+ ret = rtmp_send_hs_packet(rt, hs_epoch, 0, hs_c1,
+ RTMP_HANDSHAKE_PACKET_SIZE);
+ if (ret) {
+ av_log(s, AV_LOG_ERROR, "RTMP Handshake S2 Error\n");
+ return ret;
+ }
+ /* Receive C2 */
+ ret = rtmp_receive_hs_packet(rt, &temp, &zeroes, buffer,
+ RTMP_HANDSHAKE_PACKET_SIZE);
+ if (ret) {
+ av_log(s, AV_LOG_ERROR, "RTMP Handshake C2 Error\n");
+ return ret;
+ }
+ if (temp != hs_my_epoch)
+ av_log(s, AV_LOG_WARNING,
+ "Erroneous C2 Message epoch does not match up with C1 epoch\n");
+ if (memcmp(buffer + 8, hs_s1 + 8,
+ RTMP_HANDSHAKE_PACKET_SIZE - 8))
+ av_log(s, AV_LOG_WARNING,
+ "Erroneous C2 Message random does not match up\n");
+
+ return 0;
+}
+
+static int handle_chunk_size(URLContext *s, RTMPPacket *pkt)
+{
+ RTMPContext *rt = s->priv_data;
+ int ret;
+
+ if (pkt->data_size < 4) {
+ av_log(s, AV_LOG_ERROR,
+ "Too short chunk size change packet (%d)\n",
+ pkt->data_size);
+ return AVERROR_INVALIDDATA;
+ }
+
+ if (!rt->is_input) {
+ /* Send the same chunk size change packet back to the server,
+ * setting the outgoing chunk size to the same as the incoming one. */
+ if ((ret = ff_rtmp_packet_write(rt->stream, pkt, rt->out_chunk_size,
+ rt->prev_pkt[1])) < 0)
+ return ret;
+ rt->out_chunk_size = AV_RB32(pkt->data);
+ }
+
+ rt->in_chunk_size = AV_RB32(pkt->data);
+ if (rt->in_chunk_size <= 0) {
+ av_log(s, AV_LOG_ERROR, "Incorrect chunk size %d\n",
+ rt->in_chunk_size);
+ return AVERROR_INVALIDDATA;
+ }
+ av_log(s, AV_LOG_DEBUG, "New incoming chunk size = %d\n",
+ rt->in_chunk_size);
+
+ return 0;
+}
+
+static int handle_ping(URLContext *s, RTMPPacket *pkt)
+{
+ RTMPContext *rt = s->priv_data;
+ int t, ret;
+
+ if (pkt->data_size < 2) {
+ av_log(s, AV_LOG_ERROR, "Too short ping packet (%d)\n",
+ pkt->data_size);
+ return AVERROR_INVALIDDATA;
+ }
+
+ t = AV_RB16(pkt->data);
+ if (t == 6) {
+ if ((ret = gen_pong(s, rt, pkt)) < 0)
+ return ret;
+ } else if (t == 26) {
+ if (rt->swfsize) {
+ if ((ret = gen_swf_verification(s, rt)) < 0)
+ return ret;
+ } else {
+ av_log(s, AV_LOG_WARNING, "Ignoring SWFVerification request.\n");
+ }
+ }
+
+ return 0;
+}
+
+static int handle_client_bw(URLContext *s, RTMPPacket *pkt)
+{
+ RTMPContext *rt = s->priv_data;
+
+ if (pkt->data_size < 4) {
+ av_log(s, AV_LOG_ERROR,
+ "Client bandwidth report packet is less than 4 bytes long (%d)\n",
+ pkt->data_size);
+ return AVERROR_INVALIDDATA;
+ }
+
+ rt->client_report_size = AV_RB32(pkt->data);
+ if (rt->client_report_size <= 0) {
+ av_log(s, AV_LOG_ERROR, "Incorrect client bandwidth %d\n",
+ rt->client_report_size);
+ return AVERROR_INVALIDDATA;
+
+ }
+ av_log(s, AV_LOG_DEBUG, "Client bandwidth = %d\n", rt->client_report_size);
+ rt->client_report_size >>= 1;
+
+ return 0;
+}
+
+static int handle_server_bw(URLContext *s, RTMPPacket *pkt)
+{
+ RTMPContext *rt = s->priv_data;
+
+ if (pkt->data_size < 4) {
+ av_log(s, AV_LOG_ERROR,
+ "Too short server bandwidth report packet (%d)\n",
+ pkt->data_size);
+ return AVERROR_INVALIDDATA;
+ }
+
+ rt->server_bw = AV_RB32(pkt->data);
+ if (rt->server_bw <= 0) {
+ av_log(s, AV_LOG_ERROR, "Incorrect server bandwidth %d\n",
+ rt->server_bw);
+ return AVERROR_INVALIDDATA;
+ }
+ av_log(s, AV_LOG_DEBUG, "Server bandwidth = %d\n", rt->server_bw);
+
+ return 0;
+}
+
+static int do_adobe_auth(RTMPContext *rt, const char *user, const char *salt,
+ const char *opaque, const char *challenge)
+{
+ uint8_t hash[16];
+ char hashstr[AV_BASE64_SIZE(sizeof(hash))], challenge2[10];
+ struct AVMD5 *md5 = av_md5_alloc();
+ if (!md5)
+ return AVERROR(ENOMEM);
+
+ snprintf(challenge2, sizeof(challenge2), "%08x", av_get_random_seed());
+
+ av_md5_init(md5);
+ av_md5_update(md5, user, strlen(user));
+ av_md5_update(md5, salt, strlen(salt));
+ av_md5_update(md5, rt->password, strlen(rt->password));
+ av_md5_final(md5, hash);
+ av_base64_encode(hashstr, sizeof(hashstr), hash,
+ sizeof(hash));
+ av_md5_init(md5);
+ av_md5_update(md5, hashstr, strlen(hashstr));
+ if (opaque)
+ av_md5_update(md5, opaque, strlen(opaque));
+ else if (challenge)
+ av_md5_update(md5, challenge, strlen(challenge));
+ av_md5_update(md5, challenge2, strlen(challenge2));
+ av_md5_final(md5, hash);
+ av_base64_encode(hashstr, sizeof(hashstr), hash,
+ sizeof(hash));
+ snprintf(rt->auth_params, sizeof(rt->auth_params),
+ "?authmod=%s&user=%s&challenge=%s&response=%s",
+ "adobe", user, challenge2, hashstr);
+ if (opaque)
+ av_strlcatf(rt->auth_params, sizeof(rt->auth_params),
+ "&opaque=%s", opaque);
+
+ av_free(md5);
+ return 0;
+}
+
+static int do_llnw_auth(RTMPContext *rt, const char *user, const char *nonce)
+{
+ uint8_t hash[16];
+ char hashstr1[33], hashstr2[33];
+ const char *realm = "live";
+ const char *method = "publish";
+ const char *qop = "auth";
+ const char *nc = "00000001";
+ char cnonce[10];
+ struct AVMD5 *md5 = av_md5_alloc();
+ if (!md5)
+ return AVERROR(ENOMEM);
+
+ snprintf(cnonce, sizeof(cnonce), "%08x", av_get_random_seed());
+
+ av_md5_init(md5);
+ av_md5_update(md5, user, strlen(user));
+ av_md5_update(md5, ":", 1);
+ av_md5_update(md5, realm, strlen(realm));
+ av_md5_update(md5, ":", 1);
+ av_md5_update(md5, rt->password, strlen(rt->password));
+ av_md5_final(md5, hash);
+ ff_data_to_hex(hashstr1, hash, 16, 1);
+ hashstr1[32] = '\0';
+
+ av_md5_init(md5);
+ av_md5_update(md5, method, strlen(method));
+ av_md5_update(md5, ":/", 2);
+ av_md5_update(md5, rt->app, strlen(rt->app));
+ av_md5_final(md5, hash);
+ ff_data_to_hex(hashstr2, hash, 16, 1);
+ hashstr2[32] = '\0';
+
+ av_md5_init(md5);
+ av_md5_update(md5, hashstr1, strlen(hashstr1));
+ av_md5_update(md5, ":", 1);
+ if (nonce)
+ av_md5_update(md5, nonce, strlen(nonce));
+ av_md5_update(md5, ":", 1);
+ av_md5_update(md5, nc, strlen(nc));
+ av_md5_update(md5, ":", 1);
+ av_md5_update(md5, cnonce, strlen(cnonce));
+ av_md5_update(md5, ":", 1);
+ av_md5_update(md5, qop, strlen(qop));
+ av_md5_update(md5, ":", 1);
+ av_md5_update(md5, hashstr2, strlen(hashstr2));
+ av_md5_final(md5, hash);
+ ff_data_to_hex(hashstr1, hash, 16, 1);
+
+ snprintf(rt->auth_params, sizeof(rt->auth_params),
+ "?authmod=%s&user=%s&nonce=%s&cnonce=%s&nc=%s&response=%s",
+ "llnw", user, nonce, cnonce, nc, hashstr1);
+
+ av_free(md5);
+ return 0;
+}
+
+static int handle_connect_error(URLContext *s, const char *desc)
+{
+ RTMPContext *rt = s->priv_data;
+ char buf[300], *ptr, authmod[15];
+ int i = 0, ret = 0;
+ const char *user = "", *salt = "", *opaque = NULL,
+ *challenge = NULL, *cptr = NULL, *nonce = NULL;
+
+ if (!(cptr = strstr(desc, "authmod=adobe")) &&
+ !(cptr = strstr(desc, "authmod=llnw"))) {
+ av_log(s, AV_LOG_ERROR,
+ "Unknown connect error (unsupported authentication method?)\n");
+ return AVERROR_UNKNOWN;
+ }
+ cptr += strlen("authmod=");
+ while (*cptr && *cptr != ' ' && i < sizeof(authmod) - 1)
+ authmod[i++] = *cptr++;
+ authmod[i] = '\0';
+
+ if (!rt->username[0] || !rt->password[0]) {
+ av_log(s, AV_LOG_ERROR, "No credentials set\n");
+ return AVERROR_UNKNOWN;
+ }
+
+ if (strstr(desc, "?reason=authfailed")) {
+ av_log(s, AV_LOG_ERROR, "Incorrect username/password\n");
+ return AVERROR_UNKNOWN;
+ } else if (strstr(desc, "?reason=nosuchuser")) {
+ av_log(s, AV_LOG_ERROR, "Incorrect username\n");
+ return AVERROR_UNKNOWN;
+ }
+
+ if (rt->auth_tried) {
+ av_log(s, AV_LOG_ERROR, "Authentication failed\n");
+ return AVERROR_UNKNOWN;
+ }
+
+ rt->auth_params[0] = '\0';
+
+ if (strstr(desc, "code=403 need auth")) {
+ snprintf(rt->auth_params, sizeof(rt->auth_params),
+ "?authmod=%s&user=%s", authmod, rt->username);
+ return 0;
+ }
+
+ if (!(cptr = strstr(desc, "?reason=needauth"))) {
+ av_log(s, AV_LOG_ERROR, "No auth parameters found\n");
+ return AVERROR_UNKNOWN;
+ }
+
+ av_strlcpy(buf, cptr + 1, sizeof(buf));
+ ptr = buf;
+
+ while (ptr) {
+ char *next = strchr(ptr, '&');
+ char *value = strchr(ptr, '=');
+ if (next)
+ *next++ = '\0';
+ if (value)
+ *value++ = '\0';
+ if (!strcmp(ptr, "user")) {
+ user = value;
+ } else if (!strcmp(ptr, "salt")) {
+ salt = value;
+ } else if (!strcmp(ptr, "opaque")) {
+ opaque = value;
+ } else if (!strcmp(ptr, "challenge")) {
+ challenge = value;
+ } else if (!strcmp(ptr, "nonce")) {
+ nonce = value;
+ }
+ ptr = next;
+ }
+
+ if (!strcmp(authmod, "adobe")) {
+ if ((ret = do_adobe_auth(rt, user, salt, challenge, opaque)) < 0)
+ return ret;
+ } else {
+ if ((ret = do_llnw_auth(rt, user, nonce)) < 0)
+ return ret;
+ }
+
+ rt->auth_tried = 1;
+ return 0;
+}
+
+static int handle_invoke_error(URLContext *s, RTMPPacket *pkt)
+{
+ RTMPContext *rt = s->priv_data;
+ const uint8_t *data_end = pkt->data + pkt->data_size;
+ char *tracked_method = NULL;
+ int level = AV_LOG_ERROR;
+ uint8_t tmpstr[256];
+ int ret;
+
+ if ((ret = find_tracked_method(s, pkt, 9, &tracked_method)) < 0)
+ return ret;
+
+ if (!ff_amf_get_field_value(pkt->data + 9, data_end,
+ "description", tmpstr, sizeof(tmpstr))) {
+ if (tracked_method && (!strcmp(tracked_method, "_checkbw") ||
+ !strcmp(tracked_method, "releaseStream") ||
+ !strcmp(tracked_method, "FCSubscribe") ||
+ !strcmp(tracked_method, "FCPublish"))) {
+ /* Gracefully ignore Adobe-specific historical artifact errors. */
+ level = AV_LOG_WARNING;
+ ret = 0;
+ } else if (tracked_method && !strcmp(tracked_method, "connect")) {
+ ret = handle_connect_error(s, tmpstr);
+ if (!ret) {
+ rt->do_reconnect = 1;
+ level = AV_LOG_VERBOSE;
+ }
+ } else
+ ret = AVERROR_UNKNOWN;
+ av_log(s, level, "Server error: %s\n", tmpstr);
+ }
+
+ av_free(tracked_method);
+ return ret;
+}
+
+static int send_invoke_response(URLContext *s, RTMPPacket *pkt)
+{
+ RTMPContext *rt = s->priv_data;
+ double seqnum;
+ char filename[64];
+ char command[64];
+ char statusmsg[128];
+ int stringlen;
+ char *pchar;
+ const uint8_t *p = pkt->data;
+ uint8_t *pp = NULL;
+ RTMPPacket spkt = { 0 };
+ GetByteContext gbc;
+ int ret;
+
+ bytestream2_init(&gbc, p, pkt->data_size);
+ if (ff_amf_read_string(&gbc, command, sizeof(command),
+ &stringlen)) {
+ av_log(s, AV_LOG_ERROR, "Error in PT_INVOKE\n");
+ return AVERROR_INVALIDDATA;
+ }
+
+ ret = ff_amf_read_number(&gbc, &seqnum);
+ if (ret)
+ return ret;
+ ret = ff_amf_read_null(&gbc);
+ if (ret)
+ return ret;
+ if (!strcmp(command, "FCPublish") ||
+ !strcmp(command, "publish")) {
+ ret = ff_amf_read_string(&gbc, filename,
+ sizeof(filename), &stringlen);
+ // check with url
+ if (s->filename) {
+ pchar = strrchr(s->filename, '/');
+ if (!pchar) {
+ av_log(s, AV_LOG_WARNING,
+ "Unable to find / in url %s, bad format\n",
+ s->filename);
+ pchar = s->filename;
+ }
+ pchar++;
+ if (strcmp(pchar, filename))
+ av_log(s, AV_LOG_WARNING, "Unexpected stream %s, expecting"
+ " %s\n", filename, pchar);
+ }
+ rt->state = STATE_RECEIVING;
+ }
+
+ if (!strcmp(command, "FCPublish")) {
+ if ((ret = ff_rtmp_packet_create(&spkt, RTMP_SYSTEM_CHANNEL,
+ RTMP_PT_INVOKE, 0,
+ RTMP_PKTDATA_DEFAULT_SIZE)) < 0) {
+ av_log(s, AV_LOG_ERROR, "Unable to create response packet\n");
+ return ret;
+ }
+ pp = spkt.data;
+ ff_amf_write_string(&pp, "onFCPublish");
+ } else if (!strcmp(command, "publish")) {
+ PutByteContext pbc;
+ // Send Stream Begin 1
+ if ((ret = ff_rtmp_packet_create(&spkt, RTMP_NETWORK_CHANNEL,
+ RTMP_PT_PING, 0, 6)) < 0) {
+ av_log(s, AV_LOG_ERROR, "Unable to create response packet\n");
+ return ret;
+ }
+ pp = spkt.data;
+ bytestream2_init_writer(&pbc, pp, spkt.data_size);
+ bytestream2_put_be16(&pbc, 0); // 0 -> Stream Begin
+ bytestream2_put_be32(&pbc, rt->nb_streamid);
+ ret = ff_rtmp_packet_write(rt->stream, &spkt, rt->out_chunk_size,
+ rt->prev_pkt[1]);
+ ff_rtmp_packet_destroy(&spkt);
+ if (ret < 0)
+ return ret;
+
+ // Send onStatus(NetStream.Publish.Start)
+ if ((ret = ff_rtmp_packet_create(&spkt, RTMP_SYSTEM_CHANNEL,
+ RTMP_PT_INVOKE, 0,
+ RTMP_PKTDATA_DEFAULT_SIZE)) < 0) {
+ av_log(s, AV_LOG_ERROR, "Unable to create response packet\n");
+ return ret;
+ }
+ spkt.extra = pkt->extra;
+ pp = spkt.data;
+ ff_amf_write_string(&pp, "onStatus");
+ ff_amf_write_number(&pp, 0);
+ ff_amf_write_null(&pp);
+
+ ff_amf_write_object_start(&pp);
+ ff_amf_write_field_name(&pp, "level");
+ ff_amf_write_string(&pp, "status");
+ ff_amf_write_field_name(&pp, "code");
+ ff_amf_write_string(&pp, "NetStream.Publish.Start");
+ ff_amf_write_field_name(&pp, "description");
+ snprintf(statusmsg, sizeof(statusmsg),
+ "%s is now published", filename);
+ ff_amf_write_string(&pp, statusmsg);
+ ff_amf_write_field_name(&pp, "details");
+ ff_amf_write_string(&pp, filename);
+ ff_amf_write_field_name(&pp, "clientid");
+ snprintf(statusmsg, sizeof(statusmsg), "%s", LIBAVFORMAT_IDENT);
+ ff_amf_write_string(&pp, statusmsg);
+ ff_amf_write_object_end(&pp);
+
} else {
- ffurl_write(rt->stream, serverdata+1, RTMP_HANDSHAKE_PACKET_SIZE);
+ if ((ret = ff_rtmp_packet_create(&spkt, RTMP_SYSTEM_CHANNEL,
+ RTMP_PT_INVOKE, 0,
+ RTMP_PKTDATA_DEFAULT_SIZE)) < 0) {
+ av_log(s, AV_LOG_ERROR, "Unable to create response packet\n");
+ return ret;
+ }
+ pp = spkt.data;
+ ff_amf_write_string(&pp, "_result");
+ ff_amf_write_number(&pp, seqnum);
+ ff_amf_write_null(&pp);
+ if (!strcmp(command, "createStream")) {
+ rt->nb_streamid++;
+ if (rt->nb_streamid == 0 || rt->nb_streamid == 2)
+ rt->nb_streamid++; /* Values 0 and 2 are reserved */
+ ff_amf_write_number(&pp, rt->nb_streamid);
+ /* By now we don't control which streams are removed in
+ * deleteStream. There is no stream creation control
+ * if a client creates more than 2^32 - 2 streams. */
+ }
+ }
+ spkt.data_size = pp - spkt.data;
+ ret = ff_rtmp_packet_write(rt->stream, &spkt, rt->out_chunk_size,
+ rt->prev_pkt[1]);
+ ff_rtmp_packet_destroy(&spkt);
+ return ret;
+}
+
+static int handle_invoke_result(URLContext *s, RTMPPacket *pkt)
+{
+ RTMPContext *rt = s->priv_data;
+ char *tracked_method = NULL;
+ int ret = 0;
+
+ if ((ret = find_tracked_method(s, pkt, 10, &tracked_method)) < 0)
+ return ret;
+
+ if (!tracked_method) {
+ /* Ignore this reply when the current method is not tracked. */
+ return ret;
+ }
+
+ if (!memcmp(tracked_method, "connect", 7)) {
+ if (!rt->is_input) {
+ if ((ret = gen_release_stream(s, rt)) < 0)
+ goto fail;
+
+ if ((ret = gen_fcpublish_stream(s, rt)) < 0)
+ goto fail;
+ } else {
+ if ((ret = gen_server_bw(s, rt)) < 0)
+ goto fail;
+ }
+
+ if ((ret = gen_create_stream(s, rt)) < 0)
+ goto fail;
+
+ if (rt->is_input) {
+ /* Send the FCSubscribe command when the name of live
+ * stream is defined by the user or if it's a live stream. */
+ if (rt->subscribe) {
+ if ((ret = gen_fcsubscribe_stream(s, rt, rt->subscribe)) < 0)
+ goto fail;
+ } else if (rt->live == -1) {
+ if ((ret = gen_fcsubscribe_stream(s, rt, rt->playpath)) < 0)
+ goto fail;
+ }
+ }
+ } else if (!memcmp(tracked_method, "createStream", 12)) {
+ //extract a number from the result
+ if (pkt->data[10] || pkt->data[19] != 5 || pkt->data[20]) {
+ av_log(s, AV_LOG_WARNING, "Unexpected reply on connect()\n");
+ } else {
+ rt->main_channel_id = av_int2double(AV_RB64(pkt->data + 21));
+ }
+
+ if (!rt->is_input) {
+ if ((ret = gen_publish(s, rt)) < 0)
+ goto fail;
+ } else {
+ if ((ret = gen_play(s, rt)) < 0)
+ goto fail;
+ if ((ret = gen_buffer_time(s, rt)) < 0)
+ goto fail;
+ }
}
+fail:
+ av_free(tracked_method);
+ return ret;
+}
+
+static int handle_invoke_status(URLContext *s, RTMPPacket *pkt)
+{
+ RTMPContext *rt = s->priv_data;
+ const uint8_t *data_end = pkt->data + pkt->data_size;
+ const uint8_t *ptr = pkt->data + 11;
+ uint8_t tmpstr[256];
+ int i, t;
+
+ for (i = 0; i < 2; i++) {
+ t = ff_amf_tag_size(ptr, data_end);
+ if (t < 0)
+ return 1;
+ ptr += t;
+ }
+
+ t = ff_amf_get_field_value(ptr, data_end, "level", tmpstr, sizeof(tmpstr));
+ if (!t && !strcmp(tmpstr, "error")) {
+ if (!ff_amf_get_field_value(ptr, data_end,
+ "description", tmpstr, sizeof(tmpstr)))
+ av_log(s, AV_LOG_ERROR, "Server error: %s\n", tmpstr);
+ return -1;
+ }
+
+ t = ff_amf_get_field_value(ptr, data_end, "code", tmpstr, sizeof(tmpstr));
+ if (!t && !strcmp(tmpstr, "NetStream.Play.Start")) rt->state = STATE_PLAYING;
+ if (!t && !strcmp(tmpstr, "NetStream.Play.Stop")) rt->state = STATE_STOPPED;
+ if (!t && !strcmp(tmpstr, "NetStream.Play.UnpublishNotify")) rt->state = STATE_STOPPED;
+ if (!t && !strcmp(tmpstr, "NetStream.Publish.Start")) rt->state = STATE_PUBLISHING;
+
+ return 0;
+}
+
+static int handle_invoke(URLContext *s, RTMPPacket *pkt)
+{
+ RTMPContext *rt = s->priv_data;
+ int ret = 0;
+
+ //TODO: check for the messages sent for wrong state?
+ if (!memcmp(pkt->data, "\002\000\006_error", 9)) {
+ if ((ret = handle_invoke_error(s, pkt)) < 0)
+ return ret;
+ } else if (!memcmp(pkt->data, "\002\000\007_result", 10)) {
+ if ((ret = handle_invoke_result(s, pkt)) < 0)
+ return ret;
+ } else if (!memcmp(pkt->data, "\002\000\010onStatus", 11)) {
+ if ((ret = handle_invoke_status(s, pkt)) < 0)
+ return ret;
+ } else if (!memcmp(pkt->data, "\002\000\010onBWDone", 11)) {
+ if ((ret = gen_check_bw(s, rt)) < 0)
+ return ret;
+ } else if (!memcmp(pkt->data, "\002\000\015releaseStream", 16) ||
+ !memcmp(pkt->data, "\002\000\011FCPublish", 12) ||
+ !memcmp(pkt->data, "\002\000\007publish", 10) ||
+ !memcmp(pkt->data, "\002\000\010_checkbw", 11) ||
+ !memcmp(pkt->data, "\002\000\014createStream", 15)) {
+ if (ret = send_invoke_response(s, pkt) < 0)
+ return ret;
+ }
+
+ return ret;
+}
+
+static int handle_notify(URLContext *s, RTMPPacket *pkt) {
+ RTMPContext *rt = s->priv_data;
+ const uint8_t *p = NULL;
+ uint8_t *cp = NULL;
+ uint8_t commandbuffer[64];
+ char statusmsg[128];
+ int stringlen;
+ GetByteContext gbc;
+ PutByteContext pbc;
+ uint32_t ts;
+ int old_flv_size;
+ const uint8_t *datatowrite;
+ unsigned datatowritelength;
+
+ p = pkt->data;
+ bytestream2_init(&gbc, p, pkt->data_size);
+ if (ff_amf_read_string(&gbc, commandbuffer, sizeof(commandbuffer),
+ &stringlen))
+ return AVERROR_INVALIDDATA;
+ if (!strcmp(commandbuffer, "@setDataFrame")) {
+ datatowrite = gbc.buffer;
+ datatowritelength = bytestream2_get_bytes_left(&gbc);
+ if (ff_amf_read_string(&gbc, statusmsg,
+ sizeof(statusmsg), &stringlen))
+ return AVERROR_INVALIDDATA;
+ if (strcmp(statusmsg, "onMetaData")) {
+ av_log(s, AV_LOG_INFO, "Expecting onMetadata but got %s\n",
+ statusmsg);
+ return 0;
+ }
+
+ /* Provide ECMAArray to flv */
+ ts = pkt->timestamp;
+
+ // generate packet header and put data into buffer for FLV demuxer
+ if (rt->flv_off < rt->flv_size) {
+ old_flv_size = rt->flv_size;
+ rt->flv_size += datatowritelength + 15;
+ } else {
+ old_flv_size = 0;
+ rt->flv_size = datatowritelength + 15;
+ rt->flv_off = 0;
+ }
+
+ cp = av_realloc(rt->flv_data, rt->flv_size);
+ if (!cp)
+ return AVERROR(ENOMEM);
+ rt->flv_data = cp;
+ bytestream2_init_writer(&pbc, cp, rt->flv_size);
+ bytestream2_skip_p(&pbc, old_flv_size);
+ bytestream2_put_byte(&pbc, pkt->type);
+ bytestream2_put_be24(&pbc, datatowritelength);
+ bytestream2_put_be24(&pbc, ts);
+ bytestream2_put_byte(&pbc, ts >> 24);
+ bytestream2_put_be24(&pbc, 0);
+ bytestream2_put_buffer(&pbc, datatowrite, datatowritelength);
+ bytestream2_put_be32(&pbc, 0);
+ }
return 0;
}
@@ -548,119 +2068,44 @@ static int rtmp_handshake(URLContext *s, RTMPContext *rt)
*/
static int rtmp_parse_result(URLContext *s, RTMPContext *rt, RTMPPacket *pkt)
{
- int i, t;
- const uint8_t *data_end = pkt->data + pkt->data_size;
+ int ret;
#ifdef DEBUG
ff_rtmp_packet_dump(s, pkt);
#endif
switch (pkt->type) {
+ case RTMP_PT_BYTES_READ:
+ av_dlog(s, "received bytes read report\n");
+ break;
case RTMP_PT_CHUNK_SIZE:
- if (pkt->data_size != 4) {
- av_log(s, AV_LOG_ERROR,
- "Chunk size change packet is not 4 bytes long (%d)\n", pkt->data_size);
- return -1;
- }
- if (!rt->is_input)
- ff_rtmp_packet_write(rt->stream, pkt, rt->chunk_size, rt->prev_pkt[1]);
- rt->chunk_size = AV_RB32(pkt->data);
- if (rt->chunk_size <= 0) {
- av_log(s, AV_LOG_ERROR, "Incorrect chunk size %d\n", rt->chunk_size);
- return -1;
- }
- av_log(s, AV_LOG_DEBUG, "New chunk size = %d\n", rt->chunk_size);
+ if ((ret = handle_chunk_size(s, pkt)) < 0)
+ return ret;
break;
case RTMP_PT_PING:
- t = AV_RB16(pkt->data);
- if (t == 6)
- gen_pong(s, rt, pkt);
+ if ((ret = handle_ping(s, pkt)) < 0)
+ return ret;
break;
case RTMP_PT_CLIENT_BW:
- if (pkt->data_size < 4) {
- av_log(s, AV_LOG_ERROR,
- "Client bandwidth report packet is less than 4 bytes long (%d)\n",
- pkt->data_size);
- return -1;
- }
- av_log(s, AV_LOG_DEBUG, "Client bandwidth = %d\n", AV_RB32(pkt->data));
- rt->client_report_size = AV_RB32(pkt->data) >> 1;
+ if ((ret = handle_client_bw(s, pkt)) < 0)
+ return ret;
+ break;
+ case RTMP_PT_SERVER_BW:
+ if ((ret = handle_server_bw(s, pkt)) < 0)
+ return ret;
break;
case RTMP_PT_INVOKE:
- //TODO: check for the messages sent for wrong state?
- if (!memcmp(pkt->data, "\002\000\006_error", 9)) {
- uint8_t tmpstr[256];
-
- if (!ff_amf_get_field_value(pkt->data + 9, data_end,
- "description", tmpstr, sizeof(tmpstr)))
- av_log(s, AV_LOG_ERROR, "Server error: %s\n",tmpstr);
- return -1;
- } else if (!memcmp(pkt->data, "\002\000\007_result", 10)) {
- switch (rt->state) {
- case STATE_HANDSHAKED:
- if (!rt->is_input) {
- gen_release_stream(s, rt);
- gen_fcpublish_stream(s, rt);
- rt->state = STATE_RELEASING;
- } else {
- rt->state = STATE_CONNECTING;
- }
- gen_create_stream(s, rt);
- break;
- case STATE_FCPUBLISH:
- rt->state = STATE_CONNECTING;
- break;
- case STATE_RELEASING:
- rt->state = STATE_FCPUBLISH;
- /* hack for Wowza Media Server, it does not send result for
- * releaseStream and FCPublish calls */
- if (!pkt->data[10]) {
- int pkt_id = av_int2double(AV_RB64(pkt->data + 11));
- if (pkt_id == rt->create_stream_invoke)
- rt->state = STATE_CONNECTING;
- }
- if (rt->state != STATE_CONNECTING)
- break;
- case STATE_CONNECTING:
- //extract a number from the result
- if (pkt->data[10] || pkt->data[19] != 5 || pkt->data[20]) {
- av_log(s, AV_LOG_WARNING, "Unexpected reply on connect()\n");
- } else {
- rt->main_channel_id = av_int2double(AV_RB64(pkt->data + 21));
- }
- if (rt->is_input) {
- gen_play(s, rt);
- } else {
- gen_publish(s, rt);
- }
- rt->state = STATE_READY;
- break;
- }
- } else if (!memcmp(pkt->data, "\002\000\010onStatus", 11)) {
- const uint8_t* ptr = pkt->data + 11;
- uint8_t tmpstr[256];
-
- for (i = 0; i < 2; i++) {
- t = ff_amf_tag_size(ptr, data_end);
- if (t < 0)
- return 1;
- ptr += t;
- }
- t = ff_amf_get_field_value(ptr, data_end,
- "level", tmpstr, sizeof(tmpstr));
- if (!t && !strcmp(tmpstr, "error")) {
- if (!ff_amf_get_field_value(ptr, data_end,
- "description", tmpstr, sizeof(tmpstr)))
- av_log(s, AV_LOG_ERROR, "Server error: %s\n",tmpstr);
- return -1;
- }
- t = ff_amf_get_field_value(ptr, data_end,
- "code", tmpstr, sizeof(tmpstr));
- if (!t && !strcmp(tmpstr, "NetStream.Play.Start")) rt->state = STATE_PLAYING;
- if (!t && !strcmp(tmpstr, "NetStream.Play.Stop")) rt->state = STATE_STOPPED;
- if (!t && !strcmp(tmpstr, "NetStream.Play.UnpublishNotify")) rt->state = STATE_STOPPED;
- if (!t && !strcmp(tmpstr, "NetStream.Publish.Start")) rt->state = STATE_PUBLISHING;
- }
+ if ((ret = handle_invoke(s, pkt)) < 0)
+ return ret;
+ break;
+ case RTMP_PT_VIDEO:
+ case RTMP_PT_AUDIO:
+ case RTMP_PT_METADATA:
+ case RTMP_PT_NOTIFY:
+ /* Audio, Video and Metadata packets are parsed in get_packet() */
+ break;
+ default:
+ av_log(s, AV_LOG_VERBOSE, "Unknown packet type received 0x%02X\n", pkt->type);
break;
}
return 0;
@@ -692,7 +2137,7 @@ static int get_packet(URLContext *s, int for_header)
for (;;) {
RTMPPacket rpkt = { 0 };
if ((ret = ff_rtmp_packet_read(rt->stream, &rpkt,
- rt->chunk_size, rt->prev_pkt[0])) <= 0) {
+ rt->in_chunk_size, rt->prev_pkt[0])) <= 0) {
if (ret == 0) {
return AVERROR(EAGAIN);
} else {
@@ -702,20 +2147,27 @@ static int get_packet(URLContext *s, int for_header)
rt->bytes_read += ret;
if (rt->bytes_read > rt->last_bytes_read + rt->client_report_size) {
av_log(s, AV_LOG_DEBUG, "Sending bytes read report\n");
- gen_bytes_read(s, rt, rpkt.timestamp + 1);
+ if ((ret = gen_bytes_read(s, rt, rpkt.timestamp + 1)) < 0)
+ return ret;
rt->last_bytes_read = rt->bytes_read;
}
ret = rtmp_parse_result(s, rt, &rpkt);
if (ret < 0) {//serious error in current packet
ff_rtmp_packet_destroy(&rpkt);
- return -1;
+ return ret;
+ }
+ if (rt->do_reconnect && for_header) {
+ ff_rtmp_packet_destroy(&rpkt);
+ return 0;
}
if (rt->state == STATE_STOPPED) {
ff_rtmp_packet_destroy(&rpkt);
return AVERROR_EOF;
}
- if (for_header && (rt->state == STATE_PLAYING || rt->state == STATE_PUBLISHING)) {
+ if (for_header && (rt->state == STATE_PLAYING ||
+ rt->state == STATE_PUBLISHING ||
+ rt->state == STATE_RECEIVING)) {
ff_rtmp_packet_destroy(&rpkt);
return 0;
}
@@ -740,6 +2192,14 @@ static int get_packet(URLContext *s, int for_header)
bytestream_put_be32(&p, 0);
ff_rtmp_packet_destroy(&rpkt);
return 0;
+ } else if (rpkt.type == RTMP_PT_NOTIFY) {
+ ret = handle_notify(s, &rpkt);
+ ff_rtmp_packet_destroy(&rpkt);
+ if (ret) {
+ av_log(s, AV_LOG_ERROR, "Handle notify error\n");
+ return ret;
+ }
+ return 0;
} else if (rpkt.type == RTMP_PT_METADATA) {
// we got raw FLV data, make it available for FLV demuxer
rt->flv_off = 0;
@@ -773,20 +2233,22 @@ static int get_packet(URLContext *s, int for_header)
static int rtmp_close(URLContext *h)
{
RTMPContext *rt = h->priv_data;
+ int ret = 0;
if (!rt->is_input) {
rt->flv_data = NULL;
if (rt->out_pkt.data_size)
ff_rtmp_packet_destroy(&rt->out_pkt);
if (rt->state > STATE_FCPUBLISH)
- gen_fcunpublish_stream(h, rt);
+ ret = gen_fcunpublish_stream(h, rt);
}
if (rt->state > STATE_HANDSHAKED)
- gen_delete_stream(h, rt);
+ ret = gen_delete_stream(h, rt);
+ free_tracked_methods(rt);
av_freep(&rt->flv_data);
ffurl_close(rt->stream);
- return 0;
+ return ret;
}
/**
@@ -801,45 +2263,112 @@ static int rtmp_close(URLContext *h)
static int rtmp_open(URLContext *s, const char *uri, int flags)
{
RTMPContext *rt = s->priv_data;
- char proto[8], hostname[256], path[1024], *fname;
+ char proto[8], hostname[256], path[1024], auth[100], *fname;
+ char *old_app;
uint8_t buf[2048];
int port;
+ AVDictionary *opts = NULL;
int ret;
+ if (rt->listen_timeout > 0)
+ rt->listen = 1;
+
rt->is_input = !(flags & AVIO_FLAG_WRITE);
- av_url_split(proto, sizeof(proto), NULL, 0, hostname, sizeof(hostname), &port,
+ av_url_split(proto, sizeof(proto), auth, sizeof(auth),
+ hostname, sizeof(hostname), &port,
path, sizeof(path), s->filename);
- if (port < 0)
- port = RTMP_DEFAULT_PORT;
- ff_url_join(buf, sizeof(buf), "tcp", NULL, hostname, port, NULL);
+ if (auth[0]) {
+ char *ptr = strchr(auth, ':');
+ if (ptr) {
+ *ptr = '\0';
+ av_strlcpy(rt->username, auth, sizeof(rt->username));
+ av_strlcpy(rt->password, ptr + 1, sizeof(rt->password));
+ }
+ }
- if (ffurl_open(&rt->stream, buf, AVIO_FLAG_READ_WRITE,
- &s->interrupt_callback, NULL) < 0) {
+ if (rt->listen && strcmp(proto, "rtmp")) {
+ av_log(s, AV_LOG_ERROR, "rtmp_listen not available for %s\n",
+ proto);
+ return AVERROR(EINVAL);
+ }
+ if (!strcmp(proto, "rtmpt") || !strcmp(proto, "rtmpts")) {
+ if (!strcmp(proto, "rtmpts"))
+ av_dict_set(&opts, "ffrtmphttp_tls", "1", 1);
+
+ /* open the http tunneling connection */
+ ff_url_join(buf, sizeof(buf), "ffrtmphttp", NULL, hostname, port, NULL);
+ } else if (!strcmp(proto, "rtmps")) {
+ /* open the tls connection */
+ if (port < 0)
+ port = RTMPS_DEFAULT_PORT;
+ ff_url_join(buf, sizeof(buf), "tls", NULL, hostname, port, NULL);
+ } else if (!strcmp(proto, "rtmpe") || (!strcmp(proto, "rtmpte"))) {
+ if (!strcmp(proto, "rtmpte"))
+ av_dict_set(&opts, "ffrtmpcrypt_tunneling", "1", 1);
+
+ /* open the encrypted connection */
+ ff_url_join(buf, sizeof(buf), "ffrtmpcrypt", NULL, hostname, port, NULL);
+ rt->encrypted = 1;
+ } else {
+ /* open the tcp connection */
+ if (port < 0)
+ port = RTMP_DEFAULT_PORT;
+ if (rt->listen)
+ ff_url_join(buf, sizeof(buf), "tcp", NULL, hostname, port,
+ "?listen&listen_timeout=%d",
+ rt->listen_timeout * 1000);
+ else
+ ff_url_join(buf, sizeof(buf), "tcp", NULL, hostname, port, NULL);
+ }
+
+reconnect:
+ if ((ret = ffurl_open(&rt->stream, buf, AVIO_FLAG_READ_WRITE,
+ &s->interrupt_callback, &opts)) < 0) {
av_log(s , AV_LOG_ERROR, "Cannot open connection %s\n", buf);
goto fail;
}
+ if (rt->swfverify) {
+ if ((ret = rtmp_calc_swfhash(s)) < 0)
+ goto fail;
+ }
+
rt->state = STATE_START;
- if (rtmp_handshake(s, rt))
+ if (!rt->listen && (ret = rtmp_handshake(s, rt)) < 0)
+ goto fail;
+ if (rt->listen && (ret = rtmp_server_handshake(s, rt)) < 0)
goto fail;
- rt->chunk_size = 128;
+ rt->out_chunk_size = 128;
+ rt->in_chunk_size = 128; // Probably overwritten later
rt->state = STATE_HANDSHAKED;
+
+ // Keep the application name when it has been defined by the user.
+ old_app = rt->app;
+
+ rt->app = av_malloc(APP_MAX_LENGTH);
+ if (!rt->app) {
+ ret = AVERROR(ENOMEM);
+ goto fail;
+ }
+
//extract "app" part from path
if (!strncmp(path, "/ondemand/", 10)) {
fname = path + 10;
memcpy(rt->app, "ondemand", 9);
} else {
- char *p = strchr(path + 1, '/');
+ char *next = *path ? path + 1 : path;
+ char *p = strchr(next, '/');
if (!p) {
- fname = path + 1;
+ fname = next;
rt->app[0] = '\0';
} else {
+ // make sure we do not mismatch a playpath for an application instance
char *c = strchr(p + 1, ':');
fname = strchr(p + 1, '/');
- if (!fname || c < fname) {
+ if (!fname || (c && c < fname)) {
fname = p + 1;
av_strlcpy(rt->app, path + 1, p - path);
} else {
@@ -848,22 +2377,75 @@ static int rtmp_open(URLContext *s, const char *uri, int flags)
}
}
}
- if (!strchr(fname, ':') &&
- (!strcmp(fname + strlen(fname) - 4, ".f4v") ||
- !strcmp(fname + strlen(fname) - 4, ".mp4"))) {
- memcpy(rt->playpath, "mp4:", 5);
- } else {
- rt->playpath[0] = 0;
+
+ if (old_app) {
+ // The name of application has been defined by the user, override it.
+ av_free(rt->app);
+ rt->app = old_app;
+ }
+
+ if (!rt->playpath) {
+ int len = strlen(fname);
+
+ rt->playpath = av_malloc(PLAYPATH_MAX_LENGTH);
+ if (!rt->playpath) {
+ ret = AVERROR(ENOMEM);
+ goto fail;
+ }
+
+ if (!strchr(fname, ':') && len >= 4 &&
+ (!strcmp(fname + len - 4, ".f4v") ||
+ !strcmp(fname + len - 4, ".mp4"))) {
+ memcpy(rt->playpath, "mp4:", 5);
+ } else if (len >= 4 && !strcmp(fname + len - 4, ".flv")) {
+ fname[len - 4] = '\0';
+ } else {
+ rt->playpath[0] = 0;
+ }
+ av_strlcat(rt->playpath, fname, PLAYPATH_MAX_LENGTH);
+ }
+
+ if (!rt->tcurl) {
+ rt->tcurl = av_malloc(TCURL_MAX_LENGTH);
+ if (!rt->tcurl) {
+ ret = AVERROR(ENOMEM);
+ goto fail;
+ }
+ ff_url_join(rt->tcurl, TCURL_MAX_LENGTH, proto, NULL, hostname,
+ port, "/%s", rt->app);
+ }
+
+ if (!rt->flashver) {
+ rt->flashver = av_malloc(FLASHVER_MAX_LENGTH);
+ if (!rt->flashver) {
+ ret = AVERROR(ENOMEM);
+ goto fail;
+ }
+ if (rt->is_input) {
+ snprintf(rt->flashver, FLASHVER_MAX_LENGTH, "%s %d,%d,%d,%d",
+ RTMP_CLIENT_PLATFORM, RTMP_CLIENT_VER1, RTMP_CLIENT_VER2,
+ RTMP_CLIENT_VER3, RTMP_CLIENT_VER4);
+ } else {
+ snprintf(rt->flashver, FLASHVER_MAX_LENGTH,
+ "FMLE/3.0 (compatible; %s)", LIBAVFORMAT_IDENT);
+ }
}
- strncat(rt->playpath, fname, sizeof(rt->playpath) - 5);
rt->client_report_size = 1048576;
rt->bytes_read = 0;
rt->last_bytes_read = 0;
+ rt->server_bw = 2500000;
av_log(s, AV_LOG_DEBUG, "Proto = %s, path = %s, app = %s, fname = %s\n",
proto, path, rt->app, rt->playpath);
- gen_connect(s, rt, proto, hostname, port);
+ if (!rt->listen) {
+ if ((ret = gen_connect(s, rt)) < 0)
+ goto fail;
+ } else {
+ if (read_connect(s, s->priv_data) < 0)
+ goto fail;
+ rt->is_input = 1;
+ }
do {
ret = get_packet(s, 1);
@@ -871,6 +2453,16 @@ static int rtmp_open(URLContext *s, const char *uri, int flags)
if (ret < 0)
goto fail;
+ if (rt->do_reconnect) {
+ ffurl_close(rt->stream);
+ rt->stream = NULL;
+ rt->do_reconnect = 0;
+ rt->nb_invokes = 0;
+ memset(rt->prev_pkt, 0, sizeof(rt->prev_pkt));
+ free_tracked_methods(rt);
+ goto reconnect;
+ }
+
if (rt->is_input) {
// generate FLV header for demuxer
rt->flv_size = 13;
@@ -889,8 +2481,9 @@ static int rtmp_open(URLContext *s, const char *uri, int flags)
return 0;
fail:
+ av_dict_free(&opts);
rtmp_close(s);
- return AVERROR(EIO);
+ return ret;
}
static int rtmp_read(URLContext *s, uint8_t *buf, int size)
@@ -927,6 +2520,8 @@ static int rtmp_write(URLContext *s, const uint8_t *buf, int size)
int pktsize, pkttype;
uint32_t ts;
const uint8_t *buf_temp = buf;
+ uint8_t c;
+ int ret;
do {
if (rt->skip_bytes) {
@@ -962,7 +2557,10 @@ static int rtmp_write(URLContext *s, const uint8_t *buf, int size)
}
//this can be a big packet, it's better to send it right here
- ff_rtmp_packet_create(&rt->out_pkt, RTMP_SOURCE_CHANNEL, pkttype, ts, pktsize);
+ if ((ret = ff_rtmp_packet_create(&rt->out_pkt, RTMP_SOURCE_CHANNEL,
+ pkttype, ts, pktsize)) < 0)
+ return ret;
+
rt->out_pkt.extra = rt->main_channel_id;
rt->flv_data = rt->out_pkt.data;
@@ -983,22 +2581,100 @@ static int rtmp_write(URLContext *s, const uint8_t *buf, int size)
if (rt->flv_off == rt->flv_size) {
rt->skip_bytes = 4;
- ff_rtmp_packet_write(rt->stream, &rt->out_pkt, rt->chunk_size, rt->prev_pkt[1]);
- ff_rtmp_packet_destroy(&rt->out_pkt);
+ if ((ret = rtmp_send_packet(rt, &rt->out_pkt, 0)) < 0)
+ return ret;
rt->flv_size = 0;
rt->flv_off = 0;
rt->flv_header_bytes = 0;
+ rt->flv_nb_packets++;
}
} while (buf_temp - buf < size);
+
+ if (rt->flv_nb_packets < rt->flush_interval)
+ return size;
+ rt->flv_nb_packets = 0;
+
+ /* set stream into nonblocking mode */
+ rt->stream->flags |= AVIO_FLAG_NONBLOCK;
+
+ /* try to read one byte from the stream */
+ ret = ffurl_read(rt->stream, &c, 1);
+
+ /* switch the stream back into blocking mode */
+ rt->stream->flags &= ~AVIO_FLAG_NONBLOCK;
+
+ if (ret == AVERROR(EAGAIN)) {
+ /* no incoming data to handle */
+ return size;
+ } else if (ret < 0) {
+ return ret;
+ } else if (ret == 1) {
+ RTMPPacket rpkt = { 0 };
+
+ if ((ret = ff_rtmp_packet_read_internal(rt->stream, &rpkt,
+ rt->in_chunk_size,
+ rt->prev_pkt[0], c)) <= 0)
+ return ret;
+
+ if ((ret = rtmp_parse_result(s, rt, &rpkt)) < 0)
+ return ret;
+
+ ff_rtmp_packet_destroy(&rpkt);
+ }
+
return size;
}
-URLProtocol ff_rtmp_protocol = {
- .name = "rtmp",
- .url_open = rtmp_open,
- .url_read = rtmp_read,
- .url_write = rtmp_write,
- .url_close = rtmp_close,
- .priv_data_size = sizeof(RTMPContext),
- .flags = URL_PROTOCOL_FLAG_NETWORK,
+#define OFFSET(x) offsetof(RTMPContext, x)
+#define DEC AV_OPT_FLAG_DECODING_PARAM
+#define ENC AV_OPT_FLAG_ENCODING_PARAM
+
+static const AVOption rtmp_options[] = {
+ {"rtmp_app", "Name of application to connect to on the RTMP server", OFFSET(app), AV_OPT_TYPE_STRING, {.str = NULL }, 0, 0, DEC|ENC},
+ {"rtmp_buffer", "Set buffer time in milliseconds. The default is 3000.", OFFSET(client_buffer_time), AV_OPT_TYPE_INT, {.i64 = 3000}, 0, INT_MAX, DEC|ENC},
+ {"rtmp_conn", "Append arbitrary AMF data to the Connect message", OFFSET(conn), AV_OPT_TYPE_STRING, {.str = NULL }, 0, 0, DEC|ENC},
+ {"rtmp_flashver", "Version of the Flash plugin used to run the SWF player.", OFFSET(flashver), AV_OPT_TYPE_STRING, {.str = NULL }, 0, 0, DEC|ENC},
+ {"rtmp_flush_interval", "Number of packets flushed in the same request (RTMPT only).", OFFSET(flush_interval), AV_OPT_TYPE_INT, {.i64 = 10}, 0, INT_MAX, ENC},
+ {"rtmp_live", "Specify that the media is a live stream.", OFFSET(live), AV_OPT_TYPE_INT, {.i64 = -2}, INT_MIN, INT_MAX, DEC, "rtmp_live"},
+ {"any", "both", 0, AV_OPT_TYPE_CONST, {.i64 = -2}, 0, 0, DEC, "rtmp_live"},
+ {"live", "live stream", 0, AV_OPT_TYPE_CONST, {.i64 = -1}, 0, 0, DEC, "rtmp_live"},
+ {"recorded", "recorded stream", 0, AV_OPT_TYPE_CONST, {.i64 = 0}, 0, 0, DEC, "rtmp_live"},
+ {"rtmp_pageurl", "URL of the web page in which the media was embedded. By default no value will be sent.", OFFSET(pageurl), AV_OPT_TYPE_STRING, {.str = NULL }, 0, 0, DEC},
+ {"rtmp_playpath", "Stream identifier to play or to publish", OFFSET(playpath), AV_OPT_TYPE_STRING, {.str = NULL }, 0, 0, DEC|ENC},
+ {"rtmp_subscribe", "Name of live stream to subscribe to. Defaults to rtmp_playpath.", OFFSET(subscribe), AV_OPT_TYPE_STRING, {.str = NULL }, 0, 0, DEC},
+ {"rtmp_swfhash", "SHA256 hash of the decompressed SWF file (32 bytes).", OFFSET(swfhash), AV_OPT_TYPE_BINARY, .flags = DEC},
+ {"rtmp_swfsize", "Size of the decompressed SWF file, required for SWFVerification.", OFFSET(swfsize), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, DEC},
+ {"rtmp_swfurl", "URL of the SWF player. By default no value will be sent", OFFSET(swfurl), AV_OPT_TYPE_STRING, {.str = NULL }, 0, 0, DEC|ENC},
+ {"rtmp_swfverify", "URL to player swf file, compute hash/size automatically.", OFFSET(swfverify), AV_OPT_TYPE_STRING, {.str = NULL }, 0, 0, DEC},
+ {"rtmp_tcurl", "URL of the target stream. Defaults to proto://host[:port]/app.", OFFSET(tcurl), AV_OPT_TYPE_STRING, {.str = NULL }, 0, 0, DEC|ENC},
+ {"rtmp_listen", "Listen for incoming rtmp connections", OFFSET(listen), AV_OPT_TYPE_INT, {.i64 = 0}, INT_MIN, INT_MAX, DEC, "rtmp_listen" },
+ {"timeout", "Maximum timeout (in seconds) to wait for incoming connections. -1 is infinite. Implies -rtmp_listen 1", OFFSET(listen_timeout), AV_OPT_TYPE_INT, {.i64 = -1}, INT_MIN, INT_MAX, DEC, "rtmp_listen" },
+ { NULL },
};
+
+#define RTMP_PROTOCOL(flavor) \
+static const AVClass flavor##_class = { \
+ .class_name = #flavor, \
+ .item_name = av_default_item_name, \
+ .option = rtmp_options, \
+ .version = LIBAVUTIL_VERSION_INT, \
+}; \
+ \
+URLProtocol ff_##flavor##_protocol = { \
+ .name = #flavor, \
+ .url_open = rtmp_open, \
+ .url_read = rtmp_read, \
+ .url_write = rtmp_write, \
+ .url_close = rtmp_close, \
+ .priv_data_size = sizeof(RTMPContext), \
+ .flags = URL_PROTOCOL_FLAG_NETWORK, \
+ .priv_data_class= &flavor##_class, \
+};
+
+
+RTMP_PROTOCOL(rtmp)
+RTMP_PROTOCOL(rtmpe)
+RTMP_PROTOCOL(rtmps)
+RTMP_PROTOCOL(rtmpt)
+RTMP_PROTOCOL(rtmpte)
+RTMP_PROTOCOL(rtmpts)
diff --git a/gst-libs/ext/libav/libavformat/rtp.c b/gst-libs/ext/libav/libavformat/rtp.c
index b6b4b72..eab8271 100644
--- a/gst-libs/ext/libav/libavformat/rtp.c
+++ b/gst-libs/ext/libav/libavformat/rtp.c
@@ -37,38 +37,38 @@ static const struct
int pt;
const char enc_name[6];
enum AVMediaType codec_type;
- enum CodecID codec_id;
+ enum AVCodecID codec_id;
int clock_rate;
int audio_channels;
} AVRtpPayloadTypes[]=
{
- {0, "PCMU", AVMEDIA_TYPE_AUDIO, CODEC_ID_PCM_MULAW, 8000, 1},
- {3, "GSM", AVMEDIA_TYPE_AUDIO, CODEC_ID_NONE, 8000, 1},
- {4, "G723", AVMEDIA_TYPE_AUDIO, CODEC_ID_NONE, 8000, 1},
- {5, "DVI4", AVMEDIA_TYPE_AUDIO, CODEC_ID_NONE, 8000, 1},
- {6, "DVI4", AVMEDIA_TYPE_AUDIO, CODEC_ID_NONE, 16000, 1},
- {7, "LPC", AVMEDIA_TYPE_AUDIO, CODEC_ID_NONE, 8000, 1},
- {8, "PCMA", AVMEDIA_TYPE_AUDIO, CODEC_ID_PCM_ALAW, 8000, 1},
- {9, "G722", AVMEDIA_TYPE_AUDIO, CODEC_ID_ADPCM_G722, 8000, 1},
- {10, "L16", AVMEDIA_TYPE_AUDIO, CODEC_ID_PCM_S16BE, 44100, 2},
- {11, "L16", AVMEDIA_TYPE_AUDIO, CODEC_ID_PCM_S16BE, 44100, 1},
- {12, "QCELP", AVMEDIA_TYPE_AUDIO, CODEC_ID_QCELP, 8000, 1},
- {13, "CN", AVMEDIA_TYPE_AUDIO, CODEC_ID_NONE, 8000, 1},
- {14, "MPA", AVMEDIA_TYPE_AUDIO, CODEC_ID_MP2, -1, -1},
- {14, "MPA", AVMEDIA_TYPE_AUDIO, CODEC_ID_MP3, -1, -1},
- {15, "G728", AVMEDIA_TYPE_AUDIO, CODEC_ID_NONE, 8000, 1},
- {16, "DVI4", AVMEDIA_TYPE_AUDIO, CODEC_ID_NONE, 11025, 1},
- {17, "DVI4", AVMEDIA_TYPE_AUDIO, CODEC_ID_NONE, 22050, 1},
- {18, "G729", AVMEDIA_TYPE_AUDIO, CODEC_ID_NONE, 8000, 1},
- {25, "CelB", AVMEDIA_TYPE_VIDEO, CODEC_ID_NONE, 90000, -1},
- {26, "JPEG", AVMEDIA_TYPE_VIDEO, CODEC_ID_MJPEG, 90000, -1},
- {28, "nv", AVMEDIA_TYPE_VIDEO, CODEC_ID_NONE, 90000, -1},
- {31, "H261", AVMEDIA_TYPE_VIDEO, CODEC_ID_H261, 90000, -1},
- {32, "MPV", AVMEDIA_TYPE_VIDEO, CODEC_ID_MPEG1VIDEO, 90000, -1},
- {32, "MPV", AVMEDIA_TYPE_VIDEO, CODEC_ID_MPEG2VIDEO, 90000, -1},
- {33, "MP2T", AVMEDIA_TYPE_DATA, CODEC_ID_MPEG2TS, 90000, -1},
- {34, "H263", AVMEDIA_TYPE_VIDEO, CODEC_ID_H263, 90000, -1},
- {-1, "", AVMEDIA_TYPE_UNKNOWN, CODEC_ID_NONE, -1, -1}
+ {0, "PCMU", AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_PCM_MULAW, 8000, 1},
+ {3, "GSM", AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_NONE, 8000, 1},
+ {4, "G723", AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_G723_1, 8000, 1},
+ {5, "DVI4", AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_NONE, 8000, 1},
+ {6, "DVI4", AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_NONE, 16000, 1},
+ {7, "LPC", AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_NONE, 8000, 1},
+ {8, "PCMA", AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_PCM_ALAW, 8000, 1},
+ {9, "G722", AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_ADPCM_G722, 8000, 1},
+ {10, "L16", AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_PCM_S16BE, 44100, 2},
+ {11, "L16", AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_PCM_S16BE, 44100, 1},
+ {12, "QCELP", AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_QCELP, 8000, 1},
+ {13, "CN", AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_NONE, 8000, 1},
+ {14, "MPA", AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_MP2, -1, -1},
+ {14, "MPA", AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_MP3, -1, -1},
+ {15, "G728", AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_NONE, 8000, 1},
+ {16, "DVI4", AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_NONE, 11025, 1},
+ {17, "DVI4", AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_NONE, 22050, 1},
+ {18, "G729", AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_NONE, 8000, 1},
+ {25, "CelB", AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_NONE, 90000, -1},
+ {26, "JPEG", AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_MJPEG, 90000, -1},
+ {28, "nv", AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_NONE, 90000, -1},
+ {31, "H261", AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_H261, 90000, -1},
+ {32, "MPV", AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_MPEG1VIDEO, 90000, -1},
+ {32, "MPV", AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_MPEG2VIDEO, 90000, -1},
+ {33, "MP2T", AVMEDIA_TYPE_DATA, AV_CODEC_ID_MPEG2TS, 90000, -1},
+ {34, "H263", AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_H263, 90000, -1},
+ {-1, "", AVMEDIA_TYPE_UNKNOWN, AV_CODEC_ID_NONE, -1, -1}
};
int ff_rtp_get_codec_info(AVCodecContext *codec, int payload_type)
@@ -77,7 +77,7 @@ int ff_rtp_get_codec_info(AVCodecContext *codec, int payload_type)
for (i = 0; AVRtpPayloadTypes[i].pt >= 0; i++)
if (AVRtpPayloadTypes[i].pt == payload_type) {
- if (AVRtpPayloadTypes[i].codec_id != CODEC_ID_NONE) {
+ if (AVRtpPayloadTypes[i].codec_id != AV_CODEC_ID_NONE) {
codec->codec_type = AVRtpPayloadTypes[i].codec_type;
codec->codec_id = AVRtpPayloadTypes[i].codec_id;
if (AVRtpPayloadTypes[i].audio_channels > 0)
@@ -90,13 +90,14 @@ int ff_rtp_get_codec_info(AVCodecContext *codec, int payload_type)
return -1;
}
-int ff_rtp_get_payload_type(AVFormatContext *fmt, AVCodecContext *codec)
+int ff_rtp_get_payload_type(AVFormatContext *fmt,
+ AVCodecContext *codec, int idx)
{
int i;
AVOutputFormat *ofmt = fmt ? fmt->oformat : NULL;
/* Was the payload type already specified for the RTP muxer? */
- if (ofmt && ofmt->priv_class) {
+ if (ofmt && ofmt->priv_class && fmt->priv_data) {
int64_t payload_type;
if (av_opt_get_int(fmt->priv_data, "payload_type", 0, &payload_type) >= 0 &&
payload_type >= 0)
@@ -106,16 +107,29 @@ int ff_rtp_get_payload_type(AVFormatContext *fmt, AVCodecContext *codec)
/* static payload type */
for (i = 0; AVRtpPayloadTypes[i].pt >= 0; ++i)
if (AVRtpPayloadTypes[i].codec_id == codec->codec_id) {
- if (codec->codec_id == CODEC_ID_H263)
+ if (codec->codec_id == AV_CODEC_ID_H263 && (!fmt || !fmt->oformat ||
+ !fmt->oformat->priv_class || !fmt->priv_data ||
+ !av_opt_flag_is_set(fmt->priv_data, "rtpflags", "rfc2190")))
+ continue;
+ /* G722 has 8000 as nominal rate even if the sample rate is 16000,
+ * see section 4.5.2 in RFC 3551. */
+ if (codec->codec_id == AV_CODEC_ID_ADPCM_G722 &&
+ codec->sample_rate == 16000 && codec->channels == 1)
+ return AVRtpPayloadTypes[i].pt;
+ if (codec->codec_type == AVMEDIA_TYPE_AUDIO &&
+ ((AVRtpPayloadTypes[i].clock_rate > 0 &&
+ codec->sample_rate != AVRtpPayloadTypes[i].clock_rate) ||
+ (AVRtpPayloadTypes[i].audio_channels > 0 &&
+ codec->channels != AVRtpPayloadTypes[i].audio_channels)))
continue;
- if (codec->codec_id == CODEC_ID_PCM_S16BE)
- if (codec->channels != AVRtpPayloadTypes[i].audio_channels)
- continue;
return AVRtpPayloadTypes[i].pt;
}
+ if (idx < 0)
+ idx = codec->codec_type == AVMEDIA_TYPE_AUDIO;
+
/* dynamic payload type */
- return RTP_PT_PRIVATE + (codec->codec_type == AVMEDIA_TYPE_AUDIO);
+ return RTP_PT_PRIVATE + idx;
}
const char *ff_rtp_enc_name(int payload_type)
@@ -130,7 +144,7 @@ const char *ff_rtp_enc_name(int payload_type)
return "";
}
-enum CodecID ff_rtp_codec_id(const char *buf, enum AVMediaType codec_type)
+enum AVCodecID ff_rtp_codec_id(const char *buf, enum AVMediaType codec_type)
{
int i;
@@ -139,5 +153,5 @@ enum CodecID ff_rtp_codec_id(const char *buf, enum AVMediaType codec_type)
return AVRtpPayloadTypes[i].codec_id;
}
- return CODEC_ID_NONE;
+ return AV_CODEC_ID_NONE;
}
diff --git a/gst-libs/ext/libav/libavformat/rtp.h b/gst-libs/ext/libav/libavformat/rtp.h
index e619008..f8d406e 100644
--- a/gst-libs/ext/libav/libavformat/rtp.h
+++ b/gst-libs/ext/libav/libavformat/rtp.h
@@ -25,13 +25,18 @@
#include "libavcodec/avcodec.h"
/**
- * Return the payload type for a given codec used in the given format context.
+ * Return the payload type for a given stream used in the given format context.
+ * Static payload types are derived from the codec.
+ * Dynamic payload type are derived from the id field in AVStream.
+ * The format context private option payload_type overrides both.
*
* @param fmt The context of the format
* @param codec The context of the codec
+ * @param idx The stream index
* @return The payload type (the 'PT' field in the RTP header).
*/
-int ff_rtp_get_payload_type(AVFormatContext *fmt, AVCodecContext *codec);
+int ff_rtp_get_payload_type(AVFormatContext *fmt, AVCodecContext *codec,
+ int idx);
/**
* Initialize a codec context based on the payload type.
@@ -63,10 +68,10 @@ const char *ff_rtp_enc_name(int payload_type);
*
* @param buf A pointer to the string containing the encoding name
* @param codec_type The codec type
- * @return In case of unknown encoding name, CODEC_ID_NONE is returned;
+ * @return In case of unknown encoding name, AV_CODEC_ID_NONE is returned;
* otherwise, the codec id is returned
*/
-enum CodecID ff_rtp_codec_id(const char *buf, enum AVMediaType codec_type);
+enum AVCodecID ff_rtp_codec_id(const char *buf, enum AVMediaType codec_type);
#define RTP_PT_PRIVATE 96
#define RTP_VERSION 2
@@ -77,18 +82,31 @@ enum CodecID ff_rtp_codec_id(const char *buf, enum AVMediaType codec_type);
#define RTCP_TX_RATIO_DEN 1000
/* An arbitrary id value for RTP Xiph streams - only relevant to indicate
- * the the configuration has changed within a stream (by changing the
+ * that the configuration has changed within a stream (by changing the
* ident value sent).
*/
#define RTP_XIPH_IDENT 0xfecdba
/* RTCP packet types */
enum RTCPType {
+ RTCP_FIR = 192,
+ RTCP_NACK, // 193
+ RTCP_SMPTETC,// 194
+ RTCP_IJ, // 195
RTCP_SR = 200,
RTCP_RR, // 201
RTCP_SDES, // 202
RTCP_BYE, // 203
- RTCP_APP // 204
+ RTCP_APP, // 204
+ RTCP_RTPFB,// 205
+ RTCP_PSFB, // 206
+ RTCP_XR, // 207
+ RTCP_AVB, // 208
+ RTCP_RSI, // 209
+ RTCP_TOKEN,// 210
};
+#define RTP_PT_IS_RTCP(x) (((x) >= RTCP_FIR && (x) <= RTCP_IJ) || \
+ ((x) >= RTCP_SR && (x) <= RTCP_TOKEN))
+
#endif /* AVFORMAT_RTP_H */
diff --git a/gst-libs/ext/libav/libavformat/rtpdec.c b/gst-libs/ext/libav/libavformat/rtpdec.c
index 7e8b52a..08150b7 100644
--- a/gst-libs/ext/libav/libavformat/rtpdec.c
+++ b/gst-libs/ext/libav/libavformat/rtpdec.c
@@ -21,41 +21,40 @@
#include "libavutil/mathematics.h"
#include "libavutil/avstring.h"
+#include "libavutil/time.h"
#include "libavcodec/get_bits.h"
#include "avformat.h"
#include "mpegts.h"
-#include "url.h"
-
-#include <unistd.h>
#include "network.h"
-
+#include "url.h"
#include "rtpdec.h"
#include "rtpdec_formats.h"
-//#define DEBUG
-
-/* TODO: - add RTCP statistics reporting (should be optional).
+static RTPDynamicProtocolHandler realmedia_mp3_dynamic_handler = {
+ .enc_name = "X-MP3-draft-00",
+ .codec_type = AVMEDIA_TYPE_AUDIO,
+ .codec_id = AV_CODEC_ID_MP3ADU,
+};
- - add support for h263/mpeg4 packetized output : IDEA: send a
- buffer to 'rtp_write_packet' contains all the packets for ONE
- frame. Each packet should have a four byte header containing
- the length in big endian format (same trick as
- 'ffio_open_dyn_packet_buf')
-*/
+static RTPDynamicProtocolHandler speex_dynamic_handler = {
+ .enc_name = "speex",
+ .codec_type = AVMEDIA_TYPE_AUDIO,
+ .codec_id = AV_CODEC_ID_SPEEX,
+};
-static RTPDynamicProtocolHandler ff_realmedia_mp3_dynamic_handler = {
- .enc_name = "X-MP3-draft-00",
- .codec_type = AVMEDIA_TYPE_AUDIO,
- .codec_id = CODEC_ID_MP3ADU,
+static RTPDynamicProtocolHandler opus_dynamic_handler = {
+ .enc_name = "opus",
+ .codec_type = AVMEDIA_TYPE_AUDIO,
+ .codec_id = AV_CODEC_ID_OPUS,
};
/* statistics functions */
-static RTPDynamicProtocolHandler *RTPFirstDynamicPayloadHandler= NULL;
+static RTPDynamicProtocolHandler *rtp_first_dynamic_payload_handler = NULL;
void ff_register_dynamic_payload_handler(RTPDynamicProtocolHandler *handler)
{
- handler->next= RTPFirstDynamicPayloadHandler;
- RTPFirstDynamicPayloadHandler= handler;
+ handler->next = rtp_first_dynamic_payload_handler;
+ rtp_first_dynamic_payload_handler = handler;
}
void av_register_rtp_dynamic_payload_handlers(void)
@@ -66,7 +65,10 @@ void av_register_rtp_dynamic_payload_handlers(void)
ff_register_dynamic_payload_handler(&ff_amr_wb_dynamic_handler);
ff_register_dynamic_payload_handler(&ff_h263_1998_dynamic_handler);
ff_register_dynamic_payload_handler(&ff_h263_2000_dynamic_handler);
+ ff_register_dynamic_payload_handler(&ff_h263_rfc2190_dynamic_handler);
ff_register_dynamic_payload_handler(&ff_h264_dynamic_handler);
+ ff_register_dynamic_payload_handler(&ff_ilbc_dynamic_handler);
+ ff_register_dynamic_payload_handler(&ff_jpeg_dynamic_handler);
ff_register_dynamic_payload_handler(&ff_vorbis_dynamic_handler);
ff_register_dynamic_payload_handler(&ff_theora_dynamic_handler);
ff_register_dynamic_payload_handler(&ff_qdm2_dynamic_handler);
@@ -74,7 +76,9 @@ void av_register_rtp_dynamic_payload_handlers(void)
ff_register_dynamic_payload_handler(&ff_mp4a_latm_dynamic_handler);
ff_register_dynamic_payload_handler(&ff_vp8_dynamic_handler);
ff_register_dynamic_payload_handler(&ff_qcelp_dynamic_handler);
- ff_register_dynamic_payload_handler(&ff_realmedia_mp3_dynamic_handler);
+ ff_register_dynamic_payload_handler(&realmedia_mp3_dynamic_handler);
+ ff_register_dynamic_payload_handler(&speex_dynamic_handler);
+ ff_register_dynamic_payload_handler(&opus_dynamic_handler);
ff_register_dynamic_payload_handler(&ff_ms_rtp_asf_pfv_handler);
ff_register_dynamic_payload_handler(&ff_ms_rtp_asf_pfa_handler);
@@ -91,10 +95,10 @@ void av_register_rtp_dynamic_payload_handlers(void)
}
RTPDynamicProtocolHandler *ff_rtp_handler_find_by_name(const char *name,
- enum AVMediaType codec_type)
+ enum AVMediaType codec_type)
{
RTPDynamicProtocolHandler *handler;
- for (handler = RTPFirstDynamicPayloadHandler;
+ for (handler = rtp_first_dynamic_payload_handler;
handler; handler = handler->next)
if (!av_strcasecmp(name, handler->enc_name) &&
codec_type == handler->codec_type)
@@ -103,10 +107,10 @@ RTPDynamicProtocolHandler *ff_rtp_handler_find_by_name(const char *name,
}
RTPDynamicProtocolHandler *ff_rtp_handler_find_by_id(int id,
- enum AVMediaType codec_type)
+ enum AVMediaType codec_type)
{
RTPDynamicProtocolHandler *handler;
- for (handler = RTPFirstDynamicPayloadHandler;
+ for (handler = rtp_first_dynamic_payload_handler;
handler; handler = handler->next)
if (handler->static_payload_id && handler->static_payload_id == id &&
codec_type == handler->codec_type)
@@ -114,7 +118,8 @@ RTPDynamicProtocolHandler *ff_rtp_handler_find_by_id(int id,
return NULL;
}
-static int rtcp_parse_packet(RTPDemuxContext *s, const unsigned char *buf, int len)
+static int rtcp_parse_packet(RTPDemuxContext *s, const unsigned char *buf,
+ int len)
{
int payload_len;
while (len >= 4) {
@@ -123,11 +128,12 @@ static int rtcp_parse_packet(RTPDemuxContext *s, const unsigned char *buf, int l
switch (buf[1]) {
case RTCP_SR:
if (payload_len < 20) {
- av_log(NULL, AV_LOG_ERROR, "Invalid length for RTCP SR packet\n");
+ av_log(NULL, AV_LOG_ERROR,
+ "Invalid length for RTCP SR packet\n");
return AVERROR_INVALIDDATA;
}
- s->last_rtcp_ntp_time = AV_RB64(buf + 8);
+ s->last_rtcp_ntp_time = AV_RB64(buf + 8);
s->last_rtcp_timestamp = AV_RB32(buf + 16);
if (s->first_rtcp_ntp_time == AV_NOPTS_VALUE) {
s->first_rtcp_ntp_time = s->last_rtcp_ntp_time;
@@ -147,73 +153,70 @@ static int rtcp_parse_packet(RTPDemuxContext *s, const unsigned char *buf, int l
return -1;
}
-#define RTP_SEQ_MOD (1<<16)
+#define RTP_SEQ_MOD (1 << 16)
-/**
-* called on parse open packet
-*/
-static void rtp_init_statistics(RTPStatistics *s, uint16_t base_sequence) // called on parse open packet.
+static void rtp_init_statistics(RTPStatistics *s, uint16_t base_sequence)
{
memset(s, 0, sizeof(RTPStatistics));
- s->max_seq= base_sequence;
- s->probation= 1;
+ s->max_seq = base_sequence;
+ s->probation = 1;
}
-/**
-* called whenever there is a large jump in sequence numbers, or when they get out of probation...
-*/
+/*
+ * Called whenever there is a large jump in sequence numbers,
+ * or when they get out of probation...
+ */
static void rtp_init_sequence(RTPStatistics *s, uint16_t seq)
{
- s->max_seq= seq;
- s->cycles= 0;
- s->base_seq= seq -1;
- s->bad_seq= RTP_SEQ_MOD + 1;
- s->received= 0;
- s->expected_prior= 0;
- s->received_prior= 0;
- s->jitter= 0;
- s->transit= 0;
+ s->max_seq = seq;
+ s->cycles = 0;
+ s->base_seq = seq - 1;
+ s->bad_seq = RTP_SEQ_MOD + 1;
+ s->received = 0;
+ s->expected_prior = 0;
+ s->received_prior = 0;
+ s->jitter = 0;
+ s->transit = 0;
}
-/**
-* returns 1 if we should handle this packet.
-*/
+/* Returns 1 if we should handle this packet. */
static int rtp_valid_packet_in_sequence(RTPStatistics *s, uint16_t seq)
{
- uint16_t udelta= seq - s->max_seq;
- const int MAX_DROPOUT= 3000;
- const int MAX_MISORDER = 100;
+ uint16_t udelta = seq - s->max_seq;
+ const int MAX_DROPOUT = 3000;
+ const int MAX_MISORDER = 100;
const int MIN_SEQUENTIAL = 2;
- /* source not valid until MIN_SEQUENTIAL packets with sequence seq. numbers have been received */
- if(s->probation)
- {
- if(seq==s->max_seq + 1) {
+ /* source not valid until MIN_SEQUENTIAL packets with sequence
+ * seq. numbers have been received */
+ if (s->probation) {
+ if (seq == s->max_seq + 1) {
s->probation--;
- s->max_seq= seq;
- if(s->probation==0) {
+ s->max_seq = seq;
+ if (s->probation == 0) {
rtp_init_sequence(s, seq);
s->received++;
return 1;
}
} else {
- s->probation= MIN_SEQUENTIAL - 1;
- s->max_seq = seq;
+ s->probation = MIN_SEQUENTIAL - 1;
+ s->max_seq = seq;
}
} else if (udelta < MAX_DROPOUT) {
// in order, with permissible gap
- if(seq < s->max_seq) {
- //sequence number wrapped; count antother 64k cycles
+ if (seq < s->max_seq) {
+ // sequence number wrapped; count another 64k cycles
s->cycles += RTP_SEQ_MOD;
}
- s->max_seq= seq;
+ s->max_seq = seq;
} else if (udelta <= RTP_SEQ_MOD - MAX_MISORDER) {
// sequence made a large jump...
- if(seq==s->bad_seq) {
- // two sequential packets-- assume that the other side restarted without telling us; just resync.
+ if (seq == s->bad_seq) {
+ /* two sequential packets -- assume that the other side
+ * restarted without telling us; just resync. */
rtp_init_sequence(s, seq);
} else {
- s->bad_seq= (seq + 1) & (RTP_SEQ_MOD-1);
+ s->bad_seq = (seq + 1) & (RTP_SEQ_MOD - 1);
return 0;
}
} else {
@@ -223,13 +226,14 @@ static int rtp_valid_packet_in_sequence(RTPStatistics *s, uint16_t seq)
return 1;
}
-int ff_rtp_check_and_send_back_rr(RTPDemuxContext *s, int count)
+int ff_rtp_check_and_send_back_rr(RTPDemuxContext *s, URLContext *fd,
+ AVIOContext *avio, int count)
{
AVIOContext *pb;
uint8_t *buf;
int len;
int rtcp_bytes;
- RTPStatistics *stats= &s->statistics;
+ RTPStatistics *stats = &s->statistics;
uint32_t lost;
uint32_t extended_max;
uint32_t expected_interval;
@@ -237,13 +241,13 @@ int ff_rtp_check_and_send_back_rr(RTPDemuxContext *s, int count)
uint32_t lost_interval;
uint32_t expected;
uint32_t fraction;
- uint64_t ntp_time= s->last_rtcp_ntp_time; // TODO: Get local ntp time?
+ uint64_t ntp_time = s->last_rtcp_ntp_time; // TODO: Get local ntp time?
- if (!s->rtp_ctx || (count < 1))
+ if ((!fd && !avio) || (count < 1))
return -1;
/* TODO: I think this is way too often; RFC 1889 has algorithm for this */
- /* XXX: mpeg pts hardcoded. RTCP send every 0.5 seconds */
+ /* XXX: MPEG pts hardcoded. RTCP send every 0.5 seconds */
s->octet_count += count;
rtcp_bytes = ((s->octet_count - s->last_octet_count) * RTCP_TX_RATIO_NUM) /
RTCP_TX_RATIO_DEN;
@@ -252,7 +256,9 @@ int ff_rtp_check_and_send_back_rr(RTPDemuxContext *s, int count)
return -1;
s->last_octet_count = s->octet_count;
- if (avio_open_dyn_buf(&pb) < 0)
+ if (!fd)
+ pb = avio;
+ else if (avio_open_dyn_buf(&pb) < 0)
return -1;
// Receiver Report
@@ -264,31 +270,32 @@ int ff_rtp_check_and_send_back_rr(RTPDemuxContext *s, int count)
avio_wb32(pb, s->ssrc); // server SSRC
// some placeholders we should really fill...
// RFC 1889/p64
- extended_max= stats->cycles + stats->max_seq;
- expected= extended_max - stats->base_seq + 1;
- lost= expected - stats->received;
- lost= FFMIN(lost, 0xffffff); // clamp it since it's only 24 bits...
- expected_interval= expected - stats->expected_prior;
- stats->expected_prior= expected;
- received_interval= stats->received - stats->received_prior;
- stats->received_prior= stats->received;
- lost_interval= expected_interval - received_interval;
- if (expected_interval==0 || lost_interval<=0) fraction= 0;
- else fraction = (lost_interval<<8)/expected_interval;
-
- fraction= (fraction<<24) | lost;
+ extended_max = stats->cycles + stats->max_seq;
+ expected = extended_max - stats->base_seq + 1;
+ lost = expected - stats->received;
+ lost = FFMIN(lost, 0xffffff); // clamp it since it's only 24 bits...
+ expected_interval = expected - stats->expected_prior;
+ stats->expected_prior = expected;
+ received_interval = stats->received - stats->received_prior;
+ stats->received_prior = stats->received;
+ lost_interval = expected_interval - received_interval;
+ if (expected_interval == 0 || lost_interval <= 0)
+ fraction = 0;
+ else
+ fraction = (lost_interval << 8) / expected_interval;
+
+ fraction = (fraction << 24) | lost;
avio_wb32(pb, fraction); /* 8 bits of fraction, 24 bits of total packets lost */
avio_wb32(pb, extended_max); /* max sequence received */
- avio_wb32(pb, stats->jitter>>4); /* jitter */
+ avio_wb32(pb, stats->jitter >> 4); /* jitter */
- if(s->last_rtcp_ntp_time==AV_NOPTS_VALUE)
- {
+ if (s->last_rtcp_ntp_time == AV_NOPTS_VALUE) {
avio_wb32(pb, 0); /* last SR timestamp */
avio_wb32(pb, 0); /* delay since last SR */
} else {
- uint32_t middle_32_bits= s->last_rtcp_ntp_time>>16; // this is valid, right? do we need to handle 64 bit values special?
- uint32_t delay_since_last= ntp_time - s->last_rtcp_ntp_time;
+ uint32_t middle_32_bits = s->last_rtcp_ntp_time >> 16; // this is valid, right? do we need to handle 64 bit values special?
+ uint32_t delay_since_last = ntp_time - s->last_rtcp_ntp_time;
avio_wb32(pb, middle_32_bits); /* last SR timestamp */
avio_wb32(pb, delay_since_last); /* delay since last SR */
@@ -299,28 +306,29 @@ int ff_rtp_check_and_send_back_rr(RTPDemuxContext *s, int count)
avio_w8(pb, RTCP_SDES);
len = strlen(s->hostname);
avio_wb16(pb, (6 + len + 3) / 4); /* length in words - 1 */
- avio_wb32(pb, s->ssrc);
+ avio_wb32(pb, s->ssrc + 1);
avio_w8(pb, 0x01);
avio_w8(pb, len);
avio_write(pb, s->hostname, len);
// padding
- for (len = (6 + len) % 4; len % 4; len++) {
+ for (len = (6 + len) % 4; len % 4; len++)
avio_w8(pb, 0);
- }
avio_flush(pb);
+ if (!fd)
+ return 0;
len = avio_close_dyn_buf(pb, &buf);
if ((len > 0) && buf) {
int av_unused result;
av_dlog(s->ic, "sending %d bytes of RR\n", len);
- result= ffurl_write(s->rtp_ctx, buf, len);
+ result = ffurl_write(fd, buf, len);
av_dlog(s->ic, "result from ffurl_write: %d\n", result);
av_free(buf);
}
return 0;
}
-void ff_rtp_send_punch_packets(URLContext* rtp_handle)
+void ff_rtp_send_punch_packets(URLContext *rtp_handle)
{
AVIOContext *pb;
uint8_t *buf;
@@ -358,25 +366,25 @@ void ff_rtp_send_punch_packets(URLContext* rtp_handle)
av_free(buf);
}
-
/**
* open a new RTP parse context for stream 'st'. 'st' can be NULL for
- * MPEG2TS streams to indicate that they should be demuxed inside the
- * rtp demux (otherwise CODEC_ID_MPEG2TS packets are returned)
+ * MPEG2-TS streams to indicate that they should be demuxed inside the
+ * rtp demux (otherwise AV_CODEC_ID_MPEG2TS packets are returned)
*/
-RTPDemuxContext *ff_rtp_parse_open(AVFormatContext *s1, AVStream *st, URLContext *rtpc, int payload_type, int queue_size)
+RTPDemuxContext *ff_rtp_parse_open(AVFormatContext *s1, AVStream *st,
+ int payload_type, int queue_size)
{
RTPDemuxContext *s;
s = av_mallocz(sizeof(RTPDemuxContext));
if (!s)
return NULL;
- s->payload_type = payload_type;
- s->last_rtcp_ntp_time = AV_NOPTS_VALUE;
+ s->payload_type = payload_type;
+ s->last_rtcp_ntp_time = AV_NOPTS_VALUE;
s->first_rtcp_ntp_time = AV_NOPTS_VALUE;
- s->ic = s1;
- s->st = st;
- s->queue_size = queue_size;
+ s->ic = s1;
+ s->st = st;
+ s->queue_size = queue_size;
rtp_init_statistics(&s->statistics, 0); // do we know the initial sequence from sdp?
if (!strcmp(ff_rtp_enc_name(payload_type), "MP2T")) {
s->ts = ff_mpegts_parse_open(s->ic);
@@ -384,18 +392,21 @@ RTPDemuxContext *ff_rtp_parse_open(AVFormatContext *s1, AVStream *st, URLContext
av_free(s);
return NULL;
}
- } else {
- switch(st->codec->codec_id) {
- case CODEC_ID_MPEG1VIDEO:
- case CODEC_ID_MPEG2VIDEO:
- case CODEC_ID_MP2:
- case CODEC_ID_MP3:
- case CODEC_ID_MPEG4:
- case CODEC_ID_H263:
- case CODEC_ID_H264:
+ } else if (st) {
+ switch (st->codec->codec_id) {
+ case AV_CODEC_ID_MPEG1VIDEO:
+ case AV_CODEC_ID_MPEG2VIDEO:
+ case AV_CODEC_ID_MP2:
+ case AV_CODEC_ID_MP3:
+ case AV_CODEC_ID_MPEG4:
+ case AV_CODEC_ID_H263:
+ case AV_CODEC_ID_H264:
st->need_parsing = AVSTREAM_PARSE_FULL;
break;
- case CODEC_ID_ADPCM_G722:
+ case AV_CODEC_ID_VORBIS:
+ st->need_parsing = AVSTREAM_PARSE_HEADERS;
+ break;
+ case AV_CODEC_ID_ADPCM_G722:
/* According to RFC 3551, the stream clock rate is 8000
* even if the sample rate is 16000. */
if (st->codec->sample_rate == 8000)
@@ -406,21 +417,20 @@ RTPDemuxContext *ff_rtp_parse_open(AVFormatContext *s1, AVStream *st, URLContext
}
}
// needed to send back RTCP RR in RTSP sessions
- s->rtp_ctx = rtpc;
gethostname(s->hostname, sizeof(s->hostname));
return s;
}
-void
-ff_rtp_parse_set_dynamic_protocol(RTPDemuxContext *s, PayloadContext *ctx,
- RTPDynamicProtocolHandler *handler)
+void ff_rtp_parse_set_dynamic_protocol(RTPDemuxContext *s, PayloadContext *ctx,
+ RTPDynamicProtocolHandler *handler)
{
s->dynamic_protocol_context = ctx;
- s->parse_packet = handler->parse_packet;
+ s->parse_packet = handler->parse_packet;
}
/**
- * This was the second switch in rtp_parse packet. Normalizes time, if required, sets stream_index, etc.
+ * This was the second switch in rtp_parse packet.
+ * Normalizes time, if required, sets stream_index, etc.
*/
static void finalize_packet(RTPDemuxContext *s, AVPacket *pkt, uint32_t timestamp)
{
@@ -436,7 +446,9 @@ static void finalize_packet(RTPDemuxContext *s, AVPacket *pkt, uint32_t timestam
/* compute pts from timestamp with received ntp_time */
delta_timestamp = timestamp - s->last_rtcp_timestamp;
/* convert to the PTS timebase */
- addend = av_rescale(s->last_rtcp_ntp_time - s->first_rtcp_ntp_time, s->st->time_base.den, (uint64_t)s->st->time_base.num << 32);
+ addend = av_rescale(s->last_rtcp_ntp_time - s->first_rtcp_ntp_time,
+ s->st->time_base.den,
+ (uint64_t) s->st->time_base.num << 32);
pkt->pts = s->range_start_offset + s->rtcp_ts_offset + addend +
delta_timestamp;
return;
@@ -444,13 +456,15 @@ static void finalize_packet(RTPDemuxContext *s, AVPacket *pkt, uint32_t timestam
if (!s->base_timestamp)
s->base_timestamp = timestamp;
- /* assume that the difference is INT32_MIN < x < INT32_MAX, but allow the first timestamp to exceed INT32_MAX */
+ /* assume that the difference is INT32_MIN < x < INT32_MAX,
+ * but allow the first timestamp to exceed INT32_MAX */
if (!s->timestamp)
s->unwrapped_timestamp += timestamp;
else
s->unwrapped_timestamp += (int32_t)(timestamp - s->timestamp);
s->timestamp = timestamp;
- pkt->pts = s->unwrapped_timestamp + s->range_start_offset - s->base_timestamp;
+ pkt->pts = s->unwrapped_timestamp + s->range_start_offset -
+ s->base_timestamp;
}
static int rtp_parse_packet_internal(RTPDemuxContext *s, AVPacket *pkt,
@@ -461,15 +475,15 @@ static int rtp_parse_packet_internal(RTPDemuxContext *s, AVPacket *pkt,
int ext;
AVStream *st;
uint32_t timestamp;
- int rv= 0;
+ int rv = 0;
- ext = buf[0] & 0x10;
+ ext = buf[0] & 0x10;
payload_type = buf[1] & 0x7f;
if (buf[1] & 0x80)
flags |= RTP_FLAG_MARKER;
- seq = AV_RB16(buf + 2);
+ seq = AV_RB16(buf + 2);
timestamp = AV_RB32(buf + 4);
- ssrc = AV_RB32(buf + 8);
+ ssrc = AV_RB32(buf + 8);
/* store the ssrc in the RTPDemuxContext */
s->ssrc = ssrc;
@@ -479,9 +493,9 @@ static int rtp_parse_packet_internal(RTPDemuxContext *s, AVPacket *pkt,
st = s->st;
// only do something with this if all the rtp checks pass...
- if(!rtp_valid_packet_in_sequence(&s->statistics, seq))
- {
- av_log(st?st->codec:NULL, AV_LOG_ERROR, "RTP: PT=%02x: bad cseq %04x expected=%04x\n",
+ if (!rtp_valid_packet_in_sequence(&s->statistics, seq)) {
+ av_log(st ? st->codec : NULL, AV_LOG_ERROR,
+ "RTP: PT=%02x: bad cseq %04x expected=%04x\n",
payload_type, seq, ((s->seq + 1) & 0xffff));
return -1;
}
@@ -493,8 +507,8 @@ static int rtp_parse_packet_internal(RTPDemuxContext *s, AVPacket *pkt,
}
s->seq = seq;
- len -= 12;
- buf += 12;
+ len -= 12;
+ buf += 12;
/* RFC 3550 Section 5.3.1 RTP Header Extension handling */
if (ext) {
@@ -512,7 +526,7 @@ static int rtp_parse_packet_internal(RTPDemuxContext *s, AVPacket *pkt,
}
if (!st) {
- /* specific MPEG2TS demux support */
+ /* specific MPEG2-TS demux support */
ret = ff_mpegts_parse_packet(s->ts, pkt, buf, len);
/* The only error that can be returned from ff_mpegts_parse_packet
* is "no more data to return from the provided buffer", so return
@@ -520,7 +534,7 @@ static int rtp_parse_packet_internal(RTPDemuxContext *s, AVPacket *pkt,
if (ret < 0)
return AVERROR(EAGAIN);
if (ret < len) {
- s->read_buf_size = len - ret;
+ s->read_buf_size = FFMIN(len - ret, sizeof(s->buf));
memcpy(s->buf, buf + ret, s->read_buf_size);
s->read_buf_index = 0;
return 1;
@@ -528,31 +542,32 @@ static int rtp_parse_packet_internal(RTPDemuxContext *s, AVPacket *pkt,
return 0;
} else if (s->parse_packet) {
rv = s->parse_packet(s->ic, s->dynamic_protocol_context,
- s->st, pkt, &timestamp, buf, len, flags);
+ s->st, pkt, &timestamp, buf, len, seq, flags);
} else {
- // at this point, the RTP header has been stripped; This is ASSUMING that there is only 1 CSRC, which in't wise.
- switch(st->codec->codec_id) {
- case CODEC_ID_MP2:
- case CODEC_ID_MP3:
- /* better than nothing: skip mpeg audio RTP header */
+ /* At this point, the RTP header has been stripped;
+ * This is ASSUMING that there is only 1 CSRC, which isn't wise. */
+ switch (st->codec->codec_id) {
+ case AV_CODEC_ID_MP2:
+ case AV_CODEC_ID_MP3:
+ /* better than nothing: skip MPEG audio RTP header */
if (len <= 4)
return -1;
- h = AV_RB32(buf);
+ h = AV_RB32(buf);
len -= 4;
buf += 4;
av_new_packet(pkt, len);
memcpy(pkt->data, buf, len);
break;
- case CODEC_ID_MPEG1VIDEO:
- case CODEC_ID_MPEG2VIDEO:
- /* better than nothing: skip mpeg video RTP header */
+ case AV_CODEC_ID_MPEG1VIDEO:
+ case AV_CODEC_ID_MPEG2VIDEO:
+ /* better than nothing: skip MPEG video RTP header */
if (len <= 4)
return -1;
- h = AV_RB32(buf);
+ h = AV_RB32(buf);
buf += 4;
len -= 4;
if (h & (1 << 26)) {
- /* mpeg2 */
+ /* MPEG-2 */
if (len <= 4)
return -1;
buf += 4;
@@ -591,7 +606,7 @@ void ff_rtp_reset_packet_queue(RTPDemuxContext *s)
static void enqueue_packet(RTPDemuxContext *s, uint8_t *buf, int len)
{
- uint16_t seq = AV_RB16(buf + 2);
+ uint16_t seq = AV_RB16(buf + 2);
RTPPacket *cur = s->queue, *prev = NULL, *packet;
/* Find the correct place in the queue to insert the packet */
@@ -600,17 +615,17 @@ static void enqueue_packet(RTPDemuxContext *s, uint8_t *buf, int len)
if (diff < 0)
break;
prev = cur;
- cur = cur->next;
+ cur = cur->next;
}
packet = av_mallocz(sizeof(*packet));
if (!packet)
return;
packet->recvtime = av_gettime();
- packet->seq = seq;
- packet->len = len;
- packet->buf = buf;
- packet->next = cur;
+ packet->seq = seq;
+ packet->len = len;
+ packet->buf = buf;
+ packet->next = cur;
if (prev)
prev->next = packet;
else
@@ -641,7 +656,7 @@ static int rtp_parse_queued_packet(RTPDemuxContext *s, AVPacket *pkt)
"RTP: missed %d packets\n", s->queue->seq - s->seq - 1);
/* Parse the first packet in the queue, and dequeue it */
- rv = rtp_parse_packet_internal(s, pkt, s->queue->buf, s->queue->len);
+ rv = rtp_parse_packet_internal(s, pkt, s->queue->buf, s->queue->len);
next = s->queue->next;
av_free(s->queue->buf);
av_free(s->queue);
@@ -651,12 +666,12 @@ static int rtp_parse_queued_packet(RTPDemuxContext *s, AVPacket *pkt)
}
static int rtp_parse_one_packet(RTPDemuxContext *s, AVPacket *pkt,
- uint8_t **bufptr, int len)
+ uint8_t **bufptr, int len)
{
- uint8_t* buf = bufptr ? *bufptr : NULL;
+ uint8_t *buf = bufptr ? *bufptr : NULL;
int ret, flags = 0;
uint32_t timestamp;
- int rv= 0;
+ int rv = 0;
if (!buf) {
/* If parsing of the previous packet actually returned 0 or an error,
@@ -665,12 +680,13 @@ static int rtp_parse_one_packet(RTPDemuxContext *s, AVPacket *pkt,
if (s->prev_ret <= 0)
return rtp_parse_queued_packet(s, pkt);
/* return the next packets, if any */
- if(s->st && s->parse_packet) {
+ if (s->st && s->parse_packet) {
/* timestamp should be overwritten by parse_packet, if not,
* the packet is left with pts == AV_NOPTS_VALUE */
timestamp = RTP_NOTS_VALUE;
- rv= s->parse_packet(s->ic, s->dynamic_protocol_context,
- s->st, pkt, &timestamp, NULL, 0, flags);
+ rv = s->parse_packet(s->ic, s->dynamic_protocol_context,
+ s->st, pkt, &timestamp, NULL, 0, 0,
+ flags);
finalize_packet(s, pkt, timestamp);
return rv;
} else {
@@ -678,7 +694,7 @@ static int rtp_parse_one_packet(RTPDemuxContext *s, AVPacket *pkt,
if (s->read_buf_index >= s->read_buf_size)
return AVERROR(EAGAIN);
ret = ff_mpegts_parse_packet(s->ts, pkt, s->buf + s->read_buf_index,
- s->read_buf_size - s->read_buf_index);
+ s->read_buf_size - s->read_buf_index);
if (ret < 0)
return AVERROR(EAGAIN);
s->read_buf_index += ret;
@@ -694,7 +710,7 @@ static int rtp_parse_one_packet(RTPDemuxContext *s, AVPacket *pkt,
if ((buf[0] & 0xc0) != (RTP_VERSION << 6))
return -1;
- if (buf[1] >= RTCP_SR && buf[1] <= RTCP_APP) {
+ if (RTP_PT_IS_RTCP(buf[1])) {
return rtcp_parse_packet(s, buf, len);
}
@@ -765,19 +781,21 @@ int ff_parse_fmtp(AVStream *stream, PayloadContext *data, const char *p,
int value_size = strlen(p) + 1;
if (!(value = av_malloc(value_size))) {
- av_log(stream, AV_LOG_ERROR, "Failed to allocate data for FMTP.");
+ av_log(NULL, AV_LOG_ERROR, "Failed to allocate data for FMTP.");
return AVERROR(ENOMEM);
}
// remove protocol identifier
- while (*p && *p == ' ') p++; // strip spaces
- while (*p && *p != ' ') p++; // eat protocol identifier
- while (*p && *p == ' ') p++; // strip trailing spaces
+ while (*p && *p == ' ')
+ p++; // strip spaces
+ while (*p && *p != ' ')
+ p++; // eat protocol identifier
+ while (*p && *p == ' ')
+ p++; // strip trailing spaces
while (ff_rtsp_next_attr_and_value(&p,
attr, sizeof(attr),
value, value_size)) {
-
res = parse_fmtp(stream, data, attr, value);
if (res < 0 && res != AVERROR_PATCHWELCOME) {
av_free(value);
@@ -787,3 +805,14 @@ int ff_parse_fmtp(AVStream *stream, PayloadContext *data, const char *p,
av_free(value);
return 0;
}
+
+int ff_rtp_finalize_packet(AVPacket *pkt, AVIOContext **dyn_buf, int stream_idx)
+{
+ av_init_packet(pkt);
+
+ pkt->size = avio_close_dyn_buf(*dyn_buf, &pkt->data);
+ pkt->stream_index = stream_idx;
+ pkt->destruct = av_destruct_packet;
+ *dyn_buf = NULL;
+ return pkt->size;
+}
diff --git a/gst-libs/ext/libav/libavformat/rtpdec.h b/gst-libs/ext/libav/libavformat/rtpdec.h
index 9e2bfd0..7c51f5a 100644
--- a/gst-libs/ext/libav/libavformat/rtpdec.h
+++ b/gst-libs/ext/libav/libavformat/rtpdec.h
@@ -19,6 +19,7 @@
* License along with Libav; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+
#ifndef AVFORMAT_RTPDEC_H
#define AVFORMAT_RTPDEC_H
@@ -28,17 +29,18 @@
#include "url.h"
typedef struct PayloadContext PayloadContext;
-typedef struct RTPDynamicProtocolHandler_s RTPDynamicProtocolHandler;
+typedef struct RTPDynamicProtocolHandler RTPDynamicProtocolHandler;
#define RTP_MIN_PACKET_LENGTH 12
-#define RTP_MAX_PACKET_LENGTH 1500 /* XXX: suppress this define */
+#define RTP_MAX_PACKET_LENGTH 1500
#define RTP_REORDER_QUEUE_DEFAULT_SIZE 10
#define RTP_NOTS_VALUE ((uint32_t)-1)
typedef struct RTPDemuxContext RTPDemuxContext;
-RTPDemuxContext *ff_rtp_parse_open(AVFormatContext *s1, AVStream *st, URLContext *rtpc, int payload_type, int queue_size);
+RTPDemuxContext *ff_rtp_parse_open(AVFormatContext *s1, AVStream *st,
+ 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,
@@ -66,18 +68,14 @@ 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
+ * so we send a Receiver Report to the provided URLContext or AVIOContext
* (we don't have access to the rtcp handle from here)
*/
-int ff_rtp_check_and_send_back_rr(RTPDemuxContext *s, int count);
-
-/**
- * Get the file handle for the RTCP socket.
- */
-int ff_rtp_get_rtcp_file_handle(URLContext *h);
+int ff_rtp_check_and_send_back_rr(RTPDemuxContext *s, URLContext *fd,
+ AVIOContext *avio, int count);
// these statistics are used for rtcp receiver reports...
-typedef struct {
+typedef struct RTPStatistics {
uint16_t max_seq; ///< highest sequence number seen
uint32_t cycles; ///< shifted count of sequence number cycles
uint32_t base_seq; ///< base sequence number
@@ -99,39 +97,41 @@ typedef struct {
* @param s stream context
* @param st stream that this packet belongs to
* @param pkt packet in which to write the parsed data
- * @param timestamp pointer in which to write the timestamp of this RTP packet
+ * @param timestamp pointer to the RTP timestamp of the input data, can be
+ * updated by the function if returning older, buffered data
* @param buf pointer to raw RTP packet data
* @param len length of buf
+ * @param seq RTP sequence number of the packet
* @param flags flags from the RTP packet header (RTP_FLAG_*)
*/
-typedef int (*DynamicPayloadPacketHandlerProc) (AVFormatContext *ctx,
- PayloadContext *s,
- AVStream *st,
- AVPacket * pkt,
- uint32_t *timestamp,
- const uint8_t * buf,
- int len, int flags);
-
-struct RTPDynamicProtocolHandler_s {
- // fields from AVRtpDynamicPayloadType_s
- const char enc_name[50]; /* XXX: still why 50 ? ;-) */
+typedef int (*DynamicPayloadPacketHandlerProc)(AVFormatContext *ctx,
+ PayloadContext *s,
+ AVStream *st, AVPacket *pkt,
+ uint32_t *timestamp,
+ const uint8_t * buf,
+ int len, uint16_t seq, int flags);
+
+struct RTPDynamicProtocolHandler {
+ const char enc_name[50];
enum AVMediaType codec_type;
- enum CodecID codec_id;
+ enum AVCodecID codec_id;
int static_payload_id; /* 0 means no payload id is set. 0 is a valid
* payload ID (PCMU), too, but that format doesn't
* require any custom depacketization code. */
- // may be null
- int (*init)(AVFormatContext *s, int st_index, PayloadContext *priv_data); ///< Initialize dynamic protocol handler, called after the full rtpmap line is parsed
- int (*parse_sdp_a_line) (AVFormatContext *s,
- int st_index,
- PayloadContext *priv_data,
- const char *line); ///< Parse the a= line from the sdp field
- PayloadContext *(*alloc) (void); ///< allocate any data needed by the rtp parsing for this dynamic data.
- void (*free)(PayloadContext *protocol_data); ///< free any data needed by the rtp parsing for this dynamic data.
- DynamicPayloadPacketHandlerProc parse_packet; ///< parse handler for this dynamic packet.
-
- struct RTPDynamicProtocolHandler_s *next;
+ /** Initialize dynamic protocol handler, called after the full rtpmap line is parsed, may be null */
+ int (*init)(AVFormatContext *s, int st_index, PayloadContext *priv_data);
+ /** Parse the a= line from the sdp field */
+ int (*parse_sdp_a_line)(AVFormatContext *s, int st_index,
+ PayloadContext *priv_data, const char *line);
+ /** Allocate any data needed by the rtp parsing for this dynamic data. */
+ PayloadContext *(*alloc)(void);
+ /** Free any data needed by the rtp parsing for this dynamic data. */
+ void (*free)(PayloadContext *protocol_data);
+ /** Parse handler for this dynamic packet */
+ DynamicPayloadPacketHandlerProc parse_packet;
+
+ struct RTPDynamicProtocolHandler *next;
};
typedef struct RTPPacket {
@@ -142,7 +142,6 @@ typedef struct RTPPacket {
struct RTPPacket *next;
} RTPPacket;
-// moved out of rtp.c, because the h264 decoder needs to know about this structure..
struct RTPDemuxContext {
AVFormatContext *ic;
AVStream *st;
@@ -159,10 +158,10 @@ struct RTPDemuxContext {
int read_buf_index;
int read_buf_size;
/* used to send back RTCP RR */
- URLContext *rtp_ctx;
char hostname[256];
- RTPStatistics statistics; ///< Statistics for this stream (used by RTCP receiver reports)
+ /** Statistics for this stream (used by RTCP receiver reports) */
+ RTPStatistics statistics;
/** Fields for packet reordering @{ */
int prev_ret; ///< The return value of the actual parsing of the previous packet
@@ -172,24 +171,21 @@ struct RTPDemuxContext {
/*@}*/
/* rtcp sender statistics receive */
- int64_t last_rtcp_ntp_time; // TODO: move into statistics
- int64_t first_rtcp_ntp_time; // TODO: move into statistics
- uint32_t last_rtcp_timestamp; // TODO: move into statistics
+ int64_t last_rtcp_ntp_time;
+ int64_t first_rtcp_ntp_time;
+ uint32_t last_rtcp_timestamp;
int64_t rtcp_ts_offset;
/* rtcp sender statistics */
- unsigned int packet_count; // TODO: move into statistics (outgoing)
- unsigned int octet_count; // TODO: move into statistics (outgoing)
- unsigned int last_octet_count; // TODO: move into statistics (outgoing)
- int first_packet;
- /* buffer for output */
+ unsigned int packet_count;
+ unsigned int octet_count;
+ unsigned int last_octet_count;
+ /* buffer for partially parsed packets */
uint8_t buf[RTP_MAX_PACKET_LENGTH];
- uint8_t *buf_ptr;
/* dynamic payload stuff */
- DynamicPayloadPacketHandlerProc parse_packet; ///< This is also copied from the dynamic protocol handler structure
- PayloadContext *dynamic_protocol_context; ///< This is a copy from the values setup from the sdp parsing, in rtsp.c don't free me.
- int max_frames_per_packet;
+ DynamicPayloadPacketHandlerProc parse_packet;
+ PayloadContext *dynamic_protocol_context;
};
void ff_register_dynamic_payload_handler(RTPDynamicProtocolHandler *handler);
@@ -198,7 +194,9 @@ RTPDynamicProtocolHandler *ff_rtp_handler_find_by_name(const char *name,
RTPDynamicProtocolHandler *ff_rtp_handler_find_by_id(int id,
enum AVMediaType codec_type);
-int ff_rtsp_next_attr_and_value(const char **p, char *attr, int attr_size, char *value, int value_size); ///< from rtsp.c, but used by rtp dynamic protocol handlers.
+/* from rtsp.c, but used by rtp dynamic protocol handlers. */
+int ff_rtsp_next_attr_and_value(const char **p, char *attr, int attr_size,
+ char *value, int value_size);
int ff_parse_fmtp(AVStream *stream, PayloadContext *data, const char *p,
int (*parse_fmtp)(AVStream *stream,
@@ -207,4 +205,9 @@ int ff_parse_fmtp(AVStream *stream, PayloadContext *data, const char *p,
void av_register_rtp_dynamic_payload_handlers(void);
+/**
+ * Close the dynamic buffer and make a packet from it.
+ */
+int ff_rtp_finalize_packet(AVPacket *pkt, AVIOContext **dyn_buf, int stream_idx);
+
#endif /* AVFORMAT_RTPDEC_H */
diff --git a/gst-libs/ext/libav/libavformat/rtpdec_amr.c b/gst-libs/ext/libav/libavformat/rtpdec_amr.c
index b7ff3aa..fd18ff2 100644
--- a/gst-libs/ext/libav/libavformat/rtpdec_amr.c
+++ b/gst-libs/ext/libav/libavformat/rtpdec_amr.c
@@ -19,6 +19,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "libavutil/channel_layout.h"
#include "avformat.h"
#include "rtpdec_formats.h"
#include "libavutil/avstring.h"
@@ -50,13 +51,10 @@ static void amr_free_context(PayloadContext *data)
av_free(data);
}
-static int amr_handle_packet(AVFormatContext *ctx,
- PayloadContext *data,
- AVStream *st,
- AVPacket * pkt,
- uint32_t * timestamp,
- const uint8_t * buf,
- int len, int flags)
+static int amr_handle_packet(AVFormatContext *ctx, PayloadContext *data,
+ AVStream *st, AVPacket *pkt, uint32_t *timestamp,
+ const uint8_t *buf, int len, uint16_t seq,
+ int flags)
{
const uint8_t *frame_sizes = NULL;
int frames;
@@ -64,9 +62,9 @@ static int amr_handle_packet(AVFormatContext *ctx,
const uint8_t *speech_data;
uint8_t *ptr;
- if (st->codec->codec_id == CODEC_ID_AMR_NB) {
+ if (st->codec->codec_id == AV_CODEC_ID_AMR_NB) {
frame_sizes = frame_sizes_nb;
- } else if (st->codec->codec_id == CODEC_ID_AMR_WB) {
+ } else if (st->codec->codec_id == AV_CODEC_ID_AMR_WB) {
frame_sizes = frame_sizes_wb;
} else {
av_log(ctx, AV_LOG_ERROR, "Bad codec ID\n");
@@ -77,6 +75,7 @@ static int amr_handle_packet(AVFormatContext *ctx,
av_log(ctx, AV_LOG_ERROR, "Only mono AMR is supported\n");
return AVERROR_INVALIDDATA;
}
+ st->codec->channel_layout = AV_CH_LAYOUT_MONO;
/* The AMR RTP packet consists of one header byte, followed
* by one TOC byte for each AMR frame in the packet, followed
@@ -169,6 +168,9 @@ static int amr_parse_sdp_line(AVFormatContext *s, int st_index,
const char *p;
int ret;
+ if (st_index < 0)
+ return 0;
+
/* Parse an fmtp line this one:
* a=fmtp:97 octet-align=1; interleaving=0
* That is, a normal fmtp: line followed by semicolon & space
@@ -189,7 +191,7 @@ static int amr_parse_sdp_line(AVFormatContext *s, int st_index,
RTPDynamicProtocolHandler ff_amr_nb_dynamic_handler = {
.enc_name = "AMR",
.codec_type = AVMEDIA_TYPE_AUDIO,
- .codec_id = CODEC_ID_AMR_NB,
+ .codec_id = AV_CODEC_ID_AMR_NB,
.parse_sdp_a_line = amr_parse_sdp_line,
.alloc = amr_new_context,
.free = amr_free_context,
@@ -199,10 +201,9 @@ RTPDynamicProtocolHandler ff_amr_nb_dynamic_handler = {
RTPDynamicProtocolHandler ff_amr_wb_dynamic_handler = {
.enc_name = "AMR-WB",
.codec_type = AVMEDIA_TYPE_AUDIO,
- .codec_id = CODEC_ID_AMR_WB,
+ .codec_id = AV_CODEC_ID_AMR_WB,
.parse_sdp_a_line = amr_parse_sdp_line,
.alloc = amr_new_context,
.free = amr_free_context,
.parse_packet = amr_handle_packet,
};
-
diff --git a/gst-libs/ext/libav/libavformat/rtpdec_asf.c b/gst-libs/ext/libav/libavformat/rtpdec_asf.c
index 483b196..e425650 100644
--- a/gst-libs/ext/libav/libavformat/rtpdec_asf.c
+++ b/gst-libs/ext/libav/libavformat/rtpdec_asf.c
@@ -99,6 +99,7 @@ int ff_wms_parse_sdp_a_line(AVFormatContext *s, const char *p)
if (av_strstart(p, "pgmpu:data:application/vnd.ms.wms-hdr.asfv1;base64,", &p)) {
AVIOContext pb;
RTSPState *rt = s->priv_data;
+ AVDictionary *opts = NULL;
int len = strlen(p) * 6 / 8;
char *buf = av_mallocz(len);
av_base64_decode(buf, p, len);
@@ -113,7 +114,9 @@ int ff_wms_parse_sdp_a_line(AVFormatContext *s, const char *p)
if (!(rt->asf_ctx = avformat_alloc_context()))
return AVERROR(ENOMEM);
rt->asf_ctx->pb = &pb;
- ret = avformat_open_input(&rt->asf_ctx, "", &ff_asf_demuxer, NULL);
+ av_dict_set(&opts, "no_resync_search", "1", 0);
+ ret = avformat_open_input(&rt->asf_ctx, "", &ff_asf_demuxer, &opts);
+ av_dict_free(&opts);
if (ret < 0)
return ret;
av_dict_copy(&s->metadata, rt->asf_ctx->metadata, 0);
@@ -127,6 +130,8 @@ int ff_wms_parse_sdp_a_line(AVFormatContext *s, const char *p)
static int asfrtp_parse_sdp_line(AVFormatContext *s, int stream_index,
PayloadContext *asf, const char *line)
{
+ if (stream_index < 0)
+ return 0;
if (av_strstart(line, "stream:", &line)) {
RTSPState *rt = s->priv_data;
@@ -163,7 +168,8 @@ struct PayloadContext {
static int asfrtp_parse_packet(AVFormatContext *s, PayloadContext *asf,
AVStream *st, AVPacket *pkt,
uint32_t *timestamp,
- const uint8_t *buf, int len, int flags)
+ const uint8_t *buf, int len, uint16_t seq,
+ int flags)
{
AVIOContext *pb = &asf->pb;
int res, mflags, len_off;
@@ -256,7 +262,7 @@ static int asfrtp_parse_packet(AVFormatContext *s, PayloadContext *asf,
for (;;) {
int i;
- res = av_read_packet(rt->asf_ctx, pkt);
+ res = ff_read_packet(rt->asf_ctx, pkt);
rt->asf_pb_pos = avio_tell(pb);
if (res != 0)
break;
@@ -293,7 +299,7 @@ static void asfrtp_free_context(PayloadContext *asf)
RTPDynamicProtocolHandler ff_ms_rtp_ ## n ## _handler = { \
.enc_name = s, \
.codec_type = t, \
- .codec_id = CODEC_ID_NONE, \
+ .codec_id = AV_CODEC_ID_NONE, \
.parse_sdp_a_line = asfrtp_parse_sdp_line, \
.alloc = asfrtp_new_context, \
.free = asfrtp_free_context, \
diff --git a/gst-libs/ext/libav/libavformat/rtpdec_formats.h b/gst-libs/ext/libav/libavformat/rtpdec_formats.h
index 3074565..e449ddf 100644
--- a/gst-libs/ext/libav/libavformat/rtpdec_formats.h
+++ b/gst-libs/ext/libav/libavformat/rtpdec_formats.h
@@ -31,6 +31,10 @@
*/
int ff_wms_parse_sdp_a_line(AVFormatContext *s, const char *p);
+int ff_h263_handle_packet(AVFormatContext *ctx, PayloadContext *data,
+ AVStream *st, AVPacket *pkt, uint32_t *timestamp,
+ const uint8_t *buf, int len, uint16_t seq, int flags);
+
extern RTPDynamicProtocolHandler ff_amr_nb_dynamic_handler;
extern RTPDynamicProtocolHandler ff_amr_wb_dynamic_handler;
extern RTPDynamicProtocolHandler ff_g726_16_dynamic_handler;
@@ -39,7 +43,10 @@ extern RTPDynamicProtocolHandler ff_g726_32_dynamic_handler;
extern RTPDynamicProtocolHandler ff_g726_40_dynamic_handler;
extern RTPDynamicProtocolHandler ff_h263_1998_dynamic_handler;
extern RTPDynamicProtocolHandler ff_h263_2000_dynamic_handler;
+extern RTPDynamicProtocolHandler ff_h263_rfc2190_dynamic_handler;
extern RTPDynamicProtocolHandler ff_h264_dynamic_handler;
+extern RTPDynamicProtocolHandler ff_ilbc_dynamic_handler;
+extern RTPDynamicProtocolHandler ff_jpeg_dynamic_handler;
extern RTPDynamicProtocolHandler ff_mp4a_latm_dynamic_handler;
extern RTPDynamicProtocolHandler ff_mp4v_es_dynamic_handler;
extern RTPDynamicProtocolHandler ff_mpeg4_generic_dynamic_handler;
diff --git a/gst-libs/ext/libav/libavformat/rtpdec_g726.c b/gst-libs/ext/libav/libavformat/rtpdec_g726.c
index 4a0b6ac..adb4ab3 100644
--- a/gst-libs/ext/libav/libavformat/rtpdec_g726.c
+++ b/gst-libs/ext/libav/libavformat/rtpdec_g726.c
@@ -36,7 +36,7 @@ static int g726_ ## bitrate ##_init(AVFormatContext *s, int st_index, PayloadCon
RTPDynamicProtocolHandler ff_g726_ ## bitrate ## _dynamic_handler = { \
.enc_name = "G726-" #bitrate, \
.codec_type = AVMEDIA_TYPE_AUDIO, \
- .codec_id = CODEC_ID_ADPCM_G726, \
+ .codec_id = AV_CODEC_ID_ADPCM_G726, \
.init = g726_ ## bitrate ## _init, \
}
diff --git a/gst-libs/ext/libav/libavformat/rtpdec_h263.c b/gst-libs/ext/libav/libavformat/rtpdec_h263.c
index 0fb1b25..bdb5195 100644
--- a/gst-libs/ext/libav/libavformat/rtpdec_h263.c
+++ b/gst-libs/ext/libav/libavformat/rtpdec_h263.c
@@ -23,13 +23,9 @@
#include "rtpdec_formats.h"
#include "libavutil/intreadwrite.h"
-static int h263_handle_packet(AVFormatContext *ctx,
- PayloadContext *data,
- AVStream *st,
- AVPacket * pkt,
- uint32_t * timestamp,
- const uint8_t * buf,
- int len, int flags)
+int ff_h263_handle_packet(AVFormatContext *ctx, PayloadContext *data,
+ AVStream *st, AVPacket *pkt, uint32_t *timestamp,
+ const uint8_t *buf, int len, uint16_t seq, int flags)
{
uint8_t *ptr;
uint16_t header;
@@ -95,14 +91,13 @@ static int h263_handle_packet(AVFormatContext *ctx,
RTPDynamicProtocolHandler ff_h263_1998_dynamic_handler = {
.enc_name = "H263-1998",
.codec_type = AVMEDIA_TYPE_VIDEO,
- .codec_id = CODEC_ID_H263,
- .parse_packet = h263_handle_packet,
+ .codec_id = AV_CODEC_ID_H263,
+ .parse_packet = ff_h263_handle_packet,
};
RTPDynamicProtocolHandler ff_h263_2000_dynamic_handler = {
.enc_name = "H263-2000",
.codec_type = AVMEDIA_TYPE_VIDEO,
- .codec_id = CODEC_ID_H263,
- .parse_packet = h263_handle_packet,
+ .codec_id = AV_CODEC_ID_H263,
+ .parse_packet = ff_h263_handle_packet,
};
-
diff --git a/gst-libs/ext/libav/libavformat/rtpdec_h263_rfc2190.c b/gst-libs/ext/libav/libavformat/rtpdec_h263_rfc2190.c
new file mode 100644
index 0000000..4792a9f
--- /dev/null
+++ b/gst-libs/ext/libav/libavformat/rtpdec_h263_rfc2190.c
@@ -0,0 +1,205 @@
+/*
+ * RTP H.263 Depacketizer, RFC 2190
+ * Copyright (c) 2012 Martin Storsjo
+ * Based on the GStreamer H.263 Depayloder:
+ * Copyright 2005 Wim Taymans
+ * Copyright 2007 Edward Hervey
+ * Copyright 2007 Nokia Corporation
+ * Copyright 2007 Collabora Ltd, Philippe Kalaf
+ * Copyright 2010 Mark Nauwelaerts
+ *
+ * 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
+ */
+
+#include "avformat.h"
+#include "rtpdec_formats.h"
+#include "libavutil/intreadwrite.h"
+#include "libavcodec/get_bits.h"
+
+struct PayloadContext {
+ AVIOContext *buf;
+ uint8_t endbyte;
+ int endbyte_bits;
+ uint32_t timestamp;
+ int newformat;
+};
+
+static PayloadContext *h263_new_context(void)
+{
+ return av_mallocz(sizeof(PayloadContext));
+}
+
+static void h263_free_context(PayloadContext *data)
+{
+ if (!data)
+ return;
+ if (data->buf) {
+ uint8_t *p;
+ avio_close_dyn_buf(data->buf, &p);
+ av_free(p);
+ }
+ av_free(data);
+}
+
+static int h263_handle_packet(AVFormatContext *ctx, PayloadContext *data,
+ AVStream *st, AVPacket *pkt, uint32_t *timestamp,
+ const uint8_t *buf, int len, uint16_t seq,
+ int flags)
+{
+ /* Corresponding to header fields in the RFC */
+ int f, p, i, sbit, ebit, src, r;
+ int header_size, ret;
+
+ if (data->newformat)
+ return ff_h263_handle_packet(ctx, data, st, pkt, timestamp, buf, len,
+ seq, flags);
+
+ if (data->buf && data->timestamp != *timestamp) {
+ /* Dropping old buffered, unfinished data */
+ uint8_t *p;
+ avio_close_dyn_buf(data->buf, &p);
+ av_free(p);
+ data->buf = NULL;
+ }
+
+ if (len < 4) {
+ av_log(ctx, AV_LOG_ERROR, "Too short H.263 RTP packet: %d\n", len);
+ return AVERROR_INVALIDDATA;
+ }
+
+ f = buf[0] & 0x80;
+ p = buf[0] & 0x40;
+ if (!f) {
+ /* Mode A */
+ header_size = 4;
+ i = buf[1] & 0x10;
+ r = ((buf[1] & 0x01) << 3) | ((buf[2] & 0xe0) >> 5);
+ } else if (!p) {
+ /* Mode B */
+ header_size = 8;
+ if (len < header_size) {
+ av_log(ctx, AV_LOG_ERROR,
+ "Too short H.263 RTP packet: %d bytes, %d header bytes\n",
+ len, header_size);
+ return AVERROR_INVALIDDATA;
+ }
+ r = buf[3] & 0x03;
+ i = buf[4] & 0x80;
+ } else {
+ /* Mode C */
+ header_size = 12;
+ if (len < header_size) {
+ av_log(ctx, AV_LOG_ERROR,
+ "Too short H.263 RTP packet: %d bytes, %d header bytes\n",
+ len, header_size);
+ return AVERROR_INVALIDDATA;
+ }
+ r = buf[3] & 0x03;
+ i = buf[4] & 0x80;
+ }
+ sbit = (buf[0] >> 3) & 0x7;
+ ebit = buf[0] & 0x7;
+ src = (buf[1] & 0xe0) >> 5;
+ if (!(buf[0] & 0xf8)) { /* Reserved bits in RFC 2429/4629 are zero */
+ if ((src == 0 || src >= 6) && r) {
+ /* Invalid src for this format, and bits that should be zero
+ * according to RFC 2190 aren't zero. */
+ av_log(ctx, AV_LOG_WARNING,
+ "Interpreting H263 RTP data as RFC 2429/4629 even though "
+ "signalled with a static payload type.\n");
+ data->newformat = 1;
+ return ff_h263_handle_packet(ctx, data, st, pkt, timestamp, buf,
+ len, seq, flags);
+ }
+ }
+
+ buf += header_size;
+ len -= header_size;
+
+ if (!data->buf) {
+ /* Check the picture start code, only start buffering a new frame
+ * if this is correct */
+ if (len > 4 && AV_RB32(buf) >> 10 == 0x20) {
+ ret = avio_open_dyn_buf(&data->buf);
+ if (ret < 0)
+ return ret;
+ data->timestamp = *timestamp;
+ } else {
+ /* Frame not started yet, skipping */
+ return AVERROR(EAGAIN);
+ }
+ }
+
+ if (data->endbyte_bits || sbit) {
+ if (data->endbyte_bits == sbit) {
+ data->endbyte |= buf[0] & (0xff >> sbit);
+ data->endbyte_bits = 0;
+ buf++;
+ len--;
+ avio_w8(data->buf, data->endbyte);
+ } else {
+ /* Start/end skip bits not matching - missed packets? */
+ GetBitContext gb;
+ init_get_bits(&gb, buf, len*8 - ebit);
+ skip_bits(&gb, sbit);
+ if (data->endbyte_bits) {
+ data->endbyte |= get_bits(&gb, 8 - data->endbyte_bits);
+ avio_w8(data->buf, data->endbyte);
+ }
+ while (get_bits_left(&gb) >= 8)
+ avio_w8(data->buf, get_bits(&gb, 8));
+ data->endbyte_bits = get_bits_left(&gb);
+ if (data->endbyte_bits)
+ data->endbyte = get_bits(&gb, data->endbyte_bits) <<
+ (8 - data->endbyte_bits);
+ ebit = 0;
+ len = 0;
+ }
+ }
+ if (ebit) {
+ if (len > 0)
+ avio_write(data->buf, buf, len - 1);
+ data->endbyte_bits = 8 - ebit;
+ data->endbyte = buf[len - 1] & (0xff << ebit);
+ } else {
+ avio_write(data->buf, buf, len);
+ }
+
+ if (!(flags & RTP_FLAG_MARKER))
+ return AVERROR(EAGAIN);
+
+ if (data->endbyte_bits)
+ avio_w8(data->buf, data->endbyte);
+ data->endbyte_bits = 0;
+
+ ret = ff_rtp_finalize_packet(pkt, &data->buf, st->index);
+ if (ret < 0)
+ return ret;
+ if (!i)
+ pkt->flags |= AV_PKT_FLAG_KEY;
+
+ return 0;
+}
+
+RTPDynamicProtocolHandler ff_h263_rfc2190_dynamic_handler = {
+ .codec_type = AVMEDIA_TYPE_VIDEO,
+ .codec_id = AV_CODEC_ID_H263,
+ .parse_packet = h263_handle_packet,
+ .alloc = h263_new_context,
+ .free = h263_free_context,
+ .static_payload_id = 34,
+};
diff --git a/gst-libs/ext/libav/libavformat/rtpdec_h264.c b/gst-libs/ext/libav/libavformat/rtpdec_h264.c
index effdc1f..2df0930 100644
--- a/gst-libs/ext/libav/libavformat/rtpdec_h264.c
+++ b/gst-libs/ext/libav/libavformat/rtpdec_h264.c
@@ -20,7 +20,7 @@
*/
/**
-* @file
+ * @file
* @brief H.264 / RTP Code (RFC3984)
* @author Ryan Martell <rdm4@martellventures.com>
*
@@ -29,66 +29,61 @@
* This currently supports packetization mode:
* Single Nal Unit Mode (0), or
* Non-Interleaved Mode (1). It currently does not support
- * Interleaved Mode (2). (This requires implementing STAP-B, MTAP16, MTAP24, FU-B packet types)
- *
- * @note TODO:
- * 1) RTCP sender reports for udp streams are required..
- *
+ * Interleaved Mode (2). (This requires implementing STAP-B, MTAP16, MTAP24,
+ * FU-B packet types)
*/
#include "libavutil/base64.h"
#include "libavutil/avstring.h"
#include "libavcodec/get_bits.h"
#include "avformat.h"
-#include "mpegts.h"
-#include <unistd.h>
#include "network.h"
#include <assert.h>
#include "rtpdec.h"
#include "rtpdec_formats.h"
-/**
- RTP/H264 specific private data.
-*/
struct PayloadContext {
- unsigned long cookie; ///< sanity check, to make sure we get the pointer we're expecting.
-
- //sdp setup parameters
- uint8_t profile_idc; ///< from the sdp setup parameters.
- uint8_t profile_iop; ///< from the sdp setup parameters.
- uint8_t level_idc; ///< from the sdp setup parameters.
- int packetization_mode; ///< from the sdp setup parameters.
+ // sdp setup parameters
+ uint8_t profile_idc;
+ uint8_t profile_iop;
+ uint8_t level_idc;
+ int packetization_mode;
#ifdef DEBUG
int packet_types_received[32];
#endif
};
-#define MAGIC_COOKIE (0xdeadbeef) ///< Cookie for the extradata; to verify we are what we think we are, and that we haven't been freed.
-#define DEAD_COOKIE (0xdeaddead) ///< Cookie for the extradata; once it is freed.
+#ifdef DEBUG
+#define COUNT_NAL_TYPE(data, nal) data->packet_types_received[(nal) & 0x1f]++
+#else
+#define COUNT_NAL_TYPE(data, nal) do { } while (0)
+#endif
+
+static const uint8_t start_sequence[] = { 0, 0, 0, 1 };
-/* ---------------- private code */
-static int sdp_parse_fmtp_config_h264(AVStream * stream,
- PayloadContext * h264_data,
+static int sdp_parse_fmtp_config_h264(AVStream *stream,
+ PayloadContext *h264_data,
char *attr, char *value)
{
AVCodecContext *codec = stream->codec;
- assert(codec->codec_id == CODEC_ID_H264);
+ assert(codec->codec_id == AV_CODEC_ID_H264);
assert(h264_data != NULL);
if (!strcmp(attr, "packetization-mode")) {
av_log(codec, AV_LOG_DEBUG, "RTP Packetization Mode: %d\n", atoi(value));
h264_data->packetization_mode = atoi(value);
/*
- Packetization Mode:
- 0 or not present: Single NAL mode (Only nals from 1-23 are allowed)
- 1: Non-interleaved Mode: 1-23, 24 (STAP-A), 28 (FU-A) are allowed.
- 2: Interleaved Mode: 25 (STAP-B), 26 (MTAP16), 27 (MTAP24), 28 (FU-A), and 29 (FU-B) are allowed.
+ * Packetization Mode:
+ * 0 or not present: Single NAL mode (Only nals from 1-23 are allowed)
+ * 1: Non-interleaved Mode: 1-23, 24 (STAP-A), 28 (FU-A) are allowed.
+ * 2: Interleaved Mode: 25 (STAP-B), 26 (MTAP16), 27 (MTAP24), 28 (FU-A),
+ * and 29 (FU-B) are allowed.
*/
if (h264_data->packetization_mode > 1)
av_log(codec, AV_LOG_ERROR,
- "Interleaved RTP mode is not supported yet.");
+ "Interleaved RTP mode is not supported yet.\n");
} else if (!strcmp(attr, "profile-level-id")) {
if (strlen(value) == 6) {
char buffer[3];
@@ -97,25 +92,27 @@ static int sdp_parse_fmtp_config_h264(AVStream * stream,
uint8_t profile_iop;
uint8_t level_idc;
- buffer[0] = value[0]; buffer[1] = value[1]; buffer[2] = '\0';
+ buffer[0] = value[0];
+ buffer[1] = value[1];
+ buffer[2] = '\0';
profile_idc = strtol(buffer, NULL, 16);
- buffer[0] = value[2]; buffer[1] = value[3];
+ buffer[0] = value[2];
+ buffer[1] = value[3];
profile_iop = strtol(buffer, NULL, 16);
- buffer[0] = value[4]; buffer[1] = value[5];
- level_idc = strtol(buffer, NULL, 16);
+ buffer[0] = value[4];
+ buffer[1] = value[5];
+ level_idc = strtol(buffer, NULL, 16);
- // set the parameters...
av_log(codec, AV_LOG_DEBUG,
"RTP Profile IDC: %x Profile IOP: %x Level: %x\n",
profile_idc, profile_iop, level_idc);
h264_data->profile_idc = profile_idc;
h264_data->profile_iop = profile_iop;
- h264_data->level_idc = level_idc;
+ h264_data->level_idc = level_idc;
}
- } else if (!strcmp(attr, "sprop-parameter-sets")) {
- uint8_t start_sequence[]= { 0, 0, 1 };
- codec->extradata_size= 0;
- codec->extradata= NULL;
+ } else if (!strcmp(attr, "sprop-parameter-sets")) {
+ codec->extradata_size = 0;
+ av_freep(&codec->extradata);
while (*value) {
char base64packet[1024];
@@ -132,127 +129,127 @@ static int sdp_parse_fmtp_config_h264(AVStream * stream,
if (*value == ',')
value++;
- packet_size= av_base64_decode(decoded_packet, base64packet, sizeof(decoded_packet));
+ packet_size = av_base64_decode(decoded_packet, base64packet,
+ sizeof(decoded_packet));
if (packet_size > 0) {
uint8_t *dest = av_malloc(packet_size + sizeof(start_sequence) +
- codec->extradata_size +
- FF_INPUT_BUFFER_PADDING_SIZE);
- if(dest)
- {
- if(codec->extradata_size)
- {
- // av_realloc?
- memcpy(dest, codec->extradata, codec->extradata_size);
- av_free(codec->extradata);
- }
-
- memcpy(dest+codec->extradata_size, start_sequence, sizeof(start_sequence));
- memcpy(dest+codec->extradata_size+sizeof(start_sequence), decoded_packet, packet_size);
- memset(dest+codec->extradata_size+sizeof(start_sequence)+
- packet_size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
-
- codec->extradata= dest;
- codec->extradata_size+= sizeof(start_sequence)+packet_size;
- } else {
- av_log(codec, AV_LOG_ERROR, "Unable to allocate memory for extradata!");
+ codec->extradata_size +
+ FF_INPUT_BUFFER_PADDING_SIZE);
+ if (!dest) {
+ av_log(codec, AV_LOG_ERROR,
+ "Unable to allocate memory for extradata!\n");
return AVERROR(ENOMEM);
}
+ if (codec->extradata_size) {
+ memcpy(dest, codec->extradata, codec->extradata_size);
+ av_free(codec->extradata);
+ }
+
+ memcpy(dest + codec->extradata_size, start_sequence,
+ sizeof(start_sequence));
+ memcpy(dest + codec->extradata_size + sizeof(start_sequence),
+ decoded_packet, packet_size);
+ memset(dest + codec->extradata_size + sizeof(start_sequence) +
+ packet_size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
+
+ codec->extradata = dest;
+ codec->extradata_size += sizeof(start_sequence) + packet_size;
}
}
- av_log(codec, AV_LOG_DEBUG, "Extradata set to %p (size: %d)!", codec->extradata, codec->extradata_size);
+ av_log(codec, AV_LOG_DEBUG, "Extradata set to %p (size: %d)!\n",
+ codec->extradata, codec->extradata_size);
}
return 0;
}
-// return 0 on packet, no more left, 1 on packet, 1 on partial packet...
-static int h264_handle_packet(AVFormatContext *ctx,
- PayloadContext *data,
- AVStream *st,
- AVPacket * pkt,
- uint32_t * timestamp,
- const uint8_t * buf,
- int len, int flags)
+// return 0 on packet, no more left, 1 on packet, 1 on partial packet
+static int h264_handle_packet(AVFormatContext *ctx, PayloadContext *data,
+ AVStream *st, AVPacket *pkt, uint32_t *timestamp,
+ const uint8_t *buf, int len, uint16_t seq,
+ int flags)
{
- uint8_t nal = buf[0];
- uint8_t type = (nal & 0x1f);
- int result= 0;
- uint8_t start_sequence[]= {0, 0, 1};
+ uint8_t nal;
+ uint8_t type;
+ int result = 0;
+
+ if (!len) {
+ av_log(ctx, AV_LOG_ERROR, "Empty H264 RTP packet\n");
+ return AVERROR_INVALIDDATA;
+ }
+ nal = buf[0];
+ type = nal & 0x1f;
-#ifdef DEBUG
assert(data);
- assert(data->cookie == MAGIC_COOKIE);
-#endif
assert(buf);
+ /* Simplify the case (these are all the nal types used internally by
+ * the h264 codec). */
if (type >= 1 && type <= 23)
- type = 1; // simplify the case. (these are all the nal types used internally by the h264 codec)
+ type = 1;
switch (type) {
case 0: // undefined, but pass them through
case 1:
- av_new_packet(pkt, len+sizeof(start_sequence));
+ av_new_packet(pkt, len + sizeof(start_sequence));
memcpy(pkt->data, start_sequence, sizeof(start_sequence));
- memcpy(pkt->data+sizeof(start_sequence), buf, len);
-#ifdef DEBUG
- data->packet_types_received[nal & 0x1f]++;
-#endif
+ memcpy(pkt->data + sizeof(start_sequence), buf, len);
+ COUNT_NAL_TYPE(data, nal);
break;
case 24: // STAP-A (one packet, multiple nals)
// consume the STAP-A NAL
buf++;
len--;
- // first we are going to figure out the total size....
+ // first we are going to figure out the total size
{
- int pass= 0;
- int total_length= 0;
- uint8_t *dst= NULL;
+ int pass = 0;
+ int total_length = 0;
+ uint8_t *dst = NULL;
- for(pass= 0; pass<2; pass++) {
- const uint8_t *src= buf;
- int src_len= len;
+ for (pass = 0; pass < 2; pass++) {
+ const uint8_t *src = buf;
+ int src_len = len;
- do {
- uint16_t nal_size = AV_RB16(src); // this going to be a problem if unaligned (can it be?)
+ while (src_len > 2) {
+ uint16_t nal_size = AV_RB16(src);
- // consume the length of the aggregate...
- src += 2;
+ // consume the length of the aggregate
+ src += 2;
src_len -= 2;
if (nal_size <= src_len) {
- if(pass==0) {
- // counting...
- total_length+= sizeof(start_sequence)+nal_size;
+ if (pass == 0) {
+ // counting
+ total_length += sizeof(start_sequence) + nal_size;
} else {
// copying
assert(dst);
memcpy(dst, start_sequence, sizeof(start_sequence));
- dst+= sizeof(start_sequence);
+ dst += sizeof(start_sequence);
memcpy(dst, src, nal_size);
-#ifdef DEBUG
- data->packet_types_received[*src & 0x1f]++;
-#endif
- dst+= nal_size;
+ COUNT_NAL_TYPE(data, *src);
+ dst += nal_size;
}
} else {
av_log(ctx, AV_LOG_ERROR,
"nal size exceeds length: %d %d\n", nal_size, src_len);
}
- // eat what we handled...
- src += nal_size;
+ // eat what we handled
+ src += nal_size;
src_len -= nal_size;
if (src_len < 0)
av_log(ctx, AV_LOG_ERROR,
"Consumed more bytes than we got! (%d)\n", src_len);
- } while (src_len > 2); // because there could be rtp padding..
+ }
- if(pass==0) {
- // now we know the total size of the packet (with the start sequences added)
+ if (pass == 0) {
+ /* now we know the total size of the packet (with the
+ * start sequences added) */
av_new_packet(pkt, total_length);
- dst= pkt->data;
+ dst = pkt->data;
} else {
- assert(dst-pkt->data==total_length);
+ assert(dst - pkt->data == total_length);
}
}
}
@@ -265,51 +262,54 @@ static int h264_handle_packet(AVFormatContext *ctx,
av_log(ctx, AV_LOG_ERROR,
"Unhandled type (%d) (See RFC for implementation details\n",
type);
- result= -1;
+ result = AVERROR(ENOSYS);
break;
case 28: // FU-A (fragmented nal)
buf++;
- len--; // skip the fu_indicator
- {
- // these are the same as above, we just redo them here for clarity...
- uint8_t fu_indicator = nal;
- uint8_t fu_header = *buf; // read the fu_header.
- uint8_t start_bit = fu_header >> 7;
-// uint8_t end_bit = (fu_header & 0x40) >> 6;
- uint8_t nal_type = (fu_header & 0x1f);
+ len--; // skip the fu_indicator
+ if (len > 1) {
+ // these are the same as above, we just redo them here for clarity
+ uint8_t fu_indicator = nal;
+ uint8_t fu_header = *buf;
+ uint8_t start_bit = fu_header >> 7;
+ uint8_t av_unused end_bit = (fu_header & 0x40) >> 6;
+ uint8_t nal_type = fu_header & 0x1f;
uint8_t reconstructed_nal;
- // reconstruct this packet's true nal; only the data follows..
- reconstructed_nal = fu_indicator & (0xe0); // the original nal forbidden bit and NRI are stored in this packet's nal;
+ // Reconstruct this packet's true nal; only the data follows.
+ /* The original nal forbidden bit and NRI are stored in this
+ * packet's nal. */
+ reconstructed_nal = fu_indicator & 0xe0;
reconstructed_nal |= nal_type;
- // skip the fu_header...
+ // skip the fu_header
buf++;
len--;
-#ifdef DEBUG
if (start_bit)
- data->packet_types_received[nal_type]++;
-#endif
- if(start_bit) {
- // copy in the start sequence, and the reconstructed nal....
- av_new_packet(pkt, sizeof(start_sequence)+sizeof(nal)+len);
+ COUNT_NAL_TYPE(data, nal_type);
+ if (start_bit) {
+ /* copy in the start sequence, and the reconstructed nal */
+ av_new_packet(pkt, sizeof(start_sequence) + sizeof(nal) + len);
memcpy(pkt->data, start_sequence, sizeof(start_sequence));
- pkt->data[sizeof(start_sequence)]= reconstructed_nal;
- memcpy(pkt->data+sizeof(start_sequence)+sizeof(nal), buf, len);
+ pkt->data[sizeof(start_sequence)] = reconstructed_nal;
+ memcpy(pkt->data + sizeof(start_sequence) + sizeof(nal), buf, len);
} else {
av_new_packet(pkt, len);
memcpy(pkt->data, buf, len);
}
+ } else {
+ av_log(ctx, AV_LOG_ERROR, "Too short data for FU-A H264 RTP packet\n");
+ result = AVERROR_INVALIDDATA;
}
break;
case 30: // undefined
case 31: // undefined
default:
- av_log(ctx, AV_LOG_ERROR, "Undefined type (%d)", type);
- result= -1;
+ av_log(ctx, AV_LOG_ERROR, "Undefined type (%d)\n", type);
+ result = AVERROR_INVALIDDATA;
break;
}
@@ -318,18 +318,9 @@ static int h264_handle_packet(AVFormatContext *ctx,
return result;
}
-/* ---------------- public code */
static PayloadContext *h264_new_context(void)
{
- PayloadContext *data =
- av_mallocz(sizeof(PayloadContext) +
- FF_INPUT_BUFFER_PADDING_SIZE);
-
- if (data) {
- data->cookie = MAGIC_COOKIE;
- }
-
- return data;
+ return av_mallocz(sizeof(PayloadContext) + FF_INPUT_BUFFER_PADDING_SIZE);
}
static void h264_free_context(PayloadContext *data)
@@ -344,59 +335,54 @@ static void h264_free_context(PayloadContext *data)
}
#endif
- assert(data);
- assert(data->cookie == MAGIC_COOKIE);
-
- // avoid stale pointers (assert)
- data->cookie = DEAD_COOKIE;
-
- // and clear out this...
av_free(data);
}
static int parse_h264_sdp_line(AVFormatContext *s, int st_index,
PayloadContext *h264_data, const char *line)
{
- AVStream *stream = s->streams[st_index];
- AVCodecContext *codec = stream->codec;
+ AVStream *stream;
+ AVCodecContext *codec;
const char *p = line;
- assert(h264_data->cookie == MAGIC_COOKIE);
+ if (st_index < 0)
+ return 0;
+
+ stream = s->streams[st_index];
+ codec = stream->codec;
if (av_strstart(p, "framesize:", &p)) {
char buf1[50];
char *dst = buf1;
- // remove the protocol identifier..
- while (*p && *p == ' ') p++; // strip spaces.
- while (*p && *p != ' ') p++; // eat protocol identifier
- while (*p && *p == ' ') p++; // strip trailing spaces.
- while (*p && *p != '-' && (dst - buf1) < sizeof(buf1) - 1) {
+ // remove the protocol identifier
+ while (*p && *p == ' ')
+ p++; // strip spaces.
+ while (*p && *p != ' ')
+ p++; // eat protocol identifier
+ while (*p && *p == ' ')
+ p++; // strip trailing spaces.
+ while (*p && *p != '-' && (dst - buf1) < sizeof(buf1) - 1)
*dst++ = *p++;
- }
*dst = '\0';
// a='framesize:96 320-240'
- // set our parameters..
- codec->width = atoi(buf1);
- codec->height = atoi(p + 1); // skip the -
- codec->pix_fmt = PIX_FMT_YUV420P;
+ // set our parameters
+ codec->width = atoi(buf1);
+ codec->height = atoi(p + 1); // skip the -
} else if (av_strstart(p, "fmtp:", &p)) {
return ff_parse_fmtp(stream, h264_data, p, sdp_parse_fmtp_config_h264);
} else if (av_strstart(p, "cliprect:", &p)) {
// could use this if we wanted.
}
- return 0; // keep processing it the normal way...
+ return 0;
}
-/**
-This is the structure for expanding on the dynamic rtp protocols (makes everything static. yay!)
-*/
RTPDynamicProtocolHandler ff_h264_dynamic_handler = {
.enc_name = "H264",
.codec_type = AVMEDIA_TYPE_VIDEO,
- .codec_id = CODEC_ID_H264,
+ .codec_id = AV_CODEC_ID_H264,
.parse_sdp_a_line = parse_h264_sdp_line,
.alloc = h264_new_context,
.free = h264_free_context,
diff --git a/gst-libs/ext/libav/libavformat/rtpdec_ilbc.c b/gst-libs/ext/libav/libavformat/rtpdec_ilbc.c
new file mode 100644
index 0000000..2e99734
--- /dev/null
+++ b/gst-libs/ext/libav/libavformat/rtpdec_ilbc.c
@@ -0,0 +1,73 @@
+/*
+ * RTP iLBC Depacketizer, RFC 3952
+ * Copyright (c) 2012 Martin Storsjo
+ *
+ * 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
+ */
+
+#include "avformat.h"
+#include "rtpdec_formats.h"
+#include "libavutil/avstring.h"
+
+static int ilbc_parse_fmtp(AVStream *stream, PayloadContext *data,
+ char *attr, char *value)
+{
+ if (!strcmp(attr, "mode")) {
+ int mode = atoi(value);
+ switch (mode) {
+ case 20:
+ stream->codec->block_align = 38;
+ break;
+ case 30:
+ stream->codec->block_align = 50;
+ break;
+ default:
+ av_log(NULL, AV_LOG_ERROR, "Unsupported iLBC mode %d\n", mode);
+ return AVERROR(EINVAL);
+ }
+ }
+ return 0;
+}
+
+static int ilbc_parse_sdp_line(AVFormatContext *s, int st_index,
+ PayloadContext *data, const char *line)
+{
+ const char *p;
+ AVStream *st;
+
+ if (st_index < 0)
+ return 0;
+ st = s->streams[st_index];
+
+ if (av_strstart(line, "fmtp:", &p)) {
+ int ret = ff_parse_fmtp(st, data, p, ilbc_parse_fmtp);
+ if (ret < 0)
+ return ret;
+ if (!st->codec->block_align) {
+ av_log(s, AV_LOG_ERROR, "No iLBC mode set\n");
+ return AVERROR(EINVAL);
+ }
+ }
+ return 0;
+}
+
+RTPDynamicProtocolHandler ff_ilbc_dynamic_handler = {
+ .enc_name = "iLBC",
+ .codec_type = AVMEDIA_TYPE_AUDIO,
+ .codec_id = AV_CODEC_ID_ILBC,
+ .parse_sdp_a_line = ilbc_parse_sdp_line,
+};
diff --git a/gst-libs/ext/libav/libavformat/rtpdec_jpeg.c b/gst-libs/ext/libav/libavformat/rtpdec_jpeg.c
new file mode 100644
index 0000000..ed9c86c
--- /dev/null
+++ b/gst-libs/ext/libav/libavformat/rtpdec_jpeg.c
@@ -0,0 +1,392 @@
+/*
+ * RTP JPEG-compressed Video Depacketizer, RFC 2435
+ * Copyright (c) 2012 Samuel Pitoiset
+ *
+ * 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
+ */
+
+#include "avformat.h"
+#include "rtpdec.h"
+#include "rtpdec_formats.h"
+#include "libavutil/intreadwrite.h"
+#include "libavcodec/mjpeg.h"
+#include "libavcodec/bytestream.h"
+
+/**
+ * RTP/JPEG specific private data.
+ */
+struct PayloadContext {
+ AVIOContext *frame; ///< current frame buffer
+ uint32_t timestamp; ///< current frame timestamp
+ int hdr_size; ///< size of the current frame header
+ uint8_t qtables[128][128];
+ uint8_t qtables_len[128];
+};
+
+static const uint8_t default_quantizers[128] = {
+ /* luma table */
+ 16, 11, 12, 14, 12, 10, 16, 14,
+ 13, 14, 18, 17, 16, 19, 24, 40,
+ 26, 24, 22, 22, 24, 49, 35, 37,
+ 29, 40, 58, 51, 61, 60, 57, 51,
+ 56, 55, 64, 72, 92, 78, 64, 68,
+ 87, 69, 55, 56, 80, 109, 81, 87,
+ 95, 98, 103, 104, 103, 62, 77, 113,
+ 121, 112, 100, 120, 92, 101, 103, 99,
+
+ /* chroma table */
+ 17, 18, 18, 24, 21, 24, 47, 26,
+ 26, 47, 99, 66, 56, 66, 99, 99,
+ 99, 99, 99, 99, 99, 99, 99, 99,
+ 99, 99, 99, 99, 99, 99, 99, 99,
+ 99, 99, 99, 99, 99, 99, 99, 99,
+ 99, 99, 99, 99, 99, 99, 99, 99,
+ 99, 99, 99, 99, 99, 99, 99, 99,
+ 99, 99, 99, 99, 99, 99, 99, 99
+};
+
+static PayloadContext *jpeg_new_context(void)
+{
+ return av_mallocz(sizeof(PayloadContext));
+}
+
+static inline void free_frame_if_needed(PayloadContext *jpeg)
+{
+ if (jpeg->frame) {
+ uint8_t *p;
+ avio_close_dyn_buf(jpeg->frame, &p);
+ av_free(p);
+ jpeg->frame = NULL;
+ }
+}
+
+static void jpeg_free_context(PayloadContext *jpeg)
+{
+ free_frame_if_needed(jpeg);
+ av_free(jpeg);
+}
+
+static int jpeg_create_huffman_table(PutByteContext *p, int table_class,
+ int table_id, const uint8_t *bits_table,
+ const uint8_t *value_table)
+{
+ int i, n = 0;
+
+ bytestream2_put_byte(p, table_class << 4 | table_id);
+
+ for (i = 1; i <= 16; i++) {
+ n += bits_table[i];
+ bytestream2_put_byte(p, bits_table[i]);
+ }
+
+ for (i = 0; i < n; i++) {
+ bytestream2_put_byte(p, value_table[i]);
+ }
+ return n + 17;
+}
+
+static void jpeg_put_marker(PutByteContext *pbc, int code)
+{
+ bytestream2_put_byte(pbc, 0xff);
+ bytestream2_put_byte(pbc, code);
+}
+
+static int jpeg_create_header(uint8_t *buf, int size, uint32_t type, uint32_t w,
+ uint32_t h, const uint8_t *qtable, int nb_qtable)
+{
+ PutByteContext pbc;
+ uint8_t *dht_size_ptr;
+ int dht_size, i;
+
+ bytestream2_init_writer(&pbc, buf, size);
+
+ /* Convert from blocks to pixels. */
+ w <<= 3;
+ h <<= 3;
+
+ /* SOI */
+ jpeg_put_marker(&pbc, SOI);
+
+ /* JFIF header */
+ jpeg_put_marker(&pbc, APP0);
+ bytestream2_put_be16(&pbc, 16);
+ bytestream2_put_buffer(&pbc, "JFIF", 5);
+ bytestream2_put_be16(&pbc, 0x0201);
+ bytestream2_put_byte(&pbc, 0);
+ bytestream2_put_be16(&pbc, 1);
+ bytestream2_put_be16(&pbc, 1);
+ bytestream2_put_byte(&pbc, 0);
+ bytestream2_put_byte(&pbc, 0);
+
+ /* DQT */
+ jpeg_put_marker(&pbc, DQT);
+ bytestream2_put_be16(&pbc, 2 + nb_qtable * (1 + 64));
+
+ for (i = 0; i < nb_qtable; i++) {
+ bytestream2_put_byte(&pbc, i);
+
+ /* Each table is an array of 64 values given in zig-zag
+ * order, identical to the format used in a JFIF DQT
+ * marker segment. */
+ bytestream2_put_buffer(&pbc, qtable + 64 * i, 64);
+ }
+
+ /* DHT */
+ jpeg_put_marker(&pbc, DHT);
+ dht_size_ptr = pbc.buffer;
+ bytestream2_put_be16(&pbc, 0);
+
+ dht_size = 2;
+ dht_size += jpeg_create_huffman_table(&pbc, 0, 0,avpriv_mjpeg_bits_dc_luminance,
+ avpriv_mjpeg_val_dc);
+ dht_size += jpeg_create_huffman_table(&pbc, 0, 1, avpriv_mjpeg_bits_dc_chrominance,
+ avpriv_mjpeg_val_dc);
+ dht_size += jpeg_create_huffman_table(&pbc, 1, 0, avpriv_mjpeg_bits_ac_luminance,
+ avpriv_mjpeg_val_ac_luminance);
+ dht_size += jpeg_create_huffman_table(&pbc, 1, 1, avpriv_mjpeg_bits_ac_chrominance,
+ avpriv_mjpeg_val_ac_chrominance);
+ AV_WB16(dht_size_ptr, dht_size);
+
+ /* SOF0 */
+ jpeg_put_marker(&pbc, SOF0);
+ bytestream2_put_be16(&pbc, 17); /* size */
+ bytestream2_put_byte(&pbc, 8); /* bits per component */
+ bytestream2_put_be16(&pbc, h);
+ bytestream2_put_be16(&pbc, w);
+ bytestream2_put_byte(&pbc, 3); /* number of components */
+ bytestream2_put_byte(&pbc, 1); /* component number */
+ bytestream2_put_byte(&pbc, (2 << 4) | (type ? 2 : 1)); /* hsample/vsample */
+ bytestream2_put_byte(&pbc, 0); /* matrix number */
+ bytestream2_put_byte(&pbc, 2); /* component number */
+ bytestream2_put_byte(&pbc, 1 << 4 | 1); /* hsample/vsample */
+ bytestream2_put_byte(&pbc, nb_qtable == 2 ? 1 : 0); /* matrix number */
+ bytestream2_put_byte(&pbc, 3); /* component number */
+ bytestream2_put_byte(&pbc, 1 << 4 | 1); /* hsample/vsample */
+ bytestream2_put_byte(&pbc, nb_qtable == 2 ? 1 : 0); /* matrix number */
+
+ /* SOS */
+ jpeg_put_marker(&pbc, SOS);
+ bytestream2_put_be16(&pbc, 12);
+ bytestream2_put_byte(&pbc, 3);
+ bytestream2_put_byte(&pbc, 1);
+ bytestream2_put_byte(&pbc, 0);
+ bytestream2_put_byte(&pbc, 2);
+ bytestream2_put_byte(&pbc, 17);
+ bytestream2_put_byte(&pbc, 3);
+ bytestream2_put_byte(&pbc, 17);
+ bytestream2_put_byte(&pbc, 0);
+ bytestream2_put_byte(&pbc, 63);
+ bytestream2_put_byte(&pbc, 0);
+
+ /* Return the length in bytes of the JPEG header. */
+ return bytestream2_tell_p(&pbc);
+}
+
+static void create_default_qtables(uint8_t *qtables, uint8_t q)
+{
+ int factor = q;
+ int i;
+
+ factor = av_clip(q, 1, 99);
+
+ if (q < 50)
+ q = 5000 / factor;
+ else
+ q = 200 - factor * 2;
+
+ for (i = 0; i < 128; i++) {
+ int val = (default_quantizers[i] * q + 50) / 100;
+
+ /* Limit the quantizers to 1 <= q <= 255. */
+ val = av_clip(val, 1, 255);
+ qtables[i] = val;
+ }
+}
+
+static int jpeg_parse_packet(AVFormatContext *ctx, PayloadContext *jpeg,
+ AVStream *st, AVPacket *pkt, uint32_t *timestamp,
+ const uint8_t *buf, int len, uint16_t seq,
+ int flags)
+{
+ uint8_t type, q, width, height;
+ const uint8_t *qtables = NULL;
+ uint16_t qtable_len;
+ uint32_t off;
+ int ret;
+
+ if (len < 8) {
+ av_log(ctx, AV_LOG_ERROR, "Too short RTP/JPEG packet.\n");
+ return AVERROR_INVALIDDATA;
+ }
+
+ /* Parse the main JPEG header. */
+ off = AV_RB24(buf + 1); /* fragment byte offset */
+ type = AV_RB8(buf + 4); /* id of jpeg decoder params */
+ q = AV_RB8(buf + 5); /* quantization factor (or table id) */
+ width = AV_RB8(buf + 6); /* frame width in 8 pixel blocks */
+ height = AV_RB8(buf + 7); /* frame height in 8 pixel blocks */
+ buf += 8;
+ len -= 8;
+
+ /* Parse the restart marker header. */
+ if (type > 63) {
+ av_log(ctx, AV_LOG_ERROR,
+ "Unimplemented RTP/JPEG restart marker header.\n");
+ return AVERROR_PATCHWELCOME;
+ }
+ if (type > 1) {
+ av_log(ctx, AV_LOG_ERROR, "Unimplemented RTP/JPEG type %d\n", type);
+ return AVERROR_PATCHWELCOME;
+ }
+
+ /* Parse the quantization table header. */
+ if (off == 0) {
+ /* Start of JPEG data packet. */
+ uint8_t new_qtables[128];
+ uint8_t hdr[1024];
+
+ if (q > 127) {
+ uint8_t precision;
+ if (len < 4) {
+ av_log(ctx, AV_LOG_ERROR, "Too short RTP/JPEG packet.\n");
+ return AVERROR_INVALIDDATA;
+ }
+
+ /* The first byte is reserved for future use. */
+ precision = AV_RB8(buf + 1); /* size of coefficients */
+ qtable_len = AV_RB16(buf + 2); /* length in bytes */
+ buf += 4;
+ len -= 4;
+
+ if (precision)
+ av_log(ctx, AV_LOG_WARNING, "Only 8-bit precision is supported.\n");
+
+ if (qtable_len > 0) {
+ if (len < qtable_len) {
+ av_log(ctx, AV_LOG_ERROR, "Too short RTP/JPEG packet.\n");
+ return AVERROR_INVALIDDATA;
+ }
+ qtables = buf;
+ buf += qtable_len;
+ len -= qtable_len;
+ if (q < 255) {
+ if (jpeg->qtables_len[q - 128] &&
+ (jpeg->qtables_len[q - 128] != qtable_len ||
+ memcmp(qtables, &jpeg->qtables[q - 128][0], qtable_len))) {
+ av_log(ctx, AV_LOG_WARNING,
+ "Quantization tables for q=%d changed\n", q);
+ } else if (!jpeg->qtables_len[q - 128] && qtable_len <= 128) {
+ memcpy(&jpeg->qtables[q - 128][0], qtables,
+ qtable_len);
+ jpeg->qtables_len[q - 128] = qtable_len;
+ }
+ }
+ } else {
+ if (q == 255) {
+ av_log(ctx, AV_LOG_ERROR,
+ "Invalid RTP/JPEG packet. Quantization tables not found.\n");
+ return AVERROR_INVALIDDATA;
+ }
+ if (!jpeg->qtables_len[q - 128]) {
+ av_log(ctx, AV_LOG_ERROR,
+ "No quantization tables known for q=%d yet.\n", q);
+ return AVERROR_INVALIDDATA;
+ }
+ qtables = &jpeg->qtables[q - 128][0];
+ qtable_len = jpeg->qtables_len[q - 128];
+ }
+ } else { /* q <= 127 */
+ if (q == 0 || q > 99) {
+ av_log(ctx, AV_LOG_ERROR, "Reserved q value %d\n", q);
+ return AVERROR_INVALIDDATA;
+ }
+ create_default_qtables(new_qtables, q);
+ qtables = new_qtables;
+ qtable_len = sizeof(new_qtables);
+ }
+
+ /* Skip the current frame in case of the end packet
+ * has been lost somewhere. */
+ free_frame_if_needed(jpeg);
+
+ if ((ret = avio_open_dyn_buf(&jpeg->frame)) < 0)
+ return ret;
+ jpeg->timestamp = *timestamp;
+
+ /* Generate a frame and scan headers that can be prepended to the
+ * RTP/JPEG data payload to produce a JPEG compressed image in
+ * interchange format. */
+ jpeg->hdr_size = jpeg_create_header(hdr, sizeof(hdr), type, width,
+ height, qtables,
+ qtable_len / 64);
+
+ /* Copy JPEG header to frame buffer. */
+ avio_write(jpeg->frame, hdr, jpeg->hdr_size);
+ }
+
+ if (!jpeg->frame) {
+ av_log(ctx, AV_LOG_ERROR,
+ "Received packet without a start chunk; dropping frame.\n");
+ return AVERROR(EAGAIN);
+ }
+
+ if (jpeg->timestamp != *timestamp) {
+ /* Skip the current frame if timestamp is incorrect.
+ * A start packet has been lost somewhere. */
+ free_frame_if_needed(jpeg);
+ av_log(ctx, AV_LOG_ERROR, "RTP timestamps don't match.\n");
+ return AVERROR_INVALIDDATA;
+ }
+
+ if (off != avio_tell(jpeg->frame) - jpeg->hdr_size) {
+ av_log(ctx, AV_LOG_ERROR,
+ "Missing packets; dropping frame.\n");
+ return AVERROR(EAGAIN);
+ }
+
+ /* Copy data to frame buffer. */
+ avio_write(jpeg->frame, buf, len);
+
+ if (flags & RTP_FLAG_MARKER) {
+ /* End of JPEG data packet. */
+ uint8_t buf[2] = { 0xff, EOI };
+
+ /* Put EOI marker. */
+ avio_write(jpeg->frame, buf, sizeof(buf));
+
+ /* Prepare the JPEG packet. */
+ if ((ret = ff_rtp_finalize_packet(pkt, &jpeg->frame, st->index)) < 0) {
+ av_log(ctx, AV_LOG_ERROR,
+ "Error occurred when getting frame buffer.\n");
+ return ret;
+ }
+
+ return 0;
+ }
+
+ return AVERROR(EAGAIN);
+}
+
+RTPDynamicProtocolHandler ff_jpeg_dynamic_handler = {
+ .enc_name = "JPEG",
+ .codec_type = AVMEDIA_TYPE_VIDEO,
+ .codec_id = AV_CODEC_ID_MJPEG,
+ .alloc = jpeg_new_context,
+ .free = jpeg_free_context,
+ .parse_packet = jpeg_parse_packet,
+ .static_payload_id = 26,
+};
diff --git a/gst-libs/ext/libav/libavformat/rtpdec_latm.c b/gst-libs/ext/libav/libavformat/rtpdec_latm.c
index 96f4e83..7d4ae1e 100644
--- a/gst-libs/ext/libav/libavformat/rtpdec_latm.c
+++ b/gst-libs/ext/libav/libavformat/rtpdec_latm.c
@@ -1,4 +1,4 @@
-/**
+/*
* RTP Depacketization of MP4A-LATM, RFC 3016
* Copyright (c) 2010 Martin Storsjo
*
@@ -51,7 +51,8 @@ static void latm_free_context(PayloadContext *data)
static int latm_parse_packet(AVFormatContext *ctx, PayloadContext *data,
AVStream *st, AVPacket *pkt, uint32_t *timestamp,
- const uint8_t *buf, int len, int flags)
+ const uint8_t *buf, int len, uint16_t seq,
+ int flags)
{
int ret, cur_len;
@@ -168,6 +169,9 @@ static int latm_parse_sdp_line(AVFormatContext *s, int st_index,
{
const char *p;
+ if (st_index < 0)
+ return 0;
+
if (av_strstart(line, "fmtp:", &p))
return ff_parse_fmtp(s->streams[st_index], data, p, parse_fmtp);
@@ -177,7 +181,7 @@ static int latm_parse_sdp_line(AVFormatContext *s, int st_index,
RTPDynamicProtocolHandler ff_mp4a_latm_dynamic_handler = {
.enc_name = "MP4A-LATM",
.codec_type = AVMEDIA_TYPE_AUDIO,
- .codec_id = CODEC_ID_AAC,
+ .codec_id = AV_CODEC_ID_AAC,
.parse_sdp_a_line = latm_parse_sdp_line,
.alloc = latm_new_context,
.free = latm_free_context,
diff --git a/gst-libs/ext/libav/libavformat/rtpdec_mpeg4.c b/gst-libs/ext/libav/libavformat/rtpdec_mpeg4.c
index b143c1a..13d051a 100644
--- a/gst-libs/ext/libav/libavformat/rtpdec_mpeg4.c
+++ b/gst-libs/ext/libav/libavformat/rtpdec_mpeg4.c
@@ -1,4 +1,4 @@
-/**
+/*
* Common code for the RTP depacketization of MPEG-4 formats.
* Copyright (c) 2010 Fabrice Bellard
* Romain Degez
@@ -32,9 +32,8 @@
#include "libavutil/avstring.h"
#include "libavcodec/get_bits.h"
-/** Structure listing useful vars to parse RTP packet payload*/
-struct PayloadContext
-{
+/** Structure listing useful vars to parse RTP packet payload */
+struct PayloadContext {
int sizelength;
int indexlength;
int indexdeltalength;
@@ -69,8 +68,7 @@ typedef struct {
/* All known fmtp parameters and the corresponding RTPAttrTypeEnum */
#define ATTR_NAME_TYPE_INT 0
#define ATTR_NAME_TYPE_STR 1
-static const AttrNameMap attr_names[]=
-{
+static const AttrNameMap attr_names[] = {
{ "SizeLength", ATTR_NAME_TYPE_INT,
offsetof(PayloadContext, sizelength) },
{ "IndexLength", ATTR_NAME_TYPE_INT,
@@ -91,22 +89,14 @@ static PayloadContext *new_context(void)
return av_mallocz(sizeof(PayloadContext));
}
-static void free_context(PayloadContext * data)
+static void free_context(PayloadContext *data)
{
- int i;
- for (i = 0; i < data->nb_au_headers; i++) {
- /* according to rtp_parse_mp4_au, we treat multiple
- * au headers as one, so nb_au_headers is always 1.
- * loop anyway in case this changes.
- * (note: changes done carelessly might lead to a double free)
- */
- av_free(&data->au_headers[i]);
- }
+ av_free(data->au_headers);
av_free(data->mode);
av_free(data);
}
-static int parse_fmtp_config(AVCodecContext * codec, char *value)
+static int parse_fmtp_config(AVCodecContext *codec, char *value)
{
/* decode the hexa encoded parameter */
int len = ff_hex_to_data(NULL, value);
@@ -167,12 +157,10 @@ static int rtp_parse_mp4_au(PayloadContext *data, const uint8_t *buf)
/* Follows RFC 3640 */
-static int aac_parse_packet(AVFormatContext *ctx,
- PayloadContext *data,
- AVStream *st,
- AVPacket *pkt,
- uint32_t *timestamp,
- const uint8_t *buf, int len, int flags)
+static int aac_parse_packet(AVFormatContext *ctx, PayloadContext *data,
+ AVStream *st, AVPacket *pkt, uint32_t *timestamp,
+ const uint8_t *buf, int len, uint16_t seq,
+ int flags)
{
if (rtp_parse_mp4_au(data, buf))
return -1;
@@ -202,7 +190,7 @@ static int parse_fmtp(AVStream *stream, PayloadContext *data,
return res;
}
- if (codec->codec_id == CODEC_ID_AAC) {
+ if (codec->codec_id == AV_CODEC_ID_AAC) {
/* Looking for a known attribute */
for (i = 0; attr_names[i].str; ++i) {
if (!av_strcasecmp(attr, attr_names[i].str)) {
@@ -223,6 +211,9 @@ static int parse_sdp_line(AVFormatContext *s, int st_index,
{
const char *p;
+ if (st_index < 0)
+ return 0;
+
if (av_strstart(line, "fmtp:", &p))
return ff_parse_fmtp(s->streams[st_index], data, p, parse_fmtp);
@@ -232,14 +223,14 @@ static int parse_sdp_line(AVFormatContext *s, int st_index,
RTPDynamicProtocolHandler ff_mp4v_es_dynamic_handler = {
.enc_name = "MP4V-ES",
.codec_type = AVMEDIA_TYPE_VIDEO,
- .codec_id = CODEC_ID_MPEG4,
+ .codec_id = AV_CODEC_ID_MPEG4,
.parse_sdp_a_line = parse_sdp_line,
};
RTPDynamicProtocolHandler ff_mpeg4_generic_dynamic_handler = {
.enc_name = "mpeg4-generic",
.codec_type = AVMEDIA_TYPE_AUDIO,
- .codec_id = CODEC_ID_AAC,
+ .codec_id = AV_CODEC_ID_AAC,
.parse_sdp_a_line = parse_sdp_line,
.alloc = new_context,
.free = free_context,
diff --git a/gst-libs/ext/libav/libavformat/rtpdec_qcelp.c b/gst-libs/ext/libav/libavformat/rtpdec_qcelp.c
index 325683c..45a89ae 100644
--- a/gst-libs/ext/libav/libavformat/rtpdec_qcelp.c
+++ b/gst-libs/ext/libav/libavformat/rtpdec_qcelp.c
@@ -1,4 +1,4 @@
-/**
+/*
* RTP Depacketization of QCELP/PureVoice, RFC 2658
* Copyright (c) 2010 Martin Storsjo
*
@@ -210,7 +210,8 @@ static int return_stored_frame(AVFormatContext *ctx, PayloadContext *data,
static int qcelp_parse_packet(AVFormatContext *ctx, PayloadContext *data,
AVStream *st, AVPacket *pkt, uint32_t *timestamp,
- const uint8_t *buf, int len, int flags)
+ const uint8_t *buf, int len, uint16_t seq,
+ int flags)
{
if (buf)
return store_packet(ctx, data, st, pkt, timestamp, buf, len);
@@ -221,7 +222,7 @@ static int qcelp_parse_packet(AVFormatContext *ctx, PayloadContext *data,
RTPDynamicProtocolHandler ff_qcelp_dynamic_handler = {
.enc_name = "x-Purevoice",
.codec_type = AVMEDIA_TYPE_AUDIO,
- .codec_id = CODEC_ID_QCELP,
+ .codec_id = AV_CODEC_ID_QCELP,
.static_payload_id = 12,
.alloc = qcelp_new_context,
.free = qcelp_free_context,
diff --git a/gst-libs/ext/libav/libavformat/rtpdec_qdm2.c b/gst-libs/ext/libav/libavformat/rtpdec_qdm2.c
index 76b4c53..0d7b5bb 100644
--- a/gst-libs/ext/libav/libavformat/rtpdec_qdm2.c
+++ b/gst-libs/ext/libav/libavformat/rtpdec_qdm2.c
@@ -237,7 +237,8 @@ static int qdm2_restore_block(PayloadContext *qdm, AVStream *st, AVPacket *pkt)
static int qdm2_parse_packet(AVFormatContext *s, PayloadContext *qdm,
AVStream *st, AVPacket *pkt,
uint32_t *timestamp,
- const uint8_t *buf, int len, int flags)
+ const uint8_t *buf, int len, uint16_t seq,
+ int flags)
{
int res = AVERROR_INVALIDDATA, n;
const uint8_t *end = buf + len, *p = buf;
@@ -259,14 +260,14 @@ static int qdm2_parse_packet(AVFormatContext *s, PayloadContext *qdm,
return res;
p += res;
- /* We set codec_id to CODEC_ID_NONE initially to
+ /* We set codec_id to AV_CODEC_ID_NONE initially to
* delay decoder initialization since extradata is
* carried within the RTP stream, not SDP. Here,
- * by setting codec_id to CODEC_ID_QDM2, we are signalling
+ * by setting codec_id to AV_CODEC_ID_QDM2, we are signalling
* to the decoder that it is OK to initialize. */
- st->codec->codec_id = CODEC_ID_QDM2;
+ st->codec->codec_id = AV_CODEC_ID_QDM2;
}
- if (st->codec->codec_id == CODEC_ID_NONE)
+ if (st->codec->codec_id == AV_CODEC_ID_NONE)
return AVERROR(EAGAIN);
/* subpackets */
@@ -310,7 +311,7 @@ static void qdm2_extradata_free(PayloadContext *qdm)
RTPDynamicProtocolHandler ff_qdm2_dynamic_handler = {
.enc_name = "X-QDM",
.codec_type = AVMEDIA_TYPE_AUDIO,
- .codec_id = CODEC_ID_NONE,
+ .codec_id = AV_CODEC_ID_NONE,
.alloc = qdm2_extradata_new,
.free = qdm2_extradata_free,
.parse_packet = qdm2_parse_packet,
diff --git a/gst-libs/ext/libav/libavformat/rtpdec_qt.c b/gst-libs/ext/libav/libavformat/rtpdec_qt.c
index 1037154..6350507 100644
--- a/gst-libs/ext/libav/libavformat/rtpdec_qt.c
+++ b/gst-libs/ext/libav/libavformat/rtpdec_qt.c
@@ -42,7 +42,7 @@ struct PayloadContext {
static int qt_rtp_parse_packet(AVFormatContext *s, PayloadContext *qt,
AVStream *st, AVPacket *pkt,
uint32_t *timestamp, const uint8_t *buf,
- int len, int flags)
+ int len, uint16_t seq, int flags)
{
AVIOContext pb;
GetBitContext gb;
@@ -99,7 +99,7 @@ static int qt_rtp_parse_packet(AVFormatContext *s, PayloadContext *qt,
if (!is_start || !is_finish) {
av_log_missing_feature(s, "RTP-X-QT with payload description "
"split over several packets", 1);
- return AVERROR(ENOSYS);
+ return AVERROR_PATCHWELCOME;
}
skip_bits(&gb, 12); // reserved
data_len = get_bits(&gb, 16);
@@ -162,7 +162,7 @@ static int qt_rtp_parse_packet(AVFormatContext *s, PayloadContext *qt,
if (has_packet_info) {
av_log_missing_feature(s, "RTP-X-QT with packet specific info", 1);
- return AVERROR(ENOSYS);
+ return AVERROR_PATCHWELCOME;
}
alen = len - avio_tell(&pb);
@@ -225,7 +225,7 @@ static int qt_rtp_parse_packet(AVFormatContext *s, PayloadContext *qt,
default: /* unimplemented */
av_log_missing_feature(NULL, "RTP-X-QT with packing scheme 2", 1);
- return AVERROR(ENOSYS);
+ return AVERROR_PATCHWELCOME;
}
}
@@ -244,7 +244,7 @@ static void qt_rtp_free(PayloadContext *qt)
RTPDynamicProtocolHandler ff_ ## m ## _rtp_ ## n ## _handler = { \
.enc_name = s, \
.codec_type = t, \
- .codec_id = CODEC_ID_NONE, \
+ .codec_id = AV_CODEC_ID_NONE, \
.alloc = qt_rtp_new, \
.free = qt_rtp_free, \
.parse_packet = qt_rtp_parse_packet, \
diff --git a/gst-libs/ext/libav/libavformat/rtpdec_svq3.c b/gst-libs/ext/libav/libavformat/rtpdec_svq3.c
index 4df3e3a..aa880e5 100644
--- a/gst-libs/ext/libav/libavformat/rtpdec_svq3.c
+++ b/gst-libs/ext/libav/libavformat/rtpdec_svq3.c
@@ -41,7 +41,8 @@ struct PayloadContext {
static int svq3_parse_packet (AVFormatContext *s, PayloadContext *sv,
AVStream *st, AVPacket *pkt,
uint32_t *timestamp,
- const uint8_t *buf, int len, int flags)
+ const uint8_t *buf, int len, uint16_t seq,
+ int flags)
{
int config_packet, start_packet, end_packet;
@@ -68,12 +69,12 @@ static int svq3_parse_packet (AVFormatContext *s, PayloadContext *sv,
AV_WB32(st->codec->extradata + 4, len);
memcpy(st->codec->extradata + 8, buf, len);
- /* We set codec_id to CODEC_ID_NONE initially to
+ /* We set codec_id to AV_CODEC_ID_NONE initially to
* delay decoder initialization since extradata is
* carried within the RTP stream, not SDP. Here,
- * by setting codec_id to CODEC_ID_SVQ3, we are signalling
+ * by setting codec_id to AV_CODEC_ID_SVQ3, we are signalling
* to the decoder that it is OK to initialize. */
- st->codec->codec_id = CODEC_ID_SVQ3;
+ st->codec->codec_id = AV_CODEC_ID_SVQ3;
return AVERROR(EAGAIN);
}
@@ -97,12 +98,11 @@ static int svq3_parse_packet (AVFormatContext *s, PayloadContext *sv,
avio_write(sv->pktbuf, buf, len);
if (end_packet) {
- av_init_packet(pkt);
- pkt->stream_index = st->index;
+ int ret = ff_rtp_finalize_packet(pkt, &sv->pktbuf, st->index);
+ if (ret < 0)
+ return ret;
+
*timestamp = sv->timestamp;
- pkt->size = avio_close_dyn_buf(sv->pktbuf, &pkt->data);
- pkt->destruct = av_destruct_packet;
- sv->pktbuf = NULL;
return 0;
}
@@ -127,7 +127,7 @@ static void svq3_extradata_free(PayloadContext *sv)
RTPDynamicProtocolHandler ff_svq3_dynamic_handler = {
.enc_name = "X-SV3V-ES",
.codec_type = AVMEDIA_TYPE_VIDEO,
- .codec_id = CODEC_ID_NONE, // see if (config_packet) above
+ .codec_id = AV_CODEC_ID_NONE, // see if (config_packet) above
.alloc = svq3_extradata_new,
.free = svq3_extradata_free,
.parse_packet = svq3_parse_packet,
diff --git a/gst-libs/ext/libav/libavformat/rtpdec_vp8.c b/gst-libs/ext/libav/libavformat/rtpdec_vp8.c
index d13c398..18275a5 100644
--- a/gst-libs/ext/libav/libavformat/rtpdec_vp8.c
+++ b/gst-libs/ext/libav/libavformat/rtpdec_vp8.c
@@ -1,6 +1,7 @@
/*
* RTP VP8 Depacketizer
* Copyright (c) 2010 Josh Allmann
+ * Copyright (c) 2012 Martin Storsjo
*
* This file is part of Libav.
*
@@ -23,7 +24,7 @@
* @file
* @brief RTP support for the VP8 payload
* @author Josh Allmann <joshua.allmann@gmail.com>
- * @see http://www.webmproject.org/code/specs/rtp/
+ * @see http://tools.ietf.org/html/draft-ietf-payload-vp8-05
*/
#include "libavcodec/bytestream.h"
@@ -32,95 +33,216 @@
struct PayloadContext {
AVIOContext *data;
- uint32_t timestamp;
- int is_keyframe;
+ uint32_t timestamp;
+ int is_keyframe;
+ int sequence_ok;
+ int first_part_size;
+ uint16_t prev_seq;
+ int prev_pictureid;
+ int broken_frame;
};
-static void prepare_packet(AVPacket *pkt, PayloadContext *vp8, int stream)
+static void vp8_free_buffer(PayloadContext *vp8)
{
- av_init_packet(pkt);
- pkt->stream_index = stream;
- pkt->flags = vp8->is_keyframe ? AV_PKT_FLAG_KEY : 0;
- pkt->size = avio_close_dyn_buf(vp8->data, &pkt->data);
- pkt->destruct = av_destruct_packet;
- vp8->data = NULL;
+ uint8_t *tmp;
+ if (!vp8->data)
+ return;
+ avio_close_dyn_buf(vp8->data, &tmp);
+ av_free(tmp);
+ vp8->data = NULL;
}
-static int vp8_handle_packet(AVFormatContext *ctx,
- PayloadContext *vp8,
- AVStream *st,
- AVPacket *pkt,
- uint32_t *timestamp,
- const uint8_t *buf,
- int len, int flags)
+static int vp8_broken_sequence(AVFormatContext *ctx, PayloadContext *vp8,
+ const char *msg)
{
- int start_packet, end_packet, has_au, ret = AVERROR(EAGAIN);
+ vp8->sequence_ok = 0;
+ av_log(ctx, AV_LOG_WARNING, "%s", msg);
+ vp8_free_buffer(vp8);
+ return AVERROR(EAGAIN);
+}
+
+static int vp8_handle_packet(AVFormatContext *ctx, PayloadContext *vp8,
+ AVStream *st, AVPacket *pkt, uint32_t *timestamp,
+ const uint8_t *buf, int len, uint16_t seq,
+ int flags)
+{
+ int start_partition, end_packet;
+ int extended_bits, part_id;
+ int pictureid_present = 0, tl0picidx_present = 0, tid_present = 0,
+ keyidx_present = 0;
+ int pictureid = -1, pictureid_mask;
+ int returned_old_frame = 0;
+ uint32_t old_timestamp;
if (!buf) {
- // only called when vp8_handle_packet returns 1
- if (!vp8->data) {
- av_log(ctx, AV_LOG_ERROR, "Invalid VP8 data passed\n");
- return AVERROR_INVALIDDATA;
+ if (vp8->data) {
+ int ret = ff_rtp_finalize_packet(pkt, &vp8->data, st->index);
+ if (ret < 0)
+ return ret;
+ return 0;
}
- prepare_packet(pkt, vp8, st->index);
- *timestamp = vp8->timestamp;
- return 0;
+ return AVERROR(EAGAIN);
}
- start_packet = *buf & 1;
- end_packet = flags & RTP_FLAG_MARKER;
- has_au = *buf & 2;
+ if (len < 1)
+ return AVERROR_INVALIDDATA;
+
+ extended_bits = buf[0] & 0x80;
+ start_partition = buf[0] & 0x10;
+ part_id = buf[0] & 0x0f;
+ end_packet = flags & RTP_FLAG_MARKER;
buf++;
len--;
+ if (extended_bits) {
+ if (len < 1)
+ return AVERROR_INVALIDDATA;
+ pictureid_present = buf[0] & 0x80;
+ tl0picidx_present = buf[0] & 0x40;
+ tid_present = buf[0] & 0x20;
+ keyidx_present = buf[0] & 0x10;
+ buf++;
+ len--;
+ }
+ if (pictureid_present) {
+ if (len < 1)
+ return AVERROR_INVALIDDATA;
+ if (buf[0] & 0x80) {
+ if (len < 2)
+ return AVERROR_INVALIDDATA;
+ pictureid = AV_RB16(buf) & 0x7fff;
+ pictureid_mask = 0x7fff;
+ buf += 2;
+ len -= 2;
+ } else {
+ pictureid = buf[0] & 0x7f;
+ pictureid_mask = 0x7f;
+ buf++;
+ len--;
+ }
+ }
+ if (tl0picidx_present) {
+ // Ignoring temporal level zero index
+ buf++;
+ len--;
+ }
+ if (tid_present || keyidx_present) {
+ // Ignoring temporal layer index, layer sync bit and keyframe index
+ buf++;
+ len--;
+ }
+ if (len < 1)
+ return AVERROR_INVALIDDATA;
- if (start_packet) {
+ if (start_partition && part_id == 0 && len >= 3) {
int res;
- uint32_t ts = *timestamp;
- if (vp8->data) {
- // missing end marker; return old frame anyway. untested
- prepare_packet(pkt, vp8, st->index);
- *timestamp = vp8->timestamp; // reset timestamp from old frame
-
- // if current frame fits into one rtp packet, need to hold
- // that for the next av_get_packet call
- ret = end_packet ? 1 : 0;
+ int non_key = buf[0] & 0x01;
+ if (!non_key) {
+ vp8_free_buffer(vp8);
+ // Keyframe, decoding ok again
+ vp8->sequence_ok = 1;
+ } else {
+ int can_continue = vp8->data && !vp8->is_keyframe &&
+ avio_tell(vp8->data) >= vp8->first_part_size;
+ if (!vp8->sequence_ok)
+ return AVERROR(EAGAIN);
+ if (pictureid >= 0) {
+ if (pictureid != ((vp8->prev_pictureid + 1) & pictureid_mask)) {
+ return vp8_broken_sequence(ctx, vp8,
+ "Missed a picture, sequence broken\n");
+ } else {
+ if (vp8->data && !can_continue)
+ return vp8_broken_sequence(ctx, vp8,
+ "Missed a picture, sequence broken\n");
+ }
+ } else {
+ uint16_t expected_seq = vp8->prev_seq + 1;
+ int16_t diff = seq - expected_seq;
+ if (vp8->data) {
+ // No picture id, so we can't know if missed packets
+ // contained any new frames. If diff == 0, we did get
+ // later packets from the same frame (matching timestamp),
+ // so we know we didn't miss any frame. If diff == 1 and
+ // we still have data (not flushed by the end of frame
+ // marker), the single missed packet must have been part
+ // of the same frame.
+ if ((diff == 0 || diff == 1) && can_continue) {
+ // Proceed with what we have
+ } else {
+ return vp8_broken_sequence(ctx, vp8,
+ "Missed too much, sequence broken\n");
+ }
+ } else {
+ if (diff != 0)
+ return vp8_broken_sequence(ctx, vp8,
+ "Missed unknown data, sequence broken\n");
+ }
+ }
+ if (vp8->data) {
+ if (avio_tell(vp8->data) >= vp8->first_part_size) {
+ int ret = ff_rtp_finalize_packet(pkt, &vp8->data, st->index);
+ if (ret < 0)
+ return ret;
+ pkt->size = vp8->first_part_size;
+ returned_old_frame = 1;
+ old_timestamp = vp8->timestamp;
+ } else {
+ // Shouldn't happen
+ vp8_free_buffer(vp8);
+ }
+ }
}
+ vp8->first_part_size = (AV_RL16(&buf[1]) << 3 | buf[0] >> 5) + 3;
if ((res = avio_open_dyn_buf(&vp8->data)) < 0)
return res;
- vp8->is_keyframe = *buf & 1;
- vp8->timestamp = ts;
- }
+ vp8->timestamp = *timestamp;
+ vp8->broken_frame = 0;
+ vp8->prev_pictureid = pictureid;
+ vp8->is_keyframe = !non_key;
+ } else {
+ uint16_t expected_seq = vp8->prev_seq + 1;
- if (!vp8->data || vp8->timestamp != *timestamp && ret == AVERROR(EAGAIN)) {
- av_log(ctx, AV_LOG_WARNING,
- "Received no start marker; dropping frame\n");
- return AVERROR(EAGAIN);
- }
+ if (!vp8->sequence_ok)
+ return AVERROR(EAGAIN);
- // cycle through VP8AU headers if needed
- // not tested with actual VP8AUs
- while (len) {
- int au_len = len;
- if (has_au && len > 2) {
- au_len = AV_RB16(buf);
- buf += 2;
- len -= 2;
- if (buf + au_len > buf + len) {
- av_log(ctx, AV_LOG_ERROR, "Invalid VP8AU length\n");
- return AVERROR_INVALIDDATA;
- }
+ if (vp8->timestamp != *timestamp) {
+ // Missed the start of the new frame, sequence broken
+ vp8->sequence_ok = 0;
+ av_log(ctx, AV_LOG_WARNING,
+ "Received no start marker; dropping frame\n");
+ vp8_free_buffer(vp8);
+ return AVERROR(EAGAIN);
}
- avio_write(vp8->data, buf, au_len);
- buf += au_len;
- len -= au_len;
+ if (seq != expected_seq) {
+ if (vp8->is_keyframe) {
+ return vp8_broken_sequence(ctx, vp8,
+ "Missed part of a keyframe, sequence broken\n");
+ } else if (vp8->data && avio_tell(vp8->data) >= vp8->first_part_size) {
+ vp8->broken_frame = 1;
+ } else {
+ return vp8_broken_sequence(ctx, vp8,
+ "Missed part of the first partition, sequence broken\n");
+ }
+ }
}
- if (ret != AVERROR(EAGAIN)) // did we miss a end marker?
- return ret;
+ if (!vp8->data)
+ return vp8_broken_sequence(ctx, vp8, "Received no start marker\n");
+
+ vp8->prev_seq = seq;
+ avio_write(vp8->data, buf, len);
if (end_packet) {
- prepare_packet(pkt, vp8, st->index);
+ int ret;
+ if (returned_old_frame) {
+ *timestamp = old_timestamp;
+ return 1;
+ }
+ ret = ff_rtp_finalize_packet(pkt, &vp8->data, st->index);
+ if (ret < 0)
+ return ret;
+ if (vp8->broken_frame)
+ pkt->size = vp8->first_part_size;
return 0;
}
@@ -129,25 +251,19 @@ static int vp8_handle_packet(AVFormatContext *ctx,
static PayloadContext *vp8_new_context(void)
{
- av_log(NULL, AV_LOG_ERROR, "RTP VP8 payload implementation is incompatible "
- "with the latest spec drafts.\n");
return av_mallocz(sizeof(PayloadContext));
}
static void vp8_free_context(PayloadContext *vp8)
{
- if (vp8->data) {
- uint8_t *tmp;
- avio_close_dyn_buf(vp8->data, &tmp);
- av_free(tmp);
- }
+ vp8_free_buffer(vp8);
av_free(vp8);
}
RTPDynamicProtocolHandler ff_vp8_dynamic_handler = {
.enc_name = "VP8",
.codec_type = AVMEDIA_TYPE_VIDEO,
- .codec_id = CODEC_ID_VP8,
+ .codec_id = AV_CODEC_ID_VP8,
.alloc = vp8_new_context,
.free = vp8_free_context,
.parse_packet = vp8_handle_packet,
diff --git a/gst-libs/ext/libav/libavformat/rtpdec_xiph.c b/gst-libs/ext/libav/libavformat/rtpdec_xiph.c
index a7f36ef..db39462 100644
--- a/gst-libs/ext/libav/libavformat/rtpdec_xiph.c
+++ b/gst-libs/ext/libav/libavformat/rtpdec_xiph.c
@@ -70,12 +70,10 @@ static void xiph_free_context(PayloadContext * data)
av_free(data);
}
-static int xiph_handle_packet(AVFormatContext * ctx,
- PayloadContext * data,
- AVStream * st,
- AVPacket * pkt,
- uint32_t * timestamp,
- const uint8_t * buf, int len, int flags)
+static int xiph_handle_packet(AVFormatContext *ctx, PayloadContext *data,
+ AVStream *st, AVPacket *pkt, uint32_t *timestamp,
+ const uint8_t *buf, int len, uint16_t seq,
+ int flags)
{
int ident, fragmented, tdt, num_pkts, pkt_len;
@@ -202,20 +200,13 @@ static int xiph_handle_packet(AVFormatContext * ctx,
if (fragmented == 3) {
// end of xiph data packet
- av_init_packet(pkt);
- pkt->size = avio_close_dyn_buf(data->fragment, &pkt->data);
-
- if (pkt->size < 0) {
+ int ret = ff_rtp_finalize_packet(pkt, &data->fragment, st->index);
+ if (ret < 0) {
av_log(ctx, AV_LOG_ERROR,
"Error occurred when getting fragment buffer.");
- return pkt->size;
+ return ret;
}
- pkt->stream_index = st->index;
- pkt->destruct = av_destruct_packet;
-
- data->fragment = NULL;
-
return 0;
}
}
@@ -243,7 +234,7 @@ static int get_base128(const uint8_t ** buf, const uint8_t * buf_end)
/**
* Based off parse_packed_headers in Vorbis RTP
*/
-static unsigned int
+static int
parse_packed_headers(const uint8_t * packed_headers,
const uint8_t * packed_headers_end,
AVCodecContext * codec, PayloadContext * xiph_data)
@@ -313,11 +304,11 @@ static int xiph_parse_fmtp_pair(AVStream* stream,
if (!strcmp(attr, "sampling")) {
if (!strcmp(value, "YCbCr-4:2:0")) {
- codec->pix_fmt = PIX_FMT_YUV420P;
+ codec->pix_fmt = AV_PIX_FMT_YUV420P;
} else if (!strcmp(value, "YCbCr-4:4:2")) {
- codec->pix_fmt = PIX_FMT_YUV422P;
+ codec->pix_fmt = AV_PIX_FMT_YUV422P;
} else if (!strcmp(value, "YCbCr-4:4:4")) {
- codec->pix_fmt = PIX_FMT_YUV444P;
+ codec->pix_fmt = AV_PIX_FMT_YUV444P;
} else {
av_log(codec, AV_LOG_ERROR,
"Unsupported pixel format %s\n", attr);
@@ -372,10 +363,13 @@ static int xiph_parse_fmtp_pair(AVStream* stream,
}
static int xiph_parse_sdp_line(AVFormatContext *s, int st_index,
- PayloadContext *data, const char *line)
+ PayloadContext *data, const char *line)
{
const char *p;
+ if (st_index < 0)
+ return 0;
+
if (av_strstart(line, "fmtp:", &p)) {
return ff_parse_fmtp(s->streams[st_index], data, p,
xiph_parse_fmtp_pair);
@@ -387,7 +381,7 @@ static int xiph_parse_sdp_line(AVFormatContext *s, int st_index,
RTPDynamicProtocolHandler ff_theora_dynamic_handler = {
.enc_name = "theora",
.codec_type = AVMEDIA_TYPE_VIDEO,
- .codec_id = CODEC_ID_THEORA,
+ .codec_id = AV_CODEC_ID_THEORA,
.parse_sdp_a_line = xiph_parse_sdp_line,
.alloc = xiph_new_context,
.free = xiph_free_context,
@@ -397,7 +391,7 @@ RTPDynamicProtocolHandler ff_theora_dynamic_handler = {
RTPDynamicProtocolHandler ff_vorbis_dynamic_handler = {
.enc_name = "vorbis",
.codec_type = AVMEDIA_TYPE_AUDIO,
- .codec_id = CODEC_ID_VORBIS,
+ .codec_id = AV_CODEC_ID_VORBIS,
.parse_sdp_a_line = xiph_parse_sdp_line,
.alloc = xiph_new_context,
.free = xiph_free_context,
diff --git a/gst-libs/ext/libav/libavformat/rtpenc.c b/gst-libs/ext/libav/libavformat/rtpenc.c
index 1f036a6..0f5307d 100644
--- a/gst-libs/ext/libav/libavformat/rtpenc.c
+++ b/gst-libs/ext/libav/libavformat/rtpenc.c
@@ -32,7 +32,9 @@
static const AVOption options[] = {
FF_RTP_FLAG_OPTS(RTPMuxContext, flags),
- { "payload_type", "Specify RTP payload type", offsetof(RTPMuxContext, payload_type), AV_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, {.i64 = -1 }, -1, 127, AV_OPT_FLAG_ENCODING_PARAM },
+ { "ssrc", "Stream identifier", offsetof(RTPMuxContext, ssrc), AV_OPT_TYPE_INT, { .i64 = 0 }, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM },
+ { "cname", "CNAME to include in RTCP SR packets", offsetof(RTPMuxContext, cname), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, AV_OPT_FLAG_ENCODING_PARAM },
{ NULL },
};
@@ -45,34 +47,38 @@ static const AVClass rtp_muxer_class = {
#define RTCP_SR_SIZE 28
-static int is_supported(enum CodecID id)
+static int is_supported(enum AVCodecID id)
{
switch(id) {
- case CODEC_ID_H263:
- case CODEC_ID_H263P:
- case CODEC_ID_H264:
- case CODEC_ID_MPEG1VIDEO:
- case CODEC_ID_MPEG2VIDEO:
- case CODEC_ID_MPEG4:
- case CODEC_ID_AAC:
- case CODEC_ID_MP2:
- case CODEC_ID_MP3:
- case CODEC_ID_PCM_ALAW:
- case CODEC_ID_PCM_MULAW:
- case CODEC_ID_PCM_S8:
- case CODEC_ID_PCM_S16BE:
- case CODEC_ID_PCM_S16LE:
- case CODEC_ID_PCM_U16BE:
- case CODEC_ID_PCM_U16LE:
- case CODEC_ID_PCM_U8:
- case CODEC_ID_MPEG2TS:
- case CODEC_ID_AMR_NB:
- case CODEC_ID_AMR_WB:
- case CODEC_ID_VORBIS:
- case CODEC_ID_THEORA:
- case CODEC_ID_VP8:
- case CODEC_ID_ADPCM_G722:
- case CODEC_ID_ADPCM_G726:
+ case AV_CODEC_ID_H263:
+ case AV_CODEC_ID_H263P:
+ case AV_CODEC_ID_H264:
+ case AV_CODEC_ID_MPEG1VIDEO:
+ case AV_CODEC_ID_MPEG2VIDEO:
+ case AV_CODEC_ID_MPEG4:
+ case AV_CODEC_ID_AAC:
+ case AV_CODEC_ID_MP2:
+ case AV_CODEC_ID_MP3:
+ case AV_CODEC_ID_PCM_ALAW:
+ case AV_CODEC_ID_PCM_MULAW:
+ case AV_CODEC_ID_PCM_S8:
+ case AV_CODEC_ID_PCM_S16BE:
+ case AV_CODEC_ID_PCM_S16LE:
+ case AV_CODEC_ID_PCM_U16BE:
+ case AV_CODEC_ID_PCM_U16LE:
+ case AV_CODEC_ID_PCM_U8:
+ case AV_CODEC_ID_MPEG2TS:
+ case AV_CODEC_ID_AMR_NB:
+ case AV_CODEC_ID_AMR_WB:
+ case AV_CODEC_ID_VORBIS:
+ case AV_CODEC_ID_THEORA:
+ case AV_CODEC_ID_VP8:
+ case AV_CODEC_ID_ADPCM_G722:
+ case AV_CODEC_ID_ADPCM_G726:
+ case AV_CODEC_ID_ILBC:
+ case AV_CODEC_ID_MJPEG:
+ case AV_CODEC_ID_SPEEX:
+ case AV_CODEC_ID_OPUS:
return 1;
default:
return 0;
@@ -82,11 +88,13 @@ static int is_supported(enum CodecID id)
static int rtp_write_header(AVFormatContext *s1)
{
RTPMuxContext *s = s1->priv_data;
- int max_packet_size, n;
+ int n;
AVStream *st;
- if (s1->nb_streams != 1)
- return -1;
+ if (s1->nb_streams != 1) {
+ av_log(s1, AV_LOG_ERROR, "Only one stream supported in the RTP muxer\n");
+ return AVERROR(EINVAL);
+ }
st = s1->streams[0];
if (!is_supported(st->codec->codec_id)) {
av_log(s1, AV_LOG_ERROR, "Unsupported codec %x\n", st->codec->codec_id);
@@ -94,12 +102,22 @@ static int rtp_write_header(AVFormatContext *s1)
return -1;
}
- if (s->payload_type < 0)
- s->payload_type = ff_rtp_get_payload_type(s1, st->codec);
+ if (s->payload_type < 0) {
+ /* Re-validate non-dynamic payload types */
+ if (st->id < RTP_PT_PRIVATE)
+ st->id = ff_rtp_get_payload_type(s1, st->codec, -1);
+
+ s->payload_type = st->id;
+ } else {
+ /* private option takes priority */
+ st->id = s->payload_type;
+ }
+
s->base_timestamp = av_get_random_seed();
s->timestamp = s->base_timestamp;
s->cur_timestamp = 0;
- s->ssrc = av_get_random_seed();
+ if (!s->ssrc)
+ s->ssrc = av_get_random_seed();
s->first_packet = 1;
s->first_rtcp_ntp_time = ff_ntp_time();
if (s1->start_time_realtime)
@@ -107,22 +125,36 @@ static int rtp_write_header(AVFormatContext *s1)
s->first_rtcp_ntp_time = (s1->start_time_realtime / 1000) * 1000 +
NTP_OFFSET_US;
- max_packet_size = s1->pb->max_packet_size;
- if (max_packet_size <= 12)
+ if (s1->packet_size) {
+ if (s1->pb->max_packet_size)
+ s1->packet_size = FFMIN(s1->packet_size,
+ s1->pb->max_packet_size);
+ } else
+ s1->packet_size = s1->pb->max_packet_size;
+ if (s1->packet_size <= 12) {
+ av_log(s1, AV_LOG_ERROR, "Max packet size %d too low\n", s1->packet_size);
return AVERROR(EIO);
- s->buf = av_malloc(max_packet_size);
+ }
+ s->buf = av_malloc(s1->packet_size);
if (s->buf == NULL) {
return AVERROR(ENOMEM);
}
- s->max_payload_size = max_packet_size - 12;
+ s->max_payload_size = s1->packet_size - 12;
s->max_frames_per_packet = 0;
- if (s1->max_delay) {
+ if (s1->max_delay > 0) {
if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO) {
- if (st->codec->frame_size == 0) {
+ int frame_size = av_get_audio_frame_duration(st->codec, 0);
+ if (!frame_size)
+ frame_size = st->codec->frame_size;
+ if (frame_size == 0) {
av_log(s1, AV_LOG_ERROR, "Cannot respect max delay: frame size = 0\n");
} else {
- s->max_frames_per_packet = av_rescale_rnd(s1->max_delay, st->codec->sample_rate, AV_TIME_BASE * (int64_t)st->codec->frame_size, AV_ROUND_DOWN);
+ s->max_frames_per_packet =
+ av_rescale_q_rnd(s1->max_delay,
+ AV_TIME_BASE_Q,
+ (AVRational){ frame_size, st->codec->sample_rate },
+ AV_ROUND_DOWN);
}
}
if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
@@ -133,60 +165,76 @@ static int rtp_write_header(AVFormatContext *s1)
avpriv_set_pts_info(st, 32, 1, 90000);
switch(st->codec->codec_id) {
- case CODEC_ID_MP2:
- case CODEC_ID_MP3:
+ case AV_CODEC_ID_MP2:
+ case AV_CODEC_ID_MP3:
s->buf_ptr = s->buf + 4;
break;
- case CODEC_ID_MPEG1VIDEO:
- case CODEC_ID_MPEG2VIDEO:
+ case AV_CODEC_ID_MPEG1VIDEO:
+ case AV_CODEC_ID_MPEG2VIDEO:
break;
- case CODEC_ID_MPEG2TS:
+ case AV_CODEC_ID_MPEG2TS:
n = s->max_payload_size / TS_PACKET_SIZE;
if (n < 1)
n = 1;
s->max_payload_size = n * TS_PACKET_SIZE;
s->buf_ptr = s->buf;
break;
- case CODEC_ID_H264:
+ case AV_CODEC_ID_H264:
/* check for H.264 MP4 syntax */
if (st->codec->extradata_size > 4 && st->codec->extradata[0] == 1) {
s->nal_length_size = (st->codec->extradata[4] & 0x03) + 1;
}
break;
- case CODEC_ID_VORBIS:
- case CODEC_ID_THEORA:
+ case AV_CODEC_ID_VORBIS:
+ case AV_CODEC_ID_THEORA:
if (!s->max_frames_per_packet) s->max_frames_per_packet = 15;
s->max_frames_per_packet = av_clip(s->max_frames_per_packet, 1, 15);
s->max_payload_size -= 6; // ident+frag+tdt/vdt+pkt_num+pkt_length
s->num_frames = 0;
goto defaultcase;
- case CODEC_ID_VP8:
- av_log(s1, AV_LOG_ERROR, "RTP VP8 payload implementation is "
- "incompatible with the latest spec drafts.\n");
- break;
- case CODEC_ID_ADPCM_G722:
+ case AV_CODEC_ID_ADPCM_G722:
/* Due to a historical error, the clock rate for G722 in RTP is
* 8000, even if the sample rate is 16000. See RFC 3551. */
avpriv_set_pts_info(st, 32, 1, 8000);
break;
- case CODEC_ID_AMR_NB:
- case CODEC_ID_AMR_WB:
+ case AV_CODEC_ID_OPUS:
+ if (st->codec->channels > 2) {
+ av_log(s1, AV_LOG_ERROR, "Multistream opus not supported in RTP\n");
+ goto fail;
+ }
+ /* The opus RTP RFC says that all opus streams should use 48000 Hz
+ * as clock rate, since all opus sample rates can be expressed in
+ * this clock rate, and sample rate changes on the fly are supported. */
+ avpriv_set_pts_info(st, 32, 1, 48000);
+ break;
+ case AV_CODEC_ID_ILBC:
+ if (st->codec->block_align != 38 && st->codec->block_align != 50) {
+ av_log(s1, AV_LOG_ERROR, "Incorrect iLBC block size specified\n");
+ goto fail;
+ }
+ if (!s->max_frames_per_packet)
+ s->max_frames_per_packet = 1;
+ s->max_frames_per_packet = FFMIN(s->max_frames_per_packet,
+ s->max_payload_size / st->codec->block_align);
+ goto defaultcase;
+ case AV_CODEC_ID_AMR_NB:
+ case AV_CODEC_ID_AMR_WB:
if (!s->max_frames_per_packet)
s->max_frames_per_packet = 12;
- if (st->codec->codec_id == CODEC_ID_AMR_NB)
+ if (st->codec->codec_id == AV_CODEC_ID_AMR_NB)
n = 31;
else
n = 61;
/* max_header_toc_size + the largest AMR payload must fit */
if (1 + s->max_frames_per_packet + n > s->max_payload_size) {
av_log(s1, AV_LOG_ERROR, "RTP max payload size too small for AMR\n");
- return -1;
+ goto fail;
}
if (st->codec->channels != 1) {
av_log(s1, AV_LOG_ERROR, "Only mono is supported\n");
- return -1;
+ goto fail;
}
- case CODEC_ID_AAC:
+ case AV_CODEC_ID_AAC:
s->num_frames = 0;
default:
defaultcase:
@@ -198,6 +246,10 @@ defaultcase:
}
return 0;
+
+fail:
+ av_freep(&s->buf);
+ return AVERROR(EINVAL);
}
/* send an rtcp sender report packet */
@@ -220,6 +272,22 @@ static void rtcp_send_sr(AVFormatContext *s1, int64_t ntp_time)
avio_wb32(s1->pb, rtp_ts);
avio_wb32(s1->pb, s->packet_count);
avio_wb32(s1->pb, s->octet_count);
+
+ if (s->cname) {
+ int len = FFMIN(strlen(s->cname), 255);
+ avio_w8(s1->pb, (RTP_VERSION << 6) + 1);
+ avio_w8(s1->pb, RTCP_SDES);
+ avio_wb16(s1->pb, (7 + len + 3) / 4); /* length in words - 1 */
+
+ avio_wb32(s1->pb, s->ssrc);
+ avio_w8(s1->pb, 0x01); /* CNAME */
+ avio_w8(s1->pb, len);
+ avio_write(s1->pb, s->cname, len);
+ avio_w8(s1->pb, 0); /* END */
+ for (len = (7 + len) % 4; len % 4; len++)
+ avio_w8(s1->pb, 0);
+ }
+
avio_flush(s1->pb);
}
@@ -248,8 +316,8 @@ void ff_rtp_send_data(AVFormatContext *s1, const uint8_t *buf1, int len, int m)
/* send an integer number of samples and compute time stamp and fill
the rtp send buffer before sending. */
-static void rtp_send_samples(AVFormatContext *s1,
- const uint8_t *buf1, int size, int sample_size_bits)
+static int rtp_send_samples(AVFormatContext *s1,
+ const uint8_t *buf1, int size, int sample_size_bits)
{
RTPMuxContext *s = s1->priv_data;
int len, max_packet_size, n;
@@ -259,7 +327,7 @@ static void rtp_send_samples(AVFormatContext *s1,
max_packet_size = (s->max_payload_size / aligned_samples_size) * aligned_samples_size;
/* Not needed, but who knows. Don't check if samples aren't an even number of bytes. */
if ((sample_size_bits % 8) == 0 && ((8 * size) % sample_size_bits) != 0)
- av_abort();
+ return AVERROR(EINVAL);
n = 0;
while (size > 0) {
s->buf_ptr = s->buf;
@@ -274,6 +342,7 @@ static void rtp_send_samples(AVFormatContext *s1,
ff_rtp_send_data(s1, s->buf, s->buf_ptr - s->buf, 0);
n += (s->buf_ptr - s->buf);
}
+ return 0;
}
static void rtp_send_mpegaudio(AVFormatContext *s1,
@@ -373,6 +442,36 @@ static void rtp_send_mpegts_raw(AVFormatContext *s1,
}
}
+static int rtp_send_ilbc(AVFormatContext *s1, const uint8_t *buf, int size)
+{
+ RTPMuxContext *s = s1->priv_data;
+ AVStream *st = s1->streams[0];
+ int frame_duration = av_get_audio_frame_duration(st->codec, 0);
+ int frame_size = st->codec->block_align;
+ int frames = size / frame_size;
+
+ while (frames > 0) {
+ int n = FFMIN(s->max_frames_per_packet - s->num_frames, frames);
+
+ if (!s->num_frames) {
+ s->buf_ptr = s->buf;
+ s->timestamp = s->cur_timestamp;
+ }
+ memcpy(s->buf_ptr, buf, n * frame_size);
+ frames -= n;
+ s->num_frames += n;
+ s->buf_ptr += n * frame_size;
+ buf += n * frame_size;
+ s->cur_timestamp += n * frame_duration;
+
+ if (s->num_frames == s->max_frames_per_packet) {
+ ff_rtp_send_data(s1, s->buf, s->buf_ptr - s->buf, 1);
+ s->num_frames = 0;
+ }
+ }
+ return 0;
+}
+
static int rtp_write_packet(AVFormatContext *s1, AVPacket *pkt)
{
RTPMuxContext *s = s1->priv_data;
@@ -384,8 +483,9 @@ static int rtp_write_packet(AVFormatContext *s1, AVPacket *pkt)
rtcp_bytes = ((s->octet_count - s->last_octet_count) * RTCP_TX_RATIO_NUM) /
RTCP_TX_RATIO_DEN;
- if (s->first_packet || ((rtcp_bytes >= RTCP_SR_SIZE) &&
- (ff_ntp_time() - s->last_rtcp_ntp_time > 5000000))) {
+ if ((s->first_packet || ((rtcp_bytes >= RTCP_SR_SIZE) &&
+ (ff_ntp_time() - s->last_rtcp_ntp_time > 5000000))) &&
+ !(s->flags & FF_RTP_FLAG_SKIP_RTCP)) {
rtcp_send_sr(s1, ff_ntp_time());
s->last_octet_count = s->octet_count;
s->first_packet = 0;
@@ -393,64 +493,83 @@ static int rtp_write_packet(AVFormatContext *s1, AVPacket *pkt)
s->cur_timestamp = s->base_timestamp + pkt->pts;
switch(st->codec->codec_id) {
- case CODEC_ID_PCM_MULAW:
- case CODEC_ID_PCM_ALAW:
- case CODEC_ID_PCM_U8:
- case CODEC_ID_PCM_S8:
- rtp_send_samples(s1, pkt->data, size, 8 * st->codec->channels);
- break;
- case CODEC_ID_PCM_U16BE:
- case CODEC_ID_PCM_U16LE:
- case CODEC_ID_PCM_S16BE:
- case CODEC_ID_PCM_S16LE:
- rtp_send_samples(s1, pkt->data, size, 16 * st->codec->channels);
- break;
- case CODEC_ID_ADPCM_G722:
+ case AV_CODEC_ID_PCM_MULAW:
+ case AV_CODEC_ID_PCM_ALAW:
+ case AV_CODEC_ID_PCM_U8:
+ case AV_CODEC_ID_PCM_S8:
+ return rtp_send_samples(s1, pkt->data, size, 8 * st->codec->channels);
+ case AV_CODEC_ID_PCM_U16BE:
+ case AV_CODEC_ID_PCM_U16LE:
+ case AV_CODEC_ID_PCM_S16BE:
+ case AV_CODEC_ID_PCM_S16LE:
+ return rtp_send_samples(s1, pkt->data, size, 16 * st->codec->channels);
+ case AV_CODEC_ID_ADPCM_G722:
/* The actual sample size is half a byte per sample, but since the
* stream clock rate is 8000 Hz while the sample rate is 16000 Hz,
* the correct parameter for send_samples_bits is 8 bits per stream
* clock. */
- rtp_send_samples(s1, pkt->data, size, 8 * st->codec->channels);
- break;
- case CODEC_ID_ADPCM_G726:
- rtp_send_samples(s1, pkt->data, size,
- st->codec->bits_per_coded_sample * st->codec->channels);
- break;
- case CODEC_ID_MP2:
- case CODEC_ID_MP3:
+ return rtp_send_samples(s1, pkt->data, size, 8 * st->codec->channels);
+ case AV_CODEC_ID_ADPCM_G726:
+ return rtp_send_samples(s1, pkt->data, size,
+ st->codec->bits_per_coded_sample * st->codec->channels);
+ case AV_CODEC_ID_MP2:
+ case AV_CODEC_ID_MP3:
rtp_send_mpegaudio(s1, pkt->data, size);
break;
- case CODEC_ID_MPEG1VIDEO:
- case CODEC_ID_MPEG2VIDEO:
+ case AV_CODEC_ID_MPEG1VIDEO:
+ case AV_CODEC_ID_MPEG2VIDEO:
ff_rtp_send_mpegvideo(s1, pkt->data, size);
break;
- case CODEC_ID_AAC:
+ case AV_CODEC_ID_AAC:
if (s->flags & FF_RTP_FLAG_MP4A_LATM)
ff_rtp_send_latm(s1, pkt->data, size);
else
ff_rtp_send_aac(s1, pkt->data, size);
break;
- case CODEC_ID_AMR_NB:
- case CODEC_ID_AMR_WB:
+ case AV_CODEC_ID_AMR_NB:
+ case AV_CODEC_ID_AMR_WB:
ff_rtp_send_amr(s1, pkt->data, size);
break;
- case CODEC_ID_MPEG2TS:
+ case AV_CODEC_ID_MPEG2TS:
rtp_send_mpegts_raw(s1, pkt->data, size);
break;
- case CODEC_ID_H264:
+ case AV_CODEC_ID_H264:
ff_rtp_send_h264(s1, pkt->data, size);
break;
- case CODEC_ID_H263:
- case CODEC_ID_H263P:
+ case AV_CODEC_ID_H263:
+ if (s->flags & FF_RTP_FLAG_RFC2190) {
+ int mb_info_size = 0;
+ const uint8_t *mb_info =
+ av_packet_get_side_data(pkt, AV_PKT_DATA_H263_MB_INFO,
+ &mb_info_size);
+ ff_rtp_send_h263_rfc2190(s1, pkt->data, size, mb_info, mb_info_size);
+ break;
+ }
+ /* Fallthrough */
+ case AV_CODEC_ID_H263P:
ff_rtp_send_h263(s1, pkt->data, size);
break;
- case CODEC_ID_VORBIS:
- case CODEC_ID_THEORA:
+ case AV_CODEC_ID_VORBIS:
+ case AV_CODEC_ID_THEORA:
ff_rtp_send_xiph(s1, pkt->data, size);
break;
- case CODEC_ID_VP8:
+ case AV_CODEC_ID_VP8:
ff_rtp_send_vp8(s1, pkt->data, size);
break;
+ case AV_CODEC_ID_ILBC:
+ rtp_send_ilbc(s1, pkt->data, size);
+ break;
+ case AV_CODEC_ID_MJPEG:
+ ff_rtp_send_jpeg(s1, pkt->data, size);
+ break;
+ case AV_CODEC_ID_OPUS:
+ if (size > s->max_payload_size) {
+ av_log(s1, AV_LOG_ERROR,
+ "Packet size %d too large for max RTP payload size %d\n",
+ size, s->max_payload_size);
+ return AVERROR(EINVAL);
+ }
+ /* Intentional fallthrough */
default:
/* better than nothing : send the codec raw data */
rtp_send_raw(s1, pkt->data, size);
@@ -470,12 +589,12 @@ static int rtp_write_trailer(AVFormatContext *s1)
AVOutputFormat ff_rtp_muxer = {
.name = "rtp",
- .long_name = NULL_IF_CONFIG_SMALL("RTP output format"),
+ .long_name = NULL_IF_CONFIG_SMALL("RTP output"),
.priv_data_size = sizeof(RTPMuxContext),
- .audio_codec = CODEC_ID_PCM_MULAW,
- .video_codec = CODEC_ID_MPEG4,
+ .audio_codec = AV_CODEC_ID_PCM_MULAW,
+ .video_codec = AV_CODEC_ID_MPEG4,
.write_header = rtp_write_header,
.write_packet = rtp_write_packet,
.write_trailer = rtp_write_trailer,
- .priv_class = &rtp_muxer_class,
+ .priv_class = &rtp_muxer_class,
};
diff --git a/gst-libs/ext/libav/libavformat/rtpenc.h b/gst-libs/ext/libav/libavformat/rtpenc.h
index 72d7f65..f797348 100644
--- a/gst-libs/ext/libav/libavformat/rtpenc.h
+++ b/gst-libs/ext/libav/libavformat/rtpenc.h
@@ -30,6 +30,7 @@ struct RTPMuxContext {
AVStream *st;
int payload_type;
uint32_t ssrc;
+ const char *cname;
uint16_t seq;
uint32_t timestamp;
uint32_t base_timestamp;
@@ -38,13 +39,13 @@ struct RTPMuxContext {
int num_frames;
/* rtcp sender statistics receive */
- int64_t last_rtcp_ntp_time; // TODO: move into statistics
- int64_t first_rtcp_ntp_time; // TODO: move into statistics
+ int64_t last_rtcp_ntp_time;
+ int64_t first_rtcp_ntp_time;
/* rtcp sender statistics */
- unsigned int packet_count; // TODO: move into statistics (outgoing)
- unsigned int octet_count; // TODO: move into statistics (outgoing)
- unsigned int last_octet_count; // TODO: move into statistics (outgoing)
+ unsigned int packet_count;
+ unsigned int octet_count;
+ unsigned int last_octet_count;
int first_packet;
/* buffer for output */
uint8_t *buf;
@@ -59,25 +60,39 @@ struct RTPMuxContext {
int nal_length_size;
int flags;
+
+ unsigned int frame_count;
};
typedef struct RTPMuxContext RTPMuxContext;
#define FF_RTP_FLAG_MP4A_LATM 1
+#define FF_RTP_FLAG_RFC2190 2
+#define FF_RTP_FLAG_SKIP_RTCP 4
+#define FF_RTP_FLAG_H264_MODE0 8
#define FF_RTP_FLAG_OPTS(ctx, fieldname) \
- { "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" } \
+ { "rtpflags", "RTP muxer flags", offsetof(ctx, fieldname), AV_OPT_TYPE_FLAGS, {.i64 = 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, {.i64 = FF_RTP_FLAG_MP4A_LATM}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "rtpflags" }, \
+ { "rfc2190", "Use RFC 2190 packetization instead of RFC 4629 for H.263", 0, AV_OPT_TYPE_CONST, {.i64 = FF_RTP_FLAG_RFC2190}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "rtpflags" }, \
+ { "skip_rtcp", "Don't send RTCP sender reports", 0, AV_OPT_TYPE_CONST, {.i64 = FF_RTP_FLAG_SKIP_RTCP}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "rtpflags" }, \
+ { "h264_mode0", "Use mode 0 for H264 in RTP", 0, AV_OPT_TYPE_CONST, {.i64 = FF_RTP_FLAG_H264_MODE0}, 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);
void ff_rtp_send_h264(AVFormatContext *s1, const uint8_t *buf1, int size);
void ff_rtp_send_h263(AVFormatContext *s1, const uint8_t *buf1, int size);
+void ff_rtp_send_h263_rfc2190(AVFormatContext *s1, const uint8_t *buf1, int size,
+ const uint8_t *mb_info, int mb_info_size);
void ff_rtp_send_aac(AVFormatContext *s1, const uint8_t *buff, int size);
void ff_rtp_send_latm(AVFormatContext *s1, const uint8_t *buff, int size);
void ff_rtp_send_amr(AVFormatContext *s1, const uint8_t *buff, int size);
void ff_rtp_send_mpegvideo(AVFormatContext *s1, const uint8_t *buf1, int size);
void ff_rtp_send_xiph(AVFormatContext *s1, const uint8_t *buff, int size);
void ff_rtp_send_vp8(AVFormatContext *s1, const uint8_t *buff, int size);
+void ff_rtp_send_jpeg(AVFormatContext *s1, const uint8_t *buff, int size);
+
+const uint8_t *ff_h263_find_resync_marker_reverse(const uint8_t *restrict start,
+ const uint8_t *restrict end);
#endif /* AVFORMAT_RTPENC_H */
diff --git a/gst-libs/ext/libav/libavformat/rtpenc_aac.c b/gst-libs/ext/libav/libavformat/rtpenc_aac.c
index 86318df..1b2fa0a 100644
--- a/gst-libs/ext/libav/libavformat/rtpenc_aac.c
+++ b/gst-libs/ext/libav/libavformat/rtpenc_aac.c
@@ -47,8 +47,8 @@ void ff_rtp_send_aac(AVFormatContext *s1, const uint8_t *buff, int size)
memmove(p + 2, s->buf + 2, au_size);
}
/* Write the AU header size */
- p[0] = ((au_size * 8) & 0xFF) >> 8;
- p[1] = (au_size * 8) & 0xFF;
+ p[0] = au_size >> 5;
+ p[1] = (au_size & 0x1F) << 3;
ff_rtp_send_data(s1, p, s->buf_ptr - p, 1);
diff --git a/gst-libs/ext/libav/libavformat/rtpenc_amr.c b/gst-libs/ext/libav/libavformat/rtpenc_amr.c
index 4da7ace..73da8c8 100644
--- a/gst-libs/ext/libav/libavformat/rtpenc_amr.c
+++ b/gst-libs/ext/libav/libavformat/rtpenc_amr.c
@@ -63,4 +63,3 @@ void ff_rtp_send_amr(AVFormatContext *s1, const uint8_t *buff, int size)
memcpy(s->buf_ptr, buff, size);
s->buf_ptr += size;
}
-
diff --git a/gst-libs/ext/libav/libavformat/rtpenc_chain.c b/gst-libs/ext/libav/libavformat/rtpenc_chain.c
index b9d1690..935dd6c 100644
--- a/gst-libs/ext/libav/libavformat/rtpenc_chain.c
+++ b/gst-libs/ext/libav/libavformat/rtpenc_chain.c
@@ -23,29 +23,35 @@
#include "avio_internal.h"
#include "rtpenc_chain.h"
#include "avio_internal.h"
+#include "rtp.h"
#include "libavutil/opt.h"
-AVFormatContext *ff_rtp_chain_mux_open(AVFormatContext *s, AVStream *st,
- URLContext *handle, int packet_size)
+int ff_rtp_chain_mux_open(AVFormatContext **out, AVFormatContext *s,
+ AVStream *st, URLContext *handle, int packet_size,
+ int idx)
{
- AVFormatContext *rtpctx;
+ AVFormatContext *rtpctx = NULL;
int ret;
AVOutputFormat *rtp_format = av_guess_format("rtp", NULL, NULL);
uint8_t *rtpflags;
AVDictionary *opts = NULL;
- if (!rtp_format)
- return NULL;
+ if (!rtp_format) {
+ ret = AVERROR(ENOSYS);
+ goto fail;
+ }
/* Allocate an AVFormatContext for each output stream */
rtpctx = avformat_alloc_context();
- if (!rtpctx)
- return NULL;
+ if (!rtpctx) {
+ ret = AVERROR(ENOMEM);
+ goto fail;
+ }
rtpctx->oformat = rtp_format;
if (!avformat_new_stream(rtpctx, NULL)) {
- av_free(rtpctx);
- return NULL;
+ ret = AVERROR(ENOMEM);
+ goto fail;
}
/* Pass the interrupt callback on */
rtpctx->interrupt_callback = s->interrupt_callback;
@@ -53,6 +59,12 @@ AVFormatContext *ff_rtp_chain_mux_open(AVFormatContext *s, AVStream *st,
rtpctx->max_delay = s->max_delay;
/* Copy other stream parameters. */
rtpctx->streams[0]->sample_aspect_ratio = st->sample_aspect_ratio;
+ /* Get the payload type from the codec */
+ if (st->id < RTP_PT_PRIVATE)
+ rtpctx->streams[0]->id =
+ ff_rtp_get_payload_type(s, st->codec, idx);
+ else
+ rtpctx->streams[0]->id = st->id;
if (av_opt_get(s, "rtpflags", AV_OPT_SEARCH_CHILDREN, &rtpflags) >= 0)
av_dict_set(&opts, "rtpflags", rtpflags, AV_DICT_DONT_STRDUP_VAL);
@@ -78,9 +90,15 @@ AVFormatContext *ff_rtp_chain_mux_open(AVFormatContext *s, AVStream *st,
av_free(ptr);
}
avformat_free_context(rtpctx);
- return NULL;
+ return ret;
}
- return rtpctx;
-}
+ *out = rtpctx;
+ return 0;
+fail:
+ av_free(rtpctx);
+ if (handle)
+ ffurl_close(handle);
+ return ret;
+}
diff --git a/gst-libs/ext/libav/libavformat/rtpenc_chain.h b/gst-libs/ext/libav/libavformat/rtpenc_chain.h
index 6bdddcf..4117239 100644
--- a/gst-libs/ext/libav/libavformat/rtpenc_chain.h
+++ b/gst-libs/ext/libav/libavformat/rtpenc_chain.h
@@ -25,7 +25,8 @@
#include "avformat.h"
#include "url.h"
-AVFormatContext *ff_rtp_chain_mux_open(AVFormatContext *s, AVStream *st,
- URLContext *handle, int packet_size);
+int ff_rtp_chain_mux_open(AVFormatContext **out, AVFormatContext *s,
+ AVStream *st, URLContext *handle, int packet_size,
+ int id);
#endif /* AVFORMAT_RTPENC_CHAIN_H */
diff --git a/gst-libs/ext/libav/libavformat/rtpenc_h263.c b/gst-libs/ext/libav/libavformat/rtpenc_h263.c
index fbc696e..87f0bd7 100644
--- a/gst-libs/ext/libav/libavformat/rtpenc_h263.c
+++ b/gst-libs/ext/libav/libavformat/rtpenc_h263.c
@@ -23,8 +23,8 @@
#include "avformat.h"
#include "rtpenc.h"
-static const uint8_t *find_resync_marker_reverse(const uint8_t *restrict start,
- const uint8_t *restrict end)
+const uint8_t *ff_h263_find_resync_marker_reverse(const uint8_t *restrict start,
+ const uint8_t *restrict end)
{
const uint8_t *p = end - 1;
start += 1; /* Make sure we never return the original start. */
@@ -63,7 +63,8 @@ void ff_rtp_send_h263(AVFormatContext *s1, const uint8_t *buf1, int size)
/* Look for a better place to split the frame into packets. */
if (len < size) {
- const uint8_t *end = find_resync_marker_reverse(buf1, buf1 + len);
+ const uint8_t *end = ff_h263_find_resync_marker_reverse(buf1,
+ buf1 + len);
len = end - buf1;
}
diff --git a/gst-libs/ext/libav/libavformat/rtpenc_h263_rfc2190.c b/gst-libs/ext/libav/libavformat/rtpenc_h263_rfc2190.c
new file mode 100644
index 0000000..f714d01
--- /dev/null
+++ b/gst-libs/ext/libav/libavformat/rtpenc_h263_rfc2190.c
@@ -0,0 +1,195 @@
+/*
+ * RTP packetization for H.263 video
+ * Copyright (c) 2012 Martin Storsjo
+ *
+ * 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
+ */
+
+#include "avformat.h"
+#include "rtpenc.h"
+#include "libavcodec/put_bits.h"
+#include "libavcodec/get_bits.h"
+
+struct H263Info {
+ int src;
+ int i;
+ int u;
+ int s;
+ int a;
+ int pb;
+ int tr;
+};
+
+struct H263State {
+ int gobn;
+ int mba;
+ int hmv1, vmv1, hmv2, vmv2;
+ int quant;
+};
+
+static void send_mode_a(AVFormatContext *s1, const struct H263Info *info,
+ const uint8_t *buf, int len, int ebits, int m)
+{
+ RTPMuxContext *s = s1->priv_data;
+ PutBitContext pb;
+
+ init_put_bits(&pb, s->buf, 32);
+ put_bits(&pb, 1, 0); /* F - 0, mode A */
+ put_bits(&pb, 1, 0); /* P - 0, normal I/P */
+ put_bits(&pb, 3, 0); /* SBIT - 0 bits */
+ put_bits(&pb, 3, ebits); /* EBIT */
+ put_bits(&pb, 3, info->src); /* SRC - source format */
+ put_bits(&pb, 1, info->i); /* I - inter/intra */
+ put_bits(&pb, 1, info->u); /* U - unrestricted motion vector */
+ put_bits(&pb, 1, info->s); /* S - syntax-baesd arithmetic coding */
+ put_bits(&pb, 1, info->a); /* A - advanced prediction */
+ put_bits(&pb, 4, 0); /* R - reserved */
+ put_bits(&pb, 2, 0); /* DBQ - 0 */
+ put_bits(&pb, 3, 0); /* TRB - 0 */
+ put_bits(&pb, 8, info->tr); /* TR */
+ flush_put_bits(&pb);
+ memcpy(s->buf + 4, buf, len);
+
+ ff_rtp_send_data(s1, s->buf, len + 4, m);
+}
+
+static void send_mode_b(AVFormatContext *s1, const struct H263Info *info,
+ const struct H263State *state, const uint8_t *buf,
+ int len, int sbits, int ebits, int m)
+{
+ RTPMuxContext *s = s1->priv_data;
+ PutBitContext pb;
+
+ init_put_bits(&pb, s->buf, 64);
+ put_bits(&pb, 1, 1); /* F - 1, mode B */
+ put_bits(&pb, 1, 0); /* P - 0, mode B */
+ put_bits(&pb, 3, sbits); /* SBIT - 0 bits */
+ put_bits(&pb, 3, ebits); /* EBIT - 0 bits */
+ put_bits(&pb, 3, info->src); /* SRC - source format */
+ put_bits(&pb, 5, state->quant); /* QUANT - quantizer for the first MB */
+ put_bits(&pb, 5, state->gobn); /* GOBN - GOB number */
+ put_bits(&pb, 9, state->mba); /* MBA - MB address */
+ put_bits(&pb, 2, 0); /* R - reserved */
+ put_bits(&pb, 1, info->i); /* I - inter/intra */
+ put_bits(&pb, 1, info->u); /* U - unrestricted motion vector */
+ put_bits(&pb, 1, info->s); /* S - syntax-baesd arithmetic coding */
+ put_bits(&pb, 1, info->a); /* A - advanced prediction */
+ put_bits(&pb, 7, state->hmv1); /* HVM1 - horizontal motion vector 1 */
+ put_bits(&pb, 7, state->vmv1); /* VMV1 - vertical motion vector 1 */
+ put_bits(&pb, 7, state->hmv2); /* HVM2 - horizontal motion vector 2 */
+ put_bits(&pb, 7, state->vmv2); /* VMV2 - vertical motion vector 2 */
+ flush_put_bits(&pb);
+ memcpy(s->buf + 8, buf, len);
+
+ ff_rtp_send_data(s1, s->buf, len + 8, m);
+}
+
+void ff_rtp_send_h263_rfc2190(AVFormatContext *s1, const uint8_t *buf, int size,
+ const uint8_t *mb_info, int mb_info_size)
+{
+ RTPMuxContext *s = s1->priv_data;
+ int len, sbits = 0, ebits = 0;
+ GetBitContext gb;
+ struct H263Info info = { 0 };
+ struct H263State state = { 0 };
+ int mb_info_pos = 0, mb_info_count = mb_info_size / 12;
+ const uint8_t *buf_base = buf;
+
+ s->timestamp = s->cur_timestamp;
+
+ init_get_bits(&gb, buf, size*8);
+ if (get_bits(&gb, 22) == 0x20) { /* Picture Start Code */
+ info.tr = get_bits(&gb, 8);
+ skip_bits(&gb, 2); /* PTYPE start, H261 disambiguation */
+ skip_bits(&gb, 3); /* Split screen, document camera, freeze picture release */
+ info.src = get_bits(&gb, 3);
+ info.i = get_bits(&gb, 1);
+ info.u = get_bits(&gb, 1);
+ info.s = get_bits(&gb, 1);
+ info.a = get_bits(&gb, 1);
+ info.pb = get_bits(&gb, 1);
+ }
+
+ while (size > 0) {
+ struct H263State packet_start_state = state;
+ len = FFMIN(s->max_payload_size - 8, size);
+
+ /* Look for a better place to split the frame into packets. */
+ if (len < size) {
+ const uint8_t *end = ff_h263_find_resync_marker_reverse(buf,
+ buf + len);
+ len = end - buf;
+ if (len == s->max_payload_size - 8) {
+ /* Skip mb info prior to the start of the current ptr */
+ while (mb_info_pos < mb_info_count) {
+ uint32_t pos = AV_RL32(&mb_info[12*mb_info_pos])/8;
+ if (pos >= buf - buf_base)
+ break;
+ mb_info_pos++;
+ }
+ /* Find the first mb info past the end pointer */
+ while (mb_info_pos + 1 < mb_info_count) {
+ uint32_t pos = AV_RL32(&mb_info[12*(mb_info_pos + 1)])/8;
+ if (pos >= end - buf_base)
+ break;
+ mb_info_pos++;
+ }
+ if (mb_info_pos < mb_info_count) {
+ const uint8_t *ptr = &mb_info[12*mb_info_pos];
+ uint32_t bit_pos = AV_RL32(ptr);
+ uint32_t pos = (bit_pos + 7)/8;
+ if (pos <= end - buf_base) {
+ state.quant = ptr[4];
+ state.gobn = ptr[5];
+ state.mba = AV_RL16(&ptr[6]);
+ state.hmv1 = (int8_t) ptr[8];
+ state.vmv1 = (int8_t) ptr[9];
+ state.hmv2 = (int8_t) ptr[10];
+ state.vmv2 = (int8_t) ptr[11];
+ ebits = 8 * pos - bit_pos;
+ len = pos - (buf - buf_base);
+ mb_info_pos++;
+ } else {
+ av_log(s1, AV_LOG_ERROR,
+ "Unable to split H263 packet, use -mb_info %d "
+ "or lower.\n", s->max_payload_size - 8);
+ }
+ } else {
+ av_log(s1, AV_LOG_ERROR, "Unable to split H263 packet, "
+ "use -mb_info %d or -ps 1.\n",
+ s->max_payload_size - 8);
+ }
+ }
+ }
+
+ if (size > 2 && !buf[0] && !buf[1])
+ send_mode_a(s1, &info, buf, len, ebits, len == size);
+ else
+ send_mode_b(s1, &info, &packet_start_state, buf, len, sbits,
+ ebits, len == size);
+
+ if (ebits) {
+ sbits = 8 - ebits;
+ len--;
+ } else {
+ sbits = 0;
+ }
+ buf += len;
+ size -= len;
+ ebits = 0;
+ }
+}
diff --git a/gst-libs/ext/libav/libavformat/rtpenc_h264.c b/gst-libs/ext/libav/libavformat/rtpenc_h264.c
index 776da83..ac74074 100644
--- a/gst-libs/ext/libav/libavformat/rtpenc_h264.c
+++ b/gst-libs/ext/libav/libavformat/rtpenc_h264.c
@@ -55,6 +55,12 @@ static void nal_send(AVFormatContext *s1, const uint8_t *buf, int size, int last
uint8_t type = buf[0] & 0x1F;
uint8_t nri = buf[0] & 0x60;
+ if (s->flags & FF_RTP_FLAG_H264_MODE0) {
+ av_log(s1, AV_LOG_ERROR,
+ "NAL size %d > %d, try -slice-max-size %d\n", size,
+ s->max_payload_size, s->max_payload_size);
+ return;
+ }
av_log(s1, AV_LOG_DEBUG, "NAL size %d > %d\n", size, s->max_payload_size);
s->buf[0] = 28; /* FU Indicator; Type = 28 ---> FU-A */
s->buf[0] |= nri;
diff --git a/gst-libs/ext/libav/libavformat/rtpenc_jpeg.c b/gst-libs/ext/libav/libavformat/rtpenc_jpeg.c
new file mode 100644
index 0000000..04df658
--- /dev/null
+++ b/gst-libs/ext/libav/libavformat/rtpenc_jpeg.c
@@ -0,0 +1,138 @@
+/*
+ * RTP JPEG-compressed video Packetizer, RFC 2435
+ * Copyright (c) 2012 Samuel Pitoiset
+ *
+ * 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
+ */
+
+#include "libavcodec/bytestream.h"
+#include "libavcodec/mjpeg.h"
+#include "libavutil/intreadwrite.h"
+#include "rtpenc.h"
+
+void ff_rtp_send_jpeg(AVFormatContext *s1, const uint8_t *buf, int size)
+{
+ RTPMuxContext *s = s1->priv_data;
+ const uint8_t *qtables = NULL;
+ int nb_qtables = 0;
+ uint8_t type = 1; /* default pixel format is AV_PIX_FMT_YUVJ420P */
+ uint8_t w, h;
+ uint8_t *p;
+ int off = 0; /* fragment offset of the current JPEG frame */
+ int len;
+ int i;
+
+ s->buf_ptr = s->buf;
+ s->timestamp = s->cur_timestamp;
+
+ /* convert video pixel dimensions from pixels to blocks */
+ w = s1->streams[0]->codec->width >> 3;
+ h = s1->streams[0]->codec->height >> 3;
+
+ /* check if pixel format is not the normal 420 case */
+ if (s1->streams[0]->codec->pix_fmt == AV_PIX_FMT_YUVJ422P) {
+ type = 0;
+ } else if (s1->streams[0]->codec->pix_fmt == AV_PIX_FMT_YUVJ420P) {
+ type = 1;
+ } else {
+ av_log(s1, AV_LOG_ERROR, "Unsupported pixel format\n");
+ return;
+ }
+
+ /* preparse the header for getting some infos */
+ for (i = 0; i < size; i++) {
+ if (buf[i] != 0xff)
+ continue;
+
+ if (buf[i + 1] == DQT) {
+ if (buf[i + 4])
+ av_log(s1, AV_LOG_WARNING,
+ "Only 8-bit precision is supported.\n");
+
+ /* a quantization table is 64 bytes long */
+ nb_qtables = AV_RB16(&buf[i + 2]) / 65;
+ if (i + 4 + nb_qtables * 65 > size) {
+ av_log(s1, AV_LOG_ERROR, "Too short JPEG header. Aborted!\n");
+ return;
+ }
+
+ qtables = &buf[i + 4];
+ } else if (buf[i + 1] == SOF0) {
+ if (buf[i + 14] != 17 || buf[i + 17] != 17) {
+ av_log(s1, AV_LOG_ERROR,
+ "Only 1x1 chroma blocks are supported. Aborted!\n");
+ return;
+ }
+ } else if (buf[i + 1] == SOS) {
+ /* SOS is last marker in the header */
+ i += AV_RB16(&buf[i + 2]) + 2;
+ break;
+ }
+ }
+
+ /* skip JPEG header */
+ buf += i;
+ size -= i;
+
+ for (i = size - 2; i >= 0; i--) {
+ if (buf[i] == 0xff && buf[i + 1] == EOI) {
+ /* Remove the EOI marker */
+ size = i;
+ break;
+ }
+ }
+
+ p = s->buf_ptr;
+ while (size > 0) {
+ int hdr_size = 8;
+
+ if (off == 0 && nb_qtables)
+ hdr_size += 4 + 64 * nb_qtables;
+
+ /* payload max in one packet */
+ len = FFMIN(size, s->max_payload_size - hdr_size);
+
+ /* set main header */
+ bytestream_put_byte(&p, 0);
+ bytestream_put_be24(&p, off);
+ bytestream_put_byte(&p, type);
+ bytestream_put_byte(&p, 255);
+ bytestream_put_byte(&p, w);
+ bytestream_put_byte(&p, h);
+
+ if (off == 0 && nb_qtables) {
+ /* set quantization tables header */
+ bytestream_put_byte(&p, 0);
+ bytestream_put_byte(&p, 0);
+ bytestream_put_be16(&p, 64 * nb_qtables);
+
+ for (i = 0; i < nb_qtables; i++)
+ bytestream_put_buffer(&p, &qtables[65 * i + 1], 64);
+ }
+
+ /* copy payload data */
+ memcpy(p, buf, len);
+
+ /* marker bit is last packet in frame */
+ ff_rtp_send_data(s1, s->buf, len + hdr_size, size == len);
+
+ buf += len;
+ size -= len;
+ off += len;
+ p = s->buf;
+ }
+}
diff --git a/gst-libs/ext/libav/libavformat/rtpenc_mpv.c b/gst-libs/ext/libav/libavformat/rtpenc_mpv.c
index 1c67f95..37dedc3 100644
--- a/gst-libs/ext/libav/libavformat/rtpenc_mpv.c
+++ b/gst-libs/ext/libav/libavformat/rtpenc_mpv.c
@@ -115,5 +115,3 @@ void ff_rtp_send_mpegvideo(AVFormatContext *s1, const uint8_t *buf1, int size)
end_of_slice = 0;
}
}
-
-
diff --git a/gst-libs/ext/libav/libavformat/rtpenc_vp8.c b/gst-libs/ext/libav/libavformat/rtpenc_vp8.c
index afedbb4..d24c8bc 100644
--- a/gst-libs/ext/libav/libavformat/rtpenc_vp8.c
+++ b/gst-libs/ext/libav/libavformat/rtpenc_vp8.c
@@ -22,26 +22,34 @@
#include "rtpenc.h"
/* Based on a draft spec for VP8 RTP.
- * ( http://www.webmproject.org/code/specs/rtp/ ) */
+ * ( http://tools.ietf.org/html/draft-ietf-payload-vp8-05 ) */
void ff_rtp_send_vp8(AVFormatContext *s1, const uint8_t *buf, int size)
{
RTPMuxContext *s = s1->priv_data;
- int len, max_packet_size;
+ int len, max_packet_size, header_size;
s->buf_ptr = s->buf;
s->timestamp = s->cur_timestamp;
- max_packet_size = s->max_payload_size - 1; // minus one for header byte
- *s->buf_ptr++ = 1; // 0b1 indicates start of frame
+ // extended control bit set, reference frame, start of partition,
+ // partition id 0
+ *s->buf_ptr++ = 0x90;
+ *s->buf_ptr++ = 0x80; // Picture id present
+ *s->buf_ptr++ = s->frame_count++ & 0x7f;
+ // Calculate the number of remaining bytes
+ header_size = s->buf_ptr - s->buf;
+ max_packet_size = s->max_payload_size - header_size;
+
while (size > 0) {
len = FFMIN(size, max_packet_size);
memcpy(s->buf_ptr, buf, len);
- ff_rtp_send_data(s1, s->buf, len+1, size == len); // marker bit is last packet in frame
+ // marker bit is last packet in frame
+ ff_rtp_send_data(s1, s->buf, len + header_size, size == len);
size -= len;
buf += len;
- s->buf_ptr = s->buf;
- *s->buf_ptr++ = 0; // payload descriptor
+ // Clear the partition start bit, keep the rest of the header untouched
+ s->buf[0] &= ~0x10;
}
}
diff --git a/gst-libs/ext/libav/libavformat/rtpproto.c b/gst-libs/ext/libav/libavformat/rtpproto.c
index 03794ae..190dff4 100644
--- a/gst-libs/ext/libav/libavformat/rtpproto.c
+++ b/gst-libs/ext/libav/libavformat/rtpproto.c
@@ -31,7 +31,6 @@
#include "rtpdec.h"
#include "url.h"
-#include <unistd.h>
#include <stdarg.h>
#include "internal.h"
#include "network.h"
@@ -40,10 +39,6 @@
#if HAVE_POLL_H
#include <sys/poll.h>
#endif
-#include <sys/time.h>
-
-#define RTP_TX_BUF_SIZE (64 * 1024)
-#define RTP_RX_BUF_SIZE (128 * 1024)
typedef struct RTPContext {
URLContext *rtp_hd, *rtcp_hd;
@@ -266,7 +261,7 @@ static int rtp_write(URLContext *h, const uint8_t *buf, int size)
int ret;
URLContext *hd;
- if (buf[1] >= RTCP_SR && buf[1] <= RTCP_APP) {
+ if (RTP_PT_IS_RTCP(buf[1])) {
/* RTCP payload type */
hd = s->rtcp_hd;
} else {
@@ -317,18 +312,27 @@ static int rtp_get_file_handle(URLContext *h)
return s->rtp_fd;
}
-int ff_rtp_get_rtcp_file_handle(URLContext *h) {
+static int rtp_get_multi_file_handle(URLContext *h, int **handles,
+ int *numhandles)
+{
RTPContext *s = h->priv_data;
- return s->rtcp_fd;
+ int *hs = *handles = av_malloc(sizeof(**handles) * 2);
+ if (!hs)
+ return AVERROR(ENOMEM);
+ hs[0] = s->rtp_fd;
+ hs[1] = s->rtcp_fd;
+ *numhandles = 2;
+ return 0;
}
URLProtocol ff_rtp_protocol = {
- .name = "rtp",
- .url_open = rtp_open,
- .url_read = rtp_read,
- .url_write = rtp_write,
- .url_close = rtp_close,
- .url_get_file_handle = rtp_get_file_handle,
- .priv_data_size = sizeof(RTPContext),
- .flags = URL_PROTOCOL_FLAG_NETWORK,
+ .name = "rtp",
+ .url_open = rtp_open,
+ .url_read = rtp_read,
+ .url_write = rtp_write,
+ .url_close = rtp_close,
+ .url_get_file_handle = rtp_get_file_handle,
+ .url_get_multi_file_handle = rtp_get_multi_file_handle,
+ .priv_data_size = sizeof(RTPContext),
+ .flags = URL_PROTOCOL_FLAG_NETWORK,
};
diff --git a/gst-libs/ext/libav/libavformat/rtsp.c b/gst-libs/ext/libav/libavformat/rtsp.c
index 5a691f2..134b322 100644
--- a/gst-libs/ext/libav/libavformat/rtsp.c
+++ b/gst-libs/ext/libav/libavformat/rtsp.c
@@ -27,10 +27,10 @@
#include "libavutil/random_seed.h"
#include "libavutil/dict.h"
#include "libavutil/opt.h"
+#include "libavutil/time.h"
#include "avformat.h"
#include "avio_internal.h"
-#include <sys/time.h>
#if HAVE_POLL_H
#include <poll.h>
#endif
@@ -46,6 +46,7 @@
#include "rtpenc_chain.h"
#include "url.h"
#include "rtpenc.h"
+#include "mpegts.h"
//#define DEBUG
@@ -56,42 +57,54 @@
#define MAX_TIMEOUTS READ_PACKET_TIMEOUT_S * 1000 / POLL_TIMEOUT_MS
#define SDP_MAX_SIZE 16384
#define RECVBUF_SIZE 10 * RTP_MAX_PACKET_LENGTH
+#define DEFAULT_REORDERING_DELAY 100000
#define OFFSET(x) offsetof(RTSPState, x)
#define DEC AV_OPT_FLAG_DECODING_PARAM
#define ENC AV_OPT_FLAG_ENCODING_PARAM
#define RTSP_FLAG_OPTS(name, longname) \
- { name, longname, OFFSET(rtsp_flags), AV_OPT_TYPE_FLAGS, {0}, INT_MIN, INT_MAX, DEC, "rtsp_flags" }, \
- { "filter_src", "Only receive packets from the negotiated peer IP", 0, AV_OPT_TYPE_CONST, {RTSP_FLAG_FILTER_SRC}, 0, 0, DEC, "rtsp_flags" }
+ { name, longname, OFFSET(rtsp_flags), AV_OPT_TYPE_FLAGS, {.i64 = 0}, INT_MIN, INT_MAX, DEC, "rtsp_flags" }, \
+ { "filter_src", "Only receive packets from the negotiated peer IP", 0, AV_OPT_TYPE_CONST, {.i64 = RTSP_FLAG_FILTER_SRC}, 0, 0, DEC, "rtsp_flags" }, \
+ { "listen", "Wait for incoming connections", 0, AV_OPT_TYPE_CONST, {.i64 = RTSP_FLAG_LISTEN}, 0, 0, DEC, "rtsp_flags" }
#define RTSP_MEDIATYPE_OPTS(name, longname) \
- { name, longname, OFFSET(media_type_mask), AV_OPT_TYPE_FLAGS, { (1 << (AVMEDIA_TYPE_DATA+1)) - 1 }, INT_MIN, INT_MAX, DEC, "allowed_media_types" }, \
- { "video", "Video", 0, AV_OPT_TYPE_CONST, {1 << AVMEDIA_TYPE_VIDEO}, 0, 0, DEC, "allowed_media_types" }, \
- { "audio", "Audio", 0, AV_OPT_TYPE_CONST, {1 << AVMEDIA_TYPE_AUDIO}, 0, 0, DEC, "allowed_media_types" }, \
- { "data", "Data", 0, AV_OPT_TYPE_CONST, {1 << AVMEDIA_TYPE_DATA}, 0, 0, DEC, "allowed_media_types" }
+ { name, longname, OFFSET(media_type_mask), AV_OPT_TYPE_FLAGS, { .i64 = (1 << (AVMEDIA_TYPE_DATA+1)) - 1 }, INT_MIN, INT_MAX, DEC, "allowed_media_types" }, \
+ { "video", "Video", 0, AV_OPT_TYPE_CONST, {.i64 = 1 << AVMEDIA_TYPE_VIDEO}, 0, 0, DEC, "allowed_media_types" }, \
+ { "audio", "Audio", 0, AV_OPT_TYPE_CONST, {.i64 = 1 << AVMEDIA_TYPE_AUDIO}, 0, 0, DEC, "allowed_media_types" }, \
+ { "data", "Data", 0, AV_OPT_TYPE_CONST, {.i64 = 1 << AVMEDIA_TYPE_DATA}, 0, 0, DEC, "allowed_media_types" }
+
+#define RTSP_REORDERING_OPTS() \
+ { "reorder_queue_size", "Number of packets to buffer for handling of reordered packets", OFFSET(reordering_queue_size), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, DEC }
const AVOption ff_rtsp_options[] = {
- { "initial_pause", "Don't start playing the stream immediately", OFFSET(initial_pause), AV_OPT_TYPE_INT, {0}, 0, 1, DEC },
+ { "initial_pause", "Don't start playing the stream immediately", OFFSET(initial_pause), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1, DEC },
FF_RTP_FLAG_OPTS(RTSPState, rtp_muxer_flags),
- { "rtsp_transport", "RTSP transport protocols", OFFSET(lower_transport_mask), AV_OPT_TYPE_FLAGS, {0}, INT_MIN, INT_MAX, DEC|ENC, "rtsp_transport" }, \
- { "udp", "UDP", 0, AV_OPT_TYPE_CONST, {1 << RTSP_LOWER_TRANSPORT_UDP}, 0, 0, DEC|ENC, "rtsp_transport" }, \
- { "tcp", "TCP", 0, AV_OPT_TYPE_CONST, {1 << RTSP_LOWER_TRANSPORT_TCP}, 0, 0, DEC|ENC, "rtsp_transport" }, \
- { "udp_multicast", "UDP multicast", 0, AV_OPT_TYPE_CONST, {1 << RTSP_LOWER_TRANSPORT_UDP_MULTICAST}, 0, 0, DEC, "rtsp_transport" },
- { "http", "HTTP tunneling", 0, AV_OPT_TYPE_CONST, {(1 << RTSP_LOWER_TRANSPORT_HTTP)}, 0, 0, DEC, "rtsp_transport" },
+ { "rtsp_transport", "RTSP transport protocols", OFFSET(lower_transport_mask), AV_OPT_TYPE_FLAGS, {.i64 = 0}, INT_MIN, INT_MAX, DEC|ENC, "rtsp_transport" }, \
+ { "udp", "UDP", 0, AV_OPT_TYPE_CONST, {.i64 = 1 << RTSP_LOWER_TRANSPORT_UDP}, 0, 0, DEC|ENC, "rtsp_transport" }, \
+ { "tcp", "TCP", 0, AV_OPT_TYPE_CONST, {.i64 = 1 << RTSP_LOWER_TRANSPORT_TCP}, 0, 0, DEC|ENC, "rtsp_transport" }, \
+ { "udp_multicast", "UDP multicast", 0, AV_OPT_TYPE_CONST, {.i64 = 1 << RTSP_LOWER_TRANSPORT_UDP_MULTICAST}, 0, 0, DEC, "rtsp_transport" },
+ { "http", "HTTP tunneling", 0, AV_OPT_TYPE_CONST, {.i64 = (1 << RTSP_LOWER_TRANSPORT_HTTP)}, 0, 0, DEC, "rtsp_transport" },
RTSP_FLAG_OPTS("rtsp_flags", "RTSP flags"),
RTSP_MEDIATYPE_OPTS("allowed_media_types", "Media types to accept from the server"),
+ { "min_port", "Minimum local UDP port", OFFSET(rtp_port_min), AV_OPT_TYPE_INT, {.i64 = RTSP_RTP_PORT_MIN}, 0, 65535, DEC|ENC },
+ { "max_port", "Maximum local UDP port", OFFSET(rtp_port_max), AV_OPT_TYPE_INT, {.i64 = RTSP_RTP_PORT_MAX}, 0, 65535, DEC|ENC },
+ { "timeout", "Maximum timeout (in seconds) to wait for incoming connections. -1 is infinite. Implies flag listen", OFFSET(initial_timeout), AV_OPT_TYPE_INT, {.i64 = -1}, INT_MIN, INT_MAX, DEC },
+ RTSP_REORDERING_OPTS(),
{ NULL },
};
static const AVOption sdp_options[] = {
RTSP_FLAG_OPTS("sdp_flags", "SDP flags"),
+ { "custom_io", "Use custom IO", 0, AV_OPT_TYPE_CONST, {.i64 = RTSP_FLAG_CUSTOM_IO}, 0, 0, DEC, "rtsp_flags" },
RTSP_MEDIATYPE_OPTS("allowed_media_types", "Media types to accept from the server"),
+ RTSP_REORDERING_OPTS(),
{ NULL },
};
static const AVOption rtp_options[] = {
RTSP_FLAG_OPTS("rtp_flags", "RTP flags"),
+ RTSP_REORDERING_OPTS(),
{ NULL },
};
@@ -148,14 +161,11 @@ static void rtsp_parse_range_npt(const char *p, int64_t *start, int64_t *end)
get_word_sep(buf, sizeof(buf), "-", &p);
av_parse_time(end, buf, 1);
}
-// av_log(NULL, AV_LOG_DEBUG, "Range Start: %lld\n", *start);
-// av_log(NULL, AV_LOG_DEBUG, "Range End: %lld\n", *end);
}
static int get_sockaddr(const char *buf, struct sockaddr_storage *sock)
{
- struct addrinfo hints, *ai = NULL;
- memset(&hints, 0, sizeof(hints));
+ struct addrinfo hints = { 0 }, *ai = NULL;
hints.ai_flags = AI_NUMERICHOST;
if (getaddrinfo(buf, NULL, &hints, &ai))
return -1;
@@ -196,7 +206,14 @@ static int sdp_parse_rtpmap(AVFormatContext *s,
* particular servers ("RealServer Version 6.1.3.970", see issue 1658)
* have a trailing space. */
get_word_sep(buf, sizeof(buf), "/ ", &p);
- if (payload_type >= RTP_PT_PRIVATE) {
+ if (payload_type < RTP_PT_PRIVATE) {
+ /* We are in a standard case
+ * (from http://www.iana.org/assignments/rtp-parameters). */
+ /* search into AVRtpPayloadTypes[] */
+ codec->codec_id = ff_rtp_codec_id(buf, codec->codec_type);
+ }
+
+ if (codec->codec_id == AV_CODEC_ID_NONE) {
RTPDynamicProtocolHandler *handler =
ff_rtp_handler_find_by_name(buf, codec->codec_type);
init_rtp_handler(handler, rtsp_st, codec);
@@ -206,11 +223,6 @@ static int sdp_parse_rtpmap(AVFormatContext *s,
* the format name from the rtpmap line never is passed into rtpdec. */
if (!rtsp_st->dynamic_handler)
codec->codec_id = ff_rtp_codec_id(buf, codec->codec_type);
- } else {
- /* We are in a standard case
- * (from http://www.iana.org/assignments/rtp-parameters). */
- /* search into AVRtpPayloadTypes[] */
- codec->codec_id = ff_rtp_codec_id(buf, codec->codec_type);
}
c = avcodec_find_decoder(codec->codec_id);
@@ -364,7 +376,9 @@ static void sdp_parse_line(AVFormatContext *s, SDPParseState *s1,
get_word(buf1, sizeof(buf1), &p); /* port */
rtsp_st->sdp_port = atoi(buf1);
- get_word(buf1, sizeof(buf1), &p); /* protocol (ignored) */
+ get_word(buf1, sizeof(buf1), &p); /* protocol */
+ if (!strcmp(buf1, "udp"))
+ rt->transport = RTSP_TRANSPORT_RAW;
/* XXX: handle list of formats */
get_word(buf1, sizeof(buf1), &p); /* format list */
@@ -372,6 +386,12 @@ static void sdp_parse_line(AVFormatContext *s, SDPParseState *s1,
if (!strcmp(ff_rtp_enc_name(rtsp_st->sdp_payload_type), "MP2T")) {
/* no corresponding stream */
+ if (rt->transport == RTSP_TRANSPORT_RAW && !rt->ts && CONFIG_RTPDEC)
+ rt->ts = ff_mpegts_parse_open(s);
+ } else if (rt->server_type == RTSP_SERVER_WMS &&
+ codec_type == AVMEDIA_TYPE_DATA) {
+ /* RTX stream, a stream that carries all the other actual
+ * audio/video streams. Don't expose this to the callers. */
} else {
st = avformat_new_stream(s, NULL);
if (!st)
@@ -428,9 +448,11 @@ static void sdp_parse_line(AVFormatContext *s, SDPParseState *s1,
/* NOTE: rtpmap is only supported AFTER the 'm=' tag */
get_word(buf1, sizeof(buf1), &p);
payload_type = atoi(buf1);
- st = s->streams[s->nb_streams - 1];
rtsp_st = rt->rtsp_streams[rt->nb_rtsp_streams - 1];
- sdp_parse_rtpmap(s, st, rtsp_st, payload_type, p);
+ if (rtsp_st->stream_index >= 0) {
+ st = s->streams[rtsp_st->stream_index];
+ sdp_parse_rtpmap(s, st, rtsp_st, payload_type, p);
+ }
} else if (av_strstart(p, "fmtp:", &p) ||
av_strstart(p, "framesize:", &p)) {
/* NOTE: fmtp is only supported AFTER the 'a=rtpmap:xxx' tag */
@@ -465,14 +487,15 @@ static void sdp_parse_line(AVFormatContext *s, SDPParseState *s1,
if (rt->server_type == RTSP_SERVER_WMS)
ff_wms_parse_sdp_a_line(s, p);
if (s->nb_streams > 0) {
+ rtsp_st = rt->rtsp_streams[rt->nb_rtsp_streams - 1];
+
if (rt->server_type == RTSP_SERVER_REAL)
- ff_real_parse_sdp_a_line(s, s->nb_streams - 1, p);
+ ff_real_parse_sdp_a_line(s, rtsp_st->stream_index, p);
- rtsp_st = rt->rtsp_streams[rt->nb_rtsp_streams - 1];
if (rtsp_st->dynamic_handler &&
rtsp_st->dynamic_handler->parse_sdp_a_line)
rtsp_st->dynamic_handler->parse_sdp_a_line(s,
- s->nb_streams - 1,
+ rtsp_st->stream_index,
rtsp_st->dynamic_protocol_context, buf);
}
}
@@ -494,9 +517,8 @@ int ff_sdp_parse(AVFormatContext *s, const char *content)
* The Vorbis FMTP line can be up to 16KB - see xiph_parse_sdp_line
* in rtpdec_xiph.c. */
char buf[16384], *q;
- SDPParseState sdp_parse_state, *s1 = &sdp_parse_state;
+ SDPParseState sdp_parse_state = { { 0 } }, *s1 = &sdp_parse_state;
- memset(s1, 0, sizeof(SDPParseState));
p = content;
for (;;) {
p += strspn(p, SPACE_CHARS);
@@ -551,7 +573,7 @@ void ff_rtsp_undo_setup(AVFormatContext *s)
avformat_free_context(rtpctx);
} else if (rt->transport == RTSP_TRANSPORT_RDT && CONFIG_RTPDEC)
ff_rdt_parse_close(rtsp_st->transport_priv);
- else if (CONFIG_RTPDEC)
+ else if (rt->transport == RTSP_TRANSPORT_RTP && CONFIG_RTPDEC)
ff_rtp_parse_close(rtsp_st->transport_priv);
}
rtsp_st->transport_priv = NULL;
@@ -582,14 +604,23 @@ void ff_rtsp_close_streams(AVFormatContext *s)
if (rt->asf_ctx) {
avformat_close_input(&rt->asf_ctx);
}
+ if (rt->ts && CONFIG_RTPDEC)
+ ff_mpegts_parse_close(rt->ts);
av_free(rt->p);
av_free(rt->recvbuf);
}
-static int rtsp_open_transport_ctx(AVFormatContext *s, RTSPStream *rtsp_st)
+int ff_rtsp_open_transport_ctx(AVFormatContext *s, RTSPStream *rtsp_st)
{
RTSPState *rt = s->priv_data;
AVStream *st = NULL;
+ int reordering_queue_size = rt->reordering_queue_size;
+ if (reordering_queue_size < 0) {
+ if (rt->lower_transport == RTSP_LOWER_TRANSPORT_TCP || !s->max_delay)
+ reordering_queue_size = 0;
+ else
+ reordering_queue_size = RTP_REORDER_QUEUE_DEFAULT_SIZE;
+ }
/* open the RTP context */
if (rtsp_st->stream_index >= 0)
@@ -598,24 +629,28 @@ static int rtsp_open_transport_ctx(AVFormatContext *s, RTSPStream *rtsp_st)
s->ctx_flags |= AVFMTCTX_NOHEADER;
if (s->oformat && CONFIG_RTSP_MUXER) {
- rtsp_st->transport_priv = ff_rtp_chain_mux_open(s, st,
- rtsp_st->rtp_handle,
- RTSP_TCP_MAX_PACKET_SIZE);
+ int ret = ff_rtp_chain_mux_open(&rtsp_st->transport_priv, s, st,
+ rtsp_st->rtp_handle,
+ RTSP_TCP_MAX_PACKET_SIZE,
+ rtsp_st->stream_index);
/* Ownership of rtp_handle is passed to the rtp mux context */
rtsp_st->rtp_handle = NULL;
+ if (ret < 0)
+ return ret;
+ } else if (rt->transport == RTSP_TRANSPORT_RAW) {
+ return 0; // Don't need to open any parser here
} else if (rt->transport == RTSP_TRANSPORT_RDT && CONFIG_RTPDEC)
rtsp_st->transport_priv = ff_rdt_parse_open(s, st->index,
rtsp_st->dynamic_protocol_context,
rtsp_st->dynamic_handler);
else if (CONFIG_RTPDEC)
- rtsp_st->transport_priv = ff_rtp_parse_open(s, st, rtsp_st->rtp_handle,
+ rtsp_st->transport_priv = ff_rtp_parse_open(s, st,
rtsp_st->sdp_payload_type,
- (rt->lower_transport == RTSP_LOWER_TRANSPORT_TCP || !s->max_delay)
- ? 0 : RTP_REORDER_QUEUE_DEFAULT_SIZE);
+ reordering_queue_size);
if (!rtsp_st->transport_priv) {
return AVERROR(ENOMEM);
- } else if (rt->transport != RTSP_TRANSPORT_RDT && CONFIG_RTPDEC) {
+ } else if (rt->transport == RTSP_TRANSPORT_RTP && CONFIG_RTPDEC) {
if (rtsp_st->dynamic_handler) {
ff_rtp_parse_set_dynamic_protocol(rtsp_st->transport_priv,
rtsp_st->dynamic_protocol_context,
@@ -629,16 +664,17 @@ static int rtsp_open_transport_ctx(AVFormatContext *s, RTSPStream *rtsp_st)
#if CONFIG_RTSP_DEMUXER || CONFIG_RTSP_MUXER
static void rtsp_parse_range(int *min_ptr, int *max_ptr, const char **pp)
{
- const char *p;
+ const char *q;
+ char *p;
int v;
- p = *pp;
- p += strspn(p, SPACE_CHARS);
- v = strtol(p, (char **)&p, 10);
+ q = *pp;
+ q += strspn(q, SPACE_CHARS);
+ v = strtol(q, &p, 10);
if (*p == '-') {
p++;
*min_ptr = v;
- v = strtol(p, (char **)&p, 10);
+ v = strtol(p, &p, 10);
*max_ptr = v;
} else {
*min_ptr = v;
@@ -683,6 +719,15 @@ static void rtsp_parse_transport(RTSPMessageHeader *reply, const char *p)
get_word_sep(lower_transport, sizeof(lower_transport), "/;,", &p);
profile[0] = '\0';
th->transport = RTSP_TRANSPORT_RDT;
+ } else if (!av_strcasecmp(transport_protocol, "raw")) {
+ get_word_sep(profile, sizeof(profile), "/;,", &p);
+ lower_transport[0] = '\0';
+ /* raw/raw/<protocol> */
+ if (*p == '/') {
+ get_word_sep(lower_transport, sizeof(lower_transport),
+ ";,", &p);
+ }
+ th->transport = RTSP_TRANSPORT_RAW;
}
if (!av_strcasecmp(lower_transport, "TCP"))
th->lower_transport = RTSP_LOWER_TRANSPORT_TCP;
@@ -722,8 +767,10 @@ static void rtsp_parse_transport(RTSPMessageHeader *reply, const char *p)
th->lower_transport = RTSP_LOWER_TRANSPORT_UDP_MULTICAST;
} else if (!strcmp(parameter, "ttl")) {
if (*p == '=') {
+ char *end;
p++;
- th->ttl = strtol(p, (char **)&p, 10);
+ th->ttl = strtol(p, &end, 10);
+ p = end;
}
} else if (!strcmp(parameter, "destination")) {
if (*p == '=') {
@@ -737,6 +784,14 @@ static void rtsp_parse_transport(RTSPMessageHeader *reply, const char *p)
get_word_sep(buf, sizeof(buf), ";,", &p);
av_strlcpy(th->source, buf, sizeof(th->source));
}
+ } else if (!strcmp(parameter, "mode")) {
+ if (*p == '=') {
+ p++;
+ get_word_sep(buf, sizeof(buf), ";, ", &p);
+ if (!strcmp(buf, "record") ||
+ !strcmp(buf, "receive"))
+ th->mode_record = 1;
+ }
}
while (*p != ';' && *p != '\0' && *p != ',')
@@ -861,6 +916,9 @@ void ff_rtsp_parse_line(RTSPMessageHeader *reply, const char *buf,
} else if (av_stristart(p, "x-Accept-Dynamic-Rate:", &p) && rt) {
p += strspn(p, SPACE_CHARS);
rt->accept_dynamic_rate = atoi(p);
+ } else if (av_stristart(p, "Content-Type:", &p)) {
+ p += strspn(p, SPACE_CHARS);
+ av_strlcpy(reply->content_type, p, sizeof(reply->content_type));
}
}
@@ -898,9 +956,13 @@ int ff_rtsp_read_reply(AVFormatContext *s, RTSPMessageHeader *reply,
char buf[4096], buf1[1024], *q;
unsigned char ch;
const char *p;
- int ret, content_length, line_count = 0;
+ int ret, content_length, line_count = 0, request = 0;
unsigned char *content = NULL;
+start:
+ line_count = 0;
+ request = 0;
+ content = NULL;
memset(reply, 0, sizeof(*reply));
/* parse reply (XXX: use buffers) */
@@ -936,9 +998,15 @@ int ff_rtsp_read_reply(AVFormatContext *s, RTSPMessageHeader *reply,
if (line_count == 0) {
/* get reply code */
get_word(buf1, sizeof(buf1), &p);
- get_word(buf1, sizeof(buf1), &p);
- reply->status_code = atoi(buf1);
- av_strlcpy(reply->reason, p, sizeof(reply->reason));
+ if (!strncmp(buf1, "RTSP/", 5)) {
+ get_word(buf1, sizeof(buf1), &p);
+ reply->status_code = atoi(buf1);
+ av_strlcpy(reply->reason, p, sizeof(reply->reason));
+ } else {
+ av_strlcpy(reply->reason, buf1, sizeof(reply->reason)); // method
+ get_word(buf1, sizeof(buf1), &p); // object
+ request = 1;
+ }
} else {
ff_rtsp_parse_line(reply, p, rt, method);
av_strlcat(rt->last_reply, p, sizeof(rt->last_reply));
@@ -947,7 +1015,7 @@ int ff_rtsp_read_reply(AVFormatContext *s, RTSPMessageHeader *reply,
line_count++;
}
- if (rt->session_id[0] == '\0' && reply->session_id[0] != '\0')
+ if (rt->session_id[0] == '\0' && reply->session_id[0] != '\0' && !request)
av_strlcpy(rt->session_id, reply->session_id, sizeof(rt->session_id));
content_length = reply->content_length;
@@ -962,6 +1030,44 @@ int ff_rtsp_read_reply(AVFormatContext *s, RTSPMessageHeader *reply,
else
av_free(content);
+ if (request) {
+ char buf[1024];
+ char base64buf[AV_BASE64_SIZE(sizeof(buf))];
+ const char* ptr = buf;
+
+ if (!strcmp(reply->reason, "OPTIONS")) {
+ snprintf(buf, sizeof(buf), "RTSP/1.0 200 OK\r\n");
+ if (reply->seq)
+ av_strlcatf(buf, sizeof(buf), "CSeq: %d\r\n", reply->seq);
+ if (reply->session_id[0])
+ av_strlcatf(buf, sizeof(buf), "Session: %s\r\n",
+ reply->session_id);
+ } else {
+ snprintf(buf, sizeof(buf), "RTSP/1.0 501 Not Implemented\r\n");
+ }
+ av_strlcat(buf, "\r\n", sizeof(buf));
+
+ if (rt->control_transport == RTSP_MODE_TUNNEL) {
+ av_base64_encode(base64buf, sizeof(base64buf), buf, strlen(buf));
+ ptr = base64buf;
+ }
+ ffurl_write(rt->rtsp_hd_out, ptr, strlen(ptr));
+
+ rt->last_cmd_time = av_gettime();
+ /* Even if the request from the server had data, it is not the data
+ * that the caller wants or expects. The memory could also be leaked
+ * if the actual following reply has content data. */
+ if (content_ptr)
+ av_freep(content_ptr);
+ /* If method is set, this is called from ff_rtsp_send_cmd,
+ * where a reply to exactly this request is awaited. For
+ * callers from within packet receiving, we just want to
+ * return to the caller and go back to receiving packets. */
+ if (method)
+ goto start;
+ return 0;
+ }
+
if (rt->seq != reply->seq) {
av_log(s, AV_LOG_WARNING, "CSeq %d expected, %d received.\n",
rt->seq, reply->seq);
@@ -1072,7 +1178,7 @@ int ff_rtsp_send_cmd_with_content(AVFormatContext *s,
{
RTSPState *rt = s->priv_data;
HTTPAuthType cur_auth_type;
- int ret;
+ int ret, attempts = 0;
retry:
cur_auth_type = rt->auth_state.auth_type;
@@ -1083,9 +1189,11 @@ retry:
if ((ret = ff_rtsp_read_reply(s, reply, content_ptr, 0, method) ) < 0)
return ret;
+ attempts++;
- if (reply->status_code == 401 && cur_auth_type == HTTP_AUTH_NONE &&
- rt->auth_state.auth_type != HTTP_AUTH_NONE)
+ if (reply->status_code == 401 &&
+ (cur_auth_type == HTTP_AUTH_NONE || rt->auth_state.stale) &&
+ rt->auth_state.auth_type != HTTP_AUTH_NONE && attempts < 2)
goto retry;
if (reply->status_code > 400){
@@ -1103,7 +1211,7 @@ int ff_rtsp_make_setup_request(AVFormatContext *s, const char *host, int port,
int lower_transport, const char *real_challenge)
{
RTSPState *rt = s->priv_data;
- int rtx = 0, j, i, err, interleave = 0;
+ int rtx = 0, j, i, err, interleave = 0, port_off;
RTSPStream *rtsp_st;
RTSPMessageHeader reply1, *reply = &reply1;
char cmd[2048];
@@ -1111,6 +1219,8 @@ int ff_rtsp_make_setup_request(AVFormatContext *s, const char *host, int port,
if (rt->transport == RTSP_TRANSPORT_RDT)
trans_pref = "x-pn-tng";
+ else if (rt->transport == RTSP_TRANSPORT_RAW)
+ trans_pref = "RAW/RAW";
else
trans_pref = "RTP/AVP";
@@ -1121,7 +1231,14 @@ int ff_rtsp_make_setup_request(AVFormatContext *s, const char *host, int port,
/* XXX: we assume the same server is used for the control of each
* RTSP stream */
- for (j = RTSP_RTP_PORT_MIN, i = 0; i < rt->nb_rtsp_streams; ++i) {
+ /* Choose a random starting offset within the first half of the
+ * port range, to allow for a number of ports to try even if the offset
+ * happens to be at the end of the random range. */
+ port_off = av_get_random_seed() % ((rt->rtp_port_max - rt->rtp_port_min)/2);
+ /* even random offset */
+ port_off -= port_off & 0x01;
+
+ for (j = rt->rtp_port_min + port_off, i = 0; i < rt->nb_rtsp_streams; ++i) {
char transport[2048];
/*
@@ -1158,16 +1275,14 @@ int ff_rtsp_make_setup_request(AVFormatContext *s, const char *host, int port,
}
/* first try in specified port range */
- if (RTSP_RTP_PORT_MIN != 0) {
- while (j <= RTSP_RTP_PORT_MAX) {
- ff_url_join(buf, sizeof(buf), "rtp", NULL, host, -1,
- "?localport=%d", j);
- /* we will use two ports per rtp stream (rtp and rtcp) */
- j += 2;
- if (ffurl_open(&rtsp_st->rtp_handle, buf, AVIO_FLAG_READ_WRITE,
- &s->interrupt_callback, NULL) == 0)
- goto rtp_opened;
- }
+ while (j <= rt->rtp_port_max) {
+ ff_url_join(buf, sizeof(buf), "rtp", NULL, host, -1,
+ "?localport=%d", j);
+ /* we will use two ports per rtp stream (rtp and rtcp) */
+ j += 2;
+ if (!ffurl_open(&rtsp_st->rtp_handle, buf, AVIO_FLAG_READ_WRITE,
+ &s->interrupt_callback, NULL))
+ goto rtp_opened;
}
av_log(s, AV_LOG_ERROR, "Unable to open an input RTP port\n");
@@ -1194,8 +1309,9 @@ int ff_rtsp_make_setup_request(AVFormatContext *s, const char *host, int port,
* UDP. When trying to set it up for TCP streams, the server
* will return an error. Therefore, we skip those streams. */
if (rt->server_type == RTSP_SERVER_WMS &&
- s->streams[rtsp_st->stream_index]->codec->codec_type ==
- AVMEDIA_TYPE_DATA)
+ (rtsp_st->stream_index < 0 ||
+ s->streams[rtsp_st->stream_index]->codec->codec_type ==
+ AVMEDIA_TYPE_DATA))
continue;
snprintf(transport, sizeof(transport) - 1,
"%s/TCP;", trans_pref);
@@ -1212,7 +1328,7 @@ int ff_rtsp_make_setup_request(AVFormatContext *s, const char *host, int port,
"%s/UDP;multicast", trans_pref);
}
if (s->oformat) {
- av_strlcat(transport, ";mode=receive", sizeof(transport));
+ av_strlcat(transport, ";mode=record", sizeof(transport));
} else if (rt->server_type == RTSP_SERVER_REAL ||
rt->server_type == RTSP_SERVER_WMS)
av_strlcat(transport, ";mode=play", sizeof(transport));
@@ -1295,7 +1411,7 @@ int ff_rtsp_make_setup_request(AVFormatContext *s, const char *host, int port,
break;
}
case RTSP_LOWER_TRANSPORT_UDP_MULTICAST: {
- char url[1024], namebuf[50];
+ char url[1024], namebuf[50], optbuf[20] = "";
struct sockaddr_storage addr;
int port, ttl;
@@ -1308,10 +1424,12 @@ int ff_rtsp_make_setup_request(AVFormatContext *s, const char *host, int port,
port = rtsp_st->sdp_port;
ttl = rtsp_st->sdp_ttl;
}
+ if (ttl > 0)
+ snprintf(optbuf, sizeof(optbuf), "?ttl=%d", ttl);
getnameinfo((struct sockaddr*) &addr, sizeof(addr),
namebuf, sizeof(namebuf), NULL, 0, NI_NUMERICHOST);
ff_url_join(url, sizeof(url), "rtp", NULL, namebuf,
- port, "?ttl=%d", ttl);
+ port, "%s", optbuf);
if (ffurl_open(&rtsp_st->rtp_handle, url, AVIO_FLAG_READ_WRITE,
&s->interrupt_callback, NULL) < 0) {
err = AVERROR_INVALIDDATA;
@@ -1321,11 +1439,11 @@ int ff_rtsp_make_setup_request(AVFormatContext *s, const char *host, int port,
}
}
- if ((err = rtsp_open_transport_ctx(s, rtsp_st)))
+ if ((err = ff_rtsp_open_transport_ctx(s, rtsp_st)))
goto fail;
}
- if (reply->timeout > 0)
+ if (rt->nb_rtsp_streams && reply->timeout > 0)
rt->timeout = reply->timeout;
if (rt->server_type == RTSP_SERVER_REAL)
@@ -1350,7 +1468,6 @@ int ff_rtsp_connect(AVFormatContext *s)
{
RTSPState *rt = s->priv_data;
char host[1024], path[1024], tcpname[1024], cmd[2048], auth[128];
- char *option_list, *option, *filename;
int port, err, tcp_fd;
RTSPMessageHeader reply1 = {0}, *reply = &reply1;
int lower_transport_mask = 0;
@@ -1358,9 +1475,19 @@ int ff_rtsp_connect(AVFormatContext *s)
struct sockaddr_storage peer;
socklen_t peer_len = sizeof(peer);
+ if (rt->rtp_port_max < rt->rtp_port_min) {
+ av_log(s, AV_LOG_ERROR, "Invalid UDP port range, max port %d less "
+ "than min port %d\n", rt->rtp_port_max,
+ rt->rtp_port_min);
+ return AVERROR(EINVAL);
+ }
+
if (!ff_network_init())
return AVERROR(EIO);
+ if (s->max_delay < 0) /* Not set by the caller */
+ s->max_delay = s->iformat ? DEFAULT_REORDERING_DELAY : 0;
+
rt->control_transport = RTSP_MODE_PLAIN;
if (rt->lower_transport_mask & (1 << RTSP_LOWER_TRANSPORT_HTTP)) {
rt->lower_transport_mask = 1 << RTSP_LOWER_TRANSPORT_TCP;
@@ -1380,51 +1507,6 @@ redirect:
if (port < 0)
port = RTSP_DEFAULT_PORT;
-#if FF_API_RTSP_URL_OPTIONS
- /* search for options */
- option_list = strrchr(path, '?');
- if (option_list) {
- /* Strip out the RTSP specific options, write out the rest of
- * the options back into the same string. */
- filename = option_list;
- while (option_list) {
- int handled = 1;
- /* move the option pointer */
- option = ++option_list;
- option_list = strchr(option_list, '&');
- if (option_list)
- *option_list = 0;
-
- /* handle the options */
- if (!strcmp(option, "udp")) {
- lower_transport_mask |= (1<< RTSP_LOWER_TRANSPORT_UDP);
- } else if (!strcmp(option, "multicast")) {
- lower_transport_mask |= (1<< RTSP_LOWER_TRANSPORT_UDP_MULTICAST);
- } else if (!strcmp(option, "tcp")) {
- lower_transport_mask |= (1<< RTSP_LOWER_TRANSPORT_TCP);
- } else if(!strcmp(option, "http")) {
- lower_transport_mask |= (1<< RTSP_LOWER_TRANSPORT_TCP);
- rt->control_transport = RTSP_MODE_TUNNEL;
- } else if (!strcmp(option, "filter_src")) {
- rt->rtsp_flags |= RTSP_FLAG_FILTER_SRC;
- } else {
- /* Write options back into the buffer, using memmove instead
- * of strcpy since the strings may overlap. */
- int len = strlen(option);
- memmove(++filename, option, len);
- filename += len;
- if (option_list) *filename = '&';
- handled = 0;
- }
- if (handled)
- av_log(s, AV_LOG_WARNING, "Options passed via URL are "
- "deprecated, use -rtsp_transport "
- "and -rtsp_flags instead.\n");
- }
- *filename = 0;
- }
-#endif
-
if (!lower_transport_mask)
lower_transport_mask = (1 << RTSP_LOWER_TRANSPORT_NB) - 1;
@@ -1627,6 +1709,7 @@ static int udp_read_packet(AVFormatContext *s, RTSPStream **prtsp_st,
int n, i, ret, tcp_fd, timeout_cnt = 0;
int max_p = 0;
struct pollfd *p = rt->p;
+ int *fds = NULL, fdsnum, fdsidx;
for (;;) {
if (ff_check_interrupt(&s->interrupt_callback))
@@ -1644,10 +1727,21 @@ static int udp_read_packet(AVFormatContext *s, RTSPStream **prtsp_st,
for (i = 0; i < rt->nb_rtsp_streams; i++) {
rtsp_st = rt->rtsp_streams[i];
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 = ff_rtp_get_rtcp_file_handle(rtsp_st->rtp_handle);
- p[max_p++].events = POLLIN;
+ if (ret = ffurl_get_multi_file_handle(rtsp_st->rtp_handle,
+ &fds, &fdsnum)) {
+ av_log(s, AV_LOG_ERROR, "Unable to recover rtp ports\n");
+ return ret;
+ }
+ if (fdsnum != 2) {
+ av_log(s, AV_LOG_ERROR,
+ "Number of fds %d not supported\n", fdsnum);
+ return AVERROR_INVALIDDATA;
+ }
+ for (fdsidx = 0; fdsidx < fdsnum; fdsidx++) {
+ p[max_p].fd = fds[fdsidx];
+ p[max_p++].events = POLLIN;
+ }
+ av_free(fds);
}
}
n = poll(p, max_p, POLL_TIMEOUT_MS);
@@ -1669,14 +1763,24 @@ static int udp_read_packet(AVFormatContext *s, RTSPStream **prtsp_st,
}
#if CONFIG_RTSP_DEMUXER
if (tcp_fd != -1 && p[0].revents & POLLIN) {
- RTSPMessageHeader reply;
-
- ret = ff_rtsp_read_reply(s, &reply, NULL, 0, NULL);
- if (ret < 0)
- return ret;
- /* XXX: parse message */
- if (rt->state != RTSP_STATE_STREAMING)
- return 0;
+ if (rt->rtsp_flags & RTSP_FLAG_LISTEN) {
+ if (rt->state == RTSP_STATE_STREAMING) {
+ if (!ff_rtsp_parse_streaming_commands(s))
+ return AVERROR_EOF;
+ else
+ av_log(s, AV_LOG_WARNING,
+ "Unable to answer to TEARDOWN\n");
+ } else
+ return 0;
+ } else {
+ RTSPMessageHeader reply;
+ ret = ff_rtsp_read_reply(s, &reply, NULL, 0, NULL);
+ if (ret < 0)
+ return ret;
+ /* XXX: parse message */
+ if (rt->state != RTSP_STATE_STREAMING)
+ return 0;
+ }
}
#endif
} else if (n == 0 && ++timeout_cnt >= MAX_TIMEOUTS) {
@@ -1686,6 +1790,50 @@ static int udp_read_packet(AVFormatContext *s, RTSPStream **prtsp_st,
}
}
+static int pick_stream(AVFormatContext *s, RTSPStream **rtsp_st,
+ const uint8_t *buf, int len)
+{
+ RTSPState *rt = s->priv_data;
+ int i;
+ if (len < 0)
+ return len;
+ if (rt->nb_rtsp_streams == 1) {
+ *rtsp_st = rt->rtsp_streams[0];
+ return len;
+ }
+ if (len >= 8 && rt->transport == RTSP_TRANSPORT_RTP) {
+ if (RTP_PT_IS_RTCP(rt->recvbuf[1])) {
+ int no_ssrc = 0;
+ for (i = 0; i < rt->nb_rtsp_streams; i++) {
+ RTPDemuxContext *rtpctx = rt->rtsp_streams[i]->transport_priv;
+ if (!rtpctx)
+ continue;
+ if (rtpctx->ssrc == AV_RB32(&buf[4])) {
+ *rtsp_st = rt->rtsp_streams[i];
+ return len;
+ }
+ if (!rtpctx->ssrc)
+ no_ssrc = 1;
+ }
+ if (no_ssrc) {
+ av_log(s, AV_LOG_WARNING,
+ "Unable to pick stream for packet - SSRC not known for "
+ "all streams\n");
+ return AVERROR(EAGAIN);
+ }
+ } else {
+ for (i = 0; i < rt->nb_rtsp_streams; i++) {
+ if ((buf[1] & 0x7f) == rt->rtsp_streams[i]->sdp_payload_type) {
+ *rtsp_st = rt->rtsp_streams[i];
+ return len;
+ }
+ }
+ }
+ }
+ av_log(s, AV_LOG_WARNING, "Unable to pick stream for packet\n");
+ return AVERROR(EAGAIN);
+}
+
int ff_rtsp_fetch_packet(AVFormatContext *s, AVPacket *pkt)
{
RTSPState *rt = s->priv_data;
@@ -1700,8 +1848,16 @@ int ff_rtsp_fetch_packet(AVFormatContext *s, AVPacket *pkt)
if (rt->cur_transport_priv) {
if (rt->transport == RTSP_TRANSPORT_RDT) {
ret = ff_rdt_parse_packet(rt->cur_transport_priv, pkt, NULL, 0);
- } else
+ } else if (rt->transport == RTSP_TRANSPORT_RTP) {
ret = ff_rtp_parse_packet(rt->cur_transport_priv, pkt, NULL, 0);
+ } else if (rt->ts && CONFIG_RTPDEC) {
+ ret = ff_mpegts_parse_packet(rt->ts, pkt, rt->recvbuf + rt->recvbuf_pos, rt->recvbuf_len - rt->recvbuf_pos);
+ if (ret >= 0) {
+ rt->recvbuf_pos += ret;
+ ret = rt->recvbuf_pos < rt->recvbuf_len;
+ }
+ } else
+ ret = -1;
if (ret == 0) {
rt->cur_transport_priv = NULL;
return 0;
@@ -1711,7 +1867,6 @@ int ff_rtsp_fetch_packet(AVFormatContext *s, AVPacket *pkt)
rt->cur_transport_priv = NULL;
}
-redo:
if (rt->transport == RTSP_TRANSPORT_RTP) {
int i;
int64_t first_queue_time = 0;
@@ -1727,15 +1882,12 @@ redo:
first_queue_st = rt->rtsp_streams[i];
}
}
- if (first_queue_time) {
+ if (first_queue_time)
wait_end = first_queue_time + s->max_delay;
- } else {
- wait_end = 0;
- first_queue_st = NULL;
- }
}
/* read next RTP packet */
+ redo:
if (!rt->recvbuf) {
rt->recvbuf = av_malloc(RECVBUF_SIZE);
if (!rt->recvbuf)
@@ -1753,7 +1905,13 @@ redo:
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)
- ff_rtp_check_and_send_back_rr(rtsp_st->transport_priv, len);
+ ff_rtp_check_and_send_back_rr(rtsp_st->transport_priv, rtsp_st->rtp_handle, NULL, len);
+ break;
+ case RTSP_LOWER_TRANSPORT_CUSTOM:
+ len = ffio_read_partial(s->pb, rt->recvbuf, RECVBUF_SIZE);
+ len = pick_stream(s, &rtsp_st, rt->recvbuf, len);
+ if (len > 0 && rtsp_st->transport_priv && rt->transport == RTSP_TRANSPORT_RTP)
+ ff_rtp_check_and_send_back_rr(rtsp_st->transport_priv, NULL, s->pb, len);
break;
}
if (len == AVERROR(EAGAIN) && first_queue_st &&
@@ -1768,7 +1926,7 @@ redo:
return AVERROR_EOF;
if (rt->transport == RTSP_TRANSPORT_RDT) {
ret = ff_rdt_parse_packet(rtsp_st->transport_priv, pkt, &rt->recvbuf, len);
- } else {
+ } else if (rt->transport == RTSP_TRANSPORT_RTP) {
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
@@ -1807,6 +1965,20 @@ redo:
return AVERROR_EOF;
}
}
+ } else if (rt->ts && CONFIG_RTPDEC) {
+ ret = ff_mpegts_parse_packet(rt->ts, pkt, rt->recvbuf, len);
+ if (ret >= 0) {
+ if (ret < len) {
+ rt->recvbuf_len = len;
+ rt->recvbuf_pos = ret;
+ rt->cur_transport_priv = rt->ts;
+ return 1;
+ } else {
+ ret = 0;
+ }
+ }
+ } else {
+ return AVERROR_INVALIDDATA;
}
end:
if (ret < 0)
@@ -1839,7 +2011,7 @@ static int sdp_probe(AVProbeData *p1)
return 0;
}
-static int sdp_read_header(AVFormatContext *s, AVFormatParameters *ap)
+static int sdp_read_header(AVFormatContext *s)
{
RTSPState *rt = s->priv_data;
RTSPStream *rtsp_st;
@@ -1850,6 +2022,11 @@ static int sdp_read_header(AVFormatContext *s, AVFormatParameters *ap)
if (!ff_network_init())
return AVERROR(EIO);
+ if (s->max_delay < 0) /* Not set by the caller */
+ s->max_delay = DEFAULT_REORDERING_DELAY;
+ if (rt->rtsp_flags & RTSP_FLAG_CUSTOM_IO)
+ rt->lower_transport = RTSP_LOWER_TRANSPORT_CUSTOM;
+
/* read the whole sdp file */
/* XXX: better loading */
content = av_malloc(SDP_MAX_SIZE);
@@ -1869,19 +2046,21 @@ static int sdp_read_header(AVFormatContext *s, AVFormatParameters *ap)
char namebuf[50];
rtsp_st = rt->rtsp_streams[i];
- getnameinfo((struct sockaddr*) &rtsp_st->sdp_ip, sizeof(rtsp_st->sdp_ip),
- namebuf, sizeof(namebuf), NULL, 0, NI_NUMERICHOST);
- ff_url_join(url, sizeof(url), "rtp", NULL,
- namebuf, rtsp_st->sdp_port,
- "?localport=%d&ttl=%d&connect=%d", rtsp_st->sdp_port,
- rtsp_st->sdp_ttl,
- rt->rtsp_flags & RTSP_FLAG_FILTER_SRC ? 1 : 0);
- if (ffurl_open(&rtsp_st->rtp_handle, url, AVIO_FLAG_READ_WRITE,
- &s->interrupt_callback, NULL) < 0) {
- err = AVERROR_INVALIDDATA;
- goto fail;
+ if (!(rt->rtsp_flags & RTSP_FLAG_CUSTOM_IO)) {
+ getnameinfo((struct sockaddr*) &rtsp_st->sdp_ip, sizeof(rtsp_st->sdp_ip),
+ namebuf, sizeof(namebuf), NULL, 0, NI_NUMERICHOST);
+ ff_url_join(url, sizeof(url), "rtp", NULL,
+ namebuf, rtsp_st->sdp_port,
+ "?localport=%d&ttl=%d&connect=%d", rtsp_st->sdp_port,
+ rtsp_st->sdp_ttl,
+ rt->rtsp_flags & RTSP_FLAG_FILTER_SRC ? 1 : 0);
+ if (ffurl_open(&rtsp_st->rtp_handle, url, AVIO_FLAG_READ_WRITE,
+ &s->interrupt_callback, NULL) < 0) {
+ err = AVERROR_INVALIDDATA;
+ goto fail;
+ }
}
- if ((err = rtsp_open_transport_ctx(s, rtsp_st)))
+ if ((err = ff_rtsp_open_transport_ctx(s, rtsp_st)))
goto fail;
}
return 0;
@@ -1913,7 +2092,7 @@ AVInputFormat ff_sdp_demuxer = {
.read_header = sdp_read_header,
.read_packet = ff_rtsp_fetch_packet,
.read_close = sdp_read_close,
- .priv_class = &sdp_demuxer_class
+ .priv_class = &sdp_demuxer_class,
};
#endif /* CONFIG_SDP_DEMUXER */
@@ -1925,15 +2104,14 @@ static int rtp_probe(AVProbeData *p)
return 0;
}
-static int rtp_read_header(AVFormatContext *s,
- AVFormatParameters *ap)
+static int rtp_read_header(AVFormatContext *s)
{
uint8_t recvbuf[1500];
char host[500], sdp[500];
int ret, port;
URLContext* in = NULL;
int payload_type;
- AVCodecContext codec;
+ AVCodecContext codec = { 0 };
struct sockaddr_storage addr;
AVIOContext pb;
socklen_t addrlen = sizeof(addr);
@@ -1964,6 +2142,9 @@ static int rtp_read_header(AVFormatContext *s,
continue;
}
+ if (RTP_PT_IS_RTCP(recvbuf[1]))
+ continue;
+
payload_type = recvbuf[1] & 0x7f;
break;
}
@@ -1971,7 +2152,6 @@ static int rtp_read_header(AVFormatContext *s,
ffurl_close(in);
in = NULL;
- memset(&codec, 0, sizeof(codec));
if (ff_rtp_get_codec_info(&codec, payload_type)) {
av_log(s, AV_LOG_ERROR, "Unable to receive RTP payload type %d "
"without an SDP file describing it\n",
@@ -2003,7 +2183,7 @@ static int rtp_read_header(AVFormatContext *s,
rt->media_type_mask = (1 << (AVMEDIA_TYPE_DATA+1)) - 1;
- ret = sdp_read_header(s, ap);
+ ret = sdp_read_header(s);
s->pb = NULL;
return ret;
@@ -2023,14 +2203,13 @@ static const AVClass rtp_demuxer_class = {
AVInputFormat ff_rtp_demuxer = {
.name = "rtp",
- .long_name = NULL_IF_CONFIG_SMALL("RTP input format"),
+ .long_name = NULL_IF_CONFIG_SMALL("RTP input"),
.priv_data_size = sizeof(RTSPState),
.read_probe = rtp_probe,
.read_header = rtp_read_header,
.read_packet = ff_rtsp_fetch_packet,
.read_close = sdp_read_close,
- .flags = AVFMT_NOFILE,
- .priv_class = &rtp_demuxer_class
+ .flags = AVFMT_NOFILE,
+ .priv_class = &rtp_demuxer_class,
};
#endif /* CONFIG_RTP_DEMUXER */
-
diff --git a/gst-libs/ext/libav/libavformat/rtsp.h b/gst-libs/ext/libav/libavformat/rtsp.h
index 9d05289..3260f6c 100644
--- a/gst-libs/ext/libav/libavformat/rtsp.h
+++ b/gst-libs/ext/libav/libavformat/rtsp.h
@@ -42,6 +42,10 @@ enum RTSPLowerTransport {
RTSP_LOWER_TRANSPORT_HTTP = 8, /**< HTTP tunneled - not a proper
transport mode as such,
only for use via AVOptions */
+ RTSP_LOWER_TRANSPORT_CUSTOM = 16, /**< Custom IO - not a public
+ option for lower_transport_mask,
+ but set in the SDP demuxer based
+ on a flag. */
};
/**
@@ -52,6 +56,7 @@ enum RTSPLowerTransport {
enum RTSPTransport {
RTSP_TRANSPORT_RTP, /**< Standards-compliant RTP */
RTSP_TRANSPORT_RDT, /**< Realmedia Data Transport */
+ RTSP_TRANSPORT_RAW, /**< Raw data (over UDP) */
RTSP_TRANSPORT_NB
};
@@ -102,6 +107,9 @@ typedef struct RTSPTransportField {
* packets will be allowed to make before being discarded. */
int ttl;
+ /** transport set to record data */
+ int mode_record;
+
struct sockaddr_storage destination; /**< destination IP address */
char source[INET6_ADDRSTRLEN + 1]; /**< source IP address */
@@ -171,6 +179,11 @@ typedef struct RTSPMessageHeader {
* returned
*/
char reason[256];
+
+ /**
+ * Content type header
+ */
+ char content_type[64];
} RTSPMessageHeader;
/**
@@ -302,6 +315,13 @@ typedef struct RTSPState {
* other cases, this is a copy of AVFormatContext->filename. */
char control_uri[1024];
+ /** The following are used for parsing raw mpegts in udp */
+ //@{
+ struct MpegTSContext *ts;
+ int recvbuf_pos;
+ int recvbuf_len;
+ //@}
+
/** Additional output handle, used when input and output are done
* separately, eg for HTTP tunneling. */
URLContext *rtsp_hd_out;
@@ -359,11 +379,28 @@ typedef struct RTSPState {
* Mask of all requested media types
*/
int media_type_mask;
+
+ /**
+ * Minimum and maximum local UDP ports.
+ */
+ int rtp_port_min, rtp_port_max;
+
+ /**
+ * Timeout to wait for incoming connections.
+ */
+ int initial_timeout;
+
+ /**
+ * Size of RTP packet reordering queue.
+ */
+ int reordering_queue_size;
} RTSPState;
#define RTSP_FLAG_FILTER_SRC 0x1 /**< Filter incoming UDP packets -
receive packets only from the right
source address and port. */
+#define RTSP_FLAG_LISTEN 0x2 /**< Wait for incoming connections. */
+#define RTSP_FLAG_CUSTOM_IO 0x4 /**< Do all IO via the AVIOContext. */
/**
* Describe a single stream, as identified by a single m= line block in the
@@ -392,7 +429,7 @@ typedef struct RTSPStream {
int sdp_payload_type; /**< payload type */
//@}
- /** The following are used for dynamic protocols (rtp_*.c/rdt.c) */
+ /** The following are used for dynamic protocols (rtpdec_*.c/rdt.c) */
//@{
/** handler structure */
RTPDynamicProtocolHandler *dynamic_handler;
@@ -516,6 +553,12 @@ int ff_rtsp_setup_input_streams(AVFormatContext *s, RTSPMessageHeader *reply);
int ff_rtsp_setup_output_streams(AVFormatContext *s, const char *addr);
/**
+ * Parse RTSP commands (OPTIONS, PAUSE and TEARDOWN) during streaming in
+ * listen mode.
+ */
+int ff_rtsp_parse_streaming_commands(AVFormatContext *s);
+
+/**
* Parse an SDP description of streams by populating an RTSPState struct
* within the AVFormatContext; also allocate the RTP streams and the
* pollfd array used for UDP streams.
@@ -548,6 +591,11 @@ int ff_rtsp_make_setup_request(AVFormatContext *s, const char *host, int port,
*/
void ff_rtsp_undo_setup(AVFormatContext *s);
+/**
+ * Open RTSP transport context.
+ */
+int ff_rtsp_open_transport_ctx(AVFormatContext *s, RTSPStream *rtsp_st);
+
extern const AVOption ff_rtsp_options[];
#endif /* AVFORMAT_RTSP_H */
diff --git a/gst-libs/ext/libav/libavformat/rtspcodes.h b/gst-libs/ext/libav/libavformat/rtspcodes.h
index 63ceb66..31ab336 100644
--- a/gst-libs/ext/libav/libavformat/rtspcodes.h
+++ b/gst-libs/ext/libav/libavformat/rtspcodes.h
@@ -37,4 +37,18 @@ RTSP_STATUS_SERVICE =503, /**< Service Unavailable */
RTSP_STATUS_VERSION =505, /**< RTSP Version not supported */
};
+enum RTSPMethod {
+ DESCRIBE,
+ ANNOUNCE,
+ OPTIONS,
+ SETUP,
+ PLAY,
+ PAUSE,
+ TEARDOWN,
+ GET_PARAMETER,
+ SET_PARAMETER,
+ REDIRECT,
+ RECORD,
+ UNKNOWN = -1,
+};
#endif /* AVFORMAT_RTSPCODES_H */
diff --git a/gst-libs/ext/libav/libavformat/rtspdec.c b/gst-libs/ext/libav/libavformat/rtspdec.c
index 1b4982f..7e7fb2d 100644
--- a/gst-libs/ext/libav/libavformat/rtspdec.c
+++ b/gst-libs/ext/libav/libavformat/rtspdec.c
@@ -22,6 +22,8 @@
#include "libavutil/avstring.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/mathematics.h"
+#include "libavutil/random_seed.h"
+#include "libavutil/time.h"
#include "avformat.h"
#include "internal.h"
@@ -31,6 +33,462 @@
#include "rdt.h"
#include "url.h"
+static const struct RTSPStatusMessage {
+ enum RTSPStatusCode code;
+ const char *message;
+} status_messages[] = {
+ { RTSP_STATUS_OK, "OK" },
+ { RTSP_STATUS_METHOD, "Method Not Allowed" },
+ { RTSP_STATUS_BANDWIDTH, "Not Enough Bandwidth" },
+ { RTSP_STATUS_SESSION, "Session Not Found" },
+ { RTSP_STATUS_STATE, "Method Not Valid in This State" },
+ { RTSP_STATUS_AGGREGATE, "Aggregate operation not allowed" },
+ { RTSP_STATUS_ONLY_AGGREGATE, "Only aggregate operation allowed" },
+ { RTSP_STATUS_TRANSPORT, "Unsupported transport" },
+ { RTSP_STATUS_INTERNAL, "Internal Server Error" },
+ { RTSP_STATUS_SERVICE, "Service Unavailable" },
+ { RTSP_STATUS_VERSION, "RTSP Version not supported" },
+ { 0, "NULL" }
+};
+
+static int rtsp_read_close(AVFormatContext *s)
+{
+ RTSPState *rt = s->priv_data;
+
+ if (!(rt->rtsp_flags & RTSP_FLAG_LISTEN))
+ ff_rtsp_send_cmd_async(s, "TEARDOWN", rt->control_uri, NULL);
+
+ ff_rtsp_close_streams(s);
+ ff_rtsp_close_connections(s);
+ ff_network_close();
+ rt->real_setup = NULL;
+ av_freep(&rt->real_setup_cache);
+ return 0;
+}
+
+static inline int read_line(AVFormatContext *s, char *rbuf, const int rbufsize,
+ int *rbuflen)
+{
+ RTSPState *rt = s->priv_data;
+ int idx = 0;
+ int ret = 0;
+ *rbuflen = 0;
+
+ do {
+ ret = ffurl_read_complete(rt->rtsp_hd, rbuf + idx, 1);
+ if (ret <= 0)
+ return ret ? ret : AVERROR_EOF;
+ if (rbuf[idx] == '\r') {
+ /* Ignore */
+ } else if (rbuf[idx] == '\n') {
+ rbuf[idx] = '\0';
+ *rbuflen = idx;
+ return 0;
+ } else
+ idx++;
+ } while (idx < rbufsize);
+ av_log(s, AV_LOG_ERROR, "Message too long\n");
+ return AVERROR(EIO);
+}
+
+static int rtsp_send_reply(AVFormatContext *s, enum RTSPStatusCode code,
+ const char *extracontent, uint16_t seq)
+{
+ RTSPState *rt = s->priv_data;
+ char message[4096];
+ int index = 0;
+ while (status_messages[index].code) {
+ if (status_messages[index].code == code) {
+ snprintf(message, sizeof(message), "RTSP/1.0 %d %s\r\n",
+ code, status_messages[index].message);
+ break;
+ }
+ index++;
+ }
+ if (!status_messages[index].code)
+ return AVERROR(EINVAL);
+ av_strlcatf(message, sizeof(message), "CSeq: %d\r\n", seq);
+ av_strlcatf(message, sizeof(message), "Server: %s\r\n", LIBAVFORMAT_IDENT);
+ if (extracontent)
+ av_strlcat(message, extracontent, sizeof(message));
+ av_strlcat(message, "\r\n", sizeof(message));
+ av_dlog(s, "Sending response:\n%s", message);
+ ffurl_write(rt->rtsp_hd, message, strlen(message));
+
+ return 0;
+}
+
+static inline int check_sessionid(AVFormatContext *s,
+ RTSPMessageHeader *request)
+{
+ RTSPState *rt = s->priv_data;
+ unsigned char *session_id = rt->session_id;
+ if (!session_id[0]) {
+ av_log(s, AV_LOG_WARNING, "There is no session-id at the moment\n");
+ return 0;
+ }
+ if (strcmp(session_id, request->session_id)) {
+ av_log(s, AV_LOG_ERROR, "Unexpected session-id %s\n",
+ request->session_id);
+ rtsp_send_reply(s, RTSP_STATUS_SESSION, NULL, request->seq);
+ return AVERROR_STREAM_NOT_FOUND;
+ }
+ return 0;
+}
+
+static inline int rtsp_read_request(AVFormatContext *s,
+ RTSPMessageHeader *request,
+ const char *method)
+{
+ RTSPState *rt = s->priv_data;
+ char rbuf[1024];
+ int rbuflen, ret;
+ do {
+ ret = read_line(s, rbuf, sizeof(rbuf), &rbuflen);
+ if (ret)
+ return ret;
+ if (rbuflen > 1) {
+ av_dlog(s, "Parsing[%d]: %s\n", rbuflen, rbuf);
+ ff_rtsp_parse_line(request, rbuf, rt, method);
+ }
+ } while (rbuflen > 0);
+ if (request->seq != rt->seq + 1) {
+ av_log(s, AV_LOG_ERROR, "Unexpected Sequence number %d\n",
+ request->seq);
+ return AVERROR(EINVAL);
+ }
+ if (rt->session_id[0] && strcmp(method, "OPTIONS")) {
+ ret = check_sessionid(s, request);
+ if (ret)
+ return ret;
+ }
+
+ return 0;
+}
+
+static int rtsp_read_announce(AVFormatContext *s)
+{
+ RTSPState *rt = s->priv_data;
+ RTSPMessageHeader request = { 0 };
+ char sdp[4096];
+ int ret;
+
+ ret = rtsp_read_request(s, &request, "ANNOUNCE");
+ if (ret)
+ return ret;
+ rt->seq++;
+ if (strcmp(request.content_type, "application/sdp")) {
+ av_log(s, AV_LOG_ERROR, "Unexpected content type %s\n",
+ request.content_type);
+ rtsp_send_reply(s, RTSP_STATUS_SERVICE, NULL, request.seq);
+ return AVERROR_OPTION_NOT_FOUND;
+ }
+ if (request.content_length && request.content_length < sizeof(sdp) - 1) {
+ /* Read SDP */
+ if (ffurl_read_complete(rt->rtsp_hd, sdp, request.content_length)
+ < request.content_length) {
+ av_log(s, AV_LOG_ERROR,
+ "Unable to get complete SDP Description in ANNOUNCE\n");
+ rtsp_send_reply(s, RTSP_STATUS_INTERNAL, NULL, request.seq);
+ return AVERROR(EIO);
+ }
+ sdp[request.content_length] = '\0';
+ av_log(s, AV_LOG_VERBOSE, "SDP: %s\n", sdp);
+ ret = ff_sdp_parse(s, sdp);
+ if (ret)
+ return ret;
+ rtsp_send_reply(s, RTSP_STATUS_OK, NULL, request.seq);
+ return 0;
+ }
+ av_log(s, AV_LOG_ERROR,
+ "Content-Length header value exceeds sdp allocated buffer (4KB)\n");
+ rtsp_send_reply(s, RTSP_STATUS_INTERNAL,
+ "Content-Length exceeds buffer size", request.seq);
+ return AVERROR(EIO);
+}
+
+static int rtsp_read_options(AVFormatContext *s)
+{
+ RTSPState *rt = s->priv_data;
+ RTSPMessageHeader request = { 0 };
+ int ret = 0;
+
+ /* Parsing headers */
+ ret = rtsp_read_request(s, &request, "OPTIONS");
+ if (ret)
+ return ret;
+ rt->seq++;
+ /* Send Reply */
+ rtsp_send_reply(s, RTSP_STATUS_OK,
+ "Public: ANNOUNCE, PAUSE, SETUP, TEARDOWN, RECORD\r\n",
+ request.seq);
+ return 0;
+}
+
+static int rtsp_read_setup(AVFormatContext *s, char* host, char *controlurl)
+{
+ RTSPState *rt = s->priv_data;
+ RTSPMessageHeader request = { 0 };
+ int ret = 0;
+ char url[1024];
+ RTSPStream *rtsp_st;
+ char responseheaders[1024];
+ int localport = -1;
+ int transportidx = 0;
+ int streamid = 0;
+
+ ret = rtsp_read_request(s, &request, "SETUP");
+ if (ret)
+ return ret;
+ rt->seq++;
+ if (!request.nb_transports) {
+ av_log(s, AV_LOG_ERROR, "No transport defined in SETUP\n");
+ return AVERROR_INVALIDDATA;
+ }
+ for (transportidx = 0; transportidx < request.nb_transports;
+ transportidx++) {
+ if (!request.transports[transportidx].mode_record ||
+ (request.transports[transportidx].lower_transport !=
+ RTSP_LOWER_TRANSPORT_UDP &&
+ request.transports[transportidx].lower_transport !=
+ RTSP_LOWER_TRANSPORT_TCP)) {
+ av_log(s, AV_LOG_ERROR, "mode=record/receive not set or transport"
+ " protocol not supported (yet)\n");
+ return AVERROR_INVALIDDATA;
+ }
+ }
+ if (request.nb_transports > 1)
+ av_log(s, AV_LOG_WARNING, "More than one transport not supported, "
+ "using first of all\n");
+ for (streamid = 0; streamid < rt->nb_rtsp_streams; streamid++) {
+ if (!strcmp(rt->rtsp_streams[streamid]->control_url,
+ controlurl))
+ break;
+ }
+ if (streamid == rt->nb_rtsp_streams) {
+ av_log(s, AV_LOG_ERROR, "Unable to find requested track\n");
+ return AVERROR_STREAM_NOT_FOUND;
+ }
+ rtsp_st = rt->rtsp_streams[streamid];
+ localport = rt->rtp_port_min;
+
+ if (request.transports[0].lower_transport == RTSP_LOWER_TRANSPORT_TCP) {
+ rt->lower_transport = RTSP_LOWER_TRANSPORT_TCP;
+ if ((ret = ff_rtsp_open_transport_ctx(s, rtsp_st))) {
+ rtsp_send_reply(s, RTSP_STATUS_TRANSPORT, NULL, request.seq);
+ return ret;
+ }
+ rtsp_st->interleaved_min = request.transports[0].interleaved_min;
+ rtsp_st->interleaved_max = request.transports[0].interleaved_max;
+ snprintf(responseheaders, sizeof(responseheaders), "Transport: "
+ "RTP/AVP/TCP;unicast;mode=receive;interleaved=%d-%d"
+ "\r\n", request.transports[0].interleaved_min,
+ request.transports[0].interleaved_max);
+ } else {
+ do {
+ ff_url_join(url, sizeof(url), "rtp", NULL, host, localport, NULL);
+ av_dlog(s, "Opening: %s", url);
+ ret = ffurl_open(&rtsp_st->rtp_handle, url, AVIO_FLAG_READ_WRITE,
+ &s->interrupt_callback, NULL);
+ if (ret)
+ localport += 2;
+ } while (ret || localport > rt->rtp_port_max);
+ if (localport > rt->rtp_port_max) {
+ rtsp_send_reply(s, RTSP_STATUS_TRANSPORT, NULL, request.seq);
+ return ret;
+ }
+
+ av_dlog(s, "Listening on: %d",
+ ff_rtp_get_local_rtp_port(rtsp_st->rtp_handle));
+ if ((ret = ff_rtsp_open_transport_ctx(s, rtsp_st))) {
+ rtsp_send_reply(s, RTSP_STATUS_TRANSPORT, NULL, request.seq);
+ return ret;
+ }
+
+ localport = ff_rtp_get_local_rtp_port(rtsp_st->rtp_handle);
+ snprintf(responseheaders, sizeof(responseheaders), "Transport: "
+ "RTP/AVP/UDP;unicast;mode=receive;source=%s;"
+ "client_port=%d-%d;server_port=%d-%d\r\n",
+ host, request.transports[0].client_port_min,
+ request.transports[0].client_port_max, localport,
+ localport + 1);
+ }
+
+ /* Establish sessionid if not previously set */
+ /* Put this in a function? */
+ /* RFC 2326: session id must be at least 8 digits */
+ while (strlen(rt->session_id) < 8)
+ av_strlcatf(rt->session_id, 512, "%u", av_get_random_seed());
+
+ av_strlcatf(responseheaders, sizeof(responseheaders), "Session: %s\r\n",
+ rt->session_id);
+ /* Send Reply */
+ rtsp_send_reply(s, RTSP_STATUS_OK, responseheaders, request.seq);
+
+ rt->state = RTSP_STATE_PAUSED;
+ return 0;
+}
+
+static int rtsp_read_record(AVFormatContext *s)
+{
+ RTSPState *rt = s->priv_data;
+ RTSPMessageHeader request = { 0 };
+ int ret = 0;
+ char responseheaders[1024];
+
+ ret = rtsp_read_request(s, &request, "RECORD");
+ if (ret)
+ return ret;
+ ret = check_sessionid(s, &request);
+ if (ret)
+ return ret;
+ rt->seq++;
+ snprintf(responseheaders, sizeof(responseheaders), "Session: %s\r\n",
+ rt->session_id);
+ rtsp_send_reply(s, RTSP_STATUS_OK, responseheaders, request.seq);
+
+ rt->state = RTSP_STATE_STREAMING;
+ return 0;
+}
+
+static inline int parse_command_line(AVFormatContext *s, const char *line,
+ int linelen, char *uri, int urisize,
+ char *method, int methodsize,
+ enum RTSPMethod *methodcode)
+{
+ RTSPState *rt = s->priv_data;
+ const char *linept, *searchlinept;
+ linept = strchr(line, ' ');
+ if (linept - line > methodsize - 1) {
+ av_log(s, AV_LOG_ERROR, "Method string too long\n");
+ return AVERROR(EIO);
+ }
+ memcpy(method, line, linept - line);
+ method[linept - line] = '\0';
+ linept++;
+ if (!strcmp(method, "ANNOUNCE"))
+ *methodcode = ANNOUNCE;
+ else if (!strcmp(method, "OPTIONS"))
+ *methodcode = OPTIONS;
+ else if (!strcmp(method, "RECORD"))
+ *methodcode = RECORD;
+ else if (!strcmp(method, "SETUP"))
+ *methodcode = SETUP;
+ else if (!strcmp(method, "PAUSE"))
+ *methodcode = PAUSE;
+ else if (!strcmp(method, "TEARDOWN"))
+ *methodcode = TEARDOWN;
+ else
+ *methodcode = UNKNOWN;
+ /* Check method with the state */
+ if (rt->state == RTSP_STATE_IDLE) {
+ if ((*methodcode != ANNOUNCE) && (*methodcode != OPTIONS)) {
+ av_log(s, AV_LOG_ERROR, "Unexpected command in Idle State %s\n",
+ line);
+ return AVERROR_PROTOCOL_NOT_FOUND;
+ }
+ } else if (rt->state == RTSP_STATE_PAUSED) {
+ if ((*methodcode != OPTIONS) && (*methodcode != RECORD)
+ && (*methodcode != SETUP)) {
+ av_log(s, AV_LOG_ERROR, "Unexpected command in Paused State %s\n",
+ line);
+ return AVERROR_PROTOCOL_NOT_FOUND;
+ }
+ } else if (rt->state == RTSP_STATE_STREAMING) {
+ if ((*methodcode != PAUSE) && (*methodcode != OPTIONS)
+ && (*methodcode != TEARDOWN)) {
+ av_log(s, AV_LOG_ERROR, "Unexpected command in Streaming State"
+ " %s\n", line);
+ return AVERROR_PROTOCOL_NOT_FOUND;
+ }
+ } else {
+ av_log(s, AV_LOG_ERROR, "Unexpected State [%d]\n", rt->state);
+ return AVERROR_BUG;
+ }
+
+ searchlinept = strchr(linept, ' ');
+ if (searchlinept == NULL) {
+ av_log(s, AV_LOG_ERROR, "Error parsing message URI\n");
+ return AVERROR_INVALIDDATA;
+ }
+ if (searchlinept - linept > urisize - 1) {
+ av_log(s, AV_LOG_ERROR, "uri string length exceeded buffer size\n");
+ return AVERROR(EIO);
+ }
+ memcpy(uri, linept, searchlinept - linept);
+ uri[searchlinept - linept] = '\0';
+ if (strcmp(rt->control_uri, uri)) {
+ char host[128], path[512], auth[128];
+ int port;
+ char ctl_host[128], ctl_path[512], ctl_auth[128];
+ int ctl_port;
+ av_url_split(NULL, 0, auth, sizeof(auth), host, sizeof(host), &port,
+ path, sizeof(path), uri);
+ av_url_split(NULL, 0, ctl_auth, sizeof(ctl_auth), ctl_host,
+ sizeof(ctl_host), &ctl_port, ctl_path, sizeof(ctl_path),
+ rt->control_uri);
+ if (strcmp(host, ctl_host))
+ av_log(s, AV_LOG_INFO, "Host %s differs from expected %s\n",
+ host, ctl_host);
+ if (strcmp(path, ctl_path) && *methodcode != SETUP)
+ av_log(s, AV_LOG_WARNING, "WARNING: Path %s differs from expected"
+ " %s\n", path, ctl_path);
+ if (*methodcode == ANNOUNCE) {
+ av_log(s, AV_LOG_INFO,
+ "Updating control URI to %s\n", uri);
+ av_strlcpy(rt->control_uri, uri, sizeof(rt->control_uri));
+ }
+ }
+
+ linept = searchlinept + 1;
+ if (!av_strstart(linept, "RTSP/1.0", NULL)) {
+ av_log(s, AV_LOG_ERROR, "Error parsing protocol or version\n");
+ return AVERROR_PROTOCOL_NOT_FOUND;
+ }
+ return 0;
+}
+
+int ff_rtsp_parse_streaming_commands(AVFormatContext *s)
+{
+ RTSPState *rt = s->priv_data;
+ unsigned char rbuf[4096];
+ unsigned char method[10];
+ char uri[500];
+ int ret;
+ int rbuflen = 0;
+ RTSPMessageHeader request = { 0 };
+ enum RTSPMethod methodcode;
+
+ ret = read_line(s, rbuf, sizeof(rbuf), &rbuflen);
+ if (ret < 0)
+ return ret;
+ ret = parse_command_line(s, rbuf, rbuflen, uri, sizeof(uri), method,
+ sizeof(method), &methodcode);
+ if (ret) {
+ av_log(s, AV_LOG_ERROR, "RTSP: Unexpected Command\n");
+ return ret;
+ }
+
+ ret = rtsp_read_request(s, &request, method);
+ if (ret)
+ return ret;
+ rt->seq++;
+ if (methodcode == PAUSE) {
+ rt->state = RTSP_STATE_PAUSED;
+ ret = rtsp_send_reply(s, RTSP_STATUS_OK, NULL , request.seq);
+ // TODO: Missing date header in response
+ } else if (methodcode == OPTIONS) {
+ ret = rtsp_send_reply(s, RTSP_STATUS_OK,
+ "Public: ANNOUNCE, PAUSE, SETUP, TEARDOWN, "
+ "RECORD\r\n", request.seq);
+ } else if (methodcode == TEARDOWN) {
+ rt->state = RTSP_STATE_IDLE;
+ ret = rtsp_send_reply(s, RTSP_STATUS_OK, NULL , request.seq);
+ return 0;
+ }
+ return ret;
+}
+
static int rtsp_read_play(AVFormatContext *s)
{
RTSPState *rt = s->priv_data;
@@ -143,6 +601,71 @@ int ff_rtsp_setup_input_streams(AVFormatContext *s, RTSPMessageHeader *reply)
return 0;
}
+static int rtsp_listen(AVFormatContext *s)
+{
+ RTSPState *rt = s->priv_data;
+ char host[128], path[512], auth[128];
+ char uri[500];
+ int port;
+ char tcpname[500];
+ unsigned char rbuf[4096];
+ unsigned char method[10];
+ int rbuflen = 0;
+ int ret;
+ enum RTSPMethod methodcode;
+
+ /* extract hostname and port */
+ av_url_split(NULL, 0, auth, sizeof(auth), host, sizeof(host), &port,
+ path, sizeof(path), s->filename);
+
+ /* ff_url_join. No authorization by now (NULL) */
+ ff_url_join(rt->control_uri, sizeof(rt->control_uri), "rtsp", NULL, host,
+ port, "%s", path);
+
+ if (port < 0)
+ port = RTSP_DEFAULT_PORT;
+
+ /* Create TCP connection */
+ ff_url_join(tcpname, sizeof(tcpname), "tcp", NULL, host, port,
+ "?listen&listen_timeout=%d", rt->initial_timeout * 1000);
+
+ if (ret = ffurl_open(&rt->rtsp_hd, tcpname, AVIO_FLAG_READ_WRITE,
+ &s->interrupt_callback, NULL)) {
+ av_log(s, AV_LOG_ERROR, "Unable to open RTSP for listening\n");
+ return ret;
+ }
+ rt->state = RTSP_STATE_IDLE;
+ rt->rtsp_hd_out = rt->rtsp_hd;
+ for (;;) { /* Wait for incoming RTSP messages */
+ ret = read_line(s, rbuf, sizeof(rbuf), &rbuflen);
+ if (ret < 0)
+ return ret;
+ ret = parse_command_line(s, rbuf, rbuflen, uri, sizeof(uri), method,
+ sizeof(method), &methodcode);
+ if (ret) {
+ av_log(s, AV_LOG_ERROR, "RTSP: Unexpected Command\n");
+ return ret;
+ }
+
+ if (methodcode == ANNOUNCE) {
+ ret = rtsp_read_announce(s);
+ rt->state = RTSP_STATE_PAUSED;
+ } else if (methodcode == OPTIONS) {
+ ret = rtsp_read_options(s);
+ } else if (methodcode == RECORD) {
+ ret = rtsp_read_record(s);
+ if (!ret)
+ return 0; // We are ready for streaming
+ } else if (methodcode == SETUP)
+ ret = rtsp_read_setup(s, host, uri);
+ if (ret) {
+ ffurl_close(rt->rtsp_hd);
+ return AVERROR_INVALIDDATA;
+ }
+ }
+ return 0;
+}
+
static int rtsp_probe(AVProbeData *p)
{
if (av_strstart(p->filename, "rtsp:", NULL))
@@ -150,28 +673,37 @@ static int rtsp_probe(AVProbeData *p)
return 0;
}
-static int rtsp_read_header(AVFormatContext *s,
- AVFormatParameters *ap)
+static int rtsp_read_header(AVFormatContext *s)
{
RTSPState *rt = s->priv_data;
int ret;
- ret = ff_rtsp_connect(s);
- if (ret)
- return ret;
-
- rt->real_setup_cache = av_mallocz(2 * s->nb_streams * sizeof(*rt->real_setup_cache));
- if (!rt->real_setup_cache)
- return AVERROR(ENOMEM);
- rt->real_setup = rt->real_setup_cache + s->nb_streams;
+ if (rt->initial_timeout > 0)
+ rt->rtsp_flags |= RTSP_FLAG_LISTEN;
- if (rt->initial_pause) {
- /* do not start immediately */
+ if (rt->rtsp_flags & RTSP_FLAG_LISTEN) {
+ ret = rtsp_listen(s);
+ if (ret)
+ return ret;
} else {
- if (rtsp_read_play(s) < 0) {
- ff_rtsp_close_streams(s);
- ff_rtsp_close_connections(s);
- return AVERROR_INVALIDDATA;
+ ret = ff_rtsp_connect(s);
+ if (ret)
+ return ret;
+
+ rt->real_setup_cache = !s->nb_streams ? NULL :
+ av_mallocz(2 * s->nb_streams * sizeof(*rt->real_setup_cache));
+ if (!rt->real_setup_cache && s->nb_streams)
+ return AVERROR(ENOMEM);
+ rt->real_setup = rt->real_setup_cache + s->nb_streams;
+
+ if (rt->initial_pause) {
+ /* do not start immediately */
+ } else {
+ if (rtsp_read_play(s) < 0) {
+ ff_rtsp_close_streams(s);
+ ff_rtsp_close_connections(s);
+ return AVERROR_INVALIDDATA;
+ }
}
}
@@ -335,14 +867,21 @@ retry:
}
rt->packets++;
- /* send dummy request to keep TCP connection alive */
- if ((av_gettime() - rt->last_cmd_time) / 1000000 >= rt->timeout / 2) {
- if (rt->server_type == RTSP_SERVER_WMS ||
- (rt->server_type != RTSP_SERVER_REAL &&
- rt->get_parameter_supported)) {
- ff_rtsp_send_cmd_async(s, "GET_PARAMETER", rt->control_uri, NULL);
- } else {
- ff_rtsp_send_cmd_async(s, "OPTIONS", "*", NULL);
+ if (!(rt->rtsp_flags & RTSP_FLAG_LISTEN)) {
+ /* send dummy request to keep TCP connection alive */
+ if ((av_gettime() - rt->last_cmd_time) / 1000000 >= rt->timeout / 2 ||
+ rt->auth_state.stale) {
+ if (rt->server_type == RTSP_SERVER_WMS ||
+ (rt->server_type != RTSP_SERVER_REAL &&
+ rt->get_parameter_supported)) {
+ ff_rtsp_send_cmd_async(s, "GET_PARAMETER", rt->control_uri, NULL);
+ } else {
+ ff_rtsp_send_cmd_async(s, "OPTIONS", "*", NULL);
+ }
+ /* The stale flag should be reset when creating the auth response in
+ * ff_rtsp_send_cmd_async, but reset it here just in case we never
+ * called the auth code (if we didn't have any credentials set). */
+ rt->auth_state.stale = 0;
}
}
@@ -375,21 +914,7 @@ static int rtsp_read_seek(AVFormatContext *s, int stream_index,
return 0;
}
-static int rtsp_read_close(AVFormatContext *s)
-{
- RTSPState *rt = s->priv_data;
-
- ff_rtsp_send_cmd_async(s, "TEARDOWN", rt->control_uri, NULL);
-
- ff_rtsp_close_streams(s);
- ff_rtsp_close_connections(s);
- ff_network_close();
- rt->real_setup = NULL;
- av_freep(&rt->real_setup_cache);
- return 0;
-}
-
-const AVClass rtsp_demuxer_class = {
+static const AVClass rtsp_demuxer_class = {
.class_name = "RTSP demuxer",
.item_name = av_default_item_name,
.option = ff_rtsp_options,
@@ -398,15 +923,15 @@ const AVClass rtsp_demuxer_class = {
AVInputFormat ff_rtsp_demuxer = {
.name = "rtsp",
- .long_name = NULL_IF_CONFIG_SMALL("RTSP input format"),
+ .long_name = NULL_IF_CONFIG_SMALL("RTSP input"),
.priv_data_size = sizeof(RTSPState),
.read_probe = rtsp_probe,
.read_header = rtsp_read_header,
.read_packet = rtsp_read_packet,
.read_close = rtsp_read_close,
.read_seek = rtsp_read_seek,
- .flags = AVFMT_NOFILE,
- .read_play = rtsp_read_play,
- .read_pause = rtsp_read_pause,
- .priv_class = &rtsp_demuxer_class,
+ .flags = AVFMT_NOFILE,
+ .read_play = rtsp_read_play,
+ .read_pause = rtsp_read_pause,
+ .priv_class = &rtsp_demuxer_class,
};
diff --git a/gst-libs/ext/libav/libavformat/rtspenc.c b/gst-libs/ext/libav/libavformat/rtspenc.c
index e4e79ca..9b3c7c9 100644
--- a/gst-libs/ext/libav/libavformat/rtspenc.c
+++ b/gst-libs/ext/libav/libavformat/rtspenc.c
@@ -21,7 +21,6 @@
#include "avformat.h"
-#include <sys/time.h>
#if HAVE_POLL_H
#include <poll.h>
#endif
@@ -32,6 +31,7 @@
#include "avio_internal.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/avstring.h"
+#include "libavutil/time.h"
#include "url.h"
#define SDP_MAX_SIZE 16384
@@ -159,7 +159,7 @@ static int tcp_write_packet(AVFormatContext *s, RTSPStream *rtsp_st)
size -= 4;
if (packet_len > size || packet_len < 2)
break;
- if (ptr[1] >= RTCP_SR && ptr[1] <= RTCP_APP)
+ if (RTP_PT_IS_RTCP(ptr[1]))
id = rtsp_st->interleaved_max; /* RTCP */
else
id = rtsp_st->interleaved_min; /* RTP */
@@ -235,14 +235,13 @@ static int rtsp_write_close(AVFormatContext *s)
AVOutputFormat ff_rtsp_muxer = {
.name = "rtsp",
- .long_name = NULL_IF_CONFIG_SMALL("RTSP output format"),
+ .long_name = NULL_IF_CONFIG_SMALL("RTSP output"),
.priv_data_size = sizeof(RTSPState),
- .audio_codec = CODEC_ID_AAC,
- .video_codec = CODEC_ID_MPEG4,
+ .audio_codec = AV_CODEC_ID_AAC,
+ .video_codec = AV_CODEC_ID_MPEG4,
.write_header = rtsp_write_header,
.write_packet = rtsp_write_packet,
.write_trailer = rtsp_write_close,
- .flags = AVFMT_NOFILE | AVFMT_GLOBALHEADER,
- .priv_class = &rtsp_muxer_class,
+ .flags = AVFMT_NOFILE | AVFMT_GLOBALHEADER,
+ .priv_class = &rtsp_muxer_class,
};
-
diff --git a/gst-libs/ext/libav/libavformat/sapdec.c b/gst-libs/ext/libav/libavformat/sapdec.c
index 531cfd2..c1cdc8f 100644
--- a/gst-libs/ext/libav/libavformat/sapdec.c
+++ b/gst-libs/ext/libav/libavformat/sapdec.c
@@ -30,7 +30,6 @@
#if HAVE_POLL_H
#include <poll.h>
#endif
-#include <sys/time.h>
struct SAPState {
URLContext *ann_fd;
@@ -60,8 +59,7 @@ static int sap_read_close(AVFormatContext *s)
return 0;
}
-static int sap_read_header(AVFormatContext *s,
- AVFormatParameters *ap)
+static int sap_read_header(AVFormatContext *s)
{
struct SAPState *sap = s->priv_data;
char host[1024], path[1024], url[1024];
@@ -229,12 +227,11 @@ static int sap_fetch_packet(AVFormatContext *s, AVPacket *pkt)
AVInputFormat ff_sap_demuxer = {
.name = "sap",
- .long_name = NULL_IF_CONFIG_SMALL("SAP input format"),
+ .long_name = NULL_IF_CONFIG_SMALL("SAP input"),
.priv_data_size = sizeof(struct SAPState),
.read_probe = sap_probe,
.read_header = sap_read_header,
.read_packet = sap_fetch_packet,
.read_close = sap_read_close,
- .flags = AVFMT_NOFILE,
+ .flags = AVFMT_NOFILE,
};
-
diff --git a/gst-libs/ext/libav/libavformat/sapenc.c b/gst-libs/ext/libav/libavformat/sapenc.c
index d8ec465..7e2bba7 100644
--- a/gst-libs/ext/libav/libavformat/sapenc.c
+++ b/gst-libs/ext/libav/libavformat/sapenc.c
@@ -23,7 +23,9 @@
#include "libavutil/parseutils.h"
#include "libavutil/random_seed.h"
#include "libavutil/avstring.h"
+#include "libavutil/dict.h"
#include "libavutil/intreadwrite.h"
+#include "libavutil/time.h"
#include "internal.h"
#include "network.h"
#include "os_support.h"
@@ -75,6 +77,7 @@ static int sap_write_header(AVFormatContext *s)
struct sockaddr_storage localaddr;
socklen_t addrlen = sizeof(localaddr);
int udp_fd;
+ AVDictionaryEntry* title = av_dict_get(s->metadata, "title", NULL, 0);
if (!ff_network_init())
return AVERROR(EIO);
@@ -104,8 +107,7 @@ static int sap_write_header(AVFormatContext *s)
}
if (!announce_addr[0]) {
- struct addrinfo hints, *ai = NULL;
- memset(&hints, 0, sizeof(hints));
+ struct addrinfo hints = { 0 }, *ai = NULL;
hints.ai_family = AF_UNSPEC;
if (getaddrinfo(host, NULL, &hints, &ai)) {
av_log(s, AV_LOG_ERROR, "Unable to resolve %s\n", host);
@@ -151,11 +153,16 @@ static int sap_write_header(AVFormatContext *s)
ret = AVERROR(EIO);
goto fail;
}
- s->streams[i]->priv_data = contexts[i] =
- ff_rtp_chain_mux_open(s, s->streams[i], fd, 0);
+ ret = ff_rtp_chain_mux_open(&contexts[i], s, s->streams[i], fd, 0, i);
+ if (ret < 0)
+ goto fail;
+ s->streams[i]->priv_data = contexts[i];
av_strlcpy(contexts[i]->filename, url, sizeof(contexts[i]->filename));
}
+ if (s->nb_streams > 0 && title)
+ av_dict_set(&contexts[0]->metadata, "title", title->value, 0);
+
ff_url_join(url, sizeof(url), "udp", NULL, announce_addr, port,
"?ttl=%d&connect=1", ttl);
ret = ffurl_open(&sap->ann_fd, url, AVIO_FLAG_WRITE,
@@ -210,7 +217,7 @@ static int sap_write_header(AVFormatContext *s)
pos += strlen(&sap->ann[pos]) + 1;
if (av_sdp_create(contexts, s->nb_streams, &sap->ann[pos],
- sap->ann_size - pos)) {
+ sap->ann_size - pos)) {
ret = AVERROR_INVALIDDATA;
goto fail;
}
@@ -252,13 +259,12 @@ static int sap_write_packet(AVFormatContext *s, AVPacket *pkt)
AVOutputFormat ff_sap_muxer = {
.name = "sap",
- .long_name = NULL_IF_CONFIG_SMALL("SAP output format"),
+ .long_name = NULL_IF_CONFIG_SMALL("SAP output"),
.priv_data_size = sizeof(struct SAPState),
- .audio_codec = CODEC_ID_AAC,
- .video_codec = CODEC_ID_MPEG4,
+ .audio_codec = AV_CODEC_ID_AAC,
+ .video_codec = AV_CODEC_ID_MPEG4,
.write_header = sap_write_header,
.write_packet = sap_write_packet,
.write_trailer = sap_write_close,
- .flags = AVFMT_NOFILE | AVFMT_GLOBALHEADER,
+ .flags = AVFMT_NOFILE | AVFMT_GLOBALHEADER,
};
-
diff --git a/gst-libs/ext/libav/libavformat/sctp.c b/gst-libs/ext/libav/libavformat/sctp.c
new file mode 100644
index 0000000..b8ab63e
--- /dev/null
+++ b/gst-libs/ext/libav/libavformat/sctp.c
@@ -0,0 +1,330 @@
+/*
+ * SCTP protocol
+ * Copyright (c) 2012 Luca Barbato
+ *
+ * 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
+ *
+ * sctp url_protocol
+ *
+ * url syntax: sctp://host:port[?option=val...]
+ * option: 'listen' : listen for an incoming connection
+ * 'max_streams=n' : set the maximum number of streams
+ * 'reuse=1' : enable reusing the socket [TBD]
+ *
+ * by setting the maximum number of streams the protocol will use the
+ * first two bytes of the incoming/outgoing buffer to store the
+ * stream number of the packet being read/written.
+ * @see sctp_read
+ * @see sctp_write
+ */
+
+
+#include <netinet/in.h>
+#include <netinet/sctp.h>
+
+#include "config.h"
+
+#if HAVE_POLL_H
+#include <poll.h>
+#endif
+
+#include "libavutil/intreadwrite.h"
+#include "libavutil/parseutils.h"
+#include "avformat.h"
+#include "internal.h"
+#include "network.h"
+#include "os_support.h"
+#include "url.h"
+
+/*
+ * The sctp_recvmsg and sctp_sendmsg functions are part of the user
+ * library that offers support
+ * for the SCTP kernel Implementation. The main purpose of this
+ * code is to provide the SCTP Socket API mappings for user
+ * application to interface with the SCTP in kernel.
+ *
+ * This implementation is based on the Socket API Extensions for SCTP
+ * defined in <draft-ietf-tsvwg-sctpsocket-10.txt>
+ *
+ * Copyright (c) 2003 International Business Machines, Corp.
+ *
+ * Written or modified by:
+ * Ryan Layer <rmlayer@us.ibm.com>
+ */
+
+static int ff_sctp_recvmsg(int s, void *msg, size_t len, struct sockaddr *from,
+ socklen_t *fromlen, struct sctp_sndrcvinfo *sinfo,
+ int *msg_flags)
+{
+ int recvb;
+ struct iovec iov;
+ char incmsg[CMSG_SPACE(sizeof(struct sctp_sndrcvinfo))];
+ struct msghdr inmsg = { 0 };
+ struct cmsghdr *cmsg = NULL;
+
+ iov.iov_base = msg;
+ iov.iov_len = len;
+
+ inmsg.msg_name = from;
+ inmsg.msg_namelen = fromlen ? *fromlen : 0;
+ inmsg.msg_iov = &iov;
+ inmsg.msg_iovlen = 1;
+ inmsg.msg_control = incmsg;
+ inmsg.msg_controllen = sizeof(incmsg);
+
+ if ((recvb = recvmsg(s, &inmsg, msg_flags ? *msg_flags : 0)) < 0)
+ return recvb;
+
+ if (fromlen)
+ *fromlen = inmsg.msg_namelen;
+ if (msg_flags)
+ *msg_flags = inmsg.msg_flags;
+
+ for (cmsg = CMSG_FIRSTHDR(&inmsg); cmsg != NULL;
+ cmsg = CMSG_NXTHDR(&inmsg, cmsg)) {
+ if ((IPPROTO_SCTP == cmsg->cmsg_level) &&
+ (SCTP_SNDRCV == cmsg->cmsg_type))
+ break;
+ }
+
+ /* Copy sinfo. */
+ if (cmsg)
+ memcpy(sinfo, CMSG_DATA(cmsg), sizeof(struct sctp_sndrcvinfo));
+
+ return recvb;
+}
+
+static int ff_sctp_send(int s, const void *msg, size_t len,
+ const struct sctp_sndrcvinfo *sinfo, int flags)
+{
+ struct msghdr outmsg;
+ struct iovec iov;
+
+ outmsg.msg_name = NULL;
+ outmsg.msg_namelen = 0;
+ outmsg.msg_iov = &iov;
+ iov.iov_base = msg;
+ iov.iov_len = len;
+ outmsg.msg_iovlen = 1;
+ outmsg.msg_controllen = 0;
+
+ if (sinfo) {
+ char outcmsg[CMSG_SPACE(sizeof(struct sctp_sndrcvinfo))];
+ struct cmsghdr *cmsg;
+
+ outmsg.msg_control = outcmsg;
+ outmsg.msg_controllen = sizeof(outcmsg);
+ outmsg.msg_flags = 0;
+
+ cmsg = CMSG_FIRSTHDR(&outmsg);
+ cmsg->cmsg_level = IPPROTO_SCTP;
+ cmsg->cmsg_type = SCTP_SNDRCV;
+ cmsg->cmsg_len = CMSG_LEN(sizeof(struct sctp_sndrcvinfo));
+
+ outmsg.msg_controllen = cmsg->cmsg_len;
+ memcpy(CMSG_DATA(cmsg), sinfo, sizeof(struct sctp_sndrcvinfo));
+ }
+
+ return sendmsg(s, &outmsg, flags);
+}
+
+typedef struct SCTPContext {
+ int fd;
+ int max_streams;
+ struct sockaddr_storage dest_addr;
+ socklen_t dest_addr_len;
+} SCTPContext;
+
+static int sctp_open(URLContext *h, const char *uri, int flags)
+{
+ struct addrinfo *ai, *cur_ai;
+ struct addrinfo hints = { 0 };
+ struct sctp_event_subscribe event = { 0 };
+ struct sctp_initmsg initparams = { 0 };
+ int port;
+ int fd = -1;
+ SCTPContext *s = h->priv_data;
+ const char *p;
+ char buf[256];
+ int ret, listen_socket = 0;
+ char hostname[1024], proto[1024], path[1024];
+ char portstr[10];
+
+ av_url_split(proto, sizeof(proto), NULL, 0, hostname, sizeof(hostname),
+ &port, path, sizeof(path), uri);
+ if (strcmp(proto, "sctp"))
+ return AVERROR(EINVAL);
+ if (port <= 0 || port >= 65536) {
+ av_log(s, AV_LOG_ERROR, "Port missing in uri\n");
+ return AVERROR(EINVAL);
+ }
+
+ s->max_streams = 0;
+ p = strchr(uri, '?');
+ if (p) {
+ if (av_find_info_tag(buf, sizeof(buf), "listen", p))
+ listen_socket = 1;
+ if (av_find_info_tag(buf, sizeof(buf), "max_streams", p))
+ s->max_streams = strtol(buf, NULL, 10);
+ }
+
+ hints.ai_family = AF_UNSPEC;
+ hints.ai_socktype = SOCK_STREAM;
+ snprintf(portstr, sizeof(portstr), "%d", port);
+ ret = getaddrinfo(hostname, portstr, &hints, &ai);
+ if (ret) {
+ av_log(h, AV_LOG_ERROR, "Failed to resolve hostname %s: %s\n",
+ hostname, gai_strerror(ret));
+ return AVERROR(EIO);
+ }
+
+ cur_ai = ai;
+
+ fd = socket(cur_ai->ai_family, SOCK_STREAM, IPPROTO_SCTP);
+ if (fd < 0)
+ goto fail;
+
+ s->dest_addr_len = sizeof(s->dest_addr);
+
+ if (listen_socket) {
+ int fd1;
+ ret = bind(fd, cur_ai->ai_addr, cur_ai->ai_addrlen);
+ listen(fd, 100);
+ fd1 = accept(fd, NULL, NULL);
+ closesocket(fd);
+ fd = fd1;
+ } else
+ ret = connect(fd, cur_ai->ai_addr, cur_ai->ai_addrlen);
+
+ ff_socket_nonblock(fd, 1);
+
+ event.sctp_data_io_event = 1;
+ /* TODO: Subscribe to more event types and handle them */
+
+ if (setsockopt(fd, IPPROTO_SCTP, SCTP_EVENTS, &event,
+ sizeof(event)) != 0) {
+ av_log(h, AV_LOG_ERROR,
+ "SCTP ERROR: Unable to subscribe to events\n");
+ goto fail;
+ }
+
+ if (s->max_streams) {
+ initparams.sinit_max_instreams = s->max_streams;
+ initparams.sinit_num_ostreams = s->max_streams;
+ if (setsockopt(fd, IPPROTO_SCTP, SCTP_INITMSG, &initparams,
+ sizeof(initparams)) < 0)
+ av_log(h, AV_LOG_ERROR,
+ "SCTP ERROR: Unable to initialize socket max streams %d\n",
+ s->max_streams);
+ }
+
+ h->priv_data = s;
+ h->is_streamed = 1;
+ s->fd = fd;
+ freeaddrinfo(ai);
+ return 0;
+
+fail:
+ ret = AVERROR(EIO);
+ freeaddrinfo(ai);
+ return ret;
+}
+
+static int sctp_wait_fd(int fd, int write)
+{
+ int ev = write ? POLLOUT : POLLIN;
+ struct pollfd p = { .fd = fd, .events = ev, .revents = 0 };
+ int ret;
+
+ ret = poll(&p, 1, 100);
+ return ret < 0 ? ff_neterrno() : p.revents & ev ? 0 : AVERROR(EAGAIN);
+}
+
+static int sctp_read(URLContext *h, uint8_t *buf, int size)
+{
+ SCTPContext *s = h->priv_data;
+ int ret;
+
+ if (!(h->flags & AVIO_FLAG_NONBLOCK)) {
+ ret = sctp_wait_fd(s->fd, 0);
+ if (ret < 0)
+ return ret;
+ }
+
+ if (s->max_streams) {
+ /*StreamId is introduced as a 2byte code into the stream*/
+ struct sctp_sndrcvinfo info = { 0 };
+ ret = ff_sctp_recvmsg(s->fd, buf + 2, size - 2, NULL, 0, &info, 0);
+ AV_WB16(buf, info.sinfo_stream);
+ ret = ret < 0 ? ret : ret + 2;
+ } else
+ ret = recv(s->fd, buf, size, 0);
+
+ return ret < 0 ? ff_neterrno() : ret;
+}
+
+static int sctp_write(URLContext *h, const uint8_t *buf, int size)
+{
+ SCTPContext *s = h->priv_data;
+ int ret;
+
+ if (!(h->flags & AVIO_FLAG_NONBLOCK)) {
+ ret = sctp_wait_fd(s->fd, 1);
+ if (ret < 0)
+ return ret;
+ }
+
+ if (s->max_streams) {
+ /*StreamId is introduced as a 2byte code into the stream*/
+ struct sctp_sndrcvinfo info = { 0 };
+ info.sinfo_stream = AV_RB16(buf);
+ if (info.sinfo_stream > s->max_streams)
+ abort();
+ ret = ff_sctp_send(s->fd, buf + 2, size - 2, &info, MSG_EOR);
+ } else
+ ret = send(s->fd, buf, size, 0);
+
+ return ret < 0 ? ff_neterrno() : ret;
+}
+
+static int sctp_close(URLContext *h)
+{
+ SCTPContext *s = h->priv_data;
+ closesocket(s->fd);
+ return 0;
+}
+
+static int sctp_get_file_handle(URLContext *h)
+{
+ SCTPContext *s = h->priv_data;
+ return s->fd;
+}
+
+URLProtocol ff_sctp_protocol = {
+ .name = "sctp",
+ .url_open = sctp_open,
+ .url_read = sctp_read,
+ .url_write = sctp_write,
+ .url_close = sctp_close,
+ .url_get_file_handle = sctp_get_file_handle,
+ .priv_data_size = sizeof(SCTPContext),
+ .flags = URL_PROTOCOL_FLAG_NETWORK,
+};
diff --git a/gst-libs/ext/libav/libavformat/sdp.c b/gst-libs/ext/libav/libavformat/sdp.c
index d89591f..57044d4 100644
--- a/gst-libs/ext/libav/libavformat/sdp.c
+++ b/gst-libs/ext/libav/libavformat/sdp.c
@@ -88,7 +88,7 @@ static void sdp_write_header(char *buff, int size, struct sdp_session_level *s)
static int resolve_destination(char *dest_addr, int size, char *type,
int type_size)
{
- struct addrinfo hints, *ai;
+ struct addrinfo hints = { 0 }, *ai;
int is_multicast;
av_strlcpy(type, "IP4", type_size);
@@ -98,7 +98,6 @@ static int resolve_destination(char *dest_addr, int size, char *type,
/* Resolve the destination, since it must be written
* as a numeric IP address in the SDP. */
- memset(&hints, 0, sizeof(hints));
if (getaddrinfo(dest_addr, NULL, &hints, &ai))
return 0;
getnameinfo(ai->ai_addr, ai->ai_addrlen, dest_addr, size,
@@ -155,9 +154,11 @@ static char *extradata2psets(AVCodecContext *c)
{
char *psets, *p;
const uint8_t *r;
- const char *pset_string = "; sprop-parameter-sets=";
+ static const char pset_string[] = "; sprop-parameter-sets=";
+ static const char profile_string[] = "; profile-level-id=";
uint8_t *orig_extradata = NULL;
int orig_extradata_size = 0;
+ const uint8_t *sps = NULL, *sps_end;
if (c->extradata_size > MAX_EXTRADATA_SIZE) {
av_log(c, AV_LOG_ERROR, "Too much extradata!\n");
@@ -211,6 +212,10 @@ static char *extradata2psets(AVCodecContext *c)
*p = ',';
p++;
}
+ if (!sps) {
+ sps = r;
+ sps_end = r1;
+ }
if (av_base64_encode(p, MAX_PSET_SIZE - (p - psets), r, r1 - r) == NULL) {
av_log(c, AV_LOG_ERROR, "Cannot Base64-encode %td %td!\n", MAX_PSET_SIZE - (p - psets), r1 - r);
av_free(psets);
@@ -220,6 +225,12 @@ static char *extradata2psets(AVCodecContext *c)
p += strlen(p);
r = r1;
}
+ if (sps && sps_end - sps >= 4) {
+ memcpy(p, profile_string, strlen(profile_string));
+ p += strlen(p);
+ ff_data_to_hex(p, sps + 1, 3, 0);
+ p[6] = '\0';
+ }
if (orig_extradata) {
av_free(c->extradata);
c->extradata = orig_extradata;
@@ -258,10 +269,10 @@ static char *xiph_extradata2config(AVCodecContext *c)
int first_header_size;
switch (c->codec_id) {
- case CODEC_ID_THEORA:
+ case AV_CODEC_ID_THEORA:
first_header_size = 42;
break;
- case CODEC_ID_VORBIS:
+ case AV_CODEC_ID_VORBIS:
first_header_size = 30;
break;
default:
@@ -389,27 +400,35 @@ static char *sdp_write_media_attributes(char *buff, int size, AVCodecContext *c,
char *config = NULL;
switch (c->codec_id) {
- case CODEC_ID_H264:
+ case AV_CODEC_ID_H264: {
+ int mode = 1;
+ if (fmt && fmt->oformat->priv_class &&
+ av_opt_flag_is_set(fmt->priv_data, "rtpflags", "h264_mode0"))
+ mode = 0;
if (c->extradata_size) {
config = extradata2psets(c);
}
av_strlcatf(buff, size, "a=rtpmap:%d H264/90000\r\n"
- "a=fmtp:%d packetization-mode=1%s\r\n",
+ "a=fmtp:%d packetization-mode=%d%s\r\n",
payload_type,
- payload_type, config ? config : "");
+ payload_type, mode, config ? config : "");
break;
- case CODEC_ID_H263:
- case CODEC_ID_H263P:
+ }
+ case AV_CODEC_ID_H263:
+ case AV_CODEC_ID_H263P:
/* a=framesize is required by 3GPP TS 26.234 (PSS). It
* actually specifies the maximum video size, but we only know
* the current size. This is required for playback on Android
* stagefright and on Samsung bada. */
+ if (!fmt || !fmt->oformat->priv_class ||
+ !av_opt_flag_is_set(fmt->priv_data, "rtpflags", "rfc2190") ||
+ c->codec_id == AV_CODEC_ID_H263P)
av_strlcatf(buff, size, "a=rtpmap:%d H263-2000/90000\r\n"
"a=framesize:%d %d-%d\r\n",
payload_type,
payload_type, c->width, c->height);
break;
- case CODEC_ID_MPEG4:
+ case AV_CODEC_ID_MPEG4:
if (c->extradata_size) {
config = extradata2config(c);
}
@@ -418,7 +437,7 @@ static char *sdp_write_media_attributes(char *buff, int size, AVCodecContext *c,
payload_type,
payload_type, config ? config : "");
break;
- case CODEC_ID_AAC:
+ case AV_CODEC_ID_AAC:
if (fmt && fmt->oformat->priv_class &&
av_opt_flag_is_set(fmt->priv_data, "rtpflags", "latm")) {
config = latm_context2config(c);
@@ -449,37 +468,37 @@ static char *sdp_write_media_attributes(char *buff, int size, AVCodecContext *c,
payload_type, config);
}
break;
- case CODEC_ID_PCM_S16BE:
+ case AV_CODEC_ID_PCM_S16BE:
if (payload_type >= RTP_PT_PRIVATE)
av_strlcatf(buff, size, "a=rtpmap:%d L16/%d/%d\r\n",
payload_type,
c->sample_rate, c->channels);
break;
- case CODEC_ID_PCM_MULAW:
+ case AV_CODEC_ID_PCM_MULAW:
if (payload_type >= RTP_PT_PRIVATE)
av_strlcatf(buff, size, "a=rtpmap:%d PCMU/%d/%d\r\n",
payload_type,
c->sample_rate, c->channels);
break;
- case CODEC_ID_PCM_ALAW:
+ case AV_CODEC_ID_PCM_ALAW:
if (payload_type >= RTP_PT_PRIVATE)
av_strlcatf(buff, size, "a=rtpmap:%d PCMA/%d/%d\r\n",
payload_type,
c->sample_rate, c->channels);
break;
- case CODEC_ID_AMR_NB:
+ case AV_CODEC_ID_AMR_NB:
av_strlcatf(buff, size, "a=rtpmap:%d AMR/%d/%d\r\n"
"a=fmtp:%d octet-align=1\r\n",
payload_type, c->sample_rate, c->channels,
payload_type);
break;
- case CODEC_ID_AMR_WB:
+ case AV_CODEC_ID_AMR_WB:
av_strlcatf(buff, size, "a=rtpmap:%d AMR-WB/%d/%d\r\n"
"a=fmtp:%d octet-align=1\r\n",
payload_type, c->sample_rate, c->channels,
payload_type);
break;
- case CODEC_ID_VORBIS:
+ case AV_CODEC_ID_VORBIS:
if (c->extradata_size)
config = xiph_extradata2config(c);
else
@@ -492,7 +511,7 @@ static char *sdp_write_media_attributes(char *buff, int size, AVCodecContext *c,
payload_type, c->sample_rate, c->channels,
payload_type, config);
break;
- case CODEC_ID_THEORA: {
+ case AV_CODEC_ID_THEORA: {
const char *pix_fmt;
if (c->extradata_size)
config = xiph_extradata2config(c);
@@ -502,13 +521,13 @@ static char *sdp_write_media_attributes(char *buff, int size, AVCodecContext *c,
return NULL;
switch (c->pix_fmt) {
- case PIX_FMT_YUV420P:
+ case AV_PIX_FMT_YUV420P:
pix_fmt = "YCbCr-4:2:0";
break;
- case PIX_FMT_YUV422P:
+ case AV_PIX_FMT_YUV422P:
pix_fmt = "YCbCr-4:2:2";
break;
- case PIX_FMT_YUV444P:
+ case AV_PIX_FMT_YUV444P:
pix_fmt = "YCbCr-4:4:4";
break;
default:
@@ -524,17 +543,22 @@ static char *sdp_write_media_attributes(char *buff, int size, AVCodecContext *c,
c->width, c->height, pix_fmt, config);
break;
}
- case CODEC_ID_VP8:
+ case AV_CODEC_ID_VP8:
av_strlcatf(buff, size, "a=rtpmap:%d VP8/90000\r\n",
payload_type);
break;
- case CODEC_ID_ADPCM_G722:
+ case AV_CODEC_ID_MJPEG:
+ if (payload_type >= RTP_PT_PRIVATE)
+ av_strlcatf(buff, size, "a=rtpmap:%d JPEG/90000\r\n",
+ payload_type);
+ break;
+ case AV_CODEC_ID_ADPCM_G722:
if (payload_type >= RTP_PT_PRIVATE)
av_strlcatf(buff, size, "a=rtpmap:%d G722/%d/%d\r\n",
payload_type,
8000, c->channels);
break;
- case CODEC_ID_ADPCM_G726: {
+ case AV_CODEC_ID_ADPCM_G726: {
if (payload_type >= RTP_PT_PRIVATE)
av_strlcatf(buff, size, "a=rtpmap:%d G726-%d/%d\r\n",
payload_type,
@@ -542,6 +566,20 @@ static char *sdp_write_media_attributes(char *buff, int size, AVCodecContext *c,
c->sample_rate);
break;
}
+ case AV_CODEC_ID_ILBC:
+ av_strlcatf(buff, size, "a=rtpmap:%d iLBC/%d\r\n"
+ "a=fmtp:%d mode=%d\r\n",
+ payload_type, c->sample_rate,
+ payload_type, c->block_align == 38 ? 20 : 30);
+ break;
+ case AV_CODEC_ID_SPEEX:
+ av_strlcatf(buff, size, "a=rtpmap:%d speex/%d\r\n",
+ payload_type, c->sample_rate);
+ break;
+ case AV_CODEC_ID_OPUS:
+ av_strlcatf(buff, size, "a=rtpmap:%d opus/48000\r\n",
+ payload_type);
+ break;
default:
/* Nothing special to do here... */
break;
@@ -552,12 +590,15 @@ static char *sdp_write_media_attributes(char *buff, int size, AVCodecContext *c,
return buff;
}
-void ff_sdp_write_media(char *buff, int size, AVCodecContext *c, const char *dest_addr, const char *dest_type, int port, int ttl, AVFormatContext *fmt)
+void ff_sdp_write_media(char *buff, int size, AVStream *st, int idx,
+ const char *dest_addr, const char *dest_type,
+ int port, int ttl, AVFormatContext *fmt)
{
+ AVCodecContext *c = st->codec;
const char *type;
int payload_type;
- payload_type = ff_rtp_get_payload_type(fmt, c);
+ payload_type = ff_rtp_get_payload_type(fmt, c, idx);
switch (c->codec_type) {
case AVMEDIA_TYPE_VIDEO : type = "video" ; break;
@@ -578,12 +619,11 @@ void ff_sdp_write_media(char *buff, int size, AVCodecContext *c, const char *des
int av_sdp_create(AVFormatContext *ac[], int n_files, char *buf, int size)
{
AVDictionaryEntry *title = av_dict_get(ac[0]->metadata, "title", NULL, 0);
- struct sdp_session_level s;
- int i, j, port, ttl, is_multicast;
+ struct sdp_session_level s = { 0 };
+ int i, j, port, ttl, is_multicast, index = 0;
char dst[32], dst_type[5];
memset(buf, 0, size);
- memset(&s, 0, sizeof(struct sdp_session_level));
s.user = "-";
s.src_addr = "127.0.0.1"; /* FIXME: Properly set this */
s.src_type = "IP4";
@@ -619,10 +659,10 @@ int av_sdp_create(AVFormatContext *ac[], int n_files, char *buf, int size)
ttl = 0;
}
for (j = 0; j < ac[i]->nb_streams; j++) {
- ff_sdp_write_media(buf, size,
- ac[i]->streams[j]->codec, dst[0] ? dst : NULL,
- dst_type, (port > 0) ? port + j * 2 : 0, ttl,
- ac[i]);
+ ff_sdp_write_media(buf, size, ac[i]->streams[j], index++,
+ dst[0] ? dst : NULL, dst_type,
+ (port > 0) ? port + j * 2 : 0,
+ ttl, ac[i]);
if (port <= 0) {
av_strlcatf(buf, size,
"a=control:streamid=%d\r\n", i + j);
@@ -638,14 +678,9 @@ int av_sdp_create(AVFormatContext *ac[], int n_files, char *buf, int size)
return AVERROR(ENOSYS);
}
-void ff_sdp_write_media(char *buff, int size, AVCodecContext *c, const char *dest_addr, const char *dest_type, int port, int ttl, AVFormatContext *fmt)
-{
-}
-#endif
-
-#if FF_API_SDP_CREATE
-int avf_sdp_create(AVFormatContext *ac[], int n_files, char *buff, int size)
+void ff_sdp_write_media(char *buff, int size, AVStream *st, int idx,
+ const char *dest_addr, const char *dest_type,
+ int port, int ttl, AVFormatContext *fmt)
{
- return av_sdp_create(ac, n_files, buff, size);
}
#endif
diff --git a/gst-libs/ext/libav/libavformat/seek-test.c b/gst-libs/ext/libav/libavformat/seek-test.c
index 699c693..143f0b5 100644
--- a/gst-libs/ext/libav/libavformat/seek-test.c
+++ b/gst-libs/ext/libav/libavformat/seek-test.c
@@ -28,9 +28,6 @@
#include "libavutil/mathematics.h"
#include "libavformat/avformat.h"
-#undef printf
-#undef fprintf
-
static char buffer[20];
static const char *ret_str(int v)
@@ -93,11 +90,10 @@ int main(int argc, char **argv)
}
for(i=0; ; i++){
- AVPacket pkt;
+ AVPacket pkt = { 0 };
AVStream *av_uninit(st);
char ts_buf[60];
- memset(&pkt, 0, sizeof(pkt));
if(ret>=0){
ret= av_read_frame(ic, &pkt);
if(ret>=0){
diff --git a/gst-libs/ext/libav/libavformat/seek.c b/gst-libs/ext/libav/libavformat/seek.c
index 6c4286b..524cd87 100644
--- a/gst-libs/ext/libav/libavformat/seek.c
+++ b/gst-libs/ext/libav/libavformat/seek.c
@@ -409,13 +409,13 @@ AVParserState *ff_store_parser_state(AVFormatContext *s)
state->fpos = avio_tell(s->pb);
// copy context structures
- state->cur_st = s->cur_st;
state->packet_buffer = s->packet_buffer;
+ state->parse_queue = s->parse_queue;
state->raw_packet_buffer = s->raw_packet_buffer;
state->raw_packet_buffer_remaining_size = s->raw_packet_buffer_remaining_size;
- s->cur_st = NULL;
s->packet_buffer = NULL;
+ s->parse_queue = NULL;
s->raw_packet_buffer = NULL;
s->raw_packet_buffer_remaining_size = RAW_PACKET_BUFFER_SIZE;
@@ -429,19 +429,13 @@ AVParserState *ff_store_parser_state(AVFormatContext *s)
ss->last_IP_pts = st->last_IP_pts;
ss->cur_dts = st->cur_dts;
ss->reference_dts = st->reference_dts;
- ss->cur_ptr = st->cur_ptr;
- ss->cur_len = st->cur_len;
ss->probe_packets = st->probe_packets;
- ss->cur_pkt = st->cur_pkt;
st->parser = NULL;
st->last_IP_pts = AV_NOPTS_VALUE;
st->cur_dts = AV_NOPTS_VALUE;
st->reference_dts = AV_NOPTS_VALUE;
- st->cur_ptr = NULL;
- st->cur_len = 0;
st->probe_packets = MAX_PROBE_PACKETS;
- av_init_packet(&st->cur_pkt);
}
return state;
@@ -460,8 +454,8 @@ void ff_restore_parser_state(AVFormatContext *s, AVParserState *state)
avio_seek(s->pb, state->fpos, SEEK_SET);
// copy context structures
- s->cur_st = state->cur_st;
s->packet_buffer = state->packet_buffer;
+ s->parse_queue = state->parse_queue;
s->raw_packet_buffer = state->raw_packet_buffer;
s->raw_packet_buffer_remaining_size = state->raw_packet_buffer_remaining_size;
@@ -474,10 +468,7 @@ void ff_restore_parser_state(AVFormatContext *s, AVParserState *state)
st->last_IP_pts = ss->last_IP_pts;
st->cur_dts = ss->cur_dts;
st->reference_dts = ss->reference_dts;
- st->cur_ptr = ss->cur_ptr;
- st->cur_len = ss->cur_len;
st->probe_packets = ss->probe_packets;
- st->cur_pkt = ss->cur_pkt;
}
av_free(state->stream_states);
@@ -507,13 +498,12 @@ void ff_free_parser_state(AVFormatContext *s, AVParserState *state)
ss = &state->stream_states[i];
if (ss->parser)
av_parser_close(ss->parser);
- av_free_packet(&ss->cur_pkt);
}
free_packet_list(state->packet_buffer);
+ free_packet_list(state->parse_queue);
free_packet_list(state->raw_packet_buffer);
av_free(state->stream_states);
av_free(state);
}
-
diff --git a/gst-libs/ext/libav/libavformat/seek.h b/gst-libs/ext/libav/libavformat/seek.h
index fd95f49..e79d7bd 100644
--- a/gst-libs/ext/libav/libavformat/seek.h
+++ b/gst-libs/ext/libav/libavformat/seek.h
@@ -31,12 +31,9 @@
typedef struct AVParserStreamState {
// saved members of AVStream
AVCodecParserContext *parser;
- AVPacket cur_pkt;
int64_t last_IP_pts;
int64_t cur_dts;
int64_t reference_dts;
- const uint8_t *cur_ptr;
- int cur_len;
int probe_packets;
} AVParserStreamState;
@@ -47,8 +44,8 @@ typedef struct AVParserState {
int64_t fpos; ///< file position at the time of call
// saved members of AVFormatContext
- AVStream *cur_st; ///< current stream.
AVPacketList *packet_buffer; ///< packet buffer of original state
+ AVPacketList *parse_queue; ///< parse queue of original state
AVPacketList *raw_packet_buffer; ///< raw packet buffer of original state
int raw_packet_buffer_remaining_size; ///< remaining space in raw_packet_buffer
diff --git a/gst-libs/ext/libav/libavformat/segafilm.c b/gst-libs/ext/libav/libavformat/segafilm.c
index 5c346a7..068d432 100644
--- a/gst-libs/ext/libav/libavformat/segafilm.c
+++ b/gst-libs/ext/libav/libavformat/segafilm.c
@@ -49,12 +49,12 @@ typedef struct FilmDemuxContext {
int video_stream_index;
int audio_stream_index;
- enum CodecID audio_type;
+ enum AVCodecID audio_type;
unsigned int audio_samplerate;
unsigned int audio_bits;
unsigned int audio_channels;
- enum CodecID video_type;
+ enum AVCodecID video_type;
unsigned int sample_count;
film_sample *sample_table;
unsigned int current_sample;
@@ -75,8 +75,7 @@ static int film_probe(AVProbeData *p)
return AVPROBE_SCORE_MAX;
}
-static int film_read_header(AVFormatContext *s,
- AVFormatParameters *ap)
+static int film_read_header(AVFormatContext *s)
{
FilmDemuxContext *film = s->priv_data;
AVIOContext *pb = s->pb;
@@ -102,7 +101,7 @@ static int film_read_header(AVFormatContext *s,
if (avio_read(pb, scratch, 20) != 20)
return AVERROR(EIO);
/* make some assumptions about the audio parameters */
- film->audio_type = CODEC_ID_PCM_S8;
+ film->audio_type = AV_CODEC_ID_PCM_S8;
film->audio_samplerate = 22050;
film->audio_channels = 1;
film->audio_bits = 8;
@@ -114,27 +113,27 @@ static int film_read_header(AVFormatContext *s,
film->audio_channels = scratch[21];
film->audio_bits = scratch[22];
if (scratch[23] == 2)
- film->audio_type = CODEC_ID_ADPCM_ADX;
+ film->audio_type = AV_CODEC_ID_ADPCM_ADX;
else if (film->audio_channels > 0) {
if (film->audio_bits == 8)
- film->audio_type = CODEC_ID_PCM_S8;
+ film->audio_type = AV_CODEC_ID_PCM_S8;
else if (film->audio_bits == 16)
- film->audio_type = CODEC_ID_PCM_S16BE;
+ film->audio_type = AV_CODEC_ID_PCM_S16BE;
else
- film->audio_type = CODEC_ID_NONE;
+ film->audio_type = AV_CODEC_ID_NONE;
} else
- film->audio_type = CODEC_ID_NONE;
+ film->audio_type = AV_CODEC_ID_NONE;
}
if (AV_RB32(&scratch[0]) != FDSC_TAG)
return AVERROR_INVALIDDATA;
if (AV_RB32(&scratch[8]) == CVID_TAG) {
- film->video_type = CODEC_ID_CINEPAK;
+ film->video_type = AV_CODEC_ID_CINEPAK;
} else if (AV_RB32(&scratch[8]) == RAW_TAG) {
- film->video_type = CODEC_ID_RAWVIDEO;
+ film->video_type = AV_CODEC_ID_RAWVIDEO;
} else {
- film->video_type = CODEC_ID_NONE;
+ film->video_type = AV_CODEC_ID_NONE;
}
/* initialize the decoder streams */
@@ -149,9 +148,9 @@ static int film_read_header(AVFormatContext *s,
st->codec->width = AV_RB32(&scratch[16]);
st->codec->height = AV_RB32(&scratch[12]);
- if (film->video_type == CODEC_ID_RAWVIDEO) {
+ if (film->video_type == AV_CODEC_ID_RAWVIDEO) {
if (scratch[20] == 24) {
- st->codec->pix_fmt = PIX_FMT_RGB24;
+ st->codec->pix_fmt = AV_PIX_FMT_RGB24;
} else {
av_log(s, AV_LOG_ERROR, "raw video is using unhandled %dbpp\n", scratch[20]);
return -1;
@@ -170,7 +169,7 @@ static int film_read_header(AVFormatContext *s,
st->codec->channels = film->audio_channels;
st->codec->sample_rate = film->audio_samplerate;
- if (film->audio_type == CODEC_ID_ADPCM_ADX) {
+ if (film->audio_type == AV_CODEC_ID_ADPCM_ADX) {
st->codec->bits_per_coded_sample = 18 * 8 / 32;
st->codec->block_align = st->codec->channels * 18;
st->need_parsing = AVSTREAM_PARSE_FULL;
@@ -197,8 +196,13 @@ static int film_read_header(AVFormatContext *s,
if (!film->sample_table)
return AVERROR(ENOMEM);
- for(i=0; i<s->nb_streams; i++)
- avpriv_set_pts_info(s->streams[i], 33, 1, film->base_clock);
+ for (i = 0; i < s->nb_streams; i++) {
+ st = s->streams[i];
+ if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO)
+ avpriv_set_pts_info(st, 33, 1, film->base_clock);
+ else
+ avpriv_set_pts_info(st, 64, 1, film->audio_samplerate);
+ }
audio_frame_counter = 0;
for (i = 0; i < film->sample_count; i++) {
@@ -213,13 +217,11 @@ static int film_read_header(AVFormatContext *s,
if (AV_RB32(&scratch[8]) == 0xFFFFFFFF) {
film->sample_table[i].stream = film->audio_stream_index;
film->sample_table[i].pts = audio_frame_counter;
- film->sample_table[i].pts *= film->base_clock;
- film->sample_table[i].pts /= film->audio_samplerate;
- if (film->audio_type == CODEC_ID_ADPCM_ADX)
+ if (film->audio_type == AV_CODEC_ID_ADPCM_ADX)
audio_frame_counter += (film->sample_table[i].sample_size * 32 /
(18 * film->audio_channels));
- else if (film->audio_type != CODEC_ID_NONE)
+ else if (film->audio_type != AV_CODEC_ID_NONE)
audio_frame_counter += (film->sample_table[i].sample_size /
(film->audio_channels * film->audio_bits / 8));
} else {
@@ -254,14 +256,14 @@ static int film_read_packet(AVFormatContext *s,
/* do a special song and dance when loading FILM Cinepak chunks */
if ((sample->stream == film->video_stream_index) &&
- (film->video_type == CODEC_ID_CINEPAK)) {
+ (film->video_type == AV_CODEC_ID_CINEPAK)) {
pkt->pos= avio_tell(pb);
if (av_new_packet(pkt, sample->sample_size))
return AVERROR(ENOMEM);
avio_read(pb, pkt->data, sample->sample_size);
} else if ((sample->stream == film->audio_stream_index) &&
(film->audio_channels == 2) &&
- (film->audio_type != CODEC_ID_ADPCM_ADX)) {
+ (film->audio_type != AV_CODEC_ID_ADPCM_ADX)) {
/* stereo PCM needs to be interleaved */
if (av_new_packet(pkt, sample->sample_size))
@@ -322,7 +324,7 @@ static int film_read_close(AVFormatContext *s)
AVInputFormat ff_segafilm_demuxer = {
.name = "film_cpk",
- .long_name = NULL_IF_CONFIG_SMALL("Sega FILM/CPK format"),
+ .long_name = NULL_IF_CONFIG_SMALL("Sega FILM / CPK"),
.priv_data_size = sizeof(FilmDemuxContext),
.read_probe = film_probe,
.read_header = film_read_header,
diff --git a/gst-libs/ext/libav/libavformat/segment.c b/gst-libs/ext/libav/libavformat/segment.c
index 89ae62d..d79a327 100644
--- a/gst-libs/ext/libav/libavformat/segment.c
+++ b/gst-libs/ext/libav/libavformat/segment.c
@@ -19,7 +19,6 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include <strings.h>
#include <float.h>
#include "avformat.h"
@@ -34,23 +33,98 @@
typedef struct {
const AVClass *class; /**< Class for private options. */
int number;
+ AVOutputFormat *oformat;
AVFormatContext *avf;
char *format; /**< Set by a private option. */
char *list; /**< Set by a private option. */
+ int list_type; /**< Set by a private option. */
float time; /**< Set by a private option. */
int size; /**< Set by a private option. */
+ int wrap; /**< Set by a private option. */
+ int individual_header_trailer; /**< Set by a private option. */
+ int write_header_trailer; /**< Set by a private option. */
int64_t offset_time;
int64_t recording_time;
int has_video;
AVIOContext *pb;
} SegmentContext;
-static int segment_start(AVFormatContext *s)
+enum {
+ LIST_FLAT,
+ LIST_HLS
+};
+
+static int segment_mux_init(AVFormatContext *s)
+{
+ SegmentContext *seg = s->priv_data;
+ AVFormatContext *oc;
+ int i;
+
+ seg->avf = oc = avformat_alloc_context();
+ if (!oc)
+ return AVERROR(ENOMEM);
+
+ oc->oformat = seg->oformat;
+ oc->interrupt_callback = s->interrupt_callback;
+
+ for (i = 0; i < s->nb_streams; i++) {
+ AVStream *st;
+ if (!(st = avformat_new_stream(oc, NULL)))
+ return AVERROR(ENOMEM);
+ avcodec_copy_context(st->codec, s->streams[i]->codec);
+ st->sample_aspect_ratio = s->streams[i]->sample_aspect_ratio;
+ }
+
+ return 0;
+}
+
+static int segment_hls_window(AVFormatContext *s, int last)
+{
+ SegmentContext *seg = s->priv_data;
+ int i, ret = 0;
+ char buf[1024];
+
+ if ((ret = avio_open2(&seg->pb, seg->list, AVIO_FLAG_WRITE,
+ &s->interrupt_callback, NULL)) < 0)
+ goto fail;
+
+ avio_printf(seg->pb, "#EXTM3U\n");
+ avio_printf(seg->pb, "#EXT-X-VERSION:3\n");
+ avio_printf(seg->pb, "#EXT-X-TARGETDURATION:%d\n", (int)seg->time);
+ avio_printf(seg->pb, "#EXT-X-MEDIA-SEQUENCE:%d\n",
+ FFMAX(0, seg->number - seg->size));
+
+ for (i = FFMAX(0, seg->number - seg->size);
+ i < seg->number; i++) {
+ avio_printf(seg->pb, "#EXTINF:%d,\n", (int)seg->time);
+ av_get_frame_filename(buf, sizeof(buf), s->filename, i);
+ avio_printf(seg->pb, "%s\n", buf);
+ }
+
+ if (last)
+ avio_printf(seg->pb, "#EXT-X-ENDLIST\n");
+fail:
+ avio_closep(&seg->pb);
+ return ret;
+}
+
+static int segment_start(AVFormatContext *s, int write_header)
{
SegmentContext *c = s->priv_data;
AVFormatContext *oc = c->avf;
int err = 0;
+ if (write_header) {
+ avformat_free_context(oc);
+ c->avf = NULL;
+ if ((err = segment_mux_init(s)) < 0)
+ return err;
+ oc = c->avf;
+ }
+
+ if (c->wrap)
+ c->number %= c->wrap;
+
if (av_get_frame_filename(oc->filename, sizeof(oc->filename),
s->filename, c->number++) < 0)
return AVERROR(EINVAL);
@@ -59,62 +133,67 @@ static int segment_start(AVFormatContext *s)
&s->interrupt_callback, NULL)) < 0)
return err;
- if (!oc->priv_data && oc->oformat->priv_data_size > 0) {
- oc->priv_data = av_mallocz(oc->oformat->priv_data_size);
- if (!oc->priv_data) {
- avio_close(oc->pb);
- return AVERROR(ENOMEM);
- }
- if (oc->oformat->priv_class) {
- *(const AVClass**)oc->priv_data = oc->oformat->priv_class;
- av_opt_set_defaults(oc->priv_data);
- }
- }
+ if (oc->oformat->priv_class && oc->priv_data)
+ av_opt_set(oc->priv_data, "resend_headers", "1", 0); /* mpegts specific */
- if ((err = oc->oformat->write_header(oc)) < 0) {
- goto fail;
+ if (write_header) {
+ if ((err = avformat_write_header(oc, NULL)) < 0)
+ return err;
}
return 0;
-
-fail:
- avio_close(oc->pb);
- av_freep(&oc->priv_data);
-
- return err;
}
-static int segment_end(AVFormatContext *oc)
+static int segment_end(AVFormatContext *oc, int write_trailer)
{
int ret = 0;
- if (oc->oformat->write_trailer)
- ret = oc->oformat->write_trailer(oc);
-
+ av_write_frame(oc, NULL); /* Flush any buffered data (fragmented mp4) */
+ if (write_trailer)
+ av_write_trailer(oc);
avio_close(oc->pb);
- if (oc->oformat->priv_class)
- av_opt_free(oc->priv_data);
- av_freep(&oc->priv_data);
return ret;
}
+static int open_null_ctx(AVIOContext **ctx)
+{
+ int buf_size = 32768;
+ uint8_t *buf = av_malloc(buf_size);
+ if (!buf)
+ return AVERROR(ENOMEM);
+ *ctx = avio_alloc_context(buf, buf_size, AVIO_FLAG_WRITE, NULL, NULL, NULL, NULL);
+ if (!*ctx) {
+ av_free(buf);
+ return AVERROR(ENOMEM);
+ }
+ return 0;
+}
+
+static void close_null_ctx(AVIOContext *pb)
+{
+ av_free(pb->buffer);
+ av_free(pb);
+}
+
static int seg_write_header(AVFormatContext *s)
{
SegmentContext *seg = s->priv_data;
- AVFormatContext *oc;
+ AVFormatContext *oc = NULL;
int ret, i;
seg->number = 0;
seg->offset_time = 0;
seg->recording_time = seg->time * 1000000;
+ if (!seg->write_header_trailer)
+ seg->individual_header_trailer = 0;
- if (seg->list)
+ if (seg->list && seg->list_type != LIST_HLS)
if ((ret = avio_open2(&seg->pb, seg->list, AVIO_FLAG_WRITE,
&s->interrupt_callback, NULL)) < 0)
- return ret;
+ goto fail;
- for (i = 0; i< s->nb_streams; i++)
+ for (i = 0; i < s->nb_streams; i++)
seg->has_video +=
(s->streams[i]->codec->codec_type == AVMEDIA_TYPE_VIDEO);
@@ -123,30 +202,22 @@ static int seg_write_header(AVFormatContext *s)
"More than a single video stream present, "
"expect issues decoding it.\n");
- oc = avformat_alloc_context();
-
- if (!oc) {
- ret = AVERROR(ENOMEM);
- goto fail;
- }
-
- oc->oformat = av_guess_format(seg->format, s->filename, NULL);
+ seg->oformat = av_guess_format(seg->format, s->filename, NULL);
- if (!oc->oformat) {
+ if (!seg->oformat) {
ret = AVERROR_MUXER_NOT_FOUND;
goto fail;
}
- if (oc->oformat->flags & AVFMT_NOFILE) {
+ if (seg->oformat->flags & AVFMT_NOFILE) {
av_log(s, AV_LOG_ERROR, "format %s not supported.\n",
- oc->oformat->name);
+ seg->oformat->name);
ret = AVERROR(EINVAL);
goto fail;
}
- seg->avf = oc;
-
- oc->streams = s->streams;
- oc->nb_streams = s->nb_streams;
+ if ((ret = segment_mux_init(s)) < 0)
+ goto fail;
+ oc = seg->avf;
if (av_get_frame_filename(oc->filename, sizeof(oc->filename),
s->filename, seg->number++) < 0) {
@@ -154,27 +225,43 @@ static int seg_write_header(AVFormatContext *s)
goto fail;
}
- if ((ret = avio_open2(&oc->pb, oc->filename, AVIO_FLAG_WRITE,
- &s->interrupt_callback, NULL)) < 0)
- goto fail;
+ if (seg->write_header_trailer) {
+ if ((ret = avio_open2(&oc->pb, oc->filename, AVIO_FLAG_WRITE,
+ &s->interrupt_callback, NULL)) < 0)
+ goto fail;
+ } else {
+ if ((ret = open_null_ctx(&oc->pb)) < 0)
+ goto fail;
+ }
if ((ret = avformat_write_header(oc, NULL)) < 0) {
avio_close(oc->pb);
goto fail;
}
+ if (!seg->write_header_trailer) {
+ close_null_ctx(oc->pb);
+ if ((ret = avio_open2(&oc->pb, oc->filename, AVIO_FLAG_WRITE,
+ &s->interrupt_callback, NULL)) < 0)
+ goto fail;
+ }
+
if (seg->list) {
- avio_printf(seg->pb, "%s\n", oc->filename);
- avio_flush(seg->pb);
+ if (seg->list_type == LIST_HLS) {
+ if ((ret = segment_hls_window(s, 0)) < 0)
+ goto fail;
+ } else {
+ avio_printf(seg->pb, "%s\n", oc->filename);
+ avio_flush(seg->pb);
+ }
}
fail:
if (ret) {
- oc->streams = NULL;
- oc->nb_streams = 0;
if (seg->list)
avio_close(seg->pb);
- avformat_free_context(oc);
+ if (seg->avf)
+ avformat_free_context(seg->avf);
}
return ret;
}
@@ -183,45 +270,51 @@ static int seg_write_packet(AVFormatContext *s, AVPacket *pkt)
{
SegmentContext *seg = s->priv_data;
AVFormatContext *oc = seg->avf;
- AVStream *st = oc->streams[pkt->stream_index];
+ AVStream *st = s->streams[pkt->stream_index];
int64_t end_pts = seg->recording_time * seg->number;
- int ret;
+ int ret, can_split = 1;
- if ((seg->has_video && st->codec->codec_type == AVMEDIA_TYPE_VIDEO) &&
- av_compare_ts(pkt->pts, st->time_base,
- end_pts, AV_TIME_BASE_Q) >= 0 &&
- pkt->flags & AV_PKT_FLAG_KEY) {
+ if (seg->has_video) {
+ can_split = st->codec->codec_type == AVMEDIA_TYPE_VIDEO &&
+ pkt->flags & AV_PKT_FLAG_KEY;
+ }
+ if (can_split && av_compare_ts(pkt->pts, st->time_base, end_pts,
+ AV_TIME_BASE_Q) >= 0) {
av_log(s, AV_LOG_DEBUG, "Next segment starts at %d %"PRId64"\n",
pkt->stream_index, pkt->pts);
- ret = segment_end(oc);
+ ret = segment_end(oc, seg->individual_header_trailer);
if (!ret)
- ret = segment_start(s);
+ ret = segment_start(s, seg->individual_header_trailer);
if (ret)
goto fail;
+ oc = seg->avf;
+
if (seg->list) {
- avio_printf(seg->pb, "%s\n", oc->filename);
- avio_flush(seg->pb);
- if (!(seg->number % seg->size)) {
- avio_close(seg->pb);
- if ((ret = avio_open2(&seg->pb, seg->list, AVIO_FLAG_WRITE,
- &s->interrupt_callback, NULL)) < 0)
+ if (seg->list_type == LIST_HLS) {
+ if ((ret = segment_hls_window(s, 0)) < 0)
goto fail;
-
+ } else {
+ avio_printf(seg->pb, "%s\n", oc->filename);
+ avio_flush(seg->pb);
+ if (seg->size && !(seg->number % seg->size)) {
+ avio_closep(&seg->pb);
+ if ((ret = avio_open2(&seg->pb, seg->list, AVIO_FLAG_WRITE,
+ &s->interrupt_callback, NULL)) < 0)
+ goto fail;
+ }
}
}
}
- ret = oc->oformat->write_packet(oc, pkt);
+ ret = ff_write_chained(oc, pkt->stream_index, pkt, s);
fail:
if (ret < 0) {
- oc->streams = NULL;
- oc->nb_streams = 0;
if (seg->list)
avio_close(seg->pb);
avformat_free_context(oc);
@@ -234,11 +327,27 @@ static int seg_write_trailer(struct AVFormatContext *s)
{
SegmentContext *seg = s->priv_data;
AVFormatContext *oc = seg->avf;
- int ret = segment_end(oc);
- if (seg->list)
- avio_close(seg->pb);
- oc->streams = NULL;
- oc->nb_streams = 0;
+ int ret;
+ if (!seg->write_header_trailer) {
+ if ((ret = segment_end(oc, 0)) < 0)
+ goto fail;
+ open_null_ctx(&oc->pb);
+ ret = av_write_trailer(oc);
+ close_null_ctx(oc->pb);
+ } else {
+ ret = segment_end(oc, 1);
+ }
+
+ if (ret < 0)
+ goto fail;
+
+ if (seg->list && seg->list_type == LIST_HLS) {
+ if ((ret = segment_hls_window(s, 1) < 0))
+ goto fail;
+ }
+
+fail:
+ avio_close(seg->pb);
avformat_free_context(oc);
return ret;
}
@@ -249,7 +358,13 @@ static const AVOption options[] = {
{ "segment_format", "container format used for the segments", OFFSET(format), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, E },
{ "segment_time", "segment length in seconds", OFFSET(time), AV_OPT_TYPE_FLOAT, {.dbl = 2}, 0, FLT_MAX, E },
{ "segment_list", "output the segment list", OFFSET(list), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, E },
- { "segment_list_size", "maximum number of playlist entries", OFFSET(size), AV_OPT_TYPE_INT, {.dbl = 5}, 0, INT_MAX, E },
+ { "segment_list_size", "maximum number of playlist entries", OFFSET(size), AV_OPT_TYPE_INT, {.i64 = 5}, 0, INT_MAX, E },
+ { "segment_list_type", "segment list format", OFFSET(list_type), AV_OPT_TYPE_INT, {.i64 = LIST_FLAT}, 0, 2, E, "list_type" },
+ { "flat", "plain list (default)", 0, AV_OPT_TYPE_CONST, {.i64 = LIST_FLAT}, 0, 0, E, "list_type" },
+ { "hls", "Apple HTTP Live Streaming compatible", 0, AV_OPT_TYPE_CONST, {.i64 = LIST_HLS}, 0, 0, E, "list_type" },
+ { "segment_wrap", "number after which the index wraps", OFFSET(wrap), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, E },
+ { "individual_header_trailer", "write header/trailer to each segment", OFFSET(individual_header_trailer), AV_OPT_TYPE_INT, {.i64 = 1}, 0, 1, E },
+ { "write_header_trailer", "write a header to the first segment and a trailer to the last one", OFFSET(write_header_trailer), AV_OPT_TYPE_INT, {.i64 = 1}, 0, 1, E },
{ NULL },
};
@@ -263,9 +378,9 @@ static const AVClass seg_class = {
AVOutputFormat ff_segment_muxer = {
.name = "segment",
- .long_name = NULL_IF_CONFIG_SMALL("segment muxer"),
+ .long_name = NULL_IF_CONFIG_SMALL("segment"),
.priv_data_size = sizeof(SegmentContext),
- .flags = AVFMT_GLOBALHEADER | AVFMT_NOFILE,
+ .flags = AVFMT_NOFILE,
.write_header = seg_write_header,
.write_packet = seg_write_packet,
.write_trailer = seg_write_trailer,
diff --git a/gst-libs/ext/libav/libavformat/sierravmd.c b/gst-libs/ext/libav/libavformat/sierravmd.c
index 81ff46f..359282c 100644
--- a/gst-libs/ext/libav/libavformat/sierravmd.c
+++ b/gst-libs/ext/libav/libavformat/sierravmd.c
@@ -27,6 +27,7 @@
* http://www.pcisys.net/~melanson/codecs/
*/
+#include "libavutil/channel_layout.h"
#include "libavutil/intreadwrite.h"
#include "avformat.h"
#include "internal.h"
@@ -78,8 +79,7 @@ static int vmd_probe(AVProbeData *p)
return AVPROBE_SCORE_MAX / 2;
}
-static int vmd_read_header(AVFormatContext *s,
- AVFormatParameters *ap)
+static int vmd_read_header(AVFormatContext *s)
{
VmdDemuxContext *vmd = s->priv_data;
AVIOContext *pb = s->pb;
@@ -111,7 +111,7 @@ static int vmd_read_header(AVFormatContext *s,
avpriv_set_pts_info(vst, 33, 1, 10);
vmd->video_stream_index = vst->index;
vst->codec->codec_type = AVMEDIA_TYPE_VIDEO;
- vst->codec->codec_id = vmd->is_indeo3 ? CODEC_ID_INDEO3 : CODEC_ID_VMDVIDEO;
+ vst->codec->codec_id = vmd->is_indeo3 ? AV_CODEC_ID_INDEO3 : AV_CODEC_ID_VMDVIDEO;
vst->codec->codec_tag = 0; /* no fourcc */
vst->codec->width = AV_RL16(&vmd->vmd_header[12]);
vst->codec->height = AV_RL16(&vmd->vmd_header[14]);
@@ -131,9 +131,15 @@ static int vmd_read_header(AVFormatContext *s,
return AVERROR(ENOMEM);
vmd->audio_stream_index = st->index;
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
- st->codec->codec_id = CODEC_ID_VMDAUDIO;
+ st->codec->codec_id = AV_CODEC_ID_VMDAUDIO;
st->codec->codec_tag = 0; /* no fourcc */
- st->codec->channels = (vmd->vmd_header[811] & 0x80) ? 2 : 1;
+ if (vmd->vmd_header[811] & 0x80) {
+ st->codec->channels = 2;
+ st->codec->channel_layout = AV_CH_LAYOUT_STEREO;
+ } else {
+ st->codec->channels = 1;
+ st->codec->channel_layout = AV_CH_LAYOUT_MONO;
+ }
st->codec->sample_rate = vmd->sample_rate;
st->codec->block_align = AV_RL16(&vmd->vmd_header[806]);
if (st->codec->block_align & 0x8000) {
@@ -283,7 +289,7 @@ static int vmd_read_close(AVFormatContext *s)
AVInputFormat ff_vmd_demuxer = {
.name = "vmd",
- .long_name = NULL_IF_CONFIG_SMALL("Sierra VMD format"),
+ .long_name = NULL_IF_CONFIG_SMALL("Sierra VMD"),
.priv_data_size = sizeof(VmdDemuxContext),
.read_probe = vmd_probe,
.read_header = vmd_read_header,
diff --git a/gst-libs/ext/libav/libavformat/siff.c b/gst-libs/ext/libav/libavformat/siff.c
index 9f4d733..8ba7c60 100644
--- a/gst-libs/ext/libav/libavformat/siff.c
+++ b/gst-libs/ext/libav/libavformat/siff.c
@@ -19,6 +19,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "libavutil/channel_layout.h"
#include "libavutil/intreadwrite.h"
#include "avformat.h"
#include "internal.h"
@@ -76,12 +77,13 @@ static int create_audio_stream(AVFormatContext *s, SIFFContext *c)
if (!ast)
return -1;
ast->codec->codec_type = AVMEDIA_TYPE_AUDIO;
- ast->codec->codec_id = CODEC_ID_PCM_U8;
+ ast->codec->codec_id = AV_CODEC_ID_PCM_U8;
ast->codec->channels = 1;
- ast->codec->bits_per_coded_sample = c->bits;
+ ast->codec->channel_layout = AV_CH_LAYOUT_MONO;
+ ast->codec->bits_per_coded_sample = 8;
ast->codec->sample_rate = c->rate;
- ast->codec->frame_size = c->block_align;
avpriv_set_pts_info(ast, 16, 1, c->rate);
+ ast->start_time = 0;
return 0;
}
@@ -120,11 +122,11 @@ static int siff_parse_vbv1(AVFormatContext *s, SIFFContext *c, AVIOContext *pb)
if (!st)
return -1;
st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
- st->codec->codec_id = CODEC_ID_VB;
+ st->codec->codec_id = AV_CODEC_ID_VB;
st->codec->codec_tag = MKTAG('V', 'B', 'V', '1');
st->codec->width = width;
st->codec->height = height;
- st->codec->pix_fmt = PIX_FMT_PAL8;
+ st->codec->pix_fmt = AV_PIX_FMT_PAL8;
avpriv_set_pts_info(st, 16, 1, 12);
c->cur_frame = 0;
@@ -153,7 +155,7 @@ static int siff_parse_soun(AVFormatContext *s, SIFFContext *c, AVIOContext *pb)
return create_audio_stream(s, c);
}
-static int siff_read_header(AVFormatContext *s, AVFormatParameters *ap)
+static int siff_read_header(AVFormatContext *s)
{
AVIOContext *pb = s->pb;
SIFFContext *c = s->priv_data;
@@ -211,9 +213,10 @@ static int siff_read_packet(AVFormatContext *s, AVPacket *pkt)
pkt->stream_index = 0;
c->curstrm = -1;
}else{
- if (av_get_packet(s->pb, pkt, c->sndsize - 4) < 0)
+ if ((size = av_get_packet(s->pb, pkt, c->sndsize - 4)) < 0)
return AVERROR(EIO);
pkt->stream_index = 1;
+ pkt->duration = size;
c->curstrm = 0;
}
if(!c->cur_frame || c->curstrm)
@@ -224,6 +227,7 @@ static int siff_read_packet(AVFormatContext *s, AVPacket *pkt)
size = av_get_packet(s->pb, pkt, c->block_align);
if(size <= 0)
return AVERROR(EIO);
+ pkt->duration = size;
}
return pkt->size;
}
@@ -235,5 +239,5 @@ AVInputFormat ff_siff_demuxer = {
.read_probe = siff_probe,
.read_header = siff_read_header,
.read_packet = siff_read_packet,
- .extensions = "vb,son"
+ .extensions = "vb,son",
};
diff --git a/gst-libs/ext/libav/libavformat/smacker.c b/gst-libs/ext/libav/libavformat/smacker.c
index d6bb213..4a3a2b3 100644
--- a/gst-libs/ext/libav/libavformat/smacker.c
+++ b/gst-libs/ext/libav/libavformat/smacker.c
@@ -24,6 +24,7 @@
*/
#include "libavutil/bswap.h"
+#include "libavutil/channel_layout.h"
#include "libavutil/intreadwrite.h"
#include "avformat.h"
#include "internal.h"
@@ -98,7 +99,7 @@ static int smacker_probe(AVProbeData *p)
return 0;
}
-static int smacker_read_header(AVFormatContext *s, AVFormatParameters *ap)
+static int smacker_read_header(AVFormatContext *s)
{
AVIOContext *pb = s->pb;
SmackerContext *smk = s->priv_data;
@@ -161,9 +162,9 @@ static int smacker_read_header(AVFormatContext *s, AVFormatParameters *ap)
smk->videoindex = st->index;
st->codec->width = smk->width;
st->codec->height = smk->height;
- st->codec->pix_fmt = PIX_FMT_PAL8;
+ st->codec->pix_fmt = AV_PIX_FMT_PAL8;
st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
- st->codec->codec_id = CODEC_ID_SMACKVIDEO;
+ st->codec->codec_id = AV_CODEC_ID_SMACKVIDEO;
st->codec->codec_tag = smk->magic;
/* Smacker uses 100000 as internal timebase */
if(smk->pts_inc < 0)
@@ -182,20 +183,26 @@ static int smacker_read_header(AVFormatContext *s, AVFormatParameters *ap)
smk->indexes[i] = ast[i]->index;
ast[i]->codec->codec_type = AVMEDIA_TYPE_AUDIO;
if (smk->aflags[i] & SMK_AUD_BINKAUD) {
- ast[i]->codec->codec_id = CODEC_ID_BINKAUDIO_RDFT;
+ ast[i]->codec->codec_id = AV_CODEC_ID_BINKAUDIO_RDFT;
} else if (smk->aflags[i] & SMK_AUD_USEDCT) {
- ast[i]->codec->codec_id = CODEC_ID_BINKAUDIO_DCT;
+ ast[i]->codec->codec_id = AV_CODEC_ID_BINKAUDIO_DCT;
} else if (smk->aflags[i] & SMK_AUD_PACKED){
- ast[i]->codec->codec_id = CODEC_ID_SMACKAUDIO;
+ ast[i]->codec->codec_id = AV_CODEC_ID_SMACKAUDIO;
ast[i]->codec->codec_tag = MKTAG('S', 'M', 'K', 'A');
} else {
- ast[i]->codec->codec_id = CODEC_ID_PCM_U8;
+ ast[i]->codec->codec_id = AV_CODEC_ID_PCM_U8;
+ }
+ if (smk->aflags[i] & SMK_AUD_STEREO) {
+ ast[i]->codec->channels = 2;
+ ast[i]->codec->channel_layout = AV_CH_LAYOUT_STEREO;
+ } else {
+ ast[i]->codec->channels = 1;
+ ast[i]->codec->channel_layout = AV_CH_LAYOUT_MONO;
}
- ast[i]->codec->channels = (smk->aflags[i] & SMK_AUD_STEREO) ? 2 : 1;
ast[i]->codec->sample_rate = smk->rates[i];
ast[i]->codec->bits_per_coded_sample = (smk->aflags[i] & SMK_AUD_16BITS) ? 16 : 8;
- if(ast[i]->codec->bits_per_coded_sample == 16 && ast[i]->codec->codec_id == CODEC_ID_PCM_U8)
- ast[i]->codec->codec_id = CODEC_ID_PCM_S16LE;
+ if(ast[i]->codec->bits_per_coded_sample == 16 && ast[i]->codec->codec_id == AV_CODEC_ID_PCM_U8)
+ ast[i]->codec->codec_id = AV_CODEC_ID_PCM_S16LE;
avpriv_set_pts_info(ast[i], 64, 1, ast[i]->codec->sample_rate
* ast[i]->codec->channels * ast[i]->codec->bits_per_coded_sample / 8);
}
diff --git a/gst-libs/ext/libav/libavformat/smjpeg.c b/gst-libs/ext/libav/libavformat/smjpeg.c
index 573a8a3..52e45e9 100644
--- a/gst-libs/ext/libav/libavformat/smjpeg.c
+++ b/gst-libs/ext/libav/libavformat/smjpeg.c
@@ -29,12 +29,12 @@
#include "smjpeg.h"
const AVCodecTag ff_codec_smjpeg_video_tags[] = {
- { CODEC_ID_MJPEG, MKTAG('J', 'F', 'I', 'F') },
- { CODEC_ID_NONE, 0 },
+ { AV_CODEC_ID_MJPEG, MKTAG('J', 'F', 'I', 'F') },
+ { AV_CODEC_ID_NONE, 0 },
};
const AVCodecTag ff_codec_smjpeg_audio_tags[] = {
- { CODEC_ID_ADPCM_IMA_SMJPEG, MKTAG('A', 'P', 'C', 'M') },
- { CODEC_ID_PCM_S16LE, MKTAG('N', 'O', 'N', 'E') },
- { CODEC_ID_NONE, 0 },
+ { AV_CODEC_ID_ADPCM_IMA_SMJPEG, MKTAG('A', 'P', 'C', 'M') },
+ { AV_CODEC_ID_PCM_S16LE, MKTAG('N', 'O', 'N', 'E') },
+ { AV_CODEC_ID_NONE, 0 },
};
diff --git a/gst-libs/ext/libav/libavformat/smjpegdec.c b/gst-libs/ext/libav/libavformat/smjpegdec.c
index d7ff979..39bb1b4 100644
--- a/gst-libs/ext/libav/libavformat/smjpegdec.c
+++ b/gst-libs/ext/libav/libavformat/smjpegdec.c
@@ -41,7 +41,7 @@ static int smjpeg_probe(AVProbeData *p)
return 0;
}
-static int smjpeg_read_header(AVFormatContext *s, AVFormatParameters *ap)
+static int smjpeg_read_header(AVFormatContext *s)
{
SMJPEGContext *sc = s->priv_data;
AVStream *ast = NULL, *vst = NULL;
@@ -78,7 +78,7 @@ static int smjpeg_read_header(AVFormatContext *s, AVFormatParameters *ap)
case SMJPEG_SND:
if (ast) {
av_log_ask_for_sample(s, "multiple audio streams not supported\n");
- return AVERROR_INVALIDDATA;
+ return AVERROR_PATCHWELCOME;
}
hlength = avio_rb32(pb);
if (hlength < 8)
@@ -135,10 +135,13 @@ static int smjpeg_read_header(AVFormatContext *s, AVFormatParameters *ap)
static int smjpeg_read_packet(AVFormatContext *s, AVPacket *pkt)
{
SMJPEGContext *sc = s->priv_data;
- uint32_t dtype, ret, size, timestamp;
+ uint32_t dtype, size, timestamp;
+ int64_t pos;
+ int ret;
if (s->pb->eof_reached)
return AVERROR_EOF;
+ pos = avio_tell(s->pb);
dtype = avio_rl32(s->pb);
switch (dtype) {
case SMJPEG_SNDD:
@@ -147,6 +150,7 @@ static int smjpeg_read_packet(AVFormatContext *s, AVPacket *pkt)
ret = av_get_packet(s->pb, pkt, size);
pkt->stream_index = sc->audio_stream_index;
pkt->pts = timestamp;
+ pkt->pos = pos;
break;
case SMJPEG_VIDD:
timestamp = avio_rb32(s->pb);
@@ -154,6 +158,7 @@ static int smjpeg_read_packet(AVFormatContext *s, AVPacket *pkt)
ret = av_get_packet(s->pb, pkt, size);
pkt->stream_index = sc->video_stream_index;
pkt->pts = timestamp;
+ pkt->pos = pos;
break;
case SMJPEG_DONE:
ret = AVERROR_EOF;
@@ -174,4 +179,5 @@ AVInputFormat ff_smjpeg_demuxer = {
.read_header = smjpeg_read_header,
.read_packet = smjpeg_read_packet,
.extensions = "mjpg",
+ .flags = AVFMT_GENERIC_INDEX,
};
diff --git a/gst-libs/ext/libav/libavformat/smjpegenc.c b/gst-libs/ext/libav/libavformat/smjpegenc.c
index 45ba20b..5c64e84 100644
--- a/gst-libs/ext/libav/libavformat/smjpegenc.c
+++ b/gst-libs/ext/libav/libavformat/smjpegenc.c
@@ -26,7 +26,6 @@
#include "avformat.h"
#include "internal.h"
-#include "riff.h"
#include "smjpeg.h"
typedef struct SMJPEGMuxContext {
@@ -130,7 +129,6 @@ static int smjpeg_write_trailer(AVFormatContext *s)
}
avio_wl32(pb, SMJPEG_DONE);
- avio_flush(pb);
return 0;
}
@@ -139,11 +137,11 @@ AVOutputFormat ff_smjpeg_muxer = {
.name = "smjpeg",
.long_name = NULL_IF_CONFIG_SMALL("Loki SDL MJPEG"),
.priv_data_size = sizeof(SMJPEGMuxContext),
- .audio_codec = CODEC_ID_PCM_S16LE,
- .video_codec = CODEC_ID_MJPEG,
+ .audio_codec = AV_CODEC_ID_PCM_S16LE,
+ .video_codec = AV_CODEC_ID_MJPEG,
.write_header = smjpeg_write_header,
.write_packet = smjpeg_write_packet,
.write_trailer = smjpeg_write_trailer,
- .flags = AVFMT_GLOBALHEADER,
+ .flags = AVFMT_GLOBALHEADER | AVFMT_TS_NONSTRICT,
.codec_tag = (const AVCodecTag *const []){ ff_codec_smjpeg_video_tags, ff_codec_smjpeg_audio_tags, 0 },
};
diff --git a/gst-libs/ext/libav/libavformat/smoothstreamingenc.c b/gst-libs/ext/libav/libavformat/smoothstreamingenc.c
new file mode 100644
index 0000000..d26af05
--- /dev/null
+++ b/gst-libs/ext/libav/libavformat/smoothstreamingenc.c
@@ -0,0 +1,629 @@
+/*
+ * Live smooth streaming fragmenter
+ * Copyright (c) 2012 Martin Storsjo
+ *
+ * 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
+ */
+
+#include "config.h"
+#include <float.h>
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+#include "avformat.h"
+#include "internal.h"
+#include "os_support.h"
+#include "avc.h"
+#include "url.h"
+#include "isom.h"
+
+#include "libavutil/opt.h"
+#include "libavutil/avstring.h"
+#include "libavutil/mathematics.h"
+#include "libavutil/intreadwrite.h"
+
+typedef struct {
+ char file[1024];
+ char infofile[1024];
+ int64_t start_time, duration;
+ int n;
+ int64_t start_pos, size;
+} Fragment;
+
+typedef struct {
+ AVFormatContext *ctx;
+ int ctx_inited;
+ char dirname[1024];
+ uint8_t iobuf[32768];
+ URLContext *out; // Current output stream where all output is written
+ URLContext *out2; // Auxiliary output stream where all output is also written
+ URLContext *tail_out; // The actual main output stream, if we're currently seeked back to write elsewhere
+ int64_t tail_pos, cur_pos, cur_start_pos;
+ int packets_written;
+ const char *stream_type_tag;
+ int nb_fragments, fragments_size, fragment_index;
+ Fragment **fragments;
+
+ const char *fourcc;
+ char *private_str;
+ int packet_size;
+ int audio_tag;
+} OutputStream;
+
+typedef struct {
+ const AVClass *class; /* Class for private options. */
+ int window_size;
+ int extra_window_size;
+ int lookahead_count;
+ int min_frag_duration;
+ int remove_at_exit;
+ OutputStream *streams;
+ int has_video, has_audio;
+ int nb_fragments;
+} SmoothStreamingContext;
+
+static int ism_write(void *opaque, uint8_t *buf, int buf_size)
+{
+ OutputStream *os = opaque;
+ if (os->out)
+ ffurl_write(os->out, buf, buf_size);
+ if (os->out2)
+ ffurl_write(os->out2, buf, buf_size);
+ os->cur_pos += buf_size;
+ if (os->cur_pos >= os->tail_pos)
+ os->tail_pos = os->cur_pos;
+ return buf_size;
+}
+
+static int64_t ism_seek(void *opaque, int64_t offset, int whence)
+{
+ OutputStream *os = opaque;
+ int i;
+ if (whence != SEEK_SET)
+ return AVERROR(ENOSYS);
+ if (os->tail_out) {
+ if (os->out) {
+ ffurl_close(os->out);
+ }
+ if (os->out2) {
+ ffurl_close(os->out2);
+ }
+ os->out = os->tail_out;
+ os->out2 = NULL;
+ os->tail_out = NULL;
+ }
+ if (offset >= os->cur_start_pos) {
+ if (os->out)
+ ffurl_seek(os->out, offset - os->cur_start_pos, SEEK_SET);
+ os->cur_pos = offset;
+ return offset;
+ }
+ for (i = os->nb_fragments - 1; i >= 0; i--) {
+ Fragment *frag = os->fragments[i];
+ if (offset >= frag->start_pos && offset < frag->start_pos + frag->size) {
+ int ret;
+ AVDictionary *opts = NULL;
+ os->tail_out = os->out;
+ av_dict_set(&opts, "truncate", "0", 0);
+ ret = ffurl_open(&os->out, frag->file, AVIO_FLAG_READ_WRITE, &os->ctx->interrupt_callback, &opts);
+ av_dict_free(&opts);
+ if (ret < 0) {
+ os->out = os->tail_out;
+ os->tail_out = NULL;
+ return ret;
+ }
+ av_dict_set(&opts, "truncate", "0", 0);
+ ffurl_open(&os->out2, frag->infofile, AVIO_FLAG_READ_WRITE, &os->ctx->interrupt_callback, &opts);
+ av_dict_free(&opts);
+ ffurl_seek(os->out, offset - frag->start_pos, SEEK_SET);
+ if (os->out2)
+ ffurl_seek(os->out2, offset - frag->start_pos, SEEK_SET);
+ os->cur_pos = offset;
+ return offset;
+ }
+ }
+ return AVERROR(EIO);
+}
+
+static void get_private_data(OutputStream *os)
+{
+ AVCodecContext *codec = os->ctx->streams[0]->codec;
+ uint8_t *ptr = codec->extradata;
+ int size = codec->extradata_size;
+ int i;
+ if (codec->codec_id == AV_CODEC_ID_H264) {
+ ff_avc_write_annexb_extradata(ptr, &ptr, &size);
+ if (!ptr)
+ ptr = codec->extradata;
+ }
+ if (!ptr)
+ return;
+ os->private_str = av_mallocz(2*size + 1);
+ for (i = 0; i < size; i++)
+ snprintf(&os->private_str[2*i], 3, "%02x", ptr[i]);
+ if (ptr != codec->extradata)
+ av_free(ptr);
+}
+
+static void ism_free(AVFormatContext *s)
+{
+ SmoothStreamingContext *c = s->priv_data;
+ int i, j;
+ if (!c->streams)
+ return;
+ for (i = 0; i < s->nb_streams; i++) {
+ OutputStream *os = &c->streams[i];
+ ffurl_close(os->out);
+ ffurl_close(os->out2);
+ ffurl_close(os->tail_out);
+ os->out = os->out2 = os->tail_out = NULL;
+ if (os->ctx && os->ctx_inited)
+ av_write_trailer(os->ctx);
+ if (os->ctx && os->ctx->pb)
+ av_free(os->ctx->pb);
+ if (os->ctx)
+ avformat_free_context(os->ctx);
+ av_free(os->private_str);
+ for (j = 0; j < os->nb_fragments; j++)
+ av_free(os->fragments[j]);
+ av_free(os->fragments);
+ }
+ av_freep(&c->streams);
+}
+
+static void output_chunk_list(OutputStream *os, AVIOContext *out, int final, int skip, int window_size)
+{
+ int removed = 0, i, start = 0;
+ if (os->nb_fragments <= 0)
+ return;
+ if (os->fragments[0]->n > 0)
+ removed = 1;
+ if (final)
+ skip = 0;
+ if (window_size)
+ start = FFMAX(os->nb_fragments - skip - window_size, 0);
+ for (i = start; i < os->nb_fragments - skip; i++) {
+ Fragment *frag = os->fragments[i];
+ if (!final || removed)
+ avio_printf(out, "<c t=\"%"PRIu64"\" d=\"%"PRIu64"\" />\n", frag->start_time, frag->duration);
+ else
+ avio_printf(out, "<c n=\"%d\" d=\"%"PRIu64"\" />\n", frag->n, frag->duration);
+ }
+}
+
+static int write_manifest(AVFormatContext *s, int final)
+{
+ SmoothStreamingContext *c = s->priv_data;
+ AVIOContext *out;
+ char filename[1024];
+ int ret, i, video_chunks = 0, audio_chunks = 0, video_streams = 0, audio_streams = 0;
+ int64_t duration = 0;
+
+ snprintf(filename, sizeof(filename), "%s/Manifest", s->filename);
+ ret = avio_open2(&out, filename, AVIO_FLAG_WRITE, &s->interrupt_callback, NULL);
+ if (ret < 0) {
+ av_log(s, AV_LOG_ERROR, "Unable to open %s for writing\n", filename);
+ return ret;
+ }
+ avio_printf(out, "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n");
+ for (i = 0; i < s->nb_streams; i++) {
+ OutputStream *os = &c->streams[i];
+ if (os->nb_fragments > 0) {
+ Fragment *last = os->fragments[os->nb_fragments - 1];
+ duration = last->start_time + last->duration;
+ }
+ if (s->streams[i]->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
+ video_chunks = os->nb_fragments;
+ video_streams++;
+ } else {
+ audio_chunks = os->nb_fragments;
+ audio_streams++;
+ }
+ }
+ if (!final) {
+ duration = 0;
+ video_chunks = audio_chunks = 0;
+ }
+ if (c->window_size) {
+ video_chunks = FFMIN(video_chunks, c->window_size);
+ audio_chunks = FFMIN(audio_chunks, c->window_size);
+ }
+ avio_printf(out, "<SmoothStreamingMedia MajorVersion=\"2\" MinorVersion=\"0\" Duration=\"%"PRIu64"\"", duration);
+ if (!final)
+ avio_printf(out, " IsLive=\"true\" LookAheadFragmentCount=\"%d\" DVRWindowLength=\"0\"", c->lookahead_count);
+ avio_printf(out, ">\n");
+ if (c->has_video) {
+ int last = -1, index = 0;
+ avio_printf(out, "<StreamIndex Type=\"video\" QualityLevels=\"%d\" Chunks=\"%d\" Url=\"QualityLevels({bitrate})/Fragments(video={start time})\">\n", video_streams, video_chunks);
+ for (i = 0; i < s->nb_streams; i++) {
+ OutputStream *os = &c->streams[i];
+ if (s->streams[i]->codec->codec_type != AVMEDIA_TYPE_VIDEO)
+ continue;
+ last = i;
+ avio_printf(out, "<QualityLevel Index=\"%d\" Bitrate=\"%d\" FourCC=\"%s\" MaxWidth=\"%d\" MaxHeight=\"%d\" CodecPrivateData=\"%s\" />\n", index, s->streams[i]->codec->bit_rate, os->fourcc, s->streams[i]->codec->width, s->streams[i]->codec->height, os->private_str);
+ index++;
+ }
+ output_chunk_list(&c->streams[last], out, final, c->lookahead_count, c->window_size);
+ avio_printf(out, "</StreamIndex>\n");
+ }
+ if (c->has_audio) {
+ int last = -1, index = 0;
+ avio_printf(out, "<StreamIndex Type=\"audio\" QualityLevels=\"%d\" Chunks=\"%d\" Url=\"QualityLevels({bitrate})/Fragments(audio={start time})\">\n", audio_streams, audio_chunks);
+ for (i = 0; i < s->nb_streams; i++) {
+ OutputStream *os = &c->streams[i];
+ if (s->streams[i]->codec->codec_type != AVMEDIA_TYPE_AUDIO)
+ continue;
+ last = i;
+ avio_printf(out, "<QualityLevel Index=\"%d\" Bitrate=\"%d\" FourCC=\"%s\" SamplingRate=\"%d\" Channels=\"%d\" BitsPerSample=\"16\" PacketSize=\"%d\" AudioTag=\"%d\" CodecPrivateData=\"%s\" />\n", index, s->streams[i]->codec->bit_rate, os->fourcc, s->streams[i]->codec->sample_rate, s->streams[i]->codec->channels, os->packet_size, os->audio_tag, os->private_str);
+ index++;
+ }
+ output_chunk_list(&c->streams[last], out, final, c->lookahead_count, c->window_size);
+ avio_printf(out, "</StreamIndex>\n");
+ }
+ avio_printf(out, "</SmoothStreamingMedia>\n");
+ avio_flush(out);
+ avio_close(out);
+ return 0;
+}
+
+static int ism_write_header(AVFormatContext *s)
+{
+ SmoothStreamingContext *c = s->priv_data;
+ int ret = 0, i;
+ AVOutputFormat *oformat;
+
+ mkdir(s->filename, 0777);
+
+ oformat = av_guess_format("ismv", NULL, NULL);
+ if (!oformat) {
+ ret = AVERROR_MUXER_NOT_FOUND;
+ goto fail;
+ }
+
+ c->streams = av_mallocz(sizeof(*c->streams) * s->nb_streams);
+ if (!c->streams) {
+ ret = AVERROR(ENOMEM);
+ goto fail;
+ }
+
+ for (i = 0; i < s->nb_streams; i++) {
+ OutputStream *os = &c->streams[i];
+ AVFormatContext *ctx;
+ AVStream *st;
+ AVDictionary *opts = NULL;
+ char buf[10];
+
+ if (!s->streams[i]->codec->bit_rate) {
+ av_log(s, AV_LOG_ERROR, "No bit rate set for stream %d\n", i);
+ ret = AVERROR(EINVAL);
+ goto fail;
+ }
+ snprintf(os->dirname, sizeof(os->dirname), "%s/QualityLevels(%d)", s->filename, s->streams[i]->codec->bit_rate);
+ mkdir(os->dirname, 0777);
+
+ ctx = avformat_alloc_context();
+ if (!ctx) {
+ ret = AVERROR(ENOMEM);
+ goto fail;
+ }
+ os->ctx = ctx;
+ ctx->oformat = oformat;
+ ctx->interrupt_callback = s->interrupt_callback;
+
+ if (!(st = avformat_new_stream(ctx, NULL))) {
+ ret = AVERROR(ENOMEM);
+ goto fail;
+ }
+ avcodec_copy_context(st->codec, s->streams[i]->codec);
+ st->sample_aspect_ratio = s->streams[i]->sample_aspect_ratio;
+
+ ctx->pb = avio_alloc_context(os->iobuf, sizeof(os->iobuf), AVIO_FLAG_WRITE, os, NULL, ism_write, ism_seek);
+ if (!ctx->pb) {
+ ret = AVERROR(ENOMEM);
+ goto fail;
+ }
+
+ snprintf(buf, sizeof(buf), "%d", c->lookahead_count);
+ av_dict_set(&opts, "ism_lookahead", buf, 0);
+ av_dict_set(&opts, "movflags", "frag_custom", 0);
+ if ((ret = avformat_write_header(ctx, &opts)) < 0) {
+ goto fail;
+ }
+ os->ctx_inited = 1;
+ avio_flush(ctx->pb);
+ av_dict_free(&opts);
+ s->streams[i]->time_base = st->time_base;
+ if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
+ c->has_video = 1;
+ os->stream_type_tag = "video";
+ if (st->codec->codec_id == AV_CODEC_ID_H264) {
+ os->fourcc = "H264";
+ } else if (st->codec->codec_id == AV_CODEC_ID_VC1) {
+ os->fourcc = "WVC1";
+ } else {
+ av_log(s, AV_LOG_ERROR, "Unsupported video codec\n");
+ ret = AVERROR(EINVAL);
+ goto fail;
+ }
+ } else {
+ c->has_audio = 1;
+ os->stream_type_tag = "audio";
+ if (st->codec->codec_id == AV_CODEC_ID_AAC) {
+ os->fourcc = "AACL";
+ os->audio_tag = 0xff;
+ } else if (st->codec->codec_id == AV_CODEC_ID_WMAPRO) {
+ os->fourcc = "WMAP";
+ os->audio_tag = 0x0162;
+ } else {
+ av_log(s, AV_LOG_ERROR, "Unsupported audio codec\n");
+ ret = AVERROR(EINVAL);
+ goto fail;
+ }
+ os->packet_size = st->codec->block_align ? st->codec->block_align : 4;
+ }
+ get_private_data(os);
+ }
+
+ if (!c->has_video && c->min_frag_duration <= 0) {
+ av_log(s, AV_LOG_WARNING, "no video stream and no min frag duration set\n");
+ ret = AVERROR(EINVAL);
+ }
+ ret = write_manifest(s, 0);
+
+fail:
+ if (ret)
+ ism_free(s);
+ return ret;
+}
+
+static int parse_fragment(AVFormatContext *s, const char *filename, int64_t *start_ts, int64_t *duration, int64_t *moof_size, int64_t size)
+{
+ AVIOContext *in;
+ int ret;
+ uint32_t len;
+ if ((ret = avio_open2(&in, filename, AVIO_FLAG_READ, &s->interrupt_callback, NULL)) < 0)
+ return ret;
+ ret = AVERROR(EIO);
+ *moof_size = avio_rb32(in);
+ if (*moof_size < 8 || *moof_size > size)
+ goto fail;
+ if (avio_rl32(in) != MKTAG('m','o','o','f'))
+ goto fail;
+ len = avio_rb32(in);
+ if (len > *moof_size)
+ goto fail;
+ if (avio_rl32(in) != MKTAG('m','f','h','d'))
+ goto fail;
+ avio_seek(in, len - 8, SEEK_CUR);
+ avio_rb32(in); /* traf size */
+ if (avio_rl32(in) != MKTAG('t','r','a','f'))
+ goto fail;
+ while (avio_tell(in) < *moof_size) {
+ uint32_t len = avio_rb32(in);
+ uint32_t tag = avio_rl32(in);
+ int64_t end = avio_tell(in) + len - 8;
+ if (len < 8 || len >= *moof_size)
+ goto fail;
+ if (tag == MKTAG('u','u','i','d')) {
+ const uint8_t tfxd[] = {
+ 0x6d, 0x1d, 0x9b, 0x05, 0x42, 0xd5, 0x44, 0xe6,
+ 0x80, 0xe2, 0x14, 0x1d, 0xaf, 0xf7, 0x57, 0xb2
+ };
+ uint8_t uuid[16];
+ avio_read(in, uuid, 16);
+ if (!memcmp(uuid, tfxd, 16) && len >= 8 + 16 + 4 + 16) {
+ avio_seek(in, 4, SEEK_CUR);
+ *start_ts = avio_rb64(in);
+ *duration = avio_rb64(in);
+ ret = 0;
+ break;
+ }
+ }
+ avio_seek(in, end, SEEK_SET);
+ }
+fail:
+ avio_close(in);
+ return ret;
+}
+
+static int add_fragment(OutputStream *os, const char *file, const char *infofile, int64_t start_time, int64_t duration, int64_t start_pos, int64_t size)
+{
+ Fragment *frag;
+ if (os->nb_fragments >= os->fragments_size) {
+ os->fragments_size = (os->fragments_size + 1) * 2;
+ os->fragments = av_realloc(os->fragments, sizeof(*os->fragments)*os->fragments_size);
+ if (!os->fragments)
+ return AVERROR(ENOMEM);
+ }
+ frag = av_mallocz(sizeof(*frag));
+ if (!frag)
+ return AVERROR(ENOMEM);
+ av_strlcpy(frag->file, file, sizeof(frag->file));
+ av_strlcpy(frag->infofile, infofile, sizeof(frag->infofile));
+ frag->start_time = start_time;
+ frag->duration = duration;
+ frag->start_pos = start_pos;
+ frag->size = size;
+ frag->n = os->fragment_index;
+ os->fragments[os->nb_fragments++] = frag;
+ os->fragment_index++;
+ return 0;
+}
+
+static int copy_moof(AVFormatContext *s, const char* infile, const char *outfile, int64_t size)
+{
+ AVIOContext *in, *out;
+ int ret = 0;
+ if ((ret = avio_open2(&in, infile, AVIO_FLAG_READ, &s->interrupt_callback, NULL)) < 0)
+ return ret;
+ if ((ret = avio_open2(&out, outfile, AVIO_FLAG_WRITE, &s->interrupt_callback, NULL)) < 0) {
+ avio_close(in);
+ return ret;
+ }
+ while (size > 0) {
+ uint8_t buf[8192];
+ int n = FFMIN(size, sizeof(buf));
+ n = avio_read(in, buf, n);
+ if (n <= 0) {
+ ret = AVERROR(EIO);
+ break;
+ }
+ avio_write(out, buf, n);
+ size -= n;
+ }
+ avio_flush(out);
+ avio_close(out);
+ avio_close(in);
+ return ret;
+}
+
+static int ism_flush(AVFormatContext *s, int final)
+{
+ SmoothStreamingContext *c = s->priv_data;
+ int i, ret = 0;
+
+ for (i = 0; i < s->nb_streams; i++) {
+ OutputStream *os = &c->streams[i];
+ char filename[1024], target_filename[1024], header_filename[1024];
+ int64_t start_pos = os->tail_pos, size;
+ int64_t start_ts, duration, moof_size;
+ if (!os->packets_written)
+ continue;
+
+ snprintf(filename, sizeof(filename), "%s/temp", os->dirname);
+ ret = ffurl_open(&os->out, filename, AVIO_FLAG_WRITE, &s->interrupt_callback, NULL);
+ if (ret < 0)
+ break;
+ os->cur_start_pos = os->tail_pos;
+ av_write_frame(os->ctx, NULL);
+ avio_flush(os->ctx->pb);
+ os->packets_written = 0;
+ if (!os->out || os->tail_out)
+ return AVERROR(EIO);
+
+ ffurl_close(os->out);
+ os->out = NULL;
+ size = os->tail_pos - start_pos;
+ if ((ret = parse_fragment(s, filename, &start_ts, &duration, &moof_size, size)) < 0)
+ break;
+ snprintf(header_filename, sizeof(header_filename), "%s/FragmentInfo(%s=%"PRIu64")", os->dirname, os->stream_type_tag, start_ts);
+ snprintf(target_filename, sizeof(target_filename), "%s/Fragments(%s=%"PRIu64")", os->dirname, os->stream_type_tag, start_ts);
+ copy_moof(s, filename, header_filename, moof_size);
+ rename(filename, target_filename);
+ add_fragment(os, target_filename, header_filename, start_ts, duration, start_pos, size);
+ }
+
+ if (c->window_size || (final && c->remove_at_exit)) {
+ for (i = 0; i < s->nb_streams; i++) {
+ OutputStream *os = &c->streams[i];
+ int j;
+ int remove = os->nb_fragments - c->window_size - c->extra_window_size - c->lookahead_count;
+ if (final && c->remove_at_exit)
+ remove = os->nb_fragments;
+ if (remove > 0) {
+ for (j = 0; j < remove; j++) {
+ unlink(os->fragments[j]->file);
+ unlink(os->fragments[j]->infofile);
+ av_free(os->fragments[j]);
+ }
+ os->nb_fragments -= remove;
+ memmove(os->fragments, os->fragments + remove, os->nb_fragments * sizeof(*os->fragments));
+ }
+ if (final && c->remove_at_exit)
+ rmdir(os->dirname);
+ }
+ }
+
+ if (ret >= 0)
+ ret = write_manifest(s, final);
+ return ret;
+}
+
+static int ism_write_packet(AVFormatContext *s, AVPacket *pkt)
+{
+ SmoothStreamingContext *c = s->priv_data;
+ AVStream *st = s->streams[pkt->stream_index];
+ OutputStream *os = &c->streams[pkt->stream_index];
+ int64_t end_dts = (c->nb_fragments + 1) * c->min_frag_duration;
+ int ret;
+
+ if (st->first_dts == AV_NOPTS_VALUE)
+ st->first_dts = pkt->dts;
+
+ if ((!c->has_video || st->codec->codec_type == AVMEDIA_TYPE_VIDEO) &&
+ av_compare_ts(pkt->dts - st->first_dts, st->time_base,
+ end_dts, AV_TIME_BASE_Q) >= 0 &&
+ pkt->flags & AV_PKT_FLAG_KEY && os->packets_written) {
+
+ if ((ret = ism_flush(s, 0)) < 0)
+ return ret;
+ c->nb_fragments++;
+ }
+
+ os->packets_written++;
+ return ff_write_chained(os->ctx, 0, pkt, s);
+}
+
+static int ism_write_trailer(AVFormatContext *s)
+{
+ SmoothStreamingContext *c = s->priv_data;
+ ism_flush(s, 1);
+
+ if (c->remove_at_exit) {
+ char filename[1024];
+ snprintf(filename, sizeof(filename), "%s/Manifest", s->filename);
+ unlink(filename);
+ rmdir(s->filename);
+ }
+
+ ism_free(s);
+ return 0;
+}
+
+#define OFFSET(x) offsetof(SmoothStreamingContext, x)
+#define E AV_OPT_FLAG_ENCODING_PARAM
+static const AVOption options[] = {
+ { "window_size", "number of fragments kept in the manifest", OFFSET(window_size), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, E },
+ { "extra_window_size", "number of fragments kept outside of the manifest before removing from disk", OFFSET(extra_window_size), AV_OPT_TYPE_INT, { .i64 = 5 }, 0, INT_MAX, E },
+ { "lookahead_count", "number of lookahead fragments", OFFSET(lookahead_count), AV_OPT_TYPE_INT, { .i64 = 2 }, 0, INT_MAX, E },
+ { "min_frag_duration", "minimum fragment duration (in microseconds)", OFFSET(min_frag_duration), AV_OPT_TYPE_INT64, { .i64 = 5000000 }, 0, INT_MAX, E },
+ { "remove_at_exit", "remove all fragments when finished", OFFSET(remove_at_exit), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, E },
+ { NULL },
+};
+
+static const AVClass ism_class = {
+ .class_name = "smooth streaming muxer",
+ .item_name = av_default_item_name,
+ .option = options,
+ .version = LIBAVUTIL_VERSION_INT,
+};
+
+
+AVOutputFormat ff_smoothstreaming_muxer = {
+ .name = "smoothstreaming",
+ .long_name = NULL_IF_CONFIG_SMALL("Smooth Streaming Muxer"),
+ .priv_data_size = sizeof(SmoothStreamingContext),
+ .audio_codec = AV_CODEC_ID_AAC,
+ .video_codec = AV_CODEC_ID_H264,
+ .flags = AVFMT_GLOBALHEADER | AVFMT_NOFILE,
+ .write_header = ism_write_header,
+ .write_packet = ism_write_packet,
+ .write_trailer = ism_write_trailer,
+ .codec_tag = (const AVCodecTag* const []){ ff_mp4_obj_type, 0 },
+ .priv_class = &ism_class,
+};
diff --git a/gst-libs/ext/libav/libavformat/sol.c b/gst-libs/ext/libav/libavformat/sol.c
index 31c84ce..92599b1 100644
--- a/gst-libs/ext/libav/libavformat/sol.c
+++ b/gst-libs/ext/libav/libavformat/sol.c
@@ -23,6 +23,7 @@
* Based on documents from Game Audio Player and own research
*/
+#include "libavutil/channel_layout.h"
#include "libavutil/intreadwrite.h"
#include "avformat.h"
#include "internal.h"
@@ -47,21 +48,21 @@ static int sol_probe(AVProbeData *p)
#define SOL_16BIT 4
#define SOL_STEREO 16
-static enum CodecID sol_codec_id(int magic, int type)
+static enum AVCodecID sol_codec_id(int magic, int type)
{
if (magic == 0x0B8D)
{
- if (type & SOL_DPCM) return CODEC_ID_SOL_DPCM;
- else return CODEC_ID_PCM_U8;
+ if (type & SOL_DPCM) return AV_CODEC_ID_SOL_DPCM;
+ else return AV_CODEC_ID_PCM_U8;
}
if (type & SOL_DPCM)
{
- if (type & SOL_16BIT) return CODEC_ID_SOL_DPCM;
- else if (magic == 0x0C8D) return CODEC_ID_SOL_DPCM;
- else return CODEC_ID_SOL_DPCM;
+ if (type & SOL_16BIT) return AV_CODEC_ID_SOL_DPCM;
+ else if (magic == 0x0C8D) return AV_CODEC_ID_SOL_DPCM;
+ else return AV_CODEC_ID_SOL_DPCM;
}
- if (type & SOL_16BIT) return CODEC_ID_PCM_S16LE;
- return CODEC_ID_PCM_U8;
+ if (type & SOL_16BIT) return AV_CODEC_ID_PCM_S16LE;
+ return AV_CODEC_ID_PCM_U8;
}
static int sol_codec_type(int magic, int type)
@@ -82,13 +83,12 @@ static int sol_channels(int magic, int type)
return 2;
}
-static int sol_read_header(AVFormatContext *s,
- AVFormatParameters *ap)
+static int sol_read_header(AVFormatContext *s)
{
unsigned int magic,tag;
AVIOContext *pb = s->pb;
unsigned int id, channels, rate, type;
- enum CodecID codec;
+ enum AVCodecID codec;
AVStream *st;
/* check ".snd" header */
@@ -105,7 +105,7 @@ static int sol_read_header(AVFormatContext *s,
codec = sol_codec_id(magic, type);
channels = sol_channels(magic, type);
- if (codec == CODEC_ID_SOL_DPCM)
+ if (codec == AV_CODEC_ID_SOL_DPCM)
id = sol_codec_type(magic, type);
else id = 0;
@@ -117,6 +117,8 @@ static int sol_read_header(AVFormatContext *s,
st->codec->codec_tag = id;
st->codec->codec_id = codec;
st->codec->channels = channels;
+ st->codec->channel_layout = channels == 1 ? AV_CH_LAYOUT_MONO :
+ AV_CH_LAYOUT_STEREO;
st->codec->sample_rate = rate;
avpriv_set_pts_info(st, 64, 1, rate);
return 0;
@@ -144,9 +146,9 @@ static int sol_read_packet(AVFormatContext *s,
AVInputFormat ff_sol_demuxer = {
.name = "sol",
- .long_name = NULL_IF_CONFIG_SMALL("Sierra SOL format"),
+ .long_name = NULL_IF_CONFIG_SMALL("Sierra SOL"),
.read_probe = sol_probe,
.read_header = sol_read_header,
.read_packet = sol_read_packet,
- .read_seek = pcm_read_seek,
+ .read_seek = ff_pcm_read_seek,
};
diff --git a/gst-libs/ext/libav/libavformat/soxdec.c b/gst-libs/ext/libav/libavformat/soxdec.c
index 1074b3f..ec94675 100644
--- a/gst-libs/ext/libav/libavformat/soxdec.c
+++ b/gst-libs/ext/libav/libavformat/soxdec.c
@@ -44,8 +44,7 @@ static int sox_probe(AVProbeData *p)
return 0;
}
-static int sox_read_header(AVFormatContext *s,
- AVFormatParameters *ap)
+static int sox_read_header(AVFormatContext *s)
{
AVIOContext *pb = s->pb;
unsigned header_size, comment_size;
@@ -59,14 +58,14 @@ static int sox_read_header(AVFormatContext *s,
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
if (avio_rl32(pb) == SOX_TAG) {
- st->codec->codec_id = CODEC_ID_PCM_S32LE;
+ st->codec->codec_id = AV_CODEC_ID_PCM_S32LE;
header_size = avio_rl32(pb);
avio_skip(pb, 8); /* sample count */
sample_rate = av_int2double(avio_rl64(pb));
st->codec->channels = avio_rl32(pb);
comment_size = avio_rl32(pb);
} else {
- st->codec->codec_id = CODEC_ID_PCM_S32BE;
+ st->codec->codec_id = AV_CODEC_ID_PCM_S32BE;
header_size = avio_rb32(pb);
avio_skip(pb, 8); /* sample count */
sample_rate = av_int2double(avio_rb64(pb));
@@ -145,9 +144,9 @@ static int sox_read_packet(AVFormatContext *s,
AVInputFormat ff_sox_demuxer = {
.name = "sox",
- .long_name = NULL_IF_CONFIG_SMALL("SoX native format"),
+ .long_name = NULL_IF_CONFIG_SMALL("SoX native"),
.read_probe = sox_probe,
.read_header = sox_read_header,
.read_packet = sox_read_packet,
- .read_seek = pcm_read_seek,
+ .read_seek = ff_pcm_read_seek,
};
diff --git a/gst-libs/ext/libav/libavformat/soxenc.c b/gst-libs/ext/libav/libavformat/soxenc.c
index 55d5bd9..3e5d2e3 100644
--- a/gst-libs/ext/libav/libavformat/soxenc.c
+++ b/gst-libs/ext/libav/libavformat/soxenc.c
@@ -55,14 +55,14 @@ static int sox_write_header(AVFormatContext *s)
sox->header_size = SOX_FIXED_HDR + comment_size;
- if (enc->codec_id == CODEC_ID_PCM_S32LE) {
+ if (enc->codec_id == AV_CODEC_ID_PCM_S32LE) {
ffio_wfourcc(pb, ".SoX");
avio_wl32(pb, sox->header_size);
avio_wl64(pb, 0); /* number of samples */
avio_wl64(pb, av_double2int(enc->sample_rate));
avio_wl32(pb, enc->channels);
avio_wl32(pb, comment_size);
- } else if (enc->codec_id == CODEC_ID_PCM_S32BE) {
+ } else if (enc->codec_id == AV_CODEC_ID_PCM_S32BE) {
ffio_wfourcc(pb, "XoS.");
avio_wb32(pb, sox->header_size);
avio_wb64(pb, 0); /* number of samples */
@@ -103,7 +103,7 @@ static int sox_write_trailer(AVFormatContext *s)
int64_t file_size = avio_tell(pb);
int64_t num_samples = (file_size - sox->header_size - 4LL) >> 2LL;
avio_seek(pb, 8, SEEK_SET);
- if (enc->codec_id == CODEC_ID_PCM_S32LE) {
+ if (enc->codec_id == AV_CODEC_ID_PCM_S32LE) {
avio_wl64(pb, num_samples);
} else
avio_wb64(pb, num_samples);
@@ -117,11 +117,11 @@ static int sox_write_trailer(AVFormatContext *s)
AVOutputFormat ff_sox_muxer = {
.name = "sox",
- .long_name = NULL_IF_CONFIG_SMALL("SoX native format"),
+ .long_name = NULL_IF_CONFIG_SMALL("SoX native"),
.extensions = "sox",
.priv_data_size = sizeof(SoXContext),
- .audio_codec = CODEC_ID_PCM_S32LE,
- .video_codec = CODEC_ID_NONE,
+ .audio_codec = AV_CODEC_ID_PCM_S32LE,
+ .video_codec = AV_CODEC_ID_NONE,
.write_header = sox_write_header,
.write_packet = sox_write_packet,
.write_trailer = sox_write_trailer,
diff --git a/gst-libs/ext/libav/libavformat/spdifdec.c b/gst-libs/ext/libav/libavformat/spdifdec.c
index 3daf23f..6d37c94 100644
--- a/gst-libs/ext/libav/libavformat/spdifdec.c
+++ b/gst-libs/ext/libav/libavformat/spdifdec.c
@@ -33,7 +33,7 @@
static int spdif_get_offset_and_codec(AVFormatContext *s,
enum IEC61937DataType data_type,
const char *buf, int *offset,
- enum CodecID *codec)
+ enum AVCodecID *codec)
{
AACADTSHeaderInfo aac_hdr;
GetBitContext gbc;
@@ -41,19 +41,19 @@ static int spdif_get_offset_and_codec(AVFormatContext *s,
switch (data_type & 0xff) {
case IEC61937_AC3:
*offset = AC3_FRAME_SIZE << 2;
- *codec = CODEC_ID_AC3;
+ *codec = AV_CODEC_ID_AC3;
break;
case IEC61937_MPEG1_LAYER1:
*offset = spdif_mpeg_pkt_offset[1][0];
- *codec = CODEC_ID_MP1;
+ *codec = AV_CODEC_ID_MP1;
break;
case IEC61937_MPEG1_LAYER23:
*offset = spdif_mpeg_pkt_offset[1][0];
- *codec = CODEC_ID_MP3;
+ *codec = AV_CODEC_ID_MP3;
break;
case IEC61937_MPEG2_EXT:
*offset = 4608;
- *codec = CODEC_ID_MP3;
+ *codec = AV_CODEC_ID_MP3;
break;
case IEC61937_MPEG2_AAC:
init_get_bits(&gbc, buf, AAC_ADTS_HEADER_SIZE * 8);
@@ -63,36 +63,36 @@ static int spdif_get_offset_and_codec(AVFormatContext *s,
return AVERROR_INVALIDDATA;
}
*offset = aac_hdr.samples << 2;
- *codec = CODEC_ID_AAC;
+ *codec = AV_CODEC_ID_AAC;
break;
case IEC61937_MPEG2_LAYER1_LSF:
*offset = spdif_mpeg_pkt_offset[0][0];
- *codec = CODEC_ID_MP1;
+ *codec = AV_CODEC_ID_MP1;
break;
case IEC61937_MPEG2_LAYER2_LSF:
*offset = spdif_mpeg_pkt_offset[0][1];
- *codec = CODEC_ID_MP2;
+ *codec = AV_CODEC_ID_MP2;
break;
case IEC61937_MPEG2_LAYER3_LSF:
*offset = spdif_mpeg_pkt_offset[0][2];
- *codec = CODEC_ID_MP3;
+ *codec = AV_CODEC_ID_MP3;
break;
case IEC61937_DTS1:
*offset = 2048;
- *codec = CODEC_ID_DTS;
+ *codec = AV_CODEC_ID_DTS;
break;
case IEC61937_DTS2:
*offset = 4096;
- *codec = CODEC_ID_DTS;
+ *codec = AV_CODEC_ID_DTS;
break;
case IEC61937_DTS3:
*offset = 8192;
- *codec = CODEC_ID_DTS;
+ *codec = AV_CODEC_ID_DTS;
break;
default:
if (s) { /* be silent during a probe */
av_log(s, AV_LOG_WARNING, "Data type 0x%04x", data_type);
- av_log_missing_feature(s, " in IEC 61937 is", 1);
+ av_log_missing_feature(s, " in IEC 61937", 1);
}
return AVERROR_PATCHWELCOME;
}
@@ -112,7 +112,7 @@ static int spdif_probe(AVProbeData *p)
int sync_codes = 0;
int consecutive_codes = 0;
int offset;
- enum CodecID codec;
+ enum AVCodecID codec;
for (; buf < probe_end; buf++) {
state = (state << 8) | *buf;
@@ -155,7 +155,7 @@ static int spdif_probe(AVProbeData *p)
return AVPROBE_SCORE_MAX / 8;
}
-static int spdif_read_header(AVFormatContext *s, AVFormatParameters *ap)
+static int spdif_read_header(AVFormatContext *s)
{
s->ctx_flags |= AVFMTCTX_NOHEADER;
return 0;
@@ -165,7 +165,7 @@ static int spdif_read_packet(AVFormatContext *s, AVPacket *pkt)
{
AVIOContext *pb = s->pb;
enum IEC61937DataType data_type;
- enum CodecID codec_id;
+ enum AVCodecID codec_id;
uint32_t state = 0;
int pkt_size_bits, offset, ret;
@@ -213,7 +213,7 @@ static int spdif_read_packet(AVFormatContext *s, AVPacket *pkt)
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
st->codec->codec_id = codec_id;
} else if (codec_id != s->streams[0]->codec->codec_id) {
- av_log_missing_feature(s, "codec change in IEC 61937", 0);
+ av_log_missing_feature(s, "Codec change in IEC 61937", 0);
return AVERROR_PATCHWELCOME;
}
@@ -231,5 +231,5 @@ AVInputFormat ff_spdif_demuxer = {
.read_probe = spdif_probe,
.read_header = spdif_read_header,
.read_packet = spdif_read_packet,
- .flags = AVFMT_GENERIC_INDEX,
+ .flags = AVFMT_GENERIC_INDEX,
};
diff --git a/gst-libs/ext/libav/libavformat/spdifenc.c b/gst-libs/ext/libav/libavformat/spdifenc.c
index 5a1b8e4..cf421a7 100644
--- a/gst-libs/ext/libav/libavformat/spdifenc.c
+++ b/gst-libs/ext/libav/libavformat/spdifenc.c
@@ -49,7 +49,6 @@
#include "spdif.h"
#include "libavcodec/ac3.h"
#include "libavcodec/dca.h"
-#include "libavcodec/dcadata.h"
#include "libavcodec/aacadtsdec.h"
#include "libavutil/opt.h"
@@ -86,10 +85,10 @@ typedef struct IEC61937Context {
} IEC61937Context;
static const AVOption options[] = {
-{ "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 },
+{ "spdif_flags", "IEC 61937 encapsulation flags", offsetof(IEC61937Context, spdif_flags), AV_OPT_TYPE_FLAGS, {.i64 = 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, {.i64 = 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, {.i64 = 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, {.i64 = 60}, -1, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM },
{ NULL },
};
@@ -253,7 +252,7 @@ static int spdif_header_dts(AVFormatContext *s, AVPacket *pkt)
case DCA_MARKER_RAW_BE:
blocks = (AV_RB16(pkt->data + 4) >> 2) & 0x7f;
core_size = ((AV_RB24(pkt->data + 5) >> 4) & 0x3fff) + 1;
- sample_rate = dca_sample_rates[(pkt->data[8] >> 2) & 0x0f];
+ sample_rate = avpriv_dca_sample_rates[(pkt->data[8] >> 2) & 0x0f];
break;
case DCA_MARKER_RAW_LE:
blocks = (AV_RL16(pkt->data + 4) >> 2) & 0x7f;
@@ -340,7 +339,7 @@ static int spdif_header_mpeg(AVFormatContext *s, AVPacket *pkt)
ctx->data_type = mpeg_data_type [version & 1][layer];
ctx->pkt_offset = spdif_mpeg_pkt_offset[version & 1][layer];
}
- // TODO Data type dependant info (normal/karaoke, dynamic range control)
+ // TODO Data type dependent info (normal/karaoke, dynamic range control)
return 0;
}
@@ -415,7 +414,7 @@ static int spdif_header_truehd(AVFormatContext *s, AVPacket *pkt)
* distribute the TrueHD frames in the MAT frame */
av_log(s, AV_LOG_ERROR, "TrueHD frame too big, %d bytes\n", pkt->size);
av_log_ask_for_sample(s, NULL);
- return AVERROR_INVALIDDATA;
+ return AVERROR_PATCHWELCOME;
}
memcpy(&ctx->hd_buf[ctx->hd_buf_count * TRUEHD_FRAME_OFFSET - BURST_HEADER_SIZE + mat_code_length],
@@ -443,24 +442,24 @@ static int spdif_write_header(AVFormatContext *s)
IEC61937Context *ctx = s->priv_data;
switch (s->streams[0]->codec->codec_id) {
- case CODEC_ID_AC3:
+ case AV_CODEC_ID_AC3:
ctx->header_info = spdif_header_ac3;
break;
- case CODEC_ID_EAC3:
+ case AV_CODEC_ID_EAC3:
ctx->header_info = spdif_header_eac3;
break;
- case CODEC_ID_MP1:
- case CODEC_ID_MP2:
- case CODEC_ID_MP3:
+ case AV_CODEC_ID_MP1:
+ case AV_CODEC_ID_MP2:
+ case AV_CODEC_ID_MP3:
ctx->header_info = spdif_header_mpeg;
break;
- case CODEC_ID_DTS:
+ case AV_CODEC_ID_DTS:
ctx->header_info = spdif_header_dts;
break;
- case CODEC_ID_AAC:
+ case AV_CODEC_ID_AAC:
ctx->header_info = spdif_header_aac;
break;
- case CODEC_ID_TRUEHD:
+ case AV_CODEC_ID_TRUEHD:
ctx->header_info = spdif_header_truehd;
ctx->hd_buf = av_malloc(MAT_FRAME_SIZE);
if (!ctx->hd_buf)
@@ -548,11 +547,11 @@ AVOutputFormat ff_spdif_muxer = {
.long_name = NULL_IF_CONFIG_SMALL("IEC 61937 (used on S/PDIF - IEC958)"),
.extensions = "spdif",
.priv_data_size = sizeof(IEC61937Context),
- .audio_codec = CODEC_ID_AC3,
- .video_codec = CODEC_ID_NONE,
+ .audio_codec = AV_CODEC_ID_AC3,
+ .video_codec = AV_CODEC_ID_NONE,
.write_header = spdif_write_header,
.write_packet = spdif_write_packet,
.write_trailer = spdif_write_trailer,
- .flags = AVFMT_NOTIMESTAMPS,
- .priv_class = &class,
+ .flags = AVFMT_NOTIMESTAMPS,
+ .priv_class = &class,
};
diff --git a/gst-libs/ext/libav/libavformat/srtdec.c b/gst-libs/ext/libav/libavformat/srtdec.c
index ca0a304..9db5133 100644
--- a/gst-libs/ext/libav/libavformat/srtdec.c
+++ b/gst-libs/ext/libav/libavformat/srtdec.c
@@ -40,14 +40,14 @@ static int srt_probe(AVProbeData *p)
return 0;
}
-static int srt_read_header(AVFormatContext *s, AVFormatParameters *ap)
+static int srt_read_header(AVFormatContext *s)
{
AVStream *st = avformat_new_stream(s, NULL);
if (!st)
return -1;
avpriv_set_pts_info(st, 64, 1, 1000);
st->codec->codec_type = AVMEDIA_TYPE_SUBTITLE;
- st->codec->codec_id = CODEC_ID_SRT;
+ st->codec->codec_id = AV_CODEC_ID_SRT;
return 0;
}
@@ -94,7 +94,7 @@ static int srt_read_packet(AVFormatContext *s, AVPacket *pkt)
AVInputFormat ff_srt_demuxer = {
.name = "srt",
- .long_name = NULL_IF_CONFIG_SMALL("SubRip subtitle format"),
+ .long_name = NULL_IF_CONFIG_SMALL("SubRip subtitle"),
.read_probe = srt_probe,
.read_header = srt_read_header,
.read_packet = srt_read_packet,
diff --git a/gst-libs/ext/libav/libavformat/swf.c b/gst-libs/ext/libav/libavformat/swf.c
new file mode 100644
index 0000000..e6adf69
--- /dev/null
+++ b/gst-libs/ext/libav/libavformat/swf.c
@@ -0,0 +1,29 @@
+/*
+ * Flash Compatible Streaming Format
+ * Copyright (c) 2000 Fabrice Bellard
+ * Copyright (c) 2003 Tinic Uro
+ *
+ * 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
+ */
+
+#include "internal.h"
+
+const AVCodecTag ff_swf_codec_tags[] = {
+ { AV_CODEC_ID_FLV1, 0x02 },
+ { AV_CODEC_ID_VP6F, 0x04 },
+ { AV_CODEC_ID_NONE, 0 },
+};
diff --git a/gst-libs/ext/libav/libavformat/swf.h b/gst-libs/ext/libav/libavformat/swf.h
index 2be6cd5..79c3c1d 100644
--- a/gst-libs/ext/libav/libavformat/swf.h
+++ b/gst-libs/ext/libav/libavformat/swf.h
@@ -26,7 +26,7 @@
#include "libavutil/fifo.h"
#include "avformat.h"
#include "avio.h"
-#include "riff.h" /* for CodecTag */
+#include "internal.h"
/* should have a generic way to indicate probable size */
#define DUMMY_FILE_SIZE (100 * 1024 * 1024)
@@ -64,7 +64,7 @@
#undef NDEBUG
#include <assert.h>
-typedef struct {
+typedef struct SWFContext {
int64_t duration_pos;
int64_t tag_pos;
int64_t vframes_pos;
@@ -78,19 +78,6 @@ typedef struct {
AVCodecContext *audio_enc, *video_enc;
} SWFContext;
-static const AVCodecTag swf_codec_tags[] = {
- {CODEC_ID_FLV1, 0x02},
- {CODEC_ID_VP6F, 0x04},
- {CODEC_ID_NONE, 0},
-};
-
-static const AVCodecTag swf_audio_codec_tags[] = {
- {CODEC_ID_PCM_S16LE, 0x00},
- {CODEC_ID_ADPCM_SWF, 0x01},
- {CODEC_ID_MP3, 0x02},
- {CODEC_ID_PCM_S16LE, 0x03},
- //{CODEC_ID_NELLYMOSER, 0x06},
- {CODEC_ID_NONE, 0},
-};
+extern const AVCodecTag ff_swf_codec_tags[];
#endif /* AVFORMAT_SWF_H */
diff --git a/gst-libs/ext/libav/libavformat/swfdec.c b/gst-libs/ext/libav/libavformat/swfdec.c
index 6966176..d7a5314 100644
--- a/gst-libs/ext/libav/libavformat/swfdec.c
+++ b/gst-libs/ext/libav/libavformat/swfdec.c
@@ -20,9 +20,19 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "libavutil/channel_layout.h"
#include "libavutil/intreadwrite.h"
#include "swf.h"
+static const AVCodecTag swf_audio_codec_tags[] = {
+ { AV_CODEC_ID_PCM_S16LE, 0x00 },
+ { AV_CODEC_ID_ADPCM_SWF, 0x01 },
+ { AV_CODEC_ID_MP3, 0x02 },
+ { AV_CODEC_ID_PCM_S16LE, 0x03 },
+// { AV_CODEC_ID_NELLYMOSER, 0x06 },
+ { AV_CODEC_ID_NONE, 0 },
+};
+
static int get_swf_tag(AVIOContext *pb, int *len_ptr)
{
int tag, len;
@@ -36,7 +46,6 @@ static int get_swf_tag(AVIOContext *pb, int *len_ptr)
if (len == 0x3f) {
len = avio_rl32(pb);
}
-// av_log(NULL, AV_LOG_DEBUG, "Tag: %d - Len: %d\n", tag, len);
*len_ptr = len;
return tag;
}
@@ -52,7 +61,7 @@ static int swf_probe(AVProbeData *p)
return 0;
}
-static int swf_read_header(AVFormatContext *s, AVFormatParameters *ap)
+static int swf_read_header(AVFormatContext *s)
{
SWFContext *swf = s->priv_data;
AVIOContext *pb = s->pb;
@@ -91,6 +100,10 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt)
tag = get_swf_tag(pb, &len);
if (tag < 0)
return AVERROR(EIO);
+ if (len < 0) {
+ av_log(s, AV_LOG_ERROR, "invalid tag length: %d\n", len);
+ return AVERROR_INVALIDDATA;
+ }
if (tag == TAG_VIDEOSTREAM) {
int ch_id = avio_rl16(pb);
len -= 2;
@@ -111,9 +124,8 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt)
return -1;
vst->id = ch_id;
vst->codec->codec_type = AVMEDIA_TYPE_VIDEO;
- vst->codec->codec_id = ff_codec_get_id(swf_codec_tags, avio_r8(pb));
+ vst->codec->codec_id = ff_codec_get_id(ff_swf_codec_tags, avio_r8(pb));
avpriv_set_pts_info(vst, 16, 256, swf->frame_rate);
- vst->codec->time_base = (AVRational){ 256, swf->frame_rate };
len -= 8;
} else if (tag == TAG_STREAMHEAD || tag == TAG_STREAMHEAD2) {
/* streaming found */
@@ -132,15 +144,18 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt)
if (!ast)
return -1;
ast->id = -1; /* -1 to avoid clash with video stream ch_id */
- ast->codec->channels = 1 + (v&1);
+ if (v & 1) {
+ ast->codec->channels = 2;
+ ast->codec->channel_layout = AV_CH_LAYOUT_STEREO;
+ } else {
+ ast->codec->channels = 1;
+ ast->codec->channel_layout = AV_CH_LAYOUT_MONO;
+ }
ast->codec->codec_type = AVMEDIA_TYPE_AUDIO;
ast->codec->codec_id = ff_codec_get_id(swf_audio_codec_tags, (v>>4) & 15);
ast->need_parsing = AVSTREAM_PARSE_FULL;
sample_rate_code= (v>>2) & 3;
- if (!sample_rate_code)
- ast->codec->sample_rate = 5512;
- else
- ast->codec->sample_rate = 11025 << (sample_rate_code-1);
+ ast->codec->sample_rate = 44100 >> (3 - sample_rate_code);
avpriv_set_pts_info(ast, 64, 1, ast->codec->sample_rate);
len -= 4;
} else if (tag == TAG_VIDEOFRAME) {
@@ -150,7 +165,10 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt)
st = s->streams[i];
if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO && st->id == ch_id) {
frame = avio_rl16(pb);
- if ((res = av_get_packet(pb, pkt, len-2)) < 0)
+ len -= 2;
+ if (len <= 0)
+ goto skip;
+ if ((res = av_get_packet(pb, pkt, len)) < 0)
return res;
pkt->pos = pos;
pkt->pts = frame;
@@ -162,23 +180,28 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt)
for (i = 0; i < s->nb_streams; i++) {
st = s->streams[i];
if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO && st->id == -1) {
- if (st->codec->codec_id == CODEC_ID_MP3) {
- avio_skip(pb, 4);
- if ((res = av_get_packet(pb, pkt, len-4)) < 0)
- return res;
- } else { // ADPCM, PCM
- if ((res = av_get_packet(pb, pkt, len)) < 0)
- return res;
- }
- pkt->pos = pos;
- pkt->stream_index = st->index;
- return pkt->size;
+ if (st->codec->codec_id == AV_CODEC_ID_MP3) {
+ avio_skip(pb, 4);
+ len -= 4;
+ if (len <= 0)
+ goto skip;
+ if ((res = av_get_packet(pb, pkt, len)) < 0)
+ return res;
+ } else { // ADPCM, PCM
+ if (len <= 0)
+ goto skip;
+ if ((res = av_get_packet(pb, pkt, len)) < 0)
+ return res;
+ }
+ pkt->pos = pos;
+ pkt->stream_index = st->index;
+ return pkt->size;
}
}
} else if (tag == TAG_JPEG2) {
for (i=0; i<s->nb_streams; i++) {
st = s->streams[i];
- if (st->codec->codec_id == CODEC_ID_MJPEG && st->id == -2)
+ if (st->codec->codec_id == AV_CODEC_ID_MJPEG && st->id == -2)
break;
}
if (i == s->nb_streams) {
@@ -187,13 +210,15 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt)
return -1;
vst->id = -2; /* -2 to avoid clash with video stream and audio stream */
vst->codec->codec_type = AVMEDIA_TYPE_VIDEO;
- vst->codec->codec_id = CODEC_ID_MJPEG;
+ vst->codec->codec_id = AV_CODEC_ID_MJPEG;
avpriv_set_pts_info(vst, 64, 256, swf->frame_rate);
- vst->codec->time_base = (AVRational){ 256, swf->frame_rate };
st = vst;
}
avio_rl16(pb); /* BITMAP_ID */
- if ((res = av_new_packet(pkt, len-2)) < 0)
+ len -= 2;
+ if (len < 4)
+ goto skip;
+ if ((res = av_new_packet(pkt, len)) < 0)
return res;
avio_read(pb, pkt->data, 4);
if (AV_RB32(pkt->data) == 0xffd8ffd9 ||
@@ -210,13 +235,14 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt)
return pkt->size;
}
skip:
+ len = FFMAX(0, len);
avio_skip(pb, len);
}
}
AVInputFormat ff_swf_demuxer = {
.name = "swf",
- .long_name = NULL_IF_CONFIG_SMALL("Flash format"),
+ .long_name = NULL_IF_CONFIG_SMALL("SWF (ShockWave Flash)"),
.priv_data_size = sizeof(SWFContext),
.read_probe = swf_probe,
.read_header = swf_read_header,
diff --git a/gst-libs/ext/libav/libavformat/swfenc.c b/gst-libs/ext/libav/libavformat/swfenc.c
index f4494cd..31f405d 100644
--- a/gst-libs/ext/libav/libavformat/swfenc.c
+++ b/gst-libs/ext/libav/libavformat/swfenc.c
@@ -186,11 +186,11 @@ static int swf_write_header(AVFormatContext *s)
for(i=0;i<s->nb_streams;i++) {
AVCodecContext *enc = s->streams[i]->codec;
if (enc->codec_type == AVMEDIA_TYPE_AUDIO) {
- if (enc->codec_id == CODEC_ID_MP3) {
- if (!enc->frame_size) {
- av_log(s, AV_LOG_ERROR, "audio frame size not set\n");
- return -1;
- }
+ if (swf->audio_enc) {
+ av_log(s, AV_LOG_ERROR, "SWF muxer only supports 1 audio stream\n");
+ return AVERROR_INVALIDDATA;
+ }
+ if (enc->codec_id == AV_CODEC_ID_MP3) {
swf->audio_enc = enc;
swf->audio_fifo= av_fifo_alloc(AUDIO_FIFO_SIZE);
if (!swf->audio_fifo)
@@ -200,9 +200,13 @@ static int swf_write_header(AVFormatContext *s)
return -1;
}
} else {
- if (enc->codec_id == CODEC_ID_VP6F ||
- enc->codec_id == CODEC_ID_FLV1 ||
- enc->codec_id == CODEC_ID_MJPEG) {
+ if (swf->video_enc) {
+ av_log(s, AV_LOG_ERROR, "SWF muxer only supports 1 video stream\n");
+ return AVERROR_INVALIDDATA;
+ }
+ if (enc->codec_id == AV_CODEC_ID_VP6F ||
+ enc->codec_id == AV_CODEC_ID_FLV1 ||
+ enc->codec_id == AV_CODEC_ID_MJPEG) {
swf->video_enc = enc;
} else {
av_log(s, AV_LOG_ERROR, "SWF muxer only supports VP6, FLV1 and MJPEG\n");
@@ -233,9 +237,9 @@ static int swf_write_header(AVFormatContext *s)
if (!strcmp("avm2", s->oformat->name))
version = 9;
- else if (swf->video_enc && swf->video_enc->codec_id == CODEC_ID_VP6F)
+ else if (swf->video_enc && swf->video_enc->codec_id == AV_CODEC_ID_VP6F)
version = 8; /* version 8 and above support VP6 codec */
- else if (swf->video_enc && swf->video_enc->codec_id == CODEC_ID_FLV1)
+ else if (swf->video_enc && swf->video_enc->codec_id == AV_CODEC_ID_FLV1)
version = 6; /* version 6 and above support FLV1 codec */
else
version = 4; /* version 4 for mpeg audio support */
@@ -257,7 +261,7 @@ static int swf_write_header(AVFormatContext *s)
}
/* define a shape with the jpeg inside */
- if (swf->video_enc && swf->video_enc->codec_id == CODEC_ID_MJPEG) {
+ if (swf->video_enc && swf->video_enc->codec_id == AV_CODEC_ID_MJPEG) {
put_swf_tag(s, TAG_DEFINESHAPE);
avio_wl16(pb, SHAPE_ID); /* ID of shape */
@@ -300,7 +304,7 @@ static int swf_write_header(AVFormatContext *s)
put_swf_end_tag(s);
}
- if (swf->audio_enc && swf->audio_enc->codec_id == CODEC_ID_MP3) {
+ if (swf->audio_enc && swf->audio_enc->codec_id == AV_CODEC_ID_MP3) {
int v = 0;
/* start sound */
@@ -340,8 +344,8 @@ static int swf_write_video(AVFormatContext *s,
if (swf->swf_frame_number == 16000)
av_log(enc, AV_LOG_INFO, "warning: Flash Player limit of 16000 frames reached\n");
- if (enc->codec_id == CODEC_ID_VP6F ||
- enc->codec_id == CODEC_ID_FLV1) {
+ if (enc->codec_id == AV_CODEC_ID_VP6F ||
+ enc->codec_id == AV_CODEC_ID_FLV1) {
if (swf->video_frame_number == 0) {
/* create a new video object */
put_swf_tag(s, TAG_VIDEOSTREAM);
@@ -351,7 +355,7 @@ static int swf_write_video(AVFormatContext *s,
avio_wl16(pb, enc->width);
avio_wl16(pb, enc->height);
avio_w8(pb, 0);
- avio_w8(pb,ff_codec_get_tag(swf_codec_tags,enc->codec_id));
+ avio_w8(pb,ff_codec_get_tag(ff_swf_codec_tags, enc->codec_id));
put_swf_end_tag(s);
/* place the video object for the first time */
@@ -379,7 +383,7 @@ static int swf_write_video(AVFormatContext *s,
avio_wl16(pb, swf->video_frame_number++);
avio_write(pb, buf, size);
put_swf_end_tag(s);
- } else if (enc->codec_id == CODEC_ID_MJPEG) {
+ } else if (enc->codec_id == AV_CODEC_ID_MJPEG) {
if (swf->swf_frame_number > 0) {
/* remove the shape */
put_swf_tag(s, TAG_REMOVEOBJECT);
@@ -452,7 +456,7 @@ static int swf_write_audio(AVFormatContext *s,
}
av_fifo_generic_write(swf->audio_fifo, buf, size, NULL);
- swf->sound_samples += enc->frame_size;
+ swf->sound_samples += av_get_audio_frame_duration(enc, size);
/* if audio only stream make sure we add swf frames */
if (!swf->video_enc)
@@ -489,8 +493,6 @@ static int swf_write_trailer(AVFormatContext *s)
put_swf_tag(s, TAG_END);
put_swf_end_tag(s);
- avio_flush(s->pb);
-
/* patch file size and number of frames if not streamed */
if (s->pb->seekable && video_enc) {
file_size = avio_tell(pb);
@@ -508,27 +510,29 @@ static int swf_write_trailer(AVFormatContext *s)
#if CONFIG_SWF_MUXER
AVOutputFormat ff_swf_muxer = {
.name = "swf",
- .long_name = NULL_IF_CONFIG_SMALL("Flash format"),
+ .long_name = NULL_IF_CONFIG_SMALL("SWF (ShockWave Flash)"),
.mime_type = "application/x-shockwave-flash",
.extensions = "swf",
.priv_data_size = sizeof(SWFContext),
- .audio_codec = CODEC_ID_MP3,
- .video_codec = CODEC_ID_FLV1,
+ .audio_codec = AV_CODEC_ID_MP3,
+ .video_codec = AV_CODEC_ID_FLV1,
.write_header = swf_write_header,
.write_packet = swf_write_packet,
.write_trailer = swf_write_trailer,
+ .flags = AVFMT_TS_NONSTRICT,
};
#endif
#if CONFIG_AVM2_MUXER
AVOutputFormat ff_avm2_muxer = {
.name = "avm2",
- .long_name = NULL_IF_CONFIG_SMALL("Flash 9 (AVM2) format"),
+ .long_name = NULL_IF_CONFIG_SMALL("SWF (ShockWave Flash) (AVM2)"),
.mime_type = "application/x-shockwave-flash",
.priv_data_size = sizeof(SWFContext),
- .audio_codec = CODEC_ID_MP3,
- .video_codec = CODEC_ID_FLV1,
+ .audio_codec = AV_CODEC_ID_MP3,
+ .video_codec = AV_CODEC_ID_FLV1,
.write_header = swf_write_header,
.write_packet = swf_write_packet,
.write_trailer = swf_write_trailer,
+ .flags = AVFMT_TS_NONSTRICT,
};
#endif
diff --git a/gst-libs/ext/libav/libavformat/takdec.c b/gst-libs/ext/libav/libavformat/takdec.c
new file mode 100644
index 0000000..13bc49b
--- /dev/null
+++ b/gst-libs/ext/libav/libavformat/takdec.c
@@ -0,0 +1,185 @@
+/*
+ * Raw TAK demuxer
+ * Copyright (c) 2012 Paul B Mahol
+ *
+ * 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
+ */
+
+#include "libavcodec/tak.h"
+#include "avformat.h"
+#include "internal.h"
+#include "rawdec.h"
+#include "apetag.h"
+
+typedef struct TAKDemuxContext {
+ int mlast_frame;
+ int64_t data_end;
+} TAKDemuxContext;
+
+static int tak_probe(AVProbeData *p)
+{
+ if (!memcmp(p->buf, "tBaK", 4))
+ return AVPROBE_SCORE_MAX / 2;
+ return 0;
+}
+
+static int tak_read_header(AVFormatContext *s)
+{
+ TAKDemuxContext *tc = s->priv_data;
+ AVIOContext *pb = s->pb;
+ GetBitContext gb;
+ AVStream *st;
+ uint8_t *buffer = NULL;
+ int ret;
+
+ st = avformat_new_stream(s, 0);
+ if (!st)
+ return AVERROR(ENOMEM);
+
+ st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
+ st->codec->codec_id = AV_CODEC_ID_TAK;
+ st->need_parsing = AVSTREAM_PARSE_FULL;
+
+ tc->mlast_frame = 0;
+ if (avio_rl32(pb) != MKTAG('t', 'B', 'a', 'K')) {
+ avio_seek(pb, -4, SEEK_CUR);
+ return 0;
+ }
+
+ while (!pb->eof_reached) {
+ enum TAKMetaDataType type;
+ int size;
+
+ type = avio_r8(pb) & 0x7f;
+ size = avio_rl24(pb);
+
+ switch (type) {
+ case TAK_METADATA_STREAMINFO:
+ case TAK_METADATA_LAST_FRAME:
+ case TAK_METADATA_ENCODER:
+ buffer = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE);
+ if (!buffer)
+ return AVERROR(ENOMEM);
+
+ if (avio_read(pb, buffer, size) != size) {
+ av_freep(&buffer);
+ return AVERROR(EIO);
+ }
+
+ init_get_bits(&gb, buffer, size * 8);
+ break;
+ case TAK_METADATA_MD5: {
+ uint8_t md5[16];
+ int i;
+
+ if (size != 19)
+ return AVERROR_INVALIDDATA;
+ avio_read(pb, md5, 16);
+ avio_skip(pb, 3);
+ av_log(s, AV_LOG_VERBOSE, "MD5=");
+ for (i = 0; i < 16; i++)
+ av_log(s, AV_LOG_VERBOSE, "%02x", md5[i]);
+ av_log(s, AV_LOG_VERBOSE, "\n");
+ break;
+ }
+ case TAK_METADATA_END: {
+ int64_t curpos = avio_tell(pb);
+
+ if (pb->seekable) {
+ ff_ape_parse_tag(s);
+ avio_seek(pb, curpos, SEEK_SET);
+ }
+
+ tc->data_end += curpos;
+ return 0;
+ }
+ default:
+ ret = avio_skip(pb, size);
+ if (ret < 0)
+ return ret;
+ }
+
+ if (type == TAK_METADATA_STREAMINFO) {
+ TAKStreamInfo ti;
+
+ avpriv_tak_parse_streaminfo(&gb, &ti);
+ if (ti.samples > 0)
+ st->duration = ti.samples;
+ st->codec->bits_per_coded_sample = ti.bps;
+ if (ti.ch_layout)
+ st->codec->channel_layout = ti.ch_layout;
+ st->codec->sample_rate = ti.sample_rate;
+ st->codec->channels = ti.channels;
+ st->start_time = 0;
+ avpriv_set_pts_info(st, 64, 1, st->codec->sample_rate);
+ st->codec->extradata = buffer;
+ st->codec->extradata_size = size;
+ buffer = NULL;
+ } else if (type == TAK_METADATA_LAST_FRAME) {
+ if (size != 11)
+ return AVERROR_INVALIDDATA;
+ tc->mlast_frame = 1;
+ tc->data_end = get_bits64(&gb, TAK_LAST_FRAME_POS_BITS) +
+ get_bits(&gb, TAK_LAST_FRAME_SIZE_BITS);
+ av_freep(&buffer);
+ } else if (type == TAK_METADATA_ENCODER) {
+ av_log(s, AV_LOG_VERBOSE, "encoder version: %0X\n",
+ get_bits_long(&gb, TAK_ENCODER_VERSION_BITS));
+ av_freep(&buffer);
+ }
+ }
+
+ return AVERROR_EOF;
+}
+
+static int raw_read_packet(AVFormatContext *s, AVPacket *pkt)
+{
+ TAKDemuxContext *tc = s->priv_data;
+ int ret;
+
+ if (tc->mlast_frame) {
+ AVIOContext *pb = s->pb;
+ int64_t size, left;
+
+ left = tc->data_end - avio_tell(s->pb);
+ size = FFMIN(left, 1024);
+ if (size <= 0)
+ return AVERROR_EOF;
+
+ ret = av_get_packet(pb, pkt, size);
+ if (ret < 0)
+ return ret;
+
+ pkt->stream_index = 0;
+ } else {
+ ret = ff_raw_read_partial_packet(s, pkt);
+ }
+
+ return ret;
+}
+
+AVInputFormat ff_tak_demuxer = {
+ .name = "tak",
+ .long_name = NULL_IF_CONFIG_SMALL("raw TAK"),
+ .priv_data_size = sizeof(TAKDemuxContext),
+ .read_probe = tak_probe,
+ .read_header = tak_read_header,
+ .read_packet = raw_read_packet,
+ .flags = AVFMT_GENERIC_INDEX,
+ .extensions = "tak",
+ .raw_codec_id = AV_CODEC_ID_TAK,
+};
diff --git a/gst-libs/ext/libav/libavformat/tcp.c b/gst-libs/ext/libav/libavformat/tcp.c
index fdb457e..bdaab7f 100644
--- a/gst-libs/ext/libav/libavformat/tcp.c
+++ b/gst-libs/ext/libav/libavformat/tcp.c
@@ -20,7 +20,6 @@
*/
#include "avformat.h"
#include "libavutil/parseutils.h"
-#include <unistd.h>
#include "internal.h"
#include "network.h"
#include "os_support.h"
@@ -28,7 +27,6 @@
#if HAVE_POLL_H
#include <poll.h>
#endif
-#include <sys/time.h>
typedef struct TCPContext {
int fd;
@@ -37,7 +35,7 @@ typedef struct TCPContext {
/* return non zero if error */
static int tcp_open(URLContext *h, const char *uri, int flags)
{
- struct addrinfo hints, *ai, *cur_ai;
+ struct addrinfo hints = { 0 }, *ai, *cur_ai;
int port, fd = -1;
TCPContext *s = h->priv_data;
int listen_socket = 0;
@@ -45,15 +43,18 @@ static int tcp_open(URLContext *h, const char *uri, int flags)
char buf[256];
int ret;
socklen_t optlen;
- int timeout = 100;
+ int timeout = 100, listen_timeout = -1;
char hostname[1024],proto[1024],path[1024];
char portstr[10];
av_url_split(proto, sizeof(proto), NULL, 0, hostname, sizeof(hostname),
&port, path, sizeof(path), uri);
- if (strcmp(proto,"tcp") || port <= 0 || port >= 65536)
+ if (strcmp(proto, "tcp"))
return AVERROR(EINVAL);
-
+ if (port <= 0 || port >= 65536) {
+ av_log(h, AV_LOG_ERROR, "Port missing in uri\n");
+ return AVERROR(EINVAL);
+ }
p = strchr(uri, '?');
if (p) {
if (av_find_info_tag(buf, sizeof(buf), "listen", p))
@@ -61,12 +62,19 @@ static int tcp_open(URLContext *h, const char *uri, int flags)
if (av_find_info_tag(buf, sizeof(buf), "timeout", p)) {
timeout = strtol(buf, NULL, 10);
}
+ if (av_find_info_tag(buf, sizeof(buf), "listen_timeout", p)) {
+ listen_timeout = strtol(buf, NULL, 10);
+ }
}
- memset(&hints, 0, sizeof(hints));
hints.ai_family = AF_UNSPEC;
hints.ai_socktype = SOCK_STREAM;
snprintf(portstr, sizeof(portstr), "%d", port);
- ret = getaddrinfo(hostname, portstr, &hints, &ai);
+ if (listen_socket)
+ hints.ai_flags |= AI_PASSIVE;
+ if (!hostname[0])
+ ret = getaddrinfo(NULL, portstr, &hints, &ai);
+ else
+ ret = getaddrinfo(hostname, portstr, &hints, &ai);
if (ret) {
av_log(h, AV_LOG_ERROR,
"Failed to resolve hostname %s: %s\n",
@@ -84,9 +92,29 @@ static int tcp_open(URLContext *h, const char *uri, int flags)
if (listen_socket) {
int fd1;
+ int reuse = 1;
+ struct pollfd lp = { fd, POLLIN, 0 };
+ setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &reuse, sizeof(reuse));
ret = bind(fd, cur_ai->ai_addr, cur_ai->ai_addrlen);
- listen(fd, 1);
+ if (ret) {
+ ret = ff_neterrno();
+ goto fail1;
+ }
+ ret = listen(fd, 1);
+ if (ret) {
+ ret = ff_neterrno();
+ goto fail1;
+ }
+ ret = poll(&lp, 1, listen_timeout >= 0 ? listen_timeout : -1);
+ if (ret <= 0) {
+ ret = AVERROR(ETIMEDOUT);
+ goto fail1;
+ }
fd1 = accept(fd, NULL, NULL);
+ if (fd1 < 0) {
+ ret = ff_neterrno();
+ goto fail1;
+ }
closesocket(fd);
fd = fd1;
ff_socket_nonblock(fd, 1);
@@ -126,12 +154,15 @@ static int tcp_open(URLContext *h, const char *uri, int flags)
}
/* test error */
optlen = sizeof(ret);
- getsockopt (fd, SOL_SOCKET, SO_ERROR, &ret, &optlen);
+ if (getsockopt (fd, SOL_SOCKET, SO_ERROR, &ret, &optlen))
+ ret = AVUNERROR(ff_neterrno());
if (ret != 0) {
+ char errbuf[100];
+ ret = AVERROR(ret);
+ av_strerror(ret, errbuf, sizeof(errbuf));
av_log(h, AV_LOG_ERROR,
"TCP connection to %s:%d failed: %s\n",
- hostname, port, strerror(ret));
- ret = AVERROR(ret);
+ hostname, port, errbuf);
goto fail;
}
}
@@ -183,6 +214,22 @@ static int tcp_write(URLContext *h, const uint8_t *buf, int size)
return ret < 0 ? ff_neterrno() : ret;
}
+static int tcp_shutdown(URLContext *h, int flags)
+{
+ TCPContext *s = h->priv_data;
+ int how;
+
+ if (flags & AVIO_FLAG_WRITE && flags & AVIO_FLAG_READ) {
+ how = SHUT_RDWR;
+ } else if (flags & AVIO_FLAG_WRITE) {
+ how = SHUT_WR;
+ } else {
+ how = SHUT_RD;
+ }
+
+ return shutdown(s->fd, how);
+}
+
static int tcp_close(URLContext *h)
{
TCPContext *s = h->priv_data;
@@ -203,6 +250,7 @@ URLProtocol ff_tcp_protocol = {
.url_write = tcp_write,
.url_close = tcp_close,
.url_get_file_handle = tcp_get_file_handle,
+ .url_shutdown = tcp_shutdown,
.priv_data_size = sizeof(TCPContext),
.flags = URL_PROTOCOL_FLAG_NETWORK,
};
diff --git a/gst-libs/ext/libav/libavformat/thp.c b/gst-libs/ext/libav/libavformat/thp.c
index 25efcbb..e8ca04f 100644
--- a/gst-libs/ext/libav/libavformat/thp.c
+++ b/gst-libs/ext/libav/libavformat/thp.c
@@ -54,8 +54,7 @@ static int thp_probe(AVProbeData *p)
return 0;
}
-static int thp_read_header(AVFormatContext *s,
- AVFormatParameters *ap)
+static int thp_read_header(AVFormatContext *s)
{
ThpDemuxContext *thp = s->priv_data;
AVStream *st;
@@ -103,7 +102,7 @@ static int thp_read_header(AVFormatContext *s,
is required. */
avpriv_set_pts_info(st, 64, thp->fps.den, thp->fps.num);
st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
- st->codec->codec_id = CODEC_ID_THP;
+ st->codec->codec_id = AV_CODEC_ID_THP;
st->codec->codec_tag = 0; /* no fourcc */
st->codec->width = avio_rb32(pb);
st->codec->height = avio_rb32(pb);
@@ -123,7 +122,7 @@ static int thp_read_header(AVFormatContext *s,
return AVERROR(ENOMEM);
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
- st->codec->codec_id = CODEC_ID_ADPCM_THP;
+ st->codec->codec_id = AV_CODEC_ID_ADPCM_THP;
st->codec->codec_tag = 0; /* no fourcc */
st->codec->channels = avio_rb32(pb); /* numChannels. */
st->codec->sample_rate = avio_rb32(pb); /* Frequency. */
@@ -182,6 +181,9 @@ static int thp_read_packet(AVFormatContext *s,
}
pkt->stream_index = thp->audio_stream_index;
+ if (thp->audiosize >= 8)
+ pkt->duration = AV_RB32(&pkt->data[4]);
+
thp->audiosize = 0;
thp->frame++;
}
diff --git a/gst-libs/ext/libav/libavformat/tiertexseq.c b/gst-libs/ext/libav/libavformat/tiertexseq.c
index 0590190..45300f9 100644
--- a/gst-libs/ext/libav/libavformat/tiertexseq.c
+++ b/gst-libs/ext/libav/libavformat/tiertexseq.c
@@ -24,6 +24,7 @@
* Tiertex Limited SEQ file demuxer
*/
+#include "libavutil/channel_layout.h"
#include "avformat.h"
#include "internal.h"
@@ -181,7 +182,7 @@ static int seq_parse_frame_data(SeqDemuxContext *seq, AVIOContext *pb)
return 0;
}
-static int seq_read_header(AVFormatContext *s, AVFormatParameters *ap)
+static int seq_read_header(AVFormatContext *s)
{
int i, rc;
SeqDemuxContext *seq = s->priv_data;
@@ -214,7 +215,7 @@ static int seq_read_header(AVFormatContext *s, AVFormatParameters *ap)
avpriv_set_pts_info(st, 32, 1, SEQ_FRAME_RATE);
seq->video_stream_index = st->index;
st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
- st->codec->codec_id = CODEC_ID_TIERTEXSEQVIDEO;
+ st->codec->codec_id = AV_CODEC_ID_TIERTEXSEQVIDEO;
st->codec->codec_tag = 0; /* no fourcc */
st->codec->width = SEQ_FRAME_W;
st->codec->height = SEQ_FRAME_H;
@@ -224,16 +225,18 @@ static int seq_read_header(AVFormatContext *s, AVFormatParameters *ap)
if (!st)
return AVERROR(ENOMEM);
+ st->start_time = 0;
avpriv_set_pts_info(st, 32, 1, SEQ_SAMPLE_RATE);
seq->audio_stream_index = st->index;
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
- st->codec->codec_id = CODEC_ID_PCM_S16BE;
+ st->codec->codec_id = AV_CODEC_ID_PCM_S16BE;
st->codec->codec_tag = 0; /* no tag */
st->codec->channels = 1;
+ st->codec->channel_layout = AV_CH_LAYOUT_MONO;
st->codec->sample_rate = SEQ_SAMPLE_RATE;
st->codec->bits_per_coded_sample = 16;
st->codec->bit_rate = st->codec->sample_rate * st->codec->bits_per_coded_sample * st->codec->channels;
- st->codec->block_align = st->codec->channels * st->codec->bits_per_coded_sample;
+ st->codec->block_align = st->codec->channels * st->codec->bits_per_coded_sample / 8;
return 0;
}
@@ -305,7 +308,7 @@ static int seq_read_close(AVFormatContext *s)
AVInputFormat ff_tiertexseq_demuxer = {
.name = "tiertexseq",
- .long_name = NULL_IF_CONFIG_SMALL("Tiertex Limited SEQ format"),
+ .long_name = NULL_IF_CONFIG_SMALL("Tiertex Limited SEQ"),
.priv_data_size = sizeof(SeqDemuxContext),
.read_probe = seq_probe,
.read_header = seq_read_header,
diff --git a/gst-libs/ext/libav/libavformat/tls.c b/gst-libs/ext/libav/libavformat/tls.c
index fb84fa8..866e55f 100644
--- a/gst-libs/ext/libav/libavformat/tls.c
+++ b/gst-libs/ext/libav/libavformat/tls.c
@@ -209,7 +209,7 @@ static int tls_read(URLContext *h, uint8_t *buf, int size)
if (ret > 0)
return ret;
if (ret == 0)
- return AVERROR(EIO);
+ return AVERROR_EOF;
if ((ret = do_tls_poll(h, ret)) < 0)
return ret;
}
@@ -224,7 +224,7 @@ static int tls_write(URLContext *h, const uint8_t *buf, int size)
if (ret > 0)
return ret;
if (ret == 0)
- return AVERROR(EIO);
+ return AVERROR_EOF;
if ((ret = do_tls_poll(h, ret)) < 0)
return ret;
}
diff --git a/gst-libs/ext/libav/libavformat/tmv.c b/gst-libs/ext/libav/libavformat/tmv.c
index 73b44bb..103ac4a 100644
--- a/gst-libs/ext/libav/libavformat/tmv.c
+++ b/gst-libs/ext/libav/libavformat/tmv.c
@@ -26,6 +26,7 @@
* @see http://www.oldskool.org/pc/8088_Corruption
*/
+#include "libavutil/channel_layout.h"
#include "libavutil/intreadwrite.h"
#include "avformat.h"
#include "internal.h"
@@ -63,7 +64,7 @@ static int tmv_probe(AVProbeData *p)
return 0;
}
-static int tmv_read_header(AVFormatContext *s, AVFormatParameters *ap)
+static int tmv_read_header(AVFormatContext *s)
{
TMVContext *tmv = s->priv_data;
AVIOContext *pb = s->pb;
@@ -111,8 +112,14 @@ static int tmv_read_header(AVFormatContext *s, AVFormatParameters *ap)
}
ast->codec->codec_type = AVMEDIA_TYPE_AUDIO;
- ast->codec->codec_id = CODEC_ID_PCM_U8;
- ast->codec->channels = features & TMV_STEREO ? 2 : 1;
+ ast->codec->codec_id = AV_CODEC_ID_PCM_U8;
+ if (features & TMV_STEREO) {
+ ast->codec->channels = 2;
+ ast->codec->channel_layout = AV_CH_LAYOUT_STEREO;
+ } else {
+ ast->codec->channels = 1;
+ ast->codec->channel_layout = AV_CH_LAYOUT_MONO;
+ }
ast->codec->bits_per_coded_sample = 8;
ast->codec->bit_rate = ast->codec->sample_rate *
ast->codec->bits_per_coded_sample;
@@ -123,8 +130,8 @@ static int tmv_read_header(AVFormatContext *s, AVFormatParameters *ap)
av_reduce(&fps.num, &fps.den, fps.num, fps.den, 0xFFFFFFFFLL);
vst->codec->codec_type = AVMEDIA_TYPE_VIDEO;
- vst->codec->codec_id = CODEC_ID_TMV;
- vst->codec->pix_fmt = PIX_FMT_PAL8;
+ vst->codec->codec_id = AV_CODEC_ID_TMV;
+ vst->codec->pix_fmt = AV_PIX_FMT_PAL8;
vst->codec->width = char_cols * 8;
vst->codec->height = char_rows * 8;
avpriv_set_pts_info(vst, 32, fps.den, fps.num);
@@ -174,7 +181,8 @@ static int tmv_read_seek(AVFormatContext *s, int stream_index,
pos = timestamp *
(tmv->audio_chunk_size + tmv->video_chunk_size + tmv->padding);
- avio_seek(s->pb, pos + TMV_HEADER_SIZE, SEEK_SET);
+ if (avio_seek(s->pb, pos + TMV_HEADER_SIZE, SEEK_SET) < 0)
+ return -1;
tmv->stream_index = 0;
return 0;
}
@@ -187,5 +195,5 @@ AVInputFormat ff_tmv_demuxer = {
.read_header = tmv_read_header,
.read_packet = tmv_read_packet,
.read_seek = tmv_read_seek,
- .flags = AVFMT_GENERIC_INDEX,
+ .flags = AVFMT_GENERIC_INDEX,
};
diff --git a/gst-libs/ext/libav/libavformat/tta.c b/gst-libs/ext/libav/libavformat/tta.c
index 6bf0979..9d3d295 100644
--- a/gst-libs/ext/libav/libavformat/tta.c
+++ b/gst-libs/ext/libav/libavformat/tta.c
@@ -27,6 +27,8 @@
typedef struct {
int totalframes, currentframe;
+ int frame_size;
+ int last_frame_size;
} TTAContext;
static int tta_probe(AVProbeData *p)
@@ -38,11 +40,11 @@ static int tta_probe(AVProbeData *p)
return 0;
}
-static int tta_read_header(AVFormatContext *s, AVFormatParameters *ap)
+static int tta_read_header(AVFormatContext *s)
{
TTAContext *c = s->priv_data;
AVStream *st;
- int i, channels, bps, samplerate, datalen, framelen;
+ int i, channels, bps, samplerate, datalen;
uint64_t framepos, start_offset;
if (!av_dict_get(s->metadata, "", NULL, AV_DICT_IGNORE_SUFFIX))
@@ -69,8 +71,11 @@ static int tta_read_header(AVFormatContext *s, AVFormatParameters *ap)
avio_skip(s->pb, 4); // header crc
- framelen = samplerate*256/245;
- c->totalframes = datalen / framelen + ((datalen % framelen) ? 1 : 0);
+ c->frame_size = samplerate * 256 / 245;
+ c->last_frame_size = datalen % c->frame_size;
+ if (!c->last_frame_size)
+ c->last_frame_size = c->frame_size;
+ c->totalframes = datalen / c->frame_size + (c->last_frame_size < c->frame_size);
c->currentframe = 0;
if(c->totalframes >= UINT_MAX/sizeof(uint32_t)){
@@ -90,13 +95,14 @@ static int tta_read_header(AVFormatContext *s, AVFormatParameters *ap)
for (i = 0; i < c->totalframes; i++) {
uint32_t size = avio_rl32(s->pb);
- av_add_index_entry(st, framepos, i*framelen, size, 0, AVINDEX_KEYFRAME);
+ av_add_index_entry(st, framepos, i * c->frame_size, size, 0,
+ AVINDEX_KEYFRAME);
framepos += size;
}
avio_skip(s->pb, 4); // seektable crc
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
- st->codec->codec_id = CODEC_ID_TTA;
+ st->codec->codec_id = AV_CODEC_ID_TTA;
st->codec->channels = channels;
st->codec->sample_rate = samplerate;
st->codec->bits_per_coded_sample = bps;
@@ -132,6 +138,8 @@ static int tta_read_packet(AVFormatContext *s, AVPacket *pkt)
ret = av_get_packet(s->pb, pkt, size);
pkt->dts = st->index_entries[c->currentframe++].timestamp;
+ pkt->duration = c->currentframe == c->totalframes ? c->last_frame_size :
+ c->frame_size;
return ret;
}
@@ -142,20 +150,21 @@ static int tta_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp
int index = av_index_search_timestamp(st, timestamp, flags);
if (index < 0)
return -1;
+ if (avio_seek(s->pb, st->index_entries[index].pos, SEEK_SET) < 0)
+ return -1;
c->currentframe = index;
- avio_seek(s->pb, st->index_entries[index].pos, SEEK_SET);
return 0;
}
AVInputFormat ff_tta_demuxer = {
.name = "tta",
- .long_name = NULL_IF_CONFIG_SMALL("True Audio"),
+ .long_name = NULL_IF_CONFIG_SMALL("TTA (True Audio)"),
.priv_data_size = sizeof(TTAContext),
.read_probe = tta_probe,
.read_header = tta_read_header,
.read_packet = tta_read_packet,
.read_seek = tta_read_seek,
- .extensions = "tta",
+ .extensions = "tta",
};
diff --git a/gst-libs/ext/libav/libavformat/tty.c b/gst-libs/ext/libav/libavformat/tty.c
index 8041900..f85f230 100644
--- a/gst-libs/ext/libav/libavformat/tty.c
+++ b/gst-libs/ext/libav/libavformat/tty.c
@@ -72,8 +72,7 @@ static int efi_read(AVFormatContext *avctx, uint64_t start_pos)
return 0;
}
-static int read_header(AVFormatContext *avctx,
- AVFormatParameters *ap)
+static int read_header(AVFormatContext *avctx)
{
TtyDemuxContext *s = avctx->priv_data;
int width = 0, height = 0, ret = 0;
@@ -86,7 +85,7 @@ static int read_header(AVFormatContext *avctx,
}
st->codec->codec_tag = 0;
st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
- st->codec->codec_id = CODEC_ID_ANSI;
+ st->codec->codec_id = AV_CODEC_ID_ANSI;
if (s->video_size && (ret = av_parse_video_size(&width, &height, s->video_size)) < 0) {
av_log (avctx, AV_LOG_ERROR, "Couldn't parse video size.\n");
@@ -143,7 +142,7 @@ 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), AV_OPT_TYPE_INT, {.dbl = 6000}, 1, INT_MAX, AV_OPT_FLAG_DECODING_PARAM},
+ { "chars_per_frame", "", offsetof(TtyDemuxContext, chars_per_frame), AV_OPT_TYPE_INT, {.i64 = 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/gst-libs/ext/libav/libavformat/txd.c b/gst-libs/ext/libav/libavformat/txd.c
index a601ea0..5897881 100644
--- a/gst-libs/ext/libav/libavformat/txd.c
+++ b/gst-libs/ext/libav/libavformat/txd.c
@@ -37,14 +37,14 @@ static int txd_probe(AVProbeData * pd) {
return 0;
}
-static int txd_read_header(AVFormatContext *s, AVFormatParameters *ap) {
+static int txd_read_header(AVFormatContext *s) {
AVStream *st;
st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
- st->codec->codec_id = CODEC_ID_TXD;
+ st->codec->codec_id = AV_CODEC_ID_TXD;
st->codec->time_base.den = 5;
st->codec->time_base.num = 1;
/* the parameters will be extracted from the compressed bitstream */
diff --git a/gst-libs/ext/libav/libavformat/udp.c b/gst-libs/ext/libav/libavformat/udp.c
index 8bb63c6..373a4c9 100644
--- a/gst-libs/ext/libav/libavformat/udp.c
+++ b/gst-libs/ext/libav/libavformat/udp.c
@@ -30,12 +30,10 @@
#include "avio_internal.h"
#include "libavutil/parseutils.h"
#include "libavutil/avstring.h"
-#include <unistd.h>
#include "internal.h"
#include "network.h"
#include "os_support.h"
#include "url.h"
-#include <sys/time.h>
#ifndef IPV6_ADD_MEMBERSHIP
#define IPV6_ADD_MEMBERSHIP IPV6_JOIN_GROUP
@@ -57,13 +55,20 @@ typedef struct {
#define UDP_TX_BUF_SIZE 32768
#define UDP_MAX_PKT_SIZE 65536
+static void log_net_error(void *ctx, int level, const char* prefix)
+{
+ char errbuf[100];
+ av_strerror(ff_neterrno(), errbuf, sizeof(errbuf));
+ av_log(ctx, level, "%s: %s\n", prefix, errbuf);
+}
+
static int udp_set_multicast_ttl(int sockfd, int mcastTTL,
struct sockaddr *addr)
{
#ifdef IP_MULTICAST_TTL
if (addr->sa_family == AF_INET) {
if (setsockopt(sockfd, IPPROTO_IP, IP_MULTICAST_TTL, &mcastTTL, sizeof(mcastTTL)) < 0) {
- av_log(NULL, AV_LOG_ERROR, "setsockopt(IP_MULTICAST_TTL): %s\n", strerror(errno));
+ log_net_error(NULL, AV_LOG_ERROR, "setsockopt(IP_MULTICAST_TTL)");
return -1;
}
}
@@ -71,7 +76,7 @@ static int udp_set_multicast_ttl(int sockfd, int mcastTTL,
#if defined(IPPROTO_IPV6) && defined(IPV6_MULTICAST_HOPS)
if (addr->sa_family == AF_INET6) {
if (setsockopt(sockfd, IPPROTO_IPV6, IPV6_MULTICAST_HOPS, &mcastTTL, sizeof(mcastTTL)) < 0) {
- av_log(NULL, AV_LOG_ERROR, "setsockopt(IPV6_MULTICAST_HOPS): %s\n", strerror(errno));
+ log_net_error(NULL, AV_LOG_ERROR, "setsockopt(IPV6_MULTICAST_HOPS)");
return -1;
}
}
@@ -88,7 +93,7 @@ static int udp_join_multicast_group(int sockfd, struct sockaddr *addr)
mreq.imr_multiaddr.s_addr = ((struct sockaddr_in *)addr)->sin_addr.s_addr;
mreq.imr_interface.s_addr= INADDR_ANY;
if (setsockopt(sockfd, IPPROTO_IP, IP_ADD_MEMBERSHIP, (const void *)&mreq, sizeof(mreq)) < 0) {
- av_log(NULL, AV_LOG_ERROR, "setsockopt(IP_ADD_MEMBERSHIP): %s\n", strerror(errno));
+ log_net_error(NULL, AV_LOG_ERROR, "setsockopt(IP_ADD_MEMBERSHIP)");
return -1;
}
}
@@ -100,7 +105,7 @@ static int udp_join_multicast_group(int sockfd, struct sockaddr *addr)
memcpy(&mreq6.ipv6mr_multiaddr, &(((struct sockaddr_in6 *)addr)->sin6_addr), sizeof(struct in6_addr));
mreq6.ipv6mr_interface= 0;
if (setsockopt(sockfd, IPPROTO_IPV6, IPV6_ADD_MEMBERSHIP, &mreq6, sizeof(mreq6)) < 0) {
- av_log(NULL, AV_LOG_ERROR, "setsockopt(IPV6_ADD_MEMBERSHIP): %s\n", strerror(errno));
+ log_net_error(NULL, AV_LOG_ERROR, "setsockopt(IPV6_ADD_MEMBERSHIP)");
return -1;
}
}
@@ -117,7 +122,7 @@ static int udp_leave_multicast_group(int sockfd, struct sockaddr *addr)
mreq.imr_multiaddr.s_addr = ((struct sockaddr_in *)addr)->sin_addr.s_addr;
mreq.imr_interface.s_addr= INADDR_ANY;
if (setsockopt(sockfd, IPPROTO_IP, IP_DROP_MEMBERSHIP, (const void *)&mreq, sizeof(mreq)) < 0) {
- av_log(NULL, AV_LOG_ERROR, "setsockopt(IP_DROP_MEMBERSHIP): %s\n", strerror(errno));
+ log_net_error(NULL, AV_LOG_ERROR, "setsockopt(IP_DROP_MEMBERSHIP)");
return -1;
}
}
@@ -129,7 +134,7 @@ static int udp_leave_multicast_group(int sockfd, struct sockaddr *addr)
memcpy(&mreq6.ipv6mr_multiaddr, &(((struct sockaddr_in6 *)addr)->sin6_addr), sizeof(struct in6_addr));
mreq6.ipv6mr_interface= 0;
if (setsockopt(sockfd, IPPROTO_IPV6, IPV6_DROP_MEMBERSHIP, &mreq6, sizeof(mreq6)) < 0) {
- av_log(NULL, AV_LOG_ERROR, "setsockopt(IPV6_DROP_MEMBERSHIP): %s\n", strerror(errno));
+ log_net_error(NULL, AV_LOG_ERROR, "setsockopt(IPV6_DROP_MEMBERSHIP)");
return -1;
}
}
@@ -140,7 +145,7 @@ static int udp_leave_multicast_group(int sockfd, struct sockaddr *addr)
static struct addrinfo* udp_resolve_host(const char *hostname, int port,
int type, int family, int flags)
{
- struct addrinfo hints, *res = 0;
+ struct addrinfo hints = { 0 }, *res = 0;
int error;
char sport[16];
const char *node = 0, *service = "0";
@@ -152,7 +157,6 @@ static struct addrinfo* udp_resolve_host(const char *hostname, int port,
if ((hostname) && (hostname[0] != '\0') && (hostname[0] != '?')) {
node = hostname;
}
- memset(&hints, 0, sizeof(hints));
hints.ai_socktype = type;
hints.ai_family = family;
hints.ai_flags = flags;
@@ -164,6 +168,79 @@ static struct addrinfo* udp_resolve_host(const char *hostname, int port,
return res;
}
+static int udp_set_multicast_sources(int sockfd, struct sockaddr *addr,
+ int addr_len, char **sources,
+ int nb_sources, int include)
+{
+#if HAVE_STRUCT_GROUP_SOURCE_REQ && defined(MCAST_BLOCK_SOURCE) && !defined(_WIN32)
+ /* These ones are available in the microsoft SDK, but don't seem to work
+ * as on linux, so just prefer the v4-only approach there for now. */
+ int i;
+ for (i = 0; i < nb_sources; i++) {
+ struct group_source_req mreqs;
+ int level = addr->sa_family == AF_INET ? IPPROTO_IP : IPPROTO_IPV6;
+ struct addrinfo *sourceaddr = udp_resolve_host(sources[i], 0,
+ SOCK_DGRAM, AF_UNSPEC,
+ AI_NUMERICHOST);
+ if (!sourceaddr)
+ return AVERROR(ENOENT);
+
+ mreqs.gsr_interface = 0;
+ memcpy(&mreqs.gsr_group, addr, addr_len);
+ memcpy(&mreqs.gsr_source, sourceaddr->ai_addr, sourceaddr->ai_addrlen);
+ freeaddrinfo(sourceaddr);
+
+ if (setsockopt(sockfd, level,
+ include ? MCAST_JOIN_SOURCE_GROUP : MCAST_BLOCK_SOURCE,
+ (const void *)&mreqs, sizeof(mreqs)) < 0) {
+ if (include)
+ log_net_error(NULL, AV_LOG_ERROR, "setsockopt(MCAST_JOIN_SOURCE_GROUP)");
+ else
+ log_net_error(NULL, AV_LOG_ERROR, "setsockopt(MCAST_BLOCK_SOURCE)");
+ return ff_neterrno();
+ }
+ }
+#elif HAVE_STRUCT_IP_MREQ_SOURCE && defined(IP_BLOCK_SOURCE)
+ int i;
+ if (addr->sa_family != AF_INET) {
+ av_log(NULL, AV_LOG_ERROR,
+ "Setting multicast sources only supported for IPv4\n");
+ return AVERROR(EINVAL);
+ }
+ for (i = 0; i < nb_sources; i++) {
+ struct ip_mreq_source mreqs;
+ struct addrinfo *sourceaddr = udp_resolve_host(sources[i], 0,
+ SOCK_DGRAM, AF_UNSPEC,
+ AI_NUMERICHOST);
+ if (!sourceaddr)
+ return AVERROR(ENOENT);
+ if (sourceaddr->ai_addr->sa_family != AF_INET) {
+ freeaddrinfo(sourceaddr);
+ av_log(NULL, AV_LOG_ERROR, "%s is of incorrect protocol family\n",
+ sources[i]);
+ return AVERROR(EINVAL);
+ }
+
+ mreqs.imr_multiaddr.s_addr = ((struct sockaddr_in *)addr)->sin_addr.s_addr;
+ mreqs.imr_interface.s_addr = INADDR_ANY;
+ mreqs.imr_sourceaddr.s_addr = ((struct sockaddr_in *)sourceaddr->ai_addr)->sin_addr.s_addr;
+ freeaddrinfo(sourceaddr);
+
+ if (setsockopt(sockfd, IPPROTO_IP,
+ include ? IP_ADD_SOURCE_MEMBERSHIP : IP_BLOCK_SOURCE,
+ (const void *)&mreqs, sizeof(mreqs)) < 0) {
+ if (include)
+ log_net_error(NULL, AV_LOG_ERROR, "setsockopt(IP_ADD_SOURCE_MEMBERSHIP)");
+ else
+ log_net_error(NULL, AV_LOG_ERROR, "setsockopt(IP_BLOCK_SOURCE)");
+ return ff_neterrno();
+ }
+ }
+#else
+ return AVERROR(ENOSYS);
+#endif
+ return 0;
+}
static int udp_set_url(struct sockaddr_storage *addr,
const char *hostname, int port)
{
@@ -180,7 +257,7 @@ static int udp_set_url(struct sockaddr_storage *addr,
}
static int udp_socket_create(UDPContext *s, struct sockaddr_storage *addr,
- int *addr_len, const char *localaddr)
+ socklen_t *addr_len, const char *localaddr)
{
int udp_fd = -1;
struct addrinfo *res0 = NULL, *res = NULL;
@@ -194,8 +271,8 @@ static int udp_socket_create(UDPContext *s, struct sockaddr_storage *addr,
goto fail;
for (res = res0; res; res=res->ai_next) {
udp_fd = socket(res->ai_family, SOCK_DGRAM, 0);
- if (udp_fd > 0) break;
- av_log(NULL, AV_LOG_ERROR, "socket: %s\n", strerror(errno));
+ if (udp_fd != -1) break;
+ log_net_error(NULL, AV_LOG_ERROR, "socket");
}
if (udp_fd < 0)
@@ -219,9 +296,10 @@ static int udp_socket_create(UDPContext *s, struct sockaddr_storage *addr,
static int udp_port(struct sockaddr_storage *addr, int addr_len)
{
char sbuf[sizeof(int)*3+1];
+ int error;
- if (getnameinfo((struct sockaddr *)addr, addr_len, NULL, 0, sbuf, sizeof(sbuf), NI_NUMERICSERV) != 0) {
- av_log(NULL, AV_LOG_ERROR, "getnameinfo: %s\n", strerror(errno));
+ if ((error = getnameinfo((struct sockaddr *)addr, addr_len, NULL, 0, sbuf, sizeof(sbuf), NI_NUMERICSERV)) != 0) {
+ av_log(NULL, AV_LOG_ERROR, "getnameinfo: %s\n", gai_strerror(error));
return -1;
}
@@ -268,7 +346,7 @@ int ff_udp_set_remote_url(URLContext *h, const char *uri)
if (connect(s->udp_fd, (struct sockaddr *) &s->dest_addr,
s->dest_addr_len)) {
s->is_connected = 0;
- av_log(h, AV_LOG_ERROR, "connect: %s\n", strerror(errno));
+ log_net_error(h, AV_LOG_ERROR, "connect");
return AVERROR(EIO);
}
}
@@ -311,8 +389,10 @@ static int udp_open(URLContext *h, const char *uri, int flags)
const char *p;
char buf[256];
struct sockaddr_storage my_addr;
- int len;
+ socklen_t len;
int reuse_specified = 0;
+ int i, include = 0, num_sources = 0;
+ char *sources[32];
h->is_streamed = 1;
h->max_packet_size = 1472;
@@ -350,6 +430,25 @@ static int udp_open(URLContext *h, const char *uri, int flags)
if (av_find_info_tag(buf, sizeof(buf), "localaddr", p)) {
av_strlcpy(localaddr, buf, sizeof(localaddr));
}
+ if (av_find_info_tag(buf, sizeof(buf), "sources", p))
+ include = 1;
+ if (include || av_find_info_tag(buf, sizeof(buf), "block", p)) {
+ char *source_start;
+
+ source_start = buf;
+ while (1) {
+ char *next = strchr(source_start, ',');
+ if (next)
+ *next = '\0';
+ sources[num_sources] = av_strdup(source_start);
+ if (!sources[num_sources])
+ goto fail;
+ source_start = next + 1;
+ num_sources++;
+ if (num_sources >= FF_ARRAY_ELEMS(sources) || !next)
+ break;
+ }
+ }
}
/* fill the dest addr */
@@ -380,29 +479,48 @@ static int udp_open(URLContext *h, const char *uri, int flags)
goto fail;
}
- /* the bind is needed to give a port to the socket now */
- /* if multicast, try the multicast address bind first */
- if (s->is_multicast && (h->flags & AVIO_FLAG_READ)) {
+ /* If multicast, try binding the multicast address first, to avoid
+ * receiving UDP packets from other sources aimed at the same UDP
+ * port. This fails on windows. This makes sending to the same address
+ * using sendto() fail, so only do it if we're opened in read-only mode. */
+ if (s->is_multicast && !(h->flags & AVIO_FLAG_WRITE)) {
bind_ret = bind(udp_fd,(struct sockaddr *)&s->dest_addr, len);
}
/* bind to the local address if not multicast or if the multicast
* bind failed */
- if (bind_ret < 0 && bind(udp_fd,(struct sockaddr *)&my_addr, len) < 0)
+ /* the bind is needed to give a port to the socket now */
+ if (bind_ret < 0 && bind(udp_fd,(struct sockaddr *)&my_addr, len) < 0) {
+ log_net_error(h, AV_LOG_ERROR, "bind failed");
goto fail;
+ }
len = sizeof(my_addr);
getsockname(udp_fd, (struct sockaddr *)&my_addr, &len);
s->local_port = udp_port(&my_addr, len);
if (s->is_multicast) {
- if (!(h->flags & AVIO_FLAG_READ)) {
+ if (h->flags & AVIO_FLAG_WRITE) {
/* output */
if (udp_set_multicast_ttl(udp_fd, s->ttl, (struct sockaddr *)&s->dest_addr) < 0)
goto fail;
- } else {
+ }
+ if (h->flags & AVIO_FLAG_READ) {
/* input */
- if (udp_join_multicast_group(udp_fd, (struct sockaddr *)&s->dest_addr) < 0)
+ if (num_sources == 0 || !include) {
+ if (udp_join_multicast_group(udp_fd, (struct sockaddr *)&s->dest_addr) < 0)
+ goto fail;
+
+ if (num_sources) {
+ if (udp_set_multicast_sources(udp_fd, (struct sockaddr *)&s->dest_addr, s->dest_addr_len, sources, num_sources, 0) < 0)
+ goto fail;
+ }
+ } else if (include && num_sources) {
+ if (udp_set_multicast_sources(udp_fd, (struct sockaddr *)&s->dest_addr, s->dest_addr_len, sources, num_sources, 1) < 0)
+ goto fail;
+ } else {
+ av_log(NULL, AV_LOG_ERROR, "invalid udp settings: inclusive multicast but no sources given\n");
goto fail;
+ }
}
}
@@ -410,7 +528,7 @@ static int udp_open(URLContext *h, const char *uri, int flags)
/* limit the tx buf size to limit latency */
tmp = s->buffer_size;
if (setsockopt(udp_fd, SOL_SOCKET, SO_SNDBUF, &tmp, sizeof(tmp)) < 0) {
- av_log(h, AV_LOG_ERROR, "setsockopt(SO_SNDBUF): %s\n", strerror(errno));
+ log_net_error(h, AV_LOG_ERROR, "setsockopt(SO_SNDBUF)");
goto fail;
}
} else {
@@ -418,23 +536,28 @@ static int udp_open(URLContext *h, const char *uri, int flags)
* avoid losing data on OSes that set this too low by default. */
tmp = s->buffer_size;
if (setsockopt(udp_fd, SOL_SOCKET, SO_RCVBUF, &tmp, sizeof(tmp)) < 0) {
- av_log(h, AV_LOG_WARNING, "setsockopt(SO_RECVBUF): %s\n", strerror(errno));
+ log_net_error(h, AV_LOG_WARNING, "setsockopt(SO_RECVBUF)");
}
/* make the socket non-blocking */
ff_socket_nonblock(udp_fd, 1);
}
if (s->is_connected) {
if (connect(udp_fd, (struct sockaddr *) &s->dest_addr, s->dest_addr_len)) {
- av_log(h, AV_LOG_ERROR, "connect: %s\n", strerror(errno));
+ log_net_error(h, AV_LOG_ERROR, "connect");
goto fail;
}
}
+ for (i = 0; i < num_sources; i++)
+ av_free(sources[i]);
+
s->udp_fd = udp_fd;
return 0;
fail:
if (udp_fd >= 0)
closesocket(udp_fd);
+ for (i = 0; i < num_sources; i++)
+ av_free(sources[i]);
return AVERROR(EIO);
}
diff --git a/gst-libs/ext/libav/libavformat/url-test.c b/gst-libs/ext/libav/libavformat/url-test.c
new file mode 100644
index 0000000..6639ccf
--- /dev/null
+++ b/gst-libs/ext/libav/libavformat/url-test.c
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2012 Martin Storsjo
+ *
+ * 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
+ */
+
+#include "internal.h"
+
+static void test(const char *base, const char *rel)
+{
+ char buf[200], buf2[200];
+ ff_make_absolute_url(buf, sizeof(buf), base, rel);
+ printf("%s\n", buf);
+ if (base) {
+ /* Test in-buffer replacement */
+ snprintf(buf2, sizeof(buf2), "%s", base);
+ ff_make_absolute_url(buf2, sizeof(buf2), buf2, rel);
+ if (strcmp(buf, buf2)) {
+ printf("In-place handling of %s + %s failed\n", base, rel);
+ exit(1);
+ }
+ }
+}
+
+int main(void)
+{
+ test(NULL, "baz");
+ test("/foo/bar", "baz");
+ test("/foo/bar", "../baz");
+ test("/foo/bar", "/baz");
+ test("http://server/foo/", "baz");
+ test("http://server/foo/bar", "baz");
+ test("http://server/foo/", "../baz");
+ test("http://server/foo/bar/123", "../../baz");
+ test("http://server/foo/bar/123", "/baz");
+ test("http://server/foo/bar/123", "https://other/url");
+ test("http://server/foo/bar?param=value/with/slashes", "/baz");
+ test("http://server/foo/bar?param&otherparam", "?someparam");
+ test("http://server/foo/bar", "//other/url");
+ return 0;
+}
diff --git a/gst-libs/ext/libav/libavformat/url.h b/gst-libs/ext/libav/libavformat/url.h
index 14832af..195a8ff 100644
--- a/gst-libs/ext/libav/libavformat/url.h
+++ b/gst-libs/ext/libav/libavformat/url.h
@@ -31,7 +31,6 @@
#include "libavutil/dict.h"
#include "libavutil/log.h"
-#if !FF_API_OLD_AVIO
#define URL_PROTOCOL_FLAG_NESTED_SCHEME 1 /*< The protocol name can be the first part of a nested protocol scheme */
#define URL_PROTOCOL_FLAG_NETWORK 2 /*< The protocol uses network */
@@ -60,6 +59,19 @@ typedef struct URLProtocol {
* for those nested protocols.
*/
int (*url_open2)(URLContext *h, const char *url, int flags, AVDictionary **options);
+
+ /**
+ * Read data from the protocol.
+ * If data is immediately available (even less than size), EOF is
+ * reached or an error occurs (including EINTR), return immediately.
+ * Otherwise:
+ * In non-blocking mode, return AVERROR(EAGAIN) immediately.
+ * In blocking mode, wait for data/EOF/error with a short timeout (0.1s),
+ * and return AVERROR(EAGAIN) on timeout.
+ * Checking interrupt_callback, looping on EINTR and EAGAIN and until
+ * enough data has been read is left to the calling function; see
+ * retry_transfer_wrapper in avio.c.
+ */
int (*url_read)( URLContext *h, unsigned char *buf, int size);
int (*url_write)(URLContext *h, const unsigned char *buf, int size);
int64_t (*url_seek)( URLContext *h, int64_t pos, int whence);
@@ -69,12 +81,14 @@ typedef struct URLProtocol {
int64_t (*url_read_seek)(URLContext *h, int stream_index,
int64_t timestamp, int flags);
int (*url_get_file_handle)(URLContext *h);
+ int (*url_get_multi_file_handle)(URLContext *h, int **handles,
+ int *numhandles);
+ int (*url_shutdown)(URLContext *h, int flags);
int priv_data_size;
const AVClass *priv_data_class;
int flags;
int (*url_check)(URLContext *h, int mask);
} URLProtocol;
-#endif
/**
* Create a URLContext for accessing to the resource indicated by
@@ -190,6 +204,25 @@ int64_t ffurl_size(URLContext *h);
int ffurl_get_file_handle(URLContext *h);
/**
+ * Return the file descriptors associated with this URL.
+ *
+ * @return 0 on success or <0 on error.
+ */
+int ffurl_get_multi_file_handle(URLContext *h, int **handles, int *numhandles);
+
+/**
+ * Signal the URLContext that we are done reading or writing the stream.
+ *
+ * @param h pointer to the resource
+ * @param flags flags which control how the resource indicated by url
+ * is to be shutdown
+ *
+ * @return a negative value if an error condition occurred, 0
+ * otherwise
+ */
+int ffurl_shutdown(URLContext *h, int flags);
+
+/**
* Register the URLProtocol protocol.
*
* @param size the size of the URLProtocol struct referenced
diff --git a/gst-libs/ext/libav/libavformat/urldecode.c b/gst-libs/ext/libav/libavformat/urldecode.c
new file mode 100644
index 0000000..32460da
--- /dev/null
+++ b/gst-libs/ext/libav/libavformat/urldecode.c
@@ -0,0 +1,87 @@
+/*
+ * Simple URL decoding function
+ * Copyright (c) 2012 Antti Seppälä
+ *
+ * References:
+ * RFC 3986: Uniform Resource Identifier (URI): Generic Syntax
+ * T. Berners-Lee et al. The Internet Society, 2005
+ *
+ * based on http://www.icosaedro.it/apache/urldecode.c
+ * from Umberto Salsi (salsi@icosaedro.it)
+ *
+ * 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
+ */
+
+#include <ctype.h>
+#include <string.h>
+
+#include "libavutil/mem.h"
+#include "libavutil/avstring.h"
+#include "urldecode.h"
+
+char *ff_urldecode(const char *url)
+{
+ int s = 0, d = 0, url_len = 0;
+ char c;
+ char *dest = NULL;
+
+ if (!url)
+ return NULL;
+
+ url_len = strlen(url) + 1;
+ dest = av_malloc(url_len);
+
+ if (!dest)
+ return NULL;
+
+ while (s < url_len) {
+ c = url[s++];
+
+ if (c == '%' && s + 2 < url_len) {
+ char c2 = url[s++];
+ char c3 = url[s++];
+ if (isxdigit(c2) && isxdigit(c3)) {
+ c2 = av_tolower(c2);
+ c3 = av_tolower(c3);
+
+ if (c2 <= '9')
+ c2 = c2 - '0';
+ else
+ c2 = c2 - 'a' + 10;
+
+ if (c3 <= '9')
+ c3 = c3 - '0';
+ else
+ c3 = c3 - 'a' + 10;
+
+ dest[d++] = 16 * c2 + c3;
+
+ } else { /* %zz or something other invalid */
+ dest[d++] = c;
+ dest[d++] = c2;
+ dest[d++] = c3;
+ }
+ } else if (c == '+') {
+ dest[d++] = ' ';
+ } else {
+ dest[d++] = c;
+ }
+
+ }
+
+ return dest;
+}
diff --git a/gst-libs/ext/libav/libavformat/urldecode.h b/gst-libs/ext/libav/libavformat/urldecode.h
new file mode 100644
index 0000000..b43f319
--- /dev/null
+++ b/gst-libs/ext/libav/libavformat/urldecode.h
@@ -0,0 +1,35 @@
+/*
+ * 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
+ */
+
+#ifndef AVFORMAT_URLDECODE_H
+#define AVFORMAT_URLDECODE_H
+
+/**
+ * Decodes an URL from its percent-encoded form back into normal
+ * representation. This function returns the decoded URL in a string.
+ * The URL to be decoded does not necessarily have to be encoded but
+ * in that case the original string is duplicated.
+ *
+ * @param url a string to be decoded.
+ * @return new string with the URL decoded or NULL if decoding failed.
+ * Note that the returned string should be explicitly freed when not
+ * used anymore.
+ */
+char *ff_urldecode(const char *url);
+
+#endif /* AVFORMAT_URLDECODE_H */
diff --git a/gst-libs/ext/libav/libavformat/utils.c b/gst-libs/ext/libav/libavformat/utils.c
index 98c3af4..085ae83 100644
--- a/gst-libs/ext/libav/libavformat/utils.c
+++ b/gst-libs/ext/libav/libavformat/utils.c
@@ -35,11 +35,10 @@
#include "libavutil/avstring.h"
#include "libavutil/mathematics.h"
#include "libavutil/parseutils.h"
+#include "libavutil/time.h"
#include "riff.h"
#include "audiointerleave.h"
#include "url.h"
-#include <sys/time.h>
-#include <time.h>
#include <stdarg.h>
#if CONFIG_NETWORK
#include "network.h"
@@ -69,56 +68,6 @@ const char *avformat_license(void)
return LICENSE_PREFIX LIBAV_LICENSE + sizeof(LICENSE_PREFIX) - 1;
}
-/* fraction handling */
-
-/**
- * f = val + (num / den) + 0.5.
- *
- * 'num' is normalized so that it is such as 0 <= num < den.
- *
- * @param f fractional number
- * @param val integer value
- * @param num must be >= 0
- * @param den must be >= 1
- */
-static void frac_init(AVFrac *f, int64_t val, int64_t num, int64_t den)
-{
- num += (den >> 1);
- if (num >= den) {
- val += num / den;
- num = num % den;
- }
- f->val = val;
- f->num = num;
- f->den = den;
-}
-
-/**
- * Fractional addition to f: f = f + (incr / f->den).
- *
- * @param f fractional number
- * @param incr increment, can be positive or negative
- */
-static void frac_add(AVFrac *f, int64_t incr)
-{
- int64_t num, den;
-
- num = f->num + incr;
- den = f->den;
- if (num < 0) {
- f->val += num / den;
- num = num % den;
- if (num < 0) {
- num += den;
- f->val--;
- }
- } else if (num >= den) {
- f->val += num / den;
- num = num % den;
- }
- f->num = num;
-}
-
/** head of registered input format linked list */
static AVInputFormat *first_iformat = NULL;
/** head of registered output format linked list */
@@ -209,7 +158,7 @@ AVOutputFormat *av_guess_format(const char *short_name, const char *filename,
#if CONFIG_IMAGE2_MUXER
if (!short_name && filename &&
av_filename_number_test(filename) &&
- ff_guess_image2_codec(filename) != CODEC_ID_NONE) {
+ ff_guess_image2_codec(filename) != AV_CODEC_ID_NONE) {
return av_guess_format("image2", NULL, NULL);
}
#endif
@@ -218,7 +167,7 @@ AVOutputFormat *av_guess_format(const char *short_name, const char *filename,
score_max = 0;
while ((fmt = av_oformat_next(fmt))) {
score = 0;
- if (fmt->name && short_name && !strcmp(fmt->name, short_name))
+ if (fmt->name && short_name && !av_strcasecmp(fmt->name, short_name))
score += 100;
if (fmt->mime_type && mime_type && !strcmp(fmt->mime_type, mime_type))
score += 10;
@@ -234,17 +183,17 @@ AVOutputFormat *av_guess_format(const char *short_name, const char *filename,
return fmt_found;
}
-enum CodecID av_guess_codec(AVOutputFormat *fmt, const char *short_name,
+enum AVCodecID av_guess_codec(AVOutputFormat *fmt, const char *short_name,
const char *filename, const char *mime_type, enum AVMediaType type){
if(type == AVMEDIA_TYPE_VIDEO){
- enum CodecID codec_id= CODEC_ID_NONE;
+ enum AVCodecID codec_id= AV_CODEC_ID_NONE;
#if CONFIG_IMAGE2_MUXER
if(!strcmp(fmt->name, "image2") || !strcmp(fmt->name, "image2pipe")){
codec_id= ff_guess_image2_codec(filename);
}
#endif
- if(codec_id == CODEC_ID_NONE)
+ if(codec_id == AV_CODEC_ID_NONE)
codec_id= fmt->video_codec;
return codec_id;
}else if(type == AVMEDIA_TYPE_AUDIO)
@@ -252,7 +201,7 @@ enum CodecID av_guess_codec(AVOutputFormat *fmt, const char *short_name,
else if (type == AVMEDIA_TYPE_SUBTITLE)
return fmt->subtitle_codec;
else
- return CODEC_ID_NONE;
+ return AV_CODEC_ID_NONE;
}
AVInputFormat *av_find_input_format(const char *short_name)
@@ -368,16 +317,16 @@ AVInputFormat *av_probe_input_format(AVProbeData *pd, int is_opened){
static int set_codec_from_probe_data(AVFormatContext *s, AVStream *st, AVProbeData *pd, int score)
{
static const struct {
- const char *name; enum CodecID id; enum AVMediaType type;
+ const char *name; enum AVCodecID id; enum AVMediaType type;
} fmt_id_type[] = {
- { "aac" , CODEC_ID_AAC , AVMEDIA_TYPE_AUDIO },
- { "ac3" , CODEC_ID_AC3 , AVMEDIA_TYPE_AUDIO },
- { "dts" , CODEC_ID_DTS , AVMEDIA_TYPE_AUDIO },
- { "eac3" , CODEC_ID_EAC3 , AVMEDIA_TYPE_AUDIO },
- { "h264" , CODEC_ID_H264 , AVMEDIA_TYPE_VIDEO },
- { "m4v" , CODEC_ID_MPEG4 , AVMEDIA_TYPE_VIDEO },
- { "mp3" , CODEC_ID_MP3 , AVMEDIA_TYPE_AUDIO },
- { "mpegvideo", CODEC_ID_MPEG2VIDEO, AVMEDIA_TYPE_VIDEO },
+ { "aac" , AV_CODEC_ID_AAC , AVMEDIA_TYPE_AUDIO },
+ { "ac3" , AV_CODEC_ID_AC3 , AVMEDIA_TYPE_AUDIO },
+ { "dts" , AV_CODEC_ID_DTS , AVMEDIA_TYPE_AUDIO },
+ { "eac3" , AV_CODEC_ID_EAC3 , AVMEDIA_TYPE_AUDIO },
+ { "h264" , AV_CODEC_ID_H264 , AVMEDIA_TYPE_VIDEO },
+ { "m4v" , AV_CODEC_ID_MPEG4 , AVMEDIA_TYPE_VIDEO },
+ { "mp3" , AV_CODEC_ID_MP3 , AVMEDIA_TYPE_AUDIO },
+ { "mpegvideo", AV_CODEC_ID_MPEG2VIDEO, AVMEDIA_TYPE_VIDEO },
{ 0 }
};
AVInputFormat *fmt = av_probe_input_format2(pd, 1, &score);
@@ -400,93 +349,6 @@ static int set_codec_from_probe_data(AVFormatContext *s, AVStream *st, AVProbeDa
/************************************************************/
/* input media file */
-#if FF_API_FORMAT_PARAMETERS
-static AVDictionary *convert_format_parameters(AVFormatParameters *ap)
-{
- char buf[1024];
- AVDictionary *opts = NULL;
-
- if (!ap)
- return NULL;
-
- if (ap->time_base.num) {
- snprintf(buf, sizeof(buf), "%d/%d", ap->time_base.den, ap->time_base.num);
- av_dict_set(&opts, "framerate", buf, 0);
- }
- if (ap->sample_rate) {
- snprintf(buf, sizeof(buf), "%d", ap->sample_rate);
- av_dict_set(&opts, "sample_rate", buf, 0);
- }
- if (ap->channels) {
- snprintf(buf, sizeof(buf), "%d", ap->channels);
- av_dict_set(&opts, "channels", buf, 0);
- }
- if (ap->width || ap->height) {
- snprintf(buf, sizeof(buf), "%dx%d", ap->width, ap->height);
- av_dict_set(&opts, "video_size", buf, 0);
- }
- if (ap->pix_fmt != PIX_FMT_NONE) {
- av_dict_set(&opts, "pixel_format", av_get_pix_fmt_name(ap->pix_fmt), 0);
- }
- if (ap->channel) {
- snprintf(buf, sizeof(buf), "%d", ap->channel);
- av_dict_set(&opts, "channel", buf, 0);
- }
- if (ap->standard) {
- av_dict_set(&opts, "standard", ap->standard, 0);
- }
- if (ap->mpeg2ts_compute_pcr) {
- av_dict_set(&opts, "mpeg2ts_compute_pcr", "1", 0);
- }
- if (ap->initial_pause) {
- av_dict_set(&opts, "initial_pause", "1", 0);
- }
- return opts;
-}
-
-/**
- * Open a media file from an IO stream. 'fmt' must be specified.
- */
-int av_open_input_stream(AVFormatContext **ic_ptr,
- AVIOContext *pb, const char *filename,
- AVInputFormat *fmt, AVFormatParameters *ap)
-{
- int err;
- AVDictionary *opts;
- AVFormatContext *ic;
- AVFormatParameters default_ap;
-
- if(!ap){
- ap=&default_ap;
- memset(ap, 0, sizeof(default_ap));
- }
- opts = convert_format_parameters(ap);
-
- if(!ap->prealloced_context)
- ic = avformat_alloc_context();
- else
- ic = *ic_ptr;
- if (!ic) {
- err = AVERROR(ENOMEM);
- goto fail;
- }
- if (pb && fmt && fmt->flags & AVFMT_NOFILE)
- av_log(ic, AV_LOG_WARNING, "Custom AVIOContext makes no sense and "
- "will be ignored with AVFMT_NOFILE format.\n");
- else
- ic->pb = pb;
-
- if ((err = avformat_open_input(&ic, filename, fmt, &opts)) < 0)
- goto fail;
- ic->pb = ic->pb ? ic->pb : pb; // don't leak custom pb if it wasn't set above
-
-fail:
- *ic_ptr = ic;
- av_dict_free(&opts);
- return err;
-}
-#endif
-
/** size of probe buffer, for guessing file type from file contents */
#define PROBE_BUF_MIN 2048
#define PROBE_BUF_MAX (1<<20)
@@ -558,25 +420,6 @@ int av_probe_input_buffer(AVIOContext *pb, AVInputFormat **fmt,
return ret;
}
-#if FF_API_FORMAT_PARAMETERS
-int av_open_input_file(AVFormatContext **ic_ptr, const char *filename,
- AVInputFormat *fmt,
- int buf_size,
- AVFormatParameters *ap)
-{
- int err;
- AVDictionary *opts = convert_format_parameters(ap);
-
- if (!ap || !ap->prealloced_context)
- *ic_ptr = NULL;
-
- err = avformat_open_input(ic_ptr, filename, fmt, &opts);
-
- av_dict_free(&opts);
- return err;
-}
-#endif
-
/* open input file and probe the format if necessary */
static int init_input(AVFormatContext *s, const char *filename, AVDictionary **options)
{
@@ -586,7 +429,7 @@ static int init_input(AVFormatContext *s, const char *filename, AVDictionary **o
if (s->pb) {
s->flags |= AVFMT_FLAG_CUSTOM_IO;
if (!s->iformat)
- return av_probe_input_buffer(s->pb, &s->iformat, filename, s, 0, 0);
+ return av_probe_input_buffer(s->pb, &s->iformat, filename, s, 0, s->probesize);
else if (s->iformat->flags & AVFMT_NOFILE)
return AVERROR(EINVAL);
return 0;
@@ -601,15 +444,44 @@ static int init_input(AVFormatContext *s, const char *filename, AVDictionary **o
return ret;
if (s->iformat)
return 0;
- return av_probe_input_buffer(s->pb, &s->iformat, filename, s, 0, 0);
+ return av_probe_input_buffer(s->pb, &s->iformat, filename, s, 0, s->probesize);
+}
+
+static AVPacket *add_to_pktbuf(AVPacketList **packet_buffer, AVPacket *pkt,
+ AVPacketList **plast_pktl){
+ AVPacketList *pktl = av_mallocz(sizeof(AVPacketList));
+ if (!pktl)
+ return NULL;
+
+ if (*packet_buffer)
+ (*plast_pktl)->next = pktl;
+ else
+ *packet_buffer = pktl;
+
+ /* add the packet in the buffered packet list */
+ *plast_pktl = pktl;
+ pktl->pkt= *pkt;
+ return &pktl->pkt;
+}
+
+static void queue_attached_pictures(AVFormatContext *s)
+{
+ int i;
+ for (i = 0; i < s->nb_streams; i++)
+ if (s->streams[i]->disposition & AV_DISPOSITION_ATTACHED_PIC &&
+ s->streams[i]->discard < AVDISCARD_ALL) {
+ AVPacket copy = s->streams[i]->attached_pic;
+ copy.destruct = NULL;
+ add_to_pktbuf(&s->raw_packet_buffer, &copy, &s->raw_packet_buffer_end);
+ }
}
int avformat_open_input(AVFormatContext **ps, const char *filename, AVInputFormat *fmt, AVDictionary **options)
{
AVFormatContext *s = *ps;
int ret = 0;
- AVFormatParameters ap = { { 0 } };
AVDictionary *tmp = NULL;
+ ID3v2ExtraMeta *id3v2_extra_meta = NULL;
if (!s && !(s = avformat_alloc_context()))
return AVERROR(ENOMEM);
@@ -652,12 +524,19 @@ int avformat_open_input(AVFormatContext **ps, const char *filename, AVInputForma
/* e.g. AVFMT_NOFILE formats will not have a AVIOContext */
if (s->pb)
- ff_id3v2_read(s, ID3v2_DEFAULT_MAGIC);
+ ff_id3v2_read(s, ID3v2_DEFAULT_MAGIC, &id3v2_extra_meta);
if (s->iformat->read_header)
- if ((ret = s->iformat->read_header(s, &ap)) < 0)
+ if ((ret = s->iformat->read_header(s)) < 0)
goto fail;
+ if (id3v2_extra_meta &&
+ (ret = ff_id3v2_parse_apic(s, &id3v2_extra_meta)) < 0)
+ goto fail;
+ ff_id3v2_free_extra_meta(&id3v2_extra_meta);
+
+ queue_attached_pictures(s);
+
if (s->pb && !s->data_offset)
s->data_offset = avio_tell(s->pb);
@@ -671,6 +550,7 @@ int avformat_open_input(AVFormatContext **ps, const char *filename, AVInputForma
return 0;
fail:
+ ff_id3v2_free_extra_meta(&id3v2_extra_meta);
av_dict_free(&tmp);
if (s->pb && !(s->flags & AVFMT_FLAG_CUSTOM_IO))
avio_close(s->pb);
@@ -681,24 +561,40 @@ fail:
/*******************************************************/
-static AVPacket *add_to_pktbuf(AVPacketList **packet_buffer, AVPacket *pkt,
- AVPacketList **plast_pktl){
- AVPacketList *pktl = av_mallocz(sizeof(AVPacketList));
- if (!pktl)
- return NULL;
+static void probe_codec(AVFormatContext *s, AVStream *st, const AVPacket *pkt)
+{
+ if(st->codec->codec_id == AV_CODEC_ID_PROBE){
+ AVProbeData *pd = &st->probe_data;
+ av_log(s, AV_LOG_DEBUG, "probing stream %d\n", st->index);
+ --st->probe_packets;
- if (*packet_buffer)
- (*plast_pktl)->next = pktl;
- else
- *packet_buffer = pktl;
+ if (pkt) {
+ pd->buf = av_realloc(pd->buf, pd->buf_size+pkt->size+AVPROBE_PADDING_SIZE);
+ memcpy(pd->buf+pd->buf_size, pkt->data, pkt->size);
+ pd->buf_size += pkt->size;
+ memset(pd->buf+pd->buf_size, 0, AVPROBE_PADDING_SIZE);
+ } else {
+ st->probe_packets = 0;
+ if (!pd->buf_size) {
+ av_log(s, AV_LOG_ERROR, "nothing to probe for stream %d\n",
+ st->index);
+ return;
+ }
+ }
- /* add the packet in the buffered packet list */
- *plast_pktl = pktl;
- pktl->pkt= *pkt;
- return &pktl->pkt;
+ if (!st->probe_packets ||
+ av_log2(pd->buf_size) != av_log2(pd->buf_size - pkt->size)) {
+ set_codec_from_probe_data(s, st, pd, st->probe_packets > 0 ? AVPROBE_SCORE_MAX/4 : 0);
+ if(st->codec->codec_id != AV_CODEC_ID_PROBE){
+ pd->buf_size=0;
+ av_freep(&pd->buf);
+ av_log(s, AV_LOG_DEBUG, "probed stream %d\n", st->index);
+ }
+ }
+ }
}
-int av_read_packet(AVFormatContext *s, AVPacket *pkt)
+int ff_read_packet(AVFormatContext *s, AVPacket *pkt)
{
int ret, i;
AVStream *st;
@@ -708,10 +604,14 @@ int av_read_packet(AVFormatContext *s, AVPacket *pkt)
if (pktl) {
*pkt = pktl->pkt;
- if(s->streams[pkt->stream_index]->codec->codec_id != CODEC_ID_PROBE ||
- !s->streams[pkt->stream_index]->probe_packets ||
- s->raw_packet_buffer_remaining_size < pkt->size){
- AVProbeData *pd = &s->streams[pkt->stream_index]->probe_data;
+ st = s->streams[pkt->stream_index];
+ if (st->codec->codec_id != AV_CODEC_ID_PROBE || !st->probe_packets ||
+ s->raw_packet_buffer_remaining_size < pkt->size) {
+ AVProbeData *pd;
+ if (st->probe_packets) {
+ probe_codec(s, st, NULL);
+ }
+ pd = &st->probe_data;
av_freep(&pd->buf);
pd->buf_size = 0;
s->raw_packet_buffer = pktl->next;
@@ -721,13 +621,19 @@ int av_read_packet(AVFormatContext *s, AVPacket *pkt)
}
}
+ pkt->data = NULL;
+ pkt->size = 0;
av_init_packet(pkt);
ret= s->iformat->read_packet(s, pkt);
if (ret < 0) {
if (!pktl || ret == AVERROR(EAGAIN))
return ret;
- for (i = 0; i < s->nb_streams; i++)
- s->streams[i]->probe_packets = 0;
+ for (i = 0; i < s->nb_streams; i++) {
+ st = s->streams[i];
+ if (st->probe_packets) {
+ probe_codec(s, st, NULL);
+ }
+ }
continue;
}
@@ -754,73 +660,54 @@ int av_read_packet(AVFormatContext *s, AVPacket *pkt)
break;
}
- if(!pktl && (st->codec->codec_id != CODEC_ID_PROBE ||
+ if(!pktl && (st->codec->codec_id != AV_CODEC_ID_PROBE ||
!st->probe_packets))
return ret;
add_to_pktbuf(&s->raw_packet_buffer, pkt, &s->raw_packet_buffer_end);
s->raw_packet_buffer_remaining_size -= pkt->size;
- if(st->codec->codec_id == CODEC_ID_PROBE){
- AVProbeData *pd = &st->probe_data;
- av_log(s, AV_LOG_DEBUG, "probing stream %d\n", st->index);
- --st->probe_packets;
-
- pd->buf = av_realloc(pd->buf, pd->buf_size+pkt->size+AVPROBE_PADDING_SIZE);
- memcpy(pd->buf+pd->buf_size, pkt->data, pkt->size);
- pd->buf_size += pkt->size;
- memset(pd->buf+pd->buf_size, 0, AVPROBE_PADDING_SIZE);
-
- if(av_log2(pd->buf_size) != av_log2(pd->buf_size - pkt->size)){
- //FIXME we do not reduce score to 0 for the case of running out of buffer space in bytes
- set_codec_from_probe_data(s, st, pd, st->probe_packets > 0 ? AVPROBE_SCORE_MAX/4 : 0);
- if(st->codec->codec_id != CODEC_ID_PROBE){
- pd->buf_size=0;
- av_freep(&pd->buf);
- av_log(s, AV_LOG_DEBUG, "probed stream %d\n", st->index);
- }
- }
- }
+ probe_codec(s, st, pkt);
}
}
+#if FF_API_READ_PACKET
+int av_read_packet(AVFormatContext *s, AVPacket *pkt)
+{
+ return ff_read_packet(s, pkt);
+}
+#endif
+
+
/**********************************************************/
/**
* Get the number of samples of an audio frame. Return -1 on error.
*/
-static int get_audio_frame_size(AVCodecContext *enc, int size)
+int ff_get_audio_frame_size(AVCodecContext *enc, int size, int mux)
{
int frame_size;
- if(enc->codec_id == CODEC_ID_VORBIS)
- return -1;
+ /* give frame_size priority if demuxing */
+ if (!mux && enc->frame_size > 1)
+ return enc->frame_size;
- if (enc->frame_size <= 1) {
- int bits_per_sample = av_get_bits_per_sample(enc->codec_id);
+ if ((frame_size = av_get_audio_frame_duration(enc, size)) > 0)
+ return frame_size;
- if (bits_per_sample) {
- if (enc->channels == 0)
- return -1;
- frame_size = (size << 3) / (bits_per_sample * enc->channels);
- } else {
- /* used for example by ADPCM codecs */
- if (enc->bit_rate == 0)
- return -1;
- frame_size = ((int64_t)size * 8 * enc->sample_rate) / enc->bit_rate;
- }
- } else {
- frame_size = enc->frame_size;
- }
- return frame_size;
+ /* fallback to using frame_size if muxing */
+ if (enc->frame_size > 1)
+ return enc->frame_size;
+
+ return -1;
}
/**
* Return the frame duration in seconds. Return 0 if not available.
*/
-static void compute_frame_duration(int *pnum, int *pden, AVStream *st,
- AVCodecParserContext *pc, AVPacket *pkt)
+void ff_compute_frame_duration(int *pnum, int *pden, AVStream *st,
+ AVCodecParserContext *pc, AVPacket *pkt)
{
int frame_size;
@@ -828,9 +715,9 @@ static void compute_frame_duration(int *pnum, int *pden, AVStream *st,
*pden = 0;
switch(st->codec->codec_type) {
case AVMEDIA_TYPE_VIDEO:
- if (st->r_frame_rate.num) {
- *pnum = st->r_frame_rate.den;
- *pden = st->r_frame_rate.num;
+ if (st->avg_frame_rate.num) {
+ *pnum = st->avg_frame_rate.den;
+ *pden = st->avg_frame_rate.num;
} else if(st->time_base.num*1000LL > st->time_base.den) {
*pnum = st->time_base.num;
*pden = st->time_base.den;
@@ -851,7 +738,7 @@ static void compute_frame_duration(int *pnum, int *pden, AVStream *st,
}
break;
case AVMEDIA_TYPE_AUDIO:
- frame_size = get_audio_frame_size(st->codec, pkt->size);
+ frame_size = ff_get_audio_frame_size(st->codec, pkt->size, 0);
if (frame_size <= 0 || st->codec->sample_rate <= 0)
break;
*pnum = frame_size;
@@ -862,29 +749,14 @@ static void compute_frame_duration(int *pnum, int *pden, AVStream *st,
}
}
-static int is_intra_only(AVCodecContext *enc){
- if(enc->codec_type == AVMEDIA_TYPE_AUDIO){
- return 1;
- }else if(enc->codec_type == AVMEDIA_TYPE_VIDEO){
- switch(enc->codec_id){
- case CODEC_ID_MJPEG:
- case CODEC_ID_MJPEGB:
- case CODEC_ID_LJPEG:
- case CODEC_ID_PRORES:
- case CODEC_ID_RAWVIDEO:
- case CODEC_ID_DVVIDEO:
- case CODEC_ID_HUFFYUV:
- case CODEC_ID_FFVHUFF:
- case CODEC_ID_ASV1:
- case CODEC_ID_ASV2:
- case CODEC_ID_VCR1:
- case CODEC_ID_DNXHD:
- case CODEC_ID_JPEG2000:
- return 1;
- default: break;
- }
- }
- return 0;
+static int is_intra_only(enum AVCodecID id)
+{
+ const AVCodecDescriptor *d = avcodec_descriptor_get(id);
+ if (!d)
+ return 0;
+ if (d->type == AVMEDIA_TYPE_VIDEO && !(d->props & AV_CODEC_PROP_INTRA_ONLY))
+ return 0;
+ return 1;
}
static void update_initial_timestamps(AVFormatContext *s, int stream_index,
@@ -916,7 +788,8 @@ static void update_initial_timestamps(AVFormatContext *s, int stream_index,
st->start_time = pts;
}
-static void update_initial_durations(AVFormatContext *s, AVStream *st, AVPacket *pkt)
+static void update_initial_durations(AVFormatContext *s, AVStream *st,
+ int stream_index, int duration)
{
AVPacketList *pktl= s->packet_buffer;
int64_t cur_dts= 0;
@@ -924,10 +797,10 @@ static void update_initial_durations(AVFormatContext *s, AVStream *st, AVPacket
if(st->first_dts != AV_NOPTS_VALUE){
cur_dts= st->first_dts;
for(; pktl; pktl= pktl->next){
- if(pktl->pkt.stream_index == pkt->stream_index){
+ if(pktl->pkt.stream_index == stream_index){
if(pktl->pkt.pts != pktl->pkt.dts || pktl->pkt.dts != AV_NOPTS_VALUE || pktl->pkt.duration)
break;
- cur_dts -= pkt->duration;
+ cur_dts -= duration;
}
}
pktl= s->packet_buffer;
@@ -936,15 +809,16 @@ static void update_initial_durations(AVFormatContext *s, AVStream *st, AVPacket
return;
for(; pktl; pktl= pktl->next){
- if(pktl->pkt.stream_index != pkt->stream_index)
+ if(pktl->pkt.stream_index != stream_index)
continue;
if(pktl->pkt.pts == pktl->pkt.dts && pktl->pkt.dts == AV_NOPTS_VALUE
&& !pktl->pkt.duration){
pktl->pkt.dts= cur_dts;
if(!st->codec->has_b_frames)
pktl->pkt.pts= cur_dts;
- cur_dts += pkt->duration;
- pktl->pkt.duration= pkt->duration;
+ cur_dts += duration;
+ if (st->codec->codec_type != AVMEDIA_TYPE_AUDIO)
+ pktl->pkt.duration = duration;
}else
break;
}
@@ -964,10 +838,6 @@ static void compute_pkt_fields(AVFormatContext *s, AVStream *st,
if((s->flags & AVFMT_FLAG_IGNDTS) && pkt->pts != AV_NOPTS_VALUE)
pkt->dts= AV_NOPTS_VALUE;
- if (st->codec->codec_id != CODEC_ID_H264 && pc && pc->pict_type == AV_PICTURE_TYPE_B)
- //FIXME Set low_delay = 0 when has_b_frames = 1
- st->codec->has_b_frames = 1;
-
/* do we have a video B-frame ? */
delay= st->codec->has_b_frames;
presentation_delayed = 0;
@@ -991,13 +861,13 @@ static void compute_pkt_fields(AVFormatContext *s, AVStream *st,
pkt->dts= pkt->pts= AV_NOPTS_VALUE;
}
- if (pkt->duration == 0) {
- compute_frame_duration(&num, &den, st, pc, pkt);
+ if (pkt->duration == 0 && st->codec->codec_type != AVMEDIA_TYPE_AUDIO) {
+ ff_compute_frame_duration(&num, &den, st, pc, pkt);
if (den && num) {
pkt->duration = av_rescale_rnd(1, num * (int64_t)st->time_base.den, den * (int64_t)st->time_base.num, AV_ROUND_DOWN);
if(pkt->duration != 0 && s->packet_buffer)
- update_initial_durations(s, st, pkt);
+ update_initial_durations(s, st, pkt->stream_index, pkt->duration);
}
}
@@ -1035,10 +905,13 @@ static void compute_pkt_fields(AVFormatContext *s, AVStream *st,
if(pkt->dts != AV_NOPTS_VALUE && pkt->pts != AV_NOPTS_VALUE && pkt->pts > pkt->dts)
presentation_delayed = 1;
-// av_log(NULL, AV_LOG_DEBUG, "IN delayed:%d pts:%"PRId64", dts:%"PRId64" cur_dts:%"PRId64" st:%d pc:%p\n", presentation_delayed, pkt->pts, pkt->dts, st->cur_dts, pkt->stream_index, pc);
+ av_dlog(NULL,
+ "IN delayed:%d pts:%"PRId64", dts:%"PRId64" cur_dts:%"PRId64" st:%d pc:%p\n",
+ presentation_delayed, pkt->pts, pkt->dts, st->cur_dts,
+ pkt->stream_index, pc);
/* interpolate PTS and DTS if they are not present */
//We skip H264 currently because delay and has_b_frames are not reliably set
- if((delay==0 || (delay==1 && pc)) && st->codec->codec_id != CODEC_ID_H264){
+ if((delay==0 || (delay==1 && pc)) && st->codec->codec_id != AV_CODEC_ID_H264){
if (presentation_delayed) {
/* DTS = decompression timestamp */
/* PTS = presentation timestamp */
@@ -1058,25 +931,37 @@ static void compute_pkt_fields(AVFormatContext *s, AVStream *st,
st->last_IP_pts= pkt->pts;
/* cannot compute PTS if not present (we can compute it only
by knowing the future */
- } else if(pkt->pts != AV_NOPTS_VALUE || pkt->dts != AV_NOPTS_VALUE || pkt->duration){
- if(pkt->pts != AV_NOPTS_VALUE && pkt->duration){
- int64_t old_diff= FFABS(st->cur_dts - pkt->duration - pkt->pts);
- int64_t new_diff= FFABS(st->cur_dts - pkt->pts);
- if(old_diff < new_diff && old_diff < (pkt->duration>>3)){
- pkt->pts += pkt->duration;
- // av_log(NULL, AV_LOG_DEBUG, "id:%d old:%"PRId64" new:%"PRId64" dur:%d cur:%"PRId64" size:%d\n", pkt->stream_index, old_diff, new_diff, pkt->duration, st->cur_dts, pkt->size);
+ } else if (pkt->pts != AV_NOPTS_VALUE ||
+ pkt->dts != AV_NOPTS_VALUE ||
+ pkt->duration ||
+ st->codec->codec_type == AVMEDIA_TYPE_AUDIO) {
+ int duration = pkt->duration;
+ if (!duration && st->codec->codec_type == AVMEDIA_TYPE_AUDIO) {
+ ff_compute_frame_duration(&num, &den, st, pc, pkt);
+ if (den && num) {
+ duration = av_rescale_rnd(1, num * (int64_t)st->time_base.den,
+ den * (int64_t)st->time_base.num,
+ AV_ROUND_DOWN);
+ if (duration != 0 && s->packet_buffer) {
+ update_initial_durations(s, st, pkt->stream_index,
+ duration);
+ }
}
}
- /* presentation is not delayed : PTS and DTS are the same */
- if(pkt->pts == AV_NOPTS_VALUE)
- pkt->pts = pkt->dts;
- update_initial_timestamps(s, pkt->stream_index, pkt->pts, pkt->pts);
- if(pkt->pts == AV_NOPTS_VALUE)
- pkt->pts = st->cur_dts;
- pkt->dts = pkt->pts;
- if(pkt->pts != AV_NOPTS_VALUE)
- st->cur_dts = pkt->pts + pkt->duration;
+ if (pkt->pts != AV_NOPTS_VALUE || pkt->dts != AV_NOPTS_VALUE ||
+ duration) {
+ /* presentation is not delayed : PTS and DTS are the same */
+ if (pkt->pts == AV_NOPTS_VALUE)
+ pkt->pts = pkt->dts;
+ update_initial_timestamps(s, pkt->stream_index, pkt->pts,
+ pkt->pts);
+ if (pkt->pts == AV_NOPTS_VALUE)
+ pkt->pts = st->cur_dts;
+ pkt->dts = pkt->pts;
+ if (pkt->pts != AV_NOPTS_VALUE)
+ st->cur_dts = pkt->pts + duration;
+ }
}
}
@@ -1086,160 +971,229 @@ static void compute_pkt_fields(AVFormatContext *s, AVStream *st,
FFSWAP(int64_t, st->pts_buffer[i], st->pts_buffer[i+1]);
if(pkt->dts == AV_NOPTS_VALUE)
pkt->dts= st->pts_buffer[0];
- if(st->codec->codec_id == CODEC_ID_H264){ // we skipped it above so we try here
+ if(st->codec->codec_id == AV_CODEC_ID_H264){ // we skipped it above so we try here
update_initial_timestamps(s, pkt->stream_index, pkt->dts, pkt->pts); // this should happen on the first packet
}
if(pkt->dts > st->cur_dts)
st->cur_dts = pkt->dts;
}
-// av_log(NULL, AV_LOG_ERROR, "OUTdelayed:%d/%d pts:%"PRId64", dts:%"PRId64" cur_dts:%"PRId64"\n", presentation_delayed, delay, pkt->pts, pkt->dts, st->cur_dts);
+ av_dlog(NULL,
+ "OUTdelayed:%d/%d pts:%"PRId64", dts:%"PRId64" cur_dts:%"PRId64"\n",
+ presentation_delayed, delay, pkt->pts, pkt->dts, st->cur_dts);
/* update flags */
- if(is_intra_only(st->codec))
+ if (is_intra_only(st->codec->codec_id))
pkt->flags |= AV_PKT_FLAG_KEY;
- else if (pc) {
- pkt->flags = 0;
- /* keyframe computation */
- if (pc->key_frame == 1)
- pkt->flags |= AV_PKT_FLAG_KEY;
- else if (pc->key_frame == -1 && pc->pict_type == AV_PICTURE_TYPE_I)
- pkt->flags |= AV_PKT_FLAG_KEY;
- }
if (pc)
pkt->convergence_duration = pc->convergence_duration;
}
+static void free_packet_buffer(AVPacketList **pkt_buf, AVPacketList **pkt_buf_end)
+{
+ while (*pkt_buf) {
+ AVPacketList *pktl = *pkt_buf;
+ *pkt_buf = pktl->next;
+ av_free_packet(&pktl->pkt);
+ av_freep(&pktl);
+ }
+ *pkt_buf_end = NULL;
+}
+
+/**
+ * Parse a packet, add all split parts to parse_queue
+ *
+ * @param pkt packet to parse, NULL when flushing the parser at end of stream
+ */
+static int parse_packet(AVFormatContext *s, AVPacket *pkt, int stream_index)
+{
+ AVPacket out_pkt = { 0 }, flush_pkt = { 0 };
+ AVStream *st = s->streams[stream_index];
+ uint8_t *data = pkt ? pkt->data : NULL;
+ int size = pkt ? pkt->size : 0;
+ int ret = 0, got_output = 0;
+
+ if (!pkt) {
+ av_init_packet(&flush_pkt);
+ pkt = &flush_pkt;
+ got_output = 1;
+ }
+
+ while (size > 0 || (pkt == &flush_pkt && got_output)) {
+ int len;
+
+ av_init_packet(&out_pkt);
+ len = av_parser_parse2(st->parser, st->codec,
+ &out_pkt.data, &out_pkt.size, data, size,
+ pkt->pts, pkt->dts, pkt->pos);
+
+ pkt->pts = pkt->dts = AV_NOPTS_VALUE;
+ /* increment read pointer */
+ data += len;
+ size -= len;
+
+ got_output = !!out_pkt.size;
+
+ if (!out_pkt.size)
+ continue;
+
+ /* set the duration */
+ out_pkt.duration = 0;
+ if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO) {
+ if (st->codec->sample_rate > 0) {
+ out_pkt.duration = av_rescale_q_rnd(st->parser->duration,
+ (AVRational){ 1, st->codec->sample_rate },
+ st->time_base,
+ AV_ROUND_DOWN);
+ }
+ } else if (st->codec->time_base.num != 0 &&
+ st->codec->time_base.den != 0) {
+ out_pkt.duration = av_rescale_q_rnd(st->parser->duration,
+ st->codec->time_base,
+ st->time_base,
+ AV_ROUND_DOWN);
+ }
+
+ out_pkt.stream_index = st->index;
+ out_pkt.pts = st->parser->pts;
+ out_pkt.dts = st->parser->dts;
+ out_pkt.pos = st->parser->pos;
+
+ if (st->parser->key_frame == 1 ||
+ (st->parser->key_frame == -1 &&
+ st->parser->pict_type == AV_PICTURE_TYPE_I))
+ out_pkt.flags |= AV_PKT_FLAG_KEY;
+
+ compute_pkt_fields(s, st, st->parser, &out_pkt);
+
+ if ((s->iformat->flags & AVFMT_GENERIC_INDEX) &&
+ out_pkt.flags & AV_PKT_FLAG_KEY) {
+ ff_reduce_index(s, st->index);
+ av_add_index_entry(st, st->parser->frame_offset, out_pkt.dts,
+ 0, 0, AVINDEX_KEYFRAME);
+ }
+
+ if (out_pkt.data == pkt->data && out_pkt.size == pkt->size) {
+ out_pkt.destruct = pkt->destruct;
+ pkt->destruct = NULL;
+ }
+ if ((ret = av_dup_packet(&out_pkt)) < 0)
+ goto fail;
+
+ if (!add_to_pktbuf(&s->parse_queue, &out_pkt, &s->parse_queue_end)) {
+ av_free_packet(&out_pkt);
+ ret = AVERROR(ENOMEM);
+ goto fail;
+ }
+ }
+
+
+ /* end of the stream => close and free the parser */
+ if (pkt == &flush_pkt) {
+ av_parser_close(st->parser);
+ st->parser = NULL;
+ }
+
+fail:
+ av_free_packet(pkt);
+ return ret;
+}
+
+static int read_from_packet_buffer(AVPacketList **pkt_buffer,
+ AVPacketList **pkt_buffer_end,
+ AVPacket *pkt)
+{
+ AVPacketList *pktl;
+ av_assert0(*pkt_buffer);
+ pktl = *pkt_buffer;
+ *pkt = pktl->pkt;
+ *pkt_buffer = pktl->next;
+ if (!pktl->next)
+ *pkt_buffer_end = NULL;
+ av_freep(&pktl);
+ return 0;
+}
static int read_frame_internal(AVFormatContext *s, AVPacket *pkt)
{
- AVStream *st;
- int len, ret, i;
+ int ret = 0, i, got_packet = 0;
av_init_packet(pkt);
- for(;;) {
- /* select current input stream component */
- st = s->cur_st;
- if (st) {
- if (!st->need_parsing || !st->parser) {
- /* no parsing needed: we just output the packet as is */
- /* raw data support */
- *pkt = st->cur_pkt; st->cur_pkt.data= NULL;
- compute_pkt_fields(s, st, NULL, pkt);
- s->cur_st = NULL;
- if ((s->iformat->flags & AVFMT_GENERIC_INDEX) &&
- (pkt->flags & AV_PKT_FLAG_KEY) && pkt->dts != AV_NOPTS_VALUE) {
- ff_reduce_index(s, st->index);
- av_add_index_entry(st, pkt->pos, pkt->dts, 0, 0, AVINDEX_KEYFRAME);
- }
- break;
- } else if (st->cur_len > 0 && st->discard < AVDISCARD_ALL) {
- len = av_parser_parse2(st->parser, st->codec, &pkt->data, &pkt->size,
- st->cur_ptr, st->cur_len,
- st->cur_pkt.pts, st->cur_pkt.dts,
- st->cur_pkt.pos);
- st->cur_pkt.pts = AV_NOPTS_VALUE;
- st->cur_pkt.dts = AV_NOPTS_VALUE;
- /* increment read pointer */
- st->cur_ptr += len;
- st->cur_len -= len;
-
- /* return packet if any */
- if (pkt->size) {
- got_packet:
- pkt->duration = 0;
- pkt->stream_index = st->index;
- pkt->pts = st->parser->pts;
- pkt->dts = st->parser->dts;
- pkt->pos = st->parser->pos;
- if(pkt->data == st->cur_pkt.data && pkt->size == st->cur_pkt.size){
- s->cur_st = NULL;
- pkt->destruct= st->cur_pkt.destruct;
- st->cur_pkt.destruct= NULL;
- st->cur_pkt.data = NULL;
- assert(st->cur_len == 0);
- }else{
- pkt->destruct = NULL;
- }
- compute_pkt_fields(s, st, st->parser, pkt);
-
- if((s->iformat->flags & AVFMT_GENERIC_INDEX) && pkt->flags & AV_PKT_FLAG_KEY){
- ff_reduce_index(s, st->index);
- av_add_index_entry(st, st->parser->frame_offset, pkt->dts,
- 0, 0, AVINDEX_KEYFRAME);
- }
+ while (!got_packet && !s->parse_queue) {
+ AVStream *st;
+ AVPacket cur_pkt;
- break;
- }
- } else {
- /* free packet */
- av_free_packet(&st->cur_pkt);
- s->cur_st = NULL;
- }
- } else {
- AVPacket cur_pkt;
- /* read next packet */
- ret = av_read_packet(s, &cur_pkt);
- if (ret < 0) {
- if (ret == AVERROR(EAGAIN))
- return ret;
- /* return the last frames, if any */
- for(i = 0; i < s->nb_streams; i++) {
- st = s->streams[i];
- if (st->parser && st->need_parsing) {
- av_parser_parse2(st->parser, st->codec,
- &pkt->data, &pkt->size,
- NULL, 0,
- AV_NOPTS_VALUE, AV_NOPTS_VALUE,
- AV_NOPTS_VALUE);
- if (pkt->size)
- goto got_packet;
- }
- }
- /* no more packets: really terminate parsing */
+ /* read next packet */
+ ret = ff_read_packet(s, &cur_pkt);
+ if (ret < 0) {
+ if (ret == AVERROR(EAGAIN))
return ret;
+ /* flush the parsers */
+ for(i = 0; i < s->nb_streams; i++) {
+ st = s->streams[i];
+ if (st->parser && st->need_parsing)
+ parse_packet(s, NULL, st->index);
}
- st = s->streams[cur_pkt.stream_index];
- st->cur_pkt= cur_pkt;
-
- if(st->cur_pkt.pts != AV_NOPTS_VALUE &&
- st->cur_pkt.dts != AV_NOPTS_VALUE &&
- st->cur_pkt.pts < st->cur_pkt.dts){
- av_log(s, AV_LOG_WARNING, "Invalid timestamps stream=%d, pts=%"PRId64", dts=%"PRId64", size=%d\n",
- st->cur_pkt.stream_index,
- st->cur_pkt.pts,
- st->cur_pkt.dts,
- st->cur_pkt.size);
-// av_free_packet(&st->cur_pkt);
-// return -1;
+ /* all remaining packets are now in parse_queue =>
+ * really terminate parsing */
+ break;
+ }
+ ret = 0;
+ st = s->streams[cur_pkt.stream_index];
+
+ if (cur_pkt.pts != AV_NOPTS_VALUE &&
+ cur_pkt.dts != AV_NOPTS_VALUE &&
+ cur_pkt.pts < cur_pkt.dts) {
+ av_log(s, AV_LOG_WARNING, "Invalid timestamps stream=%d, pts=%"PRId64", dts=%"PRId64", size=%d\n",
+ cur_pkt.stream_index,
+ cur_pkt.pts,
+ cur_pkt.dts,
+ cur_pkt.size);
+ }
+ if (s->debug & FF_FDEBUG_TS)
+ av_log(s, AV_LOG_DEBUG, "ff_read_packet stream=%d, pts=%"PRId64", dts=%"PRId64", size=%d, duration=%d, flags=%d\n",
+ cur_pkt.stream_index,
+ cur_pkt.pts,
+ cur_pkt.dts,
+ cur_pkt.size,
+ cur_pkt.duration,
+ cur_pkt.flags);
+
+ if (st->need_parsing && !st->parser && !(s->flags & AVFMT_FLAG_NOPARSE)) {
+ st->parser = av_parser_init(st->codec->codec_id);
+ if (!st->parser) {
+ /* no parser available: just output the raw packets */
+ st->need_parsing = AVSTREAM_PARSE_NONE;
+ } else if(st->need_parsing == AVSTREAM_PARSE_HEADERS) {
+ st->parser->flags |= PARSER_FLAG_COMPLETE_FRAMES;
+ } else if(st->need_parsing == AVSTREAM_PARSE_FULL_ONCE) {
+ st->parser->flags |= PARSER_FLAG_ONCE;
}
+ }
- if(s->debug & FF_FDEBUG_TS)
- av_log(s, AV_LOG_DEBUG, "av_read_packet stream=%d, pts=%"PRId64", dts=%"PRId64", size=%d, duration=%d, flags=%d\n",
- st->cur_pkt.stream_index,
- st->cur_pkt.pts,
- st->cur_pkt.dts,
- st->cur_pkt.size,
- st->cur_pkt.duration,
- st->cur_pkt.flags);
-
- s->cur_st = st;
- st->cur_ptr = st->cur_pkt.data;
- st->cur_len = st->cur_pkt.size;
- if (st->need_parsing && !st->parser && !(s->flags & AVFMT_FLAG_NOPARSE)) {
- st->parser = av_parser_init(st->codec->codec_id);
- if (!st->parser) {
- /* no parser available: just output the raw packets */
- st->need_parsing = AVSTREAM_PARSE_NONE;
- }else if(st->need_parsing == AVSTREAM_PARSE_HEADERS){
- st->parser->flags |= PARSER_FLAG_COMPLETE_FRAMES;
- }else if(st->need_parsing == AVSTREAM_PARSE_FULL_ONCE){
- st->parser->flags |= PARSER_FLAG_ONCE;
- }
+ if (!st->need_parsing || !st->parser) {
+ /* no parsing needed: we just output the packet as is */
+ *pkt = cur_pkt;
+ compute_pkt_fields(s, st, NULL, pkt);
+ if ((s->iformat->flags & AVFMT_GENERIC_INDEX) &&
+ (pkt->flags & AV_PKT_FLAG_KEY) && pkt->dts != AV_NOPTS_VALUE) {
+ ff_reduce_index(s, st->index);
+ av_add_index_entry(st, pkt->pos, pkt->dts, 0, 0, AVINDEX_KEYFRAME);
}
+ got_packet = 1;
+ } else if (st->discard < AVDISCARD_ALL) {
+ if ((ret = parse_packet(s, &cur_pkt, cur_pkt.stream_index)) < 0)
+ return ret;
+ } else {
+ /* free packet */
+ av_free_packet(&cur_pkt);
}
}
+
+ if (!got_packet && s->parse_queue)
+ ret = read_from_packet_buffer(&s->parse_queue, &s->parse_queue_end, pkt);
+
if(s->debug & FF_FDEBUG_TS)
av_log(s, AV_LOG_DEBUG, "read_frame_internal stream=%d, pts=%"PRId64", dts=%"PRId64", size=%d, duration=%d, flags=%d\n",
pkt->stream_index,
@@ -1249,17 +1203,7 @@ static int read_frame_internal(AVFormatContext *s, AVPacket *pkt)
pkt->duration,
pkt->flags);
- return 0;
-}
-
-static int read_from_packet_buffer(AVFormatContext *s, AVPacket *pkt)
-{
- AVPacketList *pktl = s->packet_buffer;
- av_assert0(pktl);
- *pkt = pktl->pkt;
- s->packet_buffer = pktl->next;
- av_freep(&pktl);
- return 0;
+ return ret;
}
int av_read_frame(AVFormatContext *s, AVPacket *pkt)
@@ -1268,7 +1212,9 @@ int av_read_frame(AVFormatContext *s, AVPacket *pkt)
int eof = 0;
if (!genpts)
- return s->packet_buffer ? read_from_packet_buffer(s, pkt) :
+ return s->packet_buffer ? read_from_packet_buffer(&s->packet_buffer,
+ &s->packet_buffer_end,
+ pkt) :
read_frame_internal(s, pkt);
for (;;) {
@@ -1294,7 +1240,8 @@ int av_read_frame(AVFormatContext *s, AVPacket *pkt)
/* read packet from packet buffer, if there is data */
if (!(next_pkt->pts == AV_NOPTS_VALUE &&
next_pkt->dts != AV_NOPTS_VALUE && !eof))
- return read_from_packet_buffer(s, pkt);
+ return read_from_packet_buffer(&s->packet_buffer,
+ &s->packet_buffer_end, pkt);
}
ret = read_frame_internal(s, pkt);
@@ -1315,24 +1262,10 @@ int av_read_frame(AVFormatContext *s, AVPacket *pkt)
/* XXX: suppress the packet queue */
static void flush_packet_queue(AVFormatContext *s)
{
- AVPacketList *pktl;
+ free_packet_buffer(&s->parse_queue, &s->parse_queue_end);
+ free_packet_buffer(&s->packet_buffer, &s->packet_buffer_end);
+ free_packet_buffer(&s->raw_packet_buffer, &s->raw_packet_buffer_end);
- for(;;) {
- pktl = s->packet_buffer;
- if (!pktl)
- break;
- s->packet_buffer = pktl->next;
- av_free_packet(&pktl->pkt);
- av_free(pktl);
- }
- while(s->raw_packet_buffer){
- pktl = s->raw_packet_buffer;
- s->raw_packet_buffer = pktl->next;
- av_free_packet(&pktl->pkt);
- av_free(pktl);
- }
- s->packet_buffer_end=
- s->raw_packet_buffer_end= NULL;
s->raw_packet_buffer_remaining_size = RAW_PACKET_BUFFER_SIZE;
}
@@ -1349,7 +1282,8 @@ int av_find_default_stream_index(AVFormatContext *s)
return -1;
for(i = 0; i < s->nb_streams; i++) {
st = s->streams[i];
- if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
+ if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO &&
+ !(st->disposition & AV_DISPOSITION_ATTACHED_PIC)) {
return i;
}
if (first_audio_index < 0 && st->codec->codec_type == AVMEDIA_TYPE_AUDIO)
@@ -1368,8 +1302,6 @@ void ff_read_frame_flush(AVFormatContext *s)
flush_packet_queue(s);
- s->cur_st = NULL;
-
/* for each stream, reset read state */
for(i = 0; i < s->nb_streams; i++) {
st = s->streams[i];
@@ -1377,14 +1309,10 @@ void ff_read_frame_flush(AVFormatContext *s)
if (st->parser) {
av_parser_close(st->parser);
st->parser = NULL;
- av_free_packet(&st->cur_pkt);
}
st->last_IP_pts = AV_NOPTS_VALUE;
st->cur_dts = AV_NOPTS_VALUE; /* we set the current DTS to an unspecified origin */
st->reference_dts = AV_NOPTS_VALUE;
- /* fail safe */
- st->cur_ptr = NULL;
- st->cur_len = 0;
st->probe_packets = MAX_PROBE_PACKETS;
@@ -1393,13 +1321,6 @@ void ff_read_frame_flush(AVFormatContext *s)
}
}
-#if FF_API_SEEK_PUBLIC
-void av_update_cur_dts(AVFormatContext *s, AVStream *ref_st, int64_t timestamp)
-{
- ff_update_cur_dts(s, ref_st, timestamp);
-}
-#endif
-
void ff_update_cur_dts(AVFormatContext *s, AVStream *ref_st, int64_t timestamp)
{
int i;
@@ -1521,12 +1442,6 @@ int av_index_search_timestamp(AVStream *st, int64_t wanted_timestamp,
wanted_timestamp, flags);
}
-#if FF_API_SEEK_PUBLIC
-int av_seek_frame_binary(AVFormatContext *s, int stream_index, int64_t target_ts, int flags){
- return ff_seek_frame_binary(s, stream_index, target_ts, flags);
-}
-#endif
-
int ff_seek_frame_binary(AVFormatContext *s, int stream_index, int64_t target_ts, int flags)
{
AVInputFormat *avif= s->iformat;
@@ -1588,18 +1503,6 @@ int ff_seek_frame_binary(AVFormatContext *s, int stream_index, int64_t target_ts
return 0;
}
-#if FF_API_SEEK_PUBLIC
-int64_t av_gen_search(AVFormatContext *s, int stream_index, int64_t target_ts,
- int64_t pos_min, int64_t pos_max, int64_t pos_limit,
- int64_t ts_min, int64_t ts_max, int flags, int64_t *ts_ret,
- int64_t (*read_timestamp)(struct AVFormatContext *, int , int64_t *, int64_t ))
-{
- return ff_gen_search(s, stream_index, target_ts, pos_min, pos_max,
- pos_limit, ts_min, ts_max, flags, ts_ret,
- read_timestamp);
-}
-#endif
-
int64_t ff_gen_search(AVFormatContext *s, int stream_index, int64_t target_ts,
int64_t pos_min, int64_t pos_max, int64_t pos_limit,
int64_t ts_min, int64_t ts_max, int flags, int64_t *ts_ret,
@@ -1712,14 +1615,6 @@ int64_t ff_gen_search(AVFormatContext *s, int stream_index, int64_t target_ts,
static int seek_frame_byte(AVFormatContext *s, int stream_index, int64_t pos, int flags){
int64_t pos_min, pos_max;
-#if 0
- AVStream *st;
-
- if (stream_index < 0)
- return -1;
-
- st= s->streams[stream_index];
-#endif
pos_min = s->data_offset;
pos_max = avio_size(s->pb) - 1;
@@ -1729,9 +1624,6 @@ static int seek_frame_byte(AVFormatContext *s, int stream_index, int64_t pos, in
avio_seek(s->pb, pos, SEEK_SET);
-#if 0
- av_update_cur_dts(s, st, ts);
-#endif
return 0;
}
@@ -1794,7 +1686,8 @@ static int seek_frame_generic(AVFormatContext *s,
return 0;
}
-int av_seek_frame(AVFormatContext *s, int stream_index, int64_t timestamp, int flags)
+static int seek_frame_internal(AVFormatContext *s, int stream_index,
+ int64_t timestamp, int flags)
{
int ret;
AVStream *st;
@@ -1837,14 +1730,29 @@ int av_seek_frame(AVFormatContext *s, int stream_index, int64_t timestamp, int f
return -1;
}
+int av_seek_frame(AVFormatContext *s, int stream_index, int64_t timestamp, int flags)
+{
+ int ret = seek_frame_internal(s, stream_index, timestamp, flags);
+
+ if (ret >= 0)
+ queue_attached_pictures(s);
+
+ return ret;
+}
+
int avformat_seek_file(AVFormatContext *s, int stream_index, int64_t min_ts, int64_t ts, int64_t max_ts, int flags)
{
if(min_ts > ts || max_ts < ts)
return -1;
if (s->iformat->read_seek2) {
+ int ret;
ff_read_frame_flush(s);
- return s->iformat->read_seek2(s, stream_index, min_ts, ts, max_ts, flags);
+ ret = s->iformat->read_seek2(s, stream_index, min_ts, ts, max_ts, flags);
+
+ if (ret >= 0)
+ queue_attached_pictures(s);
+ return ret;
}
if(s->iformat->read_timestamp){
@@ -1876,6 +1784,8 @@ static int has_duration(AVFormatContext *ic)
if (st->duration != AV_NOPTS_VALUE)
return 1;
}
+ if (ic->duration != AV_NOPTS_VALUE)
+ return 1;
return 0;
}
@@ -1987,8 +1897,6 @@ static void estimate_timings_from_pts(AVFormatContext *ic, int64_t old_offset)
int64_t filesize, offset, duration;
int retry=0;
- ic->cur_st = NULL;
-
/* flush packet queue */
flush_packet_queue(ic);
@@ -2000,7 +1908,6 @@ static void estimate_timings_from_pts(AVFormatContext *ic, int64_t old_offset)
if (st->parser) {
av_parser_close(st->parser);
st->parser= NULL;
- av_free_packet(&st->cur_pkt);
}
}
@@ -2020,7 +1927,7 @@ static void estimate_timings_from_pts(AVFormatContext *ic, int64_t old_offset)
break;
do {
- ret = av_read_packet(ic, pkt);
+ ret = ff_read_packet(ic, pkt);
} while(ret == AVERROR(EAGAIN));
if (ret != 0)
break;
@@ -2102,53 +2009,56 @@ static void estimate_timings(AVFormatContext *ic, int64_t old_offset)
}
}
-static int has_codec_parameters(AVCodecContext *avctx)
+static int has_codec_parameters(AVStream *st)
{
+ AVCodecContext *avctx = st->codec;
int val;
switch (avctx->codec_type) {
case AVMEDIA_TYPE_AUDIO:
- val = avctx->sample_rate && avctx->channels && avctx->sample_fmt != AV_SAMPLE_FMT_NONE;
- if (!avctx->frame_size &&
- (avctx->codec_id == CODEC_ID_VORBIS ||
- avctx->codec_id == CODEC_ID_AAC ||
- avctx->codec_id == CODEC_ID_MP1 ||
- avctx->codec_id == CODEC_ID_MP2 ||
- avctx->codec_id == CODEC_ID_MP3 ||
- avctx->codec_id == CODEC_ID_CELT))
+ val = avctx->sample_rate && avctx->channels;
+ if (st->info->found_decoder >= 0 && avctx->sample_fmt == AV_SAMPLE_FMT_NONE)
return 0;
break;
case AVMEDIA_TYPE_VIDEO:
- val = avctx->width && avctx->pix_fmt != PIX_FMT_NONE;
+ val = avctx->width;
+ if (st->info->found_decoder >= 0 && avctx->pix_fmt == AV_PIX_FMT_NONE)
+ return 0;
break;
default:
val = 1;
break;
}
- return avctx->codec_id != CODEC_ID_NONE && val != 0;
+ return avctx->codec_id != AV_CODEC_ID_NONE && val != 0;
}
static int has_decode_delay_been_guessed(AVStream *st)
{
- return st->codec->codec_id != CODEC_ID_H264 ||
+ return st->codec->codec_id != AV_CODEC_ID_H264 ||
st->info->nb_decoded_frames >= 6;
}
/* returns 1 or 0 if or if not decoded data was returned, or a negative error */
static int try_decode_frame(AVStream *st, AVPacket *avpkt, AVDictionary **options)
{
- AVCodec *codec;
+ const AVCodec *codec;
int got_picture = 1, ret = 0;
- AVFrame picture;
+ AVFrame *frame = avcodec_alloc_frame();
AVPacket pkt = *avpkt;
- if (!avcodec_is_open(st->codec)) {
+ if (!frame)
+ return AVERROR(ENOMEM);
+
+ if (!avcodec_is_open(st->codec) && !st->info->found_decoder) {
AVDictionary *thread_opt = NULL;
codec = st->codec->codec ? st->codec->codec :
avcodec_find_decoder(st->codec->codec_id);
- if (!codec)
- return -1;
+ if (!codec) {
+ st->info->found_decoder = -1;
+ ret = -1;
+ goto fail;
+ }
/* force thread count to 1 since the h264 decoder will not extract SPS
* and PPS to extradata during multi-threaded decoding */
@@ -2156,24 +2066,33 @@ static int try_decode_frame(AVStream *st, AVPacket *avpkt, AVDictionary **option
ret = avcodec_open2(st->codec, codec, options ? options : &thread_opt);
if (!options)
av_dict_free(&thread_opt);
- if (ret < 0)
- return ret;
+ if (ret < 0) {
+ st->info->found_decoder = -1;
+ goto fail;
+ }
+ st->info->found_decoder = 1;
+ } else if (!st->info->found_decoder)
+ st->info->found_decoder = 1;
+
+ if (st->info->found_decoder < 0) {
+ ret = -1;
+ goto fail;
}
while ((pkt.size > 0 || (!pkt.data && got_picture)) &&
ret >= 0 &&
- (!has_codec_parameters(st->codec) ||
+ (!has_codec_parameters(st) ||
!has_decode_delay_been_guessed(st) ||
(!st->codec_info_nb_frames && st->codec->codec->capabilities & CODEC_CAP_CHANNEL_CONF))) {
got_picture = 0;
- avcodec_get_frame_defaults(&picture);
+ avcodec_get_frame_defaults(frame);
switch(st->codec->codec_type) {
case AVMEDIA_TYPE_VIDEO:
- ret = avcodec_decode_video2(st->codec, &picture,
+ ret = avcodec_decode_video2(st->codec, frame,
&got_picture, &pkt);
break;
case AVMEDIA_TYPE_AUDIO:
- ret = avcodec_decode_audio4(st->codec, &picture, &got_picture, &pkt);
+ ret = avcodec_decode_audio4(st->codec, frame, &got_picture, &pkt);
break;
default:
break;
@@ -2186,12 +2105,15 @@ static int try_decode_frame(AVStream *st, AVPacket *avpkt, AVDictionary **option
ret = got_picture;
}
}
+
+fail:
+ avcodec_free_frame(&frame);
return ret;
}
-unsigned int ff_codec_get_tag(const AVCodecTag *tags, enum CodecID id)
+unsigned int ff_codec_get_tag(const AVCodecTag *tags, enum AVCodecID id)
{
- while (tags->id != CODEC_ID_NONE) {
+ while (tags->id != AV_CODEC_ID_NONE) {
if (tags->id == id)
return tags->tag;
tags++;
@@ -2199,21 +2121,51 @@ unsigned int ff_codec_get_tag(const AVCodecTag *tags, enum CodecID id)
return 0;
}
-enum CodecID ff_codec_get_id(const AVCodecTag *tags, unsigned int tag)
+enum AVCodecID ff_codec_get_id(const AVCodecTag *tags, unsigned int tag)
{
int i;
- for(i=0; tags[i].id != CODEC_ID_NONE;i++) {
+ for(i=0; tags[i].id != AV_CODEC_ID_NONE;i++) {
if(tag == tags[i].tag)
return tags[i].id;
}
- for(i=0; tags[i].id != CODEC_ID_NONE; i++) {
+ for(i=0; tags[i].id != AV_CODEC_ID_NONE; i++) {
if (avpriv_toupper4(tag) == avpriv_toupper4(tags[i].tag))
return tags[i].id;
}
- return CODEC_ID_NONE;
+ return AV_CODEC_ID_NONE;
}
-unsigned int av_codec_get_tag(const AVCodecTag * const *tags, enum CodecID id)
+enum AVCodecID ff_get_pcm_codec_id(int bps, int flt, int be, int sflags)
+{
+ if (flt) {
+ switch (bps) {
+ case 32: return be ? AV_CODEC_ID_PCM_F32BE : AV_CODEC_ID_PCM_F32LE;
+ case 64: return be ? AV_CODEC_ID_PCM_F64BE : AV_CODEC_ID_PCM_F64LE;
+ default: return AV_CODEC_ID_NONE;
+ }
+ } else {
+ bps >>= 3;
+ if (sflags & (1 << (bps - 1))) {
+ switch (bps) {
+ case 1: return AV_CODEC_ID_PCM_S8;
+ case 2: return be ? AV_CODEC_ID_PCM_S16BE : AV_CODEC_ID_PCM_S16LE;
+ case 3: return be ? AV_CODEC_ID_PCM_S24BE : AV_CODEC_ID_PCM_S24LE;
+ case 4: return be ? AV_CODEC_ID_PCM_S32BE : AV_CODEC_ID_PCM_S32LE;
+ default: return AV_CODEC_ID_NONE;
+ }
+ } else {
+ switch (bps) {
+ case 1: return AV_CODEC_ID_PCM_U8;
+ case 2: return be ? AV_CODEC_ID_PCM_U16BE : AV_CODEC_ID_PCM_U16LE;
+ case 3: return be ? AV_CODEC_ID_PCM_U24BE : AV_CODEC_ID_PCM_U24LE;
+ case 4: return be ? AV_CODEC_ID_PCM_U32BE : AV_CODEC_ID_PCM_U32LE;
+ default: return AV_CODEC_ID_NONE;
+ }
+ }
+ }
+}
+
+unsigned int av_codec_get_tag(const AVCodecTag * const *tags, enum AVCodecID id)
{
int i;
for(i=0; tags && tags[i]; i++){
@@ -2223,14 +2175,14 @@ unsigned int av_codec_get_tag(const AVCodecTag * const *tags, enum CodecID id)
return 0;
}
-enum CodecID av_codec_get_id(const AVCodecTag * const *tags, unsigned int tag)
+enum AVCodecID av_codec_get_id(const AVCodecTag * const *tags, unsigned int tag)
{
int i;
for(i=0; tags && tags[i]; i++){
- enum CodecID id= ff_codec_get_id(tags[i], tag);
- if(id!=CODEC_ID_NONE) return id;
+ enum AVCodecID id= ff_codec_get_id(tags[i], tag);
+ if(id!=AV_CODEC_ID_NONE) return id;
}
- return CODEC_ID_NONE;
+ return AV_CODEC_ID_NONE;
}
static void compute_chapters_end(AVFormatContext *s)
@@ -2272,20 +2224,13 @@ static int tb_unreliable(AVCodecContext *c){
|| c->time_base.den < 5L*c->time_base.num
/* || c->codec_tag == AV_RL32("DIVX")
|| c->codec_tag == AV_RL32("XVID")*/
- || c->codec_id == CODEC_ID_MPEG2VIDEO
- || c->codec_id == CODEC_ID_H264
+ || c->codec_id == AV_CODEC_ID_MPEG2VIDEO
+ || c->codec_id == AV_CODEC_ID_H264
)
return 1;
return 0;
}
-#if FF_API_FORMAT_PARAMETERS
-int av_find_stream_info(AVFormatContext *ic)
-{
- return avformat_find_stream_info(ic, NULL);
-}
-#endif
-
int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
{
int i, count, ret, read_size, j;
@@ -2295,17 +2240,10 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
int orig_nb_streams = ic->nb_streams; // new streams might appear, no options for those
for(i=0;i<ic->nb_streams;i++) {
- AVCodec *codec;
+ const AVCodec *codec;
AVDictionary *thread_opt = NULL;
st = ic->streams[i];
- if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO ||
- st->codec->codec_type == AVMEDIA_TYPE_SUBTITLE) {
-/* if(!st->time_base.num)
- st->time_base= */
- if(!st->codec->time_base.num)
- st->codec->time_base= st->time_base;
- }
//only for the split stuff
if (!st->parser && !(ic->flags & AVFMT_FLAG_NOPARSE)) {
st->parser = av_parser_init(st->codec->codec_id);
@@ -2327,7 +2265,7 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
: &thread_opt);
//try to just open decoders, in case this is enough to get parameters
- if(!has_codec_parameters(st->codec)){
+ if (!has_codec_parameters(st)) {
if (codec && !st->codec->codec)
avcodec_open2(st->codec, codec, options ? &options[i]
: &thread_opt);
@@ -2337,7 +2275,11 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
}
for (i=0; i<ic->nb_streams; i++) {
+#if FF_API_R_FRAME_RATE
ic->streams[i]->info->last_dts = AV_NOPTS_VALUE;
+#endif
+ ic->streams[i]->info->fps_first_dts = AV_NOPTS_VALUE;
+ ic->streams[i]->info->fps_last_dts = AV_NOPTS_VALUE;
}
count = 0;
@@ -2354,7 +2296,7 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
int fps_analyze_framecount = 20;
st = ic->streams[i];
- if (!has_codec_parameters(st->codec))
+ if (!has_codec_parameters(st))
break;
/* if the timebase is coarse (like the usual millisecond precision
of mkv), we need to analyze more frames to reliably arrive at
@@ -2364,13 +2306,15 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
if (ic->fps_probe_size >= 0)
fps_analyze_framecount = ic->fps_probe_size;
/* variable fps and no guess at the real fps */
- if( tb_unreliable(st->codec) && !(st->r_frame_rate.num && st->avg_frame_rate.num)
- && st->info->duration_count < fps_analyze_framecount
+ if( tb_unreliable(st->codec) && !st->avg_frame_rate.num
+ && st->codec_info_nb_frames < fps_analyze_framecount
&& st->codec->codec_type == AVMEDIA_TYPE_VIDEO)
break;
if(st->parser && st->parser->parser->split && !st->codec->extradata)
break;
- if(st->first_dts == AV_NOPTS_VALUE)
+ if (st->first_dts == AV_NOPTS_VALUE &&
+ (st->codec->codec_type == AVMEDIA_TYPE_VIDEO ||
+ st->codec->codec_type == AVMEDIA_TYPE_AUDIO))
break;
}
if (i == ic->nb_streams) {
@@ -2400,7 +2344,7 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
if (ret < 0) {
/* EOF or error*/
AVPacket empty_pkt = { 0 };
- int err;
+ int err = 0;
av_init_packet(&empty_pkt);
ret = -1; /* we could not have all the codec parameters before EOF */
@@ -2408,16 +2352,18 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
st = ic->streams[i];
/* flush the decoders */
- do {
- err = try_decode_frame(st, &empty_pkt,
- (options && i < orig_nb_streams) ?
- &options[i] : NULL);
- } while (err > 0 && !has_codec_parameters(st->codec));
+ if (st->info->found_decoder == 1) {
+ do {
+ err = try_decode_frame(st, &empty_pkt,
+ (options && i < orig_nb_streams) ?
+ &options[i] : NULL);
+ } while (err > 0 && !has_codec_parameters(st));
+ }
if (err < 0) {
av_log(ic, AV_LOG_WARNING,
"decoding for stream %d failed\n", st->index);
- } else if (!has_codec_parameters(st->codec)){
+ } else if (!has_codec_parameters(st)) {
char buf[256];
avcodec_string(buf, sizeof(buf), st->codec, 0);
av_log(ic, AV_LOG_WARNING,
@@ -2429,20 +2375,58 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
break;
}
- pkt= add_to_pktbuf(&ic->packet_buffer, &pkt1, &ic->packet_buffer_end);
- if ((ret = av_dup_packet(pkt)) < 0)
- goto find_stream_info_err;
+ if (ic->flags & AVFMT_FLAG_NOBUFFER) {
+ pkt = &pkt1;
+ } else {
+ pkt = add_to_pktbuf(&ic->packet_buffer, &pkt1,
+ &ic->packet_buffer_end);
+ if ((ret = av_dup_packet(pkt)) < 0)
+ goto find_stream_info_err;
+ }
read_size += pkt->size;
st = ic->streams[pkt->stream_index];
- if (st->codec_info_nb_frames>1) {
- if (st->time_base.den > 0 && av_rescale_q(st->info->codec_info_duration, st->time_base, AV_TIME_BASE_Q) >= ic->max_analyze_duration) {
+ if (pkt->dts != AV_NOPTS_VALUE && st->codec_info_nb_frames > 1) {
+ /* check for non-increasing dts */
+ if (st->info->fps_last_dts != AV_NOPTS_VALUE &&
+ st->info->fps_last_dts >= pkt->dts) {
+ av_log(ic, AV_LOG_WARNING, "Non-increasing DTS in stream %d: "
+ "packet %d with DTS %"PRId64", packet %d with DTS "
+ "%"PRId64"\n", st->index, st->info->fps_last_dts_idx,
+ st->info->fps_last_dts, st->codec_info_nb_frames, pkt->dts);
+ st->info->fps_first_dts = st->info->fps_last_dts = AV_NOPTS_VALUE;
+ }
+ /* check for a discontinuity in dts - if the difference in dts
+ * is more than 1000 times the average packet duration in the sequence,
+ * we treat it as a discontinuity */
+ if (st->info->fps_last_dts != AV_NOPTS_VALUE &&
+ st->info->fps_last_dts_idx > st->info->fps_first_dts_idx &&
+ (pkt->dts - st->info->fps_last_dts) / 1000 >
+ (st->info->fps_last_dts - st->info->fps_first_dts) / (st->info->fps_last_dts_idx - st->info->fps_first_dts_idx)) {
+ av_log(ic, AV_LOG_WARNING, "DTS discontinuity in stream %d: "
+ "packet %d with DTS %"PRId64", packet %d with DTS "
+ "%"PRId64"\n", st->index, st->info->fps_last_dts_idx,
+ st->info->fps_last_dts, st->codec_info_nb_frames, pkt->dts);
+ st->info->fps_first_dts = st->info->fps_last_dts = AV_NOPTS_VALUE;
+ }
+
+ /* update stored dts values */
+ if (st->info->fps_first_dts == AV_NOPTS_VALUE) {
+ st->info->fps_first_dts = pkt->dts;
+ st->info->fps_first_dts_idx = st->codec_info_nb_frames;
+ }
+ st->info->fps_last_dts = pkt->dts;
+ st->info->fps_last_dts_idx = st->codec_info_nb_frames;
+
+ /* check max_analyze_duration */
+ if (av_rescale_q(pkt->dts - st->info->fps_first_dts, st->time_base,
+ AV_TIME_BASE_Q) >= ic->max_analyze_duration) {
av_log(ic, AV_LOG_WARNING, "max_analyze_duration reached\n");
break;
}
- st->info->codec_info_duration += pkt->duration;
}
+#if FF_API_R_FRAME_RATE
{
int64_t last = st->info->last_dts;
@@ -2450,8 +2434,6 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
int64_t duration= pkt->dts - last;
double dur= duration * av_q2d(st->time_base);
-// if(st->codec->codec_type == AVMEDIA_TYPE_VIDEO)
-// av_log(NULL, AV_LOG_ERROR, "%f\n", dur);
if (st->info->duration_count < 2)
memset(st->info->duration_error, 0, sizeof(st->info->duration_error));
for (i=1; i<FF_ARRAY_ELEMS(st->info->duration_error); i++) {
@@ -2468,6 +2450,7 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
if (last == AV_NOPTS_VALUE || st->info->duration_count <= 1)
st->info->last_dts = pkt->dts;
}
+#endif
if(st->parser && st->parser->parser->split && !st->codec->extradata){
int i= st->parser->parser->split(st->codec, pkt->data, pkt->size);
if (i > 0 && i < FF_MAX_EXTRADATA_SIZE) {
@@ -2502,28 +2485,48 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
}
for(i=0;i<ic->nb_streams;i++) {
st = ic->streams[i];
- if (st->codec_info_nb_frames>2 && !st->avg_frame_rate.num && st->info->codec_info_duration)
- av_reduce(&st->avg_frame_rate.num, &st->avg_frame_rate.den,
- (st->codec_info_nb_frames-2)*(int64_t)st->time_base.den,
- st->info->codec_info_duration*(int64_t)st->time_base.num, 60000);
if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
+ /* estimate average framerate if not set by demuxer */
+ if (!st->avg_frame_rate.num && st->info->fps_last_dts != st->info->fps_first_dts) {
+ int64_t delta_dts = st->info->fps_last_dts - st->info->fps_first_dts;
+ int delta_packets = st->info->fps_last_dts_idx - st->info->fps_first_dts_idx;
+ int best_fps = 0;
+ double best_error = 0.01;
+
+ av_reduce(&st->avg_frame_rate.num, &st->avg_frame_rate.den,
+ delta_packets*(int64_t)st->time_base.den,
+ delta_dts*(int64_t)st->time_base.num, 60000);
+
+ /* round guessed framerate to a "standard" framerate if it's
+ * within 1% of the original estimate*/
+ for (j = 1; j < MAX_STD_TIMEBASES; j++) {
+ AVRational std_fps = { get_std_framerate(j), 12*1001 };
+ double error = fabs(av_q2d(st->avg_frame_rate) / av_q2d(std_fps) - 1);
+
+ if (error < best_error) {
+ best_error = error;
+ best_fps = std_fps.num;
+ }
+ }
+ if (best_fps) {
+ av_reduce(&st->avg_frame_rate.num, &st->avg_frame_rate.den,
+ best_fps, 12*1001, INT_MAX);
+ }
+ }
+#if FF_API_R_FRAME_RATE
// the check for tb_unreliable() is not completely correct, since this is not about handling
// a unreliable/inexact time base, but a time base that is finer than necessary, as e.g.
// ipmovie.c produces.
if (tb_unreliable(st->codec) && st->info->duration_count > 15 && st->info->duration_gcd > 1 && !st->r_frame_rate.num)
av_reduce(&st->r_frame_rate.num, &st->r_frame_rate.den, st->time_base.den, st->time_base.num * st->info->duration_gcd, INT_MAX);
if (st->info->duration_count && !st->r_frame_rate.num
- && tb_unreliable(st->codec) /*&&
- //FIXME we should not special-case MPEG-2, but this needs testing with non-MPEG-2 ...
- st->time_base.num*duration_sum[i]/st->info->duration_count*101LL > st->time_base.den*/){
+ && tb_unreliable(st->codec)) {
int num = 0;
double best_error= 2*av_q2d(st->time_base);
best_error = best_error*best_error*st->info->duration_count*1000*12*30;
for (j=1; j<FF_ARRAY_ELEMS(st->info->duration_error); j++) {
double error = st->info->duration_error[j] * get_std_framerate(j);
-// if(st->codec->codec_type == AVMEDIA_TYPE_VIDEO)
-// av_log(NULL, AV_LOG_ERROR, "%f %f\n", get_std_framerate(j) / 12.0/1001, error);
if(error < best_error){
best_error= error;
num = get_std_framerate(j);
@@ -2533,17 +2536,7 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
if (num && (!st->r_frame_rate.num || (double)num/(12*1001) < 1.01 * av_q2d(st->r_frame_rate)))
av_reduce(&st->r_frame_rate.num, &st->r_frame_rate.den, num, 12*1001, INT_MAX);
}
-
- if (!st->r_frame_rate.num){
- if( st->codec->time_base.den * (int64_t)st->time_base.num
- <= st->codec->time_base.num * st->codec->ticks_per_frame * (int64_t)st->time_base.den){
- st->r_frame_rate.num = st->codec->time_base.den;
- st->r_frame_rate.den = st->codec->time_base.num * st->codec->ticks_per_frame;
- }else{
- st->r_frame_rate.num = st->time_base.den;
- st->r_frame_rate.den = st->time_base.num;
- }
- }
+#endif
}else if(st->codec->codec_type == AVMEDIA_TYPE_AUDIO) {
if(!st->codec->bits_per_coded_sample)
st->codec->bits_per_coded_sample= av_get_bits_per_sample(st->codec->codec_id);
@@ -2567,31 +2560,6 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
compute_chapters_end(ic);
-#if 0
- /* correct DTS for B-frame streams with no timestamps */
- for(i=0;i<ic->nb_streams;i++) {
- st = ic->streams[i];
- if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
- if(b-frames){
- ppktl = &ic->packet_buffer;
- while(ppkt1){
- if(ppkt1->stream_index != i)
- continue;
- if(ppkt1->pkt->dts < 0)
- break;
- if(ppkt1->pkt->pts != AV_NOPTS_VALUE)
- break;
- ppkt1->pkt->dts -= delta;
- ppkt1= ppkt1->next;
- }
- if(ppkt1)
- continue;
- st->cur_dts -= delta;
- }
- }
- }
-#endif
-
find_stream_info_err:
for (i=0; i < ic->nb_streams; i++) {
if (ic->streams[i]->codec)
@@ -2685,16 +2653,6 @@ int av_read_pause(AVFormatContext *s)
return AVERROR(ENOSYS);
}
-#if FF_API_FORMAT_PARAMETERS
-void av_close_input_stream(AVFormatContext *s)
-{
- flush_packet_queue(s);
- if (s->iformat->read_close)
- s->iformat->read_close(s);
- avformat_free_context(s);
-}
-#endif
-
void avformat_free_context(AVFormatContext *s)
{
int i;
@@ -2709,8 +2667,9 @@ void avformat_free_context(AVFormatContext *s)
st = s->streams[i];
if (st->parser) {
av_parser_close(st->parser);
- av_free_packet(&st->cur_pkt);
}
+ if (st->attached_pic.data)
+ av_free_packet(&st->attached_pic);
av_dict_free(&st->metadata);
av_freep(&st->probe_data.buf);
av_free(st->index_entries);
@@ -2748,26 +2707,25 @@ void av_close_input_file(AVFormatContext *s)
void avformat_close_input(AVFormatContext **ps)
{
AVFormatContext *s = *ps;
- AVIOContext *pb = (s->iformat->flags & AVFMT_NOFILE) || (s->flags & AVFMT_FLAG_CUSTOM_IO) ?
- NULL : s->pb;
+ AVIOContext *pb = s->pb;
+
+ if ((s->iformat && s->iformat->flags & AVFMT_NOFILE) ||
+ (s->flags & AVFMT_FLAG_CUSTOM_IO))
+ pb = NULL;
+
flush_packet_queue(s);
- if (s->iformat->read_close)
- s->iformat->read_close(s);
+
+ if (s->iformat) {
+ if (s->iformat->read_close)
+ s->iformat->read_close(s);
+ }
+
avformat_free_context(s);
+
*ps = NULL;
- if (pb)
- avio_close(pb);
-}
-#if FF_API_NEW_STREAM
-AVStream *av_new_stream(AVFormatContext *s, int id)
-{
- AVStream *st = avformat_new_stream(s, NULL);
- if (st)
- st->id = id;
- return st;
+ avio_close(pb);
}
-#endif
AVStream *avformat_new_stream(AVFormatContext *s, AVCodec *c)
{
@@ -2815,6 +2773,12 @@ AVStream *avformat_new_stream(AVFormatContext *s, AVCodec *c)
st->sample_aspect_ratio = (AVRational){0,1};
+#if FF_API_R_FRAME_RATE
+ st->info->last_dts = AV_NOPTS_VALUE;
+#endif
+ st->info->fps_first_dts = AV_NOPTS_VALUE;
+ st->info->fps_last_dts = AV_NOPTS_VALUE;
+
s->streams[s->nb_streams++] = st;
return st;
}
@@ -2866,464 +2830,6 @@ AVChapter *avpriv_new_chapter(AVFormatContext *s, int id, AVRational time_base,
return chapter;
}
-/************************************************************/
-/* output media file */
-
-#if FF_API_FORMAT_PARAMETERS
-int av_set_parameters(AVFormatContext *s, AVFormatParameters *ap)
-{
- int ret;
-
- if (s->oformat->priv_data_size > 0) {
- s->priv_data = av_mallocz(s->oformat->priv_data_size);
- if (!s->priv_data)
- return AVERROR(ENOMEM);
- if (s->oformat->priv_class) {
- *(const AVClass**)s->priv_data= s->oformat->priv_class;
- av_opt_set_defaults(s->priv_data);
- }
- } else
- s->priv_data = NULL;
-
- if (s->oformat->set_parameters) {
- ret = s->oformat->set_parameters(s, ap);
- if (ret < 0)
- return ret;
- }
- return 0;
-}
-#endif
-
-static int validate_codec_tag(AVFormatContext *s, AVStream *st)
-{
- const AVCodecTag *avctag;
- int n;
- enum CodecID id = CODEC_ID_NONE;
- unsigned int tag = 0;
-
- /**
- * Check that tag + id is in the table
- * If neither is in the table -> OK
- * If tag is in the table with another id -> FAIL
- * If id is in the table with another tag -> FAIL unless strict < normal
- */
- for (n = 0; s->oformat->codec_tag[n]; n++) {
- avctag = s->oformat->codec_tag[n];
- while (avctag->id != CODEC_ID_NONE) {
- if (avpriv_toupper4(avctag->tag) == avpriv_toupper4(st->codec->codec_tag)) {
- id = avctag->id;
- if (id == st->codec->codec_id)
- return 1;
- }
- if (avctag->id == st->codec->codec_id)
- tag = avctag->tag;
- avctag++;
- }
- }
- if (id != CODEC_ID_NONE)
- return 0;
- if (tag && (st->codec->strict_std_compliance >= FF_COMPLIANCE_NORMAL))
- return 0;
- return 1;
-}
-
-#if FF_API_FORMAT_PARAMETERS
-int av_write_header(AVFormatContext *s)
-{
- return avformat_write_header(s, NULL);
-}
-#endif
-
-int avformat_write_header(AVFormatContext *s, AVDictionary **options)
-{
- int ret = 0, i;
- AVStream *st;
- AVDictionary *tmp = NULL;
-
- if (options)
- av_dict_copy(&tmp, *options, 0);
- if ((ret = av_opt_set_dict(s, &tmp)) < 0)
- goto fail;
-
- // some sanity checks
- if (s->nb_streams == 0 && !(s->oformat->flags & AVFMT_NOSTREAMS)) {
- av_log(s, AV_LOG_ERROR, "no streams\n");
- ret = AVERROR(EINVAL);
- goto fail;
- }
-
- for(i=0;i<s->nb_streams;i++) {
- st = s->streams[i];
-
- switch (st->codec->codec_type) {
- case AVMEDIA_TYPE_AUDIO:
- if(st->codec->sample_rate<=0){
- av_log(s, AV_LOG_ERROR, "sample rate not set\n");
- ret = AVERROR(EINVAL);
- goto fail;
- }
- if(!st->codec->block_align)
- st->codec->block_align = st->codec->channels *
- av_get_bits_per_sample(st->codec->codec_id) >> 3;
- break;
- case AVMEDIA_TYPE_VIDEO:
- if(st->codec->time_base.num<=0 || st->codec->time_base.den<=0){ //FIXME audio too?
- av_log(s, AV_LOG_ERROR, "time base not set\n");
- ret = AVERROR(EINVAL);
- goto fail;
- }
- if((st->codec->width<=0 || st->codec->height<=0) && !(s->oformat->flags & AVFMT_NODIMENSIONS)){
- av_log(s, AV_LOG_ERROR, "dimensions not set\n");
- ret = AVERROR(EINVAL);
- goto fail;
- }
- if(av_cmp_q(st->sample_aspect_ratio, st->codec->sample_aspect_ratio)){
- av_log(s, AV_LOG_ERROR, "Aspect ratio mismatch between encoder and muxer layer\n");
- ret = AVERROR(EINVAL);
- goto fail;
- }
- break;
- }
-
- if(s->oformat->codec_tag){
- if(st->codec->codec_tag && st->codec->codec_id == CODEC_ID_RAWVIDEO && av_codec_get_tag(s->oformat->codec_tag, st->codec->codec_id) == 0 && !validate_codec_tag(s, st)){
- //the current rawvideo encoding system ends up setting the wrong codec_tag for avi, we override it here
- st->codec->codec_tag= 0;
- }
- if(st->codec->codec_tag){
- if (!validate_codec_tag(s, st)) {
- char tagbuf[32];
- av_get_codec_tag_string(tagbuf, sizeof(tagbuf), st->codec->codec_tag);
- av_log(s, AV_LOG_ERROR,
- "Tag %s/0x%08x incompatible with output codec id '%d'\n",
- tagbuf, st->codec->codec_tag, st->codec->codec_id);
- ret = AVERROR_INVALIDDATA;
- goto fail;
- }
- }else
- st->codec->codec_tag= av_codec_get_tag(s->oformat->codec_tag, st->codec->codec_id);
- }
-
- if(s->oformat->flags & AVFMT_GLOBALHEADER &&
- !(st->codec->flags & CODEC_FLAG_GLOBAL_HEADER))
- av_log(s, AV_LOG_WARNING, "Codec for stream %d does not use global headers but container format requires global headers\n", i);
- }
-
- if (!s->priv_data && s->oformat->priv_data_size > 0) {
- s->priv_data = av_mallocz(s->oformat->priv_data_size);
- if (!s->priv_data) {
- ret = AVERROR(ENOMEM);
- goto fail;
- }
- if (s->oformat->priv_class) {
- *(const AVClass**)s->priv_data= s->oformat->priv_class;
- av_opt_set_defaults(s->priv_data);
- if ((ret = av_opt_set_dict(s->priv_data, &tmp)) < 0)
- goto fail;
- }
- }
-
- /* set muxer identification string */
- if (s->nb_streams && !(s->streams[0]->codec->flags & CODEC_FLAG_BITEXACT)) {
- av_dict_set(&s->metadata, "encoder", LIBAVFORMAT_IDENT, 0);
- }
-
- if(s->oformat->write_header){
- ret = s->oformat->write_header(s);
- if (ret < 0)
- goto fail;
- }
-
- /* init PTS generation */
- for(i=0;i<s->nb_streams;i++) {
- int64_t den = AV_NOPTS_VALUE;
- st = s->streams[i];
-
- switch (st->codec->codec_type) {
- case AVMEDIA_TYPE_AUDIO:
- den = (int64_t)st->time_base.num * st->codec->sample_rate;
- break;
- case AVMEDIA_TYPE_VIDEO:
- den = (int64_t)st->time_base.num * st->codec->time_base.den;
- break;
- default:
- break;
- }
- if (den != AV_NOPTS_VALUE) {
- if (den <= 0) {
- ret = AVERROR_INVALIDDATA;
- goto fail;
- }
- frac_init(&st->pts, 0, 0, den);
- }
- }
-
- if (options) {
- av_dict_free(options);
- *options = tmp;
- }
- return 0;
-fail:
- av_dict_free(&tmp);
- return ret;
-}
-
-//FIXME merge with compute_pkt_fields
-static int compute_pkt_fields2(AVFormatContext *s, AVStream *st, AVPacket *pkt){
- int delay = FFMAX(st->codec->has_b_frames, !!st->codec->max_b_frames);
- int num, den, frame_size, i;
-
- av_dlog(s, "compute_pkt_fields2: pts:%"PRId64" dts:%"PRId64" cur_dts:%"PRId64" b:%d size:%d st:%d\n",
- pkt->pts, pkt->dts, st->cur_dts, delay, pkt->size, pkt->stream_index);
-
-/* if(pkt->pts == AV_NOPTS_VALUE && pkt->dts == AV_NOPTS_VALUE)
- return AVERROR(EINVAL);*/
-
- /* duration field */
- if (pkt->duration == 0) {
- compute_frame_duration(&num, &den, st, NULL, pkt);
- if (den && num) {
- pkt->duration = av_rescale(1, num * (int64_t)st->time_base.den * st->codec->ticks_per_frame, den * (int64_t)st->time_base.num);
- }
- }
-
- if(pkt->pts == AV_NOPTS_VALUE && pkt->dts != AV_NOPTS_VALUE && delay==0)
- pkt->pts= pkt->dts;
-
- //XXX/FIXME this is a temporary hack until all encoders output pts
- if((pkt->pts == 0 || pkt->pts == AV_NOPTS_VALUE) && pkt->dts == AV_NOPTS_VALUE && !delay){
- pkt->dts=
-// pkt->pts= st->cur_dts;
- pkt->pts= st->pts.val;
- }
-
- //calculate dts from pts
- if(pkt->pts != AV_NOPTS_VALUE && pkt->dts == AV_NOPTS_VALUE && delay <= MAX_REORDER_DELAY){
- st->pts_buffer[0]= pkt->pts;
- for(i=1; i<delay+1 && st->pts_buffer[i] == AV_NOPTS_VALUE; i++)
- st->pts_buffer[i]= pkt->pts + (i-delay-1) * pkt->duration;
- for(i=0; i<delay && st->pts_buffer[i] > st->pts_buffer[i+1]; i++)
- FFSWAP(int64_t, st->pts_buffer[i], st->pts_buffer[i+1]);
-
- pkt->dts= st->pts_buffer[0];
- }
-
- if(st->cur_dts && st->cur_dts != AV_NOPTS_VALUE && st->cur_dts >= pkt->dts){
- av_log(s, AV_LOG_ERROR,
- "Application provided invalid, non monotonically increasing dts to muxer in stream %d: %"PRId64" >= %"PRId64"\n",
- st->index, st->cur_dts, pkt->dts);
- return AVERROR(EINVAL);
- }
- if(pkt->dts != AV_NOPTS_VALUE && pkt->pts != AV_NOPTS_VALUE && pkt->pts < pkt->dts){
- av_log(s, AV_LOG_ERROR, "pts < dts in stream %d\n", st->index);
- return AVERROR(EINVAL);
- }
-
-// av_log(s, AV_LOG_DEBUG, "av_write_frame: pts2:%"PRId64" dts2:%"PRId64"\n", pkt->pts, pkt->dts);
- st->cur_dts= pkt->dts;
- st->pts.val= pkt->dts;
-
- /* update pts */
- switch (st->codec->codec_type) {
- case AVMEDIA_TYPE_AUDIO:
- frame_size = get_audio_frame_size(st->codec, pkt->size);
-
- /* HACK/FIXME, we skip the initial 0 size packets as they are most
- likely equal to the encoder delay, but it would be better if we
- had the real timestamps from the encoder */
- if (frame_size >= 0 && (pkt->size || st->pts.num!=st->pts.den>>1 || st->pts.val)) {
- frac_add(&st->pts, (int64_t)st->time_base.den * frame_size);
- }
- break;
- case AVMEDIA_TYPE_VIDEO:
- frac_add(&st->pts, (int64_t)st->time_base.den * st->codec->time_base.num);
- break;
- default:
- break;
- }
- return 0;
-}
-
-int av_write_frame(AVFormatContext *s, AVPacket *pkt)
-{
- int ret = compute_pkt_fields2(s, s->streams[pkt->stream_index], pkt);
-
- if(ret<0 && !(s->oformat->flags & AVFMT_NOTIMESTAMPS))
- return ret;
-
- ret= s->oformat->write_packet(s, pkt);
-
- if (ret >= 0)
- s->streams[pkt->stream_index]->nb_frames++;
- return ret;
-}
-
-void ff_interleave_add_packet(AVFormatContext *s, AVPacket *pkt,
- int (*compare)(AVFormatContext *, AVPacket *, AVPacket *))
-{
- AVPacketList **next_point, *this_pktl;
-
- this_pktl = av_mallocz(sizeof(AVPacketList));
- this_pktl->pkt= *pkt;
- pkt->destruct= NULL; // do not free original but only the copy
- av_dup_packet(&this_pktl->pkt); // duplicate the packet if it uses non-alloced memory
-
- if(s->streams[pkt->stream_index]->last_in_packet_buffer){
- next_point = &(s->streams[pkt->stream_index]->last_in_packet_buffer->next);
- }else
- next_point = &s->packet_buffer;
-
- if(*next_point){
- if(compare(s, &s->packet_buffer_end->pkt, pkt)){
- while(!compare(s, &(*next_point)->pkt, pkt)){
- next_point= &(*next_point)->next;
- }
- goto next_non_null;
- }else{
- next_point = &(s->packet_buffer_end->next);
- }
- }
- assert(!*next_point);
-
- s->packet_buffer_end= this_pktl;
-next_non_null:
-
- this_pktl->next= *next_point;
-
- s->streams[pkt->stream_index]->last_in_packet_buffer=
- *next_point= this_pktl;
-}
-
-static int ff_interleave_compare_dts(AVFormatContext *s, AVPacket *next, AVPacket *pkt)
-{
- AVStream *st = s->streams[ pkt ->stream_index];
- AVStream *st2= s->streams[ next->stream_index];
- int comp = av_compare_ts(next->dts, st2->time_base, pkt->dts,
- st->time_base);
-
- if (comp == 0)
- return pkt->stream_index < next->stream_index;
- return comp > 0;
-}
-
-int av_interleave_packet_per_dts(AVFormatContext *s, AVPacket *out, AVPacket *pkt, int flush){
- AVPacketList *pktl;
- int stream_count=0;
- int i;
-
- if(pkt){
- ff_interleave_add_packet(s, pkt, ff_interleave_compare_dts);
- }
-
- for(i=0; i < s->nb_streams; i++)
- stream_count+= !!s->streams[i]->last_in_packet_buffer;
-
- if(stream_count && (s->nb_streams == stream_count || flush)){
- pktl= s->packet_buffer;
- *out= pktl->pkt;
-
- s->packet_buffer= pktl->next;
- if(!s->packet_buffer)
- s->packet_buffer_end= NULL;
-
- if(s->streams[out->stream_index]->last_in_packet_buffer == pktl)
- s->streams[out->stream_index]->last_in_packet_buffer= NULL;
- av_freep(&pktl);
- return 1;
- }else{
- av_init_packet(out);
- return 0;
- }
-}
-
-/**
- * Interleave an AVPacket correctly so it can be muxed.
- * @param out the interleaved packet will be output here
- * @param in the input packet
- * @param flush 1 if no further packets are available as input and all
- * remaining packets should be output
- * @return 1 if a packet was output, 0 if no packet could be output,
- * < 0 if an error occurred
- */
-static int interleave_packet(AVFormatContext *s, AVPacket *out, AVPacket *in, int flush){
- if (s->oformat->interleave_packet) {
- int ret = s->oformat->interleave_packet(s, out, in, flush);
- if (in)
- av_free_packet(in);
- return ret;
- } else
- return av_interleave_packet_per_dts(s, out, in, flush);
-}
-
-int av_interleaved_write_frame(AVFormatContext *s, AVPacket *pkt){
- AVStream *st= s->streams[ pkt->stream_index];
- int ret;
-
- //FIXME/XXX/HACK drop zero sized packets
- if(st->codec->codec_type == AVMEDIA_TYPE_AUDIO && pkt->size==0)
- return 0;
-
- av_dlog(s, "av_interleaved_write_frame size:%d dts:%"PRId64" pts:%"PRId64"\n",
- pkt->size, pkt->dts, pkt->pts);
- if((ret = compute_pkt_fields2(s, st, pkt)) < 0 && !(s->oformat->flags & AVFMT_NOTIMESTAMPS))
- return ret;
-
- if(pkt->dts == AV_NOPTS_VALUE && !(s->oformat->flags & AVFMT_NOTIMESTAMPS))
- return AVERROR(EINVAL);
-
- for(;;){
- AVPacket opkt;
- int ret= interleave_packet(s, &opkt, pkt, 0);
- if(ret<=0) //FIXME cleanup needed for ret<0 ?
- return ret;
-
- ret= s->oformat->write_packet(s, &opkt);
- if (ret >= 0)
- s->streams[opkt.stream_index]->nb_frames++;
-
- av_free_packet(&opkt);
- pkt= NULL;
-
- if(ret<0)
- return ret;
- }
-}
-
-int av_write_trailer(AVFormatContext *s)
-{
- int ret, i;
-
- for(;;){
- AVPacket pkt;
- ret= interleave_packet(s, &pkt, NULL, 1);
- if(ret<0) //FIXME cleanup needed for ret<0 ?
- goto fail;
- if(!ret)
- break;
-
- ret= s->oformat->write_packet(s, &pkt);
- if (ret >= 0)
- s->streams[pkt.stream_index]->nb_frames++;
-
- av_free_packet(&pkt);
-
- if(ret<0)
- goto fail;
- }
-
- if(s->oformat->write_trailer)
- ret = s->oformat->write_trailer(s);
-fail:
- for(i=0;i<s->nb_streams;i++) {
- av_freep(&s->streams[i]->priv_data);
- av_freep(&s->streams[i]->index_entries);
- }
- if (s->oformat->priv_class)
- av_opt_free(s->priv_data);
- av_freep(&s->priv_data);
- return ret;
-}
-
void ff_program_add_stream_index(AVFormatContext *ac, int progid, unsigned int idx)
{
int i, j;
@@ -3361,7 +2867,7 @@ static void print_fps(double d, const char *postfix){
static void dump_metadata(void *ctx, AVDictionary *m, const char *indent)
{
- if(m && !(m->count == 1 && av_dict_get(m, "language", NULL, 0))){
+ if(m && !(av_dict_count(m) == 1 && av_dict_get(m, "language", NULL, 0))){
AVDictionaryEntry *tag=NULL;
av_log(ctx, AV_LOG_INFO, "%sMetadata:\n", indent);
@@ -3404,8 +2910,10 @@ static void dump_stream_format(AVFormatContext *ic, int i, int index, int is_out
if(st->codec->codec_type == AVMEDIA_TYPE_VIDEO){
if(st->avg_frame_rate.den && st->avg_frame_rate.num)
print_fps(av_q2d(st->avg_frame_rate), "fps");
+#if FF_API_R_FRAME_RATE
if(st->r_frame_rate.den && st->r_frame_rate.num)
print_fps(av_q2d(st->r_frame_rate), "tbr");
+#endif
if(st->time_base.den && st->time_base.num)
print_fps(1/av_q2d(st->time_base), "tbn");
if(st->codec->time_base.den && st->codec->time_base.num)
@@ -3435,16 +2943,6 @@ static void dump_stream_format(AVFormatContext *ic, int i, int index, int is_out
dump_metadata(NULL, st->metadata, " ");
}
-#if FF_API_DUMP_FORMAT
-void dump_format(AVFormatContext *ic,
- int index,
- const char *url,
- int is_output)
-{
- av_dump_format(ic, index, url, is_output);
-}
-#endif
-
void av_dump_format(AVFormatContext *ic,
int index,
const char *url,
@@ -3524,38 +3022,18 @@ void av_dump_format(AVFormatContext *ic,
av_free(printed);
}
-int64_t av_gettime(void)
+#if FF_API_AV_GETTIME && CONFIG_SHARED && HAVE_SYMVER
+FF_SYMVER(int64_t, av_gettime, (void), "LIBAVFORMAT_54")
{
- struct timeval tv;
- gettimeofday(&tv,NULL);
- return (int64_t)tv.tv_sec * 1000000 + tv.tv_usec;
+ return av_gettime();
}
+#endif
uint64_t ff_ntp_time(void)
{
return (av_gettime() / 1000) * 1000 + NTP_OFFSET_US;
}
-#if FF_API_PARSE_DATE
-#include "libavutil/parseutils.h"
-
-int64_t parse_date(const char *timestr, int duration)
-{
- int64_t timeval;
- av_parse_time(&timeval, timestr, duration);
- return timeval;
-}
-#endif
-
-#if FF_API_FIND_INFO_TAG
-#include "libavutil/parseutils.h"
-
-int find_info_tag(char *arg, int arg_size, const char *tag1, const char *info)
-{
- return av_find_info_tag(arg, arg_size, tag1, info);
-}
-#endif
-
int av_get_frame_filename(char *buf, int buf_size,
const char *path, int number)
{
@@ -3611,10 +3089,10 @@ int av_get_frame_filename(char *buf, int buf_size,
return -1;
}
-static void hex_dump_internal(void *avcl, FILE *f, int level, uint8_t *buf, int size)
+static void hex_dump_internal(void *avcl, FILE *f, int level,
+ const uint8_t *buf, int size)
{
int len, i, j, c;
-#undef fprintf
#define PRINT(...) do { if (!f) av_log(avcl, level, __VA_ARGS__); else fprintf(f, __VA_ARGS__); } while(0)
for(i=0;i<size;i+=16) {
@@ -3640,19 +3118,18 @@ static void hex_dump_internal(void *avcl, FILE *f, int level, uint8_t *buf, int
#undef PRINT
}
-void av_hex_dump(FILE *f, uint8_t *buf, int size)
+void av_hex_dump(FILE *f, const uint8_t *buf, int size)
{
hex_dump_internal(NULL, f, 0, buf, size);
}
-void av_hex_dump_log(void *avcl, int level, uint8_t *buf, int size)
+void av_hex_dump_log(void *avcl, int level, const uint8_t *buf, int size)
{
hex_dump_internal(avcl, NULL, level, buf, size);
}
static void pkt_dump_internal(void *avcl, FILE *f, int level, AVPacket *pkt, int dump_payload, AVRational time_base)
{
-#undef fprintf
#define PRINT(...) do { if (!f) av_log(avcl, level, __VA_ARGS__); else fprintf(f, __VA_ARGS__); } while(0)
PRINT("stream #%d:\n", pkt->stream_index);
PRINT(" keyframe=%d\n", ((pkt->flags & AV_PKT_FLAG_KEY) != 0));
@@ -3676,27 +3153,11 @@ static void pkt_dump_internal(void *avcl, FILE *f, int level, AVPacket *pkt, int
av_hex_dump(f, pkt->data, pkt->size);
}
-#if FF_API_PKT_DUMP
-void av_pkt_dump(FILE *f, AVPacket *pkt, int dump_payload)
-{
- AVRational tb = { 1, AV_TIME_BASE };
- pkt_dump_internal(NULL, f, 0, pkt, dump_payload, tb);
-}
-#endif
-
void av_pkt_dump2(FILE *f, AVPacket *pkt, int dump_payload, AVStream *st)
{
pkt_dump_internal(NULL, f, 0, pkt, dump_payload, st->time_base);
}
-#if FF_API_PKT_DUMP
-void av_pkt_dump_log(void *avcl, int level, AVPacket *pkt, int dump_payload)
-{
- AVRational tb = { 1, AV_TIME_BASE };
- pkt_dump_internal(avcl, NULL, level, pkt, dump_payload, tb);
-}
-#endif
-
void av_pkt_dump_log2(void *avcl, int level, AVPacket *pkt, int dump_payload,
AVStream *st)
{
@@ -3813,14 +3274,6 @@ int ff_hex_to_data(uint8_t *data, const char *p)
return len;
}
-#if FF_API_SET_PTS_INFO
-void av_set_pts_info(AVStream *s, int pts_wrap_bits,
- unsigned int pts_num, unsigned int pts_den)
-{
- avpriv_set_pts_info(s, pts_wrap_bits, pts_num, pts_den);
-}
-#endif
-
void avpriv_set_pts_info(AVStream *s, int pts_wrap_bits,
unsigned int pts_num, unsigned int pts_den)
{
@@ -3844,7 +3297,7 @@ int ff_url_join(char *str, int size, const char *proto,
int port, const char *fmt, ...)
{
#if CONFIG_NETWORK
- struct addrinfo hints, *ai;
+ struct addrinfo hints = { 0 }, *ai;
#endif
str[0] = '\0';
@@ -3855,7 +3308,6 @@ int ff_url_join(char *str, int size, const char *proto,
#if CONFIG_NETWORK && defined(AF_INET6)
/* Determine if hostname is a numerical IPv6 address,
* properly escape it within [] in that case. */
- memset(&hints, 0, sizeof(hints));
hints.ai_flags = AI_NUMERICHOST;
if (!getaddrinfo(hostname, NULL, &hints, &ai)) {
if (ai->ai_family == AF_INET6) {
@@ -3969,17 +3421,23 @@ int ff_find_stream_index(AVFormatContext *s, int id)
void ff_make_absolute_url(char *buf, int size, const char *base,
const char *rel)
{
- char *sep;
+ char *sep, *path_query;
/* Absolute path, relative to the current server */
if (base && strstr(base, "://") && rel[0] == '/') {
if (base != buf)
av_strlcpy(buf, base, size);
sep = strstr(buf, "://");
if (sep) {
- sep += 3;
- sep = strchr(sep, '/');
- if (sep)
- *sep = '\0';
+ /* Take scheme from base url */
+ if (rel[1] == '/') {
+ sep[1] = '\0';
+ } else {
+ /* Take scheme and host from base url */
+ sep += 3;
+ sep = strchr(sep, '/');
+ if (sep)
+ *sep = '\0';
+ }
}
av_strlcat(buf, rel, size);
return;
@@ -3991,6 +3449,18 @@ void ff_make_absolute_url(char *buf, int size, const char *base,
}
if (base != buf)
av_strlcpy(buf, base, size);
+
+ /* Strip off any query string from base */
+ path_query = strchr(buf, '?');
+ if (path_query != NULL)
+ *path_query = '\0';
+
+ /* Is relative path just a new query part? */
+ if (rel[0] == '?') {
+ av_strlcat(buf, rel, size);
+ return;
+ }
+
/* Remove the file name from the base url */
sep = strrchr(buf, '/');
if (sep)
@@ -4035,7 +3505,7 @@ int64_t ff_iso8601_to_unix_time(const char *datestr)
#endif
}
-int avformat_query_codec(AVOutputFormat *ofmt, enum CodecID codec_id, int std_compliance)
+int avformat_query_codec(AVOutputFormat *ofmt, enum AVCodecID codec_id, int std_compliance)
{
if (ofmt) {
if (ofmt->query_codec)
diff --git a/gst-libs/ext/libav/libavformat/vc1test.c b/gst-libs/ext/libav/libavformat/vc1test.c
index 6789b9d..1895fc4 100644
--- a/gst-libs/ext/libav/libavformat/vc1test.c
+++ b/gst-libs/ext/libav/libavformat/vc1test.c
@@ -42,8 +42,7 @@ static int vc1t_probe(AVProbeData *p)
return AVPROBE_SCORE_MAX/2;
}
-static int vc1t_read_header(AVFormatContext *s,
- AVFormatParameters *ap)
+static int vc1t_read_header(AVFormatContext *s)
{
AVIOContext *pb = s->pb;
AVStream *st;
@@ -60,7 +59,7 @@ static int vc1t_read_header(AVFormatContext *s,
return -1;
st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
- st->codec->codec_id = CODEC_ID_WMV3;
+ st->codec->codec_id = AV_CODEC_ID_WMV3;
st->codec->extradata = av_malloc(VC1_EXTRADATA_SIZE);
st->codec->extradata_size = VC1_EXTRADATA_SIZE;
@@ -112,9 +111,9 @@ static int vc1t_read_packet(AVFormatContext *s,
AVInputFormat ff_vc1t_demuxer = {
.name = "vc1test",
- .long_name = NULL_IF_CONFIG_SMALL("VC-1 test bitstream format"),
+ .long_name = NULL_IF_CONFIG_SMALL("VC-1 test bitstream"),
.read_probe = vc1t_probe,
.read_header = vc1t_read_header,
.read_packet = vc1t_read_packet,
- .flags = AVFMT_GENERIC_INDEX,
+ .flags = AVFMT_GENERIC_INDEX,
};
diff --git a/gst-libs/ext/libav/libavformat/vc1testenc.c b/gst-libs/ext/libav/libavformat/vc1testenc.c
index a1228d8..abe8c6b 100644
--- a/gst-libs/ext/libav/libavformat/vc1testenc.c
+++ b/gst-libs/ext/libav/libavformat/vc1testenc.c
@@ -30,7 +30,7 @@ static int vc1test_write_header(AVFormatContext *s)
AVCodecContext *avc = s->streams[0]->codec;
AVIOContext *pb = s->pb;
- if (avc->codec_id != CODEC_ID_WMV3) {
+ if (avc->codec_id != AV_CODEC_ID_WMV3) {
av_log(s, AV_LOG_ERROR, "Only WMV3 is accepted!\n");
return -1;
}
@@ -44,8 +44,8 @@ static int vc1test_write_header(AVFormatContext *s)
avio_wl24(pb, 0); // hrd_buffer
avio_w8(pb, 0x80); // level|cbr|res1
avio_wl32(pb, 0); // hrd_rate
- if (s->streams[0]->r_frame_rate.den && s->streams[0]->r_frame_rate.num == 1)
- avio_wl32(pb, s->streams[0]->r_frame_rate.den);
+ if (s->streams[0]->avg_frame_rate.den && s->streams[0]->avg_frame_rate.num == 1)
+ avio_wl32(pb, s->streams[0]->avg_frame_rate.den);
else
avio_wl32(pb, 0xFFFFFFFF); //variable framerate
avpriv_set_pts_info(s->streams[0], 32, 1, 1000);
@@ -88,8 +88,8 @@ AVOutputFormat ff_vc1t_muxer = {
.mime_type = "",
.extensions = "rcv",
.priv_data_size = sizeof(RCVContext),
- .audio_codec = CODEC_ID_NONE,
- .video_codec = CODEC_ID_WMV3,
+ .audio_codec = AV_CODEC_ID_NONE,
+ .video_codec = AV_CODEC_ID_WMV3,
.write_header = vc1test_write_header,
.write_packet = vc1test_write_packet,
.write_trailer = vc1test_write_trailer,
diff --git a/gst-libs/ext/libav/libavformat/version.h b/gst-libs/ext/libav/libavformat/version.h
index c0ca05a..c2c1e3a 100644
--- a/gst-libs/ext/libav/libavformat/version.h
+++ b/gst-libs/ext/libav/libavformat/version.h
@@ -29,9 +29,9 @@
#include "libavutil/avutil.h"
-#define LIBAVFORMAT_VERSION_MAJOR 53
-#define LIBAVFORMAT_VERSION_MINOR 21
-#define LIBAVFORMAT_VERSION_MICRO 1
+#define LIBAVFORMAT_VERSION_MAJOR 54
+#define LIBAVFORMAT_VERSION_MINOR 20
+#define LIBAVFORMAT_VERSION_MICRO 3
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
LIBAVFORMAT_VERSION_MINOR, \
@@ -44,83 +44,28 @@
#define LIBAVFORMAT_IDENT "Lavf" AV_STRINGIFY(LIBAVFORMAT_VERSION)
/**
- * Those FF_API_* defines are not part of public API.
- * They may change, break or disappear at any time.
+ * FF_API_* defines may be placed below to indicate public API that will be
+ * dropped at a future version bump. The defines themselves are not part of
+ * the public API and may change, break or disappear at any time.
*/
-#ifndef FF_API_OLD_METADATA2
-#define FF_API_OLD_METADATA2 (LIBAVFORMAT_VERSION_MAJOR < 54)
-#endif
-#ifndef FF_API_OLD_AVIO
-#define FF_API_OLD_AVIO (LIBAVFORMAT_VERSION_MAJOR < 54)
-#endif
-#ifndef FF_API_DUMP_FORMAT
-#define FF_API_DUMP_FORMAT (LIBAVFORMAT_VERSION_MAJOR < 54)
-#endif
-#ifndef FF_API_PARSE_DATE
-#define FF_API_PARSE_DATE (LIBAVFORMAT_VERSION_MAJOR < 54)
-#endif
-#ifndef FF_API_FIND_INFO_TAG
-#define FF_API_FIND_INFO_TAG (LIBAVFORMAT_VERSION_MAJOR < 54)
-#endif
-#ifndef FF_API_PKT_DUMP
-#define FF_API_PKT_DUMP (LIBAVFORMAT_VERSION_MAJOR < 54)
-#endif
-#ifndef FF_API_GUESS_IMG2_CODEC
-#define FF_API_GUESS_IMG2_CODEC (LIBAVFORMAT_VERSION_MAJOR < 54)
-#endif
-#ifndef FF_API_SDP_CREATE
-#define FF_API_SDP_CREATE (LIBAVFORMAT_VERSION_MAJOR < 54)
-#endif
-#ifndef FF_API_FORMAT_PARAMETERS
-#define FF_API_FORMAT_PARAMETERS (LIBAVFORMAT_VERSION_MAJOR < 54)
-#endif
-#ifndef FF_API_FLAG_RTP_HINT
-#define FF_API_FLAG_RTP_HINT (LIBAVFORMAT_VERSION_MAJOR < 54)
-#endif
-#ifndef FF_API_AVSTREAM_QUALITY
-#define FF_API_AVSTREAM_QUALITY (LIBAVFORMAT_VERSION_MAJOR < 54)
-#endif
-#ifndef FF_API_LOOP_INPUT
-#define FF_API_LOOP_INPUT (LIBAVFORMAT_VERSION_MAJOR < 54)
-#endif
-#ifndef FF_API_LOOP_OUTPUT
-#define FF_API_LOOP_OUTPUT (LIBAVFORMAT_VERSION_MAJOR < 54)
-#endif
-#ifndef FF_API_TIMESTAMP
-#define FF_API_TIMESTAMP (LIBAVFORMAT_VERSION_MAJOR < 54)
-#endif
-#ifndef FF_API_FILESIZE
-#define FF_API_FILESIZE (LIBAVFORMAT_VERSION_MAJOR < 54)
-#endif
-#ifndef FF_API_MUXRATE
-#define FF_API_MUXRATE (LIBAVFORMAT_VERSION_MAJOR < 54)
-#endif
-#ifndef FF_API_RTSP_URL_OPTIONS
-#define FF_API_RTSP_URL_OPTIONS (LIBAVFORMAT_VERSION_MAJOR < 54)
-#endif
-#ifndef FF_API_NEW_STREAM
-#define FF_API_NEW_STREAM (LIBAVFORMAT_VERSION_MAJOR < 54)
-#endif
-#ifndef FF_API_PRELOAD
-#define FF_API_PRELOAD (LIBAVFORMAT_VERSION_MAJOR < 54)
-#endif
-#ifndef FF_API_STREAM_COPY
-#define FF_API_STREAM_COPY (LIBAVFORMAT_VERSION_MAJOR < 54)
+
+#ifndef FF_API_CLOSE_INPUT_FILE
+#define FF_API_CLOSE_INPUT_FILE (LIBAVFORMAT_VERSION_MAJOR < 55)
#endif
-#ifndef FF_API_SEEK_PUBLIC
-#define FF_API_SEEK_PUBLIC (LIBAVFORMAT_VERSION_MAJOR < 54)
+#ifndef FF_API_APPLEHTTP_PROTO
+#define FF_API_APPLEHTTP_PROTO (LIBAVFORMAT_VERSION_MAJOR < 55)
#endif
-#ifndef FF_API_REORDER_PRIVATE
-#define FF_API_REORDER_PRIVATE (LIBAVFORMAT_VERSION_MAJOR < 54)
+#ifndef FF_API_READ_PACKET
+#define FF_API_READ_PACKET (LIBAVFORMAT_VERSION_MAJOR < 55)
#endif
-#ifndef FF_API_OLD_INTERRUPT_CB
-#define FF_API_OLD_INTERRUPT_CB (LIBAVFORMAT_VERSION_MAJOR < 54)
+#ifndef FF_API_INTERLEAVE_PACKET
+#define FF_API_INTERLEAVE_PACKET (LIBAVFORMAT_VERSION_MAJOR < 55)
#endif
-#ifndef FF_API_SET_PTS_INFO
-#define FF_API_SET_PTS_INFO (LIBAVFORMAT_VERSION_MAJOR < 54)
+#ifndef FF_API_AV_GETTIME
+#define FF_API_AV_GETTIME (LIBAVFORMAT_VERSION_MAJOR < 55)
#endif
-#ifndef FF_API_CLOSE_INPUT_FILE
-#define FF_API_CLOSE_INPUT_FILE (LIBAVFORMAT_VERSION_MAJOR < 54)
+#ifndef FF_API_R_FRAME_RATE
+#define FF_API_R_FRAME_RATE (LIBAVFORMAT_VERSION_MAJOR < 55)
#endif
#endif /* AVFORMAT_VERSION_H */
diff --git a/gst-libs/ext/libav/libavformat/voc.c b/gst-libs/ext/libav/libavformat/voc.c
index 314623e..1b7d499 100644
--- a/gst-libs/ext/libav/libavformat/voc.c
+++ b/gst-libs/ext/libav/libavformat/voc.c
@@ -25,13 +25,13 @@
const unsigned char ff_voc_magic[21] = "Creative Voice File\x1A";
const AVCodecTag ff_voc_codec_tags[] = {
- {CODEC_ID_PCM_U8, 0x00},
- {CODEC_ID_ADPCM_SBPRO_4, 0x01},
- {CODEC_ID_ADPCM_SBPRO_3, 0x02},
- {CODEC_ID_ADPCM_SBPRO_2, 0x03},
- {CODEC_ID_PCM_S16LE, 0x04},
- {CODEC_ID_PCM_ALAW, 0x06},
- {CODEC_ID_PCM_MULAW, 0x07},
- {CODEC_ID_ADPCM_CT, 0x0200},
- {CODEC_ID_NONE, 0},
+ {AV_CODEC_ID_PCM_U8, 0x00},
+ {AV_CODEC_ID_ADPCM_SBPRO_4, 0x01},
+ {AV_CODEC_ID_ADPCM_SBPRO_3, 0x02},
+ {AV_CODEC_ID_ADPCM_SBPRO_2, 0x03},
+ {AV_CODEC_ID_PCM_S16LE, 0x04},
+ {AV_CODEC_ID_PCM_ALAW, 0x06},
+ {AV_CODEC_ID_PCM_MULAW, 0x07},
+ {AV_CODEC_ID_ADPCM_CT, 0x0200},
+ {AV_CODEC_ID_NONE, 0},
};
diff --git a/gst-libs/ext/libav/libavformat/voc.h b/gst-libs/ext/libav/libavformat/voc.h
index abd8fdb..d2c0cb4 100644
--- a/gst-libs/ext/libav/libavformat/voc.h
+++ b/gst-libs/ext/libav/libavformat/voc.h
@@ -23,7 +23,7 @@
#define AVFORMAT_VOC_H
#include "avformat.h"
-#include "riff.h" /* for CodecTag */
+#include "internal.h"
typedef struct voc_dec_context {
int64_t remaining_size;
@@ -45,7 +45,7 @@ typedef enum voc_type {
extern const unsigned char ff_voc_magic[21];
extern const AVCodecTag ff_voc_codec_tags[];
-int voc_get_packet(AVFormatContext *s, AVPacket *pkt,
- AVStream *st, int max_size);
+int ff_voc_get_packet(AVFormatContext *s, AVPacket *pkt,
+ AVStream *st, int max_size);
#endif /* AVFORMAT_VOC_H */
diff --git a/gst-libs/ext/libav/libavformat/vocdec.c b/gst-libs/ext/libav/libavformat/vocdec.c
index 638c15a..4e06513 100644
--- a/gst-libs/ext/libav/libavformat/vocdec.c
+++ b/gst-libs/ext/libav/libavformat/vocdec.c
@@ -38,7 +38,7 @@ static int voc_probe(AVProbeData *p)
return AVPROBE_SCORE_MAX;
}
-static int voc_read_header(AVFormatContext *s, AVFormatParameters *ap)
+static int voc_read_header(AVFormatContext *s)
{
VocDecContext *voc = s->priv_data;
AVIOContext *pb = s->pb;
@@ -62,7 +62,7 @@ static int voc_read_header(AVFormatContext *s, AVFormatParameters *ap)
}
int
-voc_get_packet(AVFormatContext *s, AVPacket *pkt, AVStream *st, int max_size)
+ff_voc_get_packet(AVFormatContext *s, AVPacket *pkt, AVStream *st, int max_size)
{
VocDecContext *voc = s->priv_data;
AVCodecContext *dec = st->codec;
@@ -86,9 +86,13 @@ voc_get_packet(AVFormatContext *s, AVPacket *pkt, AVStream *st, int max_size)
switch (type) {
case VOC_TYPE_VOICE_DATA:
- dec->sample_rate = 1000000 / (256 - avio_r8(pb));
- if (sample_rate)
- dec->sample_rate = sample_rate;
+ if (!dec->sample_rate) {
+ dec->sample_rate = 1000000 / (256 - avio_r8(pb));
+ if (sample_rate)
+ dec->sample_rate = sample_rate;
+ avpriv_set_pts_info(st, 64, 1, dec->sample_rate);
+ } else
+ avio_skip(pb, 1);
dec->channels = channels;
tmp_codec = avio_r8(pb);
dec->bits_per_coded_sample = av_get_bits_per_sample(dec->codec_id);
@@ -110,7 +114,11 @@ voc_get_packet(AVFormatContext *s, AVPacket *pkt, AVStream *st, int max_size)
break;
case VOC_TYPE_NEW_VOICE_DATA:
- dec->sample_rate = avio_rl32(pb);
+ if (!dec->sample_rate) {
+ dec->sample_rate = avio_rl32(pb);
+ avpriv_set_pts_info(st, 64, 1, dec->sample_rate);
+ } else
+ avio_skip(pb, 4);
dec->bits_per_coded_sample = avio_r8(pb);
dec->channels = avio_r8(pb);
tmp_codec = avio_rl16(pb);
@@ -129,12 +137,12 @@ voc_get_packet(AVFormatContext *s, AVPacket *pkt, AVStream *st, int max_size)
if (tmp_codec >= 0) {
tmp_codec = ff_codec_get_id(ff_voc_codec_tags, tmp_codec);
- if (dec->codec_id == CODEC_ID_NONE)
+ if (dec->codec_id == AV_CODEC_ID_NONE)
dec->codec_id = tmp_codec;
else if (dec->codec_id != tmp_codec)
av_log(s, AV_LOG_WARNING, "Ignoring mid-stream change in audio codec\n");
- if (dec->codec_id == CODEC_ID_NONE) {
- if (s->audio_codec_id == CODEC_ID_NONE) {
+ if (dec->codec_id == AV_CODEC_ID_NONE) {
+ if (s->audio_codec_id == AV_CODEC_ID_NONE) {
av_log(s, AV_LOG_ERROR, "unknown codec tag\n");
return AVERROR(EINVAL);
}
@@ -153,15 +161,15 @@ voc_get_packet(AVFormatContext *s, AVPacket *pkt, AVStream *st, int max_size)
static int voc_read_packet(AVFormatContext *s, AVPacket *pkt)
{
- return voc_get_packet(s, pkt, s->streams[0], 0);
+ return ff_voc_get_packet(s, pkt, s->streams[0], 0);
}
AVInputFormat ff_voc_demuxer = {
.name = "voc",
- .long_name = NULL_IF_CONFIG_SMALL("Creative Voice file format"),
+ .long_name = NULL_IF_CONFIG_SMALL("Creative Voice"),
.priv_data_size = sizeof(VocDecContext),
.read_probe = voc_probe,
.read_header = voc_read_header,
.read_packet = voc_read_packet,
- .codec_tag=(const AVCodecTag* const []){ff_voc_codec_tags, 0},
+ .codec_tag = (const AVCodecTag* const []){ ff_voc_codec_tags, 0 },
};
diff --git a/gst-libs/ext/libav/libavformat/vocenc.c b/gst-libs/ext/libav/libavformat/vocenc.c
index d0986bb..d18eac2 100644
--- a/gst-libs/ext/libav/libavformat/vocenc.c
+++ b/gst-libs/ext/libav/libavformat/vocenc.c
@@ -91,14 +91,14 @@ static int voc_write_trailer(AVFormatContext *s)
AVOutputFormat ff_voc_muxer = {
.name = "voc",
- .long_name = NULL_IF_CONFIG_SMALL("Creative Voice file format"),
+ .long_name = NULL_IF_CONFIG_SMALL("Creative Voice"),
.mime_type = "audio/x-voc",
.extensions = "voc",
.priv_data_size = sizeof(VocEncContext),
- .audio_codec = CODEC_ID_PCM_U8,
- .video_codec = CODEC_ID_NONE,
+ .audio_codec = AV_CODEC_ID_PCM_U8,
+ .video_codec = AV_CODEC_ID_NONE,
.write_header = voc_write_header,
.write_packet = voc_write_packet,
.write_trailer = voc_write_trailer,
- .codec_tag=(const AVCodecTag* const []){ff_voc_codec_tags, 0},
+ .codec_tag = (const AVCodecTag* const []){ ff_voc_codec_tags, 0 },
};
diff --git a/gst-libs/ext/libav/libavformat/vqf.c b/gst-libs/ext/libav/libavformat/vqf.c
index 4f8f07c..66ced37 100644
--- a/gst-libs/ext/libav/libavformat/vqf.c
+++ b/gst-libs/ext/libav/libavformat/vqf.c
@@ -86,7 +86,7 @@ static const AVMetadataConv vqf_metadata_conv[] = {
{ 0 },
};
-static int vqf_read_header(AVFormatContext *s, AVFormatParameters *ap)
+static int vqf_read_header(AVFormatContext *s)
{
VqfContext *c = s->priv_data;
AVStream *st = avformat_new_stream(s, NULL);
@@ -105,7 +105,7 @@ static int vqf_read_header(AVFormatContext *s, AVFormatParameters *ap)
header_size = avio_rb32(s->pb);
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
- st->codec->codec_id = CODEC_ID_TWINVQ;
+ st->codec->codec_id = AV_CODEC_ID_TWINVQ;
st->start_time = 0;
do {
@@ -201,7 +201,7 @@ static int vqf_read_header(AVFormatContext *s, AVFormatParameters *ap)
return -1;
}
c->frame_bit_len = st->codec->bit_rate*size/st->codec->sample_rate;
- avpriv_set_pts_info(st, 64, 1, st->codec->sample_rate);
+ avpriv_set_pts_info(st, 64, size, st->codec->sample_rate);
/* put first 12 bytes of COMM chunk in extradata */
if (!(st->codec->extradata = av_malloc(12 + FF_INPUT_BUFFER_PADDING_SIZE)))
@@ -220,12 +220,13 @@ static int vqf_read_packet(AVFormatContext *s, AVPacket *pkt)
int ret;
int size = (c->frame_bit_len - c->remaining_bits + 7)>>3;
- pkt->pos = avio_tell(s->pb);
- pkt->stream_index = 0;
-
if (av_new_packet(pkt, size+2) < 0)
return AVERROR(EIO);
+ pkt->pos = avio_tell(s->pb);
+ pkt->stream_index = 0;
+ pkt->duration = 1;
+
pkt->data[0] = 8 - c->remaining_bits; // Number of bits to skip
pkt->data[1] = c->last_frame_bits;
ret = avio_read(s->pb, pkt->data+2, size);
diff --git a/gst-libs/ext/libav/libavformat/wav.c b/gst-libs/ext/libav/libavformat/wav.c
deleted file mode 100644
index 7539ce0..0000000
--- a/gst-libs/ext/libav/libavformat/wav.c
+++ /dev/null
@@ -1,694 +0,0 @@
-/*
- * WAV muxer and demuxer
- * Copyright (c) 2001, 2002 Fabrice Bellard
- *
- * Sony Wave64 demuxer
- * RF64 demuxer
- * Copyright (c) 2009 Daniel Verkamp
- *
- * 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
- */
-
-#include "libavutil/avassert.h"
-#include "libavutil/dict.h"
-#include "libavutil/log.h"
-#include "libavutil/mathematics.h"
-#include "libavutil/opt.h"
-#include "avformat.h"
-#include "internal.h"
-#include "avio_internal.h"
-#include "pcm.h"
-#include "riff.h"
-#include "avio.h"
-#include "metadata.h"
-
-typedef struct {
- const AVClass *class;
- int64_t data;
- int64_t data_end;
- int64_t minpts;
- int64_t maxpts;
- int last_duration;
- int w64;
- int write_bext;
-} WAVContext;
-
-#if CONFIG_WAV_MUXER
-static inline void bwf_write_bext_string(AVFormatContext *s, const char *key, int maxlen)
-{
- AVDictionaryEntry *tag;
- int len = 0;
-
- if (tag = av_dict_get(s->metadata, key, NULL, 0)) {
- len = strlen(tag->value);
- len = FFMIN(len, maxlen);
- avio_write(s->pb, tag->value, len);
- }
-
- ffio_fill(s->pb, 0, maxlen - len);
-}
-
-static void bwf_write_bext_chunk(AVFormatContext *s)
-{
- AVDictionaryEntry *tmp_tag;
- uint64_t time_reference = 0;
- int64_t bext = ff_start_tag(s->pb, "bext");
-
- bwf_write_bext_string(s, "description", 256);
- bwf_write_bext_string(s, "originator", 32);
- bwf_write_bext_string(s, "originator_reference", 32);
- bwf_write_bext_string(s, "origination_date", 10);
- bwf_write_bext_string(s, "origination_time", 8);
-
- if (tmp_tag = av_dict_get(s->metadata, "time_reference", NULL, 0))
- time_reference = strtoll(tmp_tag->value, NULL, 10);
- avio_wl64(s->pb, time_reference);
- avio_wl16(s->pb, 1); // set version to 1
-
- if (tmp_tag = av_dict_get(s->metadata, "umid", NULL, 0)) {
- unsigned char umidpart_str[17] = {0};
- int i;
- uint64_t umidpart;
- int len = strlen(tmp_tag->value+2);
-
- for (i = 0; i < len/16; i++) {
- memcpy(umidpart_str, tmp_tag->value + 2 + (i*16), 16);
- umidpart = strtoll(umidpart_str, NULL, 16);
- avio_wb64(s->pb, umidpart);
- }
- ffio_fill(s->pb, 0, 64 - i*8);
- } else
- ffio_fill(s->pb, 0, 64); // zero UMID
-
- ffio_fill(s->pb, 0, 190); // Reserved
-
- if (tmp_tag = av_dict_get(s->metadata, "coding_history", NULL, 0))
- avio_put_str(s->pb, tmp_tag->value);
-
- ff_end_tag(s->pb, bext);
-}
-
-static int wav_write_header(AVFormatContext *s)
-{
- WAVContext *wav = s->priv_data;
- AVIOContext *pb = s->pb;
- int64_t fmt, fact;
-
- ffio_wfourcc(pb, "RIFF");
- avio_wl32(pb, 0); /* file length */
- ffio_wfourcc(pb, "WAVE");
-
- /* format header */
- fmt = ff_start_tag(pb, "fmt ");
- if (ff_put_wav_header(pb, s->streams[0]->codec) < 0) {
- av_log(s, AV_LOG_ERROR, "%s codec not supported in WAVE format\n",
- s->streams[0]->codec->codec ? s->streams[0]->codec->codec->name : "NONE");
- return -1;
- }
- ff_end_tag(pb, fmt);
-
- if (s->streams[0]->codec->codec_tag != 0x01 /* hence for all other than PCM */
- && s->pb->seekable) {
- fact = ff_start_tag(pb, "fact");
- avio_wl32(pb, 0);
- ff_end_tag(pb, fact);
- }
-
- if (wav->write_bext)
- bwf_write_bext_chunk(s);
-
- avpriv_set_pts_info(s->streams[0], 64, 1, s->streams[0]->codec->sample_rate);
- wav->maxpts = wav->last_duration = 0;
- wav->minpts = INT64_MAX;
-
- /* data header */
- wav->data = ff_start_tag(pb, "data");
-
- avio_flush(pb);
-
- return 0;
-}
-
-static int wav_write_packet(AVFormatContext *s, AVPacket *pkt)
-{
- AVIOContext *pb = s->pb;
- WAVContext *wav = s->priv_data;
- avio_write(pb, pkt->data, pkt->size);
- if(pkt->pts != AV_NOPTS_VALUE) {
- wav->minpts = FFMIN(wav->minpts, pkt->pts);
- wav->maxpts = FFMAX(wav->maxpts, pkt->pts);
- wav->last_duration = pkt->duration;
- } else
- av_log(s, AV_LOG_ERROR, "wav_write_packet: NOPTS\n");
- return 0;
-}
-
-static int wav_write_trailer(AVFormatContext *s)
-{
- AVIOContext *pb = s->pb;
- WAVContext *wav = s->priv_data;
- int64_t file_size;
-
- avio_flush(pb);
-
- if (s->pb->seekable) {
- ff_end_tag(pb, wav->data);
-
- /* update file size */
- file_size = avio_tell(pb);
- avio_seek(pb, 4, SEEK_SET);
- avio_wl32(pb, (uint32_t)(file_size - 8));
- avio_seek(pb, file_size, SEEK_SET);
-
- avio_flush(pb);
-
- if(s->streams[0]->codec->codec_tag != 0x01) {
- /* Update num_samps in fact chunk */
- int number_of_samples;
- number_of_samples = av_rescale(wav->maxpts - wav->minpts + wav->last_duration,
- s->streams[0]->codec->sample_rate * (int64_t)s->streams[0]->time_base.num,
- s->streams[0]->time_base.den);
- avio_seek(pb, wav->data-12, SEEK_SET);
- avio_wl32(pb, number_of_samples);
- avio_seek(pb, file_size, SEEK_SET);
- avio_flush(pb);
- }
- }
- return 0;
-}
-
-#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), AV_OPT_TYPE_INT, { 0 }, 0, 1, ENC },
- { NULL },
-};
-
-static const AVClass wav_muxer_class = {
- .class_name = "WAV muxer",
- .item_name = av_default_item_name,
- .option = options,
- .version = LIBAVUTIL_VERSION_INT,
-};
-
-AVOutputFormat ff_wav_muxer = {
- .name = "wav",
- .long_name = NULL_IF_CONFIG_SMALL("WAV format"),
- .mime_type = "audio/x-wav",
- .extensions = "wav",
- .priv_data_size = sizeof(WAVContext),
- .audio_codec = CODEC_ID_PCM_S16LE,
- .video_codec = CODEC_ID_NONE,
- .write_header = wav_write_header,
- .write_packet = wav_write_packet,
- .write_trailer = wav_write_trailer,
- .codec_tag= (const AVCodecTag* const []){ff_codec_wav_tags, 0},
- .priv_class = &wav_muxer_class,
-};
-#endif /* CONFIG_WAV_MUXER */
-
-
-#if CONFIG_WAV_DEMUXER
-
-static int64_t next_tag(AVIOContext *pb, uint32_t *tag)
-{
- *tag = avio_rl32(pb);
- return avio_rl32(pb);
-}
-
-/* RIFF chunks are always on a even offset. */
-static int64_t wav_seek_tag(AVIOContext *s, int64_t offset, int whence)
-{
- return avio_seek(s, offset + (offset & 1), whence);
-}
-
-/* return the size of the found tag */
-static int64_t find_tag(AVIOContext *pb, uint32_t tag1)
-{
- unsigned int tag;
- int64_t size;
-
- for (;;) {
- if (pb->eof_reached)
- return -1;
- size = next_tag(pb, &tag);
- if (tag == tag1)
- break;
- wav_seek_tag(pb, size, SEEK_CUR);
- }
- return size;
-}
-
-static int wav_probe(AVProbeData *p)
-{
- /* check file header */
- if (p->buf_size <= 32)
- return 0;
- if (!memcmp(p->buf + 8, "WAVE", 4)) {
- if (!memcmp(p->buf, "RIFF", 4))
- /*
- Since ACT demuxer has standard WAV header at top of it's own,
- returning score is decreased to avoid probe conflict
- between ACT and WAV.
- */
- return AVPROBE_SCORE_MAX - 1;
- else if (!memcmp(p->buf, "RF64", 4) &&
- !memcmp(p->buf + 12, "ds64", 4))
- return AVPROBE_SCORE_MAX;
- }
- return 0;
-}
-
-static int wav_parse_fmt_tag(AVFormatContext *s, int64_t size, AVStream **st)
-{
- AVIOContext *pb = s->pb;
- int ret;
-
- /* parse fmt header */
- *st = avformat_new_stream(s, NULL);
- if (!*st)
- return AVERROR(ENOMEM);
-
- ret = ff_get_wav_header(pb, (*st)->codec, size);
- if (ret < 0)
- return ret;
- (*st)->need_parsing = AVSTREAM_PARSE_FULL;
-
- avpriv_set_pts_info(*st, 64, 1, (*st)->codec->sample_rate);
-
- return 0;
-}
-
-static inline int wav_parse_bext_string(AVFormatContext *s, const char *key,
- int length)
-{
- char temp[257];
- int ret;
-
- av_assert0(length <= sizeof(temp));
- if ((ret = avio_read(s->pb, temp, length)) < 0)
- return ret;
-
- temp[length] = 0;
-
- if (strlen(temp))
- return av_dict_set(&s->metadata, key, temp, 0);
-
- return 0;
-}
-
-static int wav_parse_bext_tag(AVFormatContext *s, int64_t size)
-{
- char temp[131], *coding_history;
- int ret, x;
- uint64_t time_reference;
- int64_t umid_parts[8], umid_mask = 0;
-
- if ((ret = wav_parse_bext_string(s, "description", 256)) < 0 ||
- (ret = wav_parse_bext_string(s, "originator", 32)) < 0 ||
- (ret = wav_parse_bext_string(s, "originator_reference", 32)) < 0 ||
- (ret = wav_parse_bext_string(s, "origination_date", 10)) < 0 ||
- (ret = wav_parse_bext_string(s, "origination_time", 8)) < 0)
- return ret;
-
- time_reference = avio_rl64(s->pb);
- snprintf(temp, sizeof(temp), "%"PRIu64, time_reference);
- if ((ret = av_dict_set(&s->metadata, "time_reference", temp, 0)) < 0)
- return ret;
-
- /* check if version is >= 1, in which case an UMID may be present */
- if (avio_rl16(s->pb) >= 1) {
- for (x = 0; x < 8; x++)
- umid_mask |= umid_parts[x] = avio_rb64(s->pb);
-
- if (umid_mask) {
- /* the string formatting below is per SMPTE 330M-2004 Annex C */
- if (umid_parts[4] == 0 && umid_parts[5] == 0 && umid_parts[6] == 0 && umid_parts[7] == 0) {
- /* basic UMID */
- snprintf(temp, sizeof(temp), "0x%016"PRIX64"%016"PRIX64"%016"PRIX64"%016"PRIX64,
- umid_parts[0], umid_parts[1], umid_parts[2], umid_parts[3]);
- } else {
- /* extended UMID */
- snprintf(temp, sizeof(temp), "0x%016"PRIX64"%016"PRIX64"%016"PRIX64"%016"PRIX64
- "0x%016"PRIX64"%016"PRIX64"%016"PRIX64"%016"PRIX64,
- umid_parts[0], umid_parts[1], umid_parts[2], umid_parts[3],
- umid_parts[4], umid_parts[5], umid_parts[6], umid_parts[7]);
- }
-
- if ((ret = av_dict_set(&s->metadata, "umid", temp, 0)) < 0)
- return ret;
- }
-
- avio_skip(s->pb, 190);
- } else
- avio_skip(s->pb, 254);
-
- if (size > 602) {
- /* CodingHistory present */
- size -= 602;
-
- if (!(coding_history = av_malloc(size+1)))
- return AVERROR(ENOMEM);
-
- if ((ret = avio_read(s->pb, coding_history, size)) < 0)
- return ret;
-
- coding_history[size] = 0;
- if ((ret = av_dict_set(&s->metadata, "coding_history", coding_history,
- AV_DICT_DONT_STRDUP_VAL)) < 0)
- return ret;
- }
-
- return 0;
-}
-
-static const AVMetadataConv wav_metadata_conv[] = {
- {"description", "comment" },
- {"originator", "encoded_by" },
- {"origination_date", "date" },
- {"origination_time", "creation_time"},
- {0},
-};
-
-/* wav input */
-static int wav_read_header(AVFormatContext *s,
- AVFormatParameters *ap)
-{
- int64_t size, av_uninit(data_size);
- int64_t sample_count=0;
- int rf64;
- uint32_t tag, list_type;
- AVIOContext *pb = s->pb;
- AVStream *st;
- WAVContext *wav = s->priv_data;
- int ret, got_fmt = 0;
- int64_t next_tag_ofs, data_ofs = -1;
-
- /* check RIFF header */
- tag = avio_rl32(pb);
-
- rf64 = tag == MKTAG('R', 'F', '6', '4');
- if (!rf64 && tag != MKTAG('R', 'I', 'F', 'F'))
- return -1;
- avio_rl32(pb); /* file size */
- tag = avio_rl32(pb);
- if (tag != MKTAG('W', 'A', 'V', 'E'))
- return -1;
-
- if (rf64) {
- if (avio_rl32(pb) != MKTAG('d', 's', '6', '4'))
- return -1;
- size = avio_rl32(pb);
- if (size < 16)
- return -1;
- avio_rl64(pb); /* RIFF size */
- data_size = avio_rl64(pb);
- sample_count = avio_rl64(pb);
- if (data_size < 0 || sample_count < 0) {
- av_log(s, AV_LOG_ERROR, "negative data_size and/or sample_count in "
- "ds64: data_size = %"PRId64", sample_count = %"PRId64"\n",
- data_size, sample_count);
- return AVERROR_INVALIDDATA;
- }
- avio_skip(pb, size - 16); /* skip rest of ds64 chunk */
- }
-
- for (;;) {
- size = next_tag(pb, &tag);
- next_tag_ofs = avio_tell(pb) + size;
-
- if (pb->eof_reached)
- break;
-
- switch (tag) {
- case MKTAG('f', 'm', 't', ' '):
- /* only parse the first 'fmt ' tag found */
- if (!got_fmt && (ret = wav_parse_fmt_tag(s, size, &st) < 0)) {
- return ret;
- } else if (got_fmt)
- av_log(s, AV_LOG_WARNING, "found more than one 'fmt ' tag\n");
-
- got_fmt = 1;
- break;
- case MKTAG('d', 'a', 't', 'a'):
- if (!got_fmt) {
- av_log(s, AV_LOG_ERROR, "found no 'fmt ' tag before the 'data' tag\n");
- return AVERROR_INVALIDDATA;
- }
-
- if (rf64) {
- next_tag_ofs = wav->data_end = avio_tell(pb) + data_size;
- } else {
- data_size = size;
- next_tag_ofs = wav->data_end = size ? next_tag_ofs : INT64_MAX;
- }
-
- data_ofs = avio_tell(pb);
-
- /* don't look for footer metadata if we can't seek or if we don't
- * know where the data tag ends
- */
- if (!pb->seekable || (!rf64 && !size))
- goto break_loop;
- break;
- case MKTAG('f','a','c','t'):
- if (!sample_count)
- sample_count = avio_rl32(pb);
- break;
- case MKTAG('b','e','x','t'):
- if ((ret = wav_parse_bext_tag(s, size)) < 0)
- return ret;
- break;
- case MKTAG('L', 'I', 'S', 'T'):
- list_type = avio_rl32(pb);
- if (size < 4) {
- av_log(s, AV_LOG_ERROR, "too short LIST");
- return AVERROR_INVALIDDATA;
- }
- switch (list_type) {
- case MKTAG('I', 'N', 'F', 'O'):
- if ((ret = ff_read_riff_info(s, size - 4)) < 0)
- return ret;
- }
- break;
- }
-
- /* seek to next tag unless we know that we'll run into EOF */
- if ((avio_size(pb) > 0 && next_tag_ofs >= avio_size(pb)) ||
- wav_seek_tag(pb, next_tag_ofs, SEEK_SET) < 0) {
- break;
- }
- }
-break_loop:
- if (data_ofs < 0) {
- av_log(s, AV_LOG_ERROR, "no 'data' tag found\n");
- return AVERROR_INVALIDDATA;
- }
-
- avio_seek(pb, data_ofs, SEEK_SET);
-
- if (!sample_count && st->codec->channels && av_get_bits_per_sample(st->codec->codec_id))
- sample_count = (data_size<<3) / (st->codec->channels * (uint64_t)av_get_bits_per_sample(st->codec->codec_id));
- if (sample_count)
- st->duration = sample_count;
-
- ff_metadata_conv_ctx(s, NULL, wav_metadata_conv);
- ff_metadata_conv_ctx(s, NULL, ff_riff_info_conv);
-
- return 0;
-}
-
-/** Find chunk with w64 GUID by skipping over other chunks
- * @return the size of the found chunk
- */
-static int64_t find_guid(AVIOContext *pb, const uint8_t guid1[16])
-{
- uint8_t guid[16];
- int64_t size;
-
- while (!pb->eof_reached) {
- avio_read(pb, guid, 16);
- size = avio_rl64(pb);
- if (size <= 24)
- return -1;
- if (!memcmp(guid, guid1, 16))
- return size;
- avio_skip(pb, FFALIGN(size, INT64_C(8)) - 24);
- }
- return -1;
-}
-
-static const uint8_t guid_data[16] = { 'd', 'a', 't', 'a',
- 0xF3, 0xAC, 0xD3, 0x11, 0x8C, 0xD1, 0x00, 0xC0, 0x4F, 0x8E, 0xDB, 0x8A };
-
-#define MAX_SIZE 4096
-
-static int wav_read_packet(AVFormatContext *s,
- AVPacket *pkt)
-{
- int ret, size;
- int64_t left;
- AVStream *st;
- WAVContext *wav = s->priv_data;
-
- st = s->streams[0];
-
- left = wav->data_end - avio_tell(s->pb);
- if (left <= 0){
- if (CONFIG_W64_DEMUXER && wav->w64)
- left = find_guid(s->pb, guid_data) - 24;
- else
- left = find_tag(s->pb, MKTAG('d', 'a', 't', 'a'));
- if (left < 0)
- return AVERROR_EOF;
- wav->data_end= avio_tell(s->pb) + left;
- }
-
- size = MAX_SIZE;
- if (st->codec->block_align > 1) {
- if (size < st->codec->block_align)
- size = st->codec->block_align;
- size = (size / st->codec->block_align) * st->codec->block_align;
- }
- size = FFMIN(size, left);
- ret = av_get_packet(s->pb, pkt, size);
- if (ret < 0)
- return ret;
- pkt->stream_index = 0;
-
- return ret;
-}
-
-static int wav_read_seek(AVFormatContext *s,
- int stream_index, int64_t timestamp, int flags)
-{
- AVStream *st;
-
- st = s->streams[0];
- switch (st->codec->codec_id) {
- case CODEC_ID_MP2:
- case CODEC_ID_MP3:
- case CODEC_ID_AC3:
- case CODEC_ID_DTS:
- /* use generic seeking with dynamically generated indexes */
- return -1;
- default:
- break;
- }
- return pcm_read_seek(s, stream_index, timestamp, flags);
-}
-
-AVInputFormat ff_wav_demuxer = {
- .name = "wav",
- .long_name = NULL_IF_CONFIG_SMALL("WAV format"),
- .priv_data_size = sizeof(WAVContext),
- .read_probe = wav_probe,
- .read_header = wav_read_header,
- .read_packet = wav_read_packet,
- .read_seek = wav_read_seek,
- .flags= AVFMT_GENERIC_INDEX,
- .codec_tag= (const AVCodecTag* const []){ff_codec_wav_tags, 0},
-};
-#endif /* CONFIG_WAV_DEMUXER */
-
-
-#if CONFIG_W64_DEMUXER
-static const uint8_t guid_riff[16] = { 'r', 'i', 'f', 'f',
- 0x2E, 0x91, 0xCF, 0x11, 0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00 };
-
-static const uint8_t guid_wave[16] = { 'w', 'a', 'v', 'e',
- 0xF3, 0xAC, 0xD3, 0x11, 0x8C, 0xD1, 0x00, 0xC0, 0x4F, 0x8E, 0xDB, 0x8A };
-
-static const uint8_t guid_fmt [16] = { 'f', 'm', 't', ' ',
- 0xF3, 0xAC, 0xD3, 0x11, 0x8C, 0xD1, 0x00, 0xC0, 0x4F, 0x8E, 0xDB, 0x8A };
-
-static int w64_probe(AVProbeData *p)
-{
- if (p->buf_size <= 40)
- return 0;
- if (!memcmp(p->buf, guid_riff, 16) &&
- !memcmp(p->buf + 24, guid_wave, 16))
- return AVPROBE_SCORE_MAX;
- else
- return 0;
-}
-
-static int w64_read_header(AVFormatContext *s, AVFormatParameters *ap)
-{
- int64_t size;
- AVIOContext *pb = s->pb;
- WAVContext *wav = s->priv_data;
- AVStream *st;
- uint8_t guid[16];
- int ret;
-
- avio_read(pb, guid, 16);
- if (memcmp(guid, guid_riff, 16))
- return -1;
-
- if (avio_rl64(pb) < 16 + 8 + 16 + 8 + 16 + 8) /* riff + wave + fmt + sizes */
- return -1;
-
- avio_read(pb, guid, 16);
- if (memcmp(guid, guid_wave, 16)) {
- av_log(s, AV_LOG_ERROR, "could not find wave guid\n");
- return -1;
- }
-
- size = find_guid(pb, guid_fmt);
- if (size < 0) {
- av_log(s, AV_LOG_ERROR, "could not find fmt guid\n");
- return -1;
- }
-
- st = avformat_new_stream(s, NULL);
- if (!st)
- return AVERROR(ENOMEM);
-
- /* subtract chunk header size - normal wav file doesn't count it */
- ret = ff_get_wav_header(pb, st->codec, size - 24);
- if (ret < 0)
- return ret;
- avio_skip(pb, FFALIGN(size, INT64_C(8)) - size);
-
- st->need_parsing = AVSTREAM_PARSE_FULL;
-
- avpriv_set_pts_info(st, 64, 1, st->codec->sample_rate);
-
- size = find_guid(pb, guid_data);
- if (size < 0) {
- av_log(s, AV_LOG_ERROR, "could not find data guid\n");
- return -1;
- }
- wav->data_end = avio_tell(pb) + size - 24;
- wav->w64 = 1;
-
- return 0;
-}
-
-AVInputFormat ff_w64_demuxer = {
- .name = "w64",
- .long_name = NULL_IF_CONFIG_SMALL("Sony Wave64 format"),
- .priv_data_size = sizeof(WAVContext),
- .read_probe = w64_probe,
- .read_header = w64_read_header,
- .read_packet = wav_read_packet,
- .read_seek = wav_read_seek,
- .flags = AVFMT_GENERIC_INDEX,
- .codec_tag = (const AVCodecTag* const []){ff_codec_wav_tags, 0},
-};
-#endif /* CONFIG_W64_DEMUXER */
diff --git a/gst-libs/ext/libav/libavformat/wavdec.c b/gst-libs/ext/libav/libavformat/wavdec.c
new file mode 100644
index 0000000..e9dda92
--- /dev/null
+++ b/gst-libs/ext/libav/libavformat/wavdec.c
@@ -0,0 +1,512 @@
+/*
+ * WAV demuxer
+ * Copyright (c) 2001, 2002 Fabrice Bellard
+ *
+ * Sony Wave64 demuxer
+ * RF64 demuxer
+ * Copyright (c) 2009 Daniel Verkamp
+ *
+ * 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
+ */
+
+#include "libavutil/avassert.h"
+#include "libavutil/dict.h"
+#include "libavutil/log.h"
+#include "libavutil/mathematics.h"
+#include "libavutil/opt.h"
+#include "avformat.h"
+#include "internal.h"
+#include "avio_internal.h"
+#include "pcm.h"
+#include "riff.h"
+#include "avio.h"
+#include "metadata.h"
+
+typedef struct WAVDemuxContext {
+ int64_t data_end;
+ int w64;
+} WAVDemuxContext;
+
+
+#if CONFIG_WAV_DEMUXER
+
+static int64_t next_tag(AVIOContext *pb, uint32_t *tag)
+{
+ *tag = avio_rl32(pb);
+ return avio_rl32(pb);
+}
+
+/* RIFF chunks are always on a even offset. */
+static int64_t wav_seek_tag(AVIOContext *s, int64_t offset, int whence)
+{
+ return avio_seek(s, offset + (offset & 1), whence);
+}
+
+/* return the size of the found tag */
+static int64_t find_tag(AVIOContext *pb, uint32_t tag1)
+{
+ unsigned int tag;
+ int64_t size;
+
+ for (;;) {
+ if (pb->eof_reached)
+ return -1;
+ size = next_tag(pb, &tag);
+ if (tag == tag1)
+ break;
+ wav_seek_tag(pb, size, SEEK_CUR);
+ }
+ return size;
+}
+
+static int wav_probe(AVProbeData *p)
+{
+ /* check file header */
+ if (p->buf_size <= 32)
+ return 0;
+ if (!memcmp(p->buf + 8, "WAVE", 4)) {
+ if (!memcmp(p->buf, "RIFF", 4))
+ /*
+ Since ACT demuxer has standard WAV header at top of it's own,
+ returning score is decreased to avoid probe conflict
+ between ACT and WAV.
+ */
+ return AVPROBE_SCORE_MAX - 1;
+ else if (!memcmp(p->buf, "RF64", 4) &&
+ !memcmp(p->buf + 12, "ds64", 4))
+ return AVPROBE_SCORE_MAX;
+ }
+ return 0;
+}
+
+static int wav_parse_fmt_tag(AVFormatContext *s, int64_t size, AVStream **st)
+{
+ AVIOContext *pb = s->pb;
+ int ret;
+
+ /* parse fmt header */
+ *st = avformat_new_stream(s, NULL);
+ if (!*st)
+ return AVERROR(ENOMEM);
+
+ ret = ff_get_wav_header(pb, (*st)->codec, size);
+ if (ret < 0)
+ return ret;
+ (*st)->need_parsing = AVSTREAM_PARSE_FULL;
+
+ avpriv_set_pts_info(*st, 64, 1, (*st)->codec->sample_rate);
+
+ return 0;
+}
+
+static inline int wav_parse_bext_string(AVFormatContext *s, const char *key,
+ int length)
+{
+ char temp[257];
+ int ret;
+
+ av_assert0(length <= sizeof(temp));
+ if ((ret = avio_read(s->pb, temp, length)) < 0)
+ return ret;
+
+ temp[length] = 0;
+
+ if (strlen(temp))
+ return av_dict_set(&s->metadata, key, temp, 0);
+
+ return 0;
+}
+
+static int wav_parse_bext_tag(AVFormatContext *s, int64_t size)
+{
+ char temp[131], *coding_history;
+ int ret, x;
+ uint64_t time_reference;
+ int64_t umid_parts[8], umid_mask = 0;
+
+ if ((ret = wav_parse_bext_string(s, "description", 256)) < 0 ||
+ (ret = wav_parse_bext_string(s, "originator", 32)) < 0 ||
+ (ret = wav_parse_bext_string(s, "originator_reference", 32)) < 0 ||
+ (ret = wav_parse_bext_string(s, "origination_date", 10)) < 0 ||
+ (ret = wav_parse_bext_string(s, "origination_time", 8)) < 0)
+ return ret;
+
+ time_reference = avio_rl64(s->pb);
+ snprintf(temp, sizeof(temp), "%"PRIu64, time_reference);
+ if ((ret = av_dict_set(&s->metadata, "time_reference", temp, 0)) < 0)
+ return ret;
+
+ /* check if version is >= 1, in which case an UMID may be present */
+ if (avio_rl16(s->pb) >= 1) {
+ for (x = 0; x < 8; x++)
+ umid_mask |= umid_parts[x] = avio_rb64(s->pb);
+
+ if (umid_mask) {
+ /* the string formatting below is per SMPTE 330M-2004 Annex C */
+ if (umid_parts[4] == 0 && umid_parts[5] == 0 && umid_parts[6] == 0 && umid_parts[7] == 0) {
+ /* basic UMID */
+ snprintf(temp, sizeof(temp), "0x%016"PRIX64"%016"PRIX64"%016"PRIX64"%016"PRIX64,
+ umid_parts[0], umid_parts[1], umid_parts[2], umid_parts[3]);
+ } else {
+ /* extended UMID */
+ snprintf(temp, sizeof(temp), "0x%016"PRIX64"%016"PRIX64"%016"PRIX64"%016"PRIX64
+ "0x%016"PRIX64"%016"PRIX64"%016"PRIX64"%016"PRIX64,
+ umid_parts[0], umid_parts[1], umid_parts[2], umid_parts[3],
+ umid_parts[4], umid_parts[5], umid_parts[6], umid_parts[7]);
+ }
+
+ if ((ret = av_dict_set(&s->metadata, "umid", temp, 0)) < 0)
+ return ret;
+ }
+
+ avio_skip(s->pb, 190);
+ } else
+ avio_skip(s->pb, 254);
+
+ if (size > 602) {
+ /* CodingHistory present */
+ size -= 602;
+
+ if (!(coding_history = av_malloc(size+1)))
+ return AVERROR(ENOMEM);
+
+ if ((ret = avio_read(s->pb, coding_history, size)) < 0)
+ return ret;
+
+ coding_history[size] = 0;
+ if ((ret = av_dict_set(&s->metadata, "coding_history", coding_history,
+ AV_DICT_DONT_STRDUP_VAL)) < 0)
+ return ret;
+ }
+
+ return 0;
+}
+
+static const AVMetadataConv wav_metadata_conv[] = {
+ {"description", "comment" },
+ {"originator", "encoded_by" },
+ {"origination_date", "date" },
+ {"origination_time", "creation_time"},
+ {0},
+};
+
+/* wav input */
+static int wav_read_header(AVFormatContext *s)
+{
+ int64_t size, av_uninit(data_size);
+ int64_t sample_count=0;
+ int rf64;
+ uint32_t tag;
+ AVIOContext *pb = s->pb;
+ AVStream *st = NULL;
+ WAVDemuxContext *wav = s->priv_data;
+ int ret, got_fmt = 0;
+ int64_t next_tag_ofs, data_ofs = -1;
+
+ /* check RIFF header */
+ tag = avio_rl32(pb);
+
+ rf64 = tag == MKTAG('R', 'F', '6', '4');
+ if (!rf64 && tag != MKTAG('R', 'I', 'F', 'F'))
+ return -1;
+ avio_rl32(pb); /* file size */
+ tag = avio_rl32(pb);
+ if (tag != MKTAG('W', 'A', 'V', 'E'))
+ return -1;
+
+ if (rf64) {
+ if (avio_rl32(pb) != MKTAG('d', 's', '6', '4'))
+ return -1;
+ size = avio_rl32(pb);
+ if (size < 16)
+ return -1;
+ avio_rl64(pb); /* RIFF size */
+ data_size = avio_rl64(pb);
+ sample_count = avio_rl64(pb);
+ if (data_size < 0 || sample_count < 0) {
+ av_log(s, AV_LOG_ERROR, "negative data_size and/or sample_count in "
+ "ds64: data_size = %"PRId64", sample_count = %"PRId64"\n",
+ data_size, sample_count);
+ return AVERROR_INVALIDDATA;
+ }
+ avio_skip(pb, size - 16); /* skip rest of ds64 chunk */
+ }
+
+ for (;;) {
+ size = next_tag(pb, &tag);
+ next_tag_ofs = avio_tell(pb) + size;
+
+ if (pb->eof_reached)
+ break;
+
+ switch (tag) {
+ case MKTAG('f', 'm', 't', ' '):
+ /* only parse the first 'fmt ' tag found */
+ if (!got_fmt && (ret = wav_parse_fmt_tag(s, size, &st) < 0)) {
+ return ret;
+ } else if (got_fmt)
+ av_log(s, AV_LOG_WARNING, "found more than one 'fmt ' tag\n");
+
+ got_fmt = 1;
+ break;
+ case MKTAG('d', 'a', 't', 'a'):
+ if (!got_fmt) {
+ av_log(s, AV_LOG_ERROR, "found no 'fmt ' tag before the 'data' tag\n");
+ return AVERROR_INVALIDDATA;
+ }
+
+ if (rf64) {
+ next_tag_ofs = wav->data_end = avio_tell(pb) + data_size;
+ } else {
+ data_size = size;
+ next_tag_ofs = wav->data_end = size ? next_tag_ofs : INT64_MAX;
+ }
+
+ data_ofs = avio_tell(pb);
+
+ /* don't look for footer metadata if we can't seek or if we don't
+ * know where the data tag ends
+ */
+ if (!pb->seekable || (!rf64 && !size))
+ goto break_loop;
+ break;
+ case MKTAG('f','a','c','t'):
+ if (!sample_count)
+ sample_count = avio_rl32(pb);
+ break;
+ case MKTAG('b','e','x','t'):
+ if ((ret = wav_parse_bext_tag(s, size)) < 0)
+ return ret;
+ break;
+ case MKTAG('L', 'I', 'S', 'T'):
+ if (size < 4) {
+ av_log(s, AV_LOG_ERROR, "too short LIST");
+ return AVERROR_INVALIDDATA;
+ }
+ switch (avio_rl32(pb)) {
+ case MKTAG('I', 'N', 'F', 'O'):
+ if ((ret = ff_read_riff_info(s, size - 4)) < 0)
+ return ret;
+ }
+ break;
+ }
+
+ /* seek to next tag unless we know that we'll run into EOF */
+ if ((avio_size(pb) > 0 && next_tag_ofs >= avio_size(pb)) ||
+ wav_seek_tag(pb, next_tag_ofs, SEEK_SET) < 0) {
+ break;
+ }
+ }
+break_loop:
+ if (data_ofs < 0) {
+ av_log(s, AV_LOG_ERROR, "no 'data' tag found\n");
+ return AVERROR_INVALIDDATA;
+ }
+
+ avio_seek(pb, data_ofs, SEEK_SET);
+
+ if (!sample_count && st->codec->channels && av_get_bits_per_sample(st->codec->codec_id))
+ sample_count = (data_size<<3) / (st->codec->channels * (uint64_t)av_get_bits_per_sample(st->codec->codec_id));
+ if (sample_count)
+ st->duration = sample_count;
+
+ ff_metadata_conv_ctx(s, NULL, wav_metadata_conv);
+ ff_metadata_conv_ctx(s, NULL, ff_riff_info_conv);
+
+ return 0;
+}
+
+/** Find chunk with w64 GUID by skipping over other chunks
+ * @return the size of the found chunk
+ */
+static int64_t find_guid(AVIOContext *pb, const uint8_t guid1[16])
+{
+ uint8_t guid[16];
+ int64_t size;
+
+ while (!pb->eof_reached) {
+ avio_read(pb, guid, 16);
+ size = avio_rl64(pb);
+ if (size <= 24)
+ return -1;
+ if (!memcmp(guid, guid1, 16))
+ return size;
+ avio_skip(pb, FFALIGN(size, INT64_C(8)) - 24);
+ }
+ return -1;
+}
+
+static const uint8_t guid_data[16] = { 'd', 'a', 't', 'a',
+ 0xF3, 0xAC, 0xD3, 0x11, 0x8C, 0xD1, 0x00, 0xC0, 0x4F, 0x8E, 0xDB, 0x8A };
+
+#define MAX_SIZE 4096
+
+static int wav_read_packet(AVFormatContext *s,
+ AVPacket *pkt)
+{
+ int ret, size;
+ int64_t left;
+ AVStream *st;
+ WAVDemuxContext *wav = s->priv_data;
+
+ st = s->streams[0];
+
+ left = wav->data_end - avio_tell(s->pb);
+ if (left <= 0){
+ if (CONFIG_W64_DEMUXER && wav->w64)
+ left = find_guid(s->pb, guid_data) - 24;
+ else
+ left = find_tag(s->pb, MKTAG('d', 'a', 't', 'a'));
+ if (left < 0)
+ return AVERROR_EOF;
+ wav->data_end= avio_tell(s->pb) + left;
+ }
+
+ size = MAX_SIZE;
+ if (st->codec->block_align > 1) {
+ if (size < st->codec->block_align)
+ size = st->codec->block_align;
+ size = (size / st->codec->block_align) * st->codec->block_align;
+ }
+ size = FFMIN(size, left);
+ ret = av_get_packet(s->pb, pkt, size);
+ if (ret < 0)
+ return ret;
+ pkt->stream_index = 0;
+
+ return ret;
+}
+
+static int wav_read_seek(AVFormatContext *s,
+ int stream_index, int64_t timestamp, int flags)
+{
+ AVStream *st;
+
+ st = s->streams[0];
+ switch (st->codec->codec_id) {
+ case AV_CODEC_ID_MP2:
+ case AV_CODEC_ID_MP3:
+ case AV_CODEC_ID_AC3:
+ case AV_CODEC_ID_DTS:
+ /* use generic seeking with dynamically generated indexes */
+ return -1;
+ default:
+ break;
+ }
+ return ff_pcm_read_seek(s, stream_index, timestamp, flags);
+}
+
+AVInputFormat ff_wav_demuxer = {
+ .name = "wav",
+ .long_name = NULL_IF_CONFIG_SMALL("WAV / WAVE (Waveform Audio)"),
+ .priv_data_size = sizeof(WAVDemuxContext),
+ .read_probe = wav_probe,
+ .read_header = wav_read_header,
+ .read_packet = wav_read_packet,
+ .read_seek = wav_read_seek,
+ .flags = AVFMT_GENERIC_INDEX,
+ .codec_tag = (const AVCodecTag* const []){ ff_codec_wav_tags, 0 },
+};
+#endif /* CONFIG_WAV_DEMUXER */
+
+
+#if CONFIG_W64_DEMUXER
+static const uint8_t guid_riff[16] = { 'r', 'i', 'f', 'f',
+ 0x2E, 0x91, 0xCF, 0x11, 0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00 };
+
+static const uint8_t guid_wave[16] = { 'w', 'a', 'v', 'e',
+ 0xF3, 0xAC, 0xD3, 0x11, 0x8C, 0xD1, 0x00, 0xC0, 0x4F, 0x8E, 0xDB, 0x8A };
+
+static const uint8_t guid_fmt [16] = { 'f', 'm', 't', ' ',
+ 0xF3, 0xAC, 0xD3, 0x11, 0x8C, 0xD1, 0x00, 0xC0, 0x4F, 0x8E, 0xDB, 0x8A };
+
+static int w64_probe(AVProbeData *p)
+{
+ if (p->buf_size <= 40)
+ return 0;
+ if (!memcmp(p->buf, guid_riff, 16) &&
+ !memcmp(p->buf + 24, guid_wave, 16))
+ return AVPROBE_SCORE_MAX;
+ else
+ return 0;
+}
+
+static int w64_read_header(AVFormatContext *s)
+{
+ int64_t size;
+ AVIOContext *pb = s->pb;
+ WAVDemuxContext *wav = s->priv_data;
+ AVStream *st;
+ uint8_t guid[16];
+ int ret;
+
+ avio_read(pb, guid, 16);
+ if (memcmp(guid, guid_riff, 16))
+ return -1;
+
+ if (avio_rl64(pb) < 16 + 8 + 16 + 8 + 16 + 8) /* riff + wave + fmt + sizes */
+ return -1;
+
+ avio_read(pb, guid, 16);
+ if (memcmp(guid, guid_wave, 16)) {
+ av_log(s, AV_LOG_ERROR, "could not find wave guid\n");
+ return -1;
+ }
+
+ size = find_guid(pb, guid_fmt);
+ if (size < 0) {
+ av_log(s, AV_LOG_ERROR, "could not find fmt guid\n");
+ return -1;
+ }
+
+ st = avformat_new_stream(s, NULL);
+ if (!st)
+ return AVERROR(ENOMEM);
+
+ /* subtract chunk header size - normal wav file doesn't count it */
+ ret = ff_get_wav_header(pb, st->codec, size - 24);
+ if (ret < 0)
+ return ret;
+ avio_skip(pb, FFALIGN(size, INT64_C(8)) - size);
+
+ st->need_parsing = AVSTREAM_PARSE_FULL;
+
+ avpriv_set_pts_info(st, 64, 1, st->codec->sample_rate);
+
+ size = find_guid(pb, guid_data);
+ if (size < 0) {
+ av_log(s, AV_LOG_ERROR, "could not find data guid\n");
+ return -1;
+ }
+ wav->data_end = avio_tell(pb) + size - 24;
+ wav->w64 = 1;
+
+ return 0;
+}
+
+AVInputFormat ff_w64_demuxer = {
+ .name = "w64",
+ .long_name = NULL_IF_CONFIG_SMALL("Sony Wave64"),
+ .priv_data_size = sizeof(WAVDemuxContext),
+ .read_probe = w64_probe,
+ .read_header = w64_read_header,
+ .read_packet = wav_read_packet,
+ .read_seek = wav_read_seek,
+ .flags = AVFMT_GENERIC_INDEX,
+ .codec_tag = (const AVCodecTag* const []){ ff_codec_wav_tags, 0 },
+};
+#endif /* CONFIG_W64_DEMUXER */
diff --git a/gst-libs/ext/libav/libavformat/wavenc.c b/gst-libs/ext/libav/libavformat/wavenc.c
new file mode 100644
index 0000000..86ed557
--- /dev/null
+++ b/gst-libs/ext/libav/libavformat/wavenc.c
@@ -0,0 +1,220 @@
+/*
+ * WAV muxer
+ * Copyright (c) 2001, 2002 Fabrice Bellard
+ *
+ * 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
+ */
+
+#include <stdint.h>
+#include <string.h>
+
+#include "libavutil/dict.h"
+#include "libavutil/common.h"
+#include "libavutil/mathematics.h"
+#include "libavutil/opt.h"
+
+#include "avformat.h"
+#include "avio.h"
+#include "avio_internal.h"
+#include "internal.h"
+#include "riff.h"
+
+typedef struct WAVMuxContext {
+ const AVClass *class;
+ int64_t data;
+ int64_t fact_pos;
+ int64_t minpts;
+ int64_t maxpts;
+ int last_duration;
+ int write_bext;
+} WAVMuxContext;
+
+static inline void bwf_write_bext_string(AVFormatContext *s, const char *key, int maxlen)
+{
+ AVDictionaryEntry *tag;
+ int len = 0;
+
+ if (tag = av_dict_get(s->metadata, key, NULL, 0)) {
+ len = strlen(tag->value);
+ len = FFMIN(len, maxlen);
+ avio_write(s->pb, tag->value, len);
+ }
+
+ ffio_fill(s->pb, 0, maxlen - len);
+}
+
+static void bwf_write_bext_chunk(AVFormatContext *s)
+{
+ AVDictionaryEntry *tmp_tag;
+ uint64_t time_reference = 0;
+ int64_t bext = ff_start_tag(s->pb, "bext");
+
+ bwf_write_bext_string(s, "description", 256);
+ bwf_write_bext_string(s, "originator", 32);
+ bwf_write_bext_string(s, "originator_reference", 32);
+ bwf_write_bext_string(s, "origination_date", 10);
+ bwf_write_bext_string(s, "origination_time", 8);
+
+ if (tmp_tag = av_dict_get(s->metadata, "time_reference", NULL, 0))
+ time_reference = strtoll(tmp_tag->value, NULL, 10);
+ avio_wl64(s->pb, time_reference);
+ avio_wl16(s->pb, 1); // set version to 1
+
+ if (tmp_tag = av_dict_get(s->metadata, "umid", NULL, 0)) {
+ unsigned char umidpart_str[17] = {0};
+ int i;
+ uint64_t umidpart;
+ int len = strlen(tmp_tag->value+2);
+
+ for (i = 0; i < len/16; i++) {
+ memcpy(umidpart_str, tmp_tag->value + 2 + (i*16), 16);
+ umidpart = strtoll(umidpart_str, NULL, 16);
+ avio_wb64(s->pb, umidpart);
+ }
+ ffio_fill(s->pb, 0, 64 - i*8);
+ } else
+ ffio_fill(s->pb, 0, 64); // zero UMID
+
+ ffio_fill(s->pb, 0, 190); // Reserved
+
+ if (tmp_tag = av_dict_get(s->metadata, "coding_history", NULL, 0))
+ avio_put_str(s->pb, tmp_tag->value);
+
+ ff_end_tag(s->pb, bext);
+}
+
+static int wav_write_header(AVFormatContext *s)
+{
+ WAVMuxContext *wav = s->priv_data;
+ AVIOContext *pb = s->pb;
+ int64_t fmt;
+
+ ffio_wfourcc(pb, "RIFF");
+ avio_wl32(pb, 0); /* file length */
+ ffio_wfourcc(pb, "WAVE");
+
+ /* format header */
+ fmt = ff_start_tag(pb, "fmt ");
+ if (ff_put_wav_header(pb, s->streams[0]->codec) < 0) {
+ av_log(s, AV_LOG_ERROR, "%s codec not supported in WAVE format\n",
+ s->streams[0]->codec->codec ? s->streams[0]->codec->codec->name : "NONE");
+ return -1;
+ }
+ ff_end_tag(pb, fmt);
+
+ if (s->streams[0]->codec->codec_tag != 0x01 /* hence for all other than PCM */
+ && s->pb->seekable) {
+ wav->fact_pos = ff_start_tag(pb, "fact");
+ avio_wl32(pb, 0);
+ ff_end_tag(pb, wav->fact_pos);
+ }
+
+ if (wav->write_bext)
+ bwf_write_bext_chunk(s);
+
+ avpriv_set_pts_info(s->streams[0], 64, 1, s->streams[0]->codec->sample_rate);
+ wav->maxpts = wav->last_duration = 0;
+ wav->minpts = INT64_MAX;
+
+ /* info header */
+ ff_riff_write_info(s);
+
+ /* data header */
+ wav->data = ff_start_tag(pb, "data");
+
+ avio_flush(pb);
+
+ return 0;
+}
+
+static int wav_write_packet(AVFormatContext *s, AVPacket *pkt)
+{
+ AVIOContext *pb = s->pb;
+ WAVMuxContext *wav = s->priv_data;
+ avio_write(pb, pkt->data, pkt->size);
+ if(pkt->pts != AV_NOPTS_VALUE) {
+ wav->minpts = FFMIN(wav->minpts, pkt->pts);
+ wav->maxpts = FFMAX(wav->maxpts, pkt->pts);
+ wav->last_duration = pkt->duration;
+ } else
+ av_log(s, AV_LOG_ERROR, "wav_write_packet: NOPTS\n");
+ return 0;
+}
+
+static int wav_write_trailer(AVFormatContext *s)
+{
+ AVIOContext *pb = s->pb;
+ WAVMuxContext *wav = s->priv_data;
+ int64_t file_size;
+
+ avio_flush(pb);
+
+ if (s->pb->seekable) {
+ ff_end_tag(pb, wav->data);
+
+ /* update file size */
+ file_size = avio_tell(pb);
+ avio_seek(pb, 4, SEEK_SET);
+ avio_wl32(pb, (uint32_t)(file_size - 8));
+ avio_seek(pb, file_size, SEEK_SET);
+
+ avio_flush(pb);
+
+ if(s->streams[0]->codec->codec_tag != 0x01) {
+ /* Update num_samps in fact chunk */
+ int number_of_samples;
+ number_of_samples = av_rescale(wav->maxpts - wav->minpts + wav->last_duration,
+ s->streams[0]->codec->sample_rate * (int64_t)s->streams[0]->time_base.num,
+ s->streams[0]->time_base.den);
+ avio_seek(pb, wav->fact_pos, SEEK_SET);
+ avio_wl32(pb, number_of_samples);
+ avio_seek(pb, file_size, SEEK_SET);
+ avio_flush(pb);
+ }
+ }
+ return 0;
+}
+
+#define OFFSET(x) offsetof(WAVMuxContext, x)
+#define ENC AV_OPT_FLAG_ENCODING_PARAM
+static const AVOption options[] = {
+ { "write_bext", "Write BEXT chunk.", OFFSET(write_bext), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, ENC },
+ { NULL },
+};
+
+static const AVClass wav_muxer_class = {
+ .class_name = "WAV muxer",
+ .item_name = av_default_item_name,
+ .option = options,
+ .version = LIBAVUTIL_VERSION_INT,
+};
+
+AVOutputFormat ff_wav_muxer = {
+ .name = "wav",
+ .long_name = NULL_IF_CONFIG_SMALL("WAV / WAVE (Waveform Audio)"),
+ .mime_type = "audio/x-wav",
+ .extensions = "wav",
+ .priv_data_size = sizeof(WAVMuxContext),
+ .audio_codec = AV_CODEC_ID_PCM_S16LE,
+ .video_codec = AV_CODEC_ID_NONE,
+ .write_header = wav_write_header,
+ .write_packet = wav_write_packet,
+ .write_trailer = wav_write_trailer,
+ .flags = AVFMT_TS_NONSTRICT,
+ .codec_tag = (const AVCodecTag* const []){ ff_codec_wav_tags, 0 },
+ .priv_class = &wav_muxer_class,
+};
diff --git a/gst-libs/ext/libav/libavformat/wc3movie.c b/gst-libs/ext/libav/libavformat/wc3movie.c
index af5470f..c894253 100644
--- a/gst-libs/ext/libav/libavformat/wc3movie.c
+++ b/gst-libs/ext/libav/libavformat/wc3movie.c
@@ -27,6 +27,7 @@
* http://www.pcisys.net/~melanson/codecs/
*/
+#include "libavutil/channel_layout.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/dict.h"
#include "avformat.h"
@@ -83,8 +84,7 @@ static int wc3_probe(AVProbeData *p)
return AVPROBE_SCORE_MAX;
}
-static int wc3_read_header(AVFormatContext *s,
- AVFormatParameters *ap)
+static int wc3_read_header(AVFormatContext *s)
{
Wc3DemuxContext *wc3 = s->priv_data;
AVIOContext *pb = s->pb;
@@ -170,7 +170,7 @@ static int wc3_read_header(AVFormatContext *s,
avpriv_set_pts_info(st, 33, 1, WC3_FRAME_FPS);
wc3->video_stream_index = st->index;
st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
- st->codec->codec_id = CODEC_ID_XAN_WC3;
+ st->codec->codec_id = AV_CODEC_ID_XAN_WC3;
st->codec->codec_tag = 0; /* no fourcc */
st->codec->width = wc3->width;
st->codec->height = wc3->height;
@@ -181,9 +181,10 @@ static int wc3_read_header(AVFormatContext *s,
avpriv_set_pts_info(st, 33, 1, WC3_FRAME_FPS);
wc3->audio_stream_index = st->index;
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
- st->codec->codec_id = CODEC_ID_PCM_S16LE;
+ st->codec->codec_id = AV_CODEC_ID_PCM_S16LE;
st->codec->codec_tag = 1;
st->codec->channels = WC3_AUDIO_CHANNELS;
+ st->codec->channel_layout = AV_CH_LAYOUT_MONO;
st->codec->bits_per_coded_sample = WC3_AUDIO_BITS;
st->codec->sample_rate = WC3_SAMPLE_RATE;
st->codec->bit_rate = st->codec->channels * st->codec->sample_rate *
@@ -294,7 +295,7 @@ static int wc3_read_close(AVFormatContext *s)
AVInputFormat ff_wc3_demuxer = {
.name = "wc3movie",
- .long_name = NULL_IF_CONFIG_SMALL("Wing Commander III movie format"),
+ .long_name = NULL_IF_CONFIG_SMALL("Wing Commander III movie"),
.priv_data_size = sizeof(Wc3DemuxContext),
.read_probe = wc3_probe,
.read_header = wc3_read_header,
diff --git a/gst-libs/ext/libav/libavformat/westwood.c b/gst-libs/ext/libav/libavformat/westwood.c
deleted file mode 100644
index 82b7e94..0000000
--- a/gst-libs/ext/libav/libavformat/westwood.c
+++ /dev/null
@@ -1,394 +0,0 @@
-/*
- * Westwood Studios Multimedia Formats Demuxer (VQA, AUD)
- * Copyright (c) 2003 The ffmpeg Project
- *
- * 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
- * Westwood Studios VQA & AUD file demuxers
- * by Mike Melanson (melanson@pcisys.net)
- * for more information on the Westwood file formats, visit:
- * http://www.pcisys.net/~melanson/codecs/
- * http://www.geocities.com/SiliconValley/8682/aud3.txt
- *
- * Implementation note: There is no definite file signature for AUD files.
- * The demuxer uses a probabilistic strategy for content detection. This
- * entails performing sanity checks on certain header values in order to
- * qualify a file. Refer to wsaud_probe() for the precise parameters.
- */
-
-#include "libavutil/intreadwrite.h"
-#include "avformat.h"
-#include "internal.h"
-
-#define AUD_HEADER_SIZE 12
-#define AUD_CHUNK_PREAMBLE_SIZE 8
-#define AUD_CHUNK_SIGNATURE 0x0000DEAF
-
-#define FORM_TAG MKBETAG('F', 'O', 'R', 'M')
-#define WVQA_TAG MKBETAG('W', 'V', 'Q', 'A')
-#define VQHD_TAG MKBETAG('V', 'Q', 'H', 'D')
-#define FINF_TAG MKBETAG('F', 'I', 'N', 'F')
-#define SND0_TAG MKBETAG('S', 'N', 'D', '0')
-#define SND1_TAG MKBETAG('S', 'N', 'D', '1')
-#define SND2_TAG MKBETAG('S', 'N', 'D', '2')
-#define VQFR_TAG MKBETAG('V', 'Q', 'F', 'R')
-
-/* don't know what these tags are for, but acknowledge their existence */
-#define CINF_TAG MKBETAG('C', 'I', 'N', 'F')
-#define CINH_TAG MKBETAG('C', 'I', 'N', 'H')
-#define CIND_TAG MKBETAG('C', 'I', 'N', 'D')
-#define PINF_TAG MKBETAG('P', 'I', 'N', 'F')
-#define PINH_TAG MKBETAG('P', 'I', 'N', 'H')
-#define PIND_TAG MKBETAG('P', 'I', 'N', 'D')
-#define CMDS_TAG MKBETAG('C', 'M', 'D', 'S')
-
-#define VQA_HEADER_SIZE 0x2A
-#define VQA_FRAMERATE 15
-#define VQA_PREAMBLE_SIZE 8
-
-typedef struct WsAudDemuxContext {
- int audio_samplerate;
- int audio_channels;
- int audio_bits;
- enum CodecID audio_type;
- int audio_stream_index;
- int64_t audio_frame_counter;
-} WsAudDemuxContext;
-
-typedef struct WsVqaDemuxContext {
- int audio_samplerate;
- int audio_channels;
- int audio_bits;
-
- int audio_stream_index;
- int video_stream_index;
-
- int64_t audio_frame_counter;
-} WsVqaDemuxContext;
-
-static int wsaud_probe(AVProbeData *p)
-{
- int field;
-
- /* Probabilistic content detection strategy: There is no file signature
- * so perform sanity checks on various header parameters:
- * 8000 <= sample rate (16 bits) <= 48000 ==> 40001 acceptable numbers
- * flags <= 0x03 (2 LSBs are used) ==> 4 acceptable numbers
- * compression type (8 bits) = 1 or 99 ==> 2 acceptable numbers
- * first audio chunk signature (32 bits) ==> 1 acceptable number
- * The number space contains 2^64 numbers. There are 40001 * 4 * 2 * 1 =
- * 320008 acceptable number combinations.
- */
-
- if (p->buf_size < AUD_HEADER_SIZE + AUD_CHUNK_PREAMBLE_SIZE)
- return 0;
-
- /* check sample rate */
- field = AV_RL16(&p->buf[0]);
- if ((field < 8000) || (field > 48000))
- return 0;
-
- /* enforce the rule that the top 6 bits of this flags field are reserved (0);
- * this might not be true, but enforce it until deemed unnecessary */
- if (p->buf[10] & 0xFC)
- return 0;
-
- /* note: only check for WS IMA (type 99) right now since there is no
- * support for type 1 */
- if (p->buf[11] != 99)
- return 0;
-
- /* read ahead to the first audio chunk and validate the first header signature */
- if (AV_RL32(&p->buf[16]) != AUD_CHUNK_SIGNATURE)
- return 0;
-
- /* return 1/2 certainty since this file check is a little sketchy */
- return AVPROBE_SCORE_MAX / 2;
-}
-
-static int wsaud_read_header(AVFormatContext *s,
- AVFormatParameters *ap)
-{
- WsAudDemuxContext *wsaud = s->priv_data;
- AVIOContext *pb = s->pb;
- AVStream *st;
- unsigned char header[AUD_HEADER_SIZE];
-
- if (avio_read(pb, header, AUD_HEADER_SIZE) != AUD_HEADER_SIZE)
- return AVERROR(EIO);
- wsaud->audio_samplerate = AV_RL16(&header[0]);
- if (header[11] == 99)
- wsaud->audio_type = CODEC_ID_ADPCM_IMA_WS;
- else
- return AVERROR_INVALIDDATA;
-
- /* flag 0 indicates stereo */
- wsaud->audio_channels = (header[10] & 0x1) + 1;
- /* flag 1 indicates 16 bit audio */
- wsaud->audio_bits = (((header[10] & 0x2) >> 1) + 1) * 8;
-
- /* initialize the audio decoder stream */
- st = avformat_new_stream(s, NULL);
- if (!st)
- return AVERROR(ENOMEM);
- avpriv_set_pts_info(st, 33, 1, wsaud->audio_samplerate);
- st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
- st->codec->codec_id = wsaud->audio_type;
- st->codec->codec_tag = 0; /* no tag */
- st->codec->channels = wsaud->audio_channels;
- st->codec->sample_rate = wsaud->audio_samplerate;
- st->codec->bits_per_coded_sample = wsaud->audio_bits;
- st->codec->bit_rate = st->codec->channels * st->codec->sample_rate *
- st->codec->bits_per_coded_sample / 4;
- st->codec->block_align = st->codec->channels * st->codec->bits_per_coded_sample;
-
- wsaud->audio_stream_index = st->index;
- wsaud->audio_frame_counter = 0;
-
- return 0;
-}
-
-static int wsaud_read_packet(AVFormatContext *s,
- AVPacket *pkt)
-{
- WsAudDemuxContext *wsaud = s->priv_data;
- AVIOContext *pb = s->pb;
- unsigned char preamble[AUD_CHUNK_PREAMBLE_SIZE];
- unsigned int chunk_size;
- int ret = 0;
-
- if (avio_read(pb, preamble, AUD_CHUNK_PREAMBLE_SIZE) !=
- AUD_CHUNK_PREAMBLE_SIZE)
- return AVERROR(EIO);
-
- /* validate the chunk */
- if (AV_RL32(&preamble[4]) != AUD_CHUNK_SIGNATURE)
- return AVERROR_INVALIDDATA;
-
- chunk_size = AV_RL16(&preamble[0]);
- ret= av_get_packet(pb, pkt, chunk_size);
- if (ret != chunk_size)
- return AVERROR(EIO);
- pkt->stream_index = wsaud->audio_stream_index;
- pkt->pts = wsaud->audio_frame_counter;
- pkt->pts /= wsaud->audio_samplerate;
-
- /* 2 samples/byte, 1 or 2 samples per frame depending on stereo */
- wsaud->audio_frame_counter += (chunk_size * 2) / wsaud->audio_channels;
-
- return ret;
-}
-
-static int wsvqa_probe(AVProbeData *p)
-{
- /* need 12 bytes to qualify */
- if (p->buf_size < 12)
- return 0;
-
- /* check for the VQA signatures */
- if ((AV_RB32(&p->buf[0]) != FORM_TAG) ||
- (AV_RB32(&p->buf[8]) != WVQA_TAG))
- return 0;
-
- return AVPROBE_SCORE_MAX;
-}
-
-static int wsvqa_read_header(AVFormatContext *s,
- AVFormatParameters *ap)
-{
- WsVqaDemuxContext *wsvqa = s->priv_data;
- AVIOContext *pb = s->pb;
- AVStream *st;
- unsigned char *header;
- unsigned char scratch[VQA_PREAMBLE_SIZE];
- unsigned int chunk_tag;
- unsigned int chunk_size;
-
- /* initialize the video decoder stream */
- st = avformat_new_stream(s, NULL);
- if (!st)
- return AVERROR(ENOMEM);
- avpriv_set_pts_info(st, 33, 1, VQA_FRAMERATE);
- wsvqa->video_stream_index = st->index;
- st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
- st->codec->codec_id = CODEC_ID_WS_VQA;
- st->codec->codec_tag = 0; /* no fourcc */
-
- /* skip to the start of the VQA header */
- avio_seek(pb, 20, SEEK_SET);
-
- /* the VQA header needs to go to the decoder */
- st->codec->extradata_size = VQA_HEADER_SIZE;
- st->codec->extradata = av_mallocz(VQA_HEADER_SIZE + FF_INPUT_BUFFER_PADDING_SIZE);
- header = (unsigned char *)st->codec->extradata;
- if (avio_read(pb, st->codec->extradata, VQA_HEADER_SIZE) !=
- VQA_HEADER_SIZE) {
- av_free(st->codec->extradata);
- return AVERROR(EIO);
- }
- st->codec->width = AV_RL16(&header[6]);
- st->codec->height = AV_RL16(&header[8]);
-
- /* initialize the audio decoder stream for VQA v1 or nonzero samplerate */
- if (AV_RL16(&header[24]) || (AV_RL16(&header[0]) == 1 && AV_RL16(&header[2]) == 1)) {
- st = avformat_new_stream(s, NULL);
- if (!st)
- return AVERROR(ENOMEM);
- avpriv_set_pts_info(st, 33, 1, VQA_FRAMERATE);
- st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
- if (AV_RL16(&header[0]) == 1)
- st->codec->codec_id = CODEC_ID_WESTWOOD_SND1;
- else
- st->codec->codec_id = CODEC_ID_ADPCM_IMA_WS;
- st->codec->codec_tag = 0; /* no tag */
- st->codec->sample_rate = AV_RL16(&header[24]);
- if (!st->codec->sample_rate)
- st->codec->sample_rate = 22050;
- st->codec->channels = header[26];
- if (!st->codec->channels)
- st->codec->channels = 1;
- st->codec->bits_per_coded_sample = 16;
- st->codec->bit_rate = st->codec->channels * st->codec->sample_rate *
- st->codec->bits_per_coded_sample / 4;
- st->codec->block_align = st->codec->channels * st->codec->bits_per_coded_sample;
-
- wsvqa->audio_stream_index = st->index;
- wsvqa->audio_samplerate = st->codec->sample_rate;
- wsvqa->audio_channels = st->codec->channels;
- wsvqa->audio_frame_counter = 0;
- }
-
- /* there are 0 or more chunks before the FINF chunk; iterate until
- * FINF has been skipped and the file will be ready to be demuxed */
- do {
- if (avio_read(pb, scratch, VQA_PREAMBLE_SIZE) != VQA_PREAMBLE_SIZE) {
- av_free(st->codec->extradata);
- return AVERROR(EIO);
- }
- chunk_tag = AV_RB32(&scratch[0]);
- chunk_size = AV_RB32(&scratch[4]);
-
- /* catch any unknown header tags, for curiousity */
- switch (chunk_tag) {
- case CINF_TAG:
- case CINH_TAG:
- case CIND_TAG:
- case PINF_TAG:
- case PINH_TAG:
- case PIND_TAG:
- case FINF_TAG:
- case CMDS_TAG:
- break;
-
- default:
- av_log (s, AV_LOG_ERROR, " note: unknown chunk seen (%c%c%c%c)\n",
- scratch[0], scratch[1],
- scratch[2], scratch[3]);
- break;
- }
-
- avio_skip(pb, chunk_size);
- } while (chunk_tag != FINF_TAG);
-
- return 0;
-}
-
-static int wsvqa_read_packet(AVFormatContext *s,
- AVPacket *pkt)
-{
- WsVqaDemuxContext *wsvqa = s->priv_data;
- AVIOContext *pb = s->pb;
- int ret = -1;
- unsigned char preamble[VQA_PREAMBLE_SIZE];
- unsigned int chunk_type;
- unsigned int chunk_size;
- int skip_byte;
-
- while (avio_read(pb, preamble, VQA_PREAMBLE_SIZE) == VQA_PREAMBLE_SIZE) {
- chunk_type = AV_RB32(&preamble[0]);
- chunk_size = AV_RB32(&preamble[4]);
- skip_byte = chunk_size & 0x01;
-
- if ((chunk_type == SND2_TAG || chunk_type == SND1_TAG) && wsvqa->audio_channels == 0) {
- av_log(s, AV_LOG_ERROR, "audio chunk without any audio header information found\n");
- return AVERROR_INVALIDDATA;
- }
-
- if ((chunk_type == SND1_TAG) || (chunk_type == SND2_TAG) || (chunk_type == VQFR_TAG)) {
-
- if (av_new_packet(pkt, chunk_size))
- return AVERROR(EIO);
- ret = avio_read(pb, pkt->data, chunk_size);
- if (ret != chunk_size) {
- av_free_packet(pkt);
- return AVERROR(EIO);
- }
-
- if (chunk_type == SND2_TAG) {
- pkt->stream_index = wsvqa->audio_stream_index;
- /* 2 samples/byte, 1 or 2 samples per frame depending on stereo */
- wsvqa->audio_frame_counter += (chunk_size * 2) / wsvqa->audio_channels;
- } else if(chunk_type == SND1_TAG) {
- pkt->stream_index = wsvqa->audio_stream_index;
- /* unpacked size is stored in header */
- wsvqa->audio_frame_counter += AV_RL16(pkt->data) / wsvqa->audio_channels;
- } else {
- pkt->stream_index = wsvqa->video_stream_index;
- }
- /* stay on 16-bit alignment */
- if (skip_byte)
- avio_skip(pb, 1);
-
- return ret;
- } else {
- switch(chunk_type){
- case CMDS_TAG:
- case SND0_TAG:
- break;
- default:
- av_log(s, AV_LOG_INFO, "Skipping unknown chunk 0x%08X\n", chunk_type);
- }
- avio_skip(pb, chunk_size + skip_byte);
- }
- }
-
- return ret;
-}
-
-#if CONFIG_WSAUD_DEMUXER
-AVInputFormat ff_wsaud_demuxer = {
- .name = "wsaud",
- .long_name = NULL_IF_CONFIG_SMALL("Westwood Studios audio format"),
- .priv_data_size = sizeof(WsAudDemuxContext),
- .read_probe = wsaud_probe,
- .read_header = wsaud_read_header,
- .read_packet = wsaud_read_packet,
-};
-#endif
-#if CONFIG_WSVQA_DEMUXER
-AVInputFormat ff_wsvqa_demuxer = {
- .name = "wsvqa",
- .long_name = NULL_IF_CONFIG_SMALL("Westwood Studios VQA format"),
- .priv_data_size = sizeof(WsVqaDemuxContext),
- .read_probe = wsvqa_probe,
- .read_header = wsvqa_read_header,
- .read_packet = wsvqa_read_packet,
-};
-#endif
diff --git a/gst-libs/ext/libav/libavformat/westwood_aud.c b/gst-libs/ext/libav/libavformat/westwood_aud.c
new file mode 100644
index 0000000..2a06c29
--- /dev/null
+++ b/gst-libs/ext/libav/libavformat/westwood_aud.c
@@ -0,0 +1,183 @@
+/*
+ * Westwood Studios AUD Format Demuxer
+ * Copyright (c) 2003 The ffmpeg Project
+ *
+ * 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
+ * Westwood Studios AUD file demuxer
+ * by Mike Melanson (melanson@pcisys.net)
+ * for more information on the Westwood file formats, visit:
+ * http://www.pcisys.net/~melanson/codecs/
+ * http://www.geocities.com/SiliconValley/8682/aud3.txt
+ *
+ * Implementation note: There is no definite file signature for AUD files.
+ * The demuxer uses a probabilistic strategy for content detection. This
+ * entails performing sanity checks on certain header values in order to
+ * qualify a file. Refer to wsaud_probe() for the precise parameters.
+ */
+
+#include "libavutil/channel_layout.h"
+#include "libavutil/intreadwrite.h"
+#include "avformat.h"
+#include "internal.h"
+
+#define AUD_HEADER_SIZE 12
+#define AUD_CHUNK_PREAMBLE_SIZE 8
+#define AUD_CHUNK_SIGNATURE 0x0000DEAF
+
+static int wsaud_probe(AVProbeData *p)
+{
+ int field;
+
+ /* Probabilistic content detection strategy: There is no file signature
+ * so perform sanity checks on various header parameters:
+ * 8000 <= sample rate (16 bits) <= 48000 ==> 40001 acceptable numbers
+ * flags <= 0x03 (2 LSBs are used) ==> 4 acceptable numbers
+ * compression type (8 bits) = 1 or 99 ==> 2 acceptable numbers
+ * first audio chunk signature (32 bits) ==> 1 acceptable number
+ * The number space contains 2^64 numbers. There are 40001 * 4 * 2 * 1 =
+ * 320008 acceptable number combinations.
+ */
+
+ if (p->buf_size < AUD_HEADER_SIZE + AUD_CHUNK_PREAMBLE_SIZE)
+ return 0;
+
+ /* check sample rate */
+ field = AV_RL16(&p->buf[0]);
+ if ((field < 8000) || (field > 48000))
+ return 0;
+
+ /* enforce the rule that the top 6 bits of this flags field are reserved (0);
+ * this might not be true, but enforce it until deemed unnecessary */
+ if (p->buf[10] & 0xFC)
+ return 0;
+
+ /* note: only check for WS IMA (type 99) right now since there is no
+ * support for type 1 */
+ if (p->buf[11] != 99 && p->buf[11] != 1)
+ return 0;
+
+ /* read ahead to the first audio chunk and validate the first header signature */
+ if (AV_RL32(&p->buf[16]) != AUD_CHUNK_SIGNATURE)
+ return 0;
+
+ /* return 1/2 certainty since this file check is a little sketchy */
+ return AVPROBE_SCORE_MAX / 2;
+}
+
+static int wsaud_read_header(AVFormatContext *s)
+{
+ AVIOContext *pb = s->pb;
+ AVStream *st;
+ unsigned char header[AUD_HEADER_SIZE];
+ int sample_rate, channels, codec;
+
+ if (avio_read(pb, header, AUD_HEADER_SIZE) != AUD_HEADER_SIZE)
+ return AVERROR(EIO);
+
+ sample_rate = AV_RL16(&header[0]);
+ channels = (header[10] & 0x1) + 1;
+ codec = header[11];
+
+ /* initialize the audio decoder stream */
+ st = avformat_new_stream(s, NULL);
+ if (!st)
+ return AVERROR(ENOMEM);
+
+ switch (codec) {
+ case 1:
+ if (channels != 1) {
+ av_log_ask_for_sample(s, "Stereo WS-SND1 is not supported.\n");
+ return AVERROR_PATCHWELCOME;
+ }
+ st->codec->codec_id = AV_CODEC_ID_WESTWOOD_SND1;
+ break;
+ case 99:
+ st->codec->codec_id = AV_CODEC_ID_ADPCM_IMA_WS;
+ st->codec->bits_per_coded_sample = 4;
+ st->codec->bit_rate = channels * sample_rate * 4;
+ break;
+ default:
+ av_log_ask_for_sample(s, "Unknown codec: %d\n", codec);
+ return AVERROR_PATCHWELCOME;
+ }
+ avpriv_set_pts_info(st, 64, 1, sample_rate);
+ st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
+ st->codec->channels = channels;
+ st->codec->channel_layout = channels == 1 ? AV_CH_LAYOUT_MONO :
+ AV_CH_LAYOUT_STEREO;
+ st->codec->sample_rate = sample_rate;
+
+ return 0;
+}
+
+static int wsaud_read_packet(AVFormatContext *s,
+ AVPacket *pkt)
+{
+ AVIOContext *pb = s->pb;
+ unsigned char preamble[AUD_CHUNK_PREAMBLE_SIZE];
+ unsigned int chunk_size;
+ int ret = 0;
+ AVStream *st = s->streams[0];
+
+ if (avio_read(pb, preamble, AUD_CHUNK_PREAMBLE_SIZE) !=
+ AUD_CHUNK_PREAMBLE_SIZE)
+ return AVERROR(EIO);
+
+ /* validate the chunk */
+ if (AV_RL32(&preamble[4]) != AUD_CHUNK_SIGNATURE)
+ return AVERROR_INVALIDDATA;
+
+ chunk_size = AV_RL16(&preamble[0]);
+
+ if (st->codec->codec_id == AV_CODEC_ID_WESTWOOD_SND1) {
+ /* For Westwood SND1 audio we need to add the output size and input
+ size to the start of the packet to match what is in VQA.
+ Specifically, this is needed to signal when a packet should be
+ decoding as raw 8-bit pcm or variable-size ADPCM. */
+ int out_size = AV_RL16(&preamble[2]);
+ if ((ret = av_new_packet(pkt, chunk_size + 4)))
+ return ret;
+ if ((ret = avio_read(pb, &pkt->data[4], chunk_size)) != chunk_size)
+ return ret < 0 ? ret : AVERROR(EIO);
+ AV_WL16(&pkt->data[0], out_size);
+ AV_WL16(&pkt->data[2], chunk_size);
+
+ pkt->duration = out_size;
+ } else {
+ ret = av_get_packet(pb, pkt, chunk_size);
+ if (ret != chunk_size)
+ return AVERROR(EIO);
+
+ /* 2 samples/byte, 1 or 2 samples per frame depending on stereo */
+ pkt->duration = (chunk_size * 2) / st->codec->channels;
+ }
+ pkt->stream_index = st->index;
+
+ return ret;
+}
+
+AVInputFormat ff_wsaud_demuxer = {
+ .name = "wsaud",
+ .long_name = NULL_IF_CONFIG_SMALL("Westwood Studios audio"),
+ .read_probe = wsaud_probe,
+ .read_header = wsaud_read_header,
+ .read_packet = wsaud_read_packet,
+};
diff --git a/gst-libs/ext/libav/libavformat/westwood_vqa.c b/gst-libs/ext/libav/libavformat/westwood_vqa.c
new file mode 100644
index 0000000..7c9cb0d
--- /dev/null
+++ b/gst-libs/ext/libav/libavformat/westwood_vqa.c
@@ -0,0 +1,281 @@
+/*
+ * Westwood Studios VQA Format Demuxer
+ * Copyright (c) 2003 The ffmpeg Project
+ *
+ * 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
+ * Westwood Studios VQA file demuxer
+ * by Mike Melanson (melanson@pcisys.net)
+ * for more information on the Westwood file formats, visit:
+ * http://www.pcisys.net/~melanson/codecs/
+ * http://www.geocities.com/SiliconValley/8682/aud3.txt
+ */
+
+#include "libavutil/intreadwrite.h"
+#include "avformat.h"
+#include "internal.h"
+
+#define FORM_TAG MKBETAG('F', 'O', 'R', 'M')
+#define WVQA_TAG MKBETAG('W', 'V', 'Q', 'A')
+#define VQHD_TAG MKBETAG('V', 'Q', 'H', 'D')
+#define FINF_TAG MKBETAG('F', 'I', 'N', 'F')
+#define SND0_TAG MKBETAG('S', 'N', 'D', '0')
+#define SND1_TAG MKBETAG('S', 'N', 'D', '1')
+#define SND2_TAG MKBETAG('S', 'N', 'D', '2')
+#define VQFR_TAG MKBETAG('V', 'Q', 'F', 'R')
+
+/* don't know what these tags are for, but acknowledge their existence */
+#define CINF_TAG MKBETAG('C', 'I', 'N', 'F')
+#define CINH_TAG MKBETAG('C', 'I', 'N', 'H')
+#define CIND_TAG MKBETAG('C', 'I', 'N', 'D')
+#define PINF_TAG MKBETAG('P', 'I', 'N', 'F')
+#define PINH_TAG MKBETAG('P', 'I', 'N', 'H')
+#define PIND_TAG MKBETAG('P', 'I', 'N', 'D')
+#define CMDS_TAG MKBETAG('C', 'M', 'D', 'S')
+
+#define VQA_HEADER_SIZE 0x2A
+#define VQA_PREAMBLE_SIZE 8
+
+typedef struct WsVqaDemuxContext {
+ int version;
+ int bps;
+ int channels;
+ int sample_rate;
+ int audio_stream_index;
+ int video_stream_index;
+} WsVqaDemuxContext;
+
+static int wsvqa_probe(AVProbeData *p)
+{
+ /* need 12 bytes to qualify */
+ if (p->buf_size < 12)
+ return 0;
+
+ /* check for the VQA signatures */
+ if ((AV_RB32(&p->buf[0]) != FORM_TAG) ||
+ (AV_RB32(&p->buf[8]) != WVQA_TAG))
+ return 0;
+
+ return AVPROBE_SCORE_MAX;
+}
+
+static int wsvqa_read_header(AVFormatContext *s)
+{
+ WsVqaDemuxContext *wsvqa = s->priv_data;
+ AVIOContext *pb = s->pb;
+ AVStream *st;
+ unsigned char *header;
+ unsigned char scratch[VQA_PREAMBLE_SIZE];
+ unsigned int chunk_tag;
+ unsigned int chunk_size;
+ int fps;
+
+ /* initialize the video decoder stream */
+ st = avformat_new_stream(s, NULL);
+ if (!st)
+ return AVERROR(ENOMEM);
+ st->start_time = 0;
+ wsvqa->video_stream_index = st->index;
+ st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
+ st->codec->codec_id = AV_CODEC_ID_WS_VQA;
+ st->codec->codec_tag = 0; /* no fourcc */
+
+ /* skip to the start of the VQA header */
+ avio_seek(pb, 20, SEEK_SET);
+
+ /* the VQA header needs to go to the decoder */
+ st->codec->extradata_size = VQA_HEADER_SIZE;
+ st->codec->extradata = av_mallocz(VQA_HEADER_SIZE + FF_INPUT_BUFFER_PADDING_SIZE);
+ header = (unsigned char *)st->codec->extradata;
+ if (avio_read(pb, st->codec->extradata, VQA_HEADER_SIZE) !=
+ VQA_HEADER_SIZE) {
+ av_free(st->codec->extradata);
+ return AVERROR(EIO);
+ }
+ st->codec->width = AV_RL16(&header[6]);
+ st->codec->height = AV_RL16(&header[8]);
+ fps = header[12];
+ st->nb_frames =
+ st->duration = AV_RL16(&header[4]);
+ if (fps < 1 || fps > 30) {
+ av_log(s, AV_LOG_ERROR, "invalid fps: %d\n", fps);
+ return AVERROR_INVALIDDATA;
+ }
+ avpriv_set_pts_info(st, 64, 1, fps);
+
+ wsvqa->version = AV_RL16(&header[ 0]);
+ wsvqa->sample_rate = AV_RL16(&header[24]);
+ wsvqa->channels = header[26];
+ wsvqa->bps = header[27];
+ wsvqa->audio_stream_index = -1;
+
+ s->ctx_flags |= AVFMTCTX_NOHEADER;
+
+ /* there are 0 or more chunks before the FINF chunk; iterate until
+ * FINF has been skipped and the file will be ready to be demuxed */
+ do {
+ if (avio_read(pb, scratch, VQA_PREAMBLE_SIZE) != VQA_PREAMBLE_SIZE) {
+ av_free(st->codec->extradata);
+ return AVERROR(EIO);
+ }
+ chunk_tag = AV_RB32(&scratch[0]);
+ chunk_size = AV_RB32(&scratch[4]);
+
+ /* catch any unknown header tags, for curiousity */
+ switch (chunk_tag) {
+ case CINF_TAG:
+ case CINH_TAG:
+ case CIND_TAG:
+ case PINF_TAG:
+ case PINH_TAG:
+ case PIND_TAG:
+ case FINF_TAG:
+ case CMDS_TAG:
+ break;
+
+ default:
+ av_log (s, AV_LOG_ERROR, " note: unknown chunk seen (%c%c%c%c)\n",
+ scratch[0], scratch[1],
+ scratch[2], scratch[3]);
+ break;
+ }
+
+ avio_skip(pb, chunk_size);
+ } while (chunk_tag != FINF_TAG);
+
+ return 0;
+}
+
+static int wsvqa_read_packet(AVFormatContext *s,
+ AVPacket *pkt)
+{
+ WsVqaDemuxContext *wsvqa = s->priv_data;
+ AVIOContext *pb = s->pb;
+ int ret = -1;
+ unsigned char preamble[VQA_PREAMBLE_SIZE];
+ unsigned int chunk_type;
+ unsigned int chunk_size;
+ int skip_byte;
+
+ while (avio_read(pb, preamble, VQA_PREAMBLE_SIZE) == VQA_PREAMBLE_SIZE) {
+ chunk_type = AV_RB32(&preamble[0]);
+ chunk_size = AV_RB32(&preamble[4]);
+ skip_byte = chunk_size & 0x01;
+
+ if ((chunk_type == SND0_TAG) || (chunk_type == SND1_TAG) ||
+ (chunk_type == SND2_TAG) || (chunk_type == VQFR_TAG)) {
+
+ if (av_new_packet(pkt, chunk_size))
+ return AVERROR(EIO);
+ ret = avio_read(pb, pkt->data, chunk_size);
+ if (ret != chunk_size) {
+ av_free_packet(pkt);
+ return AVERROR(EIO);
+ }
+
+ switch (chunk_type) {
+ case SND0_TAG:
+ case SND1_TAG:
+ case SND2_TAG:
+ if (wsvqa->audio_stream_index == -1) {
+ AVStream *st = avformat_new_stream(s, NULL);
+ if (!st)
+ return AVERROR(ENOMEM);
+
+ wsvqa->audio_stream_index = st->index;
+ if (!wsvqa->sample_rate)
+ wsvqa->sample_rate = 22050;
+ if (!wsvqa->channels)
+ wsvqa->channels = 1;
+ if (!wsvqa->bps)
+ wsvqa->bps = 8;
+ st->codec->sample_rate = wsvqa->sample_rate;
+ st->codec->bits_per_coded_sample = wsvqa->bps;
+ st->codec->channels = wsvqa->channels;
+ st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
+
+ avpriv_set_pts_info(st, 64, 1, st->codec->sample_rate);
+
+ switch (chunk_type) {
+ case SND0_TAG:
+ if (wsvqa->bps == 16)
+ st->codec->codec_id = AV_CODEC_ID_PCM_S16LE;
+ else
+ st->codec->codec_id = AV_CODEC_ID_PCM_U8;
+ break;
+ case SND1_TAG:
+ st->codec->codec_id = AV_CODEC_ID_WESTWOOD_SND1;
+ break;
+ case SND2_TAG:
+ st->codec->codec_id = AV_CODEC_ID_ADPCM_IMA_WS;
+ st->codec->extradata_size = 2;
+ st->codec->extradata = av_mallocz(2 + FF_INPUT_BUFFER_PADDING_SIZE);
+ if (!st->codec->extradata)
+ return AVERROR(ENOMEM);
+ AV_WL16(st->codec->extradata, wsvqa->version);
+ break;
+ }
+ }
+
+ pkt->stream_index = wsvqa->audio_stream_index;
+ switch (chunk_type) {
+ case SND1_TAG:
+ /* unpacked size is stored in header */
+ pkt->duration = AV_RL16(pkt->data) / wsvqa->channels;
+ break;
+ case SND2_TAG:
+ /* 2 samples/byte, 1 or 2 samples per frame depending on stereo */
+ pkt->duration = (chunk_size * 2) / wsvqa->channels;
+ break;
+ }
+ break;
+ case VQFR_TAG:
+ pkt->stream_index = wsvqa->video_stream_index;
+ pkt->duration = 1;
+ break;
+ }
+
+ /* stay on 16-bit alignment */
+ if (skip_byte)
+ avio_skip(pb, 1);
+
+ return ret;
+ } else {
+ switch(chunk_type){
+ case CMDS_TAG:
+ break;
+ default:
+ av_log(s, AV_LOG_INFO, "Skipping unknown chunk 0x%08X\n", chunk_type);
+ }
+ avio_skip(pb, chunk_size + skip_byte);
+ }
+ }
+
+ return ret;
+}
+
+AVInputFormat ff_wsvqa_demuxer = {
+ .name = "wsvqa",
+ .long_name = NULL_IF_CONFIG_SMALL("Westwood Studios VQA"),
+ .priv_data_size = sizeof(WsVqaDemuxContext),
+ .read_probe = wsvqa_probe,
+ .read_header = wsvqa_read_header,
+ .read_packet = wsvqa_read_packet,
+};
diff --git a/gst-libs/ext/libav/libavformat/wtv.c b/gst-libs/ext/libav/libavformat/wtv.c
index c619868..2e5d39c 100644
--- a/gst-libs/ext/libav/libavformat/wtv.c
+++ b/gst-libs/ext/libav/libavformat/wtv.c
@@ -25,6 +25,7 @@
* @author Peter Ross <pross@xvid.org>
*/
+#include "libavutil/channel_layout.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/intfloat.h"
#include "libavutil/dict.h"
@@ -220,7 +221,7 @@ static AVIOContext * wtvfile_open_sector(int first_sector, uint64_t length, int
}
wf->length = length;
- /* seek to intial sector */
+ /* seek to initial sector */
wf->position = 0;
if (avio_seek(s->pb, (int64_t)wf->sectors[0] << WTV_SECTOR_BITS, SEEK_SET) < 0) {
av_free(wf->sectors);
@@ -331,18 +332,18 @@ typedef struct {
} WtvContext;
typedef struct {
- enum CodecID id;
+ enum AVCodecID id;
ff_asf_guid guid;
} AVCodecGuid;
-static enum CodecID ff_codec_guid_get_id(const AVCodecGuid *guids, ff_asf_guid guid)
+static enum AVCodecID ff_codec_guid_get_id(const AVCodecGuid *guids, ff_asf_guid guid)
{
int i;
- for (i = 0; guids[i].id != CODEC_ID_NONE; i++) {
+ for (i = 0; guids[i].id != AV_CODEC_ID_NONE; i++) {
if (!ff_guidcmp(guids[i].guid, guid))
return guids[i].id;
}
- return CODEC_ID_NONE;
+ return AV_CODEC_ID_NONE;
}
/* WTV GUIDs */
@@ -421,15 +422,15 @@ static const ff_asf_guid format_none =
{0xD6,0x17,0x64,0x0F,0x18,0xC3,0xD0,0x11,0xA4,0x3F,0x00,0xA0,0xC9,0x22,0x31,0x96};
static const AVCodecGuid video_guids[] = {
- {CODEC_ID_MPEG2VIDEO, {0x26,0x80,0x6D,0xE0,0x46,0xDB,0xCF,0x11,0xB4,0xD1,0x00,0x80,0x5F,0x6C,0xBB,0xEA}},
- {CODEC_ID_NONE}
+ {AV_CODEC_ID_MPEG2VIDEO, {0x26,0x80,0x6D,0xE0,0x46,0xDB,0xCF,0x11,0xB4,0xD1,0x00,0x80,0x5F,0x6C,0xBB,0xEA}},
+ {AV_CODEC_ID_NONE}
};
static const AVCodecGuid audio_guids[] = {
- {CODEC_ID_AC3, {0x2C,0x80,0x6D,0xE0,0x46,0xDB,0xCF,0x11,0xB4,0xD1,0x00,0x80,0x5F,0x6C,0xBB,0xEA}},
- {CODEC_ID_EAC3, {0xAF,0x87,0xFB,0xA7,0x02,0x2D,0xFB,0x42,0xA4,0xD4,0x05,0xCD,0x93,0x84,0x3B,0xDD}},
- {CODEC_ID_MP2, {0x2B,0x80,0x6D,0xE0,0x46,0xDB,0xCF,0x11,0xB4,0xD1,0x00,0x80,0x5F,0x6C,0xBB,0xEA}},
- {CODEC_ID_NONE}
+ {AV_CODEC_ID_AC3, {0x2C,0x80,0x6D,0xE0,0x46,0xDB,0xCF,0x11,0xB4,0xD1,0x00,0x80,0x5F,0x6C,0xBB,0xEA}},
+ {AV_CODEC_ID_EAC3, {0xAF,0x87,0xFB,0xA7,0x02,0x2D,0xFB,0x42,0xA4,0xD4,0x05,0xCD,0x93,0x84,0x3B,0xDD}},
+ {AV_CODEC_ID_MP2, {0x2B,0x80,0x6D,0xE0,0x46,0xDB,0xCF,0x11,0xB4,0xD1,0x00,0x80,0x5F,0x6C,0xBB,0xEA}},
+ {AV_CODEC_ID_NONE}
};
static int read_probe(AVProbeData *p)
@@ -443,7 +444,11 @@ static int read_probe(AVProbeData *p)
static void filetime_to_iso8601(char *buf, int buf_size, int64_t value)
{
time_t t = (value / 10000000LL) - 11644473600LL;
- strftime(buf, buf_size, "%Y-%m-%d %H:%M:%S", gmtime(&t));
+ struct tm *tm = gmtime(&t);
+ if (tm)
+ strftime(buf, buf_size, "%Y-%m-%d %H:%M:%S", gmtime(&t));
+ else
+ buf[0] = '\0';
}
/**
@@ -452,7 +457,11 @@ static void filetime_to_iso8601(char *buf, int buf_size, int64_t value)
static void crazytime_to_iso8601(char *buf, int buf_size, int64_t value)
{
time_t t = (value / 10000000LL) - 719162LL*86400LL;
- strftime(buf, buf_size, "%Y-%m-%d %H:%M:%S", gmtime(&t));
+ struct tm *tm = gmtime(&t);
+ if (tm)
+ strftime(buf, buf_size, "%Y-%m-%d %H:%M:%S", gmtime(&t));
+ else
+ buf[0] = '\0';
}
/**
@@ -461,7 +470,11 @@ static void crazytime_to_iso8601(char *buf, int buf_size, int64_t value)
static void oledate_to_iso8601(char *buf, int buf_size, int64_t value)
{
time_t t = 631112400LL + 86400*av_int2double(value);
- strftime(buf, buf_size, "%Y-%m-%d %H:%M:%S", gmtime(&t));
+ struct tm *tm = gmtime(&t);
+ if (tm)
+ strftime(buf, buf_size, "%Y-%m-%d %H:%M:%S", gmtime(&t));
+ else
+ buf[0] = '\0';
}
static void get_attachment(AVFormatContext *s, AVIOContext *pb, int length)
@@ -486,7 +499,7 @@ static void get_attachment(AVFormatContext *s, AVIOContext *pb, int length)
if (!st)
goto done;
av_dict_set(&st->metadata, "title", description, 0);
- st->codec->codec_id = CODEC_ID_MJPEG;
+ st->codec->codec_id = AV_CODEC_ID_MJPEG;
st->codec->codec_type = AVMEDIA_TYPE_ATTACHMENT;
st->codec->extradata = av_mallocz(filesize);
if (!st->codec->extradata)
@@ -597,17 +610,23 @@ static void parse_mpeg1waveformatex(AVStream *st)
{
/* fwHeadLayer */
switch (AV_RL16(st->codec->extradata)) {
- case 0x0001 : st->codec->codec_id = CODEC_ID_MP1; break;
- case 0x0002 : st->codec->codec_id = CODEC_ID_MP2; break;
- case 0x0004 : st->codec->codec_id = CODEC_ID_MP3; break;
+ case 0x0001 : st->codec->codec_id = AV_CODEC_ID_MP1; break;
+ case 0x0002 : st->codec->codec_id = AV_CODEC_ID_MP2; break;
+ case 0x0004 : st->codec->codec_id = AV_CODEC_ID_MP3; break;
}
st->codec->bit_rate = AV_RL32(st->codec->extradata + 2); /* dwHeadBitrate */
/* dwHeadMode */
switch (AV_RL16(st->codec->extradata + 6)) {
- case 1 : case 2 : case 4 : st->codec->channels = 2; break;
- case 8 : st->codec->channels = 1; break;
+ case 1 :
+ case 2 :
+ case 4 : st->codec->channels = 2;
+ st->codec->channel_layout = AV_CH_LAYOUT_STEREO;
+ break;
+ case 8 : st->codec->channels = 1;
+ st->codec->channel_layout = AV_CH_LAYOUT_MONO;
+ break;
}
}
@@ -696,7 +715,7 @@ static AVStream * parse_media_type(AVFormatContext *s, AVStream *st, int sid,
av_log(s, AV_LOG_WARNING, "MPEG1WAVEFORMATEX underflow\n");
} else {
st->codec->codec_id = ff_codec_guid_get_id(audio_guids, subtype);
- if (st->codec->codec_id == CODEC_ID_NONE)
+ if (st->codec->codec_id == AV_CODEC_ID_NONE)
av_log(s, AV_LOG_WARNING, "unknown subtype:"PRI_GUID"\n", ARG_GUID(subtype));
}
return st;
@@ -721,7 +740,7 @@ static AVStream * parse_media_type(AVFormatContext *s, AVStream *st, int sid,
} else {
st->codec->codec_id = ff_codec_guid_get_id(video_guids, subtype);
}
- if (st->codec->codec_id == CODEC_ID_NONE)
+ if (st->codec->codec_id == AV_CODEC_ID_NONE)
av_log(s, AV_LOG_WARNING, "unknown subtype:"PRI_GUID"\n", ARG_GUID(subtype));
return st;
} else if (!ff_guidcmp(mediatype, mediatype_mpeg2_pes) &&
@@ -732,7 +751,7 @@ static AVStream * parse_media_type(AVFormatContext *s, AVStream *st, int sid,
if (ff_guidcmp(formattype, format_none))
av_log(s, AV_LOG_WARNING, "unknown formattype:"PRI_GUID"\n", ARG_GUID(formattype));
avio_skip(pb, size);
- st->codec->codec_id = CODEC_ID_DVB_SUBTITLE;
+ st->codec->codec_id = AV_CODEC_ID_DVB_SUBTITLE;
return st;
} else if (!ff_guidcmp(mediatype, mediatype_mstvcaption) &&
(!ff_guidcmp(subtype, mediasubtype_teletext) || !ff_guidcmp(subtype, mediasubtype_dtvccdata))) {
@@ -742,7 +761,7 @@ static AVStream * parse_media_type(AVFormatContext *s, AVStream *st, int sid,
if (ff_guidcmp(formattype, format_none))
av_log(s, AV_LOG_WARNING, "unknown formattype:"PRI_GUID"\n", ARG_GUID(formattype));
avio_skip(pb, size);
- st->codec->codec_id = CODEC_ID_DVB_TELETEXT;
+ st->codec->codec_id = AV_CODEC_ID_DVB_TELETEXT;
return st;
} else if (!ff_guidcmp(mediatype, mediatype_mpeg2_sections) &&
!ff_guidcmp(subtype, mediasubtype_mpeg2_sections)) {
@@ -945,7 +964,7 @@ static const uint8_t timeline_table_0_entries_Events_le16[] =
{'t'_'i'_'m'_'e'_'l'_'i'_'n'_'e'_'.'_'t'_'a'_'b'_'l'_'e'_'.'_'0'_'.'_'e'_'n'_'t'_'r'_'i'_'e'_'s'_'.'_'E'_'v'_'e'_'n'_'t'_'s', 0};
#undef _
-static int read_header(AVFormatContext *s, AVFormatParameters *ap)
+static int read_header(AVFormatContext *s)
{
WtvContext *wtv = s->priv_data;
int root_sector, root_size;
diff --git a/gst-libs/ext/libav/libavformat/wv.c b/gst-libs/ext/libav/libavformat/wv.c
index 5f7b3b4..f6b96d5 100644
--- a/gst-libs/ext/libav/libavformat/wv.c
+++ b/gst-libs/ext/libav/libavformat/wv.c
@@ -19,7 +19,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "libavutil/audioconvert.h"
+#include "libavutil/channel_layout.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/dict.h"
#include "avformat.h"
@@ -36,7 +36,7 @@
#define WV_END_BLOCK 0x1000
#define WV_SINGLE_BLOCK (WV_START_BLOCK | WV_END_BLOCK)
-enum WV_FLAGS{
+enum WV_FLAGS {
WV_MONO = 0x0004,
WV_HYBRID = 0x0008,
WV_JOINT = 0x0010,
@@ -51,11 +51,11 @@ enum WV_FLAGS{
};
static const int wv_rates[16] = {
- 6000, 8000, 9600, 11025, 12000, 16000, 22050, 24000,
- 32000, 44100, 48000, 64000, 88200, 96000, 192000, -1
+ 6000, 8000, 9600, 11025, 12000, 16000, 22050, 24000,
+ 32000, 44100, 48000, 64000, 88200, 96000, 192000, -1
};
-typedef struct{
+typedef struct {
uint32_t blksize, flags;
int rate, chan, bpp;
uint32_t chmask;
@@ -64,7 +64,9 @@ typedef struct{
int block_parsed;
uint8_t extra[WV_EXTRA_SIZE];
int64_t pos;
-}WVContext;
+
+ int64_t apetag_start;
+} WVContext;
static int wv_probe(AVProbeData *p)
{
@@ -78,7 +80,8 @@ static int wv_probe(AVProbeData *p)
return 0;
}
-static int wv_read_block_header(AVFormatContext *ctx, AVIOContext *pb, int append)
+static int wv_read_block_header(AVFormatContext *ctx, AVIOContext *pb,
+ int append)
{
WVContext *wc = ctx->priv_data;
uint32_t tag, ver;
@@ -87,64 +90,72 @@ static int wv_read_block_header(AVFormatContext *ctx, AVIOContext *pb, int appen
uint32_t chmask;
wc->pos = avio_tell(pb);
- if(!append){
+
+ /* don't return bogus packets with the ape tag data */
+ if (wc->apetag_start && wc->pos >= wc->apetag_start)
+ return AVERROR_EOF;
+
+ if (!append) {
tag = avio_rl32(pb);
if (tag != MKTAG('w', 'v', 'p', 'k'))
- return -1;
+ return AVERROR_INVALIDDATA;
size = avio_rl32(pb);
- if(size < 24 || size > WV_BLOCK_LIMIT){
+ if (size < 24 || size > WV_BLOCK_LIMIT) {
av_log(ctx, AV_LOG_ERROR, "Incorrect block size %i\n", size);
- return -1;
+ return AVERROR_INVALIDDATA;
}
wc->blksize = size;
ver = avio_rl16(pb);
- if(ver < 0x402 || ver > 0x410){
+ if (ver < 0x402 || ver > 0x410) {
av_log(ctx, AV_LOG_ERROR, "Unsupported version %03X\n", ver);
- return -1;
+ return AVERROR_PATCHWELCOME;
}
avio_r8(pb); // track no
avio_r8(pb); // track sub index
wc->samples = avio_rl32(pb); // total samples in file
- wc->soff = avio_rl32(pb); // offset in samples of current block
+ wc->soff = avio_rl32(pb); // offset in samples of current block
avio_read(pb, wc->extra, WV_EXTRA_SIZE);
- }else{
+ } else {
size = wc->blksize;
}
wc->flags = AV_RL32(wc->extra + 4);
- // blocks with zero samples don't contain actual audio information and should be ignored
+ /* Blocks with zero samples don't contain actual audio information
+ * and should be ignored */
if (!AV_RN32(wc->extra))
return 0;
- //parse flags
- bpp = ((wc->flags & 3) + 1) << 3;
- chan = 1 + !(wc->flags & WV_MONO);
+ // parse flags
+ bpp = ((wc->flags & 3) + 1) << 3;
+ chan = 1 + !(wc->flags & WV_MONO);
chmask = wc->flags & WV_MONO ? AV_CH_LAYOUT_MONO : AV_CH_LAYOUT_STEREO;
- rate = wv_rates[(wc->flags >> 23) & 0xF];
+ rate = wv_rates[(wc->flags >> 23) & 0xF];
wc->multichannel = !!((wc->flags & WV_SINGLE_BLOCK) != WV_SINGLE_BLOCK);
- if(wc->multichannel){
- chan = wc->chan;
+ if (wc->multichannel) {
+ chan = wc->chan;
chmask = wc->chmask;
}
- if((rate == -1 || !chan) && !wc->block_parsed){
+ if ((rate == -1 || !chan) && !wc->block_parsed) {
int64_t block_end = avio_tell(pb) + wc->blksize - 24;
- if(!pb->seekable){
- av_log(ctx, AV_LOG_ERROR, "Cannot determine additional parameters\n");
- return -1;
+ if (!pb->seekable) {
+ av_log(ctx, AV_LOG_ERROR,
+ "Cannot determine additional parameters\n");
+ return AVERROR_INVALIDDATA;
}
- while(avio_tell(pb) < block_end){
+ while (avio_tell(pb) < block_end) {
int id, size;
- id = avio_r8(pb);
+ id = avio_r8(pb);
size = (id & 0x80) ? avio_rl24(pb) : avio_r8(pb);
size <<= 1;
- if(id&0x40)
+ if (id & 0x40)
size--;
- switch(id&0x3F){
+ switch (id & 0x3F) {
case 0xD:
- if(size <= 1){
- av_log(ctx, AV_LOG_ERROR, "Insufficient channel information\n");
- return -1;
+ if (size <= 1) {
+ av_log(ctx, AV_LOG_ERROR,
+ "Insufficient channel information\n");
+ return AVERROR_INVALIDDATA;
}
chan = avio_r8(pb);
- switch(size - 2){
+ switch (size - 2) {
case 0:
chmask = avio_r8(pb);
break;
@@ -159,12 +170,13 @@ static int wv_read_block_header(AVFormatContext *ctx, AVIOContext *pb, int appen
break;
case 5:
avio_skip(pb, 1);
- chan |= (avio_r8(pb) & 0xF) << 8;
+ chan |= (avio_r8(pb) & 0xF) << 8;
chmask = avio_rl24(pb);
break;
default:
- av_log(ctx, AV_LOG_ERROR, "Invalid channel info size %d\n", size);
- return -1;
+ av_log(ctx, AV_LOG_ERROR,
+ "Invalid channel info size %d\n", size);
+ return AVERROR_INVALIDDATA;
}
break;
case 0x27:
@@ -173,48 +185,59 @@ static int wv_read_block_header(AVFormatContext *ctx, AVIOContext *pb, int appen
default:
avio_skip(pb, size);
}
- if(id&0x40)
+ if (id & 0x40)
avio_skip(pb, 1);
}
- if(rate == -1){
- av_log(ctx, AV_LOG_ERROR, "Cannot determine custom sampling rate\n");
- return -1;
+ if (rate == -1) {
+ av_log(ctx, AV_LOG_ERROR,
+ "Cannot determine custom sampling rate\n");
+ return AVERROR_INVALIDDATA;
}
avio_seek(pb, block_end - wc->blksize + 24, SEEK_SET);
}
- if(!wc->bpp) wc->bpp = bpp;
- if(!wc->chan) wc->chan = chan;
- if(!wc->chmask) wc->chmask = chmask;
- if(!wc->rate) wc->rate = rate;
+ if (!wc->bpp)
+ wc->bpp = bpp;
+ if (!wc->chan)
+ wc->chan = chan;
+ if (!wc->chmask)
+ wc->chmask = chmask;
+ if (!wc->rate)
+ wc->rate = rate;
- if(wc->flags && bpp != wc->bpp){
- av_log(ctx, AV_LOG_ERROR, "Bits per sample differ, this block: %i, header block: %i\n", bpp, wc->bpp);
- return -1;
+ if (wc->flags && bpp != wc->bpp) {
+ av_log(ctx, AV_LOG_ERROR,
+ "Bits per sample differ, this block: %i, header block: %i\n",
+ bpp, wc->bpp);
+ return AVERROR_INVALIDDATA;
}
- if(wc->flags && !wc->multichannel && chan != wc->chan){
- av_log(ctx, AV_LOG_ERROR, "Channels differ, this block: %i, header block: %i\n", chan, wc->chan);
- return -1;
+ if (wc->flags && !wc->multichannel && chan != wc->chan) {
+ av_log(ctx, AV_LOG_ERROR,
+ "Channels differ, this block: %i, header block: %i\n",
+ chan, wc->chan);
+ return AVERROR_INVALIDDATA;
}
- if(wc->flags && rate != -1 && rate != wc->rate){
- av_log(ctx, AV_LOG_ERROR, "Sampling rate differ, this block: %i, header block: %i\n", rate, wc->rate);
- return -1;
+ if (wc->flags && rate != -1 && rate != wc->rate) {
+ av_log(ctx, AV_LOG_ERROR,
+ "Sampling rate differ, this block: %i, header block: %i\n",
+ rate, wc->rate);
+ return AVERROR_INVALIDDATA;
}
wc->blksize = size - 24;
return 0;
}
-static int wv_read_header(AVFormatContext *s,
- AVFormatParameters *ap)
+static int wv_read_header(AVFormatContext *s)
{
AVIOContext *pb = s->pb;
WVContext *wc = s->priv_data;
AVStream *st;
+ int ret;
wc->block_parsed = 0;
- for(;;){
- if(wv_read_block_header(s, pb, 0) < 0)
- return -1;
- if(!AV_RN32(wc->extra))
+ for (;;) {
+ if ((ret = wv_read_block_header(s, pb, 0)) < 0)
+ return ret;
+ if (!AV_RN32(wc->extra))
avio_skip(pb, wc->blksize - 24);
else
break;
@@ -223,21 +246,21 @@ static int wv_read_header(AVFormatContext *s,
/* now we are ready: build format streams */
st = avformat_new_stream(s, NULL);
if (!st)
- return -1;
- st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
- st->codec->codec_id = CODEC_ID_WAVPACK;
- st->codec->channels = wc->chan;
- st->codec->channel_layout = wc->chmask;
- st->codec->sample_rate = wc->rate;
+ return AVERROR(ENOMEM);
+ st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
+ st->codec->codec_id = AV_CODEC_ID_WAVPACK;
+ st->codec->channels = wc->chan;
+ st->codec->channel_layout = wc->chmask;
+ st->codec->sample_rate = wc->rate;
st->codec->bits_per_coded_sample = wc->bpp;
avpriv_set_pts_info(st, 64, 1, wc->rate);
st->start_time = 0;
- st->duration = wc->samples;
+ st->duration = wc->samples;
- if(s->pb->seekable) {
+ if (s->pb->seekable) {
int64_t cur = avio_tell(s->pb);
- ff_ape_parse_tag(s);
- if(!av_dict_get(s->metadata, "", NULL, AV_DICT_IGNORE_SUFFIX))
+ wc->apetag_start = ff_ape_parse_tag(s);
+ if (!av_dict_get(s->metadata, "", NULL, AV_DICT_IGNORE_SUFFIX))
ff_id3v1_read(s);
avio_seek(s->pb, cur, SEEK_SET);
}
@@ -245,85 +268,93 @@ static int wv_read_header(AVFormatContext *s,
return 0;
}
-static int wv_read_packet(AVFormatContext *s,
- AVPacket *pkt)
+static int wv_read_packet(AVFormatContext *s, AVPacket *pkt)
{
WVContext *wc = s->priv_data;
int ret;
int size, ver, off;
int64_t pos;
+ uint32_t block_samples;
if (s->pb->eof_reached)
- return AVERROR(EIO);
- if(wc->block_parsed){
- if(wv_read_block_header(s, s->pb, 0) < 0)
- return -1;
+ return AVERROR_EOF;
+ if (wc->block_parsed) {
+ if ((ret = wv_read_block_header(s, s->pb, 0)) < 0)
+ return ret;
}
pos = wc->pos;
off = wc->multichannel ? 4 : 0;
- if(av_new_packet(pkt, wc->blksize + WV_EXTRA_SIZE + off) < 0)
+ if (av_new_packet(pkt, wc->blksize + WV_EXTRA_SIZE + off) < 0)
return AVERROR(ENOMEM);
- if(wc->multichannel)
+ if (wc->multichannel)
AV_WL32(pkt->data, wc->blksize + WV_EXTRA_SIZE + 12);
memcpy(pkt->data + off, wc->extra, WV_EXTRA_SIZE);
ret = avio_read(s->pb, pkt->data + WV_EXTRA_SIZE + off, wc->blksize);
- if(ret != wc->blksize){
+ if (ret != wc->blksize) {
av_free_packet(pkt);
return AVERROR(EIO);
}
- while(!(wc->flags & WV_END_BLOCK)){
- if(avio_rl32(s->pb) != MKTAG('w', 'v', 'p', 'k')){
+ while (!(wc->flags & WV_END_BLOCK)) {
+ if (avio_rl32(s->pb) != MKTAG('w', 'v', 'p', 'k')) {
av_free_packet(pkt);
- return -1;
+ return AVERROR_INVALIDDATA;
}
- if((ret = av_append_packet(s->pb, pkt, 4)) < 0){
+ if ((ret = av_append_packet(s->pb, pkt, 4)) < 0) {
av_free_packet(pkt);
return ret;
}
size = AV_RL32(pkt->data + pkt->size - 4);
- if(size < 24 || size > WV_BLOCK_LIMIT){
+ if (size < 24 || size > WV_BLOCK_LIMIT) {
av_free_packet(pkt);
av_log(s, AV_LOG_ERROR, "Incorrect block size %d\n", size);
- return -1;
+ return AVERROR_INVALIDDATA;
}
wc->blksize = size;
- ver = avio_rl16(s->pb);
- if(ver < 0x402 || ver > 0x410){
+ ver = avio_rl16(s->pb);
+ if (ver < 0x402 || ver > 0x410) {
av_free_packet(pkt);
av_log(s, AV_LOG_ERROR, "Unsupported version %03X\n", ver);
- return -1;
+ return AVERROR_PATCHWELCOME;
}
avio_r8(s->pb); // track no
avio_r8(s->pb); // track sub index
wc->samples = avio_rl32(s->pb); // total samples in file
- wc->soff = avio_rl32(s->pb); // offset in samples of current block
- if((ret = av_append_packet(s->pb, pkt, WV_EXTRA_SIZE)) < 0){
+ wc->soff = avio_rl32(s->pb); // offset in samples of current block
+ if ((ret = av_append_packet(s->pb, pkt, WV_EXTRA_SIZE)) < 0) {
av_free_packet(pkt);
return ret;
}
memcpy(wc->extra, pkt->data + pkt->size - WV_EXTRA_SIZE, WV_EXTRA_SIZE);
- if(wv_read_block_header(s, s->pb, 1) < 0){
+ if ((ret = wv_read_block_header(s, s->pb, 1)) < 0) {
av_free_packet(pkt);
- return -1;
+ return ret;
}
ret = av_append_packet(s->pb, pkt, wc->blksize);
- if(ret < 0){
+ if (ret < 0) {
av_free_packet(pkt);
return ret;
}
}
pkt->stream_index = 0;
- wc->block_parsed = 1;
- pkt->pts = wc->soff;
+ wc->block_parsed = 1;
+ pkt->pts = wc->soff;
+ block_samples = AV_RN32(wc->extra);
+ if (block_samples > INT32_MAX)
+ av_log(s, AV_LOG_WARNING,
+ "Too many samples in block: %"PRIu32"\n", block_samples);
+ else
+ pkt->duration = block_samples;
+
av_add_index_entry(s->streams[0], pos, pkt->pts, 0, 0, AVINDEX_KEYFRAME);
return 0;
}
-static int wv_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int flags)
+static int wv_read_seek(AVFormatContext *s, int stream_index,
+ int64_t timestamp, int flags)
{
- AVStream *st = s->streams[stream_index];
+ AVStream *st = s->streams[stream_index];
WVContext *wc = s->priv_data;
AVPacket pkt1, *pkt = &pkt1;
int ret;
@@ -338,19 +369,19 @@ static int wv_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp,
return 0;
}
/* if timestamp is out of bounds, return error */
- if(timestamp < 0 || timestamp >= s->duration)
- return -1;
+ if (timestamp < 0 || timestamp >= s->duration)
+ return AVERROR(EINVAL);
pos = avio_tell(s->pb);
- do{
+ do {
ret = av_read_frame(s, pkt);
- if (ret < 0){
+ if (ret < 0) {
avio_seek(s->pb, pos, SEEK_SET);
- return -1;
+ return ret;
}
pts = pkt->pts;
av_free_packet(pkt);
- }while(pts < timestamp);
+ } while(pts < timestamp);
return 0;
}
diff --git a/gst-libs/ext/libav/libavformat/xa.c b/gst-libs/ext/libav/libavformat/xa.c
index 0a1ad59..02d66c5 100644
--- a/gst-libs/ext/libav/libavformat/xa.c
+++ b/gst-libs/ext/libav/libavformat/xa.c
@@ -38,7 +38,6 @@
typedef struct MaxisXADemuxContext {
uint32_t out_size;
uint32_t sent_bytes;
- uint32_t audio_frame_counter;
} MaxisXADemuxContext;
static int xa_probe(AVProbeData *p)
@@ -63,8 +62,7 @@ static int xa_probe(AVProbeData *p)
return AVPROBE_SCORE_MAX/2;
}
-static int xa_read_header(AVFormatContext *s,
- AVFormatParameters *ap)
+static int xa_read_header(AVFormatContext *s)
{
MaxisXADemuxContext *xa = s->priv_data;
AVIOContext *pb = s->pb;
@@ -76,18 +74,21 @@ static int xa_read_header(AVFormatContext *s,
return AVERROR(ENOMEM);
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
- st->codec->codec_id = CODEC_ID_ADPCM_EA_MAXIS_XA;
+ st->codec->codec_id = AV_CODEC_ID_ADPCM_EA_MAXIS_XA;
avio_skip(pb, 4); /* Skip the XA ID */
xa->out_size = avio_rl32(pb);
avio_skip(pb, 2); /* Skip the tag */
st->codec->channels = avio_rl16(pb);
st->codec->sample_rate = avio_rl32(pb);
- /* Value in file is average byte rate*/
- st->codec->bit_rate = avio_rl32(pb) * 8;
- st->codec->block_align = avio_rl16(pb);
- st->codec->bits_per_coded_sample = avio_rl16(pb);
+ avio_skip(pb, 4); /* Skip average byte rate */
+ avio_skip(pb, 2); /* Skip block align */
+ avio_skip(pb, 2); /* Skip bits-per-sample */
+
+ st->codec->bit_rate = av_clip(15LL * st->codec->channels * 8 *
+ st->codec->sample_rate / 28, 0, INT_MAX);
avpriv_set_pts_info(st, 64, 1, st->codec->sample_rate);
+ st->start_time = 0;
return 0;
}
@@ -101,8 +102,8 @@ static int xa_read_packet(AVFormatContext *s,
unsigned int packet_size;
int ret;
- if(xa->sent_bytes > xa->out_size)
- return AVERROR(EIO);
+ if (xa->sent_bytes >= xa->out_size)
+ return AVERROR_EOF;
/* 1 byte header and 14 bytes worth of samples * number channels per block */
packet_size = 15*st->codec->channels;
@@ -112,16 +113,14 @@ static int xa_read_packet(AVFormatContext *s,
pkt->stream_index = st->index;
xa->sent_bytes += packet_size;
- pkt->pts = xa->audio_frame_counter;
- /* 14 bytes Samples per channel with 2 samples per byte */
- xa->audio_frame_counter += 28 * st->codec->channels;
+ pkt->duration = 28;
return ret;
}
AVInputFormat ff_xa_demuxer = {
.name = "xa",
- .long_name = NULL_IF_CONFIG_SMALL("Maxis XA File Format"),
+ .long_name = NULL_IF_CONFIG_SMALL("Maxis XA"),
.priv_data_size = sizeof(MaxisXADemuxContext),
.read_probe = xa_probe,
.read_header = xa_read_header,
diff --git a/gst-libs/ext/libav/libavformat/xmv.c b/gst-libs/ext/libav/libavformat/xmv.c
index 8249ce1..d491dec 100644
--- a/gst-libs/ext/libav/libavformat/xmv.c
+++ b/gst-libs/ext/libav/libavformat/xmv.c
@@ -53,7 +53,7 @@ typedef struct XMVAudioTrack {
uint16_t block_align;
uint16_t block_samples;
- enum CodecID codec_id;
+ enum AVCodecID codec_id;
} XMVAudioTrack;
typedef struct XMVVideoPacket {
@@ -136,8 +136,7 @@ static int xmv_read_close(AVFormatContext *s)
return 0;
}
-static int xmv_read_header(AVFormatContext *s,
- AVFormatParameters *ap)
+static int xmv_read_header(AVFormatContext *s)
{
XMVDemuxContext *xmv = s->priv_data;
AVIOContext *pb = s->pb;
@@ -169,7 +168,7 @@ static int xmv_read_header(AVFormatContext *s,
avpriv_set_pts_info(vst, 32, 1, 1000);
vst->codec->codec_type = AVMEDIA_TYPE_VIDEO;
- vst->codec->codec_id = CODEC_ID_WMV2;
+ vst->codec->codec_id = AV_CODEC_ID_WMV2;
vst->codec->codec_tag = MKBETAG('W', 'M', 'V', '2');
vst->codec->width = avio_rl32(pb);
vst->codec->height = avio_rl32(pb);
@@ -325,7 +324,7 @@ static int xmv_process_packet_header(AVFormatContext *s)
* short for every audio track. But as playing around with XMV files with
* ADPCM audio showed, taking the extra 4 bytes from the audio data gives
* you either completely distorted audio or click (when skipping the
- * remaining 68 bytes of the ADPCM block). Substracting 4 bytes for every
+ * remaining 68 bytes of the ADPCM block). Subtracting 4 bytes for every
* audio track from the video data works at least for the audio. Probably
* some alignment thing?
* The video data has (always?) lots of padding, so it should work out...
diff --git a/gst-libs/ext/libav/libavformat/xwma.c b/gst-libs/ext/libav/libavformat/xwma.c
index 94abfc7..46ca0b8 100644
--- a/gst-libs/ext/libav/libavformat/xwma.c
+++ b/gst-libs/ext/libav/libavformat/xwma.c
@@ -40,7 +40,7 @@ static int xwma_probe(AVProbeData *p)
return 0;
}
-static int xwma_read_header(AVFormatContext *s, AVFormatParameters *ap)
+static int xwma_read_header(AVFormatContext *s)
{
int64_t size, av_uninit(data_size);
int ret;
@@ -84,7 +84,7 @@ static int xwma_read_header(AVFormatContext *s, AVFormatParameters *ap)
* extradata for that. Thus, ask the user for feedback, but try to go on
* anyway.
*/
- if (st->codec->codec_id != CODEC_ID_WMAV2) {
+ if (st->codec->codec_id != AV_CODEC_ID_WMAV2) {
av_log(s, AV_LOG_WARNING, "unexpected codec (tag 0x04%x; id %d)\n",
st->codec->codec_tag, st->codec->codec_id);
av_log_ask_for_sample(s, NULL);
diff --git a/gst-libs/ext/libav/libavformat/yop.c b/gst-libs/ext/libav/libavformat/yop.c
index a317825..5fe6bdc 100644
--- a/gst-libs/ext/libav/libavformat/yop.c
+++ b/gst-libs/ext/libav/libavformat/yop.c
@@ -22,6 +22,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "libavutil/channel_layout.h"
#include "libavutil/intreadwrite.h"
#include "avformat.h"
#include "internal.h"
@@ -47,7 +48,7 @@ static int yop_probe(AVProbeData *probe_packet)
return 0;
}
-static int yop_read_header(AVFormatContext *s, AVFormatParameters *ap)
+static int yop_read_header(AVFormatContext *s)
{
YopDecContext *yop = s->priv_data;
AVIOContext *pb = s->pb;
@@ -72,14 +73,15 @@ static int yop_read_header(AVFormatContext *s, AVFormatParameters *ap)
// Audio
audio_dec = audio_stream->codec;
audio_dec->codec_type = AVMEDIA_TYPE_AUDIO;
- audio_dec->codec_id = CODEC_ID_ADPCM_IMA_WS;
+ audio_dec->codec_id = AV_CODEC_ID_ADPCM_IMA_APC;
audio_dec->channels = 1;
+ audio_dec->channel_layout = AV_CH_LAYOUT_MONO;
audio_dec->sample_rate = 22050;
// Video
video_dec = video_stream->codec;
video_dec->codec_type = AVMEDIA_TYPE_VIDEO;
- video_dec->codec_id = CODEC_ID_YOP;
+ video_dec->codec_id = AV_CODEC_ID_YOP;
avio_skip(pb, 6);
@@ -184,8 +186,6 @@ static int yop_read_seek(AVFormatContext *s, int stream_index,
int64_t frame_pos, pos_min, pos_max;
int frame_count;
- av_free_packet(&yop->video_packet);
-
if (!stream_index)
return -1;
@@ -196,21 +196,25 @@ static int yop_read_seek(AVFormatContext *s, int stream_index,
timestamp = FFMAX(0, FFMIN(frame_count, timestamp));
frame_pos = timestamp * yop->frame_size + pos_min;
+
+ if (avio_seek(s->pb, frame_pos, SEEK_SET) < 0)
+ return -1;
+
+ av_free_packet(&yop->video_packet);
yop->odd_frame = timestamp & 1;
- avio_seek(s->pb, frame_pos, SEEK_SET);
return 0;
}
AVInputFormat ff_yop_demuxer = {
.name = "yop",
- .long_name = NULL_IF_CONFIG_SMALL("Psygnosis YOP Format"),
+ .long_name = NULL_IF_CONFIG_SMALL("Psygnosis YOP"),
.priv_data_size = sizeof(YopDecContext),
.read_probe = yop_probe,
.read_header = yop_read_header,
.read_packet = yop_read_packet,
.read_close = yop_read_close,
.read_seek = yop_read_seek,
- .extensions = "yop",
- .flags = AVFMT_GENERIC_INDEX,
+ .extensions = "yop",
+ .flags = AVFMT_GENERIC_INDEX,
};
diff --git a/gst-libs/ext/libav/libavformat/yuv4mpeg.c b/gst-libs/ext/libav/libavformat/yuv4mpeg.c
index f68c1a7..a8077a0 100644
--- a/gst-libs/ext/libav/libavformat/yuv4mpeg.c
+++ b/gst-libs/ext/libav/libavformat/yuv4mpeg.c
@@ -57,23 +57,23 @@ static int yuv4_generate_header(AVFormatContext *s, char* buf)
inter = st->codec->coded_frame->top_field_first ? 't' : 'b';
switch (st->codec->pix_fmt) {
- case PIX_FMT_GRAY8:
+ case AV_PIX_FMT_GRAY8:
colorspace = " Cmono";
break;
- case PIX_FMT_YUV411P:
+ case AV_PIX_FMT_YUV411P:
colorspace = " C411 XYSCSS=411";
break;
- case PIX_FMT_YUV420P:
+ case AV_PIX_FMT_YUV420P:
switch (st->codec->chroma_sample_location) {
case AVCHROMA_LOC_TOPLEFT: colorspace = " C420paldv XYSCSS=420PALDV"; break;
case AVCHROMA_LOC_LEFT: colorspace = " C420mpeg2 XYSCSS=420MPEG2"; break;
default: colorspace = " C420jpeg XYSCSS=420JPEG"; break;
}
break;
- case PIX_FMT_YUV422P:
+ case AV_PIX_FMT_YUV422P:
colorspace = " C422 XYSCSS=422";
break;
- case PIX_FMT_YUV444P:
+ case AV_PIX_FMT_YUV444P:
colorspace = " C444 XYSCSS=444";
break;
}
@@ -126,7 +126,7 @@ static int yuv4_write_packet(AVFormatContext *s, AVPacket *pkt)
ptr += picture->linesize[0];
}
- if (st->codec->pix_fmt != PIX_FMT_GRAY8) {
+ if (st->codec->pix_fmt != AV_PIX_FMT_GRAY8) {
// Adjust for smaller Cb and Cr planes
avcodec_get_chroma_sub_sample(st->codec->pix_fmt, &h_chroma_shift,
&v_chroma_shift);
@@ -155,18 +155,18 @@ static int yuv4_write_header(AVFormatContext *s)
if (s->nb_streams != 1)
return AVERROR(EIO);
- if (s->streams[0]->codec->codec_id != CODEC_ID_RAWVIDEO) {
+ if (s->streams[0]->codec->codec_id != AV_CODEC_ID_RAWVIDEO) {
av_log(s, AV_LOG_ERROR, "ERROR: Only rawvideo supported.\n");
return AVERROR_INVALIDDATA;
}
- if (s->streams[0]->codec->pix_fmt == PIX_FMT_YUV411P) {
+ if (s->streams[0]->codec->pix_fmt == AV_PIX_FMT_YUV411P) {
av_log(s, AV_LOG_ERROR, "Warning: generating rarely used 4:1:1 YUV "
"stream, some mjpegtools might not work.\n");
- } else if ((s->streams[0]->codec->pix_fmt != PIX_FMT_YUV420P) &&
- (s->streams[0]->codec->pix_fmt != PIX_FMT_YUV422P) &&
- (s->streams[0]->codec->pix_fmt != PIX_FMT_GRAY8) &&
- (s->streams[0]->codec->pix_fmt != PIX_FMT_YUV444P)) {
+ } else if ((s->streams[0]->codec->pix_fmt != AV_PIX_FMT_YUV420P) &&
+ (s->streams[0]->codec->pix_fmt != AV_PIX_FMT_YUV422P) &&
+ (s->streams[0]->codec->pix_fmt != AV_PIX_FMT_GRAY8) &&
+ (s->streams[0]->codec->pix_fmt != AV_PIX_FMT_YUV444P)) {
av_log(s, AV_LOG_ERROR, "ERROR: yuv4mpeg only handles yuv444p, "
"yuv422p, yuv420p, yuv411p and gray pixel formats. "
"Use -pix_fmt to select one.\n");
@@ -179,12 +179,12 @@ static int yuv4_write_header(AVFormatContext *s)
AVOutputFormat ff_yuv4mpegpipe_muxer = {
.name = "yuv4mpegpipe",
- .long_name = NULL_IF_CONFIG_SMALL("YUV4MPEG pipe format"),
+ .long_name = NULL_IF_CONFIG_SMALL("YUV4MPEG pipe"),
.mime_type = "",
.extensions = "y4m",
.priv_data_size = sizeof(int),
- .audio_codec = CODEC_ID_NONE,
- .video_codec = CODEC_ID_RAWVIDEO,
+ .audio_codec = AV_CODEC_ID_NONE,
+ .video_codec = AV_CODEC_ID_RAWVIDEO,
.write_header = yuv4_write_header,
.write_packet = yuv4_write_packet,
.flags = AVFMT_RAWPICTURE,
@@ -195,7 +195,7 @@ AVOutputFormat ff_yuv4mpegpipe_muxer = {
#define MAX_YUV4_HEADER 80
#define MAX_FRAME_HEADER 80
-static int yuv4_read_header(AVFormatContext *s, AVFormatParameters *ap)
+static int yuv4_read_header(AVFormatContext *s)
{
char header[MAX_YUV4_HEADER + 10]; // Include headroom for
// the longest option
@@ -204,7 +204,7 @@ static int yuv4_read_header(AVFormatContext *s, AVFormatParameters *ap)
AVIOContext *pb = s->pb;
int width = -1, height = -1, raten = 0,
rated = 0, aspectn = 0, aspectd = 0;
- enum PixelFormat pix_fmt = PIX_FMT_NONE, alt_pix_fmt = PIX_FMT_NONE;
+ enum AVPixelFormat pix_fmt = AV_PIX_FMT_NONE, alt_pix_fmt = AV_PIX_FMT_NONE;
enum AVChromaLocation chroma_sample_location = AVCHROMA_LOC_UNSPECIFIED;
AVStream *st;
struct frame_attributes *s1 = s->priv_data;
@@ -241,26 +241,29 @@ static int yuv4_read_header(AVFormatContext *s, AVFormatParameters *ap)
break;
case 'C': // Color space
if (strncmp("420jpeg", tokstart, 7) == 0) {
- pix_fmt = PIX_FMT_YUV420P;
+ pix_fmt = AV_PIX_FMT_YUV420P;
chroma_sample_location = AVCHROMA_LOC_CENTER;
} else if (strncmp("420mpeg2", tokstart, 8) == 0) {
- pix_fmt = PIX_FMT_YUV420P;
+ pix_fmt = AV_PIX_FMT_YUV420P;
chroma_sample_location = AVCHROMA_LOC_LEFT;
} else if (strncmp("420paldv", tokstart, 8) == 0) {
- pix_fmt = PIX_FMT_YUV420P;
+ pix_fmt = AV_PIX_FMT_YUV420P;
chroma_sample_location = AVCHROMA_LOC_TOPLEFT;
+ } else if (strncmp("420", tokstart, 3) == 0) {
+ pix_fmt = AV_PIX_FMT_YUV420P;
+ chroma_sample_location = AVCHROMA_LOC_CENTER;
} else if (strncmp("411", tokstart, 3) == 0)
- pix_fmt = PIX_FMT_YUV411P;
+ pix_fmt = AV_PIX_FMT_YUV411P;
else if (strncmp("422", tokstart, 3) == 0)
- pix_fmt = PIX_FMT_YUV422P;
+ pix_fmt = AV_PIX_FMT_YUV422P;
else if (strncmp("444alpha", tokstart, 8) == 0 ) {
av_log(s, AV_LOG_ERROR, "Cannot handle 4:4:4:4 "
"YUV4MPEG stream.\n");
return -1;
} else if (strncmp("444", tokstart, 3) == 0)
- pix_fmt = PIX_FMT_YUV444P;
+ pix_fmt = AV_PIX_FMT_YUV444P;
else if (strncmp("mono", tokstart, 4) == 0) {
- pix_fmt = PIX_FMT_GRAY8;
+ pix_fmt = AV_PIX_FMT_GRAY8;
} else {
av_log(s, AV_LOG_ERROR, "YUV4MPEG stream contains an unknown "
"pixel format.\n");
@@ -308,17 +311,17 @@ static int yuv4_read_header(AVFormatContext *s, AVFormatParameters *ap)
// Older nonstandard pixel format representation
tokstart += 6;
if (strncmp("420JPEG", tokstart, 7) == 0)
- alt_pix_fmt = PIX_FMT_YUV420P;
+ alt_pix_fmt = AV_PIX_FMT_YUV420P;
else if (strncmp("420MPEG2", tokstart, 8) == 0)
- alt_pix_fmt = PIX_FMT_YUV420P;
+ alt_pix_fmt = AV_PIX_FMT_YUV420P;
else if (strncmp("420PALDV", tokstart, 8) == 0)
- alt_pix_fmt = PIX_FMT_YUV420P;
+ alt_pix_fmt = AV_PIX_FMT_YUV420P;
else if (strncmp("411", tokstart, 3) == 0)
- alt_pix_fmt = PIX_FMT_YUV411P;
+ alt_pix_fmt = AV_PIX_FMT_YUV411P;
else if (strncmp("422", tokstart, 3) == 0)
- alt_pix_fmt = PIX_FMT_YUV422P;
+ alt_pix_fmt = AV_PIX_FMT_YUV422P;
else if (strncmp("444", tokstart, 3) == 0)
- alt_pix_fmt = PIX_FMT_YUV444P;
+ alt_pix_fmt = AV_PIX_FMT_YUV444P;
}
while (tokstart < header_end && *tokstart != 0x20)
tokstart++;
@@ -331,9 +334,9 @@ static int yuv4_read_header(AVFormatContext *s, AVFormatParameters *ap)
return -1;
}
- if (pix_fmt == PIX_FMT_NONE) {
- if (alt_pix_fmt == PIX_FMT_NONE)
- pix_fmt = PIX_FMT_YUV420P;
+ if (pix_fmt == AV_PIX_FMT_NONE) {
+ if (alt_pix_fmt == AV_PIX_FMT_NONE)
+ pix_fmt = AV_PIX_FMT_YUV420P;
else
pix_fmt = alt_pix_fmt;
}
@@ -358,7 +361,7 @@ static int yuv4_read_header(AVFormatContext *s, AVFormatParameters *ap)
avpriv_set_pts_info(st, 64, rated, raten);
st->codec->pix_fmt = pix_fmt;
st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
- st->codec->codec_id = CODEC_ID_RAWVIDEO;
+ st->codec->codec_id = AV_CODEC_ID_RAWVIDEO;
st->sample_aspect_ratio = (AVRational){ aspectn, aspectd };
st->codec->chroma_sample_location = chroma_sample_location;
@@ -424,11 +427,11 @@ static int yuv4_probe(AVProbeData *pd)
#if CONFIG_YUV4MPEGPIPE_DEMUXER
AVInputFormat ff_yuv4mpegpipe_demuxer = {
.name = "yuv4mpegpipe",
- .long_name = NULL_IF_CONFIG_SMALL("YUV4MPEG pipe format"),
+ .long_name = NULL_IF_CONFIG_SMALL("YUV4MPEG pipe"),
.priv_data_size = sizeof(struct frame_attributes),
.read_probe = yuv4_probe,
.read_header = yuv4_read_header,
.read_packet = yuv4_read_packet,
- .extensions = "y4m"
+ .extensions = "y4m",
};
#endif
diff --git a/gst-libs/ext/libav/libavresample/Makefile b/gst-libs/ext/libav/libavresample/Makefile
new file mode 100644
index 0000000..6805280
--- /dev/null
+++ b/gst-libs/ext/libav/libavresample/Makefile
@@ -0,0 +1,16 @@
+NAME = avresample
+FFLIBS = avutil
+
+HEADERS = avresample.h \
+ version.h \
+
+OBJS = audio_convert.o \
+ audio_data.o \
+ audio_mix.o \
+ audio_mix_matrix.o \
+ dither.o \
+ options.o \
+ resample.o \
+ utils.o \
+
+TESTPROGS = avresample
diff --git a/gst-libs/ext/libav/libavresample/arm/Makefile b/gst-libs/ext/libav/libavresample/arm/Makefile
new file mode 100644
index 0000000..55683cb
--- /dev/null
+++ b/gst-libs/ext/libav/libavresample/arm/Makefile
@@ -0,0 +1,2 @@
+OBJS += arm/audio_convert_init.o
+NEON-OBJS += arm/audio_convert_neon.o
diff --git a/gst-libs/ext/libav/libavresample/arm/audio_convert_init.c b/gst-libs/ext/libav/libavresample/arm/audio_convert_init.c
new file mode 100644
index 0000000..bbb7bae
--- /dev/null
+++ b/gst-libs/ext/libav/libavresample/arm/audio_convert_init.c
@@ -0,0 +1,49 @@
+/*
+ * 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
+ */
+
+#include <stdint.h>
+
+#include "config.h"
+#include "libavutil/attributes.h"
+#include "libavutil/cpu.h"
+#include "libavutil/arm/cpu.h"
+#include "libavutil/samplefmt.h"
+#include "libavresample/audio_convert.h"
+
+void ff_conv_flt_to_s16_neon(int16_t *dst, const float *src, int len);
+void ff_conv_fltp_to_s16_neon(int16_t *dst, float *const *src,
+ int len, int channels);
+void ff_conv_fltp_to_s16_2ch_neon(int16_t *dst, float *const *src,
+ int len, int channels);
+
+av_cold void ff_audio_convert_init_arm(AudioConvert *ac)
+{
+ int cpu_flags = av_get_cpu_flags();
+
+ if (have_neon(cpu_flags)) {
+ ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_FLT,
+ 0, 16, 8, "NEON",
+ ff_conv_flt_to_s16_neon);
+ ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_FLTP,
+ 0, 16, 8, "NEON",
+ ff_conv_fltp_to_s16_neon);
+ ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_FLTP,
+ 2, 16, 8, "NEON",
+ ff_conv_fltp_to_s16_2ch_neon);
+ }
+}
diff --git a/gst-libs/ext/libav/libavresample/arm/audio_convert_neon.S b/gst-libs/ext/libav/libavresample/arm/audio_convert_neon.S
new file mode 100644
index 0000000..092ce0c
--- /dev/null
+++ b/gst-libs/ext/libav/libavresample/arm/audio_convert_neon.S
@@ -0,0 +1,363 @@
+/*
+ * Copyright (c) 2008 Mans Rullgard <mans@mansr.com>
+ *
+ * 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
+ */
+
+#include "config.h"
+#include "libavutil/arm/asm.S"
+
+function ff_conv_flt_to_s16_neon, export=1
+ subs r2, r2, #8
+ vld1.32 {q0}, [r1,:128]!
+ vcvt.s32.f32 q8, q0, #31
+ vld1.32 {q1}, [r1,:128]!
+ vcvt.s32.f32 q9, q1, #31
+ beq 3f
+ bics r12, r2, #15
+ beq 2f
+1: subs r12, r12, #16
+ vqrshrn.s32 d4, q8, #16
+ vld1.32 {q0}, [r1,:128]!
+ vcvt.s32.f32 q0, q0, #31
+ vqrshrn.s32 d5, q9, #16
+ vld1.32 {q1}, [r1,:128]!
+ vcvt.s32.f32 q1, q1, #31
+ vqrshrn.s32 d6, q0, #16
+ vst1.16 {q2}, [r0,:128]!
+ vqrshrn.s32 d7, q1, #16
+ vld1.32 {q8}, [r1,:128]!
+ vcvt.s32.f32 q8, q8, #31
+ vld1.32 {q9}, [r1,:128]!
+ vcvt.s32.f32 q9, q9, #31
+ vst1.16 {q3}, [r0,:128]!
+ bne 1b
+ ands r2, r2, #15
+ beq 3f
+2: vld1.32 {q0}, [r1,:128]!
+ vqrshrn.s32 d4, q8, #16
+ vcvt.s32.f32 q0, q0, #31
+ vld1.32 {q1}, [r1,:128]!
+ vqrshrn.s32 d5, q9, #16
+ vcvt.s32.f32 q1, q1, #31
+ vqrshrn.s32 d6, q0, #16
+ vst1.16 {q2}, [r0,:128]!
+ vqrshrn.s32 d7, q1, #16
+ vst1.16 {q3}, [r0,:128]!
+ bx lr
+3: vqrshrn.s32 d4, q8, #16
+ vqrshrn.s32 d5, q9, #16
+ vst1.16 {q2}, [r0,:128]!
+ bx lr
+endfunc
+
+function ff_conv_fltp_to_s16_2ch_neon, export=1
+ ldm r1, {r1, r3}
+ subs r2, r2, #8
+ vld1.32 {q0}, [r1,:128]!
+ vcvt.s32.f32 q8, q0, #31
+ vld1.32 {q1}, [r1,:128]!
+ vcvt.s32.f32 q9, q1, #31
+ vld1.32 {q10}, [r3,:128]!
+ vcvt.s32.f32 q10, q10, #31
+ vld1.32 {q11}, [r3,:128]!
+ vcvt.s32.f32 q11, q11, #31
+ beq 3f
+ bics r12, r2, #15
+ beq 2f
+1: subs r12, r12, #16
+ vld1.32 {q0}, [r1,:128]!
+ vcvt.s32.f32 q0, q0, #31
+ vsri.32 q10, q8, #16
+ vld1.32 {q1}, [r1,:128]!
+ vcvt.s32.f32 q1, q1, #31
+ vld1.32 {q12}, [r3,:128]!
+ vcvt.s32.f32 q12, q12, #31
+ vld1.32 {q13}, [r3,:128]!
+ vsri.32 q11, q9, #16
+ vst1.16 {q10}, [r0,:128]!
+ vcvt.s32.f32 q13, q13, #31
+ vst1.16 {q11}, [r0,:128]!
+ vsri.32 q12, q0, #16
+ vld1.32 {q8}, [r1,:128]!
+ vsri.32 q13, q1, #16
+ vst1.16 {q12}, [r0,:128]!
+ vcvt.s32.f32 q8, q8, #31
+ vld1.32 {q9}, [r1,:128]!
+ vcvt.s32.f32 q9, q9, #31
+ vld1.32 {q10}, [r3,:128]!
+ vcvt.s32.f32 q10, q10, #31
+ vld1.32 {q11}, [r3,:128]!
+ vcvt.s32.f32 q11, q11, #31
+ vst1.16 {q13}, [r0,:128]!
+ bne 1b
+ ands r2, r2, #15
+ beq 3f
+2: vsri.32 q10, q8, #16
+ vld1.32 {q0}, [r1,:128]!
+ vcvt.s32.f32 q0, q0, #31
+ vld1.32 {q1}, [r1,:128]!
+ vcvt.s32.f32 q1, q1, #31
+ vld1.32 {q12}, [r3,:128]!
+ vcvt.s32.f32 q12, q12, #31
+ vsri.32 q11, q9, #16
+ vld1.32 {q13}, [r3,:128]!
+ vcvt.s32.f32 q13, q13, #31
+ vst1.16 {q10}, [r0,:128]!
+ vsri.32 q12, q0, #16
+ vst1.16 {q11}, [r0,:128]!
+ vsri.32 q13, q1, #16
+ vst1.16 {q12-q13},[r0,:128]!
+ bx lr
+3: vsri.32 q10, q8, #16
+ vsri.32 q11, q9, #16
+ vst1.16 {q10-q11},[r0,:128]!
+ bx lr
+endfunc
+
+function ff_conv_fltp_to_s16_neon, export=1
+ cmp r3, #2
+ itt lt
+ ldrlt r1, [r1]
+ blt ff_conv_flt_to_s16_neon
+ beq ff_conv_fltp_to_s16_2ch_neon
+
+ push {r4-r8, lr}
+ cmp r3, #4
+ lsl r12, r3, #1
+ blt 4f
+
+ @ 4 channels
+5: ldm r1!, {r4-r7}
+ mov lr, r2
+ mov r8, r0
+ vld1.32 {q8}, [r4,:128]!
+ vcvt.s32.f32 q8, q8, #31
+ vld1.32 {q9}, [r5,:128]!
+ vcvt.s32.f32 q9, q9, #31
+ vld1.32 {q10}, [r6,:128]!
+ vcvt.s32.f32 q10, q10, #31
+ vld1.32 {q11}, [r7,:128]!
+ vcvt.s32.f32 q11, q11, #31
+6: subs lr, lr, #8
+ vld1.32 {q0}, [r4,:128]!
+ vcvt.s32.f32 q0, q0, #31
+ vsri.32 q9, q8, #16
+ vld1.32 {q1}, [r5,:128]!
+ vcvt.s32.f32 q1, q1, #31
+ vsri.32 q11, q10, #16
+ vld1.32 {q2}, [r6,:128]!
+ vcvt.s32.f32 q2, q2, #31
+ vzip.32 d18, d22
+ vld1.32 {q3}, [r7,:128]!
+ vcvt.s32.f32 q3, q3, #31
+ vzip.32 d19, d23
+ vst1.16 {d18}, [r8], r12
+ vsri.32 q1, q0, #16
+ vst1.16 {d22}, [r8], r12
+ vsri.32 q3, q2, #16
+ vst1.16 {d19}, [r8], r12
+ vzip.32 d2, d6
+ vst1.16 {d23}, [r8], r12
+ vzip.32 d3, d7
+ beq 7f
+ vld1.32 {q8}, [r4,:128]!
+ vcvt.s32.f32 q8, q8, #31
+ vst1.16 {d2}, [r8], r12
+ vld1.32 {q9}, [r5,:128]!
+ vcvt.s32.f32 q9, q9, #31
+ vst1.16 {d6}, [r8], r12
+ vld1.32 {q10}, [r6,:128]!
+ vcvt.s32.f32 q10, q10, #31
+ vst1.16 {d3}, [r8], r12
+ vld1.32 {q11}, [r7,:128]!
+ vcvt.s32.f32 q11, q11, #31
+ vst1.16 {d7}, [r8], r12
+ b 6b
+7: vst1.16 {d2}, [r8], r12
+ vst1.16 {d6}, [r8], r12
+ vst1.16 {d3}, [r8], r12
+ vst1.16 {d7}, [r8], r12
+ subs r3, r3, #4
+ it eq
+ popeq {r4-r8, pc}
+ cmp r3, #4
+ add r0, r0, #8
+ bge 5b
+
+ @ 2 channels
+4: cmp r3, #2
+ blt 4f
+ ldm r1!, {r4-r5}
+ mov lr, r2
+ mov r8, r0
+ tst lr, #8
+ vld1.32 {q8}, [r4,:128]!
+ vcvt.s32.f32 q8, q8, #31
+ vld1.32 {q9}, [r5,:128]!
+ vcvt.s32.f32 q9, q9, #31
+ vld1.32 {q10}, [r4,:128]!
+ vcvt.s32.f32 q10, q10, #31
+ vld1.32 {q11}, [r5,:128]!
+ vcvt.s32.f32 q11, q11, #31
+ beq 6f
+ subs lr, lr, #8
+ beq 7f
+ vsri.32 d18, d16, #16
+ vsri.32 d19, d17, #16
+ vld1.32 {q8}, [r4,:128]!
+ vcvt.s32.f32 q8, q8, #31
+ vst1.32 {d18[0]}, [r8], r12
+ vsri.32 d22, d20, #16
+ vst1.32 {d18[1]}, [r8], r12
+ vsri.32 d23, d21, #16
+ vst1.32 {d19[0]}, [r8], r12
+ vst1.32 {d19[1]}, [r8], r12
+ vld1.32 {q9}, [r5,:128]!
+ vcvt.s32.f32 q9, q9, #31
+ vst1.32 {d22[0]}, [r8], r12
+ vst1.32 {d22[1]}, [r8], r12
+ vld1.32 {q10}, [r4,:128]!
+ vcvt.s32.f32 q10, q10, #31
+ vst1.32 {d23[0]}, [r8], r12
+ vst1.32 {d23[1]}, [r8], r12
+ vld1.32 {q11}, [r5,:128]!
+ vcvt.s32.f32 q11, q11, #31
+6: subs lr, lr, #16
+ vld1.32 {q0}, [r4,:128]!
+ vcvt.s32.f32 q0, q0, #31
+ vsri.32 d18, d16, #16
+ vld1.32 {q1}, [r5,:128]!
+ vcvt.s32.f32 q1, q1, #31
+ vsri.32 d19, d17, #16
+ vld1.32 {q2}, [r4,:128]!
+ vcvt.s32.f32 q2, q2, #31
+ vld1.32 {q3}, [r5,:128]!
+ vcvt.s32.f32 q3, q3, #31
+ vst1.32 {d18[0]}, [r8], r12
+ vsri.32 d22, d20, #16
+ vst1.32 {d18[1]}, [r8], r12
+ vsri.32 d23, d21, #16
+ vst1.32 {d19[0]}, [r8], r12
+ vsri.32 d2, d0, #16
+ vst1.32 {d19[1]}, [r8], r12
+ vsri.32 d3, d1, #16
+ vst1.32 {d22[0]}, [r8], r12
+ vsri.32 d6, d4, #16
+ vst1.32 {d22[1]}, [r8], r12
+ vsri.32 d7, d5, #16
+ vst1.32 {d23[0]}, [r8], r12
+ vst1.32 {d23[1]}, [r8], r12
+ beq 6f
+ vld1.32 {q8}, [r4,:128]!
+ vcvt.s32.f32 q8, q8, #31
+ vst1.32 {d2[0]}, [r8], r12
+ vst1.32 {d2[1]}, [r8], r12
+ vld1.32 {q9}, [r5,:128]!
+ vcvt.s32.f32 q9, q9, #31
+ vst1.32 {d3[0]}, [r8], r12
+ vst1.32 {d3[1]}, [r8], r12
+ vld1.32 {q10}, [r4,:128]!
+ vcvt.s32.f32 q10, q10, #31
+ vst1.32 {d6[0]}, [r8], r12
+ vst1.32 {d6[1]}, [r8], r12
+ vld1.32 {q11}, [r5,:128]!
+ vcvt.s32.f32 q11, q11, #31
+ vst1.32 {d7[0]}, [r8], r12
+ vst1.32 {d7[1]}, [r8], r12
+ bgt 6b
+6: vst1.32 {d2[0]}, [r8], r12
+ vst1.32 {d2[1]}, [r8], r12
+ vst1.32 {d3[0]}, [r8], r12
+ vst1.32 {d3[1]}, [r8], r12
+ vst1.32 {d6[0]}, [r8], r12
+ vst1.32 {d6[1]}, [r8], r12
+ vst1.32 {d7[0]}, [r8], r12
+ vst1.32 {d7[1]}, [r8], r12
+ b 8f
+7: vsri.32 d18, d16, #16
+ vsri.32 d19, d17, #16
+ vst1.32 {d18[0]}, [r8], r12
+ vsri.32 d22, d20, #16
+ vst1.32 {d18[1]}, [r8], r12
+ vsri.32 d23, d21, #16
+ vst1.32 {d19[0]}, [r8], r12
+ vst1.32 {d19[1]}, [r8], r12
+ vst1.32 {d22[0]}, [r8], r12
+ vst1.32 {d22[1]}, [r8], r12
+ vst1.32 {d23[0]}, [r8], r12
+ vst1.32 {d23[1]}, [r8], r12
+8: subs r3, r3, #2
+ add r0, r0, #4
+ it eq
+ popeq {r4-r8, pc}
+
+ @ 1 channel
+4: ldr r4, [r1]
+ tst r2, #8
+ mov lr, r2
+ mov r5, r0
+ vld1.32 {q0}, [r4,:128]!
+ vcvt.s32.f32 q0, q0, #31
+ vld1.32 {q1}, [r4,:128]!
+ vcvt.s32.f32 q1, q1, #31
+ bne 8f
+6: subs lr, lr, #16
+ vld1.32 {q2}, [r4,:128]!
+ vcvt.s32.f32 q2, q2, #31
+ vld1.32 {q3}, [r4,:128]!
+ vcvt.s32.f32 q3, q3, #31
+ vst1.16 {d0[1]}, [r5,:16], r12
+ vst1.16 {d0[3]}, [r5,:16], r12
+ vst1.16 {d1[1]}, [r5,:16], r12
+ vst1.16 {d1[3]}, [r5,:16], r12
+ vst1.16 {d2[1]}, [r5,:16], r12
+ vst1.16 {d2[3]}, [r5,:16], r12
+ vst1.16 {d3[1]}, [r5,:16], r12
+ vst1.16 {d3[3]}, [r5,:16], r12
+ beq 7f
+ vld1.32 {q0}, [r4,:128]!
+ vcvt.s32.f32 q0, q0, #31
+ vld1.32 {q1}, [r4,:128]!
+ vcvt.s32.f32 q1, q1, #31
+7: vst1.16 {d4[1]}, [r5,:16], r12
+ vst1.16 {d4[3]}, [r5,:16], r12
+ vst1.16 {d5[1]}, [r5,:16], r12
+ vst1.16 {d5[3]}, [r5,:16], r12
+ vst1.16 {d6[1]}, [r5,:16], r12
+ vst1.16 {d6[3]}, [r5,:16], r12
+ vst1.16 {d7[1]}, [r5,:16], r12
+ vst1.16 {d7[3]}, [r5,:16], r12
+ bgt 6b
+ pop {r4-r8, pc}
+8: subs lr, lr, #8
+ vst1.16 {d0[1]}, [r5,:16], r12
+ vst1.16 {d0[3]}, [r5,:16], r12
+ vst1.16 {d1[1]}, [r5,:16], r12
+ vst1.16 {d1[3]}, [r5,:16], r12
+ vst1.16 {d2[1]}, [r5,:16], r12
+ vst1.16 {d2[3]}, [r5,:16], r12
+ vst1.16 {d3[1]}, [r5,:16], r12
+ vst1.16 {d3[3]}, [r5,:16], r12
+ it eq
+ popeq {r4-r8, pc}
+ vld1.32 {q0}, [r4,:128]!
+ vcvt.s32.f32 q0, q0, #31
+ vld1.32 {q1}, [r4,:128]!
+ vcvt.s32.f32 q1, q1, #31
+ b 6b
+endfunc
diff --git a/gst-libs/ext/libav/libavresample/audio_convert.c b/gst-libs/ext/libav/libavresample/audio_convert.c
new file mode 100644
index 0000000..eb3bc1f
--- /dev/null
+++ b/gst-libs/ext/libav/libavresample/audio_convert.c
@@ -0,0 +1,369 @@
+/*
+ * Copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at>
+ * Copyright (c) 2012 Justin Ruggles <justin.ruggles@gmail.com>
+ *
+ * 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
+ */
+
+#include <stdint.h>
+
+#include "config.h"
+#include "libavutil/common.h"
+#include "libavutil/libm.h"
+#include "libavutil/log.h"
+#include "libavutil/mem.h"
+#include "libavutil/samplefmt.h"
+#include "audio_convert.h"
+#include "audio_data.h"
+#include "dither.h"
+#include "internal.h"
+
+enum ConvFuncType {
+ CONV_FUNC_TYPE_FLAT,
+ CONV_FUNC_TYPE_INTERLEAVE,
+ CONV_FUNC_TYPE_DEINTERLEAVE,
+};
+
+typedef void (conv_func_flat)(uint8_t *out, const uint8_t *in, int len);
+
+typedef void (conv_func_interleave)(uint8_t *out, uint8_t *const *in,
+ int len, int channels);
+
+typedef void (conv_func_deinterleave)(uint8_t **out, const uint8_t *in, int len,
+ int channels);
+
+struct AudioConvert {
+ AVAudioResampleContext *avr;
+ DitherContext *dc;
+ enum AVSampleFormat in_fmt;
+ enum AVSampleFormat out_fmt;
+ int channels;
+ int planes;
+ int ptr_align;
+ int samples_align;
+ int has_optimized_func;
+ const char *func_descr;
+ const char *func_descr_generic;
+ enum ConvFuncType func_type;
+ conv_func_flat *conv_flat;
+ conv_func_flat *conv_flat_generic;
+ conv_func_interleave *conv_interleave;
+ conv_func_interleave *conv_interleave_generic;
+ conv_func_deinterleave *conv_deinterleave;
+ conv_func_deinterleave *conv_deinterleave_generic;
+};
+
+void ff_audio_convert_set_func(AudioConvert *ac, enum AVSampleFormat out_fmt,
+ enum AVSampleFormat in_fmt, int channels,
+ int ptr_align, int samples_align,
+ const char *descr, void *conv)
+{
+ int found = 0;
+
+ switch (ac->func_type) {
+ case CONV_FUNC_TYPE_FLAT:
+ if (av_get_packed_sample_fmt(ac->in_fmt) == in_fmt &&
+ av_get_packed_sample_fmt(ac->out_fmt) == out_fmt) {
+ ac->conv_flat = conv;
+ ac->func_descr = descr;
+ ac->ptr_align = ptr_align;
+ ac->samples_align = samples_align;
+ if (ptr_align == 1 && samples_align == 1) {
+ ac->conv_flat_generic = conv;
+ ac->func_descr_generic = descr;
+ } else {
+ ac->has_optimized_func = 1;
+ }
+ found = 1;
+ }
+ break;
+ case CONV_FUNC_TYPE_INTERLEAVE:
+ if (ac->in_fmt == in_fmt && ac->out_fmt == out_fmt &&
+ (!channels || ac->channels == channels)) {
+ ac->conv_interleave = conv;
+ ac->func_descr = descr;
+ ac->ptr_align = ptr_align;
+ ac->samples_align = samples_align;
+ if (ptr_align == 1 && samples_align == 1) {
+ ac->conv_interleave_generic = conv;
+ ac->func_descr_generic = descr;
+ } else {
+ ac->has_optimized_func = 1;
+ }
+ found = 1;
+ }
+ break;
+ case CONV_FUNC_TYPE_DEINTERLEAVE:
+ if (ac->in_fmt == in_fmt && ac->out_fmt == out_fmt &&
+ (!channels || ac->channels == channels)) {
+ ac->conv_deinterleave = conv;
+ ac->func_descr = descr;
+ ac->ptr_align = ptr_align;
+ ac->samples_align = samples_align;
+ if (ptr_align == 1 && samples_align == 1) {
+ ac->conv_deinterleave_generic = conv;
+ ac->func_descr_generic = descr;
+ } else {
+ ac->has_optimized_func = 1;
+ }
+ found = 1;
+ }
+ break;
+ }
+ if (found) {
+ av_log(ac->avr, AV_LOG_DEBUG, "audio_convert: found function: %-4s "
+ "to %-4s (%s)\n", av_get_sample_fmt_name(ac->in_fmt),
+ av_get_sample_fmt_name(ac->out_fmt), descr);
+ }
+}
+
+#define CONV_FUNC_NAME(dst_fmt, src_fmt) conv_ ## src_fmt ## _to_ ## dst_fmt
+
+#define CONV_LOOP(otype, expr) \
+ do { \
+ *(otype *)po = expr; \
+ pi += is; \
+ po += os; \
+ } while (po < end); \
+
+#define CONV_FUNC_FLAT(ofmt, otype, ifmt, itype, expr) \
+static void CONV_FUNC_NAME(ofmt, ifmt)(uint8_t *out, const uint8_t *in, \
+ int len) \
+{ \
+ int is = sizeof(itype); \
+ int os = sizeof(otype); \
+ const uint8_t *pi = in; \
+ uint8_t *po = out; \
+ uint8_t *end = out + os * len; \
+ CONV_LOOP(otype, expr) \
+}
+
+#define CONV_FUNC_INTERLEAVE(ofmt, otype, ifmt, itype, expr) \
+static void CONV_FUNC_NAME(ofmt, ifmt)(uint8_t *out, const uint8_t **in, \
+ int len, int channels) \
+{ \
+ int ch; \
+ int out_bps = sizeof(otype); \
+ int is = sizeof(itype); \
+ int os = channels * out_bps; \
+ for (ch = 0; ch < channels; ch++) { \
+ const uint8_t *pi = in[ch]; \
+ uint8_t *po = out + ch * out_bps; \
+ uint8_t *end = po + os * len; \
+ CONV_LOOP(otype, expr) \
+ } \
+}
+
+#define CONV_FUNC_DEINTERLEAVE(ofmt, otype, ifmt, itype, expr) \
+static void CONV_FUNC_NAME(ofmt, ifmt)(uint8_t **out, const uint8_t *in, \
+ int len, int channels) \
+{ \
+ int ch; \
+ int in_bps = sizeof(itype); \
+ int is = channels * in_bps; \
+ int os = sizeof(otype); \
+ for (ch = 0; ch < channels; ch++) { \
+ const uint8_t *pi = in + ch * in_bps; \
+ uint8_t *po = out[ch]; \
+ uint8_t *end = po + os * len; \
+ CONV_LOOP(otype, expr) \
+ } \
+}
+
+#define CONV_FUNC_GROUP(ofmt, otype, ifmt, itype, expr) \
+CONV_FUNC_FLAT( ofmt, otype, ifmt, itype, expr) \
+CONV_FUNC_INTERLEAVE( ofmt, otype, ifmt ## P, itype, expr) \
+CONV_FUNC_DEINTERLEAVE(ofmt ## P, otype, ifmt, itype, expr)
+
+CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_U8, uint8_t, *(const uint8_t *)pi)
+CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_U8, uint8_t, (*(const uint8_t *)pi - 0x80) << 8)
+CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_U8, uint8_t, (*(const uint8_t *)pi - 0x80) << 24)
+CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_U8, uint8_t, (*(const uint8_t *)pi - 0x80) * (1.0f / (1 << 7)))
+CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_U8, uint8_t, (*(const uint8_t *)pi - 0x80) * (1.0 / (1 << 7)))
+CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S16, int16_t, (*(const int16_t *)pi >> 8) + 0x80)
+CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_S16, int16_t, *(const int16_t *)pi)
+CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_S16, int16_t, *(const int16_t *)pi << 16)
+CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S16, int16_t, *(const int16_t *)pi * (1.0f / (1 << 15)))
+CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S16, int16_t, *(const int16_t *)pi * (1.0 / (1 << 15)))
+CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S32, int32_t, (*(const int32_t *)pi >> 24) + 0x80)
+CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_S32, int32_t, *(const int32_t *)pi >> 16)
+CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_S32, int32_t, *(const int32_t *)pi)
+CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S32, int32_t, *(const int32_t *)pi * (1.0f / (1U << 31)))
+CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S32, int32_t, *(const int32_t *)pi * (1.0 / (1U << 31)))
+CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_FLT, float, av_clip_uint8( lrintf(*(const float *)pi * (1 << 7)) + 0x80))
+CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, float, av_clip_int16( lrintf(*(const float *)pi * (1 << 15))))
+CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, float, av_clipl_int32(llrintf(*(const float *)pi * (1U << 31))))
+CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_FLT, float, *(const float *)pi)
+CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_FLT, float, *(const float *)pi)
+CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_DBL, double, av_clip_uint8( lrint(*(const double *)pi * (1 << 7)) + 0x80))
+CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, double, av_clip_int16( lrint(*(const double *)pi * (1 << 15))))
+CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, double, av_clipl_int32(llrint(*(const double *)pi * (1U << 31))))
+CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_DBL, double, *(const double *)pi)
+CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_DBL, double, *(const double *)pi)
+
+#define SET_CONV_FUNC_GROUP(ofmt, ifmt) \
+ff_audio_convert_set_func(ac, ofmt, ifmt, 0, 1, 1, "C", CONV_FUNC_NAME(ofmt, ifmt)); \
+ff_audio_convert_set_func(ac, ofmt ## P, ifmt, 0, 1, 1, "C", CONV_FUNC_NAME(ofmt ## P, ifmt)); \
+ff_audio_convert_set_func(ac, ofmt, ifmt ## P, 0, 1, 1, "C", CONV_FUNC_NAME(ofmt, ifmt ## P));
+
+static void set_generic_function(AudioConvert *ac)
+{
+ SET_CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_U8)
+ SET_CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_U8)
+ SET_CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_U8)
+ SET_CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_U8)
+ SET_CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_U8)
+ SET_CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_S16)
+ SET_CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S16)
+ SET_CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_S16)
+ SET_CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S16)
+ SET_CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_S16)
+ SET_CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_S32)
+ SET_CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S32)
+ SET_CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_S32)
+ SET_CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S32)
+ SET_CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_S32)
+ SET_CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_FLT)
+ SET_CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_FLT)
+ SET_CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_FLT)
+ SET_CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_FLT)
+ SET_CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_FLT)
+ SET_CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_DBL)
+ SET_CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_DBL)
+ SET_CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_DBL)
+ SET_CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_DBL)
+ SET_CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_DBL)
+}
+
+void ff_audio_convert_free(AudioConvert **ac)
+{
+ if (!*ac)
+ return;
+ ff_dither_free(&(*ac)->dc);
+ av_freep(ac);
+}
+
+AudioConvert *ff_audio_convert_alloc(AVAudioResampleContext *avr,
+ enum AVSampleFormat out_fmt,
+ enum AVSampleFormat in_fmt,
+ int channels, int sample_rate)
+{
+ AudioConvert *ac;
+ int in_planar, out_planar;
+
+ ac = av_mallocz(sizeof(*ac));
+ if (!ac)
+ return NULL;
+
+ ac->avr = avr;
+ ac->out_fmt = out_fmt;
+ ac->in_fmt = in_fmt;
+ ac->channels = channels;
+
+ if (avr->dither_method != AV_RESAMPLE_DITHER_NONE &&
+ av_get_packed_sample_fmt(out_fmt) == AV_SAMPLE_FMT_S16 &&
+ av_get_bytes_per_sample(in_fmt) > 2) {
+ ac->dc = ff_dither_alloc(avr, out_fmt, in_fmt, channels, sample_rate);
+ if (!ac->dc) {
+ av_free(ac);
+ return NULL;
+ }
+ return ac;
+ }
+
+ in_planar = av_sample_fmt_is_planar(in_fmt);
+ out_planar = av_sample_fmt_is_planar(out_fmt);
+
+ if (in_planar == out_planar) {
+ ac->func_type = CONV_FUNC_TYPE_FLAT;
+ ac->planes = in_planar ? ac->channels : 1;
+ } else if (in_planar)
+ ac->func_type = CONV_FUNC_TYPE_INTERLEAVE;
+ else
+ ac->func_type = CONV_FUNC_TYPE_DEINTERLEAVE;
+
+ set_generic_function(ac);
+
+ if (ARCH_ARM)
+ ff_audio_convert_init_arm(ac);
+ if (ARCH_X86)
+ ff_audio_convert_init_x86(ac);
+
+ return ac;
+}
+
+int ff_audio_convert(AudioConvert *ac, AudioData *out, AudioData *in)
+{
+ int use_generic = 1;
+ int len = in->nb_samples;
+
+ if (ac->dc) {
+ /* dithered conversion */
+ av_dlog(ac->avr, "%d samples - audio_convert: %s to %s (dithered)\n",
+ len, av_get_sample_fmt_name(ac->in_fmt),
+ av_get_sample_fmt_name(ac->out_fmt));
+
+ return ff_convert_dither(ac->dc, out, in);
+ }
+
+ /* determine whether to use the optimized function based on pointer and
+ samples alignment in both the input and output */
+ if (ac->has_optimized_func) {
+ int ptr_align = FFMIN(in->ptr_align, out->ptr_align);
+ int samples_align = FFMIN(in->samples_align, out->samples_align);
+ int aligned_len = FFALIGN(len, ac->samples_align);
+ if (!(ptr_align % ac->ptr_align) && samples_align >= aligned_len) {
+ len = aligned_len;
+ use_generic = 0;
+ }
+ }
+ av_dlog(ac->avr, "%d samples - audio_convert: %s to %s (%s)\n", len,
+ av_get_sample_fmt_name(ac->in_fmt),
+ av_get_sample_fmt_name(ac->out_fmt),
+ use_generic ? ac->func_descr_generic : ac->func_descr);
+
+ switch (ac->func_type) {
+ case CONV_FUNC_TYPE_FLAT: {
+ int p;
+ if (!in->is_planar)
+ len *= in->channels;
+ if (use_generic) {
+ for (p = 0; p < ac->planes; p++)
+ ac->conv_flat_generic(out->data[p], in->data[p], len);
+ } else {
+ for (p = 0; p < ac->planes; p++)
+ ac->conv_flat(out->data[p], in->data[p], len);
+ }
+ break;
+ }
+ case CONV_FUNC_TYPE_INTERLEAVE:
+ if (use_generic)
+ ac->conv_interleave_generic(out->data[0], in->data, len, ac->channels);
+ else
+ ac->conv_interleave(out->data[0], in->data, len, ac->channels);
+ break;
+ case CONV_FUNC_TYPE_DEINTERLEAVE:
+ if (use_generic)
+ ac->conv_deinterleave_generic(out->data, in->data[0], len, ac->channels);
+ else
+ ac->conv_deinterleave(out->data, in->data[0], len, ac->channels);
+ break;
+ }
+
+ out->nb_samples = in->nb_samples;
+ return 0;
+}
diff --git a/gst-libs/ext/libav/libavresample/audio_convert.h b/gst-libs/ext/libav/libavresample/audio_convert.h
new file mode 100644
index 0000000..b8808f1
--- /dev/null
+++ b/gst-libs/ext/libav/libavresample/audio_convert.h
@@ -0,0 +1,101 @@
+/*
+ * Copyright (c) 2012 Justin Ruggles <justin.ruggles@gmail.com>
+ *
+ * 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
+ */
+
+#ifndef AVRESAMPLE_AUDIO_CONVERT_H
+#define AVRESAMPLE_AUDIO_CONVERT_H
+
+#include "libavutil/samplefmt.h"
+#include "avresample.h"
+#include "audio_data.h"
+
+typedef struct AudioConvert AudioConvert;
+
+/**
+ * Set conversion function if the parameters match.
+ *
+ * This compares the parameters of the conversion function to the parameters
+ * in the AudioConvert context. If the parameters do not match, no changes are
+ * made to the active functions. If the parameters do match and the alignment
+ * is not constrained, the function is set as the generic conversion function.
+ * If the parameters match and the alignment is constrained, the function is
+ * set as the optimized conversion function.
+ *
+ * @param ac AudioConvert context
+ * @param out_fmt output sample format
+ * @param in_fmt input sample format
+ * @param channels number of channels, or 0 for any number of channels
+ * @param ptr_align buffer pointer alignment, in bytes
+ * @param samples_align buffer size alignment, in samples
+ * @param descr function type description (e.g. "C" or "SSE")
+ * @param conv conversion function pointer
+ */
+void ff_audio_convert_set_func(AudioConvert *ac, enum AVSampleFormat out_fmt,
+ enum AVSampleFormat in_fmt, int channels,
+ int ptr_align, int samples_align,
+ const char *descr, void *conv);
+
+/**
+ * Allocate and initialize AudioConvert context for sample format conversion.
+ *
+ * @param avr AVAudioResampleContext
+ * @param out_fmt output sample format
+ * @param in_fmt input sample format
+ * @param channels number of channels
+ * @param sample_rate sample rate (used for dithering)
+ * @return newly-allocated AudioConvert context
+ */
+AudioConvert *ff_audio_convert_alloc(AVAudioResampleContext *avr,
+ enum AVSampleFormat out_fmt,
+ enum AVSampleFormat in_fmt,
+ int channels, int sample_rate);
+
+/**
+ * Free AudioConvert.
+ *
+ * The AudioConvert must have been previously allocated with ff_audio_convert_alloc().
+ *
+ * @param ac AudioConvert struct
+ */
+void ff_audio_convert_free(AudioConvert **ac);
+
+/**
+ * Convert audio data from one sample format to another.
+ *
+ * For each call, the alignment of the input and output AudioData buffers are
+ * examined to determine whether to use the generic or optimized conversion
+ * function (when available).
+ *
+ * The number of samples to convert is determined by in->nb_samples. The output
+ * buffer must be large enough to handle this many samples. out->nb_samples is
+ * set by this function before a successful return.
+ *
+ * @param ac AudioConvert context
+ * @param out output audio data
+ * @param in input audio data
+ * @return 0 on success, negative AVERROR code on failure
+ */
+int ff_audio_convert(AudioConvert *ac, AudioData *out, AudioData *in);
+
+/* arch-specific initialization functions */
+
+void ff_audio_convert_init_arm(AudioConvert *ac);
+void ff_audio_convert_init_x86(AudioConvert *ac);
+
+#endif /* AVRESAMPLE_AUDIO_CONVERT_H */
diff --git a/gst-libs/ext/libav/libavresample/audio_data.c b/gst-libs/ext/libav/libavresample/audio_data.c
new file mode 100644
index 0000000..199a68c
--- /dev/null
+++ b/gst-libs/ext/libav/libavresample/audio_data.c
@@ -0,0 +1,346 @@
+/*
+ * Copyright (c) 2012 Justin Ruggles <justin.ruggles@gmail.com>
+ *
+ * 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
+ */
+
+#include <stdint.h>
+#include <string.h>
+
+#include "libavutil/mem.h"
+#include "audio_data.h"
+
+static const AVClass audio_data_class = {
+ .class_name = "AudioData",
+ .item_name = av_default_item_name,
+ .version = LIBAVUTIL_VERSION_INT,
+};
+
+/*
+ * Calculate alignment for data pointers.
+ */
+static void calc_ptr_alignment(AudioData *a)
+{
+ int p;
+ int min_align = 128;
+
+ for (p = 0; p < a->planes; p++) {
+ int cur_align = 128;
+ while ((intptr_t)a->data[p] % cur_align)
+ cur_align >>= 1;
+ if (cur_align < min_align)
+ min_align = cur_align;
+ }
+ a->ptr_align = min_align;
+}
+
+int ff_audio_data_set_channels(AudioData *a, int channels)
+{
+ if (channels < 1 || channels > AVRESAMPLE_MAX_CHANNELS ||
+ channels > a->allocated_channels)
+ return AVERROR(EINVAL);
+
+ a->channels = channels;
+ a->planes = a->is_planar ? channels : 1;
+
+ calc_ptr_alignment(a);
+
+ return 0;
+}
+
+int ff_audio_data_init(AudioData *a, uint8_t **src, int plane_size, int channels,
+ int nb_samples, enum AVSampleFormat sample_fmt,
+ int read_only, const char *name)
+{
+ int p;
+
+ memset(a, 0, sizeof(*a));
+ a->class = &audio_data_class;
+
+ if (channels < 1 || channels > AVRESAMPLE_MAX_CHANNELS) {
+ av_log(a, AV_LOG_ERROR, "invalid channel count: %d\n", channels);
+ return AVERROR(EINVAL);
+ }
+
+ a->sample_size = av_get_bytes_per_sample(sample_fmt);
+ if (!a->sample_size) {
+ av_log(a, AV_LOG_ERROR, "invalid sample format\n");
+ return AVERROR(EINVAL);
+ }
+ a->is_planar = av_sample_fmt_is_planar(sample_fmt);
+ a->planes = a->is_planar ? channels : 1;
+ a->stride = a->sample_size * (a->is_planar ? 1 : channels);
+
+ for (p = 0; p < (a->is_planar ? channels : 1); p++) {
+ if (!src[p]) {
+ av_log(a, AV_LOG_ERROR, "invalid NULL pointer for src[%d]\n", p);
+ return AVERROR(EINVAL);
+ }
+ a->data[p] = src[p];
+ }
+ a->allocated_samples = nb_samples * !read_only;
+ a->nb_samples = nb_samples;
+ a->sample_fmt = sample_fmt;
+ a->channels = channels;
+ a->allocated_channels = channels;
+ a->read_only = read_only;
+ a->allow_realloc = 0;
+ a->name = name ? name : "{no name}";
+
+ calc_ptr_alignment(a);
+ a->samples_align = plane_size / a->stride;
+
+ return 0;
+}
+
+AudioData *ff_audio_data_alloc(int channels, int nb_samples,
+ enum AVSampleFormat sample_fmt, const char *name)
+{
+ AudioData *a;
+ int ret;
+
+ if (channels < 1 || channels > AVRESAMPLE_MAX_CHANNELS)
+ return NULL;
+
+ a = av_mallocz(sizeof(*a));
+ if (!a)
+ return NULL;
+
+ a->sample_size = av_get_bytes_per_sample(sample_fmt);
+ if (!a->sample_size) {
+ av_free(a);
+ return NULL;
+ }
+ a->is_planar = av_sample_fmt_is_planar(sample_fmt);
+ a->planes = a->is_planar ? channels : 1;
+ a->stride = a->sample_size * (a->is_planar ? 1 : channels);
+
+ a->class = &audio_data_class;
+ a->sample_fmt = sample_fmt;
+ a->channels = channels;
+ a->allocated_channels = channels;
+ a->read_only = 0;
+ a->allow_realloc = 1;
+ a->name = name ? name : "{no name}";
+
+ if (nb_samples > 0) {
+ ret = ff_audio_data_realloc(a, nb_samples);
+ if (ret < 0) {
+ av_free(a);
+ return NULL;
+ }
+ return a;
+ } else {
+ calc_ptr_alignment(a);
+ return a;
+ }
+}
+
+int ff_audio_data_realloc(AudioData *a, int nb_samples)
+{
+ int ret, new_buf_size, plane_size, p;
+
+ /* check if buffer is already large enough */
+ if (a->allocated_samples >= nb_samples)
+ return 0;
+
+ /* validate that the output is not read-only and realloc is allowed */
+ if (a->read_only || !a->allow_realloc)
+ return AVERROR(EINVAL);
+
+ new_buf_size = av_samples_get_buffer_size(&plane_size,
+ a->allocated_channels, nb_samples,
+ a->sample_fmt, 0);
+ if (new_buf_size < 0)
+ return new_buf_size;
+
+ /* if there is already data in the buffer and the sample format is planar,
+ allocate a new buffer and copy the data, otherwise just realloc the
+ internal buffer and set new data pointers */
+ if (a->nb_samples > 0 && a->is_planar) {
+ uint8_t *new_data[AVRESAMPLE_MAX_CHANNELS] = { NULL };
+
+ ret = av_samples_alloc(new_data, &plane_size, a->allocated_channels,
+ nb_samples, a->sample_fmt, 0);
+ if (ret < 0)
+ return ret;
+
+ for (p = 0; p < a->planes; p++)
+ memcpy(new_data[p], a->data[p], a->nb_samples * a->stride);
+
+ av_freep(&a->buffer);
+ memcpy(a->data, new_data, sizeof(new_data));
+ a->buffer = a->data[0];
+ } else {
+ av_freep(&a->buffer);
+ a->buffer = av_malloc(new_buf_size);
+ if (!a->buffer)
+ return AVERROR(ENOMEM);
+ ret = av_samples_fill_arrays(a->data, &plane_size, a->buffer,
+ a->allocated_channels, nb_samples,
+ a->sample_fmt, 0);
+ if (ret < 0)
+ return ret;
+ }
+ a->buffer_size = new_buf_size;
+ a->allocated_samples = nb_samples;
+
+ calc_ptr_alignment(a);
+ a->samples_align = plane_size / a->stride;
+
+ return 0;
+}
+
+void ff_audio_data_free(AudioData **a)
+{
+ if (!*a)
+ return;
+ av_free((*a)->buffer);
+ av_freep(a);
+}
+
+int ff_audio_data_copy(AudioData *dst, AudioData *src)
+{
+ int ret, p;
+
+ /* validate input/output compatibility */
+ if (dst->sample_fmt != src->sample_fmt || dst->channels < src->channels)
+ return AVERROR(EINVAL);
+
+ /* if the input is empty, just empty the output */
+ if (!src->nb_samples) {
+ dst->nb_samples = 0;
+ return 0;
+ }
+
+ /* reallocate output if necessary */
+ ret = ff_audio_data_realloc(dst, src->nb_samples);
+ if (ret < 0)
+ return ret;
+
+ /* copy data */
+ for (p = 0; p < src->planes; p++)
+ memcpy(dst->data[p], src->data[p], src->nb_samples * src->stride);
+ dst->nb_samples = src->nb_samples;
+
+ return 0;
+}
+
+int ff_audio_data_combine(AudioData *dst, int dst_offset, AudioData *src,
+ int src_offset, int nb_samples)
+{
+ int ret, p, dst_offset2, dst_move_size;
+
+ /* validate input/output compatibility */
+ if (dst->sample_fmt != src->sample_fmt || dst->channels != src->channels) {
+ av_log(src, AV_LOG_ERROR, "sample format mismatch\n");
+ return AVERROR(EINVAL);
+ }
+
+ /* validate offsets are within the buffer bounds */
+ if (dst_offset < 0 || dst_offset > dst->nb_samples ||
+ src_offset < 0 || src_offset > src->nb_samples) {
+ av_log(src, AV_LOG_ERROR, "offset out-of-bounds: src=%d dst=%d\n",
+ src_offset, dst_offset);
+ return AVERROR(EINVAL);
+ }
+
+ /* check offsets and sizes to see if we can just do nothing and return */
+ if (nb_samples > src->nb_samples - src_offset)
+ nb_samples = src->nb_samples - src_offset;
+ if (nb_samples <= 0)
+ return 0;
+
+ /* validate that the output is not read-only */
+ if (dst->read_only) {
+ av_log(dst, AV_LOG_ERROR, "dst is read-only\n");
+ return AVERROR(EINVAL);
+ }
+
+ /* reallocate output if necessary */
+ ret = ff_audio_data_realloc(dst, dst->nb_samples + nb_samples);
+ if (ret < 0) {
+ av_log(dst, AV_LOG_ERROR, "error reallocating dst\n");
+ return ret;
+ }
+
+ dst_offset2 = dst_offset + nb_samples;
+ dst_move_size = dst->nb_samples - dst_offset;
+
+ for (p = 0; p < src->planes; p++) {
+ if (dst_move_size > 0) {
+ memmove(dst->data[p] + dst_offset2 * dst->stride,
+ dst->data[p] + dst_offset * dst->stride,
+ dst_move_size * dst->stride);
+ }
+ memcpy(dst->data[p] + dst_offset * dst->stride,
+ src->data[p] + src_offset * src->stride,
+ nb_samples * src->stride);
+ }
+ dst->nb_samples += nb_samples;
+
+ return 0;
+}
+
+void ff_audio_data_drain(AudioData *a, int nb_samples)
+{
+ if (a->nb_samples <= nb_samples) {
+ /* drain the whole buffer */
+ a->nb_samples = 0;
+ } else {
+ int p;
+ int move_offset = a->stride * nb_samples;
+ int move_size = a->stride * (a->nb_samples - nb_samples);
+
+ for (p = 0; p < a->planes; p++)
+ memmove(a->data[p], a->data[p] + move_offset, move_size);
+
+ a->nb_samples -= nb_samples;
+ }
+}
+
+int ff_audio_data_add_to_fifo(AVAudioFifo *af, AudioData *a, int offset,
+ int nb_samples)
+{
+ uint8_t *offset_data[AVRESAMPLE_MAX_CHANNELS];
+ int offset_size, p;
+
+ if (offset >= a->nb_samples)
+ return 0;
+ offset_size = offset * a->stride;
+ for (p = 0; p < a->planes; p++)
+ offset_data[p] = a->data[p] + offset_size;
+
+ return av_audio_fifo_write(af, (void **)offset_data, nb_samples);
+}
+
+int ff_audio_data_read_from_fifo(AVAudioFifo *af, AudioData *a, int nb_samples)
+{
+ int ret;
+
+ if (a->read_only)
+ return AVERROR(EINVAL);
+
+ ret = ff_audio_data_realloc(a, nb_samples);
+ if (ret < 0)
+ return ret;
+
+ ret = av_audio_fifo_read(af, (void **)a->data, nb_samples);
+ if (ret >= 0)
+ a->nb_samples = ret;
+ return ret;
+}
diff --git a/gst-libs/ext/libav/libavresample/audio_data.h b/gst-libs/ext/libav/libavresample/audio_data.h
new file mode 100644
index 0000000..558e7e6
--- /dev/null
+++ b/gst-libs/ext/libav/libavresample/audio_data.h
@@ -0,0 +1,173 @@
+/*
+ * Copyright (c) 2012 Justin Ruggles <justin.ruggles@gmail.com>
+ *
+ * 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
+ */
+
+#ifndef AVRESAMPLE_AUDIO_DATA_H
+#define AVRESAMPLE_AUDIO_DATA_H
+
+#include <stdint.h>
+
+#include "libavutil/audio_fifo.h"
+#include "libavutil/log.h"
+#include "libavutil/samplefmt.h"
+#include "avresample.h"
+
+/**
+ * Audio buffer used for intermediate storage between conversion phases.
+ */
+typedef struct AudioData {
+ const AVClass *class; /**< AVClass for logging */
+ uint8_t *data[AVRESAMPLE_MAX_CHANNELS]; /**< data plane pointers */
+ uint8_t *buffer; /**< data buffer */
+ unsigned int buffer_size; /**< allocated buffer size */
+ int allocated_samples; /**< number of samples the buffer can hold */
+ int nb_samples; /**< current number of samples */
+ enum AVSampleFormat sample_fmt; /**< sample format */
+ int channels; /**< channel count */
+ int allocated_channels; /**< allocated channel count */
+ int is_planar; /**< sample format is planar */
+ int planes; /**< number of data planes */
+ int sample_size; /**< bytes per sample */
+ int stride; /**< sample byte offset within a plane */
+ int read_only; /**< data is read-only */
+ int allow_realloc; /**< realloc is allowed */
+ int ptr_align; /**< minimum data pointer alignment */
+ int samples_align; /**< allocated samples alignment */
+ const char *name; /**< name for debug logging */
+} AudioData;
+
+int ff_audio_data_set_channels(AudioData *a, int channels);
+
+/**
+ * Initialize AudioData using a given source.
+ *
+ * This does not allocate an internal buffer. It only sets the data pointers
+ * and audio parameters.
+ *
+ * @param a AudioData struct
+ * @param src source data pointers
+ * @param plane_size plane size, in bytes.
+ * This can be 0 if unknown, but that will lead to
+ * optimized functions not being used in many cases,
+ * which could slow down some conversions.
+ * @param channels channel count
+ * @param nb_samples number of samples in the source data
+ * @param sample_fmt sample format
+ * @param read_only indicates if buffer is read only or read/write
+ * @param name name for debug logging (can be NULL)
+ * @return 0 on success, negative AVERROR value on error
+ */
+int ff_audio_data_init(AudioData *a, uint8_t **src, int plane_size, int channels,
+ int nb_samples, enum AVSampleFormat sample_fmt,
+ int read_only, const char *name);
+
+/**
+ * Allocate AudioData.
+ *
+ * This allocates an internal buffer and sets audio parameters.
+ *
+ * @param channels channel count
+ * @param nb_samples number of samples to allocate space for
+ * @param sample_fmt sample format
+ * @param name name for debug logging (can be NULL)
+ * @return newly allocated AudioData struct, or NULL on error
+ */
+AudioData *ff_audio_data_alloc(int channels, int nb_samples,
+ enum AVSampleFormat sample_fmt,
+ const char *name);
+
+/**
+ * Reallocate AudioData.
+ *
+ * The AudioData must have been previously allocated with ff_audio_data_alloc().
+ *
+ * @param a AudioData struct
+ * @param nb_samples number of samples to allocate space for
+ * @return 0 on success, negative AVERROR value on error
+ */
+int ff_audio_data_realloc(AudioData *a, int nb_samples);
+
+/**
+ * Free AudioData.
+ *
+ * The AudioData must have been previously allocated with ff_audio_data_alloc().
+ *
+ * @param a AudioData struct
+ */
+void ff_audio_data_free(AudioData **a);
+
+/**
+ * Copy data from one AudioData to another.
+ *
+ * @param out output AudioData
+ * @param in input AudioData
+ * @return 0 on success, negative AVERROR value on error
+ */
+int ff_audio_data_copy(AudioData *out, AudioData *in);
+
+/**
+ * Append data from one AudioData to the end of another.
+ *
+ * @param dst destination AudioData
+ * @param dst_offset offset, in samples, to start writing, relative to the
+ * start of dst
+ * @param src source AudioData
+ * @param src_offset offset, in samples, to start copying, relative to the
+ * start of the src
+ * @param nb_samples number of samples to copy
+ * @return 0 on success, negative AVERROR value on error
+ */
+int ff_audio_data_combine(AudioData *dst, int dst_offset, AudioData *src,
+ int src_offset, int nb_samples);
+
+/**
+ * Drain samples from the start of the AudioData.
+ *
+ * Remaining samples are shifted to the start of the AudioData.
+ *
+ * @param a AudioData struct
+ * @param nb_samples number of samples to drain
+ */
+void ff_audio_data_drain(AudioData *a, int nb_samples);
+
+/**
+ * Add samples in AudioData to an AVAudioFifo.
+ *
+ * @param af Audio FIFO Buffer
+ * @param a AudioData struct
+ * @param offset number of samples to skip from the start of the data
+ * @param nb_samples number of samples to add to the FIFO
+ * @return number of samples actually added to the FIFO, or
+ * negative AVERROR code on error
+ */
+int ff_audio_data_add_to_fifo(AVAudioFifo *af, AudioData *a, int offset,
+ int nb_samples);
+
+/**
+ * Read samples from an AVAudioFifo to AudioData.
+ *
+ * @param af Audio FIFO Buffer
+ * @param a AudioData struct
+ * @param nb_samples number of samples to read from the FIFO
+ * @return number of samples actually read from the FIFO, or
+ * negative AVERROR code on error
+ */
+int ff_audio_data_read_from_fifo(AVAudioFifo *af, AudioData *a, int nb_samples);
+
+#endif /* AVRESAMPLE_AUDIO_DATA_H */
diff --git a/gst-libs/ext/libav/libavresample/audio_mix.c b/gst-libs/ext/libav/libavresample/audio_mix.c
new file mode 100644
index 0000000..c056028
--- /dev/null
+++ b/gst-libs/ext/libav/libavresample/audio_mix.c
@@ -0,0 +1,544 @@
+/*
+ * Copyright (c) 2012 Justin Ruggles <justin.ruggles@gmail.com>
+ *
+ * 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
+ */
+
+#include <stdint.h>
+
+#include "libavutil/common.h"
+#include "libavutil/libm.h"
+#include "libavutil/samplefmt.h"
+#include "avresample.h"
+#include "internal.h"
+#include "audio_data.h"
+#include "audio_mix.h"
+
+static const char *coeff_type_names[] = { "q8", "q15", "flt" };
+
+struct AudioMix {
+ AVAudioResampleContext *avr;
+ enum AVSampleFormat fmt;
+ enum AVMixCoeffType coeff_type;
+ uint64_t in_layout;
+ uint64_t out_layout;
+ int in_channels;
+ int out_channels;
+
+ int ptr_align;
+ int samples_align;
+ int has_optimized_func;
+ const char *func_descr;
+ const char *func_descr_generic;
+ mix_func *mix;
+ mix_func *mix_generic;
+
+ int16_t *matrix_q8[AVRESAMPLE_MAX_CHANNELS];
+ int32_t *matrix_q15[AVRESAMPLE_MAX_CHANNELS];
+ float *matrix_flt[AVRESAMPLE_MAX_CHANNELS];
+ void **matrix;
+};
+
+void ff_audio_mix_set_func(AudioMix *am, enum AVSampleFormat fmt,
+ enum AVMixCoeffType coeff_type, int in_channels,
+ int out_channels, int ptr_align, int samples_align,
+ const char *descr, void *mix_func)
+{
+ if (fmt == am->fmt && coeff_type == am->coeff_type &&
+ ( in_channels == am->in_channels || in_channels == 0) &&
+ (out_channels == am->out_channels || out_channels == 0)) {
+ char chan_str[16];
+ am->mix = mix_func;
+ am->func_descr = descr;
+ am->ptr_align = ptr_align;
+ am->samples_align = samples_align;
+ if (ptr_align == 1 && samples_align == 1) {
+ am->mix_generic = mix_func;
+ am->func_descr_generic = descr;
+ } else {
+ am->has_optimized_func = 1;
+ }
+ if (in_channels) {
+ if (out_channels)
+ snprintf(chan_str, sizeof(chan_str), "[%d to %d] ",
+ in_channels, out_channels);
+ else
+ snprintf(chan_str, sizeof(chan_str), "[%d to any] ",
+ in_channels);
+ } else if (out_channels) {
+ snprintf(chan_str, sizeof(chan_str), "[any to %d] ",
+ out_channels);
+ }
+ av_log(am->avr, AV_LOG_DEBUG, "audio_mix: found function: [fmt=%s] "
+ "[c=%s] %s(%s)\n", av_get_sample_fmt_name(fmt),
+ coeff_type_names[coeff_type],
+ (in_channels || out_channels) ? chan_str : "", descr);
+ }
+}
+
+#define MIX_FUNC_NAME(fmt, cfmt) mix_any_ ## fmt ##_## cfmt ##_c
+
+#define MIX_FUNC_GENERIC(fmt, cfmt, stype, ctype, sumtype, expr) \
+static void MIX_FUNC_NAME(fmt, cfmt)(stype **samples, ctype **matrix, \
+ int len, int out_ch, int in_ch) \
+{ \
+ int i, in, out; \
+ stype temp[AVRESAMPLE_MAX_CHANNELS]; \
+ for (i = 0; i < len; i++) { \
+ for (out = 0; out < out_ch; out++) { \
+ sumtype sum = 0; \
+ for (in = 0; in < in_ch; in++) \
+ sum += samples[in][i] * matrix[out][in]; \
+ temp[out] = expr; \
+ } \
+ for (out = 0; out < out_ch; out++) \
+ samples[out][i] = temp[out]; \
+ } \
+}
+
+MIX_FUNC_GENERIC(FLTP, FLT, float, float, float, sum)
+MIX_FUNC_GENERIC(S16P, FLT, int16_t, float, float, av_clip_int16(lrintf(sum)))
+MIX_FUNC_GENERIC(S16P, Q15, int16_t, int32_t, int64_t, av_clip_int16(sum >> 15))
+MIX_FUNC_GENERIC(S16P, Q8, int16_t, int16_t, int32_t, av_clip_int16(sum >> 8))
+
+/* TODO: templatize the channel-specific C functions */
+
+static void mix_2_to_1_fltp_flt_c(float **samples, float **matrix, int len,
+ int out_ch, int in_ch)
+{
+ float *src0 = samples[0];
+ float *src1 = samples[1];
+ float *dst = src0;
+ float m0 = matrix[0][0];
+ float m1 = matrix[0][1];
+
+ while (len > 4) {
+ *dst++ = *src0++ * m0 + *src1++ * m1;
+ *dst++ = *src0++ * m0 + *src1++ * m1;
+ *dst++ = *src0++ * m0 + *src1++ * m1;
+ *dst++ = *src0++ * m0 + *src1++ * m1;
+ len -= 4;
+ }
+ while (len > 0) {
+ *dst++ = *src0++ * m0 + *src1++ * m1;
+ len--;
+ }
+}
+
+static void mix_2_to_1_s16p_flt_c(int16_t **samples, float **matrix, int len,
+ int out_ch, int in_ch)
+{
+ int16_t *src0 = samples[0];
+ int16_t *src1 = samples[1];
+ int16_t *dst = src0;
+ float m0 = matrix[0][0];
+ float m1 = matrix[0][1];
+
+ while (len > 4) {
+ *dst++ = av_clip_int16(lrintf(*src0++ * m0 + *src1++ * m1));
+ *dst++ = av_clip_int16(lrintf(*src0++ * m0 + *src1++ * m1));
+ *dst++ = av_clip_int16(lrintf(*src0++ * m0 + *src1++ * m1));
+ *dst++ = av_clip_int16(lrintf(*src0++ * m0 + *src1++ * m1));
+ len -= 4;
+ }
+ while (len > 0) {
+ *dst++ = av_clip_int16(lrintf(*src0++ * m0 + *src1++ * m1));
+ len--;
+ }
+}
+
+static void mix_2_to_1_s16p_q8_c(int16_t **samples, int16_t **matrix, int len,
+ int out_ch, int in_ch)
+{
+ int16_t *src0 = samples[0];
+ int16_t *src1 = samples[1];
+ int16_t *dst = src0;
+ int16_t m0 = matrix[0][0];
+ int16_t m1 = matrix[0][1];
+
+ while (len > 4) {
+ *dst++ = (*src0++ * m0 + *src1++ * m1) >> 8;
+ *dst++ = (*src0++ * m0 + *src1++ * m1) >> 8;
+ *dst++ = (*src0++ * m0 + *src1++ * m1) >> 8;
+ *dst++ = (*src0++ * m0 + *src1++ * m1) >> 8;
+ len -= 4;
+ }
+ while (len > 0) {
+ *dst++ = (*src0++ * m0 + *src1++ * m1) >> 8;
+ len--;
+ }
+}
+
+static void mix_1_to_2_fltp_flt_c(float **samples, float **matrix, int len,
+ int out_ch, int in_ch)
+{
+ float v;
+ float *dst0 = samples[0];
+ float *dst1 = samples[1];
+ float *src = dst0;
+ float m0 = matrix[0][0];
+ float m1 = matrix[1][0];
+
+ while (len > 4) {
+ v = *src++;
+ *dst0++ = v * m1;
+ *dst1++ = v * m0;
+ v = *src++;
+ *dst0++ = v * m1;
+ *dst1++ = v * m0;
+ v = *src++;
+ *dst0++ = v * m1;
+ *dst1++ = v * m0;
+ v = *src++;
+ *dst0++ = v * m1;
+ *dst1++ = v * m0;
+ len -= 4;
+ }
+ while (len > 0) {
+ v = *src++;
+ *dst0++ = v * m1;
+ *dst1++ = v * m0;
+ len--;
+ }
+}
+
+static void mix_6_to_2_fltp_flt_c(float **samples, float **matrix, int len,
+ int out_ch, int in_ch)
+{
+ float v0, v1;
+ float *src0 = samples[0];
+ float *src1 = samples[1];
+ float *src2 = samples[2];
+ float *src3 = samples[3];
+ float *src4 = samples[4];
+ float *src5 = samples[5];
+ float *dst0 = src0;
+ float *dst1 = src1;
+ float *m0 = matrix[0];
+ float *m1 = matrix[1];
+
+ while (len > 0) {
+ v0 = *src0++;
+ v1 = *src1++;
+ *dst0++ = v0 * m0[0] +
+ v1 * m0[1] +
+ *src2 * m0[2] +
+ *src3 * m0[3] +
+ *src4 * m0[4] +
+ *src5 * m0[5];
+ *dst1++ = v0 * m1[0] +
+ v1 * m1[1] +
+ *src2++ * m1[2] +
+ *src3++ * m1[3] +
+ *src4++ * m1[4] +
+ *src5++ * m1[5];
+ len--;
+ }
+}
+
+static void mix_2_to_6_fltp_flt_c(float **samples, float **matrix, int len,
+ int out_ch, int in_ch)
+{
+ float v0, v1;
+ float *dst0 = samples[0];
+ float *dst1 = samples[1];
+ float *dst2 = samples[2];
+ float *dst3 = samples[3];
+ float *dst4 = samples[4];
+ float *dst5 = samples[5];
+ float *src0 = dst0;
+ float *src1 = dst1;
+
+ while (len > 0) {
+ v0 = *src0++;
+ v1 = *src1++;
+ *dst0++ = v0 * matrix[0][0] + v1 * matrix[0][1];
+ *dst1++ = v0 * matrix[1][0] + v1 * matrix[1][1];
+ *dst2++ = v0 * matrix[2][0] + v1 * matrix[2][1];
+ *dst3++ = v0 * matrix[3][0] + v1 * matrix[3][1];
+ *dst4++ = v0 * matrix[4][0] + v1 * matrix[4][1];
+ *dst5++ = v0 * matrix[5][0] + v1 * matrix[5][1];
+ len--;
+ }
+}
+
+static int mix_function_init(AudioMix *am)
+{
+ /* any-to-any C versions */
+
+ ff_audio_mix_set_func(am, AV_SAMPLE_FMT_FLTP, AV_MIX_COEFF_TYPE_FLT,
+ 0, 0, 1, 1, "C", MIX_FUNC_NAME(FLTP, FLT));
+
+ ff_audio_mix_set_func(am, AV_SAMPLE_FMT_S16P, AV_MIX_COEFF_TYPE_FLT,
+ 0, 0, 1, 1, "C", MIX_FUNC_NAME(S16P, FLT));
+
+ ff_audio_mix_set_func(am, AV_SAMPLE_FMT_S16P, AV_MIX_COEFF_TYPE_Q15,
+ 0, 0, 1, 1, "C", MIX_FUNC_NAME(S16P, Q15));
+
+ ff_audio_mix_set_func(am, AV_SAMPLE_FMT_S16P, AV_MIX_COEFF_TYPE_Q8,
+ 0, 0, 1, 1, "C", MIX_FUNC_NAME(S16P, Q8));
+
+ /* channel-specific C versions */
+
+ ff_audio_mix_set_func(am, AV_SAMPLE_FMT_FLTP, AV_MIX_COEFF_TYPE_FLT,
+ 2, 1, 1, 1, "C", mix_2_to_1_fltp_flt_c);
+
+ ff_audio_mix_set_func(am, AV_SAMPLE_FMT_S16P, AV_MIX_COEFF_TYPE_FLT,
+ 2, 1, 1, 1, "C", mix_2_to_1_s16p_flt_c);
+
+ ff_audio_mix_set_func(am, AV_SAMPLE_FMT_S16P, AV_MIX_COEFF_TYPE_Q8,
+ 2, 1, 1, 1, "C", mix_2_to_1_s16p_q8_c);
+
+ ff_audio_mix_set_func(am, AV_SAMPLE_FMT_FLTP, AV_MIX_COEFF_TYPE_FLT,
+ 1, 2, 1, 1, "C", mix_1_to_2_fltp_flt_c);
+
+ ff_audio_mix_set_func(am, AV_SAMPLE_FMT_FLTP, AV_MIX_COEFF_TYPE_FLT,
+ 6, 2, 1, 1, "C", mix_6_to_2_fltp_flt_c);
+
+ ff_audio_mix_set_func(am, AV_SAMPLE_FMT_FLTP, AV_MIX_COEFF_TYPE_FLT,
+ 2, 6, 1, 1, "C", mix_2_to_6_fltp_flt_c);
+
+ if (ARCH_X86)
+ ff_audio_mix_init_x86(am);
+
+ if (!am->mix) {
+ av_log(am->avr, AV_LOG_ERROR, "audio_mix: NO FUNCTION FOUND: [fmt=%s] "
+ "[c=%s] [%d to %d]\n", av_get_sample_fmt_name(am->fmt),
+ coeff_type_names[am->coeff_type], am->in_channels,
+ am->out_channels);
+ return AVERROR_PATCHWELCOME;
+ }
+ return 0;
+}
+
+AudioMix *ff_audio_mix_alloc(AVAudioResampleContext *avr)
+{
+ AudioMix *am;
+ int ret;
+
+ am = av_mallocz(sizeof(*am));
+ if (!am)
+ return NULL;
+ am->avr = avr;
+
+ if (avr->internal_sample_fmt != AV_SAMPLE_FMT_S16P &&
+ avr->internal_sample_fmt != AV_SAMPLE_FMT_FLTP) {
+ av_log(avr, AV_LOG_ERROR, "Unsupported internal format for "
+ "mixing: %s\n",
+ av_get_sample_fmt_name(avr->internal_sample_fmt));
+ goto error;
+ }
+
+ am->fmt = avr->internal_sample_fmt;
+ am->coeff_type = avr->mix_coeff_type;
+ am->in_layout = avr->in_channel_layout;
+ am->out_layout = avr->out_channel_layout;
+ am->in_channels = avr->in_channels;
+ am->out_channels = avr->out_channels;
+
+ /* build matrix if the user did not already set one */
+ if (avr->mix_matrix) {
+ ret = ff_audio_mix_set_matrix(am, avr->mix_matrix, avr->in_channels);
+ if (ret < 0)
+ goto error;
+ av_freep(&avr->mix_matrix);
+ } else {
+ int i, j;
+ char in_layout_name[128];
+ char out_layout_name[128];
+ double *matrix_dbl = av_mallocz(avr->out_channels * avr->in_channels *
+ sizeof(*matrix_dbl));
+ if (!matrix_dbl)
+ goto error;
+
+ ret = avresample_build_matrix(avr->in_channel_layout,
+ avr->out_channel_layout,
+ avr->center_mix_level,
+ avr->surround_mix_level,
+ avr->lfe_mix_level,
+ avr->normalize_mix_level,
+ matrix_dbl,
+ avr->in_channels,
+ avr->matrix_encoding);
+ if (ret < 0) {
+ av_free(matrix_dbl);
+ goto error;
+ }
+
+ av_get_channel_layout_string(in_layout_name, sizeof(in_layout_name),
+ avr->in_channels, avr->in_channel_layout);
+ av_get_channel_layout_string(out_layout_name, sizeof(out_layout_name),
+ avr->out_channels, avr->out_channel_layout);
+ av_log(avr, AV_LOG_DEBUG, "audio_mix: %s to %s\n",
+ in_layout_name, out_layout_name);
+ for (i = 0; i < avr->out_channels; i++) {
+ for (j = 0; j < avr->in_channels; j++) {
+ av_log(avr, AV_LOG_DEBUG, " %0.3f ",
+ matrix_dbl[i * avr->in_channels + j]);
+ }
+ av_log(avr, AV_LOG_DEBUG, "\n");
+ }
+
+ ret = ff_audio_mix_set_matrix(am, matrix_dbl, avr->in_channels);
+ if (ret < 0) {
+ av_free(matrix_dbl);
+ goto error;
+ }
+ av_free(matrix_dbl);
+ }
+
+ return am;
+
+error:
+ av_free(am);
+ return NULL;
+}
+
+void ff_audio_mix_free(AudioMix **am_p)
+{
+ AudioMix *am;
+
+ if (!*am_p)
+ return;
+ am = *am_p;
+
+ if (am->matrix) {
+ av_free(am->matrix[0]);
+ am->matrix = NULL;
+ }
+ memset(am->matrix_q8, 0, sizeof(am->matrix_q8 ));
+ memset(am->matrix_q15, 0, sizeof(am->matrix_q15));
+ memset(am->matrix_flt, 0, sizeof(am->matrix_flt));
+
+ av_freep(am_p);
+}
+
+int ff_audio_mix(AudioMix *am, AudioData *src)
+{
+ int use_generic = 1;
+ int len = src->nb_samples;
+
+ /* determine whether to use the optimized function based on pointer and
+ samples alignment in both the input and output */
+ if (am->has_optimized_func) {
+ int aligned_len = FFALIGN(len, am->samples_align);
+ if (!(src->ptr_align % am->ptr_align) &&
+ src->samples_align >= aligned_len) {
+ len = aligned_len;
+ use_generic = 0;
+ }
+ }
+ av_dlog(am->avr, "audio_mix: %d samples - %d to %d channels (%s)\n",
+ src->nb_samples, am->in_channels, am->out_channels,
+ use_generic ? am->func_descr_generic : am->func_descr);
+
+ if (use_generic)
+ am->mix_generic(src->data, am->matrix, len, am->out_channels,
+ am->in_channels);
+ else
+ am->mix(src->data, am->matrix, len, am->out_channels, am->in_channels);
+
+ ff_audio_data_set_channels(src, am->out_channels);
+
+ return 0;
+}
+
+int ff_audio_mix_get_matrix(AudioMix *am, double *matrix, int stride)
+{
+ int i, o;
+
+ if ( am->in_channels <= 0 || am->in_channels > AVRESAMPLE_MAX_CHANNELS ||
+ am->out_channels <= 0 || am->out_channels > AVRESAMPLE_MAX_CHANNELS) {
+ av_log(am->avr, AV_LOG_ERROR, "Invalid channel counts\n");
+ return AVERROR(EINVAL);
+ }
+
+#define GET_MATRIX_CONVERT(suffix, scale) \
+ if (!am->matrix_ ## suffix[0]) { \
+ av_log(am->avr, AV_LOG_ERROR, "matrix is not set\n"); \
+ return AVERROR(EINVAL); \
+ } \
+ for (o = 0; o < am->out_channels; o++) \
+ for (i = 0; i < am->in_channels; i++) \
+ matrix[o * stride + i] = am->matrix_ ## suffix[o][i] * (scale);
+
+ switch (am->coeff_type) {
+ case AV_MIX_COEFF_TYPE_Q8:
+ GET_MATRIX_CONVERT(q8, 1.0 / 256.0);
+ break;
+ case AV_MIX_COEFF_TYPE_Q15:
+ GET_MATRIX_CONVERT(q15, 1.0 / 32768.0);
+ break;
+ case AV_MIX_COEFF_TYPE_FLT:
+ GET_MATRIX_CONVERT(flt, 1.0);
+ break;
+ default:
+ av_log(am->avr, AV_LOG_ERROR, "Invalid mix coeff type\n");
+ return AVERROR(EINVAL);
+ }
+
+ return 0;
+}
+
+int ff_audio_mix_set_matrix(AudioMix *am, const double *matrix, int stride)
+{
+ int i, o;
+
+ if ( am->in_channels <= 0 || am->in_channels > AVRESAMPLE_MAX_CHANNELS ||
+ am->out_channels <= 0 || am->out_channels > AVRESAMPLE_MAX_CHANNELS) {
+ av_log(am->avr, AV_LOG_ERROR, "Invalid channel counts\n");
+ return AVERROR(EINVAL);
+ }
+
+ if (am->matrix) {
+ av_free(am->matrix[0]);
+ am->matrix = NULL;
+ }
+
+#define CONVERT_MATRIX(type, expr) \
+ am->matrix_## type[0] = av_mallocz(am->out_channels * am->in_channels * \
+ sizeof(*am->matrix_## type[0])); \
+ if (!am->matrix_## type[0]) \
+ return AVERROR(ENOMEM); \
+ for (o = 0; o < am->out_channels; o++) { \
+ if (o > 0) \
+ am->matrix_## type[o] = am->matrix_## type[o - 1] + \
+ am->in_channels; \
+ for (i = 0; i < am->in_channels; i++) { \
+ double v = matrix[o * stride + i]; \
+ am->matrix_## type[o][i] = expr; \
+ } \
+ } \
+ am->matrix = (void **)am->matrix_## type;
+
+ switch (am->coeff_type) {
+ case AV_MIX_COEFF_TYPE_Q8:
+ CONVERT_MATRIX(q8, av_clip_int16(lrint(256.0 * v)))
+ break;
+ case AV_MIX_COEFF_TYPE_Q15:
+ CONVERT_MATRIX(q15, av_clipl_int32(llrint(32768.0 * v)))
+ break;
+ case AV_MIX_COEFF_TYPE_FLT:
+ CONVERT_MATRIX(flt, v)
+ break;
+ default:
+ av_log(am->avr, AV_LOG_ERROR, "Invalid mix coeff type\n");
+ return AVERROR(EINVAL);
+ }
+
+ return mix_function_init(am);
+}
diff --git a/gst-libs/ext/libav/libavresample/audio_mix.h b/gst-libs/ext/libav/libavresample/audio_mix.h
new file mode 100644
index 0000000..4ccfc1f
--- /dev/null
+++ b/gst-libs/ext/libav/libavresample/audio_mix.h
@@ -0,0 +1,95 @@
+/*
+ * Copyright (c) 2012 Justin Ruggles <justin.ruggles@gmail.com>
+ *
+ * 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
+ */
+
+#ifndef AVRESAMPLE_AUDIO_MIX_H
+#define AVRESAMPLE_AUDIO_MIX_H
+
+#include <stdint.h>
+
+#include "libavutil/samplefmt.h"
+#include "avresample.h"
+#include "audio_data.h"
+
+typedef void (mix_func)(uint8_t **src, void **matrix, int len, int out_ch,
+ int in_ch);
+
+typedef struct AudioMix AudioMix;
+
+/**
+ * Set mixing function if the parameters match.
+ *
+ * This compares the parameters of the mixing function to the parameters in the
+ * AudioMix context. If the parameters do not match, no changes are made to the
+ * active functions. If the parameters do match and the alignment is not
+ * constrained, the function is set as the generic mixing function. If the
+ * parameters match and the alignment is constrained, the function is set as
+ * the optimized mixing function.
+ *
+ * @param am AudioMix context
+ * @param fmt input/output sample format
+ * @param coeff_type mixing coefficient type
+ * @param in_channels number of input channels, or 0 for any number of channels
+ * @param out_channels number of output channels, or 0 for any number of channels
+ * @param ptr_align buffer pointer alignment, in bytes
+ * @param samples_align buffer size alignment, in samples
+ * @param descr function type description (e.g. "C" or "SSE")
+ * @param mix_func mixing function pointer
+ */
+void ff_audio_mix_set_func(AudioMix *am, enum AVSampleFormat fmt,
+ enum AVMixCoeffType coeff_type, int in_channels,
+ int out_channels, int ptr_align, int samples_align,
+ const char *descr, void *mix_func);
+
+/**
+ * Allocate and initialize an AudioMix context.
+ *
+ * The parameters in the AVAudioResampleContext are used to initialize the
+ * AudioMix context.
+ *
+ * @param avr AVAudioResampleContext
+ * @return newly-allocated AudioMix context.
+ */
+AudioMix *ff_audio_mix_alloc(AVAudioResampleContext *avr);
+
+/**
+ * Free an AudioMix context.
+ */
+void ff_audio_mix_free(AudioMix **am);
+
+/**
+ * Apply channel mixing to audio data using the current mixing matrix.
+ */
+int ff_audio_mix(AudioMix *am, AudioData *src);
+
+/**
+ * Get the current mixing matrix.
+ */
+int ff_audio_mix_get_matrix(AudioMix *am, double *matrix, int stride);
+
+/**
+ * Set the current mixing matrix.
+ */
+int ff_audio_mix_set_matrix(AudioMix *am, const double *matrix, int stride);
+
+/* arch-specific initialization functions */
+
+void ff_audio_mix_init_x86(AudioMix *am);
+
+#endif /* AVRESAMPLE_AUDIO_MIX_H */
diff --git a/gst-libs/ext/libav/libavresample/audio_mix_matrix.c b/gst-libs/ext/libav/libavresample/audio_mix_matrix.c
new file mode 100644
index 0000000..8da1b48
--- /dev/null
+++ b/gst-libs/ext/libav/libavresample/audio_mix_matrix.c
@@ -0,0 +1,289 @@
+/*
+ * Copyright (C) 2011 Michael Niedermayer (michaelni@gmx.at)
+ * Copyright (c) 2012 Justin Ruggles <justin.ruggles@gmail.com>
+ *
+ * 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
+ */
+
+#include <stdint.h>
+
+#include "libavutil/common.h"
+#include "libavutil/libm.h"
+#include "libavutil/samplefmt.h"
+#include "avresample.h"
+#include "internal.h"
+#include "audio_data.h"
+#include "audio_mix.h"
+
+/* channel positions */
+#define FRONT_LEFT 0
+#define FRONT_RIGHT 1
+#define FRONT_CENTER 2
+#define LOW_FREQUENCY 3
+#define BACK_LEFT 4
+#define BACK_RIGHT 5
+#define FRONT_LEFT_OF_CENTER 6
+#define FRONT_RIGHT_OF_CENTER 7
+#define BACK_CENTER 8
+#define SIDE_LEFT 9
+#define SIDE_RIGHT 10
+#define TOP_CENTER 11
+#define TOP_FRONT_LEFT 12
+#define TOP_FRONT_CENTER 13
+#define TOP_FRONT_RIGHT 14
+#define TOP_BACK_LEFT 15
+#define TOP_BACK_CENTER 16
+#define TOP_BACK_RIGHT 17
+#define STEREO_LEFT 29
+#define STEREO_RIGHT 30
+#define WIDE_LEFT 31
+#define WIDE_RIGHT 32
+#define SURROUND_DIRECT_LEFT 33
+#define SURROUND_DIRECT_RIGHT 34
+#define LOW_FREQUENCY_2 35
+
+#define SQRT3_2 1.22474487139158904909 /* sqrt(3/2) */
+
+static av_always_inline int even(uint64_t layout)
+{
+ return (!layout || (layout & (layout - 1)));
+}
+
+static int sane_layout(uint64_t layout)
+{
+ /* check that there is at least 1 front speaker */
+ if (!(layout & AV_CH_LAYOUT_SURROUND))
+ return 0;
+
+ /* check for left/right symmetry */
+ if (!even(layout & (AV_CH_FRONT_LEFT | AV_CH_FRONT_RIGHT)) ||
+ !even(layout & (AV_CH_SIDE_LEFT | AV_CH_SIDE_RIGHT)) ||
+ !even(layout & (AV_CH_BACK_LEFT | AV_CH_BACK_RIGHT)) ||
+ !even(layout & (AV_CH_FRONT_LEFT_OF_CENTER | AV_CH_FRONT_RIGHT_OF_CENTER)) ||
+ !even(layout & (AV_CH_TOP_FRONT_LEFT | AV_CH_TOP_FRONT_RIGHT)) ||
+ !even(layout & (AV_CH_TOP_BACK_LEFT | AV_CH_TOP_BACK_RIGHT)) ||
+ !even(layout & (AV_CH_STEREO_LEFT | AV_CH_STEREO_RIGHT)) ||
+ !even(layout & (AV_CH_WIDE_LEFT | AV_CH_WIDE_RIGHT)) ||
+ !even(layout & (AV_CH_SURROUND_DIRECT_LEFT | AV_CH_SURROUND_DIRECT_RIGHT)))
+ return 0;
+
+ return 1;
+}
+
+int avresample_build_matrix(uint64_t in_layout, uint64_t out_layout,
+ double center_mix_level, double surround_mix_level,
+ double lfe_mix_level, int normalize,
+ double *matrix_out, int stride,
+ enum AVMatrixEncoding matrix_encoding)
+{
+ int i, j, out_i, out_j;
+ double matrix[64][64] = {{0}};
+ int64_t unaccounted;
+ double maxcoef = 0;
+ int in_channels, out_channels;
+
+ if ((out_layout & AV_CH_LAYOUT_STEREO_DOWNMIX) == AV_CH_LAYOUT_STEREO_DOWNMIX) {
+ out_layout = AV_CH_LAYOUT_STEREO;
+ }
+
+ unaccounted = in_layout & ~out_layout;
+
+ in_channels = av_get_channel_layout_nb_channels( in_layout);
+ out_channels = av_get_channel_layout_nb_channels(out_layout);
+
+ memset(matrix_out, 0, out_channels * stride * sizeof(*matrix_out));
+
+ /* check if layouts are supported */
+ if (!in_layout || in_channels > AVRESAMPLE_MAX_CHANNELS)
+ return AVERROR(EINVAL);
+ if (!out_layout || out_channels > AVRESAMPLE_MAX_CHANNELS)
+ return AVERROR(EINVAL);
+
+ /* check if layouts are unbalanced or abnormal */
+ if (!sane_layout(in_layout) || !sane_layout(out_layout))
+ return AVERROR_PATCHWELCOME;
+
+ /* route matching input/output channels */
+ for (i = 0; i < 64; i++) {
+ if (in_layout & out_layout & (1ULL << i))
+ matrix[i][i] = 1.0;
+ }
+
+ /* mix front center to front left/right */
+ if (unaccounted & AV_CH_FRONT_CENTER) {
+ if ((out_layout & AV_CH_LAYOUT_STEREO) == AV_CH_LAYOUT_STEREO) {
+ matrix[FRONT_LEFT ][FRONT_CENTER] += M_SQRT1_2;
+ matrix[FRONT_RIGHT][FRONT_CENTER] += M_SQRT1_2;
+ } else
+ return AVERROR_PATCHWELCOME;
+ }
+ /* mix front left/right to center */
+ if (unaccounted & AV_CH_LAYOUT_STEREO) {
+ if (out_layout & AV_CH_FRONT_CENTER) {
+ matrix[FRONT_CENTER][FRONT_LEFT ] += M_SQRT1_2;
+ matrix[FRONT_CENTER][FRONT_RIGHT] += M_SQRT1_2;
+ /* mix left/right/center to center */
+ if (in_layout & AV_CH_FRONT_CENTER)
+ matrix[FRONT_CENTER][FRONT_CENTER] = center_mix_level * M_SQRT2;
+ } else
+ return AVERROR_PATCHWELCOME;
+ }
+ /* mix back center to back, side, or front */
+ if (unaccounted & AV_CH_BACK_CENTER) {
+ if (out_layout & AV_CH_BACK_LEFT) {
+ matrix[BACK_LEFT ][BACK_CENTER] += M_SQRT1_2;
+ matrix[BACK_RIGHT][BACK_CENTER] += M_SQRT1_2;
+ } else if (out_layout & AV_CH_SIDE_LEFT) {
+ matrix[SIDE_LEFT ][BACK_CENTER] += M_SQRT1_2;
+ matrix[SIDE_RIGHT][BACK_CENTER] += M_SQRT1_2;
+ } else if (out_layout & AV_CH_FRONT_LEFT) {
+ if (matrix_encoding == AV_MATRIX_ENCODING_DOLBY ||
+ matrix_encoding == AV_MATRIX_ENCODING_DPLII) {
+ if (unaccounted & (AV_CH_BACK_LEFT | AV_CH_SIDE_LEFT)) {
+ matrix[FRONT_LEFT ][BACK_CENTER] -= surround_mix_level * M_SQRT1_2;
+ matrix[FRONT_RIGHT][BACK_CENTER] += surround_mix_level * M_SQRT1_2;
+ } else {
+ matrix[FRONT_LEFT ][BACK_CENTER] -= surround_mix_level;
+ matrix[FRONT_RIGHT][BACK_CENTER] += surround_mix_level;
+ }
+ } else {
+ matrix[FRONT_LEFT ][BACK_CENTER] += surround_mix_level * M_SQRT1_2;
+ matrix[FRONT_RIGHT][BACK_CENTER] += surround_mix_level * M_SQRT1_2;
+ }
+ } else if (out_layout & AV_CH_FRONT_CENTER) {
+ matrix[FRONT_CENTER][BACK_CENTER] += surround_mix_level * M_SQRT1_2;
+ } else
+ return AVERROR_PATCHWELCOME;
+ }
+ /* mix back left/right to back center, side, or front */
+ if (unaccounted & AV_CH_BACK_LEFT) {
+ if (out_layout & AV_CH_BACK_CENTER) {
+ matrix[BACK_CENTER][BACK_LEFT ] += M_SQRT1_2;
+ matrix[BACK_CENTER][BACK_RIGHT] += M_SQRT1_2;
+ } else if (out_layout & AV_CH_SIDE_LEFT) {
+ /* if side channels do not exist in the input, just copy back
+ channels to side channels, otherwise mix back into side */
+ if (in_layout & AV_CH_SIDE_LEFT) {
+ matrix[SIDE_LEFT ][BACK_LEFT ] += M_SQRT1_2;
+ matrix[SIDE_RIGHT][BACK_RIGHT] += M_SQRT1_2;
+ } else {
+ matrix[SIDE_LEFT ][BACK_LEFT ] += 1.0;
+ matrix[SIDE_RIGHT][BACK_RIGHT] += 1.0;
+ }
+ } else if (out_layout & AV_CH_FRONT_LEFT) {
+ if (matrix_encoding == AV_MATRIX_ENCODING_DOLBY) {
+ matrix[FRONT_LEFT ][BACK_LEFT ] -= surround_mix_level * M_SQRT1_2;
+ matrix[FRONT_LEFT ][BACK_RIGHT] -= surround_mix_level * M_SQRT1_2;
+ matrix[FRONT_RIGHT][BACK_LEFT ] += surround_mix_level * M_SQRT1_2;
+ matrix[FRONT_RIGHT][BACK_RIGHT] += surround_mix_level * M_SQRT1_2;
+ } else if (matrix_encoding == AV_MATRIX_ENCODING_DPLII) {
+ matrix[FRONT_LEFT ][BACK_LEFT ] -= surround_mix_level * SQRT3_2;
+ matrix[FRONT_LEFT ][BACK_RIGHT] -= surround_mix_level * M_SQRT1_2;
+ matrix[FRONT_RIGHT][BACK_LEFT ] += surround_mix_level * M_SQRT1_2;
+ matrix[FRONT_RIGHT][BACK_RIGHT] += surround_mix_level * SQRT3_2;
+ } else {
+ matrix[FRONT_LEFT ][BACK_LEFT ] += surround_mix_level;
+ matrix[FRONT_RIGHT][BACK_RIGHT] += surround_mix_level;
+ }
+ } else if (out_layout & AV_CH_FRONT_CENTER) {
+ matrix[FRONT_CENTER][BACK_LEFT ] += surround_mix_level * M_SQRT1_2;
+ matrix[FRONT_CENTER][BACK_RIGHT] += surround_mix_level * M_SQRT1_2;
+ } else
+ return AVERROR_PATCHWELCOME;
+ }
+ /* mix side left/right into back or front */
+ if (unaccounted & AV_CH_SIDE_LEFT) {
+ if (out_layout & AV_CH_BACK_LEFT) {
+ /* if back channels do not exist in the input, just copy side
+ channels to back channels, otherwise mix side into back */
+ if (in_layout & AV_CH_BACK_LEFT) {
+ matrix[BACK_LEFT ][SIDE_LEFT ] += M_SQRT1_2;
+ matrix[BACK_RIGHT][SIDE_RIGHT] += M_SQRT1_2;
+ } else {
+ matrix[BACK_LEFT ][SIDE_LEFT ] += 1.0;
+ matrix[BACK_RIGHT][SIDE_RIGHT] += 1.0;
+ }
+ } else if (out_layout & AV_CH_BACK_CENTER) {
+ matrix[BACK_CENTER][SIDE_LEFT ] += M_SQRT1_2;
+ matrix[BACK_CENTER][SIDE_RIGHT] += M_SQRT1_2;
+ } else if (out_layout & AV_CH_FRONT_LEFT) {
+ if (matrix_encoding == AV_MATRIX_ENCODING_DOLBY) {
+ matrix[FRONT_LEFT ][SIDE_LEFT ] -= surround_mix_level * M_SQRT1_2;
+ matrix[FRONT_LEFT ][SIDE_RIGHT] -= surround_mix_level * M_SQRT1_2;
+ matrix[FRONT_RIGHT][SIDE_LEFT ] += surround_mix_level * M_SQRT1_2;
+ matrix[FRONT_RIGHT][SIDE_RIGHT] += surround_mix_level * M_SQRT1_2;
+ } else if (matrix_encoding == AV_MATRIX_ENCODING_DPLII) {
+ matrix[FRONT_LEFT ][SIDE_LEFT ] -= surround_mix_level * SQRT3_2;
+ matrix[FRONT_LEFT ][SIDE_RIGHT] -= surround_mix_level * M_SQRT1_2;
+ matrix[FRONT_RIGHT][SIDE_LEFT ] += surround_mix_level * M_SQRT1_2;
+ matrix[FRONT_RIGHT][SIDE_RIGHT] += surround_mix_level * SQRT3_2;
+ } else {
+ matrix[FRONT_LEFT ][SIDE_LEFT ] += surround_mix_level;
+ matrix[FRONT_RIGHT][SIDE_RIGHT] += surround_mix_level;
+ }
+ } else if (out_layout & AV_CH_FRONT_CENTER) {
+ matrix[FRONT_CENTER][SIDE_LEFT ] += surround_mix_level * M_SQRT1_2;
+ matrix[FRONT_CENTER][SIDE_RIGHT] += surround_mix_level * M_SQRT1_2;
+ } else
+ return AVERROR_PATCHWELCOME;
+ }
+ /* mix left-of-center/right-of-center into front left/right or center */
+ if (unaccounted & AV_CH_FRONT_LEFT_OF_CENTER) {
+ if (out_layout & AV_CH_FRONT_LEFT) {
+ matrix[FRONT_LEFT ][FRONT_LEFT_OF_CENTER ] += 1.0;
+ matrix[FRONT_RIGHT][FRONT_RIGHT_OF_CENTER] += 1.0;
+ } else if (out_layout & AV_CH_FRONT_CENTER) {
+ matrix[FRONT_CENTER][FRONT_LEFT_OF_CENTER ] += M_SQRT1_2;
+ matrix[FRONT_CENTER][FRONT_RIGHT_OF_CENTER] += M_SQRT1_2;
+ } else
+ return AVERROR_PATCHWELCOME;
+ }
+ /* mix LFE into front left/right or center */
+ if (unaccounted & AV_CH_LOW_FREQUENCY) {
+ if (out_layout & AV_CH_FRONT_CENTER) {
+ matrix[FRONT_CENTER][LOW_FREQUENCY] += lfe_mix_level;
+ } else if (out_layout & AV_CH_FRONT_LEFT) {
+ matrix[FRONT_LEFT ][LOW_FREQUENCY] += lfe_mix_level * M_SQRT1_2;
+ matrix[FRONT_RIGHT][LOW_FREQUENCY] += lfe_mix_level * M_SQRT1_2;
+ } else
+ return AVERROR_PATCHWELCOME;
+ }
+
+ /* transfer internal matrix to output matrix and calculate maximum
+ per-channel coefficient sum */
+ for (out_i = i = 0; out_i < out_channels && i < 64; i++) {
+ double sum = 0;
+ for (out_j = j = 0; out_j < in_channels && j < 64; j++) {
+ matrix_out[out_i * stride + out_j] = matrix[i][j];
+ sum += fabs(matrix[i][j]);
+ if (in_layout & (1ULL << j))
+ out_j++;
+ }
+ maxcoef = FFMAX(maxcoef, sum);
+ if (out_layout & (1ULL << i))
+ out_i++;
+ }
+
+ /* normalize */
+ if (normalize && maxcoef > 1.0) {
+ for (i = 0; i < out_channels; i++)
+ for (j = 0; j < in_channels; j++)
+ matrix_out[i * stride + j] /= maxcoef;
+ }
+
+ return 0;
+}
diff --git a/gst-libs/ext/libav/libavresample/avresample-test.c b/gst-libs/ext/libav/libavresample/avresample-test.c
new file mode 100644
index 0000000..81e9bf0
--- /dev/null
+++ b/gst-libs/ext/libav/libavresample/avresample-test.c
@@ -0,0 +1,341 @@
+/*
+ * Copyright (c) 2002 Fabrice Bellard
+ * Copyright (c) 2012 Justin Ruggles <justin.ruggles@gmail.com>
+ *
+ * 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
+ */
+
+#include <stdint.h>
+#include <stdio.h>
+
+#include "libavutil/avstring.h"
+#include "libavutil/common.h"
+#include "libavutil/lfg.h"
+#include "libavutil/libm.h"
+#include "libavutil/log.h"
+#include "libavutil/mem.h"
+#include "libavutil/opt.h"
+#include "libavutil/samplefmt.h"
+#include "avresample.h"
+
+static double dbl_rand(AVLFG *lfg)
+{
+ return 2.0 * (av_lfg_get(lfg) / (double)UINT_MAX) - 1.0;
+}
+
+#define PUT_FUNC(name, fmt, type, expr) \
+static void put_sample_ ## name(void **data, enum AVSampleFormat sample_fmt,\
+ int channels, int sample, int ch, \
+ double v_dbl) \
+{ \
+ type v = expr; \
+ type **out = (type **)data; \
+ if (av_sample_fmt_is_planar(sample_fmt)) \
+ out[ch][sample] = v; \
+ else \
+ out[0][sample * channels + ch] = v; \
+}
+
+PUT_FUNC(u8, AV_SAMPLE_FMT_U8, uint8_t, av_clip_uint8 ( lrint(v_dbl * (1 << 7)) + 128))
+PUT_FUNC(s16, AV_SAMPLE_FMT_S16, int16_t, av_clip_int16 ( lrint(v_dbl * (1 << 15))))
+PUT_FUNC(s32, AV_SAMPLE_FMT_S32, int32_t, av_clipl_int32(llrint(v_dbl * (1U << 31))))
+PUT_FUNC(flt, AV_SAMPLE_FMT_FLT, float, v_dbl)
+PUT_FUNC(dbl, AV_SAMPLE_FMT_DBL, double, v_dbl)
+
+static void put_sample(void **data, enum AVSampleFormat sample_fmt,
+ int channels, int sample, int ch, double v_dbl)
+{
+ switch (av_get_packed_sample_fmt(sample_fmt)) {
+ case AV_SAMPLE_FMT_U8:
+ put_sample_u8(data, sample_fmt, channels, sample, ch, v_dbl);
+ break;
+ case AV_SAMPLE_FMT_S16:
+ put_sample_s16(data, sample_fmt, channels, sample, ch, v_dbl);
+ break;
+ case AV_SAMPLE_FMT_S32:
+ put_sample_s32(data, sample_fmt, channels, sample, ch, v_dbl);
+ break;
+ case AV_SAMPLE_FMT_FLT:
+ put_sample_flt(data, sample_fmt, channels, sample, ch, v_dbl);
+ break;
+ case AV_SAMPLE_FMT_DBL:
+ put_sample_dbl(data, sample_fmt, channels, sample, ch, v_dbl);
+ break;
+ }
+}
+
+static void audiogen(AVLFG *rnd, void **data, enum AVSampleFormat sample_fmt,
+ int channels, int sample_rate, int nb_samples)
+{
+ int i, ch, k;
+ double v, f, a, ampa;
+ double tabf1[AVRESAMPLE_MAX_CHANNELS];
+ double tabf2[AVRESAMPLE_MAX_CHANNELS];
+ double taba[AVRESAMPLE_MAX_CHANNELS];
+
+#define PUT_SAMPLE put_sample(data, sample_fmt, channels, k, ch, v);
+
+ k = 0;
+
+ /* 1 second of single freq sinus at 1000 Hz */
+ a = 0;
+ for (i = 0; i < 1 * sample_rate && k < nb_samples; i++, k++) {
+ v = sin(a) * 0.30;
+ for (ch = 0; ch < channels; ch++)
+ PUT_SAMPLE
+ a += M_PI * 1000.0 * 2.0 / sample_rate;
+ }
+
+ /* 1 second of varying frequency between 100 and 10000 Hz */
+ a = 0;
+ for (i = 0; i < 1 * sample_rate && k < nb_samples; i++, k++) {
+ v = sin(a) * 0.30;
+ for (ch = 0; ch < channels; ch++)
+ PUT_SAMPLE
+ f = 100.0 + (((10000.0 - 100.0) * i) / sample_rate);
+ a += M_PI * f * 2.0 / sample_rate;
+ }
+
+ /* 0.5 second of low amplitude white noise */
+ for (i = 0; i < sample_rate / 2 && k < nb_samples; i++, k++) {
+ v = dbl_rand(rnd) * 0.30;
+ for (ch = 0; ch < channels; ch++)
+ PUT_SAMPLE
+ }
+
+ /* 0.5 second of high amplitude white noise */
+ for (i = 0; i < sample_rate / 2 && k < nb_samples; i++, k++) {
+ v = dbl_rand(rnd);
+ for (ch = 0; ch < channels; ch++)
+ PUT_SAMPLE
+ }
+
+ /* 1 second of unrelated ramps for each channel */
+ for (ch = 0; ch < channels; ch++) {
+ taba[ch] = 0;
+ tabf1[ch] = 100 + av_lfg_get(rnd) % 5000;
+ tabf2[ch] = 100 + av_lfg_get(rnd) % 5000;
+ }
+ for (i = 0; i < 1 * sample_rate && k < nb_samples; i++, k++) {
+ for (ch = 0; ch < channels; ch++) {
+ v = sin(taba[ch]) * 0.30;
+ PUT_SAMPLE
+ f = tabf1[ch] + (((tabf2[ch] - tabf1[ch]) * i) / sample_rate);
+ taba[ch] += M_PI * f * 2.0 / sample_rate;
+ }
+ }
+
+ /* 2 seconds of 500 Hz with varying volume */
+ a = 0;
+ ampa = 0;
+ for (i = 0; i < 2 * sample_rate && k < nb_samples; i++, k++) {
+ for (ch = 0; ch < channels; ch++) {
+ double amp = (1.0 + sin(ampa)) * 0.15;
+ if (ch & 1)
+ amp = 0.30 - amp;
+ v = sin(a) * amp;
+ PUT_SAMPLE
+ a += M_PI * 500.0 * 2.0 / sample_rate;
+ ampa += M_PI * 2.0 / sample_rate;
+ }
+ }
+}
+
+/* formats, rates, and layouts are ordered for priority in testing.
+ e.g. 'avresample-test 4 2 2' will test all input/output combinations of
+ S16/FLTP/S16P/FLT, 48000/44100, and stereo/mono */
+
+static const enum AVSampleFormat formats[] = {
+ AV_SAMPLE_FMT_S16,
+ AV_SAMPLE_FMT_FLTP,
+ AV_SAMPLE_FMT_S16P,
+ AV_SAMPLE_FMT_FLT,
+ AV_SAMPLE_FMT_S32P,
+ AV_SAMPLE_FMT_S32,
+ AV_SAMPLE_FMT_U8P,
+ AV_SAMPLE_FMT_U8,
+ AV_SAMPLE_FMT_DBLP,
+ AV_SAMPLE_FMT_DBL,
+};
+
+static const int rates[] = {
+ 48000,
+ 44100,
+ 16000
+};
+
+static const uint64_t layouts[] = {
+ AV_CH_LAYOUT_STEREO,
+ AV_CH_LAYOUT_MONO,
+ AV_CH_LAYOUT_5POINT1,
+ AV_CH_LAYOUT_7POINT1,
+};
+
+int main(int argc, char **argv)
+{
+ AVAudioResampleContext *s;
+ AVLFG rnd;
+ int ret = 0;
+ uint8_t *in_buf = NULL;
+ uint8_t *out_buf = NULL;
+ unsigned int in_buf_size;
+ unsigned int out_buf_size;
+ uint8_t *in_data[AVRESAMPLE_MAX_CHANNELS] = { 0 };
+ uint8_t *out_data[AVRESAMPLE_MAX_CHANNELS] = { 0 };
+ int in_linesize;
+ int out_linesize;
+ uint64_t in_ch_layout;
+ int in_channels;
+ enum AVSampleFormat in_fmt;
+ int in_rate;
+ uint64_t out_ch_layout;
+ int out_channels;
+ enum AVSampleFormat out_fmt;
+ int out_rate;
+ int num_formats, num_rates, num_layouts;
+ int i, j, k, l, m, n;
+
+ num_formats = 2;
+ num_rates = 2;
+ num_layouts = 2;
+ if (argc > 1) {
+ if (!av_strncasecmp(argv[1], "-h", 3)) {
+ av_log(NULL, AV_LOG_INFO, "Usage: avresample-test [<num formats> "
+ "[<num sample rates> [<num channel layouts>]]]\n"
+ "Default is 2 2 2\n");
+ return 0;
+ }
+ num_formats = strtol(argv[1], NULL, 0);
+ num_formats = av_clip(num_formats, 1, FF_ARRAY_ELEMS(formats));
+ }
+ if (argc > 2) {
+ num_rates = strtol(argv[2], NULL, 0);
+ num_rates = av_clip(num_rates, 1, FF_ARRAY_ELEMS(rates));
+ }
+ if (argc > 3) {
+ num_layouts = strtol(argv[3], NULL, 0);
+ num_layouts = av_clip(num_layouts, 1, FF_ARRAY_ELEMS(layouts));
+ }
+
+ av_log_set_level(AV_LOG_DEBUG);
+
+ av_lfg_init(&rnd, 0xC0FFEE);
+
+ in_buf_size = av_samples_get_buffer_size(&in_linesize, 8, 48000 * 6,
+ AV_SAMPLE_FMT_DBLP, 0);
+ out_buf_size = in_buf_size;
+
+ in_buf = av_malloc(in_buf_size);
+ if (!in_buf)
+ goto end;
+ out_buf = av_malloc(out_buf_size);
+ if (!out_buf)
+ goto end;
+
+ s = avresample_alloc_context();
+ if (!s) {
+ av_log(NULL, AV_LOG_ERROR, "Error allocating AVAudioResampleContext\n");
+ ret = 1;
+ goto end;
+ }
+
+ for (i = 0; i < num_formats; i++) {
+ in_fmt = formats[i];
+ for (k = 0; k < num_layouts; k++) {
+ in_ch_layout = layouts[k];
+ in_channels = av_get_channel_layout_nb_channels(in_ch_layout);
+ for (m = 0; m < num_rates; m++) {
+ in_rate = rates[m];
+
+ ret = av_samples_fill_arrays(in_data, &in_linesize, in_buf,
+ in_channels, in_rate * 6,
+ in_fmt, 0);
+ if (ret < 0) {
+ av_log(s, AV_LOG_ERROR, "failed in_data fill arrays\n");
+ goto end;
+ }
+ audiogen(&rnd, (void **)in_data, in_fmt, in_channels, in_rate, in_rate * 6);
+
+ for (j = 0; j < num_formats; j++) {
+ out_fmt = formats[j];
+ for (l = 0; l < num_layouts; l++) {
+ out_ch_layout = layouts[l];
+ out_channels = av_get_channel_layout_nb_channels(out_ch_layout);
+ for (n = 0; n < num_rates; n++) {
+ out_rate = rates[n];
+
+ av_log(NULL, AV_LOG_INFO, "%s to %s, %d to %d channels, %d Hz to %d Hz\n",
+ av_get_sample_fmt_name(in_fmt), av_get_sample_fmt_name(out_fmt),
+ in_channels, out_channels, in_rate, out_rate);
+
+ ret = av_samples_fill_arrays(out_data, &out_linesize,
+ out_buf, out_channels,
+ out_rate * 6, out_fmt, 0);
+ if (ret < 0) {
+ av_log(s, AV_LOG_ERROR, "failed out_data fill arrays\n");
+ goto end;
+ }
+
+ av_opt_set_int(s, "in_channel_layout", in_ch_layout, 0);
+ av_opt_set_int(s, "in_sample_fmt", in_fmt, 0);
+ av_opt_set_int(s, "in_sample_rate", in_rate, 0);
+ av_opt_set_int(s, "out_channel_layout", out_ch_layout, 0);
+ av_opt_set_int(s, "out_sample_fmt", out_fmt, 0);
+ av_opt_set_int(s, "out_sample_rate", out_rate, 0);
+
+ av_opt_set_int(s, "internal_sample_fmt", AV_SAMPLE_FMT_FLTP, 0);
+
+ ret = avresample_open(s);
+ if (ret < 0) {
+ av_log(s, AV_LOG_ERROR, "Error opening context\n");
+ goto end;
+ }
+
+ ret = avresample_convert(s, out_data, out_linesize, out_rate * 6,
+ in_data, in_linesize, in_rate * 6);
+ if (ret < 0) {
+ char errbuf[256];
+ av_strerror(ret, errbuf, sizeof(errbuf));
+ av_log(NULL, AV_LOG_ERROR, "%s\n", errbuf);
+ goto end;
+ }
+ av_log(NULL, AV_LOG_INFO, "Converted %d samples to %d samples\n",
+ in_rate * 6, ret);
+ if (avresample_get_delay(s) > 0)
+ av_log(NULL, AV_LOG_INFO, "%d delay samples not converted\n",
+ avresample_get_delay(s));
+ if (avresample_available(s) > 0)
+ av_log(NULL, AV_LOG_INFO, "%d samples available for output\n",
+ avresample_available(s));
+ av_log(NULL, AV_LOG_INFO, "\n");
+
+ avresample_close(s);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ ret = 0;
+
+end:
+ av_freep(&in_buf);
+ av_freep(&out_buf);
+ avresample_free(&s);
+ return ret;
+}
diff --git a/gst-libs/ext/libav/libavresample/avresample.h b/gst-libs/ext/libav/libavresample/avresample.h
new file mode 100644
index 0000000..0012787
--- /dev/null
+++ b/gst-libs/ext/libav/libavresample/avresample.h
@@ -0,0 +1,379 @@
+/*
+ * Copyright (c) 2012 Justin Ruggles <justin.ruggles@gmail.com>
+ *
+ * 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
+ */
+
+#ifndef AVRESAMPLE_AVRESAMPLE_H
+#define AVRESAMPLE_AVRESAMPLE_H
+
+/**
+ * @file
+ * @ingroup lavr
+ * external API header
+ */
+
+/**
+ * @defgroup lavr Libavresample
+ * @{
+ *
+ * Libavresample (lavr) is a library that handles audio resampling, sample
+ * format conversion and mixing.
+ *
+ * Interaction with lavr is done through AVAudioResampleContext, which is
+ * allocated with avresample_alloc_context(). It is opaque, so all parameters
+ * must be set with the @ref avoptions API.
+ *
+ * For example the following code will setup conversion from planar float sample
+ * format to interleaved signed 16-bit integer, downsampling from 48kHz to
+ * 44.1kHz and downmixing from 5.1 channels to stereo (using the default mixing
+ * matrix):
+ * @code
+ * AVAudioResampleContext *avr = avresample_alloc_context();
+ * av_opt_set_int(avr, "in_channel_layout", AV_CH_LAYOUT_5POINT1, 0);
+ * av_opt_set_int(avr, "out_channel_layout", AV_CH_LAYOUT_STEREO, 0);
+ * av_opt_set_int(avr, "in_sample_rate", 48000, 0);
+ * av_opt_set_int(avr, "out_sample_rate", 44100, 0);
+ * av_opt_set_int(avr, "in_sample_fmt", AV_SAMPLE_FMT_FLTP, 0);
+ * av_opt_set_int(avr, "out_sample_fmt", AV_SAMPLE_FMT_S16, 0);
+ * @endcode
+ *
+ * Once the context is initialized, it must be opened with avresample_open(). If
+ * you need to change the conversion parameters, you must close the context with
+ * avresample_close(), change the parameters as described above, then reopen it
+ * again.
+ *
+ * The conversion itself is done by repeatedly calling avresample_convert().
+ * Note that the samples may get buffered in two places in lavr. The first one
+ * is the output FIFO, where the samples end up if the output buffer is not
+ * large enough. The data stored in there may be retrieved at any time with
+ * avresample_read(). The second place is the resampling delay buffer,
+ * applicable only when resampling is done. The samples in it require more input
+ * before they can be processed. Their current amount is returned by
+ * avresample_get_delay(). At the end of conversion the resampling buffer can be
+ * flushed by calling avresample_convert() with NULL input.
+ *
+ * The following code demonstrates the conversion loop assuming the parameters
+ * from above and caller-defined functions get_input() and handle_output():
+ * @code
+ * uint8_t **input;
+ * int in_linesize, in_samples;
+ *
+ * while (get_input(&input, &in_linesize, &in_samples)) {
+ * uint8_t *output
+ * int out_linesize;
+ * int out_samples = avresample_available(avr) +
+ * av_rescale_rnd(avresample_get_delay(avr) +
+ * in_samples, 44100, 48000, AV_ROUND_UP);
+ * av_samples_alloc(&output, &out_linesize, 2, out_samples,
+ * AV_SAMPLE_FMT_S16, 0);
+ * out_samples = avresample_convert(avr, &output, out_linesize, out_samples,
+ * input, in_linesize, in_samples);
+ * handle_output(output, out_linesize, out_samples);
+ * av_freep(&output);
+ * }
+ * @endcode
+ *
+ * When the conversion is finished and the FIFOs are flushed if required, the
+ * conversion context and everything associated with it must be freed with
+ * avresample_free().
+ */
+
+#include "libavutil/avutil.h"
+#include "libavutil/channel_layout.h"
+#include "libavutil/dict.h"
+#include "libavutil/log.h"
+
+#include "libavresample/version.h"
+
+#define AVRESAMPLE_MAX_CHANNELS 32
+
+typedef struct AVAudioResampleContext AVAudioResampleContext;
+
+/** Mixing Coefficient Types */
+enum AVMixCoeffType {
+ AV_MIX_COEFF_TYPE_Q8, /** 16-bit 8.8 fixed-point */
+ AV_MIX_COEFF_TYPE_Q15, /** 32-bit 17.15 fixed-point */
+ AV_MIX_COEFF_TYPE_FLT, /** floating-point */
+ AV_MIX_COEFF_TYPE_NB, /** Number of coeff types. Not part of ABI */
+};
+
+/** Resampling Filter Types */
+enum AVResampleFilterType {
+ AV_RESAMPLE_FILTER_TYPE_CUBIC, /**< Cubic */
+ AV_RESAMPLE_FILTER_TYPE_BLACKMAN_NUTTALL, /**< Blackman Nuttall Windowed Sinc */
+ AV_RESAMPLE_FILTER_TYPE_KAISER, /**< Kaiser Windowed Sinc */
+};
+
+enum AVResampleDitherMethod {
+ AV_RESAMPLE_DITHER_NONE, /**< Do not use dithering */
+ AV_RESAMPLE_DITHER_RECTANGULAR, /**< Rectangular Dither */
+ AV_RESAMPLE_DITHER_TRIANGULAR, /**< Triangular Dither*/
+ AV_RESAMPLE_DITHER_TRIANGULAR_HP, /**< Triangular Dither with High Pass */
+ AV_RESAMPLE_DITHER_TRIANGULAR_NS, /**< Triangular Dither with Noise Shaping */
+ AV_RESAMPLE_DITHER_NB, /**< Number of dither types. Not part of ABI. */
+};
+
+/**
+ * Return the LIBAVRESAMPLE_VERSION_INT constant.
+ */
+unsigned avresample_version(void);
+
+/**
+ * Return the libavresample build-time configuration.
+ * @return configure string
+ */
+const char *avresample_configuration(void);
+
+/**
+ * Return the libavresample license.
+ */
+const char *avresample_license(void);
+
+/**
+ * Get the AVClass for AVAudioResampleContext.
+ *
+ * Can be used in combination with AV_OPT_SEARCH_FAKE_OBJ for examining options
+ * without allocating a context.
+ *
+ * @see av_opt_find().
+ *
+ * @return AVClass for AVAudioResampleContext
+ */
+const AVClass *avresample_get_class(void);
+
+/**
+ * Allocate AVAudioResampleContext and set options.
+ *
+ * @return allocated audio resample context, or NULL on failure
+ */
+AVAudioResampleContext *avresample_alloc_context(void);
+
+/**
+ * Initialize AVAudioResampleContext.
+ *
+ * @param avr audio resample context
+ * @return 0 on success, negative AVERROR code on failure
+ */
+int avresample_open(AVAudioResampleContext *avr);
+
+/**
+ * Close AVAudioResampleContext.
+ *
+ * This closes the context, but it does not change the parameters. The context
+ * can be reopened with avresample_open(). It does, however, clear the output
+ * FIFO and any remaining leftover samples in the resampling delay buffer. If
+ * there was a custom matrix being used, that is also cleared.
+ *
+ * @see avresample_convert()
+ * @see avresample_set_matrix()
+ *
+ * @param avr audio resample context
+ */
+void avresample_close(AVAudioResampleContext *avr);
+
+/**
+ * Free AVAudioResampleContext and associated AVOption values.
+ *
+ * This also calls avresample_close() before freeing.
+ *
+ * @param avr audio resample context
+ */
+void avresample_free(AVAudioResampleContext **avr);
+
+/**
+ * Generate a channel mixing matrix.
+ *
+ * This function is the one used internally by libavresample for building the
+ * default mixing matrix. It is made public just as a utility function for
+ * building custom matrices.
+ *
+ * @param in_layout input channel layout
+ * @param out_layout output channel layout
+ * @param center_mix_level mix level for the center channel
+ * @param surround_mix_level mix level for the surround channel(s)
+ * @param lfe_mix_level mix level for the low-frequency effects channel
+ * @param normalize if 1, coefficients will be normalized to prevent
+ * overflow. if 0, coefficients will not be
+ * normalized.
+ * @param[out] matrix mixing coefficients; matrix[i + stride * o] is
+ * the weight of input channel i in output channel o.
+ * @param stride distance between adjacent input channels in the
+ * matrix array
+ * @param matrix_encoding matrixed stereo downmix mode (e.g. dplii)
+ * @return 0 on success, negative AVERROR code on failure
+ */
+int avresample_build_matrix(uint64_t in_layout, uint64_t out_layout,
+ double center_mix_level, double surround_mix_level,
+ double lfe_mix_level, int normalize, double *matrix,
+ int stride, enum AVMatrixEncoding matrix_encoding);
+
+/**
+ * Get the current channel mixing matrix.
+ *
+ * If no custom matrix has been previously set or the AVAudioResampleContext is
+ * not open, an error is returned.
+ *
+ * @param avr audio resample context
+ * @param matrix mixing coefficients; matrix[i + stride * o] is the weight of
+ * input channel i in output channel o.
+ * @param stride distance between adjacent input channels in the matrix array
+ * @return 0 on success, negative AVERROR code on failure
+ */
+int avresample_get_matrix(AVAudioResampleContext *avr, double *matrix,
+ int stride);
+
+/**
+ * Set channel mixing matrix.
+ *
+ * Allows for setting a custom mixing matrix, overriding the default matrix
+ * generated internally during avresample_open(). This function can be called
+ * anytime on an allocated context, either before or after calling
+ * avresample_open(), as long as the channel layouts have been set.
+ * avresample_convert() always uses the current matrix.
+ * Calling avresample_close() on the context will clear the current matrix.
+ *
+ * @see avresample_close()
+ *
+ * @param avr audio resample context
+ * @param matrix mixing coefficients; matrix[i + stride * o] is the weight of
+ * input channel i in output channel o.
+ * @param stride distance between adjacent input channels in the matrix array
+ * @return 0 on success, negative AVERROR code on failure
+ */
+int avresample_set_matrix(AVAudioResampleContext *avr, const double *matrix,
+ int stride);
+
+/**
+ * Set compensation for resampling.
+ *
+ * This can be called anytime after avresample_open(). If resampling is not
+ * automatically enabled because of a sample rate conversion, the
+ * "force_resampling" option must have been set to 1 when opening the context
+ * in order to use resampling compensation.
+ *
+ * @param avr audio resample context
+ * @param sample_delta compensation delta, in samples
+ * @param compensation_distance compensation distance, in samples
+ * @return 0 on success, negative AVERROR code on failure
+ */
+int avresample_set_compensation(AVAudioResampleContext *avr, int sample_delta,
+ int compensation_distance);
+
+/**
+ * Convert input samples and write them to the output FIFO.
+ *
+ * The upper bound on the number of output samples is given by
+ * avresample_available() + (avresample_get_delay() + number of input samples) *
+ * output sample rate / input sample rate.
+ *
+ * The output data can be NULL or have fewer allocated samples than required.
+ * In this case, any remaining samples not written to the output will be added
+ * to an internal FIFO buffer, to be returned at the next call to this function
+ * or to avresample_read().
+ *
+ * If converting sample rate, there may be data remaining in the internal
+ * resampling delay buffer. avresample_get_delay() tells the number of remaining
+ * samples. To get this data as output, call avresample_convert() with NULL
+ * input.
+ *
+ * At the end of the conversion process, there may be data remaining in the
+ * internal FIFO buffer. avresample_available() tells the number of remaining
+ * samples. To get this data as output, either call avresample_convert() with
+ * NULL input or call avresample_read().
+ *
+ * @see avresample_available()
+ * @see avresample_read()
+ * @see avresample_get_delay()
+ *
+ * @param avr audio resample context
+ * @param output output data pointers
+ * @param out_plane_size output plane size, in bytes.
+ * This can be 0 if unknown, but that will lead to
+ * optimized functions not being used directly on the
+ * output, which could slow down some conversions.
+ * @param out_samples maximum number of samples that the output buffer can hold
+ * @param input input data pointers
+ * @param in_plane_size input plane size, in bytes
+ * This can be 0 if unknown, but that will lead to
+ * optimized functions not being used directly on the
+ * input, which could slow down some conversions.
+ * @param in_samples number of input samples to convert
+ * @return number of samples written to the output buffer,
+ * not including converted samples added to the internal
+ * output FIFO
+ */
+int avresample_convert(AVAudioResampleContext *avr, uint8_t **output,
+ int out_plane_size, int out_samples, uint8_t **input,
+ int in_plane_size, int in_samples);
+
+/**
+ * Return the number of samples currently in the resampling delay buffer.
+ *
+ * When resampling, there may be a delay between the input and output. Any
+ * unconverted samples in each call are stored internally in a delay buffer.
+ * This function allows the user to determine the current number of samples in
+ * the delay buffer, which can be useful for synchronization.
+ *
+ * @see avresample_convert()
+ *
+ * @param avr audio resample context
+ * @return number of samples currently in the resampling delay buffer
+ */
+int avresample_get_delay(AVAudioResampleContext *avr);
+
+/**
+ * Return the number of available samples in the output FIFO.
+ *
+ * During conversion, if the user does not specify an output buffer or
+ * specifies an output buffer that is smaller than what is needed, remaining
+ * samples that are not written to the output are stored to an internal FIFO
+ * buffer. The samples in the FIFO can be read with avresample_read() or
+ * avresample_convert().
+ *
+ * @see avresample_read()
+ * @see avresample_convert()
+ *
+ * @param avr audio resample context
+ * @return number of samples available for reading
+ */
+int avresample_available(AVAudioResampleContext *avr);
+
+/**
+ * Read samples from the output FIFO.
+ *
+ * During conversion, if the user does not specify an output buffer or
+ * specifies an output buffer that is smaller than what is needed, remaining
+ * samples that are not written to the output are stored to an internal FIFO
+ * buffer. This function can be used to read samples from that internal FIFO.
+ *
+ * @see avresample_available()
+ * @see avresample_convert()
+ *
+ * @param avr audio resample context
+ * @param output output data pointers. May be NULL, in which case
+ * nb_samples of data is discarded from output FIFO.
+ * @param nb_samples number of samples to read from the FIFO
+ * @return the number of samples written to output
+ */
+int avresample_read(AVAudioResampleContext *avr, uint8_t **output, int nb_samples);
+
+/**
+ * @}
+ */
+
+#endif /* AVRESAMPLE_AVRESAMPLE_H */
diff --git a/gst-libs/ext/libav/libavresample/dither.c b/gst-libs/ext/libav/libavresample/dither.c
new file mode 100644
index 0000000..9c1e1c1
--- /dev/null
+++ b/gst-libs/ext/libav/libavresample/dither.c
@@ -0,0 +1,423 @@
+/*
+ * Copyright (c) 2012 Justin Ruggles <justin.ruggles@gmail.com>
+ *
+ * Triangular with Noise Shaping is based on opusfile.
+ * Copyright (c) 1994-2012 by the Xiph.Org Foundation and contributors
+ *
+ * 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
+ * Dithered Audio Sample Quantization
+ *
+ * Converts from dbl, flt, or s32 to s16 using dithering.
+ */
+
+#include <math.h>
+#include <stdint.h>
+
+#include "libavutil/common.h"
+#include "libavutil/lfg.h"
+#include "libavutil/mem.h"
+#include "libavutil/samplefmt.h"
+#include "audio_convert.h"
+#include "dither.h"
+#include "internal.h"
+
+typedef struct DitherState {
+ int mute;
+ unsigned int seed;
+ AVLFG lfg;
+ float *noise_buf;
+ int noise_buf_size;
+ int noise_buf_ptr;
+ float dither_a[4];
+ float dither_b[4];
+} DitherState;
+
+struct DitherContext {
+ DitherDSPContext ddsp;
+ enum AVResampleDitherMethod method;
+
+ int mute_dither_threshold; // threshold for disabling dither
+ int mute_reset_threshold; // threshold for resetting noise shaping
+ const float *ns_coef_b; // noise shaping coeffs
+ const float *ns_coef_a; // noise shaping coeffs
+
+ int channels;
+ DitherState *state; // dither states for each channel
+
+ AudioData *flt_data; // input data in fltp
+ AudioData *s16_data; // dithered output in s16p
+ AudioConvert *ac_in; // converter for input to fltp
+ AudioConvert *ac_out; // converter for s16p to s16 (if needed)
+
+ void (*quantize)(int16_t *dst, const float *src, float *dither, int len);
+ int samples_align;
+};
+
+/* mute threshold, in seconds */
+#define MUTE_THRESHOLD_SEC 0.000333
+
+/* scale factor for 16-bit output.
+ The signal is attenuated slightly to avoid clipping */
+#define S16_SCALE 32753.0f
+
+/* scale to convert lfg from INT_MIN/INT_MAX to -0.5/0.5 */
+#define LFG_SCALE (1.0f / (2.0f * INT32_MAX))
+
+/* noise shaping coefficients */
+
+static const float ns_48_coef_b[4] = {
+ 2.2374f, -0.7339f, -0.1251f, -0.6033f
+};
+
+static const float ns_48_coef_a[4] = {
+ 0.9030f, 0.0116f, -0.5853f, -0.2571f
+};
+
+static const float ns_44_coef_b[4] = {
+ 2.2061f, -0.4707f, -0.2534f, -0.6213f
+};
+
+static const float ns_44_coef_a[4] = {
+ 1.0587f, 0.0676f, -0.6054f, -0.2738f
+};
+
+static void dither_int_to_float_rectangular_c(float *dst, int *src, int len)
+{
+ int i;
+ for (i = 0; i < len; i++)
+ dst[i] = src[i] * LFG_SCALE;
+}
+
+static void dither_int_to_float_triangular_c(float *dst, int *src0, int len)
+{
+ int i;
+ int *src1 = src0 + len;
+
+ for (i = 0; i < len; i++) {
+ float r = src0[i] * LFG_SCALE;
+ r += src1[i] * LFG_SCALE;
+ dst[i] = r;
+ }
+}
+
+static void quantize_c(int16_t *dst, const float *src, float *dither, int len)
+{
+ int i;
+ for (i = 0; i < len; i++)
+ dst[i] = av_clip_int16(lrintf(src[i] * S16_SCALE + dither[i]));
+}
+
+#define SQRT_1_6 0.40824829046386301723f
+
+static void dither_highpass_filter(float *src, int len)
+{
+ int i;
+
+ /* filter is from libswresample in FFmpeg */
+ for (i = 0; i < len - 2; i++)
+ src[i] = (-src[i] + 2 * src[i + 1] - src[i + 2]) * SQRT_1_6;
+}
+
+static int generate_dither_noise(DitherContext *c, DitherState *state,
+ int min_samples)
+{
+ int i;
+ int nb_samples = FFALIGN(min_samples, 16) + 16;
+ int buf_samples = nb_samples *
+ (c->method == AV_RESAMPLE_DITHER_RECTANGULAR ? 1 : 2);
+ unsigned int *noise_buf_ui;
+
+ av_freep(&state->noise_buf);
+ state->noise_buf_size = state->noise_buf_ptr = 0;
+
+ state->noise_buf = av_malloc(buf_samples * sizeof(*state->noise_buf));
+ if (!state->noise_buf)
+ return AVERROR(ENOMEM);
+ state->noise_buf_size = FFALIGN(min_samples, 16);
+ noise_buf_ui = (unsigned int *)state->noise_buf;
+
+ av_lfg_init(&state->lfg, state->seed);
+ for (i = 0; i < buf_samples; i++)
+ noise_buf_ui[i] = av_lfg_get(&state->lfg);
+
+ c->ddsp.dither_int_to_float(state->noise_buf, noise_buf_ui, nb_samples);
+
+ if (c->method == AV_RESAMPLE_DITHER_TRIANGULAR_HP)
+ dither_highpass_filter(state->noise_buf, nb_samples);
+
+ return 0;
+}
+
+static void quantize_triangular_ns(DitherContext *c, DitherState *state,
+ int16_t *dst, const float *src,
+ int nb_samples)
+{
+ int i, j;
+ float *dither = &state->noise_buf[state->noise_buf_ptr];
+
+ if (state->mute > c->mute_reset_threshold)
+ memset(state->dither_a, 0, sizeof(state->dither_a));
+
+ for (i = 0; i < nb_samples; i++) {
+ float err = 0;
+ float sample = src[i] * S16_SCALE;
+
+ for (j = 0; j < 4; j++) {
+ err += c->ns_coef_b[j] * state->dither_b[j] -
+ c->ns_coef_a[j] * state->dither_a[j];
+ }
+ for (j = 3; j > 0; j--) {
+ state->dither_a[j] = state->dither_a[j - 1];
+ state->dither_b[j] = state->dither_b[j - 1];
+ }
+ state->dither_a[0] = err;
+ sample -= err;
+
+ if (state->mute > c->mute_dither_threshold) {
+ dst[i] = av_clip_int16(lrintf(sample));
+ state->dither_b[0] = 0;
+ } else {
+ dst[i] = av_clip_int16(lrintf(sample + dither[i]));
+ state->dither_b[0] = av_clipf(dst[i] - sample, -1.5f, 1.5f);
+ }
+
+ state->mute++;
+ if (src[i])
+ state->mute = 0;
+ }
+}
+
+static int convert_samples(DitherContext *c, int16_t **dst, float * const *src,
+ int channels, int nb_samples)
+{
+ int ch, ret;
+ int aligned_samples = FFALIGN(nb_samples, 16);
+
+ for (ch = 0; ch < channels; ch++) {
+ DitherState *state = &c->state[ch];
+
+ if (state->noise_buf_size < aligned_samples) {
+ ret = generate_dither_noise(c, state, nb_samples);
+ if (ret < 0)
+ return ret;
+ } else if (state->noise_buf_size - state->noise_buf_ptr < aligned_samples) {
+ state->noise_buf_ptr = 0;
+ }
+
+ if (c->method == AV_RESAMPLE_DITHER_TRIANGULAR_NS) {
+ quantize_triangular_ns(c, state, dst[ch], src[ch], nb_samples);
+ } else {
+ c->quantize(dst[ch], src[ch],
+ &state->noise_buf[state->noise_buf_ptr],
+ FFALIGN(nb_samples, c->samples_align));
+ }
+
+ state->noise_buf_ptr += aligned_samples;
+ }
+
+ return 0;
+}
+
+int ff_convert_dither(DitherContext *c, AudioData *dst, AudioData *src)
+{
+ int ret;
+ AudioData *flt_data;
+
+ /* output directly to dst if it is planar */
+ if (dst->sample_fmt == AV_SAMPLE_FMT_S16P)
+ c->s16_data = dst;
+ else {
+ /* make sure s16_data is large enough for the output */
+ ret = ff_audio_data_realloc(c->s16_data, src->nb_samples);
+ if (ret < 0)
+ return ret;
+ }
+
+ if (src->sample_fmt != AV_SAMPLE_FMT_FLTP) {
+ /* make sure flt_data is large enough for the input */
+ ret = ff_audio_data_realloc(c->flt_data, src->nb_samples);
+ if (ret < 0)
+ return ret;
+ flt_data = c->flt_data;
+
+ /* convert input samples to fltp and scale to s16 range */
+ ret = ff_audio_convert(c->ac_in, flt_data, src);
+ if (ret < 0)
+ return ret;
+ } else {
+ flt_data = src;
+ }
+
+ /* check alignment and padding constraints */
+ if (c->method != AV_RESAMPLE_DITHER_TRIANGULAR_NS) {
+ int ptr_align = FFMIN(flt_data->ptr_align, c->s16_data->ptr_align);
+ int samples_align = FFMIN(flt_data->samples_align, c->s16_data->samples_align);
+ int aligned_len = FFALIGN(src->nb_samples, c->ddsp.samples_align);
+
+ if (!(ptr_align % c->ddsp.ptr_align) && samples_align >= aligned_len) {
+ c->quantize = c->ddsp.quantize;
+ c->samples_align = c->ddsp.samples_align;
+ } else {
+ c->quantize = quantize_c;
+ c->samples_align = 1;
+ }
+ }
+
+ ret = convert_samples(c, (int16_t **)c->s16_data->data,
+ (float * const *)flt_data->data, src->channels,
+ src->nb_samples);
+ if (ret < 0)
+ return ret;
+
+ c->s16_data->nb_samples = src->nb_samples;
+
+ /* interleave output to dst if needed */
+ if (dst->sample_fmt == AV_SAMPLE_FMT_S16) {
+ ret = ff_audio_convert(c->ac_out, dst, c->s16_data);
+ if (ret < 0)
+ return ret;
+ } else
+ c->s16_data = NULL;
+
+ return 0;
+}
+
+void ff_dither_free(DitherContext **cp)
+{
+ DitherContext *c = *cp;
+ int ch;
+
+ if (!c)
+ return;
+ ff_audio_data_free(&c->flt_data);
+ ff_audio_data_free(&c->s16_data);
+ ff_audio_convert_free(&c->ac_in);
+ ff_audio_convert_free(&c->ac_out);
+ for (ch = 0; ch < c->channels; ch++)
+ av_free(c->state[ch].noise_buf);
+ av_free(c->state);
+ av_freep(cp);
+}
+
+static void dither_init(DitherDSPContext *ddsp,
+ enum AVResampleDitherMethod method)
+{
+ ddsp->quantize = quantize_c;
+ ddsp->ptr_align = 1;
+ ddsp->samples_align = 1;
+
+ if (method == AV_RESAMPLE_DITHER_RECTANGULAR)
+ ddsp->dither_int_to_float = dither_int_to_float_rectangular_c;
+ else
+ ddsp->dither_int_to_float = dither_int_to_float_triangular_c;
+}
+
+DitherContext *ff_dither_alloc(AVAudioResampleContext *avr,
+ enum AVSampleFormat out_fmt,
+ enum AVSampleFormat in_fmt,
+ int channels, int sample_rate)
+{
+ AVLFG seed_gen;
+ DitherContext *c;
+ int ch;
+
+ if (av_get_packed_sample_fmt(out_fmt) != AV_SAMPLE_FMT_S16 ||
+ av_get_bytes_per_sample(in_fmt) <= 2) {
+ av_log(avr, AV_LOG_ERROR, "dithering %s to %s is not supported\n",
+ av_get_sample_fmt_name(in_fmt), av_get_sample_fmt_name(out_fmt));
+ return NULL;
+ }
+
+ c = av_mallocz(sizeof(*c));
+ if (!c)
+ return NULL;
+
+ if (avr->dither_method == AV_RESAMPLE_DITHER_TRIANGULAR_NS &&
+ sample_rate != 48000 && sample_rate != 44100) {
+ av_log(avr, AV_LOG_WARNING, "sample rate must be 48000 or 44100 Hz "
+ "for triangular_ns dither. using triangular_hp instead.\n");
+ avr->dither_method = AV_RESAMPLE_DITHER_TRIANGULAR_HP;
+ }
+ c->method = avr->dither_method;
+ dither_init(&c->ddsp, c->method);
+
+ if (c->method == AV_RESAMPLE_DITHER_TRIANGULAR_NS) {
+ if (sample_rate == 48000) {
+ c->ns_coef_b = ns_48_coef_b;
+ c->ns_coef_a = ns_48_coef_a;
+ } else {
+ c->ns_coef_b = ns_44_coef_b;
+ c->ns_coef_a = ns_44_coef_a;
+ }
+ }
+
+ /* Either s16 or s16p output format is allowed, but s16p is used
+ internally, so we need to use a temp buffer and interleave if the output
+ format is s16 */
+ if (out_fmt != AV_SAMPLE_FMT_S16P) {
+ c->s16_data = ff_audio_data_alloc(channels, 1024, AV_SAMPLE_FMT_S16P,
+ "dither s16 buffer");
+ if (!c->s16_data)
+ goto fail;
+
+ c->ac_out = ff_audio_convert_alloc(avr, out_fmt, AV_SAMPLE_FMT_S16P,
+ channels, sample_rate);
+ if (!c->ac_out)
+ goto fail;
+ }
+
+ if (in_fmt != AV_SAMPLE_FMT_FLTP) {
+ c->flt_data = ff_audio_data_alloc(channels, 1024, AV_SAMPLE_FMT_FLTP,
+ "dither flt buffer");
+ if (!c->flt_data)
+ goto fail;
+
+ c->ac_in = ff_audio_convert_alloc(avr, AV_SAMPLE_FMT_FLTP, in_fmt,
+ channels, sample_rate);
+ if (!c->ac_in)
+ goto fail;
+ }
+
+ c->state = av_mallocz(channels * sizeof(*c->state));
+ if (!c->state)
+ goto fail;
+ c->channels = channels;
+
+ /* calculate thresholds for turning off dithering during periods of
+ silence to avoid replacing digital silence with quiet dither noise */
+ c->mute_dither_threshold = lrintf(sample_rate * MUTE_THRESHOLD_SEC);
+ c->mute_reset_threshold = c->mute_dither_threshold * 4;
+
+ /* initialize dither states */
+ av_lfg_init(&seed_gen, 0xC0FFEE);
+ for (ch = 0; ch < channels; ch++) {
+ DitherState *state = &c->state[ch];
+ state->mute = c->mute_reset_threshold + 1;
+ state->seed = av_lfg_get(&seed_gen);
+ generate_dither_noise(c, state, FFMAX(32768, sample_rate / 2));
+ }
+
+ return c;
+
+fail:
+ ff_dither_free(&c);
+ return NULL;
+}
diff --git a/gst-libs/ext/libav/libavresample/dither.h b/gst-libs/ext/libav/libavresample/dither.h
new file mode 100644
index 0000000..8b30dd2
--- /dev/null
+++ b/gst-libs/ext/libav/libavresample/dither.h
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 2012 Justin Ruggles <justin.ruggles@gmail.com>
+ *
+ * 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
+ */
+
+#ifndef AVRESAMPLE_DITHER_H
+#define AVRESAMPLE_DITHER_H
+
+#include "avresample.h"
+#include "audio_data.h"
+
+typedef struct DitherContext DitherContext;
+
+typedef struct DitherDSPContext {
+ /**
+ * Convert samples from flt to s16 with added dither noise.
+ *
+ * @param dst destination float array, range -0.5 to 0.5
+ * @param src source int array, range INT_MIN to INT_MAX.
+ * @param dither float dither noise array
+ * @param len number of samples
+ */
+ void (*quantize)(int16_t *dst, const float *src, float *dither, int len);
+
+ int ptr_align; ///< src and dst constraits for quantize()
+ int samples_align; ///< len constraits for quantize()
+
+ /**
+ * Convert dither noise from int to float with triangular distribution.
+ *
+ * @param dst destination float array, range -0.5 to 0.5
+ * constraints: 32-byte aligned
+ * @param src0 source int array, range INT_MIN to INT_MAX.
+ * the array size is len * 2
+ * constraints: 32-byte aligned
+ * @param len number of output noise samples
+ * constraints: multiple of 16
+ */
+ void (*dither_int_to_float)(float *dst, int *src0, int len);
+} DitherDSPContext;
+
+/**
+ * Allocate and initialize a DitherContext.
+ *
+ * The parameters in the AVAudioResampleContext are used to initialize the
+ * DitherContext.
+ *
+ * @param avr AVAudioResampleContext
+ * @return newly-allocated DitherContext
+ */
+DitherContext *ff_dither_alloc(AVAudioResampleContext *avr,
+ enum AVSampleFormat out_fmt,
+ enum AVSampleFormat in_fmt,
+ int channels, int sample_rate);
+
+/**
+ * Free a DitherContext.
+ *
+ * @param c DitherContext
+ */
+void ff_dither_free(DitherContext **c);
+
+/**
+ * Convert audio sample format with dithering.
+ *
+ * @param c DitherContext
+ * @param dst destination audio data
+ * @param src source audio data
+ * @return 0 if ok, negative AVERROR code on failure
+ */
+int ff_convert_dither(DitherContext *c, AudioData *dst, AudioData *src);
+
+#endif /* AVRESAMPLE_DITHER_H */
diff --git a/gst-libs/ext/libav/libavresample/internal.h b/gst-libs/ext/libav/libavresample/internal.h
new file mode 100644
index 0000000..2e139ab
--- /dev/null
+++ b/gst-libs/ext/libav/libavresample/internal.h
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) 2012 Justin Ruggles <justin.ruggles@gmail.com>
+ *
+ * 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
+ */
+
+#ifndef AVRESAMPLE_INTERNAL_H
+#define AVRESAMPLE_INTERNAL_H
+
+#include "libavutil/audio_fifo.h"
+#include "libavutil/log.h"
+#include "libavutil/opt.h"
+#include "libavutil/samplefmt.h"
+#include "avresample.h"
+#include "audio_convert.h"
+#include "audio_data.h"
+#include "audio_mix.h"
+#include "resample.h"
+
+struct AVAudioResampleContext {
+ const AVClass *av_class; /**< AVClass for logging and AVOptions */
+
+ uint64_t in_channel_layout; /**< input channel layout */
+ enum AVSampleFormat in_sample_fmt; /**< input sample format */
+ int in_sample_rate; /**< input sample rate */
+ uint64_t out_channel_layout; /**< output channel layout */
+ enum AVSampleFormat out_sample_fmt; /**< output sample format */
+ int out_sample_rate; /**< output sample rate */
+ enum AVSampleFormat internal_sample_fmt; /**< internal sample format */
+ enum AVMixCoeffType mix_coeff_type; /**< mixing coefficient type */
+ double center_mix_level; /**< center mix level */
+ double surround_mix_level; /**< surround mix level */
+ double lfe_mix_level; /**< lfe mix level */
+ int normalize_mix_level; /**< enable mix level normalization */
+ int force_resampling; /**< force resampling */
+ int filter_size; /**< length of each FIR filter in the resampling filterbank relative to the cutoff frequency */
+ int phase_shift; /**< log2 of the number of entries in the resampling polyphase filterbank */
+ int linear_interp; /**< if 1 then the resampling FIR filter will be linearly interpolated */
+ double cutoff; /**< resampling cutoff frequency. 1.0 corresponds to half the output sample rate */
+ enum AVResampleFilterType filter_type; /**< resampling filter type */
+ int kaiser_beta; /**< beta value for Kaiser window (only applicable if filter_type == AV_FILTER_TYPE_KAISER) */
+ enum AVResampleDitherMethod dither_method; /**< dither method */
+
+ int in_channels; /**< number of input channels */
+ int out_channels; /**< number of output channels */
+ int resample_channels; /**< number of channels used for resampling */
+ int downmix_needed; /**< downmixing is needed */
+ int upmix_needed; /**< upmixing is needed */
+ int mixing_needed; /**< either upmixing or downmixing is needed */
+ int resample_needed; /**< resampling is needed */
+ int in_convert_needed; /**< input sample format conversion is needed */
+ int out_convert_needed; /**< output sample format conversion is needed */
+
+ AudioData *in_buffer; /**< buffer for converted input */
+ AudioData *resample_out_buffer; /**< buffer for output from resampler */
+ AudioData *out_buffer; /**< buffer for converted output */
+ AVAudioFifo *out_fifo; /**< FIFO for output samples */
+
+ AudioConvert *ac_in; /**< input sample format conversion context */
+ AudioConvert *ac_out; /**< output sample format conversion context */
+ ResampleContext *resample; /**< resampling context */
+ AudioMix *am; /**< channel mixing context */
+ enum AVMatrixEncoding matrix_encoding; /**< matrixed stereo encoding */
+
+ /**
+ * mix matrix
+ * only used if avresample_set_matrix() is called before avresample_open()
+ */
+ double *mix_matrix;
+};
+
+#endif /* AVRESAMPLE_INTERNAL_H */
diff --git a/gst-libs/ext/libav/libavresample/libavresample.v b/gst-libs/ext/libav/libavresample/libavresample.v
new file mode 100644
index 0000000..b8c7c7d
--- /dev/null
+++ b/gst-libs/ext/libav/libavresample/libavresample.v
@@ -0,0 +1,4 @@
+LIBAVRESAMPLE_$MAJOR {
+ global: av*;
+ local: *;
+};
diff --git a/gst-libs/ext/libav/libavresample/options.c b/gst-libs/ext/libav/libavresample/options.c
new file mode 100644
index 0000000..68548f0
--- /dev/null
+++ b/gst-libs/ext/libav/libavresample/options.c
@@ -0,0 +1,99 @@
+/*
+ * Copyright (c) 2012 Justin Ruggles <justin.ruggles@gmail.com>
+ *
+ * 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
+ */
+
+#include "libavutil/mathematics.h"
+#include "libavutil/mem.h"
+#include "libavutil/opt.h"
+#include "avresample.h"
+#include "internal.h"
+#include "audio_mix.h"
+
+/**
+ * @file
+ * Options definition for AVAudioResampleContext.
+ */
+
+#define OFFSET(x) offsetof(AVAudioResampleContext, x)
+#define PARAM AV_OPT_FLAG_AUDIO_PARAM
+
+static const AVOption options[] = {
+ { "in_channel_layout", "Input Channel Layout", OFFSET(in_channel_layout), AV_OPT_TYPE_INT64, { .i64 = 0 }, INT64_MIN, INT64_MAX, PARAM },
+ { "in_sample_fmt", "Input Sample Format", OFFSET(in_sample_fmt), AV_OPT_TYPE_INT, { .i64 = AV_SAMPLE_FMT_S16 }, AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_NB-1, PARAM },
+ { "in_sample_rate", "Input Sample Rate", OFFSET(in_sample_rate), AV_OPT_TYPE_INT, { .i64 = 48000 }, 1, INT_MAX, PARAM },
+ { "out_channel_layout", "Output Channel Layout", OFFSET(out_channel_layout), AV_OPT_TYPE_INT64, { .i64 = 0 }, INT64_MIN, INT64_MAX, PARAM },
+ { "out_sample_fmt", "Output Sample Format", OFFSET(out_sample_fmt), AV_OPT_TYPE_INT, { .i64 = AV_SAMPLE_FMT_S16 }, AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_NB-1, PARAM },
+ { "out_sample_rate", "Output Sample Rate", OFFSET(out_sample_rate), AV_OPT_TYPE_INT, { .i64 = 48000 }, 1, INT_MAX, PARAM },
+ { "internal_sample_fmt", "Internal Sample Format", OFFSET(internal_sample_fmt), AV_OPT_TYPE_INT, { .i64 = AV_SAMPLE_FMT_NONE }, AV_SAMPLE_FMT_NONE, AV_SAMPLE_FMT_NB-1, PARAM },
+ { "mix_coeff_type", "Mixing Coefficient Type", OFFSET(mix_coeff_type), AV_OPT_TYPE_INT, { .i64 = AV_MIX_COEFF_TYPE_FLT }, AV_MIX_COEFF_TYPE_Q8, AV_MIX_COEFF_TYPE_NB-1, PARAM, "mix_coeff_type" },
+ { "q8", "16-bit 8.8 Fixed-Point", 0, AV_OPT_TYPE_CONST, { .i64 = AV_MIX_COEFF_TYPE_Q8 }, INT_MIN, INT_MAX, PARAM, "mix_coeff_type" },
+ { "q15", "32-bit 17.15 Fixed-Point", 0, AV_OPT_TYPE_CONST, { .i64 = AV_MIX_COEFF_TYPE_Q15 }, INT_MIN, INT_MAX, PARAM, "mix_coeff_type" },
+ { "flt", "Floating-Point", 0, AV_OPT_TYPE_CONST, { .i64 = AV_MIX_COEFF_TYPE_FLT }, INT_MIN, INT_MAX, PARAM, "mix_coeff_type" },
+ { "center_mix_level", "Center Mix Level", OFFSET(center_mix_level), AV_OPT_TYPE_DOUBLE, { .dbl = M_SQRT1_2 }, -32.0, 32.0, PARAM },
+ { "surround_mix_level", "Surround Mix Level", OFFSET(surround_mix_level), AV_OPT_TYPE_DOUBLE, { .dbl = M_SQRT1_2 }, -32.0, 32.0, PARAM },
+ { "lfe_mix_level", "LFE Mix Level", OFFSET(lfe_mix_level), AV_OPT_TYPE_DOUBLE, { .dbl = 0.0 }, -32.0, 32.0, PARAM },
+ { "normalize_mix_level", "Normalize Mix Level", OFFSET(normalize_mix_level), AV_OPT_TYPE_INT, { .i64 = 1 }, 0, 1, PARAM },
+ { "force_resampling", "Force Resampling", OFFSET(force_resampling), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, PARAM },
+ { "filter_size", "Resampling Filter Size", OFFSET(filter_size), AV_OPT_TYPE_INT, { .i64 = 16 }, 0, 32, /* ??? */ PARAM },
+ { "phase_shift", "Resampling Phase Shift", OFFSET(phase_shift), AV_OPT_TYPE_INT, { .i64 = 10 }, 0, 30, /* ??? */ PARAM },
+ { "linear_interp", "Use Linear Interpolation", OFFSET(linear_interp), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, PARAM },
+ { "cutoff", "Cutoff Frequency Ratio", OFFSET(cutoff), AV_OPT_TYPE_DOUBLE, { .dbl = 0.8 }, 0.0, 1.0, PARAM },
+ { "matrix_encoding", "Matrixed Stereo Encoding", OFFSET(matrix_encoding), AV_OPT_TYPE_INT, {.i64 = AV_MATRIX_ENCODING_NONE}, AV_MATRIX_ENCODING_NONE, AV_MATRIX_ENCODING_NB-1, PARAM, "matrix_encoding" },
+ { "none", "None", 0, AV_OPT_TYPE_CONST, { .i64 = AV_MATRIX_ENCODING_NONE }, INT_MIN, INT_MAX, PARAM, "matrix_encoding" },
+ { "dolby", "Dolby", 0, AV_OPT_TYPE_CONST, { .i64 = AV_MATRIX_ENCODING_DOLBY }, INT_MIN, INT_MAX, PARAM, "matrix_encoding" },
+ { "dplii", "Dolby Pro Logic II", 0, AV_OPT_TYPE_CONST, { .i64 = AV_MATRIX_ENCODING_DPLII }, INT_MIN, INT_MAX, PARAM, "matrix_encoding" },
+ { "filter_type", "Filter Type", OFFSET(filter_type), AV_OPT_TYPE_INT, { .i64 = AV_RESAMPLE_FILTER_TYPE_KAISER }, AV_RESAMPLE_FILTER_TYPE_CUBIC, AV_RESAMPLE_FILTER_TYPE_KAISER, PARAM, "filter_type" },
+ { "cubic", "Cubic", 0, AV_OPT_TYPE_CONST, { .i64 = AV_RESAMPLE_FILTER_TYPE_CUBIC }, INT_MIN, INT_MAX, PARAM, "filter_type" },
+ { "blackman_nuttall", "Blackman Nuttall Windowed Sinc", 0, AV_OPT_TYPE_CONST, { .i64 = AV_RESAMPLE_FILTER_TYPE_BLACKMAN_NUTTALL }, INT_MIN, INT_MAX, PARAM, "filter_type" },
+ { "kaiser", "Kaiser Windowed Sinc", 0, AV_OPT_TYPE_CONST, { .i64 = AV_RESAMPLE_FILTER_TYPE_KAISER }, INT_MIN, INT_MAX, PARAM, "filter_type" },
+ { "kaiser_beta", "Kaiser Window Beta", OFFSET(kaiser_beta), AV_OPT_TYPE_INT, { .i64 = 9 }, 2, 16, PARAM },
+ { "dither_method", "Dither Method", OFFSET(dither_method), AV_OPT_TYPE_INT, { .i64 = AV_RESAMPLE_DITHER_NONE }, 0, AV_RESAMPLE_DITHER_NB-1, PARAM, "dither_method"},
+ {"none", "No Dithering", 0, AV_OPT_TYPE_CONST, { .i64 = AV_RESAMPLE_DITHER_NONE }, INT_MIN, INT_MAX, PARAM, "dither_method"},
+ {"rectangular", "Rectangular Dither", 0, AV_OPT_TYPE_CONST, { .i64 = AV_RESAMPLE_DITHER_RECTANGULAR }, INT_MIN, INT_MAX, PARAM, "dither_method"},
+ {"triangular", "Triangular Dither", 0, AV_OPT_TYPE_CONST, { .i64 = AV_RESAMPLE_DITHER_TRIANGULAR }, INT_MIN, INT_MAX, PARAM, "dither_method"},
+ {"triangular_hp", "Triangular Dither With High Pass", 0, AV_OPT_TYPE_CONST, { .i64 = AV_RESAMPLE_DITHER_TRIANGULAR_HP }, INT_MIN, INT_MAX, PARAM, "dither_method"},
+ {"triangular_ns", "Triangular Dither With Noise Shaping", 0, AV_OPT_TYPE_CONST, { .i64 = AV_RESAMPLE_DITHER_TRIANGULAR_NS }, INT_MIN, INT_MAX, PARAM, "dither_method"},
+ { NULL },
+};
+
+static const AVClass av_resample_context_class = {
+ .class_name = "AVAudioResampleContext",
+ .item_name = av_default_item_name,
+ .option = options,
+ .version = LIBAVUTIL_VERSION_INT,
+};
+
+AVAudioResampleContext *avresample_alloc_context(void)
+{
+ AVAudioResampleContext *avr;
+
+ avr = av_mallocz(sizeof(*avr));
+ if (!avr)
+ return NULL;
+
+ avr->av_class = &av_resample_context_class;
+ av_opt_set_defaults(avr);
+
+ return avr;
+}
+
+const AVClass *avresample_get_class(void)
+{
+ return &av_resample_context_class;
+}
diff --git a/gst-libs/ext/libav/libavresample/resample.c b/gst-libs/ext/libav/libavresample/resample.c
new file mode 100644
index 0000000..dc121fe
--- /dev/null
+++ b/gst-libs/ext/libav/libavresample/resample.c
@@ -0,0 +1,468 @@
+/*
+ * Copyright (c) 2004 Michael Niedermayer <michaelni@gmx.at>
+ * Copyright (c) 2012 Justin Ruggles <justin.ruggles@gmail.com>
+ *
+ * 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
+ */
+
+#include "libavutil/common.h"
+#include "libavutil/libm.h"
+#include "libavutil/log.h"
+#include "internal.h"
+#include "audio_data.h"
+
+struct ResampleContext {
+ AVAudioResampleContext *avr;
+ AudioData *buffer;
+ uint8_t *filter_bank;
+ int filter_length;
+ int ideal_dst_incr;
+ int dst_incr;
+ int index;
+ int frac;
+ int src_incr;
+ int compensation_distance;
+ int phase_shift;
+ int phase_mask;
+ int linear;
+ enum AVResampleFilterType filter_type;
+ int kaiser_beta;
+ double factor;
+ void (*set_filter)(void *filter, double *tab, int phase, int tap_count);
+ void (*resample_one)(struct ResampleContext *c, int no_filter, void *dst0,
+ int dst_index, const void *src0, int src_size,
+ int index, int frac);
+};
+
+
+/* double template */
+#define CONFIG_RESAMPLE_DBL
+#include "resample_template.c"
+#undef CONFIG_RESAMPLE_DBL
+
+/* float template */
+#define CONFIG_RESAMPLE_FLT
+#include "resample_template.c"
+#undef CONFIG_RESAMPLE_FLT
+
+/* s32 template */
+#define CONFIG_RESAMPLE_S32
+#include "resample_template.c"
+#undef CONFIG_RESAMPLE_S32
+
+/* s16 template */
+#include "resample_template.c"
+
+
+/* 0th order modified bessel function of the first kind. */
+static double bessel(double x)
+{
+ double v = 1;
+ double lastv = 0;
+ double t = 1;
+ int i;
+
+ x = x * x / 4;
+ for (i = 1; v != lastv; i++) {
+ lastv = v;
+ t *= x / (i * i);
+ v += t;
+ }
+ return v;
+}
+
+/* Build a polyphase filterbank. */
+static int build_filter(ResampleContext *c)
+{
+ int ph, i;
+ double x, y, w, factor;
+ double *tab;
+ int tap_count = c->filter_length;
+ int phase_count = 1 << c->phase_shift;
+ const int center = (tap_count - 1) / 2;
+
+ tab = av_malloc(tap_count * sizeof(*tab));
+ if (!tab)
+ return AVERROR(ENOMEM);
+
+ /* if upsampling, only need to interpolate, no filter */
+ factor = FFMIN(c->factor, 1.0);
+
+ for (ph = 0; ph < phase_count; ph++) {
+ double norm = 0;
+ for (i = 0; i < tap_count; i++) {
+ x = M_PI * ((double)(i - center) - (double)ph / phase_count) * factor;
+ if (x == 0) y = 1.0;
+ else y = sin(x) / x;
+ switch (c->filter_type) {
+ case AV_RESAMPLE_FILTER_TYPE_CUBIC: {
+ const float d = -0.5; //first order derivative = -0.5
+ x = fabs(((double)(i - center) - (double)ph / phase_count) * factor);
+ if (x < 1.0) y = 1 - 3 * x*x + 2 * x*x*x + d * ( -x*x + x*x*x);
+ else y = d * (-4 + 8 * x - 5 * x*x + x*x*x);
+ break;
+ }
+ case AV_RESAMPLE_FILTER_TYPE_BLACKMAN_NUTTALL:
+ w = 2.0 * x / (factor * tap_count) + M_PI;
+ y *= 0.3635819 - 0.4891775 * cos( w) +
+ 0.1365995 * cos(2 * w) -
+ 0.0106411 * cos(3 * w);
+ break;
+ case AV_RESAMPLE_FILTER_TYPE_KAISER:
+ w = 2.0 * x / (factor * tap_count * M_PI);
+ y *= bessel(c->kaiser_beta * sqrt(FFMAX(1 - w * w, 0)));
+ break;
+ }
+
+ tab[i] = y;
+ norm += y;
+ }
+ /* normalize so that an uniform color remains the same */
+ for (i = 0; i < tap_count; i++)
+ tab[i] = tab[i] / norm;
+
+ c->set_filter(c->filter_bank, tab, ph, tap_count);
+ }
+
+ av_free(tab);
+ return 0;
+}
+
+ResampleContext *ff_audio_resample_init(AVAudioResampleContext *avr)
+{
+ ResampleContext *c;
+ int out_rate = avr->out_sample_rate;
+ int in_rate = avr->in_sample_rate;
+ double factor = FFMIN(out_rate * avr->cutoff / in_rate, 1.0);
+ int phase_count = 1 << avr->phase_shift;
+ int felem_size;
+
+ if (avr->internal_sample_fmt != AV_SAMPLE_FMT_S16P &&
+ avr->internal_sample_fmt != AV_SAMPLE_FMT_S32P &&
+ avr->internal_sample_fmt != AV_SAMPLE_FMT_FLTP &&
+ avr->internal_sample_fmt != AV_SAMPLE_FMT_DBLP) {
+ av_log(avr, AV_LOG_ERROR, "Unsupported internal format for "
+ "resampling: %s\n",
+ av_get_sample_fmt_name(avr->internal_sample_fmt));
+ return NULL;
+ }
+ c = av_mallocz(sizeof(*c));
+ if (!c)
+ return NULL;
+
+ c->avr = avr;
+ c->phase_shift = avr->phase_shift;
+ c->phase_mask = phase_count - 1;
+ c->linear = avr->linear_interp;
+ c->factor = factor;
+ c->filter_length = FFMAX((int)ceil(avr->filter_size / factor), 1);
+ c->filter_type = avr->filter_type;
+ c->kaiser_beta = avr->kaiser_beta;
+
+ switch (avr->internal_sample_fmt) {
+ case AV_SAMPLE_FMT_DBLP:
+ c->resample_one = resample_one_dbl;
+ c->set_filter = set_filter_dbl;
+ break;
+ case AV_SAMPLE_FMT_FLTP:
+ c->resample_one = resample_one_flt;
+ c->set_filter = set_filter_flt;
+ break;
+ case AV_SAMPLE_FMT_S32P:
+ c->resample_one = resample_one_s32;
+ c->set_filter = set_filter_s32;
+ break;
+ case AV_SAMPLE_FMT_S16P:
+ c->resample_one = resample_one_s16;
+ c->set_filter = set_filter_s16;
+ break;
+ }
+
+ felem_size = av_get_bytes_per_sample(avr->internal_sample_fmt);
+ c->filter_bank = av_mallocz(c->filter_length * (phase_count + 1) * felem_size);
+ if (!c->filter_bank)
+ goto error;
+
+ if (build_filter(c) < 0)
+ goto error;
+
+ memcpy(&c->filter_bank[(c->filter_length * phase_count + 1) * felem_size],
+ c->filter_bank, (c->filter_length - 1) * felem_size);
+ memcpy(&c->filter_bank[c->filter_length * phase_count * felem_size],
+ &c->filter_bank[(c->filter_length - 1) * felem_size], felem_size);
+
+ c->compensation_distance = 0;
+ if (!av_reduce(&c->src_incr, &c->dst_incr, out_rate,
+ in_rate * (int64_t)phase_count, INT32_MAX / 2))
+ goto error;
+ c->ideal_dst_incr = c->dst_incr;
+
+ c->index = -phase_count * ((c->filter_length - 1) / 2);
+ c->frac = 0;
+
+ /* allocate internal buffer */
+ c->buffer = ff_audio_data_alloc(avr->resample_channels, 0,
+ avr->internal_sample_fmt,
+ "resample buffer");
+ if (!c->buffer)
+ goto error;
+
+ av_log(avr, AV_LOG_DEBUG, "resample: %s from %d Hz to %d Hz\n",
+ av_get_sample_fmt_name(avr->internal_sample_fmt),
+ avr->in_sample_rate, avr->out_sample_rate);
+
+ return c;
+
+error:
+ ff_audio_data_free(&c->buffer);
+ av_free(c->filter_bank);
+ av_free(c);
+ return NULL;
+}
+
+void ff_audio_resample_free(ResampleContext **c)
+{
+ if (!*c)
+ return;
+ ff_audio_data_free(&(*c)->buffer);
+ av_free((*c)->filter_bank);
+ av_freep(c);
+}
+
+int avresample_set_compensation(AVAudioResampleContext *avr, int sample_delta,
+ int compensation_distance)
+{
+ ResampleContext *c;
+ AudioData *fifo_buf = NULL;
+ int ret = 0;
+
+ if (compensation_distance < 0)
+ return AVERROR(EINVAL);
+ if (!compensation_distance && sample_delta)
+ return AVERROR(EINVAL);
+
+ if (!avr->resample_needed) {
+#if FF_API_RESAMPLE_CLOSE_OPEN
+ /* if resampling was not enabled previously, re-initialize the
+ AVAudioResampleContext and force resampling */
+ int fifo_samples;
+ int restore_matrix = 0;
+ double matrix[AVRESAMPLE_MAX_CHANNELS * AVRESAMPLE_MAX_CHANNELS] = { 0 };
+
+ /* buffer any remaining samples in the output FIFO before closing */
+ fifo_samples = av_audio_fifo_size(avr->out_fifo);
+ if (fifo_samples > 0) {
+ fifo_buf = ff_audio_data_alloc(avr->out_channels, fifo_samples,
+ avr->out_sample_fmt, NULL);
+ if (!fifo_buf)
+ return AVERROR(EINVAL);
+ ret = ff_audio_data_read_from_fifo(avr->out_fifo, fifo_buf,
+ fifo_samples);
+ if (ret < 0)
+ goto reinit_fail;
+ }
+ /* save the channel mixing matrix */
+ if (avr->am) {
+ ret = avresample_get_matrix(avr, matrix, AVRESAMPLE_MAX_CHANNELS);
+ if (ret < 0)
+ goto reinit_fail;
+ restore_matrix = 1;
+ }
+
+ /* close the AVAudioResampleContext */
+ avresample_close(avr);
+
+ avr->force_resampling = 1;
+
+ /* restore the channel mixing matrix */
+ if (restore_matrix) {
+ ret = avresample_set_matrix(avr, matrix, AVRESAMPLE_MAX_CHANNELS);
+ if (ret < 0)
+ goto reinit_fail;
+ }
+
+ /* re-open the AVAudioResampleContext */
+ ret = avresample_open(avr);
+ if (ret < 0)
+ goto reinit_fail;
+
+ /* restore buffered samples to the output FIFO */
+ if (fifo_samples > 0) {
+ ret = ff_audio_data_add_to_fifo(avr->out_fifo, fifo_buf, 0,
+ fifo_samples);
+ if (ret < 0)
+ goto reinit_fail;
+ ff_audio_data_free(&fifo_buf);
+ }
+#else
+ av_log(avr, AV_LOG_ERROR, "Unable to set resampling compensation\n");
+ return AVERROR(EINVAL);
+#endif
+ }
+ c = avr->resample;
+ c->compensation_distance = compensation_distance;
+ if (compensation_distance) {
+ c->dst_incr = c->ideal_dst_incr - c->ideal_dst_incr *
+ (int64_t)sample_delta / compensation_distance;
+ } else {
+ c->dst_incr = c->ideal_dst_incr;
+ }
+ return 0;
+
+reinit_fail:
+ ff_audio_data_free(&fifo_buf);
+ return ret;
+}
+
+static int resample(ResampleContext *c, void *dst, const void *src,
+ int *consumed, int src_size, int dst_size, int update_ctx)
+{
+ int dst_index;
+ int index = c->index;
+ int frac = c->frac;
+ int dst_incr_frac = c->dst_incr % c->src_incr;
+ int dst_incr = c->dst_incr / c->src_incr;
+ int compensation_distance = c->compensation_distance;
+
+ if (!dst != !src)
+ return AVERROR(EINVAL);
+
+ if (compensation_distance == 0 && c->filter_length == 1 &&
+ c->phase_shift == 0) {
+ int64_t index2 = ((int64_t)index) << 32;
+ int64_t incr = (1LL << 32) * c->dst_incr / c->src_incr;
+ dst_size = FFMIN(dst_size,
+ (src_size-1-index) * (int64_t)c->src_incr /
+ c->dst_incr);
+
+ if (dst) {
+ for(dst_index = 0; dst_index < dst_size; dst_index++) {
+ c->resample_one(c, 1, dst, dst_index, src, 0, index2 >> 32, 0);
+ index2 += incr;
+ }
+ } else {
+ dst_index = dst_size;
+ }
+ index += dst_index * dst_incr;
+ index += (frac + dst_index * (int64_t)dst_incr_frac) / c->src_incr;
+ frac = (frac + dst_index * (int64_t)dst_incr_frac) % c->src_incr;
+ } else {
+ for (dst_index = 0; dst_index < dst_size; dst_index++) {
+ int sample_index = index >> c->phase_shift;
+
+ if (sample_index + c->filter_length > src_size ||
+ -sample_index >= src_size)
+ break;
+
+ if (dst)
+ c->resample_one(c, 0, dst, dst_index, src, src_size, index, frac);
+
+ frac += dst_incr_frac;
+ index += dst_incr;
+ if (frac >= c->src_incr) {
+ frac -= c->src_incr;
+ index++;
+ }
+ if (dst_index + 1 == compensation_distance) {
+ compensation_distance = 0;
+ dst_incr_frac = c->ideal_dst_incr % c->src_incr;
+ dst_incr = c->ideal_dst_incr / c->src_incr;
+ }
+ }
+ }
+ if (consumed)
+ *consumed = FFMAX(index, 0) >> c->phase_shift;
+
+ if (update_ctx) {
+ if (index >= 0)
+ index &= c->phase_mask;
+
+ if (compensation_distance) {
+ compensation_distance -= dst_index;
+ if (compensation_distance <= 0)
+ return AVERROR_BUG;
+ }
+ c->frac = frac;
+ c->index = index;
+ c->dst_incr = dst_incr_frac + c->src_incr*dst_incr;
+ c->compensation_distance = compensation_distance;
+ }
+
+ return dst_index;
+}
+
+int ff_audio_resample(ResampleContext *c, AudioData *dst, AudioData *src)
+{
+ int ch, in_samples, in_leftover, consumed = 0, out_samples = 0;
+ int ret = AVERROR(EINVAL);
+
+ in_samples = src ? src->nb_samples : 0;
+ in_leftover = c->buffer->nb_samples;
+
+ /* add input samples to the internal buffer */
+ if (src) {
+ ret = ff_audio_data_combine(c->buffer, in_leftover, src, 0, in_samples);
+ if (ret < 0)
+ return ret;
+ } else if (!in_leftover) {
+ /* no remaining samples to flush */
+ return 0;
+ } else {
+ /* TODO: pad buffer to flush completely */
+ }
+
+ /* calculate output size and reallocate output buffer if needed */
+ /* TODO: try to calculate this without the dummy resample() run */
+ if (!dst->read_only && dst->allow_realloc) {
+ out_samples = resample(c, NULL, NULL, NULL, c->buffer->nb_samples,
+ INT_MAX, 0);
+ ret = ff_audio_data_realloc(dst, out_samples);
+ if (ret < 0) {
+ av_log(c->avr, AV_LOG_ERROR, "error reallocating output\n");
+ return ret;
+ }
+ }
+
+ /* resample each channel plane */
+ for (ch = 0; ch < c->buffer->channels; ch++) {
+ out_samples = resample(c, (void *)dst->data[ch],
+ (const void *)c->buffer->data[ch], &consumed,
+ c->buffer->nb_samples, dst->allocated_samples,
+ ch + 1 == c->buffer->channels);
+ }
+ if (out_samples < 0) {
+ av_log(c->avr, AV_LOG_ERROR, "error during resampling\n");
+ return out_samples;
+ }
+
+ /* drain consumed samples from the internal buffer */
+ ff_audio_data_drain(c->buffer, consumed);
+
+ av_dlog(c->avr, "resampled %d in + %d leftover to %d out + %d leftover\n",
+ in_samples, in_leftover, out_samples, c->buffer->nb_samples);
+
+ dst->nb_samples = out_samples;
+ return 0;
+}
+
+int avresample_get_delay(AVAudioResampleContext *avr)
+{
+ if (!avr->resample_needed || !avr->resample)
+ return 0;
+
+ return avr->resample->buffer->nb_samples;
+}
diff --git a/gst-libs/ext/libav/libavresample/resample.h b/gst-libs/ext/libav/libavresample/resample.h
new file mode 100644
index 0000000..7534e26
--- /dev/null
+++ b/gst-libs/ext/libav/libavresample/resample.h
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2004 Michael Niedermayer <michaelni@gmx.at>
+ *
+ * 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
+ */
+
+#ifndef AVRESAMPLE_RESAMPLE_H
+#define AVRESAMPLE_RESAMPLE_H
+
+#include "avresample.h"
+#include "audio_data.h"
+
+typedef struct ResampleContext ResampleContext;
+
+/**
+ * Allocate and initialize a ResampleContext.
+ *
+ * The parameters in the AVAudioResampleContext are used to initialize the
+ * ResampleContext.
+ *
+ * @param avr AVAudioResampleContext
+ * @return newly-allocated ResampleContext
+ */
+ResampleContext *ff_audio_resample_init(AVAudioResampleContext *avr);
+
+/**
+ * Free a ResampleContext.
+ *
+ * @param c ResampleContext
+ */
+void ff_audio_resample_free(ResampleContext **c);
+
+/**
+ * Resample audio data.
+ *
+ * Changes the sample rate.
+ *
+ * @par
+ * All samples in the source data may not be consumed depending on the
+ * resampling parameters and the size of the output buffer. The unconsumed
+ * samples are automatically added to the start of the source in the next call.
+ * If the destination data can be reallocated, that may be done in this function
+ * in order to fit all available output. If it cannot be reallocated, fewer
+ * input samples will be consumed in order to have the output fit in the
+ * destination data buffers.
+ *
+ * @param c ResampleContext
+ * @param dst destination audio data
+ * @param src source audio data
+ * @return 0 on success, negative AVERROR code on failure
+ */
+int ff_audio_resample(ResampleContext *c, AudioData *dst, AudioData *src);
+
+#endif /* AVRESAMPLE_RESAMPLE_H */
diff --git a/gst-libs/ext/libav/libavresample/resample_template.c b/gst-libs/ext/libav/libavresample/resample_template.c
new file mode 100644
index 0000000..5b0fbec
--- /dev/null
+++ b/gst-libs/ext/libav/libavresample/resample_template.c
@@ -0,0 +1,102 @@
+/*
+ * Copyright (c) 2004 Michael Niedermayer <michaelni@gmx.at>
+ *
+ * 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
+ */
+
+#if defined(CONFIG_RESAMPLE_DBL)
+#define SET_TYPE(func) func ## _dbl
+#define FELEM double
+#define FELEM2 double
+#define FELEML double
+#define OUT(d, v) d = v
+#define DBL_TO_FELEM(d, v) d = v
+#elif defined(CONFIG_RESAMPLE_FLT)
+#define SET_TYPE(func) func ## _flt
+#define FELEM float
+#define FELEM2 float
+#define FELEML float
+#define OUT(d, v) d = v
+#define DBL_TO_FELEM(d, v) d = v
+#elif defined(CONFIG_RESAMPLE_S32)
+#define SET_TYPE(func) func ## _s32
+#define FELEM int32_t
+#define FELEM2 int64_t
+#define FELEML int64_t
+#define OUT(d, v) d = av_clipl_int32((v + (1 << 29)) >> 30)
+#define DBL_TO_FELEM(d, v) d = av_clipl_int32(llrint(v * (1 << 30)));
+#else
+#define SET_TYPE(func) func ## _s16
+#define FELEM int16_t
+#define FELEM2 int32_t
+#define FELEML int64_t
+#define OUT(d, v) d = av_clip_int16((v + (1 << 14)) >> 15)
+#define DBL_TO_FELEM(d, v) d = av_clip_int16(lrint(v * (1 << 15)))
+#endif
+
+static void SET_TYPE(resample_one)(ResampleContext *c, int no_filter,
+ void *dst0, int dst_index, const void *src0,
+ int src_size, int index, int frac)
+{
+ FELEM *dst = dst0;
+ const FELEM *src = src0;
+
+ if (no_filter) {
+ dst[dst_index] = src[index];
+ } else {
+ int i;
+ int sample_index = index >> c->phase_shift;
+ FELEM2 val = 0;
+ FELEM *filter = ((FELEM *)c->filter_bank) +
+ c->filter_length * (index & c->phase_mask);
+
+ if (sample_index < 0) {
+ for (i = 0; i < c->filter_length; i++)
+ val += src[FFABS(sample_index + i) % src_size] *
+ (FELEM2)filter[i];
+ } else if (c->linear) {
+ FELEM2 v2 = 0;
+ for (i = 0; i < c->filter_length; i++) {
+ val += src[abs(sample_index + i)] * (FELEM2)filter[i];
+ v2 += src[abs(sample_index + i)] * (FELEM2)filter[i + c->filter_length];
+ }
+ val += (v2 - val) * (FELEML)frac / c->src_incr;
+ } else {
+ for (i = 0; i < c->filter_length; i++)
+ val += src[sample_index + i] * (FELEM2)filter[i];
+ }
+
+ OUT(dst[dst_index], val);
+ }
+}
+
+static void SET_TYPE(set_filter)(void *filter0, double *tab, int phase,
+ int tap_count)
+{
+ int i;
+ FELEM *filter = ((FELEM *)filter0) + phase * tap_count;
+ for (i = 0; i < tap_count; i++) {
+ DBL_TO_FELEM(filter[i], tab[i]);
+ }
+}
+
+#undef SET_TYPE
+#undef FELEM
+#undef FELEM2
+#undef FELEML
+#undef OUT
+#undef DBL_TO_FELEM
diff --git a/gst-libs/ext/libav/libavresample/utils.c b/gst-libs/ext/libav/libavresample/utils.c
new file mode 100644
index 0000000..ed7f470
--- /dev/null
+++ b/gst-libs/ext/libav/libavresample/utils.c
@@ -0,0 +1,496 @@
+/*
+ * Copyright (c) 2012 Justin Ruggles <justin.ruggles@gmail.com>
+ *
+ * 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
+ */
+
+#include "libavutil/common.h"
+#include "libavutil/dict.h"
+#include "libavutil/error.h"
+#include "libavutil/log.h"
+#include "libavutil/mem.h"
+#include "libavutil/opt.h"
+
+#include "avresample.h"
+#include "audio_data.h"
+#include "internal.h"
+
+int avresample_open(AVAudioResampleContext *avr)
+{
+ int ret;
+
+ /* set channel mixing parameters */
+ avr->in_channels = av_get_channel_layout_nb_channels(avr->in_channel_layout);
+ if (avr->in_channels <= 0 || avr->in_channels > AVRESAMPLE_MAX_CHANNELS) {
+ av_log(avr, AV_LOG_ERROR, "Invalid input channel layout: %"PRIu64"\n",
+ avr->in_channel_layout);
+ return AVERROR(EINVAL);
+ }
+ avr->out_channels = av_get_channel_layout_nb_channels(avr->out_channel_layout);
+ if (avr->out_channels <= 0 || avr->out_channels > AVRESAMPLE_MAX_CHANNELS) {
+ av_log(avr, AV_LOG_ERROR, "Invalid output channel layout: %"PRIu64"\n",
+ avr->out_channel_layout);
+ return AVERROR(EINVAL);
+ }
+ avr->resample_channels = FFMIN(avr->in_channels, avr->out_channels);
+ avr->downmix_needed = avr->in_channels > avr->out_channels;
+ avr->upmix_needed = avr->out_channels > avr->in_channels ||
+ (!avr->downmix_needed && (avr->mix_matrix ||
+ avr->in_channel_layout != avr->out_channel_layout));
+ avr->mixing_needed = avr->downmix_needed || avr->upmix_needed;
+
+ /* set resampling parameters */
+ avr->resample_needed = avr->in_sample_rate != avr->out_sample_rate ||
+ avr->force_resampling;
+
+ /* select internal sample format if not specified by the user */
+ if (avr->internal_sample_fmt == AV_SAMPLE_FMT_NONE &&
+ (avr->mixing_needed || avr->resample_needed)) {
+ enum AVSampleFormat in_fmt = av_get_planar_sample_fmt(avr->in_sample_fmt);
+ enum AVSampleFormat out_fmt = av_get_planar_sample_fmt(avr->out_sample_fmt);
+ int max_bps = FFMAX(av_get_bytes_per_sample(in_fmt),
+ av_get_bytes_per_sample(out_fmt));
+ if (max_bps <= 2) {
+ avr->internal_sample_fmt = AV_SAMPLE_FMT_S16P;
+ } else if (avr->mixing_needed) {
+ avr->internal_sample_fmt = AV_SAMPLE_FMT_FLTP;
+ } else {
+ if (max_bps <= 4) {
+ if (in_fmt == AV_SAMPLE_FMT_S32P ||
+ out_fmt == AV_SAMPLE_FMT_S32P) {
+ if (in_fmt == AV_SAMPLE_FMT_FLTP ||
+ out_fmt == AV_SAMPLE_FMT_FLTP) {
+ /* if one is s32 and the other is flt, use dbl */
+ avr->internal_sample_fmt = AV_SAMPLE_FMT_DBLP;
+ } else {
+ /* if one is s32 and the other is s32, s16, or u8, use s32 */
+ avr->internal_sample_fmt = AV_SAMPLE_FMT_S32P;
+ }
+ } else {
+ /* if one is flt and the other is flt, s16 or u8, use flt */
+ avr->internal_sample_fmt = AV_SAMPLE_FMT_FLTP;
+ }
+ } else {
+ /* if either is dbl, use dbl */
+ avr->internal_sample_fmt = AV_SAMPLE_FMT_DBLP;
+ }
+ }
+ av_log(avr, AV_LOG_DEBUG, "Using %s as internal sample format\n",
+ av_get_sample_fmt_name(avr->internal_sample_fmt));
+ }
+
+ /* set sample format conversion parameters */
+ if (avr->in_channels == 1)
+ avr->in_sample_fmt = av_get_planar_sample_fmt(avr->in_sample_fmt);
+ if (avr->out_channels == 1)
+ avr->out_sample_fmt = av_get_planar_sample_fmt(avr->out_sample_fmt);
+ avr->in_convert_needed = (avr->resample_needed || avr->mixing_needed) &&
+ avr->in_sample_fmt != avr->internal_sample_fmt;
+ if (avr->resample_needed || avr->mixing_needed)
+ avr->out_convert_needed = avr->internal_sample_fmt != avr->out_sample_fmt;
+ else
+ avr->out_convert_needed = avr->in_sample_fmt != avr->out_sample_fmt;
+
+ /* allocate buffers */
+ if (avr->mixing_needed || avr->in_convert_needed) {
+ avr->in_buffer = ff_audio_data_alloc(FFMAX(avr->in_channels, avr->out_channels),
+ 0, avr->internal_sample_fmt,
+ "in_buffer");
+ if (!avr->in_buffer) {
+ ret = AVERROR(EINVAL);
+ goto error;
+ }
+ }
+ if (avr->resample_needed) {
+ avr->resample_out_buffer = ff_audio_data_alloc(avr->out_channels,
+ 0, avr->internal_sample_fmt,
+ "resample_out_buffer");
+ if (!avr->resample_out_buffer) {
+ ret = AVERROR(EINVAL);
+ goto error;
+ }
+ }
+ if (avr->out_convert_needed) {
+ avr->out_buffer = ff_audio_data_alloc(avr->out_channels, 0,
+ avr->out_sample_fmt, "out_buffer");
+ if (!avr->out_buffer) {
+ ret = AVERROR(EINVAL);
+ goto error;
+ }
+ }
+ avr->out_fifo = av_audio_fifo_alloc(avr->out_sample_fmt, avr->out_channels,
+ 1024);
+ if (!avr->out_fifo) {
+ ret = AVERROR(ENOMEM);
+ goto error;
+ }
+
+ /* setup contexts */
+ if (avr->in_convert_needed) {
+ avr->ac_in = ff_audio_convert_alloc(avr, avr->internal_sample_fmt,
+ avr->in_sample_fmt, avr->in_channels,
+ avr->in_sample_rate);
+ if (!avr->ac_in) {
+ ret = AVERROR(ENOMEM);
+ goto error;
+ }
+ }
+ if (avr->out_convert_needed) {
+ enum AVSampleFormat src_fmt;
+ if (avr->in_convert_needed)
+ src_fmt = avr->internal_sample_fmt;
+ else
+ src_fmt = avr->in_sample_fmt;
+ avr->ac_out = ff_audio_convert_alloc(avr, avr->out_sample_fmt, src_fmt,
+ avr->out_channels,
+ avr->out_sample_rate);
+ if (!avr->ac_out) {
+ ret = AVERROR(ENOMEM);
+ goto error;
+ }
+ }
+ if (avr->resample_needed) {
+ avr->resample = ff_audio_resample_init(avr);
+ if (!avr->resample) {
+ ret = AVERROR(ENOMEM);
+ goto error;
+ }
+ }
+ if (avr->mixing_needed) {
+ avr->am = ff_audio_mix_alloc(avr);
+ if (!avr->am) {
+ ret = AVERROR(ENOMEM);
+ goto error;
+ }
+ }
+
+ return 0;
+
+error:
+ avresample_close(avr);
+ return ret;
+}
+
+void avresample_close(AVAudioResampleContext *avr)
+{
+ ff_audio_data_free(&avr->in_buffer);
+ ff_audio_data_free(&avr->resample_out_buffer);
+ ff_audio_data_free(&avr->out_buffer);
+ av_audio_fifo_free(avr->out_fifo);
+ avr->out_fifo = NULL;
+ ff_audio_convert_free(&avr->ac_in);
+ ff_audio_convert_free(&avr->ac_out);
+ ff_audio_resample_free(&avr->resample);
+ ff_audio_mix_free(&avr->am);
+ av_freep(&avr->mix_matrix);
+}
+
+void avresample_free(AVAudioResampleContext **avr)
+{
+ if (!*avr)
+ return;
+ avresample_close(*avr);
+ av_opt_free(*avr);
+ av_freep(avr);
+}
+
+static int handle_buffered_output(AVAudioResampleContext *avr,
+ AudioData *output, AudioData *converted)
+{
+ int ret;
+
+ if (!output || av_audio_fifo_size(avr->out_fifo) > 0 ||
+ (converted && output->allocated_samples < converted->nb_samples)) {
+ if (converted) {
+ /* if there are any samples in the output FIFO or if the
+ user-supplied output buffer is not large enough for all samples,
+ we add to the output FIFO */
+ av_dlog(avr, "[FIFO] add %s to out_fifo\n", converted->name);
+ ret = ff_audio_data_add_to_fifo(avr->out_fifo, converted, 0,
+ converted->nb_samples);
+ if (ret < 0)
+ return ret;
+ }
+
+ /* if the user specified an output buffer, read samples from the output
+ FIFO to the user output */
+ if (output && output->allocated_samples > 0) {
+ av_dlog(avr, "[FIFO] read from out_fifo to output\n");
+ av_dlog(avr, "[end conversion]\n");
+ return ff_audio_data_read_from_fifo(avr->out_fifo, output,
+ output->allocated_samples);
+ }
+ } else if (converted) {
+ /* copy directly to output if it is large enough or there is not any
+ data in the output FIFO */
+ av_dlog(avr, "[copy] %s to output\n", converted->name);
+ output->nb_samples = 0;
+ ret = ff_audio_data_copy(output, converted);
+ if (ret < 0)
+ return ret;
+ av_dlog(avr, "[end conversion]\n");
+ return output->nb_samples;
+ }
+ av_dlog(avr, "[end conversion]\n");
+ return 0;
+}
+
+int attribute_align_arg avresample_convert(AVAudioResampleContext *avr,
+ uint8_t **output, int out_plane_size,
+ int out_samples, uint8_t **input,
+ int in_plane_size, int in_samples)
+{
+ AudioData input_buffer;
+ AudioData output_buffer;
+ AudioData *current_buffer;
+ int ret, direct_output;
+
+ /* reset internal buffers */
+ if (avr->in_buffer) {
+ avr->in_buffer->nb_samples = 0;
+ ff_audio_data_set_channels(avr->in_buffer,
+ avr->in_buffer->allocated_channels);
+ }
+ if (avr->resample_out_buffer) {
+ avr->resample_out_buffer->nb_samples = 0;
+ ff_audio_data_set_channels(avr->resample_out_buffer,
+ avr->resample_out_buffer->allocated_channels);
+ }
+ if (avr->out_buffer) {
+ avr->out_buffer->nb_samples = 0;
+ ff_audio_data_set_channels(avr->out_buffer,
+ avr->out_buffer->allocated_channels);
+ }
+
+ av_dlog(avr, "[start conversion]\n");
+
+ /* initialize output_buffer with output data */
+ direct_output = output && av_audio_fifo_size(avr->out_fifo) == 0;
+ if (output) {
+ ret = ff_audio_data_init(&output_buffer, output, out_plane_size,
+ avr->out_channels, out_samples,
+ avr->out_sample_fmt, 0, "output");
+ if (ret < 0)
+ return ret;
+ output_buffer.nb_samples = 0;
+ }
+
+ if (input) {
+ /* initialize input_buffer with input data */
+ ret = ff_audio_data_init(&input_buffer, input, in_plane_size,
+ avr->in_channels, in_samples,
+ avr->in_sample_fmt, 1, "input");
+ if (ret < 0)
+ return ret;
+ current_buffer = &input_buffer;
+
+ if (avr->upmix_needed && !avr->in_convert_needed && !avr->resample_needed &&
+ !avr->out_convert_needed && direct_output && out_samples >= in_samples) {
+ /* in some rare cases we can copy input to output and upmix
+ directly in the output buffer */
+ av_dlog(avr, "[copy] %s to output\n", current_buffer->name);
+ ret = ff_audio_data_copy(&output_buffer, current_buffer);
+ if (ret < 0)
+ return ret;
+ current_buffer = &output_buffer;
+ } else if (avr->mixing_needed || avr->in_convert_needed) {
+ /* if needed, copy or convert input to in_buffer, and downmix if
+ applicable */
+ if (avr->in_convert_needed) {
+ ret = ff_audio_data_realloc(avr->in_buffer,
+ current_buffer->nb_samples);
+ if (ret < 0)
+ return ret;
+ av_dlog(avr, "[convert] %s to in_buffer\n", current_buffer->name);
+ ret = ff_audio_convert(avr->ac_in, avr->in_buffer,
+ current_buffer);
+ if (ret < 0)
+ return ret;
+ } else {
+ av_dlog(avr, "[copy] %s to in_buffer\n", current_buffer->name);
+ ret = ff_audio_data_copy(avr->in_buffer, current_buffer);
+ if (ret < 0)
+ return ret;
+ }
+ ff_audio_data_set_channels(avr->in_buffer, avr->in_channels);
+ if (avr->downmix_needed) {
+ av_dlog(avr, "[downmix] in_buffer\n");
+ ret = ff_audio_mix(avr->am, avr->in_buffer);
+ if (ret < 0)
+ return ret;
+ }
+ current_buffer = avr->in_buffer;
+ }
+ } else {
+ /* flush resampling buffer and/or output FIFO if input is NULL */
+ if (!avr->resample_needed)
+ return handle_buffered_output(avr, output ? &output_buffer : NULL,
+ NULL);
+ current_buffer = NULL;
+ }
+
+ if (avr->resample_needed) {
+ AudioData *resample_out;
+
+ if (!avr->out_convert_needed && direct_output && out_samples > 0)
+ resample_out = &output_buffer;
+ else
+ resample_out = avr->resample_out_buffer;
+ av_dlog(avr, "[resample] %s to %s\n", current_buffer->name,
+ resample_out->name);
+ ret = ff_audio_resample(avr->resample, resample_out,
+ current_buffer);
+ if (ret < 0)
+ return ret;
+
+ /* if resampling did not produce any samples, just return 0 */
+ if (resample_out->nb_samples == 0) {
+ av_dlog(avr, "[end conversion]\n");
+ return 0;
+ }
+
+ current_buffer = resample_out;
+ }
+
+ if (avr->upmix_needed) {
+ av_dlog(avr, "[upmix] %s\n", current_buffer->name);
+ ret = ff_audio_mix(avr->am, current_buffer);
+ if (ret < 0)
+ return ret;
+ }
+
+ /* if we resampled or upmixed directly to output, return here */
+ if (current_buffer == &output_buffer) {
+ av_dlog(avr, "[end conversion]\n");
+ return current_buffer->nb_samples;
+ }
+
+ if (avr->out_convert_needed) {
+ if (direct_output && out_samples >= current_buffer->nb_samples) {
+ /* convert directly to output */
+ av_dlog(avr, "[convert] %s to output\n", current_buffer->name);
+ ret = ff_audio_convert(avr->ac_out, &output_buffer, current_buffer);
+ if (ret < 0)
+ return ret;
+
+ av_dlog(avr, "[end conversion]\n");
+ return output_buffer.nb_samples;
+ } else {
+ ret = ff_audio_data_realloc(avr->out_buffer,
+ current_buffer->nb_samples);
+ if (ret < 0)
+ return ret;
+ av_dlog(avr, "[convert] %s to out_buffer\n", current_buffer->name);
+ ret = ff_audio_convert(avr->ac_out, avr->out_buffer,
+ current_buffer);
+ if (ret < 0)
+ return ret;
+ current_buffer = avr->out_buffer;
+ }
+ }
+
+ return handle_buffered_output(avr, output ? &output_buffer : NULL,
+ current_buffer);
+}
+
+int avresample_get_matrix(AVAudioResampleContext *avr, double *matrix,
+ int stride)
+{
+ int in_channels, out_channels, i, o;
+
+ if (avr->am)
+ return ff_audio_mix_get_matrix(avr->am, matrix, stride);
+
+ in_channels = av_get_channel_layout_nb_channels(avr->in_channel_layout);
+ out_channels = av_get_channel_layout_nb_channels(avr->out_channel_layout);
+
+ if ( in_channels <= 0 || in_channels > AVRESAMPLE_MAX_CHANNELS ||
+ out_channels <= 0 || out_channels > AVRESAMPLE_MAX_CHANNELS) {
+ av_log(avr, AV_LOG_ERROR, "Invalid channel layouts\n");
+ return AVERROR(EINVAL);
+ }
+
+ if (!avr->mix_matrix) {
+ av_log(avr, AV_LOG_ERROR, "matrix is not set\n");
+ return AVERROR(EINVAL);
+ }
+
+ for (o = 0; o < out_channels; o++)
+ for (i = 0; i < in_channels; i++)
+ matrix[o * stride + i] = avr->mix_matrix[o * in_channels + i];
+
+ return 0;
+}
+
+int avresample_set_matrix(AVAudioResampleContext *avr, const double *matrix,
+ int stride)
+{
+ int in_channels, out_channels, i, o;
+
+ if (avr->am)
+ return ff_audio_mix_set_matrix(avr->am, matrix, stride);
+
+ in_channels = av_get_channel_layout_nb_channels(avr->in_channel_layout);
+ out_channels = av_get_channel_layout_nb_channels(avr->out_channel_layout);
+
+ if ( in_channels <= 0 || in_channels > AVRESAMPLE_MAX_CHANNELS ||
+ out_channels <= 0 || out_channels > AVRESAMPLE_MAX_CHANNELS) {
+ av_log(avr, AV_LOG_ERROR, "Invalid channel layouts\n");
+ return AVERROR(EINVAL);
+ }
+
+ if (avr->mix_matrix)
+ av_freep(&avr->mix_matrix);
+ avr->mix_matrix = av_malloc(in_channels * out_channels *
+ sizeof(*avr->mix_matrix));
+ if (!avr->mix_matrix)
+ return AVERROR(ENOMEM);
+
+ for (o = 0; o < out_channels; o++)
+ for (i = 0; i < in_channels; i++)
+ avr->mix_matrix[o * in_channels + i] = matrix[o * stride + i];
+
+ return 0;
+}
+
+int avresample_available(AVAudioResampleContext *avr)
+{
+ return av_audio_fifo_size(avr->out_fifo);
+}
+
+int avresample_read(AVAudioResampleContext *avr, uint8_t **output, int nb_samples)
+{
+ if (!output)
+ return av_audio_fifo_drain(avr->out_fifo, nb_samples);
+ return av_audio_fifo_read(avr->out_fifo, (void**)output, nb_samples);
+}
+
+unsigned avresample_version(void)
+{
+ return LIBAVRESAMPLE_VERSION_INT;
+}
+
+const char *avresample_license(void)
+{
+#define LICENSE_PREFIX "libavresample license: "
+ return LICENSE_PREFIX LIBAV_LICENSE + sizeof(LICENSE_PREFIX) - 1;
+}
+
+const char *avresample_configuration(void)
+{
+ return LIBAV_CONFIGURATION;
+}
diff --git a/gst-libs/ext/libav/libavresample/version.h b/gst-libs/ext/libav/libavresample/version.h
new file mode 100644
index 0000000..ebcd07f
--- /dev/null
+++ b/gst-libs/ext/libav/libavresample/version.h
@@ -0,0 +1,46 @@
+/*
+ * 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
+ */
+
+#ifndef AVRESAMPLE_VERSION_H
+#define AVRESAMPLE_VERSION_H
+
+#define LIBAVRESAMPLE_VERSION_MAJOR 1
+#define LIBAVRESAMPLE_VERSION_MINOR 0
+#define LIBAVRESAMPLE_VERSION_MICRO 1
+
+#define LIBAVRESAMPLE_VERSION_INT AV_VERSION_INT(LIBAVRESAMPLE_VERSION_MAJOR, \
+ LIBAVRESAMPLE_VERSION_MINOR, \
+ LIBAVRESAMPLE_VERSION_MICRO)
+#define LIBAVRESAMPLE_VERSION AV_VERSION(LIBAVRESAMPLE_VERSION_MAJOR, \
+ LIBAVRESAMPLE_VERSION_MINOR, \
+ LIBAVRESAMPLE_VERSION_MICRO)
+#define LIBAVRESAMPLE_BUILD LIBAVRESAMPLE_VERSION_INT
+
+#define LIBAVRESAMPLE_IDENT "Lavr" AV_STRINGIFY(LIBAVRESAMPLE_VERSION)
+
+/**
+ * FF_API_* defines may be placed below to indicate public API that will be
+ * dropped at a future version bump. The defines themselves are not part of
+ * the public API and may change, break or disappear at any time.
+ */
+
+#ifndef FF_API_RESAMPLE_CLOSE_OPEN
+#define FF_API_RESAMPLE_CLOSE_OPEN (LIBAVRESAMPLE_VERSION_MAJOR < 2)
+#endif
+
+#endif /* AVRESAMPLE_VERSION_H */
diff --git a/gst-libs/ext/libav/libavresample/x86/Makefile b/gst-libs/ext/libav/libavresample/x86/Makefile
new file mode 100644
index 0000000..65bed89
--- /dev/null
+++ b/gst-libs/ext/libav/libavresample/x86/Makefile
@@ -0,0 +1,5 @@
+OBJS += x86/audio_convert_init.o \
+ x86/audio_mix_init.o \
+
+YASM-OBJS += x86/audio_convert.o \
+ x86/audio_mix.o \
diff --git a/gst-libs/ext/libav/libavresample/x86/audio_convert.asm b/gst-libs/ext/libav/libavresample/x86/audio_convert.asm
new file mode 100644
index 0000000..1af1429
--- /dev/null
+++ b/gst-libs/ext/libav/libavresample/x86/audio_convert.asm
@@ -0,0 +1,1227 @@
+;******************************************************************************
+;* x86 optimized Format Conversion Utils
+;* Copyright (c) 2008 Loren Merritt
+;* Copyright (c) 2012 Justin Ruggles <justin.ruggles@gmail.com>
+;*
+;* 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
+;******************************************************************************
+
+%include "libavutil/x86/x86util.asm"
+%include "util.asm"
+
+SECTION_RODATA 32
+
+pf_s32_inv_scale: times 8 dd 0x30000000
+pf_s32_scale: times 8 dd 0x4f000000
+pf_s32_clip: times 8 dd 0x4effffff
+pf_s16_inv_scale: times 4 dd 0x38000000
+pf_s16_scale: times 4 dd 0x47000000
+pb_shuf_unpack_even: db -1, -1, 0, 1, -1, -1, 2, 3, -1, -1, 8, 9, -1, -1, 10, 11
+pb_shuf_unpack_odd: db -1, -1, 4, 5, -1, -1, 6, 7, -1, -1, 12, 13, -1, -1, 14, 15
+pb_interleave_words: SHUFFLE_MASK_W 0, 4, 1, 5, 2, 6, 3, 7
+pb_deinterleave_words: SHUFFLE_MASK_W 0, 2, 4, 6, 1, 3, 5, 7
+pw_zero_even: times 4 dw 0x0000, 0xffff
+
+SECTION_TEXT
+
+;------------------------------------------------------------------------------
+; void ff_conv_s16_to_s32(int32_t *dst, const int16_t *src, int len);
+;------------------------------------------------------------------------------
+
+INIT_XMM sse2
+cglobal conv_s16_to_s32, 3,3,3, dst, src, len
+ lea lenq, [2*lend]
+ lea dstq, [dstq+2*lenq]
+ add srcq, lenq
+ neg lenq
+.loop:
+ mova m2, [srcq+lenq]
+ pxor m0, m0
+ pxor m1, m1
+ punpcklwd m0, m2
+ punpckhwd m1, m2
+ mova [dstq+2*lenq ], m0
+ mova [dstq+2*lenq+mmsize], m1
+ add lenq, mmsize
+ jl .loop
+ REP_RET
+
+;------------------------------------------------------------------------------
+; void ff_conv_s16_to_flt(float *dst, const int16_t *src, int len);
+;------------------------------------------------------------------------------
+
+%macro CONV_S16_TO_FLT 0
+cglobal conv_s16_to_flt, 3,3,3, dst, src, len
+ lea lenq, [2*lend]
+ add srcq, lenq
+ lea dstq, [dstq + 2*lenq]
+ neg lenq
+ mova m2, [pf_s16_inv_scale]
+ ALIGN 16
+.loop:
+ mova m0, [srcq+lenq]
+ S16_TO_S32_SX 0, 1
+ cvtdq2ps m0, m0
+ cvtdq2ps m1, m1
+ mulps m0, m2
+ mulps m1, m2
+ mova [dstq+2*lenq ], m0
+ mova [dstq+2*lenq+mmsize], m1
+ add lenq, mmsize
+ jl .loop
+ REP_RET
+%endmacro
+
+INIT_XMM sse2
+CONV_S16_TO_FLT
+INIT_XMM sse4
+CONV_S16_TO_FLT
+
+;------------------------------------------------------------------------------
+; void ff_conv_s32_to_s16(int16_t *dst, const int32_t *src, int len);
+;------------------------------------------------------------------------------
+
+%macro CONV_S32_TO_S16 0
+cglobal conv_s32_to_s16, 3,3,4, dst, src, len
+ lea lenq, [2*lend]
+ lea srcq, [srcq+2*lenq]
+ add dstq, lenq
+ neg lenq
+.loop:
+ mova m0, [srcq+2*lenq ]
+ mova m1, [srcq+2*lenq+ mmsize]
+ mova m2, [srcq+2*lenq+2*mmsize]
+ mova m3, [srcq+2*lenq+3*mmsize]
+ psrad m0, 16
+ psrad m1, 16
+ psrad m2, 16
+ psrad m3, 16
+ packssdw m0, m1
+ packssdw m2, m3
+ mova [dstq+lenq ], m0
+ mova [dstq+lenq+mmsize], m2
+ add lenq, mmsize*2
+ jl .loop
+%if mmsize == 8
+ emms
+ RET
+%else
+ REP_RET
+%endif
+%endmacro
+
+INIT_MMX mmx
+CONV_S32_TO_S16
+INIT_XMM sse2
+CONV_S32_TO_S16
+
+;------------------------------------------------------------------------------
+; void ff_conv_s32_to_flt(float *dst, const int32_t *src, int len);
+;------------------------------------------------------------------------------
+
+%macro CONV_S32_TO_FLT 0
+cglobal conv_s32_to_flt, 3,3,3, dst, src, len
+ lea lenq, [4*lend]
+ add srcq, lenq
+ add dstq, lenq
+ neg lenq
+ mova m0, [pf_s32_inv_scale]
+ ALIGN 16
+.loop:
+ cvtdq2ps m1, [srcq+lenq ]
+ cvtdq2ps m2, [srcq+lenq+mmsize]
+ mulps m1, m1, m0
+ mulps m2, m2, m0
+ mova [dstq+lenq ], m1
+ mova [dstq+lenq+mmsize], m2
+ add lenq, mmsize*2
+ jl .loop
+ REP_RET
+%endmacro
+
+INIT_XMM sse2
+CONV_S32_TO_FLT
+INIT_YMM avx
+CONV_S32_TO_FLT
+
+;------------------------------------------------------------------------------
+; void ff_conv_flt_to_s16(int16_t *dst, const float *src, int len);
+;------------------------------------------------------------------------------
+
+INIT_XMM sse2
+cglobal conv_flt_to_s16, 3,3,5, dst, src, len
+ lea lenq, [2*lend]
+ lea srcq, [srcq+2*lenq]
+ add dstq, lenq
+ neg lenq
+ mova m4, [pf_s16_scale]
+.loop:
+ mova m0, [srcq+2*lenq ]
+ mova m1, [srcq+2*lenq+1*mmsize]
+ mova m2, [srcq+2*lenq+2*mmsize]
+ mova m3, [srcq+2*lenq+3*mmsize]
+ mulps m0, m4
+ mulps m1, m4
+ mulps m2, m4
+ mulps m3, m4
+ cvtps2dq m0, m0
+ cvtps2dq m1, m1
+ cvtps2dq m2, m2
+ cvtps2dq m3, m3
+ packssdw m0, m1
+ packssdw m2, m3
+ mova [dstq+lenq ], m0
+ mova [dstq+lenq+mmsize], m2
+ add lenq, mmsize*2
+ jl .loop
+ REP_RET
+
+;------------------------------------------------------------------------------
+; void ff_conv_flt_to_s32(int32_t *dst, const float *src, int len);
+;------------------------------------------------------------------------------
+
+%macro CONV_FLT_TO_S32 0
+cglobal conv_flt_to_s32, 3,3,6, dst, src, len
+ lea lenq, [lend*4]
+ add srcq, lenq
+ add dstq, lenq
+ neg lenq
+ mova m4, [pf_s32_scale]
+ mova m5, [pf_s32_clip]
+.loop:
+ mulps m0, m4, [srcq+lenq ]
+ mulps m1, m4, [srcq+lenq+1*mmsize]
+ mulps m2, m4, [srcq+lenq+2*mmsize]
+ mulps m3, m4, [srcq+lenq+3*mmsize]
+ minps m0, m0, m5
+ minps m1, m1, m5
+ minps m2, m2, m5
+ minps m3, m3, m5
+ cvtps2dq m0, m0
+ cvtps2dq m1, m1
+ cvtps2dq m2, m2
+ cvtps2dq m3, m3
+ mova [dstq+lenq ], m0
+ mova [dstq+lenq+1*mmsize], m1
+ mova [dstq+lenq+2*mmsize], m2
+ mova [dstq+lenq+3*mmsize], m3
+ add lenq, mmsize*4
+ jl .loop
+ REP_RET
+%endmacro
+
+INIT_XMM sse2
+CONV_FLT_TO_S32
+INIT_YMM avx
+CONV_FLT_TO_S32
+
+;------------------------------------------------------------------------------
+; void ff_conv_s16p_to_s16_2ch(int16_t *dst, int16_t *const *src, int len,
+; int channels);
+;------------------------------------------------------------------------------
+
+%macro CONV_S16P_TO_S16_2CH 0
+cglobal conv_s16p_to_s16_2ch, 3,4,5, dst, src0, len, src1
+ mov src1q, [src0q+gprsize]
+ mov src0q, [src0q ]
+ lea lenq, [2*lend]
+ add src0q, lenq
+ add src1q, lenq
+ lea dstq, [dstq+2*lenq]
+ neg lenq
+.loop:
+ mova m0, [src0q+lenq ]
+ mova m1, [src1q+lenq ]
+ mova m2, [src0q+lenq+mmsize]
+ mova m3, [src1q+lenq+mmsize]
+ SBUTTERFLY2 wd, 0, 1, 4
+ SBUTTERFLY2 wd, 2, 3, 4
+ mova [dstq+2*lenq+0*mmsize], m0
+ mova [dstq+2*lenq+1*mmsize], m1
+ mova [dstq+2*lenq+2*mmsize], m2
+ mova [dstq+2*lenq+3*mmsize], m3
+ add lenq, 2*mmsize
+ jl .loop
+ REP_RET
+%endmacro
+
+INIT_XMM sse2
+CONV_S16P_TO_S16_2CH
+INIT_XMM avx
+CONV_S16P_TO_S16_2CH
+
+;------------------------------------------------------------------------------
+; void ff_conv_s16p_to_s16_6ch(int16_t *dst, int16_t *const *src, int len,
+; int channels);
+;------------------------------------------------------------------------------
+
+;------------------------------------------------------------------------------
+; NOTE: In the 6-channel functions, len could be used as an index on x86-64
+; instead of just a counter, which would avoid incrementing the
+; pointers, but the extra complexity and amount of code is not worth
+; the small gain. On x86-32 there are not enough registers to use len
+; as an index without keeping two of the pointers on the stack and
+; loading them in each iteration.
+;------------------------------------------------------------------------------
+
+%macro CONV_S16P_TO_S16_6CH 0
+%if ARCH_X86_64
+cglobal conv_s16p_to_s16_6ch, 3,8,7, dst, src0, len, src1, src2, src3, src4, src5
+%else
+cglobal conv_s16p_to_s16_6ch, 2,7,7, dst, src0, src1, src2, src3, src4, src5
+%define lend dword r2m
+%endif
+ mov src1q, [src0q+1*gprsize]
+ mov src2q, [src0q+2*gprsize]
+ mov src3q, [src0q+3*gprsize]
+ mov src4q, [src0q+4*gprsize]
+ mov src5q, [src0q+5*gprsize]
+ mov src0q, [src0q]
+ sub src1q, src0q
+ sub src2q, src0q
+ sub src3q, src0q
+ sub src4q, src0q
+ sub src5q, src0q
+.loop:
+%if cpuflag(sse2slow)
+ movq m0, [src0q ] ; m0 = 0, 6, 12, 18, x, x, x, x
+ movq m1, [src0q+src1q] ; m1 = 1, 7, 13, 19, x, x, x, x
+ movq m2, [src0q+src2q] ; m2 = 2, 8, 14, 20, x, x, x, x
+ movq m3, [src0q+src3q] ; m3 = 3, 9, 15, 21, x, x, x, x
+ movq m4, [src0q+src4q] ; m4 = 4, 10, 16, 22, x, x, x, x
+ movq m5, [src0q+src5q] ; m5 = 5, 11, 17, 23, x, x, x, x
+ ; unpack words:
+ punpcklwd m0, m1 ; m0 = 0, 1, 6, 7, 12, 13, 18, 19
+ punpcklwd m2, m3 ; m2 = 4, 5, 10, 11, 16, 17, 22, 23
+ punpcklwd m4, m5 ; m4 = 2, 3, 8, 9, 14, 15, 20, 21
+ ; blend dwords
+ shufps m1, m0, m2, q2020 ; m1 = 0, 1, 12, 13, 2, 3, 14, 15
+ shufps m0, m4, q2031 ; m0 = 6, 7, 18, 19, 4, 5, 16, 17
+ shufps m2, m4, q3131 ; m2 = 8, 9, 20, 21, 10, 11, 22, 23
+ ; shuffle dwords
+ pshufd m0, m0, q1302 ; m0 = 4, 5, 6, 7, 16, 17, 18, 19
+ pshufd m1, m1, q3120 ; m1 = 0, 1, 2, 3, 12, 13, 14, 15
+ pshufd m2, m2, q3120 ; m2 = 8, 9, 10, 11, 20, 21, 22, 23
+ movq [dstq+0*mmsize/2], m1
+ movq [dstq+1*mmsize/2], m0
+ movq [dstq+2*mmsize/2], m2
+ movhps [dstq+3*mmsize/2], m1
+ movhps [dstq+4*mmsize/2], m0
+ movhps [dstq+5*mmsize/2], m2
+ add src0q, mmsize/2
+ add dstq, mmsize*3
+ sub lend, mmsize/4
+%else
+ mova m0, [src0q ] ; m0 = 0, 6, 12, 18, 24, 30, 36, 42
+ mova m1, [src0q+src1q] ; m1 = 1, 7, 13, 19, 25, 31, 37, 43
+ mova m2, [src0q+src2q] ; m2 = 2, 8, 14, 20, 26, 32, 38, 44
+ mova m3, [src0q+src3q] ; m3 = 3, 9, 15, 21, 27, 33, 39, 45
+ mova m4, [src0q+src4q] ; m4 = 4, 10, 16, 22, 28, 34, 40, 46
+ mova m5, [src0q+src5q] ; m5 = 5, 11, 17, 23, 29, 35, 41, 47
+ ; unpack words:
+ SBUTTERFLY2 wd, 0, 1, 6 ; m0 = 0, 1, 6, 7, 12, 13, 18, 19
+ ; m1 = 24, 25, 30, 31, 36, 37, 42, 43
+ SBUTTERFLY2 wd, 2, 3, 6 ; m2 = 2, 3, 8, 9, 14, 15, 20, 21
+ ; m3 = 26, 27, 32, 33, 38, 39, 44, 45
+ SBUTTERFLY2 wd, 4, 5, 6 ; m4 = 4, 5, 10, 11, 16, 17, 22, 23
+ ; m5 = 28, 29, 34, 35, 40, 41, 46, 47
+ ; blend dwords
+ shufps m6, m0, m2, q2020 ; m6 = 0, 1, 12, 13, 2, 3, 14, 15
+ shufps m0, m4, q2031 ; m0 = 6, 7, 18, 19, 4, 5, 16, 17
+ shufps m2, m4, q3131 ; m2 = 8, 9, 20, 21, 10, 11, 22, 23
+ SWAP 4,6 ; m4 = 0, 1, 12, 13, 2, 3, 14, 15
+ shufps m6, m1, m3, q2020 ; m6 = 24, 25, 36, 37, 26, 27, 38, 39
+ shufps m1, m5, q2031 ; m1 = 30, 31, 42, 43, 28, 29, 40, 41
+ shufps m3, m5, q3131 ; m3 = 32, 33, 44, 45, 34, 35, 46, 47
+ SWAP 5,6 ; m5 = 24, 25, 36, 37, 26, 27, 38, 39
+ ; shuffle dwords
+ pshufd m0, m0, q1302 ; m0 = 4, 5, 6, 7, 16, 17, 18, 19
+ pshufd m2, m2, q3120 ; m2 = 8, 9, 10, 11, 20, 21, 22, 23
+ pshufd m4, m4, q3120 ; m4 = 0, 1, 2, 3, 12, 13, 14, 15
+ pshufd m1, m1, q1302 ; m1 = 28, 29, 30, 31, 40, 41, 42, 43
+ pshufd m3, m3, q3120 ; m3 = 32, 33, 34, 35, 44, 45, 46, 47
+ pshufd m5, m5, q3120 ; m5 = 24, 25, 26, 27, 36, 37, 38, 39
+ ; shuffle qwords
+ punpcklqdq m6, m4, m0 ; m6 = 0, 1, 2, 3, 4, 5, 6, 7
+ punpckhqdq m0, m2 ; m0 = 16, 17, 18, 19, 20, 21, 22, 23
+ shufps m2, m4, q3210 ; m2 = 8, 9, 10, 11, 12, 13, 14, 15
+ SWAP 4,6 ; m4 = 0, 1, 2, 3, 4, 5, 6, 7
+ punpcklqdq m6, m5, m1 ; m6 = 24, 25, 26, 27, 28, 29, 30, 31
+ punpckhqdq m1, m3 ; m1 = 40, 41, 42, 43, 44, 45, 46, 47
+ shufps m3, m5, q3210 ; m3 = 32, 33, 34, 35, 36, 37, 38, 39
+ SWAP 5,6 ; m5 = 24, 25, 26, 27, 28, 29, 30, 31
+ mova [dstq+0*mmsize], m4
+ mova [dstq+1*mmsize], m2
+ mova [dstq+2*mmsize], m0
+ mova [dstq+3*mmsize], m5
+ mova [dstq+4*mmsize], m3
+ mova [dstq+5*mmsize], m1
+ add src0q, mmsize
+ add dstq, mmsize*6
+ sub lend, mmsize/2
+%endif
+ jg .loop
+ REP_RET
+%endmacro
+
+INIT_XMM sse2
+CONV_S16P_TO_S16_6CH
+INIT_XMM sse2slow
+CONV_S16P_TO_S16_6CH
+INIT_XMM avx
+CONV_S16P_TO_S16_6CH
+
+;------------------------------------------------------------------------------
+; void ff_conv_s16p_to_flt_2ch(float *dst, int16_t *const *src, int len,
+; int channels);
+;------------------------------------------------------------------------------
+
+%macro CONV_S16P_TO_FLT_2CH 0
+cglobal conv_s16p_to_flt_2ch, 3,4,6, dst, src0, len, src1
+ lea lenq, [2*lend]
+ mov src1q, [src0q+gprsize]
+ mov src0q, [src0q ]
+ lea dstq, [dstq+4*lenq]
+ add src0q, lenq
+ add src1q, lenq
+ neg lenq
+ mova m5, [pf_s32_inv_scale]
+.loop:
+ mova m2, [src0q+lenq] ; m2 = 0, 2, 4, 6, 8, 10, 12, 14
+ mova m4, [src1q+lenq] ; m4 = 1, 3, 5, 7, 9, 11, 13, 15
+ SBUTTERFLY2 wd, 2, 4, 3 ; m2 = 0, 1, 2, 3, 4, 5, 6, 7
+ ; m4 = 8, 9, 10, 11, 12, 13, 14, 15
+ pxor m3, m3
+ punpcklwd m0, m3, m2 ; m0 = 0, 1, 2, 3
+ punpckhwd m1, m3, m2 ; m1 = 4, 5, 6, 7
+ punpcklwd m2, m3, m4 ; m2 = 8, 9, 10, 11
+ punpckhwd m3, m4 ; m3 = 12, 13, 14, 15
+ cvtdq2ps m0, m0
+ cvtdq2ps m1, m1
+ cvtdq2ps m2, m2
+ cvtdq2ps m3, m3
+ mulps m0, m5
+ mulps m1, m5
+ mulps m2, m5
+ mulps m3, m5
+ mova [dstq+4*lenq ], m0
+ mova [dstq+4*lenq+ mmsize], m1
+ mova [dstq+4*lenq+2*mmsize], m2
+ mova [dstq+4*lenq+3*mmsize], m3
+ add lenq, mmsize
+ jl .loop
+ REP_RET
+%endmacro
+
+INIT_XMM sse2
+CONV_S16P_TO_FLT_2CH
+INIT_XMM avx
+CONV_S16P_TO_FLT_2CH
+
+;------------------------------------------------------------------------------
+; void ff_conv_s16p_to_flt_6ch(float *dst, int16_t *const *src, int len,
+; int channels);
+;------------------------------------------------------------------------------
+
+%macro CONV_S16P_TO_FLT_6CH 0
+%if ARCH_X86_64
+cglobal conv_s16p_to_flt_6ch, 3,8,8, dst, src, len, src1, src2, src3, src4, src5
+%else
+cglobal conv_s16p_to_flt_6ch, 2,7,8, dst, src, src1, src2, src3, src4, src5
+%define lend dword r2m
+%endif
+ mov src1q, [srcq+1*gprsize]
+ mov src2q, [srcq+2*gprsize]
+ mov src3q, [srcq+3*gprsize]
+ mov src4q, [srcq+4*gprsize]
+ mov src5q, [srcq+5*gprsize]
+ mov srcq, [srcq]
+ sub src1q, srcq
+ sub src2q, srcq
+ sub src3q, srcq
+ sub src4q, srcq
+ sub src5q, srcq
+ mova m7, [pf_s32_inv_scale]
+%if cpuflag(ssse3)
+ %define unpack_even m6
+ mova m6, [pb_shuf_unpack_even]
+%if ARCH_X86_64
+ %define unpack_odd m8
+ mova m8, [pb_shuf_unpack_odd]
+%else
+ %define unpack_odd [pb_shuf_unpack_odd]
+%endif
+%endif
+.loop:
+ movq m0, [srcq ] ; m0 = 0, 6, 12, 18, x, x, x, x
+ movq m1, [srcq+src1q] ; m1 = 1, 7, 13, 19, x, x, x, x
+ movq m2, [srcq+src2q] ; m2 = 2, 8, 14, 20, x, x, x, x
+ movq m3, [srcq+src3q] ; m3 = 3, 9, 15, 21, x, x, x, x
+ movq m4, [srcq+src4q] ; m4 = 4, 10, 16, 22, x, x, x, x
+ movq m5, [srcq+src5q] ; m5 = 5, 11, 17, 23, x, x, x, x
+ ; unpack words:
+ punpcklwd m0, m1 ; m0 = 0, 1, 6, 7, 12, 13, 18, 19
+ punpcklwd m2, m3 ; m2 = 2, 3, 8, 9, 14, 15, 20, 21
+ punpcklwd m4, m5 ; m4 = 4, 5, 10, 11, 16, 17, 22, 23
+ ; blend dwords
+ shufps m1, m4, m0, q3120 ; m1 = 4, 5, 16, 17, 6, 7, 18, 19
+ shufps m0, m2, q2020 ; m0 = 0, 1, 12, 13, 2, 3, 14, 15
+ shufps m2, m4, q3131 ; m2 = 8, 9, 20, 21, 10, 11, 22, 23
+%if cpuflag(ssse3)
+ pshufb m3, m0, unpack_odd ; m3 = 12, 13, 14, 15
+ pshufb m0, unpack_even ; m0 = 0, 1, 2, 3
+ pshufb m4, m1, unpack_odd ; m4 = 16, 17, 18, 19
+ pshufb m1, unpack_even ; m1 = 4, 5, 6, 7
+ pshufb m5, m2, unpack_odd ; m5 = 20, 21, 22, 23
+ pshufb m2, unpack_even ; m2 = 8, 9, 10, 11
+%else
+ ; shuffle dwords
+ pshufd m0, m0, q3120 ; m0 = 0, 1, 2, 3, 12, 13, 14, 15
+ pshufd m1, m1, q3120 ; m1 = 4, 5, 6, 7, 16, 17, 18, 19
+ pshufd m2, m2, q3120 ; m2 = 8, 9, 10, 11, 20, 21, 22, 23
+ pxor m6, m6 ; convert s16 in m0-m2 to s32 in m0-m5
+ punpcklwd m3, m6, m0 ; m3 = 0, 1, 2, 3
+ punpckhwd m4, m6, m0 ; m4 = 12, 13, 14, 15
+ punpcklwd m0, m6, m1 ; m0 = 4, 5, 6, 7
+ punpckhwd m5, m6, m1 ; m5 = 16, 17, 18, 19
+ punpcklwd m1, m6, m2 ; m1 = 8, 9, 10, 11
+ punpckhwd m6, m2 ; m6 = 20, 21, 22, 23
+ SWAP 6,2,1,0,3,4,5 ; swap registers 3,0,1,4,5,6 to 0,1,2,3,4,5
+%endif
+ cvtdq2ps m0, m0 ; convert s32 to float
+ cvtdq2ps m1, m1
+ cvtdq2ps m2, m2
+ cvtdq2ps m3, m3
+ cvtdq2ps m4, m4
+ cvtdq2ps m5, m5
+ mulps m0, m7 ; scale float from s32 range to [-1.0,1.0]
+ mulps m1, m7
+ mulps m2, m7
+ mulps m3, m7
+ mulps m4, m7
+ mulps m5, m7
+ mova [dstq ], m0
+ mova [dstq+ mmsize], m1
+ mova [dstq+2*mmsize], m2
+ mova [dstq+3*mmsize], m3
+ mova [dstq+4*mmsize], m4
+ mova [dstq+5*mmsize], m5
+ add srcq, mmsize/2
+ add dstq, mmsize*6
+ sub lend, mmsize/4
+ jg .loop
+ REP_RET
+%endmacro
+
+INIT_XMM sse2
+CONV_S16P_TO_FLT_6CH
+INIT_XMM ssse3
+CONV_S16P_TO_FLT_6CH
+INIT_XMM avx
+CONV_S16P_TO_FLT_6CH
+
+;------------------------------------------------------------------------------
+; void ff_conv_fltp_to_s16_2ch(int16_t *dst, float *const *src, int len,
+; int channels);
+;------------------------------------------------------------------------------
+
+%macro CONV_FLTP_TO_S16_2CH 0
+cglobal conv_fltp_to_s16_2ch, 3,4,3, dst, src0, len, src1
+ lea lenq, [4*lend]
+ mov src1q, [src0q+gprsize]
+ mov src0q, [src0q ]
+ add dstq, lenq
+ add src0q, lenq
+ add src1q, lenq
+ neg lenq
+ mova m2, [pf_s16_scale]
+%if cpuflag(ssse3)
+ mova m3, [pb_interleave_words]
+%endif
+.loop:
+ mulps m0, m2, [src0q+lenq] ; m0 = 0, 2, 4, 6
+ mulps m1, m2, [src1q+lenq] ; m1 = 1, 3, 5, 7
+ cvtps2dq m0, m0
+ cvtps2dq m1, m1
+%if cpuflag(ssse3)
+ packssdw m0, m1 ; m0 = 0, 2, 4, 6, 1, 3, 5, 7
+ pshufb m0, m3 ; m0 = 0, 1, 2, 3, 4, 5, 6, 7
+%else
+ packssdw m0, m0 ; m0 = 0, 2, 4, 6, x, x, x, x
+ packssdw m1, m1 ; m1 = 1, 3, 5, 7, x, x, x, x
+ punpcklwd m0, m1 ; m0 = 0, 1, 2, 3, 4, 5, 6, 7
+%endif
+ mova [dstq+lenq], m0
+ add lenq, mmsize
+ jl .loop
+ REP_RET
+%endmacro
+
+INIT_XMM sse2
+CONV_FLTP_TO_S16_2CH
+INIT_XMM ssse3
+CONV_FLTP_TO_S16_2CH
+
+;------------------------------------------------------------------------------
+; void ff_conv_fltp_to_s16_6ch(int16_t *dst, float *const *src, int len,
+; int channels);
+;------------------------------------------------------------------------------
+
+%macro CONV_FLTP_TO_S16_6CH 0
+%if ARCH_X86_64
+cglobal conv_fltp_to_s16_6ch, 3,8,7, dst, src, len, src1, src2, src3, src4, src5
+%else
+cglobal conv_fltp_to_s16_6ch, 2,7,7, dst, src, src1, src2, src3, src4, src5
+%define lend dword r2m
+%endif
+ mov src1q, [srcq+1*gprsize]
+ mov src2q, [srcq+2*gprsize]
+ mov src3q, [srcq+3*gprsize]
+ mov src4q, [srcq+4*gprsize]
+ mov src5q, [srcq+5*gprsize]
+ mov srcq, [srcq]
+ sub src1q, srcq
+ sub src2q, srcq
+ sub src3q, srcq
+ sub src4q, srcq
+ sub src5q, srcq
+ movaps xmm6, [pf_s16_scale]
+.loop:
+%if cpuflag(sse2)
+ mulps m0, m6, [srcq ]
+ mulps m1, m6, [srcq+src1q]
+ mulps m2, m6, [srcq+src2q]
+ mulps m3, m6, [srcq+src3q]
+ mulps m4, m6, [srcq+src4q]
+ mulps m5, m6, [srcq+src5q]
+ cvtps2dq m0, m0
+ cvtps2dq m1, m1
+ cvtps2dq m2, m2
+ cvtps2dq m3, m3
+ cvtps2dq m4, m4
+ cvtps2dq m5, m5
+ packssdw m0, m3 ; m0 = 0, 6, 12, 18, 3, 9, 15, 21
+ packssdw m1, m4 ; m1 = 1, 7, 13, 19, 4, 10, 16, 22
+ packssdw m2, m5 ; m2 = 2, 8, 14, 20, 5, 11, 17, 23
+ ; unpack words:
+ movhlps m3, m0 ; m3 = 3, 9, 15, 21, x, x, x, x
+ punpcklwd m0, m1 ; m0 = 0, 1, 6, 7, 12, 13, 18, 19
+ punpckhwd m1, m2 ; m1 = 4, 5, 10, 11, 16, 17, 22, 23
+ punpcklwd m2, m3 ; m2 = 2, 3, 8, 9, 14, 15, 20, 21
+ ; blend dwords:
+ shufps m3, m0, m2, q2020 ; m3 = 0, 1, 12, 13, 2, 3, 14, 15
+ shufps m0, m1, q2031 ; m0 = 6, 7, 18, 19, 4, 5, 16, 17
+ shufps m2, m1, q3131 ; m2 = 8, 9, 20, 21, 10, 11, 22, 23
+ ; shuffle dwords:
+ shufps m1, m2, m3, q3120 ; m1 = 8, 9, 10, 11, 12, 13, 14, 15
+ shufps m3, m0, q0220 ; m3 = 0, 1, 2, 3, 4, 5, 6, 7
+ shufps m0, m2, q3113 ; m0 = 16, 17, 18, 19, 20, 21, 22, 23
+ mova [dstq+0*mmsize], m3
+ mova [dstq+1*mmsize], m1
+ mova [dstq+2*mmsize], m0
+%else ; sse
+ movlps xmm0, [srcq ]
+ movlps xmm1, [srcq+src1q]
+ movlps xmm2, [srcq+src2q]
+ movlps xmm3, [srcq+src3q]
+ movlps xmm4, [srcq+src4q]
+ movlps xmm5, [srcq+src5q]
+ mulps xmm0, xmm6
+ mulps xmm1, xmm6
+ mulps xmm2, xmm6
+ mulps xmm3, xmm6
+ mulps xmm4, xmm6
+ mulps xmm5, xmm6
+ cvtps2pi mm0, xmm0
+ cvtps2pi mm1, xmm1
+ cvtps2pi mm2, xmm2
+ cvtps2pi mm3, xmm3
+ cvtps2pi mm4, xmm4
+ cvtps2pi mm5, xmm5
+ packssdw mm0, mm3 ; m0 = 0, 6, 3, 9
+ packssdw mm1, mm4 ; m1 = 1, 7, 4, 10
+ packssdw mm2, mm5 ; m2 = 2, 8, 5, 11
+ ; unpack words
+ pshufw mm3, mm0, q1032 ; m3 = 3, 9, 0, 6
+ punpcklwd mm0, mm1 ; m0 = 0, 1, 6, 7
+ punpckhwd mm1, mm2 ; m1 = 4, 5, 10, 11
+ punpcklwd mm2, mm3 ; m2 = 2, 3, 8, 9
+ ; unpack dwords
+ pshufw mm3, mm0, q1032 ; m3 = 6, 7, 0, 1
+ punpckldq mm0, mm2 ; m0 = 0, 1, 2, 3 (final)
+ punpckhdq mm2, mm1 ; m2 = 8, 9, 10, 11 (final)
+ punpckldq mm1, mm3 ; m1 = 4, 5, 6, 7 (final)
+ mova [dstq+0*mmsize], mm0
+ mova [dstq+1*mmsize], mm1
+ mova [dstq+2*mmsize], mm2
+%endif
+ add srcq, mmsize
+ add dstq, mmsize*3
+ sub lend, mmsize/4
+ jg .loop
+%if mmsize == 8
+ emms
+ RET
+%else
+ REP_RET
+%endif
+%endmacro
+
+INIT_MMX sse
+CONV_FLTP_TO_S16_6CH
+INIT_XMM sse2
+CONV_FLTP_TO_S16_6CH
+INIT_XMM avx
+CONV_FLTP_TO_S16_6CH
+
+;------------------------------------------------------------------------------
+; void ff_conv_fltp_to_flt_2ch(float *dst, float *const *src, int len,
+; int channels);
+;------------------------------------------------------------------------------
+
+%macro CONV_FLTP_TO_FLT_2CH 0
+cglobal conv_fltp_to_flt_2ch, 3,4,5, dst, src0, len, src1
+ mov src1q, [src0q+gprsize]
+ mov src0q, [src0q]
+ lea lenq, [4*lend]
+ add src0q, lenq
+ add src1q, lenq
+ lea dstq, [dstq+2*lenq]
+ neg lenq
+.loop:
+ mova m0, [src0q+lenq ]
+ mova m1, [src1q+lenq ]
+ mova m2, [src0q+lenq+mmsize]
+ mova m3, [src1q+lenq+mmsize]
+ SBUTTERFLYPS 0, 1, 4
+ SBUTTERFLYPS 2, 3, 4
+ mova [dstq+2*lenq+0*mmsize], m0
+ mova [dstq+2*lenq+1*mmsize], m1
+ mova [dstq+2*lenq+2*mmsize], m2
+ mova [dstq+2*lenq+3*mmsize], m3
+ add lenq, 2*mmsize
+ jl .loop
+ REP_RET
+%endmacro
+
+INIT_XMM sse
+CONV_FLTP_TO_FLT_2CH
+INIT_XMM avx
+CONV_FLTP_TO_FLT_2CH
+
+;-----------------------------------------------------------------------------
+; void ff_conv_fltp_to_flt_6ch(float *dst, float *const *src, int len,
+; int channels);
+;-----------------------------------------------------------------------------
+
+%macro CONV_FLTP_TO_FLT_6CH 0
+cglobal conv_fltp_to_flt_6ch, 2,8,7, dst, src, src1, src2, src3, src4, src5, len
+%if ARCH_X86_64
+ mov lend, r2d
+%else
+ %define lend dword r2m
+%endif
+ mov src1q, [srcq+1*gprsize]
+ mov src2q, [srcq+2*gprsize]
+ mov src3q, [srcq+3*gprsize]
+ mov src4q, [srcq+4*gprsize]
+ mov src5q, [srcq+5*gprsize]
+ mov srcq, [srcq]
+ sub src1q, srcq
+ sub src2q, srcq
+ sub src3q, srcq
+ sub src4q, srcq
+ sub src5q, srcq
+.loop:
+ mova m0, [srcq ]
+ mova m1, [srcq+src1q]
+ mova m2, [srcq+src2q]
+ mova m3, [srcq+src3q]
+ mova m4, [srcq+src4q]
+ mova m5, [srcq+src5q]
+%if cpuflag(sse4)
+ SBUTTERFLYPS 0, 1, 6
+ SBUTTERFLYPS 2, 3, 6
+ SBUTTERFLYPS 4, 5, 6
+
+ blendps m6, m4, m0, 1100b
+ movlhps m0, m2
+ movhlps m4, m2
+ blendps m2, m5, m1, 1100b
+ movlhps m1, m3
+ movhlps m5, m3
+
+ movaps [dstq ], m0
+ movaps [dstq+16], m6
+ movaps [dstq+32], m4
+ movaps [dstq+48], m1
+ movaps [dstq+64], m2
+ movaps [dstq+80], m5
+%else ; mmx
+ SBUTTERFLY dq, 0, 1, 6
+ SBUTTERFLY dq, 2, 3, 6
+ SBUTTERFLY dq, 4, 5, 6
+
+ movq [dstq ], m0
+ movq [dstq+ 8], m2
+ movq [dstq+16], m4
+ movq [dstq+24], m1
+ movq [dstq+32], m3
+ movq [dstq+40], m5
+%endif
+ add srcq, mmsize
+ add dstq, mmsize*6
+ sub lend, mmsize/4
+ jg .loop
+%if mmsize == 8
+ emms
+ RET
+%else
+ REP_RET
+%endif
+%endmacro
+
+INIT_MMX mmx
+CONV_FLTP_TO_FLT_6CH
+INIT_XMM sse4
+CONV_FLTP_TO_FLT_6CH
+INIT_XMM avx
+CONV_FLTP_TO_FLT_6CH
+
+;------------------------------------------------------------------------------
+; void ff_conv_s16_to_s16p_2ch(int16_t *const *dst, int16_t *src, int len,
+; int channels);
+;------------------------------------------------------------------------------
+
+%macro CONV_S16_TO_S16P_2CH 0
+cglobal conv_s16_to_s16p_2ch, 3,4,4, dst0, src, len, dst1
+ lea lenq, [2*lend]
+ mov dst1q, [dst0q+gprsize]
+ mov dst0q, [dst0q ]
+ lea srcq, [srcq+2*lenq]
+ add dst0q, lenq
+ add dst1q, lenq
+ neg lenq
+%if cpuflag(ssse3)
+ mova m3, [pb_deinterleave_words]
+%endif
+.loop:
+ mova m0, [srcq+2*lenq ] ; m0 = 0, 1, 2, 3, 4, 5, 6, 7
+ mova m1, [srcq+2*lenq+mmsize] ; m1 = 8, 9, 10, 11, 12, 13, 14, 15
+%if cpuflag(ssse3)
+ pshufb m0, m3 ; m0 = 0, 2, 4, 6, 1, 3, 5, 7
+ pshufb m1, m3 ; m1 = 8, 10, 12, 14, 9, 11, 13, 15
+ SBUTTERFLY2 qdq, 0, 1, 2 ; m0 = 0, 2, 4, 6, 8, 10, 12, 14
+ ; m1 = 1, 3, 5, 7, 9, 11, 13, 15
+%else ; sse2
+ pshuflw m0, m0, q3120 ; m0 = 0, 2, 1, 3, 4, 5, 6, 7
+ pshufhw m0, m0, q3120 ; m0 = 0, 2, 1, 3, 4, 6, 5, 7
+ pshuflw m1, m1, q3120 ; m1 = 8, 10, 9, 11, 12, 13, 14, 15
+ pshufhw m1, m1, q3120 ; m1 = 8, 10, 9, 11, 12, 14, 13, 15
+ DEINT2_PS 0, 1, 2 ; m0 = 0, 2, 4, 6, 8, 10, 12, 14
+ ; m1 = 1, 3, 5, 7, 9, 11, 13, 15
+%endif
+ mova [dst0q+lenq], m0
+ mova [dst1q+lenq], m1
+ add lenq, mmsize
+ jl .loop
+ REP_RET
+%endmacro
+
+INIT_XMM sse2
+CONV_S16_TO_S16P_2CH
+INIT_XMM ssse3
+CONV_S16_TO_S16P_2CH
+INIT_XMM avx
+CONV_S16_TO_S16P_2CH
+
+;------------------------------------------------------------------------------
+; void ff_conv_s16_to_s16p_6ch(int16_t *const *dst, int16_t *src, int len,
+; int channels);
+;------------------------------------------------------------------------------
+
+%macro CONV_S16_TO_S16P_6CH 0
+%if ARCH_X86_64
+cglobal conv_s16_to_s16p_6ch, 3,8,5, dst, src, len, dst1, dst2, dst3, dst4, dst5
+%else
+cglobal conv_s16_to_s16p_6ch, 2,7,5, dst, src, dst1, dst2, dst3, dst4, dst5
+%define lend dword r2m
+%endif
+ mov dst1q, [dstq+ gprsize]
+ mov dst2q, [dstq+2*gprsize]
+ mov dst3q, [dstq+3*gprsize]
+ mov dst4q, [dstq+4*gprsize]
+ mov dst5q, [dstq+5*gprsize]
+ mov dstq, [dstq ]
+ sub dst1q, dstq
+ sub dst2q, dstq
+ sub dst3q, dstq
+ sub dst4q, dstq
+ sub dst5q, dstq
+.loop:
+ mova m0, [srcq+0*mmsize] ; m0 = 0, 1, 2, 3, 4, 5, 6, 7
+ mova m3, [srcq+1*mmsize] ; m3 = 8, 9, 10, 11, 12, 13, 14, 15
+ mova m2, [srcq+2*mmsize] ; m2 = 16, 17, 18, 19, 20, 21, 22, 23
+ PALIGNR m1, m3, m0, 12, m4 ; m1 = 6, 7, 8, 9, 10, 11, x, x
+ shufps m3, m2, q1032 ; m3 = 12, 13, 14, 15, 16, 17, 18, 19
+ psrldq m2, 4 ; m2 = 18, 19, 20, 21, 22, 23, x, x
+ SBUTTERFLY2 wd, 0, 1, 4 ; m0 = 0, 6, 1, 7, 2, 8, 3, 9
+ ; m1 = 4, 10, 5, 11, x, x, x, x
+ SBUTTERFLY2 wd, 3, 2, 4 ; m3 = 12, 18, 13, 19, 14, 20, 15, 21
+ ; m2 = 16, 22, 17, 23, x, x, x, x
+ SBUTTERFLY2 dq, 0, 3, 4 ; m0 = 0, 6, 12, 18, 1, 7, 13, 19
+ ; m3 = 2, 8, 14, 20, 3, 9, 15, 21
+ punpckldq m1, m2 ; m1 = 4, 10, 16, 22, 5, 11, 17, 23
+ movq [dstq ], m0
+ movhps [dstq+dst1q], m0
+ movq [dstq+dst2q], m3
+ movhps [dstq+dst3q], m3
+ movq [dstq+dst4q], m1
+ movhps [dstq+dst5q], m1
+ add srcq, mmsize*3
+ add dstq, mmsize/2
+ sub lend, mmsize/4
+ jg .loop
+ REP_RET
+%endmacro
+
+INIT_XMM sse2
+CONV_S16_TO_S16P_6CH
+INIT_XMM ssse3
+CONV_S16_TO_S16P_6CH
+INIT_XMM avx
+CONV_S16_TO_S16P_6CH
+
+;------------------------------------------------------------------------------
+; void ff_conv_s16_to_fltp_2ch(float *const *dst, int16_t *src, int len,
+; int channels);
+;------------------------------------------------------------------------------
+
+%macro CONV_S16_TO_FLTP_2CH 0
+cglobal conv_s16_to_fltp_2ch, 3,4,5, dst0, src, len, dst1
+ lea lenq, [4*lend]
+ mov dst1q, [dst0q+gprsize]
+ mov dst0q, [dst0q ]
+ add srcq, lenq
+ add dst0q, lenq
+ add dst1q, lenq
+ neg lenq
+ mova m3, [pf_s32_inv_scale]
+ mova m4, [pw_zero_even]
+.loop:
+ mova m1, [srcq+lenq]
+ pslld m0, m1, 16
+ pand m1, m4
+ cvtdq2ps m0, m0
+ cvtdq2ps m1, m1
+ mulps m0, m0, m3
+ mulps m1, m1, m3
+ mova [dst0q+lenq], m0
+ mova [dst1q+lenq], m1
+ add lenq, mmsize
+ jl .loop
+ REP_RET
+%endmacro
+
+INIT_XMM sse2
+CONV_S16_TO_FLTP_2CH
+INIT_XMM avx
+CONV_S16_TO_FLTP_2CH
+
+;------------------------------------------------------------------------------
+; void ff_conv_s16_to_fltp_6ch(float *const *dst, int16_t *src, int len,
+; int channels);
+;------------------------------------------------------------------------------
+
+%macro CONV_S16_TO_FLTP_6CH 0
+%if ARCH_X86_64
+cglobal conv_s16_to_fltp_6ch, 3,8,7, dst, src, len, dst1, dst2, dst3, dst4, dst5
+%else
+cglobal conv_s16_to_fltp_6ch, 2,7,7, dst, src, dst1, dst2, dst3, dst4, dst5
+%define lend dword r2m
+%endif
+ mov dst1q, [dstq+ gprsize]
+ mov dst2q, [dstq+2*gprsize]
+ mov dst3q, [dstq+3*gprsize]
+ mov dst4q, [dstq+4*gprsize]
+ mov dst5q, [dstq+5*gprsize]
+ mov dstq, [dstq ]
+ sub dst1q, dstq
+ sub dst2q, dstq
+ sub dst3q, dstq
+ sub dst4q, dstq
+ sub dst5q, dstq
+ mova m6, [pf_s16_inv_scale]
+.loop:
+ mova m0, [srcq+0*mmsize] ; m0 = 0, 1, 2, 3, 4, 5, 6, 7
+ mova m3, [srcq+1*mmsize] ; m3 = 8, 9, 10, 11, 12, 13, 14, 15
+ mova m2, [srcq+2*mmsize] ; m2 = 16, 17, 18, 19, 20, 21, 22, 23
+ PALIGNR m1, m3, m0, 12, m4 ; m1 = 6, 7, 8, 9, 10, 11, x, x
+ shufps m3, m2, q1032 ; m3 = 12, 13, 14, 15, 16, 17, 18, 19
+ psrldq m2, 4 ; m2 = 18, 19, 20, 21, 22, 23, x, x
+ SBUTTERFLY2 wd, 0, 1, 4 ; m0 = 0, 6, 1, 7, 2, 8, 3, 9
+ ; m1 = 4, 10, 5, 11, x, x, x, x
+ SBUTTERFLY2 wd, 3, 2, 4 ; m3 = 12, 18, 13, 19, 14, 20, 15, 21
+ ; m2 = 16, 22, 17, 23, x, x, x, x
+ SBUTTERFLY2 dq, 0, 3, 4 ; m0 = 0, 6, 12, 18, 1, 7, 13, 19
+ ; m3 = 2, 8, 14, 20, 3, 9, 15, 21
+ punpckldq m1, m2 ; m1 = 4, 10, 16, 22, 5, 11, 17, 23
+ S16_TO_S32_SX 0, 2 ; m0 = 0, 6, 12, 18
+ ; m2 = 1, 7, 13, 19
+ S16_TO_S32_SX 3, 4 ; m3 = 2, 8, 14, 20
+ ; m4 = 3, 9, 15, 21
+ S16_TO_S32_SX 1, 5 ; m1 = 4, 10, 16, 22
+ ; m5 = 5, 11, 17, 23
+ SWAP 1,2,3,4
+ cvtdq2ps m0, m0
+ cvtdq2ps m1, m1
+ cvtdq2ps m2, m2
+ cvtdq2ps m3, m3
+ cvtdq2ps m4, m4
+ cvtdq2ps m5, m5
+ mulps m0, m6
+ mulps m1, m6
+ mulps m2, m6
+ mulps m3, m6
+ mulps m4, m6
+ mulps m5, m6
+ mova [dstq ], m0
+ mova [dstq+dst1q], m1
+ mova [dstq+dst2q], m2
+ mova [dstq+dst3q], m3
+ mova [dstq+dst4q], m4
+ mova [dstq+dst5q], m5
+ add srcq, mmsize*3
+ add dstq, mmsize
+ sub lend, mmsize/4
+ jg .loop
+ REP_RET
+%endmacro
+
+INIT_XMM sse2
+CONV_S16_TO_FLTP_6CH
+INIT_XMM ssse3
+CONV_S16_TO_FLTP_6CH
+INIT_XMM sse4
+CONV_S16_TO_FLTP_6CH
+INIT_XMM avx
+CONV_S16_TO_FLTP_6CH
+
+;------------------------------------------------------------------------------
+; void ff_conv_flt_to_s16p_2ch(int16_t *const *dst, float *src, int len,
+; int channels);
+;------------------------------------------------------------------------------
+
+%macro CONV_FLT_TO_S16P_2CH 0
+cglobal conv_flt_to_s16p_2ch, 3,4,6, dst0, src, len, dst1
+ lea lenq, [2*lend]
+ mov dst1q, [dst0q+gprsize]
+ mov dst0q, [dst0q ]
+ lea srcq, [srcq+4*lenq]
+ add dst0q, lenq
+ add dst1q, lenq
+ neg lenq
+ mova m5, [pf_s16_scale]
+.loop:
+ mova m0, [srcq+4*lenq ]
+ mova m1, [srcq+4*lenq+ mmsize]
+ mova m2, [srcq+4*lenq+2*mmsize]
+ mova m3, [srcq+4*lenq+3*mmsize]
+ DEINT2_PS 0, 1, 4
+ DEINT2_PS 2, 3, 4
+ mulps m0, m0, m5
+ mulps m1, m1, m5
+ mulps m2, m2, m5
+ mulps m3, m3, m5
+ cvtps2dq m0, m0
+ cvtps2dq m1, m1
+ cvtps2dq m2, m2
+ cvtps2dq m3, m3
+ packssdw m0, m2
+ packssdw m1, m3
+ mova [dst0q+lenq], m0
+ mova [dst1q+lenq], m1
+ add lenq, mmsize
+ jl .loop
+ REP_RET
+%endmacro
+
+INIT_XMM sse2
+CONV_FLT_TO_S16P_2CH
+INIT_XMM avx
+CONV_FLT_TO_S16P_2CH
+
+;------------------------------------------------------------------------------
+; void ff_conv_flt_to_s16p_6ch(int16_t *const *dst, float *src, int len,
+; int channels);
+;------------------------------------------------------------------------------
+
+%macro CONV_FLT_TO_S16P_6CH 0
+%if ARCH_X86_64
+cglobal conv_flt_to_s16p_6ch, 3,8,7, dst, src, len, dst1, dst2, dst3, dst4, dst5
+%else
+cglobal conv_flt_to_s16p_6ch, 2,7,7, dst, src, dst1, dst2, dst3, dst4, dst5
+%define lend dword r2m
+%endif
+ mov dst1q, [dstq+ gprsize]
+ mov dst2q, [dstq+2*gprsize]
+ mov dst3q, [dstq+3*gprsize]
+ mov dst4q, [dstq+4*gprsize]
+ mov dst5q, [dstq+5*gprsize]
+ mov dstq, [dstq ]
+ sub dst1q, dstq
+ sub dst2q, dstq
+ sub dst3q, dstq
+ sub dst4q, dstq
+ sub dst5q, dstq
+ mova m6, [pf_s16_scale]
+.loop:
+ mulps m0, m6, [srcq+0*mmsize]
+ mulps m3, m6, [srcq+1*mmsize]
+ mulps m1, m6, [srcq+2*mmsize]
+ mulps m4, m6, [srcq+3*mmsize]
+ mulps m2, m6, [srcq+4*mmsize]
+ mulps m5, m6, [srcq+5*mmsize]
+ cvtps2dq m0, m0
+ cvtps2dq m1, m1
+ cvtps2dq m2, m2
+ cvtps2dq m3, m3
+ cvtps2dq m4, m4
+ cvtps2dq m5, m5
+ packssdw m0, m3 ; m0 = 0, 1, 2, 3, 4, 5, 6, 7
+ packssdw m1, m4 ; m1 = 8, 9, 10, 11, 12, 13, 14, 15
+ packssdw m2, m5 ; m2 = 16, 17, 18, 19, 20, 21, 22, 23
+ PALIGNR m3, m1, m0, 12, m4 ; m3 = 6, 7, 8, 9, 10, 11, x, x
+ shufps m1, m2, q1032 ; m1 = 12, 13, 14, 15, 16, 17, 18, 19
+ psrldq m2, 4 ; m2 = 18, 19, 20, 21, 22, 23, x, x
+ SBUTTERFLY2 wd, 0, 3, 4 ; m0 = 0, 6, 1, 7, 2, 8, 3, 9
+ ; m3 = 4, 10, 5, 11, x, x, x, x
+ SBUTTERFLY2 wd, 1, 2, 4 ; m1 = 12, 18, 13, 19, 14, 20, 15, 21
+ ; m2 = 16, 22, 17, 23, x, x, x, x
+ SBUTTERFLY2 dq, 0, 1, 4 ; m0 = 0, 6, 12, 18, 1, 7, 13, 19
+ ; m1 = 2, 8, 14, 20, 3, 9, 15, 21
+ punpckldq m3, m2 ; m3 = 4, 10, 16, 22, 5, 11, 17, 23
+ movq [dstq ], m0
+ movhps [dstq+dst1q], m0
+ movq [dstq+dst2q], m1
+ movhps [dstq+dst3q], m1
+ movq [dstq+dst4q], m3
+ movhps [dstq+dst5q], m3
+ add srcq, mmsize*6
+ add dstq, mmsize/2
+ sub lend, mmsize/4
+ jg .loop
+ REP_RET
+%endmacro
+
+INIT_XMM sse2
+CONV_FLT_TO_S16P_6CH
+INIT_XMM ssse3
+CONV_FLT_TO_S16P_6CH
+INIT_XMM avx
+CONV_FLT_TO_S16P_6CH
+
+;------------------------------------------------------------------------------
+; void ff_conv_flt_to_fltp_2ch(float *const *dst, float *src, int len,
+; int channels);
+;------------------------------------------------------------------------------
+
+%macro CONV_FLT_TO_FLTP_2CH 0
+cglobal conv_flt_to_fltp_2ch, 3,4,3, dst0, src, len, dst1
+ lea lenq, [4*lend]
+ mov dst1q, [dst0q+gprsize]
+ mov dst0q, [dst0q ]
+ lea srcq, [srcq+2*lenq]
+ add dst0q, lenq
+ add dst1q, lenq
+ neg lenq
+.loop:
+ mova m0, [srcq+2*lenq ]
+ mova m1, [srcq+2*lenq+mmsize]
+ DEINT2_PS 0, 1, 2
+ mova [dst0q+lenq], m0
+ mova [dst1q+lenq], m1
+ add lenq, mmsize
+ jl .loop
+ REP_RET
+%endmacro
+
+INIT_XMM sse
+CONV_FLT_TO_FLTP_2CH
+INIT_XMM avx
+CONV_FLT_TO_FLTP_2CH
+
+;------------------------------------------------------------------------------
+; void ff_conv_flt_to_fltp_6ch(float *const *dst, float *src, int len,
+; int channels);
+;------------------------------------------------------------------------------
+
+%macro CONV_FLT_TO_FLTP_6CH 0
+%if ARCH_X86_64
+cglobal conv_flt_to_fltp_6ch, 3,8,7, dst, src, len, dst1, dst2, dst3, dst4, dst5
+%else
+cglobal conv_flt_to_fltp_6ch, 2,7,7, dst, src, dst1, dst2, dst3, dst4, dst5
+%define lend dword r2m
+%endif
+ mov dst1q, [dstq+ gprsize]
+ mov dst2q, [dstq+2*gprsize]
+ mov dst3q, [dstq+3*gprsize]
+ mov dst4q, [dstq+4*gprsize]
+ mov dst5q, [dstq+5*gprsize]
+ mov dstq, [dstq ]
+ sub dst1q, dstq
+ sub dst2q, dstq
+ sub dst3q, dstq
+ sub dst4q, dstq
+ sub dst5q, dstq
+.loop:
+ mova m0, [srcq+0*mmsize] ; m0 = 0, 1, 2, 3
+ mova m1, [srcq+1*mmsize] ; m1 = 4, 5, 6, 7
+ mova m2, [srcq+2*mmsize] ; m2 = 8, 9, 10, 11
+ mova m3, [srcq+3*mmsize] ; m3 = 12, 13, 14, 15
+ mova m4, [srcq+4*mmsize] ; m4 = 16, 17, 18, 19
+ mova m5, [srcq+5*mmsize] ; m5 = 20, 21, 22, 23
+
+ SBUTTERFLY2 dq, 0, 3, 6 ; m0 = 0, 12, 1, 13
+ ; m3 = 2, 14, 3, 15
+ SBUTTERFLY2 dq, 1, 4, 6 ; m1 = 4, 16, 5, 17
+ ; m4 = 6, 18, 7, 19
+ SBUTTERFLY2 dq, 2, 5, 6 ; m2 = 8, 20, 9, 21
+ ; m5 = 10, 22, 11, 23
+ SBUTTERFLY2 dq, 0, 4, 6 ; m0 = 0, 6, 12, 18
+ ; m4 = 1, 7, 13, 19
+ SBUTTERFLY2 dq, 3, 2, 6 ; m3 = 2, 8, 14, 20
+ ; m2 = 3, 9, 15, 21
+ SBUTTERFLY2 dq, 1, 5, 6 ; m1 = 4, 10, 16, 22
+ ; m5 = 5, 11, 17, 23
+ mova [dstq ], m0
+ mova [dstq+dst1q], m4
+ mova [dstq+dst2q], m3
+ mova [dstq+dst3q], m2
+ mova [dstq+dst4q], m1
+ mova [dstq+dst5q], m5
+ add srcq, mmsize*6
+ add dstq, mmsize
+ sub lend, mmsize/4
+ jg .loop
+ REP_RET
+%endmacro
+
+INIT_XMM sse2
+CONV_FLT_TO_FLTP_6CH
+INIT_XMM avx
+CONV_FLT_TO_FLTP_6CH
diff --git a/gst-libs/ext/libav/libavresample/x86/audio_convert_init.c b/gst-libs/ext/libav/libavresample/x86/audio_convert_init.c
new file mode 100644
index 0000000..879108d
--- /dev/null
+++ b/gst-libs/ext/libav/libavresample/x86/audio_convert_init.c
@@ -0,0 +1,263 @@
+/*
+ * Copyright (c) 2012 Justin Ruggles <justin.ruggles@gmail.com>
+ *
+ * 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
+ */
+
+#include "config.h"
+#include "libavutil/cpu.h"
+#include "libavutil/x86/cpu.h"
+#include "libavresample/audio_convert.h"
+
+/* flat conversions */
+
+extern void ff_conv_s16_to_s32_sse2(int16_t *dst, const int32_t *src, int len);
+
+extern void ff_conv_s16_to_flt_sse2(float *dst, const int16_t *src, int len);
+extern void ff_conv_s16_to_flt_sse4(float *dst, const int16_t *src, int len);
+
+extern void ff_conv_s32_to_s16_mmx (int16_t *dst, const int32_t *src, int len);
+extern void ff_conv_s32_to_s16_sse2(int16_t *dst, const int32_t *src, int len);
+
+extern void ff_conv_s32_to_flt_sse2(float *dst, const int32_t *src, int len);
+extern void ff_conv_s32_to_flt_avx (float *dst, const int32_t *src, int len);
+
+extern void ff_conv_flt_to_s16_sse2(int16_t *dst, const float *src, int len);
+
+extern void ff_conv_flt_to_s32_sse2(int32_t *dst, const float *src, int len);
+extern void ff_conv_flt_to_s32_avx (int32_t *dst, const float *src, int len);
+
+/* interleave conversions */
+
+extern void ff_conv_s16p_to_s16_2ch_sse2(int16_t *dst, int16_t *const *src,
+ int len, int channels);
+extern void ff_conv_s16p_to_s16_2ch_avx (int16_t *dst, int16_t *const *src,
+ int len, int channels);
+
+extern void ff_conv_s16p_to_s16_6ch_sse2(int16_t *dst, int16_t *const *src,
+ int len, int channels);
+extern void ff_conv_s16p_to_s16_6ch_sse2slow(int16_t *dst, int16_t *const *src,
+ int len, int channels);
+extern void ff_conv_s16p_to_s16_6ch_avx (int16_t *dst, int16_t *const *src,
+ int len, int channels);
+
+extern void ff_conv_s16p_to_flt_2ch_sse2(float *dst, int16_t *const *src,
+ int len, int channels);
+extern void ff_conv_s16p_to_flt_2ch_avx (float *dst, int16_t *const *src,
+ int len, int channels);
+
+extern void ff_conv_s16p_to_flt_6ch_sse2 (float *dst, int16_t *const *src,
+ int len, int channels);
+extern void ff_conv_s16p_to_flt_6ch_ssse3(float *dst, int16_t *const *src,
+ int len, int channels);
+extern void ff_conv_s16p_to_flt_6ch_avx (float *dst, int16_t *const *src,
+ int len, int channels);
+
+extern void ff_conv_fltp_to_s16_2ch_sse2 (int16_t *dst, float *const *src,
+ int len, int channels);
+extern void ff_conv_fltp_to_s16_2ch_ssse3(int16_t *dst, float *const *src,
+ int len, int channels);
+
+extern void ff_conv_fltp_to_s16_6ch_sse (int16_t *dst, float *const *src,
+ int len, int channels);
+extern void ff_conv_fltp_to_s16_6ch_sse2(int16_t *dst, float *const *src,
+ int len, int channels);
+extern void ff_conv_fltp_to_s16_6ch_avx (int16_t *dst, float *const *src,
+ int len, int channels);
+
+extern void ff_conv_fltp_to_flt_2ch_sse(float *dst, float *const *src, int len,
+ int channels);
+extern void ff_conv_fltp_to_flt_2ch_avx(float *dst, float *const *src, int len,
+ int channels);
+
+extern void ff_conv_fltp_to_flt_6ch_mmx (float *dst, float *const *src, int len,
+ int channels);
+extern void ff_conv_fltp_to_flt_6ch_sse4(float *dst, float *const *src, int len,
+ int channels);
+extern void ff_conv_fltp_to_flt_6ch_avx (float *dst, float *const *src, int len,
+ int channels);
+
+/* deinterleave conversions */
+
+extern void ff_conv_s16_to_s16p_2ch_sse2(int16_t *const *dst, int16_t *src,
+ int len, int channels);
+extern void ff_conv_s16_to_s16p_2ch_ssse3(int16_t *const *dst, int16_t *src,
+ int len, int channels);
+extern void ff_conv_s16_to_s16p_2ch_avx (int16_t *const *dst, int16_t *src,
+ int len, int channels);
+
+extern void ff_conv_s16_to_s16p_6ch_sse2 (int16_t *const *dst, int16_t *src,
+ int len, int channels);
+extern void ff_conv_s16_to_s16p_6ch_ssse3(int16_t *const *dst, int16_t *src,
+ int len, int channels);
+extern void ff_conv_s16_to_s16p_6ch_avx (int16_t *const *dst, int16_t *src,
+ int len, int channels);
+
+extern void ff_conv_s16_to_fltp_2ch_sse2(float *const *dst, int16_t *src,
+ int len, int channels);
+extern void ff_conv_s16_to_fltp_2ch_avx (float *const *dst, int16_t *src,
+ int len, int channels);
+
+extern void ff_conv_s16_to_fltp_6ch_sse2 (float *const *dst, int16_t *src,
+ int len, int channels);
+extern void ff_conv_s16_to_fltp_6ch_ssse3(float *const *dst, int16_t *src,
+ int len, int channels);
+extern void ff_conv_s16_to_fltp_6ch_sse4 (float *const *dst, int16_t *src,
+ int len, int channels);
+extern void ff_conv_s16_to_fltp_6ch_avx (float *const *dst, int16_t *src,
+ int len, int channels);
+
+extern void ff_conv_flt_to_s16p_2ch_sse2(int16_t *const *dst, float *src,
+ int len, int channels);
+extern void ff_conv_flt_to_s16p_2ch_avx (int16_t *const *dst, float *src,
+ int len, int channels);
+
+extern void ff_conv_flt_to_s16p_6ch_sse2 (int16_t *const *dst, float *src,
+ int len, int channels);
+extern void ff_conv_flt_to_s16p_6ch_ssse3(int16_t *const *dst, float *src,
+ int len, int channels);
+extern void ff_conv_flt_to_s16p_6ch_avx (int16_t *const *dst, float *src,
+ int len, int channels);
+
+extern void ff_conv_flt_to_fltp_2ch_sse(float *const *dst, float *src, int len,
+ int channels);
+extern void ff_conv_flt_to_fltp_2ch_avx(float *const *dst, float *src, int len,
+ int channels);
+
+extern void ff_conv_flt_to_fltp_6ch_sse2(float *const *dst, float *src, int len,
+ int channels);
+extern void ff_conv_flt_to_fltp_6ch_avx (float *const *dst, float *src, int len,
+ int channels);
+
+av_cold void ff_audio_convert_init_x86(AudioConvert *ac)
+{
+ int mm_flags = av_get_cpu_flags();
+
+ if (EXTERNAL_MMX(mm_flags)) {
+ ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S32,
+ 0, 1, 8, "MMX", ff_conv_s32_to_s16_mmx);
+ ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_FLTP,
+ 6, 1, 4, "MMX", ff_conv_fltp_to_flt_6ch_mmx);
+ }
+ if (EXTERNAL_SSE(mm_flags)) {
+ ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_FLTP,
+ 6, 1, 2, "SSE", ff_conv_fltp_to_s16_6ch_sse);
+ ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_FLTP,
+ 2, 16, 8, "SSE", ff_conv_fltp_to_flt_2ch_sse);
+ ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_FLT,
+ 2, 16, 4, "SSE", ff_conv_flt_to_fltp_2ch_sse);
+ }
+ if (EXTERNAL_SSE2(mm_flags)) {
+ if (!(mm_flags & AV_CPU_FLAG_SSE2SLOW)) {
+ ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S32,
+ 0, 16, 16, "SSE2", ff_conv_s32_to_s16_sse2);
+ ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S16P,
+ 6, 16, 8, "SSE2", ff_conv_s16p_to_s16_6ch_sse2);
+ ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_FLTP,
+ 6, 16, 4, "SSE2", ff_conv_fltp_to_s16_6ch_sse2);
+ } else {
+ ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S16P,
+ 6, 1, 4, "SSE2SLOW", ff_conv_s16p_to_s16_6ch_sse2slow);
+ }
+ ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_S16,
+ 0, 16, 8, "SSE2", ff_conv_s16_to_s32_sse2);
+ ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S16,
+ 0, 16, 8, "SSE2", ff_conv_s16_to_flt_sse2);
+ ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S32,
+ 0, 16, 8, "SSE2", ff_conv_s32_to_flt_sse2);
+ ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_FLT,
+ 0, 16, 16, "SSE2", ff_conv_flt_to_s16_sse2);
+ ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_FLT,
+ 0, 16, 16, "SSE2", ff_conv_flt_to_s32_sse2);
+ ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S16P,
+ 2, 16, 16, "SSE2", ff_conv_s16p_to_s16_2ch_sse2);
+ ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S16P,
+ 2, 16, 8, "SSE2", ff_conv_s16p_to_flt_2ch_sse2);
+ ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S16P,
+ 6, 16, 4, "SSE2", ff_conv_s16p_to_flt_6ch_sse2);
+ ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_FLTP,
+ 2, 16, 4, "SSE2", ff_conv_fltp_to_s16_2ch_sse2);
+ ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16P, AV_SAMPLE_FMT_S16,
+ 2, 16, 8, "SSE2", ff_conv_s16_to_s16p_2ch_sse2);
+ ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16P, AV_SAMPLE_FMT_S16,
+ 6, 16, 4, "SSE2", ff_conv_s16_to_s16p_6ch_sse2);
+ ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_S16,
+ 2, 16, 8, "SSE2", ff_conv_s16_to_fltp_2ch_sse2);
+ ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_S16,
+ 6, 16, 4, "SSE2", ff_conv_s16_to_fltp_6ch_sse2);
+ ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16P, AV_SAMPLE_FMT_FLT,
+ 2, 16, 8, "SSE2", ff_conv_flt_to_s16p_2ch_sse2);
+ ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16P, AV_SAMPLE_FMT_FLT,
+ 6, 16, 4, "SSE2", ff_conv_flt_to_s16p_6ch_sse2);
+ ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_FLT,
+ 6, 16, 4, "SSE2", ff_conv_flt_to_fltp_6ch_sse2);
+ }
+ if (EXTERNAL_SSSE3(mm_flags)) {
+ ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S16P,
+ 6, 16, 4, "SSSE3", ff_conv_s16p_to_flt_6ch_ssse3);
+ ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_FLTP,
+ 2, 16, 4, "SSSE3", ff_conv_fltp_to_s16_2ch_ssse3);
+ ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16P, AV_SAMPLE_FMT_S16,
+ 2, 16, 8, "SSSE3", ff_conv_s16_to_s16p_2ch_ssse3);
+ ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16P, AV_SAMPLE_FMT_S16,
+ 6, 16, 4, "SSSE3", ff_conv_s16_to_s16p_6ch_ssse3);
+ ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_S16,
+ 6, 16, 4, "SSSE3", ff_conv_s16_to_fltp_6ch_ssse3);
+ ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16P, AV_SAMPLE_FMT_FLT,
+ 6, 16, 4, "SSSE3", ff_conv_flt_to_s16p_6ch_ssse3);
+ }
+ if (EXTERNAL_SSE4(mm_flags)) {
+ ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S16,
+ 0, 16, 8, "SSE4", ff_conv_s16_to_flt_sse4);
+ ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_FLTP,
+ 6, 16, 4, "SSE4", ff_conv_fltp_to_flt_6ch_sse4);
+ }
+ if (EXTERNAL_AVX(mm_flags)) {
+ ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S32,
+ 0, 32, 16, "AVX", ff_conv_s32_to_flt_avx);
+ ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_FLT,
+ 0, 32, 32, "AVX", ff_conv_flt_to_s32_avx);
+ ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S16P,
+ 2, 16, 16, "AVX", ff_conv_s16p_to_s16_2ch_avx);
+ ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S16P,
+ 6, 16, 8, "AVX", ff_conv_s16p_to_s16_6ch_avx);
+ ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S16P,
+ 2, 16, 8, "AVX", ff_conv_s16p_to_flt_2ch_avx);
+ ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S16P,
+ 6, 16, 4, "AVX", ff_conv_s16p_to_flt_6ch_avx);
+ ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_FLTP,
+ 6, 16, 4, "AVX", ff_conv_fltp_to_s16_6ch_avx);
+ ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_FLTP,
+ 6, 16, 4, "AVX", ff_conv_fltp_to_flt_6ch_avx);
+ ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16P, AV_SAMPLE_FMT_S16,
+ 2, 16, 8, "AVX", ff_conv_s16_to_s16p_2ch_avx);
+ ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16P, AV_SAMPLE_FMT_S16,
+ 6, 16, 4, "AVX", ff_conv_s16_to_s16p_6ch_avx);
+ ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_S16,
+ 2, 16, 8, "AVX", ff_conv_s16_to_fltp_2ch_avx);
+ ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_S16,
+ 6, 16, 4, "AVX", ff_conv_s16_to_fltp_6ch_avx);
+ ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16P, AV_SAMPLE_FMT_FLT,
+ 2, 16, 8, "AVX", ff_conv_flt_to_s16p_2ch_avx);
+ ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16P, AV_SAMPLE_FMT_FLT,
+ 6, 16, 4, "AVX", ff_conv_flt_to_s16p_6ch_avx);
+ ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_FLT,
+ 2, 16, 4, "AVX", ff_conv_flt_to_fltp_2ch_avx);
+ ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_FLT,
+ 6, 16, 4, "AVX", ff_conv_flt_to_fltp_6ch_avx);
+ }
+}
diff --git a/gst-libs/ext/libav/libavresample/x86/audio_mix.asm b/gst-libs/ext/libav/libavresample/x86/audio_mix.asm
new file mode 100644
index 0000000..8a298e2
--- /dev/null
+++ b/gst-libs/ext/libav/libavresample/x86/audio_mix.asm
@@ -0,0 +1,503 @@
+;******************************************************************************
+;* x86 optimized channel mixing
+;* Copyright (c) 2012 Justin Ruggles <justin.ruggles@gmail.com>
+;*
+;* 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
+;******************************************************************************
+
+%include "libavutil/x86/x86util.asm"
+%include "util.asm"
+
+SECTION_TEXT
+
+;-----------------------------------------------------------------------------
+; void ff_mix_2_to_1_fltp_flt(float **src, float **matrix, int len,
+; int out_ch, int in_ch);
+;-----------------------------------------------------------------------------
+
+%macro MIX_2_TO_1_FLTP_FLT 0
+cglobal mix_2_to_1_fltp_flt, 3,4,6, src, matrix, len, src1
+ mov src1q, [srcq+gprsize]
+ mov srcq, [srcq ]
+ sub src1q, srcq
+ mov matrixq, [matrixq ]
+ VBROADCASTSS m4, [matrixq ]
+ VBROADCASTSS m5, [matrixq+4]
+ ALIGN 16
+.loop:
+ mulps m0, m4, [srcq ]
+ mulps m1, m5, [srcq+src1q ]
+ mulps m2, m4, [srcq+ mmsize]
+ mulps m3, m5, [srcq+src1q+mmsize]
+ addps m0, m0, m1
+ addps m2, m2, m3
+ mova [srcq ], m0
+ mova [srcq+mmsize], m2
+ add srcq, mmsize*2
+ sub lend, mmsize*2/4
+ jg .loop
+ REP_RET
+%endmacro
+
+INIT_XMM sse
+MIX_2_TO_1_FLTP_FLT
+INIT_YMM avx
+MIX_2_TO_1_FLTP_FLT
+
+;-----------------------------------------------------------------------------
+; void ff_mix_2_to_1_s16p_flt(int16_t **src, float **matrix, int len,
+; int out_ch, int in_ch);
+;-----------------------------------------------------------------------------
+
+%macro MIX_2_TO_1_S16P_FLT 0
+cglobal mix_2_to_1_s16p_flt, 3,4,6, src, matrix, len, src1
+ mov src1q, [srcq+gprsize]
+ mov srcq, [srcq]
+ sub src1q, srcq
+ mov matrixq, [matrixq ]
+ VBROADCASTSS m4, [matrixq ]
+ VBROADCASTSS m5, [matrixq+4]
+ ALIGN 16
+.loop:
+ mova m0, [srcq ]
+ mova m2, [srcq+src1q]
+ S16_TO_S32_SX 0, 1
+ S16_TO_S32_SX 2, 3
+ cvtdq2ps m0, m0
+ cvtdq2ps m1, m1
+ cvtdq2ps m2, m2
+ cvtdq2ps m3, m3
+ mulps m0, m4
+ mulps m1, m4
+ mulps m2, m5
+ mulps m3, m5
+ addps m0, m2
+ addps m1, m3
+ cvtps2dq m0, m0
+ cvtps2dq m1, m1
+ packssdw m0, m1
+ mova [srcq], m0
+ add srcq, mmsize
+ sub lend, mmsize/2
+ jg .loop
+ REP_RET
+%endmacro
+
+INIT_XMM sse2
+MIX_2_TO_1_S16P_FLT
+INIT_XMM sse4
+MIX_2_TO_1_S16P_FLT
+
+;-----------------------------------------------------------------------------
+; void ff_mix_2_to_1_s16p_q8(int16_t **src, int16_t **matrix, int len,
+; int out_ch, int in_ch);
+;-----------------------------------------------------------------------------
+
+INIT_XMM sse2
+cglobal mix_2_to_1_s16p_q8, 3,4,6, src, matrix, len, src1
+ mov src1q, [srcq+gprsize]
+ mov srcq, [srcq]
+ sub src1q, srcq
+ mov matrixq, [matrixq]
+ movd m4, [matrixq]
+ movd m5, [matrixq]
+ SPLATW m4, m4, 0
+ SPLATW m5, m5, 1
+ pxor m0, m0
+ punpcklwd m4, m0
+ punpcklwd m5, m0
+ ALIGN 16
+.loop:
+ mova m0, [srcq ]
+ mova m2, [srcq+src1q]
+ punpckhwd m1, m0, m0
+ punpcklwd m0, m0
+ punpckhwd m3, m2, m2
+ punpcklwd m2, m2
+ pmaddwd m0, m4
+ pmaddwd m1, m4
+ pmaddwd m2, m5
+ pmaddwd m3, m5
+ paddd m0, m2
+ paddd m1, m3
+ psrad m0, 8
+ psrad m1, 8
+ packssdw m0, m1
+ mova [srcq], m0
+ add srcq, mmsize
+ sub lend, mmsize/2
+ jg .loop
+ REP_RET
+
+;-----------------------------------------------------------------------------
+; void ff_mix_1_to_2_fltp_flt(float **src, float **matrix, int len,
+; int out_ch, int in_ch);
+;-----------------------------------------------------------------------------
+
+%macro MIX_1_TO_2_FLTP_FLT 0
+cglobal mix_1_to_2_fltp_flt, 3,5,4, src0, matrix0, len, src1, matrix1
+ mov src1q, [src0q+gprsize]
+ mov src0q, [src0q]
+ sub src1q, src0q
+ mov matrix1q, [matrix0q+gprsize]
+ mov matrix0q, [matrix0q]
+ VBROADCASTSS m2, [matrix0q]
+ VBROADCASTSS m3, [matrix1q]
+ ALIGN 16
+.loop:
+ mova m0, [src0q]
+ mulps m1, m0, m3
+ mulps m0, m0, m2
+ mova [src0q ], m0
+ mova [src0q+src1q], m1
+ add src0q, mmsize
+ sub lend, mmsize/4
+ jg .loop
+ REP_RET
+%endmacro
+
+INIT_XMM sse
+MIX_1_TO_2_FLTP_FLT
+INIT_YMM avx
+MIX_1_TO_2_FLTP_FLT
+
+;-----------------------------------------------------------------------------
+; void ff_mix_1_to_2_s16p_flt(int16_t **src, float **matrix, int len,
+; int out_ch, int in_ch);
+;-----------------------------------------------------------------------------
+
+%macro MIX_1_TO_2_S16P_FLT 0
+cglobal mix_1_to_2_s16p_flt, 3,5,6, src0, matrix0, len, src1, matrix1
+ mov src1q, [src0q+gprsize]
+ mov src0q, [src0q]
+ sub src1q, src0q
+ mov matrix1q, [matrix0q+gprsize]
+ mov matrix0q, [matrix0q]
+ VBROADCASTSS m4, [matrix0q]
+ VBROADCASTSS m5, [matrix1q]
+ ALIGN 16
+.loop:
+ mova m0, [src0q]
+ S16_TO_S32_SX 0, 2
+ cvtdq2ps m0, m0
+ cvtdq2ps m2, m2
+ mulps m1, m0, m5
+ mulps m0, m0, m4
+ mulps m3, m2, m5
+ mulps m2, m2, m4
+ cvtps2dq m0, m0
+ cvtps2dq m1, m1
+ cvtps2dq m2, m2
+ cvtps2dq m3, m3
+ packssdw m0, m2
+ packssdw m1, m3
+ mova [src0q ], m0
+ mova [src0q+src1q], m1
+ add src0q, mmsize
+ sub lend, mmsize/2
+ jg .loop
+ REP_RET
+%endmacro
+
+INIT_XMM sse2
+MIX_1_TO_2_S16P_FLT
+INIT_XMM sse4
+MIX_1_TO_2_S16P_FLT
+INIT_XMM avx
+MIX_1_TO_2_S16P_FLT
+
+;-----------------------------------------------------------------------------
+; void ff_mix_3_8_to_1_2_fltp/s16p_flt(float/int16_t **src, float **matrix,
+; int len, int out_ch, int in_ch);
+;-----------------------------------------------------------------------------
+
+%macro MIX_3_8_TO_1_2_FLT 3 ; %1 = in channels, %2 = out channels, %3 = s16p or fltp
+; define some names to make the code clearer
+%assign in_channels %1
+%assign out_channels %2
+%assign stereo out_channels - 1
+%ifidn %3, s16p
+ %assign is_s16 1
+%else
+ %assign is_s16 0
+%endif
+
+; determine how many matrix elements must go on the stack vs. mmregs
+%assign matrix_elements in_channels * out_channels
+%if is_s16
+ %if stereo
+ %assign needed_mmregs 7
+ %else
+ %assign needed_mmregs 5
+ %endif
+%else
+ %if stereo
+ %assign needed_mmregs 4
+ %else
+ %assign needed_mmregs 3
+ %endif
+%endif
+%assign matrix_elements_mm num_mmregs - needed_mmregs
+%if matrix_elements < matrix_elements_mm
+ %assign matrix_elements_mm matrix_elements
+%endif
+%if matrix_elements_mm < matrix_elements
+ %assign matrix_elements_stack matrix_elements - matrix_elements_mm
+%else
+ %assign matrix_elements_stack 0
+%endif
+%assign matrix_stack_size matrix_elements_stack * mmsize
+
+%assign needed_stack_size -1 * matrix_stack_size
+%if ARCH_X86_32 && in_channels >= 7
+%assign needed_stack_size needed_stack_size - 16
+%endif
+
+cglobal mix_%1_to_%2_%3_flt, 3,in_channels+2,needed_mmregs+matrix_elements_mm, needed_stack_size, src0, src1, len, src2, src3, src4, src5, src6, src7
+
+; define src pointers on stack if needed
+%if matrix_elements_stack > 0 && ARCH_X86_32 && in_channels >= 7
+ %define src5m [rsp+matrix_stack_size+0]
+ %define src6m [rsp+matrix_stack_size+4]
+ %define src7m [rsp+matrix_stack_size+8]
+%endif
+
+; load matrix pointers
+%define matrix0q r1q
+%define matrix1q r3q
+%if stereo
+ mov matrix1q, [matrix0q+gprsize]
+%endif
+ mov matrix0q, [matrix0q]
+
+; define matrix coeff names
+%assign %%i 0
+%assign %%j needed_mmregs
+%rep in_channels
+ %if %%i >= matrix_elements_mm
+ CAT_XDEFINE mx_stack_0_, %%i, 1
+ CAT_XDEFINE mx_0_, %%i, [rsp+(%%i-matrix_elements_mm)*mmsize]
+ %else
+ CAT_XDEFINE mx_stack_0_, %%i, 0
+ CAT_XDEFINE mx_0_, %%i, m %+ %%j
+ %assign %%j %%j+1
+ %endif
+ %assign %%i %%i+1
+%endrep
+%if stereo
+%assign %%i 0
+%rep in_channels
+ %if in_channels + %%i >= matrix_elements_mm
+ CAT_XDEFINE mx_stack_1_, %%i, 1
+ CAT_XDEFINE mx_1_, %%i, [rsp+(in_channels+%%i-matrix_elements_mm)*mmsize]
+ %else
+ CAT_XDEFINE mx_stack_1_, %%i, 0
+ CAT_XDEFINE mx_1_, %%i, m %+ %%j
+ %assign %%j %%j+1
+ %endif
+ %assign %%i %%i+1
+%endrep
+%endif
+
+; load/splat matrix coeffs
+%assign %%i 0
+%rep in_channels
+ %if mx_stack_0_ %+ %%i
+ VBROADCASTSS m0, [matrix0q+4*%%i]
+ mova mx_0_ %+ %%i, m0
+ %else
+ VBROADCASTSS mx_0_ %+ %%i, [matrix0q+4*%%i]
+ %endif
+ %if stereo
+ %if mx_stack_1_ %+ %%i
+ VBROADCASTSS m0, [matrix1q+4*%%i]
+ mova mx_1_ %+ %%i, m0
+ %else
+ VBROADCASTSS mx_1_ %+ %%i, [matrix1q+4*%%i]
+ %endif
+ %endif
+ %assign %%i %%i+1
+%endrep
+
+; load channel pointers to registers as offsets from the first channel pointer
+%if ARCH_X86_64
+ movsxd lenq, r2d
+%endif
+ shl lenq, 2-is_s16
+%assign %%i 1
+%rep (in_channels - 1)
+ %if ARCH_X86_32 && in_channels >= 7 && %%i >= 5
+ mov src5q, [src0q+%%i*gprsize]
+ add src5q, lenq
+ mov src %+ %%i %+ m, src5q
+ %else
+ mov src %+ %%i %+ q, [src0q+%%i*gprsize]
+ add src %+ %%i %+ q, lenq
+ %endif
+ %assign %%i %%i+1
+%endrep
+ mov src0q, [src0q]
+ add src0q, lenq
+ neg lenq
+.loop:
+; for x86-32 with 7-8 channels we do not have enough gp registers for all src
+; pointers, so we have to load some of them from the stack each time
+%define copy_src_from_stack ARCH_X86_32 && in_channels >= 7 && %%i >= 5
+%if is_s16
+ ; mix with s16p input
+ mova m0, [src0q+lenq]
+ S16_TO_S32_SX 0, 1
+ cvtdq2ps m0, m0
+ cvtdq2ps m1, m1
+ %if stereo
+ mulps m2, m0, mx_1_0
+ mulps m3, m1, mx_1_0
+ %endif
+ mulps m0, m0, mx_0_0
+ mulps m1, m1, mx_0_0
+%assign %%i 1
+%rep (in_channels - 1)
+ %if copy_src_from_stack
+ %define src_ptr src5q
+ %else
+ %define src_ptr src %+ %%i %+ q
+ %endif
+ %if stereo
+ %if copy_src_from_stack
+ mov src_ptr, src %+ %%i %+ m
+ %endif
+ mova m4, [src_ptr+lenq]
+ S16_TO_S32_SX 4, 5
+ cvtdq2ps m4, m4
+ cvtdq2ps m5, m5
+ fmaddps m2, m4, mx_1_ %+ %%i, m2, m6
+ fmaddps m3, m5, mx_1_ %+ %%i, m3, m6
+ fmaddps m0, m4, mx_0_ %+ %%i, m0, m4
+ fmaddps m1, m5, mx_0_ %+ %%i, m1, m5
+ %else
+ %if copy_src_from_stack
+ mov src_ptr, src %+ %%i %+ m
+ %endif
+ mova m2, [src_ptr+lenq]
+ S16_TO_S32_SX 2, 3
+ cvtdq2ps m2, m2
+ cvtdq2ps m3, m3
+ fmaddps m0, m2, mx_0_ %+ %%i, m0, m4
+ fmaddps m1, m3, mx_0_ %+ %%i, m1, m4
+ %endif
+ %assign %%i %%i+1
+%endrep
+ %if stereo
+ cvtps2dq m2, m2
+ cvtps2dq m3, m3
+ packssdw m2, m3
+ mova [src1q+lenq], m2
+ %endif
+ cvtps2dq m0, m0
+ cvtps2dq m1, m1
+ packssdw m0, m1
+ mova [src0q+lenq], m0
+%else
+ ; mix with fltp input
+ %if stereo || mx_stack_0_0
+ mova m0, [src0q+lenq]
+ %endif
+ %if stereo
+ mulps m1, m0, mx_1_0
+ %endif
+ %if stereo || mx_stack_0_0
+ mulps m0, m0, mx_0_0
+ %else
+ mulps m0, [src0q+lenq], mx_0_0
+ %endif
+%assign %%i 1
+%rep (in_channels - 1)
+ %if copy_src_from_stack
+ %define src_ptr src5q
+ mov src_ptr, src %+ %%i %+ m
+ %else
+ %define src_ptr src %+ %%i %+ q
+ %endif
+ ; avoid extra load for mono if matrix is in a mm register
+ %if stereo || mx_stack_0_ %+ %%i
+ mova m2, [src_ptr+lenq]
+ %endif
+ %if stereo
+ fmaddps m1, m2, mx_1_ %+ %%i, m1, m3
+ %endif
+ %if stereo || mx_stack_0_ %+ %%i
+ fmaddps m0, m2, mx_0_ %+ %%i, m0, m2
+ %else
+ fmaddps m0, mx_0_ %+ %%i, [src_ptr+lenq], m0, m1
+ %endif
+ %assign %%i %%i+1
+%endrep
+ mova [src0q+lenq], m0
+ %if stereo
+ mova [src1q+lenq], m1
+ %endif
+%endif
+
+ add lenq, mmsize
+ jl .loop
+; zero ymm high halves
+%if mmsize == 32
+ vzeroupper
+%endif
+ RET
+%endmacro
+
+%macro MIX_3_8_TO_1_2_FLT_FUNCS 0
+%assign %%i 3
+%rep 6
+ INIT_XMM sse
+ MIX_3_8_TO_1_2_FLT %%i, 1, fltp
+ MIX_3_8_TO_1_2_FLT %%i, 2, fltp
+ INIT_XMM sse2
+ MIX_3_8_TO_1_2_FLT %%i, 1, s16p
+ MIX_3_8_TO_1_2_FLT %%i, 2, s16p
+ INIT_XMM sse4
+ MIX_3_8_TO_1_2_FLT %%i, 1, s16p
+ MIX_3_8_TO_1_2_FLT %%i, 2, s16p
+ ; do not use ymm AVX or FMA4 in x86-32 for 6 or more channels due to stack alignment issues
+ %if ARCH_X86_64 || %%i < 6
+ INIT_YMM avx
+ %else
+ INIT_XMM avx
+ %endif
+ MIX_3_8_TO_1_2_FLT %%i, 1, fltp
+ MIX_3_8_TO_1_2_FLT %%i, 2, fltp
+ INIT_XMM avx
+ MIX_3_8_TO_1_2_FLT %%i, 1, s16p
+ MIX_3_8_TO_1_2_FLT %%i, 2, s16p
+ %if HAVE_FMA4_EXTERNAL
+ %if ARCH_X86_64 || %%i < 6
+ INIT_YMM fma4
+ %else
+ INIT_XMM fma4
+ %endif
+ MIX_3_8_TO_1_2_FLT %%i, 1, fltp
+ MIX_3_8_TO_1_2_FLT %%i, 2, fltp
+ INIT_XMM fma4
+ MIX_3_8_TO_1_2_FLT %%i, 1, s16p
+ MIX_3_8_TO_1_2_FLT %%i, 2, s16p
+ %endif
+ %assign %%i %%i+1
+%endrep
+%endmacro
+
+MIX_3_8_TO_1_2_FLT_FUNCS
diff --git a/gst-libs/ext/libav/libavresample/x86/audio_mix_init.c b/gst-libs/ext/libav/libavresample/x86/audio_mix_init.c
new file mode 100644
index 0000000..72b2397
--- /dev/null
+++ b/gst-libs/ext/libav/libavresample/x86/audio_mix_init.c
@@ -0,0 +1,215 @@
+/*
+ * Copyright (c) 2012 Justin Ruggles <justin.ruggles@gmail.com>
+ *
+ * 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
+ */
+
+#include "config.h"
+#include "libavutil/cpu.h"
+#include "libavutil/x86/cpu.h"
+#include "libavresample/audio_mix.h"
+
+extern void ff_mix_2_to_1_fltp_flt_sse(float **src, float **matrix, int len,
+ int out_ch, int in_ch);
+extern void ff_mix_2_to_1_fltp_flt_avx(float **src, float **matrix, int len,
+ int out_ch, int in_ch);
+
+extern void ff_mix_2_to_1_s16p_flt_sse2(int16_t **src, float **matrix, int len,
+ int out_ch, int in_ch);
+extern void ff_mix_2_to_1_s16p_flt_sse4(int16_t **src, float **matrix, int len,
+ int out_ch, int in_ch);
+
+extern void ff_mix_2_to_1_s16p_q8_sse2(int16_t **src, int16_t **matrix,
+ int len, int out_ch, int in_ch);
+
+extern void ff_mix_1_to_2_fltp_flt_sse(float **src, float **matrix, int len,
+ int out_ch, int in_ch);
+extern void ff_mix_1_to_2_fltp_flt_avx(float **src, float **matrix, int len,
+ int out_ch, int in_ch);
+
+extern void ff_mix_1_to_2_s16p_flt_sse2(int16_t **src, float **matrix, int len,
+ int out_ch, int in_ch);
+extern void ff_mix_1_to_2_s16p_flt_sse4(int16_t **src, float **matrix, int len,
+ int out_ch, int in_ch);
+extern void ff_mix_1_to_2_s16p_flt_avx (int16_t **src, float **matrix, int len,
+ int out_ch, int in_ch);
+
+#define DEFINE_MIX_3_8_TO_1_2(chan) \
+extern void ff_mix_ ## chan ## _to_1_fltp_flt_sse(float **src, \
+ float **matrix, int len, \
+ int out_ch, int in_ch); \
+extern void ff_mix_ ## chan ## _to_2_fltp_flt_sse(float **src, \
+ float **matrix, int len, \
+ int out_ch, int in_ch); \
+ \
+extern void ff_mix_ ## chan ## _to_1_s16p_flt_sse2(int16_t **src, \
+ float **matrix, int len, \
+ int out_ch, int in_ch); \
+extern void ff_mix_ ## chan ## _to_2_s16p_flt_sse2(int16_t **src, \
+ float **matrix, int len, \
+ int out_ch, int in_ch); \
+ \
+extern void ff_mix_ ## chan ## _to_1_s16p_flt_sse4(int16_t **src, \
+ float **matrix, int len, \
+ int out_ch, int in_ch); \
+extern void ff_mix_ ## chan ## _to_2_s16p_flt_sse4(int16_t **src, \
+ float **matrix, int len, \
+ int out_ch, int in_ch); \
+ \
+extern void ff_mix_ ## chan ## _to_1_fltp_flt_avx(float **src, \
+ float **matrix, int len, \
+ int out_ch, int in_ch); \
+extern void ff_mix_ ## chan ## _to_2_fltp_flt_avx(float **src, \
+ float **matrix, int len, \
+ int out_ch, int in_ch); \
+ \
+extern void ff_mix_ ## chan ## _to_1_s16p_flt_avx(int16_t **src, \
+ float **matrix, int len, \
+ int out_ch, int in_ch); \
+extern void ff_mix_ ## chan ## _to_2_s16p_flt_avx(int16_t **src, \
+ float **matrix, int len, \
+ int out_ch, int in_ch); \
+ \
+extern void ff_mix_ ## chan ## _to_1_fltp_flt_fma4(float **src, \
+ float **matrix, int len, \
+ int out_ch, int in_ch); \
+extern void ff_mix_ ## chan ## _to_2_fltp_flt_fma4(float **src, \
+ float **matrix, int len, \
+ int out_ch, int in_ch); \
+ \
+extern void ff_mix_ ## chan ## _to_1_s16p_flt_fma4(int16_t **src, \
+ float **matrix, int len, \
+ int out_ch, int in_ch); \
+extern void ff_mix_ ## chan ## _to_2_s16p_flt_fma4(int16_t **src, \
+ float **matrix, int len, \
+ int out_ch, int in_ch);
+
+DEFINE_MIX_3_8_TO_1_2(3)
+DEFINE_MIX_3_8_TO_1_2(4)
+DEFINE_MIX_3_8_TO_1_2(5)
+DEFINE_MIX_3_8_TO_1_2(6)
+DEFINE_MIX_3_8_TO_1_2(7)
+DEFINE_MIX_3_8_TO_1_2(8)
+
+#define SET_MIX_3_8_TO_1_2(chan) \
+ if (EXTERNAL_SSE(mm_flags)) { \
+ ff_audio_mix_set_func(am, AV_SAMPLE_FMT_FLTP, AV_MIX_COEFF_TYPE_FLT,\
+ chan, 1, 16, 4, "SSE", \
+ ff_mix_ ## chan ## _to_1_fltp_flt_sse); \
+ ff_audio_mix_set_func(am, AV_SAMPLE_FMT_FLTP, AV_MIX_COEFF_TYPE_FLT,\
+ chan, 2, 16, 4, "SSE", \
+ ff_mix_## chan ##_to_2_fltp_flt_sse); \
+ } \
+ if (EXTERNAL_SSE2(mm_flags)) { \
+ ff_audio_mix_set_func(am, AV_SAMPLE_FMT_S16P, AV_MIX_COEFF_TYPE_FLT,\
+ chan, 1, 16, 8, "SSE2", \
+ ff_mix_ ## chan ## _to_1_s16p_flt_sse2); \
+ ff_audio_mix_set_func(am, AV_SAMPLE_FMT_S16P, AV_MIX_COEFF_TYPE_FLT,\
+ chan, 2, 16, 8, "SSE2", \
+ ff_mix_ ## chan ## _to_2_s16p_flt_sse2); \
+ } \
+ if (EXTERNAL_SSE4(mm_flags)) { \
+ ff_audio_mix_set_func(am, AV_SAMPLE_FMT_S16P, AV_MIX_COEFF_TYPE_FLT,\
+ chan, 1, 16, 8, "SSE4", \
+ ff_mix_ ## chan ## _to_1_s16p_flt_sse4); \
+ ff_audio_mix_set_func(am, AV_SAMPLE_FMT_S16P, AV_MIX_COEFF_TYPE_FLT,\
+ chan, 2, 16, 8, "SSE4", \
+ ff_mix_ ## chan ## _to_2_s16p_flt_sse4); \
+ } \
+ if (EXTERNAL_AVX(mm_flags)) { \
+ int ptr_align = 32; \
+ int smp_align = 8; \
+ if (ARCH_X86_32 || chan >= 6) { \
+ ptr_align = 16; \
+ smp_align = 4; \
+ } \
+ ff_audio_mix_set_func(am, AV_SAMPLE_FMT_FLTP, AV_MIX_COEFF_TYPE_FLT,\
+ chan, 1, ptr_align, smp_align, "AVX", \
+ ff_mix_ ## chan ## _to_1_fltp_flt_avx); \
+ ff_audio_mix_set_func(am, AV_SAMPLE_FMT_FLTP, AV_MIX_COEFF_TYPE_FLT,\
+ chan, 2, ptr_align, smp_align, "AVX", \
+ ff_mix_ ## chan ## _to_2_fltp_flt_avx); \
+ ff_audio_mix_set_func(am, AV_SAMPLE_FMT_S16P, AV_MIX_COEFF_TYPE_FLT,\
+ chan, 1, 16, 8, "AVX", \
+ ff_mix_ ## chan ## _to_1_s16p_flt_avx); \
+ ff_audio_mix_set_func(am, AV_SAMPLE_FMT_S16P, AV_MIX_COEFF_TYPE_FLT,\
+ chan, 2, 16, 8, "AVX", \
+ ff_mix_ ## chan ## _to_2_s16p_flt_avx); \
+ } \
+ if (EXTERNAL_FMA4(mm_flags)) { \
+ int ptr_align = 32; \
+ int smp_align = 8; \
+ if (ARCH_X86_32 || chan >= 6) { \
+ ptr_align = 16; \
+ smp_align = 4; \
+ } \
+ ff_audio_mix_set_func(am, AV_SAMPLE_FMT_FLTP, AV_MIX_COEFF_TYPE_FLT,\
+ chan, 1, ptr_align, smp_align, "FMA4", \
+ ff_mix_ ## chan ## _to_1_fltp_flt_fma4); \
+ ff_audio_mix_set_func(am, AV_SAMPLE_FMT_FLTP, AV_MIX_COEFF_TYPE_FLT,\
+ chan, 2, ptr_align, smp_align, "FMA4", \
+ ff_mix_ ## chan ## _to_2_fltp_flt_fma4); \
+ ff_audio_mix_set_func(am, AV_SAMPLE_FMT_S16P, AV_MIX_COEFF_TYPE_FLT,\
+ chan, 1, 16, 8, "FMA4", \
+ ff_mix_ ## chan ## _to_1_s16p_flt_fma4); \
+ ff_audio_mix_set_func(am, AV_SAMPLE_FMT_S16P, AV_MIX_COEFF_TYPE_FLT,\
+ chan, 2, 16, 8, "FMA4", \
+ ff_mix_ ## chan ## _to_2_s16p_flt_fma4); \
+ }
+
+av_cold void ff_audio_mix_init_x86(AudioMix *am)
+{
+#if HAVE_YASM
+ int mm_flags = av_get_cpu_flags();
+
+ if (EXTERNAL_SSE(mm_flags)) {
+ ff_audio_mix_set_func(am, AV_SAMPLE_FMT_FLTP, AV_MIX_COEFF_TYPE_FLT,
+ 2, 1, 16, 8, "SSE", ff_mix_2_to_1_fltp_flt_sse);
+ ff_audio_mix_set_func(am, AV_SAMPLE_FMT_FLTP, AV_MIX_COEFF_TYPE_FLT,
+ 1, 2, 16, 4, "SSE", ff_mix_1_to_2_fltp_flt_sse);
+ }
+ if (EXTERNAL_SSE2(mm_flags)) {
+ ff_audio_mix_set_func(am, AV_SAMPLE_FMT_S16P, AV_MIX_COEFF_TYPE_FLT,
+ 2, 1, 16, 8, "SSE2", ff_mix_2_to_1_s16p_flt_sse2);
+ ff_audio_mix_set_func(am, AV_SAMPLE_FMT_S16P, AV_MIX_COEFF_TYPE_Q8,
+ 2, 1, 16, 8, "SSE2", ff_mix_2_to_1_s16p_q8_sse2);
+ ff_audio_mix_set_func(am, AV_SAMPLE_FMT_S16P, AV_MIX_COEFF_TYPE_FLT,
+ 1, 2, 16, 8, "SSE2", ff_mix_1_to_2_s16p_flt_sse2);
+ }
+ if (EXTERNAL_SSE4(mm_flags)) {
+ ff_audio_mix_set_func(am, AV_SAMPLE_FMT_S16P, AV_MIX_COEFF_TYPE_FLT,
+ 2, 1, 16, 8, "SSE4", ff_mix_2_to_1_s16p_flt_sse4);
+ ff_audio_mix_set_func(am, AV_SAMPLE_FMT_S16P, AV_MIX_COEFF_TYPE_FLT,
+ 1, 2, 16, 8, "SSE4", ff_mix_1_to_2_s16p_flt_sse4);
+ }
+ if (EXTERNAL_AVX(mm_flags)) {
+ ff_audio_mix_set_func(am, AV_SAMPLE_FMT_FLTP, AV_MIX_COEFF_TYPE_FLT,
+ 2, 1, 32, 16, "AVX", ff_mix_2_to_1_fltp_flt_avx);
+ ff_audio_mix_set_func(am, AV_SAMPLE_FMT_FLTP, AV_MIX_COEFF_TYPE_FLT,
+ 1, 2, 32, 8, "AVX", ff_mix_1_to_2_fltp_flt_avx);
+ ff_audio_mix_set_func(am, AV_SAMPLE_FMT_S16P, AV_MIX_COEFF_TYPE_FLT,
+ 1, 2, 16, 8, "AVX", ff_mix_1_to_2_s16p_flt_avx);
+ }
+
+ SET_MIX_3_8_TO_1_2(3)
+ SET_MIX_3_8_TO_1_2(4)
+ SET_MIX_3_8_TO_1_2(5)
+ SET_MIX_3_8_TO_1_2(6)
+ SET_MIX_3_8_TO_1_2(7)
+ SET_MIX_3_8_TO_1_2(8)
+#endif /* HAVE_YASM */
+}
diff --git a/gst-libs/ext/libav/libavresample/x86/util.asm b/gst-libs/ext/libav/libavresample/x86/util.asm
new file mode 100644
index 0000000..0ce9531
--- /dev/null
+++ b/gst-libs/ext/libav/libavresample/x86/util.asm
@@ -0,0 +1,41 @@
+;******************************************************************************
+;* x86 utility macros for libavresample
+;* Copyright (c) 2012 Justin Ruggles <justin.ruggles@gmail.com>
+;*
+;* 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
+;******************************************************************************
+
+%macro S16_TO_S32_SX 2 ; src/low dst, high dst
+%if cpuflag(sse4)
+ pmovsxwd m%2, m%1
+ psrldq m%1, 8
+ pmovsxwd m%1, m%1
+ SWAP %1, %2
+%else
+ mova m%2, m%1
+ punpckhwd m%2, m%2
+ punpcklwd m%1, m%1
+ psrad m%2, 16
+ psrad m%1, 16
+%endif
+%endmacro
+
+%macro DEINT2_PS 3 ; src0/even dst, src1/odd dst, temp
+ shufps m%3, m%1, m%2, q3131
+ shufps m%1, m%2, q2020
+ SWAP %2,%3
+%endmacro
diff --git a/gst-libs/ext/libav/libavutil/Makefile b/gst-libs/ext/libav/libavutil/Makefile
index 4bbe257..48a0e16 100644
--- a/gst-libs/ext/libav/libavutil/Makefile
+++ b/gst-libs/ext/libav/libavutil/Makefile
@@ -3,12 +3,15 @@ NAME = avutil
HEADERS = adler32.h \
aes.h \
attributes.h \
+ audio_fifo.h \
audioconvert.h \
avassert.h \
avstring.h \
avutil.h \
base64.h \
+ blowfish.h \
bswap.h \
+ channel_layout.h \
common.h \
cpu.h \
crc.h \
@@ -22,11 +25,11 @@ HEADERS = adler32.h \
intreadwrite.h \
lfg.h \
log.h \
- lzo.h \
mathematics.h \
md5.h \
mem.h \
dict.h \
+ old_pix_fmts.h \
opt.h \
parseutils.h \
pixdesc.h \
@@ -35,14 +38,26 @@ HEADERS = adler32.h \
rational.h \
samplefmt.h \
sha.h \
+ time.h \
+ version.h \
+ xtea.h \
+
+HEADERS-$(CONFIG_LZO) += lzo.h
+
+ARCH_HEADERS = bswap.h \
+ intmath.h \
+ intreadwrite.h \
+ timer.h \
BUILT_HEADERS = avconfig.h
OBJS = adler32.o \
aes.o \
- audioconvert.o \
+ audio_fifo.o \
avstring.o \
base64.o \
+ blowfish.o \
+ channel_layout.o \
cpu.o \
crc.o \
des.o \
@@ -50,13 +65,14 @@ OBJS = adler32.o \
eval.o \
fifo.o \
file.o \
+ float_dsp.o \
imgutils.o \
intfloat_readwrite.o \
- inverse.o \
+ intmath.o \
lfg.o \
lls.o \
log.o \
- lzo.o \
+ log2_tab.o \
mathematics.o \
md5.o \
mem.o \
@@ -69,19 +85,32 @@ OBJS = adler32.o \
rc4.o \
samplefmt.o \
sha.o \
+ time.o \
tree.o \
utils.o \
+ xtea.o \
-OBJS-$(ARCH_ARM) += arm/cpu.o
-OBJS-$(ARCH_PPC) += ppc/cpu.o
-OBJS-$(ARCH_X86) += x86/cpu.o
-
-TESTPROGS = adler32 aes avstring base64 cpu crc des eval file fifo lfg lls \
- md5 opt parseutils rational sha tree
-TESTPROGS-$(HAVE_LZO1X_999_COMPRESS) += lzo
+OBJS-$(CONFIG_LZO) += lzo.o
-DIRS = arm bfin sh4 x86
+OBJS += $(COMPAT_OBJS:%=../compat/%)
-ARCH_HEADERS = bswap.h intmath.h intreadwrite.h timer.h
+SKIPHEADERS = old_pix_fmts.h
-$(SUBDIR)lzo-test$(EXESUF): ELIBS = -llzo2
+TESTPROGS = adler32 \
+ aes \
+ avstring \
+ base64 \
+ blowfish \
+ cpu \
+ crc \
+ des \
+ eval \
+ fifo \
+ lfg \
+ lls \
+ md5 \
+ opt \
+ parseutils \
+ sha \
+ tree \
+ xtea \
diff --git a/gst-libs/ext/libav/libavutil/aes.c b/gst-libs/ext/libav/libavutil/aes.c
index 6803c71..4656a48 100644
--- a/gst-libs/ext/libav/libavutil/aes.c
+++ b/gst-libs/ext/libav/libavutil/aes.c
@@ -39,7 +39,14 @@ typedef struct AVAES {
int rounds;
} AVAES;
+#if FF_API_CONTEXT_SIZE
const int av_aes_size= sizeof(AVAES);
+#endif
+
+struct AVAES *av_aes_alloc(void)
+{
+ return av_mallocz(sizeof(struct AVAES));
+}
static const uint8_t rcon[10] = {
0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36
diff --git a/gst-libs/ext/libav/libavutil/aes.h b/gst-libs/ext/libav/libavutil/aes.h
index cf7b462..edff275 100644
--- a/gst-libs/ext/libav/libavutil/aes.h
+++ b/gst-libs/ext/libav/libavutil/aes.h
@@ -23,17 +23,27 @@
#include <stdint.h>
+#include "attributes.h"
+#include "version.h"
+
/**
* @defgroup lavu_aes AES
* @ingroup lavu_crypto
* @{
*/
-extern const int av_aes_size;
+#if FF_API_CONTEXT_SIZE
+extern attribute_deprecated const int av_aes_size;
+#endif
struct AVAES;
/**
+ * Allocate an AVAES context.
+ */
+struct AVAES *av_aes_alloc(void);
+
+/**
* Initialize an AVAES context.
* @param key_bits 128, 192 or 256
* @param decrypt 0 for encryption, 1 for decryption
diff --git a/gst-libs/ext/libav/libavutil/arm/Makefile b/gst-libs/ext/libav/libavutil/arm/Makefile
new file mode 100644
index 0000000..5da44b0
--- /dev/null
+++ b/gst-libs/ext/libav/libavutil/arm/Makefile
@@ -0,0 +1,8 @@
+OBJS += arm/cpu.o \
+ arm/float_dsp_init_arm.o \
+
+VFP-OBJS += arm/float_dsp_init_vfp.o \
+ arm/float_dsp_vfp.o \
+
+NEON-OBJS += arm/float_dsp_init_neon.o \
+ arm/float_dsp_neon.o \
diff --git a/gst-libs/ext/libav/libavutil/arm/asm.S b/gst-libs/ext/libav/libavutil/arm/asm.S
new file mode 100644
index 0000000..a181789
--- /dev/null
+++ b/gst-libs/ext/libav/libavutil/arm/asm.S
@@ -0,0 +1,304 @@
+/*
+ * Copyright (c) 2008 Mans Rullgard <mans@mansr.com>
+ *
+ * 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
+ */
+
+#include "config.h"
+
+#ifdef __ELF__
+# define ELF
+#else
+# define ELF @
+#endif
+
+#if CONFIG_THUMB
+# define A @
+# define T
+#else
+# define A
+# define T @
+#endif
+
+#if HAVE_NEON
+ .arch armv7-a
+#elif HAVE_ARMV6T2
+ .arch armv6t2
+#elif HAVE_ARMV6
+ .arch armv6
+#elif HAVE_ARMV5TE
+ .arch armv5te
+#endif
+
+#if HAVE_NEON
+ .fpu neon
+#elif HAVE_VFP
+ .fpu vfp
+#endif
+
+ .syntax unified
+T .thumb
+ELF .eabi_attribute 25, 1 @ Tag_ABI_align_preserved
+
+.macro function name, export=0
+ .set .Lpic_idx, 0
+ .set .Lpic_gp, 0
+ .macro endfunc
+ .if .Lpic_idx
+ .align 2
+ .altmacro
+ put_pic %(.Lpic_idx - 1)
+ .noaltmacro
+ .endif
+ELF .size \name, . - \name
+ .endfunc
+ .purgem endfunc
+ .endm
+ .text
+ .align 2
+ .if \export
+ .global EXTERN_ASM\name
+EXTERN_ASM\name:
+ .endif
+ELF .type \name, %function
+ .func \name
+\name:
+.endm
+
+.macro const name, align=2
+ .macro endconst
+ELF .size \name, . - \name
+ .purgem endconst
+ .endm
+ .section .rodata
+ .align \align
+\name:
+.endm
+
+#if !HAVE_ARMV6T2_EXTERNAL
+.macro movw rd, val
+ mov \rd, \val & 255
+ orr \rd, \val & ~255
+.endm
+#endif
+
+.macro mov32 rd, val
+#if HAVE_ARMV6T2_EXTERNAL
+ movw \rd, #(\val) & 0xffff
+ .if (\val) >> 16
+ movt \rd, #(\val) >> 16
+ .endif
+#else
+ ldr \rd, =\val
+#endif
+.endm
+
+.macro put_pic num
+ put_pic_\num
+.endm
+
+.macro do_def_pic num, val, label
+ .macro put_pic_\num
+ .if \num
+ .altmacro
+ put_pic %(\num - 1)
+ .noaltmacro
+ .endif
+\label: .word \val
+ .purgem put_pic_\num
+ .endm
+.endm
+
+.macro def_pic val, label
+ .altmacro
+ do_def_pic %.Lpic_idx, \val, \label
+ .noaltmacro
+ .set .Lpic_idx, .Lpic_idx + 1
+.endm
+
+.macro ldpic rd, val, indir=0
+ ldr \rd, .Lpicoff\@
+.Lpic\@:
+ .if \indir
+A ldr \rd, [pc, \rd]
+T add \rd, pc
+T ldr \rd, [\rd]
+ .else
+ add \rd, pc
+ .endif
+ def_pic \val - (.Lpic\@ + (8 >> CONFIG_THUMB)), .Lpicoff\@
+.endm
+
+.macro movrel rd, val
+#if CONFIG_PIC
+ ldpic \rd, \val
+#elif HAVE_ARMV6T2_EXTERNAL && !defined(__APPLE__)
+ movw \rd, #:lower16:\val
+ movt \rd, #:upper16:\val
+#else
+ ldr \rd, =\val
+#endif
+.endm
+
+.macro movrelx rd, val, gp
+#if CONFIG_PIC && defined(__ELF__)
+ .ifnb \gp
+ .if .Lpic_gp
+ .unreq gp
+ .endif
+ gp .req \gp
+ ldpic gp, _GLOBAL_OFFSET_TABLE_
+ .elseif !.Lpic_gp
+ gp .req r12
+ ldpic gp, _GLOBAL_OFFSET_TABLE_
+ .endif
+ .set .Lpic_gp, 1
+ ldr \rd, .Lpicoff\@
+ ldr \rd, [gp, \rd]
+ def_pic \val(GOT), .Lpicoff\@
+#elif CONFIG_PIC && defined(__APPLE__)
+ ldpic \rd, .Lpic\@, indir=1
+ .non_lazy_symbol_pointer
+.Lpic\@:
+ .indirect_symbol \val
+ .word 0
+ .text
+#else
+ movrel \rd, \val
+#endif
+.endm
+
+.macro add_sh rd, rn, rm, sh:vararg
+A add \rd, \rn, \rm, \sh
+T mov \rm, \rm, \sh
+T add \rd, \rn, \rm
+.endm
+
+.macro ldr_pre rt, rn, rm:vararg
+A ldr \rt, [\rn, \rm]!
+T add \rn, \rn, \rm
+T ldr \rt, [\rn]
+.endm
+
+.macro ldr_dpre rt, rn, rm:vararg
+A ldr \rt, [\rn, -\rm]!
+T sub \rn, \rn, \rm
+T ldr \rt, [\rn]
+.endm
+
+.macro ldr_nreg rt, rn, rm:vararg
+A ldr \rt, [\rn, -\rm]
+T sub \rt, \rn, \rm
+T ldr \rt, [\rt]
+.endm
+
+.macro ldr_post rt, rn, rm:vararg
+A ldr \rt, [\rn], \rm
+T ldr \rt, [\rn]
+T add \rn, \rn, \rm
+.endm
+
+.macro ldrd_reg rt, rt2, rn, rm
+A ldrd \rt, \rt2, [\rn, \rm]
+T add \rt, \rn, \rm
+T ldrd \rt, \rt2, [\rt]
+.endm
+
+.macro ldrd_post rt, rt2, rn, rm
+A ldrd \rt, \rt2, [\rn], \rm
+T ldrd \rt, \rt2, [\rn]
+T add \rn, \rn, \rm
+.endm
+
+.macro ldrh_pre rt, rn, rm
+A ldrh \rt, [\rn, \rm]!
+T add \rn, \rn, \rm
+T ldrh \rt, [\rn]
+.endm
+
+.macro ldrh_dpre rt, rn, rm
+A ldrh \rt, [\rn, -\rm]!
+T sub \rn, \rn, \rm
+T ldrh \rt, [\rn]
+.endm
+
+.macro ldrh_post rt, rn, rm
+A ldrh \rt, [\rn], \rm
+T ldrh \rt, [\rn]
+T add \rn, \rn, \rm
+.endm
+
+.macro ldrb_post rt, rn, rm
+A ldrb \rt, [\rn], \rm
+T ldrb \rt, [\rn]
+T add \rn, \rn, \rm
+.endm
+
+.macro str_post rt, rn, rm:vararg
+A str \rt, [\rn], \rm
+T str \rt, [\rn]
+T add \rn, \rn, \rm
+.endm
+
+.macro strb_post rt, rn, rm:vararg
+A strb \rt, [\rn], \rm
+T strb \rt, [\rn]
+T add \rn, \rn, \rm
+.endm
+
+.macro strd_post rt, rt2, rn, rm
+A strd \rt, \rt2, [\rn], \rm
+T strd \rt, \rt2, [\rn]
+T add \rn, \rn, \rm
+.endm
+
+.macro strh_pre rt, rn, rm
+A strh \rt, [\rn, \rm]!
+T add \rn, \rn, \rm
+T strh \rt, [\rn]
+.endm
+
+.macro strh_dpre rt, rn, rm
+A strh \rt, [\rn, -\rm]!
+T sub \rn, \rn, \rm
+T strh \rt, [\rn]
+.endm
+
+.macro strh_post rt, rn, rm
+A strh \rt, [\rn], \rm
+T strh \rt, [\rn]
+T add \rn, \rn, \rm
+.endm
+
+.macro strh_dpost rt, rn, rm
+A strh \rt, [\rn], -\rm
+T strh \rt, [\rn]
+T sub \rn, \rn, \rm
+.endm
+
+#if HAVE_VFP_ARGS
+ .eabi_attribute 28, 1
+# define VFP
+# define NOVFP @
+#else
+# define VFP @
+# define NOVFP
+#endif
+
+#define GLUE(a, b) a ## b
+#define JOIN(a, b) GLUE(a, b)
+#define X(s) JOIN(EXTERN_ASM, s)
diff --git a/gst-libs/ext/libav/libavutil/arm/bswap.h b/gst-libs/ext/libav/libavutil/arm/bswap.h
index f94cbcf..8bc7d9a 100644
--- a/gst-libs/ext/libav/libavutil/arm/bswap.h
+++ b/gst-libs/ext/libav/libavutil/arm/bswap.h
@@ -26,13 +26,6 @@
#ifdef __ARMCC_VERSION
#if HAVE_ARMV6
-#define av_bswap16 av_bswap16
-static av_always_inline av_const unsigned av_bswap16(unsigned x)
-{
- __asm { rev16 x, x }
- return x;
-}
-
#define av_bswap32 av_bswap32
static av_always_inline av_const uint32_t av_bswap32(uint32_t x)
{
@@ -42,7 +35,7 @@ static av_always_inline av_const uint32_t av_bswap32(uint32_t x)
#elif HAVE_INLINE_ASM
-#if HAVE_ARMV6
+#if HAVE_ARMV6_INLINE
#define av_bswap16 av_bswap16
static av_always_inline av_const unsigned av_bswap16(unsigned x)
{
@@ -55,7 +48,7 @@ static av_always_inline av_const unsigned av_bswap16(unsigned x)
#define av_bswap32 av_bswap32
static av_always_inline av_const uint32_t av_bswap32(uint32_t x)
{
-#if HAVE_ARMV6
+#if HAVE_ARMV6_INLINE
__asm__("rev %0, %0" : "+r"(x));
#else
uint32_t t;
@@ -64,7 +57,7 @@ static av_always_inline av_const uint32_t av_bswap32(uint32_t x)
"mov %0, %0, ror #8 \n\t"
"eor %0, %0, %1, lsr #8 \n\t"
: "+r"(x), "=&r"(t));
-#endif /* HAVE_ARMV6 */
+#endif /* HAVE_ARMV6_INLINE */
return x;
}
#endif /* !AV_GCC_VERSION_AT_LEAST(4,5) */
diff --git a/gst-libs/ext/libav/libavutil/arm/cpu.c b/gst-libs/ext/libav/libavutil/arm/cpu.c
index 835513e..b4aabc3 100644
--- a/gst-libs/ext/libav/libavutil/arm/cpu.c
+++ b/gst-libs/ext/libav/libavutil/arm/cpu.c
@@ -19,7 +19,128 @@
#include "libavutil/cpu.h"
#include "config.h"
+#define CORE_FLAG(f) \
+ (AV_CPU_FLAG_ ## f * (HAVE_ ## f ## _EXTERNAL || HAVE_ ## f ## _INLINE))
+
+#define CORE_CPU_FLAGS \
+ (CORE_FLAG(ARMV5TE) | \
+ CORE_FLAG(ARMV6) | \
+ CORE_FLAG(ARMV6T2) | \
+ CORE_FLAG(VFP) | \
+ CORE_FLAG(VFPV3) | \
+ CORE_FLAG(NEON))
+
+#if defined __linux__ || defined __ANDROID__
+
+#include <stdint.h>
+#include <stdio.h>
+#include <string.h>
+#include "libavutil/avstring.h"
+
+#define AT_HWCAP 16
+
+/* Relevant HWCAP values from kernel headers */
+#define HWCAP_VFP (1 << 6)
+#define HWCAP_EDSP (1 << 7)
+#define HWCAP_THUMBEE (1 << 11)
+#define HWCAP_NEON (1 << 12)
+#define HWCAP_VFPv3 (1 << 13)
+#define HWCAP_TLS (1 << 15)
+
+static int get_hwcap(uint32_t *hwcap)
+{
+ struct { uint32_t a_type; uint32_t a_val; } auxv;
+ FILE *f = fopen("/proc/self/auxv", "r");
+ int err = -1;
+
+ if (!f)
+ return -1;
+
+ while (fread(&auxv, sizeof(auxv), 1, f) > 0) {
+ if (auxv.a_type == AT_HWCAP) {
+ *hwcap = auxv.a_val;
+ err = 0;
+ break;
+ }
+ }
+
+ fclose(f);
+ return err;
+}
+
+static int get_cpuinfo(uint32_t *hwcap)
+{
+ FILE *f = fopen("/proc/cpuinfo", "r");
+ char buf[200];
+
+ if (!f)
+ return -1;
+
+ *hwcap = 0;
+ while (fgets(buf, sizeof(buf), f)) {
+ if (av_strstart(buf, "Features", NULL)) {
+ if (strstr(buf, " edsp "))
+ *hwcap |= HWCAP_EDSP;
+ if (strstr(buf, " tls "))
+ *hwcap |= HWCAP_TLS;
+ if (strstr(buf, " thumbee "))
+ *hwcap |= HWCAP_THUMBEE;
+ if (strstr(buf, " vfp "))
+ *hwcap |= HWCAP_VFP;
+ if (strstr(buf, " vfpv3 "))
+ *hwcap |= HWCAP_VFPv3;
+ if (strstr(buf, " neon "))
+ *hwcap |= HWCAP_NEON;
+ break;
+ }
+ }
+ fclose(f);
+ return 0;
+}
+
+int ff_get_cpu_flags_arm(void)
+{
+ int flags = CORE_CPU_FLAGS;
+ uint32_t hwcap;
+
+ if (get_hwcap(&hwcap) < 0)
+ if (get_cpuinfo(&hwcap) < 0)
+ return flags;
+
+#define check_cap(cap, flag) do { \
+ if (hwcap & HWCAP_ ## cap) \
+ flags |= AV_CPU_FLAG_ ## flag; \
+ } while (0)
+
+ /* No flags explicitly indicate v6 or v6T2 so check others which
+ imply support. */
+ check_cap(EDSP, ARMV5TE);
+ check_cap(TLS, ARMV6);
+ check_cap(THUMBEE, ARMV6T2);
+ check_cap(VFP, VFP);
+ check_cap(VFPv3, VFPV3);
+ check_cap(NEON, NEON);
+
+ /* The v6 checks above are not reliable so let higher flags
+ trickle down. */
+ if (flags & (AV_CPU_FLAG_VFPV3 | AV_CPU_FLAG_NEON))
+ flags |= AV_CPU_FLAG_ARMV6T2;
+ if (flags & AV_CPU_FLAG_ARMV6T2)
+ flags |= AV_CPU_FLAG_ARMV6;
+
+ return flags;
+}
+
+#else
+
int ff_get_cpu_flags_arm(void)
{
- return HAVE_IWMMXT * AV_CPU_FLAG_IWMMXT;
+ return AV_CPU_FLAG_ARMV5TE * HAVE_ARMV5TE |
+ AV_CPU_FLAG_ARMV6 * HAVE_ARMV6 |
+ AV_CPU_FLAG_ARMV6T2 * HAVE_ARMV6T2 |
+ AV_CPU_FLAG_VFP * HAVE_VFP |
+ AV_CPU_FLAG_VFPV3 * HAVE_VFPV3 |
+ AV_CPU_FLAG_NEON * HAVE_NEON;
}
+
+#endif
diff --git a/gst-libs/ext/libav/libavutil/arm/cpu.h b/gst-libs/ext/libav/libavutil/arm/cpu.h
new file mode 100644
index 0000000..91c959a
--- /dev/null
+++ b/gst-libs/ext/libav/libavutil/arm/cpu.h
@@ -0,0 +1,32 @@
+/*
+ * 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
+ */
+
+#ifndef AVUTIL_ARM_CPU_H
+#define AVUTIL_ARM_CPU_H
+
+#include "config.h"
+#include "libavutil/cpu.h"
+
+#define have_armv5te(flags) (HAVE_ARMV5TE && ((flags) & AV_CPU_FLAG_ARMV5TE))
+#define have_armv6(flags) (HAVE_ARMV6 && ((flags) & AV_CPU_FLAG_ARMV6))
+#define have_armv6t2(flags) (HAVE_ARMV6T2 && ((flags) & AV_CPU_FLAG_ARMV6T2))
+#define have_vfp(flags) (HAVE_VFP && ((flags) & AV_CPU_FLAG_VFP))
+#define have_vfpv3(flags) (HAVE_VFPV3 && ((flags) & AV_CPU_FLAG_VFPV3))
+#define have_neon(flags) (HAVE_NEON && ((flags) & AV_CPU_FLAG_NEON))
+
+#endif
diff --git a/gst-libs/ext/libav/libavutil/arm/float_dsp_arm.h b/gst-libs/ext/libav/libavutil/arm/float_dsp_arm.h
new file mode 100644
index 0000000..81fad3e
--- /dev/null
+++ b/gst-libs/ext/libav/libavutil/arm/float_dsp_arm.h
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2009 Mans Rullgard <mans@mansr.com>
+ *
+ * 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
+ */
+
+#ifndef AVUTIL_ARM_FLOAT_DSP_ARM_H
+#define AVUTIL_ARM_FLOAT_DSP_ARM_H
+
+#include "libavutil/float_dsp.h"
+
+void ff_float_dsp_init_vfp (AVFloatDSPContext *fdsp);
+void ff_float_dsp_init_neon(AVFloatDSPContext *fdsp);
+
+#endif /* AVUTIL_ARM_FLOAT_DSP_ARM_H */
diff --git a/gst-libs/ext/libav/libavutil/arm/float_dsp_init_arm.c b/gst-libs/ext/libav/libavutil/arm/float_dsp_init_arm.c
new file mode 100644
index 0000000..b133d32
--- /dev/null
+++ b/gst-libs/ext/libav/libavutil/arm/float_dsp_init_arm.c
@@ -0,0 +1,33 @@
+/*
+ * ARM optimized DSP utils
+ *
+ * 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
+ */
+
+#include "libavutil/float_dsp.h"
+#include "cpu.h"
+#include "float_dsp_arm.h"
+
+void ff_float_dsp_init_arm(AVFloatDSPContext *fdsp)
+{
+ int cpu_flags = av_get_cpu_flags();
+
+ if (have_vfp(cpu_flags))
+ ff_float_dsp_init_vfp(fdsp);
+ if (have_neon(cpu_flags))
+ ff_float_dsp_init_neon(fdsp);
+}
diff --git a/gst-libs/ext/libav/libavutil/arm/float_dsp_init_neon.c b/gst-libs/ext/libav/libavutil/arm/float_dsp_init_neon.c
new file mode 100644
index 0000000..88eb4b3
--- /dev/null
+++ b/gst-libs/ext/libav/libavutil/arm/float_dsp_init_neon.c
@@ -0,0 +1,40 @@
+/*
+ * ARM NEON optimised Float DSP functions
+ * Copyright (c) 2008 Mans Rullgard <mans@mansr.com>
+ *
+ * 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
+ */
+
+#include <stdint.h>
+
+#include "libavutil/float_dsp.h"
+#include "float_dsp_arm.h"
+
+void ff_vector_fmul_neon(float *dst, const float *src0, const float *src1, int len);
+
+void ff_vector_fmac_scalar_neon(float *dst, const float *src, float mul,
+ int len);
+
+void ff_vector_fmul_scalar_neon(float *dst, const float *src, float mul,
+ int len);
+
+void ff_float_dsp_init_neon(AVFloatDSPContext *fdsp)
+{
+ fdsp->vector_fmul = ff_vector_fmul_neon;
+ fdsp->vector_fmac_scalar = ff_vector_fmac_scalar_neon;
+ fdsp->vector_fmul_scalar = ff_vector_fmul_scalar_neon;
+}
diff --git a/gst-libs/ext/libav/libavutil/arm/float_dsp_init_vfp.c b/gst-libs/ext/libav/libavutil/arm/float_dsp_init_vfp.c
new file mode 100644
index 0000000..ef808d8
--- /dev/null
+++ b/gst-libs/ext/libav/libavutil/arm/float_dsp_init_vfp.c
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2008 Siarhei Siamashka <ssvb@users.sourceforge.net>
+ *
+ * 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
+ */
+
+#include "libavutil/float_dsp.h"
+#include "cpu.h"
+#include "float_dsp_arm.h"
+
+void ff_vector_fmul_vfp(float *dst, const float *src0, const float *src1,
+ int len);
+
+void ff_float_dsp_init_vfp(AVFloatDSPContext *fdsp)
+{
+ int cpu_flags = av_get_cpu_flags();
+
+ if (!have_vfpv3(cpu_flags))
+ fdsp->vector_fmul = ff_vector_fmul_vfp;
+}
diff --git a/gst-libs/ext/libav/libavutil/arm/float_dsp_neon.S b/gst-libs/ext/libav/libavutil/arm/float_dsp_neon.S
new file mode 100644
index 0000000..6d7bd52
--- /dev/null
+++ b/gst-libs/ext/libav/libavutil/arm/float_dsp_neon.S
@@ -0,0 +1,148 @@
+/*
+ * ARM NEON optimised Float DSP functions
+ * Copyright (c) 2008 Mans Rullgard <mans@mansr.com>
+ *
+ * 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
+ */
+
+#include "config.h"
+#include "asm.S"
+
+function ff_vector_fmul_neon, export=1
+ subs r3, r3, #8
+ vld1.32 {d0-d3}, [r1,:128]!
+ vld1.32 {d4-d7}, [r2,:128]!
+ vmul.f32 q8, q0, q2
+ vmul.f32 q9, q1, q3
+ beq 3f
+ bics ip, r3, #15
+ beq 2f
+1: subs ip, ip, #16
+ vld1.32 {d0-d1}, [r1,:128]!
+ vld1.32 {d4-d5}, [r2,:128]!
+ vmul.f32 q10, q0, q2
+ vld1.32 {d2-d3}, [r1,:128]!
+ vld1.32 {d6-d7}, [r2,:128]!
+ vmul.f32 q11, q1, q3
+ vst1.32 {d16-d19},[r0,:128]!
+ vld1.32 {d0-d1}, [r1,:128]!
+ vld1.32 {d4-d5}, [r2,:128]!
+ vmul.f32 q8, q0, q2
+ vld1.32 {d2-d3}, [r1,:128]!
+ vld1.32 {d6-d7}, [r2,:128]!
+ vmul.f32 q9, q1, q3
+ vst1.32 {d20-d23},[r0,:128]!
+ bne 1b
+ ands r3, r3, #15
+ beq 3f
+2: vld1.32 {d0-d1}, [r1,:128]!
+ vld1.32 {d4-d5}, [r2,:128]!
+ vst1.32 {d16-d17},[r0,:128]!
+ vmul.f32 q8, q0, q2
+ vld1.32 {d2-d3}, [r1,:128]!
+ vld1.32 {d6-d7}, [r2,:128]!
+ vst1.32 {d18-d19},[r0,:128]!
+ vmul.f32 q9, q1, q3
+3: vst1.32 {d16-d19},[r0,:128]!
+ bx lr
+endfunc
+
+function ff_vector_fmac_scalar_neon, export=1
+VFP len .req r2
+VFP acc .req r3
+NOVFP len .req r3
+NOVFP acc .req r2
+VFP vdup.32 q15, d0[0]
+NOVFP vdup.32 q15, r2
+ bics r12, len, #15
+ mov acc, r0
+ beq 3f
+ vld1.32 {q0}, [r1,:128]!
+ vld1.32 {q8}, [acc,:128]!
+ vld1.32 {q1}, [r1,:128]!
+ vld1.32 {q9}, [acc,:128]!
+1: vmla.f32 q8, q0, q15
+ vld1.32 {q2}, [r1,:128]!
+ vld1.32 {q10}, [acc,:128]!
+ vmla.f32 q9, q1, q15
+ vld1.32 {q3}, [r1,:128]!
+ vld1.32 {q11}, [acc,:128]!
+ vmla.f32 q10, q2, q15
+ vst1.32 {q8}, [r0,:128]!
+ vmla.f32 q11, q3, q15
+ vst1.32 {q9}, [r0,:128]!
+ subs r12, r12, #16
+ beq 2f
+ vld1.32 {q0}, [r1,:128]!
+ vld1.32 {q8}, [acc,:128]!
+ vst1.32 {q10}, [r0,:128]!
+ vld1.32 {q1}, [r1,:128]!
+ vld1.32 {q9}, [acc,:128]!
+ vst1.32 {q11}, [r0,:128]!
+ b 1b
+2: vst1.32 {q10}, [r0,:128]!
+ vst1.32 {q11}, [r0,:128]!
+ ands len, len, #15
+ it eq
+ bxeq lr
+3: vld1.32 {q0}, [r1,:128]!
+ vld1.32 {q8}, [acc,:128]!
+ vmla.f32 q8, q0, q15
+ vst1.32 {q8}, [r0,:128]!
+ subs len, len, #4
+ bgt 3b
+ bx lr
+ .unreq len
+endfunc
+
+function ff_vector_fmul_scalar_neon, export=1
+VFP len .req r2
+NOVFP len .req r3
+VFP vdup.32 q8, d0[0]
+NOVFP vdup.32 q8, r2
+ bics r12, len, #15
+ beq 3f
+ vld1.32 {q0},[r1,:128]!
+ vld1.32 {q1},[r1,:128]!
+1: vmul.f32 q0, q0, q8
+ vld1.32 {q2},[r1,:128]!
+ vmul.f32 q1, q1, q8
+ vld1.32 {q3},[r1,:128]!
+ vmul.f32 q2, q2, q8
+ vst1.32 {q0},[r0,:128]!
+ vmul.f32 q3, q3, q8
+ vst1.32 {q1},[r0,:128]!
+ subs r12, r12, #16
+ beq 2f
+ vld1.32 {q0},[r1,:128]!
+ vst1.32 {q2},[r0,:128]!
+ vld1.32 {q1},[r1,:128]!
+ vst1.32 {q3},[r0,:128]!
+ b 1b
+2: vst1.32 {q2},[r0,:128]!
+ vst1.32 {q3},[r0,:128]!
+ ands len, len, #15
+ it eq
+ bxeq lr
+3: vld1.32 {q0},[r1,:128]!
+ vmul.f32 q0, q0, q8
+ vst1.32 {q0},[r0,:128]!
+ subs len, len, #4
+ bgt 3b
+ bx lr
+ .unreq len
+endfunc
diff --git a/gst-libs/ext/libav/libavutil/arm/float_dsp_vfp.S b/gst-libs/ext/libav/libavutil/arm/float_dsp_vfp.S
new file mode 100644
index 0000000..3931828
--- /dev/null
+++ b/gst-libs/ext/libav/libavutil/arm/float_dsp_vfp.S
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2008 Siarhei Siamashka <ssvb@users.sourceforge.net>
+ *
+ * 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
+ */
+
+#include "config.h"
+#include "asm.S"
+
+/**
+ * Assume that len is a positive number and is multiple of 8
+ */
+@ void ff_vector_fmul_vfp(float *dst, const float *src0, const float *src1, int len)
+function ff_vector_fmul_vfp, export=1
+ vpush {d8-d15}
+ fmrx r12, fpscr
+ orr r12, r12, #(3 << 16) /* set vector size to 4 */
+ fmxr fpscr, r12
+
+ vldmia r1!, {s0-s3}
+ vldmia r2!, {s8-s11}
+ vldmia r1!, {s4-s7}
+ vldmia r2!, {s12-s15}
+ vmul.f32 s8, s0, s8
+1:
+ subs r3, r3, #16
+ vmul.f32 s12, s4, s12
+ itttt ge
+ vldmiage r1!, {s16-s19}
+ vldmiage r2!, {s24-s27}
+ vldmiage r1!, {s20-s23}
+ vldmiage r2!, {s28-s31}
+ it ge
+ vmulge.f32 s24, s16, s24
+ vstmia r0!, {s8-s11}
+ vstmia r0!, {s12-s15}
+ it ge
+ vmulge.f32 s28, s20, s28
+ itttt gt
+ vldmiagt r1!, {s0-s3}
+ vldmiagt r2!, {s8-s11}
+ vldmiagt r1!, {s4-s7}
+ vldmiagt r2!, {s12-s15}
+ ittt ge
+ vmulge.f32 s8, s0, s8
+ vstmiage r0!, {s24-s27}
+ vstmiage r0!, {s28-s31}
+ bgt 1b
+
+ bic r12, r12, #(7 << 16) /* set vector size back to 1 */
+ fmxr fpscr, r12
+ vpop {d8-d15}
+ bx lr
+endfunc
diff --git a/gst-libs/ext/libav/libavutil/arm/intmath.h b/gst-libs/ext/libav/libavutil/arm/intmath.h
index b6a45c1..56fcdb3 100644
--- a/gst-libs/ext/libav/libavutil/arm/intmath.h
+++ b/gst-libs/ext/libav/libavutil/arm/intmath.h
@@ -28,23 +28,10 @@
#if HAVE_INLINE_ASM
-#if HAVE_ARMV6
-
-#define FASTDIV FASTDIV
-static av_always_inline av_const int FASTDIV(int a, int b)
-{
- int r;
- __asm__ ("cmp %2, #2 \n\t"
- "ldr %0, [%3, %2, lsl #2] \n\t"
- "ite le \n\t"
- "lsrle %0, %1, #1 \n\t"
- "smmulgt %0, %0, %1 \n\t"
- : "=&r"(r) : "r"(a), "r"(b), "r"(ff_inverse) : "cc");
- return r;
-}
+#if HAVE_ARMV6_INLINE
#define av_clip_uint8 av_clip_uint8_arm
-static av_always_inline av_const uint8_t av_clip_uint8_arm(int a)
+static av_always_inline av_const unsigned av_clip_uint8_arm(int a)
{
unsigned x;
__asm__ ("usat %0, #8, %1" : "=r"(x) : "r"(a));
@@ -52,15 +39,15 @@ static av_always_inline av_const uint8_t av_clip_uint8_arm(int a)
}
#define av_clip_int8 av_clip_int8_arm
-static av_always_inline av_const uint8_t av_clip_int8_arm(int a)
+static av_always_inline av_const int av_clip_int8_arm(int a)
{
- unsigned x;
+ int x;
__asm__ ("ssat %0, #8, %1" : "=r"(x) : "r"(a));
return x;
}
#define av_clip_uint16 av_clip_uint16_arm
-static av_always_inline av_const uint16_t av_clip_uint16_arm(int a)
+static av_always_inline av_const unsigned av_clip_uint16_arm(int a)
{
unsigned x;
__asm__ ("usat %0, #16, %1" : "=r"(x) : "r"(a));
@@ -68,7 +55,7 @@ static av_always_inline av_const uint16_t av_clip_uint16_arm(int a)
}
#define av_clip_int16 av_clip_int16_arm
-static av_always_inline av_const int16_t av_clip_int16_arm(int a)
+static av_always_inline av_const int av_clip_int16_arm(int a)
{
int x;
__asm__ ("ssat %0, #16, %1" : "=r"(x) : "r"(a));
@@ -83,19 +70,25 @@ static av_always_inline av_const unsigned av_clip_uintp2_arm(int a, int p)
return x;
}
+#define av_sat_add32 av_sat_add32_arm
+static av_always_inline int av_sat_add32_arm(int a, int b)
+{
+ int r;
+ __asm__ ("qadd %0, %1, %2" : "=r"(r) : "r"(a), "r"(b));
+ return r;
+}
-#else /* HAVE_ARMV6 */
-
-#define FASTDIV FASTDIV
-static av_always_inline av_const int FASTDIV(int a, int b)
+#define av_sat_dadd32 av_sat_dadd32_arm
+static av_always_inline int av_sat_dadd32_arm(int a, int b)
{
- int r, t;
- __asm__ ("umull %1, %0, %2, %3"
- : "=&r"(r), "=&r"(t) : "r"(a), "r"(ff_inverse[b]));
+ int r;
+ __asm__ ("qdadd %0, %1, %2" : "=r"(r) : "r"(a), "r"(b));
return r;
}
-#endif /* HAVE_ARMV6 */
+#endif /* HAVE_ARMV6_INLINE */
+
+#if HAVE_ASM_MOD_Q
#define av_clipl_int32 av_clipl_int32_arm
static av_always_inline av_const int32_t av_clipl_int32_arm(int64_t a)
@@ -106,10 +99,12 @@ static av_always_inline av_const int32_t av_clipl_int32_arm(int64_t a)
"mvnne %1, #1<<31 \n\t"
"moveq %0, %Q2 \n\t"
"eorne %0, %1, %R2, asr #31 \n\t"
- : "=r"(x), "=&r"(y) : "r"(a));
+ : "=r"(x), "=&r"(y) : "r"(a) : "cc");
return x;
}
+#endif /* HAVE_ASM_MOD_Q */
+
#endif /* HAVE_INLINE_ASM */
#endif /* AVUTIL_ARM_INTMATH_H */
diff --git a/gst-libs/ext/libav/libavutil/arm/intreadwrite.h b/gst-libs/ext/libav/libavutil/arm/intreadwrite.h
index 613abe5..6eff733 100644
--- a/gst-libs/ext/libav/libavutil/arm/intreadwrite.h
+++ b/gst-libs/ext/libav/libavutil/arm/intreadwrite.h
@@ -21,14 +21,22 @@
#include <stdint.h>
#include "config.h"
+#include "libavutil/attributes.h"
-#if HAVE_FAST_UNALIGNED && HAVE_INLINE_ASM
+#if HAVE_FAST_UNALIGNED && HAVE_INLINE_ASM && !AV_GCC_VERSION_AT_LEAST(4,7)
#define AV_RN16 AV_RN16
static av_always_inline unsigned AV_RN16(const void *p)
{
+ const uint8_t *q = p;
unsigned v;
- __asm__ ("ldrh %0, %1" : "=r"(v) : "m"(*(const uint16_t *)p));
+#if !AV_GCC_VERSION_AT_LEAST(4,6)
+ __asm__ ("ldrh %0, %1" : "=r"(v) : "m"(*(const uint16_t *)q));
+#elif defined __thumb__
+ __asm__ ("ldrh %0, %1" : "=r"(v) : "m"(q[0]), "m"(q[1]));
+#else
+ __asm__ ("ldrh %0, %1" : "=r"(v) : "Uq"(q[0]), "m"(q[1]));
+#endif
return v;
}
@@ -41,8 +49,9 @@ static av_always_inline void AV_WN16(void *p, uint16_t v)
#define AV_RN32 AV_RN32
static av_always_inline uint32_t AV_RN32(const void *p)
{
+ const struct __attribute__((packed)) { uint32_t v; } *q = p;
uint32_t v;
- __asm__ ("ldr %0, %1" : "=r"(v) : "m"(*(const uint32_t *)p));
+ __asm__ ("ldr %0, %1" : "=r"(v) : "m"(*q));
return v;
}
@@ -52,14 +61,17 @@ static av_always_inline void AV_WN32(void *p, uint32_t v)
__asm__ ("str %1, %0" : "=m"(*(uint32_t *)p) : "r"(v));
}
+#if HAVE_ASM_MOD_Q
+
#define AV_RN64 AV_RN64
static av_always_inline uint64_t AV_RN64(const void *p)
{
+ const struct __attribute__((packed)) { uint32_t v; } *q = p;
uint64_t v;
__asm__ ("ldr %Q0, %1 \n\t"
"ldr %R0, %2 \n\t"
: "=&r"(v)
- : "m"(*(const uint32_t*)p), "m"(*((const uint32_t*)p+1)));
+ : "m"(q[0]), "m"(q[1]));
return v;
}
@@ -72,6 +84,8 @@ static av_always_inline void AV_WN64(void *p, uint64_t v)
: "r"(v));
}
+#endif /* HAVE_ASM_MOD_Q */
+
#endif /* HAVE_INLINE_ASM */
#endif /* AVUTIL_ARM_INTREADWRITE_H */
diff --git a/gst-libs/ext/libav/libavutil/attributes.h b/gst-libs/ext/libav/libavutil/attributes.h
index ef990a1..292a0a1 100644
--- a/gst-libs/ext/libav/libavutil/attributes.h
+++ b/gst-libs/ext/libav/libavutil/attributes.h
@@ -32,98 +32,78 @@
# define AV_GCC_VERSION_AT_LEAST(x,y) 0
#endif
-#ifndef av_always_inline
#if AV_GCC_VERSION_AT_LEAST(3,1)
# define av_always_inline __attribute__((always_inline)) inline
+#elif defined(_MSC_VER)
+# define av_always_inline __forceinline
#else
# define av_always_inline inline
#endif
-#endif
-#ifndef av_noinline
#if AV_GCC_VERSION_AT_LEAST(3,1)
# define av_noinline __attribute__((noinline))
#else
# define av_noinline
#endif
-#endif
-#ifndef av_pure
#if AV_GCC_VERSION_AT_LEAST(3,1)
# define av_pure __attribute__((pure))
#else
# define av_pure
#endif
-#endif
-#ifndef av_const
#if AV_GCC_VERSION_AT_LEAST(2,6)
# define av_const __attribute__((const))
#else
# define av_const
#endif
-#endif
-#ifndef av_cold
#if AV_GCC_VERSION_AT_LEAST(4,3)
# define av_cold __attribute__((cold))
#else
# define av_cold
#endif
-#endif
-#ifndef av_flatten
#if AV_GCC_VERSION_AT_LEAST(4,1)
# define av_flatten __attribute__((flatten))
#else
# define av_flatten
#endif
-#endif
-#ifndef attribute_deprecated
#if AV_GCC_VERSION_AT_LEAST(3,1)
# define attribute_deprecated __attribute__((deprecated))
#else
# define attribute_deprecated
#endif
-#endif
-#ifndef av_unused
#if defined(__GNUC__)
# define av_unused __attribute__((unused))
#else
# define av_unused
#endif
-#endif
/**
* Mark a variable as used and prevent the compiler from optimizing it
* away. This is useful for variables accessed only from inline
* assembler without the compiler being aware.
*/
-#ifndef av_used
#if AV_GCC_VERSION_AT_LEAST(3,1)
# define av_used __attribute__((used))
#else
# define av_used
#endif
-#endif
-#ifndef av_alias
#if AV_GCC_VERSION_AT_LEAST(3,3)
# define av_alias __attribute__((may_alias))
#else
# define av_alias
#endif
-#endif
-#ifndef av_uninit
#if defined(__GNUC__) && !defined(__ICC)
# define av_uninit(x) x=x
#else
# define av_uninit(x) x
#endif
-#endif
#ifdef __GNUC__
# define av_builtin_constant_p __builtin_constant_p
@@ -133,4 +113,10 @@
# define av_printf_format(fmtpos, attrpos)
#endif
+#if AV_GCC_VERSION_AT_LEAST(2,5)
+# define av_noreturn __attribute__((noreturn))
+#else
+# define av_noreturn
+#endif
+
#endif /* AVUTIL_ATTRIBUTES_H */
diff --git a/gst-libs/ext/libav/libavutil/audio_fifo.c b/gst-libs/ext/libav/libavutil/audio_fifo.c
new file mode 100644
index 0000000..b562537
--- /dev/null
+++ b/gst-libs/ext/libav/libavutil/audio_fifo.c
@@ -0,0 +1,194 @@
+/*
+ * Audio FIFO
+ * Copyright (c) 2012 Justin Ruggles <justin.ruggles@gmail.com>
+ *
+ * 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
+ * Audio FIFO
+ */
+
+#include "avutil.h"
+#include "audio_fifo.h"
+#include "common.h"
+#include "fifo.h"
+#include "mem.h"
+#include "samplefmt.h"
+
+struct AVAudioFifo {
+ AVFifoBuffer **buf; /**< single buffer for interleaved, per-channel buffers for planar */
+ int nb_buffers; /**< number of buffers */
+ int nb_samples; /**< number of samples currently in the FIFO */
+ int allocated_samples; /**< current allocated size, in samples */
+
+ int channels; /**< number of channels */
+ enum AVSampleFormat sample_fmt; /**< sample format */
+ int sample_size; /**< size, in bytes, of one sample in a buffer */
+};
+
+void av_audio_fifo_free(AVAudioFifo *af)
+{
+ if (af) {
+ if (af->buf) {
+ int i;
+ for (i = 0; i < af->nb_buffers; i++) {
+ if (af->buf[i])
+ av_fifo_free(af->buf[i]);
+ }
+ av_free(af->buf);
+ }
+ av_free(af);
+ }
+}
+
+AVAudioFifo *av_audio_fifo_alloc(enum AVSampleFormat sample_fmt, int channels,
+ int nb_samples)
+{
+ AVAudioFifo *af;
+ int buf_size, i;
+
+ /* get channel buffer size (also validates parameters) */
+ if (av_samples_get_buffer_size(&buf_size, channels, nb_samples, sample_fmt, 1) < 0)
+ return NULL;
+
+ af = av_mallocz(sizeof(*af));
+ if (!af)
+ return NULL;
+
+ af->channels = channels;
+ af->sample_fmt = sample_fmt;
+ af->sample_size = buf_size / nb_samples;
+ af->nb_buffers = av_sample_fmt_is_planar(sample_fmt) ? channels : 1;
+
+ af->buf = av_mallocz(af->nb_buffers * sizeof(*af->buf));
+ if (!af->buf)
+ goto error;
+
+ for (i = 0; i < af->nb_buffers; i++) {
+ af->buf[i] = av_fifo_alloc(buf_size);
+ if (!af->buf[i])
+ goto error;
+ }
+ af->allocated_samples = nb_samples;
+
+ return af;
+
+error:
+ av_audio_fifo_free(af);
+ return NULL;
+}
+
+int av_audio_fifo_realloc(AVAudioFifo *af, int nb_samples)
+{
+ int i, ret, buf_size;
+
+ if ((ret = av_samples_get_buffer_size(&buf_size, af->channels, nb_samples,
+ af->sample_fmt, 1)) < 0)
+ return ret;
+
+ for (i = 0; i < af->nb_buffers; i++) {
+ if ((ret = av_fifo_realloc2(af->buf[i], buf_size)) < 0)
+ return ret;
+ }
+ af->allocated_samples = nb_samples;
+ return 0;
+}
+
+int av_audio_fifo_write(AVAudioFifo *af, void **data, int nb_samples)
+{
+ int i, ret, size;
+
+ /* automatically reallocate buffers if needed */
+ if (av_audio_fifo_space(af) < nb_samples) {
+ int current_size = av_audio_fifo_size(af);
+ /* check for integer overflow in new size calculation */
+ if (INT_MAX / 2 - current_size < nb_samples)
+ return AVERROR(EINVAL);
+ /* reallocate buffers */
+ if ((ret = av_audio_fifo_realloc(af, 2 * (current_size + nb_samples))) < 0)
+ return ret;
+ }
+
+ size = nb_samples * af->sample_size;
+ for (i = 0; i < af->nb_buffers; i++) {
+ ret = av_fifo_generic_write(af->buf[i], data[i], size, NULL);
+ if (ret != size)
+ return AVERROR_BUG;
+ }
+ af->nb_samples += nb_samples;
+
+ return nb_samples;
+}
+
+int av_audio_fifo_read(AVAudioFifo *af, void **data, int nb_samples)
+{
+ int i, ret, size;
+
+ if (nb_samples < 0)
+ return AVERROR(EINVAL);
+ nb_samples = FFMIN(nb_samples, af->nb_samples);
+ if (!nb_samples)
+ return 0;
+
+ size = nb_samples * af->sample_size;
+ for (i = 0; i < af->nb_buffers; i++) {
+ if ((ret = av_fifo_generic_read(af->buf[i], data[i], size, NULL)) < 0)
+ return AVERROR_BUG;
+ }
+ af->nb_samples -= nb_samples;
+
+ return nb_samples;
+}
+
+int av_audio_fifo_drain(AVAudioFifo *af, int nb_samples)
+{
+ int i, size;
+
+ if (nb_samples < 0)
+ return AVERROR(EINVAL);
+ nb_samples = FFMIN(nb_samples, af->nb_samples);
+
+ if (nb_samples) {
+ size = nb_samples * af->sample_size;
+ for (i = 0; i < af->nb_buffers; i++)
+ av_fifo_drain(af->buf[i], size);
+ af->nb_samples -= nb_samples;
+ }
+ return 0;
+}
+
+void av_audio_fifo_reset(AVAudioFifo *af)
+{
+ int i;
+
+ for (i = 0; i < af->nb_buffers; i++)
+ av_fifo_reset(af->buf[i]);
+
+ af->nb_samples = 0;
+}
+
+int av_audio_fifo_size(AVAudioFifo *af)
+{
+ return af->nb_samples;
+}
+
+int av_audio_fifo_space(AVAudioFifo *af)
+{
+ return af->allocated_samples - af->nb_samples;
+}
diff --git a/gst-libs/ext/libav/libavutil/audio_fifo.h b/gst-libs/ext/libav/libavutil/audio_fifo.h
new file mode 100644
index 0000000..8c76388
--- /dev/null
+++ b/gst-libs/ext/libav/libavutil/audio_fifo.h
@@ -0,0 +1,146 @@
+/*
+ * Audio FIFO
+ * Copyright (c) 2012 Justin Ruggles <justin.ruggles@gmail.com>
+ *
+ * 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
+ * Audio FIFO Buffer
+ */
+
+#ifndef AVUTIL_AUDIO_FIFO_H
+#define AVUTIL_AUDIO_FIFO_H
+
+#include "avutil.h"
+#include "fifo.h"
+#include "samplefmt.h"
+
+/**
+ * @addtogroup lavu_audio
+ * @{
+ */
+
+/**
+ * Context for an Audio FIFO Buffer.
+ *
+ * - Operates at the sample level rather than the byte level.
+ * - Supports multiple channels with either planar or packed sample format.
+ * - Automatic reallocation when writing to a full buffer.
+ */
+typedef struct AVAudioFifo AVAudioFifo;
+
+/**
+ * Free an AVAudioFifo.
+ *
+ * @param af AVAudioFifo to free
+ */
+void av_audio_fifo_free(AVAudioFifo *af);
+
+/**
+ * Allocate an AVAudioFifo.
+ *
+ * @param sample_fmt sample format
+ * @param channels number of channels
+ * @param nb_samples initial allocation size, in samples
+ * @return newly allocated AVAudioFifo, or NULL on error
+ */
+AVAudioFifo *av_audio_fifo_alloc(enum AVSampleFormat sample_fmt, int channels,
+ int nb_samples);
+
+/**
+ * Reallocate an AVAudioFifo.
+ *
+ * @param af AVAudioFifo to reallocate
+ * @param nb_samples new allocation size, in samples
+ * @return 0 if OK, or negative AVERROR code on failure
+ */
+int av_audio_fifo_realloc(AVAudioFifo *af, int nb_samples);
+
+/**
+ * Write data to an AVAudioFifo.
+ *
+ * The AVAudioFifo will be reallocated automatically if the available space
+ * is less than nb_samples.
+ *
+ * @see enum AVSampleFormat
+ * The documentation for AVSampleFormat describes the data layout.
+ *
+ * @param af AVAudioFifo to write to
+ * @param data audio data plane pointers
+ * @param nb_samples number of samples to write
+ * @return number of samples actually written, or negative AVERROR
+ * code on failure.
+ */
+int av_audio_fifo_write(AVAudioFifo *af, void **data, int nb_samples);
+
+/**
+ * Read data from an AVAudioFifo.
+ *
+ * @see enum AVSampleFormat
+ * The documentation for AVSampleFormat describes the data layout.
+ *
+ * @param af AVAudioFifo to read from
+ * @param data audio data plane pointers
+ * @param nb_samples number of samples to read
+ * @return number of samples actually read, or negative AVERROR code
+ * on failure.
+ */
+int av_audio_fifo_read(AVAudioFifo *af, void **data, int nb_samples);
+
+/**
+ * Drain data from an AVAudioFifo.
+ *
+ * Removes the data without reading it.
+ *
+ * @param af AVAudioFifo to drain
+ * @param nb_samples number of samples to drain
+ * @return 0 if OK, or negative AVERROR code on failure
+ */
+int av_audio_fifo_drain(AVAudioFifo *af, int nb_samples);
+
+/**
+ * Reset the AVAudioFifo buffer.
+ *
+ * This empties all data in the buffer.
+ *
+ * @param af AVAudioFifo to reset
+ */
+void av_audio_fifo_reset(AVAudioFifo *af);
+
+/**
+ * Get the current number of samples in the AVAudioFifo available for reading.
+ *
+ * @param af the AVAudioFifo to query
+ * @return number of samples available for reading
+ */
+int av_audio_fifo_size(AVAudioFifo *af);
+
+/**
+ * Get the current number of samples in the AVAudioFifo available for writing.
+ *
+ * @param af the AVAudioFifo to query
+ * @return number of samples available for writing
+ */
+int av_audio_fifo_space(AVAudioFifo *af);
+
+/**
+ * @}
+ */
+
+#endif /* AVUTIL_AUDIO_FIFO_H */
diff --git a/gst-libs/ext/libav/libavutil/audioconvert.c b/gst-libs/ext/libav/libavutil/audioconvert.c
deleted file mode 100644
index e9f9e41..0000000
--- a/gst-libs/ext/libav/libavutil/audioconvert.c
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * Copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at>
- *
- * 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
- * audio conversion routines
- */
-
-#include "avstring.h"
-#include "avutil.h"
-#include "audioconvert.h"
-
-static const char * const channel_names[] = {
- [0] = "FL", /* front left */
- [1] = "FR", /* front right */
- [2] = "FC", /* front center */
- [3] = "LFE", /* low frequency */
- [4] = "BL", /* back left */
- [5] = "BR", /* back right */
- [6] = "FLC", /* front left-of-center */
- [7] = "FRC", /* front right-of-center */
- [8] = "BC", /* back-center */
- [9] = "SL", /* side left */
- [10] = "SR", /* side right */
- [11] = "TC", /* top center */
- [12] = "TFL", /* top front left */
- [13] = "TFC", /* top front center */
- [14] = "TFR", /* top front right */
- [15] = "TBL", /* top back left */
- [16] = "TBC", /* top back center */
- [17] = "TBR", /* top back right */
- [29] = "DL", /* downmix left */
- [30] = "DR", /* downmix right */
-};
-
-static const char *get_channel_name(int channel_id)
-{
- if (channel_id < 0 || channel_id >= FF_ARRAY_ELEMS(channel_names))
- return NULL;
- return channel_names[channel_id];
-}
-
-static const struct {
- const char *name;
- int nb_channels;
- uint64_t layout;
-} channel_layout_map[] = {
- { "mono", 1, AV_CH_LAYOUT_MONO },
- { "stereo", 2, AV_CH_LAYOUT_STEREO },
- { "4.0", 4, AV_CH_LAYOUT_4POINT0 },
- { "quad", 4, AV_CH_LAYOUT_QUAD },
- { "5.0", 5, AV_CH_LAYOUT_5POINT0 },
- { "5.0", 5, AV_CH_LAYOUT_5POINT0_BACK },
- { "5.1", 6, AV_CH_LAYOUT_5POINT1 },
- { "5.1", 6, AV_CH_LAYOUT_5POINT1_BACK },
- { "5.1+downmix", 8, AV_CH_LAYOUT_5POINT1|AV_CH_LAYOUT_STEREO_DOWNMIX, },
- { "7.1", 8, AV_CH_LAYOUT_7POINT1 },
- { "7.1(wide)", 8, AV_CH_LAYOUT_7POINT1_WIDE },
- { "7.1+downmix", 10, AV_CH_LAYOUT_7POINT1|AV_CH_LAYOUT_STEREO_DOWNMIX, },
- { 0 }
-};
-
-uint64_t av_get_channel_layout(const char *name)
-{
- int i = 0;
- do {
- if (!strcmp(channel_layout_map[i].name, name))
- return channel_layout_map[i].layout;
- i++;
- } while (channel_layout_map[i].name);
-
- return 0;
-}
-
-void av_get_channel_layout_string(char *buf, int buf_size,
- int nb_channels, uint64_t channel_layout)
-{
- int i;
-
- if (nb_channels <= 0)
- nb_channels = av_get_channel_layout_nb_channels(channel_layout);
-
- for (i = 0; channel_layout_map[i].name; i++)
- if (nb_channels == channel_layout_map[i].nb_channels &&
- channel_layout == channel_layout_map[i].layout) {
- av_strlcpy(buf, channel_layout_map[i].name, buf_size);
- return;
- }
-
- snprintf(buf, buf_size, "%d channels", nb_channels);
- if (channel_layout) {
- int i, ch;
- av_strlcat(buf, " (", buf_size);
- for (i = 0, ch = 0; i < 64; i++) {
- if ((channel_layout & (UINT64_C(1) << i))) {
- const char *name = get_channel_name(i);
- if (name) {
- if (ch > 0)
- av_strlcat(buf, "|", buf_size);
- av_strlcat(buf, name, buf_size);
- }
- ch++;
- }
- }
- av_strlcat(buf, ")", buf_size);
- }
-}
-
-int av_get_channel_layout_nb_channels(uint64_t channel_layout)
-{
- int count;
- uint64_t x = channel_layout;
- for (count = 0; x; count++)
- x &= x-1; // unset lowest set bit
- return count;
-}
diff --git a/gst-libs/ext/libav/libavutil/audioconvert.h b/gst-libs/ext/libav/libavutil/audioconvert.h
index 00ed0ff..300a67c 100644
--- a/gst-libs/ext/libav/libavutil/audioconvert.h
+++ b/gst-libs/ext/libav/libavutil/audioconvert.h
@@ -1,130 +1,6 @@
-/*
- * Copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at>
- * Copyright (c) 2008 Peter Ross
- *
- * 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
- */
-#ifndef AVUTIL_AUDIOCONVERT_H
-#define AVUTIL_AUDIOCONVERT_H
+#include "version.h"
-#include <stdint.h>
-
-/**
- * @file
- * audio conversion routines
- */
-
-/**
- * @addtogroup lavu_audio
- * @{
- */
-
-/**
- * @defgroup channel_masks Audio channel masks
- * @{
- */
-#define AV_CH_FRONT_LEFT 0x00000001
-#define AV_CH_FRONT_RIGHT 0x00000002
-#define AV_CH_FRONT_CENTER 0x00000004
-#define AV_CH_LOW_FREQUENCY 0x00000008
-#define AV_CH_BACK_LEFT 0x00000010
-#define AV_CH_BACK_RIGHT 0x00000020
-#define AV_CH_FRONT_LEFT_OF_CENTER 0x00000040
-#define AV_CH_FRONT_RIGHT_OF_CENTER 0x00000080
-#define AV_CH_BACK_CENTER 0x00000100
-#define AV_CH_SIDE_LEFT 0x00000200
-#define AV_CH_SIDE_RIGHT 0x00000400
-#define AV_CH_TOP_CENTER 0x00000800
-#define AV_CH_TOP_FRONT_LEFT 0x00001000
-#define AV_CH_TOP_FRONT_CENTER 0x00002000
-#define AV_CH_TOP_FRONT_RIGHT 0x00004000
-#define AV_CH_TOP_BACK_LEFT 0x00008000
-#define AV_CH_TOP_BACK_CENTER 0x00010000
-#define AV_CH_TOP_BACK_RIGHT 0x00020000
-#define AV_CH_STEREO_LEFT 0x20000000 ///< Stereo downmix.
-#define AV_CH_STEREO_RIGHT 0x40000000 ///< See AV_CH_STEREO_LEFT.
-#define AV_CH_WIDE_LEFT 0x0000000080000000ULL
-#define AV_CH_WIDE_RIGHT 0x0000000100000000ULL
-#define AV_CH_SURROUND_DIRECT_LEFT 0x0000000200000000ULL
-#define AV_CH_SURROUND_DIRECT_RIGHT 0x0000000400000000ULL
-
-/** Channel mask value used for AVCodecContext.request_channel_layout
- to indicate that the user requests the channel order of the decoder output
- to be the native codec channel order. */
-#define AV_CH_LAYOUT_NATIVE 0x8000000000000000ULL
-
-/**
- * @}
- * @defgroup channel_mask_c Audio channel convenience macros
- * @{
- * */
-#define AV_CH_LAYOUT_MONO (AV_CH_FRONT_CENTER)
-#define AV_CH_LAYOUT_STEREO (AV_CH_FRONT_LEFT|AV_CH_FRONT_RIGHT)
-#define AV_CH_LAYOUT_2POINT1 (AV_CH_LAYOUT_STEREO|AV_CH_LOW_FREQUENCY)
-#define AV_CH_LAYOUT_2_1 (AV_CH_LAYOUT_STEREO|AV_CH_BACK_CENTER)
-#define AV_CH_LAYOUT_SURROUND (AV_CH_LAYOUT_STEREO|AV_CH_FRONT_CENTER)
-#define AV_CH_LAYOUT_3POINT1 (AV_CH_LAYOUT_SURROUND|AV_CH_LOW_FREQUENCY)
-#define AV_CH_LAYOUT_4POINT0 (AV_CH_LAYOUT_SURROUND|AV_CH_BACK_CENTER)
-#define AV_CH_LAYOUT_4POINT1 (AV_CH_LAYOUT_4POINT0|AV_CH_LOW_FREQUENCY)
-#define AV_CH_LAYOUT_2_2 (AV_CH_LAYOUT_STEREO|AV_CH_SIDE_LEFT|AV_CH_SIDE_RIGHT)
-#define AV_CH_LAYOUT_QUAD (AV_CH_LAYOUT_STEREO|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT)
-#define AV_CH_LAYOUT_5POINT0 (AV_CH_LAYOUT_SURROUND|AV_CH_SIDE_LEFT|AV_CH_SIDE_RIGHT)
-#define AV_CH_LAYOUT_5POINT1 (AV_CH_LAYOUT_5POINT0|AV_CH_LOW_FREQUENCY)
-#define AV_CH_LAYOUT_5POINT0_BACK (AV_CH_LAYOUT_SURROUND|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT)
-#define AV_CH_LAYOUT_5POINT1_BACK (AV_CH_LAYOUT_5POINT0_BACK|AV_CH_LOW_FREQUENCY)
-#define AV_CH_LAYOUT_6POINT0 (AV_CH_LAYOUT_5POINT0|AV_CH_BACK_CENTER)
-#define AV_CH_LAYOUT_6POINT0_FRONT (AV_CH_LAYOUT_2_2|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER)
-#define AV_CH_LAYOUT_HEXAGONAL (AV_CH_LAYOUT_5POINT0_BACK|AV_CH_BACK_CENTER)
-#define AV_CH_LAYOUT_6POINT1 (AV_CH_LAYOUT_5POINT1|AV_CH_BACK_CENTER)
-#define AV_CH_LAYOUT_6POINT1_BACK (AV_CH_LAYOUT_5POINT1_BACK|AV_CH_BACK_CENTER)
-#define AV_CH_LAYOUT_6POINT1_FRONT (AV_CH_LAYOUT_6POINT0_FRONT|AV_CH_LOW_FREQUENCY)
-#define AV_CH_LAYOUT_7POINT0 (AV_CH_LAYOUT_5POINT0|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT)
-#define AV_CH_LAYOUT_7POINT0_FRONT (AV_CH_LAYOUT_5POINT0|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER)
-#define AV_CH_LAYOUT_7POINT1 (AV_CH_LAYOUT_5POINT1|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT)
-#define AV_CH_LAYOUT_7POINT1_WIDE (AV_CH_LAYOUT_5POINT1|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER)
-#define AV_CH_LAYOUT_OCTAGONAL (AV_CH_LAYOUT_5POINT0|AV_CH_BACK_LEFT|AV_CH_BACK_CENTER|AV_CH_BACK_RIGHT)
-#define AV_CH_LAYOUT_STEREO_DOWNMIX (AV_CH_STEREO_LEFT|AV_CH_STEREO_RIGHT)
-
-/**
- * @}
- */
-
-/**
- * Return a channel layout id that matches name, 0 if no match.
- */
-uint64_t av_get_channel_layout(const char *name);
-
-/**
- * Return a description of a channel layout.
- * If nb_channels is <= 0, it is guessed from the channel_layout.
- *
- * @param buf put here the string containing the channel layout
- * @param buf_size size in bytes of the buffer
- */
-void av_get_channel_layout_string(char *buf, int buf_size, int nb_channels, uint64_t channel_layout);
-
-/**
- * Return the number of channels in the channel layout.
- */
-int av_get_channel_layout_nb_channels(uint64_t channel_layout);
-
-/**
- * @}
- */
-
-#endif /* AVUTIL_AUDIOCONVERT_H */
+#if FF_API_AUDIOCONVERT
+#include "channel_layout.h"
+#endif
diff --git a/gst-libs/ext/libav/libavutil/avstring.c b/gst-libs/ext/libav/libavutil/avstring.c
index 11f3a7c..2c88bd3 100644
--- a/gst-libs/ext/libav/libavutil/avstring.c
+++ b/gst-libs/ext/libav/libavutil/avstring.c
@@ -20,10 +20,13 @@
*/
#include <stdarg.h>
+#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include "avstring.h"
+#include "config.h"
+#include "common.h"
#include "mem.h"
int av_strstart(const char *str, const char *pfx, const char **ptr)
@@ -155,9 +158,48 @@ int av_strncasecmp(const char *a, const char *b, size_t n)
return c1 - c2;
}
+const char *av_basename(const char *path)
+{
+ char *p = strrchr(path, '/');
+
+#if HAVE_DOS_PATHS
+ char *q = strrchr(path, '\\');
+ char *d = strchr(path, ':');
+
+ p = FFMAX3(p, q, d);
+#endif
+
+ if (!p)
+ return path;
+
+ return p + 1;
+}
+
+const char *av_dirname(char *path)
+{
+ char *p = strrchr(path, '/');
+
+#if HAVE_DOS_PATHS
+ char *q = strrchr(path, '\\');
+ char *d = strchr(path, ':');
+
+ d = d ? d + 1 : d;
+
+ p = FFMAX3(p, q, d);
+#endif
+
+ if (!p)
+ return ".";
+
+ *p = '\0';
+
+ return path;
+}
+
+
#ifdef TEST
-#undef printf
+#include "common.h"
int main(void)
{
@@ -195,10 +237,12 @@ int main(void)
};
for (i=0; i < FF_ARRAY_ELEMS(strings); i++) {
- const char *p= strings[i];
+ const char *p = strings[i], *q;
printf("|%s|", p);
- printf(" -> |%s|", av_get_token(&p, ":"));
+ q = av_get_token(&p, ":");
+ printf(" -> |%s|", q);
printf(" + |%s|\n", p);
+ av_free(q);
}
}
diff --git a/gst-libs/ext/libav/libavutil/avstring.h b/gst-libs/ext/libav/libavutil/avstring.h
index ed4e465..acd6610 100644
--- a/gst-libs/ext/libav/libavutil/avstring.h
+++ b/gst-libs/ext/libav/libavutil/avstring.h
@@ -168,6 +168,22 @@ int av_strcasecmp(const char *a, const char *b);
*/
int av_strncasecmp(const char *a, const char *b, size_t n);
+
+/**
+ * Thread safe basename.
+ * @param path the path, on DOS both \ and / are considered separators.
+ * @return pointer to the basename substring.
+ */
+const char *av_basename(const char *path);
+
+/**
+ * Thread safe dirname.
+ * @param path the path, on DOS both \ and / are considered separators.
+ * @return the path with the separator replaced by the string terminator or ".".
+ * @note the function may change the input string.
+ */
+const char *av_dirname(char *path);
+
/**
* @}
*/
diff --git a/gst-libs/ext/libav/libavutil/avutil.h b/gst-libs/ext/libav/libavutil/avutil.h
index 05e9248..33f9bea 100644
--- a/gst-libs/ext/libav/libavutil/avutil.h
+++ b/gst-libs/ext/libav/libavutil/avutil.h
@@ -31,7 +31,7 @@
*
* @section libav_intro Introduction
*
- * This document describe the usage of the different libraries
+ * This document describes the usage of the different libraries
* provided by Libav.
*
* @li @ref libavc "libavcodec" encoding/decoding library
@@ -39,9 +39,8 @@
* @li @ref libavf "libavformat" I/O and muxing/demuxing library
* @li @ref lavd "libavdevice" special devices muxing/demuxing library
* @li @ref lavu "libavutil" common utility library
- * @li @subpage libpostproc post processing library
+ * @li @ref lavr "libavresample" audio resampling, format conversion and mixing
* @li @subpage libswscale color conversion and scaling library
- *
*/
/**
@@ -144,56 +143,6 @@
/**
* @}
- *
- * @defgroup lavu_ver Version and Build diagnostics
- *
- * Macros and function useful to check at compiletime and at runtime
- * which version of libavutil is in use.
- *
- * @{
- */
-
-#define LIBAVUTIL_VERSION_MAJOR 51
-#define LIBAVUTIL_VERSION_MINOR 22
-#define LIBAVUTIL_VERSION_MICRO 1
-
-#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
- LIBAVUTIL_VERSION_MINOR, \
- LIBAVUTIL_VERSION_MICRO)
-#define LIBAVUTIL_VERSION AV_VERSION(LIBAVUTIL_VERSION_MAJOR, \
- LIBAVUTIL_VERSION_MINOR, \
- LIBAVUTIL_VERSION_MICRO)
-#define LIBAVUTIL_BUILD LIBAVUTIL_VERSION_INT
-
-#define LIBAVUTIL_IDENT "Lavu" AV_STRINGIFY(LIBAVUTIL_VERSION)
-
-/**
- * @}
- *
- * @defgroup depr_guards Deprecation guards
- * Those FF_API_* defines are not part of public API.
- * They may change, break or disappear at any time.
- *
- * They are used mostly internally to mark code that will be removed
- * on the next major version.
- *
- * @{
- */
-#ifndef FF_API_GET_BITS_PER_SAMPLE_FMT
-#define FF_API_GET_BITS_PER_SAMPLE_FMT (LIBAVUTIL_VERSION_MAJOR < 52)
-#endif
-#ifndef FF_API_FIND_OPT
-#define FF_API_FIND_OPT (LIBAVUTIL_VERSION_MAJOR < 52)
-#endif
-#ifndef FF_API_AV_FIFO_PEEK
-#define FF_API_AV_FIFO_PEEK (LIBAVUTIL_VERSION_MAJOR < 52)
-#endif
-#ifndef FF_API_OLD_AVOPTIONS
-#define FF_API_OLD_AVOPTIONS (LIBAVUTIL_VERSION_MAJOR < 52)
-#endif
-
-/**
- * @}
*/
/**
@@ -315,8 +264,8 @@ char av_get_picture_type_char(enum AVPictureType pict_type);
* @}
*/
-#include "common.h"
#include "error.h"
+#include "version.h"
/**
* @}
diff --git a/gst-libs/ext/libav/libavutil/base64.c b/gst-libs/ext/libav/libavutil/base64.c
index 73872b8..d16195f 100644
--- a/gst-libs/ext/libav/libavutil/base64.c
+++ b/gst-libs/ext/libav/libavutil/base64.c
@@ -44,10 +44,10 @@ static const uint8_t map2[] =
int av_base64_decode(uint8_t *out, const char *in, int out_size)
{
- int i, v;
+ int i;
+ unsigned v = 0;
uint8_t *dst = out;
- v = 0;
for (i = 0; in[i] && in[i] != '='; i++) {
unsigned int index= in[i]-43;
if (index>=FF_ARRAY_ELEMS(map2) || map2[index] == 0xff)
@@ -101,8 +101,6 @@ char *av_base64_encode(char *out, int out_size, const uint8_t *in, int in_size)
#ifdef TEST
-#undef printf
-
#define MAX_DATA_SIZE 1024
#define MAX_ENCODED_SIZE 2048
diff --git a/gst-libs/ext/libav/libavutil/blowfish.c b/gst-libs/ext/libav/libavutil/blowfish.c
new file mode 100644
index 0000000..63cc404
--- /dev/null
+++ b/gst-libs/ext/libav/libavutil/blowfish.c
@@ -0,0 +1,597 @@
+/*
+ * Blowfish algorithm
+ * Copyright (c) 2012 Samuel Pitoiset
+ *
+ * loosely based on Paul Kocher's implementation
+ *
+ * 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
+ */
+
+#include "libavutil/intreadwrite.h"
+
+#include "avutil.h"
+#include "common.h"
+#include "blowfish.h"
+
+static const uint32_t orig_p[AV_BF_ROUNDS + 2] = {
+ 0x243F6A88, 0x85A308D3, 0x13198A2E, 0x03707344,
+ 0xA4093822, 0x299F31D0, 0x082EFA98, 0xEC4E6C89,
+ 0x452821E6, 0x38D01377, 0xBE5466CF, 0x34E90C6C,
+ 0xC0AC29B7, 0xC97C50DD, 0x3F84D5B5, 0xB5470917,
+ 0x9216D5D9, 0x8979FB1B
+};
+
+static const uint32_t orig_s[4][256] = {
+ { 0xD1310BA6, 0x98DFB5AC, 0x2FFD72DB, 0xD01ADFB7,
+ 0xB8E1AFED, 0x6A267E96, 0xBA7C9045, 0xF12C7F99,
+ 0x24A19947, 0xB3916CF7, 0x0801F2E2, 0x858EFC16,
+ 0x636920D8, 0x71574E69, 0xA458FEA3, 0xF4933D7E,
+ 0x0D95748F, 0x728EB658, 0x718BCD58, 0x82154AEE,
+ 0x7B54A41D, 0xC25A59B5, 0x9C30D539, 0x2AF26013,
+ 0xC5D1B023, 0x286085F0, 0xCA417918, 0xB8DB38EF,
+ 0x8E79DCB0, 0x603A180E, 0x6C9E0E8B, 0xB01E8A3E,
+ 0xD71577C1, 0xBD314B27, 0x78AF2FDA, 0x55605C60,
+ 0xE65525F3, 0xAA55AB94, 0x57489862, 0x63E81440,
+ 0x55CA396A, 0x2AAB10B6, 0xB4CC5C34, 0x1141E8CE,
+ 0xA15486AF, 0x7C72E993, 0xB3EE1411, 0x636FBC2A,
+ 0x2BA9C55D, 0x741831F6, 0xCE5C3E16, 0x9B87931E,
+ 0xAFD6BA33, 0x6C24CF5C, 0x7A325381, 0x28958677,
+ 0x3B8F4898, 0x6B4BB9AF, 0xC4BFE81B, 0x66282193,
+ 0x61D809CC, 0xFB21A991, 0x487CAC60, 0x5DEC8032,
+ 0xEF845D5D, 0xE98575B1, 0xDC262302, 0xEB651B88,
+ 0x23893E81, 0xD396ACC5, 0x0F6D6FF3, 0x83F44239,
+ 0x2E0B4482, 0xA4842004, 0x69C8F04A, 0x9E1F9B5E,
+ 0x21C66842, 0xF6E96C9A, 0x670C9C61, 0xABD388F0,
+ 0x6A51A0D2, 0xD8542F68, 0x960FA728, 0xAB5133A3,
+ 0x6EEF0B6C, 0x137A3BE4, 0xBA3BF050, 0x7EFB2A98,
+ 0xA1F1651D, 0x39AF0176, 0x66CA593E, 0x82430E88,
+ 0x8CEE8619, 0x456F9FB4, 0x7D84A5C3, 0x3B8B5EBE,
+ 0xE06F75D8, 0x85C12073, 0x401A449F, 0x56C16AA6,
+ 0x4ED3AA62, 0x363F7706, 0x1BFEDF72, 0x429B023D,
+ 0x37D0D724, 0xD00A1248, 0xDB0FEAD3, 0x49F1C09B,
+ 0x075372C9, 0x80991B7B, 0x25D479D8, 0xF6E8DEF7,
+ 0xE3FE501A, 0xB6794C3B, 0x976CE0BD, 0x04C006BA,
+ 0xC1A94FB6, 0x409F60C4, 0x5E5C9EC2, 0x196A2463,
+ 0x68FB6FAF, 0x3E6C53B5, 0x1339B2EB, 0x3B52EC6F,
+ 0x6DFC511F, 0x9B30952C, 0xCC814544, 0xAF5EBD09,
+ 0xBEE3D004, 0xDE334AFD, 0x660F2807, 0x192E4BB3,
+ 0xC0CBA857, 0x45C8740F, 0xD20B5F39, 0xB9D3FBDB,
+ 0x5579C0BD, 0x1A60320A, 0xD6A100C6, 0x402C7279,
+ 0x679F25FE, 0xFB1FA3CC, 0x8EA5E9F8, 0xDB3222F8,
+ 0x3C7516DF, 0xFD616B15, 0x2F501EC8, 0xAD0552AB,
+ 0x323DB5FA, 0xFD238760, 0x53317B48, 0x3E00DF82,
+ 0x9E5C57BB, 0xCA6F8CA0, 0x1A87562E, 0xDF1769DB,
+ 0xD542A8F6, 0x287EFFC3, 0xAC6732C6, 0x8C4F5573,
+ 0x695B27B0, 0xBBCA58C8, 0xE1FFA35D, 0xB8F011A0,
+ 0x10FA3D98, 0xFD2183B8, 0x4AFCB56C, 0x2DD1D35B,
+ 0x9A53E479, 0xB6F84565, 0xD28E49BC, 0x4BFB9790,
+ 0xE1DDF2DA, 0xA4CB7E33, 0x62FB1341, 0xCEE4C6E8,
+ 0xEF20CADA, 0x36774C01, 0xD07E9EFE, 0x2BF11FB4,
+ 0x95DBDA4D, 0xAE909198, 0xEAAD8E71, 0x6B93D5A0,
+ 0xD08ED1D0, 0xAFC725E0, 0x8E3C5B2F, 0x8E7594B7,
+ 0x8FF6E2FB, 0xF2122B64, 0x8888B812, 0x900DF01C,
+ 0x4FAD5EA0, 0x688FC31C, 0xD1CFF191, 0xB3A8C1AD,
+ 0x2F2F2218, 0xBE0E1777, 0xEA752DFE, 0x8B021FA1,
+ 0xE5A0CC0F, 0xB56F74E8, 0x18ACF3D6, 0xCE89E299,
+ 0xB4A84FE0, 0xFD13E0B7, 0x7CC43B81, 0xD2ADA8D9,
+ 0x165FA266, 0x80957705, 0x93CC7314, 0x211A1477,
+ 0xE6AD2065, 0x77B5FA86, 0xC75442F5, 0xFB9D35CF,
+ 0xEBCDAF0C, 0x7B3E89A0, 0xD6411BD3, 0xAE1E7E49,
+ 0x00250E2D, 0x2071B35E, 0x226800BB, 0x57B8E0AF,
+ 0x2464369B, 0xF009B91E, 0x5563911D, 0x59DFA6AA,
+ 0x78C14389, 0xD95A537F, 0x207D5BA2, 0x02E5B9C5,
+ 0x83260376, 0x6295CFA9, 0x11C81968, 0x4E734A41,
+ 0xB3472DCA, 0x7B14A94A, 0x1B510052, 0x9A532915,
+ 0xD60F573F, 0xBC9BC6E4, 0x2B60A476, 0x81E67400,
+ 0x08BA6FB5, 0x571BE91F, 0xF296EC6B, 0x2A0DD915,
+ 0xB6636521, 0xE7B9F9B6, 0xFF34052E, 0xC5855664,
+ 0x53B02D5D, 0xA99F8FA1, 0x08BA4799, 0x6E85076A },
+ { 0x4B7A70E9, 0xB5B32944, 0xDB75092E, 0xC4192623,
+ 0xAD6EA6B0, 0x49A7DF7D, 0x9CEE60B8, 0x8FEDB266,
+ 0xECAA8C71, 0x699A17FF, 0x5664526C, 0xC2B19EE1,
+ 0x193602A5, 0x75094C29, 0xA0591340, 0xE4183A3E,
+ 0x3F54989A, 0x5B429D65, 0x6B8FE4D6, 0x99F73FD6,
+ 0xA1D29C07, 0xEFE830F5, 0x4D2D38E6, 0xF0255DC1,
+ 0x4CDD2086, 0x8470EB26, 0x6382E9C6, 0x021ECC5E,
+ 0x09686B3F, 0x3EBAEFC9, 0x3C971814, 0x6B6A70A1,
+ 0x687F3584, 0x52A0E286, 0xB79C5305, 0xAA500737,
+ 0x3E07841C, 0x7FDEAE5C, 0x8E7D44EC, 0x5716F2B8,
+ 0xB03ADA37, 0xF0500C0D, 0xF01C1F04, 0x0200B3FF,
+ 0xAE0CF51A, 0x3CB574B2, 0x25837A58, 0xDC0921BD,
+ 0xD19113F9, 0x7CA92FF6, 0x94324773, 0x22F54701,
+ 0x3AE5E581, 0x37C2DADC, 0xC8B57634, 0x9AF3DDA7,
+ 0xA9446146, 0x0FD0030E, 0xECC8C73E, 0xA4751E41,
+ 0xE238CD99, 0x3BEA0E2F, 0x3280BBA1, 0x183EB331,
+ 0x4E548B38, 0x4F6DB908, 0x6F420D03, 0xF60A04BF,
+ 0x2CB81290, 0x24977C79, 0x5679B072, 0xBCAF89AF,
+ 0xDE9A771F, 0xD9930810, 0xB38BAE12, 0xDCCF3F2E,
+ 0x5512721F, 0x2E6B7124, 0x501ADDE6, 0x9F84CD87,
+ 0x7A584718, 0x7408DA17, 0xBC9F9ABC, 0xE94B7D8C,
+ 0xEC7AEC3A, 0xDB851DFA, 0x63094366, 0xC464C3D2,
+ 0xEF1C1847, 0x3215D908, 0xDD433B37, 0x24C2BA16,
+ 0x12A14D43, 0x2A65C451, 0x50940002, 0x133AE4DD,
+ 0x71DFF89E, 0x10314E55, 0x81AC77D6, 0x5F11199B,
+ 0x043556F1, 0xD7A3C76B, 0x3C11183B, 0x5924A509,
+ 0xF28FE6ED, 0x97F1FBFA, 0x9EBABF2C, 0x1E153C6E,
+ 0x86E34570, 0xEAE96FB1, 0x860E5E0A, 0x5A3E2AB3,
+ 0x771FE71C, 0x4E3D06FA, 0x2965DCB9, 0x99E71D0F,
+ 0x803E89D6, 0x5266C825, 0x2E4CC978, 0x9C10B36A,
+ 0xC6150EBA, 0x94E2EA78, 0xA5FC3C53, 0x1E0A2DF4,
+ 0xF2F74EA7, 0x361D2B3D, 0x1939260F, 0x19C27960,
+ 0x5223A708, 0xF71312B6, 0xEBADFE6E, 0xEAC31F66,
+ 0xE3BC4595, 0xA67BC883, 0xB17F37D1, 0x018CFF28,
+ 0xC332DDEF, 0xBE6C5AA5, 0x65582185, 0x68AB9802,
+ 0xEECEA50F, 0xDB2F953B, 0x2AEF7DAD, 0x5B6E2F84,
+ 0x1521B628, 0x29076170, 0xECDD4775, 0x619F1510,
+ 0x13CCA830, 0xEB61BD96, 0x0334FE1E, 0xAA0363CF,
+ 0xB5735C90, 0x4C70A239, 0xD59E9E0B, 0xCBAADE14,
+ 0xEECC86BC, 0x60622CA7, 0x9CAB5CAB, 0xB2F3846E,
+ 0x648B1EAF, 0x19BDF0CA, 0xA02369B9, 0x655ABB50,
+ 0x40685A32, 0x3C2AB4B3, 0x319EE9D5, 0xC021B8F7,
+ 0x9B540B19, 0x875FA099, 0x95F7997E, 0x623D7DA8,
+ 0xF837889A, 0x97E32D77, 0x11ED935F, 0x16681281,
+ 0x0E358829, 0xC7E61FD6, 0x96DEDFA1, 0x7858BA99,
+ 0x57F584A5, 0x1B227263, 0x9B83C3FF, 0x1AC24696,
+ 0xCDB30AEB, 0x532E3054, 0x8FD948E4, 0x6DBC3128,
+ 0x58EBF2EF, 0x34C6FFEA, 0xFE28ED61, 0xEE7C3C73,
+ 0x5D4A14D9, 0xE864B7E3, 0x42105D14, 0x203E13E0,
+ 0x45EEE2B6, 0xA3AAABEA, 0xDB6C4F15, 0xFACB4FD0,
+ 0xC742F442, 0xEF6ABBB5, 0x654F3B1D, 0x41CD2105,
+ 0xD81E799E, 0x86854DC7, 0xE44B476A, 0x3D816250,
+ 0xCF62A1F2, 0x5B8D2646, 0xFC8883A0, 0xC1C7B6A3,
+ 0x7F1524C3, 0x69CB7492, 0x47848A0B, 0x5692B285,
+ 0x095BBF00, 0xAD19489D, 0x1462B174, 0x23820E00,
+ 0x58428D2A, 0x0C55F5EA, 0x1DADF43E, 0x233F7061,
+ 0x3372F092, 0x8D937E41, 0xD65FECF1, 0x6C223BDB,
+ 0x7CDE3759, 0xCBEE7460, 0x4085F2A7, 0xCE77326E,
+ 0xA6078084, 0x19F8509E, 0xE8EFD855, 0x61D99735,
+ 0xA969A7AA, 0xC50C06C2, 0x5A04ABFC, 0x800BCADC,
+ 0x9E447A2E, 0xC3453484, 0xFDD56705, 0x0E1E9EC9,
+ 0xDB73DBD3, 0x105588CD, 0x675FDA79, 0xE3674340,
+ 0xC5C43465, 0x713E38D8, 0x3D28F89E, 0xF16DFF20,
+ 0x153E21E7, 0x8FB03D4A, 0xE6E39F2B, 0xDB83ADF7 },
+ { 0xE93D5A68, 0x948140F7, 0xF64C261C, 0x94692934,
+ 0x411520F7, 0x7602D4F7, 0xBCF46B2E, 0xD4A20068,
+ 0xD4082471, 0x3320F46A, 0x43B7D4B7, 0x500061AF,
+ 0x1E39F62E, 0x97244546, 0x14214F74, 0xBF8B8840,
+ 0x4D95FC1D, 0x96B591AF, 0x70F4DDD3, 0x66A02F45,
+ 0xBFBC09EC, 0x03BD9785, 0x7FAC6DD0, 0x31CB8504,
+ 0x96EB27B3, 0x55FD3941, 0xDA2547E6, 0xABCA0A9A,
+ 0x28507825, 0x530429F4, 0x0A2C86DA, 0xE9B66DFB,
+ 0x68DC1462, 0xD7486900, 0x680EC0A4, 0x27A18DEE,
+ 0x4F3FFEA2, 0xE887AD8C, 0xB58CE006, 0x7AF4D6B6,
+ 0xAACE1E7C, 0xD3375FEC, 0xCE78A399, 0x406B2A42,
+ 0x20FE9E35, 0xD9F385B9, 0xEE39D7AB, 0x3B124E8B,
+ 0x1DC9FAF7, 0x4B6D1856, 0x26A36631, 0xEAE397B2,
+ 0x3A6EFA74, 0xDD5B4332, 0x6841E7F7, 0xCA7820FB,
+ 0xFB0AF54E, 0xD8FEB397, 0x454056AC, 0xBA489527,
+ 0x55533A3A, 0x20838D87, 0xFE6BA9B7, 0xD096954B,
+ 0x55A867BC, 0xA1159A58, 0xCCA92963, 0x99E1DB33,
+ 0xA62A4A56, 0x3F3125F9, 0x5EF47E1C, 0x9029317C,
+ 0xFDF8E802, 0x04272F70, 0x80BB155C, 0x05282CE3,
+ 0x95C11548, 0xE4C66D22, 0x48C1133F, 0xC70F86DC,
+ 0x07F9C9EE, 0x41041F0F, 0x404779A4, 0x5D886E17,
+ 0x325F51EB, 0xD59BC0D1, 0xF2BCC18F, 0x41113564,
+ 0x257B7834, 0x602A9C60, 0xDFF8E8A3, 0x1F636C1B,
+ 0x0E12B4C2, 0x02E1329E, 0xAF664FD1, 0xCAD18115,
+ 0x6B2395E0, 0x333E92E1, 0x3B240B62, 0xEEBEB922,
+ 0x85B2A20E, 0xE6BA0D99, 0xDE720C8C, 0x2DA2F728,
+ 0xD0127845, 0x95B794FD, 0x647D0862, 0xE7CCF5F0,
+ 0x5449A36F, 0x877D48FA, 0xC39DFD27, 0xF33E8D1E,
+ 0x0A476341, 0x992EFF74, 0x3A6F6EAB, 0xF4F8FD37,
+ 0xA812DC60, 0xA1EBDDF8, 0x991BE14C, 0xDB6E6B0D,
+ 0xC67B5510, 0x6D672C37, 0x2765D43B, 0xDCD0E804,
+ 0xF1290DC7, 0xCC00FFA3, 0xB5390F92, 0x690FED0B,
+ 0x667B9FFB, 0xCEDB7D9C, 0xA091CF0B, 0xD9155EA3,
+ 0xBB132F88, 0x515BAD24, 0x7B9479BF, 0x763BD6EB,
+ 0x37392EB3, 0xCC115979, 0x8026E297, 0xF42E312D,
+ 0x6842ADA7, 0xC66A2B3B, 0x12754CCC, 0x782EF11C,
+ 0x6A124237, 0xB79251E7, 0x06A1BBE6, 0x4BFB6350,
+ 0x1A6B1018, 0x11CAEDFA, 0x3D25BDD8, 0xE2E1C3C9,
+ 0x44421659, 0x0A121386, 0xD90CEC6E, 0xD5ABEA2A,
+ 0x64AF674E, 0xDA86A85F, 0xBEBFE988, 0x64E4C3FE,
+ 0x9DBC8057, 0xF0F7C086, 0x60787BF8, 0x6003604D,
+ 0xD1FD8346, 0xF6381FB0, 0x7745AE04, 0xD736FCCC,
+ 0x83426B33, 0xF01EAB71, 0xB0804187, 0x3C005E5F,
+ 0x77A057BE, 0xBDE8AE24, 0x55464299, 0xBF582E61,
+ 0x4E58F48F, 0xF2DDFDA2, 0xF474EF38, 0x8789BDC2,
+ 0x5366F9C3, 0xC8B38E74, 0xB475F255, 0x46FCD9B9,
+ 0x7AEB2661, 0x8B1DDF84, 0x846A0E79, 0x915F95E2,
+ 0x466E598E, 0x20B45770, 0x8CD55591, 0xC902DE4C,
+ 0xB90BACE1, 0xBB8205D0, 0x11A86248, 0x7574A99E,
+ 0xB77F19B6, 0xE0A9DC09, 0x662D09A1, 0xC4324633,
+ 0xE85A1F02, 0x09F0BE8C, 0x4A99A025, 0x1D6EFE10,
+ 0x1AB93D1D, 0x0BA5A4DF, 0xA186F20F, 0x2868F169,
+ 0xDCB7DA83, 0x573906FE, 0xA1E2CE9B, 0x4FCD7F52,
+ 0x50115E01, 0xA70683FA, 0xA002B5C4, 0x0DE6D027,
+ 0x9AF88C27, 0x773F8641, 0xC3604C06, 0x61A806B5,
+ 0xF0177A28, 0xC0F586E0, 0x006058AA, 0x30DC7D62,
+ 0x11E69ED7, 0x2338EA63, 0x53C2DD94, 0xC2C21634,
+ 0xBBCBEE56, 0x90BCB6DE, 0xEBFC7DA1, 0xCE591D76,
+ 0x6F05E409, 0x4B7C0188, 0x39720A3D, 0x7C927C24,
+ 0x86E3725F, 0x724D9DB9, 0x1AC15BB4, 0xD39EB8FC,
+ 0xED545578, 0x08FCA5B5, 0xD83D7CD3, 0x4DAD0FC4,
+ 0x1E50EF5E, 0xB161E6F8, 0xA28514D9, 0x6C51133C,
+ 0x6FD5C7E7, 0x56E14EC4, 0x362ABFCE, 0xDDC6C837,
+ 0xD79A3234, 0x92638212, 0x670EFA8E, 0x406000E0 },
+ { 0x3A39CE37, 0xD3FAF5CF, 0xABC27737, 0x5AC52D1B,
+ 0x5CB0679E, 0x4FA33742, 0xD3822740, 0x99BC9BBE,
+ 0xD5118E9D, 0xBF0F7315, 0xD62D1C7E, 0xC700C47B,
+ 0xB78C1B6B, 0x21A19045, 0xB26EB1BE, 0x6A366EB4,
+ 0x5748AB2F, 0xBC946E79, 0xC6A376D2, 0x6549C2C8,
+ 0x530FF8EE, 0x468DDE7D, 0xD5730A1D, 0x4CD04DC6,
+ 0x2939BBDB, 0xA9BA4650, 0xAC9526E8, 0xBE5EE304,
+ 0xA1FAD5F0, 0x6A2D519A, 0x63EF8CE2, 0x9A86EE22,
+ 0xC089C2B8, 0x43242EF6, 0xA51E03AA, 0x9CF2D0A4,
+ 0x83C061BA, 0x9BE96A4D, 0x8FE51550, 0xBA645BD6,
+ 0x2826A2F9, 0xA73A3AE1, 0x4BA99586, 0xEF5562E9,
+ 0xC72FEFD3, 0xF752F7DA, 0x3F046F69, 0x77FA0A59,
+ 0x80E4A915, 0x87B08601, 0x9B09E6AD, 0x3B3EE593,
+ 0xE990FD5A, 0x9E34D797, 0x2CF0B7D9, 0x022B8B51,
+ 0x96D5AC3A, 0x017DA67D, 0xD1CF3ED6, 0x7C7D2D28,
+ 0x1F9F25CF, 0xADF2B89B, 0x5AD6B472, 0x5A88F54C,
+ 0xE029AC71, 0xE019A5E6, 0x47B0ACFD, 0xED93FA9B,
+ 0xE8D3C48D, 0x283B57CC, 0xF8D56629, 0x79132E28,
+ 0x785F0191, 0xED756055, 0xF7960E44, 0xE3D35E8C,
+ 0x15056DD4, 0x88F46DBA, 0x03A16125, 0x0564F0BD,
+ 0xC3EB9E15, 0x3C9057A2, 0x97271AEC, 0xA93A072A,
+ 0x1B3F6D9B, 0x1E6321F5, 0xF59C66FB, 0x26DCF319,
+ 0x7533D928, 0xB155FDF5, 0x03563482, 0x8ABA3CBB,
+ 0x28517711, 0xC20AD9F8, 0xABCC5167, 0xCCAD925F,
+ 0x4DE81751, 0x3830DC8E, 0x379D5862, 0x9320F991,
+ 0xEA7A90C2, 0xFB3E7BCE, 0x5121CE64, 0x774FBE32,
+ 0xA8B6E37E, 0xC3293D46, 0x48DE5369, 0x6413E680,
+ 0xA2AE0810, 0xDD6DB224, 0x69852DFD, 0x09072166,
+ 0xB39A460A, 0x6445C0DD, 0x586CDECF, 0x1C20C8AE,
+ 0x5BBEF7DD, 0x1B588D40, 0xCCD2017F, 0x6BB4E3BB,
+ 0xDDA26A7E, 0x3A59FF45, 0x3E350A44, 0xBCB4CDD5,
+ 0x72EACEA8, 0xFA6484BB, 0x8D6612AE, 0xBF3C6F47,
+ 0xD29BE463, 0x542F5D9E, 0xAEC2771B, 0xF64E6370,
+ 0x740E0D8D, 0xE75B1357, 0xF8721671, 0xAF537D5D,
+ 0x4040CB08, 0x4EB4E2CC, 0x34D2466A, 0x0115AF84,
+ 0xE1B00428, 0x95983A1D, 0x06B89FB4, 0xCE6EA048,
+ 0x6F3F3B82, 0x3520AB82, 0x011A1D4B, 0x277227F8,
+ 0x611560B1, 0xE7933FDC, 0xBB3A792B, 0x344525BD,
+ 0xA08839E1, 0x51CE794B, 0x2F32C9B7, 0xA01FBAC9,
+ 0xE01CC87E, 0xBCC7D1F6, 0xCF0111C3, 0xA1E8AAC7,
+ 0x1A908749, 0xD44FBD9A, 0xD0DADECB, 0xD50ADA38,
+ 0x0339C32A, 0xC6913667, 0x8DF9317C, 0xE0B12B4F,
+ 0xF79E59B7, 0x43F5BB3A, 0xF2D519FF, 0x27D9459C,
+ 0xBF97222C, 0x15E6FC2A, 0x0F91FC71, 0x9B941525,
+ 0xFAE59361, 0xCEB69CEB, 0xC2A86459, 0x12BAA8D1,
+ 0xB6C1075E, 0xE3056A0C, 0x10D25065, 0xCB03A442,
+ 0xE0EC6E0E, 0x1698DB3B, 0x4C98A0BE, 0x3278E964,
+ 0x9F1F9532, 0xE0D392DF, 0xD3A0342B, 0x8971F21E,
+ 0x1B0A7441, 0x4BA3348C, 0xC5BE7120, 0xC37632D8,
+ 0xDF359F8D, 0x9B992F2E, 0xE60B6F47, 0x0FE3F11D,
+ 0xE54CDA54, 0x1EDAD891, 0xCE6279CF, 0xCD3E7E6F,
+ 0x1618B166, 0xFD2C1D05, 0x848FD2C5, 0xF6FB2299,
+ 0xF523F357, 0xA6327623, 0x93A83531, 0x56CCCD02,
+ 0xACF08162, 0x5A75EBB5, 0x6E163697, 0x88D273CC,
+ 0xDE966292, 0x81B949D0, 0x4C50901B, 0x71C65614,
+ 0xE6C6C7BD, 0x327A140A, 0x45E1D006, 0xC3F27B9A,
+ 0xC9AA53FD, 0x62A80F00, 0xBB25BFE2, 0x35BDD2F6,
+ 0x71126905, 0xB2040222, 0xB6CBCF7C, 0xCD769C2B,
+ 0x53113EC0, 0x1640E3D3, 0x38ABBD60, 0x2547ADF0,
+ 0xBA38209C, 0xF746CE76, 0x77AFA1C5, 0x20756060,
+ 0x85CBFE4E, 0x8AE88DD8, 0x7AAAF9B0, 0x4CF9AA7E,
+ 0x1948C25C, 0x02FB8A8C, 0x01C36AE4, 0xD6EBE1F9,
+ 0x90D4F869, 0xA65CDEA0, 0x3F09252D, 0xC208E69F,
+ 0xB74E6132, 0xCE77E25B, 0x578FDFE3, 0x3AC372E6 }
+};
+
+static void F(AVBlowfish *ctx, uint32_t *xl, uint32_t *xr, int i)
+{
+ uint32_t Xl, Xr;
+ uint32_t y;
+
+ Xl = *xl;
+ Xr = *xr;
+
+ Xl ^= ctx->p[i];
+ y = ctx->s[0][(Xl >> 24) & 0xFF];
+ y += ctx->s[1][(Xl >> 16) & 0xFF];
+ y ^= ctx->s[2][(Xl >> 8) & 0xFF];
+ y += ctx->s[3][ Xl & 0xFF];
+ Xr ^= y;
+
+ *xl = Xr;
+ *xr = Xl;
+}
+
+av_cold void av_blowfish_init(AVBlowfish *ctx, const uint8_t *key, int key_len)
+{
+ uint32_t data, data_l, data_r;
+ int i, j, k;
+
+ memcpy(ctx->s, orig_s, sizeof(orig_s));
+
+ j = 0;
+ for (i = 0; i < AV_BF_ROUNDS + 2; ++i) {
+ data = 0;
+ for (k = 0; k < 4; k++) {
+ data = (data << 8) | key[j];
+ if (++j >= key_len)
+ j = 0;
+ }
+ ctx->p[i] = orig_p[i] ^ data;
+ }
+
+ data_l = data_r = 0;
+
+ for (i = 0; i < AV_BF_ROUNDS + 2; i += 2) {
+ av_blowfish_crypt_ecb(ctx, &data_l, &data_r, 0);
+ ctx->p[i] = data_l;
+ ctx->p[i + 1] = data_r;
+ }
+
+ for (i = 0; i < 4; ++i) {
+ for (j = 0; j < 256; j += 2) {
+ av_blowfish_crypt_ecb(ctx, &data_l, &data_r, 0);
+ ctx->s[i][j] = data_l;
+ ctx->s[i][j + 1] = data_r;
+ }
+ }
+}
+
+void av_blowfish_crypt_ecb(AVBlowfish *ctx, uint32_t *xl, uint32_t *xr,
+ int decrypt)
+{
+ uint32_t Xl, Xr;
+ int i;
+
+ Xl = *xl;
+ Xr = *xr;
+
+ if (decrypt) {
+ for (i = AV_BF_ROUNDS + 1; i > 1; --i)
+ F(ctx, &Xl, &Xr, i);
+
+ Xl = Xl ^ ctx->p[1];
+ Xr = Xr ^ ctx->p[0];
+ } else {
+ for (i = 0; i < AV_BF_ROUNDS; ++i)
+ F(ctx, &Xl, &Xr, i);
+
+ Xl = Xl ^ ctx->p[AV_BF_ROUNDS];
+ Xr = Xr ^ ctx->p[AV_BF_ROUNDS + 1];
+ }
+
+ *xl = Xr;
+ *xr = Xl;
+}
+
+void av_blowfish_crypt(AVBlowfish *ctx, uint8_t *dst, const uint8_t *src,
+ int count, uint8_t *iv, int decrypt)
+{
+ uint32_t v0, v1;
+ int i;
+
+ if (decrypt) {
+ while (count--) {
+ v0 = AV_RB32(src);
+ v1 = AV_RB32(src + 4);
+
+ av_blowfish_crypt_ecb(ctx, &v0, &v1, decrypt);
+
+ if (iv) {
+ v0 ^= AV_RB32(iv);
+ v1 ^= AV_RB32(iv + 4);
+ memcpy(iv, src, 8);
+ }
+
+ AV_WB32(dst, v0);
+ AV_WB32(dst + 4, v1);
+
+ src += 8;
+ dst += 8;
+ }
+ } else {
+ while (count--) {
+ if (iv) {
+ for (i = 0; i < 8; i++)
+ dst[i] = src[i] ^ iv[i];
+ v0 = AV_RB32(dst);
+ v1 = AV_RB32(dst + 4);
+ } else {
+ v0 = AV_RB32(src);
+ v1 = AV_RB32(src + 4);
+ }
+
+ av_blowfish_crypt_ecb(ctx, &v0, &v1, decrypt);
+
+ AV_WB32(dst, v0);
+ AV_WB32(dst + 4, v1);
+
+ if (iv)
+ memcpy(iv, dst, 8);
+
+ src += 8;
+ dst += 8;
+ }
+ }
+}
+
+#ifdef TEST
+#include <stdio.h>
+
+#define NUM_VARIABLE_KEY_TESTS 34
+
+/* plaintext bytes -- left halves */
+static const uint32_t plaintext_l[NUM_VARIABLE_KEY_TESTS] = {
+ 0x00000000, 0xFFFFFFFF, 0x10000000, 0x11111111, 0x11111111,
+ 0x01234567, 0x00000000, 0x01234567, 0x01A1D6D0, 0x5CD54CA8,
+ 0x0248D438, 0x51454B58, 0x42FD4430, 0x059B5E08, 0x0756D8E0,
+ 0x762514B8, 0x3BDD1190, 0x26955F68, 0x164D5E40, 0x6B056E18,
+ 0x004BD6EF, 0x480D3900, 0x437540C8, 0x072D43A0, 0x02FE5577,
+ 0x1D9D5C50, 0x30553228, 0x01234567, 0x01234567, 0x01234567,
+ 0xFFFFFFFF, 0x00000000, 0x00000000, 0xFFFFFFFF
+};
+
+/* plaintext bytes -- right halves */
+static const uint32_t plaintext_r[NUM_VARIABLE_KEY_TESTS] = {
+ 0x00000000, 0xFFFFFFFF, 0x00000001, 0x11111111, 0x11111111,
+ 0x89ABCDEF, 0x00000000, 0x89ABCDEF, 0x39776742, 0x3DEF57DA,
+ 0x06F67172, 0x2DDF440A, 0x59577FA2, 0x51CF143A, 0x774761D2,
+ 0x29BF486A, 0x49372802, 0x35AF609A, 0x4F275232, 0x759F5CCA,
+ 0x09176062, 0x6EE762F2, 0x698F3CFA, 0x77075292, 0x8117F12A,
+ 0x18F728C2, 0x6D6F295A, 0x89ABCDEF, 0x89ABCDEF, 0x89ABCDEF,
+ 0xFFFFFFFF, 0x00000000, 0x00000000, 0xFFFFFFFF
+};
+
+/* key bytes for variable key tests */
+static const uint8_t variable_key[NUM_VARIABLE_KEY_TESTS][8] = {
+ { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
+ { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF },
+ { 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
+ { 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 },
+ { 0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF },
+ { 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 },
+ { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
+ { 0xFE, 0xDC, 0xBA, 0x98, 0x76, 0x54, 0x32, 0x10 },
+ { 0x7C, 0xA1, 0x10, 0x45, 0x4A, 0x1A, 0x6E, 0x57 },
+ { 0x01, 0x31, 0xD9, 0x61, 0x9D, 0xC1, 0x37, 0x6E },
+ { 0x07, 0xA1, 0x13, 0x3E, 0x4A, 0x0B, 0x26, 0x86 },
+ { 0x38, 0x49, 0x67, 0x4C, 0x26, 0x02, 0x31, 0x9E },
+ { 0x04, 0xB9, 0x15, 0xBA, 0x43, 0xFE, 0xB5, 0xB6 },
+ { 0x01, 0x13, 0xB9, 0x70, 0xFD, 0x34, 0xF2, 0xCE },
+ { 0x01, 0x70, 0xF1, 0x75, 0x46, 0x8F, 0xB5, 0xE6 },
+ { 0x43, 0x29, 0x7F, 0xAD, 0x38, 0xE3, 0x73, 0xFE },
+ { 0x07, 0xA7, 0x13, 0x70, 0x45, 0xDA, 0x2A, 0x16 },
+ { 0x04, 0x68, 0x91, 0x04, 0xC2, 0xFD, 0x3B, 0x2F },
+ { 0x37, 0xD0, 0x6B, 0xB5, 0x16, 0xCB, 0x75, 0x46 },
+ { 0x1F, 0x08, 0x26, 0x0D, 0x1A, 0xC2, 0x46, 0x5E },
+ { 0x58, 0x40, 0x23, 0x64, 0x1A, 0xBA, 0x61, 0x76 },
+ { 0x02, 0x58, 0x16, 0x16, 0x46, 0x29, 0xB0, 0x07 },
+ { 0x49, 0x79, 0x3E, 0xBC, 0x79, 0xB3, 0x25, 0x8F },
+ { 0x4F, 0xB0, 0x5E, 0x15, 0x15, 0xAB, 0x73, 0xA7 },
+ { 0x49, 0xE9, 0x5D, 0x6D, 0x4C, 0xA2, 0x29, 0xBF },
+ { 0x01, 0x83, 0x10, 0xDC, 0x40, 0x9B, 0x26, 0xD6 },
+ { 0x1C, 0x58, 0x7F, 0x1C, 0x13, 0x92, 0x4F, 0xEF },
+ { 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 },
+ { 0x1F, 0x1F, 0x1F, 0x1F, 0x0E, 0x0E, 0x0E, 0x0E },
+ { 0xE0, 0xFE, 0xE0, 0xFE, 0xF1, 0xFE, 0xF1, 0xFE },
+ { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
+ { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF },
+ { 0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF },
+ { 0xFE, 0xDC, 0xBA, 0x98, 0x76, 0x54, 0x32, 0x10 }
+};
+
+/* ciphertext bytes -- left halves */
+static const uint32_t ciphertext_l[NUM_VARIABLE_KEY_TESTS] = {
+ 0x4EF99745, 0x51866FD5, 0x7D856F9A, 0x2466DD87, 0x61F9C380,
+ 0x7D0CC630, 0x4EF99745, 0x0ACEAB0F, 0x59C68245, 0xB1B8CC0B,
+ 0x1730E577, 0xA25E7856, 0x353882B1, 0x48F4D088, 0x432193B7,
+ 0x13F04154, 0x2EEDDA93, 0xD887E039, 0x5F99D04F, 0x4A057A3B,
+ 0x452031C1, 0x7555AE39, 0x53C55F9C, 0x7A8E7BFA, 0xCF9C5D7A,
+ 0xD1ABB290, 0x55CB3774, 0xFA34EC48, 0xA7907951, 0xC39E072D,
+ 0x014933E0, 0xF21E9A77, 0x24594688, 0x6B5C5A9C
+};
+
+/* ciphertext bytes -- right halves */
+static const uint32_t ciphertext_r[NUM_VARIABLE_KEY_TESTS] = {
+ 0x6198DD78, 0xB85ECB8A, 0x613063F2, 0x8B963C9D, 0x2281B096,
+ 0xAFDA1EC7, 0x6198DD78, 0xC6A0A28D, 0xEB05282B, 0x250F09A0,
+ 0x8BEA1DA4, 0xCF2651EB, 0x09CE8F1A, 0x4C379918, 0x8951FC98,
+ 0xD69D1AE5, 0xFFD39C79, 0x3C2DA6E3, 0x5B163969, 0x24D3977B,
+ 0xE4FADA8E, 0xF59B87BD, 0xB49FC019, 0x937E89A3, 0x4986ADB5,
+ 0x658BC778, 0xD13EF201, 0x47B268B2, 0x08EA3CAE, 0x9FAC631D,
+ 0xCDAFF6E4, 0xB71C49BC, 0x5754369A, 0x5D9E0A5A
+};
+
+/* plaintext bytes */
+static const uint8_t plaintext[8] = "BLOWFISH";
+
+static const uint8_t plaintext2[16] = "BLOWFISHBLOWFISH";
+
+/* ciphertext bytes */
+static const uint8_t ciphertext[8] = {
+ 0x32, 0x4E, 0xD0, 0xFE, 0xF4, 0x13, 0xA2, 0x03
+};
+
+static const uint8_t ciphertext2[16] = {
+ 0x53, 0x00, 0x40, 0x06, 0x63, 0xf2, 0x1d, 0x99,
+ 0x3b, 0x9b, 0x27, 0x64, 0x46, 0xfd, 0x20, 0xc1,
+};
+
+#define IV "blowfish"
+
+static void test_blowfish(AVBlowfish *ctx, uint8_t *dst, const uint8_t *src,
+ const uint8_t *ref, int len, uint8_t *iv, int dir,
+ const char *test)
+{
+ av_blowfish_crypt(ctx, dst, src, len, iv, dir);
+ if (memcmp(dst, ref, 8*len)) {
+ int i;
+ printf("%s failed\ngot ", test);
+ for (i = 0; i < 8*len; i++)
+ printf("%02x ", dst[i]);
+ printf("\nexpected ");
+ for (i = 0; i < 8*len; i++)
+ printf("%02x ", ref[i]);
+ printf("\n");
+ exit(1);
+ }
+}
+
+int main(void)
+{
+ AVBlowfish ctx;
+ uint32_t tmptext_l[NUM_VARIABLE_KEY_TESTS];
+ uint32_t tmptext_r[NUM_VARIABLE_KEY_TESTS];
+ uint8_t tmp[16], iv[8];
+ int i;
+
+ av_blowfish_init(&ctx, "abcdefghijklmnopqrstuvwxyz", 26);
+
+ test_blowfish(&ctx, tmp, plaintext, ciphertext, 1, NULL, 0, "encryption");
+ test_blowfish(&ctx, tmp, ciphertext, plaintext, 1, NULL, 1, "decryption");
+ test_blowfish(&ctx, tmp, tmp, ciphertext, 1, NULL, 0, "Inplace encryption");
+ test_blowfish(&ctx, tmp, tmp, plaintext, 1, NULL, 1, "Inplace decryption");
+ memcpy(iv, IV, 8);
+ test_blowfish(&ctx, tmp, plaintext2, ciphertext2, 2, iv, 0, "CBC encryption");
+ memcpy(iv, IV, 8);
+ test_blowfish(&ctx, tmp, ciphertext2, plaintext2, 2, iv, 1, "CBC decryption");
+ memcpy(iv, IV, 8);
+ test_blowfish(&ctx, tmp, tmp, ciphertext2, 2, iv, 0, "Inplace CBC encryption");
+ memcpy(iv, IV, 8);
+ test_blowfish(&ctx, tmp, tmp, plaintext2, 2, iv, 1, "Inplace CBC decryption");
+
+ memcpy(tmptext_l, plaintext_l, sizeof(*plaintext_l) * NUM_VARIABLE_KEY_TESTS);
+ memcpy(tmptext_r, plaintext_r, sizeof(*plaintext_r) * NUM_VARIABLE_KEY_TESTS);
+
+ for (i = 0; i < NUM_VARIABLE_KEY_TESTS; i++) {
+ av_blowfish_init(&ctx, variable_key[i], 8);
+
+ av_blowfish_crypt_ecb(&ctx, &tmptext_l[i], &tmptext_r[i], 0);
+ if (tmptext_l[i] != ciphertext_l[i] || tmptext_r[i] != ciphertext_r[i]) {
+ printf("Test encryption failed.\n");
+ return 1;
+ }
+
+ av_blowfish_crypt_ecb(&ctx, &tmptext_l[i], &tmptext_r[i], 1);
+ if (tmptext_l[i] != plaintext_l[i] || tmptext_r[i] != plaintext_r[i]) {
+ printf("Test decryption failed.\n");
+ return 1;
+ }
+ }
+ printf("Test encryption/decryption success.\n");
+
+ return 0;
+}
+
+#endif
diff --git a/gst-libs/ext/libav/libavutil/blowfish.h b/gst-libs/ext/libav/libavutil/blowfish.h
new file mode 100644
index 0000000..8c29536
--- /dev/null
+++ b/gst-libs/ext/libav/libavutil/blowfish.h
@@ -0,0 +1,76 @@
+/*
+ * Blowfish algorithm
+ *
+ * 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
+ */
+
+#ifndef AVUTIL_BLOWFISH_H
+#define AVUTIL_BLOWFISH_H
+
+#include <stdint.h>
+
+/**
+ * @defgroup lavu_blowfish Blowfish
+ * @ingroup lavu_crypto
+ * @{
+ */
+
+#define AV_BF_ROUNDS 16
+
+typedef struct AVBlowfish {
+ uint32_t p[AV_BF_ROUNDS + 2];
+ uint32_t s[4][256];
+} AVBlowfish;
+
+/**
+ * Initialize an AVBlowfish context.
+ *
+ * @param ctx an AVBlowfish context
+ * @param key a key
+ * @param key_len length of the key
+ */
+void av_blowfish_init(struct AVBlowfish *ctx, const uint8_t *key, int key_len);
+
+/**
+ * Encrypt or decrypt a buffer using a previously initialized context.
+ *
+ * @param ctx an AVBlowfish context
+ * @param xl left four bytes halves of input to be encrypted
+ * @param xr right four bytes halves of input to be encrypted
+ * @param decrypt 0 for encryption, 1 for decryption
+ */
+void av_blowfish_crypt_ecb(struct AVBlowfish *ctx, uint32_t *xl, uint32_t *xr,
+ int decrypt);
+
+/**
+ * Encrypt or decrypt a buffer using a previously initialized context.
+ *
+ * @param ctx an AVBlowfish context
+ * @param dst destination array, can be equal to src
+ * @param src source array, can be equal to dst
+ * @param count number of 8 byte blocks
+ * @param iv initialization vector for CBC mode, if NULL ECB will be used
+ * @param decrypt 0 for encryption, 1 for decryption
+ */
+void av_blowfish_crypt(struct AVBlowfish *ctx, uint8_t *dst, const uint8_t *src,
+ int count, uint8_t *iv, int decrypt);
+
+/**
+ * @}
+ */
+
+#endif /* AVUTIL_BLOWFISH_H */
diff --git a/gst-libs/ext/libav/libavutil/channel_layout.c b/gst-libs/ext/libav/libavutil/channel_layout.c
new file mode 100644
index 0000000..79e398e
--- /dev/null
+++ b/gst-libs/ext/libav/libavutil/channel_layout.c
@@ -0,0 +1,231 @@
+/*
+ * Copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at>
+ *
+ * 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
+ * audio channel layout utility functions
+ */
+
+#include "avstring.h"
+#include "avutil.h"
+#include "channel_layout.h"
+#include "common.h"
+
+static const char * const channel_names[] = {
+ [0] = "FL", /* front left */
+ [1] = "FR", /* front right */
+ [2] = "FC", /* front center */
+ [3] = "LFE", /* low frequency */
+ [4] = "BL", /* back left */
+ [5] = "BR", /* back right */
+ [6] = "FLC", /* front left-of-center */
+ [7] = "FRC", /* front right-of-center */
+ [8] = "BC", /* back-center */
+ [9] = "SL", /* side left */
+ [10] = "SR", /* side right */
+ [11] = "TC", /* top center */
+ [12] = "TFL", /* top front left */
+ [13] = "TFC", /* top front center */
+ [14] = "TFR", /* top front right */
+ [15] = "TBL", /* top back left */
+ [16] = "TBC", /* top back center */
+ [17] = "TBR", /* top back right */
+ [29] = "DL", /* downmix left */
+ [30] = "DR", /* downmix right */
+ [31] = "WL", /* wide left */
+ [32] = "WR", /* wide right */
+ [33] = "SDL", /* surround direct left */
+ [34] = "SDR", /* surround direct right */
+ [35] = "LFE2", /* low frequency 2 */
+};
+
+static const char *get_channel_name(int channel_id)
+{
+ if (channel_id < 0 || channel_id >= FF_ARRAY_ELEMS(channel_names))
+ return NULL;
+ return channel_names[channel_id];
+}
+
+static const struct {
+ const char *name;
+ int nb_channels;
+ uint64_t layout;
+} channel_layout_map[] = {
+ { "mono", 1, AV_CH_LAYOUT_MONO },
+ { "stereo", 2, AV_CH_LAYOUT_STEREO },
+ { "stereo", 2, AV_CH_LAYOUT_STEREO_DOWNMIX },
+ { "2.1", 3, AV_CH_LAYOUT_2POINT1 },
+ { "3.0", 3, AV_CH_LAYOUT_SURROUND },
+ { "3.0(back)", 3, AV_CH_LAYOUT_2_1 },
+ { "3.1", 4, AV_CH_LAYOUT_3POINT1 },
+ { "4.0", 4, AV_CH_LAYOUT_4POINT0 },
+ { "quad", 4, AV_CH_LAYOUT_QUAD },
+ { "quad(side)", 4, AV_CH_LAYOUT_2_2 },
+ { "4.1", 5, AV_CH_LAYOUT_4POINT1 },
+ { "5.0", 5, AV_CH_LAYOUT_5POINT0 },
+ { "5.0", 5, AV_CH_LAYOUT_5POINT0_BACK },
+ { "5.1", 6, AV_CH_LAYOUT_5POINT1 },
+ { "5.1", 6, AV_CH_LAYOUT_5POINT1_BACK },
+ { "6.0", 6, AV_CH_LAYOUT_6POINT0 },
+ { "6.0(front)", 6, AV_CH_LAYOUT_6POINT0_FRONT },
+ { "hexagonal", 6, AV_CH_LAYOUT_HEXAGONAL },
+ { "6.1", 7, AV_CH_LAYOUT_6POINT1 },
+ { "6.1", 7, AV_CH_LAYOUT_6POINT1_BACK },
+ { "6.1(front)", 7, AV_CH_LAYOUT_6POINT1_FRONT },
+ { "7.0", 7, AV_CH_LAYOUT_7POINT0 },
+ { "7.0(front)", 7, AV_CH_LAYOUT_7POINT0_FRONT },
+ { "7.1", 8, AV_CH_LAYOUT_7POINT1 },
+ { "7.1(wide)", 8, AV_CH_LAYOUT_7POINT1_WIDE },
+ { "7.1(wide)", 8, AV_CH_LAYOUT_7POINT1_WIDE_BACK },
+ { "octagonal", 8, AV_CH_LAYOUT_OCTAGONAL },
+ { "downmix", 2, AV_CH_LAYOUT_STEREO_DOWNMIX, },
+ { 0 }
+};
+
+static uint64_t get_channel_layout_single(const char *name, int name_len)
+{
+ int i;
+ char *end;
+ int64_t layout;
+
+ for (i = 0; i < FF_ARRAY_ELEMS(channel_layout_map) - 1; i++) {
+ if (strlen(channel_layout_map[i].name) == name_len &&
+ !memcmp(channel_layout_map[i].name, name, name_len))
+ return channel_layout_map[i].layout;
+ }
+ for (i = 0; i < FF_ARRAY_ELEMS(channel_names); i++)
+ if (channel_names[i] &&
+ strlen(channel_names[i]) == name_len &&
+ !memcmp(channel_names[i], name, name_len))
+ return (int64_t)1 << i;
+ i = strtol(name, &end, 10);
+ if (end - name == name_len ||
+ (end + 1 - name == name_len && *end == 'c'))
+ return av_get_default_channel_layout(i);
+ layout = strtoll(name, &end, 0);
+ if (end - name == name_len)
+ return FFMAX(layout, 0);
+ return 0;
+}
+
+uint64_t av_get_channel_layout(const char *name)
+{
+ const char *n, *e;
+ const char *name_end = name + strlen(name);
+ int64_t layout = 0, layout_single;
+
+ for (n = name; n < name_end; n = e + 1) {
+ for (e = n; e < name_end && *e != '+' && *e != '|'; e++);
+ layout_single = get_channel_layout_single(n, e - n);
+ if (!layout_single)
+ return 0;
+ layout |= layout_single;
+ }
+ return layout;
+}
+
+void av_get_channel_layout_string(char *buf, int buf_size,
+ int nb_channels, uint64_t channel_layout)
+{
+ int i;
+
+ if (nb_channels <= 0)
+ nb_channels = av_get_channel_layout_nb_channels(channel_layout);
+
+ for (i = 0; channel_layout_map[i].name; i++)
+ if (nb_channels == channel_layout_map[i].nb_channels &&
+ channel_layout == channel_layout_map[i].layout) {
+ av_strlcpy(buf, channel_layout_map[i].name, buf_size);
+ return;
+ }
+
+ snprintf(buf, buf_size, "%d channels", nb_channels);
+ if (channel_layout) {
+ int i, ch;
+ av_strlcat(buf, " (", buf_size);
+ for (i = 0, ch = 0; i < 64; i++) {
+ if ((channel_layout & (UINT64_C(1) << i))) {
+ const char *name = get_channel_name(i);
+ if (name) {
+ if (ch > 0)
+ av_strlcat(buf, "|", buf_size);
+ av_strlcat(buf, name, buf_size);
+ }
+ ch++;
+ }
+ }
+ av_strlcat(buf, ")", buf_size);
+ }
+}
+
+int av_get_channel_layout_nb_channels(uint64_t channel_layout)
+{
+ return av_popcount64(channel_layout);
+}
+
+uint64_t av_get_default_channel_layout(int nb_channels)
+{
+ switch(nb_channels) {
+ case 1: return AV_CH_LAYOUT_MONO;
+ case 2: return AV_CH_LAYOUT_STEREO;
+ case 3: return AV_CH_LAYOUT_SURROUND;
+ case 4: return AV_CH_LAYOUT_QUAD;
+ case 5: return AV_CH_LAYOUT_5POINT0;
+ case 6: return AV_CH_LAYOUT_5POINT1;
+ case 7: return AV_CH_LAYOUT_6POINT1;
+ case 8: return AV_CH_LAYOUT_7POINT1;
+ default: return 0;
+ }
+}
+
+int av_get_channel_layout_channel_index(uint64_t channel_layout,
+ uint64_t channel)
+{
+ if (!(channel_layout & channel) ||
+ av_get_channel_layout_nb_channels(channel) != 1)
+ return AVERROR(EINVAL);
+ channel_layout &= channel - 1;
+ return av_get_channel_layout_nb_channels(channel_layout);
+}
+
+const char *av_get_channel_name(uint64_t channel)
+{
+ int i;
+ if (av_get_channel_layout_nb_channels(channel) != 1)
+ return NULL;
+ for (i = 0; i < 64; i++)
+ if ((1ULL<<i) & channel)
+ return get_channel_name(i);
+ return NULL;
+}
+
+uint64_t av_channel_layout_extract_channel(uint64_t channel_layout, int index)
+{
+ int i;
+
+ if (av_get_channel_layout_nb_channels(channel_layout) <= index)
+ return 0;
+
+ for (i = 0; i < 64; i++) {
+ if ((1ULL << i) & channel_layout && !index--)
+ return 1ULL << i;
+ }
+ return 0;
+}
diff --git a/gst-libs/ext/libav/libavutil/channel_layout.h b/gst-libs/ext/libav/libavutil/channel_layout.h
new file mode 100644
index 0000000..15b6887
--- /dev/null
+++ b/gst-libs/ext/libav/libavutil/channel_layout.h
@@ -0,0 +1,182 @@
+/*
+ * Copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at>
+ * Copyright (c) 2008 Peter Ross
+ *
+ * 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
+ */
+
+#ifndef AVUTIL_CHANNEL_LAYOUT_H
+#define AVUTIL_CHANNEL_LAYOUT_H
+
+#include <stdint.h>
+
+/**
+ * @file
+ * audio channel layout utility functions
+ */
+
+/**
+ * @addtogroup lavu_audio
+ * @{
+ */
+
+/**
+ * @defgroup channel_masks Audio channel masks
+ * @{
+ */
+#define AV_CH_FRONT_LEFT 0x00000001
+#define AV_CH_FRONT_RIGHT 0x00000002
+#define AV_CH_FRONT_CENTER 0x00000004
+#define AV_CH_LOW_FREQUENCY 0x00000008
+#define AV_CH_BACK_LEFT 0x00000010
+#define AV_CH_BACK_RIGHT 0x00000020
+#define AV_CH_FRONT_LEFT_OF_CENTER 0x00000040
+#define AV_CH_FRONT_RIGHT_OF_CENTER 0x00000080
+#define AV_CH_BACK_CENTER 0x00000100
+#define AV_CH_SIDE_LEFT 0x00000200
+#define AV_CH_SIDE_RIGHT 0x00000400
+#define AV_CH_TOP_CENTER 0x00000800
+#define AV_CH_TOP_FRONT_LEFT 0x00001000
+#define AV_CH_TOP_FRONT_CENTER 0x00002000
+#define AV_CH_TOP_FRONT_RIGHT 0x00004000
+#define AV_CH_TOP_BACK_LEFT 0x00008000
+#define AV_CH_TOP_BACK_CENTER 0x00010000
+#define AV_CH_TOP_BACK_RIGHT 0x00020000
+#define AV_CH_STEREO_LEFT 0x20000000 ///< Stereo downmix.
+#define AV_CH_STEREO_RIGHT 0x40000000 ///< See AV_CH_STEREO_LEFT.
+#define AV_CH_WIDE_LEFT 0x0000000080000000ULL
+#define AV_CH_WIDE_RIGHT 0x0000000100000000ULL
+#define AV_CH_SURROUND_DIRECT_LEFT 0x0000000200000000ULL
+#define AV_CH_SURROUND_DIRECT_RIGHT 0x0000000400000000ULL
+#define AV_CH_LOW_FREQUENCY_2 0x0000000800000000ULL
+
+/** Channel mask value used for AVCodecContext.request_channel_layout
+ to indicate that the user requests the channel order of the decoder output
+ to be the native codec channel order. */
+#define AV_CH_LAYOUT_NATIVE 0x8000000000000000ULL
+
+/**
+ * @}
+ * @defgroup channel_mask_c Audio channel convenience macros
+ * @{
+ * */
+#define AV_CH_LAYOUT_MONO (AV_CH_FRONT_CENTER)
+#define AV_CH_LAYOUT_STEREO (AV_CH_FRONT_LEFT|AV_CH_FRONT_RIGHT)
+#define AV_CH_LAYOUT_2POINT1 (AV_CH_LAYOUT_STEREO|AV_CH_LOW_FREQUENCY)
+#define AV_CH_LAYOUT_2_1 (AV_CH_LAYOUT_STEREO|AV_CH_BACK_CENTER)
+#define AV_CH_LAYOUT_SURROUND (AV_CH_LAYOUT_STEREO|AV_CH_FRONT_CENTER)
+#define AV_CH_LAYOUT_3POINT1 (AV_CH_LAYOUT_SURROUND|AV_CH_LOW_FREQUENCY)
+#define AV_CH_LAYOUT_4POINT0 (AV_CH_LAYOUT_SURROUND|AV_CH_BACK_CENTER)
+#define AV_CH_LAYOUT_4POINT1 (AV_CH_LAYOUT_4POINT0|AV_CH_LOW_FREQUENCY)
+#define AV_CH_LAYOUT_2_2 (AV_CH_LAYOUT_STEREO|AV_CH_SIDE_LEFT|AV_CH_SIDE_RIGHT)
+#define AV_CH_LAYOUT_QUAD (AV_CH_LAYOUT_STEREO|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT)
+#define AV_CH_LAYOUT_5POINT0 (AV_CH_LAYOUT_SURROUND|AV_CH_SIDE_LEFT|AV_CH_SIDE_RIGHT)
+#define AV_CH_LAYOUT_5POINT1 (AV_CH_LAYOUT_5POINT0|AV_CH_LOW_FREQUENCY)
+#define AV_CH_LAYOUT_5POINT0_BACK (AV_CH_LAYOUT_SURROUND|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT)
+#define AV_CH_LAYOUT_5POINT1_BACK (AV_CH_LAYOUT_5POINT0_BACK|AV_CH_LOW_FREQUENCY)
+#define AV_CH_LAYOUT_6POINT0 (AV_CH_LAYOUT_5POINT0|AV_CH_BACK_CENTER)
+#define AV_CH_LAYOUT_6POINT0_FRONT (AV_CH_LAYOUT_2_2|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER)
+#define AV_CH_LAYOUT_HEXAGONAL (AV_CH_LAYOUT_5POINT0_BACK|AV_CH_BACK_CENTER)
+#define AV_CH_LAYOUT_6POINT1 (AV_CH_LAYOUT_5POINT1|AV_CH_BACK_CENTER)
+#define AV_CH_LAYOUT_6POINT1_BACK (AV_CH_LAYOUT_5POINT1_BACK|AV_CH_BACK_CENTER)
+#define AV_CH_LAYOUT_6POINT1_FRONT (AV_CH_LAYOUT_6POINT0_FRONT|AV_CH_LOW_FREQUENCY)
+#define AV_CH_LAYOUT_7POINT0 (AV_CH_LAYOUT_5POINT0|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT)
+#define AV_CH_LAYOUT_7POINT0_FRONT (AV_CH_LAYOUT_5POINT0|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER)
+#define AV_CH_LAYOUT_7POINT1 (AV_CH_LAYOUT_5POINT1|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT)
+#define AV_CH_LAYOUT_7POINT1_WIDE (AV_CH_LAYOUT_5POINT1|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER)
+#define AV_CH_LAYOUT_7POINT1_WIDE_BACK (AV_CH_LAYOUT_5POINT1_BACK|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER)
+#define AV_CH_LAYOUT_OCTAGONAL (AV_CH_LAYOUT_5POINT0|AV_CH_BACK_LEFT|AV_CH_BACK_CENTER|AV_CH_BACK_RIGHT)
+#define AV_CH_LAYOUT_STEREO_DOWNMIX (AV_CH_STEREO_LEFT|AV_CH_STEREO_RIGHT)
+
+enum AVMatrixEncoding {
+ AV_MATRIX_ENCODING_NONE,
+ AV_MATRIX_ENCODING_DOLBY,
+ AV_MATRIX_ENCODING_DPLII,
+ AV_MATRIX_ENCODING_NB
+};
+
+/**
+ * @}
+ */
+
+/**
+ * Return a channel layout id that matches name, or 0 if no match is found.
+ *
+ * name can be one or several of the following notations,
+ * separated by '+' or '|':
+ * - the name of an usual channel layout (mono, stereo, 4.0, quad, 5.0,
+ * 5.0(side), 5.1, 5.1(side), 7.1, 7.1(wide), downmix);
+ * - the name of a single channel (FL, FR, FC, LFE, BL, BR, FLC, FRC, BC,
+ * SL, SR, TC, TFL, TFC, TFR, TBL, TBC, TBR, DL, DR);
+ * - a number of channels, in decimal, optionally followed by 'c', yielding
+ * the default channel layout for that number of channels (@see
+ * av_get_default_channel_layout);
+ * - a channel layout mask, in hexadecimal starting with "0x" (see the
+ * AV_CH_* macros).
+ *
+ * Example: "stereo+FC" = "2+FC" = "2c+1c" = "0x7"
+ */
+uint64_t av_get_channel_layout(const char *name);
+
+/**
+ * Return a description of a channel layout.
+ * If nb_channels is <= 0, it is guessed from the channel_layout.
+ *
+ * @param buf put here the string containing the channel layout
+ * @param buf_size size in bytes of the buffer
+ */
+void av_get_channel_layout_string(char *buf, int buf_size, int nb_channels, uint64_t channel_layout);
+
+/**
+ * Return the number of channels in the channel layout.
+ */
+int av_get_channel_layout_nb_channels(uint64_t channel_layout);
+
+/**
+ * Return default channel layout for a given number of channels.
+ */
+uint64_t av_get_default_channel_layout(int nb_channels);
+
+/**
+ * Get the index of a channel in channel_layout.
+ *
+ * @param channel a channel layout describing exactly one channel which must be
+ * present in channel_layout.
+ *
+ * @return index of channel in channel_layout on success, a negative AVERROR
+ * on error.
+ */
+int av_get_channel_layout_channel_index(uint64_t channel_layout,
+ uint64_t channel);
+
+/**
+ * Get the channel with the given index in channel_layout.
+ */
+uint64_t av_channel_layout_extract_channel(uint64_t channel_layout, int index);
+
+/**
+ * Get the name of a given channel.
+ *
+ * @return channel name on success, NULL on error.
+ */
+const char *av_get_channel_name(uint64_t channel);
+
+/**
+ * @}
+ */
+
+#endif /* AVUTIL_CHANNEL_LAYOUT_H */
diff --git a/gst-libs/ext/libav/libavutil/common.h b/gst-libs/ext/libav/libavutil/common.h
index c99d858..cc4df16 100644
--- a/gst-libs/ext/libav/libavutil/common.h
+++ b/gst-libs/ext/libav/libavutil/common.h
@@ -34,7 +34,9 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+
#include "attributes.h"
+#include "version.h"
#include "libavutil/avconfig.h"
#if AV_HAVE_BIGENDIAN
@@ -60,37 +62,10 @@
#define FFALIGN(x, a) (((x)+(a)-1)&~((a)-1))
/* misc math functions */
-extern const uint8_t ff_log2_tab[256];
-
-extern const uint8_t av_reverse[256];
-
-static av_always_inline av_const int av_log2_c(unsigned int v)
-{
- int n = 0;
- if (v & 0xffff0000) {
- v >>= 16;
- n += 16;
- }
- if (v & 0xff00) {
- v >>= 8;
- n += 8;
- }
- n += ff_log2_tab[v];
-
- return n;
-}
-static av_always_inline av_const int av_log2_16bit_c(unsigned int v)
-{
- int n = 0;
- if (v & 0xff00) {
- v >>= 8;
- n += 8;
- }
- n += ff_log2_tab[v];
-
- return n;
-}
+#if FF_API_AV_REVERSE
+extern attribute_deprecated const uint8_t av_reverse[256];
+#endif
#ifdef HAVE_AV_CONFIG_H
# include "config.h"
@@ -100,6 +75,14 @@ static av_always_inline av_const int av_log2_16bit_c(unsigned int v)
/* Pull in unguarded fallback defines at the end of this file. */
#include "common.h"
+#ifndef av_log2
+av_const int av_log2(unsigned v);
+#endif
+
+#ifndef av_log2_16bit
+av_const int av_log2_16bit(unsigned v);
+#endif
+
/**
* Clip a signed integer value into the amin-amax range.
* @param a value to clip
@@ -182,6 +165,30 @@ static av_always_inline av_const unsigned av_clip_uintp2_c(int a, int p)
}
/**
+ * Add two signed 32-bit values with saturation.
+ *
+ * @param a one value
+ * @param b another value
+ * @return sum with signed saturation
+ */
+static av_always_inline int av_sat_add32_c(int a, int b)
+{
+ return av_clipl_int32((int64_t)a + b);
+}
+
+/**
+ * Add a doubled value to another value with saturation at both stages.
+ *
+ * @param a first value
+ * @param b value doubled and added to a
+ * @return sum with signed saturation
+ */
+static av_always_inline int av_sat_dadd32_c(int a, int b)
+{
+ return av_sat_add32(a, av_sat_add32(b, b));
+}
+
+/**
* Clip a float value into the amin-amax range.
* @param a value to clip
* @param amin minimum value of the clip range
@@ -245,16 +252,17 @@ static av_always_inline av_const int av_popcount64_c(uint64_t x)
#define GET_UTF8(val, GET_BYTE, ERROR)\
val= GET_BYTE;\
{\
- int ones= 7 - av_log2(val ^ 255);\
- if(ones==1)\
+ uint32_t top = (val & 128) >> 1;\
+ if ((val & 0xc0) == 0x80)\
ERROR\
- val&= 127>>ones;\
- while(--ones > 0){\
+ while (val & top) {\
int tmp= GET_BYTE - 128;\
if(tmp>>6)\
ERROR\
val= (val<<6) + tmp;\
+ top <<= 5;\
}\
+ val &= (top << 1) - 1;\
}
/**
@@ -357,12 +365,6 @@ static av_always_inline av_const int av_popcount64_c(uint64_t x)
* to ensure they are immediately available in intmath.h.
*/
-#ifndef av_log2
-# define av_log2 av_log2_c
-#endif
-#ifndef av_log2_16bit
-# define av_log2_16bit av_log2_16bit_c
-#endif
#ifndef av_ceil_log2
# define av_ceil_log2 av_ceil_log2_c
#endif
@@ -387,6 +389,12 @@ static av_always_inline av_const int av_popcount64_c(uint64_t x)
#ifndef av_clip_uintp2
# define av_clip_uintp2 av_clip_uintp2_c
#endif
+#ifndef av_sat_add32
+# define av_sat_add32 av_sat_add32_c
+#endif
+#ifndef av_sat_dadd32
+# define av_sat_dadd32 av_sat_dadd32_c
+#endif
#ifndef av_clipf
# define av_clipf av_clipf_c
#endif
diff --git a/gst-libs/ext/libav/libavutil/cpu.c b/gst-libs/ext/libav/libavutil/cpu.c
index 25895d6..23016d6 100644
--- a/gst-libs/ext/libav/libavutil/cpu.c
+++ b/gst-libs/ext/libav/libavutil/cpu.c
@@ -18,10 +18,13 @@
#include "cpu.h"
#include "config.h"
+#include "opt.h"
+
+static int cpuflags_mask = -1, checked;
int av_get_cpu_flags(void)
{
- static int flags, checked;
+ static int flags;
if (checked)
return flags;
@@ -30,13 +33,84 @@ int av_get_cpu_flags(void)
if (ARCH_PPC) flags = ff_get_cpu_flags_ppc();
if (ARCH_X86) flags = ff_get_cpu_flags_x86();
+ flags &= cpuflags_mask;
checked = 1;
+
return flags;
}
+void av_set_cpu_flags_mask(int mask)
+{
+ cpuflags_mask = mask;
+ checked = 0;
+}
+
+int av_parse_cpu_flags(const char *s)
+{
+#define CPUFLAG_MMXEXT (AV_CPU_FLAG_MMX | AV_CPU_FLAG_MMXEXT | AV_CPU_FLAG_CMOV)
+#define CPUFLAG_3DNOW (AV_CPU_FLAG_3DNOW | AV_CPU_FLAG_MMX)
+#define CPUFLAG_3DNOWEXT (AV_CPU_FLAG_3DNOWEXT | CPUFLAG_3DNOW)
+#define CPUFLAG_SSE (AV_CPU_FLAG_SSE | CPUFLAG_MMXEXT)
+#define CPUFLAG_SSE2 (AV_CPU_FLAG_SSE2 | CPUFLAG_SSE)
+#define CPUFLAG_SSE2SLOW (AV_CPU_FLAG_SSE2SLOW | CPUFLAG_SSE2)
+#define CPUFLAG_SSE3 (AV_CPU_FLAG_SSE3 | CPUFLAG_SSE2)
+#define CPUFLAG_SSE3SLOW (AV_CPU_FLAG_SSE3SLOW | CPUFLAG_SSE3)
+#define CPUFLAG_SSSE3 (AV_CPU_FLAG_SSSE3 | CPUFLAG_SSE3)
+#define CPUFLAG_SSE4 (AV_CPU_FLAG_SSE4 | CPUFLAG_SSSE3)
+#define CPUFLAG_SSE42 (AV_CPU_FLAG_SSE42 | CPUFLAG_SSE4)
+#define CPUFLAG_AVX (AV_CPU_FLAG_AVX | CPUFLAG_SSE42)
+#define CPUFLAG_XOP (AV_CPU_FLAG_XOP | CPUFLAG_AVX)
+#define CPUFLAG_FMA4 (AV_CPU_FLAG_FMA4 | CPUFLAG_AVX)
+ static const AVOption cpuflags_opts[] = {
+ { "flags" , NULL, 0, AV_OPT_TYPE_FLAGS, { .i64 = 0 }, INT64_MIN, INT64_MAX, .unit = "flags" },
+#if ARCH_PPC
+ { "altivec" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_ALTIVEC }, .unit = "flags" },
+#elif ARCH_X86
+ { "mmx" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_MMX }, .unit = "flags" },
+ { "mmxext" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_MMXEXT }, .unit = "flags" },
+ { "sse" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_SSE }, .unit = "flags" },
+ { "sse2" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_SSE2 }, .unit = "flags" },
+ { "sse2slow", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_SSE2SLOW }, .unit = "flags" },
+ { "sse3" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_SSE3 }, .unit = "flags" },
+ { "sse3slow", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_SSE3SLOW }, .unit = "flags" },
+ { "ssse3" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_SSSE3 }, .unit = "flags" },
+ { "atom" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_ATOM }, .unit = "flags" },
+ { "sse4.1" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_SSE4 }, .unit = "flags" },
+ { "sse4.2" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_SSE42 }, .unit = "flags" },
+ { "avx" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_AVX }, .unit = "flags" },
+ { "xop" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_XOP }, .unit = "flags" },
+ { "fma4" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_FMA4 }, .unit = "flags" },
+ { "3dnow" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_3DNOW }, .unit = "flags" },
+ { "3dnowext", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_3DNOWEXT }, .unit = "flags" },
+ { "cmov", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_CMOV }, .unit = "flags" },
+#elif ARCH_ARM
+ { "armv5te", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_ARMV5TE }, .unit = "flags" },
+ { "armv6", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_ARMV6 }, .unit = "flags" },
+ { "armv6t2", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_ARMV6T2 }, .unit = "flags" },
+ { "vfp", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_VFP }, .unit = "flags" },
+ { "vfpv3", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_VFPV3 }, .unit = "flags" },
+ { "neon", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_NEON }, .unit = "flags" },
+#endif
+ { NULL },
+ };
+ static const AVClass class = {
+ .class_name = "cpuflags",
+ .item_name = av_default_item_name,
+ .option = cpuflags_opts,
+ .version = LIBAVUTIL_VERSION_INT,
+ };
+
+ int flags = 0, ret;
+ const AVClass *pclass = &class;
+
+ if ((ret = av_opt_eval_flags(&pclass, &cpuflags_opts[0], s, &flags)) < 0)
+ return ret;
+
+ return flags & INT_MAX;
+}
+
#ifdef TEST
-#undef printf
#include <stdio.h>
static const struct {
@@ -44,12 +118,17 @@ static const struct {
const char *name;
} cpu_flag_tab[] = {
#if ARCH_ARM
- { AV_CPU_FLAG_IWMMXT, "iwmmxt" },
+ { AV_CPU_FLAG_ARMV5TE, "armv5te" },
+ { AV_CPU_FLAG_ARMV6, "armv6" },
+ { AV_CPU_FLAG_ARMV6T2, "armv6t2" },
+ { AV_CPU_FLAG_VFP, "vfp" },
+ { AV_CPU_FLAG_VFPV3, "vfpv3" },
+ { AV_CPU_FLAG_NEON, "neon" },
#elif ARCH_PPC
{ AV_CPU_FLAG_ALTIVEC, "altivec" },
#elif ARCH_X86
{ AV_CPU_FLAG_MMX, "mmx" },
- { AV_CPU_FLAG_MMX2, "mmx2" },
+ { AV_CPU_FLAG_MMXEXT, "mmxext" },
{ AV_CPU_FLAG_SSE, "sse" },
{ AV_CPU_FLAG_SSE2, "sse2" },
{ AV_CPU_FLAG_SSE2SLOW, "sse2(slow)" },
@@ -64,6 +143,7 @@ static const struct {
{ AV_CPU_FLAG_FMA4, "fma4" },
{ AV_CPU_FLAG_3DNOW, "3dnow" },
{ AV_CPU_FLAG_3DNOWEXT, "3dnowext" },
+ { AV_CPU_FLAG_CMOV, "cmov" },
#endif
{ 0 }
};
diff --git a/gst-libs/ext/libav/libavutil/cpu.h b/gst-libs/ext/libav/libavutil/cpu.h
index df7bf44..4929512 100644
--- a/gst-libs/ext/libav/libavutil/cpu.h
+++ b/gst-libs/ext/libav/libavutil/cpu.h
@@ -21,11 +21,16 @@
#ifndef AVUTIL_CPU_H
#define AVUTIL_CPU_H
+#include "version.h"
+
#define AV_CPU_FLAG_FORCE 0x80000000 /* force usage of selected flags (OR) */
/* lower 16 bits - CPU features */
#define AV_CPU_FLAG_MMX 0x0001 ///< standard MMX
+#define AV_CPU_FLAG_MMXEXT 0x0002 ///< SSE integer functions or AMD MMX ext
+#if FF_API_CPU_FLAG_MMX2
#define AV_CPU_FLAG_MMX2 0x0002 ///< SSE integer functions or AMD MMX ext
+#endif
#define AV_CPU_FLAG_3DNOW 0x0004 ///< AMD 3DNOW
#define AV_CPU_FLAG_SSE 0x0008 ///< SSE functions
#define AV_CPU_FLAG_SSE2 0x0010 ///< PIV SSE2 functions
@@ -40,14 +45,37 @@
#define AV_CPU_FLAG_AVX 0x4000 ///< AVX functions: requires OS support even if YMM registers aren't used
#define AV_CPU_FLAG_XOP 0x0400 ///< Bulldozer XOP functions
#define AV_CPU_FLAG_FMA4 0x0800 ///< Bulldozer FMA4 functions
-#define AV_CPU_FLAG_IWMMXT 0x0100 ///< XScale IWMMXT
+#define AV_CPU_FLAG_CMOV 0x1000 ///< i686 cmov
+
#define AV_CPU_FLAG_ALTIVEC 0x0001 ///< standard
+#define AV_CPU_FLAG_ARMV5TE (1 << 0)
+#define AV_CPU_FLAG_ARMV6 (1 << 1)
+#define AV_CPU_FLAG_ARMV6T2 (1 << 2)
+#define AV_CPU_FLAG_VFP (1 << 3)
+#define AV_CPU_FLAG_VFPV3 (1 << 4)
+#define AV_CPU_FLAG_NEON (1 << 5)
+
/**
* Return the flags which specify extensions supported by the CPU.
*/
int av_get_cpu_flags(void);
+/**
+ * Set a mask on flags returned by av_get_cpu_flags().
+ * This function is mainly useful for testing.
+ *
+ * @warning this function is not thread safe.
+ */
+void av_set_cpu_flags_mask(int mask);
+
+/**
+ * Parse CPU flags from a string.
+ *
+ * @return a combination of AV_CPU_* flags, negative on error.
+ */
+int av_parse_cpu_flags(const char *s);
+
/* The following CPU-specific functions shall not be called directly. */
int ff_get_cpu_flags_arm(void);
int ff_get_cpu_flags_ppc(void);
diff --git a/gst-libs/ext/libav/libavutil/crc.c b/gst-libs/ext/libav/libavutil/crc.c
index ee925d6..3d1d876 100644
--- a/gst-libs/ext/libav/libavutil/crc.c
+++ b/gst-libs/ext/libav/libavutil/crc.c
@@ -40,22 +40,6 @@ static struct {
static AVCRC av_crc_table[AV_CRC_MAX][257];
#endif
-/**
- * Initialize a CRC table.
- * @param ctx must be an array of size sizeof(AVCRC)*257 or sizeof(AVCRC)*1024
- * @param le If 1, the lowest bit represents the coefficient for the highest
- * exponent of the corresponding polynomial (both for poly and
- * actual CRC).
- * If 0, you must swap the CRC parameter and the result of av_crc
- * if you need the standard representation (can be simplified in
- * most cases to e.g. bswap16):
- * av_bswap32(crc << (32-bits))
- * @param bits number of bits for the CRC
- * @param poly generator polynomial without the x**bits coefficient, in the
- * representation as specified by le
- * @param ctx_size size of ctx in bytes
- * @return <0 on failure
- */
int av_crc_init(AVCRC *ctx, int le, int bits, uint32_t poly, int ctx_size)
{
unsigned i, j;
@@ -89,11 +73,6 @@ int av_crc_init(AVCRC *ctx, int le, int bits, uint32_t poly, int ctx_size)
return 0;
}
-/**
- * Get an initialized standard CRC table.
- * @param crc_id ID of a standard CRC
- * @return a pointer to the CRC table or NULL on failure
- */
const AVCRC *av_crc_get_table(AVCRCId crc_id)
{
#if !CONFIG_HARDCODED_TABLES
@@ -108,13 +87,6 @@ const AVCRC *av_crc_get_table(AVCRCId crc_id)
return av_crc_table[crc_id];
}
-/**
- * Calculate the CRC of a block.
- * @param crc CRC of previous blocks if any or initial value for CRC
- * @return CRC updated with the data from the given block
- *
- * @see av_crc_init() "le" parameter
- */
uint32_t av_crc(const AVCRC *ctx, uint32_t crc,
const uint8_t *buffer, size_t length)
{
@@ -141,7 +113,6 @@ uint32_t av_crc(const AVCRC *ctx, uint32_t crc,
}
#ifdef TEST
-#undef printf
int main(void)
{
uint8_t buf[1999];
diff --git a/gst-libs/ext/libav/libavutil/crc.h b/gst-libs/ext/libav/libavutil/crc.h
index a934119..0540619 100644
--- a/gst-libs/ext/libav/libavutil/crc.h
+++ b/gst-libs/ext/libav/libavutil/crc.h
@@ -36,9 +36,39 @@ typedef enum {
AV_CRC_MAX, /*< Not part of public API! Do not use outside libavutil. */
}AVCRCId;
+/**
+ * Initialize a CRC table.
+ * @param ctx must be an array of size sizeof(AVCRC)*257 or sizeof(AVCRC)*1024
+ * @param le If 1, the lowest bit represents the coefficient for the highest
+ * exponent of the corresponding polynomial (both for poly and
+ * actual CRC).
+ * If 0, you must swap the CRC parameter and the result of av_crc
+ * if you need the standard representation (can be simplified in
+ * most cases to e.g. bswap16):
+ * av_bswap32(crc << (32-bits))
+ * @param bits number of bits for the CRC
+ * @param poly generator polynomial without the x**bits coefficient, in the
+ * representation as specified by le
+ * @param ctx_size size of ctx in bytes
+ * @return <0 on failure
+ */
int av_crc_init(AVCRC *ctx, int le, int bits, uint32_t poly, int ctx_size);
+
+/**
+ * Get an initialized standard CRC table.
+ * @param crc_id ID of a standard CRC
+ * @return a pointer to the CRC table or NULL on failure
+ */
const AVCRC *av_crc_get_table(AVCRCId crc_id);
-uint32_t av_crc(const AVCRC *ctx, uint32_t start_crc, const uint8_t *buffer, size_t length) av_pure;
-#endif /* AVUTIL_CRC_H */
+/**
+ * Calculate the CRC of a block.
+ * @param crc CRC of previous blocks if any or initial value for CRC
+ * @return CRC updated with the data from the given block
+ *
+ * @see av_crc_init() "le" parameter
+ */
+uint32_t av_crc(const AVCRC *ctx, uint32_t crc,
+ const uint8_t *buffer, size_t length) av_pure;
+#endif /* AVUTIL_CRC_H */
diff --git a/gst-libs/ext/libav/libavutil/des.c b/gst-libs/ext/libav/libavutil/des.c
index d65760e..01cb10b 100644
--- a/gst-libs/ext/libav/libavutil/des.c
+++ b/gst-libs/ext/libav/libavutil/des.c
@@ -337,12 +337,9 @@ void av_des_mac(AVDES *d, uint8_t *dst, const uint8_t *src, int count) {
}
#ifdef TEST
-#undef printf
-#undef rand
-#undef srand
#include <stdlib.h>
#include <stdio.h>
-#include <sys/time.h>
+#include "libavutil/time.h"
static uint64_t rand64(void) {
uint64_t r = rand();
r = (r << 32) | rand();
@@ -389,13 +386,11 @@ int main(void) {
#ifdef GENTABLES
int j;
#endif
- struct timeval tv;
uint64_t key[3];
uint64_t data;
uint64_t ct;
uint64_t roundkeys[16];
- gettimeofday(&tv, NULL);
- srand(tv.tv_sec * 1000 * 1000 + tv.tv_usec);
+ srand(av_gettime());
key[0] = AV_RB64(test_key);
data = AV_RB64(plain);
gen_roundkeys(roundkeys, key[0]);
diff --git a/gst-libs/ext/libav/libavutil/dict.c b/gst-libs/ext/libav/libavutil/dict.c
index cb5f7b1..3c3194c 100644
--- a/gst-libs/ext/libav/libavutil/dict.c
+++ b/gst-libs/ext/libav/libavutil/dict.c
@@ -18,11 +18,24 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <ctype.h>
+#include <string.h>
+
#include "avstring.h"
#include "dict.h"
#include "internal.h"
#include "mem.h"
+struct AVDictionary {
+ int count;
+ AVDictionaryEntry *elems;
+};
+
+int av_dict_count(const AVDictionary *m)
+{
+ return m ? m->count : 0;
+}
+
AVDictionaryEntry *
av_dict_get(AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags)
{
diff --git a/gst-libs/ext/libav/libavutil/dict.h b/gst-libs/ext/libav/libavutil/dict.h
index 6e28b61..492da9a 100644
--- a/gst-libs/ext/libav/libavutil/dict.h
+++ b/gst-libs/ext/libav/libavutil/dict.h
@@ -68,7 +68,7 @@
#define AV_DICT_APPEND 32 /**< If the entry already exists, append to it. Note that no
delimiter is added, the strings are simply concatenated. */
-typedef struct {
+typedef struct AVDictionaryEntry {
char *key;
char *value;
} AVDictionaryEntry;
@@ -87,13 +87,21 @@ AVDictionaryEntry *
av_dict_get(AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags);
/**
+ * Get number of entries in dictionary.
+ *
+ * @param m dictionary
+ * @return number of entries in dictionary
+ */
+int av_dict_count(const AVDictionary *m);
+
+/**
* Set the given entry in *pm, overwriting an existing entry.
*
* @param pm pointer to a pointer to a dictionary struct. If *pm is NULL
* a dictionary struct is allocated and put in *pm.
* @param key entry key to add to *pm (will be av_strduped depending on flags)
* @param value entry value to add to *pm (will be av_strduped depending on flags).
- * Passing a NULL value will cause an existing tag to be deleted.
+ * Passing a NULL value will cause an existing entry to be deleted.
* @return >= 0 on success otherwise an error code <0
*/
int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags);
@@ -118,4 +126,4 @@ void av_dict_free(AVDictionary **m);
* @}
*/
-#endif // AVUTIL_DICT_H
+#endif /* AVUTIL_DICT_H */
diff --git a/gst-libs/ext/libav/libavutil/error.c b/gst-libs/ext/libav/libavutil/error.c
index 21b6876..6803d2d 100644
--- a/gst-libs/ext/libav/libavutil/error.c
+++ b/gst-libs/ext/libav/libavutil/error.c
@@ -18,6 +18,7 @@
#include "avutil.h"
#include "avstring.h"
+#include "common.h"
int av_strerror(int errnum, char *errbuf, size_t errbuf_size)
{
@@ -40,6 +41,7 @@ int av_strerror(int errnum, char *errbuf, size_t errbuf_size)
case AVERROR_STREAM_NOT_FOUND: errstr = "Stream not found" ; break;
case AVERROR_BUG: errstr = "Bug detected, please report the issue" ; break;
case AVERROR_UNKNOWN: errstr = "Unknown error occurred" ; break;
+ case AVERROR_EXPERIMENTAL: errstr = "Experimental feature" ; break;
}
if (errstr) {
diff --git a/gst-libs/ext/libav/libavutil/error.h b/gst-libs/ext/libav/libavutil/error.h
index 11bcc5c..3dfd880 100644
--- a/gst-libs/ext/libav/libavutil/error.h
+++ b/gst-libs/ext/libav/libavutil/error.h
@@ -25,6 +25,7 @@
#define AVUTIL_ERROR_H
#include <errno.h>
+#include <stddef.h>
#include "avutil.h"
/**
@@ -44,21 +45,22 @@
#define AVUNERROR(e) (e)
#endif
-#define AVERROR_BSF_NOT_FOUND (-MKTAG(0xF8,'B','S','F')) ///< Bitstream filter not found
-#define AVERROR_DECODER_NOT_FOUND (-MKTAG(0xF8,'D','E','C')) ///< Decoder not found
-#define AVERROR_DEMUXER_NOT_FOUND (-MKTAG(0xF8,'D','E','M')) ///< Demuxer not found
-#define AVERROR_ENCODER_NOT_FOUND (-MKTAG(0xF8,'E','N','C')) ///< Encoder not found
-#define AVERROR_EOF (-MKTAG( 'E','O','F',' ')) ///< End of file
-#define AVERROR_EXIT (-MKTAG( 'E','X','I','T')) ///< Immediate exit was requested; the called function should not be restarted
-#define AVERROR_FILTER_NOT_FOUND (-MKTAG(0xF8,'F','I','L')) ///< Filter not found
-#define AVERROR_INVALIDDATA (-MKTAG( 'I','N','D','A')) ///< Invalid data found when processing input
-#define AVERROR_MUXER_NOT_FOUND (-MKTAG(0xF8,'M','U','X')) ///< Muxer not found
-#define AVERROR_OPTION_NOT_FOUND (-MKTAG(0xF8,'O','P','T')) ///< Option not found
-#define AVERROR_PATCHWELCOME (-MKTAG( 'P','A','W','E')) ///< Not yet implemented in Libav, patches welcome
-#define AVERROR_PROTOCOL_NOT_FOUND (-MKTAG(0xF8,'P','R','O')) ///< Protocol not found
-#define AVERROR_STREAM_NOT_FOUND (-MKTAG(0xF8,'S','T','R')) ///< Stream not found
-#define AVERROR_BUG (-MKTAG( 'B','U','G',' ')) ///< Bug detected, please report the issue
-#define AVERROR_UNKNOWN (-MKTAG( 'U','N','K','N')) ///< Unknown error, typically from an external library
+#define AVERROR_BSF_NOT_FOUND (-0x39acbd08) ///< Bitstream filter not found
+#define AVERROR_DECODER_NOT_FOUND (-0x3cbabb08) ///< Decoder not found
+#define AVERROR_DEMUXER_NOT_FOUND (-0x32babb08) ///< Demuxer not found
+#define AVERROR_ENCODER_NOT_FOUND (-0x3cb1ba08) ///< Encoder not found
+#define AVERROR_EOF (-0x5fb9b0bb) ///< End of file
+#define AVERROR_EXIT (-0x2bb6a7bb) ///< Immediate exit was requested; the called function should not be restarted
+#define AVERROR_FILTER_NOT_FOUND (-0x33b6b908) ///< Filter not found
+#define AVERROR_INVALIDDATA (-0x3ebbb1b7) ///< Invalid data found when processing input
+#define AVERROR_MUXER_NOT_FOUND (-0x27aab208) ///< Muxer not found
+#define AVERROR_OPTION_NOT_FOUND (-0x2bafb008) ///< Option not found
+#define AVERROR_PATCHWELCOME (-0x3aa8beb0) ///< Not yet implemented in Libav, patches welcome
+#define AVERROR_PROTOCOL_NOT_FOUND (-0x30adaf08) ///< Protocol not found
+#define AVERROR_STREAM_NOT_FOUND (-0x2dabac08) ///< Stream not found
+#define AVERROR_BUG (-0x5fb8aabe) ///< Bug detected, please report the issue
+#define AVERROR_UNKNOWN (-0x31b4b1ab) ///< Unknown error, typically from an external library
+#define AVERROR_EXPERIMENTAL (-0x2bb2afa8) ///< Requested feature is flagged experimental. Set strict_std_compliance if you really want to use it.
/**
* Put a description of the AVERROR code errnum in errbuf.
diff --git a/gst-libs/ext/libav/libavutil/eval.c b/gst-libs/ext/libav/libavutil/eval.c
index 44d1428..a0e968d 100644
--- a/gst-libs/ext/libav/libavutil/eval.c
+++ b/gst-libs/ext/libav/libavutil/eval.c
@@ -27,8 +27,10 @@
*/
#include "avutil.h"
+#include "common.h"
#include "eval.h"
#include "log.h"
+#include "mathematics.h"
typedef struct Parser {
const AVClass *class;
@@ -79,7 +81,11 @@ double av_strtod(const char *numstr, char **tail)
d = strtod(numstr, &next);
/* if parsing succeeded, check for and interpret postfixes */
if (next!=numstr) {
- if (*next >= 'E' && *next <= 'z') {
+ if (next[0] == 'd' && next[1] == 'B') {
+ /* treat dB as decibels instead of decibytes */
+ d = pow(10, d / 20);
+ next += 2;
+ } else if (*next >= 'E' && *next <= 'z') {
int e= si_prefixes[*next - 'E'];
if (e) {
if (next[1] == 'i') {
@@ -119,7 +125,7 @@ static int strmatch(const char *s, const char *prefix)
struct AVExpr {
enum {
e_value, e_const, e_func0, e_func1, e_func2,
- e_squish, e_gauss, e_ld, e_isnan,
+ e_squish, e_gauss, e_ld, e_isnan, e_isinf,
e_mod, e_max, e_min, e_eq, e_gt, e_gte,
e_pow, e_mul, e_div, e_add,
e_last, e_st, e_while, e_floor, e_ceil, e_trunc,
@@ -147,6 +153,7 @@ static double eval_expr(Parser *p, AVExpr *e)
case e_gauss: { double d = eval_expr(p, e->param[0]); return exp(-d*d/2)/sqrt(2*M_PI); }
case e_ld: return e->value * p->var[av_clip(eval_expr(p, e->param[0]), 0, VARS-1)];
case e_isnan: return e->value * !!isnan(eval_expr(p, e->param[0]));
+ case e_isinf: return e->value * !!isinf(eval_expr(p, e->param[0]));
case e_floor: return e->value * floor(eval_expr(p, e->param[0]));
case e_ceil : return e->value * ceil (eval_expr(p, e->param[0]));
case e_trunc: return e->value * trunc(eval_expr(p, e->param[0]));
@@ -281,6 +288,7 @@ static int parse_primary(AVExpr **e, Parser *p)
else if (strmatch(next, "lt" )) { AVExpr *tmp = d->param[1]; d->param[1] = d->param[0]; d->param[0] = tmp; d->type = e_gt; }
else if (strmatch(next, "ld" )) d->type = e_ld;
else if (strmatch(next, "isnan" )) d->type = e_isnan;
+ else if (strmatch(next, "isinf" )) d->type = e_isinf;
else if (strmatch(next, "st" )) d->type = e_st;
else if (strmatch(next, "while" )) d->type = e_while;
else if (strmatch(next, "floor" )) d->type = e_floor;
@@ -335,16 +343,31 @@ static int parse_pow(AVExpr **e, Parser *p, int *sign)
return parse_primary(e, p);
}
+static int parse_dB(AVExpr **e, Parser *p, int *sign)
+{
+ /* do not filter out the negative sign when parsing a dB value.
+ for example, -3dB is not the same as -(3dB) */
+ if (*p->s == '-') {
+ char *next;
+ strtod(p->s, &next);
+ if (next != p->s && next[0] == 'd' && next[1] == 'B') {
+ *sign = 0;
+ return parse_primary(e, p);
+ }
+ }
+ return parse_pow(e, p, sign);
+}
+
static int parse_factor(AVExpr **e, Parser *p)
{
int sign, sign2, ret;
AVExpr *e0, *e1, *e2;
- if ((ret = parse_pow(&e0, p, &sign)) < 0)
+ if ((ret = parse_dB(&e0, p, &sign)) < 0)
return ret;
while(p->s[0]=='^'){
e1 = e0;
p->s++;
- if ((ret = parse_pow(&e2, p, &sign2)) < 0) {
+ if ((ret = parse_dB(&e2, p, &sign2)) < 0) {
av_expr_free(e1);
return ret;
}
@@ -452,6 +475,7 @@ static int verify_expr(AVExpr *e)
case e_ld:
case e_gauss:
case e_isnan:
+ case e_isinf:
case e_floor:
case e_ceil:
case e_trunc:
@@ -540,16 +564,15 @@ int av_expr_parse_and_eval(double *d, const char *s,
}
#ifdef TEST
-#undef printf
#include <string.h>
-static double const_values[] = {
+static const double const_values[] = {
M_PI,
M_E,
0
};
-static const char *const_names[] = {
+static const char *const const_names[] = {
"PI",
"E",
0
@@ -559,7 +582,8 @@ int main(int argc, char **argv)
{
int i;
double d;
- const char **expr, *exprs[] = {
+ const char *const *expr;
+ static const char *const exprs[] = {
"",
"1;2",
"-20",
@@ -592,6 +616,14 @@ int main(int argc, char **argv)
"1Gi",
"st(0, 123)",
"st(1, 123); ld(1)",
+ "lte(0, 1)",
+ "lte(1, 1)",
+ "lte(1, 0)",
+ "lt(0, 1)",
+ "lt(1, 1)",
+ "gt(1, 0)",
+ "gt(2, 7)",
+ "gte(122, 122)",
/* compute 1+2+...+N */
"st(0, 1); while(lte(ld(0), 100), st(1, ld(1)+ld(0));st(0, ld(0)+1)); ld(1)",
/* compute Fib(N) */
@@ -600,6 +632,10 @@ int main(int argc, char **argv)
"st(0, 1); while(lte(ld(0),100), st(1, ld(1)+ld(0)); st(0, ld(0)+1))",
"isnan(1)",
"isnan(NAN)",
+ "isnan(INF)",
+ "isinf(1)",
+ "isinf(NAN)",
+ "isinf(INF)",
"floor(NAN)",
"floor(123.123)",
"floor(-123.123)",
@@ -612,6 +648,8 @@ int main(int argc, char **argv)
"not(1)",
"not(NAN)",
"not(0)",
+ "6.0206dB",
+ "-3.0103dB",
NULL
};
@@ -620,7 +658,10 @@ int main(int argc, char **argv)
av_expr_parse_and_eval(&d, *expr,
const_names, const_values,
NULL, NULL, NULL, NULL, NULL, 0, NULL);
- printf("'%s' -> %f\n\n", *expr, d);
+ if (isnan(d))
+ printf("'%s' -> nan\n\n", *expr);
+ else
+ printf("'%s' -> %f\n\n", *expr, d);
}
av_expr_parse_and_eval(&d, "1+(5-2)^(3-1)+1/2+sin(PI)-max(-2.2,-3.1)",
diff --git a/gst-libs/ext/libav/libavutil/fifo.c b/gst-libs/ext/libav/libavutil/fifo.c
index 5774d33..2684899 100644
--- a/gst-libs/ext/libav/libavutil/fifo.c
+++ b/gst-libs/ext/libav/libavutil/fifo.c
@@ -130,8 +130,6 @@ void av_fifo_drain(AVFifoBuffer *f, int size)
#ifdef TEST
-#undef printf
-
int main(void)
{
/* create a FIFO buffer */
diff --git a/gst-libs/ext/libav/libavutil/fifo.h b/gst-libs/ext/libav/libavutil/fifo.h
index f106239..ea30f5d 100644
--- a/gst-libs/ext/libav/libavutil/fifo.h
+++ b/gst-libs/ext/libav/libavutil/fifo.h
@@ -26,6 +26,7 @@
#include <stdint.h>
#include "avutil.h"
+#include "attributes.h"
typedef struct AVFifoBuffer {
uint8_t *buffer;
@@ -127,15 +128,4 @@ static inline uint8_t *av_fifo_peek2(const AVFifoBuffer *f, int offs)
return ptr;
}
-#if FF_API_AV_FIFO_PEEK
-/**
- * @deprecated Use av_fifo_peek2() instead.
- */
-attribute_deprecated
-static inline uint8_t av_fifo_peek(AVFifoBuffer *f, int offs)
-{
- return *av_fifo_peek2(f, offs);
-}
-#endif
-
#endif /* AVUTIL_FIFO_H */
diff --git a/gst-libs/ext/libav/libavutil/file.c b/gst-libs/ext/libav/libavutil/file.c
index 649bb76..ce02487 100644
--- a/gst-libs/ext/libav/libavutil/file.c
+++ b/gst-libs/ext/libav/libavutil/file.c
@@ -16,15 +16,21 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "config.h"
#include "file.h"
#include "log.h"
+#include "mem.h"
#include <fcntl.h>
#include <sys/stat.h>
+#if HAVE_UNISTD_H
#include <unistd.h>
+#endif
+#if HAVE_IO_H
+#include <io.h>
+#endif
#if HAVE_MMAP
#include <sys/mman.h>
#elif HAVE_MAPVIEWOFFILE
-#include <io.h>
#include <windows.h>
#endif
@@ -129,21 +135,3 @@ void av_file_unmap(uint8_t *bufptr, size_t size)
av_free(bufptr);
#endif
}
-
-#ifdef TEST
-
-#undef printf
-
-int main(void)
-{
- uint8_t *buf;
- size_t size;
- if (av_file_map("file.c", &buf, &size, 0, NULL) < 0)
- return 1;
-
- buf[0] = 's';
- printf("%s", buf);
- av_file_unmap(buf, size);
- return 0;
-}
-#endif
diff --git a/gst-libs/ext/libav/libavutil/file.h b/gst-libs/ext/libav/libavutil/file.h
index c481c37..e3f02a8 100644
--- a/gst-libs/ext/libav/libavutil/file.h
+++ b/gst-libs/ext/libav/libavutil/file.h
@@ -19,6 +19,8 @@
#ifndef AVUTIL_FILE_H
#define AVUTIL_FILE_H
+#include <stdint.h>
+
#include "avutil.h"
/**
diff --git a/gst-libs/ext/libav/libavutil/float_dsp.c b/gst-libs/ext/libav/libavutil/float_dsp.c
new file mode 100644
index 0000000..22139de
--- /dev/null
+++ b/gst-libs/ext/libav/libavutil/float_dsp.c
@@ -0,0 +1,69 @@
+/*
+ * 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
+ */
+
+#include "config.h"
+
+#include "float_dsp.h"
+
+static void vector_fmul_c(float *dst, const float *src0, const float *src1,
+ int len)
+{
+ int i;
+ for (i = 0; i < len; i++)
+ dst[i] = src0[i] * src1[i];
+}
+
+static void vector_fmac_scalar_c(float *dst, const float *src, float mul,
+ int len)
+{
+ int i;
+ for (i = 0; i < len; i++)
+ dst[i] += src[i] * mul;
+}
+
+static void vector_fmul_scalar_c(float *dst, const float *src, float mul,
+ int len)
+{
+ int i;
+ for (i = 0; i < len; i++)
+ dst[i] = src[i] * mul;
+}
+
+static void vector_dmul_scalar_c(double *dst, const double *src, double mul,
+ int len)
+{
+ int i;
+ for (i = 0; i < len; i++)
+ dst[i] = src[i] * mul;
+}
+
+void avpriv_float_dsp_init(AVFloatDSPContext *fdsp, int bit_exact)
+{
+ fdsp->vector_fmul = vector_fmul_c;
+ fdsp->vector_fmac_scalar = vector_fmac_scalar_c;
+ fdsp->vector_fmul_scalar = vector_fmul_scalar_c;
+ fdsp->vector_dmul_scalar = vector_dmul_scalar_c;
+
+#if ARCH_ARM
+ ff_float_dsp_init_arm(fdsp);
+#elif ARCH_PPC
+ ff_float_dsp_init_ppc(fdsp, bit_exact);
+#elif ARCH_X86
+ ff_float_dsp_init_x86(fdsp);
+#endif
+}
diff --git a/gst-libs/ext/libav/libavutil/float_dsp.h b/gst-libs/ext/libav/libavutil/float_dsp.h
new file mode 100644
index 0000000..41b73c5
--- /dev/null
+++ b/gst-libs/ext/libav/libavutil/float_dsp.h
@@ -0,0 +1,99 @@
+/*
+ * 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
+ */
+
+#ifndef AVUTIL_FLOAT_DSP_H
+#define AVUTIL_FLOAT_DSP_H
+
+typedef struct AVFloatDSPContext {
+ /**
+ * Calculate the product of two vectors of floats and store the result in
+ * a vector of floats.
+ *
+ * @param dst output vector
+ * constraints: 32-byte aligned
+ * @param src0 first input vector
+ * constraints: 32-byte aligned
+ * @param src1 second input vector
+ * constraints: 32-byte aligned
+ * @param len number of elements in the input
+ * constraints: multiple of 16
+ */
+ void (*vector_fmul)(float *dst, const float *src0, const float *src1,
+ int len);
+
+ /**
+ * Multiply a vector of floats by a scalar float and add to
+ * destination vector. Source and destination vectors must
+ * overlap exactly or not at all.
+ *
+ * @param dst result vector
+ * constraints: 32-byte aligned
+ * @param src input vector
+ * constraints: 32-byte aligned
+ * @param mul scalar value
+ * @param len length of vector
+ * constraints: multiple of 16
+ */
+ void (*vector_fmac_scalar)(float *dst, const float *src, float mul,
+ int len);
+
+ /**
+ * Multiply a vector of floats by a scalar float. Source and
+ * destination vectors must overlap exactly or not at all.
+ *
+ * @param dst result vector
+ * constraints: 16-byte aligned
+ * @param src input vector
+ * constraints: 16-byte aligned
+ * @param mul scalar value
+ * @param len length of vector
+ * constraints: multiple of 4
+ */
+ void (*vector_fmul_scalar)(float *dst, const float *src, float mul,
+ int len);
+
+ /**
+ * Multiply a vector of double by a scalar double. Source and
+ * destination vectors must overlap exactly or not at all.
+ *
+ * @param dst result vector
+ * constraints: 32-byte aligned
+ * @param src input vector
+ * constraints: 32-byte aligned
+ * @param mul scalar value
+ * @param len length of vector
+ * constraints: multiple of 8
+ */
+ void (*vector_dmul_scalar)(double *dst, const double *src, double mul,
+ int len);
+} AVFloatDSPContext;
+
+/**
+ * Initialize a float DSP context.
+ *
+ * @param fdsp float DSP context
+ * @param strict setting to non-zero avoids using functions which may not be IEEE-754 compliant
+ */
+void avpriv_float_dsp_init(AVFloatDSPContext *fdsp, int strict);
+
+
+void ff_float_dsp_init_arm(AVFloatDSPContext *fdsp);
+void ff_float_dsp_init_ppc(AVFloatDSPContext *fdsp, int strict);
+void ff_float_dsp_init_x86(AVFloatDSPContext *fdsp);
+
+#endif /* AVUTIL_FLOAT_DSP_H */
diff --git a/gst-libs/ext/libav/libavutil/imgutils.c b/gst-libs/ext/libav/libavutil/imgutils.c
index b734db7..413329d 100644
--- a/gst-libs/ext/libav/libavutil/imgutils.c
+++ b/gst-libs/ext/libav/libavutil/imgutils.c
@@ -21,6 +21,7 @@
* misc image utilities
*/
+#include "common.h"
#include "imgutils.h"
#include "internal.h"
#include "log.h"
@@ -44,13 +45,16 @@ void av_image_fill_max_pixsteps(int max_pixsteps[4], int max_pixstep_comps[4],
}
}
-int av_image_get_linesize(enum PixelFormat pix_fmt, int width, int plane)
+int av_image_get_linesize(enum AVPixelFormat pix_fmt, int width, int plane)
{
- const AVPixFmtDescriptor *desc = &av_pix_fmt_descriptors[pix_fmt];
+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
int max_step [4]; /* max pixel step for each plane */
int max_step_comp[4]; /* the component for each plane which has the max pixel step */
int s;
+ if (!desc)
+ return AVERROR(EINVAL);
+
if (desc->flags & PIX_FMT_BITSTREAM)
return (width * (desc->comp[0].step_minus1+1) + 7) >> 3;
@@ -59,16 +63,16 @@ int av_image_get_linesize(enum PixelFormat pix_fmt, int width, int plane)
return max_step[plane] * (((width + (1 << s) - 1)) >> s);
}
-int av_image_fill_linesizes(int linesizes[4], enum PixelFormat pix_fmt, int width)
+int av_image_fill_linesizes(int linesizes[4], enum AVPixelFormat pix_fmt, int width)
{
int i;
- const AVPixFmtDescriptor *desc = &av_pix_fmt_descriptors[pix_fmt];
+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
int max_step [4]; /* max pixel step for each plane */
int max_step_comp[4]; /* the component for each plane which has the max pixel step */
memset(linesizes, 0, 4*sizeof(linesizes[0]));
- if ((unsigned)pix_fmt >= PIX_FMT_NB || desc->flags & PIX_FMT_HWACCEL)
+ if (!desc || desc->flags & PIX_FMT_HWACCEL)
return AVERROR(EINVAL);
if (desc->flags & PIX_FMT_BITSTREAM) {
@@ -90,17 +94,15 @@ int av_image_fill_linesizes(int linesizes[4], enum PixelFormat pix_fmt, int widt
return 0;
}
-int av_image_fill_pointers(uint8_t *data[4], enum PixelFormat pix_fmt, int height,
+int av_image_fill_pointers(uint8_t *data[4], enum AVPixelFormat pix_fmt, int height,
uint8_t *ptr, const int linesizes[4])
{
- int i, total_size, size[4], has_plane[4];
+ int i, total_size, size[4] = { 0 }, has_plane[4] = { 0 };
- const AVPixFmtDescriptor *desc = &av_pix_fmt_descriptors[pix_fmt];
+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
memset(data , 0, sizeof(data[0])*4);
- memset(size , 0, sizeof(size));
- memset(has_plane, 0, sizeof(has_plane));
- if ((unsigned)pix_fmt >= PIX_FMT_NB || desc->flags & PIX_FMT_HWACCEL)
+ if (!desc || desc->flags & PIX_FMT_HWACCEL)
return AVERROR(EINVAL);
data[0] = ptr;
@@ -108,7 +110,8 @@ int av_image_fill_pointers(uint8_t *data[4], enum PixelFormat pix_fmt, int heigh
return AVERROR(EINVAL);
size[0] = linesizes[0] * height;
- if (desc->flags & PIX_FMT_PAL) {
+ if (desc->flags & PIX_FMT_PAL ||
+ desc->flags & PIX_FMT_PSEUDOPAL) {
size[0] = (size[0] + 3) & ~3;
data[1] = ptr + size[0]; /* palette is stored here as 256 32 bits words */
return size[0] + 256 * 4;
@@ -133,7 +136,7 @@ int av_image_fill_pointers(uint8_t *data[4], enum PixelFormat pix_fmt, int heigh
return total_size;
}
-int ff_set_systematic_pal2(uint32_t pal[256], enum PixelFormat pix_fmt)
+int avpriv_set_systematic_pal2(uint32_t pal[256], enum AVPixelFormat pix_fmt)
{
int i;
@@ -141,27 +144,27 @@ int ff_set_systematic_pal2(uint32_t pal[256], enum PixelFormat pix_fmt)
int r, g, b;
switch (pix_fmt) {
- case PIX_FMT_RGB8:
+ case AV_PIX_FMT_RGB8:
r = (i>>5 )*36;
g = ((i>>2)&7)*36;
b = (i&3 )*85;
break;
- case PIX_FMT_BGR8:
+ case AV_PIX_FMT_BGR8:
b = (i>>6 )*85;
g = ((i>>3)&7)*36;
r = (i&7 )*36;
break;
- case PIX_FMT_RGB4_BYTE:
+ case AV_PIX_FMT_RGB4_BYTE:
r = (i>>3 )*255;
g = ((i>>1)&3)*85;
b = (i&1 )*255;
break;
- case PIX_FMT_BGR4_BYTE:
+ case AV_PIX_FMT_BGR4_BYTE:
b = (i>>3 )*255;
g = ((i>>1)&3)*85;
r = (i&1 )*255;
break;
- case PIX_FMT_GRAY8:
+ case AV_PIX_FMT_GRAY8:
r = b = g = i;
break;
default:
@@ -174,11 +177,15 @@ int ff_set_systematic_pal2(uint32_t pal[256], enum PixelFormat pix_fmt)
}
int av_image_alloc(uint8_t *pointers[4], int linesizes[4],
- int w, int h, enum PixelFormat pix_fmt, int align)
+ int w, int h, enum AVPixelFormat pix_fmt, int align)
{
+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
int i, ret;
uint8_t *buf;
+ if (!desc)
+ return AVERROR(EINVAL);
+
if ((ret = av_image_check_size(w, h, 0, NULL)) < 0)
return ret;
if ((ret = av_image_fill_linesizes(linesizes, pix_fmt, w)) < 0)
@@ -196,8 +203,8 @@ int av_image_alloc(uint8_t *pointers[4], int linesizes[4],
av_free(buf);
return ret;
}
- if (av_pix_fmt_descriptors[pix_fmt].flags & PIX_FMT_PAL)
- ff_set_systematic_pal2((uint32_t*)pointers[1], pix_fmt);
+ if (desc->flags & PIX_FMT_PAL || desc->flags & PIX_FMT_PSEUDOPAL)
+ avpriv_set_systematic_pal2((uint32_t*)pointers[1], pix_fmt);
return ret;
}
@@ -236,14 +243,15 @@ void av_image_copy_plane(uint8_t *dst, int dst_linesize,
void av_image_copy(uint8_t *dst_data[4], int dst_linesizes[4],
const uint8_t *src_data[4], const int src_linesizes[4],
- enum PixelFormat pix_fmt, int width, int height)
+ enum AVPixelFormat pix_fmt, int width, int height)
{
- const AVPixFmtDescriptor *desc = &av_pix_fmt_descriptors[pix_fmt];
+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
- if (desc->flags & PIX_FMT_HWACCEL)
+ if (!desc || desc->flags & PIX_FMT_HWACCEL)
return;
- if (desc->flags & PIX_FMT_PAL) {
+ if (desc->flags & PIX_FMT_PAL ||
+ desc->flags & PIX_FMT_PSEUDOPAL) {
av_image_copy_plane(dst_data[0], dst_linesizes[0],
src_data[0], src_linesizes[0],
width, height);
diff --git a/gst-libs/ext/libav/libavutil/imgutils.h b/gst-libs/ext/libav/libavutil/imgutils.h
index 3815a49..7151013 100644
--- a/gst-libs/ext/libav/libavutil/imgutils.h
+++ b/gst-libs/ext/libav/libavutil/imgutils.h
@@ -55,7 +55,7 @@ void av_image_fill_max_pixsteps(int max_pixsteps[4], int max_pixstep_comps[4],
*
* @return the computed size in bytes
*/
-int av_image_get_linesize(enum PixelFormat pix_fmt, int width, int plane);
+int av_image_get_linesize(enum AVPixelFormat pix_fmt, int width, int plane);
/**
* Fill plane linesizes for an image with pixel format pix_fmt and
@@ -64,7 +64,7 @@ int av_image_get_linesize(enum PixelFormat pix_fmt, int width, int plane);
* @param linesizes array to be filled with the linesize for each plane
* @return >= 0 in case of success, a negative error code otherwise
*/
-int av_image_fill_linesizes(int linesizes[4], enum PixelFormat pix_fmt, int width);
+int av_image_fill_linesizes(int linesizes[4], enum AVPixelFormat pix_fmt, int width);
/**
* Fill plane data pointers for an image with pixel format pix_fmt and
@@ -77,7 +77,7 @@ int av_image_fill_linesizes(int linesizes[4], enum PixelFormat pix_fmt, int widt
* @return the size in bytes required for the image buffer, a negative
* error code in case of failure
*/
-int av_image_fill_pointers(uint8_t *data[4], enum PixelFormat pix_fmt, int height,
+int av_image_fill_pointers(uint8_t *data[4], enum AVPixelFormat pix_fmt, int height,
uint8_t *ptr, const int linesizes[4]);
/**
@@ -91,7 +91,7 @@ int av_image_fill_pointers(uint8_t *data[4], enum PixelFormat pix_fmt, int heigh
* error code in case of failure
*/
int av_image_alloc(uint8_t *pointers[4], int linesizes[4],
- int w, int h, enum PixelFormat pix_fmt, int align);
+ int w, int h, enum AVPixelFormat pix_fmt, int align);
/**
* Copy image plane from src to dst.
@@ -114,7 +114,7 @@ void av_image_copy_plane(uint8_t *dst, int dst_linesize,
*/
void av_image_copy(uint8_t *dst_data[4], int dst_linesizes[4],
const uint8_t *src_data[4], const int src_linesizes[4],
- enum PixelFormat pix_fmt, int width, int height);
+ enum AVPixelFormat pix_fmt, int width, int height);
/**
* Check if the given dimension of an image is valid, meaning that all
@@ -128,7 +128,7 @@ void av_image_copy(uint8_t *dst_data[4], int dst_linesizes[4],
*/
int av_image_check_size(unsigned int w, unsigned int h, int log_offset, void *log_ctx);
-int ff_set_systematic_pal2(uint32_t pal[256], enum PixelFormat pix_fmt);
+int avpriv_set_systematic_pal2(uint32_t pal[256], enum AVPixelFormat pix_fmt);
/**
* @}
diff --git a/gst-libs/ext/libav/libavutil/internal.h b/gst-libs/ext/libav/libavutil/internal.h
index ae678d5..f0f5a63 100644
--- a/gst-libs/ext/libav/libavutil/internal.h
+++ b/gst-libs/ext/libav/libavutil/internal.h
@@ -39,11 +39,6 @@
#include "timer.h"
#include "dict.h"
-struct AVDictionary {
- int count;
- AVDictionaryEntry *elems;
-};
-
#ifndef attribute_align_arg
#if ARCH_X86_32 && AV_GCC_VERSION_AT_LEAST(4,2)
# define attribute_align_arg __attribute__((force_align_arg_pointer))
@@ -52,114 +47,16 @@ struct AVDictionary {
#endif
#endif
-#ifndef INT16_MIN
-#define INT16_MIN (-0x7fff - 1)
-#endif
-
-#ifndef INT16_MAX
-#define INT16_MAX 0x7fff
-#endif
-
-#ifndef INT32_MIN
-#define INT32_MIN (-0x7fffffff - 1)
-#endif
-
-#ifndef INT32_MAX
-#define INT32_MAX 0x7fffffff
-#endif
-
-#ifndef UINT32_MAX
-#define UINT32_MAX 0xffffffff
-#endif
-
-#ifndef INT64_MIN
-#define INT64_MIN (-0x7fffffffffffffffLL - 1)
-#endif
-
-#ifndef INT64_MAX
-#define INT64_MAX INT64_C(9223372036854775807)
-#endif
-
-#ifndef UINT64_MAX
-#define UINT64_MAX UINT64_C(0xFFFFFFFFFFFFFFFF)
+#if defined(_MSC_VER) && CONFIG_SHARED
+# define av_export __declspec(dllimport)
+#else
+# define av_export
#endif
#ifndef INT_BIT
# define INT_BIT (CHAR_BIT * sizeof(int))
#endif
-#ifndef offsetof
-# define offsetof(T, F) ((unsigned int)((char *)&((T *)0)->F))
-#endif
-
-/* Use to export labels from asm. */
-#define LABEL_MANGLE(a) EXTERN_PREFIX #a
-
-// Use rip-relative addressing if compiling PIC code on x86-64.
-#if ARCH_X86_64 && defined(PIC)
-# define LOCAL_MANGLE(a) #a "(%%rip)"
-#else
-# define LOCAL_MANGLE(a) #a
-#endif
-
-#define MANGLE(a) EXTERN_PREFIX LOCAL_MANGLE(a)
-
-/* debug stuff */
-
-#define av_abort() do { av_log(NULL, AV_LOG_ERROR, "Abort at %s:%d\n", __FILE__, __LINE__); abort(); } while (0)
-
-/* math */
-
-#if ARCH_X86
-#define MASK_ABS(mask, level)\
- __asm__ volatile(\
- "cltd \n\t"\
- "xorl %1, %0 \n\t"\
- "subl %1, %0 \n\t"\
- : "+a" (level), "=&d" (mask)\
- );
-#else
-#define MASK_ABS(mask, level)\
- mask = level >> 31;\
- level = (level ^ mask) - mask;
-#endif
-
-/* avoid usage of dangerous/inappropriate system functions */
-#undef malloc
-#define malloc please_use_av_malloc
-#undef free
-#define free please_use_av_free
-#undef realloc
-#define realloc please_use_av_realloc
-#undef time
-#define time time_is_forbidden_due_to_security_issues
-#undef rand
-#define rand rand_is_forbidden_due_to_state_trashing_use_av_lfg_get
-#undef srand
-#define srand srand_is_forbidden_due_to_state_trashing_use_av_lfg_init
-#undef random
-#define random random_is_forbidden_due_to_state_trashing_use_av_lfg_get
-#undef sprintf
-#define sprintf sprintf_is_forbidden_due_to_security_issues_use_snprintf
-#undef strcat
-#define strcat strcat_is_forbidden_due_to_security_issues_use_av_strlcat
-#undef strncpy
-#define strncpy strncpy_is_forbidden_due_to_security_issues_use_av_strlcpy
-#undef exit
-#define exit exit_is_forbidden
-#undef printf
-#define printf please_use_av_log_instead_of_printf
-#undef fprintf
-#define fprintf please_use_av_log_instead_of_fprintf
-#undef puts
-#define puts please_use_av_log_instead_of_puts
-#undef perror
-#define perror please_use_av_log_instead_of_perror
-#undef strcasecmp
-#define strcasecmp please_use_av_strcasecmp
-#undef strncasecmp
-#define strncasecmp please_use_av_strncasecmp
-
#define FF_ALLOC_OR_GOTO(ctx, p, size, label)\
{\
p = av_malloc(size);\
@@ -231,7 +128,7 @@ struct AVDictionary {
# define ONLY_IF_THREADS_ENABLED(x) NULL
#endif
-#if HAVE_MMX
+#if HAVE_MMX_INLINE
/**
* Empty mmx state.
* this must be called between any dsp function and float/double code.
@@ -241,8 +138,11 @@ static av_always_inline void emms_c(void)
{
__asm__ volatile ("emms" ::: "memory");
}
-#else /* HAVE_MMX */
-#define emms_c()
-#endif /* HAVE_MMX */
+#elif HAVE_MMX && HAVE_MM_EMPTY
+# include <mmintrin.h>
+# define emms_c _mm_empty
+#else
+# define emms_c()
+#endif /* HAVE_MMX_INLINE */
#endif /* AVUTIL_INTERNAL_H */
diff --git a/gst-libs/ext/libav/libavutil/intfloat.h b/gst-libs/ext/libav/libavutil/intfloat.h
index 9db624a..38d26ad 100644
--- a/gst-libs/ext/libav/libavutil/intfloat.h
+++ b/gst-libs/ext/libav/libavutil/intfloat.h
@@ -39,7 +39,8 @@ union av_intfloat64 {
*/
static av_always_inline float av_int2float(uint32_t i)
{
- union av_intfloat32 v = { .i = i };
+ union av_intfloat32 v;
+ v.i = i;
return v.f;
}
@@ -48,7 +49,8 @@ static av_always_inline float av_int2float(uint32_t i)
*/
static av_always_inline uint32_t av_float2int(float f)
{
- union av_intfloat32 v = { .f = f };
+ union av_intfloat32 v;
+ v.f = f;
return v.i;
}
@@ -57,7 +59,8 @@ static av_always_inline uint32_t av_float2int(float f)
*/
static av_always_inline double av_int2double(uint64_t i)
{
- union av_intfloat64 v = { .i = i };
+ union av_intfloat64 v;
+ v.i = i;
return v.f;
}
@@ -66,7 +69,8 @@ static av_always_inline double av_int2double(uint64_t i)
*/
static av_always_inline uint64_t av_double2int(double f)
{
- union av_intfloat64 v = { .f = f };
+ union av_intfloat64 v;
+ v.f = f;
return v.i;
}
diff --git a/gst-libs/ext/libav/libavutil/intfloat_readwrite.c b/gst-libs/ext/libav/libavutil/intfloat_readwrite.c
index 4c8de7b..6838563 100644
--- a/gst-libs/ext/libav/libavutil/intfloat_readwrite.c
+++ b/gst-libs/ext/libav/libavutil/intfloat_readwrite.c
@@ -95,4 +95,3 @@ AVExtFloat av_dbl2ext(double d){
ext.exponent[0] |= 0x80;
return ext;
}
-
diff --git a/gst-libs/ext/libav/libavutil/intmath.c b/gst-libs/ext/libav/libavutil/intmath.c
new file mode 100644
index 0000000..8db425c
--- /dev/null
+++ b/gst-libs/ext/libav/libavutil/intmath.c
@@ -0,0 +1,39 @@
+/*
+ * 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
+ */
+
+#include "intmath.h"
+
+/* undef these to get the function prototypes from common.h */
+#undef av_log2
+#undef av_log2_16bit
+#include "common.h"
+
+int av_log2(unsigned v)
+{
+ return ff_log2(v);
+}
+
+int av_log2_16bit(unsigned v)
+{
+ return ff_log2_16bit(v);
+}
+
+int av_ctz(int v)
+{
+ return ff_ctz(v);
+}
diff --git a/gst-libs/ext/libav/libavutil/intmath.h b/gst-libs/ext/libav/libavutil/intmath.h
index e6a2e10..a5ee652 100644
--- a/gst-libs/ext/libav/libavutil/intmath.h
+++ b/gst-libs/ext/libav/libavutil/intmath.h
@@ -22,64 +22,123 @@
#define AVUTIL_INTMATH_H
#include <stdint.h>
+
#include "config.h"
#include "attributes.h"
+#if ARCH_ARM
+# include "arm/intmath.h"
+#endif
+
/**
* @addtogroup lavu_internal
* @{
*/
-extern const uint32_t ff_inverse[257];
-
-#if ARCH_ARM
-# include "arm/intmath.h"
-#elif ARCH_X86
-# include "x86/intmath.h"
-#endif
-
#if HAVE_FAST_CLZ && AV_GCC_VERSION_AT_LEAST(3,4)
-#ifndef av_log2
-# define av_log2(x) (31 - __builtin_clz((x)|1))
-# ifndef av_log2_16bit
-# define av_log2_16bit av_log2
+#ifndef ff_log2
+# define ff_log2(x) (31 - __builtin_clz((x)|1))
+# ifndef ff_log2_16bit
+# define ff_log2_16bit av_log2
# endif
-#endif /* av_log2 */
+#endif /* ff_log2 */
#endif /* AV_GCC_VERSION_AT_LEAST(3,4) */
-#ifndef FASTDIV
-# if CONFIG_FASTDIV
-# define FASTDIV(a,b) ((uint32_t)((((uint64_t)a) * ff_inverse[b]) >> 32))
-# else
-# define FASTDIV(a,b) ((a) / (b))
-# endif
-#endif /* FASTDIV */
+extern const uint8_t ff_log2_tab[256];
-#include "common.h"
+#ifndef ff_log2
+#define ff_log2 ff_log2_c
+static av_always_inline av_const int ff_log2_c(unsigned int v)
+{
+ int n = 0;
+ if (v & 0xffff0000) {
+ v >>= 16;
+ n += 16;
+ }
+ if (v & 0xff00) {
+ v >>= 8;
+ n += 8;
+ }
+ n += ff_log2_tab[v];
-extern const uint8_t ff_sqrt_tab[256];
+ return n;
+}
+#endif
-static inline av_const unsigned int ff_sqrt(unsigned int a)
+#ifndef ff_log2_16bit
+#define ff_log2_16bit ff_log2_16bit_c
+static av_always_inline av_const int ff_log2_16bit_c(unsigned int v)
{
- unsigned int b;
+ int n = 0;
+ if (v & 0xff00) {
+ v >>= 8;
+ n += 8;
+ }
+ n += ff_log2_tab[v];
- if (a < 255) return (ff_sqrt_tab[a + 1] - 1) >> 4;
- else if (a < (1 << 12)) b = ff_sqrt_tab[a >> 4] >> 2;
-#if !CONFIG_SMALL
- else if (a < (1 << 14)) b = ff_sqrt_tab[a >> 6] >> 1;
- else if (a < (1 << 16)) b = ff_sqrt_tab[a >> 8] ;
+ return n;
+}
#endif
- else {
- int s = av_log2_16bit(a >> 16) >> 1;
- unsigned int c = a >> (s + 2);
- b = ff_sqrt_tab[c >> (s + 8)];
- b = FASTDIV(c,b) + (b << s);
+
+#define av_log2 ff_log2
+#define av_log2_16bit ff_log2_16bit
+
+/**
+ * @}
+ */
+
+/**
+ * @addtogroup lavu_math
+ * @{
+ */
+
+#if HAVE_FAST_CLZ && AV_GCC_VERSION_AT_LEAST(3,4)
+#ifndef ff_ctz
+#define ff_ctz(v) __builtin_ctz(v)
+#endif
+#endif
+
+#ifndef ff_ctz
+#define ff_ctz ff_ctz_c
+static av_always_inline av_const int ff_ctz_c(int v)
+{
+ int c;
+
+ if (v & 0x1)
+ return 0;
+
+ c = 1;
+ if (!(v & 0xffff)) {
+ v >>= 16;
+ c += 16;
+ }
+ if (!(v & 0xff)) {
+ v >>= 8;
+ c += 8;
+ }
+ if (!(v & 0xf)) {
+ v >>= 4;
+ c += 4;
+ }
+ if (!(v & 0x3)) {
+ v >>= 2;
+ c += 2;
}
+ c -= v & 0x1;
- return b - (a < b * b);
+ return c;
}
+#endif
+
+/**
+ * Trailing zero bit count.
+ *
+ * @param v input value. If v is 0, the result is undefined.
+ * @return the number of trailing 0-bits
+ */
+int av_ctz(int v);
/**
* @}
diff --git a/gst-libs/ext/libav/libavutil/intreadwrite.h b/gst-libs/ext/libav/libavutil/intreadwrite.h
index 01eb278..f77fd60 100644
--- a/gst-libs/ext/libav/libavutil/intreadwrite.h
+++ b/gst-libs/ext/libav/libavutil/intreadwrite.h
@@ -462,6 +462,33 @@ union unaligned_16 { uint16_t l; } __attribute__((packed)) av_alias;
# define AV_WN64A(p, v) AV_WNA(64, p, v)
#endif
+/*
+ * The AV_COPYxxU macros are suitable for copying data to/from unaligned
+ * memory locations.
+ */
+
+#define AV_COPYU(n, d, s) AV_WN##n(d, AV_RN##n(s));
+
+#ifndef AV_COPY16U
+# define AV_COPY16U(d, s) AV_COPYU(16, d, s)
+#endif
+
+#ifndef AV_COPY32U
+# define AV_COPY32U(d, s) AV_COPYU(32, d, s)
+#endif
+
+#ifndef AV_COPY64U
+# define AV_COPY64U(d, s) AV_COPYU(64, d, s)
+#endif
+
+#ifndef AV_COPY128U
+# define AV_COPY128U(d, s) \
+ do { \
+ AV_COPY64U(d, s); \
+ AV_COPY64U((char *)(d) + 8, (const char *)(s) + 8); \
+ } while(0)
+#endif
+
/* Parameters for AV_COPY*, AV_SWAP*, AV_ZERO* must be
* naturally aligned. They may be implemented using MMX,
* so emms_c() must be called before using any float code
diff --git a/gst-libs/ext/libav/libavutil/inverse.c b/gst-libs/ext/libav/libavutil/inverse.c
deleted file mode 100644
index 5a5c490..0000000
--- a/gst-libs/ext/libav/libavutil/inverse.c
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Inverse table
- * Copyright (c) 2002-2004 Michael Niedermayer <michaelni@gmx.at>
- *
- * 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
- */
-
-#include <stdint.h>
-
-/* a*inverse[b]>>32 == a/b for all 0<=a<=16909558 && 2<=b<=256
- * for a>16909558, is an overestimate by less than 1 part in 1<<24 */
-const uint32_t ff_inverse[257]={
- 0, 4294967295U,2147483648U,1431655766, 1073741824, 858993460, 715827883, 613566757,
- 536870912, 477218589, 429496730, 390451573, 357913942, 330382100, 306783379, 286331154,
- 268435456, 252645136, 238609295, 226050911, 214748365, 204522253, 195225787, 186737709,
- 178956971, 171798692, 165191050, 159072863, 153391690, 148102321, 143165577, 138547333,
- 134217728, 130150525, 126322568, 122713352, 119304648, 116080198, 113025456, 110127367,
- 107374183, 104755300, 102261127, 99882961, 97612894, 95443718, 93368855, 91382283,
- 89478486, 87652394, 85899346, 84215046, 82595525, 81037119, 79536432, 78090315,
- 76695845, 75350304, 74051161, 72796056, 71582789, 70409300, 69273667, 68174085,
- 67108864, 66076420, 65075263, 64103990, 63161284, 62245903, 61356676, 60492498,
- 59652324, 58835169, 58040099, 57266231, 56512728, 55778797, 55063684, 54366675,
- 53687092, 53024288, 52377650, 51746594, 51130564, 50529028, 49941481, 49367441,
- 48806447, 48258060, 47721859, 47197443, 46684428, 46182445, 45691142, 45210183,
- 44739243, 44278014, 43826197, 43383509, 42949673, 42524429, 42107523, 41698712,
- 41297763, 40904451, 40518560, 40139882, 39768216, 39403370, 39045158, 38693400,
- 38347923, 38008561, 37675152, 37347542, 37025581, 36709123, 36398028, 36092163,
- 35791395, 35495598, 35204650, 34918434, 34636834, 34359739, 34087043, 33818641,
- 33554432, 33294321, 33038210, 32786010, 32537632, 32292988, 32051995, 31814573,
- 31580642, 31350127, 31122952, 30899046, 30678338, 30460761, 30246249, 30034737,
- 29826162, 29620465, 29417585, 29217465, 29020050, 28825284, 28633116, 28443493,
- 28256364, 28071682, 27889399, 27709467, 27531842, 27356480, 27183338, 27012373,
- 26843546, 26676816, 26512144, 26349493, 26188825, 26030105, 25873297, 25718368,
- 25565282, 25414008, 25264514, 25116768, 24970741, 24826401, 24683721, 24542671,
- 24403224, 24265352, 24129030, 23994231, 23860930, 23729102, 23598722, 23469767,
- 23342214, 23216040, 23091223, 22967740, 22845571, 22724695, 22605092, 22486740,
- 22369622, 22253717, 22139007, 22025474, 21913099, 21801865, 21691755, 21582751,
- 21474837, 21367997, 21262215, 21157475, 21053762, 20951060, 20849356, 20748635,
- 20648882, 20550083, 20452226, 20355296, 20259280, 20164166, 20069941, 19976593,
- 19884108, 19792477, 19701685, 19611723, 19522579, 19434242, 19346700, 19259944,
- 19173962, 19088744, 19004281, 18920561, 18837576, 18755316, 18673771, 18592933,
- 18512791, 18433337, 18354562, 18276457, 18199014, 18122225, 18046082, 17970575,
- 17895698, 17821442, 17747799, 17674763, 17602325, 17530479, 17459217, 17388532,
- 17318417, 17248865, 17179870, 17111424, 17043522, 16976156, 16909321, 16843010,
- 16777216
-};
diff --git a/gst-libs/ext/libav/libavutil/lfg.c b/gst-libs/ext/libav/libavutil/lfg.c
index 227af68..4221e62 100644
--- a/gst-libs/ext/libav/libavutil/lfg.c
+++ b/gst-libs/ext/libav/libavutil/lfg.c
@@ -27,7 +27,7 @@
#include "intreadwrite.h"
#include "attributes.h"
-void av_cold av_lfg_init(AVLFG *c, unsigned int seed)
+av_cold void av_lfg_init(AVLFG *c, unsigned int seed)
{
uint8_t tmp[16] = { 0 };
int i;
@@ -72,10 +72,8 @@ int main(void)
av_lfg_init(&state, 0xdeadbeef);
for (j = 0; j < 10000; j++) {
START_TIMER
- for (i = 0; i < 624; i++) {
- //av_log(NULL, AV_LOG_ERROR, "%X\n", av_lfg_get(&state));
+ for (i = 0; i < 624; i++)
x += av_lfg_get(&state);
- }
STOP_TIMER("624 calls of av_lfg_get");
}
av_log(NULL, AV_LOG_ERROR, "final value:%X\n", x);
diff --git a/gst-libs/ext/libav/libavutil/lfg.h b/gst-libs/ext/libav/libavutil/lfg.h
index 904d00a..5e526c1 100644
--- a/gst-libs/ext/libav/libavutil/lfg.h
+++ b/gst-libs/ext/libav/libavutil/lfg.h
@@ -22,7 +22,7 @@
#ifndef AVUTIL_LFG_H
#define AVUTIL_LFG_H
-typedef struct {
+typedef struct AVLFG {
unsigned int state[64];
int index;
} AVLFG;
diff --git a/gst-libs/ext/libav/libavutil/libavutil.v b/gst-libs/ext/libav/libavutil/libavutil.v
index ec52f2b..e9f04cb 100644
--- a/gst-libs/ext/libav/libavutil/libavutil.v
+++ b/gst-libs/ext/libav/libavutil/libavutil.v
@@ -1,4 +1,4 @@
LIBAVUTIL_$MAJOR {
- global: av_*; ff_*; avutil_*;
+ global: av*;
local: *;
};
diff --git a/gst-libs/ext/libav/libavutil/libm.h b/gst-libs/ext/libav/libavutil/libm.h
index 783f3cd..d6c2cf8 100644
--- a/gst-libs/ext/libav/libavutil/libm.h
+++ b/gst-libs/ext/libav/libavutil/libm.h
@@ -27,6 +27,39 @@
#include <math.h>
#include "config.h"
#include "attributes.h"
+#include "intfloat.h"
+
+#if !HAVE_ATANF
+#undef atanf
+#define atanf(x) ((float)atan(x))
+#endif
+
+#if !HAVE_ATAN2F
+#undef atan2f
+#define atan2f(y, x) ((float)atan2(y, x))
+#endif
+
+#if !HAVE_POWF
+#undef powf
+#define powf(x, y) ((float)pow(x, y))
+#endif
+
+#if !HAVE_CBRTF
+static av_always_inline float cbrtf(float x)
+{
+ return x < 0 ? -powf(-x, 1.0 / 3.0) : powf(x, 1.0 / 3.0);
+}
+#endif
+
+#if !HAVE_COSF
+#undef cosf
+#define cosf(x) ((float)cos(x))
+#endif
+
+#if !HAVE_EXPF
+#undef expf
+#define expf(x) ((float)exp(x))
+#endif
#if !HAVE_EXP2
#undef exp2
@@ -38,6 +71,31 @@
#define exp2f(x) ((float)exp2(x))
#endif /* HAVE_EXP2F */
+#if !HAVE_ISINF
+static av_always_inline av_const int isinf(float x)
+{
+ uint32_t v = av_float2int(x);
+ if ((v & 0x7f800000) != 0x7f800000)
+ return 0;
+ return !(v & 0x007fffff);
+}
+#endif /* HAVE_ISINF */
+
+#if !HAVE_ISNAN
+static av_always_inline av_const int isnan(float x)
+{
+ uint32_t v = av_float2int(x);
+ if ((v & 0x7f800000) != 0x7f800000)
+ return 0;
+ return v & 0x007fffff;
+}
+#endif /* HAVE_ISNAN */
+
+#if !HAVE_LDEXPF
+#undef ldexpf
+#define ldexpf(x, exp) ((float)ldexp(x, exp))
+#endif
+
#if !HAVE_LLRINT
#undef llrint
#define llrint(x) ((long long)rint(x))
@@ -58,6 +116,23 @@
#define log2f(x) ((float)log2(x))
#endif /* HAVE_LOG2F */
+#if !HAVE_LOG10F
+#undef log10f
+#define log10f(x) ((float)log10(x))
+#endif
+
+#if !HAVE_SINF
+#undef sinf
+#define sinf(x) ((float)sin(x))
+#endif
+
+#if !HAVE_RINT
+static inline double rint(double x)
+{
+ return x >= 0 ? floor(x + 0.5) : ceil(x - 0.5);
+}
+#endif /* HAVE_RINT */
+
#if !HAVE_LRINT
static av_always_inline av_const long int lrint(double x)
{
diff --git a/gst-libs/ext/libav/libavutil/log.c b/gst-libs/ext/libav/libavutil/log.c
index 2969355..8012976 100644
--- a/gst-libs/ext/libav/libavutil/log.c
+++ b/gst-libs/ext/libav/libavutil/log.c
@@ -24,34 +24,41 @@
* logging functions
*/
+#include "config.h"
+
+#if HAVE_UNISTD_H
#include <unistd.h>
+#endif
+#if HAVE_IO_H
+#include <io.h>
+#endif
#include <stdlib.h>
#include "avstring.h"
#include "avutil.h"
+#include "common.h"
#include "log.h"
static int av_log_level = AV_LOG_INFO;
static int flags;
-#if defined(_WIN32) && !defined(__MINGW32CE__)
+#if HAVE_SETCONSOLETEXTATTRIBUTE
#include <windows.h>
-static const uint8_t color[] = { 12, 12, 12, 14, 7, 7, 7 };
+static const uint8_t color[] = { 12, 12, 12, 14, 7, 10, 11 };
static int16_t background, attr_orig;
static HANDLE con;
#define set_color(x) SetConsoleTextAttribute(con, background | color[x])
#define reset_color() SetConsoleTextAttribute(con, attr_orig)
#else
-static const uint8_t color[] = { 0x41, 0x41, 0x11, 0x03, 9, 9, 9 };
+static const uint8_t color[] = { 0x41, 0x41, 0x11, 0x03, 9, 0x02, 0x06 };
#define set_color(x) fprintf(stderr, "\033[%d;3%dm", color[x] >> 4, color[x]&15)
#define reset_color() fprintf(stderr, "\033[0m")
#endif
static int use_color = -1;
-#undef fprintf
static void colored_fputs(int level, const char *str)
{
if (use_color < 0) {
-#if defined(_WIN32) && !defined(__MINGW32CE__)
+#if HAVE_SETCONSOLETEXTATTRIBUTE
CONSOLE_SCREEN_BUFFER_INFO con_info;
con = GetStdHandle(STD_ERROR_HANDLE);
use_color = (con != INVALID_HANDLE_VALUE) && !getenv("NO_COLOR") &&
@@ -96,7 +103,6 @@ void av_log_default_callback(void* ptr, int level, const char* fmt, va_list vl)
if (level > av_log_level)
return;
line[0] = 0;
-#undef fprintf
if (print_prefix && avc) {
if (avc->parent_log_context_offset) {
AVClass** parent = *(AVClass ***) (((uint8_t *) ptr) +
diff --git a/gst-libs/ext/libav/libavutil/log.h b/gst-libs/ext/libav/libavutil/log.h
index 0678e1a..7b17330 100644
--- a/gst-libs/ext/libav/libavutil/log.h
+++ b/gst-libs/ext/libav/libavutil/log.h
@@ -65,10 +65,11 @@ typedef struct AVClass {
int log_level_offset_offset;
/**
- * Offset in the structure where a pointer to the parent context for loging is stored.
- * for example a decoder that uses eval.c could pass its AVCodecContext to eval as such
- * parent context. And a av_log() implementation could then display the parent context
- * can be NULL of course
+ * Offset in the structure where a pointer to the parent context for
+ * logging is stored. For example a decoder could pass its AVCodecContext
+ * to eval as such a parent context, which an av_log() implementation
+ * could then leverage to display the parent context.
+ * The offset can be NULL.
*/
int parent_log_context_offset;
@@ -78,7 +79,7 @@ typedef struct AVClass {
void* (*child_next)(void *obj, void *prev);
/**
- * Return an AVClass corresponding to next potential
+ * Return an AVClass corresponding to the next potential
* AVOptions-enabled child.
*
* The difference between child_next and this is that
diff --git a/gst-libs/ext/libav/libavutil/log2_tab.c b/gst-libs/ext/libav/libavutil/log2_tab.c
new file mode 100644
index 0000000..f6cbe79
--- /dev/null
+++ b/gst-libs/ext/libav/libavutil/log2_tab.c
@@ -0,0 +1,30 @@
+/*
+ * 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
+ */
+
+#include <stdint.h>
+
+const uint8_t ff_log2_tab[256]={
+ 0,0,1,1,2,2,2,2,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,
+ 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
+ 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
+ 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7
+};
diff --git a/gst-libs/ext/libav/libavutil/lzo.c b/gst-libs/ext/libav/libavutil/lzo.c
index e49b83e..5c5ebc8 100644
--- a/gst-libs/ext/libav/libavutil/lzo.c
+++ b/gst-libs/ext/libav/libavutil/lzo.c
@@ -19,17 +19,18 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <string.h>
+
#include "avutil.h"
#include "common.h"
-/// Avoid e.g. MPlayers fast_memcpy, it slows things down here.
-#undef memcpy
-#include <string.h>
+#include "intreadwrite.h"
#include "lzo.h"
/// Define if we may write up to 12 bytes beyond the output buffer.
#define OUTBUF_PADDED 1
/// Define if we may read up to 8 bytes beyond the input buffer.
#define INBUF_PADDED 1
+
typedef struct LZOContext {
const uint8_t *in, *in_end;
uint8_t *out_start, *out, *out_end;
@@ -40,7 +41,8 @@ typedef struct LZOContext {
* @brief Reads one byte from the input buffer, avoiding an overrun.
* @return byte read
*/
-static inline int get_byte(LZOContext *c) {
+static inline int get_byte(LZOContext *c)
+{
if (c->in < c->in_end)
return *c->in++;
c->error |= AV_LZO_INPUT_DEPLETED;
@@ -59,57 +61,45 @@ static inline int get_byte(LZOContext *c) {
* @param mask bits used from x
* @return decoded length value
*/
-static inline int get_len(LZOContext *c, int x, int mask) {
+static inline int get_len(LZOContext *c, int x, int mask)
+{
int cnt = x & mask;
if (!cnt) {
- while (!(x = get_byte(c))) cnt += 255;
+ while (!(x = get_byte(c)))
+ cnt += 255;
cnt += mask + x;
}
return cnt;
}
-//#define UNALIGNED_LOADSTORE
-#define BUILTIN_MEMCPY
-#ifdef UNALIGNED_LOADSTORE
-#define COPY2(d, s) *(uint16_t *)(d) = *(uint16_t *)(s);
-#define COPY4(d, s) *(uint32_t *)(d) = *(uint32_t *)(s);
-#elif defined(BUILTIN_MEMCPY)
-#define COPY2(d, s) memcpy(d, s, 2);
-#define COPY4(d, s) memcpy(d, s, 4);
-#else
-#define COPY2(d, s) (d)[0] = (s)[0]; (d)[1] = (s)[1];
-#define COPY4(d, s) (d)[0] = (s)[0]; (d)[1] = (s)[1]; (d)[2] = (s)[2]; (d)[3] = (s)[3];
-#endif
-
/**
* @brief Copies bytes from input to output buffer with checking.
* @param cnt number of bytes to copy, must be >= 0
*/
-static inline void copy(LZOContext *c, int cnt) {
+static inline void copy(LZOContext *c, int cnt)
+{
register const uint8_t *src = c->in;
- register uint8_t *dst = c->out;
+ register uint8_t *dst = c->out;
if (cnt > c->in_end - src) {
- cnt = FFMAX(c->in_end - src, 0);
+ cnt = FFMAX(c->in_end - src, 0);
c->error |= AV_LZO_INPUT_DEPLETED;
}
if (cnt > c->out_end - dst) {
- cnt = FFMAX(c->out_end - dst, 0);
+ cnt = FFMAX(c->out_end - dst, 0);
c->error |= AV_LZO_OUTPUT_FULL;
}
#if defined(INBUF_PADDED) && defined(OUTBUF_PADDED)
- COPY4(dst, src);
+ AV_COPY32U(dst, src);
src += 4;
dst += 4;
cnt -= 4;
if (cnt > 0)
#endif
- memcpy(dst, src, cnt);
- c->in = src + cnt;
+ memcpy(dst, src, cnt);
+ c->in = src + cnt;
c->out = dst + cnt;
}
-static inline void memcpy_backptr(uint8_t *dst, int back, int cnt);
-
/**
* @brief Copies previously decoded bytes to current position.
* @param back how many bytes back we start
@@ -118,60 +108,24 @@ static inline void memcpy_backptr(uint8_t *dst, int back, int cnt);
* cnt > back is valid, this will copy the bytes we just copied,
* thus creating a repeating pattern with a period length of back.
*/
-static inline void copy_backptr(LZOContext *c, int back, int cnt) {
- register uint8_t *dst = c->out;
+static inline void copy_backptr(LZOContext *c, int back, int cnt)
+{
+ register uint8_t *dst = c->out;
if (dst - c->out_start < back) {
c->error |= AV_LZO_INVALID_BACKPTR;
return;
}
if (cnt > c->out_end - dst) {
- cnt = FFMAX(c->out_end - dst, 0);
+ cnt = FFMAX(c->out_end - dst, 0);
c->error |= AV_LZO_OUTPUT_FULL;
}
- memcpy_backptr(dst, back, cnt);
+ av_memcpy_backptr(dst, back, cnt);
c->out = dst + cnt;
}
-static inline void memcpy_backptr(uint8_t *dst, int back, int cnt) {
- const uint8_t *src = &dst[-back];
- if (back == 1) {
- memset(dst, *src, cnt);
- } else {
-#ifdef OUTBUF_PADDED
- COPY2(dst, src);
- COPY2(dst + 2, src + 2);
- src += 4;
- dst += 4;
- cnt -= 4;
- if (cnt > 0) {
- COPY2(dst, src);
- COPY2(dst + 2, src + 2);
- COPY2(dst + 4, src + 4);
- COPY2(dst + 6, src + 6);
- src += 8;
- dst += 8;
- cnt -= 8;
- }
-#endif
- if (cnt > 0) {
- int blocklen = back;
- while (cnt > blocklen) {
- memcpy(dst, src, blocklen);
- dst += blocklen;
- cnt -= blocklen;
- blocklen <<= 1;
- }
- memcpy(dst, src, cnt);
- }
- }
-}
-
-void av_memcpy_backptr(uint8_t *dst, int back, int cnt) {
- memcpy_backptr(dst, back, cnt);
-}
-
-int av_lzo1x_decode(void *out, int *outlen, const void *in, int *inlen) {
- int state= 0;
+int av_lzo1x_decode(void *out, int *outlen, const void *in, int *inlen)
+{
+ int state = 0;
int x;
LZOContext c;
if (!*outlen || !*inlen) {
@@ -182,16 +136,17 @@ int av_lzo1x_decode(void *out, int *outlen, const void *in, int *inlen) {
res |= AV_LZO_INPUT_DEPLETED;
return res;
}
- c.in = in;
- c.in_end = (const uint8_t *)in + *inlen;
- c.out = c.out_start = out;
- c.out_end = (uint8_t *)out + * outlen;
- c.error = 0;
- x = GETB(c);
+ c.in = in;
+ c.in_end = (const uint8_t *)in + *inlen;
+ c.out = c.out_start = out;
+ c.out_end = (uint8_t *)out + *outlen;
+ c.error = 0;
+ x = GETB(c);
if (x > 17) {
copy(&c, x - 17);
x = GETB(c);
- if (x < 16) c.error |= AV_LZO_ERROR;
+ if (x < 16)
+ c.error |= AV_LZO_ERROR;
}
if (c.in > c.in_end)
c.error |= AV_LZO_INPUT_DEPLETED;
@@ -199,16 +154,16 @@ int av_lzo1x_decode(void *out, int *outlen, const void *in, int *inlen) {
int cnt, back;
if (x > 15) {
if (x > 63) {
- cnt = (x >> 5) - 1;
+ cnt = (x >> 5) - 1;
back = (GETB(c) << 3) + ((x >> 2) & 7) + 1;
} else if (x > 31) {
- cnt = get_len(&c, x, 31);
- x = GETB(c);
+ cnt = get_len(&c, x, 31);
+ x = GETB(c);
back = (GETB(c) << 6) + (x >> 2) + 1;
} else {
- cnt = get_len(&c, x, 7);
- back = (1 << 14) + ((x & 8) << 11);
- x = GETB(c);
+ cnt = get_len(&c, x, 7);
+ back = (1 << 14) + ((x & 8) << 11);
+ x = GETB(c);
back += (GETB(c) << 6) + (x >> 2);
if (back == (1 << 14)) {
if (cnt != 1)
@@ -216,21 +171,21 @@ int av_lzo1x_decode(void *out, int *outlen, const void *in, int *inlen) {
break;
}
}
- } else if(!state){
- cnt = get_len(&c, x, 15);
- copy(&c, cnt + 3);
- x = GETB(c);
- if (x > 15)
- continue;
- cnt = 1;
- back = (1 << 11) + (GETB(c) << 2) + (x >> 2) + 1;
+ } else if (!state) {
+ cnt = get_len(&c, x, 15);
+ copy(&c, cnt + 3);
+ x = GETB(c);
+ if (x > 15)
+ continue;
+ cnt = 1;
+ back = (1 << 11) + (GETB(c) << 2) + (x >> 2) + 1;
} else {
- cnt = 0;
- back = (GETB(c) << 2) + (x >> 2) + 1;
+ cnt = 0;
+ back = (GETB(c) << 2) + (x >> 2) + 1;
}
copy_backptr(&c, back, cnt + 2);
- state=
- cnt = x & 3;
+ state =
+ cnt = x & 3;
copy(&c, cnt);
x = GETB(c);
}
@@ -240,47 +195,3 @@ int av_lzo1x_decode(void *out, int *outlen, const void *in, int *inlen) {
*outlen = c.out_end - c.out;
return c.error;
}
-
-#ifdef TEST
-#include <stdio.h>
-#include <lzo/lzo1x.h>
-#include "log.h"
-#define MAXSZ (10*1024*1024)
-
-/* Define one of these to 1 if you wish to benchmark liblzo
- * instead of our native implementation. */
-#define BENCHMARK_LIBLZO_SAFE 0
-#define BENCHMARK_LIBLZO_UNSAFE 0
-
-int main(int argc, char *argv[]) {
- FILE *in = fopen(argv[1], "rb");
- uint8_t *orig = av_malloc(MAXSZ + 16);
- uint8_t *comp = av_malloc(2*MAXSZ + 16);
- uint8_t *decomp = av_malloc(MAXSZ + 16);
- size_t s = fread(orig, 1, MAXSZ, in);
- lzo_uint clen = 0;
- long tmp[LZO1X_MEM_COMPRESS];
- int inlen, outlen;
- int i;
- av_log_set_level(AV_LOG_DEBUG);
- lzo1x_999_compress(orig, s, comp, &clen, tmp);
- for (i = 0; i < 300; i++) {
-START_TIMER
- inlen = clen; outlen = MAXSZ;
-#if BENCHMARK_LIBLZO_SAFE
- if (lzo1x_decompress_safe(comp, inlen, decomp, &outlen, NULL))
-#elif BENCHMARK_LIBLZO_UNSAFE
- if (lzo1x_decompress(comp, inlen, decomp, &outlen, NULL))
-#else
- if (av_lzo1x_decode(decomp, &outlen, comp, &inlen))
-#endif
- av_log(NULL, AV_LOG_ERROR, "decompression error\n");
-STOP_TIMER("lzod")
- }
- if (memcmp(orig, decomp, s))
- av_log(NULL, AV_LOG_ERROR, "decompression incorrect\n");
- else
- av_log(NULL, AV_LOG_ERROR, "decompression OK\n");
- return 0;
-}
-#endif
diff --git a/gst-libs/ext/libav/libavutil/lzo.h b/gst-libs/ext/libav/libavutil/lzo.h
index 1b774a5..9d7e8f1 100644
--- a/gst-libs/ext/libav/libavutil/lzo.h
+++ b/gst-libs/ext/libav/libavutil/lzo.h
@@ -32,18 +32,18 @@
#include <stdint.h>
/** @name Error flags returned by av_lzo1x_decode
- * @{ */
+ * @{ */
/// end of the input buffer reached before decoding finished
-#define AV_LZO_INPUT_DEPLETED 1
+#define AV_LZO_INPUT_DEPLETED 1
/// decoded data did not fit into output buffer
-#define AV_LZO_OUTPUT_FULL 2
+#define AV_LZO_OUTPUT_FULL 2
/// a reference to previously decoded data was wrong
#define AV_LZO_INVALID_BACKPTR 4
/// a non-specific error in the compressed bitstream
-#define AV_LZO_ERROR 8
+#define AV_LZO_ERROR 8
/** @} */
-#define AV_LZO_INPUT_PADDING 8
+#define AV_LZO_INPUT_PADDING 8
#define AV_LZO_OUTPUT_PADDING 12
/**
@@ -60,17 +60,6 @@
int av_lzo1x_decode(void *out, int *outlen, const void *in, int *inlen);
/**
- * @brief deliberately overlapping memcpy implementation
- * @param dst destination buffer; must be padded with 12 additional bytes
- * @param back how many bytes back we start (the initial size of the overlapping window)
- * @param cnt number of bytes to copy, must be >= 0
- *
- * cnt > back is valid, this will copy the bytes we just copied,
- * thus creating a repeating pattern with a period length of back.
- */
-void av_memcpy_backptr(uint8_t *dst, int back, int cnt);
-
-/**
* @}
*/
diff --git a/gst-libs/ext/libav/libavutil/mathematics.c b/gst-libs/ext/libav/libavutil/mathematics.c
index e6ce2f9..137683e 100644
--- a/gst-libs/ext/libav/libavutil/mathematics.c
+++ b/gst-libs/ext/libav/libavutil/mathematics.c
@@ -26,30 +26,11 @@
#include <assert.h>
#include <stdint.h>
#include <limits.h>
-#include "mathematics.h"
-
-const uint8_t ff_sqrt_tab[256]={
- 0, 16, 23, 28, 32, 36, 40, 43, 46, 48, 51, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 77, 79, 80, 82, 84, 85, 87, 88, 90,
- 91, 92, 94, 95, 96, 98, 99,100,102,103,104,105,107,108,109,110,111,112,114,115,116,117,118,119,120,121,122,123,124,125,126,127,
-128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,144,145,146,147,148,149,150,151,151,152,153,154,155,156,156,
-157,158,159,160,160,161,162,163,164,164,165,166,167,168,168,169,170,171,171,172,173,174,174,175,176,176,177,178,179,179,180,181,
-182,182,183,184,184,185,186,186,187,188,188,189,190,190,191,192,192,193,194,194,195,196,196,197,198,198,199,200,200,201,202,202,
-203,204,204,205,205,206,207,207,208,208,209,210,210,211,212,212,213,213,214,215,215,216,216,217,218,218,219,219,220,220,221,222,
-222,223,223,224,224,225,226,226,227,227,228,228,229,230,230,231,231,232,232,233,233,234,235,235,236,236,237,237,238,238,239,239,
-240,240,241,242,242,243,243,244,244,245,245,246,246,247,247,248,248,249,249,250,250,251,251,252,252,253,253,254,254,255,255,255
-};
-const uint8_t ff_log2_tab[256]={
- 0,0,1,1,2,2,2,2,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,
- 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
- 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
- 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7
-};
+#include "mathematics.h"
+#include "version.h"
+#if FF_API_AV_REVERSE
const uint8_t av_reverse[256]={
0x00,0x80,0x40,0xC0,0x20,0xA0,0x60,0xE0,0x10,0x90,0x50,0xD0,0x30,0xB0,0x70,0xF0,
0x08,0x88,0x48,0xC8,0x28,0xA8,0x68,0xE8,0x18,0x98,0x58,0xD8,0x38,0xB8,0x78,0xF8,
@@ -68,6 +49,7 @@ const uint8_t av_reverse[256]={
0x07,0x87,0x47,0xC7,0x27,0xA7,0x67,0xE7,0x17,0x97,0x57,0xD7,0x37,0xB7,0x77,0xF7,
0x0F,0x8F,0x4F,0xCF,0x2F,0xAF,0x6F,0xEF,0x1F,0x9F,0x5F,0xDF,0x3F,0xBF,0x7F,0xFF,
};
+#endif
int64_t av_gcd(int64_t a, int64_t b){
if(b) return av_gcd(b, a%b);
@@ -130,10 +112,17 @@ int64_t av_rescale(int64_t a, int64_t b, int64_t c){
return av_rescale_rnd(a, b, c, AV_ROUND_NEAR_INF);
}
-int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq){
+int64_t av_rescale_q_rnd(int64_t a, AVRational bq, AVRational cq,
+ enum AVRounding rnd)
+{
int64_t b= bq.num * (int64_t)cq.den;
int64_t c= cq.num * (int64_t)bq.den;
- return av_rescale_rnd(a, b, c, AV_ROUND_NEAR_INF);
+ return av_rescale_rnd(a, b, c, rnd);
+}
+
+int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
+{
+ return av_rescale_q_rnd(a, bq, cq, AV_ROUND_NEAR_INF);
}
int av_compare_ts(int64_t ts_a, AVRational tb_a, int64_t ts_b, AVRational tb_b){
diff --git a/gst-libs/ext/libav/libavutil/mathematics.h b/gst-libs/ext/libav/libavutil/mathematics.h
index 0b072eb..043dd0f 100644
--- a/gst-libs/ext/libav/libavutil/mathematics.h
+++ b/gst-libs/ext/libav/libavutil/mathematics.h
@@ -25,36 +25,19 @@
#include <math.h>
#include "attributes.h"
#include "rational.h"
+#include "intfloat.h"
-#ifndef M_E
-#define M_E 2.7182818284590452354 /* e */
-#endif
-#ifndef M_LN2
-#define M_LN2 0.69314718055994530942 /* log_e 2 */
-#endif
-#ifndef M_LN10
-#define M_LN10 2.30258509299404568402 /* log_e 10 */
-#endif
#ifndef M_LOG2_10
#define M_LOG2_10 3.32192809488736234787 /* log_2 10 */
#endif
#ifndef M_PHI
#define M_PHI 1.61803398874989484820 /* phi / golden ratio */
#endif
-#ifndef M_PI
-#define M_PI 3.14159265358979323846 /* pi */
-#endif
-#ifndef M_SQRT1_2
-#define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */
-#endif
-#ifndef M_SQRT2
-#define M_SQRT2 1.41421356237309504880 /* sqrt(2) */
-#endif
#ifndef NAN
-#define NAN (0.0/0.0)
+#define NAN av_int2float(0x7fc00000)
#endif
#ifndef INFINITY
-#define INFINITY (1.0/0.0)
+#define INFINITY av_int2float(0x7f800000)
#endif
/**
@@ -96,6 +79,12 @@ int64_t av_rescale_rnd(int64_t a, int64_t b, int64_t c, enum AVRounding) av_cons
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq) av_const;
/**
+ * Rescale a 64-bit integer by 2 rational numbers with specified rounding.
+ */
+int64_t av_rescale_q_rnd(int64_t a, AVRational bq, AVRational cq,
+ enum AVRounding) av_const;
+
+/**
* Compare 2 timestamps each in its own timebases.
* The result of the function is undefined if one of the timestamps
* is outside the int64_t range when represented in the others timebase.
diff --git a/gst-libs/ext/libav/libavutil/md5.c b/gst-libs/ext/libav/libavutil/md5.c
index ca0e598..efb993e 100644
--- a/gst-libs/ext/libav/libavutil/md5.c
+++ b/gst-libs/ext/libav/libavutil/md5.c
@@ -34,6 +34,7 @@
#include "bswap.h"
#include "intreadwrite.h"
#include "md5.h"
+#include "mem.h"
typedef struct AVMD5{
uint64_t len;
@@ -41,7 +42,14 @@ typedef struct AVMD5{
uint32_t ABCD[4];
} AVMD5;
+#if FF_API_CONTEXT_SIZE
const int av_md5_size = sizeof(AVMD5);
+#endif
+
+struct AVMD5 *av_md5_alloc(void)
+{
+ return av_mallocz(sizeof(struct AVMD5));
+}
static const uint8_t S[4][4] = {
{ 7, 12, 17, 22 }, /* round 1 */
@@ -174,7 +182,6 @@ void av_md5_sum(uint8_t *dst, const uint8_t *src, const int len)
}
#ifdef TEST
-#undef printf
#include <stdio.h>
static void print_md5(uint8_t *md5)
diff --git a/gst-libs/ext/libav/libavutil/md5.h b/gst-libs/ext/libav/libavutil/md5.h
index 1412ee2..29e4e7c 100644
--- a/gst-libs/ext/libav/libavutil/md5.h
+++ b/gst-libs/ext/libav/libavutil/md5.h
@@ -23,16 +23,22 @@
#include <stdint.h>
+#include "attributes.h"
+#include "version.h"
+
/**
* @defgroup lavu_md5 MD5
* @ingroup lavu_crypto
* @{
*/
-extern const int av_md5_size;
+#if FF_API_CONTEXT_SIZE
+extern attribute_deprecated const int av_md5_size;
+#endif
struct AVMD5;
+struct AVMD5 *av_md5_alloc(void);
void av_md5_init(struct AVMD5 *ctx);
void av_md5_update(struct AVMD5 *ctx, const uint8_t *src, const int len);
void av_md5_final(struct AVMD5 *ctx, uint8_t *dst);
@@ -43,4 +49,3 @@ void av_md5_sum(uint8_t *dst, const uint8_t *src, const int len);
*/
#endif /* AVUTIL_MD5_H */
-
diff --git a/gst-libs/ext/libav/libavutil/mem.c b/gst-libs/ext/libav/libavutil/mem.c
index 27bb30b..391eb7d 100644
--- a/gst-libs/ext/libav/libavutil/mem.c
+++ b/gst-libs/ext/libav/libavutil/mem.c
@@ -27,6 +27,7 @@
#include "config.h"
#include <limits.h>
+#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#if HAVE_MALLOC_H
@@ -34,13 +35,9 @@
#endif
#include "avutil.h"
+#include "intreadwrite.h"
#include "mem.h"
-/* here we can use OS-dependent allocation functions */
-#undef free
-#undef malloc
-#undef realloc
-
#ifdef MALLOC_PREFIX
#define malloc AV_JOIN(MALLOC_PREFIX, malloc)
@@ -58,8 +55,8 @@ void free(void *ptr);
#endif /* MALLOC_PREFIX */
/* You can redefine av_malloc and av_free in your project to use your
- memory allocator. You do not need to suppress this file because the
- linker will do it automatically. */
+ * memory allocator. You do not need to suppress this file because the
+ * linker will do it automatically. */
void *av_malloc(size_t size)
{
@@ -69,44 +66,46 @@ void *av_malloc(size_t size)
#endif
/* let's disallow possible ambiguous cases */
- if(size > (INT_MAX-32) )
+ if (size > (INT_MAX - 32) || !size)
return NULL;
#if CONFIG_MEMALIGN_HACK
- ptr = malloc(size+32);
- if(!ptr)
+ ptr = malloc(size + 32);
+ if (!ptr)
return ptr;
- diff= ((-(long)ptr - 1)&31) + 1;
- ptr = (char*)ptr + diff;
- ((char*)ptr)[-1]= diff;
+ diff = ((-(long)ptr - 1) & 31) + 1;
+ ptr = (char *)ptr + diff;
+ ((char *)ptr)[-1] = diff;
#elif HAVE_POSIX_MEMALIGN
- if (posix_memalign(&ptr,32,size))
+ if (posix_memalign(&ptr, 32, size))
ptr = NULL;
+#elif HAVE_ALIGNED_MALLOC
+ ptr = _aligned_malloc(size, 32);
#elif HAVE_MEMALIGN
- ptr = memalign(32,size);
+ ptr = memalign(32, size);
/* Why 64?
- Indeed, we should align it:
- on 4 for 386
- on 16 for 486
- on 32 for 586, PPro - K6-III
- on 64 for K7 (maybe for P3 too).
- Because L1 and L2 caches are aligned on those values.
- But I don't want to code such logic here!
+ * Indeed, we should align it:
+ * on 4 for 386
+ * on 16 for 486
+ * on 32 for 586, PPro - K6-III
+ * on 64 for K7 (maybe for P3 too).
+ * Because L1 and L2 caches are aligned on those values.
+ * But I don't want to code such logic here!
*/
- /* Why 32?
- For AVX ASM. SSE / NEON needs only 16.
- Why not larger? Because I did not see a difference in benchmarks ...
+ /* Why 32?
+ * For AVX ASM. SSE / NEON needs only 16.
+ * Why not larger? Because I did not see a difference in benchmarks ...
*/
- /* benchmarks with P3
- memalign(64)+1 3071,3051,3032
- memalign(64)+2 3051,3032,3041
- memalign(64)+4 2911,2896,2915
- memalign(64)+8 2545,2554,2550
- memalign(64)+16 2543,2572,2563
- memalign(64)+32 2546,2545,2571
- memalign(64)+64 2570,2533,2558
-
- BTW, malloc seems to do 8-byte alignment by default here.
+ /* benchmarks with P3
+ * memalign(64) + 1 3071, 3051, 3032
+ * memalign(64) + 2 3051, 3032, 3041
+ * memalign(64) + 4 2911, 2896, 2915
+ * memalign(64) + 8 2545, 2554, 2550
+ * memalign(64) + 16 2543, 2572, 2563
+ * memalign(64) + 32 2546, 2545, 2571
+ * memalign(64) + 64 2570, 2533, 2558
+ *
+ * BTW, malloc seems to do 8-byte alignment by default here.
*/
#else
ptr = malloc(size);
@@ -121,14 +120,17 @@ void *av_realloc(void *ptr, size_t size)
#endif
/* let's disallow possible ambiguous cases */
- if(size > (INT_MAX-16) )
+ if (size > (INT_MAX - 16))
return NULL;
#if CONFIG_MEMALIGN_HACK
//FIXME this isn't aligned correctly, though it probably isn't needed
- if(!ptr) return av_malloc(size);
- diff= ((char*)ptr)[-1];
- return (char*)realloc((char*)ptr - diff, size + diff) + diff;
+ if (!ptr)
+ return av_malloc(size);
+ diff = ((char *)ptr)[-1];
+ return (char *)realloc((char *)ptr - diff, size + diff) + diff;
+#elif HAVE_ALIGNED_MALLOC
+ return _aligned_realloc(ptr, size, 32);
#else
return realloc(ptr, size);
#endif
@@ -138,7 +140,9 @@ void av_free(void *ptr)
{
#if CONFIG_MEMALIGN_HACK
if (ptr)
- free((char*)ptr - ((char*)ptr)[-1]);
+ free((char *)ptr - ((char *)ptr)[-1]);
+#elif HAVE_ALIGNED_MALLOC
+ _aligned_free(ptr);
#else
free(ptr);
#endif
@@ -146,7 +150,7 @@ void av_free(void *ptr)
void av_freep(void *arg)
{
- void **ptr= (void**)arg;
+ void **ptr = (void **)arg;
av_free(*ptr);
*ptr = NULL;
}
@@ -161,8 +165,8 @@ void *av_mallocz(size_t size)
char *av_strdup(const char *s)
{
- char *ptr= NULL;
- if(s){
+ char *ptr = NULL;
+ if (s) {
int len = strlen(s) + 1;
ptr = av_malloc(len);
if (ptr)
@@ -171,3 +175,126 @@ char *av_strdup(const char *s)
return ptr;
}
+static void fill16(uint8_t *dst, int len)
+{
+ uint32_t v = AV_RN16(dst - 2);
+
+ v |= v << 16;
+
+ while (len >= 4) {
+ AV_WN32(dst, v);
+ dst += 4;
+ len -= 4;
+ }
+
+ while (len--) {
+ *dst = dst[-2];
+ dst++;
+ }
+}
+
+static void fill24(uint8_t *dst, int len)
+{
+#if HAVE_BIGENDIAN
+ uint32_t v = AV_RB24(dst - 3);
+ uint32_t a = v << 8 | v >> 16;
+ uint32_t b = v << 16 | v >> 8;
+ uint32_t c = v << 24 | v;
+#else
+ uint32_t v = AV_RL24(dst - 3);
+ uint32_t a = v | v << 24;
+ uint32_t b = v >> 8 | v << 16;
+ uint32_t c = v >> 16 | v << 8;
+#endif
+
+ while (len >= 12) {
+ AV_WN32(dst, a);
+ AV_WN32(dst + 4, b);
+ AV_WN32(dst + 8, c);
+ dst += 12;
+ len -= 12;
+ }
+
+ if (len >= 4) {
+ AV_WN32(dst, a);
+ dst += 4;
+ len -= 4;
+ }
+
+ if (len >= 4) {
+ AV_WN32(dst, b);
+ dst += 4;
+ len -= 4;
+ }
+
+ while (len--) {
+ *dst = dst[-3];
+ dst++;
+ }
+}
+
+static void fill32(uint8_t *dst, int len)
+{
+ uint32_t v = AV_RN32(dst - 4);
+
+ while (len >= 4) {
+ AV_WN32(dst, v);
+ dst += 4;
+ len -= 4;
+ }
+
+ while (len--) {
+ *dst = dst[-4];
+ dst++;
+ }
+}
+
+void av_memcpy_backptr(uint8_t *dst, int back, int cnt)
+{
+ const uint8_t *src = &dst[-back];
+ if (!back)
+ return;
+
+ if (back == 1) {
+ memset(dst, *src, cnt);
+ } else if (back == 2) {
+ fill16(dst, cnt);
+ } else if (back == 3) {
+ fill24(dst, cnt);
+ } else if (back == 4) {
+ fill32(dst, cnt);
+ } else {
+ if (cnt >= 16) {
+ int blocklen = back;
+ while (cnt > blocklen) {
+ memcpy(dst, src, blocklen);
+ dst += blocklen;
+ cnt -= blocklen;
+ blocklen <<= 1;
+ }
+ memcpy(dst, src, cnt);
+ return;
+ }
+ if (cnt >= 8) {
+ AV_COPY32U(dst, src);
+ AV_COPY32U(dst + 4, src + 4);
+ src += 8;
+ dst += 8;
+ cnt -= 8;
+ }
+ if (cnt >= 4) {
+ AV_COPY32U(dst, src);
+ src += 4;
+ dst += 4;
+ cnt -= 4;
+ }
+ if (cnt >= 2) {
+ AV_COPY16U(dst, src);
+ src += 2;
+ dst += 2;
+ cnt -= 2;
+ }
+ if (cnt)
+ *dst = *src;
+ }
+}
diff --git a/gst-libs/ext/libav/libavutil/mem.h b/gst-libs/ext/libav/libavutil/mem.h
index cd8490b..8f47224 100644
--- a/gst-libs/ext/libav/libavutil/mem.h
+++ b/gst-libs/ext/libav/libavutil/mem.h
@@ -26,6 +26,9 @@
#ifndef AVUTIL_MEM_H
#define AVUTIL_MEM_H
+#include <limits.h>
+#include <stdint.h>
+
#include "attributes.h"
#include "avutil.h"
@@ -35,7 +38,7 @@
*/
-#if defined(__ICC) && _ICC < 1200 || defined(__SUNPRO_C)
+#if defined(__ICC) && __ICC < 1200 || defined(__SUNPRO_C)
#define DECLARE_ALIGNED(n,t,v) t __attribute__ ((aligned (n))) v
#define DECLARE_ASM_CONST(n,t,v) const t __attribute__ ((aligned (n))) v
#elif defined(__TI_COMPILER_VERSION__)
@@ -63,9 +66,9 @@
#endif
#if AV_GCC_VERSION_AT_LEAST(4,3)
- #define av_alloc_size(n) __attribute__((alloc_size(n)))
+ #define av_alloc_size(...) __attribute__((alloc_size(__VA_ARGS__)))
#else
- #define av_alloc_size(n)
+ #define av_alloc_size(...)
#endif
/**
@@ -79,6 +82,22 @@
void *av_malloc(size_t size) av_malloc_attrib av_alloc_size(1);
/**
+ * Helper function to allocate a block of size * nmemb bytes with
+ * using av_malloc()
+ * @param nmemb Number of elements
+ * @param size Size of the single element
+ * @return Pointer to the allocated block, NULL if the block cannot
+ * be allocated.
+ * @see av_malloc()
+ */
+av_alloc_size(1, 2) static inline void *av_malloc_array(size_t nmemb, size_t size)
+{
+ if (size <= 0 || nmemb >= INT_MAX / size)
+ return NULL;
+ return av_malloc(nmemb * size);
+}
+
+/**
* Allocate or reallocate a block of memory.
* If ptr is NULL and size > 0, allocate a new block. If
* size is zero, free the memory block pointed to by ptr.
@@ -113,6 +132,23 @@ void av_free(void *ptr);
void *av_mallocz(size_t size) av_malloc_attrib av_alloc_size(1);
/**
+ * Helper function to allocate a block of size * nmemb bytes with
+ * using av_mallocz()
+ * @param nmemb Number of elements
+ * @param size Size of the single element
+ * @return Pointer to the allocated block, NULL if the block cannot
+ * be allocated.
+ * @see av_mallocz()
+ * @see av_malloc_array()
+ */
+av_alloc_size(1, 2) static inline void *av_mallocz_array(size_t nmemb, size_t size)
+{
+ if (size <= 0 || nmemb >= INT_MAX / size)
+ return NULL;
+ return av_mallocz(nmemb * size);
+}
+
+/**
* Duplicate the string s.
* @param s string to be duplicated
* @return Pointer to a newly allocated string containing a
@@ -130,6 +166,17 @@ char *av_strdup(const char *s) av_malloc_attrib;
void av_freep(void *ptr);
/**
+ * @brief deliberately overlapping memcpy implementation
+ * @param dst destination buffer
+ * @param back how many bytes back we start (the initial size of the overlapping window)
+ * @param cnt number of bytes to copy, must be >= 0
+ *
+ * cnt > back is valid, this will copy the bytes we just copied,
+ * thus creating a repeating pattern with a period length of back.
+ */
+void av_memcpy_backptr(uint8_t *dst, int back, int cnt);
+
+/**
* @}
*/
diff --git a/gst-libs/ext/libav/libavutil/mips/intreadwrite.h b/gst-libs/ext/libav/libavutil/mips/intreadwrite.h
index 0e0cc06..4dabbe6 100644
--- a/gst-libs/ext/libav/libavutil/mips/intreadwrite.h
+++ b/gst-libs/ext/libav/libavutil/mips/intreadwrite.h
@@ -24,75 +24,23 @@
#include <stdint.h>
#include "config.h"
-#if HAVE_INLINE_ASM
+#if ARCH_MIPS64 && HAVE_INLINE_ASM
#define AV_RN32 AV_RN32
static av_always_inline uint32_t AV_RN32(const void *p)
{
+ struct __attribute__((packed)) u32 { uint32_t v; };
+ const uint8_t *q = p;
+ const struct u32 *pl = (const struct u32 *)(q + 3 * !HAVE_BIGENDIAN);
+ const struct u32 *pr = (const struct u32 *)(q + 3 * HAVE_BIGENDIAN);
uint32_t v;
__asm__ ("lwl %0, %1 \n\t"
"lwr %0, %2 \n\t"
: "=&r"(v)
- : "m"(*(const uint32_t *)((const uint8_t *)p+3*!HAVE_BIGENDIAN)),
- "m"(*(const uint32_t *)((const uint8_t *)p+3*HAVE_BIGENDIAN)));
+ : "m"(*pl), "m"(*pr));
return v;
}
-#define AV_WN32 AV_WN32
-static av_always_inline void AV_WN32(void *p, uint32_t v)
-{
- __asm__ ("swl %2, %0 \n\t"
- "swr %2, %1 \n\t"
- : "=m"(*(uint32_t *)((uint8_t *)p+3*!HAVE_BIGENDIAN)),
- "=m"(*(uint32_t *)((uint8_t *)p+3*HAVE_BIGENDIAN))
- : "r"(v));
-}
-
-#if ARCH_MIPS64
-
-#define AV_RN64 AV_RN64
-static av_always_inline uint64_t AV_RN64(const void *p)
-{
- uint64_t v;
- __asm__ ("ldl %0, %1 \n\t"
- "ldr %0, %2 \n\t"
- : "=&r"(v)
- : "m"(*(const uint64_t *)((const uint8_t *)p+7*!HAVE_BIGENDIAN)),
- "m"(*(const uint64_t *)((const uint8_t *)p+7*HAVE_BIGENDIAN)));
- return v;
-}
-
-#define AV_WN64 AV_WN64
-static av_always_inline void AV_WN64(void *p, uint64_t v)
-{
- __asm__ ("sdl %2, %0 \n\t"
- "sdr %2, %1 \n\t"
- : "=m"(*(uint64_t *)((uint8_t *)p+7*!HAVE_BIGENDIAN)),
- "=m"(*(uint64_t *)((uint8_t *)p+7*HAVE_BIGENDIAN))
- : "r"(v));
-}
-
-#else
-
-#define AV_RN64 AV_RN64
-static av_always_inline uint64_t AV_RN64(const void *p)
-{
- union { uint64_t v; uint32_t hl[2]; } v;
- v.hl[0] = AV_RN32(p);
- v.hl[1] = AV_RN32((const uint8_t *)p + 4);
- return v.v;
-}
-
-#define AV_WN64 AV_WN64
-static av_always_inline void AV_WN64(void *p, uint64_t v)
-{
- union { uint64_t v; uint32_t hl[2]; } vv = { v };
- AV_WN32(p, vv.hl[0]);
- AV_WN32((uint8_t *)p + 4, vv.hl[1]);
-}
-
-#endif /* ARCH_MIPS64 */
-
-#endif /* HAVE_INLINE_ASM */
+#endif /* ARCH_MIPS64 && HAVE_INLINE_ASM */
#endif /* AVUTIL_MIPS_INTREADWRITE_H */
diff --git a/gst-libs/ext/libav/libavutil/old_pix_fmts.h b/gst-libs/ext/libav/libavutil/old_pix_fmts.h
new file mode 100644
index 0000000..31765ae
--- /dev/null
+++ b/gst-libs/ext/libav/libavutil/old_pix_fmts.h
@@ -0,0 +1,128 @@
+/*
+ * 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
+ */
+
+#ifndef AVUTIL_OLD_PIX_FMTS_H
+#define AVUTIL_OLD_PIX_FMTS_H
+
+/*
+ * This header exists to prevent new pixel formats from being accidentally added
+ * to the deprecated list.
+ * Do not include it directly. It will be removed on next major bump
+ *
+ * Do not add new items to this list. Use the AVPixelFormat enum instead.
+ */
+ PIX_FMT_NONE = AV_PIX_FMT_NONE,
+ PIX_FMT_YUV420P, ///< planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
+ PIX_FMT_YUYV422, ///< packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr
+ PIX_FMT_RGB24, ///< packed RGB 8:8:8, 24bpp, RGBRGB...
+ PIX_FMT_BGR24, ///< packed RGB 8:8:8, 24bpp, BGRBGR...
+ PIX_FMT_YUV422P, ///< planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
+ PIX_FMT_YUV444P, ///< planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
+ PIX_FMT_YUV410P, ///< planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
+ PIX_FMT_YUV411P, ///< planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
+ PIX_FMT_GRAY8, ///< Y , 8bpp
+ PIX_FMT_MONOWHITE, ///< Y , 1bpp, 0 is white, 1 is black, in each byte pixels are ordered from the msb to the lsb
+ PIX_FMT_MONOBLACK, ///< Y , 1bpp, 0 is black, 1 is white, in each byte pixels are ordered from the msb to the lsb
+ PIX_FMT_PAL8, ///< 8 bit with PIX_FMT_RGB32 palette
+ PIX_FMT_YUVJ420P, ///< planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV420P and setting color_range
+ PIX_FMT_YUVJ422P, ///< planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV422P and setting color_range
+ PIX_FMT_YUVJ444P, ///< planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV444P and setting color_range
+ PIX_FMT_XVMC_MPEG2_MC,///< XVideo Motion Acceleration via common packet passing
+ PIX_FMT_XVMC_MPEG2_IDCT,
+ PIX_FMT_UYVY422, ///< packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1
+ PIX_FMT_UYYVYY411, ///< packed YUV 4:1:1, 12bpp, Cb Y0 Y1 Cr Y2 Y3
+ PIX_FMT_BGR8, ///< packed RGB 3:3:2, 8bpp, (msb)2B 3G 3R(lsb)
+ PIX_FMT_BGR4, ///< packed RGB 1:2:1 bitstream, 4bpp, (msb)1B 2G 1R(lsb), a byte contains two pixels, the first pixel in the byte is the one composed by the 4 msb bits
+ PIX_FMT_BGR4_BYTE, ///< packed RGB 1:2:1, 8bpp, (msb)1B 2G 1R(lsb)
+ PIX_FMT_RGB8, ///< packed RGB 3:3:2, 8bpp, (msb)2R 3G 3B(lsb)
+ PIX_FMT_RGB4, ///< packed RGB 1:2:1 bitstream, 4bpp, (msb)1R 2G 1B(lsb), a byte contains two pixels, the first pixel in the byte is the one composed by the 4 msb bits
+ PIX_FMT_RGB4_BYTE, ///< packed RGB 1:2:1, 8bpp, (msb)1R 2G 1B(lsb)
+ PIX_FMT_NV12, ///< planar YUV 4:2:0, 12bpp, 1 plane for Y and 1 plane for the UV components, which are interleaved (first byte U and the following byte V)
+ PIX_FMT_NV21, ///< as above, but U and V bytes are swapped
+
+ PIX_FMT_ARGB, ///< packed ARGB 8:8:8:8, 32bpp, ARGBARGB...
+ PIX_FMT_RGBA, ///< packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
+ PIX_FMT_ABGR, ///< packed ABGR 8:8:8:8, 32bpp, ABGRABGR...
+ PIX_FMT_BGRA, ///< packed BGRA 8:8:8:8, 32bpp, BGRABGRA...
+
+ PIX_FMT_GRAY16BE, ///< Y , 16bpp, big-endian
+ PIX_FMT_GRAY16LE, ///< Y , 16bpp, little-endian
+ PIX_FMT_YUV440P, ///< planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
+ PIX_FMT_YUVJ440P, ///< planar YUV 4:4:0 full scale (JPEG), deprecated in favor of PIX_FMT_YUV440P and setting color_range
+ PIX_FMT_YUVA420P, ///< planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples)
+ PIX_FMT_VDPAU_H264,///< H.264 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers
+ PIX_FMT_VDPAU_MPEG1,///< MPEG-1 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers
+ PIX_FMT_VDPAU_MPEG2,///< MPEG-2 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers
+ PIX_FMT_VDPAU_WMV3,///< WMV3 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers
+ PIX_FMT_VDPAU_VC1, ///< VC-1 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers
+ PIX_FMT_RGB48BE, ///< packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, the 2-byte value for each R/G/B component is stored as big-endian
+ PIX_FMT_RGB48LE, ///< packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, the 2-byte value for each R/G/B component is stored as little-endian
+
+ PIX_FMT_RGB565BE, ///< packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), big-endian
+ PIX_FMT_RGB565LE, ///< packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), little-endian
+ PIX_FMT_RGB555BE, ///< packed RGB 5:5:5, 16bpp, (msb)1A 5R 5G 5B(lsb), big-endian, most significant bit to 0
+ PIX_FMT_RGB555LE, ///< packed RGB 5:5:5, 16bpp, (msb)1A 5R 5G 5B(lsb), little-endian, most significant bit to 0
+
+ PIX_FMT_BGR565BE, ///< packed BGR 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), big-endian
+ PIX_FMT_BGR565LE, ///< packed BGR 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), little-endian
+ PIX_FMT_BGR555BE, ///< packed BGR 5:5:5, 16bpp, (msb)1A 5B 5G 5R(lsb), big-endian, most significant bit to 1
+ PIX_FMT_BGR555LE, ///< packed BGR 5:5:5, 16bpp, (msb)1A 5B 5G 5R(lsb), little-endian, most significant bit to 1
+
+ PIX_FMT_VAAPI_MOCO, ///< HW acceleration through VA API at motion compensation entry-point, Picture.data[3] contains a vaapi_render_state struct which contains macroblocks as well as various fields extracted from headers
+ PIX_FMT_VAAPI_IDCT, ///< HW acceleration through VA API at IDCT entry-point, Picture.data[3] contains a vaapi_render_state struct which contains fields extracted from headers
+ PIX_FMT_VAAPI_VLD, ///< HW decoding through VA API, Picture.data[3] contains a vaapi_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers
+
+ PIX_FMT_YUV420P16LE, ///< planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
+ PIX_FMT_YUV420P16BE, ///< planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
+ PIX_FMT_YUV422P16LE, ///< planar YUV 4:2:2, 32bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
+ PIX_FMT_YUV422P16BE, ///< planar YUV 4:2:2, 32bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
+ PIX_FMT_YUV444P16LE, ///< planar YUV 4:4:4, 48bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
+ PIX_FMT_YUV444P16BE, ///< planar YUV 4:4:4, 48bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
+ PIX_FMT_VDPAU_MPEG4, ///< MPEG4 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers
+ PIX_FMT_DXVA2_VLD, ///< HW decoding through DXVA2, Picture.data[3] contains a LPDIRECT3DSURFACE9 pointer
+
+ PIX_FMT_RGB444LE, ///< packed RGB 4:4:4, 16bpp, (msb)4A 4R 4G 4B(lsb), little-endian, most significant bits to 0
+ PIX_FMT_RGB444BE, ///< packed RGB 4:4:4, 16bpp, (msb)4A 4R 4G 4B(lsb), big-endian, most significant bits to 0
+ PIX_FMT_BGR444LE, ///< packed BGR 4:4:4, 16bpp, (msb)4A 4B 4G 4R(lsb), little-endian, most significant bits to 1
+ PIX_FMT_BGR444BE, ///< packed BGR 4:4:4, 16bpp, (msb)4A 4B 4G 4R(lsb), big-endian, most significant bits to 1
+ PIX_FMT_Y400A, ///< 8bit gray, 8bit alpha
+ PIX_FMT_BGR48BE, ///< packed RGB 16:16:16, 48bpp, 16B, 16G, 16R, the 2-byte value for each R/G/B component is stored as big-endian
+ PIX_FMT_BGR48LE, ///< packed RGB 16:16:16, 48bpp, 16B, 16G, 16R, the 2-byte value for each R/G/B component is stored as little-endian
+ PIX_FMT_YUV420P9BE, ///< planar YUV 4:2:0, 13.5bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
+ PIX_FMT_YUV420P9LE, ///< planar YUV 4:2:0, 13.5bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
+ PIX_FMT_YUV420P10BE,///< planar YUV 4:2:0, 15bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
+ PIX_FMT_YUV420P10LE,///< planar YUV 4:2:0, 15bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
+ PIX_FMT_YUV422P10BE,///< planar YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
+ PIX_FMT_YUV422P10LE,///< planar YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
+ PIX_FMT_YUV444P9BE, ///< planar YUV 4:4:4, 27bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
+ PIX_FMT_YUV444P9LE, ///< planar YUV 4:4:4, 27bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
+ PIX_FMT_YUV444P10BE,///< planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
+ PIX_FMT_YUV444P10LE,///< planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
+ PIX_FMT_YUV422P9BE, ///< planar YUV 4:2:2, 18bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
+ PIX_FMT_YUV422P9LE, ///< planar YUV 4:2:2, 18bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
+ PIX_FMT_VDA_VLD, ///< hardware decoding through VDA
+ PIX_FMT_GBRP, ///< planar GBR 4:4:4 24bpp
+ PIX_FMT_GBRP9BE, ///< planar GBR 4:4:4 27bpp, big endian
+ PIX_FMT_GBRP9LE, ///< planar GBR 4:4:4 27bpp, little endian
+ PIX_FMT_GBRP10BE, ///< planar GBR 4:4:4 30bpp, big endian
+ PIX_FMT_GBRP10LE, ///< planar GBR 4:4:4 30bpp, little endian
+ PIX_FMT_GBRP16BE, ///< planar GBR 4:4:4 48bpp, big endian
+ PIX_FMT_GBRP16LE, ///< planar GBR 4:4:4 48bpp, little endian
+ PIX_FMT_NB, ///< number of pixel formats, DO NOT USE THIS if you want to link with shared libav* because the number of formats might differ between versions
+
+#endif /* AVUTIL_OLD_PIX_FMTS_H */
diff --git a/gst-libs/ext/libav/libavutil/opt.c b/gst-libs/ext/libav/libavutil/opt.c
index aea381e..04f4413 100644
--- a/gst-libs/ext/libav/libavutil/opt.c
+++ b/gst-libs/ext/libav/libavutil/opt.c
@@ -27,32 +27,12 @@
#include "avutil.h"
#include "avstring.h"
+#include "common.h"
#include "opt.h"
#include "eval.h"
#include "dict.h"
#include "log.h"
-
-#if FF_API_FIND_OPT
-//FIXME order them and do a bin search
-const AVOption *av_find_opt(void *v, const char *name, const char *unit, int mask, int flags)
-{
- AVClass *c= *(AVClass**)v; //FIXME silly way of storing AVClass
- const AVOption *o= c->option;
-
- for (; o && o->name; o++) {
- if (!strcmp(o->name, name) && (!unit || (o->unit && !strcmp(o->unit, unit))) && (o->flags & mask) == flags)
- return o;
- }
- return NULL;
-}
-#endif
-
-#if FF_API_OLD_AVOPTIONS
-const AVOption *av_next_option(void *obj, const AVOption *last)
-{
- return av_opt_next(obj, last);
-}
-#endif
+#include "mathematics.h"
const AVOption *av_opt_next(void *obj, const AVOption *last)
{
@@ -82,7 +62,8 @@ static int read_number(const AVOption *o, void *dst, double *num, int *den, int6
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) {
- av_log(obj, AV_LOG_ERROR, "Value %lf for parameter '%s' out of range\n", num, o->name);
+ av_log(obj, AV_LOG_ERROR, "Value %f for parameter '%s' out of range\n",
+ num*intnum/den, o->name);
return AVERROR(ERANGE);
}
@@ -159,6 +140,12 @@ static int set_string(void *obj, const AVOption *o, const char *val, uint8_t **d
return 0;
}
+#define DEFAULT_NUMVAL(opt) ((opt->type == AV_OPT_TYPE_INT64 || \
+ opt->type == AV_OPT_TYPE_CONST || \
+ opt->type == AV_OPT_TYPE_FLAGS || \
+ opt->type == AV_OPT_TYPE_INT) ? \
+ opt->default_val.i64 : opt->default_val.dbl)
+
static int set_string_number(void *obj, const AVOption *o, const char *val, void *dst)
{
int ret = 0, notfirst = 0;
@@ -169,18 +156,23 @@ static int set_string_number(void *obj, const AVOption *o, const char *val, void
double d, num = 1;
int64_t intnum = 1;
- if (*val == '+' || *val == '-')
- cmd = *(val++);
+ i = 0;
+ if (*val == '+' || *val == '-') {
+ if (o->type == AV_OPT_TYPE_FLAGS)
+ cmd = *(val++);
+ else if (!notfirst)
+ buf[i++] = *val;
+ }
- for (i = 0; i < sizeof(buf) - 1 && val[i] && val[i] != '+' && val[i] != '-'; i++)
+ for (; i < sizeof(buf) - 1 && val[i] && val[i] != '+' && val[i] != '-'; i++)
buf[i] = val[i];
buf[i] = 0;
{
const AVOption *o_named = av_opt_find(obj, buf, o->unit, 0, 0);
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;
+ d = DEFAULT_NUMVAL(o_named);
+ else if (!strcmp(buf, "default")) d = DEFAULT_NUMVAL(o);
else if (!strcmp(buf, "max" )) d = o->max;
else if (!strcmp(buf, "min" )) d = o->min;
else if (!strcmp(buf, "none" )) d = 0;
@@ -214,16 +206,6 @@ 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);
- if (o_out)
- *o_out = 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;
@@ -277,32 +259,6 @@ static int set_number(void *obj, const char *name, double num, int den, int64_t
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)
-{
- 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)
-{
- 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)
-{
- 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);
@@ -318,45 +274,34 @@ 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
- * @param buf_len allocated length in bytes of buf
- */
-const char *av_get_string(void *obj, const char *name, const AVOption **o_out, char *buf, int buf_len)
-{
- const AVOption *o = av_opt_find(obj, name, NULL, 0, 0);
- void *dst;
- uint8_t *bin;
- int len, i;
- if (!o)
- return NULL;
- if (o->type != AV_OPT_TYPE_STRING && (!buf || !buf_len))
- return NULL;
-
- dst= ((uint8_t*)obj) + o->offset;
- if (o_out) *o_out= o;
+int av_opt_set_bin(void *obj, const char *name, const uint8_t *val, int len, int search_flags)
+{
+ void *target_obj;
+ const AVOption *o = av_opt_find2(obj, name, NULL, 0, search_flags, &target_obj);
+ uint8_t *ptr;
+ uint8_t **dst;
+ int *lendst;
- switch (o->type) {
- 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;
- for (i = 0; i < len; i++) snprintf(buf + i*2, 3, "%02X", bin[i]);
- break;
- default: return NULL;
- }
- return buf;
+ if (!o || !target_obj)
+ return AVERROR_OPTION_NOT_FOUND;
+
+ if (o->type != AV_OPT_TYPE_BINARY)
+ return AVERROR(EINVAL);
+
+ ptr = av_malloc(len);
+ if (!ptr)
+ return AVERROR(ENOMEM);
+
+ dst = (uint8_t **)(((uint8_t *)target_obj) + o->offset);
+ lendst = (int *)(dst + 1);
+
+ av_free(*dst);
+ *dst = ptr;
+ *lendst = len;
+ memcpy(ptr, val, len);
+
+ return 0;
}
-#endif
int av_opt_get(void *obj, const char *name, int search_flags, uint8_t **out_val)
{
@@ -423,44 +368,6 @@ error:
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) < 0)
- return NAN;
- return num*intnum/den;
-}
-
-AVRational av_get_q(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) < 0)
- return (AVRational){0, 0};
- if (num == 1.0 && (int)intnum == intnum)
- return (AVRational){intnum, den};
- else
- return av_d2q(num*intnum/den, 1<<24);
-}
-
-int64_t av_get_int(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) < 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;
@@ -511,7 +418,7 @@ int av_opt_flag_is_set(void *obj, const char *field_name, const char *flag_name)
if (!field || !flag || flag->type != AV_OPT_TYPE_CONST ||
av_opt_get_int(obj, field_name, 0, &res) < 0)
return 0;
- return res & (int) flag->default_val.dbl;
+ return res & flag->default_val.i64;
}
static void opt_list(void *obj, void *av_log_obj, const char *unit,
@@ -597,34 +504,16 @@ int av_opt_show2(void *obj, void *av_log_obj, int req_flags, int rej_flags)
void av_opt_set_defaults(void *s)
{
-#if FF_API_OLD_AVOPTIONS
- av_opt_set_defaults2(s, 0, 0);
-}
-
-void av_opt_set_defaults2(void *s, int mask, int flags)
-{
-#endif
const AVOption *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 AV_OPT_TYPE_CONST:
/* Nothing to be done here */
break;
case AV_OPT_TYPE_FLAGS:
- case AV_OPT_TYPE_INT: {
- int val;
- val = opt->default_val.dbl;
- av_opt_set_int(s, opt->name, val, 0);
- }
- break;
+ case AV_OPT_TYPE_INT:
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_opt_set_int(s, opt->name, opt->default_val.dbl, 0);
+ av_opt_set_int(s, opt->name, opt->default_val.i64, 0);
break;
case AV_OPT_TYPE_DOUBLE:
case AV_OPT_TYPE_FLOAT: {
@@ -803,8 +692,6 @@ const AVClass *av_opt_child_class_next(const AVClass *parent, const AVClass *pre
#ifdef TEST
-#undef printf
-
typedef struct TestContext
{
const AVClass *class;
@@ -822,14 +709,14 @@ typedef struct TestContext
#define TEST_FLAG_MU 04
static const AVOption test_options[]= {
-{"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 },
+{"num", "set num", OFFSET(num), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 100 },
+{"toggle", "set toggle", OFFSET(toggle), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1 },
+{"rational", "set rational", OFFSET(rational), AV_OPT_TYPE_RATIONAL, {.dbl = 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" },
+{"flags", "set flags", OFFSET(flags), AV_OPT_TYPE_FLAGS, {.i64 = 0}, 0, INT_MAX, 0, "flags" },
+{"cool", "set cool flag ", 0, AV_OPT_TYPE_CONST, {.i64 = TEST_FLAG_COOL}, INT_MIN, INT_MAX, 0, "flags" },
+{"lame", "set lame flag ", 0, AV_OPT_TYPE_CONST, {.i64 = TEST_FLAG_LAME}, INT_MIN, INT_MAX, 0, "flags" },
+{"mu", "set mu flag ", 0, AV_OPT_TYPE_CONST, {.i64 = TEST_FLAG_MU}, INT_MIN, INT_MAX, 0, "flags" },
{NULL},
};
diff --git a/gst-libs/ext/libav/libavutil/opt.h b/gst-libs/ext/libav/libavutil/opt.h
index 1954940..2d3cc73 100644
--- a/gst-libs/ext/libav/libavutil/opt.h
+++ b/gst-libs/ext/libav/libavutil/opt.h
@@ -64,7 +64,7 @@
*
* static const AVOption options[] = {
* { "test_int", "This is a test option of int type.", offsetof(test_struct, int_opt),
- * AV_OPT_TYPE_INT, { -1 }, INT_MIN, INT_MAX },
+ * AV_OPT_TYPE_INT, { .i64 = -1 }, INT_MIN, INT_MAX },
* { "test_str", "This is a test option of string type.", offsetof(test_struct, str_opt),
* AV_OPT_TYPE_STRING },
* { "test_bin", "This is a test option of binary type.", offsetof(test_struct, bin_opt),
@@ -123,7 +123,7 @@
* } child_struct;
* static const AVOption child_opts[] = {
* { "test_flags", "This is a test option of flags type.",
- * offsetof(child_struct, flags_opt), AV_OPT_TYPE_FLAGS, { 0 }, INT_MIN, INT_MAX },
+ * offsetof(child_struct, flags_opt), AV_OPT_TYPE_FLAGS, { .i64 = 0 }, INT_MIN, INT_MAX },
* { NULL },
* };
* static const AVClass child_class = {
@@ -170,8 +170,8 @@
* above, put the following into the child_opts array:
* @code
* { "test_flags", "This is a test option of flags type.",
- * offsetof(child_struct, flags_opt), AV_OPT_TYPE_FLAGS, { 0 }, INT_MIN, INT_MAX, "test_unit" },
- * { "flag1", "This is a flag with value 16", 0, AV_OPT_TYPE_CONST, { 16 }, 0, 0, "test_unit" },
+ * offsetof(child_struct, flags_opt), AV_OPT_TYPE_FLAGS, { .i64 = 0 }, INT_MIN, INT_MAX, "test_unit" },
+ * { "flag1", "This is a flag with value 16", 0, AV_OPT_TYPE_CONST, { .i64 = 16 }, 0, 0, "test_unit" },
* @endcode
*
* @section avoptions_use Using AVOptions
@@ -225,17 +225,6 @@ enum AVOptionType{
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,
- FF_OPT_TYPE_FLOAT,
- FF_OPT_TYPE_STRING,
- 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
};
/**
@@ -261,10 +250,10 @@ typedef struct AVOption {
* the default value for scalar options
*/
union {
+ int64_t i64;
double dbl;
const char *str;
/* TODO those are unused now */
- int64_t i64;
AVRational q;
} default_val;
double min; ///< minimum valid value for the option
@@ -287,66 +276,6 @@ typedef struct AVOption {
const char *unit;
} AVOption;
-#if FF_API_FIND_OPT
-/**
- * Look for an option in obj. Look only for the options which
- * have the flags set as specified in mask and flags (that is,
- * for which it is the case that opt->flags & mask == flags).
- *
- * @param[in] obj a pointer to a struct whose first element is a
- * pointer to an AVClass
- * @param[in] name the name of the option to look for
- * @param[in] unit the unit of the option to look for, or any if NULL
- * @return a pointer to the option found, or NULL if no option
- * has been found
- *
- * @deprecated use av_opt_find.
- */
-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.
- *
- * @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. 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[out] o_out if non-NULL put here a pointer to the AVOption
- * found
- * @param alloc this parameter is currently ignored
- * @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
- * @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);
-
-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.
*
@@ -365,11 +294,6 @@ int av_opt_show2(void *obj, void *av_log_obj, int req_flags, int rej_flags);
*/
void av_opt_set_defaults(void *s);
-#if FF_API_OLD_AVOPTIONS
-attribute_deprecated
-void av_opt_set_defaults2(void *s, int mask, int flags);
-#endif
-
/**
* Parse the key/value pairs list in opts. For each key/value pair
* found, stores the value in the field in ctx that is named like the
@@ -560,6 +484,7 @@ int av_opt_set (void *obj, const char *name, const char *val, int search_f
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);
+int av_opt_set_bin (void *obj, const char *name, const uint8_t *val, int size, int search_flags);
/**
* @}
*/
diff --git a/gst-libs/ext/libav/libavutil/parseutils.c b/gst-libs/ext/libav/libavutil/parseutils.c
index a1d221b..917451e 100644
--- a/gst-libs/ext/libav/libavutil/parseutils.c
+++ b/gst-libs/ext/libav/libavutil/parseutils.c
@@ -21,11 +21,11 @@
* misc parsing utilities
*/
-#include <sys/time.h>
#include <time.h>
#include "avstring.h"
#include "avutil.h"
+#include "common.h"
#include "eval.h"
#include "log.h"
#include "random_seed.h"
@@ -107,8 +107,7 @@ int av_parse_video_size(int *width_ptr, int *height_ptr, const char *str)
}
}
if (i == n) {
- p = str;
- width = strtol(p, &p, 10);
+ width = strtol(str, &p, 10);
if (*p)
p++;
height = strtol(p, &p, 10);
@@ -355,7 +354,7 @@ int av_parse_color(uint8_t *rgba_color, const char *color_string, int slen,
}
if (tail) {
- unsigned long int alpha;
+ double alpha;
const char *alpha_string = tail;
if (!strncmp(alpha_string, "0x", 2)) {
alpha = strtoul(alpha_string, &tail, 16);
@@ -363,7 +362,7 @@ int av_parse_color(uint8_t *rgba_color, const char *color_string, int slen,
alpha = 255 * strtod(alpha_string, &tail);
}
- if (tail == alpha_string || *tail || alpha > 255) {
+ if (tail == alpha_string || *tail || alpha > 255 || alpha < 0) {
av_log(log_ctx, AV_LOG_ERROR, "Invalid alpha value specifier '%s' in '%s'\n",
alpha_string, color_string);
return AVERROR(EINVAL);
@@ -484,7 +483,7 @@ int av_parse_time(int64_t *timeval, const char *timestr, int duration)
{
const char *p;
int64_t t;
- struct tm dt;
+ struct tm dt = { 0 };
int i;
static const char * const date_fmt[] = {
"%Y-%m-%d",
@@ -499,7 +498,6 @@ int av_parse_time(int64_t *timeval, const char *timestr, int duration)
char lastch;
int negative = 0;
-#undef time
time_t now = time(0);
len = strlen(timestr);
@@ -509,8 +507,6 @@ int av_parse_time(int64_t *timeval, const char *timestr, int duration)
lastch = '\0';
is_utc = (lastch == 'z' || lastch == 'Z');
- memset(&dt, 0, sizeof(dt));
-
p = timestr;
q = NULL;
if (!duration) {
@@ -646,14 +642,12 @@ int av_find_info_tag(char *arg, int arg_size, const char *tag1, const char *info
#ifdef TEST
-#undef printf
-
int main(void)
{
printf("Testing av_parse_video_rate()\n");
{
int i;
- const char *rates[] = {
+ static const char *const rates[] = {
"-inf",
"inf",
"nan",
@@ -683,10 +677,10 @@ int main(void)
for (i = 0; i < FF_ARRAY_ELEMS(rates); i++) {
int ret;
- AVRational q = (AVRational){0, 0};
- ret = av_parse_video_rate(&q, rates[i]),
- printf("'%s' -> %d/%d ret:%d\n",
- rates[i], q.num, q.den, ret);
+ AVRational q = { 0, 0 };
+ ret = av_parse_video_rate(&q, rates[i]);
+ printf("'%s' -> %d/%d %s\n",
+ rates[i], q.num, q.den, ret ? "ERROR" : "OK");
}
}
@@ -694,9 +688,7 @@ int main(void)
{
int i;
uint8_t rgba[4];
- const char *color_names[] = {
- "bikeshed",
- "RaNdOm",
+ static const char *const color_names[] = {
"foo",
"red",
"Red ",
@@ -737,7 +729,8 @@ int main(void)
for (i = 0; i < FF_ARRAY_ELEMS(color_names); i++) {
if (av_parse_color(rgba, color_names[i], -1, NULL) >= 0)
- printf("%s -> R(%d) G(%d) B(%d) A(%d)\n", color_names[i], rgba[0], rgba[1], rgba[2], rgba[3]);
+ printf("%s -> R(%d) G(%d) B(%d) A(%d)\n",
+ color_names[i], rgba[0], rgba[1], rgba[2], rgba[3]);
}
}
diff --git a/gst-libs/ext/libav/libavutil/pixdesc.c b/gst-libs/ext/libav/libavutil/pixdesc.c
index 6e1f23b..31b7cf5 100644
--- a/gst-libs/ext/libav/libavutil/pixdesc.c
+++ b/gst-libs/ext/libav/libavutil/pixdesc.c
@@ -21,13 +21,17 @@
#include <stdio.h>
#include <string.h>
+
+#include "common.h"
#include "pixfmt.h"
#include "pixdesc.h"
#include "intreadwrite.h"
-void av_read_image_line(uint16_t *dst, const uint8_t *data[4], const int linesize[4],
- const AVPixFmtDescriptor *desc, int x, int y, int c, int w,
+void av_read_image_line(uint16_t *dst,
+ const uint8_t *data[4], const int linesize[4],
+ const AVPixFmtDescriptor *desc,
+ int x, int y, int c, int w,
int read_pal_component)
{
AVComponentDescriptor comp = desc->comp[c];
@@ -53,7 +57,8 @@ void av_read_image_line(uint16_t *dst, const uint8_t *data[4], const int linesiz
*dst++ = val;
}
} else {
- const uint8_t *p = data[plane] + y * linesize[plane] + x * step + comp.offset_plus1 - 1;
+ const uint8_t *p = data[plane] + y * linesize[plane] +
+ x * step + comp.offset_plus1 - 1;
int is_8bit = shift + depth <= 8;
if (is_8bit)
@@ -71,8 +76,10 @@ void av_read_image_line(uint16_t *dst, const uint8_t *data[4], const int linesiz
}
}
-void av_write_image_line(const uint16_t *src, uint8_t *data[4], const int linesize[4],
- const AVPixFmtDescriptor *desc, int x, int y, int c, int w)
+void av_write_image_line(const uint16_t *src,
+ uint8_t *data[4], const int linesize[4],
+ const AVPixFmtDescriptor *desc,
+ int x, int y, int c, int w)
{
AVComponentDescriptor comp = desc->comp[c];
int plane = comp.plane;
@@ -93,7 +100,8 @@ void av_write_image_line(const uint16_t *src, uint8_t *data[4], const int linesi
}
} else {
int shift = comp.shift;
- uint8_t *p = data[plane] + y * linesize[plane] + x * step + comp.offset_plus1 - 1;
+ uint8_t *p = data[plane] + y * linesize[plane] +
+ x * step + comp.offset_plus1 - 1;
if (shift + depth <= 8) {
p += !!(flags & PIX_FMT_BE);
@@ -116,8 +124,11 @@ void av_write_image_line(const uint16_t *src, uint8_t *data[4], const int linesi
}
}
-const AVPixFmtDescriptor av_pix_fmt_descriptors[PIX_FMT_NB] = {
- [PIX_FMT_YUV420P] = {
+#if !FF_API_PIX_FMT_DESC
+static
+#endif
+const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
+ [AV_PIX_FMT_YUV420P] = {
.name = "yuv420p",
.nb_components = 3,
.log2_chroma_w = 1,
@@ -129,7 +140,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[PIX_FMT_NB] = {
},
.flags = PIX_FMT_PLANAR,
},
- [PIX_FMT_YUYV422] = {
+ [AV_PIX_FMT_YUYV422] = {
.name = "yuyv422",
.nb_components = 3,
.log2_chroma_w = 1,
@@ -140,7 +151,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[PIX_FMT_NB] = {
{ 0, 3, 4, 0, 7 }, /* V */
},
},
- [PIX_FMT_RGB24] = {
+ [AV_PIX_FMT_RGB24] = {
.name = "rgb24",
.nb_components = 3,
.log2_chroma_w = 0,
@@ -152,7 +163,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[PIX_FMT_NB] = {
},
.flags = PIX_FMT_RGB,
},
- [PIX_FMT_BGR24] = {
+ [AV_PIX_FMT_BGR24] = {
.name = "bgr24",
.nb_components = 3,
.log2_chroma_w = 0,
@@ -164,7 +175,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[PIX_FMT_NB] = {
},
.flags = PIX_FMT_RGB,
},
- [PIX_FMT_YUV422P] = {
+ [AV_PIX_FMT_YUV422P] = {
.name = "yuv422p",
.nb_components = 3,
.log2_chroma_w = 1,
@@ -176,7 +187,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[PIX_FMT_NB] = {
},
.flags = PIX_FMT_PLANAR,
},
- [PIX_FMT_YUV444P] = {
+ [AV_PIX_FMT_YUV444P] = {
.name = "yuv444p",
.nb_components = 3,
.log2_chroma_w = 0,
@@ -188,7 +199,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[PIX_FMT_NB] = {
},
.flags = PIX_FMT_PLANAR,
},
- [PIX_FMT_YUV410P] = {
+ [AV_PIX_FMT_YUV410P] = {
.name = "yuv410p",
.nb_components = 3,
.log2_chroma_w = 2,
@@ -200,7 +211,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[PIX_FMT_NB] = {
},
.flags = PIX_FMT_PLANAR,
},
- [PIX_FMT_YUV411P] = {
+ [AV_PIX_FMT_YUV411P] = {
.name = "yuv411p",
.nb_components = 3,
.log2_chroma_w = 2,
@@ -212,7 +223,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[PIX_FMT_NB] = {
},
.flags = PIX_FMT_PLANAR,
},
- [PIX_FMT_GRAY8] = {
+ [AV_PIX_FMT_GRAY8] = {
.name = "gray",
.nb_components = 1,
.log2_chroma_w = 0,
@@ -220,8 +231,9 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[PIX_FMT_NB] = {
.comp = {
{ 0, 0, 1, 0, 7 }, /* Y */
},
+ .flags = PIX_FMT_PSEUDOPAL,
},
- [PIX_FMT_MONOWHITE] = {
+ [AV_PIX_FMT_MONOWHITE] = {
.name = "monow",
.nb_components = 1,
.log2_chroma_w = 0,
@@ -231,7 +243,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[PIX_FMT_NB] = {
},
.flags = PIX_FMT_BITSTREAM,
},
- [PIX_FMT_MONOBLACK] = {
+ [AV_PIX_FMT_MONOBLACK] = {
.name = "monob",
.nb_components = 1,
.log2_chroma_w = 0,
@@ -241,7 +253,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[PIX_FMT_NB] = {
},
.flags = PIX_FMT_BITSTREAM,
},
- [PIX_FMT_PAL8] = {
+ [AV_PIX_FMT_PAL8] = {
.name = "pal8",
.nb_components = 1,
.log2_chroma_w = 0,
@@ -251,7 +263,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[PIX_FMT_NB] = {
},
.flags = PIX_FMT_PAL,
},
- [PIX_FMT_YUVJ420P] = {
+ [AV_PIX_FMT_YUVJ420P] = {
.name = "yuvj420p",
.nb_components = 3,
.log2_chroma_w = 1,
@@ -263,7 +275,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[PIX_FMT_NB] = {
},
.flags = PIX_FMT_PLANAR,
},
- [PIX_FMT_YUVJ422P] = {
+ [AV_PIX_FMT_YUVJ422P] = {
.name = "yuvj422p",
.nb_components = 3,
.log2_chroma_w = 1,
@@ -275,7 +287,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[PIX_FMT_NB] = {
},
.flags = PIX_FMT_PLANAR,
},
- [PIX_FMT_YUVJ444P] = {
+ [AV_PIX_FMT_YUVJ444P] = {
.name = "yuvj444p",
.nb_components = 3,
.log2_chroma_w = 0,
@@ -287,15 +299,15 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[PIX_FMT_NB] = {
},
.flags = PIX_FMT_PLANAR,
},
- [PIX_FMT_XVMC_MPEG2_MC] = {
+ [AV_PIX_FMT_XVMC_MPEG2_MC] = {
.name = "xvmcmc",
.flags = PIX_FMT_HWACCEL,
},
- [PIX_FMT_XVMC_MPEG2_IDCT] = {
+ [AV_PIX_FMT_XVMC_MPEG2_IDCT] = {
.name = "xvmcidct",
.flags = PIX_FMT_HWACCEL,
},
- [PIX_FMT_UYVY422] = {
+ [AV_PIX_FMT_UYVY422] = {
.name = "uyvy422",
.nb_components = 3,
.log2_chroma_w = 1,
@@ -306,7 +318,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[PIX_FMT_NB] = {
{ 0, 3, 3, 0, 7 }, /* V */
},
},
- [PIX_FMT_UYYVYY411] = {
+ [AV_PIX_FMT_UYYVYY411] = {
.name = "uyyvyy411",
.nb_components = 3,
.log2_chroma_w = 2,
@@ -317,7 +329,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[PIX_FMT_NB] = {
{ 0, 5, 4, 0, 7 }, /* V */
},
},
- [PIX_FMT_BGR8] = {
+ [AV_PIX_FMT_BGR8] = {
.name = "bgr8",
.nb_components = 3,
.log2_chroma_w = 0,
@@ -327,9 +339,9 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[PIX_FMT_NB] = {
{ 0, 0, 1, 3, 2 }, /* G */
{ 0, 0, 1, 0, 2 }, /* R */
},
- .flags = PIX_FMT_PAL | PIX_FMT_RGB,
+ .flags = PIX_FMT_RGB | PIX_FMT_PSEUDOPAL,
},
- [PIX_FMT_BGR4] = {
+ [AV_PIX_FMT_BGR4] = {
.name = "bgr4",
.nb_components = 3,
.log2_chroma_w = 0,
@@ -341,7 +353,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[PIX_FMT_NB] = {
},
.flags = PIX_FMT_BITSTREAM | PIX_FMT_RGB,
},
- [PIX_FMT_BGR4_BYTE] = {
+ [AV_PIX_FMT_BGR4_BYTE] = {
.name = "bgr4_byte",
.nb_components = 3,
.log2_chroma_w = 0,
@@ -351,9 +363,9 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[PIX_FMT_NB] = {
{ 0, 0, 1, 1, 1 }, /* G */
{ 0, 0, 1, 0, 0 }, /* R */
},
- .flags = PIX_FMT_PAL | PIX_FMT_RGB,
+ .flags = PIX_FMT_RGB | PIX_FMT_PSEUDOPAL,
},
- [PIX_FMT_RGB8] = {
+ [AV_PIX_FMT_RGB8] = {
.name = "rgb8",
.nb_components = 3,
.log2_chroma_w = 0,
@@ -363,9 +375,9 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[PIX_FMT_NB] = {
{ 0, 0, 1, 3, 2 }, /* G */
{ 0, 0, 1, 0, 2 }, /* B */
},
- .flags = PIX_FMT_PAL | PIX_FMT_RGB,
+ .flags = PIX_FMT_RGB | PIX_FMT_PSEUDOPAL,
},
- [PIX_FMT_RGB4] = {
+ [AV_PIX_FMT_RGB4] = {
.name = "rgb4",
.nb_components = 3,
.log2_chroma_w = 0,
@@ -377,7 +389,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[PIX_FMT_NB] = {
},
.flags = PIX_FMT_BITSTREAM | PIX_FMT_RGB,
},
- [PIX_FMT_RGB4_BYTE] = {
+ [AV_PIX_FMT_RGB4_BYTE] = {
.name = "rgb4_byte",
.nb_components = 3,
.log2_chroma_w = 0,
@@ -387,21 +399,21 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[PIX_FMT_NB] = {
{ 0, 0, 1, 1, 1 }, /* G */
{ 0, 0, 1, 0, 0 }, /* B */
},
- .flags = PIX_FMT_PAL | PIX_FMT_RGB,
+ .flags = PIX_FMT_RGB | PIX_FMT_PSEUDOPAL,
},
- [PIX_FMT_NV12] = {
+ [AV_PIX_FMT_NV12] = {
.name = "nv12",
.nb_components = 3,
.log2_chroma_w = 1,
.log2_chroma_h = 1,
.comp = {
- { 0,0,1,0,7 }, /* Y */
- { 1,1,1,0,7 }, /* U */
- { 1,1,2,0,7 }, /* V */
+ { 0, 0, 1, 0, 7 }, /* Y */
+ { 1, 1, 1, 0, 7 }, /* U */
+ { 1, 1, 2, 0, 7 }, /* V */
},
.flags = PIX_FMT_PLANAR,
},
- [PIX_FMT_NV21] = {
+ [AV_PIX_FMT_NV21] = {
.name = "nv21",
.nb_components = 3,
.log2_chroma_w = 1,
@@ -413,7 +425,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[PIX_FMT_NB] = {
},
.flags = PIX_FMT_PLANAR,
},
- [PIX_FMT_ARGB] = {
+ [AV_PIX_FMT_ARGB] = {
.name = "argb",
.nb_components = 4,
.log2_chroma_w = 0,
@@ -424,9 +436,9 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[PIX_FMT_NB] = {
{ 0, 3, 3, 0, 7 }, /* G */
{ 0, 3, 4, 0, 7 }, /* B */
},
- .flags = PIX_FMT_RGB,
+ .flags = PIX_FMT_RGB | PIX_FMT_ALPHA,
},
- [PIX_FMT_RGBA] = {
+ [AV_PIX_FMT_RGBA] = {
.name = "rgba",
.nb_components = 4,
.log2_chroma_w = 0,
@@ -437,9 +449,9 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[PIX_FMT_NB] = {
{ 0, 3, 3, 0, 7 }, /* B */
{ 0, 3, 4, 0, 7 }, /* A */
},
- .flags = PIX_FMT_RGB,
+ .flags = PIX_FMT_RGB | PIX_FMT_ALPHA,
},
- [PIX_FMT_ABGR] = {
+ [AV_PIX_FMT_ABGR] = {
.name = "abgr",
.nb_components = 4,
.log2_chroma_w = 0,
@@ -450,9 +462,9 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[PIX_FMT_NB] = {
{ 0, 3, 3, 0, 7 }, /* G */
{ 0, 3, 4, 0, 7 }, /* R */
},
- .flags = PIX_FMT_RGB,
+ .flags = PIX_FMT_RGB | PIX_FMT_ALPHA,
},
- [PIX_FMT_BGRA] = {
+ [AV_PIX_FMT_BGRA] = {
.name = "bgra",
.nb_components = 4,
.log2_chroma_w = 0,
@@ -463,9 +475,9 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[PIX_FMT_NB] = {
{ 0, 3, 3, 0, 7 }, /* R */
{ 0, 3, 4, 0, 7 }, /* A */
},
- .flags = PIX_FMT_RGB,
+ .flags = PIX_FMT_RGB | PIX_FMT_ALPHA,
},
- [PIX_FMT_GRAY16BE] = {
+ [AV_PIX_FMT_GRAY16BE] = {
.name = "gray16be",
.nb_components = 1,
.log2_chroma_w = 0,
@@ -475,7 +487,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[PIX_FMT_NB] = {
},
.flags = PIX_FMT_BE,
},
- [PIX_FMT_GRAY16LE] = {
+ [AV_PIX_FMT_GRAY16LE] = {
.name = "gray16le",
.nb_components = 1,
.log2_chroma_w = 0,
@@ -484,7 +496,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[PIX_FMT_NB] = {
{ 0, 1, 1, 0, 15 }, /* Y */
},
},
- [PIX_FMT_YUV440P] = {
+ [AV_PIX_FMT_YUV440P] = {
.name = "yuv440p",
.nb_components = 3,
.log2_chroma_w = 0,
@@ -496,7 +508,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[PIX_FMT_NB] = {
},
.flags = PIX_FMT_PLANAR,
},
- [PIX_FMT_YUVJ440P] = {
+ [AV_PIX_FMT_YUVJ440P] = {
.name = "yuvj440p",
.nb_components = 3,
.log2_chroma_w = 0,
@@ -508,7 +520,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[PIX_FMT_NB] = {
},
.flags = PIX_FMT_PLANAR,
},
- [PIX_FMT_YUVA420P] = {
+ [AV_PIX_FMT_YUVA420P] = {
.name = "yuva420p",
.nb_components = 4,
.log2_chroma_w = 1,
@@ -519,45 +531,305 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[PIX_FMT_NB] = {
{ 2, 0, 1, 0, 7 }, /* V */
{ 3, 0, 1, 0, 7 }, /* A */
},
- .flags = PIX_FMT_PLANAR,
+ .flags = PIX_FMT_PLANAR | PIX_FMT_ALPHA,
+ },
+ [AV_PIX_FMT_YUVA422P] = {
+ .name = "yuva422p",
+ .nb_components = 4,
+ .log2_chroma_w = 1,
+ .log2_chroma_h = 0,
+ .comp = {
+ { 0, 0, 1, 0, 7 }, /* Y */
+ { 1, 0, 1, 0, 7 }, /* U */
+ { 2, 0, 1, 0, 7 }, /* V */
+ { 3, 0, 1, 0, 7 }, /* A */
+ },
+ .flags = PIX_FMT_PLANAR | PIX_FMT_ALPHA,
+ },
+ [AV_PIX_FMT_YUVA444P] = {
+ .name = "yuva444p",
+ .nb_components = 4,
+ .log2_chroma_w = 0,
+ .log2_chroma_h = 0,
+ .comp = {
+ { 0, 0, 1, 0, 7 }, /* Y */
+ { 1, 0, 1, 0, 7 }, /* U */
+ { 2, 0, 1, 0, 7 }, /* V */
+ { 3, 0, 1, 0, 7 }, /* A */
+ },
+ .flags = PIX_FMT_PLANAR | PIX_FMT_ALPHA,
+ },
+ [AV_PIX_FMT_YUVA420P9BE] = {
+ .name = "yuva420p9be",
+ .nb_components = 4,
+ .log2_chroma_w = 1,
+ .log2_chroma_h = 1,
+ .comp = {
+ { 0, 1, 1, 0, 8 }, /* Y */
+ { 1, 1, 1, 0, 8 }, /* U */
+ { 2, 1, 1, 0, 8 }, /* V */
+ { 3, 1, 1, 0, 8 }, /* A */
+ },
+ .flags = PIX_FMT_BE | PIX_FMT_PLANAR,
+ },
+ [AV_PIX_FMT_YUVA420P9LE] = {
+ .name = "yuva420p9le",
+ .nb_components = 4,
+ .log2_chroma_w = 1,
+ .log2_chroma_h = 1,
+ .comp = {
+ { 0, 1, 1, 0, 8 }, /* Y */
+ { 1, 1, 1, 0, 8 }, /* U */
+ { 2, 1, 1, 0, 8 }, /* V */
+ { 3, 1, 1, 0, 8 }, /* A */
+ },
+ .flags = PIX_FMT_PLANAR | PIX_FMT_ALPHA,
+ },
+ [AV_PIX_FMT_YUVA422P9BE] = {
+ .name = "yuva422p9be",
+ .nb_components = 4,
+ .log2_chroma_w = 1,
+ .log2_chroma_h = 0,
+ .comp = {
+ { 0, 1, 1, 0, 8 }, /* Y */
+ { 1, 1, 1, 0, 8 }, /* U */
+ { 2, 1, 1, 0, 8 }, /* V */
+ { 3, 1, 1, 0, 8 }, /* A */
+ },
+ .flags = PIX_FMT_BE | PIX_FMT_PLANAR | PIX_FMT_ALPHA,
+ },
+ [AV_PIX_FMT_YUVA422P9LE] = {
+ .name = "yuva422p9le",
+ .nb_components = 4,
+ .log2_chroma_w = 1,
+ .log2_chroma_h = 0,
+ .comp = {
+ { 0, 1, 1, 0, 8 }, /* Y */
+ { 1, 1, 1, 0, 8 }, /* U */
+ { 2, 1, 1, 0, 8 }, /* V */
+ { 3, 1, 1, 0, 8 }, /* A */
+ },
+ .flags = PIX_FMT_PLANAR | PIX_FMT_ALPHA,
+ },
+ [AV_PIX_FMT_YUVA444P9BE] = {
+ .name = "yuva444p9be",
+ .nb_components = 4,
+ .log2_chroma_w = 0,
+ .log2_chroma_h = 0,
+ .comp = {
+ { 0, 1, 1, 0, 8 }, /* Y */
+ { 1, 1, 1, 0, 8 }, /* U */
+ { 2, 1, 1, 0, 8 }, /* V */
+ { 3, 1, 1, 0, 8 }, /* A */
+ },
+ .flags = PIX_FMT_BE | PIX_FMT_PLANAR | PIX_FMT_ALPHA,
+ },
+ [AV_PIX_FMT_YUVA444P9LE] = {
+ .name = "yuva444p9le",
+ .nb_components = 4,
+ .log2_chroma_w = 0,
+ .log2_chroma_h = 0,
+ .comp = {
+ { 0, 1, 1, 0, 8 }, /* Y */
+ { 1, 1, 1, 0, 8 }, /* U */
+ { 2, 1, 1, 0, 8 }, /* V */
+ { 3, 1, 1, 0, 8 }, /* A */
+ },
+ .flags = PIX_FMT_PLANAR | PIX_FMT_ALPHA,
+ },
+ [AV_PIX_FMT_YUVA420P10BE] = {
+ .name = "yuva420p10be",
+ .nb_components = 4,
+ .log2_chroma_w = 1,
+ .log2_chroma_h = 1,
+ .comp = {
+ { 0, 1, 1, 0, 9 }, /* Y */
+ { 1, 1, 1, 0, 9 }, /* U */
+ { 2, 1, 1, 0, 9 }, /* V */
+ { 3, 1, 1, 0, 9 }, /* A */
+ },
+ .flags = PIX_FMT_BE | PIX_FMT_PLANAR | PIX_FMT_ALPHA,
+ },
+ [AV_PIX_FMT_YUVA420P10LE] = {
+ .name = "yuva420p10le",
+ .nb_components = 4,
+ .log2_chroma_w = 1,
+ .log2_chroma_h = 1,
+ .comp = {
+ { 0, 1, 1, 0, 9 }, /* Y */
+ { 1, 1, 1, 0, 9 }, /* U */
+ { 2, 1, 1, 0, 9 }, /* V */
+ { 3, 1, 1, 0, 9 }, /* A */
+ },
+ .flags = PIX_FMT_PLANAR | PIX_FMT_ALPHA,
+ },
+ [AV_PIX_FMT_YUVA422P10BE] = {
+ .name = "yuva422p10be",
+ .nb_components = 4,
+ .log2_chroma_w = 1,
+ .log2_chroma_h = 0,
+ .comp = {
+ { 0, 1, 1, 0, 9 }, /* Y */
+ { 1, 1, 1, 0, 9 }, /* U */
+ { 2, 1, 1, 0, 9 }, /* V */
+ { 3, 1, 1, 0, 9 }, /* A */
+ },
+ .flags = PIX_FMT_BE | PIX_FMT_PLANAR | PIX_FMT_ALPHA,
+ },
+ [AV_PIX_FMT_YUVA422P10LE] = {
+ .name = "yuva422p10le",
+ .nb_components = 4,
+ .log2_chroma_w = 1,
+ .log2_chroma_h = 0,
+ .comp = {
+ { 0, 1, 1, 0, 9 }, /* Y */
+ { 1, 1, 1, 0, 9 }, /* U */
+ { 2, 1, 1, 0, 9 }, /* V */
+ { 3, 1, 1, 0, 9 }, /* A */
+ },
+ .flags = PIX_FMT_PLANAR | PIX_FMT_ALPHA,
+ },
+ [AV_PIX_FMT_YUVA444P10BE] = {
+ .name = "yuva444p10be",
+ .nb_components = 4,
+ .log2_chroma_w = 0,
+ .log2_chroma_h = 0,
+ .comp = {
+ { 0, 1, 1, 0, 9 }, /* Y */
+ { 1, 1, 1, 0, 9 }, /* U */
+ { 2, 1, 1, 0, 9 }, /* V */
+ { 3, 1, 1, 0, 9 }, /* A */
+ },
+ .flags = PIX_FMT_BE | PIX_FMT_PLANAR | PIX_FMT_ALPHA,
+ },
+ [AV_PIX_FMT_YUVA444P10LE] = {
+ .name = "yuva444p10le",
+ .nb_components = 4,
+ .log2_chroma_w = 0,
+ .log2_chroma_h = 0,
+ .comp = {
+ { 0, 1, 1, 0, 9 }, /* Y */
+ { 1, 1, 1, 0, 9 }, /* U */
+ { 2, 1, 1, 0, 9 }, /* V */
+ { 3, 1, 1, 0, 9 }, /* A */
+ },
+ .flags = PIX_FMT_PLANAR | PIX_FMT_ALPHA,
+ },
+ [AV_PIX_FMT_YUVA420P16BE] = {
+ .name = "yuva420p16be",
+ .nb_components = 4,
+ .log2_chroma_w = 1,
+ .log2_chroma_h = 1,
+ .comp = {
+ { 0, 1, 1, 0, 15 }, /* Y */
+ { 1, 1, 1, 0, 15 }, /* U */
+ { 2, 1, 1, 0, 15 }, /* V */
+ { 3, 1, 1, 0, 15 }, /* A */
+ },
+ .flags = PIX_FMT_BE | PIX_FMT_PLANAR | PIX_FMT_ALPHA,
+ },
+ [AV_PIX_FMT_YUVA420P16LE] = {
+ .name = "yuva420p16le",
+ .nb_components = 4,
+ .log2_chroma_w = 1,
+ .log2_chroma_h = 1,
+ .comp = {
+ { 0, 1, 1, 0, 15 }, /* Y */
+ { 1, 1, 1, 0, 15 }, /* U */
+ { 2, 1, 1, 0, 15 }, /* V */
+ { 3, 1, 1, 0, 15 }, /* A */
+ },
+ .flags = PIX_FMT_PLANAR | PIX_FMT_ALPHA,
+ },
+ [AV_PIX_FMT_YUVA422P16BE] = {
+ .name = "yuva422p16be",
+ .nb_components = 4,
+ .log2_chroma_w = 1,
+ .log2_chroma_h = 0,
+ .comp = {
+ { 0, 1, 1, 0, 15 }, /* Y */
+ { 1, 1, 1, 0, 15 }, /* U */
+ { 2, 1, 1, 0, 15 }, /* V */
+ { 3, 1, 1, 0, 15 }, /* A */
+ },
+ .flags = PIX_FMT_BE | PIX_FMT_PLANAR | PIX_FMT_ALPHA,
+ },
+ [AV_PIX_FMT_YUVA422P16LE] = {
+ .name = "yuva422p16le",
+ .nb_components = 4,
+ .log2_chroma_w = 1,
+ .log2_chroma_h = 0,
+ .comp = {
+ { 0, 1, 1, 0, 15 }, /* Y */
+ { 1, 1, 1, 0, 15 }, /* U */
+ { 2, 1, 1, 0, 15 }, /* V */
+ { 3, 1, 1, 0, 15 }, /* A */
+ },
+ .flags = PIX_FMT_PLANAR | PIX_FMT_ALPHA,
+ },
+ [AV_PIX_FMT_YUVA444P16BE] = {
+ .name = "yuva444p16be",
+ .nb_components = 4,
+ .log2_chroma_w = 0,
+ .log2_chroma_h = 0,
+ .comp = {
+ { 0, 1, 1, 0, 15 }, /* Y */
+ { 1, 1, 1, 0, 15 }, /* U */
+ { 2, 1, 1, 0, 15 }, /* V */
+ { 3, 1, 1, 0, 15 }, /* A */
+ },
+ .flags = PIX_FMT_BE | PIX_FMT_PLANAR | PIX_FMT_ALPHA,
},
- [PIX_FMT_VDPAU_H264] = {
+ [AV_PIX_FMT_YUVA444P16LE] = {
+ .name = "yuva444p16le",
+ .nb_components = 4,
+ .log2_chroma_w = 0,
+ .log2_chroma_h = 0,
+ .comp = {
+ { 0, 1, 1, 0, 15 }, /* Y */
+ { 1, 1, 1, 0, 15 }, /* U */
+ { 2, 1, 1, 0, 15 }, /* V */
+ { 3, 1, 1, 0, 15 }, /* A */
+ },
+ .flags = PIX_FMT_PLANAR | PIX_FMT_ALPHA,
+ },
+ [AV_PIX_FMT_VDPAU_H264] = {
.name = "vdpau_h264",
.log2_chroma_w = 1,
.log2_chroma_h = 1,
.flags = PIX_FMT_HWACCEL,
},
- [PIX_FMT_VDPAU_MPEG1] = {
+ [AV_PIX_FMT_VDPAU_MPEG1] = {
.name = "vdpau_mpeg1",
.log2_chroma_w = 1,
.log2_chroma_h = 1,
.flags = PIX_FMT_HWACCEL,
},
- [PIX_FMT_VDPAU_MPEG2] = {
+ [AV_PIX_FMT_VDPAU_MPEG2] = {
.name = "vdpau_mpeg2",
.log2_chroma_w = 1,
.log2_chroma_h = 1,
.flags = PIX_FMT_HWACCEL,
},
- [PIX_FMT_VDPAU_WMV3] = {
+ [AV_PIX_FMT_VDPAU_WMV3] = {
.name = "vdpau_wmv3",
.log2_chroma_w = 1,
.log2_chroma_h = 1,
.flags = PIX_FMT_HWACCEL,
},
- [PIX_FMT_VDPAU_VC1] = {
+ [AV_PIX_FMT_VDPAU_VC1] = {
.name = "vdpau_vc1",
.log2_chroma_w = 1,
.log2_chroma_h = 1,
.flags = PIX_FMT_HWACCEL,
},
- [PIX_FMT_VDPAU_MPEG4] = {
+ [AV_PIX_FMT_VDPAU_MPEG4] = {
.name = "vdpau_mpeg4",
.log2_chroma_w = 1,
.log2_chroma_h = 1,
.flags = PIX_FMT_HWACCEL,
},
- [PIX_FMT_RGB48BE] = {
+ [AV_PIX_FMT_RGB48BE] = {
.name = "rgb48be",
.nb_components = 3,
.log2_chroma_w = 0,
@@ -569,7 +841,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[PIX_FMT_NB] = {
},
.flags = PIX_FMT_RGB | PIX_FMT_BE,
},
- [PIX_FMT_RGB48LE] = {
+ [AV_PIX_FMT_RGB48LE] = {
.name = "rgb48le",
.nb_components = 3,
.log2_chroma_w = 0,
@@ -581,7 +853,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[PIX_FMT_NB] = {
},
.flags = PIX_FMT_RGB,
},
- [PIX_FMT_RGB565BE] = {
+ [AV_PIX_FMT_RGB565BE] = {
.name = "rgb565be",
.nb_components = 3,
.log2_chroma_w = 0,
@@ -593,7 +865,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[PIX_FMT_NB] = {
},
.flags = PIX_FMT_BE | PIX_FMT_RGB,
},
- [PIX_FMT_RGB565LE] = {
+ [AV_PIX_FMT_RGB565LE] = {
.name = "rgb565le",
.nb_components = 3,
.log2_chroma_w = 0,
@@ -605,7 +877,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[PIX_FMT_NB] = {
},
.flags = PIX_FMT_RGB,
},
- [PIX_FMT_RGB555BE] = {
+ [AV_PIX_FMT_RGB555BE] = {
.name = "rgb555be",
.nb_components = 3,
.log2_chroma_w = 0,
@@ -617,7 +889,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[PIX_FMT_NB] = {
},
.flags = PIX_FMT_BE | PIX_FMT_RGB,
},
- [PIX_FMT_RGB555LE] = {
+ [AV_PIX_FMT_RGB555LE] = {
.name = "rgb555le",
.nb_components = 3,
.log2_chroma_w = 0,
@@ -629,7 +901,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[PIX_FMT_NB] = {
},
.flags = PIX_FMT_RGB,
},
- [PIX_FMT_RGB444BE] = {
+ [AV_PIX_FMT_RGB444BE] = {
.name = "rgb444be",
.nb_components = 3,
.log2_chroma_w = 0,
@@ -641,7 +913,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[PIX_FMT_NB] = {
},
.flags = PIX_FMT_BE | PIX_FMT_RGB,
},
- [PIX_FMT_RGB444LE] = {
+ [AV_PIX_FMT_RGB444LE] = {
.name = "rgb444le",
.nb_components = 3,
.log2_chroma_w = 0,
@@ -653,7 +925,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[PIX_FMT_NB] = {
},
.flags = PIX_FMT_RGB,
},
- [PIX_FMT_BGR48BE] = {
+ [AV_PIX_FMT_BGR48BE] = {
.name = "bgr48be",
.nb_components = 3,
.log2_chroma_w = 0,
@@ -665,7 +937,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[PIX_FMT_NB] = {
},
.flags = PIX_FMT_BE | PIX_FMT_RGB,
},
- [PIX_FMT_BGR48LE] = {
+ [AV_PIX_FMT_BGR48LE] = {
.name = "bgr48le",
.nb_components = 3,
.log2_chroma_w = 0,
@@ -677,7 +949,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[PIX_FMT_NB] = {
},
.flags = PIX_FMT_RGB,
},
- [PIX_FMT_BGR565BE] = {
+ [AV_PIX_FMT_BGR565BE] = {
.name = "bgr565be",
.nb_components = 3,
.log2_chroma_w = 0,
@@ -689,7 +961,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[PIX_FMT_NB] = {
},
.flags = PIX_FMT_BE | PIX_FMT_RGB,
},
- [PIX_FMT_BGR565LE] = {
+ [AV_PIX_FMT_BGR565LE] = {
.name = "bgr565le",
.nb_components = 3,
.log2_chroma_w = 0,
@@ -701,7 +973,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[PIX_FMT_NB] = {
},
.flags = PIX_FMT_RGB,
},
- [PIX_FMT_BGR555BE] = {
+ [AV_PIX_FMT_BGR555BE] = {
.name = "bgr555be",
.nb_components = 3,
.log2_chroma_w = 0,
@@ -713,7 +985,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[PIX_FMT_NB] = {
},
.flags = PIX_FMT_BE | PIX_FMT_RGB,
},
- [PIX_FMT_BGR555LE] = {
+ [AV_PIX_FMT_BGR555LE] = {
.name = "bgr555le",
.nb_components = 3,
.log2_chroma_w = 0,
@@ -725,7 +997,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[PIX_FMT_NB] = {
},
.flags = PIX_FMT_RGB,
},
- [PIX_FMT_BGR444BE] = {
+ [AV_PIX_FMT_BGR444BE] = {
.name = "bgr444be",
.nb_components = 3,
.log2_chroma_w = 0,
@@ -737,7 +1009,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[PIX_FMT_NB] = {
},
.flags = PIX_FMT_BE | PIX_FMT_RGB,
},
- [PIX_FMT_BGR444LE] = {
+ [AV_PIX_FMT_BGR444LE] = {
.name = "bgr444le",
.nb_components = 3,
.log2_chroma_w = 0,
@@ -749,31 +1021,31 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[PIX_FMT_NB] = {
},
.flags = PIX_FMT_RGB,
},
- [PIX_FMT_VAAPI_MOCO] = {
+ [AV_PIX_FMT_VAAPI_MOCO] = {
.name = "vaapi_moco",
.log2_chroma_w = 1,
.log2_chroma_h = 1,
.flags = PIX_FMT_HWACCEL,
},
- [PIX_FMT_VAAPI_IDCT] = {
+ [AV_PIX_FMT_VAAPI_IDCT] = {
.name = "vaapi_idct",
.log2_chroma_w = 1,
.log2_chroma_h = 1,
.flags = PIX_FMT_HWACCEL,
},
- [PIX_FMT_VAAPI_VLD] = {
+ [AV_PIX_FMT_VAAPI_VLD] = {
.name = "vaapi_vld",
.log2_chroma_w = 1,
.log2_chroma_h = 1,
.flags = PIX_FMT_HWACCEL,
},
- [PIX_FMT_VDA_VLD] = {
+ [AV_PIX_FMT_VDA_VLD] = {
.name = "vda_vld",
.log2_chroma_w = 1,
.log2_chroma_h = 1,
.flags = PIX_FMT_HWACCEL,
},
- [PIX_FMT_YUV420P9LE] = {
+ [AV_PIX_FMT_YUV420P9LE] = {
.name = "yuv420p9le",
.nb_components = 3,
.log2_chroma_w = 1,
@@ -785,7 +1057,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[PIX_FMT_NB] = {
},
.flags = PIX_FMT_PLANAR,
},
- [PIX_FMT_YUV420P9BE] = {
+ [AV_PIX_FMT_YUV420P9BE] = {
.name = "yuv420p9be",
.nb_components = 3,
.log2_chroma_w = 1,
@@ -797,7 +1069,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[PIX_FMT_NB] = {
},
.flags = PIX_FMT_BE | PIX_FMT_PLANAR,
},
- [PIX_FMT_YUV420P10LE] = {
+ [AV_PIX_FMT_YUV420P10LE] = {
.name = "yuv420p10le",
.nb_components = 3,
.log2_chroma_w = 1,
@@ -809,7 +1081,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[PIX_FMT_NB] = {
},
.flags = PIX_FMT_PLANAR,
},
- [PIX_FMT_YUV420P10BE] = {
+ [AV_PIX_FMT_YUV420P10BE] = {
.name = "yuv420p10be",
.nb_components = 3,
.log2_chroma_w = 1,
@@ -821,7 +1093,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[PIX_FMT_NB] = {
},
.flags = PIX_FMT_BE | PIX_FMT_PLANAR,
},
- [PIX_FMT_YUV420P16LE] = {
+ [AV_PIX_FMT_YUV420P16LE] = {
.name = "yuv420p16le",
.nb_components = 3,
.log2_chroma_w = 1,
@@ -833,7 +1105,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[PIX_FMT_NB] = {
},
.flags = PIX_FMT_PLANAR,
},
- [PIX_FMT_YUV420P16BE] = {
+ [AV_PIX_FMT_YUV420P16BE] = {
.name = "yuv420p16be",
.nb_components = 3,
.log2_chroma_w = 1,
@@ -845,7 +1117,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[PIX_FMT_NB] = {
},
.flags = PIX_FMT_BE | PIX_FMT_PLANAR,
},
- [PIX_FMT_YUV422P9LE] = {
+ [AV_PIX_FMT_YUV422P9LE] = {
.name = "yuv422p9le",
.nb_components = 3,
.log2_chroma_w = 1,
@@ -857,19 +1129,19 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[PIX_FMT_NB] = {
},
.flags = PIX_FMT_PLANAR,
},
- [PIX_FMT_YUV422P9BE] = {
+ [AV_PIX_FMT_YUV422P9BE] = {
.name = "yuv422p9be",
.nb_components = 3,
.log2_chroma_w = 1,
.log2_chroma_h = 0,
.comp = {
- {0,1,1,0,8}, /* Y */
- {1,1,1,0,8}, /* U */
- {2,1,1,0,8}, /* V */
+ { 0, 1, 1, 0, 8 }, /* Y */
+ { 1, 1, 1, 0, 8 }, /* U */
+ { 2, 1, 1, 0, 8 }, /* V */
},
.flags = PIX_FMT_BE | PIX_FMT_PLANAR,
},
- [PIX_FMT_YUV422P10LE] = {
+ [AV_PIX_FMT_YUV422P10LE] = {
.name = "yuv422p10le",
.nb_components = 3,
.log2_chroma_w = 1,
@@ -881,7 +1153,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[PIX_FMT_NB] = {
},
.flags = PIX_FMT_PLANAR,
},
- [PIX_FMT_YUV422P10BE] = {
+ [AV_PIX_FMT_YUV422P10BE] = {
.name = "yuv422p10be",
.nb_components = 3,
.log2_chroma_w = 1,
@@ -893,7 +1165,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[PIX_FMT_NB] = {
},
.flags = PIX_FMT_BE | PIX_FMT_PLANAR,
},
- [PIX_FMT_YUV422P16LE] = {
+ [AV_PIX_FMT_YUV422P16LE] = {
.name = "yuv422p16le",
.nb_components = 3,
.log2_chroma_w = 1,
@@ -905,7 +1177,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[PIX_FMT_NB] = {
},
.flags = PIX_FMT_PLANAR,
},
- [PIX_FMT_YUV422P16BE] = {
+ [AV_PIX_FMT_YUV422P16BE] = {
.name = "yuv422p16be",
.nb_components = 3,
.log2_chroma_w = 1,
@@ -917,7 +1189,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[PIX_FMT_NB] = {
},
.flags = PIX_FMT_BE | PIX_FMT_PLANAR,
},
- [PIX_FMT_YUV444P16LE] = {
+ [AV_PIX_FMT_YUV444P16LE] = {
.name = "yuv444p16le",
.nb_components = 3,
.log2_chroma_w = 0,
@@ -929,7 +1201,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[PIX_FMT_NB] = {
},
.flags = PIX_FMT_PLANAR,
},
- [PIX_FMT_YUV444P16BE] = {
+ [AV_PIX_FMT_YUV444P16BE] = {
.name = "yuv444p16be",
.nb_components = 3,
.log2_chroma_w = 0,
@@ -941,7 +1213,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[PIX_FMT_NB] = {
},
.flags = PIX_FMT_BE | PIX_FMT_PLANAR,
},
- [PIX_FMT_YUV444P10LE] = {
+ [AV_PIX_FMT_YUV444P10LE] = {
.name = "yuv444p10le",
.nb_components = 3,
.log2_chroma_w = 0,
@@ -953,7 +1225,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[PIX_FMT_NB] = {
},
.flags = PIX_FMT_PLANAR,
},
- [PIX_FMT_YUV444P10BE] = {
+ [AV_PIX_FMT_YUV444P10BE] = {
.name = "yuv444p10be",
.nb_components = 3,
.log2_chroma_w = 0,
@@ -965,7 +1237,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[PIX_FMT_NB] = {
},
.flags = PIX_FMT_BE | PIX_FMT_PLANAR,
},
- [PIX_FMT_YUV444P9LE] = {
+ [AV_PIX_FMT_YUV444P9LE] = {
.name = "yuv444p9le",
.nb_components = 3,
.log2_chroma_w = 0,
@@ -977,7 +1249,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[PIX_FMT_NB] = {
},
.flags = PIX_FMT_PLANAR,
},
- [PIX_FMT_YUV444P9BE] = {
+ [AV_PIX_FMT_YUV444P9BE] = {
.name = "yuv444p9be",
.nb_components = 3,
.log2_chroma_w = 0,
@@ -989,21 +1261,22 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[PIX_FMT_NB] = {
},
.flags = PIX_FMT_BE | PIX_FMT_PLANAR,
},
- [PIX_FMT_DXVA2_VLD] = {
+ [AV_PIX_FMT_DXVA2_VLD] = {
.name = "dxva2_vld",
.log2_chroma_w = 1,
.log2_chroma_h = 1,
.flags = PIX_FMT_HWACCEL,
},
- [PIX_FMT_Y400A] = {
+ [AV_PIX_FMT_Y400A] = {
.name = "y400a",
.nb_components = 2,
.comp = {
{ 0, 1, 1, 0, 7 }, /* Y */
{ 0, 1, 2, 0, 7 }, /* A */
},
+ .flags = PIX_FMT_ALPHA,
},
- [PIX_FMT_GBRP] = {
+ [AV_PIX_FMT_GBRP] = {
.name = "gbrp",
.nb_components = 3,
.log2_chroma_w = 0,
@@ -1015,7 +1288,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[PIX_FMT_NB] = {
},
.flags = PIX_FMT_PLANAR | PIX_FMT_RGB,
},
- [PIX_FMT_GBRP9LE] = {
+ [AV_PIX_FMT_GBRP9LE] = {
.name = "gbrp9le",
.nb_components = 3,
.log2_chroma_w = 0,
@@ -1027,7 +1300,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[PIX_FMT_NB] = {
},
.flags = PIX_FMT_PLANAR | PIX_FMT_RGB,
},
- [PIX_FMT_GBRP9BE] = {
+ [AV_PIX_FMT_GBRP9BE] = {
.name = "gbrp9be",
.nb_components = 3,
.log2_chroma_w = 0,
@@ -1039,7 +1312,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[PIX_FMT_NB] = {
},
.flags = PIX_FMT_BE | PIX_FMT_PLANAR | PIX_FMT_RGB,
},
- [PIX_FMT_GBRP10LE] = {
+ [AV_PIX_FMT_GBRP10LE] = {
.name = "gbrp10le",
.nb_components = 3,
.log2_chroma_w = 0,
@@ -1051,7 +1324,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[PIX_FMT_NB] = {
},
.flags = PIX_FMT_PLANAR | PIX_FMT_RGB,
},
- [PIX_FMT_GBRP10BE] = {
+ [AV_PIX_FMT_GBRP10BE] = {
.name = "gbrp10be",
.nb_components = 3,
.log2_chroma_w = 0,
@@ -1063,7 +1336,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[PIX_FMT_NB] = {
},
.flags = PIX_FMT_BE | PIX_FMT_PLANAR | PIX_FMT_RGB,
},
- [PIX_FMT_GBRP16LE] = {
+ [AV_PIX_FMT_GBRP16LE] = {
.name = "gbrp16le",
.nb_components = 3,
.log2_chroma_w = 0,
@@ -1075,7 +1348,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[PIX_FMT_NB] = {
},
.flags = PIX_FMT_PLANAR | PIX_FMT_RGB,
},
- [PIX_FMT_GBRP16BE] = {
+ [AV_PIX_FMT_GBRP16BE] = {
.name = "gbrp16be",
.nb_components = 3,
.log2_chroma_w = 0,
@@ -1089,21 +1362,21 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[PIX_FMT_NB] = {
},
};
-static enum PixelFormat get_pix_fmt_internal(const char *name)
+static enum AVPixelFormat get_pix_fmt_internal(const char *name)
{
- enum PixelFormat pix_fmt;
+ enum AVPixelFormat pix_fmt;
- for (pix_fmt = 0; pix_fmt < PIX_FMT_NB; pix_fmt++)
+ for (pix_fmt = 0; pix_fmt < AV_PIX_FMT_NB; pix_fmt++)
if (av_pix_fmt_descriptors[pix_fmt].name &&
!strcmp(av_pix_fmt_descriptors[pix_fmt].name, name))
return pix_fmt;
- return PIX_FMT_NONE;
+ return AV_PIX_FMT_NONE;
}
-const char *av_get_pix_fmt_name(enum PixelFormat pix_fmt)
+const char *av_get_pix_fmt_name(enum AVPixelFormat pix_fmt)
{
- return (unsigned)pix_fmt < PIX_FMT_NB ?
+ return (unsigned)pix_fmt < AV_PIX_FMT_NB ?
av_pix_fmt_descriptors[pix_fmt].name : NULL;
}
@@ -1113,9 +1386,9 @@ const char *av_get_pix_fmt_name(enum PixelFormat pix_fmt)
# define X_NE(be, le) le
#endif
-enum PixelFormat av_get_pix_fmt(const char *name)
+enum AVPixelFormat av_get_pix_fmt(const char *name)
{
- enum PixelFormat pix_fmt;
+ enum AVPixelFormat pix_fmt;
if (!strcmp(name, "rgb32"))
name = X_NE("argb", "bgra");
@@ -1123,7 +1396,7 @@ enum PixelFormat av_get_pix_fmt(const char *name)
name = X_NE("abgr", "rgba");
pix_fmt = get_pix_fmt_internal(name);
- if (pix_fmt == PIX_FMT_NONE) {
+ if (pix_fmt == AV_PIX_FMT_NONE) {
char name2[32];
snprintf(name2, sizeof(name2), "%s%s", name, X_NE("be", "le"));
@@ -1145,7 +1418,7 @@ int av_get_bits_per_pixel(const AVPixFmtDescriptor *pixdesc)
return bits >> log2_pixels;
}
-char *av_get_pix_fmt_string (char *buf, int buf_size, enum PixelFormat pix_fmt)
+char *av_get_pix_fmt_string (char *buf, int buf_size, enum AVPixelFormat pix_fmt)
{
/* print header */
if (pix_fmt < 0) {
@@ -1158,3 +1431,40 @@ char *av_get_pix_fmt_string (char *buf, int buf_size, enum PixelFormat pix_fmt)
return buf;
}
+
+const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
+{
+ if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB)
+ return NULL;
+ return &av_pix_fmt_descriptors[pix_fmt];
+}
+
+const AVPixFmtDescriptor *av_pix_fmt_desc_next(const AVPixFmtDescriptor *prev)
+{
+ if (!prev)
+ return &av_pix_fmt_descriptors[0];
+ if (prev - av_pix_fmt_descriptors < FF_ARRAY_ELEMS(av_pix_fmt_descriptors) - 1)
+ return prev + 1;
+ return NULL;
+}
+
+enum AVPixelFormat av_pix_fmt_desc_get_id(const AVPixFmtDescriptor *desc)
+{
+ if (desc < av_pix_fmt_descriptors ||
+ desc >= av_pix_fmt_descriptors + FF_ARRAY_ELEMS(av_pix_fmt_descriptors))
+ return AV_PIX_FMT_NONE;
+
+ return desc - av_pix_fmt_descriptors;
+}
+
+int av_pix_fmt_get_chroma_sub_sample(enum AVPixelFormat pix_fmt,
+ int *h_shift, int *v_shift)
+{
+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
+ if (!desc)
+ return AVERROR(ENOSYS);
+ *h_shift = desc->log2_chroma_w;
+ *v_shift = desc->log2_chroma_h;
+
+ return 0;
+}
diff --git a/gst-libs/ext/libav/libavutil/pixdesc.h b/gst-libs/ext/libav/libavutil/pixdesc.h
index b5972c7..47e6bb8 100644
--- a/gst-libs/ext/libav/libavutil/pixdesc.h
+++ b/gst-libs/ext/libav/libavutil/pixdesc.h
@@ -89,11 +89,22 @@ typedef struct AVPixFmtDescriptor{
#define PIX_FMT_HWACCEL 8 ///< Pixel format is an HW accelerated format.
#define PIX_FMT_PLANAR 16 ///< At least one pixel component is not in the first data plane
#define PIX_FMT_RGB 32 ///< The pixel format contains RGB-like data (as opposed to YUV/grayscale)
+/**
+ * The pixel format is "pseudo-paletted". This means that Libav treats it as
+ * paletted internally, but the palette is generated by the decoder and is not
+ * stored in the file.
+ */
+#define PIX_FMT_PSEUDOPAL 64
+
+#define PIX_FMT_ALPHA 128 ///< The pixel format has an alpha channel
+
+#if FF_API_PIX_FMT_DESC
/**
* The array of all the pixel format descriptors.
*/
extern const AVPixFmtDescriptor av_pix_fmt_descriptors[];
+#endif
/**
* Read a line from an image, and write the values of the
@@ -142,7 +153,7 @@ void av_write_image_line(const uint16_t *src, uint8_t *data[4], const int linesi
*
* Finally if no pixel format has been found, returns PIX_FMT_NONE.
*/
-enum PixelFormat av_get_pix_fmt(const char *name);
+enum AVPixelFormat av_get_pix_fmt(const char *name);
/**
* Return the short name for a pixel format, NULL in case pix_fmt is
@@ -150,7 +161,7 @@ enum PixelFormat av_get_pix_fmt(const char *name);
*
* @see av_get_pix_fmt(), av_get_pix_fmt_string()
*/
-const char *av_get_pix_fmt_name(enum PixelFormat pix_fmt);
+const char *av_get_pix_fmt_name(enum AVPixelFormat pix_fmt);
/**
* Print in buf the string corresponding to the pixel format with
@@ -162,7 +173,7 @@ const char *av_get_pix_fmt_name(enum PixelFormat pix_fmt);
* corresponding info string, or a negative value to print the
* corresponding header.
*/
-char *av_get_pix_fmt_string (char *buf, int buf_size, enum PixelFormat pix_fmt);
+char *av_get_pix_fmt_string (char *buf, int buf_size, enum AVPixelFormat pix_fmt);
/**
* Return the number of bits per pixel used by the pixel format
@@ -174,4 +185,39 @@ char *av_get_pix_fmt_string (char *buf, int buf_size, enum PixelFormat pix_fmt);
*/
int av_get_bits_per_pixel(const AVPixFmtDescriptor *pixdesc);
+/**
+ * @return a pixel format descriptor for provided pixel format or NULL if
+ * this pixel format is unknown.
+ */
+const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt);
+
+/**
+ * Iterate over all pixel format descriptors known to libavutil.
+ *
+ * @param prev previous descriptor. NULL to get the first descriptor.
+ *
+ * @return next descriptor or NULL after the last descriptor
+ */
+const AVPixFmtDescriptor *av_pix_fmt_desc_next(const AVPixFmtDescriptor *prev);
+
+/**
+ * @return an AVPixelFormat id described by desc, or AV_PIX_FMT_NONE if desc
+ * is not a valid pointer to a pixel format descriptor.
+ */
+enum AVPixelFormat av_pix_fmt_desc_get_id(const AVPixFmtDescriptor *desc);
+
+/**
+ * Utility function to access log2_chroma_w log2_chroma_h from
+ * the pixel format AVPixFmtDescriptor.
+ *
+ * @param[in] pix_fmt the pixel format
+ * @param[out] h_shift store log2_chroma_h
+ * @param[out] v_shift store log2_chroma_w
+ *
+ * @return 0 on success, AVERROR(ENOSYS) on invalid or unknown pixel format
+ */
+int av_pix_fmt_get_chroma_sub_sample(enum AVPixelFormat pix_fmt,
+ int *h_shift, int *v_shift);
+
+
#endif /* AVUTIL_PIXDESC_H */
diff --git a/gst-libs/ext/libav/libavutil/pixfmt.h b/gst-libs/ext/libav/libavutil/pixfmt.h
index bd898bd..1072f00 100644
--- a/gst-libs/ext/libav/libavutil/pixfmt.h
+++ b/gst-libs/ext/libav/libavutil/pixfmt.h
@@ -28,6 +28,7 @@
*/
#include "libavutil/avconfig.h"
+#include "libavutil/version.h"
/**
* Pixel format.
@@ -55,144 +56,213 @@
* allocating the picture.
*
* @note
- * make sure that all newly added big endian formats have pix_fmt&1==1
- * and that all newly added little endian formats have pix_fmt&1==0
- * this allows simpler detection of big vs little endian.
+ * Make sure that all newly added big-endian formats have pix_fmt & 1 == 1
+ * and that all newly added little-endian formats have pix_fmt & 1 == 0.
+ * This allows simpler detection of big vs little-endian.
*/
-enum PixelFormat {
- PIX_FMT_NONE= -1,
- PIX_FMT_YUV420P, ///< planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
- PIX_FMT_YUYV422, ///< packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr
- PIX_FMT_RGB24, ///< packed RGB 8:8:8, 24bpp, RGBRGB...
- PIX_FMT_BGR24, ///< packed RGB 8:8:8, 24bpp, BGRBGR...
- PIX_FMT_YUV422P, ///< planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
- PIX_FMT_YUV444P, ///< planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
- PIX_FMT_YUV410P, ///< planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
- PIX_FMT_YUV411P, ///< planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
- PIX_FMT_GRAY8, ///< Y , 8bpp
- PIX_FMT_MONOWHITE, ///< Y , 1bpp, 0 is white, 1 is black, in each byte pixels are ordered from the msb to the lsb
- PIX_FMT_MONOBLACK, ///< Y , 1bpp, 0 is black, 1 is white, in each byte pixels are ordered from the msb to the lsb
- PIX_FMT_PAL8, ///< 8 bit with PIX_FMT_RGB32 palette
- PIX_FMT_YUVJ420P, ///< planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV420P and setting color_range
- PIX_FMT_YUVJ422P, ///< planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV422P and setting color_range
- PIX_FMT_YUVJ444P, ///< planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV444P and setting color_range
- PIX_FMT_XVMC_MPEG2_MC,///< XVideo Motion Acceleration via common packet passing
- PIX_FMT_XVMC_MPEG2_IDCT,
- PIX_FMT_UYVY422, ///< packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1
- PIX_FMT_UYYVYY411, ///< packed YUV 4:1:1, 12bpp, Cb Y0 Y1 Cr Y2 Y3
- PIX_FMT_BGR8, ///< packed RGB 3:3:2, 8bpp, (msb)2B 3G 3R(lsb)
- PIX_FMT_BGR4, ///< packed RGB 1:2:1 bitstream, 4bpp, (msb)1B 2G 1R(lsb), a byte contains two pixels, the first pixel in the byte is the one composed by the 4 msb bits
- PIX_FMT_BGR4_BYTE, ///< packed RGB 1:2:1, 8bpp, (msb)1B 2G 1R(lsb)
- PIX_FMT_RGB8, ///< packed RGB 3:3:2, 8bpp, (msb)2R 3G 3B(lsb)
- PIX_FMT_RGB4, ///< packed RGB 1:2:1 bitstream, 4bpp, (msb)1R 2G 1B(lsb), a byte contains two pixels, the first pixel in the byte is the one composed by the 4 msb bits
- PIX_FMT_RGB4_BYTE, ///< packed RGB 1:2:1, 8bpp, (msb)1R 2G 1B(lsb)
- PIX_FMT_NV12, ///< planar YUV 4:2:0, 12bpp, 1 plane for Y and 1 plane for the UV components, which are interleaved (first byte U and the following byte V)
- PIX_FMT_NV21, ///< as above, but U and V bytes are swapped
-
- PIX_FMT_ARGB, ///< packed ARGB 8:8:8:8, 32bpp, ARGBARGB...
- PIX_FMT_RGBA, ///< packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
- PIX_FMT_ABGR, ///< packed ABGR 8:8:8:8, 32bpp, ABGRABGR...
- PIX_FMT_BGRA, ///< packed BGRA 8:8:8:8, 32bpp, BGRABGRA...
-
- PIX_FMT_GRAY16BE, ///< Y , 16bpp, big-endian
- PIX_FMT_GRAY16LE, ///< Y , 16bpp, little-endian
- PIX_FMT_YUV440P, ///< planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
- PIX_FMT_YUVJ440P, ///< planar YUV 4:4:0 full scale (JPEG), deprecated in favor of PIX_FMT_YUV440P and setting color_range
- PIX_FMT_YUVA420P, ///< planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples)
- PIX_FMT_VDPAU_H264,///< H.264 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers
- PIX_FMT_VDPAU_MPEG1,///< MPEG-1 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers
- PIX_FMT_VDPAU_MPEG2,///< MPEG-2 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers
- PIX_FMT_VDPAU_WMV3,///< WMV3 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers
- PIX_FMT_VDPAU_VC1, ///< VC-1 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers
- PIX_FMT_RGB48BE, ///< packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, the 2-byte value for each R/G/B component is stored as big-endian
- PIX_FMT_RGB48LE, ///< packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, the 2-byte value for each R/G/B component is stored as little-endian
-
- PIX_FMT_RGB565BE, ///< packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), big-endian
- PIX_FMT_RGB565LE, ///< packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), little-endian
- PIX_FMT_RGB555BE, ///< packed RGB 5:5:5, 16bpp, (msb)1A 5R 5G 5B(lsb), big-endian, most significant bit to 0
- PIX_FMT_RGB555LE, ///< packed RGB 5:5:5, 16bpp, (msb)1A 5R 5G 5B(lsb), little-endian, most significant bit to 0
-
- PIX_FMT_BGR565BE, ///< packed BGR 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), big-endian
- PIX_FMT_BGR565LE, ///< packed BGR 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), little-endian
- PIX_FMT_BGR555BE, ///< packed BGR 5:5:5, 16bpp, (msb)1A 5B 5G 5R(lsb), big-endian, most significant bit to 1
- PIX_FMT_BGR555LE, ///< packed BGR 5:5:5, 16bpp, (msb)1A 5B 5G 5R(lsb), little-endian, most significant bit to 1
-
- PIX_FMT_VAAPI_MOCO, ///< HW acceleration through VA API at motion compensation entry-point, Picture.data[3] contains a vaapi_render_state struct which contains macroblocks as well as various fields extracted from headers
- PIX_FMT_VAAPI_IDCT, ///< HW acceleration through VA API at IDCT entry-point, Picture.data[3] contains a vaapi_render_state struct which contains fields extracted from headers
- PIX_FMT_VAAPI_VLD, ///< HW decoding through VA API, Picture.data[3] contains a vaapi_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers
-
- PIX_FMT_YUV420P16LE, ///< planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
- PIX_FMT_YUV420P16BE, ///< planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
- PIX_FMT_YUV422P16LE, ///< planar YUV 4:2:2, 32bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
- PIX_FMT_YUV422P16BE, ///< planar YUV 4:2:2, 32bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
- PIX_FMT_YUV444P16LE, ///< planar YUV 4:4:4, 48bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
- PIX_FMT_YUV444P16BE, ///< planar YUV 4:4:4, 48bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
- PIX_FMT_VDPAU_MPEG4, ///< MPEG4 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers
- PIX_FMT_DXVA2_VLD, ///< HW decoding through DXVA2, Picture.data[3] contains a LPDIRECT3DSURFACE9 pointer
-
- PIX_FMT_RGB444LE, ///< packed RGB 4:4:4, 16bpp, (msb)4A 4R 4G 4B(lsb), little-endian, most significant bits to 0
- PIX_FMT_RGB444BE, ///< packed RGB 4:4:4, 16bpp, (msb)4A 4R 4G 4B(lsb), big-endian, most significant bits to 0
- PIX_FMT_BGR444LE, ///< packed BGR 4:4:4, 16bpp, (msb)4A 4B 4G 4R(lsb), little-endian, most significant bits to 1
- PIX_FMT_BGR444BE, ///< packed BGR 4:4:4, 16bpp, (msb)4A 4B 4G 4R(lsb), big-endian, most significant bits to 1
- PIX_FMT_Y400A, ///< 8bit gray, 8bit alpha
- PIX_FMT_BGR48BE, ///< packed RGB 16:16:16, 48bpp, 16B, 16G, 16R, the 2-byte value for each R/G/B component is stored as big-endian
- PIX_FMT_BGR48LE, ///< packed RGB 16:16:16, 48bpp, 16B, 16G, 16R, the 2-byte value for each R/G/B component is stored as little-endian
- PIX_FMT_YUV420P9BE, ///< planar YUV 4:2:0, 13.5bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
- PIX_FMT_YUV420P9LE, ///< planar YUV 4:2:0, 13.5bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
- PIX_FMT_YUV420P10BE,///< planar YUV 4:2:0, 15bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
- PIX_FMT_YUV420P10LE,///< planar YUV 4:2:0, 15bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
- PIX_FMT_YUV422P10BE,///< planar YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
- PIX_FMT_YUV422P10LE,///< planar YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
- PIX_FMT_YUV444P9BE, ///< planar YUV 4:4:4, 27bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
- PIX_FMT_YUV444P9LE, ///< planar YUV 4:4:4, 27bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
- PIX_FMT_YUV444P10BE,///< planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
- PIX_FMT_YUV444P10LE,///< planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
- PIX_FMT_YUV422P9BE, ///< planar YUV 4:2:2, 18bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
- PIX_FMT_YUV422P9LE, ///< planar YUV 4:2:2, 18bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
- PIX_FMT_VDA_VLD, ///< hardware decoding through VDA
- PIX_FMT_GBRP, ///< planar GBR 4:4:4 24bpp
- PIX_FMT_GBRP9BE, ///< planar GBR 4:4:4 27bpp, big endian
- PIX_FMT_GBRP9LE, ///< planar GBR 4:4:4 27bpp, little endian
- PIX_FMT_GBRP10BE, ///< planar GBR 4:4:4 30bpp, big endian
- PIX_FMT_GBRP10LE, ///< planar GBR 4:4:4 30bpp, little endian
- PIX_FMT_GBRP16BE, ///< planar GBR 4:4:4 48bpp, big endian
- PIX_FMT_GBRP16LE, ///< planar GBR 4:4:4 48bpp, little endian
- PIX_FMT_NB, ///< number of pixel formats, DO NOT USE THIS if you want to link with shared libav* because the number of formats might differ between versions
+enum AVPixelFormat {
+ AV_PIX_FMT_NONE = -1,
+ AV_PIX_FMT_YUV420P, ///< planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
+ AV_PIX_FMT_YUYV422, ///< packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr
+ AV_PIX_FMT_RGB24, ///< packed RGB 8:8:8, 24bpp, RGBRGB...
+ AV_PIX_FMT_BGR24, ///< packed RGB 8:8:8, 24bpp, BGRBGR...
+ AV_PIX_FMT_YUV422P, ///< planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
+ AV_PIX_FMT_YUV444P, ///< planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
+ AV_PIX_FMT_YUV410P, ///< planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
+ AV_PIX_FMT_YUV411P, ///< planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
+ AV_PIX_FMT_GRAY8, ///< Y , 8bpp
+ AV_PIX_FMT_MONOWHITE, ///< Y , 1bpp, 0 is white, 1 is black, in each byte pixels are ordered from the msb to the lsb
+ AV_PIX_FMT_MONOBLACK, ///< Y , 1bpp, 0 is black, 1 is white, in each byte pixels are ordered from the msb to the lsb
+ AV_PIX_FMT_PAL8, ///< 8 bit with PIX_FMT_RGB32 palette
+ AV_PIX_FMT_YUVJ420P, ///< planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV420P and setting color_range
+ AV_PIX_FMT_YUVJ422P, ///< planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV422P and setting color_range
+ AV_PIX_FMT_YUVJ444P, ///< planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV444P and setting color_range
+ AV_PIX_FMT_XVMC_MPEG2_MC,///< XVideo Motion Acceleration via common packet passing
+ AV_PIX_FMT_XVMC_MPEG2_IDCT,
+ AV_PIX_FMT_UYVY422, ///< packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1
+ AV_PIX_FMT_UYYVYY411, ///< packed YUV 4:1:1, 12bpp, Cb Y0 Y1 Cr Y2 Y3
+ AV_PIX_FMT_BGR8, ///< packed RGB 3:3:2, 8bpp, (msb)2B 3G 3R(lsb)
+ AV_PIX_FMT_BGR4, ///< packed RGB 1:2:1 bitstream, 4bpp, (msb)1B 2G 1R(lsb), a byte contains two pixels, the first pixel in the byte is the one composed by the 4 msb bits
+ AV_PIX_FMT_BGR4_BYTE, ///< packed RGB 1:2:1, 8bpp, (msb)1B 2G 1R(lsb)
+ AV_PIX_FMT_RGB8, ///< packed RGB 3:3:2, 8bpp, (msb)2R 3G 3B(lsb)
+ AV_PIX_FMT_RGB4, ///< packed RGB 1:2:1 bitstream, 4bpp, (msb)1R 2G 1B(lsb), a byte contains two pixels, the first pixel in the byte is the one composed by the 4 msb bits
+ AV_PIX_FMT_RGB4_BYTE, ///< packed RGB 1:2:1, 8bpp, (msb)1R 2G 1B(lsb)
+ AV_PIX_FMT_NV12, ///< planar YUV 4:2:0, 12bpp, 1 plane for Y and 1 plane for the UV components, which are interleaved (first byte U and the following byte V)
+ AV_PIX_FMT_NV21, ///< as above, but U and V bytes are swapped
+
+ AV_PIX_FMT_ARGB, ///< packed ARGB 8:8:8:8, 32bpp, ARGBARGB...
+ AV_PIX_FMT_RGBA, ///< packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
+ AV_PIX_FMT_ABGR, ///< packed ABGR 8:8:8:8, 32bpp, ABGRABGR...
+ AV_PIX_FMT_BGRA, ///< packed BGRA 8:8:8:8, 32bpp, BGRABGRA...
+
+ AV_PIX_FMT_GRAY16BE, ///< Y , 16bpp, big-endian
+ AV_PIX_FMT_GRAY16LE, ///< Y , 16bpp, little-endian
+ AV_PIX_FMT_YUV440P, ///< planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
+ AV_PIX_FMT_YUVJ440P, ///< planar YUV 4:4:0 full scale (JPEG), deprecated in favor of PIX_FMT_YUV440P and setting color_range
+ AV_PIX_FMT_YUVA420P, ///< planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples)
+ AV_PIX_FMT_VDPAU_H264,///< H.264 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers
+ AV_PIX_FMT_VDPAU_MPEG1,///< MPEG-1 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers
+ AV_PIX_FMT_VDPAU_MPEG2,///< MPEG-2 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers
+ AV_PIX_FMT_VDPAU_WMV3,///< WMV3 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers
+ AV_PIX_FMT_VDPAU_VC1, ///< VC-1 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers
+ AV_PIX_FMT_RGB48BE, ///< packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, the 2-byte value for each R/G/B component is stored as big-endian
+ AV_PIX_FMT_RGB48LE, ///< packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, the 2-byte value for each R/G/B component is stored as little-endian
+
+ AV_PIX_FMT_RGB565BE, ///< packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), big-endian
+ AV_PIX_FMT_RGB565LE, ///< packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), little-endian
+ AV_PIX_FMT_RGB555BE, ///< packed RGB 5:5:5, 16bpp, (msb)1A 5R 5G 5B(lsb), big-endian, most significant bit to 0
+ AV_PIX_FMT_RGB555LE, ///< packed RGB 5:5:5, 16bpp, (msb)1A 5R 5G 5B(lsb), little-endian, most significant bit to 0
+
+ AV_PIX_FMT_BGR565BE, ///< packed BGR 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), big-endian
+ AV_PIX_FMT_BGR565LE, ///< packed BGR 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), little-endian
+ AV_PIX_FMT_BGR555BE, ///< packed BGR 5:5:5, 16bpp, (msb)1A 5B 5G 5R(lsb), big-endian, most significant bit to 1
+ AV_PIX_FMT_BGR555LE, ///< packed BGR 5:5:5, 16bpp, (msb)1A 5B 5G 5R(lsb), little-endian, most significant bit to 1
+
+ AV_PIX_FMT_VAAPI_MOCO, ///< HW acceleration through VA API at motion compensation entry-point, Picture.data[3] contains a vaapi_render_state struct which contains macroblocks as well as various fields extracted from headers
+ AV_PIX_FMT_VAAPI_IDCT, ///< HW acceleration through VA API at IDCT entry-point, Picture.data[3] contains a vaapi_render_state struct which contains fields extracted from headers
+ AV_PIX_FMT_VAAPI_VLD, ///< HW decoding through VA API, Picture.data[3] contains a vaapi_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers
+
+ AV_PIX_FMT_YUV420P16LE, ///< planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
+ AV_PIX_FMT_YUV420P16BE, ///< planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
+ AV_PIX_FMT_YUV422P16LE, ///< planar YUV 4:2:2, 32bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
+ AV_PIX_FMT_YUV422P16BE, ///< planar YUV 4:2:2, 32bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
+ AV_PIX_FMT_YUV444P16LE, ///< planar YUV 4:4:4, 48bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
+ AV_PIX_FMT_YUV444P16BE, ///< planar YUV 4:4:4, 48bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
+ AV_PIX_FMT_VDPAU_MPEG4, ///< MPEG4 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers
+ AV_PIX_FMT_DXVA2_VLD, ///< HW decoding through DXVA2, Picture.data[3] contains a LPDIRECT3DSURFACE9 pointer
+
+ AV_PIX_FMT_RGB444LE, ///< packed RGB 4:4:4, 16bpp, (msb)4A 4R 4G 4B(lsb), little-endian, most significant bits to 0
+ AV_PIX_FMT_RGB444BE, ///< packed RGB 4:4:4, 16bpp, (msb)4A 4R 4G 4B(lsb), big-endian, most significant bits to 0
+ AV_PIX_FMT_BGR444LE, ///< packed BGR 4:4:4, 16bpp, (msb)4A 4B 4G 4R(lsb), little-endian, most significant bits to 1
+ AV_PIX_FMT_BGR444BE, ///< packed BGR 4:4:4, 16bpp, (msb)4A 4B 4G 4R(lsb), big-endian, most significant bits to 1
+ AV_PIX_FMT_Y400A, ///< 8bit gray, 8bit alpha
+ AV_PIX_FMT_BGR48BE, ///< packed RGB 16:16:16, 48bpp, 16B, 16G, 16R, the 2-byte value for each R/G/B component is stored as big-endian
+ AV_PIX_FMT_BGR48LE, ///< packed RGB 16:16:16, 48bpp, 16B, 16G, 16R, the 2-byte value for each R/G/B component is stored as little-endian
+ AV_PIX_FMT_YUV420P9BE, ///< planar YUV 4:2:0, 13.5bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
+ AV_PIX_FMT_YUV420P9LE, ///< planar YUV 4:2:0, 13.5bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
+ AV_PIX_FMT_YUV420P10BE,///< planar YUV 4:2:0, 15bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
+ AV_PIX_FMT_YUV420P10LE,///< planar YUV 4:2:0, 15bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
+ AV_PIX_FMT_YUV422P10BE,///< planar YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
+ AV_PIX_FMT_YUV422P10LE,///< planar YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
+ AV_PIX_FMT_YUV444P9BE, ///< planar YUV 4:4:4, 27bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
+ AV_PIX_FMT_YUV444P9LE, ///< planar YUV 4:4:4, 27bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
+ AV_PIX_FMT_YUV444P10BE,///< planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
+ AV_PIX_FMT_YUV444P10LE,///< planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
+ AV_PIX_FMT_YUV422P9BE, ///< planar YUV 4:2:2, 18bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
+ AV_PIX_FMT_YUV422P9LE, ///< planar YUV 4:2:2, 18bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
+ AV_PIX_FMT_VDA_VLD, ///< hardware decoding through VDA
+ AV_PIX_FMT_GBRP, ///< planar GBR 4:4:4 24bpp
+ AV_PIX_FMT_GBRP9BE, ///< planar GBR 4:4:4 27bpp, big-endian
+ AV_PIX_FMT_GBRP9LE, ///< planar GBR 4:4:4 27bpp, little-endian
+ AV_PIX_FMT_GBRP10BE, ///< planar GBR 4:4:4 30bpp, big-endian
+ AV_PIX_FMT_GBRP10LE, ///< planar GBR 4:4:4 30bpp, little-endian
+ AV_PIX_FMT_GBRP16BE, ///< planar GBR 4:4:4 48bpp, big-endian
+ AV_PIX_FMT_GBRP16LE, ///< planar GBR 4:4:4 48bpp, little-endian
+ AV_PIX_FMT_YUVA422P, ///< planar YUV 4:2:2 24bpp, (1 Cr & Cb sample per 2x1 Y & A samples)
+ AV_PIX_FMT_YUVA444P, ///< planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples)
+ AV_PIX_FMT_YUVA420P9BE, ///< planar YUV 4:2:0 22.5bpp, (1 Cr & Cb sample per 2x2 Y & A samples), big-endian
+ AV_PIX_FMT_YUVA420P9LE, ///< planar YUV 4:2:0 22.5bpp, (1 Cr & Cb sample per 2x2 Y & A samples), little-endian
+ AV_PIX_FMT_YUVA422P9BE, ///< planar YUV 4:2:2 27bpp, (1 Cr & Cb sample per 2x1 Y & A samples), big-endian
+ AV_PIX_FMT_YUVA422P9LE, ///< planar YUV 4:2:2 27bpp, (1 Cr & Cb sample per 2x1 Y & A samples), little-endian
+ AV_PIX_FMT_YUVA444P9BE, ///< planar YUV 4:4:4 36bpp, (1 Cr & Cb sample per 1x1 Y & A samples), big-endian
+ AV_PIX_FMT_YUVA444P9LE, ///< planar YUV 4:4:4 36bpp, (1 Cr & Cb sample per 1x1 Y & A samples), little-endian
+ AV_PIX_FMT_YUVA420P10BE, ///< planar YUV 4:2:0 25bpp, (1 Cr & Cb sample per 2x2 Y & A samples, big-endian)
+ AV_PIX_FMT_YUVA420P10LE, ///< planar YUV 4:2:0 25bpp, (1 Cr & Cb sample per 2x2 Y & A samples, little-endian)
+ AV_PIX_FMT_YUVA422P10BE, ///< planar YUV 4:2:2 30bpp, (1 Cr & Cb sample per 2x1 Y & A samples, big-endian)
+ AV_PIX_FMT_YUVA422P10LE, ///< planar YUV 4:2:2 30bpp, (1 Cr & Cb sample per 2x1 Y & A samples, little-endian)
+ AV_PIX_FMT_YUVA444P10BE, ///< planar YUV 4:4:4 40bpp, (1 Cr & Cb sample per 1x1 Y & A samples, big-endian)
+ AV_PIX_FMT_YUVA444P10LE, ///< planar YUV 4:4:4 40bpp, (1 Cr & Cb sample per 1x1 Y & A samples, little-endian)
+ AV_PIX_FMT_YUVA420P16BE, ///< planar YUV 4:2:0 40bpp, (1 Cr & Cb sample per 2x2 Y & A samples, big-endian)
+ AV_PIX_FMT_YUVA420P16LE, ///< planar YUV 4:2:0 40bpp, (1 Cr & Cb sample per 2x2 Y & A samples, little-endian)
+ AV_PIX_FMT_YUVA422P16BE, ///< planar YUV 4:2:2 48bpp, (1 Cr & Cb sample per 2x1 Y & A samples, big-endian)
+ AV_PIX_FMT_YUVA422P16LE, ///< planar YUV 4:2:2 48bpp, (1 Cr & Cb sample per 2x1 Y & A samples, little-endian)
+ AV_PIX_FMT_YUVA444P16BE, ///< planar YUV 4:4:4 64bpp, (1 Cr & Cb sample per 1x1 Y & A samples, big-endian)
+ AV_PIX_FMT_YUVA444P16LE, ///< planar YUV 4:4:4 64bpp, (1 Cr & Cb sample per 1x1 Y & A samples, little-endian)
+ AV_PIX_FMT_NB, ///< number of pixel formats, DO NOT USE THIS if you want to link with shared libav* because the number of formats might differ between versions
+
+#if FF_API_PIX_FMT
+#include "old_pix_fmts.h"
+#endif
};
#if AV_HAVE_BIGENDIAN
-# define PIX_FMT_NE(be, le) PIX_FMT_##be
+# define AV_PIX_FMT_NE(be, le) AV_PIX_FMT_##be
#else
-# define PIX_FMT_NE(be, le) PIX_FMT_##le
+# define AV_PIX_FMT_NE(be, le) AV_PIX_FMT_##le
#endif
-#define PIX_FMT_RGB32 PIX_FMT_NE(ARGB, BGRA)
-#define PIX_FMT_RGB32_1 PIX_FMT_NE(RGBA, ABGR)
-#define PIX_FMT_BGR32 PIX_FMT_NE(ABGR, RGBA)
-#define PIX_FMT_BGR32_1 PIX_FMT_NE(BGRA, ARGB)
-
-#define PIX_FMT_GRAY16 PIX_FMT_NE(GRAY16BE, GRAY16LE)
-#define PIX_FMT_RGB48 PIX_FMT_NE(RGB48BE, RGB48LE)
-#define PIX_FMT_RGB565 PIX_FMT_NE(RGB565BE, RGB565LE)
-#define PIX_FMT_RGB555 PIX_FMT_NE(RGB555BE, RGB555LE)
-#define PIX_FMT_RGB444 PIX_FMT_NE(RGB444BE, RGB444LE)
-#define PIX_FMT_BGR48 PIX_FMT_NE(BGR48BE, BGR48LE)
-#define PIX_FMT_BGR565 PIX_FMT_NE(BGR565BE, BGR565LE)
-#define PIX_FMT_BGR555 PIX_FMT_NE(BGR555BE, BGR555LE)
-#define PIX_FMT_BGR444 PIX_FMT_NE(BGR444BE, BGR444LE)
-
-#define PIX_FMT_YUV420P9 PIX_FMT_NE(YUV420P9BE , YUV420P9LE)
-#define PIX_FMT_YUV422P9 PIX_FMT_NE(YUV422P9BE , YUV422P9LE)
-#define PIX_FMT_YUV444P9 PIX_FMT_NE(YUV444P9BE , YUV444P9LE)
-#define PIX_FMT_YUV420P10 PIX_FMT_NE(YUV420P10BE, YUV420P10LE)
-#define PIX_FMT_YUV422P10 PIX_FMT_NE(YUV422P10BE, YUV422P10LE)
-#define PIX_FMT_YUV444P10 PIX_FMT_NE(YUV444P10BE, YUV444P10LE)
-#define PIX_FMT_YUV420P16 PIX_FMT_NE(YUV420P16BE, YUV420P16LE)
-#define PIX_FMT_YUV422P16 PIX_FMT_NE(YUV422P16BE, YUV422P16LE)
-#define PIX_FMT_YUV444P16 PIX_FMT_NE(YUV444P16BE, YUV444P16LE)
-
-#define PIX_FMT_GBRP9 PIX_FMT_NE(GBRP9BE , GBRP9LE)
-#define PIX_FMT_GBRP10 PIX_FMT_NE(GBRP10BE, GBRP10LE)
-#define PIX_FMT_GBRP16 PIX_FMT_NE(GBRP16BE, GBRP16LE)
+#define AV_PIX_FMT_RGB32 AV_PIX_FMT_NE(ARGB, BGRA)
+#define AV_PIX_FMT_RGB32_1 AV_PIX_FMT_NE(RGBA, ABGR)
+#define AV_PIX_FMT_BGR32 AV_PIX_FMT_NE(ABGR, RGBA)
+#define AV_PIX_FMT_BGR32_1 AV_PIX_FMT_NE(BGRA, ARGB)
+
+#define AV_PIX_FMT_GRAY16 AV_PIX_FMT_NE(GRAY16BE, GRAY16LE)
+#define AV_PIX_FMT_RGB48 AV_PIX_FMT_NE(RGB48BE, RGB48LE)
+#define AV_PIX_FMT_RGB565 AV_PIX_FMT_NE(RGB565BE, RGB565LE)
+#define AV_PIX_FMT_RGB555 AV_PIX_FMT_NE(RGB555BE, RGB555LE)
+#define AV_PIX_FMT_RGB444 AV_PIX_FMT_NE(RGB444BE, RGB444LE)
+#define AV_PIX_FMT_BGR48 AV_PIX_FMT_NE(BGR48BE, BGR48LE)
+#define AV_PIX_FMT_BGR565 AV_PIX_FMT_NE(BGR565BE, BGR565LE)
+#define AV_PIX_FMT_BGR555 AV_PIX_FMT_NE(BGR555BE, BGR555LE)
+#define AV_PIX_FMT_BGR444 AV_PIX_FMT_NE(BGR444BE, BGR444LE)
+
+#define AV_PIX_FMT_YUV420P9 AV_PIX_FMT_NE(YUV420P9BE , YUV420P9LE)
+#define AV_PIX_FMT_YUV422P9 AV_PIX_FMT_NE(YUV422P9BE , YUV422P9LE)
+#define AV_PIX_FMT_YUV444P9 AV_PIX_FMT_NE(YUV444P9BE , YUV444P9LE)
+#define AV_PIX_FMT_YUV420P10 AV_PIX_FMT_NE(YUV420P10BE, YUV420P10LE)
+#define AV_PIX_FMT_YUV422P10 AV_PIX_FMT_NE(YUV422P10BE, YUV422P10LE)
+#define AV_PIX_FMT_YUV444P10 AV_PIX_FMT_NE(YUV444P10BE, YUV444P10LE)
+#define AV_PIX_FMT_YUV420P16 AV_PIX_FMT_NE(YUV420P16BE, YUV420P16LE)
+#define AV_PIX_FMT_YUV422P16 AV_PIX_FMT_NE(YUV422P16BE, YUV422P16LE)
+#define AV_PIX_FMT_YUV444P16 AV_PIX_FMT_NE(YUV444P16BE, YUV444P16LE)
+
+#define AV_PIX_FMT_GBRP9 AV_PIX_FMT_NE(GBRP9BE , GBRP9LE)
+#define AV_PIX_FMT_GBRP10 AV_PIX_FMT_NE(GBRP10BE, GBRP10LE)
+#define AV_PIX_FMT_GBRP16 AV_PIX_FMT_NE(GBRP16BE, GBRP16LE)
+
+#define AV_PIX_FMT_YUVA420P9 AV_PIX_FMT_NE(YUVA420P9BE , YUVA420P9LE)
+#define AV_PIX_FMT_YUVA422P9 AV_PIX_FMT_NE(YUVA422P9BE , YUVA422P9LE)
+#define AV_PIX_FMT_YUVA444P9 AV_PIX_FMT_NE(YUVA444P9BE , YUVA444P9LE)
+#define AV_PIX_FMT_YUVA420P10 AV_PIX_FMT_NE(YUVA420P10BE, YUVA420P10LE)
+#define AV_PIX_FMT_YUVA422P10 AV_PIX_FMT_NE(YUVA422P10BE, YUVA422P10LE)
+#define AV_PIX_FMT_YUVA444P10 AV_PIX_FMT_NE(YUVA444P10BE, YUVA444P10LE)
+#define AV_PIX_FMT_YUVA420P16 AV_PIX_FMT_NE(YUVA420P16BE, YUVA420P16LE)
+#define AV_PIX_FMT_YUVA422P16 AV_PIX_FMT_NE(YUVA422P16BE, YUVA422P16LE)
+#define AV_PIX_FMT_YUVA444P16 AV_PIX_FMT_NE(YUVA444P16BE, YUVA444P16LE)
+
+#if FF_API_PIX_FMT
+#define PixelFormat AVPixelFormat
+
+#define PIX_FMT_NE(be, le) AV_PIX_FMT_NE(be, le)
+
+#define PIX_FMT_RGB32 AV_PIX_FMT_RGB32
+#define PIX_FMT_RGB32_1 AV_PIX_FMT_RGB32_1
+#define PIX_FMT_BGR32 AV_PIX_FMT_BGR32
+#define PIX_FMT_BGR32_1 AV_PIX_FMT_BGR32_1
+
+#define PIX_FMT_GRAY16 AV_PIX_FMT_GRAY16
+#define PIX_FMT_RGB48 AV_PIX_FMT_RGB48
+#define PIX_FMT_RGB565 AV_PIX_FMT_RGB565
+#define PIX_FMT_RGB555 AV_PIX_FMT_RGB555
+#define PIX_FMT_RGB444 AV_PIX_FMT_RGB444
+#define PIX_FMT_BGR48 AV_PIX_FMT_BGR48
+#define PIX_FMT_BGR565 AV_PIX_FMT_BGR565
+#define PIX_FMT_BGR555 AV_PIX_FMT_BGR555
+#define PIX_FMT_BGR444 AV_PIX_FMT_BGR444
+
+#define PIX_FMT_YUV420P9 AV_PIX_FMT_YUV420P9
+#define PIX_FMT_YUV422P9 AV_PIX_FMT_YUV422P9
+#define PIX_FMT_YUV444P9 AV_PIX_FMT_YUV444P9
+#define PIX_FMT_YUV420P10 AV_PIX_FMT_YUV420P10
+#define PIX_FMT_YUV422P10 AV_PIX_FMT_YUV422P10
+#define PIX_FMT_YUV444P10 AV_PIX_FMT_YUV444P10
+#define PIX_FMT_YUV420P16 AV_PIX_FMT_YUV420P16
+#define PIX_FMT_YUV422P16 AV_PIX_FMT_YUV422P16
+#define PIX_FMT_YUV444P16 AV_PIX_FMT_YUV444P16
+
+#define PIX_FMT_GBRP9 AV_PIX_FMT_GBRP9
+#define PIX_FMT_GBRP10 AV_PIX_FMT_GBRP10
+#define PIX_FMT_GBRP16 AV_PIX_FMT_GBRP16
+#endif
#endif /* AVUTIL_PIXFMT_H */
diff --git a/gst-libs/ext/libav/libavutil/ppc/Makefile b/gst-libs/ext/libav/libavutil/ppc/Makefile
new file mode 100644
index 0000000..4fd8d6d
--- /dev/null
+++ b/gst-libs/ext/libav/libavutil/ppc/Makefile
@@ -0,0 +1,4 @@
+OBJS += ppc/cpu.o \
+ ppc/float_dsp_init.o \
+
+ALTIVEC-OBJS += ppc/float_dsp_altivec.o \
diff --git a/gst-libs/ext/libav/libavutil/ppc/float_dsp_altivec.c b/gst-libs/ext/libav/libavutil/ppc/float_dsp_altivec.c
new file mode 100644
index 0000000..55e3fbe
--- /dev/null
+++ b/gst-libs/ext/libav/libavutil/ppc/float_dsp_altivec.c
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2006 Luca Barbato <lu_zero@gentoo.org>
+ *
+ * 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
+ */
+
+#include "util_altivec.h"
+#include "float_dsp_altivec.h"
+
+void ff_vector_fmul_altivec(float *dst, const float *src0, const float *src1,
+ int len)
+{
+ int i;
+ vector float d0, d1, s, zero = (vector float)vec_splat_u32(0);
+ for (i = 0; i < len - 7; i += 8) {
+ d0 = vec_ld( 0, src0 + i);
+ s = vec_ld( 0, src1 + i);
+ d1 = vec_ld(16, src0 + i);
+ d0 = vec_madd(d0, s, zero);
+ d1 = vec_madd(d1, vec_ld(16, src1 + i), zero);
+ vec_st(d0, 0, dst + i);
+ vec_st(d1, 16, dst + i);
+ }
+}
diff --git a/gst-libs/ext/libav/libavutil/ppc/float_dsp_altivec.h b/gst-libs/ext/libav/libavutil/ppc/float_dsp_altivec.h
new file mode 100644
index 0000000..0b9425b
--- /dev/null
+++ b/gst-libs/ext/libav/libavutil/ppc/float_dsp_altivec.h
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2006 Luca Barbato <lu_zero@gentoo.org>
+ *
+ * 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
+ */
+
+#ifndef AVUTIL_PPC_FLOAT_DSP_ALTIVEC_H
+#define AVUTIL_PPC_FLOAT_DSP_ALTIVEC_H
+
+extern void ff_vector_fmul_altivec(float *dst, const float *src0,
+ const float *src1, int len);
+
+#endif /* AVUTIL_PPC_FLOAT_DSP_ALTIVEC_H */
diff --git a/gst-libs/ext/libav/libavutil/ppc/float_dsp_init.c b/gst-libs/ext/libav/libavutil/ppc/float_dsp_init.c
new file mode 100644
index 0000000..2052764
--- /dev/null
+++ b/gst-libs/ext/libav/libavutil/ppc/float_dsp_init.c
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2006 Luca Barbato <lu_zero@gentoo.org>
+ *
+ * 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
+ */
+
+#include "config.h"
+#include "libavutil/cpu.h"
+#include "libavutil/float_dsp.h"
+#include "float_dsp_altivec.h"
+
+void ff_float_dsp_init_ppc(AVFloatDSPContext *fdsp, int bit_exact)
+{
+#if HAVE_ALTIVEC
+ int mm_flags = av_get_cpu_flags();
+
+ if (!(mm_flags & AV_CPU_FLAG_ALTIVEC))
+ return;
+
+ fdsp->vector_fmul = ff_vector_fmul_altivec;
+#endif
+}
diff --git a/gst-libs/ext/libav/libavutil/ppc/types_altivec.h b/gst-libs/ext/libav/libavutil/ppc/types_altivec.h
new file mode 100644
index 0000000..0a4eaf8
--- /dev/null
+++ b/gst-libs/ext/libav/libavutil/ppc/types_altivec.h
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2006 Guillaume Poirier <gpoirier@mplayerhq.hu>
+ *
+ * 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
+ */
+
+#ifndef AVUTIL_PPC_TYPES_ALTIVEC_H
+#define AVUTIL_PPC_TYPES_ALTIVEC_H
+
+/***********************************************************************
+ * Vector types
+ **********************************************************************/
+#define vec_u8 vector unsigned char
+#define vec_s8 vector signed char
+#define vec_u16 vector unsigned short
+#define vec_s16 vector signed short
+#define vec_u32 vector unsigned int
+#define vec_s32 vector signed int
+#define vec_f vector float
+
+/***********************************************************************
+ * Null vector
+ **********************************************************************/
+#define LOAD_ZERO const vec_u8 zerov = vec_splat_u8( 0 )
+
+#define zero_u8v (vec_u8) zerov
+#define zero_s8v (vec_s8) zerov
+#define zero_u16v (vec_u16) zerov
+#define zero_s16v (vec_s16) zerov
+#define zero_u32v (vec_u32) zerov
+#define zero_s32v (vec_s32) zerov
+
+#endif /* AVUTIL_PPC_TYPES_ALTIVEC_H */
diff --git a/gst-libs/ext/libav/libavutil/ppc/util_altivec.h b/gst-libs/ext/libav/libavutil/ppc/util_altivec.h
new file mode 100644
index 0000000..bdbf862
--- /dev/null
+++ b/gst-libs/ext/libav/libavutil/ppc/util_altivec.h
@@ -0,0 +1,118 @@
+/*
+ * 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
+ * Contains misc utility macros and inline functions
+ */
+
+#ifndef AVUTIL_PPC_UTIL_ALTIVEC_H
+#define AVUTIL_PPC_UTIL_ALTIVEC_H
+
+#include <stdint.h>
+
+#include "config.h"
+
+#if HAVE_ALTIVEC_H
+#include <altivec.h>
+#endif
+
+#include "types_altivec.h"
+
+// used to build registers permutation vectors (vcprm)
+// the 's' are for words in the _s_econd vector
+#define WORD_0 0x00,0x01,0x02,0x03
+#define WORD_1 0x04,0x05,0x06,0x07
+#define WORD_2 0x08,0x09,0x0a,0x0b
+#define WORD_3 0x0c,0x0d,0x0e,0x0f
+#define WORD_s0 0x10,0x11,0x12,0x13
+#define WORD_s1 0x14,0x15,0x16,0x17
+#define WORD_s2 0x18,0x19,0x1a,0x1b
+#define WORD_s3 0x1c,0x1d,0x1e,0x1f
+
+#define vcprm(a,b,c,d) (const vector unsigned char){WORD_ ## a, WORD_ ## b, WORD_ ## c, WORD_ ## d}
+#define vcii(a,b,c,d) (const vector float){FLOAT_ ## a, FLOAT_ ## b, FLOAT_ ## c, FLOAT_ ## d}
+
+// vcprmle is used to keep the same index as in the SSE version.
+// it's the same as vcprm, with the index inversed
+// ('le' is Little Endian)
+#define vcprmle(a,b,c,d) vcprm(d,c,b,a)
+
+// used to build inverse/identity vectors (vcii)
+// n is _n_egative, p is _p_ositive
+#define FLOAT_n -1.
+#define FLOAT_p 1.
+
+
+// Transpose 8x8 matrix of 16-bit elements (in-place)
+#define TRANSPOSE8(a,b,c,d,e,f,g,h) \
+do { \
+ vector signed short A1, B1, C1, D1, E1, F1, G1, H1; \
+ vector signed short A2, B2, C2, D2, E2, F2, G2, H2; \
+ \
+ A1 = vec_mergeh (a, e); \
+ B1 = vec_mergel (a, e); \
+ C1 = vec_mergeh (b, f); \
+ D1 = vec_mergel (b, f); \
+ E1 = vec_mergeh (c, g); \
+ F1 = vec_mergel (c, g); \
+ G1 = vec_mergeh (d, h); \
+ H1 = vec_mergel (d, h); \
+ \
+ A2 = vec_mergeh (A1, E1); \
+ B2 = vec_mergel (A1, E1); \
+ C2 = vec_mergeh (B1, F1); \
+ D2 = vec_mergel (B1, F1); \
+ E2 = vec_mergeh (C1, G1); \
+ F2 = vec_mergel (C1, G1); \
+ G2 = vec_mergeh (D1, H1); \
+ H2 = vec_mergel (D1, H1); \
+ \
+ a = vec_mergeh (A2, E2); \
+ b = vec_mergel (A2, E2); \
+ c = vec_mergeh (B2, F2); \
+ d = vec_mergel (B2, F2); \
+ e = vec_mergeh (C2, G2); \
+ f = vec_mergel (C2, G2); \
+ g = vec_mergeh (D2, H2); \
+ h = vec_mergel (D2, H2); \
+} while (0)
+
+
+/** @brief loads unaligned vector @a *src with offset @a offset
+ and returns it */
+static inline vector unsigned char unaligned_load(int offset, uint8_t *src)
+{
+ register vector unsigned char first = vec_ld(offset, src);
+ register vector unsigned char second = vec_ld(offset+15, src);
+ register vector unsigned char mask = vec_lvsl(offset, src);
+ return vec_perm(first, second, mask);
+}
+
+/**
+ * loads vector known misalignment
+ * @param perm_vec the align permute vector to combine the two loads from lvsl
+ */
+static inline vec_u8 load_with_perm_vec(int offset, uint8_t *src, vec_u8 perm_vec)
+{
+ vec_u8 a = vec_ld(offset, src);
+ vec_u8 b = vec_ld(offset+15, src);
+ return vec_perm(a, b, perm_vec);
+}
+
+#endif /* AVUTIL_PPC_UTIL_ALTIVEC_H */
diff --git a/gst-libs/ext/libav/libavutil/random_seed.c b/gst-libs/ext/libav/libavutil/random_seed.c
index 51ca99b..ec9caa7 100644
--- a/gst-libs/ext/libav/libavutil/random_seed.c
+++ b/gst-libs/ext/libav/libavutil/random_seed.c
@@ -18,7 +18,15 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "config.h"
+
+#if HAVE_UNISTD_H
#include <unistd.h>
+#endif
+#if HAVE_CRYPTGENRANDOM
+#include <windows.h>
+#include <wincrypt.h>
+#endif
#include <fcntl.h>
#include <math.h>
#include <time.h>
@@ -27,6 +35,7 @@
static int read_random(uint32_t *dst, const char *file)
{
+#if HAVE_UNISTD_H
int fd = open(file, O_RDONLY);
int err = -1;
@@ -36,6 +45,9 @@ static int read_random(uint32_t *dst, const char *file)
close(fd);
return err;
+#else
+ return -1;
+#endif
}
static uint32_t get_generic_seed(void)
@@ -74,6 +86,17 @@ uint32_t av_get_random_seed(void)
{
uint32_t seed;
+#if HAVE_CRYPTGENRANDOM
+ HCRYPTPROV provider;
+ if (CryptAcquireContext(&provider, NULL, NULL, PROV_RSA_FULL,
+ CRYPT_VERIFYCONTEXT | CRYPT_SILENT)) {
+ BOOL ret = CryptGenRandom(provider, sizeof(seed), (PBYTE) &seed);
+ CryptReleaseContext(provider, 0);
+ if (ret)
+ return seed;
+ }
+#endif
+
if (read_random(&seed, "/dev/urandom") == sizeof(seed))
return seed;
if (read_random(&seed, "/dev/random") == sizeof(seed))
diff --git a/gst-libs/ext/libav/libavutil/rational.c b/gst-libs/ext/libav/libavutil/rational.c
index 3e62e1b..4770c54 100644
--- a/gst-libs/ext/libav/libavutil/rational.c
+++ b/gst-libs/ext/libav/libavutil/rational.c
@@ -144,28 +144,3 @@ int av_find_nearest_q_idx(AVRational q, const AVRational* q_list)
return nearest_q_idx;
}
-
-#ifdef TEST
-int main(void)
-{
- AVRational a,b;
- for (a.num = -2; a.num <= 2; a.num++) {
- for (a.den = -2; a.den <= 2; a.den++) {
- for (b.num = -2; b.num <= 2; b.num++) {
- for (b.den = -2; b.den <= 2; b.den++) {
- int c = av_cmp_q(a,b);
- double d = av_q2d(a) == av_q2d(b) ?
- 0 : (av_q2d(a) - av_q2d(b));
- if (d > 0) d = 1;
- else if (d < 0) d = -1;
- else if (d != d) d = INT_MIN;
- if (c != d)
- av_log(0, AV_LOG_ERROR, "%d/%d %d/%d, %d %f\n", a.num,
- a.den, b.num, b.den, c,d);
- }
- }
- }
- }
- return 0;
-}
-#endif
diff --git a/gst-libs/ext/libav/libavutil/rational.h b/gst-libs/ext/libav/libavutil/rational.h
index 0ec18ec..5d7dab7 100644
--- a/gst-libs/ext/libav/libavutil/rational.h
+++ b/gst-libs/ext/libav/libavutil/rational.h
@@ -115,6 +115,17 @@ AVRational av_add_q(AVRational b, AVRational c) av_const;
AVRational av_sub_q(AVRational b, AVRational c) av_const;
/**
+ * Invert a rational.
+ * @param q value
+ * @return 1 / q
+ */
+static av_always_inline AVRational av_inv_q(AVRational q)
+{
+ AVRational r = { q.den, q.num };
+ return r;
+}
+
+/**
* Convert a double precision floating point number to a rational.
* inf is expressed as {1,0} or {-1,0} depending on the sign.
*
diff --git a/gst-libs/ext/libav/libavutil/samplefmt.c b/gst-libs/ext/libav/libavutil/samplefmt.c
index f38d05e..389f726 100644
--- a/gst-libs/ext/libav/libavutil/samplefmt.c
+++ b/gst-libs/ext/libav/libavutil/samplefmt.c
@@ -16,6 +16,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "common.h"
#include "samplefmt.h"
#include <stdio.h>
@@ -26,20 +27,21 @@ typedef struct SampleFmtInfo {
const char *name;
int bits;
int planar;
+ enum AVSampleFormat altform; ///< planar<->packed alternative form
} SampleFmtInfo;
/** this table gives more information about formats */
static const SampleFmtInfo sample_fmt_info[AV_SAMPLE_FMT_NB] = {
- [AV_SAMPLE_FMT_U8] = { .name = "u8", .bits = 8, .planar = 0 },
- [AV_SAMPLE_FMT_S16] = { .name = "s16", .bits = 16, .planar = 0 },
- [AV_SAMPLE_FMT_S32] = { .name = "s32", .bits = 32, .planar = 0 },
- [AV_SAMPLE_FMT_FLT] = { .name = "flt", .bits = 32, .planar = 0 },
- [AV_SAMPLE_FMT_DBL] = { .name = "dbl", .bits = 64, .planar = 0 },
- [AV_SAMPLE_FMT_U8P] = { .name = "u8p", .bits = 8, .planar = 1 },
- [AV_SAMPLE_FMT_S16P] = { .name = "s16p", .bits = 16, .planar = 1 },
- [AV_SAMPLE_FMT_S32P] = { .name = "s32p", .bits = 32, .planar = 1 },
- [AV_SAMPLE_FMT_FLTP] = { .name = "fltp", .bits = 32, .planar = 1 },
- [AV_SAMPLE_FMT_DBLP] = { .name = "dblp", .bits = 64, .planar = 1 },
+ [AV_SAMPLE_FMT_U8] = { .name = "u8", .bits = 8, .planar = 0, .altform = AV_SAMPLE_FMT_U8P },
+ [AV_SAMPLE_FMT_S16] = { .name = "s16", .bits = 16, .planar = 0, .altform = AV_SAMPLE_FMT_S16P },
+ [AV_SAMPLE_FMT_S32] = { .name = "s32", .bits = 32, .planar = 0, .altform = AV_SAMPLE_FMT_S32P },
+ [AV_SAMPLE_FMT_FLT] = { .name = "flt", .bits = 32, .planar = 0, .altform = AV_SAMPLE_FMT_FLTP },
+ [AV_SAMPLE_FMT_DBL] = { .name = "dbl", .bits = 64, .planar = 0, .altform = AV_SAMPLE_FMT_DBLP },
+ [AV_SAMPLE_FMT_U8P] = { .name = "u8p", .bits = 8, .planar = 1, .altform = AV_SAMPLE_FMT_U8 },
+ [AV_SAMPLE_FMT_S16P] = { .name = "s16p", .bits = 16, .planar = 1, .altform = AV_SAMPLE_FMT_S16 },
+ [AV_SAMPLE_FMT_S32P] = { .name = "s32p", .bits = 32, .planar = 1, .altform = AV_SAMPLE_FMT_S32 },
+ [AV_SAMPLE_FMT_FLTP] = { .name = "fltp", .bits = 32, .planar = 1, .altform = AV_SAMPLE_FMT_FLT },
+ [AV_SAMPLE_FMT_DBLP] = { .name = "dblp", .bits = 64, .planar = 1, .altform = AV_SAMPLE_FMT_DBL },
};
const char *av_get_sample_fmt_name(enum AVSampleFormat sample_fmt)
@@ -59,6 +61,24 @@ enum AVSampleFormat av_get_sample_fmt(const char *name)
return AV_SAMPLE_FMT_NONE;
}
+enum AVSampleFormat av_get_packed_sample_fmt(enum AVSampleFormat sample_fmt)
+{
+ if (sample_fmt < 0 || sample_fmt >= AV_SAMPLE_FMT_NB)
+ return AV_SAMPLE_FMT_NONE;
+ if (sample_fmt_info[sample_fmt].planar)
+ return sample_fmt_info[sample_fmt].altform;
+ return sample_fmt;
+}
+
+enum AVSampleFormat av_get_planar_sample_fmt(enum AVSampleFormat sample_fmt)
+{
+ if (sample_fmt < 0 || sample_fmt >= AV_SAMPLE_FMT_NB)
+ return AV_SAMPLE_FMT_NONE;
+ if (sample_fmt_info[sample_fmt].planar)
+ return sample_fmt;
+ return sample_fmt_info[sample_fmt].altform;
+}
+
char *av_get_sample_fmt_string (char *buf, int buf_size, enum AVSampleFormat sample_fmt)
{
/* print header */
@@ -78,14 +98,6 @@ int av_get_bytes_per_sample(enum AVSampleFormat sample_fmt)
0 : sample_fmt_info[sample_fmt].bits >> 3;
}
-#if FF_API_GET_BITS_PER_SAMPLE_FMT
-int av_get_bits_per_sample_fmt(enum AVSampleFormat sample_fmt)
-{
- return sample_fmt < 0 || sample_fmt >= AV_SAMPLE_FMT_NB ?
- 0 : sample_fmt_info[sample_fmt].bits;
-}
-#endif
-
int av_sample_fmt_is_planar(enum AVSampleFormat sample_fmt)
{
if (sample_fmt < 0 || sample_fmt >= AV_SAMPLE_FMT_NB)
@@ -104,6 +116,12 @@ int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples,
if (!sample_size || nb_samples <= 0 || nb_channels <= 0)
return AVERROR(EINVAL);
+ /* auto-select alignment if not specified */
+ if (!align) {
+ align = 1;
+ nb_samples = FFALIGN(nb_samples, 32);
+ }
+
/* check for integer overflow */
if (nb_channels > INT_MAX / align ||
(int64_t)nb_channels * nb_samples > (INT_MAX - (align * nb_channels)) / sample_size)
@@ -118,20 +136,23 @@ int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples,
}
int av_samples_fill_arrays(uint8_t **audio_data, int *linesize,
- uint8_t *buf, int nb_channels, int nb_samples,
+ const uint8_t *buf, int nb_channels, int nb_samples,
enum AVSampleFormat sample_fmt, int align)
{
- int ch, planar, buf_size;
+ int ch, planar, buf_size, line_size;
planar = av_sample_fmt_is_planar(sample_fmt);
- buf_size = av_samples_get_buffer_size(linesize, nb_channels, nb_samples,
+ buf_size = av_samples_get_buffer_size(&line_size, nb_channels, nb_samples,
sample_fmt, align);
if (buf_size < 0)
return buf_size;
audio_data[0] = buf;
for (ch = 1; planar && ch < nb_channels; ch++)
- audio_data[ch] = audio_data[ch-1] + *linesize;
+ audio_data[ch] = audio_data[ch-1] + line_size;
+
+ if (linesize)
+ *linesize = line_size;
return 0;
}
@@ -145,7 +166,7 @@ int av_samples_alloc(uint8_t **audio_data, int *linesize, int nb_channels,
if (size < 0)
return size;
- buf = av_mallocz(size);
+ buf = av_malloc(size);
if (!buf)
return AVERROR(ENOMEM);
@@ -155,5 +176,46 @@ int av_samples_alloc(uint8_t **audio_data, int *linesize, int nb_channels,
av_free(buf);
return size;
}
+
+ av_samples_set_silence(audio_data, 0, nb_samples, nb_channels, sample_fmt);
+
+ return 0;
+}
+
+int av_samples_copy(uint8_t **dst, uint8_t * const *src, int dst_offset,
+ int src_offset, int nb_samples, int nb_channels,
+ enum AVSampleFormat sample_fmt)
+{
+ int planar = av_sample_fmt_is_planar(sample_fmt);
+ int planes = planar ? nb_channels : 1;
+ int block_align = av_get_bytes_per_sample(sample_fmt) * (planar ? 1 : nb_channels);
+ int data_size = nb_samples * block_align;
+ int i;
+
+ dst_offset *= block_align;
+ src_offset *= block_align;
+
+ for (i = 0; i < planes; i++)
+ memcpy(dst[i] + dst_offset, src[i] + src_offset, data_size);
+
+ return 0;
+}
+
+int av_samples_set_silence(uint8_t **audio_data, int offset, int nb_samples,
+ int nb_channels, enum AVSampleFormat sample_fmt)
+{
+ int planar = av_sample_fmt_is_planar(sample_fmt);
+ int planes = planar ? nb_channels : 1;
+ int block_align = av_get_bytes_per_sample(sample_fmt) * (planar ? 1 : nb_channels);
+ int data_size = nb_samples * block_align;
+ int fill_char = (sample_fmt == AV_SAMPLE_FMT_U8 ||
+ sample_fmt == AV_SAMPLE_FMT_U8P) ? 0x80 : 0x00;
+ int i;
+
+ offset *= block_align;
+
+ for (i = 0; i < planes; i++)
+ memset(audio_data[i] + offset, fill_char, data_size);
+
return 0;
}
diff --git a/gst-libs/ext/libav/libavutil/samplefmt.h b/gst-libs/ext/libav/libavutil/samplefmt.h
index b671556..33cbded 100644
--- a/gst-libs/ext/libav/libavutil/samplefmt.h
+++ b/gst-libs/ext/libav/libavutil/samplefmt.h
@@ -19,10 +19,32 @@
#ifndef AVUTIL_SAMPLEFMT_H
#define AVUTIL_SAMPLEFMT_H
+#include <stdint.h>
+
#include "avutil.h"
+#include "attributes.h"
/**
- * all in native-endian format
+ * Audio Sample Formats
+ *
+ * @par
+ * The data described by the sample format is always in native-endian order.
+ * Sample values can be expressed by native C types, hence the lack of a signed
+ * 24-bit sample format even though it is a common raw audio data format.
+ *
+ * @par
+ * The floating-point formats are based on full volume being in the range
+ * [-1.0, 1.0]. Any values outside this range are beyond full volume level.
+ *
+ * @par
+ * The data layout as used in av_samples_fill_arrays() and elsewhere in Libav
+ * (such as AVFrame in libavcodec) is as follows:
+ *
+ * For planar sample formats, each audio channel is in a separate data plane,
+ * and linesize is the buffer size, in bytes, for a single plane. All data
+ * planes must be the same size. For packed sample formats, only the first data
+ * plane is used, and samples for each channel are interleaved. In this case,
+ * linesize is the buffer size, in bytes, for the 1 plane.
*/
enum AVSampleFormat {
AV_SAMPLE_FMT_NONE = -1,
@@ -54,6 +76,28 @@ const char *av_get_sample_fmt_name(enum AVSampleFormat sample_fmt);
enum AVSampleFormat av_get_sample_fmt(const char *name);
/**
+ * Get the packed alternative form of the given sample format.
+ *
+ * If the passed sample_fmt is already in packed format, the format returned is
+ * the same as the input.
+ *
+ * @return the packed alternative form of the given sample format or
+ AV_SAMPLE_FMT_NONE on error.
+ */
+enum AVSampleFormat av_get_packed_sample_fmt(enum AVSampleFormat sample_fmt);
+
+/**
+ * Get the planar alternative form of the given sample format.
+ *
+ * If the passed sample_fmt is already in planar format, the format returned is
+ * the same as the input.
+ *
+ * @return the planar alternative form of the given sample format or
+ AV_SAMPLE_FMT_NONE on error.
+ */
+enum AVSampleFormat av_get_planar_sample_fmt(enum AVSampleFormat sample_fmt);
+
+/**
* Generate a string corresponding to the sample format with
* sample_fmt, or a header if sample_fmt is negative.
*
@@ -67,14 +111,6 @@ enum AVSampleFormat av_get_sample_fmt(const char *name);
*/
char *av_get_sample_fmt_string(char *buf, int buf_size, enum AVSampleFormat sample_fmt);
-#if FF_API_GET_BITS_PER_SAMPLE_FMT
-/**
- * @deprecated Use av_get_bytes_per_sample() instead.
- */
-attribute_deprecated
-int av_get_bits_per_sample_fmt(enum AVSampleFormat sample_fmt);
-#endif
-
/**
* Return number of bytes per sample.
*
@@ -99,6 +135,7 @@ int av_sample_fmt_is_planar(enum AVSampleFormat sample_fmt);
* @param nb_channels the number of channels
* @param nb_samples the number of samples in a single channel
* @param sample_fmt the sample format
+ * @param align buffer size alignment (0 = default, 1 = no alignment)
* @return required buffer size, or negative error code on failure
*/
int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples,
@@ -116,16 +153,20 @@ int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples,
* buffer for planar layout, or the aligned size of the buffer for all channels
* for packed layout.
*
+ * @see enum AVSampleFormat
+ * The documentation for AVSampleFormat describes the data layout.
+ *
* @param[out] audio_data array to be filled with the pointer for each channel
- * @param[out] linesize calculated linesize
+ * @param[out] linesize calculated linesize, may be NULL
* @param buf the pointer to a buffer containing the samples
* @param nb_channels the number of channels
* @param nb_samples the number of samples in a single channel
* @param sample_fmt the sample format
- * @param align buffer size alignment (1 = no alignment required)
+ * @param align buffer size alignment (0 = default, 1 = no alignment)
* @return 0 on success or a negative error code on failure
*/
-int av_samples_fill_arrays(uint8_t **audio_data, int *linesize, uint8_t *buf,
+int av_samples_fill_arrays(uint8_t **audio_data, int *linesize,
+ const uint8_t *buf,
int nb_channels, int nb_samples,
enum AVSampleFormat sample_fmt, int align);
@@ -133,16 +174,47 @@ int av_samples_fill_arrays(uint8_t **audio_data, int *linesize, uint8_t *buf,
* Allocate a samples buffer for nb_samples samples, and fill data pointers and
* linesize accordingly.
* The allocated samples buffer can be freed by using av_freep(&audio_data[0])
+ * Allocated data will be initialized to silence.
+ *
+ * @see enum AVSampleFormat
+ * The documentation for AVSampleFormat describes the data layout.
*
* @param[out] audio_data array to be filled with the pointer for each channel
- * @param[out] linesize aligned size for audio buffer(s)
+ * @param[out] linesize aligned size for audio buffer(s), may be NULL
* @param nb_channels number of audio channels
* @param nb_samples number of samples per channel
- * @param align buffer size alignment (1 = no alignment required)
+ * @param align buffer size alignment (0 = default, 1 = no alignment)
* @return 0 on success or a negative error code on failure
* @see av_samples_fill_arrays()
*/
int av_samples_alloc(uint8_t **audio_data, int *linesize, int nb_channels,
int nb_samples, enum AVSampleFormat sample_fmt, int align);
+/**
+ * Copy samples from src to dst.
+ *
+ * @param dst destination array of pointers to data planes
+ * @param src source array of pointers to data planes
+ * @param dst_offset offset in samples at which the data will be written to dst
+ * @param src_offset offset in samples at which the data will be read from src
+ * @param nb_samples number of samples to be copied
+ * @param nb_channels number of audio channels
+ * @param sample_fmt audio sample format
+ */
+int av_samples_copy(uint8_t **dst, uint8_t * const *src, int dst_offset,
+ int src_offset, int nb_samples, int nb_channels,
+ enum AVSampleFormat sample_fmt);
+
+/**
+ * Fill an audio buffer with silence.
+ *
+ * @param audio_data array of pointers to data planes
+ * @param offset offset in samples at which to start filling
+ * @param nb_samples number of samples to fill
+ * @param nb_channels number of audio channels
+ * @param sample_fmt audio sample format
+ */
+int av_samples_set_silence(uint8_t **audio_data, int offset, int nb_samples,
+ int nb_channels, enum AVSampleFormat sample_fmt);
+
#endif /* AVUTIL_SAMPLEFMT_H */
diff --git a/gst-libs/ext/libav/libavutil/sha.c b/gst-libs/ext/libav/libavutil/sha.c
index 5af742d..c7c6ce3 100644
--- a/gst-libs/ext/libav/libavutil/sha.c
+++ b/gst-libs/ext/libav/libavutil/sha.c
@@ -26,6 +26,7 @@
#include "bswap.h"
#include "sha.h"
#include "intreadwrite.h"
+#include "mem.h"
/** hash context */
typedef struct AVSHA {
@@ -37,7 +38,14 @@ typedef struct AVSHA {
void (*transform)(uint32_t *state, const uint8_t buffer[64]);
} AVSHA;
+#if FF_API_CONTEXT_SIZE
const int av_sha_size = sizeof(AVSHA);
+#endif
+
+struct AVSHA *av_sha_alloc(void)
+{
+ return av_mallocz(sizeof(struct AVSHA));
+}
#define rol(value, bits) (((value) << (bits)) | ((value) >> (32 - (bits))))
@@ -181,7 +189,7 @@ static void sha256_transform(uint32_t *state, const uint8_t buffer[64])
{
unsigned int i, a, b, c, d, e, f, g, h;
uint32_t block[64];
- uint32_t T1, av_unused(T2);
+ uint32_t T1;
a = state[0];
b = state[1];
@@ -193,6 +201,7 @@ static void sha256_transform(uint32_t *state, const uint8_t buffer[64])
h = state[7];
#if CONFIG_SMALL
for (i = 0; i < 64; i++) {
+ uint32_t T2;
if (i < 16)
T1 = blk0(i);
else
@@ -325,7 +334,6 @@ void av_sha_final(AVSHA* ctx, uint8_t *digest)
#ifdef TEST
#include <stdio.h>
-#undef printf
int main(void)
{
diff --git a/gst-libs/ext/libav/libavutil/sha.h b/gst-libs/ext/libav/libavutil/sha.h
index 8350954..4c9a0c9 100644
--- a/gst-libs/ext/libav/libavutil/sha.h
+++ b/gst-libs/ext/libav/libavutil/sha.h
@@ -23,17 +23,27 @@
#include <stdint.h>
+#include "attributes.h"
+#include "version.h"
+
/**
* @defgroup lavu_sha SHA
* @ingroup lavu_crypto
* @{
*/
-extern const int av_sha_size;
+#if FF_API_CONTEXT_SIZE
+extern attribute_deprecated const int av_sha_size;
+#endif
struct AVSHA;
/**
+ * Allocate an AVSHA context.
+ */
+struct AVSHA *av_sha_alloc(void);
+
+/**
* Initialize SHA-1 or SHA-2 hashing.
*
* @param context pointer to the function context (of size av_sha_size)
diff --git a/gst-libs/ext/libav/libavutil/time.c b/gst-libs/ext/libav/libavutil/time.c
new file mode 100644
index 0000000..51779c5
--- /dev/null
+++ b/gst-libs/ext/libav/libavutil/time.c
@@ -0,0 +1,68 @@
+/*
+ * 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
+ */
+
+#include "config.h"
+
+#include <stddef.h>
+#include <stdint.h>
+#include <time.h>
+#if HAVE_GETTIMEOFDAY
+#include <sys/time.h>
+#endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#if HAVE_WINDOWS_H
+#include <windows.h>
+#endif
+
+#include "libavutil/time.h"
+#include "error.h"
+
+int64_t av_gettime(void)
+{
+#if HAVE_GETTIMEOFDAY
+ struct timeval tv;
+ gettimeofday(&tv, NULL);
+ return (int64_t)tv.tv_sec * 1000000 + tv.tv_usec;
+#elif HAVE_GETSYSTEMTIMEASFILETIME
+ FILETIME ft;
+ int64_t t;
+ GetSystemTimeAsFileTime(&ft);
+ t = (int64_t)ft.dwHighDateTime << 32 | ft.dwLowDateTime;
+ return t / 10 - 11644473600000000; /* Jan 1, 1601 */
+#else
+ return -1;
+#endif
+}
+
+int av_usleep(unsigned usec)
+{
+#if HAVE_NANOSLEEP
+ struct timespec ts = { usec / 1000000, usec % 1000000 * 1000 };
+ while (nanosleep(&ts, &ts) < 0 && errno == EINTR);
+ return 0;
+#elif HAVE_USLEEP
+ return usleep(usec);
+#elif HAVE_SLEEP
+ Sleep(usec / 1000);
+ return 0;
+#else
+ return AVERROR(ENOSYS);
+#endif
+}
diff --git a/gst-libs/ext/libav/libavutil/time.h b/gst-libs/ext/libav/libavutil/time.h
new file mode 100644
index 0000000..b01a97d
--- /dev/null
+++ b/gst-libs/ext/libav/libavutil/time.h
@@ -0,0 +1,39 @@
+/*
+ * 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
+ */
+
+#ifndef AVUTIL_TIME_H
+#define AVUTIL_TIME_H
+
+#include <stdint.h>
+
+/**
+ * Get the current time in microseconds.
+ */
+int64_t av_gettime(void);
+
+/**
+ * Sleep for a period of time. Although the duration is expressed in
+ * microseconds, the actual delay may be rounded to the precision of the
+ * system timer.
+ *
+ * @param usec Number of microseconds to sleep.
+ * @return zero on success or (negative) error code.
+ */
+int av_usleep(unsigned usec);
+
+#endif /* AVUTIL_TIME_H */
diff --git a/gst-libs/ext/libav/libavutil/timer.h b/gst-libs/ext/libav/libavutil/timer.h
index 78d2b5f..ea5c891 100644
--- a/gst-libs/ext/libav/libavutil/timer.h
+++ b/gst-libs/ext/libav/libavutil/timer.h
@@ -28,6 +28,7 @@
#include <stdlib.h>
#include <stdint.h>
+#include <inttypes.h>
#include "config.h"
diff --git a/gst-libs/ext/libav/libavutil/tree.c b/gst-libs/ext/libav/libavutil/tree.c
index e614f72..fd51a74 100644
--- a/gst-libs/ext/libav/libavutil/tree.c
+++ b/gst-libs/ext/libav/libavutil/tree.c
@@ -19,6 +19,7 @@
*/
#include "log.h"
+#include "mem.h"
#include "tree.h"
typedef struct AVTreeNode {
@@ -27,7 +28,14 @@ typedef struct AVTreeNode {
int state;
} AVTreeNode;
+#if FF_API_CONTEXT_SIZE
const int av_tree_node_size = sizeof(AVTreeNode);
+#endif
+
+struct AVTreeNode *av_tree_node_alloc(void)
+{
+ return av_mallocz(sizeof(struct AVTreeNode));
+}
void *av_tree_find(const AVTreeNode *t, void *key,
int (*cmp)(void *key, const void *b), void *next[2])
@@ -157,6 +165,7 @@ void av_tree_enumerate(AVTreeNode *t, void *opaque,
#ifdef TEST
+#include "common.h"
#include "lfg.h"
static int check(AVTreeNode *t)
@@ -211,7 +220,7 @@ int main (void)
}
av_log(NULL, AV_LOG_ERROR, "inserting %4d\n", j);
if (!node)
- node = av_mallocz(av_tree_node_size);
+ node = av_tree_node_alloc();
av_tree_insert(&root, (void *) (j + 1), cmp, &node);
j = av_lfg_get(&prng) % 86294;
diff --git a/gst-libs/ext/libav/libavutil/tree.h b/gst-libs/ext/libav/libavutil/tree.h
index 59ea01d..623280f 100644
--- a/gst-libs/ext/libav/libavutil/tree.h
+++ b/gst-libs/ext/libav/libavutil/tree.h
@@ -27,6 +27,9 @@
#ifndef AVUTIL_TREE_H
#define AVUTIL_TREE_H
+#include "attributes.h"
+#include "version.h"
+
/**
* @addtogroup lavu_tree AVTree
* @ingroup lavu_data
@@ -40,7 +43,14 @@
struct AVTreeNode;
-extern const int av_tree_node_size;
+#if FF_API_CONTEXT_SIZE
+extern attribute_deprecated const int av_tree_node_size;
+#endif
+
+/**
+ * Allocate an AVTreeNode.
+ */
+struct AVTreeNode *av_tree_node_alloc(void);
/**
* Find an element.
diff --git a/gst-libs/ext/libav/libavutil/version.h b/gst-libs/ext/libav/libavutil/version.h
new file mode 100644
index 0000000..1dbb11c
--- /dev/null
+++ b/gst-libs/ext/libav/libavutil/version.h
@@ -0,0 +1,87 @@
+/*
+ * 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
+ */
+
+#ifndef AVUTIL_VERSION_H
+#define AVUTIL_VERSION_H
+
+#include "avutil.h"
+
+/**
+ * @file
+ * @ingroup lavu
+ * Libavutil version macros
+ */
+
+/**
+ * @defgroup lavu_ver Version and Build diagnostics
+ *
+ * Macros and function useful to check at compiletime and at runtime
+ * which version of libavutil is in use.
+ *
+ * @{
+ */
+
+#define LIBAVUTIL_VERSION_MAJOR 52
+#define LIBAVUTIL_VERSION_MINOR 3
+#define LIBAVUTIL_VERSION_MICRO 0
+
+#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
+ LIBAVUTIL_VERSION_MINOR, \
+ LIBAVUTIL_VERSION_MICRO)
+#define LIBAVUTIL_VERSION AV_VERSION(LIBAVUTIL_VERSION_MAJOR, \
+ LIBAVUTIL_VERSION_MINOR, \
+ LIBAVUTIL_VERSION_MICRO)
+#define LIBAVUTIL_BUILD LIBAVUTIL_VERSION_INT
+
+#define LIBAVUTIL_IDENT "Lavu" AV_STRINGIFY(LIBAVUTIL_VERSION)
+
+/**
+ * @}
+ *
+ * @defgroup depr_guards Deprecation guards
+ * FF_API_* defines may be placed below to indicate public API that will be
+ * dropped at a future version bump. The defines themselves are not part of
+ * the public API and may change, break or disappear at any time.
+ *
+ * @{
+ */
+
+#ifndef FF_API_PIX_FMT
+#define FF_API_PIX_FMT (LIBAVUTIL_VERSION_MAJOR < 53)
+#endif
+#ifndef FF_API_CONTEXT_SIZE
+#define FF_API_CONTEXT_SIZE (LIBAVUTIL_VERSION_MAJOR < 53)
+#endif
+#ifndef FF_API_PIX_FMT_DESC
+#define FF_API_PIX_FMT_DESC (LIBAVUTIL_VERSION_MAJOR < 53)
+#endif
+#ifndef FF_API_AV_REVERSE
+#define FF_API_AV_REVERSE (LIBAVUTIL_VERSION_MAJOR < 53)
+#endif
+#ifndef FF_API_AUDIOCONVERT
+#define FF_API_AUDIOCONVERT (LIBAVUTIL_VERSION_MAJOR < 53)
+#endif
+#ifndef FF_API_CPU_FLAG_MMX2
+#define FF_API_CPU_FLAG_MMX2 (LIBAVUTIL_VERSION_MAJOR < 53)
+#endif
+
+/**
+ * @}
+ */
+
+#endif /* AVUTIL_VERSION_H */
diff --git a/gst-libs/ext/libav/libavutil/x86/Makefile b/gst-libs/ext/libav/libavutil/x86/Makefile
new file mode 100644
index 0000000..3dd696c
--- /dev/null
+++ b/gst-libs/ext/libav/libavutil/x86/Makefile
@@ -0,0 +1,5 @@
+OBJS += x86/cpu.o \
+ x86/float_dsp_init.o \
+
+YASM-OBJS += x86/cpuid.o \
+ x86/float_dsp.o \
diff --git a/gst-libs/ext/libav/libavutil/x86/asm.h b/gst-libs/ext/libav/libavutil/x86/asm.h
new file mode 100644
index 0000000..a43ab3c
--- /dev/null
+++ b/gst-libs/ext/libav/libavutil/x86/asm.h
@@ -0,0 +1,110 @@
+/*
+ * copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at>
+ *
+ * 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
+ */
+
+#ifndef AVUTIL_X86_ASM_H
+#define AVUTIL_X86_ASM_H
+
+#include <stdint.h>
+#include "config.h"
+
+#if ARCH_X86_64
+# define OPSIZE "q"
+# define REG_a "rax"
+# define REG_b "rbx"
+# define REG_c "rcx"
+# define REG_d "rdx"
+# define REG_D "rdi"
+# define REG_S "rsi"
+# define PTR_SIZE "8"
+typedef int64_t x86_reg;
+
+# define REG_SP "rsp"
+# define REG_BP "rbp"
+# define REGBP rbp
+# define REGa rax
+# define REGb rbx
+# define REGc rcx
+# define REGd rdx
+# define REGSP rsp
+
+#elif ARCH_X86_32
+
+# define OPSIZE "l"
+# define REG_a "eax"
+# define REG_b "ebx"
+# define REG_c "ecx"
+# define REG_d "edx"
+# define REG_D "edi"
+# define REG_S "esi"
+# define PTR_SIZE "4"
+typedef int32_t x86_reg;
+
+# define REG_SP "esp"
+# define REG_BP "ebp"
+# define REGBP ebp
+# define REGa eax
+# define REGb ebx
+# define REGc ecx
+# define REGd edx
+# define REGSP esp
+#else
+typedef int x86_reg;
+#endif
+
+#define HAVE_7REGS (ARCH_X86_64 || (HAVE_EBX_AVAILABLE && HAVE_EBP_AVAILABLE))
+#define HAVE_6REGS (ARCH_X86_64 || (HAVE_EBX_AVAILABLE || HAVE_EBP_AVAILABLE))
+
+#if ARCH_X86_64 && defined(PIC)
+# define BROKEN_RELOCATIONS 1
+#endif
+
+/*
+ * If gcc is not set to support sse (-msse) it will not accept xmm registers
+ * in the clobber list for inline asm. XMM_CLOBBERS takes a list of xmm
+ * registers to be marked as clobbered and evaluates to nothing if they are
+ * not supported, or to the list itself if they are supported. Since a clobber
+ * list may not be empty, XMM_CLOBBERS_ONLY should be used if the xmm
+ * registers are the only in the clobber list.
+ * For example a list with "eax" and "xmm0" as clobbers should become:
+ * : XMM_CLOBBERS("xmm0",) "eax"
+ * and a list with only "xmm0" should become:
+ * XMM_CLOBBERS_ONLY("xmm0")
+ */
+#if HAVE_XMM_CLOBBERS
+# define XMM_CLOBBERS(...) __VA_ARGS__
+# define XMM_CLOBBERS_ONLY(...) : __VA_ARGS__
+#else
+# define XMM_CLOBBERS(...)
+# define XMM_CLOBBERS_ONLY(...)
+#endif
+
+/* Use to export labels from asm. */
+#define LABEL_MANGLE(a) EXTERN_PREFIX #a
+
+// Use rip-relative addressing if compiling PIC code on x86-64.
+#if ARCH_X86_64 && defined(PIC)
+# define LOCAL_MANGLE(a) #a "(%%rip)"
+#else
+# define LOCAL_MANGLE(a) #a
+#endif
+
+#define MANGLE(a) EXTERN_PREFIX LOCAL_MANGLE(a)
+
+#endif /* AVUTIL_X86_ASM_H */
diff --git a/gst-libs/ext/libav/libavutil/x86/bswap.h b/gst-libs/ext/libav/libavutil/x86/bswap.h
index c6cf007..c73be9a 100644
--- a/gst-libs/ext/libav/libavutil/x86/bswap.h
+++ b/gst-libs/ext/libav/libavutil/x86/bswap.h
@@ -28,6 +28,8 @@
#include "config.h"
#include "libavutil/attributes.h"
+#if HAVE_INLINE_ASM
+
#if !AV_GCC_VERSION_AT_LEAST(4,1)
#define av_bswap16 av_bswap16
static av_always_inline av_const unsigned av_bswap16(unsigned x)
@@ -55,4 +57,5 @@ static inline uint64_t av_const av_bswap64(uint64_t x)
#endif
#endif /* !AV_GCC_VERSION_AT_LEAST(4,5) */
+#endif /* HAVE_INLINE_ASM */
#endif /* AVUTIL_X86_BSWAP_H */
diff --git a/gst-libs/ext/libav/libavutil/x86/cpu.c b/gst-libs/ext/libav/libavutil/x86/cpu.c
index 2424fe4..3b36fd0 100644
--- a/gst-libs/ext/libav/libavutil/x86/cpu.c
+++ b/gst-libs/ext/libav/libavutil/x86/cpu.c
@@ -22,74 +22,100 @@
#include <stdlib.h>
#include <string.h>
-#include "libavutil/x86_cpu.h"
+
+#include "libavutil/x86/asm.h"
+#include "libavutil/x86/cpu.h"
#include "libavutil/cpu.h"
+#if HAVE_YASM
+
+#define cpuid(index, eax, ebx, ecx, edx) \
+ ff_cpu_cpuid(index, &eax, &ebx, &ecx, &edx)
+
+#define xgetbv(index, eax, edx) \
+ ff_cpu_xgetbv(index, &eax, &edx)
+
+#elif HAVE_INLINE_ASM
+
/* ebx saving is necessary for PIC. gcc seems unable to see it alone */
-#define cpuid(index,eax,ebx,ecx,edx)\
- __asm__ volatile\
- ("mov %%"REG_b", %%"REG_S"\n\t"\
- "cpuid\n\t"\
- "xchg %%"REG_b", %%"REG_S\
- : "=a" (eax), "=S" (ebx),\
- "=c" (ecx), "=d" (edx)\
- : "0" (index));
-
-#define xgetbv(index,eax,edx) \
+#define cpuid(index, eax, ebx, ecx, edx) \
+ __asm__ volatile ( \
+ "mov %%"REG_b", %%"REG_S" \n\t" \
+ "cpuid \n\t" \
+ "xchg %%"REG_b", %%"REG_S \
+ : "=a" (eax), "=S" (ebx), "=c" (ecx), "=d" (edx) \
+ : "0" (index))
+
+#define xgetbv(index, eax, edx) \
__asm__ (".byte 0x0f, 0x01, 0xd0" : "=a"(eax), "=d"(edx) : "c" (index))
+#define get_eflags(x) \
+ __asm__ volatile ("pushfl \n" \
+ "pop %0 \n" \
+ : "=r"(x))
+
+#define set_eflags(x) \
+ __asm__ volatile ("push %0 \n" \
+ "popfl \n" \
+ :: "r"(x))
+
+#endif /* HAVE_INLINE_ASM */
+
+#if ARCH_X86_64
+
+#define cpuid_test() 1
+
+#elif HAVE_YASM
+
+#define cpuid_test ff_cpu_cpuid_test
+
+#elif HAVE_INLINE_ASM
+
+static int cpuid_test(void)
+{
+ x86_reg a, c;
+
+ /* Check if CPUID is supported by attempting to toggle the ID bit in
+ * the EFLAGS register. */
+ get_eflags(a);
+ set_eflags(a ^ 0x200000);
+ get_eflags(c);
+
+ return a != c;
+}
+#endif
+
/* Function to test if multimedia instructions are supported... */
int ff_get_cpu_flags_x86(void)
{
int rval = 0;
+
+#ifdef cpuid
+
int eax, ebx, ecx, edx;
- int max_std_level, max_ext_level, std_caps=0, ext_caps=0;
- int family=0, model=0;
+ int max_std_level, max_ext_level, std_caps = 0, ext_caps = 0;
+ int family = 0, model = 0;
union { int i[3]; char c[12]; } vendor;
-#if ARCH_X86_32
- x86_reg a, c;
- __asm__ volatile (
- /* See if CPUID instruction is supported ... */
- /* ... Get copies of EFLAGS into eax and ecx */
- "pushfl\n\t"
- "pop %0\n\t"
- "mov %0, %1\n\t"
-
- /* ... Toggle the ID bit in one copy and store */
- /* to the EFLAGS reg */
- "xor $0x200000, %0\n\t"
- "push %0\n\t"
- "popfl\n\t"
-
- /* ... Get the (hopefully modified) EFLAGS */
- "pushfl\n\t"
- "pop %0\n\t"
- : "=a" (a), "=c" (c)
- :
- : "cc"
- );
-
- if (a == c)
+ if (!cpuid_test())
return 0; /* CPUID not supported */
-#endif
- cpuid(0, max_std_level, ebx, ecx, edx);
- vendor.i[0] = ebx;
- vendor.i[1] = edx;
- vendor.i[2] = ecx;
+ cpuid(0, max_std_level, vendor.i[0], vendor.i[2], vendor.i[1]);
- if(max_std_level >= 1){
+ if (max_std_level >= 1) {
cpuid(1, eax, ebx, ecx, std_caps);
- family = ((eax>>8)&0xf) + ((eax>>20)&0xff);
- model = ((eax>>4)&0xf) + ((eax>>12)&0xf0);
- if (std_caps & (1<<23))
+ family = ((eax >> 8) & 0xf) + ((eax >> 20) & 0xff);
+ model = ((eax >> 4) & 0xf) + ((eax >> 12) & 0xf0);
+ if (std_caps & (1 << 15))
+ rval |= AV_CPU_FLAG_CMOV;
+ if (std_caps & (1 << 23))
rval |= AV_CPU_FLAG_MMX;
- if (std_caps & (1<<25))
- rval |= AV_CPU_FLAG_MMX2
+ if (std_caps & (1 << 25))
+ rval |= AV_CPU_FLAG_MMXEXT;
#if HAVE_SSE
- | AV_CPU_FLAG_SSE;
- if (std_caps & (1<<26))
+ if (std_caps & (1 << 25))
+ rval |= AV_CPU_FLAG_SSE;
+ if (std_caps & (1 << 26))
rval |= AV_CPU_FLAG_SSE2;
if (ecx & 1)
rval |= AV_CPU_FLAG_SSE3;
@@ -107,23 +133,22 @@ int ff_get_cpu_flags_x86(void)
if ((eax & 0x6) == 0x6)
rval |= AV_CPU_FLAG_AVX;
}
-#endif
-#endif
- ;
+#endif /* HAVE_AVX */
+#endif /* HAVE_SSE */
}
cpuid(0x80000000, max_ext_level, ebx, ecx, edx);
- if(max_ext_level >= 0x80000001){
+ if (max_ext_level >= 0x80000001) {
cpuid(0x80000001, eax, ebx, ecx, ext_caps);
- if (ext_caps & (1U<<31))
+ if (ext_caps & (1U << 31))
rval |= AV_CPU_FLAG_3DNOW;
- if (ext_caps & (1<<30))
+ if (ext_caps & (1 << 30))
rval |= AV_CPU_FLAG_3DNOWEXT;
- if (ext_caps & (1<<23))
+ if (ext_caps & (1 << 23))
rval |= AV_CPU_FLAG_MMX;
- if (ext_caps & (1<<22))
- rval |= AV_CPU_FLAG_MMX2;
+ if (ext_caps & (1 << 22))
+ rval |= AV_CPU_FLAG_MMXEXT;
/* Allow for selectively disabling SSE2 functions on AMD processors
with SSE2 support but not SSE4a. This includes Athlon64, some
@@ -149,14 +174,17 @@ int ff_get_cpu_flags_x86(void)
if (!strncmp(vendor.c, "GenuineIntel", 12)) {
if (family == 6 && (model == 9 || model == 13 || model == 14)) {
- /* 6/9 (pentium-m "banias"), 6/13 (pentium-m "dothan"), and 6/14 (core1 "yonah")
- * theoretically support sse2, but it's usually slower than mmx,
- * so let's just pretend they don't. AV_CPU_FLAG_SSE2 is disabled and
- * AV_CPU_FLAG_SSE2SLOW is enabled so that SSE2 is not used unless
- * explicitly enabled by checking AV_CPU_FLAG_SSE2SLOW. The same
- * situation applies for AV_CPU_FLAG_SSE3 and AV_CPU_FLAG_SSE3SLOW. */
- if (rval & AV_CPU_FLAG_SSE2) rval ^= AV_CPU_FLAG_SSE2SLOW|AV_CPU_FLAG_SSE2;
- if (rval & AV_CPU_FLAG_SSE3) rval ^= AV_CPU_FLAG_SSE3SLOW|AV_CPU_FLAG_SSE3;
+ /* 6/9 (pentium-m "banias"), 6/13 (pentium-m "dothan"), and
+ * 6/14 (core1 "yonah") theoretically support sse2, but it's
+ * usually slower than mmx, so let's just pretend they don't.
+ * AV_CPU_FLAG_SSE2 is disabled and AV_CPU_FLAG_SSE2SLOW is
+ * enabled so that SSE2 is not used unless explicitly enabled
+ * by checking AV_CPU_FLAG_SSE2SLOW. The same situation
+ * applies for AV_CPU_FLAG_SSE3 and AV_CPU_FLAG_SSE3SLOW. */
+ if (rval & AV_CPU_FLAG_SSE2)
+ rval ^= AV_CPU_FLAG_SSE2SLOW | AV_CPU_FLAG_SSE2;
+ if (rval & AV_CPU_FLAG_SSE3)
+ rval ^= AV_CPU_FLAG_SSE3SLOW | AV_CPU_FLAG_SSE3;
}
/* The Atom processor has SSSE3 support, which is useful in many cases,
* but sometimes the SSSE3 version is slower than the SSE2 equivalent
@@ -167,5 +195,7 @@ int ff_get_cpu_flags_x86(void)
rval |= AV_CPU_FLAG_ATOM;
}
+#endif /* cpuid */
+
return rval;
}
diff --git a/gst-libs/ext/libav/libavutil/x86/cpu.h b/gst-libs/ext/libav/libavutil/x86/cpu.h
new file mode 100644
index 0000000..e4f6f0b
--- /dev/null
+++ b/gst-libs/ext/libav/libavutil/x86/cpu.h
@@ -0,0 +1,61 @@
+/*
+ * 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
+ */
+
+#ifndef AVUTIL_X86_CPU_H
+#define AVUTIL_X86_CPU_H
+
+#include "config.h"
+#include "libavutil/cpu.h"
+
+#define CPUEXT(flags, suffix, cpuext) \
+ (HAVE_ ## cpuext ## suffix && ((flags) & AV_CPU_FLAG_ ## cpuext))
+
+#define AV_CPU_FLAG_AMD3DNOW AV_CPU_FLAG_3DNOW
+#define AV_CPU_FLAG_AMD3DNOWEXT AV_CPU_FLAG_3DNOWEXT
+
+#define EXTERNAL_AMD3DNOW(flags) CPUEXT(flags, _EXTERNAL, AMD3DNOW)
+#define EXTERNAL_AMD3DNOWEXT(flags) CPUEXT(flags, _EXTERNAL, AMD3DNOWEXT)
+#define EXTERNAL_MMX(flags) CPUEXT(flags, _EXTERNAL, MMX)
+#define EXTERNAL_MMXEXT(flags) CPUEXT(flags, _EXTERNAL, MMXEXT)
+#define EXTERNAL_SSE(flags) CPUEXT(flags, _EXTERNAL, SSE)
+#define EXTERNAL_SSE2(flags) CPUEXT(flags, _EXTERNAL, SSE2)
+#define EXTERNAL_SSE3(flags) CPUEXT(flags, _EXTERNAL, SSE3)
+#define EXTERNAL_SSSE3(flags) CPUEXT(flags, _EXTERNAL, SSSE3)
+#define EXTERNAL_SSE4(flags) CPUEXT(flags, _EXTERNAL, SSE4)
+#define EXTERNAL_SSE42(flags) CPUEXT(flags, _EXTERNAL, SSE42)
+#define EXTERNAL_AVX(flags) CPUEXT(flags, _EXTERNAL, AVX)
+#define EXTERNAL_FMA4(flags) CPUEXT(flags, _EXTERNAL, FMA4)
+
+#define INLINE_AMD3DNOW(flags) CPUEXT(flags, _INLINE, AMD3DNOW)
+#define INLINE_AMD3DNOWEXT(flags) CPUEXT(flags, _INLINE, AMD3DNOWEXT)
+#define INLINE_MMX(flags) CPUEXT(flags, _INLINE, MMX)
+#define INLINE_MMXEXT(flags) CPUEXT(flags, _INLINE, MMXEXT)
+#define INLINE_SSE(flags) CPUEXT(flags, _INLINE, SSE)
+#define INLINE_SSE2(flags) CPUEXT(flags, _INLINE, SSE2)
+#define INLINE_SSE3(flags) CPUEXT(flags, _INLINE, SSE3)
+#define INLINE_SSSE3(flags) CPUEXT(flags, _INLINE, SSSE3)
+#define INLINE_SSE4(flags) CPUEXT(flags, _INLINE, SSE4)
+#define INLINE_SSE42(flags) CPUEXT(flags, _INLINE, SSE42)
+#define INLINE_AVX(flags) CPUEXT(flags, _INLINE, AVX)
+#define INLINE_FMA4(flags) CPUEXT(flags, _INLINE, FMA4)
+
+void ff_cpu_cpuid(int index, int *eax, int *ebx, int *ecx, int *edx);
+void ff_cpu_xgetbv(int op, int *eax, int *edx);
+int ff_cpu_cpuid_test(void);
+
+#endif /* AVUTIL_X86_CPU_H */
diff --git a/gst-libs/ext/libav/libavutil/x86/cpuid.asm b/gst-libs/ext/libav/libavutil/x86/cpuid.asm
new file mode 100644
index 0000000..e739ebe
--- /dev/null
+++ b/gst-libs/ext/libav/libavutil/x86/cpuid.asm
@@ -0,0 +1,91 @@
+;*****************************************************************************
+;* Copyright (C) 2005-2010 x264 project
+;*
+;* Authors: Loren Merritt <lorenm@u.washington.edu>
+;* Jason Garrett-Glaser <darkshikari@gmail.com>
+;*
+;* 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
+;******************************************************************************
+
+%include "x86util.asm"
+
+SECTION .text
+
+;-----------------------------------------------------------------------------
+; void ff_cpu_cpuid(int index, int *eax, int *ebx, int *ecx, int *edx)
+;-----------------------------------------------------------------------------
+cglobal cpu_cpuid, 5,7
+ push rbx
+ push r4
+ push r3
+ push r2
+ push r1
+ mov eax, r0d
+ xor ecx, ecx
+ cpuid
+ pop r4
+ mov [r4], eax
+ pop r4
+ mov [r4], ebx
+ pop r4
+ mov [r4], ecx
+ pop r4
+ mov [r4], edx
+ pop rbx
+ RET
+
+;-----------------------------------------------------------------------------
+; void ff_cpu_xgetbv(int op, int *eax, int *edx)
+;-----------------------------------------------------------------------------
+cglobal cpu_xgetbv, 3,7
+ push r2
+ push r1
+ mov ecx, r0d
+ xgetbv
+ pop r4
+ mov [r4], eax
+ pop r4
+ mov [r4], edx
+ RET
+
+%if ARCH_X86_64 == 0
+;-----------------------------------------------------------------------------
+; int ff_cpu_cpuid_test(void)
+; return 0 if unsupported
+;-----------------------------------------------------------------------------
+cglobal cpu_cpuid_test
+ pushfd
+ push ebx
+ push ebp
+ push esi
+ push edi
+ pushfd
+ pop eax
+ mov ebx, eax
+ xor eax, 0x200000
+ push eax
+ popfd
+ pushfd
+ pop eax
+ xor eax, ebx
+ pop edi
+ pop esi
+ pop ebp
+ pop ebx
+ popfd
+ ret
+%endif
diff --git a/gst-libs/ext/libav/libavutil/x86/float_dsp.asm b/gst-libs/ext/libav/libavutil/x86/float_dsp.asm
new file mode 100644
index 0000000..4113fd9
--- /dev/null
+++ b/gst-libs/ext/libav/libavutil/x86/float_dsp.asm
@@ -0,0 +1,164 @@
+;*****************************************************************************
+;* x86-optimized Float DSP functions
+;*
+;* 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
+;******************************************************************************
+
+%include "x86util.asm"
+
+SECTION .text
+
+;-----------------------------------------------------------------------------
+; void vector_fmul(float *dst, const float *src0, const float *src1, int len)
+;-----------------------------------------------------------------------------
+%macro VECTOR_FMUL 0
+cglobal vector_fmul, 4,4,2, dst, src0, src1, len
+ lea lenq, [lend*4 - 2*mmsize]
+ALIGN 16
+.loop:
+ mova m0, [src0q + lenq]
+ mova m1, [src0q + lenq + mmsize]
+ mulps m0, m0, [src1q + lenq]
+ mulps m1, m1, [src1q + lenq + mmsize]
+ mova [dstq + lenq], m0
+ mova [dstq + lenq + mmsize], m1
+
+ sub lenq, 2*mmsize
+ jge .loop
+ REP_RET
+%endmacro
+
+INIT_XMM sse
+VECTOR_FMUL
+INIT_YMM avx
+VECTOR_FMUL
+
+;------------------------------------------------------------------------------
+; void ff_vector_fmac_scalar(float *dst, const float *src, float mul, int len)
+;------------------------------------------------------------------------------
+
+%macro VECTOR_FMAC_SCALAR 0
+%if UNIX64
+cglobal vector_fmac_scalar, 3,3,3, dst, src, len
+%else
+cglobal vector_fmac_scalar, 4,4,3, dst, src, mul, len
+%endif
+%if ARCH_X86_32
+ VBROADCASTSS m0, mulm
+%else
+%if WIN64
+ mova xmm0, xmm2
+%endif
+ shufps xmm0, xmm0, 0
+%if cpuflag(avx)
+ vinsertf128 m0, m0, xmm0, 1
+%endif
+%endif
+ lea lenq, [lend*4-2*mmsize]
+.loop:
+ mulps m1, m0, [srcq+lenq ]
+ mulps m2, m0, [srcq+lenq+mmsize]
+ addps m1, m1, [dstq+lenq ]
+ addps m2, m2, [dstq+lenq+mmsize]
+ mova [dstq+lenq ], m1
+ mova [dstq+lenq+mmsize], m2
+ sub lenq, 2*mmsize
+ jge .loop
+ REP_RET
+%endmacro
+
+INIT_XMM sse
+VECTOR_FMAC_SCALAR
+INIT_YMM avx
+VECTOR_FMAC_SCALAR
+
+;------------------------------------------------------------------------------
+; void ff_vector_fmul_scalar(float *dst, const float *src, float mul, int len)
+;------------------------------------------------------------------------------
+
+%macro VECTOR_FMUL_SCALAR 0
+%if UNIX64
+cglobal vector_fmul_scalar, 3,3,2, dst, src, len
+%else
+cglobal vector_fmul_scalar, 4,4,3, dst, src, mul, len
+%endif
+%if ARCH_X86_32
+ movss m0, mulm
+%elif WIN64
+ SWAP 0, 2
+%endif
+ shufps m0, m0, 0
+ lea lenq, [lend*4-mmsize]
+.loop:
+ mova m1, [srcq+lenq]
+ mulps m1, m0
+ mova [dstq+lenq], m1
+ sub lenq, mmsize
+ jge .loop
+ REP_RET
+%endmacro
+
+INIT_XMM sse
+VECTOR_FMUL_SCALAR
+
+;------------------------------------------------------------------------------
+; void ff_vector_dmul_scalar(double *dst, const double *src, double mul,
+; int len)
+;------------------------------------------------------------------------------
+
+%macro VECTOR_DMUL_SCALAR 0
+%if ARCH_X86_32
+cglobal vector_dmul_scalar, 3,4,3, dst, src, mul, len, lenaddr
+ mov lenq, lenaddrm
+%elif UNIX64
+cglobal vector_dmul_scalar, 3,3,3, dst, src, len
+%else
+cglobal vector_dmul_scalar, 4,4,3, dst, src, mul, len
+%endif
+%if ARCH_X86_32
+ VBROADCASTSD m0, mulm
+%else
+%if WIN64
+ movlhps xmm2, xmm2
+%if cpuflag(avx)
+ vinsertf128 ymm2, ymm2, xmm2, 1
+%endif
+ SWAP 0, 2
+%else
+ movlhps xmm0, xmm0
+%if cpuflag(avx)
+ vinsertf128 ymm0, ymm0, xmm0, 1
+%endif
+%endif
+%endif
+ lea lenq, [lend*8-2*mmsize]
+.loop:
+ mulpd m1, m0, [srcq+lenq ]
+ mulpd m2, m0, [srcq+lenq+mmsize]
+ mova [dstq+lenq ], m1
+ mova [dstq+lenq+mmsize], m2
+ sub lenq, 2*mmsize
+ jge .loop
+ REP_RET
+%endmacro
+
+INIT_XMM sse2
+VECTOR_DMUL_SCALAR
+%if HAVE_AVX_EXTERNAL
+INIT_YMM avx
+VECTOR_DMUL_SCALAR
+%endif
diff --git a/gst-libs/ext/libav/libavutil/x86/float_dsp_init.c b/gst-libs/ext/libav/libavutil/x86/float_dsp_init.c
new file mode 100644
index 0000000..b3b7ff4
--- /dev/null
+++ b/gst-libs/ext/libav/libavutil/x86/float_dsp_init.c
@@ -0,0 +1,60 @@
+/*
+ * 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
+ */
+
+#include "config.h"
+
+#include "libavutil/cpu.h"
+#include "libavutil/float_dsp.h"
+#include "cpu.h"
+
+extern void ff_vector_fmul_sse(float *dst, const float *src0, const float *src1,
+ int len);
+extern void ff_vector_fmul_avx(float *dst, const float *src0, const float *src1,
+ int len);
+
+extern void ff_vector_fmac_scalar_sse(float *dst, const float *src, float mul,
+ int len);
+extern void ff_vector_fmac_scalar_avx(float *dst, const float *src, float mul,
+ int len);
+
+extern void ff_vector_fmul_scalar_sse(float *dst, const float *src, float mul,
+ int len);
+
+extern void ff_vector_dmul_scalar_sse2(double *dst, const double *src,
+ double mul, int len);
+extern void ff_vector_dmul_scalar_avx(double *dst, const double *src,
+ double mul, int len);
+
+void ff_float_dsp_init_x86(AVFloatDSPContext *fdsp)
+{
+ int mm_flags = av_get_cpu_flags();
+
+ if (EXTERNAL_SSE(mm_flags)) {
+ fdsp->vector_fmul = ff_vector_fmul_sse;
+ fdsp->vector_fmac_scalar = ff_vector_fmac_scalar_sse;
+ fdsp->vector_fmul_scalar = ff_vector_fmul_scalar_sse;
+ }
+ if (EXTERNAL_SSE2(mm_flags)) {
+ fdsp->vector_dmul_scalar = ff_vector_dmul_scalar_sse2;
+ }
+ if (EXTERNAL_AVX(mm_flags)) {
+ fdsp->vector_fmul = ff_vector_fmul_avx;
+ fdsp->vector_fmac_scalar = ff_vector_fmac_scalar_avx;
+ fdsp->vector_dmul_scalar = ff_vector_dmul_scalar_avx;
+ }
+}
diff --git a/gst-libs/ext/libav/libavutil/x86/intmath.h b/gst-libs/ext/libav/libavutil/x86/intmath.h
deleted file mode 100644
index a7e82b1..0000000
--- a/gst-libs/ext/libav/libavutil/x86/intmath.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (c) 2010 Mans Rullgard <mans@mansr.com>
- *
- * 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
- */
-
-#ifndef AVUTIL_X86_INTMATH_H
-#define AVUTIL_X86_INTMATH_H
-
-#define FASTDIV(a,b) \
- ({\
- int ret, dmy;\
- __asm__ volatile(\
- "mull %3"\
- :"=d"(ret), "=a"(dmy)\
- :"1"(a), "g"(ff_inverse[b])\
- );\
- ret;\
- })
-
-#endif /* AVUTIL_X86_INTMATH_H */
diff --git a/gst-libs/ext/libav/libavutil/x86/timer.h b/gst-libs/ext/libav/libavutil/x86/timer.h
index 7f51816..35e614d 100644
--- a/gst-libs/ext/libav/libavutil/x86/timer.h
+++ b/gst-libs/ext/libav/libavutil/x86/timer.h
@@ -23,6 +23,8 @@
#include <stdint.h>
+#if HAVE_INLINE_ASM
+
#define AV_READ_TIME read_time
static inline uint64_t read_time(void)
@@ -32,4 +34,10 @@ static inline uint64_t read_time(void)
return ((uint64_t)d << 32) + a;
}
+#elif HAVE_RDTSC
+
+#define AV_READ_TIME __rdtsc
+
+#endif /* HAVE_INLINE_ASM */
+
#endif /* AVUTIL_X86_TIMER_H */
diff --git a/gst-libs/ext/libav/libavutil/x86/w64xmmtest.h b/gst-libs/ext/libav/libavutil/x86/w64xmmtest.h
new file mode 100644
index 0000000..b4ce7d3
--- /dev/null
+++ b/gst-libs/ext/libav/libavutil/x86/w64xmmtest.h
@@ -0,0 +1,73 @@
+/*
+ * check XMM registers for clobbers on Win64
+ * Copyright (c) 2008 Ramiro Polla <ramiro.polla@gmail.com>
+ *
+ * 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
+ */
+
+#include <inttypes.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+
+#include "libavutil/bswap.h"
+
+#define storexmmregs(mem) \
+ __asm__ volatile( \
+ "movups %%xmm6 , 0x00(%0)\n\t" \
+ "movups %%xmm7 , 0x10(%0)\n\t" \
+ "movups %%xmm8 , 0x20(%0)\n\t" \
+ "movups %%xmm9 , 0x30(%0)\n\t" \
+ "movups %%xmm10, 0x40(%0)\n\t" \
+ "movups %%xmm11, 0x50(%0)\n\t" \
+ "movups %%xmm12, 0x60(%0)\n\t" \
+ "movups %%xmm13, 0x70(%0)\n\t" \
+ "movups %%xmm14, 0x80(%0)\n\t" \
+ "movups %%xmm15, 0x90(%0)\n\t" \
+ :: "r"(mem) : "memory")
+
+#define testxmmclobbers(func, ctx, ...) \
+ uint64_t xmm[2][10][2]; \
+ int ret; \
+ storexmmregs(xmm[0]); \
+ ret = __real_ ## func(ctx, __VA_ARGS__); \
+ storexmmregs(xmm[1]); \
+ if (memcmp(xmm[0], xmm[1], sizeof(xmm[0]))) { \
+ int i; \
+ av_log(ctx, AV_LOG_ERROR, \
+ "XMM REGS CLOBBERED IN %s!\n", #func); \
+ for (i = 0; i < 10; i ++) \
+ if (xmm[0][i][0] != xmm[1][i][0] || \
+ xmm[0][i][1] != xmm[1][i][1]) { \
+ av_log(ctx, AV_LOG_ERROR, \
+ "xmm%-2d = %016"PRIx64"%016"PRIx64"\n", \
+ 6 + i, av_bswap64(xmm[0][i][0]), \
+ av_bswap64(xmm[0][i][1])); \
+ av_log(ctx, AV_LOG_ERROR, \
+ " -> %016"PRIx64"%016"PRIx64"\n", \
+ av_bswap64(xmm[1][i][0]), \
+ av_bswap64(xmm[1][i][1])); \
+ } \
+ abort(); \
+ } \
+ return ret
+
+#define wrap(func) \
+int __real_ ## func; \
+int __wrap_ ## func; \
+int __wrap_ ## func
diff --git a/gst-libs/ext/libav/libavutil/x86/x86inc.asm b/gst-libs/ext/libav/libavutil/x86/x86inc.asm
index 6941c1a..2617cdf 100644
--- a/gst-libs/ext/libav/libavutil/x86/x86inc.asm
+++ b/gst-libs/ext/libav/libavutil/x86/x86inc.asm
@@ -1,11 +1,12 @@
;*****************************************************************************
;* x86inc.asm: x264asm abstraction layer
;*****************************************************************************
-;* Copyright (C) 2005-2011 x264 project
+;* Copyright (C) 2005-2012 x264 project
;*
;* Authors: Loren Merritt <lorenm@u.washington.edu>
;* Anton Mitrofanov <BugMaster@narod.ru>
;* Jason Garrett-Glaser <darkshikari@gmail.com>
+;* Henrik Gramner <hengar-6@student.ltu.se>
;*
;* Permission to use, copy, modify, and/or distribute this software for any
;* purpose with or without fee is hereby granted, provided that the above
@@ -33,13 +34,19 @@
; as this feature might be useful for others as well. Send patches or ideas
; to x264-devel@videolan.org .
-%define program_name ff
+%ifndef program_name
+ %define program_name x264
+%endif
-%ifdef ARCH_X86_64
+%define WIN64 0
+%define UNIX64 0
+%if ARCH_X86_64
%ifidn __OUTPUT_FORMAT__,win32
- %define WIN64
+ %define WIN64 1
+ %elifidn __OUTPUT_FORMAT__,win64
+ %define WIN64 1
%else
- %define UNIX64
+ %define UNIX64 1
%endif
%endif
@@ -49,11 +56,6 @@
%define mangle(x) x
%endif
-; FIXME: All of the 64bit asm functions that take a stride as an argument
-; via register, assume that the high dword of that register is filled with 0.
-; This is true in practice (since we never do any 64bit arithmetic on strides,
-; and x264's strides are all positive), but is not guaranteed by the ABI.
-
; Name of the .rodata section.
; Kludge: Something on OS X fails to align .rodata even given an align attribute,
; so use a different read-only section.
@@ -79,9 +81,9 @@
%endif
%endmacro
-%ifdef WIN64
+%if WIN64
%define PIC
-%elifndef ARCH_X86_64
+%elif ARCH_X86_64 == 0
; x86_32 doesn't require PIC.
; Some distros prefer shared objects to be PIC, but nothing breaks if
; the code contains a few textrels, so we'll skip that complexity.
@@ -91,6 +93,15 @@
default rel
%endif
+%macro CPUNOP 1
+ %if HAVE_CPUNOP
+ CPU %1
+ %endif
+%endmacro
+
+; Always use long nops (reduces 0x90 spam in disassembly on x86_32)
+CPUNOP amdnop
+
; Macros to eliminate most code duplication between x86_32 and x86_64:
; Currently this works only for leaf functions which load all their arguments
; into registers at the start, and make no other use of the stack. Luckily that
@@ -100,7 +111,12 @@
; %1 = number of arguments. loads them from stack if needed.
; %2 = number of registers used. pushes callee-saved regs if needed.
; %3 = number of xmm registers used. pushes callee-saved xmm regs if needed.
-; %4 = list of names to define to registers
+; %4 = (optional) stack size to be allocated. If not aligned (x86-32 ICC 10.x,
+; MSVC or YMM), the stack will be manually aligned (to 16 or 32 bytes),
+; and an extra register will be allocated to hold the original stack
+; pointer (to not invalidate r0m etc.). To prevent the use of an extra
+; register as stack pointer, request a negative stack size.
+; %4+/%5+ = list of names to define to registers
; PROLOGUE can also be invoked by adding the same options to cglobal
; e.g.
@@ -121,46 +137,53 @@
; registers:
; rN and rNq are the native-size register holding function argument N
; rNd, rNw, rNb are dword, word, and byte size
+; rNh is the high 8 bits of the word size
; rNm is the original location of arg N (a register or on the stack), dword
; rNmp is native size
-%macro DECLARE_REG 6
+%macro DECLARE_REG 2-3
%define r%1q %2
- %define r%1d %3
- %define r%1w %4
- %define r%1b %5
- %define r%1m %6
- %ifid %6 ; i.e. it's a register
+ %define r%1d %2d
+ %define r%1w %2w
+ %define r%1b %2b
+ %define r%1h %2h
+ %define %2q %2
+ %if %0 == 2
+ %define r%1m %2d
%define r%1mp %2
- %elifdef ARCH_X86_64 ; memory
- %define r%1mp qword %6
+ %elif ARCH_X86_64 ; memory
+ %define r%1m [rstk + stack_offset + %3]
+ %define r%1mp qword r %+ %1 %+ m
%else
- %define r%1mp dword %6
+ %define r%1m [rstk + stack_offset + %3]
+ %define r%1mp dword r %+ %1 %+ m
%endif
%define r%1 %2
%endmacro
-%macro DECLARE_REG_SIZE 2
+%macro DECLARE_REG_SIZE 3
%define r%1q r%1
%define e%1q r%1
%define r%1d e%1
%define e%1d e%1
%define r%1w %1
%define e%1w %1
+ %define r%1h %3
+ %define e%1h %3
%define r%1b %2
%define e%1b %2
-%ifndef ARCH_X86_64
+%if ARCH_X86_64 == 0
%define r%1 e%1
%endif
%endmacro
-DECLARE_REG_SIZE ax, al
-DECLARE_REG_SIZE bx, bl
-DECLARE_REG_SIZE cx, cl
-DECLARE_REG_SIZE dx, dl
-DECLARE_REG_SIZE si, sil
-DECLARE_REG_SIZE di, dil
-DECLARE_REG_SIZE bp, bpl
+DECLARE_REG_SIZE ax, al, ah
+DECLARE_REG_SIZE bx, bl, bh
+DECLARE_REG_SIZE cx, cl, ch
+DECLARE_REG_SIZE dx, dl, dh
+DECLARE_REG_SIZE si, sil, null
+DECLARE_REG_SIZE di, dil, null
+DECLARE_REG_SIZE bp, bpl, null
; t# defines for when per-arch register allocation is more complex than just function arguments
@@ -178,14 +201,15 @@ DECLARE_REG_SIZE bp, bpl
%define t%1q t%1 %+ q
%define t%1d t%1 %+ d
%define t%1w t%1 %+ w
+ %define t%1h t%1 %+ h
%define t%1b t%1 %+ b
%rotate 1
%endrep
%endmacro
-DECLARE_REG_TMP_SIZE 0,1,2,3,4,5,6,7,8,9
+DECLARE_REG_TMP_SIZE 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14
-%ifdef ARCH_X86_64
+%if ARCH_X86_64
%define gprsize 8
%else
%define gprsize 4
@@ -193,24 +217,55 @@ DECLARE_REG_TMP_SIZE 0,1,2,3,4,5,6,7,8,9
%macro PUSH 1
push %1
- %assign stack_offset stack_offset+gprsize
+ %ifidn rstk, rsp
+ %assign stack_offset stack_offset+gprsize
+ %endif
%endmacro
%macro POP 1
pop %1
- %assign stack_offset stack_offset-gprsize
+ %ifidn rstk, rsp
+ %assign stack_offset stack_offset-gprsize
+ %endif
+%endmacro
+
+%macro PUSH_IF_USED 1-*
+ %rep %0
+ %if %1 < regs_used
+ PUSH r%1
+ %endif
+ %rotate 1
+ %endrep
+%endmacro
+
+%macro POP_IF_USED 1-*
+ %rep %0
+ %if %1 < regs_used
+ pop r%1
+ %endif
+ %rotate 1
+ %endrep
+%endmacro
+
+%macro LOAD_IF_USED 1-*
+ %rep %0
+ %if %1 < num_args
+ mov r%1, r %+ %1 %+ mp
+ %endif
+ %rotate 1
+ %endrep
%endmacro
%macro SUB 2
sub %1, %2
- %ifidn %1, rsp
+ %ifidn %1, rstk
%assign stack_offset stack_offset+(%2)
%endif
%endmacro
%macro ADD 2
add %1, %2
- %ifidn %1, rsp
+ %ifidn %1, rstk
%assign stack_offset stack_offset-(%2)
%endif
%endmacro
@@ -240,75 +295,154 @@ DECLARE_REG_TMP_SIZE 0,1,2,3,4,5,6,7,8,9
CAT_UNDEF arg_name %+ %%i, q
CAT_UNDEF arg_name %+ %%i, d
CAT_UNDEF arg_name %+ %%i, w
+ CAT_UNDEF arg_name %+ %%i, h
CAT_UNDEF arg_name %+ %%i, b
CAT_UNDEF arg_name %+ %%i, m
+ CAT_UNDEF arg_name %+ %%i, mp
CAT_UNDEF arg_name, %%i
%assign %%i %%i+1
%endrep
%endif
+ %xdefine %%stack_offset stack_offset
+ %undef stack_offset ; so that the current value of stack_offset doesn't get baked in by xdefine
%assign %%i 0
%rep %0
%xdefine %1q r %+ %%i %+ q
%xdefine %1d r %+ %%i %+ d
%xdefine %1w r %+ %%i %+ w
+ %xdefine %1h r %+ %%i %+ h
%xdefine %1b r %+ %%i %+ b
%xdefine %1m r %+ %%i %+ m
+ %xdefine %1mp r %+ %%i %+ mp
CAT_XDEFINE arg_name, %%i, %1
%assign %%i %%i+1
%rotate 1
%endrep
- %assign n_arg_names %%i
+ %xdefine stack_offset %%stack_offset
+ %assign n_arg_names %0
+%endmacro
+
+%macro ALLOC_STACK 1-2 0 ; stack_size, n_xmm_regs (for win64 only)
+ %ifnum %1
+ %if %1 != 0
+ %assign %%stack_alignment ((mmsize + 15) & ~15)
+ %assign stack_size %1
+ %if stack_size < 0
+ %assign stack_size -stack_size
+ %endif
+ %if mmsize != 8
+ %assign xmm_regs_used %2
+ %endif
+ %if mmsize <= 16 && HAVE_ALIGNED_STACK
+ %assign stack_size_padded stack_size + %%stack_alignment - gprsize - (stack_offset & (%%stack_alignment - 1))
+ %if xmm_regs_used > 6
+ %assign stack_size_padded stack_size_padded + (xmm_regs_used - 6) * 16
+ %endif
+ SUB rsp, stack_size_padded
+ %else
+ %assign %%reg_num (regs_used - 1)
+ %xdefine rstk r %+ %%reg_num
+ ; align stack, and save original stack location directly above
+ ; it, i.e. in [rsp+stack_size_padded], so we can restore the
+ ; stack in a single instruction (i.e. mov rsp, rstk or mov
+ ; rsp, [rsp+stack_size_padded])
+ mov rstk, rsp
+ %assign stack_size_padded stack_size
+ %if xmm_regs_used > 6
+ %assign stack_size_padded stack_size_padded + (xmm_regs_used - 6) * 16
+ %if mmsize == 32 && xmm_regs_used & 1
+ ; re-align to 32 bytes
+ %assign stack_size_padded (stack_size_padded + 16)
+ %endif
+ %endif
+ %if %1 < 0 ; need to store rsp on stack
+ sub rsp, gprsize+stack_size_padded
+ and rsp, ~(%%stack_alignment-1)
+ %xdefine rstkm [rsp+stack_size_padded]
+ mov rstkm, rstk
+ %else ; can keep rsp in rstk during whole function
+ sub rsp, stack_size_padded
+ and rsp, ~(%%stack_alignment-1)
+ %xdefine rstkm rstk
+ %endif
+ %endif
+ %if xmm_regs_used > 6
+ WIN64_PUSH_XMM
+ %endif
+ %endif
+ %endif
+%endmacro
+
+%macro SETUP_STACK_POINTER 1
+ %ifnum %1
+ %if %1 != 0 && (HAVE_ALIGNED_STACK == 0 || mmsize == 32)
+ %if %1 > 0
+ %assign regs_used (regs_used + 1)
+ %elif ARCH_X86_64 && regs_used == num_args && num_args <= 4 + UNIX64 * 2
+ %warning "Stack pointer will overwrite register argument"
+ %endif
+ %endif
+ %endif
%endmacro
-%ifdef WIN64 ; Windows x64 ;=================================================
-
-DECLARE_REG 0, rcx, ecx, cx, cl, ecx
-DECLARE_REG 1, rdx, edx, dx, dl, edx
-DECLARE_REG 2, r8, r8d, r8w, r8b, r8d
-DECLARE_REG 3, r9, r9d, r9w, r9b, r9d
-DECLARE_REG 4, rdi, edi, di, dil, [rsp + stack_offset + 40]
-DECLARE_REG 5, rsi, esi, si, sil, [rsp + stack_offset + 48]
-DECLARE_REG 6, rax, eax, ax, al, [rsp + stack_offset + 56]
-%define r7m [rsp + stack_offset + 64]
-%define r8m [rsp + stack_offset + 72]
-
-%macro LOAD_IF_USED 2 ; reg_id, number_of_args
- %if %1 < %2
- mov r%1, [rsp + stack_offset + 8 + %1*8]
+%macro DEFINE_ARGS_INTERNAL 3+
+ %ifnum %2
+ DEFINE_ARGS %3
+ %elif %1 == 4
+ DEFINE_ARGS %2
+ %elif %1 > 4
+ DEFINE_ARGS %2, %3
%endif
%endmacro
-%macro PROLOGUE 2-4+ 0 ; #args, #regs, #xmm_regs, arg_names...
- ASSERT %2 >= %1
+%if WIN64 ; Windows x64 ;=================================================
+
+DECLARE_REG 0, rcx
+DECLARE_REG 1, rdx
+DECLARE_REG 2, R8
+DECLARE_REG 3, R9
+DECLARE_REG 4, R10, 40
+DECLARE_REG 5, R11, 48
+DECLARE_REG 6, rax, 56
+DECLARE_REG 7, rdi, 64
+DECLARE_REG 8, rsi, 72
+DECLARE_REG 9, rbx, 80
+DECLARE_REG 10, rbp, 88
+DECLARE_REG 11, R12, 96
+DECLARE_REG 12, R13, 104
+DECLARE_REG 13, R14, 112
+DECLARE_REG 14, R15, 120
+
+%macro PROLOGUE 2-5+ 0 ; #args, #regs, #xmm_regs, [stack_size,] arg_names...
+ %assign num_args %1
%assign regs_used %2
- ASSERT regs_used <= 7
- %if regs_used > 4
- push r4
- push r5
- %assign stack_offset stack_offset+16
+ ASSERT regs_used >= num_args
+ SETUP_STACK_POINTER %4
+ ASSERT regs_used <= 15
+ PUSH_IF_USED 7, 8, 9, 10, 11, 12, 13, 14
+ ALLOC_STACK %4, %3
+ %if mmsize != 8 && stack_size == 0
+ WIN64_SPILL_XMM %3
%endif
- WIN64_SPILL_XMM %3
- LOAD_IF_USED 4, %1
- LOAD_IF_USED 5, %1
- LOAD_IF_USED 6, %1
- DEFINE_ARGS %4
+ LOAD_IF_USED 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14
+ DEFINE_ARGS_INTERNAL %0, %4, %5
+%endmacro
+
+%macro WIN64_PUSH_XMM 0
+ %assign %%i xmm_regs_used
+ %rep (xmm_regs_used-6)
+ %assign %%i %%i-1
+ movdqa [rsp + (%%i-6)*16 + stack_size + (~stack_offset&8)], xmm %+ %%i
+ %endrep
%endmacro
%macro WIN64_SPILL_XMM 1
%assign xmm_regs_used %1
- %if mmsize == 8
- %assign xmm_regs_used 0
- %endif
ASSERT xmm_regs_used <= 16
%if xmm_regs_used > 6
- sub rsp, (xmm_regs_used-6)*16+16
- %assign stack_offset stack_offset+(xmm_regs_used-6)*16+16
- %assign %%i xmm_regs_used
- %rep (xmm_regs_used-6)
- %assign %%i %%i-1
- movdqa [rsp + (%%i-6)*16+8], xmm %+ %%i
- %endrep
+ SUB rsp, (xmm_regs_used-6)*16+16
+ WIN64_PUSH_XMM
%endif
%endmacro
@@ -317,144 +451,168 @@ DECLARE_REG 6, rax, eax, ax, al, [rsp + stack_offset + 56]
%assign %%i xmm_regs_used
%rep (xmm_regs_used-6)
%assign %%i %%i-1
- movdqa xmm %+ %%i, [%1 + (%%i-6)*16+8]
+ movdqa xmm %+ %%i, [%1 + (%%i-6)*16+stack_size+(~stack_offset&8)]
%endrep
- add %1, (xmm_regs_used-6)*16+16
+ %if stack_size_padded == 0
+ add %1, (xmm_regs_used-6)*16+16
+ %endif
+ %endif
+ %if stack_size_padded > 0
+ %if stack_size > 0 && (mmsize == 32 || HAVE_ALIGNED_STACK == 0)
+ mov rsp, rstkm
+ %else
+ add %1, stack_size_padded
+ %endif
%endif
%endmacro
%macro WIN64_RESTORE_XMM 1
WIN64_RESTORE_XMM_INTERNAL %1
- %assign stack_offset stack_offset-(xmm_regs_used-6)*16+16
+ %assign stack_offset (stack_offset-stack_size_padded)
%assign xmm_regs_used 0
%endmacro
+%define has_epilogue regs_used > 7 || xmm_regs_used > 6 || mmsize == 32 || stack_size > 0
+
%macro RET 0
WIN64_RESTORE_XMM_INTERNAL rsp
- %if regs_used > 4
- pop r5
- pop r4
- %endif
+ POP_IF_USED 14, 13, 12, 11, 10, 9, 8, 7
+%if mmsize == 32
+ vzeroupper
+%endif
ret
%endmacro
-%macro REP_RET 0
- %if regs_used > 4 || xmm_regs_used > 6
- RET
- %else
- rep ret
- %endif
-%endmacro
-
-%elifdef ARCH_X86_64 ; *nix x64 ;=============================================
-
-DECLARE_REG 0, rdi, edi, di, dil, edi
-DECLARE_REG 1, rsi, esi, si, sil, esi
-DECLARE_REG 2, rdx, edx, dx, dl, edx
-DECLARE_REG 3, rcx, ecx, cx, cl, ecx
-DECLARE_REG 4, r8, r8d, r8w, r8b, r8d
-DECLARE_REG 5, r9, r9d, r9w, r9b, r9d
-DECLARE_REG 6, rax, eax, ax, al, [rsp + stack_offset + 8]
-%define r7m [rsp + stack_offset + 16]
-%define r8m [rsp + stack_offset + 24]
-
-%macro LOAD_IF_USED 2 ; reg_id, number_of_args
- %if %1 < %2
- mov r%1, [rsp - 40 + %1*8]
- %endif
+%elif ARCH_X86_64 ; *nix x64 ;=============================================
+
+DECLARE_REG 0, rdi
+DECLARE_REG 1, rsi
+DECLARE_REG 2, rdx
+DECLARE_REG 3, rcx
+DECLARE_REG 4, R8
+DECLARE_REG 5, R9
+DECLARE_REG 6, rax, 8
+DECLARE_REG 7, R10, 16
+DECLARE_REG 8, R11, 24
+DECLARE_REG 9, rbx, 32
+DECLARE_REG 10, rbp, 40
+DECLARE_REG 11, R12, 48
+DECLARE_REG 12, R13, 56
+DECLARE_REG 13, R14, 64
+DECLARE_REG 14, R15, 72
+
+%macro PROLOGUE 2-5+ ; #args, #regs, #xmm_regs, [stack_size,] arg_names...
+ %assign num_args %1
+ %assign regs_used %2
+ ASSERT regs_used >= num_args
+ SETUP_STACK_POINTER %4
+ ASSERT regs_used <= 15
+ PUSH_IF_USED 9, 10, 11, 12, 13, 14
+ ALLOC_STACK %4
+ LOAD_IF_USED 6, 7, 8, 9, 10, 11, 12, 13, 14
+ DEFINE_ARGS_INTERNAL %0, %4, %5
%endmacro
-%macro PROLOGUE 2-4+ ; #args, #regs, #xmm_regs, arg_names...
- ASSERT %2 >= %1
- ASSERT %2 <= 7
- LOAD_IF_USED 6, %1
- DEFINE_ARGS %4
-%endmacro
+%define has_epilogue regs_used > 9 || mmsize == 32 || stack_size > 0
%macro RET 0
+%if stack_size_padded > 0
+%if mmsize == 32 || HAVE_ALIGNED_STACK == 0
+ mov rsp, rstkm
+%else
+ add rsp, stack_size_padded
+%endif
+%endif
+ POP_IF_USED 14, 13, 12, 11, 10, 9
+%if mmsize == 32
+ vzeroupper
+%endif
ret
%endmacro
-%macro REP_RET 0
- rep ret
-%endmacro
-
%else ; X86_32 ;==============================================================
-DECLARE_REG 0, eax, eax, ax, al, [esp + stack_offset + 4]
-DECLARE_REG 1, ecx, ecx, cx, cl, [esp + stack_offset + 8]
-DECLARE_REG 2, edx, edx, dx, dl, [esp + stack_offset + 12]
-DECLARE_REG 3, ebx, ebx, bx, bl, [esp + stack_offset + 16]
-DECLARE_REG 4, esi, esi, si, null, [esp + stack_offset + 20]
-DECLARE_REG 5, edi, edi, di, null, [esp + stack_offset + 24]
-DECLARE_REG 6, ebp, ebp, bp, null, [esp + stack_offset + 28]
-%define r7m [esp + stack_offset + 32]
-%define r8m [esp + stack_offset + 36]
+DECLARE_REG 0, eax, 4
+DECLARE_REG 1, ecx, 8
+DECLARE_REG 2, edx, 12
+DECLARE_REG 3, ebx, 16
+DECLARE_REG 4, esi, 20
+DECLARE_REG 5, edi, 24
+DECLARE_REG 6, ebp, 28
%define rsp esp
-%macro PUSH_IF_USED 1 ; reg_id
- %if %1 < regs_used
- push r%1
- %assign stack_offset stack_offset+4
- %endif
-%endmacro
-
-%macro POP_IF_USED 1 ; reg_id
- %if %1 < regs_used
- pop r%1
- %endif
+%macro DECLARE_ARG 1-*
+ %rep %0
+ %define r%1m [rstk + stack_offset + 4*%1 + 4]
+ %define r%1mp dword r%1m
+ %rotate 1
+ %endrep
%endmacro
-%macro LOAD_IF_USED 2 ; reg_id, number_of_args
- %if %1 < %2
- mov r%1, [esp + stack_offset + 4 + %1*4]
- %endif
-%endmacro
+DECLARE_ARG 7, 8, 9, 10, 11, 12, 13, 14
-%macro PROLOGUE 2-4+ ; #args, #regs, #xmm_regs, arg_names...
- ASSERT %2 >= %1
+%macro PROLOGUE 2-5+ ; #args, #regs, #xmm_regs, [stack_size,] arg_names...
+ %assign num_args %1
%assign regs_used %2
+ ASSERT regs_used >= num_args
+ %if num_args > 7
+ %assign num_args 7
+ %endif
+ %if regs_used > 7
+ %assign regs_used 7
+ %endif
+ SETUP_STACK_POINTER %4
ASSERT regs_used <= 7
- PUSH_IF_USED 3
- PUSH_IF_USED 4
- PUSH_IF_USED 5
- PUSH_IF_USED 6
- LOAD_IF_USED 0, %1
- LOAD_IF_USED 1, %1
- LOAD_IF_USED 2, %1
- LOAD_IF_USED 3, %1
- LOAD_IF_USED 4, %1
- LOAD_IF_USED 5, %1
- LOAD_IF_USED 6, %1
- DEFINE_ARGS %4
+ PUSH_IF_USED 3, 4, 5, 6
+ ALLOC_STACK %4
+ LOAD_IF_USED 0, 1, 2, 3, 4, 5, 6
+ DEFINE_ARGS_INTERNAL %0, %4, %5
%endmacro
+%define has_epilogue regs_used > 3 || mmsize == 32 || stack_size > 0
+
%macro RET 0
- POP_IF_USED 6
- POP_IF_USED 5
- POP_IF_USED 4
- POP_IF_USED 3
+%if stack_size_padded > 0
+%if mmsize == 32 || HAVE_ALIGNED_STACK == 0
+ mov rsp, rstkm
+%else
+ add rsp, stack_size_padded
+%endif
+%endif
+ POP_IF_USED 6, 5, 4, 3
+%if mmsize == 32
+ vzeroupper
+%endif
ret
%endmacro
-%macro REP_RET 0
- %if regs_used > 3
- RET
- %else
- rep ret
- %endif
-%endmacro
-
%endif ;======================================================================
-%ifndef WIN64
+%if WIN64 == 0
%macro WIN64_SPILL_XMM 1
%endmacro
%macro WIN64_RESTORE_XMM 1
%endmacro
+%macro WIN64_PUSH_XMM 0
+%endmacro
%endif
+%macro REP_RET 0
+ %if has_epilogue
+ RET
+ %else
+ rep ret
+ %endif
+%endmacro
+%macro TAIL_CALL 2 ; callee, is_nonadjacent
+ %if has_epilogue
+ call %1
+ RET
+ %elif %2
+ jmp %1
+ %endif
+%endmacro
;=============================================================================
; arch-independent part
@@ -466,12 +624,10 @@ DECLARE_REG 6, ebp, ebp, bp, null, [esp + stack_offset + 28]
; Applies any symbol mangling needed for C linkage, and sets up a define such that
; subsequent uses of the function name automatically refer to the mangled version.
; Appends cpuflags to the function name if cpuflags has been specified.
-%macro cglobal 1-2+ ; name, [PROLOGUE args]
-%if %0 == 1
- cglobal_internal %1 %+ SUFFIX
-%else
+%macro cglobal 1-2+ "" ; name, [PROLOGUE args]
+ ; the "" is a workaround for nasm, which fails if SUFFIX is empty
+ ; and we call cglobal_internal with just %1 %+ SUFFIX (without %2)
cglobal_internal %1 %+ SUFFIX, %2
-%endif
%endmacro
%macro cglobal_internal 1-2+
%ifndef cglobaled_%1
@@ -488,8 +644,12 @@ DECLARE_REG 6, ebp, ebp, bp, null, [esp + stack_offset + 28]
align function_align
%1:
RESET_MM_PERMUTATION ; not really needed, but makes disassembly somewhat nicer
+ %xdefine rstk rsp
%assign stack_offset 0
- %if %0 > 1
+ %assign stack_size 0
+ %assign stack_size_padded 0
+ %assign xmm_regs_used 0
+ %ifnidn %2, ""
PROLOGUE %2
%endif
%endmacro
@@ -524,7 +684,7 @@ SECTION .note.GNU-stack noalloc noexec nowrite progbits
%assign cpuflags_mmx (1<<0)
%assign cpuflags_mmx2 (1<<1) | cpuflags_mmx
%assign cpuflags_3dnow (1<<2) | cpuflags_mmx
-%assign cpuflags_3dnow2 (1<<3) | cpuflags_3dnow
+%assign cpuflags_3dnowext (1<<3) | cpuflags_3dnow
%assign cpuflags_sse (1<<4) | cpuflags_mmx2
%assign cpuflags_sse2 (1<<5) | cpuflags_sse
%assign cpuflags_sse2slow (1<<6) | cpuflags_sse2
@@ -535,6 +695,8 @@ SECTION .note.GNU-stack noalloc noexec nowrite progbits
%assign cpuflags_avx (1<<11)| cpuflags_sse42
%assign cpuflags_xop (1<<12)| cpuflags_avx
%assign cpuflags_fma4 (1<<13)| cpuflags_avx
+%assign cpuflags_avx2 (1<<14)| cpuflags_avx
+%assign cpuflags_fma3 (1<<15)| cpuflags_avx
%assign cpuflags_cache32 (1<<16)
%assign cpuflags_cache64 (1<<17)
@@ -543,6 +705,9 @@ SECTION .note.GNU-stack noalloc noexec nowrite progbits
%assign cpuflags_misalign (1<<20)
%assign cpuflags_aligned (1<<21) ; not a cpu feature, but a function variant
%assign cpuflags_atom (1<<22)
+%assign cpuflags_bmi1 (1<<23)
+%assign cpuflags_bmi2 (1<<24)|cpuflags_bmi1
+%assign cpuflags_tbm (1<<25)|cpuflags_bmi1
%define cpuflag(x) ((cpuflags & (cpuflags_ %+ x)) == (cpuflags_ %+ x))
%define notcpuflag(x) ((cpuflags & (cpuflags_ %+ x)) != (cpuflags_ %+ x))
@@ -551,6 +716,7 @@ SECTION .note.GNU-stack noalloc noexec nowrite progbits
; All subsequent functions (up to the next INIT_CPUFLAGS) is built for the specified cpu.
; You shouldn't need to invoke this macro directly, it's a subroutine for INIT_MMX &co.
%macro INIT_CPUFLAGS 0-2
+ CPUNOP amdnop
%if %0 >= 1
%xdefine cpuname %1
%assign cpuflags cpuflags_%1
@@ -572,6 +738,9 @@ SECTION .note.GNU-stack noalloc noexec nowrite progbits
%elifidn %1, sse3
%define movu lddqu
%endif
+ %if notcpuflag(mmx2)
+ CPUNOP basicnop
+ %endif
%else
%xdefine SUFFIX
%undef cpuname
@@ -617,7 +786,7 @@ SECTION .note.GNU-stack noalloc noexec nowrite progbits
%define RESET_MM_PERMUTATION INIT_XMM %1
%define mmsize 16
%define num_mmregs 8
- %ifdef ARCH_X86_64
+ %if ARCH_X86_64
%define num_mmregs 16
%endif
%define mova movdqa
@@ -633,20 +802,12 @@ SECTION .note.GNU-stack noalloc noexec nowrite progbits
INIT_CPUFLAGS %1
%endmacro
-; FIXME: INIT_AVX can be replaced by INIT_XMM avx
-%macro INIT_AVX 0
- INIT_XMM
- %assign avx_enabled 1
- %define PALIGNR PALIGNR_SSSE3
- %define RESET_MM_PERMUTATION INIT_AVX
-%endmacro
-
%macro INIT_YMM 0-1+
%assign avx_enabled 1
%define RESET_MM_PERMUTATION INIT_YMM %1
%define mmsize 32
%define num_mmregs 8
- %ifdef ARCH_X86_64
+ %if ARCH_X86_64
%define num_mmregs 16
%endif
%define mova vmovaps
@@ -747,13 +908,13 @@ INIT_XMM
; Append cpuflags to the callee's name iff the appended name is known and the plain name isn't
%macro call 1
- call_internal %1, %1 %+ SUFFIX
+ call_internal %1 %+ SUFFIX, %1
%endmacro
%macro call_internal 2
- %xdefine %%i %1
- %ifndef cglobaled_%1
- %ifdef cglobaled_%2
- %xdefine %%i %2
+ %xdefine %%i %2
+ %ifndef cglobaled_%2
+ %ifdef cglobaled_%1
+ %xdefine %%i %1
%endif
%endif
call %%i
@@ -800,21 +961,38 @@ INIT_XMM
%endrep
%undef i
+%macro CHECK_AVX_INSTR_EMU 3-*
+ %xdefine %%opcode %1
+ %xdefine %%dst %2
+ %rep %0-2
+ %ifidn %%dst, %3
+ %error non-avx emulation of ``%%opcode'' is not supported
+ %endif
+ %rotate 1
+ %endrep
+%endmacro
+
;%1 == instruction
;%2 == 1 if float, 0 if int
-;%3 == 1 if 4-operand (xmm, xmm, xmm, imm), 0 if 3-operand (xmm, xmm, xmm)
+;%3 == 1 if 4-operand (xmm, xmm, xmm, imm), 0 if 2- or 3-operand (xmm, xmm, xmm)
;%4 == number of operands given
;%5+: operands
%macro RUN_AVX_INSTR 6-7+
- %ifid %5
- %define %%size sizeof%5
+ %ifid %6
+ %define %%sizeofreg sizeof%6
+ %elifid %5
+ %define %%sizeofreg sizeof%5
%else
- %define %%size mmsize
+ %define %%sizeofreg mmsize
%endif
- %if %%size==32
- v%1 %5, %6, %7
+ %if %%sizeofreg==32
+ %if %4>=3
+ v%1 %5, %6, %7
+ %else
+ v%1 %5, %6
+ %endif
%else
- %if %%size==8
+ %if %%sizeofreg==8
%define %%regmov movq
%elif %2
%define %%regmov movaps
@@ -824,16 +1002,17 @@ INIT_XMM
%if %4>=3+%3
%ifnidn %5, %6
- %if avx_enabled && sizeof%5==16
+ %if avx_enabled && %%sizeofreg==16
v%1 %5, %6, %7
%else
+ CHECK_AVX_INSTR_EMU {%1 %5, %6, %7}, %5, %7
%%regmov %5, %6
%1 %5, %7
%endif
%else
%1 %5, %7
%endif
- %elif %3
+ %elif %4>=3
%1 %5, %6, %7
%else
%1 %5, %6
@@ -864,7 +1043,7 @@ INIT_XMM
;%1 == instruction
;%2 == 1 if float, 0 if int
-;%3 == 1 if 4-operand (xmm, xmm, xmm, imm), 0 if 3-operand (xmm, xmm, xmm)
+;%3 == 1 if 4-operand (xmm, xmm, xmm, imm), 0 if 2- or 3-operand (xmm, xmm, xmm)
;%4 == 1 if symmetric (i.e. doesn't matter which src arg is which), 0 if not
%macro AVX_INSTR 4
%macro %1 2-9 fnord, fnord, fnord, %1, %2, %3, %4
@@ -898,6 +1077,9 @@ AVX_INSTR cmppd, 1, 0, 0
AVX_INSTR cmpps, 1, 0, 0
AVX_INSTR cmpsd, 1, 0, 0
AVX_INSTR cmpss, 1, 0, 0
+AVX_INSTR cvtdq2ps, 1, 0, 0
+AVX_INSTR cvtpd2dq, 1, 0, 0
+AVX_INSTR cvtps2dq, 1, 0, 0
AVX_INSTR divpd, 1, 0, 0
AVX_INSTR divps, 1, 0, 0
AVX_INSTR divsd, 1, 0, 0
@@ -927,6 +1109,9 @@ AVX_INSTR mulsd, 1, 0, 1
AVX_INSTR mulss, 1, 0, 1
AVX_INSTR orpd, 1, 0, 1
AVX_INSTR orps, 1, 0, 1
+AVX_INSTR pabsb, 0, 0, 0
+AVX_INSTR pabsw, 0, 0, 0
+AVX_INSTR pabsd, 0, 0, 0
AVX_INSTR packsswb, 0, 0, 0
AVX_INSTR packssdw, 0, 0, 0
AVX_INSTR packuswb, 0, 0, 0
@@ -978,6 +1163,7 @@ AVX_INSTR pminsd, 0, 0, 1
AVX_INSTR pminub, 0, 0, 1
AVX_INSTR pminuw, 0, 0, 1
AVX_INSTR pminud, 0, 0, 1
+AVX_INSTR pmovmskb, 0, 0, 0
AVX_INSTR pmulhuw, 0, 0, 1
AVX_INSTR pmulhrsw, 0, 0, 1
AVX_INSTR pmulhw, 0, 0, 1
@@ -988,6 +1174,9 @@ AVX_INSTR pmuldq, 0, 0, 1
AVX_INSTR por, 0, 0, 1
AVX_INSTR psadbw, 0, 0, 1
AVX_INSTR pshufb, 0, 0, 0
+AVX_INSTR pshufd, 0, 1, 0
+AVX_INSTR pshufhw, 0, 1, 0
+AVX_INSTR pshuflw, 0, 1, 0
AVX_INSTR psignb, 0, 0, 0
AVX_INSTR psignw, 0, 0, 0
AVX_INSTR psignd, 0, 0, 0
@@ -1009,6 +1198,7 @@ AVX_INSTR psubsb, 0, 0, 0
AVX_INSTR psubsw, 0, 0, 0
AVX_INSTR psubusb, 0, 0, 0
AVX_INSTR psubusw, 0, 0, 0
+AVX_INSTR ptest, 0, 0, 0
AVX_INSTR punpckhbw, 0, 0, 0
AVX_INSTR punpckhwd, 0, 0, 0
AVX_INSTR punpckhdq, 0, 0, 0
@@ -1054,16 +1244,26 @@ AVX_INSTR pfmul, 1, 0, 1
%undef j
%macro FMA_INSTR 3
- %macro %1 4-7 %1, %2, %3
- %if cpuflag(xop)
- v%5 %1, %2, %3, %4
+ %macro %1 5-8 %1, %2, %3
+ %if cpuflag(xop) || cpuflag(fma4)
+ v%6 %1, %2, %3, %4
%else
- %6 %1, %2, %3
- %7 %1, %4
+ %ifidn %1, %4
+ %7 %5, %2, %3
+ %8 %1, %4, %5
+ %else
+ %7 %1, %2, %3
+ %8 %1, %4
+ %endif
%endif
%endmacro
%endmacro
+FMA_INSTR fmaddps, mulps, addps
FMA_INSTR pmacsdd, pmulld, paddd
FMA_INSTR pmacsww, pmullw, paddw
FMA_INSTR pmadcswd, pmaddwd, paddd
+
+; tzcnt is equivalent to "rep bsf" and is backwards-compatible with bsf.
+; This lets us use tzcnt without bumping the yasm version requirement yet.
+%define tzcnt rep bsf
diff --git a/gst-libs/ext/libav/libavutil/x86/x86util.asm b/gst-libs/ext/libav/libavutil/x86/x86util.asm
index 874443a..16ee6cf 100644
--- a/gst-libs/ext/libav/libavutil/x86/x86util.asm
+++ b/gst-libs/ext/libav/libavutil/x86/x86util.asm
@@ -23,6 +23,11 @@
;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
;******************************************************************************
+%define program_name ff
+%define cpuflags_mmxext cpuflags_mmx2
+
+%include "libavutil/x86/x86inc.asm"
+
%macro SBUTTERFLY 4
%if avx_enabled == 0
mova m%4, m%2
@@ -42,10 +47,9 @@
%endmacro
%macro SBUTTERFLYPS 3
- movaps m%3, m%1
- unpcklps m%1, m%2
- unpckhps m%3, m%2
- SWAP %2, %3
+ unpcklps m%3, m%1, m%2
+ unpckhps m%1, m%1, m%2
+ SWAP %1, %3, %2
%endmacro
%macro TRANSPOSE4x4B 5
@@ -85,17 +89,16 @@
%macro TRANSPOSE4x4PS 5
SBUTTERFLYPS %1, %2, %5
SBUTTERFLYPS %3, %4, %5
- movaps m%5, m%1
- movlhps m%1, m%3
- movhlps m%3, m%5
- movaps m%5, m%2
- movlhps m%2, m%4
- movhlps m%4, m%5
- SWAP %2, %3
+ movlhps m%5, m%1, m%3
+ movhlps m%3, m%1
+ SWAP %5, %1
+ movlhps m%5, m%2, m%4
+ movhlps m%4, m%2
+ SWAP %5, %2, %3
%endmacro
%macro TRANSPOSE8x8W 9-11
-%ifdef ARCH_X86_64
+%if ARCH_X86_64
SBUTTERFLY wd, %1, %2, %9
SBUTTERFLY wd, %3, %4, %9
SBUTTERFLY wd, %5, %6, %9
@@ -143,13 +146,21 @@
%endif
%endmacro
-; PABSW macros assume %1 != %2, while ABS1/2 macros work in-place
-%macro PABSW_MMX 2
+; PABSW macro assumes %1 != %2, while ABS1/2 macros work in-place
+%macro PABSW 2
+%if cpuflag(ssse3)
+ pabsw %1, %2
+%elif cpuflag(mmxext)
+ pxor %1, %1
+ psubw %1, %2
+ pmaxsw %1, %2
+%else
pxor %1, %1
pcmpgtw %1, %2
pxor %2, %1
psubw %2, %1
SWAP %1, %2
+%endif
%endmacro
%macro PSIGNW_MMX 2
@@ -157,16 +168,6 @@
psubw %1, %2
%endmacro
-%macro PABSW_MMX2 2
- pxor %1, %1
- psubw %1, %2
- pmaxsw %1, %2
-%endmacro
-
-%macro PABSW_SSSE3 2
- pabsw %1, %2
-%endmacro
-
%macro PSIGNW_SSSE3 2
psignw %1, %2
%endmacro
@@ -189,13 +190,13 @@
psubw %2, %4
%endmacro
-%macro ABS1_MMX2 2 ; a, tmp
+%macro ABS1_MMXEXT 2 ; a, tmp
pxor %2, %2
psubw %2, %1
pmaxsw %1, %2
%endmacro
-%macro ABS2_MMX2 4 ; a, b, tmp0, tmp1
+%macro ABS2_MMXEXT 4 ; a, b, tmp0, tmp1
pxor %3, %3
pxor %4, %4
psubw %3, %1
@@ -258,18 +259,36 @@
%define ABSB ABSB_MMX
%define ABSB2 ABSB2_MMX
-%macro SPLATB_MMX 3
+%macro SPLATB_LOAD 3
+%if cpuflag(ssse3)
+ movd %1, [%2-3]
+ pshufb %1, %3
+%else
movd %1, [%2-3] ;to avoid crossing a cacheline
punpcklbw %1, %1
SPLATW %1, %1, 3
+%endif
%endmacro
-%macro SPLATB_SSSE3 3
- movd %1, [%2-3]
+%macro SPLATB_REG 3
+%if cpuflag(ssse3)
+ movd %1, %2d
pshufb %1, %3
+%else
+ movd %1, %2d
+ punpcklbw %1, %1
+ SPLATW %1, %1, 0
+%endif
%endmacro
-%macro PALIGNR_MMX 4-5 ; [dst,] src1, src2, imm, tmp
+%macro PALIGNR 4-5
+%if cpuflag(ssse3)
+%if %0==5
+ palignr %1, %2, %3, %4
+%else
+ palignr %1, %2, %3
+%endif
+%elif cpuflag(mmx) ; [dst,] src1, src2, imm, tmp
%define %%dst %1
%if %0==5
%ifnidn %1, %2
@@ -288,13 +307,26 @@
psrldq %4, %3
%endif
por %%dst, %4
+%endif
%endmacro
-%macro PALIGNR_SSSE3 4-5
-%if %0==5
- palignr %1, %2, %3, %4
-%else
- palignr %1, %2, %3
+%macro PSHUFLW 1+
+ %if mmsize == 8
+ pshufw %1
+ %else
+ pshuflw %1
+ %endif
+%endmacro
+
+%macro PSWAPD 2
+%if cpuflag(mmxext)
+ pshufw %1, %2, q1032
+%elif cpuflag(3dnowext)
+ pswapd %1, %2
+%elif cpuflag(3dnow)
+ movq %1, %2
+ psrlq %1, 32
+ punpckldq %1, %2
%endif
%endmacro
@@ -509,43 +541,47 @@
movh [%7+%8], %4
%endmacro
-%macro PMINUB_MMX 3 ; dst, src, tmp
+%macro PMINUB 3 ; dst, src, ignored
+%if cpuflag(mmxext)
+ pminub %1, %2
+%else ; dst, src, tmp
mova %3, %1
psubusb %3, %2
psubb %1, %3
-%endmacro
-
-%macro PMINUB_MMXEXT 3 ; dst, src, ignored
- pminub %1, %2
+%endif
%endmacro
%macro SPLATW 2-3 0
%if mmsize == 16
pshuflw %1, %2, (%3)*0x55
punpcklqdq %1, %1
-%else
+%elif cpuflag(mmxext)
pshufw %1, %2, (%3)*0x55
-%endif
-%endmacro
-
-%macro SPLATD 2-3 0
-%if mmsize == 16
- pshufd %1, %2, (%3)*0x55
%else
- pshufw %1, %2, (%3)*0x11 + ((%3)+1)*0x44
+ %ifnidn %1, %2
+ mova %1, %2
+ %endif
+ %if %3 & 2
+ punpckhwd %1, %1
+ %else
+ punpcklwd %1, %1
+ %endif
+ %if %3 & 1
+ punpckhwd %1, %1
+ %else
+ punpcklwd %1, %1
+ %endif
%endif
%endmacro
-%macro SPLATD_MMX 1
+%macro SPLATD 1
+%if mmsize == 8
punpckldq %1, %1
-%endmacro
-
-%macro SPLATD_SSE 1
- shufps %1, %1, 0
-%endmacro
-
-%macro SPLATD_SSE2 1
+%elif cpuflag(sse2)
pshufd %1, %1, 0
+%elif cpuflag(sse)
+ shufps %1, %1, 0
+%endif
%endmacro
%macro CLIPW 3 ;(dst, min, max)
@@ -585,3 +621,47 @@
pminsd %1, %3
pmaxsd %1, %2
%endmacro
+
+%macro VBROADCASTSS 2 ; dst xmm/ymm, src m32
+%if cpuflag(avx)
+ vbroadcastss %1, %2
+%else ; sse
+ movss %1, %2
+ shufps %1, %1, 0
+%endif
+%endmacro
+
+%macro VBROADCASTSD 2 ; dst xmm/ymm, src m64
+%if cpuflag(avx) && mmsize == 32
+ vbroadcastsd %1, %2
+%elif cpuflag(sse3)
+ movddup %1, %2
+%else ; sse2
+ movsd %1, %2
+ movlhps %1, %1
+%endif
+%endmacro
+
+%macro SHUFFLE_MASK_W 8
+ %rep 8
+ %if %1>=0x80
+ db %1, %1
+ %else
+ db %1*2
+ db %1*2+1
+ %endif
+ %rotate 1
+ %endrep
+%endmacro
+
+%macro PMOVSXWD 2; dst, src
+%if cpuflag(sse4)
+ pmovsxwd %1, %2
+%else
+ %ifnidn %1, %2
+ mova %1, %2
+ %endif
+ punpcklwd %1, %1
+ psrad %1, 16
+%endif
+%endmacro
diff --git a/gst-libs/ext/libav/libavutil/x86_cpu.h b/gst-libs/ext/libav/libavutil/x86_cpu.h
deleted file mode 100644
index f84eba6..0000000
--- a/gst-libs/ext/libav/libavutil/x86_cpu.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at>
- *
- * 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
- */
-
-#ifndef AVUTIL_X86_CPU_H
-#define AVUTIL_X86_CPU_H
-
-#include <stdint.h>
-#include "config.h"
-
-#if ARCH_X86_64
-# define OPSIZE "q"
-# define REG_a "rax"
-# define REG_b "rbx"
-# define REG_c "rcx"
-# define REG_d "rdx"
-# define REG_D "rdi"
-# define REG_S "rsi"
-# define PTR_SIZE "8"
-typedef int64_t x86_reg;
-
-# define REG_SP "rsp"
-# define REG_BP "rbp"
-# define REGBP rbp
-# define REGa rax
-# define REGb rbx
-# define REGc rcx
-# define REGd rdx
-# define REGSP rsp
-
-#elif ARCH_X86_32
-
-# define OPSIZE "l"
-# define REG_a "eax"
-# define REG_b "ebx"
-# define REG_c "ecx"
-# define REG_d "edx"
-# define REG_D "edi"
-# define REG_S "esi"
-# define PTR_SIZE "4"
-typedef int32_t x86_reg;
-
-# define REG_SP "esp"
-# define REG_BP "ebp"
-# define REGBP ebp
-# define REGa eax
-# define REGb ebx
-# define REGc ecx
-# define REGd edx
-# define REGSP esp
-#else
-typedef int x86_reg;
-#endif
-
-#define HAVE_7REGS (ARCH_X86_64 || (HAVE_EBX_AVAILABLE && HAVE_EBP_AVAILABLE))
-#define HAVE_6REGS (ARCH_X86_64 || (HAVE_EBX_AVAILABLE || HAVE_EBP_AVAILABLE))
-
-#if ARCH_X86_64 && defined(PIC)
-# define BROKEN_RELOCATIONS 1
-#endif
-
-/*
- * If gcc is not set to support sse (-msse) it will not accept xmm registers
- * in the clobber list for inline asm. XMM_CLOBBERS takes a list of xmm
- * registers to be marked as clobbered and evaluates to nothing if they are
- * not supported, or to the list itself if they are supported. Since a clobber
- * list may not be empty, XMM_CLOBBERS_ONLY should be used if the xmm
- * registers are the only in the clobber list.
- * For example a list with "eax" and "xmm0" as clobbers should become:
- * : XMM_CLOBBERS("xmm0",) "eax"
- * and a list with only "xmm0" should become:
- * XMM_CLOBBERS_ONLY("xmm0")
- */
-#if HAVE_XMM_CLOBBERS
-# define XMM_CLOBBERS(...) __VA_ARGS__
-# define XMM_CLOBBERS_ONLY(...) : __VA_ARGS__
-#else
-# define XMM_CLOBBERS(...)
-# define XMM_CLOBBERS_ONLY(...)
-#endif
-
-#endif /* AVUTIL_X86_CPU_H */
diff --git a/gst-libs/ext/libav/libavutil/xtea.c b/gst-libs/ext/libav/libavutil/xtea.c
new file mode 100644
index 0000000..1187662
--- /dev/null
+++ b/gst-libs/ext/libav/libavutil/xtea.c
@@ -0,0 +1,189 @@
+/*
+ * A 32-bit implementation of the XTEA algorithm
+ * Copyright (c) 2012 Samuel Pitoiset
+ *
+ * loosely based on the implementation of David Wheeler and Roger Needham
+ *
+ * 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
+ */
+
+#include "libavutil/intreadwrite.h"
+
+#include "avutil.h"
+#include "common.h"
+#include "xtea.h"
+
+void av_xtea_init(AVXTEA *ctx, const uint8_t key[16])
+{
+ int i;
+
+ for (i = 0; i < 4; i++)
+ ctx->key[i] = AV_RB32(key + (i << 2));
+}
+
+static void xtea_crypt_ecb(AVXTEA *ctx, uint8_t *dst, const uint8_t *src,
+ int decrypt, uint8_t *iv)
+{
+ uint32_t v0, v1;
+ int i;
+
+ v0 = AV_RB32(src);
+ v1 = AV_RB32(src + 4);
+
+ if (decrypt) {
+ uint32_t delta = 0x9E3779B9, sum = delta * 32;
+
+ for (i = 0; i < 32; i++) {
+ v1 -= (((v0 << 4) ^ (v0 >> 5)) + v0) ^ (sum + ctx->key[(sum >> 11) & 3]);
+ sum -= delta;
+ v0 -= (((v1 << 4) ^ (v1 >> 5)) + v1) ^ (sum + ctx->key[sum & 3]);
+ }
+ if (iv) {
+ v0 ^= AV_RB32(iv);
+ v1 ^= AV_RB32(iv + 4);
+ memcpy(iv, src, 8);
+ }
+ } else {
+ uint32_t sum = 0, delta = 0x9E3779B9;
+
+ for (i = 0; i < 32; i++) {
+ v0 += (((v1 << 4) ^ (v1 >> 5)) + v1) ^ (sum + ctx->key[sum & 3]);
+ sum += delta;
+ v1 += (((v0 << 4) ^ (v0 >> 5)) + v0) ^ (sum + ctx->key[(sum >> 11) & 3]);
+ }
+ }
+
+ AV_WB32(dst, v0);
+ AV_WB32(dst + 4, v1);
+}
+
+void av_xtea_crypt(AVXTEA *ctx, uint8_t *dst, const uint8_t *src, int count,
+ uint8_t *iv, int decrypt)
+{
+ int i;
+
+ if (decrypt) {
+ while (count--) {
+ xtea_crypt_ecb(ctx, dst, src, decrypt, iv);
+
+ src += 8;
+ dst += 8;
+ }
+ } else {
+ while (count--) {
+ if (iv) {
+ for (i = 0; i < 8; i++)
+ dst[i] = src[i] ^ iv[i];
+ xtea_crypt_ecb(ctx, dst, dst, decrypt, NULL);
+ memcpy(iv, dst, 8);
+ } else {
+ xtea_crypt_ecb(ctx, dst, src, decrypt, NULL);
+ }
+ src += 8;
+ dst += 8;
+ }
+ }
+}
+
+#ifdef TEST
+#include <stdio.h>
+
+#define XTEA_NUM_TESTS 6
+
+static const uint8_t xtea_test_key[XTEA_NUM_TESTS][16] = {
+ { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
+ { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
+ { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
+ { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
+};
+
+static const uint8_t xtea_test_pt[XTEA_NUM_TESTS][8] = {
+ { 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48 },
+ { 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41 },
+ { 0x5a, 0x5b, 0x6e, 0x27, 0x89, 0x48, 0xd7, 0x7f },
+ { 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48 },
+ { 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41 },
+ { 0x70, 0xe1, 0x22, 0x5d, 0x6e, 0x4e, 0x76, 0x55 }
+};
+
+static const uint8_t xtea_test_ct[XTEA_NUM_TESTS][8] = {
+ { 0x49, 0x7d, 0xf3, 0xd0, 0x72, 0x61, 0x2c, 0xb5 },
+ { 0xe7, 0x8f, 0x2d, 0x13, 0x74, 0x43, 0x41, 0xd8 },
+ { 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41 },
+ { 0xa0, 0x39, 0x05, 0x89, 0xf8, 0xb8, 0xef, 0xa5 },
+ { 0xed, 0x23, 0x37, 0x5a, 0x82, 0x1a, 0x8c, 0x2d },
+ { 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41 }
+};
+
+static void test_xtea(AVXTEA *ctx, uint8_t *dst, const uint8_t *src,
+ const uint8_t *ref, int len, uint8_t *iv, int dir,
+ const char *test)
+{
+ av_xtea_crypt(ctx, dst, src, len, iv, dir);
+ if (memcmp(dst, ref, 8*len)) {
+ int i;
+ printf("%s failed\ngot ", test);
+ for (i = 0; i < 8*len; i++)
+ printf("%02x ", dst[i]);
+ printf("\nexpected ");
+ for (i = 0; i < 8*len; i++)
+ printf("%02x ", ref[i]);
+ printf("\n");
+ exit(1);
+ }
+}
+
+int main(void)
+{
+ AVXTEA ctx;
+ uint8_t buf[8], iv[8];
+ int i;
+ const uint8_t src[32] = "HelloWorldHelloWorldHelloWorld";
+ uint8_t ct[32];
+ uint8_t pl[32];
+
+ for (i = 0; i < XTEA_NUM_TESTS; i++) {
+ av_xtea_init(&ctx, xtea_test_key[i]);
+
+ test_xtea(&ctx, buf, xtea_test_pt[i], xtea_test_ct[i], 1, NULL, 0, "encryption");
+ test_xtea(&ctx, buf, xtea_test_ct[i], xtea_test_pt[i], 1, NULL, 1, "decryption");
+
+ /* encrypt */
+ memcpy(iv, "HALLO123", 8);
+ av_xtea_crypt(&ctx, ct, src, 4, iv, 0);
+
+ /* decrypt into pl */
+ memcpy(iv, "HALLO123", 8);
+ test_xtea(&ctx, pl, ct, src, 4, iv, 1, "CBC decryption");
+
+ memcpy(iv, "HALLO123", 8);
+ test_xtea(&ctx, ct, ct, src, 4, iv, 1, "CBC inplace decryption");
+ }
+ printf("Test encryption/decryption success.\n");
+
+ return 0;
+}
+
+#endif
diff --git a/gst-libs/ext/libav/libavutil/xtea.h b/gst-libs/ext/libav/libavutil/xtea.h
new file mode 100644
index 0000000..7d2b07b
--- /dev/null
+++ b/gst-libs/ext/libav/libavutil/xtea.h
@@ -0,0 +1,61 @@
+/*
+ * A 32-bit implementation of the XTEA algorithm
+ *
+ * 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
+ */
+
+#ifndef AVUTIL_XTEA_H
+#define AVUTIL_XTEA_H
+
+#include <stdint.h>
+
+/**
+ * @defgroup lavu_xtea XTEA
+ * @ingroup lavu_crypto
+ * @{
+ */
+
+typedef struct AVXTEA {
+ uint32_t key[16];
+} AVXTEA;
+
+/**
+ * Initialize an AVXTEA context.
+ *
+ * @param ctx an AVXTEA context
+ * @param key a key of 16 bytes used for encryption/decryption
+ */
+void av_xtea_init(struct AVXTEA *ctx, const uint8_t key[16]);
+
+/**
+ * Encrypt or decrypt a buffer using a previously initialized context.
+ *
+ * @param ctx an AVXTEA context
+ * @param dst destination array, can be equal to src
+ * @param src source array, can be equal to dst
+ * @param count number of 8 byte blocks
+ * @param iv initialization vector for CBC mode, if NULL then ECB will be used
+ * @param decrypt 0 for encryption, 1 for decryption
+ */
+void av_xtea_crypt(struct AVXTEA *ctx, uint8_t *dst, const uint8_t *src,
+ int count, uint8_t *iv, int decrypt);
+
+/**
+ * @}
+ */
+
+#endif /* AVUTIL_XTEA_H */
diff --git a/gst-libs/ext/libav/libpostproc/Makefile b/gst-libs/ext/libav/libpostproc/Makefile
deleted file mode 100644
index 86c9b5f..0000000
--- a/gst-libs/ext/libav/libpostproc/Makefile
+++ /dev/null
@@ -1,6 +0,0 @@
-NAME = postproc
-FFLIBS = avutil
-
-HEADERS = postprocess.h
-
-OBJS = postprocess.o
diff --git a/gst-libs/ext/libav/libpostproc/libpostproc.v b/gst-libs/ext/libav/libpostproc/libpostproc.v
deleted file mode 100644
index e65d76f..0000000
--- a/gst-libs/ext/libav/libpostproc/libpostproc.v
+++ /dev/null
@@ -1,4 +0,0 @@
-LIBPOSTPROC_$MAJOR {
- global: postproc_*; pp_*;
- local: *;
-};
diff --git a/gst-libs/ext/libav/libpostproc/postprocess.c b/gst-libs/ext/libav/libpostproc/postprocess.c
deleted file mode 100644
index c363fa7..0000000
--- a/gst-libs/ext/libav/libpostproc/postprocess.c
+++ /dev/null
@@ -1,1071 +0,0 @@
-/*
- * Copyright (C) 2001-2003 Michael Niedermayer (michaelni@gmx.at)
- *
- * AltiVec optimizations (C) 2004 Romain Dolbeau <romain@dolbeau.org>
- *
- * This file is part of Libav.
- *
- * Libav is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 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 General Public License for more details.
- *
- * You should have received a copy of the GNU 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
- * postprocessing.
- */
-
-/*
- C MMX MMX2 3DNow AltiVec
-isVertDC Ec Ec Ec
-isVertMinMaxOk Ec Ec Ec
-doVertLowPass E e e Ec
-doVertDefFilter Ec Ec e e Ec
-isHorizDC Ec Ec Ec
-isHorizMinMaxOk a E Ec
-doHorizLowPass E e e Ec
-doHorizDefFilter Ec Ec e e Ec
-do_a_deblock Ec E Ec E
-deRing E e e* Ecp
-Vertical RKAlgo1 E a a
-Horizontal RKAlgo1 a a
-Vertical X1# a E E
-Horizontal X1# a E E
-LinIpolDeinterlace e E E*
-CubicIpolDeinterlace a e e*
-LinBlendDeinterlace e E E*
-MedianDeinterlace# E Ec Ec
-TempDeNoiser# E e e Ec
-
-* I do not have a 3DNow! CPU -> it is untested, but no one said it does not work so it seems to work
-# more or less selfinvented filters so the exactness is not too meaningful
-E = Exact implementation
-e = almost exact implementation (slightly different rounding,...)
-a = alternative / approximate impl
-c = checked against the other implementations (-vo md5)
-p = partially optimized, still some work to do
-*/
-
-/*
-TODO:
-reduce the time wasted on the mem transfer
-unroll stuff if instructions depend too much on the prior one
-move YScale thing to the end instead of fixing QP
-write a faster and higher quality deblocking filter :)
-make the mainloop more flexible (variable number of blocks at once
- (the if/else stuff per block is slowing things down)
-compare the quality & speed of all filters
-split this huge file
-optimize c versions
-try to unroll inner for(x=0 ... loop to avoid these damn if(x ... checks
-...
-*/
-
-//Changelog: use git log
-
-#include "config.h"
-#include "libavutil/avutil.h"
-#include <inttypes.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-//#undef HAVE_MMX2
-//#define HAVE_AMD3DNOW
-//#undef HAVE_MMX
-//#undef ARCH_X86
-//#define DEBUG_BRIGHTNESS
-#include "postprocess.h"
-#include "postprocess_internal.h"
-#include "libavutil/avstring.h"
-
-unsigned postproc_version(void)
-{
- return LIBPOSTPROC_VERSION_INT;
-}
-
-const char *postproc_configuration(void)
-{
- return LIBAV_CONFIGURATION;
-}
-
-const char *postproc_license(void)
-{
-#define LICENSE_PREFIX "libpostproc license: "
- return LICENSE_PREFIX LIBAV_LICENSE + sizeof(LICENSE_PREFIX) - 1;
-}
-
-#if HAVE_ALTIVEC_H
-#include <altivec.h>
-#endif
-
-#define GET_MODE_BUFFER_SIZE 500
-#define OPTIONS_ARRAY_SIZE 10
-#define BLOCK_SIZE 8
-#define TEMP_STRIDE 8
-//#define NUM_BLOCKS_AT_ONCE 16 //not used yet
-
-#if ARCH_X86
-DECLARE_ASM_CONST(8, uint64_t, w05)= 0x0005000500050005LL;
-DECLARE_ASM_CONST(8, uint64_t, w04)= 0x0004000400040004LL;
-DECLARE_ASM_CONST(8, uint64_t, w20)= 0x0020002000200020LL;
-DECLARE_ASM_CONST(8, uint64_t, b00)= 0x0000000000000000LL;
-DECLARE_ASM_CONST(8, uint64_t, b01)= 0x0101010101010101LL;
-DECLARE_ASM_CONST(8, uint64_t, b02)= 0x0202020202020202LL;
-DECLARE_ASM_CONST(8, uint64_t, b08)= 0x0808080808080808LL;
-DECLARE_ASM_CONST(8, uint64_t, b80)= 0x8080808080808080LL;
-#endif
-
-DECLARE_ASM_CONST(8, int, deringThreshold)= 20;
-
-
-static struct PPFilter filters[]=
-{
- {"hb", "hdeblock", 1, 1, 3, H_DEBLOCK},
- {"vb", "vdeblock", 1, 2, 4, V_DEBLOCK},
-/* {"hr", "rkhdeblock", 1, 1, 3, H_RK1_FILTER},
- {"vr", "rkvdeblock", 1, 2, 4, V_RK1_FILTER},*/
- {"h1", "x1hdeblock", 1, 1, 3, H_X1_FILTER},
- {"v1", "x1vdeblock", 1, 2, 4, V_X1_FILTER},
- {"ha", "ahdeblock", 1, 1, 3, H_A_DEBLOCK},
- {"va", "avdeblock", 1, 2, 4, V_A_DEBLOCK},
- {"dr", "dering", 1, 5, 6, DERING},
- {"al", "autolevels", 0, 1, 2, LEVEL_FIX},
- {"lb", "linblenddeint", 1, 1, 4, LINEAR_BLEND_DEINT_FILTER},
- {"li", "linipoldeint", 1, 1, 4, LINEAR_IPOL_DEINT_FILTER},
- {"ci", "cubicipoldeint", 1, 1, 4, CUBIC_IPOL_DEINT_FILTER},
- {"md", "mediandeint", 1, 1, 4, MEDIAN_DEINT_FILTER},
- {"fd", "ffmpegdeint", 1, 1, 4, FFMPEG_DEINT_FILTER},
- {"l5", "lowpass5", 1, 1, 4, LOWPASS5_DEINT_FILTER},
- {"tn", "tmpnoise", 1, 7, 8, TEMP_NOISE_FILTER},
- {"fq", "forcequant", 1, 0, 0, FORCE_QUANT},
- {NULL, NULL,0,0,0,0} //End Marker
-};
-
-static const char *replaceTable[]=
-{
- "default", "hb:a,vb:a,dr:a",
- "de", "hb:a,vb:a,dr:a",
- "fast", "h1:a,v1:a,dr:a",
- "fa", "h1:a,v1:a,dr:a",
- "ac", "ha:a:128:7,va:a,dr:a",
- NULL //End Marker
-};
-
-
-#if ARCH_X86
-static inline void prefetchnta(void *p)
-{
- __asm__ volatile( "prefetchnta (%0)\n\t"
- : : "r" (p)
- );
-}
-
-static inline void prefetcht0(void *p)
-{
- __asm__ volatile( "prefetcht0 (%0)\n\t"
- : : "r" (p)
- );
-}
-
-static inline void prefetcht1(void *p)
-{
- __asm__ volatile( "prefetcht1 (%0)\n\t"
- : : "r" (p)
- );
-}
-
-static inline void prefetcht2(void *p)
-{
- __asm__ volatile( "prefetcht2 (%0)\n\t"
- : : "r" (p)
- );
-}
-#endif
-
-/* The horizontal functions exist only in C because the MMX
- * code is faster with vertical filters and transposing. */
-
-/**
- * Check if the given 8x8 Block is mostly "flat"
- */
-static inline int isHorizDC_C(uint8_t src[], int stride, PPContext *c)
-{
- int numEq= 0;
- int y;
- const int dcOffset= ((c->nonBQP*c->ppMode.baseDcDiff)>>8) + 1;
- const int dcThreshold= dcOffset*2 + 1;
-
- for(y=0; y<BLOCK_SIZE; y++){
- if(((unsigned)(src[0] - src[1] + dcOffset)) < dcThreshold) numEq++;
- if(((unsigned)(src[1] - src[2] + dcOffset)) < dcThreshold) numEq++;
- if(((unsigned)(src[2] - src[3] + dcOffset)) < dcThreshold) numEq++;
- if(((unsigned)(src[3] - src[4] + dcOffset)) < dcThreshold) numEq++;
- if(((unsigned)(src[4] - src[5] + dcOffset)) < dcThreshold) numEq++;
- if(((unsigned)(src[5] - src[6] + dcOffset)) < dcThreshold) numEq++;
- if(((unsigned)(src[6] - src[7] + dcOffset)) < dcThreshold) numEq++;
- src+= stride;
- }
- return numEq > c->ppMode.flatnessThreshold;
-}
-
-/**
- * Check if the middle 8x8 Block in the given 8x16 block is flat
- */
-static inline int isVertDC_C(uint8_t src[], int stride, PPContext *c)
-{
- int numEq= 0;
- int y;
- const int dcOffset= ((c->nonBQP*c->ppMode.baseDcDiff)>>8) + 1;
- const int dcThreshold= dcOffset*2 + 1;
-
- src+= stride*4; // src points to begin of the 8x8 Block
- for(y=0; y<BLOCK_SIZE-1; y++){
- if(((unsigned)(src[0] - src[0+stride] + dcOffset)) < dcThreshold) numEq++;
- if(((unsigned)(src[1] - src[1+stride] + dcOffset)) < dcThreshold) numEq++;
- if(((unsigned)(src[2] - src[2+stride] + dcOffset)) < dcThreshold) numEq++;
- if(((unsigned)(src[3] - src[3+stride] + dcOffset)) < dcThreshold) numEq++;
- if(((unsigned)(src[4] - src[4+stride] + dcOffset)) < dcThreshold) numEq++;
- if(((unsigned)(src[5] - src[5+stride] + dcOffset)) < dcThreshold) numEq++;
- if(((unsigned)(src[6] - src[6+stride] + dcOffset)) < dcThreshold) numEq++;
- if(((unsigned)(src[7] - src[7+stride] + dcOffset)) < dcThreshold) numEq++;
- src+= stride;
- }
- return numEq > c->ppMode.flatnessThreshold;
-}
-
-static inline int isHorizMinMaxOk_C(uint8_t src[], int stride, int QP)
-{
- int i;
- for(i=0; i<2; i++){
- if((unsigned)(src[0] - src[5] + 2*QP) > 4*QP) return 0;
- src += stride;
- if((unsigned)(src[2] - src[7] + 2*QP) > 4*QP) return 0;
- src += stride;
- if((unsigned)(src[4] - src[1] + 2*QP) > 4*QP) return 0;
- src += stride;
- if((unsigned)(src[6] - src[3] + 2*QP) > 4*QP) return 0;
- src += stride;
- }
- return 1;
-}
-
-static inline int isVertMinMaxOk_C(uint8_t src[], int stride, int QP)
-{
- int x;
- src+= stride*4;
- for(x=0; x<BLOCK_SIZE; x+=4){
- if((unsigned)(src[ x + 0*stride] - src[ x + 5*stride] + 2*QP) > 4*QP) return 0;
- if((unsigned)(src[1+x + 2*stride] - src[1+x + 7*stride] + 2*QP) > 4*QP) return 0;
- if((unsigned)(src[2+x + 4*stride] - src[2+x + 1*stride] + 2*QP) > 4*QP) return 0;
- if((unsigned)(src[3+x + 6*stride] - src[3+x + 3*stride] + 2*QP) > 4*QP) return 0;
- }
- return 1;
-}
-
-static inline int horizClassify_C(uint8_t src[], int stride, PPContext *c)
-{
- if( isHorizDC_C(src, stride, c) ){
- if( isHorizMinMaxOk_C(src, stride, c->QP) )
- return 1;
- else
- return 0;
- }else{
- return 2;
- }
-}
-
-static inline int vertClassify_C(uint8_t src[], int stride, PPContext *c)
-{
- if( isVertDC_C(src, stride, c) ){
- if( isVertMinMaxOk_C(src, stride, c->QP) )
- return 1;
- else
- return 0;
- }else{
- return 2;
- }
-}
-
-static inline void doHorizDefFilter_C(uint8_t dst[], int stride, PPContext *c)
-{
- int y;
- for(y=0; y<BLOCK_SIZE; y++){
- const int middleEnergy= 5*(dst[4] - dst[3]) + 2*(dst[2] - dst[5]);
-
- if(FFABS(middleEnergy) < 8*c->QP){
- const int q=(dst[3] - dst[4])/2;
- const int leftEnergy= 5*(dst[2] - dst[1]) + 2*(dst[0] - dst[3]);
- const int rightEnergy= 5*(dst[6] - dst[5]) + 2*(dst[4] - dst[7]);
-
- int d= FFABS(middleEnergy) - FFMIN( FFABS(leftEnergy), FFABS(rightEnergy) );
- d= FFMAX(d, 0);
-
- d= (5*d + 32) >> 6;
- d*= FFSIGN(-middleEnergy);
-
- if(q>0)
- {
- d= d<0 ? 0 : d;
- d= d>q ? q : d;
- }
- else
- {
- d= d>0 ? 0 : d;
- d= d<q ? q : d;
- }
-
- dst[3]-= d;
- dst[4]+= d;
- }
- dst+= stride;
- }
-}
-
-/**
- * Do a horizontal low pass filter on the 10x8 block (dst points to middle 8x8 Block)
- * using the 9-Tap Filter (1,1,2,2,4,2,2,1,1)/16 (C version)
- */
-static inline void doHorizLowPass_C(uint8_t dst[], int stride, PPContext *c)
-{
- int y;
- for(y=0; y<BLOCK_SIZE; y++){
- const int first= FFABS(dst[-1] - dst[0]) < c->QP ? dst[-1] : dst[0];
- const int last= FFABS(dst[8] - dst[7]) < c->QP ? dst[8] : dst[7];
-
- int sums[10];
- sums[0] = 4*first + dst[0] + dst[1] + dst[2] + 4;
- sums[1] = sums[0] - first + dst[3];
- sums[2] = sums[1] - first + dst[4];
- sums[3] = sums[2] - first + dst[5];
- sums[4] = sums[3] - first + dst[6];
- sums[5] = sums[4] - dst[0] + dst[7];
- sums[6] = sums[5] - dst[1] + last;
- sums[7] = sums[6] - dst[2] + last;
- sums[8] = sums[7] - dst[3] + last;
- sums[9] = sums[8] - dst[4] + last;
-
- dst[0]= (sums[0] + sums[2] + 2*dst[0])>>4;
- dst[1]= (sums[1] + sums[3] + 2*dst[1])>>4;
- dst[2]= (sums[2] + sums[4] + 2*dst[2])>>4;
- dst[3]= (sums[3] + sums[5] + 2*dst[3])>>4;
- dst[4]= (sums[4] + sums[6] + 2*dst[4])>>4;
- dst[5]= (sums[5] + sums[7] + 2*dst[5])>>4;
- dst[6]= (sums[6] + sums[8] + 2*dst[6])>>4;
- dst[7]= (sums[7] + sums[9] + 2*dst[7])>>4;
-
- dst+= stride;
- }
-}
-
-/**
- * Experimental Filter 1 (Horizontal)
- * will not damage linear gradients
- * Flat blocks should look like they were passed through the (1,1,2,2,4,2,2,1,1) 9-Tap filter
- * can only smooth blocks at the expected locations (it cannot smooth them if they did move)
- * MMX2 version does correct clipping C version does not
- * not identical with the vertical one
- */
-static inline void horizX1Filter(uint8_t *src, int stride, int QP)
-{
- int y;
- static uint64_t *lut= NULL;
- if(lut==NULL)
- {
- int i;
- lut = av_malloc(256*8);
- for(i=0; i<256; i++)
- {
- int v= i < 128 ? 2*i : 2*(i-256);
-/*
-//Simulate 112242211 9-Tap filter
- uint64_t a= (v/16) & 0xFF;
- uint64_t b= (v/8) & 0xFF;
- uint64_t c= (v/4) & 0xFF;
- uint64_t d= (3*v/8) & 0xFF;
-*/
-//Simulate piecewise linear interpolation
- uint64_t a= (v/16) & 0xFF;
- uint64_t b= (v*3/16) & 0xFF;
- uint64_t c= (v*5/16) & 0xFF;
- uint64_t d= (7*v/16) & 0xFF;
- uint64_t A= (0x100 - a)&0xFF;
- uint64_t B= (0x100 - b)&0xFF;
- uint64_t C= (0x100 - c)&0xFF;
- uint64_t D= (0x100 - c)&0xFF;
-
- lut[i] = (a<<56) | (b<<48) | (c<<40) | (d<<32) |
- (D<<24) | (C<<16) | (B<<8) | (A);
- //lut[i] = (v<<32) | (v<<24);
- }
- }
-
- for(y=0; y<BLOCK_SIZE; y++){
- int a= src[1] - src[2];
- int b= src[3] - src[4];
- int c= src[5] - src[6];
-
- int d= FFMAX(FFABS(b) - (FFABS(a) + FFABS(c))/2, 0);
-
- if(d < QP){
- int v = d * FFSIGN(-b);
-
- src[1] +=v/8;
- src[2] +=v/4;
- src[3] +=3*v/8;
- src[4] -=3*v/8;
- src[5] -=v/4;
- src[6] -=v/8;
- }
- src+=stride;
- }
-}
-
-/**
- * accurate deblock filter
- */
-static av_always_inline void do_a_deblock_C(uint8_t *src, int step, int stride, PPContext *c){
- int y;
- const int QP= c->QP;
- const int dcOffset= ((c->nonBQP*c->ppMode.baseDcDiff)>>8) + 1;
- const int dcThreshold= dcOffset*2 + 1;
-//START_TIMER
- src+= step*4; // src points to begin of the 8x8 Block
- for(y=0; y<8; y++){
- int numEq= 0;
-
- if(((unsigned)(src[-1*step] - src[0*step] + dcOffset)) < dcThreshold) numEq++;
- if(((unsigned)(src[ 0*step] - src[1*step] + dcOffset)) < dcThreshold) numEq++;
- if(((unsigned)(src[ 1*step] - src[2*step] + dcOffset)) < dcThreshold) numEq++;
- if(((unsigned)(src[ 2*step] - src[3*step] + dcOffset)) < dcThreshold) numEq++;
- if(((unsigned)(src[ 3*step] - src[4*step] + dcOffset)) < dcThreshold) numEq++;
- if(((unsigned)(src[ 4*step] - src[5*step] + dcOffset)) < dcThreshold) numEq++;
- if(((unsigned)(src[ 5*step] - src[6*step] + dcOffset)) < dcThreshold) numEq++;
- if(((unsigned)(src[ 6*step] - src[7*step] + dcOffset)) < dcThreshold) numEq++;
- if(((unsigned)(src[ 7*step] - src[8*step] + dcOffset)) < dcThreshold) numEq++;
- if(numEq > c->ppMode.flatnessThreshold){
- int min, max, x;
-
- if(src[0] > src[step]){
- max= src[0];
- min= src[step];
- }else{
- max= src[step];
- min= src[0];
- }
- for(x=2; x<8; x+=2){
- if(src[x*step] > src[(x+1)*step]){
- if(src[x *step] > max) max= src[ x *step];
- if(src[(x+1)*step] < min) min= src[(x+1)*step];
- }else{
- if(src[(x+1)*step] > max) max= src[(x+1)*step];
- if(src[ x *step] < min) min= src[ x *step];
- }
- }
- if(max-min < 2*QP){
- const int first= FFABS(src[-1*step] - src[0]) < QP ? src[-1*step] : src[0];
- const int last= FFABS(src[8*step] - src[7*step]) < QP ? src[8*step] : src[7*step];
-
- int sums[10];
- sums[0] = 4*first + src[0*step] + src[1*step] + src[2*step] + 4;
- sums[1] = sums[0] - first + src[3*step];
- sums[2] = sums[1] - first + src[4*step];
- sums[3] = sums[2] - first + src[5*step];
- sums[4] = sums[3] - first + src[6*step];
- sums[5] = sums[4] - src[0*step] + src[7*step];
- sums[6] = sums[5] - src[1*step] + last;
- sums[7] = sums[6] - src[2*step] + last;
- sums[8] = sums[7] - src[3*step] + last;
- sums[9] = sums[8] - src[4*step] + last;
-
- src[0*step]= (sums[0] + sums[2] + 2*src[0*step])>>4;
- src[1*step]= (sums[1] + sums[3] + 2*src[1*step])>>4;
- src[2*step]= (sums[2] + sums[4] + 2*src[2*step])>>4;
- src[3*step]= (sums[3] + sums[5] + 2*src[3*step])>>4;
- src[4*step]= (sums[4] + sums[6] + 2*src[4*step])>>4;
- src[5*step]= (sums[5] + sums[7] + 2*src[5*step])>>4;
- src[6*step]= (sums[6] + sums[8] + 2*src[6*step])>>4;
- src[7*step]= (sums[7] + sums[9] + 2*src[7*step])>>4;
- }
- }else{
- const int middleEnergy= 5*(src[4*step] - src[3*step]) + 2*(src[2*step] - src[5*step]);
-
- if(FFABS(middleEnergy) < 8*QP){
- const int q=(src[3*step] - src[4*step])/2;
- const int leftEnergy= 5*(src[2*step] - src[1*step]) + 2*(src[0*step] - src[3*step]);
- const int rightEnergy= 5*(src[6*step] - src[5*step]) + 2*(src[4*step] - src[7*step]);
-
- int d= FFABS(middleEnergy) - FFMIN( FFABS(leftEnergy), FFABS(rightEnergy) );
- d= FFMAX(d, 0);
-
- d= (5*d + 32) >> 6;
- d*= FFSIGN(-middleEnergy);
-
- if(q>0){
- d= d<0 ? 0 : d;
- d= d>q ? q : d;
- }else{
- d= d>0 ? 0 : d;
- d= d<q ? q : d;
- }
-
- src[3*step]-= d;
- src[4*step]+= d;
- }
- }
-
- src += stride;
- }
-/*if(step==16){
- STOP_TIMER("step16")
-}else{
- STOP_TIMER("stepX")
-}*/
-}
-
-//Note: we have C, MMX, MMX2, 3DNOW version there is no 3DNOW+MMX2 one
-//Plain C versions
-#if !(HAVE_MMX || HAVE_ALTIVEC) || CONFIG_RUNTIME_CPUDETECT
-#define COMPILE_C
-#endif
-
-#if HAVE_ALTIVEC
-#define COMPILE_ALTIVEC
-#endif //HAVE_ALTIVEC
-
-#if ARCH_X86
-
-#if (HAVE_MMX && !HAVE_AMD3DNOW && !HAVE_MMX2) || CONFIG_RUNTIME_CPUDETECT
-#define COMPILE_MMX
-#endif
-
-#if HAVE_MMX2 || CONFIG_RUNTIME_CPUDETECT
-#define COMPILE_MMX2
-#endif
-
-#if (HAVE_AMD3DNOW && !HAVE_MMX2) || CONFIG_RUNTIME_CPUDETECT
-#define COMPILE_3DNOW
-#endif
-#endif /* ARCH_X86 */
-
-#undef HAVE_MMX
-#define HAVE_MMX 0
-#undef HAVE_MMX2
-#define HAVE_MMX2 0
-#undef HAVE_AMD3DNOW
-#define HAVE_AMD3DNOW 0
-#undef HAVE_ALTIVEC
-#define HAVE_ALTIVEC 0
-
-#ifdef COMPILE_C
-#define RENAME(a) a ## _C
-#include "postprocess_template.c"
-#endif
-
-#ifdef COMPILE_ALTIVEC
-#undef RENAME
-#undef HAVE_ALTIVEC
-#define HAVE_ALTIVEC 1
-#define RENAME(a) a ## _altivec
-#include "postprocess_altivec_template.c"
-#include "postprocess_template.c"
-#endif
-
-//MMX versions
-#ifdef COMPILE_MMX
-#undef RENAME
-#undef HAVE_MMX
-#define HAVE_MMX 1
-#define RENAME(a) a ## _MMX
-#include "postprocess_template.c"
-#endif
-
-//MMX2 versions
-#ifdef COMPILE_MMX2
-#undef RENAME
-#undef HAVE_MMX
-#undef HAVE_MMX2
-#define HAVE_MMX 1
-#define HAVE_MMX2 1
-#define RENAME(a) a ## _MMX2
-#include "postprocess_template.c"
-#endif
-
-//3DNOW versions
-#ifdef COMPILE_3DNOW
-#undef RENAME
-#undef HAVE_MMX
-#undef HAVE_MMX2
-#undef HAVE_AMD3DNOW
-#define HAVE_MMX 1
-#define HAVE_MMX2 0
-#define HAVE_AMD3DNOW 1
-#define RENAME(a) a ## _3DNow
-#include "postprocess_template.c"
-#endif
-
-// minor note: the HAVE_xyz is messed up after that line so do not use it.
-
-static inline void postProcess(const uint8_t src[], int srcStride, uint8_t dst[], int dstStride, int width, int height,
- const QP_STORE_T QPs[], int QPStride, int isColor, pp_mode *vm, pp_context *vc)
-{
- PPContext *c= (PPContext *)vc;
- PPMode *ppMode= (PPMode *)vm;
- c->ppMode= *ppMode; //FIXME
-
- // Using ifs here as they are faster than function pointers although the
- // difference would not be measurable here but it is much better because
- // someone might exchange the CPU whithout restarting MPlayer ;)
-#if CONFIG_RUNTIME_CPUDETECT
-#if ARCH_X86
- // ordered per speed fastest first
- if(c->cpuCaps & PP_CPU_CAPS_MMX2)
- postProcess_MMX2(src, srcStride, dst, dstStride, width, height, QPs, QPStride, isColor, c);
- else if(c->cpuCaps & PP_CPU_CAPS_3DNOW)
- postProcess_3DNow(src, srcStride, dst, dstStride, width, height, QPs, QPStride, isColor, c);
- else if(c->cpuCaps & PP_CPU_CAPS_MMX)
- postProcess_MMX(src, srcStride, dst, dstStride, width, height, QPs, QPStride, isColor, c);
- else
- postProcess_C(src, srcStride, dst, dstStride, width, height, QPs, QPStride, isColor, c);
-#else
-#if HAVE_ALTIVEC
- if(c->cpuCaps & PP_CPU_CAPS_ALTIVEC)
- postProcess_altivec(src, srcStride, dst, dstStride, width, height, QPs, QPStride, isColor, c);
- else
-#endif
- postProcess_C(src, srcStride, dst, dstStride, width, height, QPs, QPStride, isColor, c);
-#endif
-#else /* CONFIG_RUNTIME_CPUDETECT */
-#if HAVE_MMX2
- postProcess_MMX2(src, srcStride, dst, dstStride, width, height, QPs, QPStride, isColor, c);
-#elif HAVE_AMD3DNOW
- postProcess_3DNow(src, srcStride, dst, dstStride, width, height, QPs, QPStride, isColor, c);
-#elif HAVE_MMX
- postProcess_MMX(src, srcStride, dst, dstStride, width, height, QPs, QPStride, isColor, c);
-#elif HAVE_ALTIVEC
- postProcess_altivec(src, srcStride, dst, dstStride, width, height, QPs, QPStride, isColor, c);
-#else
- postProcess_C(src, srcStride, dst, dstStride, width, height, QPs, QPStride, isColor, c);
-#endif
-#endif /* !CONFIG_RUNTIME_CPUDETECT */
-}
-
-//static void postProcess(uint8_t src[], int srcStride, uint8_t dst[], int dstStride, int width, int height,
-// QP_STORE_T QPs[], int QPStride, int isColor, struct PPMode *ppMode);
-
-/* -pp Command line Help
-*/
-const char pp_help[] =
-"Available postprocessing filters:\n"
-"Filters Options\n"
-"short long name short long option Description\n"
-"* * a autoq CPU power dependent enabler\n"
-" c chrom chrominance filtering enabled\n"
-" y nochrom chrominance filtering disabled\n"
-" n noluma luma filtering disabled\n"
-"hb hdeblock (2 threshold) horizontal deblocking filter\n"
-" 1. difference factor: default=32, higher -> more deblocking\n"
-" 2. flatness threshold: default=39, lower -> more deblocking\n"
-" the h & v deblocking filters share these\n"
-" so you can't set different thresholds for h / v\n"
-"vb vdeblock (2 threshold) vertical deblocking filter\n"
-"ha hadeblock (2 threshold) horizontal deblocking filter\n"
-"va vadeblock (2 threshold) vertical deblocking filter\n"
-"h1 x1hdeblock experimental h deblock filter 1\n"
-"v1 x1vdeblock experimental v deblock filter 1\n"
-"dr dering deringing filter\n"
-"al autolevels automatic brightness / contrast\n"
-" f fullyrange stretch luminance to (0..255)\n"
-"lb linblenddeint linear blend deinterlacer\n"
-"li linipoldeint linear interpolating deinterlace\n"
-"ci cubicipoldeint cubic interpolating deinterlacer\n"
-"md mediandeint median deinterlacer\n"
-"fd ffmpegdeint ffmpeg deinterlacer\n"
-"l5 lowpass5 FIR lowpass deinterlacer\n"
-"de default hb:a,vb:a,dr:a\n"
-"fa fast h1:a,v1:a,dr:a\n"
-"ac ha:a:128:7,va:a,dr:a\n"
-"tn tmpnoise (3 threshold) temporal noise reducer\n"
-" 1. <= 2. <= 3. larger -> stronger filtering\n"
-"fq forceQuant <quantizer> force quantizer\n"
-"Usage:\n"
-"<filterName>[:<option>[:<option>...]][[,|/][-]<filterName>[:<option>...]]...\n"
-"long form example:\n"
-"vdeblock:autoq/hdeblock:autoq/linblenddeint default,-vdeblock\n"
-"short form example:\n"
-"vb:a/hb:a/lb de,-vb\n"
-"more examples:\n"
-"tn:64:128:256\n"
-"\n"
-;
-
-pp_mode *pp_get_mode_by_name_and_quality(const char *name, int quality)
-{
- char temp[GET_MODE_BUFFER_SIZE];
- char *p= temp;
- static const char filterDelimiters[] = ",/";
- static const char optionDelimiters[] = ":";
- struct PPMode *ppMode;
- char *filterToken;
-
- ppMode= av_malloc(sizeof(PPMode));
-
- ppMode->lumMode= 0;
- ppMode->chromMode= 0;
- ppMode->maxTmpNoise[0]= 700;
- ppMode->maxTmpNoise[1]= 1500;
- ppMode->maxTmpNoise[2]= 3000;
- ppMode->maxAllowedY= 234;
- ppMode->minAllowedY= 16;
- ppMode->baseDcDiff= 256/8;
- ppMode->flatnessThreshold= 56-16-1;
- ppMode->maxClippedThreshold= 0.01;
- ppMode->error=0;
-
- memset(temp, 0, GET_MODE_BUFFER_SIZE);
- av_strlcpy(temp, name, GET_MODE_BUFFER_SIZE - 1);
-
- av_log(NULL, AV_LOG_DEBUG, "pp: %s\n", name);
-
- for(;;){
- char *filterName;
- int q= 1000000; //PP_QUALITY_MAX;
- int chrom=-1;
- int luma=-1;
- char *option;
- char *options[OPTIONS_ARRAY_SIZE];
- int i;
- int filterNameOk=0;
- int numOfUnknownOptions=0;
- int enable=1; //does the user want us to enabled or disabled the filter
-
- filterToken= strtok(p, filterDelimiters);
- if(filterToken == NULL) break;
- p+= strlen(filterToken) + 1; // p points to next filterToken
- filterName= strtok(filterToken, optionDelimiters);
- av_log(NULL, AV_LOG_DEBUG, "pp: %s::%s\n", filterToken, filterName);
-
- if(*filterName == '-'){
- enable=0;
- filterName++;
- }
-
- for(;;){ //for all options
- option= strtok(NULL, optionDelimiters);
- if(option == NULL) break;
-
- av_log(NULL, AV_LOG_DEBUG, "pp: option: %s\n", option);
- if(!strcmp("autoq", option) || !strcmp("a", option)) q= quality;
- else if(!strcmp("nochrom", option) || !strcmp("y", option)) chrom=0;
- else if(!strcmp("chrom", option) || !strcmp("c", option)) chrom=1;
- else if(!strcmp("noluma", option) || !strcmp("n", option)) luma=0;
- else{
- options[numOfUnknownOptions] = option;
- numOfUnknownOptions++;
- }
- if(numOfUnknownOptions >= OPTIONS_ARRAY_SIZE-1) break;
- }
- options[numOfUnknownOptions] = NULL;
-
- /* replace stuff from the replace Table */
- for(i=0; replaceTable[2*i]!=NULL; i++){
- if(!strcmp(replaceTable[2*i], filterName)){
- int newlen= strlen(replaceTable[2*i + 1]);
- int plen;
- int spaceLeft;
-
- if(p==NULL) p= temp, *p=0; //last filter
- else p--, *p=','; //not last filter
-
- plen= strlen(p);
- spaceLeft= p - temp + plen;
- if(spaceLeft + newlen >= GET_MODE_BUFFER_SIZE - 1){
- ppMode->error++;
- break;
- }
- memmove(p + newlen, p, plen+1);
- memcpy(p, replaceTable[2*i + 1], newlen);
- filterNameOk=1;
- }
- }
-
- for(i=0; filters[i].shortName!=NULL; i++){
- if( !strcmp(filters[i].longName, filterName)
- || !strcmp(filters[i].shortName, filterName)){
- ppMode->lumMode &= ~filters[i].mask;
- ppMode->chromMode &= ~filters[i].mask;
-
- filterNameOk=1;
- if(!enable) break; // user wants to disable it
-
- if(q >= filters[i].minLumQuality && luma)
- ppMode->lumMode|= filters[i].mask;
- if(chrom==1 || (chrom==-1 && filters[i].chromDefault))
- if(q >= filters[i].minChromQuality)
- ppMode->chromMode|= filters[i].mask;
-
- if(filters[i].mask == LEVEL_FIX){
- int o;
- ppMode->minAllowedY= 16;
- ppMode->maxAllowedY= 234;
- for(o=0; options[o]!=NULL; o++){
- if( !strcmp(options[o],"fullyrange")
- ||!strcmp(options[o],"f")){
- ppMode->minAllowedY= 0;
- ppMode->maxAllowedY= 255;
- numOfUnknownOptions--;
- }
- }
- }
- else if(filters[i].mask == TEMP_NOISE_FILTER)
- {
- int o;
- int numOfNoises=0;
-
- for(o=0; options[o]!=NULL; o++){
- char *tail;
- ppMode->maxTmpNoise[numOfNoises]=
- strtol(options[o], &tail, 0);
- if(tail!=options[o]){
- numOfNoises++;
- numOfUnknownOptions--;
- if(numOfNoises >= 3) break;
- }
- }
- }
- else if(filters[i].mask == V_DEBLOCK || filters[i].mask == H_DEBLOCK
- || filters[i].mask == V_A_DEBLOCK || filters[i].mask == H_A_DEBLOCK){
- int o;
-
- for(o=0; options[o]!=NULL && o<2; o++){
- char *tail;
- int val= strtol(options[o], &tail, 0);
- if(tail==options[o]) break;
-
- numOfUnknownOptions--;
- if(o==0) ppMode->baseDcDiff= val;
- else ppMode->flatnessThreshold= val;
- }
- }
- else if(filters[i].mask == FORCE_QUANT){
- int o;
- ppMode->forcedQuant= 15;
-
- for(o=0; options[o]!=NULL && o<1; o++){
- char *tail;
- int val= strtol(options[o], &tail, 0);
- if(tail==options[o]) break;
-
- numOfUnknownOptions--;
- ppMode->forcedQuant= val;
- }
- }
- }
- }
- if(!filterNameOk) ppMode->error++;
- ppMode->error += numOfUnknownOptions;
- }
-
- av_log(NULL, AV_LOG_DEBUG, "pp: lumMode=%X, chromMode=%X\n", ppMode->lumMode, ppMode->chromMode);
- if(ppMode->error){
- av_log(NULL, AV_LOG_ERROR, "%d errors in postprocess string \"%s\"\n", ppMode->error, name);
- av_free(ppMode);
- return NULL;
- }
- return ppMode;
-}
-
-void pp_free_mode(pp_mode *mode){
- av_free(mode);
-}
-
-static void reallocAlign(void **p, int alignment, int size){
- av_free(*p);
- *p= av_mallocz(size);
-}
-
-static void reallocBuffers(PPContext *c, int width, int height, int stride, int qpStride){
- int mbWidth = (width+15)>>4;
- int mbHeight= (height+15)>>4;
- int i;
-
- c->stride= stride;
- c->qpStride= qpStride;
-
- reallocAlign((void **)&c->tempDst, 8, stride*24);
- reallocAlign((void **)&c->tempSrc, 8, stride*24);
- reallocAlign((void **)&c->tempBlocks, 8, 2*16*8);
- reallocAlign((void **)&c->yHistogram, 8, 256*sizeof(uint64_t));
- for(i=0; i<256; i++)
- c->yHistogram[i]= width*height/64*15/256;
-
- for(i=0; i<3; i++){
- //Note: The +17*1024 is just there so I do not have to worry about r/w over the end.
- reallocAlign((void **)&c->tempBlurred[i], 8, stride*mbHeight*16 + 17*1024);
- reallocAlign((void **)&c->tempBlurredPast[i], 8, 256*((height+7)&(~7))/2 + 17*1024);//FIXME size
- }
-
- reallocAlign((void **)&c->deintTemp, 8, 2*width+32);
- reallocAlign((void **)&c->nonBQPTable, 8, qpStride*mbHeight*sizeof(QP_STORE_T));
- reallocAlign((void **)&c->stdQPTable, 8, qpStride*mbHeight*sizeof(QP_STORE_T));
- reallocAlign((void **)&c->forcedQPTable, 8, mbWidth*sizeof(QP_STORE_T));
-}
-
-static const char * context_to_name(void * ptr) {
- return "postproc";
-}
-
-static const AVClass av_codec_context_class = { "Postproc", context_to_name, NULL };
-
-pp_context *pp_get_context(int width, int height, int cpuCaps){
- PPContext *c= av_malloc(sizeof(PPContext));
- int stride= FFALIGN(width, 16); //assumed / will realloc if needed
- int qpStride= (width+15)/16 + 2; //assumed / will realloc if needed
-
- memset(c, 0, sizeof(PPContext));
- c->av_class = &av_codec_context_class;
- c->cpuCaps= cpuCaps;
- if(cpuCaps&PP_FORMAT){
- c->hChromaSubSample= cpuCaps&0x3;
- c->vChromaSubSample= (cpuCaps>>4)&0x3;
- }else{
- c->hChromaSubSample= 1;
- c->vChromaSubSample= 1;
- }
-
- reallocBuffers(c, width, height, stride, qpStride);
-
- c->frameNum=-1;
-
- return c;
-}
-
-void pp_free_context(void *vc){
- PPContext *c = (PPContext*)vc;
- int i;
-
- for(i=0; i<3; i++) av_free(c->tempBlurred[i]);
- for(i=0; i<3; i++) av_free(c->tempBlurredPast[i]);
-
- av_free(c->tempBlocks);
- av_free(c->yHistogram);
- av_free(c->tempDst);
- av_free(c->tempSrc);
- av_free(c->deintTemp);
- av_free(c->stdQPTable);
- av_free(c->nonBQPTable);
- av_free(c->forcedQPTable);
-
- memset(c, 0, sizeof(PPContext));
-
- av_free(c);
-}
-
-void pp_postprocess(const uint8_t * src[3], const int srcStride[3],
- uint8_t * dst[3], const int dstStride[3],
- int width, int height,
- const QP_STORE_T *QP_store, int QPStride,
- pp_mode *vm, void *vc, int pict_type)
-{
- int mbWidth = (width+15)>>4;
- int mbHeight= (height+15)>>4;
- PPMode *mode = (PPMode*)vm;
- PPContext *c = (PPContext*)vc;
- int minStride= FFMAX(FFABS(srcStride[0]), FFABS(dstStride[0]));
- int absQPStride = FFABS(QPStride);
-
- // c->stride and c->QPStride are always positive
- if(c->stride < minStride || c->qpStride < absQPStride)
- reallocBuffers(c, width, height,
- FFMAX(minStride, c->stride),
- FFMAX(c->qpStride, absQPStride));
-
- if(QP_store==NULL || (mode->lumMode & FORCE_QUANT)){
- int i;
- QP_store= c->forcedQPTable;
- absQPStride = QPStride = 0;
- if(mode->lumMode & FORCE_QUANT)
- for(i=0; i<mbWidth; i++) c->forcedQPTable[i]= mode->forcedQuant;
- else
- for(i=0; i<mbWidth; i++) c->forcedQPTable[i]= 1;
- }
-
- if(pict_type & PP_PICT_TYPE_QP2){
- int i;
- const int count= mbHeight * absQPStride;
- for(i=0; i<(count>>2); i++){
- ((uint32_t*)c->stdQPTable)[i] = (((const uint32_t*)QP_store)[i]>>1) & 0x7F7F7F7F;
- }
- for(i<<=2; i<count; i++){
- c->stdQPTable[i] = QP_store[i]>>1;
- }
- QP_store= c->stdQPTable;
- QPStride= absQPStride;
- }
-
- if(0){
- int x,y;
- for(y=0; y<mbHeight; y++){
- for(x=0; x<mbWidth; x++){
- av_log(c, AV_LOG_INFO, "%2d ", QP_store[x + y*QPStride]);
- }
- av_log(c, AV_LOG_INFO, "\n");
- }
- av_log(c, AV_LOG_INFO, "\n");
- }
-
- if((pict_type&7)!=3){
- if (QPStride >= 0){
- int i;
- const int count= mbHeight * QPStride;
- for(i=0; i<(count>>2); i++){
- ((uint32_t*)c->nonBQPTable)[i] = ((const uint32_t*)QP_store)[i] & 0x3F3F3F3F;
- }
- for(i<<=2; i<count; i++){
- c->nonBQPTable[i] = QP_store[i] & 0x3F;
- }
- } else {
- int i,j;
- for(i=0; i<mbHeight; i++) {
- for(j=0; j<absQPStride; j++) {
- c->nonBQPTable[i*absQPStride+j] = QP_store[i*QPStride+j] & 0x3F;
- }
- }
- }
- }
-
- av_log(c, AV_LOG_DEBUG, "using npp filters 0x%X/0x%X\n",
- mode->lumMode, mode->chromMode);
-
- postProcess(src[0], srcStride[0], dst[0], dstStride[0],
- width, height, QP_store, QPStride, 0, mode, c);
-
- width = (width )>>c->hChromaSubSample;
- height = (height)>>c->vChromaSubSample;
-
- if(mode->chromMode){
- postProcess(src[1], srcStride[1], dst[1], dstStride[1],
- width, height, QP_store, QPStride, 1, mode, c);
- postProcess(src[2], srcStride[2], dst[2], dstStride[2],
- width, height, QP_store, QPStride, 2, mode, c);
- }
- else if(srcStride[1] == dstStride[1] && srcStride[2] == dstStride[2]){
- linecpy(dst[1], src[1], height, srcStride[1]);
- linecpy(dst[2], src[2], height, srcStride[2]);
- }else{
- int y;
- for(y=0; y<height; y++){
- memcpy(&(dst[1][y*dstStride[1]]), &(src[1][y*srcStride[1]]), width);
- memcpy(&(dst[2][y*dstStride[2]]), &(src[2][y*srcStride[2]]), width);
- }
- }
-}
diff --git a/gst-libs/ext/libav/libpostproc/postprocess.h b/gst-libs/ext/libav/libpostproc/postprocess.h
deleted file mode 100644
index 4cc6925..0000000
--- a/gst-libs/ext/libav/libpostproc/postprocess.h
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Copyright (C) 2001-2003 Michael Niedermayer (michaelni@gmx.at)
- *
- * This file is part of Libav.
- *
- * Libav is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 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 General Public License for more details.
- *
- * You should have received a copy of the GNU 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
- */
-
-#ifndef POSTPROC_POSTPROCESS_H
-#define POSTPROC_POSTPROCESS_H
-
-/**
- * @file
- * @brief
- * external postprocessing API
- */
-
-#include "libavutil/avutil.h"
-
-#define LIBPOSTPROC_VERSION_MAJOR 52
-#define LIBPOSTPROC_VERSION_MINOR 0
-#define LIBPOSTPROC_VERSION_MICRO 0
-
-#define LIBPOSTPROC_VERSION_INT AV_VERSION_INT(LIBPOSTPROC_VERSION_MAJOR, \
- LIBPOSTPROC_VERSION_MINOR, \
- LIBPOSTPROC_VERSION_MICRO)
-#define LIBPOSTPROC_VERSION AV_VERSION(LIBPOSTPROC_VERSION_MAJOR, \
- LIBPOSTPROC_VERSION_MINOR, \
- LIBPOSTPROC_VERSION_MICRO)
-#define LIBPOSTPROC_BUILD LIBPOSTPROC_VERSION_INT
-
-#define LIBPOSTPROC_IDENT "postproc" AV_STRINGIFY(LIBPOSTPROC_VERSION)
-
-/**
- * Return the LIBPOSTPROC_VERSION_INT constant.
- */
-unsigned postproc_version(void);
-
-/**
- * Return the libpostproc build-time configuration.
- */
-const char *postproc_configuration(void);
-
-/**
- * Return the libpostproc license.
- */
-const char *postproc_license(void);
-
-#define PP_QUALITY_MAX 6
-
-#define QP_STORE_T int8_t
-
-#include <inttypes.h>
-
-typedef void pp_context;
-typedef void pp_mode;
-
-extern const char pp_help[]; ///< a simple help text
-
-void pp_postprocess(const uint8_t * src[3], const int srcStride[3],
- uint8_t * dst[3], const int dstStride[3],
- int horizontalSize, int verticalSize,
- const QP_STORE_T *QP_store, int QP_stride,
- pp_mode *mode, pp_context *ppContext, int pict_type);
-
-
-/**
- * Return a pp_mode or NULL if an error occurred.
- *
- * @param name the string after "-pp" on the command line
- * @param quality a number from 0 to PP_QUALITY_MAX
- */
-pp_mode *pp_get_mode_by_name_and_quality(const char *name, int quality);
-void pp_free_mode(pp_mode *mode);
-
-pp_context *pp_get_context(int width, int height, int flags);
-void pp_free_context(pp_context *ppContext);
-
-#define PP_CPU_CAPS_MMX 0x80000000
-#define PP_CPU_CAPS_MMX2 0x20000000
-#define PP_CPU_CAPS_3DNOW 0x40000000
-#define PP_CPU_CAPS_ALTIVEC 0x10000000
-
-#define PP_FORMAT 0x00000008
-#define PP_FORMAT_420 (0x00000011|PP_FORMAT)
-#define PP_FORMAT_422 (0x00000001|PP_FORMAT)
-#define PP_FORMAT_411 (0x00000002|PP_FORMAT)
-#define PP_FORMAT_444 (0x00000000|PP_FORMAT)
-
-#define PP_PICT_TYPE_QP2 0x00000010 ///< MPEG2 style QScale
-
-#endif /* POSTPROC_POSTPROCESS_H */
diff --git a/gst-libs/ext/libav/libpostproc/postprocess_altivec_template.c b/gst-libs/ext/libav/libpostproc/postprocess_altivec_template.c
deleted file mode 100644
index ac65df8..0000000
--- a/gst-libs/ext/libav/libpostproc/postprocess_altivec_template.c
+++ /dev/null
@@ -1,1210 +0,0 @@
-/*
- * AltiVec optimizations (C) 2004 Romain Dolbeau <romain@dolbeau.org>
- *
- * based on code by Copyright (C) 2001-2003 Michael Niedermayer (michaelni@gmx.at)
- *
- * This file is part of Libav.
- *
- * Libav is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 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 General Public License for more details.
- *
- * You should have received a copy of the GNU 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
- */
-
-#include "libavutil/avutil.h"
-
-#define ALTIVEC_TRANSPOSE_8x8_SHORT(src_a,src_b,src_c,src_d,src_e,src_f,src_g,src_h) \
- do { \
- __typeof__(src_a) tempA1, tempB1, tempC1, tempD1; \
- __typeof__(src_a) tempE1, tempF1, tempG1, tempH1; \
- __typeof__(src_a) tempA2, tempB2, tempC2, tempD2; \
- __typeof__(src_a) tempE2, tempF2, tempG2, tempH2; \
- tempA1 = vec_mergeh (src_a, src_e); \
- tempB1 = vec_mergel (src_a, src_e); \
- tempC1 = vec_mergeh (src_b, src_f); \
- tempD1 = vec_mergel (src_b, src_f); \
- tempE1 = vec_mergeh (src_c, src_g); \
- tempF1 = vec_mergel (src_c, src_g); \
- tempG1 = vec_mergeh (src_d, src_h); \
- tempH1 = vec_mergel (src_d, src_h); \
- tempA2 = vec_mergeh (tempA1, tempE1); \
- tempB2 = vec_mergel (tempA1, tempE1); \
- tempC2 = vec_mergeh (tempB1, tempF1); \
- tempD2 = vec_mergel (tempB1, tempF1); \
- tempE2 = vec_mergeh (tempC1, tempG1); \
- tempF2 = vec_mergel (tempC1, tempG1); \
- tempG2 = vec_mergeh (tempD1, tempH1); \
- tempH2 = vec_mergel (tempD1, tempH1); \
- src_a = vec_mergeh (tempA2, tempE2); \
- src_b = vec_mergel (tempA2, tempE2); \
- src_c = vec_mergeh (tempB2, tempF2); \
- src_d = vec_mergel (tempB2, tempF2); \
- src_e = vec_mergeh (tempC2, tempG2); \
- src_f = vec_mergel (tempC2, tempG2); \
- src_g = vec_mergeh (tempD2, tempH2); \
- src_h = vec_mergel (tempD2, tempH2); \
- } while (0)
-
-
-static inline int vertClassify_altivec(uint8_t src[], int stride, PPContext *c) {
- /*
- this code makes no assumption on src or stride.
- One could remove the recomputation of the perm
- vector by assuming (stride % 16) == 0, unfortunately
- this is not always true.
- */
- short data_0 = ((c->nonBQP*c->ppMode.baseDcDiff)>>8) + 1;
- DECLARE_ALIGNED(16, short, data)[8] =
- {
- data_0,
- data_0 * 2 + 1,
- c->QP * 2,
- c->QP * 4
- };
- int numEq;
- uint8_t *src2 = src;
- vector signed short v_dcOffset;
- vector signed short v2QP;
- vector unsigned short v4QP;
- vector unsigned short v_dcThreshold;
- const int properStride = (stride % 16);
- const int srcAlign = ((unsigned long)src2 % 16);
- const int two_vectors = ((srcAlign > 8) || properStride) ? 1 : 0;
- const vector signed int zero = vec_splat_s32(0);
- const vector signed short mask = vec_splat_s16(1);
- vector signed int v_numEq = vec_splat_s32(0);
- vector signed short v_data = vec_ld(0, data);
- vector signed short v_srcAss0, v_srcAss1, v_srcAss2, v_srcAss3,
- v_srcAss4, v_srcAss5, v_srcAss6, v_srcAss7;
-//FIXME avoid this mess if possible
- register int j0 = 0,
- j1 = stride,
- j2 = 2 * stride,
- j3 = 3 * stride,
- j4 = 4 * stride,
- j5 = 5 * stride,
- j6 = 6 * stride,
- j7 = 7 * stride;
- vector unsigned char v_srcA0, v_srcA1, v_srcA2, v_srcA3,
- v_srcA4, v_srcA5, v_srcA6, v_srcA7;
-
- v_dcOffset = vec_splat(v_data, 0);
- v_dcThreshold = (vector unsigned short)vec_splat(v_data, 1);
- v2QP = vec_splat(v_data, 2);
- v4QP = (vector unsigned short)vec_splat(v_data, 3);
-
- src2 += stride * 4;
-
-#define LOAD_LINE(i) \
- { \
- vector unsigned char perm##i = vec_lvsl(j##i, src2); \
- vector unsigned char v_srcA2##i; \
- vector unsigned char v_srcA1##i = vec_ld(j##i, src2); \
- if (two_vectors) \
- v_srcA2##i = vec_ld(j##i + 16, src2); \
- v_srcA##i = \
- vec_perm(v_srcA1##i, v_srcA2##i, perm##i); \
- v_srcAss##i = \
- (vector signed short)vec_mergeh((vector signed char)zero, \
- (vector signed char)v_srcA##i); }
-
-#define LOAD_LINE_ALIGNED(i) \
- v_srcA##i = vec_ld(j##i, src2); \
- v_srcAss##i = \
- (vector signed short)vec_mergeh((vector signed char)zero, \
- (vector signed char)v_srcA##i)
-
- /* Special-casing the aligned case is worthwhile, as all calls from
- * the (transposed) horizontable deblocks will be aligned, in addition
- * to the naturally aligned vertical deblocks. */
- if (properStride && srcAlign) {
- LOAD_LINE_ALIGNED(0);
- LOAD_LINE_ALIGNED(1);
- LOAD_LINE_ALIGNED(2);
- LOAD_LINE_ALIGNED(3);
- LOAD_LINE_ALIGNED(4);
- LOAD_LINE_ALIGNED(5);
- LOAD_LINE_ALIGNED(6);
- LOAD_LINE_ALIGNED(7);
- } else {
- LOAD_LINE(0);
- LOAD_LINE(1);
- LOAD_LINE(2);
- LOAD_LINE(3);
- LOAD_LINE(4);
- LOAD_LINE(5);
- LOAD_LINE(6);
- LOAD_LINE(7);
- }
-#undef LOAD_LINE
-#undef LOAD_LINE_ALIGNED
-
-#define ITER(i, j) \
- const vector signed short v_diff##i = \
- vec_sub(v_srcAss##i, v_srcAss##j); \
- const vector signed short v_sum##i = \
- vec_add(v_diff##i, v_dcOffset); \
- const vector signed short v_comp##i = \
- (vector signed short)vec_cmplt((vector unsigned short)v_sum##i, \
- v_dcThreshold); \
- const vector signed short v_part##i = vec_and(mask, v_comp##i);
-
- {
- ITER(0, 1)
- ITER(1, 2)
- ITER(2, 3)
- ITER(3, 4)
- ITER(4, 5)
- ITER(5, 6)
- ITER(6, 7)
-
- v_numEq = vec_sum4s(v_part0, v_numEq);
- v_numEq = vec_sum4s(v_part1, v_numEq);
- v_numEq = vec_sum4s(v_part2, v_numEq);
- v_numEq = vec_sum4s(v_part3, v_numEq);
- v_numEq = vec_sum4s(v_part4, v_numEq);
- v_numEq = vec_sum4s(v_part5, v_numEq);
- v_numEq = vec_sum4s(v_part6, v_numEq);
- }
-
-#undef ITER
-
- v_numEq = vec_sums(v_numEq, zero);
-
- v_numEq = vec_splat(v_numEq, 3);
- vec_ste(v_numEq, 0, &numEq);
-
- if (numEq > c->ppMode.flatnessThreshold){
- const vector unsigned char mmoP1 = (const vector unsigned char)
- {0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f,
- 0x00, 0x01, 0x12, 0x13, 0x08, 0x09, 0x1A, 0x1B};
- const vector unsigned char mmoP2 = (const vector unsigned char)
- {0x04, 0x05, 0x16, 0x17, 0x0C, 0x0D, 0x1E, 0x1F,
- 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f};
- const vector unsigned char mmoP = (const vector unsigned char)
- vec_lvsl(8, (unsigned char*)0);
-
- vector signed short mmoL1 = vec_perm(v_srcAss0, v_srcAss2, mmoP1);
- vector signed short mmoL2 = vec_perm(v_srcAss4, v_srcAss6, mmoP2);
- vector signed short mmoL = vec_perm(mmoL1, mmoL2, mmoP);
- vector signed short mmoR1 = vec_perm(v_srcAss5, v_srcAss7, mmoP1);
- vector signed short mmoR2 = vec_perm(v_srcAss1, v_srcAss3, mmoP2);
- vector signed short mmoR = vec_perm(mmoR1, mmoR2, mmoP);
- vector signed short mmoDiff = vec_sub(mmoL, mmoR);
- vector unsigned short mmoSum = (vector unsigned short)vec_add(mmoDiff, v2QP);
-
- if (vec_any_gt(mmoSum, v4QP))
- return 0;
- else
- return 1;
- }
- else return 2;
-}
-
-static inline void doVertLowPass_altivec(uint8_t *src, int stride, PPContext *c) {
- /*
- this code makes no assumption on src or stride.
- One could remove the recomputation of the perm
- vector by assuming (stride % 16) == 0, unfortunately
- this is not always true. Quite a lot of load/stores
- can be removed by assuming proper alignment of
- src & stride :-(
- */
- uint8_t *src2 = src;
- const vector signed int zero = vec_splat_s32(0);
- const int properStride = (stride % 16);
- const int srcAlign = ((unsigned long)src2 % 16);
- DECLARE_ALIGNED(16, short, qp)[8] = {c->QP};
- vector signed short vqp = vec_ld(0, qp);
- vector signed short vb0, vb1, vb2, vb3, vb4, vb5, vb6, vb7, vb8, vb9;
- vector unsigned char vbA0, av_uninit(vbA1), av_uninit(vbA2), av_uninit(vbA3), av_uninit(vbA4), av_uninit(vbA5), av_uninit(vbA6), av_uninit(vbA7), av_uninit(vbA8), vbA9;
- vector unsigned char vbB0, av_uninit(vbB1), av_uninit(vbB2), av_uninit(vbB3), av_uninit(vbB4), av_uninit(vbB5), av_uninit(vbB6), av_uninit(vbB7), av_uninit(vbB8), vbB9;
- vector unsigned char vbT0, vbT1, vbT2, vbT3, vbT4, vbT5, vbT6, vbT7, vbT8, vbT9;
- vector unsigned char perml0, perml1, perml2, perml3, perml4,
- perml5, perml6, perml7, perml8, perml9;
- register int j0 = 0,
- j1 = stride,
- j2 = 2 * stride,
- j3 = 3 * stride,
- j4 = 4 * stride,
- j5 = 5 * stride,
- j6 = 6 * stride,
- j7 = 7 * stride,
- j8 = 8 * stride,
- j9 = 9 * stride;
-
- vqp = vec_splat(vqp, 0);
-
- src2 += stride*3;
-
-#define LOAD_LINE(i) \
- perml##i = vec_lvsl(i * stride, src2); \
- vbA##i = vec_ld(i * stride, src2); \
- vbB##i = vec_ld(i * stride + 16, src2); \
- vbT##i = vec_perm(vbA##i, vbB##i, perml##i); \
- vb##i = \
- (vector signed short)vec_mergeh((vector unsigned char)zero, \
- (vector unsigned char)vbT##i)
-
-#define LOAD_LINE_ALIGNED(i) \
- vbT##i = vec_ld(j##i, src2); \
- vb##i = \
- (vector signed short)vec_mergeh((vector signed char)zero, \
- (vector signed char)vbT##i)
-
- /* Special-casing the aligned case is worthwhile, as all calls from
- * the (transposed) horizontable deblocks will be aligned, in addition
- * to the naturally aligned vertical deblocks. */
- if (properStride && srcAlign) {
- LOAD_LINE_ALIGNED(0);
- LOAD_LINE_ALIGNED(1);
- LOAD_LINE_ALIGNED(2);
- LOAD_LINE_ALIGNED(3);
- LOAD_LINE_ALIGNED(4);
- LOAD_LINE_ALIGNED(5);
- LOAD_LINE_ALIGNED(6);
- LOAD_LINE_ALIGNED(7);
- LOAD_LINE_ALIGNED(8);
- LOAD_LINE_ALIGNED(9);
- } else {
- LOAD_LINE(0);
- LOAD_LINE(1);
- LOAD_LINE(2);
- LOAD_LINE(3);
- LOAD_LINE(4);
- LOAD_LINE(5);
- LOAD_LINE(6);
- LOAD_LINE(7);
- LOAD_LINE(8);
- LOAD_LINE(9);
- }
-#undef LOAD_LINE
-#undef LOAD_LINE_ALIGNED
- {
- const vector unsigned short v_2 = vec_splat_u16(2);
- const vector unsigned short v_4 = vec_splat_u16(4);
-
- const vector signed short v_diff01 = vec_sub(vb0, vb1);
- const vector unsigned short v_cmp01 =
- (const vector unsigned short) vec_cmplt(vec_abs(v_diff01), vqp);
- const vector signed short v_first = vec_sel(vb1, vb0, v_cmp01);
- const vector signed short v_diff89 = vec_sub(vb8, vb9);
- const vector unsigned short v_cmp89 =
- (const vector unsigned short) vec_cmplt(vec_abs(v_diff89), vqp);
- const vector signed short v_last = vec_sel(vb8, vb9, v_cmp89);
-
- const vector signed short temp01 = vec_mladd(v_first, (vector signed short)v_4, vb1);
- const vector signed short temp02 = vec_add(vb2, vb3);
- const vector signed short temp03 = vec_add(temp01, (vector signed short)v_4);
- const vector signed short v_sumsB0 = vec_add(temp02, temp03);
-
- const vector signed short temp11 = vec_sub(v_sumsB0, v_first);
- const vector signed short v_sumsB1 = vec_add(temp11, vb4);
-
- const vector signed short temp21 = vec_sub(v_sumsB1, v_first);
- const vector signed short v_sumsB2 = vec_add(temp21, vb5);
-
- const vector signed short temp31 = vec_sub(v_sumsB2, v_first);
- const vector signed short v_sumsB3 = vec_add(temp31, vb6);
-
- const vector signed short temp41 = vec_sub(v_sumsB3, v_first);
- const vector signed short v_sumsB4 = vec_add(temp41, vb7);
-
- const vector signed short temp51 = vec_sub(v_sumsB4, vb1);
- const vector signed short v_sumsB5 = vec_add(temp51, vb8);
-
- const vector signed short temp61 = vec_sub(v_sumsB5, vb2);
- const vector signed short v_sumsB6 = vec_add(temp61, v_last);
-
- const vector signed short temp71 = vec_sub(v_sumsB6, vb3);
- const vector signed short v_sumsB7 = vec_add(temp71, v_last);
-
- const vector signed short temp81 = vec_sub(v_sumsB7, vb4);
- const vector signed short v_sumsB8 = vec_add(temp81, v_last);
-
- const vector signed short temp91 = vec_sub(v_sumsB8, vb5);
- const vector signed short v_sumsB9 = vec_add(temp91, v_last);
-
- #define COMPUTE_VR(i, j, k) \
- const vector signed short temps1##i = \
- vec_add(v_sumsB##i, v_sumsB##k); \
- const vector signed short temps2##i = \
- vec_mladd(vb##j, (vector signed short)v_2, temps1##i); \
- const vector signed short vr##j = vec_sra(temps2##i, v_4)
-
- COMPUTE_VR(0, 1, 2);
- COMPUTE_VR(1, 2, 3);
- COMPUTE_VR(2, 3, 4);
- COMPUTE_VR(3, 4, 5);
- COMPUTE_VR(4, 5, 6);
- COMPUTE_VR(5, 6, 7);
- COMPUTE_VR(6, 7, 8);
- COMPUTE_VR(7, 8, 9);
-
- const vector signed char neg1 = vec_splat_s8(-1);
- const vector unsigned char permHH = (const vector unsigned char){0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
- 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F};
-
-#define PACK_AND_STORE(i) \
-{ const vector unsigned char perms##i = \
- vec_lvsr(i * stride, src2); \
- const vector unsigned char vf##i = \
- vec_packsu(vr##i, (vector signed short)zero); \
- const vector unsigned char vg##i = \
- vec_perm(vf##i, vbT##i, permHH); \
- const vector unsigned char mask##i = \
- vec_perm((vector unsigned char)zero, (vector unsigned char)neg1, perms##i); \
- const vector unsigned char vg2##i = \
- vec_perm(vg##i, vg##i, perms##i); \
- const vector unsigned char svA##i = \
- vec_sel(vbA##i, vg2##i, mask##i); \
- const vector unsigned char svB##i = \
- vec_sel(vg2##i, vbB##i, mask##i); \
- vec_st(svA##i, i * stride, src2); \
- vec_st(svB##i, i * stride + 16, src2);}
-
-#define PACK_AND_STORE_ALIGNED(i) \
-{ const vector unsigned char vf##i = \
- vec_packsu(vr##i, (vector signed short)zero); \
- const vector unsigned char vg##i = \
- vec_perm(vf##i, vbT##i, permHH); \
- vec_st(vg##i, i * stride, src2);}
-
- /* Special-casing the aligned case is worthwhile, as all calls from
- * the (transposed) horizontable deblocks will be aligned, in addition
- * to the naturally aligned vertical deblocks. */
- if (properStride && srcAlign) {
- PACK_AND_STORE_ALIGNED(1)
- PACK_AND_STORE_ALIGNED(2)
- PACK_AND_STORE_ALIGNED(3)
- PACK_AND_STORE_ALIGNED(4)
- PACK_AND_STORE_ALIGNED(5)
- PACK_AND_STORE_ALIGNED(6)
- PACK_AND_STORE_ALIGNED(7)
- PACK_AND_STORE_ALIGNED(8)
- } else {
- PACK_AND_STORE(1)
- PACK_AND_STORE(2)
- PACK_AND_STORE(3)
- PACK_AND_STORE(4)
- PACK_AND_STORE(5)
- PACK_AND_STORE(6)
- PACK_AND_STORE(7)
- PACK_AND_STORE(8)
- }
- #undef PACK_AND_STORE
- #undef PACK_AND_STORE_ALIGNED
- }
-}
-
-
-
-static inline void doVertDefFilter_altivec(uint8_t src[], int stride, PPContext *c) {
- /*
- this code makes no assumption on src or stride.
- One could remove the recomputation of the perm
- vector by assuming (stride % 16) == 0, unfortunately
- this is not always true. Quite a lot of load/stores
- can be removed by assuming proper alignment of
- src & stride :-(
- */
- uint8_t *src2 = src + stride*3;
- const vector signed int zero = vec_splat_s32(0);
- DECLARE_ALIGNED(16, short, qp)[8] = {8*c->QP};
- vector signed short vqp = vec_splat(
- (vector signed short)vec_ld(0, qp), 0);
-
-#define LOAD_LINE(i) \
- const vector unsigned char perm##i = \
- vec_lvsl(i * stride, src2); \
- const vector unsigned char vbA##i = \
- vec_ld(i * stride, src2); \
- const vector unsigned char vbB##i = \
- vec_ld(i * stride + 16, src2); \
- const vector unsigned char vbT##i = \
- vec_perm(vbA##i, vbB##i, perm##i); \
- const vector signed short vb##i = \
- (vector signed short)vec_mergeh((vector unsigned char)zero, \
- (vector unsigned char)vbT##i)
-
- LOAD_LINE(1);
- LOAD_LINE(2);
- LOAD_LINE(3);
- LOAD_LINE(4);
- LOAD_LINE(5);
- LOAD_LINE(6);
- LOAD_LINE(7);
- LOAD_LINE(8);
-#undef LOAD_LINE
-
- const vector signed short v_1 = vec_splat_s16(1);
- const vector signed short v_2 = vec_splat_s16(2);
- const vector signed short v_5 = vec_splat_s16(5);
- const vector signed short v_32 = vec_sl(v_1,
- (vector unsigned short)v_5);
- /* middle energy */
- const vector signed short l3minusl6 = vec_sub(vb3, vb6);
- const vector signed short l5minusl4 = vec_sub(vb5, vb4);
- const vector signed short twotimes_l3minusl6 = vec_mladd(v_2, l3minusl6, (vector signed short)zero);
- const vector signed short mE = vec_mladd(v_5, l5minusl4, twotimes_l3minusl6);
- const vector signed short absmE = vec_abs(mE);
- /* left & right energy */
- const vector signed short l1minusl4 = vec_sub(vb1, vb4);
- const vector signed short l3minusl2 = vec_sub(vb3, vb2);
- const vector signed short l5minusl8 = vec_sub(vb5, vb8);
- const vector signed short l7minusl6 = vec_sub(vb7, vb6);
- const vector signed short twotimes_l1minusl4 = vec_mladd(v_2, l1minusl4, (vector signed short)zero);
- const vector signed short twotimes_l5minusl8 = vec_mladd(v_2, l5minusl8, (vector signed short)zero);
- const vector signed short lE = vec_mladd(v_5, l3minusl2, twotimes_l1minusl4);
- const vector signed short rE = vec_mladd(v_5, l7minusl6, twotimes_l5minusl8);
- /* d */
- const vector signed short ddiff = vec_sub(absmE,
- vec_min(vec_abs(lE),
- vec_abs(rE)));
- const vector signed short ddiffclamp = vec_max(ddiff, (vector signed short)zero);
- const vector signed short dtimes64 = vec_mladd(v_5, ddiffclamp, v_32);
- const vector signed short d = vec_sra(dtimes64, vec_splat_u16(6));
- const vector signed short minusd = vec_sub((vector signed short)zero, d);
- const vector signed short finald = vec_sel(minusd,
- d,
- vec_cmpgt(vec_sub((vector signed short)zero, mE),
- (vector signed short)zero));
- /* q */
- const vector signed short qtimes2 = vec_sub(vb4, vb5);
- /* for a shift right to behave like /2, we need to add one
- to all negative integer */
- const vector signed short rounddown = vec_sel((vector signed short)zero,
- v_1,
- vec_cmplt(qtimes2, (vector signed short)zero));
- const vector signed short q = vec_sra(vec_add(qtimes2, rounddown), vec_splat_u16(1));
- /* clamp */
- const vector signed short dclamp_P1 = vec_max((vector signed short)zero, finald);
- const vector signed short dclamp_P = vec_min(dclamp_P1, q);
- const vector signed short dclamp_N1 = vec_min((vector signed short)zero, finald);
- const vector signed short dclamp_N = vec_max(dclamp_N1, q);
-
- const vector signed short dclampedfinal = vec_sel(dclamp_N,
- dclamp_P,
- vec_cmpgt(q, (vector signed short)zero));
- const vector signed short dornotd = vec_sel((vector signed short)zero,
- dclampedfinal,
- vec_cmplt(absmE, vqp));
- /* add/subtract to l4 and l5 */
- const vector signed short vb4minusd = vec_sub(vb4, dornotd);
- const vector signed short vb5plusd = vec_add(vb5, dornotd);
- /* finally, stores */
- const vector unsigned char st4 = vec_packsu(vb4minusd, (vector signed short)zero);
- const vector unsigned char st5 = vec_packsu(vb5plusd, (vector signed short)zero);
-
- const vector signed char neg1 = vec_splat_s8(-1);
- const vector unsigned char permHH = (const vector unsigned char){0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
- 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F};
-
-#define STORE(i) \
-{ const vector unsigned char perms##i = \
- vec_lvsr(i * stride, src2); \
- const vector unsigned char vg##i = \
- vec_perm(st##i, vbT##i, permHH); \
- const vector unsigned char mask##i = \
- vec_perm((vector unsigned char)zero, (vector unsigned char)neg1, perms##i); \
- const vector unsigned char vg2##i = \
- vec_perm(vg##i, vg##i, perms##i); \
- const vector unsigned char svA##i = \
- vec_sel(vbA##i, vg2##i, mask##i); \
- const vector unsigned char svB##i = \
- vec_sel(vg2##i, vbB##i, mask##i); \
- vec_st(svA##i, i * stride, src2); \
- vec_st(svB##i, i * stride + 16, src2);}
-
- STORE(4)
- STORE(5)
-}
-
-static inline void dering_altivec(uint8_t src[], int stride, PPContext *c) {
- const vector signed int vsint32_8 = vec_splat_s32(8);
- const vector unsigned int vuint32_4 = vec_splat_u32(4);
- const vector signed char neg1 = vec_splat_s8(-1);
-
- const vector unsigned char permA1 = (vector unsigned char)
- {0x00, 0x01, 0x02, 0x10, 0x11, 0x12, 0x1F, 0x1F,
- 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F};
- const vector unsigned char permA2 = (vector unsigned char)
- {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x10, 0x11,
- 0x12, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F};
- const vector unsigned char permA1inc = (vector unsigned char)
- {0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
- const vector unsigned char permA2inc = (vector unsigned char)
- {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
- const vector unsigned char magic = (vector unsigned char)
- {0x01, 0x02, 0x01, 0x02, 0x04, 0x02, 0x01, 0x02,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
- const vector unsigned char extractPerm = (vector unsigned char)
- {0x10, 0x10, 0x10, 0x01, 0x10, 0x10, 0x10, 0x01,
- 0x10, 0x10, 0x10, 0x01, 0x10, 0x10, 0x10, 0x01};
- const vector unsigned char extractPermInc = (vector unsigned char)
- {0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01,
- 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01};
- const vector unsigned char identity = vec_lvsl(0,(unsigned char *)0);
- const vector unsigned char tenRight = (vector unsigned char)
- {0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
- const vector unsigned char eightLeft = (vector unsigned char)
- {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08};
-
- /*
- this code makes no assumption on src or stride.
- One could remove the recomputation of the perm
- vector by assuming (stride % 16) == 0, unfortunately
- this is not always true. Quite a lot of load/stores
- can be removed by assuming proper alignment of
- src & stride :-(
- */
- uint8_t *srcCopy = src;
- DECLARE_ALIGNED(16, uint8_t, dt)[16] = { deringThreshold };
- const vector signed int zero = vec_splat_s32(0);
- vector unsigned char v_dt = vec_splat(vec_ld(0, dt), 0);
-
-#define LOAD_LINE(i) \
- const vector unsigned char perm##i = \
- vec_lvsl(i * stride, srcCopy); \
- vector unsigned char sA##i = vec_ld(i * stride, srcCopy); \
- vector unsigned char sB##i = vec_ld(i * stride + 16, srcCopy); \
- vector unsigned char src##i = vec_perm(sA##i, sB##i, perm##i)
-
- LOAD_LINE(0);
- LOAD_LINE(1);
- LOAD_LINE(2);
- LOAD_LINE(3);
- LOAD_LINE(4);
- LOAD_LINE(5);
- LOAD_LINE(6);
- LOAD_LINE(7);
- LOAD_LINE(8);
- LOAD_LINE(9);
-#undef LOAD_LINE
-
- vector unsigned char v_avg;
- DECLARE_ALIGNED(16, signed int, S)[8];
- DECLARE_ALIGNED(16, int, tQP2)[4] = { c->QP/2 + 1 };
- vector signed int vQP2 = vec_ld(0, tQP2);
- vQP2 = vec_splat(vQP2, 0);
-
- {
- const vector unsigned char trunc_perm = (vector unsigned char)
- {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
- 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18};
- const vector unsigned char trunc_src12 = vec_perm(src1, src2, trunc_perm);
- const vector unsigned char trunc_src34 = vec_perm(src3, src4, trunc_perm);
- const vector unsigned char trunc_src56 = vec_perm(src5, src6, trunc_perm);
- const vector unsigned char trunc_src78 = vec_perm(src7, src8, trunc_perm);
-
-#define EXTRACT(op) do { \
- const vector unsigned char s_1 = vec_##op(trunc_src12, trunc_src34); \
- const vector unsigned char s_2 = vec_##op(trunc_src56, trunc_src78); \
- const vector unsigned char s_6 = vec_##op(s_1, s_2); \
- const vector unsigned char s_8h = vec_mergeh(s_6, s_6); \
- const vector unsigned char s_8l = vec_mergel(s_6, s_6); \
- const vector unsigned char s_9 = vec_##op(s_8h, s_8l); \
- const vector unsigned char s_9h = vec_mergeh(s_9, s_9); \
- const vector unsigned char s_9l = vec_mergel(s_9, s_9); \
- const vector unsigned char s_10 = vec_##op(s_9h, s_9l); \
- const vector unsigned char s_10h = vec_mergeh(s_10, s_10); \
- const vector unsigned char s_10l = vec_mergel(s_10, s_10); \
- const vector unsigned char s_11 = vec_##op(s_10h, s_10l); \
- const vector unsigned char s_11h = vec_mergeh(s_11, s_11); \
- const vector unsigned char s_11l = vec_mergel(s_11, s_11); \
- v_##op = vec_##op(s_11h, s_11l); \
-} while (0)
-
- vector unsigned char v_min;
- vector unsigned char v_max;
- EXTRACT(min);
- EXTRACT(max);
-#undef EXTRACT
-
- if (vec_all_lt(vec_sub(v_max, v_min), v_dt))
- return;
-
- v_avg = vec_avg(v_min, v_max);
- }
-
- {
- const vector unsigned short mask1 = (vector unsigned short)
- {0x0001, 0x0002, 0x0004, 0x0008,
- 0x0010, 0x0020, 0x0040, 0x0080};
- const vector unsigned short mask2 = (vector unsigned short)
- {0x0100, 0x0200, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x0000};
-
- const vector unsigned int vuint32_16 = vec_sl(vec_splat_u32(1), vec_splat_u32(4));
- const vector unsigned int vuint32_1 = vec_splat_u32(1);
-
- vector signed int sumA2;
- vector signed int sumB2;
- vector signed int sum0, sum1, sum2, sum3, sum4;
- vector signed int sum5, sum6, sum7, sum8, sum9;
-
-#define COMPARE(i) \
- do { \
- const vector unsigned char cmp = \
- (vector unsigned char)vec_cmpgt(src##i, v_avg); \
- const vector unsigned short cmpHi = \
- (vector unsigned short)vec_mergeh(cmp, cmp); \
- const vector unsigned short cmpLi = \
- (vector unsigned short)vec_mergel(cmp, cmp); \
- const vector signed short cmpHf = \
- (vector signed short)vec_and(cmpHi, mask1); \
- const vector signed short cmpLf = \
- (vector signed short)vec_and(cmpLi, mask2); \
- const vector signed int sump = vec_sum4s(cmpHf, zero); \
- const vector signed int sumq = vec_sum4s(cmpLf, sump); \
- sum##i = vec_sums(sumq, zero); \
- } while (0)
-
- COMPARE(0);
- COMPARE(1);
- COMPARE(2);
- COMPARE(3);
- COMPARE(4);
- COMPARE(5);
- COMPARE(6);
- COMPARE(7);
- COMPARE(8);
- COMPARE(9);
-#undef COMPARE
-
- {
- const vector signed int sump02 = vec_mergel(sum0, sum2);
- const vector signed int sump13 = vec_mergel(sum1, sum3);
- const vector signed int sumA = vec_mergel(sump02, sump13);
-
- const vector signed int sump46 = vec_mergel(sum4, sum6);
- const vector signed int sump57 = vec_mergel(sum5, sum7);
- const vector signed int sumB = vec_mergel(sump46, sump57);
-
- const vector signed int sump8A = vec_mergel(sum8, zero);
- const vector signed int sump9B = vec_mergel(sum9, zero);
- const vector signed int sumC = vec_mergel(sump8A, sump9B);
-
- const vector signed int tA = vec_sl(vec_nor(zero, sumA), vuint32_16);
- const vector signed int tB = vec_sl(vec_nor(zero, sumB), vuint32_16);
- const vector signed int tC = vec_sl(vec_nor(zero, sumC), vuint32_16);
- const vector signed int t2A = vec_or(sumA, tA);
- const vector signed int t2B = vec_or(sumB, tB);
- const vector signed int t2C = vec_or(sumC, tC);
- const vector signed int t3A = vec_and(vec_sra(t2A, vuint32_1),
- vec_sl(t2A, vuint32_1));
- const vector signed int t3B = vec_and(vec_sra(t2B, vuint32_1),
- vec_sl(t2B, vuint32_1));
- const vector signed int t3C = vec_and(vec_sra(t2C, vuint32_1),
- vec_sl(t2C, vuint32_1));
- const vector signed int yA = vec_and(t2A, t3A);
- const vector signed int yB = vec_and(t2B, t3B);
- const vector signed int yC = vec_and(t2C, t3C);
-
- const vector unsigned char strangeperm1 = vec_lvsl(4, (unsigned char*)0);
- const vector unsigned char strangeperm2 = vec_lvsl(8, (unsigned char*)0);
- const vector signed int sumAd4 = vec_perm(yA, yB, strangeperm1);
- const vector signed int sumAd8 = vec_perm(yA, yB, strangeperm2);
- const vector signed int sumBd4 = vec_perm(yB, yC, strangeperm1);
- const vector signed int sumBd8 = vec_perm(yB, yC, strangeperm2);
- const vector signed int sumAp = vec_and(yA,
- vec_and(sumAd4,sumAd8));
- const vector signed int sumBp = vec_and(yB,
- vec_and(sumBd4,sumBd8));
- sumA2 = vec_or(sumAp,
- vec_sra(sumAp,
- vuint32_16));
- sumB2 = vec_or(sumBp,
- vec_sra(sumBp,
- vuint32_16));
- }
- vec_st(sumA2, 0, S);
- vec_st(sumB2, 16, S);
- }
-
- /* I'm not sure the following is actually faster
- than straight, unvectorized C code :-( */
-
-#define F_INIT() \
- vector unsigned char tenRightM = tenRight; \
- vector unsigned char permA1M = permA1; \
- vector unsigned char permA2M = permA2; \
- vector unsigned char extractPermM = extractPerm
-
-#define F2(i, j, k, l) \
- if (S[i] & (1 << (l+1))) { \
- const vector unsigned char a_A = vec_perm(src##i, src##j, permA1M); \
- const vector unsigned char a_B = vec_perm(a_A, src##k, permA2M); \
- const vector signed int a_sump = \
- (vector signed int)vec_msum(a_B, magic, (vector unsigned int)zero);\
- vector signed int F = vec_sr(vec_sums(a_sump, vsint32_8), vuint32_4); \
- const vector signed int p = \
- (vector signed int)vec_perm(src##j, (vector unsigned char)zero, \
- extractPermM); \
- const vector signed int sum = vec_add(p, vQP2); \
- const vector signed int diff = vec_sub(p, vQP2); \
- vector signed int newpm; \
- vector unsigned char newpm2, mask; \
- F = vec_splat(F, 3); \
- if (vec_all_lt(sum, F)) \
- newpm = sum; \
- else if (vec_all_gt(diff, F)) \
- newpm = diff; \
- else newpm = F; \
- newpm2 = vec_splat((vector unsigned char)newpm, 15); \
- mask = vec_add(identity, tenRightM); \
- src##j = vec_perm(src##j, newpm2, mask); \
- } \
- permA1M = vec_add(permA1M, permA1inc); \
- permA2M = vec_add(permA2M, permA2inc); \
- tenRightM = vec_sro(tenRightM, eightLeft); \
- extractPermM = vec_add(extractPermM, extractPermInc)
-
-#define ITER(i, j, k) do { \
- F_INIT(); \
- F2(i, j, k, 0); \
- F2(i, j, k, 1); \
- F2(i, j, k, 2); \
- F2(i, j, k, 3); \
- F2(i, j, k, 4); \
- F2(i, j, k, 5); \
- F2(i, j, k, 6); \
- F2(i, j, k, 7); \
-} while (0)
-
- ITER(0, 1, 2);
- ITER(1, 2, 3);
- ITER(2, 3, 4);
- ITER(3, 4, 5);
- ITER(4, 5, 6);
- ITER(5, 6, 7);
- ITER(6, 7, 8);
- ITER(7, 8, 9);
-
-#define STORE_LINE(i) do { \
- const vector unsigned char permST = \
- vec_lvsr(i * stride, srcCopy); \
- const vector unsigned char maskST = \
- vec_perm((vector unsigned char)zero, \
- (vector unsigned char)neg1, permST); \
- src##i = vec_perm(src##i ,src##i, permST); \
- sA##i= vec_sel(sA##i, src##i, maskST); \
- sB##i= vec_sel(src##i, sB##i, maskST); \
- vec_st(sA##i, i * stride, srcCopy); \
- vec_st(sB##i, i * stride + 16, srcCopy); \
-} while (0)
-
- STORE_LINE(1);
- STORE_LINE(2);
- STORE_LINE(3);
- STORE_LINE(4);
- STORE_LINE(5);
- STORE_LINE(6);
- STORE_LINE(7);
- STORE_LINE(8);
-
-#undef STORE_LINE
-#undef ITER
-#undef F2
-}
-
-#define doHorizLowPass_altivec(a...) doHorizLowPass_C(a)
-#define doHorizDefFilter_altivec(a...) doHorizDefFilter_C(a)
-#define do_a_deblock_altivec(a...) do_a_deblock_C(a)
-
-static inline void RENAME(tempNoiseReducer)(uint8_t *src, int stride,
- uint8_t *tempBlurred, uint32_t *tempBlurredPast, int *maxNoise)
-{
- const vector signed char neg1 = vec_splat_s8(-1);
- const vector unsigned char permHH = (const vector unsigned char){0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
- 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F};
-
- const vector signed int zero = vec_splat_s32(0);
- const vector signed short vsint16_1 = vec_splat_s16(1);
- vector signed int v_dp = zero;
- vector signed int v_sysdp = zero;
- int d, sysd, i;
-
-#define LOAD_LINE(src, i) \
- register int j##src##i = i * stride; \
- vector unsigned char perm##src##i = vec_lvsl(j##src##i, src); \
- const vector unsigned char v_##src##A1##i = vec_ld(j##src##i, src); \
- const vector unsigned char v_##src##A2##i = vec_ld(j##src##i + 16, src); \
- const vector unsigned char v_##src##A##i = \
- vec_perm(v_##src##A1##i, v_##src##A2##i, perm##src##i); \
- vector signed short v_##src##Ass##i = \
- (vector signed short)vec_mergeh((vector signed char)zero, \
- (vector signed char)v_##src##A##i)
-
- LOAD_LINE(src, 0);
- LOAD_LINE(src, 1);
- LOAD_LINE(src, 2);
- LOAD_LINE(src, 3);
- LOAD_LINE(src, 4);
- LOAD_LINE(src, 5);
- LOAD_LINE(src, 6);
- LOAD_LINE(src, 7);
-
- LOAD_LINE(tempBlurred, 0);
- LOAD_LINE(tempBlurred, 1);
- LOAD_LINE(tempBlurred, 2);
- LOAD_LINE(tempBlurred, 3);
- LOAD_LINE(tempBlurred, 4);
- LOAD_LINE(tempBlurred, 5);
- LOAD_LINE(tempBlurred, 6);
- LOAD_LINE(tempBlurred, 7);
-#undef LOAD_LINE
-
-#define ACCUMULATE_DIFFS(i) do { \
- vector signed short v_d = vec_sub(v_tempBlurredAss##i, \
- v_srcAss##i); \
- v_dp = vec_msums(v_d, v_d, v_dp); \
- v_sysdp = vec_msums(v_d, vsint16_1, v_sysdp); \
- } while (0)
-
- ACCUMULATE_DIFFS(0);
- ACCUMULATE_DIFFS(1);
- ACCUMULATE_DIFFS(2);
- ACCUMULATE_DIFFS(3);
- ACCUMULATE_DIFFS(4);
- ACCUMULATE_DIFFS(5);
- ACCUMULATE_DIFFS(6);
- ACCUMULATE_DIFFS(7);
-#undef ACCUMULATE_DIFFS
-
- tempBlurredPast[127]= maxNoise[0];
- tempBlurredPast[128]= maxNoise[1];
- tempBlurredPast[129]= maxNoise[2];
-
- v_dp = vec_sums(v_dp, zero);
- v_sysdp = vec_sums(v_sysdp, zero);
-
- v_dp = vec_splat(v_dp, 3);
- v_sysdp = vec_splat(v_sysdp, 3);
-
- vec_ste(v_dp, 0, &d);
- vec_ste(v_sysdp, 0, &sysd);
-
- i = d;
- d = (4*d
- +(*(tempBlurredPast-256))
- +(*(tempBlurredPast-1))+ (*(tempBlurredPast+1))
- +(*(tempBlurredPast+256))
- +4)>>3;
-
- *tempBlurredPast=i;
-
- if (d > maxNoise[1]) {
- if (d < maxNoise[2]) {
-#define OP(i) v_tempBlurredAss##i = vec_avg(v_tempBlurredAss##i, v_srcAss##i);
-
- OP(0);
- OP(1);
- OP(2);
- OP(3);
- OP(4);
- OP(5);
- OP(6);
- OP(7);
-#undef OP
- } else {
-#define OP(i) v_tempBlurredAss##i = v_srcAss##i;
-
- OP(0);
- OP(1);
- OP(2);
- OP(3);
- OP(4);
- OP(5);
- OP(6);
- OP(7);
-#undef OP
- }
- } else {
- if (d < maxNoise[0]) {
- const vector signed short vsint16_7 = vec_splat_s16(7);
- const vector signed short vsint16_4 = vec_splat_s16(4);
- const vector unsigned short vuint16_3 = vec_splat_u16(3);
-
-#define OP(i) do { \
- const vector signed short v_temp = \
- vec_mladd(v_tempBlurredAss##i, vsint16_7, v_srcAss##i); \
- const vector signed short v_temp2 = vec_add(v_temp, vsint16_4); \
- v_tempBlurredAss##i = vec_sr(v_temp2, vuint16_3); \
- } while (0)
-
- OP(0);
- OP(1);
- OP(2);
- OP(3);
- OP(4);
- OP(5);
- OP(6);
- OP(7);
-#undef OP
- } else {
- const vector signed short vsint16_3 = vec_splat_s16(3);
- const vector signed short vsint16_2 = vec_splat_s16(2);
-
-#define OP(i) do { \
- const vector signed short v_temp = \
- vec_mladd(v_tempBlurredAss##i, vsint16_3, v_srcAss##i); \
- const vector signed short v_temp2 = vec_add(v_temp, vsint16_2); \
- v_tempBlurredAss##i = \
- vec_sr(v_temp2, (vector unsigned short)vsint16_2); \
- } while (0)
-
- OP(0);
- OP(1);
- OP(2);
- OP(3);
- OP(4);
- OP(5);
- OP(6);
- OP(7);
-#undef OP
- }
- }
-
-#define PACK_AND_STORE(src, i) do { \
- const vector unsigned char perms = vec_lvsr(i * stride, src); \
- const vector unsigned char vf = \
- vec_packsu(v_tempBlurredAss##1, (vector signed short)zero); \
- const vector unsigned char vg = vec_perm(vf, v_##src##A##i, permHH); \
- const vector unsigned char mask = \
- vec_perm((vector unsigned char)zero, (vector unsigned char)neg1, perms); \
- const vector unsigned char vg2 = vec_perm(vg, vg, perms); \
- const vector unsigned char svA = vec_sel(v_##src##A1##i, vg2, mask); \
- const vector unsigned char svB = vec_sel(vg2, v_##src##A2##i, mask); \
- vec_st(svA, i * stride, src); \
- vec_st(svB, i * stride + 16, src); \
-} while (0)
-
- PACK_AND_STORE(src, 0);
- PACK_AND_STORE(src, 1);
- PACK_AND_STORE(src, 2);
- PACK_AND_STORE(src, 3);
- PACK_AND_STORE(src, 4);
- PACK_AND_STORE(src, 5);
- PACK_AND_STORE(src, 6);
- PACK_AND_STORE(src, 7);
- PACK_AND_STORE(tempBlurred, 0);
- PACK_AND_STORE(tempBlurred, 1);
- PACK_AND_STORE(tempBlurred, 2);
- PACK_AND_STORE(tempBlurred, 3);
- PACK_AND_STORE(tempBlurred, 4);
- PACK_AND_STORE(tempBlurred, 5);
- PACK_AND_STORE(tempBlurred, 6);
- PACK_AND_STORE(tempBlurred, 7);
-#undef PACK_AND_STORE
-}
-
-static inline void transpose_16x8_char_toPackedAlign_altivec(unsigned char* dst, unsigned char* src, int stride) {
- const vector unsigned char zero = vec_splat_u8(0);
-
-#define LOAD_DOUBLE_LINE(i, j) \
- vector unsigned char perm1##i = vec_lvsl(i * stride, src); \
- vector unsigned char perm2##i = vec_lvsl(j * stride, src); \
- vector unsigned char srcA##i = vec_ld(i * stride, src); \
- vector unsigned char srcB##i = vec_ld(i * stride + 16, src); \
- vector unsigned char srcC##i = vec_ld(j * stride, src); \
- vector unsigned char srcD##i = vec_ld(j * stride+ 16, src); \
- vector unsigned char src##i = vec_perm(srcA##i, srcB##i, perm1##i); \
- vector unsigned char src##j = vec_perm(srcC##i, srcD##i, perm2##i)
-
- LOAD_DOUBLE_LINE(0, 1);
- LOAD_DOUBLE_LINE(2, 3);
- LOAD_DOUBLE_LINE(4, 5);
- LOAD_DOUBLE_LINE(6, 7);
-#undef LOAD_DOUBLE_LINE
-
- vector unsigned char tempA = vec_mergeh(src0, zero);
- vector unsigned char tempB = vec_mergel(src0, zero);
- vector unsigned char tempC = vec_mergeh(src1, zero);
- vector unsigned char tempD = vec_mergel(src1, zero);
- vector unsigned char tempE = vec_mergeh(src2, zero);
- vector unsigned char tempF = vec_mergel(src2, zero);
- vector unsigned char tempG = vec_mergeh(src3, zero);
- vector unsigned char tempH = vec_mergel(src3, zero);
- vector unsigned char tempI = vec_mergeh(src4, zero);
- vector unsigned char tempJ = vec_mergel(src4, zero);
- vector unsigned char tempK = vec_mergeh(src5, zero);
- vector unsigned char tempL = vec_mergel(src5, zero);
- vector unsigned char tempM = vec_mergeh(src6, zero);
- vector unsigned char tempN = vec_mergel(src6, zero);
- vector unsigned char tempO = vec_mergeh(src7, zero);
- vector unsigned char tempP = vec_mergel(src7, zero);
-
- vector unsigned char temp0 = vec_mergeh(tempA, tempI);
- vector unsigned char temp1 = vec_mergel(tempA, tempI);
- vector unsigned char temp2 = vec_mergeh(tempB, tempJ);
- vector unsigned char temp3 = vec_mergel(tempB, tempJ);
- vector unsigned char temp4 = vec_mergeh(tempC, tempK);
- vector unsigned char temp5 = vec_mergel(tempC, tempK);
- vector unsigned char temp6 = vec_mergeh(tempD, tempL);
- vector unsigned char temp7 = vec_mergel(tempD, tempL);
- vector unsigned char temp8 = vec_mergeh(tempE, tempM);
- vector unsigned char temp9 = vec_mergel(tempE, tempM);
- vector unsigned char temp10 = vec_mergeh(tempF, tempN);
- vector unsigned char temp11 = vec_mergel(tempF, tempN);
- vector unsigned char temp12 = vec_mergeh(tempG, tempO);
- vector unsigned char temp13 = vec_mergel(tempG, tempO);
- vector unsigned char temp14 = vec_mergeh(tempH, tempP);
- vector unsigned char temp15 = vec_mergel(tempH, tempP);
-
- tempA = vec_mergeh(temp0, temp8);
- tempB = vec_mergel(temp0, temp8);
- tempC = vec_mergeh(temp1, temp9);
- tempD = vec_mergel(temp1, temp9);
- tempE = vec_mergeh(temp2, temp10);
- tempF = vec_mergel(temp2, temp10);
- tempG = vec_mergeh(temp3, temp11);
- tempH = vec_mergel(temp3, temp11);
- tempI = vec_mergeh(temp4, temp12);
- tempJ = vec_mergel(temp4, temp12);
- tempK = vec_mergeh(temp5, temp13);
- tempL = vec_mergel(temp5, temp13);
- tempM = vec_mergeh(temp6, temp14);
- tempN = vec_mergel(temp6, temp14);
- tempO = vec_mergeh(temp7, temp15);
- tempP = vec_mergel(temp7, temp15);
-
- temp0 = vec_mergeh(tempA, tempI);
- temp1 = vec_mergel(tempA, tempI);
- temp2 = vec_mergeh(tempB, tempJ);
- temp3 = vec_mergel(tempB, tempJ);
- temp4 = vec_mergeh(tempC, tempK);
- temp5 = vec_mergel(tempC, tempK);
- temp6 = vec_mergeh(tempD, tempL);
- temp7 = vec_mergel(tempD, tempL);
- temp8 = vec_mergeh(tempE, tempM);
- temp9 = vec_mergel(tempE, tempM);
- temp10 = vec_mergeh(tempF, tempN);
- temp11 = vec_mergel(tempF, tempN);
- temp12 = vec_mergeh(tempG, tempO);
- temp13 = vec_mergel(tempG, tempO);
- temp14 = vec_mergeh(tempH, tempP);
- temp15 = vec_mergel(tempH, tempP);
-
- vec_st(temp0, 0, dst);
- vec_st(temp1, 16, dst);
- vec_st(temp2, 32, dst);
- vec_st(temp3, 48, dst);
- vec_st(temp4, 64, dst);
- vec_st(temp5, 80, dst);
- vec_st(temp6, 96, dst);
- vec_st(temp7, 112, dst);
- vec_st(temp8, 128, dst);
- vec_st(temp9, 144, dst);
- vec_st(temp10, 160, dst);
- vec_st(temp11, 176, dst);
- vec_st(temp12, 192, dst);
- vec_st(temp13, 208, dst);
- vec_st(temp14, 224, dst);
- vec_st(temp15, 240, dst);
-}
-
-static inline void transpose_8x16_char_fromPackedAlign_altivec(unsigned char* dst, unsigned char* src, int stride) {
- const vector unsigned char zero = vec_splat_u8(0);
- const vector signed char neg1 = vec_splat_s8(-1);
-
-#define LOAD_DOUBLE_LINE(i, j) \
- vector unsigned char src##i = vec_ld(i * 16, src); \
- vector unsigned char src##j = vec_ld(j * 16, src)
-
- LOAD_DOUBLE_LINE(0, 1);
- LOAD_DOUBLE_LINE(2, 3);
- LOAD_DOUBLE_LINE(4, 5);
- LOAD_DOUBLE_LINE(6, 7);
- LOAD_DOUBLE_LINE(8, 9);
- LOAD_DOUBLE_LINE(10, 11);
- LOAD_DOUBLE_LINE(12, 13);
- LOAD_DOUBLE_LINE(14, 15);
-#undef LOAD_DOUBLE_LINE
-
- vector unsigned char tempA = vec_mergeh(src0, src8);
- vector unsigned char tempB;
- vector unsigned char tempC = vec_mergeh(src1, src9);
- vector unsigned char tempD;
- vector unsigned char tempE = vec_mergeh(src2, src10);
- vector unsigned char tempG = vec_mergeh(src3, src11);
- vector unsigned char tempI = vec_mergeh(src4, src12);
- vector unsigned char tempJ;
- vector unsigned char tempK = vec_mergeh(src5, src13);
- vector unsigned char tempL;
- vector unsigned char tempM = vec_mergeh(src6, src14);
- vector unsigned char tempO = vec_mergeh(src7, src15);
-
- vector unsigned char temp0 = vec_mergeh(tempA, tempI);
- vector unsigned char temp1 = vec_mergel(tempA, tempI);
- vector unsigned char temp2;
- vector unsigned char temp3;
- vector unsigned char temp4 = vec_mergeh(tempC, tempK);
- vector unsigned char temp5 = vec_mergel(tempC, tempK);
- vector unsigned char temp6;
- vector unsigned char temp7;
- vector unsigned char temp8 = vec_mergeh(tempE, tempM);
- vector unsigned char temp9 = vec_mergel(tempE, tempM);
- vector unsigned char temp12 = vec_mergeh(tempG, tempO);
- vector unsigned char temp13 = vec_mergel(tempG, tempO);
-
- tempA = vec_mergeh(temp0, temp8);
- tempB = vec_mergel(temp0, temp8);
- tempC = vec_mergeh(temp1, temp9);
- tempD = vec_mergel(temp1, temp9);
- tempI = vec_mergeh(temp4, temp12);
- tempJ = vec_mergel(temp4, temp12);
- tempK = vec_mergeh(temp5, temp13);
- tempL = vec_mergel(temp5, temp13);
-
- temp0 = vec_mergeh(tempA, tempI);
- temp1 = vec_mergel(tempA, tempI);
- temp2 = vec_mergeh(tempB, tempJ);
- temp3 = vec_mergel(tempB, tempJ);
- temp4 = vec_mergeh(tempC, tempK);
- temp5 = vec_mergel(tempC, tempK);
- temp6 = vec_mergeh(tempD, tempL);
- temp7 = vec_mergel(tempD, tempL);
-
-
-#define STORE_DOUBLE_LINE(i, j) do { \
- vector unsigned char dstAi = vec_ld(i * stride, dst); \
- vector unsigned char dstBi = vec_ld(i * stride + 16, dst); \
- vector unsigned char dstAj = vec_ld(j * stride, dst); \
- vector unsigned char dstBj = vec_ld(j * stride+ 16, dst); \
- vector unsigned char aligni = vec_lvsr(i * stride, dst); \
- vector unsigned char alignj = vec_lvsr(j * stride, dst); \
- vector unsigned char maski = \
- vec_perm(zero, (vector unsigned char)neg1, aligni); \
- vector unsigned char maskj = \
- vec_perm(zero, (vector unsigned char)neg1, alignj); \
- vector unsigned char dstRi = vec_perm(temp##i, temp##i, aligni); \
- vector unsigned char dstRj = vec_perm(temp##j, temp##j, alignj); \
- vector unsigned char dstAFi = vec_sel(dstAi, dstRi, maski); \
- vector unsigned char dstBFi = vec_sel(dstRi, dstBi, maski); \
- vector unsigned char dstAFj = vec_sel(dstAj, dstRj, maskj); \
- vector unsigned char dstBFj = vec_sel(dstRj, dstBj, maskj); \
- vec_st(dstAFi, i * stride, dst); \
- vec_st(dstBFi, i * stride + 16, dst); \
- vec_st(dstAFj, j * stride, dst); \
- vec_st(dstBFj, j * stride + 16, dst); \
-} while (0)
-
- STORE_DOUBLE_LINE(0,1);
- STORE_DOUBLE_LINE(2,3);
- STORE_DOUBLE_LINE(4,5);
- STORE_DOUBLE_LINE(6,7);
-}
diff --git a/gst-libs/ext/libav/libpostproc/postprocess_internal.h b/gst-libs/ext/libav/libpostproc/postprocess_internal.h
deleted file mode 100644
index d2c6708..0000000
--- a/gst-libs/ext/libav/libpostproc/postprocess_internal.h
+++ /dev/null
@@ -1,179 +0,0 @@
-/*
- * Copyright (C) 2001-2002 Michael Niedermayer (michaelni@gmx.at)
- *
- * This file is part of Libav.
- *
- * Libav is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 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 General Public License for more details.
- *
- * You should have received a copy of the GNU 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
- * internal api header.
- */
-
-#ifndef POSTPROC_POSTPROCESS_INTERNAL_H
-#define POSTPROC_POSTPROCESS_INTERNAL_H
-
-#include <string.h>
-#include "libavutil/avutil.h"
-#include "libavutil/log.h"
-#include "postprocess.h"
-
-#define V_DEBLOCK 0x01
-#define H_DEBLOCK 0x02
-#define DERING 0x04
-#define LEVEL_FIX 0x08 ///< Brightness & Contrast
-
-#define LUM_V_DEBLOCK V_DEBLOCK // 1
-#define LUM_H_DEBLOCK H_DEBLOCK // 2
-#define CHROM_V_DEBLOCK (V_DEBLOCK<<4) // 16
-#define CHROM_H_DEBLOCK (H_DEBLOCK<<4) // 32
-#define LUM_DERING DERING // 4
-#define CHROM_DERING (DERING<<4) // 64
-#define LUM_LEVEL_FIX LEVEL_FIX // 8
-#define CHROM_LEVEL_FIX (LEVEL_FIX<<4) // 128 (not implemented yet)
-
-// Experimental vertical filters
-#define V_X1_FILTER 0x0200 // 512
-#define V_A_DEBLOCK 0x0400
-
-// Experimental horizontal filters
-#define H_X1_FILTER 0x2000 // 8192
-#define H_A_DEBLOCK 0x4000
-
-/// select between full y range (255-0) or standart one (234-16)
-#define FULL_Y_RANGE 0x8000 // 32768
-
-//Deinterlacing Filters
-#define LINEAR_IPOL_DEINT_FILTER 0x10000 // 65536
-#define LINEAR_BLEND_DEINT_FILTER 0x20000 // 131072
-#define CUBIC_BLEND_DEINT_FILTER 0x8000 // (not implemented yet)
-#define CUBIC_IPOL_DEINT_FILTER 0x40000 // 262144
-#define MEDIAN_DEINT_FILTER 0x80000 // 524288
-#define FFMPEG_DEINT_FILTER 0x400000
-#define LOWPASS5_DEINT_FILTER 0x800000
-
-#define TEMP_NOISE_FILTER 0x100000
-#define FORCE_QUANT 0x200000
-
-//use if you want a faster postprocessing code
-//cannot differentiate between chroma & luma filters (both on or both off)
-//obviously the -pp option on the command line has no effect except turning the here selected
-//filters on
-//#define COMPILE_TIME_MODE 0x77
-
-static inline int CLIP(int a){
- if(a&256) return ((a)>>31)^(-1);
- else return a;
-}
-/**
- * Postprocessng filter.
- */
-struct PPFilter{
- const char *shortName;
- const char *longName;
- int chromDefault; ///< is chrominance filtering on by default if this filter is manually activated
- int minLumQuality; ///< minimum quality to turn luminance filtering on
- int minChromQuality; ///< minimum quality to turn chrominance filtering on
- int mask; ///< Bitmask to turn this filter on
-};
-
-/**
- * Postprocessng mode.
- */
-typedef struct PPMode{
- int lumMode; ///< acivates filters for luminance
- int chromMode; ///< acivates filters for chrominance
- int error; ///< non zero on error
-
- int minAllowedY; ///< for brigtness correction
- int maxAllowedY; ///< for brihtness correction
- float maxClippedThreshold; ///< amount of "black" you are willing to lose to get a brightness-corrected picture
-
- int maxTmpNoise[3]; ///< for Temporal Noise Reducing filter (Maximal sum of abs differences)
-
- int baseDcDiff;
- int flatnessThreshold;
-
- int forcedQuant; ///< quantizer if FORCE_QUANT is used
-} PPMode;
-
-/**
- * postprocess context.
- */
-typedef struct PPContext{
- /**
- * info on struct for av_log
- */
- const AVClass *av_class;
-
- uint8_t *tempBlocks; ///<used for the horizontal code
-
- /**
- * luma histogram.
- * we need 64bit here otherwise we'll going to have a problem
- * after watching a black picture for 5 hours
- */
- uint64_t *yHistogram;
-
- DECLARE_ALIGNED(8, uint64_t, packedYOffset);
- DECLARE_ALIGNED(8, uint64_t, packedYScale);
-
- /** Temporal noise reducing buffers */
- uint8_t *tempBlurred[3];
- int32_t *tempBlurredPast[3];
-
- /** Temporary buffers for handling the last row(s) */
- uint8_t *tempDst;
- uint8_t *tempSrc;
-
- uint8_t *deintTemp;
-
- DECLARE_ALIGNED(8, uint64_t, pQPb);
- DECLARE_ALIGNED(8, uint64_t, pQPb2);
-
- DECLARE_ALIGNED(8, uint64_t, mmxDcOffset)[64];
- DECLARE_ALIGNED(8, uint64_t, mmxDcThreshold)[64];
-
- QP_STORE_T *stdQPTable; ///< used to fix MPEG2 style qscale
- QP_STORE_T *nonBQPTable;
- QP_STORE_T *forcedQPTable;
-
- int QP;
- int nonBQP;
-
- int frameNum;
-
- int cpuCaps;
-
- int qpStride; ///<size of qp buffers (needed to realloc them if needed)
- int stride; ///<size of some buffers (needed to realloc them if needed)
-
- int hChromaSubSample;
- int vChromaSubSample;
-
- PPMode ppMode;
-} PPContext;
-
-
-static inline void linecpy(void *dest, const void *src, int lines, int stride) {
- if (stride > 0) {
- memcpy(dest, src, lines*stride);
- } else {
- memcpy((uint8_t*)dest+(lines-1)*stride, (const uint8_t*)src+(lines-1)*stride, -lines*stride);
- }
-}
-
-#endif /* POSTPROC_POSTPROCESS_INTERNAL_H */
diff --git a/gst-libs/ext/libav/libpostproc/postprocess_template.c b/gst-libs/ext/libav/libpostproc/postprocess_template.c
deleted file mode 100644
index a609ce8..0000000
--- a/gst-libs/ext/libav/libpostproc/postprocess_template.c
+++ /dev/null
@@ -1,3634 +0,0 @@
-/*
- * Copyright (C) 2001-2002 Michael Niedermayer (michaelni@gmx.at)
- *
- * This file is part of Libav.
- *
- * Libav is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 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 General Public License for more details.
- *
- * You should have received a copy of the GNU 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
- * mmx/mmx2/3dnow postprocess code.
- */
-
-#include "libavutil/x86_cpu.h"
-
-#define ALIGN_MASK "$-8"
-
-#undef REAL_PAVGB
-#undef PAVGB
-#undef PMINUB
-#undef PMAXUB
-
-#if HAVE_MMX2
-#define REAL_PAVGB(a,b) "pavgb " #a ", " #b " \n\t"
-#elif HAVE_AMD3DNOW
-#define REAL_PAVGB(a,b) "pavgusb " #a ", " #b " \n\t"
-#endif
-#define PAVGB(a,b) REAL_PAVGB(a,b)
-
-#if HAVE_MMX2
-#define PMINUB(a,b,t) "pminub " #a ", " #b " \n\t"
-#elif HAVE_MMX
-#define PMINUB(b,a,t) \
- "movq " #a ", " #t " \n\t"\
- "psubusb " #b ", " #t " \n\t"\
- "psubb " #t ", " #a " \n\t"
-#endif
-
-#if HAVE_MMX2
-#define PMAXUB(a,b) "pmaxub " #a ", " #b " \n\t"
-#elif HAVE_MMX
-#define PMAXUB(a,b) \
- "psubusb " #a ", " #b " \n\t"\
- "paddb " #a ", " #b " \n\t"
-#endif
-
-//FIXME? |255-0| = 1 (should not be a problem ...)
-#if HAVE_MMX
-/**
- * Check if the middle 8x8 Block in the given 8x16 block is flat
- */
-static inline int RENAME(vertClassify)(uint8_t src[], int stride, PPContext *c){
- int numEq= 0, dcOk;
- src+= stride*4; // src points to begin of the 8x8 Block
- __asm__ volatile(
- "movq %0, %%mm7 \n\t"
- "movq %1, %%mm6 \n\t"
- : : "m" (c->mmxDcOffset[c->nonBQP]), "m" (c->mmxDcThreshold[c->nonBQP])
- );
-
- __asm__ volatile(
- "lea (%2, %3), %%"REG_a" \n\t"
-// 0 1 2 3 4 5 6 7 8 9
-// %1 eax eax+%2 eax+2%2 %1+4%2 ecx ecx+%2 ecx+2%2 %1+8%2 ecx+4%2
-
- "movq (%2), %%mm0 \n\t"
- "movq (%%"REG_a"), %%mm1 \n\t"
- "movq %%mm0, %%mm3 \n\t"
- "movq %%mm0, %%mm4 \n\t"
- PMAXUB(%%mm1, %%mm4)
- PMINUB(%%mm1, %%mm3, %%mm5)
- "psubb %%mm1, %%mm0 \n\t" // mm0 = differnece
- "paddb %%mm7, %%mm0 \n\t"
- "pcmpgtb %%mm6, %%mm0 \n\t"
-
- "movq (%%"REG_a",%3), %%mm2 \n\t"
- PMAXUB(%%mm2, %%mm4)
- PMINUB(%%mm2, %%mm3, %%mm5)
- "psubb %%mm2, %%mm1 \n\t"
- "paddb %%mm7, %%mm1 \n\t"
- "pcmpgtb %%mm6, %%mm1 \n\t"
- "paddb %%mm1, %%mm0 \n\t"
-
- "movq (%%"REG_a", %3, 2), %%mm1 \n\t"
- PMAXUB(%%mm1, %%mm4)
- PMINUB(%%mm1, %%mm3, %%mm5)
- "psubb %%mm1, %%mm2 \n\t"
- "paddb %%mm7, %%mm2 \n\t"
- "pcmpgtb %%mm6, %%mm2 \n\t"
- "paddb %%mm2, %%mm0 \n\t"
-
- "lea (%%"REG_a", %3, 4), %%"REG_a" \n\t"
-
- "movq (%2, %3, 4), %%mm2 \n\t"
- PMAXUB(%%mm2, %%mm4)
- PMINUB(%%mm2, %%mm3, %%mm5)
- "psubb %%mm2, %%mm1 \n\t"
- "paddb %%mm7, %%mm1 \n\t"
- "pcmpgtb %%mm6, %%mm1 \n\t"
- "paddb %%mm1, %%mm0 \n\t"
-
- "movq (%%"REG_a"), %%mm1 \n\t"
- PMAXUB(%%mm1, %%mm4)
- PMINUB(%%mm1, %%mm3, %%mm5)
- "psubb %%mm1, %%mm2 \n\t"
- "paddb %%mm7, %%mm2 \n\t"
- "pcmpgtb %%mm6, %%mm2 \n\t"
- "paddb %%mm2, %%mm0 \n\t"
-
- "movq (%%"REG_a", %3), %%mm2 \n\t"
- PMAXUB(%%mm2, %%mm4)
- PMINUB(%%mm2, %%mm3, %%mm5)
- "psubb %%mm2, %%mm1 \n\t"
- "paddb %%mm7, %%mm1 \n\t"
- "pcmpgtb %%mm6, %%mm1 \n\t"
- "paddb %%mm1, %%mm0 \n\t"
-
- "movq (%%"REG_a", %3, 2), %%mm1 \n\t"
- PMAXUB(%%mm1, %%mm4)
- PMINUB(%%mm1, %%mm3, %%mm5)
- "psubb %%mm1, %%mm2 \n\t"
- "paddb %%mm7, %%mm2 \n\t"
- "pcmpgtb %%mm6, %%mm2 \n\t"
- "paddb %%mm2, %%mm0 \n\t"
- "psubusb %%mm3, %%mm4 \n\t"
-
- " \n\t"
-#if HAVE_MMX2
- "pxor %%mm7, %%mm7 \n\t"
- "psadbw %%mm7, %%mm0 \n\t"
-#else
- "movq %%mm0, %%mm1 \n\t"
- "psrlw $8, %%mm0 \n\t"
- "paddb %%mm1, %%mm0 \n\t"
- "movq %%mm0, %%mm1 \n\t"
- "psrlq $16, %%mm0 \n\t"
- "paddb %%mm1, %%mm0 \n\t"
- "movq %%mm0, %%mm1 \n\t"
- "psrlq $32, %%mm0 \n\t"
- "paddb %%mm1, %%mm0 \n\t"
-#endif
- "movq %4, %%mm7 \n\t" // QP,..., QP
- "paddusb %%mm7, %%mm7 \n\t" // 2QP ... 2QP
- "psubusb %%mm7, %%mm4 \n\t" // Diff <= 2QP -> 0
- "packssdw %%mm4, %%mm4 \n\t"
- "movd %%mm0, %0 \n\t"
- "movd %%mm4, %1 \n\t"
-
- : "=r" (numEq), "=r" (dcOk)
- : "r" (src), "r" ((x86_reg)stride), "m" (c->pQPb)
- : "%"REG_a
- );
-
- numEq= (-numEq) &0xFF;
- if(numEq > c->ppMode.flatnessThreshold){
- if(dcOk) return 0;
- else return 1;
- }else{
- return 2;
- }
-}
-#endif //HAVE_MMX
-
-/**
- * Do a vertical low pass filter on the 8x16 block (only write to the 8x8 block in the middle)
- * using the 9-Tap Filter (1,1,2,2,4,2,2,1,1)/16
- */
-#if !HAVE_ALTIVEC
-static inline void RENAME(doVertLowPass)(uint8_t *src, int stride, PPContext *c)
-{
-#if HAVE_MMX2 || HAVE_AMD3DNOW
- src+= stride*3;
- __asm__ volatile( //"movv %0 %1 %2\n\t"
- "movq %2, %%mm0 \n\t" // QP,..., QP
- "pxor %%mm4, %%mm4 \n\t"
-
- "movq (%0), %%mm6 \n\t"
- "movq (%0, %1), %%mm5 \n\t"
- "movq %%mm5, %%mm1 \n\t"
- "movq %%mm6, %%mm2 \n\t"
- "psubusb %%mm6, %%mm5 \n\t"
- "psubusb %%mm1, %%mm2 \n\t"
- "por %%mm5, %%mm2 \n\t" // ABS Diff of lines
- "psubusb %%mm0, %%mm2 \n\t" // diff <= QP -> 0
- "pcmpeqb %%mm4, %%mm2 \n\t" // diff <= QP -> FF
-
- "pand %%mm2, %%mm6 \n\t"
- "pandn %%mm1, %%mm2 \n\t"
- "por %%mm2, %%mm6 \n\t"// First Line to Filter
-
- "movq (%0, %1, 8), %%mm5 \n\t"
- "lea (%0, %1, 4), %%"REG_a" \n\t"
- "lea (%0, %1, 8), %%"REG_c" \n\t"
- "sub %1, %%"REG_c" \n\t"
- "add %1, %0 \n\t" // %0 points to line 1 not 0
- "movq (%0, %1, 8), %%mm7 \n\t"
- "movq %%mm5, %%mm1 \n\t"
- "movq %%mm7, %%mm2 \n\t"
- "psubusb %%mm7, %%mm5 \n\t"
- "psubusb %%mm1, %%mm2 \n\t"
- "por %%mm5, %%mm2 \n\t" // ABS Diff of lines
- "psubusb %%mm0, %%mm2 \n\t" // diff <= QP -> 0
- "pcmpeqb %%mm4, %%mm2 \n\t" // diff <= QP -> FF
-
- "pand %%mm2, %%mm7 \n\t"
- "pandn %%mm1, %%mm2 \n\t"
- "por %%mm2, %%mm7 \n\t" // First Line to Filter
-
-
- // 1 2 3 4 5 6 7 8
- // %0 %0+%1 %0+2%1 eax %0+4%1 eax+2%1 ecx eax+4%1
- // 6 4 2 2 1 1
- // 6 4 4 2
- // 6 8 2
-
- "movq (%0, %1), %%mm0 \n\t" // 1
- "movq %%mm0, %%mm1 \n\t" // 1
- PAVGB(%%mm6, %%mm0) //1 1 /2
- PAVGB(%%mm6, %%mm0) //3 1 /4
-
- "movq (%0, %1, 4), %%mm2 \n\t" // 1
- "movq %%mm2, %%mm5 \n\t" // 1
- PAVGB((%%REGa), %%mm2) // 11 /2
- PAVGB((%0, %1, 2), %%mm2) // 211 /4
- "movq %%mm2, %%mm3 \n\t" // 211 /4
- "movq (%0), %%mm4 \n\t" // 1
- PAVGB(%%mm4, %%mm3) // 4 211 /8
- PAVGB(%%mm0, %%mm3) //642211 /16
- "movq %%mm3, (%0) \n\t" // X
- // mm1=2 mm2=3(211) mm4=1 mm5=5 mm6=0 mm7=9
- "movq %%mm1, %%mm0 \n\t" // 1
- PAVGB(%%mm6, %%mm0) //1 1 /2
- "movq %%mm4, %%mm3 \n\t" // 1
- PAVGB((%0,%1,2), %%mm3) // 1 1 /2
- PAVGB((%%REGa,%1,2), %%mm5) // 11 /2
- PAVGB((%%REGa), %%mm5) // 211 /4
- PAVGB(%%mm5, %%mm3) // 2 2211 /8
- PAVGB(%%mm0, %%mm3) //4242211 /16
- "movq %%mm3, (%0,%1) \n\t" // X
- // mm1=2 mm2=3(211) mm4=1 mm5=4(211) mm6=0 mm7=9
- PAVGB(%%mm4, %%mm6) //11 /2
- "movq (%%"REG_c"), %%mm0 \n\t" // 1
- PAVGB((%%REGa, %1, 2), %%mm0) // 11/2
- "movq %%mm0, %%mm3 \n\t" // 11/2
- PAVGB(%%mm1, %%mm0) // 2 11/4
- PAVGB(%%mm6, %%mm0) //222 11/8
- PAVGB(%%mm2, %%mm0) //22242211/16
- "movq (%0, %1, 2), %%mm2 \n\t" // 1
- "movq %%mm0, (%0, %1, 2) \n\t" // X
- // mm1=2 mm2=3 mm3=6(11) mm4=1 mm5=4(211) mm6=0(11) mm7=9
- "movq (%%"REG_a", %1, 4), %%mm0 \n\t" // 1
- PAVGB((%%REGc), %%mm0) // 11 /2
- PAVGB(%%mm0, %%mm6) //11 11 /4
- PAVGB(%%mm1, %%mm4) // 11 /2
- PAVGB(%%mm2, %%mm1) // 11 /2
- PAVGB(%%mm1, %%mm6) //1122 11 /8
- PAVGB(%%mm5, %%mm6) //112242211 /16
- "movq (%%"REG_a"), %%mm5 \n\t" // 1
- "movq %%mm6, (%%"REG_a") \n\t" // X
- // mm0=7(11) mm1=2(11) mm2=3 mm3=6(11) mm4=1(11) mm5=4 mm7=9
- "movq (%%"REG_a", %1, 4), %%mm6 \n\t" // 1
- PAVGB(%%mm7, %%mm6) // 11 /2
- PAVGB(%%mm4, %%mm6) // 11 11 /4
- PAVGB(%%mm3, %%mm6) // 11 2211 /8
- PAVGB(%%mm5, %%mm2) // 11 /2
- "movq (%0, %1, 4), %%mm4 \n\t" // 1
- PAVGB(%%mm4, %%mm2) // 112 /4
- PAVGB(%%mm2, %%mm6) // 112242211 /16
- "movq %%mm6, (%0, %1, 4) \n\t" // X
- // mm0=7(11) mm1=2(11) mm2=3(112) mm3=6(11) mm4=5 mm5=4 mm7=9
- PAVGB(%%mm7, %%mm1) // 11 2 /4
- PAVGB(%%mm4, %%mm5) // 11 /2
- PAVGB(%%mm5, %%mm0) // 11 11 /4
- "movq (%%"REG_a", %1, 2), %%mm6 \n\t" // 1
- PAVGB(%%mm6, %%mm1) // 11 4 2 /8
- PAVGB(%%mm0, %%mm1) // 11224222 /16
- "movq %%mm1, (%%"REG_a", %1, 2) \n\t" // X
- // mm2=3(112) mm3=6(11) mm4=5 mm5=4(11) mm6=6 mm7=9
- PAVGB((%%REGc), %%mm2) // 112 4 /8
- "movq (%%"REG_a", %1, 4), %%mm0 \n\t" // 1
- PAVGB(%%mm0, %%mm6) // 1 1 /2
- PAVGB(%%mm7, %%mm6) // 1 12 /4
- PAVGB(%%mm2, %%mm6) // 1122424 /4
- "movq %%mm6, (%%"REG_c") \n\t" // X
- // mm0=8 mm3=6(11) mm4=5 mm5=4(11) mm7=9
- PAVGB(%%mm7, %%mm5) // 11 2 /4
- PAVGB(%%mm7, %%mm5) // 11 6 /8
-
- PAVGB(%%mm3, %%mm0) // 112 /4
- PAVGB(%%mm0, %%mm5) // 112246 /16
- "movq %%mm5, (%%"REG_a", %1, 4) \n\t" // X
- "sub %1, %0 \n\t"
-
- :
- : "r" (src), "r" ((x86_reg)stride), "m" (c->pQPb)
- : "%"REG_a, "%"REG_c
- );
-#else //HAVE_MMX2 || HAVE_AMD3DNOW
- const int l1= stride;
- const int l2= stride + l1;
- const int l3= stride + l2;
- const int l4= stride + l3;
- const int l5= stride + l4;
- const int l6= stride + l5;
- const int l7= stride + l6;
- const int l8= stride + l7;
- const int l9= stride + l8;
- int x;
- src+= stride*3;
- for(x=0; x<BLOCK_SIZE; x++){
- const int first= FFABS(src[0] - src[l1]) < c->QP ? src[0] : src[l1];
- const int last= FFABS(src[l8] - src[l9]) < c->QP ? src[l9] : src[l8];
-
- int sums[10];
- sums[0] = 4*first + src[l1] + src[l2] + src[l3] + 4;
- sums[1] = sums[0] - first + src[l4];
- sums[2] = sums[1] - first + src[l5];
- sums[3] = sums[2] - first + src[l6];
- sums[4] = sums[3] - first + src[l7];
- sums[5] = sums[4] - src[l1] + src[l8];
- sums[6] = sums[5] - src[l2] + last;
- sums[7] = sums[6] - src[l3] + last;
- sums[8] = sums[7] - src[l4] + last;
- sums[9] = sums[8] - src[l5] + last;
-
- src[l1]= (sums[0] + sums[2] + 2*src[l1])>>4;
- src[l2]= (sums[1] + sums[3] + 2*src[l2])>>4;
- src[l3]= (sums[2] + sums[4] + 2*src[l3])>>4;
- src[l4]= (sums[3] + sums[5] + 2*src[l4])>>4;
- src[l5]= (sums[4] + sums[6] + 2*src[l5])>>4;
- src[l6]= (sums[5] + sums[7] + 2*src[l6])>>4;
- src[l7]= (sums[6] + sums[8] + 2*src[l7])>>4;
- src[l8]= (sums[7] + sums[9] + 2*src[l8])>>4;
-
- src++;
- }
-#endif //HAVE_MMX2 || HAVE_AMD3DNOW
-}
-#endif //HAVE_ALTIVEC
-
-/**
- * Experimental Filter 1
- * will not damage linear gradients
- * Flat blocks should look like they were passed through the (1,1,2,2,4,2,2,1,1) 9-Tap filter
- * can only smooth blocks at the expected locations (it cannot smooth them if they did move)
- * MMX2 version does correct clipping C version does not
- */
-static inline void RENAME(vertX1Filter)(uint8_t *src, int stride, PPContext *co)
-{
-#if HAVE_MMX2 || HAVE_AMD3DNOW
- src+= stride*3;
-
- __asm__ volatile(
- "pxor %%mm7, %%mm7 \n\t" // 0
- "lea (%0, %1), %%"REG_a" \n\t"
- "lea (%%"REG_a", %1, 4), %%"REG_c" \n\t"
-// 0 1 2 3 4 5 6 7 8 9
-// %0 eax eax+%1 eax+2%1 %0+4%1 ecx ecx+%1 ecx+2%1 %0+8%1 ecx+4%1
- "movq (%%"REG_a", %1, 2), %%mm0 \n\t" // line 3
- "movq (%0, %1, 4), %%mm1 \n\t" // line 4
- "movq %%mm1, %%mm2 \n\t" // line 4
- "psubusb %%mm0, %%mm1 \n\t"
- "psubusb %%mm2, %%mm0 \n\t"
- "por %%mm1, %%mm0 \n\t" // |l2 - l3|
- "movq (%%"REG_c"), %%mm3 \n\t" // line 5
- "movq (%%"REG_c", %1), %%mm4 \n\t" // line 6
- "movq %%mm3, %%mm5 \n\t" // line 5
- "psubusb %%mm4, %%mm3 \n\t"
- "psubusb %%mm5, %%mm4 \n\t"
- "por %%mm4, %%mm3 \n\t" // |l5 - l6|
- PAVGB(%%mm3, %%mm0) // (|l2 - l3| + |l5 - l6|)/2
- "movq %%mm2, %%mm1 \n\t" // line 4
- "psubusb %%mm5, %%mm2 \n\t"
- "movq %%mm2, %%mm4 \n\t"
- "pcmpeqb %%mm7, %%mm2 \n\t" // (l4 - l5) <= 0 ? -1 : 0
- "psubusb %%mm1, %%mm5 \n\t"
- "por %%mm5, %%mm4 \n\t" // |l4 - l5|
- "psubusb %%mm0, %%mm4 \n\t" //d = MAX(0, |l4-l5| - (|l2-l3| + |l5-l6|)/2)
- "movq %%mm4, %%mm3 \n\t" // d
- "movq %2, %%mm0 \n\t"
- "paddusb %%mm0, %%mm0 \n\t"
- "psubusb %%mm0, %%mm4 \n\t"
- "pcmpeqb %%mm7, %%mm4 \n\t" // d <= QP ? -1 : 0
- "psubusb "MANGLE(b01)", %%mm3 \n\t"
- "pand %%mm4, %%mm3 \n\t" // d <= QP ? d : 0
-
- PAVGB(%%mm7, %%mm3) // d/2
- "movq %%mm3, %%mm1 \n\t" // d/2
- PAVGB(%%mm7, %%mm3) // d/4
- PAVGB(%%mm1, %%mm3) // 3*d/8
-
- "movq (%0, %1, 4), %%mm0 \n\t" // line 4
- "pxor %%mm2, %%mm0 \n\t" //(l4 - l5) <= 0 ? -l4-1 : l4
- "psubusb %%mm3, %%mm0 \n\t"
- "pxor %%mm2, %%mm0 \n\t"
- "movq %%mm0, (%0, %1, 4) \n\t" // line 4
-
- "movq (%%"REG_c"), %%mm0 \n\t" // line 5
- "pxor %%mm2, %%mm0 \n\t" //(l4 - l5) <= 0 ? -l5-1 : l5
- "paddusb %%mm3, %%mm0 \n\t"
- "pxor %%mm2, %%mm0 \n\t"
- "movq %%mm0, (%%"REG_c") \n\t" // line 5
-
- PAVGB(%%mm7, %%mm1) // d/4
-
- "movq (%%"REG_a", %1, 2), %%mm0 \n\t" // line 3
- "pxor %%mm2, %%mm0 \n\t" //(l4 - l5) <= 0 ? -l4-1 : l4
- "psubusb %%mm1, %%mm0 \n\t"
- "pxor %%mm2, %%mm0 \n\t"
- "movq %%mm0, (%%"REG_a", %1, 2) \n\t" // line 3
-
- "movq (%%"REG_c", %1), %%mm0 \n\t" // line 6
- "pxor %%mm2, %%mm0 \n\t" //(l4 - l5) <= 0 ? -l5-1 : l5
- "paddusb %%mm1, %%mm0 \n\t"
- "pxor %%mm2, %%mm0 \n\t"
- "movq %%mm0, (%%"REG_c", %1) \n\t" // line 6
-
- PAVGB(%%mm7, %%mm1) // d/8
-
- "movq (%%"REG_a", %1), %%mm0 \n\t" // line 2
- "pxor %%mm2, %%mm0 \n\t" //(l4 - l5) <= 0 ? -l2-1 : l2
- "psubusb %%mm1, %%mm0 \n\t"
- "pxor %%mm2, %%mm0 \n\t"
- "movq %%mm0, (%%"REG_a", %1) \n\t" // line 2
-
- "movq (%%"REG_c", %1, 2), %%mm0 \n\t" // line 7
- "pxor %%mm2, %%mm0 \n\t" //(l4 - l5) <= 0 ? -l7-1 : l7
- "paddusb %%mm1, %%mm0 \n\t"
- "pxor %%mm2, %%mm0 \n\t"
- "movq %%mm0, (%%"REG_c", %1, 2) \n\t" // line 7
-
- :
- : "r" (src), "r" ((x86_reg)stride), "m" (co->pQPb)
- : "%"REG_a, "%"REG_c
- );
-#else //HAVE_MMX2 || HAVE_AMD3DNOW
-
- const int l1= stride;
- const int l2= stride + l1;
- const int l3= stride + l2;
- const int l4= stride + l3;
- const int l5= stride + l4;
- const int l6= stride + l5;
- const int l7= stride + l6;
-// const int l8= stride + l7;
-// const int l9= stride + l8;
- int x;
-
- src+= stride*3;
- for(x=0; x<BLOCK_SIZE; x++){
- int a= src[l3] - src[l4];
- int b= src[l4] - src[l5];
- int c= src[l5] - src[l6];
-
- int d= FFABS(b) - ((FFABS(a) + FFABS(c))>>1);
- d= FFMAX(d, 0);
-
- if(d < co->QP*2){
- int v = d * FFSIGN(-b);
-
- src[l2] +=v>>3;
- src[l3] +=v>>2;
- src[l4] +=(3*v)>>3;
- src[l5] -=(3*v)>>3;
- src[l6] -=v>>2;
- src[l7] -=v>>3;
- }
- src++;
- }
-#endif //HAVE_MMX2 || HAVE_AMD3DNOW
-}
-
-#if !HAVE_ALTIVEC
-static inline void RENAME(doVertDefFilter)(uint8_t src[], int stride, PPContext *c)
-{
-#if HAVE_MMX2 || HAVE_AMD3DNOW
-/*
- uint8_t tmp[16];
- const int l1= stride;
- const int l2= stride + l1;
- const int l3= stride + l2;
- const int l4= (int)tmp - (int)src - stride*3;
- const int l5= (int)tmp - (int)src - stride*3 + 8;
- const int l6= stride*3 + l3;
- const int l7= stride + l6;
- const int l8= stride + l7;
-
- memcpy(tmp, src+stride*7, 8);
- memcpy(tmp+8, src+stride*8, 8);
-*/
- src+= stride*4;
- __asm__ volatile(
-
-#if 0 //slightly more accurate and slightly slower
- "pxor %%mm7, %%mm7 \n\t" // 0
- "lea (%0, %1), %%"REG_a" \n\t"
- "lea (%%"REG_a", %1, 4), %%"REG_c" \n\t"
-// 0 1 2 3 4 5 6 7
-// %0 %0+%1 %0+2%1 eax+2%1 %0+4%1 eax+4%1 ecx+%1 ecx+2%1
-// %0 eax eax+%1 eax+2%1 %0+4%1 ecx ecx+%1 ecx+2%1
-
-
- "movq (%0, %1, 2), %%mm0 \n\t" // l2
- "movq (%0), %%mm1 \n\t" // l0
- "movq %%mm0, %%mm2 \n\t" // l2
- PAVGB(%%mm7, %%mm0) // ~l2/2
- PAVGB(%%mm1, %%mm0) // ~(l2 + 2l0)/4
- PAVGB(%%mm2, %%mm0) // ~(5l2 + 2l0)/8
-
- "movq (%%"REG_a"), %%mm1 \n\t" // l1
- "movq (%%"REG_a", %1, 2), %%mm3 \n\t" // l3
- "movq %%mm1, %%mm4 \n\t" // l1
- PAVGB(%%mm7, %%mm1) // ~l1/2
- PAVGB(%%mm3, %%mm1) // ~(l1 + 2l3)/4
- PAVGB(%%mm4, %%mm1) // ~(5l1 + 2l3)/8
-
- "movq %%mm0, %%mm4 \n\t" // ~(5l2 + 2l0)/8
- "psubusb %%mm1, %%mm0 \n\t"
- "psubusb %%mm4, %%mm1 \n\t"
- "por %%mm0, %%mm1 \n\t" // ~|2l0 - 5l1 + 5l2 - 2l3|/8
-// mm1= |lenergy|, mm2= l2, mm3= l3, mm7=0
-
- "movq (%0, %1, 4), %%mm0 \n\t" // l4
- "movq %%mm0, %%mm4 \n\t" // l4
- PAVGB(%%mm7, %%mm0) // ~l4/2
- PAVGB(%%mm2, %%mm0) // ~(l4 + 2l2)/4
- PAVGB(%%mm4, %%mm0) // ~(5l4 + 2l2)/8
-
- "movq (%%"REG_c"), %%mm2 \n\t" // l5
- "movq %%mm3, %%mm5 \n\t" // l3
- PAVGB(%%mm7, %%mm3) // ~l3/2
- PAVGB(%%mm2, %%mm3) // ~(l3 + 2l5)/4
- PAVGB(%%mm5, %%mm3) // ~(5l3 + 2l5)/8
-
- "movq %%mm0, %%mm6 \n\t" // ~(5l4 + 2l2)/8
- "psubusb %%mm3, %%mm0 \n\t"
- "psubusb %%mm6, %%mm3 \n\t"
- "por %%mm0, %%mm3 \n\t" // ~|2l2 - 5l3 + 5l4 - 2l5|/8
- "pcmpeqb %%mm7, %%mm0 \n\t" // SIGN(2l2 - 5l3 + 5l4 - 2l5)
-// mm0= SIGN(menergy), mm1= |lenergy|, mm2= l5, mm3= |menergy|, mm4=l4, mm5= l3, mm7=0
-
- "movq (%%"REG_c", %1), %%mm6 \n\t" // l6
- "movq %%mm6, %%mm5 \n\t" // l6
- PAVGB(%%mm7, %%mm6) // ~l6/2
- PAVGB(%%mm4, %%mm6) // ~(l6 + 2l4)/4
- PAVGB(%%mm5, %%mm6) // ~(5l6 + 2l4)/8
-
- "movq (%%"REG_c", %1, 2), %%mm5 \n\t" // l7
- "movq %%mm2, %%mm4 \n\t" // l5
- PAVGB(%%mm7, %%mm2) // ~l5/2
- PAVGB(%%mm5, %%mm2) // ~(l5 + 2l7)/4
- PAVGB(%%mm4, %%mm2) // ~(5l5 + 2l7)/8
-
- "movq %%mm6, %%mm4 \n\t" // ~(5l6 + 2l4)/8
- "psubusb %%mm2, %%mm6 \n\t"
- "psubusb %%mm4, %%mm2 \n\t"
- "por %%mm6, %%mm2 \n\t" // ~|2l4 - 5l5 + 5l6 - 2l7|/8
-// mm0= SIGN(menergy), mm1= |lenergy|/8, mm2= |renergy|/8, mm3= |menergy|/8, mm7=0
-
-
- PMINUB(%%mm2, %%mm1, %%mm4) // MIN(|lenergy|,|renergy|)/8
- "movq %2, %%mm4 \n\t" // QP //FIXME QP+1 ?
- "paddusb "MANGLE(b01)", %%mm4 \n\t"
- "pcmpgtb %%mm3, %%mm4 \n\t" // |menergy|/8 < QP
- "psubusb %%mm1, %%mm3 \n\t" // d=|menergy|/8-MIN(|lenergy|,|renergy|)/8
- "pand %%mm4, %%mm3 \n\t"
-
- "movq %%mm3, %%mm1 \n\t"
-// "psubusb "MANGLE(b01)", %%mm3 \n\t"
- PAVGB(%%mm7, %%mm3)
- PAVGB(%%mm7, %%mm3)
- "paddusb %%mm1, %%mm3 \n\t"
-// "paddusb "MANGLE(b01)", %%mm3 \n\t"
-
- "movq (%%"REG_a", %1, 2), %%mm6 \n\t" //l3
- "movq (%0, %1, 4), %%mm5 \n\t" //l4
- "movq (%0, %1, 4), %%mm4 \n\t" //l4
- "psubusb %%mm6, %%mm5 \n\t"
- "psubusb %%mm4, %%mm6 \n\t"
- "por %%mm6, %%mm5 \n\t" // |l3-l4|
- "pcmpeqb %%mm7, %%mm6 \n\t" // SIGN(l3-l4)
- "pxor %%mm6, %%mm0 \n\t"
- "pand %%mm0, %%mm3 \n\t"
- PMINUB(%%mm5, %%mm3, %%mm0)
-
- "psubusb "MANGLE(b01)", %%mm3 \n\t"
- PAVGB(%%mm7, %%mm3)
-
- "movq (%%"REG_a", %1, 2), %%mm0 \n\t"
- "movq (%0, %1, 4), %%mm2 \n\t"
- "pxor %%mm6, %%mm0 \n\t"
- "pxor %%mm6, %%mm2 \n\t"
- "psubb %%mm3, %%mm0 \n\t"
- "paddb %%mm3, %%mm2 \n\t"
- "pxor %%mm6, %%mm0 \n\t"
- "pxor %%mm6, %%mm2 \n\t"
- "movq %%mm0, (%%"REG_a", %1, 2) \n\t"
- "movq %%mm2, (%0, %1, 4) \n\t"
-#endif //0
-
- "lea (%0, %1), %%"REG_a" \n\t"
- "pcmpeqb %%mm6, %%mm6 \n\t" // -1
-// 0 1 2 3 4 5 6 7
-// %0 %0+%1 %0+2%1 eax+2%1 %0+4%1 eax+4%1 ecx+%1 ecx+2%1
-// %0 eax eax+%1 eax+2%1 %0+4%1 ecx ecx+%1 ecx+2%1
-
-
- "movq (%%"REG_a", %1, 2), %%mm1 \n\t" // l3
- "movq (%0, %1, 4), %%mm0 \n\t" // l4
- "pxor %%mm6, %%mm1 \n\t" // -l3-1
- PAVGB(%%mm1, %%mm0) // -q+128 = (l4-l3+256)/2
-// mm1=-l3-1, mm0=128-q
-
- "movq (%%"REG_a", %1, 4), %%mm2 \n\t" // l5
- "movq (%%"REG_a", %1), %%mm3 \n\t" // l2
- "pxor %%mm6, %%mm2 \n\t" // -l5-1
- "movq %%mm2, %%mm5 \n\t" // -l5-1
- "movq "MANGLE(b80)", %%mm4 \n\t" // 128
- "lea (%%"REG_a", %1, 4), %%"REG_c" \n\t"
- PAVGB(%%mm3, %%mm2) // (l2-l5+256)/2
- PAVGB(%%mm0, %%mm4) // ~(l4-l3)/4 + 128
- PAVGB(%%mm2, %%mm4) // ~(l2-l5)/4 +(l4-l3)/8 + 128
- PAVGB(%%mm0, %%mm4) // ~(l2-l5)/8 +5(l4-l3)/16 + 128
-// mm1=-l3-1, mm0=128-q, mm3=l2, mm4=menergy/16 + 128, mm5= -l5-1
-
- "movq (%%"REG_a"), %%mm2 \n\t" // l1
- "pxor %%mm6, %%mm2 \n\t" // -l1-1
- PAVGB(%%mm3, %%mm2) // (l2-l1+256)/2
- PAVGB((%0), %%mm1) // (l0-l3+256)/2
- "movq "MANGLE(b80)", %%mm3 \n\t" // 128
- PAVGB(%%mm2, %%mm3) // ~(l2-l1)/4 + 128
- PAVGB(%%mm1, %%mm3) // ~(l0-l3)/4 +(l2-l1)/8 + 128
- PAVGB(%%mm2, %%mm3) // ~(l0-l3)/8 +5(l2-l1)/16 + 128
-// mm0=128-q, mm3=lenergy/16 + 128, mm4= menergy/16 + 128, mm5= -l5-1
-
- PAVGB((%%REGc, %1), %%mm5) // (l6-l5+256)/2
- "movq (%%"REG_c", %1, 2), %%mm1 \n\t" // l7
- "pxor %%mm6, %%mm1 \n\t" // -l7-1
- PAVGB((%0, %1, 4), %%mm1) // (l4-l7+256)/2
- "movq "MANGLE(b80)", %%mm2 \n\t" // 128
- PAVGB(%%mm5, %%mm2) // ~(l6-l5)/4 + 128
- PAVGB(%%mm1, %%mm2) // ~(l4-l7)/4 +(l6-l5)/8 + 128
- PAVGB(%%mm5, %%mm2) // ~(l4-l7)/8 +5(l6-l5)/16 + 128
-// mm0=128-q, mm2=renergy/16 + 128, mm3=lenergy/16 + 128, mm4= menergy/16 + 128
-
- "movq "MANGLE(b00)", %%mm1 \n\t" // 0
- "movq "MANGLE(b00)", %%mm5 \n\t" // 0
- "psubb %%mm2, %%mm1 \n\t" // 128 - renergy/16
- "psubb %%mm3, %%mm5 \n\t" // 128 - lenergy/16
- PMAXUB(%%mm1, %%mm2) // 128 + |renergy/16|
- PMAXUB(%%mm5, %%mm3) // 128 + |lenergy/16|
- PMINUB(%%mm2, %%mm3, %%mm1) // 128 + MIN(|lenergy|,|renergy|)/16
-
-// mm0=128-q, mm3=128 + MIN(|lenergy|,|renergy|)/16, mm4= menergy/16 + 128
-
- "movq "MANGLE(b00)", %%mm7 \n\t" // 0
- "movq %2, %%mm2 \n\t" // QP
- PAVGB(%%mm6, %%mm2) // 128 + QP/2
- "psubb %%mm6, %%mm2 \n\t"
-
- "movq %%mm4, %%mm1 \n\t"
- "pcmpgtb %%mm7, %%mm1 \n\t" // SIGN(menergy)
- "pxor %%mm1, %%mm4 \n\t"
- "psubb %%mm1, %%mm4 \n\t" // 128 + |menergy|/16
- "pcmpgtb %%mm4, %%mm2 \n\t" // |menergy|/16 < QP/2
- "psubusb %%mm3, %%mm4 \n\t" //d=|menergy|/16 - MIN(|lenergy|,|renergy|)/16
-// mm0=128-q, mm1= SIGN(menergy), mm2= |menergy|/16 < QP/2, mm4= d/16
-
- "movq %%mm4, %%mm3 \n\t" // d
- "psubusb "MANGLE(b01)", %%mm4 \n\t"
- PAVGB(%%mm7, %%mm4) // d/32
- PAVGB(%%mm7, %%mm4) // (d + 32)/64
- "paddb %%mm3, %%mm4 \n\t" // 5d/64
- "pand %%mm2, %%mm4 \n\t"
-
- "movq "MANGLE(b80)", %%mm5 \n\t" // 128
- "psubb %%mm0, %%mm5 \n\t" // q
- "paddsb %%mm6, %%mm5 \n\t" // fix bad rounding
- "pcmpgtb %%mm5, %%mm7 \n\t" // SIGN(q)
- "pxor %%mm7, %%mm5 \n\t"
-
- PMINUB(%%mm5, %%mm4, %%mm3) // MIN(|q|, 5d/64)
- "pxor %%mm1, %%mm7 \n\t" // SIGN(d*q)
-
- "pand %%mm7, %%mm4 \n\t"
- "movq (%%"REG_a", %1, 2), %%mm0 \n\t"
- "movq (%0, %1, 4), %%mm2 \n\t"
- "pxor %%mm1, %%mm0 \n\t"
- "pxor %%mm1, %%mm2 \n\t"
- "paddb %%mm4, %%mm0 \n\t"
- "psubb %%mm4, %%mm2 \n\t"
- "pxor %%mm1, %%mm0 \n\t"
- "pxor %%mm1, %%mm2 \n\t"
- "movq %%mm0, (%%"REG_a", %1, 2) \n\t"
- "movq %%mm2, (%0, %1, 4) \n\t"
-
- :
- : "r" (src), "r" ((x86_reg)stride), "m" (c->pQPb)
- : "%"REG_a, "%"REG_c
- );
-
-/*
- {
- int x;
- src-= stride;
- for(x=0; x<BLOCK_SIZE; x++){
- const int middleEnergy= 5*(src[l5] - src[l4]) + 2*(src[l3] - src[l6]);
- if(FFABS(middleEnergy)< 8*QP){
- const int q=(src[l4] - src[l5])/2;
- const int leftEnergy= 5*(src[l3] - src[l2]) + 2*(src[l1] - src[l4]);
- const int rightEnergy= 5*(src[l7] - src[l6]) + 2*(src[l5] - src[l8]);
-
- int d= FFABS(middleEnergy) - FFMIN( FFABS(leftEnergy), FFABS(rightEnergy) );
- d= FFMAX(d, 0);
-
- d= (5*d + 32) >> 6;
- d*= FFSIGN(-middleEnergy);
-
- if(q>0){
- d= d<0 ? 0 : d;
- d= d>q ? q : d;
- }else{
- d= d>0 ? 0 : d;
- d= d<q ? q : d;
- }
-
- src[l4]-= d;
- src[l5]+= d;
- }
- src++;
- }
- src-=8;
- for(x=0; x<8; x++){
- int y;
- for(y=4; y<6; y++){
- int d= src[x+y*stride] - tmp[x+(y-4)*8];
- int ad= FFABS(d);
- static int max=0;
- static int sum=0;
- static int num=0;
- static int bias=0;
-
- if(max<ad) max=ad;
- sum+= ad>3 ? 1 : 0;
- if(ad>3){
- src[0] = src[7] = src[stride*7] = src[(stride+1)*7]=255;
- }
- if(y==4) bias+=d;
- num++;
- if(num%1000000 == 0){
- av_log(c, AV_LOG_INFO, " %d %d %d %d\n", num, sum, max, bias);
- }
- }
- }
-}
-*/
-#elif HAVE_MMX
- src+= stride*4;
- __asm__ volatile(
- "pxor %%mm7, %%mm7 \n\t"
- "lea -40(%%"REG_SP"), %%"REG_c" \n\t" // make space for 4 8-byte vars
- "and "ALIGN_MASK", %%"REG_c" \n\t" // align
-// 0 1 2 3 4 5 6 7
-// %0 %0+%1 %0+2%1 eax+2%1 %0+4%1 eax+4%1 edx+%1 edx+2%1
-// %0 eax eax+%1 eax+2%1 %0+4%1 edx edx+%1 edx+2%1
-
- "movq (%0), %%mm0 \n\t"
- "movq %%mm0, %%mm1 \n\t"
- "punpcklbw %%mm7, %%mm0 \n\t" // low part of line 0
- "punpckhbw %%mm7, %%mm1 \n\t" // high part of line 0
-
- "movq (%0, %1), %%mm2 \n\t"
- "lea (%0, %1, 2), %%"REG_a" \n\t"
- "movq %%mm2, %%mm3 \n\t"
- "punpcklbw %%mm7, %%mm2 \n\t" // low part of line 1
- "punpckhbw %%mm7, %%mm3 \n\t" // high part of line 1
-
- "movq (%%"REG_a"), %%mm4 \n\t"
- "movq %%mm4, %%mm5 \n\t"
- "punpcklbw %%mm7, %%mm4 \n\t" // low part of line 2
- "punpckhbw %%mm7, %%mm5 \n\t" // high part of line 2
-
- "paddw %%mm0, %%mm0 \n\t" // 2L0
- "paddw %%mm1, %%mm1 \n\t" // 2H0
- "psubw %%mm4, %%mm2 \n\t" // L1 - L2
- "psubw %%mm5, %%mm3 \n\t" // H1 - H2
- "psubw %%mm2, %%mm0 \n\t" // 2L0 - L1 + L2
- "psubw %%mm3, %%mm1 \n\t" // 2H0 - H1 + H2
-
- "psllw $2, %%mm2 \n\t" // 4L1 - 4L2
- "psllw $2, %%mm3 \n\t" // 4H1 - 4H2
- "psubw %%mm2, %%mm0 \n\t" // 2L0 - 5L1 + 5L2
- "psubw %%mm3, %%mm1 \n\t" // 2H0 - 5H1 + 5H2
-
- "movq (%%"REG_a", %1), %%mm2 \n\t"
- "movq %%mm2, %%mm3 \n\t"
- "punpcklbw %%mm7, %%mm2 \n\t" // L3
- "punpckhbw %%mm7, %%mm3 \n\t" // H3
-
- "psubw %%mm2, %%mm0 \n\t" // 2L0 - 5L1 + 5L2 - L3
- "psubw %%mm3, %%mm1 \n\t" // 2H0 - 5H1 + 5H2 - H3
- "psubw %%mm2, %%mm0 \n\t" // 2L0 - 5L1 + 5L2 - 2L3
- "psubw %%mm3, %%mm1 \n\t" // 2H0 - 5H1 + 5H2 - 2H3
- "movq %%mm0, (%%"REG_c") \n\t" // 2L0 - 5L1 + 5L2 - 2L3
- "movq %%mm1, 8(%%"REG_c") \n\t" // 2H0 - 5H1 + 5H2 - 2H3
-
- "movq (%%"REG_a", %1, 2), %%mm0 \n\t"
- "movq %%mm0, %%mm1 \n\t"
- "punpcklbw %%mm7, %%mm0 \n\t" // L4
- "punpckhbw %%mm7, %%mm1 \n\t" // H4
-
- "psubw %%mm0, %%mm2 \n\t" // L3 - L4
- "psubw %%mm1, %%mm3 \n\t" // H3 - H4
- "movq %%mm2, 16(%%"REG_c") \n\t" // L3 - L4
- "movq %%mm3, 24(%%"REG_c") \n\t" // H3 - H4
- "paddw %%mm4, %%mm4 \n\t" // 2L2
- "paddw %%mm5, %%mm5 \n\t" // 2H2
- "psubw %%mm2, %%mm4 \n\t" // 2L2 - L3 + L4
- "psubw %%mm3, %%mm5 \n\t" // 2H2 - H3 + H4
-
- "lea (%%"REG_a", %1), %0 \n\t"
- "psllw $2, %%mm2 \n\t" // 4L3 - 4L4
- "psllw $2, %%mm3 \n\t" // 4H3 - 4H4
- "psubw %%mm2, %%mm4 \n\t" // 2L2 - 5L3 + 5L4
- "psubw %%mm3, %%mm5 \n\t" // 2H2 - 5H3 + 5H4
-//50 opcodes so far
- "movq (%0, %1, 2), %%mm2 \n\t"
- "movq %%mm2, %%mm3 \n\t"
- "punpcklbw %%mm7, %%mm2 \n\t" // L5
- "punpckhbw %%mm7, %%mm3 \n\t" // H5
- "psubw %%mm2, %%mm4 \n\t" // 2L2 - 5L3 + 5L4 - L5
- "psubw %%mm3, %%mm5 \n\t" // 2H2 - 5H3 + 5H4 - H5
- "psubw %%mm2, %%mm4 \n\t" // 2L2 - 5L3 + 5L4 - 2L5
- "psubw %%mm3, %%mm5 \n\t" // 2H2 - 5H3 + 5H4 - 2H5
-
- "movq (%%"REG_a", %1, 4), %%mm6 \n\t"
- "punpcklbw %%mm7, %%mm6 \n\t" // L6
- "psubw %%mm6, %%mm2 \n\t" // L5 - L6
- "movq (%%"REG_a", %1, 4), %%mm6 \n\t"
- "punpckhbw %%mm7, %%mm6 \n\t" // H6
- "psubw %%mm6, %%mm3 \n\t" // H5 - H6
-
- "paddw %%mm0, %%mm0 \n\t" // 2L4
- "paddw %%mm1, %%mm1 \n\t" // 2H4
- "psubw %%mm2, %%mm0 \n\t" // 2L4 - L5 + L6
- "psubw %%mm3, %%mm1 \n\t" // 2H4 - H5 + H6
-
- "psllw $2, %%mm2 \n\t" // 4L5 - 4L6
- "psllw $2, %%mm3 \n\t" // 4H5 - 4H6
- "psubw %%mm2, %%mm0 \n\t" // 2L4 - 5L5 + 5L6
- "psubw %%mm3, %%mm1 \n\t" // 2H4 - 5H5 + 5H6
-
- "movq (%0, %1, 4), %%mm2 \n\t"
- "movq %%mm2, %%mm3 \n\t"
- "punpcklbw %%mm7, %%mm2 \n\t" // L7
- "punpckhbw %%mm7, %%mm3 \n\t" // H7
-
- "paddw %%mm2, %%mm2 \n\t" // 2L7
- "paddw %%mm3, %%mm3 \n\t" // 2H7
- "psubw %%mm2, %%mm0 \n\t" // 2L4 - 5L5 + 5L6 - 2L7
- "psubw %%mm3, %%mm1 \n\t" // 2H4 - 5H5 + 5H6 - 2H7
-
- "movq (%%"REG_c"), %%mm2 \n\t" // 2L0 - 5L1 + 5L2 - 2L3
- "movq 8(%%"REG_c"), %%mm3 \n\t" // 2H0 - 5H1 + 5H2 - 2H3
-
-#if HAVE_MMX2
- "movq %%mm7, %%mm6 \n\t" // 0
- "psubw %%mm0, %%mm6 \n\t"
- "pmaxsw %%mm6, %%mm0 \n\t" // |2L4 - 5L5 + 5L6 - 2L7|
- "movq %%mm7, %%mm6 \n\t" // 0
- "psubw %%mm1, %%mm6 \n\t"
- "pmaxsw %%mm6, %%mm1 \n\t" // |2H4 - 5H5 + 5H6 - 2H7|
- "movq %%mm7, %%mm6 \n\t" // 0
- "psubw %%mm2, %%mm6 \n\t"
- "pmaxsw %%mm6, %%mm2 \n\t" // |2L0 - 5L1 + 5L2 - 2L3|
- "movq %%mm7, %%mm6 \n\t" // 0
- "psubw %%mm3, %%mm6 \n\t"
- "pmaxsw %%mm6, %%mm3 \n\t" // |2H0 - 5H1 + 5H2 - 2H3|
-#else
- "movq %%mm7, %%mm6 \n\t" // 0
- "pcmpgtw %%mm0, %%mm6 \n\t"
- "pxor %%mm6, %%mm0 \n\t"
- "psubw %%mm6, %%mm0 \n\t" // |2L4 - 5L5 + 5L6 - 2L7|
- "movq %%mm7, %%mm6 \n\t" // 0
- "pcmpgtw %%mm1, %%mm6 \n\t"
- "pxor %%mm6, %%mm1 \n\t"
- "psubw %%mm6, %%mm1 \n\t" // |2H4 - 5H5 + 5H6 - 2H7|
- "movq %%mm7, %%mm6 \n\t" // 0
- "pcmpgtw %%mm2, %%mm6 \n\t"
- "pxor %%mm6, %%mm2 \n\t"
- "psubw %%mm6, %%mm2 \n\t" // |2L0 - 5L1 + 5L2 - 2L3|
- "movq %%mm7, %%mm6 \n\t" // 0
- "pcmpgtw %%mm3, %%mm6 \n\t"
- "pxor %%mm6, %%mm3 \n\t"
- "psubw %%mm6, %%mm3 \n\t" // |2H0 - 5H1 + 5H2 - 2H3|
-#endif
-
-#if HAVE_MMX2
- "pminsw %%mm2, %%mm0 \n\t"
- "pminsw %%mm3, %%mm1 \n\t"
-#else
- "movq %%mm0, %%mm6 \n\t"
- "psubusw %%mm2, %%mm6 \n\t"
- "psubw %%mm6, %%mm0 \n\t"
- "movq %%mm1, %%mm6 \n\t"
- "psubusw %%mm3, %%mm6 \n\t"
- "psubw %%mm6, %%mm1 \n\t"
-#endif
-
- "movd %2, %%mm2 \n\t" // QP
- "punpcklbw %%mm7, %%mm2 \n\t"
-
- "movq %%mm7, %%mm6 \n\t" // 0
- "pcmpgtw %%mm4, %%mm6 \n\t" // sign(2L2 - 5L3 + 5L4 - 2L5)
- "pxor %%mm6, %%mm4 \n\t"
- "psubw %%mm6, %%mm4 \n\t" // |2L2 - 5L3 + 5L4 - 2L5|
- "pcmpgtw %%mm5, %%mm7 \n\t" // sign(2H2 - 5H3 + 5H4 - 2H5)
- "pxor %%mm7, %%mm5 \n\t"
- "psubw %%mm7, %%mm5 \n\t" // |2H2 - 5H3 + 5H4 - 2H5|
-// 100 opcodes
- "psllw $3, %%mm2 \n\t" // 8QP
- "movq %%mm2, %%mm3 \n\t" // 8QP
- "pcmpgtw %%mm4, %%mm2 \n\t"
- "pcmpgtw %%mm5, %%mm3 \n\t"
- "pand %%mm2, %%mm4 \n\t"
- "pand %%mm3, %%mm5 \n\t"
-
-
- "psubusw %%mm0, %%mm4 \n\t" // hd
- "psubusw %%mm1, %%mm5 \n\t" // ld
-
-
- "movq "MANGLE(w05)", %%mm2 \n\t" // 5
- "pmullw %%mm2, %%mm4 \n\t"
- "pmullw %%mm2, %%mm5 \n\t"
- "movq "MANGLE(w20)", %%mm2 \n\t" // 32
- "paddw %%mm2, %%mm4 \n\t"
- "paddw %%mm2, %%mm5 \n\t"
- "psrlw $6, %%mm4 \n\t"
- "psrlw $6, %%mm5 \n\t"
-
- "movq 16(%%"REG_c"), %%mm0 \n\t" // L3 - L4
- "movq 24(%%"REG_c"), %%mm1 \n\t" // H3 - H4
-
- "pxor %%mm2, %%mm2 \n\t"
- "pxor %%mm3, %%mm3 \n\t"
-
- "pcmpgtw %%mm0, %%mm2 \n\t" // sign (L3-L4)
- "pcmpgtw %%mm1, %%mm3 \n\t" // sign (H3-H4)
- "pxor %%mm2, %%mm0 \n\t"
- "pxor %%mm3, %%mm1 \n\t"
- "psubw %%mm2, %%mm0 \n\t" // |L3-L4|
- "psubw %%mm3, %%mm1 \n\t" // |H3-H4|
- "psrlw $1, %%mm0 \n\t" // |L3 - L4|/2
- "psrlw $1, %%mm1 \n\t" // |H3 - H4|/2
-
- "pxor %%mm6, %%mm2 \n\t"
- "pxor %%mm7, %%mm3 \n\t"
- "pand %%mm2, %%mm4 \n\t"
- "pand %%mm3, %%mm5 \n\t"
-
-#if HAVE_MMX2
- "pminsw %%mm0, %%mm4 \n\t"
- "pminsw %%mm1, %%mm5 \n\t"
-#else
- "movq %%mm4, %%mm2 \n\t"
- "psubusw %%mm0, %%mm2 \n\t"
- "psubw %%mm2, %%mm4 \n\t"
- "movq %%mm5, %%mm2 \n\t"
- "psubusw %%mm1, %%mm2 \n\t"
- "psubw %%mm2, %%mm5 \n\t"
-#endif
- "pxor %%mm6, %%mm4 \n\t"
- "pxor %%mm7, %%mm5 \n\t"
- "psubw %%mm6, %%mm4 \n\t"
- "psubw %%mm7, %%mm5 \n\t"
- "packsswb %%mm5, %%mm4 \n\t"
- "movq (%0), %%mm0 \n\t"
- "paddb %%mm4, %%mm0 \n\t"
- "movq %%mm0, (%0) \n\t"
- "movq (%0, %1), %%mm0 \n\t"
- "psubb %%mm4, %%mm0 \n\t"
- "movq %%mm0, (%0, %1) \n\t"
-
- : "+r" (src)
- : "r" ((x86_reg)stride), "m" (c->pQPb)
- : "%"REG_a, "%"REG_c
- );
-#else //HAVE_MMX2 || HAVE_AMD3DNOW
- const int l1= stride;
- const int l2= stride + l1;
- const int l3= stride + l2;
- const int l4= stride + l3;
- const int l5= stride + l4;
- const int l6= stride + l5;
- const int l7= stride + l6;
- const int l8= stride + l7;
-// const int l9= stride + l8;
- int x;
- src+= stride*3;
- for(x=0; x<BLOCK_SIZE; x++){
- const int middleEnergy= 5*(src[l5] - src[l4]) + 2*(src[l3] - src[l6]);
- if(FFABS(middleEnergy) < 8*c->QP){
- const int q=(src[l4] - src[l5])/2;
- const int leftEnergy= 5*(src[l3] - src[l2]) + 2*(src[l1] - src[l4]);
- const int rightEnergy= 5*(src[l7] - src[l6]) + 2*(src[l5] - src[l8]);
-
- int d= FFABS(middleEnergy) - FFMIN( FFABS(leftEnergy), FFABS(rightEnergy) );
- d= FFMAX(d, 0);
-
- d= (5*d + 32) >> 6;
- d*= FFSIGN(-middleEnergy);
-
- if(q>0){
- d= d<0 ? 0 : d;
- d= d>q ? q : d;
- }else{
- d= d>0 ? 0 : d;
- d= d<q ? q : d;
- }
-
- src[l4]-= d;
- src[l5]+= d;
- }
- src++;
- }
-#endif //HAVE_MMX2 || HAVE_AMD3DNOW
-}
-#endif //HAVE_ALTIVEC
-
-#if !HAVE_ALTIVEC
-static inline void RENAME(dering)(uint8_t src[], int stride, PPContext *c)
-{
-#if HAVE_MMX2 || HAVE_AMD3DNOW
- __asm__ volatile(
- "pxor %%mm6, %%mm6 \n\t"
- "pcmpeqb %%mm7, %%mm7 \n\t"
- "movq %2, %%mm0 \n\t"
- "punpcklbw %%mm6, %%mm0 \n\t"
- "psrlw $1, %%mm0 \n\t"
- "psubw %%mm7, %%mm0 \n\t"
- "packuswb %%mm0, %%mm0 \n\t"
- "movq %%mm0, %3 \n\t"
-
- "lea (%0, %1), %%"REG_a" \n\t"
- "lea (%%"REG_a", %1, 4), %%"REG_d" \n\t"
-
-// 0 1 2 3 4 5 6 7 8 9
-// %0 eax eax+%1 eax+2%1 %0+4%1 edx edx+%1 edx+2%1 %0+8%1 edx+4%1
-
-#undef REAL_FIND_MIN_MAX
-#undef FIND_MIN_MAX
-#if HAVE_MMX2
-#define REAL_FIND_MIN_MAX(addr)\
- "movq " #addr ", %%mm0 \n\t"\
- "pminub %%mm0, %%mm7 \n\t"\
- "pmaxub %%mm0, %%mm6 \n\t"
-#else
-#define REAL_FIND_MIN_MAX(addr)\
- "movq " #addr ", %%mm0 \n\t"\
- "movq %%mm7, %%mm1 \n\t"\
- "psubusb %%mm0, %%mm6 \n\t"\
- "paddb %%mm0, %%mm6 \n\t"\
- "psubusb %%mm0, %%mm1 \n\t"\
- "psubb %%mm1, %%mm7 \n\t"
-#endif
-#define FIND_MIN_MAX(addr) REAL_FIND_MIN_MAX(addr)
-
-FIND_MIN_MAX((%%REGa))
-FIND_MIN_MAX((%%REGa, %1))
-FIND_MIN_MAX((%%REGa, %1, 2))
-FIND_MIN_MAX((%0, %1, 4))
-FIND_MIN_MAX((%%REGd))
-FIND_MIN_MAX((%%REGd, %1))
-FIND_MIN_MAX((%%REGd, %1, 2))
-FIND_MIN_MAX((%0, %1, 8))
-
- "movq %%mm7, %%mm4 \n\t"
- "psrlq $8, %%mm7 \n\t"
-#if HAVE_MMX2
- "pminub %%mm4, %%mm7 \n\t" // min of pixels
- "pshufw $0xF9, %%mm7, %%mm4 \n\t"
- "pminub %%mm4, %%mm7 \n\t" // min of pixels
- "pshufw $0xFE, %%mm7, %%mm4 \n\t"
- "pminub %%mm4, %%mm7 \n\t"
-#else
- "movq %%mm7, %%mm1 \n\t"
- "psubusb %%mm4, %%mm1 \n\t"
- "psubb %%mm1, %%mm7 \n\t"
- "movq %%mm7, %%mm4 \n\t"
- "psrlq $16, %%mm7 \n\t"
- "movq %%mm7, %%mm1 \n\t"
- "psubusb %%mm4, %%mm1 \n\t"
- "psubb %%mm1, %%mm7 \n\t"
- "movq %%mm7, %%mm4 \n\t"
- "psrlq $32, %%mm7 \n\t"
- "movq %%mm7, %%mm1 \n\t"
- "psubusb %%mm4, %%mm1 \n\t"
- "psubb %%mm1, %%mm7 \n\t"
-#endif
-
-
- "movq %%mm6, %%mm4 \n\t"
- "psrlq $8, %%mm6 \n\t"
-#if HAVE_MMX2
- "pmaxub %%mm4, %%mm6 \n\t" // max of pixels
- "pshufw $0xF9, %%mm6, %%mm4 \n\t"
- "pmaxub %%mm4, %%mm6 \n\t"
- "pshufw $0xFE, %%mm6, %%mm4 \n\t"
- "pmaxub %%mm4, %%mm6 \n\t"
-#else
- "psubusb %%mm4, %%mm6 \n\t"
- "paddb %%mm4, %%mm6 \n\t"
- "movq %%mm6, %%mm4 \n\t"
- "psrlq $16, %%mm6 \n\t"
- "psubusb %%mm4, %%mm6 \n\t"
- "paddb %%mm4, %%mm6 \n\t"
- "movq %%mm6, %%mm4 \n\t"
- "psrlq $32, %%mm6 \n\t"
- "psubusb %%mm4, %%mm6 \n\t"
- "paddb %%mm4, %%mm6 \n\t"
-#endif
- "movq %%mm6, %%mm0 \n\t" // max
- "psubb %%mm7, %%mm6 \n\t" // max - min
- "movd %%mm6, %%ecx \n\t"
- "cmpb "MANGLE(deringThreshold)", %%cl \n\t"
- " jb 1f \n\t"
- "lea -24(%%"REG_SP"), %%"REG_c" \n\t"
- "and "ALIGN_MASK", %%"REG_c" \n\t"
- PAVGB(%%mm0, %%mm7) // a=(max + min)/2
- "punpcklbw %%mm7, %%mm7 \n\t"
- "punpcklbw %%mm7, %%mm7 \n\t"
- "punpcklbw %%mm7, %%mm7 \n\t"
- "movq %%mm7, (%%"REG_c") \n\t"
-
- "movq (%0), %%mm0 \n\t" // L10
- "movq %%mm0, %%mm1 \n\t" // L10
- "movq %%mm0, %%mm2 \n\t" // L10
- "psllq $8, %%mm1 \n\t"
- "psrlq $8, %%mm2 \n\t"
- "movd -4(%0), %%mm3 \n\t"
- "movd 8(%0), %%mm4 \n\t"
- "psrlq $24, %%mm3 \n\t"
- "psllq $56, %%mm4 \n\t"
- "por %%mm3, %%mm1 \n\t" // L00
- "por %%mm4, %%mm2 \n\t" // L20
- "movq %%mm1, %%mm3 \n\t" // L00
- PAVGB(%%mm2, %%mm1) // (L20 + L00)/2
- PAVGB(%%mm0, %%mm1) // (L20 + L00 + 2L10)/4
- "psubusb %%mm7, %%mm0 \n\t"
- "psubusb %%mm7, %%mm2 \n\t"
- "psubusb %%mm7, %%mm3 \n\t"
- "pcmpeqb "MANGLE(b00)", %%mm0 \n\t" // L10 > a ? 0 : -1
- "pcmpeqb "MANGLE(b00)", %%mm2 \n\t" // L20 > a ? 0 : -1
- "pcmpeqb "MANGLE(b00)", %%mm3 \n\t" // L00 > a ? 0 : -1
- "paddb %%mm2, %%mm0 \n\t"
- "paddb %%mm3, %%mm0 \n\t"
-
- "movq (%%"REG_a"), %%mm2 \n\t" // L11
- "movq %%mm2, %%mm3 \n\t" // L11
- "movq %%mm2, %%mm4 \n\t" // L11
- "psllq $8, %%mm3 \n\t"
- "psrlq $8, %%mm4 \n\t"
- "movd -4(%%"REG_a"), %%mm5 \n\t"
- "movd 8(%%"REG_a"), %%mm6 \n\t"
- "psrlq $24, %%mm5 \n\t"
- "psllq $56, %%mm6 \n\t"
- "por %%mm5, %%mm3 \n\t" // L01
- "por %%mm6, %%mm4 \n\t" // L21
- "movq %%mm3, %%mm5 \n\t" // L01
- PAVGB(%%mm4, %%mm3) // (L21 + L01)/2
- PAVGB(%%mm2, %%mm3) // (L21 + L01 + 2L11)/4
- "psubusb %%mm7, %%mm2 \n\t"
- "psubusb %%mm7, %%mm4 \n\t"
- "psubusb %%mm7, %%mm5 \n\t"
- "pcmpeqb "MANGLE(b00)", %%mm2 \n\t" // L11 > a ? 0 : -1
- "pcmpeqb "MANGLE(b00)", %%mm4 \n\t" // L21 > a ? 0 : -1
- "pcmpeqb "MANGLE(b00)", %%mm5 \n\t" // L01 > a ? 0 : -1
- "paddb %%mm4, %%mm2 \n\t"
- "paddb %%mm5, %%mm2 \n\t"
-// 0, 2, 3, 1
-#define REAL_DERING_CORE(dst,src,ppsx,psx,sx,pplx,plx,lx,t0,t1) \
- "movq " #src ", " #sx " \n\t" /* src[0] */\
- "movq " #sx ", " #lx " \n\t" /* src[0] */\
- "movq " #sx ", " #t0 " \n\t" /* src[0] */\
- "psllq $8, " #lx " \n\t"\
- "psrlq $8, " #t0 " \n\t"\
- "movd -4" #src ", " #t1 " \n\t"\
- "psrlq $24, " #t1 " \n\t"\
- "por " #t1 ", " #lx " \n\t" /* src[-1] */\
- "movd 8" #src ", " #t1 " \n\t"\
- "psllq $56, " #t1 " \n\t"\
- "por " #t1 ", " #t0 " \n\t" /* src[+1] */\
- "movq " #lx ", " #t1 " \n\t" /* src[-1] */\
- PAVGB(t0, lx) /* (src[-1] + src[+1])/2 */\
- PAVGB(sx, lx) /* (src[-1] + 2src[0] + src[+1])/4 */\
- PAVGB(lx, pplx) \
- "movq " #lx ", 8(%%"REG_c") \n\t"\
- "movq (%%"REG_c"), " #lx " \n\t"\
- "psubusb " #lx ", " #t1 " \n\t"\
- "psubusb " #lx ", " #t0 " \n\t"\
- "psubusb " #lx ", " #sx " \n\t"\
- "movq "MANGLE(b00)", " #lx " \n\t"\
- "pcmpeqb " #lx ", " #t1 " \n\t" /* src[-1] > a ? 0 : -1*/\
- "pcmpeqb " #lx ", " #t0 " \n\t" /* src[+1] > a ? 0 : -1*/\
- "pcmpeqb " #lx ", " #sx " \n\t" /* src[0] > a ? 0 : -1*/\
- "paddb " #t1 ", " #t0 " \n\t"\
- "paddb " #t0 ", " #sx " \n\t"\
-\
- PAVGB(plx, pplx) /* filtered */\
- "movq " #dst ", " #t0 " \n\t" /* dst */\
- "movq " #t0 ", " #t1 " \n\t" /* dst */\
- "psubusb %3, " #t0 " \n\t"\
- "paddusb %3, " #t1 " \n\t"\
- PMAXUB(t0, pplx)\
- PMINUB(t1, pplx, t0)\
- "paddb " #sx ", " #ppsx " \n\t"\
- "paddb " #psx ", " #ppsx " \n\t"\
- "#paddb "MANGLE(b02)", " #ppsx " \n\t"\
- "pand "MANGLE(b08)", " #ppsx " \n\t"\
- "pcmpeqb " #lx ", " #ppsx " \n\t"\
- "pand " #ppsx ", " #pplx " \n\t"\
- "pandn " #dst ", " #ppsx " \n\t"\
- "por " #pplx ", " #ppsx " \n\t"\
- "movq " #ppsx ", " #dst " \n\t"\
- "movq 8(%%"REG_c"), " #lx " \n\t"
-
-#define DERING_CORE(dst,src,ppsx,psx,sx,pplx,plx,lx,t0,t1) \
- REAL_DERING_CORE(dst,src,ppsx,psx,sx,pplx,plx,lx,t0,t1)
-/*
-0000000
-1111111
-
-1111110
-1111101
-1111100
-1111011
-1111010
-1111001
-
-1111000
-1110111
-
-*/
-//DERING_CORE(dst ,src ,ppsx ,psx ,sx ,pplx ,plx ,lx ,t0 ,t1)
-DERING_CORE((%%REGa) ,(%%REGa, %1) ,%%mm0,%%mm2,%%mm4,%%mm1,%%mm3,%%mm5,%%mm6,%%mm7)
-DERING_CORE((%%REGa, %1) ,(%%REGa, %1, 2),%%mm2,%%mm4,%%mm0,%%mm3,%%mm5,%%mm1,%%mm6,%%mm7)
-DERING_CORE((%%REGa, %1, 2),(%0, %1, 4) ,%%mm4,%%mm0,%%mm2,%%mm5,%%mm1,%%mm3,%%mm6,%%mm7)
-DERING_CORE((%0, %1, 4) ,(%%REGd) ,%%mm0,%%mm2,%%mm4,%%mm1,%%mm3,%%mm5,%%mm6,%%mm7)
-DERING_CORE((%%REGd) ,(%%REGd, %1) ,%%mm2,%%mm4,%%mm0,%%mm3,%%mm5,%%mm1,%%mm6,%%mm7)
-DERING_CORE((%%REGd, %1) ,(%%REGd, %1, 2),%%mm4,%%mm0,%%mm2,%%mm5,%%mm1,%%mm3,%%mm6,%%mm7)
-DERING_CORE((%%REGd, %1, 2),(%0, %1, 8) ,%%mm0,%%mm2,%%mm4,%%mm1,%%mm3,%%mm5,%%mm6,%%mm7)
-DERING_CORE((%0, %1, 8) ,(%%REGd, %1, 4),%%mm2,%%mm4,%%mm0,%%mm3,%%mm5,%%mm1,%%mm6,%%mm7)
-
- "1: \n\t"
- : : "r" (src), "r" ((x86_reg)stride), "m" (c->pQPb), "m"(c->pQPb2)
- : "%"REG_a, "%"REG_d, "%"REG_c
- );
-#else //HAVE_MMX2 || HAVE_AMD3DNOW
- int y;
- int min=255;
- int max=0;
- int avg;
- uint8_t *p;
- int s[10];
- const int QP2= c->QP/2 + 1;
-
- for(y=1; y<9; y++){
- int x;
- p= src + stride*y;
- for(x=1; x<9; x++){
- p++;
- if(*p > max) max= *p;
- if(*p < min) min= *p;
- }
- }
- avg= (min + max + 1)>>1;
-
- if(max - min <deringThreshold) return;
-
- for(y=0; y<10; y++){
- int t = 0;
-
- if(src[stride*y + 0] > avg) t+= 1;
- if(src[stride*y + 1] > avg) t+= 2;
- if(src[stride*y + 2] > avg) t+= 4;
- if(src[stride*y + 3] > avg) t+= 8;
- if(src[stride*y + 4] > avg) t+= 16;
- if(src[stride*y + 5] > avg) t+= 32;
- if(src[stride*y + 6] > avg) t+= 64;
- if(src[stride*y + 7] > avg) t+= 128;
- if(src[stride*y + 8] > avg) t+= 256;
- if(src[stride*y + 9] > avg) t+= 512;
-
- t |= (~t)<<16;
- t &= (t<<1) & (t>>1);
- s[y] = t;
- }
-
- for(y=1; y<9; y++){
- int t = s[y-1] & s[y] & s[y+1];
- t|= t>>16;
- s[y-1]= t;
- }
-
- for(y=1; y<9; y++){
- int x;
- int t = s[y-1];
-
- p= src + stride*y;
- for(x=1; x<9; x++){
- p++;
- if(t & (1<<x)){
- int f= (*(p-stride-1)) + 2*(*(p-stride)) + (*(p-stride+1))
- +2*(*(p -1)) + 4*(*p ) + 2*(*(p +1))
- +(*(p+stride-1)) + 2*(*(p+stride)) + (*(p+stride+1));
- f= (f + 8)>>4;
-
-#ifdef DEBUG_DERING_THRESHOLD
- __asm__ volatile("emms\n\t":);
- {
- static long long numPixels=0;
- if(x!=1 && x!=8 && y!=1 && y!=8) numPixels++;
-// if((max-min)<20 || (max-min)*QP<200)
-// if((max-min)*QP < 500)
-// if(max-min<QP/2)
- if(max-min < 20){
- static int numSkipped=0;
- static int errorSum=0;
- static int worstQP=0;
- static int worstRange=0;
- static int worstDiff=0;
- int diff= (f - *p);
- int absDiff= FFABS(diff);
- int error= diff*diff;
-
- if(x==1 || x==8 || y==1 || y==8) continue;
-
- numSkipped++;
- if(absDiff > worstDiff){
- worstDiff= absDiff;
- worstQP= QP;
- worstRange= max-min;
- }
- errorSum+= error;
-
- if(1024LL*1024LL*1024LL % numSkipped == 0){
- av_log(c, AV_LOG_INFO, "sum:%1.3f, skip:%d, wQP:%d, "
- "wRange:%d, wDiff:%d, relSkip:%1.3f\n",
- (float)errorSum/numSkipped, numSkipped, worstQP, worstRange,
- worstDiff, (float)numSkipped/numPixels);
- }
- }
- }
-#endif
- if (*p + QP2 < f) *p= *p + QP2;
- else if(*p - QP2 > f) *p= *p - QP2;
- else *p=f;
- }
- }
- }
-#ifdef DEBUG_DERING_THRESHOLD
- if(max-min < 20){
- for(y=1; y<9; y++){
- int x;
- int t = 0;
- p= src + stride*y;
- for(x=1; x<9; x++){
- p++;
- *p = FFMIN(*p + 20, 255);
- }
- }
-// src[0] = src[7]=src[stride*7]=src[stride*7 + 7]=255;
- }
-#endif
-#endif //HAVE_MMX2 || HAVE_AMD3DNOW
-}
-#endif //HAVE_ALTIVEC
-
-/**
- * Deinterlace the given block by linearly interpolating every second line.
- * will be called for every 8x8 block and can read & write from line 4-15
- * lines 0-3 have been passed through the deblock / dering filters already, but can be read, too.
- * lines 4-12 will be read into the deblocking filter and should be deinterlaced
- */
-static inline void RENAME(deInterlaceInterpolateLinear)(uint8_t src[], int stride)
-{
-#if HAVE_MMX2 || HAVE_AMD3DNOW
- src+= 4*stride;
- __asm__ volatile(
- "lea (%0, %1), %%"REG_a" \n\t"
- "lea (%%"REG_a", %1, 4), %%"REG_c" \n\t"
-// 0 1 2 3 4 5 6 7 8 9
-// %0 eax eax+%1 eax+2%1 %0+4%1 ecx ecx+%1 ecx+2%1 %0+8%1 ecx+4%1
-
- "movq (%0), %%mm0 \n\t"
- "movq (%%"REG_a", %1), %%mm1 \n\t"
- PAVGB(%%mm1, %%mm0)
- "movq %%mm0, (%%"REG_a") \n\t"
- "movq (%0, %1, 4), %%mm0 \n\t"
- PAVGB(%%mm0, %%mm1)
- "movq %%mm1, (%%"REG_a", %1, 2) \n\t"
- "movq (%%"REG_c", %1), %%mm1 \n\t"
- PAVGB(%%mm1, %%mm0)
- "movq %%mm0, (%%"REG_c") \n\t"
- "movq (%0, %1, 8), %%mm0 \n\t"
- PAVGB(%%mm0, %%mm1)
- "movq %%mm1, (%%"REG_c", %1, 2) \n\t"
-
- : : "r" (src), "r" ((x86_reg)stride)
- : "%"REG_a, "%"REG_c
- );
-#else
- int a, b, x;
- src+= 4*stride;
-
- for(x=0; x<2; x++){
- a= *(uint32_t*)&src[stride*0];
- b= *(uint32_t*)&src[stride*2];
- *(uint32_t*)&src[stride*1]= (a|b) - (((a^b)&0xFEFEFEFEUL)>>1);
- a= *(uint32_t*)&src[stride*4];
- *(uint32_t*)&src[stride*3]= (a|b) - (((a^b)&0xFEFEFEFEUL)>>1);
- b= *(uint32_t*)&src[stride*6];
- *(uint32_t*)&src[stride*5]= (a|b) - (((a^b)&0xFEFEFEFEUL)>>1);
- a= *(uint32_t*)&src[stride*8];
- *(uint32_t*)&src[stride*7]= (a|b) - (((a^b)&0xFEFEFEFEUL)>>1);
- src += 4;
- }
-#endif
-}
-
-/**
- * Deinterlace the given block by cubic interpolating every second line.
- * will be called for every 8x8 block and can read & write from line 4-15
- * lines 0-3 have been passed through the deblock / dering filters already, but can be read, too.
- * lines 4-12 will be read into the deblocking filter and should be deinterlaced
- * this filter will read lines 3-15 and write 7-13
- */
-static inline void RENAME(deInterlaceInterpolateCubic)(uint8_t src[], int stride)
-{
-#if HAVE_MMX2 || HAVE_AMD3DNOW
- src+= stride*3;
- __asm__ volatile(
- "lea (%0, %1), %%"REG_a" \n\t"
- "lea (%%"REG_a", %1, 4), %%"REG_d" \n\t"
- "lea (%%"REG_d", %1, 4), %%"REG_c" \n\t"
- "add %1, %%"REG_c" \n\t"
- "pxor %%mm7, %%mm7 \n\t"
-// 0 1 2 3 4 5 6 7 8 9 10
-// %0 eax eax+%1 eax+2%1 %0+4%1 edx edx+%1 edx+2%1 %0+8%1 edx+4%1 ecx
-
-#define REAL_DEINT_CUBIC(a,b,c,d,e)\
- "movq " #a ", %%mm0 \n\t"\
- "movq " #b ", %%mm1 \n\t"\
- "movq " #d ", %%mm2 \n\t"\
- "movq " #e ", %%mm3 \n\t"\
- PAVGB(%%mm2, %%mm1) /* (b+d) /2 */\
- PAVGB(%%mm3, %%mm0) /* a(a+e) /2 */\
- "movq %%mm0, %%mm2 \n\t"\
- "punpcklbw %%mm7, %%mm0 \n\t"\
- "punpckhbw %%mm7, %%mm2 \n\t"\
- "movq %%mm1, %%mm3 \n\t"\
- "punpcklbw %%mm7, %%mm1 \n\t"\
- "punpckhbw %%mm7, %%mm3 \n\t"\
- "psubw %%mm1, %%mm0 \n\t" /* L(a+e - (b+d))/2 */\
- "psubw %%mm3, %%mm2 \n\t" /* H(a+e - (b+d))/2 */\
- "psraw $3, %%mm0 \n\t" /* L(a+e - (b+d))/16 */\
- "psraw $3, %%mm2 \n\t" /* H(a+e - (b+d))/16 */\
- "psubw %%mm0, %%mm1 \n\t" /* L(9b + 9d - a - e)/16 */\
- "psubw %%mm2, %%mm3 \n\t" /* H(9b + 9d - a - e)/16 */\
- "packuswb %%mm3, %%mm1 \n\t"\
- "movq %%mm1, " #c " \n\t"
-#define DEINT_CUBIC(a,b,c,d,e) REAL_DEINT_CUBIC(a,b,c,d,e)
-
-DEINT_CUBIC((%0) , (%%REGa, %1), (%%REGa, %1, 2), (%0, %1, 4) , (%%REGd, %1))
-DEINT_CUBIC((%%REGa, %1), (%0, %1, 4) , (%%REGd) , (%%REGd, %1), (%0, %1, 8))
-DEINT_CUBIC((%0, %1, 4) , (%%REGd, %1), (%%REGd, %1, 2), (%0, %1, 8) , (%%REGc))
-DEINT_CUBIC((%%REGd, %1), (%0, %1, 8) , (%%REGd, %1, 4), (%%REGc) , (%%REGc, %1, 2))
-
- : : "r" (src), "r" ((x86_reg)stride)
- : "%"REG_a, "%"REG_d, "%"REG_c
- );
-#else //HAVE_MMX2 || HAVE_AMD3DNOW
- int x;
- src+= stride*3;
- for(x=0; x<8; x++){
- src[stride*3] = CLIP((-src[0] + 9*src[stride*2] + 9*src[stride*4] - src[stride*6])>>4);
- src[stride*5] = CLIP((-src[stride*2] + 9*src[stride*4] + 9*src[stride*6] - src[stride*8])>>4);
- src[stride*7] = CLIP((-src[stride*4] + 9*src[stride*6] + 9*src[stride*8] - src[stride*10])>>4);
- src[stride*9] = CLIP((-src[stride*6] + 9*src[stride*8] + 9*src[stride*10] - src[stride*12])>>4);
- src++;
- }
-#endif //HAVE_MMX2 || HAVE_AMD3DNOW
-}
-
-/**
- * Deinterlace the given block by filtering every second line with a (-1 4 2 4 -1) filter.
- * will be called for every 8x8 block and can read & write from line 4-15
- * lines 0-3 have been passed through the deblock / dering filters already, but can be read, too.
- * lines 4-12 will be read into the deblocking filter and should be deinterlaced
- * this filter will read lines 4-13 and write 5-11
- */
-static inline void RENAME(deInterlaceFF)(uint8_t src[], int stride, uint8_t *tmp)
-{
-#if HAVE_MMX2 || HAVE_AMD3DNOW
- src+= stride*4;
- __asm__ volatile(
- "lea (%0, %1), %%"REG_a" \n\t"
- "lea (%%"REG_a", %1, 4), %%"REG_d" \n\t"
- "pxor %%mm7, %%mm7 \n\t"
- "movq (%2), %%mm0 \n\t"
-// 0 1 2 3 4 5 6 7 8 9 10
-// %0 eax eax+%1 eax+2%1 %0+4%1 edx edx+%1 edx+2%1 %0+8%1 edx+4%1 ecx
-
-#define REAL_DEINT_FF(a,b,c,d)\
- "movq " #a ", %%mm1 \n\t"\
- "movq " #b ", %%mm2 \n\t"\
- "movq " #c ", %%mm3 \n\t"\
- "movq " #d ", %%mm4 \n\t"\
- PAVGB(%%mm3, %%mm1) \
- PAVGB(%%mm4, %%mm0) \
- "movq %%mm0, %%mm3 \n\t"\
- "punpcklbw %%mm7, %%mm0 \n\t"\
- "punpckhbw %%mm7, %%mm3 \n\t"\
- "movq %%mm1, %%mm4 \n\t"\
- "punpcklbw %%mm7, %%mm1 \n\t"\
- "punpckhbw %%mm7, %%mm4 \n\t"\
- "psllw $2, %%mm1 \n\t"\
- "psllw $2, %%mm4 \n\t"\
- "psubw %%mm0, %%mm1 \n\t"\
- "psubw %%mm3, %%mm4 \n\t"\
- "movq %%mm2, %%mm5 \n\t"\
- "movq %%mm2, %%mm0 \n\t"\
- "punpcklbw %%mm7, %%mm2 \n\t"\
- "punpckhbw %%mm7, %%mm5 \n\t"\
- "paddw %%mm2, %%mm1 \n\t"\
- "paddw %%mm5, %%mm4 \n\t"\
- "psraw $2, %%mm1 \n\t"\
- "psraw $2, %%mm4 \n\t"\
- "packuswb %%mm4, %%mm1 \n\t"\
- "movq %%mm1, " #b " \n\t"\
-
-#define DEINT_FF(a,b,c,d) REAL_DEINT_FF(a,b,c,d)
-
-DEINT_FF((%0) , (%%REGa) , (%%REGa, %1), (%%REGa, %1, 2))
-DEINT_FF((%%REGa, %1), (%%REGa, %1, 2), (%0, %1, 4) , (%%REGd) )
-DEINT_FF((%0, %1, 4) , (%%REGd) , (%%REGd, %1), (%%REGd, %1, 2))
-DEINT_FF((%%REGd, %1), (%%REGd, %1, 2), (%0, %1, 8) , (%%REGd, %1, 4))
-
- "movq %%mm0, (%2) \n\t"
- : : "r" (src), "r" ((x86_reg)stride), "r"(tmp)
- : "%"REG_a, "%"REG_d
- );
-#else //HAVE_MMX2 || HAVE_AMD3DNOW
- int x;
- src+= stride*4;
- for(x=0; x<8; x++){
- int t1= tmp[x];
- int t2= src[stride*1];
-
- src[stride*1]= CLIP((-t1 + 4*src[stride*0] + 2*t2 + 4*src[stride*2] - src[stride*3] + 4)>>3);
- t1= src[stride*4];
- src[stride*3]= CLIP((-t2 + 4*src[stride*2] + 2*t1 + 4*src[stride*4] - src[stride*5] + 4)>>3);
- t2= src[stride*6];
- src[stride*5]= CLIP((-t1 + 4*src[stride*4] + 2*t2 + 4*src[stride*6] - src[stride*7] + 4)>>3);
- t1= src[stride*8];
- src[stride*7]= CLIP((-t2 + 4*src[stride*6] + 2*t1 + 4*src[stride*8] - src[stride*9] + 4)>>3);
- tmp[x]= t1;
-
- src++;
- }
-#endif //HAVE_MMX2 || HAVE_AMD3DNOW
-}
-
-/**
- * Deinterlace the given block by filtering every line with a (-1 2 6 2 -1) filter.
- * will be called for every 8x8 block and can read & write from line 4-15
- * lines 0-3 have been passed through the deblock / dering filters already, but can be read, too.
- * lines 4-12 will be read into the deblocking filter and should be deinterlaced
- * this filter will read lines 4-13 and write 4-11
- */
-static inline void RENAME(deInterlaceL5)(uint8_t src[], int stride, uint8_t *tmp, uint8_t *tmp2)
-{
-#if HAVE_MMX2 || HAVE_AMD3DNOW
- src+= stride*4;
- __asm__ volatile(
- "lea (%0, %1), %%"REG_a" \n\t"
- "lea (%%"REG_a", %1, 4), %%"REG_d" \n\t"
- "pxor %%mm7, %%mm7 \n\t"
- "movq (%2), %%mm0 \n\t"
- "movq (%3), %%mm1 \n\t"
-// 0 1 2 3 4 5 6 7 8 9 10
-// %0 eax eax+%1 eax+2%1 %0+4%1 edx edx+%1 edx+2%1 %0+8%1 edx+4%1 ecx
-
-#define REAL_DEINT_L5(t1,t2,a,b,c)\
- "movq " #a ", %%mm2 \n\t"\
- "movq " #b ", %%mm3 \n\t"\
- "movq " #c ", %%mm4 \n\t"\
- PAVGB(t2, %%mm3) \
- PAVGB(t1, %%mm4) \
- "movq %%mm2, %%mm5 \n\t"\
- "movq %%mm2, " #t1 " \n\t"\
- "punpcklbw %%mm7, %%mm2 \n\t"\
- "punpckhbw %%mm7, %%mm5 \n\t"\
- "movq %%mm2, %%mm6 \n\t"\
- "paddw %%mm2, %%mm2 \n\t"\
- "paddw %%mm6, %%mm2 \n\t"\
- "movq %%mm5, %%mm6 \n\t"\
- "paddw %%mm5, %%mm5 \n\t"\
- "paddw %%mm6, %%mm5 \n\t"\
- "movq %%mm3, %%mm6 \n\t"\
- "punpcklbw %%mm7, %%mm3 \n\t"\
- "punpckhbw %%mm7, %%mm6 \n\t"\
- "paddw %%mm3, %%mm3 \n\t"\
- "paddw %%mm6, %%mm6 \n\t"\
- "paddw %%mm3, %%mm2 \n\t"\
- "paddw %%mm6, %%mm5 \n\t"\
- "movq %%mm4, %%mm6 \n\t"\
- "punpcklbw %%mm7, %%mm4 \n\t"\
- "punpckhbw %%mm7, %%mm6 \n\t"\
- "psubw %%mm4, %%mm2 \n\t"\
- "psubw %%mm6, %%mm5 \n\t"\
- "psraw $2, %%mm2 \n\t"\
- "psraw $2, %%mm5 \n\t"\
- "packuswb %%mm5, %%mm2 \n\t"\
- "movq %%mm2, " #a " \n\t"\
-
-#define DEINT_L5(t1,t2,a,b,c) REAL_DEINT_L5(t1,t2,a,b,c)
-
-DEINT_L5(%%mm0, %%mm1, (%0) , (%%REGa) , (%%REGa, %1) )
-DEINT_L5(%%mm1, %%mm0, (%%REGa) , (%%REGa, %1) , (%%REGa, %1, 2))
-DEINT_L5(%%mm0, %%mm1, (%%REGa, %1) , (%%REGa, %1, 2), (%0, %1, 4) )
-DEINT_L5(%%mm1, %%mm0, (%%REGa, %1, 2), (%0, %1, 4) , (%%REGd) )
-DEINT_L5(%%mm0, %%mm1, (%0, %1, 4) , (%%REGd) , (%%REGd, %1) )
-DEINT_L5(%%mm1, %%mm0, (%%REGd) , (%%REGd, %1) , (%%REGd, %1, 2))
-DEINT_L5(%%mm0, %%mm1, (%%REGd, %1) , (%%REGd, %1, 2), (%0, %1, 8) )
-DEINT_L5(%%mm1, %%mm0, (%%REGd, %1, 2), (%0, %1, 8) , (%%REGd, %1, 4))
-
- "movq %%mm0, (%2) \n\t"
- "movq %%mm1, (%3) \n\t"
- : : "r" (src), "r" ((x86_reg)stride), "r"(tmp), "r"(tmp2)
- : "%"REG_a, "%"REG_d
- );
-#else //HAVE_MMX2 || HAVE_AMD3DNOW
- int x;
- src+= stride*4;
- for(x=0; x<8; x++){
- int t1= tmp[x];
- int t2= tmp2[x];
- int t3= src[0];
-
- src[stride*0]= CLIP((-(t1 + src[stride*2]) + 2*(t2 + src[stride*1]) + 6*t3 + 4)>>3);
- t1= src[stride*1];
- src[stride*1]= CLIP((-(t2 + src[stride*3]) + 2*(t3 + src[stride*2]) + 6*t1 + 4)>>3);
- t2= src[stride*2];
- src[stride*2]= CLIP((-(t3 + src[stride*4]) + 2*(t1 + src[stride*3]) + 6*t2 + 4)>>3);
- t3= src[stride*3];
- src[stride*3]= CLIP((-(t1 + src[stride*5]) + 2*(t2 + src[stride*4]) + 6*t3 + 4)>>3);
- t1= src[stride*4];
- src[stride*4]= CLIP((-(t2 + src[stride*6]) + 2*(t3 + src[stride*5]) + 6*t1 + 4)>>3);
- t2= src[stride*5];
- src[stride*5]= CLIP((-(t3 + src[stride*7]) + 2*(t1 + src[stride*6]) + 6*t2 + 4)>>3);
- t3= src[stride*6];
- src[stride*6]= CLIP((-(t1 + src[stride*8]) + 2*(t2 + src[stride*7]) + 6*t3 + 4)>>3);
- t1= src[stride*7];
- src[stride*7]= CLIP((-(t2 + src[stride*9]) + 2*(t3 + src[stride*8]) + 6*t1 + 4)>>3);
-
- tmp[x]= t3;
- tmp2[x]= t1;
-
- src++;
- }
-#endif //HAVE_MMX2 || HAVE_AMD3DNOW
-}
-
-/**
- * Deinterlace the given block by filtering all lines with a (1 2 1) filter.
- * will be called for every 8x8 block and can read & write from line 4-15
- * lines 0-3 have been passed through the deblock / dering filters already, but can be read, too.
- * lines 4-12 will be read into the deblocking filter and should be deinterlaced
- * this filter will read lines 4-13 and write 4-11
- */
-static inline void RENAME(deInterlaceBlendLinear)(uint8_t src[], int stride, uint8_t *tmp)
-{
-#if HAVE_MMX2 || HAVE_AMD3DNOW
- src+= 4*stride;
- __asm__ volatile(
- "lea (%0, %1), %%"REG_a" \n\t"
- "lea (%%"REG_a", %1, 4), %%"REG_d" \n\t"
-// 0 1 2 3 4 5 6 7 8 9
-// %0 eax eax+%1 eax+2%1 %0+4%1 edx edx+%1 edx+2%1 %0+8%1 edx+4%1
-
- "movq (%2), %%mm0 \n\t" // L0
- "movq (%%"REG_a"), %%mm1 \n\t" // L2
- PAVGB(%%mm1, %%mm0) // L0+L2
- "movq (%0), %%mm2 \n\t" // L1
- PAVGB(%%mm2, %%mm0)
- "movq %%mm0, (%0) \n\t"
- "movq (%%"REG_a", %1), %%mm0 \n\t" // L3
- PAVGB(%%mm0, %%mm2) // L1+L3
- PAVGB(%%mm1, %%mm2) // 2L2 + L1 + L3
- "movq %%mm2, (%%"REG_a") \n\t"
- "movq (%%"REG_a", %1, 2), %%mm2 \n\t" // L4
- PAVGB(%%mm2, %%mm1) // L2+L4
- PAVGB(%%mm0, %%mm1) // 2L3 + L2 + L4
- "movq %%mm1, (%%"REG_a", %1) \n\t"
- "movq (%0, %1, 4), %%mm1 \n\t" // L5
- PAVGB(%%mm1, %%mm0) // L3+L5
- PAVGB(%%mm2, %%mm0) // 2L4 + L3 + L5
- "movq %%mm0, (%%"REG_a", %1, 2) \n\t"
- "movq (%%"REG_d"), %%mm0 \n\t" // L6
- PAVGB(%%mm0, %%mm2) // L4+L6
- PAVGB(%%mm1, %%mm2) // 2L5 + L4 + L6
- "movq %%mm2, (%0, %1, 4) \n\t"
- "movq (%%"REG_d", %1), %%mm2 \n\t" // L7
- PAVGB(%%mm2, %%mm1) // L5+L7
- PAVGB(%%mm0, %%mm1) // 2L6 + L5 + L7
- "movq %%mm1, (%%"REG_d") \n\t"
- "movq (%%"REG_d", %1, 2), %%mm1 \n\t" // L8
- PAVGB(%%mm1, %%mm0) // L6+L8
- PAVGB(%%mm2, %%mm0) // 2L7 + L6 + L8
- "movq %%mm0, (%%"REG_d", %1) \n\t"
- "movq (%0, %1, 8), %%mm0 \n\t" // L9
- PAVGB(%%mm0, %%mm2) // L7+L9
- PAVGB(%%mm1, %%mm2) // 2L8 + L7 + L9
- "movq %%mm2, (%%"REG_d", %1, 2) \n\t"
- "movq %%mm1, (%2) \n\t"
-
- : : "r" (src), "r" ((x86_reg)stride), "r" (tmp)
- : "%"REG_a, "%"REG_d
- );
-#else //HAVE_MMX2 || HAVE_AMD3DNOW
- int a, b, c, x;
- src+= 4*stride;
-
- for(x=0; x<2; x++){
- a= *(uint32_t*)&tmp[stride*0];
- b= *(uint32_t*)&src[stride*0];
- c= *(uint32_t*)&src[stride*1];
- a= (a&c) + (((a^c)&0xFEFEFEFEUL)>>1);
- *(uint32_t*)&src[stride*0]= (a|b) - (((a^b)&0xFEFEFEFEUL)>>1);
-
- a= *(uint32_t*)&src[stride*2];
- b= (a&b) + (((a^b)&0xFEFEFEFEUL)>>1);
- *(uint32_t*)&src[stride*1]= (c|b) - (((c^b)&0xFEFEFEFEUL)>>1);
-
- b= *(uint32_t*)&src[stride*3];
- c= (b&c) + (((b^c)&0xFEFEFEFEUL)>>1);
- *(uint32_t*)&src[stride*2]= (c|a) - (((c^a)&0xFEFEFEFEUL)>>1);
-
- c= *(uint32_t*)&src[stride*4];
- a= (a&c) + (((a^c)&0xFEFEFEFEUL)>>1);
- *(uint32_t*)&src[stride*3]= (a|b) - (((a^b)&0xFEFEFEFEUL)>>1);
-
- a= *(uint32_t*)&src[stride*5];
- b= (a&b) + (((a^b)&0xFEFEFEFEUL)>>1);
- *(uint32_t*)&src[stride*4]= (c|b) - (((c^b)&0xFEFEFEFEUL)>>1);
-
- b= *(uint32_t*)&src[stride*6];
- c= (b&c) + (((b^c)&0xFEFEFEFEUL)>>1);
- *(uint32_t*)&src[stride*5]= (c|a) - (((c^a)&0xFEFEFEFEUL)>>1);
-
- c= *(uint32_t*)&src[stride*7];
- a= (a&c) + (((a^c)&0xFEFEFEFEUL)>>1);
- *(uint32_t*)&src[stride*6]= (a|b) - (((a^b)&0xFEFEFEFEUL)>>1);
-
- a= *(uint32_t*)&src[stride*8];
- b= (a&b) + (((a^b)&0xFEFEFEFEUL)>>1);
- *(uint32_t*)&src[stride*7]= (c|b) - (((c^b)&0xFEFEFEFEUL)>>1);
-
- *(uint32_t*)&tmp[stride*0]= c;
- src += 4;
- tmp += 4;
- }
-#endif //HAVE_MMX2 || HAVE_AMD3DNOW
-}
-
-/**
- * Deinterlace the given block by applying a median filter to every second line.
- * will be called for every 8x8 block and can read & write from line 4-15,
- * lines 0-3 have been passed through the deblock / dering filters already, but can be read, too.
- * lines 4-12 will be read into the deblocking filter and should be deinterlaced
- */
-static inline void RENAME(deInterlaceMedian)(uint8_t src[], int stride)
-{
-#if HAVE_MMX
- src+= 4*stride;
-#if HAVE_MMX2
- __asm__ volatile(
- "lea (%0, %1), %%"REG_a" \n\t"
- "lea (%%"REG_a", %1, 4), %%"REG_d" \n\t"
-// 0 1 2 3 4 5 6 7 8 9
-// %0 eax eax+%1 eax+2%1 %0+4%1 edx edx+%1 edx+2%1 %0+8%1 edx+4%1
-
- "movq (%0), %%mm0 \n\t" //
- "movq (%%"REG_a", %1), %%mm2 \n\t" //
- "movq (%%"REG_a"), %%mm1 \n\t" //
- "movq %%mm0, %%mm3 \n\t"
- "pmaxub %%mm1, %%mm0 \n\t" //
- "pminub %%mm3, %%mm1 \n\t" //
- "pmaxub %%mm2, %%mm1 \n\t" //
- "pminub %%mm1, %%mm0 \n\t"
- "movq %%mm0, (%%"REG_a") \n\t"
-
- "movq (%0, %1, 4), %%mm0 \n\t" //
- "movq (%%"REG_a", %1, 2), %%mm1 \n\t" //
- "movq %%mm2, %%mm3 \n\t"
- "pmaxub %%mm1, %%mm2 \n\t" //
- "pminub %%mm3, %%mm1 \n\t" //
- "pmaxub %%mm0, %%mm1 \n\t" //
- "pminub %%mm1, %%mm2 \n\t"
- "movq %%mm2, (%%"REG_a", %1, 2) \n\t"
-
- "movq (%%"REG_d"), %%mm2 \n\t" //
- "movq (%%"REG_d", %1), %%mm1 \n\t" //
- "movq %%mm2, %%mm3 \n\t"
- "pmaxub %%mm0, %%mm2 \n\t" //
- "pminub %%mm3, %%mm0 \n\t" //
- "pmaxub %%mm1, %%mm0 \n\t" //
- "pminub %%mm0, %%mm2 \n\t"
- "movq %%mm2, (%%"REG_d") \n\t"
-
- "movq (%%"REG_d", %1, 2), %%mm2 \n\t" //
- "movq (%0, %1, 8), %%mm0 \n\t" //
- "movq %%mm2, %%mm3 \n\t"
- "pmaxub %%mm0, %%mm2 \n\t" //
- "pminub %%mm3, %%mm0 \n\t" //
- "pmaxub %%mm1, %%mm0 \n\t" //
- "pminub %%mm0, %%mm2 \n\t"
- "movq %%mm2, (%%"REG_d", %1, 2) \n\t"
-
-
- : : "r" (src), "r" ((x86_reg)stride)
- : "%"REG_a, "%"REG_d
- );
-
-#else // MMX without MMX2
- __asm__ volatile(
- "lea (%0, %1), %%"REG_a" \n\t"
- "lea (%%"REG_a", %1, 4), %%"REG_d" \n\t"
-// 0 1 2 3 4 5 6 7 8 9
-// %0 eax eax+%1 eax+2%1 %0+4%1 edx edx+%1 edx+2%1 %0+8%1 edx+4%1
- "pxor %%mm7, %%mm7 \n\t"
-
-#define REAL_MEDIAN(a,b,c)\
- "movq " #a ", %%mm0 \n\t"\
- "movq " #b ", %%mm2 \n\t"\
- "movq " #c ", %%mm1 \n\t"\
- "movq %%mm0, %%mm3 \n\t"\
- "movq %%mm1, %%mm4 \n\t"\
- "movq %%mm2, %%mm5 \n\t"\
- "psubusb %%mm1, %%mm3 \n\t"\
- "psubusb %%mm2, %%mm4 \n\t"\
- "psubusb %%mm0, %%mm5 \n\t"\
- "pcmpeqb %%mm7, %%mm3 \n\t"\
- "pcmpeqb %%mm7, %%mm4 \n\t"\
- "pcmpeqb %%mm7, %%mm5 \n\t"\
- "movq %%mm3, %%mm6 \n\t"\
- "pxor %%mm4, %%mm3 \n\t"\
- "pxor %%mm5, %%mm4 \n\t"\
- "pxor %%mm6, %%mm5 \n\t"\
- "por %%mm3, %%mm1 \n\t"\
- "por %%mm4, %%mm2 \n\t"\
- "por %%mm5, %%mm0 \n\t"\
- "pand %%mm2, %%mm0 \n\t"\
- "pand %%mm1, %%mm0 \n\t"\
- "movq %%mm0, " #b " \n\t"
-#define MEDIAN(a,b,c) REAL_MEDIAN(a,b,c)
-
-MEDIAN((%0) , (%%REGa) , (%%REGa, %1))
-MEDIAN((%%REGa, %1), (%%REGa, %1, 2), (%0, %1, 4))
-MEDIAN((%0, %1, 4) , (%%REGd) , (%%REGd, %1))
-MEDIAN((%%REGd, %1), (%%REGd, %1, 2), (%0, %1, 8))
-
- : : "r" (src), "r" ((x86_reg)stride)
- : "%"REG_a, "%"REG_d
- );
-#endif //HAVE_MMX2
-#else //HAVE_MMX
- int x, y;
- src+= 4*stride;
- // FIXME - there should be a way to do a few columns in parallel like w/mmx
- for(x=0; x<8; x++){
- uint8_t *colsrc = src;
- for (y=0; y<4; y++){
- int a, b, c, d, e, f;
- a = colsrc[0 ];
- b = colsrc[stride ];
- c = colsrc[stride*2];
- d = (a-b)>>31;
- e = (b-c)>>31;
- f = (c-a)>>31;
- colsrc[stride ] = (a|(d^f)) & (b|(d^e)) & (c|(e^f));
- colsrc += stride*2;
- }
- src++;
- }
-#endif //HAVE_MMX
-}
-
-#if HAVE_MMX
-/**
- * Transpose and shift the given 8x8 Block into dst1 and dst2.
- */
-static inline void RENAME(transpose1)(uint8_t *dst1, uint8_t *dst2, uint8_t *src, int srcStride)
-{
- __asm__(
- "lea (%0, %1), %%"REG_a" \n\t"
-// 0 1 2 3 4 5 6 7 8 9
-// %0 eax eax+%1 eax+2%1 %0+4%1 edx edx+%1 edx+2%1 %0+8%1 edx+4%1
- "movq (%0), %%mm0 \n\t" // 12345678
- "movq (%%"REG_a"), %%mm1 \n\t" // abcdefgh
- "movq %%mm0, %%mm2 \n\t" // 12345678
- "punpcklbw %%mm1, %%mm0 \n\t" // 1a2b3c4d
- "punpckhbw %%mm1, %%mm2 \n\t" // 5e6f7g8h
-
- "movq (%%"REG_a", %1), %%mm1 \n\t"
- "movq (%%"REG_a", %1, 2), %%mm3 \n\t"
- "movq %%mm1, %%mm4 \n\t"
- "punpcklbw %%mm3, %%mm1 \n\t"
- "punpckhbw %%mm3, %%mm4 \n\t"
-
- "movq %%mm0, %%mm3 \n\t"
- "punpcklwd %%mm1, %%mm0 \n\t"
- "punpckhwd %%mm1, %%mm3 \n\t"
- "movq %%mm2, %%mm1 \n\t"
- "punpcklwd %%mm4, %%mm2 \n\t"
- "punpckhwd %%mm4, %%mm1 \n\t"
-
- "movd %%mm0, 128(%2) \n\t"
- "psrlq $32, %%mm0 \n\t"
- "movd %%mm0, 144(%2) \n\t"
- "movd %%mm3, 160(%2) \n\t"
- "psrlq $32, %%mm3 \n\t"
- "movd %%mm3, 176(%2) \n\t"
- "movd %%mm3, 48(%3) \n\t"
- "movd %%mm2, 192(%2) \n\t"
- "movd %%mm2, 64(%3) \n\t"
- "psrlq $32, %%mm2 \n\t"
- "movd %%mm2, 80(%3) \n\t"
- "movd %%mm1, 96(%3) \n\t"
- "psrlq $32, %%mm1 \n\t"
- "movd %%mm1, 112(%3) \n\t"
-
- "lea (%%"REG_a", %1, 4), %%"REG_a" \n\t"
-
- "movq (%0, %1, 4), %%mm0 \n\t" // 12345678
- "movq (%%"REG_a"), %%mm1 \n\t" // abcdefgh
- "movq %%mm0, %%mm2 \n\t" // 12345678
- "punpcklbw %%mm1, %%mm0 \n\t" // 1a2b3c4d
- "punpckhbw %%mm1, %%mm2 \n\t" // 5e6f7g8h
-
- "movq (%%"REG_a", %1), %%mm1 \n\t"
- "movq (%%"REG_a", %1, 2), %%mm3 \n\t"
- "movq %%mm1, %%mm4 \n\t"
- "punpcklbw %%mm3, %%mm1 \n\t"
- "punpckhbw %%mm3, %%mm4 \n\t"
-
- "movq %%mm0, %%mm3 \n\t"
- "punpcklwd %%mm1, %%mm0 \n\t"
- "punpckhwd %%mm1, %%mm3 \n\t"
- "movq %%mm2, %%mm1 \n\t"
- "punpcklwd %%mm4, %%mm2 \n\t"
- "punpckhwd %%mm4, %%mm1 \n\t"
-
- "movd %%mm0, 132(%2) \n\t"
- "psrlq $32, %%mm0 \n\t"
- "movd %%mm0, 148(%2) \n\t"
- "movd %%mm3, 164(%2) \n\t"
- "psrlq $32, %%mm3 \n\t"
- "movd %%mm3, 180(%2) \n\t"
- "movd %%mm3, 52(%3) \n\t"
- "movd %%mm2, 196(%2) \n\t"
- "movd %%mm2, 68(%3) \n\t"
- "psrlq $32, %%mm2 \n\t"
- "movd %%mm2, 84(%3) \n\t"
- "movd %%mm1, 100(%3) \n\t"
- "psrlq $32, %%mm1 \n\t"
- "movd %%mm1, 116(%3) \n\t"
-
-
- :: "r" (src), "r" ((x86_reg)srcStride), "r" (dst1), "r" (dst2)
- : "%"REG_a
- );
-}
-
-/**
- * Transpose the given 8x8 block.
- */
-static inline void RENAME(transpose2)(uint8_t *dst, int dstStride, uint8_t *src)
-{
- __asm__(
- "lea (%0, %1), %%"REG_a" \n\t"
- "lea (%%"REG_a",%1,4), %%"REG_d" \n\t"
-// 0 1 2 3 4 5 6 7 8 9
-// %0 eax eax+%1 eax+2%1 %0+4%1 edx edx+%1 edx+2%1 %0+8%1 edx+4%1
- "movq (%2), %%mm0 \n\t" // 12345678
- "movq 16(%2), %%mm1 \n\t" // abcdefgh
- "movq %%mm0, %%mm2 \n\t" // 12345678
- "punpcklbw %%mm1, %%mm0 \n\t" // 1a2b3c4d
- "punpckhbw %%mm1, %%mm2 \n\t" // 5e6f7g8h
-
- "movq 32(%2), %%mm1 \n\t"
- "movq 48(%2), %%mm3 \n\t"
- "movq %%mm1, %%mm4 \n\t"
- "punpcklbw %%mm3, %%mm1 \n\t"
- "punpckhbw %%mm3, %%mm4 \n\t"
-
- "movq %%mm0, %%mm3 \n\t"
- "punpcklwd %%mm1, %%mm0 \n\t"
- "punpckhwd %%mm1, %%mm3 \n\t"
- "movq %%mm2, %%mm1 \n\t"
- "punpcklwd %%mm4, %%mm2 \n\t"
- "punpckhwd %%mm4, %%mm1 \n\t"
-
- "movd %%mm0, (%0) \n\t"
- "psrlq $32, %%mm0 \n\t"
- "movd %%mm0, (%%"REG_a") \n\t"
- "movd %%mm3, (%%"REG_a", %1) \n\t"
- "psrlq $32, %%mm3 \n\t"
- "movd %%mm3, (%%"REG_a", %1, 2) \n\t"
- "movd %%mm2, (%0, %1, 4) \n\t"
- "psrlq $32, %%mm2 \n\t"
- "movd %%mm2, (%%"REG_d") \n\t"
- "movd %%mm1, (%%"REG_d", %1) \n\t"
- "psrlq $32, %%mm1 \n\t"
- "movd %%mm1, (%%"REG_d", %1, 2) \n\t"
-
-
- "movq 64(%2), %%mm0 \n\t" // 12345678
- "movq 80(%2), %%mm1 \n\t" // abcdefgh
- "movq %%mm0, %%mm2 \n\t" // 12345678
- "punpcklbw %%mm1, %%mm0 \n\t" // 1a2b3c4d
- "punpckhbw %%mm1, %%mm2 \n\t" // 5e6f7g8h
-
- "movq 96(%2), %%mm1 \n\t"
- "movq 112(%2), %%mm3 \n\t"
- "movq %%mm1, %%mm4 \n\t"
- "punpcklbw %%mm3, %%mm1 \n\t"
- "punpckhbw %%mm3, %%mm4 \n\t"
-
- "movq %%mm0, %%mm3 \n\t"
- "punpcklwd %%mm1, %%mm0 \n\t"
- "punpckhwd %%mm1, %%mm3 \n\t"
- "movq %%mm2, %%mm1 \n\t"
- "punpcklwd %%mm4, %%mm2 \n\t"
- "punpckhwd %%mm4, %%mm1 \n\t"
-
- "movd %%mm0, 4(%0) \n\t"
- "psrlq $32, %%mm0 \n\t"
- "movd %%mm0, 4(%%"REG_a") \n\t"
- "movd %%mm3, 4(%%"REG_a", %1) \n\t"
- "psrlq $32, %%mm3 \n\t"
- "movd %%mm3, 4(%%"REG_a", %1, 2) \n\t"
- "movd %%mm2, 4(%0, %1, 4) \n\t"
- "psrlq $32, %%mm2 \n\t"
- "movd %%mm2, 4(%%"REG_d") \n\t"
- "movd %%mm1, 4(%%"REG_d", %1) \n\t"
- "psrlq $32, %%mm1 \n\t"
- "movd %%mm1, 4(%%"REG_d", %1, 2) \n\t"
-
- :: "r" (dst), "r" ((x86_reg)dstStride), "r" (src)
- : "%"REG_a, "%"REG_d
- );
-}
-#endif //HAVE_MMX
-//static long test=0;
-
-#if !HAVE_ALTIVEC
-static inline void RENAME(tempNoiseReducer)(uint8_t *src, int stride,
- uint8_t *tempBlurred, uint32_t *tempBlurredPast, int *maxNoise)
-{
- // to save a register (FIXME do this outside of the loops)
- tempBlurredPast[127]= maxNoise[0];
- tempBlurredPast[128]= maxNoise[1];
- tempBlurredPast[129]= maxNoise[2];
-
-#define FAST_L2_DIFF
-//#define L1_DIFF //u should change the thresholds too if u try that one
-#if HAVE_MMX2 || HAVE_AMD3DNOW
- __asm__ volatile(
- "lea (%2, %2, 2), %%"REG_a" \n\t" // 3*stride
- "lea (%2, %2, 4), %%"REG_d" \n\t" // 5*stride
- "lea (%%"REG_d", %2, 2), %%"REG_c" \n\t" // 7*stride
-// 0 1 2 3 4 5 6 7 8 9
-// %x %x+%2 %x+2%2 %x+eax %x+4%2 %x+edx %x+2eax %x+ecx %x+8%2
-//FIXME reorder?
-#ifdef L1_DIFF //needs mmx2
- "movq (%0), %%mm0 \n\t" // L0
- "psadbw (%1), %%mm0 \n\t" // |L0-R0|
- "movq (%0, %2), %%mm1 \n\t" // L1
- "psadbw (%1, %2), %%mm1 \n\t" // |L1-R1|
- "movq (%0, %2, 2), %%mm2 \n\t" // L2
- "psadbw (%1, %2, 2), %%mm2 \n\t" // |L2-R2|
- "movq (%0, %%"REG_a"), %%mm3 \n\t" // L3
- "psadbw (%1, %%"REG_a"), %%mm3 \n\t" // |L3-R3|
-
- "movq (%0, %2, 4), %%mm4 \n\t" // L4
- "paddw %%mm1, %%mm0 \n\t"
- "psadbw (%1, %2, 4), %%mm4 \n\t" // |L4-R4|
- "movq (%0, %%"REG_d"), %%mm5 \n\t" // L5
- "paddw %%mm2, %%mm0 \n\t"
- "psadbw (%1, %%"REG_d"), %%mm5 \n\t" // |L5-R5|
- "movq (%0, %%"REG_a", 2), %%mm6 \n\t" // L6
- "paddw %%mm3, %%mm0 \n\t"
- "psadbw (%1, %%"REG_a", 2), %%mm6 \n\t" // |L6-R6|
- "movq (%0, %%"REG_c"), %%mm7 \n\t" // L7
- "paddw %%mm4, %%mm0 \n\t"
- "psadbw (%1, %%"REG_c"), %%mm7 \n\t" // |L7-R7|
- "paddw %%mm5, %%mm6 \n\t"
- "paddw %%mm7, %%mm6 \n\t"
- "paddw %%mm6, %%mm0 \n\t"
-#else //L1_DIFF
-#if defined (FAST_L2_DIFF)
- "pcmpeqb %%mm7, %%mm7 \n\t"
- "movq "MANGLE(b80)", %%mm6 \n\t"
- "pxor %%mm0, %%mm0 \n\t"
-#define REAL_L2_DIFF_CORE(a, b)\
- "movq " #a ", %%mm5 \n\t"\
- "movq " #b ", %%mm2 \n\t"\
- "pxor %%mm7, %%mm2 \n\t"\
- PAVGB(%%mm2, %%mm5)\
- "paddb %%mm6, %%mm5 \n\t"\
- "movq %%mm5, %%mm2 \n\t"\
- "psllw $8, %%mm5 \n\t"\
- "pmaddwd %%mm5, %%mm5 \n\t"\
- "pmaddwd %%mm2, %%mm2 \n\t"\
- "paddd %%mm2, %%mm5 \n\t"\
- "psrld $14, %%mm5 \n\t"\
- "paddd %%mm5, %%mm0 \n\t"
-
-#else //defined (FAST_L2_DIFF)
- "pxor %%mm7, %%mm7 \n\t"
- "pxor %%mm0, %%mm0 \n\t"
-#define REAL_L2_DIFF_CORE(a, b)\
- "movq " #a ", %%mm5 \n\t"\
- "movq " #b ", %%mm2 \n\t"\
- "movq %%mm5, %%mm1 \n\t"\
- "movq %%mm2, %%mm3 \n\t"\
- "punpcklbw %%mm7, %%mm5 \n\t"\
- "punpckhbw %%mm7, %%mm1 \n\t"\
- "punpcklbw %%mm7, %%mm2 \n\t"\
- "punpckhbw %%mm7, %%mm3 \n\t"\
- "psubw %%mm2, %%mm5 \n\t"\
- "psubw %%mm3, %%mm1 \n\t"\
- "pmaddwd %%mm5, %%mm5 \n\t"\
- "pmaddwd %%mm1, %%mm1 \n\t"\
- "paddd %%mm1, %%mm5 \n\t"\
- "paddd %%mm5, %%mm0 \n\t"
-
-#endif //defined (FAST_L2_DIFF)
-
-#define L2_DIFF_CORE(a, b) REAL_L2_DIFF_CORE(a, b)
-
-L2_DIFF_CORE((%0) , (%1))
-L2_DIFF_CORE((%0, %2) , (%1, %2))
-L2_DIFF_CORE((%0, %2, 2) , (%1, %2, 2))
-L2_DIFF_CORE((%0, %%REGa) , (%1, %%REGa))
-L2_DIFF_CORE((%0, %2, 4) , (%1, %2, 4))
-L2_DIFF_CORE((%0, %%REGd) , (%1, %%REGd))
-L2_DIFF_CORE((%0, %%REGa,2), (%1, %%REGa,2))
-L2_DIFF_CORE((%0, %%REGc) , (%1, %%REGc))
-
-#endif //L1_DIFF
-
- "movq %%mm0, %%mm4 \n\t"
- "psrlq $32, %%mm0 \n\t"
- "paddd %%mm0, %%mm4 \n\t"
- "movd %%mm4, %%ecx \n\t"
- "shll $2, %%ecx \n\t"
- "mov %3, %%"REG_d" \n\t"
- "addl -4(%%"REG_d"), %%ecx \n\t"
- "addl 4(%%"REG_d"), %%ecx \n\t"
- "addl -1024(%%"REG_d"), %%ecx \n\t"
- "addl $4, %%ecx \n\t"
- "addl 1024(%%"REG_d"), %%ecx \n\t"
- "shrl $3, %%ecx \n\t"
- "movl %%ecx, (%%"REG_d") \n\t"
-
-// "mov %3, %%"REG_c" \n\t"
-// "mov %%"REG_c", test \n\t"
-// "jmp 4f \n\t"
- "cmpl 512(%%"REG_d"), %%ecx \n\t"
- " jb 2f \n\t"
- "cmpl 516(%%"REG_d"), %%ecx \n\t"
- " jb 1f \n\t"
-
- "lea (%%"REG_a", %2, 2), %%"REG_d" \n\t" // 5*stride
- "lea (%%"REG_d", %2, 2), %%"REG_c" \n\t" // 7*stride
- "movq (%0), %%mm0 \n\t" // L0
- "movq (%0, %2), %%mm1 \n\t" // L1
- "movq (%0, %2, 2), %%mm2 \n\t" // L2
- "movq (%0, %%"REG_a"), %%mm3 \n\t" // L3
- "movq (%0, %2, 4), %%mm4 \n\t" // L4
- "movq (%0, %%"REG_d"), %%mm5 \n\t" // L5
- "movq (%0, %%"REG_a", 2), %%mm6 \n\t" // L6
- "movq (%0, %%"REG_c"), %%mm7 \n\t" // L7
- "movq %%mm0, (%1) \n\t" // L0
- "movq %%mm1, (%1, %2) \n\t" // L1
- "movq %%mm2, (%1, %2, 2) \n\t" // L2
- "movq %%mm3, (%1, %%"REG_a") \n\t" // L3
- "movq %%mm4, (%1, %2, 4) \n\t" // L4
- "movq %%mm5, (%1, %%"REG_d") \n\t" // L5
- "movq %%mm6, (%1, %%"REG_a", 2) \n\t" // L6
- "movq %%mm7, (%1, %%"REG_c") \n\t" // L7
- "jmp 4f \n\t"
-
- "1: \n\t"
- "lea (%%"REG_a", %2, 2), %%"REG_d" \n\t" // 5*stride
- "lea (%%"REG_d", %2, 2), %%"REG_c" \n\t" // 7*stride
- "movq (%0), %%mm0 \n\t" // L0
- PAVGB((%1), %%mm0) // L0
- "movq (%0, %2), %%mm1 \n\t" // L1
- PAVGB((%1, %2), %%mm1) // L1
- "movq (%0, %2, 2), %%mm2 \n\t" // L2
- PAVGB((%1, %2, 2), %%mm2) // L2
- "movq (%0, %%"REG_a"), %%mm3 \n\t" // L3
- PAVGB((%1, %%REGa), %%mm3) // L3
- "movq (%0, %2, 4), %%mm4 \n\t" // L4
- PAVGB((%1, %2, 4), %%mm4) // L4
- "movq (%0, %%"REG_d"), %%mm5 \n\t" // L5
- PAVGB((%1, %%REGd), %%mm5) // L5
- "movq (%0, %%"REG_a", 2), %%mm6 \n\t" // L6
- PAVGB((%1, %%REGa, 2), %%mm6) // L6
- "movq (%0, %%"REG_c"), %%mm7 \n\t" // L7
- PAVGB((%1, %%REGc), %%mm7) // L7
- "movq %%mm0, (%1) \n\t" // R0
- "movq %%mm1, (%1, %2) \n\t" // R1
- "movq %%mm2, (%1, %2, 2) \n\t" // R2
- "movq %%mm3, (%1, %%"REG_a") \n\t" // R3
- "movq %%mm4, (%1, %2, 4) \n\t" // R4
- "movq %%mm5, (%1, %%"REG_d") \n\t" // R5
- "movq %%mm6, (%1, %%"REG_a", 2) \n\t" // R6
- "movq %%mm7, (%1, %%"REG_c") \n\t" // R7
- "movq %%mm0, (%0) \n\t" // L0
- "movq %%mm1, (%0, %2) \n\t" // L1
- "movq %%mm2, (%0, %2, 2) \n\t" // L2
- "movq %%mm3, (%0, %%"REG_a") \n\t" // L3
- "movq %%mm4, (%0, %2, 4) \n\t" // L4
- "movq %%mm5, (%0, %%"REG_d") \n\t" // L5
- "movq %%mm6, (%0, %%"REG_a", 2) \n\t" // L6
- "movq %%mm7, (%0, %%"REG_c") \n\t" // L7
- "jmp 4f \n\t"
-
- "2: \n\t"
- "cmpl 508(%%"REG_d"), %%ecx \n\t"
- " jb 3f \n\t"
-
- "lea (%%"REG_a", %2, 2), %%"REG_d" \n\t" // 5*stride
- "lea (%%"REG_d", %2, 2), %%"REG_c" \n\t" // 7*stride
- "movq (%0), %%mm0 \n\t" // L0
- "movq (%0, %2), %%mm1 \n\t" // L1
- "movq (%0, %2, 2), %%mm2 \n\t" // L2
- "movq (%0, %%"REG_a"), %%mm3 \n\t" // L3
- "movq (%1), %%mm4 \n\t" // R0
- "movq (%1, %2), %%mm5 \n\t" // R1
- "movq (%1, %2, 2), %%mm6 \n\t" // R2
- "movq (%1, %%"REG_a"), %%mm7 \n\t" // R3
- PAVGB(%%mm4, %%mm0)
- PAVGB(%%mm5, %%mm1)
- PAVGB(%%mm6, %%mm2)
- PAVGB(%%mm7, %%mm3)
- PAVGB(%%mm4, %%mm0)
- PAVGB(%%mm5, %%mm1)
- PAVGB(%%mm6, %%mm2)
- PAVGB(%%mm7, %%mm3)
- "movq %%mm0, (%1) \n\t" // R0
- "movq %%mm1, (%1, %2) \n\t" // R1
- "movq %%mm2, (%1, %2, 2) \n\t" // R2
- "movq %%mm3, (%1, %%"REG_a") \n\t" // R3
- "movq %%mm0, (%0) \n\t" // L0
- "movq %%mm1, (%0, %2) \n\t" // L1
- "movq %%mm2, (%0, %2, 2) \n\t" // L2
- "movq %%mm3, (%0, %%"REG_a") \n\t" // L3
-
- "movq (%0, %2, 4), %%mm0 \n\t" // L4
- "movq (%0, %%"REG_d"), %%mm1 \n\t" // L5
- "movq (%0, %%"REG_a", 2), %%mm2 \n\t" // L6
- "movq (%0, %%"REG_c"), %%mm3 \n\t" // L7
- "movq (%1, %2, 4), %%mm4 \n\t" // R4
- "movq (%1, %%"REG_d"), %%mm5 \n\t" // R5
- "movq (%1, %%"REG_a", 2), %%mm6 \n\t" // R6
- "movq (%1, %%"REG_c"), %%mm7 \n\t" // R7
- PAVGB(%%mm4, %%mm0)
- PAVGB(%%mm5, %%mm1)
- PAVGB(%%mm6, %%mm2)
- PAVGB(%%mm7, %%mm3)
- PAVGB(%%mm4, %%mm0)
- PAVGB(%%mm5, %%mm1)
- PAVGB(%%mm6, %%mm2)
- PAVGB(%%mm7, %%mm3)
- "movq %%mm0, (%1, %2, 4) \n\t" // R4
- "movq %%mm1, (%1, %%"REG_d") \n\t" // R5
- "movq %%mm2, (%1, %%"REG_a", 2) \n\t" // R6
- "movq %%mm3, (%1, %%"REG_c") \n\t" // R7
- "movq %%mm0, (%0, %2, 4) \n\t" // L4
- "movq %%mm1, (%0, %%"REG_d") \n\t" // L5
- "movq %%mm2, (%0, %%"REG_a", 2) \n\t" // L6
- "movq %%mm3, (%0, %%"REG_c") \n\t" // L7
- "jmp 4f \n\t"
-
- "3: \n\t"
- "lea (%%"REG_a", %2, 2), %%"REG_d" \n\t" // 5*stride
- "lea (%%"REG_d", %2, 2), %%"REG_c" \n\t" // 7*stride
- "movq (%0), %%mm0 \n\t" // L0
- "movq (%0, %2), %%mm1 \n\t" // L1
- "movq (%0, %2, 2), %%mm2 \n\t" // L2
- "movq (%0, %%"REG_a"), %%mm3 \n\t" // L3
- "movq (%1), %%mm4 \n\t" // R0
- "movq (%1, %2), %%mm5 \n\t" // R1
- "movq (%1, %2, 2), %%mm6 \n\t" // R2
- "movq (%1, %%"REG_a"), %%mm7 \n\t" // R3
- PAVGB(%%mm4, %%mm0)
- PAVGB(%%mm5, %%mm1)
- PAVGB(%%mm6, %%mm2)
- PAVGB(%%mm7, %%mm3)
- PAVGB(%%mm4, %%mm0)
- PAVGB(%%mm5, %%mm1)
- PAVGB(%%mm6, %%mm2)
- PAVGB(%%mm7, %%mm3)
- PAVGB(%%mm4, %%mm0)
- PAVGB(%%mm5, %%mm1)
- PAVGB(%%mm6, %%mm2)
- PAVGB(%%mm7, %%mm3)
- "movq %%mm0, (%1) \n\t" // R0
- "movq %%mm1, (%1, %2) \n\t" // R1
- "movq %%mm2, (%1, %2, 2) \n\t" // R2
- "movq %%mm3, (%1, %%"REG_a") \n\t" // R3
- "movq %%mm0, (%0) \n\t" // L0
- "movq %%mm1, (%0, %2) \n\t" // L1
- "movq %%mm2, (%0, %2, 2) \n\t" // L2
- "movq %%mm3, (%0, %%"REG_a") \n\t" // L3
-
- "movq (%0, %2, 4), %%mm0 \n\t" // L4
- "movq (%0, %%"REG_d"), %%mm1 \n\t" // L5
- "movq (%0, %%"REG_a", 2), %%mm2 \n\t" // L6
- "movq (%0, %%"REG_c"), %%mm3 \n\t" // L7
- "movq (%1, %2, 4), %%mm4 \n\t" // R4
- "movq (%1, %%"REG_d"), %%mm5 \n\t" // R5
- "movq (%1, %%"REG_a", 2), %%mm6 \n\t" // R6
- "movq (%1, %%"REG_c"), %%mm7 \n\t" // R7
- PAVGB(%%mm4, %%mm0)
- PAVGB(%%mm5, %%mm1)
- PAVGB(%%mm6, %%mm2)
- PAVGB(%%mm7, %%mm3)
- PAVGB(%%mm4, %%mm0)
- PAVGB(%%mm5, %%mm1)
- PAVGB(%%mm6, %%mm2)
- PAVGB(%%mm7, %%mm3)
- PAVGB(%%mm4, %%mm0)
- PAVGB(%%mm5, %%mm1)
- PAVGB(%%mm6, %%mm2)
- PAVGB(%%mm7, %%mm3)
- "movq %%mm0, (%1, %2, 4) \n\t" // R4
- "movq %%mm1, (%1, %%"REG_d") \n\t" // R5
- "movq %%mm2, (%1, %%"REG_a", 2) \n\t" // R6
- "movq %%mm3, (%1, %%"REG_c") \n\t" // R7
- "movq %%mm0, (%0, %2, 4) \n\t" // L4
- "movq %%mm1, (%0, %%"REG_d") \n\t" // L5
- "movq %%mm2, (%0, %%"REG_a", 2) \n\t" // L6
- "movq %%mm3, (%0, %%"REG_c") \n\t" // L7
-
- "4: \n\t"
-
- :: "r" (src), "r" (tempBlurred), "r"((x86_reg)stride), "m" (tempBlurredPast)
- : "%"REG_a, "%"REG_d, "%"REG_c, "memory"
- );
-#else //HAVE_MMX2 || HAVE_AMD3DNOW
-{
- int y;
- int d=0;
-// int sysd=0;
- int i;
-
- for(y=0; y<8; y++){
- int x;
- for(x=0; x<8; x++){
- int ref= tempBlurred[ x + y*stride ];
- int cur= src[ x + y*stride ];
- int d1=ref - cur;
-// if(x==0 || x==7) d1+= d1>>1;
-// if(y==0 || y==7) d1+= d1>>1;
-// d+= FFABS(d1);
- d+= d1*d1;
-// sysd+= d1;
- }
- }
- i=d;
- d= (
- 4*d
- +(*(tempBlurredPast-256))
- +(*(tempBlurredPast-1))+ (*(tempBlurredPast+1))
- +(*(tempBlurredPast+256))
- +4)>>3;
- *tempBlurredPast=i;
-// ((*tempBlurredPast)*3 + d + 2)>>2;
-
-/*
-Switch between
- 1 0 0 0 0 0 0 (0)
-64 32 16 8 4 2 1 (1)
-64 48 36 27 20 15 11 (33) (approx)
-64 56 49 43 37 33 29 (200) (approx)
-*/
- if(d > maxNoise[1]){
- if(d < maxNoise[2]){
- for(y=0; y<8; y++){
- int x;
- for(x=0; x<8; x++){
- int ref= tempBlurred[ x + y*stride ];
- int cur= src[ x + y*stride ];
- tempBlurred[ x + y*stride ]=
- src[ x + y*stride ]=
- (ref + cur + 1)>>1;
- }
- }
- }else{
- for(y=0; y<8; y++){
- int x;
- for(x=0; x<8; x++){
- tempBlurred[ x + y*stride ]= src[ x + y*stride ];
- }
- }
- }
- }else{
- if(d < maxNoise[0]){
- for(y=0; y<8; y++){
- int x;
- for(x=0; x<8; x++){
- int ref= tempBlurred[ x + y*stride ];
- int cur= src[ x + y*stride ];
- tempBlurred[ x + y*stride ]=
- src[ x + y*stride ]=
- (ref*7 + cur + 4)>>3;
- }
- }
- }else{
- for(y=0; y<8; y++){
- int x;
- for(x=0; x<8; x++){
- int ref= tempBlurred[ x + y*stride ];
- int cur= src[ x + y*stride ];
- tempBlurred[ x + y*stride ]=
- src[ x + y*stride ]=
- (ref*3 + cur + 2)>>2;
- }
- }
- }
- }
-}
-#endif //HAVE_MMX2 || HAVE_AMD3DNOW
-}
-#endif //HAVE_ALTIVEC
-
-#if HAVE_MMX
-/**
- * accurate deblock filter
- */
-static av_always_inline void RENAME(do_a_deblock)(uint8_t *src, int step, int stride, PPContext *c){
- int64_t dc_mask, eq_mask, both_masks;
- int64_t sums[10*8*2];
- src+= step*3; // src points to begin of the 8x8 Block
- //{ START_TIMER
- __asm__ volatile(
- "movq %0, %%mm7 \n\t"
- "movq %1, %%mm6 \n\t"
- : : "m" (c->mmxDcOffset[c->nonBQP]), "m" (c->mmxDcThreshold[c->nonBQP])
- );
-
- __asm__ volatile(
- "lea (%2, %3), %%"REG_a" \n\t"
-// 0 1 2 3 4 5 6 7 8 9
-// %1 eax eax+%2 eax+2%2 %1+4%2 ecx ecx+%2 ecx+2%2 %1+8%2 ecx+4%2
-
- "movq (%2), %%mm0 \n\t"
- "movq (%%"REG_a"), %%mm1 \n\t"
- "movq %%mm1, %%mm3 \n\t"
- "movq %%mm1, %%mm4 \n\t"
- "psubb %%mm1, %%mm0 \n\t" // mm0 = differnece
- "paddb %%mm7, %%mm0 \n\t"
- "pcmpgtb %%mm6, %%mm0 \n\t"
-
- "movq (%%"REG_a",%3), %%mm2 \n\t"
- PMAXUB(%%mm2, %%mm4)
- PMINUB(%%mm2, %%mm3, %%mm5)
- "psubb %%mm2, %%mm1 \n\t"
- "paddb %%mm7, %%mm1 \n\t"
- "pcmpgtb %%mm6, %%mm1 \n\t"
- "paddb %%mm1, %%mm0 \n\t"
-
- "movq (%%"REG_a", %3, 2), %%mm1 \n\t"
- PMAXUB(%%mm1, %%mm4)
- PMINUB(%%mm1, %%mm3, %%mm5)
- "psubb %%mm1, %%mm2 \n\t"
- "paddb %%mm7, %%mm2 \n\t"
- "pcmpgtb %%mm6, %%mm2 \n\t"
- "paddb %%mm2, %%mm0 \n\t"
-
- "lea (%%"REG_a", %3, 4), %%"REG_a" \n\t"
-
- "movq (%2, %3, 4), %%mm2 \n\t"
- PMAXUB(%%mm2, %%mm4)
- PMINUB(%%mm2, %%mm3, %%mm5)
- "psubb %%mm2, %%mm1 \n\t"
- "paddb %%mm7, %%mm1 \n\t"
- "pcmpgtb %%mm6, %%mm1 \n\t"
- "paddb %%mm1, %%mm0 \n\t"
-
- "movq (%%"REG_a"), %%mm1 \n\t"
- PMAXUB(%%mm1, %%mm4)
- PMINUB(%%mm1, %%mm3, %%mm5)
- "psubb %%mm1, %%mm2 \n\t"
- "paddb %%mm7, %%mm2 \n\t"
- "pcmpgtb %%mm6, %%mm2 \n\t"
- "paddb %%mm2, %%mm0 \n\t"
-
- "movq (%%"REG_a", %3), %%mm2 \n\t"
- PMAXUB(%%mm2, %%mm4)
- PMINUB(%%mm2, %%mm3, %%mm5)
- "psubb %%mm2, %%mm1 \n\t"
- "paddb %%mm7, %%mm1 \n\t"
- "pcmpgtb %%mm6, %%mm1 \n\t"
- "paddb %%mm1, %%mm0 \n\t"
-
- "movq (%%"REG_a", %3, 2), %%mm1 \n\t"
- PMAXUB(%%mm1, %%mm4)
- PMINUB(%%mm1, %%mm3, %%mm5)
- "psubb %%mm1, %%mm2 \n\t"
- "paddb %%mm7, %%mm2 \n\t"
- "pcmpgtb %%mm6, %%mm2 \n\t"
- "paddb %%mm2, %%mm0 \n\t"
-
- "movq (%2, %3, 8), %%mm2 \n\t"
- PMAXUB(%%mm2, %%mm4)
- PMINUB(%%mm2, %%mm3, %%mm5)
- "psubb %%mm2, %%mm1 \n\t"
- "paddb %%mm7, %%mm1 \n\t"
- "pcmpgtb %%mm6, %%mm1 \n\t"
- "paddb %%mm1, %%mm0 \n\t"
-
- "movq (%%"REG_a", %3, 4), %%mm1 \n\t"
- "psubb %%mm1, %%mm2 \n\t"
- "paddb %%mm7, %%mm2 \n\t"
- "pcmpgtb %%mm6, %%mm2 \n\t"
- "paddb %%mm2, %%mm0 \n\t"
- "psubusb %%mm3, %%mm4 \n\t"
-
- "pxor %%mm6, %%mm6 \n\t"
- "movq %4, %%mm7 \n\t" // QP,..., QP
- "paddusb %%mm7, %%mm7 \n\t" // 2QP ... 2QP
- "psubusb %%mm4, %%mm7 \n\t" // Diff >=2QP -> 0
- "pcmpeqb %%mm6, %%mm7 \n\t" // Diff < 2QP -> 0
- "pcmpeqb %%mm6, %%mm7 \n\t" // Diff < 2QP -> 0
- "movq %%mm7, %1 \n\t"
-
- "movq %5, %%mm7 \n\t"
- "punpcklbw %%mm7, %%mm7 \n\t"
- "punpcklbw %%mm7, %%mm7 \n\t"
- "punpcklbw %%mm7, %%mm7 \n\t"
- "psubb %%mm0, %%mm6 \n\t"
- "pcmpgtb %%mm7, %%mm6 \n\t"
- "movq %%mm6, %0 \n\t"
-
- : "=m" (eq_mask), "=m" (dc_mask)
- : "r" (src), "r" ((x86_reg)step), "m" (c->pQPb), "m"(c->ppMode.flatnessThreshold)
- : "%"REG_a
- );
-
- both_masks = dc_mask & eq_mask;
-
- if(both_masks){
- x86_reg offset= -8*step;
- int64_t *temp_sums= sums;
-
- __asm__ volatile(
- "movq %2, %%mm0 \n\t" // QP,..., QP
- "pxor %%mm4, %%mm4 \n\t"
-
- "movq (%0), %%mm6 \n\t"
- "movq (%0, %1), %%mm5 \n\t"
- "movq %%mm5, %%mm1 \n\t"
- "movq %%mm6, %%mm2 \n\t"
- "psubusb %%mm6, %%mm5 \n\t"
- "psubusb %%mm1, %%mm2 \n\t"
- "por %%mm5, %%mm2 \n\t" // ABS Diff of lines
- "psubusb %%mm2, %%mm0 \n\t" // diff >= QP -> 0
- "pcmpeqb %%mm4, %%mm0 \n\t" // diff >= QP -> FF
-
- "pxor %%mm6, %%mm1 \n\t"
- "pand %%mm0, %%mm1 \n\t"
- "pxor %%mm1, %%mm6 \n\t"
- // 0:QP 6:First
-
- "movq (%0, %1, 8), %%mm5 \n\t"
- "add %1, %0 \n\t" // %0 points to line 1 not 0
- "movq (%0, %1, 8), %%mm7 \n\t"
- "movq %%mm5, %%mm1 \n\t"
- "movq %%mm7, %%mm2 \n\t"
- "psubusb %%mm7, %%mm5 \n\t"
- "psubusb %%mm1, %%mm2 \n\t"
- "por %%mm5, %%mm2 \n\t" // ABS Diff of lines
- "movq %2, %%mm0 \n\t" // QP,..., QP
- "psubusb %%mm2, %%mm0 \n\t" // diff >= QP -> 0
- "pcmpeqb %%mm4, %%mm0 \n\t" // diff >= QP -> FF
-
- "pxor %%mm7, %%mm1 \n\t"
- "pand %%mm0, %%mm1 \n\t"
- "pxor %%mm1, %%mm7 \n\t"
-
- "movq %%mm6, %%mm5 \n\t"
- "punpckhbw %%mm4, %%mm6 \n\t"
- "punpcklbw %%mm4, %%mm5 \n\t"
- // 4:0 5/6:First 7:Last
-
- "movq %%mm5, %%mm0 \n\t"
- "movq %%mm6, %%mm1 \n\t"
- "psllw $2, %%mm0 \n\t"
- "psllw $2, %%mm1 \n\t"
- "paddw "MANGLE(w04)", %%mm0 \n\t"
- "paddw "MANGLE(w04)", %%mm1 \n\t"
-
-#define NEXT\
- "movq (%0), %%mm2 \n\t"\
- "movq (%0), %%mm3 \n\t"\
- "add %1, %0 \n\t"\
- "punpcklbw %%mm4, %%mm2 \n\t"\
- "punpckhbw %%mm4, %%mm3 \n\t"\
- "paddw %%mm2, %%mm0 \n\t"\
- "paddw %%mm3, %%mm1 \n\t"
-
-#define PREV\
- "movq (%0), %%mm2 \n\t"\
- "movq (%0), %%mm3 \n\t"\
- "add %1, %0 \n\t"\
- "punpcklbw %%mm4, %%mm2 \n\t"\
- "punpckhbw %%mm4, %%mm3 \n\t"\
- "psubw %%mm2, %%mm0 \n\t"\
- "psubw %%mm3, %%mm1 \n\t"
-
-
- NEXT //0
- NEXT //1
- NEXT //2
- "movq %%mm0, (%3) \n\t"
- "movq %%mm1, 8(%3) \n\t"
-
- NEXT //3
- "psubw %%mm5, %%mm0 \n\t"
- "psubw %%mm6, %%mm1 \n\t"
- "movq %%mm0, 16(%3) \n\t"
- "movq %%mm1, 24(%3) \n\t"
-
- NEXT //4
- "psubw %%mm5, %%mm0 \n\t"
- "psubw %%mm6, %%mm1 \n\t"
- "movq %%mm0, 32(%3) \n\t"
- "movq %%mm1, 40(%3) \n\t"
-
- NEXT //5
- "psubw %%mm5, %%mm0 \n\t"
- "psubw %%mm6, %%mm1 \n\t"
- "movq %%mm0, 48(%3) \n\t"
- "movq %%mm1, 56(%3) \n\t"
-
- NEXT //6
- "psubw %%mm5, %%mm0 \n\t"
- "psubw %%mm6, %%mm1 \n\t"
- "movq %%mm0, 64(%3) \n\t"
- "movq %%mm1, 72(%3) \n\t"
-
- "movq %%mm7, %%mm6 \n\t"
- "punpckhbw %%mm4, %%mm7 \n\t"
- "punpcklbw %%mm4, %%mm6 \n\t"
-
- NEXT //7
- "mov %4, %0 \n\t"
- "add %1, %0 \n\t"
- PREV //0
- "movq %%mm0, 80(%3) \n\t"
- "movq %%mm1, 88(%3) \n\t"
-
- PREV //1
- "paddw %%mm6, %%mm0 \n\t"
- "paddw %%mm7, %%mm1 \n\t"
- "movq %%mm0, 96(%3) \n\t"
- "movq %%mm1, 104(%3) \n\t"
-
- PREV //2
- "paddw %%mm6, %%mm0 \n\t"
- "paddw %%mm7, %%mm1 \n\t"
- "movq %%mm0, 112(%3) \n\t"
- "movq %%mm1, 120(%3) \n\t"
-
- PREV //3
- "paddw %%mm6, %%mm0 \n\t"
- "paddw %%mm7, %%mm1 \n\t"
- "movq %%mm0, 128(%3) \n\t"
- "movq %%mm1, 136(%3) \n\t"
-
- PREV //4
- "paddw %%mm6, %%mm0 \n\t"
- "paddw %%mm7, %%mm1 \n\t"
- "movq %%mm0, 144(%3) \n\t"
- "movq %%mm1, 152(%3) \n\t"
-
- "mov %4, %0 \n\t" //FIXME
-
- : "+&r"(src)
- : "r" ((x86_reg)step), "m" (c->pQPb), "r"(sums), "g"(src)
- );
-
- src+= step; // src points to begin of the 8x8 Block
-
- __asm__ volatile(
- "movq %4, %%mm6 \n\t"
- "pcmpeqb %%mm5, %%mm5 \n\t"
- "pxor %%mm6, %%mm5 \n\t"
- "pxor %%mm7, %%mm7 \n\t"
-
- "1: \n\t"
- "movq (%1), %%mm0 \n\t"
- "movq 8(%1), %%mm1 \n\t"
- "paddw 32(%1), %%mm0 \n\t"
- "paddw 40(%1), %%mm1 \n\t"
- "movq (%0, %3), %%mm2 \n\t"
- "movq %%mm2, %%mm3 \n\t"
- "movq %%mm2, %%mm4 \n\t"
- "punpcklbw %%mm7, %%mm2 \n\t"
- "punpckhbw %%mm7, %%mm3 \n\t"
- "paddw %%mm2, %%mm0 \n\t"
- "paddw %%mm3, %%mm1 \n\t"
- "paddw %%mm2, %%mm0 \n\t"
- "paddw %%mm3, %%mm1 \n\t"
- "psrlw $4, %%mm0 \n\t"
- "psrlw $4, %%mm1 \n\t"
- "packuswb %%mm1, %%mm0 \n\t"
- "pand %%mm6, %%mm0 \n\t"
- "pand %%mm5, %%mm4 \n\t"
- "por %%mm4, %%mm0 \n\t"
- "movq %%mm0, (%0, %3) \n\t"
- "add $16, %1 \n\t"
- "add %2, %0 \n\t"
- " js 1b \n\t"
-
- : "+r"(offset), "+r"(temp_sums)
- : "r" ((x86_reg)step), "r"(src - offset), "m"(both_masks)
- );
- }else
- src+= step; // src points to begin of the 8x8 Block
-
- if(eq_mask != -1LL){
- uint8_t *temp_src= src;
- __asm__ volatile(
- "pxor %%mm7, %%mm7 \n\t"
- "lea -40(%%"REG_SP"), %%"REG_c" \n\t" // make space for 4 8-byte vars
- "and "ALIGN_MASK", %%"REG_c" \n\t" // align
-// 0 1 2 3 4 5 6 7 8 9
-// %0 eax eax+%1 eax+2%1 %0+4%1 ecx ecx+%1 ecx+2%1 %1+8%1 ecx+4%1
-
- "movq (%0), %%mm0 \n\t"
- "movq %%mm0, %%mm1 \n\t"
- "punpcklbw %%mm7, %%mm0 \n\t" // low part of line 0
- "punpckhbw %%mm7, %%mm1 \n\t" // high part of line 0
-
- "movq (%0, %1), %%mm2 \n\t"
- "lea (%0, %1, 2), %%"REG_a" \n\t"
- "movq %%mm2, %%mm3 \n\t"
- "punpcklbw %%mm7, %%mm2 \n\t" // low part of line 1
- "punpckhbw %%mm7, %%mm3 \n\t" // high part of line 1
-
- "movq (%%"REG_a"), %%mm4 \n\t"
- "movq %%mm4, %%mm5 \n\t"
- "punpcklbw %%mm7, %%mm4 \n\t" // low part of line 2
- "punpckhbw %%mm7, %%mm5 \n\t" // high part of line 2
-
- "paddw %%mm0, %%mm0 \n\t" // 2L0
- "paddw %%mm1, %%mm1 \n\t" // 2H0
- "psubw %%mm4, %%mm2 \n\t" // L1 - L2
- "psubw %%mm5, %%mm3 \n\t" // H1 - H2
- "psubw %%mm2, %%mm0 \n\t" // 2L0 - L1 + L2
- "psubw %%mm3, %%mm1 \n\t" // 2H0 - H1 + H2
-
- "psllw $2, %%mm2 \n\t" // 4L1 - 4L2
- "psllw $2, %%mm3 \n\t" // 4H1 - 4H2
- "psubw %%mm2, %%mm0 \n\t" // 2L0 - 5L1 + 5L2
- "psubw %%mm3, %%mm1 \n\t" // 2H0 - 5H1 + 5H2
-
- "movq (%%"REG_a", %1), %%mm2 \n\t"
- "movq %%mm2, %%mm3 \n\t"
- "punpcklbw %%mm7, %%mm2 \n\t" // L3
- "punpckhbw %%mm7, %%mm3 \n\t" // H3
-
- "psubw %%mm2, %%mm0 \n\t" // 2L0 - 5L1 + 5L2 - L3
- "psubw %%mm3, %%mm1 \n\t" // 2H0 - 5H1 + 5H2 - H3
- "psubw %%mm2, %%mm0 \n\t" // 2L0 - 5L1 + 5L2 - 2L3
- "psubw %%mm3, %%mm1 \n\t" // 2H0 - 5H1 + 5H2 - 2H3
- "movq %%mm0, (%%"REG_c") \n\t" // 2L0 - 5L1 + 5L2 - 2L3
- "movq %%mm1, 8(%%"REG_c") \n\t" // 2H0 - 5H1 + 5H2 - 2H3
-
- "movq (%%"REG_a", %1, 2), %%mm0 \n\t"
- "movq %%mm0, %%mm1 \n\t"
- "punpcklbw %%mm7, %%mm0 \n\t" // L4
- "punpckhbw %%mm7, %%mm1 \n\t" // H4
-
- "psubw %%mm0, %%mm2 \n\t" // L3 - L4
- "psubw %%mm1, %%mm3 \n\t" // H3 - H4
- "movq %%mm2, 16(%%"REG_c") \n\t" // L3 - L4
- "movq %%mm3, 24(%%"REG_c") \n\t" // H3 - H4
- "paddw %%mm4, %%mm4 \n\t" // 2L2
- "paddw %%mm5, %%mm5 \n\t" // 2H2
- "psubw %%mm2, %%mm4 \n\t" // 2L2 - L3 + L4
- "psubw %%mm3, %%mm5 \n\t" // 2H2 - H3 + H4
-
- "lea (%%"REG_a", %1), %0 \n\t"
- "psllw $2, %%mm2 \n\t" // 4L3 - 4L4
- "psllw $2, %%mm3 \n\t" // 4H3 - 4H4
- "psubw %%mm2, %%mm4 \n\t" // 2L2 - 5L3 + 5L4
- "psubw %%mm3, %%mm5 \n\t" // 2H2 - 5H3 + 5H4
-//50 opcodes so far
- "movq (%0, %1, 2), %%mm2 \n\t"
- "movq %%mm2, %%mm3 \n\t"
- "punpcklbw %%mm7, %%mm2 \n\t" // L5
- "punpckhbw %%mm7, %%mm3 \n\t" // H5
- "psubw %%mm2, %%mm4 \n\t" // 2L2 - 5L3 + 5L4 - L5
- "psubw %%mm3, %%mm5 \n\t" // 2H2 - 5H3 + 5H4 - H5
- "psubw %%mm2, %%mm4 \n\t" // 2L2 - 5L3 + 5L4 - 2L5
- "psubw %%mm3, %%mm5 \n\t" // 2H2 - 5H3 + 5H4 - 2H5
-
- "movq (%%"REG_a", %1, 4), %%mm6 \n\t"
- "punpcklbw %%mm7, %%mm6 \n\t" // L6
- "psubw %%mm6, %%mm2 \n\t" // L5 - L6
- "movq (%%"REG_a", %1, 4), %%mm6 \n\t"
- "punpckhbw %%mm7, %%mm6 \n\t" // H6
- "psubw %%mm6, %%mm3 \n\t" // H5 - H6
-
- "paddw %%mm0, %%mm0 \n\t" // 2L4
- "paddw %%mm1, %%mm1 \n\t" // 2H4
- "psubw %%mm2, %%mm0 \n\t" // 2L4 - L5 + L6
- "psubw %%mm3, %%mm1 \n\t" // 2H4 - H5 + H6
-
- "psllw $2, %%mm2 \n\t" // 4L5 - 4L6
- "psllw $2, %%mm3 \n\t" // 4H5 - 4H6
- "psubw %%mm2, %%mm0 \n\t" // 2L4 - 5L5 + 5L6
- "psubw %%mm3, %%mm1 \n\t" // 2H4 - 5H5 + 5H6
-
- "movq (%0, %1, 4), %%mm2 \n\t"
- "movq %%mm2, %%mm3 \n\t"
- "punpcklbw %%mm7, %%mm2 \n\t" // L7
- "punpckhbw %%mm7, %%mm3 \n\t" // H7
-
- "paddw %%mm2, %%mm2 \n\t" // 2L7
- "paddw %%mm3, %%mm3 \n\t" // 2H7
- "psubw %%mm2, %%mm0 \n\t" // 2L4 - 5L5 + 5L6 - 2L7
- "psubw %%mm3, %%mm1 \n\t" // 2H4 - 5H5 + 5H6 - 2H7
-
- "movq (%%"REG_c"), %%mm2 \n\t" // 2L0 - 5L1 + 5L2 - 2L3
- "movq 8(%%"REG_c"), %%mm3 \n\t" // 2H0 - 5H1 + 5H2 - 2H3
-
-#if HAVE_MMX2
- "movq %%mm7, %%mm6 \n\t" // 0
- "psubw %%mm0, %%mm6 \n\t"
- "pmaxsw %%mm6, %%mm0 \n\t" // |2L4 - 5L5 + 5L6 - 2L7|
- "movq %%mm7, %%mm6 \n\t" // 0
- "psubw %%mm1, %%mm6 \n\t"
- "pmaxsw %%mm6, %%mm1 \n\t" // |2H4 - 5H5 + 5H6 - 2H7|
- "movq %%mm7, %%mm6 \n\t" // 0
- "psubw %%mm2, %%mm6 \n\t"
- "pmaxsw %%mm6, %%mm2 \n\t" // |2L0 - 5L1 + 5L2 - 2L3|
- "movq %%mm7, %%mm6 \n\t" // 0
- "psubw %%mm3, %%mm6 \n\t"
- "pmaxsw %%mm6, %%mm3 \n\t" // |2H0 - 5H1 + 5H2 - 2H3|
-#else
- "movq %%mm7, %%mm6 \n\t" // 0
- "pcmpgtw %%mm0, %%mm6 \n\t"
- "pxor %%mm6, %%mm0 \n\t"
- "psubw %%mm6, %%mm0 \n\t" // |2L4 - 5L5 + 5L6 - 2L7|
- "movq %%mm7, %%mm6 \n\t" // 0
- "pcmpgtw %%mm1, %%mm6 \n\t"
- "pxor %%mm6, %%mm1 \n\t"
- "psubw %%mm6, %%mm1 \n\t" // |2H4 - 5H5 + 5H6 - 2H7|
- "movq %%mm7, %%mm6 \n\t" // 0
- "pcmpgtw %%mm2, %%mm6 \n\t"
- "pxor %%mm6, %%mm2 \n\t"
- "psubw %%mm6, %%mm2 \n\t" // |2L0 - 5L1 + 5L2 - 2L3|
- "movq %%mm7, %%mm6 \n\t" // 0
- "pcmpgtw %%mm3, %%mm6 \n\t"
- "pxor %%mm6, %%mm3 \n\t"
- "psubw %%mm6, %%mm3 \n\t" // |2H0 - 5H1 + 5H2 - 2H3|
-#endif
-
-#if HAVE_MMX2
- "pminsw %%mm2, %%mm0 \n\t"
- "pminsw %%mm3, %%mm1 \n\t"
-#else
- "movq %%mm0, %%mm6 \n\t"
- "psubusw %%mm2, %%mm6 \n\t"
- "psubw %%mm6, %%mm0 \n\t"
- "movq %%mm1, %%mm6 \n\t"
- "psubusw %%mm3, %%mm6 \n\t"
- "psubw %%mm6, %%mm1 \n\t"
-#endif
-
- "movd %2, %%mm2 \n\t" // QP
- "punpcklbw %%mm7, %%mm2 \n\t"
-
- "movq %%mm7, %%mm6 \n\t" // 0
- "pcmpgtw %%mm4, %%mm6 \n\t" // sign(2L2 - 5L3 + 5L4 - 2L5)
- "pxor %%mm6, %%mm4 \n\t"
- "psubw %%mm6, %%mm4 \n\t" // |2L2 - 5L3 + 5L4 - 2L5|
- "pcmpgtw %%mm5, %%mm7 \n\t" // sign(2H2 - 5H3 + 5H4 - 2H5)
- "pxor %%mm7, %%mm5 \n\t"
- "psubw %%mm7, %%mm5 \n\t" // |2H2 - 5H3 + 5H4 - 2H5|
-// 100 opcodes
- "psllw $3, %%mm2 \n\t" // 8QP
- "movq %%mm2, %%mm3 \n\t" // 8QP
- "pcmpgtw %%mm4, %%mm2 \n\t"
- "pcmpgtw %%mm5, %%mm3 \n\t"
- "pand %%mm2, %%mm4 \n\t"
- "pand %%mm3, %%mm5 \n\t"
-
-
- "psubusw %%mm0, %%mm4 \n\t" // hd
- "psubusw %%mm1, %%mm5 \n\t" // ld
-
-
- "movq "MANGLE(w05)", %%mm2 \n\t" // 5
- "pmullw %%mm2, %%mm4 \n\t"
- "pmullw %%mm2, %%mm5 \n\t"
- "movq "MANGLE(w20)", %%mm2 \n\t" // 32
- "paddw %%mm2, %%mm4 \n\t"
- "paddw %%mm2, %%mm5 \n\t"
- "psrlw $6, %%mm4 \n\t"
- "psrlw $6, %%mm5 \n\t"
-
- "movq 16(%%"REG_c"), %%mm0 \n\t" // L3 - L4
- "movq 24(%%"REG_c"), %%mm1 \n\t" // H3 - H4
-
- "pxor %%mm2, %%mm2 \n\t"
- "pxor %%mm3, %%mm3 \n\t"
-
- "pcmpgtw %%mm0, %%mm2 \n\t" // sign (L3-L4)
- "pcmpgtw %%mm1, %%mm3 \n\t" // sign (H3-H4)
- "pxor %%mm2, %%mm0 \n\t"
- "pxor %%mm3, %%mm1 \n\t"
- "psubw %%mm2, %%mm0 \n\t" // |L3-L4|
- "psubw %%mm3, %%mm1 \n\t" // |H3-H4|
- "psrlw $1, %%mm0 \n\t" // |L3 - L4|/2
- "psrlw $1, %%mm1 \n\t" // |H3 - H4|/2
-
- "pxor %%mm6, %%mm2 \n\t"
- "pxor %%mm7, %%mm3 \n\t"
- "pand %%mm2, %%mm4 \n\t"
- "pand %%mm3, %%mm5 \n\t"
-
-#if HAVE_MMX2
- "pminsw %%mm0, %%mm4 \n\t"
- "pminsw %%mm1, %%mm5 \n\t"
-#else
- "movq %%mm4, %%mm2 \n\t"
- "psubusw %%mm0, %%mm2 \n\t"
- "psubw %%mm2, %%mm4 \n\t"
- "movq %%mm5, %%mm2 \n\t"
- "psubusw %%mm1, %%mm2 \n\t"
- "psubw %%mm2, %%mm5 \n\t"
-#endif
- "pxor %%mm6, %%mm4 \n\t"
- "pxor %%mm7, %%mm5 \n\t"
- "psubw %%mm6, %%mm4 \n\t"
- "psubw %%mm7, %%mm5 \n\t"
- "packsswb %%mm5, %%mm4 \n\t"
- "movq %3, %%mm1 \n\t"
- "pandn %%mm4, %%mm1 \n\t"
- "movq (%0), %%mm0 \n\t"
- "paddb %%mm1, %%mm0 \n\t"
- "movq %%mm0, (%0) \n\t"
- "movq (%0, %1), %%mm0 \n\t"
- "psubb %%mm1, %%mm0 \n\t"
- "movq %%mm0, (%0, %1) \n\t"
-
- : "+r" (temp_src)
- : "r" ((x86_reg)step), "m" (c->pQPb), "m"(eq_mask)
- : "%"REG_a, "%"REG_c
- );
- }
-/*if(step==16){
- STOP_TIMER("step16")
-}else{
- STOP_TIMER("stepX")
-}
- } */
-}
-#endif //HAVE_MMX
-
-static void RENAME(postProcess)(const uint8_t src[], int srcStride, uint8_t dst[], int dstStride, int width, int height,
- const QP_STORE_T QPs[], int QPStride, int isColor, PPContext *c);
-
-/**
- * Copy a block from src to dst and fixes the blacklevel.
- * levelFix == 0 -> do not touch the brighness & contrast
- */
-#undef REAL_SCALED_CPY
-#undef SCALED_CPY
-
-static inline void RENAME(blockCopy)(uint8_t dst[], int dstStride, const uint8_t src[], int srcStride,
- int levelFix, int64_t *packedOffsetAndScale)
-{
-#if !HAVE_MMX
- int i;
-#endif
- if(levelFix){
-#if HAVE_MMX
- __asm__ volatile(
- "movq (%%"REG_a"), %%mm2 \n\t" // packedYOffset
- "movq 8(%%"REG_a"), %%mm3 \n\t" // packedYScale
- "lea (%2,%4), %%"REG_a" \n\t"
- "lea (%3,%5), %%"REG_d" \n\t"
- "pxor %%mm4, %%mm4 \n\t"
-#if HAVE_MMX2
-#define REAL_SCALED_CPY(src1, src2, dst1, dst2) \
- "movq " #src1 ", %%mm0 \n\t"\
- "movq " #src1 ", %%mm5 \n\t"\
- "movq " #src2 ", %%mm1 \n\t"\
- "movq " #src2 ", %%mm6 \n\t"\
- "punpcklbw %%mm0, %%mm0 \n\t"\
- "punpckhbw %%mm5, %%mm5 \n\t"\
- "punpcklbw %%mm1, %%mm1 \n\t"\
- "punpckhbw %%mm6, %%mm6 \n\t"\
- "pmulhuw %%mm3, %%mm0 \n\t"\
- "pmulhuw %%mm3, %%mm5 \n\t"\
- "pmulhuw %%mm3, %%mm1 \n\t"\
- "pmulhuw %%mm3, %%mm6 \n\t"\
- "psubw %%mm2, %%mm0 \n\t"\
- "psubw %%mm2, %%mm5 \n\t"\
- "psubw %%mm2, %%mm1 \n\t"\
- "psubw %%mm2, %%mm6 \n\t"\
- "packuswb %%mm5, %%mm0 \n\t"\
- "packuswb %%mm6, %%mm1 \n\t"\
- "movq %%mm0, " #dst1 " \n\t"\
- "movq %%mm1, " #dst2 " \n\t"\
-
-#else //HAVE_MMX2
-#define REAL_SCALED_CPY(src1, src2, dst1, dst2) \
- "movq " #src1 ", %%mm0 \n\t"\
- "movq " #src1 ", %%mm5 \n\t"\
- "punpcklbw %%mm4, %%mm0 \n\t"\
- "punpckhbw %%mm4, %%mm5 \n\t"\
- "psubw %%mm2, %%mm0 \n\t"\
- "psubw %%mm2, %%mm5 \n\t"\
- "movq " #src2 ", %%mm1 \n\t"\
- "psllw $6, %%mm0 \n\t"\
- "psllw $6, %%mm5 \n\t"\
- "pmulhw %%mm3, %%mm0 \n\t"\
- "movq " #src2 ", %%mm6 \n\t"\
- "pmulhw %%mm3, %%mm5 \n\t"\
- "punpcklbw %%mm4, %%mm1 \n\t"\
- "punpckhbw %%mm4, %%mm6 \n\t"\
- "psubw %%mm2, %%mm1 \n\t"\
- "psubw %%mm2, %%mm6 \n\t"\
- "psllw $6, %%mm1 \n\t"\
- "psllw $6, %%mm6 \n\t"\
- "pmulhw %%mm3, %%mm1 \n\t"\
- "pmulhw %%mm3, %%mm6 \n\t"\
- "packuswb %%mm5, %%mm0 \n\t"\
- "packuswb %%mm6, %%mm1 \n\t"\
- "movq %%mm0, " #dst1 " \n\t"\
- "movq %%mm1, " #dst2 " \n\t"\
-
-#endif //HAVE_MMX2
-#define SCALED_CPY(src1, src2, dst1, dst2)\
- REAL_SCALED_CPY(src1, src2, dst1, dst2)
-
-SCALED_CPY((%2) , (%2, %4) , (%3) , (%3, %5))
-SCALED_CPY((%2, %4, 2), (%%REGa, %4, 2), (%3, %5, 2), (%%REGd, %5, 2))
-SCALED_CPY((%2, %4, 4), (%%REGa, %4, 4), (%3, %5, 4), (%%REGd, %5, 4))
- "lea (%%"REG_a",%4,4), %%"REG_a" \n\t"
- "lea (%%"REG_d",%5,4), %%"REG_d" \n\t"
-SCALED_CPY((%%REGa, %4), (%%REGa, %4, 2), (%%REGd, %5), (%%REGd, %5, 2))
-
-
- : "=&a" (packedOffsetAndScale)
- : "0" (packedOffsetAndScale),
- "r"(src),
- "r"(dst),
- "r" ((x86_reg)srcStride),
- "r" ((x86_reg)dstStride)
- : "%"REG_d
- );
-#else //HAVE_MMX
- for(i=0; i<8; i++)
- memcpy( &(dst[dstStride*i]),
- &(src[srcStride*i]), BLOCK_SIZE);
-#endif //HAVE_MMX
- }else{
-#if HAVE_MMX
- __asm__ volatile(
- "lea (%0,%2), %%"REG_a" \n\t"
- "lea (%1,%3), %%"REG_d" \n\t"
-
-#define REAL_SIMPLE_CPY(src1, src2, dst1, dst2) \
- "movq " #src1 ", %%mm0 \n\t"\
- "movq " #src2 ", %%mm1 \n\t"\
- "movq %%mm0, " #dst1 " \n\t"\
- "movq %%mm1, " #dst2 " \n\t"\
-
-#define SIMPLE_CPY(src1, src2, dst1, dst2)\
- REAL_SIMPLE_CPY(src1, src2, dst1, dst2)
-
-SIMPLE_CPY((%0) , (%0, %2) , (%1) , (%1, %3))
-SIMPLE_CPY((%0, %2, 2), (%%REGa, %2, 2), (%1, %3, 2), (%%REGd, %3, 2))
-SIMPLE_CPY((%0, %2, 4), (%%REGa, %2, 4), (%1, %3, 4), (%%REGd, %3, 4))
- "lea (%%"REG_a",%2,4), %%"REG_a" \n\t"
- "lea (%%"REG_d",%3,4), %%"REG_d" \n\t"
-SIMPLE_CPY((%%REGa, %2), (%%REGa, %2, 2), (%%REGd, %3), (%%REGd, %3, 2))
-
- : : "r" (src),
- "r" (dst),
- "r" ((x86_reg)srcStride),
- "r" ((x86_reg)dstStride)
- : "%"REG_a, "%"REG_d
- );
-#else //HAVE_MMX
- for(i=0; i<8; i++)
- memcpy( &(dst[dstStride*i]),
- &(src[srcStride*i]), BLOCK_SIZE);
-#endif //HAVE_MMX
- }
-}
-
-/**
- * Duplicate the given 8 src pixels ? times upward
- */
-static inline void RENAME(duplicate)(uint8_t src[], int stride)
-{
-#if HAVE_MMX
- __asm__ volatile(
- "movq (%0), %%mm0 \n\t"
- "add %1, %0 \n\t"
- "movq %%mm0, (%0) \n\t"
- "movq %%mm0, (%0, %1) \n\t"
- "movq %%mm0, (%0, %1, 2) \n\t"
- : "+r" (src)
- : "r" ((x86_reg)-stride)
- );
-#else
- int i;
- uint8_t *p=src;
- for(i=0; i<3; i++){
- p-= stride;
- memcpy(p, src, 8);
- }
-#endif
-}
-
-/**
- * Filter array of bytes (Y or U or V values)
- */
-static void RENAME(postProcess)(const uint8_t src[], int srcStride, uint8_t dst[], int dstStride, int width, int height,
- const QP_STORE_T QPs[], int QPStride, int isColor, PPContext *c2)
-{
- DECLARE_ALIGNED(8, PPContext, c)= *c2; //copy to stack for faster access
- int x,y;
-#ifdef COMPILE_TIME_MODE
- const int mode= COMPILE_TIME_MODE;
-#else
- const int mode= isColor ? c.ppMode.chromMode : c.ppMode.lumMode;
-#endif
- int black=0, white=255; // blackest black and whitest white in the picture
- int QPCorrecture= 256*256;
-
- int copyAhead;
-#if HAVE_MMX
- int i;
-#endif
-
- const int qpHShift= isColor ? 4-c.hChromaSubSample : 4;
- const int qpVShift= isColor ? 4-c.vChromaSubSample : 4;
-
- //FIXME remove
- uint64_t * const yHistogram= c.yHistogram;
- uint8_t * const tempSrc= srcStride > 0 ? c.tempSrc : c.tempSrc - 23*srcStride;
- uint8_t * const tempDst= dstStride > 0 ? c.tempDst : c.tempDst - 23*dstStride;
- //const int mbWidth= isColor ? (width+7)>>3 : (width+15)>>4;
-
-#if HAVE_MMX
- for(i=0; i<57; i++){
- int offset= ((i*c.ppMode.baseDcDiff)>>8) + 1;
- int threshold= offset*2 + 1;
- c.mmxDcOffset[i]= 0x7F - offset;
- c.mmxDcThreshold[i]= 0x7F - threshold;
- c.mmxDcOffset[i]*= 0x0101010101010101LL;
- c.mmxDcThreshold[i]*= 0x0101010101010101LL;
- }
-#endif
-
- if(mode & CUBIC_IPOL_DEINT_FILTER) copyAhead=16;
- else if( (mode & LINEAR_BLEND_DEINT_FILTER)
- || (mode & FFMPEG_DEINT_FILTER)
- || (mode & LOWPASS5_DEINT_FILTER)) copyAhead=14;
- else if( (mode & V_DEBLOCK)
- || (mode & LINEAR_IPOL_DEINT_FILTER)
- || (mode & MEDIAN_DEINT_FILTER)
- || (mode & V_A_DEBLOCK)) copyAhead=13;
- else if(mode & V_X1_FILTER) copyAhead=11;
-// else if(mode & V_RK1_FILTER) copyAhead=10;
- else if(mode & DERING) copyAhead=9;
- else copyAhead=8;
-
- copyAhead-= 8;
-
- if(!isColor){
- uint64_t sum= 0;
- int i;
- uint64_t maxClipped;
- uint64_t clipped;
- double scale;
-
- c.frameNum++;
- // first frame is fscked so we ignore it
- if(c.frameNum == 1) yHistogram[0]= width*height/64*15/256;
-
- for(i=0; i<256; i++){
- sum+= yHistogram[i];
- }
-
- /* We always get a completely black picture first. */
- maxClipped= (uint64_t)(sum * c.ppMode.maxClippedThreshold);
-
- clipped= sum;
- for(black=255; black>0; black--){
- if(clipped < maxClipped) break;
- clipped-= yHistogram[black];
- }
-
- clipped= sum;
- for(white=0; white<256; white++){
- if(clipped < maxClipped) break;
- clipped-= yHistogram[white];
- }
-
- scale= (double)(c.ppMode.maxAllowedY - c.ppMode.minAllowedY) / (double)(white-black);
-
-#if HAVE_MMX2
- c.packedYScale= (uint16_t)(scale*256.0 + 0.5);
- c.packedYOffset= (((black*c.packedYScale)>>8) - c.ppMode.minAllowedY) & 0xFFFF;
-#else
- c.packedYScale= (uint16_t)(scale*1024.0 + 0.5);
- c.packedYOffset= (black - c.ppMode.minAllowedY) & 0xFFFF;
-#endif
-
- c.packedYOffset|= c.packedYOffset<<32;
- c.packedYOffset|= c.packedYOffset<<16;
-
- c.packedYScale|= c.packedYScale<<32;
- c.packedYScale|= c.packedYScale<<16;
-
- if(mode & LEVEL_FIX) QPCorrecture= (int)(scale*256*256 + 0.5);
- else QPCorrecture= 256*256;
- }else{
- c.packedYScale= 0x0100010001000100LL;
- c.packedYOffset= 0;
- QPCorrecture= 256*256;
- }
-
- /* copy & deinterlace first row of blocks */
- y=-BLOCK_SIZE;
- {
- const uint8_t *srcBlock= &(src[y*srcStride]);
- uint8_t *dstBlock= tempDst + dstStride;
-
- // From this point on it is guaranteed that we can read and write 16 lines downward
- // finish 1 block before the next otherwise we might have a problem
- // with the L1 Cache of the P4 ... or only a few blocks at a time or soemthing
- for(x=0; x<width; x+=BLOCK_SIZE){
-
-#if HAVE_MMX2
-/*
- prefetchnta(srcBlock + (((x>>2)&6) + 5)*srcStride + 32);
- prefetchnta(srcBlock + (((x>>2)&6) + 6)*srcStride + 32);
- prefetcht0(dstBlock + (((x>>2)&6) + 5)*dstStride + 32);
- prefetcht0(dstBlock + (((x>>2)&6) + 6)*dstStride + 32);
-*/
-
- __asm__(
- "mov %4, %%"REG_a" \n\t"
- "shr $2, %%"REG_a" \n\t"
- "and $6, %%"REG_a" \n\t"
- "add %5, %%"REG_a" \n\t"
- "mov %%"REG_a", %%"REG_d" \n\t"
- "imul %1, %%"REG_a" \n\t"
- "imul %3, %%"REG_d" \n\t"
- "prefetchnta 32(%%"REG_a", %0) \n\t"
- "prefetcht0 32(%%"REG_d", %2) \n\t"
- "add %1, %%"REG_a" \n\t"
- "add %3, %%"REG_d" \n\t"
- "prefetchnta 32(%%"REG_a", %0) \n\t"
- "prefetcht0 32(%%"REG_d", %2) \n\t"
- :: "r" (srcBlock), "r" ((x86_reg)srcStride), "r" (dstBlock), "r" ((x86_reg)dstStride),
- "g" ((x86_reg)x), "g" ((x86_reg)copyAhead)
- : "%"REG_a, "%"REG_d
- );
-
-#elif HAVE_AMD3DNOW
-//FIXME check if this is faster on an 3dnow chip or if it is faster without the prefetch or ...
-/* prefetch(srcBlock + (((x>>3)&3) + 5)*srcStride + 32);
- prefetch(srcBlock + (((x>>3)&3) + 9)*srcStride + 32);
- prefetchw(dstBlock + (((x>>3)&3) + 5)*dstStride + 32);
- prefetchw(dstBlock + (((x>>3)&3) + 9)*dstStride + 32);
-*/
-#endif
-
- RENAME(blockCopy)(dstBlock + dstStride*8, dstStride,
- srcBlock + srcStride*8, srcStride, mode & LEVEL_FIX, &c.packedYOffset);
-
- RENAME(duplicate)(dstBlock + dstStride*8, dstStride);
-
- if(mode & LINEAR_IPOL_DEINT_FILTER)
- RENAME(deInterlaceInterpolateLinear)(dstBlock, dstStride);
- else if(mode & LINEAR_BLEND_DEINT_FILTER)
- RENAME(deInterlaceBlendLinear)(dstBlock, dstStride, c.deintTemp + x);
- else if(mode & MEDIAN_DEINT_FILTER)
- RENAME(deInterlaceMedian)(dstBlock, dstStride);
- else if(mode & CUBIC_IPOL_DEINT_FILTER)
- RENAME(deInterlaceInterpolateCubic)(dstBlock, dstStride);
- else if(mode & FFMPEG_DEINT_FILTER)
- RENAME(deInterlaceFF)(dstBlock, dstStride, c.deintTemp + x);
- else if(mode & LOWPASS5_DEINT_FILTER)
- RENAME(deInterlaceL5)(dstBlock, dstStride, c.deintTemp + x, c.deintTemp + width + x);
-/* else if(mode & CUBIC_BLEND_DEINT_FILTER)
- RENAME(deInterlaceBlendCubic)(dstBlock, dstStride);
-*/
- dstBlock+=8;
- srcBlock+=8;
- }
- if(width==FFABS(dstStride))
- linecpy(dst, tempDst + 9*dstStride, copyAhead, dstStride);
- else{
- int i;
- for(i=0; i<copyAhead; i++){
- memcpy(dst + i*dstStride, tempDst + (9+i)*dstStride, width);
- }
- }
- }
-
- for(y=0; y<height; y+=BLOCK_SIZE){
- //1% speedup if these are here instead of the inner loop
- const uint8_t *srcBlock= &(src[y*srcStride]);
- uint8_t *dstBlock= &(dst[y*dstStride]);
-#if HAVE_MMX
- uint8_t *tempBlock1= c.tempBlocks;
- uint8_t *tempBlock2= c.tempBlocks + 8;
-#endif
- const int8_t *QPptr= &QPs[(y>>qpVShift)*QPStride];
- int8_t *nonBQPptr= &c.nonBQPTable[(y>>qpVShift)*FFABS(QPStride)];
- int QP=0;
- /* can we mess with a 8x16 block from srcBlock/dstBlock downwards and 1 line upwards
- if not than use a temporary buffer */
- if(y+15 >= height){
- int i;
- /* copy from line (copyAhead) to (copyAhead+7) of src, these will be copied with
- blockcopy to dst later */
- linecpy(tempSrc + srcStride*copyAhead, srcBlock + srcStride*copyAhead,
- FFMAX(height-y-copyAhead, 0), srcStride);
-
- /* duplicate last line of src to fill the void up to line (copyAhead+7) */
- for(i=FFMAX(height-y, 8); i<copyAhead+8; i++)
- memcpy(tempSrc + srcStride*i, src + srcStride*(height-1), FFABS(srcStride));
-
- /* copy up to (copyAhead+1) lines of dst (line -1 to (copyAhead-1))*/
- linecpy(tempDst, dstBlock - dstStride, FFMIN(height-y+1, copyAhead+1), dstStride);
-
- /* duplicate last line of dst to fill the void up to line (copyAhead) */
- for(i=height-y+1; i<=copyAhead; i++)
- memcpy(tempDst + dstStride*i, dst + dstStride*(height-1), FFABS(dstStride));
-
- dstBlock= tempDst + dstStride;
- srcBlock= tempSrc;
- }
-
- // From this point on it is guaranteed that we can read and write 16 lines downward
- // finish 1 block before the next otherwise we might have a problem
- // with the L1 Cache of the P4 ... or only a few blocks at a time or soemthing
- for(x=0; x<width; x+=BLOCK_SIZE){
- const int stride= dstStride;
-#if HAVE_MMX
- uint8_t *tmpXchg;
-#endif
- if(isColor){
- QP= QPptr[x>>qpHShift];
- c.nonBQP= nonBQPptr[x>>qpHShift];
- }else{
- QP= QPptr[x>>4];
- QP= (QP* QPCorrecture + 256*128)>>16;
- c.nonBQP= nonBQPptr[x>>4];
- c.nonBQP= (c.nonBQP* QPCorrecture + 256*128)>>16;
- yHistogram[ srcBlock[srcStride*12 + 4] ]++;
- }
- c.QP= QP;
-#if HAVE_MMX
- __asm__ volatile(
- "movd %1, %%mm7 \n\t"
- "packuswb %%mm7, %%mm7 \n\t" // 0, 0, 0, QP, 0, 0, 0, QP
- "packuswb %%mm7, %%mm7 \n\t" // 0,QP, 0, QP, 0,QP, 0, QP
- "packuswb %%mm7, %%mm7 \n\t" // QP,..., QP
- "movq %%mm7, %0 \n\t"
- : "=m" (c.pQPb)
- : "r" (QP)
- );
-#endif
-
-
-#if HAVE_MMX2
-/*
- prefetchnta(srcBlock + (((x>>2)&6) + 5)*srcStride + 32);
- prefetchnta(srcBlock + (((x>>2)&6) + 6)*srcStride + 32);
- prefetcht0(dstBlock + (((x>>2)&6) + 5)*dstStride + 32);
- prefetcht0(dstBlock + (((x>>2)&6) + 6)*dstStride + 32);
-*/
-
- __asm__(
- "mov %4, %%"REG_a" \n\t"
- "shr $2, %%"REG_a" \n\t"
- "and $6, %%"REG_a" \n\t"
- "add %5, %%"REG_a" \n\t"
- "mov %%"REG_a", %%"REG_d" \n\t"
- "imul %1, %%"REG_a" \n\t"
- "imul %3, %%"REG_d" \n\t"
- "prefetchnta 32(%%"REG_a", %0) \n\t"
- "prefetcht0 32(%%"REG_d", %2) \n\t"
- "add %1, %%"REG_a" \n\t"
- "add %3, %%"REG_d" \n\t"
- "prefetchnta 32(%%"REG_a", %0) \n\t"
- "prefetcht0 32(%%"REG_d", %2) \n\t"
- :: "r" (srcBlock), "r" ((x86_reg)srcStride), "r" (dstBlock), "r" ((x86_reg)dstStride),
- "g" ((x86_reg)x), "g" ((x86_reg)copyAhead)
- : "%"REG_a, "%"REG_d
- );
-
-#elif HAVE_AMD3DNOW
-//FIXME check if this is faster on an 3dnow chip or if it is faster without the prefetch or ...
-/* prefetch(srcBlock + (((x>>3)&3) + 5)*srcStride + 32);
- prefetch(srcBlock + (((x>>3)&3) + 9)*srcStride + 32);
- prefetchw(dstBlock + (((x>>3)&3) + 5)*dstStride + 32);
- prefetchw(dstBlock + (((x>>3)&3) + 9)*dstStride + 32);
-*/
-#endif
-
- RENAME(blockCopy)(dstBlock + dstStride*copyAhead, dstStride,
- srcBlock + srcStride*copyAhead, srcStride, mode & LEVEL_FIX, &c.packedYOffset);
-
- if(mode & LINEAR_IPOL_DEINT_FILTER)
- RENAME(deInterlaceInterpolateLinear)(dstBlock, dstStride);
- else if(mode & LINEAR_BLEND_DEINT_FILTER)
- RENAME(deInterlaceBlendLinear)(dstBlock, dstStride, c.deintTemp + x);
- else if(mode & MEDIAN_DEINT_FILTER)
- RENAME(deInterlaceMedian)(dstBlock, dstStride);
- else if(mode & CUBIC_IPOL_DEINT_FILTER)
- RENAME(deInterlaceInterpolateCubic)(dstBlock, dstStride);
- else if(mode & FFMPEG_DEINT_FILTER)
- RENAME(deInterlaceFF)(dstBlock, dstStride, c.deintTemp + x);
- else if(mode & LOWPASS5_DEINT_FILTER)
- RENAME(deInterlaceL5)(dstBlock, dstStride, c.deintTemp + x, c.deintTemp + width + x);
-/* else if(mode & CUBIC_BLEND_DEINT_FILTER)
- RENAME(deInterlaceBlendCubic)(dstBlock, dstStride);
-*/
-
- /* only deblock if we have 2 blocks */
- if(y + 8 < height){
- if(mode & V_X1_FILTER)
- RENAME(vertX1Filter)(dstBlock, stride, &c);
- else if(mode & V_DEBLOCK){
- const int t= RENAME(vertClassify)(dstBlock, stride, &c);
-
- if(t==1)
- RENAME(doVertLowPass)(dstBlock, stride, &c);
- else if(t==2)
- RENAME(doVertDefFilter)(dstBlock, stride, &c);
- }else if(mode & V_A_DEBLOCK){
- RENAME(do_a_deblock)(dstBlock, stride, 1, &c);
- }
- }
-
-#if HAVE_MMX
- RENAME(transpose1)(tempBlock1, tempBlock2, dstBlock, dstStride);
-#endif
- /* check if we have a previous block to deblock it with dstBlock */
- if(x - 8 >= 0){
-#if HAVE_MMX
- if(mode & H_X1_FILTER)
- RENAME(vertX1Filter)(tempBlock1, 16, &c);
- else if(mode & H_DEBLOCK){
-//START_TIMER
- const int t= RENAME(vertClassify)(tempBlock1, 16, &c);
-//STOP_TIMER("dc & minmax")
- if(t==1)
- RENAME(doVertLowPass)(tempBlock1, 16, &c);
- else if(t==2)
- RENAME(doVertDefFilter)(tempBlock1, 16, &c);
- }else if(mode & H_A_DEBLOCK){
- RENAME(do_a_deblock)(tempBlock1, 16, 1, &c);
- }
-
- RENAME(transpose2)(dstBlock-4, dstStride, tempBlock1 + 4*16);
-
-#else
- if(mode & H_X1_FILTER)
- horizX1Filter(dstBlock-4, stride, QP);
- else if(mode & H_DEBLOCK){
-#if HAVE_ALTIVEC
- DECLARE_ALIGNED(16, unsigned char, tempBlock)[272];
- int t;
- transpose_16x8_char_toPackedAlign_altivec(tempBlock, dstBlock - (4 + 1), stride);
-
- t = vertClassify_altivec(tempBlock-48, 16, &c);
- if(t==1) {
- doVertLowPass_altivec(tempBlock-48, 16, &c);
- transpose_8x16_char_fromPackedAlign_altivec(dstBlock - (4 + 1), tempBlock, stride);
- }
- else if(t==2) {
- doVertDefFilter_altivec(tempBlock-48, 16, &c);
- transpose_8x16_char_fromPackedAlign_altivec(dstBlock - (4 + 1), tempBlock, stride);
- }
-#else
- const int t= RENAME(horizClassify)(dstBlock-4, stride, &c);
-
- if(t==1)
- RENAME(doHorizLowPass)(dstBlock-4, stride, &c);
- else if(t==2)
- RENAME(doHorizDefFilter)(dstBlock-4, stride, &c);
-#endif
- }else if(mode & H_A_DEBLOCK){
- RENAME(do_a_deblock)(dstBlock-8, 1, stride, &c);
- }
-#endif //HAVE_MMX
- if(mode & DERING){
- //FIXME filter first line
- if(y>0) RENAME(dering)(dstBlock - stride - 8, stride, &c);
- }
-
- if(mode & TEMP_NOISE_FILTER)
- {
- RENAME(tempNoiseReducer)(dstBlock-8, stride,
- c.tempBlurred[isColor] + y*dstStride + x,
- c.tempBlurredPast[isColor] + (y>>3)*256 + (x>>3),
- c.ppMode.maxTmpNoise);
- }
- }
-
- dstBlock+=8;
- srcBlock+=8;
-
-#if HAVE_MMX
- tmpXchg= tempBlock1;
- tempBlock1= tempBlock2;
- tempBlock2 = tmpXchg;
-#endif
- }
-
- if(mode & DERING){
- if(y > 0) RENAME(dering)(dstBlock - dstStride - 8, dstStride, &c);
- }
-
- if((mode & TEMP_NOISE_FILTER)){
- RENAME(tempNoiseReducer)(dstBlock-8, dstStride,
- c.tempBlurred[isColor] + y*dstStride + x,
- c.tempBlurredPast[isColor] + (y>>3)*256 + (x>>3),
- c.ppMode.maxTmpNoise);
- }
-
- /* did we use a tmp buffer for the last lines*/
- if(y+15 >= height){
- uint8_t *dstBlock= &(dst[y*dstStride]);
- if(width==FFABS(dstStride))
- linecpy(dstBlock, tempDst + dstStride, height-y, dstStride);
- else{
- int i;
- for(i=0; i<height-y; i++){
- memcpy(dstBlock + i*dstStride, tempDst + (i+1)*dstStride, width);
- }
- }
- }
-/*
- for(x=0; x<width; x+=32){
- volatile int i;
- i+= + dstBlock[x + 7*dstStride] + dstBlock[x + 8*dstStride]
- + dstBlock[x + 9*dstStride] + dstBlock[x +10*dstStride]
- + dstBlock[x +11*dstStride] + dstBlock[x +12*dstStride];
- + dstBlock[x +13*dstStride]
- + dstBlock[x +14*dstStride] + dstBlock[x +15*dstStride];
- }*/
- }
-#if HAVE_AMD3DNOW
- __asm__ volatile("femms");
-#elif HAVE_MMX
- __asm__ volatile("emms");
-#endif
-
-#ifdef DEBUG_BRIGHTNESS
- if(!isColor){
- int max=1;
- int i;
- for(i=0; i<256; i++)
- if(yHistogram[i] > max) max=yHistogram[i];
-
- for(i=1; i<256; i++){
- int x;
- int start=yHistogram[i-1]/(max/256+1);
- int end=yHistogram[i]/(max/256+1);
- int inc= end > start ? 1 : -1;
- for(x=start; x!=end+inc; x+=inc)
- dst[ i*dstStride + x]+=128;
- }
-
- for(i=0; i<100; i+=2){
- dst[ (white)*dstStride + i]+=128;
- dst[ (black)*dstStride + i]+=128;
- }
- }
-#endif
-
- *c2= c; //copy local context back
-
-}
diff --git a/gst-libs/ext/libav/library.mak b/gst-libs/ext/libav/library.mak
index 8dde8f4..3b4bd2d 100644
--- a/gst-libs/ext/libav/library.mak
+++ b/gst-libs/ext/libav/library.mak
@@ -5,7 +5,8 @@ include $(SRC_PATH)/common.mak
LIBVERSION := $(lib$(NAME)_VERSION)
LIBMAJOR := $(lib$(NAME)_VERSION_MAJOR)
INCINSTDIR := $(INCDIR)/lib$(NAME)
-THIS_LIB := $(SUBDIR)$($(CONFIG_SHARED:yes=S)LIBNAME)
+
+INSTHEADERS := $(INSTHEADERS) $(HEADERS:%=$(SUBDIR)%)
all-$(CONFIG_STATIC): $(SUBDIR)$(LIBNAME)
all-$(CONFIG_SHARED): $(SUBDIR)$(SLIBNAME)
@@ -16,16 +17,23 @@ $(SUBDIR)%-test.o: $(SUBDIR)%-test.c
$(SUBDIR)%-test.o: $(SUBDIR)%.c
$(COMPILE_C)
+$(SUBDIR)%-test.i: $(SUBDIR)%-test.c
+ $(CC) $(CCFLAGS) $(CC_E) $<
+
+$(SUBDIR)%-test.i: $(SUBDIR)%.c
+ $(CC) $(CCFLAGS) $(CC_E) $<
+
$(SUBDIR)x86/%.o: $(SUBDIR)x86/%.asm
- $(YASMDEP) $(YASMFLAGS) -I $(<D)/ -M -o $@ $< > $(@:.o=.d)
+ $(DEPYASM) $(YASMFLAGS) -I $(<D)/ -M -o $@ $< > $(@:.o=.d)
$(YASM) $(YASMFLAGS) -I $(<D)/ -o $@ $<
-$(OBJS) $(SUBDIR)%.ho $(TESTOBJS): CPPFLAGS += -DHAVE_AV_CONFIG_H
-$(TESTOBJS): CPPFLAGS += -DTEST
+LIBOBJS := $(OBJS) $(SUBDIR)%.h.o $(TESTOBJS)
+$(LIBOBJS) $(LIBOBJS:.o=.i): CPPFLAGS += -DHAVE_AV_CONFIG_H
+$(TESTOBJS) $(TESTOBJS:.o=.i): CPPFLAGS += -DTEST
$(SUBDIR)$(LIBNAME): $(OBJS)
$(RM) $@
- $(AR) rc $@ $^ $(EXTRAOBJS)
+ $(AR) $(ARFLAGS) $(AR_O) $^
$(RANLIB) $@
install-headers: install-lib$(NAME)-headers install-lib$(NAME)-pkgconfig
@@ -34,24 +42,26 @@ install-libs-$(CONFIG_STATIC): install-lib$(NAME)-static
install-libs-$(CONFIG_SHARED): install-lib$(NAME)-shared
define RULES
-$(EXAMPLES) $(TESTPROGS) $(TOOLS): %$(EXESUF): %.o
- $$(LD) $(LDFLAGS) -o $$@ $$^ -l$(FULLNAME) $(FFEXTRALIBS) $$(ELIBS)
+$(EXAMPLES) $(TOOLS): THISLIB = $(FULLNAME:%=$(LD_LIB))
+$(TESTPROGS): THISLIB = $(SUBDIR)$(LIBNAME)
+
+$(EXAMPLES) $(TESTPROGS) $(TOOLS): %$(EXESUF): %.o $(EXEOBJS)
+ $$(LD) $(LDFLAGS) $$(LD_O) $$(filter %.o,$$^) $$(THISLIB) $(FFEXTRALIBS) $$(ELIBS)
$(SUBDIR)$(SLIBNAME): $(SUBDIR)$(SLIBNAME_WITH_MAJOR)
$(Q)cd ./$(SUBDIR) && $(LN_S) $(SLIBNAME_WITH_MAJOR) $(SLIBNAME)
$(SUBDIR)$(SLIBNAME_WITH_MAJOR): $(OBJS) $(SUBDIR)lib$(NAME).ver $(DEP_LIBS)
$(SLIB_CREATE_DEF_CMD)
- $$(LD) $(SHFLAGS) $(LDFLAGS) -o $$@ $$(filter %.o,$$^) $(FFEXTRALIBS) $(EXTRAOBJS)
+ $$(LD) $(SHFLAGS) $(LDFLAGS) $$(LD_O) $$(filter %.o,$$^) $(FFEXTRALIBS)
$(SLIB_EXTRA_CMD)
clean::
$(RM) $(addprefix $(SUBDIR),*-example$(EXESUF) *-test$(EXESUF) $(CLEANFILES) $(CLEANSUFFIXES) $(LIBSUFFIXES)) \
- $(foreach dir,$(DIRS),$(CLEANSUFFIXES:%=$(SUBDIR)$(dir)/%))
+ $(CLEANSUFFIXES:%=$(SUBDIR)$(ARCH)/%)
distclean:: clean
- $(RM) $(DISTCLEANSUFFIXES:%=$(SUBDIR)%) \
- $(foreach dir,$(DIRS),$(DISTCLEANSUFFIXES:%=$(SUBDIR)$(dir)/%))
+ $(RM) $(DISTCLEANSUFFIXES:%=$(SUBDIR)%) $(DISTCLEANSUFFIXES:%=$(SUBDIR)$(ARCH)/%)
install-lib$(NAME)-shared: $(SUBDIR)$(SLIBNAME)
$(Q)mkdir -p "$(SHLIBDIR)"
@@ -83,15 +93,15 @@ uninstall-libs::
-$(RM) "$(LIBDIR)/$(LIBNAME)"
uninstall-headers::
- $(RM) $(addprefix "$(INCINSTDIR)/",$(HEADERS))
+ $(RM) $(addprefix "$(INCINSTDIR)/",$(HEADERS) $(BUILT_HEADERS))
$(RM) "$(LIBDIR)/pkgconfig/lib$(NAME).pc"
- -rmdir "$(INCDIR)"
+ -rmdir "$(INCINSTDIR)"
endef
$(eval $(RULES))
-$(EXAMPLES) $(TESTPROGS) $(TOOLS): $(THIS_LIB) $(DEP_LIBS)
-$(TESTPROGS): $(SUBDIR)$(LIBNAME)
+$(EXAMPLES) $(TOOLS): $(DEP_LIBS) $(SUBDIR)$($(CONFIG_SHARED:yes=S)LIBNAME)
+$(TESTPROGS): $(DEP_LIBS) $(SUBDIR)$(LIBNAME)
examples: $(EXAMPLES)
testprogs: $(TESTPROGS)
diff --git a/gst-libs/ext/libav/libswscale/Makefile b/gst-libs/ext/libav/libswscale/Makefile
index bef4200..0799b45 100644
--- a/gst-libs/ext/libav/libswscale/Makefile
+++ b/gst-libs/ext/libav/libswscale/Makefile
@@ -1,26 +1,17 @@
NAME = swscale
FFLIBS = avutil
-HEADERS = swscale.h
+HEADERS = swscale.h \
+ version.h \
-OBJS = options.o rgb2rgb.o swscale.o utils.o yuv2rgb.o \
- swscale_unscaled.o
+OBJS = input.o \
+ options.o \
+ output.o \
+ rgb2rgb.o \
+ swscale.o \
+ swscale_unscaled.o \
+ utils.o \
+ yuv2rgb.o \
-OBJS-$(ARCH_BFIN) += bfin/internal_bfin.o \
- bfin/swscale_bfin.o \
- bfin/yuv2rgb_bfin.o
-OBJS-$(CONFIG_MLIB) += mlib/yuv2rgb_mlib.o
-OBJS-$(HAVE_ALTIVEC) += ppc/swscale_altivec.o \
- ppc/yuv2rgb_altivec.o \
- ppc/yuv2yuv_altivec.o
-OBJS-$(HAVE_MMX) += x86/rgb2rgb.o \
- x86/swscale_mmx.o \
- x86/yuv2rgb_mmx.o
-OBJS-$(HAVE_VIS) += sparc/yuv2rgb_vis.o
-MMX-OBJS-$(HAVE_YASM) += x86/input.o \
- x86/output.o \
- x86/scale.o
-
-TESTPROGS = colorspace swscale
-
-DIRS = bfin mlib ppc sparc x86
+TESTPROGS = colorspace \
+ swscale \
diff --git a/gst-libs/ext/libav/libswscale/bfin/Makefile b/gst-libs/ext/libav/libswscale/bfin/Makefile
new file mode 100644
index 0000000..5f34550
--- /dev/null
+++ b/gst-libs/ext/libav/libswscale/bfin/Makefile
@@ -0,0 +1,3 @@
+OBJS += bfin/internal_bfin.o \
+ bfin/swscale_bfin.o \
+ bfin/yuv2rgb_bfin.o \
diff --git a/gst-libs/ext/libav/libswscale/bfin/internal_bfin.S b/gst-libs/ext/libav/libswscale/bfin/internal_bfin.S
index 9f985e7..b007f07 100644
--- a/gst-libs/ext/libav/libswscale/bfin/internal_bfin.S
+++ b/gst-libs/ext/libav/libswscale/bfin/internal_bfin.S
@@ -30,11 +30,11 @@ and converts it to RGB565. R:5 bits, G:6 bits, B:5 bits.. packed into shorts.
The following calculation is used for the conversion:
- r = clipz((y-oy)*cy + crv*(v-128))
- g = clipz((y-oy)*cy + cgv*(v-128) + cgu*(u-128))
- b = clipz((y-oy)*cy + cbu*(u-128))
+ r = clipz((y - oy) * cy + crv * (v - 128))
+ g = clipz((y - oy) * cy + cgv * (v - 128) + cgu * (u - 128))
+ b = clipz((y - oy) * cy + cbu * (u - 128))
-y,u,v are prescaled by a factor of 4 i.e. left-shifted to gain precision.
+y, u, v are prescaled by a factor of 4 i.e. left-shifted to gain precision.
New factorization to eliminate the truncation error which was
@@ -47,7 +47,7 @@ occurring due to the byteop3p.
2) Scale operands up by a factor of 4 not 8 because Blackfin
multiplies include a shift.
-3) Compute into the accumulators cy*yx0, cy*yx1.
+3) Compute into the accumulators cy * yx0, cy * yx1.
4) Compute each of the linear equations:
r = clipz((y - oy) * cy + crv * (v - 128))
@@ -73,7 +73,7 @@ occurring due to the byteop3p.
Where coeffs have the following layout in memory.
-uint32_t oy,oc,zero,cy,crv,rmask,cbu,bmask,cgu,cgv;
+uint32_t oy, oc, zero, cy, crv, rmask, cbu, bmask, cgu, cgv;
coeffs is a pointer to oy.
diff --git a/gst-libs/ext/libav/libswscale/bfin/swscale_bfin.c b/gst-libs/ext/libav/libswscale/bfin/swscale_bfin.c
index 0c5f004..9d0bbe3 100644
--- a/gst-libs/ext/libav/libswscale/bfin/swscale_bfin.c
+++ b/gst-libs/ext/libav/libswscale/bfin/swscale_bfin.c
@@ -20,39 +20,34 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <inttypes.h>
-#include <assert.h>
+#include <stdint.h>
+
#include "config.h"
-#include <unistd.h>
-#include "libswscale/rgb2rgb.h"
-#include "libswscale/swscale.h"
#include "libswscale/swscale_internal.h"
#if defined (__FDPIC__) && CONFIG_SRAM
-#define L1CODE __attribute__ ((l1_text))
+#define L1CODE __attribute__((l1_text))
#else
#define L1CODE
#endif
-int ff_bfin_uyvytoyv12(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
- int width, int height,
+int ff_bfin_uyvytoyv12(const uint8_t *src, uint8_t *ydst, uint8_t *udst,
+ uint8_t *vdst, int width, int height,
int lumStride, int chromStride, int srcStride) L1CODE;
-int ff_bfin_yuyvtoyv12(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
- int width, int height,
+int ff_bfin_yuyvtoyv12(const uint8_t *src, uint8_t *ydst, uint8_t *udst,
+ uint8_t *vdst, int width, int height,
int lumStride, int chromStride, int srcStride) L1CODE;
-static int uyvytoyv12_unscaled(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
- int srcSliceH, uint8_t* dst[], int dstStride[])
+static int uyvytoyv12_unscaled(SwsContext *c, const uint8_t *src[],
+ int srcStride[], int srcSliceY, int srcSliceH,
+ uint8_t *dst[], int dstStride[])
{
- uint8_t *dsty = dst[0] + dstStride[0]*srcSliceY;
- uint8_t *dstu = dst[1] + dstStride[1]*srcSliceY/2;
- uint8_t *dstv = dst[2] + dstStride[2]*srcSliceY/2;
- uint8_t *ip = src[0] + srcStride[0]*srcSliceY;
- int w = dstStride[0];
+ uint8_t *dsty = dst[0] + dstStride[0] * srcSliceY;
+ uint8_t *dstu = dst[1] + dstStride[1] * srcSliceY / 2;
+ uint8_t *dstv = dst[2] + dstStride[2] * srcSliceY / 2;
+ const uint8_t *ip = src[0] + srcStride[0] * srcSliceY;
+ int w = dstStride[0];
ff_bfin_uyvytoyv12(ip, dsty, dstu, dstv, w, srcSliceH,
dstStride[0], dstStride[1], srcStride[0]);
@@ -60,14 +55,15 @@ static int uyvytoyv12_unscaled(SwsContext *c, uint8_t* src[], int srcStride[], i
return srcSliceH;
}
-static int yuyvtoyv12_unscaled(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
- int srcSliceH, uint8_t* dst[], int dstStride[])
+static int yuyvtoyv12_unscaled(SwsContext *c, const uint8_t *src[],
+ int srcStride[], int srcSliceY, int srcSliceH,
+ uint8_t *dst[], int dstStride[])
{
- uint8_t *dsty = dst[0] + dstStride[0]*srcSliceY;
- uint8_t *dstu = dst[1] + dstStride[1]*srcSliceY/2;
- uint8_t *dstv = dst[2] + dstStride[2]*srcSliceY/2;
- uint8_t *ip = src[0] + srcStride[0]*srcSliceY;
- int w = dstStride[0];
+ uint8_t *dsty = dst[0] + dstStride[0] * srcSliceY;
+ uint8_t *dstu = dst[1] + dstStride[1] * srcSliceY / 2;
+ uint8_t *dstv = dst[2] + dstStride[2] * srcSliceY / 2;
+ const uint8_t *ip = src[0] + srcStride[0] * srcSliceY;
+ int w = dstStride[0];
ff_bfin_yuyvtoyv12(ip, dsty, dstu, dstv, w, srcSliceH,
dstStride[0], dstStride[1], srcStride[0]);
@@ -75,15 +71,16 @@ static int yuyvtoyv12_unscaled(SwsContext *c, uint8_t* src[], int srcStride[], i
return srcSliceH;
}
-
void ff_bfin_get_unscaled_swscale(SwsContext *c)
{
- if (c->dstFormat == PIX_FMT_YUV420P && c->srcFormat == PIX_FMT_UYVY422) {
- av_log (NULL, AV_LOG_VERBOSE, "selecting Blackfin optimized uyvytoyv12_unscaled\n");
+ if (c->dstFormat == AV_PIX_FMT_YUV420P && c->srcFormat == AV_PIX_FMT_UYVY422) {
+ av_log(NULL, AV_LOG_VERBOSE,
+ "selecting Blackfin optimized uyvytoyv12_unscaled\n");
c->swScale = uyvytoyv12_unscaled;
}
- if (c->dstFormat == PIX_FMT_YUV420P && c->srcFormat == PIX_FMT_YUYV422) {
- av_log (NULL, AV_LOG_VERBOSE, "selecting Blackfin optimized yuyvtoyv12_unscaled\n");
+ if (c->dstFormat == AV_PIX_FMT_YUV420P && c->srcFormat == AV_PIX_FMT_YUYV422) {
+ av_log(NULL, AV_LOG_VERBOSE,
+ "selecting Blackfin optimized yuyvtoyv12_unscaled\n");
c->swScale = yuyvtoyv12_unscaled;
}
}
diff --git a/gst-libs/ext/libav/libswscale/bfin/yuv2rgb_bfin.c b/gst-libs/ext/libav/libswscale/bfin/yuv2rgb_bfin.c
index 68af522..5b74c7a 100644
--- a/gst-libs/ext/libav/libswscale/bfin/yuv2rgb_bfin.c
+++ b/gst-libs/ext/libav/libswscale/bfin/yuv2rgb_bfin.c
@@ -21,47 +21,43 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <inttypes.h>
-#include <assert.h>
+#include <stdint.h>
+
#include "config.h"
-#include <unistd.h>
-#include "libswscale/rgb2rgb.h"
-#include "libswscale/swscale.h"
#include "libswscale/swscale_internal.h"
#if defined(__FDPIC__) && CONFIG_SRAM
-#define L1CODE __attribute__ ((l1_text))
+#define L1CODE __attribute__((l1_text))
#else
#define L1CODE
#endif
-void ff_bfin_yuv2rgb555_line(uint8_t *Y, uint8_t *U, uint8_t *V, uint8_t *out,
+void ff_bfin_yuv2rgb555_line(const uint8_t *Y, const uint8_t *U,
+ const uint8_t *V, uint8_t *out,
int w, uint32_t *coeffs) L1CODE;
-void ff_bfin_yuv2rgb565_line(uint8_t *Y, uint8_t *U, uint8_t *V, uint8_t *out,
+void ff_bfin_yuv2rgb565_line(const uint8_t *Y, const uint8_t *U,
+ const uint8_t *V, uint8_t *out,
int w, uint32_t *coeffs) L1CODE;
-void ff_bfin_yuv2rgb24_line(uint8_t *Y, uint8_t *U, uint8_t *V, uint8_t *out,
+void ff_bfin_yuv2rgb24_line(const uint8_t *Y, const uint8_t *U,
+ const uint8_t *V, uint8_t *out,
int w, uint32_t *coeffs) L1CODE;
-typedef void (* ltransform)(uint8_t *Y, uint8_t *U, uint8_t *V, uint8_t *out,
- int w, uint32_t *coeffs);
-
+typedef void (*ltransform)(const uint8_t *Y, const uint8_t *U, const uint8_t *V,
+ uint8_t *out, int w, uint32_t *coeffs);
static void bfin_prepare_coefficients(SwsContext *c, int rgb, int masks)
{
int oy;
- oy = c->yOffset&0xffff;
- oy = oy >> 3; // keep everything U8.0 for offset calculation
+ oy = c->yOffset & 0xffff;
+ oy = oy >> 3; // keep everything U8.0 for offset calculation
- c->oc = 128*0x01010101U;
- c->oy = oy*0x01010101U;
+ c->oc = 128 * 0x01010101U;
+ c->oy = oy * 0x01010101U;
/* copy 64bit vector coeffs down to 32bit vector coeffs */
- c->cy = c->yCoeff;
+ c->cy = c->yCoeff;
c->zero = 0;
if (rgb) {
@@ -76,7 +72,6 @@ static void bfin_prepare_coefficients(SwsContext *c, int rgb, int masks)
c->cgv = c->ugCoeff;
}
-
if (masks == 555) {
c->rmask = 0x001f * 0x00010001U;
c->gmask = 0x03e0 * 0x00010001U;
@@ -88,27 +83,26 @@ static void bfin_prepare_coefficients(SwsContext *c, int rgb, int masks)
}
}
-static int core_yuv420_rgb(SwsContext *c,
- uint8_t **in, int *instrides,
- int srcSliceY, int srcSliceH,
- uint8_t **oplanes, int *outstrides,
- ltransform lcscf, int rgb, int masks)
+static int core_yuv420_rgb(SwsContext *c, const uint8_t **in, int *instrides,
+ int srcSliceY, int srcSliceH, uint8_t **oplanes,
+ int *outstrides, ltransform lcscf,
+ int rgb, int masks)
{
- uint8_t *py,*pu,*pv,*op;
+ const uint8_t *py, *pu, *pv;
+ uint8_t *op;
int w = instrides[0];
- int h2 = srcSliceH>>1;
+ int h2 = srcSliceH >> 1;
int i;
bfin_prepare_coefficients(c, rgb, masks);
py = in[0];
- pu = in[1+(1^rgb)];
- pv = in[1+(0^rgb)];
+ pu = in[1 + (1 ^ rgb)];
+ pv = in[1 + (0 ^ rgb)];
- op = oplanes[0] + srcSliceY*outstrides[0];
-
- for (i=0;i<h2;i++) {
+ op = oplanes[0] + srcSliceY * outstrides[0];
+ for (i = 0; i < h2; i++) {
lcscf(py, pu, pv, op, w, &c->oy);
py += instrides[0];
@@ -125,9 +119,7 @@ static int core_yuv420_rgb(SwsContext *c,
return srcSliceH;
}
-
-static int bfin_yuv420_rgb555(SwsContext *c,
- uint8_t **in, int *instrides,
+static int bfin_yuv420_rgb555(SwsContext *c, const uint8_t **in, int *instrides,
int srcSliceY, int srcSliceH,
uint8_t **oplanes, int *outstrides)
{
@@ -135,8 +127,7 @@ static int bfin_yuv420_rgb555(SwsContext *c,
outstrides, ff_bfin_yuv2rgb555_line, 1, 555);
}
-static int bfin_yuv420_bgr555(SwsContext *c,
- uint8_t **in, int *instrides,
+static int bfin_yuv420_bgr555(SwsContext *c, const uint8_t **in, int *instrides,
int srcSliceY, int srcSliceH,
uint8_t **oplanes, int *outstrides)
{
@@ -144,8 +135,7 @@ static int bfin_yuv420_bgr555(SwsContext *c,
outstrides, ff_bfin_yuv2rgb555_line, 0, 555);
}
-static int bfin_yuv420_rgb24(SwsContext *c,
- uint8_t **in, int *instrides,
+static int bfin_yuv420_rgb24(SwsContext *c, const uint8_t **in, int *instrides,
int srcSliceY, int srcSliceH,
uint8_t **oplanes, int *outstrides)
{
@@ -153,8 +143,7 @@ static int bfin_yuv420_rgb24(SwsContext *c,
outstrides, ff_bfin_yuv2rgb24_line, 1, 888);
}
-static int bfin_yuv420_bgr24(SwsContext *c,
- uint8_t **in, int *instrides,
+static int bfin_yuv420_bgr24(SwsContext *c, const uint8_t **in, int *instrides,
int srcSliceY, int srcSliceH,
uint8_t **oplanes, int *outstrides)
{
@@ -162,8 +151,7 @@ static int bfin_yuv420_bgr24(SwsContext *c,
outstrides, ff_bfin_yuv2rgb24_line, 0, 888);
}
-static int bfin_yuv420_rgb565(SwsContext *c,
- uint8_t **in, int *instrides,
+static int bfin_yuv420_rgb565(SwsContext *c, const uint8_t **in, int *instrides,
int srcSliceY, int srcSliceH,
uint8_t **oplanes, int *outstrides)
{
@@ -171,8 +159,7 @@ static int bfin_yuv420_rgb565(SwsContext *c,
outstrides, ff_bfin_yuv2rgb565_line, 1, 565);
}
-static int bfin_yuv420_bgr565(SwsContext *c,
- uint8_t **in, int *instrides,
+static int bfin_yuv420_bgr565(SwsContext *c, const uint8_t **in, int *instrides,
int srcSliceY, int srcSliceH,
uint8_t **oplanes, int *outstrides)
{
@@ -180,24 +167,35 @@ static int bfin_yuv420_bgr565(SwsContext *c,
outstrides, ff_bfin_yuv2rgb565_line, 0, 565);
}
-
SwsFunc ff_yuv2rgb_get_func_ptr_bfin(SwsContext *c)
{
SwsFunc f;
- switch(c->dstFormat) {
- case PIX_FMT_RGB555: f = bfin_yuv420_rgb555; break;
- case PIX_FMT_BGR555: f = bfin_yuv420_bgr555; break;
- case PIX_FMT_RGB565: f = bfin_yuv420_rgb565; break;
- case PIX_FMT_BGR565: f = bfin_yuv420_bgr565; break;
- case PIX_FMT_RGB24: f = bfin_yuv420_rgb24; break;
- case PIX_FMT_BGR24: f = bfin_yuv420_bgr24; break;
+ switch (c->dstFormat) {
+ case AV_PIX_FMT_RGB555:
+ f = bfin_yuv420_rgb555;
+ break;
+ case AV_PIX_FMT_BGR555:
+ f = bfin_yuv420_bgr555;
+ break;
+ case AV_PIX_FMT_RGB565:
+ f = bfin_yuv420_rgb565;
+ break;
+ case AV_PIX_FMT_BGR565:
+ f = bfin_yuv420_bgr565;
+ break;
+ case AV_PIX_FMT_RGB24:
+ f = bfin_yuv420_rgb24;
+ break;
+ case AV_PIX_FMT_BGR24:
+ f = bfin_yuv420_bgr24;
+ break;
default:
return 0;
}
av_log(c, AV_LOG_INFO, "BlackFin accelerated color space converter %s\n",
- sws_format_name (c->dstFormat));
+ sws_format_name(c->dstFormat));
return f;
}
diff --git a/gst-libs/ext/libav/libswscale/colorspace-test.c b/gst-libs/ext/libav/libswscale/colorspace-test.c
index 10cee8a..fbf595d 100644
--- a/gst-libs/ext/libav/libswscale/colorspace-test.c
+++ b/gst-libs/ext/libav/libswscale/colorspace-test.c
@@ -20,12 +20,12 @@
#include <stdio.h>
#include <string.h> /* for memset() */
-#include <unistd.h>
#include <stdlib.h>
#include <inttypes.h>
#include "swscale.h"
#include "rgb2rgb.h"
+#include "libavutil/mem.h"
#define SIZE 1000
#define srcByte 0x55
@@ -33,7 +33,7 @@
#define FUNC(s, d, n) { s, d, #n, n }
-int main(int argc, char **argv)
+int main(void)
{
int i, funcNum;
uint8_t *srcBuffer = av_malloc(SIZE);
diff --git a/gst-libs/ext/libav/libswscale/input.c b/gst-libs/ext/libav/libswscale/input.c
new file mode 100644
index 0000000..2e8d43f
--- /dev/null
+++ b/gst-libs/ext/libav/libswscale/input.c
@@ -0,0 +1,1078 @@
+/*
+ * Copyright (C) 2001-2003 Michael Niedermayer <michaelni@gmx.at>
+ *
+ * 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
+ */
+
+#include <assert.h>
+#include <math.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "libavutil/avutil.h"
+#include "libavutil/bswap.h"
+#include "libavutil/cpu.h"
+#include "libavutil/intreadwrite.h"
+#include "libavutil/mathematics.h"
+#include "libavutil/pixdesc.h"
+#include "config.h"
+#include "rgb2rgb.h"
+#include "swscale.h"
+#include "swscale_internal.h"
+
+#define RGB2YUV_SHIFT 15
+#define BY ((int)(0.114 * 219 / 255 * (1 << RGB2YUV_SHIFT) + 0.5))
+#define BV (-(int)(0.081 * 224 / 255 * (1 << RGB2YUV_SHIFT) + 0.5))
+#define BU ((int)(0.500 * 224 / 255 * (1 << RGB2YUV_SHIFT) + 0.5))
+#define GY ((int)(0.587 * 219 / 255 * (1 << RGB2YUV_SHIFT) + 0.5))
+#define GV (-(int)(0.419 * 224 / 255 * (1 << RGB2YUV_SHIFT) + 0.5))
+#define GU (-(int)(0.331 * 224 / 255 * (1 << RGB2YUV_SHIFT) + 0.5))
+#define RY ((int)(0.299 * 219 / 255 * (1 << RGB2YUV_SHIFT) + 0.5))
+#define RV ((int)(0.500 * 224 / 255 * (1 << RGB2YUV_SHIFT) + 0.5))
+#define RU (-(int)(0.169 * 224 / 255 * (1 << RGB2YUV_SHIFT) + 0.5))
+
+#define input_pixel(pos) (isBE(origin) ? AV_RB16(pos) : AV_RL16(pos))
+
+#define r ((origin == AV_PIX_FMT_BGR48BE || origin == AV_PIX_FMT_BGR48LE) ? b_r : r_b)
+#define b ((origin == AV_PIX_FMT_BGR48BE || origin == AV_PIX_FMT_BGR48LE) ? r_b : b_r)
+
+static av_always_inline void rgb48ToY_c_template(uint16_t *dst,
+ const uint16_t *src, int width,
+ enum AVPixelFormat origin)
+{
+ int i;
+ for (i = 0; i < width; i++) {
+ unsigned int r_b = input_pixel(&src[i * 3 + 0]);
+ unsigned int g = input_pixel(&src[i * 3 + 1]);
+ unsigned int b_r = input_pixel(&src[i * 3 + 2]);
+
+ dst[i] = (RY * r + GY * g + BY * b + (0x2001 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT;
+ }
+}
+
+static av_always_inline void rgb48ToUV_c_template(uint16_t *dstU,
+ uint16_t *dstV,
+ const uint16_t *src1,
+ const uint16_t *src2,
+ int width,
+ enum AVPixelFormat origin)
+{
+ int i;
+ assert(src1 == src2);
+ for (i = 0; i < width; i++) {
+ int r_b = input_pixel(&src1[i * 3 + 0]);
+ int g = input_pixel(&src1[i * 3 + 1]);
+ int b_r = input_pixel(&src1[i * 3 + 2]);
+
+ dstU[i] = (RU * r + GU * g + BU * b + (0x10001 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT;
+ dstV[i] = (RV * r + GV * g + BV * b + (0x10001 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT;
+ }
+}
+
+static av_always_inline void rgb48ToUV_half_c_template(uint16_t *dstU,
+ uint16_t *dstV,
+ const uint16_t *src1,
+ const uint16_t *src2,
+ int width,
+ enum AVPixelFormat origin)
+{
+ int i;
+ assert(src1 == src2);
+ for (i = 0; i < width; i++) {
+ int r_b = (input_pixel(&src1[6 * i + 0]) +
+ input_pixel(&src1[6 * i + 3]) + 1) >> 1;
+ int g = (input_pixel(&src1[6 * i + 1]) +
+ input_pixel(&src1[6 * i + 4]) + 1) >> 1;
+ int b_r = (input_pixel(&src1[6 * i + 2]) +
+ input_pixel(&src1[6 * i + 5]) + 1) >> 1;
+
+ dstU[i] = (RU * r + GU * g + BU * b + (0x10001 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT;
+ dstV[i] = (RV * r + GV * g + BV * b + (0x10001 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT;
+ }
+}
+
+#undef r
+#undef b
+#undef input_pixel
+
+#define rgb48funcs(pattern, BE_LE, origin) \
+static void pattern ## 48 ## BE_LE ## ToY_c(uint8_t *_dst, \
+ const uint8_t *_src, \
+ int width, \
+ uint32_t *unused) \
+{ \
+ const uint16_t *src = (const uint16_t *)_src; \
+ uint16_t *dst = (uint16_t *)_dst; \
+ rgb48ToY_c_template(dst, src, width, origin); \
+} \
+ \
+static void pattern ## 48 ## BE_LE ## ToUV_c(uint8_t *_dstU, \
+ uint8_t *_dstV, \
+ const uint8_t *_src1, \
+ const uint8_t *_src2, \
+ int width, \
+ uint32_t *unused) \
+{ \
+ const uint16_t *src1 = (const uint16_t *)_src1, \
+ *src2 = (const uint16_t *)_src2; \
+ uint16_t *dstU = (uint16_t *)_dstU, \
+ *dstV = (uint16_t *)_dstV; \
+ rgb48ToUV_c_template(dstU, dstV, src1, src2, width, origin); \
+} \
+ \
+static void pattern ## 48 ## BE_LE ## ToUV_half_c(uint8_t *_dstU, \
+ uint8_t *_dstV, \
+ const uint8_t *_src1, \
+ const uint8_t *_src2, \
+ int width, \
+ uint32_t *unused) \
+{ \
+ const uint16_t *src1 = (const uint16_t *)_src1, \
+ *src2 = (const uint16_t *)_src2; \
+ uint16_t *dstU = (uint16_t *)_dstU, \
+ *dstV = (uint16_t *)_dstV; \
+ rgb48ToUV_half_c_template(dstU, dstV, src1, src2, width, origin); \
+}
+
+rgb48funcs(rgb, LE, AV_PIX_FMT_RGB48LE)
+rgb48funcs(rgb, BE, AV_PIX_FMT_RGB48BE)
+rgb48funcs(bgr, LE, AV_PIX_FMT_BGR48LE)
+rgb48funcs(bgr, BE, AV_PIX_FMT_BGR48BE)
+
+#define input_pixel(i) ((origin == AV_PIX_FMT_RGBA || \
+ origin == AV_PIX_FMT_BGRA || \
+ origin == AV_PIX_FMT_ARGB || \
+ origin == AV_PIX_FMT_ABGR) \
+ ? AV_RN32A(&src[(i) * 4]) \
+ : (isBE(origin) ? AV_RB16(&src[(i) * 2]) \
+ : AV_RL16(&src[(i) * 2])))
+
+static av_always_inline void rgb16_32ToY_c_template(uint8_t *dst,
+ const uint8_t *src,
+ int width,
+ enum AVPixelFormat origin,
+ int shr, int shg,
+ int shb, int shp,
+ int maskr, int maskg,
+ int maskb, int rsh,
+ int gsh, int bsh, int S)
+{
+ const int ry = RY << rsh, gy = GY << gsh, by = BY << bsh;
+ const unsigned rnd = 33u << (S - 1);
+ int i;
+
+ for (i = 0; i < width; i++) {
+ int px = input_pixel(i) >> shp;
+ int b = (px & maskb) >> shb;
+ int g = (px & maskg) >> shg;
+ int r = (px & maskr) >> shr;
+
+ dst[i] = (ry * r + gy * g + by * b + rnd) >> S;
+ }
+}
+
+static av_always_inline void rgb16_32ToUV_c_template(uint8_t *dstU,
+ uint8_t *dstV,
+ const uint8_t *src,
+ int width,
+ enum AVPixelFormat origin,
+ int shr, int shg,
+ int shb, int shp,
+ int maskr, int maskg,
+ int maskb, int rsh,
+ int gsh, int bsh, int S)
+{
+ const int ru = RU << rsh, gu = GU << gsh, bu = BU << bsh,
+ rv = RV << rsh, gv = GV << gsh, bv = BV << bsh;
+ const unsigned rnd = 257u << (S - 1);
+ int i;
+
+ for (i = 0; i < width; i++) {
+ int px = input_pixel(i) >> shp;
+ int b = (px & maskb) >> shb;
+ int g = (px & maskg) >> shg;
+ int r = (px & maskr) >> shr;
+
+ dstU[i] = (ru * r + gu * g + bu * b + rnd) >> S;
+ dstV[i] = (rv * r + gv * g + bv * b + rnd) >> S;
+ }
+}
+
+static av_always_inline void rgb16_32ToUV_half_c_template(uint8_t *dstU,
+ uint8_t *dstV,
+ const uint8_t *src,
+ int width,
+ enum AVPixelFormat origin,
+ int shr, int shg,
+ int shb, int shp,
+ int maskr, int maskg,
+ int maskb, int rsh,
+ int gsh, int bsh, int S)
+{
+ const int ru = RU << rsh, gu = GU << gsh, bu = BU << bsh,
+ rv = RV << rsh, gv = GV << gsh, bv = BV << bsh,
+ maskgx = ~(maskr | maskb);
+ const unsigned rnd = 257u << S;
+ int i;
+
+ maskr |= maskr << 1;
+ maskb |= maskb << 1;
+ maskg |= maskg << 1;
+ for (i = 0; i < width; i++) {
+ int px0 = input_pixel(2 * i + 0) >> shp;
+ int px1 = input_pixel(2 * i + 1) >> shp;
+ int b, r, g = (px0 & maskgx) + (px1 & maskgx);
+ int rb = px0 + px1 - g;
+
+ b = (rb & maskb) >> shb;
+ if (shp ||
+ origin == AV_PIX_FMT_BGR565LE || origin == AV_PIX_FMT_BGR565BE ||
+ origin == AV_PIX_FMT_RGB565LE || origin == AV_PIX_FMT_RGB565BE) {
+ g >>= shg;
+ } else {
+ g = (g & maskg) >> shg;
+ }
+ r = (rb & maskr) >> shr;
+
+ dstU[i] = (ru * r + gu * g + bu * b + rnd) >> (S + 1);
+ dstV[i] = (rv * r + gv * g + bv * b + rnd) >> (S + 1);
+ }
+}
+
+#undef input_pixel
+
+#define rgb16_32_wrapper(fmt, name, shr, shg, shb, shp, maskr, \
+ maskg, maskb, rsh, gsh, bsh, S) \
+static void name ## ToY_c(uint8_t *dst, const uint8_t *src, \
+ int width, uint32_t *unused) \
+{ \
+ rgb16_32ToY_c_template(dst, src, width, fmt, shr, shg, shb, shp, \
+ maskr, maskg, maskb, rsh, gsh, bsh, S); \
+} \
+ \
+static void name ## ToUV_c(uint8_t *dstU, uint8_t *dstV, \
+ const uint8_t *src, const uint8_t *dummy, \
+ int width, uint32_t *unused) \
+{ \
+ rgb16_32ToUV_c_template(dstU, dstV, src, width, fmt, \
+ shr, shg, shb, shp, \
+ maskr, maskg, maskb, rsh, gsh, bsh, S); \
+} \
+ \
+static void name ## ToUV_half_c(uint8_t *dstU, uint8_t *dstV, \
+ const uint8_t *src, \
+ const uint8_t *dummy, \
+ int width, uint32_t *unused) \
+{ \
+ rgb16_32ToUV_half_c_template(dstU, dstV, src, width, fmt, \
+ shr, shg, shb, shp, \
+ maskr, maskg, maskb, \
+ rsh, gsh, bsh, S); \
+}
+
+rgb16_32_wrapper(AV_PIX_FMT_BGR32, bgr32, 16, 0, 0, 0, 0xFF0000, 0xFF00, 0x00FF, 8, 0, 8, RGB2YUV_SHIFT + 8)
+rgb16_32_wrapper(AV_PIX_FMT_BGR32_1, bgr321, 16, 0, 0, 8, 0xFF0000, 0xFF00, 0x00FF, 8, 0, 8, RGB2YUV_SHIFT + 8)
+rgb16_32_wrapper(AV_PIX_FMT_RGB32, rgb32, 0, 0, 16, 0, 0x00FF, 0xFF00, 0xFF0000, 8, 0, 8, RGB2YUV_SHIFT + 8)
+rgb16_32_wrapper(AV_PIX_FMT_RGB32_1, rgb321, 0, 0, 16, 8, 0x00FF, 0xFF00, 0xFF0000, 8, 0, 8, RGB2YUV_SHIFT + 8)
+rgb16_32_wrapper(AV_PIX_FMT_BGR565LE, bgr16le, 0, 0, 0, 0, 0x001F, 0x07E0, 0xF800, 11, 5, 0, RGB2YUV_SHIFT + 8)
+rgb16_32_wrapper(AV_PIX_FMT_BGR555LE, bgr15le, 0, 0, 0, 0, 0x001F, 0x03E0, 0x7C00, 10, 5, 0, RGB2YUV_SHIFT + 7)
+rgb16_32_wrapper(AV_PIX_FMT_BGR444LE, bgr12le, 0, 0, 0, 0, 0x000F, 0x00F0, 0x0F00, 8, 4, 0, RGB2YUV_SHIFT + 4)
+rgb16_32_wrapper(AV_PIX_FMT_RGB565LE, rgb16le, 0, 0, 0, 0, 0xF800, 0x07E0, 0x001F, 0, 5, 11, RGB2YUV_SHIFT + 8)
+rgb16_32_wrapper(AV_PIX_FMT_RGB555LE, rgb15le, 0, 0, 0, 0, 0x7C00, 0x03E0, 0x001F, 0, 5, 10, RGB2YUV_SHIFT + 7)
+rgb16_32_wrapper(AV_PIX_FMT_RGB444LE, rgb12le, 0, 0, 0, 0, 0x0F00, 0x00F0, 0x000F, 0, 4, 8, RGB2YUV_SHIFT + 4)
+rgb16_32_wrapper(AV_PIX_FMT_BGR565BE, bgr16be, 0, 0, 0, 0, 0x001F, 0x07E0, 0xF800, 11, 5, 0, RGB2YUV_SHIFT + 8)
+rgb16_32_wrapper(AV_PIX_FMT_BGR555BE, bgr15be, 0, 0, 0, 0, 0x001F, 0x03E0, 0x7C00, 10, 5, 0, RGB2YUV_SHIFT + 7)
+rgb16_32_wrapper(AV_PIX_FMT_BGR444BE, bgr12be, 0, 0, 0, 0, 0x000F, 0x00F0, 0x0F00, 8, 4, 0, RGB2YUV_SHIFT + 4)
+rgb16_32_wrapper(AV_PIX_FMT_RGB565BE, rgb16be, 0, 0, 0, 0, 0xF800, 0x07E0, 0x001F, 0, 5, 11, RGB2YUV_SHIFT + 8)
+rgb16_32_wrapper(AV_PIX_FMT_RGB555BE, rgb15be, 0, 0, 0, 0, 0x7C00, 0x03E0, 0x001F, 0, 5, 10, RGB2YUV_SHIFT + 7)
+rgb16_32_wrapper(AV_PIX_FMT_RGB444BE, rgb12be, 0, 0, 0, 0, 0x0F00, 0x00F0, 0x000F, 0, 4, 8, RGB2YUV_SHIFT + 4)
+
+static void abgrToA_c(uint8_t *dst, const uint8_t *src, int width,
+ uint32_t *unused)
+{
+ int i;
+ for (i = 0; i < width; i++)
+ dst[i] = src[4 * i];
+}
+
+static void rgbaToA_c(uint8_t *dst, const uint8_t *src, int width,
+ uint32_t *unused)
+{
+ int i;
+ for (i = 0; i < width; i++)
+ dst[i] = src[4 * i + 3];
+}
+
+static void palToY_c(uint8_t *dst, const uint8_t *src, int width, uint32_t *pal)
+{
+ int i;
+ for (i = 0; i < width; i++) {
+ int d = src[i];
+
+ dst[i] = pal[d] & 0xFF;
+ }
+}
+
+static void palToUV_c(uint8_t *dstU, uint8_t *dstV,
+ const uint8_t *src1, const uint8_t *src2,
+ int width, uint32_t *pal)
+{
+ int i;
+ assert(src1 == src2);
+ for (i = 0; i < width; i++) {
+ int p = pal[src1[i]];
+
+ dstU[i] = p >> 8;
+ dstV[i] = p >> 16;
+ }
+}
+
+static void monowhite2Y_c(uint8_t *dst, const uint8_t *src,
+ int width, uint32_t *unused)
+{
+ int i, j;
+ width = (width + 7) >> 3;
+ for (i = 0; i < width; i++) {
+ int d = ~src[i];
+ for (j = 0; j < 8; j++)
+ dst[8 * i + j] = ((d >> (7 - j)) & 1) * 255;
+ }
+}
+
+static void monoblack2Y_c(uint8_t *dst, const uint8_t *src,
+ int width, uint32_t *unused)
+{
+ int i, j;
+ width = (width + 7) >> 3;
+ for (i = 0; i < width; i++) {
+ int d = src[i];
+ for (j = 0; j < 8; j++)
+ dst[8 * i + j] = ((d >> (7 - j)) & 1) * 255;
+ }
+}
+
+static void yuy2ToY_c(uint8_t *dst, const uint8_t *src, int width,
+ uint32_t *unused)
+{
+ int i;
+ for (i = 0; i < width; i++)
+ dst[i] = src[2 * i];
+}
+
+static void yuy2ToUV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *src1,
+ const uint8_t *src2, int width, uint32_t *unused)
+{
+ int i;
+ for (i = 0; i < width; i++) {
+ dstU[i] = src1[4 * i + 1];
+ dstV[i] = src1[4 * i + 3];
+ }
+ assert(src1 == src2);
+}
+
+static void bswap16Y_c(uint8_t *_dst, const uint8_t *_src, int width,
+ uint32_t *unused)
+{
+ int i;
+ const uint16_t *src = (const uint16_t *)_src;
+ uint16_t *dst = (uint16_t *)_dst;
+ for (i = 0; i < width; i++)
+ dst[i] = av_bswap16(src[i]);
+}
+
+static void bswap16UV_c(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *_src1,
+ const uint8_t *_src2, int width, uint32_t *unused)
+{
+ int i;
+ const uint16_t *src1 = (const uint16_t *)_src1,
+ *src2 = (const uint16_t *)_src2;
+ uint16_t *dstU = (uint16_t *)_dstU, *dstV = (uint16_t *)_dstV;
+ for (i = 0; i < width; i++) {
+ dstU[i] = av_bswap16(src1[i]);
+ dstV[i] = av_bswap16(src2[i]);
+ }
+}
+
+/* This is almost identical to the previous, end exists only because
+ * yuy2ToY/UV)(dst, src + 1, ...) would have 100% unaligned accesses. */
+static void uyvyToY_c(uint8_t *dst, const uint8_t *src, int width,
+ uint32_t *unused)
+{
+ int i;
+ for (i = 0; i < width; i++)
+ dst[i] = src[2 * i + 1];
+}
+
+static void uyvyToUV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *src1,
+ const uint8_t *src2, int width, uint32_t *unused)
+{
+ int i;
+ for (i = 0; i < width; i++) {
+ dstU[i] = src1[4 * i + 0];
+ dstV[i] = src1[4 * i + 2];
+ }
+ assert(src1 == src2);
+}
+
+static av_always_inline void nvXXtoUV_c(uint8_t *dst1, uint8_t *dst2,
+ const uint8_t *src, int width)
+{
+ int i;
+ for (i = 0; i < width; i++) {
+ dst1[i] = src[2 * i + 0];
+ dst2[i] = src[2 * i + 1];
+ }
+}
+
+static void nv12ToUV_c(uint8_t *dstU, uint8_t *dstV,
+ const uint8_t *src1, const uint8_t *src2,
+ int width, uint32_t *unused)
+{
+ nvXXtoUV_c(dstU, dstV, src1, width);
+}
+
+static void nv21ToUV_c(uint8_t *dstU, uint8_t *dstV,
+ const uint8_t *src1, const uint8_t *src2,
+ int width, uint32_t *unused)
+{
+ nvXXtoUV_c(dstV, dstU, src1, width);
+}
+
+#define input_pixel(pos) (isBE(origin) ? AV_RB16(pos) : AV_RL16(pos))
+
+static void bgr24ToY_c(uint8_t *dst, const uint8_t *src,
+ int width, uint32_t *unused)
+{
+ int i;
+ for (i = 0; i < width; i++) {
+ int b = src[i * 3 + 0];
+ int g = src[i * 3 + 1];
+ int r = src[i * 3 + 2];
+
+ dst[i] = ((RY * r + GY * g + BY * b + (33 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT);
+ }
+}
+
+static void bgr24ToUV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *src1,
+ const uint8_t *src2, int width, uint32_t *unused)
+{
+ int i;
+ for (i = 0; i < width; i++) {
+ int b = src1[3 * i + 0];
+ int g = src1[3 * i + 1];
+ int r = src1[3 * i + 2];
+
+ dstU[i] = (RU * r + GU * g + BU * b + (257 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT;
+ dstV[i] = (RV * r + GV * g + BV * b + (257 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT;
+ }
+ assert(src1 == src2);
+}
+
+static void bgr24ToUV_half_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *src1,
+ const uint8_t *src2, int width, uint32_t *unused)
+{
+ int i;
+ for (i = 0; i < width; i++) {
+ int b = src1[6 * i + 0] + src1[6 * i + 3];
+ int g = src1[6 * i + 1] + src1[6 * i + 4];
+ int r = src1[6 * i + 2] + src1[6 * i + 5];
+
+ dstU[i] = (RU * r + GU * g + BU * b + (257 << RGB2YUV_SHIFT)) >> (RGB2YUV_SHIFT + 1);
+ dstV[i] = (RV * r + GV * g + BV * b + (257 << RGB2YUV_SHIFT)) >> (RGB2YUV_SHIFT + 1);
+ }
+ assert(src1 == src2);
+}
+
+static void rgb24ToY_c(uint8_t *dst, const uint8_t *src, int width,
+ uint32_t *unused)
+{
+ int i;
+ for (i = 0; i < width; i++) {
+ int r = src[i * 3 + 0];
+ int g = src[i * 3 + 1];
+ int b = src[i * 3 + 2];
+
+ dst[i] = ((RY * r + GY * g + BY * b + (33 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT);
+ }
+}
+
+static void rgb24ToUV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *src1,
+ const uint8_t *src2, int width, uint32_t *unused)
+{
+ int i;
+ assert(src1 == src2);
+ for (i = 0; i < width; i++) {
+ int r = src1[3 * i + 0];
+ int g = src1[3 * i + 1];
+ int b = src1[3 * i + 2];
+
+ dstU[i] = (RU * r + GU * g + BU * b + (257 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT;
+ dstV[i] = (RV * r + GV * g + BV * b + (257 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT;
+ }
+}
+
+static void rgb24ToUV_half_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *src1,
+ const uint8_t *src2, int width, uint32_t *unused)
+{
+ int i;
+ assert(src1 == src2);
+ for (i = 0; i < width; i++) {
+ int r = src1[6 * i + 0] + src1[6 * i + 3];
+ int g = src1[6 * i + 1] + src1[6 * i + 4];
+ int b = src1[6 * i + 2] + src1[6 * i + 5];
+
+ dstU[i] = (RU * r + GU * g + BU * b + (257 << RGB2YUV_SHIFT)) >> (RGB2YUV_SHIFT + 1);
+ dstV[i] = (RV * r + GV * g + BV * b + (257 << RGB2YUV_SHIFT)) >> (RGB2YUV_SHIFT + 1);
+ }
+}
+
+static void planar_rgb_to_y(uint8_t *dst, const uint8_t *src[4], int width)
+{
+ int i;
+ for (i = 0; i < width; i++) {
+ int g = src[0][i];
+ int b = src[1][i];
+ int r = src[2][i];
+
+ dst[i] = ((RY * r + GY * g + BY * b + (33 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT);
+ }
+}
+
+static void planar_rgb_to_uv(uint8_t *dstU, uint8_t *dstV, const uint8_t *src[4], int width)
+{
+ int i;
+ for (i = 0; i < width; i++) {
+ int g = src[0][i];
+ int b = src[1][i];
+ int r = src[2][i];
+
+ dstU[i] = (RU * r + GU * g + BU * b + (257 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT;
+ dstV[i] = (RV * r + GV * g + BV * b + (257 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT;
+ }
+}
+
+#define rdpx(src) \
+ is_be ? AV_RB16(src) : AV_RL16(src)
+static av_always_inline void planar_rgb16_to_y(uint8_t *_dst, const uint8_t *_src[4],
+ int width, int bpc, int is_be)
+{
+ int i;
+ const uint16_t **src = (const uint16_t **)_src;
+ uint16_t *dst = (uint16_t *)_dst;
+ for (i = 0; i < width; i++) {
+ int g = rdpx(src[0] + i);
+ int b = rdpx(src[1] + i);
+ int r = rdpx(src[2] + i);
+
+ dst[i] = ((RY * r + GY * g + BY * b + (33 << (RGB2YUV_SHIFT + bpc - 9))) >> RGB2YUV_SHIFT);
+ }
+}
+
+static void planar_rgb9le_to_y(uint8_t *dst, const uint8_t *src[4], int w)
+{
+ planar_rgb16_to_y(dst, src, w, 9, 0);
+}
+
+static void planar_rgb9be_to_y(uint8_t *dst, const uint8_t *src[4], int w)
+{
+ planar_rgb16_to_y(dst, src, w, 9, 1);
+}
+
+static void planar_rgb10le_to_y(uint8_t *dst, const uint8_t *src[4], int w)
+{
+ planar_rgb16_to_y(dst, src, w, 10, 0);
+}
+
+static void planar_rgb10be_to_y(uint8_t *dst, const uint8_t *src[4], int w)
+{
+ planar_rgb16_to_y(dst, src, w, 10, 1);
+}
+
+static void planar_rgb16le_to_y(uint8_t *dst, const uint8_t *src[4], int w)
+{
+ planar_rgb16_to_y(dst, src, w, 16, 0);
+}
+
+static void planar_rgb16be_to_y(uint8_t *dst, const uint8_t *src[4], int w)
+{
+ planar_rgb16_to_y(dst, src, w, 16, 1);
+}
+
+static av_always_inline void planar_rgb16_to_uv(uint8_t *_dstU, uint8_t *_dstV,
+ const uint8_t *_src[4], int width,
+ int bpc, int is_be)
+{
+ int i;
+ const uint16_t **src = (const uint16_t **)_src;
+ uint16_t *dstU = (uint16_t *)_dstU;
+ uint16_t *dstV = (uint16_t *)_dstV;
+ for (i = 0; i < width; i++) {
+ int g = rdpx(src[0] + i);
+ int b = rdpx(src[1] + i);
+ int r = rdpx(src[2] + i);
+
+ dstU[i] = (RU * r + GU * g + BU * b + (257 << (RGB2YUV_SHIFT + bpc - 9))) >> RGB2YUV_SHIFT;
+ dstV[i] = (RV * r + GV * g + BV * b + (257 << (RGB2YUV_SHIFT + bpc - 9))) >> RGB2YUV_SHIFT;
+ }
+}
+#undef rdpx
+
+static void planar_rgb9le_to_uv(uint8_t *dstU, uint8_t *dstV,
+ const uint8_t *src[4], int w)
+{
+ planar_rgb16_to_uv(dstU, dstV, src, w, 9, 0);
+}
+
+static void planar_rgb9be_to_uv(uint8_t *dstU, uint8_t *dstV,
+ const uint8_t *src[4], int w)
+{
+ planar_rgb16_to_uv(dstU, dstV, src, w, 9, 1);
+}
+
+static void planar_rgb10le_to_uv(uint8_t *dstU, uint8_t *dstV,
+ const uint8_t *src[4], int w)
+{
+ planar_rgb16_to_uv(dstU, dstV, src, w, 10, 0);
+}
+
+static void planar_rgb10be_to_uv(uint8_t *dstU, uint8_t *dstV,
+ const uint8_t *src[4], int w)
+{
+ planar_rgb16_to_uv(dstU, dstV, src, w, 10, 1);
+}
+
+static void planar_rgb16le_to_uv(uint8_t *dstU, uint8_t *dstV,
+ const uint8_t *src[4], int w)
+{
+ planar_rgb16_to_uv(dstU, dstV, src, w, 16, 0);
+}
+
+static void planar_rgb16be_to_uv(uint8_t *dstU, uint8_t *dstV,
+ const uint8_t *src[4], int w)
+{
+ planar_rgb16_to_uv(dstU, dstV, src, w, 16, 1);
+}
+
+av_cold void ff_sws_init_input_funcs(SwsContext *c)
+{
+ enum AVPixelFormat srcFormat = c->srcFormat;
+
+ c->chrToYV12 = NULL;
+ switch (srcFormat) {
+ case AV_PIX_FMT_YUYV422:
+ c->chrToYV12 = yuy2ToUV_c;
+ break;
+ case AV_PIX_FMT_UYVY422:
+ c->chrToYV12 = uyvyToUV_c;
+ break;
+ case AV_PIX_FMT_NV12:
+ c->chrToYV12 = nv12ToUV_c;
+ break;
+ case AV_PIX_FMT_NV21:
+ c->chrToYV12 = nv21ToUV_c;
+ break;
+ case AV_PIX_FMT_RGB8:
+ case AV_PIX_FMT_BGR8:
+ case AV_PIX_FMT_PAL8:
+ case AV_PIX_FMT_BGR4_BYTE:
+ case AV_PIX_FMT_RGB4_BYTE:
+ c->chrToYV12 = palToUV_c;
+ break;
+ case AV_PIX_FMT_GBRP9LE:
+ c->readChrPlanar = planar_rgb9le_to_uv;
+ break;
+ case AV_PIX_FMT_GBRP10LE:
+ c->readChrPlanar = planar_rgb10le_to_uv;
+ break;
+ case AV_PIX_FMT_GBRP16LE:
+ c->readChrPlanar = planar_rgb16le_to_uv;
+ break;
+ case AV_PIX_FMT_GBRP9BE:
+ c->readChrPlanar = planar_rgb9be_to_uv;
+ break;
+ case AV_PIX_FMT_GBRP10BE:
+ c->readChrPlanar = planar_rgb10be_to_uv;
+ break;
+ case AV_PIX_FMT_GBRP16BE:
+ c->readChrPlanar = planar_rgb16be_to_uv;
+ break;
+ case AV_PIX_FMT_GBRP:
+ c->readChrPlanar = planar_rgb_to_uv;
+ break;
+#if HAVE_BIGENDIAN
+ case AV_PIX_FMT_YUV444P9LE:
+ case AV_PIX_FMT_YUV422P9LE:
+ case AV_PIX_FMT_YUV420P9LE:
+ case AV_PIX_FMT_YUV422P10LE:
+ case AV_PIX_FMT_YUV444P10LE:
+ case AV_PIX_FMT_YUV420P10LE:
+ case AV_PIX_FMT_YUV420P16LE:
+ case AV_PIX_FMT_YUV422P16LE:
+ case AV_PIX_FMT_YUV444P16LE:
+ case AV_PIX_FMT_YUVA444P9LE:
+ case AV_PIX_FMT_YUVA422P9LE:
+ case AV_PIX_FMT_YUVA420P9LE:
+ case AV_PIX_FMT_YUVA422P10LE:
+ case AV_PIX_FMT_YUVA444P10LE:
+ case AV_PIX_FMT_YUVA420P10LE:
+ case AV_PIX_FMT_YUVA420P16LE:
+ case AV_PIX_FMT_YUVA422P16LE:
+ case AV_PIX_FMT_YUVA444P16LE:
+ c->chrToYV12 = bswap16UV_c;
+ break;
+#else
+ case AV_PIX_FMT_YUV444P9BE:
+ case AV_PIX_FMT_YUV422P9BE:
+ case AV_PIX_FMT_YUV420P9BE:
+ case AV_PIX_FMT_YUV444P10BE:
+ case AV_PIX_FMT_YUV422P10BE:
+ case AV_PIX_FMT_YUV420P10BE:
+ case AV_PIX_FMT_YUV420P16BE:
+ case AV_PIX_FMT_YUV422P16BE:
+ case AV_PIX_FMT_YUV444P16BE:
+ case AV_PIX_FMT_YUVA444P9BE:
+ case AV_PIX_FMT_YUVA422P9BE:
+ case AV_PIX_FMT_YUVA420P9BE:
+ case AV_PIX_FMT_YUVA422P10BE:
+ case AV_PIX_FMT_YUVA444P10BE:
+ case AV_PIX_FMT_YUVA420P10BE:
+ case AV_PIX_FMT_YUVA420P16BE:
+ case AV_PIX_FMT_YUVA422P16BE:
+ case AV_PIX_FMT_YUVA444P16BE:
+ c->chrToYV12 = bswap16UV_c;
+ break;
+#endif
+ }
+ if (c->chrSrcHSubSample) {
+ switch (srcFormat) {
+ case AV_PIX_FMT_RGB48BE:
+ c->chrToYV12 = rgb48BEToUV_half_c;
+ break;
+ case AV_PIX_FMT_RGB48LE:
+ c->chrToYV12 = rgb48LEToUV_half_c;
+ break;
+ case AV_PIX_FMT_BGR48BE:
+ c->chrToYV12 = bgr48BEToUV_half_c;
+ break;
+ case AV_PIX_FMT_BGR48LE:
+ c->chrToYV12 = bgr48LEToUV_half_c;
+ break;
+ case AV_PIX_FMT_RGB32:
+ c->chrToYV12 = bgr32ToUV_half_c;
+ break;
+ case AV_PIX_FMT_RGB32_1:
+ c->chrToYV12 = bgr321ToUV_half_c;
+ break;
+ case AV_PIX_FMT_BGR24:
+ c->chrToYV12 = bgr24ToUV_half_c;
+ break;
+ case AV_PIX_FMT_BGR565LE:
+ c->chrToYV12 = bgr16leToUV_half_c;
+ break;
+ case AV_PIX_FMT_BGR565BE:
+ c->chrToYV12 = bgr16beToUV_half_c;
+ break;
+ case AV_PIX_FMT_BGR555LE:
+ c->chrToYV12 = bgr15leToUV_half_c;
+ break;
+ case AV_PIX_FMT_BGR555BE:
+ c->chrToYV12 = bgr15beToUV_half_c;
+ break;
+ case AV_PIX_FMT_BGR444LE:
+ c->chrToYV12 = bgr12leToUV_half_c;
+ break;
+ case AV_PIX_FMT_BGR444BE:
+ c->chrToYV12 = bgr12beToUV_half_c;
+ break;
+ case AV_PIX_FMT_BGR32:
+ c->chrToYV12 = rgb32ToUV_half_c;
+ break;
+ case AV_PIX_FMT_BGR32_1:
+ c->chrToYV12 = rgb321ToUV_half_c;
+ break;
+ case AV_PIX_FMT_RGB24:
+ c->chrToYV12 = rgb24ToUV_half_c;
+ break;
+ case AV_PIX_FMT_RGB565LE:
+ c->chrToYV12 = rgb16leToUV_half_c;
+ break;
+ case AV_PIX_FMT_RGB565BE:
+ c->chrToYV12 = rgb16beToUV_half_c;
+ break;
+ case AV_PIX_FMT_RGB555LE:
+ c->chrToYV12 = rgb15leToUV_half_c;
+ break;
+ case AV_PIX_FMT_RGB555BE:
+ c->chrToYV12 = rgb15beToUV_half_c;
+ break;
+ case AV_PIX_FMT_RGB444LE:
+ c->chrToYV12 = rgb12leToUV_half_c;
+ break;
+ case AV_PIX_FMT_RGB444BE:
+ c->chrToYV12 = rgb12beToUV_half_c;
+ break;
+ }
+ } else {
+ switch (srcFormat) {
+ case AV_PIX_FMT_RGB48BE:
+ c->chrToYV12 = rgb48BEToUV_c;
+ break;
+ case AV_PIX_FMT_RGB48LE:
+ c->chrToYV12 = rgb48LEToUV_c;
+ break;
+ case AV_PIX_FMT_BGR48BE:
+ c->chrToYV12 = bgr48BEToUV_c;
+ break;
+ case AV_PIX_FMT_BGR48LE:
+ c->chrToYV12 = bgr48LEToUV_c;
+ break;
+ case AV_PIX_FMT_RGB32:
+ c->chrToYV12 = bgr32ToUV_c;
+ break;
+ case AV_PIX_FMT_RGB32_1:
+ c->chrToYV12 = bgr321ToUV_c;
+ break;
+ case AV_PIX_FMT_BGR24:
+ c->chrToYV12 = bgr24ToUV_c;
+ break;
+ case AV_PIX_FMT_BGR565LE:
+ c->chrToYV12 = bgr16leToUV_c;
+ break;
+ case AV_PIX_FMT_BGR565BE:
+ c->chrToYV12 = bgr16beToUV_c;
+ break;
+ case AV_PIX_FMT_BGR555LE:
+ c->chrToYV12 = bgr15leToUV_c;
+ break;
+ case AV_PIX_FMT_BGR555BE:
+ c->chrToYV12 = bgr15beToUV_c;
+ break;
+ case AV_PIX_FMT_BGR444LE:
+ c->chrToYV12 = bgr12leToUV_c;
+ break;
+ case AV_PIX_FMT_BGR444BE:
+ c->chrToYV12 = bgr12beToUV_c;
+ break;
+ case AV_PIX_FMT_BGR32:
+ c->chrToYV12 = rgb32ToUV_c;
+ break;
+ case AV_PIX_FMT_BGR32_1:
+ c->chrToYV12 = rgb321ToUV_c;
+ break;
+ case AV_PIX_FMT_RGB24:
+ c->chrToYV12 = rgb24ToUV_c;
+ break;
+ case AV_PIX_FMT_RGB565LE:
+ c->chrToYV12 = rgb16leToUV_c;
+ break;
+ case AV_PIX_FMT_RGB565BE:
+ c->chrToYV12 = rgb16beToUV_c;
+ break;
+ case AV_PIX_FMT_RGB555LE:
+ c->chrToYV12 = rgb15leToUV_c;
+ break;
+ case AV_PIX_FMT_RGB555BE:
+ c->chrToYV12 = rgb15beToUV_c;
+ break;
+ case AV_PIX_FMT_RGB444LE:
+ c->chrToYV12 = rgb12leToUV_c;
+ break;
+ case AV_PIX_FMT_RGB444BE:
+ c->chrToYV12 = rgb12beToUV_c;
+ break;
+ }
+ }
+
+ c->lumToYV12 = NULL;
+ c->alpToYV12 = NULL;
+ switch (srcFormat) {
+ case AV_PIX_FMT_GBRP9LE:
+ c->readLumPlanar = planar_rgb9le_to_y;
+ break;
+ case AV_PIX_FMT_GBRP10LE:
+ c->readLumPlanar = planar_rgb10le_to_y;
+ break;
+ case AV_PIX_FMT_GBRP16LE:
+ c->readLumPlanar = planar_rgb16le_to_y;
+ break;
+ case AV_PIX_FMT_GBRP9BE:
+ c->readLumPlanar = planar_rgb9be_to_y;
+ break;
+ case AV_PIX_FMT_GBRP10BE:
+ c->readLumPlanar = planar_rgb10be_to_y;
+ break;
+ case AV_PIX_FMT_GBRP16BE:
+ c->readLumPlanar = planar_rgb16be_to_y;
+ break;
+ case AV_PIX_FMT_GBRP:
+ c->readLumPlanar = planar_rgb_to_y;
+ break;
+#if HAVE_BIGENDIAN
+ case AV_PIX_FMT_YUV444P9LE:
+ case AV_PIX_FMT_YUV422P9LE:
+ case AV_PIX_FMT_YUV420P9LE:
+ case AV_PIX_FMT_YUV444P10LE:
+ case AV_PIX_FMT_YUV422P10LE:
+ case AV_PIX_FMT_YUV420P10LE:
+ case AV_PIX_FMT_YUV420P16LE:
+ case AV_PIX_FMT_YUV422P16LE:
+ case AV_PIX_FMT_YUV444P16LE:
+ case AV_PIX_FMT_GRAY16LE:
+ c->lumToYV12 = bswap16Y_c;
+ break;
+ case AV_PIX_FMT_YUVA444P9LE:
+ case AV_PIX_FMT_YUVA422P9LE:
+ case AV_PIX_FMT_YUVA420P9LE:
+ case AV_PIX_FMT_YUVA444P10LE:
+ case AV_PIX_FMT_YUVA422P10LE:
+ case AV_PIX_FMT_YUVA420P10LE:
+ case AV_PIX_FMT_YUVA420P16LE:
+ case AV_PIX_FMT_YUVA422P16LE:
+ case AV_PIX_FMT_YUVA444P16LE:
+ c->lumToYV12 = bswap16Y_c;
+ c->alpToYV12 = bswap16Y_c;
+ break;
+#else
+ case AV_PIX_FMT_YUV444P9BE:
+ case AV_PIX_FMT_YUV422P9BE:
+ case AV_PIX_FMT_YUV420P9BE:
+ case AV_PIX_FMT_YUV444P10BE:
+ case AV_PIX_FMT_YUV422P10BE:
+ case AV_PIX_FMT_YUV420P10BE:
+ case AV_PIX_FMT_YUV420P16BE:
+ case AV_PIX_FMT_YUV422P16BE:
+ case AV_PIX_FMT_YUV444P16BE:
+ case AV_PIX_FMT_GRAY16BE:
+ c->lumToYV12 = bswap16Y_c;
+ break;
+ case AV_PIX_FMT_YUVA444P9BE:
+ case AV_PIX_FMT_YUVA422P9BE:
+ case AV_PIX_FMT_YUVA420P9BE:
+ case AV_PIX_FMT_YUVA444P10BE:
+ case AV_PIX_FMT_YUVA422P10BE:
+ case AV_PIX_FMT_YUVA420P10BE:
+ case AV_PIX_FMT_YUVA420P16BE:
+ case AV_PIX_FMT_YUVA422P16BE:
+ case AV_PIX_FMT_YUVA444P16BE:
+ c->lumToYV12 = bswap16Y_c;
+ c->alpToYV12 = bswap16Y_c;
+ break;
+#endif
+ case AV_PIX_FMT_YUYV422:
+ case AV_PIX_FMT_Y400A:
+ c->lumToYV12 = yuy2ToY_c;
+ break;
+ case AV_PIX_FMT_UYVY422:
+ c->lumToYV12 = uyvyToY_c;
+ break;
+ case AV_PIX_FMT_BGR24:
+ c->lumToYV12 = bgr24ToY_c;
+ break;
+ case AV_PIX_FMT_BGR565LE:
+ c->lumToYV12 = bgr16leToY_c;
+ break;
+ case AV_PIX_FMT_BGR565BE:
+ c->lumToYV12 = bgr16beToY_c;
+ break;
+ case AV_PIX_FMT_BGR555LE:
+ c->lumToYV12 = bgr15leToY_c;
+ break;
+ case AV_PIX_FMT_BGR555BE:
+ c->lumToYV12 = bgr15beToY_c;
+ break;
+ case AV_PIX_FMT_BGR444LE:
+ c->lumToYV12 = bgr12leToY_c;
+ break;
+ case AV_PIX_FMT_BGR444BE:
+ c->lumToYV12 = bgr12beToY_c;
+ break;
+ case AV_PIX_FMT_RGB24:
+ c->lumToYV12 = rgb24ToY_c;
+ break;
+ case AV_PIX_FMT_RGB565LE:
+ c->lumToYV12 = rgb16leToY_c;
+ break;
+ case AV_PIX_FMT_RGB565BE:
+ c->lumToYV12 = rgb16beToY_c;
+ break;
+ case AV_PIX_FMT_RGB555LE:
+ c->lumToYV12 = rgb15leToY_c;
+ break;
+ case AV_PIX_FMT_RGB555BE:
+ c->lumToYV12 = rgb15beToY_c;
+ break;
+ case AV_PIX_FMT_RGB444LE:
+ c->lumToYV12 = rgb12leToY_c;
+ break;
+ case AV_PIX_FMT_RGB444BE:
+ c->lumToYV12 = rgb12beToY_c;
+ break;
+ case AV_PIX_FMT_RGB8:
+ case AV_PIX_FMT_BGR8:
+ case AV_PIX_FMT_PAL8:
+ case AV_PIX_FMT_BGR4_BYTE:
+ case AV_PIX_FMT_RGB4_BYTE:
+ c->lumToYV12 = palToY_c;
+ break;
+ case AV_PIX_FMT_MONOBLACK:
+ c->lumToYV12 = monoblack2Y_c;
+ break;
+ case AV_PIX_FMT_MONOWHITE:
+ c->lumToYV12 = monowhite2Y_c;
+ break;
+ case AV_PIX_FMT_RGB32:
+ c->lumToYV12 = bgr32ToY_c;
+ break;
+ case AV_PIX_FMT_RGB32_1:
+ c->lumToYV12 = bgr321ToY_c;
+ break;
+ case AV_PIX_FMT_BGR32:
+ c->lumToYV12 = rgb32ToY_c;
+ break;
+ case AV_PIX_FMT_BGR32_1:
+ c->lumToYV12 = rgb321ToY_c;
+ break;
+ case AV_PIX_FMT_RGB48BE:
+ c->lumToYV12 = rgb48BEToY_c;
+ break;
+ case AV_PIX_FMT_RGB48LE:
+ c->lumToYV12 = rgb48LEToY_c;
+ break;
+ case AV_PIX_FMT_BGR48BE:
+ c->lumToYV12 = bgr48BEToY_c;
+ break;
+ case AV_PIX_FMT_BGR48LE:
+ c->lumToYV12 = bgr48LEToY_c;
+ break;
+ }
+ if (c->alpPixBuf) {
+ switch (srcFormat) {
+ case AV_PIX_FMT_BGRA:
+ case AV_PIX_FMT_RGBA:
+ c->alpToYV12 = rgbaToA_c;
+ break;
+ case AV_PIX_FMT_ABGR:
+ case AV_PIX_FMT_ARGB:
+ c->alpToYV12 = abgrToA_c;
+ break;
+ case AV_PIX_FMT_Y400A:
+ c->alpToYV12 = uyvyToY_c;
+ break;
+ }
+ }
+}
diff --git a/gst-libs/ext/libav/libswscale/libswscale.v b/gst-libs/ext/libav/libswscale/libswscale.v
index c68f153..8b9a96a 100644
--- a/gst-libs/ext/libav/libswscale/libswscale.v
+++ b/gst-libs/ext/libav/libswscale/libswscale.v
@@ -1,4 +1,4 @@
LIBSWSCALE_$MAJOR {
- global: swscale_*; sws_*; ff_*;
+ global: swscale_*; sws_*;
local: *;
};
diff --git a/gst-libs/ext/libav/libswscale/mlib/yuv2rgb_mlib.c b/gst-libs/ext/libav/libswscale/mlib/yuv2rgb_mlib.c
deleted file mode 100644
index 526c975..0000000
--- a/gst-libs/ext/libav/libswscale/mlib/yuv2rgb_mlib.c
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * software YUV to RGB converter using mediaLib
- *
- * Copyright (C) 2003 Michael Niedermayer <michaelni@gmx.at>
- *
- * 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
- */
-
-#include <mlib_types.h>
-#include <mlib_status.h>
-#include <mlib_sys.h>
-#include <mlib_video.h>
-#include <inttypes.h>
-#include <stdlib.h>
-#include <assert.h>
-
-#include "libswscale/swscale.h"
-#include "libswscale/swscale_internal.h"
-
-static int mlib_YUV2ARGB420_32(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
- int srcSliceH, uint8_t* dst[], int dstStride[])
-{
- if(c->srcFormat == PIX_FMT_YUV422P) {
- srcStride[1] *= 2;
- srcStride[2] *= 2;
- }
-
- assert(srcStride[1] == srcStride[2]);
-
- mlib_VideoColorYUV2ARGB420(dst[0]+srcSliceY*dstStride[0], src[0], src[1], src[2], c->dstW,
- srcSliceH, dstStride[0], srcStride[0], srcStride[1]);
- return srcSliceH;
-}
-
-static int mlib_YUV2ABGR420_32(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
- int srcSliceH, uint8_t* dst[], int dstStride[])
-{
- if(c->srcFormat == PIX_FMT_YUV422P) {
- srcStride[1] *= 2;
- srcStride[2] *= 2;
- }
-
- assert(srcStride[1] == srcStride[2]);
-
- mlib_VideoColorYUV2ABGR420(dst[0]+srcSliceY*dstStride[0], src[0], src[1], src[2], c->dstW,
- srcSliceH, dstStride[0], srcStride[0], srcStride[1]);
- return srcSliceH;
-}
-
-static int mlib_YUV2RGB420_24(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
- int srcSliceH, uint8_t* dst[], int dstStride[])
-{
- if(c->srcFormat == PIX_FMT_YUV422P) {
- srcStride[1] *= 2;
- srcStride[2] *= 2;
- }
-
- assert(srcStride[1] == srcStride[2]);
-
- mlib_VideoColorYUV2RGB420(dst[0]+srcSliceY*dstStride[0], src[0], src[1], src[2], c->dstW,
- srcSliceH, dstStride[0], srcStride[0], srcStride[1]);
- return srcSliceH;
-}
-
-
-SwsFunc ff_yuv2rgb_init_mlib(SwsContext *c)
-{
- switch(c->dstFormat) {
- case PIX_FMT_RGB24: return mlib_YUV2RGB420_24;
- case PIX_FMT_BGR32: return mlib_YUV2ARGB420_32;
- case PIX_FMT_RGB32: return mlib_YUV2ABGR420_32;
- default: return NULL;
- }
-}
-
diff --git a/gst-libs/ext/libav/libswscale/options.c b/gst-libs/ext/libav/libswscale/options.c
index 9ba6e5e..daf013c 100644
--- a/gst-libs/ext/libav/libswscale/options.c
+++ b/gst-libs/ext/libav/libswscale/options.c
@@ -19,12 +19,12 @@
*/
#include "libavutil/avutil.h"
-#include "libavutil/pixfmt.h"
#include "libavutil/opt.h"
+#include "libavutil/pixfmt.h"
#include "swscale.h"
#include "swscale_internal.h"
-static const char * sws_context_to_name(void * ptr)
+static const char *sws_context_to_name(void *ptr)
{
return "swscaler";
}
@@ -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), 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" },
+ { "sws_flags", "scaler flags", OFFSET(flags), AV_OPT_TYPE_FLAGS, { .i64 = DEFAULT }, 0, UINT_MAX, VE, "sws_flags" },
+ { "fast_bilinear", "fast bilinear", 0, AV_OPT_TYPE_CONST, { .i64 = SWS_FAST_BILINEAR }, INT_MIN, INT_MAX, VE, "sws_flags" },
+ { "bilinear", "bilinear", 0, AV_OPT_TYPE_CONST, { .i64 = SWS_BILINEAR }, INT_MIN, INT_MAX, VE, "sws_flags" },
+ { "bicubic", "bicubic", 0, AV_OPT_TYPE_CONST, { .i64 = SWS_BICUBIC }, INT_MIN, INT_MAX, VE, "sws_flags" },
+ { "experimental", "experimental", 0, AV_OPT_TYPE_CONST, { .i64 = SWS_X }, INT_MIN, INT_MAX, VE, "sws_flags" },
+ { "neighbor", "nearest neighbor", 0, AV_OPT_TYPE_CONST, { .i64 = SWS_POINT }, INT_MIN, INT_MAX, VE, "sws_flags" },
+ { "area", "averaging area", 0, AV_OPT_TYPE_CONST, { .i64 = SWS_AREA }, INT_MIN, INT_MAX, VE, "sws_flags" },
+ { "bicublin", "luma bicubic, chroma bilinear", 0, AV_OPT_TYPE_CONST, { .i64 = SWS_BICUBLIN }, INT_MIN, INT_MAX, VE, "sws_flags" },
+ { "gauss", "gaussian", 0, AV_OPT_TYPE_CONST, { .i64 = SWS_GAUSS }, INT_MIN, INT_MAX, VE, "sws_flags" },
+ { "sinc", "sinc", 0, AV_OPT_TYPE_CONST, { .i64 = SWS_SINC }, INT_MIN, INT_MAX, VE, "sws_flags" },
+ { "lanczos", "lanczos", 0, AV_OPT_TYPE_CONST, { .i64 = SWS_LANCZOS }, INT_MIN, INT_MAX, VE, "sws_flags" },
+ { "spline", "natural bicubic spline", 0, AV_OPT_TYPE_CONST, { .i64 = SWS_SPLINE }, INT_MIN, INT_MAX, VE, "sws_flags" },
+ { "print_info", "print info", 0, AV_OPT_TYPE_CONST, { .i64 = SWS_PRINT_INFO }, INT_MIN, INT_MAX, VE, "sws_flags" },
+ { "accurate_rnd", "accurate rounding", 0, AV_OPT_TYPE_CONST, { .i64 = SWS_ACCURATE_RND }, INT_MIN, INT_MAX, VE, "sws_flags" },
+ { "full_chroma_int", "full chroma interpolation", 0, AV_OPT_TYPE_CONST, { .i64 = SWS_FULL_CHR_H_INT }, INT_MIN, INT_MAX, VE, "sws_flags" },
+ { "full_chroma_inp", "full chroma input", 0, AV_OPT_TYPE_CONST, { .i64 = SWS_FULL_CHR_H_INP }, INT_MIN, INT_MAX, VE, "sws_flags" },
+ { "bitexact", "", 0, AV_OPT_TYPE_CONST, { .i64 = SWS_BITEXACT }, INT_MIN, INT_MAX, VE, "sws_flags" },
- { "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 },
+ { "srcw", "source width", OFFSET(srcW), AV_OPT_TYPE_INT, { .i64 = 16 }, 1, INT_MAX, VE },
+ { "srch", "source height", OFFSET(srcH), AV_OPT_TYPE_INT, { .i64 = 16 }, 1, INT_MAX, VE },
+ { "dstw", "destination width", OFFSET(dstW), AV_OPT_TYPE_INT, { .i64 = 16 }, 1, INT_MAX, VE },
+ { "dsth", "destination height", OFFSET(dstH), AV_OPT_TYPE_INT, { .i64 = 16 }, 1, INT_MAX, VE },
+ { "src_format", "source format", OFFSET(srcFormat), AV_OPT_TYPE_INT, { .i64 = DEFAULT }, 0, AV_PIX_FMT_NB - 1, VE },
+ { "dst_format", "destination format", OFFSET(dstFormat), AV_OPT_TYPE_INT, { .i64 = DEFAULT }, 0, AV_PIX_FMT_NB - 1, VE },
+ { "src_range", "source range", OFFSET(srcRange), AV_OPT_TYPE_INT, { .i64 = DEFAULT }, 0, 1, VE },
+ { "dst_range", "destination range", OFFSET(dstRange), AV_OPT_TYPE_INT, { .i64 = 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 }
};
diff --git a/gst-libs/ext/libav/libswscale/output.c b/gst-libs/ext/libav/libswscale/output.c
new file mode 100644
index 0000000..4953290
--- /dev/null
+++ b/gst-libs/ext/libav/libswscale/output.c
@@ -0,0 +1,1498 @@
+/*
+ * Copyright (C) 2001-2003 Michael Niedermayer <michaelni@gmx.at>
+ *
+ * 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
+ */
+
+#include <assert.h>
+#include <math.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "libavutil/attributes.h"
+#include "libavutil/avutil.h"
+#include "libavutil/bswap.h"
+#include "libavutil/cpu.h"
+#include "libavutil/intreadwrite.h"
+#include "libavutil/mathematics.h"
+#include "libavutil/pixdesc.h"
+#include "config.h"
+#include "rgb2rgb.h"
+#include "swscale.h"
+#include "swscale_internal.h"
+
+DECLARE_ALIGNED(8, static const uint8_t, dither_2x2_4)[2][8]={
+{ 1, 3, 1, 3, 1, 3, 1, 3, },
+{ 2, 0, 2, 0, 2, 0, 2, 0, },
+};
+
+DECLARE_ALIGNED(8, static const uint8_t, dither_2x2_8)[2][8]={
+{ 6, 2, 6, 2, 6, 2, 6, 2, },
+{ 0, 4, 0, 4, 0, 4, 0, 4, },
+};
+
+DECLARE_ALIGNED(8, const uint8_t, dither_4x4_16)[4][8]={
+{ 8, 4, 11, 7, 8, 4, 11, 7, },
+{ 2, 14, 1, 13, 2, 14, 1, 13, },
+{ 10, 6, 9, 5, 10, 6, 9, 5, },
+{ 0, 12, 3, 15, 0, 12, 3, 15, },
+};
+
+DECLARE_ALIGNED(8, const uint8_t, dither_8x8_32)[8][8]={
+{ 17, 9, 23, 15, 16, 8, 22, 14, },
+{ 5, 29, 3, 27, 4, 28, 2, 26, },
+{ 21, 13, 19, 11, 20, 12, 18, 10, },
+{ 0, 24, 6, 30, 1, 25, 7, 31, },
+{ 16, 8, 22, 14, 17, 9, 23, 15, },
+{ 4, 28, 2, 26, 5, 29, 3, 27, },
+{ 20, 12, 18, 10, 21, 13, 19, 11, },
+{ 1, 25, 7, 31, 0, 24, 6, 30, },
+};
+
+DECLARE_ALIGNED(8, const uint8_t, dither_8x8_73)[8][8]={
+{ 0, 55, 14, 68, 3, 58, 17, 72, },
+{ 37, 18, 50, 32, 40, 22, 54, 35, },
+{ 9, 64, 5, 59, 13, 67, 8, 63, },
+{ 46, 27, 41, 23, 49, 31, 44, 26, },
+{ 2, 57, 16, 71, 1, 56, 15, 70, },
+{ 39, 21, 52, 34, 38, 19, 51, 33, },
+{ 11, 66, 7, 62, 10, 65, 6, 60, },
+{ 48, 30, 43, 25, 47, 29, 42, 24, },
+};
+
+#if 1
+DECLARE_ALIGNED(8, const uint8_t, dither_8x8_220)[8][8]={
+{117, 62, 158, 103, 113, 58, 155, 100, },
+{ 34, 199, 21, 186, 31, 196, 17, 182, },
+{144, 89, 131, 76, 141, 86, 127, 72, },
+{ 0, 165, 41, 206, 10, 175, 52, 217, },
+{110, 55, 151, 96, 120, 65, 162, 107, },
+{ 28, 193, 14, 179, 38, 203, 24, 189, },
+{138, 83, 124, 69, 148, 93, 134, 79, },
+{ 7, 172, 48, 213, 3, 168, 45, 210, },
+};
+#elif 1
+// tries to correct a gamma of 1.5
+DECLARE_ALIGNED(8, const uint8_t, dither_8x8_220)[8][8]={
+{ 0, 143, 18, 200, 2, 156, 25, 215, },
+{ 78, 28, 125, 64, 89, 36, 138, 74, },
+{ 10, 180, 3, 161, 16, 195, 8, 175, },
+{109, 51, 93, 38, 121, 60, 105, 47, },
+{ 1, 152, 23, 210, 0, 147, 20, 205, },
+{ 85, 33, 134, 71, 81, 30, 130, 67, },
+{ 14, 190, 6, 171, 12, 185, 5, 166, },
+{117, 57, 101, 44, 113, 54, 97, 41, },
+};
+#elif 1
+// tries to correct a gamma of 2.0
+DECLARE_ALIGNED(8, const uint8_t, dither_8x8_220)[8][8]={
+{ 0, 124, 8, 193, 0, 140, 12, 213, },
+{ 55, 14, 104, 42, 66, 19, 119, 52, },
+{ 3, 168, 1, 145, 6, 187, 3, 162, },
+{ 86, 31, 70, 21, 99, 39, 82, 28, },
+{ 0, 134, 11, 206, 0, 129, 9, 200, },
+{ 62, 17, 114, 48, 58, 16, 109, 45, },
+{ 5, 181, 2, 157, 4, 175, 1, 151, },
+{ 95, 36, 78, 26, 90, 34, 74, 24, },
+};
+#else
+// tries to correct a gamma of 2.5
+DECLARE_ALIGNED(8, const uint8_t, dither_8x8_220)[8][8]={
+{ 0, 107, 3, 187, 0, 125, 6, 212, },
+{ 39, 7, 86, 28, 49, 11, 102, 36, },
+{ 1, 158, 0, 131, 3, 180, 1, 151, },
+{ 68, 19, 52, 12, 81, 25, 64, 17, },
+{ 0, 119, 5, 203, 0, 113, 4, 195, },
+{ 45, 9, 96, 33, 42, 8, 91, 30, },
+{ 2, 172, 1, 144, 2, 165, 0, 137, },
+{ 77, 23, 60, 15, 72, 21, 56, 14, },
+};
+#endif
+
+#define output_pixel(pos, val, bias, signedness) \
+ if (big_endian) { \
+ AV_WB16(pos, bias + av_clip_ ## signedness ## 16(val >> shift)); \
+ } else { \
+ AV_WL16(pos, bias + av_clip_ ## signedness ## 16(val >> shift)); \
+ }
+
+static av_always_inline void
+yuv2plane1_16_c_template(const int32_t *src, uint16_t *dest, int dstW,
+ int big_endian, int output_bits)
+{
+ int i;
+ int shift = 19 - output_bits;
+
+ for (i = 0; i < dstW; i++) {
+ int val = src[i] + (1 << (shift - 1));
+ output_pixel(&dest[i], val, 0, uint);
+ }
+}
+
+static av_always_inline void
+yuv2planeX_16_c_template(const int16_t *filter, int filterSize,
+ const int32_t **src, uint16_t *dest, int dstW,
+ int big_endian, int output_bits)
+{
+ int i;
+ int shift = 15 + 16 - output_bits;
+
+ for (i = 0; i < dstW; i++) {
+ int val = 1 << (30-output_bits);
+ int j;
+
+ /* range of val is [0,0x7FFFFFFF], so 31 bits, but with lanczos/spline
+ * filters (or anything with negative coeffs, the range can be slightly
+ * wider in both directions. To account for this overflow, we subtract
+ * a constant so it always fits in the signed range (assuming a
+ * reasonable filterSize), and re-add that at the end. */
+ val -= 0x40000000;
+ for (j = 0; j < filterSize; j++)
+ val += src[j][i] * filter[j];
+
+ output_pixel(&dest[i], val, 0x8000, int);
+ }
+}
+
+#undef output_pixel
+
+#define output_pixel(pos, val) \
+ if (big_endian) { \
+ AV_WB16(pos, av_clip_uintp2(val >> shift, output_bits)); \
+ } else { \
+ AV_WL16(pos, av_clip_uintp2(val >> shift, output_bits)); \
+ }
+
+static av_always_inline void
+yuv2plane1_10_c_template(const int16_t *src, uint16_t *dest, int dstW,
+ int big_endian, int output_bits)
+{
+ int i;
+ int shift = 15 - output_bits;
+
+ for (i = 0; i < dstW; i++) {
+ int val = src[i] + (1 << (shift - 1));
+ output_pixel(&dest[i], val);
+ }
+}
+
+static av_always_inline void
+yuv2planeX_10_c_template(const int16_t *filter, int filterSize,
+ const int16_t **src, uint16_t *dest, int dstW,
+ int big_endian, int output_bits)
+{
+ int i;
+ int shift = 11 + 16 - output_bits;
+
+ for (i = 0; i < dstW; i++) {
+ int val = 1 << (26-output_bits);
+ int j;
+
+ for (j = 0; j < filterSize; j++)
+ val += src[j][i] * filter[j];
+
+ output_pixel(&dest[i], val);
+ }
+}
+
+#undef output_pixel
+
+#define yuv2NBPS(bits, BE_LE, is_be, template_size, typeX_t) \
+static void yuv2plane1_ ## bits ## BE_LE ## _c(const int16_t *src, \
+ uint8_t *dest, int dstW, \
+ const uint8_t *dither, int offset)\
+{ \
+ yuv2plane1_ ## template_size ## _c_template((const typeX_t *) src, \
+ (uint16_t *) dest, dstW, is_be, bits); \
+}\
+static void yuv2planeX_ ## bits ## BE_LE ## _c(const int16_t *filter, int filterSize, \
+ const int16_t **src, uint8_t *dest, int dstW, \
+ const uint8_t *dither, int offset)\
+{ \
+ yuv2planeX_## template_size ## _c_template(filter, \
+ filterSize, (const typeX_t **) src, \
+ (uint16_t *) dest, dstW, is_be, bits); \
+}
+yuv2NBPS( 9, BE, 1, 10, int16_t)
+yuv2NBPS( 9, LE, 0, 10, int16_t)
+yuv2NBPS(10, BE, 1, 10, int16_t)
+yuv2NBPS(10, LE, 0, 10, int16_t)
+yuv2NBPS(16, BE, 1, 16, int32_t)
+yuv2NBPS(16, LE, 0, 16, int32_t)
+
+static void yuv2planeX_8_c(const int16_t *filter, int filterSize,
+ const int16_t **src, uint8_t *dest, int dstW,
+ const uint8_t *dither, int offset)
+{
+ int i;
+ for (i=0; i<dstW; i++) {
+ int val = dither[(i + offset) & 7] << 12;
+ int j;
+ for (j=0; j<filterSize; j++)
+ val += src[j][i] * filter[j];
+
+ dest[i]= av_clip_uint8(val>>19);
+ }
+}
+
+static void yuv2plane1_8_c(const int16_t *src, uint8_t *dest, int dstW,
+ const uint8_t *dither, int offset)
+{
+ int i;
+ for (i=0; i<dstW; i++) {
+ int val = (src[i] + dither[(i + offset) & 7]) >> 7;
+ dest[i]= av_clip_uint8(val);
+ }
+}
+
+static void yuv2nv12cX_c(SwsContext *c, const int16_t *chrFilter, int chrFilterSize,
+ const int16_t **chrUSrc, const int16_t **chrVSrc,
+ uint8_t *dest, int chrDstW)
+{
+ enum AVPixelFormat dstFormat = c->dstFormat;
+ const uint8_t *chrDither = c->chrDither8;
+ int i;
+
+ if (dstFormat == AV_PIX_FMT_NV12)
+ for (i=0; i<chrDstW; i++) {
+ int u = chrDither[i & 7] << 12;
+ int v = chrDither[(i + 3) & 7] << 12;
+ int j;
+ for (j=0; j<chrFilterSize; j++) {
+ u += chrUSrc[j][i] * chrFilter[j];
+ v += chrVSrc[j][i] * chrFilter[j];
+ }
+
+ dest[2*i]= av_clip_uint8(u>>19);
+ dest[2*i+1]= av_clip_uint8(v>>19);
+ }
+ else
+ for (i=0; i<chrDstW; i++) {
+ int u = chrDither[i & 7] << 12;
+ int v = chrDither[(i + 3) & 7] << 12;
+ int j;
+ for (j=0; j<chrFilterSize; j++) {
+ u += chrUSrc[j][i] * chrFilter[j];
+ v += chrVSrc[j][i] * chrFilter[j];
+ }
+
+ dest[2*i]= av_clip_uint8(v>>19);
+ dest[2*i+1]= av_clip_uint8(u>>19);
+ }
+}
+
+#define accumulate_bit(acc, val) \
+ acc <<= 1; \
+ acc |= (val) >= (128 + 110)
+#define output_pixel(pos, acc) \
+ if (target == AV_PIX_FMT_MONOBLACK) { \
+ pos = acc; \
+ } else { \
+ pos = ~acc; \
+ }
+
+static av_always_inline void
+yuv2mono_X_c_template(SwsContext *c, const int16_t *lumFilter,
+ const int16_t **lumSrc, int lumFilterSize,
+ const int16_t *chrFilter, const int16_t **chrUSrc,
+ const int16_t **chrVSrc, int chrFilterSize,
+ const int16_t **alpSrc, uint8_t *dest, int dstW,
+ int y, enum AVPixelFormat target)
+{
+ const uint8_t * const d128=dither_8x8_220[y&7];
+ int i;
+ unsigned acc = 0;
+
+ for (i = 0; i < dstW; i += 2) {
+ int j;
+ int Y1 = 1 << 18;
+ int Y2 = 1 << 18;
+
+ for (j = 0; j < lumFilterSize; j++) {
+ Y1 += lumSrc[j][i] * lumFilter[j];
+ Y2 += lumSrc[j][i+1] * lumFilter[j];
+ }
+ Y1 >>= 19;
+ Y2 >>= 19;
+ if ((Y1 | Y2) & 0x100) {
+ Y1 = av_clip_uint8(Y1);
+ Y2 = av_clip_uint8(Y2);
+ }
+ accumulate_bit(acc, Y1 + d128[(i + 0) & 7]);
+ accumulate_bit(acc, Y2 + d128[(i + 1) & 7]);
+ if ((i & 7) == 6) {
+ output_pixel(*dest++, acc);
+ }
+ }
+
+ if (i & 6) {
+ output_pixel(*dest, acc);
+ }
+}
+
+static av_always_inline void
+yuv2mono_2_c_template(SwsContext *c, const int16_t *buf[2],
+ const int16_t *ubuf[2], const int16_t *vbuf[2],
+ const int16_t *abuf[2], uint8_t *dest, int dstW,
+ int yalpha, int uvalpha, int y,
+ enum AVPixelFormat target)
+{
+ const int16_t *buf0 = buf[0], *buf1 = buf[1];
+ const uint8_t * const d128 = dither_8x8_220[y & 7];
+ int yalpha1 = 4096 - yalpha;
+ int i;
+
+ for (i = 0; i < dstW; i += 8) {
+ int Y, acc = 0;
+
+ Y = (buf0[i + 0] * yalpha1 + buf1[i + 0] * yalpha) >> 19;
+ accumulate_bit(acc, Y + d128[0]);
+ Y = (buf0[i + 1] * yalpha1 + buf1[i + 1] * yalpha) >> 19;
+ accumulate_bit(acc, Y + d128[1]);
+ Y = (buf0[i + 2] * yalpha1 + buf1[i + 2] * yalpha) >> 19;
+ accumulate_bit(acc, Y + d128[2]);
+ Y = (buf0[i + 3] * yalpha1 + buf1[i + 3] * yalpha) >> 19;
+ accumulate_bit(acc, Y + d128[3]);
+ Y = (buf0[i + 4] * yalpha1 + buf1[i + 4] * yalpha) >> 19;
+ accumulate_bit(acc, Y + d128[4]);
+ Y = (buf0[i + 5] * yalpha1 + buf1[i + 5] * yalpha) >> 19;
+ accumulate_bit(acc, Y + d128[5]);
+ Y = (buf0[i + 6] * yalpha1 + buf1[i + 6] * yalpha) >> 19;
+ accumulate_bit(acc, Y + d128[6]);
+ Y = (buf0[i + 7] * yalpha1 + buf1[i + 7] * yalpha) >> 19;
+ accumulate_bit(acc, Y + d128[7]);
+
+ output_pixel(*dest++, acc);
+ }
+}
+
+static av_always_inline void
+yuv2mono_1_c_template(SwsContext *c, const int16_t *buf0,
+ const int16_t *ubuf[2], const int16_t *vbuf[2],
+ const int16_t *abuf0, uint8_t *dest, int dstW,
+ int uvalpha, int y, enum AVPixelFormat target)
+{
+ const uint8_t * const d128 = dither_8x8_220[y & 7];
+ int i;
+
+ for (i = 0; i < dstW; i += 8) {
+ int acc = 0;
+
+ accumulate_bit(acc, (buf0[i + 0] >> 7) + d128[0]);
+ accumulate_bit(acc, (buf0[i + 1] >> 7) + d128[1]);
+ accumulate_bit(acc, (buf0[i + 2] >> 7) + d128[2]);
+ accumulate_bit(acc, (buf0[i + 3] >> 7) + d128[3]);
+ accumulate_bit(acc, (buf0[i + 4] >> 7) + d128[4]);
+ accumulate_bit(acc, (buf0[i + 5] >> 7) + d128[5]);
+ accumulate_bit(acc, (buf0[i + 6] >> 7) + d128[6]);
+ accumulate_bit(acc, (buf0[i + 7] >> 7) + d128[7]);
+
+ output_pixel(*dest++, acc);
+ }
+}
+
+#undef output_pixel
+#undef accumulate_bit
+
+#define YUV2PACKEDWRAPPER(name, base, ext, fmt) \
+static void name ## ext ## _X_c(SwsContext *c, const int16_t *lumFilter, \
+ const int16_t **lumSrc, int lumFilterSize, \
+ const int16_t *chrFilter, const int16_t **chrUSrc, \
+ const int16_t **chrVSrc, int chrFilterSize, \
+ const int16_t **alpSrc, uint8_t *dest, int dstW, \
+ int y) \
+{ \
+ name ## base ## _X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
+ chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
+ alpSrc, dest, dstW, y, fmt); \
+} \
+ \
+static void name ## ext ## _2_c(SwsContext *c, const int16_t *buf[2], \
+ const int16_t *ubuf[2], const int16_t *vbuf[2], \
+ const int16_t *abuf[2], uint8_t *dest, int dstW, \
+ int yalpha, int uvalpha, int y) \
+{ \
+ name ## base ## _2_c_template(c, buf, ubuf, vbuf, abuf, \
+ dest, dstW, yalpha, uvalpha, y, fmt); \
+} \
+ \
+static void name ## ext ## _1_c(SwsContext *c, const int16_t *buf0, \
+ const int16_t *ubuf[2], const int16_t *vbuf[2], \
+ const int16_t *abuf0, uint8_t *dest, int dstW, \
+ int uvalpha, int y) \
+{ \
+ name ## base ## _1_c_template(c, buf0, ubuf, vbuf, \
+ abuf0, dest, dstW, uvalpha, \
+ y, fmt); \
+}
+
+YUV2PACKEDWRAPPER(yuv2mono,, white, AV_PIX_FMT_MONOWHITE)
+YUV2PACKEDWRAPPER(yuv2mono,, black, AV_PIX_FMT_MONOBLACK)
+
+#define output_pixels(pos, Y1, U, Y2, V) \
+ if (target == AV_PIX_FMT_YUYV422) { \
+ dest[pos + 0] = Y1; \
+ dest[pos + 1] = U; \
+ dest[pos + 2] = Y2; \
+ dest[pos + 3] = V; \
+ } else { \
+ dest[pos + 0] = U; \
+ dest[pos + 1] = Y1; \
+ dest[pos + 2] = V; \
+ dest[pos + 3] = Y2; \
+ }
+
+static av_always_inline void
+yuv2422_X_c_template(SwsContext *c, const int16_t *lumFilter,
+ const int16_t **lumSrc, int lumFilterSize,
+ const int16_t *chrFilter, const int16_t **chrUSrc,
+ const int16_t **chrVSrc, int chrFilterSize,
+ const int16_t **alpSrc, uint8_t *dest, int dstW,
+ int y, enum AVPixelFormat target)
+{
+ int i;
+
+ for (i = 0; i < ((dstW + 1) >> 1); i++) {
+ int j;
+ int Y1 = 1 << 18;
+ int Y2 = 1 << 18;
+ int U = 1 << 18;
+ int V = 1 << 18;
+
+ for (j = 0; j < lumFilterSize; j++) {
+ Y1 += lumSrc[j][i * 2] * lumFilter[j];
+ Y2 += lumSrc[j][i * 2 + 1] * lumFilter[j];
+ }
+ for (j = 0; j < chrFilterSize; j++) {
+ U += chrUSrc[j][i] * chrFilter[j];
+ V += chrVSrc[j][i] * chrFilter[j];
+ }
+ Y1 >>= 19;
+ Y2 >>= 19;
+ U >>= 19;
+ V >>= 19;
+ if ((Y1 | Y2 | U | V) & 0x100) {
+ Y1 = av_clip_uint8(Y1);
+ Y2 = av_clip_uint8(Y2);
+ U = av_clip_uint8(U);
+ V = av_clip_uint8(V);
+ }
+ output_pixels(4*i, Y1, U, Y2, V);
+ }
+}
+
+static av_always_inline void
+yuv2422_2_c_template(SwsContext *c, const int16_t *buf[2],
+ const int16_t *ubuf[2], const int16_t *vbuf[2],
+ const int16_t *abuf[2], uint8_t *dest, int dstW,
+ int yalpha, int uvalpha, int y,
+ enum AVPixelFormat target)
+{
+ const int16_t *buf0 = buf[0], *buf1 = buf[1],
+ *ubuf0 = ubuf[0], *ubuf1 = ubuf[1],
+ *vbuf0 = vbuf[0], *vbuf1 = vbuf[1];
+ int yalpha1 = 4096 - yalpha;
+ int uvalpha1 = 4096 - uvalpha;
+ int i;
+
+ for (i = 0; i < ((dstW + 1) >> 1); i++) {
+ int Y1 = (buf0[i * 2] * yalpha1 + buf1[i * 2] * yalpha) >> 19;
+ int Y2 = (buf0[i * 2 + 1] * yalpha1 + buf1[i * 2 + 1] * yalpha) >> 19;
+ int U = (ubuf0[i] * uvalpha1 + ubuf1[i] * uvalpha) >> 19;
+ int V = (vbuf0[i] * uvalpha1 + vbuf1[i] * uvalpha) >> 19;
+
+ Y1 = av_clip_uint8(Y1);
+ Y2 = av_clip_uint8(Y2);
+ U = av_clip_uint8(U);
+ V = av_clip_uint8(V);
+
+ output_pixels(i * 4, Y1, U, Y2, V);
+ }
+}
+
+static av_always_inline void
+yuv2422_1_c_template(SwsContext *c, const int16_t *buf0,
+ const int16_t *ubuf[2], const int16_t *vbuf[2],
+ const int16_t *abuf0, uint8_t *dest, int dstW,
+ int uvalpha, int y, enum AVPixelFormat target)
+{
+ const int16_t *ubuf0 = ubuf[0], *vbuf0 = vbuf[0];
+ int i;
+
+ if (uvalpha < 2048) {
+ for (i = 0; i < ((dstW + 1) >> 1); i++) {
+ int Y1 = buf0[i * 2] >> 7;
+ int Y2 = buf0[i * 2 + 1] >> 7;
+ int U = ubuf0[i] >> 7;
+ int V = vbuf0[i] >> 7;
+
+ Y1 = av_clip_uint8(Y1);
+ Y2 = av_clip_uint8(Y2);
+ U = av_clip_uint8(U);
+ V = av_clip_uint8(V);
+
+ output_pixels(i * 4, Y1, U, Y2, V);
+ }
+ } else {
+ const int16_t *ubuf1 = ubuf[1], *vbuf1 = vbuf[1];
+ for (i = 0; i < ((dstW + 1) >> 1); i++) {
+ int Y1 = buf0[i * 2] >> 7;
+ int Y2 = buf0[i * 2 + 1] >> 7;
+ int U = (ubuf0[i] + ubuf1[i]) >> 8;
+ int V = (vbuf0[i] + vbuf1[i]) >> 8;
+
+ Y1 = av_clip_uint8(Y1);
+ Y2 = av_clip_uint8(Y2);
+ U = av_clip_uint8(U);
+ V = av_clip_uint8(V);
+
+ output_pixels(i * 4, Y1, U, Y2, V);
+ }
+ }
+}
+
+#undef output_pixels
+
+YUV2PACKEDWRAPPER(yuv2, 422, yuyv422, AV_PIX_FMT_YUYV422)
+YUV2PACKEDWRAPPER(yuv2, 422, uyvy422, AV_PIX_FMT_UYVY422)
+
+#define R_B ((target == AV_PIX_FMT_RGB48LE || target == AV_PIX_FMT_RGB48BE) ? R : B)
+#define B_R ((target == AV_PIX_FMT_RGB48LE || target == AV_PIX_FMT_RGB48BE) ? B : R)
+#define output_pixel(pos, val) \
+ if (isBE(target)) { \
+ AV_WB16(pos, val); \
+ } else { \
+ AV_WL16(pos, val); \
+ }
+
+static av_always_inline void
+yuv2rgb48_X_c_template(SwsContext *c, const int16_t *lumFilter,
+ const int32_t **lumSrc, int lumFilterSize,
+ const int16_t *chrFilter, const int32_t **chrUSrc,
+ const int32_t **chrVSrc, int chrFilterSize,
+ const int32_t **alpSrc, uint16_t *dest, int dstW,
+ int y, enum AVPixelFormat target)
+{
+ int i;
+
+ for (i = 0; i < ((dstW + 1) >> 1); i++) {
+ int j;
+ int Y1 = -0x40000000;
+ int Y2 = -0x40000000;
+ int U = -128 << 23; // 19
+ int V = -128 << 23;
+ int R, G, B;
+
+ for (j = 0; j < lumFilterSize; j++) {
+ Y1 += lumSrc[j][i * 2] * lumFilter[j];
+ Y2 += lumSrc[j][i * 2 + 1] * lumFilter[j];
+ }
+ for (j = 0; j < chrFilterSize; j++) {
+ U += chrUSrc[j][i] * chrFilter[j];
+ V += chrVSrc[j][i] * chrFilter[j];
+ }
+
+ // 8bit: 12+15=27; 16-bit: 12+19=31
+ Y1 >>= 14; // 10
+ Y1 += 0x10000;
+ Y2 >>= 14;
+ Y2 += 0x10000;
+ U >>= 14;
+ V >>= 14;
+
+ // 8bit: 27 -> 17bit, 16bit: 31 - 14 = 17bit
+ Y1 -= c->yuv2rgb_y_offset;
+ Y2 -= c->yuv2rgb_y_offset;
+ Y1 *= c->yuv2rgb_y_coeff;
+ Y2 *= c->yuv2rgb_y_coeff;
+ Y1 += 1 << 13; // 21
+ Y2 += 1 << 13;
+ // 8bit: 17 + 13bit = 30bit, 16bit: 17 + 13bit = 30bit
+
+ R = V * c->yuv2rgb_v2r_coeff;
+ G = V * c->yuv2rgb_v2g_coeff + U * c->yuv2rgb_u2g_coeff;
+ B = U * c->yuv2rgb_u2b_coeff;
+
+ // 8bit: 30 - 22 = 8bit, 16bit: 30bit - 14 = 16bit
+ output_pixel(&dest[0], av_clip_uintp2(R_B + Y1, 30) >> 14);
+ output_pixel(&dest[1], av_clip_uintp2( G + Y1, 30) >> 14);
+ output_pixel(&dest[2], av_clip_uintp2(B_R + Y1, 30) >> 14);
+ output_pixel(&dest[3], av_clip_uintp2(R_B + Y2, 30) >> 14);
+ output_pixel(&dest[4], av_clip_uintp2( G + Y2, 30) >> 14);
+ output_pixel(&dest[5], av_clip_uintp2(B_R + Y2, 30) >> 14);
+ dest += 6;
+ }
+}
+
+static av_always_inline void
+yuv2rgb48_2_c_template(SwsContext *c, const int32_t *buf[2],
+ const int32_t *ubuf[2], const int32_t *vbuf[2],
+ const int32_t *abuf[2], uint16_t *dest, int dstW,
+ int yalpha, int uvalpha, int y,
+ enum AVPixelFormat target)
+{
+ const int32_t *buf0 = buf[0], *buf1 = buf[1],
+ *ubuf0 = ubuf[0], *ubuf1 = ubuf[1],
+ *vbuf0 = vbuf[0], *vbuf1 = vbuf[1];
+ int yalpha1 = 4096 - yalpha;
+ int uvalpha1 = 4096 - uvalpha;
+ int i;
+
+ for (i = 0; i < ((dstW + 1) >> 1); i++) {
+ int Y1 = (buf0[i * 2] * yalpha1 + buf1[i * 2] * yalpha) >> 14;
+ int Y2 = (buf0[i * 2 + 1] * yalpha1 + buf1[i * 2 + 1] * yalpha) >> 14;
+ int U = (ubuf0[i] * uvalpha1 + ubuf1[i] * uvalpha + (-128 << 23)) >> 14;
+ int V = (vbuf0[i] * uvalpha1 + vbuf1[i] * uvalpha + (-128 << 23)) >> 14;
+ int R, G, B;
+
+ Y1 -= c->yuv2rgb_y_offset;
+ Y2 -= c->yuv2rgb_y_offset;
+ Y1 *= c->yuv2rgb_y_coeff;
+ Y2 *= c->yuv2rgb_y_coeff;
+ Y1 += 1 << 13;
+ Y2 += 1 << 13;
+
+ R = V * c->yuv2rgb_v2r_coeff;
+ G = V * c->yuv2rgb_v2g_coeff + U * c->yuv2rgb_u2g_coeff;
+ B = U * c->yuv2rgb_u2b_coeff;
+
+ output_pixel(&dest[0], av_clip_uintp2(R_B + Y1, 30) >> 14);
+ output_pixel(&dest[1], av_clip_uintp2( G + Y1, 30) >> 14);
+ output_pixel(&dest[2], av_clip_uintp2(B_R + Y1, 30) >> 14);
+ output_pixel(&dest[3], av_clip_uintp2(R_B + Y2, 30) >> 14);
+ output_pixel(&dest[4], av_clip_uintp2( G + Y2, 30) >> 14);
+ output_pixel(&dest[5], av_clip_uintp2(B_R + Y2, 30) >> 14);
+ dest += 6;
+ }
+}
+
+static av_always_inline void
+yuv2rgb48_1_c_template(SwsContext *c, const int32_t *buf0,
+ const int32_t *ubuf[2], const int32_t *vbuf[2],
+ const int32_t *abuf0, uint16_t *dest, int dstW,
+ int uvalpha, int y, enum AVPixelFormat target)
+{
+ const int32_t *ubuf0 = ubuf[0], *vbuf0 = vbuf[0];
+ int i;
+
+ if (uvalpha < 2048) {
+ for (i = 0; i < ((dstW + 1) >> 1); i++) {
+ int Y1 = (buf0[i * 2] ) >> 2;
+ int Y2 = (buf0[i * 2 + 1]) >> 2;
+ int U = (ubuf0[i] + (-128 << 11)) >> 2;
+ int V = (vbuf0[i] + (-128 << 11)) >> 2;
+ int R, G, B;
+
+ Y1 -= c->yuv2rgb_y_offset;
+ Y2 -= c->yuv2rgb_y_offset;
+ Y1 *= c->yuv2rgb_y_coeff;
+ Y2 *= c->yuv2rgb_y_coeff;
+ Y1 += 1 << 13;
+ Y2 += 1 << 13;
+
+ R = V * c->yuv2rgb_v2r_coeff;
+ G = V * c->yuv2rgb_v2g_coeff + U * c->yuv2rgb_u2g_coeff;
+ B = U * c->yuv2rgb_u2b_coeff;
+
+ output_pixel(&dest[0], av_clip_uintp2(R_B + Y1, 30) >> 14);
+ output_pixel(&dest[1], av_clip_uintp2( G + Y1, 30) >> 14);
+ output_pixel(&dest[2], av_clip_uintp2(B_R + Y1, 30) >> 14);
+ output_pixel(&dest[3], av_clip_uintp2(R_B + Y2, 30) >> 14);
+ output_pixel(&dest[4], av_clip_uintp2( G + Y2, 30) >> 14);
+ output_pixel(&dest[5], av_clip_uintp2(B_R + Y2, 30) >> 14);
+ dest += 6;
+ }
+ } else {
+ const int32_t *ubuf1 = ubuf[1], *vbuf1 = vbuf[1];
+ for (i = 0; i < ((dstW + 1) >> 1); i++) {
+ int Y1 = (buf0[i * 2] ) >> 2;
+ int Y2 = (buf0[i * 2 + 1]) >> 2;
+ int U = (ubuf0[i] + ubuf1[i] + (-128 << 12)) >> 3;
+ int V = (vbuf0[i] + vbuf1[i] + (-128 << 12)) >> 3;
+ int R, G, B;
+
+ Y1 -= c->yuv2rgb_y_offset;
+ Y2 -= c->yuv2rgb_y_offset;
+ Y1 *= c->yuv2rgb_y_coeff;
+ Y2 *= c->yuv2rgb_y_coeff;
+ Y1 += 1 << 13;
+ Y2 += 1 << 13;
+
+ R = V * c->yuv2rgb_v2r_coeff;
+ G = V * c->yuv2rgb_v2g_coeff + U * c->yuv2rgb_u2g_coeff;
+ B = U * c->yuv2rgb_u2b_coeff;
+
+ output_pixel(&dest[0], av_clip_uintp2(R_B + Y1, 30) >> 14);
+ output_pixel(&dest[1], av_clip_uintp2( G + Y1, 30) >> 14);
+ output_pixel(&dest[2], av_clip_uintp2(B_R + Y1, 30) >> 14);
+ output_pixel(&dest[3], av_clip_uintp2(R_B + Y2, 30) >> 14);
+ output_pixel(&dest[4], av_clip_uintp2( G + Y2, 30) >> 14);
+ output_pixel(&dest[5], av_clip_uintp2(B_R + Y2, 30) >> 14);
+ dest += 6;
+ }
+ }
+}
+
+#undef output_pixel
+#undef r_b
+#undef b_r
+
+#define YUV2PACKED16WRAPPER(name, base, ext, fmt) \
+static void name ## ext ## _X_c(SwsContext *c, const int16_t *lumFilter, \
+ const int16_t **_lumSrc, int lumFilterSize, \
+ const int16_t *chrFilter, const int16_t **_chrUSrc, \
+ const int16_t **_chrVSrc, int chrFilterSize, \
+ const int16_t **_alpSrc, uint8_t *_dest, int dstW, \
+ int y) \
+{ \
+ const int32_t **lumSrc = (const int32_t **) _lumSrc, \
+ **chrUSrc = (const int32_t **) _chrUSrc, \
+ **chrVSrc = (const int32_t **) _chrVSrc, \
+ **alpSrc = (const int32_t **) _alpSrc; \
+ uint16_t *dest = (uint16_t *) _dest; \
+ name ## base ## _X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
+ chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
+ alpSrc, dest, dstW, y, fmt); \
+} \
+ \
+static void name ## ext ## _2_c(SwsContext *c, const int16_t *_buf[2], \
+ const int16_t *_ubuf[2], const int16_t *_vbuf[2], \
+ const int16_t *_abuf[2], uint8_t *_dest, int dstW, \
+ int yalpha, int uvalpha, int y) \
+{ \
+ const int32_t **buf = (const int32_t **) _buf, \
+ **ubuf = (const int32_t **) _ubuf, \
+ **vbuf = (const int32_t **) _vbuf, \
+ **abuf = (const int32_t **) _abuf; \
+ uint16_t *dest = (uint16_t *) _dest; \
+ name ## base ## _2_c_template(c, buf, ubuf, vbuf, abuf, \
+ dest, dstW, yalpha, uvalpha, y, fmt); \
+} \
+ \
+static void name ## ext ## _1_c(SwsContext *c, const int16_t *_buf0, \
+ const int16_t *_ubuf[2], const int16_t *_vbuf[2], \
+ const int16_t *_abuf0, uint8_t *_dest, int dstW, \
+ int uvalpha, int y) \
+{ \
+ const int32_t *buf0 = (const int32_t *) _buf0, \
+ **ubuf = (const int32_t **) _ubuf, \
+ **vbuf = (const int32_t **) _vbuf, \
+ *abuf0 = (const int32_t *) _abuf0; \
+ uint16_t *dest = (uint16_t *) _dest; \
+ name ## base ## _1_c_template(c, buf0, ubuf, vbuf, abuf0, dest, \
+ dstW, uvalpha, y, fmt); \
+}
+
+YUV2PACKED16WRAPPER(yuv2, rgb48, rgb48be, AV_PIX_FMT_RGB48BE)
+YUV2PACKED16WRAPPER(yuv2, rgb48, rgb48le, AV_PIX_FMT_RGB48LE)
+YUV2PACKED16WRAPPER(yuv2, rgb48, bgr48be, AV_PIX_FMT_BGR48BE)
+YUV2PACKED16WRAPPER(yuv2, rgb48, bgr48le, AV_PIX_FMT_BGR48LE)
+
+/*
+ * Write out 2 RGB pixels in the target pixel format. This function takes a
+ * R/G/B LUT as generated by ff_yuv2rgb_c_init_tables(), which takes care of
+ * things like endianness conversion and shifting. The caller takes care of
+ * setting the correct offset in these tables from the chroma (U/V) values.
+ * This function then uses the luminance (Y1/Y2) values to write out the
+ * correct RGB values into the destination buffer.
+ */
+static av_always_inline void
+yuv2rgb_write(uint8_t *_dest, int i, unsigned Y1, unsigned Y2,
+ unsigned A1, unsigned A2,
+ const void *_r, const void *_g, const void *_b, int y,
+ enum AVPixelFormat target, int hasAlpha)
+{
+ if (target == AV_PIX_FMT_ARGB || target == AV_PIX_FMT_RGBA ||
+ target == AV_PIX_FMT_ABGR || target == AV_PIX_FMT_BGRA) {
+ uint32_t *dest = (uint32_t *) _dest;
+ const uint32_t *r = (const uint32_t *) _r;
+ const uint32_t *g = (const uint32_t *) _g;
+ const uint32_t *b = (const uint32_t *) _b;
+
+#if CONFIG_SMALL
+ int sh = hasAlpha ? ((target == AV_PIX_FMT_RGB32_1 || target == AV_PIX_FMT_BGR32_1) ? 0 : 24) : 0;
+
+ dest[i * 2 + 0] = r[Y1] + g[Y1] + b[Y1] + (hasAlpha ? A1 << sh : 0);
+ dest[i * 2 + 1] = r[Y2] + g[Y2] + b[Y2] + (hasAlpha ? A2 << sh : 0);
+#else
+ if (hasAlpha) {
+ int sh = (target == AV_PIX_FMT_RGB32_1 || target == AV_PIX_FMT_BGR32_1) ? 0 : 24;
+
+ dest[i * 2 + 0] = r[Y1] + g[Y1] + b[Y1] + (A1 << sh);
+ dest[i * 2 + 1] = r[Y2] + g[Y2] + b[Y2] + (A2 << sh);
+ } else {
+ dest[i * 2 + 0] = r[Y1] + g[Y1] + b[Y1];
+ dest[i * 2 + 1] = r[Y2] + g[Y2] + b[Y2];
+ }
+#endif
+ } else if (target == AV_PIX_FMT_RGB24 || target == AV_PIX_FMT_BGR24) {
+ uint8_t *dest = (uint8_t *) _dest;
+ const uint8_t *r = (const uint8_t *) _r;
+ const uint8_t *g = (const uint8_t *) _g;
+ const uint8_t *b = (const uint8_t *) _b;
+
+#define r_b ((target == AV_PIX_FMT_RGB24) ? r : b)
+#define b_r ((target == AV_PIX_FMT_RGB24) ? b : r)
+ dest[i * 6 + 0] = r_b[Y1];
+ dest[i * 6 + 1] = g[Y1];
+ dest[i * 6 + 2] = b_r[Y1];
+ dest[i * 6 + 3] = r_b[Y2];
+ dest[i * 6 + 4] = g[Y2];
+ dest[i * 6 + 5] = b_r[Y2];
+#undef r_b
+#undef b_r
+ } else if (target == AV_PIX_FMT_RGB565 || target == AV_PIX_FMT_BGR565 ||
+ target == AV_PIX_FMT_RGB555 || target == AV_PIX_FMT_BGR555 ||
+ target == AV_PIX_FMT_RGB444 || target == AV_PIX_FMT_BGR444) {
+ uint16_t *dest = (uint16_t *) _dest;
+ const uint16_t *r = (const uint16_t *) _r;
+ const uint16_t *g = (const uint16_t *) _g;
+ const uint16_t *b = (const uint16_t *) _b;
+ int dr1, dg1, db1, dr2, dg2, db2;
+
+ if (target == AV_PIX_FMT_RGB565 || target == AV_PIX_FMT_BGR565) {
+ dr1 = dither_2x2_8[ y & 1 ][0];
+ dg1 = dither_2x2_4[ y & 1 ][0];
+ db1 = dither_2x2_8[(y & 1) ^ 1][0];
+ dr2 = dither_2x2_8[ y & 1 ][1];
+ dg2 = dither_2x2_4[ y & 1 ][1];
+ db2 = dither_2x2_8[(y & 1) ^ 1][1];
+ } else if (target == AV_PIX_FMT_RGB555 || target == AV_PIX_FMT_BGR555) {
+ dr1 = dither_2x2_8[ y & 1 ][0];
+ dg1 = dither_2x2_8[ y & 1 ][1];
+ db1 = dither_2x2_8[(y & 1) ^ 1][0];
+ dr2 = dither_2x2_8[ y & 1 ][1];
+ dg2 = dither_2x2_8[ y & 1 ][0];
+ db2 = dither_2x2_8[(y & 1) ^ 1][1];
+ } else {
+ dr1 = dither_4x4_16[ y & 3 ][0];
+ dg1 = dither_4x4_16[ y & 3 ][1];
+ db1 = dither_4x4_16[(y & 3) ^ 3][0];
+ dr2 = dither_4x4_16[ y & 3 ][1];
+ dg2 = dither_4x4_16[ y & 3 ][0];
+ db2 = dither_4x4_16[(y & 3) ^ 3][1];
+ }
+
+ dest[i * 2 + 0] = r[Y1 + dr1] + g[Y1 + dg1] + b[Y1 + db1];
+ dest[i * 2 + 1] = r[Y2 + dr2] + g[Y2 + dg2] + b[Y2 + db2];
+ } else /* 8/4-bit */ {
+ uint8_t *dest = (uint8_t *) _dest;
+ const uint8_t *r = (const uint8_t *) _r;
+ const uint8_t *g = (const uint8_t *) _g;
+ const uint8_t *b = (const uint8_t *) _b;
+ int dr1, dg1, db1, dr2, dg2, db2;
+
+ if (target == AV_PIX_FMT_RGB8 || target == AV_PIX_FMT_BGR8) {
+ const uint8_t * const d64 = dither_8x8_73[y & 7];
+ const uint8_t * const d32 = dither_8x8_32[y & 7];
+ dr1 = dg1 = d32[(i * 2 + 0) & 7];
+ db1 = d64[(i * 2 + 0) & 7];
+ dr2 = dg2 = d32[(i * 2 + 1) & 7];
+ db2 = d64[(i * 2 + 1) & 7];
+ } else {
+ const uint8_t * const d64 = dither_8x8_73 [y & 7];
+ const uint8_t * const d128 = dither_8x8_220[y & 7];
+ dr1 = db1 = d128[(i * 2 + 0) & 7];
+ dg1 = d64[(i * 2 + 0) & 7];
+ dr2 = db2 = d128[(i * 2 + 1) & 7];
+ dg2 = d64[(i * 2 + 1) & 7];
+ }
+
+ if (target == AV_PIX_FMT_RGB4 || target == AV_PIX_FMT_BGR4) {
+ dest[i] = r[Y1 + dr1] + g[Y1 + dg1] + b[Y1 + db1] +
+ ((r[Y2 + dr2] + g[Y2 + dg2] + b[Y2 + db2]) << 4);
+ } else {
+ dest[i * 2 + 0] = r[Y1 + dr1] + g[Y1 + dg1] + b[Y1 + db1];
+ dest[i * 2 + 1] = r[Y2 + dr2] + g[Y2 + dg2] + b[Y2 + db2];
+ }
+ }
+}
+
+static av_always_inline void
+yuv2rgb_X_c_template(SwsContext *c, const int16_t *lumFilter,
+ const int16_t **lumSrc, int lumFilterSize,
+ const int16_t *chrFilter, const int16_t **chrUSrc,
+ const int16_t **chrVSrc, int chrFilterSize,
+ const int16_t **alpSrc, uint8_t *dest, int dstW,
+ int y, enum AVPixelFormat target, int hasAlpha)
+{
+ int i;
+
+ for (i = 0; i < ((dstW + 1) >> 1); i++) {
+ int j, A1, A2;
+ int Y1 = 1 << 18;
+ int Y2 = 1 << 18;
+ int U = 1 << 18;
+ int V = 1 << 18;
+ const void *r, *g, *b;
+
+ for (j = 0; j < lumFilterSize; j++) {
+ Y1 += lumSrc[j][i * 2] * lumFilter[j];
+ Y2 += lumSrc[j][i * 2 + 1] * lumFilter[j];
+ }
+ for (j = 0; j < chrFilterSize; j++) {
+ U += chrUSrc[j][i] * chrFilter[j];
+ V += chrVSrc[j][i] * chrFilter[j];
+ }
+ Y1 >>= 19;
+ Y2 >>= 19;
+ U >>= 19;
+ V >>= 19;
+ if ((Y1 | Y2 | U | V) & 0x100) {
+ Y1 = av_clip_uint8(Y1);
+ Y2 = av_clip_uint8(Y2);
+ U = av_clip_uint8(U);
+ V = av_clip_uint8(V);
+ }
+ if (hasAlpha) {
+ A1 = 1 << 18;
+ A2 = 1 << 18;
+ for (j = 0; j < lumFilterSize; j++) {
+ A1 += alpSrc[j][i * 2 ] * lumFilter[j];
+ A2 += alpSrc[j][i * 2 + 1] * lumFilter[j];
+ }
+ A1 >>= 19;
+ A2 >>= 19;
+ if ((A1 | A2) & 0x100) {
+ A1 = av_clip_uint8(A1);
+ A2 = av_clip_uint8(A2);
+ }
+ }
+
+ /* FIXME fix tables so that clipping is not needed and then use _NOCLIP*/
+ r = c->table_rV[V];
+ g = (c->table_gU[U] + c->table_gV[V]);
+ b = c->table_bU[U];
+
+ yuv2rgb_write(dest, i, Y1, Y2, hasAlpha ? A1 : 0, hasAlpha ? A2 : 0,
+ r, g, b, y, target, hasAlpha);
+ }
+}
+
+static av_always_inline void
+yuv2rgb_2_c_template(SwsContext *c, const int16_t *buf[2],
+ const int16_t *ubuf[2], const int16_t *vbuf[2],
+ const int16_t *abuf[2], uint8_t *dest, int dstW,
+ int yalpha, int uvalpha, int y,
+ enum AVPixelFormat target, int hasAlpha)
+{
+ const int16_t *buf0 = buf[0], *buf1 = buf[1],
+ *ubuf0 = ubuf[0], *ubuf1 = ubuf[1],
+ *vbuf0 = vbuf[0], *vbuf1 = vbuf[1],
+ *abuf0 = hasAlpha ? abuf[0] : NULL,
+ *abuf1 = hasAlpha ? abuf[1] : NULL;
+ int yalpha1 = 4096 - yalpha;
+ int uvalpha1 = 4096 - uvalpha;
+ int i;
+
+ for (i = 0; i < ((dstW + 1) >> 1); i++) {
+ int Y1 = (buf0[i * 2] * yalpha1 + buf1[i * 2] * yalpha) >> 19;
+ int Y2 = (buf0[i * 2 + 1] * yalpha1 + buf1[i * 2 + 1] * yalpha) >> 19;
+ int U = (ubuf0[i] * uvalpha1 + ubuf1[i] * uvalpha) >> 19;
+ int V = (vbuf0[i] * uvalpha1 + vbuf1[i] * uvalpha) >> 19;
+ int A1, A2;
+ const void *r, *g, *b;
+
+ Y1 = av_clip_uint8(Y1);
+ Y2 = av_clip_uint8(Y2);
+ U = av_clip_uint8(U);
+ V = av_clip_uint8(V);
+
+ r = c->table_rV[V];
+ g = (c->table_gU[U] + c->table_gV[V]);
+ b = c->table_bU[U];
+
+ if (hasAlpha) {
+ A1 = (abuf0[i * 2 ] * yalpha1 + abuf1[i * 2 ] * yalpha) >> 19;
+ A2 = (abuf0[i * 2 + 1] * yalpha1 + abuf1[i * 2 + 1] * yalpha) >> 19;
+ A1 = av_clip_uint8(A1);
+ A2 = av_clip_uint8(A2);
+ }
+
+ yuv2rgb_write(dest, i, Y1, Y2, hasAlpha ? A1 : 0, hasAlpha ? A2 : 0,
+ r, g, b, y, target, hasAlpha);
+ }
+}
+
+static av_always_inline void
+yuv2rgb_1_c_template(SwsContext *c, const int16_t *buf0,
+ const int16_t *ubuf[2], const int16_t *vbuf[2],
+ const int16_t *abuf0, uint8_t *dest, int dstW,
+ int uvalpha, int y, enum AVPixelFormat target,
+ int hasAlpha)
+{
+ const int16_t *ubuf0 = ubuf[0], *vbuf0 = vbuf[0];
+ int i;
+
+ if (uvalpha < 2048) {
+ for (i = 0; i < ((dstW + 1) >> 1); i++) {
+ int Y1 = buf0[i * 2] >> 7;
+ int Y2 = buf0[i * 2 + 1] >> 7;
+ int U = ubuf0[i] >> 7;
+ int V = vbuf0[i] >> 7;
+ int A1, A2;
+ const void *r, *g, *b;
+
+ Y1 = av_clip_uint8(Y1);
+ Y2 = av_clip_uint8(Y2);
+ U = av_clip_uint8(U);
+ V = av_clip_uint8(V);
+
+ r = c->table_rV[V];
+ g = (c->table_gU[U] + c->table_gV[V]);
+ b = c->table_bU[U];
+
+ if (hasAlpha) {
+ A1 = abuf0[i * 2 ] >> 7;
+ A2 = abuf0[i * 2 + 1] >> 7;
+ A1 = av_clip_uint8(A1);
+ A2 = av_clip_uint8(A2);
+ }
+
+ yuv2rgb_write(dest, i, Y1, Y2, hasAlpha ? A1 : 0, hasAlpha ? A2 : 0,
+ r, g, b, y, target, hasAlpha);
+ }
+ } else {
+ const int16_t *ubuf1 = ubuf[1], *vbuf1 = vbuf[1];
+ for (i = 0; i < ((dstW + 1) >> 1); i++) {
+ int Y1 = buf0[i * 2] >> 7;
+ int Y2 = buf0[i * 2 + 1] >> 7;
+ int U = (ubuf0[i] + ubuf1[i]) >> 8;
+ int V = (vbuf0[i] + vbuf1[i]) >> 8;
+ int A1, A2;
+ const void *r, *g, *b;
+
+ Y1 = av_clip_uint8(Y1);
+ Y2 = av_clip_uint8(Y2);
+ U = av_clip_uint8(U);
+ V = av_clip_uint8(V);
+
+ r = c->table_rV[V];
+ g = (c->table_gU[U] + c->table_gV[V]);
+ b = c->table_bU[U];
+
+ if (hasAlpha) {
+ A1 = abuf0[i * 2 ] >> 7;
+ A2 = abuf0[i * 2 + 1] >> 7;
+ A1 = av_clip_uint8(A1);
+ A2 = av_clip_uint8(A2);
+ }
+
+ yuv2rgb_write(dest, i, Y1, Y2, hasAlpha ? A1 : 0, hasAlpha ? A2 : 0,
+ r, g, b, y, target, hasAlpha);
+ }
+ }
+}
+
+#define YUV2RGBWRAPPERX(name, base, ext, fmt, hasAlpha) \
+static void name ## ext ## _X_c(SwsContext *c, const int16_t *lumFilter, \
+ const int16_t **lumSrc, int lumFilterSize, \
+ const int16_t *chrFilter, const int16_t **chrUSrc, \
+ const int16_t **chrVSrc, int chrFilterSize, \
+ const int16_t **alpSrc, uint8_t *dest, int dstW, \
+ int y) \
+{ \
+ name ## base ## _X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
+ chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
+ alpSrc, dest, dstW, y, fmt, hasAlpha); \
+}
+#define YUV2RGBWRAPPER(name, base, ext, fmt, hasAlpha) \
+YUV2RGBWRAPPERX(name, base, ext, fmt, hasAlpha) \
+static void name ## ext ## _2_c(SwsContext *c, const int16_t *buf[2], \
+ const int16_t *ubuf[2], const int16_t *vbuf[2], \
+ const int16_t *abuf[2], uint8_t *dest, int dstW, \
+ int yalpha, int uvalpha, int y) \
+{ \
+ name ## base ## _2_c_template(c, buf, ubuf, vbuf, abuf, \
+ dest, dstW, yalpha, uvalpha, y, fmt, hasAlpha); \
+} \
+ \
+static void name ## ext ## _1_c(SwsContext *c, const int16_t *buf0, \
+ const int16_t *ubuf[2], const int16_t *vbuf[2], \
+ const int16_t *abuf0, uint8_t *dest, int dstW, \
+ int uvalpha, int y) \
+{ \
+ name ## base ## _1_c_template(c, buf0, ubuf, vbuf, abuf0, dest, \
+ dstW, uvalpha, y, fmt, hasAlpha); \
+}
+
+#if CONFIG_SMALL
+YUV2RGBWRAPPER(yuv2rgb,, 32_1, AV_PIX_FMT_RGB32_1, CONFIG_SWSCALE_ALPHA && c->alpPixBuf)
+YUV2RGBWRAPPER(yuv2rgb,, 32, AV_PIX_FMT_RGB32, CONFIG_SWSCALE_ALPHA && c->alpPixBuf)
+#else
+#if CONFIG_SWSCALE_ALPHA
+YUV2RGBWRAPPER(yuv2rgb,, a32_1, AV_PIX_FMT_RGB32_1, 1)
+YUV2RGBWRAPPER(yuv2rgb,, a32, AV_PIX_FMT_RGB32, 1)
+#endif
+YUV2RGBWRAPPER(yuv2rgb,, x32_1, AV_PIX_FMT_RGB32_1, 0)
+YUV2RGBWRAPPER(yuv2rgb,, x32, AV_PIX_FMT_RGB32, 0)
+#endif
+YUV2RGBWRAPPER(yuv2, rgb, rgb24, AV_PIX_FMT_RGB24, 0)
+YUV2RGBWRAPPER(yuv2, rgb, bgr24, AV_PIX_FMT_BGR24, 0)
+YUV2RGBWRAPPER(yuv2rgb,, 16, AV_PIX_FMT_RGB565, 0)
+YUV2RGBWRAPPER(yuv2rgb,, 15, AV_PIX_FMT_RGB555, 0)
+YUV2RGBWRAPPER(yuv2rgb,, 12, AV_PIX_FMT_RGB444, 0)
+YUV2RGBWRAPPER(yuv2rgb,, 8, AV_PIX_FMT_RGB8, 0)
+YUV2RGBWRAPPER(yuv2rgb,, 4, AV_PIX_FMT_RGB4, 0)
+YUV2RGBWRAPPER(yuv2rgb,, 4b, AV_PIX_FMT_RGB4_BYTE, 0)
+
+static av_always_inline void
+yuv2rgb_full_X_c_template(SwsContext *c, const int16_t *lumFilter,
+ const int16_t **lumSrc, int lumFilterSize,
+ const int16_t *chrFilter, const int16_t **chrUSrc,
+ const int16_t **chrVSrc, int chrFilterSize,
+ const int16_t **alpSrc, uint8_t *dest,
+ int dstW, int y, enum AVPixelFormat target, int hasAlpha)
+{
+ int i;
+ int step = (target == AV_PIX_FMT_RGB24 || target == AV_PIX_FMT_BGR24) ? 3 : 4;
+
+ for (i = 0; i < dstW; i++) {
+ int j;
+ int Y = 0;
+ int U = -128 << 19;
+ int V = -128 << 19;
+ int R, G, B, A;
+
+ for (j = 0; j < lumFilterSize; j++) {
+ Y += lumSrc[j][i] * lumFilter[j];
+ }
+ for (j = 0; j < chrFilterSize; j++) {
+ U += chrUSrc[j][i] * chrFilter[j];
+ V += chrVSrc[j][i] * chrFilter[j];
+ }
+ Y >>= 10;
+ U >>= 10;
+ V >>= 10;
+ if (hasAlpha) {
+ A = 1 << 21;
+ for (j = 0; j < lumFilterSize; j++) {
+ A += alpSrc[j][i] * lumFilter[j];
+ }
+ A >>= 19;
+ if (A & 0x100)
+ A = av_clip_uint8(A);
+ }
+ Y -= c->yuv2rgb_y_offset;
+ Y *= c->yuv2rgb_y_coeff;
+ Y += 1 << 21;
+ R = Y + V*c->yuv2rgb_v2r_coeff;
+ G = Y + V*c->yuv2rgb_v2g_coeff + U*c->yuv2rgb_u2g_coeff;
+ B = Y + U*c->yuv2rgb_u2b_coeff;
+ if ((R | G | B) & 0xC0000000) {
+ R = av_clip_uintp2(R, 30);
+ G = av_clip_uintp2(G, 30);
+ B = av_clip_uintp2(B, 30);
+ }
+
+ switch(target) {
+ case AV_PIX_FMT_ARGB:
+ dest[0] = hasAlpha ? A : 255;
+ dest[1] = R >> 22;
+ dest[2] = G >> 22;
+ dest[3] = B >> 22;
+ break;
+ case AV_PIX_FMT_RGB24:
+ dest[0] = R >> 22;
+ dest[1] = G >> 22;
+ dest[2] = B >> 22;
+ break;
+ case AV_PIX_FMT_RGBA:
+ dest[0] = R >> 22;
+ dest[1] = G >> 22;
+ dest[2] = B >> 22;
+ dest[3] = hasAlpha ? A : 255;
+ break;
+ case AV_PIX_FMT_ABGR:
+ dest[0] = hasAlpha ? A : 255;
+ dest[1] = B >> 22;
+ dest[2] = G >> 22;
+ dest[3] = R >> 22;
+ dest += 4;
+ break;
+ case AV_PIX_FMT_BGR24:
+ dest[0] = B >> 22;
+ dest[1] = G >> 22;
+ dest[2] = R >> 22;
+ break;
+ case AV_PIX_FMT_BGRA:
+ dest[0] = B >> 22;
+ dest[1] = G >> 22;
+ dest[2] = R >> 22;
+ dest[3] = hasAlpha ? A : 255;
+ break;
+ }
+ dest += step;
+ }
+}
+
+#if CONFIG_SMALL
+YUV2RGBWRAPPERX(yuv2, rgb_full, bgra32_full, AV_PIX_FMT_BGRA, CONFIG_SWSCALE_ALPHA && c->alpPixBuf)
+YUV2RGBWRAPPERX(yuv2, rgb_full, abgr32_full, AV_PIX_FMT_ABGR, CONFIG_SWSCALE_ALPHA && c->alpPixBuf)
+YUV2RGBWRAPPERX(yuv2, rgb_full, rgba32_full, AV_PIX_FMT_RGBA, CONFIG_SWSCALE_ALPHA && c->alpPixBuf)
+YUV2RGBWRAPPERX(yuv2, rgb_full, argb32_full, AV_PIX_FMT_ARGB, CONFIG_SWSCALE_ALPHA && c->alpPixBuf)
+#else
+#if CONFIG_SWSCALE_ALPHA
+YUV2RGBWRAPPERX(yuv2, rgb_full, bgra32_full, AV_PIX_FMT_BGRA, 1)
+YUV2RGBWRAPPERX(yuv2, rgb_full, abgr32_full, AV_PIX_FMT_ABGR, 1)
+YUV2RGBWRAPPERX(yuv2, rgb_full, rgba32_full, AV_PIX_FMT_RGBA, 1)
+YUV2RGBWRAPPERX(yuv2, rgb_full, argb32_full, AV_PIX_FMT_ARGB, 1)
+#endif
+YUV2RGBWRAPPERX(yuv2, rgb_full, bgrx32_full, AV_PIX_FMT_BGRA, 0)
+YUV2RGBWRAPPERX(yuv2, rgb_full, xbgr32_full, AV_PIX_FMT_ABGR, 0)
+YUV2RGBWRAPPERX(yuv2, rgb_full, rgbx32_full, AV_PIX_FMT_RGBA, 0)
+YUV2RGBWRAPPERX(yuv2, rgb_full, xrgb32_full, AV_PIX_FMT_ARGB, 0)
+#endif
+YUV2RGBWRAPPERX(yuv2, rgb_full, bgr24_full, AV_PIX_FMT_BGR24, 0)
+YUV2RGBWRAPPERX(yuv2, rgb_full, rgb24_full, AV_PIX_FMT_RGB24, 0)
+
+av_cold void ff_sws_init_output_funcs(SwsContext *c,
+ yuv2planar1_fn *yuv2plane1,
+ yuv2planarX_fn *yuv2planeX,
+ yuv2interleavedX_fn *yuv2nv12cX,
+ yuv2packed1_fn *yuv2packed1,
+ yuv2packed2_fn *yuv2packed2,
+ yuv2packedX_fn *yuv2packedX)
+{
+ enum AVPixelFormat dstFormat = c->dstFormat;
+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(dstFormat);
+
+ if (is16BPS(dstFormat)) {
+ *yuv2planeX = isBE(dstFormat) ? yuv2planeX_16BE_c : yuv2planeX_16LE_c;
+ *yuv2plane1 = isBE(dstFormat) ? yuv2plane1_16BE_c : yuv2plane1_16LE_c;
+ } else if (is9_OR_10BPS(dstFormat)) {
+ if (desc->comp[0].depth_minus1 == 8) {
+ *yuv2planeX = isBE(dstFormat) ? yuv2planeX_9BE_c : yuv2planeX_9LE_c;
+ *yuv2plane1 = isBE(dstFormat) ? yuv2plane1_9BE_c : yuv2plane1_9LE_c;
+ } else {
+ *yuv2planeX = isBE(dstFormat) ? yuv2planeX_10BE_c : yuv2planeX_10LE_c;
+ *yuv2plane1 = isBE(dstFormat) ? yuv2plane1_10BE_c : yuv2plane1_10LE_c;
+ }
+ } else {
+ *yuv2plane1 = yuv2plane1_8_c;
+ *yuv2planeX = yuv2planeX_8_c;
+ if (dstFormat == AV_PIX_FMT_NV12 || dstFormat == AV_PIX_FMT_NV21)
+ *yuv2nv12cX = yuv2nv12cX_c;
+ }
+
+ if(c->flags & SWS_FULL_CHR_H_INT) {
+ switch (dstFormat) {
+ case AV_PIX_FMT_RGBA:
+#if CONFIG_SMALL
+ *yuv2packedX = yuv2rgba32_full_X_c;
+#else
+#if CONFIG_SWSCALE_ALPHA
+ if (c->alpPixBuf) {
+ *yuv2packedX = yuv2rgba32_full_X_c;
+ } else
+#endif /* CONFIG_SWSCALE_ALPHA */
+ {
+ *yuv2packedX = yuv2rgbx32_full_X_c;
+ }
+#endif /* !CONFIG_SMALL */
+ break;
+ case AV_PIX_FMT_ARGB:
+#if CONFIG_SMALL
+ *yuv2packedX = yuv2argb32_full_X_c;
+#else
+#if CONFIG_SWSCALE_ALPHA
+ if (c->alpPixBuf) {
+ *yuv2packedX = yuv2argb32_full_X_c;
+ } else
+#endif /* CONFIG_SWSCALE_ALPHA */
+ {
+ *yuv2packedX = yuv2xrgb32_full_X_c;
+ }
+#endif /* !CONFIG_SMALL */
+ break;
+ case AV_PIX_FMT_BGRA:
+#if CONFIG_SMALL
+ *yuv2packedX = yuv2bgra32_full_X_c;
+#else
+#if CONFIG_SWSCALE_ALPHA
+ if (c->alpPixBuf) {
+ *yuv2packedX = yuv2bgra32_full_X_c;
+ } else
+#endif /* CONFIG_SWSCALE_ALPHA */
+ {
+ *yuv2packedX = yuv2bgrx32_full_X_c;
+ }
+#endif /* !CONFIG_SMALL */
+ break;
+ case AV_PIX_FMT_ABGR:
+#if CONFIG_SMALL
+ *yuv2packedX = yuv2abgr32_full_X_c;
+#else
+#if CONFIG_SWSCALE_ALPHA
+ if (c->alpPixBuf) {
+ *yuv2packedX = yuv2abgr32_full_X_c;
+ } else
+#endif /* CONFIG_SWSCALE_ALPHA */
+ {
+ *yuv2packedX = yuv2xbgr32_full_X_c;
+ }
+#endif /* !CONFIG_SMALL */
+ break;
+ case AV_PIX_FMT_RGB24:
+ *yuv2packedX = yuv2rgb24_full_X_c;
+ break;
+ case AV_PIX_FMT_BGR24:
+ *yuv2packedX = yuv2bgr24_full_X_c;
+ break;
+ }
+ } else {
+ switch (dstFormat) {
+ case AV_PIX_FMT_RGB48LE:
+ *yuv2packed1 = yuv2rgb48le_1_c;
+ *yuv2packed2 = yuv2rgb48le_2_c;
+ *yuv2packedX = yuv2rgb48le_X_c;
+ break;
+ case AV_PIX_FMT_RGB48BE:
+ *yuv2packed1 = yuv2rgb48be_1_c;
+ *yuv2packed2 = yuv2rgb48be_2_c;
+ *yuv2packedX = yuv2rgb48be_X_c;
+ break;
+ case AV_PIX_FMT_BGR48LE:
+ *yuv2packed1 = yuv2bgr48le_1_c;
+ *yuv2packed2 = yuv2bgr48le_2_c;
+ *yuv2packedX = yuv2bgr48le_X_c;
+ break;
+ case AV_PIX_FMT_BGR48BE:
+ *yuv2packed1 = yuv2bgr48be_1_c;
+ *yuv2packed2 = yuv2bgr48be_2_c;
+ *yuv2packedX = yuv2bgr48be_X_c;
+ break;
+ case AV_PIX_FMT_RGB32:
+ case AV_PIX_FMT_BGR32:
+#if CONFIG_SMALL
+ *yuv2packed1 = yuv2rgb32_1_c;
+ *yuv2packed2 = yuv2rgb32_2_c;
+ *yuv2packedX = yuv2rgb32_X_c;
+#else
+#if CONFIG_SWSCALE_ALPHA
+ if (c->alpPixBuf) {
+ *yuv2packed1 = yuv2rgba32_1_c;
+ *yuv2packed2 = yuv2rgba32_2_c;
+ *yuv2packedX = yuv2rgba32_X_c;
+ } else
+#endif /* CONFIG_SWSCALE_ALPHA */
+ {
+ *yuv2packed1 = yuv2rgbx32_1_c;
+ *yuv2packed2 = yuv2rgbx32_2_c;
+ *yuv2packedX = yuv2rgbx32_X_c;
+ }
+#endif /* !CONFIG_SMALL */
+ break;
+ case AV_PIX_FMT_RGB32_1:
+ case AV_PIX_FMT_BGR32_1:
+#if CONFIG_SMALL
+ *yuv2packed1 = yuv2rgb32_1_1_c;
+ *yuv2packed2 = yuv2rgb32_1_2_c;
+ *yuv2packedX = yuv2rgb32_1_X_c;
+#else
+#if CONFIG_SWSCALE_ALPHA
+ if (c->alpPixBuf) {
+ *yuv2packed1 = yuv2rgba32_1_1_c;
+ *yuv2packed2 = yuv2rgba32_1_2_c;
+ *yuv2packedX = yuv2rgba32_1_X_c;
+ } else
+#endif /* CONFIG_SWSCALE_ALPHA */
+ {
+ *yuv2packed1 = yuv2rgbx32_1_1_c;
+ *yuv2packed2 = yuv2rgbx32_1_2_c;
+ *yuv2packedX = yuv2rgbx32_1_X_c;
+ }
+#endif /* !CONFIG_SMALL */
+ break;
+ case AV_PIX_FMT_RGB24:
+ *yuv2packed1 = yuv2rgb24_1_c;
+ *yuv2packed2 = yuv2rgb24_2_c;
+ *yuv2packedX = yuv2rgb24_X_c;
+ break;
+ case AV_PIX_FMT_BGR24:
+ *yuv2packed1 = yuv2bgr24_1_c;
+ *yuv2packed2 = yuv2bgr24_2_c;
+ *yuv2packedX = yuv2bgr24_X_c;
+ break;
+ case AV_PIX_FMT_RGB565LE:
+ case AV_PIX_FMT_RGB565BE:
+ case AV_PIX_FMT_BGR565LE:
+ case AV_PIX_FMT_BGR565BE:
+ *yuv2packed1 = yuv2rgb16_1_c;
+ *yuv2packed2 = yuv2rgb16_2_c;
+ *yuv2packedX = yuv2rgb16_X_c;
+ break;
+ case AV_PIX_FMT_RGB555LE:
+ case AV_PIX_FMT_RGB555BE:
+ case AV_PIX_FMT_BGR555LE:
+ case AV_PIX_FMT_BGR555BE:
+ *yuv2packed1 = yuv2rgb15_1_c;
+ *yuv2packed2 = yuv2rgb15_2_c;
+ *yuv2packedX = yuv2rgb15_X_c;
+ break;
+ case AV_PIX_FMT_RGB444LE:
+ case AV_PIX_FMT_RGB444BE:
+ case AV_PIX_FMT_BGR444LE:
+ case AV_PIX_FMT_BGR444BE:
+ *yuv2packed1 = yuv2rgb12_1_c;
+ *yuv2packed2 = yuv2rgb12_2_c;
+ *yuv2packedX = yuv2rgb12_X_c;
+ break;
+ case AV_PIX_FMT_RGB8:
+ case AV_PIX_FMT_BGR8:
+ *yuv2packed1 = yuv2rgb8_1_c;
+ *yuv2packed2 = yuv2rgb8_2_c;
+ *yuv2packedX = yuv2rgb8_X_c;
+ break;
+ case AV_PIX_FMT_RGB4:
+ case AV_PIX_FMT_BGR4:
+ *yuv2packed1 = yuv2rgb4_1_c;
+ *yuv2packed2 = yuv2rgb4_2_c;
+ *yuv2packedX = yuv2rgb4_X_c;
+ break;
+ case AV_PIX_FMT_RGB4_BYTE:
+ case AV_PIX_FMT_BGR4_BYTE:
+ *yuv2packed1 = yuv2rgb4b_1_c;
+ *yuv2packed2 = yuv2rgb4b_2_c;
+ *yuv2packedX = yuv2rgb4b_X_c;
+ break;
+ }
+ }
+ switch (dstFormat) {
+ case AV_PIX_FMT_MONOWHITE:
+ *yuv2packed1 = yuv2monowhite_1_c;
+ *yuv2packed2 = yuv2monowhite_2_c;
+ *yuv2packedX = yuv2monowhite_X_c;
+ break;
+ case AV_PIX_FMT_MONOBLACK:
+ *yuv2packed1 = yuv2monoblack_1_c;
+ *yuv2packed2 = yuv2monoblack_2_c;
+ *yuv2packedX = yuv2monoblack_X_c;
+ break;
+ case AV_PIX_FMT_YUYV422:
+ *yuv2packed1 = yuv2yuyv422_1_c;
+ *yuv2packed2 = yuv2yuyv422_2_c;
+ *yuv2packedX = yuv2yuyv422_X_c;
+ break;
+ case AV_PIX_FMT_UYVY422:
+ *yuv2packed1 = yuv2uyvy422_1_c;
+ *yuv2packed2 = yuv2uyvy422_2_c;
+ *yuv2packedX = yuv2uyvy422_X_c;
+ break;
+ }
+}
diff --git a/gst-libs/ext/libav/libswscale/ppc/Makefile b/gst-libs/ext/libav/libswscale/ppc/Makefile
new file mode 100644
index 0000000..018955b
--- /dev/null
+++ b/gst-libs/ext/libav/libswscale/ppc/Makefile
@@ -0,0 +1,3 @@
+ALTIVEC-OBJS += ppc/swscale_altivec.o \
+ ppc/yuv2rgb_altivec.o \
+ ppc/yuv2yuv_altivec.o \
diff --git a/gst-libs/ext/libav/libswscale/ppc/swscale_altivec.c b/gst-libs/ext/libav/libswscale/ppc/swscale_altivec.c
index d7b58ee..b0e25d0 100644
--- a/gst-libs/ext/libav/libswscale/ppc/swscale_altivec.c
+++ b/gst-libs/ext/libav/libswscale/ppc/swscale_altivec.c
@@ -22,127 +22,99 @@
*/
#include <inttypes.h>
+
#include "config.h"
#include "libswscale/swscale.h"
#include "libswscale/swscale_internal.h"
+#include "libavutil/attributes.h"
#include "libavutil/cpu.h"
#include "yuv2rgb_altivec.h"
#define vzero vec_splat_s32(0)
-static inline void
-altivec_packIntArrayToCharArray(int *val, uint8_t* dest, int dstW)
+#define yuv2planeX_8(d1, d2, l1, src, x, perm, filter) do { \
+ vector signed short l2 = vec_ld(((x) << 1) + 16, src); \
+ vector signed short ls = vec_perm(l1, l2, perm); \
+ vector signed int i1 = vec_mule(filter, ls); \
+ vector signed int i2 = vec_mulo(filter, ls); \
+ vector signed int vf1 = vec_mergeh(i1, i2); \
+ vector signed int vf2 = vec_mergel(i1, i2); \
+ d1 = vec_add(d1, vf1); \
+ d2 = vec_add(d2, vf2); \
+ l1 = l2; \
+ } while (0)
+
+static void yuv2planeX_16_altivec(const int16_t *filter, int filterSize,
+ const int16_t **src, uint8_t *dest,
+ const uint8_t *dither, int offset, int x)
{
- register int i;
+ register int i, j;
+ DECLARE_ALIGNED(16, int, val)[16];
+ vector signed int vo1, vo2, vo3, vo4;
+ vector unsigned short vs1, vs2;
+ vector unsigned char vf;
vector unsigned int altivec_vectorShiftInt19 =
vec_add(vec_splat_u32(10), vec_splat_u32(9));
- if ((uintptr_t)dest % 16) {
- /* badly aligned store, we force store alignment */
- /* and will handle load misalignment on val w/ vec_perm */
- vector unsigned char perm1;
- vector signed int v1;
- for (i = 0 ; (i < dstW) &&
- (((uintptr_t)dest + i) % 16) ; i++) {
- int t = val[i] >> 19;
- dest[i] = (t < 0) ? 0 : ((t > 255) ? 255 : t);
- }
- perm1 = vec_lvsl(i << 2, val);
- v1 = vec_ld(i << 2, val);
- for ( ; i < (dstW - 15); i+=16) {
- int offset = i << 2;
- vector signed int v2 = vec_ld(offset + 16, val);
- vector signed int v3 = vec_ld(offset + 32, val);
- vector signed int v4 = vec_ld(offset + 48, val);
- vector signed int v5 = vec_ld(offset + 64, val);
- vector signed int v12 = vec_perm(v1, v2, perm1);
- vector signed int v23 = vec_perm(v2, v3, perm1);
- vector signed int v34 = vec_perm(v3, v4, perm1);
- vector signed int v45 = vec_perm(v4, v5, perm1);
-
- vector signed int vA = vec_sra(v12, altivec_vectorShiftInt19);
- vector signed int vB = vec_sra(v23, altivec_vectorShiftInt19);
- vector signed int vC = vec_sra(v34, altivec_vectorShiftInt19);
- vector signed int vD = vec_sra(v45, altivec_vectorShiftInt19);
- vector unsigned short vs1 = vec_packsu(vA, vB);
- vector unsigned short vs2 = vec_packsu(vC, vD);
- vector unsigned char vf = vec_packsu(vs1, vs2);
- vec_st(vf, i, dest);
- v1 = v5;
- }
- } else { // dest is properly aligned, great
- for (i = 0; i < (dstW - 15); i+=16) {
- int offset = i << 2;
- vector signed int v1 = vec_ld(offset, val);
- vector signed int v2 = vec_ld(offset + 16, val);
- vector signed int v3 = vec_ld(offset + 32, val);
- vector signed int v4 = vec_ld(offset + 48, val);
- vector signed int v5 = vec_sra(v1, altivec_vectorShiftInt19);
- vector signed int v6 = vec_sra(v2, altivec_vectorShiftInt19);
- vector signed int v7 = vec_sra(v3, altivec_vectorShiftInt19);
- vector signed int v8 = vec_sra(v4, altivec_vectorShiftInt19);
- vector unsigned short vs1 = vec_packsu(v5, v6);
- vector unsigned short vs2 = vec_packsu(v7, v8);
- vector unsigned char vf = vec_packsu(vs1, vs2);
- vec_st(vf, i, dest);
- }
- }
- for ( ; i < dstW ; i++) {
- int t = val[i] >> 19;
- dest[i] = (t < 0) ? 0 : ((t > 255) ? 255 : t);
- }
-}
-//FIXME remove the usage of scratch buffers.
-static void
-yuv2planeX_altivec(const int16_t *filter, int filterSize,
- const int16_t **src, uint8_t *dest, int dstW,
- const uint8_t *dither, int offset)
-{
- register int i, j;
- {
- DECLARE_ALIGNED(16, int, val)[dstW];
+ for (i = 0; i < 16; i++)
+ val[i] = dither[(x + i + offset) & 7] << 12;
- for (i=0; i<dstW; i++)
- val[i] = dither[(i + offset) & 7] << 12;
+ vo1 = vec_ld(0, val);
+ vo2 = vec_ld(16, val);
+ vo3 = vec_ld(32, val);
+ vo4 = vec_ld(48, val);
- for (j = 0; j < filterSize; j++) {
- vector signed short l1, vLumFilter = vec_ld(j << 1, filter);
- vector unsigned char perm, perm0 = vec_lvsl(j << 1, filter);
- vLumFilter = vec_perm(vLumFilter, vLumFilter, perm0);
- vLumFilter = vec_splat(vLumFilter, 0); // lumFilter[j] is loaded 8 times in vLumFilter
+ for (j = 0; j < filterSize; j++) {
+ vector signed short l1, vLumFilter = vec_ld(j << 1, filter);
+ vector unsigned char perm, perm0 = vec_lvsl(j << 1, filter);
+ vLumFilter = vec_perm(vLumFilter, vLumFilter, perm0);
+ vLumFilter = vec_splat(vLumFilter, 0); // lumFilter[j] is loaded 8 times in vLumFilter
- perm = vec_lvsl(0, src[j]);
- l1 = vec_ld(0, src[j]);
+ perm = vec_lvsl(x << 1, src[j]);
+ l1 = vec_ld(x << 1, src[j]);
- for (i = 0; i < (dstW - 7); i+=8) {
- int offset = i << 2;
- vector signed short l2 = vec_ld((i << 1) + 16, src[j]);
+ yuv2planeX_8(vo1, vo2, l1, src[j], x, perm, vLumFilter);
+ yuv2planeX_8(vo3, vo4, l1, src[j], x + 8, perm, vLumFilter);
+ }
- vector signed int v1 = vec_ld(offset, val);
- vector signed int v2 = vec_ld(offset + 16, val);
+ vo1 = vec_sra(vo1, altivec_vectorShiftInt19);
+ vo2 = vec_sra(vo2, altivec_vectorShiftInt19);
+ vo3 = vec_sra(vo3, altivec_vectorShiftInt19);
+ vo4 = vec_sra(vo4, altivec_vectorShiftInt19);
+ vs1 = vec_packsu(vo1, vo2);
+ vs2 = vec_packsu(vo3, vo4);
+ vf = vec_packsu(vs1, vs2);
+ vec_st(vf, 0, dest);
+}
- vector signed short ls = vec_perm(l1, l2, perm); // lumSrc[j][i] ... lumSrc[j][i+7]
+static inline void yuv2planeX_u(const int16_t *filter, int filterSize,
+ const int16_t **src, uint8_t *dest, int dstW,
+ const uint8_t *dither, int offset, int x)
+{
+ int i, j;
- vector signed int i1 = vec_mule(vLumFilter, ls);
- vector signed int i2 = vec_mulo(vLumFilter, ls);
+ for (i = x; i < dstW; i++) {
+ int t = dither[(i + offset) & 7] << 12;
+ for (j = 0; j < filterSize; j++)
+ t += src[j][i] * filter[j];
+ dest[i] = av_clip_uint8(t >> 19);
+ }
+}
- vector signed int vf1 = vec_mergeh(i1, i2);
- vector signed int vf2 = vec_mergel(i1, i2); // lumSrc[j][i] * lumFilter[j] ... lumSrc[j][i+7] * lumFilter[j]
+static void yuv2planeX_altivec(const int16_t *filter, int filterSize,
+ const int16_t **src, uint8_t *dest, int dstW,
+ const uint8_t *dither, int offset)
+{
+ int dst_u = -(uintptr_t)dest & 15;
+ int i;
- vector signed int vo1 = vec_add(v1, vf1);
- vector signed int vo2 = vec_add(v2, vf2);
+ yuv2planeX_u(filter, filterSize, src, dest, dst_u, dither, offset, 0);
- vec_st(vo1, offset, val);
- vec_st(vo2, offset + 16, val);
+ for (i = dst_u; i < dstW - 15; i += 16)
+ yuv2planeX_16_altivec(filter, filterSize, src, dest + i, dither,
+ offset, i);
- l1 = l2;
- }
- for ( ; i < dstW; i++) {
- val[i] += src[j][i] * filter[j];
- }
- }
- altivec_packIntArrayToCharArray(val, dest, dstW);
- }
+ yuv2planeX_u(filter, filterSize, src, dest, dstW, dither, offset, i);
}
static void hScale_altivec_real(SwsContext *c, int16_t *dst, int dstW,
@@ -153,180 +125,169 @@ static void hScale_altivec_real(SwsContext *c, int16_t *dst, int dstW,
DECLARE_ALIGNED(16, int, tempo)[4];
if (filterSize % 4) {
- for (i=0; i<dstW; i++) {
+ for (i = 0; i < dstW; i++) {
register int j;
register int srcPos = filterPos[i];
- register int val = 0;
- for (j=0; j<filterSize; j++) {
- val += ((int)src[srcPos + j])*filter[filterSize*i + j];
- }
- dst[i] = FFMIN(val>>7, (1<<15)-1);
- }
- }
- else
- switch (filterSize) {
- case 4:
- {
- for (i=0; i<dstW; i++) {
- register int srcPos = filterPos[i];
-
- vector unsigned char src_v0 = vec_ld(srcPos, src);
- vector unsigned char src_v1, src_vF;
- vector signed short src_v, filter_v;
- vector signed int val_vEven, val_s;
- if ((((uintptr_t)src + srcPos) % 16) > 12) {
- src_v1 = vec_ld(srcPos + 16, src);
+ register int val = 0;
+ for (j = 0; j < filterSize; j++)
+ val += ((int)src[srcPos + j]) * filter[filterSize * i + j];
+ dst[i] = FFMIN(val >> 7, (1 << 15) - 1);
}
- src_vF = vec_perm(src_v0, src_v1, vec_lvsl(srcPos, src));
-
- src_v = // vec_unpackh sign-extends...
- (vector signed short)(vec_mergeh((vector unsigned char)vzero, src_vF));
- // now put our elements in the even slots
- src_v = vec_mergeh(src_v, (vector signed short)vzero);
-
- filter_v = vec_ld(i << 3, filter);
- // The 3 above is 2 (filterSize == 4) + 1 (sizeof(short) == 2).
-
- // The neat trick: We only care for half the elements,
- // high or low depending on (i<<3)%16 (it's 0 or 8 here),
- // and we're going to use vec_mule, so we choose
- // carefully how to "unpack" the elements into the even slots.
- if ((i << 3) % 16)
- filter_v = vec_mergel(filter_v, (vector signed short)vzero);
- else
- filter_v = vec_mergeh(filter_v, (vector signed short)vzero);
-
- val_vEven = vec_mule(src_v, filter_v);
- val_s = vec_sums(val_vEven, vzero);
- vec_st(val_s, 0, tempo);
- dst[i] = FFMIN(tempo[3]>>7, (1<<15)-1);
- }
- }
- break;
-
- case 8:
- {
- for (i=0; i<dstW; i++) {
- register int srcPos = filterPos[i];
-
- vector unsigned char src_v0 = vec_ld(srcPos, src);
- vector unsigned char src_v1, src_vF;
- vector signed short src_v, filter_v;
- vector signed int val_v, val_s;
- if ((((uintptr_t)src + srcPos) % 16) > 8) {
- src_v1 = vec_ld(srcPos + 16, src);
- }
- src_vF = vec_perm(src_v0, src_v1, vec_lvsl(srcPos, src));
-
- src_v = // vec_unpackh sign-extends...
- (vector signed short)(vec_mergeh((vector unsigned char)vzero, src_vF));
- filter_v = vec_ld(i << 4, filter);
- // the 4 above is 3 (filterSize == 8) + 1 (sizeof(short) == 2)
-
- val_v = vec_msums(src_v, filter_v, (vector signed int)vzero);
- val_s = vec_sums(val_v, vzero);
- vec_st(val_s, 0, tempo);
- dst[i] = FFMIN(tempo[3]>>7, (1<<15)-1);
- }
- }
- break;
-
- case 16:
- {
- for (i=0; i<dstW; i++) {
- register int srcPos = filterPos[i];
-
- vector unsigned char src_v0 = vec_ld(srcPos, src);
- vector unsigned char src_v1 = vec_ld(srcPos + 16, src);
- vector unsigned char src_vF = vec_perm(src_v0, src_v1, vec_lvsl(srcPos, src));
-
- vector signed short src_vA = // vec_unpackh sign-extends...
- (vector signed short)(vec_mergeh((vector unsigned char)vzero, src_vF));
- vector signed short src_vB = // vec_unpackh sign-extends...
- (vector signed short)(vec_mergel((vector unsigned char)vzero, src_vF));
-
- vector signed short filter_v0 = vec_ld(i << 5, filter);
- vector signed short filter_v1 = vec_ld((i << 5) + 16, filter);
- // the 5 above are 4 (filterSize == 16) + 1 (sizeof(short) == 2)
-
- vector signed int val_acc = vec_msums(src_vA, filter_v0, (vector signed int)vzero);
- vector signed int val_v = vec_msums(src_vB, filter_v1, val_acc);
-
- vector signed int val_s = vec_sums(val_v, vzero);
-
- vec_st(val_s, 0, tempo);
- dst[i] = FFMIN(tempo[3]>>7, (1<<15)-1);
- }
- }
- break;
-
- default:
- {
- for (i=0; i<dstW; i++) {
- register int j;
- register int srcPos = filterPos[i];
-
- vector signed int val_s, val_v = (vector signed int)vzero;
- vector signed short filter_v0R = vec_ld(i * 2 * filterSize, filter);
- vector unsigned char permF = vec_lvsl((i * 2 * filterSize), filter);
+ } else
+ switch (filterSize) {
+ case 4:
+ for (i = 0; i < dstW; i++) {
+ register int srcPos = filterPos[i];
+
+ vector unsigned char src_v0 = vec_ld(srcPos, src);
+ vector unsigned char src_v1, src_vF;
+ vector signed short src_v, filter_v;
+ vector signed int val_vEven, val_s;
+ if ((((uintptr_t)src + srcPos) % 16) > 12) {
+ src_v1 = vec_ld(srcPos + 16, src);
+ }
+ src_vF = vec_perm(src_v0, src_v1, vec_lvsl(srcPos, src));
+
+ src_v = // vec_unpackh sign-extends...
+ (vector signed short)(vec_mergeh((vector unsigned char)vzero, src_vF));
+ // now put our elements in the even slots
+ src_v = vec_mergeh(src_v, (vector signed short)vzero);
+
+ filter_v = vec_ld(i << 3, filter);
+ // The 3 above is 2 (filterSize == 4) + 1 (sizeof(short) == 2).
+
+ // The neat trick: We only care for half the elements,
+ // high or low depending on (i<<3)%16 (it's 0 or 8 here),
+ // and we're going to use vec_mule, so we choose
+ // carefully how to "unpack" the elements into the even slots.
+ if ((i << 3) % 16)
+ filter_v = vec_mergel(filter_v, (vector signed short)vzero);
+ else
+ filter_v = vec_mergeh(filter_v, (vector signed short)vzero);
+
+ val_vEven = vec_mule(src_v, filter_v);
+ val_s = vec_sums(val_vEven, vzero);
+ vec_st(val_s, 0, tempo);
+ dst[i] = FFMIN(tempo[3] >> 7, (1 << 15) - 1);
+ }
+ break;
+
+ case 8:
+ for (i = 0; i < dstW; i++) {
+ register int srcPos = filterPos[i];
+
+ vector unsigned char src_v0 = vec_ld(srcPos, src);
+ vector unsigned char src_v1, src_vF;
+ vector signed short src_v, filter_v;
+ vector signed int val_v, val_s;
+ if ((((uintptr_t)src + srcPos) % 16) > 8) {
+ src_v1 = vec_ld(srcPos + 16, src);
+ }
+ src_vF = vec_perm(src_v0, src_v1, vec_lvsl(srcPos, src));
+
+ src_v = // vec_unpackh sign-extends...
+ (vector signed short)(vec_mergeh((vector unsigned char)vzero, src_vF));
+ filter_v = vec_ld(i << 4, filter);
+ // the 4 above is 3 (filterSize == 8) + 1 (sizeof(short) == 2)
+
+ val_v = vec_msums(src_v, filter_v, (vector signed int)vzero);
+ val_s = vec_sums(val_v, vzero);
+ vec_st(val_s, 0, tempo);
+ dst[i] = FFMIN(tempo[3] >> 7, (1 << 15) - 1);
+ }
+ break;
- vector unsigned char src_v0 = vec_ld(srcPos, src);
- vector unsigned char permS = vec_lvsl(srcPos, src);
+ case 16:
+ for (i = 0; i < dstW; i++) {
+ register int srcPos = filterPos[i];
- for (j = 0 ; j < filterSize - 15; j += 16) {
- vector unsigned char src_v1 = vec_ld(srcPos + j + 16, src);
- vector unsigned char src_vF = vec_perm(src_v0, src_v1, permS);
+ vector unsigned char src_v0 = vec_ld(srcPos, src);
+ vector unsigned char src_v1 = vec_ld(srcPos + 16, src);
+ vector unsigned char src_vF = vec_perm(src_v0, src_v1, vec_lvsl(srcPos, src));
- vector signed short src_vA = // vec_unpackh sign-extends...
- (vector signed short)(vec_mergeh((vector unsigned char)vzero, src_vF));
- vector signed short src_vB = // vec_unpackh sign-extends...
- (vector signed short)(vec_mergel((vector unsigned char)vzero, src_vF));
+ vector signed short src_vA = // vec_unpackh sign-extends...
+ (vector signed short)(vec_mergeh((vector unsigned char)vzero, src_vF));
+ vector signed short src_vB = // vec_unpackh sign-extends...
+ (vector signed short)(vec_mergel((vector unsigned char)vzero, src_vF));
- vector signed short filter_v1R = vec_ld((i * 2 * filterSize) + (j * 2) + 16, filter);
- vector signed short filter_v2R = vec_ld((i * 2 * filterSize) + (j * 2) + 32, filter);
- vector signed short filter_v0 = vec_perm(filter_v0R, filter_v1R, permF);
- vector signed short filter_v1 = vec_perm(filter_v1R, filter_v2R, permF);
+ vector signed short filter_v0 = vec_ld(i << 5, filter);
+ vector signed short filter_v1 = vec_ld((i << 5) + 16, filter);
+ // the 5 above are 4 (filterSize == 16) + 1 (sizeof(short) == 2)
- vector signed int val_acc = vec_msums(src_vA, filter_v0, val_v);
- val_v = vec_msums(src_vB, filter_v1, val_acc);
+ vector signed int val_acc = vec_msums(src_vA, filter_v0, (vector signed int)vzero);
+ vector signed int val_v = vec_msums(src_vB, filter_v1, val_acc);
- filter_v0R = filter_v2R;
- src_v0 = src_v1;
- }
+ vector signed int val_s = vec_sums(val_v, vzero);
- if (j < filterSize-7) {
- // loading src_v0 is useless, it's already done above
- //vector unsigned char src_v0 = vec_ld(srcPos + j, src);
- vector unsigned char src_v1, src_vF;
- vector signed short src_v, filter_v1R, filter_v;
- if ((((uintptr_t)src + srcPos) % 16) > 8) {
- src_v1 = vec_ld(srcPos + j + 16, src);
+ vec_st(val_s, 0, tempo);
+ dst[i] = FFMIN(tempo[3] >> 7, (1 << 15) - 1);
+ }
+ break;
+
+ default:
+ for (i = 0; i < dstW; i++) {
+ register int j;
+ register int srcPos = filterPos[i];
+
+ vector signed int val_s, val_v = (vector signed int)vzero;
+ vector signed short filter_v0R = vec_ld(i * 2 * filterSize, filter);
+ vector unsigned char permF = vec_lvsl((i * 2 * filterSize), filter);
+
+ vector unsigned char src_v0 = vec_ld(srcPos, src);
+ vector unsigned char permS = vec_lvsl(srcPos, src);
+
+ for (j = 0; j < filterSize - 15; j += 16) {
+ vector unsigned char src_v1 = vec_ld(srcPos + j + 16, src);
+ vector unsigned char src_vF = vec_perm(src_v0, src_v1, permS);
+
+ vector signed short src_vA = // vec_unpackh sign-extends...
+ (vector signed short)(vec_mergeh((vector unsigned char)vzero, src_vF));
+ vector signed short src_vB = // vec_unpackh sign-extends...
+ (vector signed short)(vec_mergel((vector unsigned char)vzero, src_vF));
+
+ vector signed short filter_v1R = vec_ld((i * 2 * filterSize) + (j * 2) + 16, filter);
+ vector signed short filter_v2R = vec_ld((i * 2 * filterSize) + (j * 2) + 32, filter);
+ vector signed short filter_v0 = vec_perm(filter_v0R, filter_v1R, permF);
+ vector signed short filter_v1 = vec_perm(filter_v1R, filter_v2R, permF);
+
+ vector signed int val_acc = vec_msums(src_vA, filter_v0, val_v);
+ val_v = vec_msums(src_vB, filter_v1, val_acc);
+
+ filter_v0R = filter_v2R;
+ src_v0 = src_v1;
+ }
+
+ if (j < filterSize - 7) {
+ // loading src_v0 is useless, it's already done above
+ // vector unsigned char src_v0 = vec_ld(srcPos + j, src);
+ vector unsigned char src_v1, src_vF;
+ vector signed short src_v, filter_v1R, filter_v;
+ if ((((uintptr_t)src + srcPos) % 16) > 8) {
+ src_v1 = vec_ld(srcPos + j + 16, src);
+ }
+ src_vF = vec_perm(src_v0, src_v1, permS);
+
+ src_v = // vec_unpackh sign-extends...
+ (vector signed short)(vec_mergeh((vector unsigned char)vzero, src_vF));
+ // loading filter_v0R is useless, it's already done above
+ // vector signed short filter_v0R = vec_ld((i * 2 * filterSize) + j, filter);
+ filter_v1R = vec_ld((i * 2 * filterSize) + (j * 2) + 16, filter);
+ filter_v = vec_perm(filter_v0R, filter_v1R, permF);
+
+ val_v = vec_msums(src_v, filter_v, val_v);
+ }
+
+ val_s = vec_sums(val_v, vzero);
+
+ vec_st(val_s, 0, tempo);
+ dst[i] = FFMIN(tempo[3] >> 7, (1 << 15) - 1);
}
- src_vF = vec_perm(src_v0, src_v1, permS);
-
- src_v = // vec_unpackh sign-extends...
- (vector signed short)(vec_mergeh((vector unsigned char)vzero, src_vF));
- // loading filter_v0R is useless, it's already done above
- //vector signed short filter_v0R = vec_ld((i * 2 * filterSize) + j, filter);
- filter_v1R = vec_ld((i * 2 * filterSize) + (j * 2) + 16, filter);
- filter_v = vec_perm(filter_v0R, filter_v1R, permF);
-
- val_v = vec_msums(src_v, filter_v, val_v);
}
-
- val_s = vec_sums(val_v, vzero);
-
- vec_st(val_s, 0, tempo);
- dst[i] = FFMIN(tempo[3]>>7, (1<<15)-1);
- }
-
- }
- }
}
-void ff_sws_init_swScale_altivec(SwsContext *c)
+av_cold void ff_sws_init_swScale_altivec(SwsContext *c)
{
- enum PixelFormat dstFormat = c->dstFormat;
+ enum AVPixelFormat dstFormat = c->dstFormat;
if (!(av_get_cpu_flags() & AV_CPU_FLAG_ALTIVEC))
return;
@@ -335,7 +296,7 @@ void ff_sws_init_swScale_altivec(SwsContext *c)
c->hyScale = c->hcScale = hScale_altivec_real;
}
if (!is16BPS(dstFormat) && !is9_OR_10BPS(dstFormat) &&
- dstFormat != PIX_FMT_NV12 && dstFormat != PIX_FMT_NV21 &&
+ dstFormat != AV_PIX_FMT_NV12 && dstFormat != AV_PIX_FMT_NV21 &&
!c->alpPixBuf) {
c->yuv2planeX = yuv2planeX_altivec;
}
@@ -344,12 +305,24 @@ void ff_sws_init_swScale_altivec(SwsContext *c)
* match what's found in the body of ff_yuv2packedX_altivec() */
if (!(c->flags & (SWS_BITEXACT | SWS_FULL_CHR_H_INT)) && !c->alpPixBuf) {
switch (c->dstFormat) {
- case PIX_FMT_ABGR: c->yuv2packedX = ff_yuv2abgr_X_altivec; break;
- case PIX_FMT_BGRA: c->yuv2packedX = ff_yuv2bgra_X_altivec; break;
- case PIX_FMT_ARGB: c->yuv2packedX = ff_yuv2argb_X_altivec; break;
- case PIX_FMT_RGBA: c->yuv2packedX = ff_yuv2rgba_X_altivec; break;
- case PIX_FMT_BGR24: c->yuv2packedX = ff_yuv2bgr24_X_altivec; break;
- case PIX_FMT_RGB24: c->yuv2packedX = ff_yuv2rgb24_X_altivec; break;
+ case AV_PIX_FMT_ABGR:
+ c->yuv2packedX = ff_yuv2abgr_X_altivec;
+ break;
+ case AV_PIX_FMT_BGRA:
+ c->yuv2packedX = ff_yuv2bgra_X_altivec;
+ break;
+ case AV_PIX_FMT_ARGB:
+ c->yuv2packedX = ff_yuv2argb_X_altivec;
+ break;
+ case AV_PIX_FMT_RGBA:
+ c->yuv2packedX = ff_yuv2rgba_X_altivec;
+ break;
+ case AV_PIX_FMT_BGR24:
+ c->yuv2packedX = ff_yuv2bgr24_X_altivec;
+ break;
+ case AV_PIX_FMT_RGB24:
+ c->yuv2packedX = ff_yuv2rgb24_X_altivec;
+ break;
}
}
}
diff --git a/gst-libs/ext/libav/libswscale/ppc/yuv2rgb_altivec.c b/gst-libs/ext/libav/libswscale/ppc/yuv2rgb_altivec.c
index 73c02e9..94e87fe 100644
--- a/gst-libs/ext/libav/libswscale/ppc/yuv2rgb_altivec.c
+++ b/gst-libs/ext/libav/libswscale/ppc/yuv2rgb_altivec.c
@@ -21,79 +21,81 @@
*/
/*
-Convert I420 YV12 to RGB in various formats,
- it rejects images that are not in 420 formats,
- it rejects images that don't have widths of multiples of 16,
- it rejects images that don't have heights of multiples of 2.
-Reject defers to C simulation code.
-
-Lots of optimizations to be done here.
-
-1. Need to fix saturation code. I just couldn't get it to fly with packs
- and adds, so we currently use max/min to clip.
-
-2. The inefficient use of chroma loading needs a bit of brushing up.
-
-3. Analysis of pipeline stalls needs to be done. Use shark to identify
- pipeline stalls.
-
-
-MODIFIED to calculate coeffs from currently selected color space.
-MODIFIED core to be a macro where you specify the output format.
-ADDED UYVY conversion which is never called due to some thing in swscale.
-CORRECTED algorithim selection to be strict on input formats.
-ADDED runtime detection of AltiVec.
-
-ADDED altivec_yuv2packedX vertical scl + RGB converter
-
-March 27,2004
-PERFORMANCE ANALYSIS
-
-The C version uses 25% of the processor or ~250Mips for D1 video rawvideo
-used as test.
-The AltiVec version uses 10% of the processor or ~100Mips for D1 video
-same sequence.
-
-720 * 480 * 30 ~10MPS
-
-so we have roughly 10 clocks per pixel. This is too high, something has
-to be wrong.
-
-OPTIMIZED clip codes to utilize vec_max and vec_packs removing the
-need for vec_min.
-
-OPTIMIZED DST OUTPUT cache/DMA controls. We are pretty much guaranteed to have
-the input video frame, it was just decompressed so it probably resides in L1
-caches. However, we are creating the output video stream. This needs to use the
-DSTST instruction to optimize for the cache. We couple this with the fact that
-we are not going to be visiting the input buffer again so we mark it Least
-Recently Used. This shaves 25% of the processor cycles off.
-
-Now memcpy is the largest mips consumer in the system, probably due
-to the inefficient X11 stuff.
-
-GL libraries seem to be very slow on this machine 1.33Ghz PB running
-Jaguar, this is not the case for my 1Ghz PB. I thought it might be
-a versioning issue, however I have libGL.1.2.dylib for both
-machines. (We need to figure this out now.)
-
-GL2 libraries work now with patch for RGB32.
-
-NOTE: quartz vo driver ARGB32_to_RGB24 consumes 30% of the processor.
-
-Integrated luma prescaling adjustment for saturation/contrast/brightness
-adjustment.
-*/
+ * Convert I420 YV12 to RGB in various formats,
+ * it rejects images that are not in 420 formats,
+ * it rejects images that don't have widths of multiples of 16,
+ * it rejects images that don't have heights of multiples of 2.
+ * Reject defers to C simulation code.
+ *
+ * Lots of optimizations to be done here.
+ *
+ * 1. Need to fix saturation code. I just couldn't get it to fly with packs
+ * and adds, so we currently use max/min to clip.
+ *
+ * 2. The inefficient use of chroma loading needs a bit of brushing up.
+ *
+ * 3. Analysis of pipeline stalls needs to be done. Use shark to identify
+ * pipeline stalls.
+ *
+ *
+ * MODIFIED to calculate coeffs from currently selected color space.
+ * MODIFIED core to be a macro where you specify the output format.
+ * ADDED UYVY conversion which is never called due to some thing in swscale.
+ * CORRECTED algorithim selection to be strict on input formats.
+ * ADDED runtime detection of AltiVec.
+ *
+ * ADDED altivec_yuv2packedX vertical scl + RGB converter
+ *
+ * March 27,2004
+ * PERFORMANCE ANALYSIS
+ *
+ * The C version uses 25% of the processor or ~250Mips for D1 video rawvideo
+ * used as test.
+ * The AltiVec version uses 10% of the processor or ~100Mips for D1 video
+ * same sequence.
+ *
+ * 720 * 480 * 30 ~10MPS
+ *
+ * so we have roughly 10 clocks per pixel. This is too high, something has
+ * to be wrong.
+ *
+ * OPTIMIZED clip codes to utilize vec_max and vec_packs removing the
+ * need for vec_min.
+ *
+ * OPTIMIZED DST OUTPUT cache/DMA controls. We are pretty much guaranteed to
+ * have the input video frame, it was just decompressed so it probably resides
+ * in L1 caches. However, we are creating the output video stream. This needs
+ * to use the DSTST instruction to optimize for the cache. We couple this with
+ * the fact that we are not going to be visiting the input buffer again so we
+ * mark it Least Recently Used. This shaves 25% of the processor cycles off.
+ *
+ * Now memcpy is the largest mips consumer in the system, probably due
+ * to the inefficient X11 stuff.
+ *
+ * GL libraries seem to be very slow on this machine 1.33Ghz PB running
+ * Jaguar, this is not the case for my 1Ghz PB. I thought it might be
+ * a versioning issue, however I have libGL.1.2.dylib for both
+ * machines. (We need to figure this out now.)
+ *
+ * GL2 libraries work now with patch for RGB32.
+ *
+ * NOTE: quartz vo driver ARGB32_to_RGB24 consumes 30% of the processor.
+ *
+ * Integrated luma prescaling adjustment for saturation/contrast/brightness
+ * adjustment.
+ */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <inttypes.h>
#include <assert.h>
+
#include "config.h"
#include "libswscale/rgb2rgb.h"
#include "libswscale/swscale.h"
#include "libswscale/swscale_internal.h"
+#include "libavutil/attributes.h"
#include "libavutil/cpu.h"
#include "yuv2rgb_altivec.h"
@@ -103,628 +105,642 @@ adjustment.
typedef unsigned char ubyte;
typedef signed char sbyte;
-
/* RGB interleaver, 16 planar pels 8-bit samples per channel in
- homogeneous vector registers x0,x1,x2 are interleaved with the
- following technique:
-
- o0 = vec_mergeh (x0,x1);
- o1 = vec_perm (o0, x2, perm_rgb_0);
- o2 = vec_perm (o0, x2, perm_rgb_1);
- o3 = vec_mergel (x0,x1);
- o4 = vec_perm (o3,o2,perm_rgb_2);
- o5 = vec_perm (o3,o2,perm_rgb_3);
-
- perm_rgb_0: o0(RG).h v1(B) --> o1*
- 0 1 2 3 4
- rgbr|gbrg|brgb|rgbr
- 0010 0100 1001 0010
- 0102 3145 2673 894A
-
- perm_rgb_1: o0(RG).h v1(B) --> o2
- 0 1 2 3 4
- gbrg|brgb|bbbb|bbbb
- 0100 1001 1111 1111
- B5CD 6EF7 89AB CDEF
-
- perm_rgb_2: o3(RG).l o2(rgbB.l) --> o4*
- 0 1 2 3 4
- gbrg|brgb|rgbr|gbrg
- 1111 1111 0010 0100
- 89AB CDEF 0182 3945
-
- perm_rgb_2: o3(RG).l o2(rgbB.l) ---> o5*
- 0 1 2 3 4
- brgb|rgbr|gbrg|brgb
- 1001 0010 0100 1001
- a67b 89cA BdCD eEFf
-
-*/
-static
-const vector unsigned char
- perm_rgb_0 = {0x00,0x01,0x10,0x02,0x03,0x11,0x04,0x05,
- 0x12,0x06,0x07,0x13,0x08,0x09,0x14,0x0a},
- perm_rgb_1 = {0x0b,0x15,0x0c,0x0d,0x16,0x0e,0x0f,0x17,
- 0x18,0x19,0x1a,0x1b,0x1c,0x1d,0x1e,0x1f},
- perm_rgb_2 = {0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,
- 0x00,0x01,0x18,0x02,0x03,0x19,0x04,0x05},
- perm_rgb_3 = {0x1a,0x06,0x07,0x1b,0x08,0x09,0x1c,0x0a,
- 0x0b,0x1d,0x0c,0x0d,0x1e,0x0e,0x0f,0x1f};
-
-#define vec_merge3(x2,x1,x0,y0,y1,y2) \
-do { \
- __typeof__(x0) o0,o2,o3; \
- o0 = vec_mergeh (x0,x1); \
- y0 = vec_perm (o0, x2, perm_rgb_0); \
- o2 = vec_perm (o0, x2, perm_rgb_1); \
- o3 = vec_mergel (x0,x1); \
- y1 = vec_perm (o3,o2,perm_rgb_2); \
- y2 = vec_perm (o3,o2,perm_rgb_3); \
-} while(0)
-
-#define vec_mstbgr24(x0,x1,x2,ptr) \
-do { \
- __typeof__(x0) _0,_1,_2; \
- vec_merge3 (x0,x1,x2,_0,_1,_2); \
- vec_st (_0, 0, ptr++); \
- vec_st (_1, 0, ptr++); \
- vec_st (_2, 0, ptr++); \
-} while (0)
-
-#define vec_mstrgb24(x0,x1,x2,ptr) \
-do { \
- __typeof__(x0) _0,_1,_2; \
- vec_merge3 (x2,x1,x0,_0,_1,_2); \
- vec_st (_0, 0, ptr++); \
- vec_st (_1, 0, ptr++); \
- vec_st (_2, 0, ptr++); \
-} while (0)
+ * homogeneous vector registers x0,x1,x2 are interleaved with the
+ * following technique:
+ *
+ * o0 = vec_mergeh(x0, x1);
+ * o1 = vec_perm(o0, x2, perm_rgb_0);
+ * o2 = vec_perm(o0, x2, perm_rgb_1);
+ * o3 = vec_mergel(x0, x1);
+ * o4 = vec_perm(o3, o2, perm_rgb_2);
+ * o5 = vec_perm(o3, o2, perm_rgb_3);
+ *
+ * perm_rgb_0: o0(RG).h v1(B) --> o1*
+ * 0 1 2 3 4
+ * rgbr|gbrg|brgb|rgbr
+ * 0010 0100 1001 0010
+ * 0102 3145 2673 894A
+ *
+ * perm_rgb_1: o0(RG).h v1(B) --> o2
+ * 0 1 2 3 4
+ * gbrg|brgb|bbbb|bbbb
+ * 0100 1001 1111 1111
+ * B5CD 6EF7 89AB CDEF
+ *
+ * perm_rgb_2: o3(RG).l o2(rgbB.l) --> o4*
+ * 0 1 2 3 4
+ * gbrg|brgb|rgbr|gbrg
+ * 1111 1111 0010 0100
+ * 89AB CDEF 0182 3945
+ *
+ * perm_rgb_2: o3(RG).l o2(rgbB.l) ---> o5*
+ * 0 1 2 3 4
+ * brgb|rgbr|gbrg|brgb
+ * 1001 0010 0100 1001
+ * a67b 89cA BdCD eEFf
+ *
+ */
+static const vector unsigned char
+ perm_rgb_0 = { 0x00, 0x01, 0x10, 0x02, 0x03, 0x11, 0x04, 0x05,
+ 0x12, 0x06, 0x07, 0x13, 0x08, 0x09, 0x14, 0x0a },
+ perm_rgb_1 = { 0x0b, 0x15, 0x0c, 0x0d, 0x16, 0x0e, 0x0f, 0x17,
+ 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f },
+ perm_rgb_2 = { 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
+ 0x00, 0x01, 0x18, 0x02, 0x03, 0x19, 0x04, 0x05 },
+ perm_rgb_3 = { 0x1a, 0x06, 0x07, 0x1b, 0x08, 0x09, 0x1c, 0x0a,
+ 0x0b, 0x1d, 0x0c, 0x0d, 0x1e, 0x0e, 0x0f, 0x1f };
+
+#define vec_merge3(x2, x1, x0, y0, y1, y2) \
+ do { \
+ __typeof__(x0) o0, o2, o3; \
+ o0 = vec_mergeh(x0, x1); \
+ y0 = vec_perm(o0, x2, perm_rgb_0); \
+ o2 = vec_perm(o0, x2, perm_rgb_1); \
+ o3 = vec_mergel(x0, x1); \
+ y1 = vec_perm(o3, o2, perm_rgb_2); \
+ y2 = vec_perm(o3, o2, perm_rgb_3); \
+ } while (0)
+
+#define vec_mstbgr24(x0, x1, x2, ptr) \
+ do { \
+ __typeof__(x0) _0, _1, _2; \
+ vec_merge3(x0, x1, x2, _0, _1, _2); \
+ vec_st(_0, 0, ptr++); \
+ vec_st(_1, 0, ptr++); \
+ vec_st(_2, 0, ptr++); \
+ } while (0)
+
+#define vec_mstrgb24(x0, x1, x2, ptr) \
+ do { \
+ __typeof__(x0) _0, _1, _2; \
+ vec_merge3(x2, x1, x0, _0, _1, _2); \
+ vec_st(_0, 0, ptr++); \
+ vec_st(_1, 0, ptr++); \
+ vec_st(_2, 0, ptr++); \
+ } while (0)
/* pack the pixels in rgb0 format
- msb R
- lsb 0
-*/
-#define vec_mstrgb32(T,x0,x1,x2,x3,ptr) \
-do { \
- T _0,_1,_2,_3; \
- _0 = vec_mergeh (x0,x1); \
- _1 = vec_mergeh (x2,x3); \
- _2 = (T)vec_mergeh ((vector unsigned short)_0,(vector unsigned short)_1); \
- _3 = (T)vec_mergel ((vector unsigned short)_0,(vector unsigned short)_1); \
- vec_st (_2, 0*16, (T *)ptr); \
- vec_st (_3, 1*16, (T *)ptr); \
- _0 = vec_mergel (x0,x1); \
- _1 = vec_mergel (x2,x3); \
- _2 = (T)vec_mergeh ((vector unsigned short)_0,(vector unsigned short)_1); \
- _3 = (T)vec_mergel ((vector unsigned short)_0,(vector unsigned short)_1); \
- vec_st (_2, 2*16, (T *)ptr); \
- vec_st (_3, 3*16, (T *)ptr); \
- ptr += 4; \
-} while (0)
+ * msb R
+ * lsb 0
+ */
+#define vec_mstrgb32(T, x0, x1, x2, x3, ptr) \
+ do { \
+ T _0, _1, _2, _3; \
+ _0 = vec_mergeh(x0, x1); \
+ _1 = vec_mergeh(x2, x3); \
+ _2 = (T) vec_mergeh((vector unsigned short) _0, \
+ (vector unsigned short) _1); \
+ _3 = (T) vec_mergel((vector unsigned short) _0, \
+ (vector unsigned short) _1); \
+ vec_st(_2, 0 * 16, (T *) ptr); \
+ vec_st(_3, 1 * 16, (T *) ptr); \
+ _0 = vec_mergel(x0, x1); \
+ _1 = vec_mergel(x2, x3); \
+ _2 = (T) vec_mergeh((vector unsigned short) _0, \
+ (vector unsigned short) _1); \
+ _3 = (T) vec_mergel((vector unsigned short) _0, \
+ (vector unsigned short) _1); \
+ vec_st(_2, 2 * 16, (T *) ptr); \
+ vec_st(_3, 3 * 16, (T *) ptr); \
+ ptr += 4; \
+ } while (0)
/*
+ * 1 0 1.4021 | | Y |
+ * 1 -0.3441 -0.7142 |x| Cb|
+ * 1 1.7718 0 | | Cr|
+ *
+ *
+ * Y: [-128 127]
+ * Cb/Cr : [-128 127]
+ *
+ * typical YUV conversion works on Y: 0-255 this version has been
+ * optimized for JPEG decoding.
+ */
- | 1 0 1.4021 | | Y |
- | 1 -0.3441 -0.7142 |x| Cb|
- | 1 1.7718 0 | | Cr|
-
-
- Y: [-128 127]
- Cb/Cr : [-128 127]
-
- typical yuv conversion work on Y: 0-255 this version has been optimized for jpeg decode.
-
-*/
-
-
-
-
-#define vec_unh(x) \
- (vector signed short) \
- vec_perm(x,(__typeof__(x)){0}, \
- ((vector unsigned char){0x10,0x00,0x10,0x01,0x10,0x02,0x10,0x03,\
- 0x10,0x04,0x10,0x05,0x10,0x06,0x10,0x07}))
-#define vec_unl(x) \
- (vector signed short) \
- vec_perm(x,(__typeof__(x)){0}, \
- ((vector unsigned char){0x10,0x08,0x10,0x09,0x10,0x0A,0x10,0x0B,\
- 0x10,0x0C,0x10,0x0D,0x10,0x0E,0x10,0x0F}))
-
-#define vec_clip_s16(x) \
- vec_max (vec_min (x, ((vector signed short){235,235,235,235,235,235,235,235})), \
- ((vector signed short){ 16, 16, 16, 16, 16, 16, 16, 16}))
-
-#define vec_packclp(x,y) \
- (vector unsigned char)vec_packs \
- ((vector unsigned short)vec_max (x,((vector signed short) {0})), \
- (vector unsigned short)vec_max (y,((vector signed short) {0})))
-
-//#define out_pixels(a,b,c,ptr) vec_mstrgb32(__typeof__(a),((__typeof__ (a)){255}),a,a,a,ptr)
-
-
-static inline void cvtyuvtoRGB (SwsContext *c,
- vector signed short Y, vector signed short U, vector signed short V,
- vector signed short *R, vector signed short *G, vector signed short *B)
+#define vec_unh(x) \
+ (vector signed short) \
+ vec_perm(x, (__typeof__(x)) { 0 }, \
+ ((vector unsigned char) { \
+ 0x10, 0x00, 0x10, 0x01, 0x10, 0x02, 0x10, 0x03, \
+ 0x10, 0x04, 0x10, 0x05, 0x10, 0x06, 0x10, 0x07 }))
+
+#define vec_unl(x) \
+ (vector signed short) \
+ vec_perm(x, (__typeof__(x)) { 0 }, \
+ ((vector unsigned char) { \
+ 0x10, 0x08, 0x10, 0x09, 0x10, 0x0A, 0x10, 0x0B, \
+ 0x10, 0x0C, 0x10, 0x0D, 0x10, 0x0E, 0x10, 0x0F }))
+
+#define vec_clip_s16(x) \
+ vec_max(vec_min(x, ((vector signed short) { \
+ 235, 235, 235, 235, 235, 235, 235, 235 })), \
+ ((vector signed short) { 16, 16, 16, 16, 16, 16, 16, 16 }))
+
+#define vec_packclp(x, y) \
+ (vector unsigned char) \
+ vec_packs((vector unsigned short) \
+ vec_max(x, ((vector signed short) { 0 })), \
+ (vector unsigned short) \
+ vec_max(y, ((vector signed short) { 0 })))
+
+//#define out_pixels(a, b, c, ptr) vec_mstrgb32(__typeof__(a), ((__typeof__(a)) { 255 }), a, a, a, ptr)
+
+static inline void cvtyuvtoRGB(SwsContext *c, vector signed short Y,
+ vector signed short U, vector signed short V,
+ vector signed short *R, vector signed short *G,
+ vector signed short *B)
{
- vector signed short vx,ux,uvx;
+ vector signed short vx, ux, uvx;
- Y = vec_mradds (Y, c->CY, c->OY);
- U = vec_sub (U,(vector signed short)
- vec_splat((vector signed short){128},0));
- V = vec_sub (V,(vector signed short)
- vec_splat((vector signed short){128},0));
+ Y = vec_mradds(Y, c->CY, c->OY);
+ U = vec_sub(U, (vector signed short)
+ vec_splat((vector signed short) { 128 }, 0));
+ V = vec_sub(V, (vector signed short)
+ vec_splat((vector signed short) { 128 }, 0));
- // ux = (CBU*(u<<c->CSHIFT)+0x4000)>>15;
- ux = vec_sl (U, c->CSHIFT);
- *B = vec_mradds (ux, c->CBU, Y);
+ // ux = (CBU * (u << c->CSHIFT) + 0x4000) >> 15;
+ ux = vec_sl(U, c->CSHIFT);
+ *B = vec_mradds(ux, c->CBU, Y);
- // vx = (CRV*(v<<c->CSHIFT)+0x4000)>>15;
- vx = vec_sl (V, c->CSHIFT);
- *R = vec_mradds (vx, c->CRV, Y);
+ // vx = (CRV * (v << c->CSHIFT) + 0x4000) >> 15;
+ vx = vec_sl(V, c->CSHIFT);
+ *R = vec_mradds(vx, c->CRV, Y);
- // uvx = ((CGU*u) + (CGV*v))>>15;
- uvx = vec_mradds (U, c->CGU, Y);
- *G = vec_mradds (V, c->CGV, uvx);
+ // uvx = ((CGU * u) + (CGV * v)) >> 15;
+ uvx = vec_mradds(U, c->CGU, Y);
+ *G = vec_mradds(V, c->CGV, uvx);
}
-
/*
- ------------------------------------------------------------------------------
- CS converters
- ------------------------------------------------------------------------------
-*/
-
+ * ------------------------------------------------------------------------------
+ * CS converters
+ * ------------------------------------------------------------------------------
+ */
-#define DEFCSP420_CVT(name,out_pixels) \
-static int altivec_##name (SwsContext *c, \
- const unsigned char **in, int *instrides, \
- int srcSliceY, int srcSliceH, \
- unsigned char **oplanes, int *outstrides) \
-{ \
- int w = c->srcW; \
- int h = srcSliceH; \
- int i,j; \
- int instrides_scl[3]; \
- vector unsigned char y0,y1; \
- \
- vector signed char u,v; \
- \
- vector signed short Y0,Y1,Y2,Y3; \
- vector signed short U,V; \
- vector signed short vx,ux,uvx; \
- vector signed short vx0,ux0,uvx0; \
- vector signed short vx1,ux1,uvx1; \
- vector signed short R0,G0,B0; \
- vector signed short R1,G1,B1; \
- vector unsigned char R,G,B; \
- \
- vector unsigned char *y1ivP, *y2ivP, *uivP, *vivP; \
- vector unsigned char align_perm; \
- \
- vector signed short \
- lCY = c->CY, \
- lOY = c->OY, \
- lCRV = c->CRV, \
- lCBU = c->CBU, \
- lCGU = c->CGU, \
- lCGV = c->CGV; \
- \
- vector unsigned short lCSHIFT = c->CSHIFT; \
- \
- const ubyte *y1i = in[0]; \
- const ubyte *y2i = in[0]+instrides[0]; \
- const ubyte *ui = in[1]; \
- const ubyte *vi = in[2]; \
- \
- vector unsigned char *oute \
- = (vector unsigned char *) \
- (oplanes[0]+srcSliceY*outstrides[0]); \
- vector unsigned char *outo \
- = (vector unsigned char *) \
- (oplanes[0]+srcSliceY*outstrides[0]+outstrides[0]); \
- \
- \
- instrides_scl[0] = instrides[0]*2-w; /* the loop moves y{1,2}i by w */ \
- instrides_scl[1] = instrides[1]-w/2; /* the loop moves ui by w/2 */ \
- instrides_scl[2] = instrides[2]-w/2; /* the loop moves vi by w/2 */ \
- \
- \
- for (i=0;i<h/2;i++) { \
- vec_dstst (outo, (0x02000002|(((w*3+32)/32)<<16)), 0); \
- vec_dstst (oute, (0x02000002|(((w*3+32)/32)<<16)), 1); \
- \
- for (j=0;j<w/16;j++) { \
- \
- y1ivP = (vector unsigned char *)y1i; \
- y2ivP = (vector unsigned char *)y2i; \
- uivP = (vector unsigned char *)ui; \
- vivP = (vector unsigned char *)vi; \
- \
- align_perm = vec_lvsl (0, y1i); \
- y0 = (vector unsigned char) \
- vec_perm (y1ivP[0], y1ivP[1], align_perm); \
- \
- align_perm = vec_lvsl (0, y2i); \
- y1 = (vector unsigned char) \
- vec_perm (y2ivP[0], y2ivP[1], align_perm); \
- \
- align_perm = vec_lvsl (0, ui); \
- u = (vector signed char) \
- vec_perm (uivP[0], uivP[1], align_perm); \
- \
- align_perm = vec_lvsl (0, vi); \
- v = (vector signed char) \
- vec_perm (vivP[0], vivP[1], align_perm); \
- \
- u = (vector signed char) \
- vec_sub (u,(vector signed char) \
- vec_splat((vector signed char){128},0)); \
- v = (vector signed char) \
- vec_sub (v,(vector signed char) \
- vec_splat((vector signed char){128},0)); \
- \
- U = vec_unpackh (u); \
- V = vec_unpackh (v); \
- \
- \
- Y0 = vec_unh (y0); \
- Y1 = vec_unl (y0); \
- Y2 = vec_unh (y1); \
- Y3 = vec_unl (y1); \
- \
- Y0 = vec_mradds (Y0, lCY, lOY); \
- Y1 = vec_mradds (Y1, lCY, lOY); \
- Y2 = vec_mradds (Y2, lCY, lOY); \
- Y3 = vec_mradds (Y3, lCY, lOY); \
- \
- /* ux = (CBU*(u<<CSHIFT)+0x4000)>>15 */ \
- ux = vec_sl (U, lCSHIFT); \
- ux = vec_mradds (ux, lCBU, (vector signed short){0}); \
- ux0 = vec_mergeh (ux,ux); \
- ux1 = vec_mergel (ux,ux); \
- \
- /* vx = (CRV*(v<<CSHIFT)+0x4000)>>15; */ \
- vx = vec_sl (V, lCSHIFT); \
- vx = vec_mradds (vx, lCRV, (vector signed short){0}); \
- vx0 = vec_mergeh (vx,vx); \
- vx1 = vec_mergel (vx,vx); \
- \
- /* uvx = ((CGU*u) + (CGV*v))>>15 */ \
- uvx = vec_mradds (U, lCGU, (vector signed short){0}); \
- uvx = vec_mradds (V, lCGV, uvx); \
- uvx0 = vec_mergeh (uvx,uvx); \
- uvx1 = vec_mergel (uvx,uvx); \
- \
- R0 = vec_add (Y0,vx0); \
- G0 = vec_add (Y0,uvx0); \
- B0 = vec_add (Y0,ux0); \
- R1 = vec_add (Y1,vx1); \
- G1 = vec_add (Y1,uvx1); \
- B1 = vec_add (Y1,ux1); \
- \
- R = vec_packclp (R0,R1); \
- G = vec_packclp (G0,G1); \
- B = vec_packclp (B0,B1); \
- \
- out_pixels(R,G,B,oute); \
- \
- R0 = vec_add (Y2,vx0); \
- G0 = vec_add (Y2,uvx0); \
- B0 = vec_add (Y2,ux0); \
- R1 = vec_add (Y3,vx1); \
- G1 = vec_add (Y3,uvx1); \
- B1 = vec_add (Y3,ux1); \
- R = vec_packclp (R0,R1); \
- G = vec_packclp (G0,G1); \
- B = vec_packclp (B0,B1); \
- \
- \
- out_pixels(R,G,B,outo); \
- \
- y1i += 16; \
- y2i += 16; \
- ui += 8; \
- vi += 8; \
- \
- } \
- \
- outo += (outstrides[0])>>4; \
- oute += (outstrides[0])>>4; \
- \
- ui += instrides_scl[1]; \
- vi += instrides_scl[2]; \
- y1i += instrides_scl[0]; \
- y2i += instrides_scl[0]; \
- } \
- return srcSliceH; \
+#define DEFCSP420_CVT(name, out_pixels) \
+static int altivec_ ## name(SwsContext *c, const unsigned char **in, \
+ int *instrides, int srcSliceY, int srcSliceH, \
+ unsigned char **oplanes, int *outstrides) \
+{ \
+ int w = c->srcW; \
+ int h = srcSliceH; \
+ int i, j; \
+ int instrides_scl[3]; \
+ vector unsigned char y0, y1; \
+ \
+ vector signed char u, v; \
+ \
+ vector signed short Y0, Y1, Y2, Y3; \
+ vector signed short U, V; \
+ vector signed short vx, ux, uvx; \
+ vector signed short vx0, ux0, uvx0; \
+ vector signed short vx1, ux1, uvx1; \
+ vector signed short R0, G0, B0; \
+ vector signed short R1, G1, B1; \
+ vector unsigned char R, G, B; \
+ \
+ const vector unsigned char *y1ivP, *y2ivP, *uivP, *vivP; \
+ vector unsigned char align_perm; \
+ \
+ vector signed short lCY = c->CY; \
+ vector signed short lOY = c->OY; \
+ vector signed short lCRV = c->CRV; \
+ vector signed short lCBU = c->CBU; \
+ vector signed short lCGU = c->CGU; \
+ vector signed short lCGV = c->CGV; \
+ vector unsigned short lCSHIFT = c->CSHIFT; \
+ \
+ const ubyte *y1i = in[0]; \
+ const ubyte *y2i = in[0] + instrides[0]; \
+ const ubyte *ui = in[1]; \
+ const ubyte *vi = in[2]; \
+ \
+ vector unsigned char *oute = \
+ (vector unsigned char *) \
+ (oplanes[0] + srcSliceY * outstrides[0]); \
+ vector unsigned char *outo = \
+ (vector unsigned char *) \
+ (oplanes[0] + srcSliceY * outstrides[0] + outstrides[0]); \
+ \
+ /* loop moves y{1, 2}i by w */ \
+ instrides_scl[0] = instrides[0] * 2 - w; \
+ /* loop moves ui by w / 2 */ \
+ instrides_scl[1] = instrides[1] - w / 2; \
+ /* loop moves vi by w / 2 */ \
+ instrides_scl[2] = instrides[2] - w / 2; \
+ \
+ for (i = 0; i < h / 2; i++) { \
+ vec_dstst(outo, (0x02000002 | (((w * 3 + 32) / 32) << 16)), 0); \
+ vec_dstst(oute, (0x02000002 | (((w * 3 + 32) / 32) << 16)), 1); \
+ \
+ for (j = 0; j < w / 16; j++) { \
+ y1ivP = (const vector unsigned char *) y1i; \
+ y2ivP = (const vector unsigned char *) y2i; \
+ uivP = (const vector unsigned char *) ui; \
+ vivP = (const vector unsigned char *) vi; \
+ \
+ align_perm = vec_lvsl(0, y1i); \
+ y0 = (vector unsigned char) \
+ vec_perm(y1ivP[0], y1ivP[1], align_perm); \
+ \
+ align_perm = vec_lvsl(0, y2i); \
+ y1 = (vector unsigned char) \
+ vec_perm(y2ivP[0], y2ivP[1], align_perm); \
+ \
+ align_perm = vec_lvsl(0, ui); \
+ u = (vector signed char) \
+ vec_perm(uivP[0], uivP[1], align_perm); \
+ \
+ align_perm = vec_lvsl(0, vi); \
+ v = (vector signed char) \
+ vec_perm(vivP[0], vivP[1], align_perm); \
+ \
+ u = (vector signed char) \
+ vec_sub(u, \
+ (vector signed char) \
+ vec_splat((vector signed char) { 128 }, 0)); \
+ v = (vector signed char) \
+ vec_sub(v, \
+ (vector signed char) \
+ vec_splat((vector signed char) { 128 }, 0)); \
+ \
+ U = vec_unpackh(u); \
+ V = vec_unpackh(v); \
+ \
+ Y0 = vec_unh(y0); \
+ Y1 = vec_unl(y0); \
+ Y2 = vec_unh(y1); \
+ Y3 = vec_unl(y1); \
+ \
+ Y0 = vec_mradds(Y0, lCY, lOY); \
+ Y1 = vec_mradds(Y1, lCY, lOY); \
+ Y2 = vec_mradds(Y2, lCY, lOY); \
+ Y3 = vec_mradds(Y3, lCY, lOY); \
+ \
+ /* ux = (CBU * (u << CSHIFT) + 0x4000) >> 15 */ \
+ ux = vec_sl(U, lCSHIFT); \
+ ux = vec_mradds(ux, lCBU, (vector signed short) { 0 }); \
+ ux0 = vec_mergeh(ux, ux); \
+ ux1 = vec_mergel(ux, ux); \
+ \
+ /* vx = (CRV * (v << CSHIFT) + 0x4000) >> 15; */ \
+ vx = vec_sl(V, lCSHIFT); \
+ vx = vec_mradds(vx, lCRV, (vector signed short) { 0 }); \
+ vx0 = vec_mergeh(vx, vx); \
+ vx1 = vec_mergel(vx, vx); \
+ \
+ /* uvx = ((CGU * u) + (CGV * v)) >> 15 */ \
+ uvx = vec_mradds(U, lCGU, (vector signed short) { 0 }); \
+ uvx = vec_mradds(V, lCGV, uvx); \
+ uvx0 = vec_mergeh(uvx, uvx); \
+ uvx1 = vec_mergel(uvx, uvx); \
+ \
+ R0 = vec_add(Y0, vx0); \
+ G0 = vec_add(Y0, uvx0); \
+ B0 = vec_add(Y0, ux0); \
+ R1 = vec_add(Y1, vx1); \
+ G1 = vec_add(Y1, uvx1); \
+ B1 = vec_add(Y1, ux1); \
+ \
+ R = vec_packclp(R0, R1); \
+ G = vec_packclp(G0, G1); \
+ B = vec_packclp(B0, B1); \
+ \
+ out_pixels(R, G, B, oute); \
+ \
+ R0 = vec_add(Y2, vx0); \
+ G0 = vec_add(Y2, uvx0); \
+ B0 = vec_add(Y2, ux0); \
+ R1 = vec_add(Y3, vx1); \
+ G1 = vec_add(Y3, uvx1); \
+ B1 = vec_add(Y3, ux1); \
+ R = vec_packclp(R0, R1); \
+ G = vec_packclp(G0, G1); \
+ B = vec_packclp(B0, B1); \
+ \
+ \
+ out_pixels(R, G, B, outo); \
+ \
+ y1i += 16; \
+ y2i += 16; \
+ ui += 8; \
+ vi += 8; \
+ } \
+ \
+ outo += (outstrides[0]) >> 4; \
+ oute += (outstrides[0]) >> 4; \
+ \
+ ui += instrides_scl[1]; \
+ vi += instrides_scl[2]; \
+ y1i += instrides_scl[0]; \
+ y2i += instrides_scl[0]; \
+ } \
+ return srcSliceH; \
}
-
-#define out_abgr(a,b,c,ptr) vec_mstrgb32(__typeof__(a),((__typeof__ (a)){255}),c,b,a,ptr)
-#define out_bgra(a,b,c,ptr) vec_mstrgb32(__typeof__(a),c,b,a,((__typeof__ (a)){255}),ptr)
-#define out_rgba(a,b,c,ptr) vec_mstrgb32(__typeof__(a),a,b,c,((__typeof__ (a)){255}),ptr)
-#define out_argb(a,b,c,ptr) vec_mstrgb32(__typeof__(a),((__typeof__ (a)){255}),a,b,c,ptr)
-#define out_rgb24(a,b,c,ptr) vec_mstrgb24(a,b,c,ptr)
-#define out_bgr24(a,b,c,ptr) vec_mstbgr24(a,b,c,ptr)
-
-DEFCSP420_CVT (yuv2_abgr, out_abgr)
-DEFCSP420_CVT (yuv2_bgra, out_bgra)
-DEFCSP420_CVT (yuv2_rgba, out_rgba)
-DEFCSP420_CVT (yuv2_argb, out_argb)
-DEFCSP420_CVT (yuv2_rgb24, out_rgb24)
-DEFCSP420_CVT (yuv2_bgr24, out_bgr24)
-
+#define out_abgr(a, b, c, ptr) \
+ vec_mstrgb32(__typeof__(a), ((__typeof__(a)) { 255 }), c, b, a, ptr)
+#define out_bgra(a, b, c, ptr) \
+ vec_mstrgb32(__typeof__(a), c, b, a, ((__typeof__(a)) { 255 }), ptr)
+#define out_rgba(a, b, c, ptr) \
+ vec_mstrgb32(__typeof__(a), a, b, c, ((__typeof__(a)) { 255 }), ptr)
+#define out_argb(a, b, c, ptr) \
+ vec_mstrgb32(__typeof__(a), ((__typeof__(a)) { 255 }), a, b, c, ptr)
+#define out_rgb24(a, b, c, ptr) vec_mstrgb24(a, b, c, ptr)
+#define out_bgr24(a, b, c, ptr) vec_mstbgr24(a, b, c, ptr)
+
+DEFCSP420_CVT(yuv2_abgr, out_abgr)
+DEFCSP420_CVT(yuv2_bgra, out_bgra)
+DEFCSP420_CVT(yuv2_rgba, out_rgba)
+DEFCSP420_CVT(yuv2_argb, out_argb)
+DEFCSP420_CVT(yuv2_rgb24, out_rgb24)
+DEFCSP420_CVT(yuv2_bgr24, out_bgr24)
// uyvy|uyvy|uyvy|uyvy
// 0123 4567 89ab cdef
-static
-const vector unsigned char
- demux_u = {0x10,0x00,0x10,0x00,
- 0x10,0x04,0x10,0x04,
- 0x10,0x08,0x10,0x08,
- 0x10,0x0c,0x10,0x0c},
- demux_v = {0x10,0x02,0x10,0x02,
- 0x10,0x06,0x10,0x06,
- 0x10,0x0A,0x10,0x0A,
- 0x10,0x0E,0x10,0x0E},
- demux_y = {0x10,0x01,0x10,0x03,
- 0x10,0x05,0x10,0x07,
- 0x10,0x09,0x10,0x0B,
- 0x10,0x0D,0x10,0x0F};
+static const vector unsigned char
+ demux_u = { 0x10, 0x00, 0x10, 0x00,
+ 0x10, 0x04, 0x10, 0x04,
+ 0x10, 0x08, 0x10, 0x08,
+ 0x10, 0x0c, 0x10, 0x0c },
+ demux_v = { 0x10, 0x02, 0x10, 0x02,
+ 0x10, 0x06, 0x10, 0x06,
+ 0x10, 0x0A, 0x10, 0x0A,
+ 0x10, 0x0E, 0x10, 0x0E },
+ demux_y = { 0x10, 0x01, 0x10, 0x03,
+ 0x10, 0x05, 0x10, 0x07,
+ 0x10, 0x09, 0x10, 0x0B,
+ 0x10, 0x0D, 0x10, 0x0F };
/*
- this is so I can play live CCIR raw video
-*/
-static int altivec_uyvy_rgb32 (SwsContext *c,
- const unsigned char **in, int *instrides,
- int srcSliceY, int srcSliceH,
- unsigned char **oplanes, int *outstrides)
+ * this is so I can play live CCIR raw video
+ */
+static int altivec_uyvy_rgb32(SwsContext *c, const unsigned char **in,
+ int *instrides, int srcSliceY, int srcSliceH,
+ unsigned char **oplanes, int *outstrides)
{
int w = c->srcW;
int h = srcSliceH;
- int i,j;
+ int i, j;
vector unsigned char uyvy;
- vector signed short Y,U,V;
- vector signed short R0,G0,B0,R1,G1,B1;
- vector unsigned char R,G,B;
+ vector signed short Y, U, V;
+ vector signed short R0, G0, B0, R1, G1, B1;
+ vector unsigned char R, G, B;
vector unsigned char *out;
const ubyte *img;
img = in[0];
- out = (vector unsigned char *)(oplanes[0]+srcSliceY*outstrides[0]);
+ out = (vector unsigned char *) (oplanes[0] + srcSliceY * outstrides[0]);
- for (i=0;i<h;i++) {
- for (j=0;j<w/16;j++) {
- uyvy = vec_ld (0, img);
- U = (vector signed short)
- vec_perm (uyvy, (vector unsigned char){0}, demux_u);
+ for (i = 0; i < h; i++)
+ for (j = 0; j < w / 16; j++) {
+ uyvy = vec_ld(0, img);
+ U = (vector signed short)
+ vec_perm(uyvy, (vector unsigned char) { 0 }, demux_u);
V = (vector signed short)
- vec_perm (uyvy, (vector unsigned char){0}, demux_v);
-
+ vec_perm(uyvy, (vector unsigned char) { 0 }, demux_v);
Y = (vector signed short)
- vec_perm (uyvy, (vector unsigned char){0}, demux_y);
+ vec_perm(uyvy, (vector unsigned char) { 0 }, demux_y);
- cvtyuvtoRGB (c, Y,U,V,&R0,&G0,&B0);
+ cvtyuvtoRGB(c, Y, U, V, &R0, &G0, &B0);
- uyvy = vec_ld (16, img);
- U = (vector signed short)
- vec_perm (uyvy, (vector unsigned char){0}, demux_u);
+ uyvy = vec_ld(16, img);
+ U = (vector signed short)
+ vec_perm(uyvy, (vector unsigned char) { 0 }, demux_u);
V = (vector signed short)
- vec_perm (uyvy, (vector unsigned char){0}, demux_v);
-
+ vec_perm(uyvy, (vector unsigned char) { 0 }, demux_v);
Y = (vector signed short)
- vec_perm (uyvy, (vector unsigned char){0}, demux_y);
+ vec_perm(uyvy, (vector unsigned char) { 0 }, demux_y);
- cvtyuvtoRGB (c, Y,U,V,&R1,&G1,&B1);
+ cvtyuvtoRGB(c, Y, U, V, &R1, &G1, &B1);
- R = vec_packclp (R0,R1);
- G = vec_packclp (G0,G1);
- B = vec_packclp (B0,B1);
+ R = vec_packclp(R0, R1);
+ G = vec_packclp(G0, G1);
+ B = vec_packclp(B0, B1);
- // vec_mstbgr24 (R,G,B, out);
- out_rgba (R,G,B,out);
+ // vec_mstbgr24 (R,G,B, out);
+ out_rgba(R, G, B, out);
img += 32;
}
- }
return srcSliceH;
}
-
-
/* Ok currently the acceleration routine only supports
- inputs of widths a multiple of 16
- and heights a multiple 2
-
- So we just fall back to the C codes for this.
-*/
-SwsFunc ff_yuv2rgb_init_altivec(SwsContext *c)
+ * inputs of widths a multiple of 16
+ * and heights a multiple 2
+ *
+ * So we just fall back to the C codes for this.
+ */
+av_cold SwsFunc ff_yuv2rgb_init_altivec(SwsContext *c)
{
if (!(av_get_cpu_flags() & AV_CPU_FLAG_ALTIVEC))
return NULL;
/*
- and this seems not to matter too much I tried a bunch of
- videos with abnormal widths and MPlayer crashes elsewhere.
- mplayer -vo x11 -rawvideo on:w=350:h=240 raw-350x240.eyuv
- boom with X11 bad match.
-
- */
- if ((c->srcW & 0xf) != 0) return NULL;
+ * and this seems not to matter too much I tried a bunch of
+ * videos with abnormal widths and MPlayer crashes elsewhere.
+ * mplayer -vo x11 -rawvideo on:w=350:h=240 raw-350x240.eyuv
+ * boom with X11 bad match.
+ *
+ */
+ if ((c->srcW & 0xf) != 0)
+ return NULL;
switch (c->srcFormat) {
- case PIX_FMT_YUV410P:
- case PIX_FMT_YUV420P:
+ case AV_PIX_FMT_YUV410P:
+ case AV_PIX_FMT_YUV420P:
/*case IMGFMT_CLPL: ??? */
- case PIX_FMT_GRAY8:
- case PIX_FMT_NV12:
- case PIX_FMT_NV21:
+ case AV_PIX_FMT_GRAY8:
+ case AV_PIX_FMT_NV12:
+ case AV_PIX_FMT_NV21:
if ((c->srcH & 0x1) != 0)
return NULL;
- switch(c->dstFormat) {
- case PIX_FMT_RGB24:
+ switch (c->dstFormat) {
+ case AV_PIX_FMT_RGB24:
av_log(c, AV_LOG_WARNING, "ALTIVEC: Color Space RGB24\n");
return altivec_yuv2_rgb24;
- case PIX_FMT_BGR24:
+ case AV_PIX_FMT_BGR24:
av_log(c, AV_LOG_WARNING, "ALTIVEC: Color Space BGR24\n");
return altivec_yuv2_bgr24;
- case PIX_FMT_ARGB:
+ case AV_PIX_FMT_ARGB:
av_log(c, AV_LOG_WARNING, "ALTIVEC: Color Space ARGB\n");
return altivec_yuv2_argb;
- case PIX_FMT_ABGR:
+ case AV_PIX_FMT_ABGR:
av_log(c, AV_LOG_WARNING, "ALTIVEC: Color Space ABGR\n");
return altivec_yuv2_abgr;
- case PIX_FMT_RGBA:
+ case AV_PIX_FMT_RGBA:
av_log(c, AV_LOG_WARNING, "ALTIVEC: Color Space RGBA\n");
return altivec_yuv2_rgba;
- case PIX_FMT_BGRA:
+ case AV_PIX_FMT_BGRA:
av_log(c, AV_LOG_WARNING, "ALTIVEC: Color Space BGRA\n");
return altivec_yuv2_bgra;
default: return NULL;
}
break;
- case PIX_FMT_UYVY422:
- switch(c->dstFormat) {
- case PIX_FMT_BGR32:
+ case AV_PIX_FMT_UYVY422:
+ switch (c->dstFormat) {
+ case AV_PIX_FMT_BGR32:
av_log(c, AV_LOG_WARNING, "ALTIVEC: Color Space UYVY -> RGB32\n");
return altivec_uyvy_rgb32;
default: return NULL;
}
break;
-
}
return NULL;
}
-void ff_yuv2rgb_init_tables_altivec(SwsContext *c, const int inv_table[4], int brightness, int contrast, int saturation)
+av_cold void ff_yuv2rgb_init_tables_altivec(SwsContext *c,
+ const int inv_table[4],
+ int brightness,
+ int contrast,
+ int saturation)
{
union {
DECLARE_ALIGNED(16, signed short, tmp)[8];
vector signed short vec;
} buf;
- buf.tmp[0] = ((0xffffLL) * contrast>>8)>>9; //cy
- buf.tmp[1] = -256*brightness; //oy
- buf.tmp[2] = (inv_table[0]>>3) *(contrast>>16)*(saturation>>16); //crv
- buf.tmp[3] = (inv_table[1]>>3) *(contrast>>16)*(saturation>>16); //cbu
- buf.tmp[4] = -((inv_table[2]>>1)*(contrast>>16)*(saturation>>16)); //cgu
- buf.tmp[5] = -((inv_table[3]>>1)*(contrast>>16)*(saturation>>16)); //cgv
-
-
- c->CSHIFT = (vector unsigned short)vec_splat_u16(2);
- c->CY = vec_splat ((vector signed short)buf.vec, 0);
- c->OY = vec_splat ((vector signed short)buf.vec, 1);
- c->CRV = vec_splat ((vector signed short)buf.vec, 2);
- c->CBU = vec_splat ((vector signed short)buf.vec, 3);
- c->CGU = vec_splat ((vector signed short)buf.vec, 4);
- c->CGV = vec_splat ((vector signed short)buf.vec, 5);
+ buf.tmp[0] = ((0xffffLL) * contrast >> 8) >> 9; // cy
+ buf.tmp[1] = -256 * brightness; // oy
+ buf.tmp[2] = (inv_table[0] >> 3) * (contrast >> 16) * (saturation >> 16); // crv
+ buf.tmp[3] = (inv_table[1] >> 3) * (contrast >> 16) * (saturation >> 16); // cbu
+ buf.tmp[4] = -((inv_table[2] >> 1) * (contrast >> 16) * (saturation >> 16)); // cgu
+ buf.tmp[5] = -((inv_table[3] >> 1) * (contrast >> 16) * (saturation >> 16)); // cgv
+
+ c->CSHIFT = (vector unsigned short) vec_splat_u16(2);
+ c->CY = vec_splat((vector signed short) buf.vec, 0);
+ c->OY = vec_splat((vector signed short) buf.vec, 1);
+ c->CRV = vec_splat((vector signed short) buf.vec, 2);
+ c->CBU = vec_splat((vector signed short) buf.vec, 3);
+ c->CGU = vec_splat((vector signed short) buf.vec, 4);
+ c->CGV = vec_splat((vector signed short) buf.vec, 5);
return;
}
-
-static av_always_inline void
-ff_yuv2packedX_altivec(SwsContext *c, const int16_t *lumFilter,
- const int16_t **lumSrc, int lumFilterSize,
- const int16_t *chrFilter, const int16_t **chrUSrc,
- const int16_t **chrVSrc, int chrFilterSize,
- const int16_t **alpSrc, uint8_t *dest,
- int dstW, int dstY, enum PixelFormat target)
+static av_always_inline void ff_yuv2packedX_altivec(SwsContext *c,
+ const int16_t *lumFilter,
+ const int16_t **lumSrc,
+ int lumFilterSize,
+ const int16_t *chrFilter,
+ const int16_t **chrUSrc,
+ const int16_t **chrVSrc,
+ int chrFilterSize,
+ const int16_t **alpSrc,
+ uint8_t *dest,
+ int dstW, int dstY,
+ enum AVPixelFormat target)
{
- int i,j;
- vector signed short X,X0,X1,Y0,U0,V0,Y1,U1,V1,U,V;
- vector signed short R0,G0,B0,R1,G1,B1;
+ int i, j;
+ vector signed short X, X0, X1, Y0, U0, V0, Y1, U1, V1, U, V;
+ vector signed short R0, G0, B0, R1, G1, B1;
- vector unsigned char R,G,B;
- vector unsigned char *out,*nout;
+ vector unsigned char R, G, B;
+ vector unsigned char *out, *nout;
- vector signed short RND = vec_splat_s16(1<<3);
+ vector signed short RND = vec_splat_s16(1 << 3);
vector unsigned short SCL = vec_splat_u16(4);
DECLARE_ALIGNED(16, unsigned int, scratch)[16];
vector signed short *YCoeffs, *CCoeffs;
- YCoeffs = c->vYCoeffsBank+dstY*lumFilterSize;
- CCoeffs = c->vCCoeffsBank+dstY*chrFilterSize;
+ YCoeffs = c->vYCoeffsBank + dstY * lumFilterSize;
+ CCoeffs = c->vCCoeffsBank + dstY * chrFilterSize;
- out = (vector unsigned char *)dest;
+ out = (vector unsigned char *) dest;
- for (i=0; i<dstW; i+=16) {
+ for (i = 0; i < dstW; i += 16) {
Y0 = RND;
Y1 = RND;
/* extract 16 coeffs from lumSrc */
- for (j=0; j<lumFilterSize; j++) {
- X0 = vec_ld (0, &lumSrc[j][i]);
- X1 = vec_ld (16, &lumSrc[j][i]);
- Y0 = vec_mradds (X0, YCoeffs[j], Y0);
- Y1 = vec_mradds (X1, YCoeffs[j], Y1);
+ for (j = 0; j < lumFilterSize; j++) {
+ X0 = vec_ld(0, &lumSrc[j][i]);
+ X1 = vec_ld(16, &lumSrc[j][i]);
+ Y0 = vec_mradds(X0, YCoeffs[j], Y0);
+ Y1 = vec_mradds(X1, YCoeffs[j], Y1);
}
U = RND;
V = RND;
/* extract 8 coeffs from U,V */
- for (j=0; j<chrFilterSize; j++) {
- X = vec_ld (0, &chrUSrc[j][i/2]);
- U = vec_mradds (X, CCoeffs[j], U);
- X = vec_ld (0, &chrVSrc[j][i/2]);
- V = vec_mradds (X, CCoeffs[j], V);
+ for (j = 0; j < chrFilterSize; j++) {
+ X = vec_ld(0, &chrUSrc[j][i / 2]);
+ U = vec_mradds(X, CCoeffs[j], U);
+ X = vec_ld(0, &chrVSrc[j][i / 2]);
+ V = vec_mradds(X, CCoeffs[j], V);
}
/* scale and clip signals */
- Y0 = vec_sra (Y0, SCL);
- Y1 = vec_sra (Y1, SCL);
- U = vec_sra (U, SCL);
- V = vec_sra (V, SCL);
+ Y0 = vec_sra(Y0, SCL);
+ Y1 = vec_sra(Y1, SCL);
+ U = vec_sra(U, SCL);
+ V = vec_sra(V, SCL);
- Y0 = vec_clip_s16 (Y0);
- Y1 = vec_clip_s16 (Y1);
- U = vec_clip_s16 (U);
- V = vec_clip_s16 (V);
+ Y0 = vec_clip_s16(Y0);
+ Y1 = vec_clip_s16(Y1);
+ U = vec_clip_s16(U);
+ V = vec_clip_s16(V);
/* now we have
- Y0= y0 y1 y2 y3 y4 y5 y6 y7 Y1= y8 y9 y10 y11 y12 y13 y14 y15
- U= u0 u1 u2 u3 u4 u5 u6 u7 V= v0 v1 v2 v3 v4 v5 v6 v7
-
- Y0= y0 y1 y2 y3 y4 y5 y6 y7 Y1= y8 y9 y10 y11 y12 y13 y14 y15
- U0= u0 u0 u1 u1 u2 u2 u3 u3 U1= u4 u4 u5 u5 u6 u6 u7 u7
- V0= v0 v0 v1 v1 v2 v2 v3 v3 V1= v4 v4 v5 v5 v6 v6 v7 v7
- */
-
- U0 = vec_mergeh (U,U);
- V0 = vec_mergeh (V,V);
-
- U1 = vec_mergel (U,U);
- V1 = vec_mergel (V,V);
-
- cvtyuvtoRGB (c, Y0,U0,V0,&R0,&G0,&B0);
- cvtyuvtoRGB (c, Y1,U1,V1,&R1,&G1,&B1);
-
- R = vec_packclp (R0,R1);
- G = vec_packclp (G0,G1);
- B = vec_packclp (B0,B1);
-
- switch(target) {
- case PIX_FMT_ABGR: out_abgr (R,G,B,out); break;
- case PIX_FMT_BGRA: out_bgra (R,G,B,out); break;
- case PIX_FMT_RGBA: out_rgba (R,G,B,out); break;
- case PIX_FMT_ARGB: out_argb (R,G,B,out); break;
- case PIX_FMT_RGB24: out_rgb24 (R,G,B,out); break;
- case PIX_FMT_BGR24: out_bgr24 (R,G,B,out); break;
+ * Y0 = y0 y1 y2 y3 y4 y5 y6 y7 Y1 = y8 y9 y10 y11 y12 y13 y14 y15
+ * U = u0 u1 u2 u3 u4 u5 u6 u7 V = v0 v1 v2 v3 v4 v5 v6 v7
+ *
+ * Y0 = y0 y1 y2 y3 y4 y5 y6 y7 Y1 = y8 y9 y10 y11 y12 y13 y14 y15
+ * U0 = u0 u0 u1 u1 u2 u2 u3 u3 U1 = u4 u4 u5 u5 u6 u6 u7 u7
+ * V0 = v0 v0 v1 v1 v2 v2 v3 v3 V1 = v4 v4 v5 v5 v6 v6 v7 v7
+ */
+
+ U0 = vec_mergeh(U, U);
+ V0 = vec_mergeh(V, V);
+
+ U1 = vec_mergel(U, U);
+ V1 = vec_mergel(V, V);
+
+ cvtyuvtoRGB(c, Y0, U0, V0, &R0, &G0, &B0);
+ cvtyuvtoRGB(c, Y1, U1, V1, &R1, &G1, &B1);
+
+ R = vec_packclp(R0, R1);
+ G = vec_packclp(G0, G1);
+ B = vec_packclp(B0, B1);
+
+ switch (target) {
+ case AV_PIX_FMT_ABGR:
+ out_abgr(R, G, B, out);
+ break;
+ case AV_PIX_FMT_BGRA:
+ out_bgra(R, G, B, out);
+ break;
+ case AV_PIX_FMT_RGBA:
+ out_rgba(R, G, B, out);
+ break;
+ case AV_PIX_FMT_ARGB:
+ out_argb(R, G, B, out);
+ break;
+ case AV_PIX_FMT_RGB24:
+ out_rgb24(R, G, B, out);
+ break;
+ case AV_PIX_FMT_BGR24:
+ out_bgr24(R, G, B, out);
+ break;
default:
- {
- /* If this is reached, the caller should have called yuv2packedXinC
- instead. */
- static int printed_error_message;
- if (!printed_error_message) {
- av_log(c, AV_LOG_ERROR, "altivec_yuv2packedX doesn't support %s output\n",
- sws_format_name(c->dstFormat));
- printed_error_message=1;
- }
- return;
+ {
+ /* If this is reached, the caller should have called yuv2packedXinC
+ * instead. */
+ static int printed_error_message;
+ if (!printed_error_message) {
+ av_log(c, AV_LOG_ERROR,
+ "altivec_yuv2packedX doesn't support %s output\n",
+ sws_format_name(c->dstFormat));
+ printed_error_message = 1;
}
+ return;
+ }
}
}
@@ -734,92 +750,109 @@ ff_yuv2packedX_altivec(SwsContext *c, const int16_t *lumFilter,
Y0 = RND;
Y1 = RND;
/* extract 16 coeffs from lumSrc */
- for (j=0; j<lumFilterSize; j++) {
- X0 = vec_ld (0, &lumSrc[j][i]);
- X1 = vec_ld (16, &lumSrc[j][i]);
- Y0 = vec_mradds (X0, YCoeffs[j], Y0);
- Y1 = vec_mradds (X1, YCoeffs[j], Y1);
+ for (j = 0; j < lumFilterSize; j++) {
+ X0 = vec_ld(0, &lumSrc[j][i]);
+ X1 = vec_ld(16, &lumSrc[j][i]);
+ Y0 = vec_mradds(X0, YCoeffs[j], Y0);
+ Y1 = vec_mradds(X1, YCoeffs[j], Y1);
}
U = RND;
V = RND;
/* extract 8 coeffs from U,V */
- for (j=0; j<chrFilterSize; j++) {
- X = vec_ld (0, &chrUSrc[j][i/2]);
- U = vec_mradds (X, CCoeffs[j], U);
- X = vec_ld (0, &chrVSrc[j][i/2]);
- V = vec_mradds (X, CCoeffs[j], V);
+ for (j = 0; j < chrFilterSize; j++) {
+ X = vec_ld(0, &chrUSrc[j][i / 2]);
+ U = vec_mradds(X, CCoeffs[j], U);
+ X = vec_ld(0, &chrVSrc[j][i / 2]);
+ V = vec_mradds(X, CCoeffs[j], V);
}
/* scale and clip signals */
- Y0 = vec_sra (Y0, SCL);
- Y1 = vec_sra (Y1, SCL);
- U = vec_sra (U, SCL);
- V = vec_sra (V, SCL);
+ Y0 = vec_sra(Y0, SCL);
+ Y1 = vec_sra(Y1, SCL);
+ U = vec_sra(U, SCL);
+ V = vec_sra(V, SCL);
- Y0 = vec_clip_s16 (Y0);
- Y1 = vec_clip_s16 (Y1);
- U = vec_clip_s16 (U);
- V = vec_clip_s16 (V);
+ Y0 = vec_clip_s16(Y0);
+ Y1 = vec_clip_s16(Y1);
+ U = vec_clip_s16(U);
+ V = vec_clip_s16(V);
/* now we have
- Y0= y0 y1 y2 y3 y4 y5 y6 y7 Y1= y8 y9 y10 y11 y12 y13 y14 y15
- U = u0 u1 u2 u3 u4 u5 u6 u7 V = v0 v1 v2 v3 v4 v5 v6 v7
-
- Y0= y0 y1 y2 y3 y4 y5 y6 y7 Y1= y8 y9 y10 y11 y12 y13 y14 y15
- U0= u0 u0 u1 u1 u2 u2 u3 u3 U1= u4 u4 u5 u5 u6 u6 u7 u7
- V0= v0 v0 v1 v1 v2 v2 v3 v3 V1= v4 v4 v5 v5 v6 v6 v7 v7
- */
-
- U0 = vec_mergeh (U,U);
- V0 = vec_mergeh (V,V);
-
- U1 = vec_mergel (U,U);
- V1 = vec_mergel (V,V);
-
- cvtyuvtoRGB (c, Y0,U0,V0,&R0,&G0,&B0);
- cvtyuvtoRGB (c, Y1,U1,V1,&R1,&G1,&B1);
-
- R = vec_packclp (R0,R1);
- G = vec_packclp (G0,G1);
- B = vec_packclp (B0,B1);
-
- nout = (vector unsigned char *)scratch;
- switch(target) {
- case PIX_FMT_ABGR: out_abgr (R,G,B,nout); break;
- case PIX_FMT_BGRA: out_bgra (R,G,B,nout); break;
- case PIX_FMT_RGBA: out_rgba (R,G,B,nout); break;
- case PIX_FMT_ARGB: out_argb (R,G,B,nout); break;
- case PIX_FMT_RGB24: out_rgb24 (R,G,B,nout); break;
- case PIX_FMT_BGR24: out_bgr24 (R,G,B,nout); break;
+ * Y0 = y0 y1 y2 y3 y4 y5 y6 y7 Y1 = y8 y9 y10 y11 y12 y13 y14 y15
+ * U = u0 u1 u2 u3 u4 u5 u6 u7 V = v0 v1 v2 v3 v4 v5 v6 v7
+ *
+ * Y0 = y0 y1 y2 y3 y4 y5 y6 y7 Y1 = y8 y9 y10 y11 y12 y13 y14 y15
+ * U0 = u0 u0 u1 u1 u2 u2 u3 u3 U1 = u4 u4 u5 u5 u6 u6 u7 u7
+ * V0 = v0 v0 v1 v1 v2 v2 v3 v3 V1 = v4 v4 v5 v5 v6 v6 v7 v7
+ */
+
+ U0 = vec_mergeh(U, U);
+ V0 = vec_mergeh(V, V);
+
+ U1 = vec_mergel(U, U);
+ V1 = vec_mergel(V, V);
+
+ cvtyuvtoRGB(c, Y0, U0, V0, &R0, &G0, &B0);
+ cvtyuvtoRGB(c, Y1, U1, V1, &R1, &G1, &B1);
+
+ R = vec_packclp(R0, R1);
+ G = vec_packclp(G0, G1);
+ B = vec_packclp(B0, B1);
+
+ nout = (vector unsigned char *) scratch;
+ switch (target) {
+ case AV_PIX_FMT_ABGR:
+ out_abgr(R, G, B, nout);
+ break;
+ case AV_PIX_FMT_BGRA:
+ out_bgra(R, G, B, nout);
+ break;
+ case AV_PIX_FMT_RGBA:
+ out_rgba(R, G, B, nout);
+ break;
+ case AV_PIX_FMT_ARGB:
+ out_argb(R, G, B, nout);
+ break;
+ case AV_PIX_FMT_RGB24:
+ out_rgb24(R, G, B, nout);
+ break;
+ case AV_PIX_FMT_BGR24:
+ out_bgr24(R, G, B, nout);
+ break;
default:
/* Unreachable, I think. */
- av_log(c, AV_LOG_ERROR, "altivec_yuv2packedX doesn't support %s output\n",
+ av_log(c, AV_LOG_ERROR,
+ "altivec_yuv2packedX doesn't support %s output\n",
sws_format_name(c->dstFormat));
return;
}
- memcpy (&((uint32_t*)dest)[i], scratch, (dstW-i)/4);
+ memcpy(&((uint32_t *) dest)[i], scratch, (dstW - i) / 4);
}
-
}
-#define YUV2PACKEDX_WRAPPER(suffix, pixfmt) \
-void ff_yuv2 ## suffix ## _X_altivec(SwsContext *c, const int16_t *lumFilter, \
- const int16_t **lumSrc, int lumFilterSize, \
- const int16_t *chrFilter, const int16_t **chrUSrc, \
- const int16_t **chrVSrc, int chrFilterSize, \
- const int16_t **alpSrc, uint8_t *dest, \
- int dstW, int dstY) \
-{ \
- ff_yuv2packedX_altivec(c, lumFilter, lumSrc, lumFilterSize, \
- chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
- alpSrc, dest, dstW, dstY, pixfmt); \
+#define YUV2PACKEDX_WRAPPER(suffix, pixfmt) \
+void ff_yuv2 ## suffix ## _X_altivec(SwsContext *c, \
+ const int16_t *lumFilter, \
+ const int16_t **lumSrc, \
+ int lumFilterSize, \
+ const int16_t *chrFilter, \
+ const int16_t **chrUSrc, \
+ const int16_t **chrVSrc, \
+ int chrFilterSize, \
+ const int16_t **alpSrc, \
+ uint8_t *dest, int dstW, int dstY) \
+{ \
+ ff_yuv2packedX_altivec(c, lumFilter, lumSrc, lumFilterSize, \
+ chrFilter, chrUSrc, chrVSrc, \
+ chrFilterSize, alpSrc, \
+ dest, dstW, dstY, pixfmt); \
}
-YUV2PACKEDX_WRAPPER(abgr, PIX_FMT_ABGR);
-YUV2PACKEDX_WRAPPER(bgra, PIX_FMT_BGRA);
-YUV2PACKEDX_WRAPPER(argb, PIX_FMT_ARGB);
-YUV2PACKEDX_WRAPPER(rgba, PIX_FMT_RGBA);
-YUV2PACKEDX_WRAPPER(rgb24, PIX_FMT_RGB24);
-YUV2PACKEDX_WRAPPER(bgr24, PIX_FMT_BGR24);
+YUV2PACKEDX_WRAPPER(abgr, AV_PIX_FMT_ABGR);
+YUV2PACKEDX_WRAPPER(bgra, AV_PIX_FMT_BGRA);
+YUV2PACKEDX_WRAPPER(argb, AV_PIX_FMT_ARGB);
+YUV2PACKEDX_WRAPPER(rgba, AV_PIX_FMT_RGBA);
+YUV2PACKEDX_WRAPPER(rgb24, AV_PIX_FMT_RGB24);
+YUV2PACKEDX_WRAPPER(bgr24, AV_PIX_FMT_BGR24);
diff --git a/gst-libs/ext/libav/libswscale/ppc/yuv2rgb_altivec.h b/gst-libs/ext/libav/libswscale/ppc/yuv2rgb_altivec.h
index 626d2b0..2c5e7ed 100644
--- a/gst-libs/ext/libav/libswscale/ppc/yuv2rgb_altivec.h
+++ b/gst-libs/ext/libav/libswscale/ppc/yuv2rgb_altivec.h
@@ -24,6 +24,10 @@
#ifndef SWSCALE_PPC_YUV2RGB_ALTIVEC_H
#define SWSCALE_PPC_YUV2RGB_ALTIVEC_H
+#include <stdint.h>
+
+#include "libswscale/swscale_internal.h"
+
#define YUV2PACKEDX_HEADER(suffix) \
void ff_yuv2 ## suffix ## _X_altivec(SwsContext *c, \
const int16_t *lumFilter, \
diff --git a/gst-libs/ext/libav/libswscale/ppc/yuv2yuv_altivec.c b/gst-libs/ext/libav/libswscale/ppc/yuv2yuv_altivec.c
index 4cd02ff..5aa1820 100644
--- a/gst-libs/ext/libav/libswscale/ppc/yuv2yuv_altivec.c
+++ b/gst-libs/ext/libav/libswscale/ppc/yuv2yuv_altivec.c
@@ -1,5 +1,5 @@
/*
- * AltiVec-enhanced yuv-to-yuv convertion routines.
+ * AltiVec-enhanced yuv-to-yuv conversion routines.
*
* Copyright (C) 2004 Romain Dolbeau <romain@dolbeau.org>
* based on the equivalent C code in swscale.c
@@ -22,55 +22,57 @@
*/
#include <inttypes.h>
+
#include "config.h"
#include "libswscale/swscale.h"
#include "libswscale/swscale_internal.h"
#include "libavutil/cpu.h"
-static int yv12toyuy2_unscaled_altivec(SwsContext *c, const uint8_t* src[],
+static int yv12toyuy2_unscaled_altivec(SwsContext *c, const uint8_t *src[],
int srcStride[], int srcSliceY,
- int srcSliceH, uint8_t* dstParam[],
+ int srcSliceH, uint8_t *dstParam[],
int dstStride_a[])
{
- uint8_t *dst=dstParam[0] + dstStride_a[0]*srcSliceY;
- // yv12toyuy2(src[0], src[1], src[2], dst, c->srcW, srcSliceH, srcStride[0], srcStride[1], dstStride[0]);
- const uint8_t *ysrc = src[0];
- const uint8_t *usrc = src[1];
- const uint8_t *vsrc = src[2];
- const int width = c->srcW;
- const int height = srcSliceH;
- const int lumStride = srcStride[0];
+ uint8_t *dst = dstParam[0] + dstStride_a[0] * srcSliceY;
+ // yv12toyuy2(src[0], src[1], src[2], dst, c->srcW, srcSliceH,
+ // srcStride[0], srcStride[1], dstStride[0]);
+ const uint8_t *ysrc = src[0];
+ const uint8_t *usrc = src[1];
+ const uint8_t *vsrc = src[2];
+ const int width = c->srcW;
+ const int height = srcSliceH;
+ const int lumStride = srcStride[0];
const int chromStride = srcStride[1];
- const int dstStride = dstStride_a[0];
+ const int dstStride = dstStride_a[0];
const vector unsigned char yperm = vec_lvsl(0, ysrc);
- const int vertLumPerChroma = 2;
+ const int vertLumPerChroma = 2;
register unsigned int y;
/* This code assumes:
+ *
+ * 1) dst is 16 bytes-aligned
+ * 2) dstStride is a multiple of 16
+ * 3) width is a multiple of 16
+ * 4) lum & chrom stride are multiples of 8
+ */
- 1) dst is 16 bytes-aligned
- 2) dstStride is a multiple of 16
- 3) width is a multiple of 16
- 4) lum & chrom stride are multiples of 8
- */
-
- for (y=0; y<height; y++) {
+ for (y = 0; y < height; y++) {
int i;
- for (i = 0; i < width - 31; i+= 32) {
- const unsigned int j = i >> 1;
- vector unsigned char v_yA = vec_ld(i, ysrc);
- vector unsigned char v_yB = vec_ld(i + 16, ysrc);
- vector unsigned char v_yC = vec_ld(i + 32, ysrc);
- vector unsigned char v_y1 = vec_perm(v_yA, v_yB, yperm);
- vector unsigned char v_y2 = vec_perm(v_yB, v_yC, yperm);
- vector unsigned char v_uA = vec_ld(j, usrc);
- vector unsigned char v_uB = vec_ld(j + 16, usrc);
- vector unsigned char v_u = vec_perm(v_uA, v_uB, vec_lvsl(j, usrc));
- vector unsigned char v_vA = vec_ld(j, vsrc);
- vector unsigned char v_vB = vec_ld(j + 16, vsrc);
- vector unsigned char v_v = vec_perm(v_vA, v_vB, vec_lvsl(j, vsrc));
- vector unsigned char v_uv_a = vec_mergeh(v_u, v_v);
- vector unsigned char v_uv_b = vec_mergel(v_u, v_v);
+ for (i = 0; i < width - 31; i += 32) {
+ const unsigned int j = i >> 1;
+ vector unsigned char v_yA = vec_ld(i, ysrc);
+ vector unsigned char v_yB = vec_ld(i + 16, ysrc);
+ vector unsigned char v_yC = vec_ld(i + 32, ysrc);
+ vector unsigned char v_y1 = vec_perm(v_yA, v_yB, yperm);
+ vector unsigned char v_y2 = vec_perm(v_yB, v_yC, yperm);
+ vector unsigned char v_uA = vec_ld(j, usrc);
+ vector unsigned char v_uB = vec_ld(j + 16, usrc);
+ vector unsigned char v_u = vec_perm(v_uA, v_uB, vec_lvsl(j, usrc));
+ vector unsigned char v_vA = vec_ld(j, vsrc);
+ vector unsigned char v_vB = vec_ld(j + 16, vsrc);
+ vector unsigned char v_v = vec_perm(v_vA, v_vB, vec_lvsl(j, vsrc));
+ vector unsigned char v_uv_a = vec_mergeh(v_u, v_v);
+ vector unsigned char v_uv_b = vec_mergel(v_u, v_v);
vector unsigned char v_yuy2_0 = vec_mergeh(v_y1, v_uv_a);
vector unsigned char v_yuy2_1 = vec_mergel(v_y1, v_uv_a);
vector unsigned char v_yuy2_2 = vec_mergeh(v_y2, v_uv_b);
@@ -81,71 +83,72 @@ static int yv12toyuy2_unscaled_altivec(SwsContext *c, const uint8_t* src[],
vec_st(v_yuy2_3, (i << 1) + 48, dst);
}
if (i < width) {
- const unsigned int j = i >> 1;
- vector unsigned char v_y1 = vec_ld(i, ysrc);
- vector unsigned char v_u = vec_ld(j, usrc);
- vector unsigned char v_v = vec_ld(j, vsrc);
- vector unsigned char v_uv_a = vec_mergeh(v_u, v_v);
+ const unsigned int j = i >> 1;
+ vector unsigned char v_y1 = vec_ld(i, ysrc);
+ vector unsigned char v_u = vec_ld(j, usrc);
+ vector unsigned char v_v = vec_ld(j, vsrc);
+ vector unsigned char v_uv_a = vec_mergeh(v_u, v_v);
vector unsigned char v_yuy2_0 = vec_mergeh(v_y1, v_uv_a);
vector unsigned char v_yuy2_1 = vec_mergel(v_y1, v_uv_a);
vec_st(v_yuy2_0, (i << 1), dst);
vec_st(v_yuy2_1, (i << 1) + 16, dst);
}
- if ((y&(vertLumPerChroma-1)) == vertLumPerChroma-1) {
+ if ((y & (vertLumPerChroma - 1)) == vertLumPerChroma - 1) {
usrc += chromStride;
vsrc += chromStride;
}
ysrc += lumStride;
- dst += dstStride;
+ dst += dstStride;
}
return srcSliceH;
}
-static int yv12touyvy_unscaled_altivec(SwsContext *c, const uint8_t* src[],
+static int yv12touyvy_unscaled_altivec(SwsContext *c, const uint8_t *src[],
int srcStride[], int srcSliceY,
- int srcSliceH, uint8_t* dstParam[],
+ int srcSliceH, uint8_t *dstParam[],
int dstStride_a[])
{
- uint8_t *dst=dstParam[0] + dstStride_a[0]*srcSliceY;
- // yv12toyuy2(src[0], src[1], src[2], dst, c->srcW, srcSliceH, srcStride[0], srcStride[1], dstStride[0]);
- const uint8_t *ysrc = src[0];
- const uint8_t *usrc = src[1];
- const uint8_t *vsrc = src[2];
- const int width = c->srcW;
- const int height = srcSliceH;
- const int lumStride = srcStride[0];
- const int chromStride = srcStride[1];
- const int dstStride = dstStride_a[0];
- const int vertLumPerChroma = 2;
+ uint8_t *dst = dstParam[0] + dstStride_a[0] * srcSliceY;
+ // yv12toyuy2(src[0], src[1], src[2], dst, c->srcW, srcSliceH,
+ // srcStride[0], srcStride[1], dstStride[0]);
+ const uint8_t *ysrc = src[0];
+ const uint8_t *usrc = src[1];
+ const uint8_t *vsrc = src[2];
+ const int width = c->srcW;
+ const int height = srcSliceH;
+ const int lumStride = srcStride[0];
+ const int chromStride = srcStride[1];
+ const int dstStride = dstStride_a[0];
+ const int vertLumPerChroma = 2;
const vector unsigned char yperm = vec_lvsl(0, ysrc);
register unsigned int y;
/* This code assumes:
+ *
+ * 1) dst is 16 bytes-aligned
+ * 2) dstStride is a multiple of 16
+ * 3) width is a multiple of 16
+ * 4) lum & chrom stride are multiples of 8
+ */
- 1) dst is 16 bytes-aligned
- 2) dstStride is a multiple of 16
- 3) width is a multiple of 16
- 4) lum & chrom stride are multiples of 8
- */
-
- for (y=0; y<height; y++) {
+ for (y = 0; y < height; y++) {
int i;
- for (i = 0; i < width - 31; i+= 32) {
- const unsigned int j = i >> 1;
- vector unsigned char v_yA = vec_ld(i, ysrc);
- vector unsigned char v_yB = vec_ld(i + 16, ysrc);
- vector unsigned char v_yC = vec_ld(i + 32, ysrc);
- vector unsigned char v_y1 = vec_perm(v_yA, v_yB, yperm);
- vector unsigned char v_y2 = vec_perm(v_yB, v_yC, yperm);
- vector unsigned char v_uA = vec_ld(j, usrc);
- vector unsigned char v_uB = vec_ld(j + 16, usrc);
- vector unsigned char v_u = vec_perm(v_uA, v_uB, vec_lvsl(j, usrc));
- vector unsigned char v_vA = vec_ld(j, vsrc);
- vector unsigned char v_vB = vec_ld(j + 16, vsrc);
- vector unsigned char v_v = vec_perm(v_vA, v_vB, vec_lvsl(j, vsrc));
- vector unsigned char v_uv_a = vec_mergeh(v_u, v_v);
- vector unsigned char v_uv_b = vec_mergel(v_u, v_v);
+ for (i = 0; i < width - 31; i += 32) {
+ const unsigned int j = i >> 1;
+ vector unsigned char v_yA = vec_ld(i, ysrc);
+ vector unsigned char v_yB = vec_ld(i + 16, ysrc);
+ vector unsigned char v_yC = vec_ld(i + 32, ysrc);
+ vector unsigned char v_y1 = vec_perm(v_yA, v_yB, yperm);
+ vector unsigned char v_y2 = vec_perm(v_yB, v_yC, yperm);
+ vector unsigned char v_uA = vec_ld(j, usrc);
+ vector unsigned char v_uB = vec_ld(j + 16, usrc);
+ vector unsigned char v_u = vec_perm(v_uA, v_uB, vec_lvsl(j, usrc));
+ vector unsigned char v_vA = vec_ld(j, vsrc);
+ vector unsigned char v_vB = vec_ld(j + 16, vsrc);
+ vector unsigned char v_v = vec_perm(v_vA, v_vB, vec_lvsl(j, vsrc));
+ vector unsigned char v_uv_a = vec_mergeh(v_u, v_v);
+ vector unsigned char v_uv_b = vec_mergel(v_u, v_v);
vector unsigned char v_uyvy_0 = vec_mergeh(v_uv_a, v_y1);
vector unsigned char v_uyvy_1 = vec_mergel(v_uv_a, v_y1);
vector unsigned char v_uyvy_2 = vec_mergeh(v_uv_b, v_y2);
@@ -156,22 +159,22 @@ static int yv12touyvy_unscaled_altivec(SwsContext *c, const uint8_t* src[],
vec_st(v_uyvy_3, (i << 1) + 48, dst);
}
if (i < width) {
- const unsigned int j = i >> 1;
- vector unsigned char v_y1 = vec_ld(i, ysrc);
- vector unsigned char v_u = vec_ld(j, usrc);
- vector unsigned char v_v = vec_ld(j, vsrc);
- vector unsigned char v_uv_a = vec_mergeh(v_u, v_v);
+ const unsigned int j = i >> 1;
+ vector unsigned char v_y1 = vec_ld(i, ysrc);
+ vector unsigned char v_u = vec_ld(j, usrc);
+ vector unsigned char v_v = vec_ld(j, vsrc);
+ vector unsigned char v_uv_a = vec_mergeh(v_u, v_v);
vector unsigned char v_uyvy_0 = vec_mergeh(v_uv_a, v_y1);
vector unsigned char v_uyvy_1 = vec_mergel(v_uv_a, v_y1);
vec_st(v_uyvy_0, (i << 1), dst);
vec_st(v_uyvy_1, (i << 1) + 16, dst);
}
- if ((y&(vertLumPerChroma-1)) == vertLumPerChroma-1) {
+ if ((y & (vertLumPerChroma - 1)) == vertLumPerChroma - 1) {
usrc += chromStride;
vsrc += chromStride;
}
ysrc += lumStride;
- dst += dstStride;
+ dst += dstStride;
}
return srcSliceH;
}
@@ -179,13 +182,13 @@ static int yv12touyvy_unscaled_altivec(SwsContext *c, const uint8_t* src[],
void ff_swscale_get_unscaled_altivec(SwsContext *c)
{
if ((av_get_cpu_flags() & AV_CPU_FLAG_ALTIVEC) && !(c->srcW & 15) &&
- !(c->flags & SWS_BITEXACT) && c->srcFormat == PIX_FMT_YUV420P) {
- enum PixelFormat dstFormat = c->dstFormat;
+ !(c->flags & SWS_BITEXACT) && c->srcFormat == AV_PIX_FMT_YUV420P) {
+ enum AVPixelFormat dstFormat = c->dstFormat;
// unscaled YV12 -> packed YUV, we want speed
- if (dstFormat == PIX_FMT_YUYV422)
- c->swScale= yv12toyuy2_unscaled_altivec;
- else if (dstFormat == PIX_FMT_UYVY422)
- c->swScale= yv12touyvy_unscaled_altivec;
+ if (dstFormat == AV_PIX_FMT_YUYV422)
+ c->swScale = yv12toyuy2_unscaled_altivec;
+ else if (dstFormat == AV_PIX_FMT_UYVY422)
+ c->swScale = yv12touyvy_unscaled_altivec;
}
}
diff --git a/gst-libs/ext/libav/libswscale/rgb2rgb.c b/gst-libs/ext/libav/libswscale/rgb2rgb.c
index 47b06f5..c261fe6 100644
--- a/gst-libs/ext/libav/libswscale/rgb2rgb.c
+++ b/gst-libs/ext/libav/libswscale/rgb2rgb.c
@@ -22,48 +22,59 @@
* License along with Libav; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+
#include <inttypes.h>
-#include "config.h"
+
+#include "libavutil/attributes.h"
#include "libavutil/bswap.h"
+#include "config.h"
#include "rgb2rgb.h"
#include "swscale.h"
#include "swscale_internal.h"
+void (*rgb32tobgr24)(const uint8_t *src, uint8_t *dst, int src_size);
+void (*rgb32tobgr16)(const uint8_t *src, uint8_t *dst, int src_size);
+void (*rgb32tobgr15)(const uint8_t *src, uint8_t *dst, int src_size);
void (*rgb24tobgr32)(const uint8_t *src, uint8_t *dst, int src_size);
+void (*rgb24tobgr24)(const uint8_t *src, uint8_t *dst, int src_size);
void (*rgb24tobgr16)(const uint8_t *src, uint8_t *dst, int src_size);
void (*rgb24tobgr15)(const uint8_t *src, uint8_t *dst, int src_size);
-void (*rgb32tobgr24)(const uint8_t *src, uint8_t *dst, int src_size);
+void (*rgb16tobgr24)(const uint8_t *src, uint8_t *dst, int src_size);
+void (*rgb15tobgr24)(const uint8_t *src, uint8_t *dst, int src_size);
+
void (*rgb32to16)(const uint8_t *src, uint8_t *dst, int src_size);
void (*rgb32to15)(const uint8_t *src, uint8_t *dst, int src_size);
-void (*rgb15to16)(const uint8_t *src, uint8_t *dst, int src_size);
-void (*rgb15tobgr24)(const uint8_t *src, uint8_t *dst, int src_size);
-void (*rgb15to32)(const uint8_t *src, uint8_t *dst, int src_size);
-void (*rgb16to15)(const uint8_t *src, uint8_t *dst, int src_size);
-void (*rgb16tobgr24)(const uint8_t *src, uint8_t *dst, int src_size);
-void (*rgb16to32)(const uint8_t *src, uint8_t *dst, int src_size);
-void (*rgb24tobgr24)(const uint8_t *src, uint8_t *dst, int src_size);
void (*rgb24to16)(const uint8_t *src, uint8_t *dst, int src_size);
void (*rgb24to15)(const uint8_t *src, uint8_t *dst, int src_size);
+void (*rgb16to32)(const uint8_t *src, uint8_t *dst, int src_size);
+void (*rgb16to15)(const uint8_t *src, uint8_t *dst, int src_size);
+void (*rgb15to16)(const uint8_t *src, uint8_t *dst, int src_size);
+void (*rgb15to32)(const uint8_t *src, uint8_t *dst, int src_size);
+
void (*shuffle_bytes_2103)(const uint8_t *src, uint8_t *dst, int src_size);
-void (*rgb32tobgr16)(const uint8_t *src, uint8_t *dst, int src_size);
-void (*rgb32tobgr15)(const uint8_t *src, uint8_t *dst, int src_size);
-void (*yv12toyuy2)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst,
+void (*yv12toyuy2)(const uint8_t *ysrc, const uint8_t *usrc,
+ const uint8_t *vsrc, uint8_t *dst,
int width, int height,
int lumStride, int chromStride, int dstStride);
-void (*yv12touyvy)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst,
+void (*yv12touyvy)(const uint8_t *ysrc, const uint8_t *usrc,
+ const uint8_t *vsrc, uint8_t *dst,
int width, int height,
int lumStride, int chromStride, int dstStride);
-void (*yuv422ptoyuy2)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst,
+void (*yuv422ptoyuy2)(const uint8_t *ysrc, const uint8_t *usrc,
+ const uint8_t *vsrc, uint8_t *dst,
int width, int height,
int lumStride, int chromStride, int dstStride);
-void (*yuv422ptouyvy)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst,
+void (*yuv422ptouyvy)(const uint8_t *ysrc, const uint8_t *usrc,
+ const uint8_t *vsrc, uint8_t *dst,
int width, int height,
int lumStride, int chromStride, int dstStride);
-void (*yuy2toyv12)(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
+void (*yuy2toyv12)(const uint8_t *src, uint8_t *ydst,
+ uint8_t *udst, uint8_t *vdst,
int width, int height,
int lumStride, int chromStride, int srcStride);
-void (*rgb24toyv12)(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
+void (*rgb24toyv12)(const uint8_t *src, uint8_t *ydst,
+ uint8_t *udst, uint8_t *vdst,
int width, int height,
int lumStride, int chromStride, int srcStride);
void (*planar2x)(const uint8_t *src, uint8_t *dst, int width, int height,
@@ -76,47 +87,46 @@ void (*vu9_to_vu12)(const uint8_t *src1, const uint8_t *src2,
int width, int height,
int srcStride1, int srcStride2,
int dstStride1, int dstStride2);
-void (*yvu9_to_yuy2)(const uint8_t *src1, const uint8_t *src2, const uint8_t *src3,
- uint8_t *dst,
+void (*yvu9_to_yuy2)(const uint8_t *src1, const uint8_t *src2,
+ const uint8_t *src3, uint8_t *dst,
int width, int height,
int srcStride1, int srcStride2,
int srcStride3, int dstStride);
-void (*uyvytoyuv420)(uint8_t *ydst, uint8_t *udst, uint8_t *vdst, const uint8_t *src,
- int width, int height,
+void (*uyvytoyuv420)(uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
+ const uint8_t *src, int width, int height,
int lumStride, int chromStride, int srcStride);
-void (*uyvytoyuv422)(uint8_t *ydst, uint8_t *udst, uint8_t *vdst, const uint8_t *src,
- int width, int height,
+void (*uyvytoyuv422)(uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
+ const uint8_t *src, int width, int height,
int lumStride, int chromStride, int srcStride);
-void (*yuyvtoyuv420)(uint8_t *ydst, uint8_t *udst, uint8_t *vdst, const uint8_t *src,
- int width, int height,
+void (*yuyvtoyuv420)(uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
+ const uint8_t *src, int width, int height,
int lumStride, int chromStride, int srcStride);
-void (*yuyvtoyuv422)(uint8_t *ydst, uint8_t *udst, uint8_t *vdst, const uint8_t *src,
- int width, int height,
+void (*yuyvtoyuv422)(uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
+ const uint8_t *src, int width, int height,
int lumStride, int chromStride, int srcStride);
#define RGB2YUV_SHIFT 8
-#define BY ((int)( 0.098*(1<<RGB2YUV_SHIFT)+0.5))
-#define BV ((int)(-0.071*(1<<RGB2YUV_SHIFT)+0.5))
-#define BU ((int)( 0.439*(1<<RGB2YUV_SHIFT)+0.5))
-#define GY ((int)( 0.504*(1<<RGB2YUV_SHIFT)+0.5))
-#define GV ((int)(-0.368*(1<<RGB2YUV_SHIFT)+0.5))
-#define GU ((int)(-0.291*(1<<RGB2YUV_SHIFT)+0.5))
-#define RY ((int)( 0.257*(1<<RGB2YUV_SHIFT)+0.5))
-#define RV ((int)( 0.439*(1<<RGB2YUV_SHIFT)+0.5))
-#define RU ((int)(-0.148*(1<<RGB2YUV_SHIFT)+0.5))
+#define BY ((int)( 0.098 * (1 << RGB2YUV_SHIFT) + 0.5))
+#define BV ((int)(-0.071 * (1 << RGB2YUV_SHIFT) + 0.5))
+#define BU ((int)( 0.439 * (1 << RGB2YUV_SHIFT) + 0.5))
+#define GY ((int)( 0.504 * (1 << RGB2YUV_SHIFT) + 0.5))
+#define GV ((int)(-0.368 * (1 << RGB2YUV_SHIFT) + 0.5))
+#define GU ((int)(-0.291 * (1 << RGB2YUV_SHIFT) + 0.5))
+#define RY ((int)( 0.257 * (1 << RGB2YUV_SHIFT) + 0.5))
+#define RV ((int)( 0.439 * (1 << RGB2YUV_SHIFT) + 0.5))
+#define RU ((int)(-0.148 * (1 << RGB2YUV_SHIFT) + 0.5))
//plain C versions
#include "rgb2rgb_template.c"
-
/*
- RGB15->RGB16 original by Strepto/Astral
- ported to gcc & bugfixed : A'rpi
- MMX2, 3DNOW optimization by Nick Kurshev
- 32-bit C version, and and&add trick by Michael Niedermayer
-*/
+ * RGB15->RGB16 original by Strepto/Astral
+ * ported to gcc & bugfixed : A'rpi
+ * MMXEXT, 3DNOW optimization by Nick Kurshev
+ * 32-bit C version, and and&add trick by Michael Niedermayer
+ */
-void sws_rgb2rgb_init(void)
+av_cold void sws_rgb2rgb_init(void)
{
rgb2rgb_init_c();
if (HAVE_MMX)
@@ -125,18 +135,18 @@ void sws_rgb2rgb_init(void)
void rgb32to24(const uint8_t *src, uint8_t *dst, int src_size)
{
- int i;
- int num_pixels = src_size >> 2;
- for (i=0; i<num_pixels; i++) {
+ int i, num_pixels = src_size >> 2;
+
+ for (i = 0; i < num_pixels; i++) {
#if HAVE_BIGENDIAN
/* RGB32 (= A,B,G,R) -> BGR24 (= B,G,R) */
- dst[3*i + 0] = src[4*i + 1];
- dst[3*i + 1] = src[4*i + 2];
- dst[3*i + 2] = src[4*i + 3];
+ dst[3 * i + 0] = src[4 * i + 1];
+ dst[3 * i + 1] = src[4 * i + 2];
+ dst[3 * i + 2] = src[4 * i + 3];
#else
- dst[3*i + 0] = src[4*i + 2];
- dst[3*i + 1] = src[4*i + 1];
- dst[3*i + 2] = src[4*i + 0];
+ dst[3 * i + 0] = src[4 * i + 2];
+ dst[3 * i + 1] = src[4 * i + 1];
+ dst[3 * i + 2] = src[4 * i + 0];
#endif
}
}
@@ -144,40 +154,40 @@ void rgb32to24(const uint8_t *src, uint8_t *dst, int src_size)
void rgb24to32(const uint8_t *src, uint8_t *dst, int src_size)
{
int i;
- for (i=0; 3*i<src_size; i++) {
+
+ for (i = 0; 3 * i < src_size; i++) {
#if HAVE_BIGENDIAN
- /* RGB24 (= R,G,B) -> BGR32 (= A,R,G,B) */
- dst[4*i + 0] = 255;
- dst[4*i + 1] = src[3*i + 0];
- dst[4*i + 2] = src[3*i + 1];
- dst[4*i + 3] = src[3*i + 2];
+ /* RGB24 (= R, G, B) -> BGR32 (= A, R, G, B) */
+ dst[4 * i + 0] = 255;
+ dst[4 * i + 1] = src[3 * i + 0];
+ dst[4 * i + 2] = src[3 * i + 1];
+ dst[4 * i + 3] = src[3 * i + 2];
#else
- dst[4*i + 0] = src[3*i + 2];
- dst[4*i + 1] = src[3*i + 1];
- dst[4*i + 2] = src[3*i + 0];
- dst[4*i + 3] = 255;
+ dst[4 * i + 0] = src[3 * i + 2];
+ dst[4 * i + 1] = src[3 * i + 1];
+ dst[4 * i + 2] = src[3 * i + 0];
+ dst[4 * i + 3] = 255;
#endif
}
}
void rgb16tobgr32(const uint8_t *src, uint8_t *dst, int src_size)
{
- const uint16_t *end;
- uint8_t *d = dst;
- const uint16_t *s = (const uint16_t *)src;
- end = s + src_size/2;
+ uint8_t *d = dst;
+ const uint16_t *s = (const uint16_t *)src;
+ const uint16_t *end = s + src_size / 2;
+
while (s < end) {
- register uint16_t bgr;
- bgr = *s++;
+ register uint16_t bgr = *s++;
#if HAVE_BIGENDIAN
*d++ = 255;
- *d++ = (bgr&0x1F)<<3;
- *d++ = (bgr&0x7E0)>>3;
- *d++ = (bgr&0xF800)>>8;
+ *d++ = (bgr & 0x1F) << 3;
+ *d++ = (bgr & 0x7E0) >> 3;
+ *d++ = (bgr & 0xF800) >> 8;
#else
- *d++ = (bgr&0xF800)>>8;
- *d++ = (bgr&0x7E0)>>3;
- *d++ = (bgr&0x1F)<<3;
+ *d++ = (bgr & 0xF800) >> 8;
+ *d++ = (bgr & 0x7E0) >> 3;
+ *d++ = (bgr & 0x1F) << 3;
*d++ = 255;
#endif
}
@@ -185,78 +195,74 @@ void rgb16tobgr32(const uint8_t *src, uint8_t *dst, int src_size)
void rgb12to15(const uint8_t *src, uint8_t *dst, int src_size)
{
- const uint16_t *end;
- uint16_t *d = (uint16_t *)dst;
- const uint16_t *s = (const uint16_t *)src;
uint16_t rgb, r, g, b;
- end = s + src_size / 2;
+ uint16_t *d = (uint16_t *)dst;
+ const uint16_t *s = (const uint16_t *)src;
+ const uint16_t *end = s + src_size / 2;
+
while (s < end) {
- rgb = *s++;
- r = rgb & 0xF00;
- g = rgb & 0x0F0;
- b = rgb & 0x00F;
- r = (r << 3) | ((r & 0x800) >> 1);
- g = (g << 2) | ((g & 0x080) >> 2);
- b = (b << 1) | ( b >> 3);
+ rgb = *s++;
+ r = rgb & 0xF00;
+ g = rgb & 0x0F0;
+ b = rgb & 0x00F;
+ r = (r << 3) | ((r & 0x800) >> 1);
+ g = (g << 2) | ((g & 0x080) >> 2);
+ b = (b << 1) | ( b >> 3);
*d++ = r | g | b;
}
}
void rgb16to24(const uint8_t *src, uint8_t *dst, int src_size)
{
- const uint16_t *end;
- uint8_t *d = dst;
- const uint16_t *s = (const uint16_t *)src;
- end = s + src_size/2;
+ uint8_t *d = dst;
+ const uint16_t *s = (const uint16_t *)src;
+ const uint16_t *end = s + src_size / 2;
+
while (s < end) {
- register uint16_t bgr;
- bgr = *s++;
- *d++ = (bgr&0xF800)>>8;
- *d++ = (bgr&0x7E0)>>3;
- *d++ = (bgr&0x1F)<<3;
+ register uint16_t bgr = *s++;
+ *d++ = (bgr & 0xF800) >> 8;
+ *d++ = (bgr & 0x7E0) >> 3;
+ *d++ = (bgr & 0x1F) << 3;
}
}
void rgb16tobgr16(const uint8_t *src, uint8_t *dst, int src_size)
{
- int i;
- int num_pixels = src_size >> 1;
+ int i, num_pixels = src_size >> 1;
- for (i=0; i<num_pixels; i++) {
- unsigned rgb = ((const uint16_t*)src)[i];
- ((uint16_t*)dst)[i] = (rgb>>11) | (rgb&0x7E0) | (rgb<<11);
+ for (i = 0; i < num_pixels; i++) {
+ unsigned rgb = ((const uint16_t *)src)[i];
+ ((uint16_t *)dst)[i] = (rgb >> 11) | (rgb & 0x7E0) | (rgb << 11);
}
}
void rgb16tobgr15(const uint8_t *src, uint8_t *dst, int src_size)
{
- int i;
- int num_pixels = src_size >> 1;
+ int i, num_pixels = src_size >> 1;
- for (i=0; i<num_pixels; i++) {
- unsigned rgb = ((const uint16_t*)src)[i];
- ((uint16_t*)dst)[i] = (rgb>>11) | ((rgb&0x7C0)>>1) | ((rgb&0x1F)<<10);
+ for (i = 0; i < num_pixels; i++) {
+ unsigned rgb = ((const uint16_t *)src)[i];
+ ((uint16_t *)dst)[i] = (rgb >> 11) | ((rgb & 0x7C0) >> 1) | ((rgb & 0x1F) << 10);
}
}
void rgb15tobgr32(const uint8_t *src, uint8_t *dst, int src_size)
{
- const uint16_t *end;
- uint8_t *d = dst;
- const uint16_t *s = (const uint16_t *)src;
- end = s + src_size/2;
+ uint8_t *d = dst;
+ const uint16_t *s = (const uint16_t *)src;
+ const uint16_t *end = s + src_size / 2;
+
while (s < end) {
- register uint16_t bgr;
- bgr = *s++;
+ register uint16_t bgr = *s++;
#if HAVE_BIGENDIAN
*d++ = 255;
- *d++ = (bgr&0x1F)<<3;
- *d++ = (bgr&0x3E0)>>2;
- *d++ = (bgr&0x7C00)>>7;
+ *d++ = (bgr & 0x1F) << 3;
+ *d++ = (bgr & 0x3E0) >> 2;
+ *d++ = (bgr & 0x7C00) >> 7;
#else
- *d++ = (bgr&0x7C00)>>7;
- *d++ = (bgr&0x3E0)>>2;
- *d++ = (bgr&0x1F)<<3;
+ *d++ = (bgr & 0x7C00) >> 7;
+ *d++ = (bgr & 0x3E0) >> 2;
+ *d++ = (bgr & 0x1F) << 3;
*d++ = 255;
#endif
}
@@ -264,77 +270,71 @@ void rgb15tobgr32(const uint8_t *src, uint8_t *dst, int src_size)
void rgb15to24(const uint8_t *src, uint8_t *dst, int src_size)
{
- const uint16_t *end;
- uint8_t *d = dst;
- const uint16_t *s = (const uint16_t *)src;
- end = s + src_size/2;
+ uint8_t *d = dst;
+ const uint16_t *s = (const uint16_t *)src;
+ const uint16_t *end = s + src_size / 2;
+
while (s < end) {
- register uint16_t bgr;
- bgr = *s++;
- *d++ = (bgr&0x7C00)>>7;
- *d++ = (bgr&0x3E0)>>2;
- *d++ = (bgr&0x1F)<<3;
+ register uint16_t bgr = *s++;
+ *d++ = (bgr & 0x7C00) >> 7;
+ *d++ = (bgr & 0x3E0) >> 2;
+ *d++ = (bgr & 0x1F) << 3;
}
}
void rgb15tobgr16(const uint8_t *src, uint8_t *dst, int src_size)
{
- int i;
- int num_pixels = src_size >> 1;
+ int i, num_pixels = src_size >> 1;
- for (i=0; i<num_pixels; i++) {
- unsigned rgb = ((const uint16_t*)src)[i];
- ((uint16_t*)dst)[i] = ((rgb&0x7C00)>>10) | ((rgb&0x3E0)<<1) | (rgb<<11);
+ for (i = 0; i < num_pixels; i++) {
+ unsigned rgb = ((const uint16_t *)src)[i];
+ ((uint16_t *)dst)[i] = ((rgb & 0x7C00) >> 10) | ((rgb & 0x3E0) << 1) | (rgb << 11);
}
}
void rgb15tobgr15(const uint8_t *src, uint8_t *dst, int src_size)
{
- int i;
- int num_pixels = src_size >> 1;
+ int i, num_pixels = src_size >> 1;
- for (i=0; i<num_pixels; i++) {
- unsigned br;
- unsigned rgb = ((const uint16_t*)src)[i];
- br = rgb&0x7c1F;
- ((uint16_t*)dst)[i] = (br>>10) | (rgb&0x3E0) | (br<<10);
+ for (i = 0; i < num_pixels; i++) {
+ unsigned rgb = ((const uint16_t *)src)[i];
+ unsigned br = rgb & 0x7C1F;
+ ((uint16_t *)dst)[i] = (br >> 10) | (rgb & 0x3E0) | (br << 10);
}
}
void rgb12tobgr12(const uint8_t *src, uint8_t *dst, int src_size)
{
- uint16_t *d = (uint16_t*)dst;
- uint16_t *s = (uint16_t*)src;
- int i;
- int num_pixels = src_size >> 1;
+ uint16_t *d = (uint16_t *)dst;
+ uint16_t *s = (uint16_t *)src;
+ int i, num_pixels = src_size >> 1;
for (i = 0; i < num_pixels; i++) {
unsigned rgb = s[i];
- d[i] = (rgb << 8 | rgb & 0xF0 | rgb >> 8) & 0xFFF;
+ d[i] = (rgb << 8 | rgb & 0xF0 | rgb >> 8) & 0xFFF;
}
}
void bgr8torgb8(const uint8_t *src, uint8_t *dst, int src_size)
{
- int i;
- int num_pixels = src_size;
- for (i=0; i<num_pixels; i++) {
- unsigned b,g,r;
- register uint8_t rgb;
- rgb = src[i];
- r = (rgb&0x07);
- g = (rgb&0x38)>>3;
- b = (rgb&0xC0)>>6;
- dst[i] = ((b<<1)&0x07) | ((g&0x07)<<3) | ((r&0x03)<<6);
+ int i, num_pixels = src_size;
+
+ for (i = 0; i < num_pixels; i++) {
+ register uint8_t rgb = src[i];
+ unsigned r = (rgb & 0x07);
+ unsigned g = (rgb & 0x38) >> 3;
+ unsigned b = (rgb & 0xC0) >> 6;
+ dst[i] = ((b << 1) & 0x07) | ((g & 0x07) << 3) | ((r & 0x03) << 6);
}
}
#define DEFINE_SHUFFLE_BYTES(a, b, c, d) \
-void shuffle_bytes_##a##b##c##d(const uint8_t *src, uint8_t *dst, int src_size) \
+void shuffle_bytes_ ## a ## b ## c ## d(const uint8_t *src, \
+ uint8_t *dst, int src_size) \
{ \
- int i; \
+ int i; \
\
- for (i = 0; i < src_size; i+=4) { \
+ for (i = 0; i < src_size; i += 4) { \
dst[i + 0] = src[i + a]; \
dst[i + 1] = src[i + b]; \
dst[i + 2] = src[i + c]; \
@@ -346,4 +346,3 @@ DEFINE_SHUFFLE_BYTES(0, 3, 2, 1)
DEFINE_SHUFFLE_BYTES(1, 2, 3, 0)
DEFINE_SHUFFLE_BYTES(3, 0, 1, 2)
DEFINE_SHUFFLE_BYTES(3, 2, 1, 0)
-
diff --git a/gst-libs/ext/libav/libswscale/rgb2rgb_template.c b/gst-libs/ext/libav/libswscale/rgb2rgb_template.c
index c02015e..3785ef9 100644
--- a/gst-libs/ext/libav/libswscale/rgb2rgb_template.c
+++ b/gst-libs/ext/libav/libswscale/rgb2rgb_template.c
@@ -26,276 +26,286 @@
#include <stddef.h>
-static inline void rgb24tobgr32_c(const uint8_t *src, uint8_t *dst, int src_size)
+static inline void rgb24tobgr32_c(const uint8_t *src, uint8_t *dst,
+ int src_size)
{
- uint8_t *dest = dst;
- const uint8_t *s = src;
- const uint8_t *end;
- end = s + src_size;
+ uint8_t *dest = dst;
+ const uint8_t *s = src;
+ const uint8_t *end = s + src_size;
while (s < end) {
#if HAVE_BIGENDIAN
- /* RGB24 (= R,G,B) -> RGB32 (= A,B,G,R) */
- *dest++ = 255;
- *dest++ = s[2];
- *dest++ = s[1];
- *dest++ = s[0];
- s+=3;
+ /* RGB24 (= R, G, B) -> RGB32 (= A, B, G, R) */
+ *dest++ = 255;
+ *dest++ = s[2];
+ *dest++ = s[1];
+ *dest++ = s[0];
+ s += 3;
#else
- *dest++ = *s++;
- *dest++ = *s++;
- *dest++ = *s++;
- *dest++ = 255;
+ *dest++ = *s++;
+ *dest++ = *s++;
+ *dest++ = *s++;
+ *dest++ = 255;
#endif
}
}
-static inline void rgb32tobgr24_c(const uint8_t *src, uint8_t *dst, int src_size)
+static inline void rgb32tobgr24_c(const uint8_t *src, uint8_t *dst,
+ int src_size)
{
- uint8_t *dest = dst;
- const uint8_t *s = src;
- const uint8_t *end;
-
- end = s + src_size;
+ uint8_t *dest = dst;
+ const uint8_t *s = src;
+ const uint8_t *end = s + src_size;
while (s < end) {
#if HAVE_BIGENDIAN
- /* RGB32 (= A,B,G,R) -> RGB24 (= R,G,B) */
+ /* RGB32 (= A, B, G, R) -> RGB24 (= R, G, B) */
s++;
- dest[2] = *s++;
- dest[1] = *s++;
- dest[0] = *s++;
- dest += 3;
+ dest[2] = *s++;
+ dest[1] = *s++;
+ dest[0] = *s++;
+ dest += 3;
#else
- *dest++ = *s++;
- *dest++ = *s++;
- *dest++ = *s++;
+ *dest++ = *s++;
+ *dest++ = *s++;
+ *dest++ = *s++;
s++;
#endif
}
}
/*
- original by Strepto/Astral
- ported to gcc & bugfixed: A'rpi
- MMX2, 3DNOW optimization by Nick Kurshev
- 32-bit C version, and and&add trick by Michael Niedermayer
-*/
+ * original by Strepto/Astral
+ * ported to gcc & bugfixed: A'rpi
+ * MMXEXT, 3DNOW optimization by Nick Kurshev
+ * 32-bit C version, and and&add trick by Michael Niedermayer
+ */
static inline void rgb15to16_c(const uint8_t *src, uint8_t *dst, int src_size)
{
- register const uint8_t* s=src;
- register uint8_t* d=dst;
- register const uint8_t *end;
- const uint8_t *mm_end;
- end = s + src_size;
- mm_end = end - 3;
+ register uint8_t *d = dst;
+ register const uint8_t *s = src;
+ register const uint8_t *end = s + src_size;
+ const uint8_t *mm_end = end - 3;
+
while (s < mm_end) {
- register unsigned x= *((const uint32_t *)s);
- *((uint32_t *)d) = (x&0x7FFF7FFF) + (x&0x7FE07FE0);
- d+=4;
- s+=4;
+ register unsigned x = *((const uint32_t *)s);
+ *((uint32_t *)d) = (x & 0x7FFF7FFF) + (x & 0x7FE07FE0);
+ d += 4;
+ s += 4;
}
if (s < end) {
- register unsigned short x= *((const uint16_t *)s);
- *((uint16_t *)d) = (x&0x7FFF) + (x&0x7FE0);
+ register unsigned short x = *((const uint16_t *)s);
+ *((uint16_t *)d) = (x & 0x7FFF) + (x & 0x7FE0);
}
}
static inline void rgb16to15_c(const uint8_t *src, uint8_t *dst, int src_size)
{
- register const uint8_t* s=src;
- register uint8_t* d=dst;
- register const uint8_t *end;
- const uint8_t *mm_end;
- end = s + src_size;
+ register uint8_t *d = dst;
+ register const uint8_t *s = src;
+ register const uint8_t *end = s + src_size;
+ const uint8_t *mm_end = end - 3;
- mm_end = end - 3;
while (s < mm_end) {
- register uint32_t x= *((const uint32_t*)s);
- *((uint32_t *)d) = ((x>>1)&0x7FE07FE0) | (x&0x001F001F);
- s+=4;
- d+=4;
+ register uint32_t x = *((const uint32_t *)s);
+ *((uint32_t *)d) = ((x >> 1) & 0x7FE07FE0) | (x & 0x001F001F);
+ s += 4;
+ d += 4;
}
if (s < end) {
- register uint16_t x= *((const uint16_t*)s);
- *((uint16_t *)d) = ((x>>1)&0x7FE0) | (x&0x001F);
+ register uint16_t x = *((const uint16_t *)s);
+ *((uint16_t *)d) = ((x >> 1) & 0x7FE0) | (x & 0x001F);
}
}
static inline void rgb32to16_c(const uint8_t *src, uint8_t *dst, int src_size)
{
- const uint8_t *s = src;
- const uint8_t *end;
- uint16_t *d = (uint16_t *)dst;
- end = s + src_size;
+ uint16_t *d = (uint16_t *)dst;
+ const uint8_t *s = src;
+ const uint8_t *end = s + src_size;
while (s < end) {
- register int rgb = *(const uint32_t*)s; s += 4;
- *d++ = ((rgb&0xFF)>>3) + ((rgb&0xFC00)>>5) + ((rgb&0xF80000)>>8);
+ register int rgb = *(const uint32_t *)s;
+ s += 4;
+ *d++ = ((rgb & 0xFF) >> 3) +
+ ((rgb & 0xFC00) >> 5) +
+ ((rgb & 0xF80000) >> 8);
}
}
-static inline void rgb32tobgr16_c(const uint8_t *src, uint8_t *dst, int src_size)
+static inline void rgb32tobgr16_c(const uint8_t *src, uint8_t *dst,
+ int src_size)
{
- const uint8_t *s = src;
- const uint8_t *end;
- uint16_t *d = (uint16_t *)dst;
- end = s + src_size;
+ uint16_t *d = (uint16_t *)dst;
+ const uint8_t *s = src;
+ const uint8_t *end = s + src_size;
+
while (s < end) {
- register int rgb = *(const uint32_t*)s; s += 4;
- *d++ = ((rgb&0xF8)<<8) + ((rgb&0xFC00)>>5) + ((rgb&0xF80000)>>19);
+ register int rgb = *(const uint32_t *)s;
+ s += 4;
+ *d++ = ((rgb & 0xF8) << 8) +
+ ((rgb & 0xFC00) >> 5) +
+ ((rgb & 0xF80000) >> 19);
}
}
static inline void rgb32to15_c(const uint8_t *src, uint8_t *dst, int src_size)
{
- const uint8_t *s = src;
- const uint8_t *end;
- uint16_t *d = (uint16_t *)dst;
- end = s + src_size;
+ uint16_t *d = (uint16_t *)dst;
+ const uint8_t *s = src;
+ const uint8_t *end = s + src_size;
+
while (s < end) {
- register int rgb = *(const uint32_t*)s; s += 4;
- *d++ = ((rgb&0xFF)>>3) + ((rgb&0xF800)>>6) + ((rgb&0xF80000)>>9);
+ register int rgb = *(const uint32_t *)s;
+ s += 4;
+ *d++ = ((rgb & 0xFF) >> 3) +
+ ((rgb & 0xF800) >> 6) +
+ ((rgb & 0xF80000) >> 9);
}
}
-static inline void rgb32tobgr15_c(const uint8_t *src, uint8_t *dst, int src_size)
+static inline void rgb32tobgr15_c(const uint8_t *src, uint8_t *dst,
+ int src_size)
{
- const uint8_t *s = src;
- const uint8_t *end;
- uint16_t *d = (uint16_t *)dst;
- end = s + src_size;
+ uint16_t *d = (uint16_t *)dst;
+ const uint8_t *s = src;
+ const uint8_t *end = s + src_size;
+
while (s < end) {
- register int rgb = *(const uint32_t*)s; s += 4;
- *d++ = ((rgb&0xF8)<<7) + ((rgb&0xF800)>>6) + ((rgb&0xF80000)>>19);
+ register int rgb = *(const uint32_t *)s;
+ s += 4;
+ *d++ = ((rgb & 0xF8) << 7) +
+ ((rgb & 0xF800) >> 6) +
+ ((rgb & 0xF80000) >> 19);
}
}
-static inline void rgb24tobgr16_c(const uint8_t *src, uint8_t *dst, int src_size)
+static inline void rgb24tobgr16_c(const uint8_t *src, uint8_t *dst,
+ int src_size)
{
- const uint8_t *s = src;
- const uint8_t *end;
- uint16_t *d = (uint16_t *)dst;
- end = s + src_size;
+ uint16_t *d = (uint16_t *)dst;
+ const uint8_t *s = src;
+ const uint8_t *end = s + src_size;
+
while (s < end) {
const int b = *s++;
const int g = *s++;
const int r = *s++;
- *d++ = (b>>3) | ((g&0xFC)<<3) | ((r&0xF8)<<8);
+ *d++ = (b >> 3) | ((g & 0xFC) << 3) | ((r & 0xF8) << 8);
}
}
static inline void rgb24to16_c(const uint8_t *src, uint8_t *dst, int src_size)
{
- const uint8_t *s = src;
- const uint8_t *end;
- uint16_t *d = (uint16_t *)dst;
- end = s + src_size;
+ uint16_t *d = (uint16_t *)dst;
+ const uint8_t *s = src;
+ const uint8_t *end = s + src_size;
+
while (s < end) {
const int r = *s++;
const int g = *s++;
const int b = *s++;
- *d++ = (b>>3) | ((g&0xFC)<<3) | ((r&0xF8)<<8);
+ *d++ = (b >> 3) | ((g & 0xFC) << 3) | ((r & 0xF8) << 8);
}
}
-static inline void rgb24tobgr15_c(const uint8_t *src, uint8_t *dst, int src_size)
+static inline void rgb24tobgr15_c(const uint8_t *src, uint8_t *dst,
+ int src_size)
{
- const uint8_t *s = src;
- const uint8_t *end;
- uint16_t *d = (uint16_t *)dst;
- end = s + src_size;
+ uint16_t *d = (uint16_t *)dst;
+ const uint8_t *s = src;
+ const uint8_t *end = s + src_size;
+
while (s < end) {
const int b = *s++;
const int g = *s++;
const int r = *s++;
- *d++ = (b>>3) | ((g&0xF8)<<2) | ((r&0xF8)<<7);
+ *d++ = (b >> 3) | ((g & 0xF8) << 2) | ((r & 0xF8) << 7);
}
}
static inline void rgb24to15_c(const uint8_t *src, uint8_t *dst, int src_size)
{
- const uint8_t *s = src;
- const uint8_t *end;
- uint16_t *d = (uint16_t *)dst;
- end = s + src_size;
+ uint16_t *d = (uint16_t *)dst;
+ const uint8_t *s = src;
+ const uint8_t *end = s + src_size;
+
while (s < end) {
const int r = *s++;
const int g = *s++;
const int b = *s++;
- *d++ = (b>>3) | ((g&0xF8)<<2) | ((r&0xF8)<<7);
+ *d++ = (b >> 3) | ((g & 0xF8) << 2) | ((r & 0xF8) << 7);
}
}
/*
- I use less accurate approximation here by simply left-shifting the input
- value and filling the low order bits with zeroes. This method improves PNG
- compression but this scheme cannot reproduce white exactly, since it does
- not generate an all-ones maximum value; the net effect is to darken the
- image slightly.
-
- The better method should be "left bit replication":
-
- 4 3 2 1 0
- ---------
- 1 1 0 1 1
-
- 7 6 5 4 3 2 1 0
- ----------------
- 1 1 0 1 1 1 1 0
- |=======| |===|
- | leftmost bits repeated to fill open bits
- |
- original bits
-*/
-static inline void rgb15tobgr24_c(const uint8_t *src, uint8_t *dst, int src_size)
-{
- const uint16_t *end;
- uint8_t *d = dst;
- const uint16_t *s = (const uint16_t*)src;
- end = s + src_size/2;
+ * I use less accurate approximation here by simply left-shifting the input
+ * value and filling the low order bits with zeroes. This method improves PNG
+ * compression but this scheme cannot reproduce white exactly, since it does
+ * not generate an all-ones maximum value; the net effect is to darken the
+ * image slightly.
+ *
+ * The better method should be "left bit replication":
+ *
+ * 4 3 2 1 0
+ * ---------
+ * 1 1 0 1 1
+ *
+ * 7 6 5 4 3 2 1 0
+ * ----------------
+ * 1 1 0 1 1 1 1 0
+ * |=======| |===|
+ * | leftmost bits repeated to fill open bits
+ * |
+ * original bits
+ */
+static inline void rgb15tobgr24_c(const uint8_t *src, uint8_t *dst,
+ int src_size)
+{
+ uint8_t *d = dst;
+ const uint16_t *s = (const uint16_t *)src;
+ const uint16_t *end = s + src_size / 2;
+
while (s < end) {
- register uint16_t bgr;
- bgr = *s++;
- *d++ = (bgr&0x1F)<<3;
- *d++ = (bgr&0x3E0)>>2;
- *d++ = (bgr&0x7C00)>>7;
+ register uint16_t bgr = *s++;
+ *d++ = (bgr & 0x1F) << 3;
+ *d++ = (bgr & 0x3E0) >> 2;
+ *d++ = (bgr & 0x7C00) >> 7;
}
}
-static inline void rgb16tobgr24_c(const uint8_t *src, uint8_t *dst, int src_size)
+static inline void rgb16tobgr24_c(const uint8_t *src, uint8_t *dst,
+ int src_size)
{
- const uint16_t *end;
- uint8_t *d = (uint8_t *)dst;
- const uint16_t *s = (const uint16_t *)src;
- end = s + src_size/2;
+ uint8_t *d = (uint8_t *)dst;
+ const uint16_t *s = (const uint16_t *)src;
+ const uint16_t *end = s + src_size / 2;
+
while (s < end) {
- register uint16_t bgr;
- bgr = *s++;
- *d++ = (bgr&0x1F)<<3;
- *d++ = (bgr&0x7E0)>>3;
- *d++ = (bgr&0xF800)>>8;
+ register uint16_t bgr = *s++;
+ *d++ = (bgr & 0x1F) << 3;
+ *d++ = (bgr & 0x7E0) >> 3;
+ *d++ = (bgr & 0xF800) >> 8;
}
}
static inline void rgb15to32_c(const uint8_t *src, uint8_t *dst, int src_size)
{
- const uint16_t *end;
- uint8_t *d = dst;
- const uint16_t *s = (const uint16_t *)src;
- end = s + src_size/2;
+ uint8_t *d = dst;
+ const uint16_t *s = (const uint16_t *)src;
+ const uint16_t *end = s + src_size / 2;
+
while (s < end) {
- register uint16_t bgr;
- bgr = *s++;
+ register uint16_t bgr = *s++;
#if HAVE_BIGENDIAN
*d++ = 255;
- *d++ = (bgr&0x7C00)>>7;
- *d++ = (bgr&0x3E0)>>2;
- *d++ = (bgr&0x1F)<<3;
+ *d++ = (bgr & 0x7C00) >> 7;
+ *d++ = (bgr & 0x3E0) >> 2;
+ *d++ = (bgr & 0x1F) << 3;
#else
- *d++ = (bgr&0x1F)<<3;
- *d++ = (bgr&0x3E0)>>2;
- *d++ = (bgr&0x7C00)>>7;
+ *d++ = (bgr & 0x1F) << 3;
+ *d++ = (bgr & 0x3E0) >> 2;
+ *d++ = (bgr & 0x7C00) >> 7;
*d++ = 255;
#endif
}
@@ -303,48 +313,49 @@ static inline void rgb15to32_c(const uint8_t *src, uint8_t *dst, int src_size)
static inline void rgb16to32_c(const uint8_t *src, uint8_t *dst, int src_size)
{
- const uint16_t *end;
- uint8_t *d = dst;
- const uint16_t *s = (const uint16_t*)src;
- end = s + src_size/2;
+ uint8_t *d = dst;
+ const uint16_t *s = (const uint16_t *)src;
+ const uint16_t *end = s + src_size / 2;
+
while (s < end) {
- register uint16_t bgr;
- bgr = *s++;
+ register uint16_t bgr = *s++;
#if HAVE_BIGENDIAN
*d++ = 255;
- *d++ = (bgr&0xF800)>>8;
- *d++ = (bgr&0x7E0)>>3;
- *d++ = (bgr&0x1F)<<3;
+ *d++ = (bgr & 0xF800) >> 8;
+ *d++ = (bgr & 0x7E0) >> 3;
+ *d++ = (bgr & 0x1F) << 3;
#else
- *d++ = (bgr&0x1F)<<3;
- *d++ = (bgr&0x7E0)>>3;
- *d++ = (bgr&0xF800)>>8;
+ *d++ = (bgr & 0x1F) << 3;
+ *d++ = (bgr & 0x7E0) >> 3;
+ *d++ = (bgr & 0xF800) >> 8;
*d++ = 255;
#endif
}
}
-static inline void shuffle_bytes_2103_c(const uint8_t *src, uint8_t *dst, int src_size)
+static inline void shuffle_bytes_2103_c(const uint8_t *src, uint8_t *dst,
+ int src_size)
{
- int idx = 15 - src_size;
- const uint8_t *s = src-idx;
- uint8_t *d = dst-idx;
- for (; idx<15; idx+=4) {
- register int v = *(const uint32_t *)&s[idx], g = v & 0xff00ff00;
- v &= 0xff00ff;
- *(uint32_t *)&d[idx] = (v>>16) + g + (v<<16);
+ int idx = 15 - src_size;
+ const uint8_t *s = src - idx;
+ uint8_t *d = dst - idx;
+
+ for (; idx < 15; idx += 4) {
+ register int v = *(const uint32_t *)&s[idx], g = v & 0xff00ff00;
+ v &= 0xff00ff;
+ *(uint32_t *)&d[idx] = (v >> 16) + g + (v << 16);
}
}
static inline void rgb24tobgr24_c(const uint8_t *src, uint8_t *dst, int src_size)
{
unsigned i;
- for (i=0; i<src_size; i+=3) {
- register uint8_t x;
- x = src[i + 2];
- dst[i + 1] = src[i + 1];
- dst[i + 2] = src[i + 0];
- dst[i + 0] = x;
+
+ for (i = 0; i < src_size; i += 3) {
+ register uint8_t x = src[i + 2];
+ dst[i + 1] = src[i + 1];
+ dst[i + 2] = src[i + 0];
+ dst[i + 0] = x;
}
}
@@ -354,42 +365,42 @@ static inline void yuvPlanartoyuy2_c(const uint8_t *ysrc, const uint8_t *usrc,
int lumStride, int chromStride,
int dstStride, int vertLumPerChroma)
{
- int y;
+ int y, i;
const int chromWidth = width >> 1;
- for (y=0; y<height; y++) {
+
+ for (y = 0; y < height; y++) {
#if HAVE_FAST_64BIT
- int i;
- uint64_t *ldst = (uint64_t *) dst;
+ uint64_t *ldst = (uint64_t *)dst;
const uint8_t *yc = ysrc, *uc = usrc, *vc = vsrc;
for (i = 0; i < chromWidth; i += 2) {
- uint64_t k, l;
- k = yc[0] + (uc[0] << 8) +
- (yc[1] << 16) + (vc[0] << 24);
- l = yc[2] + (uc[1] << 8) +
- (yc[3] << 16) + (vc[1] << 24);
+ uint64_t k = yc[0] + (uc[0] << 8) +
+ (yc[1] << 16) + (vc[0] << 24);
+ uint64_t l = yc[2] + (uc[1] << 8) +
+ (yc[3] << 16) + (vc[1] << 24);
*ldst++ = k + (l << 32);
- yc += 4;
- uc += 2;
- vc += 2;
+ yc += 4;
+ uc += 2;
+ vc += 2;
}
#else
- int i, *idst = (int32_t *) dst;
+ int *idst = (int32_t *)dst;
const uint8_t *yc = ysrc, *uc = usrc, *vc = vsrc;
+
for (i = 0; i < chromWidth; i++) {
#if HAVE_BIGENDIAN
- *idst++ = (yc[0] << 24)+ (uc[0] << 16) +
- (yc[1] << 8) + (vc[0] << 0);
+ *idst++ = (yc[0] << 24) + (uc[0] << 16) +
+ (yc[1] << 8) + (vc[0] << 0);
#else
*idst++ = yc[0] + (uc[0] << 8) +
- (yc[1] << 16) + (vc[0] << 24);
+ (yc[1] << 16) + (vc[0] << 24);
#endif
yc += 2;
uc++;
vc++;
}
#endif
- if ((y&(vertLumPerChroma-1)) == vertLumPerChroma-1) {
+ if ((y & (vertLumPerChroma - 1)) == vertLumPerChroma - 1) {
usrc += chromStride;
vsrc += chromStride;
}
@@ -404,9 +415,8 @@ static inline void yuvPlanartoyuy2_c(const uint8_t *ysrc, const uint8_t *usrc,
*/
static inline void yv12toyuy2_c(const uint8_t *ysrc, const uint8_t *usrc,
const uint8_t *vsrc, uint8_t *dst,
- int width, int height,
- int lumStride, int chromStride,
- int dstStride)
+ int width, int height, int lumStride,
+ int chromStride, int dstStride)
{
//FIXME interpolate chroma
yuvPlanartoyuy2_c(ysrc, usrc, vsrc, dst, width, height, lumStride,
@@ -419,47 +429,47 @@ static inline void yuvPlanartouyvy_c(const uint8_t *ysrc, const uint8_t *usrc,
int lumStride, int chromStride,
int dstStride, int vertLumPerChroma)
{
- int y;
+ int y, i;
const int chromWidth = width >> 1;
- for (y=0; y<height; y++) {
+
+ for (y = 0; y < height; y++) {
#if HAVE_FAST_64BIT
- int i;
- uint64_t *ldst = (uint64_t *) dst;
+ uint64_t *ldst = (uint64_t *)dst;
const uint8_t *yc = ysrc, *uc = usrc, *vc = vsrc;
for (i = 0; i < chromWidth; i += 2) {
- uint64_t k, l;
- k = uc[0] + (yc[0] << 8) +
- (vc[0] << 16) + (yc[1] << 24);
- l = uc[1] + (yc[2] << 8) +
- (vc[1] << 16) + (yc[3] << 24);
+ uint64_t k = uc[0] + (yc[0] << 8) +
+ (vc[0] << 16) + (yc[1] << 24);
+ uint64_t l = uc[1] + (yc[2] << 8) +
+ (vc[1] << 16) + (yc[3] << 24);
*ldst++ = k + (l << 32);
- yc += 4;
- uc += 2;
- vc += 2;
+ yc += 4;
+ uc += 2;
+ vc += 2;
}
#else
- int i, *idst = (int32_t *) dst;
+ int *idst = (int32_t *)dst;
const uint8_t *yc = ysrc, *uc = usrc, *vc = vsrc;
+
for (i = 0; i < chromWidth; i++) {
#if HAVE_BIGENDIAN
- *idst++ = (uc[0] << 24)+ (yc[0] << 16) +
- (vc[0] << 8) + (yc[1] << 0);
+ *idst++ = (uc[0] << 24) + (yc[0] << 16) +
+ (vc[0] << 8) + (yc[1] << 0);
#else
*idst++ = uc[0] + (yc[0] << 8) +
- (vc[0] << 16) + (yc[1] << 24);
+ (vc[0] << 16) + (yc[1] << 24);
#endif
yc += 2;
uc++;
vc++;
}
#endif
- if ((y&(vertLumPerChroma-1)) == vertLumPerChroma-1) {
+ if ((y & (vertLumPerChroma - 1)) == vertLumPerChroma - 1) {
usrc += chromStride;
vsrc += chromStride;
}
ysrc += lumStride;
- dst += dstStride;
+ dst += dstStride;
}
}
@@ -469,9 +479,8 @@ static inline void yuvPlanartouyvy_c(const uint8_t *ysrc, const uint8_t *usrc,
*/
static inline void yv12touyvy_c(const uint8_t *ysrc, const uint8_t *usrc,
const uint8_t *vsrc, uint8_t *dst,
- int width, int height,
- int lumStride, int chromStride,
- int dstStride)
+ int width, int height, int lumStride,
+ int chromStride, int dstStride)
{
//FIXME interpolate chroma
yuvPlanartouyvy_c(ysrc, usrc, vsrc, dst, width, height, lumStride,
@@ -483,9 +492,8 @@ static inline void yv12touyvy_c(const uint8_t *ysrc, const uint8_t *usrc,
*/
static inline void yuv422ptouyvy_c(const uint8_t *ysrc, const uint8_t *usrc,
const uint8_t *vsrc, uint8_t *dst,
- int width, int height,
- int lumStride, int chromStride,
- int dstStride)
+ int width, int height, int lumStride,
+ int chromStride, int dstStride)
{
yuvPlanartouyvy_c(ysrc, usrc, vsrc, dst, width, height, lumStride,
chromStride, dstStride, 1);
@@ -496,9 +504,8 @@ static inline void yuv422ptouyvy_c(const uint8_t *ysrc, const uint8_t *usrc,
*/
static inline void yuv422ptoyuy2_c(const uint8_t *ysrc, const uint8_t *usrc,
const uint8_t *vsrc, uint8_t *dst,
- int width, int height,
- int lumStride, int chromStride,
- int dstStride)
+ int width, int height, int lumStride,
+ int chromStride, int dstStride)
{
yuvPlanartoyuy2_c(ysrc, usrc, vsrc, dst, width, height, lumStride,
chromStride, dstStride, 1);
@@ -510,26 +517,26 @@ static inline void yuv422ptoyuy2_c(const uint8_t *ysrc, const uint8_t *usrc,
*/
static inline void yuy2toyv12_c(const uint8_t *src, uint8_t *ydst,
uint8_t *udst, uint8_t *vdst,
- int width, int height,
- int lumStride, int chromStride,
- int srcStride)
+ int width, int height, int lumStride,
+ int chromStride, int srcStride)
{
int y;
const int chromWidth = width >> 1;
- for (y=0; y<height; y+=2) {
+
+ for (y = 0; y < height; y += 2) {
int i;
- for (i=0; i<chromWidth; i++) {
- ydst[2*i+0] = src[4*i+0];
- udst[i] = src[4*i+1];
- ydst[2*i+1] = src[4*i+2];
- vdst[i] = src[4*i+3];
+ for (i = 0; i < chromWidth; i++) {
+ ydst[2 * i + 0] = src[4 * i + 0];
+ udst[i] = src[4 * i + 1];
+ ydst[2 * i + 1] = src[4 * i + 2];
+ vdst[i] = src[4 * i + 3];
}
ydst += lumStride;
src += srcStride;
- for (i=0; i<chromWidth; i++) {
- ydst[2*i+0] = src[4*i+0];
- ydst[2*i+1] = src[4*i+2];
+ for (i = 0; i < chromWidth; i++) {
+ ydst[2 * i + 0] = src[4 * i + 0];
+ ydst[2 * i + 1] = src[4 * i + 2];
}
udst += chromStride;
vdst += chromStride;
@@ -541,46 +548,46 @@ static inline void yuy2toyv12_c(const uint8_t *src, uint8_t *ydst,
static inline void planar2x_c(const uint8_t *src, uint8_t *dst, int srcWidth,
int srcHeight, int srcStride, int dstStride)
{
- int x,y;
+ int x, y;
- dst[0]= src[0];
+ dst[0] = src[0];
// first line
- for (x=0; x<srcWidth-1; x++) {
- dst[2*x+1]= (3*src[x] + src[x+1])>>2;
- dst[2*x+2]= ( src[x] + 3*src[x+1])>>2;
+ for (x = 0; x < srcWidth - 1; x++) {
+ dst[2 * x + 1] = (3 * src[x] + src[x + 1]) >> 2;
+ dst[2 * x + 2] = (src[x] + 3 * src[x + 1]) >> 2;
}
- dst[2*srcWidth-1]= src[srcWidth-1];
+ dst[2 * srcWidth - 1] = src[srcWidth - 1];
- dst+= dstStride;
+ dst += dstStride;
- for (y=1; y<srcHeight; y++) {
+ for (y = 1; y < srcHeight; y++) {
const int mmxSize = 1;
- dst[0 ]= (3*src[0] + src[srcStride])>>2;
- dst[dstStride]= ( src[0] + 3*src[srcStride])>>2;
+ dst[0] = (src[0] * 3 + src[srcStride]) >> 2;
+ dst[dstStride] = (src[0] + 3 * src[srcStride]) >> 2;
- for (x=mmxSize-1; x<srcWidth-1; x++) {
- dst[2*x +1]= (3*src[x+0] + src[x+srcStride+1])>>2;
- dst[2*x+dstStride+2]= ( src[x+0] + 3*src[x+srcStride+1])>>2;
- dst[2*x+dstStride+1]= ( src[x+1] + 3*src[x+srcStride ])>>2;
- dst[2*x +2]= (3*src[x+1] + src[x+srcStride ])>>2;
+ for (x = mmxSize - 1; x < srcWidth - 1; x++) {
+ dst[2 * x + 1] = (src[x + 0] * 3 + src[x + srcStride + 1]) >> 2;
+ dst[2 * x + dstStride + 2] = (src[x + 0] + 3 * src[x + srcStride + 1]) >> 2;
+ dst[2 * x + dstStride + 1] = (src[x + 1] + 3 * src[x + srcStride]) >> 2;
+ dst[2 * x + 2] = (src[x + 1] * 3 + src[x + srcStride]) >> 2;
}
- dst[srcWidth*2 -1 ]= (3*src[srcWidth-1] + src[srcWidth-1 + srcStride])>>2;
- dst[srcWidth*2 -1 + dstStride]= ( src[srcWidth-1] + 3*src[srcWidth-1 + srcStride])>>2;
+ dst[srcWidth * 2 - 1] = (src[srcWidth - 1] * 3 + src[srcWidth - 1 + srcStride]) >> 2;
+ dst[srcWidth * 2 - 1 + dstStride] = (src[srcWidth - 1] + 3 * src[srcWidth - 1 + srcStride]) >> 2;
- dst+=dstStride*2;
- src+=srcStride;
+ dst += dstStride * 2;
+ src += srcStride;
}
// last line
- dst[0]= src[0];
+ dst[0] = src[0];
- for (x=0; x<srcWidth-1; x++) {
- dst[2*x+1]= (3*src[x] + src[x+1])>>2;
- dst[2*x+2]= ( src[x] + 3*src[x+1])>>2;
+ for (x = 0; x < srcWidth - 1; x++) {
+ dst[2 * x + 1] = (src[x] * 3 + src[x + 1]) >> 2;
+ dst[2 * x + 2] = (src[x] + 3 * src[x + 1]) >> 2;
}
- dst[2*srcWidth-1]= src[srcWidth-1];
+ dst[2 * srcWidth - 1] = src[srcWidth - 1];
}
/**
@@ -591,26 +598,26 @@ static inline void planar2x_c(const uint8_t *src, uint8_t *dst, int srcWidth,
*/
static inline void uyvytoyv12_c(const uint8_t *src, uint8_t *ydst,
uint8_t *udst, uint8_t *vdst,
- int width, int height,
- int lumStride, int chromStride,
- int srcStride)
+ int width, int height, int lumStride,
+ int chromStride, int srcStride)
{
int y;
const int chromWidth = width >> 1;
- for (y=0; y<height; y+=2) {
+
+ for (y = 0; y < height; y += 2) {
int i;
- for (i=0; i<chromWidth; i++) {
- udst[i] = src[4*i+0];
- ydst[2*i+0] = src[4*i+1];
- vdst[i] = src[4*i+2];
- ydst[2*i+1] = src[4*i+3];
+ for (i = 0; i < chromWidth; i++) {
+ udst[i] = src[4 * i + 0];
+ ydst[2 * i + 0] = src[4 * i + 1];
+ vdst[i] = src[4 * i + 2];
+ ydst[2 * i + 1] = src[4 * i + 3];
}
ydst += lumStride;
src += srcStride;
- for (i=0; i<chromWidth; i++) {
- ydst[2*i+0] = src[4*i+1];
- ydst[2*i+1] = src[4*i+3];
+ for (i = 0; i < chromWidth; i++) {
+ ydst[2 * i + 0] = src[4 * i + 1];
+ ydst[2 * i + 1] = src[4 * i + 3];
}
udst += chromStride;
vdst += chromStride;
@@ -632,47 +639,47 @@ void rgb24toyv12_c(const uint8_t *src, uint8_t *ydst, uint8_t *udst,
{
int y;
const int chromWidth = width >> 1;
- y=0;
- for (; y<height; y+=2) {
+
+ for (y = 0; y < height; y += 2) {
int i;
- for (i=0; i<chromWidth; i++) {
- unsigned int b = src[6*i+0];
- unsigned int g = src[6*i+1];
- unsigned int r = src[6*i+2];
+ for (i = 0; i < chromWidth; i++) {
+ unsigned int b = src[6 * i + 0];
+ unsigned int g = src[6 * i + 1];
+ unsigned int r = src[6 * i + 2];
- unsigned int Y = ((RY*r + GY*g + BY*b)>>RGB2YUV_SHIFT) + 16;
- unsigned int V = ((RV*r + GV*g + BV*b)>>RGB2YUV_SHIFT) + 128;
- unsigned int U = ((RU*r + GU*g + BU*b)>>RGB2YUV_SHIFT) + 128;
+ unsigned int Y = ((RY * r + GY * g + BY * b) >> RGB2YUV_SHIFT) + 16;
+ unsigned int V = ((RV * r + GV * g + BV * b) >> RGB2YUV_SHIFT) + 128;
+ unsigned int U = ((RU * r + GU * g + BU * b) >> RGB2YUV_SHIFT) + 128;
udst[i] = U;
vdst[i] = V;
- ydst[2*i] = Y;
+ ydst[2 * i] = Y;
- b = src[6*i+3];
- g = src[6*i+4];
- r = src[6*i+5];
+ b = src[6 * i + 3];
+ g = src[6 * i + 4];
+ r = src[6 * i + 5];
- Y = ((RY*r + GY*g + BY*b)>>RGB2YUV_SHIFT) + 16;
- ydst[2*i+1] = Y;
+ Y = ((RY * r + GY * g + BY * b) >> RGB2YUV_SHIFT) + 16;
+ ydst[2 * i + 1] = Y;
}
ydst += lumStride;
src += srcStride;
- for (i=0; i<chromWidth; i++) {
- unsigned int b = src[6*i+0];
- unsigned int g = src[6*i+1];
- unsigned int r = src[6*i+2];
+ for (i = 0; i < chromWidth; i++) {
+ unsigned int b = src[6 * i + 0];
+ unsigned int g = src[6 * i + 1];
+ unsigned int r = src[6 * i + 2];
- unsigned int Y = ((RY*r + GY*g + BY*b)>>RGB2YUV_SHIFT) + 16;
+ unsigned int Y = ((RY * r + GY * g + BY * b) >> RGB2YUV_SHIFT) + 16;
- ydst[2*i] = Y;
+ ydst[2 * i] = Y;
- b = src[6*i+3];
- g = src[6*i+4];
- r = src[6*i+5];
+ b = src[6 * i + 3];
+ g = src[6 * i + 4];
+ r = src[6 * i + 5];
- Y = ((RY*r + GY*g + BY*b)>>RGB2YUV_SHIFT) + 16;
- ydst[2*i+1] = Y;
+ Y = ((RY * r + GY * g + BY * b) >> RGB2YUV_SHIFT) + 16;
+ ydst[2 * i + 1] = Y;
}
udst += chromStride;
vdst += chromStride;
@@ -682,17 +689,16 @@ void rgb24toyv12_c(const uint8_t *src, uint8_t *ydst, uint8_t *udst,
}
static void interleaveBytes_c(const uint8_t *src1, const uint8_t *src2,
- uint8_t *dest, int width,
- int height, int src1Stride,
- int src2Stride, int dstStride)
+ uint8_t *dest, int width, int height,
+ int src1Stride, int src2Stride, int dstStride)
{
int h;
- for (h=0; h < height; h++) {
+ for (h = 0; h < height; h++) {
int w;
- for (w=0; w < width; w++) {
- dest[2*w+0] = src1[w];
- dest[2*w+1] = src2[w];
+ for (w = 0; w < width; w++) {
+ dest[2 * w + 0] = src1[w];
+ dest[2 * w + 1] = src2[w];
}
dest += dstStride;
src1 += src1Stride;
@@ -706,20 +712,21 @@ static inline void vu9_to_vu12_c(const uint8_t *src1, const uint8_t *src2,
int srcStride1, int srcStride2,
int dstStride1, int dstStride2)
{
- int y;
- int x,w,h;
- w=width/2; h=height/2;
- for (y=0;y<h;y++) {
- const uint8_t* s1=src1+srcStride1*(y>>1);
- uint8_t* d=dst1+dstStride1*y;
- x=0;
- for (;x<w;x++) d[2*x]=d[2*x+1]=s1[x];
+ int x, y;
+ int w = width / 2;
+ int h = height / 2;
+
+ for (y = 0; y < h; y++) {
+ const uint8_t *s1 = src1 + srcStride1 * (y >> 1);
+ uint8_t *d = dst1 + dstStride1 * y;
+ for (x = 0; x < w; x++)
+ d[2 * x] = d[2 * x + 1] = s1[x];
}
- for (y=0;y<h;y++) {
- const uint8_t* s2=src2+srcStride2*(y>>1);
- uint8_t* d=dst2+dstStride2*y;
- x=0;
- for (;x<w;x++) d[2*x]=d[2*x+1]=s2[x];
+ for (y = 0; y < h; y++) {
+ const uint8_t *s2 = src2 + srcStride2 * (y >> 1);
+ uint8_t *d = dst2 + dstStride2 * y;
+ for (x = 0; x < w; x++)
+ d[2 * x] = d[2 * x + 1] = s2[x];
}
}
@@ -729,37 +736,36 @@ static inline void yvu9_to_yuy2_c(const uint8_t *src1, const uint8_t *src2,
int srcStride1, int srcStride2,
int srcStride3, int dstStride)
{
- int x;
- int y,w,h;
- w=width/2; h=height;
- for (y=0;y<h;y++) {
- const uint8_t* yp=src1+srcStride1*y;
- const uint8_t* up=src2+srcStride2*(y>>2);
- const uint8_t* vp=src3+srcStride3*(y>>2);
- uint8_t* d=dst+dstStride*y;
- x=0;
- for (; x<w; x++) {
- const int x2 = x<<2;
- d[8*x+0] = yp[x2];
- d[8*x+1] = up[x];
- d[8*x+2] = yp[x2+1];
- d[8*x+3] = vp[x];
- d[8*x+4] = yp[x2+2];
- d[8*x+5] = up[x];
- d[8*x+6] = yp[x2+3];
- d[8*x+7] = vp[x];
+ int x, y;
+ int w = width / 2;
+ int h = height;
+
+ for (y = 0; y < h; y++) {
+ const uint8_t *yp = src1 + srcStride1 * y;
+ const uint8_t *up = src2 + srcStride2 * (y >> 2);
+ const uint8_t *vp = src3 + srcStride3 * (y >> 2);
+ uint8_t *d = dst + dstStride * y;
+ for (x = 0; x < w; x++) {
+ const int x2 = x << 2;
+ d[8 * x + 0] = yp[x2];
+ d[8 * x + 1] = up[x];
+ d[8 * x + 2] = yp[x2 + 1];
+ d[8 * x + 3] = vp[x];
+ d[8 * x + 4] = yp[x2 + 2];
+ d[8 * x + 5] = up[x];
+ d[8 * x + 6] = yp[x2 + 3];
+ d[8 * x + 7] = vp[x];
}
}
}
static void extract_even_c(const uint8_t *src, uint8_t *dst, int count)
{
- dst += count;
- src += 2*count;
- count= - count;
-
- while(count<0) {
- dst[count]= src[2*count];
+ dst += count;
+ src += count * 2;
+ count = -count;
+ while (count < 0) {
+ dst[count] = src[2 * count];
count++;
}
}
@@ -767,13 +773,13 @@ static void extract_even_c(const uint8_t *src, uint8_t *dst, int count)
static void extract_even2_c(const uint8_t *src, uint8_t *dst0, uint8_t *dst1,
int count)
{
- dst0+= count;
- dst1+= count;
- src += 4*count;
- count= - count;
- while(count<0) {
- dst0[count]= src[4*count+0];
- dst1[count]= src[4*count+2];
+ dst0 += count;
+ dst1 += count;
+ src += count * 4;
+ count = -count;
+ while (count < 0) {
+ dst0[count] = src[4 * count + 0];
+ dst1[count] = src[4 * count + 2];
count++;
}
}
@@ -781,14 +787,14 @@ static void extract_even2_c(const uint8_t *src, uint8_t *dst0, uint8_t *dst1,
static void extract_even2avg_c(const uint8_t *src0, const uint8_t *src1,
uint8_t *dst0, uint8_t *dst1, int count)
{
- dst0 += count;
- dst1 += count;
- src0 += 4*count;
- src1 += 4*count;
- count= - count;
- while(count<0) {
- dst0[count]= (src0[4*count+0]+src1[4*count+0])>>1;
- dst1[count]= (src0[4*count+2]+src1[4*count+2])>>1;
+ dst0 += count;
+ dst1 += count;
+ src0 += count * 4;
+ src1 += count * 4;
+ count = -count;
+ while (count < 0) {
+ dst0[count] = (src0[4 * count + 0] + src1[4 * count + 0]) >> 1;
+ dst1[count] = (src0[4 * count + 2] + src1[4 * count + 2]) >> 1;
count++;
}
}
@@ -796,14 +802,14 @@ static void extract_even2avg_c(const uint8_t *src0, const uint8_t *src1,
static void extract_odd2_c(const uint8_t *src, uint8_t *dst0, uint8_t *dst1,
int count)
{
- dst0+= count;
- dst1+= count;
- src += 4*count;
- count= - count;
+ dst0 += count;
+ dst1 += count;
+ src += count * 4;
+ count = -count;
src++;
- while(count<0) {
- dst0[count]= src[4*count+0];
- dst1[count]= src[4*count+2];
+ while (count < 0) {
+ dst0[count] = src[4 * count + 0];
+ dst1[count] = src[4 * count + 2];
count++;
}
}
@@ -811,16 +817,16 @@ static void extract_odd2_c(const uint8_t *src, uint8_t *dst0, uint8_t *dst1,
static void extract_odd2avg_c(const uint8_t *src0, const uint8_t *src1,
uint8_t *dst0, uint8_t *dst1, int count)
{
- dst0 += count;
- dst1 += count;
- src0 += 4*count;
- src1 += 4*count;
- count= - count;
+ dst0 += count;
+ dst1 += count;
+ src0 += count * 4;
+ src1 += count * 4;
+ count = -count;
src0++;
src1++;
- while(count<0) {
- dst0[count]= (src0[4*count+0]+src1[4*count+0])>>1;
- dst1[count]= (src0[4*count+2]+src1[4*count+2])>>1;
+ while (count < 0) {
+ dst0[count] = (src0[4 * count + 0] + src1[4 * count + 0]) >> 1;
+ dst1[count] = (src0[4 * count + 2] + src1[4 * count + 2]) >> 1;
count++;
}
}
@@ -830,18 +836,18 @@ static void yuyvtoyuv420_c(uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
int lumStride, int chromStride, int srcStride)
{
int y;
- const int chromWidth= -((-width)>>1);
+ const int chromWidth = -((-width) >> 1);
- for (y=0; y<height; y++) {
+ for (y = 0; y < height; y++) {
extract_even_c(src, ydst, width);
- if(y&1) {
+ if (y & 1) {
extract_odd2avg_c(src - srcStride, src, udst, vdst, chromWidth);
- udst+= chromStride;
- vdst+= chromStride;
+ udst += chromStride;
+ vdst += chromStride;
}
- src += srcStride;
- ydst+= lumStride;
+ src += srcStride;
+ ydst += lumStride;
}
}
@@ -850,16 +856,16 @@ static void yuyvtoyuv422_c(uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
int lumStride, int chromStride, int srcStride)
{
int y;
- const int chromWidth= -((-width)>>1);
+ const int chromWidth = -((-width) >> 1);
- for (y=0; y<height; y++) {
+ for (y = 0; y < height; y++) {
extract_even_c(src, ydst, width);
extract_odd2_c(src, udst, vdst, chromWidth);
- src += srcStride;
- ydst+= lumStride;
- udst+= chromStride;
- vdst+= chromStride;
+ src += srcStride;
+ ydst += lumStride;
+ udst += chromStride;
+ vdst += chromStride;
}
}
@@ -868,18 +874,18 @@ static void uyvytoyuv420_c(uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
int lumStride, int chromStride, int srcStride)
{
int y;
- const int chromWidth= -((-width)>>1);
+ const int chromWidth = -((-width) >> 1);
- for (y=0; y<height; y++) {
+ for (y = 0; y < height; y++) {
extract_even_c(src + 1, ydst, width);
- if(y&1) {
+ if (y & 1) {
extract_even2avg_c(src - srcStride, src, udst, vdst, chromWidth);
- udst+= chromStride;
- vdst+= chromStride;
+ udst += chromStride;
+ vdst += chromStride;
}
- src += srcStride;
- ydst+= lumStride;
+ src += srcStride;
+ ydst += lumStride;
}
}
@@ -888,16 +894,16 @@ static void uyvytoyuv422_c(uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
int lumStride, int chromStride, int srcStride)
{
int y;
- const int chromWidth= -((-width)>>1);
+ const int chromWidth = -((-width) >> 1);
- for (y=0; y<height; y++) {
+ for (y = 0; y < height; y++) {
extract_even_c(src + 1, ydst, width);
extract_even2_c(src, udst, vdst, chromWidth);
- src += srcStride;
- ydst+= lumStride;
- udst+= chromStride;
- vdst+= chromStride;
+ src += srcStride;
+ ydst += lumStride;
+ udst += chromStride;
+ vdst += chromStride;
}
}
diff --git a/gst-libs/ext/libav/libswscale/sparc/Makefile b/gst-libs/ext/libav/libswscale/sparc/Makefile
new file mode 100644
index 0000000..2351ba4
--- /dev/null
+++ b/gst-libs/ext/libav/libswscale/sparc/Makefile
@@ -0,0 +1 @@
+VIS-OBJS += sparc/yuv2rgb_vis.o \
diff --git a/gst-libs/ext/libav/libswscale/sparc/yuv2rgb_vis.c b/gst-libs/ext/libav/libswscale/sparc/yuv2rgb_vis.c
index 2111ea8..cd8a8b0 100644
--- a/gst-libs/ext/libav/libswscale/sparc/yuv2rgb_vis.c
+++ b/gst-libs/ext/libav/libswscale/sparc/yuv2rgb_vis.c
@@ -22,152 +22,152 @@
#include <inttypes.h>
#include <stdlib.h>
+#include "libavutil/attributes.h"
#include "libswscale/swscale.h"
#include "libswscale/swscale_internal.h"
-#define YUV2RGB_INIT \
- "wr %%g0, 0x10, %%gsr \n\t" \
- "ldd [%5], %%f32 \n\t" \
- "ldd [%5+8], %%f34 \n\t" \
- "ldd [%5+16], %%f36 \n\t" \
- "ldd [%5+24], %%f38 \n\t" \
- "ldd [%5+32], %%f40 \n\t" \
- "ldd [%5+40], %%f42 \n\t" \
- "ldd [%5+48], %%f44 \n\t" \
- "ldd [%5+56], %%f46 \n\t" \
- "ldd [%5+64], %%f48 \n\t" \
- "ldd [%5+72], %%f50 \n\t"
-
-#define YUV2RGB_KERNEL \
- /* ^^^^ f0=Y f3=u f5=v */ \
- "fmul8x16 %%f3, %%f48, %%f6 \n\t" \
- "fmul8x16 %%f19, %%f48, %%f22 \n\t" \
- "fmul8x16 %%f5, %%f44, %%f8 \n\t" \
- "fmul8x16 %%f21, %%f44, %%f24 \n\t" \
- "fmul8x16 %%f0, %%f42, %%f0 \n\t" \
- "fmul8x16 %%f16, %%f42, %%f16 \n\t" \
- "fmul8x16 %%f3, %%f50, %%f2 \n\t" \
- "fmul8x16 %%f19, %%f50, %%f18 \n\t" \
- "fmul8x16 %%f5, %%f46, %%f4 \n\t" \
- "fmul8x16 %%f21, %%f46, %%f20 \n\t" \
- \
- "fpsub16 %%f6, %%f34, %%f6 \n\t" /* 1 */ \
- "fpsub16 %%f22, %%f34, %%f22 \n\t" /* 1 */ \
- "fpsub16 %%f8, %%f38, %%f8 \n\t" /* 3 */ \
- "fpsub16 %%f24, %%f38, %%f24 \n\t" /* 3 */ \
- "fpsub16 %%f0, %%f32, %%f0 \n\t" /* 0 */ \
- "fpsub16 %%f16, %%f32, %%f16 \n\t" /* 0 */ \
- "fpsub16 %%f2, %%f36, %%f2 \n\t" /* 2 */ \
- "fpsub16 %%f18, %%f36, %%f18 \n\t" /* 2 */ \
- "fpsub16 %%f4, %%f40, %%f4 \n\t" /* 4 */ \
- "fpsub16 %%f20, %%f40, %%f20 \n\t" /* 4 */ \
- \
- "fpadd16 %%f0, %%f8, %%f8 \n\t" /* Gt */ \
- "fpadd16 %%f16, %%f24, %%f24 \n\t" /* Gt */ \
- "fpadd16 %%f0, %%f4, %%f4 \n\t" /* R */ \
- "fpadd16 %%f16, %%f20, %%f20 \n\t" /* R */ \
- "fpadd16 %%f0, %%f6, %%f6 \n\t" /* B */ \
- "fpadd16 %%f16, %%f22, %%f22 \n\t" /* B */ \
- "fpadd16 %%f8, %%f2, %%f2 \n\t" /* G */ \
- "fpadd16 %%f24, %%f18, %%f18 \n\t" /* G */ \
- \
- "fpack16 %%f4, %%f4 \n\t" \
- "fpack16 %%f20, %%f20 \n\t" \
- "fpack16 %%f6, %%f6 \n\t" \
- "fpack16 %%f22, %%f22 \n\t" \
- "fpack16 %%f2, %%f2 \n\t" \
- "fpack16 %%f18, %%f18 \n\t"
-
-
+#define YUV2RGB_INIT \
+ "wr %%g0, 0x10, %%gsr \n\t" \
+ "ldd [%5], %%f32 \n\t" \
+ "ldd [%5 + 8], %%f34 \n\t" \
+ "ldd [%5 + 16], %%f36 \n\t" \
+ "ldd [%5 + 24], %%f38 \n\t" \
+ "ldd [%5 + 32], %%f40 \n\t" \
+ "ldd [%5 + 40], %%f42 \n\t" \
+ "ldd [%5 + 48], %%f44 \n\t" \
+ "ldd [%5 + 56], %%f46 \n\t" \
+ "ldd [%5 + 64], %%f48 \n\t" \
+ "ldd [%5 + 72], %%f50 \n\t"
+
+#define YUV2RGB_KERNEL \
+ /* ^^^^ f0=Y f3=u f5=v */ \
+ "fmul8x16 %%f3, %%f48, %%f6 \n\t" \
+ "fmul8x16 %%f19, %%f48, %%f22 \n\t" \
+ "fmul8x16 %%f5, %%f44, %%f8 \n\t" \
+ "fmul8x16 %%f21, %%f44, %%f24 \n\t" \
+ "fmul8x16 %%f0, %%f42, %%f0 \n\t" \
+ "fmul8x16 %%f16, %%f42, %%f16 \n\t" \
+ "fmul8x16 %%f3, %%f50, %%f2 \n\t" \
+ "fmul8x16 %%f19, %%f50, %%f18 \n\t" \
+ "fmul8x16 %%f5, %%f46, %%f4 \n\t" \
+ "fmul8x16 %%f21, %%f46, %%f20 \n\t" \
+ \
+ "fpsub16 %%f6, %%f34, %%f6 \n\t" /* 1 */ \
+ "fpsub16 %%f22, %%f34, %%f22 \n\t" /* 1 */ \
+ "fpsub16 %%f8, %%f38, %%f8 \n\t" /* 3 */ \
+ "fpsub16 %%f24, %%f38, %%f24 \n\t" /* 3 */ \
+ "fpsub16 %%f0, %%f32, %%f0 \n\t" /* 0 */ \
+ "fpsub16 %%f16, %%f32, %%f16 \n\t" /* 0 */ \
+ "fpsub16 %%f2, %%f36, %%f2 \n\t" /* 2 */ \
+ "fpsub16 %%f18, %%f36, %%f18 \n\t" /* 2 */ \
+ "fpsub16 %%f4, %%f40, %%f4 \n\t" /* 4 */ \
+ "fpsub16 %%f20, %%f40, %%f20 \n\t" /* 4 */ \
+ \
+ "fpadd16 %%f0, %%f8, %%f8 \n\t" /* Gt */ \
+ "fpadd16 %%f16, %%f24, %%f24 \n\t" /* Gt */ \
+ "fpadd16 %%f0, %%f4, %%f4 \n\t" /* R */ \
+ "fpadd16 %%f16, %%f20, %%f20 \n\t" /* R */ \
+ "fpadd16 %%f0, %%f6, %%f6 \n\t" /* B */ \
+ "fpadd16 %%f16, %%f22, %%f22 \n\t" /* B */ \
+ "fpadd16 %%f8, %%f2, %%f2 \n\t" /* G */ \
+ "fpadd16 %%f24, %%f18, %%f18 \n\t" /* G */ \
+ \
+ "fpack16 %%f4, %%f4 \n\t" \
+ "fpack16 %%f20, %%f20 \n\t" \
+ "fpack16 %%f6, %%f6 \n\t" \
+ "fpack16 %%f22, %%f22 \n\t" \
+ "fpack16 %%f2, %%f2 \n\t" \
+ "fpack16 %%f18, %%f18 \n\t"
// FIXME: must be changed to set alpha to 255 instead of 0
-static int vis_420P_ARGB32(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
- int srcSliceH, uint8_t* dst[], int dstStride[])
+static int vis_420P_ARGB32(SwsContext *c, uint8_t *src[], int srcStride[],
+ int srcSliceY, int srcSliceH,
+ uint8_t *dst[], int dstStride[])
{
int y, out1, out2, out3, out4, out5, out6;
- for(y=0;y < srcSliceH;++y) {
+ for (y = 0; y < srcSliceH; ++y)
__asm__ volatile (
YUV2RGB_INIT
- "wr %%g0, 0xd2, %%asi \n\t" /* ASI_FL16_P */
+ "wr %%g0, 0xd2, %%asi \n\t" /* ASI_FL16_P */
"1: \n\t"
- "ldda [%1] %%asi, %%f2 \n\t"
- "ldda [%1+2] %%asi, %%f18 \n\t"
- "ldda [%2] %%asi, %%f4 \n\t"
- "ldda [%2+2] %%asi, %%f20 \n\t"
+ "ldda [%1] %%asi, %%f2 \n\t"
+ "ldda [%1 + 2] %%asi, %%f18 \n\t"
+ "ldda [%2] %%asi, %%f4 \n\t"
+ "ldda [%2 + 2] %%asi, %%f20 \n\t"
"ld [%0], %%f0 \n\t"
"ld [%0+4], %%f16 \n\t"
- "fpmerge %%f3, %%f3, %%f2 \n\t"
+ "fpmerge %%f3, %%f3, %%f2 \n\t"
"fpmerge %%f19, %%f19, %%f18 \n\t"
- "fpmerge %%f5, %%f5, %%f4 \n\t"
+ "fpmerge %%f5, %%f5, %%f4 \n\t"
"fpmerge %%f21, %%f21, %%f20 \n\t"
YUV2RGB_KERNEL
"fzero %%f0 \n\t"
- "fpmerge %%f4, %%f6, %%f8 \n\t" // r,b,t1
- "fpmerge %%f20, %%f22, %%f24 \n\t" // r,b,t1
- "fpmerge %%f0, %%f2, %%f10 \n\t" // 0,g,t2
- "fpmerge %%f0, %%f18, %%f26 \n\t" // 0,g,t2
- "fpmerge %%f10, %%f8, %%f4 \n\t" // t2,t1,msb
- "fpmerge %%f26, %%f24, %%f20 \n\t" // t2,t1,msb
- "fpmerge %%f11, %%f9, %%f6 \n\t" // t2,t1,lsb
- "fpmerge %%f27, %%f25, %%f22 \n\t" // t2,t1,lsb
- "std %%f4, [%3] \n\t"
- "std %%f20, [%3+16] \n\t"
- "std %%f6, [%3+8] \n\t"
- "std %%f22, [%3+24] \n\t"
+ "fpmerge %%f4, %%f6, %%f8 \n\t" // r, b, t1
+ "fpmerge %%f20, %%f22, %%f24 \n\t" // r, b, t1
+ "fpmerge %%f0, %%f2, %%f10 \n\t" // 0, g, t2
+ "fpmerge %%f0, %%f18, %%f26 \n\t" // 0, g, t2
+ "fpmerge %%f10, %%f8, %%f4 \n\t" // t2, t1, msb
+ "fpmerge %%f26, %%f24, %%f20 \n\t" // t2, t1, msb
+ "fpmerge %%f11, %%f9, %%f6 \n\t" // t2, t1, lsb
+ "fpmerge %%f27, %%f25, %%f22 \n\t" // t2, t1, lsb
+ "std %%f4, [%3] \n\t"
+ "std %%f20, [%3 + 16] \n\t"
+ "std %%f6, [%3 + 8] \n\t"
+ "std %%f22, [%3 + 24] \n\t"
"add %0, 8, %0 \n\t"
"add %1, 4, %1 \n\t"
"add %2, 4, %2 \n\t"
"subcc %4, 8, %4 \n\t"
"bne 1b \n\t"
- "add %3, 32, %3 \n\t" //delay slot
+ "add %3, 32, %3 \n\t" // delay slot
: "=r" (out1), "=r" (out2), "=r" (out3), "=r" (out4), "=r" (out5), "=r" (out6)
- : "0" (src[0]+(y+srcSliceY)*srcStride[0]), "1" (src[1]+((y+srcSliceY)>>1)*srcStride[1]),
- "2" (src[2]+((y+srcSliceY)>>1)*srcStride[2]), "3" (dst[0]+(y+srcSliceY)*dstStride[0]),
- "4" (c->dstW),
- "5" (c->sparc_coeffs)
- );
- }
+ : "0" (src[0] + (y + srcSliceY) * srcStride[0]), "1" (src[1] + ((y + srcSliceY) >> 1) * srcStride[1]),
+ "2" (src[2] + ((y + srcSliceY) >> 1) * srcStride[2]), "3" (dst[0] + (y + srcSliceY) * dstStride[0]),
+ "4" (c->dstW),
+ "5" (c->sparc_coeffs)
+ );
return srcSliceH;
}
// FIXME: must be changed to set alpha to 255 instead of 0
-static int vis_422P_ARGB32(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
- int srcSliceH, uint8_t* dst[], int dstStride[])
+static int vis_422P_ARGB32(SwsContext *c, uint8_t *src[], int srcStride[],
+ int srcSliceY, int srcSliceH,
+ uint8_t *dst[], int dstStride[])
{
int y, out1, out2, out3, out4, out5, out6;
- for(y=0;y < srcSliceH;++y) {
+ for (y = 0; y < srcSliceH; ++y)
__asm__ volatile (
YUV2RGB_INIT
"wr %%g0, 0xd2, %%asi \n\t" /* ASI_FL16_P */
"1: \n\t"
- "ldda [%1] %%asi, %%f2 \n\t"
- "ldda [%1+2] %%asi, %%f18 \n\t"
- "ldda [%2] %%asi, %%f4 \n\t"
- "ldda [%2+2] %%asi, %%f20 \n\t"
- "ld [%0], %%f0 \n\t"
- "ld [%0+4], %%f16 \n\t"
- "fpmerge %%f3, %%f3, %%f2 \n\t"
+ "ldda [%1] %%asi, %%f2 \n\t"
+ "ldda [%1 + 2] %%asi, %%f18 \n\t"
+ "ldda [%2] %%asi, %%f4 \n\t"
+ "ldda [%2 + 2] %%asi, %%f20 \n\t"
+ "ld [%0], %%f0 \n\t"
+ "ld [%0 + 4], %%f16 \n\t"
+ "fpmerge %%f3, %%f3, %%f2 \n\t"
"fpmerge %%f19, %%f19, %%f18 \n\t"
- "fpmerge %%f5, %%f5, %%f4 \n\t"
+ "fpmerge %%f5, %%f5, %%f4 \n\t"
"fpmerge %%f21, %%f21, %%f20 \n\t"
YUV2RGB_KERNEL
"fzero %%f0 \n\t"
- "fpmerge %%f4, %%f6, %%f8 \n\t" // r,b,t1
+ "fpmerge %%f4, %%f6, %%f8 \n\t" // r,b,t1
"fpmerge %%f20, %%f22, %%f24 \n\t" // r,b,t1
- "fpmerge %%f0, %%f2, %%f10 \n\t" // 0,g,t2
- "fpmerge %%f0, %%f18, %%f26 \n\t" // 0,g,t2
- "fpmerge %%f10, %%f8, %%f4 \n\t" // t2,t1,msb
+ "fpmerge %%f0, %%f2, %%f10 \n\t" // 0,g,t2
+ "fpmerge %%f0, %%f18, %%f26 \n\t" // 0,g,t2
+ "fpmerge %%f10, %%f8, %%f4 \n\t" // t2,t1,msb
"fpmerge %%f26, %%f24, %%f20 \n\t" // t2,t1,msb
- "fpmerge %%f11, %%f9, %%f6 \n\t" // t2,t1,lsb
+ "fpmerge %%f11, %%f9, %%f6 \n\t" // t2,t1,lsb
"fpmerge %%f27, %%f25, %%f22 \n\t" // t2,t1,lsb
- "std %%f4, [%3] \n\t"
- "std %%f20, [%3+16] \n\t"
- "std %%f6, [%3+8] \n\t"
- "std %%f22, [%3+24] \n\t"
+ "std %%f4, [%3] \n\t"
+ "std %%f20, [%3 + 16] \n\t"
+ "std %%f6, [%3 + 8] \n\t"
+ "std %%f22, [%3 + 24] \n\t"
"add %0, 8, %0 \n\t"
"add %1, 4, %1 \n\t"
@@ -176,36 +176,36 @@ static int vis_422P_ARGB32(SwsContext *c, uint8_t* src[], int srcStride[], int s
"bne 1b \n\t"
"add %3, 32, %3 \n\t" //delay slot
: "=r" (out1), "=r" (out2), "=r" (out3), "=r" (out4), "=r" (out5), "=r" (out6)
- : "0" (src[0]+(y+srcSliceY)*srcStride[0]), "1" (src[1]+(y+srcSliceY)*srcStride[1]),
- "2" (src[2]+(y+srcSliceY)*srcStride[2]), "3" (dst[0]+(y+srcSliceY)*dstStride[0]),
- "4" (c->dstW),
- "5" (c->sparc_coeffs)
- );
- }
+ : "0" (src[0] + (y + srcSliceY) * srcStride[0]), "1" (src[1] + (y + srcSliceY) * srcStride[1]),
+ "2" (src[2] + (y + srcSliceY) * srcStride[2]), "3" (dst[0] + (y + srcSliceY) * dstStride[0]),
+ "4" (c->dstW),
+ "5" (c->sparc_coeffs)
+ );
return srcSliceH;
}
-SwsFunc ff_yuv2rgb_init_vis(SwsContext *c)
+av_cold SwsFunc ff_yuv2rgb_init_vis(SwsContext *c)
{
- c->sparc_coeffs[5]=c->yCoeff;
- c->sparc_coeffs[6]=c->vgCoeff;
- c->sparc_coeffs[7]=c->vrCoeff;
- c->sparc_coeffs[8]=c->ubCoeff;
- c->sparc_coeffs[9]=c->ugCoeff;
-
- c->sparc_coeffs[0]=(((int16_t)c->yOffset*(int16_t)c->yCoeff >>11) & 0xffff) * 0x0001000100010001ULL;
- c->sparc_coeffs[1]=(((int16_t)c->uOffset*(int16_t)c->ubCoeff>>11) & 0xffff) * 0x0001000100010001ULL;
- c->sparc_coeffs[2]=(((int16_t)c->uOffset*(int16_t)c->ugCoeff>>11) & 0xffff) * 0x0001000100010001ULL;
- c->sparc_coeffs[3]=(((int16_t)c->vOffset*(int16_t)c->vgCoeff>>11) & 0xffff) * 0x0001000100010001ULL;
- c->sparc_coeffs[4]=(((int16_t)c->vOffset*(int16_t)c->vrCoeff>>11) & 0xffff) * 0x0001000100010001ULL;
-
- if (c->dstFormat == PIX_FMT_RGB32 && c->srcFormat == PIX_FMT_YUV422P && (c->dstW & 7)==0) {
- av_log(c, AV_LOG_INFO, "SPARC VIS accelerated YUV422P -> RGB32 (WARNING: alpha value is wrong)\n");
+ c->sparc_coeffs[5] = c->yCoeff;
+ c->sparc_coeffs[6] = c->vgCoeff;
+ c->sparc_coeffs[7] = c->vrCoeff;
+ c->sparc_coeffs[8] = c->ubCoeff;
+ c->sparc_coeffs[9] = c->ugCoeff;
+
+ c->sparc_coeffs[0] = (((int16_t)c->yOffset * (int16_t)c->yCoeff >> 11) & 0xffff) * 0x0001000100010001ULL;
+ c->sparc_coeffs[1] = (((int16_t)c->uOffset * (int16_t)c->ubCoeff >> 11) & 0xffff) * 0x0001000100010001ULL;
+ c->sparc_coeffs[2] = (((int16_t)c->uOffset * (int16_t)c->ugCoeff >> 11) & 0xffff) * 0x0001000100010001ULL;
+ c->sparc_coeffs[3] = (((int16_t)c->vOffset * (int16_t)c->vgCoeff >> 11) & 0xffff) * 0x0001000100010001ULL;
+ c->sparc_coeffs[4] = (((int16_t)c->vOffset * (int16_t)c->vrCoeff >> 11) & 0xffff) * 0x0001000100010001ULL;
+
+ if (c->dstFormat == AV_PIX_FMT_RGB32 && c->srcFormat == AV_PIX_FMT_YUV422P && (c->dstW & 7) == 0) {
+ av_log(c, AV_LOG_INFO,
+ "SPARC VIS accelerated YUV422P -> RGB32 (WARNING: alpha value is wrong)\n");
return vis_422P_ARGB32;
- }
- else if (c->dstFormat == PIX_FMT_RGB32 && c->srcFormat == PIX_FMT_YUV420P && (c->dstW & 7)==0) {
- av_log(c, AV_LOG_INFO, "SPARC VIS accelerated YUV420P -> RGB32 (WARNING: alpha value is wrong)\n");
+ } else if (c->dstFormat == AV_PIX_FMT_RGB32 && c->srcFormat == AV_PIX_FMT_YUV420P && (c->dstW & 7) == 0) {
+ av_log(c, AV_LOG_INFO,
+ "SPARC VIS accelerated YUV420P -> RGB32 (WARNING: alpha value is wrong)\n");
return vis_420P_ARGB32;
}
return NULL;
diff --git a/gst-libs/ext/libav/libswscale/swscale-test.c b/gst-libs/ext/libav/libswscale/swscale-test.c
index 3497dff..12fa9ed 100644
--- a/gst-libs/ext/libav/libswscale/swscale-test.c
+++ b/gst-libs/ext/libav/libswscale/swscale-test.c
@@ -36,20 +36,20 @@
/* HACK Duplicated from swscale_internal.h.
* Should be removed when a cleaner pixel format system exists. */
#define isGray(x) \
- ((x) == PIX_FMT_GRAY8 || \
- (x) == PIX_FMT_Y400A || \
- (x) == PIX_FMT_GRAY16BE || \
- (x) == PIX_FMT_GRAY16LE)
+ ((x) == AV_PIX_FMT_GRAY8 || \
+ (x) == AV_PIX_FMT_Y400A || \
+ (x) == AV_PIX_FMT_GRAY16BE || \
+ (x) == AV_PIX_FMT_GRAY16LE)
#define hasChroma(x) \
(!(isGray(x) || \
- (x) == PIX_FMT_MONOBLACK || \
- (x) == PIX_FMT_MONOWHITE))
+ (x) == AV_PIX_FMT_MONOBLACK || \
+ (x) == AV_PIX_FMT_MONOWHITE))
#define isALPHA(x) \
- ((x) == PIX_FMT_BGR32 || \
- (x) == PIX_FMT_BGR32_1 || \
- (x) == PIX_FMT_RGB32 || \
- (x) == PIX_FMT_RGB32_1 || \
- (x) == PIX_FMT_YUVA420P)
+ ((x) == AV_PIX_FMT_BGR32 || \
+ (x) == AV_PIX_FMT_BGR32_1 || \
+ (x) == AV_PIX_FMT_RGB32 || \
+ (x) == AV_PIX_FMT_RGB32_1 || \
+ (x) == AV_PIX_FMT_YUVA420P)
static uint64_t getSSD(uint8_t *src1, uint8_t *src2, int stride1,
int stride2, int w, int h)
@@ -77,11 +77,14 @@ struct Results {
// test by ref -> src -> dst -> out & compare out against ref
// ref & out are YV12
static int doTest(uint8_t *ref[4], int refStride[4], int w, int h,
- enum PixelFormat srcFormat, enum PixelFormat dstFormat,
+ enum AVPixelFormat srcFormat, enum AVPixelFormat dstFormat,
int srcW, int srcH, int dstW, int dstH, int flags,
struct Results *r)
{
- static enum PixelFormat cur_srcFormat;
+ const AVPixFmtDescriptor *desc_yuva420p = av_pix_fmt_desc_get(AV_PIX_FMT_YUVA420P);
+ const AVPixFmtDescriptor *desc_src = av_pix_fmt_desc_get(srcFormat);
+ const AVPixFmtDescriptor *desc_dst = av_pix_fmt_desc_get(dstFormat);
+ static enum AVPixelFormat cur_srcFormat;
static int cur_srcW, cur_srcH;
static uint8_t *src[4];
static int srcStride[4];
@@ -111,12 +114,12 @@ static int doTest(uint8_t *ref[4], int refStride[4], int w, int h,
goto end;
}
}
- srcContext = sws_getContext(w, h, PIX_FMT_YUVA420P, srcW, srcH,
+ srcContext = sws_getContext(w, h, AV_PIX_FMT_YUVA420P, srcW, srcH,
srcFormat, SWS_BILINEAR, NULL, NULL, NULL);
if (!srcContext) {
fprintf(stderr, "Failed to get %s ---> %s\n",
- av_pix_fmt_descriptors[PIX_FMT_YUVA420P].name,
- av_pix_fmt_descriptors[srcFormat].name);
+ desc_yuva420p->name,
+ desc_src->name);
res = -1;
goto end;
}
@@ -150,15 +153,14 @@ static int doTest(uint8_t *ref[4], int refStride[4], int w, int h,
flags, NULL, NULL, NULL);
if (!dstContext) {
fprintf(stderr, "Failed to get %s ---> %s\n",
- av_pix_fmt_descriptors[srcFormat].name,
- av_pix_fmt_descriptors[dstFormat].name);
+ desc_src->name, desc_dst->name);
res = -1;
goto end;
}
printf(" %s %dx%d -> %s %3dx%3d flags=%2d",
- av_pix_fmt_descriptors[srcFormat].name, srcW, srcH,
- av_pix_fmt_descriptors[dstFormat].name, dstW, dstH,
+ desc_src->name, srcW, srcH,
+ desc_dst->name, dstW, dstH,
flags);
fflush(stdout);
@@ -184,12 +186,12 @@ static int doTest(uint8_t *ref[4], int refStride[4], int w, int h,
}
}
outContext = sws_getContext(dstW, dstH, dstFormat, w, h,
- PIX_FMT_YUVA420P, SWS_BILINEAR,
+ AV_PIX_FMT_YUVA420P, SWS_BILINEAR,
NULL, NULL, NULL);
if (!outContext) {
fprintf(stderr, "Failed to get %s ---> %s\n",
- av_pix_fmt_descriptors[dstFormat].name,
- av_pix_fmt_descriptors[PIX_FMT_YUVA420P].name);
+ desc_dst->name,
+ desc_yuva420p->name);
res = -1;
goto end;
}
@@ -232,8 +234,8 @@ end:
}
static void selfTest(uint8_t *ref[4], int refStride[4], int w, int h,
- enum PixelFormat srcFormat_in,
- enum PixelFormat dstFormat_in)
+ enum AVPixelFormat srcFormat_in,
+ enum AVPixelFormat dstFormat_in)
{
const int flags[] = { SWS_FAST_BILINEAR, SWS_BILINEAR, SWS_BICUBIC,
SWS_X, SWS_POINT, SWS_AREA, 0 };
@@ -241,16 +243,19 @@ static void selfTest(uint8_t *ref[4], int refStride[4], int w, int h,
const int srcH = h;
const int dstW[] = { srcW - srcW / 3, srcW, srcW + srcW / 3, 0 };
const int dstH[] = { srcH - srcH / 3, srcH, srcH + srcH / 3, 0 };
- enum PixelFormat srcFormat, dstFormat;
+ enum AVPixelFormat srcFormat, dstFormat;
+ const AVPixFmtDescriptor *desc_src, *desc_dst;
- for (srcFormat = srcFormat_in != PIX_FMT_NONE ? srcFormat_in : 0;
- srcFormat < PIX_FMT_NB; srcFormat++) {
+ for (srcFormat = srcFormat_in != AV_PIX_FMT_NONE ? srcFormat_in : 0;
+ srcFormat < AV_PIX_FMT_NB; srcFormat++) {
if (!sws_isSupportedInput(srcFormat) ||
!sws_isSupportedOutput(srcFormat))
continue;
- for (dstFormat = dstFormat_in != PIX_FMT_NONE ? dstFormat_in : 0;
- dstFormat < PIX_FMT_NB; dstFormat++) {
+ desc_src = av_pix_fmt_desc_get(srcFormat);
+
+ for (dstFormat = dstFormat_in != AV_PIX_FMT_NONE ? dstFormat_in : 0;
+ dstFormat < AV_PIX_FMT_NB; dstFormat++) {
int i, j, k;
int res = 0;
@@ -258,9 +263,9 @@ static void selfTest(uint8_t *ref[4], int refStride[4], int w, int h,
!sws_isSupportedOutput(dstFormat))
continue;
- printf("%s -> %s\n",
- av_pix_fmt_descriptors[srcFormat].name,
- av_pix_fmt_descriptors[dstFormat].name);
+ desc_dst = av_pix_fmt_desc_get(dstFormat);
+
+ printf("%s -> %s\n", desc_src->name, desc_dst->name);
fflush(stdout);
for (k = 0; flags[k] && !res; k++)
@@ -270,26 +275,26 @@ static void selfTest(uint8_t *ref[4], int refStride[4], int w, int h,
srcFormat, dstFormat,
srcW, srcH, dstW[i], dstH[j], flags[k],
NULL);
- if (dstFormat_in != PIX_FMT_NONE)
+ if (dstFormat_in != AV_PIX_FMT_NONE)
break;
}
- if (srcFormat_in != PIX_FMT_NONE)
+ if (srcFormat_in != AV_PIX_FMT_NONE)
break;
}
}
static int fileTest(uint8_t *ref[4], int refStride[4], int w, int h, FILE *fp,
- enum PixelFormat srcFormat_in,
- enum PixelFormat dstFormat_in)
+ enum AVPixelFormat srcFormat_in,
+ enum AVPixelFormat dstFormat_in)
{
char buf[256];
while (fgets(buf, sizeof(buf), fp)) {
struct Results r;
- enum PixelFormat srcFormat;
+ enum AVPixelFormat srcFormat;
char srcStr[12];
int srcW, srcH;
- enum PixelFormat dstFormat;
+ enum AVPixelFormat dstFormat;
char dstStr[12];
int dstW, dstH;
int flags;
@@ -308,12 +313,12 @@ static int fileTest(uint8_t *ref[4], int refStride[4], int w, int h, FILE *fp,
srcFormat = av_get_pix_fmt(srcStr);
dstFormat = av_get_pix_fmt(dstStr);
- if (srcFormat == PIX_FMT_NONE || dstFormat == PIX_FMT_NONE) {
+ if (srcFormat == AV_PIX_FMT_NONE || dstFormat == AV_PIX_FMT_NONE) {
fprintf(stderr, "malformed input file\n");
return -1;
}
- if ((srcFormat_in != PIX_FMT_NONE && srcFormat_in != srcFormat) ||
- (dstFormat_in != PIX_FMT_NONE && dstFormat_in != dstFormat))
+ if ((srcFormat_in != AV_PIX_FMT_NONE && srcFormat_in != srcFormat) ||
+ (dstFormat_in != AV_PIX_FMT_NONE && dstFormat_in != dstFormat))
continue;
if (ret != 12) {
printf("%s", buf);
@@ -334,8 +339,8 @@ static int fileTest(uint8_t *ref[4], int refStride[4], int w, int h, FILE *fp,
int main(int argc, char **argv)
{
- enum PixelFormat srcFormat = PIX_FMT_NONE;
- enum PixelFormat dstFormat = PIX_FMT_NONE;
+ enum AVPixelFormat srcFormat = AV_PIX_FMT_NONE;
+ enum AVPixelFormat dstFormat = AV_PIX_FMT_NONE;
uint8_t *rgb_data = av_malloc(W * H * 4);
uint8_t *rgb_src[4] = { rgb_data, NULL, NULL, NULL };
int rgb_stride[4] = { 4 * W, 0, 0, 0 };
@@ -351,8 +356,8 @@ int main(int argc, char **argv)
if (!rgb_data || !data)
return -1;
- sws = sws_getContext(W / 12, H / 12, PIX_FMT_RGB32, W, H,
- PIX_FMT_YUVA420P, SWS_BILINEAR, NULL, NULL, NULL);
+ sws = sws_getContext(W / 12, H / 12, AV_PIX_FMT_RGB32, W, H,
+ AV_PIX_FMT_YUVA420P, SWS_BILINEAR, NULL, NULL, NULL);
av_lfg_init(&rand, 1);
@@ -377,13 +382,13 @@ int main(int argc, char **argv)
goto end;
} else if (!strcmp(argv[i], "-src")) {
srcFormat = av_get_pix_fmt(argv[i + 1]);
- if (srcFormat == PIX_FMT_NONE) {
+ if (srcFormat == AV_PIX_FMT_NONE) {
fprintf(stderr, "invalid pixel format %s\n", argv[i + 1]);
return -1;
}
} else if (!strcmp(argv[i], "-dst")) {
dstFormat = av_get_pix_fmt(argv[i + 1]);
- if (dstFormat == PIX_FMT_NONE) {
+ if (dstFormat == AV_PIX_FMT_NONE) {
fprintf(stderr, "invalid pixel format %s\n", argv[i + 1]);
return -1;
}
diff --git a/gst-libs/ext/libav/libswscale/swscale.c b/gst-libs/ext/libav/libswscale/swscale.c
index 1d0ea1b..dac8b37 100644
--- a/gst-libs/ext/libav/libswscale/swscale.c
+++ b/gst-libs/ext/libav/libswscale/swscale.c
@@ -18,1874 +18,86 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <assert.h>
#include <inttypes.h>
-#include <string.h>
#include <math.h>
#include <stdio.h>
-#include "config.h"
-#include <assert.h>
-#include "swscale.h"
-#include "swscale_internal.h"
-#include "rgb2rgb.h"
-#include "libavutil/intreadwrite.h"
-#include "libavutil/cpu.h"
+#include <string.h>
+
#include "libavutil/avutil.h"
-#include "libavutil/mathematics.h"
#include "libavutil/bswap.h"
+#include "libavutil/cpu.h"
+#include "libavutil/intreadwrite.h"
+#include "libavutil/mathematics.h"
#include "libavutil/pixdesc.h"
+#include "config.h"
+#include "rgb2rgb.h"
+#include "swscale_internal.h"
+#include "swscale.h"
-#define DITHER1XBPP
-
-#define RGB2YUV_SHIFT 15
-#define BY ( (int)(0.114*219/255*(1<<RGB2YUV_SHIFT)+0.5))
-#define BV (-(int)(0.081*224/255*(1<<RGB2YUV_SHIFT)+0.5))
-#define BU ( (int)(0.500*224/255*(1<<RGB2YUV_SHIFT)+0.5))
-#define GY ( (int)(0.587*219/255*(1<<RGB2YUV_SHIFT)+0.5))
-#define GV (-(int)(0.419*224/255*(1<<RGB2YUV_SHIFT)+0.5))
-#define GU (-(int)(0.331*224/255*(1<<RGB2YUV_SHIFT)+0.5))
-#define RY ( (int)(0.299*219/255*(1<<RGB2YUV_SHIFT)+0.5))
-#define RV ( (int)(0.500*224/255*(1<<RGB2YUV_SHIFT)+0.5))
-#define RU (-(int)(0.169*224/255*(1<<RGB2YUV_SHIFT)+0.5))
-
-/*
-NOTES
-Special versions: fast Y 1:1 scaling (no interpolation in y direction)
-
-TODO
-more intelligent misalignment avoidance for the horizontal scaler
-write special vertical cubic upscale version
-optimize C code (YV12 / minmax)
-add support for packed pixel YUV input & output
-add support for Y8 output
-optimize BGR24 & BGR32
-add BGR4 output support
-write special BGR->BGR scaler
-*/
-
-DECLARE_ALIGNED(8, static const uint8_t, dither_2x2_4)[2][8]={
-{ 1, 3, 1, 3, 1, 3, 1, 3, },
-{ 2, 0, 2, 0, 2, 0, 2, 0, },
-};
-
-DECLARE_ALIGNED(8, static const uint8_t, dither_2x2_8)[2][8]={
-{ 6, 2, 6, 2, 6, 2, 6, 2, },
-{ 0, 4, 0, 4, 0, 4, 0, 4, },
-};
-
-DECLARE_ALIGNED(8, const uint8_t, dither_4x4_16)[4][8]={
-{ 8, 4, 11, 7, 8, 4, 11, 7, },
-{ 2, 14, 1, 13, 2, 14, 1, 13, },
-{ 10, 6, 9, 5, 10, 6, 9, 5, },
-{ 0, 12, 3, 15, 0, 12, 3, 15, },
-};
-
-DECLARE_ALIGNED(8, const uint8_t, dither_8x8_32)[8][8]={
-{ 17, 9, 23, 15, 16, 8, 22, 14, },
-{ 5, 29, 3, 27, 4, 28, 2, 26, },
-{ 21, 13, 19, 11, 20, 12, 18, 10, },
-{ 0, 24, 6, 30, 1, 25, 7, 31, },
-{ 16, 8, 22, 14, 17, 9, 23, 15, },
-{ 4, 28, 2, 26, 5, 29, 3, 27, },
-{ 20, 12, 18, 10, 21, 13, 19, 11, },
-{ 1, 25, 7, 31, 0, 24, 6, 30, },
-};
-
-DECLARE_ALIGNED(8, const uint8_t, dither_8x8_73)[8][8]={
-{ 0, 55, 14, 68, 3, 58, 17, 72, },
-{ 37, 18, 50, 32, 40, 22, 54, 35, },
-{ 9, 64, 5, 59, 13, 67, 8, 63, },
-{ 46, 27, 41, 23, 49, 31, 44, 26, },
-{ 2, 57, 16, 71, 1, 56, 15, 70, },
-{ 39, 21, 52, 34, 38, 19, 51, 33, },
-{ 11, 66, 7, 62, 10, 65, 6, 60, },
-{ 48, 30, 43, 25, 47, 29, 42, 24, },
-};
-
-#if 1
-DECLARE_ALIGNED(8, const uint8_t, dither_8x8_220)[8][8]={
-{117, 62, 158, 103, 113, 58, 155, 100, },
-{ 34, 199, 21, 186, 31, 196, 17, 182, },
-{144, 89, 131, 76, 141, 86, 127, 72, },
-{ 0, 165, 41, 206, 10, 175, 52, 217, },
-{110, 55, 151, 96, 120, 65, 162, 107, },
-{ 28, 193, 14, 179, 38, 203, 24, 189, },
-{138, 83, 124, 69, 148, 93, 134, 79, },
-{ 7, 172, 48, 213, 3, 168, 45, 210, },
-};
-#elif 1
-// tries to correct a gamma of 1.5
-DECLARE_ALIGNED(8, const uint8_t, dither_8x8_220)[8][8]={
-{ 0, 143, 18, 200, 2, 156, 25, 215, },
-{ 78, 28, 125, 64, 89, 36, 138, 74, },
-{ 10, 180, 3, 161, 16, 195, 8, 175, },
-{109, 51, 93, 38, 121, 60, 105, 47, },
-{ 1, 152, 23, 210, 0, 147, 20, 205, },
-{ 85, 33, 134, 71, 81, 30, 130, 67, },
-{ 14, 190, 6, 171, 12, 185, 5, 166, },
-{117, 57, 101, 44, 113, 54, 97, 41, },
-};
-#elif 1
-// tries to correct a gamma of 2.0
-DECLARE_ALIGNED(8, const uint8_t, dither_8x8_220)[8][8]={
-{ 0, 124, 8, 193, 0, 140, 12, 213, },
-{ 55, 14, 104, 42, 66, 19, 119, 52, },
-{ 3, 168, 1, 145, 6, 187, 3, 162, },
-{ 86, 31, 70, 21, 99, 39, 82, 28, },
-{ 0, 134, 11, 206, 0, 129, 9, 200, },
-{ 62, 17, 114, 48, 58, 16, 109, 45, },
-{ 5, 181, 2, 157, 4, 175, 1, 151, },
-{ 95, 36, 78, 26, 90, 34, 74, 24, },
-};
-#else
-// tries to correct a gamma of 2.5
-DECLARE_ALIGNED(8, const uint8_t, dither_8x8_220)[8][8]={
-{ 0, 107, 3, 187, 0, 125, 6, 212, },
-{ 39, 7, 86, 28, 49, 11, 102, 36, },
-{ 1, 158, 0, 131, 3, 180, 1, 151, },
-{ 68, 19, 52, 12, 81, 25, 64, 17, },
-{ 0, 119, 5, 203, 0, 113, 4, 195, },
-{ 45, 9, 96, 33, 42, 8, 91, 30, },
-{ 2, 172, 1, 144, 2, 165, 0, 137, },
-{ 77, 23, 60, 15, 72, 21, 56, 14, },
-};
-#endif
DECLARE_ALIGNED(8, const uint8_t, dither_8x8_128)[8][8] = {
-{ 36, 68, 60, 92, 34, 66, 58, 90,},
-{ 100, 4,124, 28, 98, 2,122, 26,},
-{ 52, 84, 44, 76, 50, 82, 42, 74,},
-{ 116, 20,108, 12,114, 18,106, 10,},
-{ 32, 64, 56, 88, 38, 70, 62, 94,},
-{ 96, 0,120, 24,102, 6,126, 30,},
-{ 48, 80, 40, 72, 54, 86, 46, 78,},
-{ 112, 16,104, 8,118, 22,110, 14,},
+ { 36, 68, 60, 92, 34, 66, 58, 90, },
+ { 100, 4, 124, 28, 98, 2, 122, 26, },
+ { 52, 84, 44, 76, 50, 82, 42, 74, },
+ { 116, 20, 108, 12, 114, 18, 106, 10, },
+ { 32, 64, 56, 88, 38, 70, 62, 94, },
+ { 96, 0, 120, 24, 102, 6, 126, 30, },
+ { 48, 80, 40, 72, 54, 86, 46, 78, },
+ { 112, 16, 104, 8, 118, 22, 110, 14, },
};
-DECLARE_ALIGNED(8, const uint8_t, ff_sws_pb_64)[8] =
-{ 64, 64, 64, 64, 64, 64, 64, 64 };
-
-#define output_pixel(pos, val, bias, signedness) \
- if (big_endian) { \
- AV_WB16(pos, bias + av_clip_ ## signedness ## 16(val >> shift)); \
- } else { \
- AV_WL16(pos, bias + av_clip_ ## signedness ## 16(val >> shift)); \
- }
-
-static av_always_inline void
-yuv2plane1_16_c_template(const int32_t *src, uint16_t *dest, int dstW,
- int big_endian, int output_bits)
-{
- int i;
- int shift = 19 - output_bits;
-
- for (i = 0; i < dstW; i++) {
- int val = src[i] + (1 << (shift - 1));
- output_pixel(&dest[i], val, 0, uint);
- }
-}
-
-static av_always_inline void
-yuv2planeX_16_c_template(const int16_t *filter, int filterSize,
- const int32_t **src, uint16_t *dest, int dstW,
- int big_endian, int output_bits)
-{
- int i;
- int shift = 15 + 16 - output_bits;
-
- for (i = 0; i < dstW; i++) {
- int val = 1 << (30-output_bits);
- int j;
-
- /* range of val is [0,0x7FFFFFFF], so 31 bits, but with lanczos/spline
- * filters (or anything with negative coeffs, the range can be slightly
- * wider in both directions. To account for this overflow, we subtract
- * a constant so it always fits in the signed range (assuming a
- * reasonable filterSize), and re-add that at the end. */
- val -= 0x40000000;
- for (j = 0; j < filterSize; j++)
- val += src[j][i] * filter[j];
-
- output_pixel(&dest[i], val, 0x8000, int);
- }
-}
-
-#undef output_pixel
-
-#define output_pixel(pos, val) \
- if (big_endian) { \
- AV_WB16(pos, av_clip_uintp2(val >> shift, output_bits)); \
- } else { \
- AV_WL16(pos, av_clip_uintp2(val >> shift, output_bits)); \
- }
-
-static av_always_inline void
-yuv2plane1_10_c_template(const int16_t *src, uint16_t *dest, int dstW,
- int big_endian, int output_bits)
-{
- int i;
- int shift = 15 - output_bits;
-
- for (i = 0; i < dstW; i++) {
- int val = src[i] + (1 << (shift - 1));
- output_pixel(&dest[i], val);
- }
-}
-
-static av_always_inline void
-yuv2planeX_10_c_template(const int16_t *filter, int filterSize,
- const int16_t **src, uint16_t *dest, int dstW,
- int big_endian, int output_bits)
-{
- int i;
- int shift = 11 + 16 - output_bits;
-
- for (i = 0; i < dstW; i++) {
- int val = 1 << (26-output_bits);
- int j;
-
- for (j = 0; j < filterSize; j++)
- val += src[j][i] * filter[j];
-
- output_pixel(&dest[i], val);
- }
-}
-
-#undef output_pixel
-
-#define yuv2NBPS(bits, BE_LE, is_be, template_size, typeX_t) \
-static void yuv2plane1_ ## bits ## BE_LE ## _c(const int16_t *src, \
- uint8_t *dest, int dstW, \
- const uint8_t *dither, int offset)\
-{ \
- yuv2plane1_ ## template_size ## _c_template((const typeX_t *) src, \
- (uint16_t *) dest, dstW, is_be, bits); \
-}\
-static void yuv2planeX_ ## bits ## BE_LE ## _c(const int16_t *filter, int filterSize, \
- const int16_t **src, uint8_t *dest, int dstW, \
- const uint8_t *dither, int offset)\
-{ \
- yuv2planeX_## template_size ## _c_template(filter, \
- filterSize, (const typeX_t **) src, \
- (uint16_t *) dest, dstW, is_be, bits); \
-}
-yuv2NBPS( 9, BE, 1, 10, int16_t)
-yuv2NBPS( 9, LE, 0, 10, int16_t)
-yuv2NBPS(10, BE, 1, 10, int16_t)
-yuv2NBPS(10, LE, 0, 10, int16_t)
-yuv2NBPS(16, BE, 1, 16, int32_t)
-yuv2NBPS(16, LE, 0, 16, int32_t)
-
-static void yuv2planeX_8_c(const int16_t *filter, int filterSize,
- const int16_t **src, uint8_t *dest, int dstW,
- const uint8_t *dither, int offset)
-{
- int i;
- for (i=0; i<dstW; i++) {
- int val = dither[(i + offset) & 7] << 12;
- int j;
- for (j=0; j<filterSize; j++)
- val += src[j][i] * filter[j];
-
- dest[i]= av_clip_uint8(val>>19);
- }
-}
-
-static void yuv2plane1_8_c(const int16_t *src, uint8_t *dest, int dstW,
- const uint8_t *dither, int offset)
-{
- int i;
- for (i=0; i<dstW; i++) {
- int val = (src[i] + dither[(i + offset) & 7]) >> 7;
- dest[i]= av_clip_uint8(val);
- }
-}
-
-static void yuv2nv12cX_c(SwsContext *c, const int16_t *chrFilter, int chrFilterSize,
- const int16_t **chrUSrc, const int16_t **chrVSrc,
- uint8_t *dest, int chrDstW)
-{
- enum PixelFormat dstFormat = c->dstFormat;
- const uint8_t *chrDither = c->chrDither8;
- int i;
-
- if (dstFormat == PIX_FMT_NV12)
- for (i=0; i<chrDstW; i++) {
- int u = chrDither[i & 7] << 12;
- int v = chrDither[(i + 3) & 7] << 12;
- int j;
- for (j=0; j<chrFilterSize; j++) {
- u += chrUSrc[j][i] * chrFilter[j];
- v += chrVSrc[j][i] * chrFilter[j];
- }
-
- dest[2*i]= av_clip_uint8(u>>19);
- dest[2*i+1]= av_clip_uint8(v>>19);
- }
- else
- for (i=0; i<chrDstW; i++) {
- int u = chrDither[i & 7] << 12;
- int v = chrDither[(i + 3) & 7] << 12;
- int j;
- for (j=0; j<chrFilterSize; j++) {
- u += chrUSrc[j][i] * chrFilter[j];
- v += chrVSrc[j][i] * chrFilter[j];
- }
-
- dest[2*i]= av_clip_uint8(v>>19);
- dest[2*i+1]= av_clip_uint8(u>>19);
- }
-}
-
-#define output_pixel(pos, val) \
- if (target == PIX_FMT_GRAY16BE) { \
- AV_WB16(pos, val); \
- } else { \
- AV_WL16(pos, val); \
- }
-
-static av_always_inline void
-yuv2gray16_X_c_template(SwsContext *c, const int16_t *lumFilter,
- const int32_t **lumSrc, int lumFilterSize,
- const int16_t *chrFilter, const int32_t **chrUSrc,
- const int32_t **chrVSrc, int chrFilterSize,
- const int32_t **alpSrc, uint16_t *dest, int dstW,
- int y, enum PixelFormat target)
-{
- int i;
-
- for (i = 0; i < (dstW >> 1); i++) {
- int j;
- int Y1 = (1 << 14) - 0x40000000;
- int Y2 = (1 << 14) - 0x40000000;
-
- for (j = 0; j < lumFilterSize; j++) {
- Y1 += lumSrc[j][i * 2] * lumFilter[j];
- Y2 += lumSrc[j][i * 2 + 1] * lumFilter[j];
- }
- Y1 >>= 15;
- Y2 >>= 15;
- Y1 = av_clip_int16(Y1);
- Y2 = av_clip_int16(Y2);
- output_pixel(&dest[i * 2 + 0], 0x8000 + Y1);
- output_pixel(&dest[i * 2 + 1], 0x8000 + Y2);
- }
-}
-
-static av_always_inline void
-yuv2gray16_2_c_template(SwsContext *c, const int32_t *buf[2],
- const int32_t *ubuf[2], const int32_t *vbuf[2],
- const int32_t *abuf[2], uint16_t *dest, int dstW,
- int yalpha, int uvalpha, int y,
- enum PixelFormat target)
-{
- int yalpha1 = 4095 - yalpha;
- int i;
- const int32_t *buf0 = buf[0], *buf1 = buf[1];
-
- for (i = 0; i < (dstW >> 1); i++) {
- int Y1 = (buf0[i * 2 ] * yalpha1 + buf1[i * 2 ] * yalpha) >> 15;
- int Y2 = (buf0[i * 2 + 1] * yalpha1 + buf1[i * 2 + 1] * yalpha) >> 15;
-
- output_pixel(&dest[i * 2 + 0], Y1);
- output_pixel(&dest[i * 2 + 1], Y2);
- }
-}
-
-static av_always_inline void
-yuv2gray16_1_c_template(SwsContext *c, const int32_t *buf0,
- const int32_t *ubuf[2], const int32_t *vbuf[2],
- const int32_t *abuf0, uint16_t *dest, int dstW,
- int uvalpha, int y, enum PixelFormat target)
-{
- int i;
-
- for (i = 0; i < (dstW >> 1); i++) {
- int Y1 = buf0[i * 2 ] << 1;
- int Y2 = buf0[i * 2 + 1] << 1;
-
- output_pixel(&dest[i * 2 + 0], Y1);
- output_pixel(&dest[i * 2 + 1], Y2);
- }
-}
-
-#undef output_pixel
-
-#define YUV2PACKED16WRAPPER(name, base, ext, fmt) \
-static void name ## ext ## _X_c(SwsContext *c, const int16_t *lumFilter, \
- const int16_t **_lumSrc, int lumFilterSize, \
- const int16_t *chrFilter, const int16_t **_chrUSrc, \
- const int16_t **_chrVSrc, int chrFilterSize, \
- const int16_t **_alpSrc, uint8_t *_dest, int dstW, \
- int y) \
-{ \
- const int32_t **lumSrc = (const int32_t **) _lumSrc, \
- **chrUSrc = (const int32_t **) _chrUSrc, \
- **chrVSrc = (const int32_t **) _chrVSrc, \
- **alpSrc = (const int32_t **) _alpSrc; \
- uint16_t *dest = (uint16_t *) _dest; \
- name ## base ## _X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
- chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
- alpSrc, dest, dstW, y, fmt); \
-} \
- \
-static void name ## ext ## _2_c(SwsContext *c, const int16_t *_buf[2], \
- const int16_t *_ubuf[2], const int16_t *_vbuf[2], \
- const int16_t *_abuf[2], uint8_t *_dest, int dstW, \
- int yalpha, int uvalpha, int y) \
-{ \
- const int32_t **buf = (const int32_t **) _buf, \
- **ubuf = (const int32_t **) _ubuf, \
- **vbuf = (const int32_t **) _vbuf, \
- **abuf = (const int32_t **) _abuf; \
- uint16_t *dest = (uint16_t *) _dest; \
- name ## base ## _2_c_template(c, buf, ubuf, vbuf, abuf, \
- dest, dstW, yalpha, uvalpha, y, fmt); \
-} \
- \
-static void name ## ext ## _1_c(SwsContext *c, const int16_t *_buf0, \
- const int16_t *_ubuf[2], const int16_t *_vbuf[2], \
- const int16_t *_abuf0, uint8_t *_dest, int dstW, \
- int uvalpha, int y) \
-{ \
- const int32_t *buf0 = (const int32_t *) _buf0, \
- **ubuf = (const int32_t **) _ubuf, \
- **vbuf = (const int32_t **) _vbuf, \
- *abuf0 = (const int32_t *) _abuf0; \
- uint16_t *dest = (uint16_t *) _dest; \
- name ## base ## _1_c_template(c, buf0, ubuf, vbuf, abuf0, dest, \
- dstW, uvalpha, y, fmt); \
-}
-
-YUV2PACKED16WRAPPER(yuv2gray16,, LE, PIX_FMT_GRAY16LE)
-YUV2PACKED16WRAPPER(yuv2gray16,, BE, PIX_FMT_GRAY16BE)
-
-#define output_pixel(pos, acc) \
- if (target == PIX_FMT_MONOBLACK) { \
- pos = acc; \
- } else { \
- pos = ~acc; \
- }
-
-static av_always_inline void
-yuv2mono_X_c_template(SwsContext *c, const int16_t *lumFilter,
- const int16_t **lumSrc, int lumFilterSize,
- const int16_t *chrFilter, const int16_t **chrUSrc,
- const int16_t **chrVSrc, int chrFilterSize,
- const int16_t **alpSrc, uint8_t *dest, int dstW,
- int y, enum PixelFormat target)
-{
- const uint8_t * const d128=dither_8x8_220[y&7];
- uint8_t *g = c->table_gU[128] + c->table_gV[128];
- int i;
- unsigned acc = 0;
-
- for (i = 0; i < dstW - 1; i += 2) {
- int j;
- int Y1 = 1 << 18;
- int Y2 = 1 << 18;
-
- for (j = 0; j < lumFilterSize; j++) {
- Y1 += lumSrc[j][i] * lumFilter[j];
- Y2 += lumSrc[j][i+1] * lumFilter[j];
- }
- Y1 >>= 19;
- Y2 >>= 19;
- if ((Y1 | Y2) & 0x100) {
- Y1 = av_clip_uint8(Y1);
- Y2 = av_clip_uint8(Y2);
- }
- acc += acc + g[Y1 + d128[(i + 0) & 7]];
- acc += acc + g[Y2 + d128[(i + 1) & 7]];
- if ((i & 7) == 6) {
- output_pixel(*dest++, acc);
- }
- }
-}
-
-static av_always_inline void
-yuv2mono_2_c_template(SwsContext *c, const int16_t *buf[2],
- const int16_t *ubuf[2], const int16_t *vbuf[2],
- const int16_t *abuf[2], uint8_t *dest, int dstW,
- int yalpha, int uvalpha, int y,
- enum PixelFormat target)
-{
- const int16_t *buf0 = buf[0], *buf1 = buf[1];
- const uint8_t * const d128 = dither_8x8_220[y & 7];
- uint8_t *g = c->table_gU[128] + c->table_gV[128];
- int yalpha1 = 4095 - yalpha;
- int i;
-
- for (i = 0; i < dstW - 7; i += 8) {
- int acc = g[((buf0[i ] * yalpha1 + buf1[i ] * yalpha) >> 19) + d128[0]];
- acc += acc + g[((buf0[i + 1] * yalpha1 + buf1[i + 1] * yalpha) >> 19) + d128[1]];
- acc += acc + g[((buf0[i + 2] * yalpha1 + buf1[i + 2] * yalpha) >> 19) + d128[2]];
- acc += acc + g[((buf0[i + 3] * yalpha1 + buf1[i + 3] * yalpha) >> 19) + d128[3]];
- acc += acc + g[((buf0[i + 4] * yalpha1 + buf1[i + 4] * yalpha) >> 19) + d128[4]];
- acc += acc + g[((buf0[i + 5] * yalpha1 + buf1[i + 5] * yalpha) >> 19) + d128[5]];
- acc += acc + g[((buf0[i + 6] * yalpha1 + buf1[i + 6] * yalpha) >> 19) + d128[6]];
- acc += acc + g[((buf0[i + 7] * yalpha1 + buf1[i + 7] * yalpha) >> 19) + d128[7]];
- output_pixel(*dest++, acc);
- }
-}
-
-static av_always_inline void
-yuv2mono_1_c_template(SwsContext *c, const int16_t *buf0,
- const int16_t *ubuf[2], const int16_t *vbuf[2],
- const int16_t *abuf0, uint8_t *dest, int dstW,
- int uvalpha, int y, enum PixelFormat target)
-{
- const uint8_t * const d128 = dither_8x8_220[y & 7];
- uint8_t *g = c->table_gU[128] + c->table_gV[128];
- int i;
-
- for (i = 0; i < dstW - 7; i += 8) {
- int acc = g[(buf0[i ] >> 7) + d128[0]];
- acc += acc + g[(buf0[i + 1] >> 7) + d128[1]];
- acc += acc + g[(buf0[i + 2] >> 7) + d128[2]];
- acc += acc + g[(buf0[i + 3] >> 7) + d128[3]];
- acc += acc + g[(buf0[i + 4] >> 7) + d128[4]];
- acc += acc + g[(buf0[i + 5] >> 7) + d128[5]];
- acc += acc + g[(buf0[i + 6] >> 7) + d128[6]];
- acc += acc + g[(buf0[i + 7] >> 7) + d128[7]];
- output_pixel(*dest++, acc);
- }
-}
-
-#undef output_pixel
-
-#define YUV2PACKEDWRAPPER(name, base, ext, fmt) \
-static void name ## ext ## _X_c(SwsContext *c, const int16_t *lumFilter, \
- const int16_t **lumSrc, int lumFilterSize, \
- const int16_t *chrFilter, const int16_t **chrUSrc, \
- const int16_t **chrVSrc, int chrFilterSize, \
- const int16_t **alpSrc, uint8_t *dest, int dstW, \
- int y) \
-{ \
- name ## base ## _X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
- chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
- alpSrc, dest, dstW, y, fmt); \
-} \
- \
-static void name ## ext ## _2_c(SwsContext *c, const int16_t *buf[2], \
- const int16_t *ubuf[2], const int16_t *vbuf[2], \
- const int16_t *abuf[2], uint8_t *dest, int dstW, \
- int yalpha, int uvalpha, int y) \
-{ \
- name ## base ## _2_c_template(c, buf, ubuf, vbuf, abuf, \
- dest, dstW, yalpha, uvalpha, y, fmt); \
-} \
- \
-static void name ## ext ## _1_c(SwsContext *c, const int16_t *buf0, \
- const int16_t *ubuf[2], const int16_t *vbuf[2], \
- const int16_t *abuf0, uint8_t *dest, int dstW, \
- int uvalpha, int y) \
-{ \
- name ## base ## _1_c_template(c, buf0, ubuf, vbuf, \
- abuf0, dest, dstW, uvalpha, \
- y, fmt); \
-}
-
-YUV2PACKEDWRAPPER(yuv2mono,, white, PIX_FMT_MONOWHITE)
-YUV2PACKEDWRAPPER(yuv2mono,, black, PIX_FMT_MONOBLACK)
-
-#define output_pixels(pos, Y1, U, Y2, V) \
- if (target == PIX_FMT_YUYV422) { \
- dest[pos + 0] = Y1; \
- dest[pos + 1] = U; \
- dest[pos + 2] = Y2; \
- dest[pos + 3] = V; \
- } else { \
- dest[pos + 0] = U; \
- dest[pos + 1] = Y1; \
- dest[pos + 2] = V; \
- dest[pos + 3] = Y2; \
- }
-
-static av_always_inline void
-yuv2422_X_c_template(SwsContext *c, const int16_t *lumFilter,
- const int16_t **lumSrc, int lumFilterSize,
- const int16_t *chrFilter, const int16_t **chrUSrc,
- const int16_t **chrVSrc, int chrFilterSize,
- const int16_t **alpSrc, uint8_t *dest, int dstW,
- int y, enum PixelFormat target)
-{
- int i;
-
- for (i = 0; i < (dstW >> 1); i++) {
- int j;
- int Y1 = 1 << 18;
- int Y2 = 1 << 18;
- int U = 1 << 18;
- int V = 1 << 18;
-
- for (j = 0; j < lumFilterSize; j++) {
- Y1 += lumSrc[j][i * 2] * lumFilter[j];
- Y2 += lumSrc[j][i * 2 + 1] * lumFilter[j];
- }
- for (j = 0; j < chrFilterSize; j++) {
- U += chrUSrc[j][i] * chrFilter[j];
- V += chrVSrc[j][i] * chrFilter[j];
- }
- Y1 >>= 19;
- Y2 >>= 19;
- U >>= 19;
- V >>= 19;
- if ((Y1 | Y2 | U | V) & 0x100) {
- Y1 = av_clip_uint8(Y1);
- Y2 = av_clip_uint8(Y2);
- U = av_clip_uint8(U);
- V = av_clip_uint8(V);
- }
- output_pixels(4*i, Y1, U, Y2, V);
- }
-}
-
-static av_always_inline void
-yuv2422_2_c_template(SwsContext *c, const int16_t *buf[2],
- const int16_t *ubuf[2], const int16_t *vbuf[2],
- const int16_t *abuf[2], uint8_t *dest, int dstW,
- int yalpha, int uvalpha, int y,
- enum PixelFormat target)
-{
- const int16_t *buf0 = buf[0], *buf1 = buf[1],
- *ubuf0 = ubuf[0], *ubuf1 = ubuf[1],
- *vbuf0 = vbuf[0], *vbuf1 = vbuf[1];
- int yalpha1 = 4095 - yalpha;
- int uvalpha1 = 4095 - uvalpha;
- int i;
-
- for (i = 0; i < (dstW >> 1); i++) {
- int Y1 = (buf0[i * 2] * yalpha1 + buf1[i * 2] * yalpha) >> 19;
- int Y2 = (buf0[i * 2 + 1] * yalpha1 + buf1[i * 2 + 1] * yalpha) >> 19;
- int U = (ubuf0[i] * uvalpha1 + ubuf1[i] * uvalpha) >> 19;
- int V = (vbuf0[i] * uvalpha1 + vbuf1[i] * uvalpha) >> 19;
-
- output_pixels(i * 4, Y1, U, Y2, V);
- }
-}
-
-static av_always_inline void
-yuv2422_1_c_template(SwsContext *c, const int16_t *buf0,
- const int16_t *ubuf[2], const int16_t *vbuf[2],
- const int16_t *abuf0, uint8_t *dest, int dstW,
- int uvalpha, int y, enum PixelFormat target)
-{
- const int16_t *ubuf0 = ubuf[0], *ubuf1 = ubuf[1],
- *vbuf0 = vbuf[0], *vbuf1 = vbuf[1];
- int i;
-
- if (uvalpha < 2048) {
- for (i = 0; i < (dstW >> 1); i++) {
- int Y1 = buf0[i * 2] >> 7;
- int Y2 = buf0[i * 2 + 1] >> 7;
- int U = ubuf1[i] >> 7;
- int V = vbuf1[i] >> 7;
-
- output_pixels(i * 4, Y1, U, Y2, V);
- }
- } else {
- for (i = 0; i < (dstW >> 1); i++) {
- int Y1 = buf0[i * 2] >> 7;
- int Y2 = buf0[i * 2 + 1] >> 7;
- int U = (ubuf0[i] + ubuf1[i]) >> 8;
- int V = (vbuf0[i] + vbuf1[i]) >> 8;
-
- output_pixels(i * 4, Y1, U, Y2, V);
- }
- }
-}
-
-#undef output_pixels
-
-YUV2PACKEDWRAPPER(yuv2, 422, yuyv422, PIX_FMT_YUYV422)
-YUV2PACKEDWRAPPER(yuv2, 422, uyvy422, PIX_FMT_UYVY422)
-
-#define R_B ((target == PIX_FMT_RGB48LE || target == PIX_FMT_RGB48BE) ? R : B)
-#define B_R ((target == PIX_FMT_RGB48LE || target == PIX_FMT_RGB48BE) ? B : R)
-#define output_pixel(pos, val) \
- if (isBE(target)) { \
- AV_WB16(pos, val); \
- } else { \
- AV_WL16(pos, val); \
- }
-
-static av_always_inline void
-yuv2rgb48_X_c_template(SwsContext *c, const int16_t *lumFilter,
- const int32_t **lumSrc, int lumFilterSize,
- const int16_t *chrFilter, const int32_t **chrUSrc,
- const int32_t **chrVSrc, int chrFilterSize,
- const int32_t **alpSrc, uint16_t *dest, int dstW,
- int y, enum PixelFormat target)
-{
- int i;
-
- for (i = 0; i < (dstW >> 1); i++) {
- int j;
- int Y1 = -0x40000000;
- int Y2 = -0x40000000;
- int U = -128 << 23; // 19
- int V = -128 << 23;
- int R, G, B;
-
- for (j = 0; j < lumFilterSize; j++) {
- Y1 += lumSrc[j][i * 2] * lumFilter[j];
- Y2 += lumSrc[j][i * 2 + 1] * lumFilter[j];
- }
- for (j = 0; j < chrFilterSize; j++) {
- U += chrUSrc[j][i] * chrFilter[j];
- V += chrVSrc[j][i] * chrFilter[j];
- }
-
- // 8bit: 12+15=27; 16-bit: 12+19=31
- Y1 >>= 14; // 10
- Y1 += 0x10000;
- Y2 >>= 14;
- Y2 += 0x10000;
- U >>= 14;
- V >>= 14;
-
- // 8bit: 27 -> 17bit, 16bit: 31 - 14 = 17bit
- Y1 -= c->yuv2rgb_y_offset;
- Y2 -= c->yuv2rgb_y_offset;
- Y1 *= c->yuv2rgb_y_coeff;
- Y2 *= c->yuv2rgb_y_coeff;
- Y1 += 1 << 13; // 21
- Y2 += 1 << 13;
- // 8bit: 17 + 13bit = 30bit, 16bit: 17 + 13bit = 30bit
-
- R = V * c->yuv2rgb_v2r_coeff;
- G = V * c->yuv2rgb_v2g_coeff + U * c->yuv2rgb_u2g_coeff;
- B = U * c->yuv2rgb_u2b_coeff;
-
- // 8bit: 30 - 22 = 8bit, 16bit: 30bit - 14 = 16bit
- output_pixel(&dest[0], av_clip_uintp2(R_B + Y1, 30) >> 14);
- output_pixel(&dest[1], av_clip_uintp2( G + Y1, 30) >> 14);
- output_pixel(&dest[2], av_clip_uintp2(B_R + Y1, 30) >> 14);
- output_pixel(&dest[3], av_clip_uintp2(R_B + Y2, 30) >> 14);
- output_pixel(&dest[4], av_clip_uintp2( G + Y2, 30) >> 14);
- output_pixel(&dest[5], av_clip_uintp2(B_R + Y2, 30) >> 14);
- dest += 6;
- }
-}
-
-static av_always_inline void
-yuv2rgb48_2_c_template(SwsContext *c, const int32_t *buf[2],
- const int32_t *ubuf[2], const int32_t *vbuf[2],
- const int32_t *abuf[2], uint16_t *dest, int dstW,
- int yalpha, int uvalpha, int y,
- enum PixelFormat target)
-{
- const int32_t *buf0 = buf[0], *buf1 = buf[1],
- *ubuf0 = ubuf[0], *ubuf1 = ubuf[1],
- *vbuf0 = vbuf[0], *vbuf1 = vbuf[1];
- int yalpha1 = 4095 - yalpha;
- int uvalpha1 = 4095 - uvalpha;
- int i;
-
- for (i = 0; i < (dstW >> 1); i++) {
- int Y1 = (buf0[i * 2] * yalpha1 + buf1[i * 2] * yalpha) >> 14;
- int Y2 = (buf0[i * 2 + 1] * yalpha1 + buf1[i * 2 + 1] * yalpha) >> 14;
- int U = (ubuf0[i] * uvalpha1 + ubuf1[i] * uvalpha + (-128 << 23)) >> 14;
- int V = (vbuf0[i] * uvalpha1 + vbuf1[i] * uvalpha + (-128 << 23)) >> 14;
- int R, G, B;
-
- Y1 -= c->yuv2rgb_y_offset;
- Y2 -= c->yuv2rgb_y_offset;
- Y1 *= c->yuv2rgb_y_coeff;
- Y2 *= c->yuv2rgb_y_coeff;
- Y1 += 1 << 13;
- Y2 += 1 << 13;
-
- R = V * c->yuv2rgb_v2r_coeff;
- G = V * c->yuv2rgb_v2g_coeff + U * c->yuv2rgb_u2g_coeff;
- B = U * c->yuv2rgb_u2b_coeff;
-
- output_pixel(&dest[0], av_clip_uintp2(R_B + Y1, 30) >> 14);
- output_pixel(&dest[1], av_clip_uintp2( G + Y1, 30) >> 14);
- output_pixel(&dest[2], av_clip_uintp2(B_R + Y1, 30) >> 14);
- output_pixel(&dest[3], av_clip_uintp2(R_B + Y2, 30) >> 14);
- output_pixel(&dest[4], av_clip_uintp2( G + Y2, 30) >> 14);
- output_pixel(&dest[5], av_clip_uintp2(B_R + Y2, 30) >> 14);
- dest += 6;
- }
-}
-
-static av_always_inline void
-yuv2rgb48_1_c_template(SwsContext *c, const int32_t *buf0,
- const int32_t *ubuf[2], const int32_t *vbuf[2],
- const int32_t *abuf0, uint16_t *dest, int dstW,
- int uvalpha, int y, enum PixelFormat target)
-{
- const int32_t *ubuf0 = ubuf[0], *ubuf1 = ubuf[1],
- *vbuf0 = vbuf[0], *vbuf1 = vbuf[1];
- int i;
-
- if (uvalpha < 2048) {
- for (i = 0; i < (dstW >> 1); i++) {
- int Y1 = (buf0[i * 2] ) >> 2;
- int Y2 = (buf0[i * 2 + 1]) >> 2;
- int U = (ubuf0[i] + (-128 << 11)) >> 2;
- int V = (vbuf0[i] + (-128 << 11)) >> 2;
- int R, G, B;
-
- Y1 -= c->yuv2rgb_y_offset;
- Y2 -= c->yuv2rgb_y_offset;
- Y1 *= c->yuv2rgb_y_coeff;
- Y2 *= c->yuv2rgb_y_coeff;
- Y1 += 1 << 13;
- Y2 += 1 << 13;
-
- R = V * c->yuv2rgb_v2r_coeff;
- G = V * c->yuv2rgb_v2g_coeff + U * c->yuv2rgb_u2g_coeff;
- B = U * c->yuv2rgb_u2b_coeff;
-
- output_pixel(&dest[0], av_clip_uintp2(R_B + Y1, 30) >> 14);
- output_pixel(&dest[1], av_clip_uintp2( G + Y1, 30) >> 14);
- output_pixel(&dest[2], av_clip_uintp2(B_R + Y1, 30) >> 14);
- output_pixel(&dest[3], av_clip_uintp2(R_B + Y2, 30) >> 14);
- output_pixel(&dest[4], av_clip_uintp2( G + Y2, 30) >> 14);
- output_pixel(&dest[5], av_clip_uintp2(B_R + Y2, 30) >> 14);
- dest += 6;
- }
- } else {
- for (i = 0; i < (dstW >> 1); i++) {
- int Y1 = (buf0[i * 2] ) >> 2;
- int Y2 = (buf0[i * 2 + 1]) >> 2;
- int U = (ubuf0[i] + ubuf1[i] + (-128 << 11)) >> 3;
- int V = (vbuf0[i] + vbuf1[i] + (-128 << 11)) >> 3;
- int R, G, B;
-
- Y1 -= c->yuv2rgb_y_offset;
- Y2 -= c->yuv2rgb_y_offset;
- Y1 *= c->yuv2rgb_y_coeff;
- Y2 *= c->yuv2rgb_y_coeff;
- Y1 += 1 << 13;
- Y2 += 1 << 13;
-
- R = V * c->yuv2rgb_v2r_coeff;
- G = V * c->yuv2rgb_v2g_coeff + U * c->yuv2rgb_u2g_coeff;
- B = U * c->yuv2rgb_u2b_coeff;
-
- output_pixel(&dest[0], av_clip_uintp2(R_B + Y1, 30) >> 14);
- output_pixel(&dest[1], av_clip_uintp2( G + Y1, 30) >> 14);
- output_pixel(&dest[2], av_clip_uintp2(B_R + Y1, 30) >> 14);
- output_pixel(&dest[3], av_clip_uintp2(R_B + Y2, 30) >> 14);
- output_pixel(&dest[4], av_clip_uintp2( G + Y2, 30) >> 14);
- output_pixel(&dest[5], av_clip_uintp2(B_R + Y2, 30) >> 14);
- dest += 6;
- }
- }
-}
-
-#undef output_pixel
-#undef r_b
-#undef b_r
-
-YUV2PACKED16WRAPPER(yuv2, rgb48, rgb48be, PIX_FMT_RGB48BE)
-YUV2PACKED16WRAPPER(yuv2, rgb48, rgb48le, PIX_FMT_RGB48LE)
-YUV2PACKED16WRAPPER(yuv2, rgb48, bgr48be, PIX_FMT_BGR48BE)
-YUV2PACKED16WRAPPER(yuv2, rgb48, bgr48le, PIX_FMT_BGR48LE)
-
-/*
- * Write out 2 RGB pixels in the target pixel format. This function takes a
- * R/G/B LUT as generated by ff_yuv2rgb_c_init_tables(), which takes care of
- * things like endianness conversion and shifting. The caller takes care of
- * setting the correct offset in these tables from the chroma (U/V) values.
- * This function then uses the luminance (Y1/Y2) values to write out the
- * correct RGB values into the destination buffer.
- */
-static av_always_inline void
-yuv2rgb_write(uint8_t *_dest, int i, unsigned Y1, unsigned Y2,
- unsigned A1, unsigned A2,
- const void *_r, const void *_g, const void *_b, int y,
- enum PixelFormat target, int hasAlpha)
-{
- if (target == PIX_FMT_ARGB || target == PIX_FMT_RGBA ||
- target == PIX_FMT_ABGR || target == PIX_FMT_BGRA) {
- uint32_t *dest = (uint32_t *) _dest;
- const uint32_t *r = (const uint32_t *) _r;
- const uint32_t *g = (const uint32_t *) _g;
- const uint32_t *b = (const uint32_t *) _b;
-
-#if CONFIG_SMALL
- int sh = hasAlpha ? ((target == PIX_FMT_RGB32_1 || target == PIX_FMT_BGR32_1) ? 0 : 24) : 0;
-
- dest[i * 2 + 0] = r[Y1] + g[Y1] + b[Y1] + (hasAlpha ? A1 << sh : 0);
- dest[i * 2 + 1] = r[Y2] + g[Y2] + b[Y2] + (hasAlpha ? A2 << sh : 0);
-#else
- if (hasAlpha) {
- int sh = (target == PIX_FMT_RGB32_1 || target == PIX_FMT_BGR32_1) ? 0 : 24;
-
- dest[i * 2 + 0] = r[Y1] + g[Y1] + b[Y1] + (A1 << sh);
- dest[i * 2 + 1] = r[Y2] + g[Y2] + b[Y2] + (A2 << sh);
- } else {
- dest[i * 2 + 0] = r[Y1] + g[Y1] + b[Y1];
- dest[i * 2 + 1] = r[Y2] + g[Y2] + b[Y2];
- }
-#endif
- } else if (target == PIX_FMT_RGB24 || target == PIX_FMT_BGR24) {
- uint8_t *dest = (uint8_t *) _dest;
- const uint8_t *r = (const uint8_t *) _r;
- const uint8_t *g = (const uint8_t *) _g;
- const uint8_t *b = (const uint8_t *) _b;
-
-#define r_b ((target == PIX_FMT_RGB24) ? r : b)
-#define b_r ((target == PIX_FMT_RGB24) ? b : r)
- dest[i * 6 + 0] = r_b[Y1];
- dest[i * 6 + 1] = g[Y1];
- dest[i * 6 + 2] = b_r[Y1];
- dest[i * 6 + 3] = r_b[Y2];
- dest[i * 6 + 4] = g[Y2];
- dest[i * 6 + 5] = b_r[Y2];
-#undef r_b
-#undef b_r
- } else if (target == PIX_FMT_RGB565 || target == PIX_FMT_BGR565 ||
- target == PIX_FMT_RGB555 || target == PIX_FMT_BGR555 ||
- target == PIX_FMT_RGB444 || target == PIX_FMT_BGR444) {
- uint16_t *dest = (uint16_t *) _dest;
- const uint16_t *r = (const uint16_t *) _r;
- const uint16_t *g = (const uint16_t *) _g;
- const uint16_t *b = (const uint16_t *) _b;
- int dr1, dg1, db1, dr2, dg2, db2;
-
- if (target == PIX_FMT_RGB565 || target == PIX_FMT_BGR565) {
- dr1 = dither_2x2_8[ y & 1 ][0];
- dg1 = dither_2x2_4[ y & 1 ][0];
- db1 = dither_2x2_8[(y & 1) ^ 1][0];
- dr2 = dither_2x2_8[ y & 1 ][1];
- dg2 = dither_2x2_4[ y & 1 ][1];
- db2 = dither_2x2_8[(y & 1) ^ 1][1];
- } else if (target == PIX_FMT_RGB555 || target == PIX_FMT_BGR555) {
- dr1 = dither_2x2_8[ y & 1 ][0];
- dg1 = dither_2x2_8[ y & 1 ][1];
- db1 = dither_2x2_8[(y & 1) ^ 1][0];
- dr2 = dither_2x2_8[ y & 1 ][1];
- dg2 = dither_2x2_8[ y & 1 ][0];
- db2 = dither_2x2_8[(y & 1) ^ 1][1];
- } else {
- dr1 = dither_4x4_16[ y & 3 ][0];
- dg1 = dither_4x4_16[ y & 3 ][1];
- db1 = dither_4x4_16[(y & 3) ^ 3][0];
- dr2 = dither_4x4_16[ y & 3 ][1];
- dg2 = dither_4x4_16[ y & 3 ][0];
- db2 = dither_4x4_16[(y & 3) ^ 3][1];
- }
-
- dest[i * 2 + 0] = r[Y1 + dr1] + g[Y1 + dg1] + b[Y1 + db1];
- dest[i * 2 + 1] = r[Y2 + dr2] + g[Y2 + dg2] + b[Y2 + db2];
- } else /* 8/4-bit */ {
- uint8_t *dest = (uint8_t *) _dest;
- const uint8_t *r = (const uint8_t *) _r;
- const uint8_t *g = (const uint8_t *) _g;
- const uint8_t *b = (const uint8_t *) _b;
- int dr1, dg1, db1, dr2, dg2, db2;
-
- if (target == PIX_FMT_RGB8 || target == PIX_FMT_BGR8) {
- const uint8_t * const d64 = dither_8x8_73[y & 7];
- const uint8_t * const d32 = dither_8x8_32[y & 7];
- dr1 = dg1 = d32[(i * 2 + 0) & 7];
- db1 = d64[(i * 2 + 0) & 7];
- dr2 = dg2 = d32[(i * 2 + 1) & 7];
- db2 = d64[(i * 2 + 1) & 7];
- } else {
- const uint8_t * const d64 = dither_8x8_73 [y & 7];
- const uint8_t * const d128 = dither_8x8_220[y & 7];
- dr1 = db1 = d128[(i * 2 + 0) & 7];
- dg1 = d64[(i * 2 + 0) & 7];
- dr2 = db2 = d128[(i * 2 + 1) & 7];
- dg2 = d64[(i * 2 + 1) & 7];
- }
-
- if (target == PIX_FMT_RGB4 || target == PIX_FMT_BGR4) {
- dest[i] = r[Y1 + dr1] + g[Y1 + dg1] + b[Y1 + db1] +
- ((r[Y2 + dr2] + g[Y2 + dg2] + b[Y2 + db2]) << 4);
- } else {
- dest[i * 2 + 0] = r[Y1 + dr1] + g[Y1 + dg1] + b[Y1 + db1];
- dest[i * 2 + 1] = r[Y2 + dr2] + g[Y2 + dg2] + b[Y2 + db2];
- }
- }
-}
-
-static av_always_inline void
-yuv2rgb_X_c_template(SwsContext *c, const int16_t *lumFilter,
- const int16_t **lumSrc, int lumFilterSize,
- const int16_t *chrFilter, const int16_t **chrUSrc,
- const int16_t **chrVSrc, int chrFilterSize,
- const int16_t **alpSrc, uint8_t *dest, int dstW,
- int y, enum PixelFormat target, int hasAlpha)
-{
- int i;
-
- for (i = 0; i < (dstW >> 1); i++) {
- int j;
- int Y1 = 1 << 18;
- int Y2 = 1 << 18;
- int U = 1 << 18;
- int V = 1 << 18;
- int av_unused A1, A2;
- const void *r, *g, *b;
-
- for (j = 0; j < lumFilterSize; j++) {
- Y1 += lumSrc[j][i * 2] * lumFilter[j];
- Y2 += lumSrc[j][i * 2 + 1] * lumFilter[j];
- }
- for (j = 0; j < chrFilterSize; j++) {
- U += chrUSrc[j][i] * chrFilter[j];
- V += chrVSrc[j][i] * chrFilter[j];
- }
- Y1 >>= 19;
- Y2 >>= 19;
- U >>= 19;
- V >>= 19;
- if ((Y1 | Y2 | U | V) & 0x100) {
- Y1 = av_clip_uint8(Y1);
- Y2 = av_clip_uint8(Y2);
- U = av_clip_uint8(U);
- V = av_clip_uint8(V);
- }
- if (hasAlpha) {
- A1 = 1 << 18;
- A2 = 1 << 18;
- for (j = 0; j < lumFilterSize; j++) {
- A1 += alpSrc[j][i * 2 ] * lumFilter[j];
- A2 += alpSrc[j][i * 2 + 1] * lumFilter[j];
- }
- A1 >>= 19;
- A2 >>= 19;
- if ((A1 | A2) & 0x100) {
- A1 = av_clip_uint8(A1);
- A2 = av_clip_uint8(A2);
- }
- }
-
- /* FIXME fix tables so that clipping is not needed and then use _NOCLIP*/
- r = c->table_rV[V];
- g = (c->table_gU[U] + c->table_gV[V]);
- b = c->table_bU[U];
-
- yuv2rgb_write(dest, i, Y1, Y2, hasAlpha ? A1 : 0, hasAlpha ? A2 : 0,
- r, g, b, y, target, hasAlpha);
- }
-}
-
-static av_always_inline void
-yuv2rgb_2_c_template(SwsContext *c, const int16_t *buf[2],
- const int16_t *ubuf[2], const int16_t *vbuf[2],
- const int16_t *abuf[2], uint8_t *dest, int dstW,
- int yalpha, int uvalpha, int y,
- enum PixelFormat target, int hasAlpha)
-{
- const int16_t *buf0 = buf[0], *buf1 = buf[1],
- *ubuf0 = ubuf[0], *ubuf1 = ubuf[1],
- *vbuf0 = vbuf[0], *vbuf1 = vbuf[1],
- *abuf0 = hasAlpha ? abuf[0] : NULL,
- *abuf1 = hasAlpha ? abuf[1] : NULL;
- int yalpha1 = 4095 - yalpha;
- int uvalpha1 = 4095 - uvalpha;
- int i;
-
- for (i = 0; i < (dstW >> 1); i++) {
- int Y1 = (buf0[i * 2] * yalpha1 + buf1[i * 2] * yalpha) >> 19;
- int Y2 = (buf0[i * 2 + 1] * yalpha1 + buf1[i * 2 + 1] * yalpha) >> 19;
- int U = (ubuf0[i] * uvalpha1 + ubuf1[i] * uvalpha) >> 19;
- int V = (vbuf0[i] * uvalpha1 + vbuf1[i] * uvalpha) >> 19;
- int A1, A2;
- const void *r = c->table_rV[V],
- *g = (c->table_gU[U] + c->table_gV[V]),
- *b = c->table_bU[U];
-
- if (hasAlpha) {
- A1 = (abuf0[i * 2 ] * yalpha1 + abuf1[i * 2 ] * yalpha) >> 19;
- A2 = (abuf0[i * 2 + 1] * yalpha1 + abuf1[i * 2 + 1] * yalpha) >> 19;
- }
-
- yuv2rgb_write(dest, i, Y1, Y2, hasAlpha ? A1 : 0, hasAlpha ? A2 : 0,
- r, g, b, y, target, hasAlpha);
- }
-}
-
-static av_always_inline void
-yuv2rgb_1_c_template(SwsContext *c, const int16_t *buf0,
- const int16_t *ubuf[2], const int16_t *vbuf[2],
- const int16_t *abuf0, uint8_t *dest, int dstW,
- int uvalpha, int y, enum PixelFormat target,
- int hasAlpha)
-{
- const int16_t *ubuf0 = ubuf[0], *ubuf1 = ubuf[1],
- *vbuf0 = vbuf[0], *vbuf1 = vbuf[1];
- int i;
-
- if (uvalpha < 2048) {
- for (i = 0; i < (dstW >> 1); i++) {
- int Y1 = buf0[i * 2] >> 7;
- int Y2 = buf0[i * 2 + 1] >> 7;
- int U = ubuf1[i] >> 7;
- int V = vbuf1[i] >> 7;
- int A1, A2;
- const void *r = c->table_rV[V],
- *g = (c->table_gU[U] + c->table_gV[V]),
- *b = c->table_bU[U];
-
- if (hasAlpha) {
- A1 = abuf0[i * 2 ] >> 7;
- A2 = abuf0[i * 2 + 1] >> 7;
- }
-
- yuv2rgb_write(dest, i, Y1, Y2, hasAlpha ? A1 : 0, hasAlpha ? A2 : 0,
- r, g, b, y, target, hasAlpha);
- }
- } else {
- for (i = 0; i < (dstW >> 1); i++) {
- int Y1 = buf0[i * 2] >> 7;
- int Y2 = buf0[i * 2 + 1] >> 7;
- int U = (ubuf0[i] + ubuf1[i]) >> 8;
- int V = (vbuf0[i] + vbuf1[i]) >> 8;
- int A1, A2;
- const void *r = c->table_rV[V],
- *g = (c->table_gU[U] + c->table_gV[V]),
- *b = c->table_bU[U];
-
- if (hasAlpha) {
- A1 = abuf0[i * 2 ] >> 7;
- A2 = abuf0[i * 2 + 1] >> 7;
- }
-
- yuv2rgb_write(dest, i, Y1, Y2, hasAlpha ? A1 : 0, hasAlpha ? A2 : 0,
- r, g, b, y, target, hasAlpha);
- }
- }
-}
-
-#define YUV2RGBWRAPPERX(name, base, ext, fmt, hasAlpha) \
-static void name ## ext ## _X_c(SwsContext *c, const int16_t *lumFilter, \
- const int16_t **lumSrc, int lumFilterSize, \
- const int16_t *chrFilter, const int16_t **chrUSrc, \
- const int16_t **chrVSrc, int chrFilterSize, \
- const int16_t **alpSrc, uint8_t *dest, int dstW, \
- int y) \
-{ \
- name ## base ## _X_c_template(c, lumFilter, lumSrc, lumFilterSize, \
- chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
- alpSrc, dest, dstW, y, fmt, hasAlpha); \
-}
-#define YUV2RGBWRAPPER(name, base, ext, fmt, hasAlpha) \
-YUV2RGBWRAPPERX(name, base, ext, fmt, hasAlpha) \
-static void name ## ext ## _2_c(SwsContext *c, const int16_t *buf[2], \
- const int16_t *ubuf[2], const int16_t *vbuf[2], \
- const int16_t *abuf[2], uint8_t *dest, int dstW, \
- int yalpha, int uvalpha, int y) \
-{ \
- name ## base ## _2_c_template(c, buf, ubuf, vbuf, abuf, \
- dest, dstW, yalpha, uvalpha, y, fmt, hasAlpha); \
-} \
- \
-static void name ## ext ## _1_c(SwsContext *c, const int16_t *buf0, \
- const int16_t *ubuf[2], const int16_t *vbuf[2], \
- const int16_t *abuf0, uint8_t *dest, int dstW, \
- int uvalpha, int y) \
-{ \
- name ## base ## _1_c_template(c, buf0, ubuf, vbuf, abuf0, dest, \
- dstW, uvalpha, y, fmt, hasAlpha); \
-}
-
-#if CONFIG_SMALL
-YUV2RGBWRAPPER(yuv2rgb,, 32_1, PIX_FMT_RGB32_1, CONFIG_SWSCALE_ALPHA && c->alpPixBuf)
-YUV2RGBWRAPPER(yuv2rgb,, 32, PIX_FMT_RGB32, CONFIG_SWSCALE_ALPHA && c->alpPixBuf)
-#else
-#if CONFIG_SWSCALE_ALPHA
-YUV2RGBWRAPPER(yuv2rgb,, a32_1, PIX_FMT_RGB32_1, 1)
-YUV2RGBWRAPPER(yuv2rgb,, a32, PIX_FMT_RGB32, 1)
-#endif
-YUV2RGBWRAPPER(yuv2rgb,, x32_1, PIX_FMT_RGB32_1, 0)
-YUV2RGBWRAPPER(yuv2rgb,, x32, PIX_FMT_RGB32, 0)
-#endif
-YUV2RGBWRAPPER(yuv2, rgb, rgb24, PIX_FMT_RGB24, 0)
-YUV2RGBWRAPPER(yuv2, rgb, bgr24, PIX_FMT_BGR24, 0)
-YUV2RGBWRAPPER(yuv2rgb,, 16, PIX_FMT_RGB565, 0)
-YUV2RGBWRAPPER(yuv2rgb,, 15, PIX_FMT_RGB555, 0)
-YUV2RGBWRAPPER(yuv2rgb,, 12, PIX_FMT_RGB444, 0)
-YUV2RGBWRAPPER(yuv2rgb,, 8, PIX_FMT_RGB8, 0)
-YUV2RGBWRAPPER(yuv2rgb,, 4, PIX_FMT_RGB4, 0)
-YUV2RGBWRAPPER(yuv2rgb,, 4b, PIX_FMT_RGB4_BYTE, 0)
-
-static av_always_inline void
-yuv2rgb_full_X_c_template(SwsContext *c, const int16_t *lumFilter,
- const int16_t **lumSrc, int lumFilterSize,
- const int16_t *chrFilter, const int16_t **chrUSrc,
- const int16_t **chrVSrc, int chrFilterSize,
- const int16_t **alpSrc, uint8_t *dest,
- int dstW, int y, enum PixelFormat target, int hasAlpha)
-{
- int i;
- int step = (target == PIX_FMT_RGB24 || target == PIX_FMT_BGR24) ? 3 : 4;
-
- for (i = 0; i < dstW; i++) {
- int j;
- int Y = 0;
- int U = -128 << 19;
- int V = -128 << 19;
- int av_unused A;
- int R, G, B;
-
- for (j = 0; j < lumFilterSize; j++) {
- Y += lumSrc[j][i] * lumFilter[j];
- }
- for (j = 0; j < chrFilterSize; j++) {
- U += chrUSrc[j][i] * chrFilter[j];
- V += chrVSrc[j][i] * chrFilter[j];
- }
- Y >>= 10;
- U >>= 10;
- V >>= 10;
- if (hasAlpha) {
- A = 1 << 21;
- for (j = 0; j < lumFilterSize; j++) {
- A += alpSrc[j][i] * lumFilter[j];
- }
- A >>= 19;
- if (A & 0x100)
- A = av_clip_uint8(A);
- }
- Y -= c->yuv2rgb_y_offset;
- Y *= c->yuv2rgb_y_coeff;
- Y += 1 << 21;
- R = Y + V*c->yuv2rgb_v2r_coeff;
- G = Y + V*c->yuv2rgb_v2g_coeff + U*c->yuv2rgb_u2g_coeff;
- B = Y + U*c->yuv2rgb_u2b_coeff;
- if ((R | G | B) & 0xC0000000) {
- R = av_clip_uintp2(R, 30);
- G = av_clip_uintp2(G, 30);
- B = av_clip_uintp2(B, 30);
- }
-
- switch(target) {
- case PIX_FMT_ARGB:
- dest[0] = hasAlpha ? A : 255;
- dest[1] = R >> 22;
- dest[2] = G >> 22;
- dest[3] = B >> 22;
- break;
- case PIX_FMT_RGB24:
- dest[0] = R >> 22;
- dest[1] = G >> 22;
- dest[2] = B >> 22;
- break;
- case PIX_FMT_RGBA:
- dest[0] = R >> 22;
- dest[1] = G >> 22;
- dest[2] = B >> 22;
- dest[3] = hasAlpha ? A : 255;
- break;
- case PIX_FMT_ABGR:
- dest[0] = hasAlpha ? A : 255;
- dest[1] = B >> 22;
- dest[2] = G >> 22;
- dest[3] = R >> 22;
- dest += 4;
- break;
- case PIX_FMT_BGR24:
- dest[0] = B >> 22;
- dest[1] = G >> 22;
- dest[2] = R >> 22;
- break;
- case PIX_FMT_BGRA:
- dest[0] = B >> 22;
- dest[1] = G >> 22;
- dest[2] = R >> 22;
- dest[3] = hasAlpha ? A : 255;
- break;
- }
- dest += step;
- }
-}
-#if CONFIG_SMALL
-YUV2RGBWRAPPERX(yuv2, rgb_full, bgra32_full, PIX_FMT_BGRA, CONFIG_SWSCALE_ALPHA && c->alpPixBuf)
-YUV2RGBWRAPPERX(yuv2, rgb_full, abgr32_full, PIX_FMT_ABGR, CONFIG_SWSCALE_ALPHA && c->alpPixBuf)
-YUV2RGBWRAPPERX(yuv2, rgb_full, rgba32_full, PIX_FMT_RGBA, CONFIG_SWSCALE_ALPHA && c->alpPixBuf)
-YUV2RGBWRAPPERX(yuv2, rgb_full, argb32_full, PIX_FMT_ARGB, CONFIG_SWSCALE_ALPHA && c->alpPixBuf)
-#else
-#if CONFIG_SWSCALE_ALPHA
-YUV2RGBWRAPPERX(yuv2, rgb_full, bgra32_full, PIX_FMT_BGRA, 1)
-YUV2RGBWRAPPERX(yuv2, rgb_full, abgr32_full, PIX_FMT_ABGR, 1)
-YUV2RGBWRAPPERX(yuv2, rgb_full, rgba32_full, PIX_FMT_RGBA, 1)
-YUV2RGBWRAPPERX(yuv2, rgb_full, argb32_full, PIX_FMT_ARGB, 1)
-#endif
-YUV2RGBWRAPPERX(yuv2, rgb_full, bgrx32_full, PIX_FMT_BGRA, 0)
-YUV2RGBWRAPPERX(yuv2, rgb_full, xbgr32_full, PIX_FMT_ABGR, 0)
-YUV2RGBWRAPPERX(yuv2, rgb_full, rgbx32_full, PIX_FMT_RGBA, 0)
-YUV2RGBWRAPPERX(yuv2, rgb_full, xrgb32_full, PIX_FMT_ARGB, 0)
-#endif
-YUV2RGBWRAPPERX(yuv2, rgb_full, bgr24_full, PIX_FMT_BGR24, 0)
-YUV2RGBWRAPPERX(yuv2, rgb_full, rgb24_full, PIX_FMT_RGB24, 0)
+DECLARE_ALIGNED(8, const uint8_t, ff_sws_pb_64)[8] = {
+ 64, 64, 64, 64, 64, 64, 64, 64
+};
-static av_always_inline void fillPlane(uint8_t* plane, int stride,
- int width, int height,
- int y, uint8_t val)
+static av_always_inline void fillPlane(uint8_t *plane, int stride, int width,
+ int height, int y, uint8_t val)
{
int i;
- uint8_t *ptr = plane + stride*y;
- for (i=0; i<height; i++) {
+ uint8_t *ptr = plane + stride * y;
+ for (i = 0; i < height; i++) {
memset(ptr, val, width);
ptr += stride;
}
}
-#define input_pixel(pos) (isBE(origin) ? AV_RB16(pos) : AV_RL16(pos))
-
-#define r ((origin == PIX_FMT_BGR48BE || origin == PIX_FMT_BGR48LE) ? b_r : r_b)
-#define b ((origin == PIX_FMT_BGR48BE || origin == PIX_FMT_BGR48LE) ? r_b : b_r)
-
-static av_always_inline void
-rgb48ToY_c_template(uint16_t *dst, const uint16_t *src, int width,
- enum PixelFormat origin)
-{
- int i;
- for (i = 0; i < width; i++) {
- unsigned int r_b = input_pixel(&src[i*3+0]);
- unsigned int g = input_pixel(&src[i*3+1]);
- unsigned int b_r = input_pixel(&src[i*3+2]);
-
- dst[i] = (RY*r + GY*g + BY*b + (0x2001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
- }
-}
-
-static av_always_inline void
-rgb48ToUV_c_template(uint16_t *dstU, uint16_t *dstV,
- const uint16_t *src1, const uint16_t *src2,
- int width, enum PixelFormat origin)
-{
- int i;
- assert(src1==src2);
- for (i = 0; i < width; i++) {
- int r_b = input_pixel(&src1[i*3+0]);
- int g = input_pixel(&src1[i*3+1]);
- int b_r = input_pixel(&src1[i*3+2]);
-
- dstU[i] = (RU*r + GU*g + BU*b + (0x10001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
- dstV[i] = (RV*r + GV*g + BV*b + (0x10001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
- }
-}
-
-static av_always_inline void
-rgb48ToUV_half_c_template(uint16_t *dstU, uint16_t *dstV,
- const uint16_t *src1, const uint16_t *src2,
- int width, enum PixelFormat origin)
-{
- int i;
- assert(src1==src2);
- for (i = 0; i < width; i++) {
- int r_b = (input_pixel(&src1[6 * i + 0]) + input_pixel(&src1[6 * i + 3]) + 1) >> 1;
- int g = (input_pixel(&src1[6 * i + 1]) + input_pixel(&src1[6 * i + 4]) + 1) >> 1;
- int b_r = (input_pixel(&src1[6 * i + 2]) + input_pixel(&src1[6 * i + 5]) + 1) >> 1;
-
- dstU[i]= (RU*r + GU*g + BU*b + (0x10001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
- dstV[i]= (RV*r + GV*g + BV*b + (0x10001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
- }
-}
-
-#undef r
-#undef b
-#undef input_pixel
-
-#define rgb48funcs(pattern, BE_LE, origin) \
-static void pattern ## 48 ## BE_LE ## ToY_c(uint8_t *_dst, const uint8_t *_src, \
- int width, uint32_t *unused) \
-{ \
- const uint16_t *src = (const uint16_t *) _src; \
- uint16_t *dst = (uint16_t *) _dst; \
- rgb48ToY_c_template(dst, src, width, origin); \
-} \
- \
-static void pattern ## 48 ## BE_LE ## ToUV_c(uint8_t *_dstU, uint8_t *_dstV, \
- const uint8_t *_src1, const uint8_t *_src2, \
- int width, uint32_t *unused) \
-{ \
- const uint16_t *src1 = (const uint16_t *) _src1, \
- *src2 = (const uint16_t *) _src2; \
- uint16_t *dstU = (uint16_t *) _dstU, *dstV = (uint16_t *) _dstV; \
- rgb48ToUV_c_template(dstU, dstV, src1, src2, width, origin); \
-} \
- \
-static void pattern ## 48 ## BE_LE ## ToUV_half_c(uint8_t *_dstU, uint8_t *_dstV, \
- const uint8_t *_src1, const uint8_t *_src2, \
- int width, uint32_t *unused) \
-{ \
- const uint16_t *src1 = (const uint16_t *) _src1, \
- *src2 = (const uint16_t *) _src2; \
- uint16_t *dstU = (uint16_t *) _dstU, *dstV = (uint16_t *) _dstV; \
- rgb48ToUV_half_c_template(dstU, dstV, src1, src2, width, origin); \
-}
-
-rgb48funcs(rgb, LE, PIX_FMT_RGB48LE)
-rgb48funcs(rgb, BE, PIX_FMT_RGB48BE)
-rgb48funcs(bgr, LE, PIX_FMT_BGR48LE)
-rgb48funcs(bgr, BE, PIX_FMT_BGR48BE)
-
-#define input_pixel(i) ((origin == PIX_FMT_RGBA || origin == PIX_FMT_BGRA || \
- origin == PIX_FMT_ARGB || origin == PIX_FMT_ABGR) ? AV_RN32A(&src[(i)*4]) : \
- (isBE(origin) ? AV_RB16(&src[(i)*2]) : AV_RL16(&src[(i)*2])))
-
-static av_always_inline void
-rgb16_32ToY_c_template(uint8_t *dst, const uint8_t *src,
- int width, enum PixelFormat origin,
- int shr, int shg, int shb, int shp,
- int maskr, int maskg, int maskb,
- int rsh, int gsh, int bsh, int S)
-{
- const int ry = RY << rsh, gy = GY << gsh, by = BY << bsh;
- const unsigned rnd = 33u << (S - 1);
- int i;
-
- for (i = 0; i < width; i++) {
- int px = input_pixel(i) >> shp;
- int b = (px & maskb) >> shb;
- int g = (px & maskg) >> shg;
- int r = (px & maskr) >> shr;
-
- dst[i] = (ry * r + gy * g + by * b + rnd) >> S;
- }
-}
-
-static av_always_inline void
-rgb16_32ToUV_c_template(uint8_t *dstU, uint8_t *dstV,
- const uint8_t *src, int width,
- enum PixelFormat origin,
- int shr, int shg, int shb, int shp,
- int maskr, int maskg, int maskb,
- int rsh, int gsh, int bsh, int S)
-{
- const int ru = RU << rsh, gu = GU << gsh, bu = BU << bsh,
- rv = RV << rsh, gv = GV << gsh, bv = BV << bsh;
- const unsigned rnd = 257u << (S - 1);
- int i;
-
- for (i = 0; i < width; i++) {
- int px = input_pixel(i) >> shp;
- int b = (px & maskb) >> shb;
- int g = (px & maskg) >> shg;
- int r = (px & maskr) >> shr;
-
- dstU[i] = (ru * r + gu * g + bu * b + rnd) >> S;
- dstV[i] = (rv * r + gv * g + bv * b + rnd) >> S;
- }
-}
-
-static av_always_inline void
-rgb16_32ToUV_half_c_template(uint8_t *dstU, uint8_t *dstV,
- const uint8_t *src, int width,
- enum PixelFormat origin,
- int shr, int shg, int shb, int shp,
- int maskr, int maskg, int maskb,
- int rsh, int gsh, int bsh, int S)
-{
- const int ru = RU << rsh, gu = GU << gsh, bu = BU << bsh,
- rv = RV << rsh, gv = GV << gsh, bv = BV << bsh,
- maskgx = ~(maskr | maskb);
- const unsigned rnd = 257u << S;
- int i;
-
- maskr |= maskr << 1; maskb |= maskb << 1; maskg |= maskg << 1;
- for (i = 0; i < width; i++) {
- int px0 = input_pixel(2 * i + 0) >> shp;
- int px1 = input_pixel(2 * i + 1) >> shp;
- int b, r, g = (px0 & maskgx) + (px1 & maskgx);
- int rb = px0 + px1 - g;
-
- b = (rb & maskb) >> shb;
- if (shp || origin == PIX_FMT_BGR565LE || origin == PIX_FMT_BGR565BE ||
- origin == PIX_FMT_RGB565LE || origin == PIX_FMT_RGB565BE) {
- g >>= shg;
- } else {
- g = (g & maskg) >> shg;
- }
- r = (rb & maskr) >> shr;
-
- dstU[i] = (ru * r + gu * g + bu * b + rnd) >> (S + 1);
- dstV[i] = (rv * r + gv * g + bv * b + rnd) >> (S + 1);
- }
-}
-
-#undef input_pixel
-
-#define rgb16_32_wrapper(fmt, name, shr, shg, shb, shp, maskr, \
- maskg, maskb, rsh, gsh, bsh, S) \
-static void name ## ToY_c(uint8_t *dst, const uint8_t *src, \
- int width, uint32_t *unused) \
-{ \
- rgb16_32ToY_c_template(dst, src, width, fmt, shr, shg, shb, shp, \
- maskr, maskg, maskb, rsh, gsh, bsh, S); \
-} \
- \
-static void name ## ToUV_c(uint8_t *dstU, uint8_t *dstV, \
- const uint8_t *src, const uint8_t *dummy, \
- int width, uint32_t *unused) \
-{ \
- rgb16_32ToUV_c_template(dstU, dstV, src, width, fmt, shr, shg, shb, shp, \
- maskr, maskg, maskb, rsh, gsh, bsh, S); \
-} \
- \
-static void name ## ToUV_half_c(uint8_t *dstU, uint8_t *dstV, \
- const uint8_t *src, const uint8_t *dummy, \
- int width, uint32_t *unused) \
-{ \
- rgb16_32ToUV_half_c_template(dstU, dstV, src, width, fmt, shr, shg, shb, shp, \
- maskr, maskg, maskb, rsh, gsh, bsh, S); \
-}
-
-rgb16_32_wrapper(PIX_FMT_BGR32, bgr32, 16, 0, 0, 0, 0xFF0000, 0xFF00, 0x00FF, 8, 0, 8, RGB2YUV_SHIFT+8)
-rgb16_32_wrapper(PIX_FMT_BGR32_1, bgr321, 16, 0, 0, 8, 0xFF0000, 0xFF00, 0x00FF, 8, 0, 8, RGB2YUV_SHIFT+8)
-rgb16_32_wrapper(PIX_FMT_RGB32, rgb32, 0, 0, 16, 0, 0x00FF, 0xFF00, 0xFF0000, 8, 0, 8, RGB2YUV_SHIFT+8)
-rgb16_32_wrapper(PIX_FMT_RGB32_1, rgb321, 0, 0, 16, 8, 0x00FF, 0xFF00, 0xFF0000, 8, 0, 8, RGB2YUV_SHIFT+8)
-rgb16_32_wrapper(PIX_FMT_BGR565LE, bgr16le, 0, 0, 0, 0, 0x001F, 0x07E0, 0xF800, 11, 5, 0, RGB2YUV_SHIFT+8)
-rgb16_32_wrapper(PIX_FMT_BGR555LE, bgr15le, 0, 0, 0, 0, 0x001F, 0x03E0, 0x7C00, 10, 5, 0, RGB2YUV_SHIFT+7)
-rgb16_32_wrapper(PIX_FMT_BGR444LE, bgr12le, 0, 0, 0, 0, 0x000F, 0x00F0, 0x0F00, 8, 4, 0, RGB2YUV_SHIFT+4)
-rgb16_32_wrapper(PIX_FMT_RGB565LE, rgb16le, 0, 0, 0, 0, 0xF800, 0x07E0, 0x001F, 0, 5, 11, RGB2YUV_SHIFT+8)
-rgb16_32_wrapper(PIX_FMT_RGB555LE, rgb15le, 0, 0, 0, 0, 0x7C00, 0x03E0, 0x001F, 0, 5, 10, RGB2YUV_SHIFT+7)
-rgb16_32_wrapper(PIX_FMT_RGB444LE, rgb12le, 0, 0, 0, 0, 0x0F00, 0x00F0, 0x000F, 0, 4, 8, RGB2YUV_SHIFT+4)
-rgb16_32_wrapper(PIX_FMT_BGR565BE, bgr16be, 0, 0, 0, 0, 0x001F, 0x07E0, 0xF800, 11, 5, 0, RGB2YUV_SHIFT+8)
-rgb16_32_wrapper(PIX_FMT_BGR555BE, bgr15be, 0, 0, 0, 0, 0x001F, 0x03E0, 0x7C00, 10, 5, 0, RGB2YUV_SHIFT+7)
-rgb16_32_wrapper(PIX_FMT_BGR444BE, bgr12be, 0, 0, 0, 0, 0x000F, 0x00F0, 0x0F00, 8, 4, 0, RGB2YUV_SHIFT+4)
-rgb16_32_wrapper(PIX_FMT_RGB565BE, rgb16be, 0, 0, 0, 0, 0xF800, 0x07E0, 0x001F, 0, 5, 11, RGB2YUV_SHIFT+8)
-rgb16_32_wrapper(PIX_FMT_RGB555BE, rgb15be, 0, 0, 0, 0, 0x7C00, 0x03E0, 0x001F, 0, 5, 10, RGB2YUV_SHIFT+7)
-rgb16_32_wrapper(PIX_FMT_RGB444BE, rgb12be, 0, 0, 0, 0, 0x0F00, 0x00F0, 0x000F, 0, 4, 8, RGB2YUV_SHIFT+4)
-
-static void abgrToA_c(uint8_t *dst, const uint8_t *src, int width, uint32_t *unused)
-{
- int i;
- for (i=0; i<width; i++) {
- dst[i]= src[4*i];
- }
-}
-
-static void rgbaToA_c(uint8_t *dst, const uint8_t *src, int width, uint32_t *unused)
-{
- int i;
- for (i=0; i<width; i++) {
- dst[i]= src[4*i+3];
- }
-}
-
-static void palToY_c(uint8_t *dst, const uint8_t *src, int width, uint32_t *pal)
-{
- int i;
- for (i=0; i<width; i++) {
- int d= src[i];
-
- dst[i]= pal[d] & 0xFF;
- }
-}
-
-static void palToUV_c(uint8_t *dstU, uint8_t *dstV,
- const uint8_t *src1, const uint8_t *src2,
- int width, uint32_t *pal)
-{
- int i;
- assert(src1 == src2);
- for (i=0; i<width; i++) {
- int p= pal[src1[i]];
-
- dstU[i]= p>>8;
- dstV[i]= p>>16;
- }
-}
-
-static void monowhite2Y_c(uint8_t *dst, const uint8_t *src,
- int width, uint32_t *unused)
-{
- int i, j;
- for (i=0; i<width/8; i++) {
- int d= ~src[i];
- for(j=0; j<8; j++)
- dst[8*i+j]= ((d>>(7-j))&1)*255;
- }
-}
-
-static void monoblack2Y_c(uint8_t *dst, const uint8_t *src,
- int width, uint32_t *unused)
+static void fill_plane9or10(uint8_t *plane, int stride, int width,
+ int height, int y, uint8_t val,
+ const int dst_depth, const int big_endian)
{
int i, j;
- for (i=0; i<width/8; i++) {
- int d= src[i];
- for(j=0; j<8; j++)
- dst[8*i+j]= ((d>>(7-j))&1)*255;
- }
-}
-
-//FIXME yuy2* can read up to 7 samples too much
-
-static void yuy2ToY_c(uint8_t *dst, const uint8_t *src, int width,
- uint32_t *unused)
-{
- int i;
- for (i=0; i<width; i++)
- dst[i]= src[2*i];
-}
-
-static void yuy2ToUV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *src1,
- const uint8_t *src2, int width, uint32_t *unused)
-{
- int i;
- for (i=0; i<width; i++) {
- dstU[i]= src1[4*i + 1];
- dstV[i]= src1[4*i + 3];
- }
- assert(src1 == src2);
-}
-
-static void bswap16Y_c(uint8_t *_dst, const uint8_t *_src, int width, uint32_t *unused)
-{
- int i;
- const uint16_t *src = (const uint16_t *) _src;
- uint16_t *dst = (uint16_t *) _dst;
- for (i=0; i<width; i++) {
- dst[i] = av_bswap16(src[i]);
- }
-}
-
-static void bswap16UV_c(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *_src1,
- const uint8_t *_src2, int width, uint32_t *unused)
-{
- int i;
- const uint16_t *src1 = (const uint16_t *) _src1,
- *src2 = (const uint16_t *) _src2;
- uint16_t *dstU = (uint16_t *) _dstU, *dstV = (uint16_t *) _dstV;
- for (i=0; i<width; i++) {
- dstU[i] = av_bswap16(src1[i]);
- dstV[i] = av_bswap16(src2[i]);
- }
-}
-
-/* This is almost identical to the previous, end exists only because
- * yuy2ToY/UV)(dst, src+1, ...) would have 100% unaligned accesses. */
-static void uyvyToY_c(uint8_t *dst, const uint8_t *src, int width,
- uint32_t *unused)
-{
- int i;
- for (i=0; i<width; i++)
- dst[i]= src[2*i+1];
-}
-
-static void uyvyToUV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *src1,
- const uint8_t *src2, int width, uint32_t *unused)
-{
- int i;
- for (i=0; i<width; i++) {
- dstU[i]= src1[4*i + 0];
- dstV[i]= src1[4*i + 2];
- }
- assert(src1 == src2);
-}
-
-static av_always_inline void nvXXtoUV_c(uint8_t *dst1, uint8_t *dst2,
- const uint8_t *src, int width)
-{
- int i;
- for (i = 0; i < width; i++) {
- dst1[i] = src[2*i+0];
- dst2[i] = src[2*i+1];
- }
-}
-
-static void nv12ToUV_c(uint8_t *dstU, uint8_t *dstV,
- const uint8_t *src1, const uint8_t *src2,
- int width, uint32_t *unused)
-{
- nvXXtoUV_c(dstU, dstV, src1, width);
-}
-
-static void nv21ToUV_c(uint8_t *dstU, uint8_t *dstV,
- const uint8_t *src1, const uint8_t *src2,
- int width, uint32_t *unused)
-{
- nvXXtoUV_c(dstV, dstU, src1, width);
-}
-
-#define input_pixel(pos) (isBE(origin) ? AV_RB16(pos) : AV_RL16(pos))
-
-static void bgr24ToY_c(uint8_t *dst, const uint8_t *src,
- int width, uint32_t *unused)
-{
- int i;
- for (i=0; i<width; i++) {
- int b= src[i*3+0];
- int g= src[i*3+1];
- int r= src[i*3+2];
-
- dst[i]= ((RY*r + GY*g + BY*b + (33<<(RGB2YUV_SHIFT-1)))>>RGB2YUV_SHIFT);
- }
-}
-
-static void bgr24ToUV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *src1,
- const uint8_t *src2, int width, uint32_t *unused)
-{
- int i;
- for (i=0; i<width; i++) {
- int b= src1[3*i + 0];
- int g= src1[3*i + 1];
- int r= src1[3*i + 2];
-
- dstU[i]= (RU*r + GU*g + BU*b + (257<<(RGB2YUV_SHIFT-1)))>>RGB2YUV_SHIFT;
- dstV[i]= (RV*r + GV*g + BV*b + (257<<(RGB2YUV_SHIFT-1)))>>RGB2YUV_SHIFT;
- }
- assert(src1 == src2);
-}
-
-static void bgr24ToUV_half_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *src1,
- const uint8_t *src2, int width, uint32_t *unused)
-{
- int i;
- for (i=0; i<width; i++) {
- int b= src1[6*i + 0] + src1[6*i + 3];
- int g= src1[6*i + 1] + src1[6*i + 4];
- int r= src1[6*i + 2] + src1[6*i + 5];
-
- dstU[i]= (RU*r + GU*g + BU*b + (257<<RGB2YUV_SHIFT))>>(RGB2YUV_SHIFT+1);
- dstV[i]= (RV*r + GV*g + BV*b + (257<<RGB2YUV_SHIFT))>>(RGB2YUV_SHIFT+1);
- }
- assert(src1 == src2);
-}
-
-static void rgb24ToY_c(uint8_t *dst, const uint8_t *src, int width,
- uint32_t *unused)
-{
- int i;
- for (i=0; i<width; i++) {
- int r= src[i*3+0];
- int g= src[i*3+1];
- int b= src[i*3+2];
-
- dst[i]= ((RY*r + GY*g + BY*b + (33<<(RGB2YUV_SHIFT-1)))>>RGB2YUV_SHIFT);
- }
-}
-
-static void rgb24ToUV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *src1,
- const uint8_t *src2, int width, uint32_t *unused)
-{
- int i;
- assert(src1==src2);
- for (i=0; i<width; i++) {
- int r= src1[3*i + 0];
- int g= src1[3*i + 1];
- int b= src1[3*i + 2];
-
- dstU[i]= (RU*r + GU*g + BU*b + (257<<(RGB2YUV_SHIFT-1)))>>RGB2YUV_SHIFT;
- dstV[i]= (RV*r + GV*g + BV*b + (257<<(RGB2YUV_SHIFT-1)))>>RGB2YUV_SHIFT;
- }
-}
-
-static void rgb24ToUV_half_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *src1,
- const uint8_t *src2, int width, uint32_t *unused)
-{
- int i;
- assert(src1==src2);
- for (i=0; i<width; i++) {
- int r= src1[6*i + 0] + src1[6*i + 3];
- int g= src1[6*i + 1] + src1[6*i + 4];
- int b= src1[6*i + 2] + src1[6*i + 5];
-
- dstU[i]= (RU*r + GU*g + BU*b + (257<<RGB2YUV_SHIFT))>>(RGB2YUV_SHIFT+1);
- dstV[i]= (RV*r + GV*g + BV*b + (257<<RGB2YUV_SHIFT))>>(RGB2YUV_SHIFT+1);
- }
-}
-
-static void planar_rgb_to_y(uint8_t *dst, const uint8_t *src[4], int width)
-{
- int i;
- for (i = 0; i < width; i++) {
- int g = src[0][i];
- int b = src[1][i];
- int r = src[2][i];
-
- dst[i] = ((RY * r + GY * g + BY * b + (33 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT);
- }
-}
-
-static void planar_rgb16le_to_y(uint8_t *_dst, const uint8_t *_src[4], int width)
-{
- int i;
- const uint16_t **src = (const uint16_t **) _src;
- uint16_t *dst = (uint16_t *) _dst;
- for (i = 0; i < width; i++) {
- int g = AV_RL16(src[0] + i);
- int b = AV_RL16(src[1] + i);
- int r = AV_RL16(src[2] + i);
-
- dst[i] = ((RY * r + GY * g + BY * b + (33 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT);
- }
-}
-
-static void planar_rgb16be_to_y(uint8_t *_dst, const uint8_t *_src[4], int width)
-{
- int i;
- const uint16_t **src = (const uint16_t **) _src;
- uint16_t *dst = (uint16_t *) _dst;
- for (i = 0; i < width; i++) {
- int g = AV_RB16(src[0] + i);
- int b = AV_RB16(src[1] + i);
- int r = AV_RB16(src[2] + i);
-
- dst[i] = ((RY * r + GY * g + BY * b + (33 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT);
- }
-}
-
-static void planar_rgb_to_uv(uint8_t *dstU, uint8_t *dstV, const uint8_t *src[4], int width)
-{
- int i;
- for (i = 0; i < width; i++) {
- int g = src[0][i];
- int b = src[1][i];
- int r = src[2][i];
-
- dstU[i] = (RU * r + GU * g + BU * b + (257 << RGB2YUV_SHIFT)) >> (RGB2YUV_SHIFT + 1);
- dstV[i] = (RV * r + GV * g + BV * b + (257 << RGB2YUV_SHIFT)) >> (RGB2YUV_SHIFT + 1);
- }
-}
-
-static void planar_rgb16le_to_uv(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *_src[4], int width)
-{
- int i;
- const uint16_t **src = (const uint16_t **) _src;
- uint16_t *dstU = (uint16_t *) _dstU;
- uint16_t *dstV = (uint16_t *) _dstV;
- for (i = 0; i < width; i++) {
- int g = AV_RL16(src[0] + i);
- int b = AV_RL16(src[1] + i);
- int r = AV_RL16(src[2] + i);
-
- dstU[i] = (RU * r + GU * g + BU * b + (257 << RGB2YUV_SHIFT)) >> (RGB2YUV_SHIFT + 1);
- dstV[i] = (RV * r + GV * g + BV * b + (257 << RGB2YUV_SHIFT)) >> (RGB2YUV_SHIFT + 1);
+ uint16_t *dst = (uint16_t *) (plane + stride * y);
+#define FILL8TO9_OR_10(wfunc) \
+ for (i = 0; i < height; i++) { \
+ for (j = 0; j < width; j++) { \
+ wfunc(&dst[j], (val << (dst_depth - 8)) | \
+ (val >> (16 - dst_depth))); \
+ } \
+ dst += stride / 2; \
+ }
+ if (big_endian) {
+ FILL8TO9_OR_10(AV_WB16);
+ } else {
+ FILL8TO9_OR_10(AV_WL16);
}
}
-static void planar_rgb16be_to_uv(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *_src[4], int width)
-{
- int i;
- const uint16_t **src = (const uint16_t **) _src;
- uint16_t *dstU = (uint16_t *) _dstU;
- uint16_t *dstV = (uint16_t *) _dstV;
- for (i = 0; i < width; i++) {
- int g = AV_RB16(src[0] + i);
- int b = AV_RB16(src[1] + i);
- int r = AV_RB16(src[2] + i);
-
- dstU[i] = (RU * r + GU * g + BU * b + (257 << RGB2YUV_SHIFT)) >> (RGB2YUV_SHIFT + 1);
- dstV[i] = (RV * r + GV * g + BV * b + (257 << RGB2YUV_SHIFT)) >> (RGB2YUV_SHIFT + 1);
- }
-}
-static void hScale16To19_c(SwsContext *c, int16_t *_dst, int dstW, const uint8_t *_src,
- const int16_t *filter,
+static void hScale16To19_c(SwsContext *c, int16_t *_dst, int dstW,
+ const uint8_t *_src, const int16_t *filter,
const int32_t *filterPos, int filterSize)
{
+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(c->srcFormat);
int i;
- int32_t *dst = (int32_t *) _dst;
+ int32_t *dst = (int32_t *) _dst;
const uint16_t *src = (const uint16_t *) _src;
- int bits = av_pix_fmt_descriptors[c->srcFormat].comp[0].depth_minus1;
- int sh = bits - 4;
+ int bits = desc->comp[0].depth_minus1;
+ int sh = bits - 4;
for (i = 0; i < dstW; i++) {
int j;
int srcPos = filterPos[i];
- int val = 0;
+ int val = 0;
for (j = 0; j < filterSize; j++) {
val += src[srcPos + j] * filter[filterSize * i + j];
@@ -1895,18 +107,19 @@ static void hScale16To19_c(SwsContext *c, int16_t *_dst, int dstW, const uint8_t
}
}
-static void hScale16To15_c(SwsContext *c, int16_t *dst, int dstW, const uint8_t *_src,
- const int16_t *filter,
+static void hScale16To15_c(SwsContext *c, int16_t *dst, int dstW,
+ const uint8_t *_src, const int16_t *filter,
const int32_t *filterPos, int filterSize)
{
+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(c->srcFormat);
int i;
const uint16_t *src = (const uint16_t *) _src;
- int sh = av_pix_fmt_descriptors[c->srcFormat].comp[0].depth_minus1;
+ int sh = desc->comp[0].depth_minus1;
for (i = 0; i < dstW; i++) {
int j;
int srcPos = filterPos[i];
- int val = 0;
+ int val = 0;
for (j = 0; j < filterSize; j++) {
val += src[srcPos + j] * filter[filterSize * i + j];
@@ -1917,72 +130,71 @@ static void hScale16To15_c(SwsContext *c, int16_t *dst, int dstW, const uint8_t
}
// bilinear / bicubic scaling
-static void hScale8To15_c(SwsContext *c, int16_t *dst, int dstW, const uint8_t *src,
- const int16_t *filter, const int32_t *filterPos,
- int filterSize)
+static void hScale8To15_c(SwsContext *c, int16_t *dst, int dstW,
+ const uint8_t *src, const int16_t *filter,
+ const int32_t *filterPos, int filterSize)
{
int i;
- for (i=0; i<dstW; i++) {
+ for (i = 0; i < dstW; i++) {
int j;
- int srcPos= filterPos[i];
- int val=0;
- for (j=0; j<filterSize; j++) {
- val += ((int)src[srcPos + j])*filter[filterSize*i + j];
+ int srcPos = filterPos[i];
+ int val = 0;
+ for (j = 0; j < filterSize; j++) {
+ val += ((int)src[srcPos + j]) * filter[filterSize * i + j];
}
- //filter += hFilterSize;
- dst[i] = FFMIN(val>>7, (1<<15)-1); // the cubic equation does overflow ...
- //dst[i] = val>>7;
+ dst[i] = FFMIN(val >> 7, (1 << 15) - 1); // the cubic equation does overflow ...
}
}
-static void hScale8To19_c(SwsContext *c, int16_t *_dst, int dstW, const uint8_t *src,
- const int16_t *filter, const int32_t *filterPos,
- int filterSize)
+static void hScale8To19_c(SwsContext *c, int16_t *_dst, int dstW,
+ const uint8_t *src, const int16_t *filter,
+ const int32_t *filterPos, int filterSize)
{
int i;
int32_t *dst = (int32_t *) _dst;
- for (i=0; i<dstW; i++) {
+ for (i = 0; i < dstW; i++) {
int j;
- int srcPos= filterPos[i];
- int val=0;
- for (j=0; j<filterSize; j++) {
- val += ((int)src[srcPos + j])*filter[filterSize*i + j];
+ int srcPos = filterPos[i];
+ int val = 0;
+ for (j = 0; j < filterSize; j++) {
+ val += ((int)src[srcPos + j]) * filter[filterSize * i + j];
}
- //filter += hFilterSize;
- dst[i] = FFMIN(val>>3, (1<<19)-1); // the cubic equation does overflow ...
- //dst[i] = val>>7;
+ dst[i] = FFMIN(val >> 3, (1 << 19) - 1); // the cubic equation does overflow ...
}
}
-//FIXME all pal and rgb srcFormats could do this convertion as well
-//FIXME all scalers more complex than bilinear could do half of this transform
+// FIXME all pal and rgb srcFormats could do this conversion as well
+// FIXME all scalers more complex than bilinear could do half of this transform
static void chrRangeToJpeg_c(int16_t *dstU, int16_t *dstV, int width)
{
int i;
for (i = 0; i < width; i++) {
- dstU[i] = (FFMIN(dstU[i],30775)*4663 - 9289992)>>12; //-264
- dstV[i] = (FFMIN(dstV[i],30775)*4663 - 9289992)>>12; //-264
+ dstU[i] = (FFMIN(dstU[i], 30775) * 4663 - 9289992) >> 12; // -264
+ dstV[i] = (FFMIN(dstV[i], 30775) * 4663 - 9289992) >> 12; // -264
}
}
+
static void chrRangeFromJpeg_c(int16_t *dstU, int16_t *dstV, int width)
{
int i;
for (i = 0; i < width; i++) {
- dstU[i] = (dstU[i]*1799 + 4081085)>>11; //1469
- dstV[i] = (dstV[i]*1799 + 4081085)>>11; //1469
+ dstU[i] = (dstU[i] * 1799 + 4081085) >> 11; // 1469
+ dstV[i] = (dstV[i] * 1799 + 4081085) >> 11; // 1469
}
}
+
static void lumRangeToJpeg_c(int16_t *dst, int width)
{
int i;
for (i = 0; i < width; i++)
- dst[i] = (FFMIN(dst[i],30189)*19077 - 39057361)>>14;
+ dst[i] = (FFMIN(dst[i], 30189) * 19077 - 39057361) >> 14;
}
+
static void lumRangeFromJpeg_c(int16_t *dst, int width)
{
int i;
for (i = 0; i < width; i++)
- dst[i] = (dst[i]*14071 + 33561947)>>14;
+ dst[i] = (dst[i] * 14071 + 33561947) >> 14;
}
static void chrRangeToJpeg16_c(int16_t *_dstU, int16_t *_dstV, int width)
@@ -1991,70 +203,77 @@ static void chrRangeToJpeg16_c(int16_t *_dstU, int16_t *_dstV, int width)
int32_t *dstU = (int32_t *) _dstU;
int32_t *dstV = (int32_t *) _dstV;
for (i = 0; i < width; i++) {
- dstU[i] = (FFMIN(dstU[i],30775<<4)*4663 - (9289992<<4))>>12; //-264
- dstV[i] = (FFMIN(dstV[i],30775<<4)*4663 - (9289992<<4))>>12; //-264
+ dstU[i] = (FFMIN(dstU[i], 30775 << 4) * 4663 - (9289992 << 4)) >> 12; // -264
+ dstV[i] = (FFMIN(dstV[i], 30775 << 4) * 4663 - (9289992 << 4)) >> 12; // -264
}
}
+
static void chrRangeFromJpeg16_c(int16_t *_dstU, int16_t *_dstV, int width)
{
int i;
int32_t *dstU = (int32_t *) _dstU;
int32_t *dstV = (int32_t *) _dstV;
for (i = 0; i < width; i++) {
- dstU[i] = (dstU[i]*1799 + (4081085<<4))>>11; //1469
- dstV[i] = (dstV[i]*1799 + (4081085<<4))>>11; //1469
+ dstU[i] = (dstU[i] * 1799 + (4081085 << 4)) >> 11; // 1469
+ dstV[i] = (dstV[i] * 1799 + (4081085 << 4)) >> 11; // 1469
}
}
+
static void lumRangeToJpeg16_c(int16_t *_dst, int width)
{
int i;
int32_t *dst = (int32_t *) _dst;
for (i = 0; i < width; i++)
- dst[i] = (FFMIN(dst[i],30189<<4)*4769 - (39057361<<2))>>12;
+ dst[i] = (FFMIN(dst[i], 30189 << 4) * 4769 - (39057361 << 2)) >> 12;
}
+
static void lumRangeFromJpeg16_c(int16_t *_dst, int width)
{
int i;
int32_t *dst = (int32_t *) _dst;
for (i = 0; i < width; i++)
- dst[i] = (dst[i]*14071 + (33561947<<4))>>14;
+ dst[i] = (dst[i] * 14071 + (33561947 << 4)) >> 14;
}
static void hyscale_fast_c(SwsContext *c, int16_t *dst, int dstWidth,
const uint8_t *src, int srcW, int xInc)
{
int i;
- unsigned int xpos=0;
- for (i=0;i<dstWidth;i++) {
- register unsigned int xx=xpos>>16;
- register unsigned int xalpha=(xpos&0xFFFF)>>9;
- dst[i]= (src[xx]<<7) + (src[xx+1] - src[xx])*xalpha;
- xpos+=xInc;
+ unsigned int xpos = 0;
+ for (i = 0; i < dstWidth; i++) {
+ register unsigned int xx = xpos >> 16;
+ register unsigned int xalpha = (xpos & 0xFFFF) >> 9;
+ dst[i] = (src[xx] << 7) + (src[xx + 1] - src[xx]) * xalpha;
+ xpos += xInc;
}
}
// *** horizontal scale Y line to temp buffer
static av_always_inline void hyscale(SwsContext *c, int16_t *dst, int dstWidth,
- const uint8_t *src_in[4], int srcW, int xInc,
+ const uint8_t *src_in[4],
+ int srcW, int xInc,
const int16_t *hLumFilter,
- const int32_t *hLumFilterPos, int hLumFilterSize,
+ const int32_t *hLumFilterPos,
+ int hLumFilterSize,
uint8_t *formatConvBuffer,
uint32_t *pal, int isAlpha)
{
- void (*toYV12)(uint8_t *, const uint8_t *, int, uint32_t *) = isAlpha ? c->alpToYV12 : c->lumToYV12;
+ void (*toYV12)(uint8_t *, const uint8_t *, int, uint32_t *) =
+ isAlpha ? c->alpToYV12 : c->lumToYV12;
void (*convertRange)(int16_t *, int) = isAlpha ? NULL : c->lumConvertRange;
const uint8_t *src = src_in[isAlpha ? 3 : 0];
if (toYV12) {
toYV12(formatConvBuffer, src, srcW, pal);
- src= formatConvBuffer;
+ src = formatConvBuffer;
} else if (c->readLumPlanar && !isAlpha) {
c->readLumPlanar(formatConvBuffer, src_in, srcW);
src = formatConvBuffer;
}
if (!c->hyscale_fast) {
- c->hyScale(c, dst, dstWidth, src, hLumFilter, hLumFilterPos, hLumFilterSize);
+ c->hyScale(c, dst, dstWidth, src, hLumFilter,
+ hLumFilterPos, hLumFilterSize);
} else { // fast bilinear upscale / crap downscale
c->hyscale_fast(c, dst, dstWidth, src, srcW, xInc);
}
@@ -2068,33 +287,38 @@ static void hcscale_fast_c(SwsContext *c, int16_t *dst1, int16_t *dst2,
const uint8_t *src2, int srcW, int xInc)
{
int i;
- unsigned int xpos=0;
- for (i=0;i<dstWidth;i++) {
- register unsigned int xx=xpos>>16;
- register unsigned int xalpha=(xpos&0xFFFF)>>9;
- dst1[i]=(src1[xx]*(xalpha^127)+src1[xx+1]*xalpha);
- dst2[i]=(src2[xx]*(xalpha^127)+src2[xx+1]*xalpha);
- xpos+=xInc;
+ unsigned int xpos = 0;
+ for (i = 0; i < dstWidth; i++) {
+ register unsigned int xx = xpos >> 16;
+ register unsigned int xalpha = (xpos & 0xFFFF) >> 9;
+ dst1[i] = (src1[xx] * (xalpha ^ 127) + src1[xx + 1] * xalpha);
+ dst2[i] = (src2[xx] * (xalpha ^ 127) + src2[xx + 1] * xalpha);
+ xpos += xInc;
}
}
-static av_always_inline void hcscale(SwsContext *c, int16_t *dst1, int16_t *dst2, int dstWidth,
+static av_always_inline void hcscale(SwsContext *c, int16_t *dst1,
+ int16_t *dst2, int dstWidth,
const uint8_t *src_in[4],
- int srcW, int xInc, const int16_t *hChrFilter,
- const int32_t *hChrFilterPos, int hChrFilterSize,
+ int srcW, int xInc,
+ const int16_t *hChrFilter,
+ const int32_t *hChrFilterPos,
+ int hChrFilterSize,
uint8_t *formatConvBuffer, uint32_t *pal)
{
const uint8_t *src1 = src_in[1], *src2 = src_in[2];
if (c->chrToYV12) {
- uint8_t *buf2 = formatConvBuffer + FFALIGN(srcW * FFALIGN(c->srcBpc, 8) >> 3, 16);
+ uint8_t *buf2 = formatConvBuffer +
+ FFALIGN(srcW * FFALIGN(c->srcBpc, 8) >> 3, 16);
c->chrToYV12(formatConvBuffer, buf2, src1, src2, srcW, pal);
- src1= formatConvBuffer;
- src2= buf2;
+ src1 = formatConvBuffer;
+ src2 = buf2;
} else if (c->readChrPlanar) {
- uint8_t *buf2 = formatConvBuffer + FFALIGN(srcW * FFALIGN(c->srcBpc, 8) >> 3, 16);
+ uint8_t *buf2 = formatConvBuffer +
+ FFALIGN(srcW * FFALIGN(c->srcBpc, 8) >> 3, 16);
c->readChrPlanar(formatConvBuffer, buf2, src_in, srcW);
- src1= formatConvBuffer;
- src2= buf2;
+ src1 = formatConvBuffer;
+ src2 = buf2;
}
if (!c->hcscale_fast) {
@@ -2108,366 +332,131 @@ static av_always_inline void hcscale(SwsContext *c, int16_t *dst1, int16_t *dst2
c->chrConvertRange(dst1, dst2, dstWidth);
}
-static av_always_inline void
-find_c_packed_planar_out_funcs(SwsContext *c,
- yuv2planar1_fn *yuv2plane1, yuv2planarX_fn *yuv2planeX,
- yuv2interleavedX_fn *yuv2nv12cX,
- yuv2packed1_fn *yuv2packed1, yuv2packed2_fn *yuv2packed2,
- yuv2packedX_fn *yuv2packedX)
-{
- enum PixelFormat dstFormat = c->dstFormat;
-
- if (is16BPS(dstFormat)) {
- *yuv2planeX = isBE(dstFormat) ? yuv2planeX_16BE_c : yuv2planeX_16LE_c;
- *yuv2plane1 = isBE(dstFormat) ? yuv2plane1_16BE_c : yuv2plane1_16LE_c;
- } else if (is9_OR_10BPS(dstFormat)) {
- if (av_pix_fmt_descriptors[dstFormat].comp[0].depth_minus1 == 8) {
- *yuv2planeX = isBE(dstFormat) ? yuv2planeX_9BE_c : yuv2planeX_9LE_c;
- *yuv2plane1 = isBE(dstFormat) ? yuv2plane1_9BE_c : yuv2plane1_9LE_c;
- } else {
- *yuv2planeX = isBE(dstFormat) ? yuv2planeX_10BE_c : yuv2planeX_10LE_c;
- *yuv2plane1 = isBE(dstFormat) ? yuv2plane1_10BE_c : yuv2plane1_10LE_c;
- }
- } else {
- *yuv2plane1 = yuv2plane1_8_c;
- *yuv2planeX = yuv2planeX_8_c;
- if (dstFormat == PIX_FMT_NV12 || dstFormat == PIX_FMT_NV21)
- *yuv2nv12cX = yuv2nv12cX_c;
- }
-
- if(c->flags & SWS_FULL_CHR_H_INT) {
- switch (dstFormat) {
- case PIX_FMT_RGBA:
-#if CONFIG_SMALL
- *yuv2packedX = yuv2rgba32_full_X_c;
-#else
-#if CONFIG_SWSCALE_ALPHA
- if (c->alpPixBuf) {
- *yuv2packedX = yuv2rgba32_full_X_c;
- } else
-#endif /* CONFIG_SWSCALE_ALPHA */
- {
- *yuv2packedX = yuv2rgbx32_full_X_c;
- }
-#endif /* !CONFIG_SMALL */
- break;
- case PIX_FMT_ARGB:
-#if CONFIG_SMALL
- *yuv2packedX = yuv2argb32_full_X_c;
-#else
-#if CONFIG_SWSCALE_ALPHA
- if (c->alpPixBuf) {
- *yuv2packedX = yuv2argb32_full_X_c;
- } else
-#endif /* CONFIG_SWSCALE_ALPHA */
- {
- *yuv2packedX = yuv2xrgb32_full_X_c;
- }
-#endif /* !CONFIG_SMALL */
- break;
- case PIX_FMT_BGRA:
-#if CONFIG_SMALL
- *yuv2packedX = yuv2bgra32_full_X_c;
-#else
-#if CONFIG_SWSCALE_ALPHA
- if (c->alpPixBuf) {
- *yuv2packedX = yuv2bgra32_full_X_c;
- } else
-#endif /* CONFIG_SWSCALE_ALPHA */
- {
- *yuv2packedX = yuv2bgrx32_full_X_c;
- }
-#endif /* !CONFIG_SMALL */
- break;
- case PIX_FMT_ABGR:
-#if CONFIG_SMALL
- *yuv2packedX = yuv2abgr32_full_X_c;
-#else
-#if CONFIG_SWSCALE_ALPHA
- if (c->alpPixBuf) {
- *yuv2packedX = yuv2abgr32_full_X_c;
- } else
-#endif /* CONFIG_SWSCALE_ALPHA */
- {
- *yuv2packedX = yuv2xbgr32_full_X_c;
- }
-#endif /* !CONFIG_SMALL */
- break;
- case PIX_FMT_RGB24:
- *yuv2packedX = yuv2rgb24_full_X_c;
- break;
- case PIX_FMT_BGR24:
- *yuv2packedX = yuv2bgr24_full_X_c;
- break;
- }
- } else {
- switch (dstFormat) {
- case PIX_FMT_RGB48LE:
- *yuv2packed1 = yuv2rgb48le_1_c;
- *yuv2packed2 = yuv2rgb48le_2_c;
- *yuv2packedX = yuv2rgb48le_X_c;
- break;
- case PIX_FMT_RGB48BE:
- *yuv2packed1 = yuv2rgb48be_1_c;
- *yuv2packed2 = yuv2rgb48be_2_c;
- *yuv2packedX = yuv2rgb48be_X_c;
- break;
- case PIX_FMT_BGR48LE:
- *yuv2packed1 = yuv2bgr48le_1_c;
- *yuv2packed2 = yuv2bgr48le_2_c;
- *yuv2packedX = yuv2bgr48le_X_c;
- break;
- case PIX_FMT_BGR48BE:
- *yuv2packed1 = yuv2bgr48be_1_c;
- *yuv2packed2 = yuv2bgr48be_2_c;
- *yuv2packedX = yuv2bgr48be_X_c;
- break;
- case PIX_FMT_RGB32:
- case PIX_FMT_BGR32:
-#if CONFIG_SMALL
- *yuv2packed1 = yuv2rgb32_1_c;
- *yuv2packed2 = yuv2rgb32_2_c;
- *yuv2packedX = yuv2rgb32_X_c;
-#else
-#if CONFIG_SWSCALE_ALPHA
- if (c->alpPixBuf) {
- *yuv2packed1 = yuv2rgba32_1_c;
- *yuv2packed2 = yuv2rgba32_2_c;
- *yuv2packedX = yuv2rgba32_X_c;
- } else
-#endif /* CONFIG_SWSCALE_ALPHA */
- {
- *yuv2packed1 = yuv2rgbx32_1_c;
- *yuv2packed2 = yuv2rgbx32_2_c;
- *yuv2packedX = yuv2rgbx32_X_c;
- }
-#endif /* !CONFIG_SMALL */
- break;
- case PIX_FMT_RGB32_1:
- case PIX_FMT_BGR32_1:
-#if CONFIG_SMALL
- *yuv2packed1 = yuv2rgb32_1_1_c;
- *yuv2packed2 = yuv2rgb32_1_2_c;
- *yuv2packedX = yuv2rgb32_1_X_c;
-#else
-#if CONFIG_SWSCALE_ALPHA
- if (c->alpPixBuf) {
- *yuv2packed1 = yuv2rgba32_1_1_c;
- *yuv2packed2 = yuv2rgba32_1_2_c;
- *yuv2packedX = yuv2rgba32_1_X_c;
- } else
-#endif /* CONFIG_SWSCALE_ALPHA */
- {
- *yuv2packed1 = yuv2rgbx32_1_1_c;
- *yuv2packed2 = yuv2rgbx32_1_2_c;
- *yuv2packedX = yuv2rgbx32_1_X_c;
- }
-#endif /* !CONFIG_SMALL */
- break;
- case PIX_FMT_RGB24:
- *yuv2packed1 = yuv2rgb24_1_c;
- *yuv2packed2 = yuv2rgb24_2_c;
- *yuv2packedX = yuv2rgb24_X_c;
- break;
- case PIX_FMT_BGR24:
- *yuv2packed1 = yuv2bgr24_1_c;
- *yuv2packed2 = yuv2bgr24_2_c;
- *yuv2packedX = yuv2bgr24_X_c;
- break;
- case PIX_FMT_RGB565LE:
- case PIX_FMT_RGB565BE:
- case PIX_FMT_BGR565LE:
- case PIX_FMT_BGR565BE:
- *yuv2packed1 = yuv2rgb16_1_c;
- *yuv2packed2 = yuv2rgb16_2_c;
- *yuv2packedX = yuv2rgb16_X_c;
- break;
- case PIX_FMT_RGB555LE:
- case PIX_FMT_RGB555BE:
- case PIX_FMT_BGR555LE:
- case PIX_FMT_BGR555BE:
- *yuv2packed1 = yuv2rgb15_1_c;
- *yuv2packed2 = yuv2rgb15_2_c;
- *yuv2packedX = yuv2rgb15_X_c;
- break;
- case PIX_FMT_RGB444LE:
- case PIX_FMT_RGB444BE:
- case PIX_FMT_BGR444LE:
- case PIX_FMT_BGR444BE:
- *yuv2packed1 = yuv2rgb12_1_c;
- *yuv2packed2 = yuv2rgb12_2_c;
- *yuv2packedX = yuv2rgb12_X_c;
- break;
- case PIX_FMT_RGB8:
- case PIX_FMT_BGR8:
- *yuv2packed1 = yuv2rgb8_1_c;
- *yuv2packed2 = yuv2rgb8_2_c;
- *yuv2packedX = yuv2rgb8_X_c;
- break;
- case PIX_FMT_RGB4:
- case PIX_FMT_BGR4:
- *yuv2packed1 = yuv2rgb4_1_c;
- *yuv2packed2 = yuv2rgb4_2_c;
- *yuv2packedX = yuv2rgb4_X_c;
- break;
- case PIX_FMT_RGB4_BYTE:
- case PIX_FMT_BGR4_BYTE:
- *yuv2packed1 = yuv2rgb4b_1_c;
- *yuv2packed2 = yuv2rgb4b_2_c;
- *yuv2packedX = yuv2rgb4b_X_c;
- break;
- }
- }
- switch (dstFormat) {
- case PIX_FMT_GRAY16BE:
- *yuv2packed1 = yuv2gray16BE_1_c;
- *yuv2packed2 = yuv2gray16BE_2_c;
- *yuv2packedX = yuv2gray16BE_X_c;
- break;
- case PIX_FMT_GRAY16LE:
- *yuv2packed1 = yuv2gray16LE_1_c;
- *yuv2packed2 = yuv2gray16LE_2_c;
- *yuv2packedX = yuv2gray16LE_X_c;
- break;
- case PIX_FMT_MONOWHITE:
- *yuv2packed1 = yuv2monowhite_1_c;
- *yuv2packed2 = yuv2monowhite_2_c;
- *yuv2packedX = yuv2monowhite_X_c;
- break;
- case PIX_FMT_MONOBLACK:
- *yuv2packed1 = yuv2monoblack_1_c;
- *yuv2packed2 = yuv2monoblack_2_c;
- *yuv2packedX = yuv2monoblack_X_c;
- break;
- case PIX_FMT_YUYV422:
- *yuv2packed1 = yuv2yuyv422_1_c;
- *yuv2packed2 = yuv2yuyv422_2_c;
- *yuv2packedX = yuv2yuyv422_X_c;
- break;
- case PIX_FMT_UYVY422:
- *yuv2packed1 = yuv2uyvy422_1_c;
- *yuv2packed2 = yuv2uyvy422_2_c;
- *yuv2packedX = yuv2uyvy422_X_c;
- break;
- }
-}
-
#define DEBUG_SWSCALE_BUFFERS 0
-#define DEBUG_BUFFERS(...) if (DEBUG_SWSCALE_BUFFERS) av_log(c, AV_LOG_DEBUG, __VA_ARGS__)
+#define DEBUG_BUFFERS(...) \
+ if (DEBUG_SWSCALE_BUFFERS) \
+ av_log(c, AV_LOG_DEBUG, __VA_ARGS__)
-static int swScale(SwsContext *c, const uint8_t* src[],
+static int swScale(SwsContext *c, const uint8_t *src[],
int srcStride[], int srcSliceY,
- int srcSliceH, uint8_t* dst[], int dstStride[])
-{
- /* load a few things into local vars to make the code more readable? and faster */
- const int srcW= c->srcW;
- const int dstW= c->dstW;
- const int dstH= c->dstH;
- const int chrDstW= c->chrDstW;
- const int chrSrcW= c->chrSrcW;
- const int lumXInc= c->lumXInc;
- const int chrXInc= c->chrXInc;
- const enum PixelFormat dstFormat= c->dstFormat;
- const int flags= c->flags;
- int32_t *vLumFilterPos= c->vLumFilterPos;
- int32_t *vChrFilterPos= c->vChrFilterPos;
- int32_t *hLumFilterPos= c->hLumFilterPos;
- int32_t *hChrFilterPos= c->hChrFilterPos;
- int16_t *vLumFilter= c->vLumFilter;
- int16_t *vChrFilter= c->vChrFilter;
- int16_t *hLumFilter= c->hLumFilter;
- int16_t *hChrFilter= c->hChrFilter;
- int32_t *lumMmxFilter= c->lumMmxFilter;
- int32_t *chrMmxFilter= c->chrMmxFilter;
- int32_t av_unused *alpMmxFilter= c->alpMmxFilter;
- const int vLumFilterSize= c->vLumFilterSize;
- const int vChrFilterSize= c->vChrFilterSize;
- const int hLumFilterSize= c->hLumFilterSize;
- const int hChrFilterSize= c->hChrFilterSize;
- int16_t **lumPixBuf= c->lumPixBuf;
- int16_t **chrUPixBuf= c->chrUPixBuf;
- int16_t **chrVPixBuf= c->chrVPixBuf;
- int16_t **alpPixBuf= c->alpPixBuf;
- const int vLumBufSize= c->vLumBufSize;
- const int vChrBufSize= c->vChrBufSize;
- uint8_t *formatConvBuffer= c->formatConvBuffer;
- const int chrSrcSliceY= srcSliceY >> c->chrSrcVSubSample;
- const int chrSrcSliceH= -((-srcSliceH) >> c->chrSrcVSubSample);
+ int srcSliceH, uint8_t *dst[], int dstStride[])
+{
+ /* load a few things into local vars to make the code more readable?
+ * and faster */
+ const int srcW = c->srcW;
+ const int dstW = c->dstW;
+ const int dstH = c->dstH;
+ const int chrDstW = c->chrDstW;
+ const int chrSrcW = c->chrSrcW;
+ const int lumXInc = c->lumXInc;
+ const int chrXInc = c->chrXInc;
+ const enum AVPixelFormat dstFormat = c->dstFormat;
+ const int flags = c->flags;
+ int32_t *vLumFilterPos = c->vLumFilterPos;
+ int32_t *vChrFilterPos = c->vChrFilterPos;
+ int32_t *hLumFilterPos = c->hLumFilterPos;
+ int32_t *hChrFilterPos = c->hChrFilterPos;
+ int16_t *vLumFilter = c->vLumFilter;
+ int16_t *vChrFilter = c->vChrFilter;
+ int16_t *hLumFilter = c->hLumFilter;
+ int16_t *hChrFilter = c->hChrFilter;
+ int32_t *lumMmxFilter = c->lumMmxFilter;
+ int32_t *chrMmxFilter = c->chrMmxFilter;
+ const int vLumFilterSize = c->vLumFilterSize;
+ const int vChrFilterSize = c->vChrFilterSize;
+ const int hLumFilterSize = c->hLumFilterSize;
+ const int hChrFilterSize = c->hChrFilterSize;
+ int16_t **lumPixBuf = c->lumPixBuf;
+ int16_t **chrUPixBuf = c->chrUPixBuf;
+ int16_t **chrVPixBuf = c->chrVPixBuf;
+ int16_t **alpPixBuf = c->alpPixBuf;
+ const int vLumBufSize = c->vLumBufSize;
+ const int vChrBufSize = c->vChrBufSize;
+ uint8_t *formatConvBuffer = c->formatConvBuffer;
+ uint32_t *pal = c->pal_yuv;
+ yuv2planar1_fn yuv2plane1 = c->yuv2plane1;
+ yuv2planarX_fn yuv2planeX = c->yuv2planeX;
+ yuv2interleavedX_fn yuv2nv12cX = c->yuv2nv12cX;
+ yuv2packed1_fn yuv2packed1 = c->yuv2packed1;
+ yuv2packed2_fn yuv2packed2 = c->yuv2packed2;
+ yuv2packedX_fn yuv2packedX = c->yuv2packedX;
+ const int chrSrcSliceY = srcSliceY >> c->chrSrcVSubSample;
+ const int chrSrcSliceH = -((-srcSliceH) >> c->chrSrcVSubSample);
+ int should_dither = is9_OR_10BPS(c->srcFormat) ||
+ is16BPS(c->srcFormat);
int lastDstY;
- uint32_t *pal=c->pal_yuv;
- yuv2planar1_fn yuv2plane1 = c->yuv2plane1;
- yuv2planarX_fn yuv2planeX = c->yuv2planeX;
- yuv2interleavedX_fn yuv2nv12cX = c->yuv2nv12cX;
- yuv2packed1_fn yuv2packed1 = c->yuv2packed1;
- yuv2packed2_fn yuv2packed2 = c->yuv2packed2;
- yuv2packedX_fn yuv2packedX = c->yuv2packedX;
- int should_dither = is9_OR_10BPS(c->srcFormat) || is16BPS(c->srcFormat);
/* vars which will change and which we need to store back in the context */
- int dstY= c->dstY;
- int lumBufIndex= c->lumBufIndex;
- int chrBufIndex= c->chrBufIndex;
- int lastInLumBuf= c->lastInLumBuf;
- int lastInChrBuf= c->lastInChrBuf;
+ int dstY = c->dstY;
+ int lumBufIndex = c->lumBufIndex;
+ int chrBufIndex = c->chrBufIndex;
+ int lastInLumBuf = c->lastInLumBuf;
+ int lastInChrBuf = c->lastInChrBuf;
if (isPacked(c->srcFormat)) {
- src[0]=
- src[1]=
- src[2]=
- src[3]= src[0];
- srcStride[0]=
- srcStride[1]=
- srcStride[2]=
- srcStride[3]= srcStride[0];
- }
- srcStride[1]<<= c->vChrDrop;
- srcStride[2]<<= c->vChrDrop;
+ src[0] =
+ src[1] =
+ src[2] =
+ src[3] = src[0];
+ srcStride[0] =
+ srcStride[1] =
+ srcStride[2] =
+ srcStride[3] = srcStride[0];
+ }
+ srcStride[1] <<= c->vChrDrop;
+ srcStride[2] <<= c->vChrDrop;
DEBUG_BUFFERS("swScale() %p[%d] %p[%d] %p[%d] %p[%d] -> %p[%d] %p[%d] %p[%d] %p[%d]\n",
- src[0], srcStride[0], src[1], srcStride[1], src[2], srcStride[2], src[3], srcStride[3],
- dst[0], dstStride[0], dst[1], dstStride[1], dst[2], dstStride[2], dst[3], dstStride[3]);
+ src[0], srcStride[0], src[1], srcStride[1],
+ src[2], srcStride[2], src[3], srcStride[3],
+ dst[0], dstStride[0], dst[1], dstStride[1],
+ dst[2], dstStride[2], dst[3], dstStride[3]);
DEBUG_BUFFERS("srcSliceY: %d srcSliceH: %d dstY: %d dstH: %d\n",
- srcSliceY, srcSliceH, dstY, dstH);
+ srcSliceY, srcSliceH, dstY, dstH);
DEBUG_BUFFERS("vLumFilterSize: %d vLumBufSize: %d vChrFilterSize: %d vChrBufSize: %d\n",
- vLumFilterSize, vLumBufSize, vChrFilterSize, vChrBufSize);
+ vLumFilterSize, vLumBufSize, vChrFilterSize, vChrBufSize);
- if (dstStride[0]%8 !=0 || dstStride[1]%8 !=0 || dstStride[2]%8 !=0 || dstStride[3]%8 != 0) {
- static int warnedAlready=0; //FIXME move this into the context perhaps
+ if (dstStride[0] % 8 != 0 || dstStride[1] % 8 != 0 ||
+ dstStride[2] % 8 != 0 || dstStride[3] % 8 != 0) {
+ static int warnedAlready = 0; // FIXME maybe move this into the context
if (flags & SWS_PRINT_INFO && !warnedAlready) {
- av_log(c, AV_LOG_WARNING, "Warning: dstStride is not aligned!\n"
+ av_log(c, AV_LOG_WARNING,
+ "Warning: dstStride is not aligned!\n"
" ->cannot do aligned memory accesses anymore\n");
- warnedAlready=1;
+ warnedAlready = 1;
}
}
/* Note the user might start scaling the picture in the middle so this
- will not get executed. This is not really intended but works
- currently, so people might do it. */
- if (srcSliceY ==0) {
- lumBufIndex=-1;
- chrBufIndex=-1;
- dstY=0;
- lastInLumBuf= -1;
- lastInChrBuf= -1;
+ * will not get executed. This is not really intended but works
+ * currently, so people might do it. */
+ if (srcSliceY == 0) {
+ lumBufIndex = -1;
+ chrBufIndex = -1;
+ dstY = 0;
+ lastInLumBuf = -1;
+ lastInChrBuf = -1;
}
if (!should_dither) {
c->chrDither8 = c->lumDither8 = ff_sws_pb_64;
}
- lastDstY= dstY;
+ lastDstY = dstY;
- for (;dstY < dstH; dstY++) {
- const int chrDstY= dstY>>c->chrDstVSubSample;
- uint8_t *dest[4] = {
+ for (; dstY < dstH; dstY++) {
+ const int chrDstY = dstY >> c->chrDstVSubSample;
+ uint8_t *dest[4] = {
dst[0] + dstStride[0] * dstY,
dst[1] + dstStride[1] * chrDstY,
dst[2] + dstStride[2] * chrDstY,
(CONFIG_SWSCALE_ALPHA && alpPixBuf) ? dst[3] + dstStride[3] * dstY : NULL,
};
- const int firstLumSrcY= vLumFilterPos[dstY]; //First line needed as input
- const int firstLumSrcY2= vLumFilterPos[FFMIN(dstY | ((1<<c->chrDstVSubSample) - 1), dstH-1)];
- const int firstChrSrcY= vChrFilterPos[chrDstY]; //First line needed as input
+ // First line needed as input
+ const int firstLumSrcY = FFMAX(1 - vLumFilterSize, vLumFilterPos[dstY]);
+ const int firstLumSrcY2 = FFMAX(1 - vLumFilterSize, vLumFilterPos[FFMIN(dstY | ((1 << c->chrDstVSubSample) - 1), dstH - 1)]);
+ // First line needed as input
+ const int firstChrSrcY = FFMAX(1 - vChrFilterSize, vChrFilterPos[chrDstY]);
// Last line needed as input
int lastLumSrcY = FFMIN(c->srcH, firstLumSrcY + vLumFilterSize) - 1;
@@ -2475,30 +464,33 @@ static int swScale(SwsContext *c, const uint8_t* src[],
int lastChrSrcY = FFMIN(c->chrSrcH, firstChrSrcY + vChrFilterSize) - 1;
int enough_lines;
- //handle holes (FAST_BILINEAR & weird filters)
- if (firstLumSrcY > lastInLumBuf) lastInLumBuf= firstLumSrcY-1;
- if (firstChrSrcY > lastInChrBuf) lastInChrBuf= firstChrSrcY-1;
+ // handle holes (FAST_BILINEAR & weird filters)
+ if (firstLumSrcY > lastInLumBuf)
+ lastInLumBuf = firstLumSrcY - 1;
+ if (firstChrSrcY > lastInChrBuf)
+ lastInChrBuf = firstChrSrcY - 1;
assert(firstLumSrcY >= lastInLumBuf - vLumBufSize + 1);
assert(firstChrSrcY >= lastInChrBuf - vChrBufSize + 1);
DEBUG_BUFFERS("dstY: %d\n", dstY);
DEBUG_BUFFERS("\tfirstLumSrcY: %d lastLumSrcY: %d lastInLumBuf: %d\n",
- firstLumSrcY, lastLumSrcY, lastInLumBuf);
+ firstLumSrcY, lastLumSrcY, lastInLumBuf);
DEBUG_BUFFERS("\tfirstChrSrcY: %d lastChrSrcY: %d lastInChrBuf: %d\n",
- firstChrSrcY, lastChrSrcY, lastInChrBuf);
+ firstChrSrcY, lastChrSrcY, lastInChrBuf);
// Do we have enough lines in this slice to output the dstY line
- enough_lines = lastLumSrcY2 < srcSliceY + srcSliceH && lastChrSrcY < -((-srcSliceY - srcSliceH)>>c->chrSrcVSubSample);
+ enough_lines = lastLumSrcY2 < srcSliceY + srcSliceH &&
+ lastChrSrcY < -((-srcSliceY - srcSliceH) >> c->chrSrcVSubSample);
if (!enough_lines) {
lastLumSrcY = srcSliceY + srcSliceH - 1;
lastChrSrcY = chrSrcSliceY + chrSrcSliceH - 1;
DEBUG_BUFFERS("buffering slice: lastLumSrcY %d lastChrSrcY %d\n",
- lastLumSrcY, lastChrSrcY);
+ lastLumSrcY, lastChrSrcY);
}
- //Do horizontal scaling
- while(lastInLumBuf < lastLumSrcY) {
+ // Do horizontal scaling
+ while (lastInLumBuf < lastLumSrcY) {
const uint8_t *src1[4] = {
src[0] + (lastInLumBuf + 1 - srcSliceY) * srcStride[0],
src[1] + (lastInLumBuf + 1 - srcSliceY) * srcStride[1],
@@ -2506,23 +498,21 @@ static int swScale(SwsContext *c, const uint8_t* src[],
src[3] + (lastInLumBuf + 1 - srcSliceY) * srcStride[3],
};
lumBufIndex++;
- assert(lumBufIndex < 2*vLumBufSize);
+ assert(lumBufIndex < 2 * vLumBufSize);
assert(lastInLumBuf + 1 - srcSliceY < srcSliceH);
assert(lastInLumBuf + 1 - srcSliceY >= 0);
- hyscale(c, lumPixBuf[ lumBufIndex ], dstW, src1, srcW, lumXInc,
+ hyscale(c, lumPixBuf[lumBufIndex], dstW, src1, srcW, lumXInc,
hLumFilter, hLumFilterPos, hLumFilterSize,
- formatConvBuffer,
- pal, 0);
+ formatConvBuffer, pal, 0);
if (CONFIG_SWSCALE_ALPHA && alpPixBuf)
- hyscale(c, alpPixBuf[ lumBufIndex ], dstW, src1, srcW,
+ hyscale(c, alpPixBuf[lumBufIndex], dstW, src1, srcW,
lumXInc, hLumFilter, hLumFilterPos, hLumFilterSize,
- formatConvBuffer,
- pal, 1);
+ formatConvBuffer, pal, 1);
lastInLumBuf++;
DEBUG_BUFFERS("\t\tlumBufIndex %d: lastInLumBuf: %d\n",
- lumBufIndex, lastInLumBuf);
+ lumBufIndex, lastInLumBuf);
}
- while(lastInChrBuf < lastChrSrcY) {
+ while (lastInChrBuf < lastChrSrcY) {
const uint8_t *src1[4] = {
src[0] + (lastInChrBuf + 1 - chrSrcSliceY) * srcStride[0],
src[1] + (lastInChrBuf + 1 - chrSrcSliceY) * srcStride[1],
@@ -2530,80 +520,90 @@ static int swScale(SwsContext *c, const uint8_t* src[],
src[3] + (lastInChrBuf + 1 - chrSrcSliceY) * srcStride[3],
};
chrBufIndex++;
- assert(chrBufIndex < 2*vChrBufSize);
+ assert(chrBufIndex < 2 * vChrBufSize);
assert(lastInChrBuf + 1 - chrSrcSliceY < (chrSrcSliceH));
assert(lastInChrBuf + 1 - chrSrcSliceY >= 0);
- //FIXME replace parameters through context struct (some at least)
+ // FIXME replace parameters through context struct (some at least)
if (c->needs_hcscale)
hcscale(c, chrUPixBuf[chrBufIndex], chrVPixBuf[chrBufIndex],
- chrDstW, src1, chrSrcW, chrXInc,
- hChrFilter, hChrFilterPos, hChrFilterSize,
- formatConvBuffer, pal);
+ chrDstW, src1, chrSrcW, chrXInc,
+ hChrFilter, hChrFilterPos, hChrFilterSize,
+ formatConvBuffer, pal);
lastInChrBuf++;
DEBUG_BUFFERS("\t\tchrBufIndex %d: lastInChrBuf: %d\n",
- chrBufIndex, lastInChrBuf);
+ chrBufIndex, lastInChrBuf);
}
- //wrap buf index around to stay inside the ring buffer
- if (lumBufIndex >= vLumBufSize) lumBufIndex-= vLumBufSize;
- if (chrBufIndex >= vChrBufSize) chrBufIndex-= vChrBufSize;
+ // wrap buf index around to stay inside the ring buffer
+ if (lumBufIndex >= vLumBufSize)
+ lumBufIndex -= vLumBufSize;
+ if (chrBufIndex >= vChrBufSize)
+ chrBufIndex -= vChrBufSize;
if (!enough_lines)
- break; //we can't output a dstY line so let's try with the next slice
+ break; // we can't output a dstY line so let's try with the next slice
-#if HAVE_MMX
- updateMMXDitherTables(c, dstY, lumBufIndex, chrBufIndex, lastInLumBuf, lastInChrBuf);
+#if HAVE_MMX_INLINE
+ updateMMXDitherTables(c, dstY, lumBufIndex, chrBufIndex,
+ lastInLumBuf, lastInChrBuf);
#endif
if (should_dither) {
c->chrDither8 = dither_8x8_128[chrDstY & 7];
- c->lumDither8 = dither_8x8_128[dstY & 7];
+ c->lumDither8 = dither_8x8_128[dstY & 7];
}
- if (dstY >= dstH-2) {
- // hmm looks like we can't use MMX here without overwriting this array's tail
- find_c_packed_planar_out_funcs(c, &yuv2plane1, &yuv2planeX, &yuv2nv12cX,
- &yuv2packed1, &yuv2packed2, &yuv2packedX);
+ if (dstY >= dstH - 2) {
+ /* hmm looks like we can't use MMX here without overwriting
+ * this array's tail */
+ ff_sws_init_output_funcs(c, &yuv2plane1, &yuv2planeX, &yuv2nv12cX,
+ &yuv2packed1, &yuv2packed2, &yuv2packedX);
}
{
- const int16_t **lumSrcPtr= (const int16_t **) lumPixBuf + lumBufIndex + firstLumSrcY - lastInLumBuf + vLumBufSize;
- const int16_t **chrUSrcPtr= (const int16_t **) chrUPixBuf + chrBufIndex + firstChrSrcY - lastInChrBuf + vChrBufSize;
- const int16_t **chrVSrcPtr= (const int16_t **) chrVPixBuf + chrBufIndex + firstChrSrcY - lastInChrBuf + vChrBufSize;
- const int16_t **alpSrcPtr= (CONFIG_SWSCALE_ALPHA && alpPixBuf) ? (const int16_t **) alpPixBuf + lumBufIndex + firstLumSrcY - lastInLumBuf + vLumBufSize : NULL;
+ const int16_t **lumSrcPtr = (const int16_t **)lumPixBuf + lumBufIndex + firstLumSrcY - lastInLumBuf + vLumBufSize;
+ const int16_t **chrUSrcPtr = (const int16_t **)chrUPixBuf + chrBufIndex + firstChrSrcY - lastInChrBuf + vChrBufSize;
+ const int16_t **chrVSrcPtr = (const int16_t **)chrVPixBuf + chrBufIndex + firstChrSrcY - lastInChrBuf + vChrBufSize;
+ const int16_t **alpSrcPtr = (CONFIG_SWSCALE_ALPHA && alpPixBuf) ?
+ (const int16_t **)alpPixBuf + lumBufIndex + firstLumSrcY - lastInLumBuf + vLumBufSize : NULL;
if (firstLumSrcY < 0 || firstLumSrcY + vLumFilterSize > c->srcH) {
- const int16_t **tmpY = (const int16_t **) lumPixBuf + 2 * vLumBufSize;
- int neg = -firstLumSrcY, i, end = FFMIN(c->srcH - firstLumSrcY, vLumFilterSize);
- for (i = 0; i < neg; i++)
+ const int16_t **tmpY = (const int16_t **)lumPixBuf +
+ 2 * vLumBufSize;
+ int neg = -firstLumSrcY, i;
+ int end = FFMIN(c->srcH - firstLumSrcY, vLumFilterSize);
+ for (i = 0; i < neg; i++)
tmpY[i] = lumSrcPtr[neg];
- for ( ; i < end; i++)
+ for (; i < end; i++)
tmpY[i] = lumSrcPtr[i];
- for ( ; i < vLumFilterSize; i++)
- tmpY[i] = tmpY[i-1];
+ for (; i < vLumFilterSize; i++)
+ tmpY[i] = tmpY[i - 1];
lumSrcPtr = tmpY;
if (alpSrcPtr) {
- const int16_t **tmpA = (const int16_t **) alpPixBuf + 2 * vLumBufSize;
- for (i = 0; i < neg; i++)
+ const int16_t **tmpA = (const int16_t **)alpPixBuf +
+ 2 * vLumBufSize;
+ for (i = 0; i < neg; i++)
tmpA[i] = alpSrcPtr[neg];
- for ( ; i < end; i++)
+ for (; i < end; i++)
tmpA[i] = alpSrcPtr[i];
- for ( ; i < vLumFilterSize; i++)
+ for (; i < vLumFilterSize; i++)
tmpA[i] = tmpA[i - 1];
alpSrcPtr = tmpA;
}
}
- if (firstChrSrcY < 0 || firstChrSrcY + vChrFilterSize > c->chrSrcH) {
- const int16_t **tmpU = (const int16_t **) chrUPixBuf + 2 * vChrBufSize,
- **tmpV = (const int16_t **) chrVPixBuf + 2 * vChrBufSize;
- int neg = -firstChrSrcY, i, end = FFMIN(c->chrSrcH - firstChrSrcY, vChrFilterSize);
- for (i = 0; i < neg; i++) {
+ if (firstChrSrcY < 0 ||
+ firstChrSrcY + vChrFilterSize > c->chrSrcH) {
+ const int16_t **tmpU = (const int16_t **)chrUPixBuf + 2 * vChrBufSize,
+ **tmpV = (const int16_t **)chrVPixBuf + 2 * vChrBufSize;
+ int neg = -firstChrSrcY, i;
+ int end = FFMIN(c->chrSrcH - firstChrSrcY, vChrFilterSize);
+ for (i = 0; i < neg; i++) {
tmpU[i] = chrUSrcPtr[neg];
tmpV[i] = chrVSrcPtr[neg];
}
- for ( ; i < end; i++) {
+ for (; i < end; i++) {
tmpU[i] = chrUSrcPtr[i];
tmpV[i] = chrVSrcPtr[i];
}
- for ( ; i < vChrFilterSize; i++) {
+ for (; i < vChrFilterSize; i++) {
tmpU[i] = tmpU[i - 1];
tmpV[i] = tmpV[i - 1];
}
@@ -2611,57 +611,65 @@ static int swScale(SwsContext *c, const uint8_t* src[],
chrVSrcPtr = tmpV;
}
- if (isPlanarYUV(dstFormat) || dstFormat==PIX_FMT_GRAY8) { //YV12 like
- const int chrSkipMask= (1<<c->chrDstVSubSample)-1;
+ if (isPlanarYUV(dstFormat) ||
+ (isGray(dstFormat) && !isALPHA(dstFormat))) { // YV12 like
+ const int chrSkipMask = (1 << c->chrDstVSubSample) - 1;
if (vLumFilterSize == 1) {
yuv2plane1(lumSrcPtr[0], dest[0], dstW, c->lumDither8, 0);
} else {
- yuv2planeX(vLumFilter + dstY * vLumFilterSize, vLumFilterSize,
- lumSrcPtr, dest[0], dstW, c->lumDither8, 0);
+ yuv2planeX(vLumFilter + dstY * vLumFilterSize,
+ vLumFilterSize, lumSrcPtr, dest[0],
+ dstW, c->lumDither8, 0);
}
- if (!((dstY&chrSkipMask) || isGray(dstFormat))) {
+ if (!((dstY & chrSkipMask) || isGray(dstFormat))) {
if (yuv2nv12cX) {
- yuv2nv12cX(c, vChrFilter + chrDstY * vChrFilterSize, vChrFilterSize, chrUSrcPtr, chrVSrcPtr, dest[1], chrDstW);
+ yuv2nv12cX(c, vChrFilter + chrDstY * vChrFilterSize,
+ vChrFilterSize, chrUSrcPtr, chrVSrcPtr,
+ dest[1], chrDstW);
} else if (vChrFilterSize == 1) {
yuv2plane1(chrUSrcPtr[0], dest[1], chrDstW, c->chrDither8, 0);
yuv2plane1(chrVSrcPtr[0], dest[2], chrDstW, c->chrDither8, 3);
} else {
- yuv2planeX(vChrFilter + chrDstY * vChrFilterSize, vChrFilterSize,
- chrUSrcPtr, dest[1], chrDstW, c->chrDither8, 0);
- yuv2planeX(vChrFilter + chrDstY * vChrFilterSize, vChrFilterSize,
- chrVSrcPtr, dest[2], chrDstW, c->chrDither8, 3);
+ yuv2planeX(vChrFilter + chrDstY * vChrFilterSize,
+ vChrFilterSize, chrUSrcPtr, dest[1],
+ chrDstW, c->chrDither8, 0);
+ yuv2planeX(vChrFilter + chrDstY * vChrFilterSize,
+ vChrFilterSize, chrVSrcPtr, dest[2],
+ chrDstW, c->chrDither8, 3);
}
}
- if (CONFIG_SWSCALE_ALPHA && alpPixBuf){
+ if (CONFIG_SWSCALE_ALPHA && alpPixBuf) {
if (vLumFilterSize == 1) {
- yuv2plane1(alpSrcPtr[0], dest[3], dstW, c->lumDither8, 0);
+ yuv2plane1(alpSrcPtr[0], dest[3], dstW,
+ c->lumDither8, 0);
} else {
- yuv2planeX(vLumFilter + dstY * vLumFilterSize, vLumFilterSize,
- alpSrcPtr, dest[3], dstW, c->lumDither8, 0);
+ yuv2planeX(vLumFilter + dstY * vLumFilterSize,
+ vLumFilterSize, alpSrcPtr, dest[3],
+ dstW, c->lumDither8, 0);
}
}
} else {
- assert(lumSrcPtr + vLumFilterSize - 1 < lumPixBuf + vLumBufSize*2);
- assert(chrUSrcPtr + vChrFilterSize - 1 < chrUPixBuf + vChrBufSize*2);
- if (c->yuv2packed1 && vLumFilterSize == 1 && vChrFilterSize == 2) { //unscaled RGB
- int chrAlpha = vChrFilter[2 * dstY + 1];
+ if (c->yuv2packed1 && vLumFilterSize == 1 &&
+ vChrFilterSize <= 2) { // unscaled RGB
+ int chrAlpha = vChrFilterSize == 1 ? 0 : vChrFilter[2 * dstY + 1];
yuv2packed1(c, *lumSrcPtr, chrUSrcPtr, chrVSrcPtr,
alpPixBuf ? *alpSrcPtr : NULL,
dest[0], dstW, chrAlpha, dstY);
- } else if (c->yuv2packed2 && vLumFilterSize == 2 && vChrFilterSize == 2) { //bilinear upscale RGB
+ } else if (c->yuv2packed2 && vLumFilterSize == 2 &&
+ vChrFilterSize == 2) { // bilinear upscale RGB
int lumAlpha = vLumFilter[2 * dstY + 1];
int chrAlpha = vChrFilter[2 * dstY + 1];
lumMmxFilter[2] =
- lumMmxFilter[3] = vLumFilter[2 * dstY ] * 0x10001;
+ lumMmxFilter[3] = vLumFilter[2 * dstY] * 0x10001;
chrMmxFilter[2] =
chrMmxFilter[3] = vChrFilter[2 * chrDstY] * 0x10001;
yuv2packed2(c, lumSrcPtr, chrUSrcPtr, chrVSrcPtr,
alpPixBuf ? alpSrcPtr : NULL,
dest[0], dstW, lumAlpha, chrAlpha, dstY);
- } else { //general RGB
+ } else { // general RGB
yuv2packedX(c, vLumFilter + dstY * vLumFilterSize,
lumSrcPtr, vLumFilterSize,
vChrFilter + dstY * vChrFilterSize,
@@ -2672,200 +680,46 @@ static int swScale(SwsContext *c, const uint8_t* src[],
}
}
- if ((dstFormat == PIX_FMT_YUVA420P) && !alpPixBuf)
- fillPlane(dst[3], dstStride[3], dstW, dstY-lastDstY, lastDstY, 255);
+ if (isPlanar(dstFormat) && isALPHA(dstFormat) && !alpPixBuf) {
+ int length = dstW;
+ int height = dstY - lastDstY;
+ if (is16BPS(c->dstFormat))
+ length *= 2;
+
+ if (is9_OR_10BPS(dstFormat)) {
+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(dstFormat);
+ fill_plane9or10(dst[3], dstStride[3], length, height, lastDstY,
+ 255, desc->comp[3].depth_minus1 + 1,
+ isBE(dstFormat));
+ } else
+ fillPlane(dst[3], dstStride[3], length, height, lastDstY, 255);
+ }
-#if HAVE_MMX2
- if (av_get_cpu_flags() & AV_CPU_FLAG_MMX2)
- __asm__ volatile("sfence":::"memory");
+#if HAVE_MMXEXT_INLINE
+ if (av_get_cpu_flags() & AV_CPU_FLAG_MMXEXT)
+ __asm__ volatile ("sfence" ::: "memory");
#endif
emms_c();
/* store changed local vars back in the context */
- c->dstY= dstY;
- c->lumBufIndex= lumBufIndex;
- c->chrBufIndex= chrBufIndex;
- c->lastInLumBuf= lastInLumBuf;
- c->lastInChrBuf= lastInChrBuf;
+ c->dstY = dstY;
+ c->lumBufIndex = lumBufIndex;
+ c->chrBufIndex = chrBufIndex;
+ c->lastInLumBuf = lastInLumBuf;
+ c->lastInChrBuf = lastInChrBuf;
return dstY - lastDstY;
}
static av_cold void sws_init_swScale_c(SwsContext *c)
{
- enum PixelFormat srcFormat = c->srcFormat;
-
- find_c_packed_planar_out_funcs(c, &c->yuv2plane1, &c->yuv2planeX,
- &c->yuv2nv12cX, &c->yuv2packed1, &c->yuv2packed2,
- &c->yuv2packedX);
-
- c->chrToYV12 = NULL;
- switch(srcFormat) {
- case PIX_FMT_YUYV422 : c->chrToYV12 = yuy2ToUV_c; break;
- case PIX_FMT_UYVY422 : c->chrToYV12 = uyvyToUV_c; break;
- case PIX_FMT_NV12 : c->chrToYV12 = nv12ToUV_c; break;
- case PIX_FMT_NV21 : c->chrToYV12 = nv21ToUV_c; break;
- case PIX_FMT_RGB8 :
- case PIX_FMT_BGR8 :
- case PIX_FMT_PAL8 :
- case PIX_FMT_BGR4_BYTE:
- case PIX_FMT_RGB4_BYTE: c->chrToYV12 = palToUV_c; break;
- case PIX_FMT_GBRP9LE:
- case PIX_FMT_GBRP10LE:
- case PIX_FMT_GBRP16LE: c->readChrPlanar = planar_rgb16le_to_uv; break;
- case PIX_FMT_GBRP9BE:
- case PIX_FMT_GBRP10BE:
- case PIX_FMT_GBRP16BE: c->readChrPlanar = planar_rgb16be_to_uv; break;
- case PIX_FMT_GBRP: c->readChrPlanar = planar_rgb_to_uv; break;
-#if HAVE_BIGENDIAN
- case PIX_FMT_YUV444P9LE:
- case PIX_FMT_YUV422P9LE:
- case PIX_FMT_YUV420P9LE:
- case PIX_FMT_YUV422P10LE:
- case PIX_FMT_YUV444P10LE:
- case PIX_FMT_YUV420P10LE:
- case PIX_FMT_YUV420P16LE:
- case PIX_FMT_YUV422P16LE:
- case PIX_FMT_YUV444P16LE: c->chrToYV12 = bswap16UV_c; break;
-#else
- case PIX_FMT_YUV444P9BE:
- case PIX_FMT_YUV422P9BE:
- case PIX_FMT_YUV420P9BE:
- case PIX_FMT_YUV444P10BE:
- case PIX_FMT_YUV422P10BE:
- case PIX_FMT_YUV420P10BE:
- case PIX_FMT_YUV420P16BE:
- case PIX_FMT_YUV422P16BE:
- case PIX_FMT_YUV444P16BE: c->chrToYV12 = bswap16UV_c; break;
-#endif
- }
- if (c->chrSrcHSubSample) {
- switch(srcFormat) {
- case PIX_FMT_RGB48BE : c->chrToYV12 = rgb48BEToUV_half_c; break;
- case PIX_FMT_RGB48LE : c->chrToYV12 = rgb48LEToUV_half_c; break;
- case PIX_FMT_BGR48BE : c->chrToYV12 = bgr48BEToUV_half_c; break;
- case PIX_FMT_BGR48LE : c->chrToYV12 = bgr48LEToUV_half_c; break;
- case PIX_FMT_RGB32 : c->chrToYV12 = bgr32ToUV_half_c; break;
- case PIX_FMT_RGB32_1 : c->chrToYV12 = bgr321ToUV_half_c; break;
- case PIX_FMT_BGR24 : c->chrToYV12 = bgr24ToUV_half_c; break;
- case PIX_FMT_BGR565LE: c->chrToYV12 = bgr16leToUV_half_c; break;
- case PIX_FMT_BGR565BE: c->chrToYV12 = bgr16beToUV_half_c; break;
- case PIX_FMT_BGR555LE: c->chrToYV12 = bgr15leToUV_half_c; break;
- case PIX_FMT_BGR555BE: c->chrToYV12 = bgr15beToUV_half_c; break;
- case PIX_FMT_BGR444LE: c->chrToYV12 = bgr12leToUV_half_c; break;
- case PIX_FMT_BGR444BE: c->chrToYV12 = bgr12beToUV_half_c; break;
- case PIX_FMT_BGR32 : c->chrToYV12 = rgb32ToUV_half_c; break;
- case PIX_FMT_BGR32_1 : c->chrToYV12 = rgb321ToUV_half_c; break;
- case PIX_FMT_RGB24 : c->chrToYV12 = rgb24ToUV_half_c; break;
- case PIX_FMT_RGB565LE: c->chrToYV12 = rgb16leToUV_half_c; break;
- case PIX_FMT_RGB565BE: c->chrToYV12 = rgb16beToUV_half_c; break;
- case PIX_FMT_RGB555LE: c->chrToYV12 = rgb15leToUV_half_c; break;
- case PIX_FMT_RGB555BE: c->chrToYV12 = rgb15beToUV_half_c; break;
- case PIX_FMT_RGB444LE: c->chrToYV12 = rgb12leToUV_half_c; break;
- case PIX_FMT_RGB444BE: c->chrToYV12 = rgb12beToUV_half_c; break;
- }
- } else {
- switch(srcFormat) {
- case PIX_FMT_RGB48BE : c->chrToYV12 = rgb48BEToUV_c; break;
- case PIX_FMT_RGB48LE : c->chrToYV12 = rgb48LEToUV_c; break;
- case PIX_FMT_BGR48BE : c->chrToYV12 = bgr48BEToUV_c; break;
- case PIX_FMT_BGR48LE : c->chrToYV12 = bgr48LEToUV_c; break;
- case PIX_FMT_RGB32 : c->chrToYV12 = bgr32ToUV_c; break;
- case PIX_FMT_RGB32_1 : c->chrToYV12 = bgr321ToUV_c; break;
- case PIX_FMT_BGR24 : c->chrToYV12 = bgr24ToUV_c; break;
- case PIX_FMT_BGR565LE: c->chrToYV12 = bgr16leToUV_c; break;
- case PIX_FMT_BGR565BE: c->chrToYV12 = bgr16beToUV_c; break;
- case PIX_FMT_BGR555LE: c->chrToYV12 = bgr15leToUV_c; break;
- case PIX_FMT_BGR555BE: c->chrToYV12 = bgr15beToUV_c; break;
- case PIX_FMT_BGR444LE: c->chrToYV12 = bgr12leToUV_c; break;
- case PIX_FMT_BGR444BE: c->chrToYV12 = bgr12beToUV_c; break;
- case PIX_FMT_BGR32 : c->chrToYV12 = rgb32ToUV_c; break;
- case PIX_FMT_BGR32_1 : c->chrToYV12 = rgb321ToUV_c; break;
- case PIX_FMT_RGB24 : c->chrToYV12 = rgb24ToUV_c; break;
- case PIX_FMT_RGB565LE: c->chrToYV12 = rgb16leToUV_c; break;
- case PIX_FMT_RGB565BE: c->chrToYV12 = rgb16beToUV_c; break;
- case PIX_FMT_RGB555LE: c->chrToYV12 = rgb15leToUV_c; break;
- case PIX_FMT_RGB555BE: c->chrToYV12 = rgb15beToUV_c; break;
- case PIX_FMT_RGB444LE: c->chrToYV12 = rgb12leToUV_c; break;
- case PIX_FMT_RGB444BE: c->chrToYV12 = rgb12beToUV_c; break;
- }
- }
+ enum AVPixelFormat srcFormat = c->srcFormat;
- c->lumToYV12 = NULL;
- c->alpToYV12 = NULL;
- switch (srcFormat) {
- case PIX_FMT_GBRP9LE:
- case PIX_FMT_GBRP10LE:
- case PIX_FMT_GBRP16LE: c->readLumPlanar = planar_rgb16le_to_y; break;
- case PIX_FMT_GBRP9BE:
- case PIX_FMT_GBRP10BE:
- case PIX_FMT_GBRP16BE: c->readLumPlanar = planar_rgb16be_to_y; break;
- case PIX_FMT_GBRP: c->readLumPlanar = planar_rgb_to_y; break;
-#if HAVE_BIGENDIAN
- case PIX_FMT_YUV444P9LE:
- case PIX_FMT_YUV422P9LE:
- case PIX_FMT_YUV420P9LE:
- case PIX_FMT_YUV444P10LE:
- case PIX_FMT_YUV422P10LE:
- case PIX_FMT_YUV420P10LE:
- case PIX_FMT_YUV420P16LE:
- case PIX_FMT_YUV422P16LE:
- case PIX_FMT_YUV444P16LE:
- case PIX_FMT_GRAY16LE: c->lumToYV12 = bswap16Y_c; break;
-#else
- case PIX_FMT_YUV444P9BE:
- case PIX_FMT_YUV422P9BE:
- case PIX_FMT_YUV420P9BE:
- case PIX_FMT_YUV444P10BE:
- case PIX_FMT_YUV422P10BE:
- case PIX_FMT_YUV420P10BE:
- case PIX_FMT_YUV420P16BE:
- case PIX_FMT_YUV422P16BE:
- case PIX_FMT_YUV444P16BE:
- case PIX_FMT_GRAY16BE: c->lumToYV12 = bswap16Y_c; break;
-#endif
- case PIX_FMT_YUYV422 :
- case PIX_FMT_Y400A : c->lumToYV12 = yuy2ToY_c; break;
- case PIX_FMT_UYVY422 : c->lumToYV12 = uyvyToY_c; break;
- case PIX_FMT_BGR24 : c->lumToYV12 = bgr24ToY_c; break;
- case PIX_FMT_BGR565LE : c->lumToYV12 = bgr16leToY_c; break;
- case PIX_FMT_BGR565BE : c->lumToYV12 = bgr16beToY_c; break;
- case PIX_FMT_BGR555LE : c->lumToYV12 = bgr15leToY_c; break;
- case PIX_FMT_BGR555BE : c->lumToYV12 = bgr15beToY_c; break;
- case PIX_FMT_BGR444LE : c->lumToYV12 = bgr12leToY_c; break;
- case PIX_FMT_BGR444BE : c->lumToYV12 = bgr12beToY_c; break;
- case PIX_FMT_RGB24 : c->lumToYV12 = rgb24ToY_c; break;
- case PIX_FMT_RGB565LE : c->lumToYV12 = rgb16leToY_c; break;
- case PIX_FMT_RGB565BE : c->lumToYV12 = rgb16beToY_c; break;
- case PIX_FMT_RGB555LE : c->lumToYV12 = rgb15leToY_c; break;
- case PIX_FMT_RGB555BE : c->lumToYV12 = rgb15beToY_c; break;
- case PIX_FMT_RGB444LE : c->lumToYV12 = rgb12leToY_c; break;
- case PIX_FMT_RGB444BE : c->lumToYV12 = rgb12beToY_c; break;
- case PIX_FMT_RGB8 :
- case PIX_FMT_BGR8 :
- case PIX_FMT_PAL8 :
- case PIX_FMT_BGR4_BYTE:
- case PIX_FMT_RGB4_BYTE: c->lumToYV12 = palToY_c; break;
- case PIX_FMT_MONOBLACK: c->lumToYV12 = monoblack2Y_c; break;
- case PIX_FMT_MONOWHITE: c->lumToYV12 = monowhite2Y_c; break;
- case PIX_FMT_RGB32 : c->lumToYV12 = bgr32ToY_c; break;
- case PIX_FMT_RGB32_1: c->lumToYV12 = bgr321ToY_c; break;
- case PIX_FMT_BGR32 : c->lumToYV12 = rgb32ToY_c; break;
- case PIX_FMT_BGR32_1: c->lumToYV12 = rgb321ToY_c; break;
- case PIX_FMT_RGB48BE: c->lumToYV12 = rgb48BEToY_c; break;
- case PIX_FMT_RGB48LE: c->lumToYV12 = rgb48LEToY_c; break;
- case PIX_FMT_BGR48BE: c->lumToYV12 = bgr48BEToY_c; break;
- case PIX_FMT_BGR48LE: c->lumToYV12 = bgr48LEToY_c; break;
- }
- if (c->alpPixBuf) {
- switch (srcFormat) {
- case PIX_FMT_BGRA:
- case PIX_FMT_RGBA: c->alpToYV12 = rgbaToA_c; break;
- case PIX_FMT_ABGR:
- case PIX_FMT_ARGB: c->alpToYV12 = abgrToA_c; break;
- case PIX_FMT_Y400A: c->alpToYV12 = uyvyToY_c; break;
- }
- }
+ ff_sws_init_output_funcs(c, &c->yuv2plane1, &c->yuv2planeX,
+ &c->yuv2nv12cX, &c->yuv2packed1,
+ &c->yuv2packed2, &c->yuv2packedX);
+
+ ff_sws_init_input_funcs(c);
if (c->srcBpc == 8) {
if (c->dstBpc <= 10) {
@@ -2878,7 +732,8 @@ static av_cold void sws_init_swScale_c(SwsContext *c)
c->hyScale = c->hcScale = hScale8To19_c;
}
} else {
- c->hyScale = c->hcScale = c->dstBpc > 10 ? hScale16To19_c : hScale16To15_c;
+ c->hyScale = c->hcScale = c->dstBpc > 10 ? hScale16To19_c
+ : hScale16To15_c;
}
if (c->srcRange != c->dstRange && !isAnyRGB(c->dstFormat)) {
@@ -2902,7 +757,7 @@ static av_cold void sws_init_swScale_c(SwsContext *c)
}
if (!(isGray(srcFormat) || isGray(c->dstFormat) ||
- srcFormat == PIX_FMT_MONOBLACK || srcFormat == PIX_FMT_MONOWHITE))
+ srcFormat == AV_PIX_FMT_MONOBLACK || srcFormat == AV_PIX_FMT_MONOWHITE))
c->needs_hcscale = 1;
}
diff --git a/gst-libs/ext/libav/libswscale/swscale.h b/gst-libs/ext/libav/libswscale/swscale.h
index b5a6a57..8ba09e6 100644
--- a/gst-libs/ext/libav/libswscale/swscale.h
+++ b/gst-libs/ext/libav/libswscale/swscale.h
@@ -27,34 +27,12 @@
* external api for the swscale stuff
*/
+#include <stdint.h>
+
#include "libavutil/avutil.h"
#include "libavutil/log.h"
#include "libavutil/pixfmt.h"
-
-#define LIBSWSCALE_VERSION_MAJOR 2
-#define LIBSWSCALE_VERSION_MINOR 1
-#define LIBSWSCALE_VERSION_MICRO 0
-
-#define LIBSWSCALE_VERSION_INT AV_VERSION_INT(LIBSWSCALE_VERSION_MAJOR, \
- LIBSWSCALE_VERSION_MINOR, \
- LIBSWSCALE_VERSION_MICRO)
-#define LIBSWSCALE_VERSION AV_VERSION(LIBSWSCALE_VERSION_MAJOR, \
- LIBSWSCALE_VERSION_MINOR, \
- LIBSWSCALE_VERSION_MICRO)
-#define LIBSWSCALE_BUILD LIBSWSCALE_VERSION_INT
-
-#define LIBSWSCALE_IDENT "SwS" AV_STRINGIFY(LIBSWSCALE_VERSION)
-
-/**
- * Those FF_API_* defines are not part of public API.
- * They may change, break or disappear at any time.
- */
-#ifndef FF_API_SWS_GETCONTEXT
-#define FF_API_SWS_GETCONTEXT (LIBSWSCALE_VERSION_MAJOR < 3)
-#endif
-#ifndef FF_API_SWS_CPU_CAPS
-#define FF_API_SWS_CPU_CAPS (LIBSWSCALE_VERSION_MAJOR < 3)
-#endif
+#include "version.h"
/**
* Return the LIBSWSCALE_VERSION_INT constant.
@@ -106,6 +84,7 @@ const char *swscale_license(void);
* are only provided for API compatibility.
*/
#define SWS_CPU_CAPS_MMX 0x80000000
+#define SWS_CPU_CAPS_MMXEXT 0x20000000
#define SWS_CPU_CAPS_MMX2 0x20000000
#define SWS_CPU_CAPS_3DNOW 0x40000000
#define SWS_CPU_CAPS_ALTIVEC 0x10000000
@@ -134,13 +113,13 @@ const int *sws_getCoefficients(int colorspace);
// when used for filters they must have an odd number of elements
// coeffs cannot be shared between vectors
-typedef struct {
+typedef struct SwsVector {
double *coeff; ///< pointer to the list of coefficients
int length; ///< number of coefficients in the vector
} SwsVector;
// vectors can be shared
-typedef struct {
+typedef struct SwsFilter {
SwsVector *lumH;
SwsVector *lumV;
SwsVector *chrH;
@@ -153,13 +132,13 @@ struct SwsContext;
* Return a positive value if pix_fmt is a supported input format, 0
* otherwise.
*/
-int sws_isSupportedInput(enum PixelFormat pix_fmt);
+int sws_isSupportedInput(enum AVPixelFormat pix_fmt);
/**
* Return a positive value if pix_fmt is a supported output format, 0
* otherwise.
*/
-int sws_isSupportedOutput(enum PixelFormat pix_fmt);
+int sws_isSupportedOutput(enum AVPixelFormat pix_fmt);
/**
* Allocate an empty SwsContext. This must be filled and passed to
@@ -199,8 +178,8 @@ void sws_freeContext(struct SwsContext *swsContext);
* written
* @deprecated Use sws_getCachedContext() instead.
*/
-struct SwsContext *sws_getContext(int srcW, int srcH, enum PixelFormat srcFormat,
- int dstW, int dstH, enum PixelFormat dstFormat,
+struct SwsContext *sws_getContext(int srcW, int srcH, enum AVPixelFormat srcFormat,
+ int dstW, int dstH, enum AVPixelFormat dstFormat,
int flags, SwsFilter *srcFilter,
SwsFilter *dstFilter, const double *param);
#endif
@@ -320,8 +299,8 @@ void sws_freeFilter(SwsFilter *filter);
* are assumed to remain the same.
*/
struct SwsContext *sws_getCachedContext(struct SwsContext *context,
- int srcW, int srcH, enum PixelFormat srcFormat,
- int dstW, int dstH, enum PixelFormat dstFormat,
+ int srcW, int srcH, enum AVPixelFormat srcFormat,
+ int dstW, int dstH, enum AVPixelFormat dstFormat,
int flags, SwsFilter *srcFilter,
SwsFilter *dstFilter, const double *param);
diff --git a/gst-libs/ext/libav/libswscale/swscale_internal.h b/gst-libs/ext/libav/libswscale/swscale_internal.h
index a716995..8752672 100644
--- a/gst-libs/ext/libav/libswscale/swscale_internal.h
+++ b/gst-libs/ext/libav/libswscale/swscale_internal.h
@@ -27,7 +27,9 @@
#include <altivec.h>
#endif
+#include "libavutil/avassert.h"
#include "libavutil/avutil.h"
+#include "libavutil/common.h"
#include "libavutil/log.h"
#include "libavutil/pixfmt.h"
#include "libavutil/pixdesc.h"
@@ -237,8 +239,8 @@ typedef struct SwsContext {
int chrDstH; ///< Height of destination chroma planes.
int lumXInc, chrXInc;
int lumYInc, chrYInc;
- enum PixelFormat dstFormat; ///< Destination pixel format.
- enum PixelFormat srcFormat; ///< Source pixel format.
+ enum AVPixelFormat dstFormat; ///< Destination pixel format.
+ enum AVPixelFormat srcFormat; ///< Source pixel format.
int dstFormatBpp; ///< Number of bits per pixel of the destination pixel format.
int srcFormatBpp; ///< Number of bits per pixel of the source pixel format.
int dstBpc, srcBpc;
@@ -305,12 +307,12 @@ typedef struct SwsContext {
int vChrFilterSize; ///< Vertical filter size for chroma pixels.
//@}
- int lumMmx2FilterCodeSize; ///< Runtime-generated MMX2 horizontal fast bilinear scaler code size for luma/alpha planes.
- int chrMmx2FilterCodeSize; ///< Runtime-generated MMX2 horizontal fast bilinear scaler code size for chroma planes.
- uint8_t *lumMmx2FilterCode; ///< Runtime-generated MMX2 horizontal fast bilinear scaler code for luma/alpha planes.
- uint8_t *chrMmx2FilterCode; ///< Runtime-generated MMX2 horizontal fast bilinear scaler code for chroma planes.
+ int lumMmxextFilterCodeSize; ///< Runtime-generated MMXEXT horizontal fast bilinear scaler code size for luma/alpha planes.
+ int chrMmxextFilterCodeSize; ///< Runtime-generated MMXEXT horizontal fast bilinear scaler code size for chroma planes.
+ uint8_t *lumMmxextFilterCode; ///< Runtime-generated MMXEXT horizontal fast bilinear scaler code for luma/alpha planes.
+ uint8_t *chrMmxextFilterCode; ///< Runtime-generated MMXEXT horizontal fast bilinear scaler code for chroma planes.
- int canMMX2BeUsed;
+ int canMMXEXTBeUsed;
int dstY; ///< Last destination vertical line output from last slice.
int flags; ///< Flags passed by the user to select scaler algorithm, optimizations, subsampling, etc...
@@ -535,33 +537,53 @@ void updateMMXDitherTables(SwsContext *c, int dstY, int lumBufIndex, int chrBufI
SwsFunc ff_yuv2rgb_init_mmx(SwsContext *c);
SwsFunc ff_yuv2rgb_init_vis(SwsContext *c);
-SwsFunc ff_yuv2rgb_init_mlib(SwsContext *c);
SwsFunc ff_yuv2rgb_init_altivec(SwsContext *c);
SwsFunc ff_yuv2rgb_get_func_ptr_bfin(SwsContext *c);
void ff_bfin_get_unscaled_swscale(SwsContext *c);
-const char *sws_format_name(enum PixelFormat format);
-
-#define is16BPS(x) \
- (av_pix_fmt_descriptors[x].comp[0].depth_minus1 == 15)
-
-#define is9_OR_10BPS(x) \
- (av_pix_fmt_descriptors[x].comp[0].depth_minus1 == 8 || \
- av_pix_fmt_descriptors[x].comp[0].depth_minus1 == 9)
-
-#define isBE(x) \
- (av_pix_fmt_descriptors[x].flags & PIX_FMT_BE)
-
-#define isYUV(x) \
- (!(av_pix_fmt_descriptors[x].flags & PIX_FMT_RGB) && \
- av_pix_fmt_descriptors[x].nb_components >= 2)
-
-#define isPlanarYUV(x) \
- ((av_pix_fmt_descriptors[x].flags & PIX_FMT_PLANAR) && \
- isYUV(x))
-
-#define isRGB(x) \
- (av_pix_fmt_descriptors[x].flags & PIX_FMT_RGB)
+const char *sws_format_name(enum AVPixelFormat format);
+
+static av_always_inline int is16BPS(enum AVPixelFormat pix_fmt)
+{
+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
+ av_assert0(desc);
+ return desc->comp[0].depth_minus1 == 15;
+}
+
+static av_always_inline int is9_OR_10BPS(enum AVPixelFormat pix_fmt)
+{
+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
+ av_assert0(desc);
+ return desc->comp[0].depth_minus1 == 8 || desc->comp[0].depth_minus1 == 9;
+}
+
+static av_always_inline int isBE(enum AVPixelFormat pix_fmt)
+{
+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
+ av_assert0(desc);
+ return desc->flags & PIX_FMT_BE;
+}
+
+static av_always_inline int isYUV(enum AVPixelFormat pix_fmt)
+{
+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
+ av_assert0(desc);
+ return !(desc->flags & PIX_FMT_RGB) && desc->nb_components >= 2;
+}
+
+static av_always_inline int isPlanarYUV(enum AVPixelFormat pix_fmt)
+{
+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
+ av_assert0(desc);
+ return ((desc->flags & PIX_FMT_PLANAR) && isYUV(pix_fmt));
+}
+
+static av_always_inline int isRGB(enum AVPixelFormat pix_fmt)
+{
+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
+ av_assert0(desc);
+ return (desc->flags & PIX_FMT_RGB);
+}
#if 0 // FIXME
#define isGray(x) \
@@ -569,66 +591,96 @@ const char *sws_format_name(enum PixelFormat format);
av_pix_fmt_descriptors[x].nb_components <= 2)
#else
#define isGray(x) \
- ((x) == PIX_FMT_GRAY8 || \
- (x) == PIX_FMT_Y400A || \
- (x) == PIX_FMT_GRAY16BE || \
- (x) == PIX_FMT_GRAY16LE)
+ ((x) == AV_PIX_FMT_GRAY8 || \
+ (x) == AV_PIX_FMT_Y400A || \
+ (x) == AV_PIX_FMT_GRAY16BE || \
+ (x) == AV_PIX_FMT_GRAY16LE)
#endif
#define isRGBinInt(x) \
- ((x) == PIX_FMT_RGB48BE || \
- (x) == PIX_FMT_RGB48LE || \
- (x) == PIX_FMT_RGB32 || \
- (x) == PIX_FMT_RGB32_1 || \
- (x) == PIX_FMT_RGB24 || \
- (x) == PIX_FMT_RGB565BE || \
- (x) == PIX_FMT_RGB565LE || \
- (x) == PIX_FMT_RGB555BE || \
- (x) == PIX_FMT_RGB555LE || \
- (x) == PIX_FMT_RGB444BE || \
- (x) == PIX_FMT_RGB444LE || \
- (x) == PIX_FMT_RGB8 || \
- (x) == PIX_FMT_RGB4 || \
- (x) == PIX_FMT_RGB4_BYTE || \
- (x) == PIX_FMT_MONOBLACK || \
- (x) == PIX_FMT_MONOWHITE)
+ ((x) == AV_PIX_FMT_RGB48BE || \
+ (x) == AV_PIX_FMT_RGB48LE || \
+ (x) == AV_PIX_FMT_RGB32 || \
+ (x) == AV_PIX_FMT_RGB32_1 || \
+ (x) == AV_PIX_FMT_RGB24 || \
+ (x) == AV_PIX_FMT_RGB565BE || \
+ (x) == AV_PIX_FMT_RGB565LE || \
+ (x) == AV_PIX_FMT_RGB555BE || \
+ (x) == AV_PIX_FMT_RGB555LE || \
+ (x) == AV_PIX_FMT_RGB444BE || \
+ (x) == AV_PIX_FMT_RGB444LE || \
+ (x) == AV_PIX_FMT_RGB8 || \
+ (x) == AV_PIX_FMT_RGB4 || \
+ (x) == AV_PIX_FMT_RGB4_BYTE || \
+ (x) == AV_PIX_FMT_MONOBLACK || \
+ (x) == AV_PIX_FMT_MONOWHITE)
#define isBGRinInt(x) \
- ((x) == PIX_FMT_BGR48BE || \
- (x) == PIX_FMT_BGR48LE || \
- (x) == PIX_FMT_BGR32 || \
- (x) == PIX_FMT_BGR32_1 || \
- (x) == PIX_FMT_BGR24 || \
- (x) == PIX_FMT_BGR565BE || \
- (x) == PIX_FMT_BGR565LE || \
- (x) == PIX_FMT_BGR555BE || \
- (x) == PIX_FMT_BGR555LE || \
- (x) == PIX_FMT_BGR444BE || \
- (x) == PIX_FMT_BGR444LE || \
- (x) == PIX_FMT_BGR8 || \
- (x) == PIX_FMT_BGR4 || \
- (x) == PIX_FMT_BGR4_BYTE || \
- (x) == PIX_FMT_MONOBLACK || \
- (x) == PIX_FMT_MONOWHITE)
+ ((x) == AV_PIX_FMT_BGR48BE || \
+ (x) == AV_PIX_FMT_BGR48LE || \
+ (x) == AV_PIX_FMT_BGR32 || \
+ (x) == AV_PIX_FMT_BGR32_1 || \
+ (x) == AV_PIX_FMT_BGR24 || \
+ (x) == AV_PIX_FMT_BGR565BE || \
+ (x) == AV_PIX_FMT_BGR565LE || \
+ (x) == AV_PIX_FMT_BGR555BE || \
+ (x) == AV_PIX_FMT_BGR555LE || \
+ (x) == AV_PIX_FMT_BGR444BE || \
+ (x) == AV_PIX_FMT_BGR444LE || \
+ (x) == AV_PIX_FMT_BGR8 || \
+ (x) == AV_PIX_FMT_BGR4 || \
+ (x) == AV_PIX_FMT_BGR4_BYTE || \
+ (x) == AV_PIX_FMT_MONOBLACK || \
+ (x) == AV_PIX_FMT_MONOWHITE)
#define isAnyRGB(x) \
(isRGBinInt(x) || \
isBGRinInt(x))
-#define isALPHA(x) \
- (av_pix_fmt_descriptors[x].nb_components == 2 || \
- av_pix_fmt_descriptors[x].nb_components == 4)
-
-#define isPacked(x) \
- ((av_pix_fmt_descriptors[x].nb_components >= 2 && \
- !(av_pix_fmt_descriptors[x].flags & PIX_FMT_PLANAR)) || \
- (x) == PIX_FMT_PAL8)
-
-#define isPlanar(x) \
- (av_pix_fmt_descriptors[x].nb_components >= 2 && \
- (av_pix_fmt_descriptors[x].flags & PIX_FMT_PLANAR))
-
-#define usePal(x) ((av_pix_fmt_descriptors[x].flags & PIX_FMT_PAL) || (x) == PIX_FMT_Y400A)
+static av_always_inline int isALPHA(enum AVPixelFormat pix_fmt)
+{
+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
+ av_assert0(desc);
+ return desc->nb_components == 2 || desc->nb_components == 4;
+}
+
+static av_always_inline int isPacked(enum AVPixelFormat pix_fmt)
+{
+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
+ av_assert0(desc);
+ return ((desc->nb_components >= 2 && !(desc->flags & PIX_FMT_PLANAR)) ||
+ pix_fmt == AV_PIX_FMT_PAL8);
+}
+
+static av_always_inline int isPlanar(enum AVPixelFormat pix_fmt)
+{
+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
+ av_assert0(desc);
+ return (desc->nb_components >= 2 && (desc->flags & PIX_FMT_PLANAR));
+}
+
+static av_always_inline int isPackedRGB(enum AVPixelFormat pix_fmt)
+{
+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
+ av_assert0(desc);
+ return ((desc->flags & (PIX_FMT_PLANAR | PIX_FMT_RGB)) == PIX_FMT_RGB);
+}
+
+static av_always_inline int isPlanarRGB(enum AVPixelFormat pix_fmt)
+{
+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
+ av_assert0(desc);
+ return ((desc->flags & (PIX_FMT_PLANAR | PIX_FMT_RGB)) ==
+ (PIX_FMT_PLANAR | PIX_FMT_RGB));
+}
+
+static av_always_inline int usePal(enum AVPixelFormat pix_fmt)
+{
+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
+ av_assert0(desc);
+ return ((desc->flags & PIX_FMT_PAL) || (desc->flags & PIX_FMT_PSEUDOPAL) ||
+ pix_fmt == AV_PIX_FMT_Y400A);
+}
extern const uint64_t ff_dither4[2];
extern const uint64_t ff_dither8[2];
@@ -649,6 +701,14 @@ void ff_swscale_get_unscaled_altivec(SwsContext *c);
*/
SwsFunc ff_getSwsFunc(SwsContext *c);
+void ff_sws_init_input_funcs(SwsContext *c);
+void ff_sws_init_output_funcs(SwsContext *c,
+ yuv2planar1_fn *yuv2plane1,
+ yuv2planarX_fn *yuv2planeX,
+ yuv2interleavedX_fn *yuv2nv12cX,
+ yuv2packed1_fn *yuv2packed1,
+ yuv2packed2_fn *yuv2packed2,
+ yuv2packedX_fn *yuv2packedX);
void ff_sws_init_swScale_altivec(SwsContext *c);
void ff_sws_init_swScale_mmx(SwsContext *c);
diff --git a/gst-libs/ext/libav/libswscale/swscale_unscaled.c b/gst-libs/ext/libav/libswscale/swscale_unscaled.c
index 5fe2b14..9b919f8 100644
--- a/gst-libs/ext/libav/libswscale/swscale_unscaled.c
+++ b/gst-libs/ext/libav/libswscale/swscale_unscaled.c
@@ -98,6 +98,27 @@ static void fillPlane(uint8_t *plane, int stride, int width, int height, int y,
}
}
+static void fill_plane9or10(uint8_t *plane, int stride, int width,
+ int height, int y, uint8_t val,
+ const int dst_depth, const int big_endian)
+{
+ int i, j;
+ uint16_t *dst = (uint16_t *) (plane + stride * y);
+#define FILL8TO9_OR_10(wfunc) \
+ for (i = 0; i < height; i++) { \
+ for (j = 0; j < width; j++) { \
+ wfunc(&dst[j], (val << (dst_depth - 8)) | \
+ (val >> (16 - dst_depth))); \
+ } \
+ dst += stride / 2; \
+ }
+ if (big_endian) {
+ FILL8TO9_OR_10(AV_WB16);
+ } else {
+ FILL8TO9_OR_10(AV_WL16);
+ }
+}
+
static void copyPlane(const uint8_t *src, int srcStride,
int srcSliceY, int srcSliceH, int width,
uint8_t *dst, int dstStride)
@@ -125,7 +146,7 @@ static int planarToNv12Wrapper(SwsContext *c, const uint8_t *src[],
copyPlane(src[0], srcStride[0], srcSliceY, srcSliceH, c->srcW,
dstParam[0], dstStride[0]);
- if (c->dstFormat == PIX_FMT_NV12)
+ if (c->dstFormat == AV_PIX_FMT_NV12)
interleaveBytes(src[1], src[2], dst, c->srcW / 2, srcSliceH / 2,
srcStride[1], srcStride[2], dstStride[0]);
else
@@ -302,31 +323,31 @@ static int palToRgbWrapper(SwsContext *c, const uint8_t *src[], int srcStride[],
int srcSliceY, int srcSliceH, uint8_t *dst[],
int dstStride[])
{
- const enum PixelFormat srcFormat = c->srcFormat;
- const enum PixelFormat dstFormat = c->dstFormat;
+ const enum AVPixelFormat srcFormat = c->srcFormat;
+ const enum AVPixelFormat dstFormat = c->dstFormat;
void (*conv)(const uint8_t *src, uint8_t *dst, int num_pixels,
const uint8_t *palette) = NULL;
int i;
uint8_t *dstPtr = dst[0] + dstStride[0] * srcSliceY;
const uint8_t *srcPtr = src[0];
- if (srcFormat == PIX_FMT_Y400A) {
+ if (srcFormat == AV_PIX_FMT_Y400A) {
switch (dstFormat) {
- case PIX_FMT_RGB32 : conv = gray8aToPacked32; break;
- case PIX_FMT_BGR32 : conv = gray8aToPacked32; break;
- case PIX_FMT_BGR32_1: conv = gray8aToPacked32_1; break;
- case PIX_FMT_RGB32_1: conv = gray8aToPacked32_1; break;
- case PIX_FMT_RGB24 : conv = gray8aToPacked24; break;
- case PIX_FMT_BGR24 : conv = gray8aToPacked24; break;
+ case AV_PIX_FMT_RGB32 : conv = gray8aToPacked32; break;
+ case AV_PIX_FMT_BGR32 : conv = gray8aToPacked32; break;
+ case AV_PIX_FMT_BGR32_1: conv = gray8aToPacked32_1; break;
+ case AV_PIX_FMT_RGB32_1: conv = gray8aToPacked32_1; break;
+ case AV_PIX_FMT_RGB24 : conv = gray8aToPacked24; break;
+ case AV_PIX_FMT_BGR24 : conv = gray8aToPacked24; break;
}
} else if (usePal(srcFormat)) {
switch (dstFormat) {
- case PIX_FMT_RGB32 : conv = sws_convertPalette8ToPacked32; break;
- case PIX_FMT_BGR32 : conv = sws_convertPalette8ToPacked32; break;
- case PIX_FMT_BGR32_1: conv = sws_convertPalette8ToPacked32; break;
- case PIX_FMT_RGB32_1: conv = sws_convertPalette8ToPacked32; break;
- case PIX_FMT_RGB24 : conv = sws_convertPalette8ToPacked24; break;
- case PIX_FMT_BGR24 : conv = sws_convertPalette8ToPacked24; break;
+ case AV_PIX_FMT_RGB32 : conv = sws_convertPalette8ToPacked32; break;
+ case AV_PIX_FMT_BGR32 : conv = sws_convertPalette8ToPacked32; break;
+ case AV_PIX_FMT_BGR32_1: conv = sws_convertPalette8ToPacked32; break;
+ case AV_PIX_FMT_RGB32_1: conv = sws_convertPalette8ToPacked32; break;
+ case AV_PIX_FMT_RGB24 : conv = sws_convertPalette8ToPacked24; break;
+ case AV_PIX_FMT_BGR24 : conv = sws_convertPalette8ToPacked24; break;
}
}
@@ -344,32 +365,137 @@ static int palToRgbWrapper(SwsContext *c, const uint8_t *src[], int srcStride[],
return srcSliceH;
}
+static void gbr24ptopacked24(const uint8_t *src[], int srcStride[],
+ uint8_t *dst, int dstStride, int srcSliceH,
+ int width)
+{
+ int x, h, i;
+ for (h = 0; h < srcSliceH; h++) {
+ uint8_t *dest = dst + dstStride * h;
+ for (x = 0; x < width; x++) {
+ *dest++ = src[0][x];
+ *dest++ = src[1][x];
+ *dest++ = src[2][x];
+ }
+
+ for (i = 0; i < 3; i++)
+ src[i] += srcStride[i];
+ }
+}
+
+static void gbr24ptopacked32(const uint8_t *src[], int srcStride[],
+ uint8_t *dst, int dstStride, int srcSliceH,
+ int alpha_first, int width)
+{
+ int x, h, i;
+ for (h = 0; h < srcSliceH; h++) {
+ uint8_t *dest = dst + dstStride * h;
+
+ if (alpha_first) {
+ for (x = 0; x < width; x++) {
+ *dest++ = 0xff;
+ *dest++ = src[0][x];
+ *dest++ = src[1][x];
+ *dest++ = src[2][x];
+ }
+ } else {
+ for (x = 0; x < width; x++) {
+ *dest++ = src[0][x];
+ *dest++ = src[1][x];
+ *dest++ = src[2][x];
+ *dest++ = 0xff;
+ }
+ }
+
+ for (i = 0; i < 3; i++)
+ src[i] += srcStride[i];
+ }
+}
+
+static int planarRgbToRgbWrapper(SwsContext *c, const uint8_t *src[],
+ int srcStride[], int srcSliceY, int srcSliceH,
+ uint8_t *dst[], int dstStride[])
+{
+ int alpha_first = 0;
+ const uint8_t *src102[] = { src[1], src[0], src[2] };
+ const uint8_t *src201[] = { src[2], src[0], src[1] };
+ int stride102[] = { srcStride[1], srcStride[0], srcStride[2] };
+ int stride201[] = { srcStride[2], srcStride[0], srcStride[1] };
+
+ if (c->srcFormat != AV_PIX_FMT_GBRP) {
+ av_log(c, AV_LOG_ERROR, "unsupported planar RGB conversion %s -> %s\n",
+ av_get_pix_fmt_name(c->srcFormat),
+ av_get_pix_fmt_name(c->dstFormat));
+ return srcSliceH;
+ }
+
+ switch (c->dstFormat) {
+ case AV_PIX_FMT_BGR24:
+ gbr24ptopacked24(src102, stride102,
+ dst[0] + srcSliceY * dstStride[0], dstStride[0],
+ srcSliceH, c->srcW);
+ break;
+
+ case AV_PIX_FMT_RGB24:
+ gbr24ptopacked24(src201, stride201,
+ dst[0] + srcSliceY * dstStride[0], dstStride[0],
+ srcSliceH, c->srcW);
+ break;
+
+ case AV_PIX_FMT_ARGB:
+ alpha_first = 1;
+ case AV_PIX_FMT_RGBA:
+ gbr24ptopacked32(src201, stride201,
+ dst[0] + srcSliceY * dstStride[0], dstStride[0],
+ srcSliceH, alpha_first, c->srcW);
+ break;
+
+ case AV_PIX_FMT_ABGR:
+ alpha_first = 1;
+ case AV_PIX_FMT_BGRA:
+ gbr24ptopacked32(src102, stride102,
+ dst[0] + srcSliceY * dstStride[0], dstStride[0],
+ srcSliceH, alpha_first, c->srcW);
+ break;
+
+ default:
+ av_log(c, AV_LOG_ERROR,
+ "unsupported planar RGB conversion %s -> %s\n",
+ av_get_pix_fmt_name(c->srcFormat),
+ av_get_pix_fmt_name(c->dstFormat));
+ }
+
+ return srcSliceH;
+}
+
#define isRGBA32(x) ( \
- (x) == PIX_FMT_ARGB \
- || (x) == PIX_FMT_RGBA \
- || (x) == PIX_FMT_BGRA \
- || (x) == PIX_FMT_ABGR \
+ (x) == AV_PIX_FMT_ARGB \
+ || (x) == AV_PIX_FMT_RGBA \
+ || (x) == AV_PIX_FMT_BGRA \
+ || (x) == AV_PIX_FMT_ABGR \
)
/* {RGB,BGR}{15,16,24,32,32_1} -> {RGB,BGR}{15,16,24,32} */
typedef void (* rgbConvFn) (const uint8_t *, uint8_t *, int);
static rgbConvFn findRgbConvFn(SwsContext *c)
{
- const enum PixelFormat srcFormat = c->srcFormat;
- const enum PixelFormat dstFormat = c->dstFormat;
+ const enum AVPixelFormat srcFormat = c->srcFormat;
+ const enum AVPixelFormat dstFormat = c->dstFormat;
const int srcId = c->srcFormatBpp;
const int dstId = c->dstFormatBpp;
rgbConvFn conv = NULL;
+ const AVPixFmtDescriptor *desc_src = av_pix_fmt_desc_get(srcFormat);
+ const AVPixFmtDescriptor *desc_dst = av_pix_fmt_desc_get(dstFormat);
-#define IS_NOT_NE(bpp, fmt) \
+#define IS_NOT_NE(bpp, desc) \
(((bpp + 7) >> 3) == 2 && \
- (!(av_pix_fmt_descriptors[fmt].flags & PIX_FMT_BE) != !HAVE_BIGENDIAN))
+ (!(desc->flags & PIX_FMT_BE) != !HAVE_BIGENDIAN))
/* if this is non-native rgb444/555/565, don't handle it here. */
- if (IS_NOT_NE(srcId, srcFormat) || IS_NOT_NE(dstId, dstFormat))
+ if (IS_NOT_NE(srcId, desc_src) || IS_NOT_NE(dstId, desc_dst))
return NULL;
-#define CONV_IS(src, dst) (srcFormat == PIX_FMT_##src && dstFormat == PIX_FMT_##dst)
+#define CONV_IS(src, dst) (srcFormat == AV_PIX_FMT_##src && dstFormat == AV_PIX_FMT_##dst)
if (isRGBA32(srcFormat) && isRGBA32(dstFormat)) {
if ( CONV_IS(ABGR, RGBA)
@@ -434,8 +560,8 @@ static int rgbToRgbWrapper(SwsContext *c, const uint8_t *src[], int srcStride[],
int dstStride[])
{
- const enum PixelFormat srcFormat = c->srcFormat;
- const enum PixelFormat dstFormat = c->dstFormat;
+ const enum AVPixelFormat srcFormat = c->srcFormat;
+ const enum AVPixelFormat dstFormat = c->dstFormat;
const int srcBpp = (c->srcFormatBpp + 7) >> 3;
const int dstBpp = (c->dstFormatBpp + 7) >> 3;
rgbConvFn conv = findRgbConvFn(c);
@@ -446,11 +572,11 @@ static int rgbToRgbWrapper(SwsContext *c, const uint8_t *src[], int srcStride[],
} else {
const uint8_t *srcPtr = src[0];
uint8_t *dstPtr = dst[0];
- if ((srcFormat == PIX_FMT_RGB32_1 || srcFormat == PIX_FMT_BGR32_1) &&
+ if ((srcFormat == AV_PIX_FMT_RGB32_1 || srcFormat == AV_PIX_FMT_BGR32_1) &&
!isRGBA32(dstFormat))
srcPtr += ALT32_CORR;
- if ((dstFormat == PIX_FMT_RGB32_1 || dstFormat == PIX_FMT_BGR32_1) &&
+ if ((dstFormat == AV_PIX_FMT_RGB32_1 || dstFormat == AV_PIX_FMT_BGR32_1) &&
!isRGBA32(srcFormat))
dstPtr += ALT32_CORR;
@@ -557,6 +683,8 @@ static int planarCopyWrapper(SwsContext *c, const uint8_t *src[],
int srcStride[], int srcSliceY, int srcSliceH,
uint8_t *dst[], int dstStride[])
{
+ const AVPixFmtDescriptor *desc_src = av_pix_fmt_desc_get(c->srcFormat);
+ const AVPixFmtDescriptor *desc_dst = av_pix_fmt_desc_get(c->dstFormat);
int plane, i, j;
for (plane = 0; plane < 4; plane++) {
int length = (plane == 0 || plane == 3) ? c->srcW : -((-c->srcW ) >> c->chrDstHSubSample);
@@ -570,14 +698,21 @@ static int planarCopyWrapper(SwsContext *c, const uint8_t *src[],
// ignore palette for GRAY8
if (plane == 1 && !dst[2]) continue;
if (!src[plane] || (plane == 1 && !src[2])) {
+ int val = (plane == 3) ? 255 : 128;
if (is16BPS(c->dstFormat))
length *= 2;
- fillPlane(dst[plane], dstStride[plane], length, height, y,
- (plane == 3) ? 255 : 128);
+ if (is9_OR_10BPS(c->dstFormat)) {
+ fill_plane9or10(dst[plane], dstStride[plane],
+ length, height, y, val,
+ desc_dst->comp[plane].depth_minus1 + 1,
+ isBE(c->dstFormat));
+ } else
+ fillPlane(dst[plane], dstStride[plane], length, height, y,
+ val);
} else {
if (is9_OR_10BPS(c->srcFormat)) {
- const int src_depth = av_pix_fmt_descriptors[c->srcFormat].comp[plane].depth_minus1 + 1;
- const int dst_depth = av_pix_fmt_descriptors[c->dstFormat].comp[plane].depth_minus1 + 1;
+ const int src_depth = desc_src->comp[plane].depth_minus1 + 1;
+ const int dst_depth = desc_dst->comp[plane].depth_minus1 + 1;
const uint16_t *srcPtr2 = (const uint16_t *) srcPtr;
if (is16BPS(c->dstFormat)) {
@@ -657,7 +792,7 @@ static int planarCopyWrapper(SwsContext *c, const uint8_t *src[],
}
}
} else if (is9_OR_10BPS(c->dstFormat)) {
- const int dst_depth = av_pix_fmt_descriptors[c->dstFormat].comp[plane].depth_minus1 + 1;
+ const int dst_depth = desc_dst->comp[plane].depth_minus1 + 1;
uint16_t *dstPtr2 = (uint16_t *) dstPtr;
if (is16BPS(c->srcFormat)) {
@@ -737,7 +872,7 @@ static int planarCopyWrapper(SwsContext *c, const uint8_t *src[],
} else {
if (is16BPS(c->srcFormat) && is16BPS(c->dstFormat))
length *= 2;
- else if (!av_pix_fmt_descriptors[c->srcFormat].comp[0].depth_minus1)
+ else if (!desc_src->comp[0].depth_minus1)
length >>= 3; // monowhite/black
for (i = 0; i < height; i++) {
memcpy(dstPtr, srcPtr, length);
@@ -758,8 +893,8 @@ static int planarCopyWrapper(SwsContext *c, const uint8_t *src[],
void ff_get_unscaled_swscale(SwsContext *c)
{
- const enum PixelFormat srcFormat = c->srcFormat;
- const enum PixelFormat dstFormat = c->dstFormat;
+ const enum AVPixelFormat srcFormat = c->srcFormat;
+ const enum AVPixelFormat dstFormat = c->dstFormat;
const int flags = c->flags;
const int dstH = c->dstH;
int needsDither;
@@ -769,26 +904,26 @@ void ff_get_unscaled_swscale(SwsContext *c)
(c->dstFormatBpp < c->srcFormatBpp || (!isAnyRGB(srcFormat)));
/* yv12_to_nv12 */
- if ((srcFormat == PIX_FMT_YUV420P || srcFormat == PIX_FMT_YUVA420P) &&
- (dstFormat == PIX_FMT_NV12 || dstFormat == PIX_FMT_NV21)) {
+ if ((srcFormat == AV_PIX_FMT_YUV420P || srcFormat == AV_PIX_FMT_YUVA420P) &&
+ (dstFormat == AV_PIX_FMT_NV12 || dstFormat == AV_PIX_FMT_NV21)) {
c->swScale = planarToNv12Wrapper;
}
/* yuv2bgr */
- if ((srcFormat == PIX_FMT_YUV420P || srcFormat == PIX_FMT_YUV422P ||
- srcFormat == PIX_FMT_YUVA420P) && isAnyRGB(dstFormat) &&
+ if ((srcFormat == AV_PIX_FMT_YUV420P || srcFormat == AV_PIX_FMT_YUV422P ||
+ srcFormat == AV_PIX_FMT_YUVA420P) && isAnyRGB(dstFormat) &&
!(flags & SWS_ACCURATE_RND) && !(dstH & 1)) {
c->swScale = ff_yuv2rgb_get_func_ptr(c);
}
- if (srcFormat == PIX_FMT_YUV410P &&
- (dstFormat == PIX_FMT_YUV420P || dstFormat == PIX_FMT_YUVA420P) &&
+ if (srcFormat == AV_PIX_FMT_YUV410P &&
+ (dstFormat == AV_PIX_FMT_YUV420P || dstFormat == AV_PIX_FMT_YUVA420P) &&
!(flags & SWS_BITEXACT)) {
c->swScale = yvu9ToYv12Wrapper;
}
/* bgr24toYV12 */
- if (srcFormat == PIX_FMT_BGR24 &&
- (dstFormat == PIX_FMT_YUV420P || dstFormat == PIX_FMT_YUVA420P) &&
+ if (srcFormat == AV_PIX_FMT_BGR24 &&
+ (dstFormat == AV_PIX_FMT_YUV420P || dstFormat == AV_PIX_FMT_YUVA420P) &&
!(flags & SWS_ACCURATE_RND))
c->swScale = bgr24ToYv12Wrapper;
@@ -797,67 +932,70 @@ void ff_get_unscaled_swscale(SwsContext *c)
&& (!needsDither || (c->flags&(SWS_FAST_BILINEAR|SWS_POINT))))
c->swScale= rgbToRgbWrapper;
+ if (isPlanarRGB(srcFormat) && isPackedRGB(dstFormat))
+ c->swScale = planarRgbToRgbWrapper;
+
/* bswap 16 bits per pixel/component packed formats */
- if (IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, PIX_FMT_BGR444) ||
- IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, PIX_FMT_BGR48) ||
- IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, PIX_FMT_BGR555) ||
- IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, PIX_FMT_BGR565) ||
- IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, PIX_FMT_GRAY16) ||
- IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, PIX_FMT_RGB444) ||
- IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, PIX_FMT_RGB48) ||
- IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, PIX_FMT_RGB555) ||
- IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, PIX_FMT_RGB565))
+ if (IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_BGR444) ||
+ IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_BGR48) ||
+ IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_BGR555) ||
+ IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_BGR565) ||
+ IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_GRAY16) ||
+ IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_RGB444) ||
+ IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_RGB48) ||
+ IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_RGB555) ||
+ IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_RGB565))
c->swScale = packed_16bpc_bswap;
if ((usePal(srcFormat) && (
- dstFormat == PIX_FMT_RGB32 ||
- dstFormat == PIX_FMT_RGB32_1 ||
- dstFormat == PIX_FMT_RGB24 ||
- dstFormat == PIX_FMT_BGR32 ||
- dstFormat == PIX_FMT_BGR32_1 ||
- dstFormat == PIX_FMT_BGR24)))
+ dstFormat == AV_PIX_FMT_RGB32 ||
+ dstFormat == AV_PIX_FMT_RGB32_1 ||
+ dstFormat == AV_PIX_FMT_RGB24 ||
+ dstFormat == AV_PIX_FMT_BGR32 ||
+ dstFormat == AV_PIX_FMT_BGR32_1 ||
+ dstFormat == AV_PIX_FMT_BGR24)))
c->swScale = palToRgbWrapper;
- if (srcFormat == PIX_FMT_YUV422P) {
- if (dstFormat == PIX_FMT_YUYV422)
+ if (srcFormat == AV_PIX_FMT_YUV422P) {
+ if (dstFormat == AV_PIX_FMT_YUYV422)
c->swScale = yuv422pToYuy2Wrapper;
- else if (dstFormat == PIX_FMT_UYVY422)
+ else if (dstFormat == AV_PIX_FMT_UYVY422)
c->swScale = yuv422pToUyvyWrapper;
}
/* LQ converters if -sws 0 or -sws 4*/
if (c->flags&(SWS_FAST_BILINEAR|SWS_POINT)) {
/* yv12_to_yuy2 */
- if (srcFormat == PIX_FMT_YUV420P || srcFormat == PIX_FMT_YUVA420P) {
- if (dstFormat == PIX_FMT_YUYV422)
+ if (srcFormat == AV_PIX_FMT_YUV420P || srcFormat == AV_PIX_FMT_YUVA420P) {
+ if (dstFormat == AV_PIX_FMT_YUYV422)
c->swScale = planarToYuy2Wrapper;
- else if (dstFormat == PIX_FMT_UYVY422)
+ else if (dstFormat == AV_PIX_FMT_UYVY422)
c->swScale = planarToUyvyWrapper;
}
}
- if (srcFormat == PIX_FMT_YUYV422 &&
- (dstFormat == PIX_FMT_YUV420P || dstFormat == PIX_FMT_YUVA420P))
+ if (srcFormat == AV_PIX_FMT_YUYV422 &&
+ (dstFormat == AV_PIX_FMT_YUV420P || dstFormat == AV_PIX_FMT_YUVA420P))
c->swScale = yuyvToYuv420Wrapper;
- if (srcFormat == PIX_FMT_UYVY422 &&
- (dstFormat == PIX_FMT_YUV420P || dstFormat == PIX_FMT_YUVA420P))
+ if (srcFormat == AV_PIX_FMT_UYVY422 &&
+ (dstFormat == AV_PIX_FMT_YUV420P || dstFormat == AV_PIX_FMT_YUVA420P))
c->swScale = uyvyToYuv420Wrapper;
- if (srcFormat == PIX_FMT_YUYV422 && dstFormat == PIX_FMT_YUV422P)
+ if (srcFormat == AV_PIX_FMT_YUYV422 && dstFormat == AV_PIX_FMT_YUV422P)
c->swScale = yuyvToYuv422Wrapper;
- if (srcFormat == PIX_FMT_UYVY422 && dstFormat == PIX_FMT_YUV422P)
+ if (srcFormat == AV_PIX_FMT_UYVY422 && dstFormat == AV_PIX_FMT_YUV422P)
c->swScale = uyvyToYuv422Wrapper;
/* simple copy */
if ( srcFormat == dstFormat ||
- (srcFormat == PIX_FMT_YUVA420P && dstFormat == PIX_FMT_YUV420P) ||
- (srcFormat == PIX_FMT_YUV420P && dstFormat == PIX_FMT_YUVA420P) ||
+ (srcFormat == AV_PIX_FMT_YUVA420P && dstFormat == AV_PIX_FMT_YUV420P) ||
+ (srcFormat == AV_PIX_FMT_YUV420P && dstFormat == AV_PIX_FMT_YUVA420P) ||
(isPlanarYUV(srcFormat) && isGray(dstFormat)) ||
(isPlanarYUV(dstFormat) && isGray(srcFormat)) ||
(isGray(dstFormat) && isGray(srcFormat)) ||
(isPlanarYUV(srcFormat) && isPlanarYUV(dstFormat) &&
c->chrDstHSubSample == c->chrSrcHSubSample &&
c->chrDstVSubSample == c->chrSrcVSubSample &&
- dstFormat != PIX_FMT_NV12 && dstFormat != PIX_FMT_NV21 &&
- srcFormat != PIX_FMT_NV12 && srcFormat != PIX_FMT_NV21))
+ dstFormat != AV_PIX_FMT_NV12 && dstFormat != AV_PIX_FMT_NV21 &&
+ srcFormat != AV_PIX_FMT_NV12 && srcFormat != AV_PIX_FMT_NV21))
{
if (isPacked(c->srcFormat))
c->swScale = packedCopyWrapper;
@@ -883,10 +1021,10 @@ static void reset_ptr(const uint8_t *src[], int format)
}
}
-static int check_image_pointers(uint8_t *data[4], enum PixelFormat pix_fmt,
+static int check_image_pointers(uint8_t *data[4], enum AVPixelFormat pix_fmt,
const int linesizes[4])
{
- const AVPixFmtDescriptor *desc = &av_pix_fmt_descriptors[pix_fmt];
+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
int i;
for (i = 0; i < 4; i++) {
@@ -936,28 +1074,28 @@ int attribute_align_arg sws_scale(struct SwsContext *c,
if (usePal(c->srcFormat)) {
for (i = 0; i < 256; i++) {
int p, r, g, b, y, u, v;
- if (c->srcFormat == PIX_FMT_PAL8) {
+ if (c->srcFormat == AV_PIX_FMT_PAL8) {
p = ((const uint32_t *)(srcSlice[1]))[i];
r = (p >> 16) & 0xFF;
g = (p >> 8) & 0xFF;
b = p & 0xFF;
- } else if (c->srcFormat == PIX_FMT_RGB8) {
+ } else if (c->srcFormat == AV_PIX_FMT_RGB8) {
r = ( i >> 5 ) * 36;
g = ((i >> 2) & 7) * 36;
b = ( i & 3) * 85;
- } else if (c->srcFormat == PIX_FMT_BGR8) {
+ } else if (c->srcFormat == AV_PIX_FMT_BGR8) {
b = ( i >> 6 ) * 85;
g = ((i >> 3) & 7) * 36;
r = ( i & 7) * 36;
- } else if (c->srcFormat == PIX_FMT_RGB4_BYTE) {
+ } else if (c->srcFormat == AV_PIX_FMT_RGB4_BYTE) {
r = ( i >> 3 ) * 255;
g = ((i >> 1) & 3) * 85;
b = ( i & 1) * 255;
- } else if (c->srcFormat == PIX_FMT_GRAY8 ||
- c->srcFormat == PIX_FMT_Y400A) {
+ } else if (c->srcFormat == AV_PIX_FMT_GRAY8 ||
+ c->srcFormat == AV_PIX_FMT_Y400A) {
r = g = b = i;
} else {
- assert(c->srcFormat == PIX_FMT_BGR4_BYTE);
+ assert(c->srcFormat == AV_PIX_FMT_BGR4_BYTE);
b = ( i >> 3 ) * 255;
g = ((i >> 1) & 3) * 85;
r = ( i & 1) * 255;
@@ -968,27 +1106,27 @@ int attribute_align_arg sws_scale(struct SwsContext *c,
c->pal_yuv[i] = y + (u << 8) + (v << 16);
switch (c->dstFormat) {
- case PIX_FMT_BGR32:
+ case AV_PIX_FMT_BGR32:
#if !HAVE_BIGENDIAN
- case PIX_FMT_RGB24:
+ case AV_PIX_FMT_RGB24:
#endif
c->pal_rgb[i] = r + (g << 8) + (b << 16);
break;
- case PIX_FMT_BGR32_1:
+ case AV_PIX_FMT_BGR32_1:
#if HAVE_BIGENDIAN
- case PIX_FMT_BGR24:
+ case AV_PIX_FMT_BGR24:
#endif
c->pal_rgb[i] = (r + (g << 8) + (b << 16)) << 8;
break;
- case PIX_FMT_RGB32_1:
+ case AV_PIX_FMT_RGB32_1:
#if HAVE_BIGENDIAN
- case PIX_FMT_RGB24:
+ case AV_PIX_FMT_RGB24:
#endif
c->pal_rgb[i] = (b + (g << 8) + (r << 16)) << 8;
break;
- case PIX_FMT_RGB32:
+ case AV_PIX_FMT_RGB32:
#if !HAVE_BIGENDIAN
- case PIX_FMT_BGR24:
+ case AV_PIX_FMT_BGR24:
#endif
default:
c->pal_rgb[i] = b + (g << 8) + (r << 16);
diff --git a/gst-libs/ext/libav/libswscale/utils.c b/gst-libs/ext/libav/libswscale/utils.c
index f3a5012..f0a2b46 100644
--- a/gst-libs/ext/libav/libswscale/utils.c
+++ b/gst-libs/ext/libav/libswscale/utils.c
@@ -18,13 +18,14 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#define _SVID_SOURCE //needed for MAP_ANONYMOUS
+#include "config.h"
+
+#define _SVID_SOURCE // needed for MAP_ANONYMOUS
+#include <assert.h>
#include <inttypes.h>
-#include <string.h>
#include <math.h>
#include <stdio.h>
-#include "config.h"
-#include <assert.h>
+#include <string.h>
#if HAVE_SYS_MMAN_H
#include <sys/mman.h>
#if defined(MAP_ANON) && !defined(MAP_ANONYMOUS)
@@ -35,17 +36,20 @@
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#endif
-#include "swscale.h"
-#include "swscale_internal.h"
-#include "rgb2rgb.h"
-#include "libavutil/intreadwrite.h"
-#include "libavutil/x86_cpu.h"
-#include "libavutil/cpu.h"
+
+#include "libavutil/attributes.h"
#include "libavutil/avutil.h"
#include "libavutil/bswap.h"
+#include "libavutil/cpu.h"
+#include "libavutil/intreadwrite.h"
#include "libavutil/mathematics.h"
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
+#include "libavutil/x86/asm.h"
+#include "libavutil/x86/cpu.h"
+#include "rgb2rgb.h"
+#include "swscale.h"
+#include "swscale_internal.h"
unsigned swscale_version(void)
{
@@ -63,402 +67,470 @@ const char *swscale_license(void)
return LICENSE_PREFIX LIBAV_LICENSE + sizeof(LICENSE_PREFIX) - 1;
}
-#define RET 0xC3 //near return opcode for x86
+#define RET 0xC3 // near return opcode for x86
typedef struct FormatEntry {
int is_supported_in, is_supported_out;
} FormatEntry;
-static const FormatEntry format_entries[PIX_FMT_NB] = {
- [PIX_FMT_YUV420P] = { 1 , 1 },
- [PIX_FMT_YUYV422] = { 1 , 1 },
- [PIX_FMT_RGB24] = { 1 , 1 },
- [PIX_FMT_BGR24] = { 1 , 1 },
- [PIX_FMT_YUV422P] = { 1 , 1 },
- [PIX_FMT_YUV444P] = { 1 , 1 },
- [PIX_FMT_YUV410P] = { 1 , 1 },
- [PIX_FMT_YUV411P] = { 1 , 1 },
- [PIX_FMT_GRAY8] = { 1 , 1 },
- [PIX_FMT_MONOWHITE] = { 1 , 1 },
- [PIX_FMT_MONOBLACK] = { 1 , 1 },
- [PIX_FMT_PAL8] = { 1 , 0 },
- [PIX_FMT_YUVJ420P] = { 1 , 1 },
- [PIX_FMT_YUVJ422P] = { 1 , 1 },
- [PIX_FMT_YUVJ444P] = { 1 , 1 },
- [PIX_FMT_UYVY422] = { 1 , 1 },
- [PIX_FMT_UYYVYY411] = { 0 , 0 },
- [PIX_FMT_BGR8] = { 1 , 1 },
- [PIX_FMT_BGR4] = { 0 , 1 },
- [PIX_FMT_BGR4_BYTE] = { 1 , 1 },
- [PIX_FMT_RGB8] = { 1 , 1 },
- [PIX_FMT_RGB4] = { 0 , 1 },
- [PIX_FMT_RGB4_BYTE] = { 1 , 1 },
- [PIX_FMT_NV12] = { 1 , 1 },
- [PIX_FMT_NV21] = { 1 , 1 },
- [PIX_FMT_ARGB] = { 1 , 1 },
- [PIX_FMT_RGBA] = { 1 , 1 },
- [PIX_FMT_ABGR] = { 1 , 1 },
- [PIX_FMT_BGRA] = { 1 , 1 },
- [PIX_FMT_GRAY16BE] = { 1 , 1 },
- [PIX_FMT_GRAY16LE] = { 1 , 1 },
- [PIX_FMT_YUV440P] = { 1 , 1 },
- [PIX_FMT_YUVJ440P] = { 1 , 1 },
- [PIX_FMT_YUVA420P] = { 1 , 1 },
- [PIX_FMT_RGB48BE] = { 1 , 1 },
- [PIX_FMT_RGB48LE] = { 1 , 1 },
- [PIX_FMT_RGB565BE] = { 1 , 1 },
- [PIX_FMT_RGB565LE] = { 1 , 1 },
- [PIX_FMT_RGB555BE] = { 1 , 1 },
- [PIX_FMT_RGB555LE] = { 1 , 1 },
- [PIX_FMT_BGR565BE] = { 1 , 1 },
- [PIX_FMT_BGR565LE] = { 1 , 1 },
- [PIX_FMT_BGR555BE] = { 1 , 1 },
- [PIX_FMT_BGR555LE] = { 1 , 1 },
- [PIX_FMT_YUV420P16LE] = { 1 , 1 },
- [PIX_FMT_YUV420P16BE] = { 1 , 1 },
- [PIX_FMT_YUV422P16LE] = { 1 , 1 },
- [PIX_FMT_YUV422P16BE] = { 1 , 1 },
- [PIX_FMT_YUV444P16LE] = { 1 , 1 },
- [PIX_FMT_YUV444P16BE] = { 1 , 1 },
- [PIX_FMT_RGB444LE] = { 1 , 1 },
- [PIX_FMT_RGB444BE] = { 1 , 1 },
- [PIX_FMT_BGR444LE] = { 1 , 1 },
- [PIX_FMT_BGR444BE] = { 1 , 1 },
- [PIX_FMT_Y400A] = { 1 , 0 },
- [PIX_FMT_BGR48BE] = { 1 , 1 },
- [PIX_FMT_BGR48LE] = { 1 , 1 },
- [PIX_FMT_YUV420P9BE] = { 1 , 1 },
- [PIX_FMT_YUV420P9LE] = { 1 , 1 },
- [PIX_FMT_YUV420P10BE] = { 1 , 1 },
- [PIX_FMT_YUV420P10LE] = { 1 , 1 },
- [PIX_FMT_YUV422P9BE] = { 1 , 1 },
- [PIX_FMT_YUV422P9LE] = { 1 , 1 },
- [PIX_FMT_YUV422P10BE] = { 1 , 1 },
- [PIX_FMT_YUV422P10LE] = { 1 , 1 },
- [PIX_FMT_YUV444P9BE] = { 1 , 1 },
- [PIX_FMT_YUV444P9LE] = { 1 , 1 },
- [PIX_FMT_YUV444P10BE] = { 1 , 1 },
- [PIX_FMT_YUV444P10LE] = { 1 , 1 },
- [PIX_FMT_GBRP] = { 1 , 0 },
- [PIX_FMT_GBRP9LE] = { 1 , 0 },
- [PIX_FMT_GBRP9BE] = { 1 , 0 },
- [PIX_FMT_GBRP10LE] = { 1 , 0 },
- [PIX_FMT_GBRP10BE] = { 1 , 0 },
- [PIX_FMT_GBRP16LE] = { 1 , 0 },
- [PIX_FMT_GBRP16BE] = { 1 , 0 },
+static const FormatEntry format_entries[AV_PIX_FMT_NB] = {
+ [AV_PIX_FMT_YUV420P] = { 1, 1 },
+ [AV_PIX_FMT_YUYV422] = { 1, 1 },
+ [AV_PIX_FMT_RGB24] = { 1, 1 },
+ [AV_PIX_FMT_BGR24] = { 1, 1 },
+ [AV_PIX_FMT_YUV422P] = { 1, 1 },
+ [AV_PIX_FMT_YUV444P] = { 1, 1 },
+ [AV_PIX_FMT_YUV410P] = { 1, 1 },
+ [AV_PIX_FMT_YUV411P] = { 1, 1 },
+ [AV_PIX_FMT_GRAY8] = { 1, 1 },
+ [AV_PIX_FMT_MONOWHITE] = { 1, 1 },
+ [AV_PIX_FMT_MONOBLACK] = { 1, 1 },
+ [AV_PIX_FMT_PAL8] = { 1, 0 },
+ [AV_PIX_FMT_YUVJ420P] = { 1, 1 },
+ [AV_PIX_FMT_YUVJ422P] = { 1, 1 },
+ [AV_PIX_FMT_YUVJ444P] = { 1, 1 },
+ [AV_PIX_FMT_UYVY422] = { 1, 1 },
+ [AV_PIX_FMT_UYYVYY411] = { 0, 0 },
+ [AV_PIX_FMT_BGR8] = { 1, 1 },
+ [AV_PIX_FMT_BGR4] = { 0, 1 },
+ [AV_PIX_FMT_BGR4_BYTE] = { 1, 1 },
+ [AV_PIX_FMT_RGB8] = { 1, 1 },
+ [AV_PIX_FMT_RGB4] = { 0, 1 },
+ [AV_PIX_FMT_RGB4_BYTE] = { 1, 1 },
+ [AV_PIX_FMT_NV12] = { 1, 1 },
+ [AV_PIX_FMT_NV21] = { 1, 1 },
+ [AV_PIX_FMT_ARGB] = { 1, 1 },
+ [AV_PIX_FMT_RGBA] = { 1, 1 },
+ [AV_PIX_FMT_ABGR] = { 1, 1 },
+ [AV_PIX_FMT_BGRA] = { 1, 1 },
+ [AV_PIX_FMT_GRAY16BE] = { 1, 1 },
+ [AV_PIX_FMT_GRAY16LE] = { 1, 1 },
+ [AV_PIX_FMT_YUV440P] = { 1, 1 },
+ [AV_PIX_FMT_YUVJ440P] = { 1, 1 },
+ [AV_PIX_FMT_YUVA420P] = { 1, 1 },
+ [AV_PIX_FMT_YUVA422P] = { 1, 1 },
+ [AV_PIX_FMT_YUVA444P] = { 1, 1 },
+ [AV_PIX_FMT_YUVA420P9BE] = { 1, 1 },
+ [AV_PIX_FMT_YUVA420P9LE] = { 1, 1 },
+ [AV_PIX_FMT_YUVA422P9BE] = { 1, 1 },
+ [AV_PIX_FMT_YUVA422P9LE] = { 1, 1 },
+ [AV_PIX_FMT_YUVA444P9BE] = { 1, 1 },
+ [AV_PIX_FMT_YUVA444P9LE] = { 1, 1 },
+ [AV_PIX_FMT_YUVA420P10BE]= { 1, 1 },
+ [AV_PIX_FMT_YUVA420P10LE]= { 1, 1 },
+ [AV_PIX_FMT_YUVA422P10BE]= { 1, 1 },
+ [AV_PIX_FMT_YUVA422P10LE]= { 1, 1 },
+ [AV_PIX_FMT_YUVA444P10BE]= { 1, 1 },
+ [AV_PIX_FMT_YUVA444P10LE]= { 1, 1 },
+ [AV_PIX_FMT_YUVA420P16BE]= { 1, 1 },
+ [AV_PIX_FMT_YUVA420P16LE]= { 1, 1 },
+ [AV_PIX_FMT_YUVA422P16BE]= { 1, 1 },
+ [AV_PIX_FMT_YUVA422P16LE]= { 1, 1 },
+ [AV_PIX_FMT_YUVA444P16BE]= { 1, 1 },
+ [AV_PIX_FMT_YUVA444P16LE]= { 1, 1 },
+ [AV_PIX_FMT_RGB48BE] = { 1, 1 },
+ [AV_PIX_FMT_RGB48LE] = { 1, 1 },
+ [AV_PIX_FMT_RGB565BE] = { 1, 1 },
+ [AV_PIX_FMT_RGB565LE] = { 1, 1 },
+ [AV_PIX_FMT_RGB555BE] = { 1, 1 },
+ [AV_PIX_FMT_RGB555LE] = { 1, 1 },
+ [AV_PIX_FMT_BGR565BE] = { 1, 1 },
+ [AV_PIX_FMT_BGR565LE] = { 1, 1 },
+ [AV_PIX_FMT_BGR555BE] = { 1, 1 },
+ [AV_PIX_FMT_BGR555LE] = { 1, 1 },
+ [AV_PIX_FMT_YUV420P16LE] = { 1, 1 },
+ [AV_PIX_FMT_YUV420P16BE] = { 1, 1 },
+ [AV_PIX_FMT_YUV422P16LE] = { 1, 1 },
+ [AV_PIX_FMT_YUV422P16BE] = { 1, 1 },
+ [AV_PIX_FMT_YUV444P16LE] = { 1, 1 },
+ [AV_PIX_FMT_YUV444P16BE] = { 1, 1 },
+ [AV_PIX_FMT_RGB444LE] = { 1, 1 },
+ [AV_PIX_FMT_RGB444BE] = { 1, 1 },
+ [AV_PIX_FMT_BGR444LE] = { 1, 1 },
+ [AV_PIX_FMT_BGR444BE] = { 1, 1 },
+ [AV_PIX_FMT_Y400A] = { 1, 0 },
+ [AV_PIX_FMT_BGR48BE] = { 1, 1 },
+ [AV_PIX_FMT_BGR48LE] = { 1, 1 },
+ [AV_PIX_FMT_YUV420P9BE] = { 1, 1 },
+ [AV_PIX_FMT_YUV420P9LE] = { 1, 1 },
+ [AV_PIX_FMT_YUV420P10BE] = { 1, 1 },
+ [AV_PIX_FMT_YUV420P10LE] = { 1, 1 },
+ [AV_PIX_FMT_YUV422P9BE] = { 1, 1 },
+ [AV_PIX_FMT_YUV422P9LE] = { 1, 1 },
+ [AV_PIX_FMT_YUV422P10BE] = { 1, 1 },
+ [AV_PIX_FMT_YUV422P10LE] = { 1, 1 },
+ [AV_PIX_FMT_YUV444P9BE] = { 1, 1 },
+ [AV_PIX_FMT_YUV444P9LE] = { 1, 1 },
+ [AV_PIX_FMT_YUV444P10BE] = { 1, 1 },
+ [AV_PIX_FMT_YUV444P10LE] = { 1, 1 },
+ [AV_PIX_FMT_GBRP] = { 1, 0 },
+ [AV_PIX_FMT_GBRP9LE] = { 1, 0 },
+ [AV_PIX_FMT_GBRP9BE] = { 1, 0 },
+ [AV_PIX_FMT_GBRP10LE] = { 1, 0 },
+ [AV_PIX_FMT_GBRP10BE] = { 1, 0 },
+ [AV_PIX_FMT_GBRP16LE] = { 1, 0 },
+ [AV_PIX_FMT_GBRP16BE] = { 1, 0 },
};
-int sws_isSupportedInput(enum PixelFormat pix_fmt)
+int sws_isSupportedInput(enum AVPixelFormat pix_fmt)
{
- return (unsigned)pix_fmt < PIX_FMT_NB ?
- format_entries[pix_fmt].is_supported_in : 0;
+ return (unsigned)pix_fmt < AV_PIX_FMT_NB ?
+ format_entries[pix_fmt].is_supported_in : 0;
}
-int sws_isSupportedOutput(enum PixelFormat pix_fmt)
+int sws_isSupportedOutput(enum AVPixelFormat pix_fmt)
{
- return (unsigned)pix_fmt < PIX_FMT_NB ?
- format_entries[pix_fmt].is_supported_out : 0;
+ return (unsigned)pix_fmt < AV_PIX_FMT_NB ?
+ format_entries[pix_fmt].is_supported_out : 0;
}
extern const int32_t ff_yuv2rgb_coeffs[8][4];
-const char *sws_format_name(enum PixelFormat format)
+const char *sws_format_name(enum AVPixelFormat format)
{
- if ((unsigned)format < PIX_FMT_NB && av_pix_fmt_descriptors[format].name)
- return av_pix_fmt_descriptors[format].name;
+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(format);
+ if (desc)
+ return desc->name;
else
return "Unknown format";
}
-static double getSplineCoeff(double a, double b, double c, double d, double dist)
+static double getSplineCoeff(double a, double b, double c, double d,
+ double dist)
{
- if (dist<=1.0) return ((d*dist + c)*dist + b)*dist +a;
- else return getSplineCoeff( 0.0,
- b+ 2.0*c + 3.0*d,
- c + 3.0*d,
- -b- 3.0*c - 6.0*d,
- dist-1.0);
+ if (dist <= 1.0)
+ return ((d * dist + c) * dist + b) * dist + a;
+ else
+ return getSplineCoeff(0.0,
+ b + 2.0 * c + 3.0 * d,
+ c + 3.0 * d,
+ -b - 3.0 * c - 6.0 * d,
+ dist - 1.0);
}
-static int initFilter(int16_t **outFilter, int32_t **filterPos, int *outFilterSize, int xInc,
- int srcW, int dstW, int filterAlign, int one, int flags, int cpu_flags,
- SwsVector *srcFilter, SwsVector *dstFilter, double param[2], int is_horizontal)
+static int initFilter(int16_t **outFilter, int32_t **filterPos,
+ int *outFilterSize, int xInc, int srcW, int dstW,
+ int filterAlign, int one, int flags, int cpu_flags,
+ SwsVector *srcFilter, SwsVector *dstFilter,
+ double param[2], int is_horizontal)
{
int i;
int filterSize;
int filter2Size;
int minFilterSize;
- int64_t *filter=NULL;
- int64_t *filter2=NULL;
- const int64_t fone= 1LL<<54;
- int ret= -1;
+ int64_t *filter = NULL;
+ int64_t *filter2 = NULL;
+ const int64_t fone = 1LL << 54;
+ int ret = -1;
- emms_c(); //FIXME this should not be required but it IS (even for non-MMX versions)
+ emms_c(); // FIXME should not be required but IS (even for non-MMX versions)
- // NOTE: the +3 is for the MMX(+1)/SSE(+3) scaler which reads over the end
- FF_ALLOC_OR_GOTO(NULL, *filterPos, (dstW+3)*sizeof(**filterPos), fail);
+ // NOTE: the +3 is for the MMX(+1) / SSE(+3) scaler which reads over the end
+ FF_ALLOC_OR_GOTO(NULL, *filterPos, (dstW + 3) * sizeof(**filterPos), fail);
- if (FFABS(xInc - 0x10000) <10) { // unscaled
+ if (FFABS(xInc - 0x10000) < 10) { // unscaled
int i;
- filterSize= 1;
- FF_ALLOCZ_OR_GOTO(NULL, filter, dstW*sizeof(*filter)*filterSize, fail);
+ filterSize = 1;
+ FF_ALLOCZ_OR_GOTO(NULL, filter,
+ dstW * sizeof(*filter) * filterSize, fail);
- for (i=0; i<dstW; i++) {
- filter[i*filterSize]= fone;
- (*filterPos)[i]=i;
+ for (i = 0; i < dstW; i++) {
+ filter[i * filterSize] = fone;
+ (*filterPos)[i] = i;
}
-
- } else if (flags&SWS_POINT) { // lame looking point sampling mode
+ } else if (flags & SWS_POINT) { // lame looking point sampling mode
int i;
int xDstInSrc;
- filterSize= 1;
- FF_ALLOC_OR_GOTO(NULL, filter, dstW*sizeof(*filter)*filterSize, fail);
+ filterSize = 1;
+ FF_ALLOC_OR_GOTO(NULL, filter,
+ dstW * sizeof(*filter) * filterSize, fail);
- xDstInSrc= xInc/2 - 0x8000;
- for (i=0; i<dstW; i++) {
- int xx= (xDstInSrc - ((filterSize-1)<<15) + (1<<15))>>16;
+ xDstInSrc = xInc / 2 - 0x8000;
+ for (i = 0; i < dstW; i++) {
+ int xx = (xDstInSrc - ((filterSize - 1) << 15) + (1 << 15)) >> 16;
- (*filterPos)[i]= xx;
- filter[i]= fone;
- xDstInSrc+= xInc;
+ (*filterPos)[i] = xx;
+ filter[i] = fone;
+ xDstInSrc += xInc;
}
- } else if ((xInc <= (1<<16) && (flags&SWS_AREA)) || (flags&SWS_FAST_BILINEAR)) { // bilinear upscale
+ } else if ((xInc <= (1 << 16) && (flags & SWS_AREA)) ||
+ (flags & SWS_FAST_BILINEAR)) { // bilinear upscale
int i;
int xDstInSrc;
- filterSize= 2;
- FF_ALLOC_OR_GOTO(NULL, filter, dstW*sizeof(*filter)*filterSize, fail);
+ filterSize = 2;
+ FF_ALLOC_OR_GOTO(NULL, filter,
+ dstW * sizeof(*filter) * filterSize, fail);
- xDstInSrc= xInc/2 - 0x8000;
- for (i=0; i<dstW; i++) {
- int xx= (xDstInSrc - ((filterSize-1)<<15) + (1<<15))>>16;
+ xDstInSrc = xInc / 2 - 0x8000;
+ for (i = 0; i < dstW; i++) {
+ int xx = (xDstInSrc - ((filterSize - 1) << 15) + (1 << 15)) >> 16;
int j;
- (*filterPos)[i]= xx;
- //bilinear upscale / linear interpolate / area averaging
- for (j=0; j<filterSize; j++) {
- int64_t coeff= fone - FFABS((xx<<16) - xDstInSrc)*(fone>>16);
- if (coeff<0) coeff=0;
- filter[i*filterSize + j]= coeff;
+ (*filterPos)[i] = xx;
+ // bilinear upscale / linear interpolate / area averaging
+ for (j = 0; j < filterSize; j++) {
+ int64_t coeff = fone - FFABS((xx << 16) - xDstInSrc) *
+ (fone >> 16);
+ if (coeff < 0)
+ coeff = 0;
+ filter[i * filterSize + j] = coeff;
xx++;
}
- xDstInSrc+= xInc;
+ xDstInSrc += xInc;
}
} else {
int64_t xDstInSrc;
int sizeFactor;
- if (flags&SWS_BICUBIC) sizeFactor= 4;
- else if (flags&SWS_X) sizeFactor= 8;
- else if (flags&SWS_AREA) sizeFactor= 1; //downscale only, for upscale it is bilinear
- else if (flags&SWS_GAUSS) sizeFactor= 8; // infinite ;)
- else if (flags&SWS_LANCZOS) sizeFactor= param[0] != SWS_PARAM_DEFAULT ? ceil(2*param[0]) : 6;
- else if (flags&SWS_SINC) sizeFactor= 20; // infinite ;)
- else if (flags&SWS_SPLINE) sizeFactor= 20; // infinite ;)
- else if (flags&SWS_BILINEAR) sizeFactor= 2;
+ if (flags & SWS_BICUBIC)
+ sizeFactor = 4;
+ else if (flags & SWS_X)
+ sizeFactor = 8;
+ else if (flags & SWS_AREA)
+ sizeFactor = 1; // downscale only, for upscale it is bilinear
+ else if (flags & SWS_GAUSS)
+ sizeFactor = 8; // infinite ;)
+ else if (flags & SWS_LANCZOS)
+ sizeFactor = param[0] != SWS_PARAM_DEFAULT ? ceil(2 * param[0]) : 6;
+ else if (flags & SWS_SINC)
+ sizeFactor = 20; // infinite ;)
+ else if (flags & SWS_SPLINE)
+ sizeFactor = 20; // infinite ;)
+ else if (flags & SWS_BILINEAR)
+ sizeFactor = 2;
else {
- sizeFactor= 0; //GCC warning killer
+ sizeFactor = 0; // GCC warning killer
assert(0);
}
- if (xInc <= 1<<16) filterSize= 1 + sizeFactor; // upscale
- else filterSize= 1 + (sizeFactor*srcW + dstW - 1)/ dstW;
+ if (xInc <= 1 << 16)
+ filterSize = 1 + sizeFactor; // upscale
+ else
+ filterSize = 1 + (sizeFactor * srcW + dstW - 1) / dstW;
- filterSize = av_clip(filterSize, 1, srcW - 2);
+ filterSize = FFMIN(filterSize, srcW - 2);
+ filterSize = FFMAX(filterSize, 1);
- FF_ALLOC_OR_GOTO(NULL, filter, dstW*sizeof(*filter)*filterSize, fail);
+ FF_ALLOC_OR_GOTO(NULL, filter,
+ dstW * sizeof(*filter) * filterSize, fail);
- xDstInSrc= xInc - 0x10000;
- for (i=0; i<dstW; i++) {
- int xx= (xDstInSrc - ((filterSize-2)<<16)) / (1<<17);
+ xDstInSrc = xInc - 0x10000;
+ for (i = 0; i < dstW; i++) {
+ int xx = (xDstInSrc - ((filterSize - 2) << 16)) / (1 << 17);
int j;
- (*filterPos)[i]= xx;
- for (j=0; j<filterSize; j++) {
- int64_t d= ((int64_t)FFABS((xx<<17) - xDstInSrc))<<13;
+ (*filterPos)[i] = xx;
+ for (j = 0; j < filterSize; j++) {
+ int64_t d = (FFABS(((int64_t)xx << 17) - xDstInSrc)) << 13;
double floatd;
int64_t coeff;
- if (xInc > 1<<16)
- d= d*dstW/srcW;
- floatd= d * (1.0/(1<<30));
+ if (xInc > 1 << 16)
+ d = d * dstW / srcW;
+ floatd = d * (1.0 / (1 << 30));
if (flags & SWS_BICUBIC) {
- int64_t B= (param[0] != SWS_PARAM_DEFAULT ? param[0] : 0) * (1<<24);
- int64_t C= (param[1] != SWS_PARAM_DEFAULT ? param[1] : 0.6) * (1<<24);
+ int64_t B = (param[0] != SWS_PARAM_DEFAULT ? param[0] : 0) * (1 << 24);
+ int64_t C = (param[1] != SWS_PARAM_DEFAULT ? param[1] : 0.6) * (1 << 24);
- if (d >= 1LL<<31) {
+ if (d >= 1LL << 31) {
coeff = 0.0;
} else {
int64_t dd = (d * d) >> 30;
int64_t ddd = (dd * d) >> 30;
- if (d < 1LL<<30)
- coeff = (12*(1<<24)-9*B-6*C)*ddd + (-18*(1<<24)+12*B+6*C)*dd + (6*(1<<24)-2*B)*(1<<30);
+ if (d < 1LL << 30)
+ coeff = (12 * (1 << 24) - 9 * B - 6 * C) * ddd +
+ (-18 * (1 << 24) + 12 * B + 6 * C) * dd +
+ (6 * (1 << 24) - 2 * B) * (1 << 30);
else
- coeff = (-B-6*C)*ddd + (6*B+30*C)*dd + (-12*B-48*C)*d + (8*B+24*C)*(1<<30);
+ coeff = (-B - 6 * C) * ddd +
+ (6 * B + 30 * C) * dd +
+ (-12 * B - 48 * C) * d +
+ (8 * B + 24 * C) * (1 << 30);
}
- coeff *= fone>>(30+24);
+ coeff *= fone >> (30 + 24);
}
-/* else if (flags & SWS_X) {
- double p= param ? param*0.01 : 0.3;
- coeff = d ? sin(d*M_PI)/(d*M_PI) : 1.0;
- coeff*= pow(2.0, - p*d*d);
- }*/
+#if 0
+ else if (flags & SWS_X) {
+ double p = param ? param * 0.01 : 0.3;
+ coeff = d ? sin(d * M_PI) / (d * M_PI) : 1.0;
+ coeff *= pow(2.0, -p * d * d);
+ }
+#endif
else if (flags & SWS_X) {
- double A= param[0] != SWS_PARAM_DEFAULT ? param[0] : 1.0;
+ double A = param[0] != SWS_PARAM_DEFAULT ? param[0] : 1.0;
double c;
- if (floatd<1.0)
- c = cos(floatd*M_PI);
+ if (floatd < 1.0)
+ c = cos(floatd * M_PI);
else
- c=-1.0;
- if (c<0.0) c= -pow(-c, A);
- else c= pow( c, A);
- coeff= (c*0.5 + 0.5)*fone;
+ c = -1.0;
+ if (c < 0.0)
+ c = -pow(-c, A);
+ else
+ c = pow(c, A);
+ coeff = (c * 0.5 + 0.5) * fone;
} else if (flags & SWS_AREA) {
- int64_t d2= d - (1<<29);
- if (d2*xInc < -(1LL<<(29+16))) coeff= 1.0 * (1LL<<(30+16));
- else if (d2*xInc < (1LL<<(29+16))) coeff= -d2*xInc + (1LL<<(29+16));
- else coeff=0.0;
- coeff *= fone>>(30+16);
+ int64_t d2 = d - (1 << 29);
+ if (d2 * xInc < -(1LL << (29 + 16)))
+ coeff = 1.0 * (1LL << (30 + 16));
+ else if (d2 * xInc < (1LL << (29 + 16)))
+ coeff = -d2 * xInc + (1LL << (29 + 16));
+ else
+ coeff = 0.0;
+ coeff *= fone >> (30 + 16);
} else if (flags & SWS_GAUSS) {
- double p= param[0] != SWS_PARAM_DEFAULT ? param[0] : 3.0;
- coeff = (pow(2.0, - p*floatd*floatd))*fone;
+ double p = param[0] != SWS_PARAM_DEFAULT ? param[0] : 3.0;
+ coeff = (pow(2.0, -p * floatd * floatd)) * fone;
} else if (flags & SWS_SINC) {
- coeff = (d ? sin(floatd*M_PI)/(floatd*M_PI) : 1.0)*fone;
+ coeff = (d ? sin(floatd * M_PI) / (floatd * M_PI) : 1.0) * fone;
} else if (flags & SWS_LANCZOS) {
- double p= param[0] != SWS_PARAM_DEFAULT ? param[0] : 3.0;
- coeff = (d ? sin(floatd*M_PI)*sin(floatd*M_PI/p)/(floatd*floatd*M_PI*M_PI/p) : 1.0)*fone;
- if (floatd>p) coeff=0;
+ double p = param[0] != SWS_PARAM_DEFAULT ? param[0] : 3.0;
+ coeff = (d ? sin(floatd * M_PI) * sin(floatd * M_PI / p) /
+ (floatd * floatd * M_PI * M_PI / p) : 1.0) * fone;
+ if (floatd > p)
+ coeff = 0;
} else if (flags & SWS_BILINEAR) {
- coeff= (1<<30) - d;
- if (coeff<0) coeff=0;
+ coeff = (1 << 30) - d;
+ if (coeff < 0)
+ coeff = 0;
coeff *= fone >> 30;
} else if (flags & SWS_SPLINE) {
- double p=-2.196152422706632;
- coeff = getSplineCoeff(1.0, 0.0, p, -p-1.0, floatd) * fone;
+ double p = -2.196152422706632;
+ coeff = getSplineCoeff(1.0, 0.0, p, -p - 1.0, floatd) * fone;
} else {
- coeff= 0.0; //GCC warning killer
+ coeff = 0.0; // GCC warning killer
assert(0);
}
- filter[i*filterSize + j]= coeff;
+ filter[i * filterSize + j] = coeff;
xx++;
}
- xDstInSrc+= 2*xInc;
+ xDstInSrc += 2 * xInc;
}
}
/* apply src & dst Filter to filter -> filter2
- av_free(filter);
- */
- assert(filterSize>0);
- filter2Size= filterSize;
- if (srcFilter) filter2Size+= srcFilter->length - 1;
- if (dstFilter) filter2Size+= dstFilter->length - 1;
- assert(filter2Size>0);
- FF_ALLOCZ_OR_GOTO(NULL, filter2, filter2Size*dstW*sizeof(*filter2), fail);
-
- for (i=0; i<dstW; i++) {
+ * av_free(filter);
+ */
+ assert(filterSize > 0);
+ filter2Size = filterSize;
+ if (srcFilter)
+ filter2Size += srcFilter->length - 1;
+ if (dstFilter)
+ filter2Size += dstFilter->length - 1;
+ assert(filter2Size > 0);
+ FF_ALLOCZ_OR_GOTO(NULL, filter2, filter2Size * dstW * sizeof(*filter2), fail);
+
+ for (i = 0; i < dstW; i++) {
int j, k;
- if(srcFilter) {
- for (k=0; k<srcFilter->length; k++) {
- for (j=0; j<filterSize; j++)
- filter2[i*filter2Size + k + j] += srcFilter->coeff[k]*filter[i*filterSize + j];
+ if (srcFilter) {
+ for (k = 0; k < srcFilter->length; k++) {
+ for (j = 0; j < filterSize; j++)
+ filter2[i * filter2Size + k + j] +=
+ srcFilter->coeff[k] * filter[i * filterSize + j];
}
} else {
- for (j=0; j<filterSize; j++)
- filter2[i*filter2Size + j]= filter[i*filterSize + j];
+ for (j = 0; j < filterSize; j++)
+ filter2[i * filter2Size + j] = filter[i * filterSize + j];
}
- //FIXME dstFilter
+ // FIXME dstFilter
- (*filterPos)[i]+= (filterSize-1)/2 - (filter2Size-1)/2;
+ (*filterPos)[i] += (filterSize - 1) / 2 - (filter2Size - 1) / 2;
}
av_freep(&filter);
/* try to reduce the filter-size (step1 find size and shift left) */
// Assume it is near normalized (*0.5 or *2.0 is OK but * 0.001 is not).
- minFilterSize= 0;
- for (i=dstW-1; i>=0; i--) {
- int min= filter2Size;
+ minFilterSize = 0;
+ for (i = dstW - 1; i >= 0; i--) {
+ int min = filter2Size;
int j;
- int64_t cutOff=0.0;
+ int64_t cutOff = 0.0;
/* get rid of near zero elements on the left by shifting left */
- for (j=0; j<filter2Size; j++) {
+ for (j = 0; j < filter2Size; j++) {
int k;
- cutOff += FFABS(filter2[i*filter2Size]);
+ cutOff += FFABS(filter2[i * filter2Size]);
- if (cutOff > SWS_MAX_REDUCE_CUTOFF*fone) break;
+ if (cutOff > SWS_MAX_REDUCE_CUTOFF * fone)
+ break;
- /* preserve monotonicity because the core can't handle the filter otherwise */
- if (i<dstW-1 && (*filterPos)[i] >= (*filterPos)[i+1]) break;
+ /* preserve monotonicity because the core can't handle the
+ * filter otherwise */
+ if (i < dstW - 1 && (*filterPos)[i] >= (*filterPos)[i + 1])
+ break;
// move filter coefficients left
- for (k=1; k<filter2Size; k++)
- filter2[i*filter2Size + k - 1]= filter2[i*filter2Size + k];
- filter2[i*filter2Size + k - 1]= 0;
+ for (k = 1; k < filter2Size; k++)
+ filter2[i * filter2Size + k - 1] = filter2[i * filter2Size + k];
+ filter2[i * filter2Size + k - 1] = 0;
(*filterPos)[i]++;
}
- cutOff=0;
+ cutOff = 0;
/* count near zeros on the right */
- for (j=filter2Size-1; j>0; j--) {
- cutOff += FFABS(filter2[i*filter2Size + j]);
+ for (j = filter2Size - 1; j > 0; j--) {
+ cutOff += FFABS(filter2[i * filter2Size + j]);
- if (cutOff > SWS_MAX_REDUCE_CUTOFF*fone) break;
+ if (cutOff > SWS_MAX_REDUCE_CUTOFF * fone)
+ break;
min--;
}
- if (min>minFilterSize) minFilterSize= min;
+ if (min > minFilterSize)
+ minFilterSize = min;
}
if (HAVE_ALTIVEC && cpu_flags & AV_CPU_FLAG_ALTIVEC) {
- // we can handle the special case 4,
- // so we don't want to go to the full 8
+ // we can handle the special case 4, so we don't want to go the full 8
if (minFilterSize < 5)
filterAlign = 4;
- // We really don't want to waste our time
- // doing useless computation, so fall back on
- // the scalar C code for very small filters.
- // Vectorizing is worth it only if you have a
- // decent-sized vector.
+ /* We really don't want to waste our time doing useless computation, so
+ * fall back on the scalar C code for very small filters.
+ * Vectorizing is worth it only if you have a decent-sized vector. */
if (minFilterSize < 3)
filterAlign = 1;
}
- if (HAVE_MMX && cpu_flags & AV_CPU_FLAG_MMX) {
+ if (INLINE_MMX(cpu_flags)) {
// special case for unscaled vertical filtering
if (minFilterSize == 1 && filterAlign == 2)
- filterAlign= 1;
+ filterAlign = 1;
}
assert(minFilterSize > 0);
- filterSize= (minFilterSize +(filterAlign-1)) & (~(filterAlign-1));
+ filterSize = (minFilterSize + (filterAlign - 1)) & (~(filterAlign - 1));
assert(filterSize > 0);
- filter= av_malloc(filterSize*dstW*sizeof(*filter));
- if (filterSize >= MAX_FILTER_SIZE*16/((flags&SWS_ACCURATE_RND) ? APCK_SIZE : 16) || !filter)
+ filter = av_malloc(filterSize * dstW * sizeof(*filter));
+ if (filterSize >= MAX_FILTER_SIZE * 16 /
+ ((flags & SWS_ACCURATE_RND) ? APCK_SIZE : 16) || !filter)
goto fail;
- *outFilterSize= filterSize;
+ *outFilterSize = filterSize;
- if (flags&SWS_PRINT_INFO)
- av_log(NULL, AV_LOG_VERBOSE, "SwScaler: reducing / aligning filtersize %d -> %d\n", filter2Size, filterSize);
+ if (flags & SWS_PRINT_INFO)
+ av_log(NULL, AV_LOG_VERBOSE,
+ "SwScaler: reducing / aligning filtersize %d -> %d\n",
+ filter2Size, filterSize);
/* try to reduce the filter-size (step2 reduce it) */
- for (i=0; i<dstW; i++) {
+ for (i = 0; i < dstW; i++) {
int j;
- for (j=0; j<filterSize; j++) {
- if (j>=filter2Size) filter[i*filterSize + j]= 0;
- else filter[i*filterSize + j]= filter2[i*filter2Size + j];
- if((flags & SWS_BITEXACT) && j>=minFilterSize)
- filter[i*filterSize + j]= 0;
+ for (j = 0; j < filterSize; j++) {
+ if (j >= filter2Size)
+ filter[i * filterSize + j] = 0;
+ else
+ filter[i * filterSize + j] = filter2[i * filter2Size + j];
+ if ((flags & SWS_BITEXACT) && j >= minFilterSize)
+ filter[i * filterSize + j] = 0;
}
}
- //FIXME try to align filterPos if possible
+ // FIXME try to align filterPos if possible
- //fix borders
+ // fix borders
if (is_horizontal) {
for (i = 0; i < dstW; i++) {
int j;
@@ -467,7 +539,7 @@ static int initFilter(int16_t **outFilter, int32_t **filterPos, int *outFilterSi
for (j = 1; j < filterSize; j++) {
int left = FFMAX(j + (*filterPos)[i], 0);
filter[i * filterSize + left] += filter[i * filterSize + j];
- filter[i * filterSize + j ] = 0;
+ filter[i * filterSize + j] = 0;
}
(*filterPos)[i] = 0;
}
@@ -478,7 +550,7 @@ static int initFilter(int16_t **outFilter, int32_t **filterPos, int *outFilterSi
for (j = filterSize - 2; j >= 0; j--) {
int right = FFMIN(j + shift, filterSize - 1);
filter[i * filterSize + right] += filter[i * filterSize + j];
- filter[i * filterSize + j ] = 0;
+ filter[i * filterSize + j] = 0;
}
(*filterPos)[i] = srcW - filterSize;
}
@@ -487,45 +559,50 @@ static int initFilter(int16_t **outFilter, int32_t **filterPos, int *outFilterSi
// Note the +1 is for the MMX scaler which reads over the end
/* align at 16 for AltiVec (needed by hScale_altivec_real) */
- FF_ALLOCZ_OR_GOTO(NULL, *outFilter, *outFilterSize*(dstW+3)*sizeof(int16_t), fail);
+ FF_ALLOCZ_OR_GOTO(NULL, *outFilter,
+ *outFilterSize * (dstW + 3) * sizeof(int16_t), fail);
/* normalize & store in outFilter */
- for (i=0; i<dstW; i++) {
+ for (i = 0; i < dstW; i++) {
int j;
- int64_t error=0;
- int64_t sum=0;
+ int64_t error = 0;
+ int64_t sum = 0;
- for (j=0; j<filterSize; j++) {
- sum+= filter[i*filterSize + j];
+ for (j = 0; j < filterSize; j++) {
+ sum += filter[i * filterSize + j];
}
- sum= (sum + one/2)/ one;
- for (j=0; j<*outFilterSize; j++) {
- int64_t v= filter[i*filterSize + j] + error;
- int intV= ROUNDED_DIV(v, sum);
- (*outFilter)[i*(*outFilterSize) + j]= intV;
- error= v - intV*sum;
+ sum = (sum + one / 2) / one;
+ for (j = 0; j < *outFilterSize; j++) {
+ int64_t v = filter[i * filterSize + j] + error;
+ int intV = ROUNDED_DIV(v, sum);
+ (*outFilter)[i * (*outFilterSize) + j] = intV;
+ error = v - intV * sum;
}
}
- (*filterPos)[dstW+0] =
- (*filterPos)[dstW+1] =
- (*filterPos)[dstW+2] = (*filterPos)[dstW-1]; // the MMX/SSE scaler will read over the end
- for (i=0; i<*outFilterSize; i++) {
- int k= (dstW - 1) * (*outFilterSize) + i;
+ (*filterPos)[dstW + 0] =
+ (*filterPos)[dstW + 1] =
+ (*filterPos)[dstW + 2] = (*filterPos)[dstW - 1]; /* the MMX/SSE scaler will
+ * read over the end */
+ for (i = 0; i < *outFilterSize; i++) {
+ int k = (dstW - 1) * (*outFilterSize) + i;
(*outFilter)[k + 1 * (*outFilterSize)] =
(*outFilter)[k + 2 * (*outFilterSize)] =
(*outFilter)[k + 3 * (*outFilterSize)] = (*outFilter)[k];
}
- ret=0;
+ ret = 0;
+
fail:
av_free(filter);
av_free(filter2);
return ret;
}
-#if HAVE_MMX2
-static int initMMX2HScaler(int dstW, int xInc, uint8_t *filterCode, int16_t *filter, int32_t *filterPos, int numSplits)
+#if HAVE_MMXEXT_INLINE
+static int init_hscaler_mmxext(int dstW, int xInc, uint8_t *filterCode,
+ int16_t *filter, int32_t *filterPos,
+ int numSplits)
{
uint8_t *fragmentA;
x86_reg imm8OfPShufW1A;
@@ -540,18 +617,17 @@ static int initMMX2HScaler(int dstW, int xInc, uint8_t *filterCode, int16_t *fil
int xpos, i;
// create an optimized horizontal scaling routine
- /* This scaler is made of runtime-generated MMX2 code using specially
- * tuned pshufw instructions. For every four output pixels, if four
- * input pixels are enough for the fast bilinear scaling, then a chunk
- * of fragmentB is used. If five input pixels are needed, then a chunk
- * of fragmentA is used.
+ /* This scaler is made of runtime-generated MMXEXT code using specially tuned
+ * pshufw instructions. For every four output pixels, if four input pixels
+ * are enough for the fast bilinear scaling, then a chunk of fragmentB is
+ * used. If five input pixels are needed, then a chunk of fragmentA is used.
*/
- //code fragment
+ // code fragment
- __asm__ volatile(
+ __asm__ volatile (
"jmp 9f \n\t"
- // Begin
+ // Begin
"0: \n\t"
"movq (%%"REG_d", %%"REG_a"), %%mm3 \n\t"
"movd (%%"REG_c", %%"REG_S"), %%mm0 \n\t"
@@ -571,27 +647,27 @@ static int initMMX2HScaler(int dstW, int xInc, uint8_t *filterCode, int16_t *fil
"movq %%mm0, (%%"REG_D", %%"REG_a") \n\t"
"add $8, %%"REG_a" \n\t"
- // End
+ // End
"9: \n\t"
-// "int $3 \n\t"
- "lea " LOCAL_MANGLE(0b) ", %0 \n\t"
- "lea " LOCAL_MANGLE(1b) ", %1 \n\t"
- "lea " LOCAL_MANGLE(2b) ", %2 \n\t"
+ // "int $3 \n\t"
+ "lea " LOCAL_MANGLE(0b) ", %0 \n\t"
+ "lea " LOCAL_MANGLE(1b) ", %1 \n\t"
+ "lea " LOCAL_MANGLE(2b) ", %2 \n\t"
"dec %1 \n\t"
"dec %2 \n\t"
"sub %0, %1 \n\t"
"sub %0, %2 \n\t"
- "lea " LOCAL_MANGLE(9b) ", %3 \n\t"
+ "lea " LOCAL_MANGLE(9b) ", %3 \n\t"
"sub %0, %3 \n\t"
- :"=r" (fragmentA), "=r" (imm8OfPShufW1A), "=r" (imm8OfPShufW2A),
- "=r" (fragmentLengthA)
- );
+ : "=r" (fragmentA), "=r" (imm8OfPShufW1A), "=r" (imm8OfPShufW2A),
+ "=r" (fragmentLengthA)
+ );
- __asm__ volatile(
+ __asm__ volatile (
"jmp 9f \n\t"
- // Begin
+ // Begin
"0: \n\t"
"movq (%%"REG_d", %%"REG_a"), %%mm3 \n\t"
"movd (%%"REG_c", %%"REG_S"), %%mm0 \n\t"
@@ -609,109 +685,120 @@ static int initMMX2HScaler(int dstW, int xInc, uint8_t *filterCode, int16_t *fil
"movq %%mm0, (%%"REG_D", %%"REG_a") \n\t"
"add $8, %%"REG_a" \n\t"
- // End
+ // End
"9: \n\t"
-// "int $3 \n\t"
- "lea " LOCAL_MANGLE(0b) ", %0 \n\t"
- "lea " LOCAL_MANGLE(1b) ", %1 \n\t"
- "lea " LOCAL_MANGLE(2b) ", %2 \n\t"
+ // "int $3 \n\t"
+ "lea " LOCAL_MANGLE(0b) ", %0 \n\t"
+ "lea " LOCAL_MANGLE(1b) ", %1 \n\t"
+ "lea " LOCAL_MANGLE(2b) ", %2 \n\t"
"dec %1 \n\t"
"dec %2 \n\t"
"sub %0, %1 \n\t"
"sub %0, %2 \n\t"
- "lea " LOCAL_MANGLE(9b) ", %3 \n\t"
+ "lea " LOCAL_MANGLE(9b) ", %3 \n\t"
"sub %0, %3 \n\t"
- :"=r" (fragmentB), "=r" (imm8OfPShufW1B), "=r" (imm8OfPShufW2B),
- "=r" (fragmentLengthB)
- );
+ : "=r" (fragmentB), "=r" (imm8OfPShufW1B), "=r" (imm8OfPShufW2B),
+ "=r" (fragmentLengthB)
+ );
- xpos= 0; //lumXInc/2 - 0x8000; // difference between pixel centers
- fragmentPos=0;
+ xpos = 0; // lumXInc/2 - 0x8000; // difference between pixel centers
+ fragmentPos = 0;
- for (i=0; i<dstW/numSplits; i++) {
- int xx=xpos>>16;
+ for (i = 0; i < dstW / numSplits; i++) {
+ int xx = xpos >> 16;
- if ((i&3) == 0) {
- int a=0;
- int b=((xpos+xInc)>>16) - xx;
- int c=((xpos+xInc*2)>>16) - xx;
- int d=((xpos+xInc*3)>>16) - xx;
- int inc = (d+1<4);
- uint8_t *fragment = (d+1<4) ? fragmentB : fragmentA;
- x86_reg imm8OfPShufW1 = (d+1<4) ? imm8OfPShufW1B : imm8OfPShufW1A;
- x86_reg imm8OfPShufW2 = (d+1<4) ? imm8OfPShufW2B : imm8OfPShufW2A;
- x86_reg fragmentLength = (d+1<4) ? fragmentLengthB : fragmentLengthA;
- int maxShift= 3-(d+inc);
- int shift=0;
+ if ((i & 3) == 0) {
+ int a = 0;
+ int b = ((xpos + xInc) >> 16) - xx;
+ int c = ((xpos + xInc * 2) >> 16) - xx;
+ int d = ((xpos + xInc * 3) >> 16) - xx;
+ int inc = (d + 1 < 4);
+ uint8_t *fragment = (d + 1 < 4) ? fragmentB : fragmentA;
+ x86_reg imm8OfPShufW1 = (d + 1 < 4) ? imm8OfPShufW1B : imm8OfPShufW1A;
+ x86_reg imm8OfPShufW2 = (d + 1 < 4) ? imm8OfPShufW2B : imm8OfPShufW2A;
+ x86_reg fragmentLength = (d + 1 < 4) ? fragmentLengthB : fragmentLengthA;
+ int maxShift = 3 - (d + inc);
+ int shift = 0;
if (filterCode) {
- filter[i ] = (( xpos & 0xFFFF) ^ 0xFFFF)>>9;
- filter[i+1] = (((xpos+xInc ) & 0xFFFF) ^ 0xFFFF)>>9;
- filter[i+2] = (((xpos+xInc*2) & 0xFFFF) ^ 0xFFFF)>>9;
- filter[i+3] = (((xpos+xInc*3) & 0xFFFF) ^ 0xFFFF)>>9;
- filterPos[i/2]= xx;
+ filter[i] = ((xpos & 0xFFFF) ^ 0xFFFF) >> 9;
+ filter[i + 1] = (((xpos + xInc) & 0xFFFF) ^ 0xFFFF) >> 9;
+ filter[i + 2] = (((xpos + xInc * 2) & 0xFFFF) ^ 0xFFFF) >> 9;
+ filter[i + 3] = (((xpos + xInc * 3) & 0xFFFF) ^ 0xFFFF) >> 9;
+ filterPos[i / 2] = xx;
memcpy(filterCode + fragmentPos, fragment, fragmentLength);
- filterCode[fragmentPos + imm8OfPShufW1]=
- (a+inc) | ((b+inc)<<2) | ((c+inc)<<4) | ((d+inc)<<6);
- filterCode[fragmentPos + imm8OfPShufW2]=
- a | (b<<2) | (c<<4) | (d<<6);
-
- if (i+4-inc>=dstW) shift=maxShift; //avoid overread
- else if ((filterPos[i/2]&3) <= maxShift) shift=filterPos[i/2]&3; //Align
-
- if (shift && i>=shift) {
- filterCode[fragmentPos + imm8OfPShufW1]+= 0x55*shift;
- filterCode[fragmentPos + imm8OfPShufW2]+= 0x55*shift;
- filterPos[i/2]-=shift;
+ filterCode[fragmentPos + imm8OfPShufW1] = (a + inc) |
+ ((b + inc) << 2) |
+ ((c + inc) << 4) |
+ ((d + inc) << 6);
+ filterCode[fragmentPos + imm8OfPShufW2] = a | (b << 2) |
+ (c << 4) |
+ (d << 6);
+
+ if (i + 4 - inc >= dstW)
+ shift = maxShift; // avoid overread
+ else if ((filterPos[i / 2] & 3) <= maxShift)
+ shift = filterPos[i / 2] & 3; // align
+
+ if (shift && i >= shift) {
+ filterCode[fragmentPos + imm8OfPShufW1] += 0x55 * shift;
+ filterCode[fragmentPos + imm8OfPShufW2] += 0x55 * shift;
+ filterPos[i / 2] -= shift;
}
}
- fragmentPos+= fragmentLength;
+ fragmentPos += fragmentLength;
if (filterCode)
- filterCode[fragmentPos]= RET;
+ filterCode[fragmentPos] = RET;
}
- xpos+=xInc;
+ xpos += xInc;
}
if (filterCode)
- filterPos[((i/2)+1)&(~1)]= xpos>>16; // needed to jump to the next part
+ filterPos[((i / 2) + 1) & (~1)] = xpos >> 16; // needed to jump to the next part
return fragmentPos + 1;
}
-#endif /* HAVE_MMX2 */
+#endif /* HAVE_MMXEXT_INLINE */
-static void getSubSampleFactors(int *h, int *v, enum PixelFormat format)
+static void getSubSampleFactors(int *h, int *v, enum AVPixelFormat format)
{
- *h = av_pix_fmt_descriptors[format].log2_chroma_w;
- *v = av_pix_fmt_descriptors[format].log2_chroma_h;
+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(format);
+ *h = desc->log2_chroma_w;
+ *v = desc->log2_chroma_h;
}
int sws_setColorspaceDetails(struct SwsContext *c, const int inv_table[4],
int srcRange, const int table[4], int dstRange,
int brightness, int contrast, int saturation)
{
- memcpy(c->srcColorspaceTable, inv_table, sizeof(int)*4);
- memcpy(c->dstColorspaceTable, table, sizeof(int)*4);
-
- c->brightness= brightness;
- c->contrast = contrast;
- c->saturation= saturation;
- c->srcRange = srcRange;
- c->dstRange = dstRange;
- if (isYUV(c->dstFormat) || isGray(c->dstFormat)) return -1;
-
- c->dstFormatBpp = av_get_bits_per_pixel(&av_pix_fmt_descriptors[c->dstFormat]);
- c->srcFormatBpp = av_get_bits_per_pixel(&av_pix_fmt_descriptors[c->srcFormat]);
-
- ff_yuv2rgb_c_init_tables(c, inv_table, srcRange, brightness, contrast, saturation);
- //FIXME factorize
+ const AVPixFmtDescriptor *desc_dst = av_pix_fmt_desc_get(c->dstFormat);
+ const AVPixFmtDescriptor *desc_src = av_pix_fmt_desc_get(c->srcFormat);
+ memcpy(c->srcColorspaceTable, inv_table, sizeof(int) * 4);
+ memcpy(c->dstColorspaceTable, table, sizeof(int) * 4);
+
+ c->brightness = brightness;
+ c->contrast = contrast;
+ c->saturation = saturation;
+ c->srcRange = srcRange;
+ c->dstRange = dstRange;
+ if (isYUV(c->dstFormat) || isGray(c->dstFormat))
+ return -1;
+
+ c->dstFormatBpp = av_get_bits_per_pixel(desc_dst);
+ c->srcFormatBpp = av_get_bits_per_pixel(desc_src);
+
+ ff_yuv2rgb_c_init_tables(c, inv_table, srcRange, brightness,
+ contrast, saturation);
+ // FIXME factorize
if (HAVE_ALTIVEC && av_get_cpu_flags() & AV_CPU_FLAG_ALTIVEC)
- ff_yuv2rgb_init_tables_altivec(c, inv_table, brightness, contrast, saturation);
+ ff_yuv2rgb_init_tables_altivec(c, inv_table, brightness,
+ contrast, saturation);
return 0;
}
@@ -719,165 +806,196 @@ int sws_getColorspaceDetails(struct SwsContext *c, int **inv_table,
int *srcRange, int **table, int *dstRange,
int *brightness, int *contrast, int *saturation)
{
- if (isYUV(c->dstFormat) || isGray(c->dstFormat)) return -1;
+ if (isYUV(c->dstFormat) || isGray(c->dstFormat))
+ return -1;
- *inv_table = c->srcColorspaceTable;
- *table = c->dstColorspaceTable;
- *srcRange = c->srcRange;
- *dstRange = c->dstRange;
- *brightness= c->brightness;
- *contrast = c->contrast;
- *saturation= c->saturation;
+ *inv_table = c->srcColorspaceTable;
+ *table = c->dstColorspaceTable;
+ *srcRange = c->srcRange;
+ *dstRange = c->dstRange;
+ *brightness = c->brightness;
+ *contrast = c->contrast;
+ *saturation = c->saturation;
return 0;
}
-static int handle_jpeg(enum PixelFormat *format)
+static int handle_jpeg(enum AVPixelFormat *format)
{
switch (*format) {
- case PIX_FMT_YUVJ420P: *format = PIX_FMT_YUV420P; return 1;
- case PIX_FMT_YUVJ422P: *format = PIX_FMT_YUV422P; return 1;
- case PIX_FMT_YUVJ444P: *format = PIX_FMT_YUV444P; return 1;
- case PIX_FMT_YUVJ440P: *format = PIX_FMT_YUV440P; return 1;
- default: return 0;
+ case AV_PIX_FMT_YUVJ420P:
+ *format = AV_PIX_FMT_YUV420P;
+ return 1;
+ case AV_PIX_FMT_YUVJ422P:
+ *format = AV_PIX_FMT_YUV422P;
+ return 1;
+ case AV_PIX_FMT_YUVJ444P:
+ *format = AV_PIX_FMT_YUV444P;
+ return 1;
+ case AV_PIX_FMT_YUVJ440P:
+ *format = AV_PIX_FMT_YUV440P;
+ return 1;
+ default:
+ return 0;
}
}
SwsContext *sws_alloc_context(void)
{
- SwsContext *c= av_mallocz(sizeof(SwsContext));
+ SwsContext *c = av_mallocz(sizeof(SwsContext));
- c->av_class = &sws_context_class;
- av_opt_set_defaults(c);
+ if (c) {
+ c->av_class = &sws_context_class;
+ av_opt_set_defaults(c);
+ }
return c;
}
-int sws_init_context(SwsContext *c, SwsFilter *srcFilter, SwsFilter *dstFilter)
+av_cold int sws_init_context(SwsContext *c, SwsFilter *srcFilter,
+ SwsFilter *dstFilter)
{
int i;
int usesVFilter, usesHFilter;
int unscaled;
- SwsFilter dummyFilter= {NULL, NULL, NULL, NULL};
- int srcW= c->srcW;
- int srcH= c->srcH;
- int dstW= c->dstW;
- int dstH= c->dstH;
- int dst_stride = FFALIGN(dstW * sizeof(int16_t) + 16, 16), dst_stride_px = dst_stride >> 1;
+ SwsFilter dummyFilter = { NULL, NULL, NULL, NULL };
+ int srcW = c->srcW;
+ int srcH = c->srcH;
+ int dstW = c->dstW;
+ int dstH = c->dstH;
+ int dst_stride = FFALIGN(dstW * sizeof(int16_t) + 16, 16);
+ int dst_stride_px = dst_stride >> 1;
int flags, cpu_flags;
- enum PixelFormat srcFormat= c->srcFormat;
- enum PixelFormat dstFormat= c->dstFormat;
+ enum AVPixelFormat srcFormat = c->srcFormat;
+ enum AVPixelFormat dstFormat = c->dstFormat;
+ const AVPixFmtDescriptor *desc_src = av_pix_fmt_desc_get(srcFormat);
+ const AVPixFmtDescriptor *desc_dst = av_pix_fmt_desc_get(dstFormat);
cpu_flags = av_get_cpu_flags();
flags = c->flags;
emms_c();
- if (!rgb15to16) sws_rgb2rgb_init();
+ if (!rgb15to16)
+ sws_rgb2rgb_init();
unscaled = (srcW == dstW && srcH == dstH);
if (!sws_isSupportedInput(srcFormat)) {
- av_log(c, AV_LOG_ERROR, "%s is not supported as input pixel format\n", sws_format_name(srcFormat));
+ av_log(c, AV_LOG_ERROR, "%s is not supported as input pixel format\n",
+ sws_format_name(srcFormat));
return AVERROR(EINVAL);
}
if (!sws_isSupportedOutput(dstFormat)) {
- av_log(c, AV_LOG_ERROR, "%s is not supported as output pixel format\n", sws_format_name(dstFormat));
+ av_log(c, AV_LOG_ERROR, "%s is not supported as output pixel format\n",
+ sws_format_name(dstFormat));
return AVERROR(EINVAL);
}
- i= flags & ( SWS_POINT
- |SWS_AREA
- |SWS_BILINEAR
- |SWS_FAST_BILINEAR
- |SWS_BICUBIC
- |SWS_X
- |SWS_GAUSS
- |SWS_LANCZOS
- |SWS_SINC
- |SWS_SPLINE
- |SWS_BICUBLIN);
- if(!i || (i & (i-1))) {
- av_log(c, AV_LOG_ERROR, "Exactly one scaler algorithm must be chosen\n");
+ i = flags & (SWS_POINT |
+ SWS_AREA |
+ SWS_BILINEAR |
+ SWS_FAST_BILINEAR |
+ SWS_BICUBIC |
+ SWS_X |
+ SWS_GAUSS |
+ SWS_LANCZOS |
+ SWS_SINC |
+ SWS_SPLINE |
+ SWS_BICUBLIN);
+ if (!i || (i & (i - 1))) {
+ av_log(c, AV_LOG_ERROR,
+ "Exactly one scaler algorithm must be chosen\n");
return AVERROR(EINVAL);
}
/* sanity check */
- if (srcW<4 || srcH<1 || dstW<8 || dstH<1) { //FIXME check if these are enough and try to lowwer them after fixing the relevant parts of the code
+ if (srcW < 4 || srcH < 1 || dstW < 8 || dstH < 1) {
+ /* FIXME check if these are enough and try to lower them after
+ * fixing the relevant parts of the code */
av_log(c, AV_LOG_ERROR, "%dx%d -> %dx%d is invalid scaling dimension\n",
srcW, srcH, dstW, dstH);
return AVERROR(EINVAL);
}
- if (!dstFilter) dstFilter= &dummyFilter;
- if (!srcFilter) srcFilter= &dummyFilter;
-
- c->lumXInc= (((int64_t)srcW<<16) + (dstW>>1))/dstW;
- c->lumYInc= (((int64_t)srcH<<16) + (dstH>>1))/dstH;
- c->dstFormatBpp = av_get_bits_per_pixel(&av_pix_fmt_descriptors[dstFormat]);
- c->srcFormatBpp = av_get_bits_per_pixel(&av_pix_fmt_descriptors[srcFormat]);
- c->vRounder= 4* 0x0001000100010001ULL;
-
- usesVFilter = (srcFilter->lumV && srcFilter->lumV->length>1) ||
- (srcFilter->chrV && srcFilter->chrV->length>1) ||
- (dstFilter->lumV && dstFilter->lumV->length>1) ||
- (dstFilter->chrV && dstFilter->chrV->length>1);
- usesHFilter = (srcFilter->lumH && srcFilter->lumH->length>1) ||
- (srcFilter->chrH && srcFilter->chrH->length>1) ||
- (dstFilter->lumH && dstFilter->lumH->length>1) ||
- (dstFilter->chrH && dstFilter->chrH->length>1);
+ if (!dstFilter)
+ dstFilter = &dummyFilter;
+ if (!srcFilter)
+ srcFilter = &dummyFilter;
+
+ c->lumXInc = (((int64_t)srcW << 16) + (dstW >> 1)) / dstW;
+ c->lumYInc = (((int64_t)srcH << 16) + (dstH >> 1)) / dstH;
+ c->dstFormatBpp = av_get_bits_per_pixel(desc_dst);
+ c->srcFormatBpp = av_get_bits_per_pixel(desc_src);
+ c->vRounder = 4 * 0x0001000100010001ULL;
+
+ usesVFilter = (srcFilter->lumV && srcFilter->lumV->length > 1) ||
+ (srcFilter->chrV && srcFilter->chrV->length > 1) ||
+ (dstFilter->lumV && dstFilter->lumV->length > 1) ||
+ (dstFilter->chrV && dstFilter->chrV->length > 1);
+ usesHFilter = (srcFilter->lumH && srcFilter->lumH->length > 1) ||
+ (srcFilter->chrH && srcFilter->chrH->length > 1) ||
+ (dstFilter->lumH && dstFilter->lumH->length > 1) ||
+ (dstFilter->chrH && dstFilter->chrH->length > 1);
getSubSampleFactors(&c->chrSrcHSubSample, &c->chrSrcVSubSample, srcFormat);
getSubSampleFactors(&c->chrDstHSubSample, &c->chrDstVSubSample, dstFormat);
- // reuse chroma for 2 pixels RGB/BGR unless user wants full chroma interpolation
+ /* reuse chroma for 2 pixels RGB/BGR unless user wants full
+ * chroma interpolation */
if (flags & SWS_FULL_CHR_H_INT &&
- isAnyRGB(dstFormat) &&
- dstFormat != PIX_FMT_RGBA &&
- dstFormat != PIX_FMT_ARGB &&
- dstFormat != PIX_FMT_BGRA &&
- dstFormat != PIX_FMT_ABGR &&
- dstFormat != PIX_FMT_RGB24 &&
- dstFormat != PIX_FMT_BGR24) {
+ isAnyRGB(dstFormat) &&
+ dstFormat != AV_PIX_FMT_RGBA &&
+ dstFormat != AV_PIX_FMT_ARGB &&
+ dstFormat != AV_PIX_FMT_BGRA &&
+ dstFormat != AV_PIX_FMT_ABGR &&
+ dstFormat != AV_PIX_FMT_RGB24 &&
+ dstFormat != AV_PIX_FMT_BGR24) {
av_log(c, AV_LOG_ERROR,
"full chroma interpolation for destination format '%s' not yet implemented\n",
sws_format_name(dstFormat));
- flags &= ~SWS_FULL_CHR_H_INT;
+ flags &= ~SWS_FULL_CHR_H_INT;
c->flags = flags;
}
- if (isAnyRGB(dstFormat) && !(flags&SWS_FULL_CHR_H_INT)) c->chrDstHSubSample=1;
+ if (isAnyRGB(dstFormat) && !(flags & SWS_FULL_CHR_H_INT))
+ c->chrDstHSubSample = 1;
// drop some chroma lines if the user wants it
- c->vChrDrop= (flags&SWS_SRC_V_CHR_DROP_MASK)>>SWS_SRC_V_CHR_DROP_SHIFT;
- c->chrSrcVSubSample+= c->vChrDrop;
-
- // drop every other pixel for chroma calculation unless user wants full chroma
- if (isAnyRGB(srcFormat) && !(flags&SWS_FULL_CHR_H_INP)
- && srcFormat!=PIX_FMT_RGB8 && srcFormat!=PIX_FMT_BGR8
- && srcFormat!=PIX_FMT_RGB4 && srcFormat!=PIX_FMT_BGR4
- && srcFormat!=PIX_FMT_RGB4_BYTE && srcFormat!=PIX_FMT_BGR4_BYTE
- && ((dstW>>c->chrDstHSubSample) <= (srcW>>1) || (flags&SWS_FAST_BILINEAR)))
- c->chrSrcHSubSample=1;
+ c->vChrDrop = (flags & SWS_SRC_V_CHR_DROP_MASK) >>
+ SWS_SRC_V_CHR_DROP_SHIFT;
+ c->chrSrcVSubSample += c->vChrDrop;
+
+ /* drop every other pixel for chroma calculation unless user
+ * wants full chroma */
+ if (isAnyRGB(srcFormat) && !(flags & SWS_FULL_CHR_H_INP) &&
+ srcFormat != AV_PIX_FMT_RGB8 && srcFormat != AV_PIX_FMT_BGR8 &&
+ srcFormat != AV_PIX_FMT_RGB4 && srcFormat != AV_PIX_FMT_BGR4 &&
+ srcFormat != AV_PIX_FMT_RGB4_BYTE && srcFormat != AV_PIX_FMT_BGR4_BYTE &&
+ ((dstW >> c->chrDstHSubSample) <= (srcW >> 1) ||
+ (flags & SWS_FAST_BILINEAR)))
+ c->chrSrcHSubSample = 1;
// Note the -((-x)>>y) is so that we always round toward +inf.
- c->chrSrcW= -((-srcW) >> c->chrSrcHSubSample);
- c->chrSrcH= -((-srcH) >> c->chrSrcVSubSample);
- c->chrDstW= -((-dstW) >> c->chrDstHSubSample);
- c->chrDstH= -((-dstH) >> c->chrDstVSubSample);
+ c->chrSrcW = -((-srcW) >> c->chrSrcHSubSample);
+ c->chrSrcH = -((-srcH) >> c->chrSrcVSubSample);
+ c->chrDstW = -((-dstW) >> c->chrDstHSubSample);
+ c->chrDstH = -((-dstH) >> c->chrDstVSubSample);
/* unscaled special cases */
- if (unscaled && !usesHFilter && !usesVFilter && (c->srcRange == c->dstRange || isAnyRGB(dstFormat))) {
+ if (unscaled && !usesHFilter && !usesVFilter &&
+ (c->srcRange == c->dstRange || isAnyRGB(dstFormat))) {
ff_get_unscaled_swscale(c);
if (c->swScale) {
- if (flags&SWS_PRINT_INFO)
- av_log(c, AV_LOG_INFO, "using unscaled %s -> %s special converter\n",
+ if (flags & SWS_PRINT_INFO)
+ av_log(c, AV_LOG_INFO,
+ "using unscaled %s -> %s special converter\n",
sws_format_name(srcFormat), sws_format_name(dstFormat));
return 0;
}
}
- c->srcBpc = 1 + av_pix_fmt_descriptors[srcFormat].comp[0].depth_minus1;
+ c->srcBpc = 1 + desc_src->comp[0].depth_minus1;
if (c->srcBpc < 8)
c->srcBpc = 8;
- c->dstBpc = 1 + av_pix_fmt_descriptors[dstFormat].comp[0].depth_minus1;
+ c->dstBpc = 1 + desc_dst->comp[0].depth_minus1;
if (c->dstBpc < 8)
c->dstBpc = 8;
if (c->dstBpc == 16)
@@ -885,250 +1003,311 @@ int sws_init_context(SwsContext *c, SwsFilter *srcFilter, SwsFilter *dstFilter)
FF_ALLOC_OR_GOTO(c, c->formatConvBuffer,
(FFALIGN(srcW, 16) * 2 * FFALIGN(c->srcBpc, 8) >> 3) + 16,
fail);
- if (HAVE_MMX2 && cpu_flags & AV_CPU_FLAG_MMX2 && c->srcBpc == 8 && c->dstBpc <= 10) {
- c->canMMX2BeUsed= (dstW >=srcW && (dstW&31)==0 && (srcW&15)==0) ? 1 : 0;
- if (!c->canMMX2BeUsed && dstW >=srcW && (srcW&15)==0 && (flags&SWS_FAST_BILINEAR)) {
- if (flags&SWS_PRINT_INFO)
- av_log(c, AV_LOG_INFO, "output width is not a multiple of 32 -> no MMX2 scaler\n");
+ if (INLINE_MMXEXT(cpu_flags) && c->srcBpc == 8 && c->dstBpc <= 10) {
+ c->canMMXEXTBeUsed = (dstW >= srcW && (dstW & 31) == 0 &&
+ (srcW & 15) == 0) ? 1 : 0;
+ if (!c->canMMXEXTBeUsed && dstW >= srcW && (srcW & 15) == 0
+ && (flags & SWS_FAST_BILINEAR)) {
+ if (flags & SWS_PRINT_INFO)
+ av_log(c, AV_LOG_INFO,
+ "output width is not a multiple of 32 -> no MMXEXT scaler\n");
}
- if (usesHFilter) c->canMMX2BeUsed=0;
- }
- else
- c->canMMX2BeUsed=0;
-
- c->chrXInc= (((int64_t)c->chrSrcW<<16) + (c->chrDstW>>1))/c->chrDstW;
- c->chrYInc= (((int64_t)c->chrSrcH<<16) + (c->chrDstH>>1))/c->chrDstH;
-
- // match pixel 0 of the src to pixel 0 of dst and match pixel n-2 of src to pixel n-2 of dst
- // but only for the FAST_BILINEAR mode otherwise do correct scaling
- // n-2 is the last chrominance sample available
- // this is not perfect, but no one should notice the difference, the more correct variant
- // would be like the vertical one, but that would require some special code for the
- // first and last pixel
- if (flags&SWS_FAST_BILINEAR) {
- if (c->canMMX2BeUsed) {
- c->lumXInc+= 20;
- c->chrXInc+= 20;
+ if (usesHFilter)
+ c->canMMXEXTBeUsed = 0;
+ } else
+ c->canMMXEXTBeUsed = 0;
+
+ c->chrXInc = (((int64_t)c->chrSrcW << 16) + (c->chrDstW >> 1)) / c->chrDstW;
+ c->chrYInc = (((int64_t)c->chrSrcH << 16) + (c->chrDstH >> 1)) / c->chrDstH;
+
+ /* Match pixel 0 of the src to pixel 0 of dst and match pixel n-2 of src
+ * to pixel n-2 of dst, but only for the FAST_BILINEAR mode otherwise do
+ * correct scaling.
+ * n-2 is the last chrominance sample available.
+ * This is not perfect, but no one should notice the difference, the more
+ * correct variant would be like the vertical one, but that would require
+ * some special code for the first and last pixel */
+ if (flags & SWS_FAST_BILINEAR) {
+ if (c->canMMXEXTBeUsed) {
+ c->lumXInc += 20;
+ c->chrXInc += 20;
}
- //we don't use the x86 asm scaler if MMX is available
- else if (HAVE_MMX && cpu_flags & AV_CPU_FLAG_MMX) {
- c->lumXInc = ((int64_t)(srcW-2)<<16)/(dstW-2) - 20;
- c->chrXInc = ((int64_t)(c->chrSrcW-2)<<16)/(c->chrDstW-2) - 20;
+ // we don't use the x86 asm scaler if MMX is available
+ else if (INLINE_MMX(cpu_flags)) {
+ c->lumXInc = ((int64_t)(srcW - 2) << 16) / (dstW - 2) - 20;
+ c->chrXInc = ((int64_t)(c->chrSrcW - 2) << 16) / (c->chrDstW - 2) - 20;
}
}
+#define USE_MMAP (HAVE_MMAP && HAVE_MPROTECT && defined MAP_ANONYMOUS)
+
/* precalculate horizontal scaler filter coefficients */
{
-#if HAVE_MMX2
+#if HAVE_MMXEXT_INLINE
// can't downscale !!!
- if (c->canMMX2BeUsed && (flags & SWS_FAST_BILINEAR)) {
- c->lumMmx2FilterCodeSize = initMMX2HScaler( dstW, c->lumXInc, NULL, NULL, NULL, 8);
- c->chrMmx2FilterCodeSize = initMMX2HScaler(c->chrDstW, c->chrXInc, NULL, NULL, NULL, 4);
-
-#ifdef MAP_ANONYMOUS
- c->lumMmx2FilterCode = mmap(NULL, c->lumMmx2FilterCodeSize, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
- c->chrMmx2FilterCode = mmap(NULL, c->chrMmx2FilterCodeSize, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
+ if (c->canMMXEXTBeUsed && (flags & SWS_FAST_BILINEAR)) {
+ c->lumMmxextFilterCodeSize = init_hscaler_mmxext(dstW, c->lumXInc, NULL,
+ NULL, NULL, 8);
+ c->chrMmxextFilterCodeSize = init_hscaler_mmxext(c->chrDstW, c->chrXInc,
+ NULL, NULL, NULL, 4);
+
+#if USE_MMAP
+ c->lumMmxextFilterCode = mmap(NULL, c->lumMmxextFilterCodeSize,
+ PROT_READ | PROT_WRITE,
+ MAP_PRIVATE | MAP_ANONYMOUS,
+ -1, 0);
+ c->chrMmxextFilterCode = mmap(NULL, c->chrMmxextFilterCodeSize,
+ PROT_READ | PROT_WRITE,
+ MAP_PRIVATE | MAP_ANONYMOUS,
+ -1, 0);
#elif HAVE_VIRTUALALLOC
- c->lumMmx2FilterCode = VirtualAlloc(NULL, c->lumMmx2FilterCodeSize, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
- c->chrMmx2FilterCode = VirtualAlloc(NULL, c->chrMmx2FilterCodeSize, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
+ c->lumMmxextFilterCode = VirtualAlloc(NULL,
+ c->lumMmxextFilterCodeSize,
+ MEM_COMMIT,
+ PAGE_EXECUTE_READWRITE);
+ c->chrMmxextFilterCode = VirtualAlloc(NULL,
+ c->chrMmxextFilterCodeSize,
+ MEM_COMMIT,
+ PAGE_EXECUTE_READWRITE);
#else
- c->lumMmx2FilterCode = av_malloc(c->lumMmx2FilterCodeSize);
- c->chrMmx2FilterCode = av_malloc(c->chrMmx2FilterCodeSize);
+ c->lumMmxextFilterCode = av_malloc(c->lumMmxextFilterCodeSize);
+ c->chrMmxextFilterCode = av_malloc(c->chrMmxextFilterCodeSize);
#endif
- if (!c->lumMmx2FilterCode || !c->chrMmx2FilterCode)
+ if (!c->lumMmxextFilterCode || !c->chrMmxextFilterCode)
return AVERROR(ENOMEM);
- FF_ALLOCZ_OR_GOTO(c, c->hLumFilter , (dstW /8+8)*sizeof(int16_t), fail);
- FF_ALLOCZ_OR_GOTO(c, c->hChrFilter , (c->chrDstW /4+8)*sizeof(int16_t), fail);
- FF_ALLOCZ_OR_GOTO(c, c->hLumFilterPos, (dstW /2/8+8)*sizeof(int32_t), fail);
- FF_ALLOCZ_OR_GOTO(c, c->hChrFilterPos, (c->chrDstW/2/4+8)*sizeof(int32_t), fail);
-
- initMMX2HScaler( dstW, c->lumXInc, c->lumMmx2FilterCode, c->hLumFilter, c->hLumFilterPos, 8);
- initMMX2HScaler(c->chrDstW, c->chrXInc, c->chrMmx2FilterCode, c->hChrFilter, c->hChrFilterPos, 4);
-
-#ifdef MAP_ANONYMOUS
- mprotect(c->lumMmx2FilterCode, c->lumMmx2FilterCodeSize, PROT_EXEC | PROT_READ);
- mprotect(c->chrMmx2FilterCode, c->chrMmx2FilterCodeSize, PROT_EXEC | PROT_READ);
+ FF_ALLOCZ_OR_GOTO(c, c->hLumFilter, (dstW / 8 + 8) * sizeof(int16_t), fail);
+ FF_ALLOCZ_OR_GOTO(c, c->hChrFilter, (c->chrDstW / 4 + 8) * sizeof(int16_t), fail);
+ FF_ALLOCZ_OR_GOTO(c, c->hLumFilterPos, (dstW / 2 / 8 + 8) * sizeof(int32_t), fail);
+ FF_ALLOCZ_OR_GOTO(c, c->hChrFilterPos, (c->chrDstW / 2 / 4 + 8) * sizeof(int32_t), fail);
+
+ init_hscaler_mmxext(dstW, c->lumXInc, c->lumMmxextFilterCode,
+ c->hLumFilter, c->hLumFilterPos, 8);
+ init_hscaler_mmxext(c->chrDstW, c->chrXInc, c->chrMmxextFilterCode,
+ c->hChrFilter, c->hChrFilterPos, 4);
+
+#if USE_MMAP
+ mprotect(c->lumMmxextFilterCode, c->lumMmxextFilterCodeSize, PROT_EXEC | PROT_READ);
+ mprotect(c->chrMmxextFilterCode, c->chrMmxextFilterCodeSize, PROT_EXEC | PROT_READ);
#endif
} else
-#endif /* HAVE_MMX2 */
+#endif /* HAVE_MMXEXT_INLINE */
{
- const int filterAlign=
- (HAVE_MMX && cpu_flags & AV_CPU_FLAG_MMX) ? 4 :
+ const int filterAlign =
+ (HAVE_MMX && cpu_flags & AV_CPU_FLAG_MMX) ? 4 :
(HAVE_ALTIVEC && cpu_flags & AV_CPU_FLAG_ALTIVEC) ? 8 :
1;
- if (initFilter(&c->hLumFilter, &c->hLumFilterPos, &c->hLumFilterSize, c->lumXInc,
- srcW , dstW, filterAlign, 1<<14,
- (flags&SWS_BICUBLIN) ? (flags|SWS_BICUBIC) : flags, cpu_flags,
- srcFilter->lumH, dstFilter->lumH, c->param, 1) < 0)
+ if (initFilter(&c->hLumFilter, &c->hLumFilterPos,
+ &c->hLumFilterSize, c->lumXInc,
+ srcW, dstW, filterAlign, 1 << 14,
+ (flags & SWS_BICUBLIN) ? (flags | SWS_BICUBIC) : flags,
+ cpu_flags, srcFilter->lumH, dstFilter->lumH,
+ c->param, 1) < 0)
goto fail;
- if (initFilter(&c->hChrFilter, &c->hChrFilterPos, &c->hChrFilterSize, c->chrXInc,
- c->chrSrcW, c->chrDstW, filterAlign, 1<<14,
- (flags&SWS_BICUBLIN) ? (flags|SWS_BILINEAR) : flags, cpu_flags,
- srcFilter->chrH, dstFilter->chrH, c->param, 1) < 0)
+ if (initFilter(&c->hChrFilter, &c->hChrFilterPos,
+ &c->hChrFilterSize, c->chrXInc,
+ c->chrSrcW, c->chrDstW, filterAlign, 1 << 14,
+ (flags & SWS_BICUBLIN) ? (flags | SWS_BILINEAR) : flags,
+ cpu_flags, srcFilter->chrH, dstFilter->chrH,
+ c->param, 1) < 0)
goto fail;
}
} // initialize horizontal stuff
/* precalculate vertical scaler filter coefficients */
{
- const int filterAlign=
- (HAVE_MMX && cpu_flags & AV_CPU_FLAG_MMX) ? 2 :
+ const int filterAlign =
+ (HAVE_MMX && cpu_flags & AV_CPU_FLAG_MMX) ? 2 :
(HAVE_ALTIVEC && cpu_flags & AV_CPU_FLAG_ALTIVEC) ? 8 :
1;
- if (initFilter(&c->vLumFilter, &c->vLumFilterPos, &c->vLumFilterSize, c->lumYInc,
- srcH , dstH, filterAlign, (1<<12),
- (flags&SWS_BICUBLIN) ? (flags|SWS_BICUBIC) : flags, cpu_flags,
- srcFilter->lumV, dstFilter->lumV, c->param, 0) < 0)
+ if (initFilter(&c->vLumFilter, &c->vLumFilterPos, &c->vLumFilterSize,
+ c->lumYInc, srcH, dstH, filterAlign, (1 << 12),
+ (flags & SWS_BICUBLIN) ? (flags | SWS_BICUBIC) : flags,
+ cpu_flags, srcFilter->lumV, dstFilter->lumV,
+ c->param, 0) < 0)
goto fail;
- if (initFilter(&c->vChrFilter, &c->vChrFilterPos, &c->vChrFilterSize, c->chrYInc,
- c->chrSrcH, c->chrDstH, filterAlign, (1<<12),
- (flags&SWS_BICUBLIN) ? (flags|SWS_BILINEAR) : flags, cpu_flags,
- srcFilter->chrV, dstFilter->chrV, c->param, 0) < 0)
+ if (initFilter(&c->vChrFilter, &c->vChrFilterPos, &c->vChrFilterSize,
+ c->chrYInc, c->chrSrcH, c->chrDstH,
+ filterAlign, (1 << 12),
+ (flags & SWS_BICUBLIN) ? (flags | SWS_BILINEAR) : flags,
+ cpu_flags, srcFilter->chrV, dstFilter->chrV,
+ c->param, 0) < 0)
goto fail;
#if HAVE_ALTIVEC
- FF_ALLOC_OR_GOTO(c, c->vYCoeffsBank, sizeof (vector signed short)*c->vLumFilterSize*c->dstH, fail);
- FF_ALLOC_OR_GOTO(c, c->vCCoeffsBank, sizeof (vector signed short)*c->vChrFilterSize*c->chrDstH, fail);
+ FF_ALLOC_OR_GOTO(c, c->vYCoeffsBank, sizeof(vector signed short) * c->vLumFilterSize * c->dstH, fail);
+ FF_ALLOC_OR_GOTO(c, c->vCCoeffsBank, sizeof(vector signed short) * c->vChrFilterSize * c->chrDstH, fail);
- for (i=0;i<c->vLumFilterSize*c->dstH;i++) {
+ for (i = 0; i < c->vLumFilterSize * c->dstH; i++) {
int j;
short *p = (short *)&c->vYCoeffsBank[i];
- for (j=0;j<8;j++)
+ for (j = 0; j < 8; j++)
p[j] = c->vLumFilter[i];
}
- for (i=0;i<c->vChrFilterSize*c->chrDstH;i++) {
+ for (i = 0; i < c->vChrFilterSize * c->chrDstH; i++) {
int j;
short *p = (short *)&c->vCCoeffsBank[i];
- for (j=0;j<8;j++)
+ for (j = 0; j < 8; j++)
p[j] = c->vChrFilter[i];
}
#endif
}
// calculate buffer sizes so that they won't run out while handling these damn slices
- c->vLumBufSize= c->vLumFilterSize;
- c->vChrBufSize= c->vChrFilterSize;
- for (i=0; i<dstH; i++) {
- int chrI = (int64_t) i * c->chrDstH / dstH;
- int nextSlice= FFMAX(c->vLumFilterPos[i ] + c->vLumFilterSize - 1,
- ((c->vChrFilterPos[chrI] + c->vChrFilterSize - 1)<<c->chrSrcVSubSample));
-
- nextSlice>>= c->chrSrcVSubSample;
- nextSlice<<= c->chrSrcVSubSample;
- if (c->vLumFilterPos[i ] + c->vLumBufSize < nextSlice)
- c->vLumBufSize= nextSlice - c->vLumFilterPos[i];
- if (c->vChrFilterPos[chrI] + c->vChrBufSize < (nextSlice>>c->chrSrcVSubSample))
- c->vChrBufSize= (nextSlice>>c->chrSrcVSubSample) - c->vChrFilterPos[chrI];
+ c->vLumBufSize = c->vLumFilterSize;
+ c->vChrBufSize = c->vChrFilterSize;
+ for (i = 0; i < dstH; i++) {
+ int chrI = (int64_t)i * c->chrDstH / dstH;
+ int nextSlice = FFMAX(c->vLumFilterPos[i] + c->vLumFilterSize - 1,
+ ((c->vChrFilterPos[chrI] + c->vChrFilterSize - 1)
+ << c->chrSrcVSubSample));
+
+ nextSlice >>= c->chrSrcVSubSample;
+ nextSlice <<= c->chrSrcVSubSample;
+ if (c->vLumFilterPos[i] + c->vLumBufSize < nextSlice)
+ c->vLumBufSize = nextSlice - c->vLumFilterPos[i];
+ if (c->vChrFilterPos[chrI] + c->vChrBufSize <
+ (nextSlice >> c->chrSrcVSubSample))
+ c->vChrBufSize = (nextSlice >> c->chrSrcVSubSample) -
+ c->vChrFilterPos[chrI];
}
- // allocate pixbufs (we use dynamic allocation because otherwise we would need to
- // allocate several megabytes to handle all possible cases)
- FF_ALLOC_OR_GOTO(c, c->lumPixBuf, c->vLumBufSize*3*sizeof(int16_t*), fail);
- FF_ALLOC_OR_GOTO(c, c->chrUPixBuf, c->vChrBufSize*3*sizeof(int16_t*), fail);
- FF_ALLOC_OR_GOTO(c, c->chrVPixBuf, c->vChrBufSize*3*sizeof(int16_t*), fail);
+ /* Allocate pixbufs (we use dynamic allocation because otherwise we would
+ * need to allocate several megabytes to handle all possible cases) */
+ FF_ALLOC_OR_GOTO(c, c->lumPixBuf, c->vLumBufSize * 3 * sizeof(int16_t *), fail);
+ FF_ALLOC_OR_GOTO(c, c->chrUPixBuf, c->vChrBufSize * 3 * sizeof(int16_t *), fail);
+ FF_ALLOC_OR_GOTO(c, c->chrVPixBuf, c->vChrBufSize * 3 * sizeof(int16_t *), fail);
if (CONFIG_SWSCALE_ALPHA && isALPHA(c->srcFormat) && isALPHA(c->dstFormat))
- FF_ALLOCZ_OR_GOTO(c, c->alpPixBuf, c->vLumBufSize*3*sizeof(int16_t*), fail);
- //Note we need at least one pixel more at the end because of the MMX code (just in case someone wanna replace the 4000/8000)
+ FF_ALLOCZ_OR_GOTO(c, c->alpPixBuf, c->vLumBufSize * 3 * sizeof(int16_t *), fail);
+ /* Note we need at least one pixel more at the end because of the MMX code
+ * (just in case someone wants to replace the 4000/8000). */
/* align at 16 bytes for AltiVec */
- for (i=0; i<c->vLumBufSize; i++) {
- FF_ALLOCZ_OR_GOTO(c, c->lumPixBuf[i+c->vLumBufSize], dst_stride+16, fail);
- c->lumPixBuf[i] = c->lumPixBuf[i+c->vLumBufSize];
+ for (i = 0; i < c->vLumBufSize; i++) {
+ FF_ALLOCZ_OR_GOTO(c, c->lumPixBuf[i + c->vLumBufSize],
+ dst_stride + 16, fail);
+ c->lumPixBuf[i] = c->lumPixBuf[i + c->vLumBufSize];
}
// 64 / (c->dstBpc & ~7) is the same as 16 / sizeof(scaling_intermediate)
- c->uv_off_px = dst_stride_px + 64 / (c->dstBpc &~ 7);
+ c->uv_off_px = dst_stride_px + 64 / (c->dstBpc & ~7);
c->uv_off_byte = dst_stride + 16;
- for (i=0; i<c->vChrBufSize; i++) {
- FF_ALLOC_OR_GOTO(c, c->chrUPixBuf[i+c->vChrBufSize], dst_stride*2+32, fail);
- c->chrUPixBuf[i] = c->chrUPixBuf[i+c->vChrBufSize];
- c->chrVPixBuf[i] = c->chrVPixBuf[i+c->vChrBufSize] = c->chrUPixBuf[i] + (dst_stride >> 1) + 8;
+ for (i = 0; i < c->vChrBufSize; i++) {
+ FF_ALLOC_OR_GOTO(c, c->chrUPixBuf[i + c->vChrBufSize],
+ dst_stride * 2 + 32, fail);
+ c->chrUPixBuf[i] = c->chrUPixBuf[i + c->vChrBufSize];
+ c->chrVPixBuf[i] = c->chrVPixBuf[i + c->vChrBufSize]
+ = c->chrUPixBuf[i] + (dst_stride >> 1) + 8;
}
if (CONFIG_SWSCALE_ALPHA && c->alpPixBuf)
- for (i=0; i<c->vLumBufSize; i++) {
- FF_ALLOCZ_OR_GOTO(c, c->alpPixBuf[i+c->vLumBufSize], dst_stride+16, fail);
- c->alpPixBuf[i] = c->alpPixBuf[i+c->vLumBufSize];
+ for (i = 0; i < c->vLumBufSize; i++) {
+ FF_ALLOCZ_OR_GOTO(c, c->alpPixBuf[i + c->vLumBufSize],
+ dst_stride + 16, fail);
+ c->alpPixBuf[i] = c->alpPixBuf[i + c->vLumBufSize];
}
- //try to avoid drawing green stuff between the right end and the stride end
- for (i=0; i<c->vChrBufSize; i++)
- memset(c->chrUPixBuf[i], 64, dst_stride*2+1);
+ // try to avoid drawing green stuff between the right end and the stride end
+ for (i = 0; i < c->vChrBufSize; i++)
+ memset(c->chrUPixBuf[i], 64, dst_stride * 2 + 1);
assert(c->chrDstH <= dstH);
- if (flags&SWS_PRINT_INFO) {
- if (flags&SWS_FAST_BILINEAR) av_log(c, AV_LOG_INFO, "FAST_BILINEAR scaler, ");
- else if (flags&SWS_BILINEAR) av_log(c, AV_LOG_INFO, "BILINEAR scaler, ");
- else if (flags&SWS_BICUBIC) av_log(c, AV_LOG_INFO, "BICUBIC scaler, ");
- else if (flags&SWS_X) av_log(c, AV_LOG_INFO, "Experimental scaler, ");
- else if (flags&SWS_POINT) av_log(c, AV_LOG_INFO, "Nearest Neighbor / POINT scaler, ");
- else if (flags&SWS_AREA) av_log(c, AV_LOG_INFO, "Area Averaging scaler, ");
- else if (flags&SWS_BICUBLIN) av_log(c, AV_LOG_INFO, "luma BICUBIC / chroma BILINEAR scaler, ");
- else if (flags&SWS_GAUSS) av_log(c, AV_LOG_INFO, "Gaussian scaler, ");
- else if (flags&SWS_SINC) av_log(c, AV_LOG_INFO, "Sinc scaler, ");
- else if (flags&SWS_LANCZOS) av_log(c, AV_LOG_INFO, "Lanczos scaler, ");
- else if (flags&SWS_SPLINE) av_log(c, AV_LOG_INFO, "Bicubic spline scaler, ");
- else av_log(c, AV_LOG_INFO, "ehh flags invalid?! ");
+ if (flags & SWS_PRINT_INFO) {
+ if (flags & SWS_FAST_BILINEAR)
+ av_log(c, AV_LOG_INFO, "FAST_BILINEAR scaler, ");
+ else if (flags & SWS_BILINEAR)
+ av_log(c, AV_LOG_INFO, "BILINEAR scaler, ");
+ else if (flags & SWS_BICUBIC)
+ av_log(c, AV_LOG_INFO, "BICUBIC scaler, ");
+ else if (flags & SWS_X)
+ av_log(c, AV_LOG_INFO, "Experimental scaler, ");
+ else if (flags & SWS_POINT)
+ av_log(c, AV_LOG_INFO, "Nearest Neighbor / POINT scaler, ");
+ else if (flags & SWS_AREA)
+ av_log(c, AV_LOG_INFO, "Area Averaging scaler, ");
+ else if (flags & SWS_BICUBLIN)
+ av_log(c, AV_LOG_INFO, "luma BICUBIC / chroma BILINEAR scaler, ");
+ else if (flags & SWS_GAUSS)
+ av_log(c, AV_LOG_INFO, "Gaussian scaler, ");
+ else if (flags & SWS_SINC)
+ av_log(c, AV_LOG_INFO, "Sinc scaler, ");
+ else if (flags & SWS_LANCZOS)
+ av_log(c, AV_LOG_INFO, "Lanczos scaler, ");
+ else if (flags & SWS_SPLINE)
+ av_log(c, AV_LOG_INFO, "Bicubic spline scaler, ");
+ else
+ av_log(c, AV_LOG_INFO, "ehh flags invalid?! ");
av_log(c, AV_LOG_INFO, "from %s to %s%s ",
sws_format_name(srcFormat),
#ifdef DITHER1XBPP
- dstFormat == PIX_FMT_BGR555 || dstFormat == PIX_FMT_BGR565 ||
- dstFormat == PIX_FMT_RGB444BE || dstFormat == PIX_FMT_RGB444LE ||
- dstFormat == PIX_FMT_BGR444BE || dstFormat == PIX_FMT_BGR444LE ? "dithered " : "",
+ dstFormat == AV_PIX_FMT_BGR555 || dstFormat == AV_PIX_FMT_BGR565 ||
+ dstFormat == AV_PIX_FMT_RGB444BE || dstFormat == AV_PIX_FMT_RGB444LE ||
+ dstFormat == AV_PIX_FMT_BGR444BE || dstFormat == AV_PIX_FMT_BGR444LE ?
+ "dithered " : "",
#else
"",
#endif
sws_format_name(dstFormat));
- if (HAVE_MMX2 && cpu_flags & AV_CPU_FLAG_MMX2) av_log(c, AV_LOG_INFO, "using MMX2\n");
- else if (HAVE_AMD3DNOW && cpu_flags & AV_CPU_FLAG_3DNOW) av_log(c, AV_LOG_INFO, "using 3DNOW\n");
- else if (HAVE_MMX && cpu_flags & AV_CPU_FLAG_MMX) av_log(c, AV_LOG_INFO, "using MMX\n");
- else if (HAVE_ALTIVEC && cpu_flags & AV_CPU_FLAG_ALTIVEC) av_log(c, AV_LOG_INFO, "using AltiVec\n");
- else av_log(c, AV_LOG_INFO, "using C\n");
+ if (INLINE_MMXEXT(cpu_flags))
+ av_log(c, AV_LOG_INFO, "using MMXEXT\n");
+ else if (INLINE_AMD3DNOW(cpu_flags))
+ av_log(c, AV_LOG_INFO, "using 3DNOW\n");
+ else if (INLINE_MMX(cpu_flags))
+ av_log(c, AV_LOG_INFO, "using MMX\n");
+ else if (HAVE_ALTIVEC && cpu_flags & AV_CPU_FLAG_ALTIVEC)
+ av_log(c, AV_LOG_INFO, "using AltiVec\n");
+ else
+ av_log(c, AV_LOG_INFO, "using C\n");
av_log(c, AV_LOG_VERBOSE, "%dx%d -> %dx%d\n", srcW, srcH, dstW, dstH);
- av_log(c, AV_LOG_DEBUG, "lum srcW=%d srcH=%d dstW=%d dstH=%d xInc=%d yInc=%d\n",
+ av_log(c, AV_LOG_DEBUG,
+ "lum srcW=%d srcH=%d dstW=%d dstH=%d xInc=%d yInc=%d\n",
c->srcW, c->srcH, c->dstW, c->dstH, c->lumXInc, c->lumYInc);
- av_log(c, AV_LOG_DEBUG, "chr srcW=%d srcH=%d dstW=%d dstH=%d xInc=%d yInc=%d\n",
- c->chrSrcW, c->chrSrcH, c->chrDstW, c->chrDstH, c->chrXInc, c->chrYInc);
+ av_log(c, AV_LOG_DEBUG,
+ "chr srcW=%d srcH=%d dstW=%d dstH=%d xInc=%d yInc=%d\n",
+ c->chrSrcW, c->chrSrcH, c->chrDstW, c->chrDstH,
+ c->chrXInc, c->chrYInc);
}
- c->swScale= ff_getSwsFunc(c);
+ c->swScale = ff_getSwsFunc(c);
return 0;
-fail: //FIXME replace things by appropriate error codes
+fail: // FIXME replace things by appropriate error codes
return -1;
}
#if FF_API_SWS_GETCONTEXT
-SwsContext *sws_getContext(int srcW, int srcH, enum PixelFormat srcFormat,
- int dstW, int dstH, enum PixelFormat dstFormat, int flags,
- SwsFilter *srcFilter, SwsFilter *dstFilter, const double *param)
+SwsContext *sws_getContext(int srcW, int srcH, enum AVPixelFormat srcFormat,
+ int dstW, int dstH, enum AVPixelFormat dstFormat,
+ int flags, SwsFilter *srcFilter,
+ SwsFilter *dstFilter, const double *param)
{
SwsContext *c;
- if(!(c=sws_alloc_context()))
+ if (!(c = sws_alloc_context()))
return NULL;
- c->flags= flags;
- c->srcW= srcW;
- c->srcH= srcH;
- c->dstW= dstW;
- c->dstH= dstH;
- c->srcRange = handle_jpeg(&srcFormat);
- c->dstRange = handle_jpeg(&dstFormat);
- c->srcFormat= srcFormat;
- c->dstFormat= dstFormat;
+ c->flags = flags;
+ c->srcW = srcW;
+ c->srcH = srcH;
+ c->dstW = dstW;
+ c->dstH = dstH;
+ c->srcRange = handle_jpeg(&srcFormat);
+ c->dstRange = handle_jpeg(&dstFormat);
+ c->srcFormat = srcFormat;
+ c->dstFormat = dstFormat;
if (param) {
c->param[0] = param[0];
c->param[1] = param[1];
}
- sws_setColorspaceDetails(c, ff_yuv2rgb_coeffs[SWS_CS_DEFAULT], c->srcRange, ff_yuv2rgb_coeffs[SWS_CS_DEFAULT] /* FIXME*/, c->dstRange, 0, 1<<16, 1<<16);
+ sws_setColorspaceDetails(c, ff_yuv2rgb_coeffs[SWS_CS_DEFAULT], c->srcRange,
+ ff_yuv2rgb_coeffs[SWS_CS_DEFAULT] /* FIXME*/,
+ c->dstRange, 0, 1 << 16, 1 << 16);
- if(sws_init_context(c, srcFilter, dstFilter) < 0){
+ if (sws_init_context(c, srcFilter, dstFilter) < 0) {
sws_freeContext(c);
return NULL;
}
@@ -1142,28 +1321,28 @@ SwsFilter *sws_getDefaultFilter(float lumaGBlur, float chromaGBlur,
float chromaHShift, float chromaVShift,
int verbose)
{
- SwsFilter *filter= av_malloc(sizeof(SwsFilter));
+ SwsFilter *filter = av_malloc(sizeof(SwsFilter));
if (!filter)
return NULL;
- if (lumaGBlur!=0.0) {
- filter->lumH= sws_getGaussianVec(lumaGBlur, 3.0);
- filter->lumV= sws_getGaussianVec(lumaGBlur, 3.0);
+ if (lumaGBlur != 0.0) {
+ filter->lumH = sws_getGaussianVec(lumaGBlur, 3.0);
+ filter->lumV = sws_getGaussianVec(lumaGBlur, 3.0);
} else {
- filter->lumH= sws_getIdentityVec();
- filter->lumV= sws_getIdentityVec();
+ filter->lumH = sws_getIdentityVec();
+ filter->lumV = sws_getIdentityVec();
}
- if (chromaGBlur!=0.0) {
- filter->chrH= sws_getGaussianVec(chromaGBlur, 3.0);
- filter->chrV= sws_getGaussianVec(chromaGBlur, 3.0);
+ if (chromaGBlur != 0.0) {
+ filter->chrH = sws_getGaussianVec(chromaGBlur, 3.0);
+ filter->chrV = sws_getGaussianVec(chromaGBlur, 3.0);
} else {
- filter->chrH= sws_getIdentityVec();
- filter->chrV= sws_getIdentityVec();
+ filter->chrH = sws_getIdentityVec();
+ filter->chrV = sws_getIdentityVec();
}
- if (chromaSharpen!=0.0) {
- SwsVector *id= sws_getIdentityVec();
+ if (chromaSharpen != 0.0) {
+ SwsVector *id = sws_getIdentityVec();
sws_scaleVec(filter->chrH, -chromaSharpen);
sws_scaleVec(filter->chrV, -chromaSharpen);
sws_addVec(filter->chrH, id);
@@ -1171,8 +1350,8 @@ SwsFilter *sws_getDefaultFilter(float lumaGBlur, float chromaGBlur,
sws_freeVec(id);
}
- if (lumaSharpen!=0.0) {
- SwsVector *id= sws_getIdentityVec();
+ if (lumaSharpen != 0.0) {
+ SwsVector *id = sws_getIdentityVec();
sws_scaleVec(filter->lumH, -lumaSharpen);
sws_scaleVec(filter->lumV, -lumaSharpen);
sws_addVec(filter->lumH, id);
@@ -1181,18 +1360,20 @@ SwsFilter *sws_getDefaultFilter(float lumaGBlur, float chromaGBlur,
}
if (chromaHShift != 0.0)
- sws_shiftVec(filter->chrH, (int)(chromaHShift+0.5));
+ sws_shiftVec(filter->chrH, (int)(chromaHShift + 0.5));
if (chromaVShift != 0.0)
- sws_shiftVec(filter->chrV, (int)(chromaVShift+0.5));
+ sws_shiftVec(filter->chrV, (int)(chromaVShift + 0.5));
sws_normalizeVec(filter->chrH, 1.0);
sws_normalizeVec(filter->chrV, 1.0);
sws_normalizeVec(filter->lumH, 1.0);
sws_normalizeVec(filter->lumV, 1.0);
- if (verbose) sws_printVec2(filter->chrH, NULL, AV_LOG_DEBUG);
- if (verbose) sws_printVec2(filter->lumH, NULL, AV_LOG_DEBUG);
+ if (verbose)
+ sws_printVec2(filter->chrH, NULL, AV_LOG_DEBUG);
+ if (verbose)
+ sws_printVec2(filter->lumH, NULL, AV_LOG_DEBUG);
return filter;
}
@@ -1211,17 +1392,18 @@ SwsVector *sws_allocVec(int length)
SwsVector *sws_getGaussianVec(double variance, double quality)
{
- const int length= (int)(variance*quality + 0.5) | 1;
+ const int length = (int)(variance * quality + 0.5) | 1;
int i;
- double middle= (length-1)*0.5;
- SwsVector *vec= sws_allocVec(length);
+ double middle = (length - 1) * 0.5;
+ SwsVector *vec = sws_allocVec(length);
if (!vec)
return NULL;
- for (i=0; i<length; i++) {
- double dist= i-middle;
- vec->coeff[i]= exp(-dist*dist/(2*variance*variance)) / sqrt(2*variance*M_PI);
+ for (i = 0; i < length; i++) {
+ double dist = i - middle;
+ vec->coeff[i] = exp(-dist * dist / (2 * variance * variance)) /
+ sqrt(2 * variance * M_PI);
}
sws_normalizeVec(vec, 1.0);
@@ -1232,13 +1414,13 @@ SwsVector *sws_getGaussianVec(double variance, double quality)
SwsVector *sws_getConstVec(double c, int length)
{
int i;
- SwsVector *vec= sws_allocVec(length);
+ SwsVector *vec = sws_allocVec(length);
if (!vec)
return NULL;
- for (i=0; i<length; i++)
- vec->coeff[i]= c;
+ for (i = 0; i < length; i++)
+ vec->coeff[i] = c;
return vec;
}
@@ -1251,10 +1433,10 @@ SwsVector *sws_getIdentityVec(void)
static double sws_dcVec(SwsVector *a)
{
int i;
- double sum=0;
+ double sum = 0;
- for (i=0; i<a->length; i++)
- sum+= a->coeff[i];
+ for (i = 0; i < a->length; i++)
+ sum += a->coeff[i];
return sum;
}
@@ -1263,27 +1445,27 @@ void sws_scaleVec(SwsVector *a, double scalar)
{
int i;
- for (i=0; i<a->length; i++)
- a->coeff[i]*= scalar;
+ for (i = 0; i < a->length; i++)
+ a->coeff[i] *= scalar;
}
void sws_normalizeVec(SwsVector *a, double height)
{
- sws_scaleVec(a, height/sws_dcVec(a));
+ sws_scaleVec(a, height / sws_dcVec(a));
}
static SwsVector *sws_getConvVec(SwsVector *a, SwsVector *b)
{
- int length= a->length + b->length - 1;
+ int length = a->length + b->length - 1;
int i, j;
- SwsVector *vec= sws_getConstVec(0.0, length);
+ SwsVector *vec = sws_getConstVec(0.0, length);
if (!vec)
return NULL;
- for (i=0; i<a->length; i++) {
- for (j=0; j<b->length; j++) {
- vec->coeff[i+j]+= a->coeff[i]*b->coeff[j];
+ for (i = 0; i < a->length; i++) {
+ for (j = 0; j < b->length; j++) {
+ vec->coeff[i + j] += a->coeff[i] * b->coeff[j];
}
}
@@ -1292,30 +1474,34 @@ static SwsVector *sws_getConvVec(SwsVector *a, SwsVector *b)
static SwsVector *sws_sumVec(SwsVector *a, SwsVector *b)
{
- int length= FFMAX(a->length, b->length);
+ int length = FFMAX(a->length, b->length);
int i;
- SwsVector *vec= sws_getConstVec(0.0, length);
+ SwsVector *vec = sws_getConstVec(0.0, length);
if (!vec)
return NULL;
- for (i=0; i<a->length; i++) vec->coeff[i + (length-1)/2 - (a->length-1)/2]+= a->coeff[i];
- for (i=0; i<b->length; i++) vec->coeff[i + (length-1)/2 - (b->length-1)/2]+= b->coeff[i];
+ for (i = 0; i < a->length; i++)
+ vec->coeff[i + (length - 1) / 2 - (a->length - 1) / 2] += a->coeff[i];
+ for (i = 0; i < b->length; i++)
+ vec->coeff[i + (length - 1) / 2 - (b->length - 1) / 2] += b->coeff[i];
return vec;
}
static SwsVector *sws_diffVec(SwsVector *a, SwsVector *b)
{
- int length= FFMAX(a->length, b->length);
+ int length = FFMAX(a->length, b->length);
int i;
- SwsVector *vec= sws_getConstVec(0.0, length);
+ SwsVector *vec = sws_getConstVec(0.0, length);
if (!vec)
return NULL;
- for (i=0; i<a->length; i++) vec->coeff[i + (length-1)/2 - (a->length-1)/2]+= a->coeff[i];
- for (i=0; i<b->length; i++) vec->coeff[i + (length-1)/2 - (b->length-1)/2]-= b->coeff[i];
+ for (i = 0; i < a->length; i++)
+ vec->coeff[i + (length - 1) / 2 - (a->length - 1) / 2] += a->coeff[i];
+ for (i = 0; i < b->length; i++)
+ vec->coeff[i + (length - 1) / 2 - (b->length - 1) / 2] -= b->coeff[i];
return vec;
}
@@ -1323,15 +1509,16 @@ static SwsVector *sws_diffVec(SwsVector *a, SwsVector *b)
/* shift left / or right if "shift" is negative */
static SwsVector *sws_getShiftedVec(SwsVector *a, int shift)
{
- int length= a->length + FFABS(shift)*2;
+ int length = a->length + FFABS(shift) * 2;
int i;
- SwsVector *vec= sws_getConstVec(0.0, length);
+ SwsVector *vec = sws_getConstVec(0.0, length);
if (!vec)
return NULL;
- for (i=0; i<a->length; i++) {
- vec->coeff[i + (length-1)/2 - (a->length-1)/2 - shift]= a->coeff[i];
+ for (i = 0; i < a->length; i++) {
+ vec->coeff[i + (length - 1) / 2 -
+ (a->length - 1) / 2 - shift] = a->coeff[i];
}
return vec;
@@ -1339,49 +1526,50 @@ static SwsVector *sws_getShiftedVec(SwsVector *a, int shift)
void sws_shiftVec(SwsVector *a, int shift)
{
- SwsVector *shifted= sws_getShiftedVec(a, shift);
+ SwsVector *shifted = sws_getShiftedVec(a, shift);
av_free(a->coeff);
- a->coeff= shifted->coeff;
- a->length= shifted->length;
+ a->coeff = shifted->coeff;
+ a->length = shifted->length;
av_free(shifted);
}
void sws_addVec(SwsVector *a, SwsVector *b)
{
- SwsVector *sum= sws_sumVec(a, b);
+ SwsVector *sum = sws_sumVec(a, b);
av_free(a->coeff);
- a->coeff= sum->coeff;
- a->length= sum->length;
+ a->coeff = sum->coeff;
+ a->length = sum->length;
av_free(sum);
}
void sws_subVec(SwsVector *a, SwsVector *b)
{
- SwsVector *diff= sws_diffVec(a, b);
+ SwsVector *diff = sws_diffVec(a, b);
av_free(a->coeff);
- a->coeff= diff->coeff;
- a->length= diff->length;
+ a->coeff = diff->coeff;
+ a->length = diff->length;
av_free(diff);
}
void sws_convVec(SwsVector *a, SwsVector *b)
{
- SwsVector *conv= sws_getConvVec(a, b);
+ SwsVector *conv = sws_getConvVec(a, b);
av_free(a->coeff);
- a->coeff= conv->coeff;
- a->length= conv->length;
+ a->coeff = conv->coeff;
+ a->length = conv->length;
av_free(conv);
}
SwsVector *sws_cloneVec(SwsVector *a)
{
int i;
- SwsVector *vec= sws_allocVec(a->length);
+ SwsVector *vec = sws_allocVec(a->length);
if (!vec)
return NULL;
- for (i=0; i<a->length; i++) vec->coeff[i]= a->coeff[i];
+ for (i = 0; i < a->length; i++)
+ vec->coeff[i] = a->coeff[i];
return vec;
}
@@ -1389,65 +1577,75 @@ SwsVector *sws_cloneVec(SwsVector *a)
void sws_printVec2(SwsVector *a, AVClass *log_ctx, int log_level)
{
int i;
- double max=0;
- double min=0;
+ double max = 0;
+ double min = 0;
double range;
- for (i=0; i<a->length; i++)
- if (a->coeff[i]>max) max= a->coeff[i];
+ for (i = 0; i < a->length; i++)
+ if (a->coeff[i] > max)
+ max = a->coeff[i];
- for (i=0; i<a->length; i++)
- if (a->coeff[i]<min) min= a->coeff[i];
+ for (i = 0; i < a->length; i++)
+ if (a->coeff[i] < min)
+ min = a->coeff[i];
- range= max - min;
+ range = max - min;
- for (i=0; i<a->length; i++) {
- int x= (int)((a->coeff[i]-min)*60.0/range +0.5);
+ for (i = 0; i < a->length; i++) {
+ int x = (int)((a->coeff[i] - min) * 60.0 / range + 0.5);
av_log(log_ctx, log_level, "%1.3f ", a->coeff[i]);
- for (;x>0; x--) av_log(log_ctx, log_level, " ");
+ for (; x > 0; x--)
+ av_log(log_ctx, log_level, " ");
av_log(log_ctx, log_level, "|\n");
}
}
void sws_freeVec(SwsVector *a)
{
- if (!a) return;
+ if (!a)
+ return;
av_freep(&a->coeff);
- a->length=0;
+ a->length = 0;
av_free(a);
}
void sws_freeFilter(SwsFilter *filter)
{
- if (!filter) return;
-
- if (filter->lumH) sws_freeVec(filter->lumH);
- if (filter->lumV) sws_freeVec(filter->lumV);
- if (filter->chrH) sws_freeVec(filter->chrH);
- if (filter->chrV) sws_freeVec(filter->chrV);
+ if (!filter)
+ return;
+
+ if (filter->lumH)
+ sws_freeVec(filter->lumH);
+ if (filter->lumV)
+ sws_freeVec(filter->lumV);
+ if (filter->chrH)
+ sws_freeVec(filter->chrH);
+ if (filter->chrV)
+ sws_freeVec(filter->chrV);
av_free(filter);
}
void sws_freeContext(SwsContext *c)
{
int i;
- if (!c) return;
+ if (!c)
+ return;
if (c->lumPixBuf) {
- for (i=0; i<c->vLumBufSize; i++)
+ for (i = 0; i < c->vLumBufSize; i++)
av_freep(&c->lumPixBuf[i]);
av_freep(&c->lumPixBuf);
}
if (c->chrUPixBuf) {
- for (i=0; i<c->vChrBufSize; i++)
+ for (i = 0; i < c->vChrBufSize; i++)
av_freep(&c->chrUPixBuf[i]);
av_freep(&c->chrUPixBuf);
av_freep(&c->chrVPixBuf);
}
if (CONFIG_SWSCALE_ALPHA && c->alpPixBuf) {
- for (i=0; i<c->vLumBufSize; i++)
+ for (i = 0; i < c->vLumBufSize; i++)
av_freep(&c->alpPixBuf[i]);
av_freep(&c->alpPixBuf);
}
@@ -1466,20 +1664,24 @@ void sws_freeContext(SwsContext *c)
av_freep(&c->hLumFilterPos);
av_freep(&c->hChrFilterPos);
-#if HAVE_MMX
-#ifdef MAP_ANONYMOUS
- if (c->lumMmx2FilterCode) munmap(c->lumMmx2FilterCode, c->lumMmx2FilterCodeSize);
- if (c->chrMmx2FilterCode) munmap(c->chrMmx2FilterCode, c->chrMmx2FilterCodeSize);
+#if HAVE_MMX_INLINE
+#if USE_MMAP
+ if (c->lumMmxextFilterCode)
+ munmap(c->lumMmxextFilterCode, c->lumMmxextFilterCodeSize);
+ if (c->chrMmxextFilterCode)
+ munmap(c->chrMmxextFilterCode, c->chrMmxextFilterCodeSize);
#elif HAVE_VIRTUALALLOC
- if (c->lumMmx2FilterCode) VirtualFree(c->lumMmx2FilterCode, 0, MEM_RELEASE);
- if (c->chrMmx2FilterCode) VirtualFree(c->chrMmx2FilterCode, 0, MEM_RELEASE);
+ if (c->lumMmxextFilterCode)
+ VirtualFree(c->lumMmxextFilterCode, 0, MEM_RELEASE);
+ if (c->chrMmxextFilterCode)
+ VirtualFree(c->chrMmxextFilterCode, 0, MEM_RELEASE);
#else
- av_free(c->lumMmx2FilterCode);
- av_free(c->chrMmx2FilterCode);
+ av_free(c->lumMmxextFilterCode);
+ av_free(c->chrMmxextFilterCode);
#endif
- c->lumMmx2FilterCode=NULL;
- c->chrMmx2FilterCode=NULL;
-#endif /* HAVE_MMX */
+ c->lumMmxextFilterCode = NULL;
+ c->chrMmxextFilterCode = NULL;
+#endif /* HAVE_MMX_INLINE */
av_freep(&c->yuvTable);
av_free(c->formatConvBuffer);
@@ -1487,12 +1689,16 @@ void sws_freeContext(SwsContext *c)
av_free(c);
}
-struct SwsContext *sws_getCachedContext(struct SwsContext *context,
- int srcW, int srcH, enum PixelFormat srcFormat,
- int dstW, int dstH, enum PixelFormat dstFormat, int flags,
- SwsFilter *srcFilter, SwsFilter *dstFilter, const double *param)
+struct SwsContext *sws_getCachedContext(struct SwsContext *context, int srcW,
+ int srcH, enum AVPixelFormat srcFormat,
+ int dstW, int dstH,
+ enum AVPixelFormat dstFormat, int flags,
+ SwsFilter *srcFilter,
+ SwsFilter *dstFilter,
+ const double *param)
{
- static const double default_param[2] = {SWS_PARAM_DEFAULT, SWS_PARAM_DEFAULT};
+ static const double default_param[2] = { SWS_PARAM_DEFAULT,
+ SWS_PARAM_DEFAULT };
if (!param)
param = default_param;
@@ -1525,7 +1731,10 @@ struct SwsContext *sws_getCachedContext(struct SwsContext *context,
context->flags = flags;
context->param[0] = param[0];
context->param[1] = param[1];
- sws_setColorspaceDetails(context, ff_yuv2rgb_coeffs[SWS_CS_DEFAULT], context->srcRange, ff_yuv2rgb_coeffs[SWS_CS_DEFAULT] /* FIXME*/, context->dstRange, 0, 1<<16, 1<<16);
+ sws_setColorspaceDetails(context, ff_yuv2rgb_coeffs[SWS_CS_DEFAULT],
+ context->srcRange,
+ ff_yuv2rgb_coeffs[SWS_CS_DEFAULT] /* FIXME*/,
+ context->dstRange, 0, 1 << 16, 1 << 16);
if (sws_init_context(context, srcFilter, dstFilter) < 0) {
sws_freeContext(context);
return NULL;
@@ -1533,4 +1742,3 @@ struct SwsContext *sws_getCachedContext(struct SwsContext *context,
}
return context;
}
-
diff --git a/gst-libs/ext/libav/libswscale/version.h b/gst-libs/ext/libav/libswscale/version.h
new file mode 100644
index 0000000..acbdf6b
--- /dev/null
+++ b/gst-libs/ext/libav/libswscale/version.h
@@ -0,0 +1,56 @@
+/*
+ * 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
+ */
+
+#ifndef SWSCALE_VERSION_H
+#define SWSCALE_VERSION_H
+
+/**
+ * @file
+ * swscale version macros
+ */
+
+#include "libavutil/avutil.h"
+
+#define LIBSWSCALE_VERSION_MAJOR 2
+#define LIBSWSCALE_VERSION_MINOR 1
+#define LIBSWSCALE_VERSION_MICRO 1
+
+#define LIBSWSCALE_VERSION_INT AV_VERSION_INT(LIBSWSCALE_VERSION_MAJOR, \
+ LIBSWSCALE_VERSION_MINOR, \
+ LIBSWSCALE_VERSION_MICRO)
+#define LIBSWSCALE_VERSION AV_VERSION(LIBSWSCALE_VERSION_MAJOR, \
+ LIBSWSCALE_VERSION_MINOR, \
+ LIBSWSCALE_VERSION_MICRO)
+#define LIBSWSCALE_BUILD LIBSWSCALE_VERSION_INT
+
+#define LIBSWSCALE_IDENT "SwS" AV_STRINGIFY(LIBSWSCALE_VERSION)
+
+/**
+ * FF_API_* defines may be placed below to indicate public API that will be
+ * dropped at a future version bump. The defines themselves are not part of
+ * the public API and may change, break or disappear at any time.
+ */
+
+#ifndef FF_API_SWS_GETCONTEXT
+#define FF_API_SWS_GETCONTEXT (LIBSWSCALE_VERSION_MAJOR < 3)
+#endif
+#ifndef FF_API_SWS_CPU_CAPS
+#define FF_API_SWS_CPU_CAPS (LIBSWSCALE_VERSION_MAJOR < 3)
+#endif
+
+#endif /* SWSCALE_VERSION_H */
diff --git a/gst-libs/ext/libav/libswscale/x86/Makefile b/gst-libs/ext/libav/libswscale/x86/Makefile
new file mode 100644
index 0000000..5416d48
--- /dev/null
+++ b/gst-libs/ext/libav/libswscale/x86/Makefile
@@ -0,0 +1,9 @@
+OBJS-$(CONFIG_XMM_CLOBBER_TEST) += x86/w64xmmtest.o
+
+MMX-OBJS += x86/rgb2rgb.o \
+ x86/swscale.o \
+ x86/yuv2rgb.o \
+
+YASM-OBJS += x86/input.o \
+ x86/output.o \
+ x86/scale.o \
diff --git a/gst-libs/ext/libav/libswscale/x86/input.asm b/gst-libs/ext/libav/libswscale/x86/input.asm
index a23cf05..a8d5a5a 100644
--- a/gst-libs/ext/libav/libswscale/x86/input.asm
+++ b/gst-libs/ext/libav/libswscale/x86/input.asm
@@ -21,14 +21,440 @@
;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
;******************************************************************************
-%include "x86inc.asm"
-%include "x86util.asm"
+%include "libavutil/x86/x86util.asm"
SECTION_RODATA
+%define RY 0x20DE
+%define GY 0x4087
+%define BY 0x0C88
+%define RU 0xECFF
+%define GU 0xDAC8
+%define BU 0x3838
+%define RV 0x3838
+%define GV 0xD0E3
+%define BV 0xF6E4
+
+rgb_Yrnd: times 4 dd 0x84000 ; 16.5 << 15
+rgb_UVrnd: times 4 dd 0x404000 ; 128.5 << 15
+bgr_Ycoeff_12x4: times 2 dw BY, GY, 0, BY
+bgr_Ycoeff_3x56: times 2 dw RY, 0, GY, RY
+rgb_Ycoeff_12x4: times 2 dw RY, GY, 0, RY
+rgb_Ycoeff_3x56: times 2 dw BY, 0, GY, BY
+bgr_Ucoeff_12x4: times 2 dw BU, GU, 0, BU
+bgr_Ucoeff_3x56: times 2 dw RU, 0, GU, RU
+rgb_Ucoeff_12x4: times 2 dw RU, GU, 0, RU
+rgb_Ucoeff_3x56: times 2 dw BU, 0, GU, BU
+bgr_Vcoeff_12x4: times 2 dw BV, GV, 0, BV
+bgr_Vcoeff_3x56: times 2 dw RV, 0, GV, RV
+rgb_Vcoeff_12x4: times 2 dw RV, GV, 0, RV
+rgb_Vcoeff_3x56: times 2 dw BV, 0, GV, BV
+
+rgba_Ycoeff_rb: times 4 dw RY, BY
+rgba_Ycoeff_br: times 4 dw BY, RY
+rgba_Ycoeff_ga: times 4 dw GY, 0
+rgba_Ycoeff_ag: times 4 dw 0, GY
+rgba_Ucoeff_rb: times 4 dw RU, BU
+rgba_Ucoeff_br: times 4 dw BU, RU
+rgba_Ucoeff_ga: times 4 dw GU, 0
+rgba_Ucoeff_ag: times 4 dw 0, GU
+rgba_Vcoeff_rb: times 4 dw RV, BV
+rgba_Vcoeff_br: times 4 dw BV, RV
+rgba_Vcoeff_ga: times 4 dw GV, 0
+rgba_Vcoeff_ag: times 4 dw 0, GV
+
+shuf_rgb_12x4: db 0, 0x80, 1, 0x80, 2, 0x80, 3, 0x80, \
+ 6, 0x80, 7, 0x80, 8, 0x80, 9, 0x80
+shuf_rgb_3x56: db 2, 0x80, 3, 0x80, 4, 0x80, 5, 0x80, \
+ 8, 0x80, 9, 0x80, 10, 0x80, 11, 0x80
+
SECTION .text
;-----------------------------------------------------------------------------
+; RGB to Y/UV.
+;
+; void <fmt>ToY_<opt>(uint8_t *dst, const uint8_t *src, int w);
+; and
+; void <fmt>toUV_<opt>(uint8_t *dstU, uint8_t *dstV, const uint8_t *src,
+; const uint8_t *unused, int w);
+;-----------------------------------------------------------------------------
+
+; %1 = nr. of XMM registers
+; %2 = rgb or bgr
+%macro RGB24_TO_Y_FN 2-3
+cglobal %2 %+ 24ToY, 3, 3, %1, dst, src, w
+%if mmsize == 8
+ mova m5, [%2_Ycoeff_12x4]
+ mova m6, [%2_Ycoeff_3x56]
+%define coeff1 m5
+%define coeff2 m6
+%elif ARCH_X86_64
+ mova m8, [%2_Ycoeff_12x4]
+ mova m9, [%2_Ycoeff_3x56]
+%define coeff1 m8
+%define coeff2 m9
+%else ; x86-32 && mmsize == 16
+%define coeff1 [%2_Ycoeff_12x4]
+%define coeff2 [%2_Ycoeff_3x56]
+%endif ; x86-32/64 && mmsize == 8/16
+%if (ARCH_X86_64 || mmsize == 8) && %0 == 3
+ jmp mangle(program_name %+ _ %+ %3 %+ 24ToY %+ SUFFIX).body
+%else ; (ARCH_X86_64 && %0 == 3) || mmsize == 8
+.body:
+%if cpuflag(ssse3)
+ mova m7, [shuf_rgb_12x4]
+%define shuf_rgb1 m7
+%if ARCH_X86_64
+ mova m10, [shuf_rgb_3x56]
+%define shuf_rgb2 m10
+%else ; x86-32
+%define shuf_rgb2 [shuf_rgb_3x56]
+%endif ; x86-32/64
+%endif ; cpuflag(ssse3)
+%if ARCH_X86_64
+ movsxd wq, wd
+%endif
+ add dstq, wq
+ neg wq
+%if notcpuflag(ssse3)
+ pxor m7, m7
+%endif ; !cpuflag(ssse3)
+ mova m4, [rgb_Yrnd]
+.loop:
+%if cpuflag(ssse3)
+ movu m0, [srcq+0] ; (byte) { Bx, Gx, Rx }[0-3]
+ movu m2, [srcq+12] ; (byte) { Bx, Gx, Rx }[4-7]
+ pshufb m1, m0, shuf_rgb2 ; (word) { R0, B1, G1, R1, R2, B3, G3, R3 }
+ pshufb m0, shuf_rgb1 ; (word) { B0, G0, R0, B1, B2, G2, R2, B3 }
+ pshufb m3, m2, shuf_rgb2 ; (word) { R4, B5, G5, R5, R6, B7, G7, R7 }
+ pshufb m2, shuf_rgb1 ; (word) { B4, G4, R4, B5, B6, G6, R6, B7 }
+%else ; !cpuflag(ssse3)
+ movd m0, [srcq+0] ; (byte) { B0, G0, R0, B1 }
+ movd m1, [srcq+2] ; (byte) { R0, B1, G1, R1 }
+ movd m2, [srcq+6] ; (byte) { B2, G2, R2, B3 }
+ movd m3, [srcq+8] ; (byte) { R2, B3, G3, R3 }
+%if mmsize == 16 ; i.e. sse2
+ punpckldq m0, m2 ; (byte) { B0, G0, R0, B1, B2, G2, R2, B3 }
+ punpckldq m1, m3 ; (byte) { R0, B1, G1, R1, R2, B3, G3, R3 }
+ movd m2, [srcq+12] ; (byte) { B4, G4, R4, B5 }
+ movd m3, [srcq+14] ; (byte) { R4, B5, G5, R5 }
+ movd m5, [srcq+18] ; (byte) { B6, G6, R6, B7 }
+ movd m6, [srcq+20] ; (byte) { R6, B7, G7, R7 }
+ punpckldq m2, m5 ; (byte) { B4, G4, R4, B5, B6, G6, R6, B7 }
+ punpckldq m3, m6 ; (byte) { R4, B5, G5, R5, R6, B7, G7, R7 }
+%endif ; mmsize == 16
+ punpcklbw m0, m7 ; (word) { B0, G0, R0, B1, B2, G2, R2, B3 }
+ punpcklbw m1, m7 ; (word) { R0, B1, G1, R1, R2, B3, G3, R3 }
+ punpcklbw m2, m7 ; (word) { B4, G4, R4, B5, B6, G6, R6, B7 }
+ punpcklbw m3, m7 ; (word) { R4, B5, G5, R5, R6, B7, G7, R7 }
+%endif ; cpuflag(ssse3)
+ add srcq, 3 * mmsize / 2
+ pmaddwd m0, coeff1 ; (dword) { B0*BY + G0*GY, B1*BY, B2*BY + G2*GY, B3*BY }
+ pmaddwd m1, coeff2 ; (dword) { R0*RY, G1+GY + R1*RY, R2*RY, G3+GY + R3*RY }
+ pmaddwd m2, coeff1 ; (dword) { B4*BY + G4*GY, B5*BY, B6*BY + G6*GY, B7*BY }
+ pmaddwd m3, coeff2 ; (dword) { R4*RY, G5+GY + R5*RY, R6*RY, G7+GY + R7*RY }
+ paddd m0, m1 ; (dword) { Bx*BY + Gx*GY + Rx*RY }[0-3]
+ paddd m2, m3 ; (dword) { Bx*BY + Gx*GY + Rx*RY }[4-7]
+ paddd m0, m4 ; += rgb_Yrnd, i.e. (dword) { Y[0-3] }
+ paddd m2, m4 ; += rgb_Yrnd, i.e. (dword) { Y[4-7] }
+ psrad m0, 15
+ psrad m2, 15
+ packssdw m0, m2 ; (word) { Y[0-7] }
+ packuswb m0, m0 ; (byte) { Y[0-7] }
+ movh [dstq+wq], m0
+ add wq, mmsize / 2
+ jl .loop
+ REP_RET
+%endif ; (ARCH_X86_64 && %0 == 3) || mmsize == 8
+%endmacro
+
+; %1 = nr. of XMM registers
+; %2 = rgb or bgr
+%macro RGB24_TO_UV_FN 2-3
+cglobal %2 %+ 24ToUV, 3, 4, %1, dstU, dstV, src, w
+%if ARCH_X86_64
+ mova m8, [%2_Ucoeff_12x4]
+ mova m9, [%2_Ucoeff_3x56]
+ mova m10, [%2_Vcoeff_12x4]
+ mova m11, [%2_Vcoeff_3x56]
+%define coeffU1 m8
+%define coeffU2 m9
+%define coeffV1 m10
+%define coeffV2 m11
+%else ; x86-32
+%define coeffU1 [%2_Ucoeff_12x4]
+%define coeffU2 [%2_Ucoeff_3x56]
+%define coeffV1 [%2_Vcoeff_12x4]
+%define coeffV2 [%2_Vcoeff_3x56]
+%endif ; x86-32/64
+%if ARCH_X86_64 && %0 == 3
+ jmp mangle(program_name %+ _ %+ %3 %+ 24ToUV %+ SUFFIX).body
+%else ; ARCH_X86_64 && %0 == 3
+.body:
+%if cpuflag(ssse3)
+ mova m7, [shuf_rgb_12x4]
+%define shuf_rgb1 m7
+%if ARCH_X86_64
+ mova m12, [shuf_rgb_3x56]
+%define shuf_rgb2 m12
+%else ; x86-32
+%define shuf_rgb2 [shuf_rgb_3x56]
+%endif ; x86-32/64
+%endif ; cpuflag(ssse3)
+%if ARCH_X86_64
+ movsxd wq, dword r4m
+%else ; x86-32
+ mov wq, r4m
+%endif
+ add dstUq, wq
+ add dstVq, wq
+ neg wq
+ mova m6, [rgb_UVrnd]
+%if notcpuflag(ssse3)
+ pxor m7, m7
+%endif
+.loop:
+%if cpuflag(ssse3)
+ movu m0, [srcq+0] ; (byte) { Bx, Gx, Rx }[0-3]
+ movu m4, [srcq+12] ; (byte) { Bx, Gx, Rx }[4-7]
+ pshufb m1, m0, shuf_rgb2 ; (word) { R0, B1, G1, R1, R2, B3, G3, R3 }
+ pshufb m0, shuf_rgb1 ; (word) { B0, G0, R0, B1, B2, G2, R2, B3 }
+%else ; !cpuflag(ssse3)
+ movd m0, [srcq+0] ; (byte) { B0, G0, R0, B1 }
+ movd m1, [srcq+2] ; (byte) { R0, B1, G1, R1 }
+ movd m4, [srcq+6] ; (byte) { B2, G2, R2, B3 }
+ movd m5, [srcq+8] ; (byte) { R2, B3, G3, R3 }
+%if mmsize == 16
+ punpckldq m0, m4 ; (byte) { B0, G0, R0, B1, B2, G2, R2, B3 }
+ punpckldq m1, m5 ; (byte) { R0, B1, G1, R1, R2, B3, G3, R3 }
+ movd m4, [srcq+12] ; (byte) { B4, G4, R4, B5 }
+ movd m5, [srcq+14] ; (byte) { R4, B5, G5, R5 }
+%endif ; mmsize == 16
+ punpcklbw m0, m7 ; (word) { B0, G0, R0, B1, B2, G2, R2, B3 }
+ punpcklbw m1, m7 ; (word) { R0, B1, G1, R1, R2, B3, G3, R3 }
+%endif ; cpuflag(ssse3)
+ pmaddwd m2, m0, coeffV1 ; (dword) { B0*BV + G0*GV, B1*BV, B2*BV + G2*GV, B3*BV }
+ pmaddwd m3, m1, coeffV2 ; (dword) { R0*BV, G1*GV + R1*BV, R2*BV, G3*GV + R3*BV }
+ pmaddwd m0, coeffU1 ; (dword) { B0*BU + G0*GU, B1*BU, B2*BU + G2*GU, B3*BU }
+ pmaddwd m1, coeffU2 ; (dword) { R0*BU, G1*GU + R1*BU, R2*BU, G3*GU + R3*BU }
+ paddd m0, m1 ; (dword) { Bx*BU + Gx*GU + Rx*RU }[0-3]
+ paddd m2, m3 ; (dword) { Bx*BV + Gx*GV + Rx*RV }[0-3]
+%if cpuflag(ssse3)
+ pshufb m5, m4, shuf_rgb2 ; (word) { R4, B5, G5, R5, R6, B7, G7, R7 }
+ pshufb m4, shuf_rgb1 ; (word) { B4, G4, R4, B5, B6, G6, R6, B7 }
+%else ; !cpuflag(ssse3)
+%if mmsize == 16
+ movd m1, [srcq+18] ; (byte) { B6, G6, R6, B7 }
+ movd m3, [srcq+20] ; (byte) { R6, B7, G7, R7 }
+ punpckldq m4, m1 ; (byte) { B4, G4, R4, B5, B6, G6, R6, B7 }
+ punpckldq m5, m3 ; (byte) { R4, B5, G5, R5, R6, B7, G7, R7 }
+%endif ; mmsize == 16 && !cpuflag(ssse3)
+ punpcklbw m4, m7 ; (word) { B4, G4, R4, B5, B6, G6, R6, B7 }
+ punpcklbw m5, m7 ; (word) { R4, B5, G5, R5, R6, B7, G7, R7 }
+%endif ; cpuflag(ssse3)
+ add srcq, 3 * mmsize / 2
+ pmaddwd m1, m4, coeffU1 ; (dword) { B4*BU + G4*GU, B5*BU, B6*BU + G6*GU, B7*BU }
+ pmaddwd m3, m5, coeffU2 ; (dword) { R4*BU, G5*GU + R5*BU, R6*BU, G7*GU + R7*BU }
+ pmaddwd m4, coeffV1 ; (dword) { B4*BV + G4*GV, B5*BV, B6*BV + G6*GV, B7*BV }
+ pmaddwd m5, coeffV2 ; (dword) { R4*BV, G5*GV + R5*BV, R6*BV, G7*GV + R7*BV }
+ paddd m1, m3 ; (dword) { Bx*BU + Gx*GU + Rx*RU }[4-7]
+ paddd m4, m5 ; (dword) { Bx*BV + Gx*GV + Rx*RV }[4-7]
+ paddd m0, m6 ; += rgb_UVrnd, i.e. (dword) { U[0-3] }
+ paddd m2, m6 ; += rgb_UVrnd, i.e. (dword) { V[0-3] }
+ paddd m1, m6 ; += rgb_UVrnd, i.e. (dword) { U[4-7] }
+ paddd m4, m6 ; += rgb_UVrnd, i.e. (dword) { V[4-7] }
+ psrad m0, 15
+ psrad m2, 15
+ psrad m1, 15
+ psrad m4, 15
+ packssdw m0, m1 ; (word) { U[0-7] }
+ packssdw m2, m4 ; (word) { V[0-7] }
+%if mmsize == 8
+ packuswb m0, m0 ; (byte) { U[0-3] }
+ packuswb m2, m2 ; (byte) { V[0-3] }
+ movh [dstUq+wq], m0
+ movh [dstVq+wq], m2
+%else ; mmsize == 16
+ packuswb m0, m2 ; (byte) { U[0-7], V[0-7] }
+ movh [dstUq+wq], m0
+ movhps [dstVq+wq], m0
+%endif ; mmsize == 8/16
+ add wq, mmsize / 2
+ jl .loop
+ REP_RET
+%endif ; ARCH_X86_64 && %0 == 3
+%endmacro
+
+; %1 = nr. of XMM registers for rgb-to-Y func
+; %2 = nr. of XMM registers for rgb-to-UV func
+%macro RGB24_FUNCS 2
+RGB24_TO_Y_FN %1, rgb
+RGB24_TO_Y_FN %1, bgr, rgb
+RGB24_TO_UV_FN %2, rgb
+RGB24_TO_UV_FN %2, bgr, rgb
+%endmacro
+
+%if ARCH_X86_32
+INIT_MMX mmx
+RGB24_FUNCS 0, 0
+%endif
+
+INIT_XMM sse2
+RGB24_FUNCS 10, 12
+
+INIT_XMM ssse3
+RGB24_FUNCS 11, 13
+
+INIT_XMM avx
+RGB24_FUNCS 11, 13
+
+; %1 = nr. of XMM registers
+; %2-5 = rgba, bgra, argb or abgr (in individual characters)
+%macro RGB32_TO_Y_FN 5-6
+cglobal %2%3%4%5 %+ ToY, 3, 3, %1, dst, src, w
+ mova m5, [rgba_Ycoeff_%2%4]
+ mova m6, [rgba_Ycoeff_%3%5]
+%if %0 == 6
+ jmp mangle(program_name %+ _ %+ %6 %+ ToY %+ SUFFIX).body
+%else ; %0 == 6
+.body:
+%if ARCH_X86_64
+ movsxd wq, wd
+%endif
+ lea srcq, [srcq+wq*4]
+ add dstq, wq
+ neg wq
+ mova m4, [rgb_Yrnd]
+ pcmpeqb m7, m7
+ psrlw m7, 8 ; (word) { 0x00ff } x4
+.loop:
+ ; FIXME check alignment and use mova
+ movu m0, [srcq+wq*4+0] ; (byte) { Bx, Gx, Rx, xx }[0-3]
+ movu m2, [srcq+wq*4+mmsize] ; (byte) { Bx, Gx, Rx, xx }[4-7]
+ DEINTB 1, 0, 3, 2, 7 ; (word) { Gx, xx (m0/m2) or Bx, Rx (m1/m3) }[0-3]/[4-7]
+ pmaddwd m1, m5 ; (dword) { Bx*BY + Rx*RY }[0-3]
+ pmaddwd m0, m6 ; (dword) { Gx*GY }[0-3]
+ pmaddwd m3, m5 ; (dword) { Bx*BY + Rx*RY }[4-7]
+ pmaddwd m2, m6 ; (dword) { Gx*GY }[4-7]
+ paddd m0, m4 ; += rgb_Yrnd
+ paddd m2, m4 ; += rgb_Yrnd
+ paddd m0, m1 ; (dword) { Y[0-3] }
+ paddd m2, m3 ; (dword) { Y[4-7] }
+ psrad m0, 15
+ psrad m2, 15
+ packssdw m0, m2 ; (word) { Y[0-7] }
+ packuswb m0, m0 ; (byte) { Y[0-7] }
+ movh [dstq+wq], m0
+ add wq, mmsize / 2
+ jl .loop
+ REP_RET
+%endif ; %0 == 3
+%endmacro
+
+; %1 = nr. of XMM registers
+; %2-5 = rgba, bgra, argb or abgr (in individual characters)
+%macro RGB32_TO_UV_FN 5-6
+cglobal %2%3%4%5 %+ ToUV, 3, 4, %1, dstU, dstV, src, w
+%if ARCH_X86_64
+ mova m8, [rgba_Ucoeff_%2%4]
+ mova m9, [rgba_Ucoeff_%3%5]
+ mova m10, [rgba_Vcoeff_%2%4]
+ mova m11, [rgba_Vcoeff_%3%5]
+%define coeffU1 m8
+%define coeffU2 m9
+%define coeffV1 m10
+%define coeffV2 m11
+%else ; x86-32
+%define coeffU1 [rgba_Ucoeff_%2%4]
+%define coeffU2 [rgba_Ucoeff_%3%5]
+%define coeffV1 [rgba_Vcoeff_%2%4]
+%define coeffV2 [rgba_Vcoeff_%3%5]
+%endif ; x86-64/32
+%if ARCH_X86_64 && %0 == 6
+ jmp mangle(program_name %+ _ %+ %6 %+ ToUV %+ SUFFIX).body
+%else ; ARCH_X86_64 && %0 == 6
+.body:
+%if ARCH_X86_64
+ movsxd wq, dword r4m
+%else ; x86-32
+ mov wq, r4m
+%endif
+ add dstUq, wq
+ add dstVq, wq
+ lea srcq, [srcq+wq*4]
+ neg wq
+ pcmpeqb m7, m7
+ psrlw m7, 8 ; (word) { 0x00ff } x4
+ mova m6, [rgb_UVrnd]
+.loop:
+ ; FIXME check alignment and use mova
+ movu m0, [srcq+wq*4+0] ; (byte) { Bx, Gx, Rx, xx }[0-3]
+ movu m4, [srcq+wq*4+mmsize] ; (byte) { Bx, Gx, Rx, xx }[4-7]
+ DEINTB 1, 0, 5, 4, 7 ; (word) { Gx, xx (m0/m4) or Bx, Rx (m1/m5) }[0-3]/[4-7]
+ pmaddwd m3, m1, coeffV1 ; (dword) { Bx*BV + Rx*RV }[0-3]
+ pmaddwd m2, m0, coeffV2 ; (dword) { Gx*GV }[0-3]
+ pmaddwd m1, coeffU1 ; (dword) { Bx*BU + Rx*RU }[0-3]
+ pmaddwd m0, coeffU2 ; (dword) { Gx*GU }[0-3]
+ paddd m3, m6 ; += rgb_UVrnd
+ paddd m1, m6 ; += rgb_UVrnd
+ paddd m2, m3 ; (dword) { V[0-3] }
+ paddd m0, m1 ; (dword) { U[0-3] }
+ pmaddwd m3, m5, coeffV1 ; (dword) { Bx*BV + Rx*RV }[4-7]
+ pmaddwd m1, m4, coeffV2 ; (dword) { Gx*GV }[4-7]
+ pmaddwd m5, coeffU1 ; (dword) { Bx*BU + Rx*RU }[4-7]
+ pmaddwd m4, coeffU2 ; (dword) { Gx*GU }[4-7]
+ paddd m3, m6 ; += rgb_UVrnd
+ paddd m5, m6 ; += rgb_UVrnd
+ psrad m0, 15
+ paddd m1, m3 ; (dword) { V[4-7] }
+ paddd m4, m5 ; (dword) { U[4-7] }
+ psrad m2, 15
+ psrad m4, 15
+ psrad m1, 15
+ packssdw m0, m4 ; (word) { U[0-7] }
+ packssdw m2, m1 ; (word) { V[0-7] }
+%if mmsize == 8
+ packuswb m0, m0 ; (byte) { U[0-7] }
+ packuswb m2, m2 ; (byte) { V[0-7] }
+ movh [dstUq+wq], m0
+ movh [dstVq+wq], m2
+%else ; mmsize == 16
+ packuswb m0, m2 ; (byte) { U[0-7], V[0-7] }
+ movh [dstUq+wq], m0
+ movhps [dstVq+wq], m0
+%endif ; mmsize == 8/16
+ add wq, mmsize / 2
+ jl .loop
+ REP_RET
+%endif ; ARCH_X86_64 && %0 == 3
+%endmacro
+
+; %1 = nr. of XMM registers for rgb-to-Y func
+; %2 = nr. of XMM registers for rgb-to-UV func
+%macro RGB32_FUNCS 2
+RGB32_TO_Y_FN %1, r, g, b, a
+RGB32_TO_Y_FN %1, b, g, r, a, rgba
+RGB32_TO_Y_FN %1, a, r, g, b, rgba
+RGB32_TO_Y_FN %1, a, b, g, r, rgba
+
+RGB32_TO_UV_FN %2, r, g, b, a
+RGB32_TO_UV_FN %2, b, g, r, a, rgba
+RGB32_TO_UV_FN %2, a, r, g, b, rgba
+RGB32_TO_UV_FN %2, a, b, g, r, rgba
+%endmacro
+
+%if ARCH_X86_32
+INIT_MMX mmx
+RGB32_FUNCS 0, 0
+%endif
+
+INIT_XMM sse2
+RGB32_FUNCS 8, 12
+
+INIT_XMM avx
+RGB32_FUNCS 8, 12
+
+;-----------------------------------------------------------------------------
; YUYV/UYVY/NV12/NV21 packed pixel shuffling.
;
; void <fmt>ToY_<opt>(uint8_t *dst, const uint8_t *src, int w);
@@ -64,7 +490,7 @@ SECTION .text
; split the loop in an aligned and unaligned case
%macro YUYV_TO_Y_FN 2-3
cglobal %2ToY, 3, 3, %1, dst, src, w
-%ifdef ARCH_X86_64
+%if ARCH_X86_64
movsxd wq, wd
%endif
add dstq, wq
@@ -134,7 +560,7 @@ cglobal %2ToY, 3, 3, %1, dst, src, w
; split the loop in an aligned and unaligned case
%macro YUYV_TO_UV_FN 2-3
cglobal %2ToUV, 3, 4, %1, dstU, dstV, src, w
-%ifdef ARCH_X86_64
+%if ARCH_X86_64
movsxd wq, dword r4m
%else ; x86-32
mov wq, r4m
@@ -189,7 +615,7 @@ cglobal %2ToUV, 3, 4, %1, dstU, dstV, src, w
; %2 = nv12 or nv21
%macro NVXX_TO_UV_FN 2
cglobal %2ToUV, 3, 4, %1, dstU, dstV, src, w
-%ifdef ARCH_X86_64
+%if ARCH_X86_64
movsxd wq, dword r4m
%else ; x86-32
mov wq, r4m
@@ -215,7 +641,7 @@ cglobal %2ToUV, 3, 4, %1, dstU, dstV, src, w
%endif ; mmsize == 8/16
%endmacro
-%ifdef ARCH_X86_32
+%if ARCH_X86_32
INIT_MMX mmx
YUYV_TO_Y_FN 0, yuyv
YUYV_TO_Y_FN 0, uyvy
diff --git a/gst-libs/ext/libav/libswscale/x86/output.asm b/gst-libs/ext/libav/libswscale/x86/output.asm
index ae2929c..e1ceded 100644
--- a/gst-libs/ext/libav/libswscale/x86/output.asm
+++ b/gst-libs/ext/libav/libswscale/x86/output.asm
@@ -20,8 +20,7 @@
;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
;******************************************************************************
-%include "x86inc.asm"
-%include "x86util.asm"
+%include "libavutil/x86/x86util.asm"
SECTION_RODATA
@@ -58,21 +57,21 @@ SECTION .text
%macro yuv2planeX_fn 3
-%ifdef ARCH_X86_32
-%define cntr_reg r1
+%if ARCH_X86_32
+%define cntr_reg fltsizeq
%define movsx mov
%else
-%define cntr_reg r11
+%define cntr_reg r7
%define movsx movsxd
%endif
-cglobal yuv2planeX_%1, %3, 7, %2
+cglobal yuv2planeX_%1, %3, 8, %2, filter, fltsize, src, dst, w, dither, offset
%if %1 == 8 || %1 == 9 || %1 == 10
pxor m6, m6
%endif ; %1 == 8/9/10
%if %1 == 8
-%ifdef ARCH_X86_32
+%if ARCH_X86_32
%assign pad 0x2c - (stack_offset & 15)
SUB rsp, pad
%define m_dith m7
@@ -81,8 +80,8 @@ cglobal yuv2planeX_%1, %3, 7, %2
%endif ; x86-32
; create registers holding dither
- movq m_dith, [r5] ; dither
- test r6d, r6d
+ movq m_dith, [ditherq] ; dither
+ test offsetd, offsetd
jz .no_rot
%if mmsize == 16
punpcklqdq m_dith, m_dith
@@ -91,7 +90,7 @@ cglobal yuv2planeX_%1, %3, 7, %2
.no_rot:
%if mmsize == 16
punpcklbw m_dith, m6
-%ifdef ARCH_X86_64
+%if ARCH_X86_64
punpcklwd m8, m_dith, m6
pslld m8, 12
%else ; x86-32
@@ -100,7 +99,7 @@ cglobal yuv2planeX_%1, %3, 7, %2
%endif ; x86-32/64
punpckhwd m_dith, m6
pslld m_dith, 12
-%ifdef ARCH_X86_32
+%if ARCH_X86_32
mova [rsp+ 0], m5
mova [rsp+16], m_dith
%endif
@@ -131,11 +130,15 @@ cglobal yuv2planeX_%1, %3, 7, %2
; pixels per iteration. In order to not have to keep track of where
; we are w.r.t. dithering, we unroll the mmx/8bit loop x2.
%if %1 == 8
-%rep 16/mmsize
-%endif ; %1 == 8
+%assign %%repcnt 16/mmsize
+%else
+%assign %%repcnt 1
+%endif
+
+%rep %%repcnt
%if %1 == 8
-%ifdef ARCH_X86_32
+%if ARCH_X86_32
mova m2, [rsp+mmsize*(0+%%i)]
mova m1, [rsp+mmsize*(1+%%i)]
%else ; x86-64
@@ -146,17 +149,17 @@ cglobal yuv2planeX_%1, %3, 7, %2
mova m1, [yuv2yuvX_%1_start]
mova m2, m1
%endif ; %1 == 8/9/10/16
- movsx cntr_reg, r1m
+ movsx cntr_reg, fltsizem
.filterloop_ %+ %%i:
; input pixels
- mov r6, [r2+gprsize*cntr_reg-2*gprsize]
+ mov r6, [srcq+gprsize*cntr_reg-2*gprsize]
%if %1 == 16
mova m3, [r6+r5*4]
mova m5, [r6+r5*4+mmsize]
%else ; %1 == 8/9/10
mova m3, [r6+r5*2]
%endif ; %1 == 8/9/10/16
- mov r6, [r2+gprsize*cntr_reg-gprsize]
+ mov r6, [srcq+gprsize*cntr_reg-gprsize]
%if %1 == 16
mova m4, [r6+r5*4]
mova m6, [r6+r5*4+mmsize]
@@ -165,7 +168,7 @@ cglobal yuv2planeX_%1, %3, 7, %2
%endif ; %1 == 8/9/10/16
; coefficients
- movd m0, [r0+2*cntr_reg-4]; coeff[0], coeff[1]
+ movd m0, [filterq+2*cntr_reg-4] ; coeff[0], coeff[1]
%if %1 == 16
pshuflw m7, m0, 0 ; coeff[0]
pshuflw m0, m0, 0x55 ; coeff[1]
@@ -184,7 +187,7 @@ cglobal yuv2planeX_%1, %3, 7, %2
%else ; %1 == 10/9/8
punpcklwd m5, m3, m4
punpckhwd m3, m4
- SPLATD m0, m0
+ SPLATD m0
pmaddwd m5, m0
pmaddwd m3, m0
@@ -207,7 +210,7 @@ cglobal yuv2planeX_%1, %3, 7, %2
%if %1 == 8
packssdw m2, m1
packuswb m2, m2
- movh [r3+r5*1], m2
+ movh [dstq+r5*1], m2
%else ; %1 == 9/10/16
%if %1 == 16
packssdw m2, m1
@@ -215,25 +218,24 @@ cglobal yuv2planeX_%1, %3, 7, %2
%else ; %1 == 9/10
%if cpuflag(sse4)
packusdw m2, m1
-%else ; mmx2/sse2
+%else ; mmxext/sse2
packssdw m2, m1
pmaxsw m2, m6
-%endif ; mmx2/sse2/sse4/avx
+%endif ; mmxext/sse2/sse4/avx
pminsw m2, [yuv2yuvX_%1_upper]
%endif ; %1 == 9/10/16
- mova [r3+r5*2], m2
+ mova [dstq+r5*2], m2
%endif ; %1 == 8/9/10/16
add r5, mmsize/2
- sub r4d, mmsize/2
-%if %1 == 8
+ sub wd, mmsize/2
+
%assign %%i %%i+2
%endrep
-%endif ; %1 == 8
jg .pixelloop
%if %1 == 8
-%ifdef ARCH_X86_32
+%if ARCH_X86_32
ADD rsp, pad
RET
%else ; x86-64
@@ -244,9 +246,8 @@ cglobal yuv2planeX_%1, %3, 7, %2
%endif ; %1 == 8/9/10/16
%endmacro
-%define PALIGNR PALIGNR_MMX
-%ifdef ARCH_X86_32
-INIT_MMX mmx2
+%if ARCH_X86_32
+INIT_MMX mmxext
yuv2planeX_fn 8, 0, 7
yuv2planeX_fn 9, 0, 5
yuv2planeX_fn 10, 0, 5
@@ -257,7 +258,6 @@ yuv2planeX_fn 8, 10, 7
yuv2planeX_fn 9, 7, 5
yuv2planeX_fn 10, 7, 5
-%define PALIGNR PALIGNR_SSSE3
INIT_XMM sse4
yuv2planeX_fn 8, 10, 7
yuv2planeX_fn 9, 7, 5
@@ -273,17 +273,17 @@ yuv2planeX_fn 10, 7, 5
%macro yuv2plane1_mainloop 2
.loop_%2:
%if %1 == 8
- paddsw m0, m2, [r0+r2*2+mmsize*0]
- paddsw m1, m3, [r0+r2*2+mmsize*1]
+ paddsw m0, m2, [srcq+wq*2+mmsize*0]
+ paddsw m1, m3, [srcq+wq*2+mmsize*1]
psraw m0, 7
psraw m1, 7
packuswb m0, m1
- mov%2 [r1+r2], m0
+ mov%2 [dstq+wq], m0
%elif %1 == 16
- paddd m0, m4, [r0+r2*4+mmsize*0]
- paddd m1, m4, [r0+r2*4+mmsize*1]
- paddd m2, m4, [r0+r2*4+mmsize*2]
- paddd m3, m4, [r0+r2*4+mmsize*3]
+ paddd m0, m4, [srcq+wq*4+mmsize*0]
+ paddd m1, m4, [srcq+wq*4+mmsize*1]
+ paddd m2, m4, [srcq+wq*4+mmsize*2]
+ paddd m3, m4, [srcq+wq*4+mmsize*3]
psrad m0, 3
psrad m1, 3
psrad m2, 3
@@ -297,51 +297,52 @@ yuv2planeX_fn 10, 7, 5
paddw m0, m5
paddw m2, m5
%endif ; mmx/sse2/sse4/avx
- mov%2 [r1+r2*2], m0
- mov%2 [r1+r2*2+mmsize], m2
-%else
- paddsw m0, m2, [r0+r2*2+mmsize*0]
- paddsw m1, m2, [r0+r2*2+mmsize*1]
+ mov%2 [dstq+wq*2+mmsize*0], m0
+ mov%2 [dstq+wq*2+mmsize*1], m2
+%else ; %1 == 9/10
+ paddsw m0, m2, [srcq+wq*2+mmsize*0]
+ paddsw m1, m2, [srcq+wq*2+mmsize*1]
psraw m0, 15 - %1
psraw m1, 15 - %1
pmaxsw m0, m4
pmaxsw m1, m4
pminsw m0, m3
pminsw m1, m3
- mov%2 [r1+r2*2], m0
- mov%2 [r1+r2*2+mmsize], m1
+ mov%2 [dstq+wq*2+mmsize*0], m0
+ mov%2 [dstq+wq*2+mmsize*1], m1
%endif
- add r2, mmsize
+ add wq, mmsize
jl .loop_%2
%endmacro
%macro yuv2plane1_fn 3
-cglobal yuv2plane1_%1, %3, %3, %2
- add r2, mmsize - 1
- and r2, ~(mmsize - 1)
+cglobal yuv2plane1_%1, %3, %3, %2, src, dst, w, dither, offset
+ movsxdifnidn wq, wd
+ add wq, mmsize - 1
+ and wq, ~(mmsize - 1)
%if %1 == 8
- add r1, r2
+ add dstq, wq
%else ; %1 != 8
- lea r1, [r1+r2*2]
+ lea dstq, [dstq+wq*2]
%endif ; %1 == 8
%if %1 == 16
- lea r0, [r0+r2*4]
+ lea srcq, [srcq+wq*4]
%else ; %1 != 16
- lea r0, [r0+r2*2]
+ lea srcq, [srcq+wq*2]
%endif ; %1 == 16
- neg r2
+ neg wq
%if %1 == 8
pxor m4, m4 ; zero
; create registers holding dither
- movq m3, [r3] ; dither
- test r4d, r4d
+ movq m3, [ditherq] ; dither
+ test offsetd, offsetd
jz .no_rot
%if mmsize == 16
punpcklqdq m3, m3
%endif ; mmsize == 16
- PALIGNR_MMX m3, m3, 3, m2
+ PALIGNR m3, m3, 3, m2
.no_rot:
%if mmsize == 8
mova m2, m3
@@ -372,7 +373,7 @@ cglobal yuv2plane1_%1, %3, %3, %2
%if mmsize == 8
yuv2plane1_mainloop %1, a
%else ; mmsize == 16
- test r1, 15
+ test dstq, 15
jnz .unaligned
yuv2plane1_mainloop %1, a
REP_RET
@@ -382,12 +383,12 @@ cglobal yuv2plane1_%1, %3, %3, %2
REP_RET
%endmacro
-%ifdef ARCH_X86_32
+%if ARCH_X86_32
INIT_MMX mmx
yuv2plane1_fn 8, 0, 5
yuv2plane1_fn 16, 0, 3
-INIT_MMX mmx2
+INIT_MMX mmxext
yuv2plane1_fn 9, 0, 3
yuv2plane1_fn 10, 0, 3
%endif
diff --git a/gst-libs/ext/libav/libswscale/x86/rgb2rgb.c b/gst-libs/ext/libav/libswscale/x86/rgb2rgb.c
index 282618c..d4f2580 100644
--- a/gst-libs/ext/libav/libswscale/x86/rgb2rgb.c
+++ b/gst-libs/ext/libav/libswscale/x86/rgb2rgb.c
@@ -26,13 +26,17 @@
#include <stdint.h>
#include "config.h"
-#include "libavutil/x86_cpu.h"
+#include "libavutil/attributes.h"
+#include "libavutil/x86/asm.h"
+#include "libavutil/x86/cpu.h"
#include "libavutil/cpu.h"
#include "libavutil/bswap.h"
#include "libswscale/rgb2rgb.h"
#include "libswscale/swscale.h"
#include "libswscale/swscale_internal.h"
+#if HAVE_INLINE_ASM
+
DECLARE_ASM_CONST(8, uint64_t, mmx_ff) = 0x00000000000000FFULL;
DECLARE_ASM_CONST(8, uint64_t, mmx_null) = 0x0000000000000000ULL;
DECLARE_ASM_CONST(8, uint64_t, mmx_one) = 0xFFFFFFFFFFFFFFFFULL;
@@ -80,9 +84,9 @@ DECLARE_ASM_CONST(8, uint64_t, blue_15mask) = 0x0000001f0000001fULL;
#define RV ((int)( 0.439*(1<<RGB2YUV_SHIFT)+0.5))
#define RU ((int)(-0.148*(1<<RGB2YUV_SHIFT)+0.5))
-//Note: We have C, MMX, MMX2, 3DNOW versions, there is no 3DNOW + MMX2 one.
+// Note: We have C, MMX, MMXEXT, 3DNOW versions, there is no 3DNOW + MMXEXT one.
-#define COMPILE_TEMPLATE_MMX2 0
+#define COMPILE_TEMPLATE_MMXEXT 0
#define COMPILE_TEMPLATE_AMD3DNOW 0
#define COMPILE_TEMPLATE_SSE2 0
@@ -91,11 +95,11 @@ DECLARE_ASM_CONST(8, uint64_t, blue_15mask) = 0x0000001f0000001fULL;
#define RENAME(a) a ## _MMX
#include "rgb2rgb_template.c"
-//MMX2 versions
+// MMXEXT versions
#undef RENAME
-#undef COMPILE_TEMPLATE_MMX2
-#define COMPILE_TEMPLATE_MMX2 1
-#define RENAME(a) a ## _MMX2
+#undef COMPILE_TEMPLATE_MMXEXT
+#define COMPILE_TEMPLATE_MMXEXT 1
+#define RENAME(a) a ## _MMXEXT
#include "rgb2rgb_template.c"
//SSE2 versions
@@ -107,10 +111,10 @@ DECLARE_ASM_CONST(8, uint64_t, blue_15mask) = 0x0000001f0000001fULL;
//3DNOW versions
#undef RENAME
-#undef COMPILE_TEMPLATE_MMX2
+#undef COMPILE_TEMPLATE_MMXEXT
#undef COMPILE_TEMPLATE_SSE2
#undef COMPILE_TEMPLATE_AMD3DNOW
-#define COMPILE_TEMPLATE_MMX2 0
+#define COMPILE_TEMPLATE_MMXEXT 0
#define COMPILE_TEMPLATE_SSE2 0
#define COMPILE_TEMPLATE_AMD3DNOW 1
#define RENAME(a) a ## _3DNOW
@@ -119,20 +123,24 @@ DECLARE_ASM_CONST(8, uint64_t, blue_15mask) = 0x0000001f0000001fULL;
/*
RGB15->RGB16 original by Strepto/Astral
ported to gcc & bugfixed : A'rpi
- MMX2, 3DNOW optimization by Nick Kurshev
+ MMXEXT, 3DNOW optimization by Nick Kurshev
32-bit C version, and and&add trick by Michael Niedermayer
*/
-void rgb2rgb_init_x86(void)
+#endif /* HAVE_INLINE_ASM */
+
+av_cold void rgb2rgb_init_x86(void)
{
+#if HAVE_INLINE_ASM
int cpu_flags = av_get_cpu_flags();
- if (cpu_flags & AV_CPU_FLAG_MMX)
+ if (INLINE_MMX(cpu_flags))
rgb2rgb_init_MMX();
- if (HAVE_AMD3DNOW && cpu_flags & AV_CPU_FLAG_3DNOW)
+ if (INLINE_AMD3DNOW(cpu_flags))
rgb2rgb_init_3DNOW();
- if (HAVE_MMX2 && cpu_flags & AV_CPU_FLAG_MMX2)
- rgb2rgb_init_MMX2();
- if (HAVE_SSE && cpu_flags & AV_CPU_FLAG_SSE2)
+ if (INLINE_MMXEXT(cpu_flags))
+ rgb2rgb_init_MMXEXT();
+ if (INLINE_SSE2(cpu_flags))
rgb2rgb_init_SSE2();
+#endif /* HAVE_INLINE_ASM */
}
diff --git a/gst-libs/ext/libav/libswscale/x86/rgb2rgb_template.c b/gst-libs/ext/libav/libswscale/x86/rgb2rgb_template.c
index c255610..205b749 100644
--- a/gst-libs/ext/libav/libswscale/x86/rgb2rgb_template.c
+++ b/gst-libs/ext/libav/libswscale/x86/rgb2rgb_template.c
@@ -35,7 +35,7 @@
#if COMPILE_TEMPLATE_AMD3DNOW
#define PREFETCH "prefetch"
#define PAVGB "pavgusb"
-#elif COMPILE_TEMPLATE_MMX2
+#elif COMPILE_TEMPLATE_MMXEXT
#define PREFETCH "prefetchnta"
#define PAVGB "pavgb"
#else
@@ -49,7 +49,7 @@
#define EMMS "emms"
#endif
-#if COMPILE_TEMPLATE_MMX2
+#if COMPILE_TEMPLATE_MMXEXT
#define MOVNTQ "movntq"
#define SFENCE "sfence"
#else
@@ -73,25 +73,24 @@ static inline void RENAME(rgb24tobgr32)(const uint8_t *src, uint8_t *dst, int sr
__asm__ volatile("movq %0, %%mm7"::"m"(mask32a):"memory");
while (s < mm_end) {
__asm__ volatile(
- PREFETCH" 32%1 \n\t"
- "movd %1, %%mm0 \n\t"
- "punpckldq 3%1, %%mm0 \n\t"
- "movd 6%1, %%mm1 \n\t"
- "punpckldq 9%1, %%mm1 \n\t"
- "movd 12%1, %%mm2 \n\t"
- "punpckldq 15%1, %%mm2 \n\t"
- "movd 18%1, %%mm3 \n\t"
- "punpckldq 21%1, %%mm3 \n\t"
+ PREFETCH" 32(%1) \n\t"
+ "movd (%1), %%mm0 \n\t"
+ "punpckldq 3(%1), %%mm0 \n\t"
+ "movd 6(%1), %%mm1 \n\t"
+ "punpckldq 9(%1), %%mm1 \n\t"
+ "movd 12(%1), %%mm2 \n\t"
+ "punpckldq 15(%1), %%mm2 \n\t"
+ "movd 18(%1), %%mm3 \n\t"
+ "punpckldq 21(%1), %%mm3 \n\t"
"por %%mm7, %%mm0 \n\t"
"por %%mm7, %%mm1 \n\t"
"por %%mm7, %%mm2 \n\t"
"por %%mm7, %%mm3 \n\t"
- MOVNTQ" %%mm0, %0 \n\t"
- MOVNTQ" %%mm1, 8%0 \n\t"
- MOVNTQ" %%mm2, 16%0 \n\t"
- MOVNTQ" %%mm3, 24%0"
- :"=m"(*dest)
- :"m"(*s)
+ MOVNTQ" %%mm0, (%0) \n\t"
+ MOVNTQ" %%mm1, 8(%0) \n\t"
+ MOVNTQ" %%mm2, 16(%0) \n\t"
+ MOVNTQ" %%mm3, 24(%0)"
+ :: "r"(dest), "r"(s)
:"memory");
dest += 32;
s += 24;
@@ -138,9 +137,9 @@ static inline void RENAME(rgb24tobgr32)(const uint8_t *src, uint8_t *dst, int sr
"pand "MANGLE(mask24hhhh)", %%mm5\n\t" \
"por %%mm5, %%mm4 \n\t" \
\
- MOVNTQ" %%mm0, %0 \n\t" \
- MOVNTQ" %%mm1, 8%0 \n\t" \
- MOVNTQ" %%mm4, 16%0"
+ MOVNTQ" %%mm0, (%0) \n\t" \
+ MOVNTQ" %%mm1, 8(%0) \n\t" \
+ MOVNTQ" %%mm4, 16(%0)"
static inline void RENAME(rgb32tobgr24)(const uint8_t *src, uint8_t *dst, int src_size)
@@ -154,18 +153,17 @@ static inline void RENAME(rgb32tobgr24)(const uint8_t *src, uint8_t *dst, int sr
mm_end = end - 31;
while (s < mm_end) {
__asm__ volatile(
- PREFETCH" 32%1 \n\t"
- "movq %1, %%mm0 \n\t"
- "movq 8%1, %%mm1 \n\t"
- "movq 16%1, %%mm4 \n\t"
- "movq 24%1, %%mm5 \n\t"
+ PREFETCH" 32(%1) \n\t"
+ "movq (%1), %%mm0 \n\t"
+ "movq 8(%1), %%mm1 \n\t"
+ "movq 16(%1), %%mm4 \n\t"
+ "movq 24(%1), %%mm5 \n\t"
"movq %%mm0, %%mm2 \n\t"
"movq %%mm1, %%mm3 \n\t"
"movq %%mm4, %%mm6 \n\t"
"movq %%mm5, %%mm7 \n\t"
STORE_BGR24_MMX
- :"=m"(*dest)
- :"m"(*s)
+ :: "r"(dest), "r"(s)
:"memory");
dest += 24;
s += 32;
@@ -183,7 +181,7 @@ static inline void RENAME(rgb32tobgr24)(const uint8_t *src, uint8_t *dst, int sr
/*
original by Strepto/Astral
ported to gcc & bugfixed: A'rpi
- MMX2, 3DNOW optimization by Nick Kurshev
+ MMXEXT, 3DNOW optimization by Nick Kurshev
32-bit C version, and and&add trick by Michael Niedermayer
*/
static inline void RENAME(rgb15to16)(const uint8_t *src, uint8_t *dst, int src_size)
@@ -198,19 +196,18 @@ static inline void RENAME(rgb15to16)(const uint8_t *src, uint8_t *dst, int src_s
mm_end = end - 15;
while (s<mm_end) {
__asm__ volatile(
- PREFETCH" 32%1 \n\t"
- "movq %1, %%mm0 \n\t"
- "movq 8%1, %%mm2 \n\t"
+ PREFETCH" 32(%1) \n\t"
+ "movq (%1), %%mm0 \n\t"
+ "movq 8(%1), %%mm2 \n\t"
"movq %%mm0, %%mm1 \n\t"
"movq %%mm2, %%mm3 \n\t"
"pand %%mm4, %%mm0 \n\t"
"pand %%mm4, %%mm2 \n\t"
"paddw %%mm1, %%mm0 \n\t"
"paddw %%mm3, %%mm2 \n\t"
- MOVNTQ" %%mm0, %0 \n\t"
- MOVNTQ" %%mm2, 8%0"
- :"=m"(*d)
- :"m"(*s)
+ MOVNTQ" %%mm0, (%0) \n\t"
+ MOVNTQ" %%mm2, 8(%0)"
+ :: "r"(d), "r"(s)
);
d+=16;
s+=16;
@@ -243,9 +240,9 @@ static inline void RENAME(rgb16to15)(const uint8_t *src, uint8_t *dst, int src_s
mm_end = end - 15;
while (s<mm_end) {
__asm__ volatile(
- PREFETCH" 32%1 \n\t"
- "movq %1, %%mm0 \n\t"
- "movq 8%1, %%mm2 \n\t"
+ PREFETCH" 32(%1) \n\t"
+ "movq (%1), %%mm0 \n\t"
+ "movq 8(%1), %%mm2 \n\t"
"movq %%mm0, %%mm1 \n\t"
"movq %%mm2, %%mm3 \n\t"
"psrlq $1, %%mm0 \n\t"
@@ -256,10 +253,9 @@ static inline void RENAME(rgb16to15)(const uint8_t *src, uint8_t *dst, int src_s
"pand %%mm6, %%mm3 \n\t"
"por %%mm1, %%mm0 \n\t"
"por %%mm3, %%mm2 \n\t"
- MOVNTQ" %%mm0, %0 \n\t"
- MOVNTQ" %%mm2, 8%0"
- :"=m"(*d)
- :"m"(*s)
+ MOVNTQ" %%mm0, (%0) \n\t"
+ MOVNTQ" %%mm2, 8(%0)"
+ :: "r"(d), "r"(s)
);
d+=16;
s+=16;
@@ -287,7 +283,6 @@ static inline void RENAME(rgb32to16)(const uint8_t *src, uint8_t *dst, int src_s
uint16_t *d = (uint16_t *)dst;
end = s + src_size;
mm_end = end - 15;
-#if 1 //is faster only if multiplies are reasonably fast (FIXME figure out on which CPUs this is faster, on Athlon it is slightly faster)
__asm__ volatile(
"movq %3, %%mm5 \n\t"
"movq %4, %%mm6 \n\t"
@@ -322,47 +317,6 @@ static inline void RENAME(rgb32to16)(const uint8_t *src, uint8_t *dst, int src_s
: "+r" (d), "+r"(s)
: "r" (mm_end), "m" (mask3216g), "m" (mask3216br), "m" (mul3216)
);
-#else
- __asm__ volatile(PREFETCH" %0"::"m"(*src):"memory");
- __asm__ volatile(
- "movq %0, %%mm7 \n\t"
- "movq %1, %%mm6 \n\t"
- ::"m"(red_16mask),"m"(green_16mask));
- while (s < mm_end) {
- __asm__ volatile(
- PREFETCH" 32%1 \n\t"
- "movd %1, %%mm0 \n\t"
- "movd 4%1, %%mm3 \n\t"
- "punpckldq 8%1, %%mm0 \n\t"
- "punpckldq 12%1, %%mm3 \n\t"
- "movq %%mm0, %%mm1 \n\t"
- "movq %%mm0, %%mm2 \n\t"
- "movq %%mm3, %%mm4 \n\t"
- "movq %%mm3, %%mm5 \n\t"
- "psrlq $3, %%mm0 \n\t"
- "psrlq $3, %%mm3 \n\t"
- "pand %2, %%mm0 \n\t"
- "pand %2, %%mm3 \n\t"
- "psrlq $5, %%mm1 \n\t"
- "psrlq $5, %%mm4 \n\t"
- "pand %%mm6, %%mm1 \n\t"
- "pand %%mm6, %%mm4 \n\t"
- "psrlq $8, %%mm2 \n\t"
- "psrlq $8, %%mm5 \n\t"
- "pand %%mm7, %%mm2 \n\t"
- "pand %%mm7, %%mm5 \n\t"
- "por %%mm1, %%mm0 \n\t"
- "por %%mm4, %%mm3 \n\t"
- "por %%mm2, %%mm0 \n\t"
- "por %%mm5, %%mm3 \n\t"
- "psllq $16, %%mm3 \n\t"
- "por %%mm3, %%mm0 \n\t"
- MOVNTQ" %%mm0, %0 \n\t"
- :"=m"(*d):"m"(*s),"m"(blue_16mask):"memory");
- d += 4;
- s += 16;
- }
-#endif
__asm__ volatile(SFENCE:::"memory");
__asm__ volatile(EMMS:::"memory");
while (s < end) {
@@ -386,11 +340,11 @@ static inline void RENAME(rgb32tobgr16)(const uint8_t *src, uint8_t *dst, int sr
mm_end = end - 15;
while (s < mm_end) {
__asm__ volatile(
- PREFETCH" 32%1 \n\t"
- "movd %1, %%mm0 \n\t"
- "movd 4%1, %%mm3 \n\t"
- "punpckldq 8%1, %%mm0 \n\t"
- "punpckldq 12%1, %%mm3 \n\t"
+ PREFETCH" 32(%1) \n\t"
+ "movd (%1), %%mm0 \n\t"
+ "movd 4(%1), %%mm3 \n\t"
+ "punpckldq 8(%1), %%mm0 \n\t"
+ "punpckldq 12(%1), %%mm3 \n\t"
"movq %%mm0, %%mm1 \n\t"
"movq %%mm0, %%mm2 \n\t"
"movq %%mm3, %%mm4 \n\t"
@@ -413,8 +367,8 @@ static inline void RENAME(rgb32tobgr16)(const uint8_t *src, uint8_t *dst, int sr
"por %%mm5, %%mm3 \n\t"
"psllq $16, %%mm3 \n\t"
"por %%mm3, %%mm0 \n\t"
- MOVNTQ" %%mm0, %0 \n\t"
- :"=m"(*d):"m"(*s),"m"(blue_16mask):"memory");
+ MOVNTQ" %%mm0, (%0) \n\t"
+ :: "r"(d),"r"(s),"m"(blue_16mask):"memory");
d += 4;
s += 16;
}
@@ -434,7 +388,6 @@ static inline void RENAME(rgb32to15)(const uint8_t *src, uint8_t *dst, int src_s
uint16_t *d = (uint16_t *)dst;
end = s + src_size;
mm_end = end - 15;
-#if 1 //is faster only if multiplies are reasonably fast (FIXME figure out on which CPUs this is faster, on Athlon it is slightly faster)
__asm__ volatile(
"movq %3, %%mm5 \n\t"
"movq %4, %%mm6 \n\t"
@@ -469,47 +422,6 @@ static inline void RENAME(rgb32to15)(const uint8_t *src, uint8_t *dst, int src_s
: "+r" (d), "+r"(s)
: "r" (mm_end), "m" (mask3215g), "m" (mask3216br), "m" (mul3215)
);
-#else
- __asm__ volatile(PREFETCH" %0"::"m"(*src):"memory");
- __asm__ volatile(
- "movq %0, %%mm7 \n\t"
- "movq %1, %%mm6 \n\t"
- ::"m"(red_15mask),"m"(green_15mask));
- while (s < mm_end) {
- __asm__ volatile(
- PREFETCH" 32%1 \n\t"
- "movd %1, %%mm0 \n\t"
- "movd 4%1, %%mm3 \n\t"
- "punpckldq 8%1, %%mm0 \n\t"
- "punpckldq 12%1, %%mm3 \n\t"
- "movq %%mm0, %%mm1 \n\t"
- "movq %%mm0, %%mm2 \n\t"
- "movq %%mm3, %%mm4 \n\t"
- "movq %%mm3, %%mm5 \n\t"
- "psrlq $3, %%mm0 \n\t"
- "psrlq $3, %%mm3 \n\t"
- "pand %2, %%mm0 \n\t"
- "pand %2, %%mm3 \n\t"
- "psrlq $6, %%mm1 \n\t"
- "psrlq $6, %%mm4 \n\t"
- "pand %%mm6, %%mm1 \n\t"
- "pand %%mm6, %%mm4 \n\t"
- "psrlq $9, %%mm2 \n\t"
- "psrlq $9, %%mm5 \n\t"
- "pand %%mm7, %%mm2 \n\t"
- "pand %%mm7, %%mm5 \n\t"
- "por %%mm1, %%mm0 \n\t"
- "por %%mm4, %%mm3 \n\t"
- "por %%mm2, %%mm0 \n\t"
- "por %%mm5, %%mm3 \n\t"
- "psllq $16, %%mm3 \n\t"
- "por %%mm3, %%mm0 \n\t"
- MOVNTQ" %%mm0, %0 \n\t"
- :"=m"(*d):"m"(*s),"m"(blue_15mask):"memory");
- d += 4;
- s += 16;
- }
-#endif
__asm__ volatile(SFENCE:::"memory");
__asm__ volatile(EMMS:::"memory");
while (s < end) {
@@ -533,11 +445,11 @@ static inline void RENAME(rgb32tobgr15)(const uint8_t *src, uint8_t *dst, int sr
mm_end = end - 15;
while (s < mm_end) {
__asm__ volatile(
- PREFETCH" 32%1 \n\t"
- "movd %1, %%mm0 \n\t"
- "movd 4%1, %%mm3 \n\t"
- "punpckldq 8%1, %%mm0 \n\t"
- "punpckldq 12%1, %%mm3 \n\t"
+ PREFETCH" 32(%1) \n\t"
+ "movd (%1), %%mm0 \n\t"
+ "movd 4(%1), %%mm3 \n\t"
+ "punpckldq 8(%1), %%mm0 \n\t"
+ "punpckldq 12(%1), %%mm3 \n\t"
"movq %%mm0, %%mm1 \n\t"
"movq %%mm0, %%mm2 \n\t"
"movq %%mm3, %%mm4 \n\t"
@@ -560,8 +472,8 @@ static inline void RENAME(rgb32tobgr15)(const uint8_t *src, uint8_t *dst, int sr
"por %%mm5, %%mm3 \n\t"
"psllq $16, %%mm3 \n\t"
"por %%mm3, %%mm0 \n\t"
- MOVNTQ" %%mm0, %0 \n\t"
- :"=m"(*d):"m"(*s),"m"(blue_15mask):"memory");
+ MOVNTQ" %%mm0, (%0) \n\t"
+ ::"r"(d),"r"(s),"m"(blue_15mask):"memory");
d += 4;
s += 16;
}
@@ -588,11 +500,11 @@ static inline void RENAME(rgb24tobgr16)(const uint8_t *src, uint8_t *dst, int sr
mm_end = end - 11;
while (s < mm_end) {
__asm__ volatile(
- PREFETCH" 32%1 \n\t"
- "movd %1, %%mm0 \n\t"
- "movd 3%1, %%mm3 \n\t"
- "punpckldq 6%1, %%mm0 \n\t"
- "punpckldq 9%1, %%mm3 \n\t"
+ PREFETCH" 32(%1) \n\t"
+ "movd (%1), %%mm0 \n\t"
+ "movd 3(%1), %%mm3 \n\t"
+ "punpckldq 6(%1), %%mm0 \n\t"
+ "punpckldq 9(%1), %%mm3 \n\t"
"movq %%mm0, %%mm1 \n\t"
"movq %%mm0, %%mm2 \n\t"
"movq %%mm3, %%mm4 \n\t"
@@ -615,8 +527,8 @@ static inline void RENAME(rgb24tobgr16)(const uint8_t *src, uint8_t *dst, int sr
"por %%mm5, %%mm3 \n\t"
"psllq $16, %%mm3 \n\t"
"por %%mm3, %%mm0 \n\t"
- MOVNTQ" %%mm0, %0 \n\t"
- :"=m"(*d):"m"(*s),"m"(blue_16mask):"memory");
+ MOVNTQ" %%mm0, (%0) \n\t"
+ ::"r"(d),"r"(s),"m"(blue_16mask):"memory");
d += 4;
s += 12;
}
@@ -645,11 +557,11 @@ static inline void RENAME(rgb24to16)(const uint8_t *src, uint8_t *dst, int src_s
mm_end = end - 15;
while (s < mm_end) {
__asm__ volatile(
- PREFETCH" 32%1 \n\t"
- "movd %1, %%mm0 \n\t"
- "movd 3%1, %%mm3 \n\t"
- "punpckldq 6%1, %%mm0 \n\t"
- "punpckldq 9%1, %%mm3 \n\t"
+ PREFETCH" 32(%1) \n\t"
+ "movd (%1), %%mm0 \n\t"
+ "movd 3(%1), %%mm3 \n\t"
+ "punpckldq 6(%1), %%mm0 \n\t"
+ "punpckldq 9(%1), %%mm3 \n\t"
"movq %%mm0, %%mm1 \n\t"
"movq %%mm0, %%mm2 \n\t"
"movq %%mm3, %%mm4 \n\t"
@@ -672,8 +584,8 @@ static inline void RENAME(rgb24to16)(const uint8_t *src, uint8_t *dst, int src_s
"por %%mm5, %%mm3 \n\t"
"psllq $16, %%mm3 \n\t"
"por %%mm3, %%mm0 \n\t"
- MOVNTQ" %%mm0, %0 \n\t"
- :"=m"(*d):"m"(*s),"m"(blue_16mask):"memory");
+ MOVNTQ" %%mm0, (%0) \n\t"
+ ::"r"(d),"r"(s),"m"(blue_16mask):"memory");
d += 4;
s += 12;
}
@@ -702,11 +614,11 @@ static inline void RENAME(rgb24tobgr15)(const uint8_t *src, uint8_t *dst, int sr
mm_end = end - 11;
while (s < mm_end) {
__asm__ volatile(
- PREFETCH" 32%1 \n\t"
- "movd %1, %%mm0 \n\t"
- "movd 3%1, %%mm3 \n\t"
- "punpckldq 6%1, %%mm0 \n\t"
- "punpckldq 9%1, %%mm3 \n\t"
+ PREFETCH" 32(%1) \n\t"
+ "movd (%1), %%mm0 \n\t"
+ "movd 3(%1), %%mm3 \n\t"
+ "punpckldq 6(%1), %%mm0 \n\t"
+ "punpckldq 9(%1), %%mm3 \n\t"
"movq %%mm0, %%mm1 \n\t"
"movq %%mm0, %%mm2 \n\t"
"movq %%mm3, %%mm4 \n\t"
@@ -729,8 +641,8 @@ static inline void RENAME(rgb24tobgr15)(const uint8_t *src, uint8_t *dst, int sr
"por %%mm5, %%mm3 \n\t"
"psllq $16, %%mm3 \n\t"
"por %%mm3, %%mm0 \n\t"
- MOVNTQ" %%mm0, %0 \n\t"
- :"=m"(*d):"m"(*s),"m"(blue_15mask):"memory");
+ MOVNTQ" %%mm0, (%0) \n\t"
+ ::"r"(d),"r"(s),"m"(blue_15mask):"memory");
d += 4;
s += 12;
}
@@ -759,11 +671,11 @@ static inline void RENAME(rgb24to15)(const uint8_t *src, uint8_t *dst, int src_s
mm_end = end - 15;
while (s < mm_end) {
__asm__ volatile(
- PREFETCH" 32%1 \n\t"
- "movd %1, %%mm0 \n\t"
- "movd 3%1, %%mm3 \n\t"
- "punpckldq 6%1, %%mm0 \n\t"
- "punpckldq 9%1, %%mm3 \n\t"
+ PREFETCH" 32(%1) \n\t"
+ "movd (%1), %%mm0 \n\t"
+ "movd 3(%1), %%mm3 \n\t"
+ "punpckldq 6(%1), %%mm0 \n\t"
+ "punpckldq 9(%1), %%mm3 \n\t"
"movq %%mm0, %%mm1 \n\t"
"movq %%mm0, %%mm2 \n\t"
"movq %%mm3, %%mm4 \n\t"
@@ -786,8 +698,8 @@ static inline void RENAME(rgb24to15)(const uint8_t *src, uint8_t *dst, int src_s
"por %%mm5, %%mm3 \n\t"
"psllq $16, %%mm3 \n\t"
"por %%mm3, %%mm0 \n\t"
- MOVNTQ" %%mm0, %0 \n\t"
- :"=m"(*d):"m"(*s),"m"(blue_15mask):"memory");
+ MOVNTQ" %%mm0, (%0) \n\t"
+ ::"r"(d),"r"(s),"m"(blue_15mask):"memory");
d += 4;
s += 12;
}
@@ -833,10 +745,10 @@ static inline void RENAME(rgb15tobgr24)(const uint8_t *src, uint8_t *dst, int sr
mm_end = end - 7;
while (s < mm_end) {
__asm__ volatile(
- PREFETCH" 32%1 \n\t"
- "movq %1, %%mm0 \n\t"
- "movq %1, %%mm1 \n\t"
- "movq %1, %%mm2 \n\t"
+ PREFETCH" 32(%1) \n\t"
+ "movq (%1), %%mm0 \n\t"
+ "movq (%1), %%mm1 \n\t"
+ "movq (%1), %%mm2 \n\t"
"pand %2, %%mm0 \n\t"
"pand %3, %%mm1 \n\t"
"pand %4, %%mm2 \n\t"
@@ -864,9 +776,9 @@ static inline void RENAME(rgb15tobgr24)(const uint8_t *src, uint8_t *dst, int sr
"movq %%mm0, %%mm6 \n\t"
"movq %%mm3, %%mm7 \n\t"
- "movq 8%1, %%mm0 \n\t"
- "movq 8%1, %%mm1 \n\t"
- "movq 8%1, %%mm2 \n\t"
+ "movq 8(%1), %%mm0 \n\t"
+ "movq 8(%1), %%mm1 \n\t"
+ "movq 8(%1), %%mm2 \n\t"
"pand %2, %%mm0 \n\t"
"pand %3, %%mm1 \n\t"
"pand %4, %%mm2 \n\t"
@@ -892,7 +804,7 @@ static inline void RENAME(rgb15tobgr24)(const uint8_t *src, uint8_t *dst, int sr
"por %%mm5, %%mm3 \n\t"
:"=m"(*d)
- :"m"(*s),"m"(mask15b),"m"(mask15g),"m"(mask15r), "m"(mmx_null)
+ :"r"(s),"m"(mask15b),"m"(mask15g),"m"(mask15r), "m"(mmx_null)
:"memory");
/* borrowed 32 to 24 */
__asm__ volatile(
@@ -908,8 +820,7 @@ static inline void RENAME(rgb15tobgr24)(const uint8_t *src, uint8_t *dst, int sr
STORE_BGR24_MMX
- :"=m"(*d)
- :"m"(*s)
+ :: "r"(d), "m"(*s)
:"memory");
d += 24;
s += 8;
@@ -936,10 +847,10 @@ static inline void RENAME(rgb16tobgr24)(const uint8_t *src, uint8_t *dst, int sr
mm_end = end - 7;
while (s < mm_end) {
__asm__ volatile(
- PREFETCH" 32%1 \n\t"
- "movq %1, %%mm0 \n\t"
- "movq %1, %%mm1 \n\t"
- "movq %1, %%mm2 \n\t"
+ PREFETCH" 32(%1) \n\t"
+ "movq (%1), %%mm0 \n\t"
+ "movq (%1), %%mm1 \n\t"
+ "movq (%1), %%mm2 \n\t"
"pand %2, %%mm0 \n\t"
"pand %3, %%mm1 \n\t"
"pand %4, %%mm2 \n\t"
@@ -967,9 +878,9 @@ static inline void RENAME(rgb16tobgr24)(const uint8_t *src, uint8_t *dst, int sr
"movq %%mm0, %%mm6 \n\t"
"movq %%mm3, %%mm7 \n\t"
- "movq 8%1, %%mm0 \n\t"
- "movq 8%1, %%mm1 \n\t"
- "movq 8%1, %%mm2 \n\t"
+ "movq 8(%1), %%mm0 \n\t"
+ "movq 8(%1), %%mm1 \n\t"
+ "movq 8(%1), %%mm2 \n\t"
"pand %2, %%mm0 \n\t"
"pand %3, %%mm1 \n\t"
"pand %4, %%mm2 \n\t"
@@ -994,7 +905,7 @@ static inline void RENAME(rgb16tobgr24)(const uint8_t *src, uint8_t *dst, int sr
"por %%mm4, %%mm3 \n\t"
"por %%mm5, %%mm3 \n\t"
:"=m"(*d)
- :"m"(*s),"m"(mask16b),"m"(mask16g),"m"(mask16r),"m"(mmx_null)
+ :"r"(s),"m"(mask16b),"m"(mask16g),"m"(mask16r),"m"(mmx_null)
:"memory");
/* borrowed 32 to 24 */
__asm__ volatile(
@@ -1010,8 +921,7 @@ static inline void RENAME(rgb16tobgr24)(const uint8_t *src, uint8_t *dst, int sr
STORE_BGR24_MMX
- :"=m"(*d)
- :"m"(*s)
+ :: "r"(d), "m"(*s)
:"memory");
d += 24;
s += 8;
@@ -1043,8 +953,8 @@ static inline void RENAME(rgb16tobgr24)(const uint8_t *src, uint8_t *dst, int sr
"movq %%mm0, %%mm3 \n\t" \
"punpcklwd %%mm2, %%mm0 \n\t" /* FF R1 G1 B1 FF R0 G0 B0 */ \
"punpckhwd %%mm2, %%mm3 \n\t" /* FF R3 G3 B3 FF R2 G2 B2 */ \
- MOVNTQ" %%mm0, %0 \n\t" \
- MOVNTQ" %%mm3, 8%0 \n\t" \
+ MOVNTQ" %%mm0, (%0) \n\t" \
+ MOVNTQ" %%mm3, 8(%0) \n\t" \
static inline void RENAME(rgb15to32)(const uint8_t *src, uint8_t *dst, int src_size)
{
@@ -1059,10 +969,10 @@ static inline void RENAME(rgb15to32)(const uint8_t *src, uint8_t *dst, int src_s
mm_end = end - 3;
while (s < mm_end) {
__asm__ volatile(
- PREFETCH" 32%1 \n\t"
- "movq %1, %%mm0 \n\t"
- "movq %1, %%mm1 \n\t"
- "movq %1, %%mm2 \n\t"
+ PREFETCH" 32(%1) \n\t"
+ "movq (%1), %%mm0 \n\t"
+ "movq (%1), %%mm1 \n\t"
+ "movq (%1), %%mm2 \n\t"
"pand %2, %%mm0 \n\t"
"pand %3, %%mm1 \n\t"
"pand %4, %%mm2 \n\t"
@@ -1070,8 +980,7 @@ static inline void RENAME(rgb15to32)(const uint8_t *src, uint8_t *dst, int src_s
"psrlq $2, %%mm1 \n\t"
"psrlq $7, %%mm2 \n\t"
PACK_RGB32
- :"=m"(*d)
- :"m"(*s),"m"(mask15b),"m"(mask15g),"m"(mask15r)
+ ::"r"(d),"r"(s),"m"(mask15b),"m"(mask15g),"m"(mask15r)
:"memory");
d += 16;
s += 4;
@@ -1101,10 +1010,10 @@ static inline void RENAME(rgb16to32)(const uint8_t *src, uint8_t *dst, int src_s
mm_end = end - 3;
while (s < mm_end) {
__asm__ volatile(
- PREFETCH" 32%1 \n\t"
- "movq %1, %%mm0 \n\t"
- "movq %1, %%mm1 \n\t"
- "movq %1, %%mm2 \n\t"
+ PREFETCH" 32(%1) \n\t"
+ "movq (%1), %%mm0 \n\t"
+ "movq (%1), %%mm1 \n\t"
+ "movq (%1), %%mm2 \n\t"
"pand %2, %%mm0 \n\t"
"pand %3, %%mm1 \n\t"
"pand %4, %%mm2 \n\t"
@@ -1112,8 +1021,7 @@ static inline void RENAME(rgb16to32)(const uint8_t *src, uint8_t *dst, int src_s
"psrlq $3, %%mm1 \n\t"
"psrlq $8, %%mm2 \n\t"
PACK_RGB32
- :"=m"(*d)
- :"m"(*s),"m"(mask16b),"m"(mask16g),"m"(mask16r)
+ ::"r"(d),"r"(s),"m"(mask16b),"m"(mask16g),"m"(mask16r)
:"memory");
d += 16;
s += 4;
@@ -1148,7 +1056,7 @@ static inline void RENAME(shuffle_bytes_2103)(const uint8_t *src, uint8_t *dst,
PREFETCH" 32(%1, %0) \n\t"
"movq (%1, %0), %%mm0 \n\t"
"movq 8(%1, %0), %%mm1 \n\t"
-# if COMPILE_TEMPLATE_MMX2
+# if COMPILE_TEMPLATE_MMXEXT
"pshufw $177, %%mm0, %%mm3 \n\t"
"pshufw $177, %%mm1, %%mm5 \n\t"
"pand %%mm7, %%mm0 \n\t"
@@ -1512,7 +1420,7 @@ static inline void RENAME(yuy2toyv12)(const uint8_t *src, uint8_t *ydst, uint8_t
}
#endif /* !COMPILE_TEMPLATE_AMD3DNOW */
-#if COMPILE_TEMPLATE_MMX2 || COMPILE_TEMPLATE_AMD3DNOW
+#if COMPILE_TEMPLATE_MMXEXT || COMPILE_TEMPLATE_AMD3DNOW
static inline void RENAME(planar2x)(const uint8_t *src, uint8_t *dst, int srcWidth, int srcHeight, int srcStride, int dstStride)
{
int x,y;
@@ -1602,7 +1510,7 @@ static inline void RENAME(planar2x)(const uint8_t *src, uint8_t *dst, int srcWid
SFENCE" \n\t"
:::"memory");
}
-#endif /* COMPILE_TEMPLATE_MMX2 || COMPILE_TEMPLATE_AMD3DNOW */
+#endif /* COMPILE_TEMPLATE_MMXEXT || COMPILE_TEMPLATE_AMD3DNOW */
#if !COMPILE_TEMPLATE_AMD3DNOW
/**
@@ -1810,7 +1718,7 @@ static inline void RENAME(rgb24toyv12)(const uint8_t *src, uint8_t *ydst, uint8_
"1: \n\t"
PREFETCH" 64(%0, %%"REG_d") \n\t"
PREFETCH" 64(%1, %%"REG_d") \n\t"
-#if COMPILE_TEMPLATE_MMX2 || COMPILE_TEMPLATE_AMD3DNOW
+#if COMPILE_TEMPLATE_MMXEXT || COMPILE_TEMPLATE_AMD3DNOW
"movq (%0, %%"REG_d"), %%mm0 \n\t"
"movq (%1, %%"REG_d"), %%mm1 \n\t"
"movq 6(%0, %%"REG_d"), %%mm2 \n\t"
@@ -1871,7 +1779,7 @@ static inline void RENAME(rgb24toyv12)(const uint8_t *src, uint8_t *ydst, uint8_
"packssdw %%mm1, %%mm0 \n\t" // V1 V0 U1 U0
"psraw $7, %%mm0 \n\t"
-#if COMPILE_TEMPLATE_MMX2 || COMPILE_TEMPLATE_AMD3DNOW
+#if COMPILE_TEMPLATE_MMXEXT || COMPILE_TEMPLATE_AMD3DNOW
"movq 12(%0, %%"REG_d"), %%mm4 \n\t"
"movq 12(%1, %%"REG_d"), %%mm1 \n\t"
"movq 18(%0, %%"REG_d"), %%mm2 \n\t"
@@ -2041,8 +1949,8 @@ static inline void RENAME(vu9_to_vu12)(const uint8_t *src1, const uint8_t *src2,
int srcStride1, int srcStride2,
int dstStride1, int dstStride2)
{
- x86_reg y;
- int x,w,h;
+ x86_reg x, y;
+ int w,h;
w=width/2; h=height/2;
__asm__ volatile(
PREFETCH" %0 \n\t"
@@ -2054,11 +1962,11 @@ static inline void RENAME(vu9_to_vu12)(const uint8_t *src1, const uint8_t *src2,
x=0;
for (;x<w-31;x+=32) {
__asm__ volatile(
- PREFETCH" 32%1 \n\t"
- "movq %1, %%mm0 \n\t"
- "movq 8%1, %%mm2 \n\t"
- "movq 16%1, %%mm4 \n\t"
- "movq 24%1, %%mm6 \n\t"
+ PREFETCH" 32(%1,%2) \n\t"
+ "movq (%1,%2), %%mm0 \n\t"
+ "movq 8(%1,%2), %%mm2 \n\t"
+ "movq 16(%1,%2), %%mm4 \n\t"
+ "movq 24(%1,%2), %%mm6 \n\t"
"movq %%mm0, %%mm1 \n\t"
"movq %%mm2, %%mm3 \n\t"
"movq %%mm4, %%mm5 \n\t"
@@ -2071,16 +1979,15 @@ static inline void RENAME(vu9_to_vu12)(const uint8_t *src1, const uint8_t *src2,
"punpckhbw %%mm5, %%mm5 \n\t"
"punpcklbw %%mm6, %%mm6 \n\t"
"punpckhbw %%mm7, %%mm7 \n\t"
- MOVNTQ" %%mm0, %0 \n\t"
- MOVNTQ" %%mm1, 8%0 \n\t"
- MOVNTQ" %%mm2, 16%0 \n\t"
- MOVNTQ" %%mm3, 24%0 \n\t"
- MOVNTQ" %%mm4, 32%0 \n\t"
- MOVNTQ" %%mm5, 40%0 \n\t"
- MOVNTQ" %%mm6, 48%0 \n\t"
- MOVNTQ" %%mm7, 56%0"
- :"=m"(d[2*x])
- :"m"(s1[x])
+ MOVNTQ" %%mm0, (%0,%2,2) \n\t"
+ MOVNTQ" %%mm1, 8(%0,%2,2) \n\t"
+ MOVNTQ" %%mm2, 16(%0,%2,2) \n\t"
+ MOVNTQ" %%mm3, 24(%0,%2,2) \n\t"
+ MOVNTQ" %%mm4, 32(%0,%2,2) \n\t"
+ MOVNTQ" %%mm5, 40(%0,%2,2) \n\t"
+ MOVNTQ" %%mm6, 48(%0,%2,2) \n\t"
+ MOVNTQ" %%mm7, 56(%0,%2,2)"
+ :: "r"(d), "r"(s1), "r"(x)
:"memory");
}
for (;x<w;x++) d[2*x]=d[2*x+1]=s1[x];
@@ -2091,11 +1998,11 @@ static inline void RENAME(vu9_to_vu12)(const uint8_t *src1, const uint8_t *src2,
x=0;
for (;x<w-31;x+=32) {
__asm__ volatile(
- PREFETCH" 32%1 \n\t"
- "movq %1, %%mm0 \n\t"
- "movq 8%1, %%mm2 \n\t"
- "movq 16%1, %%mm4 \n\t"
- "movq 24%1, %%mm6 \n\t"
+ PREFETCH" 32(%1,%2) \n\t"
+ "movq (%1,%2), %%mm0 \n\t"
+ "movq 8(%1,%2), %%mm2 \n\t"
+ "movq 16(%1,%2), %%mm4 \n\t"
+ "movq 24(%1,%2), %%mm6 \n\t"
"movq %%mm0, %%mm1 \n\t"
"movq %%mm2, %%mm3 \n\t"
"movq %%mm4, %%mm5 \n\t"
@@ -2108,16 +2015,15 @@ static inline void RENAME(vu9_to_vu12)(const uint8_t *src1, const uint8_t *src2,
"punpckhbw %%mm5, %%mm5 \n\t"
"punpcklbw %%mm6, %%mm6 \n\t"
"punpckhbw %%mm7, %%mm7 \n\t"
- MOVNTQ" %%mm0, %0 \n\t"
- MOVNTQ" %%mm1, 8%0 \n\t"
- MOVNTQ" %%mm2, 16%0 \n\t"
- MOVNTQ" %%mm3, 24%0 \n\t"
- MOVNTQ" %%mm4, 32%0 \n\t"
- MOVNTQ" %%mm5, 40%0 \n\t"
- MOVNTQ" %%mm6, 48%0 \n\t"
- MOVNTQ" %%mm7, 56%0"
- :"=m"(d[2*x])
- :"m"(s2[x])
+ MOVNTQ" %%mm0, (%0,%2,2) \n\t"
+ MOVNTQ" %%mm1, 8(%0,%2,2) \n\t"
+ MOVNTQ" %%mm2, 16(%0,%2,2) \n\t"
+ MOVNTQ" %%mm3, 24(%0,%2,2) \n\t"
+ MOVNTQ" %%mm4, 32(%0,%2,2) \n\t"
+ MOVNTQ" %%mm5, 40(%0,%2,2) \n\t"
+ MOVNTQ" %%mm6, 48(%0,%2,2) \n\t"
+ MOVNTQ" %%mm7, 56(%0,%2,2)"
+ :: "r"(d), "r"(s2), "r"(x)
:"memory");
}
for (;x<w;x++) d[2*x]=d[2*x+1]=s2[x];
@@ -2590,16 +2496,16 @@ static inline void RENAME(rgb2rgb_init)(void)
yvu9_to_yuy2 = RENAME(yvu9_to_yuy2);
uyvytoyuv422 = RENAME(uyvytoyuv422);
yuyvtoyuv422 = RENAME(yuyvtoyuv422);
-#endif /* !COMPILE_TEMPLATE_SSE2 */
+#endif /* !COMPILE_TEMPLATE_AMD3DNOW */
-#if COMPILE_TEMPLATE_MMX2 || COMPILE_TEMPLATE_AMD3DNOW
+#if COMPILE_TEMPLATE_MMXEXT || COMPILE_TEMPLATE_AMD3DNOW
planar2x = RENAME(planar2x);
-#endif /* COMPILE_TEMPLATE_MMX2 || COMPILE_TEMPLATE_AMD3DNOW */
+#endif /* COMPILE_TEMPLATE_MMXEXT || COMPILE_TEMPLATE_AMD3DNOW */
rgb24toyv12 = RENAME(rgb24toyv12);
yuyvtoyuv420 = RENAME(yuyvtoyuv420);
uyvytoyuv420 = RENAME(uyvytoyuv420);
-#endif /* COMPILE_TEMPLATE_SSE2 */
+#endif /* !COMPILE_TEMPLATE_SSE2 */
#if !COMPILE_TEMPLATE_AMD3DNOW
interleaveBytes = RENAME(interleaveBytes);
diff --git a/gst-libs/ext/libav/libswscale/x86/scale.asm b/gst-libs/ext/libav/libswscale/x86/scale.asm
index 2b0b6dd..440a27b 100644
--- a/gst-libs/ext/libav/libswscale/x86/scale.asm
+++ b/gst-libs/ext/libav/libswscale/x86/scale.asm
@@ -19,8 +19,7 @@
;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
;******************************************************************************
-%include "x86inc.asm"
-%include "x86util.asm"
+%include "libavutil/x86/x86util.asm"
SECTION_RODATA
@@ -48,11 +47,15 @@ SECTION .text
; the first pixel is given in filterPos[nOutputPixel].
;-----------------------------------------------------------------------------
-; SCALE_FUNC source_width, intermediate_nbits, filtersize, filtersuffix, opt, n_args, n_xmm
-%macro SCALE_FUNC 7
-cglobal hscale%1to%2_%4_%5, %6, 7, %7
-%ifdef ARCH_X86_64
- movsxd r2, r2d
+; SCALE_FUNC source_width, intermediate_nbits, filtersize, filtersuffix, n_args, n_xmm
+%macro SCALE_FUNC 6
+%ifnidn %3, X
+cglobal hscale%1to%2_%4, %5, 7, %6, pos0, dst, w, src, filter, fltpos, pos1
+%else
+cglobal hscale%1to%2_%4, %5, 10, %6, pos0, dst, w, srcmem, filter, fltpos, fltsize
+%endif
+%if ARCH_X86_64
+ movsxd wq, wd
%define mov32 movsxd
%else ; x86-32
%define mov32 mov
@@ -60,7 +63,7 @@ cglobal hscale%1to%2_%4_%5, %6, 7, %7
%if %2 == 19
%if mmsize == 8 ; mmx
mova m2, [max_19bit_int]
-%elifidn %5, sse4
+%elif cpuflag(sse4)
mova m2, [max_19bit_int]
%else ; ssse3/sse2
mova m2, [max_19bit_flt]
@@ -87,48 +90,48 @@ cglobal hscale%1to%2_%4_%5, %6, 7, %7
; setup loop
%if %3 == 8
- shl r2, 1 ; this allows *16 (i.e. now *8) in lea instructions for the 8-tap filter
-%define r2shr 1
+ shl wq, 1 ; this allows *16 (i.e. now *8) in lea instructions for the 8-tap filter
+%define wshr 1
%else ; %3 == 4
-%define r2shr 0
+%define wshr 0
%endif ; %3 == 8
- lea r4, [r4+r2*8]
+ lea filterq, [filterq+wq*8]
%if %2 == 15
- lea r1, [r1+r2*(2>>r2shr)]
+ lea dstq, [dstq+wq*(2>>wshr)]
%else ; %2 == 19
- lea r1, [r1+r2*(4>>r2shr)]
+ lea dstq, [dstq+wq*(4>>wshr)]
%endif ; %2 == 15/19
- lea r5, [r5+r2*(4>>r2shr)]
- neg r2
+ lea fltposq, [fltposq+wq*(4>>wshr)]
+ neg wq
.loop:
%if %3 == 4 ; filterSize == 4 scaling
; load 2x4 or 4x4 source pixels into m0/m1
- mov32 r0, dword [r5+r2*4+0] ; filterPos[0]
- mov32 r6, dword [r5+r2*4+4] ; filterPos[1]
- movlh m0, [r3+r0*srcmul] ; src[filterPos[0] + {0,1,2,3}]
+ mov32 pos0q, dword [fltposq+wq*4+ 0] ; filterPos[0]
+ mov32 pos1q, dword [fltposq+wq*4+ 4] ; filterPos[1]
+ movlh m0, [srcq+pos0q*srcmul] ; src[filterPos[0] + {0,1,2,3}]
%if mmsize == 8
- movlh m1, [r3+r6*srcmul] ; src[filterPos[1] + {0,1,2,3}]
+ movlh m1, [srcq+pos1q*srcmul] ; src[filterPos[1] + {0,1,2,3}]
%else ; mmsize == 16
%if %1 > 8
- movhps m0, [r3+r6*srcmul] ; src[filterPos[1] + {0,1,2,3}]
+ movhps m0, [srcq+pos1q*srcmul] ; src[filterPos[1] + {0,1,2,3}]
%else ; %1 == 8
- movd m4, [r3+r6*srcmul] ; src[filterPos[1] + {0,1,2,3}]
+ movd m4, [srcq+pos1q*srcmul] ; src[filterPos[1] + {0,1,2,3}]
%endif
- mov32 r0, dword [r5+r2*4+8] ; filterPos[2]
- mov32 r6, dword [r5+r2*4+12] ; filterPos[3]
- movlh m1, [r3+r0*srcmul] ; src[filterPos[2] + {0,1,2,3}]
+ mov32 pos0q, dword [fltposq+wq*4+ 8] ; filterPos[2]
+ mov32 pos1q, dword [fltposq+wq*4+12] ; filterPos[3]
+ movlh m1, [srcq+pos0q*srcmul] ; src[filterPos[2] + {0,1,2,3}]
%if %1 > 8
- movhps m1, [r3+r6*srcmul] ; src[filterPos[3] + {0,1,2,3}]
+ movhps m1, [srcq+pos1q*srcmul] ; src[filterPos[3] + {0,1,2,3}]
%else ; %1 == 8
- movd m5, [r3+r6*srcmul] ; src[filterPos[3] + {0,1,2,3}]
+ movd m5, [srcq+pos1q*srcmul] ; src[filterPos[3] + {0,1,2,3}]
punpckldq m0, m4
punpckldq m1, m5
-%endif ; %1 == 8 && %5 <= ssse
+%endif ; %1 == 8
%endif ; mmsize == 8/16
%if %1 == 8
- punpcklbw m0, m3 ; byte -> word
- punpcklbw m1, m3 ; byte -> word
+ punpcklbw m0, m3 ; byte -> word
+ punpcklbw m1, m3 ; byte -> word
%endif ; %1 == 8
; multiply with filter coefficients
@@ -137,8 +140,8 @@ cglobal hscale%1to%2_%4_%5, %6, 7, %7
psubw m0, m6
psubw m1, m6
%endif ; %1 == 16
- pmaddwd m0, [r4+r2*8+mmsize*0] ; *= filter[{0,1,..,6,7}]
- pmaddwd m1, [r4+r2*8+mmsize*1] ; *= filter[{8,9,..,14,15}]
+ pmaddwd m0, [filterq+wq*8+mmsize*0] ; *= filter[{0,1,..,6,7}]
+ pmaddwd m1, [filterq+wq*8+mmsize*1] ; *= filter[{8,9,..,14,15}]
; add up horizontally (4 srcpix * 4 coefficients -> 1 dstpix)
%if mmsize == 8 ; mmx
@@ -146,38 +149,38 @@ cglobal hscale%1to%2_%4_%5, %6, 7, %7
punpckldq m0, m1
punpckhdq m4, m1
paddd m0, m4
-%elifidn %5, sse2
+%elif notcpuflag(ssse3) ; sse2
mova m4, m0
shufps m0, m1, 10001000b
shufps m4, m1, 11011101b
paddd m0, m4
%else ; ssse3/sse4
- phaddd m0, m1 ; filter[{ 0, 1, 2, 3}]*src[filterPos[0]+{0,1,2,3}],
- ; filter[{ 4, 5, 6, 7}]*src[filterPos[1]+{0,1,2,3}],
- ; filter[{ 8, 9,10,11}]*src[filterPos[2]+{0,1,2,3}],
- ; filter[{12,13,14,15}]*src[filterPos[3]+{0,1,2,3}]
+ phaddd m0, m1 ; filter[{ 0, 1, 2, 3}]*src[filterPos[0]+{0,1,2,3}],
+ ; filter[{ 4, 5, 6, 7}]*src[filterPos[1]+{0,1,2,3}],
+ ; filter[{ 8, 9,10,11}]*src[filterPos[2]+{0,1,2,3}],
+ ; filter[{12,13,14,15}]*src[filterPos[3]+{0,1,2,3}]
%endif ; mmx/sse2/ssse3/sse4
%else ; %3 == 8, i.e. filterSize == 8 scaling
; load 2x8 or 4x8 source pixels into m0, m1, m4 and m5
- mov32 r0, dword [r5+r2*2+0] ; filterPos[0]
- mov32 r6, dword [r5+r2*2+4] ; filterPos[1]
- movbh m0, [r3+ r0 *srcmul] ; src[filterPos[0] + {0,1,2,3,4,5,6,7}]
+ mov32 pos0q, dword [fltposq+wq*2+0] ; filterPos[0]
+ mov32 pos1q, dword [fltposq+wq*2+4] ; filterPos[1]
+ movbh m0, [srcq+ pos0q *srcmul] ; src[filterPos[0] + {0,1,2,3,4,5,6,7}]
%if mmsize == 8
- movbh m1, [r3+(r0+4)*srcmul] ; src[filterPos[0] + {4,5,6,7}]
- movbh m4, [r3+ r6 *srcmul] ; src[filterPos[1] + {0,1,2,3}]
- movbh m5, [r3+(r6+4)*srcmul] ; src[filterPos[1] + {4,5,6,7}]
+ movbh m1, [srcq+(pos0q+4)*srcmul] ; src[filterPos[0] + {4,5,6,7}]
+ movbh m4, [srcq+ pos1q *srcmul] ; src[filterPos[1] + {0,1,2,3}]
+ movbh m5, [srcq+(pos1q+4)*srcmul] ; src[filterPos[1] + {4,5,6,7}]
%else ; mmsize == 16
- movbh m1, [r3+ r6 *srcmul] ; src[filterPos[1] + {0,1,2,3,4,5,6,7}]
- mov32 r0, dword [r5+r2*2+8] ; filterPos[2]
- mov32 r6, dword [r5+r2*2+12] ; filterPos[3]
- movbh m4, [r3+ r0 *srcmul] ; src[filterPos[2] + {0,1,2,3,4,5,6,7}]
- movbh m5, [r3+ r6 *srcmul] ; src[filterPos[3] + {0,1,2,3,4,5,6,7}]
+ movbh m1, [srcq+ pos1q *srcmul] ; src[filterPos[1] + {0,1,2,3,4,5,6,7}]
+ mov32 pos0q, dword [fltposq+wq*2+8] ; filterPos[2]
+ mov32 pos1q, dword [fltposq+wq*2+12] ; filterPos[3]
+ movbh m4, [srcq+ pos0q *srcmul] ; src[filterPos[2] + {0,1,2,3,4,5,6,7}]
+ movbh m5, [srcq+ pos1q *srcmul] ; src[filterPos[3] + {0,1,2,3,4,5,6,7}]
%endif ; mmsize == 8/16
%if %1 == 8
- punpcklbw m0, m3 ; byte -> word
- punpcklbw m1, m3 ; byte -> word
- punpcklbw m4, m3 ; byte -> word
- punpcklbw m5, m3 ; byte -> word
+ punpcklbw m0, m3 ; byte -> word
+ punpcklbw m1, m3 ; byte -> word
+ punpcklbw m4, m3 ; byte -> word
+ punpcklbw m5, m3 ; byte -> word
%endif ; %1 == 8
; multiply
@@ -188,10 +191,10 @@ cglobal hscale%1to%2_%4_%5, %6, 7, %7
psubw m4, m6
psubw m5, m6
%endif ; %1 == 16
- pmaddwd m0, [r4+r2*8+mmsize*0] ; *= filter[{0,1,..,6,7}]
- pmaddwd m1, [r4+r2*8+mmsize*1] ; *= filter[{8,9,..,14,15}]
- pmaddwd m4, [r4+r2*8+mmsize*2] ; *= filter[{16,17,..,22,23}]
- pmaddwd m5, [r4+r2*8+mmsize*3] ; *= filter[{24,25,..,30,31}]
+ pmaddwd m0, [filterq+wq*8+mmsize*0] ; *= filter[{0,1,..,6,7}]
+ pmaddwd m1, [filterq+wq*8+mmsize*1] ; *= filter[{8,9,..,14,15}]
+ pmaddwd m4, [filterq+wq*8+mmsize*2] ; *= filter[{16,17,..,22,23}]
+ pmaddwd m5, [filterq+wq*8+mmsize*3] ; *= filter[{24,25,..,30,31}]
; add up horizontally (8 srcpix * 8 coefficients -> 1 dstpix)
%if mmsize == 8
@@ -201,7 +204,7 @@ cglobal hscale%1to%2_%4_%5, %6, 7, %7
punpckldq m0, m4
punpckhdq m1, m4
paddd m0, m1
-%elifidn %5, sse2
+%elif notcpuflag(ssse3) ; sse2
%if %1 == 8
%define mex m6
%else
@@ -226,55 +229,54 @@ cglobal hscale%1to%2_%4_%5, %6, 7, %7
; of 3 x phaddd here, faster on older cpus
phaddd m0, m1
phaddd m4, m5
- phaddd m0, m4 ; filter[{ 0, 1,..., 6, 7}]*src[filterPos[0]+{0,1,...,6,7}],
- ; filter[{ 8, 9,...,14,15}]*src[filterPos[1]+{0,1,...,6,7}],
- ; filter[{16,17,...,22,23}]*src[filterPos[2]+{0,1,...,6,7}],
- ; filter[{24,25,...,30,31}]*src[filterPos[3]+{0,1,...,6,7}]
+ phaddd m0, m4 ; filter[{ 0, 1,..., 6, 7}]*src[filterPos[0]+{0,1,...,6,7}],
+ ; filter[{ 8, 9,...,14,15}]*src[filterPos[1]+{0,1,...,6,7}],
+ ; filter[{16,17,...,22,23}]*src[filterPos[2]+{0,1,...,6,7}],
+ ; filter[{24,25,...,30,31}]*src[filterPos[3]+{0,1,...,6,7}]
%endif ; mmx/sse2/ssse3/sse4
%endif ; %3 == 4/8
%else ; %3 == X, i.e. any filterSize scaling
%ifidn %4, X4
-%define r6sub 4
+%define dlt 4
%else ; %4 == X || %4 == X8
-%define r6sub 0
+%define dlt 0
%endif ; %4 ==/!= X4
-%ifdef ARCH_X86_64
- push r12
- movsxd r6, r6d ; filterSize
- lea r12, [r3+(r6-r6sub)*srcmul] ; &src[filterSize&~4]
-%define src_reg r11
-%define r1x r10
-%define filter2 r12
+%if ARCH_X86_64
+%define srcq r8
+%define pos1q r7
+%define srcendq r9
+ movsxd fltsizeq, fltsized ; filterSize
+ lea srcendq, [srcmemq+(fltsizeq-dlt)*srcmul] ; &src[filterSize&~4]
%else ; x86-32
- lea r0, [r3+(r6-r6sub)*srcmul] ; &src[filterSize&~4]
- mov r6m, r0
-%define src_reg r3
-%define r1x r1
-%define filter2 r6m
+%define srcq srcmemq
+%define pos1q dstq
+%define srcendq r6m
+ lea pos0q, [srcmemq+(fltsizeq-dlt)*srcmul] ; &src[filterSize&~4]
+ mov srcendq, pos0q
%endif ; x86-32/64
- lea r5, [r5+r2*4]
+ lea fltposq, [fltposq+wq*4]
%if %2 == 15
- lea r1, [r1+r2*2]
+ lea dstq, [dstq+wq*2]
%else ; %2 == 19
- lea r1, [r1+r2*4]
+ lea dstq, [dstq+wq*4]
%endif ; %2 == 15/19
- movifnidn r1mp, r1
- neg r2
+ movifnidn dstmp, dstq
+ neg wq
.loop:
- mov32 r0, dword [r5+r2*4+0] ; filterPos[0]
- mov32 r1x, dword [r5+r2*4+4] ; filterPos[1]
+ mov32 pos0q, dword [fltposq+wq*4+0] ; filterPos[0]
+ mov32 pos1q, dword [fltposq+wq*4+4] ; filterPos[1]
; FIXME maybe do 4px/iteration on x86-64 (x86-32 wouldn't have enough regs)?
pxor m4, m4
pxor m5, m5
- mov src_reg, r3mp
+ mov srcq, srcmemmp
.innerloop:
; load 2x4 (mmx) or 2x8 (sse) source pixels into m0/m1 -> m4/m5
- movbh m0, [src_reg+r0 *srcmul] ; src[filterPos[0] + {0,1,2,3(,4,5,6,7)}]
- movbh m1, [src_reg+(r1x+r6sub)*srcmul] ; src[filterPos[1] + {0,1,2,3(,4,5,6,7)}]
+ movbh m0, [srcq+ pos0q *srcmul] ; src[filterPos[0] + {0,1,2,3(,4,5,6,7)}]
+ movbh m1, [srcq+(pos1q+dlt)*srcmul] ; src[filterPos[1] + {0,1,2,3(,4,5,6,7)}]
%if %1 == 8
punpcklbw m0, m3
punpcklbw m1, m3
@@ -286,25 +288,25 @@ cglobal hscale%1to%2_%4_%5, %6, 7, %7
psubw m0, m6
psubw m1, m6
%endif ; %1 == 16
- pmaddwd m0, [r4 ] ; filter[{0,1,2,3(,4,5,6,7)}]
- pmaddwd m1, [r4+(r6+r6sub)*2] ; filter[filtersize+{0,1,2,3(,4,5,6,7)}]
+ pmaddwd m0, [filterq] ; filter[{0,1,2,3(,4,5,6,7)}]
+ pmaddwd m1, [filterq+(fltsizeq+dlt)*2]; filter[filtersize+{0,1,2,3(,4,5,6,7)}]
paddd m4, m0
paddd m5, m1
- add r4, mmsize
- add src_reg, srcmul*mmsize/2
- cmp src_reg, filter2 ; while (src += 4) < &src[filterSize]
+ add filterq, mmsize
+ add srcq, srcmul*mmsize/2
+ cmp srcq, srcendq ; while (src += 4) < &src[filterSize]
jl .innerloop
%ifidn %4, X4
- mov32 r1x, dword [r5+r2*4+4] ; filterPos[1]
- movlh m0, [src_reg+r0 *srcmul] ; split last 4 srcpx of dstpx[0]
- sub r1x, r6 ; and first 4 srcpx of dstpx[1]
+ mov32 pos1q, dword [fltposq+wq*4+4] ; filterPos[1]
+ movlh m0, [srcq+ pos0q *srcmul] ; split last 4 srcpx of dstpx[0]
+ sub pos1q, fltsizeq ; and first 4 srcpx of dstpx[1]
%if %1 > 8
- movhps m0, [src_reg+(r1x+r6sub)*srcmul]
+ movhps m0, [srcq+(pos1q+dlt)*srcmul]
%else ; %1 == 8
- movd m1, [src_reg+(r1x+r6sub)*srcmul]
+ movd m1, [srcq+(pos1q+dlt)*srcmul]
punpckldq m0, m1
-%endif ; %1 == 8 && %5 <= ssse
+%endif ; %1 == 8
%if %1 == 8
punpcklbw m0, m3
%endif ; %1 == 8
@@ -312,10 +314,10 @@ cglobal hscale%1to%2_%4_%5, %6, 7, %7
; add back 0x8000 * sum(coeffs) after the horizontal add
psubw m0, m6
%endif ; %1 == 16
- pmaddwd m0, [r4]
+ pmaddwd m0, [filterq]
%endif ; %4 == X4
- lea r4, [r4+(r6+r6sub)*2]
+ lea filterq, [filterq+(fltsizeq+dlt)*2]
%if mmsize == 8 ; mmx
movq m0, m4
@@ -323,7 +325,7 @@ cglobal hscale%1to%2_%4_%5, %6, 7, %7
punpckhdq m0, m5
paddd m0, m4
%else ; mmsize == 16
-%ifidn %5, sse2
+%if notcpuflag(ssse3) ; sse2
mova m1, m4
punpcklqdq m4, m5
punpckhqdq m1, m5
@@ -334,7 +336,7 @@ cglobal hscale%1to%2_%4_%5, %6, 7, %7
%ifidn %4, X4
paddd m4, m0
%endif ; %3 == X4
-%ifidn %5, sse2
+%if notcpuflag(ssse3) ; sse2
pshufd m4, m4, 11011000b
movhlps m0, m4
paddd m0, m4
@@ -352,19 +354,19 @@ cglobal hscale%1to%2_%4_%5, %6, 7, %7
; clip, store
psrad m0, 14 + %1 - %2
%ifidn %3, X
- movifnidn r1, r1mp
+ movifnidn dstq, dstmp
%endif ; %3 == X
%if %2 == 15
packssdw m0, m0
%ifnidn %3, X
- movh [r1+r2*(2>>r2shr)], m0
+ movh [dstq+wq*(2>>wshr)], m0
%else ; %3 == X
- movd [r1+r2*2], m0
+ movd [dstq+wq*2], m0
%endif ; %3 ==/!= X
%else ; %2 == 19
%if mmsize == 8
PMINSD_MMX m0, m2, m4
-%elifidn %5, sse4
+%elif cpuflag(sse4)
pminsd m0, m2
%else ; sse2/ssse3
cvtdq2ps m0, m0
@@ -372,61 +374,54 @@ cglobal hscale%1to%2_%4_%5, %6, 7, %7
cvtps2dq m0, m0
%endif ; mmx/sse2/ssse3/sse4
%ifnidn %3, X
- mova [r1+r2*(4>>r2shr)], m0
+ mova [dstq+wq*(4>>wshr)], m0
%else ; %3 == X
- movq [r1+r2*4], m0
+ movq [dstq+wq*4], m0
%endif ; %3 ==/!= X
%endif ; %2 == 15/19
%ifnidn %3, X
- add r2, (mmsize<<r2shr)/4 ; both 8tap and 4tap really only do 4 pixels (or for mmx: 2 pixels)
- ; per iteration. see "shl r2,1" above as for why we do this
+ add wq, (mmsize<<wshr)/4 ; both 8tap and 4tap really only do 4 pixels (or for mmx: 2 pixels)
+ ; per iteration. see "shl wq,1" above as for why we do this
%else ; %3 == X
- add r2, 2
+ add wq, 2
%endif ; %3 ==/!= X
jl .loop
-%ifnidn %3, X
REP_RET
-%else ; %3 == X
-%ifdef ARCH_X86_64
- pop r12
- RET
-%else ; x86-32
- REP_RET
-%endif ; x86-32/64
-%endif ; %3 ==/!= X
%endmacro
-; SCALE_FUNCS source_width, intermediate_nbits, opt, n_xmm
-%macro SCALE_FUNCS 4
-SCALE_FUNC %1, %2, 4, 4, %3, 6, %4
-SCALE_FUNC %1, %2, 8, 8, %3, 6, %4
+; SCALE_FUNCS source_width, intermediate_nbits, n_xmm
+%macro SCALE_FUNCS 3
+SCALE_FUNC %1, %2, 4, 4, 6, %3
+SCALE_FUNC %1, %2, 8, 8, 6, %3
%if mmsize == 8
-SCALE_FUNC %1, %2, X, X, %3, 7, %4
+SCALE_FUNC %1, %2, X, X, 7, %3
%else
-SCALE_FUNC %1, %2, X, X4, %3, 7, %4
-SCALE_FUNC %1, %2, X, X8, %3, 7, %4
+SCALE_FUNC %1, %2, X, X4, 7, %3
+SCALE_FUNC %1, %2, X, X8, 7, %3
%endif
%endmacro
-; SCALE_FUNCS2 opt, 8_xmm_args, 9to10_xmm_args, 16_xmm_args
-%macro SCALE_FUNCS2 4
-%ifnidn %1, sse4
-SCALE_FUNCS 8, 15, %1, %2
-SCALE_FUNCS 9, 15, %1, %3
-SCALE_FUNCS 10, 15, %1, %3
-SCALE_FUNCS 16, 15, %1, %4
+; SCALE_FUNCS2 8_xmm_args, 9to10_xmm_args, 16_xmm_args
+%macro SCALE_FUNCS2 3
+%if notcpuflag(sse4)
+SCALE_FUNCS 8, 15, %1
+SCALE_FUNCS 9, 15, %2
+SCALE_FUNCS 10, 15, %2
+SCALE_FUNCS 16, 15, %3
%endif ; !sse4
-SCALE_FUNCS 8, 19, %1, %2
-SCALE_FUNCS 9, 19, %1, %3
-SCALE_FUNCS 10, 19, %1, %3
-SCALE_FUNCS 16, 19, %1, %4
+SCALE_FUNCS 8, 19, %1
+SCALE_FUNCS 9, 19, %2
+SCALE_FUNCS 10, 19, %2
+SCALE_FUNCS 16, 19, %3
%endmacro
-%ifdef ARCH_X86_32
-INIT_MMX
-SCALE_FUNCS2 mmx, 0, 0, 0
+%if ARCH_X86_32
+INIT_MMX mmx
+SCALE_FUNCS2 0, 0, 0
%endif
-INIT_XMM
-SCALE_FUNCS2 sse2, 6, 7, 8
-SCALE_FUNCS2 ssse3, 6, 6, 8
-SCALE_FUNCS2 sse4, 6, 6, 8
+INIT_XMM sse2
+SCALE_FUNCS2 6, 7, 8
+INIT_XMM ssse3
+SCALE_FUNCS2 6, 6, 8
+INIT_XMM sse4
+SCALE_FUNCS2 6, 6, 8
diff --git a/gst-libs/ext/libav/libswscale/x86/swscale.c b/gst-libs/ext/libav/libswscale/x86/swscale.c
new file mode 100644
index 0000000..c48e56d
--- /dev/null
+++ b/gst-libs/ext/libav/libswscale/x86/swscale.c
@@ -0,0 +1,493 @@
+/*
+ * Copyright (C) 2001-2003 Michael Niedermayer <michaelni@gmx.at>
+ *
+ * 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
+ */
+
+#include <inttypes.h>
+#include "config.h"
+#include "libswscale/swscale.h"
+#include "libswscale/swscale_internal.h"
+#include "libavutil/attributes.h"
+#include "libavutil/intreadwrite.h"
+#include "libavutil/x86/asm.h"
+#include "libavutil/x86/cpu.h"
+#include "libavutil/cpu.h"
+#include "libavutil/pixdesc.h"
+
+#if HAVE_INLINE_ASM
+
+#define DITHER1XBPP
+
+DECLARE_ASM_CONST(8, uint64_t, bF8)= 0xF8F8F8F8F8F8F8F8LL;
+DECLARE_ASM_CONST(8, uint64_t, bFC)= 0xFCFCFCFCFCFCFCFCLL;
+DECLARE_ASM_CONST(8, uint64_t, w10)= 0x0010001000100010LL;
+DECLARE_ASM_CONST(8, uint64_t, w02)= 0x0002000200020002LL;
+
+const DECLARE_ALIGNED(8, uint64_t, ff_dither4)[2] = {
+ 0x0103010301030103LL,
+ 0x0200020002000200LL,};
+
+const DECLARE_ALIGNED(8, uint64_t, ff_dither8)[2] = {
+ 0x0602060206020602LL,
+ 0x0004000400040004LL,};
+
+DECLARE_ASM_CONST(8, uint64_t, b16Mask)= 0x001F001F001F001FLL;
+DECLARE_ASM_CONST(8, uint64_t, g16Mask)= 0x07E007E007E007E0LL;
+DECLARE_ASM_CONST(8, uint64_t, r16Mask)= 0xF800F800F800F800LL;
+DECLARE_ASM_CONST(8, uint64_t, b15Mask)= 0x001F001F001F001FLL;
+DECLARE_ASM_CONST(8, uint64_t, g15Mask)= 0x03E003E003E003E0LL;
+DECLARE_ASM_CONST(8, uint64_t, r15Mask)= 0x7C007C007C007C00LL;
+
+DECLARE_ALIGNED(8, const uint64_t, ff_M24A) = 0x00FF0000FF0000FFLL;
+DECLARE_ALIGNED(8, const uint64_t, ff_M24B) = 0xFF0000FF0000FF00LL;
+DECLARE_ALIGNED(8, const uint64_t, ff_M24C) = 0x0000FF0000FF0000LL;
+
+#ifdef FAST_BGR2YV12
+DECLARE_ALIGNED(8, const uint64_t, ff_bgr2YCoeff) = 0x000000210041000DULL;
+DECLARE_ALIGNED(8, const uint64_t, ff_bgr2UCoeff) = 0x0000FFEEFFDC0038ULL;
+DECLARE_ALIGNED(8, const uint64_t, ff_bgr2VCoeff) = 0x00000038FFD2FFF8ULL;
+#else
+DECLARE_ALIGNED(8, const uint64_t, ff_bgr2YCoeff) = 0x000020E540830C8BULL;
+DECLARE_ALIGNED(8, const uint64_t, ff_bgr2UCoeff) = 0x0000ED0FDAC23831ULL;
+DECLARE_ALIGNED(8, const uint64_t, ff_bgr2VCoeff) = 0x00003831D0E6F6EAULL;
+#endif /* FAST_BGR2YV12 */
+DECLARE_ALIGNED(8, const uint64_t, ff_bgr2YOffset) = 0x1010101010101010ULL;
+DECLARE_ALIGNED(8, const uint64_t, ff_bgr2UVOffset) = 0x8080808080808080ULL;
+DECLARE_ALIGNED(8, const uint64_t, ff_w1111) = 0x0001000100010001ULL;
+
+//MMX versions
+#if HAVE_MMX_INLINE
+#undef RENAME
+#define COMPILE_TEMPLATE_MMXEXT 0
+#define RENAME(a) a ## _MMX
+#include "swscale_template.c"
+#endif
+
+// MMXEXT versions
+#if HAVE_MMXEXT_INLINE
+#undef RENAME
+#undef COMPILE_TEMPLATE_MMXEXT
+#define COMPILE_TEMPLATE_MMXEXT 1
+#define RENAME(a) a ## _MMXEXT
+#include "swscale_template.c"
+#endif
+
+void updateMMXDitherTables(SwsContext *c, int dstY, int lumBufIndex, int chrBufIndex,
+ int lastInLumBuf, int lastInChrBuf)
+{
+ const int dstH= c->dstH;
+ const int flags= c->flags;
+ int16_t **lumPixBuf= c->lumPixBuf;
+ int16_t **chrUPixBuf= c->chrUPixBuf;
+ int16_t **alpPixBuf= c->alpPixBuf;
+ const int vLumBufSize= c->vLumBufSize;
+ const int vChrBufSize= c->vChrBufSize;
+ int32_t *vLumFilterPos= c->vLumFilterPos;
+ int32_t *vChrFilterPos= c->vChrFilterPos;
+ int16_t *vLumFilter= c->vLumFilter;
+ int16_t *vChrFilter= c->vChrFilter;
+ int32_t *lumMmxFilter= c->lumMmxFilter;
+ int32_t *chrMmxFilter= c->chrMmxFilter;
+ int32_t av_unused *alpMmxFilter= c->alpMmxFilter;
+ const int vLumFilterSize= c->vLumFilterSize;
+ const int vChrFilterSize= c->vChrFilterSize;
+ const int chrDstY= dstY>>c->chrDstVSubSample;
+ const int firstLumSrcY= vLumFilterPos[dstY]; //First line needed as input
+ const int firstChrSrcY= vChrFilterPos[chrDstY]; //First line needed as input
+
+ c->blueDither= ff_dither8[dstY&1];
+ if (c->dstFormat == AV_PIX_FMT_RGB555 || c->dstFormat == AV_PIX_FMT_BGR555)
+ c->greenDither= ff_dither8[dstY&1];
+ else
+ c->greenDither= ff_dither4[dstY&1];
+ c->redDither= ff_dither8[(dstY+1)&1];
+ if (dstY < dstH - 2) {
+ const int16_t **lumSrcPtr= (const int16_t **) lumPixBuf + lumBufIndex + firstLumSrcY - lastInLumBuf + vLumBufSize;
+ const int16_t **chrUSrcPtr= (const int16_t **) chrUPixBuf + chrBufIndex + firstChrSrcY - lastInChrBuf + vChrBufSize;
+ const int16_t **alpSrcPtr= (CONFIG_SWSCALE_ALPHA && alpPixBuf) ? (const int16_t **) alpPixBuf + lumBufIndex + firstLumSrcY - lastInLumBuf + vLumBufSize : NULL;
+ int i;
+
+ if (firstLumSrcY < 0 || firstLumSrcY + vLumFilterSize > c->srcH) {
+ const int16_t **tmpY = (const int16_t **) lumPixBuf + 2 * vLumBufSize;
+ int neg = -firstLumSrcY, i, end = FFMIN(c->srcH - firstLumSrcY, vLumFilterSize);
+ for (i = 0; i < neg; i++)
+ tmpY[i] = lumSrcPtr[neg];
+ for ( ; i < end; i++)
+ tmpY[i] = lumSrcPtr[i];
+ for ( ; i < vLumFilterSize; i++)
+ tmpY[i] = tmpY[i-1];
+ lumSrcPtr = tmpY;
+
+ if (alpSrcPtr) {
+ const int16_t **tmpA = (const int16_t **) alpPixBuf + 2 * vLumBufSize;
+ for (i = 0; i < neg; i++)
+ tmpA[i] = alpSrcPtr[neg];
+ for ( ; i < end; i++)
+ tmpA[i] = alpSrcPtr[i];
+ for ( ; i < vLumFilterSize; i++)
+ tmpA[i] = tmpA[i - 1];
+ alpSrcPtr = tmpA;
+ }
+ }
+ if (firstChrSrcY < 0 || firstChrSrcY + vChrFilterSize > c->chrSrcH) {
+ const int16_t **tmpU = (const int16_t **) chrUPixBuf + 2 * vChrBufSize;
+ int neg = -firstChrSrcY, i, end = FFMIN(c->chrSrcH - firstChrSrcY, vChrFilterSize);
+ for (i = 0; i < neg; i++) {
+ tmpU[i] = chrUSrcPtr[neg];
+ }
+ for ( ; i < end; i++) {
+ tmpU[i] = chrUSrcPtr[i];
+ }
+ for ( ; i < vChrFilterSize; i++) {
+ tmpU[i] = tmpU[i - 1];
+ }
+ chrUSrcPtr = tmpU;
+ }
+
+ if (flags & SWS_ACCURATE_RND) {
+ int s= APCK_SIZE / 8;
+ for (i=0; i<vLumFilterSize; i+=2) {
+ *(const void**)&lumMmxFilter[s*i ]= lumSrcPtr[i ];
+ *(const void**)&lumMmxFilter[s*i+APCK_PTR2/4 ]= lumSrcPtr[i+(vLumFilterSize>1)];
+ lumMmxFilter[s*i+APCK_COEF/4 ]=
+ lumMmxFilter[s*i+APCK_COEF/4+1]= vLumFilter[dstY*vLumFilterSize + i ]
+ + (vLumFilterSize>1 ? vLumFilter[dstY*vLumFilterSize + i + 1]<<16 : 0);
+ if (CONFIG_SWSCALE_ALPHA && alpPixBuf) {
+ *(const void**)&alpMmxFilter[s*i ]= alpSrcPtr[i ];
+ *(const void**)&alpMmxFilter[s*i+APCK_PTR2/4 ]= alpSrcPtr[i+(vLumFilterSize>1)];
+ alpMmxFilter[s*i+APCK_COEF/4 ]=
+ alpMmxFilter[s*i+APCK_COEF/4+1]= lumMmxFilter[s*i+APCK_COEF/4 ];
+ }
+ }
+ for (i=0; i<vChrFilterSize; i+=2) {
+ *(const void**)&chrMmxFilter[s*i ]= chrUSrcPtr[i ];
+ *(const void**)&chrMmxFilter[s*i+APCK_PTR2/4 ]= chrUSrcPtr[i+(vChrFilterSize>1)];
+ chrMmxFilter[s*i+APCK_COEF/4 ]=
+ chrMmxFilter[s*i+APCK_COEF/4+1]= vChrFilter[chrDstY*vChrFilterSize + i ]
+ + (vChrFilterSize>1 ? vChrFilter[chrDstY*vChrFilterSize + i + 1]<<16 : 0);
+ }
+ } else {
+ for (i=0; i<vLumFilterSize; i++) {
+ *(const void**)&lumMmxFilter[4*i+0]= lumSrcPtr[i];
+ lumMmxFilter[4*i+2]=
+ lumMmxFilter[4*i+3]=
+ ((uint16_t)vLumFilter[dstY*vLumFilterSize + i])*0x10001;
+ if (CONFIG_SWSCALE_ALPHA && alpPixBuf) {
+ *(const void**)&alpMmxFilter[4*i+0]= alpSrcPtr[i];
+ alpMmxFilter[4*i+2]=
+ alpMmxFilter[4*i+3]= lumMmxFilter[4*i+2];
+ }
+ }
+ for (i=0; i<vChrFilterSize; i++) {
+ *(const void**)&chrMmxFilter[4*i+0]= chrUSrcPtr[i];
+ chrMmxFilter[4*i+2]=
+ chrMmxFilter[4*i+3]=
+ ((uint16_t)vChrFilter[chrDstY*vChrFilterSize + i])*0x10001;
+ }
+ }
+ }
+}
+
+#endif /* HAVE_INLINE_ASM */
+
+#define SCALE_FUNC(filter_n, from_bpc, to_bpc, opt) \
+extern void ff_hscale ## from_bpc ## to ## to_bpc ## _ ## filter_n ## _ ## opt( \
+ SwsContext *c, int16_t *data, \
+ int dstW, const uint8_t *src, \
+ const int16_t *filter, \
+ const int32_t *filterPos, int filterSize)
+
+#define SCALE_FUNCS(filter_n, opt) \
+ SCALE_FUNC(filter_n, 8, 15, opt); \
+ SCALE_FUNC(filter_n, 9, 15, opt); \
+ SCALE_FUNC(filter_n, 10, 15, opt); \
+ SCALE_FUNC(filter_n, 16, 15, opt); \
+ SCALE_FUNC(filter_n, 8, 19, opt); \
+ SCALE_FUNC(filter_n, 9, 19, opt); \
+ SCALE_FUNC(filter_n, 10, 19, opt); \
+ SCALE_FUNC(filter_n, 16, 19, opt)
+
+#define SCALE_FUNCS_MMX(opt) \
+ SCALE_FUNCS(4, opt); \
+ SCALE_FUNCS(8, opt); \
+ SCALE_FUNCS(X, opt)
+
+#define SCALE_FUNCS_SSE(opt) \
+ SCALE_FUNCS(4, opt); \
+ SCALE_FUNCS(8, opt); \
+ SCALE_FUNCS(X4, opt); \
+ SCALE_FUNCS(X8, opt)
+
+#if ARCH_X86_32
+SCALE_FUNCS_MMX(mmx);
+#endif
+SCALE_FUNCS_SSE(sse2);
+SCALE_FUNCS_SSE(ssse3);
+SCALE_FUNCS_SSE(sse4);
+
+#define VSCALEX_FUNC(size, opt) \
+extern void ff_yuv2planeX_ ## size ## _ ## opt(const int16_t *filter, int filterSize, \
+ const int16_t **src, uint8_t *dest, int dstW, \
+ const uint8_t *dither, int offset)
+#define VSCALEX_FUNCS(opt) \
+ VSCALEX_FUNC(8, opt); \
+ VSCALEX_FUNC(9, opt); \
+ VSCALEX_FUNC(10, opt)
+
+#if ARCH_X86_32
+VSCALEX_FUNCS(mmxext);
+#endif
+VSCALEX_FUNCS(sse2);
+VSCALEX_FUNCS(sse4);
+VSCALEX_FUNC(16, sse4);
+VSCALEX_FUNCS(avx);
+
+#define VSCALE_FUNC(size, opt) \
+extern void ff_yuv2plane1_ ## size ## _ ## opt(const int16_t *src, uint8_t *dst, int dstW, \
+ const uint8_t *dither, int offset)
+#define VSCALE_FUNCS(opt1, opt2) \
+ VSCALE_FUNC(8, opt1); \
+ VSCALE_FUNC(9, opt2); \
+ VSCALE_FUNC(10, opt2); \
+ VSCALE_FUNC(16, opt1)
+
+#if ARCH_X86_32
+VSCALE_FUNCS(mmx, mmxext);
+#endif
+VSCALE_FUNCS(sse2, sse2);
+VSCALE_FUNC(16, sse4);
+VSCALE_FUNCS(avx, avx);
+
+#define INPUT_Y_FUNC(fmt, opt) \
+extern void ff_ ## fmt ## ToY_ ## opt(uint8_t *dst, const uint8_t *src, \
+ int w, uint32_t *unused)
+#define INPUT_UV_FUNC(fmt, opt) \
+extern void ff_ ## fmt ## ToUV_ ## opt(uint8_t *dstU, uint8_t *dstV, \
+ const uint8_t *src, const uint8_t *unused1, \
+ int w, uint32_t *unused2)
+#define INPUT_FUNC(fmt, opt) \
+ INPUT_Y_FUNC(fmt, opt); \
+ INPUT_UV_FUNC(fmt, opt)
+#define INPUT_FUNCS(opt) \
+ INPUT_FUNC(uyvy, opt); \
+ INPUT_FUNC(yuyv, opt); \
+ INPUT_UV_FUNC(nv12, opt); \
+ INPUT_UV_FUNC(nv21, opt); \
+ INPUT_FUNC(rgba, opt); \
+ INPUT_FUNC(bgra, opt); \
+ INPUT_FUNC(argb, opt); \
+ INPUT_FUNC(abgr, opt); \
+ INPUT_FUNC(rgb24, opt); \
+ INPUT_FUNC(bgr24, opt)
+
+#if ARCH_X86_32
+INPUT_FUNCS(mmx);
+#endif
+INPUT_FUNCS(sse2);
+INPUT_FUNCS(ssse3);
+INPUT_FUNCS(avx);
+
+av_cold void ff_sws_init_swScale_mmx(SwsContext *c)
+{
+ int cpu_flags = av_get_cpu_flags();
+
+#if HAVE_INLINE_ASM
+ if (cpu_flags & AV_CPU_FLAG_MMX)
+ sws_init_swScale_MMX(c);
+#if HAVE_MMXEXT_INLINE
+ if (cpu_flags & AV_CPU_FLAG_MMXEXT)
+ sws_init_swScale_MMXEXT(c);
+#endif
+#endif /* HAVE_INLINE_ASM */
+
+#define ASSIGN_SCALE_FUNC2(hscalefn, filtersize, opt1, opt2) do { \
+ if (c->srcBpc == 8) { \
+ hscalefn = c->dstBpc <= 10 ? ff_hscale8to15_ ## filtersize ## _ ## opt2 : \
+ ff_hscale8to19_ ## filtersize ## _ ## opt1; \
+ } else if (c->srcBpc == 9) { \
+ hscalefn = c->dstBpc <= 10 ? ff_hscale9to15_ ## filtersize ## _ ## opt2 : \
+ ff_hscale9to19_ ## filtersize ## _ ## opt1; \
+ } else if (c->srcBpc == 10) { \
+ hscalefn = c->dstBpc <= 10 ? ff_hscale10to15_ ## filtersize ## _ ## opt2 : \
+ ff_hscale10to19_ ## filtersize ## _ ## opt1; \
+ } else /* c->srcBpc == 16 */ { \
+ hscalefn = c->dstBpc <= 10 ? ff_hscale16to15_ ## filtersize ## _ ## opt2 : \
+ ff_hscale16to19_ ## filtersize ## _ ## opt1; \
+ } \
+} while (0)
+#define ASSIGN_MMX_SCALE_FUNC(hscalefn, filtersize, opt1, opt2) \
+ switch (filtersize) { \
+ case 4: ASSIGN_SCALE_FUNC2(hscalefn, 4, opt1, opt2); break; \
+ case 8: ASSIGN_SCALE_FUNC2(hscalefn, 8, opt1, opt2); break; \
+ default: ASSIGN_SCALE_FUNC2(hscalefn, X, opt1, opt2); break; \
+ }
+#define ASSIGN_VSCALEX_FUNC(vscalefn, opt, do_16_case, condition_8bit) \
+switch(c->dstBpc){ \
+ case 16: do_16_case; break; \
+ case 10: if (!isBE(c->dstFormat)) vscalefn = ff_yuv2planeX_10_ ## opt; break; \
+ case 9: if (!isBE(c->dstFormat)) vscalefn = ff_yuv2planeX_9_ ## opt; break; \
+ default: if (condition_8bit) vscalefn = ff_yuv2planeX_8_ ## opt; break; \
+ }
+#define ASSIGN_VSCALE_FUNC(vscalefn, opt1, opt2, opt2chk) \
+ switch(c->dstBpc){ \
+ case 16: if (!isBE(c->dstFormat)) vscalefn = ff_yuv2plane1_16_ ## opt1; break; \
+ case 10: if (!isBE(c->dstFormat) && opt2chk) vscalefn = ff_yuv2plane1_10_ ## opt2; break; \
+ case 9: if (!isBE(c->dstFormat) && opt2chk) vscalefn = ff_yuv2plane1_9_ ## opt2; break; \
+ default: vscalefn = ff_yuv2plane1_8_ ## opt1; break; \
+ }
+#define case_rgb(x, X, opt) \
+ case AV_PIX_FMT_ ## X: \
+ c->lumToYV12 = ff_ ## x ## ToY_ ## opt; \
+ if (!c->chrSrcHSubSample) \
+ c->chrToYV12 = ff_ ## x ## ToUV_ ## opt; \
+ break
+#if ARCH_X86_32
+ if (EXTERNAL_MMX(cpu_flags)) {
+ ASSIGN_MMX_SCALE_FUNC(c->hyScale, c->hLumFilterSize, mmx, mmx);
+ ASSIGN_MMX_SCALE_FUNC(c->hcScale, c->hChrFilterSize, mmx, mmx);
+ ASSIGN_VSCALE_FUNC(c->yuv2plane1, mmx, mmxext, cpu_flags & AV_CPU_FLAG_MMXEXT);
+
+ switch (c->srcFormat) {
+ case AV_PIX_FMT_Y400A:
+ c->lumToYV12 = ff_yuyvToY_mmx;
+ if (c->alpPixBuf)
+ c->alpToYV12 = ff_uyvyToY_mmx;
+ break;
+ case AV_PIX_FMT_YUYV422:
+ c->lumToYV12 = ff_yuyvToY_mmx;
+ c->chrToYV12 = ff_yuyvToUV_mmx;
+ break;
+ case AV_PIX_FMT_UYVY422:
+ c->lumToYV12 = ff_uyvyToY_mmx;
+ c->chrToYV12 = ff_uyvyToUV_mmx;
+ break;
+ case AV_PIX_FMT_NV12:
+ c->chrToYV12 = ff_nv12ToUV_mmx;
+ break;
+ case AV_PIX_FMT_NV21:
+ c->chrToYV12 = ff_nv21ToUV_mmx;
+ break;
+ case_rgb(rgb24, RGB24, mmx);
+ case_rgb(bgr24, BGR24, mmx);
+ case_rgb(bgra, BGRA, mmx);
+ case_rgb(rgba, RGBA, mmx);
+ case_rgb(abgr, ABGR, mmx);
+ case_rgb(argb, ARGB, mmx);
+ default:
+ break;
+ }
+ }
+ if (EXTERNAL_MMXEXT(cpu_flags)) {
+ ASSIGN_VSCALEX_FUNC(c->yuv2planeX, mmxext, , 1);
+ }
+#endif /* ARCH_X86_32 */
+#define ASSIGN_SSE_SCALE_FUNC(hscalefn, filtersize, opt1, opt2) \
+ switch (filtersize) { \
+ case 4: ASSIGN_SCALE_FUNC2(hscalefn, 4, opt1, opt2); break; \
+ case 8: ASSIGN_SCALE_FUNC2(hscalefn, 8, opt1, opt2); break; \
+ default: if (filtersize & 4) ASSIGN_SCALE_FUNC2(hscalefn, X4, opt1, opt2); \
+ else ASSIGN_SCALE_FUNC2(hscalefn, X8, opt1, opt2); \
+ break; \
+ }
+ if (EXTERNAL_SSE2(cpu_flags)) {
+ ASSIGN_SSE_SCALE_FUNC(c->hyScale, c->hLumFilterSize, sse2, sse2);
+ ASSIGN_SSE_SCALE_FUNC(c->hcScale, c->hChrFilterSize, sse2, sse2);
+ ASSIGN_VSCALEX_FUNC(c->yuv2planeX, sse2, ,
+ HAVE_ALIGNED_STACK || ARCH_X86_64);
+ ASSIGN_VSCALE_FUNC(c->yuv2plane1, sse2, sse2, 1);
+
+ switch (c->srcFormat) {
+ case AV_PIX_FMT_Y400A:
+ c->lumToYV12 = ff_yuyvToY_sse2;
+ if (c->alpPixBuf)
+ c->alpToYV12 = ff_uyvyToY_sse2;
+ break;
+ case AV_PIX_FMT_YUYV422:
+ c->lumToYV12 = ff_yuyvToY_sse2;
+ c->chrToYV12 = ff_yuyvToUV_sse2;
+ break;
+ case AV_PIX_FMT_UYVY422:
+ c->lumToYV12 = ff_uyvyToY_sse2;
+ c->chrToYV12 = ff_uyvyToUV_sse2;
+ break;
+ case AV_PIX_FMT_NV12:
+ c->chrToYV12 = ff_nv12ToUV_sse2;
+ break;
+ case AV_PIX_FMT_NV21:
+ c->chrToYV12 = ff_nv21ToUV_sse2;
+ break;
+ case_rgb(rgb24, RGB24, sse2);
+ case_rgb(bgr24, BGR24, sse2);
+ case_rgb(bgra, BGRA, sse2);
+ case_rgb(rgba, RGBA, sse2);
+ case_rgb(abgr, ABGR, sse2);
+ case_rgb(argb, ARGB, sse2);
+ default:
+ break;
+ }
+ }
+ if (EXTERNAL_SSSE3(cpu_flags)) {
+ ASSIGN_SSE_SCALE_FUNC(c->hyScale, c->hLumFilterSize, ssse3, ssse3);
+ ASSIGN_SSE_SCALE_FUNC(c->hcScale, c->hChrFilterSize, ssse3, ssse3);
+ switch (c->srcFormat) {
+ case_rgb(rgb24, RGB24, ssse3);
+ case_rgb(bgr24, BGR24, ssse3);
+ default:
+ break;
+ }
+ }
+ if (EXTERNAL_SSE4(cpu_flags)) {
+ /* Xto15 don't need special sse4 functions */
+ ASSIGN_SSE_SCALE_FUNC(c->hyScale, c->hLumFilterSize, sse4, ssse3);
+ ASSIGN_SSE_SCALE_FUNC(c->hcScale, c->hChrFilterSize, sse4, ssse3);
+ ASSIGN_VSCALEX_FUNC(c->yuv2planeX, sse4,
+ if (!isBE(c->dstFormat)) c->yuv2planeX = ff_yuv2planeX_16_sse4,
+ HAVE_ALIGNED_STACK || ARCH_X86_64);
+ if (c->dstBpc == 16 && !isBE(c->dstFormat))
+ c->yuv2plane1 = ff_yuv2plane1_16_sse4;
+ }
+
+ if (EXTERNAL_AVX(cpu_flags)) {
+ ASSIGN_VSCALEX_FUNC(c->yuv2planeX, avx, ,
+ HAVE_ALIGNED_STACK || ARCH_X86_64);
+ ASSIGN_VSCALE_FUNC(c->yuv2plane1, avx, avx, 1);
+
+ switch (c->srcFormat) {
+ case AV_PIX_FMT_YUYV422:
+ c->chrToYV12 = ff_yuyvToUV_avx;
+ break;
+ case AV_PIX_FMT_UYVY422:
+ c->chrToYV12 = ff_uyvyToUV_avx;
+ break;
+ case AV_PIX_FMT_NV12:
+ c->chrToYV12 = ff_nv12ToUV_avx;
+ break;
+ case AV_PIX_FMT_NV21:
+ c->chrToYV12 = ff_nv21ToUV_avx;
+ break;
+ case_rgb(rgb24, RGB24, avx);
+ case_rgb(bgr24, BGR24, avx);
+ case_rgb(bgra, BGRA, avx);
+ case_rgb(rgba, RGBA, avx);
+ case_rgb(abgr, ABGR, avx);
+ case_rgb(argb, ARGB, avx);
+ default:
+ break;
+ }
+ }
+}
diff --git a/gst-libs/ext/libav/libswscale/x86/swscale_mmx.c b/gst-libs/ext/libav/libswscale/x86/swscale_mmx.c
deleted file mode 100644
index f70d719..0000000
--- a/gst-libs/ext/libav/libswscale/x86/swscale_mmx.c
+++ /dev/null
@@ -1,458 +0,0 @@
-/*
- * Copyright (C) 2001-2003 Michael Niedermayer <michaelni@gmx.at>
- *
- * 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
- */
-
-#include <inttypes.h>
-#include "config.h"
-#include "libswscale/swscale.h"
-#include "libswscale/swscale_internal.h"
-#include "libavutil/intreadwrite.h"
-#include "libavutil/x86_cpu.h"
-#include "libavutil/cpu.h"
-#include "libavutil/pixdesc.h"
-
-DECLARE_ASM_CONST(8, uint64_t, bF8)= 0xF8F8F8F8F8F8F8F8LL;
-DECLARE_ASM_CONST(8, uint64_t, bFC)= 0xFCFCFCFCFCFCFCFCLL;
-DECLARE_ASM_CONST(8, uint64_t, w10)= 0x0010001000100010LL;
-DECLARE_ASM_CONST(8, uint64_t, w02)= 0x0002000200020002LL;
-DECLARE_ASM_CONST(8, uint64_t, bm00001111)=0x00000000FFFFFFFFLL;
-DECLARE_ASM_CONST(8, uint64_t, bm00000111)=0x0000000000FFFFFFLL;
-DECLARE_ASM_CONST(8, uint64_t, bm11111000)=0xFFFFFFFFFF000000LL;
-DECLARE_ASM_CONST(8, uint64_t, bm01010101)=0x00FF00FF00FF00FFLL;
-
-const DECLARE_ALIGNED(8, uint64_t, ff_dither4)[2] = {
- 0x0103010301030103LL,
- 0x0200020002000200LL,};
-
-const DECLARE_ALIGNED(8, uint64_t, ff_dither8)[2] = {
- 0x0602060206020602LL,
- 0x0004000400040004LL,};
-
-DECLARE_ASM_CONST(8, uint64_t, b16Mask)= 0x001F001F001F001FLL;
-DECLARE_ASM_CONST(8, uint64_t, g16Mask)= 0x07E007E007E007E0LL;
-DECLARE_ASM_CONST(8, uint64_t, r16Mask)= 0xF800F800F800F800LL;
-DECLARE_ASM_CONST(8, uint64_t, b15Mask)= 0x001F001F001F001FLL;
-DECLARE_ASM_CONST(8, uint64_t, g15Mask)= 0x03E003E003E003E0LL;
-DECLARE_ASM_CONST(8, uint64_t, r15Mask)= 0x7C007C007C007C00LL;
-
-DECLARE_ALIGNED(8, const uint64_t, ff_M24A) = 0x00FF0000FF0000FFLL;
-DECLARE_ALIGNED(8, const uint64_t, ff_M24B) = 0xFF0000FF0000FF00LL;
-DECLARE_ALIGNED(8, const uint64_t, ff_M24C) = 0x0000FF0000FF0000LL;
-
-#ifdef FAST_BGR2YV12
-DECLARE_ALIGNED(8, const uint64_t, ff_bgr2YCoeff) = 0x000000210041000DULL;
-DECLARE_ALIGNED(8, const uint64_t, ff_bgr2UCoeff) = 0x0000FFEEFFDC0038ULL;
-DECLARE_ALIGNED(8, const uint64_t, ff_bgr2VCoeff) = 0x00000038FFD2FFF8ULL;
-#else
-DECLARE_ALIGNED(8, const uint64_t, ff_bgr2YCoeff) = 0x000020E540830C8BULL;
-DECLARE_ALIGNED(8, const uint64_t, ff_bgr2UCoeff) = 0x0000ED0FDAC23831ULL;
-DECLARE_ALIGNED(8, const uint64_t, ff_bgr2VCoeff) = 0x00003831D0E6F6EAULL;
-#endif /* FAST_BGR2YV12 */
-DECLARE_ALIGNED(8, const uint64_t, ff_bgr2YOffset) = 0x1010101010101010ULL;
-DECLARE_ALIGNED(8, const uint64_t, ff_bgr2UVOffset) = 0x8080808080808080ULL;
-DECLARE_ALIGNED(8, const uint64_t, ff_w1111) = 0x0001000100010001ULL;
-
-DECLARE_ASM_CONST(8, uint64_t, ff_bgr24toY1Coeff) = 0x0C88000040870C88ULL;
-DECLARE_ASM_CONST(8, uint64_t, ff_bgr24toY2Coeff) = 0x20DE4087000020DEULL;
-DECLARE_ASM_CONST(8, uint64_t, ff_rgb24toY1Coeff) = 0x20DE0000408720DEULL;
-DECLARE_ASM_CONST(8, uint64_t, ff_rgb24toY2Coeff) = 0x0C88408700000C88ULL;
-DECLARE_ASM_CONST(8, uint64_t, ff_bgr24toYOffset) = 0x0008400000084000ULL;
-
-DECLARE_ASM_CONST(8, uint64_t, ff_bgr24toUV)[2][4] = {
- {0x38380000DAC83838ULL, 0xECFFDAC80000ECFFULL, 0xF6E40000D0E3F6E4ULL, 0x3838D0E300003838ULL},
- {0xECFF0000DAC8ECFFULL, 0x3838DAC800003838ULL, 0x38380000D0E33838ULL, 0xF6E4D0E30000F6E4ULL},
-};
-
-DECLARE_ASM_CONST(8, uint64_t, ff_bgr24toUVOffset)= 0x0040400000404000ULL;
-
-//MMX versions
-#if HAVE_MMX
-#undef RENAME
-#define COMPILE_TEMPLATE_MMX2 0
-#define RENAME(a) a ## _MMX
-#include "swscale_template.c"
-#endif
-
-//MMX2 versions
-#if HAVE_MMX2
-#undef RENAME
-#undef COMPILE_TEMPLATE_MMX2
-#define COMPILE_TEMPLATE_MMX2 1
-#define RENAME(a) a ## _MMX2
-#include "swscale_template.c"
-#endif
-
-void updateMMXDitherTables(SwsContext *c, int dstY, int lumBufIndex, int chrBufIndex,
- int lastInLumBuf, int lastInChrBuf)
-{
- const int dstH= c->dstH;
- const int flags= c->flags;
- int16_t **lumPixBuf= c->lumPixBuf;
- int16_t **chrUPixBuf= c->chrUPixBuf;
- int16_t **alpPixBuf= c->alpPixBuf;
- const int vLumBufSize= c->vLumBufSize;
- const int vChrBufSize= c->vChrBufSize;
- int32_t *vLumFilterPos= c->vLumFilterPos;
- int32_t *vChrFilterPos= c->vChrFilterPos;
- int16_t *vLumFilter= c->vLumFilter;
- int16_t *vChrFilter= c->vChrFilter;
- int32_t *lumMmxFilter= c->lumMmxFilter;
- int32_t *chrMmxFilter= c->chrMmxFilter;
- int32_t av_unused *alpMmxFilter= c->alpMmxFilter;
- const int vLumFilterSize= c->vLumFilterSize;
- const int vChrFilterSize= c->vChrFilterSize;
- const int chrDstY= dstY>>c->chrDstVSubSample;
- const int firstLumSrcY= vLumFilterPos[dstY]; //First line needed as input
- const int firstChrSrcY= vChrFilterPos[chrDstY]; //First line needed as input
-
- c->blueDither= ff_dither8[dstY&1];
- if (c->dstFormat == PIX_FMT_RGB555 || c->dstFormat == PIX_FMT_BGR555)
- c->greenDither= ff_dither8[dstY&1];
- else
- c->greenDither= ff_dither4[dstY&1];
- c->redDither= ff_dither8[(dstY+1)&1];
- if (dstY < dstH - 2) {
- const int16_t **lumSrcPtr= (const int16_t **) lumPixBuf + lumBufIndex + firstLumSrcY - lastInLumBuf + vLumBufSize;
- const int16_t **chrUSrcPtr= (const int16_t **) chrUPixBuf + chrBufIndex + firstChrSrcY - lastInChrBuf + vChrBufSize;
- const int16_t **alpSrcPtr= (CONFIG_SWSCALE_ALPHA && alpPixBuf) ? (const int16_t **) alpPixBuf + lumBufIndex + firstLumSrcY - lastInLumBuf + vLumBufSize : NULL;
- int i;
-
- if (firstLumSrcY < 0 || firstLumSrcY + vLumFilterSize > c->srcH) {
- const int16_t **tmpY = (const int16_t **) lumPixBuf + 2 * vLumBufSize;
- int neg = -firstLumSrcY, i, end = FFMIN(c->srcH - firstLumSrcY, vLumFilterSize);
- for (i = 0; i < neg; i++)
- tmpY[i] = lumSrcPtr[neg];
- for ( ; i < end; i++)
- tmpY[i] = lumSrcPtr[i];
- for ( ; i < vLumFilterSize; i++)
- tmpY[i] = tmpY[i-1];
- lumSrcPtr = tmpY;
-
- if (alpSrcPtr) {
- const int16_t **tmpA = (const int16_t **) alpPixBuf + 2 * vLumBufSize;
- for (i = 0; i < neg; i++)
- tmpA[i] = alpSrcPtr[neg];
- for ( ; i < end; i++)
- tmpA[i] = alpSrcPtr[i];
- for ( ; i < vLumFilterSize; i++)
- tmpA[i] = tmpA[i - 1];
- alpSrcPtr = tmpA;
- }
- }
- if (firstChrSrcY < 0 || firstChrSrcY + vChrFilterSize > c->chrSrcH) {
- const int16_t **tmpU = (const int16_t **) chrUPixBuf + 2 * vChrBufSize;
- int neg = -firstChrSrcY, i, end = FFMIN(c->chrSrcH - firstChrSrcY, vChrFilterSize);
- for (i = 0; i < neg; i++) {
- tmpU[i] = chrUSrcPtr[neg];
- }
- for ( ; i < end; i++) {
- tmpU[i] = chrUSrcPtr[i];
- }
- for ( ; i < vChrFilterSize; i++) {
- tmpU[i] = tmpU[i - 1];
- }
- chrUSrcPtr = tmpU;
- }
-
- if (flags & SWS_ACCURATE_RND) {
- int s= APCK_SIZE / 8;
- for (i=0; i<vLumFilterSize; i+=2) {
- *(const void**)&lumMmxFilter[s*i ]= lumSrcPtr[i ];
- *(const void**)&lumMmxFilter[s*i+APCK_PTR2/4 ]= lumSrcPtr[i+(vLumFilterSize>1)];
- lumMmxFilter[s*i+APCK_COEF/4 ]=
- lumMmxFilter[s*i+APCK_COEF/4+1]= vLumFilter[dstY*vLumFilterSize + i ]
- + (vLumFilterSize>1 ? vLumFilter[dstY*vLumFilterSize + i + 1]<<16 : 0);
- if (CONFIG_SWSCALE_ALPHA && alpPixBuf) {
- *(const void**)&alpMmxFilter[s*i ]= alpSrcPtr[i ];
- *(const void**)&alpMmxFilter[s*i+APCK_PTR2/4 ]= alpSrcPtr[i+(vLumFilterSize>1)];
- alpMmxFilter[s*i+APCK_COEF/4 ]=
- alpMmxFilter[s*i+APCK_COEF/4+1]= lumMmxFilter[s*i+APCK_COEF/4 ];
- }
- }
- for (i=0; i<vChrFilterSize; i+=2) {
- *(const void**)&chrMmxFilter[s*i ]= chrUSrcPtr[i ];
- *(const void**)&chrMmxFilter[s*i+APCK_PTR2/4 ]= chrUSrcPtr[i+(vChrFilterSize>1)];
- chrMmxFilter[s*i+APCK_COEF/4 ]=
- chrMmxFilter[s*i+APCK_COEF/4+1]= vChrFilter[chrDstY*vChrFilterSize + i ]
- + (vChrFilterSize>1 ? vChrFilter[chrDstY*vChrFilterSize + i + 1]<<16 : 0);
- }
- } else {
- for (i=0; i<vLumFilterSize; i++) {
- *(const void**)&lumMmxFilter[4*i+0]= lumSrcPtr[i];
- lumMmxFilter[4*i+2]=
- lumMmxFilter[4*i+3]=
- ((uint16_t)vLumFilter[dstY*vLumFilterSize + i])*0x10001;
- if (CONFIG_SWSCALE_ALPHA && alpPixBuf) {
- *(const void**)&alpMmxFilter[4*i+0]= alpSrcPtr[i];
- alpMmxFilter[4*i+2]=
- alpMmxFilter[4*i+3]= lumMmxFilter[4*i+2];
- }
- }
- for (i=0; i<vChrFilterSize; i++) {
- *(const void**)&chrMmxFilter[4*i+0]= chrUSrcPtr[i];
- chrMmxFilter[4*i+2]=
- chrMmxFilter[4*i+3]=
- ((uint16_t)vChrFilter[chrDstY*vChrFilterSize + i])*0x10001;
- }
- }
- }
-}
-
-#define SCALE_FUNC(filter_n, from_bpc, to_bpc, opt) \
-extern void ff_hscale ## from_bpc ## to ## to_bpc ## _ ## filter_n ## _ ## opt( \
- SwsContext *c, int16_t *data, \
- int dstW, const uint8_t *src, \
- const int16_t *filter, \
- const int32_t *filterPos, int filterSize)
-
-#define SCALE_FUNCS(filter_n, opt) \
- SCALE_FUNC(filter_n, 8, 15, opt); \
- SCALE_FUNC(filter_n, 9, 15, opt); \
- SCALE_FUNC(filter_n, 10, 15, opt); \
- SCALE_FUNC(filter_n, 16, 15, opt); \
- SCALE_FUNC(filter_n, 8, 19, opt); \
- SCALE_FUNC(filter_n, 9, 19, opt); \
- SCALE_FUNC(filter_n, 10, 19, opt); \
- SCALE_FUNC(filter_n, 16, 19, opt)
-
-#define SCALE_FUNCS_MMX(opt) \
- SCALE_FUNCS(4, opt); \
- SCALE_FUNCS(8, opt); \
- SCALE_FUNCS(X, opt)
-
-#define SCALE_FUNCS_SSE(opt) \
- SCALE_FUNCS(4, opt); \
- SCALE_FUNCS(8, opt); \
- SCALE_FUNCS(X4, opt); \
- SCALE_FUNCS(X8, opt)
-
-#if ARCH_X86_32
-SCALE_FUNCS_MMX(mmx);
-#endif
-SCALE_FUNCS_SSE(sse2);
-SCALE_FUNCS_SSE(ssse3);
-SCALE_FUNCS_SSE(sse4);
-
-#define VSCALEX_FUNC(size, opt) \
-extern void ff_yuv2planeX_ ## size ## _ ## opt(const int16_t *filter, int filterSize, \
- const int16_t **src, uint8_t *dest, int dstW, \
- const uint8_t *dither, int offset)
-#define VSCALEX_FUNCS(opt) \
- VSCALEX_FUNC(8, opt); \
- VSCALEX_FUNC(9, opt); \
- VSCALEX_FUNC(10, opt)
-
-#if ARCH_X86_32
-VSCALEX_FUNCS(mmx2);
-#endif
-VSCALEX_FUNCS(sse2);
-VSCALEX_FUNCS(sse4);
-VSCALEX_FUNC(16, sse4);
-VSCALEX_FUNCS(avx);
-
-#define VSCALE_FUNC(size, opt) \
-extern void ff_yuv2plane1_ ## size ## _ ## opt(const int16_t *src, uint8_t *dst, int dstW, \
- const uint8_t *dither, int offset)
-#define VSCALE_FUNCS(opt1, opt2) \
- VSCALE_FUNC(8, opt1); \
- VSCALE_FUNC(9, opt2); \
- VSCALE_FUNC(10, opt2); \
- VSCALE_FUNC(16, opt1)
-
-#if ARCH_X86_32
-VSCALE_FUNCS(mmx, mmx2);
-#endif
-VSCALE_FUNCS(sse2, sse2);
-VSCALE_FUNC(16, sse4);
-VSCALE_FUNCS(avx, avx);
-
-#define INPUT_UV_FUNC(fmt, opt) \
-extern void ff_ ## fmt ## ToUV_ ## opt(uint8_t *dstU, uint8_t *dstV, \
- const uint8_t *src, const uint8_t *unused1, \
- int w, uint32_t *unused2)
-#define INPUT_FUNC(fmt, opt) \
-extern void ff_ ## fmt ## ToY_ ## opt(uint8_t *dst, const uint8_t *src, \
- int w, uint32_t *unused); \
- INPUT_UV_FUNC(fmt, opt)
-#define INPUT_FUNCS(opt) \
- INPUT_FUNC(uyvy, opt); \
- INPUT_FUNC(yuyv, opt); \
- INPUT_UV_FUNC(nv12, opt); \
- INPUT_UV_FUNC(nv21, opt)
-
-#if ARCH_X86_32
-INPUT_FUNCS(mmx);
-#endif
-INPUT_FUNCS(sse2);
-INPUT_FUNCS(avx);
-
-void ff_sws_init_swScale_mmx(SwsContext *c)
-{
- int cpu_flags = av_get_cpu_flags();
-
- if (cpu_flags & AV_CPU_FLAG_MMX)
- sws_init_swScale_MMX(c);
-#if HAVE_MMX2
- if (cpu_flags & AV_CPU_FLAG_MMX2)
- sws_init_swScale_MMX2(c);
-#endif
-
-#if HAVE_YASM
-#define ASSIGN_SCALE_FUNC2(hscalefn, filtersize, opt1, opt2) do { \
- if (c->srcBpc == 8) { \
- hscalefn = c->dstBpc <= 10 ? ff_hscale8to15_ ## filtersize ## _ ## opt2 : \
- ff_hscale8to19_ ## filtersize ## _ ## opt1; \
- } else if (c->srcBpc == 9) { \
- hscalefn = c->dstBpc <= 10 ? ff_hscale9to15_ ## filtersize ## _ ## opt2 : \
- ff_hscale9to19_ ## filtersize ## _ ## opt1; \
- } else if (c->srcBpc == 10) { \
- hscalefn = c->dstBpc <= 10 ? ff_hscale10to15_ ## filtersize ## _ ## opt2 : \
- ff_hscale10to19_ ## filtersize ## _ ## opt1; \
- } else /* c->srcBpc == 16 */ { \
- hscalefn = c->dstBpc <= 10 ? ff_hscale16to15_ ## filtersize ## _ ## opt2 : \
- ff_hscale16to19_ ## filtersize ## _ ## opt1; \
- } \
-} while (0)
-#define ASSIGN_MMX_SCALE_FUNC(hscalefn, filtersize, opt1, opt2) \
- switch (filtersize) { \
- case 4: ASSIGN_SCALE_FUNC2(hscalefn, 4, opt1, opt2); break; \
- case 8: ASSIGN_SCALE_FUNC2(hscalefn, 8, opt1, opt2); break; \
- default: ASSIGN_SCALE_FUNC2(hscalefn, X, opt1, opt2); break; \
- }
-#define ASSIGN_VSCALEX_FUNC(vscalefn, opt, do_16_case) \
-switch(c->dstBpc){ \
- case 16: do_16_case; break; \
- case 10: if (!isBE(c->dstFormat)) vscalefn = ff_yuv2planeX_10_ ## opt; break; \
- case 9: if (!isBE(c->dstFormat)) vscalefn = ff_yuv2planeX_9_ ## opt; break; \
- default: vscalefn = ff_yuv2planeX_8_ ## opt; break; \
- }
-#define ASSIGN_VSCALE_FUNC(vscalefn, opt1, opt2, opt2chk) \
- switch(c->dstBpc){ \
- case 16: if (!isBE(c->dstFormat)) vscalefn = ff_yuv2plane1_16_ ## opt1; break; \
- case 10: if (!isBE(c->dstFormat) && opt2chk) vscalefn = ff_yuv2plane1_10_ ## opt2; break; \
- case 9: if (!isBE(c->dstFormat) && opt2chk) vscalefn = ff_yuv2plane1_9_ ## opt2; break; \
- default: vscalefn = ff_yuv2plane1_8_ ## opt1; break; \
- }
-#if ARCH_X86_32
- if (cpu_flags & AV_CPU_FLAG_MMX) {
- ASSIGN_MMX_SCALE_FUNC(c->hyScale, c->hLumFilterSize, mmx, mmx);
- ASSIGN_MMX_SCALE_FUNC(c->hcScale, c->hChrFilterSize, mmx, mmx);
- ASSIGN_VSCALE_FUNC(c->yuv2plane1, mmx, mmx2, cpu_flags & AV_CPU_FLAG_MMX2);
-
- switch (c->srcFormat) {
- case PIX_FMT_Y400A:
- c->lumToYV12 = ff_yuyvToY_mmx;
- if (c->alpPixBuf)
- c->alpToYV12 = ff_uyvyToY_mmx;
- break;
- case PIX_FMT_YUYV422:
- c->lumToYV12 = ff_yuyvToY_mmx;
- c->chrToYV12 = ff_yuyvToUV_mmx;
- break;
- case PIX_FMT_UYVY422:
- c->lumToYV12 = ff_uyvyToY_mmx;
- c->chrToYV12 = ff_uyvyToUV_mmx;
- break;
- case PIX_FMT_NV12:
- c->chrToYV12 = ff_nv12ToUV_mmx;
- break;
- case PIX_FMT_NV21:
- c->chrToYV12 = ff_nv21ToUV_mmx;
- break;
- default:
- break;
- }
- }
- if (cpu_flags & AV_CPU_FLAG_MMX2) {
- ASSIGN_VSCALEX_FUNC(c->yuv2planeX, mmx2,);
- }
-#endif
-#define ASSIGN_SSE_SCALE_FUNC(hscalefn, filtersize, opt1, opt2) \
- switch (filtersize) { \
- case 4: ASSIGN_SCALE_FUNC2(hscalefn, 4, opt1, opt2); break; \
- case 8: ASSIGN_SCALE_FUNC2(hscalefn, 8, opt1, opt2); break; \
- default: if (filtersize & 4) ASSIGN_SCALE_FUNC2(hscalefn, X4, opt1, opt2); \
- else ASSIGN_SCALE_FUNC2(hscalefn, X8, opt1, opt2); \
- break; \
- }
- if (cpu_flags & AV_CPU_FLAG_SSE2) {
- ASSIGN_SSE_SCALE_FUNC(c->hyScale, c->hLumFilterSize, sse2, sse2);
- ASSIGN_SSE_SCALE_FUNC(c->hcScale, c->hChrFilterSize, sse2, sse2);
- ASSIGN_VSCALEX_FUNC(c->yuv2planeX, sse2,);
- ASSIGN_VSCALE_FUNC(c->yuv2plane1, sse2, sse2, 1);
-
- switch (c->srcFormat) {
- case PIX_FMT_Y400A:
- c->lumToYV12 = ff_yuyvToY_sse2;
- if (c->alpPixBuf)
- c->alpToYV12 = ff_uyvyToY_sse2;
- break;
- case PIX_FMT_YUYV422:
- c->lumToYV12 = ff_yuyvToY_sse2;
- c->chrToYV12 = ff_yuyvToUV_sse2;
- break;
- case PIX_FMT_UYVY422:
- c->lumToYV12 = ff_uyvyToY_sse2;
- c->chrToYV12 = ff_uyvyToUV_sse2;
- break;
- case PIX_FMT_NV12:
- c->chrToYV12 = ff_nv12ToUV_sse2;
- break;
- case PIX_FMT_NV21:
- c->chrToYV12 = ff_nv21ToUV_sse2;
- break;
- }
- }
- if (cpu_flags & AV_CPU_FLAG_SSSE3) {
- ASSIGN_SSE_SCALE_FUNC(c->hyScale, c->hLumFilterSize, ssse3, ssse3);
- ASSIGN_SSE_SCALE_FUNC(c->hcScale, c->hChrFilterSize, ssse3, ssse3);
- }
- if (cpu_flags & AV_CPU_FLAG_SSE4) {
- /* Xto15 don't need special sse4 functions */
- ASSIGN_SSE_SCALE_FUNC(c->hyScale, c->hLumFilterSize, sse4, ssse3);
- ASSIGN_SSE_SCALE_FUNC(c->hcScale, c->hChrFilterSize, sse4, ssse3);
- ASSIGN_VSCALEX_FUNC(c->yuv2planeX, sse4,
- if (!isBE(c->dstFormat)) c->yuv2planeX = ff_yuv2planeX_16_sse4);
- if (c->dstBpc == 16 && !isBE(c->dstFormat))
- c->yuv2plane1 = ff_yuv2plane1_16_sse4;
- }
-
- if (cpu_flags & AV_CPU_FLAG_AVX) {
- ASSIGN_VSCALEX_FUNC(c->yuv2planeX, avx,);
- ASSIGN_VSCALE_FUNC(c->yuv2plane1, avx, avx, 1);
-
- switch (c->srcFormat) {
- case PIX_FMT_YUYV422:
- c->chrToYV12 = ff_yuyvToUV_avx;
- break;
- case PIX_FMT_UYVY422:
- c->chrToYV12 = ff_uyvyToUV_avx;
- break;
- case PIX_FMT_NV12:
- c->chrToYV12 = ff_nv12ToUV_avx;
- break;
- case PIX_FMT_NV21:
- c->chrToYV12 = ff_nv21ToUV_avx;
- break;
- default:
- break;
- }
- }
-#endif
-}
diff --git a/gst-libs/ext/libav/libswscale/x86/swscale_template.c b/gst-libs/ext/libav/libswscale/x86/swscale_template.c
index 40188d8..d89a26f 100644
--- a/gst-libs/ext/libav/libswscale/x86/swscale_template.c
+++ b/gst-libs/ext/libav/libswscale/x86/swscale_template.c
@@ -22,13 +22,13 @@
#undef MOVNTQ
#undef PREFETCH
-#if COMPILE_TEMPLATE_MMX2
+#if COMPILE_TEMPLATE_MMXEXT
#define PREFETCH "prefetchnta"
#else
#define PREFETCH " # nop"
#endif
-#if COMPILE_TEMPLATE_MMX2
+#if COMPILE_TEMPLATE_MMXEXT
#define REAL_MOVNTQ(a,b) "movntq " #a ", " #b " \n\t"
#else
#define REAL_MOVNTQ(a,b) "movq " #a ", " #b " \n\t"
@@ -519,7 +519,7 @@ static void RENAME(yuv2rgb555_X)(SwsContext *c, const int16_t *lumFilter,
"cmp "#dstw", "#index" \n\t"\
" jb 1b \n\t"
-#define WRITEBGR24MMX2(dst, dstw, index) \
+#define WRITEBGR24MMXEXT(dst, dstw, index) \
/* mm2=B, %%mm4=G, %%mm5=R, %%mm7=0 */\
"movq "MANGLE(ff_M24A)", %%mm0 \n\t"\
"movq "MANGLE(ff_M24C)", %%mm7 \n\t"\
@@ -567,9 +567,9 @@ static void RENAME(yuv2rgb555_X)(SwsContext *c, const int16_t *lumFilter,
"cmp "#dstw", "#index" \n\t"\
" jb 1b \n\t"
-#if COMPILE_TEMPLATE_MMX2
+#if COMPILE_TEMPLATE_MMXEXT
#undef WRITEBGR24
-#define WRITEBGR24(dst, dstw, index) WRITEBGR24MMX2(dst, dstw, index)
+#define WRITEBGR24(dst, dstw, index) WRITEBGR24MMXEXT(dst, dstw, index)
#else
#undef WRITEBGR24
#define WRITEBGR24(dst, dstw, index) WRITEBGR24MMX(dst, dstw, index)
@@ -1088,14 +1088,15 @@ static void RENAME(yuv2yuyv422_2)(SwsContext *c, const int16_t *buf[2],
* YV12 to RGB without scaling or interpolating
*/
static void RENAME(yuv2rgb32_1)(SwsContext *c, const int16_t *buf0,
- const int16_t *ubuf[2], const int16_t *bguf[2],
+ const int16_t *ubuf[2], const int16_t *vbuf[2],
const int16_t *abuf0, uint8_t *dest,
int dstW, int uvalpha, int y)
{
- const int16_t *ubuf0 = ubuf[0], *ubuf1 = ubuf[1];
+ const int16_t *ubuf0 = ubuf[0];
const int16_t *buf1= buf0; //FIXME needed for RGB1/BGR1
if (uvalpha < 2048) { // note this is not correct (shifts chrominance by 0.5 pixels) but it is a bit faster
+ const int16_t *ubuf1 = ubuf[0];
if (CONFIG_SWSCALE_ALPHA && c->alpPixBuf) {
__asm__ volatile(
"mov %%"REG_b", "ESP_OFFSET"(%5) \n\t"
@@ -1124,6 +1125,7 @@ static void RENAME(yuv2rgb32_1)(SwsContext *c, const int16_t *buf0,
);
}
} else {
+ const int16_t *ubuf1 = ubuf[1];
if (CONFIG_SWSCALE_ALPHA && c->alpPixBuf) {
__asm__ volatile(
"mov %%"REG_b", "ESP_OFFSET"(%5) \n\t"
@@ -1155,14 +1157,15 @@ static void RENAME(yuv2rgb32_1)(SwsContext *c, const int16_t *buf0,
}
static void RENAME(yuv2bgr24_1)(SwsContext *c, const int16_t *buf0,
- const int16_t *ubuf[2], const int16_t *bguf[2],
+ const int16_t *ubuf[2], const int16_t *vbuf[2],
const int16_t *abuf0, uint8_t *dest,
int dstW, int uvalpha, int y)
{
- const int16_t *ubuf0 = ubuf[0], *ubuf1 = ubuf[1];
+ const int16_t *ubuf0 = ubuf[0];
const int16_t *buf1= buf0; //FIXME needed for RGB1/BGR1
if (uvalpha < 2048) { // note this is not correct (shifts chrominance by 0.5 pixels) but it is a bit faster
+ const int16_t *ubuf1 = ubuf[0];
__asm__ volatile(
"mov %%"REG_b", "ESP_OFFSET"(%5) \n\t"
"mov %4, %%"REG_b" \n\t"
@@ -1176,6 +1179,7 @@ static void RENAME(yuv2bgr24_1)(SwsContext *c, const int16_t *buf0,
"a" (&c->redDither)
);
} else {
+ const int16_t *ubuf1 = ubuf[1];
__asm__ volatile(
"mov %%"REG_b", "ESP_OFFSET"(%5) \n\t"
"mov %4, %%"REG_b" \n\t"
@@ -1192,14 +1196,15 @@ static void RENAME(yuv2bgr24_1)(SwsContext *c, const int16_t *buf0,
}
static void RENAME(yuv2rgb555_1)(SwsContext *c, const int16_t *buf0,
- const int16_t *ubuf[2], const int16_t *bguf[2],
+ const int16_t *ubuf[2], const int16_t *vbuf[2],
const int16_t *abuf0, uint8_t *dest,
int dstW, int uvalpha, int y)
{
- const int16_t *ubuf0 = ubuf[0], *ubuf1 = ubuf[1];
+ const int16_t *ubuf0 = ubuf[0];
const int16_t *buf1= buf0; //FIXME needed for RGB1/BGR1
if (uvalpha < 2048) { // note this is not correct (shifts chrominance by 0.5 pixels) but it is a bit faster
+ const int16_t *ubuf1 = ubuf[0];
__asm__ volatile(
"mov %%"REG_b", "ESP_OFFSET"(%5) \n\t"
"mov %4, %%"REG_b" \n\t"
@@ -1219,6 +1224,7 @@ static void RENAME(yuv2rgb555_1)(SwsContext *c, const int16_t *buf0,
"a" (&c->redDither)
);
} else {
+ const int16_t *ubuf1 = ubuf[1];
__asm__ volatile(
"mov %%"REG_b", "ESP_OFFSET"(%5) \n\t"
"mov %4, %%"REG_b" \n\t"
@@ -1241,14 +1247,15 @@ static void RENAME(yuv2rgb555_1)(SwsContext *c, const int16_t *buf0,
}
static void RENAME(yuv2rgb565_1)(SwsContext *c, const int16_t *buf0,
- const int16_t *ubuf[2], const int16_t *bguf[2],
+ const int16_t *ubuf[2], const int16_t *vbuf[2],
const int16_t *abuf0, uint8_t *dest,
int dstW, int uvalpha, int y)
{
- const int16_t *ubuf0 = ubuf[0], *ubuf1 = ubuf[1];
+ const int16_t *ubuf0 = ubuf[0];
const int16_t *buf1= buf0; //FIXME needed for RGB1/BGR1
if (uvalpha < 2048) { // note this is not correct (shifts chrominance by 0.5 pixels) but it is a bit faster
+ const int16_t *ubuf1 = ubuf[0];
__asm__ volatile(
"mov %%"REG_b", "ESP_OFFSET"(%5) \n\t"
"mov %4, %%"REG_b" \n\t"
@@ -1268,6 +1275,7 @@ static void RENAME(yuv2rgb565_1)(SwsContext *c, const int16_t *buf0,
"a" (&c->redDither)
);
} else {
+ const int16_t *ubuf1 = ubuf[1];
__asm__ volatile(
"mov %%"REG_b", "ESP_OFFSET"(%5) \n\t"
"mov %4, %%"REG_b" \n\t"
@@ -1327,14 +1335,15 @@ static void RENAME(yuv2rgb565_1)(SwsContext *c, const int16_t *buf0,
#define YSCALEYUV2PACKED1b(index, c) REAL_YSCALEYUV2PACKED1b(index, c)
static void RENAME(yuv2yuyv422_1)(SwsContext *c, const int16_t *buf0,
- const int16_t *ubuf[2], const int16_t *bguf[2],
+ const int16_t *ubuf[2], const int16_t *vbuf[2],
const int16_t *abuf0, uint8_t *dest,
int dstW, int uvalpha, int y)
{
- const int16_t *ubuf0 = ubuf[0], *ubuf1 = ubuf[1];
+ const int16_t *ubuf0 = ubuf[0];
const int16_t *buf1= buf0; //FIXME needed for RGB1/BGR1
if (uvalpha < 2048) { // note this is not correct (shifts chrominance by 0.5 pixels) but it is a bit faster
+ const int16_t *ubuf1 = ubuf[0];
__asm__ volatile(
"mov %%"REG_b", "ESP_OFFSET"(%5) \n\t"
"mov %4, %%"REG_b" \n\t"
@@ -1347,6 +1356,7 @@ static void RENAME(yuv2yuyv422_1)(SwsContext *c, const int16_t *buf0,
"a" (&c->redDither)
);
} else {
+ const int16_t *ubuf1 = ubuf[1];
__asm__ volatile(
"mov %%"REG_b", "ESP_OFFSET"(%5) \n\t"
"mov %4, %%"REG_b" \n\t"
@@ -1361,156 +1371,14 @@ static void RENAME(yuv2yuyv422_1)(SwsContext *c, const int16_t *buf0,
}
}
-static av_always_inline void RENAME(bgr24ToY_mmx)(uint8_t *dst, const uint8_t *src,
- int width, enum PixelFormat srcFormat)
-{
-
- if(srcFormat == PIX_FMT_BGR24) {
- __asm__ volatile(
- "movq "MANGLE(ff_bgr24toY1Coeff)", %%mm5 \n\t"
- "movq "MANGLE(ff_bgr24toY2Coeff)", %%mm6 \n\t"
- :
- );
- } else {
- __asm__ volatile(
- "movq "MANGLE(ff_rgb24toY1Coeff)", %%mm5 \n\t"
- "movq "MANGLE(ff_rgb24toY2Coeff)", %%mm6 \n\t"
- :
- );
- }
-
- __asm__ volatile(
- "movq "MANGLE(ff_bgr24toYOffset)", %%mm4 \n\t"
- "mov %2, %%"REG_a" \n\t"
- "pxor %%mm7, %%mm7 \n\t"
- "1: \n\t"
- PREFETCH" 64(%0) \n\t"
- "movd (%0), %%mm0 \n\t"
- "movd 2(%0), %%mm1 \n\t"
- "movd 6(%0), %%mm2 \n\t"
- "movd 8(%0), %%mm3 \n\t"
- "add $12, %0 \n\t"
- "punpcklbw %%mm7, %%mm0 \n\t"
- "punpcklbw %%mm7, %%mm1 \n\t"
- "punpcklbw %%mm7, %%mm2 \n\t"
- "punpcklbw %%mm7, %%mm3 \n\t"
- "pmaddwd %%mm5, %%mm0 \n\t"
- "pmaddwd %%mm6, %%mm1 \n\t"
- "pmaddwd %%mm5, %%mm2 \n\t"
- "pmaddwd %%mm6, %%mm3 \n\t"
- "paddd %%mm1, %%mm0 \n\t"
- "paddd %%mm3, %%mm2 \n\t"
- "paddd %%mm4, %%mm0 \n\t"
- "paddd %%mm4, %%mm2 \n\t"
- "psrad $15, %%mm0 \n\t"
- "psrad $15, %%mm2 \n\t"
- "packssdw %%mm2, %%mm0 \n\t"
- "packuswb %%mm0, %%mm0 \n\t"
- "movd %%mm0, (%1, %%"REG_a") \n\t"
- "add $4, %%"REG_a" \n\t"
- " js 1b \n\t"
- : "+r" (src)
- : "r" (dst+width), "g" ((x86_reg)-width)
- : "%"REG_a
- );
-}
-
-static void RENAME(bgr24ToY)(uint8_t *dst, const uint8_t *src,
- int width, uint32_t *unused)
-{
- RENAME(bgr24ToY_mmx)(dst, src, width, PIX_FMT_BGR24);
-}
-
-static void RENAME(rgb24ToY)(uint8_t *dst, const uint8_t *src,
- int width, uint32_t *unused)
-{
- RENAME(bgr24ToY_mmx)(dst, src, width, PIX_FMT_RGB24);
-}
-
-static av_always_inline void RENAME(bgr24ToUV_mmx)(uint8_t *dstU, uint8_t *dstV,
- const uint8_t *src, int width,
- enum PixelFormat srcFormat)
-{
- __asm__ volatile(
- "movq 24(%4), %%mm6 \n\t"
- "mov %3, %%"REG_a" \n\t"
- "pxor %%mm7, %%mm7 \n\t"
- "1: \n\t"
- PREFETCH" 64(%0) \n\t"
- "movd (%0), %%mm0 \n\t"
- "movd 2(%0), %%mm1 \n\t"
- "punpcklbw %%mm7, %%mm0 \n\t"
- "punpcklbw %%mm7, %%mm1 \n\t"
- "movq %%mm0, %%mm2 \n\t"
- "movq %%mm1, %%mm3 \n\t"
- "pmaddwd (%4), %%mm0 \n\t"
- "pmaddwd 8(%4), %%mm1 \n\t"
- "pmaddwd 16(%4), %%mm2 \n\t"
- "pmaddwd %%mm6, %%mm3 \n\t"
- "paddd %%mm1, %%mm0 \n\t"
- "paddd %%mm3, %%mm2 \n\t"
-
- "movd 6(%0), %%mm1 \n\t"
- "movd 8(%0), %%mm3 \n\t"
- "add $12, %0 \n\t"
- "punpcklbw %%mm7, %%mm1 \n\t"
- "punpcklbw %%mm7, %%mm3 \n\t"
- "movq %%mm1, %%mm4 \n\t"
- "movq %%mm3, %%mm5 \n\t"
- "pmaddwd (%4), %%mm1 \n\t"
- "pmaddwd 8(%4), %%mm3 \n\t"
- "pmaddwd 16(%4), %%mm4 \n\t"
- "pmaddwd %%mm6, %%mm5 \n\t"
- "paddd %%mm3, %%mm1 \n\t"
- "paddd %%mm5, %%mm4 \n\t"
-
- "movq "MANGLE(ff_bgr24toUVOffset)", %%mm3 \n\t"
- "paddd %%mm3, %%mm0 \n\t"
- "paddd %%mm3, %%mm2 \n\t"
- "paddd %%mm3, %%mm1 \n\t"
- "paddd %%mm3, %%mm4 \n\t"
- "psrad $15, %%mm0 \n\t"
- "psrad $15, %%mm2 \n\t"
- "psrad $15, %%mm1 \n\t"
- "psrad $15, %%mm4 \n\t"
- "packssdw %%mm1, %%mm0 \n\t"
- "packssdw %%mm4, %%mm2 \n\t"
- "packuswb %%mm0, %%mm0 \n\t"
- "packuswb %%mm2, %%mm2 \n\t"
- "movd %%mm0, (%1, %%"REG_a") \n\t"
- "movd %%mm2, (%2, %%"REG_a") \n\t"
- "add $4, %%"REG_a" \n\t"
- " js 1b \n\t"
- : "+r" (src)
- : "r" (dstU+width), "r" (dstV+width), "g" ((x86_reg)-width), "r"(ff_bgr24toUV[srcFormat == PIX_FMT_RGB24])
- : "%"REG_a
- );
-}
-
-static void RENAME(bgr24ToUV)(uint8_t *dstU, uint8_t *dstV,
- const uint8_t *src1, const uint8_t *src2,
- int width, uint32_t *unused)
-{
- RENAME(bgr24ToUV_mmx)(dstU, dstV, src1, width, PIX_FMT_BGR24);
- assert(src1 == src2);
-}
-
-static void RENAME(rgb24ToUV)(uint8_t *dstU, uint8_t *dstV,
- const uint8_t *src1, const uint8_t *src2,
- int width, uint32_t *unused)
-{
- assert(src1==src2);
- RENAME(bgr24ToUV_mmx)(dstU, dstV, src1, width, PIX_FMT_RGB24);
-}
-
-#if COMPILE_TEMPLATE_MMX2
+#if COMPILE_TEMPLATE_MMXEXT
static void RENAME(hyscale_fast)(SwsContext *c, int16_t *dst,
int dstWidth, const uint8_t *src,
int srcW, int xInc)
{
int32_t *filterPos = c->hLumFilterPos;
int16_t *filter = c->hLumFilter;
- void *mmx2FilterCode= c->lumMmx2FilterCode;
+ void *mmxextFilterCode = c->lumMmxextFilterCode;
int i;
#if defined(PIC)
uint64_t ebxsave;
@@ -1543,7 +1411,7 @@ static void RENAME(hyscale_fast)(SwsContext *c, int16_t *dst,
PREFETCH" 64(%%"REG_c") \n\t"
#if ARCH_X86_64
-#define CALL_MMX2_FILTER_CODE \
+#define CALL_MMXEXT_FILTER_CODE \
"movl (%%"REG_b"), %%esi \n\t"\
"call *%4 \n\t"\
"movl (%%"REG_b", %%"REG_a"), %%esi \n\t"\
@@ -1552,7 +1420,7 @@ static void RENAME(hyscale_fast)(SwsContext *c, int16_t *dst,
"xor %%"REG_a", %%"REG_a" \n\t"\
#else
-#define CALL_MMX2_FILTER_CODE \
+#define CALL_MMXEXT_FILTER_CODE \
"movl (%%"REG_b"), %%esi \n\t"\
"call *%4 \n\t"\
"addl (%%"REG_b", %%"REG_a"), %%"REG_c" \n\t"\
@@ -1561,14 +1429,14 @@ static void RENAME(hyscale_fast)(SwsContext *c, int16_t *dst,
#endif /* ARCH_X86_64 */
- CALL_MMX2_FILTER_CODE
- CALL_MMX2_FILTER_CODE
- CALL_MMX2_FILTER_CODE
- CALL_MMX2_FILTER_CODE
- CALL_MMX2_FILTER_CODE
- CALL_MMX2_FILTER_CODE
- CALL_MMX2_FILTER_CODE
- CALL_MMX2_FILTER_CODE
+ CALL_MMXEXT_FILTER_CODE
+ CALL_MMXEXT_FILTER_CODE
+ CALL_MMXEXT_FILTER_CODE
+ CALL_MMXEXT_FILTER_CODE
+ CALL_MMXEXT_FILTER_CODE
+ CALL_MMXEXT_FILTER_CODE
+ CALL_MMXEXT_FILTER_CODE
+ CALL_MMXEXT_FILTER_CODE
#if defined(PIC)
"mov %5, %%"REG_b" \n\t"
@@ -1583,7 +1451,7 @@ static void RENAME(hyscale_fast)(SwsContext *c, int16_t *dst,
#endif
#endif
:: "m" (src), "m" (dst), "m" (filter), "m" (filterPos),
- "m" (mmx2FilterCode)
+ "m" (mmxextFilterCode)
#if defined(PIC)
,"m" (ebxsave)
#endif
@@ -1606,7 +1474,7 @@ static void RENAME(hcscale_fast)(SwsContext *c, int16_t *dst1, int16_t *dst2,
{
int32_t *filterPos = c->hChrFilterPos;
int16_t *filter = c->hChrFilter;
- void *mmx2FilterCode= c->chrMmx2FilterCode;
+ void *mmxextFilterCode = c->chrMmxextFilterCode;
int i;
#if defined(PIC)
DECLARE_ALIGNED(8, uint64_t, ebxsave);
@@ -1638,10 +1506,10 @@ static void RENAME(hcscale_fast)(SwsContext *c, int16_t *dst1, int16_t *dst2,
PREFETCH" 32(%%"REG_c") \n\t"
PREFETCH" 64(%%"REG_c") \n\t"
- CALL_MMX2_FILTER_CODE
- CALL_MMX2_FILTER_CODE
- CALL_MMX2_FILTER_CODE
- CALL_MMX2_FILTER_CODE
+ CALL_MMXEXT_FILTER_CODE
+ CALL_MMXEXT_FILTER_CODE
+ CALL_MMXEXT_FILTER_CODE
+ CALL_MMXEXT_FILTER_CODE
"xor %%"REG_a", %%"REG_a" \n\t" // i
"mov %5, %%"REG_c" \n\t" // src
"mov %6, %%"REG_D" \n\t" // buf2
@@ -1649,10 +1517,10 @@ static void RENAME(hcscale_fast)(SwsContext *c, int16_t *dst1, int16_t *dst2,
PREFETCH" 32(%%"REG_c") \n\t"
PREFETCH" 64(%%"REG_c") \n\t"
- CALL_MMX2_FILTER_CODE
- CALL_MMX2_FILTER_CODE
- CALL_MMX2_FILTER_CODE
- CALL_MMX2_FILTER_CODE
+ CALL_MMXEXT_FILTER_CODE
+ CALL_MMXEXT_FILTER_CODE
+ CALL_MMXEXT_FILTER_CODE
+ CALL_MMXEXT_FILTER_CODE
#if defined(PIC)
"mov %7, %%"REG_b" \n\t"
@@ -1667,7 +1535,7 @@ static void RENAME(hcscale_fast)(SwsContext *c, int16_t *dst1, int16_t *dst2,
#endif
#endif
:: "m" (src1), "m" (dst1), "m" (filter), "m" (filterPos),
- "m" (mmx2FilterCode), "m" (src2), "m"(dst2)
+ "m" (mmxextFilterCode), "m" (src2), "m"(dst2)
#if defined(PIC)
,"m" (ebxsave)
#endif
@@ -1685,35 +1553,34 @@ static void RENAME(hcscale_fast)(SwsContext *c, int16_t *dst1, int16_t *dst2,
dst2[i] = src2[srcW-1]*128;
}
}
-#endif /* COMPILE_TEMPLATE_MMX2 */
+#endif /* COMPILE_TEMPLATE_MMXEXT */
static av_cold void RENAME(sws_init_swScale)(SwsContext *c)
{
- enum PixelFormat srcFormat = c->srcFormat,
- dstFormat = c->dstFormat;
+ enum AVPixelFormat dstFormat = c->dstFormat;
if (!is16BPS(dstFormat) && !is9_OR_10BPS(dstFormat) &&
- dstFormat != PIX_FMT_NV12 && dstFormat != PIX_FMT_NV21) {
+ dstFormat != AV_PIX_FMT_NV12 && dstFormat != AV_PIX_FMT_NV21) {
if (!(c->flags & SWS_BITEXACT)) {
if (c->flags & SWS_ACCURATE_RND) {
if (!(c->flags & SWS_FULL_CHR_H_INT)) {
switch (c->dstFormat) {
- case PIX_FMT_RGB32: c->yuv2packedX = RENAME(yuv2rgb32_X_ar); break;
- case PIX_FMT_BGR24: c->yuv2packedX = RENAME(yuv2bgr24_X_ar); break;
- case PIX_FMT_RGB555: c->yuv2packedX = RENAME(yuv2rgb555_X_ar); break;
- case PIX_FMT_RGB565: c->yuv2packedX = RENAME(yuv2rgb565_X_ar); break;
- case PIX_FMT_YUYV422: c->yuv2packedX = RENAME(yuv2yuyv422_X_ar); break;
+ case AV_PIX_FMT_RGB32: c->yuv2packedX = RENAME(yuv2rgb32_X_ar); break;
+ case AV_PIX_FMT_BGR24: c->yuv2packedX = RENAME(yuv2bgr24_X_ar); break;
+ case AV_PIX_FMT_RGB555: c->yuv2packedX = RENAME(yuv2rgb555_X_ar); break;
+ case AV_PIX_FMT_RGB565: c->yuv2packedX = RENAME(yuv2rgb565_X_ar); break;
+ case AV_PIX_FMT_YUYV422: c->yuv2packedX = RENAME(yuv2yuyv422_X_ar); break;
default: break;
}
}
} else {
if (!(c->flags & SWS_FULL_CHR_H_INT)) {
switch (c->dstFormat) {
- case PIX_FMT_RGB32: c->yuv2packedX = RENAME(yuv2rgb32_X); break;
- case PIX_FMT_BGR24: c->yuv2packedX = RENAME(yuv2bgr24_X); break;
- case PIX_FMT_RGB555: c->yuv2packedX = RENAME(yuv2rgb555_X); break;
- case PIX_FMT_RGB565: c->yuv2packedX = RENAME(yuv2rgb565_X); break;
- case PIX_FMT_YUYV422: c->yuv2packedX = RENAME(yuv2yuyv422_X); break;
+ case AV_PIX_FMT_RGB32: c->yuv2packedX = RENAME(yuv2rgb32_X); break;
+ case AV_PIX_FMT_BGR24: c->yuv2packedX = RENAME(yuv2bgr24_X); break;
+ case AV_PIX_FMT_RGB555: c->yuv2packedX = RENAME(yuv2rgb555_X); break;
+ case AV_PIX_FMT_RGB565: c->yuv2packedX = RENAME(yuv2rgb565_X); break;
+ case AV_PIX_FMT_YUYV422: c->yuv2packedX = RENAME(yuv2yuyv422_X); break;
default: break;
}
}
@@ -1721,23 +1588,23 @@ static av_cold void RENAME(sws_init_swScale)(SwsContext *c)
}
if (!(c->flags & SWS_FULL_CHR_H_INT)) {
switch (c->dstFormat) {
- case PIX_FMT_RGB32:
+ case AV_PIX_FMT_RGB32:
c->yuv2packed1 = RENAME(yuv2rgb32_1);
c->yuv2packed2 = RENAME(yuv2rgb32_2);
break;
- case PIX_FMT_BGR24:
+ case AV_PIX_FMT_BGR24:
c->yuv2packed1 = RENAME(yuv2bgr24_1);
c->yuv2packed2 = RENAME(yuv2bgr24_2);
break;
- case PIX_FMT_RGB555:
+ case AV_PIX_FMT_RGB555:
c->yuv2packed1 = RENAME(yuv2rgb555_1);
c->yuv2packed2 = RENAME(yuv2rgb555_2);
break;
- case PIX_FMT_RGB565:
+ case AV_PIX_FMT_RGB565:
c->yuv2packed1 = RENAME(yuv2rgb565_1);
c->yuv2packed2 = RENAME(yuv2rgb565_2);
break;
- case PIX_FMT_YUYV422:
+ case AV_PIX_FMT_YUYV422:
c->yuv2packed1 = RENAME(yuv2yuyv422_1);
c->yuv2packed2 = RENAME(yuv2yuyv422_2);
break;
@@ -1748,32 +1615,17 @@ static av_cold void RENAME(sws_init_swScale)(SwsContext *c)
}
if (c->srcBpc == 8 && c->dstBpc <= 10) {
- // Use the new MMX scaler if the MMX2 one can't be used (it is faster than the x86 ASM one).
-#if COMPILE_TEMPLATE_MMX2
- if (c->flags & SWS_FAST_BILINEAR && c->canMMX2BeUsed)
- {
+ // Use the new MMX scaler if the MMXEXT one can't be used (it is faster than the x86 ASM one).
+#if COMPILE_TEMPLATE_MMXEXT
+ if (c->flags & SWS_FAST_BILINEAR && c->canMMXEXTBeUsed) {
c->hyscale_fast = RENAME(hyscale_fast);
c->hcscale_fast = RENAME(hcscale_fast);
} else {
-#endif /* COMPILE_TEMPLATE_MMX2 */
+#endif /* COMPILE_TEMPLATE_MMXEXT */
c->hyscale_fast = NULL;
c->hcscale_fast = NULL;
-#if COMPILE_TEMPLATE_MMX2
+#if COMPILE_TEMPLATE_MMXEXT
}
-#endif /* COMPILE_TEMPLATE_MMX2 */
- }
-
- if (!c->chrSrcHSubSample) {
- switch(srcFormat) {
- case PIX_FMT_BGR24 : c->chrToYV12 = RENAME(bgr24ToUV); break;
- case PIX_FMT_RGB24 : c->chrToYV12 = RENAME(rgb24ToUV); break;
- default: break;
- }
- }
-
- switch (srcFormat) {
- case PIX_FMT_BGR24 : c->lumToYV12 = RENAME(bgr24ToY); break;
- case PIX_FMT_RGB24 : c->lumToYV12 = RENAME(rgb24ToY); break;
- default: break;
+#endif /* COMPILE_TEMPLATE_MMXEXT */
}
}
diff --git a/gst-libs/ext/libav/libswscale/x86/w64xmmtest.c b/gst-libs/ext/libav/libswscale/x86/w64xmmtest.c
new file mode 100644
index 0000000..dd9a2a4
--- /dev/null
+++ b/gst-libs/ext/libav/libswscale/x86/w64xmmtest.c
@@ -0,0 +1,31 @@
+/*
+ * check XMM registers for clobbers on Win64
+ * Copyright (c) 2012 Ronald S. Bultje <rsbultje@gmail.com>
+ *
+ * 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
+ */
+
+#include "libavutil/x86/w64xmmtest.h"
+#include "libswscale/swscale.h"
+
+wrap(sws_scale(struct SwsContext *c, const uint8_t *const srcSlice[],
+ const int srcStride[], int srcSliceY, int srcSliceH,
+ uint8_t *const dst[], const int dstStride[]))
+{
+ testxmmclobbers(sws_scale, c, srcSlice, srcStride, srcSliceY,
+ srcSliceH, dst, dstStride);
+}
diff --git a/gst-libs/ext/libav/libswscale/x86/yuv2rgb.c b/gst-libs/ext/libav/libswscale/x86/yuv2rgb.c
new file mode 100644
index 0000000..419d513
--- /dev/null
+++ b/gst-libs/ext/libav/libswscale/x86/yuv2rgb.c
@@ -0,0 +1,117 @@
+/*
+ * software YUV to RGB converter
+ *
+ * Copyright (C) 2009 Konstantin Shishkov
+ *
+ * MMX/MMXEXT template stuff (needed for fast movntq support),
+ * 1,4,8bpp support and context / deglobalize stuff
+ * by Michael Niedermayer (michaelni@gmx.at)
+ *
+ * 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
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <inttypes.h>
+#include <assert.h>
+
+#include "config.h"
+#include "libswscale/rgb2rgb.h"
+#include "libswscale/swscale.h"
+#include "libswscale/swscale_internal.h"
+#include "libavutil/attributes.h"
+#include "libavutil/x86/asm.h"
+#include "libavutil/cpu.h"
+
+#if HAVE_INLINE_ASM
+
+#define DITHER1XBPP // only for MMX
+
+/* hope these constant values are cache line aligned */
+DECLARE_ASM_CONST(8, uint64_t, mmx_00ffw) = 0x00ff00ff00ff00ffULL;
+DECLARE_ASM_CONST(8, uint64_t, mmx_redmask) = 0xf8f8f8f8f8f8f8f8ULL;
+DECLARE_ASM_CONST(8, uint64_t, mmx_grnmask) = 0xfcfcfcfcfcfcfcfcULL;
+DECLARE_ASM_CONST(8, uint64_t, pb_e0) = 0xe0e0e0e0e0e0e0e0ULL;
+DECLARE_ASM_CONST(8, uint64_t, pb_03) = 0x0303030303030303ULL;
+DECLARE_ASM_CONST(8, uint64_t, pb_07) = 0x0707070707070707ULL;
+
+//MMX versions
+#if HAVE_MMX_INLINE
+#undef RENAME
+#undef COMPILE_TEMPLATE_MMXEXT
+#define COMPILE_TEMPLATE_MMXEXT 0
+#define RENAME(a) a ## _MMX
+#include "yuv2rgb_template.c"
+#endif /* HAVE_MMX_INLINE */
+
+// MMXEXT versions
+#if HAVE_MMXEXT_INLINE
+#undef RENAME
+#undef COMPILE_TEMPLATE_MMXEXT
+#define COMPILE_TEMPLATE_MMXEXT 1
+#define RENAME(a) a ## _MMXEXT
+#include "yuv2rgb_template.c"
+#endif /* HAVE_MMXEXT_INLINE */
+
+#endif /* HAVE_INLINE_ASM */
+
+av_cold SwsFunc ff_yuv2rgb_init_mmx(SwsContext *c)
+{
+#if HAVE_INLINE_ASM
+ int cpu_flags = av_get_cpu_flags();
+
+ if (c->srcFormat != AV_PIX_FMT_YUV420P &&
+ c->srcFormat != AV_PIX_FMT_YUVA420P)
+ return NULL;
+
+#if HAVE_MMXEXT_INLINE
+ if (cpu_flags & AV_CPU_FLAG_MMXEXT) {
+ switch (c->dstFormat) {
+ case AV_PIX_FMT_RGB24:
+ return yuv420_rgb24_MMXEXT;
+ case AV_PIX_FMT_BGR24:
+ return yuv420_bgr24_MMXEXT;
+ }
+ }
+#endif
+
+ if (cpu_flags & AV_CPU_FLAG_MMX) {
+ switch (c->dstFormat) {
+ case AV_PIX_FMT_RGB32:
+ if (c->srcFormat == AV_PIX_FMT_YUVA420P) {
+#if HAVE_7REGS && CONFIG_SWSCALE_ALPHA
+ return yuva420_rgb32_MMX;
+#endif
+ break;
+ } else return yuv420_rgb32_MMX;
+ case AV_PIX_FMT_BGR32:
+ if (c->srcFormat == AV_PIX_FMT_YUVA420P) {
+#if HAVE_7REGS && CONFIG_SWSCALE_ALPHA
+ return yuva420_bgr32_MMX;
+#endif
+ break;
+ } else return yuv420_bgr32_MMX;
+ case AV_PIX_FMT_RGB24: return yuv420_rgb24_MMX;
+ case AV_PIX_FMT_BGR24: return yuv420_bgr24_MMX;
+ case AV_PIX_FMT_RGB565: return yuv420_rgb16_MMX;
+ case AV_PIX_FMT_RGB555: return yuv420_rgb15_MMX;
+ }
+ }
+#endif /* HAVE_INLINE_ASM */
+
+ return NULL;
+}
diff --git a/gst-libs/ext/libav/libswscale/x86/yuv2rgb_mmx.c b/gst-libs/ext/libav/libswscale/x86/yuv2rgb_mmx.c
deleted file mode 100644
index 0eaea77..0000000
--- a/gst-libs/ext/libav/libswscale/x86/yuv2rgb_mmx.c
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * software YUV to RGB converter
- *
- * Copyright (C) 2009 Konstantin Shishkov
- *
- * MMX/MMX2 template stuff (needed for fast movntq support),
- * 1,4,8bpp support and context / deglobalize stuff
- * by Michael Niedermayer (michaelni@gmx.at)
- *
- * 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
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <inttypes.h>
-#include <assert.h>
-
-#include "config.h"
-#include "libswscale/rgb2rgb.h"
-#include "libswscale/swscale.h"
-#include "libswscale/swscale_internal.h"
-#include "libavutil/x86_cpu.h"
-#include "libavutil/cpu.h"
-
-#define DITHER1XBPP // only for MMX
-
-/* hope these constant values are cache line aligned */
-DECLARE_ASM_CONST(8, uint64_t, mmx_00ffw) = 0x00ff00ff00ff00ffULL;
-DECLARE_ASM_CONST(8, uint64_t, mmx_redmask) = 0xf8f8f8f8f8f8f8f8ULL;
-DECLARE_ASM_CONST(8, uint64_t, mmx_grnmask) = 0xfcfcfcfcfcfcfcfcULL;
-DECLARE_ASM_CONST(8, uint64_t, pb_e0) = 0xe0e0e0e0e0e0e0e0ULL;
-DECLARE_ASM_CONST(8, uint64_t, pb_03) = 0x0303030303030303ULL;
-DECLARE_ASM_CONST(8, uint64_t, pb_07) = 0x0707070707070707ULL;
-
-//MMX versions
-#if HAVE_MMX
-#undef RENAME
-#undef COMPILE_TEMPLATE_MMX2
-#define COMPILE_TEMPLATE_MMX2 0
-#define RENAME(a) a ## _MMX
-#include "yuv2rgb_template.c"
-#endif /* HAVE_MMX */
-
-//MMX2 versions
-#if HAVE_MMX2
-#undef RENAME
-#undef COMPILE_TEMPLATE_MMX2
-#define COMPILE_TEMPLATE_MMX2 1
-#define RENAME(a) a ## _MMX2
-#include "yuv2rgb_template.c"
-#endif /* HAVE_MMX2 */
-
-SwsFunc ff_yuv2rgb_init_mmx(SwsContext *c)
-{
- int cpu_flags = av_get_cpu_flags();
-
- if (c->srcFormat != PIX_FMT_YUV420P &&
- c->srcFormat != PIX_FMT_YUVA420P)
- return NULL;
-
-#if HAVE_MMX2
- if (cpu_flags & AV_CPU_FLAG_MMX2) {
- switch (c->dstFormat) {
- case PIX_FMT_RGB24: return yuv420_rgb24_MMX2;
- case PIX_FMT_BGR24: return yuv420_bgr24_MMX2;
- }
- }
-#endif
-
- if (cpu_flags & AV_CPU_FLAG_MMX) {
- switch (c->dstFormat) {
- case PIX_FMT_RGB32:
- if (c->srcFormat == PIX_FMT_YUVA420P) {
-#if HAVE_7REGS && CONFIG_SWSCALE_ALPHA
- return yuva420_rgb32_MMX;
-#endif
- break;
- } else return yuv420_rgb32_MMX;
- case PIX_FMT_BGR32:
- if (c->srcFormat == PIX_FMT_YUVA420P) {
-#if HAVE_7REGS && CONFIG_SWSCALE_ALPHA
- return yuva420_bgr32_MMX;
-#endif
- break;
- } else return yuv420_bgr32_MMX;
- case PIX_FMT_RGB24: return yuv420_rgb24_MMX;
- case PIX_FMT_BGR24: return yuv420_bgr24_MMX;
- case PIX_FMT_RGB565: return yuv420_rgb16_MMX;
- case PIX_FMT_RGB555: return yuv420_rgb15_MMX;
- }
- }
-
- return NULL;
-}
diff --git a/gst-libs/ext/libav/libswscale/x86/yuv2rgb_template.c b/gst-libs/ext/libav/libswscale/x86/yuv2rgb_template.c
index 5d1fa5b..b028e93 100644
--- a/gst-libs/ext/libav/libswscale/x86/yuv2rgb_template.c
+++ b/gst-libs/ext/libav/libswscale/x86/yuv2rgb_template.c
@@ -25,7 +25,7 @@
#undef EMMS
#undef SFENCE
-#if COMPILE_TEMPLATE_MMX2
+#if COMPILE_TEMPLATE_MMXEXT
#define MOVNTQ "movntq"
#define SFENCE "sfence"
#else
@@ -43,7 +43,7 @@
if (h_size * depth > FFABS(dstStride[0])) \
h_size -= 8; \
\
- if (c->srcFormat == PIX_FMT_YUV422P) { \
+ if (c->srcFormat == AV_PIX_FMT_YUV422P) { \
srcStride[1] *= 2; \
srcStride[2] *= 2; \
} \
@@ -182,7 +182,7 @@
"paddusb "GREEN_DITHER"(%4), %%mm2\n\t" \
"paddusb "RED_DITHER"(%4), %%mm1\n\t" \
-#if !COMPILE_TEMPLATE_MMX2
+#if !COMPILE_TEMPLATE_MMXEXT
static inline int RENAME(yuv420_rgb15)(SwsContext *c, const uint8_t *src[],
int srcStride[],
int srcSliceY, int srcSliceH,
@@ -238,7 +238,7 @@ static inline int RENAME(yuv420_rgb16)(SwsContext *c, const uint8_t *src[],
YUV2RGB_OPERANDS
YUV2RGB_ENDFUNC
}
-#endif /* !COMPILE_TEMPLATE_MMX2 */
+#endif /* !COMPILE_TEMPLATE_MMXEXT */
#define RGB_PACK24(blue, red)\
"packuswb %%mm3, %%mm0 \n" /* R0 R2 R4 R6 R1 R3 R5 R7 */\
@@ -255,7 +255,7 @@ static inline int RENAME(yuv420_rgb16)(SwsContext *c, const uint8_t *src[],
"punpckhwd %%mm6, %%mm5 \n" /* R4 G4 B4 R5 R6 G6 B6 R7 */\
RGB_PACK24_B
-#if COMPILE_TEMPLATE_MMX2
+#if COMPILE_TEMPLATE_MMXEXT
DECLARE_ASM_CONST(8, int16_t, mask1101[4]) = {-1,-1, 0,-1};
DECLARE_ASM_CONST(8, int16_t, mask0010[4]) = { 0, 0,-1, 0};
DECLARE_ASM_CONST(8, int16_t, mask0110[4]) = { 0,-1,-1, 0};
@@ -362,7 +362,7 @@ static inline int RENAME(yuv420_bgr24)(SwsContext *c, const uint8_t *src[],
MOVNTQ " %%mm5, 16(%1)\n\t" \
MOVNTQ " %%mm"alpha", 24(%1)\n\t" \
-#if !COMPILE_TEMPLATE_MMX2
+#if !COMPILE_TEMPLATE_MMXEXT
static inline int RENAME(yuv420_rgb32)(SwsContext *c, const uint8_t *src[],
int srcStride[],
int srcSliceY, int srcSliceH,
@@ -449,4 +449,4 @@ static inline int RENAME(yuva420_bgr32)(SwsContext *c, const uint8_t *src[],
}
#endif
-#endif /* !COMPILE_TEMPLATE_MMX2 */
+#endif /* !COMPILE_TEMPLATE_MMXEXT */
diff --git a/gst-libs/ext/libav/libswscale/yuv2rgb.c b/gst-libs/ext/libav/libswscale/yuv2rgb.c
index 39c8b9c..2ffbf5b 100644
--- a/gst-libs/ext/libav/libswscale/yuv2rgb.c
+++ b/gst-libs/ext/libav/libswscale/yuv2rgb.c
@@ -28,12 +28,12 @@
#include <inttypes.h>
#include <assert.h>
+#include "libavutil/cpu.h"
+#include "libavutil/bswap.h"
#include "config.h"
#include "rgb2rgb.h"
#include "swscale.h"
#include "swscale_internal.h"
-#include "libavutil/cpu.h"
-#include "libavutil/bswap.h"
extern const uint8_t dither_4x4_16[4][8];
extern const uint8_t dither_8x8_32[8][8];
@@ -41,14 +41,14 @@ extern const uint8_t dither_8x8_73[8][8];
extern const uint8_t dither_8x8_220[8][8];
const int32_t ff_yuv2rgb_coeffs[8][4] = {
- {117504, 138453, 13954, 34903}, /* no sequence_display_extension */
- {117504, 138453, 13954, 34903}, /* ITU-R Rec. 709 (1990) */
- {104597, 132201, 25675, 53279}, /* unspecified */
- {104597, 132201, 25675, 53279}, /* reserved */
- {104448, 132798, 24759, 53109}, /* FCC */
- {104597, 132201, 25675, 53279}, /* ITU-R Rec. 624-4 System B, G */
- {104597, 132201, 25675, 53279}, /* SMPTE 170M */
- {117579, 136230, 16907, 35559} /* SMPTE 240M (1987) */
+ { 117504, 138453, 13954, 34903 }, /* no sequence_display_extension */
+ { 117504, 138453, 13954, 34903 }, /* ITU-R Rec. 709 (1990) */
+ { 104597, 132201, 25675, 53279 }, /* unspecified */
+ { 104597, 132201, 25675, 53279 }, /* reserved */
+ { 104448, 132798, 24759, 53109 }, /* FCC */
+ { 104597, 132201, 25675, 53279 }, /* ITU-R Rec. 624-4 System B, G */
+ { 104597, 132201, 25675, 53279 }, /* SMPTE 170M */
+ { 117579, 136230, 16907, 35559 } /* SMPTE 240M (1987) */
};
const int *sws_getCoefficients(int colorspace)
@@ -65,505 +65,580 @@ const int *sws_getCoefficients(int colorspace)
g = (void *)(c->table_gU[U] + c->table_gV[V]); \
b = (void *)c->table_bU[U];
-#define PUTRGB(dst,src,i) \
- Y = src[2*i]; \
- dst[2*i ] = r[Y] + g[Y] + b[Y]; \
- Y = src[2*i+1]; \
- dst[2*i+1] = r[Y] + g[Y] + b[Y];
-
-#define PUTRGB24(dst,src,i) \
- Y = src[2*i]; \
- dst[6*i+0] = r[Y]; dst[6*i+1] = g[Y]; dst[6*i+2] = b[Y]; \
- Y = src[2*i+1]; \
- dst[6*i+3] = r[Y]; dst[6*i+4] = g[Y]; dst[6*i+5] = b[Y];
-
-#define PUTBGR24(dst,src,i) \
- Y = src[2*i]; \
- dst[6*i+0] = b[Y]; dst[6*i+1] = g[Y]; dst[6*i+2] = r[Y]; \
- Y = src[2*i+1]; \
- dst[6*i+3] = b[Y]; dst[6*i+4] = g[Y]; dst[6*i+5] = r[Y];
-
-#define PUTRGBA(dst,ysrc,asrc,i,s) \
- Y = ysrc[2*i]; \
- dst[2*i ] = r[Y] + g[Y] + b[Y] + (asrc[2*i ]<<s); \
- Y = ysrc[2*i+1]; \
- dst[2*i+1] = r[Y] + g[Y] + b[Y] + (asrc[2*i+1]<<s);
-
-#define PUTRGB48(dst,src,i) \
- Y = src[2*i]; \
- dst[12*i+ 0] = dst[12*i+ 1] = r[Y]; \
- dst[12*i+ 2] = dst[12*i+ 3] = g[Y]; \
- dst[12*i+ 4] = dst[12*i+ 5] = b[Y]; \
- Y = src[2*i+1]; \
- dst[12*i+ 6] = dst[12*i+ 7] = r[Y]; \
- dst[12*i+ 8] = dst[12*i+ 9] = g[Y]; \
- dst[12*i+10] = dst[12*i+11] = b[Y];
-
-#define PUTBGR48(dst,src,i) \
- Y = src[2*i]; \
- dst[12*i+ 0] = dst[12*i+ 1] = b[Y]; \
- dst[12*i+ 2] = dst[12*i+ 3] = g[Y]; \
- dst[12*i+ 4] = dst[12*i+ 5] = r[Y]; \
- Y = src[2*i+1]; \
- dst[12*i+ 6] = dst[12*i+ 7] = b[Y]; \
- dst[12*i+ 8] = dst[12*i+ 9] = g[Y]; \
- dst[12*i+10] = dst[12*i+11] = r[Y];
-
-#define YUV2RGBFUNC(func_name, dst_type, alpha) \
-static int func_name(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY, \
- int srcSliceH, uint8_t* dst[], int dstStride[]) \
-{\
- int y;\
-\
- if (!alpha && c->srcFormat == PIX_FMT_YUV422P) {\
- srcStride[1] *= 2;\
- srcStride[2] *= 2;\
- }\
- for (y=0; y<srcSliceH; y+=2) {\
- dst_type *dst_1 = (dst_type*)(dst[0] + (y+srcSliceY )*dstStride[0]);\
- dst_type *dst_2 = (dst_type*)(dst[0] + (y+srcSliceY+1)*dstStride[0]);\
- dst_type av_unused *r, *b;\
- dst_type *g;\
- const uint8_t *py_1 = src[0] + y*srcStride[0];\
- const uint8_t *py_2 = py_1 + srcStride[0];\
- const uint8_t *pu = src[1] + (y>>1)*srcStride[1];\
- const uint8_t *pv = src[2] + (y>>1)*srcStride[2];\
- const uint8_t av_unused *pa_1, *pa_2;\
- unsigned int h_size = c->dstW>>3;\
- if (alpha) {\
- pa_1 = src[3] + y*srcStride[3];\
- pa_2 = pa_1 + srcStride[3];\
- }\
- while (h_size--) {\
- int av_unused U, V;\
- int Y;\
-
-#define ENDYUV2RGBLINE(dst_delta)\
- pu += 4;\
- pv += 4;\
- py_1 += 8;\
- py_2 += 8;\
- dst_1 += dst_delta;\
- dst_2 += dst_delta;\
- }\
- if (c->dstW & 4) {\
- int av_unused Y, U, V;\
-
-#define ENDYUV2RGBFUNC()\
- }\
- }\
- return srcSliceH;\
-}
+#define PUTRGB(dst, src, i) \
+ Y = src[2 * i]; \
+ dst[2 * i] = r[Y] + g[Y] + b[Y]; \
+ Y = src[2 * i + 1]; \
+ dst[2 * i + 1] = r[Y] + g[Y] + b[Y];
+
+#define PUTRGB24(dst, src, i) \
+ Y = src[2 * i]; \
+ dst[6 * i + 0] = r[Y]; \
+ dst[6 * i + 1] = g[Y]; \
+ dst[6 * i + 2] = b[Y]; \
+ Y = src[2 * i + 1]; \
+ dst[6 * i + 3] = r[Y]; \
+ dst[6 * i + 4] = g[Y]; \
+ dst[6 * i + 5] = b[Y];
+
+#define PUTBGR24(dst, src, i) \
+ Y = src[2 * i]; \
+ dst[6 * i + 0] = b[Y]; \
+ dst[6 * i + 1] = g[Y]; \
+ dst[6 * i + 2] = r[Y]; \
+ Y = src[2 * i + 1]; \
+ dst[6 * i + 3] = b[Y]; \
+ dst[6 * i + 4] = g[Y]; \
+ dst[6 * i + 5] = r[Y];
+
+#define PUTRGBA(dst, ysrc, asrc, i, s) \
+ Y = ysrc[2 * i]; \
+ dst[2 * i] = r[Y] + g[Y] + b[Y] + (asrc[2 * i] << s); \
+ Y = ysrc[2 * i + 1]; \
+ dst[2 * i + 1] = r[Y] + g[Y] + b[Y] + (asrc[2 * i + 1] << s);
+
+#define PUTRGB48(dst, src, i) \
+ Y = src[ 2 * i]; \
+ dst[12 * i + 0] = dst[12 * i + 1] = r[Y]; \
+ dst[12 * i + 2] = dst[12 * i + 3] = g[Y]; \
+ dst[12 * i + 4] = dst[12 * i + 5] = b[Y]; \
+ Y = src[ 2 * i + 1]; \
+ dst[12 * i + 6] = dst[12 * i + 7] = r[Y]; \
+ dst[12 * i + 8] = dst[12 * i + 9] = g[Y]; \
+ dst[12 * i + 10] = dst[12 * i + 11] = b[Y];
+
+#define PUTBGR48(dst, src, i) \
+ Y = src[2 * i]; \
+ dst[12 * i + 0] = dst[12 * i + 1] = b[Y]; \
+ dst[12 * i + 2] = dst[12 * i + 3] = g[Y]; \
+ dst[12 * i + 4] = dst[12 * i + 5] = r[Y]; \
+ Y = src[2 * i + 1]; \
+ dst[12 * i + 6] = dst[12 * i + 7] = b[Y]; \
+ dst[12 * i + 8] = dst[12 * i + 9] = g[Y]; \
+ dst[12 * i + 10] = dst[12 * i + 11] = r[Y];
+
+#define YUV2RGBFUNC(func_name, dst_type, alpha) \
+ static int func_name(SwsContext *c, const uint8_t *src[], \
+ int srcStride[], int srcSliceY, int srcSliceH, \
+ uint8_t *dst[], int dstStride[]) \
+ { \
+ int y; \
+ \
+ if (!alpha && c->srcFormat == AV_PIX_FMT_YUV422P) { \
+ srcStride[1] *= 2; \
+ srcStride[2] *= 2; \
+ } \
+ for (y = 0; y < srcSliceH; y += 2) { \
+ dst_type *dst_1 = \
+ (dst_type *)(dst[0] + (y + srcSliceY) * dstStride[0]); \
+ dst_type *dst_2 = \
+ (dst_type *)(dst[0] + (y + srcSliceY + 1) * dstStride[0]); \
+ dst_type av_unused *r, *g, *b; \
+ const uint8_t *py_1 = src[0] + y * srcStride[0]; \
+ const uint8_t *py_2 = py_1 + srcStride[0]; \
+ const uint8_t *pu = src[1] + (y >> 1) * srcStride[1]; \
+ const uint8_t *pv = src[2] + (y >> 1) * srcStride[2]; \
+ const uint8_t av_unused *pa_1, *pa_2; \
+ unsigned int h_size = c->dstW >> 3; \
+ if (alpha) { \
+ pa_1 = src[3] + y * srcStride[3]; \
+ pa_2 = pa_1 + srcStride[3]; \
+ } \
+ while (h_size--) { \
+ int av_unused U, V, Y; \
+
+#define ENDYUV2RGBLINE(dst_delta, ss) \
+ pu += 4 >> ss; \
+ pv += 4 >> ss; \
+ py_1 += 8 >> ss; \
+ py_2 += 8 >> ss; \
+ dst_1 += dst_delta >> ss; \
+ dst_2 += dst_delta >> ss; \
+ } \
+ if (c->dstW & (4 >> ss)) { \
+ int av_unused Y, U, V; \
+
+#define ENDYUV2RGBFUNC() \
+ } \
+ } \
+ return srcSliceH; \
+ }
-#define CLOSEYUV2RGBFUNC(dst_delta)\
- ENDYUV2RGBLINE(dst_delta)\
+#define CLOSEYUV2RGBFUNC(dst_delta) \
+ ENDYUV2RGBLINE(dst_delta, 0) \
ENDYUV2RGBFUNC()
YUV2RGBFUNC(yuv2rgb_c_48, uint8_t, 0)
LOADCHROMA(0);
- PUTRGB48(dst_1,py_1,0);
- PUTRGB48(dst_2,py_2,0);
+ PUTRGB48(dst_1, py_1, 0);
+ PUTRGB48(dst_2, py_2, 0);
LOADCHROMA(1);
- PUTRGB48(dst_2,py_2,1);
- PUTRGB48(dst_1,py_1,1);
+ PUTRGB48(dst_2, py_2, 1);
+ PUTRGB48(dst_1, py_1, 1);
LOADCHROMA(2);
- PUTRGB48(dst_1,py_1,2);
- PUTRGB48(dst_2,py_2,2);
+ PUTRGB48(dst_1, py_1, 2);
+ PUTRGB48(dst_2, py_2, 2);
LOADCHROMA(3);
- PUTRGB48(dst_2,py_2,3);
- PUTRGB48(dst_1,py_1,3);
-ENDYUV2RGBLINE(48)
+ PUTRGB48(dst_2, py_2, 3);
+ PUTRGB48(dst_1, py_1, 3);
+ENDYUV2RGBLINE(48, 0)
LOADCHROMA(0);
- PUTRGB48(dst_1,py_1,0);
- PUTRGB48(dst_2,py_2,0);
+ PUTRGB48(dst_1, py_1, 0);
+ PUTRGB48(dst_2, py_2, 0);
LOADCHROMA(1);
- PUTRGB48(dst_2,py_2,1);
- PUTRGB48(dst_1,py_1,1);
+ PUTRGB48(dst_2, py_2, 1);
+ PUTRGB48(dst_1, py_1, 1);
+ENDYUV2RGBLINE(48, 1)
+ LOADCHROMA(0);
+ PUTRGB48(dst_1, py_1, 0);
+ PUTRGB48(dst_2, py_2, 0);
ENDYUV2RGBFUNC()
YUV2RGBFUNC(yuv2rgb_c_bgr48, uint8_t, 0)
LOADCHROMA(0);
- PUTBGR48(dst_1,py_1,0);
- PUTBGR48(dst_2,py_2,0);
+ PUTBGR48(dst_1, py_1, 0);
+ PUTBGR48(dst_2, py_2, 0);
LOADCHROMA(1);
- PUTBGR48(dst_2,py_2,1);
- PUTBGR48(dst_1,py_1,1);
+ PUTBGR48(dst_2, py_2, 1);
+ PUTBGR48(dst_1, py_1, 1);
LOADCHROMA(2);
- PUTBGR48(dst_1,py_1,2);
- PUTBGR48(dst_2,py_2,2);
+ PUTBGR48(dst_1, py_1, 2);
+ PUTBGR48(dst_2, py_2, 2);
LOADCHROMA(3);
- PUTBGR48(dst_2,py_2,3);
- PUTBGR48(dst_1,py_1,3);
-ENDYUV2RGBLINE(48)
+ PUTBGR48(dst_2, py_2, 3);
+ PUTBGR48(dst_1, py_1, 3);
+ENDYUV2RGBLINE(48, 0)
LOADCHROMA(0);
- PUTBGR48(dst_1,py_1,0);
- PUTBGR48(dst_2,py_2,0);
+ PUTBGR48(dst_1, py_1, 0);
+ PUTBGR48(dst_2, py_2, 0);
LOADCHROMA(1);
- PUTBGR48(dst_2,py_2,1);
- PUTBGR48(dst_1,py_1,1);
+ PUTBGR48(dst_2, py_2, 1);
+ PUTBGR48(dst_1, py_1, 1);
+ENDYUV2RGBLINE(48, 1)
+ LOADCHROMA(0);
+ PUTBGR48(dst_1, py_1, 0);
+ PUTBGR48(dst_2, py_2, 0);
ENDYUV2RGBFUNC()
YUV2RGBFUNC(yuv2rgb_c_32, uint32_t, 0)
LOADCHROMA(0);
- PUTRGB(dst_1,py_1,0);
- PUTRGB(dst_2,py_2,0);
+ PUTRGB(dst_1, py_1, 0);
+ PUTRGB(dst_2, py_2, 0);
LOADCHROMA(1);
- PUTRGB(dst_2,py_2,1);
- PUTRGB(dst_1,py_1,1);
+ PUTRGB(dst_2, py_2, 1);
+ PUTRGB(dst_1, py_1, 1);
LOADCHROMA(2);
- PUTRGB(dst_1,py_1,2);
- PUTRGB(dst_2,py_2,2);
+ PUTRGB(dst_1, py_1, 2);
+ PUTRGB(dst_2, py_2, 2);
LOADCHROMA(3);
- PUTRGB(dst_2,py_2,3);
- PUTRGB(dst_1,py_1,3);
-ENDYUV2RGBLINE(8)
+ PUTRGB(dst_2, py_2, 3);
+ PUTRGB(dst_1, py_1, 3);
+ENDYUV2RGBLINE(8, 0)
LOADCHROMA(0);
- PUTRGB(dst_1,py_1,0);
- PUTRGB(dst_2,py_2,0);
+ PUTRGB(dst_1, py_1, 0);
+ PUTRGB(dst_2, py_2, 0);
LOADCHROMA(1);
- PUTRGB(dst_2,py_2,1);
- PUTRGB(dst_1,py_1,1);
+ PUTRGB(dst_2, py_2, 1);
+ PUTRGB(dst_1, py_1, 1);
+ENDYUV2RGBLINE(8, 1)
+ LOADCHROMA(0);
+ PUTRGB(dst_1, py_1, 0);
+ PUTRGB(dst_2, py_2, 0);
ENDYUV2RGBFUNC()
YUV2RGBFUNC(yuva2rgba_c, uint32_t, 1)
LOADCHROMA(0);
- PUTRGBA(dst_1,py_1,pa_1,0,24);
- PUTRGBA(dst_2,py_2,pa_2,0,24);
+ PUTRGBA(dst_1, py_1, pa_1, 0, 24);
+ PUTRGBA(dst_2, py_2, pa_2, 0, 24);
LOADCHROMA(1);
- PUTRGBA(dst_2,py_2,pa_1,1,24);
- PUTRGBA(dst_1,py_1,pa_2,1,24);
+ PUTRGBA(dst_2, py_2, pa_2, 1, 24);
+ PUTRGBA(dst_1, py_1, pa_1, 1, 24);
LOADCHROMA(2);
- PUTRGBA(dst_1,py_1,pa_1,2,24);
- PUTRGBA(dst_2,py_2,pa_2,2,24);
+ PUTRGBA(dst_1, py_1, pa_1, 2, 24);
+ PUTRGBA(dst_2, py_2, pa_2, 2, 24);
LOADCHROMA(3);
- PUTRGBA(dst_2,py_2,pa_1,3,24);
- PUTRGBA(dst_1,py_1,pa_2,3,24);
- pa_1 += 8;\
- pa_2 += 8;\
-ENDYUV2RGBLINE(8)
+ PUTRGBA(dst_2, py_2, pa_2, 3, 24);
+ PUTRGBA(dst_1, py_1, pa_1, 3, 24);
+ pa_1 += 8; \
+ pa_2 += 8; \
+ENDYUV2RGBLINE(8, 0)
LOADCHROMA(0);
- PUTRGBA(dst_1,py_1,pa_1,0,24);
- PUTRGBA(dst_2,py_2,pa_2,0,24);
+ PUTRGBA(dst_1, py_1, pa_1, 0, 24);
+ PUTRGBA(dst_2, py_2, pa_2, 0, 24);
LOADCHROMA(1);
- PUTRGBA(dst_2,py_2,pa_1,1,24);
- PUTRGBA(dst_1,py_1,pa_2,1,24);
+ PUTRGBA(dst_2, py_2, pa_2, 1, 24);
+ PUTRGBA(dst_1, py_1, pa_1, 1, 24);
+ pa_1 += 4; \
+ pa_2 += 4; \
+ENDYUV2RGBLINE(8, 1)
+ LOADCHROMA(0);
+ PUTRGBA(dst_1, py_1, pa_1, 0, 24);
+ PUTRGBA(dst_2, py_2, pa_2, 0, 24);
ENDYUV2RGBFUNC()
YUV2RGBFUNC(yuva2argb_c, uint32_t, 1)
LOADCHROMA(0);
- PUTRGBA(dst_1,py_1,pa_1,0,0);
- PUTRGBA(dst_2,py_2,pa_2,0,0);
+ PUTRGBA(dst_1, py_1, pa_1, 0, 0);
+ PUTRGBA(dst_2, py_2, pa_2, 0, 0);
LOADCHROMA(1);
- PUTRGBA(dst_2,py_2,pa_2,1,0);
- PUTRGBA(dst_1,py_1,pa_1,1,0);
+ PUTRGBA(dst_2, py_2, pa_2, 1, 0);
+ PUTRGBA(dst_1, py_1, pa_1, 1, 0);
LOADCHROMA(2);
- PUTRGBA(dst_1,py_1,pa_1,2,0);
- PUTRGBA(dst_2,py_2,pa_2,2,0);
+ PUTRGBA(dst_1, py_1, pa_1, 2, 0);
+ PUTRGBA(dst_2, py_2, pa_2, 2, 0);
LOADCHROMA(3);
- PUTRGBA(dst_2,py_2,pa_2,3,0);
- PUTRGBA(dst_1,py_1,pa_1,3,0);
- pa_1 += 8;\
- pa_2 += 8;\
-ENDYUV2RGBLINE(8)
+ PUTRGBA(dst_2, py_2, pa_2, 3, 0);
+ PUTRGBA(dst_1, py_1, pa_1, 3, 0);
+ pa_1 += 8; \
+ pa_2 += 8; \
+ENDYUV2RGBLINE(8, 0)
LOADCHROMA(0);
- PUTRGBA(dst_1,py_1,pa_1,0,0);
- PUTRGBA(dst_2,py_2,pa_2,0,0);
+ PUTRGBA(dst_1, py_1, pa_1, 0, 0);
+ PUTRGBA(dst_2, py_2, pa_2, 0, 0);
LOADCHROMA(1);
- PUTRGBA(dst_2,py_2,pa_2,1,0);
- PUTRGBA(dst_1,py_1,pa_1,1,0);
+ PUTRGBA(dst_2, py_2, pa_2, 1, 0);
+ PUTRGBA(dst_1, py_1, pa_1, 1, 0);
+ pa_1 += 4; \
+ pa_2 += 4; \
+ENDYUV2RGBLINE(8, 1)
+ LOADCHROMA(0);
+ PUTRGBA(dst_1, py_1, pa_1, 0, 0);
+ PUTRGBA(dst_2, py_2, pa_2, 0, 0);
ENDYUV2RGBFUNC()
YUV2RGBFUNC(yuv2rgb_c_24_rgb, uint8_t, 0)
LOADCHROMA(0);
- PUTRGB24(dst_1,py_1,0);
- PUTRGB24(dst_2,py_2,0);
+ PUTRGB24(dst_1, py_1, 0);
+ PUTRGB24(dst_2, py_2, 0);
LOADCHROMA(1);
- PUTRGB24(dst_2,py_2,1);
- PUTRGB24(dst_1,py_1,1);
+ PUTRGB24(dst_2, py_2, 1);
+ PUTRGB24(dst_1, py_1, 1);
LOADCHROMA(2);
- PUTRGB24(dst_1,py_1,2);
- PUTRGB24(dst_2,py_2,2);
+ PUTRGB24(dst_1, py_1, 2);
+ PUTRGB24(dst_2, py_2, 2);
LOADCHROMA(3);
- PUTRGB24(dst_2,py_2,3);
- PUTRGB24(dst_1,py_1,3);
-ENDYUV2RGBLINE(24)
+ PUTRGB24(dst_2, py_2, 3);
+ PUTRGB24(dst_1, py_1, 3);
+ENDYUV2RGBLINE(24, 0)
LOADCHROMA(0);
- PUTRGB24(dst_1,py_1,0);
- PUTRGB24(dst_2,py_2,0);
+ PUTRGB24(dst_1, py_1, 0);
+ PUTRGB24(dst_2, py_2, 0);
LOADCHROMA(1);
- PUTRGB24(dst_2,py_2,1);
- PUTRGB24(dst_1,py_1,1);
+ PUTRGB24(dst_2, py_2, 1);
+ PUTRGB24(dst_1, py_1, 1);
+ENDYUV2RGBLINE(24, 1)
+ LOADCHROMA(0);
+ PUTRGB24(dst_1, py_1, 0);
+ PUTRGB24(dst_2, py_2, 0);
ENDYUV2RGBFUNC()
// only trivial mods from yuv2rgb_c_24_rgb
YUV2RGBFUNC(yuv2rgb_c_24_bgr, uint8_t, 0)
LOADCHROMA(0);
- PUTBGR24(dst_1,py_1,0);
- PUTBGR24(dst_2,py_2,0);
+ PUTBGR24(dst_1, py_1, 0);
+ PUTBGR24(dst_2, py_2, 0);
LOADCHROMA(1);
- PUTBGR24(dst_2,py_2,1);
- PUTBGR24(dst_1,py_1,1);
+ PUTBGR24(dst_2, py_2, 1);
+ PUTBGR24(dst_1, py_1, 1);
LOADCHROMA(2);
- PUTBGR24(dst_1,py_1,2);
- PUTBGR24(dst_2,py_2,2);
+ PUTBGR24(dst_1, py_1, 2);
+ PUTBGR24(dst_2, py_2, 2);
LOADCHROMA(3);
- PUTBGR24(dst_2,py_2,3);
- PUTBGR24(dst_1,py_1,3);
-ENDYUV2RGBLINE(24)
+ PUTBGR24(dst_2, py_2, 3);
+ PUTBGR24(dst_1, py_1, 3);
+ENDYUV2RGBLINE(24, 0)
LOADCHROMA(0);
- PUTBGR24(dst_1,py_1,0);
- PUTBGR24(dst_2,py_2,0);
+ PUTBGR24(dst_1, py_1, 0);
+ PUTBGR24(dst_2, py_2, 0);
LOADCHROMA(1);
- PUTBGR24(dst_2,py_2,1);
- PUTBGR24(dst_1,py_1,1);
+ PUTBGR24(dst_2, py_2, 1);
+ PUTBGR24(dst_1, py_1, 1);
+ENDYUV2RGBLINE(24, 1)
+ LOADCHROMA(0);
+ PUTBGR24(dst_1, py_1, 0);
+ PUTBGR24(dst_2, py_2, 0);
ENDYUV2RGBFUNC()
// This is exactly the same code as yuv2rgb_c_32 except for the types of
// r, g, b, dst_1, dst_2
YUV2RGBFUNC(yuv2rgb_c_16, uint16_t, 0)
LOADCHROMA(0);
- PUTRGB(dst_1,py_1,0);
- PUTRGB(dst_2,py_2,0);
+ PUTRGB(dst_1, py_1, 0);
+ PUTRGB(dst_2, py_2, 0);
LOADCHROMA(1);
- PUTRGB(dst_2,py_2,1);
- PUTRGB(dst_1,py_1,1);
+ PUTRGB(dst_2, py_2, 1);
+ PUTRGB(dst_1, py_1, 1);
LOADCHROMA(2);
- PUTRGB(dst_1,py_1,2);
- PUTRGB(dst_2,py_2,2);
+ PUTRGB(dst_1, py_1, 2);
+ PUTRGB(dst_2, py_2, 2);
LOADCHROMA(3);
- PUTRGB(dst_2,py_2,3);
- PUTRGB(dst_1,py_1,3);
+ PUTRGB(dst_2, py_2, 3);
+ PUTRGB(dst_1, py_1, 3);
CLOSEYUV2RGBFUNC(8)
// r, g, b, dst_1, dst_2
YUV2RGBFUNC(yuv2rgb_c_12_ordered_dither, uint16_t, 0)
- const uint8_t *d16 = dither_4x4_16[y&3];
-#define PUTRGB12(dst,src,i,o) \
- Y = src[2*i]; \
- dst[2*i] = r[Y+d16[0+o]] + g[Y+d16[0+o]] + b[Y+d16[0+o]]; \
- Y = src[2*i+1]; \
- dst[2*i+1] = r[Y+d16[1+o]] + g[Y+d16[1+o]] + b[Y+d16[1+o]];
+ const uint8_t *d16 = dither_4x4_16[y & 3];
+
+#define PUTRGB12(dst, src, i, o) \
+ Y = src[2 * i]; \
+ dst[2 * i] = r[Y + d16[0 + o]] + \
+ g[Y + d16[0 + o]] + \
+ b[Y + d16[0 + o]]; \
+ Y = src[2 * i + 1]; \
+ dst[2 * i + 1] = r[Y + d16[1 + o]] + \
+ g[Y + d16[1 + o]] + \
+ b[Y + d16[1 + o]];
LOADCHROMA(0);
- PUTRGB12(dst_1,py_1,0,0);
- PUTRGB12(dst_2,py_2,0,0+8);
+ PUTRGB12(dst_1, py_1, 0, 0);
+ PUTRGB12(dst_2, py_2, 0, 0 + 8);
LOADCHROMA(1);
- PUTRGB12(dst_2,py_2,1,2+8);
- PUTRGB12(dst_1,py_1,1,2);
+ PUTRGB12(dst_2, py_2, 1, 2 + 8);
+ PUTRGB12(dst_1, py_1, 1, 2);
LOADCHROMA(2);
- PUTRGB12(dst_1,py_1,2,4);
- PUTRGB12(dst_2,py_2,2,4+8);
+ PUTRGB12(dst_1, py_1, 2, 4);
+ PUTRGB12(dst_2, py_2, 2, 4 + 8);
LOADCHROMA(3);
- PUTRGB12(dst_2,py_2,3,6+8);
- PUTRGB12(dst_1,py_1,3,6);
+ PUTRGB12(dst_2, py_2, 3, 6 + 8);
+ PUTRGB12(dst_1, py_1, 3, 6);
CLOSEYUV2RGBFUNC(8)
// r, g, b, dst_1, dst_2
YUV2RGBFUNC(yuv2rgb_c_8_ordered_dither, uint8_t, 0)
- const uint8_t *d32 = dither_8x8_32[y&7];
- const uint8_t *d64 = dither_8x8_73[y&7];
-#define PUTRGB8(dst,src,i,o) \
- Y = src[2*i]; \
- dst[2*i] = r[Y+d32[0+o]] + g[Y+d32[0+o]] + b[Y+d64[0+o]]; \
- Y = src[2*i+1]; \
- dst[2*i+1] = r[Y+d32[1+o]] + g[Y+d32[1+o]] + b[Y+d64[1+o]];
+ const uint8_t *d32 = dither_8x8_32[y & 7];
+ const uint8_t *d64 = dither_8x8_73[y & 7];
+
+#define PUTRGB8(dst, src, i, o) \
+ Y = src[2 * i]; \
+ dst[2 * i] = r[Y + d32[0 + o]] + \
+ g[Y + d32[0 + o]] + \
+ b[Y + d64[0 + o]]; \
+ Y = src[2 * i + 1]; \
+ dst[2 * i + 1] = r[Y + d32[1 + o]] + \
+ g[Y + d32[1 + o]] + \
+ b[Y + d64[1 + o]];
LOADCHROMA(0);
- PUTRGB8(dst_1,py_1,0,0);
- PUTRGB8(dst_2,py_2,0,0+8);
+ PUTRGB8(dst_1, py_1, 0, 0);
+ PUTRGB8(dst_2, py_2, 0, 0 + 8);
LOADCHROMA(1);
- PUTRGB8(dst_2,py_2,1,2+8);
- PUTRGB8(dst_1,py_1,1,2);
+ PUTRGB8(dst_2, py_2, 1, 2 + 8);
+ PUTRGB8(dst_1, py_1, 1, 2);
LOADCHROMA(2);
- PUTRGB8(dst_1,py_1,2,4);
- PUTRGB8(dst_2,py_2,2,4+8);
+ PUTRGB8(dst_1, py_1, 2, 4);
+ PUTRGB8(dst_2, py_2, 2, 4 + 8);
LOADCHROMA(3);
- PUTRGB8(dst_2,py_2,3,6+8);
- PUTRGB8(dst_1,py_1,3,6);
+ PUTRGB8(dst_2, py_2, 3, 6 + 8);
+ PUTRGB8(dst_1, py_1, 3, 6);
CLOSEYUV2RGBFUNC(8)
YUV2RGBFUNC(yuv2rgb_c_4_ordered_dither, uint8_t, 0)
- const uint8_t *d64 = dither_8x8_73[y&7];
- const uint8_t *d128 = dither_8x8_220[y&7];
+ const uint8_t * d64 = dither_8x8_73[y & 7];
+ const uint8_t *d128 = dither_8x8_220[y & 7];
int acc;
-#define PUTRGB4D(dst,src,i,o) \
- Y = src[2*i]; \
- acc = r[Y+d128[0+o]] + g[Y+d64[0+o]] + b[Y+d128[0+o]]; \
- Y = src[2*i+1]; \
- acc |= (r[Y+d128[1+o]] + g[Y+d64[1+o]] + b[Y+d128[1+o]])<<4; \
- dst[i]= acc;
+#define PUTRGB4D(dst, src, i, o) \
+ Y = src[2 * i]; \
+ acc = r[Y + d128[0 + o]] + \
+ g[Y + d64[0 + o]] + \
+ b[Y + d128[0 + o]]; \
+ Y = src[2 * i + 1]; \
+ acc |= (r[Y + d128[1 + o]] + \
+ g[Y + d64[1 + o]] + \
+ b[Y + d128[1 + o]]) << 4; \
+ dst[i] = acc;
LOADCHROMA(0);
- PUTRGB4D(dst_1,py_1,0,0);
- PUTRGB4D(dst_2,py_2,0,0+8);
+ PUTRGB4D(dst_1, py_1, 0, 0);
+ PUTRGB4D(dst_2, py_2, 0, 0 + 8);
LOADCHROMA(1);
- PUTRGB4D(dst_2,py_2,1,2+8);
- PUTRGB4D(dst_1,py_1,1,2);
+ PUTRGB4D(dst_2, py_2, 1, 2 + 8);
+ PUTRGB4D(dst_1, py_1, 1, 2);
LOADCHROMA(2);
- PUTRGB4D(dst_1,py_1,2,4);
- PUTRGB4D(dst_2,py_2,2,4+8);
+ PUTRGB4D(dst_1, py_1, 2, 4);
+ PUTRGB4D(dst_2, py_2, 2, 4 + 8);
LOADCHROMA(3);
- PUTRGB4D(dst_2,py_2,3,6+8);
- PUTRGB4D(dst_1,py_1,3,6);
+ PUTRGB4D(dst_2, py_2, 3, 6 + 8);
+ PUTRGB4D(dst_1, py_1, 3, 6);
CLOSEYUV2RGBFUNC(4)
YUV2RGBFUNC(yuv2rgb_c_4b_ordered_dither, uint8_t, 0)
- const uint8_t *d64 = dither_8x8_73[y&7];
- const uint8_t *d128 = dither_8x8_220[y&7];
-
-#define PUTRGB4DB(dst,src,i,o) \
- Y = src[2*i]; \
- dst[2*i] = r[Y+d128[0+o]] + g[Y+d64[0+o]] + b[Y+d128[0+o]]; \
- Y = src[2*i+1]; \
- dst[2*i+1] = r[Y+d128[1+o]] + g[Y+d64[1+o]] + b[Y+d128[1+o]];
+ const uint8_t *d64 = dither_8x8_73[y & 7];
+ const uint8_t *d128 = dither_8x8_220[y & 7];
+
+#define PUTRGB4DB(dst, src, i, o) \
+ Y = src[2 * i]; \
+ dst[2 * i] = r[Y + d128[0 + o]] + \
+ g[Y + d64[0 + o]] + \
+ b[Y + d128[0 + o]]; \
+ Y = src[2 * i + 1]; \
+ dst[2 * i + 1] = r[Y + d128[1 + o]] + \
+ g[Y + d64[1 + o]] + \
+ b[Y + d128[1 + o]];
LOADCHROMA(0);
- PUTRGB4DB(dst_1,py_1,0,0);
- PUTRGB4DB(dst_2,py_2,0,0+8);
+ PUTRGB4DB(dst_1, py_1, 0, 0);
+ PUTRGB4DB(dst_2, py_2, 0, 0 + 8);
LOADCHROMA(1);
- PUTRGB4DB(dst_2,py_2,1,2+8);
- PUTRGB4DB(dst_1,py_1,1,2);
+ PUTRGB4DB(dst_2, py_2, 1, 2 + 8);
+ PUTRGB4DB(dst_1, py_1, 1, 2);
LOADCHROMA(2);
- PUTRGB4DB(dst_1,py_1,2,4);
- PUTRGB4DB(dst_2,py_2,2,4+8);
+ PUTRGB4DB(dst_1, py_1, 2, 4);
+ PUTRGB4DB(dst_2, py_2, 2, 4 + 8);
LOADCHROMA(3);
- PUTRGB4DB(dst_2,py_2,3,6+8);
- PUTRGB4DB(dst_1,py_1,3,6);
+ PUTRGB4DB(dst_2, py_2, 3, 6 + 8);
+ PUTRGB4DB(dst_1, py_1, 3, 6);
CLOSEYUV2RGBFUNC(8)
YUV2RGBFUNC(yuv2rgb_c_1_ordered_dither, uint8_t, 0)
- const uint8_t *d128 = dither_8x8_220[y&7];
- char out_1 = 0, out_2 = 0;
- g= c->table_gU[128] + c->table_gV[128];
+ const uint8_t *d128 = dither_8x8_220[y & 7];
+ char out_1 = 0, out_2 = 0;
+ g = c->table_gU[128] + c->table_gV[128];
-#define PUTRGB1(out,src,i,o) \
- Y = src[2*i]; \
- out+= out + g[Y+d128[0+o]]; \
- Y = src[2*i+1]; \
- out+= out + g[Y+d128[1+o]];
+#define PUTRGB1(out, src, i, o) \
+ Y = src[2 * i]; \
+ out += out + g[Y + d128[0 + o]]; \
+ Y = src[2 * i + 1]; \
+ out += out + g[Y + d128[1 + o]];
- PUTRGB1(out_1,py_1,0,0);
- PUTRGB1(out_2,py_2,0,0+8);
+ PUTRGB1(out_1, py_1, 0, 0);
+ PUTRGB1(out_2, py_2, 0, 0 + 8);
- PUTRGB1(out_2,py_2,1,2+8);
- PUTRGB1(out_1,py_1,1,2);
+ PUTRGB1(out_2, py_2, 1, 2 + 8);
+ PUTRGB1(out_1, py_1, 1, 2);
- PUTRGB1(out_1,py_1,2,4);
- PUTRGB1(out_2,py_2,2,4+8);
+ PUTRGB1(out_1, py_1, 2, 4);
+ PUTRGB1(out_2, py_2, 2, 4 + 8);
- PUTRGB1(out_2,py_2,3,6+8);
- PUTRGB1(out_1,py_1,3,6);
+ PUTRGB1(out_2, py_2, 3, 6 + 8);
+ PUTRGB1(out_1, py_1, 3, 6);
- dst_1[0]= out_1;
- dst_2[0]= out_2;
+ dst_1[0] = out_1;
+ dst_2[0] = out_2;
CLOSEYUV2RGBFUNC(1)
SwsFunc ff_yuv2rgb_get_func_ptr(SwsContext *c)
{
SwsFunc t = NULL;
- if (HAVE_MMX) {
+ if (HAVE_MMX)
t = ff_yuv2rgb_init_mmx(c);
- } else if (HAVE_VIS) {
+ else if (HAVE_VIS)
t = ff_yuv2rgb_init_vis(c);
- } else if (CONFIG_MLIB) {
- t = ff_yuv2rgb_init_mlib(c);
- } else if (HAVE_ALTIVEC) {
+ else if (HAVE_ALTIVEC)
t = ff_yuv2rgb_init_altivec(c);
- } else if (ARCH_BFIN) {
+ else if (ARCH_BFIN)
t = ff_yuv2rgb_get_func_ptr_bfin(c);
- }
if (t)
return t;
- av_log(c, AV_LOG_WARNING, "No accelerated colorspace conversion found from %s to %s.\n", sws_format_name(c->srcFormat), sws_format_name(c->dstFormat));
+ av_log(c, AV_LOG_WARNING,
+ "No accelerated colorspace conversion found from %s to %s.\n",
+ sws_format_name(c->srcFormat), sws_format_name(c->dstFormat));
switch (c->dstFormat) {
- case PIX_FMT_BGR48BE:
- case PIX_FMT_BGR48LE: return yuv2rgb_c_bgr48;
- case PIX_FMT_RGB48BE:
- case PIX_FMT_RGB48LE: return yuv2rgb_c_48;
- case PIX_FMT_ARGB:
- case PIX_FMT_ABGR: if (CONFIG_SWSCALE_ALPHA && c->srcFormat == PIX_FMT_YUVA420P) return yuva2argb_c;
- case PIX_FMT_RGBA:
- case PIX_FMT_BGRA: return (CONFIG_SWSCALE_ALPHA && c->srcFormat == PIX_FMT_YUVA420P) ? yuva2rgba_c : yuv2rgb_c_32;
- case PIX_FMT_RGB24: return yuv2rgb_c_24_rgb;
- case PIX_FMT_BGR24: return yuv2rgb_c_24_bgr;
- case PIX_FMT_RGB565:
- case PIX_FMT_BGR565:
- case PIX_FMT_RGB555:
- case PIX_FMT_BGR555: return yuv2rgb_c_16;
- case PIX_FMT_RGB444:
- case PIX_FMT_BGR444: return yuv2rgb_c_12_ordered_dither;
- case PIX_FMT_RGB8:
- case PIX_FMT_BGR8: return yuv2rgb_c_8_ordered_dither;
- case PIX_FMT_RGB4:
- case PIX_FMT_BGR4: return yuv2rgb_c_4_ordered_dither;
- case PIX_FMT_RGB4_BYTE:
- case PIX_FMT_BGR4_BYTE: return yuv2rgb_c_4b_ordered_dither;
- case PIX_FMT_MONOBLACK: return yuv2rgb_c_1_ordered_dither;
+ case AV_PIX_FMT_BGR48BE:
+ case AV_PIX_FMT_BGR48LE:
+ return yuv2rgb_c_bgr48;
+ case AV_PIX_FMT_RGB48BE:
+ case AV_PIX_FMT_RGB48LE:
+ return yuv2rgb_c_48;
+ case AV_PIX_FMT_ARGB:
+ case AV_PIX_FMT_ABGR:
+ if (CONFIG_SWSCALE_ALPHA && c->srcFormat == AV_PIX_FMT_YUVA420P)
+ return yuva2argb_c;
+ case AV_PIX_FMT_RGBA:
+ case AV_PIX_FMT_BGRA:
+ if (CONFIG_SWSCALE_ALPHA && c->srcFormat == AV_PIX_FMT_YUVA420P)
+ return yuva2rgba_c;
+ else
+ return yuv2rgb_c_32;
+ case AV_PIX_FMT_RGB24:
+ return yuv2rgb_c_24_rgb;
+ case AV_PIX_FMT_BGR24:
+ return yuv2rgb_c_24_bgr;
+ case AV_PIX_FMT_RGB565:
+ case AV_PIX_FMT_BGR565:
+ case AV_PIX_FMT_RGB555:
+ case AV_PIX_FMT_BGR555:
+ return yuv2rgb_c_16;
+ case AV_PIX_FMT_RGB444:
+ case AV_PIX_FMT_BGR444:
+ return yuv2rgb_c_12_ordered_dither;
+ case AV_PIX_FMT_RGB8:
+ case AV_PIX_FMT_BGR8:
+ return yuv2rgb_c_8_ordered_dither;
+ case AV_PIX_FMT_RGB4:
+ case AV_PIX_FMT_BGR4:
+ return yuv2rgb_c_4_ordered_dither;
+ case AV_PIX_FMT_RGB4_BYTE:
+ case AV_PIX_FMT_BGR4_BYTE:
+ return yuv2rgb_c_4b_ordered_dither;
+ case AV_PIX_FMT_MONOBLACK:
+ return yuv2rgb_c_1_ordered_dither;
default:
assert(0);
}
return NULL;
}
-static void fill_table(uint8_t* table[256], const int elemsize, const int inc, void *y_tab)
+static void fill_table(uint8_t *table[256], const int elemsize,
+ const int inc, void *y_tab)
{
int i;
- int64_t cb = 0;
+ int64_t cb = 0;
uint8_t *y_table = y_tab;
y_table -= elemsize * (inc >> 9);
for (i = 0; i < 256; i++) {
table[i] = y_table + elemsize * (cb >> 16);
- cb += inc;
+ cb += inc;
}
}
@@ -571,44 +646,49 @@ static void fill_gv_table(int table[256], const int elemsize, const int inc)
{
int i;
int64_t cb = 0;
- int off = -(inc >> 9);
+ int off = -(inc >> 9);
for (i = 0; i < 256; i++) {
table[i] = elemsize * (off + (cb >> 16));
- cb += inc;
+ cb += inc;
}
}
static uint16_t roundToInt16(int64_t f)
{
- int r= (f + (1<<15))>>16;
- if (r<-0x7FFF) return 0x8000;
- else if (r> 0x7FFF) return 0x7FFF;
- else return r;
+ int r = (f + (1 << 15)) >> 16;
+
+ if (r < -0x7FFF)
+ return 0x8000;
+ else if (r > 0x7FFF)
+ return 0x7FFF;
+ else
+ return r;
}
-av_cold int ff_yuv2rgb_c_init_tables(SwsContext *c, const int inv_table[4], int fullRange,
- int brightness, int contrast, int saturation)
+av_cold int ff_yuv2rgb_c_init_tables(SwsContext *c, const int inv_table[4],
+ int fullRange, int brightness,
+ int contrast, int saturation)
{
- const int isRgb = c->dstFormat==PIX_FMT_RGB32
- || c->dstFormat==PIX_FMT_RGB32_1
- || c->dstFormat==PIX_FMT_BGR24
- || c->dstFormat==PIX_FMT_RGB565BE
- || c->dstFormat==PIX_FMT_RGB565LE
- || c->dstFormat==PIX_FMT_RGB555BE
- || c->dstFormat==PIX_FMT_RGB555LE
- || c->dstFormat==PIX_FMT_RGB444BE
- || c->dstFormat==PIX_FMT_RGB444LE
- || c->dstFormat==PIX_FMT_RGB8
- || c->dstFormat==PIX_FMT_RGB4
- || c->dstFormat==PIX_FMT_RGB4_BYTE
- || c->dstFormat==PIX_FMT_MONOBLACK;
- const int isNotNe = c->dstFormat==PIX_FMT_NE(RGB565LE,RGB565BE)
- || c->dstFormat==PIX_FMT_NE(RGB555LE,RGB555BE)
- || c->dstFormat==PIX_FMT_NE(RGB444LE,RGB444BE)
- || c->dstFormat==PIX_FMT_NE(BGR565LE,BGR565BE)
- || c->dstFormat==PIX_FMT_NE(BGR555LE,BGR555BE)
- || c->dstFormat==PIX_FMT_NE(BGR444LE,BGR444BE);
+ const int isRgb = c->dstFormat == AV_PIX_FMT_RGB32 ||
+ c->dstFormat == AV_PIX_FMT_RGB32_1 ||
+ c->dstFormat == AV_PIX_FMT_BGR24 ||
+ c->dstFormat == AV_PIX_FMT_RGB565BE ||
+ c->dstFormat == AV_PIX_FMT_RGB565LE ||
+ c->dstFormat == AV_PIX_FMT_RGB555BE ||
+ c->dstFormat == AV_PIX_FMT_RGB555LE ||
+ c->dstFormat == AV_PIX_FMT_RGB444BE ||
+ c->dstFormat == AV_PIX_FMT_RGB444LE ||
+ c->dstFormat == AV_PIX_FMT_RGB8 ||
+ c->dstFormat == AV_PIX_FMT_RGB4 ||
+ c->dstFormat == AV_PIX_FMT_RGB4_BYTE ||
+ c->dstFormat == AV_PIX_FMT_MONOBLACK;
+ const int isNotNe = c->dstFormat == AV_PIX_FMT_NE(RGB565LE, RGB565BE) ||
+ c->dstFormat == AV_PIX_FMT_NE(RGB555LE, RGB555BE) ||
+ c->dstFormat == AV_PIX_FMT_NE(RGB444LE, RGB444BE) ||
+ c->dstFormat == AV_PIX_FMT_NE(BGR565LE, BGR565BE) ||
+ c->dstFormat == AV_PIX_FMT_NE(BGR555LE, BGR555BE) ||
+ c->dstFormat == AV_PIX_FMT_NE(BGR444LE, BGR444BE);
const int bpp = c->dstFormatBpp;
uint8_t *y_table;
uint16_t *y_table16;
@@ -620,43 +700,42 @@ av_cold int ff_yuv2rgb_c_init_tables(SwsContext *c, const int inv_table[4], int
int64_t cbu = inv_table[1];
int64_t cgu = -inv_table[2];
int64_t cgv = -inv_table[3];
- int64_t cy = 1<<16;
+ int64_t cy = 1 << 16;
int64_t oy = 0;
-
- int64_t yb = 0;
+ int64_t yb = 0;
if (!fullRange) {
- cy = (cy*255) / 219;
- oy = 16<<16;
+ cy = (cy * 255) / 219;
+ oy = 16 << 16;
} else {
- crv = (crv*224) / 255;
- cbu = (cbu*224) / 255;
- cgu = (cgu*224) / 255;
- cgv = (cgv*224) / 255;
+ crv = (crv * 224) / 255;
+ cbu = (cbu * 224) / 255;
+ cgu = (cgu * 224) / 255;
+ cgv = (cgv * 224) / 255;
}
- cy = (cy *contrast ) >> 16;
- crv = (crv*contrast * saturation) >> 32;
- cbu = (cbu*contrast * saturation) >> 32;
- cgu = (cgu*contrast * saturation) >> 32;
- cgv = (cgv*contrast * saturation) >> 32;
- oy -= 256*brightness;
-
- c->uOffset= 0x0400040004000400LL;
- c->vOffset= 0x0400040004000400LL;
- c->yCoeff= roundToInt16(cy *8192) * 0x0001000100010001ULL;
- c->vrCoeff= roundToInt16(crv*8192) * 0x0001000100010001ULL;
- c->ubCoeff= roundToInt16(cbu*8192) * 0x0001000100010001ULL;
- c->vgCoeff= roundToInt16(cgv*8192) * 0x0001000100010001ULL;
- c->ugCoeff= roundToInt16(cgu*8192) * 0x0001000100010001ULL;
- c->yOffset= roundToInt16(oy * 8) * 0x0001000100010001ULL;
-
- c->yuv2rgb_y_coeff = (int16_t)roundToInt16(cy <<13);
- c->yuv2rgb_y_offset = (int16_t)roundToInt16(oy << 9);
- c->yuv2rgb_v2r_coeff= (int16_t)roundToInt16(crv<<13);
- c->yuv2rgb_v2g_coeff= (int16_t)roundToInt16(cgv<<13);
- c->yuv2rgb_u2g_coeff= (int16_t)roundToInt16(cgu<<13);
- c->yuv2rgb_u2b_coeff= (int16_t)roundToInt16(cbu<<13);
+ cy = (cy * contrast) >> 16;
+ crv = (crv * contrast * saturation) >> 32;
+ cbu = (cbu * contrast * saturation) >> 32;
+ cgu = (cgu * contrast * saturation) >> 32;
+ cgv = (cgv * contrast * saturation) >> 32;
+ oy -= 256 * brightness;
+
+ c->uOffset = 0x0400040004000400LL;
+ c->vOffset = 0x0400040004000400LL;
+ c->yCoeff = roundToInt16(cy * 8192) * 0x0001000100010001ULL;
+ c->vrCoeff = roundToInt16(crv * 8192) * 0x0001000100010001ULL;
+ c->ubCoeff = roundToInt16(cbu * 8192) * 0x0001000100010001ULL;
+ c->vgCoeff = roundToInt16(cgv * 8192) * 0x0001000100010001ULL;
+ c->ugCoeff = roundToInt16(cgu * 8192) * 0x0001000100010001ULL;
+ c->yOffset = roundToInt16(oy * 8) * 0x0001000100010001ULL;
+
+ c->yuv2rgb_y_coeff = (int16_t)roundToInt16(cy << 13);
+ c->yuv2rgb_y_offset = (int16_t)roundToInt16(oy << 9);
+ c->yuv2rgb_v2r_coeff = (int16_t)roundToInt16(crv << 13);
+ c->yuv2rgb_v2g_coeff = (int16_t)roundToInt16(cgv << 13);
+ c->yuv2rgb_u2g_coeff = (int16_t)roundToInt16(cgu << 13);
+ c->yuv2rgb_u2b_coeff = (int16_t)roundToInt16(cbu << 13);
//scale coefficients by cy
crv = ((crv << 16) + 0x8000) / cy;
@@ -669,28 +748,28 @@ av_cold int ff_yuv2rgb_c_init_tables(SwsContext *c, const int inv_table[4], int
switch (bpp) {
case 1:
c->yuvTable = av_malloc(1024);
- y_table = c->yuvTable;
- yb = -(384<<16) - oy;
- for (i = 0; i < 1024-110; i++) {
- y_table[i+110] = av_clip_uint8((yb + 0x8000) >> 16) >> 7;
- yb += cy;
+ y_table = c->yuvTable;
+ yb = -(384 << 16) - oy;
+ for (i = 0; i < 1024 - 110; i++) {
+ y_table[i + 110] = av_clip_uint8((yb + 0x8000) >> 16) >> 7;
+ yb += cy;
}
fill_table(c->table_gU, 1, cgu, y_table + yoffs);
fill_gv_table(c->table_gV, 1, cgv);
break;
case 4:
- case 4|128:
- rbase = isRgb ? 3 : 0;
- gbase = 1;
- bbase = isRgb ? 0 : 3;
- c->yuvTable = av_malloc(1024*3);
- y_table = c->yuvTable;
- yb = -(384<<16) - oy;
- for (i = 0; i < 1024-110; i++) {
- int yval = av_clip_uint8((yb + 0x8000) >> 16);
- y_table[i+110 ] = (yval >> 7) << rbase;
- y_table[i+ 37+1024] = ((yval + 43) / 85) << gbase;
- y_table[i+110+2048] = (yval >> 7) << bbase;
+ case 4 | 128:
+ rbase = isRgb ? 3 : 0;
+ gbase = 1;
+ bbase = isRgb ? 0 : 3;
+ c->yuvTable = av_malloc(1024 * 3);
+ y_table = c->yuvTable;
+ yb = -(384 << 16) - oy;
+ for (i = 0; i < 1024 - 110; i++) {
+ int yval = av_clip_uint8((yb + 0x8000) >> 16);
+ y_table[i + 110] = (yval >> 7) << rbase;
+ y_table[i + 37 + 1024] = ((yval + 43) / 85) << gbase;
+ y_table[i + 110 + 2048] = (yval >> 7) << bbase;
yb += cy;
}
fill_table(c->table_rV, 1, crv, y_table + yoffs);
@@ -699,17 +778,17 @@ av_cold int ff_yuv2rgb_c_init_tables(SwsContext *c, const int inv_table[4], int
fill_gv_table(c->table_gV, 1, cgv);
break;
case 8:
- rbase = isRgb ? 5 : 0;
- gbase = isRgb ? 2 : 3;
- bbase = isRgb ? 0 : 6;
- c->yuvTable = av_malloc(1024*3);
- y_table = c->yuvTable;
- yb = -(384<<16) - oy;
- for (i = 0; i < 1024-38; i++) {
- int yval = av_clip_uint8((yb + 0x8000) >> 16);
- y_table[i+16 ] = ((yval + 18) / 36) << rbase;
- y_table[i+16+1024] = ((yval + 18) / 36) << gbase;
- y_table[i+37+2048] = ((yval + 43) / 85) << bbase;
+ rbase = isRgb ? 5 : 0;
+ gbase = isRgb ? 2 : 3;
+ bbase = isRgb ? 0 : 6;
+ c->yuvTable = av_malloc(1024 * 3);
+ y_table = c->yuvTable;
+ yb = -(384 << 16) - oy;
+ for (i = 0; i < 1024 - 38; i++) {
+ int yval = av_clip_uint8((yb + 0x8000) >> 16);
+ y_table[i + 16] = ((yval + 18) / 36) << rbase;
+ y_table[i + 16 + 1024] = ((yval + 18) / 36) << gbase;
+ y_table[i + 37 + 2048] = ((yval + 43) / 85) << bbase;
yb += cy;
}
fill_table(c->table_rV, 1, crv, y_table + yoffs);
@@ -718,21 +797,21 @@ av_cold int ff_yuv2rgb_c_init_tables(SwsContext *c, const int inv_table[4], int
fill_gv_table(c->table_gV, 1, cgv);
break;
case 12:
- rbase = isRgb ? 8 : 0;
- gbase = 4;
- bbase = isRgb ? 0 : 8;
- c->yuvTable = av_malloc(1024*3*2);
- y_table16 = c->yuvTable;
- yb = -(384<<16) - oy;
+ rbase = isRgb ? 8 : 0;
+ gbase = 4;
+ bbase = isRgb ? 0 : 8;
+ c->yuvTable = av_malloc(1024 * 3 * 2);
+ y_table16 = c->yuvTable;
+ yb = -(384 << 16) - oy;
for (i = 0; i < 1024; i++) {
- uint8_t yval = av_clip_uint8((yb + 0x8000) >> 16);
- y_table16[i ] = (yval >> 4) << rbase;
- y_table16[i+1024] = (yval >> 4) << gbase;
- y_table16[i+2048] = (yval >> 4) << bbase;
+ uint8_t yval = av_clip_uint8((yb + 0x8000) >> 16);
+ y_table16[i] = (yval >> 4) << rbase;
+ y_table16[i + 1024] = (yval >> 4) << gbase;
+ y_table16[i + 2048] = (yval >> 4) << bbase;
yb += cy;
}
if (isNotNe)
- for (i = 0; i < 1024*3; i++)
+ for (i = 0; i < 1024 * 3; i++)
y_table16[i] = av_bswap16(y_table16[i]);
fill_table(c->table_rV, 2, crv, y_table16 + yoffs);
fill_table(c->table_gU, 2, cgu, y_table16 + yoffs + 1024);
@@ -741,21 +820,21 @@ av_cold int ff_yuv2rgb_c_init_tables(SwsContext *c, const int inv_table[4], int
break;
case 15:
case 16:
- rbase = isRgb ? bpp - 5 : 0;
- gbase = 5;
- bbase = isRgb ? 0 : (bpp - 5);
- c->yuvTable = av_malloc(1024*3*2);
- y_table16 = c->yuvTable;
- yb = -(384<<16) - oy;
+ rbase = isRgb ? bpp - 5 : 0;
+ gbase = 5;
+ bbase = isRgb ? 0 : (bpp - 5);
+ c->yuvTable = av_malloc(1024 * 3 * 2);
+ y_table16 = c->yuvTable;
+ yb = -(384 << 16) - oy;
for (i = 0; i < 1024; i++) {
- uint8_t yval = av_clip_uint8((yb + 0x8000) >> 16);
- y_table16[i ] = (yval >> 3) << rbase;
- y_table16[i+1024] = (yval >> (18 - bpp)) << gbase;
- y_table16[i+2048] = (yval >> 3) << bbase;
+ uint8_t yval = av_clip_uint8((yb + 0x8000) >> 16);
+ y_table16[i] = (yval >> 3) << rbase;
+ y_table16[i + 1024] = (yval >> (18 - bpp)) << gbase;
+ y_table16[i + 2048] = (yval >> 3) << bbase;
yb += cy;
}
- if(isNotNe)
- for (i = 0; i < 1024*3; i++)
+ if (isNotNe)
+ for (i = 0; i < 1024 * 3; i++)
y_table16[i] = av_bswap16(y_table16[i]);
fill_table(c->table_rV, 2, crv, y_table16 + yoffs);
fill_table(c->table_gU, 2, cgu, y_table16 + yoffs + 1024);
@@ -765,11 +844,11 @@ av_cold int ff_yuv2rgb_c_init_tables(SwsContext *c, const int inv_table[4], int
case 24:
case 48:
c->yuvTable = av_malloc(1024);
- y_table = c->yuvTable;
- yb = -(384<<16) - oy;
+ y_table = c->yuvTable;
+ yb = -(384 << 16) - oy;
for (i = 0; i < 1024; i++) {
- y_table[i] = av_clip_uint8((yb + 0x8000) >> 16);
- yb += cy;
+ y_table[i] = av_clip_uint8((yb + 0x8000) >> 16);
+ yb += cy;
}
fill_table(c->table_rV, 1, crv, y_table + yoffs);
fill_table(c->table_gU, 1, cgu, y_table + yoffs);
@@ -777,21 +856,23 @@ av_cold int ff_yuv2rgb_c_init_tables(SwsContext *c, const int inv_table[4], int
fill_gv_table(c->table_gV, 1, cgv);
break;
case 32:
- base = (c->dstFormat == PIX_FMT_RGB32_1 || c->dstFormat == PIX_FMT_BGR32_1) ? 8 : 0;
- rbase = base + (isRgb ? 16 : 0);
- gbase = base + 8;
- bbase = base + (isRgb ? 0 : 16);
+ base = (c->dstFormat == AV_PIX_FMT_RGB32_1 ||
+ c->dstFormat == AV_PIX_FMT_BGR32_1) ? 8 : 0;
+ rbase = base + (isRgb ? 16 : 0);
+ gbase = base + 8;
+ bbase = base + (isRgb ? 0 : 16);
needAlpha = CONFIG_SWSCALE_ALPHA && isALPHA(c->srcFormat);
if (!needAlpha)
abase = (base + 24) & 31;
- c->yuvTable = av_malloc(1024*3*4);
- y_table32 = c->yuvTable;
- yb = -(384<<16) - oy;
+ c->yuvTable = av_malloc(1024 * 3 * 4);
+ y_table32 = c->yuvTable;
+ yb = -(384 << 16) - oy;
for (i = 0; i < 1024; i++) {
- unsigned yval = av_clip_uint8((yb + 0x8000) >> 16);
- y_table32[i ] = (yval << rbase) + (needAlpha ? 0 : (255u << abase));
- y_table32[i+1024] = yval << gbase;
- y_table32[i+2048] = yval << bbase;
+ unsigned yval = av_clip_uint8((yb + 0x8000) >> 16);
+ y_table32[i] = (yval << rbase) +
+ (needAlpha ? 0 : (255u << abase));
+ y_table32[i + 1024] = yval << gbase;
+ y_table32[i + 2048] = yval << bbase;
yb += cy;
}
fill_table(c->table_rV, 4, crv, y_table32 + yoffs);
diff --git a/gst-libs/ext/libav/tests/Makefile b/gst-libs/ext/libav/tests/Makefile
index b6b33e5..8b56b4c 100644
--- a/gst-libs/ext/libav/tests/Makefile
+++ b/gst-libs/ext/libav/tests/Makefile
@@ -1,46 +1,73 @@
-AREF = fate-acodec-aref
-VREF = fate-vsynth1-vref fate-vsynth2-vref
-REFS = $(AREF) $(VREF)
+VREF = tests/vsynth1/00.pgm
+AREF = tests/data/asynth1.sw
-$(VREF): avconv$(EXESUF) tests/vsynth1/00.pgm tests/vsynth2/00.pgm
-$(AREF): avconv$(EXESUF) tests/data/asynth1.sw
+OBJDIRS += tests/data tests/vsynth1
-tests/vsynth1/00.pgm: tests/videogen$(HOSTEXESUF)
- @mkdir -p tests/vsynth1
+tests/vsynth1/00.pgm: tests/videogen$(HOSTEXESUF) | tests/vsynth1
$(M)./$< 'tests/vsynth1/'
-tests/vsynth2/00.pgm: tests/rotozoom$(HOSTEXESUF)
- @mkdir -p tests/vsynth2
- $(M)./$< 'tests/vsynth2/' $(SRC_PATH)/tests/lena.pnm
-
-tests/data/asynth1.sw: tests/audiogen$(HOSTEXESUF)
- @mkdir -p tests/data
+tests/data/asynth1.sw: tests/audiogen$(HOSTEXESUF) | tests/data
$(M)./$< $@
-tests/data/asynth-16000-1.sw: tests/audiogen$(HOSTEXESUF)
- @mkdir -p tests/data
- $(M)./$< $@ 16000 1
+tests/data/asynth-%.wav: tests/audiogen$(HOSTEXESUF) | tests/data
+ $(M)./$< $@ $(subst -, ,$*)
+
+tests/data/vsynth1.yuv: tests/videogen$(HOSTEXESUF) | tests/data
+ $(M)$< $@
+
+tests/data/vsynth2.yuv: tests/rotozoom$(HOSTEXESUF) | tests/data
+ $(M)$< $(SRC_PATH)/tests/lena.pnm $@
+
+tests/data/asynth% tests/data/vsynth%.yuv tests/vsynth%/00.pgm: TAG = GEN
+
+CHKCFG = $(if $($(1))$(!$(1)),$($(1)), $(error No such config: $(1)))
-tests/data/asynth%.sw tests/vsynth%/00.pgm: TAG = GEN
+ALLYES = $(strip $(call XYES, $(1)))
+XYES = $(if $(strip $(1)), \
+ $(if $(call CHKCFG,CONFIG_$(firstword $(1))), \
+ $(call XYES, $(wordlist 2, $(words $(1)), $(1)))), \
+ yes)
+
+ENCDEC = $(call ALLYES, $(firstword $(1))_ENCODER $(lastword $(1))_DECODER \
+ $(firstword $(2))_MUXER $(lastword $(2))_DEMUXER)
+
+ENCDEC2 = $(call ALLYES, $(firstword $(1))_ENCODER $(lastword $(1))_DECODER \
+ $(firstword $(2))_ENCODER $(lastword $(2))_DECODER \
+ $(firstword $(3))_MUXER $(lastword $(3))_DEMUXER)
+
+DEMDEC = $(call ALLYES, $(1)_DEMUXER $(2:%=%_DECODER))
+ENCMUX = $(call ALLYES, $(1:%=%_ENCODER) $(2)_MUXER)
+
+include $(SRC_PATH)/tests/fate/acodec.mak
+include $(SRC_PATH)/tests/fate/vcodec.mak
+include $(SRC_PATH)/tests/fate/avformat.mak
+include $(SRC_PATH)/tests/fate/avfilter.mak
+include $(SRC_PATH)/tests/fate/seek.mak
include $(SRC_PATH)/tests/fate/aac.mak
include $(SRC_PATH)/tests/fate/ac3.mak
include $(SRC_PATH)/tests/fate/adpcm.mak
+include $(SRC_PATH)/tests/fate/alac.mak
include $(SRC_PATH)/tests/fate/als.mak
include $(SRC_PATH)/tests/fate/amrnb.mak
include $(SRC_PATH)/tests/fate/amrwb.mak
include $(SRC_PATH)/tests/fate/atrac.mak
include $(SRC_PATH)/tests/fate/audio.mak
-include $(SRC_PATH)/tests/fate/dct.mak
+include $(SRC_PATH)/tests/fate/bmp.mak
+include $(SRC_PATH)/tests/fate/cdxl.mak
+include $(SRC_PATH)/tests/fate/cover-art.mak
include $(SRC_PATH)/tests/fate/demux.mak
include $(SRC_PATH)/tests/fate/dfa.mak
include $(SRC_PATH)/tests/fate/dpcm.mak
include $(SRC_PATH)/tests/fate/ea.mak
+include $(SRC_PATH)/tests/fate/filter.mak
+include $(SRC_PATH)/tests/fate/flac.mak
include $(SRC_PATH)/tests/fate/fft.mak
include $(SRC_PATH)/tests/fate/h264.mak
include $(SRC_PATH)/tests/fate/image.mak
include $(SRC_PATH)/tests/fate/indeo.mak
include $(SRC_PATH)/tests/fate/libavcodec.mak
+include $(SRC_PATH)/tests/fate/libavformat.mak
include $(SRC_PATH)/tests/fate/libavutil.mak
include $(SRC_PATH)/tests/fate/lossless-audio.mak
include $(SRC_PATH)/tests/fate/lossless-video.mak
@@ -48,6 +75,7 @@ include $(SRC_PATH)/tests/fate/microsoft.mak
include $(SRC_PATH)/tests/fate/mp3.mak
include $(SRC_PATH)/tests/fate/mpc.mak
include $(SRC_PATH)/tests/fate/pcm.mak
+include $(SRC_PATH)/tests/fate/probe.mak
include $(SRC_PATH)/tests/fate/prores.mak
include $(SRC_PATH)/tests/fate/qt.mak
include $(SRC_PATH)/tests/fate/qtrle.mak
@@ -59,64 +87,38 @@ include $(SRC_PATH)/tests/fate/voice.mak
include $(SRC_PATH)/tests/fate/vorbis.mak
include $(SRC_PATH)/tests/fate/vpx.mak
include $(SRC_PATH)/tests/fate/vqf.mak
+include $(SRC_PATH)/tests/fate/wavpack.mak
include $(SRC_PATH)/tests/fate/wma.mak
-FATE_ACODEC = $(ACODEC_TESTS:%=fate-acodec-%)
-FATE_VSYNTH1 = $(VCODEC_TESTS:%=fate-vsynth1-%)
-FATE_VSYNTH2 = $(VCODEC_TESTS:%=fate-vsynth2-%)
-FATE_VCODEC = $(FATE_VSYNTH1) $(FATE_VSYNTH2)
-FATE_LAVF = $(LAVF_TESTS:%=fate-lavf-%)
-FATE_LAVFI = $(LAVFI_TESTS:%=fate-lavfi-%)
-FATE_SEEK = $(SEEK_TESTS:seek_%=fate-seek-%)
-
-FATE = $(FATE_ACODEC) \
- $(FATE_VCODEC) \
- $(FATE_LAVF) \
- $(FATE_SEEK) \
+FATE_AVCONV += $(FATE_AVCONV-yes)
+FATE-$(CONFIG_AVCONV) += $(FATE_AVCONV)
-FATE-$(CONFIG_AVFILTER) += $(FATE_LAVFI)
+FATE_SAMPLES_AVCONV += $(FATE_SAMPLES_AVCONV-yes)
+FATE_SAMPLES-$(CONFIG_AVCONV) += $(FATE_SAMPLES_AVCONV)
+FATE_SAMPLES += $(FATE_SAMPLES-yes)
FATE += $(FATE-yes)
-$(filter-out %-aref,$(FATE_ACODEC)): $(AREF)
-$(filter-out %-vref,$(FATE_VSYNTH1)): fate-vsynth1-vref
-$(filter-out %-vref,$(FATE_VSYNTH2)): fate-vsynth2-vref
-$(FATE_LAVF): $(REFS)
-$(FATE_LAVFI): $(REFS) tools/lavfi-showfiltfmts$(EXESUF)
-$(FATE_SEEK): fate-codec fate-lavf libavformat/seek-test$(EXESUF)
-
-$(FATE_ACODEC): CMD = codectest acodec
-$(FATE_VSYNTH1): CMD = codectest vsynth1
-$(FATE_VSYNTH2): CMD = codectest vsynth2
-$(FATE_LAVF): CMD = lavftest
-$(FATE_LAVFI): CMD = lavfitest
-$(FATE_SEEK): CMD = seektest
-
-fate-codec: fate-acodec fate-vcodec
-fate-acodec: $(FATE_ACODEC)
-fate-vcodec: $(FATE_VCODEC)
-fate-lavf: $(FATE_LAVF)
-fate-lavfi: $(FATE_LAVFI)
-fate-seek: $(FATE_SEEK)
+$(FATE_AVCONV) $(FATE_SAMPLES_AVCONV): avconv$(EXESUF)
ifdef SAMPLES
-FATE += $(FATE_TESTS) $(FATE_TESTS-yes)
+FATE += $(FATE_SAMPLES)
fate-rsync:
- rsync -vaLW rsync://fate-suite.libav.org/fate-suite-0.8/ $(SAMPLES)
+ rsync -vaLW rsync://fate-suite.libav.org/fate-suite-9/ $(SAMPLES)
else
fate-rsync:
@echo "use 'make fate-rsync SAMPLES=/path/to/samples' to sync the fate suite"
-$(FATE_TESTS):
- @echo "SAMPLES not specified, cannot run FATE"
+$(FATE_SAMPLES):
+ @echo "$@ requires external samples and SAMPLES not specified"; false
endif
FATE_UTILS = base64 tiny_psnr
fate: $(FATE)
-$(FATE): avconv$(EXESUF) $(FATE_UTILS:%=tests/%$(HOSTEXESUF))
+$(FATE): $(FATE_UTILS:%=tests/%$(HOSTEXESUF))
@echo "TEST $(@:fate-%=%)"
- $(Q)$(SRC_PATH)/tests/fate-run.sh $@ "$(SAMPLES)" "$(TARGET_EXEC)" "$(TARGET_PATH)" '$(CMD)' '$(CMP)' '$(REF)' '$(FUZZ)' '$(THREADS)' '$(THREAD_TYPE)'
+ $(Q)$(SRC_PATH)/tests/fate-run.sh $@ "$(SAMPLES)" "$(TARGET_EXEC)" "$(TARGET_PATH)" '$(CMD)' '$(CMP)' '$(REF)' '$(FUZZ)' '$(THREADS)' '$(THREAD_TYPE)' '$(CPUFLAGS)' '$(CMP_SHIFT)' '$(CMP_TARGET)' '$(SIZE_TOLERANCE)' '$(CMP_UNIT)'
fate-list:
@printf '%s\n' $(sort $(FATE))
@@ -124,7 +126,7 @@ fate-list:
clean:: testclean
testclean:
- $(RM) -r tests/vsynth1 tests/vsynth2 tests/data
+ $(RM) -r tests/vsynth1 tests/data
$(RM) $(CLEANSUFFIXES:%=tests/%)
$(RM) $(TESTTOOLS:%=tests/%$(HOSTEXESUF))
diff --git a/gst-libs/ext/libav/tests/audiogen.c b/gst-libs/ext/libav/tests/audiogen.c
index c4d73aa..4fa4656 100644
--- a/gst-libs/ext/libav/tests/audiogen.c
+++ b/gst-libs/ext/libav/tests/audiogen.c
@@ -22,7 +22,9 @@
*/
#include <stdlib.h>
+#include <stdint.h>
#include <stdio.h>
+#include <string.h>
#define MAX_CHANNELS 8
@@ -93,12 +95,45 @@ static int int_cos(int a)
FILE *outfile;
-static void put_sample(int v)
+static void put16(int16_t v)
{
- fputc(v & 0xff, outfile);
+ fputc( v & 0xff, outfile);
fputc((v >> 8) & 0xff, outfile);
}
+static void put32(uint32_t v)
+{
+ fputc( v & 0xff, outfile);
+ fputc((v >> 8) & 0xff, outfile);
+ fputc((v >> 16) & 0xff, outfile);
+ fputc((v >> 24) & 0xff, outfile);
+}
+
+#define HEADER_SIZE 46
+#define FMT_SIZE 18
+#define SAMPLE_SIZE 2
+#define WFORMAT_PCM 0x0001
+
+static void put_wav_header(int sample_rate, int channels, int nb_samples)
+{
+ int block_align = SAMPLE_SIZE * channels;
+ int data_size = block_align * nb_samples;
+
+ fputs("RIFF", outfile);
+ put32(HEADER_SIZE + data_size);
+ fputs("WAVEfmt ", outfile);
+ put32(FMT_SIZE);
+ put16(WFORMAT_PCM);
+ put16(channels);
+ put32(sample_rate);
+ put32(block_align * sample_rate);
+ put16(block_align);
+ put16(SAMPLE_SIZE * 8);
+ put16(0);
+ fputs("data", outfile);
+ put32(data_size);
+}
+
int main(int argc, char **argv)
{
int i, a, v, j, f, amp, ampa;
@@ -107,10 +142,12 @@ int main(int argc, char **argv)
int taba[MAX_CHANNELS];
int sample_rate = 44100;
int nb_channels = 2;
+ char *ext;
- if (argc < 2 || argc > 4) {
- printf("usage: %s file [<sample rate> [<channels>]]\n"
+ if (argc < 2 || argc > 5) {
+ printf("usage: %s file [<sample rate> [<channels>] [<random seed>]]\n"
"generate a test raw 16 bit audio stream\n"
+ "If the file extension is .wav a WAVE header will be added.\n"
"default: 44100 Hz stereo\n", argv[0]);
exit(1);
}
@@ -131,27 +168,33 @@ int main(int argc, char **argv)
}
}
+ if (argc > 4)
+ seed = atoi(argv[4]);
+
outfile = fopen(argv[1], "wb");
if (!outfile) {
perror(argv[1]);
return 1;
}
+ if ((ext = strrchr(argv[1], '.')) != NULL && !strcmp(ext, ".wav"))
+ put_wav_header(sample_rate, nb_channels, 6 * sample_rate);
+
/* 1 second of single freq sinus at 1000 Hz */
a = 0;
for (i = 0; i < 1 * sample_rate; i++) {
v = (int_cos(a) * 10000) >> FRAC_BITS;
for (j = 0; j < nb_channels; j++)
- put_sample(v);
+ put16(v);
a += (1000 * FRAC_ONE) / sample_rate;
}
- /* 1 second of varing frequency between 100 and 10000 Hz */
+ /* 1 second of varying frequency between 100 and 10000 Hz */
a = 0;
for (i = 0; i < 1 * sample_rate; i++) {
v = (int_cos(a) * 10000) >> FRAC_BITS;
for (j = 0; j < nb_channels; j++)
- put_sample(v);
+ put16(v);
f = 100 + (((10000 - 100) * i) / sample_rate);
a += (f * FRAC_ONE) / sample_rate;
}
@@ -160,14 +203,14 @@ int main(int argc, char **argv)
for (i = 0; i < sample_rate / 2; i++) {
v = myrnd(&seed, 20000) - 10000;
for (j = 0; j < nb_channels; j++)
- put_sample(v);
+ put16(v);
}
/* 0.5 second of high amplitude white noise */
for (i = 0; i < sample_rate / 2; i++) {
v = myrnd(&seed, 65535) - 32768;
for (j = 0; j < nb_channels; j++)
- put_sample(v);
+ put16(v);
}
/* 1 second of unrelated ramps for each channel */
@@ -179,7 +222,7 @@ int main(int argc, char **argv)
for (i = 0; i < 1 * sample_rate; i++) {
for (j = 0; j < nb_channels; j++) {
v = (int_cos(taba[j]) * 10000) >> FRAC_BITS;
- put_sample(v);
+ put16(v);
f = tabf1[j] + (((tabf2[j] - tabf1[j]) * i) / sample_rate);
taba[j] += (f * FRAC_ONE) / sample_rate;
}
@@ -194,7 +237,7 @@ int main(int argc, char **argv)
if (j & 1)
amp = 10000 - amp;
v = (int_cos(a) * amp) >> FRAC_BITS;
- put_sample(v);
+ put16(v);
a += (500 * FRAC_ONE) / sample_rate;
ampa += (2 * FRAC_ONE) / sample_rate;
}
diff --git a/gst-libs/ext/libav/tests/codec-regression.sh b/gst-libs/ext/libav/tests/codec-regression.sh
deleted file mode 100755
index 5fd90f5..0000000
--- a/gst-libs/ext/libav/tests/codec-regression.sh
+++ /dev/null
@@ -1,435 +0,0 @@
-#!/bin/sh
-#
-# automatic regression test for avconv
-#
-#
-#set -x
-
-set -e
-
-. $(dirname $0)/regression-funcs.sh
-
-eval do_$test=y
-
-# generate reference for quality check
-if [ -n "$do_vref" ]; then
-do_avconv $raw_ref -f image2 -vcodec pgmyuv -i $raw_src -an -f rawvideo
-fi
-if [ -n "$do_aref" ]; then
-do_avconv $pcm_ref -b 128k -ac 2 -ar 44100 -f s16le -i $pcm_src -f wav
-fi
-
-if [ -n "$do_cljr" ] ; then
-do_video_encoding cljr.avi "-an -vcodec cljr"
-do_video_decoding
-fi
-
-if [ -n "$do_mpeg" ] ; then
-# mpeg1
-do_video_encoding mpeg1.mpg "-qscale 10 -f mpeg1video"
-do_video_decoding
-fi
-
-if [ -n "$do_mpeg2" ] ; then
-# mpeg2
-do_video_encoding mpeg2.mpg "-qscale 10 -vcodec mpeg2video -f mpeg1video"
-do_video_decoding
-fi
-
-if [ -n "$do_mpeg2_ivlc_qprd" ]; then
-# mpeg2 encoding intra vlc qprd
-do_video_encoding mpeg2ivlc-qprd.mpg "-vb 500k -bf 2 -trellis 1 -flags +qprd+mv0 -flags2 +ivlc -cmp 2 -subcmp 2 -mbd rd -vcodec mpeg2video -f mpeg2video"
-do_video_decoding
-fi
-
-if [ -n "$do_mpeg2_422" ]; then
-#mpeg2 4:2:2 encoding
-do_video_encoding mpeg2_422.mpg "-vb 1000k -bf 2 -trellis 1 -flags +qprd+mv0+ildct+ilme -flags2 +ivlc -mbd rd -vcodec mpeg2video -pix_fmt yuv422p -f mpeg2video"
-do_video_decoding
-fi
-
-if [ -n "$do_mpeg2_idct_int" ]; then
-# mpeg2
-do_video_encoding mpeg2_idct_int.mpg "-qscale 10 -vcodec mpeg2video -idct int -dct int -f mpeg1video"
-do_video_decoding "-idct int"
-fi
-
-if [ -n "$do_mpeg2_ilace" ]; then
-# mpeg2 encoding interlaced
-do_video_encoding mpeg2i.mpg "-qscale 10 -vcodec mpeg2video -f mpeg1video -flags +ildct+ilme"
-do_video_decoding
-fi
-
-if [ -n "$do_mpeg2thread" ] ; then
-# mpeg2 encoding interlaced
-do_video_encoding mpeg2thread.mpg "-qscale 10 -vcodec mpeg2video -f mpeg1video -bf 2 -flags +ildct+ilme -threads 2 -slices 2"
-do_video_decoding
-fi
-
-if [ -n "$do_mpeg2thread_ilace" ]; then
-# mpeg2 encoding interlaced using intra vlc
-do_video_encoding mpeg2threadivlc.mpg "-qscale 10 -vcodec mpeg2video -f mpeg1video -bf 2 -flags +ildct+ilme -flags2 +ivlc -threads 2 -slices 2"
-do_video_decoding
-fi
-
-if [ -n "$do_msmpeg4v2" ] ; then
-do_video_encoding msmpeg4v2.avi "-qscale 10 -an -vcodec msmpeg4v2"
-do_video_decoding
-fi
-
-if [ -n "$do_msmpeg4" ] ; then
-do_video_encoding msmpeg4.avi "-qscale 10 -an -vcodec msmpeg4"
-do_video_decoding
-fi
-
-if [ -n "$do_wmv1" ] ; then
-do_video_encoding wmv1.avi "-qscale 10 -an -vcodec wmv1"
-do_video_decoding
-fi
-
-if [ -n "$do_wmv2" ] ; then
-do_video_encoding wmv2.avi "-qscale 10 -an -vcodec wmv2"
-do_video_decoding
-fi
-
-if [ -n "$do_h261" ] ; then
-do_video_encoding h261.avi "-qscale 11 -s 352x288 -an -vcodec h261"
-do_video_decoding
-fi
-
-if [ -n "$do_h263" ] ; then
-do_video_encoding h263.avi "-qscale 10 -s 352x288 -an -vcodec h263"
-do_video_decoding
-fi
-
-if [ -n "$do_h263p" ] ; then
-do_video_encoding h263p.avi "-qscale 2 -flags +umv+aiv+aic -s 352x288 -an -vcodec h263p -ps 300"
-do_video_decoding
-fi
-
-if [ -n "$do_mpeg4" ] ; then
-do_video_encoding odivx.mp4 "-flags +mv4 -mbd bits -qscale 10 -an -vcodec mpeg4"
-do_video_decoding
-fi
-
-if [ -n "$do_huffyuv" ] ; then
-do_video_encoding huffyuv.avi "-an -vcodec huffyuv -pix_fmt yuv422p -sws_flags neighbor+bitexact"
-do_video_decoding "" "-strict -2 -pix_fmt yuv420p -sws_flags neighbor+bitexact"
-fi
-
-if [ -n "$do_rc" ] ; then
-do_video_encoding mpeg4-rc.avi "-b 400k -bf 2 -an -vcodec mpeg4"
-do_video_decoding
-fi
-
-if [ -n "$do_mpeg4adv" ] ; then
-do_video_encoding mpeg4-adv.avi "-qscale 9 -flags +mv4+part+aic -trellis 1 -mbd bits -ps 200 -an -vcodec mpeg4"
-do_video_decoding
-fi
-
-if [ -n "$do_mpeg4_qprd" ]; then
-do_video_encoding mpeg4-qprd.avi "-b 450k -bf 2 -trellis 1 -flags +mv4+qprd+mv0 -cmp 2 -subcmp 2 -mbd rd -an -vcodec mpeg4"
-do_video_decoding
-fi
-
-if [ -n "$do_mpeg4_adap" ]; then
-do_video_encoding mpeg4-adap.avi "-b 550k -bf 2 -flags +mv4+mv0 -trellis 1 -cmp 1 -subcmp 2 -mbd rd -scplx_mask 0.3 -an -vcodec mpeg4"
-do_video_decoding
-fi
-
-if [ -n "$do_mpeg4_qpel" ]; then
-do_video_encoding mpeg4-Q.avi "-qscale 7 -flags +mv4+qpel -mbd 2 -bf 2 -cmp 1 -subcmp 2 -an -vcodec mpeg4"
-do_video_decoding
-fi
-
-if [ -n "$do_mpeg4thread" ] ; then
-do_video_encoding mpeg4-thread.avi "-b 500k -flags +mv4+part+aic -trellis 1 -mbd bits -ps 200 -bf 2 -an -vcodec mpeg4 -threads 2 -slices 2"
-do_video_decoding
-fi
-
-if [ -n "$do_error" ] ; then
-do_video_encoding error-mpeg4-adv.avi "-qscale 7 -flags +mv4+part+aic -mbd rd -ps 250 -error 10 -an -vcodec mpeg4"
-do_video_decoding
-fi
-
-if [ -n "$do_mpeg4nr" ] ; then
-do_video_encoding mpeg4-nr.avi "-qscale 8 -flags +mv4 -mbd rd -nr 200 -an -vcodec mpeg4"
-do_video_decoding
-fi
-
-if [ -n "$do_mpeg1b" ] ; then
-do_video_encoding mpeg1b.mpg "-qscale 8 -bf 3 -ps 200 -an -vcodec mpeg1video -f mpeg1video"
-do_video_decoding
-fi
-
-if [ -n "$do_mjpeg" ] ; then
-do_video_encoding mjpeg.avi "-qscale 9 -an -vcodec mjpeg -pix_fmt yuvj420p"
-do_video_decoding "" "-pix_fmt yuv420p"
-fi
-
-if [ -n "$do_ljpeg" ] ; then
-do_video_encoding ljpeg.avi "-an -vcodec ljpeg -strict -1"
-do_video_decoding
-fi
-
-if [ -n "$do_jpegls" ] ; then
-do_video_encoding jpegls.avi "-an -vcodec jpegls -vtag MJPG -sws_flags neighbor+full_chroma_int+accurate_rnd+bitexact"
-do_video_decoding "" "-pix_fmt yuv420p -sws_flags area+bitexact"
-fi
-
-if [ -n "$do_rv10" ] ; then
-do_video_encoding rv10.rm "-qscale 10 -an"
-do_video_decoding
-fi
-
-if [ -n "$do_rv20" ] ; then
-do_video_encoding rv20.rm "-qscale 10 -vcodec rv20 -an"
-do_video_decoding
-fi
-
-if [ -n "$do_asv1" ] ; then
-do_video_encoding asv1.avi "-qscale 10 -an -vcodec asv1"
-do_video_decoding
-fi
-
-if [ -n "$do_asv2" ] ; then
-do_video_encoding asv2.avi "-qscale 10 -an -vcodec asv2"
-do_video_decoding
-fi
-
-if [ -n "$do_flv" ] ; then
-do_video_encoding flv.flv "-qscale 10 -an -vcodec flv"
-do_video_decoding
-fi
-
-if [ -n "$do_ffv1" ] ; then
-do_video_encoding ffv1.avi "-strict -2 -an -vcodec ffv1"
-do_video_decoding
-fi
-
-if [ -n "$do_snow" ] ; then
-do_video_encoding snow.avi "-strict -2 -an -vcodec snow -qscale 2 -flags +qpel -me_method iter -dia_size 2 -cmp 12 -subcmp 12 -s 128x64"
-do_video_decoding "" "-s 352x288"
-fi
-
-if [ -n "$do_snowll" ] ; then
-do_video_encoding snow53.avi "-strict -2 -an -vcodec snow -qscale .001 -pred 1 -flags +mv4+qpel"
-do_video_decoding
-fi
-
-if [ -n "$do_dv" ] ; then
-do_video_encoding dv.dv "-dct int -s pal -an"
-do_video_decoding "" "-s cif"
-fi
-
-if [ -n "$do_dv_411" ]; then
-do_video_encoding dv411.dv "-dct int -s pal -an -pix_fmt yuv411p -sws_flags area+accurate_rnd+bitexact"
-do_video_decoding "" "-s cif -sws_flags area+accurate_rnd+bitexact"
-fi
-
-if [ -n "$do_dv50" ] ; then
-do_video_encoding dv50.dv "-dct int -s pal -pix_fmt yuv422p -an -sws_flags neighbor+bitexact"
-do_video_decoding "" "-s cif -pix_fmt yuv420p -sws_flags neighbor+bitexact"
-fi
-
-if [ -n "$do_dnxhd_1080i" ] ; then
-# FIXME: interlaced raw DNxHD decoding is broken
-do_video_encoding dnxhd-1080i.mov "-vcodec dnxhd -flags +ildct -s hd1080 -b 120M -pix_fmt yuv422p -vframes 5 -an"
-do_video_decoding "" "-s cif -pix_fmt yuv420p"
-fi
-
-if [ -n "$do_dnxhd_720p" ] ; then
-do_video_encoding dnxhd-720p.dnxhd "-s hd720 -b 90M -pix_fmt yuv422p -vframes 5 -an"
-do_video_decoding "" "-s cif -pix_fmt yuv420p"
-fi
-
-if [ -n "$do_dnxhd_720p_rd" ] ; then
-do_video_encoding dnxhd-720p-rd.dnxhd "-threads 4 -mbd rd -s hd720 -b 90M -pix_fmt yuv422p -vframes 5 -an"
-do_video_decoding "" "-s cif -pix_fmt yuv420p"
-fi
-
-if [ -n "$do_dnxhd_720p_10bit" ] ; then
-do_video_encoding dnxhd-720p-10bit.dnxhd "-s hd720 -b 90M -pix_fmt yuv422p10 -vframes 5 -an"
-do_video_decoding "" "-s cif -pix_fmt yuv420p"
-fi
-
-if [ -n "$do_svq1" ] ; then
-do_video_encoding svq1.mov "-an -vcodec svq1 -qscale 3 -pix_fmt yuv410p"
-do_video_decoding "" "-pix_fmt yuv420p"
-fi
-
-if [ -n "$do_flashsv" ] ; then
-do_video_encoding flashsv.flv "-an -vcodec flashsv -sws_flags neighbor+full_chroma_int+accurate_rnd+bitexact"
-do_video_decoding "" "-pix_fmt yuv420p -sws_flags area+accurate_rnd+bitexact"
-fi
-
-if [ -n "$do_roq" ] ; then
-do_video_encoding roqav.roq "-vframes 5"
-do_video_decoding "" "-pix_fmt yuv420p"
-fi
-
-if [ -n "$do_qtrle" ] ; then
-do_video_encoding qtrle.mov "-an -vcodec qtrle"
-do_video_decoding "" "-pix_fmt yuv420p"
-fi
-
-if [ -n "$do_rgb" ] ; then
-do_video_encoding rgb.avi "-an -vcodec rawvideo -pix_fmt bgr24"
-do_video_decoding "" "-pix_fmt yuv420p"
-fi
-
-if [ -n "$do_v210" ] ; then
-do_video_encoding v210.avi "-an -c:v v210"
-do_video_decoding "" "-pix_fmt yuv420p"
-fi
-
-if [ -n "$do_yuv" ] ; then
-do_video_encoding yuv.avi "-an -vcodec rawvideo -pix_fmt yuv420p"
-do_video_decoding "" "-pix_fmt yuv420p"
-fi
-
-if [ -n "$do_mp2" ] ; then
-do_audio_encoding mp2.mp2
-do_audio_decoding
-$tiny_psnr $pcm_dst $pcm_ref 2 1924
-fi
-
-if [ -n "$do_ac3_fixed" ] ; then
-do_audio_encoding ac3.rm "-vn -acodec ac3_fixed"
-# binaries configured with --disable-sse decode ac3 differently
-#do_audio_decoding
-#$tiny_psnr $pcm_dst $pcm_ref 2 1024
-fi
-
-if [ -n "$do_g722" ] ; then
-do_audio_encoding g722.wav "-b 64k -ac 1 -ar 16000 -acodec g722"
-do_audio_decoding
-fi
-
-if [ -n "$do_g726" ] ; then
-do_audio_encoding g726.wav "-b 32k -ac 1 -ar 8000 -acodec g726"
-do_audio_decoding
-fi
-
-if [ -n "$do_adpcm_adx" ] ; then
-do_audio_encoding adpcm_adx.adx "-acodec adpcm_adx"
-do_audio_decoding
-fi
-
-if [ -n "$do_adpcm_ima_wav" ] ; then
-do_audio_encoding adpcm_ima.wav "-acodec adpcm_ima_wav"
-do_audio_decoding
-fi
-
-if [ -n "$do_adpcm_ima_qt" ] ; then
-do_audio_encoding adpcm_qt.aiff "-acodec adpcm_ima_qt"
-do_audio_decoding
-fi
-
-if [ -n "$do_adpcm_ms" ] ; then
-do_audio_encoding adpcm_ms.wav "-acodec adpcm_ms"
-do_audio_decoding
-fi
-
-if [ -n "$do_adpcm_yam" ] ; then
-do_audio_encoding adpcm_yam.wav "-acodec adpcm_yamaha"
-do_audio_decoding
-fi
-
-if [ -n "$do_adpcm_swf" ] ; then
-do_audio_encoding adpcm_swf.flv "-acodec adpcm_swf"
-do_audio_decoding
-fi
-
-if [ -n "$do_alac" ] ; then
-do_audio_encoding alac.m4a "-acodec alac -compression_level 1"
-do_audio_decoding
-fi
-
-if [ -n "$do_flac" ] ; then
-do_audio_encoding flac.flac "-acodec flac -compression_level 2"
-do_audio_decoding
-fi
-
-if [ -n "$do_wmav1" ] ; then
-do_audio_encoding wmav1.asf "-acodec wmav1"
-do_avconv_nomd5 $pcm_dst $DEC_OPTS -i $target_path/$file -f wav
-$tiny_psnr $pcm_dst $pcm_ref 2 8192
-fi
-if [ -n "$do_wmav2" ] ; then
-do_audio_encoding wmav2.asf "-acodec wmav2"
-do_avconv_nomd5 $pcm_dst $DEC_OPTS -i $target_path/$file -f wav
-$tiny_psnr $pcm_dst $pcm_ref 2 8192
-fi
-
-#if [ -n "$do_vorbis" ] ; then
-# vorbis
-#disabled because it is broken
-#do_audio_encoding vorbis.asf "-acodec vorbis"
-#do_audio_decoding
-#fi
-
-do_audio_enc_dec() {
- do_audio_encoding $3.$1 "$4 -sample_fmt $2 -acodec $3"
- do_audio_decoding
-}
-
-if [ -n "$do_pcm_alaw" ] ; then
-do_audio_enc_dec wav s16 pcm_alaw
-fi
-if [ -n "$do_pcm_mulaw" ] ; then
-do_audio_enc_dec wav s16 pcm_mulaw
-fi
-if [ -n "$do_pcm_s8" ] ; then
-do_audio_enc_dec mov u8 pcm_s8
-fi
-if [ -n "$do_pcm_u8" ] ; then
-do_audio_enc_dec wav u8 pcm_u8
-fi
-if [ -n "$do_pcm_s16be" ] ; then
-do_audio_enc_dec mov s16 pcm_s16be
-fi
-if [ -n "$do_pcm_s16le" ] ; then
-do_audio_enc_dec wav s16 pcm_s16le
-fi
-if [ -n "$do_pcm_s24be" ] ; then
-do_audio_enc_dec mov s32 pcm_s24be
-fi
-if [ -n "$do_pcm_s24le" ] ; then
-do_audio_enc_dec wav s32 pcm_s24le
-fi
-# no compatible muxer or demuxer
-# if [ -n "$do_pcm_u24be" ] ; then
-# do_audio_enc_dec ??? u32 pcm_u24be
-# fi
-# if [ -n "$do_pcm_u24le" ] ; then
-# do_audio_enc_dec ??? u32 pcm_u24le
-# fi
-if [ -n "$do_pcm_s32be" ] ; then
-do_audio_enc_dec mov s32 pcm_s32be
-fi
-if [ -n "$do_pcm_s32le" ] ; then
-do_audio_enc_dec wav s32 pcm_s32le
-fi
-# no compatible muxer or demuxer
-# if [ -n "$do_pcm_u32be" ] ; then
-# do_audio_enc_dec ??? u32 pcm_u32be
-# fi
-# if [ -n "$do_pcm_u32le" ] ; then
-# do_audio_enc_dec ??? u32 pcm_u32le
-# fi
-if [ -n "$do_pcm_f32be" ] ; then
-do_audio_enc_dec au flt pcm_f32be
-fi
-if [ -n "$do_pcm_f32le" ] ; then
-do_audio_enc_dec wav flt pcm_f32le
-fi
-if [ -n "$do_pcm_f64be" ] ; then
-do_audio_enc_dec au dbl pcm_f64be
-fi
-if [ -n "$do_pcm_f64le" ] ; then
-do_audio_enc_dec wav dbl pcm_f64le
-fi
-if [ -n "$do_pcm_s24daud" ] ; then
-do_audio_enc_dec 302 s16 pcm_s24daud "-ac 6 -ar 96000"
-fi
diff --git a/gst-libs/ext/libav/tests/fate-run.sh b/gst-libs/ext/libav/tests/fate-run.sh
index 07cfe74..d1633e8 100755
--- a/gst-libs/ext/libav/tests/fate-run.sh
+++ b/gst-libs/ext/libav/tests/fate-run.sh
@@ -14,9 +14,14 @@ target_path=$4
command=$5
cmp=${6:-diff}
ref=${7:-"${base}/ref/fate/${test}"}
-fuzz=$8
+fuzz=${8:-1}
threads=${9:-1}
thread_type=${10:-frame+slice}
+cpuflags=${11:-all}
+cmp_shift=${12:-0}
+cmp_target=${13:-0}
+size_tolerance=${14:-0}
+cmp_unit=${15:-2}
outdir="tests/data/fate"
outfile="${outdir}/${test}"
@@ -24,24 +29,40 @@ errfile="${outdir}/${test}.err"
cmpfile="${outdir}/${test}.diff"
repfile="${outdir}/${test}.rep"
+target_path(){
+ test ${1} = ${1#/} && p=${target_path}/
+ echo ${p}${1}
+}
+
+# $1=value1, $2=value2, $3=threshold
+# prints 0 if absolute difference between value1 and value2 is <= threshold
+compare(){
+ echo "scale=2; v = $1 - $2; if (v < 0) v = -v; if (v > $3) r = 1; r" | bc
+}
+
do_tiny_psnr(){
- psnr=$(tests/tiny_psnr "$1" "$2" 2 0 0)
+ psnr=$(tests/tiny_psnr "$1" "$2" $cmp_unit $cmp_shift 0)
val=$(expr "$psnr" : ".*$3: *\([0-9.]*\)")
size1=$(expr "$psnr" : '.*bytes: *\([0-9]*\)')
size2=$(expr "$psnr" : '.*bytes:[ 0-9]*/ *\([0-9]*\)')
- res=$(echo "if ($val $4 $5) 1" | bc)
- if [ "$res" != 1 ] || [ $size1 != $size2 ]; then
+ val_cmp=$(compare $val $cmp_target $fuzz)
+ size_cmp=$(compare $size1 $size2 $size_tolerance)
+ if [ "$val_cmp" != 0 ] || [ "$size_cmp" != 0 ]; then
echo "$psnr"
return 1
fi
}
oneoff(){
- do_tiny_psnr "$1" "$2" MAXDIFF '<=' ${fuzz:-1}
+ do_tiny_psnr "$1" "$2" MAXDIFF
}
stddev(){
- do_tiny_psnr "$1" "$2" stddev '<=' ${fuzz:-1}
+ do_tiny_psnr "$1" "$2" stddev
+}
+
+oneline(){
+ printf '%s\n' "$1" | diff -u -b - "$2"
}
run(){
@@ -49,8 +70,18 @@ run(){
$target_exec $target_path/"$@"
}
+probefmt(){
+ run avprobe -show_format_entry format_name -v 0 "$@"
+}
+
avconv(){
- run avconv -nostats -threads $threads -thread_type $thread_type "$@"
+ dec_opts="-threads $threads -thread_type $thread_type"
+ avconv_args="-nostats -cpuflags $cpuflags"
+ for arg in $@; do
+ [ x${arg} = x-i ] && avconv_args="${avconv_args} ${dec_opts}"
+ avconv_args="${avconv_args} ${arg}"
+ done
+ run avconv ${avconv_args}
}
framecrc(){
@@ -73,14 +104,51 @@ pcm(){
avconv "$@" -vn -f s16le -
}
+enc_dec_pcm(){
+ out_fmt=$1
+ dec_fmt=$2
+ pcm_fmt=$3
+ src_file=$(target_path $4)
+ shift 4
+ encfile="${outdir}/${test}.${out_fmt}"
+ cleanfiles=$encfile
+ encfile=$(target_path ${encfile})
+ avconv -i $src_file "$@" -f $out_fmt -y ${encfile} || return
+ avconv -f $out_fmt -i ${encfile} -c:a pcm_${pcm_fmt} -f ${dec_fmt} -
+}
+
+FLAGS="-flags +bitexact -sws_flags +accurate_rnd+bitexact"
+DEC_OPTS="-threads $threads -idct simple $FLAGS"
+ENC_OPTS="-threads 1 -idct simple -dct fastint"
+
+enc_dec(){
+ src_fmt=$1
+ srcfile=$2
+ enc_fmt=$3
+ enc_opt=$4
+ dec_fmt=$5
+ dec_opt=$6
+ encfile="${outdir}/${test}.${enc_fmt}"
+ decfile="${outdir}/${test}.out.${dec_fmt}"
+ cleanfiles="$cleanfiles $decfile"
+ test "$7" = -keep || cleanfiles="$cleanfiles $encfile"
+ tsrcfile=$(target_path $srcfile)
+ tencfile=$(target_path $encfile)
+ tdecfile=$(target_path $decfile)
+ avconv -f $src_fmt $DEC_OPTS -i $tsrcfile $ENC_OPTS $enc_opt $FLAGS \
+ -f $enc_fmt -y $tencfile || return
+ do_md5sum $encfile
+ echo $(wc -c $encfile)
+ avconv $DEC_OPTS -i $tencfile $ENC_OPTS $dec_opt $FLAGS \
+ -f $dec_fmt -y $tdecfile || return
+ do_md5sum $decfile
+ tests/tiny_psnr $srcfile $decfile $cmp_unit $cmp_shift
+}
+
regtest(){
t="${test#$2-}"
ref=${base}/ref/$2/$t
- ${base}/${1}-regression.sh $t $2 $3 "$target_exec" "$target_path" "$threads" "$thread_type"
-}
-
-codectest(){
- regtest codec $1 tests/$1
+ ${base}/${1}-regression.sh $t $2 $3 "$target_exec" "$target_path" "$threads" "$thread_type" "$cpuflags"
}
lavftest(){
@@ -92,25 +160,10 @@ lavfitest(){
regtest lavfi lavfi tests/vsynth1
}
-seektest(){
- t="${test#seek-}"
- ref=${base}/ref/seek/$t
- case $t in
- image_*) file="tests/data/images/${t#image_}/%02d.${t#image_}" ;;
- *) file=$(echo $t | tr _ '?')
- for d in acodec vsynth2 lavf; do
- test -f tests/data/$d/$file && break
- done
- file=$(echo tests/data/$d/$file)
- ;;
- esac
- run libavformat/seek-test $target_path/$file
-}
-
mkdir -p "$outdir"
exec 3>&2
-$command > "$outfile" 2>$errfile
+eval $command >"$outfile" 2>$errfile
err=$?
if [ $err -gt 128 ]; then
@@ -118,11 +171,12 @@ if [ $err -gt 128 ]; then
test "${sig}" = "${sig%[!A-Za-z]*}" || unset sig
fi
-if test -e "$ref"; then
+if test -e "$ref" || test $cmp = "oneline" ; then
case $cmp in
- diff) diff -u -w "$ref" "$outfile" >$cmpfile ;;
- oneoff) oneoff "$ref" "$outfile" "$fuzz" >$cmpfile ;;
- stddev) stddev "$ref" "$outfile" "$fuzz" >$cmpfile ;;
+ diff) diff -u -b "$ref" "$outfile" >$cmpfile ;;
+ oneoff) oneoff "$ref" "$outfile" >$cmpfile ;;
+ stddev) stddev "$ref" "$outfile" >$cmpfile ;;
+ oneline)oneline "$ref" "$outfile" >$cmpfile ;;
null) cat "$outfile" >$cmpfile ;;
esac
cmperr=$?
diff --git a/gst-libs/ext/libav/tests/fate.sh b/gst-libs/ext/libav/tests/fate.sh
index e04c871..86e4178 100755
--- a/gst-libs/ext/libav/tests/fate.sh
+++ b/gst-libs/ext/libav/tests/fate.sh
@@ -49,6 +49,7 @@ configure()(
${cpu:+--cpu="$cpu"} \
${cross_prefix:+--cross-prefix="$cross_prefix"} \
${cc:+--cc="$cc"} \
+ ${ld:+--ld="$ld"} \
${target_os:+--target-os="$target_os"} \
${sysroot:+--sysroot="$sysroot"} \
${target_exec:+--target-exec="$target_exec"} \
diff --git a/gst-libs/ext/libav/tests/fate/aac.mak b/gst-libs/ext/libav/tests/fate/aac.mak
index ea87436..e840bf0 100644
--- a/gst-libs/ext/libav/tests/fate/aac.mak
+++ b/gst-libs/ext/libav/tests/fate/aac.mak
@@ -8,15 +8,15 @@ fate-aac-al05_44: REF = $(SAMPLES)/aac/al05_44.s16
FATE_AAC += fate-aac-al06_44
fate-aac-al06_44: CMD = pcm -i $(SAMPLES)/aac/al06_44.mp4
-fate-aac-al06_44: REF = $(SAMPLES)/aac/al06_44.s16
+fate-aac-al06_44: REF = $(SAMPLES)/aac/al06_44_reorder.s16
FATE_AAC += fate-aac-al07_96
fate-aac-al07_96: CMD = pcm -i $(SAMPLES)/aac/al07_96.mp4
-fate-aac-al07_96: REF = $(SAMPLES)/aac/al07_96.s16
+fate-aac-al07_96: REF = $(SAMPLES)/aac/al07_96_reorder.s16
FATE_AAC += fate-aac-al15_44
fate-aac-al15_44: CMD = pcm -i $(SAMPLES)/aac/al15_44.mp4
-fate-aac-al15_44: REF = $(SAMPLES)/aac/al15_44.s16
+fate-aac-al15_44: REF = $(SAMPLES)/aac/al15_44_reorder.s16
FATE_AAC += fate-aac-al17_44
fate-aac-al17_44: CMD = pcm -i $(SAMPLES)/aac/al17_44.mp4
@@ -32,7 +32,7 @@ fate-aac-am00_88: REF = $(SAMPLES)/aac/am00_88.s16
FATE_AAC += fate-aac-am05_44
fate-aac-am05_44: CMD = pcm -i $(SAMPLES)/aac/am05_44.mp4
-fate-aac-am05_44: REF = $(SAMPLES)/aac/am05_44.s16
+fate-aac-am05_44: REF = $(SAMPLES)/aac/am05_44_reorder.s16
FATE_AAC += fate-aac-al_sbr_hq_cm_48_2
fate-aac-al_sbr_hq_cm_48_2: CMD = pcm -i $(SAMPLES)/aac/al_sbr_cm_48_2.mp4
@@ -40,30 +40,23 @@ fate-aac-al_sbr_hq_cm_48_2: REF = $(SAMPLES)/aac/al_sbr_hq_cm_48_2.s16
FATE_AAC += fate-aac-al_sbr_hq_cm_48_5.1
fate-aac-al_sbr_hq_cm_48_5.1: CMD = pcm -i $(SAMPLES)/aac/al_sbr_cm_48_5.1.mp4
-fate-aac-al_sbr_hq_cm_48_5.1: REF = $(SAMPLES)/aac/al_sbr_hq_cm_48_5.1.s16
+fate-aac-al_sbr_hq_cm_48_5.1: REF = $(SAMPLES)/aac/al_sbr_hq_cm_48_5.1_reorder.s16
FATE_AAC += fate-aac-al_sbr_ps_06_ur
fate-aac-al_sbr_ps_06_ur: CMD = pcm -i $(SAMPLES)/aac/al_sbr_ps_06_new.mp4
fate-aac-al_sbr_ps_06_ur: REF = $(SAMPLES)/aac/al_sbr_ps_06_ur.s16
-FATE_AAC += fate-aac-latm_000000001180bc60
-fate-aac-latm_000000001180bc60: CMD = pcm -i $(SAMPLES)/aac/latm_000000001180bc60.mpg
-fate-aac-latm_000000001180bc60: REF = $(SAMPLES)/aac/latm_000000001180bc60.s16
-
FATE_AAC += fate-aac-ap05_48
fate-aac-ap05_48: CMD = pcm -i $(SAMPLES)/aac/ap05_48.mp4
fate-aac-ap05_48: REF = $(SAMPLES)/aac/ap05_48.s16
-FATE_AAC += fate-aac-latm_stereo_to_51
-fate-aac-latm_stereo_to_51: CMD = pcm -i $(SAMPLES)/aac/latm_stereo_to_51.ts -ac 6
-fate-aac-latm_stereo_to_51: REF = $(SAMPLES)/aac/latm_stereo_to_51.s16
-
fate-aac-ct%: CMD = pcm -i $(SAMPLES)/aac/CT_DecoderCheck/$(@:fate-aac-ct-%=%)
fate-aac-ct%: REF = $(SAMPLES)/aac/CT_DecoderCheck/aacPlusv2.wav
+FATE_AAC_CT_RAW = fate-aac-ct-sbr_i-ps_i.aac
+
FATE_AAC_CT = sbr_bc-ps_i.3gp \
sbr_bic-ps_i.3gp \
- sbr_i-ps_i.aac \
sbr_bc-ps_bc.mp4 \
sbr_bc-ps_i.mp4 \
sbr_i-ps_bic.mp4 \
@@ -71,7 +64,24 @@ FATE_AAC_CT = sbr_bc-ps_i.3gp \
FATE_AAC += $(FATE_AAC_CT:%=fate-aac-ct-%)
-FATE_TESTS += $(FATE_AAC)
-fate-aac: $(FATE_AAC)
-$(FATE_AAC): CMP = oneoff
-$(FATE_AAC): FUZZ = 2
+FATE_AAC_LATM += fate-aac-latm_000000001180bc60
+fate-aac-latm_000000001180bc60: CMD = pcm -i $(SAMPLES)/aac/latm_000000001180bc60.mpg
+fate-aac-latm_000000001180bc60: REF = $(SAMPLES)/aac/latm_000000001180bc60.s16
+
+FATE_AAC_LATM += fate-aac-latm_stereo_to_51
+fate-aac-latm_stereo_to_51: CMD = pcm -i $(SAMPLES)/aac/latm_stereo_to_51.ts -channel_layout 5.1
+fate-aac-latm_stereo_to_51: REF = $(SAMPLES)/aac/latm_stereo_to_51_ref.s16
+
+FATE_AAC-$(call DEMDEC, AAC, AAC) += $(FATE_AAC_CT_RAW)
+FATE_AAC-$(call DEMDEC, MOV, AAC) += $(FATE_AAC)
+FATE_AAC_LATM-$(call DEMDEC, MPEGTS, AAC_LATM) += $(FATE_AAC_LATM)
+
+FATE_AAC_ALL = $(FATE_AAC-yes) $(FATE_AAC_LATM-yes)
+
+$(FATE_AAC_ALL): CMP = oneoff
+$(FATE_AAC_ALL): FUZZ = 2
+
+FATE_SAMPLES_AVCONV += $(FATE_AAC_ALL)
+
+fate-aac: $(FATE_AAC_ALL)
+fate-aac-latm: $(FATE_AAC_LATM-yes)
diff --git a/gst-libs/ext/libav/tests/fate/ac3.mak b/gst-libs/ext/libav/tests/fate/ac3.mak
index 83b13b6..46e7a38 100644
--- a/gst-libs/ext/libav/tests/fate/ac3.mak
+++ b/gst-libs/ext/libav/tests/fate/ac3.mak
@@ -1,32 +1,76 @@
FATE_AC3 += fate-ac3-2.0
fate-ac3-2.0: CMD = pcm -i $(SAMPLES)/ac3/monsters_inc_2.0_192_small.ac3
-fate-ac3-2.0: CMP = oneoff
fate-ac3-2.0: REF = $(SAMPLES)/ac3/monsters_inc_2.0_192_small.pcm
+FATE_AC3 += fate-ac3-4.0
+fate-ac3-4.0: CMD = pcm -i $(SAMPLES)/ac3/millers_crossing_4.0.ac3
+fate-ac3-4.0: REF = $(SAMPLES)/ac3/millers_crossing_4.0.pcm
+
+FATE_AC3 += fate-ac3-4.0-downmix-mono
+fate-ac3-4.0-downmix-mono: CMD = pcm -request_channels 1 -i $(SAMPLES)/ac3/millers_crossing_4.0.ac3
+fate-ac3-4.0-downmix-mono: REF = $(SAMPLES)/ac3/millers_crossing_4.0_mono.pcm
+
+FATE_AC3 += fate-ac3-4.0-downmix-stereo
+fate-ac3-4.0-downmix-stereo: CMD = pcm -request_channels 2 -i $(SAMPLES)/ac3/millers_crossing_4.0.ac3
+fate-ac3-4.0-downmix-stereo: REF = $(SAMPLES)/ac3/millers_crossing_4.0_stereo.pcm
+
FATE_AC3 += fate-ac3-5.1
fate-ac3-5.1: CMD = pcm -i $(SAMPLES)/ac3/monsters_inc_5.1_448_small.ac3
-fate-ac3-5.1: CMP = oneoff
fate-ac3-5.1: REF = $(SAMPLES)/ac3/monsters_inc_5.1_448_small.pcm
-FATE_AC3 += fate-eac3-1
+FATE_AC3 += fate-ac3-5.1-downmix-mono
+fate-ac3-5.1-downmix-mono: CMD = pcm -request_channels 1 -i $(SAMPLES)/ac3/monsters_inc_5.1_448_small.ac3
+fate-ac3-5.1-downmix-mono: REF = $(SAMPLES)/ac3/monsters_inc_5.1_448_small_mono.pcm
+
+FATE_AC3 += fate-ac3-5.1-downmix-stereo
+fate-ac3-5.1-downmix-stereo: CMD = pcm -request_channels 2 -i $(SAMPLES)/ac3/monsters_inc_5.1_448_small.ac3
+fate-ac3-5.1-downmix-stereo: REF = $(SAMPLES)/ac3/monsters_inc_5.1_448_small_stereo.pcm
+
+FATE_EAC3 += fate-eac3-1
fate-eac3-1: CMD = pcm -i $(SAMPLES)/eac3/csi_miami_5.1_256_spx_small.eac3
-fate-eac3-1: CMP = oneoff
fate-eac3-1: REF = $(SAMPLES)/eac3/csi_miami_5.1_256_spx_small.pcm
-FATE_AC3 += fate-eac3-2
+FATE_EAC3 += fate-eac3-2
fate-eac3-2: CMD = pcm -i $(SAMPLES)/eac3/csi_miami_stereo_128_spx_small.eac3
-fate-eac3-2: CMP = oneoff
fate-eac3-2: REF = $(SAMPLES)/eac3/csi_miami_stereo_128_spx_small.pcm
-FATE_AC3 += fate-eac3-3
+FATE_EAC3 += fate-eac3-3
fate-eac3-3: CMD = pcm -i $(SAMPLES)/eac3/matrix2_commentary1_stereo_192_small.eac3
-fate-eac3-3: CMP = oneoff
fate-eac3-3: REF = $(SAMPLES)/eac3/matrix2_commentary1_stereo_192_small.pcm
-FATE_AC3 += fate-eac3-4
+FATE_EAC3 += fate-eac3-4
fate-eac3-4: CMD = pcm -i $(SAMPLES)/eac3/serenity_english_5.1_1536_small.eac3
-fate-eac3-4: CMP = oneoff
fate-eac3-4: REF = $(SAMPLES)/eac3/serenity_english_5.1_1536_small.pcm
-FATE_TESTS += $(FATE_AC3)
-fate-ac3: $(FATE_AC3)
+$(FATE_AC3) $(FATE_EAC3): CMP = oneoff
+
+FATE_AC3-$(call DEMDEC, AC3, AC3) += $(FATE_AC3)
+FATE_EAC3-$(call DEMDEC, EAC3, EAC3) += $(FATE_EAC3)
+
+FATE_AC3-$(call ENCDEC, AC3, AC3) += fate-ac3-encode
+fate-ac3-encode: CMD = enc_dec_pcm ac3 wav s16le $(REF) -c:a ac3 -b:a 128k
+fate-ac3-encode: CMP_SHIFT = -1024
+fate-ac3-encode: CMP_TARGET = 399.62
+fate-ac3-encode: SIZE_TOLERANCE = 488
+fate-ac3-encode: FUZZ = 3
+
+FATE_EAC3-$(call ENCDEC, EAC3, EAC3) += fate-eac3-encode
+fate-eac3-encode: CMD = enc_dec_pcm eac3 wav s16le $(REF) -c:a eac3 -b:a 128k
+fate-eac3-encode: CMP_SHIFT = -1024
+fate-eac3-encode: CMP_TARGET = 514.02
+fate-eac3-encode: SIZE_TOLERANCE = 488
+fate-eac3-encode: FUZZ = 3
+
+fate-ac3-encode fate-eac3-encode: CMP = stddev
+fate-ac3-encode fate-eac3-encode: REF = $(SAMPLES)/audio-reference/luckynight_2ch_44kHz_s16.wav
+
+FATE_AC3-$(call ENCMUX, AC3_FIXED, AC3) += fate-ac3-fixed-encode
+fate-ac3-fixed-encode: tests/data/asynth-44100-2.wav
+fate-ac3-fixed-encode: SRC = $(TARGET_PATH)/tests/data/asynth-44100-2.wav
+fate-ac3-fixed-encode: CMD = md5 -i $(SRC) -c ac3_fixed -b 128k -f ac3 -flags bitexact
+fate-ac3-fixed-encode: CMP = oneline
+fate-ac3-fixed-encode: REF = a1d1fc116463b771abf5aef7ed37d7b1
+
+FATE_SAMPLES_AVCONV += $(FATE_AC3-yes) $(FATE_EAC3-yes)
+
+fate-ac3: $(FATE_AC3-yes) $(FATE_EAC3-yes)
diff --git a/gst-libs/ext/libav/tests/fate/acodec.mak b/gst-libs/ext/libav/tests/fate/acodec.mak
new file mode 100644
index 0000000..0eb6227
--- /dev/null
+++ b/gst-libs/ext/libav/tests/fate/acodec.mak
@@ -0,0 +1,70 @@
+fate-acodec-%: CODEC = $(@:fate-acodec-%=%)
+fate-acodec-%: SRC = tests/data/asynth-44100-2.wav
+fate-acodec-%: CMD = enc_dec wav $(SRC) $(FMT) "-b 128k -c $(CODEC)" wav "-c pcm_s16le" -keep
+fate-acodec-%: CMP_UNIT = 2
+fate-acodec-%: REF = $(SRC_PATH)/tests/ref/acodec/$(@:fate-acodec-%=%)
+
+FATE_ACODEC_PCM-$(call ENCDEC, PCM_ALAW, WAV) += alaw
+FATE_ACODEC_PCM-$(call ENCDEC, PCM_MULAW, WAV) += mulaw
+FATE_ACODEC_PCM-$(call ENCDEC, PCM_S8, MOV) += s8
+FATE_ACODEC_PCM-$(call ENCDEC, PCM_U8, WAV) += u8
+FATE_ACODEC_PCM-$(call ENCDEC, PCM_S16BE, MOV) += s16be
+FATE_ACODEC_PCM-$(call ENCDEC, PCM_S16LE, WAV) += s16le
+FATE_ACODEC_PCM-$(call ENCDEC, PCM_S24BE, MOV) += s24be
+FATE_ACODEC_PCM-$(call ENCDEC, PCM_S24LE, WAV) += s24le
+FATE_ACODEC_PCM-$(call ENCDEC, PCM_S32BE, MOV) += s32be
+FATE_ACODEC_PCM-$(call ENCDEC, PCM_S32LE, WAV) += s32le
+FATE_ACODEC_PCM-$(call ENCDEC, PCM_F32BE, AU) += f32be
+FATE_ACODEC_PCM-$(call ENCDEC, PCM_F32LE, WAV) += f32le
+FATE_ACODEC_PCM-$(call ENCDEC, PCM_F64BE, AU) += f64be
+FATE_ACODEC_PCM-$(call ENCDEC, PCM_F64LE, WAV) += f64le
+
+FATE_ACODEC_PCM := $(FATE_ACODEC_PCM-yes:%=fate-acodec-pcm-%)
+FATE_ACODEC += $(FATE_ACODEC_PCM)
+fate-acodec-pcm: $(FATE_ACODEC_PCM)
+
+fate-acodec-pcm-%: FMT = wav
+fate-acodec-pcm-%: CODEC = pcm_$(@:fate-acodec-pcm-%=%)
+
+fate-acodec-pcm-s8: FMT = mov
+fate-acodec-pcm-s%be: FMT = mov
+fate-acodec-pcm-f%be: FMT = au
+
+FATE_ACODEC_ADPCM-$(call ENCDEC, ADPCM_ADX, ADX) += adx
+FATE_ACODEC_ADPCM-$(call ENCDEC, ADPCM_IMA_QT, AIFF) += ima_qt
+FATE_ACODEC_ADPCM-$(call ENCDEC, ADPCM_IMA_WAV, WAV) += ima_wav
+FATE_ACODEC_ADPCM-$(call ENCDEC, ADPCM_MS, WAV) += ms
+FATE_ACODEC_ADPCM-$(call ENCDEC, ADPCM_SWF, FLV) += swf
+FATE_ACODEC_ADPCM-$(call ENCDEC, ADPCM_YAMAHA, WAV) += yamaha
+
+FATE_ACODEC_ADPCM := $(FATE_ACODEC_ADPCM-yes:%=fate-acodec-adpcm-%)
+FATE_ACODEC += $(FATE_ACODEC_ADPCM)
+fate-acodec-adpcm: $(FATE_ACODEC_ADPCM)
+
+fate-acodec-adpcm-%: CODEC = adpcm_$(@:fate-acodec-adpcm-%=%)
+
+fate-acodec-adpcm-adx: FMT = adx
+fate-acodec-adpcm-ima_qt: FMT = aiff
+fate-acodec-adpcm-ima_wav: FMT = wav
+fate-acodec-adpcm-ms: FMT = wav
+fate-acodec-adpcm-swf: FMT = flv
+fate-acodec-adpcm-yamaha: FMT = wav
+
+FATE_ACODEC-$(call ENCDEC, MP2, MP2 MP3) += fate-acodec-mp2
+fate-acodec-mp2: FMT = mp2
+fate-acodec-mp2: CMP_SHIFT = -1924
+
+FATE_ACODEC-$(call ENCDEC, ALAC, MOV) += fate-acodec-alac
+fate-acodec-alac: FMT = mov
+fate-acodec-alac: CODEC = alac -compression_level 1
+
+FATE_ACODEC-$(call ENCDEC, FLAC, FLAC) += fate-acodec-flac
+fate-acodec-flac: FMT = flac
+fate-acodec-flac: CODEC = flac -compression_level 2
+
+FATE_ACODEC += $(FATE_ACODEC-yes)
+
+$(FATE_ACODEC): tests/data/asynth-44100-2.wav
+
+FATE_AVCONV += $(FATE_ACODEC)
+fate-acodec: $(FATE_ACODEC)
diff --git a/gst-libs/ext/libav/tests/fate/adpcm.mak b/gst-libs/ext/libav/tests/fate/adpcm.mak
index 202f0b2..bb4745b 100644
--- a/gst-libs/ext/libav/tests/fate/adpcm.mak
+++ b/gst-libs/ext/libav/tests/fate/adpcm.mak
@@ -1,44 +1,74 @@
-FATE_ADPCM += fate-adpcm-ea-r2
-fate-adpcm-ea-r2: CMD = crc -i $(SAMPLES)/ea-mpc/THX_logo.mpc -vn
-
-FATE_ADPCM += fate-adpcm-ea-r3
-fate-adpcm-ea-r3: CMD = crc -i $(SAMPLES)/ea-vp6/THX_logo.vp6 -vn
-
-FATE_ADPCM += fate-adpcm-creative
+FATE_ADPCM-$(call DEMDEC, WAV, ADPCM_CT) += fate-adpcm-creative
fate-adpcm-creative: CMD = md5 -i $(SAMPLES)/creative/intro-partial.wav -f s16le
-FATE_ADPCM += fate-adpcm-creative-8-2bit
+FATE_ADPCM-$(call DEMDEC, VOC, ADPCM_SBPRO_2) += fate-adpcm-creative-8-2bit
fate-adpcm-creative-8-2bit: CMD = md5 -i $(SAMPLES)/creative/BBC_2BIT.VOC -f s16le
-FATE_ADPCM += fate-adpcm-creative-8-2.6bit
+FATE_ADPCM-$(call DEMDEC, VOC, ADPCM_SBPRO_3) += fate-adpcm-creative-8-2.6bit
fate-adpcm-creative-8-2.6bit: CMD = md5 -i $(SAMPLES)/creative/BBC_3BIT.VOC -f s16le
-FATE_ADPCM += fate-adpcm-creative-8-4bit
+FATE_ADPCM-$(call DEMDEC, VOC, ADPCM_SBPRO_4) += fate-adpcm-creative-8-4bit
fate-adpcm-creative-8-4bit: CMD = md5 -i $(SAMPLES)/creative/BBC_4BIT.VOC -f s16le
-FATE_ADPCM += fate-adpcm-ea-mad-ea-r1
-fate-adpcm-ea-mad-ea-r1: CMD = framecrc -i $(SAMPLES)/ea-mad/NFS6LogoE.mad
+FATE_ADPCM-$(call DEMDEC, EA, ADPCM_EA) += fate-adpcm-ea-1
+fate-adpcm-ea-1: CMD = framecrc -i $(SAMPLES)/ea-wve/networkBackbone-partial.wve -frames:a 26 -vn
+
+FATE_ADPCM-$(call DEMDEC, EA, ADPCM_EA) += fate-adpcm-ea-2
+fate-adpcm-ea-2: CMD = framecrc -i $(SAMPLES)/ea-dct/NFS2Esprit-partial.dct -vn
+
+FATE_ADPCM-$(call DEMDEC, XA, ADPCM_EA_MAXIS_XA) += fate-adpcm-ea-maxis-xa
+fate-adpcm-ea-maxis-xa: CMD = framecrc -i $(SAMPLES)/maxis-xa/SC2KBUG.XA -frames:a 30
+
+FATE_ADPCM-$(call DEMDEC, EA, ADPCM_EA_R1) += fate-adpcm-ea-r1
+fate-adpcm-ea-r1: CMD = framecrc -i $(SAMPLES)/ea-mad/NFS6LogoE.mad -vn
+
+FATE_ADPCM-$(call DEMDEC, EA, ADPCM_EA_R2) += fate-adpcm-ea-r2
+fate-adpcm-ea-r2: CMD = crc -i $(SAMPLES)/ea-mpc/THX_logo.mpc -vn
+
+FATE_ADPCM-$(call DEMDEC, EA, ADPCM_EA_R3) += fate-adpcm-ea-r3
+fate-adpcm-ea-r3: CMD = crc -i $(SAMPLES)/ea-vp6/THX_logo.vp6 -vn
+
+FATE_ADPCM-$(call DEMDEC, AVI, ADPCM_IMA_AMV) += fate-adpcm-ima-amv
+fate-adpcm-ima-amv: CMD = framecrc -i $(SAMPLES)/amv/MTV_high_res_320x240_sample_Penguin_Joke_MTV_from_WMV.amv -t 10 -vn
-FATE_ADPCM += fate-adpcm-ea-tqi
-fate-adpcm-ea-tqi: CMD = framecrc -i $(SAMPLES)/ea-wve/networkBackbone-partial.wve -frames:v 26
+FATE_ADPCM-$(call DEMDEC, APC, ADPCM_IMA_APC) += fate-adpcm-ima-apc
+fate-adpcm-ima-apc: CMD = md5 -i $(SAMPLES)/cryo-apc/cine007.APC -f s16le
-FATE_ADPCM += fate-adpcm-ima-dk3
+FATE_ADPCM-$(call DEMDEC, AVI, ADPCM_IMA_DK3) += fate-adpcm-ima-dk3
fate-adpcm-ima-dk3: CMD = md5 -i $(SAMPLES)/duck/sop-audio-only.avi -f s16le
-FATE_ADPCM += fate-adpcm-ima-dk4
+FATE_ADPCM-$(call DEMDEC, AVI, ADPCM_IMA_DK4) += fate-adpcm-ima-dk4
fate-adpcm-ima-dk4: CMD = md5 -i $(SAMPLES)/duck/salsa-audio-only.avi -f s16le
-FATE_ADPCM += fate-adpcm-ima_wav-stereo
+FATE_ADPCM-$(call DEMDEC, EA, ADPCM_IMA_EA_EACS) += fate-adpcm-ima-ea-eacs
+fate-adpcm-ima-ea-eacs: CMD = framecrc -i $(SAMPLES)/ea-tgv/INTRO8K-partial.TGV -vn
+
+FATE_ADPCM-$(call DEMDEC, EA, ADPCM_IMA_EA_SEAD) += fate-adpcm-ima-ea-sead
+fate-adpcm-ima-ea-sead: CMD = framecrc -i $(SAMPLES)/ea-tgv/INTEL_S.TGV -vn
+
+FATE_ADPCM-$(call DEMDEC, ISS, ADPCM_IMA_ISS) += fate-adpcm-ima-iss
+fate-adpcm-ima-iss: CMD = md5 -i $(SAMPLES)/funcom-iss/0004010100.iss -f s16le
+
+FATE_ADPCM-$(call DEMDEC, SMJPEG, ADPCM_IMA_SMJPEG) += fate-adpcm-ima-smjpeg
+fate-adpcm-ima-smjpeg: CMD = framecrc -i $(SAMPLES)/smjpeg/scenwin.mjpg -vn
+
+FATE_ADPCM-$(call DEMDEC, MOV, ADPCM_IMA_WAV) += fate-adpcm-ima_wav-stereo
fate-adpcm-ima_wav-stereo: CMD = md5 -i $(SAMPLES)/qt-surge-suite/surge-2-16-L-ms11.mov -f s16le
-FATE_ADPCM += fate-adpcm-psx-str-v3
-fate-adpcm-psx-str-v3: CMD = framecrc -i $(SAMPLES)/psx-str/abc000_cut.str -vn
+FATE_ADPCM-$(call DEMDEC, WSVQA, ADPCM_IMA_WS) += fate-adpcm-ima-ws
+fate-adpcm-ima-ws: CMD = framecrc -i $(SAMPLES)/vqa/cc-demo1-partial.vqa -vn
-FATE_ADPCM += fate-adpcm-thp
-fate-adpcm-thp: CMD = framecrc -idct simple -i $(SAMPLES)/thp/pikmin2-opening1-partial.thp
+FATE_ADPCM-$(call DEMDEC, DXA, ADPCM_MS) += fate-adpcm-ms-mono
+fate-adpcm-ms-mono: CMD = framecrc -i $(SAMPLES)/dxa/meetsquid.dxa -t 2 -vn
-FATE_ADPCM += fate-adpcm_ms-stereo
+FATE_ADPCM-$(call DEMDEC, MOV, ADPCM_MS) += fate-adpcm_ms-stereo
fate-adpcm_ms-stereo: CMD = md5 -i $(SAMPLES)/qt-surge-suite/surge-2-16-L-ms02.mov -f s16le
-FATE_TESTS += $(FATE_ADPCM)
-fate-adpcm: $(FATE_ADPCM)
+FATE_ADPCM-$(call DEMDEC, THP, ADPCM_THP) += fate-adpcm-thp
+fate-adpcm-thp: CMD = framecrc -i $(SAMPLES)/thp/pikmin2-opening1-partial.thp -vn
+
+FATE_ADPCM-$(call DEMDEC, STR, ADPCM_XA) += fate-adpcm-xa
+fate-adpcm-xa: CMD = framecrc -i $(SAMPLES)/psx-str/abc000_cut.str -vn
+
+FATE_SAMPLES_AVCONV += $(FATE_ADPCM-yes)
+fate-adpcm: $(FATE_ADPCM-yes)
diff --git a/gst-libs/ext/libav/tests/fate/alac.mak b/gst-libs/ext/libav/tests/fate/alac.mak
new file mode 100644
index 0000000..d724837
--- /dev/null
+++ b/gst-libs/ext/libav/tests/fate/alac.mak
@@ -0,0 +1,24 @@
+FATE_ALAC += fate-alac-16-level-0 \
+ fate-alac-16-level-1 \
+ fate-alac-16-level-2 \
+ fate-alac-16-lpc-orders \
+ fate-alac-24-level-0 \
+ fate-alac-24-level-1 \
+ fate-alac-24-level-2 \
+ fate-alac-24-lpc-orders \
+
+fate-alac-16-level-%: OPTS = -compression_level $(@:fate-alac-16-level-%=%)
+fate-alac-24-level-%: OPTS = -compression_level $(@:fate-alac-24-level-%=%)
+fate-alac-%-lpc-orders: OPTS = -min_prediction_order 1 -max_prediction_order 30
+
+fate-alac-16-%: REF = $(SAMPLES)/audio-reference/luckynight_2ch_44kHz_s16.wav
+fate-alac-16-%: CMD = enc_dec_pcm mov wav s16le $(REF) -c alac $(OPTS)
+
+fate-alac-24-%: REF = $(SAMPLES)/audio-reference/divertimenti_2ch_96kHz_s24.wav
+fate-alac-24-%: CMD = enc_dec_pcm mov wav s24le $(REF) -c alac $(OPTS)
+
+fate-alac-%: CMP = oneoff
+fate-alac-%: FUZZ = 0
+
+FATE_SAMPLES_AVCONV-$(call ENCDEC, ALAC, MOV) += $(FATE_ALAC)
+fate-alac: $(FATE_ALAC)
diff --git a/gst-libs/ext/libav/tests/fate/als.mak b/gst-libs/ext/libav/tests/fate/als.mak
index 2674034..5ec1189 100644
--- a/gst-libs/ext/libav/tests/fate/als.mak
+++ b/gst-libs/ext/libav/tests/fate/als.mak
@@ -7,5 +7,5 @@ endef
$(foreach N,$(ALS_SUITE),$(eval $(call FATE_ALS_SUITE,$(N))))
-FATE_TESTS += $(FATE_ALS)
+FATE_SAMPLES_AVCONV-$(call DEMDEC, MOV, ALS) += $(FATE_ALS)
fate-als: $(FATE_ALS)
diff --git a/gst-libs/ext/libav/tests/fate/amrnb.mak b/gst-libs/ext/libav/tests/fate/amrnb.mak
index 3545ba8..6dbba58 100644
--- a/gst-libs/ext/libav/tests/fate/amrnb.mak
+++ b/gst-libs/ext/libav/tests/fate/amrnb.mak
@@ -1,50 +1,36 @@
FATE_AMRNB += fate-amrnb-4k75
fate-amrnb-4k75: CMD = pcm -i $(SAMPLES)/amrnb/4.75k.amr
-fate-amrnb-4k75: CMP = stddev
fate-amrnb-4k75: REF = $(SAMPLES)/amrnb/4.75k.pcm
-fate-amrnb-4k75: FUZZ = 1
FATE_AMRNB += fate-amrnb-5k15
fate-amrnb-5k15: CMD = pcm -i $(SAMPLES)/amrnb/5.15k.amr
-fate-amrnb-5k15: CMP = stddev
fate-amrnb-5k15: REF = $(SAMPLES)/amrnb/5.15k.pcm
-fate-amrnb-5k15: FUZZ = 1
FATE_AMRNB += fate-amrnb-5k9
fate-amrnb-5k9: CMD = pcm -i $(SAMPLES)/amrnb/5.9k.amr
-fate-amrnb-5k9: CMP = stddev
fate-amrnb-5k9: REF = $(SAMPLES)/amrnb/5.9k.pcm
-fate-amrnb-5k9: FUZZ = 1
FATE_AMRNB += fate-amrnb-6k7
fate-amrnb-6k7: CMD = pcm -i $(SAMPLES)/amrnb/6.7k.amr
-fate-amrnb-6k7: CMP = stddev
fate-amrnb-6k7: REF = $(SAMPLES)/amrnb/6.7k.pcm
-fate-amrnb-6k7: FUZZ = 1
FATE_AMRNB += fate-amrnb-7k4
fate-amrnb-7k4: CMD = pcm -i $(SAMPLES)/amrnb/7.4k.amr
-fate-amrnb-7k4: CMP = stddev
fate-amrnb-7k4: REF = $(SAMPLES)/amrnb/7.4k.pcm
-fate-amrnb-7k4: FUZZ = 1
FATE_AMRNB += fate-amrnb-7k95
fate-amrnb-7k95: CMD = pcm -i $(SAMPLES)/amrnb/7.95k.amr
-fate-amrnb-7k95: CMP = stddev
fate-amrnb-7k95: REF = $(SAMPLES)/amrnb/7.95k.pcm
-fate-amrnb-7k95: FUZZ = 1
FATE_AMRNB += fate-amrnb-10k2
fate-amrnb-10k2: CMD = pcm -i $(SAMPLES)/amrnb/10.2k.amr
-fate-amrnb-10k2: CMP = stddev
fate-amrnb-10k2: REF = $(SAMPLES)/amrnb/10.2k.pcm
-fate-amrnb-10k2: FUZZ = 1
FATE_AMRNB += fate-amrnb-12k2
fate-amrnb-12k2: CMD = pcm -i $(SAMPLES)/amrnb/12.2k.amr
-fate-amrnb-12k2: CMP = stddev
fate-amrnb-12k2: REF = $(SAMPLES)/amrnb/12.2k.pcm
-fate-amrnb-12k2: FUZZ = 1
-FATE_TESTS += $(FATE_AMRNB)
+$(FATE_AMRNB): CMP = stddev
+
+FATE_SAMPLES_AVCONV-$(call DEMDEC, AMR, AMRNB) += $(FATE_AMRNB)
fate-amrnb: $(FATE_AMRNB)
diff --git a/gst-libs/ext/libav/tests/fate/amrwb.mak b/gst-libs/ext/libav/tests/fate/amrwb.mak
index 8fc7928..99c2737 100644
--- a/gst-libs/ext/libav/tests/fate/amrwb.mak
+++ b/gst-libs/ext/libav/tests/fate/amrwb.mak
@@ -1,62 +1,47 @@
FATE_AMRWB += fate-amrwb-6k60
fate-amrwb-6k60: CMD = pcm -i $(SAMPLES)/amrwb/seed-6k60.awb
-fate-amrwb-6k60: CMP = stddev
fate-amrwb-6k60: REF = $(SAMPLES)/amrwb/seed-6k60.pcm
-fate-amrwb-6k60: FUZZ = 1
FATE_AMRWB += fate-amrwb-8k85
fate-amrwb-8k85: CMD = pcm -i $(SAMPLES)/amrwb/seed-8k85.awb
-fate-amrwb-8k85: CMP = stddev
fate-amrwb-8k85: REF = $(SAMPLES)/amrwb/seed-8k85.pcm
-fate-amrwb-8k85: FUZZ = 1
FATE_AMRWB += fate-amrwb-12k65
fate-amrwb-12k65: CMD = pcm -i $(SAMPLES)/amrwb/seed-12k65.awb
-fate-amrwb-12k65: CMP = stddev
fate-amrwb-12k65: REF = $(SAMPLES)/amrwb/seed-12k65.pcm
-fate-amrwb-12k65: FUZZ = 1
FATE_AMRWB += fate-amrwb-14k25
fate-amrwb-14k25: CMD = pcm -i $(SAMPLES)/amrwb/seed-14k25.awb
-fate-amrwb-14k25: CMP = stddev
fate-amrwb-14k25: REF = $(SAMPLES)/amrwb/seed-14k25.pcm
fate-amrwb-14k25: FUZZ = 2.6
FATE_AMRWB += fate-amrwb-15k85
fate-amrwb-15k85: CMD = pcm -i $(SAMPLES)/amrwb/seed-15k85.awb
-fate-amrwb-15k85: CMP = stddev
fate-amrwb-15k85: REF = $(SAMPLES)/amrwb/seed-15k85.pcm
-fate-amrwb-15k85: FUZZ = 1
FATE_AMRWB += fate-amrwb-18k25
fate-amrwb-18k25: CMD = pcm -i $(SAMPLES)/amrwb/seed-18k25.awb
-fate-amrwb-18k25: CMP = stddev
fate-amrwb-18k25: REF = $(SAMPLES)/amrwb/seed-18k25.pcm
-fate-amrwb-18k25: FUZZ = 1
FATE_AMRWB += fate-amrwb-19k85
fate-amrwb-19k85: CMD = pcm -i $(SAMPLES)/amrwb/seed-19k85.awb
-fate-amrwb-19k85: CMP = stddev
fate-amrwb-19k85: REF = $(SAMPLES)/amrwb/seed-19k85.pcm
-fate-amrwb-19k85: FUZZ = 1
FATE_AMRWB += fate-amrwb-23k05
fate-amrwb-23k05: CMD = pcm -i $(SAMPLES)/amrwb/seed-23k05.awb
-fate-amrwb-23k05: CMP = stddev
fate-amrwb-23k05: REF = $(SAMPLES)/amrwb/seed-23k05.pcm
fate-amrwb-23k05: FUZZ = 2
FATE_AMRWB += fate-amrwb-23k85
fate-amrwb-23k85: CMD = pcm -i $(SAMPLES)/amrwb/seed-23k85.awb
-fate-amrwb-23k85: CMP = stddev
fate-amrwb-23k85: REF = $(SAMPLES)/amrwb/seed-23k85.pcm
fate-amrwb-23k85: FUZZ = 2
FATE_AMRWB += fate-amrwb-23k85-2
fate-amrwb-23k85-2: CMD = pcm -i $(SAMPLES)/amrwb/deus-23k85.awb
-fate-amrwb-23k85-2: CMP = stddev
fate-amrwb-23k85-2: REF = $(SAMPLES)/amrwb/deus-23k85.pcm
-fate-amrwb-23k85-2: FUZZ = 1
-FATE_TESTS += $(FATE_AMRWB)
+$(FATE_AMRWB): CMP = stddev
+
+FATE_SAMPLES_AVCONV-$(call DEMDEC, AMR, AMRWB) += $(FATE_AMRWB)
fate-amrwb: $(FATE_AMRWB)
diff --git a/gst-libs/ext/libav/tests/fate/atrac.mak b/gst-libs/ext/libav/tests/fate/atrac.mak
index efb1727..3ac5553 100644
--- a/gst-libs/ext/libav/tests/fate/atrac.mak
+++ b/gst-libs/ext/libav/tests/fate/atrac.mak
@@ -1,22 +1,26 @@
-FATE_ATRAC += fate-atrac1
+FATE_ATRAC1-$(call DEMDEC, AEA, ATRAC1) += fate-atrac1
fate-atrac1: CMD = pcm -i $(SAMPLES)/atrac1/test_tones_small.aea
-fate-atrac1: CMP = oneoff
fate-atrac1: REF = $(SAMPLES)/atrac1/test_tones_small.pcm
-FATE_ATRAC += fate-atrac3-1
+FATE_ATRAC3 += fate-atrac3-1
fate-atrac3-1: CMD = pcm -i $(SAMPLES)/atrac3/mc_sich_at3_066_small.wav
-fate-atrac3-1: CMP = oneoff
fate-atrac3-1: REF = $(SAMPLES)/atrac3/mc_sich_at3_066_small.pcm
-FATE_ATRAC += fate-atrac3-2
+FATE_ATRAC3 += fate-atrac3-2
fate-atrac3-2: CMD = pcm -i $(SAMPLES)/atrac3/mc_sich_at3_105_small.wav
-fate-atrac3-2: CMP = oneoff
fate-atrac3-2: REF = $(SAMPLES)/atrac3/mc_sich_at3_105_small.pcm
-FATE_ATRAC += fate-atrac3-3
+FATE_ATRAC3 += fate-atrac3-3
fate-atrac3-3: CMD = pcm -i $(SAMPLES)/atrac3/mc_sich_at3_132_small.wav
-fate-atrac3-3: CMP = oneoff
fate-atrac3-3: REF = $(SAMPLES)/atrac3/mc_sich_at3_132_small.pcm
-FATE_TESTS += $(FATE_ATRAC)
-fate-atrac: $(FATE_ATRAC)
+FATE_ATRAC3-$(call DEMDEC, WAV, ATRAC3) += $(FATE_ATRAC3)
+
+FATE_ATRAC_ALL = $(FATE_ATRAC1-yes) $(FATE_ATRAC3-yes)
+
+$(FATE_ATRAC_ALL): CMP = oneoff
+
+FATE_SAMPLES_AVCONV += $(FATE_ATRAC_ALL)
+
+fate-atrac: $(FATE_ATRAC_ALL)
+fate-atrac3: $(FATE_ATRAC3-yes)
diff --git a/gst-libs/ext/libav/tests/fate/audio.mak b/gst-libs/ext/libav/tests/fate/audio.mak
index fcaad14..7e08c2a 100644
--- a/gst-libs/ext/libav/tests/fate/audio.mak
+++ b/gst-libs/ext/libav/tests/fate/audio.mak
@@ -1,33 +1,44 @@
-FATE_BINKAUDIO += fate-binkaudio-dct
+FATE_BINKAUDIO-$(call DEMDEC, BINK, BINKAUDIO_DCT) += fate-binkaudio-dct
fate-binkaudio-dct: CMD = pcm -i $(SAMPLES)/bink/binkaudio_dct.bik
-fate-binkaudio-dct: CMP = oneoff
fate-binkaudio-dct: REF = $(SAMPLES)/bink/binkaudio_dct.pcm
fate-binkaudio-dct: FUZZ = 2
-FATE_BINKAUDIO += fate-binkaudio-rdft
+FATE_BINKAUDIO-$(call DEMDEC, BINK, BINKAUDIO_RDFT) += fate-binkaudio-rdft
fate-binkaudio-rdft: CMD = pcm -i $(SAMPLES)/bink/binkaudio_rdft.bik
-fate-binkaudio-rdft: CMP = oneoff
fate-binkaudio-rdft: REF = $(SAMPLES)/bink/binkaudio_rdft.pcm
fate-binkaudio-rdft: FUZZ = 2
-FATE_TESTS += $(FATE_BINKAUDIO)
-fate-binkaudio: $(FATE_BINKAUDIO)
+$(FATE_BINKAUDIO-yes): CMP = oneoff
-FATE_TESTS += fate-dts
+FATE_SAMPLES_AVCONV += $(FATE_BINKAUDIO-yes)
+fate-binkaudio: $(FATE_BINKAUDIO-yes)
+
+FATE_SAMPLES_AVCONV-$(call DEMDEC, BMV, BMV_AUDIO) += fate-bmv-audio
+fate-bmv-audio: CMD = framecrc -i $(SAMPLES)/bmv/SURFING-partial.BMV -vn
+
+FATE_SAMPLES_AVCONV-$(call DEMDEC, DSICIN, DSICINAUDIO) += fate-delphine-cin-audio
+fate-delphine-cin-audio: CMD = framecrc -i $(SAMPLES)/delphine-cin/LOGO-partial.CIN -vn
+
+FATE_SAMPLES_AVCONV-$(call DEMDEC, MPEGTS, DCA) += fate-dts
fate-dts: CMD = pcm -i $(SAMPLES)/dts/dts.ts
fate-dts: CMP = oneoff
fate-dts: REF = $(SAMPLES)/dts/dts.pcm
-FATE_TESTS += fate-imc
+FATE_SAMPLES_AVCONV-$(call DEMDEC, AVI, IMC) += fate-imc
fate-imc: CMD = pcm -i $(SAMPLES)/imc/imc.avi
fate-imc: CMP = oneoff
fate-imc: REF = $(SAMPLES)/imc/imc.pcm
-FATE_TESTS += fate-nellymoser
+FATE_SAMPLES_AVCONV-$(call DEMDEC, FLV, NELLYMOSER) += fate-nellymoser
fate-nellymoser: CMD = pcm -i $(SAMPLES)/nellymoser/nellymoser.flv
fate-nellymoser: CMP = oneoff
fate-nellymoser: REF = $(SAMPLES)/nellymoser/nellymoser.pcm
-FATE_TESTS += fate-ws_snd
-fate-ws_snd: CMD = md5 -i $(SAMPLES)/vqa/ws_snd.vqa -f s16le
+FATE_SAMPLES_AVCONV-$(call DEMDEC, VMD, VMDAUDIO) += fate-sierra-vmd-audio
+fate-sierra-vmd-audio: CMD = framecrc -i $(SAMPLES)/vmd/12.vmd -vn
+
+FATE_SAMPLES_AVCONV-$(call DEMDEC, SMACKER, SMACKAUD) += fate-smacker-audio
+fate-smacker-audio: CMD = framecrc -i $(SAMPLES)/smacker/wetlogo.smk -vn
+FATE_SAMPLES_AVCONV-$(call DEMDEC, WSVQA, WS_SND1) += fate-ws_snd
+fate-ws_snd: CMD = md5 -i $(SAMPLES)/vqa/ws_snd.vqa -f s16le
diff --git a/gst-libs/ext/libav/tests/fate/avfilter.mak b/gst-libs/ext/libav/tests/fate/avfilter.mak
new file mode 100644
index 0000000..de5e9d1
--- /dev/null
+++ b/gst-libs/ext/libav/tests/fate/avfilter.mak
@@ -0,0 +1,24 @@
+FATE_LAVFI = fate-lavfi-crop \
+ fate-lavfi-crop_scale \
+ fate-lavfi-crop_scale_vflip \
+ fate-lavfi-crop_vflip \
+ fate-lavfi-null \
+ fate-lavfi-pixdesc \
+ fate-lavfi-pixfmts_copy \
+ fate-lavfi-pixfmts_crop \
+ fate-lavfi-pixfmts_hflip \
+ fate-lavfi-pixfmts_null \
+ fate-lavfi-pixfmts_pad \
+ fate-lavfi-pixfmts_scale \
+ fate-lavfi-pixfmts_vflip \
+ fate-lavfi-scale200 \
+ fate-lavfi-scale500 \
+ fate-lavfi-vflip \
+ fate-lavfi-vflip_crop \
+ fate-lavfi-vflip_vflip \
+
+$(FATE_LAVFI): $(VREF) libavfilter/filtfmts-test$(EXESUF)
+$(FATE_LAVFI): CMD = lavfitest
+
+FATE_AVCONV += $(FATE_LAVFI)
+fate-lavfi: $(FATE_LAVFI)
diff --git a/gst-libs/ext/libav/tests/fate/avformat.mak b/gst-libs/ext/libav/tests/fate/avformat.mak
new file mode 100644
index 0000000..7ef68ad
--- /dev/null
+++ b/gst-libs/ext/libav/tests/fate/avformat.mak
@@ -0,0 +1,53 @@
+FATE_LAVF-$(call ENCDEC, PCM_S16BE, AIFF) += aiff
+FATE_LAVF-$(call ENCDEC, PCM_ALAW, PCM_ALAW) += alaw
+FATE_LAVF-$(call ENCDEC2, MSMPEG4V3, MP2, ASF) += asf
+FATE_LAVF-$(call ENCDEC, PCM_S16BE, AU) += au
+FATE_LAVF-$(call ENCDEC2, MPEG4, MP2, AVI) += avi
+FATE_LAVF-$(call ENCDEC, BMP, IMAGE2) += bmp
+FATE_LAVF-$(call ENCDEC, DPX, IMAGE2) += dpx
+FATE_LAVF-$(call ENCDEC2, DVVIDEO, PCM_S16LE, AVI) += dv_fmt
+FATE_LAVF-$(call ENCDEC2, MPEG1VIDEO, MP2, FFM) += ffm
+FATE_LAVF-$(call ENCDEC, FLV, FLV) += flv_fmt
+FATE_LAVF-$(call ENCDEC, GIF, IMAGE2) += gif
+FATE_LAVF-$(call ENCDEC2, MPEG2VIDEO, PCM_S16LE, GXF) += gxf
+FATE_LAVF-$(call ENCDEC, MJPEG, IMAGE2) += jpg
+FATE_LAVF-$(call ENCDEC2, MPEG4, MP2, MATROSKA) += mkv
+FATE_LAVF-$(call ENCDEC, ADPCM_YAMAHA, MMF) += mmf
+FATE_LAVF-$(call ENCDEC2, MPEG4, PCM_ALAW, MOV) += mov
+FATE_LAVF-$(call ENCDEC2, MPEG1VIDEO, MP2, MPEG1SYSTEM MPEGPS) += mpg
+FATE_LAVF-$(call ENCDEC, PCM_MULAW, PCM_MULAW) += mulaw
+FATE_LAVF-$(call ENCDEC2, MPEG2VIDEO, PCM_S16LE, MXF) += mxf
+FATE_LAVF-$(call ENCDEC2, MPEG2VIDEO, PCM_S16LE, MXF_D10 MXF) += mxf_d10
+FATE_LAVF-$(call ENCDEC2, MPEG4, MP2, NUT) += nut
+FATE_LAVF-$(call ENCDEC, FLAC, OGG) += ogg
+FATE_LAVF-$(call ENCDEC, PAM, IMAGE2) += pam
+FATE_LAVF-$(call ENCDEC, PBM, IMAGE2PIPE) += pbmpipe
+FATE_LAVF-$(call ENCDEC, PCX, IMAGE2) += pcx
+FATE_LAVF-$(call ENCDEC, PGM, IMAGE2) += pgm
+FATE_LAVF-$(call ENCDEC, PGM, IMAGE2PIPE) += pgmpipe
+FATE_LAVF-$(call ENCDEC, PNG, IMAGE2) += png
+FATE_LAVF-$(call ENCDEC, PPM, IMAGE2) += ppm
+FATE_LAVF-$(call ENCDEC, PPM, IMAGE2PIPE) += ppmpipe
+FATE_LAVF-$(call ENCMUX, RV10 AC3_FIXED, RM) += rm
+FATE_LAVF-$(call ENCDEC, PCM_U8, RSO) += rso
+FATE_LAVF-$(call ENCDEC, SGI, IMAGE2) += sgi
+FATE_LAVF-$(call ENCDEC, PCM_S16LE, SOX) += sox
+FATE_LAVF-$(call ENCDEC, SUNRAST, IMAGE2) += sunrast
+FATE_LAVF-$(call ENCDEC, FLV, SWF) += swf
+FATE_LAVF-$(call ENCDEC, TARGA, IMAGE2) += tga
+FATE_LAVF-$(call ENCDEC, TIFF, IMAGE2) += tiff
+FATE_LAVF-$(call ENCDEC2, MPEG2VIDEO, MP2, MPEGTS) += ts
+FATE_LAVF-$(call ENCDEC, PCM_U8, VOC) += voc
+FATE_LAVF-$(call ENCDEC, PCM_S16LE, VOC) += voc_s16
+FATE_LAVF-$(call ENCDEC, PCM_S16LE, WAV) += wav
+FATE_LAVF-$(call ENCDEC, XWD, IMAGE2) += xwd
+FATE_LAVF-$(CONFIG_YUV4MPEGPIPE_MUXER) += yuv4mpeg
+
+FATE_LAVF += $(FATE_LAVF-yes:%=fate-lavf-%)
+FATE_LAVF += fate-lavf-pixfmt
+
+$(FATE_LAVF): $(AREF) $(VREF)
+$(FATE_LAVF): CMD = lavftest
+
+FATE_AVCONV += $(FATE_LAVF)
+fate-lavf: $(FATE_LAVF)
diff --git a/gst-libs/ext/libav/tests/fate/bmp.mak b/gst-libs/ext/libav/tests/fate/bmp.mak
new file mode 100644
index 0000000..9e52ac0
--- /dev/null
+++ b/gst-libs/ext/libav/tests/fate/bmp.mak
@@ -0,0 +1,43 @@
+FATE_BMP += fate-bmp-1bit
+fate-bmp-1bit: CMD = framecrc -i $(SAMPLES)/bmp/test1.bmp -pix_fmt rgb24
+
+FATE_BMP += fate-bmp-4bit
+fate-bmp-4bit: CMD = framecrc -i $(SAMPLES)/bmp/test4.bmp -pix_fmt rgb24
+
+FATE_BMP += fate-bmp-4bit-os2
+fate-bmp-4bit-os2: CMD = framecrc -i $(SAMPLES)/bmp/test4os2v2.bmp -pix_fmt rgb24
+
+FATE_BMP += fate-bmp-8bit
+fate-bmp-8bit: CMD = framecrc -i $(SAMPLES)/bmp/test8.bmp -pix_fmt rgb24
+
+FATE_BMP += fate-bmp-8bit-os2
+fate-bmp-8bit-os2: CMD = framecrc -i $(SAMPLES)/bmp/test8os2.bmp -pix_fmt rgb24
+
+FATE_BMP += fate-bmp-15bit
+fate-bmp-15bit: CMD = framecrc -i $(SAMPLES)/bmp/test16.bmp -pix_fmt rgb555le
+
+FATE_BMP += fate-bmp-15bit-mask
+fate-bmp-15bit-mask: CMD = framecrc -i $(SAMPLES)/bmp/test16bf555.bmp -pix_fmt rgb555le
+
+FATE_BMP += fate-bmp-16bit-mask
+fate-bmp-16bit-mask: CMD = framecrc -i $(SAMPLES)/bmp/test16bf565.bmp -pix_fmt rgb565le
+
+FATE_BMP += fate-bmp-24bit
+fate-bmp-24bit: CMD = framecrc -i $(SAMPLES)/bmp/test24.bmp
+
+FATE_BMP += fate-bmp-32bit
+fate-bmp-32bit: CMD = framecrc -i $(SAMPLES)/bmp/test32.bmp -pix_fmt bgr24
+
+FATE_BMP += fate-bmp-32bit-mask
+fate-bmp-32bit-mask: CMD = framecrc -i $(SAMPLES)/bmp/test32bf.bmp -pix_fmt bgr24
+
+FATE_BMP += fate-bmp-rle4
+fate-bmp-rle4: CMD = framecrc -i $(SAMPLES)/bmp/testcompress4.bmp -pix_fmt rgb24
+
+FATE_BMP += fate-bmp-rle8
+fate-bmp-rle8: CMD = framecrc -i $(SAMPLES)/bmp/testcompress8.bmp -pix_fmt rgb24
+
+FATE_BMP-$(call DEMDEC, IMAGE2, BMP) += $(FATE_BMP)
+
+FATE_SAMPLES_AVCONV += $(FATE_BMP-yes)
+fate-bmp: $(FATE_BMP-yes)
diff --git a/gst-libs/ext/libav/tests/fate/cdxl.mak b/gst-libs/ext/libav/tests/fate/cdxl.mak
new file mode 100644
index 0000000..2c69e39
--- /dev/null
+++ b/gst-libs/ext/libav/tests/fate/cdxl.mak
@@ -0,0 +1,19 @@
+FATE_CDXL += fate-cdxl-ham6
+fate-cdxl-ham6: CMD = framecrc -i $(SAMPLES)/cdxl/cat.cdxl -an -frames:v 16
+
+FATE_CDXL += fate-cdxl-ham8
+fate-cdxl-ham8: CMD = framecrc -i $(SAMPLES)/cdxl/mirage.cdxl -an -frames:v 1
+
+FATE_CDXL += fate-cdxl-pal8
+fate-cdxl-pal8: CMD = framecrc -i $(SAMPLES)/cdxl/maku.cdxl -pix_fmt rgb24 -frames:v 11
+
+FATE_CDXL += fate-cdxl-pal8-small
+fate-cdxl-pal8-small: CMD = framecrc -i $(SAMPLES)/cdxl/fruit.cdxl -an -pix_fmt rgb24 -frames:v 46
+
+FATE_CDXL += fate-cdxl-bitline-ham6
+fate-cdxl-bitline-ham6: CMD = framecrc -i $(SAMPLES)/cdxl/bitline.cdxl -frames:v 10
+
+FATE_CDXL-$(call DEMDEC, CDXL, CDXL) += $(FATE_CDXL)
+
+FATE_SAMPLES_AVCONV += $(FATE_CDXL-yes)
+fate-cdxl: $(FATE_CDXL-yes)
diff --git a/gst-libs/ext/libav/tests/fate/cover-art.mak b/gst-libs/ext/libav/tests/fate/cover-art.mak
new file mode 100644
index 0000000..dadfcd8
--- /dev/null
+++ b/gst-libs/ext/libav/tests/fate/cover-art.mak
@@ -0,0 +1,23 @@
+FATE_COVER_ART += fate-cover-art-ape
+fate-cover-art-ape: CMD = md5 -i $(SAMPLES)/cover_art/luckynight_cover.ape -an -c:v copy -f rawvideo
+fate-cover-art-ape: REF = 45333c983c45af54449dff10af144317
+
+FATE_COVER_ART += fate-cover-art-flac
+fate-cover-art-flac: CMD = md5 -i $(SAMPLES)/cover_art/cover_art.flac -an -c:v copy -f rawvideo
+fate-cover-art-flac: REF = 0de1fc6200596fa32b8f7300a14c0261
+
+FATE_COVER_ART += fate-cover-art-m4a
+fate-cover-art-m4a: CMD = md5 -i $(SAMPLES)/cover_art/Owner-iTunes_9.0.3.15.m4a -an -c:v copy -f rawvideo
+fate-cover-art-m4a: REF = 08ba70a3b594ff6345a93965e96a9d3e
+
+FATE_COVER_ART += fate-cover-art-wma
+fate-cover-art-wma: CMD = md5 -i $(SAMPLES)/cover_art/Californication_cover.wma -an -c:v copy -f rawvideo
+fate-cover-art-wma: REF = 0808bd0e1b61542a16e1906812dd924b
+
+FATE_COVER_ART += fate-cover-art-wv
+fate-cover-art-wv: CMD = md5 -i $(SAMPLES)/cover_art/luckynight_cover.wv -an -c:v copy -f rawvideo
+fate-cover-art-wv: REF = 45333c983c45af54449dff10af144317
+
+$(FATE_COVER_ART): CMP = oneline
+FATE_SAMPLES_AVCONV += $(FATE_COVER_ART)
+fate-cover-art: $(FATE_COVER_ART)
diff --git a/gst-libs/ext/libav/tests/fate/dct.mak b/gst-libs/ext/libav/tests/fate/dct.mak
deleted file mode 100644
index 8f2ab7a..0000000
--- a/gst-libs/ext/libav/tests/fate/dct.mak
+++ /dev/null
@@ -1,5 +0,0 @@
-FATE_TESTS += fate-idct8x8
-fate-idct8x8: libavcodec/dct-test$(EXESUF)
-fate-idct8x8: CMD = run libavcodec/dct-test -i
-fate-idct8x8: REF = /dev/null
-fate-idct8x8: CMP = null
diff --git a/gst-libs/ext/libav/tests/fate/demux.mak b/gst-libs/ext/libav/tests/fate/demux.mak
index 1589986..d917cca 100644
--- a/gst-libs/ext/libav/tests/fate/demux.mak
+++ b/gst-libs/ext/libav/tests/fate/demux.mak
@@ -1,89 +1,71 @@
-FATE_TESTS += fate-adts-demux
+FATE_SAMPLES_AVCONV-$(CONFIG_AAC_DEMUXER) += fate-adts-demux
fate-adts-demux: CMD = crc -i $(SAMPLES)/aac/ct_faac-adts.aac -acodec copy
-FATE_TESTS += fate-aea-demux
+FATE_SAMPLES_AVCONV-$(CONFIG_AEA_DEMUXER) += fate-aea-demux
fate-aea-demux: CMD = crc -i $(SAMPLES)/aea/chirp.aea -acodec copy
-FATE_TESTS += fate-bink-demux
+FATE_SAMPLES_AVCONV-$(CONFIG_BINK_DEMUXER) += fate-bink-demux
fate-bink-demux: CMD = crc -i $(SAMPLES)/bink/Snd0a7d9b58.dee -vn -acodec copy
-FATE_TESTS += fate-bmv
-fate-bmv: CMD = framecrc -i $(SAMPLES)/bmv/SURFING-partial.BMV -pix_fmt rgb24
+FATE_SAMPLES_AVCONV-$(CONFIG_CAF_DEMUXER) += fate-caf
+fate-caf: CMD = crc -i $(SAMPLES)/caf/caf-pcm16.caf -c copy
-FATE_TESTS += fate-caf
-fate-caf: CMD = crc -i $(SAMPLES)/caf/caf-pcm16.caf
+FATE_SAMPLES_AVCONV-$(CONFIG_CDXL_DEMUXER) += fate-cdxl-demux
+fate-cdxl-demux: CMD = framecrc -i $(SAMPLES)/cdxl/mirage.cdxl -vcodec copy -acodec copy
-FATE_TESTS += fate-cryo-apc
-fate-cryo-apc: CMD = md5 -i $(SAMPLES)/cryo-apc/cine007.APC -f s16le
+FATE_SAMPLES_AVCONV-$(CONFIG_DAUD_DEMUXER) += fate-d-cinema-demux
+fate-d-cinema-demux: CMD = framecrc -i $(SAMPLES)/d-cinema/THX_Science_FLT_1920-partial.302 -acodec copy
-FATE_TESTS += fate-d-cinema-demux
-fate-d-cinema-demux: CMD = framecrc -i $(SAMPLES)/d-cinema/THX_Science_FLT_1920-partial.302 -acodec copy -pix_fmt rgb24
+FATE_SAMPLES_AVCONV-$(CONFIG_IV8_DEMUXER) += fate-iv8-demux
+fate-iv8-demux: CMD = framecrc -i $(SAMPLES)/iv8/zzz-partial.mpg -vcodec copy
-FATE_TESTS += fate-funcom-iss
-fate-funcom-iss: CMD = md5 -i $(SAMPLES)/funcom-iss/0004010100.iss -f s16le
-
-FATE_TESTS += fate-interplay-mve-16bit
-fate-interplay-mve-16bit: CMD = framecrc -i $(SAMPLES)/interplay-mve/descent3-level5-16bit-partial.mve -pix_fmt rgb24
-
-FATE_TESTS += fate-interplay-mve-8bit
-fate-interplay-mve-8bit: CMD = framecrc -i $(SAMPLES)/interplay-mve/interplay-logo-2MB.mve -pix_fmt rgb24
-
-FATE_TESTS += fate-iv8-demux
-fate-iv8-demux: CMD = framecrc -i $(SAMPLES)/iv8/zzz-partial.mpg -vsync 0 -vcodec copy
-
-FATE_TESTS += fate-lmlm4-demux
+FATE_SAMPLES_AVCONV-$(CONFIG_LMLM4_DEMUXER) += fate-lmlm4-demux
fate-lmlm4-demux: CMD = framecrc -i $(SAMPLES)/lmlm4/LMLM4_CIFat30fps.divx -t 3 -acodec copy -vcodec copy
-FATE_TESTS += fate-maxis-xa
-fate-maxis-xa: CMD = md5 -i $(SAMPLES)/maxis-xa/SC2KBUG.XA -f s16le
+FATE_SAMPLES_AVCONV-$(CONFIG_XA_DEMUXER) += fate-maxis-xa
+fate-maxis-xa: CMD = framecrc -i $(SAMPLES)/maxis-xa/SC2KBUG.XA -frames:a 30 -c:a copy
-FATE_TESTS += fate-mtv
-fate-mtv: CMD = framecrc -i $(SAMPLES)/mtv/comedian_auto-partial.mtv -acodec copy -pix_fmt rgb24
+FATE_SAMPLES_AVCONV-$(CONFIG_MTV_DEMUXER) += fate-mtv
+fate-mtv: CMD = framecrc -i $(SAMPLES)/mtv/comedian_auto-partial.mtv -c copy
-FATE_TESTS += fate-mxf-demux
+FATE_SAMPLES_AVCONV-$(CONFIG_MXF_DEMUXER) += fate-mxf-demux
fate-mxf-demux: CMD = framecrc -i $(SAMPLES)/mxf/C0023S01.mxf -acodec copy -vcodec copy
-FATE_TESTS += fate-nc-demux
+FATE_SAMPLES_AVCONV-$(CONFIG_NC_DEMUXER) += fate-nc-demux
fate-nc-demux: CMD = framecrc -i $(SAMPLES)/nc-camera/nc-sample-partial -vcodec copy
-FATE_TESTS += fate-nsv-demux
+FATE_SAMPLES_AVCONV-$(CONFIG_NSV_DEMUXER) += fate-nsv-demux
fate-nsv-demux: CMD = framecrc -i $(SAMPLES)/nsv/witchblade-51kbps.nsv -t 6 -vcodec copy -acodec copy
-FATE_TESTS += fate-oma-demux
+FATE_SAMPLES_AVCONV-$(CONFIG_OMA_DEMUXER) += fate-oma-demux
fate-oma-demux: CMD = crc -i $(SAMPLES)/oma/01-Untitled-partial.oma -acodec copy
-FATE_TESTS += fate-psx-str
-fate-psx-str: CMD = framecrc -i $(SAMPLES)/psx-str/descent-partial.str
-
-FATE_TESTS += fate-psx-str-v3-mdec
-fate-psx-str-v3-mdec: CMD = framecrc -i $(SAMPLES)/psx-str/abc000_cut.str -an
+FATE_SAMPLES_AVCONV-$(CONFIG_STR_DEMUXER) += fate-psx-str-demux
+fate-psx-str-demux: CMD = framecrc -i $(SAMPLES)/psx-str/descent-partial.str -c copy
-FATE_TESTS += fate-pva-demux
-fate-pva-demux: CMD = framecrc -idct simple -i $(SAMPLES)/pva/PVA_test-partial.pva -t 0.6 -acodec copy
+FATE_SAMPLES_AVCONV-$(CONFIG_PVA_DEMUXER) += fate-pva-demux
+fate-pva-demux: CMD = framecrc -idct simple -i $(SAMPLES)/pva/PVA_test-partial.pva -t 0.6 -acodec copy -vn
-FATE_TESTS += fate-qcp-demux
+FATE_SAMPLES_AVCONV-$(CONFIG_QCP_DEMUXER) += fate-qcp-demux
fate-qcp-demux: CMD = crc -i $(SAMPLES)/qcp/0036580847.QCP -acodec copy
-FATE_TESTS += fate-redcode-demux
+FATE_SAMPLES_AVCONV-$(CONFIG_R3D_DEMUXER) += fate-redcode-demux
fate-redcode-demux: CMD = framecrc -i $(SAMPLES)/r3d/4MB-sample.r3d -vcodec copy -acodec copy
-FATE_TESTS += fate-sierra-vmd
-fate-sierra-vmd: CMD = framecrc -i $(SAMPLES)/vmd/12.vmd -vsync 0 -pix_fmt rgb24
-
-FATE_TESTS += fate-siff
+FATE_SAMPLES_AVCONV-$(CONFIG_SIFF_DEMUXER) += fate-siff
fate-siff: CMD = framecrc -i $(SAMPLES)/SIFF/INTRO_B.VB -t 3 -pix_fmt rgb24
-FATE_TESTS += fate-smjpeg
-fate-smjpeg: CMD = framecrc -i $(SAMPLES)/smjpeg/scenwin.mjpg -vcodec copy
+FATE_SAMPLES_AVCONV-$(CONFIG_SMJPEG_DEMUXER) += fate-smjpeg-demux
+fate-smjpeg-demux: CMD = framecrc -i $(SAMPLES)/smjpeg/scenwin.mjpg -c copy
-FATE_TESTS += fate-westwood-aud
-fate-westwood-aud: CMD = md5 -i $(SAMPLES)/westwood-aud/excellent.aud -f s16le
+FATE_SAMPLES_AVCONV-$(CONFIG_WSAUD_DEMUXER) += fate-westwood-aud
+fate-westwood-aud: CMD = framecrc -i $(SAMPLES)/westwood-aud/excellent.aud -c copy
-FATE_TESTS += fate-wtv-demux
+FATE_SAMPLES_AVCONV-$(CONFIG_WTV_DEMUXER) += fate-wtv-demux
fate-wtv-demux: CMD = framecrc -i $(SAMPLES)/wtv/law-and-order-partial.wtv -vcodec copy -acodec copy
-FATE_TESTS += fate-xmv-demux
+FATE_SAMPLES_AVCONV-$(CONFIG_XMV_DEMUXER) += fate-xmv-demux
fate-xmv-demux: CMD = framecrc -i $(SAMPLES)/xmv/logos1p.fmv -vcodec copy -acodec copy
-FATE_TESTS += fate-xwma-demux
+FATE_SAMPLES_AVCONV-$(CONFIG_XWMA_DEMUXER) += fate-xwma-demux
fate-xwma-demux: CMD = crc -i $(SAMPLES)/xwma/ergon.xwma -acodec copy
diff --git a/gst-libs/ext/libav/tests/fate/dfa.mak b/gst-libs/ext/libav/tests/fate/dfa.mak
index 6220c07..4800d8a 100644
--- a/gst-libs/ext/libav/tests/fate/dfa.mak
+++ b/gst-libs/ext/libav/tests/fate/dfa.mak
@@ -31,5 +31,7 @@ fate-dfa10: CMD = framecrc -i $(SAMPLES)/chronomaster-dfa/0009.dfa -pix_fmt rgb2
FATE_DFA += fate-dfa11
fate-dfa11: CMD = framecrc -i $(SAMPLES)/chronomaster-dfa/0010.dfa -pix_fmt rgb24
-FATE_TESTS += $(FATE_DFA)
-fate-dfa: $(FATE_DFA)
+FATE_DFA-$(call DEMDEC, DFA, DFA) += $(FATE_DFA)
+
+FATE_SAMPLES_AVCONV += $(FATE_DFA-yes)
+fate-dfa: $(FATE_DFA-yes)
diff --git a/gst-libs/ext/libav/tests/fate/dpcm.mak b/gst-libs/ext/libav/tests/fate/dpcm.mak
index a8b8b3d..abc25ed 100644
--- a/gst-libs/ext/libav/tests/fate/dpcm.mak
+++ b/gst-libs/ext/libav/tests/fate/dpcm.mak
@@ -1,11 +1,14 @@
-FATE_DPCM += fate-dpcm-idroq
-fate-dpcm-idroq: CMD = framecrc -i $(SAMPLES)/idroq/idlogo.roq
+FATE_DPCM-$(call DEMDEC, ROQ, ROQ_DPCM) += fate-dpcm-idroq
+fate-dpcm-idroq: CMD = framecrc -i $(SAMPLES)/idroq/idlogo.roq -vn
-FATE_DPCM += fate-dpcm-sierra
+FATE_DPCM-$(call DEMDEC, IPMOVIE, INTERPLAY_DPCM) += fate-dpcm-interplay
+fate-dpcm-interplay: CMD = framecrc -i $(SAMPLES)/interplay-mve/interplay-logo-2MB.mve -vn
+
+FATE_DPCM-$(call DEMDEC, SOL, SOL_DPCM) += fate-dpcm-sierra
fate-dpcm-sierra: CMD = md5 -i $(SAMPLES)/sol/lsl7sample.sol -f s16le
-FATE_DPCM += fate-dpcm-xan
+FATE_DPCM-$(call DEMDEC, AVI, XAN_DPCM) += fate-dpcm-xan
fate-dpcm-xan: CMD = md5 -i $(SAMPLES)/wc4-xan/wc4_2.avi -vn -f s16le
-FATE_TESTS += $(FATE_DPCM)
-fate-dpcm: $(FATE_DPCM)
+FATE_SAMPLES_AVCONV += $(FATE_DPCM-yes)
+fate-dpcm: $(FATE_DPCM-yes)
diff --git a/gst-libs/ext/libav/tests/fate/ea.mak b/gst-libs/ext/libav/tests/fate/ea.mak
index 1e628f4..d333042 100644
--- a/gst-libs/ext/libav/tests/fate/ea.mak
+++ b/gst-libs/ext/libav/tests/fate/ea.mak
@@ -1,17 +1,23 @@
-FATE_TESTS += fate-ea-cdata
+FATE_SAMPLES_AVCONV-$(call DEMDEC, EA_CDATA, ADPCM_EA_XAS) += fate-ea-cdata
fate-ea-cdata: CMD = md5 -i $(SAMPLES)/ea-cdata/166b084d.46410f77.0009b440.24be960c.cdata -f s16le
-FATE_TESTS += fate-ea-cmv
-fate-ea-cmv: CMD = framecrc -i $(SAMPLES)/ea-cmv/TITLE.CMV -vsync 0 -pix_fmt rgb24
+FATE_SAMPLES_AVCONV-$(call DEMDEC, EA, EACMV) += fate-ea-cmv
+fate-ea-cmv: CMD = framecrc -i $(SAMPLES)/ea-cmv/TITLE.CMV -pix_fmt rgb24
-FATE_TESTS += fate-ea-dct
-fate-ea-dct: CMD = framecrc -idct simple -i $(SAMPLES)/ea-dct/NFS2Esprit-partial.dct
+FATE_SAMPLES_AVCONV-$(call DEMDEC, EA, EAMAD) += fate-ea-mad
+fate-ea-mad: CMD = framecrc -i $(SAMPLES)/ea-mad/NFS6LogoE.mad -an
-FATE_TESTS += fate-ea-tgq
+FATE_SAMPLES_AVCONV-$(call DEMDEC, EA, EATGQ) += fate-ea-tgq
fate-ea-tgq: CMD = framecrc -i $(SAMPLES)/ea-tgq/v27.tgq -an
-FATE_TESTS += fate-ea-tgv-ima-ea-eacs
-fate-ea-tgv-ima-ea-eacs: CMD = framecrc -i $(SAMPLES)/ea-tgv/INTRO8K-partial.TGV -pix_fmt rgb24
+FATE_EA_TGV += fate-ea-tgv-1
+fate-ea-tgv-1: CMD = framecrc -i $(SAMPLES)/ea-tgv/INTRO8K-partial.TGV -pix_fmt rgb24 -an
-FATE_TESTS += fate-ea-tgv-ima-ea-sead
-fate-ea-tgv-ima-ea-sead: CMD = framecrc -i $(SAMPLES)/ea-tgv/INTEL_S.TGV -pix_fmt rgb24
+FATE_EA_TGV += fate-ea-tgv-2
+fate-ea-tgv-2: CMD = framecrc -i $(SAMPLES)/ea-tgv/INTEL_S.TGV -pix_fmt rgb24 -an
+
+FATE_SAMPLES_AVCONV-$(call DEMDEC, EA, EATGV) += $(FATE_EA_TGV)
+fate-ea-tgv: $(FATE_EA_TGV)
+
+FATE_SAMPLES_AVCONV-$(call DEMDEC, EA, EATQI) += fate-ea-tqi
+fate-ea-tqi: CMD = framecrc -i $(SAMPLES)/ea-wve/networkBackbone-partial.wve -frames:v 26 -an
diff --git a/gst-libs/ext/libav/tests/fate/fft.mak b/gst-libs/ext/libav/tests/fate/fft.mak
index 3afbbe0..20d5638 100644
--- a/gst-libs/ext/libav/tests/fate/fft.mak
+++ b/gst-libs/ext/libav/tests/fate/fft.mak
@@ -4,37 +4,39 @@ FATE_FFT += fate-fft-$(1) fate-ifft-$(1) \
fate-rdft-$(1) fate-irdft-$(1) \
fate-dct1d-$(1) fate-idct1d-$(1)
-fate-fft-$(N): CMD = run libavcodec/fft-test -n$(1)
-fate-ifft-$(N): CMD = run libavcodec/fft-test -n$(1) -i
-fate-mdct-$(N): CMD = run libavcodec/fft-test -n$(1) -m
-fate-imdct-$(N): CMD = run libavcodec/fft-test -n$(1) -m -i
-fate-rdft-$(N): CMD = run libavcodec/fft-test -n$(1) -r
-fate-irdft-$(N): CMD = run libavcodec/fft-test -n$(1) -r -i
-fate-dct1d-$(N): CMD = run libavcodec/fft-test -n$(1) -d
-fate-idct1d-$(N): CMD = run libavcodec/fft-test -n$(1) -d -i
+fate-fft-$(N): ARGS = -n$(1)
+fate-ifft-$(N): ARGS = -n$(1) -i
+fate-mdct-$(N): ARGS = -n$(1) -m
+fate-imdct-$(N): ARGS = -n$(1) -m -i
+fate-rdft-$(N): ARGS = -n$(1) -r
+fate-irdft-$(N): ARGS = -n$(1) -r -i
+fate-dct1d-$(N): ARGS = -n$(1) -d
+fate-idct1d-$(N): ARGS = -n$(1) -d -i
endef
$(foreach N, 4 5 6 7 8 9 10 11 12, $(eval $(call DEF_FFT,$(N))))
fate-fft-test: $(FATE_FFT)
$(FATE_FFT): libavcodec/fft-test$(EXESUF)
+$(FATE_FFT): CMD = run libavcodec/fft-test $(CPUFLAGS:%=-c%) $(ARGS)
$(FATE_FFT): REF = /dev/null
define DEF_FFT_FIXED
FATE_FFT_FIXED += fate-fft-fixed-$(1) fate-ifft-fixed-$(1) \
fate-mdct-fixed-$(1) fate-imdct-fixed-$(1)
-fate-fft-fixed-$(1): CMD = run libavcodec/fft-fixed-test -n$(1)
-fate-ifft-fixed-$(1): CMD = run libavcodec/fft-fixed-test -n$(1) -i
-fate-mdct-fixed-$(1): CMD = run libavcodec/fft-fixed-test -n$(1) -m
-fate-imdct-fixed-$(1): CMD = run libavcodec/fft-fixed-test -n$(1) -m -i
+fate-fft-fixed-$(1): ARGS = -n$(1)
+fate-ifft-fixed-$(1): ARGS = -n$(1) -i
+fate-mdct-fixed-$(1): ARGS = -n$(1) -m
+fate-imdct-fixed-$(1): ARGS = -n$(1) -m -i
endef
$(foreach N, 4 5 6 7 8 9 10 11 12, $(eval $(call DEF_FFT_FIXED,$(N))))
fate-fft-fixed-test: $(FATE_FFT_FIXED)
$(FATE_FFT_FIXED): libavcodec/fft-fixed-test$(EXESUF)
+$(FATE_FFT_FIXED): CMD = run libavcodec/fft-fixed-test $(CPUFLAGS:%=-c%) $(ARGS)
$(FATE_FFT_FIXED): REF = /dev/null
-FATE_TESTS += $(FATE_FFT) $(FATE_FFT_FIXED)
+FATE-$(call ALLYES, AVCODEC FFT) += $(FATE_FFT) $(FATE_FFT_FIXED)
fate-fft: $(FATE_FFT) $(FATE_FFT_FIXED)
diff --git a/gst-libs/ext/libav/tests/fate/filter.mak b/gst-libs/ext/libav/tests/fate/filter.mak
new file mode 100644
index 0000000..f16aee1
--- /dev/null
+++ b/gst-libs/ext/libav/tests/fate/filter.mak
@@ -0,0 +1,42 @@
+FATE_AMIX += fate-filter-amix-simple
+fate-filter-amix-simple: CMD = avconv -filter_complex amix -i $(SRC) -ss 3 -i $(SRC1) -f f32le -
+fate-filter-amix-simple: REF = $(SAMPLES)/filter/amix_simple.pcm
+
+FATE_AMIX += fate-filter-amix-first
+fate-filter-amix-first: CMD = avconv -filter_complex amix=duration=first -ss 4 -i $(SRC) -i $(SRC1) -f f32le -
+fate-filter-amix-first: REF = $(SAMPLES)/filter/amix_first.pcm
+
+FATE_AMIX += fate-filter-amix-transition
+fate-filter-amix-transition: tests/data/asynth-44100-2-3.wav
+fate-filter-amix-transition: SRC2 = $(TARGET_PATH)/tests/data/asynth-44100-2-3.wav
+fate-filter-amix-transition: CMD = avconv -filter_complex amix=inputs=3:dropout_transition=0.5 -i $(SRC) -ss 2 -i $(SRC1) -ss 4 -i $(SRC2) -f f32le -
+fate-filter-amix-transition: REF = $(SAMPLES)/filter/amix_transition.pcm
+
+$(FATE_AMIX): tests/data/asynth-44100-2.wav tests/data/asynth-44100-2-2.wav
+$(FATE_AMIX): SRC = $(TARGET_PATH)/tests/data/asynth-44100-2.wav
+$(FATE_AMIX): SRC1 = $(TARGET_PATH)/tests/data/asynth-44100-2-2.wav
+$(FATE_AMIX): CMP = oneoff
+$(FATE_AMIX): CMP_UNIT = f32
+
+FATE_FILTER-$(CONFIG_AMIX_FILTER) += $(FATE_AMIX)
+
+FATE_FILTER-$(CONFIG_ASYNCTS_FILTER) += fate-filter-asyncts
+fate-filter-asyncts: SRC = $(SAMPLES)/nellymoser/nellymoser-discont.flv
+fate-filter-asyncts: CMD = pcm -analyzeduration 10000000 -i $(SRC) -af asyncts
+fate-filter-asyncts: CMP = oneoff
+fate-filter-asyncts: REF = $(SAMPLES)/nellymoser/nellymoser-discont.pcm
+
+fate-filter-delogo: CMD = framecrc -i $(SAMPLES)/real/rv30.rm -vf delogo=show=0:x=290:y=25:w=26:h=16 -an
+
+FATE_FILTER-$(CONFIG_DELOGO_FILTER) += fate-filter-delogo
+
+FATE_YADIF += fate-filter-yadif-mode0
+fate-filter-yadif-mode0: CMD = framecrc -flags bitexact -idct simple -i $(SAMPLES)/mpeg2/mpeg2_field_encoding.ts -vf yadif=0
+
+FATE_YADIF += fate-filter-yadif-mode1
+fate-filter-yadif-mode1: CMD = framecrc -flags bitexact -idct simple -i $(SAMPLES)/mpeg2/mpeg2_field_encoding.ts -vf yadif=1
+
+FATE_FILTER-$(CONFIG_YADIF_FILTER) += $(FATE_YADIF)
+
+FATE_SAMPLES_AVCONV += $(FATE_FILTER-yes)
+fate-filter: $(FATE_FILTER-yes)
diff --git a/gst-libs/ext/libav/tests/fate/flac.mak b/gst-libs/ext/libav/tests/fate/flac.mak
new file mode 100644
index 0000000..92eb743
--- /dev/null
+++ b/gst-libs/ext/libav/tests/fate/flac.mak
@@ -0,0 +1,26 @@
+FATE_FLAC += fate-flac-16-chmode-indep \
+ fate-flac-16-chmode-left_side \
+ fate-flac-16-chmode-mid_side \
+ fate-flac-16-chmode-right_side \
+ fate-flac-16-fixed \
+ fate-flac-16-lpc-cholesky \
+ fate-flac-16-lpc-levinson \
+ fate-flac-24-comp-8 \
+
+fate-flac-16-chmode-%: OPTS = -ch_mode $(@:fate-flac-16-chmode-%=%)
+fate-flac-16-fixed: OPTS = -lpc_type fixed
+fate-flac-16-lpc-%: OPTS = -lpc_type $(@:fate-flac-16-lpc-%=%)
+
+fate-flac-16-%: REF = $(SAMPLES)/audio-reference/luckynight_2ch_44kHz_s16.wav
+fate-flac-16-%: CMD = enc_dec_pcm flac wav s16le $(REF) -c flac $(OPTS)
+
+fate-flac-24-comp-%: OPTS = -compression_level $(@:fate-flac-24-comp-%=%)
+
+fate-flac-24-%: REF = $(SAMPLES)/audio-reference/divertimenti_2ch_96kHz_s24.wav
+fate-flac-24-%: CMD = enc_dec_pcm flac wav s24le $(REF) -c flac $(OPTS)
+
+fate-flac-%: CMP = oneoff
+fate-flac-%: FUZZ = 0
+
+FATE_SAMPLES_AVCONV += $(FATE_FLAC)
+fate-flac: $(FATE_FLAC)
diff --git a/gst-libs/ext/libav/tests/fate/h264.mak b/gst-libs/ext/libav/tests/fate/h264.mak
index e33ffa5..02ed110 100644
--- a/gst-libs/ext/libav/tests/fate/h264.mak
+++ b/gst-libs/ext/libav/tests/fate/h264.mak
@@ -172,188 +172,190 @@ FATE_H264 = aud_mw_e \
sva_nl2_e \
FATE_H264 := $(FATE_H264:%=fate-h264-conformance-%) \
- fate-h264-interlace-crop \
- fate-h264-lossless \
fate-h264-extreme-plane-pred \
- fate-h264-bsf-mp4toannexb \
+ fate-h264-lossless \
+
+FATE_H264-$(call DEMDEC, H264, H264) += $(FATE_H264)
+FATE_H264-$(call DEMDEC, MOV, H264) += fate-h264-interlace-crop
+FATE_H264-$(call ALLYES, MOV_DEMUXER H264_MP4TOANNEXB_BSF) += fate-h264-bsf-mp4toannexb
-FATE_TESTS += $(FATE_H264)
-fate-h264: $(FATE_H264)
+FATE_SAMPLES_AVCONV += $(FATE_H264-yes)
+fate-h264: $(FATE_H264-yes)
-fate-h264-conformance-aud_mw_e: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/AUD_MW_E.264
-fate-h264-conformance-ba1_ft_c: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/BA1_FT_C.264
-fate-h264-conformance-ba1_sony_d: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/BA1_Sony_D.jsv
-fate-h264-conformance-ba2_sony_f: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/BA2_Sony_F.jsv
-fate-h264-conformance-ba3_sva_c: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/BA3_SVA_C.264
-fate-h264-conformance-ba_mw_d: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/BA_MW_D.264
-fate-h264-conformance-bamq1_jvc_c: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/BAMQ1_JVC_C.264
-fate-h264-conformance-bamq2_jvc_c: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/BAMQ2_JVC_C.264
-fate-h264-conformance-banm_mw_d: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/BANM_MW_D.264
-fate-h264-conformance-basqp1_sony_c: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/BASQP1_Sony_C.jsv
-fate-h264-conformance-caba1_sony_d: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/CABA1_Sony_D.jsv
-fate-h264-conformance-caba1_sva_b: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/CABA1_SVA_B.264
-fate-h264-conformance-caba2_sony_e: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/CABA2_Sony_E.jsv
-fate-h264-conformance-caba2_sva_b: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/CABA2_SVA_B.264
-fate-h264-conformance-caba3_sony_c: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/CABA3_Sony_C.jsv
-fate-h264-conformance-caba3_sva_b: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/CABA3_SVA_B.264
-fate-h264-conformance-caba3_toshiba_e: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/CABA3_TOSHIBA_E.264
-fate-h264-conformance-cabac_mot_fld0_full: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/camp_mot_fld0_full.26l
-fate-h264-conformance-cabac_mot_frm0_full: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/camp_mot_frm0_full.26l
-fate-h264-conformance-cabac_mot_mbaff0_full: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/camp_mot_mbaff0_full.26l
-fate-h264-conformance-cabac_mot_picaff0_full: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/camp_mot_picaff0_full.26l
-fate-h264-conformance-cabaci3_sony_b: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/CABACI3_Sony_B.jsv
-fate-h264-conformance-cabast3_sony_e: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/CABAST3_Sony_E.jsv
-fate-h264-conformance-cabastbr3_sony_b: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/CABASTBR3_Sony_B.jsv
-fate-h264-conformance-cabref3_sand_d: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/CABREF3_Sand_D.264
-fate-h264-conformance-cacqp3_sony_d: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/CACQP3_Sony_D.jsv
-fate-h264-conformance-cafi1_sva_c: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/CAFI1_SVA_C.264
-fate-h264-conformance-cama1_sony_c: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/CAMA1_Sony_C.jsv
-fate-h264-conformance-cama1_toshiba_b: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/CAMA1_TOSHIBA_B.264
-fate-h264-conformance-cama1_vtc_c: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/cama1_vtc_c.avc
-fate-h264-conformance-cama2_vtc_b: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/cama2_vtc_b.avc
-fate-h264-conformance-cama3_sand_e: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/CAMA3_Sand_E.264
-fate-h264-conformance-cama3_vtc_b: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/cama3_vtc_b.avc
-fate-h264-conformance-camaci3_sony_c: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/CAMACI3_Sony_C.jsv
-fate-h264-conformance-camanl1_toshiba_b: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/CAMANL1_TOSHIBA_B.264
-fate-h264-conformance-camanl2_toshiba_b: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/CAMANL2_TOSHIBA_B.264
-fate-h264-conformance-camanl3_sand_e: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/CAMANL3_Sand_E.264
-fate-h264-conformance-camasl3_sony_b: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/CAMASL3_Sony_B.jsv
-fate-h264-conformance-camp_mot_mbaff_l30: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/CAMP_MOT_MBAFF_L30.26l
-fate-h264-conformance-camp_mot_mbaff_l31: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/CAMP_MOT_MBAFF_L31.26l
-fate-h264-conformance-canl1_sony_e: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/CANL1_Sony_E.jsv
-fate-h264-conformance-canl1_sva_b: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/CANL1_SVA_B.264
-fate-h264-conformance-canl1_toshiba_g: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/CANL1_TOSHIBA_G.264
-fate-h264-conformance-canl2_sony_e: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/CANL2_Sony_E.jsv
-fate-h264-conformance-canl2_sva_b: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/CANL2_SVA_B.264
-fate-h264-conformance-canl3_sony_c: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/CANL3_Sony_C.jsv
-fate-h264-conformance-canl3_sva_b: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/CANL3_SVA_B.264
-fate-h264-conformance-canl4_sva_b: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/CANL4_SVA_B.264
-fate-h264-conformance-canlma2_sony_c: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/CANLMA2_Sony_C.jsv
-fate-h264-conformance-canlma3_sony_c: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/CANLMA3_Sony_C.jsv
-fate-h264-conformance-capa1_toshiba_b: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/CAPA1_TOSHIBA_B.264
-fate-h264-conformance-capama3_sand_f: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/CAPAMA3_Sand_F.264
-fate-h264-conformance-capcm1_sand_e: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/CAPCM1_Sand_E.264
-fate-h264-conformance-capcmnl1_sand_e: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/CAPCMNL1_Sand_E.264
-fate-h264-conformance-capm3_sony_d: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/CAPM3_Sony_D.jsv
-fate-h264-conformance-caqp1_sony_b: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/CAQP1_Sony_B.jsv
-fate-h264-conformance-cavlc_mot_fld0_full_b: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/cvmp_mot_fld0_full_B.26l
-fate-h264-conformance-cavlc_mot_frm0_full_b: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/cvmp_mot_frm0_full_B.26l
-fate-h264-conformance-cavlc_mot_mbaff0_full_b: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/cvmp_mot_mbaff0_full_B.26l
-fate-h264-conformance-cavlc_mot_picaff0_full_b: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/cvmp_mot_picaff0_full_B.26l
-fate-h264-conformance-cawp1_toshiba_e: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/CAWP1_TOSHIBA_E.264
-fate-h264-conformance-cawp5_toshiba_e: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/CAWP5_TOSHIBA_E.264
-fate-h264-conformance-ci1_ft_b: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/CI1_FT_B.264
-fate-h264-conformance-ci_mw_d: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/CI_MW_D.264
-fate-h264-conformance-cvbs3_sony_c: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/CVBS3_Sony_C.jsv
-fate-h264-conformance-cvcanlma2_sony_c: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/CVCANLMA2_Sony_C.jsv
-fate-h264-conformance-cvfi1_sony_d: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/CVFI1_Sony_D.jsv
-fate-h264-conformance-cvfi1_sva_c: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/CVFI1_SVA_C.264
-fate-h264-conformance-cvfi2_sony_h: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/CVFI2_Sony_H.jsv
-fate-h264-conformance-cvfi2_sva_c: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/CVFI2_SVA_C.264
-fate-h264-conformance-cvma1_sony_d: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/CVMA1_Sony_D.jsv
-fate-h264-conformance-cvma1_toshiba_b: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/CVMA1_TOSHIBA_B.264
-fate-h264-conformance-cvmanl1_toshiba_b: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/CVMANL1_TOSHIBA_B.264
-fate-h264-conformance-cvmanl2_toshiba_b: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/CVMANL2_TOSHIBA_B.264
-fate-h264-conformance-cvmapaqp3_sony_e: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/CVMAPAQP3_Sony_E.jsv
-fate-h264-conformance-cvmaqp2_sony_g: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/CVMAQP2_Sony_G.jsv
-fate-h264-conformance-cvmaqp3_sony_d: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/CVMAQP3_Sony_D.jsv
-fate-h264-conformance-cvmp_mot_fld_l30_b: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/CVMP_MOT_FLD_L30_B.26l
-fate-h264-conformance-cvmp_mot_frm_l31_b: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/CVMP_MOT_FRM_L31_B.26l
-fate-h264-conformance-cvnlfi1_sony_c: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/CVNLFI1_Sony_C.jsv
-fate-h264-conformance-cvnlfi2_sony_h: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/CVNLFI2_Sony_H.jsv
-fate-h264-conformance-cvpa1_toshiba_b: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/CVPA1_TOSHIBA_B.264
-fate-h264-conformance-cvpcmnl1_sva_c: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/CVPCMNL1_SVA_C.264
-fate-h264-conformance-cvpcmnl2_sva_c: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/CVPCMNL2_SVA_C.264
-fate-h264-conformance-cvwp1_toshiba_e: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/CVWP1_TOSHIBA_E.264
-fate-h264-conformance-cvwp2_toshiba_e: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/CVWP2_TOSHIBA_E.264
-fate-h264-conformance-cvwp3_toshiba_e: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/CVWP3_TOSHIBA_E.264
-fate-h264-conformance-cvwp5_toshiba_e: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/CVWP5_TOSHIBA_E.264
-fate-h264-conformance-fi1_sony_e: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/FI1_Sony_E.jsv
-fate-h264-conformance-frext-alphaconformanceg: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/FRext/test8b43.264
-fate-h264-conformance-frext-bcrm_freh10: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/FRext/freh10.264 -vsync 0
-fate-h264-conformance-frext-brcm_freh11: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/FRext/freh11.264 -vsync 0
-fate-h264-conformance-frext-brcm_freh3: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/FRext/freh3.264
-fate-h264-conformance-frext-brcm_freh4: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/FRext/freh4.264 -vsync 0
-fate-h264-conformance-frext-brcm_freh5: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/FRext/freh5.264
-fate-h264-conformance-frext-brcm_freh8: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/FRext/freh8.264
-fate-h264-conformance-frext-brcm_freh9: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/FRext/freh9.264
-fate-h264-conformance-frext-freh12_b: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/FRext/Freh12_B.264
-fate-h264-conformance-frext-freh1_b: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/FRext/Freh1_B.264
-fate-h264-conformance-frext-freh2_b: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/FRext/Freh2_B.264
-fate-h264-conformance-frext-freh6: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/FRext/freh6.264 -vsync 0
-fate-h264-conformance-frext-freh7_b: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/FRext/Freh7_B.264 -vsync 0
-fate-h264-conformance-frext-frext01_jvc_d: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/FRext/FREXT01_JVC_D.264
-fate-h264-conformance-frext-frext02_jvc_c: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/FRext/FREXT02_JVC_C.264
-fate-h264-conformance-frext-frext1_panasonic_c: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/FRext/FRExt1_Panasonic.avc
-fate-h264-conformance-frext-frext2_panasonic_b: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/FRext/FRExt2_Panasonic.avc -vsync 0
-fate-h264-conformance-frext-frext3_panasonic_d: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/FRext/FRExt3_Panasonic.avc
-fate-h264-conformance-frext-frext4_panasonic_a: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/FRext/FRExt4_Panasonic.avc
-fate-h264-conformance-frext-frext_mmco4_sony_b: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/FRext/FRExt_MMCO4_Sony_B.264
-fate-h264-conformance-frext-hcaff1_hhi_b: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/FRext/HCAFF1_HHI.264
-fate-h264-conformance-frext-hcafr1_hhi_c: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/FRext/HCAFR1_HHI.264
-fate-h264-conformance-frext-hcafr2_hhi_a: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/FRext/HCAFR2_HHI.264
-fate-h264-conformance-frext-hcafr3_hhi_a: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/FRext/HCAFR3_HHI.264
-fate-h264-conformance-frext-hcafr4_hhi_a: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/FRext/HCAFR4_HHI.264
-fate-h264-conformance-frext-hcamff1_hhi_b: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/FRext/HCAMFF1_HHI.264
-fate-h264-conformance-frext-hpca_brcm_c: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/FRext/HPCA_BRCM_C.264
-fate-h264-conformance-frext-hpcadq_brcm_b: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/FRext/HPCADQ_BRCM_B.264
-fate-h264-conformance-frext-hpcafl_bcrm_c: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/FRext/HPCAFL_BRCM_C.264 -vsync 0
-fate-h264-conformance-frext-hpcaflnl_bcrm_c: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/FRext/HPCAFLNL_BRCM_C.264 -vsync 0
-fate-h264-conformance-frext-hpcalq_brcm_b: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/FRext/HPCALQ_BRCM_B.264
-fate-h264-conformance-frext-hpcamapalq_bcrm_b: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/FRext/HPCAMAPALQ_BRCM_B.264 -vsync 0
-fate-h264-conformance-frext-hpcamolq_brcm_b: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/FRext/HPCAMOLQ_BRCM_B.264
-fate-h264-conformance-frext-hpcanl_brcm_c: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/FRext/HPCANL_BRCM_C.264
-fate-h264-conformance-frext-hpcaq2lq_brcm_b: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/FRext/HPCAQ2LQ_BRCM_B.264
-fate-h264-conformance-frext-hpcv_brcm_a: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/FRext/HPCV_BRCM_A.264
-fate-h264-conformance-frext-hpcvfl_bcrm_a: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/FRext/HPCVFL_BRCM_A.264 -vsync 0
-fate-h264-conformance-frext-hpcvflnl_bcrm_a: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/FRext/HPCVFLNL_BRCM_A.264 -vsync 0
-fate-h264-conformance-frext-hpcvmolq_brcm_b: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/FRext/HPCVMOLQ_BRCM_B.264
-fate-h264-conformance-frext-hpcvnl_brcm_a: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/FRext/HPCVNL_BRCM_A.264
-fate-h264-conformance-frext-pph10i1_panasonic_a: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/FRext/PPH10I1_Panasonic_A.264 -pix_fmt yuv420p10le
-fate-h264-conformance-frext-pph10i2_panasonic_a: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/FRext/PPH10I2_Panasonic_A.264 -pix_fmt yuv420p10le
-fate-h264-conformance-frext-pph10i3_panasonic_a: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/FRext/PPH10I3_Panasonic_A.264 -pix_fmt yuv420p10le
-fate-h264-conformance-frext-pph10i4_panasonic_a: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/FRext/PPH10I4_Panasonic_A.264 -pix_fmt yuv420p10le
-fate-h264-conformance-frext-pph10i5_panasonic_a: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/FRext/PPH10I5_Panasonic_A.264 -pix_fmt yuv420p10le
-fate-h264-conformance-frext-pph10i6_panasonic_a: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/FRext/PPH10I6_Panasonic_A.264 -pix_fmt yuv420p10le
-fate-h264-conformance-frext-pph10i7_panasonic_a: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/FRext/PPH10I7_Panasonic_A.264 -pix_fmt yuv420p10le
-fate-h264-conformance-hcbp2_hhi_a: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/HCBP2_HHI_A.264
-fate-h264-conformance-hcmp1_hhi_a: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/HCMP1_HHI_A.264
-fate-h264-conformance-ls_sva_d: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/LS_SVA_D.264
-fate-h264-conformance-midr_mw_d: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/MIDR_MW_D.264
-fate-h264-conformance-mps_mw_a: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/MPS_MW_A.264
-fate-h264-conformance-mr1_bt_a: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/MR1_BT_A.h264
-fate-h264-conformance-mr1_mw_a: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/MR1_MW_A.264
-fate-h264-conformance-mr2_mw_a: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/MR2_MW_A.264
-fate-h264-conformance-mr2_tandberg_e: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/MR2_TANDBERG_E.264
-fate-h264-conformance-mr3_tandberg_b: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/MR3_TANDBERG_B.264
-fate-h264-conformance-mr4_tandberg_c: CMD = framecrc -vsync 0 -strict 1 -i $(SAMPLES)/h264-conformance/MR4_TANDBERG_C.264
-fate-h264-conformance-mr5_tandberg_c: CMD = framecrc -vsync 0 -strict 1 -i $(SAMPLES)/h264-conformance/MR5_TANDBERG_C.264
-fate-h264-conformance-mr6_bt_b: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/MR6_BT_B.h264
-fate-h264-conformance-mr7_bt_b: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/MR7_BT_B.h264
-fate-h264-conformance-mr8_bt_b: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/MR8_BT_B.h264
-fate-h264-conformance-mr9_bt_b: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/MR9_BT_B.h264
-fate-h264-conformance-mv1_brcm_d: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/src19td.IBP.264
-fate-h264-conformance-nl1_sony_d: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/NL1_Sony_D.jsv
-fate-h264-conformance-nl2_sony_h: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/NL2_Sony_H.jsv
-fate-h264-conformance-nl3_sva_e: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/NL3_SVA_E.264
-fate-h264-conformance-nlmq1_jvc_c: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/NLMQ1_JVC_C.264
-fate-h264-conformance-nlmq2_jvc_c: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/NLMQ2_JVC_C.264
-fate-h264-conformance-nrf_mw_e: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/NRF_MW_E.264
-fate-h264-conformance-sharp_mp_field_1_b: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/Sharp_MP_Field_1_B.jvt
-fate-h264-conformance-sharp_mp_field_2_b: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/Sharp_MP_Field_2_B.jvt
-fate-h264-conformance-sharp_mp_field_3_b: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/Sharp_MP_Field_3_B.jvt
-fate-h264-conformance-sharp_mp_paff_1r2: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/Sharp_MP_PAFF_1r2.jvt
-fate-h264-conformance-sharp_mp_paff_2r: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/Sharp_MP_PAFF_2.jvt
-fate-h264-conformance-sl1_sva_b: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/SL1_SVA_B.264
-fate-h264-conformance-sva_ba1_b: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/SVA_BA1_B.264
-fate-h264-conformance-sva_ba2_d: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/SVA_BA2_D.264
-fate-h264-conformance-sva_base_b: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/SVA_Base_B.264
-fate-h264-conformance-sva_cl1_e: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/SVA_CL1_E.264
-fate-h264-conformance-sva_fm1_e: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/SVA_FM1_E.264
-fate-h264-conformance-sva_nl1_b: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/SVA_NL1_B.264
-fate-h264-conformance-sva_nl2_e: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264-conformance/SVA_NL2_E.264
+fate-h264-conformance-aud_mw_e: CMD = framecrc -i $(SAMPLES)/h264-conformance/AUD_MW_E.264
+fate-h264-conformance-ba1_ft_c: CMD = framecrc -i $(SAMPLES)/h264-conformance/BA1_FT_C.264
+fate-h264-conformance-ba1_sony_d: CMD = framecrc -i $(SAMPLES)/h264-conformance/BA1_Sony_D.jsv
+fate-h264-conformance-ba2_sony_f: CMD = framecrc -i $(SAMPLES)/h264-conformance/BA2_Sony_F.jsv
+fate-h264-conformance-ba3_sva_c: CMD = framecrc -i $(SAMPLES)/h264-conformance/BA3_SVA_C.264
+fate-h264-conformance-ba_mw_d: CMD = framecrc -i $(SAMPLES)/h264-conformance/BA_MW_D.264
+fate-h264-conformance-bamq1_jvc_c: CMD = framecrc -i $(SAMPLES)/h264-conformance/BAMQ1_JVC_C.264
+fate-h264-conformance-bamq2_jvc_c: CMD = framecrc -i $(SAMPLES)/h264-conformance/BAMQ2_JVC_C.264
+fate-h264-conformance-banm_mw_d: CMD = framecrc -i $(SAMPLES)/h264-conformance/BANM_MW_D.264
+fate-h264-conformance-basqp1_sony_c: CMD = framecrc -i $(SAMPLES)/h264-conformance/BASQP1_Sony_C.jsv
+fate-h264-conformance-caba1_sony_d: CMD = framecrc -i $(SAMPLES)/h264-conformance/CABA1_Sony_D.jsv
+fate-h264-conformance-caba1_sva_b: CMD = framecrc -i $(SAMPLES)/h264-conformance/CABA1_SVA_B.264
+fate-h264-conformance-caba2_sony_e: CMD = framecrc -i $(SAMPLES)/h264-conformance/CABA2_Sony_E.jsv
+fate-h264-conformance-caba2_sva_b: CMD = framecrc -i $(SAMPLES)/h264-conformance/CABA2_SVA_B.264
+fate-h264-conformance-caba3_sony_c: CMD = framecrc -i $(SAMPLES)/h264-conformance/CABA3_Sony_C.jsv
+fate-h264-conformance-caba3_sva_b: CMD = framecrc -i $(SAMPLES)/h264-conformance/CABA3_SVA_B.264
+fate-h264-conformance-caba3_toshiba_e: CMD = framecrc -i $(SAMPLES)/h264-conformance/CABA3_TOSHIBA_E.264
+fate-h264-conformance-cabac_mot_fld0_full: CMD = framecrc -i $(SAMPLES)/h264-conformance/camp_mot_fld0_full.26l
+fate-h264-conformance-cabac_mot_frm0_full: CMD = framecrc -i $(SAMPLES)/h264-conformance/camp_mot_frm0_full.26l
+fate-h264-conformance-cabac_mot_mbaff0_full: CMD = framecrc -i $(SAMPLES)/h264-conformance/camp_mot_mbaff0_full.26l
+fate-h264-conformance-cabac_mot_picaff0_full: CMD = framecrc -i $(SAMPLES)/h264-conformance/camp_mot_picaff0_full.26l
+fate-h264-conformance-cabaci3_sony_b: CMD = framecrc -i $(SAMPLES)/h264-conformance/CABACI3_Sony_B.jsv
+fate-h264-conformance-cabast3_sony_e: CMD = framecrc -i $(SAMPLES)/h264-conformance/CABAST3_Sony_E.jsv
+fate-h264-conformance-cabastbr3_sony_b: CMD = framecrc -i $(SAMPLES)/h264-conformance/CABASTBR3_Sony_B.jsv
+fate-h264-conformance-cabref3_sand_d: CMD = framecrc -i $(SAMPLES)/h264-conformance/CABREF3_Sand_D.264
+fate-h264-conformance-cacqp3_sony_d: CMD = framecrc -i $(SAMPLES)/h264-conformance/CACQP3_Sony_D.jsv
+fate-h264-conformance-cafi1_sva_c: CMD = framecrc -i $(SAMPLES)/h264-conformance/CAFI1_SVA_C.264
+fate-h264-conformance-cama1_sony_c: CMD = framecrc -i $(SAMPLES)/h264-conformance/CAMA1_Sony_C.jsv
+fate-h264-conformance-cama1_toshiba_b: CMD = framecrc -i $(SAMPLES)/h264-conformance/CAMA1_TOSHIBA_B.264
+fate-h264-conformance-cama1_vtc_c: CMD = framecrc -i $(SAMPLES)/h264-conformance/cama1_vtc_c.avc
+fate-h264-conformance-cama2_vtc_b: CMD = framecrc -i $(SAMPLES)/h264-conformance/cama2_vtc_b.avc
+fate-h264-conformance-cama3_sand_e: CMD = framecrc -i $(SAMPLES)/h264-conformance/CAMA3_Sand_E.264
+fate-h264-conformance-cama3_vtc_b: CMD = framecrc -i $(SAMPLES)/h264-conformance/cama3_vtc_b.avc
+fate-h264-conformance-camaci3_sony_c: CMD = framecrc -i $(SAMPLES)/h264-conformance/CAMACI3_Sony_C.jsv
+fate-h264-conformance-camanl1_toshiba_b: CMD = framecrc -i $(SAMPLES)/h264-conformance/CAMANL1_TOSHIBA_B.264
+fate-h264-conformance-camanl2_toshiba_b: CMD = framecrc -i $(SAMPLES)/h264-conformance/CAMANL2_TOSHIBA_B.264
+fate-h264-conformance-camanl3_sand_e: CMD = framecrc -i $(SAMPLES)/h264-conformance/CAMANL3_Sand_E.264
+fate-h264-conformance-camasl3_sony_b: CMD = framecrc -i $(SAMPLES)/h264-conformance/CAMASL3_Sony_B.jsv
+fate-h264-conformance-camp_mot_mbaff_l30: CMD = framecrc -i $(SAMPLES)/h264-conformance/CAMP_MOT_MBAFF_L30.26l
+fate-h264-conformance-camp_mot_mbaff_l31: CMD = framecrc -i $(SAMPLES)/h264-conformance/CAMP_MOT_MBAFF_L31.26l
+fate-h264-conformance-canl1_sony_e: CMD = framecrc -i $(SAMPLES)/h264-conformance/CANL1_Sony_E.jsv
+fate-h264-conformance-canl1_sva_b: CMD = framecrc -i $(SAMPLES)/h264-conformance/CANL1_SVA_B.264
+fate-h264-conformance-canl1_toshiba_g: CMD = framecrc -i $(SAMPLES)/h264-conformance/CANL1_TOSHIBA_G.264
+fate-h264-conformance-canl2_sony_e: CMD = framecrc -i $(SAMPLES)/h264-conformance/CANL2_Sony_E.jsv
+fate-h264-conformance-canl2_sva_b: CMD = framecrc -i $(SAMPLES)/h264-conformance/CANL2_SVA_B.264
+fate-h264-conformance-canl3_sony_c: CMD = framecrc -i $(SAMPLES)/h264-conformance/CANL3_Sony_C.jsv
+fate-h264-conformance-canl3_sva_b: CMD = framecrc -i $(SAMPLES)/h264-conformance/CANL3_SVA_B.264
+fate-h264-conformance-canl4_sva_b: CMD = framecrc -i $(SAMPLES)/h264-conformance/CANL4_SVA_B.264
+fate-h264-conformance-canlma2_sony_c: CMD = framecrc -i $(SAMPLES)/h264-conformance/CANLMA2_Sony_C.jsv
+fate-h264-conformance-canlma3_sony_c: CMD = framecrc -i $(SAMPLES)/h264-conformance/CANLMA3_Sony_C.jsv
+fate-h264-conformance-capa1_toshiba_b: CMD = framecrc -i $(SAMPLES)/h264-conformance/CAPA1_TOSHIBA_B.264
+fate-h264-conformance-capama3_sand_f: CMD = framecrc -i $(SAMPLES)/h264-conformance/CAPAMA3_Sand_F.264
+fate-h264-conformance-capcm1_sand_e: CMD = framecrc -i $(SAMPLES)/h264-conformance/CAPCM1_Sand_E.264
+fate-h264-conformance-capcmnl1_sand_e: CMD = framecrc -i $(SAMPLES)/h264-conformance/CAPCMNL1_Sand_E.264
+fate-h264-conformance-capm3_sony_d: CMD = framecrc -i $(SAMPLES)/h264-conformance/CAPM3_Sony_D.jsv
+fate-h264-conformance-caqp1_sony_b: CMD = framecrc -i $(SAMPLES)/h264-conformance/CAQP1_Sony_B.jsv
+fate-h264-conformance-cavlc_mot_fld0_full_b: CMD = framecrc -i $(SAMPLES)/h264-conformance/cvmp_mot_fld0_full_B.26l
+fate-h264-conformance-cavlc_mot_frm0_full_b: CMD = framecrc -i $(SAMPLES)/h264-conformance/cvmp_mot_frm0_full_B.26l
+fate-h264-conformance-cavlc_mot_mbaff0_full_b: CMD = framecrc -i $(SAMPLES)/h264-conformance/cvmp_mot_mbaff0_full_B.26l
+fate-h264-conformance-cavlc_mot_picaff0_full_b: CMD = framecrc -i $(SAMPLES)/h264-conformance/cvmp_mot_picaff0_full_B.26l
+fate-h264-conformance-cawp1_toshiba_e: CMD = framecrc -i $(SAMPLES)/h264-conformance/CAWP1_TOSHIBA_E.264
+fate-h264-conformance-cawp5_toshiba_e: CMD = framecrc -i $(SAMPLES)/h264-conformance/CAWP5_TOSHIBA_E.264
+fate-h264-conformance-ci1_ft_b: CMD = framecrc -i $(SAMPLES)/h264-conformance/CI1_FT_B.264
+fate-h264-conformance-ci_mw_d: CMD = framecrc -i $(SAMPLES)/h264-conformance/CI_MW_D.264
+fate-h264-conformance-cvbs3_sony_c: CMD = framecrc -i $(SAMPLES)/h264-conformance/CVBS3_Sony_C.jsv
+fate-h264-conformance-cvcanlma2_sony_c: CMD = framecrc -i $(SAMPLES)/h264-conformance/CVCANLMA2_Sony_C.jsv
+fate-h264-conformance-cvfi1_sony_d: CMD = framecrc -i $(SAMPLES)/h264-conformance/CVFI1_Sony_D.jsv
+fate-h264-conformance-cvfi1_sva_c: CMD = framecrc -i $(SAMPLES)/h264-conformance/CVFI1_SVA_C.264
+fate-h264-conformance-cvfi2_sony_h: CMD = framecrc -i $(SAMPLES)/h264-conformance/CVFI2_Sony_H.jsv
+fate-h264-conformance-cvfi2_sva_c: CMD = framecrc -i $(SAMPLES)/h264-conformance/CVFI2_SVA_C.264
+fate-h264-conformance-cvma1_sony_d: CMD = framecrc -i $(SAMPLES)/h264-conformance/CVMA1_Sony_D.jsv
+fate-h264-conformance-cvma1_toshiba_b: CMD = framecrc -i $(SAMPLES)/h264-conformance/CVMA1_TOSHIBA_B.264
+fate-h264-conformance-cvmanl1_toshiba_b: CMD = framecrc -i $(SAMPLES)/h264-conformance/CVMANL1_TOSHIBA_B.264
+fate-h264-conformance-cvmanl2_toshiba_b: CMD = framecrc -i $(SAMPLES)/h264-conformance/CVMANL2_TOSHIBA_B.264
+fate-h264-conformance-cvmapaqp3_sony_e: CMD = framecrc -i $(SAMPLES)/h264-conformance/CVMAPAQP3_Sony_E.jsv
+fate-h264-conformance-cvmaqp2_sony_g: CMD = framecrc -i $(SAMPLES)/h264-conformance/CVMAQP2_Sony_G.jsv
+fate-h264-conformance-cvmaqp3_sony_d: CMD = framecrc -i $(SAMPLES)/h264-conformance/CVMAQP3_Sony_D.jsv
+fate-h264-conformance-cvmp_mot_fld_l30_b: CMD = framecrc -i $(SAMPLES)/h264-conformance/CVMP_MOT_FLD_L30_B.26l
+fate-h264-conformance-cvmp_mot_frm_l31_b: CMD = framecrc -i $(SAMPLES)/h264-conformance/CVMP_MOT_FRM_L31_B.26l
+fate-h264-conformance-cvnlfi1_sony_c: CMD = framecrc -i $(SAMPLES)/h264-conformance/CVNLFI1_Sony_C.jsv
+fate-h264-conformance-cvnlfi2_sony_h: CMD = framecrc -i $(SAMPLES)/h264-conformance/CVNLFI2_Sony_H.jsv
+fate-h264-conformance-cvpa1_toshiba_b: CMD = framecrc -i $(SAMPLES)/h264-conformance/CVPA1_TOSHIBA_B.264
+fate-h264-conformance-cvpcmnl1_sva_c: CMD = framecrc -i $(SAMPLES)/h264-conformance/CVPCMNL1_SVA_C.264
+fate-h264-conformance-cvpcmnl2_sva_c: CMD = framecrc -i $(SAMPLES)/h264-conformance/CVPCMNL2_SVA_C.264
+fate-h264-conformance-cvwp1_toshiba_e: CMD = framecrc -i $(SAMPLES)/h264-conformance/CVWP1_TOSHIBA_E.264
+fate-h264-conformance-cvwp2_toshiba_e: CMD = framecrc -i $(SAMPLES)/h264-conformance/CVWP2_TOSHIBA_E.264
+fate-h264-conformance-cvwp3_toshiba_e: CMD = framecrc -i $(SAMPLES)/h264-conformance/CVWP3_TOSHIBA_E.264
+fate-h264-conformance-cvwp5_toshiba_e: CMD = framecrc -i $(SAMPLES)/h264-conformance/CVWP5_TOSHIBA_E.264
+fate-h264-conformance-fi1_sony_e: CMD = framecrc -i $(SAMPLES)/h264-conformance/FI1_Sony_E.jsv
+fate-h264-conformance-frext-alphaconformanceg: CMD = framecrc -i $(SAMPLES)/h264-conformance/FRext/test8b43.264
+fate-h264-conformance-frext-bcrm_freh10: CMD = framecrc -i $(SAMPLES)/h264-conformance/FRext/freh10.264 -vsync 0
+fate-h264-conformance-frext-brcm_freh11: CMD = framecrc -i $(SAMPLES)/h264-conformance/FRext/freh11.264 -vsync 0
+fate-h264-conformance-frext-brcm_freh3: CMD = framecrc -i $(SAMPLES)/h264-conformance/FRext/freh3.264
+fate-h264-conformance-frext-brcm_freh4: CMD = framecrc -i $(SAMPLES)/h264-conformance/FRext/freh4.264 -vsync 0
+fate-h264-conformance-frext-brcm_freh5: CMD = framecrc -i $(SAMPLES)/h264-conformance/FRext/freh5.264
+fate-h264-conformance-frext-brcm_freh8: CMD = framecrc -i $(SAMPLES)/h264-conformance/FRext/freh8.264
+fate-h264-conformance-frext-brcm_freh9: CMD = framecrc -i $(SAMPLES)/h264-conformance/FRext/freh9.264
+fate-h264-conformance-frext-freh12_b: CMD = framecrc -i $(SAMPLES)/h264-conformance/FRext/Freh12_B.264
+fate-h264-conformance-frext-freh1_b: CMD = framecrc -i $(SAMPLES)/h264-conformance/FRext/Freh1_B.264
+fate-h264-conformance-frext-freh2_b: CMD = framecrc -i $(SAMPLES)/h264-conformance/FRext/Freh2_B.264
+fate-h264-conformance-frext-freh6: CMD = framecrc -i $(SAMPLES)/h264-conformance/FRext/freh6.264 -vsync 0
+fate-h264-conformance-frext-freh7_b: CMD = framecrc -i $(SAMPLES)/h264-conformance/FRext/Freh7_B.264 -vsync 0
+fate-h264-conformance-frext-frext01_jvc_d: CMD = framecrc -i $(SAMPLES)/h264-conformance/FRext/FREXT01_JVC_D.264
+fate-h264-conformance-frext-frext02_jvc_c: CMD = framecrc -i $(SAMPLES)/h264-conformance/FRext/FREXT02_JVC_C.264
+fate-h264-conformance-frext-frext1_panasonic_c: CMD = framecrc -i $(SAMPLES)/h264-conformance/FRext/FRExt1_Panasonic.avc
+fate-h264-conformance-frext-frext2_panasonic_b: CMD = framecrc -i $(SAMPLES)/h264-conformance/FRext/FRExt2_Panasonic.avc -vsync 0
+fate-h264-conformance-frext-frext3_panasonic_d: CMD = framecrc -i $(SAMPLES)/h264-conformance/FRext/FRExt3_Panasonic.avc
+fate-h264-conformance-frext-frext4_panasonic_a: CMD = framecrc -i $(SAMPLES)/h264-conformance/FRext/FRExt4_Panasonic.avc
+fate-h264-conformance-frext-frext_mmco4_sony_b: CMD = framecrc -i $(SAMPLES)/h264-conformance/FRext/FRExt_MMCO4_Sony_B.264
+fate-h264-conformance-frext-hcaff1_hhi_b: CMD = framecrc -i $(SAMPLES)/h264-conformance/FRext/HCAFF1_HHI.264
+fate-h264-conformance-frext-hcafr1_hhi_c: CMD = framecrc -i $(SAMPLES)/h264-conformance/FRext/HCAFR1_HHI.264
+fate-h264-conformance-frext-hcafr2_hhi_a: CMD = framecrc -i $(SAMPLES)/h264-conformance/FRext/HCAFR2_HHI.264
+fate-h264-conformance-frext-hcafr3_hhi_a: CMD = framecrc -i $(SAMPLES)/h264-conformance/FRext/HCAFR3_HHI.264
+fate-h264-conformance-frext-hcafr4_hhi_a: CMD = framecrc -i $(SAMPLES)/h264-conformance/FRext/HCAFR4_HHI.264
+fate-h264-conformance-frext-hcamff1_hhi_b: CMD = framecrc -i $(SAMPLES)/h264-conformance/FRext/HCAMFF1_HHI.264
+fate-h264-conformance-frext-hpca_brcm_c: CMD = framecrc -i $(SAMPLES)/h264-conformance/FRext/HPCA_BRCM_C.264
+fate-h264-conformance-frext-hpcadq_brcm_b: CMD = framecrc -i $(SAMPLES)/h264-conformance/FRext/HPCADQ_BRCM_B.264
+fate-h264-conformance-frext-hpcafl_bcrm_c: CMD = framecrc -i $(SAMPLES)/h264-conformance/FRext/HPCAFL_BRCM_C.264 -vsync 0
+fate-h264-conformance-frext-hpcaflnl_bcrm_c: CMD = framecrc -i $(SAMPLES)/h264-conformance/FRext/HPCAFLNL_BRCM_C.264 -vsync 0
+fate-h264-conformance-frext-hpcalq_brcm_b: CMD = framecrc -i $(SAMPLES)/h264-conformance/FRext/HPCALQ_BRCM_B.264
+fate-h264-conformance-frext-hpcamapalq_bcrm_b: CMD = framecrc -i $(SAMPLES)/h264-conformance/FRext/HPCAMAPALQ_BRCM_B.264 -vsync 0
+fate-h264-conformance-frext-hpcamolq_brcm_b: CMD = framecrc -i $(SAMPLES)/h264-conformance/FRext/HPCAMOLQ_BRCM_B.264
+fate-h264-conformance-frext-hpcanl_brcm_c: CMD = framecrc -i $(SAMPLES)/h264-conformance/FRext/HPCANL_BRCM_C.264
+fate-h264-conformance-frext-hpcaq2lq_brcm_b: CMD = framecrc -i $(SAMPLES)/h264-conformance/FRext/HPCAQ2LQ_BRCM_B.264
+fate-h264-conformance-frext-hpcv_brcm_a: CMD = framecrc -i $(SAMPLES)/h264-conformance/FRext/HPCV_BRCM_A.264
+fate-h264-conformance-frext-hpcvfl_bcrm_a: CMD = framecrc -i $(SAMPLES)/h264-conformance/FRext/HPCVFL_BRCM_A.264 -vsync 0
+fate-h264-conformance-frext-hpcvflnl_bcrm_a: CMD = framecrc -i $(SAMPLES)/h264-conformance/FRext/HPCVFLNL_BRCM_A.264 -vsync 0
+fate-h264-conformance-frext-hpcvmolq_brcm_b: CMD = framecrc -i $(SAMPLES)/h264-conformance/FRext/HPCVMOLQ_BRCM_B.264
+fate-h264-conformance-frext-hpcvnl_brcm_a: CMD = framecrc -i $(SAMPLES)/h264-conformance/FRext/HPCVNL_BRCM_A.264
+fate-h264-conformance-frext-pph10i1_panasonic_a: CMD = framecrc -i $(SAMPLES)/h264-conformance/FRext/PPH10I1_Panasonic_A.264 -pix_fmt yuv420p10le
+fate-h264-conformance-frext-pph10i2_panasonic_a: CMD = framecrc -i $(SAMPLES)/h264-conformance/FRext/PPH10I2_Panasonic_A.264 -pix_fmt yuv420p10le
+fate-h264-conformance-frext-pph10i3_panasonic_a: CMD = framecrc -i $(SAMPLES)/h264-conformance/FRext/PPH10I3_Panasonic_A.264 -pix_fmt yuv420p10le
+fate-h264-conformance-frext-pph10i4_panasonic_a: CMD = framecrc -i $(SAMPLES)/h264-conformance/FRext/PPH10I4_Panasonic_A.264 -pix_fmt yuv420p10le
+fate-h264-conformance-frext-pph10i5_panasonic_a: CMD = framecrc -i $(SAMPLES)/h264-conformance/FRext/PPH10I5_Panasonic_A.264 -pix_fmt yuv420p10le
+fate-h264-conformance-frext-pph10i6_panasonic_a: CMD = framecrc -i $(SAMPLES)/h264-conformance/FRext/PPH10I6_Panasonic_A.264 -pix_fmt yuv420p10le
+fate-h264-conformance-frext-pph10i7_panasonic_a: CMD = framecrc -i $(SAMPLES)/h264-conformance/FRext/PPH10I7_Panasonic_A.264 -pix_fmt yuv420p10le
+fate-h264-conformance-hcbp2_hhi_a: CMD = framecrc -i $(SAMPLES)/h264-conformance/HCBP2_HHI_A.264
+fate-h264-conformance-hcmp1_hhi_a: CMD = framecrc -i $(SAMPLES)/h264-conformance/HCMP1_HHI_A.264
+fate-h264-conformance-ls_sva_d: CMD = framecrc -i $(SAMPLES)/h264-conformance/LS_SVA_D.264
+fate-h264-conformance-midr_mw_d: CMD = framecrc -i $(SAMPLES)/h264-conformance/MIDR_MW_D.264
+fate-h264-conformance-mps_mw_a: CMD = framecrc -i $(SAMPLES)/h264-conformance/MPS_MW_A.264
+fate-h264-conformance-mr1_bt_a: CMD = framecrc -i $(SAMPLES)/h264-conformance/MR1_BT_A.h264
+fate-h264-conformance-mr1_mw_a: CMD = framecrc -i $(SAMPLES)/h264-conformance/MR1_MW_A.264
+fate-h264-conformance-mr2_mw_a: CMD = framecrc -i $(SAMPLES)/h264-conformance/MR2_MW_A.264
+fate-h264-conformance-mr2_tandberg_e: CMD = framecrc -i $(SAMPLES)/h264-conformance/MR2_TANDBERG_E.264
+fate-h264-conformance-mr3_tandberg_b: CMD = framecrc -i $(SAMPLES)/h264-conformance/MR3_TANDBERG_B.264
+fate-h264-conformance-mr4_tandberg_c: CMD = framecrc -strict 1 -i $(SAMPLES)/h264-conformance/MR4_TANDBERG_C.264
+fate-h264-conformance-mr5_tandberg_c: CMD = framecrc -strict 1 -i $(SAMPLES)/h264-conformance/MR5_TANDBERG_C.264
+fate-h264-conformance-mr6_bt_b: CMD = framecrc -i $(SAMPLES)/h264-conformance/MR6_BT_B.h264
+fate-h264-conformance-mr7_bt_b: CMD = framecrc -i $(SAMPLES)/h264-conformance/MR7_BT_B.h264
+fate-h264-conformance-mr8_bt_b: CMD = framecrc -i $(SAMPLES)/h264-conformance/MR8_BT_B.h264
+fate-h264-conformance-mr9_bt_b: CMD = framecrc -i $(SAMPLES)/h264-conformance/MR9_BT_B.h264
+fate-h264-conformance-mv1_brcm_d: CMD = framecrc -i $(SAMPLES)/h264-conformance/src19td.IBP.264
+fate-h264-conformance-nl1_sony_d: CMD = framecrc -i $(SAMPLES)/h264-conformance/NL1_Sony_D.jsv
+fate-h264-conformance-nl2_sony_h: CMD = framecrc -i $(SAMPLES)/h264-conformance/NL2_Sony_H.jsv
+fate-h264-conformance-nl3_sva_e: CMD = framecrc -i $(SAMPLES)/h264-conformance/NL3_SVA_E.264
+fate-h264-conformance-nlmq1_jvc_c: CMD = framecrc -i $(SAMPLES)/h264-conformance/NLMQ1_JVC_C.264
+fate-h264-conformance-nlmq2_jvc_c: CMD = framecrc -i $(SAMPLES)/h264-conformance/NLMQ2_JVC_C.264
+fate-h264-conformance-nrf_mw_e: CMD = framecrc -i $(SAMPLES)/h264-conformance/NRF_MW_E.264
+fate-h264-conformance-sharp_mp_field_1_b: CMD = framecrc -i $(SAMPLES)/h264-conformance/Sharp_MP_Field_1_B.jvt
+fate-h264-conformance-sharp_mp_field_2_b: CMD = framecrc -i $(SAMPLES)/h264-conformance/Sharp_MP_Field_2_B.jvt
+fate-h264-conformance-sharp_mp_field_3_b: CMD = framecrc -i $(SAMPLES)/h264-conformance/Sharp_MP_Field_3_B.jvt
+fate-h264-conformance-sharp_mp_paff_1r2: CMD = framecrc -i $(SAMPLES)/h264-conformance/Sharp_MP_PAFF_1r2.jvt
+fate-h264-conformance-sharp_mp_paff_2r: CMD = framecrc -i $(SAMPLES)/h264-conformance/Sharp_MP_PAFF_2.jvt
+fate-h264-conformance-sl1_sva_b: CMD = framecrc -i $(SAMPLES)/h264-conformance/SL1_SVA_B.264
+fate-h264-conformance-sva_ba1_b: CMD = framecrc -i $(SAMPLES)/h264-conformance/SVA_BA1_B.264
+fate-h264-conformance-sva_ba2_d: CMD = framecrc -i $(SAMPLES)/h264-conformance/SVA_BA2_D.264
+fate-h264-conformance-sva_base_b: CMD = framecrc -i $(SAMPLES)/h264-conformance/SVA_Base_B.264
+fate-h264-conformance-sva_cl1_e: CMD = framecrc -i $(SAMPLES)/h264-conformance/SVA_CL1_E.264
+fate-h264-conformance-sva_fm1_e: CMD = framecrc -i $(SAMPLES)/h264-conformance/SVA_FM1_E.264
+fate-h264-conformance-sva_nl1_b: CMD = framecrc -i $(SAMPLES)/h264-conformance/SVA_NL1_B.264
+fate-h264-conformance-sva_nl2_e: CMD = framecrc -i $(SAMPLES)/h264-conformance/SVA_NL2_E.264
-fate-h264-interlace-crop: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264/interlaced_crop.mp4 -vframes 3
-fate-h264-lossless: CMD = framecrc -vsync 0 -i $(SAMPLES)/h264/lossless.h264
-fate-h264-extreme-plane-pred: CMD = framemd5 -vsync 0 -i $(SAMPLES)/h264/extreme-plane-pred.h264
-fate-h264-bsf-mp4toannexb: CMD = md5 -i $(SAMPLES)/h264/interlaced_crop.mp4 -vcodec copy -bsf h264_mp4toannexb -f h264
+fate-h264-bsf-mp4toannexb: CMD = md5 -i $(SAMPLES)/h264/interlaced_crop.mp4 -vcodec copy -bsf h264_mp4toannexb -f h264
+fate-h264-extreme-plane-pred: CMD = framemd5 -i $(SAMPLES)/h264/extreme-plane-pred.h264
+fate-h264-interlace-crop: CMD = framecrc -i $(SAMPLES)/h264/interlaced_crop.mp4 -vframes 3
+fate-h264-lossless: CMD = framecrc -i $(SAMPLES)/h264/lossless.h264
diff --git a/gst-libs/ext/libav/tests/fate/image.mak b/gst-libs/ext/libav/tests/fate/image.mak
index 1d3dbc1..1e4bc56 100644
--- a/gst-libs/ext/libav/tests/fate/image.mak
+++ b/gst-libs/ext/libav/tests/fate/image.mak
@@ -1,10 +1,10 @@
-FATE_TESTS += fate-dpx
+FATE_SAMPLES_AVCONV-$(call DEMDEC, IMAGE2, DPX) += fate-dpx
fate-dpx: CMD = framecrc -i $(SAMPLES)/dpx/lighthouse_rgb48.dpx
-FATE_TESTS += fate-pictor
+FATE_SAMPLES_AVCONV-$(call DEMDEC, IMAGE2, PICTOR) += fate-pictor
fate-pictor: CMD = framecrc -i $(SAMPLES)/pictor/MFISH.PIC -pix_fmt rgb24
-FATE_TESTS += fate-ptx
+FATE_SAMPLES_AVCONV-$(call DEMDEC, IMAGE2, PTX) += fate-ptx
fate-ptx: CMD = framecrc -i $(SAMPLES)/ptx/_113kw_pic.ptx -pix_fmt rgb24
FATE_SUNRASTER += fate-sunraster-1bit-raw
@@ -16,6 +16,9 @@ fate-sunraster-1bit-rle: CMD = framecrc -i $(SAMPLES)/sunraster/lena-1bit-rle.su
FATE_SUNRASTER += fate-sunraster-8bit-raw
fate-sunraster-8bit-raw: CMD = framecrc -i $(SAMPLES)/sunraster/lena-8bit-raw.sun -pix_fmt rgb24
+FATE_SUNRASTER += fate-sunraster-8bit_gray-raw
+fate-sunraster-8bit_gray-raw: CMD = framecrc -i $(SAMPLES)/sunraster/gray.ras
+
FATE_SUNRASTER += fate-sunraster-8bit-rle
fate-sunraster-8bit-rle: CMD = framecrc -i $(SAMPLES)/sunraster/lena-8bit-rle.sun -pix_fmt rgb24
@@ -25,8 +28,10 @@ fate-sunraster-24bit-raw: CMD = framecrc -i $(SAMPLES)/sunraster/lena-24bit-raw.
FATE_SUNRASTER += fate-sunraster-24bit-rle
fate-sunraster-24bit-rle: CMD = framecrc -i $(SAMPLES)/sunraster/lena-24bit-rle.sun
-FATE_TESTS += $(FATE_SUNRASTER)
-fate-sunraster: $(FATE_SUNRASTER)
+FATE_SUNRASTER-$(call DEMDEC, IMAGE2, SUNRAST) += $(FATE_SUNRASTER)
+
+FATE_SAMPLES_AVCONV += $(FATE_SUNRASTER-yes)
+fate-sunraster: $(FATE_SUNRASTER-yes)
FATE_TARGA = CBW8 \
CCM8 \
@@ -42,8 +47,10 @@ FATE_TARGA = CBW8 \
FATE_TARGA := $(FATE_TARGA:%=fate-targa-conformance-%) \
fate-targa-top-to-bottom
-FATE_TESTS += $(FATE_TARGA)
-fate-targa: $(FATE_TARGA)
+FATE_TARGA-$(call DEMDEC, IMAGE2, TARGA) += $(FATE_TARGA)
+
+FATE_SAMPLES_AVCONV += $(FATE_TARGA-yes)
+fate-targa: $(FATE_TARGA-yes)
fate-targa-conformance-CBW8: CMD = framecrc -i $(SAMPLES)/targa-conformance/CBW8.TGA
fate-targa-conformance-CCM8: CMD = framecrc -i $(SAMPLES)/targa-conformance/CCM8.TGA -pix_fmt rgba
@@ -64,5 +71,7 @@ fate-tiff-fax-g3: CMD = framecrc -i $(SAMPLES)/CCITT_fax/G31D.TIF
FATE_TIFF += fate-tiff-fax-g3s
fate-tiff-fax-g3s: CMD = framecrc -i $(SAMPLES)/CCITT_fax/G31DS.TIF
-FATE_TESTS += $(FATE_TIFF)
-fate-tiff: $(FATE_TIFF)
+FATE_TIFF-$(call DEMDEC, IMAGE2, TIFF) += $(FATE_TIFF)
+
+FATE_SAMPLES_AVCONV += $(FATE_TIFF-yes)
+fate-tiff: $(FATE_TIFF-yes)
diff --git a/gst-libs/ext/libav/tests/fate/indeo.mak b/gst-libs/ext/libav/tests/fate/indeo.mak
index cf1625c..5a99b46 100644
--- a/gst-libs/ext/libav/tests/fate/indeo.mak
+++ b/gst-libs/ext/libav/tests/fate/indeo.mak
@@ -1,14 +1,14 @@
-FATE_INDEO += fate-indeo2
+FATE_INDEO-$(call DEMDEC, AVI, INDEO2) += fate-indeo2
fate-indeo2: CMD = framecrc -i $(SAMPLES)/rt21/VPAR0026.AVI
-FATE_INDEO += fate-indeo3
+FATE_INDEO-$(call DEMDEC, MOV, INDEO3) += fate-indeo3
fate-indeo3: CMD = framecrc -i $(SAMPLES)/iv32/cubes.mov
-FATE_INDEO += fate-indeo4
+FATE_INDEO-$(call DEMDEC, AVI, INDEO4) += fate-indeo4
fate-indeo4: CMD = framecrc -i $(SAMPLES)/iv41/indeo41-partial.avi -an
-FATE_INDEO += fate-indeo5
+FATE_INDEO-$(call DEMDEC, AVI, INDEO5) += fate-indeo5
fate-indeo5: CMD = framecrc -i $(SAMPLES)/iv50/Educ_Movie_DeadlyForce.avi -an
-FATE_TESTS += $(FATE_INDEO)
-fate-indeo: $(FATE_INDEO)
+FATE_SAMPLES_AVCONV += $(FATE_INDEO-yes)
+fate-indeo: $(FATE_INDEO-yes)
diff --git a/gst-libs/ext/libav/tests/fate/libavcodec.mak b/gst-libs/ext/libav/tests/fate/libavcodec.mak
index 083f6e8..6e81f57 100644
--- a/gst-libs/ext/libav/tests/fate/libavcodec.mak
+++ b/gst-libs/ext/libav/tests/fate/libavcodec.mak
@@ -1,3 +1,23 @@
-FATE_TESTS += fate-iirfilter
+FATE_LIBAVCODEC-$(CONFIG_GOLOMB) += fate-golomb
+fate-golomb: libavcodec/golomb-test$(EXESUF)
+fate-golomb: CMD = run libavcodec/golomb-test
+fate-golomb: REF = /dev/null
+
+FATE_LIBAVCODEC-yes += fate-idct8x8
+fate-idct8x8: libavcodec/dct-test$(EXESUF)
+fate-idct8x8: CMD = run libavcodec/dct-test -i
+fate-idct8x8: CMP = null
+fate-idct8x8: REF = /dev/null
+
+FATE_LIBAVCODEC-yes += fate-iirfilter
fate-iirfilter: libavcodec/iirfilter-test$(EXESUF)
fate-iirfilter: CMD = run libavcodec/iirfilter-test
+
+FATE_LIBAVCODEC-$(CONFIG_RANGECODER) += fate-rangecoder
+fate-rangecoder: libavcodec/rangecoder-test$(EXESUF)
+fate-rangecoder: CMD = run libavcodec/rangecoder-test
+fate-rangecoder: CMP = null
+fate-rangecoder: REF = /dev/null
+
+FATE-$(CONFIG_AVCODEC) += $(FATE_LIBAVCODEC-yes)
+fate-libavcodec: $(FATE_LIBAVCODEC-yes)
diff --git a/gst-libs/ext/libav/tests/fate/libavformat.mak b/gst-libs/ext/libav/tests/fate/libavformat.mak
new file mode 100644
index 0000000..b6eda42
--- /dev/null
+++ b/gst-libs/ext/libav/tests/fate/libavformat.mak
@@ -0,0 +1,6 @@
+FATE_LIBAVFORMAT += fate-url
+fate-url: libavformat/url-test$(EXESUF)
+fate-url: CMD = run libavformat/url-test
+
+FATE-$(CONFIG_AVFORMAT) += $(FATE_LIBAVFORMAT)
+fate-libavformat: $(FATE_LIBAVFORMAT)
diff --git a/gst-libs/ext/libav/tests/fate/libavutil.mak b/gst-libs/ext/libav/tests/fate/libavutil.mak
index a65b724..9e57162 100644
--- a/gst-libs/ext/libav/tests/fate/libavutil.mak
+++ b/gst-libs/ext/libav/tests/fate/libavutil.mak
@@ -1,38 +1,57 @@
-FATE_TESTS += fate-adler32
+FATE_LIBAVUTIL += fate-adler32
fate-adler32: libavutil/adler32-test$(EXESUF)
fate-adler32: CMD = run libavutil/adler32-test
fate-adler32: REF = /dev/null
-FATE_TESTS += fate-aes
+FATE_LIBAVUTIL += fate-aes
fate-aes: libavutil/aes-test$(EXESUF)
fate-aes: CMD = run libavutil/aes-test
fate-aes: REF = /dev/null
-FATE_TESTS += fate-base64
+FATE_LIBAVUTIL += fate-avstring
+fate-avstring: libavutil/avstring-test$(EXESUF)
+fate-avstring: CMD = run libavutil/avstring-test
+
+FATE_LIBAVUTIL += fate-base64
fate-base64: libavutil/base64-test$(EXESUF)
fate-base64: CMD = run libavutil/base64-test
-FATE_TESTS += fate-crc
+FATE_LIBAVUTIL += fate-blowfish
+fate-blowfish: libavutil/blowfish-test$(EXESUF)
+fate-blowfish: CMD = run libavutil/blowfish-test
+
+FATE_LIBAVUTIL += fate-crc
fate-crc: libavutil/crc-test$(EXESUF)
fate-crc: CMD = run libavutil/crc-test
-FATE_TESTS += fate-des
+FATE_LIBAVUTIL += fate-des
fate-des: libavutil/des-test$(EXESUF)
fate-des: CMD = run libavutil/des-test
fate-des: REF = /dev/null
-FATE_TESTS += fate-eval
+FATE_LIBAVUTIL += fate-eval
fate-eval: libavutil/eval-test$(EXESUF)
fate-eval: CMD = run libavutil/eval-test
-FATE_TESTS += fate-fifo
+FATE_LIBAVUTIL += fate-fifo
fate-fifo: libavutil/fifo-test$(EXESUF)
fate-fifo: CMD = run libavutil/fifo-test
-FATE_TESTS += fate-md5
+FATE_LIBAVUTIL += fate-md5
fate-md5: libavutil/md5-test$(EXESUF)
fate-md5: CMD = run libavutil/md5-test
-FATE_TESTS += fate-sha
+FATE_LIBAVUTIL += fate-parseutils
+fate-parseutils: libavutil/parseutils-test$(EXESUF)
+fate-parseutils: CMD = run libavutil/parseutils-test
+
+FATE_LIBAVUTIL += fate-sha
fate-sha: libavutil/sha-test$(EXESUF)
fate-sha: CMD = run libavutil/sha-test
+
+FATE_LIBAVUTIL += fate-xtea
+fate-xtea: libavutil/xtea-test$(EXESUF)
+fate-xtea: CMD = run libavutil/xtea-test
+
+FATE-$(CONFIG_AVUTIL) += $(FATE_LIBAVUTIL)
+fate-libavutil: $(FATE_LIBAVUTIL)
diff --git a/gst-libs/ext/libav/tests/fate/lossless-audio.mak b/gst-libs/ext/libav/tests/fate/lossless-audio.mak
index 0a81b78..0794241 100644
--- a/gst-libs/ext/libav/tests/fate/lossless-audio.mak
+++ b/gst-libs/ext/libav/tests/fate/lossless-audio.mak
@@ -1,17 +1,20 @@
-FATE_TESTS += fate-lossless-alac
+FATE_SAMPLES_AVCONV-$(call DEMDEC, MOV, ALAC) += fate-lossless-alac
fate-lossless-alac: CMD = md5 -i $(SAMPLES)/lossless-audio/inside.m4a -f s16le
-FATE_TESTS += fate-lossless-meridianaudio
+FATE_SAMPLES_AVCONV-$(call DEMDEC, MLP, MLP) += fate-lossless-meridianaudio
fate-lossless-meridianaudio: CMD = md5 -i $(SAMPLES)/lossless-audio/luckynight-partial.mlp -f s16le
-FATE_TESTS += fate-lossless-monkeysaudio
+FATE_SAMPLES_AVCONV-$(call DEMDEC, APE, APE) += fate-lossless-monkeysaudio
fate-lossless-monkeysaudio: CMD = md5 -i $(SAMPLES)/lossless-audio/luckynight-partial.ape -f s16le
-FATE_TESTS += fate-lossless-shorten
+FATE_SAMPLES_AVCONV-$(call DEMDEC, RM, RALF) += fate-ralf
+fate-ralf: CMD = md5 -i $(SAMPLES)/lossless-audio/luckynight-partial.rmvb -vn -f s16le
+
+FATE_SAMPLES_AVCONV-$(call DEMDEC, SHORTEN, SHORTEN) += fate-lossless-shorten
fate-lossless-shorten: CMD = md5 -i $(SAMPLES)/lossless-audio/luckynight-partial.shn -f s16le
-FATE_TESTS += fate-lossless-tta
+FATE_SAMPLES_AVCONV-$(call DEMDEC, TTA, TTA) += fate-lossless-tta
fate-lossless-tta: CMD = crc -i $(SAMPLES)/lossless-audio/inside.tta
-FATE_TESTS += fate-lossless-wavpack
-fate-lossless-wavpack: CMD = md5 -i $(SAMPLES)/lossless-audio/luckynight-partial.wv -f s16le
+FATE_SAMPLES_AVCONV-$(call DEMDEC, ASF, WMALOSSLESS) += fate-lossless-wma
+fate-lossless-wma: CMD = md5 -i $(SAMPLES)/lossless-audio/luckynight-partial.wma -f s16le
diff --git a/gst-libs/ext/libav/tests/fate/lossless-video.mak b/gst-libs/ext/libav/tests/fate/lossless-video.mak
index d87abc5..06b6dd5 100644
--- a/gst-libs/ext/libav/tests/fate/lossless-video.mak
+++ b/gst-libs/ext/libav/tests/fate/lossless-video.mak
@@ -1,20 +1,47 @@
+FATE_CLLC += fate-cllc-rgb
+fate-cllc-rgb: CMD = framecrc -i $(SAMPLES)/cllc/sample-cllc-rgb.avi
+
+FATE_CLLC += fate-cllc-argb
+fate-cllc-argb: CMD = framecrc -i $(SAMPLES)/cllc/sample-cllc-argb.avi
+
+FATE_SAMPLES_AVCONV-$(call DEMDEC, AVI, CLLC) += $(FATE_CLLC)
+fate-cllc: $(FATE_CLLC)
+
+FATE_LAGARITH += fate-lagarith-rgb24
+fate-lagarith-rgb24: CMD = framecrc -i $(SAMPLES)/lagarith/lag-rgb24.avi
+
+FATE_LAGARITH += fate-lagarith-rgb32
+fate-lagarith-rgb32: CMD = framecrc -i $(SAMPLES)/lagarith/lag-rgb32.avi -pix_fmt bgra
+
+FATE_LAGARITH += fate-lagarith-yuy2
+fate-lagarith-yuy2: CMD = framecrc -i $(SAMPLES)/lagarith/lag-yuy2.avi
+
+FATE_LAGARITH += fate-lagarith-yv12
+fate-lagarith-yv12: CMD = framecrc -i $(SAMPLES)/lagarith/lag-yv12.avi
+
+FATE_SAMPLES_AVCONV-$(call DEMDEC, AVI, LAGARITH) += $(FATE_LAGARITH)
+fate-lagarith: $(FATE_LAGARITH)
+
FATE_LOCO += fate-loco-rgb
fate-loco-rgb: CMD = framecrc -i $(SAMPLES)/loco/pig-loco-rgb.avi
FATE_LOCO += fate-loco-yuy2
fate-loco-yuy2: CMD = framecrc -i $(SAMPLES)/loco/pig-loco-0.avi
-FATE_TESTS += $(FATE_LOCO)
+FATE_SAMPLES_AVCONV-$(call DEMDEC, AVI, LOCO) += $(FATE_LOCO)
fate-loco: $(FATE_LOCO)
-FATE_TESTS += fate-msrle-8bit
+FATE_SAMPLES_AVCONV-$(call DEMDEC, AVI, MSRLE) += fate-msrle-8bit
fate-msrle-8bit: CMD = framecrc -i $(SAMPLES)/msrle/Search-RLE.avi -pix_fmt rgb24
-FATE_TESTS += fate-mszh
+FATE_SAMPLES_AVCONV-$(call DEMDEC, AVI, MSZH) += fate-mszh
fate-mszh: CMD = framecrc -i $(SAMPLES)/lcl/mszh-1frame.avi
-FATE_TESTS += fate-vble
+FATE_SAMPLES_AVCONV-$(call DEMDEC, AVI, VBLE) += fate-vble
fate-vble: CMD = framecrc -i $(SAMPLES)/vble/flowers-partial-2MB.avi
-FATE_TESTS += fate-zlib
+FATE_SAMPLES_AVCONV-$(call DEMDEC, AVI, ZLIB) += fate-zlib
fate-zlib: CMD = framecrc -i $(SAMPLES)/lcl/zlib-1frame.avi
+
+FATE_SAMPLES_AVCONV-$(call DEMDEC, AVI, ZEROCODEC) += fate-zerocodec
+fate-zerocodec: CMD = framecrc -i $(SAMPLES)/zerocodec/sample-zeco.avi
diff --git a/gst-libs/ext/libav/tests/fate/microsoft.mak b/gst-libs/ext/libav/tests/fate/microsoft.mak
index 5bc27b8..a3ca3ed 100644
--- a/gst-libs/ext/libav/tests/fate/microsoft.mak
+++ b/gst-libs/ext/libav/tests/fate/microsoft.mak
@@ -1,4 +1,4 @@
-FATE_TESTS += fate-msmpeg4v1
+FATE_SAMPLES_AVCONV-$(call DEMDEC, AVI, MSMPEG4V1) += fate-msmpeg4v1
fate-msmpeg4v1: CMD = framecrc -flags +bitexact -dct fastint -idct simple -i $(SAMPLES)/msmpeg4v1/mpg4.avi -an
FATE_MSVIDEO1 += fate-msvideo1-16bit
@@ -7,7 +7,7 @@ fate-msvideo1-16bit: CMD = framecrc -i $(SAMPLES)/cram/clock-cram16.avi -pix_fmt
FATE_MSVIDEO1 += fate-msvideo1-8bit
fate-msvideo1-8bit: CMD = framecrc -i $(SAMPLES)/cram/skating.avi -t 1 -pix_fmt rgb24
-FATE_TESTS += $(FATE_MSVIDEO1)
+FATE_SAMPLES_AVCONV-$(call DEMDEC, AVI, MSVIDEO1) += $(FATE_MSVIDEO1)
fate-msvideo1: $(FATE_MSVIDEO1)
FATE_WMV8_DRM += fate-wmv8-drm
@@ -17,23 +17,26 @@ fate-wmv8-drm: CMD = framecrc -cryptokey 137381538c84c068111902a59c5cf6c340247c3
FATE_WMV8_DRM += fate-wmv8-drm-nodec
fate-wmv8-drm-nodec: CMD = framecrc -cryptokey 137381538c84c068111902a59c5cf6c340247c39 -i $(SAMPLES)/wmv8/wmv_drm.wmv -acodec copy -vcodec copy
-FATE_TESTS += $(FATE_WMV8_DRM)
+FATE_SAMPLES_AVCONV-$(call DEMDEC, ASF, WMV3) += $(FATE_WMV8_DRM)
fate-wmv8_drm: $(FATE_WMV8_DRM)
-FATE_VC1 += fate-vc1_sa00040
+FATE_VC1-$(CONFIG_VC1_DEMUXER) += fate-vc1_sa00040
fate-vc1_sa00040: CMD = framecrc -i $(SAMPLES)/vc1/SA00040.vc1
-FATE_VC1 += fate-vc1_sa00050
+FATE_VC1-$(CONFIG_VC1_DEMUXER) += fate-vc1_sa00050
fate-vc1_sa00050: CMD = framecrc -i $(SAMPLES)/vc1/SA00050.vc1
-FATE_VC1 += fate-vc1_sa10091
+FATE_VC1-$(CONFIG_VC1_DEMUXER) += fate-vc1_sa10091
fate-vc1_sa10091: CMD = framecrc -i $(SAMPLES)/vc1/SA10091.vc1
-FATE_VC1 += fate-vc1_sa20021
+FATE_VC1-$(CONFIG_VC1_DEMUXER) += fate-vc1_sa20021
fate-vc1_sa20021: CMD = framecrc -i $(SAMPLES)/vc1/SA20021.vc1
-FATE_VC1 += fate-vc1-ism
+FATE_VC1-$(CONFIG_VC1_DEMUXER) += fate-vc1_sa10143
+fate-vc1_sa10143: CMD = framecrc -i $(SAMPLES)/vc1/SA10143.vc1
+
+FATE_VC1-$(CONFIG_MOV_DEMUXER) += fate-vc1-ism
fate-vc1-ism: CMD = framecrc -i $(SAMPLES)/isom/vc1-wmapro.ism -an
-FATE_TESTS += $(FATE_VC1)
-fate-vc1: $(FATE_VC1)
+FATE_SAMPLES_AVCONV-$(CONFIG_VC1_DECODER) += $(FATE_VC1-yes)
+fate-vc1: $(FATE_VC1-yes)
diff --git a/gst-libs/ext/libav/tests/fate/mp3.mak b/gst-libs/ext/libav/tests/fate/mp3.mak
index 9dfa829..663f14e 100644
--- a/gst-libs/ext/libav/tests/fate/mp3.mak
+++ b/gst-libs/ext/libav/tests/fate/mp3.mak
@@ -1,39 +1,39 @@
FATE_MP3 += fate-mp3-float-conf-compl
fate-mp3-float-conf-compl: CMD = pcm -acodec mp3float -i $(SAMPLES)/mp3-conformance/compl.bit
-fate-mp3-float-conf-compl: CMP = stddev
fate-mp3-float-conf-compl: REF = $(SAMPLES)/mp3-conformance/compl.pcm
FATE_MP3 += fate-mp3-float-conf-he_32khz
fate-mp3-float-conf-he_32khz: CMD = pcm -acodec mp3float -i $(SAMPLES)/mp3-conformance/he_32khz.bit -fs 343296
-fate-mp3-float-conf-he_32khz: CMP = stddev
fate-mp3-float-conf-he_32khz: REF = $(SAMPLES)/mp3-conformance/he_32khz.pcm
FATE_MP3 += fate-mp3-float-conf-he_44khz
fate-mp3-float-conf-he_44khz: CMD = pcm -acodec mp3float -i $(SAMPLES)/mp3-conformance/he_44khz.bit -fs 942336
-fate-mp3-float-conf-he_44khz: CMP = stddev
fate-mp3-float-conf-he_44khz: REF = $(SAMPLES)/mp3-conformance/he_44khz.pcm
FATE_MP3 += fate-mp3-float-conf-he_48khz
fate-mp3-float-conf-he_48khz: CMD = pcm -acodec mp3float -i $(SAMPLES)/mp3-conformance/he_48khz.bit -fs 343296
-fate-mp3-float-conf-he_48khz: CMP = stddev
fate-mp3-float-conf-he_48khz: REF = $(SAMPLES)/mp3-conformance/he_48khz.pcm
FATE_MP3 += fate-mp3-float-conf-hecommon
fate-mp3-float-conf-hecommon: CMD = pcm -acodec mp3float -i $(SAMPLES)/mp3-conformance/hecommon.bit -fs 133632
-fate-mp3-float-conf-hecommon: CMP = stddev
fate-mp3-float-conf-hecommon: REF = $(SAMPLES)/mp3-conformance/hecommon.pcm
FATE_MP3 += fate-mp3-float-conf-si
fate-mp3-float-conf-si: CMD = pcm -acodec mp3float -i $(SAMPLES)/mp3-conformance/si.bit -fs 269568
-fate-mp3-float-conf-si: CMP = stddev
fate-mp3-float-conf-si: REF = $(SAMPLES)/mp3-conformance/si.pcm
FATE_MP3 += fate-mp3-float-conf-si_block
fate-mp3-float-conf-si_block: CMD = pcm -acodec mp3float -i $(SAMPLES)/mp3-conformance/si_block.bit -fs 145152
-fate-mp3-float-conf-si_block: CMP = stddev
fate-mp3-float-conf-si_block: REF = $(SAMPLES)/mp3-conformance/si_block.pcm
-FATE_TESTS += $(FATE_MP3)
-fate-mp3: $(FATE_MP3)
+FATE_MP3 += fate-mp3-float-extra_overread
+fate-mp3-float-extra_overread: CMD = pcm -c:a mp3float -i $(SAMPLES)/mpegaudio/extra_overread.mp3
+fate-mp3-float-extra_overread: REF = $(SAMPLES)/mpegaudio/extra_overread.pcm
+
$(FATE_MP3): CMP = stddev
$(FATE_MP3): FUZZ = 0.07
+
+FATE_MP3-$(call DEMDEC, MP3, MP3FLOAT) += $(FATE_MP3)
+
+FATE_SAMPLES_AVCONV += $(FATE_MP3-yes)
+fate-mp3: $(FATE_MP3-yes)
diff --git a/gst-libs/ext/libav/tests/fate/mpc.mak b/gst-libs/ext/libav/tests/fate/mpc.mak
index 2b263ce..53d236e 100644
--- a/gst-libs/ext/libav/tests/fate/mpc.mak
+++ b/gst-libs/ext/libav/tests/fate/mpc.mak
@@ -1,14 +1,13 @@
-FATE_MPC += fate-mpc7-demux
+FATE_MPC-$(CONFIG_MPC_DEMUXER) += fate-mpc7-demux
fate-mpc7-demux: CMD = crc -i $(SAMPLES)/musepack/inside-mp7.mpc -acodec copy
-FATE_MPC += fate-mpc8-demux
+FATE_MPC-$(CONFIG_MPC8_DEMUXER) += fate-mpc8-demux
fate-mpc8-demux: CMD = crc -i $(SAMPLES)/musepack/inside-mp8.mpc -acodec copy
-FATE_MPC += fate-musepack7
+FATE_MPC-$(call DEMDEC, MPC, MPC7) += fate-musepack7
fate-musepack7: CMD = pcm -i $(SAMPLES)/musepack/inside-mp7.mpc
fate-musepack7: CMP = oneoff
fate-musepack7: REF = $(SAMPLES)/musepack/inside-mp7.pcm
-fate-musepack7: FUZZ = 1
-FATE_TESTS += $(FATE_MPC)
-fate-mpc: $(FATE_MPC)
+FATE_SAMPLES_AVCONV += $(FATE_MPC-yes)
+fate-mpc: $(FATE_MPC-yes)
diff --git a/gst-libs/ext/libav/tests/fate/pcm.mak b/gst-libs/ext/libav/tests/fate/pcm.mak
index 3ce04f9..c84de9e 100644
--- a/gst-libs/ext/libav/tests/fate/pcm.mak
+++ b/gst-libs/ext/libav/tests/fate/pcm.mak
@@ -1,29 +1,32 @@
-FATE_PCM += fate-ea-mad-pcm-planar
-fate-ea-mad-pcm-planar: CMD = framecrc -i $(SAMPLES)/ea-mad/xeasport.mad
-
-FATE_PCM += fate-film-cvid-pcm-stereo-8bit
-fate-film-cvid-pcm-stereo-8bit: CMD = framecrc -i $(SAMPLES)/film/logo-capcom.cpk
-
-FATE_PCM += fate-iff-pcm
+FATE_SAMPLES_PCM += fate-iff-pcm
fate-iff-pcm: CMD = md5 -i $(SAMPLES)/iff/Bells -f s16le
-FATE_PCM += fate-pcm_dvd
+FATE_SAMPLES_PCM += fate-pcm_dvd
fate-pcm_dvd: CMD = framecrc -i $(SAMPLES)/pcm-dvd/coolitnow-partial.vob -vn
-FATE_PCM += fate-pcm_s16be-stereo
+FATE_SAMPLES_PCM += fate-pcm-planar
+fate-pcm-planar: CMD = framecrc -i $(SAMPLES)/ea-mad/xeasport.mad -vn
+
+FATE_SAMPLES_PCM += fate-pcm_s16be-stereo
fate-pcm_s16be-stereo: CMD = md5 -i $(SAMPLES)/qt-surge-suite/surge-2-16-B-twos.mov -f s16le
-FATE_PCM += fate-pcm_s16le-stereo
+FATE_SAMPLES_PCM += fate-pcm_s16le-stereo
fate-pcm_s16le-stereo: CMD = md5 -i $(SAMPLES)/qt-surge-suite/surge-2-16-L-sowt.mov -f s16le
-FATE_PCM += fate-pcm_u8-mono
+FATE_SAMPLES_PCM += fate-pcm_u8-mono
fate-pcm_u8-mono: CMD = md5 -i $(SAMPLES)/qt-surge-suite/surge-1-8-raw.mov -f s16le
-FATE_PCM += fate-pcm_u8-stereo
+FATE_SAMPLES_PCM += fate-pcm_u8-stereo
fate-pcm_u8-stereo: CMD = md5 -i $(SAMPLES)/qt-surge-suite/surge-2-8-raw.mov -f s16le
-FATE_PCM += fate-w64
+FATE_SAMPLES_PCM += fate-w64
fate-w64: CMD = crc -i $(SAMPLES)/w64/w64-pcm16.w64
-FATE_TESTS += $(FATE_PCM)
-fate-pcm: $(FATE_PCM)
+FATE_PCM += fate-dcinema-encode
+fate-dcinema-encode: tests/data/asynth-96000-6.wav
+fate-dcinema-encode: SRC = tests/data/asynth-96000-6.wav
+fate-dcinema-encode: CMD = enc_dec_pcm daud md5 s16le $(SRC) -c:a pcm_s24daud
+
+FATE_AVCONV += $(FATE_PCM)
+FATE_SAMPLES_AVCONV += $(FATE_SAMPLES_PCM)
+fate-pcm: $(FATE_PCM) $(FATE_SAMPLES_PCM)
diff --git a/gst-libs/ext/libav/tests/fate/probe.mak b/gst-libs/ext/libav/tests/fate/probe.mak
new file mode 100644
index 0000000..73bc5cb
--- /dev/null
+++ b/gst-libs/ext/libav/tests/fate/probe.mak
@@ -0,0 +1,18 @@
+FATE_PROBE_FORMAT += fate-probe-format-roundup997
+fate-probe-format-roundup997: REF = mpeg
+
+FATE_PROBE_FORMAT += fate-probe-format-roundup1383
+fate-probe-format-roundup1383: REF = mp3
+
+FATE_PROBE_FORMAT += fate-probe-format-roundup1414
+fate-probe-format-roundup1414: REF = mpeg
+
+FATE_PROBE_FORMAT += fate-probe-format-roundup2015
+fate-probe-format-roundup2015: REF = dv
+
+FATE_SAMPLES-$(CONFIG_AVPROBE) += $(FATE_PROBE_FORMAT)
+fate-probe-format: $(FATE_PROBE_FORMAT)
+
+$(FATE_PROBE_FORMAT): avprobe$(EXESUF)
+$(FATE_PROBE_FORMAT): CMP = oneline
+fate-probe-format-%: CMD = probefmt $(SAMPLES)/probe-format/$(@:fate-probe-format-%=%)
diff --git a/gst-libs/ext/libav/tests/fate/prores.mak b/gst-libs/ext/libav/tests/fate/prores.mak
index 0200c6f..9c1a1b1 100644
--- a/gst-libs/ext/libav/tests/fate/prores.mak
+++ b/gst-libs/ext/libav/tests/fate/prores.mak
@@ -4,12 +4,11 @@ FATE_PRORES = fate-prores-422 \
fate-prores-422_proxy \
fate-prores-alpha \
-FATE_TESTS += $(FATE_PRORES)
+FATE_SAMPLES_AVCONV-$(call DEMDEC, MOV, PRORES) += $(FATE_PRORES)
fate-prores: $(FATE_PRORES)
-fate-prores-422: CMD = framecrc -vsync 0 -i $(SAMPLES)/prores/Sequence_1-Apple_ProRes_422.mov -pix_fmt yuv422p10le
-fate-prores-422_hq: CMD = framecrc -vsync 0 -i $(SAMPLES)/prores/Sequence_1-Apple_ProRes_422_HQ.mov -pix_fmt yuv422p10le
-fate-prores-422_lt: CMD = framecrc -vsync 0 -i $(SAMPLES)/prores/Sequence_1-Apple_ProRes_422_LT.mov -pix_fmt yuv422p10le
-fate-prores-422_proxy: CMD = framecrc -vsync 0 -i $(SAMPLES)/prores/Sequence_1-Apple_ProRes_422_Proxy.mov -pix_fmt yuv422p10le
-fate-prores-alpha: CMD = framecrc -vsync 0 -i $(SAMPLES)/prores/Sequence_1-Apple_ProRes_with_Alpha.mov -pix_fmt yuv444p10le
-
+fate-prores-422: CMD = framecrc -i $(SAMPLES)/prores/Sequence_1-Apple_ProRes_422.mov -pix_fmt yuv422p10le
+fate-prores-422_hq: CMD = framecrc -i $(SAMPLES)/prores/Sequence_1-Apple_ProRes_422_HQ.mov -pix_fmt yuv422p10le
+fate-prores-422_lt: CMD = framecrc -i $(SAMPLES)/prores/Sequence_1-Apple_ProRes_422_LT.mov -pix_fmt yuv422p10le
+fate-prores-422_proxy: CMD = framecrc -i $(SAMPLES)/prores/Sequence_1-Apple_ProRes_422_Proxy.mov -pix_fmt yuv422p10le
+fate-prores-alpha: CMD = framecrc -i $(SAMPLES)/prores/Sequence_1-Apple_ProRes_with_Alpha.mov -pix_fmt yuv444p10le
diff --git a/gst-libs/ext/libav/tests/fate/qt.mak b/gst-libs/ext/libav/tests/fate/qt.mak
index 9b25306..79155f5 100644
--- a/gst-libs/ext/libav/tests/fate/qt.mak
+++ b/gst-libs/ext/libav/tests/fate/qt.mak
@@ -1,50 +1,50 @@
-FATE_TESTS += fate-8bps
+FATE_SAMPLES_AVCONV-$(call DEMDEC, MOV, EIGHTBPS) += fate-8bps
fate-8bps: CMD = framecrc -i $(SAMPLES)/8bps/full9iron-partial.mov -pix_fmt rgb24
-FATE_TESTS += fate-qdm2
+FATE_SAMPLES_AVCONV-$(call DEMDEC, MOV, QDM2) += fate-qdm2
fate-qdm2: CMD = pcm -i $(SAMPLES)/qt-surge-suite/surge-2-16-B-QDM2.mov
fate-qdm2: CMP = oneoff
fate-qdm2: REF = $(SAMPLES)/qt-surge-suite/surge-2-16-B-QDM2.pcm
fate-qdm2: FUZZ = 2
-FATE_TESTS += fate-qt-alaw-mono
+FATE_SAMPLES_AVCONV-$(call DEMDEC, MOV, PCM_ALAW) += fate-qt-alaw-mono
fate-qt-alaw-mono: CMD = md5 -i $(SAMPLES)/qt-surge-suite/surge-1-16-B-alaw.mov -f s16le
-FATE_TESTS += fate-qt-alaw-stereo
+FATE_SAMPLES_AVCONV-$(call DEMDEC, MOV, PCM_ALAW) += fate-qt-alaw-stereo
fate-qt-alaw-stereo: CMD = md5 -i $(SAMPLES)/qt-surge-suite/surge-2-16-B-alaw.mov -f s16le
-FATE_TESTS += fate-qt-ima4-mono
+FATE_SAMPLES_AVCONV-$(call DEMDEC, MOV, ADPCM_IMA_QT) += fate-qt-ima4-mono
fate-qt-ima4-mono: CMD = md5 -i $(SAMPLES)/qt-surge-suite/surge-1-16-B-ima4.mov -f s16le
-FATE_TESTS += fate-qt-ima4-stereo
+FATE_SAMPLES_AVCONV-$(call DEMDEC, MOV, ADPCM_IMA_QT) += fate-qt-ima4-stereo
fate-qt-ima4-stereo: CMD = md5 -i $(SAMPLES)/qt-surge-suite/surge-2-16-B-ima4.mov -f s16le
-FATE_TESTS += fate-qt-mac3-mono
+FATE_SAMPLES_AVCONV-$(call DEMDEC, MOV, MACE3) += fate-qt-mac3-mono
fate-qt-mac3-mono: CMD = md5 -i $(SAMPLES)/qt-surge-suite/surge-1-8-MAC3.mov -f s16le
-FATE_TESTS += fate-qt-mac3-stereo
+FATE_SAMPLES_AVCONV-$(call DEMDEC, MOV, MACE3) += fate-qt-mac3-stereo
fate-qt-mac3-stereo: CMD = md5 -i $(SAMPLES)/qt-surge-suite/surge-2-8-MAC3.mov -f s16le
-FATE_TESTS += fate-qt-mac6-mono
+FATE_SAMPLES_AVCONV-$(call DEMDEC, MOV, MACE6) += fate-qt-mac6-mono
fate-qt-mac6-mono: CMD = md5 -i $(SAMPLES)/qt-surge-suite/surge-1-8-MAC6.mov -f s16le
-FATE_TESTS += fate-qt-mac6-stereo
+FATE_SAMPLES_AVCONV-$(call DEMDEC, MOV, MACE6) += fate-qt-mac6-stereo
fate-qt-mac6-stereo: CMD = md5 -i $(SAMPLES)/qt-surge-suite/surge-2-8-MAC6.mov -f s16le
-FATE_TESTS += fate-qt-ulaw-mono
+FATE_SAMPLES_AVCONV-$(call DEMDEC, MOV, PCM_MULAW) += fate-qt-ulaw-mono
fate-qt-ulaw-mono: CMD = md5 -i $(SAMPLES)/qt-surge-suite/surge-1-16-B-ulaw.mov -f s16le
-FATE_TESTS += fate-qt-ulaw-stereo
+FATE_SAMPLES_AVCONV-$(call DEMDEC, MOV, PCM_MULAW) += fate-qt-ulaw-stereo
fate-qt-ulaw-stereo: CMD = md5 -i $(SAMPLES)/qt-surge-suite/surge-2-16-B-ulaw.mov -f s16le
-FATE_TESTS += fate-quickdraw
+FATE_SAMPLES_AVCONV-$(call DEMDEC, MOV, QDRAW) += fate-quickdraw
fate-quickdraw: CMD = framecrc -i $(SAMPLES)/quickdraw/Airplane.mov -pix_fmt rgb24
-FATE_TESTS += fate-rpza
+FATE_SAMPLES_AVCONV-$(call DEMDEC, MOV, RPZA) += fate-rpza
fate-rpza: CMD = framecrc -i $(SAMPLES)/rpza/rpza2.mov -t 2 -pix_fmt rgb24
-FATE_TESTS += fate-svq1
+FATE_SAMPLES_AVCONV-$(call DEMDEC, MOV, SVQ1) += fate-svq1
fate-svq1: CMD = framecrc -i $(SAMPLES)/svq1/marymary-shackles.mov -an -t 10
-FATE_TESTS += fate-svq3
+FATE_SAMPLES_AVCONV-$(call ALLYES, MOV_DEMUXER SVQ3_DECODER ZLIB) += fate-svq3
fate-svq3: CMD = framecrc -i $(SAMPLES)/svq3/Vertical400kbit.sorenson3.mov -t 6 -an
diff --git a/gst-libs/ext/libav/tests/fate/qtrle.mak b/gst-libs/ext/libav/tests/fate/qtrle.mak
index cd357b5..d8a6ecf 100644
--- a/gst-libs/ext/libav/tests/fate/qtrle.mak
+++ b/gst-libs/ext/libav/tests/fate/qtrle.mak
@@ -1,23 +1,23 @@
FATE_QTRLE += fate-qtrle-1bit
-fate-qtrle-1bit: CMD = framecrc -i $(SAMPLES)/qtrle/Animation-Monochrome.mov
+fate-qtrle-1bit: CMD = framecrc -i $(SAMPLES)/qtrle/Animation-Monochrome.mov -an
FATE_QTRLE += fate-qtrle-2bit
-fate-qtrle-2bit: CMD = framecrc -i $(SAMPLES)/qtrle/Animation-4Greys.mov -pix_fmt rgb24
+fate-qtrle-2bit: CMD = framecrc -i $(SAMPLES)/qtrle/Animation-4Greys.mov -pix_fmt rgb24 -an
FATE_QTRLE += fate-qtrle-4bit
fate-qtrle-4bit: CMD = framecrc -i $(SAMPLES)/qtrle/Animation-16Greys.mov -pix_fmt rgb24 -an
FATE_QTRLE += fate-qtrle-8bit
-fate-qtrle-8bit: CMD = framecrc -i $(SAMPLES)/qtrle/criticalpath-credits.mov -vsync 0 -pix_fmt rgb24 -an
+fate-qtrle-8bit: CMD = framecrc -i $(SAMPLES)/qtrle/criticalpath-credits.mov -pix_fmt rgb24 -an
FATE_QTRLE += fate-qtrle-16bit
fate-qtrle-16bit: CMD = framecrc -i $(SAMPLES)/qtrle/mr-cork-rle.mov -pix_fmt rgb24
FATE_QTRLE += fate-qtrle-24bit
-fate-qtrle-24bit: CMD = framecrc -i $(SAMPLES)/qtrle/aletrek-rle.mov -vsync 0
+fate-qtrle-24bit: CMD = framecrc -i $(SAMPLES)/qtrle/aletrek-rle.mov
FATE_QTRLE += fate-qtrle-32bit
fate-qtrle-32bit: CMD = framecrc -i $(SAMPLES)/qtrle/ultra_demo_720_480_32bpp_rle.mov -pix_fmt rgb24
-FATE_TESTS += $(FATE_QTRLE)
+FATE_SAMPLES_AVCONV-$(call DEMDEC, MOV, QTRLE) += $(FATE_QTRLE)
fate-qtrle: $(FATE_QTRLE)
diff --git a/gst-libs/ext/libav/tests/fate/real.mak b/gst-libs/ext/libav/tests/fate/real.mak
index f0e4917..f3866b6 100644
--- a/gst-libs/ext/libav/tests/fate/real.mak
+++ b/gst-libs/ext/libav/tests/fate/real.mak
@@ -1,42 +1,40 @@
-FATE_TESTS += fate-real-14_4
-fate-real-14_4: CMD = md5 -i $(SAMPLES)/real/ra3_in_rm_file.rm -f s16le
+FATE_SAMPLES_AVCONV-$(call DEMDEC, RM, RA_144) += fate-ra-144
+fate-ra-144: CMD = md5 -i $(SAMPLES)/real/ra3_in_rm_file.rm -f s16le
-FATE_TESTS += fate-ra-288
+FATE_SAMPLES_AVCONV-$(call DEMDEC, RM, RA_288) += fate-ra-288
fate-ra-288: CMD = pcm -i $(SAMPLES)/real/ra_288.rm
fate-ra-288: CMP = oneoff
fate-ra-288: REF = $(SAMPLES)/real/ra_288.pcm
fate-ra-288: FUZZ = 2
-FATE_TESTS += fate-ra-cook
+FATE_SAMPLES_AVCONV-$(call DEMDEC, RM, COOK) += fate-ra-cook
fate-ra-cook: CMD = pcm -i $(SAMPLES)/real/ra_cook.rm
fate-ra-cook: CMP = oneoff
fate-ra-cook: REF = $(SAMPLES)/real/ra_cook.pcm
-FATE_TESTS += fate-rv30
+FATE_SAMPLES_AVCONV-$(call DEMDEC, RM, RV30) += fate-rv30
fate-rv30: CMD = framecrc -flags +bitexact -dct fastint -idct simple -i $(SAMPLES)/real/rv30.rm -an
-FATE_TESTS += fate-real-rv40
-fate-real-rv40: CMD = framecrc -i $(SAMPLES)/real/spygames-2MB.rmvb -t 10 -an -vsync 0
+FATE_SAMPLES_AVCONV-$(call DEMDEC, RM, RV40) += fate-rv40
+fate-rv40: CMD = framecrc -i $(SAMPLES)/real/spygames-2MB.rmvb -t 10 -an -vsync 0
FATE_SIPR += fate-sipr-5k0
fate-sipr-5k0: CMD = pcm -i $(SAMPLES)/sipr/sipr_5k0.rm
-fate-sipr-5k0: CMP = oneoff
fate-sipr-5k0: REF = $(SAMPLES)/sipr/sipr_5k0.pcm
FATE_SIPR += fate-sipr-6k5
fate-sipr-6k5: CMD = pcm -i $(SAMPLES)/sipr/sipr_6k5.rm
-fate-sipr-6k5: CMP = oneoff
fate-sipr-6k5: REF = $(SAMPLES)/sipr/sipr_6k5.pcm
FATE_SIPR += fate-sipr-8k5
fate-sipr-8k5: CMD = pcm -i $(SAMPLES)/sipr/sipr_8k5.rm
-fate-sipr-8k5: CMP = oneoff
fate-sipr-8k5: REF = $(SAMPLES)/sipr/sipr_8k5.pcm
FATE_SIPR += fate-sipr-16k
fate-sipr-16k: CMD = pcm -i $(SAMPLES)/sipr/sipr_16k.rm
-fate-sipr-16k: CMP = oneoff
fate-sipr-16k: REF = $(SAMPLES)/sipr/sipr_16k.pcm
-FATE_TESTS += $(FATE_SIPR)
+$(FATE_SIPR): CMP = oneoff
+
+FATE_SAMPLES_AVCONV-$(call DEMDEC, RM, SIPR) += $(FATE_SIPR)
fate-sipr: $(FATE_SIPR)
diff --git a/gst-libs/ext/libav/tests/fate/screen.mak b/gst-libs/ext/libav/tests/fate/screen.mak
index b6d053b..3dc69c5 100644
--- a/gst-libs/ext/libav/tests/fate/screen.mak
+++ b/gst-libs/ext/libav/tests/fate/screen.mak
@@ -1,7 +1,8 @@
-FATE_TESTS += fate-cscd
-fate-cscd: CMD = framecrc -i $(SAMPLES)/CSCD/sample_video.avi -an -vsync 0 -pix_fmt rgb24
+# FIXME dropped frames in this test because of coarse timebase
+FATE_SAMPLES_AVCONV-$(call DEMDEC, AVI, CSCD) += fate-cscd
+fate-cscd: CMD = framecrc -i $(SAMPLES)/CSCD/sample_video.avi -an -pix_fmt rgb24
-FATE_TESTS += fate-dxtory
+FATE_SAMPLES_AVCONV-$(call DEMDEC, AVI, DXTORY) += fate-dxtory
fate-dxtory: CMD = framecrc -i $(SAMPLES)/dxtory/dxtory_mic.avi
FATE_FRAPS += fate-fraps-v0
@@ -22,7 +23,7 @@ fate-fraps-v4: CMD = framecrc -i $(SAMPLES)/fraps/WoW_2006-11-03_14-58-17-19-nos
FATE_FRAPS += fate-fraps-v5
fate-fraps-v5: CMD = framecrc -i $(SAMPLES)/fraps/fraps-v5-bouncing-balls-partial.avi
-FATE_TESTS += $(FATE_FRAPS)
+FATE_SAMPLES_AVCONV-$(call DEMDEC, AVI, FRAPS) += $(FATE_FRAPS)
fate-fraps: $(FATE_FRAPS)
FATE_TSCC += fate-tscc-15bit
@@ -31,7 +32,7 @@ fate-tscc-15bit: CMD = framecrc -i $(SAMPLES)/tscc/oneminute.avi -t 15 -pix_fmt
FATE_TSCC += fate-tscc-32bit
fate-tscc-32bit: CMD = framecrc -i $(SAMPLES)/tscc/2004-12-17-uebung9-partial.avi -pix_fmt rgb24 -an
-FATE_TESTS += $(FATE_TSCC)
+FATE_SAMPLES_AVCONV-$(call DEMDEC, AVI, TSCC) += $(FATE_TSCC)
fate-tscc: $(FATE_TSCC)
FATE_VMNC += fate-vmnc-16bit
@@ -40,7 +41,7 @@ fate-vmnc-16bit: CMD = framecrc -i $(SAMPLES)/VMnc/test.avi -pix_fmt rgb24
FATE_VMNC += fate-vmnc-32bit
fate-vmnc-32bit: CMD = framecrc -i $(SAMPLES)/VMnc/VS2k5DebugDemo-01-partial.avi -pix_fmt rgb24
-FATE_TESTS += $(FATE_VMNC)
+FATE_SAMPLES_AVCONV-$(call DEMDEC, AVI, VMNC) += $(FATE_VMNC)
fate-vmnc: $(FATE_VMNC)
FATE_ZMBV += fate-zmbv-8bit
@@ -55,5 +56,5 @@ fate-zmbv-16bit: CMD = framecrc -i $(SAMPLES)/zmbv/zmbv_16bit.avi -pix_fmt rgb24
FATE_ZMBV += fate-zmbv-32bit
fate-zmbv-32bit: CMD = framecrc -i $(SAMPLES)/zmbv/zmbv_32bit.avi -pix_fmt rgb24 -t 25
-FATE_TESTS += $(FATE_ZMBV)
+FATE_SAMPLES_AVCONV-$(call DEMDEC, AVI, ZMBV) += $(FATE_ZMBV)
fate-zmbv: $(FATE_ZMBV)
diff --git a/gst-libs/ext/libav/tests/fate/seek.mak b/gst-libs/ext/libav/tests/fate/seek.mak
new file mode 100644
index 0000000..f9d25bf
--- /dev/null
+++ b/gst-libs/ext/libav/tests/fate/seek.mak
@@ -0,0 +1,231 @@
+# files from fate-acodec
+
+FATE_SEEK_ACODEC-$(call ENCDEC, PCM_ALAW, WAV) += pcm-alaw
+FATE_SEEK_ACODEC-$(call ENCDEC, PCM_MULAW, WAV) += pcm-mulaw
+FATE_SEEK_ACODEC-$(call ENCDEC, PCM_S8, MOV) += pcm-s8
+FATE_SEEK_ACODEC-$(call ENCDEC, PCM_U8, WAV) += pcm-u8
+FATE_SEEK_ACODEC-$(call ENCDEC, PCM_S16BE, MOV) += pcm-s16be
+FATE_SEEK_ACODEC-$(call ENCDEC, PCM_S16LE, WAV) += pcm-s16le
+FATE_SEEK_ACODEC-$(call ENCDEC, PCM_S24BE, MOV) += pcm-s24be
+FATE_SEEK_ACODEC-$(call ENCDEC, PCM_S24LE, WAV) += pcm-s24le
+FATE_SEEK_ACODEC-$(call ENCDEC, PCM_S32BE, MOV) += pcm-s32be
+FATE_SEEK_ACODEC-$(call ENCDEC, PCM_S32LE, WAV) += pcm-s32le
+FATE_SEEK_ACODEC-$(call ENCDEC, PCM_F32BE, AU) += pcm-f32be
+FATE_SEEK_ACODEC-$(call ENCDEC, PCM_F32LE, WAV) += pcm-f32le
+FATE_SEEK_ACODEC-$(call ENCDEC, PCM_F64BE, AU) += pcm-f64be
+FATE_SEEK_ACODEC-$(call ENCDEC, PCM_F64LE, WAV) += pcm-f64le
+FATE_SEEK_ACODEC-$(call ENCDEC, ADPCM_IMA_QT, AIFF) += adpcm-ima_qt
+FATE_SEEK_ACODEC-$(call ENCDEC, ADPCM_IMA_WAV, WAV) += adpcm-ima_wav
+FATE_SEEK_ACODEC-$(call ENCDEC, ADPCM_MS, WAV) += adpcm-ms
+FATE_SEEK_ACODEC-$(call ENCDEC, ADPCM_SWF, FLV) += adpcm-swf
+FATE_SEEK_ACODEC-$(call ENCDEC, ADPCM_YAMAHA, WAV) += adpcm-yamaha
+FATE_SEEK_ACODEC-$(call ENCDEC, ALAC, MOV) += alac
+FATE_SEEK_ACODEC-$(call ENCDEC, FLAC, FLAC) += flac
+FATE_SEEK_ACODEC-$(call ENCDEC, MP2, MP2 MP3) += mp2
+
+fate-seek-acodec-adpcm-ima_qt: SRC = fate/acodec-adpcm-ima_qt.aiff
+fate-seek-acodec-adpcm-ima_wav: SRC = fate/acodec-adpcm-ima_wav.wav
+fate-seek-acodec-adpcm-ms: SRC = fate/acodec-adpcm-ms.wav
+fate-seek-acodec-adpcm-swf: SRC = fate/acodec-adpcm-swf.flv
+fate-seek-acodec-adpcm-yamaha: SRC = fate/acodec-adpcm-yamaha.wav
+fate-seek-acodec-alac: SRC = fate/acodec-alac.mov
+fate-seek-acodec-flac: SRC = fate/acodec-flac.flac
+fate-seek-acodec-mp2: SRC = fate/acodec-mp2.mp2
+fate-seek-acodec-pcm-alaw: SRC = fate/acodec-pcm-alaw.wav
+fate-seek-acodec-pcm-f32be: SRC = fate/acodec-pcm-f32be.au
+fate-seek-acodec-pcm-f32le: SRC = fate/acodec-pcm-f32le.wav
+fate-seek-acodec-pcm-f64be: SRC = fate/acodec-pcm-f64be.au
+fate-seek-acodec-pcm-f64le: SRC = fate/acodec-pcm-f64le.wav
+fate-seek-acodec-pcm-mulaw: SRC = fate/acodec-pcm-mulaw.wav
+fate-seek-acodec-pcm-s16be: SRC = fate/acodec-pcm-s16be.mov
+fate-seek-acodec-pcm-s16le: SRC = fate/acodec-pcm-s16le.wav
+fate-seek-acodec-pcm-s24be: SRC = fate/acodec-pcm-s24be.mov
+fate-seek-acodec-pcm-s24le: SRC = fate/acodec-pcm-s24le.wav
+fate-seek-acodec-pcm-s32be: SRC = fate/acodec-pcm-s32be.mov
+fate-seek-acodec-pcm-s32le: SRC = fate/acodec-pcm-s32le.wav
+fate-seek-acodec-pcm-s8: SRC = fate/acodec-pcm-s8.mov
+fate-seek-acodec-pcm-u8: SRC = fate/acodec-pcm-u8.wav
+
+FATE_SEEK += $(FATE_SEEK_ACODEC-yes:%=fate-seek-acodec-%)
+
+# files from fate-vsynth2
+
+FATE_SEEK_VSYNTH2-$(call ENCDEC, ASV1, AVI) += asv1
+FATE_SEEK_VSYNTH2-$(call ENCDEC, ASV2, AVI) += asv2
+FATE_SEEK_VSYNTH2-$(call ENCDEC, DNXHD, DNXHD) += dnxhd-720p
+FATE_SEEK_VSYNTH2-$(call ENCDEC, DNXHD, DNXHD) += dnxhd-720p-rd
+FATE_SEEK_VSYNTH2-$(call ENCDEC, DNXHD, MOV) += dnxhd-1080i
+FATE_SEEK_VSYNTH2-$(call ENCDEC, DVVIDEO, DV) += dv
+FATE_SEEK_VSYNTH2-$(call ENCDEC, DVVIDEO, DV) += dv-411
+FATE_SEEK_VSYNTH2-$(call ENCDEC, DVVIDEO, DV) += dv-50
+FATE_SEEK_VSYNTH2-$(call ENCDEC, FFV1, AVI) += ffv1
+FATE_SEEK_VSYNTH2-$(call ENCDEC, FLASHSV, FLV) += flashsv
+FATE_SEEK_VSYNTH2-$(call ENCDEC, FLV, FLV) += flv
+FATE_SEEK_VSYNTH2-$(call ENCDEC, H261, AVI) += h261
+FATE_SEEK_VSYNTH2-$(call ENCDEC, H263, AVI) += h263
+FATE_SEEK_VSYNTH2-$(call ENCDEC, H263, AVI) += h263p
+FATE_SEEK_VSYNTH2-$(call ENCDEC, HUFFYUV, AVI) += huffyuv
+FATE_SEEK_VSYNTH2-$(call ENCDEC, JPEGLS, AVI) += jpegls
+FATE_SEEK_VSYNTH2-$(call ENCDEC, LJPEG MJPEG, AVI) += ljpeg
+FATE_SEEK_VSYNTH2-$(call ENCDEC, MJPEG, AVI) += mjpeg
+
+FATE_SEEK_VSYNTH2-$(call ENCDEC, MPEG1VIDEO, MPEG1VIDEO MPEGVIDEO) += \
+ mpeg1 \
+ mpeg1b
+
+FATE_SEEK_VSYNTH2-$(call ENCDEC, MPEG2VIDEO, MPEG2VIDEO MPEGVIDEO) += \
+ mpeg2-422 \
+ mpeg2-idct-int \
+ mpeg2-ilace \
+ mpeg2-ivlc-qprd \
+ mpeg2-thread \
+ mpeg2-thread-ivlc
+
+FATE_SEEK_VSYNTH2-$(call ENCDEC, MPEG4, MP4 MOV) += mpeg4
+FATE_SEEK_VSYNTH2-$(call ENCDEC, MPEG4, AVI) += $(FATE_MPEG4_AVI)
+FATE_SEEK_VSYNTH2-$(call ENCDEC, MSMPEG4V3, AVI) += msmpeg4
+FATE_SEEK_VSYNTH2-$(call ENCDEC, MSMPEG4V2, AVI) += msmpeg4v2
+FATE_SEEK_VSYNTH2-$(call ENCDEC, RAWVIDEO, AVI) += rgb
+FATE_SEEK_VSYNTH2-$(call ENCDEC, ROQ, ROQ) += roqvideo
+FATE_SEEK_VSYNTH2-$(call ENCDEC, RV10, RM) += rv10
+FATE_SEEK_VSYNTH2-$(call ENCDEC, RV20, RM) += rv20
+FATE_SEEK_VSYNTH2-$(call ENCDEC, SNOW, AVI) += snow
+FATE_SEEK_VSYNTH2-$(call ENCDEC, SNOW, AVI) += snow-ll
+FATE_SEEK_VSYNTH2-$(call ENCDEC, SVQ1, MOV) += svq1
+FATE_SEEK_VSYNTH2-$(call ENCDEC, WMV1, AVI) += wmv1
+FATE_SEEK_VSYNTH2-$(call ENCDEC, WMV2, AVI) += wmv2
+FATE_SEEK_VSYNTH2-$(call ENCDEC, RAWVIDEO, AVI) += yuv
+
+fate-seek-vsynth2-asv1: SRC = fate/vsynth2-asv1.avi
+fate-seek-vsynth2-asv2: SRC = fate/vsynth2-asv2.avi
+fate-seek-vsynth2-dnxhd-1080i: SRC = fate/vsynth2-dnxhd-1080i.mov
+fate-seek-vsynth2-dnxhd-720p: SRC = fate/vsynth2-dnxhd-720p.dnxhd
+fate-seek-vsynth2-dnxhd-720p-rd: SRC = fate/vsynth2-dnxhd-720p.dnxhd
+fate-seek-vsynth2-dv: SRC = fate/vsynth2-dv.dv
+fate-seek-vsynth2-dv-411: SRC = fate/vsynth2-dv-411.dv
+fate-seek-vsynth2-dv-50: SRC = fate/vsynth2-dv-50.dv
+fate-seek-vsynth2-ffv1: SRC = fate/vsynth2-ffv1.avi
+fate-seek-vsynth2-flashsv: SRC = fate/vsynth2-flashsv.flv
+fate-seek-vsynth2-flv: SRC = fate/vsynth2-flv.flv
+fate-seek-vsynth2-h261: SRC = fate/vsynth2-h261.avi
+fate-seek-vsynth2-h263: SRC = fate/vsynth2-h263.avi
+fate-seek-vsynth2-h263p: SRC = fate/vsynth2-h263p.avi
+fate-seek-vsynth2-huffyuv: SRC = fate/vsynth2-huffyuv.avi
+fate-seek-vsynth2-jpegls: SRC = fate/vsynth2-jpegls.avi
+fate-seek-vsynth2-ljpeg: SRC = fate/vsynth2-ljpeg.avi
+fate-seek-vsynth2-mjpeg: SRC = fate/vsynth2-mjpeg.avi
+fate-seek-vsynth2-mpeg1: SRC = fate/vsynth2-mpeg1.mpeg1video
+fate-seek-vsynth2-mpeg1b: SRC = fate/vsynth2-mpeg1b.mpeg1video
+fate-seek-vsynth2-mpeg2-422: SRC = fate/vsynth2-mpeg2-422.mpeg2video
+fate-seek-vsynth2-mpeg2-idct-int: SRC = fate/vsynth2-mpeg2-idct-int.mpeg2video
+fate-seek-vsynth2-mpeg2-ilace: SRC = fate/vsynth2-mpeg2-ilace.mpeg2video
+fate-seek-vsynth2-mpeg2-ivlc-qprd: SRC = fate/vsynth2-mpeg2-ivlc-qprd.mpeg2video
+fate-seek-vsynth2-mpeg2-thread: SRC = fate/vsynth2-mpeg2-thread.mpeg2video
+fate-seek-vsynth2-mpeg2-thread-ivlc: SRC = fate/vsynth2-mpeg2-thread-ivlc.mpeg2video
+fate-seek-vsynth2-mpeg4: SRC = fate/vsynth2-mpeg4.mp4
+fate-seek-vsynth2-mpeg4-adap: SRC = fate/vsynth2-mpeg4-adap.avi
+fate-seek-vsynth2-mpeg4-adv: SRC = fate/vsynth2-mpeg4-adv.avi
+fate-seek-vsynth2-mpeg4-error: SRC = fate/vsynth2-mpeg4-error.avi
+fate-seek-vsynth2-mpeg4-nr: SRC = fate/vsynth2-mpeg4-nr.avi
+fate-seek-vsynth2-mpeg4-qpel: SRC = fate/vsynth2-mpeg4-qpel.avi
+fate-seek-vsynth2-mpeg4-qprd: SRC = fate/vsynth2-mpeg4-qprd.avi
+fate-seek-vsynth2-mpeg4-rc: SRC = fate/vsynth2-mpeg4-rc.avi
+fate-seek-vsynth2-mpeg4-thread: SRC = fate/vsynth2-mpeg4-thread.avi
+fate-seek-vsynth2-msmpeg4: SRC = fate/vsynth2-msmpeg4.avi
+fate-seek-vsynth2-msmpeg4v2: SRC = fate/vsynth2-msmpeg4v2.avi
+fate-seek-vsynth2-rgb: SRC = fate/vsynth2-rgb.avi
+fate-seek-vsynth2-roqvideo: SRC = fate/vsynth2-roqvideo.roq
+fate-seek-vsynth2-rv10: SRC = fate/vsynth2-rv10.rm
+fate-seek-vsynth2-rv20: SRC = fate/vsynth2-rv20.rm
+fate-seek-vsynth2-svq1: SRC = fate/vsynth2-svq1.mov
+fate-seek-vsynth2-wmv1: SRC = fate/vsynth2-wmv1.avi
+fate-seek-vsynth2-wmv2: SRC = fate/vsynth2-wmv2.avi
+fate-seek-vsynth2-yuv: SRC = fate/vsynth2-yuv.avi
+
+FATE_SEEK += $(FATE_SEEK_VSYNTH2-yes:%=fate-seek-vsynth2-%)
+
+# files from fate-lavf
+
+FATE_SEEK_LAVF-$(call ENCDEC, PCM_S16BE, AIFF) += aiff
+FATE_SEEK_LAVF-$(call ENCDEC, PCM_ALAW, PCM_ALAW) += alaw
+FATE_SEEK_LAVF-$(call ENCDEC2, MSMPEG4V3, MP2, ASF) += asf
+FATE_SEEK_LAVF-$(call ENCDEC, PCM_S16BE, AU) += au
+FATE_SEEK_LAVF-$(call ENCDEC2, MPEG4, MP2, AVI) += avi
+FATE_SEEK_LAVF-$(call ENCDEC, BMP, IMAGE2) += bmp
+FATE_SEEK_LAVF-$(call ENCDEC2, DVVIDEO, PCM_S16LE, AVI) += dv_fmt
+FATE_SEEK_LAVF-$(call ENCDEC2, MPEG1VIDEO, MP2, FFM) += ffm
+FATE_SEEK_LAVF-$(call ENCDEC, FLV, FLV) += flv_fmt
+FATE_SEEK_LAVF-$(call ENCDEC, GIF, IMAGE2) += gif
+FATE_SEEK_LAVF-$(call ENCDEC2, MPEG2VIDEO, PCM_S16LE, GXF) += gxf
+FATE_SEEK_LAVF-$(call ENCDEC, MJPEG, IMAGE2) += jpg
+FATE_SEEK_LAVF-$(call ENCDEC2, MPEG4, MP2, MATROSKA) += mkv
+FATE_SEEK_LAVF-$(call ENCDEC, ADPCM_YAMAHA, MMF) += mmf
+FATE_SEEK_LAVF-$(call ENCDEC2, MPEG4, PCM_ALAW, MOV) += mov
+FATE_SEEK_LAVF-$(call ENCDEC2, MPEG1VIDEO, MP2, MPEG1SYSTEM MPEGPS) += mpg
+FATE_SEEK_LAVF-$(call ENCDEC, PCM_MULAW, PCM_MULAW) += mulaw
+FATE_SEEK_LAVF-$(call ENCDEC2, MPEG2VIDEO, PCM_S16LE, MXF) += mxf
+FATE_SEEK_LAVF-$(call ENCDEC2, MPEG2VIDEO, PCM_S16LE, MXF_D10 MXF) += mxf_d10
+FATE_SEEK_LAVF-$(call ENCDEC2, MPEG4, MP2, NUT) += nut
+FATE_SEEK_LAVF-$(call ENCDEC, FLAC, OGG) += ogg
+FATE_SEEK_LAVF-$(call ENCDEC, PBM, IMAGE2PIPE) += pbmpipe
+FATE_SEEK_LAVF-$(call ENCDEC, PCX, IMAGE2) += pcx
+FATE_SEEK_LAVF-$(call ENCDEC, PGM, IMAGE2) += pgm
+FATE_SEEK_LAVF-$(call ENCDEC, PGM, IMAGE2PIPE) += pgmpipe
+FATE_SEEK_LAVF-$(call ENCDEC, PPM, IMAGE2) += ppm
+FATE_SEEK_LAVF-$(call ENCDEC, PPM, IMAGE2PIPE) += ppmpipe
+FATE_SEEK_LAVF-$(call ENCMUX, RV10 AC3_FIXED, RM) += rm
+FATE_SEEK_LAVF-$(call ENCDEC, SGI, IMAGE2) += sgi
+FATE_SEEK_LAVF-$(call ENCDEC, FLV, SWF) += swf
+FATE_SEEK_LAVF-$(call ENCDEC, TARGA, IMAGE2) += tga
+FATE_SEEK_LAVF-$(call ENCDEC, TIFF, IMAGE2) += tiff
+FATE_SEEK_LAVF-$(call ENCDEC2, MPEG2VIDEO, MP2, MPEGTS) += ts
+FATE_SEEK_LAVF-$(call ENCDEC, PCM_U8, VOC) += voc
+FATE_SEEK_LAVF-$(call ENCDEC, PCM_S16LE, WAV) += wav
+FATE_SEEK_LAVF-$(CONFIG_YUV4MPEGPIPE_MUXER) += yuv4mpeg
+
+fate-seek-lavf-aiff: SRC = lavf/lavf.aif
+fate-seek-lavf-alaw: SRC = lavf/lavf.al
+fate-seek-lavf-asf: SRC = lavf/lavf.asf
+fate-seek-lavf-au: SRC = lavf/lavf.au
+fate-seek-lavf-avi: SRC = lavf/lavf.avi
+fate-seek-lavf-bmp: SRC = images/bmp/%02d.bmp
+fate-seek-lavf-dv_fmt: SRC = lavf/lavf.dv
+fate-seek-lavf-ffm: SRC = lavf/lavf.ffm
+fate-seek-lavf-flv_fmt: SRC = lavf/lavf.flv
+fate-seek-lavf-gif: SRC = lavf/lavf.gif
+fate-seek-lavf-gxf: SRC = lavf/lavf.gxf
+fate-seek-lavf-jpg: SRC = images/jpg/%02d.jpg
+fate-seek-lavf-mkv: SRC = lavf/lavf.mkv
+fate-seek-lavf-mmf: SRC = lavf/lavf.mmf
+fate-seek-lavf-mov: SRC = lavf/lavf.mov
+fate-seek-lavf-mpg: SRC = lavf/lavf.mpg
+fate-seek-lavf-mulaw: SRC = lavf/lavf.ul
+fate-seek-lavf-mxf: SRC = lavf/lavf.mxf
+fate-seek-lavf-mxf_d10: SRC = lavf/lavf.mxf_d10
+fate-seek-lavf-nut: SRC = lavf/lavf.nut
+fate-seek-lavf-ogg: SRC = lavf/lavf.ogg
+fate-seek-lavf-pbmpipe: SRC = lavf/pbmpipe.pbm
+fate-seek-lavf-pcx: SRC = images/pcx/%02d.pcx
+fate-seek-lavf-pgm: SRC = images/pgm/%02d.pgm
+fate-seek-lavf-pgmpipe: SRC = lavf/pgmpipe.pgm
+fate-seek-lavf-ppm: SRC = images/ppm/%02d.ppm
+fate-seek-lavf-ppmpipe: SRC = lavf/ppmpipe.ppm
+fate-seek-lavf-rm: SRC = lavf/lavf.rm
+fate-seek-lavf-sgi: SRC = images/sgi/%02d.sgi
+fate-seek-lavf-swf: SRC = lavf/lavf.swf
+fate-seek-lavf-tga: SRC = images/tga/%02d.tga
+fate-seek-lavf-tiff: SRC = images/tiff/%02d.tiff
+fate-seek-lavf-ts: SRC = lavf/lavf.ts
+fate-seek-lavf-voc: SRC = lavf/lavf.voc
+fate-seek-lavf-wav: SRC = lavf/lavf.wav
+fate-seek-lavf-yuv4mpeg: SRC = lavf/lavf.y4m
+
+FATE_SEEK += $(FATE_SEEK_LAVF-yes:%=fate-seek-lavf-%)
+
+$(FATE_SEEK): libavformat/seek-test$(EXESUF)
+$(FATE_SEEK): CMD = run libavformat/seek-test$(EXESUF) $(TARGET_PATH)/tests/data/$(SRC)
+$(FATE_SEEK): fate-seek-%: fate-%
+fate-seek-%: REF = $(SRC_PATH)/tests/ref/seek/$(@:fate-seek-%=%)
+
+FATE_AVCONV += $(FATE_SEEK)
+fate-seek: $(FATE_SEEK)
diff --git a/gst-libs/ext/libav/tests/fate/utvideo.mak b/gst-libs/ext/libav/tests/fate/utvideo.mak
index 7cf6237..004d8e0 100644
--- a/gst-libs/ext/libav/tests/fate/utvideo.mak
+++ b/gst-libs/ext/libav/tests/fate/utvideo.mak
@@ -4,6 +4,9 @@ fate-utvideo_rgba_left: CMD = framecrc -i $(SAMPLES)/utvideo/utvideo_rgba_left.a
FATE_UTVIDEO += fate-utvideo_rgba_median
fate-utvideo_rgba_median: CMD = framecrc -i $(SAMPLES)/utvideo/utvideo_rgba_median.avi
+FATE_UTVIDEO += fate-utvideo_rgba_single_symbol
+fate-utvideo_rgba_single_symbol: CMD = framecrc -i $(SAMPLES)/utvideo/utvideo_rgba_single_symbol.avi
+
FATE_UTVIDEO += fate-utvideo_rgb_left
fate-utvideo_rgb_left: CMD = framecrc -i $(SAMPLES)/utvideo/utvideo_rgb_left.avi
@@ -22,5 +25,48 @@ fate-utvideo_yuv422_left: CMD = framecrc -i $(SAMPLES)/utvideo/utvideo_yuv422_le
FATE_UTVIDEO += fate-utvideo_yuv422_median
fate-utvideo_yuv422_median: CMD = framecrc -i $(SAMPLES)/utvideo/utvideo_yuv422_median.avi
-FATE_TESTS += $(FATE_UTVIDEO)
+FATE_SAMPLES_AVCONV-$(call DEMDEC, AVI, UTVIDEO) += $(FATE_UTVIDEO)
fate-utvideo: $(FATE_UTVIDEO)
+
+fate-utvideoenc%: CMD = framemd5 -f image2 -vcodec pgmyuv -i $(TARGET_PATH)/tests/vsynth1/%02d.pgm -vcodec utvideo -f avi -sws_flags +accurate_rnd+bitexact ${OPTS}
+
+FATE_UTVIDEOENC += fate-utvideoenc_rgba_none
+fate-utvideoenc_rgba_none: OPTS = -pix_fmt rgba -pred 3
+
+FATE_UTVIDEOENC += fate-utvideoenc_rgba_left
+fate-utvideoenc_rgba_left: OPTS = -pix_fmt rgba -pred left
+
+FATE_UTVIDEOENC += fate-utvideoenc_rgba_median
+fate-utvideoenc_rgba_median: OPTS = -pix_fmt rgba -pred median
+
+FATE_UTVIDEOENC += fate-utvideoenc_rgb_none
+fate-utvideoenc_rgb_none: OPTS = -pix_fmt rgb24 -pred 3
+
+FATE_UTVIDEOENC += fate-utvideoenc_rgb_left
+fate-utvideoenc_rgb_left: OPTS = -pix_fmt rgb24 -pred left
+
+FATE_UTVIDEOENC += fate-utvideoenc_rgb_median
+fate-utvideoenc_rgb_median: OPTS = -pix_fmt rgb24 -pred median
+
+FATE_UTVIDEOENC += fate-utvideoenc_yuv420_none
+fate-utvideoenc_yuv420_none: OPTS = -pix_fmt yuv420p -pred 3
+
+FATE_UTVIDEOENC += fate-utvideoenc_yuv420_left
+fate-utvideoenc_yuv420_left: OPTS = -pix_fmt yuv420p -pred left
+
+FATE_UTVIDEOENC += fate-utvideoenc_yuv420_median
+fate-utvideoenc_yuv420_median: OPTS = -pix_fmt yuv420p -pred median
+
+FATE_UTVIDEOENC += fate-utvideoenc_yuv422_none
+fate-utvideoenc_yuv422_none: OPTS = -pix_fmt yuv422p -pred 3
+
+FATE_UTVIDEOENC += fate-utvideoenc_yuv422_left
+fate-utvideoenc_yuv422_left: OPTS = -pix_fmt yuv422p -pred left
+
+FATE_UTVIDEOENC += fate-utvideoenc_yuv422_median
+fate-utvideoenc_yuv422_median: OPTS = -pix_fmt yuv422p -pred median
+
+$(FATE_UTVIDEOENC): tests/vsynth1/00.pgm
+
+FATE_AVCONV-$(call ENCMUX, UTVIDEO, AVI) += $(FATE_UTVIDEOENC)
+fate-utvideoenc: $(FATE_UTVIDEOENC)
diff --git a/gst-libs/ext/libav/tests/fate/vcodec.mak b/gst-libs/ext/libav/tests/fate/vcodec.mak
new file mode 100644
index 0000000..36b9658
--- /dev/null
+++ b/gst-libs/ext/libav/tests/fate/vcodec.mak
@@ -0,0 +1,249 @@
+fate-vsynth1-%: SRC = tests/data/vsynth1.yuv
+fate-vsynth2-%: SRC = tests/data/vsynth2.yuv
+fate-vsynth%: CODEC = $(word 3, $(subst -, ,$(@)))
+fate-vsynth%: FMT = avi
+fate-vsynth%: CMD = enc_dec "rawvideo -s 352x288 -pix_fmt yuv420p" $(SRC) $(FMT) "-c $(CODEC) $(ENCOPTS)" rawvideo "-s 352x288 -pix_fmt yuv420p $(DECOPTS)" -keep
+fate-vsynth%: CMP_UNIT = 1
+fate-vsynth%: REF = $(SRC_PATH)/tests/ref/vsynth/$(@:fate-%=%)
+
+FATE_VCODEC-$(call ENCDEC, ASV1, AVI) += asv1
+fate-vsynth%-asv1: ENCOPTS = -qscale 10
+
+FATE_VCODEC-$(call ENCDEC, ASV2, AVI) += asv2
+fate-vsynth%-asv2: ENCOPTS = -qscale 10
+
+FATE_VCODEC-$(call ENCDEC, CLJR, AVI) += cljr
+
+FATE_VCODEC-$(call ENCDEC, DNXHD, DNXHD) += dnxhd-720p \
+ dnxhd-720p-rd \
+ dnxhd-720p-10bit
+
+fate-vsynth%-dnxhd-720p: ENCOPTS = -s hd720 -b 90M \
+ -pix_fmt yuv422p -frames 5
+fate-vsynth%-dnxhd-720p: FMT = dnxhd
+
+fate-vsynth%-dnxhd-720p-rd: ENCOPTS = -s hd720 -b 90M -threads 4 -mbd rd \
+ -pix_fmt yuv422p -frames 5
+fate-vsynth%-dnxhd-720p-rd: FMT = dnxhd
+
+fate-vsynth%-dnxhd-720p-10bit: ENCOPTS = -s hd720 -b 90M \
+ -pix_fmt yuv422p10 -frames 5
+fate-vsynth%-dnxhd-720p-10bit: FMT = dnxhd
+
+FATE_VCODEC-$(call ENCDEC, DNXHD, MOV) += dnxhd-1080i
+fate-vsynth%-dnxhd-1080i: ENCOPTS = -s hd1080 -b 120M -flags +ildct \
+ -pix_fmt yuv422p -frames 5
+fate-vsynth%-dnxhd-1080i: FMT = mov
+
+FATE_VCODEC-$(call ENCDEC, DVVIDEO, DV) += dv dv-411 dv-50
+fate-vsynth%-dv: CODEC = dvvideo
+fate-vsynth%-dv: ENCOPTS = -dct int -s pal
+fate-vsynth%-dv: FMT = dv
+
+fate-vsynth%-dv-411: CODEC = dvvideo
+fate-vsynth%-dv-411: ENCOPTS = -dct int -s pal -pix_fmt yuv411p \
+ -sws_flags area
+fate-vsynth%-dv-411: DECOPTS = -sws_flags area
+fate-vsynth%-dv-411: FMT = dv
+
+fate-vsynth%-dv-50: CODEC = dvvideo
+fate-vsynth%-dv-50: ENCOPTS = -dct int -s pal -pix_fmt yuv422p \
+ -sws_flags neighbor
+fate-vsynth%-dv-50: DECOPTS = -sws_flags neighbor
+fate-vsynth%-dv-50: FMT = dv
+
+FATE_VCODEC-$(call ENCDEC, FFV1, AVI) += ffv1
+fate-vsynth%-ffv1: ENCOPTS = -strict -2
+
+FATE_VCODEC-$(call ENCDEC, FFVHUFF, AVI) += ffvhuff
+
+FATE_VCODEC-$(call ENCDEC, FLASHSV, FLV) += flashsv
+fate-vsynth%-flashsv: ENCOPTS = -sws_flags neighbor+full_chroma_int
+fate-vsynth%-flashsv: DECOPTS = -sws_flags area
+fate-vsynth%-flashsv: FMT = flv
+
+FATE_VCODEC-$(call ENCDEC, FLV, FLV) += flv
+fate-vsynth%-flv: ENCOPTS = -qscale 10
+fate-vsynth%-flv: FMT = flv
+
+FATE_VCODEC-$(call ENCDEC, H261, AVI) += h261
+fate-vsynth%-h261: ENCOPTS = -qscale 11
+
+FATE_VCODEC-$(call ENCDEC, H263, AVI) += h263 h263-obmc h263p
+fate-vsynth%-h263: ENCOPTS = -qscale 10
+fate-vsynth%-h263-obmc: ENCOPTS = -qscale 10 -obmc 1
+fate-vsynth%-h263p: ENCOPTS = -qscale 2 -flags +aic -umv 1 -aiv 1 -ps 300
+
+FATE_VCODEC-$(call ENCDEC, HUFFYUV, AVI) += huffyuv
+fate-vsynth%-huffyuv: ENCOPTS = -pix_fmt yuv422p -sws_flags neighbor
+fate-vsynth%-huffyuv: DECOPTS = -strict -2 -sws_flags neighbor
+
+FATE_VCODEC-$(call ENCDEC, JPEGLS, AVI) += jpegls
+fate-vsynth%-jpegls: ENCOPTS = -sws_flags neighbor+full_chroma_int
+fate-vsynth%-jpegls: DECOPTS = -sws_flags area
+
+FATE_VCODEC-$(call ENCDEC, LJPEG MJPEG, AVI) += ljpeg
+fate-vsynth%-ljpeg: ENCOPTS = -strict -1
+
+FATE_VCODEC-$(call ENCDEC, MJPEG, AVI) += mjpeg
+fate-vsynth%-mjpeg: ENCOPTS = -qscale 9 -pix_fmt yuvj420p
+
+FATE_VCODEC-$(call ENCDEC, MPEG1VIDEO, MPEG1VIDEO MPEGVIDEO) += mpeg1 mpeg1b
+fate-vsynth%-mpeg1: FMT = mpeg1video
+fate-vsynth%-mpeg1: CODEC = mpeg1video
+fate-vsynth%-mpeg1: ENCOPTS = -qscale 10
+
+fate-vsynth%-mpeg1b: CODEC = mpeg1video
+fate-vsynth%-mpeg1b: ENCOPTS = -qscale 8 -bf 3 -ps 200
+fate-vsynth%-mpeg1b: FMT = mpeg1video
+
+FATE_MPEG2 = mpeg2 \
+ mpeg2-422 \
+ mpeg2-idct-int \
+ mpeg2-ilace \
+ mpeg2-ivlc-qprd \
+ mpeg2-thread \
+ mpeg2-thread-ivlc
+
+FATE_VCODEC-$(call ENCDEC, MPEG2VIDEO, MPEG2VIDEO MPEGVIDEO) += $(FATE_MPEG2)
+
+$(FATE_MPEG2:%=fate-vsynth\%-%): FMT = mpeg2video
+$(FATE_MPEG2:%=fate-vsynth\%-%): CODEC = mpeg2video
+
+fate-vsynth%-mpeg2: ENCOPTS = -qscale 10
+fate-vsynth%-mpeg2-422: ENCOPTS = -vb 1000k \
+ -bf 2 \
+ -trellis 1 \
+ -flags +mv0+ildct+ilme \
+ -mpv_flags +qp_rd \
+ -intra_vlc 1 \
+ -mbd rd \
+ -pix_fmt yuv422p
+fate-vsynth%-mpeg2-idct-int: ENCOPTS = -qscale 10 -idct int -dct int
+fate-vsynth%-mpeg2-ilace: ENCOPTS = -qscale 10 -flags +ildct+ilme
+fate-vsynth%-mpeg2-ivlc-qprd: ENCOPTS = -vb 500k \
+ -bf 2 \
+ -trellis 1 \
+ -flags +mv0 \
+ -mpv_flags +qp_rd \
+ -intra_vlc 1 \
+ -cmp 2 -subcmp 2 \
+ -mbd rd
+fate-vsynth%-mpeg2-thread: ENCOPTS = -qscale 10 -bf 2 -flags +ildct+ilme \
+ -threads 2 -slices 2
+fate-vsynth%-mpeg2-thread-ivlc: ENCOPTS = -qscale 10 -bf 2 -flags +ildct+ilme \
+ -intra_vlc 1 -threads 2 -slices 2
+
+FATE_MPEG4_MP4 = mpeg4
+FATE_MPEG4_AVI = mpeg4-rc \
+ mpeg4-adv \
+ mpeg4-qprd \
+ mpeg4-adap \
+ mpeg4-qpel \
+ mpeg4-thread \
+ mpeg4-error \
+ mpeg4-nr
+
+FATE_VCODEC-$(call ENCDEC, MPEG4, MP4 MOV) += $(FATE_MPEG4_MP4)
+FATE_VCODEC-$(call ENCDEC, MPEG4, AVI) += $(FATE_MPEG4_AVI)
+
+fate-vsynth%-mpeg4: ENCOPTS = -qscale 10 -flags +mv4 -mbd bits
+fate-vsynth%-mpeg4: FMT = mp4
+
+fate-vsynth%-mpeg4-rc: ENCOPTS = -b 400k -bf 2
+
+fate-vsynth%-mpeg4-adv: ENCOPTS = -qscale 9 -flags +mv4+aic \
+ -data_partitioning 1 -trellis 1 \
+ -mbd bits -ps 200
+
+fate-vsynth%-mpeg4-qprd: ENCOPTS = -b 450k -bf 2 -trellis 1 \
+ -flags +mv4+mv0 -mpv_flags +qp_rd \
+ -cmp 2 -subcmp 2 -mbd rd
+
+fate-vsynth%-mpeg4-adap: ENCOPTS = -b 550k -bf 2 -flags +mv4+mv0 \
+ -trellis 1 -cmp 1 -subcmp 2 \
+ -mbd rd -scplx_mask 0.3
+
+fate-vsynth%-mpeg4-qpel: ENCOPTS = -qscale 7 -flags +mv4+qpel -mbd 2 \
+ -bf 2 -cmp 1 -subcmp 2
+
+fate-vsynth%-mpeg4-thread: ENCOPTS = -b 500k -flags +mv4+aic \
+ -data_partitioning 1 -trellis 1 \
+ -mbd bits -ps 200 -bf 2 \
+ -threads 2 -slices 2
+
+fate-vsynth%-mpeg4-error: ENCOPTS = -qscale 7 -flags +mv4+aic \
+ -data_partitioning 1 -mbd rd \
+ -ps 250 -error 10
+
+fate-vsynth%-mpeg4-nr: ENCOPTS = -qscale 8 -flags +mv4 -mbd rd -nr 200
+
+FATE_VCODEC-$(call ENCDEC, MSMPEG4V3, AVI) += msmpeg4
+fate-vsynth%-msmpeg4: ENCOPTS = -qscale 10
+
+FATE_VCODEC-$(call ENCDEC, MSMPEG4V2, AVI) += msmpeg4v2
+fate-vsynth%-msmpeg4v2: ENCOPTS = -qscale 10
+
+FATE_VCODEC-$(call ENCDEC, PRORES, MOV) += prores
+fate-vsynth%-prores: ENCOPTS = -profile hq
+fate-vsynth%-prores: FMT = mov
+
+FATE_VCODEC-$(call ENCDEC, QTRLE, MOV) += qtrle
+fate-vsynth%-qtrle: FMT = mov
+
+FATE_VCODEC-$(call ENCDEC, RAWVIDEO, AVI) += rgb
+fate-vsynth%-rgb: CODEC = rawvideo
+fate-vsynth%-rgb: ENCOPTS = -pix_fmt bgr24
+
+FATE_VCODEC-$(call ENCDEC, ROQ, ROQ) += roqvideo
+fate-vsynth%-roqvideo: CODEC = roqvideo
+fate-vsynth%-roqvideo: ENCOPTS = -frames 5
+fate-vsynth%-roqvideo: FMT = roq
+
+FATE_VCODEC-$(call ENCDEC, RV10, RM) += rv10
+fate-vsynth%-rv10: ENCOPTS = -qscale 10
+fate-vsynth%-rv10: FMT = rm
+
+FATE_VCODEC-$(call ENCDEC, RV20, RM) += rv20
+fate-vsynth%-rv20: ENCOPTS = -qscale 10
+fate-vsynth%-rv20: FMT = rm
+
+FATE_VCODEC-$(call ENCDEC, SNOW, AVI) += snow snow-hpel snow-ll
+fate-vsynth%-snow: ENCOPTS = -strict -2 -qscale 2 -flags +qpel \
+ -me_method iter -dia_size 2 \
+ -cmp 12 -subcmp 12 -s 128x64
+
+fate-vsynth%-snow-hpel: ENCOPTS = -strict -2 -qscale 2 \
+ -me_method iter -dia_size 2 \
+ -cmp 12 -subcmp 12 -s 128x64
+
+fate-vsynth%-snow-ll: ENCOPTS = -strict -2 -qscale .001 -pred 1 \
+ -flags +mv4+qpel
+
+FATE_VCODEC-$(call ENCDEC, SVQ1, MOV) += svq1
+fate-vsynth%-svq1: ENCOPTS = -qscale 3 -pix_fmt yuv410p
+fate-vsynth%-svq1: FMT = mov
+
+FATE_VCODEC-$(call ENCDEC, V210, AVI) += v210
+
+FATE_VCODEC-$(call ENCDEC, WMV1, AVI) += wmv1
+fate-vsynth%-wmv1: ENCOPTS = -qscale 10
+
+FATE_VCODEC-$(call ENCDEC, WMV2, AVI) += wmv2
+fate-vsynth%-wmv2: ENCOPTS = -qscale 10
+
+FATE_VCODEC-$(call ENCDEC, RAWVIDEO, AVI) += yuv
+fate-vsynth%-yuv: CODEC = rawvideo
+
+FATE_VCODEC += $(FATE_VCODEC-yes)
+FATE_VSYNTH1 = $(FATE_VCODEC:%=fate-vsynth1-%)
+FATE_VSYNTH2 = $(FATE_VCODEC:%=fate-vsynth2-%)
+
+$(FATE_VSYNTH1): tests/data/vsynth1.yuv
+$(FATE_VSYNTH2): tests/data/vsynth2.yuv
+
+FATE_AVCONV += $(FATE_VSYNTH1) $(FATE_VSYNTH2)
+
+fate-vsynth1: $(FATE_VSYNTH1)
+fate-vsynth2: $(FATE_VSYNTH2)
+fate-vcodec: fate-vsynth1 fate-vsynth2
diff --git a/gst-libs/ext/libav/tests/fate/video.mak b/gst-libs/ext/libav/tests/fate/video.mak
index c90661e..51315df 100644
--- a/gst-libs/ext/libav/tests/fate/video.mak
+++ b/gst-libs/ext/libav/tests/fate/video.mak
@@ -4,96 +4,114 @@ fate-4xm-1: CMD = framecrc -i $(SAMPLES)/4xm/version1.4xm -pix_fmt rgb24 -an
FATE_4XM += fate-4xm-2
fate-4xm-2: CMD = framecrc -i $(SAMPLES)/4xm/version2.4xm -pix_fmt rgb24 -an
-FATE_TESTS += $(FATE_4XM)
+FATE_SAMPLES_AVCONV-$(call DEMDEC, FOURXM, FOURXM) += $(FATE_4XM)
fate-4xm: $(FATE_4XM)
-FATE_TESTS += fate-aasc
+FATE_SAMPLES_AVCONV-$(call DEMDEC, AVI, AASC) += fate-aasc
fate-aasc: CMD = framecrc -i $(SAMPLES)/aasc/AASC-1.5MB.AVI -pix_fmt rgb24
-FATE_TESTS += fate-alg-mm
+FATE_SAMPLES_AVCONV-$(call DEMDEC, MM, MMVIDEO) += fate-alg-mm
fate-alg-mm: CMD = framecrc -i $(SAMPLES)/alg-mm/ibmlogo.mm -an -pix_fmt rgb24
-FATE_TESTS += fate-amv
-fate-amv: CMD = framecrc -idct simple -i $(SAMPLES)/amv/MTV_high_res_320x240_sample_Penguin_Joke_MTV_from_WMV.amv -t 10
+FATE_SAMPLES_AVCONV-$(call DEMDEC, AVI, AMV) += fate-amv
+fate-amv: CMD = framecrc -idct simple -i $(SAMPLES)/amv/MTV_high_res_320x240_sample_Penguin_Joke_MTV_from_WMV.amv -t 10 -an
-FATE_TESTS += fate-ansi
+FATE_SAMPLES_AVCONV-$(call DEMDEC, TTY, ANSI) += fate-ansi
fate-ansi: CMD = framecrc -chars_per_frame 44100 -i $(SAMPLES)/ansi/TRE-IOM5.ANS -pix_fmt rgb24
-FATE_TESTS += fate-armovie-escape124
+FATE_SAMPLES_AVCONV-$(call DEMDEC, RPL, ESCAPE124) += fate-armovie-escape124
fate-armovie-escape124: CMD = framecrc -i $(SAMPLES)/rpl/ESCAPE.RPL -pix_fmt rgb24
-FATE_TESTS += fate-auravision-v1
+FATE_SAMPLES_AVCONV-$(call DEMDEC, AVI, AURA) += fate-auravision-v1
fate-auravision-v1: CMD = framecrc -i $(SAMPLES)/auravision/SOUVIDEO.AVI -an
-FATE_TESTS += fate-auravision-v2
+FATE_SAMPLES_AVCONV-$(call DEMDEC, AVI, AURA2) += fate-auravision-v2
fate-auravision-v2: CMD = framecrc -i $(SAMPLES)/auravision/salma-hayek-in-ugly-betty-partial-avi -an
-FATE_TESTS += fate-bethsoft-vid
-fate-bethsoft-vid: CMD = framecrc -i $(SAMPLES)/bethsoft-vid/ANIM0001.VID -vsync 0 -t 5 -pix_fmt rgb24
+FATE_SAMPLES_AVCONV-$(call DEMDEC, BETHSOFTVID, BETHSOFTVID) += fate-bethsoft-vid
+fate-bethsoft-vid: CMD = framecrc -i $(SAMPLES)/bethsoft-vid/ANIM0001.VID -t 5 -pix_fmt rgb24
-FATE_TESTS += fate-bfi
+FATE_SAMPLES_AVCONV-$(call DEMDEC, BFI, BFI) += fate-bfi
fate-bfi: CMD = framecrc -i $(SAMPLES)/bfi/2287.bfi -pix_fmt rgb24
-FATE_TESTS += fate-bink-video
-fate-bink-video: CMD = framecrc -i $(SAMPLES)/bink/hol2br.bik
+FATE_BINK_VIDEO += fate-bink-video-b
+fate-bink-video-b: CMD = framecrc -i $(SAMPLES)/bink/RISE.BIK -frames 30
-FATE_TESTS += fate-cdgraphics
+FATE_BINK_VIDEO += fate-bink-video-f
+fate-bink-video-f: CMD = framecrc -i $(SAMPLES)/bink/hol2br.bik
+
+FATE_BINK_VIDEO += fate-bink-video-i
+fate-bink-video-i: CMD = framecrc -i $(SAMPLES)/bink/RazOnBull.bik -an
+
+FATE_SAMPLES_AVCONV-$(call DEMDEC, BINK, BINK) += $(FATE_BINK_VIDEO)
+fate-bink-video: $(FATE_BINK_VIDEO)
+
+FATE_SAMPLES_AVCONV-$(call DEMDEC, BMV, BMV_VIDEO) += fate-bmv-video
+fate-bmv-video: CMD = framecrc -i $(SAMPLES)/bmv/SURFING-partial.BMV -pix_fmt rgb24 -an
+
+FATE_SAMPLES_AVCONV-$(call DEMDEC, MPEGPS, CAVS) += fate-cavs
+fate-cavs: CMD = framecrc -i $(SAMPLES)/cavs/cavs.mpg -an
+
+FATE_SAMPLES_AVCONV-$(call DEMDEC, CDG, CDGRAPHICS) += fate-cdgraphics
fate-cdgraphics: CMD = framecrc -i $(SAMPLES)/cdgraphics/BrotherJohn.cdg -pix_fmt rgb24 -t 1
-FATE_TESTS += fate-cljr
+FATE_SAMPLES_AVCONV-$(call DEMDEC, AVI, CLJR) += fate-cljr
fate-cljr: CMD = framecrc -i $(SAMPLES)/cljr/testcljr-partial.avi
-FATE_TESTS += fate-corepng
+FATE_SAMPLES_AVCONV-$(call DEMDEC, AVI, PNG) += fate-corepng
fate-corepng: CMD = framecrc -i $(SAMPLES)/png1/corepng-partial.avi
-FATE_TESTS += fate-creatureshock-avs
+FATE_SAMPLES_AVCONV-$(call DEMDEC, AVS, AVS) += fate-creatureshock-avs
fate-creatureshock-avs: CMD = framecrc -i $(SAMPLES)/creatureshock-avs/OUTATIME.AVS -pix_fmt rgb24
-FATE_CVID += fate-cvid-partial
+FATE_CVID-$(CONFIG_AVI_DEMUXER) += fate-cvid-partial
fate-cvid-partial: CMD = framecrc -i $(SAMPLES)/cvid/laracroft-cinepak-partial.avi -an
-FATE_CVID += fate-cvid-palette
+FATE_CVID-$(CONFIG_MOV_DEMUXER) += fate-cvid-palette
fate-cvid-palette: CMD = framecrc -i $(SAMPLES)/cvid/catfight-cvid-pal8-partial.mov -pix_fmt rgb24 -an
-FATE_CVID += fate-cvid-grayscale
+FATE_CVID-$(CONFIG_AVI_DEMUXER) += fate-cvid-grayscale
fate-cvid-grayscale: CMD = framecrc -i $(SAMPLES)/cvid/pcitva15.avi -an
-FATE_TESTS += $(FATE_CVID)
-fate-cvid: $(FATE_CVID)
+FATE_SAMPLES_AVCONV-$(CONFIG_CINEPAK_DECODER) += $(FATE_CVID-yes)
+fate-cvid: $(FATE_CVID-yes)
-FATE_TESTS += fate-cyberia-c93
+FATE_SAMPLES_AVCONV-$(call DEMDEC, C93, C93) += fate-cyberia-c93
fate-cyberia-c93: CMD = framecrc -i $(SAMPLES)/cyberia-c93/intro1.c93 -t 3 -pix_fmt rgb24
-FATE_TESTS += fate-cyuv
+FATE_SAMPLES_AVCONV-$(call DEMDEC, AVI, CYUV) += fate-cyuv
fate-cyuv: CMD = framecrc -i $(SAMPLES)/cyuv/cyuv.avi
-FATE_TESTS += fate-delphine-cin
-fate-delphine-cin: CMD = framecrc -i $(SAMPLES)/delphine-cin/LOGO-partial.CIN -pix_fmt rgb24 -vsync 0
+FATE_SAMPLES_AVCONV-$(call DEMDEC, DSICIN, DSICINVIDEO) += fate-delphine-cin-video
+fate-delphine-cin-video: CMD = framecrc -i $(SAMPLES)/delphine-cin/LOGO-partial.CIN -pix_fmt rgb24 -an
-FATE_TESTS += fate-deluxepaint-anm
+FATE_SAMPLES_AVCONV-$(call DEMDEC, ANM, ANM) += fate-deluxepaint-anm
fate-deluxepaint-anm: CMD = framecrc -i $(SAMPLES)/deluxepaint-anm/INTRO1.ANM -pix_fmt rgb24
FATE_TRUEMOTION1 += fate-truemotion1-15
-fate-truemotion1-15: CMD = framecrc -i $(SAMPLES)/duck/phant2-940.duk -pix_fmt rgb24
+fate-truemotion1-15: CMD = framecrc -i $(SAMPLES)/duck/phant2-940.duk -pix_fmt rgb24 -an
FATE_TRUEMOTION1 += fate-truemotion1-24
-fate-truemotion1-24: CMD = framecrc -i $(SAMPLES)/duck/sonic3dblast_intro-partial.avi -pix_fmt rgb24
+fate-truemotion1-24: CMD = framecrc -i $(SAMPLES)/duck/sonic3dblast_intro-partial.avi -pix_fmt rgb24 -an
-FATE_TESTS += $(FATE_TRUEMOTION1)
+FATE_SAMPLES_AVCONV-$(call DEMDEC, AVI, TRUEMOTION1) += $(FATE_TRUEMOTION1)
fate-truemotion1: $(FATE_TRUEMOTION1)
-FATE_TESTS += fate-truemotion2
+FATE_SAMPLES_AVCONV-$(call DEMDEC, AVI, TRUEMOTION2) += fate-truemotion2
fate-truemotion2: CMD = framecrc -i $(SAMPLES)/duck/tm20.avi
FATE_DXA += fate-dxa-feeble
-fate-dxa-feeble: CMD = framecrc -i $(SAMPLES)/dxa/meetsquid.dxa -t 2 -pix_fmt rgb24
+fate-dxa-feeble: CMD = framecrc -i $(SAMPLES)/dxa/meetsquid.dxa -t 2 -pix_fmt rgb24 -an
FATE_DXA += fate-dxa-scummvm
fate-dxa-scummvm: CMD = framecrc -i $(SAMPLES)/dxa/scummvm.dxa -pix_fmt rgb24
-FATE_TESTS += $(FATE_DXA)
+FATE_SAMPLES_AVCONV-$(call DEMDEC, DXA, DXA) += $(FATE_DXA)
fate-dxa: $(FATE_DXA)
+FATE_SAMPLES_AVCONV-$(call DEMDEC, SEGAFILM, CINEPAK) += fate-film-cvid
+fate-film-cvid: CMD = framecrc -i $(SAMPLES)/film/logo-capcom.cpk -an
+
FATE_FLIC += fate-flic-af11-palette-change
fate-flic-af11-palette-change: CMD = framecrc -i $(SAMPLES)/fli/fli-engines.fli -t 3.3 -pix_fmt rgb24
@@ -103,73 +121,104 @@ fate-flic-af12: CMD = framecrc -i $(SAMPLES)/fli/jj00c2.fli -pix_fmt rgb24
FATE_FLIC += fate-flic-magiccarpet
fate-flic-magiccarpet: CMD = framecrc -i $(SAMPLES)/fli/intel.dat -pix_fmt rgb24
-FATE_TESTS += $(FATE_FLIC)
+FATE_SAMPLES_AVCONV-$(call DEMDEC, FLIC, FLIC) += $(FATE_FLIC)
fate-flic: $(FATE_FLIC)
-FATE_TESTS += fate-frwu
+FATE_SAMPLES_AVCONV-$(call DEMDEC, AVI, FRWU) += fate-frwu
fate-frwu: CMD = framecrc -i $(SAMPLES)/frwu/frwu.avi
-FATE_TESTS += fate-id-cin-video
+FATE_SAMPLES_AVCONV-$(call DEMDEC, IDCIN, IDCIN) += fate-id-cin-video
fate-id-cin-video: CMD = framecrc -i $(SAMPLES)/idcin/idlog-2MB.cin -pix_fmt rgb24
-FATE_TESTS-$(CONFIG_AVFILTER) += fate-idroq-video-encode
-fate-idroq-video-encode: CMD = md5 -f image2 -vcodec pgmyuv -i $(SAMPLES)/ffmpeg-synthetic/vsynth1/%02d.pgm -sws_flags +bitexact -vf pad=512:512:80:112 -f RoQ -t 0.2
+FATE_SAMPLES_AVCONV-$(call ENCDEC, ROQ PGMYUV, ROQ IMAGE2) += fate-idroq-video-encode
+fate-idroq-video-encode: CMD = md5 -f image2 -vcodec pgmyuv -i $(SAMPLES)/ffmpeg-synthetic/vsynth1/%02d.pgm -sws_flags +bitexact -vf pad=512:512:80:112 -f roq -t 0.2
-FATE_IFF += fate-iff-byterun1
+FATE_IFF-$(CONFIG_IFF_BYTERUN1_DECODER) += fate-iff-byterun1
fate-iff-byterun1: CMD = framecrc -i $(SAMPLES)/iff/ASH.LBM -pix_fmt rgb24
-FATE_IFF += fate-iff-fibonacci
+FATE_IFF-$(CONFIG_EIGHTSVX_FIB_DECODER) += fate-iff-fibonacci
fate-iff-fibonacci: CMD = md5 -i $(SAMPLES)/iff/dasboot-in-compressed -f s16le
-FATE_IFF += fate-iff-ilbm
+FATE_IFF-$(CONFIG_IFF_ILBM_DECODER) += fate-iff-ilbm
fate-iff-ilbm: CMD = framecrc -i $(SAMPLES)/iff/lms-matriks.ilbm -pix_fmt rgb24
-FATE_TESTS += $(FATE_IFF)
-fate-iff: $(FATE_IFF)
+FATE_SAMPLES_AVCONV-$(CONFIG_IFF_DEMUXER) += $(FATE_IFF-yes)
+fate-iff: $(FATE_IFF-yes)
+
+FATE_SAMPLES_AVCONV-$(call DEMDEC, IPMOVIE, INTERPLAY_VIDEO) += fate-interplay-mve-8bit
+fate-interplay-mve-8bit: CMD = framecrc -i $(SAMPLES)/interplay-mve/interplay-logo-2MB.mve -pix_fmt rgb24 -an
+
+FATE_SAMPLES_AVCONV-$(call DEMDEC, IPMOVIE, INTERPLAY_VIDEO) += fate-interplay-mve-16bit
+fate-interplay-mve-16bit: CMD = framecrc -i $(SAMPLES)/interplay-mve/descent3-level5-16bit-partial.mve -pix_fmt rgb24 -an
-FATE_TESTS += fate-kmvc
+FATE_SAMPLES_AVCONV-$(call DEMDEC, AVI, KGV1) += fate-kgv1
+fate-kgv1: CMD = framecrc -i $(SAMPLES)/kega/kgv1.avi -pix_fmt rgb555le -an
+
+FATE_SAMPLES_AVCONV-$(call DEMDEC, AVI, KMVC) += fate-kmvc
fate-kmvc: CMD = framecrc -i $(SAMPLES)/KMVC/LOGO1.AVI -an -t 3 -pix_fmt rgb24
-FATE_TESTS += fate-mimic
-fate-mimic: CMD = framecrc -idct simple -i $(SAMPLES)/mimic/mimic2-womanloveffmpeg.cam -vsync 0
+FATE_SAMPLES_AVCONV-$(call DEMDEC, EA, MDEC) += fate-mdec
+fate-mdec: CMD = framecrc -idct simple -i $(SAMPLES)/ea-dct/NFS2Esprit-partial.dct -an
+
+FATE_SAMPLES_AVCONV-$(call DEMDEC, STR, MDEC) += fate-mdec-v3
+fate-mdec-v3: CMD = framecrc -idct simple -i $(SAMPLES)/psx-str/abc000_cut.str -an
-FATE_TESTS += fate-mjpegb
+FATE_SAMPLES_AVCONV-$(call DEMDEC, MSNWC_TCP, MIMIC) += fate-mimic
+fate-mimic: CMD = framecrc -idct simple -i $(SAMPLES)/mimic/mimic2-womanloveffmpeg.cam
+
+FATE_SAMPLES_AVCONV-$(call DEMDEC, MOV, MJPEGB) += fate-mjpegb
fate-mjpegb: CMD = framecrc -idct simple -flags +bitexact -i $(SAMPLES)/mjpegb/mjpegb_part.mov -an
-FATE_TESTS += fate-motionpixels
+FATE_SAMPLES_AVCONV-$(call DEMDEC, MVI, MOTIONPIXELS) += fate-motionpixels
fate-motionpixels: CMD = framecrc -i $(SAMPLES)/motion-pixels/INTRO-partial.MVI -an -pix_fmt rgb24 -vframes 111
-FATE_TESTS += fate-mpeg2-field-enc
+FATE_SAMPLES_AVCONV-$(call DEMDEC, MPEGTS, MPEG2VIDEO) += fate-mpeg2-field-enc
fate-mpeg2-field-enc: CMD = framecrc -flags +bitexact -dct fastint -idct simple -i $(SAMPLES)/mpeg2/mpeg2_field_encoding.ts -an
-FATE_TESTS += fate-nuv
-fate-nuv: CMD = framecrc -idct simple -i $(SAMPLES)/nuv/Today.nuv -vsync 0
+# FIXME dropped frames in this test because of coarse timebase
+FATE_NUV += fate-nuv-rtjpeg
+fate-nuv-rtjpeg: CMD = framecrc -idct simple -i $(SAMPLES)/nuv/Today.nuv -an
+
+FATE_NUV += fate-nuv-rtjpeg-fh
+fate-nuv-rtjpeg-fh: CMD = framecrc -idct simple -i $(SAMPLES)/nuv/rtjpeg_frameheader.nuv -an
-FATE_TESTS += fate-qpeg
+FATE_SAMPLES_AVCONV-$(call DEMDEC, NUV, NUV) += $(FATE_NUV)
+fate-nuv: $(FATE_NUV)
+
+FATE_SAMPLES_AVCONV-$(call DEMDEC, AVI, QPEG) += fate-qpeg
fate-qpeg: CMD = framecrc -i $(SAMPLES)/qpeg/Clock.avi -an -pix_fmt rgb24
-FATE_TESTS += fate-r210
+FATE_SAMPLES_AVCONV-$(call DEMDEC, AVI, R210) += fate-r210
fate-r210: CMD = framecrc -i $(SAMPLES)/r210/r210.avi -pix_fmt rgb48le
-FATE_TESTS += fate-rl2
-fate-rl2: CMD = framecrc -i $(SAMPLES)/rl2/Z4915300.RL2 -pix_fmt rgb24 -an -vsync 0
+FATE_SAMPLES_AVCONV-$(call DEMDEC, RL2, RL2) += fate-rl2
+fate-rl2: CMD = framecrc -i $(SAMPLES)/rl2/Z4915300.RL2 -pix_fmt rgb24 -an
+
+FATE_SAMPLES_AVCONV-$(call DEMDEC, ROQ, ROQ) += fate-roqvideo
+fate-roqvideo: CMD = framecrc -i $(SAMPLES)/idroq/idlogo.roq -an
-FATE_TESTS += fate-smacker
-fate-smacker: CMD = framecrc -i $(SAMPLES)/smacker/wetlogo.smk -pix_fmt rgb24
+FATE_SAMPLES_AVCONV-$(call DEMDEC, VMD, VMDVIDEO) += fate-sierra-vmd-video
+fate-sierra-vmd-video: CMD = framecrc -i $(SAMPLES)/vmd/12.vmd -pix_fmt rgb24 -an
-FATE_TESTS += fate-smc
-fate-smc: CMD = framecrc -i $(SAMPLES)/smc/cass_schi.qt -vsync 0 -pix_fmt rgb24
+FATE_SAMPLES_AVCONV-$(call DEMDEC, SMACKER, SMACKER) += fate-smacker-video
+fate-smacker-video: CMD = framecrc -i $(SAMPLES)/smacker/wetlogo.smk -pix_fmt rgb24 -an
-FATE_TESTS += fate-sp5x
+FATE_SAMPLES_AVCONV-$(call DEMDEC, MOV, SMC) += fate-smc
+fate-smc: CMD = framecrc -i $(SAMPLES)/smc/cass_schi.qt -pix_fmt rgb24
+
+FATE_SAMPLES_AVCONV-$(call DEMDEC, AVI, SP5X) += fate-sp5x
fate-sp5x: CMD = framecrc -idct simple -i $(SAMPLES)/sp5x/sp5x_problem.avi
-FATE_TESTS += fate-sub-srt
+FATE_SAMPLES_AVCONV-$(call DEMDEC, SRT, SRT) += fate-sub-srt
fate-sub-srt: CMD = md5 -i $(SAMPLES)/sub/SubRip_capability_tester.srt -f ass
-FATE_TESTS += fate-tiertex-seq
+FATE_SAMPLES_AVCONV-$(call DEMDEC, THP, THP) += fate-thp
+fate-thp: CMD = framecrc -idct simple -i $(SAMPLES)/thp/pikmin2-opening1-partial.thp -an
+
+FATE_SAMPLES_AVCONV-$(call DEMDEC, TIERTEXSEQ, TIERTEXSEQVIDEO) += fate-tiertex-seq
fate-tiertex-seq: CMD = framecrc -i $(SAMPLES)/tiertex-seq/Gameover.seq -pix_fmt rgb24
-FATE_TESTS += fate-tmv
+FATE_SAMPLES_AVCONV-$(call DEMDEC, TMV, TMV) += fate-tmv
fate-tmv: CMD = framecrc -i $(SAMPLES)/tmv/pop-partial.tmv -pix_fmt rgb24
FATE_TXD += fate-txd-16bpp
@@ -178,39 +227,39 @@ fate-txd-16bpp: CMD = framecrc -i $(SAMPLES)/txd/misc.txd -pix_fmt bgra -an
FATE_TXD += fate-txd-pal8
fate-txd-pal8: CMD = framecrc -i $(SAMPLES)/txd/outro.txd -pix_fmt rgb24 -an
-FATE_TESTS += $(FATE_TXD)
+FATE_SAMPLES_AVCONV-$(call DEMDEC, TXD, TXD) += $(FATE_TXD)
fate-txd: $(FATE_TXD)
-FATE_TESTS += fate-ulti
+FATE_SAMPLES_AVCONV-$(call DEMDEC, AVI, ULTI) += fate-ulti
fate-ulti: CMD = framecrc -i $(SAMPLES)/ulti/hit12w.avi -an
-FATE_TESTS += fate-v210
+FATE_SAMPLES_AVCONV-$(call DEMDEC, AVI, V210) += fate-v210
fate-v210: CMD = framecrc -i $(SAMPLES)/v210/v210_720p-partial.avi -pix_fmt yuv422p16be -an
-FATE_TESTS += fate-v410dec
+FATE_SAMPLES_AVCONV-$(call DEMDEC, MOV, V410) += fate-v410dec
fate-v410dec: CMD = framecrc -i $(SAMPLES)/v410/lenav410.mov -pix_fmt yuv444p10le
-FATE_TESTS += fate-v410enc
+FATE_SAMPLES_AVCONV-$(call ENCDEC, V410 PGMYUV, AVI IMAGE2) += fate-v410enc
fate-v410enc: tests/vsynth1/00.pgm
fate-v410enc: CMD = md5 -f image2 -vcodec pgmyuv -i $(TARGET_PATH)/tests/vsynth1/%02d.pgm -flags +bitexact -vcodec v410 -f avi
-FATE_TESTS += fate-vcr1
+FATE_SAMPLES_AVCONV-$(call DEMDEC, AVI, VCR1) += fate-vcr1
fate-vcr1: CMD = framecrc -i $(SAMPLES)/vcr1/VCR1test.avi -an
-FATE_TESTS += fate-videoxl
+FATE_SAMPLES_AVCONV-$(call DEMDEC, AVI, XL) += fate-videoxl
fate-videoxl: CMD = framecrc -i $(SAMPLES)/vixl/pig-vixl.avi
-FATE_TESTS += fate-vqa-cc
-fate-vqa-cc: CMD = framecrc -i $(SAMPLES)/vqa/cc-demo1-partial.vqa -pix_fmt rgb24
+FATE_SAMPLES_AVCONV-$(call DEMDEC, WSVQA, VQA) += fate-vqa-cc
+fate-vqa-cc: CMD = framecrc -i $(SAMPLES)/vqa/cc-demo1-partial.vqa -pix_fmt rgb24 -an
-FATE_TESTS += fate-wc3movie-xan
+FATE_SAMPLES_AVCONV-$(call DEMDEC, WC3, XAN_WC3) += fate-wc3movie-xan
fate-wc3movie-xan: CMD = framecrc -i $(SAMPLES)/wc3movie/SC_32-part.MVE -pix_fmt rgb24
-FATE_TESTS += fate-wnv1
+FATE_SAMPLES_AVCONV-$(call DEMDEC, AVI, WNV1) += fate-wnv1
fate-wnv1: CMD = framecrc -i $(SAMPLES)/wnv1/wnv1-codec.avi -an
-FATE_TESTS += fate-yop
+FATE_SAMPLES_AVCONV-$(call DEMDEC, YOP, YOP) += fate-yop
fate-yop: CMD = framecrc -i $(SAMPLES)/yop/test1.yop -pix_fmt rgb24 -an
-FATE_TESTS += fate-xxan-wc4
+FATE_SAMPLES_AVCONV-$(call DEMDEC, AVI, XAN_WC4) += fate-xxan-wc4
fate-xxan-wc4: CMD = framecrc -i $(SAMPLES)/wc4-xan/wc4trailer-partial.avi -an
diff --git a/gst-libs/ext/libav/tests/fate/voice.mak b/gst-libs/ext/libav/tests/fate/voice.mak
index 834b0ff..8fe445a 100644
--- a/gst-libs/ext/libav/tests/fate/voice.mak
+++ b/gst-libs/ext/libav/tests/fate/voice.mak
@@ -1,9 +1,58 @@
-FATE_TESTS += fate-g722dec-1
+FATE_G722 += fate-g722dec-1
fate-g722dec-1: CMD = framecrc -i $(SAMPLES)/g722/conf-adminmenu-162.g722
-FATE_TESTS += fate-g722enc
-fate-g722enc: tests/data/asynth-16000-1.sw
-fate-g722enc: CMD = md5 -ar 16000 -ac 1 -f s16le -i $(TARGET_PATH)/tests/data/asynth-16000-1.sw -acodec g722 -ac 1 -f g722
+FATE_G722 += fate-g722-encode
+fate-g722-encode: tests/data/asynth-16000-1.wav
+fate-g722-encode: SRC = tests/data/asynth-16000-1.wav
+fate-g722-encode: CMD = enc_dec_pcm wav md5 s16le $(SRC) -c:a g722
+
+FATE_SAMPLES_AVCONV += $(FATE_G722)
+fate-g722: $(FATE_G722)
+
+FATE_G723_1 += fate-g723_1-dec-1
+fate-g723_1-dec-1: CMD = framecrc -postfilter 0 -i $(SAMPLES)/g723_1/ineqd53.tco
+
+FATE_G723_1 += fate-g723_1-dec-2
+fate-g723_1-dec-2: CMD = framecrc -postfilter 0 -i $(SAMPLES)/g723_1/overd53.tco
+
+FATE_G723_1 += fate-g723_1-dec-3
+fate-g723_1-dec-3: CMD = framecrc -postfilter 1 -i $(SAMPLES)/g723_1/overd63p.tco
+
+FATE_G723_1 += fate-g723_1-dec-4
+fate-g723_1-dec-4: CMD = framecrc -postfilter 0 -i $(SAMPLES)/g723_1/pathd53.tco
+
+FATE_G723_1 += fate-g723_1-dec-5
+fate-g723_1-dec-5: CMD = framecrc -postfilter 1 -i $(SAMPLES)/g723_1/pathd63p.tco
+
+FATE_G723_1 += fate-g723_1-dec-6
+fate-g723_1-dec-6: CMD = framecrc -postfilter 1 -i $(SAMPLES)/g723_1/tamed63p.tco
+
+FATE_G723_1 += fate-g723_1-dec-7
+fate-g723_1-dec-7: CMD = framecrc -postfilter 1 -i $(SAMPLES)/g723_1/dtx63b.tco
+
+FATE_G723_1 += fate-g723_1-dec-8
+fate-g723_1-dec-8: CMD = framecrc -postfilter 1 -i $(SAMPLES)/g723_1/dtx63e.tco
+
+FATE_SAMPLES_AVCONV += $(FATE_G723_1)
+fate-g723_1: $(FATE_G723_1)
+
+FATE_G726 += fate-g726-encode-2bit
+fate-g726-encode-2bit: CMD = enc_dec_pcm wav md5 s16le $(SRC) -c:a g726 -b:a 16k
+
+FATE_G726 += fate-g726-encode-3bit
+fate-g726-encode-3bit: CMD = enc_dec_pcm wav md5 s16le $(SRC) -c:a g726 -b:a 24k
+
+FATE_G726 += fate-g726-encode-4bit
+fate-g726-encode-4bit: CMD = enc_dec_pcm wav md5 s16le $(SRC) -c:a g726 -b:a 32k
+
+FATE_G726 += fate-g726-encode-5bit
+fate-g726-encode-5bit: CMD = enc_dec_pcm wav md5 s16le $(SRC) -c:a g726 -b:a 40k
+
+$(FATE_G726): tests/data/asynth-8000-1.wav
+$(FATE_G726): SRC = tests/data/asynth-8000-1.wav
+
+FATE_SAMPLES_AVCONV += $(FATE_G726)
+fate-g726: $(FATE_G726)
FATE_GSM += fate-gsm-ms
fate-gsm-ms: CMD = framecrc -i $(SAMPLES)/gsm/ciao.wav
@@ -11,15 +60,15 @@ fate-gsm-ms: CMD = framecrc -i $(SAMPLES)/gsm/ciao.wav
FATE_GSM += fate-gsm-toast
fate-gsm-toast: CMD = framecrc -i $(SAMPLES)/gsm/sample-gsm-8000.mov -t 10
-FATE_TESTS += $(FATE_GSM)
+FATE_SAMPLES_AVCONV += $(FATE_GSM)
fate-gsm: $(FATE_GSM)
-FATE_TESTS += fate-qcelp
+FATE_SAMPLES_AVCONV += fate-qcelp
fate-qcelp: CMD = pcm -i $(SAMPLES)/qcp/0036580847.QCP
fate-qcelp: CMP = oneoff
fate-qcelp: REF = $(SAMPLES)/qcp/0036580847.pcm
-FATE_TESTS += fate-truespeech
+FATE_SAMPLES_AVCONV += fate-truespeech
fate-truespeech: CMD = pcm -i $(SAMPLES)/truespeech/a6.wav
fate-truespeech: CMP = oneoff
fate-truespeech: REF = $(SAMPLES)/truespeech/a6.pcm
diff --git a/gst-libs/ext/libav/tests/fate/vorbis.mak b/gst-libs/ext/libav/tests/fate/vorbis.mak
index 5452b74..39a9724 100644
--- a/gst-libs/ext/libav/tests/fate/vorbis.mak
+++ b/gst-libs/ext/libav/tests/fate/vorbis.mak
@@ -49,6 +49,7 @@ fate-vorbis-12: REF = $(SAMPLES)/vorbis/mono_small.pcm
FATE_VORBIS += fate-vorbis-13
fate-vorbis-13: CMD = pcm -i $(SAMPLES)/vorbis/moog_small.ogg
fate-vorbis-13: REF = $(SAMPLES)/vorbis/moog_small.pcm
+fate-vorbis-13: FUZZ = 2
FATE_VORBIS += fate-vorbis-14
fate-vorbis-14: CMD = pcm -i $(SAMPLES)/vorbis/rc1-test_small.ogg
@@ -75,6 +76,10 @@ FATE_VORBIS += fate-vorbis-19
fate-vorbis-19: CMD = pcm -i $(SAMPLES)/vorbis/test-short2_small.ogg
fate-vorbis-19: REF = $(SAMPLES)/vorbis/test-short2_small.pcm
-FATE_TESTS += $(FATE_VORBIS)
+FATE_VORBIS += fate-vorbis-20
+fate-vorbis-20: CMD = pcm -i $(SAMPLES)/vorbis/6.ogg
+fate-vorbis-20: REF = $(SAMPLES)/vorbis/6.pcm
+
+FATE_SAMPLES_AVCONV-$(call DEMDEC, OGG, VORBIS) += $(FATE_VORBIS)
fate-vorbis: $(FATE_VORBIS)
$(FATE_VORBIS): CMP = oneoff
diff --git a/gst-libs/ext/libav/tests/fate/vpx.mak b/gst-libs/ext/libav/tests/fate/vpx.mak
index f55771e..a870ea5 100644
--- a/gst-libs/ext/libav/tests/fate/vpx.mak
+++ b/gst-libs/ext/libav/tests/fate/vpx.mak
@@ -1,31 +1,34 @@
-FATE_TESTS += fate-ea-vp60
-fate-ea-vp60: CMD = framecrc -i $(SAMPLES)/ea-vp6/g36.vp6
-
-FATE_TESTS += fate-ea-vp61
-fate-ea-vp61: CMD = framecrc -i $(SAMPLES)/ea-vp6/MovieSkirmishGondor.vp6 -t 4
-
-FATE_VP3 += fate-vp31
+FATE_VP3-$(CONFIG_AVI_DEMUXER) += fate-vp31
fate-vp31: CMD = framecrc -i $(SAMPLES)/vp3/vp31.avi
-FATE_VP3 += fate-vp3-coeff-level64
+FATE_VP3-$(CONFIG_MATROSKA_DEMUXER) += fate-vp3-coeff-level64
fate-vp3-coeff-level64: CMD = framecrc -i $(SAMPLES)/vp3/coeff_level64.mkv
-FATE_TESTS += $(FATE_VP3)
-fate-vp3: $(FATE_VP3)
+FATE_SAMPLES_AVCONV-$(CONFIG_VP3_DECODER) += $(FATE_VP3-yes)
+fate-vp3: $(FATE_VP3-yes)
-FATE_TESTS += fate-vp5
+FATE_SAMPLES_AVCONV-$(call DEMDEC, AVI, VP5) += fate-vp5
fate-vp5: CMD = framecrc -i $(SAMPLES)/vp5/potter512-400-partial.avi -an
-FATE_TESTS += fate-vp6a
+FATE_VP6-$(call DEMDEC, EA, VP6) += fate-vp60
+fate-vp60: CMD = framecrc -i $(SAMPLES)/ea-vp6/g36.vp6
+
+FATE_VP6-$(call DEMDEC, EA, VP6) += fate-vp61
+fate-vp61: CMD = framecrc -i $(SAMPLES)/ea-vp6/MovieSkirmishGondor.vp6 -t 4
+
+FATE_VP6-$(call DEMDEC, FLV, VP6A) += fate-vp6a
fate-vp6a: CMD = framecrc -i $(SAMPLES)/flash-vp6/300x180-Scr-f8-056alpha.flv
-FATE_TESTS += fate-vp6f
+FATE_VP6-$(call DEMDEC, FLV, VP6F) += fate-vp6f
fate-vp6f: CMD = framecrc -i $(SAMPLES)/flash-vp6/clip1024.flv
+FATE_SAMPLES_AVCONV += $(FATE_VP6-yes)
+fate-vp6: $(FATE_VP6-yes)
+
VP8_SUITE = 001 002 003 004 005 006 007 008 009 010 011 012 013 014 015 016 017
define FATE_VP8_SUITE
-FATE_VP8 += fate-vp8-test-vector$(2)-$(1)
+FATE_VP8-$(CONFIG_IVF_DEMUXER) += fate-vp8-test-vector$(2)-$(1)
fate-vp8-test-vector$(2)-$(1): CMD = framemd5 $(3) -i $(SAMPLES)/vp8-test-vectors-r1/vp80-00-comprehensive-$(1).ivf
fate-vp8-test-vector$(2)-$(1): REF = $(SRC_PATH)/tests/ref/fate/vp8-test-vector-$(1)
endef
@@ -33,12 +36,18 @@ endef
define FATE_VP8_FULL
$(foreach N,$(VP8_SUITE),$(eval $(call FATE_VP8_SUITE,$(N),$(1),$(2))))
-FATE_VP8 += fate-vp8-sign-bias$(1)
-fate-vp8-sign-bias$(1): CMD = framemd5 $(2) -i $(SAMPLES)/vp8/sintel-signbias.ivf -vsync 0
+# FIXME this file contains two frames with identical timestamps,
+# so avconv drops one of them
+FATE_VP8-$(CONFIG_IVF_DEMUXER) += fate-vp8-sign-bias$(1)
+fate-vp8-sign-bias$(1): CMD = framemd5 $(2) -i $(SAMPLES)/vp8/sintel-signbias.ivf
fate-vp8-sign-bias$(1): REF = $(SRC_PATH)/tests/ref/fate/vp8-sign-bias
+
+FATE_VP8-$(CONFIG_MATROSKA_DEMUXER) += fate-vp8-size-change$(1)
+fate-vp8-size-change$(1): CMD = framemd5 $(2) -i $(SAMPLES)/vp8/frame_size_change.webm -frames:v 30
+fate-vp8-size-change$(1): REF = $(SRC_PATH)/tests/ref/fate/vp8-size-change
endef
$(eval $(call FATE_VP8_FULL))
-$(eval $(call FATE_VP8_FULL,-emu-edge,-flags emu_edge))
-FATE_TESTS += $(FATE_VP8)
-fate-vp8: $(FATE_VP8)
+$(eval $(call FATE_VP8_FULL,-emu-edge,-flags +emu_edge))
+FATE_SAMPLES_AVCONV-$(CONFIG_VP8_DECODER) += $(FATE_VP8-yes)
+fate-vp8: $(FATE_VP8-yes)
diff --git a/gst-libs/ext/libav/tests/fate/vqf.mak b/gst-libs/ext/libav/tests/fate/vqf.mak
index 846b140..6256941 100644
--- a/gst-libs/ext/libav/tests/fate/vqf.mak
+++ b/gst-libs/ext/libav/tests/fate/vqf.mak
@@ -1,7 +1,7 @@
-FATE_TESTS += fate-twinvq
+FATE_SAMPLES_AVCONV-$(call DEMDEC, VQF, TWINVQ) += fate-twinvq
fate-twinvq: CMD = pcm -i $(SAMPLES)/vqf/achterba.vqf
fate-twinvq: CMP = oneoff
fate-twinvq: REF = $(SAMPLES)/vqf/achterba.pcm
-FATE_TESTS += fate-vqf-demux
+FATE_SAMPLES_AVCONV-$(CONFIG_VQF_DEMUXER) += fate-vqf-demux
fate-vqf-demux: CMD = md5 -i $(SAMPLES)/vqf/achterba.vqf -acodec copy -f framecrc
diff --git a/gst-libs/ext/libav/tests/fate/wavpack.mak b/gst-libs/ext/libav/tests/fate/wavpack.mak
new file mode 100644
index 0000000..ef190fa
--- /dev/null
+++ b/gst-libs/ext/libav/tests/fate/wavpack.mak
@@ -0,0 +1,92 @@
+# lossless
+
+FATE_WAVPACK += fate-wavpack-lossless-float
+fate-wavpack-lossless-float: CMD = md5 -i $(SAMPLES)/wavpack/lossless/32bit_float-partial.wv -f f32le
+
+FATE_WAVPACK += fate-wavpack-lossless-8bit
+fate-wavpack-lossless-8bit: CMD = md5 -i $(SAMPLES)/wavpack/lossless/8bit-partial.wv -f s8
+
+FATE_WAVPACK += fate-wavpack-lossless-12bit
+fate-wavpack-lossless-12bit: CMD = md5 -i $(SAMPLES)/wavpack/lossless/12bit-partial.wv -f s16le
+
+FATE_WAVPACK += fate-wavpack-lossless-16bit
+fate-wavpack-lossless-16bit: CMD = md5 -i $(SAMPLES)/wavpack/lossless/16bit-partial.wv -f s16le
+
+FATE_WAVPACK += fate-wavpack-lossless-24bit
+fate-wavpack-lossless-24bit: CMD = md5 -i $(SAMPLES)/wavpack/lossless/24bit-partial.wv -f s24le
+
+FATE_WAVPACK += fate-wavpack-lossless-32bit
+fate-wavpack-lossless-32bit: CMD = md5 -i $(SAMPLES)/wavpack/lossless/32bit_int-partial.wv -f s32le
+
+# lossy
+
+FATE_WAVPACK += fate-wavpack-lossy-float
+fate-wavpack-lossy-float: CMD = md5 -i $(SAMPLES)/wavpack/lossy/2.0_32-bit_float.wv -f f32le
+
+FATE_WAVPACK += fate-wavpack-lossy-8bit
+fate-wavpack-lossy-8bit: CMD = md5 -i $(SAMPLES)/wavpack/lossy/4.0_8-bit.wv -f s8
+
+FATE_WAVPACK += fate-wavpack-lossy-16bit
+fate-wavpack-lossy-16bit: CMD = md5 -i $(SAMPLES)/wavpack/lossy/4.0_16-bit.wv -f s16le
+
+FATE_WAVPACK += fate-wavpack-lossy-24bit
+fate-wavpack-lossy-24bit: CMD = md5 -i $(SAMPLES)/wavpack/lossy/4.0_24-bit.wv -f s24le
+
+FATE_WAVPACK += fate-wavpack-lossy-32bit
+fate-wavpack-lossy-32bit: CMD = md5 -i $(SAMPLES)/wavpack/lossy/4.0_32-bit_int.wv -f s32le
+
+# channel configurations
+
+FATE_WAVPACK += fate-wavpack-channels-monofloat
+fate-wavpack-channels-monofloat: CMD = md5 -i $(SAMPLES)/wavpack/num_channels/mono_float-partial.wv -f f32le
+
+FATE_WAVPACK += fate-wavpack-channels-monoint
+fate-wavpack-channels-monoint: CMD = md5 -i $(SAMPLES)/wavpack/num_channels/mono_16bit_int.wv -f s16le
+
+FATE_WAVPACK += fate-wavpack-channels-4.0
+fate-wavpack-channels-4.0: CMD = md5 -i $(SAMPLES)/wavpack/num_channels/edward_4.0_16bit-partial.wv -f s16le
+
+FATE_WAVPACK += fate-wavpack-channels-5.1
+fate-wavpack-channels-5.1: CMD = md5 -i $(SAMPLES)/wavpack/num_channels/panslab_sample_5.1_16bit-partial.wv -f s16le
+
+FATE_WAVPACK += fate-wavpack-channels-6.1
+fate-wavpack-channels-6.1: CMD = md5 -i $(SAMPLES)/wavpack/num_channels/eva_2.22_6.1_16bit-partial.wv -f s16le
+
+FATE_WAVPACK += fate-wavpack-channels-7.1
+fate-wavpack-channels-7.1: CMD = md5 -i $(SAMPLES)/wavpack/num_channels/panslab_sample_7.1_16bit-partial.wv -f s16le
+
+# speed modes
+
+FATE_WAVPACK += fate-wavpack-speed-default
+fate-wavpack-speed-default: CMD = md5 -i $(SAMPLES)/wavpack/speed_modes/default-partial.wv -f s16le
+
+FATE_WAVPACK += fate-wavpack-speed-fast
+fate-wavpack-speed-fast: CMD = md5 -i $(SAMPLES)/wavpack/speed_modes/fast-partial.wv -f s16le
+
+FATE_WAVPACK += fate-wavpack-speed-high
+fate-wavpack-speed-high: CMD = md5 -i $(SAMPLES)/wavpack/speed_modes/high-partial.wv -f s16le
+
+FATE_WAVPACK += fate-wavpack-speed-vhigh
+fate-wavpack-speed-vhigh: CMD = md5 -i $(SAMPLES)/wavpack/speed_modes/vhigh-partial.wv -f s16le
+
+# special cases
+
+FATE_WAVPACK += fate-wavpack-cuesheet
+fate-wavpack-cuesheet: CMD = md5 -i $(SAMPLES)/wavpack/special/cue_sheet.wv -f s16le
+
+FATE_WAVPACK += fate-wavpack-zerolsbs
+fate-wavpack-zerolsbs: CMD = md5 -i $(SAMPLES)/wavpack/special/zero_lsbs.wv -f s16le
+
+FATE_WAVPACK += fate-wavpack-clipping
+fate-wavpack-clipping: CMD = md5 -i $(SAMPLES)/wavpack/special/clipping.wv -f s16le
+
+FATE_WAVPACK += fate-wavpack-falsestereo
+fate-wavpack-falsestereo: CMD = md5 -i $(SAMPLES)/wavpack/special/false_stereo.wv -f s16le
+
+FATE_WAVPACK-$(call DEMDEC, WV, WAVPACK) += $(FATE_WAVPACK)
+
+FATE_WAVPACK-$(call DEMDEC, MATROSKA, WAVPACK) += fate-wavpack-matroskamode
+fate-wavpack-matroskamode: CMD = md5 -i $(SAMPLES)/wavpack/special/matroska_mode.mka -f s16le
+
+FATE_SAMPLES_AVCONV += $(FATE_WAVPACK-yes)
+fate-wavpack: $(FATE_WAVPACK-yes)
diff --git a/gst-libs/ext/libav/tests/fate/wma.mak b/gst-libs/ext/libav/tests/fate/wma.mak
index 3d849ea..b9a856c 100644
--- a/gst-libs/ext/libav/tests/fate/wma.mak
+++ b/gst-libs/ext/libav/tests/fate/wma.mak
@@ -1,38 +1,54 @@
-FATE_WMAPRO += fate-wmapro-2ch
+FATE_WMAPRO-$(call DEMDEC, ASF, WMAPRO) += fate-wmapro-2ch
fate-wmapro-2ch: CMD = pcm -i $(SAMPLES)/wmapro/Beethovens_9th-1_small.wma
-fate-wmapro-2ch: CMP = oneoff
fate-wmapro-2ch: REF = $(SAMPLES)/wmapro/Beethovens_9th-1_small.pcm
-FATE_WMAPRO += fate-wmapro-5.1
+FATE_WMAPRO-$(call DEMDEC, ASF, WMAPRO) += fate-wmapro-5.1
fate-wmapro-5.1: CMD = pcm -i $(SAMPLES)/wmapro/latin_192_mulitchannel_cut.wma
-fate-wmapro-5.1: CMP = oneoff
fate-wmapro-5.1: REF = $(SAMPLES)/wmapro/latin_192_mulitchannel_cut.pcm
-FATE_WMAPRO += fate-wmapro-ism
+FATE_WMAPRO-$(call DEMDEC, MOV, WMAPRO) += fate-wmapro-ism
fate-wmapro-ism: CMD = pcm -i $(SAMPLES)/isom/vc1-wmapro.ism -vn
-fate-wmapro-ism: CMP = oneoff
fate-wmapro-ism: REF = $(SAMPLES)/isom/vc1-wmapro.pcm
-FATE_TESTS += $(FATE_WMAPRO)
-fate-wmapro: $(FATE_WMAPRO)
+$(FATE_WMAPRO-yes): CMP = oneoff
-FATE_WMAVOICE += fate-wmavoice-7k
+FATE_SAMPLES_AVCONV += $(FATE_WMAPRO-yes)
+fate-wmapro: $(FATE_WMAPRO-yes)
+
+FATE_WMAVOICE-$(call DEMDEC, ASF, WMAVOICE) += fate-wmavoice-7k
fate-wmavoice-7k: CMD = pcm -i $(SAMPLES)/wmavoice/streaming_CBR-7K.wma
-fate-wmavoice-7k: CMP = stddev
fate-wmavoice-7k: REF = $(SAMPLES)/wmavoice/streaming_CBR-7K.pcm
fate-wmavoice-7k: FUZZ = 3
-FATE_WMAVOICE += fate-wmavoice-11k
+FATE_WMAVOICE-$(call DEMDEC, ASF, WMAVOICE) += fate-wmavoice-11k
fate-wmavoice-11k: CMD = pcm -i $(SAMPLES)/wmavoice/streaming_CBR-11K.wma
-fate-wmavoice-11k: CMP = stddev
fate-wmavoice-11k: REF = $(SAMPLES)/wmavoice/streaming_CBR-11K.pcm
fate-wmavoice-11k: FUZZ = 3
-FATE_WMAVOICE += fate-wmavoice-19k
+FATE_WMAVOICE-$(call DEMDEC, ASF, WMAVOICE) += fate-wmavoice-19k
fate-wmavoice-19k: CMD = pcm -i $(SAMPLES)/wmavoice/streaming_CBR-19K.wma
-fate-wmavoice-19k: CMP = stddev
fate-wmavoice-19k: REF = $(SAMPLES)/wmavoice/streaming_CBR-19K.pcm
fate-wmavoice-19k: FUZZ = 3
-FATE_TESTS += $(FATE_WMAVOICE)
-fate-wmavoice: $(FATE_WMAVOICE)
+$(FATE_WMAVOICE-yes): CMP = stddev
+
+FATE_SAMPLES_AVCONV += $(FATE_WMAVOICE-yes)
+fate-wmavoice: $(FATE_WMAVOICE-yes)
+
+FATE_WMA_ENCODE-$(call ENCDEC, WMAV1, ASF) += fate-wmav1-encode
+fate-wmav1-encode: CMD = enc_dec_pcm asf wav s16le $(REF) -c:a wmav1 -b:a 128k
+fate-wmav1-encode: CMP_SHIFT = -8192
+fate-wmav1-encode: CMP_TARGET = 291.06
+fate-wmav1-encode: SIZE_TOLERANCE = 4632
+
+FATE_WMA_ENCODE-$(call ENCDEC, WMAV2, ASF) += fate-wmav2-encode
+fate-wmav2-encode: CMD = enc_dec_pcm asf wav s16le $(REF) -c:a wmav2 -b:a 128k
+fate-wmav2-encode: CMP_SHIFT = -8192
+fate-wmav2-encode: CMP_TARGET = 258.32
+fate-wmav2-encode: SIZE_TOLERANCE = 4632
+
+$(FATE_WMA_ENCODE-yes): CMP = stddev
+$(FATE_WMA_ENCODE-yes): REF = $(SAMPLES)/audio-reference/luckynight_2ch_44kHz_s16.wav
+
+FATE_SAMPLES_AVCONV += $(FATE_WMA_ENCODE-yes)
+fate-wma-encode: $(FATE_WMA_ENCODE-yes)
diff --git a/gst-libs/ext/libav/tests/lavf-regression.sh b/gst-libs/ext/libav/tests/lavf-regression.sh
index 4a72e0a..a198306 100755
--- a/gst-libs/ext/libav/tests/lavf-regression.sh
+++ b/gst-libs/ext/libav/tests/lavf-regression.sh
@@ -14,8 +14,8 @@ eval do_$test=y
do_lavf()
{
file=${outfile}lavf.$1
- do_avconv $file $DEC_OPTS -f image2 -vcodec pgmyuv -i $raw_src $DEC_OPTS -ar 44100 -f s16le -i $pcm_src $ENC_OPTS -b:a 64k -t 1 -qscale:v 10 $2
- do_avconv_crc $file $DEC_OPTS -i $target_path/$file $3
+ do_avconv $file $DEC_OPTS -f image2 -vcodec pgmyuv -i $raw_src $DEC_OPTS -ar 44100 -f s16le $2 -i $pcm_src $ENC_OPTS -b:a 64k -t 1 -qscale:v 10 $3
+ do_avconv_crc $file $DEC_OPTS -i $target_path/$file $4
}
do_streamed_images()
@@ -33,7 +33,7 @@ do_image_formats()
run_avconv $DEC_OPTS -f image2 -vcodec pgmyuv -i $raw_src $2 $ENC_OPTS $3 -t 0.5 -y -qscale 10 $target_path/$file
do_md5sum ${outfile}02.$1
do_avconv_crc $file $DEC_OPTS $3 -i $target_path/$file
- wc -c ${outfile}02.$1
+ echo $(wc -c ${outfile}02.$1)
}
do_audio_only()
@@ -44,11 +44,11 @@ do_audio_only()
}
if [ -n "$do_avi" ] ; then
-do_lavf avi "-acodec mp2"
+do_lavf avi "" "-acodec mp2"
fi
if [ -n "$do_asf" ] ; then
-do_lavf asf "-acodec mp2" "-r 25"
+do_lavf asf "" "-acodec mp2" "-r 25"
fi
if [ -n "$do_rm" ] ; then
@@ -63,19 +63,19 @@ do_lavf mpg
fi
if [ -n "$do_mxf" ] ; then
-do_lavf mxf "-ar 48000 -bf 2 -timecode_frame_start 264363"
+do_lavf mxf "-ar 48000" "-bf 2 -timecode_frame_start 264363"
fi
if [ -n "$do_mxf_d10" ]; then
-do_lavf mxf_d10 "-ar 48000 -ac 2 -r 25 -s 720x576 -vf pad=720:608:0:32 -vcodec mpeg2video -g 0 -flags +ildct+low_delay -dc 10 -flags2 +ivlc+non_linear_q -qscale 1 -ps 1 -qmin 1 -rc_max_vbv_use 1 -rc_min_vbv_use 1 -pix_fmt yuv422p -minrate 30000k -maxrate 30000k -b 30000k -bufsize 1200000 -top 1 -rc_init_occupancy 1200000 -qmax 12 -f mxf_d10"
+do_lavf mxf_d10 "-ar 48000 -ac 2" "-r 25 -vf scale=720:576,pad=720:608:0:32 -vcodec mpeg2video -g 0 -flags +ildct+low_delay -dc 10 -non_linear_quant 1 -intra_vlc 1 -qscale 1 -ps 1 -qmin 1 -rc_max_vbv_use 1 -rc_min_vbv_use 1 -pix_fmt yuv422p -minrate 30000k -maxrate 30000k -b 30000k -bufsize 1200000 -top 1 -rc_init_occupancy 1200000 -qmax 12 -f mxf_d10"
fi
if [ -n "$do_ts" ] ; then
-do_lavf ts "-mpegts_transport_stream_id 42"
+do_lavf ts "" "-mpegts_transport_stream_id 42"
fi
if [ -n "$do_swf" ] ; then
-do_lavf swf -an
+do_lavf swf "" "-an"
fi
if [ -n "$do_ffm" ] ; then
@@ -83,27 +83,27 @@ do_lavf ffm
fi
if [ -n "$do_flv_fmt" ] ; then
-do_lavf flv -an
+do_lavf flv "" "-an"
fi
if [ -n "$do_mov" ] ; then
-do_lavf mov "-acodec pcm_alaw -c:v mpeg4"
+do_lavf mov "" "-acodec pcm_alaw -c:v mpeg4"
fi
if [ -n "$do_dv_fmt" ] ; then
-do_lavf dv "-ar 48000 -r 25 -s pal -ac 2"
+do_lavf dv "-ar 48000 -channel_layout stereo" "-r 25 -s pal"
fi
if [ -n "$do_gxf" ] ; then
-do_lavf gxf "-ar 48000 -r 25 -s pal -ac 1"
+do_lavf gxf "-ar 48000" "-r 25 -s pal -ac 1"
fi
if [ -n "$do_nut" ] ; then
-do_lavf nut "-acodec mp2"
+do_lavf nut "" "-acodec mp2"
fi
if [ -n "$do_mkv" ] ; then
-do_lavf mkv "-c:a mp2 -c:v mpeg4"
+do_lavf mkv "" "-c:a mp2 -c:v mpeg4"
fi
@@ -171,10 +171,26 @@ if [ -n "$do_jpg" ] ; then
do_image_formats jpg "-pix_fmt yuvj420p" "-f image2"
fi
+if [ -n "$do_pam" ] ; then
+do_image_formats pam
+fi
+
if [ -n "$do_pcx" ] ; then
do_image_formats pcx
fi
+if [ -n "$do_xwd" ] ; then
+do_image_formats xwd
+fi
+
+if [ -n "$do_dpx" ] ; then
+do_image_formats dpx
+fi
+
+if [ -n "$do_sunrast" ] ; then
+do_image_formats sun
+fi
+
# audio only
if [ -n "$do_wav" ] ; then
@@ -217,6 +233,10 @@ if [ -n "$do_rso" ] ; then
do_audio_only rso
fi
+if [ -n "$do_sox" ] ; then
+do_audio_only sox
+fi
+
# pix_fmt conversions
if [ -n "$do_pixfmt" ] ; then
diff --git a/gst-libs/ext/libav/tests/lavfi-regression.sh b/gst-libs/ext/libav/tests/lavfi-regression.sh
index f8c0c4e..fc7c153 100755
--- a/gst-libs/ext/libav/tests/lavfi-regression.sh
+++ b/gst-libs/ext/libav/tests/lavfi-regression.sh
@@ -21,10 +21,8 @@ do_video_filter() {
}
do_lavfi() {
- vfilters="slicify=random,$2"
-
if [ $test = $1 ] ; then
- do_video_filter $test "$vfilters"
+ do_video_filter $test "$2"
fi
}
@@ -44,17 +42,17 @@ do_lavfi_pixfmts(){
filter=$1
filter_args=$2
- showfiltfmts="$target_exec $target_path/tools/lavfi-showfiltfmts"
+ showfiltfmts="$target_exec $target_path/libavfilter/filtfmts-test"
exclude_fmts=${outfile}${1}_exclude_fmts
out_fmts=${outfile}${1}_out_fmts
# exclude pixel formats which are not supported as input
- $avconv -pix_fmts list 2>/dev/null | sed -ne '9,$p' | grep '^\..\.' | cut -d' ' -f2 | sort >$exclude_fmts
+ $avconv -pix_fmts list 2>/dev/null | awk 'NR > 8 && /^\..\./ { print $2 }' | sort >$exclude_fmts
$showfiltfmts scale | awk -F '[ \r]' '/^OUTPUT/{ print $3 }' | sort | comm -23 - $exclude_fmts >$out_fmts
pix_fmts=$($showfiltfmts $filter | awk -F '[ \r]' '/^INPUT/{ print $3 }' | sort | comm -12 - $out_fmts)
for pix_fmt in $pix_fmts; do
- do_video_filter $pix_fmt "slicify=random,format=$pix_fmt,$filter=$filter_args" -pix_fmt $pix_fmt
+ do_video_filter $pix_fmt "format=$pix_fmt,$filter=$filter_args" -pix_fmt $pix_fmt
done
rm $exclude_fmts $out_fmts
@@ -70,9 +68,9 @@ do_lavfi_pixfmts "scale" "200:100"
do_lavfi_pixfmts "vflip" ""
if [ -n "$do_pixdesc" ]; then
- pix_fmts="$($avconv -pix_fmts list 2>/dev/null | sed -ne '9,$p' | grep '^IO' | cut -d' ' -f2 | sort)"
+ pix_fmts="$($avconv -pix_fmts list 2>/dev/null | awk 'NR > 8 && /^IO/ { print $2 }' | sort)"
for pix_fmt in $pix_fmts; do
- do_video_filter $pix_fmt "slicify=random,format=$pix_fmt,pixdesctest" -pix_fmt $pix_fmt
+ do_video_filter $pix_fmt "format=$pix_fmt,pixdesctest" -pix_fmt $pix_fmt
done
fi
diff --git a/gst-libs/ext/libav/tests/md5.sh b/gst-libs/ext/libav/tests/md5.sh
index 16b0281..0b382b1 100644
--- a/gst-libs/ext/libav/tests/md5.sh
+++ b/gst-libs/ext/libav/tests/md5.sh
@@ -1,9 +1,9 @@
# try to find an md5 program
-if [ X"$(echo | md5sum 2> /dev/null)" != X ]; then
+if [ X"$(echo | md5sum -b 2> /dev/null)" != X ]; then
do_md5sum() { md5sum -b $1; }
-elif [ X"$(echo | md5 2> /dev/null)" != X ]; then
- do_md5sum() { md5 $1 | sed 's#MD5 (\(.*\)) = \(.*\)#\2 *\1#'; }
+elif [ X"$(echo | command md5 2> /dev/null)" != X ]; then
+ do_md5sum() { command md5 $1 | sed 's#MD5 (\(.*\)) = \(.*\)#\2 *\1#'; }
elif [ -x /sbin/md5 ]; then
do_md5sum() { /sbin/md5 -r $1 | sed 's# \**\./# *./#'; }
elif openssl version >/dev/null 2>&1; then
diff --git a/gst-libs/ext/libav/tests/ref/acodec/ac3_fixed b/gst-libs/ext/libav/tests/ref/acodec/ac3_fixed
deleted file mode 100644
index dba2dfc..0000000
--- a/gst-libs/ext/libav/tests/ref/acodec/ac3_fixed
+++ /dev/null
@@ -1,2 +0,0 @@
-e7fa185030a56d9db8663ad9e38c6c94 *./tests/data/acodec/ac3.rm
-98751 ./tests/data/acodec/ac3.rm
diff --git a/gst-libs/ext/libav/tests/ref/acodec/adpcm-adx b/gst-libs/ext/libav/tests/ref/acodec/adpcm-adx
new file mode 100644
index 0000000..2bc49ab
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/acodec/adpcm-adx
@@ -0,0 +1,4 @@
+0a30509d9296b857e134b762b76dbc31 *tests/data/fate/acodec-adpcm-adx.adx
+297720 tests/data/fate/acodec-adpcm-adx.adx
+2dbc601ed5259f4d74dc48ccd8da7eaf *tests/data/fate/acodec-adpcm-adx.out.wav
+stddev: 6989.46 PSNR: 19.44 MAXDIFF:65398 bytes: 1058400/ 1058432
diff --git a/gst-libs/ext/libav/tests/ref/acodec/adpcm-ima_qt b/gst-libs/ext/libav/tests/ref/acodec/adpcm-ima_qt
new file mode 100644
index 0000000..8001527
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/acodec/adpcm-ima_qt
@@ -0,0 +1,4 @@
+23cbae1182e150ebf28e0abfb9cba127 *tests/data/fate/acodec-adpcm-ima_qt.aiff
+281252 tests/data/fate/acodec-adpcm-ima_qt.aiff
+b0fafd002c38fb70acaddfda1a31ed61 *tests/data/fate/acodec-adpcm-ima_qt.out.wav
+stddev: 904.76 PSNR: 37.20 MAXDIFF:34029 bytes: 1058400/ 1058560
diff --git a/gst-libs/ext/libav/tests/ref/acodec/adpcm-ima_wav b/gst-libs/ext/libav/tests/ref/acodec/adpcm-ima_wav
new file mode 100644
index 0000000..6d83fd5
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/acodec/adpcm-ima_wav
@@ -0,0 +1,4 @@
+56b75c3a6dacedcf2ce7b0586aa33594 *tests/data/fate/acodec-adpcm-ima_wav.wav
+267324 tests/data/fate/acodec-adpcm-ima_wav.wav
+ddddfa47302da540abf19224202bef57 *tests/data/fate/acodec-adpcm-ima_wav.out.wav
+stddev: 903.51 PSNR: 37.21 MAXDIFF:34026 bytes: 1058400/ 1061748
diff --git a/gst-libs/ext/libav/tests/ref/acodec/adpcm-ms b/gst-libs/ext/libav/tests/ref/acodec/adpcm-ms
new file mode 100644
index 0000000..eb8515d
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/acodec/adpcm-ms
@@ -0,0 +1,4 @@
+a407b87daeef5b25dfb6c5b3f519e9c1 *tests/data/fate/acodec-adpcm-ms.wav
+268378 tests/data/fate/acodec-adpcm-ms.wav
+22863fb278c4e0ebe9c34cb15db5dd6b *tests/data/fate/acodec-adpcm-ms.out.wav
+stddev: 1050.01 PSNR: 35.91 MAXDIFF:29806 bytes: 1058400/ 1060576
diff --git a/gst-libs/ext/libav/tests/ref/acodec/adpcm-swf b/gst-libs/ext/libav/tests/ref/acodec/adpcm-swf
new file mode 100644
index 0000000..fddb771
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/acodec/adpcm-swf
@@ -0,0 +1,4 @@
+42d4639866ed4d692eaf126228a4fa2a *tests/data/fate/acodec-adpcm-swf.flv
+269166 tests/data/fate/acodec-adpcm-swf.flv
+f7df69d3fe708303820f2a9d00140a5b *tests/data/fate/acodec-adpcm-swf.out.wav
+stddev: 933.58 PSNR: 36.93 MAXDIFF:51119 bytes: 1058400/ 1064960
diff --git a/gst-libs/ext/libav/tests/ref/acodec/adpcm-yamaha b/gst-libs/ext/libav/tests/ref/acodec/adpcm-yamaha
new file mode 100644
index 0000000..da60f44
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/acodec/adpcm-yamaha
@@ -0,0 +1,4 @@
+e9c14f701d25947317db9367b9dc772d *tests/data/fate/acodec-adpcm-yamaha.wav
+265274 tests/data/fate/acodec-adpcm-yamaha.wav
+1488b5974fa040a65f0d407fc0224c6a *tests/data/fate/acodec-adpcm-yamaha.out.wav
+stddev: 1247.60 PSNR: 34.41 MAXDIFF:39895 bytes: 1058400/ 1060864
diff --git a/gst-libs/ext/libav/tests/ref/acodec/adpcm_adx b/gst-libs/ext/libav/tests/ref/acodec/adpcm_adx
deleted file mode 100644
index 8d86698..0000000
--- a/gst-libs/ext/libav/tests/ref/acodec/adpcm_adx
+++ /dev/null
@@ -1,4 +0,0 @@
-0a30509d9296b857e134b762b76dbc31 *./tests/data/acodec/adpcm_adx.adx
-297720 ./tests/data/acodec/adpcm_adx.adx
-2dbc601ed5259f4d74dc48ccd8da7eaf *./tests/data/adpcm_adx.acodec.out.wav
-stddev: 6989.46 PSNR: 19.44 MAXDIFF:65398 bytes: 1058432/ 1058400
diff --git a/gst-libs/ext/libav/tests/ref/acodec/adpcm_ima_qt b/gst-libs/ext/libav/tests/ref/acodec/adpcm_ima_qt
deleted file mode 100644
index c1db43f..0000000
--- a/gst-libs/ext/libav/tests/ref/acodec/adpcm_ima_qt
+++ /dev/null
@@ -1,4 +0,0 @@
-057d27978b35888776512e4e9669a63b *./tests/data/acodec/adpcm_qt.aiff
-281252 ./tests/data/acodec/adpcm_qt.aiff
-169c40435c68d50112c9c61fc67e446d *./tests/data/adpcm_ima_qt.acodec.out.wav
-stddev: 918.61 PSNR: 37.07 MAXDIFF:34029 bytes: 1058560/ 1058400
diff --git a/gst-libs/ext/libav/tests/ref/acodec/adpcm_ima_wav b/gst-libs/ext/libav/tests/ref/acodec/adpcm_ima_wav
deleted file mode 100644
index f83dbad..0000000
--- a/gst-libs/ext/libav/tests/ref/acodec/adpcm_ima_wav
+++ /dev/null
@@ -1,4 +0,0 @@
-56b75c3a6dacedcf2ce7b0586aa33594 *./tests/data/acodec/adpcm_ima.wav
-267324 ./tests/data/acodec/adpcm_ima.wav
-ddddfa47302da540abf19224202bef57 *./tests/data/adpcm_ima_wav.acodec.out.wav
-stddev: 903.51 PSNR: 37.21 MAXDIFF:34026 bytes: 1061748/ 1058400
diff --git a/gst-libs/ext/libav/tests/ref/acodec/adpcm_ms b/gst-libs/ext/libav/tests/ref/acodec/adpcm_ms
deleted file mode 100644
index 301bc80..0000000
--- a/gst-libs/ext/libav/tests/ref/acodec/adpcm_ms
+++ /dev/null
@@ -1,4 +0,0 @@
-a407b87daeef5b25dfb6c5b3f519e9c1 *./tests/data/acodec/adpcm_ms.wav
-268378 ./tests/data/acodec/adpcm_ms.wav
-22863fb278c4e0ebe9c34cb15db5dd6b *./tests/data/adpcm_ms.acodec.out.wav
-stddev: 1050.01 PSNR: 35.91 MAXDIFF:29806 bytes: 1060576/ 1058400
diff --git a/gst-libs/ext/libav/tests/ref/acodec/adpcm_swf b/gst-libs/ext/libav/tests/ref/acodec/adpcm_swf
deleted file mode 100644
index 5306dc4..0000000
--- a/gst-libs/ext/libav/tests/ref/acodec/adpcm_swf
+++ /dev/null
@@ -1,4 +0,0 @@
-42d4639866ed4d692eaf126228a4fa2a *./tests/data/acodec/adpcm_swf.flv
-269166 ./tests/data/acodec/adpcm_swf.flv
-f7df69d3fe708303820f2a9d00140a5b *./tests/data/adpcm_swf.acodec.out.wav
-stddev: 933.58 PSNR: 36.93 MAXDIFF:51119 bytes: 1064960/ 1058400
diff --git a/gst-libs/ext/libav/tests/ref/acodec/adpcm_yam b/gst-libs/ext/libav/tests/ref/acodec/adpcm_yam
deleted file mode 100644
index 0fd7029..0000000
--- a/gst-libs/ext/libav/tests/ref/acodec/adpcm_yam
+++ /dev/null
@@ -1,4 +0,0 @@
-006f8dc92eb4f7bab82eded314ca1124 *./tests/data/acodec/adpcm_yam.wav
-266298 ./tests/data/acodec/adpcm_yam.wav
-c36a9d5a1e0ad57fbe9665a31373b7c1 *./tests/data/adpcm_yam.acodec.out.wav
-stddev: 1247.60 PSNR: 34.41 MAXDIFF:39895 bytes: 1064960/ 1058400
diff --git a/gst-libs/ext/libav/tests/ref/acodec/alac b/gst-libs/ext/libav/tests/ref/acodec/alac
index cef12d0..bb7a202 100644
--- a/gst-libs/ext/libav/tests/ref/acodec/alac
+++ b/gst-libs/ext/libav/tests/ref/acodec/alac
@@ -1,4 +1,4 @@
-db1806d9ffd85c168c2c71a28e6d9229 *./tests/data/acodec/alac.m4a
-389410 ./tests/data/acodec/alac.m4a
-64151e4bcc2b717aa5a8454d424d6a1f *./tests/data/alac.acodec.out.wav
+8ad790d3a0bbda81cd23c15ab8ba760d *tests/data/fate/acodec-alac.mov
+389258 tests/data/fate/acodec-alac.mov
+64151e4bcc2b717aa5a8454d424d6a1f *tests/data/fate/acodec-alac.out.wav
stddev: 0.00 PSNR:999.99 MAXDIFF: 0 bytes: 1058400/ 1058400
diff --git a/gst-libs/ext/libav/tests/ref/acodec/aref b/gst-libs/ext/libav/tests/ref/acodec/aref
deleted file mode 100644
index cd89a63..0000000
--- a/gst-libs/ext/libav/tests/ref/acodec/aref
+++ /dev/null
@@ -1,2 +0,0 @@
-64151e4bcc2b717aa5a8454d424d6a1f *./tests/data/acodec.ref.wav
-1058446 ./tests/data/acodec.ref.wav
diff --git a/gst-libs/ext/libav/tests/ref/acodec/flac b/gst-libs/ext/libav/tests/ref/acodec/flac
index cc5c173..3ef32c2 100644
--- a/gst-libs/ext/libav/tests/ref/acodec/flac
+++ b/gst-libs/ext/libav/tests/ref/acodec/flac
@@ -1,4 +1,4 @@
-f582b59cc68adfcb3342dcfd7e020b71 *./tests/data/acodec/flac.flac
-361581 ./tests/data/acodec/flac.flac
-64151e4bcc2b717aa5a8454d424d6a1f *./tests/data/flac.acodec.out.wav
+f582b59cc68adfcb3342dcfd7e020b71 *tests/data/fate/acodec-flac.flac
+361581 tests/data/fate/acodec-flac.flac
+64151e4bcc2b717aa5a8454d424d6a1f *tests/data/fate/acodec-flac.out.wav
stddev: 0.00 PSNR:999.99 MAXDIFF: 0 bytes: 1058400/ 1058400
diff --git a/gst-libs/ext/libav/tests/ref/acodec/g722 b/gst-libs/ext/libav/tests/ref/acodec/g722
deleted file mode 100644
index 0e2f7e7..0000000
--- a/gst-libs/ext/libav/tests/ref/acodec/g722
+++ /dev/null
@@ -1,4 +0,0 @@
-7b0492eee76b04b710990235f97a0bf2 *./tests/data/acodec/g722.wav
- 48053 ./tests/data/acodec/g722.wav
-b5568e0e3930ff563824156e8e1015f0 *./tests/data/g722.acodec.out.wav
-stddev: 8939.44 PSNR: 17.30 MAXDIFF:40370 bytes: 191980/ 1058400
diff --git a/gst-libs/ext/libav/tests/ref/acodec/g726 b/gst-libs/ext/libav/tests/ref/acodec/g726
deleted file mode 100644
index 9abed4b..0000000
--- a/gst-libs/ext/libav/tests/ref/acodec/g726
+++ /dev/null
@@ -1,4 +0,0 @@
-64bfac75bd371304b704be5b3dbcd04a *./tests/data/acodec/g726.wav
-24054 ./tests/data/acodec/g726.wav
-79523adfec05760931fda877e1eaf7b4 *./tests/data/g726.acodec.out.wav
-stddev: 8554.55 PSNR: 17.69 MAXDIFF:29353 bytes: 95984/ 1058400
diff --git a/gst-libs/ext/libav/tests/ref/acodec/mp2 b/gst-libs/ext/libav/tests/ref/acodec/mp2
index 3be6c58..42381b4 100644
--- a/gst-libs/ext/libav/tests/ref/acodec/mp2
+++ b/gst-libs/ext/libav/tests/ref/acodec/mp2
@@ -1,5 +1,4 @@
-f6eb0a205350bbd7fb1028a01c7ae8aa *./tests/data/acodec/mp2.mp2
-96130 ./tests/data/acodec/mp2.mp2
-5a669ca7321adc6ab66a3eade4035909 *./tests/data/mp2.acodec.out.wav
-stddev: 9315.99 PSNR: 16.94 MAXDIFF:65388 bytes: 1059840/ 1058400
-stddev: 4384.33 PSNR: 23.49 MAXDIFF:52631 bytes: 1057916/ 1058400
+f6eb0a205350bbd7fb1028a01c7ae8aa *tests/data/fate/acodec-mp2.mp2
+96130 tests/data/fate/acodec-mp2.mp2
+5a669ca7321adc6ab66a3eade4035909 *tests/data/fate/acodec-mp2.out.wav
+stddev: 4384.33 PSNR: 23.49 MAXDIFF:52631 bytes: 1058400/ 1057916
diff --git a/gst-libs/ext/libav/tests/ref/acodec/pcm-alaw b/gst-libs/ext/libav/tests/ref/acodec/pcm-alaw
new file mode 100644
index 0000000..28ce960
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/acodec/pcm-alaw
@@ -0,0 +1,4 @@
+a2dd6a934ec6d5ec901a211652e85227 *tests/data/fate/acodec-pcm-alaw.wav
+529258 tests/data/fate/acodec-pcm-alaw.wav
+f323f7551ffad91de8613f44dcb198b6 *tests/data/fate/acodec-pcm-alaw.out.wav
+stddev: 101.67 PSNR: 56.19 MAXDIFF: 515 bytes: 1058400/ 1058400
diff --git a/gst-libs/ext/libav/tests/ref/acodec/pcm-f32be b/gst-libs/ext/libav/tests/ref/acodec/pcm-f32be
new file mode 100644
index 0000000..5b0f498
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/acodec/pcm-f32be
@@ -0,0 +1,4 @@
+118ff3dc83c62ce9ce669eef57e55bb2 *tests/data/fate/acodec-pcm-f32be.au
+2116824 tests/data/fate/acodec-pcm-f32be.au
+64151e4bcc2b717aa5a8454d424d6a1f *tests/data/fate/acodec-pcm-f32be.out.wav
+stddev: 0.00 PSNR:999.99 MAXDIFF: 0 bytes: 1058400/ 1058400
diff --git a/gst-libs/ext/libav/tests/ref/acodec/pcm-f32le b/gst-libs/ext/libav/tests/ref/acodec/pcm-f32le
new file mode 100644
index 0000000..681f083
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/acodec/pcm-f32le
@@ -0,0 +1,4 @@
+653d82a64b7bd96ac193e105e9f92d4c *tests/data/fate/acodec-pcm-f32le.wav
+2116880 tests/data/fate/acodec-pcm-f32le.wav
+64151e4bcc2b717aa5a8454d424d6a1f *tests/data/fate/acodec-pcm-f32le.out.wav
+stddev: 0.00 PSNR:999.99 MAXDIFF: 0 bytes: 1058400/ 1058400
diff --git a/gst-libs/ext/libav/tests/ref/acodec/pcm-f64be b/gst-libs/ext/libav/tests/ref/acodec/pcm-f64be
new file mode 100644
index 0000000..dd882d3
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/acodec/pcm-f64be
@@ -0,0 +1,4 @@
+8112296b1ed94f72f20d04b1a54850a7 *tests/data/fate/acodec-pcm-f64be.au
+4233624 tests/data/fate/acodec-pcm-f64be.au
+64151e4bcc2b717aa5a8454d424d6a1f *tests/data/fate/acodec-pcm-f64be.out.wav
+stddev: 0.00 PSNR:999.99 MAXDIFF: 0 bytes: 1058400/ 1058400
diff --git a/gst-libs/ext/libav/tests/ref/acodec/pcm-f64le b/gst-libs/ext/libav/tests/ref/acodec/pcm-f64le
new file mode 100644
index 0000000..c6cb027
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/acodec/pcm-f64le
@@ -0,0 +1,4 @@
+48b4cd378f47a50dc902aa03cc8280ed *tests/data/fate/acodec-pcm-f64le.wav
+4233680 tests/data/fate/acodec-pcm-f64le.wav
+64151e4bcc2b717aa5a8454d424d6a1f *tests/data/fate/acodec-pcm-f64le.out.wav
+stddev: 0.00 PSNR:999.99 MAXDIFF: 0 bytes: 1058400/ 1058400
diff --git a/gst-libs/ext/libav/tests/ref/acodec/pcm-mulaw b/gst-libs/ext/libav/tests/ref/acodec/pcm-mulaw
new file mode 100644
index 0000000..bd2a1e8
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/acodec/pcm-mulaw
@@ -0,0 +1,4 @@
+fd10ee54bd298fc29fd6fc70baa71414 *tests/data/fate/acodec-pcm-mulaw.wav
+529258 tests/data/fate/acodec-pcm-mulaw.wav
+7ae8c3fc804bd574006fd547fe28980c *tests/data/fate/acodec-pcm-mulaw.out.wav
+stddev: 103.38 PSNR: 56.04 MAXDIFF: 644 bytes: 1058400/ 1058400
diff --git a/gst-libs/ext/libav/tests/ref/acodec/pcm-s16be b/gst-libs/ext/libav/tests/ref/acodec/pcm-s16be
new file mode 100644
index 0000000..39c3838
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/acodec/pcm-s16be
@@ -0,0 +1,4 @@
+009a446579dd4cba793723b5e2b93c39 *tests/data/fate/acodec-pcm-s16be.mov
+1060097 tests/data/fate/acodec-pcm-s16be.mov
+64151e4bcc2b717aa5a8454d424d6a1f *tests/data/fate/acodec-pcm-s16be.out.wav
+stddev: 0.00 PSNR:999.99 MAXDIFF: 0 bytes: 1058400/ 1058400
diff --git a/gst-libs/ext/libav/tests/ref/acodec/pcm-s16le b/gst-libs/ext/libav/tests/ref/acodec/pcm-s16le
new file mode 100644
index 0000000..51366ad
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/acodec/pcm-s16le
@@ -0,0 +1,4 @@
+64151e4bcc2b717aa5a8454d424d6a1f *tests/data/fate/acodec-pcm-s16le.wav
+1058446 tests/data/fate/acodec-pcm-s16le.wav
+64151e4bcc2b717aa5a8454d424d6a1f *tests/data/fate/acodec-pcm-s16le.out.wav
+stddev: 0.00 PSNR:999.99 MAXDIFF: 0 bytes: 1058400/ 1058400
diff --git a/gst-libs/ext/libav/tests/ref/acodec/pcm-s24be b/gst-libs/ext/libav/tests/ref/acodec/pcm-s24be
new file mode 100644
index 0000000..20bc4e0
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/acodec/pcm-s24be
@@ -0,0 +1,4 @@
+de27dae0dff0359d8f39449b17d5607f *tests/data/fate/acodec-pcm-s24be.mov
+1589297 tests/data/fate/acodec-pcm-s24be.mov
+64151e4bcc2b717aa5a8454d424d6a1f *tests/data/fate/acodec-pcm-s24be.out.wav
+stddev: 0.00 PSNR:999.99 MAXDIFF: 0 bytes: 1058400/ 1058400
diff --git a/gst-libs/ext/libav/tests/ref/acodec/pcm-s24le b/gst-libs/ext/libav/tests/ref/acodec/pcm-s24le
new file mode 100644
index 0000000..a7e77e2
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/acodec/pcm-s24le
@@ -0,0 +1,4 @@
+18ea73985dbdf59e23f5aba66145e6fe *tests/data/fate/acodec-pcm-s24le.wav
+1587668 tests/data/fate/acodec-pcm-s24le.wav
+64151e4bcc2b717aa5a8454d424d6a1f *tests/data/fate/acodec-pcm-s24le.out.wav
+stddev: 0.00 PSNR:999.99 MAXDIFF: 0 bytes: 1058400/ 1058400
diff --git a/gst-libs/ext/libav/tests/ref/acodec/pcm-s32be b/gst-libs/ext/libav/tests/ref/acodec/pcm-s32be
new file mode 100644
index 0000000..302bc1a
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/acodec/pcm-s32be
@@ -0,0 +1,4 @@
+2db1e7fe92d4006103691a4b59064dc6 *tests/data/fate/acodec-pcm-s32be.mov
+2118497 tests/data/fate/acodec-pcm-s32be.mov
+64151e4bcc2b717aa5a8454d424d6a1f *tests/data/fate/acodec-pcm-s32be.out.wav
+stddev: 0.00 PSNR:999.99 MAXDIFF: 0 bytes: 1058400/ 1058400
diff --git a/gst-libs/ext/libav/tests/ref/acodec/pcm-s32le b/gst-libs/ext/libav/tests/ref/acodec/pcm-s32le
new file mode 100644
index 0000000..1c3e412
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/acodec/pcm-s32le
@@ -0,0 +1,4 @@
+8d8849fa5c5d91b9cb74f5c74e937faf *tests/data/fate/acodec-pcm-s32le.wav
+2116868 tests/data/fate/acodec-pcm-s32le.wav
+64151e4bcc2b717aa5a8454d424d6a1f *tests/data/fate/acodec-pcm-s32le.out.wav
+stddev: 0.00 PSNR:999.99 MAXDIFF: 0 bytes: 1058400/ 1058400
diff --git a/gst-libs/ext/libav/tests/ref/acodec/pcm-s8 b/gst-libs/ext/libav/tests/ref/acodec/pcm-s8
new file mode 100644
index 0000000..f830d2f
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/acodec/pcm-s8
@@ -0,0 +1,4 @@
+9ee95a7fff38831a1cad3b49c33e6ed9 *tests/data/fate/acodec-pcm-s8.mov
+530897 tests/data/fate/acodec-pcm-s8.mov
+651d4eb8d98dfcdda96ae6c43d8f156b *tests/data/fate/acodec-pcm-s8.out.wav
+stddev: 147.89 PSNR: 52.93 MAXDIFF: 255 bytes: 1058400/ 1058400
diff --git a/gst-libs/ext/libav/tests/ref/acodec/pcm-u8 b/gst-libs/ext/libav/tests/ref/acodec/pcm-u8
new file mode 100644
index 0000000..80e70ea
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/acodec/pcm-u8
@@ -0,0 +1,4 @@
+70fecbae732f81143a560c7315eda49a *tests/data/fate/acodec-pcm-u8.wav
+529246 tests/data/fate/acodec-pcm-u8.wav
+651d4eb8d98dfcdda96ae6c43d8f156b *tests/data/fate/acodec-pcm-u8.out.wav
+stddev: 147.89 PSNR: 52.93 MAXDIFF: 255 bytes: 1058400/ 1058400
diff --git a/gst-libs/ext/libav/tests/ref/acodec/pcm_alaw b/gst-libs/ext/libav/tests/ref/acodec/pcm_alaw
deleted file mode 100644
index 4943831..0000000
--- a/gst-libs/ext/libav/tests/ref/acodec/pcm_alaw
+++ /dev/null
@@ -1,4 +0,0 @@
-ede2da07839a00c255a43129922f2c7b *./tests/data/acodec/pcm_alaw.wav
-529258 ./tests/data/acodec/pcm_alaw.wav
-f323f7551ffad91de8613f44dcb198b6 *./tests/data/pcm_alaw.acodec.out.wav
-stddev: 101.67 PSNR: 56.19 MAXDIFF: 515 bytes: 1058400/ 1058400
diff --git a/gst-libs/ext/libav/tests/ref/acodec/pcm_f32be b/gst-libs/ext/libav/tests/ref/acodec/pcm_f32be
deleted file mode 100644
index 5f067c2..0000000
--- a/gst-libs/ext/libav/tests/ref/acodec/pcm_f32be
+++ /dev/null
@@ -1,4 +0,0 @@
-118ff3dc83c62ce9ce669eef57e55bb2 *./tests/data/acodec/pcm_f32be.au
-2116824 ./tests/data/acodec/pcm_f32be.au
-64151e4bcc2b717aa5a8454d424d6a1f *./tests/data/pcm_f32be.acodec.out.wav
-stddev: 0.00 PSNR:999.99 MAXDIFF: 0 bytes: 1058400/ 1058400
diff --git a/gst-libs/ext/libav/tests/ref/acodec/pcm_f32le b/gst-libs/ext/libav/tests/ref/acodec/pcm_f32le
deleted file mode 100644
index 38e5c0b..0000000
--- a/gst-libs/ext/libav/tests/ref/acodec/pcm_f32le
+++ /dev/null
@@ -1,4 +0,0 @@
-46f44f86a18984a832206ab9e29a79f2 *./tests/data/acodec/pcm_f32le.wav
-2116880 ./tests/data/acodec/pcm_f32le.wav
-64151e4bcc2b717aa5a8454d424d6a1f *./tests/data/pcm_f32le.acodec.out.wav
-stddev: 0.00 PSNR:999.99 MAXDIFF: 0 bytes: 1058400/ 1058400
diff --git a/gst-libs/ext/libav/tests/ref/acodec/pcm_f64be b/gst-libs/ext/libav/tests/ref/acodec/pcm_f64be
deleted file mode 100644
index 9abdabc..0000000
--- a/gst-libs/ext/libav/tests/ref/acodec/pcm_f64be
+++ /dev/null
@@ -1,4 +0,0 @@
-8112296b1ed94f72f20d04b1a54850a7 *./tests/data/acodec/pcm_f64be.au
-4233624 ./tests/data/acodec/pcm_f64be.au
-64151e4bcc2b717aa5a8454d424d6a1f *./tests/data/pcm_f64be.acodec.out.wav
-stddev: 0.00 PSNR:999.99 MAXDIFF: 0 bytes: 1058400/ 1058400
diff --git a/gst-libs/ext/libav/tests/ref/acodec/pcm_f64le b/gst-libs/ext/libav/tests/ref/acodec/pcm_f64le
deleted file mode 100644
index 42875a8..0000000
--- a/gst-libs/ext/libav/tests/ref/acodec/pcm_f64le
+++ /dev/null
@@ -1,4 +0,0 @@
-ba17c6d1a270e1333e981f239bf7eb45 *./tests/data/acodec/pcm_f64le.wav
-4233680 ./tests/data/acodec/pcm_f64le.wav
-64151e4bcc2b717aa5a8454d424d6a1f *./tests/data/pcm_f64le.acodec.out.wav
-stddev: 0.00 PSNR:999.99 MAXDIFF: 0 bytes: 1058400/ 1058400
diff --git a/gst-libs/ext/libav/tests/ref/acodec/pcm_mulaw b/gst-libs/ext/libav/tests/ref/acodec/pcm_mulaw
deleted file mode 100644
index cefd76b..0000000
--- a/gst-libs/ext/libav/tests/ref/acodec/pcm_mulaw
+++ /dev/null
@@ -1,4 +0,0 @@
-0c2a55850fb46ad5385a69b15b271f10 *./tests/data/acodec/pcm_mulaw.wav
-529258 ./tests/data/acodec/pcm_mulaw.wav
-7ae8c3fc804bd574006fd547fe28980c *./tests/data/pcm_mulaw.acodec.out.wav
-stddev: 103.38 PSNR: 56.04 MAXDIFF: 644 bytes: 1058400/ 1058400
diff --git a/gst-libs/ext/libav/tests/ref/acodec/pcm_s16be b/gst-libs/ext/libav/tests/ref/acodec/pcm_s16be
deleted file mode 100644
index f766666..0000000
--- a/gst-libs/ext/libav/tests/ref/acodec/pcm_s16be
+++ /dev/null
@@ -1,4 +0,0 @@
-53c9eb319c778e7ce137667f62384994 *./tests/data/acodec/pcm_s16be.mov
-1060073 ./tests/data/acodec/pcm_s16be.mov
-64151e4bcc2b717aa5a8454d424d6a1f *./tests/data/pcm_s16be.acodec.out.wav
-stddev: 0.00 PSNR:999.99 MAXDIFF: 0 bytes: 1058400/ 1058400
diff --git a/gst-libs/ext/libav/tests/ref/acodec/pcm_s16le b/gst-libs/ext/libav/tests/ref/acodec/pcm_s16le
deleted file mode 100644
index c7b5de7..0000000
--- a/gst-libs/ext/libav/tests/ref/acodec/pcm_s16le
+++ /dev/null
@@ -1,4 +0,0 @@
-64151e4bcc2b717aa5a8454d424d6a1f *./tests/data/acodec/pcm_s16le.wav
-1058446 ./tests/data/acodec/pcm_s16le.wav
-64151e4bcc2b717aa5a8454d424d6a1f *./tests/data/pcm_s16le.acodec.out.wav
-stddev: 0.00 PSNR:999.99 MAXDIFF: 0 bytes: 1058400/ 1058400
diff --git a/gst-libs/ext/libav/tests/ref/acodec/pcm_s24be b/gst-libs/ext/libav/tests/ref/acodec/pcm_s24be
deleted file mode 100644
index b9fada7..0000000
--- a/gst-libs/ext/libav/tests/ref/acodec/pcm_s24be
+++ /dev/null
@@ -1,4 +0,0 @@
-af8acd2f08e4bbebe7f4bea4d6f59dd6 *./tests/data/acodec/pcm_s24be.mov
-1589273 ./tests/data/acodec/pcm_s24be.mov
-64151e4bcc2b717aa5a8454d424d6a1f *./tests/data/pcm_s24be.acodec.out.wav
-stddev: 0.00 PSNR:999.99 MAXDIFF: 0 bytes: 1058400/ 1058400
diff --git a/gst-libs/ext/libav/tests/ref/acodec/pcm_s24daud b/gst-libs/ext/libav/tests/ref/acodec/pcm_s24daud
deleted file mode 100644
index eab6f8d..0000000
--- a/gst-libs/ext/libav/tests/ref/acodec/pcm_s24daud
+++ /dev/null
@@ -1,4 +0,0 @@
-8168a5c1343553ef027541830f2cb879 *./tests/data/acodec/pcm_s24daud.302
-10368730 ./tests/data/acodec/pcm_s24daud.302
-f552afadfdfcd6348a07095da6382de5 *./tests/data/pcm_s24daud.acodec.out.wav
-stddev: 9416.28 PSNR: 16.85 MAXDIFF:42744 bytes: 6911796/ 1058400
diff --git a/gst-libs/ext/libav/tests/ref/acodec/pcm_s24le b/gst-libs/ext/libav/tests/ref/acodec/pcm_s24le
deleted file mode 100644
index a724e8c..0000000
--- a/gst-libs/ext/libav/tests/ref/acodec/pcm_s24le
+++ /dev/null
@@ -1,4 +0,0 @@
-a85380fb79b0d4fff38e24ac1e34bb94 *./tests/data/acodec/pcm_s24le.wav
-1587668 ./tests/data/acodec/pcm_s24le.wav
-64151e4bcc2b717aa5a8454d424d6a1f *./tests/data/pcm_s24le.acodec.out.wav
-stddev: 0.00 PSNR:999.99 MAXDIFF: 0 bytes: 1058400/ 1058400
diff --git a/gst-libs/ext/libav/tests/ref/acodec/pcm_s32be b/gst-libs/ext/libav/tests/ref/acodec/pcm_s32be
deleted file mode 100644
index d6e5205..0000000
--- a/gst-libs/ext/libav/tests/ref/acodec/pcm_s32be
+++ /dev/null
@@ -1,4 +0,0 @@
-63f0e22b4f7c5d61d75047d85f140d52 *./tests/data/acodec/pcm_s32be.mov
-2118473 ./tests/data/acodec/pcm_s32be.mov
-64151e4bcc2b717aa5a8454d424d6a1f *./tests/data/pcm_s32be.acodec.out.wav
-stddev: 0.00 PSNR:999.99 MAXDIFF: 0 bytes: 1058400/ 1058400
diff --git a/gst-libs/ext/libav/tests/ref/acodec/pcm_s32le b/gst-libs/ext/libav/tests/ref/acodec/pcm_s32le
deleted file mode 100644
index 8677750..0000000
--- a/gst-libs/ext/libav/tests/ref/acodec/pcm_s32le
+++ /dev/null
@@ -1,4 +0,0 @@
-da6ed80f4f40f0082577dea80827e014 *./tests/data/acodec/pcm_s32le.wav
-2116868 ./tests/data/acodec/pcm_s32le.wav
-64151e4bcc2b717aa5a8454d424d6a1f *./tests/data/pcm_s32le.acodec.out.wav
-stddev: 0.00 PSNR:999.99 MAXDIFF: 0 bytes: 1058400/ 1058400
diff --git a/gst-libs/ext/libav/tests/ref/acodec/pcm_s8 b/gst-libs/ext/libav/tests/ref/acodec/pcm_s8
deleted file mode 100644
index 3b550d2..0000000
--- a/gst-libs/ext/libav/tests/ref/acodec/pcm_s8
+++ /dev/null
@@ -1,4 +0,0 @@
-4b3013a3f3c328ecdb617cd88b3fe836 *./tests/data/acodec/pcm_s8.mov
-530873 ./tests/data/acodec/pcm_s8.mov
-651d4eb8d98dfcdda96ae6c43d8f156b *./tests/data/pcm_s8.acodec.out.wav
-stddev: 147.89 PSNR: 52.93 MAXDIFF: 255 bytes: 1058400/ 1058400
diff --git a/gst-libs/ext/libav/tests/ref/acodec/pcm_u8 b/gst-libs/ext/libav/tests/ref/acodec/pcm_u8
deleted file mode 100644
index e8d70c9..0000000
--- a/gst-libs/ext/libav/tests/ref/acodec/pcm_u8
+++ /dev/null
@@ -1,4 +0,0 @@
-70fecbae732f81143a560c7315eda49a *./tests/data/acodec/pcm_u8.wav
-529246 ./tests/data/acodec/pcm_u8.wav
-651d4eb8d98dfcdda96ae6c43d8f156b *./tests/data/pcm_u8.acodec.out.wav
-stddev: 147.89 PSNR: 52.93 MAXDIFF: 255 bytes: 1058400/ 1058400
diff --git a/gst-libs/ext/libav/tests/ref/acodec/wmav1 b/gst-libs/ext/libav/tests/ref/acodec/wmav1
deleted file mode 100644
index 117aa12..0000000
--- a/gst-libs/ext/libav/tests/ref/acodec/wmav1
+++ /dev/null
@@ -1,4 +0,0 @@
-0260385b8a54df11ad349f9ba8240fd8 *./tests/data/acodec/wmav1.asf
-106004 ./tests/data/acodec/wmav1.asf
-stddev:12241.90 PSNR: 14.57 MAXDIFF:65521 bytes: 1064960/ 1058400
-stddev: 2074.79 PSNR: 29.99 MAXDIFF:27658 bytes: 1056768/ 1058400
diff --git a/gst-libs/ext/libav/tests/ref/acodec/wmav2 b/gst-libs/ext/libav/tests/ref/acodec/wmav2
deleted file mode 100644
index 43b19b7..0000000
--- a/gst-libs/ext/libav/tests/ref/acodec/wmav2
+++ /dev/null
@@ -1,4 +0,0 @@
-bdb4c312fb109f990be83a70f8ec9bdc *./tests/data/acodec/wmav2.asf
-106044 ./tests/data/acodec/wmav2.asf
-stddev:12246.35 PSNR: 14.57 MAXDIFF:65521 bytes: 1064960/ 1058400
-stddev: 2068.08 PSNR: 30.02 MAXDIFF:27650 bytes: 1056768/ 1058400
diff --git a/gst-libs/ext/libav/tests/ref/fate/4xm-1 b/gst-libs/ext/libav/tests/ref/fate/4xm-1
index 5e66dcc..d38a47a 100644
--- a/gst-libs/ext/libav/tests/ref/fate/4xm-1
+++ b/gst-libs/ext/libav/tests/ref/fate/4xm-1
@@ -1,15 +1,16 @@
-0, 0, 921600, 0xd08f97c7
-0, 6000, 921600, 0xc433a85b
-0, 12000, 921600, 0x7ffeee42
-0, 18000, 921600, 0xc0ad9f52
-0, 24000, 921600, 0xb0235112
-0, 30000, 921600, 0xcbdd9805
-0, 36000, 921600, 0x5468bdb9
-0, 42000, 921600, 0x2f0c63fd
-0, 48000, 921600, 0xf1de04f0
-0, 54000, 921600, 0x95709ce2
-0, 60000, 921600, 0x69037c4a
-0, 66000, 921600, 0x513f8a98
-0, 72000, 921600, 0x55b82fa1
-0, 78000, 921600, 0x5c8ace28
-0, 84000, 921600, 0xb019770a
+#tb 0: 1/15
+0, 0, 0, 1, 921600, 0xd08f97c7
+0, 1, 1, 1, 921600, 0xc433a85b
+0, 2, 2, 1, 921600, 0x7ffeee42
+0, 3, 3, 1, 921600, 0xc0ad9f52
+0, 4, 4, 1, 921600, 0xb0235112
+0, 5, 5, 1, 921600, 0xcbdd9805
+0, 6, 6, 1, 921600, 0x5468bdb9
+0, 7, 7, 1, 921600, 0x2f0c63fd
+0, 8, 8, 1, 921600, 0xf1de04f0
+0, 9, 9, 1, 921600, 0x95709ce2
+0, 10, 10, 1, 921600, 0x69037c4a
+0, 11, 11, 1, 921600, 0x513f8a98
+0, 12, 12, 1, 921600, 0x55b82fa1
+0, 13, 13, 1, 921600, 0x5c8ace28
+0, 14, 14, 1, 921600, 0xb019770a
diff --git a/gst-libs/ext/libav/tests/ref/fate/4xm-2 b/gst-libs/ext/libav/tests/ref/fate/4xm-2
index 4037f28..35b0797 100644
--- a/gst-libs/ext/libav/tests/ref/fate/4xm-2
+++ b/gst-libs/ext/libav/tests/ref/fate/4xm-2
@@ -1,174 +1,175 @@
-0, 0, 80640, 0x00000000
-0, 15000, 80640, 0x3a942680
-0, 30000, 80640, 0x3a942680
-0, 45000, 80640, 0x3a942680
-0, 60000, 80640, 0x3a942680
-0, 75000, 80640, 0x3a942680
-0, 90000, 80640, 0x3a942680
-0, 105000, 80640, 0x1956ebfc
-0, 120000, 80640, 0x61686290
-0, 135000, 80640, 0x7e2c2753
-0, 150000, 80640, 0x63e5e14f
-0, 165000, 80640, 0xa775947a
-0, 180000, 80640, 0x4b91b93d
-0, 195000, 80640, 0x83345f32
-0, 210000, 80640, 0x5d3a3374
-0, 225000, 80640, 0x164808c5
-0, 240000, 80640, 0xfd0189af
-0, 255000, 80640, 0x062f9389
-0, 270000, 80640, 0xe4dcaff8
-0, 285000, 80640, 0xb2d9ec51
-0, 300000, 80640, 0x3b4d5331
-0, 315000, 80640, 0xfcbd8da1
-0, 330000, 80640, 0xa0732142
-0, 345000, 80640, 0x6438df5f
-0, 360000, 80640, 0x614302fa
-0, 375000, 80640, 0x53edf986
-0, 390000, 80640, 0x6dfe13f0
-0, 405000, 80640, 0x0b2194c3
-0, 420000, 80640, 0xe0436945
-0, 435000, 80640, 0x8d8ba77f
-0, 450000, 80640, 0x9c723388
-0, 465000, 80640, 0x336bd2a2
-0, 480000, 80640, 0x5905fd0b
-0, 495000, 80640, 0x2ca368bb
-0, 510000, 80640, 0x38c1e5ec
-0, 525000, 80640, 0xe439a194
-0, 540000, 80640, 0xe7a19a64
-0, 555000, 80640, 0xbe7f9094
-0, 570000, 80640, 0x0b2cbec9
-0, 585000, 80640, 0x8050bf7d
-0, 600000, 80640, 0x4e9d4e78
-0, 615000, 80640, 0xaa7bb85d
-0, 630000, 80640, 0x6e42b1a6
-0, 645000, 80640, 0x27043fe0
-0, 660000, 80640, 0xe04bd5e6
-0, 675000, 80640, 0xd60762d6
-0, 690000, 80640, 0x2729df8f
-0, 705000, 80640, 0x1b62c4f7
-0, 720000, 80640, 0xe6b5d2f7
-0, 735000, 80640, 0xf5885096
-0, 750000, 80640, 0xe7625cf6
-0, 765000, 80640, 0xed804de6
-0, 780000, 80640, 0x3f92728e
-0, 795000, 80640, 0x353e4b0d
-0, 810000, 80640, 0x70b0228c
-0, 825000, 80640, 0x851bd554
-0, 840000, 80640, 0x594f22eb
-0, 855000, 80640, 0xa2267c0b
-0, 870000, 80640, 0xdc0fbafb
-0, 885000, 80640, 0xd596b763
-0, 900000, 80640, 0x3b9c4b1b
-0, 915000, 80640, 0x218ac4b4
-0, 930000, 80640, 0x4af393a4
-0, 945000, 80640, 0x66c098c5
-0, 960000, 80640, 0x7cc91e86
-0, 975000, 80640, 0xba282a2e
-0, 990000, 80640, 0x50932be6
-0, 1005000, 80640, 0x6531386e
-0, 1020000, 80640, 0x2616235f
-0, 1035000, 80640, 0x27aad18a
-0, 1050000, 80640, 0x67491df3
-0, 1065000, 80640, 0x167028f1
-0, 1080000, 80640, 0xa4229420
-0, 1095000, 80640, 0x77eaed07
-0, 1110000, 80640, 0xbdf7d8e8
-0, 1125000, 80640, 0xc2ac8545
-0, 1140000, 80640, 0xf3fe64ec
-0, 1155000, 80640, 0x66451d43
-0, 1170000, 80640, 0x1af2f05e
-0, 1185000, 80640, 0x2a63c2c4
-0, 1200000, 80640, 0xe4e07a0f
-0, 1215000, 80640, 0x598e8b11
-0, 1230000, 80640, 0xb2ebb868
-0, 1245000, 80640, 0xa4b6bb8a
-0, 1260000, 80640, 0x5037e910
-0, 1275000, 80640, 0x0c55f6c0
-0, 1290000, 80640, 0x3f4704f7
-0, 1305000, 80640, 0xa6a8e810
-0, 1320000, 80640, 0xedbfcfb0
-0, 1335000, 80640, 0xe568caa0
-0, 1350000, 80640, 0xdf21cc20
-0, 1365000, 80640, 0xb66cd4a8
-0, 1380000, 80640, 0xcd26c9c8
-0, 1395000, 80640, 0x5fe8d598
-0, 1410000, 80640, 0xed0dc9c8
-0, 1425000, 80640, 0x8313d288
-0, 1440000, 80640, 0x9ccdd4a0
-0, 1455000, 80640, 0x66ffe970
-0, 1470000, 80640, 0xf68ad1c8
-0, 1485000, 80640, 0xd570f658
-0, 1500000, 80640, 0x8c39d998
-0, 1515000, 80640, 0xe18fe5e0
-0, 1530000, 80640, 0xbbe7e340
-0, 1545000, 80640, 0x9a90d470
-0, 1560000, 80640, 0xd2bbced0
-0, 1575000, 80640, 0xbbf9dce0
-0, 1590000, 80640, 0x4ff7c888
-0, 1605000, 80640, 0xc2e7e1f0
-0, 1620000, 80640, 0x2104e3b0
-0, 1635000, 80640, 0xaef5e8f0
-0, 1650000, 80640, 0xc477e890
-0, 1665000, 80640, 0xb12df778
-0, 1680000, 80640, 0xd2115720
-0, 1695000, 80640, 0x620b6538
-0, 1710000, 80640, 0x894a8db8
-0, 1725000, 80640, 0x8da3bcb0
-0, 1740000, 80640, 0x96be8930
-0, 1755000, 80640, 0xe69dc1f0
-0, 1770000, 80640, 0x42b8d4e0
-0, 1785000, 80640, 0x0a8da4f0
-0, 1800000, 80640, 0x245fd3d8
-0, 1815000, 80640, 0x3fd1e858
-0, 1830000, 80640, 0xe2c299f0
-0, 1845000, 80640, 0xda1cddd0
-0, 1860000, 80640, 0xf126e498
-0, 1875000, 80640, 0xc85ab920
-0, 1890000, 80640, 0x52f39de8
-0, 1905000, 80640, 0xd0daac60
-0, 1920000, 80640, 0xef323347
-0, 1935000, 80640, 0xcc063317
-0, 1950000, 80640, 0xb6f53057
-0, 1965000, 80640, 0x5fe53b07
-0, 1980000, 80640, 0x63183d7f
-0, 1995000, 80640, 0x91a44bbf
-0, 2010000, 80640, 0xa433480f
-0, 2025000, 80640, 0xe90652ef
-0, 2040000, 80640, 0xe96e35bf
-0, 2055000, 80640, 0x84ff2ccf
-0, 2070000, 80640, 0x930f2b07
-0, 2085000, 80640, 0x5a1228d7
-0, 2100000, 80640, 0x29f226ef
-0, 2115000, 80640, 0xd35136df
-0, 2130000, 80640, 0x0e2d407f
-0, 2145000, 80640, 0x34a93267
-0, 2160000, 80640, 0x7ae82af7
-0, 2175000, 80640, 0xb20c2477
-0, 2190000, 80640, 0xa104218f
-0, 2205000, 80640, 0xcb1121e7
-0, 2220000, 80640, 0xaca04751
-0, 2235000, 80640, 0x3a51c704
-0, 2250000, 80640, 0xfa632e3d
-0, 2265000, 80640, 0x61c9407c
-0, 2280000, 80640, 0xe9a08dd9
-0, 2295000, 80640, 0xebf3c623
-0, 2310000, 80640, 0x00000000
-0, 2325000, 80640, 0x0f412500
-0, 2340000, 80640, 0x0f412500
-0, 2355000, 80640, 0x0f412500
-0, 2370000, 80640, 0xb6634270
-0, 2385000, 80640, 0x9e43a4a0
-0, 2400000, 80640, 0x136ab60b
-0, 2415000, 80640, 0x6ce3254e
-0, 2430000, 80640, 0xf4340d15
-0, 2445000, 80640, 0x73861114
-0, 2460000, 80640, 0x36b300d3
-0, 2475000, 80640, 0x2ddde523
-0, 2490000, 80640, 0xfdd79c02
-0, 2505000, 80640, 0xe6cc4fe9
-0, 2520000, 80640, 0x5b13e2b9
-0, 2535000, 80640, 0x0d588e70
-0, 2550000, 80640, 0xc6e4023f
-0, 2565000, 80640, 0xf54c496f
-0, 2580000, 80640, 0xa315a5cf
-0, 2595000, 80640, 0x2d2ac9c7
+#tb 0: 1/6
+0, 0, 0, 1, 80640, 0x00000000
+0, 1, 1, 1, 80640, 0x3a942680
+0, 2, 2, 1, 80640, 0x3a942680
+0, 3, 3, 1, 80640, 0x3a942680
+0, 4, 4, 1, 80640, 0x3a942680
+0, 5, 5, 1, 80640, 0x3a942680
+0, 6, 6, 1, 80640, 0x3a942680
+0, 7, 7, 1, 80640, 0x1956ebfc
+0, 8, 8, 1, 80640, 0x61686290
+0, 9, 9, 1, 80640, 0x7e2c2753
+0, 10, 10, 1, 80640, 0x63e5e14f
+0, 11, 11, 1, 80640, 0xa775947a
+0, 12, 12, 1, 80640, 0x4b91b93d
+0, 13, 13, 1, 80640, 0x83345f32
+0, 14, 14, 1, 80640, 0x5d3a3374
+0, 15, 15, 1, 80640, 0x164808c5
+0, 16, 16, 1, 80640, 0xfd0189af
+0, 17, 17, 1, 80640, 0x062f9389
+0, 18, 18, 1, 80640, 0xe4dcaff8
+0, 19, 19, 1, 80640, 0xb2d9ec51
+0, 20, 20, 1, 80640, 0x3b4d5331
+0, 21, 21, 1, 80640, 0xfcbd8da1
+0, 22, 22, 1, 80640, 0xa0732142
+0, 23, 23, 1, 80640, 0x6438df5f
+0, 24, 24, 1, 80640, 0x614302fa
+0, 25, 25, 1, 80640, 0x53edf986
+0, 26, 26, 1, 80640, 0x6dfe13f0
+0, 27, 27, 1, 80640, 0x0b2194c3
+0, 28, 28, 1, 80640, 0xe0436945
+0, 29, 29, 1, 80640, 0x8d8ba77f
+0, 30, 30, 1, 80640, 0x9c723388
+0, 31, 31, 1, 80640, 0x336bd2a2
+0, 32, 32, 1, 80640, 0x5905fd0b
+0, 33, 33, 1, 80640, 0x2ca368bb
+0, 34, 34, 1, 80640, 0x38c1e5ec
+0, 35, 35, 1, 80640, 0xe439a194
+0, 36, 36, 1, 80640, 0xe7a19a64
+0, 37, 37, 1, 80640, 0xbe7f9094
+0, 38, 38, 1, 80640, 0x0b2cbec9
+0, 39, 39, 1, 80640, 0x8050bf7d
+0, 40, 40, 1, 80640, 0x4e9d4e78
+0, 41, 41, 1, 80640, 0xaa7bb85d
+0, 42, 42, 1, 80640, 0x6e42b1a6
+0, 43, 43, 1, 80640, 0x27043fe0
+0, 44, 44, 1, 80640, 0xe04bd5e6
+0, 45, 45, 1, 80640, 0xd60762d6
+0, 46, 46, 1, 80640, 0x2729df8f
+0, 47, 47, 1, 80640, 0x1b62c4f7
+0, 48, 48, 1, 80640, 0xe6b5d2f7
+0, 49, 49, 1, 80640, 0xf5885096
+0, 50, 50, 1, 80640, 0xe7625cf6
+0, 51, 51, 1, 80640, 0xed804de6
+0, 52, 52, 1, 80640, 0x3f92728e
+0, 53, 53, 1, 80640, 0x353e4b0d
+0, 54, 54, 1, 80640, 0x70b0228c
+0, 55, 55, 1, 80640, 0x851bd554
+0, 56, 56, 1, 80640, 0x594f22eb
+0, 57, 57, 1, 80640, 0xa2267c0b
+0, 58, 58, 1, 80640, 0xdc0fbafb
+0, 59, 59, 1, 80640, 0xd596b763
+0, 60, 60, 1, 80640, 0x3b9c4b1b
+0, 61, 61, 1, 80640, 0x218ac4b4
+0, 62, 62, 1, 80640, 0x4af393a4
+0, 63, 63, 1, 80640, 0x66c098c5
+0, 64, 64, 1, 80640, 0x7cc91e86
+0, 65, 65, 1, 80640, 0xba282a2e
+0, 66, 66, 1, 80640, 0x50932be6
+0, 67, 67, 1, 80640, 0x6531386e
+0, 68, 68, 1, 80640, 0x2616235f
+0, 69, 69, 1, 80640, 0x27aad18a
+0, 70, 70, 1, 80640, 0x67491df3
+0, 71, 71, 1, 80640, 0x167028f1
+0, 72, 72, 1, 80640, 0xa4229420
+0, 73, 73, 1, 80640, 0x77eaed07
+0, 74, 74, 1, 80640, 0xbdf7d8e8
+0, 75, 75, 1, 80640, 0xc2ac8545
+0, 76, 76, 1, 80640, 0xf3fe64ec
+0, 77, 77, 1, 80640, 0x66451d43
+0, 78, 78, 1, 80640, 0x1af2f05e
+0, 79, 79, 1, 80640, 0x2a63c2c4
+0, 80, 80, 1, 80640, 0xe4e07a0f
+0, 81, 81, 1, 80640, 0x598e8b11
+0, 82, 82, 1, 80640, 0xb2ebb868
+0, 83, 83, 1, 80640, 0xa4b6bb8a
+0, 84, 84, 1, 80640, 0x5037e910
+0, 85, 85, 1, 80640, 0x0c55f6c0
+0, 86, 86, 1, 80640, 0x3f4704f7
+0, 87, 87, 1, 80640, 0xa6a8e810
+0, 88, 88, 1, 80640, 0xedbfcfb0
+0, 89, 89, 1, 80640, 0xe568caa0
+0, 90, 90, 1, 80640, 0xdf21cc20
+0, 91, 91, 1, 80640, 0xb66cd4a8
+0, 92, 92, 1, 80640, 0xcd26c9c8
+0, 93, 93, 1, 80640, 0x5fe8d598
+0, 94, 94, 1, 80640, 0xed0dc9c8
+0, 95, 95, 1, 80640, 0x8313d288
+0, 96, 96, 1, 80640, 0x9ccdd4a0
+0, 97, 97, 1, 80640, 0x66ffe970
+0, 98, 98, 1, 80640, 0xf68ad1c8
+0, 99, 99, 1, 80640, 0xd570f658
+0, 100, 100, 1, 80640, 0x8c39d998
+0, 101, 101, 1, 80640, 0xe18fe5e0
+0, 102, 102, 1, 80640, 0xbbe7e340
+0, 103, 103, 1, 80640, 0x9a90d470
+0, 104, 104, 1, 80640, 0xd2bbced0
+0, 105, 105, 1, 80640, 0xbbf9dce0
+0, 106, 106, 1, 80640, 0x4ff7c888
+0, 107, 107, 1, 80640, 0xc2e7e1f0
+0, 108, 108, 1, 80640, 0x2104e3b0
+0, 109, 109, 1, 80640, 0xaef5e8f0
+0, 110, 110, 1, 80640, 0xc477e890
+0, 111, 111, 1, 80640, 0xb12df778
+0, 112, 112, 1, 80640, 0xd2115720
+0, 113, 113, 1, 80640, 0x620b6538
+0, 114, 114, 1, 80640, 0x894a8db8
+0, 115, 115, 1, 80640, 0x8da3bcb0
+0, 116, 116, 1, 80640, 0x96be8930
+0, 117, 117, 1, 80640, 0xe69dc1f0
+0, 118, 118, 1, 80640, 0x42b8d4e0
+0, 119, 119, 1, 80640, 0x0a8da4f0
+0, 120, 120, 1, 80640, 0x245fd3d8
+0, 121, 121, 1, 80640, 0x3fd1e858
+0, 122, 122, 1, 80640, 0xe2c299f0
+0, 123, 123, 1, 80640, 0xda1cddd0
+0, 124, 124, 1, 80640, 0xf126e498
+0, 125, 125, 1, 80640, 0xc85ab920
+0, 126, 126, 1, 80640, 0x52f39de8
+0, 127, 127, 1, 80640, 0xd0daac60
+0, 128, 128, 1, 80640, 0xef323347
+0, 129, 129, 1, 80640, 0xcc063317
+0, 130, 130, 1, 80640, 0xb6f53057
+0, 131, 131, 1, 80640, 0x5fe53b07
+0, 132, 132, 1, 80640, 0x63183d7f
+0, 133, 133, 1, 80640, 0x91a44bbf
+0, 134, 134, 1, 80640, 0xa433480f
+0, 135, 135, 1, 80640, 0xe90652ef
+0, 136, 136, 1, 80640, 0xe96e35bf
+0, 137, 137, 1, 80640, 0x84ff2ccf
+0, 138, 138, 1, 80640, 0x930f2b07
+0, 139, 139, 1, 80640, 0x5a1228d7
+0, 140, 140, 1, 80640, 0x29f226ef
+0, 141, 141, 1, 80640, 0xd35136df
+0, 142, 142, 1, 80640, 0x0e2d407f
+0, 143, 143, 1, 80640, 0x34a93267
+0, 144, 144, 1, 80640, 0x7ae82af7
+0, 145, 145, 1, 80640, 0xb20c2477
+0, 146, 146, 1, 80640, 0xa104218f
+0, 147, 147, 1, 80640, 0xcb1121e7
+0, 148, 148, 1, 80640, 0xaca04751
+0, 149, 149, 1, 80640, 0x3a51c704
+0, 150, 150, 1, 80640, 0xfa632e3d
+0, 151, 151, 1, 80640, 0x61c9407c
+0, 152, 152, 1, 80640, 0xe9a08dd9
+0, 153, 153, 1, 80640, 0xebf3c623
+0, 154, 154, 1, 80640, 0x00000000
+0, 155, 155, 1, 80640, 0x0f412500
+0, 156, 156, 1, 80640, 0x0f412500
+0, 157, 157, 1, 80640, 0x0f412500
+0, 158, 158, 1, 80640, 0xb6634270
+0, 159, 159, 1, 80640, 0x9e43a4a0
+0, 160, 160, 1, 80640, 0x136ab60b
+0, 161, 161, 1, 80640, 0x6ce3254e
+0, 162, 162, 1, 80640, 0xf4340d15
+0, 163, 163, 1, 80640, 0x73861114
+0, 164, 164, 1, 80640, 0x36b300d3
+0, 165, 165, 1, 80640, 0x2ddde523
+0, 166, 166, 1, 80640, 0xfdd79c02
+0, 167, 167, 1, 80640, 0xe6cc4fe9
+0, 168, 168, 1, 80640, 0x5b13e2b9
+0, 169, 169, 1, 80640, 0x0d588e70
+0, 170, 170, 1, 80640, 0xc6e4023f
+0, 171, 171, 1, 80640, 0xf54c496f
+0, 172, 172, 1, 80640, 0xa315a5cf
+0, 173, 173, 1, 80640, 0x2d2ac9c7
diff --git a/gst-libs/ext/libav/tests/ref/fate/8bps b/gst-libs/ext/libav/tests/ref/fate/8bps
index 30ec8c5..869d38c 100644
--- a/gst-libs/ext/libav/tests/ref/fate/8bps
+++ b/gst-libs/ext/libav/tests/ref/fate/8bps
@@ -1,35 +1,37 @@
-0, 0, 259200, 0x7e91df07
-1, 0, 2048, 0x3d042426
-1, 4180, 2048, 0x5bcae456
-0, 7200, 259200, 0x7e91df07
-1, 8359, 2048, 0xb6043655
-1, 12539, 2048, 0x6fdaffad
-0, 14400, 259200, 0xc468c119
-1, 16718, 2048, 0xf86700cb
-1, 20898, 2048, 0x045e46c1
-0, 21600, 259200, 0x0e058930
-1, 25078, 2048, 0x000df0e5
-0, 28800, 259200, 0xa0261310
-1, 29257, 2048, 0x8f5f12fb
-1, 33437, 2048, 0xd516f6b0
-0, 36000, 259200, 0x78ca9aba
-1, 37616, 2048, 0xa1fe2bd3
-1, 41796, 2048, 0x3647087a
-0, 43200, 259200, 0x4971f7b3
-1, 45976, 2048, 0xd2ee584e
-1, 50155, 2048, 0xf132088c
-0, 50400, 259200, 0x7dc2cff7
-1, 54335, 2048, 0x1efc0eb1
-0, 57600, 259200, 0x8cbc53d5
-1, 58514, 2048, 0xeb73f402
-1, 62694, 2048, 0x75cb3d20
-0, 64800, 259200, 0xcccd77e3
-1, 66873, 2048, 0x85a501b6
-1, 71053, 2048, 0xa4eb312d
-0, 72000, 259200, 0x6b3e0fb3
-1, 75233, 2048, 0xf0aaf8c7
-0, 79200, 259200, 0x281dd175
-1, 79412, 2048, 0x65371cda
-1, 83592, 2048, 0x25512cd6
-1, 87771, 2048, 0xc81410e3
-1, 91951, 514, 0x57d77b94
+#tb 0: 1/125
+#tb 1: 1/22050
+0, 0, 0, 1, 259200, 0x7e91df07
+1, 0, 0, 1024, 2048, 0x3d042426
+1, 1024, 1024, 1024, 2048, 0x5bcae456
+0, 10, 10, 1, 259200, 0x7e91df07
+1, 2048, 2048, 1024, 2048, 0xb6043655
+1, 3072, 3072, 1024, 2048, 0x6fdaffad
+0, 20, 20, 1, 259200, 0xc468c119
+1, 4096, 4096, 1024, 2048, 0xf86700cb
+1, 5120, 5120, 1024, 2048, 0x045e46c1
+0, 30, 30, 1, 259200, 0x0e058930
+1, 6144, 6144, 1024, 2048, 0x000df0e5
+0, 40, 40, 1, 259200, 0xa0261310
+1, 7168, 7168, 1024, 2048, 0x8f5f12fb
+1, 8192, 8192, 1024, 2048, 0xd516f6b0
+0, 50, 50, 1, 259200, 0x78ca9aba
+1, 9216, 9216, 1024, 2048, 0xa1fe2bd3
+1, 10240, 10240, 1024, 2048, 0x3647087a
+0, 60, 60, 1, 259200, 0x4971f7b3
+1, 11264, 11264, 1024, 2048, 0xd2ee584e
+1, 12288, 12288, 1024, 2048, 0xf132088c
+0, 70, 70, 1, 259200, 0x7dc2cff7
+1, 13312, 13312, 1024, 2048, 0x1efc0eb1
+0, 80, 80, 1, 259200, 0x8cbc53d5
+1, 14336, 14336, 1024, 2048, 0xeb73f402
+1, 15360, 15360, 1024, 2048, 0x75cb3d20
+0, 90, 90, 1, 259200, 0xcccd77e3
+1, 16384, 16384, 1024, 2048, 0x85a501b6
+1, 17408, 17408, 1024, 2048, 0xa4eb312d
+0, 100, 100, 1, 259200, 0x6b3e0fb3
+1, 18432, 18432, 1024, 2048, 0xf0aaf8c7
+0, 110, 110, 1, 259200, 0x281dd175
+1, 19456, 19456, 1024, 2048, 0x65371cda
+1, 20480, 20480, 1024, 2048, 0x25512cd6
+1, 21504, 21504, 1024, 2048, 0xc81410e3
+1, 22528, 22528, 257, 514, 0x57d77b94
diff --git a/gst-libs/ext/libav/tests/ref/fate/aasc b/gst-libs/ext/libav/tests/ref/fate/aasc
index 7ec02ba..57d59a9 100644
--- a/gst-libs/ext/libav/tests/ref/fate/aasc
+++ b/gst-libs/ext/libav/tests/ref/fate/aasc
@@ -1,23 +1,24 @@
-0, 0, 168000, 0x45addf8f
-0, 3600, 168000, 0x45addf8f
-0, 7200, 168000, 0x45addf8f
-0, 10800, 168000, 0x45addf8f
-0, 14400, 168000, 0x45addf8f
-0, 18000, 168000, 0x45addf8f
-0, 21600, 168000, 0x45addf8f
-0, 25200, 168000, 0x45addf8f
-0, 28800, 168000, 0x45addf8f
-0, 32400, 168000, 0x45addf8f
-0, 36000, 168000, 0x45addf8f
-0, 39600, 168000, 0x45addf8f
-0, 43200, 168000, 0x8730699b
-0, 46800, 168000, 0x08b095df
-0, 50400, 168000, 0x203526e3
-0, 54000, 168000, 0x0ebc5142
-0, 57600, 168000, 0xd168e7c2
-0, 61200, 168000, 0xcc7da0e6
-0, 64800, 168000, 0x72ac60b8
-0, 68400, 168000, 0xb691e27c
-0, 72000, 168000, 0x646fa087
-0, 75600, 168000, 0x404450a2
-0, 79200, 168000, 0x5214c456
+#tb 0: 1/25
+0, 0, 0, 1, 168000, 0x00000000
+0, 1, 1, 1, 168000, 0x00000000
+0, 2, 2, 1, 168000, 0x00000000
+0, 3, 3, 1, 168000, 0x00000000
+0, 4, 4, 1, 168000, 0x00000000
+0, 5, 5, 1, 168000, 0x00000000
+0, 6, 6, 1, 168000, 0x00000000
+0, 7, 7, 1, 168000, 0x00000000
+0, 8, 8, 1, 168000, 0x00000000
+0, 9, 9, 1, 168000, 0x00000000
+0, 10, 10, 1, 168000, 0x00000000
+0, 11, 11, 1, 168000, 0x00000000
+0, 12, 12, 1, 168000, 0xa6298d46
+0, 13, 13, 1, 168000, 0x5d89d96c
+0, 14, 14, 1, 168000, 0x16d994da
+0, 15, 15, 1, 168000, 0xa8c6079b
+0, 16, 16, 1, 168000, 0xdd1decac
+0, 17, 17, 1, 168000, 0x6a96003c
+0, 18, 18, 1, 168000, 0xef7f1ff4
+0, 19, 19, 1, 168000, 0x90dc0126
+0, 20, 20, 1, 168000, 0x7a2b1006
+0, 21, 21, 1, 168000, 0xc7ca1345
+0, 22, 22, 1, 168000, 0x8841c413
diff --git a/gst-libs/ext/libav/tests/ref/fate/adpcm-ea-1 b/gst-libs/ext/libav/tests/ref/fate/adpcm-ea-1
new file mode 100644
index 0000000..f5a33df
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/adpcm-ea-1
@@ -0,0 +1,26 @@
+#tb 0: 1/22050
+0, 0, 0, 1484, 5936, 0x00000000
+0, 1484, 1484, 1456, 5824, 0x00000000
+0, 2940, 2940, 1484, 5936, 0x00000000
+0, 4424, 4424, 1456, 5824, 0x00000000
+0, 5880, 5880, 1484, 5936, 0x00000000
+0, 7364, 7364, 1456, 5824, 0x00000000
+0, 8820, 8820, 1484, 5936, 0x00000000
+0, 10304, 10304, 1456, 5824, 0x0f06f5bb
+0, 11760, 11760, 1484, 5936, 0xb0dbfc46
+0, 13244, 13244, 1456, 5824, 0x9daa9f9c
+0, 14700, 14700, 1484, 5936, 0x61400d2f
+0, 16184, 16184, 1456, 5824, 0x34a5b0e3
+0, 17640, 17640, 1484, 5936, 0x6e546f72
+0, 19124, 19124, 1456, 5824, 0x4f093b35
+0, 20580, 20580, 1484, 5936, 0x95b5b599
+0, 22064, 22064, 1456, 5824, 0x75e15e60
+0, 23520, 23520, 1484, 5936, 0xd1077d39
+0, 25004, 25004, 1456, 5824, 0x956e21ca
+0, 26460, 26460, 1484, 5936, 0x33bac234
+0, 27944, 27944, 1456, 5824, 0x5df37824
+0, 29400, 29400, 1484, 5936, 0xc174af24
+0, 30884, 30884, 1456, 5824, 0xe5dc2159
+0, 32340, 32340, 1484, 5936, 0x63ffc8b1
+0, 33824, 33824, 1456, 5824, 0xefe4c365
+0, 35280, 35280, 1484, 5936, 0x2174304d
diff --git a/gst-libs/ext/libav/tests/ref/fate/adpcm-ea-2 b/gst-libs/ext/libav/tests/ref/fate/adpcm-ea-2
new file mode 100644
index 0000000..f58d9a0
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/adpcm-ea-2
@@ -0,0 +1,134 @@
+#tb 0: 1/22050
+0, 0, 0, 1484, 5936, 0xea261a29
+0, 1484, 1484, 1456, 5824, 0x253df061
+0, 2940, 2940, 1484, 5936, 0x603a5bd7
+0, 4424, 4424, 1456, 5824, 0x9d283f59
+0, 5880, 5880, 1484, 5936, 0x49323497
+0, 7364, 7364, 1456, 5824, 0x7c299939
+0, 8820, 8820, 1484, 5936, 0x9f918e9a
+0, 10304, 10304, 1456, 5824, 0x1226b534
+0, 11760, 11760, 1484, 5936, 0xdd159326
+0, 13244, 13244, 1456, 5824, 0x361ad10f
+0, 14700, 14700, 1484, 5936, 0x6ccac9e3
+0, 16184, 16184, 1456, 5824, 0x1861efef
+0, 17640, 17640, 1484, 5936, 0x5f718eb9
+0, 19124, 19124, 1456, 5824, 0xd4ca72ba
+0, 20580, 20580, 1484, 5936, 0xbf2b27e6
+0, 22064, 22064, 1456, 5824, 0xcb6f024e
+0, 23520, 23520, 1484, 5936, 0x7dfb7e05
+0, 25004, 25004, 1456, 5824, 0x80e16f13
+0, 26460, 26460, 1484, 5936, 0x0fb59227
+0, 27944, 27944, 1456, 5824, 0x4d6f1fdb
+0, 29400, 29400, 1484, 5936, 0x505a5103
+0, 30884, 30884, 1456, 5824, 0x47ef4c13
+0, 32340, 32340, 1484, 5936, 0xbe4795fb
+0, 33824, 33824, 1456, 5824, 0xb82cc4ff
+0, 35280, 35280, 1484, 5936, 0xf7c6ab8d
+0, 36764, 36764, 1456, 5824, 0x1442f5e0
+0, 38220, 38220, 1484, 5936, 0x64659389
+0, 39704, 39704, 1456, 5824, 0xdd81725c
+0, 41160, 41160, 1484, 5936, 0x7f7c604f
+0, 42644, 42644, 1456, 5824, 0xafc77beb
+0, 44100, 44100, 1484, 5936, 0x24f88e4d
+0, 45584, 45584, 1456, 5824, 0xa31956ca
+0, 47040, 47040, 1484, 5936, 0x958e02b9
+0, 48524, 48524, 1456, 5824, 0xcfc79890
+0, 49980, 49980, 1484, 5936, 0xc7e788ae
+0, 51464, 51464, 1456, 5824, 0x4b6b1acc
+0, 52920, 52920, 1484, 5936, 0xa74496dc
+0, 54404, 54404, 1456, 5824, 0x719e6171
+0, 55860, 55860, 1484, 5936, 0x9346222d
+0, 57344, 57344, 1456, 5824, 0x9e2a876e
+0, 58800, 58800, 1484, 5936, 0xeca6ea64
+0, 60284, 60284, 1456, 5824, 0x07d8174f
+0, 61740, 61740, 1484, 5936, 0x2df5aa6b
+0, 63224, 63224, 1456, 5824, 0x314e7034
+0, 64680, 64680, 1484, 5936, 0x5a328768
+0, 66164, 66164, 1456, 5824, 0x32b92446
+0, 67620, 67620, 1484, 5936, 0x20ecbc9b
+0, 69104, 69104, 1456, 5824, 0x76019c14
+0, 70560, 70560, 1484, 5936, 0x8c3ef8a6
+0, 72044, 72044, 1456, 5824, 0xcdaab50b
+0, 73500, 73500, 1484, 5936, 0xb2f87f4f
+0, 74984, 74984, 1456, 5824, 0x70c26379
+0, 76440, 76440, 1484, 5936, 0x5691ecfd
+0, 77924, 77924, 1456, 5824, 0x61e208fe
+0, 79380, 79380, 1484, 5936, 0x87d1a5e0
+0, 80864, 80864, 1456, 5824, 0x02054cfd
+0, 82320, 82320, 1484, 5936, 0x22ff1c4b
+0, 83804, 83804, 1456, 5824, 0xc6d87fef
+0, 85260, 85260, 1484, 5936, 0x9028bb3b
+0, 86744, 86744, 1456, 5824, 0xbadde406
+0, 88200, 88200, 1484, 5936, 0x6e88ddf1
+0, 89684, 89684, 1456, 5824, 0x5bb8be6e
+0, 91140, 91140, 1484, 5936, 0xe1f8d7fc
+0, 92624, 92624, 1456, 5824, 0xc824e388
+0, 94080, 94080, 1484, 5936, 0x654371a9
+0, 95564, 95564, 1456, 5824, 0xae6ee9ec
+0, 97020, 97020, 1484, 5936, 0x9aa4550d
+0, 98504, 98504, 1456, 5824, 0xdce210ac
+0, 99960, 99960, 1484, 5936, 0xb12641c8
+0, 101444, 101444, 1456, 5824, 0x277e014b
+0, 102900, 102900, 1484, 5936, 0xb0d262de
+0, 104384, 104384, 1456, 5824, 0xf94d6f49
+0, 105840, 105840, 1484, 5936, 0x3d7848cb
+0, 107324, 107324, 1456, 5824, 0xe67fc08e
+0, 108780, 108780, 1484, 5936, 0x0475e0d6
+0, 110264, 110264, 1456, 5824, 0x8a9a4a2e
+0, 111720, 111720, 1484, 5936, 0x82576204
+0, 113204, 113204, 1456, 5824, 0x3017b648
+0, 114660, 114660, 1484, 5936, 0xca4c3e04
+0, 116144, 116144, 1456, 5824, 0x340077d1
+0, 117600, 117600, 1484, 5936, 0x805bea6e
+0, 119084, 119084, 1456, 5824, 0x2cf6c87b
+0, 120540, 120540, 1484, 5936, 0x3635bc5f
+0, 122024, 122024, 1456, 5824, 0x0d7a81c7
+0, 123480, 123480, 1484, 5936, 0x26179764
+0, 124964, 124964, 1456, 5824, 0xa0b2454f
+0, 126420, 126420, 1484, 5936, 0x91d24608
+0, 127904, 127904, 1456, 5824, 0x6509b3e1
+0, 129360, 129360, 1484, 5936, 0xa0e3c9fc
+0, 130844, 130844, 1456, 5824, 0x18682a2f
+0, 132300, 132300, 1484, 5936, 0x89cea4ff
+0, 133784, 133784, 1456, 5824, 0x7dd22b85
+0, 135240, 135240, 1484, 5936, 0x8b2eeb8d
+0, 136724, 136724, 1456, 5824, 0x0c21af82
+0, 138180, 138180, 1484, 5936, 0x9c5a748d
+0, 139664, 139664, 1456, 5824, 0x1dc72c5c
+0, 141120, 141120, 1484, 5936, 0xe6129383
+0, 142604, 142604, 1456, 5824, 0x0a44312a
+0, 144060, 144060, 1484, 5936, 0x7ed30640
+0, 145544, 145544, 1456, 5824, 0xede15f25
+0, 147000, 147000, 1484, 5936, 0x0096d0f3
+0, 148484, 148484, 1456, 5824, 0x13764b4b
+0, 149940, 149940, 1484, 5936, 0xd4608756
+0, 151424, 151424, 1456, 5824, 0x254b5f2a
+0, 152880, 152880, 1484, 5936, 0x7705b830
+0, 154364, 154364, 1456, 5824, 0x64a63d78
+0, 155820, 155820, 1484, 5936, 0xc02d81a6
+0, 157304, 157304, 1456, 5824, 0xd239e55e
+0, 158760, 158760, 1484, 5936, 0x8018cd3a
+0, 160244, 160244, 1456, 5824, 0xf86b8a98
+0, 161700, 161700, 1484, 5936, 0x2a0078bc
+0, 163184, 163184, 1456, 5824, 0x058d4e1b
+0, 164640, 164640, 1484, 5936, 0xbc718309
+0, 166124, 166124, 1456, 5824, 0xaf6c29e5
+0, 167580, 167580, 1484, 5936, 0x80df004d
+0, 169064, 169064, 1456, 5824, 0xeca5aa57
+0, 170520, 170520, 1484, 5936, 0xb793a8f8
+0, 172004, 172004, 1456, 5824, 0x70fa6aff
+0, 173460, 173460, 1484, 5936, 0xda8d4cc6
+0, 174944, 174944, 1456, 5824, 0xa70088eb
+0, 176400, 176400, 1484, 5936, 0x1c0b0aab
+0, 177884, 177884, 1456, 5824, 0x234d2436
+0, 179340, 179340, 1484, 5936, 0xf79d731e
+0, 180824, 180824, 1456, 5824, 0x5a4e454a
+0, 182280, 182280, 1484, 5936, 0xccf6d042
+0, 183764, 183764, 1456, 5824, 0x4e524d14
+0, 185220, 185220, 1484, 5936, 0xf8f2fcc3
+0, 186704, 186704, 1456, 5824, 0x08f12491
+0, 188160, 188160, 1484, 5936, 0x506e0a42
+0, 189644, 189644, 1456, 5824, 0x7cf05049
+0, 191100, 191100, 1484, 5936, 0xdeb9d295
+0, 192584, 192584, 1456, 5824, 0x758ef642
+0, 194040, 194040, 1484, 5936, 0x91903980
diff --git a/gst-libs/ext/libav/tests/ref/fate/adpcm-ea-mad-ea-r1 b/gst-libs/ext/libav/tests/ref/fate/adpcm-ea-mad-ea-r1
deleted file mode 100644
index b75de55..0000000
--- a/gst-libs/ext/libav/tests/ref/fate/adpcm-ea-mad-ea-r1
+++ /dev/null
@@ -1,191 +0,0 @@
-0, 0, 535680, 0x889c32cf
-1, 0, 6496, 0x00000000
-0, 2970, 535680, 0x0b1ef044
-1, 3045, 6384, 0x00000000
-0, 5940, 535680, 0xa7d0818b
-1, 6038, 6384, 0x00000000
-0, 8910, 535680, 0xf392e4e1
-1, 9030, 6384, 0x00000000
-0, 11880, 535680, 0x08480c69
-1, 12023, 6384, 0x00000000
-0, 14850, 535680, 0x2b8af1ed
-1, 15015, 6496, 0xe2034d04
-0, 17820, 535680, 0x0d58e062
-1, 18060, 6384, 0x089c9157
-0, 20790, 535680, 0xd140ced0
-1, 21053, 6384, 0xeed5743c
-0, 23760, 535680, 0xbd0e6652
-1, 24045, 6384, 0x71de6b34
-0, 26730, 535680, 0xdc2f2a6b
-1, 27038, 6384, 0xc0d67710
-0, 29700, 535680, 0x97c31a38
-1, 30030, 6496, 0x35786490
-0, 32670, 535680, 0x1a2bdf38
-1, 33075, 6384, 0xdf1c99a2
-0, 35640, 535680, 0xb3af3ac4
-1, 36068, 6384, 0xca9591ad
-0, 38610, 535680, 0x07a52577
-1, 39060, 6384, 0x6f0d9c3d
-0, 41580, 535680, 0x78407368
-1, 42053, 6384, 0xfacbbaee
-0, 44550, 535680, 0xd2a9efc3
-1, 45045, 6496, 0x927fb136
-0, 47520, 535680, 0x36df2f29
-1, 48090, 6384, 0x9d4f2572
-0, 50490, 535680, 0x9821d8f7
-1, 51083, 6384, 0x2a3c6d08
-0, 53460, 535680, 0xf64321aa
-1, 54075, 6384, 0x4282b1e0
-0, 56430, 535680, 0x53e4d9aa
-1, 57068, 6384, 0xc4a77b9f
-0, 59400, 535680, 0xdbd6f853
-1, 60060, 6496, 0x2af6a14f
-0, 62370, 535680, 0x5d40cf8b
-1, 63105, 6384, 0x4d734169
-0, 65340, 535680, 0xe624af9d
-1, 66098, 6384, 0xb91b5865
-0, 68310, 535680, 0xd9dbb4cd
-1, 69090, 6384, 0x9dce2417
-0, 71280, 535680, 0xf14e72ec
-1, 72083, 6384, 0xb7c4e1ce
-0, 74250, 535680, 0xb35c18f6
-1, 75075, 6496, 0xef0dc07a
-0, 77220, 535680, 0xc96d7757
-1, 78120, 6384, 0x4ad21d10
-0, 80190, 535680, 0xdfb937df
-1, 81113, 6384, 0xcfe14682
-0, 83160, 535680, 0x40cd71d7
-1, 84105, 6384, 0x07be48eb
-0, 86130, 535680, 0x15e176d6
-1, 87098, 6384, 0x09de3498
-0, 89100, 535680, 0x7f891b24
-1, 90090, 6496, 0xab2e9686
-0, 92070, 535680, 0xb87a8c32
-1, 93135, 6384, 0x3aba3ccc
-0, 95040, 535680, 0x0c01541f
-1, 96128, 6384, 0x0a905ec3
-0, 98010, 535680, 0x9eee99b3
-1, 99120, 6384, 0x76a93ce4
-0, 100980, 535680, 0xd65eb689
-1, 102113, 6384, 0xa99063a4
-0, 103950, 535680, 0x6e733cfa
-1, 105105, 6496, 0xc16bb88d
-0, 106920, 535680, 0xac536670
-1, 108150, 6384, 0x650379bf
-0, 109890, 535680, 0x002275b8
-1, 111143, 6384, 0x4e0749fe
-0, 112860, 535680, 0x6a5385cb
-1, 114135, 6384, 0x778e8d12
-0, 115830, 535680, 0xd129ade3
-1, 117128, 6384, 0x9fa8c494
-0, 118800, 535680, 0x32cab5d7
-1, 120120, 6496, 0x61d5bead
-0, 121770, 535680, 0x08be1c8f
-1, 123165, 6384, 0x4da9bc3c
-0, 124740, 535680, 0x59e1fba0
-1, 126158, 6384, 0xa72b6f93
-0, 127710, 535680, 0x138aee3a
-1, 129150, 6384, 0x811f5f77
-0, 130680, 535680, 0x4cfbcd5e
-1, 132143, 6384, 0x83ea5e3d
-0, 133650, 535680, 0xf6cf0fb4
-1, 135135, 6496, 0x78bab460
-0, 136620, 535680, 0xb13a06de
-1, 138180, 6384, 0xc9a07432
-0, 139590, 535680, 0x59176f00
-1, 141173, 6384, 0x4b4f2a34
-0, 142560, 535680, 0xf84b4ca3
-1, 144165, 6384, 0x4d707a53
-0, 145530, 535680, 0x7fd09f73
-1, 147158, 6384, 0x703efb60
-0, 148500, 535680, 0x3be383b8
-1, 150150, 6496, 0x319a77bb
-0, 151470, 535680, 0xa7118e51
-1, 153195, 6384, 0xbdfd82ec
-0, 154440, 535680, 0xbd83120c
-1, 156188, 6384, 0x413c3503
-0, 157410, 535680, 0x3bc9d256
-1, 159180, 6384, 0xe6e666b3
-0, 160380, 535680, 0xb6c87f87
-1, 162173, 6384, 0xa09c7342
-0, 163350, 535680, 0xe80d110a
-1, 165165, 6496, 0x60cba846
-0, 166320, 535680, 0xb3a83362
-1, 168210, 6384, 0x0ba34308
-0, 169290, 535680, 0xfb39eb52
-1, 171203, 6384, 0xdc3a65f0
-0, 172260, 535680, 0xbf6e1220
-1, 174195, 6384, 0x1ebf9dc4
-0, 175230, 535680, 0x9ecdfbae
-1, 177188, 6384, 0xbbcb1449
-0, 178200, 535680, 0x069a65f5
-1, 180180, 6496, 0x926574eb
-0, 181170, 535680, 0x206e372c
-1, 183225, 6384, 0xb4da92f1
-0, 184140, 535680, 0x58c83dd4
-1, 186218, 6384, 0xdbbd21e0
-0, 187110, 535680, 0xc3562b03
-1, 189210, 6384, 0x08510eff
-0, 190080, 535680, 0xd1ed85a0
-1, 192203, 6384, 0x9534b7ca
-0, 193050, 535680, 0xb6205f4b
-1, 195195, 6496, 0x50a5ed30
-0, 196020, 535680, 0xaedf8bfa
-1, 198240, 6384, 0xf5ac2f7c
-0, 198990, 535680, 0xa48d5dea
-1, 201233, 6384, 0x4fe1fa55
-0, 201960, 535680, 0xff82e7c1
-1, 204225, 6384, 0xd61c4c05
-0, 204930, 535680, 0xc9560222
-1, 207218, 6384, 0x56d11b45
-0, 207900, 535680, 0x0fafa549
-1, 210210, 6496, 0x3906084b
-0, 210870, 535680, 0x8d556ccb
-1, 213255, 6384, 0x1ef31fed
-0, 213840, 535680, 0x802aac1f
-1, 216248, 6384, 0x58ed82f5
-0, 216810, 535680, 0x7d0fa168
-1, 219240, 6384, 0xb31ccd1f
-0, 219780, 535680, 0x1a9255c9
-1, 222233, 6384, 0xfb648285
-0, 222750, 535680, 0xb4ec7e35
-1, 225225, 6496, 0xfae2950b
-0, 225720, 535680, 0x48fac072
-1, 228270, 6384, 0xe28c8357
-0, 228690, 535680, 0x1e260135
-1, 231263, 6384, 0xda718e60
-0, 231660, 535680, 0xce4d5079
-1, 234255, 6384, 0x27516999
-0, 234630, 535680, 0x13e5e4ed
-1, 237248, 6384, 0x0ba07921
-0, 237600, 535680, 0x592305ec
-1, 240240, 6496, 0xcfbecfab
-0, 240570, 535680, 0x9e227508
-1, 243285, 6384, 0xae4cedcd
-0, 243540, 535680, 0x1d37e5ea
-1, 246278, 6384, 0x917b4707
-0, 246510, 535680, 0x7eae7692
-1, 249270, 6384, 0x8671b28e
-0, 249480, 535680, 0xf452e4b9
-1, 252263, 6384, 0x9a1238fa
-0, 252450, 535680, 0x1460e7e9
-1, 255255, 6496, 0x23b8f8ca
-0, 255420, 535680, 0xc6d8a638
-1, 258300, 6384, 0x3903bcd6
-0, 258390, 535680, 0x854f5fb0
-1, 261293, 6384, 0x0532b267
-0, 261360, 535680, 0x854f5fb0
-1, 264285, 6384, 0xde931220
-0, 264330, 535680, 0x70a02d87
-1, 267278, 6384, 0x4ed70a80
-0, 267300, 535680, 0x9a4ad464
-0, 270270, 535680, 0x9a4ad464
-1, 270270, 6496, 0x4a52d5a1
-0, 273240, 535680, 0x9a4ad464
-1, 273315, 6384, 0xc1be5760
-0, 276210, 535680, 0x9a4ad464
-1, 276308, 6384, 0x790d69ba
-0, 279180, 535680, 0x9a4ad464
-1, 279300, 6384, 0x9d73e6cf
-0, 282150, 535680, 0x9a4ad464
-1, 282293, 6272, 0xbc0fc725
diff --git a/gst-libs/ext/libav/tests/ref/fate/adpcm-ea-maxis-xa b/gst-libs/ext/libav/tests/ref/fate/adpcm-ea-maxis-xa
new file mode 100644
index 0000000..5d6b5c0
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/adpcm-ea-maxis-xa
@@ -0,0 +1,31 @@
+#tb 0: 1/22050
+0, 0, 0, 28, 112, 0x291d1be4
+0, 28, 28, 28, 112, 0xf08d33cc
+0, 56, 56, 28, 112, 0x5b1521de
+0, 84, 84, 28, 112, 0x57d209f6
+0, 112, 112, 28, 112, 0x00000000
+0, 140, 140, 28, 112, 0xa15e03fc
+0, 168, 168, 28, 112, 0x73a80bf4
+0, 196, 196, 28, 112, 0x916e03fc
+0, 224, 224, 28, 112, 0xd92603fc
+0, 252, 252, 28, 112, 0x097523dc
+0, 280, 280, 28, 112, 0xf7be45ba
+0, 308, 308, 28, 112, 0x0fed4db2
+0, 336, 336, 28, 112, 0x9fb41be4
+0, 364, 364, 28, 112, 0x819a0ff0
+0, 392, 392, 28, 112, 0xfe7f3fc0
+0, 420, 420, 28, 112, 0x281e1de2
+0, 448, 448, 28, 112, 0xa76605fa
+0, 476, 476, 28, 112, 0x00000000
+0, 504, 504, 28, 112, 0xb84705fa
+0, 532, 532, 28, 112, 0xdb5c0ff0
+0, 560, 560, 28, 112, 0xbc4305fa
+0, 588, 588, 28, 112, 0x7c8305fa
+0, 616, 616, 28, 112, 0x54ff21de
+0, 644, 644, 28, 112, 0xc6c535ca
+0, 672, 672, 28, 112, 0xa4123dc2
+0, 700, 700, 28, 112, 0x196523dc
+0, 728, 728, 28, 112, 0x80ef25da
+0, 756, 756, 28, 112, 0xdf742bd4
+0, 784, 784, 28, 112, 0xd78a21de
+0, 812, 812, 28, 112, 0x191f0df2
diff --git a/gst-libs/ext/libav/tests/ref/fate/adpcm-ea-r1 b/gst-libs/ext/libav/tests/ref/fate/adpcm-ea-r1
new file mode 100644
index 0000000..74d15c6
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/adpcm-ea-r1
@@ -0,0 +1,96 @@
+#tb 0: 1/48000
+0, 0, 0, 1624, 6496, 0x00000000
+0, 1624, 1624, 1596, 6384, 0x00000000
+0, 3220, 3220, 1596, 6384, 0x00000000
+0, 4816, 4816, 1596, 6384, 0x00000000
+0, 6412, 6412, 1596, 6384, 0x00000000
+0, 8008, 8008, 1624, 6496, 0xe2034d04
+0, 9632, 9632, 1596, 6384, 0x089c9157
+0, 11228, 11228, 1596, 6384, 0xeed5743c
+0, 12824, 12824, 1596, 6384, 0x71de6b34
+0, 14420, 14420, 1596, 6384, 0xc0d67710
+0, 16016, 16016, 1624, 6496, 0x35786490
+0, 17640, 17640, 1596, 6384, 0xdf1c99a2
+0, 19236, 19236, 1596, 6384, 0xca9591ad
+0, 20832, 20832, 1596, 6384, 0x6f0d9c3d
+0, 22428, 22428, 1596, 6384, 0xfacbbaee
+0, 24024, 24024, 1624, 6496, 0x927fb136
+0, 25648, 25648, 1596, 6384, 0x9d4f2572
+0, 27244, 27244, 1596, 6384, 0x2a3c6d08
+0, 28840, 28840, 1596, 6384, 0x4282b1e0
+0, 30436, 30436, 1596, 6384, 0xc4a77b9f
+0, 32032, 32032, 1624, 6496, 0x2af6a14f
+0, 33656, 33656, 1596, 6384, 0x4d734169
+0, 35252, 35252, 1596, 6384, 0xb91b5865
+0, 36848, 36848, 1596, 6384, 0x9dce2417
+0, 38444, 38444, 1596, 6384, 0xb7c4e1ce
+0, 40040, 40040, 1624, 6496, 0xef0dc07a
+0, 41664, 41664, 1596, 6384, 0x4ad21d10
+0, 43260, 43260, 1596, 6384, 0xcfe14682
+0, 44856, 44856, 1596, 6384, 0x07be48eb
+0, 46452, 46452, 1596, 6384, 0x09de3498
+0, 48048, 48048, 1624, 6496, 0xab2e9686
+0, 49672, 49672, 1596, 6384, 0x3aba3ccc
+0, 51268, 51268, 1596, 6384, 0x0a905ec3
+0, 52864, 52864, 1596, 6384, 0x76a93ce4
+0, 54460, 54460, 1596, 6384, 0xa99063a4
+0, 56056, 56056, 1624, 6496, 0xc16bb88d
+0, 57680, 57680, 1596, 6384, 0x650379bf
+0, 59276, 59276, 1596, 6384, 0x4e0749fe
+0, 60872, 60872, 1596, 6384, 0x778e8d12
+0, 62468, 62468, 1596, 6384, 0x9fa8c494
+0, 64064, 64064, 1624, 6496, 0x61d5bead
+0, 65688, 65688, 1596, 6384, 0x4da9bc3c
+0, 67284, 67284, 1596, 6384, 0xa72b6f93
+0, 68880, 68880, 1596, 6384, 0x811f5f77
+0, 70476, 70476, 1596, 6384, 0x83ea5e3d
+0, 72072, 72072, 1624, 6496, 0x78bab460
+0, 73696, 73696, 1596, 6384, 0xc9a07432
+0, 75292, 75292, 1596, 6384, 0x4b4f2a34
+0, 76888, 76888, 1596, 6384, 0x4d707a53
+0, 78484, 78484, 1596, 6384, 0x703efb60
+0, 80080, 80080, 1624, 6496, 0x319a77bb
+0, 81704, 81704, 1596, 6384, 0xbdfd82ec
+0, 83300, 83300, 1596, 6384, 0x413c3503
+0, 84896, 84896, 1596, 6384, 0xe6e666b3
+0, 86492, 86492, 1596, 6384, 0xa09c7342
+0, 88088, 88088, 1624, 6496, 0x60cba846
+0, 89712, 89712, 1596, 6384, 0x0ba34308
+0, 91308, 91308, 1596, 6384, 0xdc3a65f0
+0, 92904, 92904, 1596, 6384, 0x1ebf9dc4
+0, 94500, 94500, 1596, 6384, 0xbbcb1449
+0, 96096, 96096, 1624, 6496, 0x926574eb
+0, 97720, 97720, 1596, 6384, 0xb4da92f1
+0, 99316, 99316, 1596, 6384, 0xdbbd21e0
+0, 100912, 100912, 1596, 6384, 0x08510eff
+0, 102508, 102508, 1596, 6384, 0x9534b7ca
+0, 104104, 104104, 1624, 6496, 0x50a5ed30
+0, 105728, 105728, 1596, 6384, 0xf5ac2f7c
+0, 107324, 107324, 1596, 6384, 0x4fe1fa55
+0, 108920, 108920, 1596, 6384, 0xd61c4c05
+0, 110516, 110516, 1596, 6384, 0x56d11b45
+0, 112112, 112112, 1624, 6496, 0x3906084b
+0, 113736, 113736, 1596, 6384, 0x1ef31fed
+0, 115332, 115332, 1596, 6384, 0x58ed82f5
+0, 116928, 116928, 1596, 6384, 0xb31ccd1f
+0, 118524, 118524, 1596, 6384, 0xfb648285
+0, 120120, 120120, 1624, 6496, 0xfae2950b
+0, 121744, 121744, 1596, 6384, 0xe28c8357
+0, 123340, 123340, 1596, 6384, 0xda718e60
+0, 124936, 124936, 1596, 6384, 0x27516999
+0, 126532, 126532, 1596, 6384, 0x0ba07921
+0, 128128, 128128, 1624, 6496, 0xcfbecfab
+0, 129752, 129752, 1596, 6384, 0xae4cedcd
+0, 131348, 131348, 1596, 6384, 0x917b4707
+0, 132944, 132944, 1596, 6384, 0x8671b28e
+0, 134540, 134540, 1596, 6384, 0x9a1238fa
+0, 136136, 136136, 1624, 6496, 0x23b8f8ca
+0, 137760, 137760, 1596, 6384, 0x3903bcd6
+0, 139356, 139356, 1596, 6384, 0x0532b267
+0, 140952, 140952, 1596, 6384, 0xde931220
+0, 142548, 142548, 1596, 6384, 0x4ed70a80
+0, 144144, 144144, 1624, 6496, 0x4a52d5a1
+0, 145768, 145768, 1596, 6384, 0xc1be5760
+0, 147364, 147364, 1596, 6384, 0x790d69ba
+0, 148960, 148960, 1596, 6384, 0x9d73e6cf
+0, 150556, 150556, 1568, 6272, 0xbc0fc725
diff --git a/gst-libs/ext/libav/tests/ref/fate/adpcm-ea-tqi b/gst-libs/ext/libav/tests/ref/fate/adpcm-ea-tqi
deleted file mode 100644
index 4fbc117..0000000
--- a/gst-libs/ext/libav/tests/ref/fate/adpcm-ea-tqi
+++ /dev/null
@@ -1,51 +0,0 @@
-0, 0, 115200, 0x375ec573
-1, 0, 5936, 0x00000000
-0, 6000, 115200, 0x375ec573
-1, 6057, 5824, 0x00000000
-0, 12000, 115200, 0x375ec573
-1, 12000, 5936, 0x00000000
-0, 18000, 115200, 0x375ec573
-1, 18057, 5824, 0x00000000
-0, 24000, 115200, 0x375ec573
-1, 24000, 5936, 0x00000000
-0, 30000, 115200, 0x375ec573
-1, 30057, 5824, 0x00000000
-0, 36000, 115200, 0x375ec573
-1, 36000, 5936, 0x00000000
-0, 42000, 115200, 0x375ec573
-1, 42057, 5824, 0x0f06f5bb
-0, 48000, 115200, 0x0b4d31bf
-1, 48000, 5936, 0xb0dbfc46
-0, 54000, 115200, 0xdd724598
-1, 54057, 5824, 0x9daa9f9c
-0, 60000, 115200, 0xc3077e75
-1, 60000, 5936, 0x61400d2f
-0, 66000, 115200, 0xbf70778a
-1, 66057, 5824, 0x34a5b0e3
-0, 72000, 115200, 0x117eb766
-1, 72000, 5936, 0x6e546f72
-0, 78000, 115200, 0x4617fbad
-1, 78057, 5824, 0x4f093b35
-0, 84000, 115200, 0x5f5b02d2
-1, 84000, 5936, 0x95b5b599
-0, 90000, 115200, 0x2a9c5325
-1, 90057, 5824, 0x75e15e60
-0, 96000, 115200, 0x14a89e2a
-1, 96000, 5936, 0xd1077d39
-0, 102000, 115200, 0xe69aa994
-1, 102057, 5824, 0x956e21ca
-0, 108000, 115200, 0xfbacf589
-1, 108000, 5936, 0x33bac234
-0, 114000, 115200, 0x1d714c6e
-1, 114057, 5824, 0x5df37824
-0, 120000, 115200, 0x6eff66cb
-1, 120000, 5936, 0xc174af24
-0, 126000, 115200, 0xee21c1cb
-1, 126057, 5824, 0xe5dc2159
-0, 132000, 115200, 0xce714ada
-1, 132000, 5936, 0x63ffc8b1
-0, 138000, 115200, 0xf89d56c3
-1, 138057, 5824, 0xefe4c365
-0, 144000, 115200, 0x65fd5e60
-1, 144000, 5936, 0x2174304d
-0, 150000, 115200, 0x0c256424
diff --git a/gst-libs/ext/libav/tests/ref/fate/adpcm-ima-amv b/gst-libs/ext/libav/tests/ref/fate/adpcm-ima-amv
new file mode 100644
index 0000000..6c2fa32
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/adpcm-ima-amv
@@ -0,0 +1,161 @@
+#tb 0: 1/22050
+0, 0, 0, 1378, 2756, 0x0af35034
+0, 1378, 1378, 1378, 2756, 0x8462443f
+0, 2756, 2756, 1378, 2756, 0x9f493ba6
+0, 4134, 4134, 1378, 2756, 0x634e5f06
+0, 5513, 5513, 1380, 2760, 0x51f35cd4
+0, 6891, 6891, 1378, 2756, 0x011c51e5
+0, 8269, 8269, 1378, 2756, 0x8c2c198c
+0, 9647, 9647, 1378, 2756, 0x2b4a3397
+0, 11025, 11025, 1378, 2756, 0x63794f22
+0, 12403, 12403, 1378, 2756, 0xfc363898
+0, 13781, 13781, 1378, 2756, 0x0da5486e
+0, 15159, 15159, 1378, 2756, 0xbae17a5f
+0, 16538, 16538, 1380, 2760, 0xba266e1b
+0, 17916, 17916, 1378, 2756, 0xdfb61002
+0, 19294, 19294, 1378, 2756, 0x15d029da
+0, 20672, 20672, 1378, 2756, 0x7bc82012
+0, 22050, 22050, 1378, 2756, 0x002e6999
+0, 23428, 23428, 1378, 2756, 0x96346ba6
+0, 24806, 24806, 1378, 2756, 0x3d54543b
+0, 26184, 26184, 1380, 2760, 0x601786e1
+0, 27563, 27563, 1378, 2756, 0xf22a5793
+0, 28941, 28941, 1378, 2756, 0x21f54d49
+0, 30319, 30319, 1378, 2756, 0x0c6d4399
+0, 31697, 31697, 1378, 2756, 0x17282f8e
+0, 33075, 33075, 1378, 2756, 0xeb698f75
+0, 34453, 34453, 1378, 2756, 0x935e1de2
+0, 35831, 35831, 1380, 2760, 0xb6fb4293
+0, 37209, 37209, 1378, 2756, 0x485053dc
+0, 38588, 38588, 1378, 2756, 0x24c35027
+0, 39966, 39966, 1378, 2756, 0x09f323ee
+0, 41344, 41344, 1378, 2756, 0xbc7d58d5
+0, 42722, 42722, 1378, 2756, 0xaefd487c
+0, 44100, 44100, 1378, 2756, 0xaca16cc0
+0, 45478, 45478, 1380, 2760, 0x98a76091
+0, 46856, 46856, 1378, 2756, 0x5d357141
+0, 48234, 48234, 1378, 2756, 0x65ea2657
+0, 49613, 49613, 1378, 2756, 0xb5e1334a
+0, 50991, 50991, 1378, 2756, 0x32cd5d91
+0, 52369, 52369, 1378, 2756, 0xdc23722b
+0, 53747, 53747, 1378, 2756, 0x2ba34684
+0, 55125, 55125, 1378, 2756, 0xf9755ba8
+0, 56503, 56503, 1380, 2760, 0x24221ddb
+0, 57881, 57881, 1378, 2756, 0xef843aa4
+0, 59259, 59259, 1378, 2756, 0x420442fe
+0, 60638, 60638, 1378, 2756, 0x5a0933cb
+0, 62016, 62016, 1378, 2756, 0xef5f6d61
+0, 63394, 63394, 1378, 2756, 0xe57e6dc0
+0, 64772, 64772, 1378, 2756, 0xc0f0495a
+0, 66150, 66150, 1380, 2760, 0x2c3b55df
+0, 67528, 67528, 1378, 2756, 0x39c2586c
+0, 68906, 68906, 1378, 2756, 0x7ffc46e5
+0, 70284, 70284, 1378, 2756, 0xa2766664
+0, 71663, 71663, 1378, 2756, 0xacb50c6c
+0, 73041, 73041, 1378, 2756, 0x7f659084
+0, 74419, 74419, 1378, 2756, 0xc72e6a12
+0, 75797, 75797, 1380, 2760, 0xdb6944df
+0, 77175, 77175, 1378, 2756, 0x954f45c1
+0, 78553, 78553, 1378, 2756, 0xa9484240
+0, 79931, 79931, 1378, 2756, 0x1d595349
+0, 81309, 81309, 1378, 2756, 0xcf2a565e
+0, 82688, 82688, 1378, 2756, 0x391028d5
+0, 84066, 84066, 1378, 2756, 0x348db7ad
+0, 85444, 85444, 1380, 2760, 0xb69b5e3a
+0, 86822, 86822, 1378, 2756, 0xe3635fbe
+0, 88200, 88200, 1378, 2756, 0xdcad3654
+0, 89578, 89578, 1378, 2756, 0x5c17abef
+0, 90956, 90956, 1378, 2756, 0xb3235184
+0, 92334, 92334, 1378, 2756, 0xdabb64a6
+0, 93713, 93713, 1378, 2756, 0xa95dc58d
+0, 95091, 95091, 1380, 2760, 0x8e7ac9eb
+0, 96469, 96469, 1378, 2756, 0x492b658e
+0, 97847, 97847, 1378, 2756, 0x377483ab
+0, 99225, 99225, 1378, 2756, 0x2c250279
+0, 100603, 100603, 1378, 2756, 0x704dbdb3
+0, 101981, 101981, 1378, 2756, 0x800d7da2
+0, 103359, 103359, 1378, 2756, 0x872aa32e
+0, 104738, 104738, 1378, 2756, 0x2d4837fe
+0, 106116, 106116, 1380, 2760, 0xc89ea57e
+0, 107494, 107494, 1378, 2756, 0x6447d7ef
+0, 108872, 108872, 1378, 2756, 0x144f59cc
+0, 110250, 110250, 1378, 2756, 0xc667154e
+0, 111628, 111628, 1378, 2756, 0xf0de66ae
+0, 113006, 113006, 1378, 2756, 0xeabf3c32
+0, 114384, 114384, 1378, 2756, 0xe98e81d1
+0, 115763, 115763, 1380, 2760, 0x56aa5889
+0, 117141, 117141, 1378, 2756, 0x4fd34c0e
+0, 118519, 118519, 1378, 2756, 0x67cf6912
+0, 119897, 119897, 1378, 2756, 0xfa944def
+0, 121275, 121275, 1378, 2756, 0xc12f23b2
+0, 122653, 122653, 1378, 2756, 0x5ea325a2
+0, 124031, 124031, 1378, 2756, 0x2b245824
+0, 125409, 125409, 1380, 2760, 0x90ac533e
+0, 126788, 126788, 1378, 2756, 0xcca34d26
+0, 128166, 128166, 1378, 2756, 0xb5f820d0
+0, 129544, 129544, 1378, 2756, 0x27f24335
+0, 130922, 130922, 1378, 2756, 0x4a9e87b7
+0, 132300, 132300, 1378, 2756, 0xbd076129
+0, 133678, 133678, 1378, 2756, 0x2e0e3f2e
+0, 135056, 135056, 1380, 2760, 0xdf534478
+0, 136434, 136434, 1378, 2756, 0xca000a2e
+0, 137813, 137813, 1378, 2756, 0x87472df3
+0, 139191, 139191, 1378, 2756, 0x16733810
+0, 140569, 140569, 1378, 2756, 0xfa0734b4
+0, 141947, 141947, 1378, 2756, 0x5eff3fc4
+0, 143325, 143325, 1378, 2756, 0xf35346bd
+0, 144703, 144703, 1378, 2756, 0xac6411c5
+0, 146081, 146081, 1380, 2760, 0x478c3c56
+0, 147459, 147459, 1378, 2756, 0xebd30bdd
+0, 148838, 148838, 1378, 2756, 0xaef95a31
+0, 150216, 150216, 1378, 2756, 0x8aad29d1
+0, 151594, 151594, 1378, 2756, 0x626863f0
+0, 152972, 152972, 1378, 2756, 0x68c05707
+0, 154350, 154350, 1378, 2756, 0x437c5e8d
+0, 155728, 155728, 1380, 2760, 0x8eca4bdb
+0, 157106, 157106, 1378, 2756, 0x62bd4162
+0, 158484, 158484, 1378, 2756, 0x9f744aa4
+0, 159863, 159863, 1378, 2756, 0x0f3f6409
+0, 161241, 161241, 1378, 2756, 0x3fee827a
+0, 162619, 162619, 1378, 2756, 0x48a0ac19
+0, 163997, 163997, 1378, 2756, 0x8e4ce0d0
+0, 165375, 165375, 1380, 2760, 0xcda82236
+0, 166753, 166753, 1378, 2756, 0x0e523255
+0, 168131, 168131, 1378, 2756, 0x84103d30
+0, 169509, 169509, 1378, 2756, 0x13941cde
+0, 170888, 170888, 1378, 2756, 0x9fc834c5
+0, 172266, 172266, 1378, 2756, 0xc0217a77
+0, 173644, 173644, 1378, 2756, 0x3f643659
+0, 175022, 175022, 1380, 2760, 0x9dbd6002
+0, 176400, 176400, 1378, 2756, 0x94f046fb
+0, 177778, 177778, 1378, 2756, 0xab01fb12
+0, 179156, 179156, 1378, 2756, 0x04cffe5c
+0, 180534, 180534, 1378, 2756, 0xef661c5e
+0, 181913, 181913, 1378, 2756, 0x094c5fc5
+0, 183291, 183291, 1378, 2756, 0xe0c1486a
+0, 184669, 184669, 1380, 2760, 0x8c3535b7
+0, 186047, 186047, 1378, 2756, 0x594934aa
+0, 187425, 187425, 1378, 2756, 0x74007238
+0, 188803, 188803, 1378, 2756, 0x61f1394d
+0, 190181, 190181, 1378, 2756, 0x72584f07
+0, 191559, 191559, 1378, 2756, 0xced9acf9
+0, 192938, 192938, 1378, 2756, 0x7d2e3ea1
+0, 194316, 194316, 1378, 2756, 0x56c06897
+0, 195694, 195694, 1380, 2760, 0x19983bbf
+0, 197072, 197072, 1378, 2756, 0x4f884f27
+0, 198450, 198450, 1378, 2756, 0x81ab2f63
+0, 199828, 199828, 1378, 2756, 0x448e681d
+0, 201206, 201206, 1378, 2756, 0x0ba9826e
+0, 202584, 202584, 1378, 2756, 0x049f36fa
+0, 203963, 203963, 1378, 2756, 0x096a2b62
+0, 205341, 205341, 1380, 2760, 0x579e2035
+0, 206719, 206719, 1378, 2756, 0xd13e30e1
+0, 208097, 208097, 1378, 2756, 0x30b6412b
+0, 209475, 209475, 1378, 2756, 0xbb1c3268
+0, 210853, 210853, 1378, 2756, 0xbc175b6a
+0, 212231, 212231, 1378, 2756, 0xf8d160e2
+0, 213609, 213609, 1378, 2756, 0xc1048154
+0, 214988, 214988, 1380, 2760, 0xb83548f4
+0, 216366, 216366, 1378, 2756, 0x22647962
+0, 217744, 217744, 1378, 2756, 0x14ca54d3
+0, 219122, 219122, 1378, 2756, 0x58754b3a
diff --git a/gst-libs/ext/libav/tests/ref/fate/cryo-apc b/gst-libs/ext/libav/tests/ref/fate/adpcm-ima-apc
index 16e1dd6..16e1dd6 100644
--- a/gst-libs/ext/libav/tests/ref/fate/cryo-apc
+++ b/gst-libs/ext/libav/tests/ref/fate/adpcm-ima-apc
diff --git a/gst-libs/ext/libav/tests/ref/fate/adpcm-ima-dk3 b/gst-libs/ext/libav/tests/ref/fate/adpcm-ima-dk3
index 9aad92b..08c0fd1 100644
--- a/gst-libs/ext/libav/tests/ref/fate/adpcm-ima-dk3
+++ b/gst-libs/ext/libav/tests/ref/fate/adpcm-ima-dk3
@@ -1 +1 @@
-bb952ae86c72d461aef7583685ec0a4d
+62fbe4db4a49cb044f57f92cce9993c5
diff --git a/gst-libs/ext/libav/tests/ref/fate/adpcm-ima-ea-eacs b/gst-libs/ext/libav/tests/ref/fate/adpcm-ima-ea-eacs
new file mode 100644
index 0000000..9887296
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/adpcm-ima-ea-eacs
@@ -0,0 +1,48 @@
+#tb 0: 1/22050
+0, 0, 0, 1468, 5872, 0x00000000
+0, 1468, 1468, 1468, 5872, 0x00000000
+0, 2936, 2936, 1468, 5872, 0x00000000
+0, 4404, 4404, 1468, 5872, 0x00000000
+0, 5872, 5872, 1468, 5872, 0x00000000
+0, 7340, 7340, 1468, 5872, 0x00000000
+0, 8808, 8808, 1468, 5872, 0x00000000
+0, 10276, 10276, 1468, 5872, 0x00000000
+0, 11744, 11744, 1468, 5872, 0x00000000
+0, 13212, 13212, 1468, 5872, 0x00000000
+0, 14680, 14680, 1468, 5872, 0x00000000
+0, 16148, 16148, 1468, 5872, 0x00000000
+0, 17616, 17616, 1468, 5872, 0x00000000
+0, 19084, 19084, 1468, 5872, 0x00000000
+0, 20552, 20552, 1468, 5872, 0x00000000
+0, 22020, 22020, 1468, 5872, 0xc6f64777
+0, 23488, 23488, 1468, 5872, 0x7c9e60e8
+0, 24956, 24956, 1468, 5872, 0x46525c54
+0, 26424, 26424, 1468, 5872, 0x842796bb
+0, 27892, 27892, 1468, 5872, 0xb1f6cbd5
+0, 29360, 29360, 1468, 5872, 0x0261a74b
+0, 30828, 30828, 1468, 5872, 0x8218b1f9
+0, 32296, 32296, 1468, 5872, 0xd7a2cae6
+0, 33764, 33764, 1468, 5872, 0x69d34562
+0, 35232, 35232, 1468, 5872, 0x9303ec65
+0, 36700, 36700, 1468, 5872, 0xd5d963a1
+0, 38168, 38168, 1468, 5872, 0x0557e06f
+0, 39636, 39636, 1468, 5872, 0x1eb48b41
+0, 41104, 41104, 1468, 5872, 0x70f5ca3f
+0, 42572, 42572, 1468, 5872, 0xd39e5c5e
+0, 44040, 44040, 1468, 5872, 0x29c59140
+0, 45508, 45508, 1468, 5872, 0x7d95e643
+0, 46976, 46976, 1468, 5872, 0x45353fd8
+0, 48444, 48444, 1468, 5872, 0xad7b1b27
+0, 49912, 49912, 1468, 5872, 0x1f0377b3
+0, 51380, 51380, 1468, 5872, 0x6074541e
+0, 52848, 52848, 1468, 5872, 0xa4f5e892
+0, 54316, 54316, 1468, 5872, 0x084bc696
+0, 55784, 55784, 1468, 5872, 0x67fdafce
+0, 57252, 57252, 1468, 5872, 0x8dfd249d
+0, 58720, 58720, 1468, 5872, 0x514184ee
+0, 60188, 60188, 1468, 5872, 0xc0090b0d
+0, 61656, 61656, 1468, 5872, 0xc1171cc8
+0, 63124, 63124, 1468, 5872, 0x7d7dd07e
+0, 64592, 64592, 1468, 5872, 0xe6aa619c
+0, 66060, 66060, 1468, 5872, 0xd5aac0df
+0, 67528, 67528, 1468, 5872, 0x3b68b390
diff --git a/gst-libs/ext/libav/tests/ref/fate/adpcm-ima-ea-sead b/gst-libs/ext/libav/tests/ref/fate/adpcm-ima-ea-sead
new file mode 100644
index 0000000..17c1087
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/adpcm-ima-ea-sead
@@ -0,0 +1,50 @@
+#tb 0: 1/22050
+0, 0, 0, 736, 2944, 0x00000000
+0, 736, 736, 1472, 5888, 0x5ae3c2a4
+0, 2208, 2208, 1472, 5888, 0x158fbcb4
+0, 3680, 3680, 1472, 5888, 0x3fc85d35
+0, 5152, 5152, 1472, 5888, 0x4667ec2b
+0, 6624, 6624, 1472, 5888, 0x82744494
+0, 8096, 8096, 1472, 5888, 0x3b0cb86f
+0, 9568, 9568, 1472, 5888, 0x29493fbb
+0, 11040, 11040, 1472, 5888, 0xaa2d8595
+0, 12512, 12512, 1472, 5888, 0x2e563de6
+0, 13984, 13984, 1472, 5888, 0x225cca99
+0, 15456, 15456, 1472, 5888, 0x2b577599
+0, 16928, 16928, 1472, 5888, 0x3d967f32
+0, 18400, 18400, 1472, 5888, 0x16639a84
+0, 19872, 19872, 1472, 5888, 0x90549ba0
+0, 21344, 21344, 1472, 5888, 0xf46e6644
+0, 22816, 22816, 1472, 5888, 0x39a073ec
+0, 24288, 24288, 1472, 5888, 0xb1d7a93a
+0, 25760, 25760, 1472, 5888, 0x25e9795b
+0, 27232, 27232, 1472, 5888, 0xbbc07644
+0, 28704, 28704, 1472, 5888, 0x323f6a1b
+0, 30176, 30176, 1472, 5888, 0x7cae130b
+0, 31648, 31648, 1472, 5888, 0xd23bf9c6
+0, 33120, 33120, 1472, 5888, 0x5f73ef35
+0, 34592, 34592, 1472, 5888, 0xc66026be
+0, 36064, 36064, 1472, 5888, 0xc8fdb539
+0, 37536, 37536, 1472, 5888, 0x94c6bfbd
+0, 39008, 39008, 1472, 5888, 0xb77e1b83
+0, 40480, 40480, 1472, 5888, 0x6c6d6693
+0, 41952, 41952, 1472, 5888, 0xd9f064d4
+0, 43424, 43424, 1472, 5888, 0x85dd990d
+0, 44896, 44896, 1472, 5888, 0x385e021b
+0, 46368, 46368, 1472, 5888, 0xac09fd02
+0, 47840, 47840, 1472, 5888, 0xc6dcdff2
+0, 49312, 49312, 1472, 5888, 0x86a6944d
+0, 50784, 50784, 1472, 5888, 0x8587b964
+0, 52256, 52256, 1472, 5888, 0x2b0355ff
+0, 53728, 53728, 1472, 5888, 0xe4148a85
+0, 55200, 55200, 1472, 5888, 0xdf02ed4f
+0, 56672, 56672, 1472, 5888, 0x87a54b15
+0, 58144, 58144, 1472, 5888, 0x3ad2be45
+0, 59616, 59616, 1472, 5888, 0x3a49c2c3
+0, 61088, 61088, 1472, 5888, 0xc2b66404
+0, 62560, 62560, 1472, 5888, 0xac3e234a
+0, 64032, 64032, 1472, 5888, 0x5dcf523b
+0, 65504, 65504, 1472, 5888, 0x2034b5d6
+0, 66976, 66976, 1472, 5888, 0x96882832
+0, 68448, 68448, 1472, 5888, 0x2be3d534
+0, 69920, 69920, 1472, 5888, 0xa841a49d
diff --git a/gst-libs/ext/libav/tests/ref/fate/funcom-iss b/gst-libs/ext/libav/tests/ref/fate/adpcm-ima-iss
index 341ef24..341ef24 100644
--- a/gst-libs/ext/libav/tests/ref/fate/funcom-iss
+++ b/gst-libs/ext/libav/tests/ref/fate/adpcm-ima-iss
diff --git a/gst-libs/ext/libav/tests/ref/fate/adpcm-ima-smjpeg b/gst-libs/ext/libav/tests/ref/fate/adpcm-ima-smjpeg
new file mode 100644
index 0000000..45cb97b
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/adpcm-ima-smjpeg
@@ -0,0 +1,351 @@
+#tb 0: 1/22050
+0, 0, 0, 512, 1024, 0x00000000
+0, 507, 507, 512, 1024, 0x00000000
+0, 1014, 1014, 512, 1024, 0xd89a448e
+0, 1521, 1521, 512, 1024, 0x695b369c
+0, 2029, 2029, 512, 1024, 0xc8ba5707
+0, 2558, 2558, 512, 1024, 0xdf241fc6
+0, 3065, 3065, 512, 1024, 0x61cf4166
+0, 3572, 3572, 512, 1024, 0x97cbc386
+0, 4079, 4079, 512, 1024, 0x44899d04
+0, 4586, 4586, 512, 1024, 0xa7cbaa62
+0, 5116, 5116, 512, 1024, 0xa7aea60c
+0, 5623, 5623, 512, 1024, 0xd7b18a89
+0, 6130, 6130, 512, 1024, 0x268e81f6
+0, 6637, 6637, 512, 1024, 0x9cf83a2f
+0, 7166, 7166, 512, 1024, 0x5559b508
+0, 7673, 7673, 512, 1024, 0xe1b9e71c
+0, 8181, 8181, 512, 1024, 0xdcee733e
+0, 8688, 8688, 512, 1024, 0xe5918f60
+0, 9195, 9195, 512, 1024, 0x29dbd209
+0, 9724, 9724, 512, 1024, 0x9bcbcf16
+0, 10231, 10231, 512, 1024, 0x86f5f458
+0, 10738, 10738, 512, 1024, 0xabcbda86
+0, 11246, 11246, 512, 1024, 0xc51f77b9
+0, 11775, 11775, 512, 1024, 0xf6b3a504
+0, 12282, 12282, 512, 1024, 0x1af3e40e
+0, 12789, 12789, 512, 1024, 0x3866b03b
+0, 13296, 13296, 512, 1024, 0xbc005403
+0, 13803, 13803, 512, 1024, 0xe9dfcc51
+0, 14333, 14333, 512, 1024, 0x83c837cb
+0, 14840, 14840, 512, 1024, 0xfa649580
+0, 15347, 15347, 512, 1024, 0x519452ea
+0, 15854, 15854, 512, 1024, 0xd4978774
+0, 16383, 16383, 512, 1024, 0xe2a3b1cd
+0, 16890, 16890, 512, 1024, 0x9a9472ad
+0, 17397, 17397, 512, 1024, 0xa12d4060
+0, 17905, 17905, 512, 1024, 0x31fb0646
+0, 18412, 18412, 512, 1024, 0xfc44343f
+0, 18941, 18941, 512, 1024, 0x0847751a
+0, 19448, 19448, 512, 1024, 0x227968a2
+0, 19955, 19955, 512, 1024, 0x7cce9f1c
+0, 20462, 20462, 512, 1024, 0xb8356713
+0, 20992, 20992, 512, 1024, 0xb29f6e6f
+0, 21499, 21499, 512, 1024, 0x9e1430ab
+0, 22006, 22006, 512, 1024, 0x26d85423
+0, 22513, 22513, 512, 1024, 0x6496547d
+0, 23020, 23020, 512, 1024, 0x316b1a86
+0, 23549, 23549, 512, 1024, 0x3cd83afc
+0, 24057, 24057, 512, 1024, 0x993ff633
+0, 24564, 24564, 512, 1024, 0x0708d1a2
+0, 25071, 25071, 512, 1024, 0xd7230db9
+0, 25578, 25578, 512, 1024, 0xbb0779ca
+0, 26107, 26107, 512, 1024, 0xc6094e1b
+0, 26614, 26614, 512, 1024, 0x15a8b039
+0, 27122, 27122, 512, 1024, 0xd6dbe88c
+0, 27629, 27629, 512, 1024, 0x7e8d1140
+0, 28158, 28158, 512, 1024, 0xef88e525
+0, 28665, 28665, 512, 1024, 0x44e21149
+0, 29172, 29172, 512, 1024, 0x65b0f5f4
+0, 29679, 29679, 512, 1024, 0xb955f687
+0, 30186, 30186, 512, 1024, 0xc85fba9c
+0, 30716, 30716, 512, 1024, 0xf59655ad
+0, 31223, 31223, 512, 1024, 0x6de80bf1
+0, 31730, 31730, 512, 1024, 0x2dcf6e41
+0, 32237, 32237, 512, 1024, 0xd0ddcf8a
+0, 32766, 32766, 512, 1024, 0x00135c2d
+0, 33273, 33273, 512, 1024, 0x697f8efd
+0, 33781, 33781, 512, 1024, 0x7a9bada5
+0, 34288, 34288, 512, 1024, 0x0d22783c
+0, 34795, 34795, 512, 1024, 0x7726d07d
+0, 35324, 35324, 512, 1024, 0xa2f14f67
+0, 35831, 35831, 512, 1024, 0x7f51060d
+0, 36338, 36338, 512, 1024, 0xc4ec6aea
+0, 36846, 36846, 512, 1024, 0x9bb37ca4
+0, 37375, 37375, 512, 1024, 0x9b085577
+0, 37882, 37882, 512, 1024, 0x8812f8af
+0, 38389, 38389, 512, 1024, 0x788f5221
+0, 38896, 38896, 512, 1024, 0x3a2ce642
+0, 39403, 39403, 512, 1024, 0x72415692
+0, 39933, 39933, 512, 1024, 0xe3dcc105
+0, 40440, 40440, 512, 1024, 0xb26c0599
+0, 40947, 40947, 512, 1024, 0x5c9e55eb
+0, 41454, 41454, 512, 1024, 0x8fe88707
+0, 41983, 41983, 512, 1024, 0xc5d7beb6
+0, 42490, 42490, 512, 1024, 0xe1d3a3b4
+0, 42998, 42998, 512, 1024, 0x012da0c6
+0, 43505, 43505, 512, 1024, 0x8d010922
+0, 44012, 44012, 512, 1024, 0x3366eb0d
+0, 44541, 44541, 512, 1024, 0xc9381a27
+0, 45048, 45048, 512, 1024, 0x0774f685
+0, 45555, 45555, 512, 1024, 0xc5cae0a5
+0, 46062, 46062, 512, 1024, 0xa6f4737c
+0, 46592, 46592, 512, 1024, 0x8fb6d0d1
+0, 47099, 47099, 512, 1024, 0x05f579c2
+0, 47606, 47606, 512, 1024, 0x56905d99
+0, 48113, 48113, 512, 1024, 0x002ee18d
+0, 48620, 48620, 512, 1024, 0xeb37ef51
+0, 49149, 49149, 512, 1024, 0x38025635
+0, 49657, 49657, 512, 1024, 0x4fe643c8
+0, 50164, 50164, 512, 1024, 0x11d66ab1
+0, 50671, 50671, 512, 1024, 0xcc3051e9
+0, 51178, 51178, 512, 1024, 0xcd93e854
+0, 51707, 51707, 512, 1024, 0x38f1196d
+0, 52214, 52214, 512, 1024, 0x657a15fc
+0, 52722, 52722, 512, 1024, 0x669ce2a9
+0, 53229, 53229, 512, 1024, 0x95862dda
+0, 53758, 53758, 512, 1024, 0x1726a7b2
+0, 54265, 54265, 512, 1024, 0xd6ece2a1
+0, 54772, 54772, 512, 1024, 0x33ab9553
+0, 55279, 55279, 512, 1024, 0xd50c73a6
+0, 55787, 55787, 512, 1024, 0xfe25b63a
+0, 56316, 56316, 512, 1024, 0x7e2959e3
+0, 56823, 56823, 512, 1024, 0xa4c07b34
+0, 57330, 57330, 512, 1024, 0xd6d8f15c
+0, 57837, 57837, 512, 1024, 0x1eccddd7
+0, 58366, 58366, 512, 1024, 0x2b69f9cb
+0, 58874, 58874, 512, 1024, 0x667b775f
+0, 59381, 59381, 512, 1024, 0xad3b84e9
+0, 59888, 59888, 512, 1024, 0x4f29fc67
+0, 60395, 60395, 512, 1024, 0x8d611ab7
+0, 60924, 60924, 512, 1024, 0x278966ea
+0, 61431, 61431, 512, 1024, 0xaf33812b
+0, 61938, 61938, 512, 1024, 0xa55f4265
+0, 62446, 62446, 512, 1024, 0x023cb51c
+0, 62975, 62975, 512, 1024, 0x1d1f1005
+0, 63482, 63482, 512, 1024, 0x874cccf7
+0, 63989, 63989, 512, 1024, 0xda705428
+0, 64496, 64496, 512, 1024, 0x48d9b440
+0, 65003, 65003, 512, 1024, 0xa14e0712
+0, 65533, 65533, 512, 1024, 0x7efbad1f
+0, 66040, 66040, 512, 1024, 0xdb82c17f
+0, 66547, 66547, 512, 1024, 0xcbe87613
+0, 67054, 67054, 512, 1024, 0x3a63df1d
+0, 67583, 67583, 512, 1024, 0xd5636bba
+0, 68090, 68090, 512, 1024, 0x9397af23
+0, 68598, 68598, 512, 1024, 0x32a07c98
+0, 69105, 69105, 512, 1024, 0x202ca667
+0, 69612, 69612, 512, 1024, 0xdf969011
+0, 70141, 70141, 512, 1024, 0xc434d238
+0, 70648, 70648, 512, 1024, 0xe9ad7562
+0, 71155, 71155, 512, 1024, 0xb51b6b50
+0, 71663, 71663, 512, 1024, 0xe70aecd3
+0, 72192, 72192, 512, 1024, 0x03c816b2
+0, 72699, 72699, 512, 1024, 0x869fdf25
+0, 73206, 73206, 512, 1024, 0xd40a0a62
+0, 73713, 73713, 512, 1024, 0x5af7dd35
+0, 74220, 74220, 512, 1024, 0x891ffc72
+0, 74750, 74750, 512, 1024, 0x1ff68a08
+0, 75257, 75257, 512, 1024, 0x5a7517a9
+0, 75764, 75764, 512, 1024, 0x0f959f74
+0, 76271, 76271, 512, 1024, 0xe92a12a2
+0, 76778, 76778, 512, 1024, 0x38000e55
+0, 77307, 77307, 512, 1024, 0x39fbdd70
+0, 77814, 77814, 512, 1024, 0xca3d9184
+0, 78322, 78322, 512, 1024, 0x66c8995b
+0, 78829, 78829, 512, 1024, 0xac25acea
+0, 79358, 79358, 512, 1024, 0x3cd1046c
+0, 79865, 79865, 512, 1024, 0x6a1df31c
+0, 80372, 80372, 512, 1024, 0x21ca10a1
+0, 80879, 80879, 512, 1024, 0x1aeccedc
+0, 81387, 81387, 512, 1024, 0xddea1335
+0, 81916, 81916, 512, 1024, 0x19f5ca9f
+0, 82423, 82423, 512, 1024, 0x88e95e43
+0, 82930, 82930, 512, 1024, 0x726284fe
+0, 83437, 83437, 512, 1024, 0x6b85b40e
+0, 83966, 83966, 512, 1024, 0x111fee2a
+0, 84474, 84474, 512, 1024, 0x3656b588
+0, 84981, 84981, 512, 1024, 0xa5a2b552
+0, 85488, 85488, 512, 1024, 0x38fb2467
+0, 85995, 85995, 512, 1024, 0xaa919ccc
+0, 86524, 86524, 512, 1024, 0x15993dbc
+0, 87031, 87031, 512, 1024, 0xbe01a7b9
+0, 87539, 87539, 512, 1024, 0xefe93c09
+0, 88046, 88046, 512, 1024, 0x1bb566e5
+0, 88575, 88575, 512, 1024, 0x15ce6237
+0, 89082, 89082, 512, 1024, 0xa8552e66
+0, 89589, 89589, 512, 1024, 0x9d80187e
+0, 90096, 90096, 512, 1024, 0x5df3fc30
+0, 90603, 90603, 512, 1024, 0x1a312aa5
+0, 91133, 91133, 512, 1024, 0x6bb8e302
+0, 91640, 91640, 512, 1024, 0xbd9684bb
+0, 92147, 92147, 512, 1024, 0x78b0b166
+0, 92654, 92654, 512, 1024, 0xd9af5eae
+0, 93183, 93183, 512, 1024, 0xdb90fe82
+0, 93690, 93690, 512, 1024, 0x327614e9
+0, 94198, 94198, 512, 1024, 0x1f19b7fe
+0, 94705, 94705, 512, 1024, 0x46c53f96
+0, 95212, 95212, 512, 1024, 0x921b2189
+0, 95741, 95741, 512, 1024, 0xa8fbc85a
+0, 96248, 96248, 512, 1024, 0xabfdaaae
+0, 96755, 96755, 512, 1024, 0x6acc7387
+0, 97263, 97263, 512, 1024, 0x0d9c27b5
+0, 97792, 97792, 512, 1024, 0xba4dd809
+0, 98299, 98299, 512, 1024, 0x2a2ad521
+0, 98806, 98806, 512, 1024, 0x892de38a
+0, 99313, 99313, 512, 1024, 0xdc97a2eb
+0, 99820, 99820, 512, 1024, 0x4f614ca4
+0, 100350, 100350, 512, 1024, 0x9c8a77ea
+0, 100857, 100857, 512, 1024, 0x2d30e646
+0, 101364, 101364, 512, 1024, 0x74e800a7
+0, 101871, 101871, 512, 1024, 0x1e01fb02
+0, 102378, 102378, 512, 1024, 0x4ed2c1d8
+0, 102907, 102907, 512, 1024, 0xf2fdbe63
+0, 103415, 103415, 512, 1024, 0x8d6f63a1
+0, 103922, 103922, 512, 1024, 0xded468d9
+0, 104429, 104429, 512, 1024, 0xccad839e
+0, 104958, 104958, 512, 1024, 0xdde7c082
+0, 105465, 105465, 512, 1024, 0x548613c5
+0, 105972, 105972, 512, 1024, 0x383909bd
+0, 106479, 106479, 512, 1024, 0xfd37627b
+0, 106987, 106987, 512, 1024, 0x6d95a481
+0, 107516, 107516, 512, 1024, 0x56aa87fa
+0, 108023, 108023, 512, 1024, 0x7b67258c
+0, 108530, 108530, 512, 1024, 0x7dd99a92
+0, 109037, 109037, 512, 1024, 0x4a66d102
+0, 109566, 109566, 512, 1024, 0x7b3fce51
+0, 110074, 110074, 512, 1024, 0xbbd968aa
+0, 110581, 110581, 512, 1024, 0x8283ec36
+0, 111088, 111088, 512, 1024, 0x3c96493d
+0, 111595, 111595, 512, 1024, 0xfa4f8cf8
+0, 112124, 112124, 512, 1024, 0xe2cf872d
+0, 112631, 112631, 512, 1024, 0x0a9e7aa6
+0, 113139, 113139, 512, 1024, 0x6e7a0550
+0, 113646, 113646, 512, 1024, 0x3acfea2f
+0, 114175, 114175, 512, 1024, 0x7111d0fa
+0, 114682, 114682, 512, 1024, 0xe9a1eca9
+0, 115189, 115189, 512, 1024, 0x24da6c46
+0, 115696, 115696, 512, 1024, 0x117cff37
+0, 116204, 116204, 512, 1024, 0x0f27cab6
+0, 116733, 116733, 512, 1024, 0x69b6b4e6
+0, 117240, 117240, 512, 1024, 0x1e6cc841
+0, 117747, 117747, 512, 1024, 0xb01e2365
+0, 118254, 118254, 512, 1024, 0x14e200d3
+0, 118783, 118783, 512, 1024, 0xd1184c98
+0, 119291, 119291, 512, 1024, 0xef9140e9
+0, 119798, 119798, 512, 1024, 0x4cbb645e
+0, 120305, 120305, 512, 1024, 0xe7fe2f06
+0, 120812, 120812, 512, 1024, 0xf8c45028
+0, 121341, 121341, 512, 1024, 0x561358f4
+0, 121848, 121848, 512, 1024, 0xd0129b77
+0, 122355, 122355, 512, 1024, 0xcc636e88
+0, 122863, 122863, 512, 1024, 0xe9406321
+0, 123392, 123392, 512, 1024, 0x9f16a041
+0, 123899, 123899, 512, 1024, 0x468bf409
+0, 124406, 124406, 512, 1024, 0x3df70f7b
+0, 124913, 124913, 512, 1024, 0xa880b11b
+0, 125420, 125420, 512, 1024, 0x3286c489
+0, 125950, 125950, 512, 1024, 0x39fe9ebc
+0, 126457, 126457, 512, 1024, 0xc533d83b
+0, 126964, 126964, 512, 1024, 0x153b195d
+0, 127471, 127471, 512, 1024, 0xd84786a1
+0, 127978, 127978, 512, 1024, 0xdc295aaa
+0, 128507, 128507, 512, 1024, 0xfb764d8c
+0, 129015, 129015, 512, 1024, 0xeebc9db9
+0, 129522, 129522, 512, 1024, 0x7ba9403e
+0, 130029, 130029, 512, 1024, 0x4e5571ec
+0, 130558, 130558, 512, 1024, 0xd965fad4
+0, 131065, 131065, 512, 1024, 0x87e259f2
+0, 131572, 131572, 512, 1024, 0xae7e533b
+0, 132080, 132080, 512, 1024, 0x313cf4d6
+0, 132587, 132587, 512, 1024, 0xe1844c90
+0, 133116, 133116, 512, 1024, 0xbb057b44
+0, 133623, 133623, 512, 1024, 0xa5099687
+0, 134130, 134130, 512, 1024, 0xbff10707
+0, 134637, 134637, 512, 1024, 0x37c4ffc0
+0, 135167, 135167, 512, 1024, 0xf9fb6caa
+0, 135674, 135674, 512, 1024, 0x3b6a3a1f
+0, 136181, 136181, 512, 1024, 0x83431edb
+0, 136688, 136688, 512, 1024, 0x1eb713cf
+0, 137195, 137195, 512, 1024, 0xd7b07a6d
+0, 137724, 137724, 512, 1024, 0x81ae3391
+0, 138231, 138231, 512, 1024, 0xf150130a
+0, 138739, 138739, 512, 1024, 0x09678eaa
+0, 139246, 139246, 512, 1024, 0xb94e06f1
+0, 139775, 139775, 512, 1024, 0x67b1dbc9
+0, 140282, 140282, 512, 1024, 0xd6edc235
+0, 140789, 140789, 512, 1024, 0x34e4c499
+0, 141296, 141296, 512, 1024, 0xeefd89c0
+0, 141804, 141804, 512, 1024, 0x38afdaf1
+0, 142333, 142333, 512, 1024, 0x29a60d76
+0, 142840, 142840, 512, 1024, 0xe28a4372
+0, 143347, 143347, 512, 1024, 0x7089454d
+0, 143854, 143854, 512, 1024, 0x0c01bb7b
+0, 144383, 144383, 512, 1024, 0xbd776a72
+0, 144891, 144891, 512, 1024, 0x86776fd0
+0, 145398, 145398, 512, 1024, 0xb37c88f7
+0, 145905, 145905, 512, 1024, 0x5f90aaf8
+0, 146412, 146412, 512, 1024, 0x203d4222
+0, 146941, 146941, 512, 1024, 0x382692a6
+0, 147448, 147448, 512, 1024, 0xf37c95fd
+0, 147956, 147956, 512, 1024, 0x6c0b8877
+0, 148463, 148463, 512, 1024, 0x2e54a8b6
+0, 148992, 148992, 512, 1024, 0x7f266488
+0, 149499, 149499, 512, 1024, 0xfbf20f9a
+0, 150006, 150006, 512, 1024, 0xf2985cc0
+0, 150513, 150513, 512, 1024, 0xc7075340
+0, 151020, 151020, 512, 1024, 0xe4585695
+0, 151550, 151550, 512, 1024, 0xbdffa380
+0, 152057, 152057, 512, 1024, 0x2422a8a9
+0, 152564, 152564, 512, 1024, 0x59cbd75f
+0, 153071, 153071, 512, 1024, 0x04ad1a8c
+0, 153578, 153578, 512, 1024, 0x33c09191
+0, 154107, 154107, 512, 1024, 0x55efa6fd
+0, 154615, 154615, 512, 1024, 0xf73d0e5d
+0, 155122, 155122, 512, 1024, 0x6141ebae
+0, 155629, 155629, 512, 1024, 0x7db17a68
+0, 156158, 156158, 512, 1024, 0xa6c690b6
+0, 156665, 156665, 512, 1024, 0xa6fd6725
+0, 157172, 157172, 512, 1024, 0x50a90b9b
+0, 157680, 157680, 512, 1024, 0xef990dc8
+0, 158187, 158187, 512, 1024, 0x75adf6b5
+0, 158716, 158716, 512, 1024, 0x61eac43e
+0, 159223, 159223, 512, 1024, 0x67797a19
+0, 159730, 159730, 512, 1024, 0xf325277a
+0, 160237, 160237, 512, 1024, 0x18bf254a
+0, 160767, 160767, 512, 1024, 0x2ce6bee3
+0, 161274, 161274, 512, 1024, 0x8d320860
+0, 161781, 161781, 512, 1024, 0xc979b6e8
+0, 162288, 162288, 512, 1024, 0xdb644b41
+0, 162795, 162795, 512, 1024, 0xe1b368ba
+0, 163324, 163324, 512, 1024, 0xacc53d15
+0, 163832, 163832, 512, 1024, 0x42ea8c18
+0, 164339, 164339, 512, 1024, 0xe52c99a4
+0, 164846, 164846, 512, 1024, 0xd7db54a6
+0, 165375, 165375, 512, 1024, 0x7f27a7e3
+0, 165882, 165882, 512, 1024, 0xf7ffeaa9
+0, 166389, 166389, 512, 1024, 0x792b6088
+0, 166896, 166896, 512, 1024, 0x61d99724
+0, 167404, 167404, 512, 1024, 0x5213720e
+0, 167933, 167933, 512, 1024, 0xac09dd30
+0, 168440, 168440, 512, 1024, 0x960bf6bb
+0, 168947, 168947, 512, 1024, 0xc90168e1
+0, 169454, 169454, 512, 1024, 0x43b45768
+0, 169983, 169983, 512, 1024, 0x935d60a1
+0, 170491, 170491, 512, 1024, 0x9a342ef2
+0, 170998, 170998, 512, 1024, 0xc894709f
+0, 171505, 171505, 512, 1024, 0x59b43b07
+0, 172012, 172012, 512, 1024, 0x36a1a98d
+0, 172541, 172541, 512, 1024, 0x9e1a121c
+0, 173048, 173048, 512, 1024, 0x02208b78
+0, 173556, 173556, 512, 1024, 0xd1d7b274
+0, 174063, 174063, 512, 1024, 0xdacd5096
+0, 174592, 174592, 512, 1024, 0x51b71ead
+0, 175099, 175099, 512, 1024, 0xd009a7ca
+0, 175606, 175606, 512, 1024, 0xb6d5a938
+0, 176113, 176113, 512, 1024, 0xf3d45e47
+0, 176621, 176621, 512, 1024, 0xea8e04fc
+0, 177150, 177150, 512, 1024, 0x0b928bd8
+0, 177657, 177657, 512, 1024, 0x0f02caec
+0, 178164, 178164, 512, 1024, 0xe2b137a8
+0, 178671, 178671, 512, 1024, 0xd5f94892
diff --git a/gst-libs/ext/libav/tests/ref/fate/adpcm-ima-ws b/gst-libs/ext/libav/tests/ref/fate/adpcm-ima-ws
new file mode 100644
index 0000000..61e0def
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/adpcm-ima-ws
@@ -0,0 +1,41 @@
+#tb 0: 1/22050
+0, 0, 0, 11024, 22048, 0x0665d7f4
+0, 11024, 11024, 1470, 2940, 0x0f3c64cb
+0, 12494, 12494, 1470, 2940, 0xc90b9e78
+0, 13964, 13964, 1470, 2940, 0x146246a3
+0, 15434, 15434, 1470, 2940, 0xd22c714e
+0, 16904, 16904, 1470, 2940, 0xd86b681e
+0, 18374, 18374, 1470, 2940, 0x12ec8186
+0, 19844, 19844, 1470, 2940, 0x69aa85b6
+0, 21314, 21314, 1470, 2940, 0xb24d33b0
+0, 22784, 22784, 1470, 2940, 0x3f7b0f0d
+0, 24254, 24254, 1470, 2940, 0x64f10f7e
+0, 25724, 25724, 1470, 2940, 0xd6ea379a
+0, 27194, 27194, 1470, 2940, 0x7c38e830
+0, 28664, 28664, 1470, 2940, 0xc28ff132
+0, 30134, 30134, 1470, 2940, 0xe7b11629
+0, 31604, 31604, 1470, 2940, 0xeb86fdcb
+0, 33074, 33074, 1470, 2940, 0x5508f586
+0, 34544, 34544, 1470, 2940, 0xf4fa1f1b
+0, 36014, 36014, 1470, 2940, 0x9e5ff976
+0, 37484, 37484, 1470, 2940, 0xcfc4e08f
+0, 38954, 38954, 1470, 2940, 0x74bde7ed
+0, 40424, 40424, 1470, 2940, 0x3e4ae245
+0, 41894, 41894, 1470, 2940, 0x4c6a8e56
+0, 43364, 43364, 1470, 2940, 0xa09d86ab
+0, 44834, 44834, 1470, 2940, 0xc8531912
+0, 46304, 46304, 1470, 2940, 0xa5f266aa
+0, 47774, 47774, 1470, 2940, 0x587a4187
+0, 49244, 49244, 1470, 2940, 0x14752d45
+0, 50714, 50714, 1470, 2940, 0x558cde10
+0, 52184, 52184, 1470, 2940, 0x735fee38
+0, 53654, 53654, 1470, 2940, 0xac8bb6c8
+0, 55124, 55124, 1470, 2940, 0xa503c73b
+0, 56594, 56594, 1470, 2940, 0x7cd588a3
+0, 58064, 58064, 1470, 2940, 0xa6974b04
+0, 59534, 59534, 1470, 2940, 0xbf448241
+0, 61004, 61004, 1470, 2940, 0x2a5c2759
+0, 62474, 62474, 1470, 2940, 0xd0de5ce0
+0, 63944, 63944, 1470, 2940, 0xc0486649
+0, 65414, 65414, 1470, 2940, 0x48b040af
+0, 66884, 66884, 1470, 2940, 0x82a338a9
diff --git a/gst-libs/ext/libav/tests/ref/fate/adpcm-ms-mono b/gst-libs/ext/libav/tests/ref/fate/adpcm-ms-mono
new file mode 100644
index 0000000..3bf44f8
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/adpcm-ms-mono
@@ -0,0 +1,46 @@
+#tb 0: 1/11025
+0, 0, 0, 500, 1000, 0x64cd9403
+0, 500, 500, 500, 1000, 0xa4ef8a9d
+0, 1000, 1000, 500, 1000, 0x75c19868
+0, 1500, 1500, 500, 1000, 0x93db6f79
+0, 2000, 2000, 500, 1000, 0x6835625d
+0, 2500, 2500, 500, 1000, 0xb3affa8f
+0, 3000, 3000, 500, 1000, 0x159fdcc8
+0, 3500, 3500, 500, 1000, 0x79f9f7f1
+0, 4000, 4000, 500, 1000, 0xd7d1131e
+0, 4500, 4500, 500, 1000, 0x52a6f797
+0, 5000, 5000, 500, 1000, 0x748202ca
+0, 5500, 5500, 500, 1000, 0x0ef92449
+0, 6000, 6000, 500, 1000, 0x6a3760ab
+0, 6500, 6500, 500, 1000, 0xce5c5abf
+0, 7000, 7000, 500, 1000, 0x23396792
+0, 7500, 7500, 500, 1000, 0xa5276238
+0, 8000, 8000, 500, 1000, 0x288adf1b
+0, 8500, 8500, 500, 1000, 0xe7de6fb2
+0, 9000, 9000, 500, 1000, 0x2c2c707f
+0, 9500, 9500, 500, 1000, 0xd66d6daf
+0, 10000, 10000, 500, 1000, 0xbcea7d64
+0, 10500, 10500, 500, 1000, 0x766feea5
+0, 11000, 11000, 500, 1000, 0xd2e1d63a
+0, 11500, 11500, 500, 1000, 0x2f7ef4ed
+0, 12000, 12000, 500, 1000, 0xb655cba4
+0, 12500, 12500, 500, 1000, 0x4507d37b
+0, 13000, 13000, 500, 1000, 0x0c57f794
+0, 13500, 13500, 500, 1000, 0x0ecbe5cc
+0, 14000, 14000, 500, 1000, 0x9bf6e345
+0, 14500, 14500, 500, 1000, 0xc461443c
+0, 15000, 15000, 500, 1000, 0xad9657bf
+0, 15500, 15500, 500, 1000, 0x466fe91c
+0, 16000, 16000, 500, 1000, 0x9ee377fe
+0, 16500, 16500, 500, 1000, 0x09956428
+0, 17000, 17000, 500, 1000, 0x9b285f0a
+0, 17500, 17500, 500, 1000, 0x0a3e61a6
+0, 18000, 18000, 500, 1000, 0xacc25d6b
+0, 18500, 18500, 500, 1000, 0x377be319
+0, 19000, 19000, 500, 1000, 0xe4890504
+0, 19500, 19500, 500, 1000, 0xe90a6497
+0, 20000, 20000, 500, 1000, 0xd00fe950
+0, 20500, 20500, 500, 1000, 0xf195eb44
+0, 21000, 21000, 500, 1000, 0xa491f3ef
+0, 21500, 21500, 500, 1000, 0x2c036e18
+0, 22000, 22000, 500, 1000, 0x52d65e2a
diff --git a/gst-libs/ext/libav/tests/ref/fate/adpcm-psx-str-v3 b/gst-libs/ext/libav/tests/ref/fate/adpcm-psx-str-v3
deleted file mode 100644
index ee0c354..0000000
--- a/gst-libs/ext/libav/tests/ref/fate/adpcm-psx-str-v3
+++ /dev/null
@@ -1,37 +0,0 @@
-0, 0, 8064, 0xa307ed8c
-0, 4800, 8064, 0xd2551927
-0, 9600, 8064, 0x3264a799
-0, 14400, 8064, 0x75da1393
-0, 19200, 8064, 0x68665f59
-0, 24000, 8064, 0xaf266a18
-0, 28800, 8064, 0x4d4b69fd
-0, 33600, 8064, 0x129d7e17
-0, 38400, 8064, 0x78c56725
-0, 43200, 8064, 0x59902cf1
-0, 48000, 8064, 0x6e699c87
-0, 52800, 8064, 0xc30692d7
-0, 57600, 8064, 0x29c043e5
-0, 62400, 8064, 0x61907704
-0, 67200, 8064, 0xf9210630
-0, 72000, 8064, 0xc0bdda08
-0, 76800, 8064, 0x6171b96d
-0, 81600, 8064, 0x082947cf
-0, 86400, 8064, 0xf7bbf1ce
-0, 91200, 8064, 0xe50e4436
-0, 96000, 8064, 0x2a860844
-0, 100800, 8064, 0xedcb502c
-0, 105600, 8064, 0x448e3c7f
-0, 110400, 8064, 0xf782f366
-0, 115200, 8064, 0xf57f66a5
-0, 120000, 8064, 0xdcc36939
-0, 124800, 8064, 0x34959d99
-0, 129600, 8064, 0xa5c20433
-0, 134400, 8064, 0xf1364e9b
-0, 139200, 8064, 0x232fe9c7
-0, 144000, 8064, 0xdc068d5a
-0, 148800, 8064, 0x4962e812
-0, 153600, 8064, 0x36a6709b
-0, 158400, 8064, 0xa2837bd8
-0, 163200, 8064, 0x68612ddb
-0, 168000, 8064, 0x8d76d1cb
-0, 172800, 8064, 0x7707cfc7
diff --git a/gst-libs/ext/libav/tests/ref/fate/adpcm-thp b/gst-libs/ext/libav/tests/ref/fate/adpcm-thp
index b1046d8..72aff61 100644
--- a/gst-libs/ext/libav/tests/ref/fate/adpcm-thp
+++ b/gst-libs/ext/libav/tests/ref/fate/adpcm-thp
@@ -1,143 +1,72 @@
-0, 0, 291840, 0xbd7e0b22
-1, 0, 4312, 0x469714f6
-0, 3003, 291840, 0xf6e12ca5
-1, 3032, 4256, 0xe03dd882
-0, 6006, 291840, 0x528c7049
-1, 6024, 4312, 0x46b901f7
-0, 9009, 291840, 0x93055de9
-1, 9056, 4256, 0x8d4a54e4
-0, 12012, 291840, 0xf95a51c1
-1, 12049, 4256, 0xfd616b67
-0, 15015, 291840, 0x6ad3a65a
-1, 15041, 4312, 0xefe62302
-0, 18018, 291840, 0x494684a7
-1, 18073, 4256, 0xab11684e
-0, 21021, 291840, 0x74c14eb1
-1, 21066, 4256, 0xb4b3feb8
-0, 24024, 291840, 0x149fcb7e
-1, 24058, 4312, 0x71db6461
-0, 27027, 291840, 0x25649761
-1, 27090, 4256, 0x090e5efa
-0, 30030, 291840, 0xbc3f9052
-1, 30083, 4256, 0x36f49c28
-0, 33033, 291840, 0x080edfff
-1, 33075, 4312, 0x0fe3d262
-0, 36036, 291840, 0x6d7ad684
-1, 36107, 4256, 0x199ce269
-0, 39039, 291840, 0x6d53844d
-1, 39099, 4256, 0x98342d05
-0, 42042, 291840, 0xf7ad5385
-1, 42092, 4312, 0xb6fb7ebe
-0, 45045, 291840, 0x0241b56a
-1, 45124, 4256, 0x033dd562
-0, 48048, 291840, 0x120122c8
-1, 48116, 4256, 0xc2cc17e0
-0, 51051, 291840, 0x31b0f32a
-1, 51109, 4312, 0x4bb3ff50
-0, 54054, 291840, 0x14068b98
-1, 54141, 4256, 0x6f2671ef
-0, 57057, 291840, 0xeeec658b
-1, 57133, 4256, 0x5a337bf4
-0, 60060, 291840, 0x9376374c
-1, 60126, 4312, 0xa71f6967
-0, 63063, 291840, 0x091e8c6e
-1, 63158, 4256, 0x48084aa9
-0, 66066, 291840, 0x744ad07f
-1, 66150, 4256, 0x3cce4218
-0, 69069, 291840, 0xf99c554e
-1, 69143, 4312, 0xcbb8f73d
-0, 72072, 291840, 0xc84bd677
-1, 72174, 4256, 0x36825021
-0, 75075, 291840, 0x3898d474
-1, 75167, 4256, 0xeae036c6
-0, 78078, 291840, 0x1e2910c8
-1, 78159, 4312, 0x0d650ac6
-0, 81081, 291840, 0xb11f58bc
-1, 81191, 4256, 0xfba4f58c
-0, 84084, 291840, 0xf89170ee
-1, 84184, 4256, 0x54311f9b
-0, 87087, 291840, 0x8f239dc3
-1, 87176, 4312, 0x286386b3
-0, 90090, 291840, 0x8538c76c
-1, 90208, 4256, 0x871896de
-0, 93093, 291840, 0x162ee66f
-1, 93201, 4256, 0x9ef9f970
-0, 96096, 291840, 0x5f8708a5
-1, 96193, 4312, 0xf9ae97f1
-0, 99099, 291840, 0x95802dfb
-1, 99225, 4256, 0x0ad0d765
-0, 102102, 291840, 0xc424630d
-1, 102218, 4256, 0x8e6aa9b5
-0, 105105, 291840, 0xfb8a8667
-1, 105210, 4312, 0x8362787b
-0, 108108, 291840, 0xbad79af5
-1, 108242, 4256, 0x9b6a5d9c
-0, 111111, 291840, 0xc733b325
-1, 111234, 4256, 0xfb715d8f
-0, 114114, 291840, 0x4bfbcd70
-1, 114227, 4312, 0x02bd8075
-0, 117117, 291840, 0x502cd950
-1, 117259, 4256, 0x428eb932
-0, 120120, 291840, 0x8461ca2c
-1, 120251, 4256, 0x17ea8c94
-0, 123123, 291840, 0x00219b0d
-1, 123244, 4312, 0xb3e761d7
-0, 126126, 291840, 0xa4de45e1
-1, 126276, 4256, 0x0919755a
-0, 129129, 291840, 0xacd3f4df
-1, 129268, 4256, 0x5e520edd
-0, 132132, 291840, 0x2203a369
-1, 132261, 4312, 0x69aa070e
-0, 135135, 291840, 0x0a66effa
-1, 135293, 4256, 0xf8192f7d
-0, 138138, 291840, 0x7ac1fd91
-1, 138285, 4256, 0xaad4475c
-0, 141141, 291840, 0x84970aa7
-1, 141278, 4312, 0x0cabcfcb
-0, 144144, 291840, 0x569d145f
-1, 144309, 4256, 0x952f0f96
-0, 147147, 291840, 0xe51efe1b
-1, 147302, 4256, 0x1b805a0c
-0, 150150, 291840, 0x38e2cd78
-1, 150294, 4312, 0x93043d2a
-0, 153153, 291840, 0x93428ea2
-1, 153326, 4256, 0x38b99e44
-0, 156156, 291840, 0x3d3f5b17
-1, 156319, 4256, 0x60cc52ff
-0, 159159, 291840, 0x9546127d
-1, 159311, 4312, 0x6a875849
-0, 162162, 291840, 0x4178be54
-1, 162343, 4256, 0xd08d6d0e
-0, 165165, 291840, 0x0d0f8036
-1, 165336, 4256, 0x36bfe48e
-0, 168168, 291840, 0xc20557b9
-1, 168328, 4312, 0x795c6134
-0, 171171, 291840, 0x6d4b2d64
-1, 171360, 4256, 0x4fd79583
-0, 174174, 291840, 0xa750125d
-1, 174353, 4256, 0x65e2ab9f
-0, 177177, 291840, 0x04623ce3
-1, 177345, 4312, 0xedeede4a
-0, 180180, 291840, 0xc7f2bbc7
-1, 180377, 4256, 0x097e0d09
-0, 183183, 291840, 0x6e271336
-1, 183369, 4256, 0x58afa133
-0, 186186, 291840, 0xcfbd4246
-1, 186362, 4312, 0x442525b5
-0, 189189, 291840, 0xe1493be9
-1, 189394, 4256, 0x6645c591
-0, 192192, 291840, 0x6c731194
-1, 192386, 4256, 0xb0dd948a
-0, 195195, 291840, 0x0fc30cc2
-1, 195379, 4312, 0x12684e69
-0, 198198, 291840, 0x967427f3
-1, 198411, 4256, 0xb45098e3
-0, 201201, 291840, 0x55ae3b00
-1, 201403, 4256, 0xb6d3c61c
-0, 204204, 291840, 0xbe4f200c
-1, 204396, 4312, 0xb46b5b22
-0, 207207, 291840, 0xc515e443
-1, 207428, 4256, 0x9a556830
-0, 210210, 291840, 0xd738bd69
-1, 210420, 4256, 0x67ca2b35
-0, 213213, 291840, 0xa8e0ab69
+#tb 0: 1/32000
+0, 0, 0, 1078, 4312, 0x469714f6
+0, 1078, 1078, 1064, 4256, 0xe03dd882
+0, 2142, 2142, 1078, 4312, 0x46b901f7
+0, 3220, 3220, 1064, 4256, 0x8d4a54e4
+0, 4284, 4284, 1064, 4256, 0xfd616b67
+0, 5348, 5348, 1078, 4312, 0xefe62302
+0, 6426, 6426, 1064, 4256, 0xab11684e
+0, 7490, 7490, 1064, 4256, 0xb4b3feb8
+0, 8554, 8554, 1078, 4312, 0x71db6461
+0, 9632, 9632, 1064, 4256, 0x090e5efa
+0, 10696, 10696, 1064, 4256, 0x36f49c28
+0, 11760, 11760, 1078, 4312, 0x0fe3d262
+0, 12838, 12838, 1064, 4256, 0x199ce269
+0, 13902, 13902, 1064, 4256, 0x98342d05
+0, 14966, 14966, 1078, 4312, 0xb6fb7ebe
+0, 16044, 16044, 1064, 4256, 0x033dd562
+0, 17108, 17108, 1064, 4256, 0xc2cc17e0
+0, 18172, 18172, 1078, 4312, 0x4bb3ff50
+0, 19250, 19250, 1064, 4256, 0x6f2671ef
+0, 20314, 20314, 1064, 4256, 0x5a337bf4
+0, 21378, 21378, 1078, 4312, 0xa71f6967
+0, 22456, 22456, 1064, 4256, 0x48084aa9
+0, 23520, 23520, 1064, 4256, 0x3cce4218
+0, 24584, 24584, 1078, 4312, 0xcbb8f73d
+0, 25662, 25662, 1064, 4256, 0x36825021
+0, 26726, 26726, 1064, 4256, 0xeae036c6
+0, 27790, 27790, 1078, 4312, 0x0d650ac6
+0, 28868, 28868, 1064, 4256, 0xfba4f58c
+0, 29932, 29932, 1064, 4256, 0x54311f9b
+0, 30996, 30996, 1078, 4312, 0x286386b3
+0, 32074, 32074, 1064, 4256, 0x871896de
+0, 33138, 33138, 1064, 4256, 0x9ef9f970
+0, 34202, 34202, 1078, 4312, 0xf9ae97f1
+0, 35280, 35280, 1064, 4256, 0x0ad0d765
+0, 36344, 36344, 1064, 4256, 0x8e6aa9b5
+0, 37408, 37408, 1078, 4312, 0x8362787b
+0, 38486, 38486, 1064, 4256, 0x9b6a5d9c
+0, 39550, 39550, 1064, 4256, 0xfb715d8f
+0, 40614, 40614, 1078, 4312, 0x02bd8075
+0, 41692, 41692, 1064, 4256, 0x428eb932
+0, 42756, 42756, 1064, 4256, 0x17ea8c94
+0, 43820, 43820, 1078, 4312, 0xb3e761d7
+0, 44898, 44898, 1064, 4256, 0x0919755a
+0, 45962, 45962, 1064, 4256, 0x5e520edd
+0, 47026, 47026, 1078, 4312, 0x69aa070e
+0, 48104, 48104, 1064, 4256, 0xf8192f7d
+0, 49168, 49168, 1064, 4256, 0xaad4475c
+0, 50232, 50232, 1078, 4312, 0x0cabcfcb
+0, 51310, 51310, 1064, 4256, 0x952f0f96
+0, 52374, 52374, 1064, 4256, 0x1b805a0c
+0, 53438, 53438, 1078, 4312, 0x93043d2a
+0, 54516, 54516, 1064, 4256, 0x38b99e44
+0, 55580, 55580, 1064, 4256, 0x60cc52ff
+0, 56644, 56644, 1078, 4312, 0x6a875849
+0, 57722, 57722, 1064, 4256, 0xd08d6d0e
+0, 58786, 58786, 1064, 4256, 0x36bfe48e
+0, 59850, 59850, 1078, 4312, 0x795c6134
+0, 60928, 60928, 1064, 4256, 0x4fd79583
+0, 61992, 61992, 1064, 4256, 0x65e2ab9f
+0, 63056, 63056, 1078, 4312, 0xedeede4a
+0, 64134, 64134, 1064, 4256, 0x097e0d09
+0, 65198, 65198, 1064, 4256, 0x58afa133
+0, 66262, 66262, 1078, 4312, 0x442525b5
+0, 67340, 67340, 1064, 4256, 0x6645c591
+0, 68404, 68404, 1064, 4256, 0xb0dd948a
+0, 69468, 69468, 1078, 4312, 0x12684e69
+0, 70546, 70546, 1064, 4256, 0xb45098e3
+0, 71610, 71610, 1064, 4256, 0xb6d3c61c
+0, 72674, 72674, 1078, 4312, 0xb46b5b22
+0, 73752, 73752, 1064, 4256, 0x9a556830
+0, 74816, 74816, 1064, 4256, 0x67ca2b35
diff --git a/gst-libs/ext/libav/tests/ref/fate/adpcm-xa b/gst-libs/ext/libav/tests/ref/fate/adpcm-xa
new file mode 100644
index 0000000..04be2b9
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/adpcm-xa
@@ -0,0 +1,38 @@
+#tb 0: 1/37800
+0, 0, 0, 2016, 8064, 0xa307ed8c
+0, 2016, 2016, 2016, 8064, 0xd2551927
+0, 4032, 4032, 2016, 8064, 0x3264a799
+0, 6048, 6048, 2016, 8064, 0x75da1393
+0, 8064, 8064, 2016, 8064, 0x68665f59
+0, 10080, 10080, 2016, 8064, 0xaf266a18
+0, 12096, 12096, 2016, 8064, 0x4d4b69fd
+0, 14112, 14112, 2016, 8064, 0x129d7e17
+0, 16128, 16128, 2016, 8064, 0x78c56725
+0, 18144, 18144, 2016, 8064, 0x59902cf1
+0, 20160, 20160, 2016, 8064, 0x6e699c87
+0, 22176, 22176, 2016, 8064, 0xc30692d7
+0, 24192, 24192, 2016, 8064, 0x29c043e5
+0, 26208, 26208, 2016, 8064, 0x61907704
+0, 28224, 28224, 2016, 8064, 0xf9210630
+0, 30240, 30240, 2016, 8064, 0xc0bdda08
+0, 32256, 32256, 2016, 8064, 0x6171b96d
+0, 34272, 34272, 2016, 8064, 0x082947cf
+0, 36288, 36288, 2016, 8064, 0xf7bbf1ce
+0, 38304, 38304, 2016, 8064, 0xe50e4436
+0, 40320, 40320, 2016, 8064, 0x2a860844
+0, 42336, 42336, 2016, 8064, 0xedcb502c
+0, 44352, 44352, 2016, 8064, 0x448e3c7f
+0, 46368, 46368, 2016, 8064, 0xf782f366
+0, 48384, 48384, 2016, 8064, 0xf57f66a5
+0, 50400, 50400, 2016, 8064, 0xdcc36939
+0, 52416, 52416, 2016, 8064, 0x34959d99
+0, 54432, 54432, 2016, 8064, 0xa5c20433
+0, 56448, 56448, 2016, 8064, 0xf1364e9b
+0, 58464, 58464, 2016, 8064, 0x232fe9c7
+0, 60480, 60480, 2016, 8064, 0xdc068d5a
+0, 62496, 62496, 2016, 8064, 0x4962e812
+0, 64512, 64512, 2016, 8064, 0x36a6709b
+0, 66528, 66528, 2016, 8064, 0xa2837bd8
+0, 68544, 68544, 2016, 8064, 0x68612ddb
+0, 70560, 70560, 2016, 8064, 0x8d76d1cb
+0, 72576, 72576, 2016, 8064, 0x7707cfc7
diff --git a/gst-libs/ext/libav/tests/ref/fate/alg-mm b/gst-libs/ext/libav/tests/ref/fate/alg-mm
index 6e245ac..5d97de9 100644
--- a/gst-libs/ext/libav/tests/ref/fate/alg-mm
+++ b/gst-libs/ext/libav/tests/ref/fate/alg-mm
@@ -1,31 +1,32 @@
-0, 0, 122880, 0x4ed8123f
-0, 9000, 122880, 0xc4c35304
-0, 18000, 122880, 0xbd3015fd
-0, 27000, 122880, 0xece5dbab
-0, 36000, 122880, 0x13249f3f
-0, 45000, 122880, 0x58f75895
-0, 54000, 122880, 0xe6570f7d
-0, 63000, 122880, 0xcce88145
-0, 72000, 122880, 0x796f633c
-0, 81000, 122880, 0x182c3cd3
-0, 90000, 122880, 0x04b2513b
-0, 99000, 122880, 0x6b7e2e42
-0, 108000, 122880, 0x2fa47070
-0, 117000, 122880, 0x7142919e
-0, 126000, 122880, 0x8995337e
-0, 135000, 122880, 0x5146ca20
-0, 144000, 122880, 0x9aadb491
-0, 153000, 122880, 0x2d5b0032
-0, 162000, 122880, 0x5c7c8314
-0, 171000, 122880, 0x2ba8253c
-0, 180000, 122880, 0xd19d504b
-0, 189000, 122880, 0x4ff15fd1
-0, 198000, 122880, 0x76039f9f
-0, 207000, 122880, 0xcce84d35
-0, 216000, 122880, 0x68c5797c
-0, 225000, 122880, 0xf1da4293
-0, 234000, 122880, 0xf5f537f3
-0, 243000, 122880, 0x8d3ffa94
-0, 252000, 122880, 0x3ca9b69c
-0, 261000, 122880, 0x21187f6c
-0, 270000, 122880, 0xe5136e34
+#tb 0: 1/10
+0, 0, 0, 1, 122880, 0x4ed8123f
+0, 1, 1, 1, 122880, 0xc4c35304
+0, 2, 2, 1, 122880, 0xbd3015fd
+0, 3, 3, 1, 122880, 0xece5dbab
+0, 4, 4, 1, 122880, 0x13249f3f
+0, 5, 5, 1, 122880, 0x58f75895
+0, 6, 6, 1, 122880, 0xe6570f7d
+0, 7, 7, 1, 122880, 0xcce88145
+0, 8, 8, 1, 122880, 0x796f633c
+0, 9, 9, 1, 122880, 0x182c3cd3
+0, 10, 10, 1, 122880, 0x04b2513b
+0, 11, 11, 1, 122880, 0x6b7e2e42
+0, 12, 12, 1, 122880, 0x2fa47070
+0, 13, 13, 1, 122880, 0x7142919e
+0, 14, 14, 1, 122880, 0x8995337e
+0, 15, 15, 1, 122880, 0x5146ca20
+0, 16, 16, 1, 122880, 0x9aadb491
+0, 17, 17, 1, 122880, 0x2d5b0032
+0, 18, 18, 1, 122880, 0x5c7c8314
+0, 19, 19, 1, 122880, 0x2ba8253c
+0, 20, 20, 1, 122880, 0xd19d504b
+0, 21, 21, 1, 122880, 0x4ff15fd1
+0, 22, 22, 1, 122880, 0x76039f9f
+0, 23, 23, 1, 122880, 0xcce84d35
+0, 24, 24, 1, 122880, 0x68c5797c
+0, 25, 25, 1, 122880, 0xf1da4293
+0, 26, 26, 1, 122880, 0xf5f537f3
+0, 27, 27, 1, 122880, 0x8d3ffa94
+0, 28, 28, 1, 122880, 0x3ca9b69c
+0, 29, 29, 1, 122880, 0x21187f6c
+0, 30, 30, 1, 122880, 0xe5136e34
diff --git a/gst-libs/ext/libav/tests/ref/fate/amv b/gst-libs/ext/libav/tests/ref/fate/amv
index a8e7136..407f077 100644
--- a/gst-libs/ext/libav/tests/ref/fate/amv
+++ b/gst-libs/ext/libav/tests/ref/fate/amv
@@ -1,320 +1,161 @@
-0, 0, 28800, 0x026058a9
-1, 0, 2756, 0x0af35034
-1, 5624, 2756, 0x8462443f
-0, 5625, 28800, 0x5dc728de
-1, 11249, 2756, 0x9f493ba6
-0, 11250, 28800, 0x83e19a2c
-1, 16873, 2756, 0x634e5f06
-0, 16875, 28800, 0xb029f94a
-1, 22498, 2760, 0x51f35cd4
-0, 22500, 28800, 0x735a6b15
-0, 28125, 28800, 0xf7e9dc8b
-1, 28131, 2756, 0x011c51e5
-0, 33750, 28800, 0xa108b0cf
-1, 33755, 2756, 0x8c2c198c
-0, 39375, 28800, 0x3d11c138
-1, 39380, 2756, 0x2b4a3397
-0, 45000, 28800, 0xed23afda
-1, 45004, 2756, 0x63794f22
-0, 50625, 28800, 0x713bb2dc
-1, 50629, 2756, 0xfc363898
-0, 56250, 28800, 0x551ad51e
-1, 56253, 2756, 0x0da5486e
-0, 61875, 28800, 0x49dfcf2d
-1, 61878, 2756, 0xbae17a5f
-0, 67500, 28800, 0x6399d5b3
-1, 67502, 2760, 0xba266e1b
-0, 73125, 28800, 0x520ad812
-1, 73135, 2756, 0xdfb61002
-0, 78750, 28800, 0xc46ad9da
-1, 78759, 2756, 0x15d029da
-0, 84375, 28800, 0xe79edb9e
-1, 84384, 2756, 0x7bc82012
-0, 90000, 28800, 0xdb1acb30
-1, 90008, 2756, 0x002e6999
-0, 95625, 28800, 0x050fb669
-1, 95633, 2756, 0x96346ba6
-0, 101250, 28800, 0x096ca687
-1, 101257, 2756, 0x3d54543b
-0, 106875, 28800, 0x0054a6bd
-1, 106882, 2760, 0x601786e1
-0, 112500, 28800, 0x6d7daad2
-1, 112514, 2756, 0xf22a5793
-0, 118125, 28800, 0x9c10a9dc
-1, 118139, 2756, 0x21f54d49
-0, 123750, 28800, 0x89b1a623
-1, 123763, 2756, 0x0c6d4399
-0, 129375, 28800, 0xa0a19c3f
-1, 129388, 2756, 0x17282f8e
-0, 135000, 28800, 0x26c898ad
-1, 135012, 2756, 0xeb698f75
-0, 140625, 28800, 0x6f639dae
-1, 140637, 2756, 0x935e1de2
-0, 146250, 28800, 0xa173a9b5
-1, 146261, 2760, 0xb6fb4293
-0, 151875, 28800, 0xa309aa08
-1, 151894, 2756, 0x485053dc
-0, 157500, 28800, 0x2059b6c4
-1, 157518, 2756, 0x24c35027
-0, 163125, 28800, 0x5ae8c761
-1, 163143, 2756, 0x09f323ee
-0, 168750, 28800, 0xb780c9c5
-1, 168767, 2756, 0xbc7d58d5
-0, 174375, 28800, 0xf58ac8fe
-1, 174392, 2756, 0xaefd487c
-0, 180000, 28800, 0x9bb307e7
-1, 180016, 2756, 0xaca16cc0
-0, 185625, 28800, 0xd32c3e81
-1, 185641, 2760, 0x98a76091
-0, 191250, 28800, 0x4edd51d2
-1, 191273, 2756, 0x5d357141
-0, 196875, 28800, 0x5a88684d
-1, 196898, 2756, 0x65ea2657
-0, 202500, 28800, 0x5bd97f0e
-1, 202522, 2756, 0xb5e1334a
-0, 208125, 28800, 0x36d67843
-1, 208147, 2756, 0x32cd5d91
-0, 213750, 28800, 0x0e18781d
-1, 213771, 2756, 0xdc23722b
-0, 219375, 28800, 0xa3168807
-1, 219396, 2756, 0x2ba34684
-0, 225000, 28800, 0xa7c575b8
-1, 225020, 2756, 0xf9755ba8
-0, 230625, 28800, 0x86367c37
-1, 230645, 2760, 0x24221ddb
-0, 236250, 28800, 0xb0f79180
-1, 236278, 2756, 0xef843aa4
-0, 241875, 28800, 0x61da8c0f
-1, 241902, 2756, 0x420442fe
-0, 247500, 28800, 0x9b11948a
-1, 247527, 2756, 0x5a0933cb
-0, 253125, 28800, 0xc53d9b44
-1, 253151, 2756, 0xef5f6d61
-0, 258750, 28800, 0xdc699185
-1, 258776, 2756, 0xe57e6dc0
-0, 264375, 28800, 0x7b4f92b5
-1, 264400, 2756, 0xc0f0495a
-0, 270000, 28800, 0x40469065
-1, 270024, 2760, 0x2c3b55df
-0, 275625, 28800, 0x737ea07e
-1, 275657, 2756, 0x39c2586c
-0, 281250, 28800, 0x0db49c8b
-1, 281282, 2756, 0x7ffc46e5
-0, 286875, 28800, 0x39249f10
-1, 286906, 2756, 0xa2766664
-0, 292500, 28800, 0xc182ab99
-1, 292531, 2756, 0xacb50c6c
-0, 298125, 28800, 0xd8f7a7c9
-1, 298155, 2756, 0x7f659084
-0, 303750, 28800, 0x46789caa
-1, 303780, 2756, 0xc72e6a12
-0, 309375, 28800, 0x4759a374
-1, 309404, 2760, 0xdb6944df
-0, 315000, 28800, 0xe621b16a
-1, 315037, 2756, 0x954f45c1
-0, 320625, 28800, 0xcf47a999
-1, 320661, 2756, 0xa9484240
-0, 326250, 28800, 0x801dacd4
-1, 326286, 2756, 0x1d595349
-0, 331875, 28800, 0xe580af51
-1, 331910, 2756, 0xcf2a565e
-0, 337500, 28800, 0x03d7a887
-1, 337535, 2756, 0x391028d5
-0, 343125, 28800, 0xa67ea51d
-1, 343159, 2756, 0x348db7ad
-0, 348750, 28800, 0x9fee0ec8
-1, 348784, 2760, 0xb69b5e3a
-0, 354375, 28800, 0x7f602a5e
-1, 354416, 2756, 0xe3635fbe
-0, 360000, 28800, 0x100d432a
-1, 360041, 2756, 0xdcad3654
-0, 365625, 28800, 0x42164dfb
-1, 365665, 2756, 0x5c17abef
-0, 371250, 28800, 0x86c05196
-1, 371290, 2756, 0xb3235184
-0, 376875, 28800, 0xfc225938
-1, 376914, 2756, 0xdabb64a6
-0, 382500, 28800, 0x81085e87
-1, 382539, 2756, 0xa95dc58d
-0, 388125, 28800, 0xaa8f5d0a
-1, 388163, 2760, 0x8e7ac9eb
-0, 393750, 28800, 0x605a5f9f
-1, 393796, 2756, 0x492b658e
-0, 399375, 28800, 0x68dc64b2
-1, 399420, 2756, 0x377483ab
-0, 405000, 28800, 0xd08e710b
-1, 405045, 2756, 0x2c250279
-0, 410625, 28800, 0xf8567939
-1, 410669, 2756, 0x704dbdb3
-0, 416250, 28800, 0x8dad7a4f
-1, 416294, 2756, 0x800d7da2
-0, 421875, 28800, 0x1a19813c
-1, 421918, 2756, 0x872aa32e
-0, 427500, 28800, 0x8a157f0e
-1, 427543, 2756, 0x2d4837fe
-0, 433125, 28800, 0xa4fa7b9d
-1, 433167, 2760, 0xc89ea57e
-0, 438750, 28800, 0x093b7b36
-1, 438800, 2756, 0x6447d7ef
-0, 444375, 28800, 0xa925755b
-1, 444424, 2756, 0x144f59cc
-0, 450000, 28800, 0xa5968138
-1, 450049, 2756, 0xc667154e
-0, 455625, 28800, 0xe00877ac
-1, 455673, 2756, 0xf0de66ae
-0, 461250, 28800, 0xd736183e
-1, 461298, 2756, 0xeabf3c32
-0, 466875, 28800, 0x356f2068
-1, 466922, 2756, 0xe98e81d1
-0, 472500, 28800, 0xf9a50f22
-1, 472547, 2760, 0x56aa5889
-0, 478125, 28800, 0x92df2ae8
-1, 478180, 2756, 0x4fd34c0e
-0, 483750, 28800, 0x67a43dc8
-1, 483804, 2756, 0x67cf6912
-0, 489375, 28800, 0xf8ce2ead
-1, 489429, 2756, 0xfa944def
-0, 495000, 28800, 0xf42f37ee
-1, 495053, 2756, 0xc12f23b2
-0, 500625, 28800, 0x03611f37
-1, 500678, 2756, 0x5ea325a2
-0, 506250, 28800, 0xddda2327
-1, 506302, 2756, 0x2b245824
-0, 511875, 28800, 0xdf073d85
-1, 511927, 2760, 0x90ac533e
-0, 517500, 28800, 0xa8331fee
-1, 517559, 2756, 0xcca34d26
-0, 523125, 28800, 0x59d3490a
-1, 523184, 2756, 0xb5f820d0
-0, 528750, 28800, 0xa8335be6
-1, 528808, 2756, 0x27f24335
-0, 534375, 28800, 0xd5483b43
-1, 534433, 2756, 0x4a9e87b7
-0, 540000, 28800, 0x23422dc9
-1, 540057, 2756, 0xbd076129
-0, 545625, 28800, 0xc04e4689
-1, 545682, 2756, 0x2e0e3f2e
-0, 551250, 28800, 0xd4d96372
-1, 551306, 2760, 0xdf534478
-0, 556875, 28800, 0x9c814e96
-1, 556939, 2756, 0xca000a2e
-0, 562500, 28800, 0x7c4b5d3b
-1, 562563, 2756, 0x87472df3
-0, 568125, 28800, 0x6bf66c04
-1, 568188, 2756, 0x16733810
-0, 573750, 28800, 0x6e8d4bb6
-1, 573812, 2756, 0xfa0734b4
-0, 579375, 28800, 0xad964d00
-1, 579437, 2756, 0x5eff3fc4
-0, 585000, 28800, 0x1ff36bd1
-1, 585061, 2756, 0xf35346bd
-0, 590625, 28800, 0xa4664c76
-1, 590686, 2756, 0xac6411c5
-0, 596250, 28800, 0x50626d82
-1, 596310, 2760, 0x478c3c56
-0, 601875, 28800, 0x81906c5c
-1, 601943, 2756, 0xebd30bdd
-0, 607500, 28800, 0x5060543f
-1, 607567, 2756, 0xaef95a31
-0, 613125, 28800, 0x231c5a86
-1, 613192, 2756, 0x8aad29d1
-0, 618750, 28800, 0x79775d48
-1, 618816, 2756, 0x626863f0
-0, 624375, 28800, 0xbb893571
-1, 624441, 2756, 0x68c05707
-0, 630000, 28800, 0x794c49ed
-1, 630065, 2756, 0x437c5e8d
-0, 635625, 28800, 0x70464bac
-1, 635690, 2760, 0x8eca4bdb
-0, 641250, 28800, 0xe79549ce
-1, 641322, 2756, 0x62bd4162
-0, 646875, 28800, 0xa6565555
-1, 646947, 2756, 0x9f744aa4
-0, 652500, 28800, 0x2ef1ad6d
-1, 652571, 2756, 0x0f3f6409
-0, 658125, 28800, 0xdd22b9aa
-1, 658196, 2756, 0x3fee827a
-0, 663750, 28800, 0x26ebaa97
-1, 663820, 2756, 0x48a0ac19
-0, 669375, 28800, 0x32bd979e
-1, 669445, 2756, 0x8e4ce0d0
-0, 675000, 28800, 0x4c167c9a
-1, 675069, 2760, 0xcda82236
-0, 680625, 28800, 0xfdf76051
-1, 680702, 2756, 0x0e523255
-0, 686250, 28800, 0x966938a8
-1, 686327, 2756, 0x84103d30
-0, 691875, 28800, 0xcea3fbde
-1, 691951, 2756, 0x13941cde
-0, 697500, 28800, 0x29a0c213
-1, 697576, 2756, 0x9fc834c5
-0, 703125, 28800, 0x5633a1c2
-1, 703200, 2756, 0xc0217a77
-0, 708750, 28800, 0xdc0b9af8
-1, 708824, 2756, 0x3f643659
-0, 714375, 28800, 0x92138848
-1, 714449, 2760, 0x9dbd6002
-0, 720000, 28800, 0xd7308da5
-1, 720082, 2756, 0x94f046fb
-0, 725625, 28800, 0x0c8f9b3f
-1, 725706, 2756, 0xab01fb12
-0, 731250, 28800, 0xd059b5d1
-1, 731331, 2756, 0x04cffe5c
-0, 736875, 28800, 0xba6ed9cd
-1, 736955, 2756, 0xef661c5e
-0, 742500, 28800, 0x896c1064
-1, 742580, 2756, 0x094c5fc5
-0, 748125, 28800, 0x986e2fc9
-1, 748204, 2756, 0xe0c1486a
-0, 753750, 28800, 0xcba94e4b
-1, 753829, 2760, 0x8c3535b7
-0, 759375, 28800, 0xf3e778ed
-1, 759461, 2756, 0x594934aa
-0, 765000, 28800, 0xc6cd7d48
-1, 765086, 2756, 0x74007238
-0, 770625, 28800, 0xd9bd84d8
-1, 770710, 2756, 0x61f1394d
-0, 776250, 28800, 0x391197b4
-1, 776335, 2756, 0x72584f07
-0, 781875, 28800, 0xf361a1d9
-1, 781959, 2756, 0xced9acf9
-0, 787500, 28800, 0x9a1ea54e
-1, 787584, 2756, 0x7d2e3ea1
-0, 793125, 28800, 0x551aab57
-1, 793208, 2756, 0x56c06897
-0, 798750, 28800, 0x3af8577d
-1, 798833, 2760, 0x19983bbf
-0, 804375, 28800, 0x10f76ed0
-1, 804465, 2756, 0x4f884f27
-0, 810000, 28800, 0x026a7fde
-1, 810090, 2756, 0x81ab2f63
-0, 815625, 28800, 0x3e0e8db8
-1, 815714, 2756, 0x448e681d
-0, 821250, 28800, 0x22998d2d
-1, 821339, 2756, 0x0ba9826e
-0, 826875, 28800, 0x05978b12
-1, 826963, 2756, 0x049f36fa
-0, 832500, 28800, 0x38b88294
-1, 832588, 2756, 0x096a2b62
-0, 838125, 28800, 0x2ef677d6
-1, 838212, 2760, 0x579e2035
-0, 843750, 28800, 0x0b9a8894
-1, 843845, 2756, 0xd13e30e1
-0, 849375, 28800, 0x2dcb6718
-1, 849469, 2756, 0x30b6412b
-0, 855000, 28800, 0xa31b6679
-1, 855094, 2756, 0xbb1c3268
-0, 860625, 28800, 0x262d6a50
-1, 860718, 2756, 0xbc175b6a
-0, 866250, 28800, 0xff3d6d0d
-1, 866343, 2756, 0xf8d160e2
-0, 871875, 28800, 0x159d7045
-1, 871967, 2756, 0xc1048154
-0, 877500, 28800, 0xf0df7800
-1, 877592, 2760, 0xb83548f4
-0, 883125, 28800, 0xbe825ea5
-1, 883224, 2756, 0x22647962
-0, 888750, 28800, 0x80e25d5a
-1, 888849, 2756, 0x14ca54d3
-0, 894375, 28800, 0x8cbe263f
-1, 894473, 2756, 0x58754b3a
+#tb 0: 1/16
+0, 0, 0, 1, 28800, 0x026058a9
+0, 1, 1, 1, 28800, 0x5dc728de
+0, 2, 2, 1, 28800, 0x83e19a2c
+0, 3, 3, 1, 28800, 0xb029f94a
+0, 4, 4, 1, 28800, 0x735a6b15
+0, 5, 5, 1, 28800, 0xf7e9dc8b
+0, 6, 6, 1, 28800, 0xa108b0cf
+0, 7, 7, 1, 28800, 0x3d11c138
+0, 8, 8, 1, 28800, 0xed23afda
+0, 9, 9, 1, 28800, 0x713bb2dc
+0, 10, 10, 1, 28800, 0x551ad51e
+0, 11, 11, 1, 28800, 0x49dfcf2d
+0, 12, 12, 1, 28800, 0x6399d5b3
+0, 13, 13, 1, 28800, 0x520ad812
+0, 14, 14, 1, 28800, 0xc46ad9da
+0, 15, 15, 1, 28800, 0xe79edb9e
+0, 16, 16, 1, 28800, 0xdb1acb30
+0, 17, 17, 1, 28800, 0x050fb669
+0, 18, 18, 1, 28800, 0x096ca687
+0, 19, 19, 1, 28800, 0x0054a6bd
+0, 20, 20, 1, 28800, 0x6d7daad2
+0, 21, 21, 1, 28800, 0x9c10a9dc
+0, 22, 22, 1, 28800, 0x89b1a623
+0, 23, 23, 1, 28800, 0xa0a19c3f
+0, 24, 24, 1, 28800, 0x26c898ad
+0, 25, 25, 1, 28800, 0x6f639dae
+0, 26, 26, 1, 28800, 0xa173a9b5
+0, 27, 27, 1, 28800, 0xa309aa08
+0, 28, 28, 1, 28800, 0x2059b6c4
+0, 29, 29, 1, 28800, 0x5ae8c761
+0, 30, 30, 1, 28800, 0xb780c9c5
+0, 31, 31, 1, 28800, 0xf58ac8fe
+0, 32, 32, 1, 28800, 0x9bb307e7
+0, 33, 33, 1, 28800, 0xd32c3e81
+0, 34, 34, 1, 28800, 0x4edd51d2
+0, 35, 35, 1, 28800, 0x5a88684d
+0, 36, 36, 1, 28800, 0x5bd97f0e
+0, 37, 37, 1, 28800, 0x36d67843
+0, 38, 38, 1, 28800, 0x0e18781d
+0, 39, 39, 1, 28800, 0xa3168807
+0, 40, 40, 1, 28800, 0xa7c575b8
+0, 41, 41, 1, 28800, 0x86367c37
+0, 42, 42, 1, 28800, 0xb0f79180
+0, 43, 43, 1, 28800, 0x61da8c0f
+0, 44, 44, 1, 28800, 0x9b11948a
+0, 45, 45, 1, 28800, 0xc53d9b44
+0, 46, 46, 1, 28800, 0xdc699185
+0, 47, 47, 1, 28800, 0x7b4f92b5
+0, 48, 48, 1, 28800, 0x40469065
+0, 49, 49, 1, 28800, 0x737ea07e
+0, 50, 50, 1, 28800, 0x0db49c8b
+0, 51, 51, 1, 28800, 0x39249f10
+0, 52, 52, 1, 28800, 0xc182ab99
+0, 53, 53, 1, 28800, 0xd8f7a7c9
+0, 54, 54, 1, 28800, 0x46789caa
+0, 55, 55, 1, 28800, 0x4759a374
+0, 56, 56, 1, 28800, 0xe621b16a
+0, 57, 57, 1, 28800, 0xcf47a999
+0, 58, 58, 1, 28800, 0x801dacd4
+0, 59, 59, 1, 28800, 0xe580af51
+0, 60, 60, 1, 28800, 0x03d7a887
+0, 61, 61, 1, 28800, 0xa67ea51d
+0, 62, 62, 1, 28800, 0x9fee0ec8
+0, 63, 63, 1, 28800, 0x7f602a5e
+0, 64, 64, 1, 28800, 0x100d432a
+0, 65, 65, 1, 28800, 0x42164dfb
+0, 66, 66, 1, 28800, 0x86c05196
+0, 67, 67, 1, 28800, 0xfc225938
+0, 68, 68, 1, 28800, 0x81085e87
+0, 69, 69, 1, 28800, 0xaa8f5d0a
+0, 70, 70, 1, 28800, 0x605a5f9f
+0, 71, 71, 1, 28800, 0x68dc64b2
+0, 72, 72, 1, 28800, 0xd08e710b
+0, 73, 73, 1, 28800, 0xf8567939
+0, 74, 74, 1, 28800, 0x8dad7a4f
+0, 75, 75, 1, 28800, 0x1a19813c
+0, 76, 76, 1, 28800, 0x8a157f0e
+0, 77, 77, 1, 28800, 0xa4fa7b9d
+0, 78, 78, 1, 28800, 0x093b7b36
+0, 79, 79, 1, 28800, 0xa925755b
+0, 80, 80, 1, 28800, 0xa5968138
+0, 81, 81, 1, 28800, 0xe00877ac
+0, 82, 82, 1, 28800, 0xd736183e
+0, 83, 83, 1, 28800, 0x356f2068
+0, 84, 84, 1, 28800, 0xf9a50f22
+0, 85, 85, 1, 28800, 0x92df2ae8
+0, 86, 86, 1, 28800, 0x67a43dc8
+0, 87, 87, 1, 28800, 0xf8ce2ead
+0, 88, 88, 1, 28800, 0xf42f37ee
+0, 89, 89, 1, 28800, 0x03611f37
+0, 90, 90, 1, 28800, 0xddda2327
+0, 91, 91, 1, 28800, 0xdf073d85
+0, 92, 92, 1, 28800, 0xa8331fee
+0, 93, 93, 1, 28800, 0x59d3490a
+0, 94, 94, 1, 28800, 0xa8335be6
+0, 95, 95, 1, 28800, 0xd5483b43
+0, 96, 96, 1, 28800, 0x23422dc9
+0, 97, 97, 1, 28800, 0xc04e4689
+0, 98, 98, 1, 28800, 0xd4d96372
+0, 99, 99, 1, 28800, 0x9c814e96
+0, 100, 100, 1, 28800, 0x7c4b5d3b
+0, 101, 101, 1, 28800, 0x6bf66c04
+0, 102, 102, 1, 28800, 0x6e8d4bb6
+0, 103, 103, 1, 28800, 0xad964d00
+0, 104, 104, 1, 28800, 0x1ff36bd1
+0, 105, 105, 1, 28800, 0xa4664c76
+0, 106, 106, 1, 28800, 0x50626d82
+0, 107, 107, 1, 28800, 0x81906c5c
+0, 108, 108, 1, 28800, 0x5060543f
+0, 109, 109, 1, 28800, 0x231c5a86
+0, 110, 110, 1, 28800, 0x79775d48
+0, 111, 111, 1, 28800, 0xbb893571
+0, 112, 112, 1, 28800, 0x794c49ed
+0, 113, 113, 1, 28800, 0x70464bac
+0, 114, 114, 1, 28800, 0xe79549ce
+0, 115, 115, 1, 28800, 0xa6565555
+0, 116, 116, 1, 28800, 0x2ef1ad6d
+0, 117, 117, 1, 28800, 0xdd22b9aa
+0, 118, 118, 1, 28800, 0x26ebaa97
+0, 119, 119, 1, 28800, 0x32bd979e
+0, 120, 120, 1, 28800, 0x4c167c9a
+0, 121, 121, 1, 28800, 0xfdf76051
+0, 122, 122, 1, 28800, 0x966938a8
+0, 123, 123, 1, 28800, 0xcea3fbde
+0, 124, 124, 1, 28800, 0x29a0c213
+0, 125, 125, 1, 28800, 0x5633a1c2
+0, 126, 126, 1, 28800, 0xdc0b9af8
+0, 127, 127, 1, 28800, 0x92138848
+0, 128, 128, 1, 28800, 0xd7308da5
+0, 129, 129, 1, 28800, 0x0c8f9b3f
+0, 130, 130, 1, 28800, 0xd059b5d1
+0, 131, 131, 1, 28800, 0xba6ed9cd
+0, 132, 132, 1, 28800, 0x896c1064
+0, 133, 133, 1, 28800, 0x986e2fc9
+0, 134, 134, 1, 28800, 0xcba94e4b
+0, 135, 135, 1, 28800, 0xf3e778ed
+0, 136, 136, 1, 28800, 0xc6cd7d48
+0, 137, 137, 1, 28800, 0xd9bd84d8
+0, 138, 138, 1, 28800, 0x391197b4
+0, 139, 139, 1, 28800, 0xf361a1d9
+0, 140, 140, 1, 28800, 0x9a1ea54e
+0, 141, 141, 1, 28800, 0x551aab57
+0, 142, 142, 1, 28800, 0x3af8577d
+0, 143, 143, 1, 28800, 0x10f76ed0
+0, 144, 144, 1, 28800, 0x026a7fde
+0, 145, 145, 1, 28800, 0x3e0e8db8
+0, 146, 146, 1, 28800, 0x22998d2d
+0, 147, 147, 1, 28800, 0x05978b12
+0, 148, 148, 1, 28800, 0x38b88294
+0, 149, 149, 1, 28800, 0x2ef677d6
+0, 150, 150, 1, 28800, 0x0b9a8894
+0, 151, 151, 1, 28800, 0x2dcb6718
+0, 152, 152, 1, 28800, 0xa31b6679
+0, 153, 153, 1, 28800, 0x262d6a50
+0, 154, 154, 1, 28800, 0xff3d6d0d
+0, 155, 155, 1, 28800, 0x159d7045
+0, 156, 156, 1, 28800, 0xf0df7800
+0, 157, 157, 1, 28800, 0xbe825ea5
+0, 158, 158, 1, 28800, 0x80e25d5a
+0, 159, 159, 1, 28800, 0x8cbe263f
diff --git a/gst-libs/ext/libav/tests/ref/fate/ansi b/gst-libs/ext/libav/tests/ref/fate/ansi
index bb9f35f..78e853f 100644
--- a/gst-libs/ext/libav/tests/ref/fate/ansi
+++ b/gst-libs/ext/libav/tests/ref/fate/ansi
@@ -1,17 +1,18 @@
-0, 0, 768000, 0x3032d0de
-0, 3600, 768000, 0xc3be5922
-0, 7200, 768000, 0xf530c476
-0, 10800, 768000, 0x11c1fb8e
-0, 14400, 768000, 0x72d12da9
-0, 18000, 768000, 0x39c7a70d
-0, 21600, 768000, 0x94bd32a4
-0, 25200, 768000, 0x06dd5ba1
-0, 28800, 768000, 0x9616ec95
-0, 32400, 768000, 0x6df5b9e2
-0, 36000, 768000, 0x7be7f60a
-0, 39600, 768000, 0x2abc8623
-0, 43200, 768000, 0x5678bfff
-0, 46800, 768000, 0x24a03042
-0, 50400, 768000, 0xfb011b23
-0, 54000, 768000, 0x925ff5e9
-0, 57600, 768000, 0x890e2a56
+#tb 0: 1/25
+0, 0, 0, 1, 768000, 0x772dd3d0
+0, 1, 1, 1, 768000, 0xd7dab1d1
+0, 2, 2, 1, 768000, 0x0e56f2d3
+0, 3, 3, 1, 768000, 0x11c1fb8e
+0, 4, 4, 1, 768000, 0x72d12da9
+0, 5, 5, 1, 768000, 0x39c7a70d
+0, 6, 6, 1, 768000, 0x94bd32a4
+0, 7, 7, 1, 768000, 0x06dd5ba1
+0, 8, 8, 1, 768000, 0x9616ec95
+0, 9, 9, 1, 768000, 0x6df5b9e2
+0, 10, 10, 1, 768000, 0x7be7f60a
+0, 11, 11, 1, 768000, 0x2abc8623
+0, 12, 12, 1, 768000, 0x5678bfff
+0, 13, 13, 1, 768000, 0x24a03042
+0, 14, 14, 1, 768000, 0xfb011b23
+0, 15, 15, 1, 768000, 0x925ff5e9
+0, 16, 16, 1, 768000, 0x890e2a56
diff --git a/gst-libs/ext/libav/tests/ref/fate/armovie-escape124 b/gst-libs/ext/libav/tests/ref/fate/armovie-escape124
index 19e6795..c686327 100644
--- a/gst-libs/ext/libav/tests/ref/fate/armovie-escape124
+++ b/gst-libs/ext/libav/tests/ref/fate/armovie-escape124
@@ -1,104 +1,106 @@
-0, 0, 230400, 0x5288d70f
-1, 0, 176400, 0xdd61578c
-0, 3600, 230400, 0x2d3c1066
-0, 7200, 230400, 0x89eb5b4a
-0, 10800, 230400, 0x24c2d2e7
-0, 14400, 230400, 0x9271cb38
-0, 18000, 230400, 0xc74a5009
-0, 21600, 230400, 0x61d70705
-0, 25200, 230400, 0x6bb2c252
-0, 28800, 230400, 0x6b3ac910
-0, 32400, 230400, 0x44071f28
-0, 36000, 230400, 0x8abd00fe
-0, 39600, 230400, 0xcbe3395d
-0, 43200, 230400, 0x603e7b7a
-0, 46800, 230400, 0x2ca8865b
-0, 50400, 230400, 0x11b4c665
-0, 54000, 230400, 0x3f19787c
-0, 57600, 230400, 0x651d24b6
-0, 61200, 230400, 0x325d05af
-0, 64800, 230400, 0x4f89d8a8
-0, 68400, 230400, 0xb07647f0
-0, 72000, 230400, 0x71141237
-0, 75600, 230400, 0xa848a2d2
-0, 79200, 230400, 0x3fbe4b58
-0, 82800, 230400, 0xa1e235a0
-0, 86400, 230400, 0x9bcf607a
-0, 90000, 230400, 0x3302e9eb
-1, 90000, 176400, 0x0b9e6d67
-0, 93600, 230400, 0xd731ba90
-0, 97200, 230400, 0x821eedcf
-0, 100800, 230400, 0xd068a93d
-0, 104400, 230400, 0x2811d46e
-0, 108000, 230400, 0xd9740446
-0, 111600, 230400, 0x1bce0df6
-0, 115200, 230400, 0x44bc60ad
-0, 118800, 230400, 0xf56f6200
-0, 122400, 230400, 0x874a2264
-0, 126000, 230400, 0xaa155c0e
-0, 129600, 230400, 0x595392d4
-0, 133200, 230400, 0x58dc57de
-0, 136800, 230400, 0x1c06733e
-0, 140400, 230400, 0x6807b1db
-0, 144000, 230400, 0x3fedff87
-0, 147600, 230400, 0x3e38cc13
-0, 151200, 230400, 0x6685ec35
-0, 154800, 230400, 0x6c0742fd
-0, 158400, 230400, 0x8108f83c
-0, 162000, 230400, 0xc0e217c8
-0, 165600, 230400, 0xb22ca65d
-0, 169200, 230400, 0xd54cec93
-0, 172800, 230400, 0xd9d61de3
-0, 176400, 230400, 0x7e0f9675
-0, 180000, 230400, 0x9869f5b7
-1, 180000, 176400, 0x2793fad7
-0, 183600, 230400, 0x22f33400
-0, 187200, 230400, 0x31b999bd
-0, 190800, 230400, 0x36c23878
-0, 194400, 230400, 0x06093a30
-0, 198000, 230400, 0x213f1718
-0, 201600, 230400, 0x83683006
-0, 205200, 230400, 0x0bfcec36
-0, 208800, 230400, 0x01b77825
-0, 212400, 230400, 0x650a5ea2
-0, 216000, 230400, 0xd8b2c559
-0, 219600, 230400, 0xb012eb10
-0, 223200, 230400, 0x135d53a4
-0, 226800, 230400, 0x98dd0712
-0, 230400, 230400, 0x75240ac0
-0, 234000, 230400, 0xa16769d5
-0, 237600, 230400, 0x3e08cda3
-0, 241200, 230400, 0xcd20d561
-0, 244800, 230400, 0x3531577d
-0, 248400, 230400, 0x65ff4c82
-0, 252000, 230400, 0x8fd4a580
-0, 255600, 230400, 0x3cf7af4c
-0, 259200, 230400, 0xda7a9202
-0, 262800, 230400, 0x4bebc138
-0, 266400, 230400, 0x5517e685
-0, 270000, 230400, 0x95f6c7a3
-1, 270000, 176400, 0xe2649a4a
-0, 273600, 230400, 0x9849ebf9
-0, 277200, 230400, 0xd77e1c7d
-0, 280800, 230400, 0x4dc6c923
-0, 284400, 230400, 0x7ce817c8
-0, 288000, 230400, 0xafb4acde
-0, 291600, 230400, 0xd0030b2c
-0, 295200, 230400, 0xb3acb77c
-0, 298800, 230400, 0x4d32b61c
-0, 302400, 230400, 0x2436a915
-0, 306000, 230400, 0xa6fd831f
-0, 309600, 230400, 0x6c6edfca
-0, 313200, 230400, 0x4b30d72e
-0, 316800, 230400, 0x59f46a8a
-0, 320400, 230400, 0xa2d0435f
-0, 324000, 230400, 0x463872c4
-0, 327600, 230400, 0x1d7e870a
-0, 331200, 230400, 0x74f4e530
-0, 334800, 230400, 0xbc61053d
-0, 338400, 230400, 0x5fb238dc
-0, 342000, 230400, 0x14a29d83
-0, 345600, 230400, 0x3fd1d09b
-0, 349200, 230400, 0x098afc13
-0, 352800, 230400, 0x9bd12a62
-0, 356400, 230400, 0x7bf71419
+#tb 0: 1/25
+#tb 1: 1/44100
+0, 0, 0, 1, 230400, 0x5288d70f
+1, 0, 0, 44100, 176400, 0xdd61578c
+0, 1, 1, 1, 230400, 0x2d3c1066
+0, 2, 2, 1, 230400, 0x89eb5b4a
+0, 3, 3, 1, 230400, 0x24c2d2e7
+0, 4, 4, 1, 230400, 0x9271cb38
+0, 5, 5, 1, 230400, 0xc74a5009
+0, 6, 6, 1, 230400, 0x61d70705
+0, 7, 7, 1, 230400, 0x6bb2c252
+0, 8, 8, 1, 230400, 0x6b3ac910
+0, 9, 9, 1, 230400, 0x44071f28
+0, 10, 10, 1, 230400, 0x8abd00fe
+0, 11, 11, 1, 230400, 0xcbe3395d
+0, 12, 12, 1, 230400, 0x603e7b7a
+0, 13, 13, 1, 230400, 0x2ca8865b
+0, 14, 14, 1, 230400, 0x11b4c665
+0, 15, 15, 1, 230400, 0x3f19787c
+0, 16, 16, 1, 230400, 0x651d24b6
+0, 17, 17, 1, 230400, 0x325d05af
+0, 18, 18, 1, 230400, 0x4f89d8a8
+0, 19, 19, 1, 230400, 0xb07647f0
+0, 20, 20, 1, 230400, 0x71141237
+0, 21, 21, 1, 230400, 0xa848a2d2
+0, 22, 22, 1, 230400, 0x3fbe4b58
+0, 23, 23, 1, 230400, 0xa1e235a0
+0, 24, 24, 1, 230400, 0x9bcf607a
+0, 25, 25, 1, 230400, 0x3302e9eb
+1, 44100, 44100, 44100, 176400, 0x0b9e6d67
+0, 26, 26, 1, 230400, 0xd731ba90
+0, 27, 27, 1, 230400, 0x821eedcf
+0, 28, 28, 1, 230400, 0xd068a93d
+0, 29, 29, 1, 230400, 0x2811d46e
+0, 30, 30, 1, 230400, 0xd9740446
+0, 31, 31, 1, 230400, 0x1bce0df6
+0, 32, 32, 1, 230400, 0x44bc60ad
+0, 33, 33, 1, 230400, 0xf56f6200
+0, 34, 34, 1, 230400, 0x874a2264
+0, 35, 35, 1, 230400, 0xaa155c0e
+0, 36, 36, 1, 230400, 0x595392d4
+0, 37, 37, 1, 230400, 0x58dc57de
+0, 38, 38, 1, 230400, 0x1c06733e
+0, 39, 39, 1, 230400, 0x6807b1db
+0, 40, 40, 1, 230400, 0x3fedff87
+0, 41, 41, 1, 230400, 0x3e38cc13
+0, 42, 42, 1, 230400, 0x6685ec35
+0, 43, 43, 1, 230400, 0x6c0742fd
+0, 44, 44, 1, 230400, 0x8108f83c
+0, 45, 45, 1, 230400, 0xc0e217c8
+0, 46, 46, 1, 230400, 0xb22ca65d
+0, 47, 47, 1, 230400, 0xd54cec93
+0, 48, 48, 1, 230400, 0xd9d61de3
+0, 49, 49, 1, 230400, 0x7e0f9675
+0, 50, 50, 1, 230400, 0x9869f5b7
+1, 88200, 88200, 44100, 176400, 0x2793fad7
+0, 51, 51, 1, 230400, 0x22f33400
+0, 52, 52, 1, 230400, 0x31b999bd
+0, 53, 53, 1, 230400, 0x36c23878
+0, 54, 54, 1, 230400, 0x06093a30
+0, 55, 55, 1, 230400, 0x213f1718
+0, 56, 56, 1, 230400, 0x83683006
+0, 57, 57, 1, 230400, 0x0bfcec36
+0, 58, 58, 1, 230400, 0x01b77825
+0, 59, 59, 1, 230400, 0x650a5ea2
+0, 60, 60, 1, 230400, 0xd8b2c559
+0, 61, 61, 1, 230400, 0xb012eb10
+0, 62, 62, 1, 230400, 0x135d53a4
+0, 63, 63, 1, 230400, 0x98dd0712
+0, 64, 64, 1, 230400, 0x75240ac0
+0, 65, 65, 1, 230400, 0xa16769d5
+0, 66, 66, 1, 230400, 0x3e08cda3
+0, 67, 67, 1, 230400, 0xcd20d561
+0, 68, 68, 1, 230400, 0x3531577d
+0, 69, 69, 1, 230400, 0x65ff4c82
+0, 70, 70, 1, 230400, 0x8fd4a580
+0, 71, 71, 1, 230400, 0x3cf7af4c
+0, 72, 72, 1, 230400, 0xda7a9202
+0, 73, 73, 1, 230400, 0x4bebc138
+0, 74, 74, 1, 230400, 0x5517e685
+0, 75, 75, 1, 230400, 0x95f6c7a3
+1, 132300, 132300, 44100, 176400, 0xe2649a4a
+0, 76, 76, 1, 230400, 0x9849ebf9
+0, 77, 77, 1, 230400, 0xd77e1c7d
+0, 78, 78, 1, 230400, 0x4dc6c923
+0, 79, 79, 1, 230400, 0x7ce817c8
+0, 80, 80, 1, 230400, 0xafb4acde
+0, 81, 81, 1, 230400, 0xd0030b2c
+0, 82, 82, 1, 230400, 0xb3acb77c
+0, 83, 83, 1, 230400, 0x4d32b61c
+0, 84, 84, 1, 230400, 0x2436a915
+0, 85, 85, 1, 230400, 0xa6fd831f
+0, 86, 86, 1, 230400, 0x6c6edfca
+0, 87, 87, 1, 230400, 0x4b30d72e
+0, 88, 88, 1, 230400, 0x59f46a8a
+0, 89, 89, 1, 230400, 0xa2d0435f
+0, 90, 90, 1, 230400, 0x463872c4
+0, 91, 91, 1, 230400, 0x1d7e870a
+0, 92, 92, 1, 230400, 0x74f4e530
+0, 93, 93, 1, 230400, 0xbc61053d
+0, 94, 94, 1, 230400, 0x5fb238dc
+0, 95, 95, 1, 230400, 0x14a29d83
+0, 96, 96, 1, 230400, 0x3fd1d09b
+0, 97, 97, 1, 230400, 0x098afc13
+0, 98, 98, 1, 230400, 0x9bd12a62
+0, 99, 99, 1, 230400, 0x7bf71419
diff --git a/gst-libs/ext/libav/tests/ref/fate/auravision-v1 b/gst-libs/ext/libav/tests/ref/fate/auravision-v1
index a7bccc0..456f399 100644
--- a/gst-libs/ext/libav/tests/ref/fate/auravision-v1
+++ b/gst-libs/ext/libav/tests/ref/fate/auravision-v1
@@ -1,24 +1,25 @@
-0, 0, 28800, 0x4a4efbbc
-0, 6001, 28800, 0xc6c7e26a
-0, 12002, 28800, 0x6cd40913
-0, 18003, 28800, 0xa7b40fe9
-0, 24004, 28800, 0x5e77fcc6
-0, 30005, 28800, 0x9b3ef3f0
-0, 36006, 28800, 0xe7031845
-0, 42007, 28800, 0x2c15458d
-0, 48008, 28800, 0xbc3d4abf
-0, 54009, 28800, 0xf8755ac7
-0, 60010, 28800, 0x64d0405b
-0, 66011, 28800, 0x1e0c341d
-0, 72012, 28800, 0x05ca3c2b
-0, 78013, 28800, 0x28cb307f
-0, 84014, 28800, 0x3a9855af
-0, 90015, 28800, 0x92b63321
-0, 96016, 28800, 0x85585151
-0, 102017, 28800, 0x1ff01bf9
-0, 108018, 28800, 0x4bab200f
-0, 114019, 28800, 0xcf732ad7
-0, 120020, 28800, 0xced00cff
-0, 126021, 28800, 0xa69046fd
-0, 132022, 28800, 0x5aa341c3
-0, 138023, 28800, 0x87ef6219
+#tb 0: 33339/500000
+0, 0, 0, 1, 28800, 0x4a4efbbc
+0, 1, 1, 1, 28800, 0xc6c7e26a
+0, 2, 2, 1, 28800, 0x6cd40913
+0, 3, 3, 1, 28800, 0xa7b40fe9
+0, 4, 4, 1, 28800, 0x5e77fcc6
+0, 5, 5, 1, 28800, 0x9b3ef3f0
+0, 6, 6, 1, 28800, 0xe7031845
+0, 7, 7, 1, 28800, 0x2c15458d
+0, 8, 8, 1, 28800, 0xbc3d4abf
+0, 9, 9, 1, 28800, 0xf8755ac7
+0, 10, 10, 1, 28800, 0x64d0405b
+0, 11, 11, 1, 28800, 0x1e0c341d
+0, 12, 12, 1, 28800, 0x05ca3c2b
+0, 13, 13, 1, 28800, 0x28cb307f
+0, 14, 14, 1, 28800, 0x3a9855af
+0, 15, 15, 1, 28800, 0x92b63321
+0, 16, 16, 1, 28800, 0x85585151
+0, 17, 17, 1, 28800, 0x1ff01bf9
+0, 18, 18, 1, 28800, 0x4bab200f
+0, 19, 19, 1, 28800, 0xcf732ad7
+0, 20, 20, 1, 28800, 0xced00cff
+0, 21, 21, 1, 28800, 0xa69046fd
+0, 22, 22, 1, 28800, 0x5aa341c3
+0, 23, 23, 1, 28800, 0x87ef6219
diff --git a/gst-libs/ext/libav/tests/ref/fate/auravision-v2 b/gst-libs/ext/libav/tests/ref/fate/auravision-v2
index a4b6e82..f1e8e3a 100644
--- a/gst-libs/ext/libav/tests/ref/fate/auravision-v2
+++ b/gst-libs/ext/libav/tests/ref/fate/auravision-v2
@@ -1,2 +1,3 @@
-0, 0, 115200, 0x2f247f66
-0, 3000, 115200, 0xf492929e
+#tb 0: 33333/1000000
+0, 0, 0, 1, 115200, 0x2f247f66
+0, 1, 1, 1, 115200, 0xf492929e
diff --git a/gst-libs/ext/libav/tests/ref/fate/avstring b/gst-libs/ext/libav/tests/ref/fate/avstring
new file mode 100644
index 0000000..bc231e8
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/avstring
@@ -0,0 +1,27 @@
+Testing av_get_token()
+|''| -> || + ||
+|| -> || + ||
+|:| -> || + |:|
+|\| -> |\| + ||
+|'| -> || + ||
+| '' :| -> || + |:|
+| '' '' :| -> | | + |:|
+|foo '' :| -> |foo | + |:|
+|'foo'| -> |foo| + ||
+|foo | -> |foo| + ||
+| ' foo ' | -> | foo | + ||
+|foo\| -> |foo\| + ||
+|foo': blah:blah| -> |foo: blah:blah| + ||
+|foo\: blah:blah| -> |foo: blah| + |:blah|
+|foo'| -> |foo| + ||
+|'foo : ' :blahblah| -> |foo : | + |:blahblah|
+|\ :blah| -> | | + |:blah|
+| foo| -> |foo| + ||
+| foo | -> |foo| + ||
+| foo \ | -> |foo | + ||
+|foo ':blah| -> |foo :blah| + ||
+| foo bar : blahblah| -> |foo bar| + |: blahblah|
+|\f\o\o| -> |foo| + ||
+|'foo : \ \ ' : blahblah| -> |foo : \ \ | + |: blahblah|
+|'\fo\o:': blahblah| -> |\fo\o:| + |: blahblah|
+|\'fo\o\:': foo ' :blahblah| -> |'foo:: foo | + |:blahblah|
diff --git a/gst-libs/ext/libav/tests/ref/fate/bethsoft-vid b/gst-libs/ext/libav/tests/ref/fate/bethsoft-vid
index 0886bfc..a4c049e 100644
--- a/gst-libs/ext/libav/tests/ref/fate/bethsoft-vid
+++ b/gst-libs/ext/libav/tests/ref/fate/bethsoft-vid
@@ -1,142 +1,144 @@
-0, 0, 192000, 0xdecc683b
-1, 0, 1480, 0x00000000
-0, 1500, 192000, 0x00000000
-0, 3000, 192000, 0x01a6cf45
-0, 4500, 192000, 0xd07d57e9
-1, 5994, 1480, 0x20a92bd4
-0, 6000, 192000, 0x3cb1dff5
-0, 7500, 192000, 0xd1aaa8fb
-0, 9000, 192000, 0x75f526cd
-0, 10500, 192000, 0x0f673577
-1, 11988, 1850, 0xa9e48a74
-0, 12000, 192000, 0x897b6781
-0, 13500, 192000, 0x81e6b7f7
-0, 15000, 192000, 0x1f45ce61
-0, 16500, 192000, 0x5a0772a6
-0, 18000, 192000, 0xf78732b3
-1, 19481, 1480, 0x23ecd018
-0, 19500, 192000, 0x8427f9e5
-0, 21000, 192000, 0x40473f11
-0, 22500, 192000, 0x173ceebe
-0, 24000, 192000, 0x136b9516
-1, 25475, 1480, 0x206bb915
-0, 25500, 192000, 0x138d11ae
-0, 27000, 192000, 0x063dbff3
-0, 28500, 192000, 0x5280852f
-0, 30000, 192000, 0x99943a8f
-1, 31469, 1850, 0xb0e10e75
-0, 31500, 192000, 0x0330a728
-0, 33000, 192000, 0x5d35467d
-0, 34500, 192000, 0xfd436343
-0, 36000, 192000, 0xc323fcfe
-0, 37500, 192000, 0x2a1530a0
-1, 38961, 1480, 0x8d9baedd
-0, 39000, 192000, 0xbd43bb60
-0, 40500, 192000, 0xa47f5eab
-0, 42000, 192000, 0xff17f5f7
-0, 43500, 192000, 0xb4140b55
-1, 44955, 1480, 0xb802aae1
-0, 45000, 192000, 0xb8782cc4
-0, 46500, 192000, 0x92975b8b
-0, 48000, 192000, 0xf42a64d6
-0, 49500, 192000, 0x2cc7077d
-1, 50950, 1480, 0xecd7b5cc
-0, 51000, 192000, 0x00080cc8
-0, 52500, 192000, 0x584b48f3
-0, 54000, 192000, 0xd68f57da
-0, 55500, 192000, 0x60158422
-1, 56944, 1850, 0x16861355
-0, 57000, 192000, 0xd7fb89e6
-0, 58500, 192000, 0x97f1c76a
-0, 60000, 192000, 0x46c4bb9e
-0, 61500, 192000, 0xd32f9b66
-0, 63000, 192000, 0x74f43886
-1, 64436, 1480, 0xa51690bd
-0, 64500, 192000, 0x3c4e47df
-0, 66000, 192000, 0xb5ac0a58
-0, 67500, 192000, 0xcc572b31
-0, 69000, 192000, 0xb1739d26
-1, 70430, 1480, 0xdd0b90d1
-0, 70500, 192000, 0x73da5473
-0, 72000, 192000, 0x5f79f5bc
-0, 73500, 192000, 0x0affc0a0
-0, 75000, 192000, 0x2b4d5c1c
-1, 76424, 1850, 0x3ce6e333
-0, 76500, 192000, 0x309b41bc
-0, 78000, 192000, 0xd42b6424
-0, 79500, 192000, 0x4795c948
-0, 81000, 192000, 0xbc1a3a8b
-0, 82500, 192000, 0x16529c5b
-1, 83917, 1480, 0xf8ce8ea3
-0, 84000, 192000, 0x6b1b31ba
-0, 85500, 192000, 0x569182ce
-0, 87000, 192000, 0xe6ea9866
-0, 88500, 192000, 0x102c6076
-1, 89911, 1480, 0xda4597af
-0, 90000, 192000, 0xb29f527a
-0, 91500, 192000, 0x040b4eee
-0, 93000, 192000, 0x92574f4a
-0, 94500, 192000, 0x1e8acdce
-1, 95905, 1480, 0x918f7cb3
-0, 96000, 192000, 0x1becf516
-0, 97500, 192000, 0xb62e9776
-0, 99000, 192000, 0xed37a08e
-0, 100500, 192000, 0xc0719912
-1, 101899, 1850, 0xca6edb15
-0, 102000, 192000, 0x24cf7a7e
-0, 103500, 192000, 0x0307f62f
-0, 105000, 192000, 0x79b7417b
-1, 109392, 1480, 0xba279597
-1, 115386, 1480, 0xc5a38a9e
-1, 121380, 1850, 0x8147eef5
-1, 128872, 1480, 0xce2c7cb5
-1, 134866, 1480, 0x4282819f
-1, 140860, 1480, 0xbdbb8da6
-1, 146854, 1850, 0xdbbeea10
-1, 154347, 1480, 0xbe6a77c2
-1, 160341, 1480, 0xa85c75b2
-1, 166335, 1850, 0xa45bde21
-1, 173828, 1480, 0x84aa7895
-1, 179822, 1480, 0x147f7d9f
-1, 185816, 1480, 0xc8e77b85
-1, 191810, 1850, 0x10d4d81b
-1, 199302, 1480, 0xb4ae8bb1
-1, 205297, 1480, 0x3ef782a5
-1, 211291, 1850, 0xdeebda14
-1, 218783, 1480, 0x4c7e7bbb
-1, 224777, 1480, 0x0e0e9198
-1, 230771, 1480, 0x5c1f819f
-1, 236765, 1850, 0x0e4cf6ff
-1, 244258, 1480, 0x374388a7
-1, 250252, 1480, 0xed729389
-1, 256246, 1850, 0xe0f1e43f
-1, 263739, 1480, 0x3b27839a
-1, 269733, 1480, 0xe6287e94
-1, 275727, 1480, 0x7e0d84b5
-1, 281721, 1850, 0xf08bebf7
-1, 289213, 1480, 0x94cf73a0
-1, 295207, 1480, 0xfef384ae
-1, 301202, 1850, 0x3b93e0f7
-1, 308694, 1480, 0x28d27bae
-1, 314688, 1480, 0x94d57da5
-1, 320682, 1480, 0xc9327db5
-1, 326676, 1850, 0xe781f604
-1, 334169, 1480, 0x752f8c5b
-1, 340163, 1480, 0x30068032
-1, 346157, 1850, 0x7895023e
-1, 353650, 1480, 0xa1e0a6e1
-1, 359644, 1480, 0x6af4b500
-1, 365638, 1480, 0xc26ea4c7
-1, 371632, 1850, 0x16a72419
-1, 379124, 1480, 0x1794aacc
-1, 385118, 1480, 0x2ecad8d0
-1, 391112, 1850, 0x2e645e07
-1, 398605, 1480, 0x1c54dfe7
-1, 404599, 1480, 0xbd35feec
-1, 410593, 1480, 0x419403d6
-1, 416587, 1850, 0x78699d2a
-1, 424080, 1480, 0x74ec68e0
-1, 430074, 1480, 0x76af64d9
-1, 436068, 1850, 0x5a303d1a
-1, 443560, 1074, 0x142ce7ba
-1, 447910, 1850, 0x7ff682f7
+#tb 0: 185/11111
+#tb 1: 1/11111
+0, 0, 0, 1, 192000, 0x00000000
+1, 0, 0, 740, 1480, 0x00000000
+0, 4, 4, 1, 192000, 0x01a6cf45
+1, 740, 740, 740, 1480, 0x20a92bd4
+0, 8, 8, 1, 192000, 0xd07d57e9
+1, 1480, 1480, 925, 1850, 0xa9e48a74
+0, 13, 13, 1, 192000, 0x3cb1dff5
+1, 2405, 2405, 740, 1480, 0x23ecd018
+0, 17, 17, 1, 192000, 0xd1aaa8fb
+1, 3145, 3145, 740, 1480, 0x206bb915
+0, 21, 21, 1, 192000, 0x75f526cd
+1, 3885, 3885, 925, 1850, 0xb0e10e75
+0, 26, 26, 1, 192000, 0x0f673577
+1, 4810, 4810, 740, 1480, 0x8d9baedd
+0, 30, 30, 1, 192000, 0x897b6781
+1, 5550, 5550, 740, 1480, 0xb802aae1
+0, 34, 34, 1, 192000, 0x81e6b7f7
+1, 6290, 6290, 740, 1480, 0xecd7b5cc
+0, 38, 38, 1, 192000, 0x1f45ce61
+1, 7030, 7030, 925, 1850, 0x16861355
+0, 43, 43, 1, 192000, 0x5a0772a6
+1, 7955, 7955, 740, 1480, 0xa51690bd
+0, 47, 47, 1, 192000, 0xf78732b3
+1, 8695, 8695, 740, 1480, 0xdd0b90d1
+0, 51, 51, 1, 192000, 0x8427f9e5
+1, 9435, 9435, 925, 1850, 0x3ce6e333
+0, 56, 56, 1, 192000, 0x40473f11
+1, 10360, 10360, 740, 1480, 0xf8ce8ea3
+0, 60, 60, 1, 192000, 0x173ceebe
+1, 11100, 11100, 740, 1480, 0xda4597af
+0, 64, 64, 1, 192000, 0x136b9516
+1, 11840, 11840, 740, 1480, 0x918f7cb3
+0, 68, 68, 1, 192000, 0x138d11ae
+1, 12580, 12580, 925, 1850, 0xca6edb15
+0, 73, 73, 1, 192000, 0x063dbff3
+1, 13505, 13505, 740, 1480, 0xba279597
+0, 77, 77, 1, 192000, 0x5280852f
+1, 14245, 14245, 740, 1480, 0xc5a38a9e
+0, 81, 81, 1, 192000, 0x99943a8f
+1, 14985, 14985, 925, 1850, 0x8147eef5
+0, 86, 86, 1, 192000, 0x0330a728
+1, 15910, 15910, 740, 1480, 0xce2c7cb5
+0, 90, 90, 1, 192000, 0x5d35467d
+1, 16650, 16650, 740, 1480, 0x4282819f
+0, 94, 94, 1, 192000, 0xfd436343
+1, 17390, 17390, 740, 1480, 0xbdbb8da6
+0, 98, 98, 1, 192000, 0xc323fcfe
+1, 18130, 18130, 925, 1850, 0xdbbeea10
+0, 103, 103, 1, 192000, 0x2a1530a0
+1, 19055, 19055, 740, 1480, 0xbe6a77c2
+0, 107, 107, 1, 192000, 0xbd43bb60
+1, 19795, 19795, 740, 1480, 0xa85c75b2
+0, 111, 111, 1, 192000, 0xa47f5eab
+1, 20535, 20535, 925, 1850, 0xa45bde21
+0, 116, 116, 1, 192000, 0xff17f5f7
+1, 21460, 21460, 740, 1480, 0x84aa7895
+0, 120, 120, 1, 192000, 0xb4140b55
+1, 22200, 22200, 740, 1480, 0x147f7d9f
+0, 124, 124, 1, 192000, 0xb8782cc4
+1, 22940, 22940, 740, 1480, 0xc8e77b85
+0, 128, 128, 1, 192000, 0x92975b8b
+1, 23680, 23680, 925, 1850, 0x10d4d81b
+0, 133, 133, 1, 192000, 0xf42a64d6
+1, 24605, 24605, 740, 1480, 0xb4ae8bb1
+0, 137, 137, 1, 192000, 0x2cc7077d
+1, 25345, 25345, 740, 1480, 0x3ef782a5
+0, 141, 141, 1, 192000, 0x00080cc8
+1, 26085, 26085, 925, 1850, 0xdeebda14
+0, 146, 146, 1, 192000, 0x584b48f3
+1, 27010, 27010, 740, 1480, 0x4c7e7bbb
+0, 150, 150, 1, 192000, 0xd68f57da
+1, 27750, 27750, 740, 1480, 0x0e0e9198
+0, 154, 154, 1, 192000, 0x60158422
+1, 28490, 28490, 740, 1480, 0x5c1f819f
+0, 158, 158, 1, 192000, 0xd7fb89e6
+1, 29230, 29230, 925, 1850, 0x0e4cf6ff
+0, 163, 163, 1, 192000, 0x97f1c76a
+1, 30155, 30155, 740, 1480, 0x374388a7
+0, 167, 167, 1, 192000, 0x46c4bb9e
+1, 30895, 30895, 740, 1480, 0xed729389
+0, 171, 171, 1, 192000, 0xd32f9b66
+1, 31635, 31635, 925, 1850, 0xe0f1e43f
+0, 176, 176, 1, 192000, 0x74f43886
+1, 32560, 32560, 740, 1480, 0x3b27839a
+0, 180, 180, 1, 192000, 0x3c4e47df
+1, 33300, 33300, 740, 1480, 0xe6287e94
+0, 184, 184, 1, 192000, 0xb5ac0a58
+1, 34040, 34040, 740, 1480, 0x7e0d84b5
+0, 188, 188, 1, 192000, 0xcc572b31
+1, 34780, 34780, 925, 1850, 0xf08bebf7
+0, 193, 193, 1, 192000, 0xb1739d26
+1, 35705, 35705, 740, 1480, 0x94cf73a0
+0, 197, 197, 1, 192000, 0x73da5473
+1, 36445, 36445, 740, 1480, 0xfef384ae
+0, 201, 201, 1, 192000, 0x5f79f5bc
+1, 37185, 37185, 925, 1850, 0x3b93e0f7
+0, 206, 206, 1, 192000, 0x0affc0a0
+1, 38110, 38110, 740, 1480, 0x28d27bae
+0, 210, 210, 1, 192000, 0x2b4d5c1c
+1, 38850, 38850, 740, 1480, 0x94d57da5
+0, 214, 214, 1, 192000, 0x309b41bc
+1, 39590, 39590, 740, 1480, 0xc9327db5
+0, 218, 218, 1, 192000, 0xd42b6424
+1, 40330, 40330, 925, 1850, 0xe781f604
+0, 223, 223, 1, 192000, 0x4795c948
+1, 41255, 41255, 740, 1480, 0x752f8c5b
+0, 227, 227, 1, 192000, 0xbc1a3a8b
+1, 41995, 41995, 740, 1480, 0x30068032
+0, 231, 231, 1, 192000, 0x16529c5b
+1, 42735, 42735, 925, 1850, 0x7895023e
+0, 236, 236, 1, 192000, 0x6b1b31ba
+1, 43660, 43660, 740, 1480, 0xa1e0a6e1
+0, 240, 240, 1, 192000, 0x569182ce
+1, 44400, 44400, 740, 1480, 0x6af4b500
+0, 244, 244, 1, 192000, 0xe6ea9866
+1, 45140, 45140, 740, 1480, 0xc26ea4c7
+0, 248, 248, 1, 192000, 0x102c6076
+1, 45880, 45880, 925, 1850, 0x16a72419
+0, 253, 253, 1, 192000, 0xb29f527a
+1, 46805, 46805, 740, 1480, 0x1794aacc
+0, 257, 257, 1, 192000, 0x040b4eee
+1, 47545, 47545, 740, 1480, 0x2ecad8d0
+0, 261, 261, 1, 192000, 0x92574f4a
+1, 48285, 48285, 925, 1850, 0x2e645e07
+0, 266, 266, 1, 192000, 0x1e8acdce
+1, 49210, 49210, 740, 1480, 0x1c54dfe7
+0, 270, 270, 1, 192000, 0x1becf516
+1, 49950, 49950, 740, 1480, 0xbd35feec
+0, 274, 274, 1, 192000, 0xb62e9776
+1, 50690, 50690, 740, 1480, 0x419403d6
+0, 278, 278, 1, 192000, 0xed37a08e
+1, 51430, 51430, 925, 1850, 0x78699d2a
+0, 283, 283, 1, 192000, 0xc0719912
+1, 52355, 52355, 740, 1480, 0x74ec68e0
+0, 287, 287, 1, 192000, 0x24cf7a7e
+1, 53095, 53095, 740, 1480, 0x76af64d9
+0, 291, 291, 1, 192000, 0x0307f62f
+1, 53835, 53835, 925, 1850, 0x5a303d1a
+0, 296, 296, 1, 192000, 0x79b7417b
+1, 54760, 54760, 537, 1074, 0x142ce7ba
+1, 55297, 55297, 925, 1850, 0x7ff682f7
+0, 300, 300, 1, 192000, 0x468d8db4
diff --git a/gst-libs/ext/libav/tests/ref/fate/bfi b/gst-libs/ext/libav/tests/ref/fate/bfi
index 1471670..0d3d8f2 100644
--- a/gst-libs/ext/libav/tests/ref/fate/bfi
+++ b/gst-libs/ext/libav/tests/ref/fate/bfi
@@ -1,114 +1,116 @@
-0, 0, 134400, 0xc218b00c
-1, 0, 17768, 0x07df135c
-0, 10000, 134400, 0x114daf7c
-0, 20000, 134400, 0xe14db24c
-0, 30000, 134400, 0x88c71df7
-0, 40000, 134400, 0xc98c09fc
-0, 50000, 134400, 0xf7c2e7a9
-0, 60000, 134400, 0xf54f304f
-0, 70000, 134400, 0x67370fdd
-1, 72522, 2220, 0x44953646
-0, 80000, 134400, 0xe70f43cd
-1, 81584, 2220, 0x256b3329
-0, 90000, 134400, 0xad74c06f
-1, 90645, 2222, 0x344d20c6
-1, 99714, 2220, 0xd8ee20db
-0, 100000, 134400, 0xef42fdf2
-1, 108776, 2222, 0x46d70aa2
-0, 110000, 134400, 0xa14cc4b8
-1, 117845, 2220, 0xbe0a2213
-0, 120000, 134400, 0xc6e57381
-1, 126906, 2222, 0x4ee0fd07
-0, 130000, 134400, 0x74b4804b
-1, 135976, 2220, 0x709dfe87
-0, 140000, 134400, 0xe0863d6f
-1, 145037, 2222, 0xbb382521
-0, 150000, 134400, 0x90b6d03c
-1, 154106, 2220, 0x6dba1d2d
-0, 160000, 134400, 0x3d0409fd
-1, 163167, 2222, 0xbc4cdd6d
-0, 170000, 134400, 0xc02e09a4
-1, 172237, 2220, 0x54340d2c
-0, 180000, 134400, 0xa3515997
-1, 181298, 2220, 0x8925d335
-0, 190000, 134400, 0xc0fda122
-1, 190359, 2222, 0xa39bd15f
-1, 199429, 2220, 0x6875f632
-0, 200000, 134400, 0x5380d707
-1, 208490, 2222, 0xda46be57
-0, 210000, 134400, 0xcc19c085
-1, 217559, 2220, 0xd591eb44
-0, 220000, 134400, 0x8041e977
-1, 226620, 2222, 0x33afd17f
-0, 230000, 134400, 0xb96b2bea
-1, 235690, 2220, 0xd97be03b
-0, 240000, 134400, 0xcc977ca7
-1, 244751, 2222, 0x3b71e82e
-0, 250000, 134400, 0xe37abb34
-1, 253820, 2220, 0x95fbec2b
-0, 260000, 134400, 0xce488baa
-1, 262882, 2220, 0xae3a1c1e
-0, 270000, 134400, 0xa0734e8a
-1, 271943, 2222, 0x46cd0973
-0, 280000, 134400, 0x6b5ce0b0
-1, 281012, 2220, 0x7b28f3f6
-0, 290000, 134400, 0xf207f938
-1, 290073, 2222, 0xa2a5bc47
-1, 299143, 2220, 0x4727df63
-0, 300000, 134400, 0xe10060f8
-1, 308204, 2222, 0xdf53f4e2
-0, 310000, 134400, 0xaebe6b37
-1, 317273, 2220, 0x469c1e8f
-0, 320000, 134400, 0x08ea5c75
-1, 326335, 2222, 0x3c541799
-0, 330000, 134400, 0x05c6b514
-1, 335404, 2220, 0xc8d21fee
-0, 340000, 134400, 0x68cb3703
-1, 344465, 2222, 0x5f52126f
-0, 350000, 134400, 0x48867fd0
-1, 353535, 2220, 0x06a9ff18
-0, 360000, 134400, 0xc53eda30
-1, 362596, 2220, 0x84f9aa2b
-0, 370000, 134400, 0x0c1b198d
-1, 371657, 2222, 0xe0518c83
-0, 380000, 134400, 0xc8ac5bc8
-1, 380727, 2220, 0xc85ee26c
-1, 389788, 2222, 0xda23fd2d
-0, 390000, 134400, 0x9e35240d
-1, 398857, 2220, 0x7ee2e818
-0, 400000, 134400, 0x885d142f
-1, 407918, 2222, 0x45eb0465
-0, 410000, 134400, 0x207cb4ac
-1, 416988, 2220, 0xf3e90549
-0, 420000, 134400, 0x0abe748b
-1, 426049, 2222, 0x17aacf3d
-0, 430000, 134400, 0xf13e991b
-1, 435118, 2220, 0x6cb7e325
-0, 440000, 134400, 0x2544248d
-1, 444180, 2220, 0x20164553
-0, 450000, 134400, 0x5444bb22
-1, 453241, 2222, 0x00000000
-0, 460000, 134400, 0xc5a8f55a
-1, 462310, 2220, 0x00000000
-0, 470000, 134400, 0xe6006820
-1, 471371, 2222, 0x00000000
-0, 480000, 134400, 0x2a34239d
-1, 480441, 2220, 0x00000000
-1, 489502, 2222, 0x00000000
-0, 490000, 134400, 0x26deac5b
-1, 498571, 2220, 0x00000000
-0, 500000, 134400, 0x82c2c0a9
-1, 507633, 2222, 0x00000000
-0, 510000, 134400, 0xcdd8daba
-1, 516702, 2450, 0x00000000
-0, 520000, 134400, 0x5a1a2105
-1, 526702, 2450, 0x00000000
-0, 530000, 134400, 0x2ad43604
-1, 536702, 2450, 0x00000000
-0, 540000, 134400, 0xa9b58f35
-1, 546702, 2450, 0x00000000
-0, 550000, 134400, 0x0e37a7a8
-1, 556702, 2450, 0x00000000
-0, 560000, 134400, 0xd288eef7
-1, 566702, 2450, 0x00000000
-1, 576702, 2450, 0x00000000
+#tb 0: 1/9
+#tb 1: 1/11025
+0, 0, 0, 1, 134400, 0xc218b00c
+1, 0, 0, 8884, 17768, 0x07df135c
+0, 1, 1, 1, 134400, 0x114daf7c
+0, 2, 2, 1, 134400, 0xe14db24c
+0, 3, 3, 1, 134400, 0x88c71df7
+0, 4, 4, 1, 134400, 0xc98c09fc
+0, 5, 5, 1, 134400, 0xf7c2e7a9
+0, 6, 6, 1, 134400, 0xf54f304f
+0, 7, 7, 1, 134400, 0x67370fdd
+1, 8884, 8884, 1110, 2220, 0x44953646
+0, 8, 8, 1, 134400, 0xe70f43cd
+1, 9994, 9994, 1110, 2220, 0x256b3329
+0, 9, 9, 1, 134400, 0xad74c06f
+1, 11104, 11104, 1111, 2222, 0x344d20c6
+1, 12215, 12215, 1110, 2220, 0xd8ee20db
+0, 10, 10, 1, 134400, 0xef42fdf2
+1, 13325, 13325, 1111, 2222, 0x46d70aa2
+0, 11, 11, 1, 134400, 0xa14cc4b8
+1, 14436, 14436, 1110, 2220, 0xbe0a2213
+0, 12, 12, 1, 134400, 0xc6e57381
+1, 15546, 15546, 1111, 2222, 0x4ee0fd07
+0, 13, 13, 1, 134400, 0x74b4804b
+1, 16657, 16657, 1110, 2220, 0x709dfe87
+0, 14, 14, 1, 134400, 0xe0863d6f
+1, 17767, 17767, 1111, 2222, 0xbb382521
+0, 15, 15, 1, 134400, 0x90b6d03c
+1, 18878, 18878, 1110, 2220, 0x6dba1d2d
+0, 16, 16, 1, 134400, 0x3d0409fd
+1, 19988, 19988, 1111, 2222, 0xbc4cdd6d
+0, 17, 17, 1, 134400, 0xc02e09a4
+1, 21099, 21099, 1110, 2220, 0x54340d2c
+0, 18, 18, 1, 134400, 0xa3515997
+1, 22209, 22209, 1110, 2220, 0x8925d335
+0, 19, 19, 1, 134400, 0xc0fda122
+1, 23319, 23319, 1111, 2222, 0xa39bd15f
+1, 24430, 24430, 1110, 2220, 0x6875f632
+0, 20, 20, 1, 134400, 0x5380d707
+1, 25540, 25540, 1111, 2222, 0xda46be57
+0, 21, 21, 1, 134400, 0xcc19c085
+1, 26651, 26651, 1110, 2220, 0xd591eb44
+0, 22, 22, 1, 134400, 0x8041e977
+1, 27761, 27761, 1111, 2222, 0x33afd17f
+0, 23, 23, 1, 134400, 0xb96b2bea
+1, 28872, 28872, 1110, 2220, 0xd97be03b
+0, 24, 24, 1, 134400, 0xcc977ca7
+1, 29982, 29982, 1111, 2222, 0x3b71e82e
+0, 25, 25, 1, 134400, 0xe37abb34
+1, 31093, 31093, 1110, 2220, 0x95fbec2b
+0, 26, 26, 1, 134400, 0xce488baa
+1, 32203, 32203, 1110, 2220, 0xae3a1c1e
+0, 27, 27, 1, 134400, 0xa0734e8a
+1, 33313, 33313, 1111, 2222, 0x46cd0973
+0, 28, 28, 1, 134400, 0x6b5ce0b0
+1, 34424, 34424, 1110, 2220, 0x7b28f3f6
+0, 29, 29, 1, 134400, 0xf207f938
+1, 35534, 35534, 1111, 2222, 0xa2a5bc47
+1, 36645, 36645, 1110, 2220, 0x4727df63
+0, 30, 30, 1, 134400, 0xe10060f8
+1, 37755, 37755, 1111, 2222, 0xdf53f4e2
+0, 31, 31, 1, 134400, 0xaebe6b37
+1, 38866, 38866, 1110, 2220, 0x469c1e8f
+0, 32, 32, 1, 134400, 0x08ea5c75
+1, 39976, 39976, 1111, 2222, 0x3c541799
+0, 33, 33, 1, 134400, 0x05c6b514
+1, 41087, 41087, 1110, 2220, 0xc8d21fee
+0, 34, 34, 1, 134400, 0x68cb3703
+1, 42197, 42197, 1111, 2222, 0x5f52126f
+0, 35, 35, 1, 134400, 0x48867fd0
+1, 43308, 43308, 1110, 2220, 0x06a9ff18
+0, 36, 36, 1, 134400, 0xc53eda30
+1, 44418, 44418, 1110, 2220, 0x84f9aa2b
+0, 37, 37, 1, 134400, 0x0c1b198d
+1, 45528, 45528, 1111, 2222, 0xe0518c83
+0, 38, 38, 1, 134400, 0xc8ac5bc8
+1, 46639, 46639, 1110, 2220, 0xc85ee26c
+1, 47749, 47749, 1111, 2222, 0xda23fd2d
+0, 39, 39, 1, 134400, 0x9e35240d
+1, 48860, 48860, 1110, 2220, 0x7ee2e818
+0, 40, 40, 1, 134400, 0x885d142f
+1, 49970, 49970, 1111, 2222, 0x45eb0465
+0, 41, 41, 1, 134400, 0x207cb4ac
+1, 51081, 51081, 1110, 2220, 0xf3e90549
+0, 42, 42, 1, 134400, 0x0abe748b
+1, 52191, 52191, 1111, 2222, 0x17aacf3d
+0, 43, 43, 1, 134400, 0xf13e991b
+1, 53302, 53302, 1110, 2220, 0x6cb7e325
+0, 44, 44, 1, 134400, 0x2544248d
+1, 54412, 54412, 1110, 2220, 0x20164553
+0, 45, 45, 1, 134400, 0x5444bb22
+1, 55522, 55522, 1111, 2222, 0x00000000
+0, 46, 46, 1, 134400, 0xc5a8f55a
+1, 56633, 56633, 1110, 2220, 0x00000000
+0, 47, 47, 1, 134400, 0xe6006820
+1, 57743, 57743, 1111, 2222, 0x00000000
+0, 48, 48, 1, 134400, 0x2a34239d
+1, 58854, 58854, 1110, 2220, 0x00000000
+1, 59964, 59964, 1111, 2222, 0x00000000
+0, 49, 49, 1, 134400, 0x26deac5b
+1, 61075, 61075, 1110, 2220, 0x00000000
+0, 50, 50, 1, 134400, 0x82c2c0a9
+1, 62185, 62185, 1111, 2222, 0x00000000
+0, 51, 51, 1, 134400, 0xcdd8daba
+1, 63296, 63296, 1225, 2450, 0x00000000
+0, 52, 52, 1, 134400, 0x5a1a2105
+1, 64521, 64521, 1225, 2450, 0x00000000
+0, 53, 53, 1, 134400, 0x2ad43604
+1, 65746, 65746, 1225, 2450, 0x00000000
+0, 54, 54, 1, 134400, 0xa9b58f35
+1, 66971, 66971, 1225, 2450, 0x00000000
+0, 55, 55, 1, 134400, 0x0e37a7a8
+1, 68196, 68196, 1225, 2450, 0x00000000
+0, 56, 56, 1, 134400, 0xd288eef7
+1, 69421, 69421, 1225, 2450, 0x00000000
+1, 70646, 70646, 1225, 2450, 0x00000000
diff --git a/gst-libs/ext/libav/tests/ref/fate/bink-video b/gst-libs/ext/libav/tests/ref/fate/bink-video
deleted file mode 100644
index f3adf76..0000000
--- a/gst-libs/ext/libav/tests/ref/fate/bink-video
+++ /dev/null
@@ -1,20 +0,0 @@
-0, 0, 460800, 0xb06f7841
-0, 6000, 460800, 0x7ed06412
-0, 12000, 460800, 0xe82b5c3d
-0, 18000, 460800, 0x67284940
-0, 24000, 460800, 0x17e2c544
-0, 30000, 460800, 0x5dc65d36
-0, 36000, 460800, 0x7de63f90
-0, 42000, 460800, 0x15c8cf7d
-0, 48000, 460800, 0xbffe4047
-0, 54000, 460800, 0xcabcc150
-0, 60000, 460800, 0xe8a17ebe
-0, 66000, 460800, 0x27e94c03
-0, 72000, 460800, 0x71c0f48e
-0, 78000, 460800, 0x5fc8f783
-0, 84000, 460800, 0xd23d336a
-0, 90000, 460800, 0xadcfa9e0
-0, 96000, 460800, 0x24222144
-0, 102000, 460800, 0x88f28b2b
-0, 108000, 460800, 0x52e13544
-0, 114000, 460800, 0x7e724731
diff --git a/gst-libs/ext/libav/tests/ref/fate/bink-video-b b/gst-libs/ext/libav/tests/ref/fate/bink-video-b
new file mode 100644
index 0000000..c772eda
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/bink-video-b
@@ -0,0 +1,31 @@
+#tb 0: 1/15
+0, 0, 0, 1, 34800, 0x4fd0a8e4
+0, 1, 1, 1, 34800, 0xd381a7b7
+0, 2, 2, 1, 34800, 0x688ca315
+0, 3, 3, 1, 34800, 0xaae39c3f
+0, 4, 4, 1, 34800, 0xdcb19759
+0, 5, 5, 1, 34800, 0xd458970a
+0, 6, 6, 1, 34800, 0x99269865
+0, 7, 7, 1, 34800, 0x6d459bbc
+0, 8, 8, 1, 34800, 0x6c759cd2
+0, 9, 9, 1, 34800, 0x47459ad5
+0, 10, 10, 1, 34800, 0xe6e897b9
+0, 11, 11, 1, 34800, 0x63599374
+0, 12, 12, 1, 34800, 0x666191e2
+0, 13, 13, 1, 34800, 0x4ca8933e
+0, 14, 14, 1, 34800, 0xbea594f4
+0, 15, 15, 1, 34800, 0xa5609473
+0, 16, 16, 1, 34800, 0xe5d79234
+0, 17, 17, 1, 34800, 0xf7738e58
+0, 18, 18, 1, 34800, 0x9d0c8b24
+0, 19, 19, 1, 34800, 0x0b2d8a66
+0, 20, 20, 1, 34800, 0xf4698b72
+0, 21, 21, 1, 34800, 0xdf808d44
+0, 22, 22, 1, 34800, 0xae6b895e
+0, 23, 23, 1, 34800, 0xa67b8144
+0, 24, 24, 1, 34800, 0xc54d79c4
+0, 25, 25, 1, 34800, 0x75ca72e2
+0, 26, 26, 1, 34800, 0xc6a56f65
+0, 27, 27, 1, 34800, 0x406e740d
+0, 28, 28, 1, 34800, 0xd29478de
+0, 29, 29, 1, 34800, 0x22cf7dc2
diff --git a/gst-libs/ext/libav/tests/ref/fate/bink-video-f b/gst-libs/ext/libav/tests/ref/fate/bink-video-f
new file mode 100644
index 0000000..40bc5a9
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/bink-video-f
@@ -0,0 +1,21 @@
+#tb 0: 1/15
+0, 0, 0, 1, 460800, 0xb06f7841
+0, 1, 1, 1, 460800, 0x7ed06412
+0, 2, 2, 1, 460800, 0xe82b5c3d
+0, 3, 3, 1, 460800, 0x67284940
+0, 4, 4, 1, 460800, 0x17e2c544
+0, 5, 5, 1, 460800, 0x5dc65d36
+0, 6, 6, 1, 460800, 0x7de63f90
+0, 7, 7, 1, 460800, 0x15c8cf7d
+0, 8, 8, 1, 460800, 0xbffe4047
+0, 9, 9, 1, 460800, 0xcabcc150
+0, 10, 10, 1, 460800, 0xe8a17ebe
+0, 11, 11, 1, 460800, 0x27e94c03
+0, 12, 12, 1, 460800, 0x71c0f48e
+0, 13, 13, 1, 460800, 0x5fc8f783
+0, 14, 14, 1, 460800, 0xd23d336a
+0, 15, 15, 1, 460800, 0xadcfa9e0
+0, 16, 16, 1, 460800, 0x24222144
+0, 17, 17, 1, 460800, 0x88f28b2b
+0, 18, 18, 1, 460800, 0x52e13544
+0, 19, 19, 1, 460800, 0x7e724731
diff --git a/gst-libs/ext/libav/tests/ref/fate/bink-video-i b/gst-libs/ext/libav/tests/ref/fate/bink-video-i
new file mode 100644
index 0000000..32c5e10
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/bink-video-i
@@ -0,0 +1,32 @@
+#tb 0: 1/30
+0, 0, 0, 1, 460800, 0xaef133d9
+0, 1, 1, 1, 460800, 0x2da1248b
+0, 2, 2, 1, 460800, 0x3d7945b4
+0, 3, 3, 1, 460800, 0x44554f62
+0, 4, 4, 1, 460800, 0x1bc0007e
+0, 5, 5, 1, 460800, 0xe9b5c4fa
+0, 6, 6, 1, 460800, 0x41b17af0
+0, 7, 7, 1, 460800, 0x88f5d31c
+0, 8, 8, 1, 460800, 0xdedb6e2d
+0, 9, 9, 1, 460800, 0xd36f0a5e
+0, 10, 10, 1, 460800, 0xb564921c
+0, 11, 11, 1, 460800, 0xd72b1208
+0, 12, 12, 1, 460800, 0x5c87760e
+0, 13, 13, 1, 460800, 0xecb75843
+0, 14, 14, 1, 460800, 0x58deee70
+0, 15, 15, 1, 460800, 0x64b5ae3e
+0, 16, 16, 1, 460800, 0x9269e9e6
+0, 17, 17, 1, 460800, 0x47064d62
+0, 18, 18, 1, 460800, 0x88858604
+0, 19, 19, 1, 460800, 0x129d8834
+0, 20, 20, 1, 460800, 0x046ecae5
+0, 21, 21, 1, 460800, 0x6c74c134
+0, 22, 22, 1, 460800, 0x37d56c01
+0, 23, 23, 1, 460800, 0x4c0a4f15
+0, 24, 24, 1, 460800, 0xe28ef96b
+0, 25, 25, 1, 460800, 0x66c72383
+0, 26, 26, 1, 460800, 0x9487175b
+0, 27, 27, 1, 460800, 0x71034965
+0, 28, 28, 1, 460800, 0x0f99ca96
+0, 29, 29, 1, 460800, 0x8a8c79b2
+0, 30, 30, 1, 460800, 0x34d4926e
diff --git a/gst-libs/ext/libav/tests/ref/fate/blowfish b/gst-libs/ext/libav/tests/ref/fate/blowfish
new file mode 100644
index 0000000..fed0b4d
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/blowfish
@@ -0,0 +1 @@
+Test encryption/decryption success.
diff --git a/gst-libs/ext/libav/tests/ref/fate/bmp-15bit b/gst-libs/ext/libav/tests/ref/fate/bmp-15bit
new file mode 100644
index 0000000..a0f3bbf
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/bmp-15bit
@@ -0,0 +1,2 @@
+#tb 0: 1/25
+0, 0, 0, 1, 16256, 0xdbcf881d
diff --git a/gst-libs/ext/libav/tests/ref/fate/bmp-15bit-mask b/gst-libs/ext/libav/tests/ref/fate/bmp-15bit-mask
new file mode 100644
index 0000000..a0f3bbf
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/bmp-15bit-mask
@@ -0,0 +1,2 @@
+#tb 0: 1/25
+0, 0, 0, 1, 16256, 0xdbcf881d
diff --git a/gst-libs/ext/libav/tests/ref/fate/bmp-16bit-mask b/gst-libs/ext/libav/tests/ref/fate/bmp-16bit-mask
new file mode 100644
index 0000000..afa5ab4
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/bmp-16bit-mask
@@ -0,0 +1,2 @@
+#tb 0: 1/25
+0, 0, 0, 1, 16256, 0x44675948
diff --git a/gst-libs/ext/libav/tests/ref/fate/bmp-1bit b/gst-libs/ext/libav/tests/ref/fate/bmp-1bit
new file mode 100644
index 0000000..1c825b1
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/bmp-1bit
@@ -0,0 +1,2 @@
+#tb 0: 1/25
+0, 0, 0, 1, 24384, 0x4c968301
diff --git a/gst-libs/ext/libav/tests/ref/fate/bmp-24bit b/gst-libs/ext/libav/tests/ref/fate/bmp-24bit
new file mode 100644
index 0000000..8f1a615
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/bmp-24bit
@@ -0,0 +1,2 @@
+#tb 0: 1/25
+0, 0, 0, 1, 24384, 0x325dd8d9
diff --git a/gst-libs/ext/libav/tests/ref/fate/bmp-32bit b/gst-libs/ext/libav/tests/ref/fate/bmp-32bit
new file mode 100644
index 0000000..8f1a615
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/bmp-32bit
@@ -0,0 +1,2 @@
+#tb 0: 1/25
+0, 0, 0, 1, 24384, 0x325dd8d9
diff --git a/gst-libs/ext/libav/tests/ref/fate/bmp-32bit-mask b/gst-libs/ext/libav/tests/ref/fate/bmp-32bit-mask
new file mode 100644
index 0000000..8f1a615
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/bmp-32bit-mask
@@ -0,0 +1,2 @@
+#tb 0: 1/25
+0, 0, 0, 1, 24384, 0x325dd8d9
diff --git a/gst-libs/ext/libav/tests/ref/fate/bmp-4bit b/gst-libs/ext/libav/tests/ref/fate/bmp-4bit
new file mode 100644
index 0000000..c0eedf1
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/bmp-4bit
@@ -0,0 +1,2 @@
+#tb 0: 1/25
+0, 0, 0, 1, 24384, 0x322d81f4
diff --git a/gst-libs/ext/libav/tests/ref/fate/bmp-4bit-os2 b/gst-libs/ext/libav/tests/ref/fate/bmp-4bit-os2
new file mode 100644
index 0000000..8a5f658
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/bmp-4bit-os2
@@ -0,0 +1,2 @@
+#tb 0: 1/25
+0, 0, 0, 1, 19800, 0x563b599a
diff --git a/gst-libs/ext/libav/tests/ref/fate/bmp-8bit b/gst-libs/ext/libav/tests/ref/fate/bmp-8bit
new file mode 100644
index 0000000..887113c
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/bmp-8bit
@@ -0,0 +1,2 @@
+#tb 0: 1/25
+0, 0, 0, 1, 24384, 0xa7aa6b9b
diff --git a/gst-libs/ext/libav/tests/ref/fate/bmp-8bit-os2 b/gst-libs/ext/libav/tests/ref/fate/bmp-8bit-os2
new file mode 100644
index 0000000..887113c
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/bmp-8bit-os2
@@ -0,0 +1,2 @@
+#tb 0: 1/25
+0, 0, 0, 1, 24384, 0xa7aa6b9b
diff --git a/gst-libs/ext/libav/tests/ref/fate/bmp-rle4 b/gst-libs/ext/libav/tests/ref/fate/bmp-rle4
new file mode 100644
index 0000000..c0eedf1
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/bmp-rle4
@@ -0,0 +1,2 @@
+#tb 0: 1/25
+0, 0, 0, 1, 24384, 0x322d81f4
diff --git a/gst-libs/ext/libav/tests/ref/fate/bmp-rle8 b/gst-libs/ext/libav/tests/ref/fate/bmp-rle8
new file mode 100644
index 0000000..887113c
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/bmp-rle8
@@ -0,0 +1,2 @@
+#tb 0: 1/25
+0, 0, 0, 1, 24384, 0xa7aa6b9b
diff --git a/gst-libs/ext/libav/tests/ref/fate/bmv b/gst-libs/ext/libav/tests/ref/fate/bmv
deleted file mode 100644
index 4e46165..0000000
--- a/gst-libs/ext/libav/tests/ref/fate/bmv
+++ /dev/null
@@ -1,42 +0,0 @@
-0, 0, 823680, 0xddb8a306
-1, 0, 7424, 0x18540b36
-0, 7500, 823680, 0xa95375c8
-1, 7576, 7296, 0x5acd2484
-0, 15000, 823680, 0xa95375c8
-1, 15020, 7424, 0xa1bc5c5a
-0, 22500, 823680, 0xb6f78afe
-1, 22596, 7296, 0x71a02ad1
-0, 30000, 823680, 0xb6f78afe
-1, 30041, 7424, 0x09cc32f2
-0, 37500, 823680, 0x45b9c8f0
-1, 37616, 7296, 0xa3451726
-0, 45000, 823680, 0x45b9c8f0
-1, 45061, 7296, 0x1eb40a18
-0, 52500, 823680, 0x7653d8e9
-1, 52506, 7424, 0xc55a2acf
-0, 60000, 823680, 0x7653d8e9
-1, 60082, 7296, 0x5b9fad3f
-0, 67500, 823680, 0xf1e2fd73
-1, 67527, 7424, 0xea651ae7
-0, 75000, 823680, 0xf1e2fd73
-1, 75102, 7296, 0x2bd5ddb6
-0, 82500, 823680, 0x6d2deab3
-1, 82547, 7424, 0xde4243b4
-0, 90000, 823680, 0x6d2deab3
-1, 90122, 7296, 0x358806d3
-0, 97500, 823680, 0x37fd33ce
-1, 97567, 7296, 0x511a144e
-0, 105000, 823680, 0x37fd33ce
-1, 105012, 7424, 0x887a3e84
-0, 112500, 823680, 0x0a8e0ab9
-1, 112588, 7296, 0xfeae2a0c
-0, 120000, 823680, 0x0a8e0ab9
-1, 120033, 7424, 0xa4ea5d22
-0, 127500, 823680, 0x991bb2b0
-1, 127608, 7296, 0xb3adf7fa
-0, 135000, 823680, 0x991bb2b0
-1, 135053, 7424, 0xce995dcc
-0, 142500, 823680, 0xb8397c8c
-1, 142629, 7296, 0x5b4cf574
-0, 150000, 823680, 0xb8397c8c
-1, 150073, 7296, 0x8a70eaf0
diff --git a/gst-libs/ext/libav/tests/ref/fate/bmv-audio b/gst-libs/ext/libav/tests/ref/fate/bmv-audio
new file mode 100644
index 0000000..746bb0c
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/bmv-audio
@@ -0,0 +1,22 @@
+#tb 0: 1/22050
+0, 0, 0, 1856, 7424, 0x18540b36
+0, 1856, 1856, 1824, 7296, 0x5acd2484
+0, 3680, 3680, 1856, 7424, 0xa1bc5c5a
+0, 5536, 5536, 1824, 7296, 0x71a02ad1
+0, 7360, 7360, 1856, 7424, 0x09cc32f2
+0, 9216, 9216, 1824, 7296, 0xa3451726
+0, 11040, 11040, 1824, 7296, 0x1eb40a18
+0, 12864, 12864, 1856, 7424, 0xc55a2acf
+0, 14720, 14720, 1824, 7296, 0x5b9fad3f
+0, 16544, 16544, 1856, 7424, 0xea651ae7
+0, 18400, 18400, 1824, 7296, 0x2bd5ddb6
+0, 20224, 20224, 1856, 7424, 0xde4243b4
+0, 22080, 22080, 1824, 7296, 0x358806d3
+0, 23904, 23904, 1824, 7296, 0x511a144e
+0, 25728, 25728, 1856, 7424, 0x887a3e84
+0, 27584, 27584, 1824, 7296, 0xfeae2a0c
+0, 29408, 29408, 1856, 7424, 0xa4ea5d22
+0, 31264, 31264, 1824, 7296, 0xb3adf7fa
+0, 33088, 33088, 1856, 7424, 0xce995dcc
+0, 34944, 34944, 1824, 7296, 0x5b4cf574
+0, 36768, 36768, 1824, 7296, 0x8a70eaf0
diff --git a/gst-libs/ext/libav/tests/ref/fate/bmv-video b/gst-libs/ext/libav/tests/ref/fate/bmv-video
new file mode 100644
index 0000000..f19cd45
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/bmv-video
@@ -0,0 +1,22 @@
+#tb 0: 1/12
+0, 0, 0, 1, 823680, 0xddb8a306
+0, 1, 1, 1, 823680, 0xa95375c8
+0, 2, 2, 1, 823680, 0xa95375c8
+0, 3, 3, 1, 823680, 0xb6f78afe
+0, 4, 4, 1, 823680, 0xb6f78afe
+0, 5, 5, 1, 823680, 0x45b9c8f0
+0, 6, 6, 1, 823680, 0x45b9c8f0
+0, 7, 7, 1, 823680, 0x7653d8e9
+0, 8, 8, 1, 823680, 0x7653d8e9
+0, 9, 9, 1, 823680, 0xf1e2fd73
+0, 10, 10, 1, 823680, 0xf1e2fd73
+0, 11, 11, 1, 823680, 0x6d2deab3
+0, 12, 12, 1, 823680, 0x6d2deab3
+0, 13, 13, 1, 823680, 0x37fd33ce
+0, 14, 14, 1, 823680, 0x37fd33ce
+0, 15, 15, 1, 823680, 0x0a8e0ab9
+0, 16, 16, 1, 823680, 0x0a8e0ab9
+0, 17, 17, 1, 823680, 0x991bb2b0
+0, 18, 18, 1, 823680, 0x991bb2b0
+0, 19, 19, 1, 823680, 0xb8397c8c
+0, 20, 20, 1, 823680, 0xb8397c8c
diff --git a/gst-libs/ext/libav/tests/ref/fate/caf b/gst-libs/ext/libav/tests/ref/fate/caf
index a400501..00de78c 100644
--- a/gst-libs/ext/libav/tests/ref/fate/caf
+++ b/gst-libs/ext/libav/tests/ref/fate/caf
@@ -1 +1 @@
-CRC=0x5b74195c
+CRC=0xd0d7195c
diff --git a/gst-libs/ext/libav/tests/ref/fate/cavs b/gst-libs/ext/libav/tests/ref/fate/cavs
new file mode 100644
index 0000000..c96468a
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/cavs
@@ -0,0 +1,171 @@
+#tb 0: 1/90000
+0, 0, 0, 0, 622080, 0x76183b91
+0, 3624, 3624, 0, 622080, 0x2ca5e808
+0, 7248, 7248, 0, 622080, 0xc503eda4
+0, 10872, 10872, 0, 622080, 0xa0dbf06c
+0, 14496, 14496, 0, 622080, 0xf4363cfa
+0, 18120, 18120, 0, 622080, 0xaa7dd9b8
+0, 21744, 21744, 0, 622080, 0x3ab6223b
+0, 25368, 25368, 0, 622080, 0xe402644b
+0, 28992, 28992, 0, 622080, 0xd0da3ade
+0, 32616, 32616, 0, 622080, 0x0aff6151
+0, 36240, 36240, 0, 622080, 0x02aea3d5
+0, 39864, 39864, 0, 622080, 0x5d8eeccd
+0, 43488, 43488, 0, 622080, 0x54384735
+0, 47112, 47112, 0, 622080, 0x890d71c2
+0, 50736, 50736, 0, 622080, 0xc60ae25b
+0, 54360, 54360, 0, 622080, 0xe589e774
+0, 57984, 57984, 0, 622080, 0x03471e74
+0, 61608, 61608, 0, 622080, 0x4e22302c
+0, 65232, 65232, 0, 622080, 0x00333583
+0, 68856, 68856, 0, 622080, 0xd6eae7d9
+0, 72480, 72480, 0, 622080, 0x72fe94f7
+0, 76104, 76104, 0, 622080, 0x3ebbad1e
+0, 79728, 79728, 0, 622080, 0x2fb1de4b
+0, 83352, 83352, 0, 622080, 0x3bfea6d2
+0, 86976, 86976, 0, 622080, 0x0fb551b2
+0, 90600, 90600, 0, 622080, 0xb203284f
+0, 94224, 94224, 0, 622080, 0xb3baac30
+0, 97200, 97200, 0, 622080, 0x15f2c1c7
+0, 100824, 100824, 0, 622080, 0xb2b530ce
+0, 104448, 104448, 0, 622080, 0xbbaaf241
+0, 108072, 108072, 0, 622080, 0x01bc9dfc
+0, 111696, 111696, 0, 622080, 0x8a449a42
+0, 115320, 115320, 0, 622080, 0xdc63d73f
+0, 118944, 118944, 0, 622080, 0xf06bc231
+0, 122568, 122568, 0, 622080, 0x19e04295
+0, 126192, 126192, 0, 622080, 0x1e7d1acd
+0, 129816, 129816, 0, 622080, 0x43878b48
+0, 133440, 133440, 0, 622080, 0xcd94b702
+0, 137064, 137064, 0, 622080, 0xd2706cf1
+0, 140688, 140688, 0, 622080, 0x47d636f3
+0, 144312, 144312, 0, 622080, 0x4a516acc
+0, 147936, 147936, 0, 622080, 0x52b7d89a
+0, 151560, 151560, 0, 622080, 0xc9ba03be
+0, 155184, 155184, 0, 622080, 0x6d17785e
+0, 158808, 158808, 0, 622080, 0x8264871b
+0, 162432, 162432, 0, 622080, 0xd59c84c0
+0, 166056, 166056, 0, 622080, 0x2b86d6cd
+0, 169680, 169680, 0, 622080, 0x9c5a5f51
+0, 173304, 173304, 0, 622080, 0x221f79ca
+0, 176928, 176928, 0, 622080, 0x98edb3ec
+0, 180552, 180552, 0, 622080, 0x9a31262c
+0, 184176, 184176, 0, 622080, 0x18f48378
+0, 187800, 187800, 0, 622080, 0x957c3d9c
+0, 191424, 191424, 0, 622080, 0x9cc6866e
+0, 195048, 195048, 0, 622080, 0x45613726
+0, 198672, 198672, 0, 622080, 0x7a6c5e65
+0, 202296, 202296, 0, 622080, 0x976d7a11
+0, 205200, 205200, 0, 622080, 0x192aea08
+0, 208824, 208824, 0, 622080, 0x8d4fc823
+0, 212448, 212448, 0, 622080, 0x1f9c55d7
+0, 216072, 216072, 0, 622080, 0xd4336d41
+0, 219696, 219696, 0, 622080, 0x7aa650cd
+0, 223320, 223320, 0, 622080, 0x8efaaeb1
+0, 226944, 226944, 0, 622080, 0x3d8c3053
+0, 230568, 230568, 0, 622080, 0x1e2b64b0
+0, 234192, 234192, 0, 622080, 0x0436b1a7
+0, 237816, 237816, 0, 622080, 0xc5120072
+0, 241440, 241440, 0, 622080, 0x0203b245
+0, 245064, 245064, 0, 622080, 0x9815582b
+0, 248688, 248688, 0, 622080, 0x3c60c359
+0, 252312, 252312, 0, 622080, 0x1a26b948
+0, 255936, 255936, 0, 622080, 0x56079812
+0, 259560, 259560, 0, 622080, 0x7b192a55
+0, 263184, 263184, 0, 622080, 0x335632ab
+0, 266808, 266808, 0, 622080, 0xd0c12eb8
+0, 270432, 270432, 0, 622080, 0x93bf46cb
+0, 274056, 274056, 0, 622080, 0xce67ce24
+0, 277680, 277680, 0, 622080, 0xff95bb26
+0, 281304, 281304, 0, 622080, 0x5e750705
+0, 284928, 284928, 0, 622080, 0x45a35725
+0, 288552, 288552, 0, 622080, 0xd8e93c39
+0, 292176, 292176, 0, 622080, 0xa9f8db50
+0, 295800, 295800, 0, 622080, 0xf90a862e
+0, 299424, 299424, 0, 622080, 0x5e5a4216
+0, 303048, 303048, 0, 622080, 0xaaf45ed6
+0, 306672, 306672, 0, 622080, 0x1933cda5
+0, 310296, 310296, 0, 622080, 0x7ff68d91
+0, 313200, 313200, 0, 622080, 0x10038fe9
+0, 316824, 316824, 0, 622080, 0x9b3425a6
+0, 320448, 320448, 0, 622080, 0x8d2a141d
+0, 324072, 324072, 0, 622080, 0x698a333e
+0, 327696, 327696, 0, 622080, 0x334685d1
+0, 331320, 331320, 0, 622080, 0x40317d40
+0, 334944, 334944, 0, 622080, 0xd3c6f519
+0, 338568, 338568, 0, 622080, 0xfc2210c2
+0, 342192, 342192, 0, 622080, 0x3761df34
+0, 345816, 345816, 0, 622080, 0xef25462a
+0, 349440, 349440, 0, 622080, 0x0fd38121
+0, 353064, 353064, 0, 622080, 0x184856a6
+0, 356688, 356688, 0, 622080, 0xc57c9f12
+0, 360312, 360312, 0, 622080, 0x39874291
+0, 363936, 363936, 0, 622080, 0x7c13cec4
+0, 367560, 367560, 0, 622080, 0xc4192a76
+0, 371184, 371184, 0, 622080, 0x2af404e3
+0, 374808, 374808, 0, 622080, 0x1ee18f41
+0, 378432, 378432, 0, 622080, 0xfb4d9ee5
+0, 382056, 382056, 0, 622080, 0x50aae4ff
+0, 385680, 385680, 0, 622080, 0x030f91fe
+0, 389304, 389304, 0, 622080, 0x3a3ee08c
+0, 392928, 392928, 0, 622080, 0x50121423
+0, 396552, 396552, 0, 622080, 0xda39e2d6
+0, 400176, 400176, 0, 622080, 0x9e13ccd6
+0, 403800, 403800, 0, 622080, 0xb72a22a7
+0, 407424, 407424, 0, 622080, 0xb76904d5
+0, 411048, 411048, 0, 622080, 0xcffa04a8
+0, 414672, 414672, 0, 622080, 0x2984bf3f
+0, 418296, 418296, 0, 622080, 0x274b5778
+0, 421200, 421200, 0, 622080, 0xf059413a
+0, 424824, 424824, 0, 622080, 0x969fae57
+0, 428448, 428448, 0, 622080, 0x75c29097
+0, 432072, 432072, 0, 622080, 0x2bf3b07d
+0, 435696, 435696, 0, 622080, 0x9f43271d
+0, 439320, 439320, 0, 622080, 0x67bf23f3
+0, 442944, 442944, 0, 622080, 0xa8edcf33
+0, 446568, 446568, 0, 622080, 0x17a0789e
+0, 450192, 450192, 0, 622080, 0x14b67cc7
+0, 453816, 453816, 0, 622080, 0x779215cd
+0, 457440, 457440, 0, 622080, 0x8b460a21
+0, 461064, 461064, 0, 622080, 0x0502ad7d
+0, 464688, 464688, 0, 622080, 0x6860678f
+0, 468312, 468312, 0, 622080, 0xe180469e
+0, 471936, 471936, 0, 622080, 0x9a992835
+0, 475560, 475560, 0, 622080, 0x2efafa33
+0, 479184, 479184, 0, 622080, 0xe24e59b2
+0, 482808, 482808, 0, 622080, 0xfb774d53
+0, 486432, 486432, 0, 622080, 0x3de4ea81
+0, 490056, 490056, 0, 622080, 0xaf9aa1d6
+0, 493680, 493680, 0, 622080, 0xa0e3722f
+0, 497304, 497304, 0, 622080, 0x81684492
+0, 500928, 500928, 0, 622080, 0xa4e971fb
+0, 504552, 504552, 0, 622080, 0x4a1903c8
+0, 508176, 508176, 0, 622080, 0x26304e4a
+0, 511800, 511800, 0, 622080, 0x867983a4
+0, 515424, 515424, 0, 622080, 0x2e7e4d13
+0, 519048, 519048, 0, 622080, 0x736f4682
+0, 522672, 522672, 0, 622080, 0x426a95fa
+0, 526296, 526296, 0, 622080, 0x2bc8850c
+0, 529200, 529200, 0, 622080, 0x047e77ab
+0, 532824, 532824, 0, 622080, 0x414ab77f
+0, 536448, 536448, 0, 622080, 0x42681090
+0, 540072, 540072, 0, 622080, 0x80744ccb
+0, 543696, 543696, 0, 622080, 0x50e2ecc0
+0, 547320, 547320, 0, 622080, 0x5c9fe70e
+0, 550944, 550944, 0, 622080, 0x016461ee
+0, 554568, 554568, 0, 622080, 0xd42f019a
+0, 558192, 558192, 0, 622080, 0x8171bf41
+0, 561816, 561816, 0, 622080, 0xf4d8ef7e
+0, 565440, 565440, 0, 622080, 0xf2d513c8
+0, 569064, 569064, 0, 622080, 0xb5b07704
+0, 572688, 572688, 0, 622080, 0x2168a07a
+0, 576312, 576312, 0, 622080, 0x840418f9
+0, 579936, 579936, 0, 622080, 0xd36f1b7c
+0, 583560, 583560, 0, 622080, 0x52532604
+0, 587184, 587184, 0, 622080, 0x0856d6eb
+0, 590808, 590808, 0, 622080, 0x21748734
+0, 594432, 594432, 0, 622080, 0xbd315c05
+0, 598056, 598056, 0, 622080, 0x1cea8103
+0, 601680, 601680, 0, 622080, 0x71f6e3cb
+0, 605304, 605304, 0, 622080, 0xb12d7aa7
+0, 608928, 608928, 0, 622080, 0x549b2acb
diff --git a/gst-libs/ext/libav/tests/ref/fate/cdgraphics b/gst-libs/ext/libav/tests/ref/fate/cdgraphics
index 10873fd..78a8f28 100644
--- a/gst-libs/ext/libav/tests/ref/fate/cdgraphics
+++ b/gst-libs/ext/libav/tests/ref/fate/cdgraphics
@@ -1,300 +1,301 @@
-0, 0, 194400, 0xd919c635
-0, 300, 194400, 0xd919c635
-0, 600, 194400, 0x516a1007
-0, 900, 194400, 0x516a1007
-0, 1200, 194400, 0x516a1007
-0, 1500, 194400, 0x516a1007
-0, 1800, 194400, 0x516a1007
-0, 2100, 194400, 0x516a1007
-0, 2400, 194400, 0x516a1007
-0, 2700, 194400, 0x516a1007
-0, 3000, 194400, 0x516a1007
-0, 3300, 194400, 0x516a1007
-0, 3600, 194400, 0x516a1007
-0, 3900, 194400, 0x516a1007
-0, 4200, 194400, 0x516a1007
-0, 4500, 194400, 0x516a1007
-0, 4800, 194400, 0x46ad80da
-0, 5100, 194400, 0x46ad80da
-0, 5400, 194400, 0x46ad80da
-0, 5700, 194400, 0x46ad80da
-0, 6000, 194400, 0x46ad80da
-0, 6300, 194400, 0x46ad80da
-0, 6600, 194400, 0x46ad80da
-0, 6900, 194400, 0x46ad80da
-0, 7200, 194400, 0x46ad80da
-0, 7500, 194400, 0x46ad80da
-0, 7800, 194400, 0x46ad80da
-0, 8100, 194400, 0x46ad80da
-0, 8400, 194400, 0x46ad80da
-0, 8700, 194400, 0x46ad80da
-0, 9000, 194400, 0x46ad80da
-0, 9300, 194400, 0x46ad80da
-0, 9600, 194400, 0x9392c3b9
-0, 9900, 194400, 0x9ff8cbb1
-0, 10200, 194400, 0xd015dba1
-0, 10500, 194400, 0x6a39f18b
-0, 10800, 194400, 0x7b8cf983
-0, 11100, 194400, 0x07a20f7c
-0, 11400, 194400, 0xa63e2962
-0, 11700, 194400, 0x2dd54447
-0, 12000, 194400, 0x90735e2d
-0, 12300, 194400, 0x90d98506
-0, 12600, 194400, 0xe5b08ffb
-0, 12900, 194400, 0x7a0d95f5
-0, 13200, 194400, 0xff6bacde
-0, 13500, 194400, 0xd998c2c8
-0, 13800, 194400, 0x3d1ddfab
-0, 14100, 194400, 0x817de4a6
-0, 14400, 194400, 0xfa3ef694
-0, 14700, 194400, 0x0b5bfb8f
-0, 15000, 194400, 0x00f62376
-0, 15300, 194400, 0x2f6b2d6c
-0, 15600, 194400, 0x40cb4752
-0, 15900, 194400, 0xd8456435
-0, 16200, 194400, 0x459f6a2f
-0, 16500, 194400, 0x9b678910
-0, 16800, 194400, 0x8791a1f7
-0, 17100, 194400, 0xdb4ac5d3
-0, 17400, 194400, 0xb223c8d0
-0, 17700, 194400, 0x4a9ce7b1
-0, 18000, 194400, 0x187eeaae
-0, 18300, 194400, 0xc712f8a0
-0, 18600, 194400, 0x549c00a7
-0, 18900, 194400, 0x4d991295
-0, 19200, 194400, 0xc41b2681
-0, 19500, 194400, 0xed5a3077
-0, 19800, 194400, 0x85ad4463
-0, 20100, 194400, 0xb98f4760
-0, 20400, 194400, 0x87ef5e49
-0, 20700, 194400, 0x830a6146
-0, 21000, 194400, 0xe33a792e
-0, 21300, 194400, 0x83517a2d
-0, 21600, 194400, 0xa97e9314
-0, 21900, 194400, 0x39059611
-0, 22200, 194400, 0xbf4eb9ed
-0, 22500, 194400, 0xe5afc4e2
-0, 22800, 194400, 0x35d4cdd9
-0, 23100, 194400, 0xb376e1c5
-0, 23400, 194400, 0x6128e3c3
-0, 23700, 194400, 0x30b7f7af
-0, 24000, 194400, 0xf1effaac
-0, 24300, 194400, 0x483914a1
-0, 24600, 194400, 0xbd48199c
-0, 24900, 194400, 0x382f2d88
-0, 25200, 194400, 0x5a573085
-0, 25500, 194400, 0x89733580
-0, 25800, 194400, 0xd1325a5b
-0, 26100, 194400, 0x655b6253
-0, 26400, 194400, 0x55146352
-0, 26700, 194400, 0xda527c39
-0, 27000, 194400, 0xb0cd7e37
-0, 27300, 194400, 0x25e7991c
-0, 27600, 194400, 0x5c22a411
-0, 27900, 194400, 0x1e2abdf7
-0, 28200, 194400, 0x8308bff5
-0, 28500, 194400, 0xfdbfd6de
-0, 28800, 194400, 0xd4d4d9db
-0, 29100, 194400, 0xa449fbb9
-0, 29400, 194400, 0x3dcafdb7
-0, 29700, 194400, 0x6f1f01c2
-0, 30000, 194400, 0xf54a1da6
-0, 30300, 194400, 0x88d11fa4
-0, 30600, 194400, 0x59642d96
-0, 30900, 194400, 0x8ba44182
-0, 31200, 194400, 0x88f56360
-0, 31500, 194400, 0xfb246d56
-0, 31800, 194400, 0xad128043
-0, 32100, 194400, 0x3a4f8a39
-0, 32400, 194400, 0x563d9d26
-0, 32700, 194400, 0x6ff8a320
-0, 33000, 194400, 0xcdb9b70c
-0, 33300, 194400, 0x99c2bd06
-0, 33600, 194400, 0x4b47cef4
-0, 33900, 194400, 0x10b9dce6
-0, 34200, 194400, 0xdd39f1d1
-0, 34500, 194400, 0xbcf104cd
-0, 34800, 194400, 0x85ec17ba
-0, 35100, 194400, 0x069219b8
-0, 35400, 194400, 0x84dd3899
-0, 35700, 194400, 0xacca4190
-0, 36000, 194400, 0xcf5b5d74
-0, 36300, 194400, 0x4b8c626f
-0, 36600, 194400, 0xf0817958
-0, 36900, 194400, 0xc0887e53
-0, 37200, 194400, 0x42e6854c
-0, 37500, 194400, 0x036c9140
-0, 37800, 194400, 0x0f21a62b
-0, 38100, 194400, 0xcdaeaa27
-0, 38400, 194400, 0xe425bc15
-0, 38700, 194400, 0x8e18c20f
-0, 39000, 194400, 0x767cd5fb
-0, 39300, 194400, 0x554ae6ea
-0, 39600, 194400, 0xeac1f9d7
-0, 39900, 194400, 0x0b32fed2
-0, 40200, 194400, 0xe30c19c6
-0, 40500, 194400, 0x6a8a23bc
-0, 40800, 194400, 0x26bf36a9
-0, 41100, 194400, 0x1e4f3fa0
-0, 41400, 194400, 0x231f5986
-0, 41700, 194400, 0xf557756a
-0, 42000, 194400, 0x6bce805f
-0, 42300, 194400, 0xcd80924d
-0, 42600, 194400, 0x65dc9f40
-0, 42900, 194400, 0x2ab7af30
-0, 43200, 194400, 0xd43cb728
-0, 43500, 194400, 0x05d9c916
-0, 43800, 194400, 0x43cad10e
-0, 44100, 194400, 0x06b5e0fe
-0, 44400, 194400, 0xa142f0ee
-0, 44700, 194400, 0xed7f03ea
-0, 45000, 194400, 0xf26019d4
-0, 45300, 194400, 0x3b7f29c4
-0, 45600, 194400, 0x30282ebf
-0, 45900, 194400, 0xaeff4aa3
-0, 46200, 194400, 0x1d355697
-0, 46500, 194400, 0x2ead6f7e
-0, 46800, 194400, 0xf1b67776
-0, 47100, 194400, 0x93b38b62
-0, 47400, 194400, 0x9469905d
-0, 47700, 194400, 0x27bf9756
-0, 48000, 194400, 0xd016a548
-0, 48300, 194400, 0x6889b835
-0, 48600, 194400, 0x6a05be2f
-0, 48900, 194400, 0xe0a1ce1f
-0, 49200, 194400, 0x8fdbd617
-0, 49500, 194400, 0xd68fe805
-0, 49800, 194400, 0x0d1dfbf1
-0, 50100, 194400, 0x0fe70bf0
-0, 50400, 194400, 0x0a8f13e8
-0, 50700, 194400, 0x0ca42bd0
-0, 51000, 194400, 0x6f3838c3
-0, 51300, 194400, 0x045448b3
-0, 51600, 194400, 0x764349b2
-0, 51900, 194400, 0xed1651aa
-0, 52200, 194400, 0xbb376398
-0, 52500, 194400, 0xd0d5718a
-0, 52800, 194400, 0xcd977e7d
-0, 53100, 194400, 0x8cb39665
-0, 53400, 194400, 0xb935b04b
-0, 53700, 194400, 0x0292be3d
-0, 54000, 194400, 0x4f21c833
-0, 54300, 194400, 0xa5c7d823
-0, 54600, 194400, 0xfb8ee01b
-0, 54900, 194400, 0xea53ee0d
-0, 55200, 194400, 0x803efcfe
-0, 55500, 194400, 0x2c0e0aff
-0, 55800, 194400, 0x3df318f1
-0, 56100, 194400, 0xc4cb26e3
-0, 56400, 194400, 0x92a033d6
-0, 56700, 194400, 0x1b2048c1
-0, 57000, 194400, 0x236858b1
-0, 57300, 194400, 0x482f6d9c
-0, 57600, 194400, 0x9ee97891
-0, 57900, 194400, 0xe0dc8683
-0, 58200, 194400, 0x461b9079
-0, 58500, 194400, 0xd346a960
-0, 58800, 194400, 0xa384b554
-0, 59100, 194400, 0x3246cf3a
-0, 59400, 194400, 0xa53fe722
-0, 59700, 194400, 0xe620fd0c
-0, 60000, 194400, 0xd6370414
-0, 60300, 194400, 0xf57f1404
-0, 60600, 194400, 0x8c6420f7
-0, 60900, 194400, 0xd4be3add
-0, 61200, 194400, 0xa8dc4ec9
-0, 61500, 194400, 0xda1563b4
-0, 61800, 194400, 0xd51873a4
-0, 62100, 194400, 0x68588196
-0, 62400, 194400, 0x40d18e89
-0, 62700, 194400, 0x1b75a275
-0, 63000, 194400, 0xedd1a572
-0, 63300, 194400, 0x55daad6a
-0, 63600, 194400, 0xcb93b067
-0, 63900, 194400, 0x5888ba5d
-0, 64200, 194400, 0x2c11c84f
-0, 64500, 194400, 0x0fbae334
-0, 64800, 194400, 0x773fed2a
-0, 65100, 194400, 0x2f87fc1b
-0, 65400, 194400, 0xe8120521
-0, 65700, 194400, 0x64ac0f17
-0, 66000, 194400, 0xba531c0a
-0, 66300, 194400, 0xf49433f2
-0, 66600, 194400, 0x79e234f1
-0, 66900, 194400, 0x043937ee
-0, 67200, 194400, 0x9e6141e4
-0, 67500, 194400, 0x34204fd6
-0, 67800, 194400, 0xa1dd60c5
-0, 68100, 194400, 0x12b36eb7
-0, 68400, 194400, 0x68987aab
-0, 68700, 194400, 0x3207889d
-0, 69000, 194400, 0x3bb59194
-0, 69300, 194400, 0x0a119f86
-0, 69600, 194400, 0x472bab7a
-0, 69900, 194400, 0x7364c85d
-0, 70200, 194400, 0xa812d84d
-0, 70500, 194400, 0xf384f530
-0, 70800, 194400, 0x1546052f
-0, 71100, 194400, 0xeb611a1a
-0, 71400, 194400, 0xc39d250f
-0, 71700, 194400, 0x7bd73301
-0, 72000, 194400, 0x10f73cf7
-0, 72300, 194400, 0x95dc55de
-0, 72600, 194400, 0x392e61d2
-0, 72900, 194400, 0x113c7bb8
-0, 73200, 194400, 0x17128fa4
-0, 73500, 194400, 0xf95e9b98
-0, 73800, 194400, 0xdc47aa89
-0, 74100, 194400, 0xea5dc073
-0, 74400, 194400, 0x8dfadc57
-0, 74700, 194400, 0xe5c3e84b
-0, 75000, 194400, 0x8952f43f
-0, 75300, 194400, 0xec9e0240
-0, 75600, 194400, 0x8f460c36
-0, 75900, 194400, 0xd43e182a
-0, 76200, 194400, 0xb00b2919
-0, 76500, 194400, 0xc9f6350d
-0, 76800, 194400, 0x87ca44fd
-0, 77100, 194400, 0xa6a250f1
-0, 77400, 194400, 0x34fa60e1
-0, 77700, 194400, 0xe1a372cf
-0, 78000, 194400, 0xc80785bc
-0, 78300, 194400, 0x43e297aa
-0, 78600, 194400, 0x7e8ea49d
-0, 78900, 194400, 0xd009b091
-0, 79200, 194400, 0x9126bc85
-0, 79500, 194400, 0x175ad36e
-0, 79800, 194400, 0xf9dae160
-0, 80100, 194400, 0x1b98f948
-0, 80400, 194400, 0xa6c5133d
-0, 80700, 194400, 0xf5d42729
-0, 81000, 194400, 0x8cfe311f
-0, 81300, 194400, 0x18733e12
-0, 81600, 194400, 0x24ac50ff
-0, 81900, 194400, 0x0d1c64eb
-0, 82200, 194400, 0xde947cd3
-0, 82500, 194400, 0x08268dc2
-0, 82800, 194400, 0xfec69fb0
-0, 83100, 194400, 0xba83aba4
-0, 83400, 194400, 0xfbe2bc93
-0, 83700, 194400, 0xe22fcc83
-0, 84000, 194400, 0x050fcf80
-0, 84300, 194400, 0xee1ed778
-0, 84600, 194400, 0xb44cda75
-0, 84900, 194400, 0xa29fe46b
-0, 85200, 194400, 0xa99bf55a
-0, 85500, 194400, 0x4f840d51
-0, 85800, 194400, 0x58941945
-0, 86100, 194400, 0x62cb2638
-0, 86400, 194400, 0x22ee312d
-0, 86700, 194400, 0xea8f3925
-0, 87000, 194400, 0xed294c12
-0, 87300, 194400, 0xafa75e00
-0, 87600, 194400, 0x19d45ffe
-0, 87900, 194400, 0x7fcf61fc
-0, 88200, 194400, 0x2c126df0
-0, 88500, 194400, 0x331379e4
-0, 88800, 194400, 0x99fe8cd1
-0, 89100, 194400, 0xa5ec98c5
-0, 89400, 194400, 0xac68a6b7
-0, 89700, 194400, 0x28e6b2ab
+#tb 0: 1/300
+0, 0, 0, 1, 194400, 0xd919c635
+0, 1, 1, 1, 194400, 0xd919c635
+0, 2, 2, 1, 194400, 0x516a1007
+0, 3, 3, 1, 194400, 0x516a1007
+0, 4, 4, 1, 194400, 0x516a1007
+0, 5, 5, 1, 194400, 0x516a1007
+0, 6, 6, 1, 194400, 0x516a1007
+0, 7, 7, 1, 194400, 0x516a1007
+0, 8, 8, 1, 194400, 0x516a1007
+0, 9, 9, 1, 194400, 0x516a1007
+0, 10, 10, 1, 194400, 0x516a1007
+0, 11, 11, 1, 194400, 0x516a1007
+0, 12, 12, 1, 194400, 0x516a1007
+0, 13, 13, 1, 194400, 0x516a1007
+0, 14, 14, 1, 194400, 0x516a1007
+0, 15, 15, 1, 194400, 0x516a1007
+0, 16, 16, 1, 194400, 0x46ad80da
+0, 17, 17, 1, 194400, 0x46ad80da
+0, 18, 18, 1, 194400, 0x46ad80da
+0, 19, 19, 1, 194400, 0x46ad80da
+0, 20, 20, 1, 194400, 0x46ad80da
+0, 21, 21, 1, 194400, 0x46ad80da
+0, 22, 22, 1, 194400, 0x46ad80da
+0, 23, 23, 1, 194400, 0x46ad80da
+0, 24, 24, 1, 194400, 0x46ad80da
+0, 25, 25, 1, 194400, 0x46ad80da
+0, 26, 26, 1, 194400, 0x46ad80da
+0, 27, 27, 1, 194400, 0x46ad80da
+0, 28, 28, 1, 194400, 0x46ad80da
+0, 29, 29, 1, 194400, 0x46ad80da
+0, 30, 30, 1, 194400, 0x46ad80da
+0, 31, 31, 1, 194400, 0x46ad80da
+0, 32, 32, 1, 194400, 0x9392c3b9
+0, 33, 33, 1, 194400, 0x9ff8cbb1
+0, 34, 34, 1, 194400, 0xd015dba1
+0, 35, 35, 1, 194400, 0x6a39f18b
+0, 36, 36, 1, 194400, 0x7b8cf983
+0, 37, 37, 1, 194400, 0x07a20f7c
+0, 38, 38, 1, 194400, 0xa63e2962
+0, 39, 39, 1, 194400, 0x2dd54447
+0, 40, 40, 1, 194400, 0x90735e2d
+0, 41, 41, 1, 194400, 0x90d98506
+0, 42, 42, 1, 194400, 0xe5b08ffb
+0, 43, 43, 1, 194400, 0x7a0d95f5
+0, 44, 44, 1, 194400, 0xff6bacde
+0, 45, 45, 1, 194400, 0xd998c2c8
+0, 46, 46, 1, 194400, 0x3d1ddfab
+0, 47, 47, 1, 194400, 0x817de4a6
+0, 48, 48, 1, 194400, 0xfa3ef694
+0, 49, 49, 1, 194400, 0x0b5bfb8f
+0, 50, 50, 1, 194400, 0x00f62376
+0, 51, 51, 1, 194400, 0x2f6b2d6c
+0, 52, 52, 1, 194400, 0x40cb4752
+0, 53, 53, 1, 194400, 0xd8456435
+0, 54, 54, 1, 194400, 0x459f6a2f
+0, 55, 55, 1, 194400, 0x9b678910
+0, 56, 56, 1, 194400, 0x8791a1f7
+0, 57, 57, 1, 194400, 0xdb4ac5d3
+0, 58, 58, 1, 194400, 0xb223c8d0
+0, 59, 59, 1, 194400, 0x4a9ce7b1
+0, 60, 60, 1, 194400, 0x187eeaae
+0, 61, 61, 1, 194400, 0xc712f8a0
+0, 62, 62, 1, 194400, 0x549c00a7
+0, 63, 63, 1, 194400, 0x4d991295
+0, 64, 64, 1, 194400, 0xc41b2681
+0, 65, 65, 1, 194400, 0xed5a3077
+0, 66, 66, 1, 194400, 0x85ad4463
+0, 67, 67, 1, 194400, 0xb98f4760
+0, 68, 68, 1, 194400, 0x87ef5e49
+0, 69, 69, 1, 194400, 0x830a6146
+0, 70, 70, 1, 194400, 0xe33a792e
+0, 71, 71, 1, 194400, 0x83517a2d
+0, 72, 72, 1, 194400, 0xa97e9314
+0, 73, 73, 1, 194400, 0x39059611
+0, 74, 74, 1, 194400, 0xbf4eb9ed
+0, 75, 75, 1, 194400, 0xe5afc4e2
+0, 76, 76, 1, 194400, 0x35d4cdd9
+0, 77, 77, 1, 194400, 0xb376e1c5
+0, 78, 78, 1, 194400, 0x6128e3c3
+0, 79, 79, 1, 194400, 0x30b7f7af
+0, 80, 80, 1, 194400, 0xf1effaac
+0, 81, 81, 1, 194400, 0x483914a1
+0, 82, 82, 1, 194400, 0xbd48199c
+0, 83, 83, 1, 194400, 0x382f2d88
+0, 84, 84, 1, 194400, 0x5a573085
+0, 85, 85, 1, 194400, 0x89733580
+0, 86, 86, 1, 194400, 0xd1325a5b
+0, 87, 87, 1, 194400, 0x655b6253
+0, 88, 88, 1, 194400, 0x55146352
+0, 89, 89, 1, 194400, 0xda527c39
+0, 90, 90, 1, 194400, 0xb0cd7e37
+0, 91, 91, 1, 194400, 0x25e7991c
+0, 92, 92, 1, 194400, 0x5c22a411
+0, 93, 93, 1, 194400, 0x1e2abdf7
+0, 94, 94, 1, 194400, 0x8308bff5
+0, 95, 95, 1, 194400, 0xfdbfd6de
+0, 96, 96, 1, 194400, 0xd4d4d9db
+0, 97, 97, 1, 194400, 0xa449fbb9
+0, 98, 98, 1, 194400, 0x3dcafdb7
+0, 99, 99, 1, 194400, 0x6f1f01c2
+0, 100, 100, 1, 194400, 0xf54a1da6
+0, 101, 101, 1, 194400, 0x88d11fa4
+0, 102, 102, 1, 194400, 0x59642d96
+0, 103, 103, 1, 194400, 0x8ba44182
+0, 104, 104, 1, 194400, 0x88f56360
+0, 105, 105, 1, 194400, 0xfb246d56
+0, 106, 106, 1, 194400, 0xad128043
+0, 107, 107, 1, 194400, 0x3a4f8a39
+0, 108, 108, 1, 194400, 0x563d9d26
+0, 109, 109, 1, 194400, 0x6ff8a320
+0, 110, 110, 1, 194400, 0xcdb9b70c
+0, 111, 111, 1, 194400, 0x99c2bd06
+0, 112, 112, 1, 194400, 0x4b47cef4
+0, 113, 113, 1, 194400, 0x10b9dce6
+0, 114, 114, 1, 194400, 0xdd39f1d1
+0, 115, 115, 1, 194400, 0xbcf104cd
+0, 116, 116, 1, 194400, 0x85ec17ba
+0, 117, 117, 1, 194400, 0x069219b8
+0, 118, 118, 1, 194400, 0x84dd3899
+0, 119, 119, 1, 194400, 0xacca4190
+0, 120, 120, 1, 194400, 0xcf5b5d74
+0, 121, 121, 1, 194400, 0x4b8c626f
+0, 122, 122, 1, 194400, 0xf0817958
+0, 123, 123, 1, 194400, 0xc0887e53
+0, 124, 124, 1, 194400, 0x42e6854c
+0, 125, 125, 1, 194400, 0x036c9140
+0, 126, 126, 1, 194400, 0x0f21a62b
+0, 127, 127, 1, 194400, 0xcdaeaa27
+0, 128, 128, 1, 194400, 0xe425bc15
+0, 129, 129, 1, 194400, 0x8e18c20f
+0, 130, 130, 1, 194400, 0x767cd5fb
+0, 131, 131, 1, 194400, 0x554ae6ea
+0, 132, 132, 1, 194400, 0xeac1f9d7
+0, 133, 133, 1, 194400, 0x0b32fed2
+0, 134, 134, 1, 194400, 0xe30c19c6
+0, 135, 135, 1, 194400, 0x6a8a23bc
+0, 136, 136, 1, 194400, 0x26bf36a9
+0, 137, 137, 1, 194400, 0x1e4f3fa0
+0, 138, 138, 1, 194400, 0x231f5986
+0, 139, 139, 1, 194400, 0xf557756a
+0, 140, 140, 1, 194400, 0x6bce805f
+0, 141, 141, 1, 194400, 0xcd80924d
+0, 142, 142, 1, 194400, 0x65dc9f40
+0, 143, 143, 1, 194400, 0x2ab7af30
+0, 144, 144, 1, 194400, 0xd43cb728
+0, 145, 145, 1, 194400, 0x05d9c916
+0, 146, 146, 1, 194400, 0x43cad10e
+0, 147, 147, 1, 194400, 0x06b5e0fe
+0, 148, 148, 1, 194400, 0xa142f0ee
+0, 149, 149, 1, 194400, 0xed7f03ea
+0, 150, 150, 1, 194400, 0xf26019d4
+0, 151, 151, 1, 194400, 0x3b7f29c4
+0, 152, 152, 1, 194400, 0x30282ebf
+0, 153, 153, 1, 194400, 0xaeff4aa3
+0, 154, 154, 1, 194400, 0x1d355697
+0, 155, 155, 1, 194400, 0x2ead6f7e
+0, 156, 156, 1, 194400, 0xf1b67776
+0, 157, 157, 1, 194400, 0x93b38b62
+0, 158, 158, 1, 194400, 0x9469905d
+0, 159, 159, 1, 194400, 0x27bf9756
+0, 160, 160, 1, 194400, 0xd016a548
+0, 161, 161, 1, 194400, 0x6889b835
+0, 162, 162, 1, 194400, 0x6a05be2f
+0, 163, 163, 1, 194400, 0xe0a1ce1f
+0, 164, 164, 1, 194400, 0x8fdbd617
+0, 165, 165, 1, 194400, 0xd68fe805
+0, 166, 166, 1, 194400, 0x0d1dfbf1
+0, 167, 167, 1, 194400, 0x0fe70bf0
+0, 168, 168, 1, 194400, 0x0a8f13e8
+0, 169, 169, 1, 194400, 0x0ca42bd0
+0, 170, 170, 1, 194400, 0x6f3838c3
+0, 171, 171, 1, 194400, 0x045448b3
+0, 172, 172, 1, 194400, 0x764349b2
+0, 173, 173, 1, 194400, 0xed1651aa
+0, 174, 174, 1, 194400, 0xbb376398
+0, 175, 175, 1, 194400, 0xd0d5718a
+0, 176, 176, 1, 194400, 0xcd977e7d
+0, 177, 177, 1, 194400, 0x8cb39665
+0, 178, 178, 1, 194400, 0xb935b04b
+0, 179, 179, 1, 194400, 0x0292be3d
+0, 180, 180, 1, 194400, 0x4f21c833
+0, 181, 181, 1, 194400, 0xa5c7d823
+0, 182, 182, 1, 194400, 0xfb8ee01b
+0, 183, 183, 1, 194400, 0xea53ee0d
+0, 184, 184, 1, 194400, 0x803efcfe
+0, 185, 185, 1, 194400, 0x2c0e0aff
+0, 186, 186, 1, 194400, 0x3df318f1
+0, 187, 187, 1, 194400, 0xc4cb26e3
+0, 188, 188, 1, 194400, 0x92a033d6
+0, 189, 189, 1, 194400, 0x1b2048c1
+0, 190, 190, 1, 194400, 0x236858b1
+0, 191, 191, 1, 194400, 0x482f6d9c
+0, 192, 192, 1, 194400, 0x9ee97891
+0, 193, 193, 1, 194400, 0xe0dc8683
+0, 194, 194, 1, 194400, 0x461b9079
+0, 195, 195, 1, 194400, 0xd346a960
+0, 196, 196, 1, 194400, 0xa384b554
+0, 197, 197, 1, 194400, 0x3246cf3a
+0, 198, 198, 1, 194400, 0xa53fe722
+0, 199, 199, 1, 194400, 0xe620fd0c
+0, 200, 200, 1, 194400, 0xd6370414
+0, 201, 201, 1, 194400, 0xf57f1404
+0, 202, 202, 1, 194400, 0x8c6420f7
+0, 203, 203, 1, 194400, 0xd4be3add
+0, 204, 204, 1, 194400, 0xa8dc4ec9
+0, 205, 205, 1, 194400, 0xda1563b4
+0, 206, 206, 1, 194400, 0xd51873a4
+0, 207, 207, 1, 194400, 0x68588196
+0, 208, 208, 1, 194400, 0x40d18e89
+0, 209, 209, 1, 194400, 0x1b75a275
+0, 210, 210, 1, 194400, 0xedd1a572
+0, 211, 211, 1, 194400, 0x55daad6a
+0, 212, 212, 1, 194400, 0xcb93b067
+0, 213, 213, 1, 194400, 0x5888ba5d
+0, 214, 214, 1, 194400, 0x2c11c84f
+0, 215, 215, 1, 194400, 0x0fbae334
+0, 216, 216, 1, 194400, 0x773fed2a
+0, 217, 217, 1, 194400, 0x2f87fc1b
+0, 218, 218, 1, 194400, 0xe8120521
+0, 219, 219, 1, 194400, 0x64ac0f17
+0, 220, 220, 1, 194400, 0xba531c0a
+0, 221, 221, 1, 194400, 0xf49433f2
+0, 222, 222, 1, 194400, 0x79e234f1
+0, 223, 223, 1, 194400, 0x043937ee
+0, 224, 224, 1, 194400, 0x9e6141e4
+0, 225, 225, 1, 194400, 0x34204fd6
+0, 226, 226, 1, 194400, 0xa1dd60c5
+0, 227, 227, 1, 194400, 0x12b36eb7
+0, 228, 228, 1, 194400, 0x68987aab
+0, 229, 229, 1, 194400, 0x3207889d
+0, 230, 230, 1, 194400, 0x3bb59194
+0, 231, 231, 1, 194400, 0x0a119f86
+0, 232, 232, 1, 194400, 0x472bab7a
+0, 233, 233, 1, 194400, 0x7364c85d
+0, 234, 234, 1, 194400, 0xa812d84d
+0, 235, 235, 1, 194400, 0xf384f530
+0, 236, 236, 1, 194400, 0x1546052f
+0, 237, 237, 1, 194400, 0xeb611a1a
+0, 238, 238, 1, 194400, 0xc39d250f
+0, 239, 239, 1, 194400, 0x7bd73301
+0, 240, 240, 1, 194400, 0x10f73cf7
+0, 241, 241, 1, 194400, 0x95dc55de
+0, 242, 242, 1, 194400, 0x392e61d2
+0, 243, 243, 1, 194400, 0x113c7bb8
+0, 244, 244, 1, 194400, 0x17128fa4
+0, 245, 245, 1, 194400, 0xf95e9b98
+0, 246, 246, 1, 194400, 0xdc47aa89
+0, 247, 247, 1, 194400, 0xea5dc073
+0, 248, 248, 1, 194400, 0x8dfadc57
+0, 249, 249, 1, 194400, 0xe5c3e84b
+0, 250, 250, 1, 194400, 0x8952f43f
+0, 251, 251, 1, 194400, 0xec9e0240
+0, 252, 252, 1, 194400, 0x8f460c36
+0, 253, 253, 1, 194400, 0xd43e182a
+0, 254, 254, 1, 194400, 0xb00b2919
+0, 255, 255, 1, 194400, 0xc9f6350d
+0, 256, 256, 1, 194400, 0x87ca44fd
+0, 257, 257, 1, 194400, 0xa6a250f1
+0, 258, 258, 1, 194400, 0x34fa60e1
+0, 259, 259, 1, 194400, 0xe1a372cf
+0, 260, 260, 1, 194400, 0xc80785bc
+0, 261, 261, 1, 194400, 0x43e297aa
+0, 262, 262, 1, 194400, 0x7e8ea49d
+0, 263, 263, 1, 194400, 0xd009b091
+0, 264, 264, 1, 194400, 0x9126bc85
+0, 265, 265, 1, 194400, 0x175ad36e
+0, 266, 266, 1, 194400, 0xf9dae160
+0, 267, 267, 1, 194400, 0x1b98f948
+0, 268, 268, 1, 194400, 0xa6c5133d
+0, 269, 269, 1, 194400, 0xf5d42729
+0, 270, 270, 1, 194400, 0x8cfe311f
+0, 271, 271, 1, 194400, 0x18733e12
+0, 272, 272, 1, 194400, 0x24ac50ff
+0, 273, 273, 1, 194400, 0x0d1c64eb
+0, 274, 274, 1, 194400, 0xde947cd3
+0, 275, 275, 1, 194400, 0x08268dc2
+0, 276, 276, 1, 194400, 0xfec69fb0
+0, 277, 277, 1, 194400, 0xba83aba4
+0, 278, 278, 1, 194400, 0xfbe2bc93
+0, 279, 279, 1, 194400, 0xe22fcc83
+0, 280, 280, 1, 194400, 0x050fcf80
+0, 281, 281, 1, 194400, 0xee1ed778
+0, 282, 282, 1, 194400, 0xb44cda75
+0, 283, 283, 1, 194400, 0xa29fe46b
+0, 284, 284, 1, 194400, 0xa99bf55a
+0, 285, 285, 1, 194400, 0x4f840d51
+0, 286, 286, 1, 194400, 0x58941945
+0, 287, 287, 1, 194400, 0x62cb2638
+0, 288, 288, 1, 194400, 0x22ee312d
+0, 289, 289, 1, 194400, 0xea8f3925
+0, 290, 290, 1, 194400, 0xed294c12
+0, 291, 291, 1, 194400, 0xafa75e00
+0, 292, 292, 1, 194400, 0x19d45ffe
+0, 293, 293, 1, 194400, 0x7fcf61fc
+0, 294, 294, 1, 194400, 0x2c126df0
+0, 295, 295, 1, 194400, 0x331379e4
+0, 296, 296, 1, 194400, 0x99fe8cd1
+0, 297, 297, 1, 194400, 0xa5ec98c5
+0, 298, 298, 1, 194400, 0xac68a6b7
+0, 299, 299, 1, 194400, 0x28e6b2ab
diff --git a/gst-libs/ext/libav/tests/ref/fate/cdxl-bitline-ham6 b/gst-libs/ext/libav/tests/ref/fate/cdxl-bitline-ham6
new file mode 100644
index 0000000..e4071a9
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/cdxl-bitline-ham6
@@ -0,0 +1,11 @@
+#tb 0: 1/11025
+0, 0, 0, 0, 63180, 0xcda82c16
+0, 220, 220, 0, 63180, 0xa6097bf9
+0, 440, 440, 0, 63180, 0x4c2fb091
+0, 660, 660, 0, 63180, 0xc597db00
+0, 880, 880, 0, 63180, 0xfa581ccd
+0, 1100, 1100, 0, 63180, 0x3e51498f
+0, 1320, 1320, 0, 63180, 0xe3495396
+0, 1540, 1540, 0, 63180, 0x425f5f02
+0, 1760, 1760, 0, 63180, 0x6077465f
+0, 1980, 1980, 0, 63180, 0x923ba29c
diff --git a/gst-libs/ext/libav/tests/ref/fate/cdxl-demux b/gst-libs/ext/libav/tests/ref/fate/cdxl-demux
new file mode 100644
index 0000000..7e4c4c8
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/cdxl-demux
@@ -0,0 +1,21 @@
+#tb 0: 1/11025
+#tb 1: 1/11025
+0, 0, 0, 1884, 22688, 0xc954a244
+1, 0, 0, 1884, 1884, 0x06925e3e
+0, 1884, 1884, 1884, 22688, 0x3ee4a304
+1, 1884, 1884, 1884, 1884, 0x1957ab65
+0, 3768, 3768, 1884, 22688, 0x9777a305
+1, 3768, 3768, 1884, 1884, 0x7fcd6e47
+0, 5652, 5652, 1884, 22688, 0xf00aa306
+1, 5652, 5652, 1884, 1884, 0xc974878e
+0, 7536, 7536, 1884, 22688, 0x48aca307
+1, 7536, 7536, 1884, 1884, 0xecb5c4c8
+0, 9420, 9420, 1884, 22688, 0xa13fa308
+1, 9420, 9420, 1884, 1884, 0x87adce5f
+0, 11304, 11304, 1884, 22688, 0xf9d2a309
+1, 11304, 11304, 1884, 1884, 0x3cf097e4
+0, 13188, 13188, 1884, 22688, 0x5274a30a
+1, 13188, 13188, 1884, 1884, 0xcc218105
+0, 15072, 15072, 1884, 22688, 0xab07a30b
+1, 15072, 15072, 1884, 1884, 0xf685762f
+0, 16956, 16956, 1884, 17896, 0x1a696b6e
diff --git a/gst-libs/ext/libav/tests/ref/fate/cdxl-ham6 b/gst-libs/ext/libav/tests/ref/fate/cdxl-ham6
new file mode 100644
index 0000000..25886b2
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/cdxl-ham6
@@ -0,0 +1,17 @@
+#tb 0: 1/11025
+0, 0, 0, 0, 57600, 0x87887a7b
+0, 1092, 1092, 0, 57600, 0x10c301d2
+0, 2184, 2184, 0, 57600, 0xd1a6f910
+0, 3276, 3276, 0, 57600, 0x20242bb9
+0, 4368, 4368, 0, 57600, 0xae33cb7f
+0, 5460, 5460, 0, 57600, 0x501b82c8
+0, 6552, 6552, 0, 57600, 0x84199043
+0, 7644, 7644, 0, 57600, 0x946a6dbb
+0, 8736, 8736, 0, 57600, 0xeacea671
+0, 9828, 9828, 0, 57600, 0x77b8723f
+0, 10920, 10920, 0, 57600, 0x371cdb09
+0, 12012, 12012, 0, 57600, 0xa16ef5ee
+0, 13104, 13104, 0, 57600, 0xcb6abd9e
+0, 14196, 14196, 0, 57600, 0xb73e800f
+0, 15288, 15288, 0, 57600, 0x368bd93e
+0, 16380, 16380, 0, 57600, 0xcde72dc5
diff --git a/gst-libs/ext/libav/tests/ref/fate/cdxl-ham8 b/gst-libs/ext/libav/tests/ref/fate/cdxl-ham8
new file mode 100644
index 0000000..356ad1b
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/cdxl-ham8
@@ -0,0 +1,2 @@
+#tb 0: 1/11025
+0, 0, 0, 0, 67584, 0xce0cade5
diff --git a/gst-libs/ext/libav/tests/ref/fate/cdxl-pal8 b/gst-libs/ext/libav/tests/ref/fate/cdxl-pal8
new file mode 100644
index 0000000..f5c319a
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/cdxl-pal8
@@ -0,0 +1,12 @@
+#tb 0: 1/11025
+0, 0, 0, 0, 67584, 0x5eae629b
+0, 220, 220, 0, 67584, 0x32591227
+0, 440, 440, 0, 67584, 0x4e4424c7
+0, 660, 660, 0, 67584, 0x70db0134
+0, 880, 880, 0, 67584, 0x3550ed0b
+0, 1100, 1100, 0, 67584, 0x86fe3eef
+0, 1320, 1320, 0, 67584, 0x3414bb33
+0, 1540, 1540, 0, 67584, 0x667bfb91
+0, 1760, 1760, 0, 67584, 0x6e1a4ccb
+0, 1980, 1980, 0, 67584, 0xf723f9ae
+0, 2200, 2200, 0, 67584, 0x88481d5d
diff --git a/gst-libs/ext/libav/tests/ref/fate/cdxl-pal8-small b/gst-libs/ext/libav/tests/ref/fate/cdxl-pal8-small
new file mode 100644
index 0000000..d285e9a
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/cdxl-pal8-small
@@ -0,0 +1,47 @@
+#tb 0: 1/11025
+0, 0, 0, 0, 30720, 0x0d552cfd
+0, 368, 368, 0, 30720, 0x3cf93291
+0, 736, 736, 0, 30720, 0xe45b2868
+0, 1104, 1104, 0, 30720, 0xb5df289b
+0, 1472, 1472, 0, 30720, 0x2562259e
+0, 1840, 1840, 0, 30720, 0xbf171878
+0, 2208, 2208, 0, 30720, 0x695b1d73
+0, 2576, 2576, 0, 30720, 0x89ef1614
+0, 2944, 2944, 0, 30720, 0xe12a1dd9
+0, 3312, 3312, 0, 30720, 0x49622ffa
+0, 3680, 3680, 0, 30720, 0xd6832703
+0, 4048, 4048, 0, 30720, 0xec1d0cb7
+0, 4416, 4416, 0, 30720, 0x8bee0525
+0, 4784, 4784, 0, 30720, 0x1e0cf0c4
+0, 5152, 5152, 0, 30720, 0xf83fd9db
+0, 5520, 5520, 0, 30720, 0xffb0d6ab
+0, 5888, 5888, 0, 30720, 0xe37fe239
+0, 6256, 6256, 0, 30720, 0x74b0f856
+0, 6624, 6624, 0, 30720, 0x9c88d3e1
+0, 6992, 6992, 0, 30720, 0x714db368
+0, 7360, 7360, 0, 30720, 0x6c8e8860
+0, 7728, 7728, 0, 30720, 0x804968e6
+0, 8096, 8096, 0, 30720, 0x7ac56ae4
+0, 8464, 8464, 0, 30720, 0xffd85cbf
+0, 8832, 8832, 0, 30720, 0x1f8455f9
+0, 9200, 9200, 0, 30720, 0x3ae65296
+0, 9568, 9568, 0, 30720, 0x9e544ecd
+0, 9936, 9936, 0, 30720, 0x35678e5a
+0, 10304, 10304, 0, 30720, 0x04bae866
+0, 10672, 10672, 0, 30720, 0xb126ed94
+0, 11040, 11040, 0, 30720, 0x1720efc5
+0, 11408, 11408, 0, 30720, 0x4c1b01c2
+0, 11776, 11776, 0, 30720, 0xd0a1e866
+0, 12144, 12144, 0, 30720, 0x0d330789
+0, 12512, 12512, 0, 30720, 0xf5ac08bb
+0, 12880, 12880, 0, 30720, 0x9abe0d83
+0, 13248, 13248, 0, 30720, 0xa44c02f4
+0, 13616, 13616, 0, 30720, 0xdc4cc688
+0, 13984, 13984, 0, 30720, 0x22eef3c1
+0, 14352, 14352, 0, 30720, 0xcfbc0d1d
+0, 14720, 14720, 0, 30720, 0x7104ea31
+0, 15088, 15088, 0, 30720, 0x80daecfb
+0, 15456, 15456, 0, 30720, 0xe1bab995
+0, 15824, 15824, 0, 30720, 0x43f4b896
+0, 16192, 16192, 0, 30720, 0xa0d2bf5c
+0, 16560, 16560, 0, 30720, 0x3556a114
diff --git a/gst-libs/ext/libav/tests/ref/fate/cljr b/gst-libs/ext/libav/tests/ref/fate/cljr
index 7221b9e..f73c8c0 100644
--- a/gst-libs/ext/libav/tests/ref/fate/cljr
+++ b/gst-libs/ext/libav/tests/ref/fate/cljr
@@ -1,36 +1,37 @@
-0, 0, 64800, 0x44a1c47c
-0, 3169, 64800, 0x649cc3a4
-0, 6338, 64800, 0xcab1b88c
-0, 9507, 64800, 0xf56cb788
-0, 12676, 64800, 0x5336b618
-0, 15845, 64800, 0x2704b438
-0, 19013, 64800, 0x04c7b8e4
-0, 22182, 64800, 0x3185b288
-0, 25351, 64800, 0xa537c410
-0, 28520, 64800, 0x6495c0f8
-0, 31689, 64800, 0x06a1ca14
-0, 34858, 64800, 0x69cdd2a0
-0, 38027, 64800, 0x4ad2d828
-0, 41196, 64800, 0x9604dea4
-0, 44365, 64800, 0x1c00e430
-0, 47534, 64800, 0x9afeefe0
-0, 50702, 64800, 0xc13fdd78
-0, 53871, 64800, 0x8438da7c
-0, 57040, 64800, 0xa0ead278
-0, 60209, 64800, 0xbeced2d8
-0, 63378, 64800, 0x85bbd7dc
-0, 66547, 64800, 0xbe59ce34
-0, 69716, 64800, 0xd76ecccc
-0, 72885, 64800, 0xe182b474
-0, 76054, 64800, 0x916cc394
-0, 79223, 64800, 0x7efebd14
-0, 82391, 64800, 0x8d28c9f0
-0, 85560, 64800, 0x00a1c960
-0, 88729, 64800, 0xc164c400
-0, 91898, 64800, 0xfd4dc544
-0, 95067, 64800, 0x01bfbe38
-0, 98236, 64800, 0xff11b5d0
-0, 101405, 64800, 0x4876bb20
-0, 104574, 64800, 0x756ecb04
-0, 107743, 64800, 0x3b8cd540
-0, 110912, 64800, 0x063ed444
+#tb 0: 3521/100000
+0, 0, 0, 1, 64800, 0x44a1c47c
+0, 1, 1, 1, 64800, 0x649cc3a4
+0, 2, 2, 1, 64800, 0xcab1b88c
+0, 3, 3, 1, 64800, 0xf56cb788
+0, 4, 4, 1, 64800, 0x5336b618
+0, 5, 5, 1, 64800, 0x2704b438
+0, 6, 6, 1, 64800, 0x04c7b8e4
+0, 7, 7, 1, 64800, 0x3185b288
+0, 8, 8, 1, 64800, 0xa537c410
+0, 9, 9, 1, 64800, 0x6495c0f8
+0, 10, 10, 1, 64800, 0x06a1ca14
+0, 11, 11, 1, 64800, 0x69cdd2a0
+0, 12, 12, 1, 64800, 0x4ad2d828
+0, 13, 13, 1, 64800, 0x9604dea4
+0, 14, 14, 1, 64800, 0x1c00e430
+0, 15, 15, 1, 64800, 0x9afeefe0
+0, 16, 16, 1, 64800, 0xc13fdd78
+0, 17, 17, 1, 64800, 0x8438da7c
+0, 18, 18, 1, 64800, 0xa0ead278
+0, 19, 19, 1, 64800, 0xbeced2d8
+0, 20, 20, 1, 64800, 0x85bbd7dc
+0, 21, 21, 1, 64800, 0xbe59ce34
+0, 22, 22, 1, 64800, 0xd76ecccc
+0, 23, 23, 1, 64800, 0xe182b474
+0, 24, 24, 1, 64800, 0x916cc394
+0, 25, 25, 1, 64800, 0x7efebd14
+0, 26, 26, 1, 64800, 0x8d28c9f0
+0, 27, 27, 1, 64800, 0x00a1c960
+0, 28, 28, 1, 64800, 0xc164c400
+0, 29, 29, 1, 64800, 0xfd4dc544
+0, 30, 30, 1, 64800, 0x01bfbe38
+0, 31, 31, 1, 64800, 0xff11b5d0
+0, 32, 32, 1, 64800, 0x4876bb20
+0, 33, 33, 1, 64800, 0x756ecb04
+0, 34, 34, 1, 64800, 0x3b8cd540
+0, 35, 35, 1, 64800, 0x063ed444
diff --git a/gst-libs/ext/libav/tests/ref/fate/cllc-argb b/gst-libs/ext/libav/tests/ref/fate/cllc-argb
new file mode 100644
index 0000000..0283863
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/cllc-argb
@@ -0,0 +1,5 @@
+#tb 0: 1001/24000
+0, 0, 0, 1, 3686400, 0xb37a6e69
+0, 1, 1, 1, 3686400, 0x66a45032
+0, 2, 2, 1, 3686400, 0xdf0c861f
+0, 3, 3, 1, 3686400, 0xa4a68cdb
diff --git a/gst-libs/ext/libav/tests/ref/fate/cllc-rgb b/gst-libs/ext/libav/tests/ref/fate/cllc-rgb
new file mode 100644
index 0000000..06d54da
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/cllc-rgb
@@ -0,0 +1,15 @@
+#tb 0: 1001/30000
+0, 0, 0, 1, 921600, 0x82e44cb9
+0, 1, 1, 1, 921600, 0x6ecc8a6c
+0, 2, 2, 1, 921600, 0x0dc31839
+0, 3, 3, 1, 921600, 0x8ed6fb3c
+0, 4, 4, 1, 921600, 0x72d759fd
+0, 5, 5, 1, 921600, 0x3941e84d
+0, 6, 6, 1, 921600, 0x9e63f5cd
+0, 7, 7, 1, 921600, 0xbce4f1cc
+0, 8, 8, 1, 921600, 0xb531bd5d
+0, 9, 9, 1, 921600, 0xab28aada
+0, 10, 10, 1, 921600, 0x49f21d52
+0, 11, 11, 1, 921600, 0x4d7488fa
+0, 12, 12, 1, 921600, 0x16b9c9c9
+0, 13, 13, 1, 921600, 0xa0a4f77f
diff --git a/gst-libs/ext/libav/tests/ref/fate/corepng b/gst-libs/ext/libav/tests/ref/fate/corepng
index 2b197d2..e200714 100644
--- a/gst-libs/ext/libav/tests/ref/fate/corepng
+++ b/gst-libs/ext/libav/tests/ref/fate/corepng
@@ -1,37 +1,39 @@
-0, 0, 230400, 0x03e25ead
-1, 0, 11026, 0x27ad637c
-0, 6000, 230400, 0x0a520ffd
-0, 12000, 230400, 0x0b11a671
-0, 18000, 230400, 0x7d3fce32
-0, 24000, 230400, 0x1edb18cc
-0, 30000, 230400, 0x1d470493
-0, 36000, 230400, 0xe53ba01d
-0, 42000, 230400, 0xc4df13c2
-1, 45004, 1470, 0x4af4b7a3
-0, 48000, 230400, 0x5febe6c9
-1, 51004, 1470, 0x2601fc3b
-0, 54000, 230400, 0xb0de2ed9
-1, 57004, 1470, 0xd94ec488
-0, 60000, 230400, 0x4991ee21
-1, 63004, 1470, 0x5ffb6bdd
-0, 66000, 230400, 0x6b367a75
-1, 69004, 1470, 0xc5fece50
-0, 72000, 230400, 0x1d406b55
-1, 75004, 1470, 0xf4988a98
-0, 78000, 230400, 0x2bbbf1d3
-1, 81004, 1470, 0xa839620f
-0, 84000, 230400, 0x2a5ee265
-1, 87004, 1470, 0x800a77ff
-0, 90000, 230400, 0x0ae9de8d
-1, 93004, 1470, 0x8fc8a729
-0, 96000, 230400, 0x567eabf8
-1, 99004, 1470, 0x78708001
-0, 102000, 230400, 0x00260e67
-1, 105004, 1470, 0xb601958b
-1, 111004, 1470, 0xb054d1d3
-1, 117004, 1470, 0xce18bb41
-1, 123004, 1470, 0x43d182f9
-1, 129004, 1470, 0xe9448449
-1, 135004, 1470, 0x175ea4b3
-1, 141004, 1470, 0xf96b0e6a
-1, 147004, 1470, 0x12cc42fb
+#tb 0: 1/15
+#tb 1: 1/11025
+0, 0, 0, 1, 230400, 0x03e25ead
+1, 0, 0, 5513, 11026, 0x27ad637c
+0, 1, 1, 1, 230400, 0x0a520ffd
+0, 2, 2, 1, 230400, 0x0b11a671
+0, 3, 3, 1, 230400, 0x7d3fce32
+0, 4, 4, 1, 230400, 0x1edb18cc
+0, 5, 5, 1, 230400, 0x1d470493
+0, 6, 6, 1, 230400, 0xe53ba01d
+0, 7, 7, 1, 230400, 0xc4df13c2
+1, 5513, 5513, 735, 1470, 0x4af4b7a3
+0, 8, 8, 1, 230400, 0x5febe6c9
+1, 6248, 6248, 735, 1470, 0x2601fc3b
+0, 9, 9, 1, 230400, 0xb0de2ed9
+1, 6983, 6983, 735, 1470, 0xd94ec488
+0, 10, 10, 1, 230400, 0x4991ee21
+1, 7718, 7718, 735, 1470, 0x5ffb6bdd
+0, 11, 11, 1, 230400, 0x6b367a75
+1, 8453, 8453, 735, 1470, 0xc5fece50
+0, 12, 12, 1, 230400, 0x1d406b55
+1, 9188, 9188, 735, 1470, 0xf4988a98
+0, 13, 13, 1, 230400, 0x2bbbf1d3
+1, 9923, 9923, 735, 1470, 0xa839620f
+0, 14, 14, 1, 230400, 0x2a5ee265
+1, 10658, 10658, 735, 1470, 0x800a77ff
+0, 15, 15, 1, 230400, 0x0ae9de8d
+1, 11393, 11393, 735, 1470, 0x8fc8a729
+0, 16, 16, 1, 230400, 0x567eabf8
+1, 12128, 12128, 735, 1470, 0x78708001
+0, 17, 17, 1, 230400, 0x00260e67
+1, 12863, 12863, 735, 1470, 0xb601958b
+1, 13598, 13598, 735, 1470, 0xb054d1d3
+1, 14333, 14333, 735, 1470, 0xce18bb41
+1, 15068, 15068, 735, 1470, 0x43d182f9
+1, 15803, 15803, 735, 1470, 0xe9448449
+1, 16538, 16538, 735, 1470, 0x175ea4b3
+1, 17273, 17273, 735, 1470, 0xf96b0e6a
+1, 18008, 18008, 735, 1470, 0x12cc42fb
diff --git a/gst-libs/ext/libav/tests/ref/fate/crc b/gst-libs/ext/libav/tests/ref/fate/crc
index 4a82680..1c24aea 100644
--- a/gst-libs/ext/libav/tests/ref/fate/crc
+++ b/gst-libs/ext/libav/tests/ref/fate/crc
@@ -1,4 +1,4 @@
-crc EDB88320 =3D5CDD04
-crc 04C11DB7 =E0BAF5C0
-crc 00008005 =BB1F
-crc 00000007 =E3
+crc EDB88320 = 3D5CDD04
+crc 04C11DB7 = E0BAF5C0
+crc 00008005 = BB1F
+crc 00000007 = E3
diff --git a/gst-libs/ext/libav/tests/ref/fate/creatureshock-avs b/gst-libs/ext/libav/tests/ref/fate/creatureshock-avs
index bd6739f..979baf6 100644
--- a/gst-libs/ext/libav/tests/ref/fate/creatureshock-avs
+++ b/gst-libs/ext/libav/tests/ref/fate/creatureshock-avs
@@ -1,92 +1,94 @@
-0, 0, 188892, 0xcb5be3dd
-1, 0, 16372, 0xfaaab59d
-0, 6000, 188892, 0x0f313ebc
-0, 12000, 188892, 0xc0da25cc
-0, 18000, 188892, 0xad6e1d44
-0, 24000, 188892, 0xb1103b40
-0, 30000, 188892, 0xae033450
-1, 33154, 4028, 0xc2daed72
-0, 36000, 188892, 0xb31f03b4
-1, 41310, 5486, 0xf7fd794d
-0, 42000, 188892, 0xacb2d3f9
-0, 48000, 188892, 0x7d77ecbd
-1, 52420, 5790, 0xfd5a369f
-0, 54000, 188892, 0x7faa2f6c
-0, 60000, 188892, 0x28f4fdf1
-1, 64145, 1068, 0x0b602cd0
-0, 66000, 188892, 0x4b53f3b9
-1, 66307, 4908, 0xfe870aad
-0, 72000, 188892, 0x1f09bb29
-1, 76246, 6062, 0x8a4d6e0f
-0, 78000, 188892, 0x3afcc11d
-0, 84000, 188892, 0x6b918e49
-1, 88522, 5402, 0x71fd352f
-0, 90000, 188892, 0x9630a04d
-0, 96000, 188892, 0x9381b4c1
-1, 99461, 544, 0xeb766d34
-1, 100563, 5906, 0x47ac7e08
-0, 102000, 188892, 0xa7dea7e5
-0, 108000, 188892, 0xd277c41d
-1, 112522, 5916, 0x0d26eb56
-0, 114000, 188892, 0xafa2a6c9
-0, 120000, 188892, 0x13a38839
-1, 124502, 4006, 0x9941c71a
-0, 126000, 188892, 0xcd5e5a6d
-0, 132000, 188892, 0xe7da71e9
-1, 132615, 2100, 0xc9a2ee36
-1, 136867, 5894, 0xd2ba4eaa
-0, 138000, 188892, 0x06928add
-0, 144000, 188892, 0x4a108eb9
-1, 148803, 6090, 0xf43e73d0
-0, 150000, 188892, 0xea2598f5
-0, 156000, 188892, 0x17ed6839
-1, 161135, 2288, 0x5a8b7aa0
-0, 162000, 188892, 0x9de6ab65
-1, 165768, 3850, 0x7f66eb2c
-0, 168000, 188892, 0xb4ee326f
-1, 173564, 5796, 0xc5cf3ee8
-0, 174000, 188892, 0x3f85095b
-0, 180000, 188892, 0xaab7e331
-1, 185302, 6042, 0xed80136d
-0, 186000, 188892, 0xc2a079e1
-0, 192000, 188892, 0x612080c2
-1, 197537, 684, 0xc42bd137
-0, 198000, 188892, 0xa7232d47
-1, 198922, 5436, 0xb7f8a6fd
-0, 204000, 188892, 0xc053297d
-1, 209930, 6098, 0xee6354a2
-0, 210000, 188892, 0x1ecc3bfe
-0, 216000, 188892, 0xcc4ac803
-0, 222000, 188892, 0x4b90047b
-1, 222278, 4838, 0x129e61d0
-0, 228000, 188892, 0xd863b643
-1, 232075, 1074, 0x9da90634
-0, 234000, 188892, 0x93a25fb1
-1, 234250, 6084, 0x8ffed952
-0, 240000, 188892, 0xf969e131
-0, 246000, 188892, 0x73bd2469
-1, 246571, 6038, 0xa07b4276
-0, 252000, 188892, 0x265a9ce2
-0, 258000, 188892, 0xd59ccd39
-1, 258798, 3176, 0xebef63c1
-0, 264000, 188892, 0xe50fc068
-1, 265229, 2794, 0xbe1000db
-0, 270000, 188892, 0x83113a86
-1, 270887, 6020, 0xd8e34961
-0, 276000, 188892, 0xa0203504
-0, 282000, 188892, 0x9e2d518c
-1, 283078, 6020, 0xc07cf461
-0, 288000, 188892, 0x5f610e66
-0, 294000, 188892, 0x9b77f900
-1, 295268, 1538, 0xc975ae02
-1, 298383, 4230, 0x0827111b
-0, 300000, 188892, 0xaaf279c2
-0, 306000, 188892, 0x4ac97cc2
-1, 306949, 6084, 0x2cf0a407
-0, 312000, 188892, 0xddd91642
-0, 318000, 188892, 0x4f32dcd1
-1, 319269, 5828, 0x12750279
-0, 324000, 188892, 0xdc126b42
-0, 330000, 188892, 0x00000000
-1, 331071, 230, 0xc9c03f3b
-1, 331536, 768, 0x6137a04d
+#tb 0: 1/90000
+#tb 1: 1/22222
+0, 0, 0, 0, 188892, 0xcb5be3dd
+1, 0, 0, 8186, 16372, 0xfaaab59d
+0, 6000, 6000, 0, 188892, 0x0f313ebc
+0, 12000, 12000, 0, 188892, 0xc0da25cc
+0, 18000, 18000, 0, 188892, 0xad6e1d44
+0, 24000, 24000, 0, 188892, 0xb1103b40
+0, 30000, 30000, 0, 188892, 0xae033450
+1, 8186, 8186, 2014, 4028, 0xc2daed72
+0, 36000, 36000, 0, 188892, 0xb31f03b4
+1, 10200, 10200, 2743, 5486, 0xf7fd794d
+0, 42000, 42000, 0, 188892, 0xacb2d3f9
+0, 48000, 48000, 0, 188892, 0x7d77ecbd
+1, 12943, 12943, 2895, 5790, 0xfd5a369f
+0, 54000, 54000, 0, 188892, 0x7faa2f6c
+0, 60000, 60000, 0, 188892, 0x28f4fdf1
+1, 15838, 15838, 534, 1068, 0x0b602cd0
+0, 66000, 66000, 0, 188892, 0x4b53f3b9
+1, 16372, 16372, 2454, 4908, 0xfe870aad
+0, 72000, 72000, 0, 188892, 0x1f09bb29
+1, 18826, 18826, 3031, 6062, 0x8a4d6e0f
+0, 78000, 78000, 0, 188892, 0x3afcc11d
+0, 84000, 84000, 0, 188892, 0x6b918e49
+1, 21857, 21857, 2701, 5402, 0x71fd352f
+0, 90000, 90000, 0, 188892, 0x9630a04d
+0, 96000, 96000, 0, 188892, 0x9381b4c1
+1, 24558, 24558, 272, 544, 0xeb766d34
+1, 24830, 24830, 2953, 5906, 0x47ac7e08
+0, 102000, 102000, 0, 188892, 0xa7dea7e5
+0, 108000, 108000, 0, 188892, 0xd277c41d
+1, 27783, 27783, 2958, 5916, 0x0d26eb56
+0, 114000, 114000, 0, 188892, 0xafa2a6c9
+0, 120000, 120000, 0, 188892, 0x13a38839
+1, 30741, 30741, 2003, 4006, 0x9941c71a
+0, 126000, 126000, 0, 188892, 0xcd5e5a6d
+0, 132000, 132000, 0, 188892, 0xe7da71e9
+1, 32744, 32744, 1050, 2100, 0xc9a2ee36
+1, 33794, 33794, 2947, 5894, 0xd2ba4eaa
+0, 138000, 138000, 0, 188892, 0x06928add
+0, 144000, 144000, 0, 188892, 0x4a108eb9
+1, 36741, 36741, 3045, 6090, 0xf43e73d0
+0, 150000, 150000, 0, 188892, 0xea2598f5
+0, 156000, 156000, 0, 188892, 0x17ed6839
+1, 39786, 39786, 1144, 2288, 0x5a8b7aa0
+0, 162000, 162000, 0, 188892, 0x9de6ab65
+1, 40930, 40930, 1925, 3850, 0x7f66eb2c
+0, 168000, 168000, 0, 188892, 0xb4ee326f
+1, 42855, 42855, 2898, 5796, 0xc5cf3ee8
+0, 174000, 174000, 0, 188892, 0x3f85095b
+0, 180000, 180000, 0, 188892, 0xaab7e331
+1, 45753, 45753, 3021, 6042, 0xed80136d
+0, 186000, 186000, 0, 188892, 0xc2a079e1
+0, 192000, 192000, 0, 188892, 0x612080c2
+1, 48774, 48774, 342, 684, 0xc42bd137
+0, 198000, 198000, 0, 188892, 0xa7232d47
+1, 49116, 49116, 2718, 5436, 0xb7f8a6fd
+0, 204000, 204000, 0, 188892, 0xc053297d
+1, 51834, 51834, 3049, 6098, 0xee6354a2
+0, 210000, 210000, 0, 188892, 0x1ecc3bfe
+0, 216000, 216000, 0, 188892, 0xcc4ac803
+0, 222000, 222000, 0, 188892, 0x4b90047b
+1, 54883, 54883, 2419, 4838, 0x129e61d0
+0, 228000, 228000, 0, 188892, 0xd863b643
+1, 57302, 57302, 537, 1074, 0x9da90634
+0, 234000, 234000, 0, 188892, 0x93a25fb1
+1, 57839, 57839, 3042, 6084, 0x8ffed952
+0, 240000, 240000, 0, 188892, 0xf969e131
+0, 246000, 246000, 0, 188892, 0x73bd2469
+1, 60881, 60881, 3019, 6038, 0xa07b4276
+0, 252000, 252000, 0, 188892, 0x265a9ce2
+0, 258000, 258000, 0, 188892, 0xd59ccd39
+1, 63900, 63900, 1588, 3176, 0xebef63c1
+0, 264000, 264000, 0, 188892, 0xe50fc068
+1, 65488, 65488, 1397, 2794, 0xbe1000db
+0, 270000, 270000, 0, 188892, 0x83113a86
+1, 66885, 66885, 3010, 6020, 0xd8e34961
+0, 276000, 276000, 0, 188892, 0xa0203504
+0, 282000, 282000, 0, 188892, 0x9e2d518c
+1, 69895, 69895, 3010, 6020, 0xc07cf461
+0, 288000, 288000, 0, 188892, 0x5f610e66
+0, 294000, 294000, 0, 188892, 0x9b77f900
+1, 72905, 72905, 769, 1538, 0xc975ae02
+1, 73674, 73674, 2115, 4230, 0x0827111b
+0, 300000, 300000, 0, 188892, 0xaaf279c2
+0, 306000, 306000, 0, 188892, 0x4ac97cc2
+1, 75789, 75789, 3042, 6084, 0x2cf0a407
+0, 312000, 312000, 0, 188892, 0xddd91642
+0, 318000, 318000, 0, 188892, 0x4f32dcd1
+1, 78831, 78831, 2914, 5828, 0x12750279
+0, 324000, 324000, 0, 188892, 0xdc126b42
+0, 330000, 330000, 0, 188892, 0x00000000
+1, 81745, 81745, 115, 230, 0xc9c03f3b
+1, 81860, 81860, 384, 768, 0x6137a04d
diff --git a/gst-libs/ext/libav/tests/ref/fate/cscd b/gst-libs/ext/libav/tests/ref/fate/cscd
index 8b89e80..74fe94e 100644
--- a/gst-libs/ext/libav/tests/ref/fate/cscd
+++ b/gst-libs/ext/libav/tests/ref/fate/cscd
@@ -1,208 +1,209 @@
-0, 0, 270000, 0xf90015d8
-0, 2865, 270000, 0xf90015d8
-0, 5729, 270000, 0xf90015d8
-0, 8594, 270000, 0xf90015d8
-0, 11459, 270000, 0xf90015d8
-0, 14324, 270000, 0xf90015d8
-0, 17188, 270000, 0xf90015d8
-0, 20053, 270000, 0xf90015d8
-0, 22918, 270000, 0xf90015d8
-0, 25782, 270000, 0xf90015d8
-0, 28647, 270000, 0xf90015d8
-0, 31512, 270000, 0xf90015d8
-0, 34377, 270000, 0xf90015d8
-0, 37241, 270000, 0xf90015d8
-0, 40106, 270000, 0xf90015d8
-0, 42971, 270000, 0xf90015d8
-0, 45836, 270000, 0xf90015d8
-0, 48700, 270000, 0xf90015d8
-0, 51565, 270000, 0xf90015d8
-0, 54430, 270000, 0xf90015d8
-0, 57294, 270000, 0xf90015d8
-0, 60159, 270000, 0xf90015d8
-0, 63024, 270000, 0xf90015d8
-0, 65889, 270000, 0xf90015d8
-0, 68753, 270000, 0xf90015d8
-0, 71618, 270000, 0xf90015d8
-0, 74483, 270000, 0xf90015d8
-0, 77347, 270000, 0xf90015d8
-0, 80212, 270000, 0xf90015d8
-0, 83077, 270000, 0xf90015d8
-0, 85942, 270000, 0xf90015d8
-0, 88806, 270000, 0xf90015d8
-0, 91671, 270000, 0xf90015d8
-0, 94536, 270000, 0xf90015d8
-0, 97401, 270000, 0xf90015d8
-0, 100265, 270000, 0xf90015d8
-0, 103130, 270000, 0xf90015d8
-0, 105995, 270000, 0xf90015d8
-0, 108859, 270000, 0xf90015d8
-0, 111724, 270000, 0x1f9c15d8
-0, 114589, 270000, 0x436f15d8
-0, 117454, 270000, 0xe90115d8
-0, 120318, 270000, 0xe90115d8
-0, 123183, 270000, 0x8ea215d8
-0, 126048, 270000, 0x424015d8
-0, 128912, 270000, 0x0ce315d8
-0, 131777, 270000, 0x14bc15d8
-0, 134642, 270000, 0x2a9215d8
-0, 137507, 270000, 0x233f15d8
-0, 140371, 270000, 0x764b15d8
-0, 143236, 270000, 0xf76115d8
-0, 146101, 270000, 0xbbe015d8
-0, 148966, 270000, 0x95af15d8
-0, 151830, 270000, 0x324815d8
-0, 154695, 270000, 0x311915d8
-0, 157560, 270000, 0x090ef191
-0, 160424, 270000, 0xd88974dc
-0, 163289, 270000, 0xfa7f58df
-0, 166154, 270000, 0x78f849c3
-0, 169019, 270000, 0xae174892
-0, 171883, 270000, 0x9d4e2332
-0, 174748, 270000, 0x874b09b4
-0, 177613, 270000, 0x4069fed6
-0, 180477, 270000, 0x4069fed6
-0, 183342, 270000, 0x4069fed6
-0, 186207, 270000, 0x4069fed6
-0, 189072, 270000, 0x4069fed6
-0, 191936, 270000, 0x4069fed6
-0, 194801, 270000, 0x4069fed6
-0, 197666, 270000, 0x4069fed6
-0, 200531, 270000, 0x4069fed6
-0, 203395, 270000, 0x4069fed6
-0, 206260, 270000, 0x4069fed6
-0, 209125, 270000, 0x773db046
-0, 211989, 270000, 0x773db046
-0, 214854, 270000, 0x773db046
-0, 217719, 270000, 0x773db046
-0, 220584, 270000, 0x773db046
-0, 223448, 270000, 0x773db046
-0, 226313, 270000, 0x773db046
-0, 229178, 270000, 0x773db046
-0, 232042, 270000, 0x773db046
-0, 234907, 270000, 0x773db046
-0, 237772, 270000, 0x773db046
-0, 240637, 270000, 0x773db046
-0, 243501, 270000, 0x773db046
-0, 246366, 270000, 0x773db046
-0, 249231, 270000, 0x773db046
-0, 252095, 270000, 0x773db046
-0, 254960, 270000, 0x773db046
-0, 257825, 270000, 0x17b9aec9
-0, 260690, 270000, 0x622fad4c
-0, 263554, 270000, 0xdaea3aef
-0, 266419, 270000, 0x61bb10e3
-0, 269284, 270000, 0xfc37ee0c
-0, 272149, 270000, 0x50dbd01e
-0, 275013, 270000, 0xcd66c27c
-0, 277878, 270000, 0xd13f1e4f
-0, 280743, 270000, 0xa4a2dbf5
-0, 283607, 270000, 0xf302c9ab
-0, 286472, 270000, 0x4479f7fe
-0, 289337, 270000, 0x1afe92c8
-0, 292202, 270000, 0x3007f4c3
-0, 295066, 270000, 0x5834c096
-0, 297931, 270000, 0x40109126
-0, 300796, 270000, 0x0a7b8882
-0, 303660, 270000, 0x15b8635d
-0, 306525, 270000, 0xeaa5598e
-0, 309390, 270000, 0x0b7b5489
-0, 312255, 270000, 0x0b7b5489
-0, 315119, 270000, 0x0b7b5489
-0, 317984, 270000, 0x0b7b5489
-0, 320849, 270000, 0x8f0e6eaa
-0, 323714, 270000, 0xc46fc0f2
-0, 326578, 270000, 0xadd7e605
-0, 329443, 270000, 0x9d23a056
-0, 332308, 270000, 0x365afa63
-0, 335172, 270000, 0x6ac3bda2
-0, 338037, 270000, 0x14f5daf2
-0, 340902, 270000, 0x4b3afb6a
-0, 343767, 270000, 0x1a3302e3
-0, 346631, 270000, 0x1a3302e3
-0, 349496, 270000, 0x1a3302e3
-0, 352361, 270000, 0x1a3302e3
-0, 355225, 270000, 0xc15526e2
-0, 358090, 270000, 0x3dd73006
-0, 360955, 270000, 0x60abb5bc
-0, 363820, 270000, 0xb960c27c
-0, 366684, 270000, 0x8fa4c01c
-0, 369549, 270000, 0x8fa4c01c
-0, 372414, 270000, 0x8fa4c01c
-0, 375279, 270000, 0xb20dcc38
-0, 378143, 270000, 0x03c6ad3c
-0, 381008, 270000, 0xe550b194
-0, 383873, 270000, 0xe550b194
-0, 386737, 270000, 0xe550b194
-0, 389602, 270000, 0xe550b194
-0, 392467, 270000, 0xe550b194
-0, 395332, 270000, 0xe550b194
-0, 398196, 270000, 0xe550b194
-0, 401061, 270000, 0xe550b194
-0, 403926, 270000, 0xe550b194
-0, 406790, 270000, 0xe550b194
-0, 409655, 270000, 0xe550b194
-0, 412520, 270000, 0xe550b194
-0, 415385, 270000, 0xe550b194
-0, 418249, 270000, 0xe550b194
-0, 421114, 270000, 0x4550a014
-0, 423979, 270000, 0xaf639da8
-0, 426844, 270000, 0xe4229da8
-0, 429708, 270000, 0x315d9da8
-0, 432573, 270000, 0x7e899da8
-0, 435438, 270000, 0x99b9a8a0
-0, 438302, 270000, 0x4588ac2a
-0, 441167, 270000, 0x1e79ae6e
-0, 444032, 270000, 0xa003cb14
-0, 446897, 270000, 0x03ef1bb8
-0, 449761, 270000, 0x3b3f30fc
-0, 452626, 270000, 0x4dad3525
-0, 455491, 270000, 0x5b600c12
-0, 458355, 270000, 0x75a1fab3
-0, 461220, 270000, 0xc9f7d9ad
-0, 464085, 270000, 0x9eaec58d
-0, 466950, 270000, 0xb91bc3e8
-0, 469814, 270000, 0x77bdbbfb
-0, 472679, 270000, 0x77bdbbfb
-0, 475544, 270000, 0x77bdbbfb
-0, 478408, 270000, 0x77bdbbfb
-0, 481273, 270000, 0x77bdbbfb
-0, 484138, 270000, 0x77bdbbfb
-0, 487003, 270000, 0x3d54eac2
-0, 489867, 270000, 0x3d54eac2
-0, 492732, 270000, 0x3d54eac2
-0, 495597, 270000, 0x3d54eac2
-0, 498462, 270000, 0x3d54eac2
-0, 501326, 270000, 0x3d54eac2
-0, 504191, 270000, 0x3d54eac2
-0, 507056, 270000, 0x3d54eac2
-0, 509920, 270000, 0x3d54eac2
-0, 512785, 270000, 0x3d54eac2
-0, 515650, 270000, 0x3d54eac2
-0, 518515, 270000, 0x3d54eac2
-0, 521379, 270000, 0x3d54eac2
-0, 524244, 270000, 0x3d54eac2
-0, 527109, 270000, 0x3d54eac2
-0, 529973, 270000, 0x3d54eac2
-0, 532838, 270000, 0x3d54eac2
-0, 535703, 270000, 0x3d54eac2
-0, 538568, 270000, 0x3d54eac2
-0, 541432, 270000, 0x5f3609ba
-0, 544297, 270000, 0x80921b0c
-0, 547162, 270000, 0x80921b0c
-0, 550027, 270000, 0x80921b0c
-0, 552891, 270000, 0x80921b0c
-0, 555756, 270000, 0x80921b0c
-0, 558621, 270000, 0x80921b0c
-0, 561485, 270000, 0x80921b0c
-0, 564350, 270000, 0x80921b0c
-0, 567215, 270000, 0x80921b0c
-0, 570080, 270000, 0x80921b0c
-0, 572944, 270000, 0x80921b0c
-0, 575809, 270000, 0x80921b0c
-0, 578674, 270000, 0x80921b0c
-0, 581538, 270000, 0x80921b0c
-0, 584403, 270000, 0x80921b0c
-0, 587268, 270000, 0x80921b0c
-0, 590133, 270000, 0xf0e626a8
-0, 592997, 270000, 0xf0e626a8
+#tb 0: 1/200
+0, 0, 0, 1, 270000, 0xf90015d8
+0, 9, 9, 1, 270000, 0xf90015d8
+0, 15, 15, 1, 270000, 0xf90015d8
+0, 22, 22, 1, 270000, 0xf90015d8
+0, 28, 28, 1, 270000, 0xf90015d8
+0, 34, 34, 1, 270000, 0xf90015d8
+0, 40, 40, 1, 270000, 0xf90015d8
+0, 47, 47, 1, 270000, 0xf90015d8
+0, 53, 53, 1, 270000, 0xf90015d8
+0, 59, 59, 1, 270000, 0xf90015d8
+0, 65, 65, 1, 270000, 0xf90015d8
+0, 72, 72, 1, 270000, 0xf90015d8
+0, 78, 78, 1, 270000, 0xf90015d8
+0, 84, 84, 1, 270000, 0xf90015d8
+0, 93, 93, 1, 270000, 0xf90015d8
+0, 100, 100, 1, 270000, 0xf90015d8
+0, 106, 106, 1, 270000, 0xf90015d8
+0, 112, 112, 1, 270000, 0xf90015d8
+0, 118, 118, 1, 270000, 0xf90015d8
+0, 125, 125, 1, 270000, 0xf90015d8
+0, 131, 131, 1, 270000, 0xf90015d8
+0, 137, 137, 1, 270000, 0xf90015d8
+0, 143, 143, 1, 270000, 0xf90015d8
+0, 150, 150, 1, 270000, 0xf90015d8
+0, 156, 156, 1, 270000, 0xf90015d8
+0, 162, 162, 1, 270000, 0xf90015d8
+0, 168, 168, 1, 270000, 0xf90015d8
+0, 175, 175, 1, 270000, 0xf90015d8
+0, 181, 181, 1, 270000, 0xf90015d8
+0, 187, 187, 1, 270000, 0xf90015d8
+0, 193, 193, 1, 270000, 0xf90015d8
+0, 200, 200, 1, 270000, 0xf90015d8
+0, 206, 206, 1, 270000, 0xf90015d8
+0, 212, 212, 1, 270000, 0xf90015d8
+0, 218, 218, 1, 270000, 0xf90015d8
+0, 225, 225, 1, 270000, 0xf90015d8
+0, 231, 231, 1, 270000, 0xf90015d8
+0, 237, 237, 1, 270000, 0xf90015d8
+0, 243, 243, 1, 270000, 0xf90015d8
+0, 253, 253, 1, 270000, 0x1f9c15d8
+0, 262, 262, 1, 270000, 0x436f15d8
+0, 268, 268, 1, 270000, 0xe90115d8
+0, 275, 275, 1, 270000, 0xe90115d8
+0, 281, 281, 1, 270000, 0x8ea215d8
+0, 290, 290, 1, 270000, 0x424015d8
+0, 300, 300, 1, 270000, 0x0ce315d8
+0, 309, 309, 1, 270000, 0x14bc15d8
+0, 318, 318, 1, 270000, 0x2a9215d8
+0, 328, 328, 1, 270000, 0x233f15d8
+0, 337, 337, 1, 270000, 0x764b15d8
+0, 347, 347, 1, 270000, 0xf76115d8
+0, 356, 356, 1, 270000, 0xbbe015d8
+0, 365, 365, 1, 270000, 0x95af15d8
+0, 375, 375, 1, 270000, 0x324815d8
+0, 384, 384, 1, 270000, 0x311915d8
+0, 393, 393, 1, 270000, 0x090ef191
+0, 403, 403, 1, 270000, 0xd88974dc
+0, 412, 412, 1, 270000, 0xfa7f58df
+0, 422, 422, 1, 270000, 0x78f849c3
+0, 431, 431, 1, 270000, 0xae174892
+0, 440, 440, 1, 270000, 0x9d4e2332
+0, 450, 450, 1, 270000, 0x874b09b4
+0, 459, 459, 1, 270000, 0x4069fed6
+0, 465, 465, 1, 270000, 0x4069fed6
+0, 472, 472, 1, 270000, 0x4069fed6
+0, 478, 478, 1, 270000, 0x4069fed6
+0, 484, 484, 1, 270000, 0x4069fed6
+0, 490, 490, 1, 270000, 0x4069fed6
+0, 500, 500, 1, 270000, 0x4069fed6
+0, 506, 506, 1, 270000, 0x4069fed6
+0, 512, 512, 1, 270000, 0x4069fed6
+0, 518, 518, 1, 270000, 0x4069fed6
+0, 525, 525, 1, 270000, 0x4069fed6
+0, 553, 553, 1, 270000, 0x773db046
+0, 559, 559, 1, 270000, 0x773db046
+0, 565, 565, 1, 270000, 0x773db046
+0, 572, 572, 1, 270000, 0x773db046
+0, 578, 578, 1, 270000, 0x773db046
+0, 584, 584, 1, 270000, 0x773db046
+0, 590, 590, 1, 270000, 0x773db046
+0, 597, 597, 1, 270000, 0x773db046
+0, 603, 603, 1, 270000, 0x773db046
+0, 609, 609, 1, 270000, 0x773db046
+0, 615, 615, 1, 270000, 0x773db046
+0, 622, 622, 1, 270000, 0x773db046
+0, 628, 628, 1, 270000, 0x773db046
+0, 634, 634, 1, 270000, 0x773db046
+0, 640, 640, 1, 270000, 0x773db046
+0, 647, 647, 1, 270000, 0x773db046
+0, 653, 653, 1, 270000, 0x773db046
+0, 662, 662, 1, 270000, 0x17b9aec9
+0, 672, 672, 1, 270000, 0x622fad4c
+0, 681, 681, 1, 270000, 0xdaea3aef
+0, 687, 687, 1, 270000, 0x61bb10e3
+0, 693, 693, 1, 270000, 0xfc37ee0c
+0, 703, 703, 1, 270000, 0x50dbd01e
+0, 712, 712, 1, 270000, 0xcd66c27c
+0, 722, 722, 1, 270000, 0xd13f1e4f
+0, 731, 731, 1, 270000, 0xa4a2dbf5
+0, 740, 740, 1, 270000, 0xf302c9ab
+0, 750, 750, 1, 270000, 0x4479f7fe
+0, 759, 759, 1, 270000, 0x1afe92c8
+0, 768, 768, 1, 270000, 0x3007f4c3
+0, 778, 778, 1, 270000, 0x5834c096
+0, 784, 784, 1, 270000, 0x40109126
+0, 790, 790, 1, 270000, 0x0a7b8882
+0, 800, 800, 1, 270000, 0x15b8635d
+0, 806, 806, 1, 270000, 0xeaa5598e
+0, 812, 812, 1, 270000, 0x0b7b5489
+0, 818, 818, 1, 270000, 0x0b7b5489
+0, 825, 825, 1, 270000, 0x0b7b5489
+0, 831, 831, 1, 270000, 0x0b7b5489
+0, 837, 837, 1, 270000, 0x8f0e6eaa
+0, 847, 847, 1, 270000, 0xc46fc0f2
+0, 856, 856, 1, 270000, 0xadd7e605
+0, 865, 865, 1, 270000, 0x9d23a056
+0, 875, 875, 1, 270000, 0x365afa63
+0, 884, 884, 1, 270000, 0x6ac3bda2
+0, 893, 893, 1, 270000, 0x14f5daf2
+0, 903, 903, 1, 270000, 0x4b3afb6a
+0, 909, 909, 1, 270000, 0x1a3302e3
+0, 915, 915, 1, 270000, 0x1a3302e3
+0, 922, 922, 1, 270000, 0x1a3302e3
+0, 928, 928, 1, 270000, 0x1a3302e3
+0, 934, 934, 1, 270000, 0xc15526e2
+0, 943, 943, 1, 270000, 0x3dd73006
+0, 953, 953, 1, 270000, 0x60abb5bc
+0, 962, 962, 1, 270000, 0xb960c27c
+0, 968, 968, 1, 270000, 0x8fa4c01c
+0, 975, 975, 1, 270000, 0x8fa4c01c
+0, 981, 981, 1, 270000, 0x8fa4c01c
+0, 987, 987, 1, 270000, 0xb20dcc38
+0, 997, 997, 1, 270000, 0x03c6ad3c
+0, 1006, 1006, 1, 270000, 0xe550b194
+0, 1012, 1012, 1, 270000, 0xe550b194
+0, 1018, 1018, 1, 270000, 0xe550b194
+0, 1025, 1025, 1, 270000, 0xe550b194
+0, 1031, 1031, 1, 270000, 0xe550b194
+0, 1037, 1037, 1, 270000, 0xe550b194
+0, 1043, 1043, 1, 270000, 0xe550b194
+0, 1050, 1050, 1, 270000, 0xe550b194
+0, 1056, 1056, 1, 270000, 0xe550b194
+0, 1062, 1062, 1, 270000, 0xe550b194
+0, 1068, 1068, 1, 270000, 0xe550b194
+0, 1075, 1075, 1, 270000, 0xe550b194
+0, 1081, 1081, 1, 270000, 0xe550b194
+0, 1087, 1087, 1, 270000, 0xe550b194
+0, 1093, 1093, 1, 270000, 0x4550a014
+0, 1103, 1103, 1, 270000, 0xaf639da8
+0, 1112, 1112, 1, 270000, 0xe4229da8
+0, 1118, 1118, 1, 270000, 0x315d9da8
+0, 1125, 1125, 1, 270000, 0x7e899da8
+0, 1134, 1134, 1, 270000, 0x99b9a8a0
+0, 1143, 1143, 1, 270000, 0x4588ac2a
+0, 1153, 1153, 1, 270000, 0x1e79ae6e
+0, 1162, 1162, 1, 270000, 0xa003cb14
+0, 1172, 1172, 1, 270000, 0x03ef1bb8
+0, 1181, 1181, 1, 270000, 0x3b3f30fc
+0, 1190, 1190, 1, 270000, 0x4dad3525
+0, 1200, 1200, 1, 270000, 0x5b600c12
+0, 1209, 1209, 1, 270000, 0x75a1fab3
+0, 1218, 1218, 1, 270000, 0xc9f7d9ad
+0, 1228, 1228, 1, 270000, 0x9eaec58d
+0, 1237, 1237, 1, 270000, 0xb91bc3e8
+0, 1247, 1247, 1, 270000, 0x77bdbbfb
+0, 1253, 1253, 1, 270000, 0x77bdbbfb
+0, 1259, 1259, 1, 270000, 0x77bdbbfb
+0, 1265, 1265, 1, 270000, 0x77bdbbfb
+0, 1272, 1272, 1, 270000, 0x77bdbbfb
+0, 1278, 1278, 1, 270000, 0x77bdbbfb
+0, 1287, 1287, 1, 270000, 0x3d54eac2
+0, 1293, 1293, 1, 270000, 0x3d54eac2
+0, 1300, 1300, 1, 270000, 0x3d54eac2
+0, 1306, 1306, 1, 270000, 0x3d54eac2
+0, 1315, 1315, 1, 270000, 0x3d54eac2
+0, 1322, 1322, 1, 270000, 0x3d54eac2
+0, 1328, 1328, 1, 270000, 0x3d54eac2
+0, 1334, 1334, 1, 270000, 0x3d54eac2
+0, 1340, 1340, 1, 270000, 0x3d54eac2
+0, 1347, 1347, 1, 270000, 0x3d54eac2
+0, 1353, 1353, 1, 270000, 0x3d54eac2
+0, 1359, 1359, 1, 270000, 0x3d54eac2
+0, 1365, 1365, 1, 270000, 0x3d54eac2
+0, 1372, 1372, 1, 270000, 0x3d54eac2
+0, 1378, 1378, 1, 270000, 0x3d54eac2
+0, 1384, 1384, 1, 270000, 0x3d54eac2
+0, 1390, 1390, 1, 270000, 0x3d54eac2
+0, 1397, 1397, 1, 270000, 0x3d54eac2
+0, 1403, 1403, 1, 270000, 0x3d54eac2
+0, 1412, 1412, 1, 270000, 0x5f3609ba
+0, 1422, 1422, 1, 270000, 0x80921b0c
+0, 1428, 1428, 1, 270000, 0x80921b0c
+0, 1434, 1434, 1, 270000, 0x80921b0c
+0, 1440, 1440, 1, 270000, 0x80921b0c
+0, 1447, 1447, 1, 270000, 0x80921b0c
+0, 1453, 1453, 1, 270000, 0x80921b0c
+0, 1459, 1459, 1, 270000, 0x80921b0c
+0, 1465, 1465, 1, 270000, 0x80921b0c
+0, 1472, 1472, 1, 270000, 0x80921b0c
+0, 1478, 1478, 1, 270000, 0x80921b0c
+0, 1484, 1484, 1, 270000, 0x80921b0c
+0, 1490, 1490, 1, 270000, 0x80921b0c
+0, 1497, 1497, 1, 270000, 0x80921b0c
+0, 1503, 1503, 1, 270000, 0x80921b0c
+0, 1509, 1509, 1, 270000, 0x80921b0c
+0, 1515, 1515, 1, 270000, 0x80921b0c
+0, 1525, 1525, 1, 270000, 0xf0e626a8
+0, 1531, 1531, 1, 270000, 0xf0e626a8
diff --git a/gst-libs/ext/libav/tests/ref/fate/cvid-grayscale b/gst-libs/ext/libav/tests/ref/fate/cvid-grayscale
index 4e39571..87ca600 100644
--- a/gst-libs/ext/libav/tests/ref/fate/cvid-grayscale
+++ b/gst-libs/ext/libav/tests/ref/fate/cvid-grayscale
@@ -1,152 +1,153 @@
-0, 0, 11300, 0x46c78923
-0, 17921, 11300, 0x3f2a1175
-0, 35842, 11300, 0x722de221
-0, 53763, 11300, 0x01746b88
-0, 71684, 11300, 0x549587a7
-0, 89605, 11300, 0x843ab943
-0, 107526, 11300, 0x62fdee48
-0, 125447, 11300, 0x74a62867
-0, 143368, 11300, 0x35a20e2f
-0, 161289, 11300, 0x4e9ef54d
-0, 179210, 11300, 0xec7201f5
-0, 197131, 11300, 0x363bfe27
-0, 215052, 11300, 0x2aaab418
-0, 232973, 11300, 0x6a48ab3f
-0, 250894, 11300, 0x3fecea34
-0, 268815, 11300, 0xa371f55e
-0, 286736, 11300, 0xa86b147c
-0, 304657, 11300, 0x49e9206e
-0, 322578, 11300, 0x6c9a2155
-0, 340499, 11300, 0x2c8a4798
-0, 358420, 11300, 0x3485676c
-0, 376341, 11300, 0xb0b293f2
-0, 394262, 11300, 0xe4a9b068
-0, 412183, 11300, 0xd68d0556
-0, 430104, 11300, 0xc28e5193
-0, 448025, 11300, 0xf6948483
-0, 465945, 11300, 0xf21fbf57
-0, 483866, 11300, 0x8345eb44
-0, 501787, 11300, 0x8124f045
-0, 519708, 11300, 0x18e31f10
-0, 537629, 11300, 0xdb1943fc
-0, 555550, 11300, 0x8701699f
-0, 573471, 11300, 0xd7b18550
-0, 591392, 11300, 0xa56faccc
-0, 609313, 11300, 0xf8bcc17c
-0, 627234, 11300, 0x446acab9
-0, 645155, 11300, 0x755fd295
-0, 663076, 11300, 0x92e3d100
-0, 680997, 11300, 0x54895bb3
-0, 698918, 11300, 0xd18bffda
-0, 716839, 11300, 0x480dbe4f
-0, 734760, 11300, 0x49ea9dbe
-0, 752681, 11300, 0x00d3a003
-0, 770602, 11300, 0xda7bbfb2
-0, 788523, 11300, 0x9700d9c2
-0, 806444, 11300, 0xa0a9e490
-0, 824365, 11300, 0x00eb0979
-0, 842286, 11300, 0x32b04630
-0, 860207, 11300, 0xdfb73e51
-0, 878128, 11300, 0x3d8e4f96
-0, 896049, 11300, 0x2ca83271
-0, 913970, 11300, 0xb5b123c0
-0, 931891, 11300, 0x8a570e58
-0, 949812, 11300, 0xc6c805bc
-0, 967733, 11300, 0x27caf7a5
-0, 985654, 11300, 0x5319ecb0
-0, 1003575, 11300, 0x5471e3fd
-0, 1021496, 11300, 0x6d68a6f4
-0, 1039417, 11300, 0x872b7194
-0, 1057338, 11300, 0x007c36bd
-0, 1075259, 11300, 0x2714f1b5
-0, 1093180, 11300, 0x6c8eb50f
-0, 1111101, 11300, 0xf5d57be8
-0, 1129022, 11300, 0x981f412b
-0, 1146943, 11300, 0x1a9804a1
-0, 1164864, 11300, 0xf0c1d24a
-0, 1182785, 11300, 0xa70a9d9b
-0, 1200706, 11300, 0x8c466876
-0, 1218627, 11300, 0xcf2e32df
-0, 1236548, 11300, 0xcb8cfebf
-0, 1254469, 11300, 0xb961ca99
-0, 1272390, 11300, 0x666d9619
-0, 1290311, 11300, 0x84bf5b55
-0, 1308232, 11300, 0xbfa22ccc
-0, 1326153, 11300, 0xcde41849
-0, 1344074, 11300, 0x71372dcd
-0, 1361994, 11300, 0x13402cfd
-0, 1379915, 11300, 0xdebdd321
-0, 1397836, 11300, 0xdda66de1
-0, 1415757, 11300, 0x7f4bb682
-0, 1433678, 11300, 0xf67fd528
-0, 1451599, 11300, 0xe739ff8c
-0, 1469520, 11300, 0x2e131774
-0, 1487441, 11300, 0xfa942811
-0, 1505362, 11300, 0x0cd93ac2
-0, 1523283, 11300, 0xd0445e0e
-0, 1541204, 11300, 0x3f3497c7
-0, 1559125, 11300, 0x11b5bd2c
-0, 1577046, 11300, 0xccd5e62a
-0, 1594967, 11300, 0xa9d4fcb5
-0, 1612888, 11300, 0x34aa1a03
-0, 1630809, 11300, 0x1ce6299e
-0, 1648730, 11300, 0x661c2745
-0, 1666651, 11300, 0x27d8a8b3
-0, 1684572, 11300, 0x9eb07467
-0, 1702493, 11300, 0x128374d2
-0, 1720414, 11300, 0x05c36ff5
-0, 1738335, 11300, 0x8a136bde
-0, 1756256, 11300, 0x15c47c99
-0, 1774177, 11300, 0xcc4a93f4
-0, 1792098, 11300, 0x19529b2b
-0, 1810019, 11300, 0x9943c076
-0, 1827940, 11300, 0xf898e583
-0, 1845861, 11300, 0x40f71f94
-0, 1863782, 11300, 0x5b604afb
-0, 1881703, 11300, 0x8c176af4
-0, 1899624, 11300, 0x0f1a6216
-0, 1917545, 11300, 0x38bbd13d
-0, 1935466, 11300, 0x90c8d1fc
-0, 1953387, 11300, 0x253000d7
-0, 1971308, 11300, 0xb94b03b1
-0, 1989229, 11300, 0xbc872268
-0, 2007150, 11300, 0xe77adb8c
-0, 2025071, 11300, 0xa38936b7
-0, 2042992, 11300, 0xd6153632
-0, 2060913, 11300, 0x1ae633cc
-0, 2078834, 11300, 0xb90c286e
-0, 2096755, 11300, 0xbc7e333d
-0, 2114676, 11300, 0x1b5421f8
-0, 2132597, 11300, 0xdde6506d
-0, 2150518, 11300, 0xd3eb757e
-0, 2168439, 11300, 0x5ad1929c
-0, 2186360, 11300, 0x4f6aa47d
-0, 2204281, 11300, 0xab3caf55
-0, 2222202, 11300, 0x5ff9b39a
-0, 2240123, 11300, 0x1454e12e
-0, 2258043, 11300, 0xf18216e8
-0, 2275964, 11300, 0x62144880
-0, 2293885, 11300, 0x54284241
-0, 2311806, 11300, 0x8e8c7228
-0, 2329727, 11300, 0xb498d06e
-0, 2347648, 11300, 0x7b1e6be1
-0, 2365569, 11300, 0x5e5ea1f4
-0, 2383490, 11300, 0x41eda28e
-0, 2401411, 11300, 0x7ba6aa92
-0, 2419332, 11300, 0xa8a8b1c7
-0, 2437253, 11300, 0x0d30bd08
-0, 2455174, 11300, 0xc610bf16
-0, 2473095, 11300, 0xed57c075
-0, 2491016, 11300, 0xb86dbfea
-0, 2508937, 11300, 0x0970c03d
-0, 2526858, 11300, 0x743ac2ac
-0, 2544779, 11300, 0x0a44c816
-0, 2562700, 11300, 0xe32acd6b
-0, 2580621, 11300, 0x209bcdab
-0, 2598542, 11300, 0x3cd0d105
-0, 2616463, 11300, 0xc0bcd330
-0, 2634384, 11300, 0x4785d6dc
-0, 2652305, 11300, 0xe85f9c90
-0, 2670226, 11300, 0xd4a72850
-0, 2688147, 11300, 0x04766e41
-0, 2706068, 11300, 0x04766e41
+#tb 0: 99561/500000
+0, 0, 0, 1, 11300, 0x46c78923
+0, 1, 1, 1, 11300, 0x3f2a1175
+0, 2, 2, 1, 11300, 0x722de221
+0, 3, 3, 1, 11300, 0x01746b88
+0, 4, 4, 1, 11300, 0x549587a7
+0, 5, 5, 1, 11300, 0x843ab943
+0, 6, 6, 1, 11300, 0x62fdee48
+0, 7, 7, 1, 11300, 0x74a62867
+0, 8, 8, 1, 11300, 0x35a20e2f
+0, 9, 9, 1, 11300, 0x4e9ef54d
+0, 10, 10, 1, 11300, 0xec7201f5
+0, 11, 11, 1, 11300, 0x363bfe27
+0, 12, 12, 1, 11300, 0x2aaab418
+0, 13, 13, 1, 11300, 0x6a48ab3f
+0, 14, 14, 1, 11300, 0x3fecea34
+0, 15, 15, 1, 11300, 0xa371f55e
+0, 16, 16, 1, 11300, 0xa86b147c
+0, 17, 17, 1, 11300, 0x49e9206e
+0, 18, 18, 1, 11300, 0x6c9a2155
+0, 19, 19, 1, 11300, 0x2c8a4798
+0, 20, 20, 1, 11300, 0x3485676c
+0, 21, 21, 1, 11300, 0xb0b293f2
+0, 22, 22, 1, 11300, 0xe4a9b068
+0, 23, 23, 1, 11300, 0xd68d0556
+0, 24, 24, 1, 11300, 0xc28e5193
+0, 25, 25, 1, 11300, 0xf6948483
+0, 26, 26, 1, 11300, 0xf21fbf57
+0, 27, 27, 1, 11300, 0x8345eb44
+0, 28, 28, 1, 11300, 0x8124f045
+0, 29, 29, 1, 11300, 0x18e31f10
+0, 30, 30, 1, 11300, 0xdb1943fc
+0, 31, 31, 1, 11300, 0x8701699f
+0, 32, 32, 1, 11300, 0xd7b18550
+0, 33, 33, 1, 11300, 0xa56faccc
+0, 34, 34, 1, 11300, 0xf8bcc17c
+0, 35, 35, 1, 11300, 0x446acab9
+0, 36, 36, 1, 11300, 0x755fd295
+0, 37, 37, 1, 11300, 0x92e3d100
+0, 38, 38, 1, 11300, 0x54895bb3
+0, 39, 39, 1, 11300, 0xd18bffda
+0, 40, 40, 1, 11300, 0x480dbe4f
+0, 41, 41, 1, 11300, 0x49ea9dbe
+0, 42, 42, 1, 11300, 0x00d3a003
+0, 43, 43, 1, 11300, 0xda7bbfb2
+0, 44, 44, 1, 11300, 0x9700d9c2
+0, 45, 45, 1, 11300, 0xa0a9e490
+0, 46, 46, 1, 11300, 0x00eb0979
+0, 47, 47, 1, 11300, 0x32b04630
+0, 48, 48, 1, 11300, 0xdfb73e51
+0, 49, 49, 1, 11300, 0x3d8e4f96
+0, 50, 50, 1, 11300, 0x2ca83271
+0, 51, 51, 1, 11300, 0xb5b123c0
+0, 52, 52, 1, 11300, 0x8a570e58
+0, 53, 53, 1, 11300, 0xc6c805bc
+0, 54, 54, 1, 11300, 0x27caf7a5
+0, 55, 55, 1, 11300, 0x5319ecb0
+0, 56, 56, 1, 11300, 0x5471e3fd
+0, 57, 57, 1, 11300, 0x6d68a6f4
+0, 58, 58, 1, 11300, 0x872b7194
+0, 59, 59, 1, 11300, 0x007c36bd
+0, 60, 60, 1, 11300, 0x2714f1b5
+0, 61, 61, 1, 11300, 0x6c8eb50f
+0, 62, 62, 1, 11300, 0xf5d57be8
+0, 63, 63, 1, 11300, 0x981f412b
+0, 64, 64, 1, 11300, 0x1a9804a1
+0, 65, 65, 1, 11300, 0xf0c1d24a
+0, 66, 66, 1, 11300, 0xa70a9d9b
+0, 67, 67, 1, 11300, 0x8c466876
+0, 68, 68, 1, 11300, 0xcf2e32df
+0, 69, 69, 1, 11300, 0xcb8cfebf
+0, 70, 70, 1, 11300, 0xb961ca99
+0, 71, 71, 1, 11300, 0x666d9619
+0, 72, 72, 1, 11300, 0x84bf5b55
+0, 73, 73, 1, 11300, 0xbfa22ccc
+0, 74, 74, 1, 11300, 0xcde41849
+0, 75, 75, 1, 11300, 0x71372dcd
+0, 76, 76, 1, 11300, 0x13402cfd
+0, 77, 77, 1, 11300, 0xdebdd321
+0, 78, 78, 1, 11300, 0xdda66de1
+0, 79, 79, 1, 11300, 0x7f4bb682
+0, 80, 80, 1, 11300, 0xf67fd528
+0, 81, 81, 1, 11300, 0xe739ff8c
+0, 82, 82, 1, 11300, 0x2e131774
+0, 83, 83, 1, 11300, 0xfa942811
+0, 84, 84, 1, 11300, 0x0cd93ac2
+0, 85, 85, 1, 11300, 0xd0445e0e
+0, 86, 86, 1, 11300, 0x3f3497c7
+0, 87, 87, 1, 11300, 0x11b5bd2c
+0, 88, 88, 1, 11300, 0xccd5e62a
+0, 89, 89, 1, 11300, 0xa9d4fcb5
+0, 90, 90, 1, 11300, 0x34aa1a03
+0, 91, 91, 1, 11300, 0x1ce6299e
+0, 92, 92, 1, 11300, 0x661c2745
+0, 93, 93, 1, 11300, 0x27d8a8b3
+0, 94, 94, 1, 11300, 0x9eb07467
+0, 95, 95, 1, 11300, 0x128374d2
+0, 96, 96, 1, 11300, 0x05c36ff5
+0, 97, 97, 1, 11300, 0x8a136bde
+0, 98, 98, 1, 11300, 0x15c47c99
+0, 99, 99, 1, 11300, 0xcc4a93f4
+0, 100, 100, 1, 11300, 0x19529b2b
+0, 101, 101, 1, 11300, 0x9943c076
+0, 102, 102, 1, 11300, 0xf898e583
+0, 103, 103, 1, 11300, 0x40f71f94
+0, 104, 104, 1, 11300, 0x5b604afb
+0, 105, 105, 1, 11300, 0x8c176af4
+0, 106, 106, 1, 11300, 0x0f1a6216
+0, 107, 107, 1, 11300, 0x38bbd13d
+0, 108, 108, 1, 11300, 0x90c8d1fc
+0, 109, 109, 1, 11300, 0x253000d7
+0, 110, 110, 1, 11300, 0xb94b03b1
+0, 111, 111, 1, 11300, 0xbc872268
+0, 112, 112, 1, 11300, 0xe77adb8c
+0, 113, 113, 1, 11300, 0xa38936b7
+0, 114, 114, 1, 11300, 0xd6153632
+0, 115, 115, 1, 11300, 0x1ae633cc
+0, 116, 116, 1, 11300, 0xb90c286e
+0, 117, 117, 1, 11300, 0xbc7e333d
+0, 118, 118, 1, 11300, 0x1b5421f8
+0, 119, 119, 1, 11300, 0xdde6506d
+0, 120, 120, 1, 11300, 0xd3eb757e
+0, 121, 121, 1, 11300, 0x5ad1929c
+0, 122, 122, 1, 11300, 0x4f6aa47d
+0, 123, 123, 1, 11300, 0xab3caf55
+0, 124, 124, 1, 11300, 0x5ff9b39a
+0, 125, 125, 1, 11300, 0x1454e12e
+0, 126, 126, 1, 11300, 0xf18216e8
+0, 127, 127, 1, 11300, 0x62144880
+0, 128, 128, 1, 11300, 0x54284241
+0, 129, 129, 1, 11300, 0x8e8c7228
+0, 130, 130, 1, 11300, 0xb498d06e
+0, 131, 131, 1, 11300, 0x7b1e6be1
+0, 132, 132, 1, 11300, 0x5e5ea1f4
+0, 133, 133, 1, 11300, 0x41eda28e
+0, 134, 134, 1, 11300, 0x7ba6aa92
+0, 135, 135, 1, 11300, 0xa8a8b1c7
+0, 136, 136, 1, 11300, 0x0d30bd08
+0, 137, 137, 1, 11300, 0xc610bf16
+0, 138, 138, 1, 11300, 0xed57c075
+0, 139, 139, 1, 11300, 0xb86dbfea
+0, 140, 140, 1, 11300, 0x0970c03d
+0, 141, 141, 1, 11300, 0x743ac2ac
+0, 142, 142, 1, 11300, 0x0a44c816
+0, 143, 143, 1, 11300, 0xe32acd6b
+0, 144, 144, 1, 11300, 0x209bcdab
+0, 145, 145, 1, 11300, 0x3cd0d105
+0, 146, 146, 1, 11300, 0xc0bcd330
+0, 147, 147, 1, 11300, 0x4785d6dc
+0, 148, 148, 1, 11300, 0xe85f9c90
+0, 149, 149, 1, 11300, 0xd4a72850
+0, 150, 150, 1, 11300, 0x04766e41
+0, 151, 151, 1, 11300, 0x04766e41
diff --git a/gst-libs/ext/libav/tests/ref/fate/cvid-palette b/gst-libs/ext/libav/tests/ref/fate/cvid-palette
index 6f6ba11..5fcbc51 100644
--- a/gst-libs/ext/libav/tests/ref/fate/cvid-palette
+++ b/gst-libs/ext/libav/tests/ref/fate/cvid-palette
@@ -1,56 +1,57 @@
-0, 0, 57600, 0x1f5c89b7
-0, 6006, 57600, 0xd2055aaf
-0, 12012, 57600, 0x22336052
-0, 18018, 57600, 0xf7135e2a
-0, 24024, 57600, 0xd9de126a
-0, 30030, 57600, 0xe5a9e1de
-0, 36036, 57600, 0x253f1702
-0, 42042, 57600, 0xcb8679c9
-0, 48048, 57600, 0x96cb5fa8
-0, 54054, 57600, 0xbe03528a
-0, 60060, 57600, 0x120a097d
-0, 66066, 57600, 0xaf562041
-0, 72072, 57600, 0x15b2d8c9
-0, 78078, 57600, 0x95f60e58
-0, 84084, 57600, 0x5ace5a6b
-0, 90090, 57600, 0x2f80b8e3
-0, 96096, 57600, 0x5c49c915
-0, 102102, 57600, 0xb91efe60
-0, 108108, 57600, 0xa80d29e8
-0, 114114, 57600, 0x6e72d03a
-0, 120120, 57600, 0x4f716a9e
-0, 126126, 57600, 0x3a43b9c9
-0, 132132, 57600, 0x65002db3
-0, 138138, 57600, 0x70edc765
-0, 144144, 57600, 0x9dc54abd
-0, 150150, 57600, 0xd17bda86
-0, 156156, 57600, 0xc5d2d458
-0, 162162, 57600, 0x32313c79
-0, 168168, 57600, 0x2e537e8d
-0, 174174, 57600, 0xe77d5d9e
-0, 180180, 57600, 0x9cc2599a
-0, 186186, 57600, 0x8a9be76e
-0, 192192, 57600, 0x47447eef
-0, 198198, 57600, 0xbf5f84fa
-0, 204204, 57600, 0xacd49c07
-0, 210210, 57600, 0xdc628975
-0, 216216, 57600, 0x97d7964e
-0, 222222, 57600, 0xd0a19b6b
-0, 228228, 57600, 0x5ea3d78c
-0, 234234, 57600, 0x39b59be0
-0, 240240, 57600, 0x6501a2d2
-0, 246246, 57600, 0x0ee7e36d
-0, 252252, 57600, 0x354ddd1d
-0, 258258, 57600, 0x9b8f22d3
-0, 264264, 57600, 0x0aadfb8c
-0, 270270, 57600, 0x322e2785
-0, 276276, 57600, 0x78a6467e
-0, 282282, 57600, 0x1757f3b1
-0, 288288, 57600, 0xe874ceb7
-0, 294294, 57600, 0xc40f9e4d
-0, 300300, 57600, 0x89f6a735
-0, 306306, 57600, 0xe3635393
-0, 312312, 57600, 0xdae585c7
-0, 318318, 57600, 0xf99baa60
-0, 324324, 57600, 0x28a8b1ee
-0, 330330, 57600, 0xcd5587f8
+#tb 0: 1/14985
+0, 0, 0, 0, 57600, 0x1f5c89b7
+0, 1000, 1000, 0, 57600, 0xd2055aaf
+0, 2000, 2000, 0, 57600, 0x22336052
+0, 3000, 3000, 0, 57600, 0xf7135e2a
+0, 4000, 4000, 0, 57600, 0xd9de126a
+0, 5000, 5000, 0, 57600, 0xe5a9e1de
+0, 6000, 6000, 0, 57600, 0x253f1702
+0, 7000, 7000, 0, 57600, 0xcb8679c9
+0, 8000, 8000, 0, 57600, 0x96cb5fa8
+0, 9000, 9000, 0, 57600, 0xbe03528a
+0, 10000, 10000, 0, 57600, 0x120a097d
+0, 11000, 11000, 0, 57600, 0xaf562041
+0, 12000, 12000, 0, 57600, 0x15b2d8c9
+0, 13000, 13000, 0, 57600, 0x95f60e58
+0, 14000, 14000, 0, 57600, 0x5ace5a6b
+0, 15000, 15000, 0, 57600, 0x2f80b8e3
+0, 16000, 16000, 0, 57600, 0x5c49c915
+0, 17000, 17000, 0, 57600, 0xb91efe60
+0, 18000, 18000, 0, 57600, 0xa80d29e8
+0, 19000, 19000, 0, 57600, 0x6e72d03a
+0, 20000, 20000, 0, 57600, 0x4f716a9e
+0, 21000, 21000, 0, 57600, 0x3a43b9c9
+0, 22000, 22000, 0, 57600, 0x65002db3
+0, 23000, 23000, 0, 57600, 0x70edc765
+0, 24000, 24000, 0, 57600, 0x9dc54abd
+0, 25000, 25000, 0, 57600, 0xd17bda86
+0, 26000, 26000, 0, 57600, 0xc5d2d458
+0, 27000, 27000, 0, 57600, 0x32313c79
+0, 28000, 28000, 0, 57600, 0x2e537e8d
+0, 29000, 29000, 0, 57600, 0xe77d5d9e
+0, 30000, 30000, 0, 57600, 0x9cc2599a
+0, 31000, 31000, 0, 57600, 0x8a9be76e
+0, 32000, 32000, 0, 57600, 0x47447eef
+0, 33000, 33000, 0, 57600, 0xbf5f84fa
+0, 34000, 34000, 0, 57600, 0xacd49c07
+0, 35000, 35000, 0, 57600, 0xdc628975
+0, 36000, 36000, 0, 57600, 0x97d7964e
+0, 37000, 37000, 0, 57600, 0xd0a19b6b
+0, 38000, 38000, 0, 57600, 0x5ea3d78c
+0, 39000, 39000, 0, 57600, 0x39b59be0
+0, 40000, 40000, 0, 57600, 0x6501a2d2
+0, 41000, 41000, 0, 57600, 0x0ee7e36d
+0, 42000, 42000, 0, 57600, 0x354ddd1d
+0, 43000, 43000, 0, 57600, 0x9b8f22d3
+0, 44000, 44000, 0, 57600, 0x0aadfb8c
+0, 45000, 45000, 0, 57600, 0x322e2785
+0, 46000, 46000, 0, 57600, 0x78a6467e
+0, 47000, 47000, 0, 57600, 0x1757f3b1
+0, 48000, 48000, 0, 57600, 0xe874ceb7
+0, 49000, 49000, 0, 57600, 0xc40f9e4d
+0, 50000, 50000, 0, 57600, 0x89f6a735
+0, 51000, 51000, 0, 57600, 0xe3635393
+0, 52000, 52000, 0, 57600, 0xdae585c7
+0, 53000, 53000, 0, 57600, 0xf99baa60
+0, 54000, 54000, 0, 57600, 0x28a8b1ee
+0, 55000, 55000, 0, 57600, 0xcd5587f8
diff --git a/gst-libs/ext/libav/tests/ref/fate/cvid-partial b/gst-libs/ext/libav/tests/ref/fate/cvid-partial
index d7ebe11..71596b4 100644
--- a/gst-libs/ext/libav/tests/ref/fate/cvid-partial
+++ b/gst-libs/ext/libav/tests/ref/fate/cvid-partial
@@ -1,78 +1,79 @@
-0, 0, 112400, 0x829180d8
-0, 7500, 112400, 0xdbebac5b
-0, 15000, 112400, 0xc5adc0f7
-0, 22500, 112400, 0xbe1fc030
-0, 30000, 112400, 0xe08ab460
-0, 37500, 112400, 0xfde0dbc5
-0, 45000, 112400, 0xed9242b0
-0, 52500, 112400, 0x1ae3933a
-0, 60000, 112400, 0xc82d2f5b
-0, 67500, 112400, 0xbae9ddfc
-0, 75000, 112400, 0xa350a1f7
-0, 82500, 112400, 0x3cf78029
-0, 90000, 112400, 0xaa0b82bf
-0, 97500, 112400, 0x71aa4794
-0, 105000, 112400, 0x2fe57373
-0, 112500, 112400, 0x429c6f82
-0, 120000, 112400, 0xfb2d917d
-0, 127500, 112400, 0xcc84cb9a
-0, 135000, 112400, 0xc68f0613
-0, 142500, 112400, 0x05f30e6a
-0, 150000, 112400, 0x5c5d853d
-0, 157500, 112400, 0x01e0aff2
-0, 165000, 112400, 0xc3b2cf4a
-0, 172500, 112400, 0xc0a3cf19
-0, 180000, 112400, 0xc743abda
-0, 187500, 112400, 0x54bd17a2
-0, 195000, 112400, 0x616ef28d
-0, 202500, 112400, 0x04b51f59
-0, 210000, 112400, 0x857511a2
-0, 217500, 112400, 0x25c62440
-0, 225000, 112400, 0x8c78198d
-0, 232500, 112400, 0xc046c912
-0, 240000, 112400, 0x0d828630
-0, 247500, 112400, 0x48999b80
-0, 255000, 112400, 0x9a869e77
-0, 262500, 112400, 0x16d893df
-0, 270000, 112400, 0xf6b86132
-0, 277500, 112400, 0xfa564ea4
-0, 285000, 112400, 0xdd473f69
-0, 292500, 112400, 0xf89625a6
-0, 300000, 112400, 0x823a58aa
-0, 307500, 112400, 0x25e0fe43
-0, 315000, 112400, 0x41034522
-0, 322500, 112400, 0xb8da4f00
-0, 330000, 112400, 0x9f684fce
-0, 337500, 112400, 0xf7188710
-0, 345000, 112400, 0x428fbfc6
-0, 352500, 112400, 0x535bace0
-0, 360000, 112400, 0x23216059
-0, 367500, 112400, 0x9b8bbfa6
-0, 375000, 112400, 0x932be522
-0, 382500, 112400, 0xdbd31409
-0, 390000, 112400, 0x0a69bf18
-0, 397500, 112400, 0xa15ef128
-0, 405000, 112400, 0x49a1fa92
-0, 412500, 112400, 0xadeeaf62
-0, 420000, 112400, 0xc1ce636e
-0, 427500, 112400, 0x5ca544eb
-0, 435000, 112400, 0x07230a36
-0, 442500, 112400, 0x12ae2b53
-0, 450000, 112400, 0x62453ef6
-0, 457500, 112400, 0xe0588a98
-0, 465000, 112400, 0xacd3927a
-0, 472500, 112400, 0x5d3c6b01
-0, 480000, 112400, 0xda671808
-0, 487500, 112400, 0x61d0b492
-0, 495000, 112400, 0x068b1293
-0, 502500, 112400, 0x75b99287
-0, 510000, 112400, 0xe657e7d6
-0, 517500, 112400, 0x17873df6
-0, 525000, 112400, 0xa8db5e31
-0, 532500, 112400, 0x4f633b8e
-0, 540000, 112400, 0x22266252
-0, 547500, 112400, 0x308a6282
-0, 555000, 112400, 0xfdb356ce
-0, 562500, 112400, 0xe4394f1f
-0, 570000, 112400, 0x8ca8649f
-0, 577500, 112400, 0x804d44eb
+#tb 0: 1/12
+0, 0, 0, 1, 112400, 0x829180d8
+0, 1, 1, 1, 112400, 0xdbebac5b
+0, 2, 2, 1, 112400, 0xc5adc0f7
+0, 3, 3, 1, 112400, 0xbe1fc030
+0, 4, 4, 1, 112400, 0xe08ab460
+0, 5, 5, 1, 112400, 0xfde0dbc5
+0, 6, 6, 1, 112400, 0xed9242b0
+0, 7, 7, 1, 112400, 0x1ae3933a
+0, 8, 8, 1, 112400, 0xc82d2f5b
+0, 9, 9, 1, 112400, 0xbae9ddfc
+0, 10, 10, 1, 112400, 0xa350a1f7
+0, 11, 11, 1, 112400, 0x3cf78029
+0, 12, 12, 1, 112400, 0xaa0b82bf
+0, 13, 13, 1, 112400, 0x71aa4794
+0, 14, 14, 1, 112400, 0x2fe57373
+0, 15, 15, 1, 112400, 0x429c6f82
+0, 16, 16, 1, 112400, 0xfb2d917d
+0, 17, 17, 1, 112400, 0xcc84cb9a
+0, 18, 18, 1, 112400, 0xc68f0613
+0, 19, 19, 1, 112400, 0x05f30e6a
+0, 20, 20, 1, 112400, 0x5c5d853d
+0, 21, 21, 1, 112400, 0x01e0aff2
+0, 22, 22, 1, 112400, 0xc3b2cf4a
+0, 23, 23, 1, 112400, 0xc0a3cf19
+0, 24, 24, 1, 112400, 0xc743abda
+0, 25, 25, 1, 112400, 0x54bd17a2
+0, 26, 26, 1, 112400, 0x616ef28d
+0, 27, 27, 1, 112400, 0x04b51f59
+0, 28, 28, 1, 112400, 0x857511a2
+0, 29, 29, 1, 112400, 0x25c62440
+0, 30, 30, 1, 112400, 0x8c78198d
+0, 31, 31, 1, 112400, 0xc046c912
+0, 32, 32, 1, 112400, 0x0d828630
+0, 33, 33, 1, 112400, 0x48999b80
+0, 34, 34, 1, 112400, 0x9a869e77
+0, 35, 35, 1, 112400, 0x16d893df
+0, 36, 36, 1, 112400, 0xf6b86132
+0, 37, 37, 1, 112400, 0xfa564ea4
+0, 38, 38, 1, 112400, 0xdd473f69
+0, 39, 39, 1, 112400, 0xf89625a6
+0, 40, 40, 1, 112400, 0x823a58aa
+0, 41, 41, 1, 112400, 0x25e0fe43
+0, 42, 42, 1, 112400, 0x41034522
+0, 43, 43, 1, 112400, 0xb8da4f00
+0, 44, 44, 1, 112400, 0x9f684fce
+0, 45, 45, 1, 112400, 0xf7188710
+0, 46, 46, 1, 112400, 0x428fbfc6
+0, 47, 47, 1, 112400, 0x535bace0
+0, 48, 48, 1, 112400, 0x23216059
+0, 49, 49, 1, 112400, 0x9b8bbfa6
+0, 50, 50, 1, 112400, 0x932be522
+0, 51, 51, 1, 112400, 0xdbd31409
+0, 52, 52, 1, 112400, 0x0a69bf18
+0, 53, 53, 1, 112400, 0xa15ef128
+0, 54, 54, 1, 112400, 0x49a1fa92
+0, 55, 55, 1, 112400, 0xadeeaf62
+0, 56, 56, 1, 112400, 0xc1ce636e
+0, 57, 57, 1, 112400, 0x5ca544eb
+0, 58, 58, 1, 112400, 0x07230a36
+0, 59, 59, 1, 112400, 0x12ae2b53
+0, 60, 60, 1, 112400, 0x62453ef6
+0, 61, 61, 1, 112400, 0xe0588a98
+0, 62, 62, 1, 112400, 0xacd3927a
+0, 63, 63, 1, 112400, 0x5d3c6b01
+0, 64, 64, 1, 112400, 0xda671808
+0, 65, 65, 1, 112400, 0x61d0b492
+0, 66, 66, 1, 112400, 0x068b1293
+0, 67, 67, 1, 112400, 0x75b99287
+0, 68, 68, 1, 112400, 0xe657e7d6
+0, 69, 69, 1, 112400, 0x17873df6
+0, 70, 70, 1, 112400, 0xa8db5e31
+0, 71, 71, 1, 112400, 0x4f633b8e
+0, 72, 72, 1, 112400, 0x22266252
+0, 73, 73, 1, 112400, 0x308a6282
+0, 74, 74, 1, 112400, 0xfdb356ce
+0, 75, 75, 1, 112400, 0xe4394f1f
+0, 76, 76, 1, 112400, 0x8ca8649f
+0, 77, 77, 1, 112400, 0x804d44eb
diff --git a/gst-libs/ext/libav/tests/ref/fate/cyberia-c93 b/gst-libs/ext/libav/tests/ref/fate/cyberia-c93
index a0dacb7..2c71e50 100644
--- a/gst-libs/ext/libav/tests/ref/fate/cyberia-c93
+++ b/gst-libs/ext/libav/tests/ref/fate/cyberia-c93
@@ -1,42 +1,44 @@
-0, 0, 184320, 0x8433f0f8
-1, 0, 28368, 0xaacc96a5
-0, 7200, 184320, 0xd0d480f7
-0, 14400, 184320, 0xaec85413
-0, 21600, 184320, 0x29d134dc
-0, 28800, 184320, 0xeac07175
-0, 36000, 184320, 0x21426b49
-0, 43200, 184320, 0xe500a37d
-0, 50400, 184320, 0x1d9cae21
-0, 57600, 184320, 0xda65309d
-0, 64800, 184320, 0xb64c331d
-0, 72000, 184320, 0xcb832741
-1, 79147, 28368, 0x6d1099bd
-0, 79200, 184320, 0xe573b565
-0, 86400, 184320, 0xa40c92d1
-0, 93600, 184320, 0x6d04ea3f
-0, 100800, 184320, 0xc438ae56
-0, 108000, 184320, 0xc6405523
-0, 115200, 184320, 0xaefef0b3
-0, 122400, 184320, 0x3e4526c6
-0, 129600, 184320, 0x2b164323
-0, 136800, 184320, 0x89b22193
-0, 144000, 184320, 0x3b73611b
-0, 151200, 184320, 0x42b33583
-1, 158294, 28368, 0x93033ae1
-0, 158400, 184320, 0x43e79dff
-0, 165600, 184320, 0xe389a377
-0, 172800, 184320, 0x09cb65f0
-0, 180000, 184320, 0x64b27755
-0, 187200, 184320, 0xdd25d6c6
-0, 194400, 184320, 0x082a80c9
-0, 201600, 184320, 0x41a8d7f4
-0, 208800, 184320, 0x6227d8d4
-0, 216000, 184320, 0x54975910
-0, 223200, 184320, 0xf4857db9
-0, 230400, 184320, 0x82d18161
-1, 237441, 28368, 0x9101e519
-0, 237600, 184320, 0x06d93bd0
-0, 244800, 184320, 0xa4304c00
-0, 252000, 184320, 0x5f77d9cd
-0, 259200, 184320, 0x95cb84e9
-0, 266400, 184320, 0x7c979475
+#tb 0: 2/25
+#tb 1: 1/16129
+0, 0, 0, 1, 184320, 0x8433f0f8
+1, 0, 0, 14184, 28368, 0xaacc96a5
+0, 1, 1, 1, 184320, 0xd0d480f7
+0, 2, 2, 1, 184320, 0xaec85413
+0, 3, 3, 1, 184320, 0x29d134dc
+0, 4, 4, 1, 184320, 0xeac07175
+0, 5, 5, 1, 184320, 0x21426b49
+0, 6, 6, 1, 184320, 0xe500a37d
+0, 7, 7, 1, 184320, 0x1d9cae21
+0, 8, 8, 1, 184320, 0xda65309d
+0, 9, 9, 1, 184320, 0xb64c331d
+0, 10, 10, 1, 184320, 0xcb832741
+1, 14184, 14184, 14184, 28368, 0x6d1099bd
+0, 11, 11, 1, 184320, 0xe573b565
+0, 12, 12, 1, 184320, 0xa40c92d1
+0, 13, 13, 1, 184320, 0x6d04ea3f
+0, 14, 14, 1, 184320, 0xc438ae56
+0, 15, 15, 1, 184320, 0xc6405523
+0, 16, 16, 1, 184320, 0xaefef0b3
+0, 17, 17, 1, 184320, 0x3e4526c6
+0, 18, 18, 1, 184320, 0x2b164323
+0, 19, 19, 1, 184320, 0x89b22193
+0, 20, 20, 1, 184320, 0x3b73611b
+0, 21, 21, 1, 184320, 0x42b33583
+1, 28368, 28368, 14184, 28368, 0x93033ae1
+0, 22, 22, 1, 184320, 0x43e79dff
+0, 23, 23, 1, 184320, 0xe389a377
+0, 24, 24, 1, 184320, 0x09cb65f0
+0, 25, 25, 1, 184320, 0x64b27755
+0, 26, 26, 1, 184320, 0xdd25d6c6
+0, 27, 27, 1, 184320, 0x082a80c9
+0, 28, 28, 1, 184320, 0x41a8d7f4
+0, 29, 29, 1, 184320, 0x6227d8d4
+0, 30, 30, 1, 184320, 0x54975910
+0, 31, 31, 1, 184320, 0xf4857db9
+0, 32, 32, 1, 184320, 0x82d18161
+1, 42552, 42552, 14184, 28368, 0x9101e519
+0, 33, 33, 1, 184320, 0x06d93bd0
+0, 34, 34, 1, 184320, 0xa4304c00
+0, 35, 35, 1, 184320, 0x5f77d9cd
+0, 36, 36, 1, 184320, 0x95cb84e9
+0, 37, 37, 1, 184320, 0x7c979475
diff --git a/gst-libs/ext/libav/tests/ref/fate/cyuv b/gst-libs/ext/libav/tests/ref/fate/cyuv
index f712323..37bdd2f 100644
--- a/gst-libs/ext/libav/tests/ref/fate/cyuv
+++ b/gst-libs/ext/libav/tests/ref/fate/cyuv
@@ -1,150 +1,151 @@
-0, 0, 38016, 0x501e6abe
-0, 3000, 38016, 0x84976f13
-0, 6000, 38016, 0x8c487acb
-0, 9000, 38016, 0x70998800
-0, 12000, 38016, 0x51ac9416
-0, 15000, 38016, 0xd1da94b7
-0, 18000, 38016, 0x52d691e8
-0, 21000, 38016, 0x3ca3907a
-0, 24000, 38016, 0x5f62929f
-0, 27000, 38016, 0x81ec98ac
-0, 30000, 38016, 0x72499f12
-0, 33000, 38016, 0x7598a716
-0, 36000, 38016, 0x38ada96f
-0, 39000, 38016, 0x78c8a727
-0, 42000, 38016, 0xe2d79d2d
-0, 45000, 38016, 0x84a2925a
-0, 48000, 38016, 0x131b8d70
-0, 50999, 38016, 0x32a78242
-0, 53999, 38016, 0x29f583e5
-0, 56999, 38016, 0x4a7f7305
-0, 59999, 38016, 0x80885f56
-0, 62999, 38016, 0xa73c4f61
-0, 65999, 38016, 0xe54d422b
-0, 68999, 38016, 0xa8c03188
-0, 71999, 38016, 0xa02a294e
-0, 74999, 38016, 0xc84e2366
-0, 77999, 38016, 0xe21112ca
-0, 80999, 38016, 0x3e450594
-0, 83999, 38016, 0x2499017c
-0, 86999, 38016, 0xecb1effa
-0, 89999, 38016, 0xa0f8eb28
-0, 92999, 38016, 0xa396e800
-0, 95999, 38016, 0xae1be010
-0, 98999, 38016, 0x4b41dff5
-0, 101999, 38016, 0x9172e319
-0, 104999, 38016, 0xb82ee262
-0, 107999, 38016, 0x151de59f
-0, 110999, 38016, 0x799deabd
-0, 113999, 38016, 0x008dee95
-0, 116999, 38016, 0x5ad502ce
-0, 119999, 38016, 0xdeb321f1
-0, 122999, 38016, 0x82734a09
-0, 125999, 38016, 0x1ccb6ddd
-0, 128999, 38016, 0x266584f0
-0, 131999, 38016, 0x46349e73
-0, 134999, 38016, 0x0b8cac83
-0, 137999, 38016, 0x7bcd9f49
-0, 140999, 38016, 0x4f5d7521
-0, 143999, 38016, 0x7709250c
-0, 146999, 38016, 0xf8eef5ad
-0, 149999, 38016, 0x2c5d28e3
-0, 152998, 38016, 0xdb116d69
-0, 155998, 38016, 0xb66c39d6
-0, 158998, 38016, 0xacecc966
-0, 161998, 38016, 0xaffd76af
-0, 164998, 38016, 0xd2b05d04
-0, 167998, 38016, 0x4d18582a
-0, 170998, 38016, 0x23635ca7
-0, 173998, 38016, 0x7ccc58f1
-0, 176998, 38016, 0xce9a4cc6
-0, 179998, 38016, 0xbeb259d3
-0, 182998, 38016, 0x0b28714c
-0, 185998, 38016, 0x642a8fdd
-0, 188998, 38016, 0x937bb589
-0, 191998, 38016, 0x1a48c407
-0, 194998, 38016, 0x8b44cd79
-0, 197998, 38016, 0xf35cde31
-0, 200998, 38016, 0xfc05fad9
-0, 203998, 38016, 0x44102111
-0, 206998, 38016, 0x832f5041
-0, 209998, 38016, 0x41177c71
-0, 212998, 38016, 0x723b88b5
-0, 215998, 38016, 0x05548f81
-0, 218998, 38016, 0xd9dd7995
-0, 221998, 38016, 0xed0d6226
-0, 224998, 38016, 0x458b5ce2
-0, 227998, 38016, 0xc7ef69af
-0, 230998, 38016, 0x936a7022
-0, 233998, 38016, 0x7a446c3d
-0, 236998, 38016, 0x9b2b73ee
-0, 239998, 38016, 0xa47779cd
-0, 242998, 38016, 0x7be47981
-0, 245998, 38016, 0x5d1778ac
-0, 248998, 38016, 0xf1f578fc
-0, 251997, 38016, 0x865b7edf
-0, 254997, 38016, 0x0a208252
-0, 257997, 38016, 0x22f07570
-0, 260997, 38016, 0x93036cef
-0, 263997, 38016, 0xa04b6120
-0, 266997, 38016, 0x80b249fe
-0, 269997, 38016, 0x5fe5317e
-0, 272997, 38016, 0x75bd0770
-0, 275997, 38016, 0x0607da6e
-0, 278997, 38016, 0x11cbb3a7
-0, 281997, 38016, 0xbb8b9335
-0, 284997, 38016, 0xa2bc75d9
-0, 287997, 38016, 0x58c160dd
-0, 290997, 38016, 0x742b55dc
-0, 293997, 38016, 0x62b24540
-0, 296997, 38016, 0x14f4381b
-0, 299997, 38016, 0x6494334d
-0, 302997, 38016, 0xb3772676
-0, 305997, 38016, 0x0c312715
-0, 308997, 38016, 0x8b401fc9
-0, 311997, 38016, 0xa851125a
-0, 314997, 38016, 0x3171092b
-0, 317997, 38016, 0x5c3603aa
-0, 320997, 38016, 0xab56fc95
-0, 323997, 38016, 0x5c76fcb5
-0, 326997, 38016, 0xbf13f3b4
-0, 329997, 38016, 0xbdb5ed1b
-0, 332997, 38016, 0xb511ea7c
-0, 335997, 38016, 0xec84df90
-0, 338997, 38016, 0x69aed672
-0, 341997, 38016, 0x72a6d334
-0, 344997, 38016, 0x7ec5c6a7
-0, 347997, 38016, 0x837abc3e
-0, 350996, 38016, 0x5ef7be01
-0, 353996, 38016, 0x173bb950
-0, 356996, 38016, 0xf572ab31
-0, 359996, 38016, 0xe704a2d9
-0, 362996, 38016, 0x26359bb5
-0, 365996, 38016, 0x00868e2d
-0, 368996, 38016, 0x72ef879e
-0, 371996, 38016, 0x510b7b07
-0, 374996, 38016, 0x947876ff
-0, 377996, 38016, 0x934073a7
-0, 380996, 38016, 0xf7c36a15
-0, 383996, 38016, 0xbcc86424
-0, 386996, 38016, 0x55b65fb0
-0, 389996, 38016, 0x6c4b5c4e
-0, 392996, 38016, 0xb315557a
-0, 395996, 38016, 0x154f503e
-0, 398996, 38016, 0x7abd44da
-0, 401996, 38016, 0x291940c6
-0, 404996, 38016, 0xc2264202
-0, 407996, 38016, 0xbd703e12
-0, 410996, 38016, 0x39193a9c
-0, 413996, 38016, 0x086637de
-0, 416996, 38016, 0x494c3be2
-0, 419996, 38016, 0x2d523e06
-0, 422996, 38016, 0x3843448a
-0, 425996, 38016, 0x307f4bd3
-0, 428996, 38016, 0xee074e3f
-0, 431996, 38016, 0x760d534a
-0, 434996, 38016, 0xbfa251cc
-0, 437996, 38016, 0x49094e22
-0, 440996, 38016, 0xda6a4f16
-0, 443996, 38016, 0xa3304fd5
-0, 446996, 38016, 0x99995068
+#tb 0: 33333/1000000
+0, 0, 0, 1, 38016, 0x501e6abe
+0, 1, 1, 1, 38016, 0x84976f13
+0, 2, 2, 1, 38016, 0x8c487acb
+0, 3, 3, 1, 38016, 0x70998800
+0, 4, 4, 1, 38016, 0x51ac9416
+0, 5, 5, 1, 38016, 0xd1da94b7
+0, 6, 6, 1, 38016, 0x52d691e8
+0, 7, 7, 1, 38016, 0x3ca3907a
+0, 8, 8, 1, 38016, 0x5f62929f
+0, 9, 9, 1, 38016, 0x81ec98ac
+0, 10, 10, 1, 38016, 0x72499f12
+0, 11, 11, 1, 38016, 0x7598a716
+0, 12, 12, 1, 38016, 0x38ada96f
+0, 13, 13, 1, 38016, 0x78c8a727
+0, 14, 14, 1, 38016, 0xe2d79d2d
+0, 15, 15, 1, 38016, 0x84a2925a
+0, 16, 16, 1, 38016, 0x131b8d70
+0, 17, 17, 1, 38016, 0x32a78242
+0, 18, 18, 1, 38016, 0x29f583e5
+0, 19, 19, 1, 38016, 0x4a7f7305
+0, 20, 20, 1, 38016, 0x80885f56
+0, 21, 21, 1, 38016, 0xa73c4f61
+0, 22, 22, 1, 38016, 0xe54d422b
+0, 23, 23, 1, 38016, 0xa8c03188
+0, 24, 24, 1, 38016, 0xa02a294e
+0, 25, 25, 1, 38016, 0xc84e2366
+0, 26, 26, 1, 38016, 0xe21112ca
+0, 27, 27, 1, 38016, 0x3e450594
+0, 28, 28, 1, 38016, 0x2499017c
+0, 29, 29, 1, 38016, 0xecb1effa
+0, 30, 30, 1, 38016, 0xa0f8eb28
+0, 31, 31, 1, 38016, 0xa396e800
+0, 32, 32, 1, 38016, 0xae1be010
+0, 33, 33, 1, 38016, 0x4b41dff5
+0, 34, 34, 1, 38016, 0x9172e319
+0, 35, 35, 1, 38016, 0xb82ee262
+0, 36, 36, 1, 38016, 0x151de59f
+0, 37, 37, 1, 38016, 0x799deabd
+0, 38, 38, 1, 38016, 0x008dee95
+0, 39, 39, 1, 38016, 0x5ad502ce
+0, 40, 40, 1, 38016, 0xdeb321f1
+0, 41, 41, 1, 38016, 0x82734a09
+0, 42, 42, 1, 38016, 0x1ccb6ddd
+0, 43, 43, 1, 38016, 0x266584f0
+0, 44, 44, 1, 38016, 0x46349e73
+0, 45, 45, 1, 38016, 0x0b8cac83
+0, 46, 46, 1, 38016, 0x7bcd9f49
+0, 47, 47, 1, 38016, 0x4f5d7521
+0, 48, 48, 1, 38016, 0x7709250c
+0, 49, 49, 1, 38016, 0xf8eef5ad
+0, 50, 50, 1, 38016, 0x2c5d28e3
+0, 51, 51, 1, 38016, 0xdb116d69
+0, 52, 52, 1, 38016, 0xb66c39d6
+0, 53, 53, 1, 38016, 0xacecc966
+0, 54, 54, 1, 38016, 0xaffd76af
+0, 55, 55, 1, 38016, 0xd2b05d04
+0, 56, 56, 1, 38016, 0x4d18582a
+0, 57, 57, 1, 38016, 0x23635ca7
+0, 58, 58, 1, 38016, 0x7ccc58f1
+0, 59, 59, 1, 38016, 0xce9a4cc6
+0, 60, 60, 1, 38016, 0xbeb259d3
+0, 61, 61, 1, 38016, 0x0b28714c
+0, 62, 62, 1, 38016, 0x642a8fdd
+0, 63, 63, 1, 38016, 0x937bb589
+0, 64, 64, 1, 38016, 0x1a48c407
+0, 65, 65, 1, 38016, 0x8b44cd79
+0, 66, 66, 1, 38016, 0xf35cde31
+0, 67, 67, 1, 38016, 0xfc05fad9
+0, 68, 68, 1, 38016, 0x44102111
+0, 69, 69, 1, 38016, 0x832f5041
+0, 70, 70, 1, 38016, 0x41177c71
+0, 71, 71, 1, 38016, 0x723b88b5
+0, 72, 72, 1, 38016, 0x05548f81
+0, 73, 73, 1, 38016, 0xd9dd7995
+0, 74, 74, 1, 38016, 0xed0d6226
+0, 75, 75, 1, 38016, 0x458b5ce2
+0, 76, 76, 1, 38016, 0xc7ef69af
+0, 77, 77, 1, 38016, 0x936a7022
+0, 78, 78, 1, 38016, 0x7a446c3d
+0, 79, 79, 1, 38016, 0x9b2b73ee
+0, 80, 80, 1, 38016, 0xa47779cd
+0, 81, 81, 1, 38016, 0x7be47981
+0, 82, 82, 1, 38016, 0x5d1778ac
+0, 83, 83, 1, 38016, 0xf1f578fc
+0, 84, 84, 1, 38016, 0x865b7edf
+0, 85, 85, 1, 38016, 0x0a208252
+0, 86, 86, 1, 38016, 0x22f07570
+0, 87, 87, 1, 38016, 0x93036cef
+0, 88, 88, 1, 38016, 0xa04b6120
+0, 89, 89, 1, 38016, 0x80b249fe
+0, 90, 90, 1, 38016, 0x5fe5317e
+0, 91, 91, 1, 38016, 0x75bd0770
+0, 92, 92, 1, 38016, 0x0607da6e
+0, 93, 93, 1, 38016, 0x11cbb3a7
+0, 94, 94, 1, 38016, 0xbb8b9335
+0, 95, 95, 1, 38016, 0xa2bc75d9
+0, 96, 96, 1, 38016, 0x58c160dd
+0, 97, 97, 1, 38016, 0x742b55dc
+0, 98, 98, 1, 38016, 0x62b24540
+0, 99, 99, 1, 38016, 0x14f4381b
+0, 100, 100, 1, 38016, 0x6494334d
+0, 101, 101, 1, 38016, 0xb3772676
+0, 102, 102, 1, 38016, 0x0c312715
+0, 103, 103, 1, 38016, 0x8b401fc9
+0, 104, 104, 1, 38016, 0xa851125a
+0, 105, 105, 1, 38016, 0x3171092b
+0, 106, 106, 1, 38016, 0x5c3603aa
+0, 107, 107, 1, 38016, 0xab56fc95
+0, 108, 108, 1, 38016, 0x5c76fcb5
+0, 109, 109, 1, 38016, 0xbf13f3b4
+0, 110, 110, 1, 38016, 0xbdb5ed1b
+0, 111, 111, 1, 38016, 0xb511ea7c
+0, 112, 112, 1, 38016, 0xec84df90
+0, 113, 113, 1, 38016, 0x69aed672
+0, 114, 114, 1, 38016, 0x72a6d334
+0, 115, 115, 1, 38016, 0x7ec5c6a7
+0, 116, 116, 1, 38016, 0x837abc3e
+0, 117, 117, 1, 38016, 0x5ef7be01
+0, 118, 118, 1, 38016, 0x173bb950
+0, 119, 119, 1, 38016, 0xf572ab31
+0, 120, 120, 1, 38016, 0xe704a2d9
+0, 121, 121, 1, 38016, 0x26359bb5
+0, 122, 122, 1, 38016, 0x00868e2d
+0, 123, 123, 1, 38016, 0x72ef879e
+0, 124, 124, 1, 38016, 0x510b7b07
+0, 125, 125, 1, 38016, 0x947876ff
+0, 126, 126, 1, 38016, 0x934073a7
+0, 127, 127, 1, 38016, 0xf7c36a15
+0, 128, 128, 1, 38016, 0xbcc86424
+0, 129, 129, 1, 38016, 0x55b65fb0
+0, 130, 130, 1, 38016, 0x6c4b5c4e
+0, 131, 131, 1, 38016, 0xb315557a
+0, 132, 132, 1, 38016, 0x154f503e
+0, 133, 133, 1, 38016, 0x7abd44da
+0, 134, 134, 1, 38016, 0x291940c6
+0, 135, 135, 1, 38016, 0xc2264202
+0, 136, 136, 1, 38016, 0xbd703e12
+0, 137, 137, 1, 38016, 0x39193a9c
+0, 138, 138, 1, 38016, 0x086637de
+0, 139, 139, 1, 38016, 0x494c3be2
+0, 140, 140, 1, 38016, 0x2d523e06
+0, 141, 141, 1, 38016, 0x3843448a
+0, 142, 142, 1, 38016, 0x307f4bd3
+0, 143, 143, 1, 38016, 0xee074e3f
+0, 144, 144, 1, 38016, 0x760d534a
+0, 145, 145, 1, 38016, 0xbfa251cc
+0, 146, 146, 1, 38016, 0x49094e22
+0, 147, 147, 1, 38016, 0xda6a4f16
+0, 148, 148, 1, 38016, 0xa3304fd5
+0, 149, 149, 1, 38016, 0x99995068
diff --git a/gst-libs/ext/libav/tests/ref/fate/d-cinema-demux b/gst-libs/ext/libav/tests/ref/fate/d-cinema-demux
index 169f54f..f663040 100644
--- a/gst-libs/ext/libav/tests/ref/fate/d-cinema-demux
+++ b/gst-libs/ext/libav/tests/ref/fate/d-cinema-demux
@@ -1,4 +1,5 @@
-0, 0, 36000, 0xd592781d
-0, 1875, 36000, 0xd592781d
-0, 3750, 36000, 0xd592781d
-0, 5625, 23056, 0xde81f0d6
+#tb 0: 1/90000
+0, 0, 0, 1875, 36000, 0xd592781d
+0, 1875, 1875, 1875, 36000, 0xd592781d
+0, 3750, 3750, 1875, 36000, 0xd592781d
+0, 5625, 5625, 1200, 23056, 0xde81f0d6
diff --git a/gst-libs/ext/libav/tests/ref/fate/dcinema-encode b/gst-libs/ext/libav/tests/ref/fate/dcinema-encode
new file mode 100644
index 0000000..8aeb215
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/dcinema-encode
@@ -0,0 +1 @@
+MD5=2d7c6897c315493647db159f4bfd6edc
diff --git a/gst-libs/ext/libav/tests/ref/fate/delphine-cin b/gst-libs/ext/libav/tests/ref/fate/delphine-cin
deleted file mode 100644
index c8894d1..0000000
--- a/gst-libs/ext/libav/tests/ref/fate/delphine-cin
+++ /dev/null
@@ -1,183 +0,0 @@
-0, 0, 153600, 0x00000000
-1, 0, 176448, 0x541ddc55
-0, 7500, 153600, 0x9c77862c
-0, 15000, 153600, 0xd487c33c
-0, 22500, 153600, 0x5c00c01c
-0, 30000, 153600, 0x5496c2a2
-0, 37500, 153600, 0x858ac5c0
-0, 45000, 153600, 0xe32fc7d9
-0, 52500, 153600, 0xabffc965
-0, 60000, 153600, 0x4171c8e7
-0, 67500, 153600, 0xaec4ca90
-0, 75000, 153600, 0x3cb4cb5d
-0, 82500, 153600, 0x3aedcdc0
-0, 90000, 153600, 0x0fa4cf55
-0, 97500, 153600, 0x66a1d146
-0, 105000, 153600, 0x3828d3ad
-0, 112500, 153600, 0x73ccd7a4
-0, 120000, 153600, 0xb815d983
-0, 127500, 153600, 0x11a5a54f
-0, 135000, 153600, 0x337d8bff
-0, 142500, 153600, 0x0a1c8e5c
-0, 150000, 153600, 0x09648a57
-0, 157500, 153600, 0xf7398ba4
-0, 165000, 153600, 0x836d8aaf
-0, 172500, 153600, 0x4ee385bf
-0, 180000, 153600, 0xacf2c4d6
-0, 187500, 153600, 0x0610f426
-0, 195000, 153600, 0xb798e4a1
-0, 202500, 153600, 0xdaabe17e
-0, 210000, 153600, 0x7b82def5
-0, 217500, 153600, 0x56afe483
-0, 225000, 153600, 0x4640acef
-0, 232500, 153600, 0x4415f46c
-0, 240000, 153600, 0x258d01d0
-0, 247500, 153600, 0x18a55ba1
-0, 255000, 153600, 0x165a7173
-0, 262500, 153600, 0xfa8a438b
-0, 270000, 153600, 0x57083a34
-0, 277500, 153600, 0xb39923cd
-0, 285000, 153600, 0x3e32fd70
-0, 292500, 153600, 0xa7e9eb7f
-0, 300000, 153600, 0x8c20ed88
-0, 307500, 153600, 0x8c9bed27
-0, 315000, 153600, 0xc79af188
-0, 322500, 153600, 0x3bda00c8
-0, 330000, 153600, 0x03f837a7
-0, 337500, 153600, 0x550b83e3
-0, 345000, 153600, 0xc0bc6080
-0, 352500, 153600, 0xb8d968ed
-0, 360000, 153600, 0x893e2348
-1, 360098, 3676, 0xaf455081
-0, 367500, 153600, 0x6cd01834
-1, 367600, 3676, 0x27ef4e91
-0, 375000, 153600, 0x9e6926c5
-1, 375102, 3676, 0xd1d986a3
-0, 382500, 153600, 0x4b57a4ea
-1, 382604, 3676, 0xaaa2b589
-0, 390000, 153600, 0xaab2cfcd
-1, 390106, 3676, 0x6e794ff9
-0, 397500, 153600, 0xffbb334d
-1, 397608, 3676, 0x266351f1
-0, 405000, 153600, 0x4b37e5a9
-1, 405110, 3676, 0xdeae50b2
-0, 412500, 153600, 0x3486dee0
-1, 412612, 3676, 0x90f1f96a
-0, 420000, 153600, 0xa7185454
-1, 420114, 3676, 0xea07adf9
-0, 427500, 153600, 0xec29b8c2
-1, 427616, 3676, 0xb80a8925
-0, 435000, 153600, 0x01e562ba
-1, 435118, 3676, 0xc392a1da
-0, 442500, 153600, 0xe695cda3
-1, 442620, 3676, 0xa076bdda
-0, 450000, 153600, 0xf6b59dac
-1, 450122, 3676, 0x8f40b4cc
-0, 457500, 153600, 0xb308206b
-1, 457624, 3676, 0x4227fe30
-0, 465000, 153600, 0xcc6ede4a
-1, 465127, 3676, 0x82b31ec8
-0, 472500, 153600, 0xd9f8071c
-1, 472629, 3676, 0x3ba04042
-0, 480000, 153600, 0xfb434821
-1, 480131, 3676, 0x6fe7440a
-0, 487500, 153600, 0x84c97077
-1, 487633, 3676, 0x23e33177
-0, 495000, 153600, 0x82dc5217
-1, 495135, 3676, 0x1f14242c
-0, 502500, 153600, 0xdbfd0ba8
-1, 502637, 3676, 0x72931fb0
-0, 510000, 153600, 0x3d71058e
-1, 510139, 3676, 0x2b1351c2
-0, 517500, 153600, 0x3027b928
-1, 517641, 3676, 0x6aee7070
-0, 525000, 153600, 0x792ae3bd
-1, 525143, 3676, 0x237658fa
-0, 532500, 153600, 0x36db00a7
-1, 532645, 3676, 0xac001143
-0, 540000, 153600, 0x4484e720
-1, 540147, 3676, 0x1921ee21
-0, 547500, 153600, 0xfaa76cdc
-1, 547649, 3676, 0x80186091
-0, 555000, 153600, 0x9f1e4c7e
-1, 555151, 3676, 0xb7f37ede
-0, 562500, 153600, 0x4b545d88
-1, 562653, 3676, 0x355227ef
-0, 570000, 153600, 0xa11cfd15
-1, 570155, 3676, 0xb0411f35
-0, 577500, 153600, 0x9f5d49c4
-1, 577657, 3676, 0xe7c4fe0e
-0, 585000, 153600, 0x7a496740
-1, 585159, 3676, 0x0425984d
-0, 592500, 153600, 0x98477803
-1, 592661, 3676, 0xfd59dea1
-0, 600000, 153600, 0xa5fc20f8
-1, 600163, 3676, 0xa53d5aab
-0, 607500, 153600, 0x344ff96e
-1, 607665, 3676, 0x8bc403c2
-0, 615000, 153600, 0x20c91746
-1, 615167, 3676, 0x7dd638c2
-0, 622500, 153600, 0x7c59b379
-1, 622669, 3676, 0x284913eb
-0, 630000, 153600, 0x38e3b86d
-1, 630171, 3676, 0xec17e83c
-0, 637500, 153600, 0xff25a440
-1, 637673, 3676, 0x40543463
-0, 645000, 153600, 0xa1f66533
-1, 645176, 3676, 0x92d81bf8
-0, 652500, 153600, 0xe136260a
-1, 652678, 3676, 0x44ef161d
-0, 660000, 153600, 0x048ccf56
-1, 660180, 3676, 0x499df3d5
-0, 667500, 153600, 0x65f68a24
-1, 667682, 3676, 0xf98f4d75
-0, 675000, 153600, 0xf32b385a
-1, 675184, 3676, 0x8ffe2681
-0, 682500, 153600, 0x3e930a8f
-1, 682686, 3676, 0x84093bfd
-1, 690188, 3676, 0x5f9c2e32
-1, 697690, 3676, 0x8f93c29b
-1, 705192, 3676, 0xf0ada687
-1, 712694, 3676, 0x30019db2
-1, 720196, 3676, 0x06ebace3
-1, 727698, 3676, 0xc293d944
-1, 735200, 3676, 0x789ff65e
-1, 742702, 3676, 0xa2ae13c1
-1, 750204, 3676, 0xb64f1cd9
-1, 757706, 3676, 0x18f4e36a
-1, 765208, 3676, 0xe9ccd0f0
-1, 772710, 3676, 0xc215b4ab
-1, 780212, 3676, 0x45b5c410
-1, 787714, 3676, 0xf84a9939
-1, 795216, 3676, 0xc8aff71e
-1, 802718, 3676, 0x76cc3afc
-1, 810220, 3676, 0x524e1dd6
-1, 817722, 3676, 0x115a3f10
-1, 825224, 3676, 0xd2bb51d1
-1, 832727, 3676, 0xe1dbfca5
-1, 840229, 3676, 0xc428f070
-1, 847731, 3676, 0x6aa4dddf
-1, 855233, 3676, 0xa0428f08
-1, 862735, 3676, 0x8fd7e256
-1, 870237, 3676, 0x41cb1787
-1, 877739, 3676, 0xe348568e
-1, 885241, 3676, 0x79091a0c
-1, 892743, 3676, 0x592f6f2e
-1, 900245, 3676, 0xa151448f
-1, 907747, 3676, 0xb3402e7a
-1, 915249, 3676, 0x74112e27
-1, 922751, 3676, 0xba090659
-1, 930253, 3676, 0xa0451f81
-1, 937755, 3676, 0x09c7393a
-1, 945257, 3676, 0xceb4e340
-1, 952759, 3676, 0x0440291a
-1, 960261, 3676, 0xb7b930c4
-1, 967763, 3676, 0x1a2afa4a
-1, 975265, 3676, 0x414fee56
-1, 982767, 3676, 0x5e26bc97
-1, 990269, 3676, 0x780e0481
-1, 997771, 3676, 0xb6dfb9c5
-1, 1005273, 3676, 0x447b36ca
-1, 1012776, 3676, 0x601c3067
-1, 1020278, 3676, 0x199f2f8d
-1, 1027780, 3676, 0x98645b08
diff --git a/gst-libs/ext/libav/tests/ref/fate/delphine-cin-audio b/gst-libs/ext/libav/tests/ref/fate/delphine-cin-audio
new file mode 100644
index 0000000..1a94a6b
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/delphine-cin-audio
@@ -0,0 +1,92 @@
+#tb 0: 1/22050
+0, 0, 0, 88224, 176448, 0x541ddc55
+0, 88224, 88224, 1838, 3676, 0xaf455081
+0, 90062, 90062, 1838, 3676, 0x27ef4e91
+0, 91900, 91900, 1838, 3676, 0xd1d986a3
+0, 93738, 93738, 1838, 3676, 0xaaa2b589
+0, 95576, 95576, 1838, 3676, 0x6e794ff9
+0, 97414, 97414, 1838, 3676, 0x266351f1
+0, 99252, 99252, 1838, 3676, 0xdeae50b2
+0, 101090, 101090, 1838, 3676, 0x90f1f96a
+0, 102928, 102928, 1838, 3676, 0xea07adf9
+0, 104766, 104766, 1838, 3676, 0xb80a8925
+0, 106604, 106604, 1838, 3676, 0xc392a1da
+0, 108442, 108442, 1838, 3676, 0xa076bdda
+0, 110280, 110280, 1838, 3676, 0x8f40b4cc
+0, 112118, 112118, 1838, 3676, 0x4227fe30
+0, 113956, 113956, 1838, 3676, 0x82b31ec8
+0, 115794, 115794, 1838, 3676, 0x3ba04042
+0, 117632, 117632, 1838, 3676, 0x6fe7440a
+0, 119470, 119470, 1838, 3676, 0x23e33177
+0, 121308, 121308, 1838, 3676, 0x1f14242c
+0, 123146, 123146, 1838, 3676, 0x72931fb0
+0, 124984, 124984, 1838, 3676, 0x2b1351c2
+0, 126822, 126822, 1838, 3676, 0x6aee7070
+0, 128660, 128660, 1838, 3676, 0x237658fa
+0, 130498, 130498, 1838, 3676, 0xac001143
+0, 132336, 132336, 1838, 3676, 0x1921ee21
+0, 134174, 134174, 1838, 3676, 0x80186091
+0, 136012, 136012, 1838, 3676, 0xb7f37ede
+0, 137850, 137850, 1838, 3676, 0x355227ef
+0, 139688, 139688, 1838, 3676, 0xb0411f35
+0, 141526, 141526, 1838, 3676, 0xe7c4fe0e
+0, 143364, 143364, 1838, 3676, 0x0425984d
+0, 145202, 145202, 1838, 3676, 0xfd59dea1
+0, 147040, 147040, 1838, 3676, 0xa53d5aab
+0, 148878, 148878, 1838, 3676, 0x8bc403c2
+0, 150716, 150716, 1838, 3676, 0x7dd638c2
+0, 152554, 152554, 1838, 3676, 0x284913eb
+0, 154392, 154392, 1838, 3676, 0xec17e83c
+0, 156230, 156230, 1838, 3676, 0x40543463
+0, 158068, 158068, 1838, 3676, 0x92d81bf8
+0, 159906, 159906, 1838, 3676, 0x44ef161d
+0, 161744, 161744, 1838, 3676, 0x499df3d5
+0, 163582, 163582, 1838, 3676, 0xf98f4d75
+0, 165420, 165420, 1838, 3676, 0x8ffe2681
+0, 167258, 167258, 1838, 3676, 0x84093bfd
+0, 169096, 169096, 1838, 3676, 0x5f9c2e32
+0, 170934, 170934, 1838, 3676, 0x8f93c29b
+0, 172772, 172772, 1838, 3676, 0xf0ada687
+0, 174610, 174610, 1838, 3676, 0x30019db2
+0, 176448, 176448, 1838, 3676, 0x06ebace3
+0, 178286, 178286, 1838, 3676, 0xc293d944
+0, 180124, 180124, 1838, 3676, 0x789ff65e
+0, 181962, 181962, 1838, 3676, 0xa2ae13c1
+0, 183800, 183800, 1838, 3676, 0xb64f1cd9
+0, 185638, 185638, 1838, 3676, 0x18f4e36a
+0, 187476, 187476, 1838, 3676, 0xe9ccd0f0
+0, 189314, 189314, 1838, 3676, 0xc215b4ab
+0, 191152, 191152, 1838, 3676, 0x45b5c410
+0, 192990, 192990, 1838, 3676, 0xf84a9939
+0, 194828, 194828, 1838, 3676, 0xc8aff71e
+0, 196666, 196666, 1838, 3676, 0x76cc3afc
+0, 198504, 198504, 1838, 3676, 0x524e1dd6
+0, 200342, 200342, 1838, 3676, 0x115a3f10
+0, 202180, 202180, 1838, 3676, 0xd2bb51d1
+0, 204018, 204018, 1838, 3676, 0xe1dbfca5
+0, 205856, 205856, 1838, 3676, 0xc428f070
+0, 207694, 207694, 1838, 3676, 0x6aa4dddf
+0, 209532, 209532, 1838, 3676, 0xa0428f08
+0, 211370, 211370, 1838, 3676, 0x8fd7e256
+0, 213208, 213208, 1838, 3676, 0x41cb1787
+0, 215046, 215046, 1838, 3676, 0xe348568e
+0, 216884, 216884, 1838, 3676, 0x79091a0c
+0, 218722, 218722, 1838, 3676, 0x592f6f2e
+0, 220560, 220560, 1838, 3676, 0xa151448f
+0, 222398, 222398, 1838, 3676, 0xb3402e7a
+0, 224236, 224236, 1838, 3676, 0x74112e27
+0, 226074, 226074, 1838, 3676, 0xba090659
+0, 227912, 227912, 1838, 3676, 0xa0451f81
+0, 229750, 229750, 1838, 3676, 0x09c7393a
+0, 231588, 231588, 1838, 3676, 0xceb4e340
+0, 233426, 233426, 1838, 3676, 0x0440291a
+0, 235264, 235264, 1838, 3676, 0xb7b930c4
+0, 237102, 237102, 1838, 3676, 0x1a2afa4a
+0, 238940, 238940, 1838, 3676, 0x414fee56
+0, 240778, 240778, 1838, 3676, 0x5e26bc97
+0, 242616, 242616, 1838, 3676, 0x780e0481
+0, 244454, 244454, 1838, 3676, 0xb6dfb9c5
+0, 246292, 246292, 1838, 3676, 0x447b36ca
+0, 248130, 248130, 1838, 3676, 0x601c3067
+0, 249968, 249968, 1838, 3676, 0x199f2f8d
+0, 251806, 251806, 1838, 3676, 0x98645b08
diff --git a/gst-libs/ext/libav/tests/ref/fate/delphine-cin-video b/gst-libs/ext/libav/tests/ref/fate/delphine-cin-video
new file mode 100644
index 0000000..feaea26
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/delphine-cin-video
@@ -0,0 +1,93 @@
+#tb 0: 1/12
+0, 0, 0, 1, 153600, 0x00000000
+0, 1, 1, 1, 153600, 0x9c77862c
+0, 2, 2, 1, 153600, 0xd487c33c
+0, 3, 3, 1, 153600, 0x5c00c01c
+0, 4, 4, 1, 153600, 0x5496c2a2
+0, 5, 5, 1, 153600, 0x858ac5c0
+0, 6, 6, 1, 153600, 0xe32fc7d9
+0, 7, 7, 1, 153600, 0xabffc965
+0, 8, 8, 1, 153600, 0x4171c8e7
+0, 9, 9, 1, 153600, 0xaec4ca90
+0, 10, 10, 1, 153600, 0x3cb4cb5d
+0, 11, 11, 1, 153600, 0x3aedcdc0
+0, 12, 12, 1, 153600, 0x0fa4cf55
+0, 13, 13, 1, 153600, 0x66a1d146
+0, 14, 14, 1, 153600, 0x3828d3ad
+0, 15, 15, 1, 153600, 0x73ccd7a4
+0, 16, 16, 1, 153600, 0xb815d983
+0, 17, 17, 1, 153600, 0x11a5a54f
+0, 18, 18, 1, 153600, 0x337d8bff
+0, 19, 19, 1, 153600, 0x0a1c8e5c
+0, 20, 20, 1, 153600, 0x09648a57
+0, 21, 21, 1, 153600, 0xf7398ba4
+0, 22, 22, 1, 153600, 0x836d8aaf
+0, 23, 23, 1, 153600, 0x4ee385bf
+0, 24, 24, 1, 153600, 0xacf2c4d6
+0, 25, 25, 1, 153600, 0x0610f426
+0, 26, 26, 1, 153600, 0xb798e4a1
+0, 27, 27, 1, 153600, 0xdaabe17e
+0, 28, 28, 1, 153600, 0x7b82def5
+0, 29, 29, 1, 153600, 0x56afe483
+0, 30, 30, 1, 153600, 0x4640acef
+0, 31, 31, 1, 153600, 0x4415f46c
+0, 32, 32, 1, 153600, 0x258d01d0
+0, 33, 33, 1, 153600, 0x18a55ba1
+0, 34, 34, 1, 153600, 0x165a7173
+0, 35, 35, 1, 153600, 0xfa8a438b
+0, 36, 36, 1, 153600, 0x57083a34
+0, 37, 37, 1, 153600, 0xb39923cd
+0, 38, 38, 1, 153600, 0x3e32fd70
+0, 39, 39, 1, 153600, 0xa7e9eb7f
+0, 40, 40, 1, 153600, 0x8c20ed88
+0, 41, 41, 1, 153600, 0x8c9bed27
+0, 42, 42, 1, 153600, 0xc79af188
+0, 43, 43, 1, 153600, 0x3bda00c8
+0, 44, 44, 1, 153600, 0x03f837a7
+0, 45, 45, 1, 153600, 0x550b83e3
+0, 46, 46, 1, 153600, 0xc0bc6080
+0, 47, 47, 1, 153600, 0xb8d968ed
+0, 48, 48, 1, 153600, 0x893e2348
+0, 49, 49, 1, 153600, 0x6cd01834
+0, 50, 50, 1, 153600, 0x9e6926c5
+0, 51, 51, 1, 153600, 0x4b57a4ea
+0, 52, 52, 1, 153600, 0xaab2cfcd
+0, 53, 53, 1, 153600, 0xffbb334d
+0, 54, 54, 1, 153600, 0x4b37e5a9
+0, 55, 55, 1, 153600, 0x3486dee0
+0, 56, 56, 1, 153600, 0xa7185454
+0, 57, 57, 1, 153600, 0xec29b8c2
+0, 58, 58, 1, 153600, 0x01e562ba
+0, 59, 59, 1, 153600, 0xe695cda3
+0, 60, 60, 1, 153600, 0xf6b59dac
+0, 61, 61, 1, 153600, 0xb308206b
+0, 62, 62, 1, 153600, 0xcc6ede4a
+0, 63, 63, 1, 153600, 0xd9f8071c
+0, 64, 64, 1, 153600, 0xfb434821
+0, 65, 65, 1, 153600, 0x84c97077
+0, 66, 66, 1, 153600, 0x82dc5217
+0, 67, 67, 1, 153600, 0xdbfd0ba8
+0, 68, 68, 1, 153600, 0x3d71058e
+0, 69, 69, 1, 153600, 0x3027b928
+0, 70, 70, 1, 153600, 0x792ae3bd
+0, 71, 71, 1, 153600, 0x36db00a7
+0, 72, 72, 1, 153600, 0x4484e720
+0, 73, 73, 1, 153600, 0xfaa76cdc
+0, 74, 74, 1, 153600, 0x9f1e4c7e
+0, 75, 75, 1, 153600, 0x4b545d88
+0, 76, 76, 1, 153600, 0xa11cfd15
+0, 77, 77, 1, 153600, 0x9f5d49c4
+0, 78, 78, 1, 153600, 0x7a496740
+0, 79, 79, 1, 153600, 0x98477803
+0, 80, 80, 1, 153600, 0xa5fc20f8
+0, 81, 81, 1, 153600, 0x344ff96e
+0, 82, 82, 1, 153600, 0x20c91746
+0, 83, 83, 1, 153600, 0x7c59b379
+0, 84, 84, 1, 153600, 0x38e3b86d
+0, 85, 85, 1, 153600, 0xff25a440
+0, 86, 86, 1, 153600, 0xa1f66533
+0, 87, 87, 1, 153600, 0xe136260a
+0, 88, 88, 1, 153600, 0x048ccf56
+0, 89, 89, 1, 153600, 0x65f68a24
+0, 90, 90, 1, 153600, 0xf32b385a
+0, 91, 91, 1, 153600, 0x3e930a8f
diff --git a/gst-libs/ext/libav/tests/ref/fate/deluxepaint-anm b/gst-libs/ext/libav/tests/ref/fate/deluxepaint-anm
index 98da928..e69b95e 100644
--- a/gst-libs/ext/libav/tests/ref/fate/deluxepaint-anm
+++ b/gst-libs/ext/libav/tests/ref/fate/deluxepaint-anm
@@ -1,123 +1,124 @@
-0, 0, 192000, 0x82a79641
-0, 3000, 192000, 0x43079971
-0, 6000, 192000, 0x6311f1e5
-0, 9000, 192000, 0x9e1ef4dc
-0, 12000, 192000, 0x6f81049b
-0, 15000, 192000, 0xe696fb12
-0, 18000, 192000, 0x1ef4d160
-0, 21000, 192000, 0x2f1bf0d4
-0, 24000, 192000, 0xcfed92da
-0, 27000, 192000, 0xbd409978
-0, 30000, 192000, 0x50f76f07
-0, 33000, 192000, 0xc8d52062
-0, 36000, 192000, 0x75061d0e
-0, 39000, 192000, 0x01b2a711
-0, 42000, 192000, 0x541ca739
-0, 45000, 192000, 0xe931ad85
-0, 48000, 192000, 0xb7e4d4a5
-0, 51000, 192000, 0xfc20d475
-0, 54000, 192000, 0x7a5eefe5
-0, 57000, 192000, 0x95a3ef97
-0, 60000, 192000, 0x021d7f69
-0, 63000, 192000, 0x108e7ed9
-0, 66000, 192000, 0x021d7f69
-0, 69000, 192000, 0x681817d8
-0, 72000, 192000, 0x653e19d2
-0, 75000, 192000, 0x56d9b14a
-0, 78000, 192000, 0x82240846
-0, 81000, 192000, 0xa2e90840
-0, 84000, 192000, 0x8e031416
-0, 87000, 192000, 0xe23813a6
-0, 90000, 192000, 0xb2451aa1
-0, 93000, 192000, 0x92eec7d2
-0, 96000, 192000, 0x6400c80e
-0, 99000, 192000, 0x24f01fce
-0, 102000, 192000, 0x7c1b201c
-0, 105000, 192000, 0xe2c878a1
-0, 108000, 192000, 0xf6006739
-0, 111000, 192000, 0x726b6677
-0, 114000, 192000, 0xca61a01d
-0, 117000, 192000, 0x87e49f69
-0, 120000, 192000, 0x57120bd4
-0, 123000, 192000, 0x50171c4b
-0, 126000, 192000, 0x8ace1c49
-0, 129000, 192000, 0x83082a8c
-0, 132000, 192000, 0x6e092b58
-0, 135000, 192000, 0x207a9af4
-0, 138000, 192000, 0xedf193f0
-0, 141000, 192000, 0x531793f0
-0, 144000, 192000, 0x24e2a406
-0, 147000, 192000, 0x6c34a1e5
-0, 150000, 192000, 0x8e7acdae
-0, 153000, 192000, 0x1f941805
-0, 156000, 192000, 0x0c391218
-0, 159000, 192000, 0xf25aa1fd
-0, 162000, 192000, 0xcb2aa40e
-0, 165000, 192000, 0x69701e49
-0, 168000, 192000, 0x0dd719d3
-0, 171000, 192000, 0x5ef71955
-0, 174000, 192000, 0xac2063ca
-0, 177000, 192000, 0xce7d601c
-0, 180000, 192000, 0x43003946
-0, 183000, 192000, 0xa72a38ee
-0, 186000, 192000, 0x98023933
-0, 189000, 192000, 0xa72a38ee
-0, 192000, 192000, 0x98023933
-0, 195000, 192000, 0xa72a38ee
-0, 198000, 192000, 0x98023933
-0, 201000, 192000, 0xa72a38ee
-0, 204000, 192000, 0xdd7f371d
-0, 207000, 192000, 0xeed134c6
-0, 210000, 192000, 0x362931f5
-0, 213000, 192000, 0xfb41331d
-0, 216000, 192000, 0x087433f8
-0, 219000, 192000, 0xf36b34a6
-0, 222000, 192000, 0x652a33cd
-0, 225000, 192000, 0x652a33cd
-0, 228000, 192000, 0xe50c336a
-0, 231000, 192000, 0x652a33cd
-0, 234000, 192000, 0xeed134c6
-0, 237000, 192000, 0x652a33cd
-0, 240000, 192000, 0x5d7633e5
-0, 243000, 192000, 0x845233b5
-0, 246000, 192000, 0x9d1c349b
-0, 249000, 192000, 0x25843317
-0, 252000, 192000, 0xc84b375c
-0, 255000, 192000, 0xaf2b3410
-0, 258000, 192000, 0xaf2b3410
-0, 261000, 192000, 0x26d23594
-0, 264000, 192000, 0xaf2b3410
-0, 267000, 192000, 0x26d23594
-0, 270000, 192000, 0xaf2b3410
-0, 273000, 192000, 0x72c4dfb9
-0, 276000, 192000, 0x3c72e390
-0, 279000, 192000, 0xb4466634
-0, 282000, 192000, 0x84f064f5
-0, 285000, 192000, 0xad43f3f5
-0, 288000, 192000, 0xa8644d57
-0, 291000, 192000, 0xfac35238
-0, 294000, 192000, 0xe9374d1e
-0, 297000, 192000, 0x0bd14cfa
-0, 300000, 192000, 0x7e51a437
-0, 303000, 192000, 0x92678dfa
-0, 306000, 192000, 0x43338d41
-0, 309000, 192000, 0x00000000
-0, 312000, 192000, 0x00000000
-0, 315000, 192000, 0x00000000
-0, 318000, 192000, 0x00000000
-0, 321000, 192000, 0x00000000
-0, 324000, 192000, 0x00000000
-0, 327000, 192000, 0x00000000
-0, 330000, 192000, 0x00000000
-0, 333000, 192000, 0x00000000
-0, 336000, 192000, 0x00000000
-0, 339000, 192000, 0x00000000
-0, 342000, 192000, 0x00000000
-0, 345000, 192000, 0x00000000
-0, 348000, 192000, 0x00000000
-0, 351000, 192000, 0x00000000
-0, 354000, 192000, 0x00000000
-0, 357000, 192000, 0x00000000
-0, 360000, 192000, 0x00000000
-0, 363000, 192000, 0x00000000
-0, 366000, 192000, 0x82a79641
+#tb 0: 1/30
+0, 0, 0, 1, 192000, 0x82a79641
+0, 1, 1, 1, 192000, 0x43079971
+0, 2, 2, 1, 192000, 0x6311f1e5
+0, 3, 3, 1, 192000, 0x9e1ef4dc
+0, 4, 4, 1, 192000, 0x6f81049b
+0, 5, 5, 1, 192000, 0xe696fb12
+0, 6, 6, 1, 192000, 0x1ef4d160
+0, 7, 7, 1, 192000, 0x2f1bf0d4
+0, 8, 8, 1, 192000, 0xcfed92da
+0, 9, 9, 1, 192000, 0xbd409978
+0, 10, 10, 1, 192000, 0x50f76f07
+0, 11, 11, 1, 192000, 0xc8d52062
+0, 12, 12, 1, 192000, 0x75061d0e
+0, 13, 13, 1, 192000, 0x01b2a711
+0, 14, 14, 1, 192000, 0x541ca739
+0, 15, 15, 1, 192000, 0xe931ad85
+0, 16, 16, 1, 192000, 0xb7e4d4a5
+0, 17, 17, 1, 192000, 0xfc20d475
+0, 18, 18, 1, 192000, 0x7a5eefe5
+0, 19, 19, 1, 192000, 0x95a3ef97
+0, 20, 20, 1, 192000, 0x021d7f69
+0, 21, 21, 1, 192000, 0x108e7ed9
+0, 22, 22, 1, 192000, 0x021d7f69
+0, 23, 23, 1, 192000, 0x681817d8
+0, 24, 24, 1, 192000, 0x653e19d2
+0, 25, 25, 1, 192000, 0x56d9b14a
+0, 26, 26, 1, 192000, 0x82240846
+0, 27, 27, 1, 192000, 0xa2e90840
+0, 28, 28, 1, 192000, 0x8e031416
+0, 29, 29, 1, 192000, 0xe23813a6
+0, 30, 30, 1, 192000, 0xb2451aa1
+0, 31, 31, 1, 192000, 0x92eec7d2
+0, 32, 32, 1, 192000, 0x6400c80e
+0, 33, 33, 1, 192000, 0x24f01fce
+0, 34, 34, 1, 192000, 0x7c1b201c
+0, 35, 35, 1, 192000, 0xe2c878a1
+0, 36, 36, 1, 192000, 0xf6006739
+0, 37, 37, 1, 192000, 0x726b6677
+0, 38, 38, 1, 192000, 0xca61a01d
+0, 39, 39, 1, 192000, 0x87e49f69
+0, 40, 40, 1, 192000, 0x57120bd4
+0, 41, 41, 1, 192000, 0x50171c4b
+0, 42, 42, 1, 192000, 0x8ace1c49
+0, 43, 43, 1, 192000, 0x83082a8c
+0, 44, 44, 1, 192000, 0x6e092b58
+0, 45, 45, 1, 192000, 0x207a9af4
+0, 46, 46, 1, 192000, 0xedf193f0
+0, 47, 47, 1, 192000, 0x531793f0
+0, 48, 48, 1, 192000, 0x24e2a406
+0, 49, 49, 1, 192000, 0x6c34a1e5
+0, 50, 50, 1, 192000, 0x8e7acdae
+0, 51, 51, 1, 192000, 0x1f941805
+0, 52, 52, 1, 192000, 0x0c391218
+0, 53, 53, 1, 192000, 0xf25aa1fd
+0, 54, 54, 1, 192000, 0xcb2aa40e
+0, 55, 55, 1, 192000, 0x69701e49
+0, 56, 56, 1, 192000, 0x0dd719d3
+0, 57, 57, 1, 192000, 0x5ef71955
+0, 58, 58, 1, 192000, 0xac2063ca
+0, 59, 59, 1, 192000, 0xce7d601c
+0, 60, 60, 1, 192000, 0x43003946
+0, 61, 61, 1, 192000, 0xa72a38ee
+0, 62, 62, 1, 192000, 0x98023933
+0, 63, 63, 1, 192000, 0xa72a38ee
+0, 64, 64, 1, 192000, 0x98023933
+0, 65, 65, 1, 192000, 0xa72a38ee
+0, 66, 66, 1, 192000, 0x98023933
+0, 67, 67, 1, 192000, 0xa72a38ee
+0, 68, 68, 1, 192000, 0xdd7f371d
+0, 69, 69, 1, 192000, 0xeed134c6
+0, 103, 103, 1, 192000, 0x362931f5
+0, 104, 104, 1, 192000, 0xfb41331d
+0, 105, 105, 1, 192000, 0x087433f8
+0, 106, 106, 1, 192000, 0xf36b34a6
+0, 107, 107, 1, 192000, 0x652a33cd
+0, 108, 108, 1, 192000, 0x652a33cd
+0, 109, 109, 1, 192000, 0xe50c336a
+0, 110, 110, 1, 192000, 0x652a33cd
+0, 111, 111, 1, 192000, 0xeed134c6
+0, 112, 112, 1, 192000, 0x652a33cd
+0, 113, 113, 1, 192000, 0x5d7633e5
+0, 114, 114, 1, 192000, 0x845233b5
+0, 115, 115, 1, 192000, 0x9d1c349b
+0, 116, 116, 1, 192000, 0x25843317
+0, 117, 117, 1, 192000, 0xc84b375c
+0, 118, 118, 1, 192000, 0xaf2b3410
+0, 119, 119, 1, 192000, 0xaf2b3410
+0, 120, 120, 1, 192000, 0x26d23594
+0, 121, 121, 1, 192000, 0xaf2b3410
+0, 122, 122, 1, 192000, 0x26d23594
+0, 123, 123, 1, 192000, 0xaf2b3410
+0, 124, 124, 1, 192000, 0x72c4dfb9
+0, 125, 125, 1, 192000, 0x3c72e390
+0, 126, 126, 1, 192000, 0xb4466634
+0, 127, 127, 1, 192000, 0x84f064f5
+0, 128, 128, 1, 192000, 0xad43f3f5
+0, 129, 129, 1, 192000, 0xa8644d57
+0, 130, 130, 1, 192000, 0xfac35238
+0, 131, 131, 1, 192000, 0xe9374d1e
+0, 132, 132, 1, 192000, 0x0bd14cfa
+0, 133, 133, 1, 192000, 0x7e51a437
+0, 134, 134, 1, 192000, 0x92678dfa
+0, 135, 135, 1, 192000, 0x43338d41
+0, 136, 136, 1, 192000, 0x00000000
+0, 137, 137, 1, 192000, 0x00000000
+0, 138, 138, 1, 192000, 0x00000000
+0, 139, 139, 1, 192000, 0x00000000
+0, 140, 140, 1, 192000, 0x00000000
+0, 141, 141, 1, 192000, 0x00000000
+0, 142, 142, 1, 192000, 0x00000000
+0, 143, 143, 1, 192000, 0x00000000
+0, 144, 144, 1, 192000, 0x00000000
+0, 145, 145, 1, 192000, 0x00000000
+0, 146, 146, 1, 192000, 0x00000000
+0, 147, 147, 1, 192000, 0x00000000
+0, 148, 148, 1, 192000, 0x00000000
+0, 149, 149, 1, 192000, 0x00000000
+0, 150, 150, 1, 192000, 0x00000000
+0, 151, 151, 1, 192000, 0x00000000
+0, 152, 152, 1, 192000, 0x00000000
+0, 153, 153, 1, 192000, 0x00000000
+0, 154, 154, 1, 192000, 0x00000000
+0, 155, 155, 1, 192000, 0x82a79641
diff --git a/gst-libs/ext/libav/tests/ref/fate/dfa1 b/gst-libs/ext/libav/tests/ref/fate/dfa1
index 43c9737..92a7cce 100644
--- a/gst-libs/ext/libav/tests/ref/fate/dfa1
+++ b/gst-libs/ext/libav/tests/ref/fate/dfa1
@@ -1,25 +1,26 @@
-0, 0, 921600, 0x2e2b3ca4
-0, 11520, 921600, 0x0ff7a368
-0, 23040, 921600, 0xf5f0dc50
-0, 34560, 921600, 0x56cb0c9d
-0, 46080, 921600, 0xb253228f
-0, 57600, 921600, 0xefd3419e
-0, 69120, 921600, 0x708c0ce7
-0, 80640, 921600, 0x0b3a7f6d
-0, 92160, 921600, 0x72db4eac
-0, 103680, 921600, 0x94328111
-0, 115200, 921600, 0x95f7b2f0
-0, 126720, 921600, 0xdc3c9655
-0, 138240, 921600, 0xfe03dec6
-0, 149760, 921600, 0x2551dffb
-0, 161280, 921600, 0xe8b37d9e
-0, 172800, 921600, 0xad93508b
-0, 184320, 921600, 0x5a1c4890
-0, 195840, 921600, 0x6f972fb4
-0, 207360, 921600, 0xa1d5ff95
-0, 218880, 921600, 0x7bc5d07c
-0, 230400, 921600, 0xc0311e4e
-0, 241920, 921600, 0x5b02cc48
-0, 253440, 921600, 0x8db4d5fa
-0, 264960, 921600, 0x31aae769
-0, 276480, 921600, 0xab62b9a7
+#tb 0: 16/125
+0, 0, 0, 1, 921600, 0x2e2b3ca4
+0, 1, 1, 1, 921600, 0x0ff7a368
+0, 2, 2, 1, 921600, 0xf5f0dc50
+0, 3, 3, 1, 921600, 0x56cb0c9d
+0, 4, 4, 1, 921600, 0xb253228f
+0, 5, 5, 1, 921600, 0xefd3419e
+0, 6, 6, 1, 921600, 0x708c0ce7
+0, 7, 7, 1, 921600, 0x0b3a7f6d
+0, 8, 8, 1, 921600, 0x72db4eac
+0, 9, 9, 1, 921600, 0x94328111
+0, 10, 10, 1, 921600, 0x95f7b2f0
+0, 11, 11, 1, 921600, 0xdc3c9655
+0, 12, 12, 1, 921600, 0xfe03dec6
+0, 13, 13, 1, 921600, 0x2551dffb
+0, 14, 14, 1, 921600, 0xe8b37d9e
+0, 15, 15, 1, 921600, 0xad93508b
+0, 16, 16, 1, 921600, 0x5a1c4890
+0, 17, 17, 1, 921600, 0x6f972fb4
+0, 18, 18, 1, 921600, 0xa1d5ff95
+0, 19, 19, 1, 921600, 0x7bc5d07c
+0, 20, 20, 1, 921600, 0xc0311e4e
+0, 21, 21, 1, 921600, 0x5b02cc48
+0, 22, 22, 1, 921600, 0x8db4d5fa
+0, 23, 23, 1, 921600, 0x31aae769
+0, 24, 24, 1, 921600, 0xab62b9a7
diff --git a/gst-libs/ext/libav/tests/ref/fate/dfa10 b/gst-libs/ext/libav/tests/ref/fate/dfa10
index 720704a..a140e5c 100644
--- a/gst-libs/ext/libav/tests/ref/fate/dfa10
+++ b/gst-libs/ext/libav/tests/ref/fate/dfa10
@@ -1,8 +1,9 @@
-0, 0, 192000, 0xbabcbd55
-0, 6390, 192000, 0xf00a5683
-0, 12780, 192000, 0xcce90589
-0, 19170, 192000, 0x8545631f
-0, 25560, 192000, 0xd3ab654c
-0, 31950, 192000, 0x5e0dda12
-0, 38340, 192000, 0x7e94b053
-0, 44730, 192000, 0x8027e68b
+#tb 0: 71/1000
+0, 0, 0, 1, 192000, 0xbabcbd55
+0, 1, 1, 1, 192000, 0xf00a5683
+0, 2, 2, 1, 192000, 0xcce90589
+0, 3, 3, 1, 192000, 0x8545631f
+0, 4, 4, 1, 192000, 0xd3ab654c
+0, 5, 5, 1, 192000, 0x5e0dda12
+0, 6, 6, 1, 192000, 0x7e94b053
+0, 7, 7, 1, 192000, 0x8027e68b
diff --git a/gst-libs/ext/libav/tests/ref/fate/dfa11 b/gst-libs/ext/libav/tests/ref/fate/dfa11
index f01fd13..3990d24 100644
--- a/gst-libs/ext/libav/tests/ref/fate/dfa11
+++ b/gst-libs/ext/libav/tests/ref/fate/dfa11
@@ -1,9 +1,10 @@
-0, 0, 192000, 0x8b8bd8de
-0, 6390, 192000, 0xdac26ec2
-0, 12780, 192000, 0x0fc01c28
-0, 19170, 192000, 0x1251eef7
-0, 25560, 192000, 0x89eced0e
-0, 31950, 192000, 0x4943d821
-0, 38340, 192000, 0x49258ec9
-0, 44730, 192000, 0x9afd5881
-0, 51120, 192000, 0xb322b901
+#tb 0: 71/1000
+0, 0, 0, 1, 192000, 0x8b8bd8de
+0, 1, 1, 1, 192000, 0xdac26ec2
+0, 2, 2, 1, 192000, 0x0fc01c28
+0, 3, 3, 1, 192000, 0x1251eef7
+0, 4, 4, 1, 192000, 0x89eced0e
+0, 5, 5, 1, 192000, 0x4943d821
+0, 6, 6, 1, 192000, 0x49258ec9
+0, 7, 7, 1, 192000, 0x9afd5881
+0, 8, 8, 1, 192000, 0xb322b901
diff --git a/gst-libs/ext/libav/tests/ref/fate/dfa2 b/gst-libs/ext/libav/tests/ref/fate/dfa2
index 98af733..a050c97 100644
--- a/gst-libs/ext/libav/tests/ref/fate/dfa2
+++ b/gst-libs/ext/libav/tests/ref/fate/dfa2
@@ -1,17 +1,18 @@
-0, 0, 921600, 0x713f2da1
-0, 6390, 921600, 0x9e772ec9
-0, 12780, 921600, 0x9420310f
-0, 19170, 921600, 0xd68f294f
-0, 25560, 921600, 0xe25a1bcf
-0, 31950, 921600, 0x32f903ec
-0, 38340, 921600, 0xdb290b1c
-0, 44730, 921600, 0x0b0d1b0f
-0, 51120, 921600, 0x58430921
-0, 57510, 921600, 0xe65dd39e
-0, 63900, 921600, 0x146b3068
-0, 70290, 921600, 0x6e1e7f78
-0, 76680, 921600, 0x0166e01c
-0, 83070, 921600, 0x83b86b56
-0, 89460, 921600, 0xd52a1697
-0, 95850, 921600, 0x5b38adc8
-0, 102240, 921600, 0x457f6cea
+#tb 0: 71/1000
+0, 0, 0, 1, 921600, 0x713f2da1
+0, 1, 1, 1, 921600, 0x9e772ec9
+0, 2, 2, 1, 921600, 0x9420310f
+0, 3, 3, 1, 921600, 0xd68f294f
+0, 4, 4, 1, 921600, 0xe25a1bcf
+0, 5, 5, 1, 921600, 0x32f903ec
+0, 6, 6, 1, 921600, 0xdb290b1c
+0, 7, 7, 1, 921600, 0x0b0d1b0f
+0, 8, 8, 1, 921600, 0x58430921
+0, 9, 9, 1, 921600, 0xe65dd39e
+0, 10, 10, 1, 921600, 0x146b3068
+0, 11, 11, 1, 921600, 0x6e1e7f78
+0, 12, 12, 1, 921600, 0x0166e01c
+0, 13, 13, 1, 921600, 0x83b86b56
+0, 14, 14, 1, 921600, 0xd52a1697
+0, 15, 15, 1, 921600, 0x5b38adc8
+0, 16, 16, 1, 921600, 0x457f6cea
diff --git a/gst-libs/ext/libav/tests/ref/fate/dfa3 b/gst-libs/ext/libav/tests/ref/fate/dfa3
index 0452f2b..8c91faa 100644
--- a/gst-libs/ext/libav/tests/ref/fate/dfa3
+++ b/gst-libs/ext/libav/tests/ref/fate/dfa3
@@ -1,10 +1,11 @@
-0, 0, 192000, 0x10380cf0
-0, 9000, 192000, 0x1d74af4c
-0, 18000, 192000, 0xd665492d
-0, 27000, 192000, 0xbf544565
-0, 36000, 192000, 0xf8a33b00
-0, 45000, 192000, 0x7d08bbad
-0, 54000, 192000, 0x10685a90
-0, 63000, 192000, 0x0a1a9ef6
-0, 72000, 192000, 0x3e967980
-0, 81000, 192000, 0x9849f751
+#tb 0: 1/10
+0, 0, 0, 1, 192000, 0x10380cf0
+0, 1, 1, 1, 192000, 0x1d74af4c
+0, 2, 2, 1, 192000, 0xd665492d
+0, 3, 3, 1, 192000, 0xbf544565
+0, 4, 4, 1, 192000, 0xf8a33b00
+0, 5, 5, 1, 192000, 0x7d08bbad
+0, 6, 6, 1, 192000, 0x10685a90
+0, 7, 7, 1, 192000, 0x0a1a9ef6
+0, 8, 8, 1, 192000, 0x3e967980
+0, 9, 9, 1, 192000, 0x9849f751
diff --git a/gst-libs/ext/libav/tests/ref/fate/dfa4 b/gst-libs/ext/libav/tests/ref/fate/dfa4
index f19061b..67b5722 100644
--- a/gst-libs/ext/libav/tests/ref/fate/dfa4
+++ b/gst-libs/ext/libav/tests/ref/fate/dfa4
@@ -1,13 +1,14 @@
-0, 0, 921600, 0xe6309638
-0, 12780, 921600, 0xa99a7665
-0, 25560, 921600, 0x172ccfbb
-0, 38340, 921600, 0xcf676571
-0, 51120, 921600, 0x6a5077f2
-0, 63900, 921600, 0x6a5077f2
-0, 76680, 921600, 0x6a5077f2
-0, 89460, 921600, 0x6a5077f2
-0, 102240, 921600, 0x6a5077f2
-0, 115020, 921600, 0x6a5077f2
-0, 127800, 921600, 0xb83db404
-0, 140580, 921600, 0x997ceb90
-0, 153360, 921600, 0xd707157c
+#tb 0: 71/500
+0, 1, 1, 1, 921600, 0xe6309638
+0, 2, 2, 1, 921600, 0xa99a7665
+0, 3, 3, 1, 921600, 0x172ccfbb
+0, 4, 4, 1, 921600, 0xcf676571
+0, 5, 5, 1, 921600, 0x6a5077f2
+0, 6, 6, 1, 921600, 0x6a5077f2
+0, 7, 7, 1, 921600, 0x6a5077f2
+0, 8, 8, 1, 921600, 0x6a5077f2
+0, 9, 9, 1, 921600, 0x6a5077f2
+0, 10, 10, 1, 921600, 0x6a5077f2
+0, 11, 11, 1, 921600, 0xb83db404
+0, 12, 12, 1, 921600, 0x997ceb90
+0, 13, 13, 1, 921600, 0xd707157c
diff --git a/gst-libs/ext/libav/tests/ref/fate/dfa5 b/gst-libs/ext/libav/tests/ref/fate/dfa5
index 65aa1bc..b9f7727 100644
--- a/gst-libs/ext/libav/tests/ref/fate/dfa5
+++ b/gst-libs/ext/libav/tests/ref/fate/dfa5
@@ -1,15 +1,16 @@
-0, 0, 192000, 0xc0941c10
-0, 9000, 192000, 0xe2fe3ae5
-0, 18000, 192000, 0x4a352d98
-0, 27000, 192000, 0x7b78e0bb
-0, 36000, 192000, 0x855c6675
-0, 45000, 192000, 0xf443dad6
-0, 54000, 192000, 0xe7e2a2e1
-0, 63000, 192000, 0xa9009c58
-0, 72000, 192000, 0x551855ab
-0, 81000, 192000, 0x253908c7
-0, 90000, 192000, 0x616213c4
-0, 99000, 192000, 0xa381c3b1
-0, 108000, 192000, 0xa2d64152
-0, 117000, 192000, 0x34ed0f72
-0, 126000, 192000, 0x05be63b4
+#tb 0: 1/10
+0, 0, 0, 1, 192000, 0xc0941c10
+0, 1, 1, 1, 192000, 0xe2fe3ae5
+0, 2, 2, 1, 192000, 0x4a352d98
+0, 3, 3, 1, 192000, 0x7b78e0bb
+0, 4, 4, 1, 192000, 0x855c6675
+0, 5, 5, 1, 192000, 0xf443dad6
+0, 6, 6, 1, 192000, 0xe7e2a2e1
+0, 7, 7, 1, 192000, 0xa9009c58
+0, 8, 8, 1, 192000, 0x551855ab
+0, 9, 9, 1, 192000, 0x253908c7
+0, 10, 10, 1, 192000, 0x616213c4
+0, 11, 11, 1, 192000, 0xa381c3b1
+0, 12, 12, 1, 192000, 0xa2d64152
+0, 13, 13, 1, 192000, 0x34ed0f72
+0, 14, 14, 1, 192000, 0x05be63b4
diff --git a/gst-libs/ext/libav/tests/ref/fate/dfa6 b/gst-libs/ext/libav/tests/ref/fate/dfa6
index 92fe427..92ed259 100644
--- a/gst-libs/ext/libav/tests/ref/fate/dfa6
+++ b/gst-libs/ext/libav/tests/ref/fate/dfa6
@@ -1,12 +1,13 @@
-0, 0, 192000, 0x69f6a5f6
-0, 6390, 192000, 0xc741d0a6
-0, 12780, 192000, 0xba31e7a4
-0, 19170, 192000, 0x7dc45080
-0, 25560, 192000, 0x1c91dad5
-0, 31950, 192000, 0x564b69b1
-0, 38340, 192000, 0xdd9d9ae8
-0, 44730, 192000, 0x605c05e1
-0, 51120, 192000, 0xa5341ddb
-0, 57510, 192000, 0x1ebff8ba
-0, 63900, 192000, 0x240df237
-0, 70290, 192000, 0xac641867
+#tb 0: 71/1000
+0, 0, 0, 1, 192000, 0x69f6a5f6
+0, 1, 1, 1, 192000, 0xc741d0a6
+0, 2, 2, 1, 192000, 0xba31e7a4
+0, 3, 3, 1, 192000, 0x7dc45080
+0, 4, 4, 1, 192000, 0x1c91dad5
+0, 5, 5, 1, 192000, 0x564b69b1
+0, 6, 6, 1, 192000, 0xdd9d9ae8
+0, 7, 7, 1, 192000, 0x605c05e1
+0, 8, 8, 1, 192000, 0xa5341ddb
+0, 9, 9, 1, 192000, 0x1ebff8ba
+0, 10, 10, 1, 192000, 0x240df237
+0, 11, 11, 1, 192000, 0xac641867
diff --git a/gst-libs/ext/libav/tests/ref/fate/dfa7 b/gst-libs/ext/libav/tests/ref/fate/dfa7
index c9612f0..7dd40f2 100644
--- a/gst-libs/ext/libav/tests/ref/fate/dfa7
+++ b/gst-libs/ext/libav/tests/ref/fate/dfa7
@@ -1,12 +1,13 @@
-0, 0, 7866, 0xa0056fdb
-0, 6390, 7866, 0xed906c7a
-0, 12780, 7866, 0x1c6e6f7d
-0, 19170, 7866, 0xa2c460f7
-0, 25560, 7866, 0xcf2166d4
-0, 31950, 7866, 0xea545432
-0, 38340, 7866, 0x604a5a9e
-0, 44730, 7866, 0xbbc95c89
-0, 51120, 7866, 0x80b16b5b
-0, 57510, 7866, 0x9a1660ae
-0, 63900, 7866, 0x6f886b10
-0, 70290, 7866, 0xad8b5c99
+#tb 0: 71/1000
+0, 0, 0, 1, 7866, 0xa0056fdb
+0, 1, 1, 1, 7866, 0xed906c7a
+0, 2, 2, 1, 7866, 0x1c6e6f7d
+0, 3, 3, 1, 7866, 0xa2c460f7
+0, 4, 4, 1, 7866, 0xcf2166d4
+0, 5, 5, 1, 7866, 0xea545432
+0, 6, 6, 1, 7866, 0x604a5a9e
+0, 7, 7, 1, 7866, 0xbbc95c89
+0, 8, 8, 1, 7866, 0x80b16b5b
+0, 9, 9, 1, 7866, 0x9a1660ae
+0, 10, 10, 1, 7866, 0x6f886b10
+0, 11, 11, 1, 7866, 0xad8b5c99
diff --git a/gst-libs/ext/libav/tests/ref/fate/dfa8 b/gst-libs/ext/libav/tests/ref/fate/dfa8
index ade21de..39dde05 100644
--- a/gst-libs/ext/libav/tests/ref/fate/dfa8
+++ b/gst-libs/ext/libav/tests/ref/fate/dfa8
@@ -1,36 +1,37 @@
-0, 0, 134724, 0x2ab217de
-0, 6390, 134724, 0xbf240f9a
-0, 12780, 134724, 0x020a6010
-0, 19170, 134724, 0x9a5f9374
-0, 25560, 134724, 0x1e93a7e9
-0, 31950, 134724, 0x9e4a4c55
-0, 38340, 134724, 0x8f9d1bab
-0, 44730, 134724, 0xb26ac45b
-0, 51120, 134724, 0xc08706d2
-0, 57510, 134724, 0x0806b031
-0, 63900, 134724, 0x234dbb33
-0, 70290, 134724, 0xe4cbfb2f
-0, 76680, 134724, 0xf603f3fd
-0, 83070, 134724, 0x205669d1
-0, 89460, 134724, 0x7ddbb5e3
-0, 95850, 134724, 0x8dfbb45a
-0, 102240, 134724, 0x9632f681
-0, 108630, 134724, 0x259e462c
-0, 115020, 134724, 0x14f2bac1
-0, 121410, 134724, 0xac3de7ed
-0, 127800, 134724, 0x6b8af396
-0, 134190, 134724, 0xd1e4bc1c
-0, 140580, 134724, 0x716d1c73
-0, 146970, 134724, 0x610956c8
-0, 153360, 134724, 0x89ff8e86
-0, 159750, 134724, 0xc3ea6b6f
-0, 166140, 134724, 0x886688ef
-0, 172530, 134724, 0xe60fc8c1
-0, 178920, 134724, 0x22bd3131
-0, 185310, 134724, 0xb1d74561
-0, 191700, 134724, 0x61b069bc
-0, 198090, 134724, 0x50b665c1
-0, 204480, 134724, 0x027e5144
-0, 210870, 134724, 0xfe0c31b4
-0, 217260, 134724, 0x1e7a1f2d
-0, 223650, 134724, 0x48bff03d
+#tb 0: 71/1000
+0, 0, 0, 1, 134724, 0x2ab217de
+0, 1, 1, 1, 134724, 0xbf240f9a
+0, 2, 2, 1, 134724, 0x020a6010
+0, 3, 3, 1, 134724, 0x9a5f9374
+0, 4, 4, 1, 134724, 0x1e93a7e9
+0, 5, 5, 1, 134724, 0x9e4a4c55
+0, 6, 6, 1, 134724, 0x8f9d1bab
+0, 7, 7, 1, 134724, 0xb26ac45b
+0, 8, 8, 1, 134724, 0xc08706d2
+0, 9, 9, 1, 134724, 0x0806b031
+0, 10, 10, 1, 134724, 0x234dbb33
+0, 11, 11, 1, 134724, 0xe4cbfb2f
+0, 12, 12, 1, 134724, 0xf603f3fd
+0, 13, 13, 1, 134724, 0x205669d1
+0, 14, 14, 1, 134724, 0x7ddbb5e3
+0, 15, 15, 1, 134724, 0x8dfbb45a
+0, 16, 16, 1, 134724, 0x9632f681
+0, 17, 17, 1, 134724, 0x259e462c
+0, 18, 18, 1, 134724, 0x14f2bac1
+0, 19, 19, 1, 134724, 0xac3de7ed
+0, 20, 20, 1, 134724, 0x6b8af396
+0, 21, 21, 1, 134724, 0xd1e4bc1c
+0, 22, 22, 1, 134724, 0x716d1c73
+0, 23, 23, 1, 134724, 0x610956c8
+0, 24, 24, 1, 134724, 0x89ff8e86
+0, 25, 25, 1, 134724, 0xc3ea6b6f
+0, 26, 26, 1, 134724, 0x886688ef
+0, 27, 27, 1, 134724, 0xe60fc8c1
+0, 28, 28, 1, 134724, 0x22bd3131
+0, 29, 29, 1, 134724, 0xb1d74561
+0, 30, 30, 1, 134724, 0x61b069bc
+0, 31, 31, 1, 134724, 0x50b665c1
+0, 32, 32, 1, 134724, 0x027e5144
+0, 33, 33, 1, 134724, 0xfe0c31b4
+0, 34, 34, 1, 134724, 0x1e7a1f2d
+0, 35, 35, 1, 134724, 0x48bff03d
diff --git a/gst-libs/ext/libav/tests/ref/fate/dfa9 b/gst-libs/ext/libav/tests/ref/fate/dfa9
index b33152a..cf24e3e 100644
--- a/gst-libs/ext/libav/tests/ref/fate/dfa9
+++ b/gst-libs/ext/libav/tests/ref/fate/dfa9
@@ -1,6 +1,7 @@
-0, 0, 228150, 0x188c6d9b
-0, 6390, 228150, 0x658dbf2f
-0, 12780, 228150, 0xc09a4b2e
-0, 19170, 228150, 0x8777bc7d
-0, 25560, 228150, 0xa388f0ce
-0, 31950, 228150, 0x4e06666e
+#tb 0: 71/1000
+0, 0, 0, 1, 228150, 0x188c6d9b
+0, 1, 1, 1, 228150, 0x658dbf2f
+0, 2, 2, 1, 228150, 0xc09a4b2e
+0, 3, 3, 1, 228150, 0x8777bc7d
+0, 4, 4, 1, 228150, 0xa388f0ce
+0, 5, 5, 1, 228150, 0x4e06666e
diff --git a/gst-libs/ext/libav/tests/ref/fate/dpcm-idroq b/gst-libs/ext/libav/tests/ref/fate/dpcm-idroq
index 7e0a10e..85e8efb 100644
--- a/gst-libs/ext/libav/tests/ref/fate/dpcm-idroq
+++ b/gst-libs/ext/libav/tests/ref/fate/dpcm-idroq
@@ -1,377 +1,168 @@
-0, 0, 393216, 0x56995aac
-1, 0, 29824, 0x77e265b7
-0, 3000, 393216, 0xf9ed5d6c
-0, 6000, 393216, 0xd3285d75
-0, 9000, 393216, 0x82d15d62
-0, 12000, 393216, 0x893e5d6f
-0, 15000, 393216, 0x82d15d62
-0, 18000, 393216, 0x893e5d6f
-0, 21000, 393216, 0x82d15d62
-0, 24000, 393216, 0x893e5d6f
-0, 27000, 393216, 0x82d15d62
-0, 30000, 393216, 0x893e5d6f
-1, 30433, 2944, 0x8dcdf50b
-0, 33000, 393216, 0x82d15d62
-1, 33437, 2944, 0xb135cd2a
-0, 36000, 393216, 0x893e5d6f
-1, 36441, 2944, 0x54a6e73f
-0, 39000, 393216, 0x82d15d62
-1, 39445, 2944, 0x050ccd4e
-0, 42000, 393216, 0x893e5d6f
-1, 42449, 2944, 0x6b68db44
-0, 45000, 393216, 0x82d15d62
-1, 45453, 2944, 0x55d1f308
-0, 48000, 393216, 0x2ae39eca
-1, 48457, 2944, 0x7e92f50b
-0, 51000, 393216, 0x9254be70
-1, 51461, 2944, 0xe9e91eed
-0, 54000, 393216, 0x4b2ed384
-1, 54465, 2944, 0x80af2ce0
-0, 57000, 393216, 0xbbd9d8f7
-1, 57469, 2944, 0xc67ffb07
-0, 60000, 393216, 0x1f2be0c3
-1, 60473, 2944, 0x7aaded27
-0, 63000, 393216, 0x2434eb25
-1, 63478, 2944, 0x14a024fd
-0, 66000, 393216, 0xa6cced4e
-1, 66482, 2944, 0x26e8df1f
-0, 69000, 393216, 0xd116f38b
-1, 69486, 2944, 0x2688df44
-0, 72000, 393216, 0x6b86f380
-1, 72490, 2944, 0x4b9cdd33
-0, 75000, 393216, 0xc1b3f8e9
-1, 75494, 2944, 0x10c2f11c
-0, 78000, 393216, 0x2993fd5d
-1, 78498, 2944, 0xc4e3ad6d
-0, 81000, 393216, 0xf489fe18
-1, 81502, 2944, 0xbeb1a78e
-0, 84000, 393216, 0x9ef10501
-1, 84506, 2944, 0x283d4e7f
-0, 87000, 393216, 0x8faf0512
-1, 87510, 2944, 0x4acf65e0
-0, 90000, 393216, 0xa54d0736
-1, 90514, 2944, 0x0ca29b8c
-0, 93000, 393216, 0xf4ef01e0
-1, 93518, 2944, 0x003fae34
-0, 96000, 393216, 0xe241ef51
-1, 96522, 2944, 0x2acfec7e
-0, 99000, 393216, 0xcc38e51f
-1, 99527, 2944, 0xea6fc6fe
-0, 102000, 393216, 0xb1345876
-1, 102531, 2944, 0xf5daec2f
-0, 105000, 393216, 0xf9b0968b
-1, 105535, 2944, 0x8d33ed7a
-0, 108000, 393216, 0x6bb1523f
-1, 108539, 2944, 0xc328f984
-0, 111000, 393216, 0x83469a05
-1, 111543, 2944, 0x6e0b58d3
-0, 114000, 393216, 0x73e30882
-1, 114547, 2944, 0xe282dc3f
-0, 117000, 393216, 0x8673da66
-1, 117551, 2944, 0xbf9bf3e6
-0, 120000, 393216, 0xb67596d3
-1, 120555, 2944, 0xd7b7d7e3
-0, 123000, 393216, 0xf7638710
-1, 123559, 2944, 0x4e87b6ab
-0, 126000, 393216, 0x813a8f47
-1, 126563, 2944, 0x7b8ce8d6
-0, 129000, 393216, 0xb3526555
-1, 129567, 2944, 0xd42991a5
-0, 132000, 393216, 0x1b167be3
-1, 132571, 2944, 0x452c98ca
-0, 135000, 393216, 0x99114562
-1, 135576, 2944, 0x6d27832d
-0, 138000, 393216, 0xfafb0693
-1, 138580, 2944, 0xa558720e
-0, 141000, 393216, 0x121d96c8
-1, 141584, 2944, 0x0a31bec0
-0, 144000, 393216, 0xb3c68c5d
-1, 144588, 2944, 0x28431384
-0, 147000, 393216, 0x2035b97f
-1, 147592, 2944, 0xd5e9fb3d
-0, 150000, 393216, 0xfbcaeb62
-1, 150596, 2944, 0x34f0e9f8
-0, 153000, 393216, 0xfd5aea5d
-1, 153600, 2944, 0x979432df
-0, 156000, 393216, 0x66efbddd
-1, 156604, 2944, 0xb00acd4d
-0, 159000, 393216, 0xf1e17862
-1, 159608, 2944, 0x726bffd6
-0, 162000, 393216, 0x27fa584d
-1, 162612, 2944, 0xa1f39a6d
-0, 165000, 393216, 0xe644ec5f
-1, 165616, 2944, 0xf6a8e30e
-0, 168000, 393216, 0x7e3067ba
-1, 168620, 2944, 0x608e9e06
-0, 171000, 393216, 0x1b6ba6fd
-1, 171624, 2944, 0x4ec58bc3
-0, 174000, 393216, 0x55bdba34
-1, 174629, 2944, 0x6d5c8458
-0, 177000, 393216, 0xc67db2e4
-1, 177633, 2944, 0x76a0abbd
-0, 180000, 393216, 0x359de8a2
-1, 180637, 2944, 0xf830e8a6
-0, 183000, 393216, 0x7b7a32ef
-1, 183641, 2944, 0x1bdd7bec
-0, 186000, 393216, 0xbe512a66
-1, 186645, 2944, 0x3c1bd187
-0, 189000, 393216, 0x681d82bf
-1, 189649, 2944, 0xf52cf697
-0, 192000, 393216, 0xa2320ec5
-1, 192653, 2944, 0x8f65b773
-0, 195000, 393216, 0xcfbd9954
-1, 195657, 2944, 0xf8b5b598
-0, 198000, 393216, 0x7fee9854
-1, 198661, 2944, 0xcd87d5ed
-0, 201000, 393216, 0x70eec155
-1, 201665, 2944, 0x672ac02a
-0, 204000, 393216, 0x114f684e
-1, 204669, 2944, 0x1d5d13ed
-0, 207000, 393216, 0xe27f034f
-1, 207673, 2944, 0xe298e3d4
-0, 210000, 393216, 0xfbbd89b4
-1, 210678, 2944, 0x3d2e9c32
-0, 213000, 393216, 0xcef4c58a
-1, 213682, 2944, 0xf3a39259
-0, 216000, 393216, 0x9eea88e9
-1, 216686, 2944, 0x930ae8f8
-0, 219000, 393216, 0x911cea42
-1, 219690, 2944, 0x8562aff7
-0, 222000, 393216, 0xec5727ea
-1, 222694, 2944, 0x9cd6c6a7
-0, 225000, 393216, 0xda998c33
-1, 225698, 2944, 0x2709dc5c
-0, 228000, 393216, 0xc82140ed
-1, 228702, 2944, 0xcbe31816
-0, 231000, 393216, 0x4caa8591
-1, 231706, 2944, 0xd7876ec4
-0, 234000, 393216, 0x4944206c
-1, 234710, 2944, 0xc2468b6a
-0, 237000, 393216, 0xd4676a94
-1, 237714, 2944, 0x76043e84
-0, 240000, 393216, 0x9e0340b3
-1, 240718, 2944, 0xd2c35bf0
-0, 243000, 393216, 0xbdef7f94
-1, 243722, 2944, 0x63de6061
-0, 246000, 393216, 0xfac05cb0
-1, 246727, 2944, 0xd8f6ed1d
-0, 249000, 393216, 0xfef5a369
-1, 249731, 2944, 0xe034928a
-0, 252000, 393216, 0x9fcb3711
-1, 252735, 2944, 0xa044da74
-0, 255000, 393216, 0x6d93f761
-1, 255739, 2944, 0xee410dba
-0, 258000, 393216, 0xe95dc1ae
-1, 258743, 2944, 0x8e020c7c
-0, 261000, 393216, 0x3e561557
-1, 261747, 2944, 0x73057ddb
-0, 264000, 393216, 0x0fa7a049
-1, 264751, 2944, 0xdee5cc18
-0, 267000, 393216, 0xf16afb95
-1, 267755, 2944, 0xf4d31dec
-0, 270000, 393216, 0xe53a2064
-1, 270759, 2944, 0xe8131e1c
-0, 273000, 393216, 0x57f046a4
-1, 273763, 2944, 0x8ae69c95
-0, 276000, 393216, 0xf6f16a0c
-1, 276767, 2944, 0x791c0bf4
-0, 279000, 393216, 0xcba0c8b0
-1, 279771, 2944, 0xd45a10db
-0, 282000, 393216, 0x5bdbe522
-1, 282776, 2944, 0x3a72b010
-0, 285000, 393216, 0x0fed0151
-1, 285780, 2944, 0x6a4a0411
-0, 288000, 393216, 0xbf86faf8
-1, 288784, 2944, 0xd77ab7f5
-0, 291000, 393216, 0x39854c5f
-1, 291788, 2944, 0xe3bf4fe5
-0, 294000, 393216, 0xd9b7760a
-1, 294792, 2944, 0x12db1be8
-0, 297000, 393216, 0x8edcc1d9
-1, 297796, 2944, 0x345210b0
-0, 300000, 393216, 0x44ae1435
-1, 300800, 2944, 0xcfc1f892
-0, 303000, 393216, 0xbc3d6d73
-1, 303804, 2944, 0x5b0a80bb
-0, 306000, 393216, 0xedd82647
-1, 306808, 2944, 0x31ab1168
-0, 309000, 393216, 0x1c2e5ce3
-1, 309812, 2944, 0xd4a4bb0a
-0, 312000, 393216, 0x04e29afe
-1, 312816, 2944, 0x8e211c8f
-0, 315000, 393216, 0xb191578e
-1, 315820, 2944, 0xcf464d50
-0, 318000, 393216, 0x31d75a06
-1, 318824, 2944, 0xe74ff3d6
-0, 321000, 393216, 0xfdb6c56e
-1, 321829, 2944, 0x6274635f
-0, 324000, 393216, 0xf528f484
-1, 324833, 2944, 0xc34c9f64
-0, 327000, 393216, 0x87af758e
-1, 327837, 2944, 0xbb997537
-0, 330000, 393216, 0xc8bdafb7
-1, 330841, 2944, 0x3600da72
-0, 333000, 393216, 0x573afe93
-1, 333845, 2944, 0x343e15f4
-0, 336000, 393216, 0xb03cb8f5
-1, 336849, 2944, 0x17bc58a8
-0, 339000, 393216, 0x6e03ac71
-1, 339853, 2944, 0x3dcbd3ff
-0, 342000, 393216, 0xf919164e
-1, 342857, 2944, 0x1d422371
-0, 345000, 393216, 0x80059f3c
-1, 345861, 2944, 0xe2b83d9d
-0, 348000, 393216, 0xf4ea0b1a
-1, 348865, 2944, 0x65388409
-0, 351000, 393216, 0xe7720ffb
-1, 351869, 2944, 0xafbca269
-0, 354000, 393216, 0x1ec0cd56
-1, 354873, 2944, 0x2d00c0fb
-0, 357000, 393216, 0x2bc8cf18
-1, 357878, 2944, 0xbac9c503
-0, 360000, 393216, 0xe0bf17b5
-1, 360882, 2944, 0x9990768d
-0, 363000, 393216, 0x660247e1
-1, 363886, 2944, 0x8ba978be
-0, 366000, 393216, 0xcf66f2a9
-1, 366890, 2944, 0x5a44a2f5
-0, 369000, 393216, 0x5494d5ab
-1, 369894, 2944, 0xa4b6f3b8
-0, 372000, 393216, 0x2c02f2c4
-1, 372898, 2944, 0x631b6b9f
-0, 375000, 393216, 0x93fa3783
-1, 375902, 2944, 0x4c840923
-0, 378000, 393216, 0x4cc50633
-1, 378906, 2944, 0x7c105df3
-0, 381000, 393216, 0x3f179386
-1, 381910, 2944, 0x01bcb213
-0, 384000, 393216, 0x2bca9e1b
-1, 384914, 2944, 0x95cffbf7
-0, 387000, 393216, 0x3e4af867
-1, 387918, 2944, 0x170a9c3a
-0, 390000, 393216, 0x7e7df93c
-1, 390922, 2944, 0x59e09d61
-0, 393000, 393216, 0x577e4fb0
-1, 393927, 2944, 0x3ea0f205
-0, 396000, 393216, 0x34487f0a
-1, 396931, 2944, 0xd9ea1a3a
-0, 399000, 393216, 0x0937bcfc
-1, 399935, 2944, 0xaf32d704
-0, 402000, 393216, 0xa9e75a5e
-1, 402939, 2944, 0x2d473392
-0, 405000, 393216, 0xf7bc0c89
-1, 405943, 2944, 0x2a8ec544
-0, 408000, 393216, 0x06dacca6
-1, 408947, 2944, 0x883c8838
-0, 411000, 393216, 0x7baaa4bd
-1, 411951, 2944, 0xfaf4d789
-0, 414000, 393216, 0x95477f5f
-1, 414955, 2944, 0xcb315b65
-0, 417000, 393216, 0x51117526
-1, 417959, 2944, 0x980c93b0
-0, 420000, 393216, 0x69656d03
-1, 420963, 2944, 0x0819583b
-0, 423000, 393216, 0xcbd061bb
-1, 423967, 2944, 0xf126e5b5
-0, 426000, 393216, 0x8d1d5be2
-1, 426971, 2944, 0x88836255
-0, 429000, 393216, 0x43e55930
-1, 429976, 2944, 0xc8ae8ca8
-0, 432000, 393216, 0xb56f5872
-1, 432980, 2944, 0xf0750551
-0, 435000, 393216, 0x09a255e9
-1, 435984, 2944, 0x3dfe13a3
-0, 438000, 393216, 0xcaaa5456
-1, 438988, 2944, 0xf2aa957b
-0, 441000, 393216, 0xd267501f
-1, 441992, 2944, 0xa77b79a3
-0, 444000, 393216, 0x7bef4eca
-1, 444996, 2944, 0xb1038284
-0, 447000, 393216, 0x9aa94af3
-1, 448000, 2944, 0xf96be3ba
-0, 450000, 393216, 0xd39d4a29
-1, 451004, 2944, 0x1ae6e293
-0, 453000, 393216, 0x7a754960
-1, 454008, 2944, 0x2059d020
-0, 456000, 393216, 0x3f004921
-1, 457012, 2944, 0x7e6c9996
-0, 459000, 393216, 0x0f784ca8
-1, 460016, 2944, 0x3108b540
-0, 462000, 393216, 0x2a062c70
-1, 463020, 2944, 0x75133155
-0, 465000, 393216, 0x114ef770
-1, 466024, 2944, 0x59a19226
-0, 468000, 393216, 0xfb7673bf
-1, 469029, 2944, 0x3140c138
-0, 471000, 393216, 0xbaea88f7
-1, 472033, 2944, 0x7570d3be
-0, 474000, 393216, 0x6fdfe2ec
-1, 475037, 2944, 0x54fd4ff6
-0, 477000, 393216, 0xb7b2b398
-1, 478041, 2944, 0x23bcf6dc
-0, 480000, 393216, 0x14ba127e
-1, 481045, 2944, 0x2d26489b
-0, 483000, 393216, 0x660b3041
-1, 484049, 2944, 0x4b37bf13
-0, 486000, 393216, 0xe3f3302a
-1, 487053, 2944, 0x12812ec9
-0, 489000, 393216, 0x34c7f1c9
-1, 490057, 2944, 0xc4a609dd
-0, 492000, 393216, 0xa8257bf4
-1, 493061, 2944, 0x5a8c5b20
-0, 495000, 393216, 0xd63fc649
-1, 496065, 2944, 0xd05d110f
-0, 498000, 393216, 0xf8e5b79c
-1, 499069, 2944, 0xceea6f1f
-0, 501000, 393216, 0xa67b52ab
-1, 502073, 2944, 0x4033b0a5
-0, 504000, 393216, 0xef8f9c74
-1, 505078, 2944, 0x101895ce
-0, 507000, 393216, 0x6d3aa6b6
-1, 508082, 2944, 0xd6c6809f
-0, 510000, 393216, 0x8c174ee6
-1, 511086, 2944, 0x197bda7e
-0, 513000, 393216, 0x2dfbc524
-1, 514090, 2944, 0x96fb3e4b
-0, 516000, 393216, 0x7d0808b6
-1, 517094, 2944, 0x12a6e3de
-0, 519000, 393216, 0x6cbdf6f5
-1, 520098, 2944, 0xfb80e466
-0, 522000, 393216, 0xfe39bc53
-1, 523102, 2944, 0xedb8c2fc
-0, 525000, 393216, 0xa3d869b0
-1, 526106, 1016, 0x30e56ca5
-0, 528000, 393216, 0x09f00057
-0, 531000, 393216, 0x6ba56343
-0, 534000, 393216, 0xb696ca3e
-0, 537000, 393216, 0x4eba0225
-0, 540000, 393216, 0xdd45464b
-0, 543000, 393216, 0x2909a9ea
-0, 546000, 393216, 0x12aa3f85
-0, 549000, 393216, 0x59421352
-0, 552000, 393216, 0x57ea0313
-0, 555000, 393216, 0x4e5f3a38
-0, 558000, 393216, 0x55bc932d
-0, 561000, 393216, 0x666ee55d
-0, 564000, 393216, 0xb0f84a69
-0, 567000, 393216, 0xad3ae63f
-0, 570000, 393216, 0x970fd47d
-0, 573000, 393216, 0x86c418e0
-0, 576000, 393216, 0x52c9ce50
-0, 579000, 393216, 0xd54c98c8
-0, 582000, 393216, 0xb40e5fea
-0, 585000, 393216, 0x2aa74875
-0, 588000, 393216, 0x305b251e
-0, 591000, 393216, 0xab8c0780
-0, 594000, 393216, 0x0101dd0e
-0, 597000, 393216, 0x23739cab
-0, 600000, 393216, 0xf05196a0
-0, 603000, 393216, 0x932d1e00
-0, 606000, 393216, 0x932d1e00
-0, 609000, 393216, 0x932d1e00
-0, 612000, 393216, 0x932d1e00
-0, 615000, 393216, 0x932d1e00
-0, 618000, 393216, 0x932d1e00
-0, 621000, 393216, 0x932d1e00
-0, 624000, 393216, 0x932d1e00
-0, 627000, 393216, 0x932d1e00
+#tb 0: 1/22050
+0, 0, 0, 7456, 29824, 0x77e265b7
+0, 7456, 7456, 736, 2944, 0x8dcdf50b
+0, 8192, 8192, 736, 2944, 0xb135cd2a
+0, 8928, 8928, 736, 2944, 0x54a6e73f
+0, 9664, 9664, 736, 2944, 0x050ccd4e
+0, 10400, 10400, 736, 2944, 0x6b68db44
+0, 11136, 11136, 736, 2944, 0x55d1f308
+0, 11872, 11872, 736, 2944, 0x7e92f50b
+0, 12608, 12608, 736, 2944, 0xe9e91eed
+0, 13344, 13344, 736, 2944, 0x80af2ce0
+0, 14080, 14080, 736, 2944, 0xc67ffb07
+0, 14816, 14816, 736, 2944, 0x7aaded27
+0, 15552, 15552, 736, 2944, 0x14a024fd
+0, 16288, 16288, 736, 2944, 0x26e8df1f
+0, 17024, 17024, 736, 2944, 0x2688df44
+0, 17760, 17760, 736, 2944, 0x4b9cdd33
+0, 18496, 18496, 736, 2944, 0x10c2f11c
+0, 19232, 19232, 736, 2944, 0xc4e3ad6d
+0, 19968, 19968, 736, 2944, 0xbeb1a78e
+0, 20704, 20704, 736, 2944, 0x283d4e7f
+0, 21440, 21440, 736, 2944, 0x4acf65e0
+0, 22176, 22176, 736, 2944, 0x0ca29b8c
+0, 22912, 22912, 736, 2944, 0x003fae34
+0, 23648, 23648, 736, 2944, 0x2acfec7e
+0, 24384, 24384, 736, 2944, 0xea6fc6fe
+0, 25120, 25120, 736, 2944, 0xf5daec2f
+0, 25856, 25856, 736, 2944, 0x8d33ed7a
+0, 26592, 26592, 736, 2944, 0xc328f984
+0, 27328, 27328, 736, 2944, 0x6e0b58d3
+0, 28064, 28064, 736, 2944, 0xe282dc3f
+0, 28800, 28800, 736, 2944, 0xbf9bf3e6
+0, 29536, 29536, 736, 2944, 0xd7b7d7e3
+0, 30272, 30272, 736, 2944, 0x4e87b6ab
+0, 31008, 31008, 736, 2944, 0x7b8ce8d6
+0, 31744, 31744, 736, 2944, 0xd42991a5
+0, 32480, 32480, 736, 2944, 0x452c98ca
+0, 33216, 33216, 736, 2944, 0x6d27832d
+0, 33952, 33952, 736, 2944, 0xa558720e
+0, 34688, 34688, 736, 2944, 0x0a31bec0
+0, 35424, 35424, 736, 2944, 0x28431384
+0, 36160, 36160, 736, 2944, 0xd5e9fb3d
+0, 36896, 36896, 736, 2944, 0x34f0e9f8
+0, 37632, 37632, 736, 2944, 0x979432df
+0, 38368, 38368, 736, 2944, 0xb00acd4d
+0, 39104, 39104, 736, 2944, 0x726bffd6
+0, 39840, 39840, 736, 2944, 0xa1f39a6d
+0, 40576, 40576, 736, 2944, 0xf6a8e30e
+0, 41312, 41312, 736, 2944, 0x608e9e06
+0, 42048, 42048, 736, 2944, 0x4ec58bc3
+0, 42784, 42784, 736, 2944, 0x6d5c8458
+0, 43520, 43520, 736, 2944, 0x76a0abbd
+0, 44256, 44256, 736, 2944, 0xf830e8a6
+0, 44992, 44992, 736, 2944, 0x1bdd7bec
+0, 45728, 45728, 736, 2944, 0x3c1bd187
+0, 46464, 46464, 736, 2944, 0xf52cf697
+0, 47200, 47200, 736, 2944, 0x8f65b773
+0, 47936, 47936, 736, 2944, 0xf8b5b598
+0, 48672, 48672, 736, 2944, 0xcd87d5ed
+0, 49408, 49408, 736, 2944, 0x672ac02a
+0, 50144, 50144, 736, 2944, 0x1d5d13ed
+0, 50880, 50880, 736, 2944, 0xe298e3d4
+0, 51616, 51616, 736, 2944, 0x3d2e9c32
+0, 52352, 52352, 736, 2944, 0xf3a39259
+0, 53088, 53088, 736, 2944, 0x930ae8f8
+0, 53824, 53824, 736, 2944, 0x8562aff7
+0, 54560, 54560, 736, 2944, 0x9cd6c6a7
+0, 55296, 55296, 736, 2944, 0x2709dc5c
+0, 56032, 56032, 736, 2944, 0xcbe31816
+0, 56768, 56768, 736, 2944, 0xd7876ec4
+0, 57504, 57504, 736, 2944, 0xc2468b6a
+0, 58240, 58240, 736, 2944, 0x76043e84
+0, 58976, 58976, 736, 2944, 0xd2c35bf0
+0, 59712, 59712, 736, 2944, 0x63de6061
+0, 60448, 60448, 736, 2944, 0xd8f6ed1d
+0, 61184, 61184, 736, 2944, 0xe034928a
+0, 61920, 61920, 736, 2944, 0xa044da74
+0, 62656, 62656, 736, 2944, 0xee410dba
+0, 63392, 63392, 736, 2944, 0x8e020c7c
+0, 64128, 64128, 736, 2944, 0x73057ddb
+0, 64864, 64864, 736, 2944, 0xdee5cc18
+0, 65600, 65600, 736, 2944, 0xf4d31dec
+0, 66336, 66336, 736, 2944, 0xe8131e1c
+0, 67072, 67072, 736, 2944, 0x8ae69c95
+0, 67808, 67808, 736, 2944, 0x791c0bf4
+0, 68544, 68544, 736, 2944, 0xd45a10db
+0, 69280, 69280, 736, 2944, 0x3a72b010
+0, 70016, 70016, 736, 2944, 0x6a4a0411
+0, 70752, 70752, 736, 2944, 0xd77ab7f5
+0, 71488, 71488, 736, 2944, 0xe3bf4fe5
+0, 72224, 72224, 736, 2944, 0x12db1be8
+0, 72960, 72960, 736, 2944, 0x345210b0
+0, 73696, 73696, 736, 2944, 0xcfc1f892
+0, 74432, 74432, 736, 2944, 0x5b0a80bb
+0, 75168, 75168, 736, 2944, 0x31ab1168
+0, 75904, 75904, 736, 2944, 0xd4a4bb0a
+0, 76640, 76640, 736, 2944, 0x8e211c8f
+0, 77376, 77376, 736, 2944, 0xcf464d50
+0, 78112, 78112, 736, 2944, 0xe74ff3d6
+0, 78848, 78848, 736, 2944, 0x6274635f
+0, 79584, 79584, 736, 2944, 0xc34c9f64
+0, 80320, 80320, 736, 2944, 0xbb997537
+0, 81056, 81056, 736, 2944, 0x3600da72
+0, 81792, 81792, 736, 2944, 0x343e15f4
+0, 82528, 82528, 736, 2944, 0x17bc58a8
+0, 83264, 83264, 736, 2944, 0x3dcbd3ff
+0, 84000, 84000, 736, 2944, 0x1d422371
+0, 84736, 84736, 736, 2944, 0xe2b83d9d
+0, 85472, 85472, 736, 2944, 0x65388409
+0, 86208, 86208, 736, 2944, 0xafbca269
+0, 86944, 86944, 736, 2944, 0x2d00c0fb
+0, 87680, 87680, 736, 2944, 0xbac9c503
+0, 88416, 88416, 736, 2944, 0x9990768d
+0, 89152, 89152, 736, 2944, 0x8ba978be
+0, 89888, 89888, 736, 2944, 0x5a44a2f5
+0, 90624, 90624, 736, 2944, 0xa4b6f3b8
+0, 91360, 91360, 736, 2944, 0x631b6b9f
+0, 92096, 92096, 736, 2944, 0x4c840923
+0, 92832, 92832, 736, 2944, 0x7c105df3
+0, 93568, 93568, 736, 2944, 0x01bcb213
+0, 94304, 94304, 736, 2944, 0x95cffbf7
+0, 95040, 95040, 736, 2944, 0x170a9c3a
+0, 95776, 95776, 736, 2944, 0x59e09d61
+0, 96512, 96512, 736, 2944, 0x3ea0f205
+0, 97248, 97248, 736, 2944, 0xd9ea1a3a
+0, 97984, 97984, 736, 2944, 0xaf32d704
+0, 98720, 98720, 736, 2944, 0x2d473392
+0, 99456, 99456, 736, 2944, 0x2a8ec544
+0, 100192, 100192, 736, 2944, 0x883c8838
+0, 100928, 100928, 736, 2944, 0xfaf4d789
+0, 101664, 101664, 736, 2944, 0xcb315b65
+0, 102400, 102400, 736, 2944, 0x980c93b0
+0, 103136, 103136, 736, 2944, 0x0819583b
+0, 103872, 103872, 736, 2944, 0xf126e5b5
+0, 104608, 104608, 736, 2944, 0x88836255
+0, 105344, 105344, 736, 2944, 0xc8ae8ca8
+0, 106080, 106080, 736, 2944, 0xf0750551
+0, 106816, 106816, 736, 2944, 0x3dfe13a3
+0, 107552, 107552, 736, 2944, 0xf2aa957b
+0, 108288, 108288, 736, 2944, 0xa77b79a3
+0, 109024, 109024, 736, 2944, 0xb1038284
+0, 109760, 109760, 736, 2944, 0xf96be3ba
+0, 110496, 110496, 736, 2944, 0x1ae6e293
+0, 111232, 111232, 736, 2944, 0x2059d020
+0, 111968, 111968, 736, 2944, 0x7e6c9996
+0, 112704, 112704, 736, 2944, 0x3108b540
+0, 113440, 113440, 736, 2944, 0x75133155
+0, 114176, 114176, 736, 2944, 0x59a19226
+0, 114912, 114912, 736, 2944, 0x3140c138
+0, 115648, 115648, 736, 2944, 0x7570d3be
+0, 116384, 116384, 736, 2944, 0x54fd4ff6
+0, 117120, 117120, 736, 2944, 0x23bcf6dc
+0, 117856, 117856, 736, 2944, 0x2d26489b
+0, 118592, 118592, 736, 2944, 0x4b37bf13
+0, 119328, 119328, 736, 2944, 0x12812ec9
+0, 120064, 120064, 736, 2944, 0xc4a609dd
+0, 120800, 120800, 736, 2944, 0x5a8c5b20
+0, 121536, 121536, 736, 2944, 0xd05d110f
+0, 122272, 122272, 736, 2944, 0xceea6f1f
+0, 123008, 123008, 736, 2944, 0x4033b0a5
+0, 123744, 123744, 736, 2944, 0x101895ce
+0, 124480, 124480, 736, 2944, 0xd6c6809f
+0, 125216, 125216, 736, 2944, 0x197bda7e
+0, 125952, 125952, 736, 2944, 0x96fb3e4b
+0, 126688, 126688, 736, 2944, 0x12a6e3de
+0, 127424, 127424, 736, 2944, 0xfb80e466
+0, 128160, 128160, 736, 2944, 0xedb8c2fc
+0, 128896, 128896, 254, 1016, 0x30e56ca5
diff --git a/gst-libs/ext/libav/tests/ref/fate/dpcm-interplay b/gst-libs/ext/libav/tests/ref/fate/dpcm-interplay
new file mode 100644
index 0000000..bda8a8f
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/dpcm-interplay
@@ -0,0 +1,125 @@
+#tb 0: 1/22050
+0, 0, 0, 1462, 5848, 0xea04292b
+0, 1462, 1462, 1472, 5888, 0x0e59e942
+0, 2934, 2934, 1472, 5888, 0x56d480f6
+0, 4406, 4406, 1472, 5888, 0xcb560b22
+0, 5878, 5878, 1472, 5888, 0xca26865b
+0, 7350, 7350, 1472, 5888, 0xa434392f
+0, 8822, 8822, 1472, 5888, 0xa0615fe4
+0, 10294, 10294, 1472, 5888, 0x85b241cd
+0, 11766, 11766, 1472, 5888, 0x2c417a43
+0, 13238, 13238, 1472, 5888, 0x2d5ed665
+0, 14710, 14710, 1472, 5888, 0x37267a2d
+0, 16182, 16182, 1472, 5888, 0x1f803c67
+0, 17654, 17654, 1472, 5888, 0xfb7940ef
+0, 19126, 19126, 1472, 5888, 0x1a5371e8
+0, 20598, 20598, 1472, 5888, 0x37e29b21
+0, 22070, 22070, 1462, 5848, 0x70065769
+0, 23532, 23532, 1472, 5888, 0xaf624f3d
+0, 25004, 25004, 1472, 5888, 0x8f5e5b57
+0, 26476, 26476, 1472, 5888, 0x93545968
+0, 27948, 27948, 1472, 5888, 0x915f268f
+0, 29420, 29420, 1472, 5888, 0x9cd48ac4
+0, 30892, 30892, 1472, 5888, 0x812c8e13
+0, 32364, 32364, 1472, 5888, 0xe794a2a7
+0, 33836, 33836, 1472, 5888, 0x4a056e4b
+0, 35308, 35308, 1472, 5888, 0xa3589992
+0, 36780, 36780, 1472, 5888, 0x19ea7ec5
+0, 38252, 38252, 1472, 5888, 0x422d5097
+0, 39724, 39724, 1472, 5888, 0xc9fd963f
+0, 41196, 41196, 1472, 5888, 0xc556a5ea
+0, 42668, 42668, 1472, 5888, 0x51557e0f
+0, 44140, 44140, 1462, 5848, 0x4903ad21
+0, 45602, 45602, 1472, 5888, 0xb1c85e85
+0, 47074, 47074, 1472, 5888, 0x68963d65
+0, 48546, 48546, 1472, 5888, 0x62a3124e
+0, 50018, 50018, 1472, 5888, 0x4ff1878f
+0, 51490, 51490, 1472, 5888, 0x8b09ac18
+0, 52962, 52962, 1472, 5888, 0x67d85338
+0, 54434, 54434, 1472, 5888, 0x82eca0a6
+0, 55906, 55906, 1472, 5888, 0x81a17eb8
+0, 57378, 57378, 1472, 5888, 0x7108478c
+0, 58850, 58850, 1472, 5888, 0xbfc18b09
+0, 60322, 60322, 1472, 5888, 0xad93711f
+0, 61794, 61794, 1472, 5888, 0xf8d25e39
+0, 63266, 63266, 1472, 5888, 0x41edd04e
+0, 64738, 64738, 1472, 5888, 0xa6557ee2
+0, 66210, 66210, 1462, 5848, 0xc14d5456
+0, 67672, 67672, 1472, 5888, 0x20a7821f
+0, 69144, 69144, 1472, 5888, 0x9f1a8f9d
+0, 70616, 70616, 1472, 5888, 0x2f3c6cc8
+0, 72088, 72088, 1472, 5888, 0x757c894a
+0, 73560, 73560, 1472, 5888, 0x483e98bb
+0, 75032, 75032, 1472, 5888, 0x84289c75
+0, 76504, 76504, 1472, 5888, 0xf79d5a91
+0, 77976, 77976, 1472, 5888, 0x395b5228
+0, 79448, 79448, 1472, 5888, 0x9c937a14
+0, 80920, 80920, 1472, 5888, 0x40c169cf
+0, 82392, 82392, 1472, 5888, 0x3e7f99b0
+0, 83864, 83864, 1472, 5888, 0xd4de993e
+0, 85336, 85336, 1472, 5888, 0xae856b09
+0, 86808, 86808, 1472, 5888, 0xa2369c95
+0, 88280, 88280, 1462, 5848, 0x992d516b
+0, 89742, 89742, 1472, 5888, 0xcd785ba9
+0, 91214, 91214, 1472, 5888, 0x55ea3bce
+0, 92686, 92686, 1472, 5888, 0xf06d4bbf
+0, 94158, 94158, 1472, 5888, 0x2a9d4c1a
+0, 95630, 95630, 1472, 5888, 0xd5e348a3
+0, 97102, 97102, 1472, 5888, 0x6431a24c
+0, 98574, 98574, 1472, 5888, 0x41f9908c
+0, 100046, 100046, 1472, 5888, 0x0ed99656
+0, 101518, 101518, 1472, 5888, 0x635a6392
+0, 102990, 102990, 1472, 5888, 0x690c750c
+0, 104462, 104462, 1472, 5888, 0xf9d97b23
+0, 105934, 105934, 1472, 5888, 0x75e1606b
+0, 107406, 107406, 1472, 5888, 0x1bcb43b0
+0, 108878, 108878, 1472, 5888, 0x48c295cb
+0, 110350, 110350, 1462, 5848, 0xe47f7b5d
+0, 111812, 111812, 1472, 5888, 0x20be7f3e
+0, 113284, 113284, 1472, 5888, 0x8c2428c4
+0, 114756, 114756, 1472, 5888, 0x851379af
+0, 116228, 116228, 1472, 5888, 0x5916647d
+0, 117700, 117700, 1472, 5888, 0xef9c6281
+0, 119172, 119172, 1472, 5888, 0x49660d32
+0, 120644, 120644, 1472, 5888, 0x62cf36a1
+0, 122116, 122116, 1472, 5888, 0x56dff39c
+0, 123588, 123588, 1472, 5888, 0x4e6b5b02
+0, 125060, 125060, 1472, 5888, 0xb8697067
+0, 126532, 126532, 1472, 5888, 0xcb4e2706
+0, 128004, 128004, 1472, 5888, 0x6eaa9669
+0, 129476, 129476, 1472, 5888, 0xfd9d7dba
+0, 130948, 130948, 1472, 5888, 0xfe137923
+0, 132420, 132420, 1462, 5848, 0x1931296f
+0, 133882, 133882, 1472, 5888, 0xa09a7c03
+0, 135354, 135354, 1472, 5888, 0xded9802d
+0, 136826, 136826, 1472, 5888, 0x9f6723b7
+0, 138298, 138298, 1472, 5888, 0x3ad02476
+0, 139770, 139770, 1472, 5888, 0xa1647e32
+0, 141242, 141242, 1472, 5888, 0x728672da
+0, 142714, 142714, 1472, 5888, 0x9c098090
+0, 144186, 144186, 1472, 5888, 0x32a65ea3
+0, 145658, 145658, 1472, 5888, 0xdde141d5
+0, 147130, 147130, 1472, 5888, 0x816c5fb4
+0, 148602, 148602, 1472, 5888, 0x75e17581
+0, 150074, 150074, 1472, 5888, 0x59035469
+0, 151546, 151546, 1472, 5888, 0x20d340cd
+0, 153018, 153018, 1472, 5888, 0xa89a8790
+0, 154490, 154490, 1462, 5848, 0x12b74c34
+0, 155952, 155952, 1472, 5888, 0xcd3b3bef
+0, 157424, 157424, 1472, 5888, 0xe5c44bf3
+0, 158896, 158896, 1472, 5888, 0xb82c4fa4
+0, 160368, 160368, 1472, 5888, 0x05b2443a
+0, 161840, 161840, 1472, 5888, 0x78028172
+0, 163312, 163312, 1472, 5888, 0xdfcac19a
+0, 164784, 164784, 1472, 5888, 0x0761a0b9
+0, 166256, 166256, 1472, 5888, 0x77d88607
+0, 167728, 167728, 1472, 5888, 0xdd7f4d77
+0, 169200, 169200, 1472, 5888, 0x366bf58a
+0, 170672, 170672, 1472, 5888, 0x9a3d59b5
+0, 172144, 172144, 1472, 5888, 0x16cb777f
+0, 173616, 173616, 1472, 5888, 0x1d4afe64
+0, 175088, 175088, 1472, 5888, 0xc0fe1e73
+0, 176560, 176560, 1462, 5848, 0xcceb69c8
+0, 178022, 178022, 1472, 5888, 0x89449643
+0, 179494, 179494, 1472, 5888, 0x5fe595b7
+0, 180966, 180966, 1472, 5888, 0x400a8c77
diff --git a/gst-libs/ext/libav/tests/ref/fate/dpx b/gst-libs/ext/libav/tests/ref/fate/dpx
index 9260977..fdb85ca 100644
--- a/gst-libs/ext/libav/tests/ref/fate/dpx
+++ b/gst-libs/ext/libav/tests/ref/fate/dpx
@@ -1 +1,2 @@
-0, 0, 2359296, 0x30d4d24f
+#tb 0: 1/25
+0, 0, 0, 1, 2359296, 0x30d4d24f
diff --git a/gst-libs/ext/libav/tests/ref/fate/dxa-feeble b/gst-libs/ext/libav/tests/ref/fate/dxa-feeble
index caea4c2..74b43dc 100644
--- a/gst-libs/ext/libav/tests/ref/fate/dxa-feeble
+++ b/gst-libs/ext/libav/tests/ref/fate/dxa-feeble
@@ -1,64 +1,21 @@
-0, 0, 921600, 0x0d03844f
-1, 0, 1000, 0x64cd9403
-1, 4082, 1000, 0xa4ef8a9d
-1, 8163, 1000, 0x75c19868
-0, 9000, 921600, 0x0d03844f
-1, 12245, 1000, 0x93db6f79
-1, 16327, 1000, 0x6835625d
-0, 18000, 921600, 0x649cdcea
-1, 20408, 1000, 0xb3affa8f
-1, 24490, 1000, 0x159fdcc8
-0, 27000, 921600, 0x649cdcea
-1, 28571, 1000, 0x79f9f7f1
-1, 32653, 1000, 0xd7d1131e
-0, 36000, 921600, 0x9c7f22e8
-1, 36735, 1000, 0x52a6f797
-1, 40816, 1000, 0x748202ca
-1, 44898, 1000, 0x0ef92449
-0, 45000, 921600, 0x9c7f22e8
-1, 48980, 1000, 0x6a3760ab
-1, 53061, 1000, 0xce5c5abf
-0, 54000, 921600, 0x3451514a
-1, 57143, 1000, 0x23396792
-1, 61224, 1000, 0xa5276238
-0, 63000, 921600, 0x3451514a
-1, 65306, 1000, 0x288adf1b
-1, 69388, 1000, 0xe7de6fb2
-0, 72000, 921600, 0x8f19f600
-1, 73469, 1000, 0x2c2c707f
-1, 77551, 1000, 0xd66d6daf
-0, 81000, 921600, 0x8f19f600
-1, 81633, 1000, 0xbcea7d64
-1, 85714, 1000, 0x766feea5
-1, 89796, 1000, 0xd2e1d63a
-0, 90000, 921600, 0x07e7445b
-1, 93878, 1000, 0x2f7ef4ed
-1, 97959, 1000, 0xb655cba4
-0, 99000, 921600, 0x07e7445b
-1, 102041, 1000, 0x4507d37b
-1, 106122, 1000, 0x0c57f794
-0, 108000, 921600, 0x873d1227
-1, 110204, 1000, 0x0ecbe5cc
-1, 114286, 1000, 0x9bf6e345
-0, 117000, 921600, 0x873d1227
-1, 118367, 1000, 0xc461443c
-1, 122449, 1000, 0xad9657bf
-0, 126000, 921600, 0xbef62d86
-1, 126531, 1000, 0x466fe91c
-1, 130612, 1000, 0x9ee377fe
-1, 134694, 1000, 0x09956428
-0, 135000, 921600, 0xbef62d86
-1, 138776, 1000, 0x9b285f0a
-1, 142857, 1000, 0x0a3e61a6
-0, 144000, 921600, 0xcf84fee4
-1, 146939, 1000, 0xacc25d6b
-1, 151020, 1000, 0x377be319
-0, 153000, 921600, 0xcf84fee4
-1, 155102, 1000, 0xe4890504
-1, 159184, 1000, 0xe90a6497
-0, 162000, 921600, 0x5639e670
-1, 163265, 1000, 0xd00fe950
-1, 167347, 1000, 0xf195eb44
-0, 171000, 921600, 0x5639e670
-1, 171429, 1000, 0xa491f3ef
-1, 175510, 1000, 0x2c036e18
+#tb 0: 1/10
+0, 0, 0, 1, 921600, 0x0d03844f
+0, 1, 1, 1, 921600, 0x0d03844f
+0, 2, 2, 1, 921600, 0x649cdcea
+0, 3, 3, 1, 921600, 0x649cdcea
+0, 4, 4, 1, 921600, 0x9c7f22e8
+0, 5, 5, 1, 921600, 0x9c7f22e8
+0, 6, 6, 1, 921600, 0x3451514a
+0, 7, 7, 1, 921600, 0x3451514a
+0, 8, 8, 1, 921600, 0x8f19f600
+0, 9, 9, 1, 921600, 0x8f19f600
+0, 10, 10, 1, 921600, 0x07e7445b
+0, 11, 11, 1, 921600, 0x07e7445b
+0, 12, 12, 1, 921600, 0x873d1227
+0, 13, 13, 1, 921600, 0x873d1227
+0, 14, 14, 1, 921600, 0xbef62d86
+0, 15, 15, 1, 921600, 0xbef62d86
+0, 16, 16, 1, 921600, 0xcf84fee4
+0, 17, 17, 1, 921600, 0xcf84fee4
+0, 18, 18, 1, 921600, 0x5639e670
+0, 19, 19, 1, 921600, 0x5639e670
diff --git a/gst-libs/ext/libav/tests/ref/fate/dxa-scummvm b/gst-libs/ext/libav/tests/ref/fate/dxa-scummvm
index 79bc1d0..308a896 100644
--- a/gst-libs/ext/libav/tests/ref/fate/dxa-scummvm
+++ b/gst-libs/ext/libav/tests/ref/fate/dxa-scummvm
@@ -1,12 +1,13 @@
-0, 0, 384000, 0xef37f34b
-0, 7500, 384000, 0xef37f34b
-0, 14999, 384000, 0xfca3cd8b
-0, 22499, 384000, 0xfca3cd8b
-0, 29999, 384000, 0x6dd34bb7
-0, 37499, 384000, 0x6dd34bb7
-0, 44998, 384000, 0xfd518717
-0, 52498, 384000, 0xfd518717
-0, 59998, 384000, 0x82db5c7b
-0, 67497, 384000, 0x82db5c7b
-0, 74997, 384000, 0xe280a5a6
-0, 82497, 384000, 0xe280a5a6
+#tb 0: 8333/100000
+0, 0, 0, 1, 384000, 0xef37f34b
+0, 1, 1, 1, 384000, 0xef37f34b
+0, 2, 2, 1, 384000, 0xfca3cd8b
+0, 3, 3, 1, 384000, 0xfca3cd8b
+0, 4, 4, 1, 384000, 0x6dd34bb7
+0, 5, 5, 1, 384000, 0x6dd34bb7
+0, 6, 6, 1, 384000, 0xfd518717
+0, 7, 7, 1, 384000, 0xfd518717
+0, 8, 8, 1, 384000, 0x82db5c7b
+0, 9, 9, 1, 384000, 0x82db5c7b
+0, 10, 10, 1, 384000, 0xe280a5a6
+0, 11, 11, 1, 384000, 0xe280a5a6
diff --git a/gst-libs/ext/libav/tests/ref/fate/dxtory b/gst-libs/ext/libav/tests/ref/fate/dxtory
index 5fab200..7d3ecbd 100644
--- a/gst-libs/ext/libav/tests/ref/fate/dxtory
+++ b/gst-libs/ext/libav/tests/ref/fate/dxtory
@@ -1 +1,3 @@
-0, 0, 1382400, 0x44373645
+#tb 0: 1/25
+#tb 1: 1/48000
+0, 0, 0, 1, 1382400, 0x44373645
diff --git a/gst-libs/ext/libav/tests/ref/fate/ea-cmv b/gst-libs/ext/libav/tests/ref/fate/ea-cmv
index 36d8889..18f2b3a 100644
--- a/gst-libs/ext/libav/tests/ref/fate/ea-cmv
+++ b/gst-libs/ext/libav/tests/ref/fate/ea-cmv
@@ -1,194 +1,195 @@
-0, 0, 120000, 0x34ac91d2
-0, 9000, 120000, 0x17150729
-0, 18000, 120000, 0xc3f510bb
-0, 27000, 120000, 0xb3b14a3b
-0, 36000, 120000, 0x26a7f3d1
-0, 45000, 120000, 0xd161af6f
-0, 54000, 120000, 0x459fc92d
-0, 63000, 120000, 0x05c3fa94
-0, 72000, 120000, 0x6630cd8c
-0, 81000, 120000, 0x60cd39d4
-0, 90000, 120000, 0xc8854d1c
-0, 99000, 120000, 0xe55e8e6d
-0, 108000, 120000, 0xbeab201f
-0, 117000, 120000, 0x70744b0b
-0, 126000, 120000, 0x80dea5d0
-0, 135000, 120000, 0x769bfa1c
-0, 144000, 120000, 0x04e25bbe
-0, 153000, 120000, 0x48abc5a5
-0, 162000, 120000, 0xda5c4e2a
-0, 171000, 120000, 0x8de96d38
-0, 180000, 120000, 0xe96418b0
-0, 189000, 120000, 0x1c2f272b
-0, 198000, 120000, 0x4b755804
-0, 207000, 120000, 0xc92f96fd
-0, 216000, 120000, 0x69e90ebb
-0, 225000, 120000, 0x78d4bd1a
-0, 234000, 120000, 0xaf2edf55
-0, 243000, 120000, 0x94161c78
-0, 252000, 120000, 0x1109094d
-0, 261000, 120000, 0xc61b0392
-0, 270000, 120000, 0xc157d003
-0, 279000, 120000, 0xf2747e7b
-0, 288000, 120000, 0xa36299c2
-0, 297000, 120000, 0x49bc788c
-0, 306000, 120000, 0x3bee336e
-0, 315000, 120000, 0xa316b9d1
-0, 324000, 120000, 0x5cc32e9c
-0, 333000, 120000, 0x9f7eca16
-0, 342000, 120000, 0x958e2988
-0, 351000, 120000, 0xebcba2f1
-0, 360000, 120000, 0x281f1e60
-0, 369000, 120000, 0x82256c4d
-0, 378000, 120000, 0xddc8be56
-0, 387000, 120000, 0x64ff2ed0
-0, 396000, 120000, 0x3e63ab02
-0, 405000, 120000, 0x43f78b37
-0, 414000, 120000, 0xb7cc62d4
-0, 423000, 120000, 0x694f1764
-0, 432000, 120000, 0x2264c483
-0, 441000, 120000, 0xb6680b4a
-0, 450000, 120000, 0x2a92626a
-0, 459000, 120000, 0x8da02509
-0, 468000, 120000, 0xa976c382
-0, 477000, 120000, 0x749e822b
-0, 486000, 120000, 0xe9e7fc8c
-0, 495000, 120000, 0xfdc05a0c
-0, 504000, 120000, 0x7d5a856d
-0, 513000, 120000, 0xcc344937
-0, 522000, 120000, 0x9d90bc67
-0, 531000, 120000, 0x3f527712
-0, 540000, 120000, 0xf0f57f97
-0, 549000, 120000, 0xc29535cd
-0, 558000, 120000, 0x9a64598b
-0, 567000, 120000, 0x0d1ddf7c
-0, 576000, 120000, 0xb580ec24
-0, 585000, 120000, 0xf0db5bbc
-0, 594000, 120000, 0x6b980b61
-0, 603000, 120000, 0xc29f30b5
-0, 612000, 120000, 0xaf2c4bcd
-0, 621000, 120000, 0x1e725645
-0, 630000, 120000, 0x295c4c96
-0, 639000, 120000, 0x7ea121a2
-0, 648000, 120000, 0xdb9e9cec
-0, 657000, 120000, 0x1da47c80
-0, 666000, 120000, 0x9d0c1345
-0, 675000, 120000, 0x88058527
-0, 684000, 120000, 0x46766aed
-0, 693000, 120000, 0xba520bd3
-0, 702000, 120000, 0x7fb6373c
-0, 711000, 120000, 0x05a86f4d
-0, 720000, 120000, 0x7fb47cbd
-0, 729000, 120000, 0x6814d8ca
-0, 738000, 120000, 0x9c13acb8
-0, 747000, 120000, 0xad0edbfe
-0, 756000, 120000, 0x352fde81
-0, 765000, 120000, 0xa654b386
-0, 774000, 120000, 0xd3b3dc72
-0, 783000, 120000, 0x01572668
-0, 792000, 120000, 0x30189e03
-0, 801000, 120000, 0x26126d30
-0, 810000, 120000, 0x4f376c7d
-0, 819000, 120000, 0xd3667bcf
-0, 828000, 120000, 0x0b46b3d5
-0, 837000, 120000, 0x893415ef
-0, 846000, 120000, 0x99a78749
-0, 855000, 120000, 0x6da0d8e9
-0, 864000, 120000, 0x22d8ceb6
-0, 873000, 120000, 0x67ef9be8
-0, 882000, 120000, 0xb696fb53
-0, 891000, 120000, 0x70339dab
-0, 900000, 120000, 0xc1876efa
-0, 909000, 120000, 0x80e78c92
-0, 918000, 120000, 0x18d2f2ac
-0, 927000, 120000, 0x28be9ae4
-0, 936000, 120000, 0xc3c2c190
-0, 945000, 120000, 0xd6a859d8
-0, 954000, 120000, 0x40b9046d
-0, 963000, 120000, 0x7f8d5999
-0, 972000, 120000, 0x89724027
-0, 981000, 120000, 0x4c15c988
-0, 990000, 120000, 0x812ebe08
-0, 999000, 120000, 0x273ef8e2
-0, 1008000, 120000, 0xe029de06
-0, 1017000, 120000, 0x5846127c
-0, 1026000, 120000, 0x6c5df8e3
-0, 1035000, 120000, 0x7424919f
-0, 1044000, 120000, 0xa8313015
-0, 1053000, 120000, 0x28878ab4
-0, 1062000, 120000, 0x126d0746
-0, 1071000, 120000, 0xee3f7138
-0, 1080000, 120000, 0xd4b2e0a1
-0, 1089000, 120000, 0x8d60bfff
-0, 1098000, 120000, 0x701c23d0
-0, 1107000, 120000, 0x1cbb5654
-0, 1116000, 120000, 0x0f5853e9
-0, 1125000, 120000, 0x2a5c3339
-0, 1134000, 120000, 0x86b00350
-0, 1143000, 120000, 0xe8cc6931
-0, 1152000, 120000, 0xf1cad983
-0, 1161000, 120000, 0xabcd8704
-0, 1170000, 120000, 0x89592f94
-0, 1179000, 120000, 0x100486d9
-0, 1188000, 120000, 0x60ef9e2d
-0, 1197000, 120000, 0x2485176a
-0, 1206000, 120000, 0x6b8c360d
-0, 1215000, 120000, 0xe2e1bf4f
-0, 1224000, 120000, 0xe17b65c3
-0, 1233000, 120000, 0x2a42821a
-0, 1242000, 120000, 0xbe9ddba7
-0, 1251000, 120000, 0x19f937fe
-0, 1260000, 120000, 0xb7e0c600
-0, 1269000, 120000, 0xfbf8c5f6
-0, 1278000, 120000, 0x93b62f93
-0, 1287000, 120000, 0xb6ddec93
-0, 1296000, 120000, 0xa04d031b
-0, 1305000, 120000, 0x61c986c0
-0, 1314000, 120000, 0x3516e54a
-0, 1323000, 120000, 0x3489eb2c
-0, 1332000, 120000, 0xb75a4827
-0, 1341000, 120000, 0x76031a80
-0, 1350000, 120000, 0x867c3969
-0, 1359000, 120000, 0x9b63a093
-0, 1368000, 120000, 0xcb253d8a
-0, 1377000, 120000, 0x354ba3b2
-0, 1386000, 120000, 0x4d5ead8c
-0, 1395000, 120000, 0x7b7029ae
-0, 1404000, 120000, 0x4765ab9d
-0, 1413000, 120000, 0x747cdee9
-0, 1422000, 120000, 0x20989b08
-0, 1431000, 120000, 0x3a957085
-0, 1440000, 120000, 0xdd49e8ad
-0, 1449000, 120000, 0x00e89719
-0, 1458000, 120000, 0x2822aa76
-0, 1467000, 120000, 0x492388f3
-0, 1476000, 120000, 0x4dffa6ee
-0, 1485000, 120000, 0xc382bb83
-0, 1494000, 120000, 0xb59aaa74
-0, 1503000, 120000, 0x7c7885d3
-0, 1512000, 120000, 0xc05ee219
-0, 1521000, 120000, 0xc3df6b73
-0, 1530000, 120000, 0x8ae31170
-0, 1539000, 120000, 0xb979fdce
-0, 1548000, 120000, 0xb8f9e407
-0, 1557000, 120000, 0x56675b80
-0, 1566000, 120000, 0x1aad1ce2
-0, 1575000, 120000, 0xa050a52b
-0, 1584000, 120000, 0x49f8c32f
-0, 1593000, 120000, 0x8e7f4d2c
-0, 1602000, 120000, 0x5c07f751
-0, 1611000, 120000, 0x67fa5523
-0, 1620000, 120000, 0xf38b933a
-0, 1629000, 120000, 0xb113e202
-0, 1638000, 120000, 0xb8d99ff4
-0, 1647000, 120000, 0x15ab6cc6
-0, 1656000, 120000, 0xd64a51c9
-0, 1665000, 120000, 0x2088b53c
-0, 1674000, 120000, 0xdd78d40a
-0, 1683000, 120000, 0x2fb58848
-0, 1692000, 120000, 0xf775d36a
-0, 1701000, 120000, 0xa03987e9
-0, 1710000, 120000, 0x457322ad
-0, 1719000, 120000, 0x0f6c3d1c
-0, 1728000, 120000, 0xbdf2f1a5
-0, 1737000, 120000, 0x5828ee1d
+#tb 0: 1/10
+0, 1, 1, 1, 120000, 0x34ac91d2
+0, 2, 2, 1, 120000, 0x17150729
+0, 3, 3, 1, 120000, 0xc3f510bb
+0, 4, 4, 1, 120000, 0xb3b14a3b
+0, 5, 5, 1, 120000, 0x26a7f3d1
+0, 6, 6, 1, 120000, 0xd161af6f
+0, 7, 7, 1, 120000, 0x459fc92d
+0, 8, 8, 1, 120000, 0x05c3fa94
+0, 9, 9, 1, 120000, 0x6630cd8c
+0, 10, 10, 1, 120000, 0x60cd39d4
+0, 11, 11, 1, 120000, 0xc8854d1c
+0, 12, 12, 1, 120000, 0xe55e8e6d
+0, 13, 13, 1, 120000, 0xbeab201f
+0, 14, 14, 1, 120000, 0x70744b0b
+0, 15, 15, 1, 120000, 0x80dea5d0
+0, 16, 16, 1, 120000, 0x769bfa1c
+0, 17, 17, 1, 120000, 0x04e25bbe
+0, 18, 18, 1, 120000, 0x48abc5a5
+0, 19, 19, 1, 120000, 0xda5c4e2a
+0, 20, 20, 1, 120000, 0x8de96d38
+0, 21, 21, 1, 120000, 0xe96418b0
+0, 22, 22, 1, 120000, 0x1c2f272b
+0, 23, 23, 1, 120000, 0x4b755804
+0, 24, 24, 1, 120000, 0xc92f96fd
+0, 25, 25, 1, 120000, 0x69e90ebb
+0, 26, 26, 1, 120000, 0x78d4bd1a
+0, 27, 27, 1, 120000, 0xaf2edf55
+0, 28, 28, 1, 120000, 0x94161c78
+0, 29, 29, 1, 120000, 0x1109094d
+0, 30, 30, 1, 120000, 0xc61b0392
+0, 31, 31, 1, 120000, 0xc157d003
+0, 32, 32, 1, 120000, 0xf2747e7b
+0, 33, 33, 1, 120000, 0xa36299c2
+0, 34, 34, 1, 120000, 0x49bc788c
+0, 35, 35, 1, 120000, 0x3bee336e
+0, 36, 36, 1, 120000, 0xa316b9d1
+0, 37, 37, 1, 120000, 0x5cc32e9c
+0, 38, 38, 1, 120000, 0x9f7eca16
+0, 39, 39, 1, 120000, 0x958e2988
+0, 40, 40, 1, 120000, 0xebcba2f1
+0, 41, 41, 1, 120000, 0x281f1e60
+0, 42, 42, 1, 120000, 0x82256c4d
+0, 43, 43, 1, 120000, 0xddc8be56
+0, 44, 44, 1, 120000, 0x64ff2ed0
+0, 45, 45, 1, 120000, 0x3e63ab02
+0, 46, 46, 1, 120000, 0x43f78b37
+0, 47, 47, 1, 120000, 0xb7cc62d4
+0, 48, 48, 1, 120000, 0x694f1764
+0, 49, 49, 1, 120000, 0x2264c483
+0, 51, 51, 1, 120000, 0xb6680b4a
+0, 52, 52, 1, 120000, 0x2a92626a
+0, 53, 53, 1, 120000, 0x8da02509
+0, 54, 54, 1, 120000, 0xa976c382
+0, 55, 55, 1, 120000, 0x749e822b
+0, 56, 56, 1, 120000, 0xe9e7fc8c
+0, 57, 57, 1, 120000, 0xfdc05a0c
+0, 58, 58, 1, 120000, 0x7d5a856d
+0, 59, 59, 1, 120000, 0xcc344937
+0, 60, 60, 1, 120000, 0x9d90bc67
+0, 61, 61, 1, 120000, 0x3f527712
+0, 62, 62, 1, 120000, 0xf0f57f97
+0, 63, 63, 1, 120000, 0xc29535cd
+0, 64, 64, 1, 120000, 0x9a64598b
+0, 65, 65, 1, 120000, 0x0d1ddf7c
+0, 66, 66, 1, 120000, 0xb580ec24
+0, 67, 67, 1, 120000, 0xf0db5bbc
+0, 68, 68, 1, 120000, 0x6b980b61
+0, 69, 69, 1, 120000, 0xc29f30b5
+0, 70, 70, 1, 120000, 0xaf2c4bcd
+0, 71, 71, 1, 120000, 0x1e725645
+0, 72, 72, 1, 120000, 0x295c4c96
+0, 73, 73, 1, 120000, 0x7ea121a2
+0, 74, 74, 1, 120000, 0xdb9e9cec
+0, 75, 75, 1, 120000, 0x1da47c80
+0, 76, 76, 1, 120000, 0x9d0c1345
+0, 77, 77, 1, 120000, 0x88058527
+0, 78, 78, 1, 120000, 0x46766aed
+0, 79, 79, 1, 120000, 0xba520bd3
+0, 80, 80, 1, 120000, 0x7fb6373c
+0, 81, 81, 1, 120000, 0x05a86f4d
+0, 82, 82, 1, 120000, 0x7fb47cbd
+0, 83, 83, 1, 120000, 0x6814d8ca
+0, 84, 84, 1, 120000, 0x9c13acb8
+0, 85, 85, 1, 120000, 0xad0edbfe
+0, 86, 86, 1, 120000, 0x352fde81
+0, 87, 87, 1, 120000, 0xa654b386
+0, 88, 88, 1, 120000, 0xd3b3dc72
+0, 89, 89, 1, 120000, 0x01572668
+0, 90, 90, 1, 120000, 0x30189e03
+0, 91, 91, 1, 120000, 0x26126d30
+0, 92, 92, 1, 120000, 0x4f376c7d
+0, 93, 93, 1, 120000, 0xd3667bcf
+0, 94, 94, 1, 120000, 0x0b46b3d5
+0, 95, 95, 1, 120000, 0x893415ef
+0, 96, 96, 1, 120000, 0x99a78749
+0, 97, 97, 1, 120000, 0x6da0d8e9
+0, 98, 98, 1, 120000, 0x22d8ceb6
+0, 99, 99, 1, 120000, 0x67ef9be8
+0, 100, 100, 1, 120000, 0xb696fb53
+0, 101, 101, 1, 120000, 0x70339dab
+0, 102, 102, 1, 120000, 0xc1876efa
+0, 103, 103, 1, 120000, 0x80e78c92
+0, 104, 104, 1, 120000, 0x18d2f2ac
+0, 105, 105, 1, 120000, 0x28be9ae4
+0, 106, 106, 1, 120000, 0xc3c2c190
+0, 107, 107, 1, 120000, 0xd6a859d8
+0, 108, 108, 1, 120000, 0x40b9046d
+0, 109, 109, 1, 120000, 0x7f8d5999
+0, 110, 110, 1, 120000, 0x89724027
+0, 111, 111, 1, 120000, 0x4c15c988
+0, 112, 112, 1, 120000, 0x812ebe08
+0, 113, 113, 1, 120000, 0x273ef8e2
+0, 114, 114, 1, 120000, 0xe029de06
+0, 115, 115, 1, 120000, 0x5846127c
+0, 116, 116, 1, 120000, 0x6c5df8e3
+0, 117, 117, 1, 120000, 0x7424919f
+0, 118, 118, 1, 120000, 0xa8313015
+0, 119, 119, 1, 120000, 0x28878ab4
+0, 120, 120, 1, 120000, 0x126d0746
+0, 121, 121, 1, 120000, 0xee3f7138
+0, 122, 122, 1, 120000, 0xd4b2e0a1
+0, 123, 123, 1, 120000, 0x8d60bfff
+0, 124, 124, 1, 120000, 0x701c23d0
+0, 125, 125, 1, 120000, 0x1cbb5654
+0, 126, 126, 1, 120000, 0x0f5853e9
+0, 127, 127, 1, 120000, 0x2a5c3339
+0, 128, 128, 1, 120000, 0x86b00350
+0, 129, 129, 1, 120000, 0xe8cc6931
+0, 130, 130, 1, 120000, 0xf1cad983
+0, 131, 131, 1, 120000, 0xabcd8704
+0, 132, 132, 1, 120000, 0x89592f94
+0, 133, 133, 1, 120000, 0x100486d9
+0, 134, 134, 1, 120000, 0x60ef9e2d
+0, 135, 135, 1, 120000, 0x2485176a
+0, 136, 136, 1, 120000, 0x6b8c360d
+0, 137, 137, 1, 120000, 0xe2e1bf4f
+0, 138, 138, 1, 120000, 0xe17b65c3
+0, 139, 139, 1, 120000, 0x2a42821a
+0, 140, 140, 1, 120000, 0xbe9ddba7
+0, 141, 141, 1, 120000, 0x19f937fe
+0, 142, 142, 1, 120000, 0xb7e0c600
+0, 143, 143, 1, 120000, 0xfbf8c5f6
+0, 144, 144, 1, 120000, 0x93b62f93
+0, 145, 145, 1, 120000, 0xb6ddec93
+0, 146, 146, 1, 120000, 0xa04d031b
+0, 147, 147, 1, 120000, 0x61c986c0
+0, 148, 148, 1, 120000, 0x3516e54a
+0, 149, 149, 1, 120000, 0x3489eb2c
+0, 150, 150, 1, 120000, 0xb75a4827
+0, 151, 151, 1, 120000, 0x76031a80
+0, 152, 152, 1, 120000, 0x867c3969
+0, 153, 153, 1, 120000, 0x9b63a093
+0, 154, 154, 1, 120000, 0xcb253d8a
+0, 155, 155, 1, 120000, 0x354ba3b2
+0, 156, 156, 1, 120000, 0x4d5ead8c
+0, 157, 157, 1, 120000, 0x7b7029ae
+0, 158, 158, 1, 120000, 0x4765ab9d
+0, 159, 159, 1, 120000, 0x747cdee9
+0, 160, 160, 1, 120000, 0x20989b08
+0, 161, 161, 1, 120000, 0x3a957085
+0, 162, 162, 1, 120000, 0xdd49e8ad
+0, 163, 163, 1, 120000, 0x00e89719
+0, 164, 164, 1, 120000, 0x2822aa76
+0, 165, 165, 1, 120000, 0x492388f3
+0, 166, 166, 1, 120000, 0x4dffa6ee
+0, 167, 167, 1, 120000, 0xc382bb83
+0, 168, 168, 1, 120000, 0xb59aaa74
+0, 169, 169, 1, 120000, 0x7c7885d3
+0, 170, 170, 1, 120000, 0xc05ee219
+0, 171, 171, 1, 120000, 0xc3df6b73
+0, 172, 172, 1, 120000, 0x8ae31170
+0, 173, 173, 1, 120000, 0xb979fdce
+0, 174, 174, 1, 120000, 0xb8f9e407
+0, 175, 175, 1, 120000, 0x56675b80
+0, 176, 176, 1, 120000, 0x1aad1ce2
+0, 177, 177, 1, 120000, 0xa050a52b
+0, 178, 178, 1, 120000, 0x49f8c32f
+0, 179, 179, 1, 120000, 0x8e7f4d2c
+0, 180, 180, 1, 120000, 0x5c07f751
+0, 181, 181, 1, 120000, 0x67fa5523
+0, 182, 182, 1, 120000, 0xf38b933a
+0, 183, 183, 1, 120000, 0xb113e202
+0, 184, 184, 1, 120000, 0xb8d99ff4
+0, 185, 185, 1, 120000, 0x15ab6cc6
+0, 186, 186, 1, 120000, 0xd64a51c9
+0, 187, 187, 1, 120000, 0x2088b53c
+0, 188, 188, 1, 120000, 0xdd78d40a
+0, 189, 189, 1, 120000, 0x2fb58848
+0, 190, 190, 1, 120000, 0xf775d36a
+0, 191, 191, 1, 120000, 0xa03987e9
+0, 192, 192, 1, 120000, 0x457322ad
+0, 193, 193, 1, 120000, 0x0f6c3d1c
+0, 194, 194, 1, 120000, 0xbdf2f1a5
+0, 195, 195, 1, 120000, 0x5828ee1d
diff --git a/gst-libs/ext/libav/tests/ref/fate/ea-dct b/gst-libs/ext/libav/tests/ref/fate/ea-dct
deleted file mode 100644
index 98a2817..0000000
--- a/gst-libs/ext/libav/tests/ref/fate/ea-dct
+++ /dev/null
@@ -1,267 +0,0 @@
-0, 0, 102144, 0x6edc83de
-1, 0, 5936, 0xea261a29
-0, 6000, 102144, 0xd0534fda
-1, 6057, 5824, 0x253df061
-0, 12000, 102144, 0x6447911f
-1, 12000, 5936, 0x603a5bd7
-0, 18000, 102144, 0xf21f3b46
-1, 18057, 5824, 0x9d283f59
-0, 24000, 102144, 0x0975077a
-1, 24000, 5936, 0x49323497
-0, 30000, 102144, 0xb9a12d8e
-1, 30057, 5824, 0x7c299939
-0, 36000, 102144, 0x17413513
-1, 36000, 5936, 0x9f918e9a
-0, 42000, 102144, 0x1e622a04
-1, 42057, 5824, 0x1226b534
-0, 48000, 102144, 0x7489224e
-1, 48000, 5936, 0xdd159326
-0, 54000, 102144, 0xae14956e
-1, 54057, 5824, 0x361ad10f
-0, 60000, 102144, 0x104fd3a0
-1, 60000, 5936, 0x6ccac9e3
-0, 66000, 102144, 0xea63a940
-1, 66057, 5824, 0x1861efef
-0, 72000, 102144, 0x0cf81588
-1, 72000, 5936, 0x5f718eb9
-0, 78000, 102144, 0xe4a5b2fd
-1, 78057, 5824, 0xd4ca72ba
-0, 84000, 102144, 0x0c9aaf77
-1, 84000, 5936, 0xbf2b27e6
-0, 90000, 102144, 0x065007d7
-1, 90057, 5824, 0xcb6f024e
-0, 96000, 102144, 0x54c0c29b
-1, 96000, 5936, 0x7dfb7e05
-0, 102000, 102144, 0x1114cb8e
-1, 102057, 5824, 0x80e16f13
-0, 108000, 102144, 0xe4270462
-1, 108000, 5936, 0x0fb59227
-0, 114000, 102144, 0x61e5b7fd
-1, 114057, 5824, 0x4d6f1fdb
-0, 120000, 102144, 0x7cbeaca6
-1, 120000, 5936, 0x505a5103
-0, 126000, 102144, 0xed92daa4
-1, 126057, 5824, 0x47ef4c13
-0, 132000, 102144, 0xd8654d0d
-1, 132000, 5936, 0xbe4795fb
-0, 138000, 102144, 0x854e842b
-1, 138057, 5824, 0xb82cc4ff
-0, 144000, 102144, 0x56407c3a
-1, 144000, 5936, 0xf7c6ab8d
-0, 150000, 102144, 0x17db3f90
-1, 150057, 5824, 0x1442f5e0
-0, 156000, 102144, 0x8b133b9a
-1, 156000, 5936, 0x64659389
-0, 162000, 102144, 0xe4899db9
-1, 162057, 5824, 0xdd81725c
-0, 168000, 102144, 0x579cf092
-1, 168000, 5936, 0x7f7c604f
-0, 174000, 102144, 0x19fa5062
-1, 174057, 5824, 0xafc77beb
-0, 180000, 102144, 0x71339792
-1, 180000, 5936, 0x24f88e4d
-0, 186000, 102144, 0x970e5c0c
-1, 186057, 5824, 0xa31956ca
-0, 192000, 102144, 0x84ee616a
-1, 192000, 5936, 0x958e02b9
-0, 198000, 102144, 0x1d6f9a23
-1, 198057, 5824, 0xcfc79890
-0, 204000, 102144, 0xc28e19db
-1, 204000, 5936, 0xc7e788ae
-0, 210000, 102144, 0x0e898967
-1, 210057, 5824, 0x4b6b1acc
-0, 216000, 102144, 0x52a8b671
-1, 216000, 5936, 0xa74496dc
-0, 222000, 102144, 0x3f45ea83
-1, 222057, 5824, 0x719e6171
-0, 228000, 102144, 0x7b0fc603
-1, 228000, 5936, 0x9346222d
-0, 234000, 102144, 0x14f94469
-1, 234057, 5824, 0x9e2a876e
-0, 240000, 102144, 0x5b9f37cc
-1, 240000, 5936, 0xeca6ea64
-0, 246000, 102144, 0xf902b7c7
-1, 246057, 5824, 0x07d8174f
-0, 252000, 102144, 0x326836e0
-1, 252000, 5936, 0x2df5aa6b
-0, 258000, 102144, 0x2e4aebba
-1, 258057, 5824, 0x314e7034
-0, 264000, 102144, 0xd10ae58c
-1, 264000, 5936, 0x5a328768
-0, 270000, 102144, 0xbd084ecf
-1, 270057, 5824, 0x32b92446
-0, 276000, 102144, 0xb2157c0a
-1, 276000, 5936, 0x20ecbc9b
-0, 282000, 102144, 0xd7f158d4
-1, 282057, 5824, 0x76019c14
-0, 288000, 102144, 0x3cf86462
-1, 288000, 5936, 0x8c3ef8a6
-0, 294000, 102144, 0x53ecddab
-1, 294057, 5824, 0xcdaab50b
-0, 300000, 102144, 0xcdaba8ef
-1, 300000, 5936, 0xb2f87f4f
-0, 306000, 102144, 0xab9ede18
-1, 306057, 5824, 0x70c26379
-0, 312000, 102144, 0xb6706e79
-1, 312000, 5936, 0x5691ecfd
-0, 318000, 102144, 0x76371069
-1, 318057, 5824, 0x61e208fe
-0, 324000, 102144, 0x3a365016
-1, 324000, 5936, 0x87d1a5e0
-0, 330000, 102144, 0x52177c09
-1, 330057, 5824, 0x02054cfd
-0, 336000, 102144, 0xc33eb4fb
-1, 336000, 5936, 0x22ff1c4b
-0, 342000, 102144, 0x16098436
-1, 342057, 5824, 0xc6d87fef
-0, 348000, 102144, 0x715d6a2b
-1, 348000, 5936, 0x9028bb3b
-0, 354000, 102144, 0xd3abc960
-1, 354057, 5824, 0xbadde406
-0, 360000, 102144, 0x7f34b0d4
-1, 360000, 5936, 0x6e88ddf1
-0, 366000, 102144, 0xe3219b9c
-1, 366057, 5824, 0x5bb8be6e
-0, 372000, 102144, 0x5fa54f54
-1, 372000, 5936, 0xe1f8d7fc
-0, 378000, 102144, 0x0fb746cb
-1, 378057, 5824, 0xc824e388
-0, 384000, 102144, 0xa6bd2da2
-1, 384000, 5936, 0x654371a9
-0, 390000, 102144, 0x04579119
-1, 390057, 5824, 0xae6ee9ec
-0, 396000, 102144, 0xda818691
-1, 396000, 5936, 0x9aa4550d
-0, 402000, 102144, 0xe9d44445
-1, 402057, 5824, 0xdce210ac
-0, 408000, 102144, 0x94868dc9
-1, 408000, 5936, 0xb12641c8
-0, 414000, 102144, 0x3ca52ce6
-1, 414057, 5824, 0x277e014b
-0, 420000, 102144, 0xd7eb4c4f
-1, 420000, 5936, 0xb0d262de
-0, 426000, 102144, 0xfcdfafca
-1, 426057, 5824, 0xf94d6f49
-0, 432000, 102144, 0x473a4a5a
-1, 432000, 5936, 0x3d7848cb
-0, 438000, 102144, 0xe5a5f3cb
-1, 438057, 5824, 0xe67fc08e
-0, 444000, 102144, 0x34070219
-1, 444000, 5936, 0x0475e0d6
-0, 450000, 102144, 0x0faa965a
-1, 450057, 5824, 0x8a9a4a2e
-0, 456000, 102144, 0xe2c6acda
-1, 456000, 5936, 0x82576204
-0, 462000, 102144, 0xe22776d5
-1, 462057, 5824, 0x3017b648
-0, 468000, 102144, 0x80d85602
-1, 468000, 5936, 0xca4c3e04
-0, 474000, 102144, 0x2f3fa190
-1, 474057, 5824, 0x340077d1
-0, 480000, 102144, 0x70b461b1
-1, 480000, 5936, 0x805bea6e
-0, 486000, 102144, 0x366c8b27
-1, 486057, 5824, 0x2cf6c87b
-0, 492000, 102144, 0x65cc0866
-1, 492000, 5936, 0x3635bc5f
-0, 498000, 102144, 0x903beb14
-1, 498057, 5824, 0x0d7a81c7
-0, 504000, 102144, 0xb6c5f5c7
-1, 504000, 5936, 0x26179764
-0, 510000, 102144, 0xaa813725
-1, 510057, 5824, 0xa0b2454f
-0, 516000, 102144, 0x014a84a0
-1, 516000, 5936, 0x91d24608
-0, 522000, 102144, 0xd286ece1
-1, 522057, 5824, 0x6509b3e1
-0, 528000, 102144, 0x48b1c27d
-1, 528000, 5936, 0xa0e3c9fc
-0, 534000, 102144, 0xa611ef42
-1, 534057, 5824, 0x18682a2f
-0, 540000, 102144, 0x98627584
-1, 540000, 5936, 0x89cea4ff
-0, 546000, 102144, 0x43de7c75
-1, 546057, 5824, 0x7dd22b85
-0, 552000, 102144, 0xa9e22c68
-1, 552000, 5936, 0x8b2eeb8d
-0, 558000, 102144, 0x84ac34d4
-1, 558057, 5824, 0x0c21af82
-0, 564000, 102144, 0x6abd00ba
-1, 564000, 5936, 0x9c5a748d
-0, 570000, 102144, 0x5d11066e
-1, 570057, 5824, 0x1dc72c5c
-0, 576000, 102144, 0xb6b083aa
-1, 576000, 5936, 0xe6129383
-0, 582000, 102144, 0x5d152a11
-1, 582057, 5824, 0x0a44312a
-0, 588000, 102144, 0x0c0aec67
-1, 588000, 5936, 0x7ed30640
-0, 594000, 102144, 0xa248bd10
-1, 594057, 5824, 0xede15f25
-0, 600000, 102144, 0x4e6c12cc
-1, 600000, 5936, 0x0096d0f3
-0, 606000, 102144, 0xca1d6753
-1, 606057, 5824, 0x13764b4b
-0, 612000, 102144, 0x116310c3
-1, 612000, 5936, 0xd4608756
-0, 618000, 102144, 0x16903cd0
-1, 618057, 5824, 0x254b5f2a
-0, 624000, 102144, 0x239adfed
-1, 624000, 5936, 0x7705b830
-0, 630000, 102144, 0x0970ce49
-1, 630057, 5824, 0x64a63d78
-0, 636000, 102144, 0xb628adc1
-1, 636000, 5936, 0xc02d81a6
-0, 642000, 102144, 0x473613f7
-1, 642057, 5824, 0xd239e55e
-0, 648000, 102144, 0x3eef3987
-1, 648000, 5936, 0x8018cd3a
-0, 654000, 102144, 0x935b99ca
-1, 654057, 5824, 0xf86b8a98
-0, 660000, 102144, 0xb9f4d6ee
-1, 660000, 5936, 0x2a0078bc
-0, 666000, 102144, 0xac811656
-1, 666057, 5824, 0x058d4e1b
-0, 672000, 102144, 0xd1f84af0
-1, 672000, 5936, 0xbc718309
-0, 678000, 102144, 0xf2fd25f4
-1, 678057, 5824, 0xaf6c29e5
-0, 684000, 102144, 0x935bbed9
-1, 684000, 5936, 0x80df004d
-0, 690000, 102144, 0x8c8c3e53
-1, 690057, 5824, 0xeca5aa57
-0, 696000, 102144, 0x24afc20f
-1, 696000, 5936, 0xb793a8f8
-0, 702000, 102144, 0xad20a451
-1, 702057, 5824, 0x70fa6aff
-0, 708000, 102144, 0xd1a0df13
-1, 708000, 5936, 0xda8d4cc6
-0, 714000, 102144, 0xb0ee53f8
-1, 714057, 5824, 0xa70088eb
-0, 720000, 102144, 0x08cdb591
-1, 720000, 5936, 0x1c0b0aab
-0, 726000, 102144, 0x89b985b0
-1, 726057, 5824, 0x234d2436
-0, 732000, 102144, 0xdd27d51f
-1, 732000, 5936, 0xf79d731e
-0, 738000, 102144, 0xa783fce0
-1, 738057, 5824, 0x5a4e454a
-0, 744000, 102144, 0xfe5602e8
-1, 744000, 5936, 0xccf6d042
-0, 750000, 102144, 0xfb989934
-1, 750057, 5824, 0x4e524d14
-0, 756000, 102144, 0xf857eb2b
-1, 756000, 5936, 0xf8f2fcc3
-0, 762000, 102144, 0x987a7098
-1, 762057, 5824, 0x08f12491
-0, 768000, 102144, 0xbc749f42
-1, 768000, 5936, 0x506e0a42
-0, 774000, 102144, 0x221e48a6
-1, 774057, 5824, 0x7cf05049
-0, 780000, 102144, 0x4c4b5da2
-1, 780000, 5936, 0xdeb9d295
-0, 786000, 102144, 0x32140027
-1, 786057, 5824, 0x758ef642
-0, 792000, 102144, 0xbeb4bf18
-1, 792000, 5936, 0x91903980
-0, 798000, 102144, 0x523012e5
diff --git a/gst-libs/ext/libav/tests/ref/fate/ea-mad b/gst-libs/ext/libav/tests/ref/fate/ea-mad
new file mode 100644
index 0000000..ce1df4a
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/ea-mad
@@ -0,0 +1,97 @@
+#tb 0: 1/90000
+0, 0, 0, 0, 535680, 0x889c32cf
+0, 2970, 2970, 0, 535680, 0x0b1ef044
+0, 5940, 5940, 0, 535680, 0xa7d0818b
+0, 8910, 8910, 0, 535680, 0xf392e4e1
+0, 11880, 11880, 0, 535680, 0x08480c69
+0, 14850, 14850, 0, 535680, 0x2b8af1ed
+0, 17820, 17820, 0, 535680, 0x0d58e062
+0, 20790, 20790, 0, 535680, 0xd140ced0
+0, 23760, 23760, 0, 535680, 0xbd0e6652
+0, 26730, 26730, 0, 535680, 0xdc2f2a6b
+0, 29700, 29700, 0, 535680, 0x97c31a38
+0, 32670, 32670, 0, 535680, 0x1a2bdf38
+0, 35640, 35640, 0, 535680, 0xb3af3ac4
+0, 38610, 38610, 0, 535680, 0x07a52577
+0, 41580, 41580, 0, 535680, 0x78407368
+0, 44550, 44550, 0, 535680, 0xd2a9efc3
+0, 47520, 47520, 0, 535680, 0x36df2f29
+0, 50490, 50490, 0, 535680, 0x9821d8f7
+0, 53460, 53460, 0, 535680, 0xf64321aa
+0, 56430, 56430, 0, 535680, 0x53e4d9aa
+0, 59400, 59400, 0, 535680, 0xdbd6f853
+0, 62370, 62370, 0, 535680, 0x5d40cf8b
+0, 65340, 65340, 0, 535680, 0xe624af9d
+0, 68310, 68310, 0, 535680, 0xd9dbb4cd
+0, 71280, 71280, 0, 535680, 0xf14e72ec
+0, 74250, 74250, 0, 535680, 0xb35c18f6
+0, 77220, 77220, 0, 535680, 0xc96d7757
+0, 80190, 80190, 0, 535680, 0xdfb937df
+0, 83160, 83160, 0, 535680, 0x40cd71d7
+0, 86130, 86130, 0, 535680, 0x15e176d6
+0, 89100, 89100, 0, 535680, 0x7f891b24
+0, 92070, 92070, 0, 535680, 0xb87a8c32
+0, 95040, 95040, 0, 535680, 0x0c01541f
+0, 98010, 98010, 0, 535680, 0x9eee99b3
+0, 100980, 100980, 0, 535680, 0xd65eb689
+0, 103950, 103950, 0, 535680, 0x6e733cfa
+0, 106920, 106920, 0, 535680, 0xac536670
+0, 109890, 109890, 0, 535680, 0x002275b8
+0, 112860, 112860, 0, 535680, 0x6a5385cb
+0, 115830, 115830, 0, 535680, 0xd129ade3
+0, 118800, 118800, 0, 535680, 0x32cab5d7
+0, 121770, 121770, 0, 535680, 0x08be1c8f
+0, 124740, 124740, 0, 535680, 0x59e1fba0
+0, 127710, 127710, 0, 535680, 0x138aee3a
+0, 130680, 130680, 0, 535680, 0x4cfbcd5e
+0, 133650, 133650, 0, 535680, 0xf6cf0fb4
+0, 136620, 136620, 0, 535680, 0xb13a06de
+0, 139590, 139590, 0, 535680, 0x59176f00
+0, 142560, 142560, 0, 535680, 0xf84b4ca3
+0, 145530, 145530, 0, 535680, 0x7fd09f73
+0, 148500, 148500, 0, 535680, 0x3be383b8
+0, 151470, 151470, 0, 535680, 0xa7118e51
+0, 154440, 154440, 0, 535680, 0xbd83120c
+0, 157410, 157410, 0, 535680, 0x3bc9d256
+0, 160380, 160380, 0, 535680, 0xb6c87f87
+0, 163350, 163350, 0, 535680, 0xe80d110a
+0, 166320, 166320, 0, 535680, 0xb3a83362
+0, 169290, 169290, 0, 535680, 0xfb39eb52
+0, 172260, 172260, 0, 535680, 0xbf6e1220
+0, 175230, 175230, 0, 535680, 0x9ecdfbae
+0, 178200, 178200, 0, 535680, 0x069a65f5
+0, 181170, 181170, 0, 535680, 0x206e372c
+0, 184140, 184140, 0, 535680, 0x58c83dd4
+0, 187110, 187110, 0, 535680, 0xc3562b03
+0, 190080, 190080, 0, 535680, 0xd1ed85a0
+0, 193050, 193050, 0, 535680, 0xb6205f4b
+0, 196020, 196020, 0, 535680, 0xaedf8bfa
+0, 198990, 198990, 0, 535680, 0xa48d5dea
+0, 201960, 201960, 0, 535680, 0xff82e7c1
+0, 204930, 204930, 0, 535680, 0xc9560222
+0, 207900, 207900, 0, 535680, 0x0fafa549
+0, 210870, 210870, 0, 535680, 0x8d556ccb
+0, 213840, 213840, 0, 535680, 0x802aac1f
+0, 216810, 216810, 0, 535680, 0x7d0fa168
+0, 219780, 219780, 0, 535680, 0x1a9255c9
+0, 222750, 222750, 0, 535680, 0xb4ec7e35
+0, 225720, 225720, 0, 535680, 0x48fac072
+0, 228690, 228690, 0, 535680, 0x1e260135
+0, 231660, 231660, 0, 535680, 0xce4d5079
+0, 234630, 234630, 0, 535680, 0x13e5e4ed
+0, 237600, 237600, 0, 535680, 0x592305ec
+0, 240570, 240570, 0, 535680, 0x9e227508
+0, 243540, 243540, 0, 535680, 0x1d37e5ea
+0, 246510, 246510, 0, 535680, 0x7eae7692
+0, 249480, 249480, 0, 535680, 0xf452e4b9
+0, 252450, 252450, 0, 535680, 0x1460e7e9
+0, 255420, 255420, 0, 535680, 0xc6d8a638
+0, 258390, 258390, 0, 535680, 0x854f5fb0
+0, 261360, 261360, 0, 535680, 0x854f5fb0
+0, 264330, 264330, 0, 535680, 0x70a02d87
+0, 267300, 267300, 0, 535680, 0x9a4ad464
+0, 270270, 270270, 0, 535680, 0x9a4ad464
+0, 273240, 273240, 0, 535680, 0x9a4ad464
+0, 276210, 276210, 0, 535680, 0x9a4ad464
+0, 279180, 279180, 0, 535680, 0x9a4ad464
+0, 282150, 282150, 0, 535680, 0x9a4ad464
diff --git a/gst-libs/ext/libav/tests/ref/fate/ea-mad-pcm-planar b/gst-libs/ext/libav/tests/ref/fate/ea-mad-pcm-planar
deleted file mode 100644
index dc47354..0000000
--- a/gst-libs/ext/libav/tests/ref/fate/ea-mad-pcm-planar
+++ /dev/null
@@ -1,292 +0,0 @@
-0, 0, 196608, 0x75d22292
-1, 0, 5884, 0x00000000
-0, 2970, 196608, 0x75d22292
-1, 3002, 5884, 0x00000000
-0, 5940, 196608, 0x75d22292
-1, 6004, 5888, 0x00000000
-0, 8910, 196608, 0x75d22292
-1, 9008, 5884, 0x00000000
-0, 11880, 196608, 0x75d22292
-1, 12010, 5888, 0x00000000
-0, 14850, 196608, 0x75d22292
-1, 15014, 5884, 0x00000000
-0, 17820, 196608, 0x75d22292
-1, 18016, 5888, 0x00000000
-0, 20790, 196608, 0x75d22292
-1, 21020, 5884, 0x00000000
-0, 23760, 196608, 0x75d22292
-1, 24022, 5888, 0x00000000
-0, 26730, 196608, 0xd3f66981
-1, 27027, 5884, 0x00000000
-0, 29700, 196608, 0xed37c4c3
-1, 30029, 5888, 0x174b2bd4
-0, 32670, 196608, 0x6ce01dc4
-1, 33033, 5884, 0xfab9563d
-0, 35640, 196608, 0x2874fc9a
-1, 36035, 5888, 0x0129a4f5
-0, 38610, 196608, 0x9b65bbc8
-1, 39039, 5884, 0xf12b15dd
-0, 41580, 196608, 0x8f9af811
-1, 42041, 5888, 0x60c8c922
-0, 44550, 196608, 0x04aeb0b0
-1, 45045, 5884, 0x85693c81
-0, 47520, 196608, 0x0df037a1
-1, 48047, 5888, 0xcefcf0e0
-0, 50490, 196608, 0xa32c5515
-1, 51051, 5884, 0x243974ff
-0, 53460, 196608, 0xf3b11a1b
-1, 54053, 5884, 0x9101b901
-0, 56430, 196608, 0xaf945190
-1, 57055, 5888, 0xe3c68cb9
-0, 59400, 196608, 0xabee8b24
-1, 60059, 5884, 0x80f2ff5f
-0, 62370, 196608, 0x1d7b3df0
-1, 63061, 5888, 0xfc2d19dc
-0, 65340, 196608, 0x1347d787
-1, 66065, 5884, 0xb6e0af21
-0, 68310, 196608, 0x654c4a9b
-1, 69067, 5888, 0x476e74ff
-0, 71280, 196608, 0xa2a6596a
-1, 72071, 5884, 0x3921bc7f
-0, 74250, 196608, 0x50d04d8e
-1, 75073, 5888, 0x44180a3f
-0, 77220, 196608, 0x4f9f9352
-1, 78078, 5884, 0x01b5a119
-0, 80190, 196608, 0xbb358281
-1, 81080, 5888, 0xdd7ad621
-0, 83160, 196608, 0xcd91a50a
-1, 84084, 5884, 0xadabe898
-0, 86130, 196608, 0xb665bb76
-1, 87086, 5888, 0x2141ff8e
-0, 89100, 196608, 0xec924ee7
-1, 90090, 5884, 0xfb5118fb
-0, 92070, 196608, 0x9c4aa4ad
-1, 93092, 5888, 0x06d31461
-0, 95040, 196608, 0x27ccdf86
-1, 96096, 5884, 0x80ce34c1
-0, 98010, 196608, 0x93778cc8
-1, 99098, 5888, 0x72bf392f
-0, 100980, 196608, 0x3d68e826
-1, 102102, 5884, 0x9d9237cf
-0, 103950, 196608, 0x9240b751
-1, 105104, 5884, 0xf5c9ce23
-0, 106920, 196608, 0xd77ec46b
-1, 108106, 5888, 0x12a05dc5
-0, 109890, 196608, 0x4a303ef1
-1, 111110, 5884, 0xd3ed5d4b
-0, 112860, 196608, 0x2508bacf
-1, 114112, 5888, 0x06557401
-0, 115830, 196608, 0xb74cb5bf
-1, 117116, 5884, 0x53d81662
-0, 118800, 196608, 0x9c4a9719
-1, 120118, 5888, 0xd7e0d98d
-0, 121770, 196608, 0xc34a7924
-1, 123122, 5884, 0xdf00752e
-0, 124740, 196608, 0x9d8428bd
-1, 126124, 5888, 0x82f1d7a9
-0, 127710, 196608, 0x019eebf7
-1, 129129, 5884, 0x9cb3aba9
-0, 130680, 196608, 0x36e58d6b
-1, 132131, 5888, 0xd6f98e91
-0, 133650, 196608, 0xc7038ceb
-1, 135135, 5884, 0xaa7f7c09
-0, 136620, 196608, 0xb041fd50
-1, 138137, 5888, 0xb97a82a7
-0, 139590, 196608, 0x76934674
-1, 141141, 5884, 0x375a3d53
-0, 142560, 196608, 0x22afa88b
-1, 144143, 5888, 0xa0a460cb
-0, 145530, 196608, 0x22158960
-1, 147147, 5884, 0xe05efbab
-0, 148500, 196608, 0x75ab0895
-1, 150149, 5888, 0x95e151f0
-0, 151470, 196608, 0xcaab6c6d
-1, 153153, 5884, 0x44ac688d
-0, 154440, 196608, 0xe64d8b91
-1, 156155, 5884, 0xfc6d929f
-0, 157410, 196608, 0x1e8aa17a
-1, 159157, 5888, 0x6406c5f1
-0, 160380, 196608, 0x7dd94fdb
-1, 162161, 5884, 0x4ee9e48c
-0, 163350, 196608, 0xab74566c
-1, 165163, 5888, 0xd55d43d0
-0, 166320, 196608, 0xec962966
-1, 168167, 5884, 0xcae69baf
-0, 169290, 196608, 0xf5bfd751
-1, 171169, 5888, 0x4c01f1f5
-0, 172260, 196608, 0xc7f46e0e
-1, 174173, 5884, 0xf7d6dab6
-0, 175230, 196608, 0xe641f676
-1, 177176, 5888, 0x1affdeb5
-0, 178200, 196608, 0xea7c7b75
-1, 180180, 5884, 0x6db72487
-0, 181170, 196608, 0x69120371
-1, 183182, 5888, 0x4f344e49
-0, 184140, 196608, 0xb2319175
-1, 186186, 5884, 0x2df3827b
-0, 187110, 196608, 0xd2d73b56
-1, 189188, 5888, 0x1d1fc283
-0, 190080, 196608, 0x74aafac0
-1, 192192, 5884, 0x22eb1dd5
-0, 193050, 196608, 0x15e8ddbc
-1, 195194, 5888, 0x734e7093
-0, 196020, 196608, 0xd4e2c90c
-1, 198198, 5884, 0x357c9531
-0, 198990, 196608, 0x86eaf31c
-1, 201200, 5888, 0x108c102d
-0, 201960, 196608, 0x8004291b
-1, 204204, 5884, 0x96ad26c6
-0, 204930, 196608, 0xbbf6954a
-1, 207206, 5888, 0x7bea1996
-0, 207900, 196608, 0x2f24f0e1
-1, 210210, 5884, 0x124a1f8e
-0, 210870, 196608, 0x59d56dfb
-1, 213212, 5884, 0x08d272fb
-0, 213840, 196608, 0x1377c9cb
-1, 216214, 5888, 0x88832c6b
-0, 216810, 196608, 0x07582cc3
-1, 219218, 5884, 0xedf41493
-0, 219780, 196608, 0xa5a853fc
-1, 222220, 5888, 0xc4f226d7
-0, 222750, 196608, 0x3b01856a
-1, 225224, 5884, 0x97730397
-0, 225720, 196608, 0x64927496
-1, 228227, 5888, 0xbc3540e9
-0, 228690, 196608, 0xf24c6f8a
-1, 231231, 5884, 0x8adfa135
-0, 231660, 196608, 0xc92c3c46
-1, 234233, 5888, 0x6d4be121
-0, 234630, 196608, 0xa50d07fb
-1, 237237, 5884, 0xc3daea85
-0, 237600, 196608, 0xb1d4a092
-1, 240239, 5888, 0x5498e9f0
-0, 240570, 196608, 0x20c5526b
-1, 243243, 5884, 0xa0eb691f
-0, 243540, 196608, 0x6127fbbd
-1, 246245, 5888, 0x775c7c59
-0, 246510, 196608, 0xc168a747
-1, 249249, 5884, 0x9f108fd1
-0, 249480, 196608, 0x9c0d3241
-1, 252251, 5888, 0x72d53062
-0, 252450, 196608, 0x5466dd21
-1, 255255, 5884, 0x13a93faa
-0, 255420, 196608, 0x5bba67cc
-1, 258257, 5888, 0x64773c8e
-0, 258390, 196608, 0x4c1a1c18
-1, 261261, 5884, 0xaf696999
-0, 261360, 196608, 0x22c0a537
-1, 264263, 5884, 0xf45e7e81
-0, 264330, 196608, 0x4ffc5ea6
-1, 267265, 5888, 0x00000000
-0, 267300, 196608, 0x7e8e2395
-1, 270269, 5884, 0x00000000
-0, 270270, 196608, 0xa3b6f198
-0, 273240, 196608, 0xf6aac4d1
-1, 273271, 5888, 0x00000000
-0, 276210, 196608, 0x1a6ea9ee
-1, 276276, 5884, 0x00000000
-0, 279180, 196608, 0xfd729443
-1, 279278, 5888, 0x00000000
-0, 282150, 196608, 0xc6a69012
-1, 282282, 5884, 0x00000000
-0, 285120, 196608, 0x576f9270
-1, 285284, 5888, 0x00000000
-0, 288090, 196608, 0x0d539fe5
-1, 288288, 5884, 0x00000000
-0, 291060, 196608, 0x191db7d6
-1, 291290, 5888, 0x00000000
-0, 294030, 196608, 0x80cddedd
-1, 294294, 5884, 0x00000000
-0, 297000, 196608, 0xccf5fd39
-1, 297296, 5888, 0x00000000
-0, 299970, 196608, 0x521d33b6
-1, 300300, 5884, 0x00000000
-0, 302940, 196608, 0xb75e59ee
-1, 303302, 5888, 0x00000000
-0, 305910, 196608, 0xbba68972
-1, 306306, 5884, 0x00000000
-0, 308880, 196608, 0x368fb86a
-1, 309308, 5888, 0x00000000
-0, 311850, 196608, 0x99e6e94a
-1, 312312, 5884, 0x00000000
-0, 314820, 196608, 0xe4021296
-1, 315314, 5884, 0x00000000
-0, 317790, 196608, 0xbc993b10
-1, 318316, 5888, 0x00000000
-0, 320760, 196608, 0xf2765d22
-1, 321320, 5884, 0x00000000
-0, 323730, 196608, 0xc6257db5
-1, 324322, 5888, 0x00000000
-0, 326700, 196608, 0xa832782f
-1, 327327, 5884, 0x00000000
-0, 329670, 196608, 0xa832782f
-1, 330329, 5888, 0x00000000
-0, 332640, 196608, 0xa832782f
-1, 333333, 5884, 0x00000000
-0, 335610, 196608, 0xa832782f
-1, 336335, 5888, 0x00000000
-0, 338580, 196608, 0xa832782f
-1, 339339, 5884, 0x00000000
-0, 341550, 196608, 0xa832782f
-1, 342341, 5888, 0x00000000
-0, 344520, 196608, 0xa832782f
-1, 345345, 5884, 0x00000000
-0, 347490, 196608, 0xa832782f
-1, 348347, 5888, 0x00000000
-0, 350460, 196608, 0xa832782f
-1, 351351, 5884, 0xfe4b2bd4
-0, 353430, 196608, 0xa832782f
-1, 354353, 5888, 0x00000000
-0, 356400, 196608, 0xa832782f
-1, 357357, 5884, 0x00000000
-0, 359370, 196608, 0xa832782f
-1, 360359, 5888, 0x00000000
-0, 362340, 196608, 0xa832782f
-1, 363363, 5884, 0x00000000
-0, 365310, 196608, 0xa832782f
-1, 366365, 5884, 0x00000000
-0, 368280, 196608, 0xa832782f
-1, 369367, 5888, 0x00000000
-0, 371250, 196608, 0xa832782f
-1, 372371, 5884, 0x00000000
-0, 374220, 196608, 0xa832782f
-1, 375373, 5888, 0x00000000
-0, 377190, 196608, 0xa832782f
-1, 378378, 5884, 0x00000000
-0, 380160, 196608, 0xa832782f
-1, 381380, 5888, 0x00000000
-0, 383130, 196608, 0xa832782f
-1, 384384, 5884, 0x00000000
-0, 386100, 196608, 0xa832782f
-1, 387386, 5888, 0x00000000
-0, 389070, 196608, 0xa832782f
-1, 390390, 5884, 0x00000000
-0, 392040, 196608, 0xa832782f
-1, 393392, 5888, 0x00000000
-0, 395010, 196608, 0xa832782f
-1, 396396, 5884, 0x00000000
-0, 397980, 196608, 0xa832782f
-1, 399398, 5888, 0x00000000
-0, 400950, 196608, 0xa832782f
-1, 402402, 5884, 0x00000000
-0, 403920, 196608, 0xa832782f
-1, 405404, 5888, 0x00000000
-0, 406890, 196608, 0xa832782f
-1, 408408, 5884, 0x00000000
-0, 409860, 196608, 0xa832782f
-1, 411410, 5888, 0x00000000
-0, 412830, 196608, 0xa832782f
-1, 414414, 5884, 0x00000000
-0, 415800, 196608, 0xa832782f
-1, 417416, 5888, 0x00000000
-0, 418770, 196608, 0xa832782f
-1, 420420, 5884, 0x00000000
-0, 421740, 196608, 0xa832782f
-1, 423422, 5048, 0x00000000
-0, 424710, 196608, 0xa832782f
-0, 427680, 196608, 0xa832782f
-0, 430650, 196608, 0xa832782f
-0, 433620, 196608, 0xa832782f
-0, 436590, 196608, 0xa832782f
-0, 439560, 196608, 0xa832782f
-0, 442530, 196608, 0xa832782f
diff --git a/gst-libs/ext/libav/tests/ref/fate/ea-tgq b/gst-libs/ext/libav/tests/ref/fate/ea-tgq
index 993c08e..edb04fa 100644
--- a/gst-libs/ext/libav/tests/ref/fate/ea-tgq
+++ b/gst-libs/ext/libav/tests/ref/fate/ea-tgq
@@ -1,278 +1,279 @@
-0, 0, 34944, 0xe33671a4
-0, 6000, 34944, 0xe33671a4
-0, 12000, 34944, 0xe33671a4
-0, 18000, 34944, 0xe33671a4
-0, 24000, 34944, 0xe33671a4
-0, 30000, 34944, 0xe33671a4
-0, 36000, 34944, 0xe33671a4
-0, 42000, 34944, 0xe33671a4
-0, 48000, 34944, 0xe33671a4
-0, 54000, 34944, 0xe33671a4
-0, 60000, 34944, 0xe33671a4
-0, 66000, 34944, 0xe33671a4
-0, 72000, 34944, 0xe33671a4
-0, 78000, 34944, 0xe33671a4
-0, 84000, 34944, 0xe33671a4
-0, 90000, 34944, 0x63196b41
-0, 96000, 34944, 0x308d6f10
-0, 102000, 34944, 0x86026ced
-0, 108000, 34944, 0xaa6a6bc9
-0, 114000, 34944, 0x58276ee3
-0, 120000, 34944, 0x402d70c2
-0, 126000, 34944, 0x948d74bf
-0, 132000, 34944, 0x3d31759c
-0, 138000, 34944, 0x638c734e
-0, 144000, 34944, 0xe218768a
-0, 150000, 34944, 0xed6678ff
-0, 156000, 34944, 0x381b7dda
-0, 162000, 34944, 0x216680e7
-0, 168000, 34944, 0xaca5810f
-0, 174000, 34944, 0xf70b81eb
-0, 180000, 34944, 0x3675858b
-0, 186000, 34944, 0xa51188c3
-0, 192000, 34944, 0x3a848bf1
-0, 198000, 34944, 0x67608d4d
-0, 204000, 34944, 0xafe49165
-0, 210000, 34944, 0x7e8a94a7
-0, 216000, 34944, 0x3b889432
-0, 222000, 34944, 0x97e89623
-0, 228000, 34944, 0x07819793
-0, 234000, 34944, 0xdac39b87
-0, 240000, 34944, 0x4d8c9d93
-0, 246000, 34944, 0xcf009fa7
-0, 252000, 34944, 0x2f109f6e
-0, 258000, 34944, 0xcedda4eb
-0, 264000, 34944, 0xfe89a6df
-0, 270000, 34944, 0x195ea7a9
-0, 276000, 34944, 0x9287ab92
-0, 282000, 34944, 0x6d21af54
-0, 288000, 34944, 0xd627b28b
-0, 294000, 34944, 0x3ad5b6fd
-0, 300000, 34944, 0x5101b64d
-0, 306000, 34944, 0xb968b8ca
-0, 312000, 34944, 0xa105b74a
-0, 318000, 34944, 0xc056bdd6
-0, 324000, 34944, 0xec7fc1d9
-0, 330000, 34944, 0x92c3c3e0
-0, 336000, 34944, 0x9bffc45c
-0, 342000, 34944, 0x5aabca4b
-0, 348000, 34944, 0xcbdacb26
-0, 354000, 34944, 0xed6cce3f
-0, 360000, 34944, 0xcc61cfb8
-0, 366000, 34944, 0x7a97d427
-0, 372000, 34944, 0x7cdbd5ec
-0, 378000, 34944, 0x5851d9c4
-0, 384000, 34944, 0x69d5dd1d
-0, 390000, 34944, 0xdf30dcf4
-0, 396000, 34944, 0x2359e084
-0, 402000, 34944, 0xe0bae491
-0, 408000, 34944, 0xa716e4fd
-0, 414000, 34944, 0xe48aeaf4
-0, 420000, 34944, 0x0a0deb21
-0, 426000, 34944, 0xe8a56e12
-0, 432000, 34944, 0x0d72c98e
-0, 438000, 34944, 0x71a7bb9d
-0, 444000, 34944, 0xc0c8c108
-0, 450000, 34944, 0x1d1fc3ba
-0, 456000, 34944, 0xebcfc67f
-0, 462000, 34944, 0x2921cb5b
-0, 468000, 34944, 0x793ed099
-0, 474000, 34944, 0xefebd9e8
-0, 480000, 34944, 0x163c2330
-0, 486000, 34944, 0x35155672
-0, 492000, 34944, 0x05474e2e
-0, 498000, 34944, 0x9433542f
-0, 504000, 34944, 0x777d5a13
-0, 510000, 34944, 0x87526776
-0, 516000, 34944, 0x4c3c72c1
-0, 522000, 34944, 0x70407b87
-0, 528000, 34944, 0x2358861d
-0, 534000, 34944, 0xec61923f
-0, 540000, 34944, 0x0bb2a0d4
-0, 546000, 34944, 0x6b6d8624
-0, 552000, 34944, 0x624761ec
-0, 558000, 34944, 0xff23b926
-0, 564000, 34944, 0x07fc7ca5
-0, 570000, 34944, 0xa8d3ffda
-0, 576000, 34944, 0xa2d31265
-0, 582000, 34944, 0x5e58225e
-0, 588000, 34944, 0x284b2fb0
-0, 594000, 34944, 0x205b3cb1
-0, 600000, 34944, 0x3fa64a09
-0, 606000, 34944, 0xa5de5097
-0, 612000, 34944, 0x00686cea
-0, 618000, 34944, 0x465a8282
-0, 624000, 34944, 0x4ceb8189
-0, 630000, 34944, 0x14698509
-0, 636000, 34944, 0x232c830d
-0, 642000, 34944, 0x0739807c
-0, 648000, 34944, 0x83b0861e
-0, 654000, 34944, 0xbdc094b1
-0, 660000, 34944, 0xc4c0a605
-0, 666000, 34944, 0x8376b059
-0, 672000, 34944, 0x2035b939
-0, 678000, 34944, 0xb6bfc812
-0, 684000, 34944, 0xc5d4d5c4
-0, 690000, 34944, 0x492c954e
-0, 696000, 34944, 0xd23f0dcc
-0, 702000, 34944, 0x22d7ff6c
-0, 708000, 34944, 0xd08b4168
-0, 714000, 34944, 0xa82e4062
-0, 720000, 34944, 0xcc4f2f31
-0, 726000, 34944, 0x964b0307
-0, 732000, 34944, 0xe8130606
-0, 738000, 34944, 0x5fb744bf
-0, 744000, 34944, 0x1546a88b
-0, 750000, 34944, 0xe6e4d94d
-0, 756000, 34944, 0x8d1ea97e
-0, 762000, 34944, 0x3bb1fb55
-0, 768000, 34944, 0x3c37e9cc
-0, 774000, 34944, 0xe2d22521
-0, 780000, 34944, 0x7c0ec8cc
-0, 786000, 34944, 0x7c2dc956
-0, 792000, 34944, 0x7fe3c263
-0, 798000, 34944, 0x9a65b813
-0, 804000, 34944, 0x7ea7cb14
-0, 810000, 34944, 0x31ded64e
-0, 816000, 34944, 0x50f30ad1
-0, 822000, 34944, 0x12eac45c
-0, 828000, 34944, 0x984b6335
-0, 834000, 34944, 0x3b9b02f0
-0, 840000, 34944, 0x4629d2a4
-0, 846000, 34944, 0x38687e89
-0, 852000, 34944, 0xb76620fe
-0, 858000, 34944, 0x66347155
-0, 864000, 34944, 0x6e6bc297
-0, 870000, 34944, 0x452a653a
-0, 876000, 34944, 0x8c8a0683
-0, 882000, 34944, 0xaf5d7c2d
-0, 888000, 34944, 0x3064a7e1
-0, 894000, 34944, 0xc0657fc4
-0, 900000, 34944, 0x1f129266
-0, 906000, 34944, 0x35adedfb
-0, 912000, 34944, 0x40a3db0d
-0, 918000, 34944, 0x87bebb37
-0, 924000, 34944, 0x04d7ffed
-0, 930000, 34944, 0x9bde3180
-0, 936000, 34944, 0xc35c25bd
-0, 942000, 34944, 0x820bf4bb
-0, 948000, 34944, 0x876163ef
-0, 954000, 34944, 0x3ab6dac0
-0, 960000, 34944, 0x69a9ef73
-0, 966000, 34944, 0x0df3813c
-0, 972000, 34944, 0x1bba0947
-0, 978000, 34944, 0x0b7883d4
-0, 984000, 34944, 0xa9972f7e
-0, 990000, 34944, 0x603d08fe
-0, 996000, 34944, 0x05f4f111
-0, 1002000, 34944, 0xb24fdb42
-0, 1008000, 34944, 0xfe2ad344
-0, 1014000, 34944, 0xda4bcb8f
-0, 1020000, 34944, 0xd28aca6b
-0, 1026000, 34944, 0x9486c260
-0, 1032000, 34944, 0xad9fc04d
-0, 1038000, 34944, 0x9333c0ca
-0, 1044000, 34944, 0x96e9c226
-0, 1050000, 34944, 0x3e89bd6f
-0, 1056000, 34944, 0x7a2dbd32
-0, 1062000, 34944, 0xe578ba53
-0, 1068000, 34944, 0xb77ebab1
-0, 1074000, 34944, 0xd8bfbcb1
-0, 1080000, 34944, 0x15d9bc97
-0, 1086000, 34944, 0x09c3b9f0
-0, 1092000, 34944, 0xd8c8b944
-0, 1098000, 34944, 0x2c2fb996
-0, 1104000, 34944, 0xd7a8b7e7
-0, 1110000, 34944, 0xce34b843
-0, 1116000, 34944, 0xba69e9fd
-0, 1122000, 34944, 0x1b3f1adc
-0, 1128000, 34944, 0x48f515aa
-0, 1134000, 34944, 0x864e12bb
-0, 1140000, 34944, 0xca571996
-0, 1146000, 34944, 0x1d5a1af0
-0, 1152000, 34944, 0x3d1e171f
-0, 1158000, 34944, 0xb57417ca
-0, 1164000, 34944, 0x6e6d1e9d
-0, 1170000, 34944, 0xc9971899
-0, 1176000, 34944, 0xe0b112c8
-0, 1182000, 34944, 0x121b0cd9
-0, 1188000, 34944, 0x418e0eff
-0, 1194000, 34944, 0x9e1b07d8
-0, 1200000, 34944, 0x5590064a
-0, 1206000, 34944, 0x7a170b14
-0, 1212000, 34944, 0xf25709f0
-0, 1218000, 34944, 0x94fa099a
-0, 1224000, 34944, 0x081e06ae
-0, 1230000, 34944, 0xcfc40417
-0, 1236000, 34944, 0xed33096f
-0, 1242000, 34944, 0xd73a07e2
-0, 1248000, 34944, 0xc512077d
-0, 1254000, 34944, 0x27d7021d
-0, 1260000, 34944, 0xab59fd20
-0, 1266000, 34944, 0xcc2400b7
-0, 1272000, 34944, 0xcb3bfb99
-0, 1278000, 34944, 0x0974fb1a
-0, 1284000, 34944, 0xef79f8ba
-0, 1290000, 34944, 0xf932f3a2
-0, 1296000, 34944, 0xa32df1bc
-0, 1302000, 34944, 0xdbe0f532
-0, 1308000, 34944, 0x234cf142
-0, 1314000, 34944, 0xe68befd0
-0, 1320000, 34944, 0xe4e7ee45
-0, 1326000, 34944, 0x0283eff1
-0, 1332000, 34944, 0xc8d3f6db
-0, 1338000, 34944, 0x0aa6ee88
-0, 1344000, 34944, 0xcc3de527
-0, 1350000, 34944, 0x9db0ebef
-0, 1356000, 34944, 0xa207e9db
-0, 1362000, 34944, 0x35b3e74a
-0, 1368000, 34944, 0x1988e848
-0, 1374000, 34944, 0x727de73c
-0, 1380000, 34944, 0x05d5e709
-0, 1386000, 34944, 0x3214e4b2
-0, 1392000, 34944, 0xed85e0a9
-0, 1398000, 34944, 0xf6c9e100
-0, 1404000, 34944, 0x57a8dbaf
-0, 1410000, 34944, 0xc75fdf41
-0, 1416000, 34944, 0x736fde24
-0, 1422000, 34944, 0x8d4bde80
-0, 1428000, 34944, 0x3220dc86
-0, 1434000, 34944, 0xe498da85
-0, 1440000, 34944, 0x0655daed
-0, 1446000, 34944, 0xb22ad874
-0, 1452000, 34944, 0x8198d411
-0, 1458000, 34944, 0xd0d2d557
-0, 1464000, 34944, 0xd740d1ff
-0, 1470000, 34944, 0x2783d00e
-0, 1476000, 34944, 0x7abdcd6b
-0, 1482000, 34944, 0x2e47d1eb
-0, 1488000, 34944, 0xfe1bcf60
-0, 1494000, 34944, 0xf0f0d5bb
-0, 1500000, 34944, 0x9af7d581
-0, 1506000, 34944, 0xb325ca3d
-0, 1512000, 34944, 0xd88abfbd
-0, 1518000, 34944, 0xf2bab746
-0, 1524000, 34944, 0xac44a7dd
-0, 1530000, 34944, 0x609e9ea3
-0, 1536000, 34944, 0xa39993b9
-0, 1542000, 34944, 0x9c948911
-0, 1548000, 34944, 0x72f8822d
-0, 1554000, 34944, 0x7f3f7a8c
-0, 1560000, 34944, 0x7ab475f9
-0, 1566000, 34944, 0x536f73aa
-0, 1572000, 34944, 0x86cb71e5
-0, 1578000, 34944, 0x17157186
-0, 1584000, 34944, 0xe33671a4
-0, 1590000, 34944, 0xe33671a4
-0, 1596000, 34944, 0xe33671a4
-0, 1602000, 34944, 0xe33671a4
-0, 1608000, 34944, 0xe33671a4
-0, 1614000, 34944, 0xe33671a4
-0, 1620000, 34944, 0xe33671a4
-0, 1626000, 34944, 0xe33671a4
-0, 1632000, 34944, 0xe33671a4
-0, 1638000, 34944, 0xe33671a4
-0, 1644000, 34944, 0xe33671a4
-0, 1650000, 34944, 0xe33671a4
-0, 1656000, 34944, 0xe33671a4
-0, 1662000, 34944, 0xe33671a4
+#tb 0: 1/90000
+0, 0, 0, 0, 34944, 0xe33671a4
+0, 6000, 6000, 0, 34944, 0xe33671a4
+0, 12000, 12000, 0, 34944, 0xe33671a4
+0, 18000, 18000, 0, 34944, 0xe33671a4
+0, 24000, 24000, 0, 34944, 0xe33671a4
+0, 30000, 30000, 0, 34944, 0xe33671a4
+0, 36000, 36000, 0, 34944, 0xe33671a4
+0, 42000, 42000, 0, 34944, 0xe33671a4
+0, 48000, 48000, 0, 34944, 0xe33671a4
+0, 54000, 54000, 0, 34944, 0xe33671a4
+0, 60000, 60000, 0, 34944, 0xe33671a4
+0, 66000, 66000, 0, 34944, 0xe33671a4
+0, 72000, 72000, 0, 34944, 0xe33671a4
+0, 78000, 78000, 0, 34944, 0xe33671a4
+0, 84000, 84000, 0, 34944, 0xe33671a4
+0, 90000, 90000, 0, 34944, 0x63196b41
+0, 96000, 96000, 0, 34944, 0x308d6f10
+0, 102000, 102000, 0, 34944, 0x86026ced
+0, 108000, 108000, 0, 34944, 0xaa6a6bc9
+0, 114000, 114000, 0, 34944, 0x58276ee3
+0, 120000, 120000, 0, 34944, 0x402d70c2
+0, 126000, 126000, 0, 34944, 0x948d74bf
+0, 132000, 132000, 0, 34944, 0x3d31759c
+0, 138000, 138000, 0, 34944, 0x638c734e
+0, 144000, 144000, 0, 34944, 0xe218768a
+0, 150000, 150000, 0, 34944, 0xed6678ff
+0, 156000, 156000, 0, 34944, 0x381b7dda
+0, 162000, 162000, 0, 34944, 0x216680e7
+0, 168000, 168000, 0, 34944, 0xaca5810f
+0, 174000, 174000, 0, 34944, 0xf70b81eb
+0, 180000, 180000, 0, 34944, 0x3675858b
+0, 186000, 186000, 0, 34944, 0xa51188c3
+0, 192000, 192000, 0, 34944, 0x3a848bf1
+0, 198000, 198000, 0, 34944, 0x67608d4d
+0, 204000, 204000, 0, 34944, 0xafe49165
+0, 210000, 210000, 0, 34944, 0x7e8a94a7
+0, 216000, 216000, 0, 34944, 0x3b889432
+0, 222000, 222000, 0, 34944, 0x97e89623
+0, 228000, 228000, 0, 34944, 0x07819793
+0, 234000, 234000, 0, 34944, 0xdac39b87
+0, 240000, 240000, 0, 34944, 0x4d8c9d93
+0, 246000, 246000, 0, 34944, 0xcf009fa7
+0, 252000, 252000, 0, 34944, 0x2f109f6e
+0, 258000, 258000, 0, 34944, 0xcedda4eb
+0, 264000, 264000, 0, 34944, 0xfe89a6df
+0, 270000, 270000, 0, 34944, 0x195ea7a9
+0, 276000, 276000, 0, 34944, 0x9287ab92
+0, 282000, 282000, 0, 34944, 0x6d21af54
+0, 288000, 288000, 0, 34944, 0xd627b28b
+0, 294000, 294000, 0, 34944, 0x3ad5b6fd
+0, 300000, 300000, 0, 34944, 0x5101b64d
+0, 306000, 306000, 0, 34944, 0xb968b8ca
+0, 312000, 312000, 0, 34944, 0xa105b74a
+0, 318000, 318000, 0, 34944, 0xc056bdd6
+0, 324000, 324000, 0, 34944, 0xec7fc1d9
+0, 330000, 330000, 0, 34944, 0x92c3c3e0
+0, 336000, 336000, 0, 34944, 0x9bffc45c
+0, 342000, 342000, 0, 34944, 0x5aabca4b
+0, 348000, 348000, 0, 34944, 0xcbdacb26
+0, 354000, 354000, 0, 34944, 0xed6cce3f
+0, 360000, 360000, 0, 34944, 0xcc61cfb8
+0, 366000, 366000, 0, 34944, 0x7a97d427
+0, 372000, 372000, 0, 34944, 0x7cdbd5ec
+0, 378000, 378000, 0, 34944, 0x5851d9c4
+0, 384000, 384000, 0, 34944, 0x69d5dd1d
+0, 390000, 390000, 0, 34944, 0xdf30dcf4
+0, 396000, 396000, 0, 34944, 0x2359e084
+0, 402000, 402000, 0, 34944, 0xe0bae491
+0, 408000, 408000, 0, 34944, 0xa716e4fd
+0, 414000, 414000, 0, 34944, 0xe48aeaf4
+0, 420000, 420000, 0, 34944, 0x0a0deb21
+0, 426000, 426000, 0, 34944, 0xe8a56e12
+0, 432000, 432000, 0, 34944, 0x0d72c98e
+0, 438000, 438000, 0, 34944, 0x71a7bb9d
+0, 444000, 444000, 0, 34944, 0xc0c8c108
+0, 450000, 450000, 0, 34944, 0x1d1fc3ba
+0, 456000, 456000, 0, 34944, 0xebcfc67f
+0, 462000, 462000, 0, 34944, 0x2921cb5b
+0, 468000, 468000, 0, 34944, 0x793ed099
+0, 474000, 474000, 0, 34944, 0xefebd9e8
+0, 480000, 480000, 0, 34944, 0x163c2330
+0, 486000, 486000, 0, 34944, 0x35155672
+0, 492000, 492000, 0, 34944, 0x05474e2e
+0, 498000, 498000, 0, 34944, 0x9433542f
+0, 504000, 504000, 0, 34944, 0x777d5a13
+0, 510000, 510000, 0, 34944, 0x87526776
+0, 516000, 516000, 0, 34944, 0x4c3c72c1
+0, 522000, 522000, 0, 34944, 0x70407b87
+0, 528000, 528000, 0, 34944, 0x2358861d
+0, 534000, 534000, 0, 34944, 0xec61923f
+0, 540000, 540000, 0, 34944, 0x0bb2a0d4
+0, 546000, 546000, 0, 34944, 0x6b6d8624
+0, 552000, 552000, 0, 34944, 0x624761ec
+0, 558000, 558000, 0, 34944, 0xff23b926
+0, 564000, 564000, 0, 34944, 0x07fc7ca5
+0, 570000, 570000, 0, 34944, 0xa8d3ffda
+0, 576000, 576000, 0, 34944, 0xa2d31265
+0, 582000, 582000, 0, 34944, 0x5e58225e
+0, 588000, 588000, 0, 34944, 0x284b2fb0
+0, 594000, 594000, 0, 34944, 0x205b3cb1
+0, 600000, 600000, 0, 34944, 0x3fa64a09
+0, 606000, 606000, 0, 34944, 0xa5de5097
+0, 612000, 612000, 0, 34944, 0x00686cea
+0, 618000, 618000, 0, 34944, 0x465a8282
+0, 624000, 624000, 0, 34944, 0x4ceb8189
+0, 630000, 630000, 0, 34944, 0x14698509
+0, 636000, 636000, 0, 34944, 0x232c830d
+0, 642000, 642000, 0, 34944, 0x0739807c
+0, 648000, 648000, 0, 34944, 0x83b0861e
+0, 654000, 654000, 0, 34944, 0xbdc094b1
+0, 660000, 660000, 0, 34944, 0xc4c0a605
+0, 666000, 666000, 0, 34944, 0x8376b059
+0, 672000, 672000, 0, 34944, 0x2035b939
+0, 678000, 678000, 0, 34944, 0xb6bfc812
+0, 684000, 684000, 0, 34944, 0xc5d4d5c4
+0, 690000, 690000, 0, 34944, 0x492c954e
+0, 696000, 696000, 0, 34944, 0xd23f0dcc
+0, 702000, 702000, 0, 34944, 0x22d7ff6c
+0, 708000, 708000, 0, 34944, 0xd08b4168
+0, 714000, 714000, 0, 34944, 0xa82e4062
+0, 720000, 720000, 0, 34944, 0xcc4f2f31
+0, 726000, 726000, 0, 34944, 0x964b0307
+0, 732000, 732000, 0, 34944, 0xe8130606
+0, 738000, 738000, 0, 34944, 0x5fb744bf
+0, 744000, 744000, 0, 34944, 0x1546a88b
+0, 750000, 750000, 0, 34944, 0xe6e4d94d
+0, 756000, 756000, 0, 34944, 0x8d1ea97e
+0, 762000, 762000, 0, 34944, 0x3bb1fb55
+0, 768000, 768000, 0, 34944, 0x3c37e9cc
+0, 774000, 774000, 0, 34944, 0xe2d22521
+0, 780000, 780000, 0, 34944, 0x7c0ec8cc
+0, 786000, 786000, 0, 34944, 0x7c2dc956
+0, 792000, 792000, 0, 34944, 0x7fe3c263
+0, 798000, 798000, 0, 34944, 0x9a65b813
+0, 804000, 804000, 0, 34944, 0x7ea7cb14
+0, 810000, 810000, 0, 34944, 0x31ded64e
+0, 816000, 816000, 0, 34944, 0x50f30ad1
+0, 822000, 822000, 0, 34944, 0x12eac45c
+0, 828000, 828000, 0, 34944, 0x984b6335
+0, 834000, 834000, 0, 34944, 0x3b9b02f0
+0, 840000, 840000, 0, 34944, 0x4629d2a4
+0, 846000, 846000, 0, 34944, 0x38687e89
+0, 852000, 852000, 0, 34944, 0xb76620fe
+0, 858000, 858000, 0, 34944, 0x66347155
+0, 864000, 864000, 0, 34944, 0x6e6bc297
+0, 870000, 870000, 0, 34944, 0x452a653a
+0, 876000, 876000, 0, 34944, 0x8c8a0683
+0, 882000, 882000, 0, 34944, 0xaf5d7c2d
+0, 888000, 888000, 0, 34944, 0x3064a7e1
+0, 894000, 894000, 0, 34944, 0xc0657fc4
+0, 900000, 900000, 0, 34944, 0x1f129266
+0, 906000, 906000, 0, 34944, 0x35adedfb
+0, 912000, 912000, 0, 34944, 0x40a3db0d
+0, 918000, 918000, 0, 34944, 0x87bebb37
+0, 924000, 924000, 0, 34944, 0x04d7ffed
+0, 930000, 930000, 0, 34944, 0x9bde3180
+0, 936000, 936000, 0, 34944, 0xc35c25bd
+0, 942000, 942000, 0, 34944, 0x820bf4bb
+0, 948000, 948000, 0, 34944, 0x876163ef
+0, 954000, 954000, 0, 34944, 0x3ab6dac0
+0, 960000, 960000, 0, 34944, 0x69a9ef73
+0, 966000, 966000, 0, 34944, 0x0df3813c
+0, 972000, 972000, 0, 34944, 0x1bba0947
+0, 978000, 978000, 0, 34944, 0x0b7883d4
+0, 984000, 984000, 0, 34944, 0xa9972f7e
+0, 990000, 990000, 0, 34944, 0x603d08fe
+0, 996000, 996000, 0, 34944, 0x05f4f111
+0, 1002000, 1002000, 0, 34944, 0xb24fdb42
+0, 1008000, 1008000, 0, 34944, 0xfe2ad344
+0, 1014000, 1014000, 0, 34944, 0xda4bcb8f
+0, 1020000, 1020000, 0, 34944, 0xd28aca6b
+0, 1026000, 1026000, 0, 34944, 0x9486c260
+0, 1032000, 1032000, 0, 34944, 0xad9fc04d
+0, 1038000, 1038000, 0, 34944, 0x9333c0ca
+0, 1044000, 1044000, 0, 34944, 0x96e9c226
+0, 1050000, 1050000, 0, 34944, 0x3e89bd6f
+0, 1056000, 1056000, 0, 34944, 0x7a2dbd32
+0, 1062000, 1062000, 0, 34944, 0xe578ba53
+0, 1068000, 1068000, 0, 34944, 0xb77ebab1
+0, 1074000, 1074000, 0, 34944, 0xd8bfbcb1
+0, 1080000, 1080000, 0, 34944, 0x15d9bc97
+0, 1086000, 1086000, 0, 34944, 0x09c3b9f0
+0, 1092000, 1092000, 0, 34944, 0xd8c8b944
+0, 1098000, 1098000, 0, 34944, 0x2c2fb996
+0, 1104000, 1104000, 0, 34944, 0xd7a8b7e7
+0, 1110000, 1110000, 0, 34944, 0xce34b843
+0, 1116000, 1116000, 0, 34944, 0xba69e9fd
+0, 1122000, 1122000, 0, 34944, 0x1b3f1adc
+0, 1128000, 1128000, 0, 34944, 0x48f515aa
+0, 1134000, 1134000, 0, 34944, 0x864e12bb
+0, 1140000, 1140000, 0, 34944, 0xca571996
+0, 1146000, 1146000, 0, 34944, 0x1d5a1af0
+0, 1152000, 1152000, 0, 34944, 0x3d1e171f
+0, 1158000, 1158000, 0, 34944, 0xb57417ca
+0, 1164000, 1164000, 0, 34944, 0x6e6d1e9d
+0, 1170000, 1170000, 0, 34944, 0xc9971899
+0, 1176000, 1176000, 0, 34944, 0xe0b112c8
+0, 1182000, 1182000, 0, 34944, 0x121b0cd9
+0, 1188000, 1188000, 0, 34944, 0x418e0eff
+0, 1194000, 1194000, 0, 34944, 0x9e1b07d8
+0, 1200000, 1200000, 0, 34944, 0x5590064a
+0, 1206000, 1206000, 0, 34944, 0x7a170b14
+0, 1212000, 1212000, 0, 34944, 0xf25709f0
+0, 1218000, 1218000, 0, 34944, 0x94fa099a
+0, 1224000, 1224000, 0, 34944, 0x081e06ae
+0, 1230000, 1230000, 0, 34944, 0xcfc40417
+0, 1236000, 1236000, 0, 34944, 0xed33096f
+0, 1242000, 1242000, 0, 34944, 0xd73a07e2
+0, 1248000, 1248000, 0, 34944, 0xc512077d
+0, 1254000, 1254000, 0, 34944, 0x27d7021d
+0, 1260000, 1260000, 0, 34944, 0xab59fd20
+0, 1266000, 1266000, 0, 34944, 0xcc2400b7
+0, 1272000, 1272000, 0, 34944, 0xcb3bfb99
+0, 1278000, 1278000, 0, 34944, 0x0974fb1a
+0, 1284000, 1284000, 0, 34944, 0xef79f8ba
+0, 1290000, 1290000, 0, 34944, 0xf932f3a2
+0, 1296000, 1296000, 0, 34944, 0xa32df1bc
+0, 1302000, 1302000, 0, 34944, 0xdbe0f532
+0, 1308000, 1308000, 0, 34944, 0x234cf142
+0, 1314000, 1314000, 0, 34944, 0xe68befd0
+0, 1320000, 1320000, 0, 34944, 0xe4e7ee45
+0, 1326000, 1326000, 0, 34944, 0x0283eff1
+0, 1332000, 1332000, 0, 34944, 0xc8d3f6db
+0, 1338000, 1338000, 0, 34944, 0x0aa6ee88
+0, 1344000, 1344000, 0, 34944, 0xcc3de527
+0, 1350000, 1350000, 0, 34944, 0x9db0ebef
+0, 1356000, 1356000, 0, 34944, 0xa207e9db
+0, 1362000, 1362000, 0, 34944, 0x35b3e74a
+0, 1368000, 1368000, 0, 34944, 0x1988e848
+0, 1374000, 1374000, 0, 34944, 0x727de73c
+0, 1380000, 1380000, 0, 34944, 0x05d5e709
+0, 1386000, 1386000, 0, 34944, 0x3214e4b2
+0, 1392000, 1392000, 0, 34944, 0xed85e0a9
+0, 1398000, 1398000, 0, 34944, 0xf6c9e100
+0, 1404000, 1404000, 0, 34944, 0x57a8dbaf
+0, 1410000, 1410000, 0, 34944, 0xc75fdf41
+0, 1416000, 1416000, 0, 34944, 0x736fde24
+0, 1422000, 1422000, 0, 34944, 0x8d4bde80
+0, 1428000, 1428000, 0, 34944, 0x3220dc86
+0, 1434000, 1434000, 0, 34944, 0xe498da85
+0, 1440000, 1440000, 0, 34944, 0x0655daed
+0, 1446000, 1446000, 0, 34944, 0xb22ad874
+0, 1452000, 1452000, 0, 34944, 0x8198d411
+0, 1458000, 1458000, 0, 34944, 0xd0d2d557
+0, 1464000, 1464000, 0, 34944, 0xd740d1ff
+0, 1470000, 1470000, 0, 34944, 0x2783d00e
+0, 1476000, 1476000, 0, 34944, 0x7abdcd6b
+0, 1482000, 1482000, 0, 34944, 0x2e47d1eb
+0, 1488000, 1488000, 0, 34944, 0xfe1bcf60
+0, 1494000, 1494000, 0, 34944, 0xf0f0d5bb
+0, 1500000, 1500000, 0, 34944, 0x9af7d581
+0, 1506000, 1506000, 0, 34944, 0xb325ca3d
+0, 1512000, 1512000, 0, 34944, 0xd88abfbd
+0, 1518000, 1518000, 0, 34944, 0xf2bab746
+0, 1524000, 1524000, 0, 34944, 0xac44a7dd
+0, 1530000, 1530000, 0, 34944, 0x609e9ea3
+0, 1536000, 1536000, 0, 34944, 0xa39993b9
+0, 1542000, 1542000, 0, 34944, 0x9c948911
+0, 1548000, 1548000, 0, 34944, 0x72f8822d
+0, 1554000, 1554000, 0, 34944, 0x7f3f7a8c
+0, 1560000, 1560000, 0, 34944, 0x7ab475f9
+0, 1566000, 1566000, 0, 34944, 0x536f73aa
+0, 1572000, 1572000, 0, 34944, 0x86cb71e5
+0, 1578000, 1578000, 0, 34944, 0x17157186
+0, 1584000, 1584000, 0, 34944, 0xe33671a4
+0, 1590000, 1590000, 0, 34944, 0xe33671a4
+0, 1596000, 1596000, 0, 34944, 0xe33671a4
+0, 1602000, 1602000, 0, 34944, 0xe33671a4
+0, 1608000, 1608000, 0, 34944, 0xe33671a4
+0, 1614000, 1614000, 0, 34944, 0xe33671a4
+0, 1620000, 1620000, 0, 34944, 0xe33671a4
+0, 1626000, 1626000, 0, 34944, 0xe33671a4
+0, 1632000, 1632000, 0, 34944, 0xe33671a4
+0, 1638000, 1638000, 0, 34944, 0xe33671a4
+0, 1644000, 1644000, 0, 34944, 0xe33671a4
+0, 1650000, 1650000, 0, 34944, 0xe33671a4
+0, 1656000, 1656000, 0, 34944, 0xe33671a4
+0, 1662000, 1662000, 0, 34944, 0xe33671a4
diff --git a/gst-libs/ext/libav/tests/ref/fate/ea-tgv-1 b/gst-libs/ext/libav/tests/ref/fate/ea-tgv-1
new file mode 100644
index 0000000..fc92181
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/ea-tgv-1
@@ -0,0 +1,48 @@
+#tb 0: 1/15
+0, 0, 0, 1, 230400, 0xfbf2581e
+0, 1, 1, 1, 230400, 0xfbf2581e
+0, 2, 2, 1, 230400, 0xfbf2581e
+0, 3, 3, 1, 230400, 0xfbf2581e
+0, 4, 4, 1, 230400, 0xfbf2581e
+0, 5, 5, 1, 230400, 0xfbf2581e
+0, 6, 6, 1, 230400, 0xfbf2581e
+0, 7, 7, 1, 230400, 0xfbf2581e
+0, 8, 8, 1, 230400, 0xfbf2581e
+0, 9, 9, 1, 230400, 0xfbf2581e
+0, 10, 10, 1, 230400, 0xfbf2581e
+0, 11, 11, 1, 230400, 0xfbf2581e
+0, 12, 12, 1, 230400, 0xfbf2581e
+0, 13, 13, 1, 230400, 0xfbf2581e
+0, 14, 14, 1, 230400, 0xfbf2581e
+0, 15, 15, 1, 230400, 0xf5a0a21d
+0, 16, 16, 1, 230400, 0x909cc039
+0, 17, 17, 1, 230400, 0x14d899dd
+0, 18, 18, 1, 230400, 0x0d246edf
+0, 19, 19, 1, 230400, 0x5345fe0d
+0, 20, 20, 1, 230400, 0x5abdff9a
+0, 21, 21, 1, 230400, 0x1730d973
+0, 22, 22, 1, 230400, 0xec881be9
+0, 23, 23, 1, 230400, 0xf4216895
+0, 24, 24, 1, 230400, 0x529d7a52
+0, 25, 25, 1, 230400, 0x93b4c7b9
+0, 26, 26, 1, 230400, 0xedc65bcd
+0, 27, 27, 1, 230400, 0xf0fb54ae
+0, 28, 28, 1, 230400, 0x27864ce9
+0, 29, 29, 1, 230400, 0xcd05012d
+0, 30, 30, 1, 230400, 0x019b6d84
+0, 31, 31, 1, 230400, 0xcc05d416
+0, 32, 32, 1, 230400, 0xb04c0248
+0, 33, 33, 1, 230400, 0x6806eb92
+0, 34, 34, 1, 230400, 0x60e9c001
+0, 35, 35, 1, 230400, 0x9b040261
+0, 36, 36, 1, 230400, 0x6961fb90
+0, 37, 37, 1, 230400, 0xbf67ad24
+0, 38, 38, 1, 230400, 0x2270f328
+0, 39, 39, 1, 230400, 0xd0c345f6
+0, 40, 40, 1, 230400, 0xfd159212
+0, 41, 41, 1, 230400, 0x085578ff
+0, 42, 42, 1, 230400, 0xcca8afa6
+0, 43, 43, 1, 230400, 0x901ec91c
+0, 44, 44, 1, 230400, 0xf1cb99f3
+0, 45, 45, 1, 230400, 0x86d98f0c
+0, 46, 46, 1, 230400, 0x52970700
diff --git a/gst-libs/ext/libav/tests/ref/fate/ea-tgv-2 b/gst-libs/ext/libav/tests/ref/fate/ea-tgv-2
new file mode 100644
index 0000000..5e9de02
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/ea-tgv-2
@@ -0,0 +1,39 @@
+#tb 0: 1/15
+0, 0, 0, 1, 192000, 0xdfc2f225
+0, 1, 1, 1, 192000, 0x059b57bd
+0, 2, 2, 1, 192000, 0x766cb086
+0, 3, 3, 1, 192000, 0x459e3bac
+0, 4, 4, 1, 192000, 0x5293e622
+0, 5, 5, 1, 192000, 0x898b03f4
+0, 6, 6, 1, 192000, 0xb184a627
+0, 7, 7, 1, 192000, 0xa3fc650a
+0, 8, 8, 1, 192000, 0xea448589
+0, 9, 9, 1, 192000, 0x700e2b76
+0, 10, 10, 1, 192000, 0xa1a1d66d
+0, 11, 11, 1, 192000, 0xd63bc8a1
+0, 12, 12, 1, 192000, 0x5f08c023
+0, 13, 13, 1, 192000, 0x8b75ec3b
+0, 14, 14, 1, 192000, 0x62728ce4
+0, 15, 15, 1, 192000, 0xaa007941
+0, 16, 16, 1, 192000, 0x55dc5b3b
+0, 17, 17, 1, 192000, 0x72d836c2
+0, 18, 18, 1, 192000, 0x1f2de2fc
+0, 19, 19, 1, 192000, 0xb295dfdb
+0, 20, 20, 1, 192000, 0xe5c5f634
+0, 21, 21, 1, 192000, 0x455a0464
+0, 22, 22, 1, 192000, 0x3bf2340d
+0, 23, 23, 1, 192000, 0xe368f0fc
+0, 24, 24, 1, 192000, 0xfa7549c0
+0, 25, 25, 1, 192000, 0x4dd76f3d
+0, 26, 26, 1, 192000, 0x50a49f6c
+0, 27, 27, 1, 192000, 0xb6072f65
+0, 28, 28, 1, 192000, 0x093ce1a8
+0, 29, 29, 1, 192000, 0x55afe3db
+0, 30, 30, 1, 192000, 0x81c3bfab
+0, 31, 31, 1, 192000, 0x583ebd3d
+0, 32, 32, 1, 192000, 0x2504f003
+0, 33, 33, 1, 192000, 0x44ade2af
+0, 34, 34, 1, 192000, 0x77cbcfd8
+0, 35, 35, 1, 192000, 0xac7ddfa1
+0, 36, 36, 1, 192000, 0x79f7cfe8
+0, 37, 37, 1, 192000, 0xdf2898fd
diff --git a/gst-libs/ext/libav/tests/ref/fate/ea-tgv-ima-ea-eacs b/gst-libs/ext/libav/tests/ref/fate/ea-tgv-ima-ea-eacs
deleted file mode 100644
index de73eef..0000000
--- a/gst-libs/ext/libav/tests/ref/fate/ea-tgv-ima-ea-eacs
+++ /dev/null
@@ -1,94 +0,0 @@
-0, 0, 230400, 0xfbf2581e
-1, 0, 5872, 0x00000000
-1, 5992, 5872, 0x00000000
-0, 6000, 230400, 0xfbf2581e
-1, 11984, 5872, 0x00000000
-0, 12000, 230400, 0xfbf2581e
-1, 17976, 5872, 0x00000000
-0, 18000, 230400, 0xfbf2581e
-1, 23967, 5872, 0x00000000
-0, 24000, 230400, 0xfbf2581e
-1, 29959, 5872, 0x00000000
-0, 30000, 230400, 0xfbf2581e
-1, 35951, 5872, 0x00000000
-0, 36000, 230400, 0xfbf2581e
-1, 41943, 5872, 0x00000000
-0, 42000, 230400, 0xfbf2581e
-1, 47935, 5872, 0x00000000
-0, 48000, 230400, 0xfbf2581e
-1, 53927, 5872, 0x00000000
-0, 54000, 230400, 0xfbf2581e
-1, 59918, 5872, 0x00000000
-0, 60000, 230400, 0xfbf2581e
-1, 65910, 5872, 0x00000000
-0, 66000, 230400, 0xfbf2581e
-1, 71902, 5872, 0x00000000
-0, 72000, 230400, 0xfbf2581e
-1, 77894, 5872, 0x00000000
-0, 78000, 230400, 0xfbf2581e
-1, 83886, 5872, 0x00000000
-0, 84000, 230400, 0xfbf2581e
-1, 89878, 5872, 0xc6f64777
-0, 90000, 230400, 0xf5a0a21d
-1, 95869, 5872, 0x7c9e60e8
-0, 96000, 230400, 0x909cc039
-1, 101861, 5872, 0x46525c54
-0, 102000, 230400, 0x14d899dd
-1, 107853, 5872, 0x842796bb
-0, 108000, 230400, 0x0d246edf
-1, 113845, 5872, 0xb1f6cbd5
-0, 114000, 230400, 0x5345fe0d
-1, 119837, 5872, 0x0261a74b
-0, 120000, 230400, 0x5abdff9a
-1, 125829, 5872, 0x8218b1f9
-0, 126000, 230400, 0x1730d973
-1, 131820, 5872, 0xd7a2cae6
-0, 132000, 230400, 0xec881be9
-1, 137812, 5872, 0x69d34562
-0, 138000, 230400, 0xf4216895
-1, 143804, 5872, 0x9303ec65
-0, 144000, 230400, 0x529d7a52
-1, 149796, 5872, 0xd5d963a1
-0, 150000, 230400, 0x93b4c7b9
-1, 155788, 5872, 0x0557e06f
-0, 156000, 230400, 0xedc65bcd
-1, 161780, 5872, 0x1eb48b41
-0, 162000, 230400, 0xf0fb54ae
-1, 167771, 5872, 0x70f5ca3f
-0, 168000, 230400, 0x27864ce9
-1, 173763, 5872, 0xd39e5c5e
-0, 174000, 230400, 0xcd05012d
-1, 179755, 5872, 0x29c59140
-0, 180000, 230400, 0x019b6d84
-1, 185747, 5872, 0x7d95e643
-0, 186000, 230400, 0xcc05d416
-1, 191739, 5872, 0x45353fd8
-0, 192000, 230400, 0xb04c0248
-1, 197731, 5872, 0xad7b1b27
-0, 198000, 230400, 0x6806eb92
-1, 203722, 5872, 0x1f0377b3
-0, 204000, 230400, 0x60e9c001
-1, 209714, 5872, 0x6074541e
-0, 210000, 230400, 0x9b040261
-1, 215706, 5872, 0xa4f5e892
-0, 216000, 230400, 0x6961fb90
-1, 221698, 5872, 0x084bc696
-0, 222000, 230400, 0xbf67ad24
-1, 227690, 5872, 0x67fdafce
-0, 228000, 230400, 0x2270f328
-1, 233682, 5872, 0x8dfd249d
-0, 234000, 230400, 0xd0c345f6
-1, 239673, 5872, 0x514184ee
-0, 240000, 230400, 0xfd159212
-1, 245665, 5872, 0xc0090b0d
-0, 246000, 230400, 0x085578ff
-1, 251657, 5872, 0xc1171cc8
-0, 252000, 230400, 0xcca8afa6
-1, 257649, 5872, 0x7d7dd07e
-0, 258000, 230400, 0x901ec91c
-1, 263641, 5872, 0xe6aa619c
-0, 264000, 230400, 0xf1cb99f3
-1, 269633, 5872, 0xd5aac0df
-0, 270000, 230400, 0x86d98f0c
-1, 275624, 5872, 0x3b68b390
-0, 276000, 230400, 0x52970700
diff --git a/gst-libs/ext/libav/tests/ref/fate/ea-tgv-ima-ea-sead b/gst-libs/ext/libav/tests/ref/fate/ea-tgv-ima-ea-sead
deleted file mode 100644
index bfa8419..0000000
--- a/gst-libs/ext/libav/tests/ref/fate/ea-tgv-ima-ea-sead
+++ /dev/null
@@ -1,87 +0,0 @@
-0, 0, 192000, 0xdfc2f225
-1, 0, 2944, 0x00000000
-1, 3004, 5888, 0x5ae3c2a4
-0, 6000, 192000, 0x059b57bd
-1, 9012, 5888, 0x158fbcb4
-0, 12000, 192000, 0x766cb086
-1, 15020, 5888, 0x3fc85d35
-0, 18000, 192000, 0x459e3bac
-1, 21029, 5888, 0x4667ec2b
-0, 24000, 192000, 0x5293e622
-1, 27037, 5888, 0x82744494
-0, 30000, 192000, 0x898b03f4
-1, 33045, 5888, 0x3b0cb86f
-0, 36000, 192000, 0xb184a627
-1, 39053, 5888, 0x29493fbb
-0, 42000, 192000, 0xa3fc650a
-1, 45061, 5888, 0xaa2d8595
-0, 48000, 192000, 0xea448589
-1, 51069, 5888, 0x2e563de6
-0, 54000, 192000, 0x700e2b76
-1, 57078, 5888, 0x225cca99
-0, 60000, 192000, 0xa1a1d66d
-1, 63086, 5888, 0x2b577599
-0, 66000, 192000, 0xd63bc8a1
-1, 69094, 5888, 0x3d967f32
-0, 72000, 192000, 0x5f08c023
-1, 75102, 5888, 0x16639a84
-0, 78000, 192000, 0x8b75ec3b
-1, 81110, 5888, 0x90549ba0
-0, 84000, 192000, 0x62728ce4
-1, 87118, 5888, 0xf46e6644
-0, 90000, 192000, 0xaa007941
-1, 93127, 5888, 0x39a073ec
-0, 96000, 192000, 0x55dc5b3b
-1, 99135, 5888, 0xb1d7a93a
-0, 102000, 192000, 0x72d836c2
-1, 105143, 5888, 0x25e9795b
-0, 108000, 192000, 0x1f2de2fc
-1, 111151, 5888, 0xbbc07644
-0, 114000, 192000, 0xb295dfdb
-1, 117159, 5888, 0x323f6a1b
-0, 120000, 192000, 0xe5c5f634
-1, 123167, 5888, 0x7cae130b
-0, 126000, 192000, 0x455a0464
-1, 129176, 5888, 0xd23bf9c6
-0, 132000, 192000, 0x3bf2340d
-1, 135184, 5888, 0x5f73ef35
-0, 138000, 192000, 0xe368f0fc
-1, 141192, 5888, 0xc66026be
-0, 144000, 192000, 0xfa7549c0
-1, 147200, 5888, 0xc8fdb539
-0, 150000, 192000, 0x4dd76f3d
-1, 153208, 5888, 0x94c6bfbd
-0, 156000, 192000, 0x50a49f6c
-1, 159216, 5888, 0xb77e1b83
-0, 162000, 192000, 0xb6072f65
-1, 165224, 5888, 0x6c6d6693
-0, 168000, 192000, 0x093ce1a8
-1, 171233, 5888, 0xd9f064d4
-0, 174000, 192000, 0x55afe3db
-1, 177241, 5888, 0x85dd990d
-0, 180000, 192000, 0x81c3bfab
-1, 183249, 5888, 0x385e021b
-0, 186000, 192000, 0x583ebd3d
-1, 189257, 5888, 0xac09fd02
-0, 192000, 192000, 0x2504f003
-1, 195265, 5888, 0xc6dcdff2
-0, 198000, 192000, 0x44ade2af
-1, 201273, 5888, 0x86a6944d
-0, 204000, 192000, 0x77cbcfd8
-1, 207282, 5888, 0x8587b964
-0, 210000, 192000, 0xac7ddfa1
-1, 213290, 5888, 0x2b0355ff
-0, 216000, 192000, 0x79f7cfe8
-1, 219298, 5888, 0xe4148a85
-0, 222000, 192000, 0xdf2898fd
-1, 225306, 5888, 0xdf02ed4f
-1, 231314, 5888, 0x87a54b15
-1, 237322, 5888, 0x3ad2be45
-1, 243331, 5888, 0x3a49c2c3
-1, 249339, 5888, 0xc2b66404
-1, 255347, 5888, 0xac3e234a
-1, 261355, 5888, 0x5dcf523b
-1, 267363, 5888, 0x2034b5d6
-1, 273371, 5888, 0x96882832
-1, 279380, 5888, 0x2be3d534
-1, 285388, 5888, 0xa841a49d
diff --git a/gst-libs/ext/libav/tests/ref/fate/ea-tqi b/gst-libs/ext/libav/tests/ref/fate/ea-tqi
new file mode 100644
index 0000000..ba0073b
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/ea-tqi
@@ -0,0 +1,27 @@
+#tb 0: 1/90000
+0, 0, 0, 0, 115200, 0x375ec573
+0, 6000, 6000, 0, 115200, 0x375ec573
+0, 12000, 12000, 0, 115200, 0x375ec573
+0, 18000, 18000, 0, 115200, 0x375ec573
+0, 24000, 24000, 0, 115200, 0x375ec573
+0, 30000, 30000, 0, 115200, 0x375ec573
+0, 36000, 36000, 0, 115200, 0x375ec573
+0, 42000, 42000, 0, 115200, 0x375ec573
+0, 48000, 48000, 0, 115200, 0x0b4d31bf
+0, 54000, 54000, 0, 115200, 0xdd724598
+0, 60000, 60000, 0, 115200, 0xc3077e75
+0, 66000, 66000, 0, 115200, 0xbf70778a
+0, 72000, 72000, 0, 115200, 0x117eb766
+0, 78000, 78000, 0, 115200, 0x4617fbad
+0, 84000, 84000, 0, 115200, 0x5f5b02d2
+0, 90000, 90000, 0, 115200, 0x2a9c5325
+0, 96000, 96000, 0, 115200, 0x14a89e2a
+0, 102000, 102000, 0, 115200, 0xe69aa994
+0, 108000, 108000, 0, 115200, 0xfbacf589
+0, 114000, 114000, 0, 115200, 0x1d714c6e
+0, 120000, 120000, 0, 115200, 0x6eff66cb
+0, 126000, 126000, 0, 115200, 0xee21c1cb
+0, 132000, 132000, 0, 115200, 0xce714ada
+0, 138000, 138000, 0, 115200, 0xf89d56c3
+0, 144000, 144000, 0, 115200, 0x65fd5e60
+0, 150000, 150000, 0, 115200, 0x0c256424
diff --git a/gst-libs/ext/libav/tests/ref/fate/ea-vp60 b/gst-libs/ext/libav/tests/ref/fate/ea-vp60
deleted file mode 100644
index b5a70c3..0000000
--- a/gst-libs/ext/libav/tests/ref/fate/ea-vp60
+++ /dev/null
@@ -1,133 +0,0 @@
-0, 0, 55296, 0x6a3202a3
-0, 3003, 55296, 0x2af202eb
-0, 6006, 55296, 0xa1a40388
-0, 9009, 55296, 0x61c90426
-0, 12012, 55296, 0x17720594
-0, 15015, 55296, 0x49440805
-0, 18018, 55296, 0x5b2e0d32
-0, 21021, 55296, 0x207891c1
-0, 24024, 55296, 0x502da4cd
-0, 27027, 55296, 0x75a22a75
-0, 30030, 55296, 0xd55099af
-0, 33033, 55296, 0x48778bb6
-0, 36036, 55296, 0xe76b7df7
-0, 39039, 55296, 0x5a049f33
-0, 42042, 55296, 0xc83d9b90
-0, 45045, 55296, 0x567877b8
-0, 48048, 55296, 0x334c7f6e
-0, 51051, 55296, 0x8717945c
-0, 54054, 55296, 0xe432831e
-0, 57057, 55296, 0x032e8d2d
-0, 60060, 55296, 0x37109fd6
-0, 63063, 55296, 0xe9b0b61b
-0, 66066, 55296, 0x7385dae8
-0, 69069, 55296, 0x74b8a9f5
-0, 72072, 55296, 0xbce2e218
-0, 75075, 55296, 0x0ab6c623
-0, 78078, 55296, 0x2234d6d6
-0, 81081, 55296, 0xd18be4d6
-0, 84084, 55296, 0x5247ecc9
-0, 87087, 55296, 0xc89f10ca
-0, 90090, 55296, 0x16181f87
-0, 93093, 55296, 0x893bfa85
-0, 96096, 55296, 0x1fd9f1c0
-0, 99099, 55296, 0xa2e8e6a9
-0, 102102, 55296, 0x1b42dfd5
-0, 105105, 55296, 0x0fa9f509
-0, 108108, 55296, 0x4449c216
-0, 111111, 55296, 0xb66baa36
-0, 114114, 55296, 0x38c19f3b
-0, 117117, 55296, 0xcdce83a0
-0, 120120, 55296, 0xac4ea82b
-0, 123123, 55296, 0xb77a6979
-0, 126126, 55296, 0xc8834ec2
-0, 129129, 55296, 0x181d3f0f
-0, 132132, 55296, 0x2ae04252
-0, 135135, 55296, 0x07633c18
-0, 138138, 55296, 0xdc6a3340
-0, 141141, 55296, 0xa456ebb1
-0, 144144, 55296, 0xbf7de5e2
-0, 147147, 55296, 0x54a1c39b
-0, 150150, 55296, 0x08fc9423
-0, 153153, 55296, 0x926f968a
-0, 156156, 55296, 0x5c908481
-0, 159159, 55296, 0x6b257f16
-0, 162162, 55296, 0xbaf8658a
-0, 165165, 55296, 0x61c957b1
-0, 168168, 55296, 0xa6d181ff
-0, 171171, 55296, 0xef476e69
-0, 174174, 55296, 0x74f72f9a
-0, 177177, 55296, 0x3a9328e9
-0, 180180, 55296, 0xbe962874
-0, 183183, 55296, 0x5f8b58cc
-0, 186186, 55296, 0x1e066d22
-0, 189189, 55296, 0x9ef72b34
-0, 192192, 55296, 0x525c2bb1
-0, 195195, 55296, 0x8e5a20a3
-0, 198198, 55296, 0x1c6723d0
-0, 201201, 55296, 0x2b1023c8
-0, 204204, 55296, 0x8f682691
-0, 207207, 55296, 0x3a0624f5
-0, 210210, 55296, 0xbc1046fb
-0, 213213, 55296, 0x2859470e
-0, 216216, 55296, 0x61d45a12
-0, 219219, 55296, 0xa68853b6
-0, 222222, 55296, 0x36543ce4
-0, 225225, 55296, 0x95b953d4
-0, 228228, 55296, 0x804b3c53
-0, 231231, 55296, 0x743960f6
-0, 234234, 55296, 0x23916b9c
-0, 237237, 55296, 0x8f5a59e3
-0, 240240, 55296, 0xf1285f83
-0, 243243, 55296, 0xde75640f
-0, 246246, 55296, 0xde146188
-0, 249249, 55296, 0xb5315cc9
-0, 252252, 55296, 0xa85f6861
-0, 255255, 55296, 0x4fda562f
-0, 258258, 55296, 0xa0185863
-0, 261261, 55296, 0xe4dc5a5f
-0, 264264, 55296, 0x8a2aabb6
-0, 267267, 55296, 0x3ba89b4f
-0, 270270, 55296, 0x82b07c21
-0, 273273, 55296, 0xb7998478
-0, 276276, 55296, 0xceca8046
-0, 279279, 55296, 0xe652b325
-0, 282282, 55296, 0xc26bb607
-0, 285285, 55296, 0x40c99200
-0, 288288, 55296, 0x61bc9b27
-0, 291291, 55296, 0x1e4baa30
-0, 294294, 55296, 0xd8a7adb0
-0, 297297, 55296, 0x0d0aa8fb
-0, 300300, 55296, 0x1f1ba33c
-0, 303303, 55296, 0xa000a80b
-0, 306306, 55296, 0xb49dd332
-0, 309309, 55296, 0x6b8ac499
-0, 312312, 55296, 0x9636ed15
-0, 315315, 55296, 0xa152f03d
-0, 318318, 55296, 0x47a8cfc7
-0, 321321, 55296, 0x9f94c82a
-0, 324324, 55296, 0xe208d626
-0, 327327, 55296, 0x28cc0616
-0, 330330, 55296, 0xc545179e
-0, 333333, 55296, 0xdf9205af
-0, 336336, 55296, 0x31d6ed99
-0, 339339, 55296, 0x866bf86e
-0, 342342, 55296, 0x0490fbd1
-0, 345345, 55296, 0xe1102987
-0, 348348, 55296, 0x7f860c29
-0, 351351, 55296, 0xc3a91f7a
-0, 354354, 55296, 0x69641a52
-0, 357357, 55296, 0x05b12204
-0, 360360, 55296, 0x715b6206
-0, 363363, 55296, 0xdcf55139
-0, 366366, 55296, 0x1369f746
-0, 369369, 55296, 0xc1533ef5
-0, 372372, 55296, 0xc00ff85f
-0, 375375, 55296, 0x4f5f70dc
-0, 378378, 55296, 0x85720ccc
-0, 381381, 55296, 0xfdff0780
-0, 384384, 55296, 0x57ef04ff
-0, 387387, 55296, 0xbf94041f
-0, 390390, 55296, 0x4cee0392
-0, 393393, 55296, 0x80160314
-0, 396396, 55296, 0x396802af
diff --git a/gst-libs/ext/libav/tests/ref/fate/ea-vp61 b/gst-libs/ext/libav/tests/ref/fate/ea-vp61
deleted file mode 100644
index bddaf42..0000000
--- a/gst-libs/ext/libav/tests/ref/fate/ea-vp61
+++ /dev/null
@@ -1,120 +0,0 @@
-0, 0, 18816, 0xc3fe9fc7
-0, 3003, 18816, 0x6ddf972f
-0, 6006, 18816, 0x72808b6e
-0, 9009, 18816, 0x8f09857f
-0, 12012, 18816, 0xe8027c00
-0, 15015, 18816, 0x308670cf
-0, 18018, 18816, 0x0e656170
-0, 21021, 18816, 0x594e54a4
-0, 24024, 18816, 0x36944b05
-0, 27027, 18816, 0x87013a34
-0, 30030, 18816, 0xc0f32f0d
-0, 33033, 18816, 0x911f1951
-0, 36036, 18816, 0xad590d59
-0, 39039, 18816, 0x943afff0
-0, 42042, 18816, 0x7f5ef719
-0, 45045, 18816, 0x889feafc
-0, 48048, 18816, 0x4334e12b
-0, 51051, 18816, 0xd080cc67
-0, 54054, 18816, 0xc3c1c04c
-0, 57057, 18816, 0x816bae4b
-0, 60060, 18816, 0xed23a5c7
-0, 63063, 18816, 0x86689c2f
-0, 66066, 18816, 0x63408c52
-0, 69069, 18816, 0x399c79d6
-0, 72072, 18816, 0xf0ff63bf
-0, 75075, 18816, 0xa6185353
-0, 78078, 18816, 0xe33d46fc
-0, 81081, 18816, 0xd58d3c6d
-0, 84084, 18816, 0xc94a27ea
-0, 87087, 18816, 0x62f31c59
-0, 90090, 18816, 0x71880825
-0, 93093, 18816, 0xa6ce01d7
-0, 96096, 18816, 0xa1d4fc06
-0, 99099, 18816, 0xc208f570
-0, 102102, 18816, 0xc862e637
-0, 105105, 18816, 0xcf9ed93a
-0, 108108, 18816, 0x85a8cbcc
-0, 111111, 18816, 0x650ac6c1
-0, 114114, 18816, 0xb418c12b
-0, 117117, 18816, 0x9fe5b412
-0, 120120, 18816, 0x80f6a7c1
-0, 123123, 18816, 0x283299e4
-0, 126126, 18816, 0x15429202
-0, 129129, 18816, 0x9f0f8c8a
-0, 132132, 18816, 0x8e828811
-0, 135135, 18816, 0xaac67993
-0, 138138, 18816, 0x8f3b6f4f
-0, 141141, 18816, 0x0b125f95
-0, 144144, 18816, 0xb4e75d14
-0, 147147, 18816, 0x1bac5933
-0, 150150, 18816, 0x300b521b
-0, 153153, 18816, 0x51174590
-0, 156156, 18816, 0x03df3d70
-0, 159159, 18816, 0x338a344a
-0, 162162, 18816, 0x45ad328d
-0, 165165, 18816, 0x2d4e321a
-0, 168168, 18816, 0x15932563
-0, 171171, 18816, 0x9b4f1c76
-0, 174174, 18816, 0x8e31153c
-0, 177177, 18816, 0xfb391185
-0, 180180, 18816, 0x93ee0cdc
-0, 183183, 18816, 0xddeb0642
-0, 186186, 18816, 0xda6cf529
-0, 189189, 18816, 0xdbd6f085
-0, 192192, 18816, 0x357aec81
-0, 195195, 18816, 0x36eaecca
-0, 198198, 18816, 0x6535ee02
-0, 201201, 18816, 0xb7dfe466
-0, 204204, 18816, 0x58d3d86b
-0, 207207, 18816, 0xd8aad64b
-0, 210210, 18816, 0x37ecd588
-0, 213213, 18816, 0xe2f9cee4
-0, 216216, 18816, 0xcd1ac93e
-0, 219219, 18816, 0x18e1be81
-0, 222222, 18816, 0xa05bb9d7
-0, 225225, 18816, 0xe0ebb663
-0, 228228, 18816, 0x7d61b39a
-0, 231231, 18816, 0x01b8acb5
-0, 234234, 18816, 0x7577aa8b
-0, 237237, 18816, 0x6bbda4b5
-0, 240240, 18816, 0xd0cc9b29
-0, 243243, 18816, 0xb2858cbb
-0, 246246, 18816, 0x93608c9d
-0, 249249, 18816, 0x80c38e03
-0, 252252, 18816, 0x37d6843c
-0, 255255, 18816, 0xacc47b9a
-0, 258258, 18816, 0xc4317178
-0, 261261, 18816, 0xc92f6ebd
-0, 264264, 18816, 0xc1217a3b
-0, 267267, 18816, 0x03a37ccb
-0, 270270, 18816, 0xf38c71a2
-0, 273273, 18816, 0x68ff697d
-0, 276276, 18816, 0x0fe358e5
-0, 279279, 18816, 0x58455870
-0, 282282, 18816, 0xc9075ce7
-0, 285285, 18816, 0x16685773
-0, 288288, 18816, 0x1b434c0e
-0, 291291, 18816, 0x008e4c97
-0, 294294, 18816, 0xb4d04f4f
-0, 297297, 18816, 0xc8c94848
-0, 300300, 18816, 0x64664191
-0, 303303, 18816, 0xd591367f
-0, 306306, 18816, 0xc70d3141
-0, 309309, 18816, 0x8d492655
-0, 312312, 18816, 0x7e7f22c8
-0, 315315, 18816, 0x335d23f9
-0, 318318, 18816, 0x0a7f22b6
-0, 321321, 18816, 0x6cf51cb2
-0, 324324, 18816, 0x312516e1
-0, 327327, 18816, 0x8a3c0c7a
-0, 330330, 18816, 0x997d0d20
-0, 333333, 18816, 0xffbd117e
-0, 336336, 18816, 0x855808ca
-0, 339339, 18816, 0xe335fb94
-0, 342342, 18816, 0x12e6f95c
-0, 345345, 18816, 0x2d62f845
-0, 348348, 18816, 0x7e63f591
-0, 351351, 18816, 0x7463f175
-0, 354354, 18816, 0x1521e0d2
-0, 357357, 18816, 0x96a8dbce
diff --git a/gst-libs/ext/libav/tests/ref/fate/eval b/gst-libs/ext/libav/tests/ref/fate/eval
index c16527c..b01e5a5 100644
--- a/gst-libs/ext/libav/tests/ref/fate/eval
+++ b/gst-libs/ext/libav/tests/ref/fate/eval
@@ -94,6 +94,30 @@ Evaluating 'st(0, 123)'
Evaluating 'st(1, 123); ld(1)'
'st(1, 123); ld(1)' -> 123.000000
+Evaluating 'lte(0, 1)'
+'lte(0, 1)' -> 1.000000
+
+Evaluating 'lte(1, 1)'
+'lte(1, 1)' -> 1.000000
+
+Evaluating 'lte(1, 0)'
+'lte(1, 0)' -> 0.000000
+
+Evaluating 'lt(0, 1)'
+'lt(0, 1)' -> 1.000000
+
+Evaluating 'lt(1, 1)'
+'lt(1, 1)' -> 0.000000
+
+Evaluating 'gt(1, 0)'
+'gt(1, 0)' -> 1.000000
+
+Evaluating 'gt(2, 7)'
+'gt(2, 7)' -> 0.000000
+
+Evaluating 'gte(122, 122)'
+'gte(122, 122)' -> 1.000000
+
Evaluating 'st(0, 1); while(lte(ld(0), 100), st(1, ld(1)+ld(0));st(0, ld(0)+1)); ld(1)'
'st(0, 1); while(lte(ld(0), 100), st(1, ld(1)+ld(0));st(0, ld(0)+1)); ld(1)' -> 5050.000000
@@ -112,6 +136,18 @@ Evaluating 'isnan(1)'
Evaluating 'isnan(NAN)'
'isnan(NAN)' -> 1.000000
+Evaluating 'isnan(INF)'
+'isnan(INF)' -> 0.000000
+
+Evaluating 'isinf(1)'
+'isinf(1)' -> 0.000000
+
+Evaluating 'isinf(NAN)'
+'isinf(NAN)' -> 0.000000
+
+Evaluating 'isinf(INF)'
+'isinf(INF)' -> 1.000000
+
Evaluating 'floor(NAN)'
'floor(NAN)' -> nan
@@ -148,5 +184,11 @@ Evaluating 'not(NAN)'
Evaluating 'not(0)'
'not(0)' -> 1.000000
+Evaluating '6.0206dB'
+'6.0206dB' -> 2.000000
+
+Evaluating '-3.0103dB'
+'-3.0103dB' -> 0.707107
+
12.700000 == 12.7
0.931323 == 0.931322575
diff --git a/gst-libs/ext/libav/tests/ref/fate/film-cvid b/gst-libs/ext/libav/tests/ref/fate/film-cvid
new file mode 100644
index 0000000..12b1f1c
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/film-cvid
@@ -0,0 +1,111 @@
+#tb 0: 1/30
+0, 0, 0, 1, 107520, 0xa6c9fdd2
+0, 2, 2, 1, 107520, 0x61eb28c1
+0, 4, 4, 1, 107520, 0x45e20af7
+0, 6, 6, 1, 107520, 0x366970fc
+0, 8, 8, 1, 107520, 0xa392bcb3
+0, 10, 10, 1, 107520, 0xcf7bac98
+0, 12, 12, 1, 107520, 0x222eba53
+0, 14, 14, 1, 107520, 0x74e255a1
+0, 16, 16, 1, 107520, 0xc19eec6f
+0, 18, 18, 1, 107520, 0xa3880681
+0, 20, 20, 1, 107520, 0x957878db
+0, 22, 22, 1, 107520, 0x18340692
+0, 24, 24, 1, 107520, 0x9970f24d
+0, 26, 26, 1, 107520, 0xf08618aa
+0, 28, 28, 1, 107520, 0xee7324f0
+0, 30, 30, 1, 107520, 0xe15025b3
+0, 32, 32, 1, 107520, 0x8afa312e
+0, 34, 34, 1, 107520, 0x717a7d0f
+0, 36, 36, 1, 107520, 0x355c6e23
+0, 38, 38, 1, 107520, 0x7015a50f
+0, 40, 40, 1, 107520, 0xcdfc1a16
+0, 42, 42, 1, 107520, 0x38d929e7
+0, 44, 44, 1, 107520, 0x52913423
+0, 46, 46, 1, 107520, 0xe2c91c10
+0, 48, 48, 1, 107520, 0x85516e9c
+0, 50, 50, 1, 107520, 0xd1626030
+0, 52, 52, 1, 107520, 0xea7b16de
+0, 54, 54, 1, 107520, 0xa33eaa0d
+0, 56, 56, 1, 107520, 0x8e3be6a6
+0, 58, 58, 1, 107520, 0x14147bd6
+0, 60, 60, 1, 107520, 0x07d54bec
+0, 62, 62, 1, 107520, 0xe287a0a7
+0, 64, 64, 1, 107520, 0xc023a14d
+0, 66, 66, 1, 107520, 0x2437085d
+0, 68, 68, 1, 107520, 0x63823918
+0, 70, 70, 1, 107520, 0xbc17e198
+0, 72, 72, 1, 107520, 0x9d99bc81
+0, 74, 74, 1, 107520, 0x7e4ec71e
+0, 76, 76, 1, 107520, 0x55b98376
+0, 78, 78, 1, 107520, 0x356d8e9e
+0, 80, 80, 1, 107520, 0xf77e8a61
+0, 82, 82, 1, 107520, 0x5ae7c8c7
+0, 84, 84, 1, 107520, 0x8acf9322
+0, 86, 86, 1, 107520, 0x40a9177e
+0, 88, 88, 1, 107520, 0x3e0e4d8d
+0, 90, 90, 1, 107520, 0xd268865b
+0, 92, 92, 1, 107520, 0x89a4efeb
+0, 94, 94, 1, 107520, 0x70ca2478
+0, 96, 96, 1, 107520, 0xcc9ec981
+0, 98, 98, 1, 107520, 0xf0648459
+0, 100, 100, 1, 107520, 0x7e4a4cca
+0, 102, 102, 1, 107520, 0xb315dc65
+0, 104, 104, 1, 107520, 0x2aecc7b4
+0, 106, 106, 1, 107520, 0x81742f51
+0, 108, 108, 1, 107520, 0x3a1d7571
+0, 110, 110, 1, 107520, 0x3a1d7571
+0, 112, 112, 1, 107520, 0x3a1d7571
+0, 114, 114, 1, 107520, 0x3a1d7571
+0, 116, 116, 1, 107520, 0x3a1d7571
+0, 118, 118, 1, 107520, 0x3a1d7571
+0, 120, 120, 1, 107520, 0x3a1d7571
+0, 122, 122, 1, 107520, 0xe974733e
+0, 124, 124, 1, 107520, 0x999c6fbf
+0, 126, 126, 1, 107520, 0x26b56b6e
+0, 128, 128, 1, 107520, 0xc9f9647b
+0, 130, 130, 1, 107520, 0x6d025d00
+0, 132, 132, 1, 107520, 0xf9c056c1
+0, 134, 134, 1, 107520, 0xa5cc4d0b
+0, 136, 136, 1, 107520, 0x1a4c4236
+0, 138, 138, 1, 107520, 0xa9d538b6
+0, 140, 140, 1, 107520, 0x14682d00
+0, 142, 142, 1, 107520, 0x6236204f
+0, 144, 144, 1, 107520, 0x303e14aa
+0, 146, 146, 1, 107520, 0x943b0837
+0, 148, 148, 1, 107520, 0xfce5fd07
+0, 150, 150, 1, 107520, 0xd993f193
+0, 152, 152, 1, 107520, 0x4d48e7b4
+0, 154, 154, 1, 107520, 0x61ccdf83
+0, 156, 156, 1, 107520, 0xfb4fd608
+0, 158, 158, 1, 107520, 0x5efdcdb3
+0, 160, 160, 1, 107520, 0xb03ec886
+0, 162, 162, 1, 107520, 0xf464c343
+0, 164, 164, 1, 107520, 0xf464c343
+0, 166, 166, 1, 107520, 0xf464c343
+0, 168, 168, 1, 107520, 0xf464c343
+0, 170, 170, 1, 107520, 0xf464c343
+0, 172, 172, 1, 107520, 0xf464c343
+0, 174, 174, 1, 107520, 0xf464c343
+0, 176, 176, 1, 107520, 0xf464c343
+0, 178, 178, 1, 107520, 0xf464c343
+0, 180, 180, 1, 107520, 0xf464c343
+0, 182, 182, 1, 107520, 0xf464c343
+0, 184, 184, 1, 107520, 0xf2b2c712
+0, 186, 186, 1, 107520, 0xf2b2c712
+0, 188, 188, 1, 107520, 0xf2b2c712
+0, 190, 190, 1, 107520, 0xf2b2c712
+0, 192, 192, 1, 107520, 0xb95e6bc8
+0, 194, 194, 1, 107520, 0x33feee37
+0, 196, 196, 1, 107520, 0x36ee3cd5
+0, 198, 198, 1, 107520, 0x59096471
+0, 200, 200, 1, 107520, 0x53b470c6
+0, 202, 202, 1, 107520, 0xdb7c64ff
+0, 204, 204, 1, 107520, 0xe5a1596a
+0, 206, 206, 1, 107520, 0x8c8942eb
+0, 208, 208, 1, 107520, 0x5ecc379e
+0, 210, 210, 1, 107520, 0xea09432a
+0, 212, 212, 1, 107520, 0xe01e6b73
+0, 214, 214, 1, 107520, 0x1d13bba8
+0, 216, 216, 1, 107520, 0x3a993a6c
+0, 218, 218, 1, 107520, 0x2ede041a
diff --git a/gst-libs/ext/libav/tests/ref/fate/film-cvid-pcm-stereo-8bit b/gst-libs/ext/libav/tests/ref/fate/film-cvid-pcm-stereo-8bit
deleted file mode 100644
index 4f3fcf4..0000000
--- a/gst-libs/ext/libav/tests/ref/fate/film-cvid-pcm-stereo-8bit
+++ /dev/null
@@ -1,139 +0,0 @@
-0, 0, 107520, 0xa6c9fdd2
-1, 0, 88192, 0x23bb50ae
-0, 3000, 107520, 0x61eb28c1
-0, 6000, 107520, 0x45e20af7
-0, 9000, 107520, 0x366970fc
-0, 12000, 107520, 0xa392bcb3
-0, 15000, 107520, 0xcf7bac98
-0, 18000, 107520, 0x222eba53
-0, 21000, 107520, 0x74e255a1
-0, 24000, 107520, 0xc19eec6f
-0, 27000, 107520, 0xa3880681
-0, 30000, 107520, 0x957878db
-0, 33000, 107520, 0x18340692
-0, 36000, 107520, 0x9970f24d
-0, 39000, 107520, 0xf08618aa
-0, 42000, 107520, 0xee7324f0
-1, 44996, 44112, 0x79600f01
-0, 45000, 107520, 0xe15025b3
-0, 48000, 107520, 0x8afa312e
-0, 51000, 107520, 0x717a7d0f
-0, 54000, 107520, 0x355c6e23
-0, 57000, 107520, 0x7015a50f
-0, 60000, 107520, 0xcdfc1a16
-0, 63000, 107520, 0x38d929e7
-0, 66000, 107520, 0x52913423
-1, 67502, 44096, 0x09dbf7aa
-0, 69000, 107520, 0xe2c91c10
-0, 72000, 107520, 0x85516e9c
-0, 75000, 107520, 0xd1626030
-0, 78000, 107520, 0xea7b16de
-0, 81000, 107520, 0xa33eaa0d
-0, 84000, 107520, 0x8e3be6a6
-0, 87000, 107520, 0x14147bd6
-0, 90000, 107520, 0x07d54bec
-1, 90000, 44112, 0x18fed048
-0, 93000, 107520, 0xe287a0a7
-0, 96000, 107520, 0xc023a14d
-0, 99000, 107520, 0x2437085d
-0, 102000, 107520, 0x63823918
-0, 105000, 107520, 0xbc17e198
-0, 108000, 107520, 0x9d99bc81
-0, 111000, 107520, 0x7e4ec71e
-1, 112506, 44112, 0x030d35ef
-0, 114000, 107520, 0x55b98376
-0, 117000, 107520, 0x356d8e9e
-0, 120000, 107520, 0xf77e8a61
-0, 123000, 107520, 0x5ae7c8c7
-0, 126000, 107520, 0x8acf9322
-0, 129000, 107520, 0x40a9177e
-0, 132000, 107520, 0x3e0e4d8d
-0, 135000, 107520, 0xd268865b
-1, 135012, 44112, 0xc23154d5
-0, 138000, 107520, 0x89a4efeb
-0, 141000, 107520, 0x70ca2478
-0, 144000, 107520, 0xcc9ec981
-0, 147000, 107520, 0xf0648459
-0, 150000, 107520, 0x7e4a4cca
-0, 153000, 107520, 0xb315dc65
-0, 156000, 107520, 0x2aecc7b4
-1, 157518, 44064, 0xe4713ee7
-0, 159000, 107520, 0x81742f51
-0, 162000, 107520, 0x3a1d7571
-0, 165000, 107520, 0x3a1d7571
-0, 168000, 107520, 0x3a1d7571
-0, 171000, 107520, 0x3a1d7571
-0, 174000, 107520, 0x3a1d7571
-0, 177000, 107520, 0x3a1d7571
-0, 180000, 107520, 0x3a1d7571
-1, 180000, 44112, 0xddc19d91
-0, 183000, 107520, 0xe974733e
-0, 186000, 107520, 0x999c6fbf
-0, 189000, 107520, 0x26b56b6e
-0, 192000, 107520, 0xc9f9647b
-0, 195000, 107520, 0x6d025d00
-0, 198000, 107520, 0xf9c056c1
-0, 201000, 107520, 0xa5cc4d0b
-1, 202506, 44112, 0x9591522d
-0, 204000, 107520, 0x1a4c4236
-0, 207000, 107520, 0xa9d538b6
-0, 210000, 107520, 0x14682d00
-0, 213000, 107520, 0x6236204f
-0, 216000, 107520, 0x303e14aa
-0, 219000, 107520, 0x943b0837
-0, 222000, 107520, 0xfce5fd07
-0, 225000, 107520, 0xd993f193
-1, 225012, 44112, 0x90deb013
-0, 228000, 107520, 0x4d48e7b4
-0, 231000, 107520, 0x61ccdf83
-0, 234000, 107520, 0xfb4fd608
-0, 237000, 107520, 0x5efdcdb3
-0, 240000, 107520, 0xb03ec886
-0, 243000, 107520, 0xf464c343
-0, 246000, 107520, 0xf464c343
-1, 247518, 44064, 0x3842d420
-0, 249000, 107520, 0xf464c343
-0, 252000, 107520, 0xf464c343
-0, 255000, 107520, 0xf464c343
-0, 258000, 107520, 0xf464c343
-0, 261000, 107520, 0xf464c343
-0, 264000, 107520, 0xf464c343
-0, 267000, 107520, 0xf464c343
-0, 270000, 107520, 0xf464c343
-1, 270000, 44112, 0x99c8c3d9
-0, 273000, 107520, 0xf464c343
-0, 276000, 107520, 0xf2b2c712
-0, 279000, 107520, 0xf2b2c712
-0, 282000, 107520, 0xf2b2c712
-0, 285000, 107520, 0xf2b2c712
-0, 288000, 107520, 0xb95e6bc8
-0, 291000, 107520, 0x33feee37
-1, 292506, 44112, 0xffaf3824
-0, 294000, 107520, 0x36ee3cd5
-0, 297000, 107520, 0x59096471
-0, 300000, 107520, 0x53b470c6
-0, 303000, 107520, 0xdb7c64ff
-0, 306000, 107520, 0xe5a1596a
-0, 309000, 107520, 0x8c8942eb
-0, 312000, 107520, 0x5ecc379e
-0, 315000, 107520, 0xea09432a
-1, 315012, 44112, 0x3dbe1aef
-0, 318000, 107520, 0xe01e6b73
-0, 321000, 107520, 0x1d13bba8
-0, 324000, 107520, 0x3a993a6c
-0, 327000, 107520, 0x2ede041a
-1, 337518, 44064, 0xed2c7dfb
-1, 360000, 44112, 0x9e475274
-1, 382506, 44112, 0x541f05d4
-1, 405012, 44112, 0x09e39025
-1, 427518, 44064, 0xdc111087
-1, 450000, 44112, 0xb8f86e48
-1, 472506, 44112, 0xa1e0c75c
-1, 495012, 44112, 0x0654dcb0
-1, 517518, 44064, 0xb921e11a
-1, 540000, 44112, 0xe0ac619f
-1, 562506, 44112, 0xb07aa65c
-1, 585012, 44112, 0x24610ff0
-1, 607518, 44064, 0x00000000
-1, 630000, 44112, 0x00000000
-1, 652506, 8800, 0x00000000
diff --git a/gst-libs/ext/libav/tests/ref/fate/filter-delogo b/gst-libs/ext/libav/tests/ref/fate/filter-delogo
new file mode 100644
index 0000000..1a1f497
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/filter-delogo
@@ -0,0 +1,110 @@
+#tb 0: 1/1000
+0, 1, 1, 0, 126720, 0x689de87e
+0, 33, 33, 0, 126720, 0x3db9e91c
+0, 66, 66, 0, 126720, 0x3db9e91c
+0, 100, 100, 0, 126720, 0x3db9e91c
+0, 133, 133, 0, 126720, 0xfa6ae95e
+0, 166, 166, 0, 126720, 0x5bcbf0e6
+0, 200, 200, 0, 126720, 0x94a0f126
+0, 233, 233, 0, 126720, 0x0250f106
+0, 266, 266, 0, 126720, 0xcf6ab4bc
+0, 300, 300, 0, 126720, 0x429eb57c
+0, 333, 333, 0, 126720, 0x3bf0b5bc
+0, 367, 367, 0, 126720, 0xcaedb591
+0, 400, 400, 0, 126720, 0xa492b5ec
+0, 433, 433, 0, 126720, 0x2431b85c
+0, 467, 467, 0, 126720, 0x8283b8dc
+0, 500, 500, 0, 126720, 0xd71bb871
+0, 533, 533, 0, 126720, 0x698eb5cc
+0, 567, 567, 0, 126720, 0x4719aa98
+0, 600, 600, 0, 126720, 0x9ca1962c
+0, 633, 633, 0, 126720, 0x18cda460
+0, 667, 667, 0, 126720, 0xc230b716
+0, 700, 700, 0, 126720, 0x8451a4e2
+0, 734, 734, 0, 126720, 0x59e9a7ea
+0, 767, 767, 0, 126720, 0xc77ca73d
+0, 800, 800, 0, 126720, 0x725fb976
+0, 834, 834, 0, 126720, 0xb30da3b3
+0, 867, 867, 0, 126720, 0x7af2ea86
+0, 900, 900, 0, 126720, 0x40d4b4eb
+0, 934, 934, 0, 126720, 0x49d00307
+0, 967, 967, 0, 126720, 0x0654849c
+0, 1000, 1000, 0, 126720, 0xe46d0107
+0, 1034, 1034, 0, 126720, 0xa483b963
+0, 1067, 1067, 0, 126720, 0xd0e903f0
+0, 1101, 1101, 0, 126720, 0x964ed592
+0, 1134, 1134, 0, 126720, 0x23fbdb3c
+0, 1167, 1167, 0, 126720, 0x59fdace5
+0, 1201, 1201, 0, 126720, 0xb1e37954
+0, 1234, 1234, 0, 126720, 0x8ed9c554
+0, 1267, 1267, 0, 126720, 0xe3c4b39f
+0, 1301, 1301, 0, 126720, 0xfd17e0ce
+0, 1334, 1334, 0, 126720, 0xf26e1dcc
+0, 1368, 1368, 0, 126720, 0x13cc783c
+0, 1401, 1401, 0, 126720, 0x47ad47a1
+0, 1434, 1434, 0, 126720, 0x427c8b0d
+0, 1468, 1468, 0, 126720, 0x59d99901
+0, 1501, 1501, 0, 126720, 0xc40707da
+0, 1534, 1534, 0, 126720, 0xcd060dce
+0, 1568, 1568, 0, 126720, 0xed4024f6
+0, 1601, 1601, 0, 126720, 0x7decd2b4
+0, 1634, 1634, 0, 126720, 0xd1d2e730
+0, 1668, 1668, 0, 126720, 0x77cee457
+0, 1701, 1701, 0, 126720, 0xe78d02c0
+0, 1735, 1735, 0, 126720, 0xad0beb29
+0, 1768, 1768, 0, 126720, 0xc414eea2
+0, 1801, 1801, 0, 126720, 0x6a15f17d
+0, 1835, 1835, 0, 126720, 0x516027f6
+0, 1868, 1868, 0, 126720, 0x4eda9dce
+0, 1901, 1901, 0, 126720, 0x7d9bdba3
+0, 1935, 1935, 0, 126720, 0x7aa3d5c0
+0, 1968, 1968, 0, 126720, 0x7c7a04f9
+0, 2001, 2001, 0, 126720, 0x3e8fb6cc
+0, 2035, 2035, 0, 126720, 0xd5474916
+0, 2068, 2068, 0, 126720, 0xf3f62bab
+0, 2102, 2102, 0, 126720, 0x2f054987
+0, 2135, 2135, 0, 126720, 0x974c2e81
+0, 2168, 2168, 0, 126720, 0xe7e28a97
+0, 2202, 2202, 0, 126720, 0x45e38b41
+0, 2235, 2235, 0, 126720, 0x169c7f19
+0, 2268, 2268, 0, 126720, 0x91d90ee8
+0, 2302, 2302, 0, 126720, 0xdd653e24
+0, 2335, 2335, 0, 126720, 0x0da598c4
+0, 2369, 2369, 0, 126720, 0x687e62cc
+0, 2402, 2402, 0, 126720, 0x7631232d
+0, 2435, 2435, 0, 126720, 0xbd1ea826
+0, 2469, 2469, 0, 126720, 0xb55f7f4b
+0, 2502, 2502, 0, 126720, 0x923f3fc9
+0, 2535, 2535, 0, 126720, 0x15515301
+0, 2569, 2569, 0, 126720, 0x9ee066e5
+0, 2602, 2602, 0, 126720, 0x7c21664b
+0, 2635, 2635, 0, 126720, 0x36849100
+0, 2669, 2669, 0, 126720, 0x08b1f61a
+0, 2702, 2702, 0, 126720, 0x5bfca6e2
+0, 2736, 2736, 0, 126720, 0x929f60e3
+0, 2769, 2769, 0, 126720, 0xa2b55c29
+0, 2802, 2802, 0, 126720, 0x68bd3ff3
+0, 2836, 2836, 0, 126720, 0x30db5b29
+0, 2869, 2869, 0, 126720, 0x00578f9b
+0, 2902, 2902, 0, 126720, 0x18368642
+0, 2936, 2936, 0, 126720, 0xbcb83a80
+0, 2969, 2969, 0, 126720, 0x90f36b72
+0, 3002, 3002, 0, 126720, 0x85e46522
+0, 3036, 3036, 0, 126720, 0x2429660a
+0, 3069, 3069, 0, 126720, 0xf283dfe2
+0, 3103, 3103, 0, 126720, 0x896b27dc
+0, 3136, 3136, 0, 126720, 0x5af4f961
+0, 3169, 3169, 0, 126720, 0x31897085
+0, 3203, 3203, 0, 126720, 0x441ce33e
+0, 3236, 3236, 0, 126720, 0x903f8009
+0, 3269, 3269, 0, 126720, 0xbdf33dba
+0, 3303, 3303, 0, 126720, 0x8a364f36
+0, 3336, 3336, 0, 126720, 0xda5513f6
+0, 3370, 3370, 0, 126720, 0xd60012b3
+0, 3403, 3403, 0, 126720, 0x67bce7be
+0, 3436, 3436, 0, 126720, 0x697e6174
+0, 3470, 3470, 0, 126720, 0xbe3e3e90
+0, 3503, 3503, 0, 126720, 0xf3e4bba6
+0, 3536, 3536, 0, 126720, 0x8124a679
+0, 3570, 3570, 0, 126720, 0x58d1acde
+0, 3603, 3603, 0, 126720, 0xd8a15ba3
diff --git a/gst-libs/ext/libav/tests/ref/fate/filter-yadif-mode0 b/gst-libs/ext/libav/tests/ref/fate/filter-yadif-mode0
new file mode 100644
index 0000000..e260977
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/filter-yadif-mode0
@@ -0,0 +1,32 @@
+#tb 0: 1/180000
+0, 64800, 64800, 0, 622080, 0x4440caef
+0, 72000, 72000, 0, 622080, 0xce67e69d
+0, 79200, 79200, 0, 622080, 0x1dbdc653
+0, 86400, 86400, 0, 622080, 0x82c591d1
+0, 93600, 93600, 0, 622080, 0x8193740b
+0, 100800, 100800, 0, 622080, 0xcb219711
+0, 108000, 108000, 0, 622080, 0x1870783b
+0, 115200, 115200, 0, 622080, 0x7080590b
+0, 122400, 122400, 0, 622080, 0x6df4175d
+0, 129600, 129600, 0, 622080, 0x6b530e95
+0, 136800, 136800, 0, 622080, 0x7f9d66f7
+0, 144000, 144000, 0, 622080, 0x338cda81
+0, 151200, 151200, 0, 622080, 0xb13797f8
+0, 158400, 158400, 0, 622080, 0xb51e7ca4
+0, 165600, 165600, 0, 622080, 0x353eed75
+0, 172800, 172800, 0, 622080, 0xf93e92b0
+0, 180000, 180000, 0, 622080, 0xd0811094
+0, 187200, 187200, 0, 622080, 0xb04a3141
+0, 194400, 194400, 0, 622080, 0x4ab84909
+0, 201600, 201600, 0, 622080, 0xa0fcb8fb
+0, 208800, 208800, 0, 622080, 0x9003aebb
+0, 216000, 216000, 0, 622080, 0x153faa3e
+0, 223200, 223200, 0, 622080, 0xae724063
+0, 230400, 230400, 0, 622080, 0xeb4de77a
+0, 237600, 237600, 0, 622080, 0x209ed8c7
+0, 244800, 244800, 0, 622080, 0xe2bbac96
+0, 252000, 252000, 0, 622080, 0xe945441e
+0, 259200, 259200, 0, 622080, 0x8f8cbd5f
+0, 266400, 266400, 0, 622080, 0xbc3cf717
+0, 273600, 273600, 0, 622080, 0x0109f125
+0, 280800, 280800, 0, 622080, 0x230c373f
diff --git a/gst-libs/ext/libav/tests/ref/fate/filter-yadif-mode1 b/gst-libs/ext/libav/tests/ref/fate/filter-yadif-mode1
new file mode 100644
index 0000000..b498137
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/filter-yadif-mode1
@@ -0,0 +1,63 @@
+#tb 0: 1/180000
+0, 64800, 64800, 0, 622080, 0x4440caef
+0, 68400, 68400, 0, 622080, 0xa5cea88b
+0, 72000, 72000, 0, 622080, 0xce67e69d
+0, 75600, 75600, 0, 622080, 0x9a57891f
+0, 79200, 79200, 0, 622080, 0x1dbdc653
+0, 82800, 82800, 0, 622080, 0xc171c0c5
+0, 86400, 86400, 0, 622080, 0x82c591d1
+0, 90000, 90000, 0, 622080, 0x20db9890
+0, 93600, 93600, 0, 622080, 0x8193740b
+0, 97200, 97200, 0, 622080, 0xdb181d52
+0, 100800, 100800, 0, 622080, 0xcb219711
+0, 104400, 104400, 0, 622080, 0xc2b913d1
+0, 108000, 108000, 0, 622080, 0x1870783b
+0, 111600, 111600, 0, 622080, 0xf1d9c5fb
+0, 115200, 115200, 0, 622080, 0x7080590b
+0, 118800, 118800, 0, 622080, 0x669c5775
+0, 122400, 122400, 0, 622080, 0x6df4175d
+0, 126000, 126000, 0, 622080, 0x01921a16
+0, 129600, 129600, 0, 622080, 0x6b530e95
+0, 133200, 133200, 0, 622080, 0xd5047bc9
+0, 136800, 136800, 0, 622080, 0x7f9d66f7
+0, 140400, 140400, 0, 622080, 0xa8b006eb
+0, 144000, 144000, 0, 622080, 0x338cda81
+0, 147600, 147600, 0, 622080, 0xf0e125a7
+0, 151200, 151200, 0, 622080, 0xb13797f8
+0, 154800, 154800, 0, 622080, 0x4afe2976
+0, 158400, 158400, 0, 622080, 0xb51e7ca4
+0, 162000, 162000, 0, 622080, 0x637fcbfe
+0, 165600, 165600, 0, 622080, 0x353eed75
+0, 169200, 169200, 0, 622080, 0xd9a8f5ac
+0, 172800, 172800, 0, 622080, 0xf93e92b0
+0, 176400, 176400, 0, 622080, 0x4540039f
+0, 180000, 180000, 0, 622080, 0xd0811094
+0, 183600, 183600, 0, 622080, 0x3039906f
+0, 187200, 187200, 0, 622080, 0xb04a3141
+0, 190800, 190800, 0, 622080, 0x52872cf9
+0, 194400, 194400, 0, 622080, 0x4ab84909
+0, 198000, 198000, 0, 622080, 0x82de12ee
+0, 201600, 201600, 0, 622080, 0xa0fcb8fb
+0, 205200, 205200, 0, 622080, 0x7e849cc9
+0, 208800, 208800, 0, 622080, 0x9003aebb
+0, 212400, 212400, 0, 622080, 0xffe6f770
+0, 216000, 216000, 0, 622080, 0x153faa3e
+0, 219600, 219600, 0, 622080, 0xb67f3233
+0, 223200, 223200, 0, 622080, 0xae724063
+0, 226800, 226800, 0, 622080, 0x15fe44b4
+0, 230400, 230400, 0, 622080, 0xeb4de77a
+0, 234000, 234000, 0, 622080, 0x380f8563
+0, 237600, 237600, 0, 622080, 0x209ed8c7
+0, 241200, 241200, 0, 622080, 0xb964d70f
+0, 244800, 244800, 0, 622080, 0xe2bbac96
+0, 248400, 248400, 0, 622080, 0x4f60f7f4
+0, 252000, 252000, 0, 622080, 0xe945441e
+0, 255600, 255600, 0, 622080, 0xd0afb742
+0, 259200, 259200, 0, 622080, 0x8f8cbd5f
+0, 262800, 262800, 0, 622080, 0xb9a15294
+0, 266400, 266400, 0, 622080, 0xbc3cf717
+0, 270000, 270000, 0, 622080, 0xb70b01a9
+0, 273600, 273600, 0, 622080, 0x0109f125
+0, 277200, 277200, 0, 622080, 0xcb3a371f
+0, 280800, 280800, 0, 622080, 0x230c373f
+0, 284400, 284400, 0, 622080, 0x82dfb1f2
diff --git a/gst-libs/ext/libav/tests/ref/fate/flic-af11-palette-change b/gst-libs/ext/libav/tests/ref/fate/flic-af11-palette-change
index ac609b8..61e6c1d 100644
--- a/gst-libs/ext/libav/tests/ref/fate/flic-af11-palette-change
+++ b/gst-libs/ext/libav/tests/ref/fate/flic-af11-palette-change
@@ -1,116 +1,117 @@
-0, 0, 192000, 0x64da83e8
-0, 2571, 192000, 0xf59ccccc
-0, 5143, 192000, 0xaaa06c5c
-0, 7714, 192000, 0xa98f82c0
-0, 10286, 192000, 0x164fbbdc
-0, 12857, 192000, 0x0b3abc0c
-0, 15429, 192000, 0x47661943
-0, 18000, 192000, 0x30711074
-0, 20571, 192000, 0x67684a84
-0, 23143, 192000, 0x1d9afa70
-0, 25714, 192000, 0x4fd28e78
-0, 28286, 192000, 0x9bc5c8cc
-0, 30857, 192000, 0xcf268b6c
-0, 33429, 192000, 0xdfe65fd4
-0, 36000, 192000, 0x47e75404
-0, 38571, 192000, 0xb3b5b448
-0, 41143, 192000, 0x826c94b4
-0, 43714, 192000, 0x158e95f8
-0, 46286, 192000, 0x576f031f
-0, 48857, 192000, 0xea3399e8
-0, 51429, 192000, 0x76b1e224
-0, 54000, 192000, 0x290073db
-0, 56571, 192000, 0x83741abf
-0, 59143, 192000, 0x50f9c4ec
-0, 61714, 192000, 0x6d8fdac0
-0, 64286, 192000, 0xe26e2600
-0, 66857, 192000, 0xbeb0e11c
-0, 69429, 192000, 0x38282fd4
-0, 72000, 192000, 0x13d0b790
-0, 74571, 192000, 0x0cf8fca9
-0, 77143, 192000, 0x64da83e8
-0, 79714, 192000, 0xf59ccccc
-0, 82286, 192000, 0xaaa06c5c
-0, 84857, 192000, 0xa98f82c0
-0, 87429, 192000, 0x164fbbdc
-0, 90000, 192000, 0x0b3abc0c
-0, 92571, 192000, 0x47661943
-0, 95143, 192000, 0x30711074
-0, 97714, 192000, 0x67684a84
-0, 100286, 192000, 0x1d9afa70
-0, 102857, 192000, 0x4fd28e78
-0, 105429, 192000, 0x9bc5c8cc
-0, 108000, 192000, 0xcf268b6c
-0, 110571, 192000, 0xdfe65fd4
-0, 113143, 192000, 0x47e75404
-0, 115714, 192000, 0xb3b5b448
-0, 118286, 192000, 0x826c94b4
-0, 120857, 192000, 0x158e95f8
-0, 123429, 192000, 0x576f031f
-0, 126000, 192000, 0xea3399e8
-0, 128571, 192000, 0x76b1e224
-0, 131143, 192000, 0x290073db
-0, 133714, 192000, 0x83741abf
-0, 136286, 192000, 0x50f9c4ec
-0, 138857, 192000, 0x6d8fdac0
-0, 141429, 192000, 0xe26e2600
-0, 144000, 192000, 0xbeb0e11c
-0, 146571, 192000, 0x38282fd4
-0, 149143, 192000, 0x13d0b790
-0, 151714, 192000, 0x0cf8fca9
-0, 154286, 192000, 0x64da83e8
-0, 156857, 192000, 0xf59ccccc
-0, 159429, 192000, 0xaaa06c5c
-0, 162000, 192000, 0xa98f82c0
-0, 164571, 192000, 0x164fbbdc
-0, 167143, 192000, 0x0b3abc0c
-0, 169714, 192000, 0x47661943
-0, 172286, 192000, 0x30711074
-0, 174857, 192000, 0x67684a84
-0, 177429, 192000, 0x1d9afa70
-0, 180000, 192000, 0x4fd28e78
-0, 182571, 192000, 0x9bc5c8cc
-0, 185143, 192000, 0xcf268b6c
-0, 187714, 192000, 0xdfe65fd4
-0, 190286, 192000, 0x47e75404
-0, 192857, 192000, 0xb3b5b448
-0, 195429, 192000, 0x826c94b4
-0, 198000, 192000, 0x158e95f8
-0, 200571, 192000, 0x576f031f
-0, 203143, 192000, 0xea3399e8
-0, 205714, 192000, 0x76b1e224
-0, 208286, 192000, 0x290073db
-0, 210857, 192000, 0x83741abf
-0, 213429, 192000, 0x50f9c4ec
-0, 216000, 192000, 0x6d8fdac0
-0, 218571, 192000, 0xe26e2600
-0, 221143, 192000, 0xbeb0e11c
-0, 223714, 192000, 0x38282fd4
-0, 226286, 192000, 0x13d0b790
-0, 228857, 192000, 0x0cf8fca9
-0, 231429, 192000, 0xfcb10883
-0, 234000, 192000, 0xfcb10883
-0, 236571, 192000, 0xd0ba80c4
-0, 239143, 192000, 0xd0ba80c4
-0, 241714, 192000, 0x690520d9
-0, 244286, 192000, 0x690520d9
-0, 246857, 192000, 0x5b621c3f
-0, 249429, 192000, 0x5b621c3f
-0, 252000, 192000, 0x689e231f
-0, 254571, 192000, 0x689e231f
-0, 257143, 192000, 0x20653ff2
-0, 259714, 192000, 0x20653ff2
-0, 262286, 192000, 0xc18b3231
-0, 264857, 192000, 0xc18b3231
-0, 267429, 192000, 0x6d87ec3d
-0, 270000, 192000, 0x6d87ec3d
-0, 272571, 192000, 0x1c5b53d6
-0, 275143, 192000, 0x1c5b53d6
-0, 277714, 192000, 0x152fdf12
-0, 280286, 192000, 0xde187291
-0, 282857, 192000, 0x167617a5
-0, 285429, 192000, 0x5067b8de
-0, 288000, 192000, 0xd02ae54e
-0, 290571, 192000, 0x0d6e9402
-0, 293143, 192000, 0xa8e98616
-0, 295714, 192000, 0x04762d1a
+#tb 0: 1/35
+0, 0, 0, 1, 192000, 0x64da83e8
+0, 1, 1, 1, 192000, 0xf59ccccc
+0, 2, 2, 1, 192000, 0xaaa06c5c
+0, 3, 3, 1, 192000, 0xa98f82c0
+0, 4, 4, 1, 192000, 0x164fbbdc
+0, 5, 5, 1, 192000, 0x0b3abc0c
+0, 6, 6, 1, 192000, 0x47661943
+0, 7, 7, 1, 192000, 0x30711074
+0, 8, 8, 1, 192000, 0x67684a84
+0, 9, 9, 1, 192000, 0x1d9afa70
+0, 10, 10, 1, 192000, 0x4fd28e78
+0, 11, 11, 1, 192000, 0x9bc5c8cc
+0, 12, 12, 1, 192000, 0xcf268b6c
+0, 13, 13, 1, 192000, 0xdfe65fd4
+0, 14, 14, 1, 192000, 0x47e75404
+0, 15, 15, 1, 192000, 0xb3b5b448
+0, 16, 16, 1, 192000, 0x826c94b4
+0, 17, 17, 1, 192000, 0x158e95f8
+0, 18, 18, 1, 192000, 0x576f031f
+0, 19, 19, 1, 192000, 0xea3399e8
+0, 20, 20, 1, 192000, 0x76b1e224
+0, 21, 21, 1, 192000, 0x290073db
+0, 22, 22, 1, 192000, 0x83741abf
+0, 23, 23, 1, 192000, 0x50f9c4ec
+0, 24, 24, 1, 192000, 0x6d8fdac0
+0, 25, 25, 1, 192000, 0xe26e2600
+0, 26, 26, 1, 192000, 0xbeb0e11c
+0, 27, 27, 1, 192000, 0x38282fd4
+0, 28, 28, 1, 192000, 0x13d0b790
+0, 29, 29, 1, 192000, 0x0cf8fca9
+0, 30, 30, 1, 192000, 0x64da83e8
+0, 31, 31, 1, 192000, 0xf59ccccc
+0, 32, 32, 1, 192000, 0xaaa06c5c
+0, 33, 33, 1, 192000, 0xa98f82c0
+0, 34, 34, 1, 192000, 0x164fbbdc
+0, 35, 35, 1, 192000, 0x0b3abc0c
+0, 36, 36, 1, 192000, 0x47661943
+0, 37, 37, 1, 192000, 0x30711074
+0, 38, 38, 1, 192000, 0x67684a84
+0, 39, 39, 1, 192000, 0x1d9afa70
+0, 40, 40, 1, 192000, 0x4fd28e78
+0, 41, 41, 1, 192000, 0x9bc5c8cc
+0, 42, 42, 1, 192000, 0xcf268b6c
+0, 43, 43, 1, 192000, 0xdfe65fd4
+0, 44, 44, 1, 192000, 0x47e75404
+0, 45, 45, 1, 192000, 0xb3b5b448
+0, 46, 46, 1, 192000, 0x826c94b4
+0, 47, 47, 1, 192000, 0x158e95f8
+0, 48, 48, 1, 192000, 0x576f031f
+0, 49, 49, 1, 192000, 0xea3399e8
+0, 50, 50, 1, 192000, 0x76b1e224
+0, 51, 51, 1, 192000, 0x290073db
+0, 52, 52, 1, 192000, 0x83741abf
+0, 53, 53, 1, 192000, 0x50f9c4ec
+0, 54, 54, 1, 192000, 0x6d8fdac0
+0, 55, 55, 1, 192000, 0xe26e2600
+0, 56, 56, 1, 192000, 0xbeb0e11c
+0, 57, 57, 1, 192000, 0x38282fd4
+0, 58, 58, 1, 192000, 0x13d0b790
+0, 59, 59, 1, 192000, 0x0cf8fca9
+0, 60, 60, 1, 192000, 0x64da83e8
+0, 61, 61, 1, 192000, 0xf59ccccc
+0, 62, 62, 1, 192000, 0xaaa06c5c
+0, 63, 63, 1, 192000, 0xa98f82c0
+0, 64, 64, 1, 192000, 0x164fbbdc
+0, 65, 65, 1, 192000, 0x0b3abc0c
+0, 66, 66, 1, 192000, 0x47661943
+0, 67, 67, 1, 192000, 0x30711074
+0, 68, 68, 1, 192000, 0x67684a84
+0, 69, 69, 1, 192000, 0x1d9afa70
+0, 70, 70, 1, 192000, 0x4fd28e78
+0, 71, 71, 1, 192000, 0x9bc5c8cc
+0, 72, 72, 1, 192000, 0xcf268b6c
+0, 73, 73, 1, 192000, 0xdfe65fd4
+0, 74, 74, 1, 192000, 0x47e75404
+0, 75, 75, 1, 192000, 0xb3b5b448
+0, 76, 76, 1, 192000, 0x826c94b4
+0, 77, 77, 1, 192000, 0x158e95f8
+0, 78, 78, 1, 192000, 0x576f031f
+0, 79, 79, 1, 192000, 0xea3399e8
+0, 80, 80, 1, 192000, 0x76b1e224
+0, 81, 81, 1, 192000, 0x290073db
+0, 82, 82, 1, 192000, 0x83741abf
+0, 83, 83, 1, 192000, 0x50f9c4ec
+0, 84, 84, 1, 192000, 0x6d8fdac0
+0, 85, 85, 1, 192000, 0xe26e2600
+0, 86, 86, 1, 192000, 0xbeb0e11c
+0, 87, 87, 1, 192000, 0x38282fd4
+0, 88, 88, 1, 192000, 0x13d0b790
+0, 89, 89, 1, 192000, 0x0cf8fca9
+0, 90, 90, 1, 192000, 0xfcb10883
+0, 91, 91, 1, 192000, 0xfcb10883
+0, 92, 92, 1, 192000, 0xd0ba80c4
+0, 93, 93, 1, 192000, 0xd0ba80c4
+0, 94, 94, 1, 192000, 0x690520d9
+0, 95, 95, 1, 192000, 0x690520d9
+0, 96, 96, 1, 192000, 0x5b621c3f
+0, 97, 97, 1, 192000, 0x5b621c3f
+0, 98, 98, 1, 192000, 0x689e231f
+0, 99, 99, 1, 192000, 0x689e231f
+0, 100, 100, 1, 192000, 0x20653ff2
+0, 101, 101, 1, 192000, 0x20653ff2
+0, 102, 102, 1, 192000, 0xc18b3231
+0, 103, 103, 1, 192000, 0xc18b3231
+0, 104, 104, 1, 192000, 0x6d87ec3d
+0, 105, 105, 1, 192000, 0x6d87ec3d
+0, 106, 106, 1, 192000, 0x1c5b53d6
+0, 107, 107, 1, 192000, 0x1c5b53d6
+0, 108, 108, 1, 192000, 0x152fdf12
+0, 109, 109, 1, 192000, 0xde187291
+0, 110, 110, 1, 192000, 0x167617a5
+0, 111, 111, 1, 192000, 0x5067b8de
+0, 112, 112, 1, 192000, 0xd02ae54e
+0, 113, 113, 1, 192000, 0x0d6e9402
+0, 114, 114, 1, 192000, 0xa8e98616
+0, 115, 115, 1, 192000, 0x04762d1a
diff --git a/gst-libs/ext/libav/tests/ref/fate/flic-af12 b/gst-libs/ext/libav/tests/ref/fate/flic-af12
index 4c3c535..227f26a 100644
--- a/gst-libs/ext/libav/tests/ref/fate/flic-af12
+++ b/gst-libs/ext/libav/tests/ref/fate/flic-af12
@@ -1,27 +1,28 @@
-0, 0, 921600, 0x50a87396
-0, 6480, 921600, 0xa6e65d9e
-0, 12960, 921600, 0x05956f62
-0, 19440, 921600, 0xffd6a5d7
-0, 25920, 921600, 0xaab0a179
-0, 32400, 921600, 0x289db2db
-0, 38880, 921600, 0x3d3840cf
-0, 45360, 921600, 0xec0a4142
-0, 51840, 921600, 0x713a9f65
-0, 58320, 921600, 0x28a8f0cd
-0, 64800, 921600, 0x0fd95ba9
-0, 71280, 921600, 0xa744bdfd
-0, 77760, 921600, 0x3cdea2a5
-0, 84240, 921600, 0xe7d671e4
-0, 90720, 921600, 0x75824cdf
-0, 97200, 921600, 0x82067d95
-0, 103680, 921600, 0xee143a4c
-0, 110160, 921600, 0xa53d3f2b
-0, 116640, 921600, 0xb491c0c5
-0, 123120, 921600, 0x6aaaef07
-0, 129600, 921600, 0xad23cca8
-0, 136080, 921600, 0xdce91bd8
-0, 142560, 921600, 0x1a1499bc
-0, 149040, 921600, 0x4cbe505a
-0, 155520, 921600, 0x24006f65
-0, 162000, 921600, 0x0711906e
-0, 168480, 921600, 0x50a87396
+#tb 0: 9/125
+0, 0, 0, 1, 921600, 0x50a87396
+0, 1, 1, 1, 921600, 0xa6e65d9e
+0, 2, 2, 1, 921600, 0x05956f62
+0, 3, 3, 1, 921600, 0xffd6a5d7
+0, 4, 4, 1, 921600, 0xaab0a179
+0, 5, 5, 1, 921600, 0x289db2db
+0, 6, 6, 1, 921600, 0x3d3840cf
+0, 7, 7, 1, 921600, 0xec0a4142
+0, 8, 8, 1, 921600, 0x713a9f65
+0, 9, 9, 1, 921600, 0x28a8f0cd
+0, 10, 10, 1, 921600, 0x0fd95ba9
+0, 11, 11, 1, 921600, 0xa744bdfd
+0, 12, 12, 1, 921600, 0x3cdea2a5
+0, 13, 13, 1, 921600, 0xe7d671e4
+0, 14, 14, 1, 921600, 0x75824cdf
+0, 15, 15, 1, 921600, 0x82067d95
+0, 16, 16, 1, 921600, 0xee143a4c
+0, 17, 17, 1, 921600, 0xa53d3f2b
+0, 18, 18, 1, 921600, 0xb491c0c5
+0, 19, 19, 1, 921600, 0x6aaaef07
+0, 20, 20, 1, 921600, 0xad23cca8
+0, 21, 21, 1, 921600, 0xdce91bd8
+0, 22, 22, 1, 921600, 0x1a1499bc
+0, 23, 23, 1, 921600, 0x4cbe505a
+0, 24, 24, 1, 921600, 0x24006f65
+0, 25, 25, 1, 921600, 0x0711906e
+0, 26, 26, 1, 921600, 0x50a87396
diff --git a/gst-libs/ext/libav/tests/ref/fate/flic-magiccarpet b/gst-libs/ext/libav/tests/ref/fate/flic-magiccarpet
index a7d9ab9..f0faf1d 100644
--- a/gst-libs/ext/libav/tests/ref/fate/flic-magiccarpet
+++ b/gst-libs/ext/libav/tests/ref/fate/flic-magiccarpet
@@ -1,42 +1,43 @@
-0, 0, 192000, 0x00000000
-0, 6429, 192000, 0x9c057d9c
-0, 12857, 192000, 0xab1aacaf
-0, 19286, 192000, 0x49a1dccd
-0, 25714, 192000, 0xebb7e245
-0, 32143, 192000, 0x6287759e
-0, 38571, 192000, 0xbf007410
-0, 45000, 192000, 0x6c72b247
-0, 51429, 192000, 0x4c26a8c3
-0, 57857, 192000, 0x99f06050
-0, 64286, 192000, 0x663f2d23
-0, 70714, 192000, 0x813c3a1f
-0, 77143, 192000, 0x6d6cfbe7
-0, 83571, 192000, 0x7b04163a
-0, 90000, 192000, 0x6792e679
-0, 96429, 192000, 0x939ac626
-0, 102857, 192000, 0xc7a139c0
-0, 109286, 192000, 0xcac7ef0c
-0, 115714, 192000, 0xf4ec59e0
-0, 122143, 192000, 0x56060f59
-0, 128571, 192000, 0xf45ecb3b
-0, 135000, 192000, 0xe7e634ff
-0, 141429, 192000, 0x7ac04aa4
-0, 147857, 192000, 0x4eaba5a1
-0, 154286, 192000, 0x89b84e25
-0, 160714, 192000, 0xc368ec1e
-0, 167143, 192000, 0xeeafb59e
-0, 173571, 192000, 0x0b630619
-0, 180000, 192000, 0x59cb8954
-0, 186429, 192000, 0x16b2875f
-0, 192857, 192000, 0x524e32bd
-0, 199286, 192000, 0x96000ba2
-0, 205714, 192000, 0x18ec28af
-0, 212143, 192000, 0x2609c56c
-0, 218571, 192000, 0xff25bb5a
-0, 225000, 192000, 0xb19a8819
-0, 231429, 192000, 0xa5ff8727
-0, 237857, 192000, 0xe83f6289
-0, 244286, 192000, 0xc6cb4903
-0, 250714, 192000, 0xa4d93eb5
-0, 257143, 192000, 0xec84ef6c
-0, 263571, 192000, 0x00000000
+#tb 0: 1/14
+0, 0, 0, 1, 192000, 0x00000000
+0, 1, 1, 1, 192000, 0x9c057d9c
+0, 2, 2, 1, 192000, 0xab1aacaf
+0, 3, 3, 1, 192000, 0x49a1dccd
+0, 4, 4, 1, 192000, 0xebb7e245
+0, 5, 5, 1, 192000, 0x6287759e
+0, 6, 6, 1, 192000, 0xbf007410
+0, 7, 7, 1, 192000, 0x6c72b247
+0, 8, 8, 1, 192000, 0x4c26a8c3
+0, 9, 9, 1, 192000, 0x99f06050
+0, 10, 10, 1, 192000, 0x663f2d23
+0, 11, 11, 1, 192000, 0x813c3a1f
+0, 12, 12, 1, 192000, 0x6d6cfbe7
+0, 13, 13, 1, 192000, 0x7b04163a
+0, 14, 14, 1, 192000, 0x6792e679
+0, 15, 15, 1, 192000, 0x939ac626
+0, 16, 16, 1, 192000, 0xc7a139c0
+0, 17, 17, 1, 192000, 0xcac7ef0c
+0, 18, 18, 1, 192000, 0xf4ec59e0
+0, 19, 19, 1, 192000, 0x56060f59
+0, 20, 20, 1, 192000, 0xf45ecb3b
+0, 21, 21, 1, 192000, 0xe7e634ff
+0, 22, 22, 1, 192000, 0x7ac04aa4
+0, 23, 23, 1, 192000, 0x4eaba5a1
+0, 24, 24, 1, 192000, 0x89b84e25
+0, 25, 25, 1, 192000, 0xc368ec1e
+0, 26, 26, 1, 192000, 0xeeafb59e
+0, 27, 27, 1, 192000, 0x0b630619
+0, 28, 28, 1, 192000, 0x59cb8954
+0, 29, 29, 1, 192000, 0x16b2875f
+0, 30, 30, 1, 192000, 0x524e32bd
+0, 31, 31, 1, 192000, 0x96000ba2
+0, 32, 32, 1, 192000, 0x18ec28af
+0, 33, 33, 1, 192000, 0x2609c56c
+0, 34, 34, 1, 192000, 0xff25bb5a
+0, 35, 35, 1, 192000, 0xb19a8819
+0, 36, 36, 1, 192000, 0xa5ff8727
+0, 37, 37, 1, 192000, 0xe83f6289
+0, 38, 38, 1, 192000, 0xc6cb4903
+0, 39, 39, 1, 192000, 0xa4d93eb5
+0, 40, 40, 1, 192000, 0xec84ef6c
+0, 41, 41, 1, 192000, 0x00000000
diff --git a/gst-libs/ext/libav/tests/ref/fate/fraps-v0 b/gst-libs/ext/libav/tests/ref/fate/fraps-v0
index bcf6e2e..3cba831 100644
--- a/gst-libs/ext/libav/tests/ref/fate/fraps-v0
+++ b/gst-libs/ext/libav/tests/ref/fate/fraps-v0
@@ -1,20 +1,21 @@
-0, 0, 101088, 0x7bf448f8
-0, 3600, 101088, 0x1ba749ec
-0, 7200, 101088, 0x94eb4dc4
-0, 10800, 101088, 0xd80b4f54
-0, 14400, 101088, 0x6fd44fff
-0, 18000, 101088, 0xf30e4f12
-0, 21600, 101088, 0x67a04fef
-0, 25200, 101088, 0xd92b4f8e
-0, 28800, 101088, 0x92cd4cde
-0, 32400, 101088, 0x93a34973
-0, 36000, 101088, 0x79a646cb
-0, 39600, 101088, 0x5d9c4227
-0, 43200, 101088, 0x239941ff
-0, 46800, 101088, 0x147e11de
-0, 50400, 101088, 0x3943cbd5
-0, 54000, 101088, 0x2ce1c01f
-0, 57600, 101088, 0xe0b7ec06
-0, 61200, 101088, 0xfe5b9baa
-0, 64800, 101088, 0x9acb4d37
-0, 68400, 101088, 0xbdbd9af5
+#tb 0: 1/25
+0, 0, 0, 1, 101088, 0x7bf448f8
+0, 1, 1, 1, 101088, 0x1ba749ec
+0, 2, 2, 1, 101088, 0x94eb4dc4
+0, 3, 3, 1, 101088, 0xd80b4f54
+0, 4, 4, 1, 101088, 0x6fd44fff
+0, 5, 5, 1, 101088, 0xf30e4f12
+0, 6, 6, 1, 101088, 0x67a04fef
+0, 7, 7, 1, 101088, 0xd92b4f8e
+0, 8, 8, 1, 101088, 0x92cd4cde
+0, 9, 9, 1, 101088, 0x93a34973
+0, 10, 10, 1, 101088, 0x79a646cb
+0, 11, 11, 1, 101088, 0x5d9c4227
+0, 12, 12, 1, 101088, 0x239941ff
+0, 13, 13, 1, 101088, 0x147e11de
+0, 14, 14, 1, 101088, 0x3943cbd5
+0, 15, 15, 1, 101088, 0x2ce1c01f
+0, 16, 16, 1, 101088, 0xe0b7ec06
+0, 17, 17, 1, 101088, 0xfe5b9baa
+0, 18, 18, 1, 101088, 0x9acb4d37
+0, 19, 19, 1, 101088, 0xbdbd9af5
diff --git a/gst-libs/ext/libav/tests/ref/fate/fraps-v1 b/gst-libs/ext/libav/tests/ref/fate/fraps-v1
index 7d09310..29c7e37 100644
--- a/gst-libs/ext/libav/tests/ref/fate/fraps-v1
+++ b/gst-libs/ext/libav/tests/ref/fate/fraps-v1
@@ -1 +1,2 @@
-0, 0, 230400, 0x6bc891ff
+#tb 0: 1/25
+0, 0, 0, 1, 230400, 0x23c29d17
diff --git a/gst-libs/ext/libav/tests/ref/fate/fraps-v2 b/gst-libs/ext/libav/tests/ref/fate/fraps-v2
index 63a01f2..1ebfb7c 100644
--- a/gst-libs/ext/libav/tests/ref/fate/fraps-v2
+++ b/gst-libs/ext/libav/tests/ref/fate/fraps-v2
@@ -1,10 +1,11 @@
-0, 0, 1179648, 0x99f80436
-0, 3000, 1179648, 0x99f80436
-0, 6000, 1179648, 0x99f80436
-0, 9000, 1179648, 0x99f80436
-0, 12000, 1179648, 0x99f80436
-0, 15000, 1179648, 0xe8ae7a30
-0, 18000, 1179648, 0xe8ae7a30
-0, 21000, 1179648, 0xe8ae7a30
-0, 24000, 1179648, 0xe8ae7a30
-0, 27000, 1179648, 0xe8ae7a30
+#tb 0: 1/30
+0, 0, 0, 1, 1179648, 0x99f80436
+0, 1, 1, 1, 1179648, 0x99f80436
+0, 2, 2, 1, 1179648, 0x99f80436
+0, 3, 3, 1, 1179648, 0x99f80436
+0, 4, 4, 1, 1179648, 0x99f80436
+0, 5, 5, 1, 1179648, 0xe8ae7a30
+0, 6, 6, 1, 1179648, 0xe8ae7a30
+0, 7, 7, 1, 1179648, 0xe8ae7a30
+0, 8, 8, 1, 1179648, 0xe8ae7a30
+0, 9, 9, 1, 1179648, 0xe8ae7a30
diff --git a/gst-libs/ext/libav/tests/ref/fate/fraps-v3 b/gst-libs/ext/libav/tests/ref/fate/fraps-v3
index ba66206..ac8b701 100644
--- a/gst-libs/ext/libav/tests/ref/fate/fraps-v3
+++ b/gst-libs/ext/libav/tests/ref/fate/fraps-v3
@@ -1,9 +1,10 @@
-0, 0, 589824, 0x0b181bbf
-0, 3000, 589824, 0xcd740f79
-0, 6000, 589824, 0x16f8f90e
-0, 9000, 589824, 0x1aaaceba
-0, 12000, 589824, 0x1aaaceba
-0, 15000, 589824, 0x902e8fe4
-0, 18000, 589824, 0x019a4443
-0, 21000, 589824, 0x019a4443
-0, 24000, 589824, 0x04eff6c6
+#tb 0: 1/30
+0, 0, 0, 1, 589824, 0x0b181bbf
+0, 1, 1, 1, 589824, 0xcd740f79
+0, 2, 2, 1, 589824, 0x16f8f90e
+0, 3, 3, 1, 589824, 0x1aaaceba
+0, 4, 4, 1, 589824, 0x1aaaceba
+0, 5, 5, 1, 589824, 0x902e8fe4
+0, 6, 6, 1, 589824, 0x019a4443
+0, 7, 7, 1, 589824, 0x019a4443
+0, 8, 8, 1, 589824, 0x04eff6c6
diff --git a/gst-libs/ext/libav/tests/ref/fate/fraps-v4 b/gst-libs/ext/libav/tests/ref/fate/fraps-v4
index 4c9377e..007916d 100644
--- a/gst-libs/ext/libav/tests/ref/fate/fraps-v4
+++ b/gst-libs/ext/libav/tests/ref/fate/fraps-v4
@@ -1,7 +1,8 @@
-0, 0, 491520, 0x68ff12c0
-0, 3000, 491520, 0x22d36f0d
-0, 6000, 491520, 0xce6f877d
-0, 9000, 491520, 0x85d6744c
-0, 12000, 491520, 0x1aa85794
-0, 15000, 491520, 0x528d1274
-0, 18000, 491520, 0x357ec61c
+#tb 0: 1/30
+0, 0, 0, 1, 491520, 0x68ff12c0
+0, 1, 1, 1, 491520, 0x22d36f0d
+0, 2, 2, 1, 491520, 0xce6f877d
+0, 3, 3, 1, 491520, 0x85d6744c
+0, 4, 4, 1, 491520, 0x1aa85794
+0, 5, 5, 1, 491520, 0x528d1274
+0, 6, 6, 1, 491520, 0x357ec61c
diff --git a/gst-libs/ext/libav/tests/ref/fate/fraps-v5 b/gst-libs/ext/libav/tests/ref/fate/fraps-v5
index 3fe1c49..599683a 100644
--- a/gst-libs/ext/libav/tests/ref/fate/fraps-v5
+++ b/gst-libs/ext/libav/tests/ref/fate/fraps-v5
@@ -1,58 +1,59 @@
-0, 0, 145152, 0x8458d4cb
-0, 3000, 145152, 0xa694d7c7
-0, 6000, 145152, 0x2bd4bfc9
-0, 9000, 145152, 0xe53b1616
-0, 12000, 145152, 0x6a0a806a
-0, 15000, 145152, 0x45f7b8e6
-0, 18000, 145152, 0x4e14150e
-0, 21000, 145152, 0xe1cd9b6f
-0, 24000, 145152, 0x5b5802d7
-0, 27000, 145152, 0xb03da5e7
-0, 30000, 145152, 0x3436b06e
-0, 33000, 145152, 0x4535e638
-0, 36000, 145152, 0x72934af1
-0, 39000, 145152, 0xb672d459
-0, 42000, 145152, 0xab57491b
-0, 45000, 145152, 0xdbac3480
-0, 48000, 145152, 0x54215962
-0, 51000, 145152, 0x451f456e
-0, 54000, 145152, 0xa17655d1
-0, 57000, 145152, 0xce95422c
-0, 60000, 145152, 0xe0ee8e77
-0, 63000, 145152, 0xdaabe277
-0, 66000, 145152, 0xc21bb665
-0, 69000, 145152, 0x1e74270e
-0, 72000, 145152, 0xae7bac5f
-0, 75000, 145152, 0xf62442ed
-0, 78000, 145152, 0x5c8d8984
-0, 81000, 145152, 0x97a69fe7
-0, 84000, 145152, 0x1f244d19
-0, 87000, 145152, 0x2758bc25
-0, 90000, 145152, 0xf43ddb89
-0, 93000, 145152, 0x086a524e
-0, 96000, 145152, 0x8b464d4d
-0, 99000, 145152, 0xb77b63d2
-0, 102000, 145152, 0xfd842fa8
-0, 105000, 145152, 0xa98b6dbe
-0, 108000, 145152, 0xdedbab2c
-0, 111000, 145152, 0x24e19172
-0, 114000, 145152, 0x1ef456f6
-0, 117000, 145152, 0xaceabdf0
-0, 120000, 145152, 0xb54de3d9
-0, 123000, 145152, 0x3af0df9b
-0, 126000, 145152, 0xf89fbd9a
-0, 129000, 145152, 0xc6a9673c
-0, 132000, 145152, 0x6d5a929e
-0, 135000, 145152, 0x879e7d9b
-0, 138000, 145152, 0x233c14eb
-0, 141000, 145152, 0x8246f081
-0, 144000, 145152, 0x3366c4bf
-0, 147000, 145152, 0x6b0203da
-0, 150000, 145152, 0x48a00163
-0, 153000, 145152, 0xe956ac2c
-0, 156000, 145152, 0xa2511283
-0, 159000, 145152, 0x7e03222d
-0, 162000, 145152, 0xc31a7a40
-0, 165000, 145152, 0x80448031
-0, 168000, 145152, 0xe3b1fbf7
-0, 171000, 145152, 0xa00395a4
+#tb 0: 1/30
+0, 0, 0, 1, 145152, 0x8458d4cb
+0, 1, 1, 1, 145152, 0xa694d7c7
+0, 2, 2, 1, 145152, 0x2bd4bfc9
+0, 3, 3, 1, 145152, 0xe53b1616
+0, 4, 4, 1, 145152, 0x6a0a806a
+0, 5, 5, 1, 145152, 0x45f7b8e6
+0, 6, 6, 1, 145152, 0x4e14150e
+0, 7, 7, 1, 145152, 0xe1cd9b6f
+0, 8, 8, 1, 145152, 0x5b5802d7
+0, 9, 9, 1, 145152, 0xb03da5e7
+0, 10, 10, 1, 145152, 0x3436b06e
+0, 11, 11, 1, 145152, 0x4535e638
+0, 12, 12, 1, 145152, 0x72934af1
+0, 13, 13, 1, 145152, 0xb672d459
+0, 14, 14, 1, 145152, 0xab57491b
+0, 15, 15, 1, 145152, 0xdbac3480
+0, 16, 16, 1, 145152, 0x54215962
+0, 17, 17, 1, 145152, 0x451f456e
+0, 18, 18, 1, 145152, 0xa17655d1
+0, 19, 19, 1, 145152, 0xce95422c
+0, 20, 20, 1, 145152, 0xe0ee8e77
+0, 21, 21, 1, 145152, 0xdaabe277
+0, 22, 22, 1, 145152, 0xc21bb665
+0, 23, 23, 1, 145152, 0x1e74270e
+0, 24, 24, 1, 145152, 0xae7bac5f
+0, 25, 25, 1, 145152, 0xf62442ed
+0, 26, 26, 1, 145152, 0x5c8d8984
+0, 27, 27, 1, 145152, 0x97a69fe7
+0, 28, 28, 1, 145152, 0x1f244d19
+0, 29, 29, 1, 145152, 0x2758bc25
+0, 30, 30, 1, 145152, 0xf43ddb89
+0, 31, 31, 1, 145152, 0x086a524e
+0, 32, 32, 1, 145152, 0x8b464d4d
+0, 33, 33, 1, 145152, 0xb77b63d2
+0, 34, 34, 1, 145152, 0xfd842fa8
+0, 35, 35, 1, 145152, 0xa98b6dbe
+0, 36, 36, 1, 145152, 0xdedbab2c
+0, 37, 37, 1, 145152, 0x24e19172
+0, 38, 38, 1, 145152, 0x1ef456f6
+0, 39, 39, 1, 145152, 0xaceabdf0
+0, 40, 40, 1, 145152, 0xb54de3d9
+0, 41, 41, 1, 145152, 0x3af0df9b
+0, 42, 42, 1, 145152, 0xf89fbd9a
+0, 43, 43, 1, 145152, 0xc6a9673c
+0, 44, 44, 1, 145152, 0x6d5a929e
+0, 45, 45, 1, 145152, 0x879e7d9b
+0, 46, 46, 1, 145152, 0x233c14eb
+0, 47, 47, 1, 145152, 0x8246f081
+0, 48, 48, 1, 145152, 0x3366c4bf
+0, 49, 49, 1, 145152, 0x6b0203da
+0, 50, 50, 1, 145152, 0x48a00163
+0, 51, 51, 1, 145152, 0xe956ac2c
+0, 52, 52, 1, 145152, 0xa2511283
+0, 53, 53, 1, 145152, 0x7e03222d
+0, 54, 54, 1, 145152, 0xc31a7a40
+0, 55, 55, 1, 145152, 0x80448031
+0, 56, 56, 1, 145152, 0xe3b1fbf7
+0, 57, 57, 1, 145152, 0xa00395a4
diff --git a/gst-libs/ext/libav/tests/ref/fate/frwu b/gst-libs/ext/libav/tests/ref/fate/frwu
index 6877b8b..32eaa6f 100644
--- a/gst-libs/ext/libav/tests/ref/fate/frwu
+++ b/gst-libs/ext/libav/tests/ref/fate/frwu
@@ -1,10 +1,11 @@
-0, 0, 153600, 0x050422c0
-0, 6000, 153600, 0x0cf35359
-0, 12000, 153600, 0x2ae95db0
-0, 18000, 153600, 0x8c855b14
-0, 24000, 153600, 0xc7a890b4
-0, 30000, 153600, 0x755bed3b
-0, 36000, 153600, 0x454a4e27
-0, 42000, 153600, 0xdc3eaecb
-0, 48000, 153600, 0x190f9a82
-0, 54000, 153600, 0x4f67511f
+#tb 0: 1/15
+0, 0, 0, 1, 153600, 0x050422c0
+0, 1, 1, 1, 153600, 0x0cf35359
+0, 2, 2, 1, 153600, 0x2ae95db0
+0, 3, 3, 1, 153600, 0x8c855b14
+0, 4, 4, 1, 153600, 0xc7a890b4
+0, 5, 5, 1, 153600, 0x755bed3b
+0, 6, 6, 1, 153600, 0x454a4e27
+0, 7, 7, 1, 153600, 0xdc3eaecb
+0, 8, 8, 1, 153600, 0x190f9a82
+0, 9, 9, 1, 153600, 0x4f67511f
diff --git a/gst-libs/ext/libav/tests/ref/fate/g722-encode b/gst-libs/ext/libav/tests/ref/fate/g722-encode
new file mode 100644
index 0000000..c7198cf
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/g722-encode
@@ -0,0 +1 @@
+MD5=7106189574186051c0497b287e2e5f19
diff --git a/gst-libs/ext/libav/tests/ref/fate/g722dec-1 b/gst-libs/ext/libav/tests/ref/fate/g722dec-1
index cdc5489..e94c3e6 100644
--- a/gst-libs/ext/libav/tests/ref/fate/g722dec-1
+++ b/gst-libs/ext/libav/tests/ref/fate/g722dec-1
@@ -1,167 +1,168 @@
-0, 0, 4096, 0x4f9228b3
-0, 11520, 4096, 0xfab58157
-0, 23040, 4096, 0x0b641c78
-0, 34560, 4096, 0x601c6803
-0, 46080, 4096, 0xb3e2f166
-0, 57600, 4096, 0x5681f206
-0, 69120, 4096, 0x1e69e71f
-0, 80640, 4096, 0x05628be3
-0, 92160, 4096, 0x109b1aef
-0, 103680, 4096, 0xd5435a9e
-0, 115200, 4096, 0xb38b5d28
-0, 126720, 4096, 0x64514c93
-0, 138240, 4096, 0x453350e7
-0, 149760, 4096, 0x6deccce6
-0, 161280, 4096, 0xd427ede1
-0, 172800, 4096, 0xdecb8c42
-0, 184320, 4096, 0x3841e4d2
-0, 195840, 4096, 0x858ac1b1
-0, 207360, 4096, 0x8e9dbfa0
-0, 218880, 4096, 0xcbc0766f
-0, 230400, 4096, 0x78d52555
-0, 241920, 4096, 0x600ac7d5
-0, 253440, 4096, 0xafadb7ee
-0, 264960, 4096, 0x8009d5a1
-0, 276480, 4096, 0xb07d475e
-0, 288000, 4096, 0xfcfecceb
-0, 299520, 4096, 0x38b5d85f
-0, 311040, 4096, 0xbd48072e
-0, 322560, 4096, 0xd04724d8
-0, 334080, 4096, 0x08425144
-0, 345600, 4096, 0x7b14483e
-0, 357120, 4096, 0x8858ef4c
-0, 368640, 4096, 0x1e3024c2
-0, 380160, 4096, 0xcd6bfe4f
-0, 391680, 4096, 0x8cde8d18
-0, 403200, 4096, 0xbbd856b8
-0, 414720, 4096, 0x988c9b7a
-0, 426240, 4096, 0x2a858e03
-0, 437760, 4096, 0x6dee1e4a
-0, 449280, 4096, 0x8cc38b41
-0, 460800, 4096, 0x48bd5cec
-0, 472320, 4096, 0xeb7f606b
-0, 483840, 4096, 0x75f5d28c
-0, 495360, 4096, 0x5bfeec4b
-0, 506880, 4096, 0xfc35c22a
-0, 518400, 4096, 0x3a95efba
-0, 529920, 4096, 0xefdbce9c
-0, 541440, 4096, 0x00594ada
-0, 552960, 4096, 0x20ffebfa
-0, 564480, 4096, 0x1b31370a
-0, 576000, 4096, 0x50766a56
-0, 587520, 4096, 0x0058315a
-0, 599040, 4096, 0x98090cbf
-0, 610560, 4096, 0x66ed2d40
-0, 622080, 4096, 0xdfd7c0a7
-0, 633600, 4096, 0x2adc57e1
-0, 645120, 4096, 0x838bbc82
-0, 656640, 4096, 0x2c55de1a
-0, 668160, 4096, 0xeae027f4
-0, 679680, 4096, 0x09fe00f6
-0, 691200, 4096, 0xa25d9970
-0, 702720, 4096, 0xedb11a20
-0, 714240, 4096, 0x9ce2e63e
-0, 725760, 4096, 0xeb699974
-0, 737280, 4096, 0xcc04a296
-0, 748800, 4096, 0xe90e9a12
-0, 760320, 4096, 0xae85c0f7
-0, 771840, 4096, 0x7ee877db
-0, 783360, 4096, 0x9ecf14ee
-0, 794880, 4096, 0xa821cecd
-0, 806400, 4096, 0x2714bb11
-0, 817920, 4096, 0x28f1c1e0
-0, 829440, 4096, 0xf81c4f60
-0, 840960, 4096, 0x1ae0e5a1
-0, 852480, 4096, 0xbdae9d9a
-0, 864000, 4096, 0x5202e560
-0, 875520, 4096, 0x82408396
-0, 887040, 4096, 0xc850ce0c
-0, 898560, 4096, 0x1d732d88
-0, 910080, 4096, 0xc5c01e33
-0, 921600, 4096, 0x84942d6c
-0, 933120, 4096, 0x7c27cd3a
-0, 944640, 4096, 0x22adc503
-0, 956160, 4096, 0xfbc3af31
-0, 967680, 4096, 0xe9652b18
-0, 979200, 4096, 0xae75987e
-0, 990720, 4096, 0x0f7ea428
-0, 1002240, 4096, 0x92b89582
-0, 1013760, 4096, 0xf393d910
-0, 1025280, 4096, 0x6349b600
-0, 1036800, 4096, 0x16918dbd
-0, 1048320, 4096, 0x14ee15ad
-0, 1059840, 4096, 0x26b510d3
-0, 1071360, 4096, 0x97007bf8
-0, 1082880, 4096, 0x3718c509
-0, 1094400, 4096, 0x24a54ccd
-0, 1105920, 4096, 0xc960df4e
-0, 1117440, 4096, 0xc7cb6e6f
-0, 1128960, 4096, 0x4c563ae5
-0, 1140480, 4096, 0x0dd51432
-0, 1152000, 4096, 0xdb4243c8
-0, 1163520, 4096, 0x9bb6417f
-0, 1175040, 4096, 0xec6a40a1
-0, 1186560, 4096, 0x82d6c3b4
-0, 1198080, 4096, 0xd181e2ec
-0, 1209600, 4096, 0xba5d7b55
-0, 1221120, 4096, 0x78fcb938
-0, 1232640, 4096, 0x6691671c
-0, 1244160, 4096, 0x44fadee7
-0, 1255680, 4096, 0xa42720d5
-0, 1267200, 4096, 0xc1165a91
-0, 1278720, 4096, 0x86aa3e3f
-0, 1290240, 4096, 0xab5ae57d
-0, 1301760, 4096, 0x291a91f3
-0, 1313280, 4096, 0xfdf0dcfc
-0, 1324800, 4096, 0x1ef91f67
-0, 1336320, 4096, 0xc899efee
-0, 1347840, 4096, 0x5ade15ac
-0, 1359360, 4096, 0x04516beb
-0, 1370880, 4096, 0xbf5ebbb9
-0, 1382400, 4096, 0x4a235122
-0, 1393920, 4096, 0xd7a3f4a6
-0, 1405440, 4096, 0x5f900f20
-0, 1416960, 4096, 0xa90b4365
-0, 1428480, 4096, 0x63149dc4
-0, 1440000, 4096, 0xf12c1ee8
-0, 1451520, 4096, 0x6d0fec8c
-0, 1463040, 4096, 0x65e07850
-0, 1474560, 4096, 0x16d951cc
-0, 1486080, 4096, 0xd296d0c4
-0, 1497600, 4096, 0x619b2a53
-0, 1509120, 4096, 0x316972d5
-0, 1520640, 4096, 0xcfd64e21
-0, 1532160, 4096, 0xcbcb10c6
-0, 1543680, 4096, 0x20aeff7c
-0, 1555200, 4096, 0xd205dabd
-0, 1566720, 4096, 0xac9d3001
-0, 1578240, 4096, 0x6d53dfdd
-0, 1589760, 4096, 0xbb9fe15c
-0, 1601280, 4096, 0x1852b88b
-0, 1612800, 4096, 0xb0acec01
-0, 1624320, 4096, 0xb52a9342
-0, 1635840, 4096, 0x7529faee
-0, 1647360, 4096, 0x150ff449
-0, 1658880, 4096, 0xa81d31d9
-0, 1670400, 4096, 0xbcb8084a
-0, 1681920, 4096, 0x07229514
-0, 1693440, 4096, 0xa85cfd88
-0, 1704960, 4096, 0x0aef9c27
-0, 1716480, 4096, 0x8ec47b39
-0, 1728000, 4096, 0x910b0560
-0, 1739520, 4096, 0x99a8578e
-0, 1751040, 4096, 0xb3df1d84
-0, 1762560, 4096, 0x48e52559
-0, 1774080, 4096, 0xb25c4800
-0, 1785600, 4096, 0x913bc8ce
-0, 1797120, 4096, 0xb736cc8c
-0, 1808640, 4096, 0x13c66646
-0, 1820160, 4096, 0x70a71221
-0, 1831680, 4096, 0x3a50a08e
-0, 1843200, 4096, 0xc0a037b0
-0, 1854720, 4096, 0x9a789475
-0, 1866240, 4096, 0xc890ca16
-0, 1877760, 4096, 0xa0d34bed
-0, 1889280, 4096, 0x1689fa60
-0, 1900800, 4096, 0x5bac4c83
-0, 1912320, 1368, 0x904be5e5
+#tb 0: 1/16000
+0, 0, 0, 2048, 4096, 0x4f9228b3
+0, 2048, 2048, 2048, 4096, 0xfab58157
+0, 4096, 4096, 2048, 4096, 0x0b641c78
+0, 6144, 6144, 2048, 4096, 0x601c6803
+0, 8192, 8192, 2048, 4096, 0xb3e2f166
+0, 10240, 10240, 2048, 4096, 0x5681f206
+0, 12288, 12288, 2048, 4096, 0x1e69e71f
+0, 14336, 14336, 2048, 4096, 0x05628be3
+0, 16384, 16384, 2048, 4096, 0x109b1aef
+0, 18432, 18432, 2048, 4096, 0xd5435a9e
+0, 20480, 20480, 2048, 4096, 0xb38b5d28
+0, 22528, 22528, 2048, 4096, 0x64514c93
+0, 24576, 24576, 2048, 4096, 0x453350e7
+0, 26624, 26624, 2048, 4096, 0x6deccce6
+0, 28672, 28672, 2048, 4096, 0xd427ede1
+0, 30720, 30720, 2048, 4096, 0xdecb8c42
+0, 32768, 32768, 2048, 4096, 0x3841e4d2
+0, 34816, 34816, 2048, 4096, 0x858ac1b1
+0, 36864, 36864, 2048, 4096, 0x8e9dbfa0
+0, 38912, 38912, 2048, 4096, 0xcbc0766f
+0, 40960, 40960, 2048, 4096, 0x78d52555
+0, 43008, 43008, 2048, 4096, 0x600ac7d5
+0, 45056, 45056, 2048, 4096, 0xafadb7ee
+0, 47104, 47104, 2048, 4096, 0x8009d5a1
+0, 49152, 49152, 2048, 4096, 0xb07d475e
+0, 51200, 51200, 2048, 4096, 0xfcfecceb
+0, 53248, 53248, 2048, 4096, 0x38b5d85f
+0, 55296, 55296, 2048, 4096, 0xbd48072e
+0, 57344, 57344, 2048, 4096, 0xd04724d8
+0, 59392, 59392, 2048, 4096, 0x08425144
+0, 61440, 61440, 2048, 4096, 0x7b14483e
+0, 63488, 63488, 2048, 4096, 0x8858ef4c
+0, 65536, 65536, 2048, 4096, 0x1e3024c2
+0, 67584, 67584, 2048, 4096, 0xcd6bfe4f
+0, 69632, 69632, 2048, 4096, 0x8cde8d18
+0, 71680, 71680, 2048, 4096, 0xbbd856b8
+0, 73728, 73728, 2048, 4096, 0x988c9b7a
+0, 75776, 75776, 2048, 4096, 0x2a858e03
+0, 77824, 77824, 2048, 4096, 0x6dee1e4a
+0, 79872, 79872, 2048, 4096, 0x8cc38b41
+0, 81920, 81920, 2048, 4096, 0x48bd5cec
+0, 83968, 83968, 2048, 4096, 0xeb7f606b
+0, 86016, 86016, 2048, 4096, 0x75f5d28c
+0, 88064, 88064, 2048, 4096, 0x5bfeec4b
+0, 90112, 90112, 2048, 4096, 0xfc35c22a
+0, 92160, 92160, 2048, 4096, 0x3a95efba
+0, 94208, 94208, 2048, 4096, 0xefdbce9c
+0, 96256, 96256, 2048, 4096, 0x00594ada
+0, 98304, 98304, 2048, 4096, 0x20ffebfa
+0, 100352, 100352, 2048, 4096, 0x1b31370a
+0, 102400, 102400, 2048, 4096, 0x50766a56
+0, 104448, 104448, 2048, 4096, 0x0058315a
+0, 106496, 106496, 2048, 4096, 0x98090cbf
+0, 108544, 108544, 2048, 4096, 0x66ed2d40
+0, 110592, 110592, 2048, 4096, 0xdfd7c0a7
+0, 112640, 112640, 2048, 4096, 0x2adc57e1
+0, 114688, 114688, 2048, 4096, 0x838bbc82
+0, 116736, 116736, 2048, 4096, 0x2c55de1a
+0, 118784, 118784, 2048, 4096, 0xeae027f4
+0, 120832, 120832, 2048, 4096, 0x09fe00f6
+0, 122880, 122880, 2048, 4096, 0xa25d9970
+0, 124928, 124928, 2048, 4096, 0xedb11a20
+0, 126976, 126976, 2048, 4096, 0x9ce2e63e
+0, 129024, 129024, 2048, 4096, 0xeb699974
+0, 131072, 131072, 2048, 4096, 0xcc04a296
+0, 133120, 133120, 2048, 4096, 0xe90e9a12
+0, 135168, 135168, 2048, 4096, 0xae85c0f7
+0, 137216, 137216, 2048, 4096, 0x7ee877db
+0, 139264, 139264, 2048, 4096, 0x9ecf14ee
+0, 141312, 141312, 2048, 4096, 0xa821cecd
+0, 143360, 143360, 2048, 4096, 0x2714bb11
+0, 145408, 145408, 2048, 4096, 0x28f1c1e0
+0, 147456, 147456, 2048, 4096, 0xf81c4f60
+0, 149504, 149504, 2048, 4096, 0x1ae0e5a1
+0, 151552, 151552, 2048, 4096, 0xbdae9d9a
+0, 153600, 153600, 2048, 4096, 0x5202e560
+0, 155648, 155648, 2048, 4096, 0x82408396
+0, 157696, 157696, 2048, 4096, 0xc850ce0c
+0, 159744, 159744, 2048, 4096, 0x1d732d88
+0, 161792, 161792, 2048, 4096, 0xc5c01e33
+0, 163840, 163840, 2048, 4096, 0x84942d6c
+0, 165888, 165888, 2048, 4096, 0x7c27cd3a
+0, 167936, 167936, 2048, 4096, 0x22adc503
+0, 169984, 169984, 2048, 4096, 0xfbc3af31
+0, 172032, 172032, 2048, 4096, 0xe9652b18
+0, 174080, 174080, 2048, 4096, 0xae75987e
+0, 176128, 176128, 2048, 4096, 0x0f7ea428
+0, 178176, 178176, 2048, 4096, 0x92b89582
+0, 180224, 180224, 2048, 4096, 0xf393d910
+0, 182272, 182272, 2048, 4096, 0x6349b600
+0, 184320, 184320, 2048, 4096, 0x16918dbd
+0, 186368, 186368, 2048, 4096, 0x14ee15ad
+0, 188416, 188416, 2048, 4096, 0x26b510d3
+0, 190464, 190464, 2048, 4096, 0x97007bf8
+0, 192512, 192512, 2048, 4096, 0x3718c509
+0, 194560, 194560, 2048, 4096, 0x24a54ccd
+0, 196608, 196608, 2048, 4096, 0xc960df4e
+0, 198656, 198656, 2048, 4096, 0xc7cb6e6f
+0, 200704, 200704, 2048, 4096, 0x4c563ae5
+0, 202752, 202752, 2048, 4096, 0x0dd51432
+0, 204800, 204800, 2048, 4096, 0xdb4243c8
+0, 206848, 206848, 2048, 4096, 0x9bb6417f
+0, 208896, 208896, 2048, 4096, 0xec6a40a1
+0, 210944, 210944, 2048, 4096, 0x82d6c3b4
+0, 212992, 212992, 2048, 4096, 0xd181e2ec
+0, 215040, 215040, 2048, 4096, 0xba5d7b55
+0, 217088, 217088, 2048, 4096, 0x78fcb938
+0, 219136, 219136, 2048, 4096, 0x6691671c
+0, 221184, 221184, 2048, 4096, 0x44fadee7
+0, 223232, 223232, 2048, 4096, 0xa42720d5
+0, 225280, 225280, 2048, 4096, 0xc1165a91
+0, 227328, 227328, 2048, 4096, 0x86aa3e3f
+0, 229376, 229376, 2048, 4096, 0xab5ae57d
+0, 231424, 231424, 2048, 4096, 0x291a91f3
+0, 233472, 233472, 2048, 4096, 0xfdf0dcfc
+0, 235520, 235520, 2048, 4096, 0x1ef91f67
+0, 237568, 237568, 2048, 4096, 0xc899efee
+0, 239616, 239616, 2048, 4096, 0x5ade15ac
+0, 241664, 241664, 2048, 4096, 0x04516beb
+0, 243712, 243712, 2048, 4096, 0xbf5ebbb9
+0, 245760, 245760, 2048, 4096, 0x4a235122
+0, 247808, 247808, 2048, 4096, 0xd7a3f4a6
+0, 249856, 249856, 2048, 4096, 0x5f900f20
+0, 251904, 251904, 2048, 4096, 0xa90b4365
+0, 253952, 253952, 2048, 4096, 0x63149dc4
+0, 256000, 256000, 2048, 4096, 0xf12c1ee8
+0, 258048, 258048, 2048, 4096, 0x6d0fec8c
+0, 260096, 260096, 2048, 4096, 0x65e07850
+0, 262144, 262144, 2048, 4096, 0x16d951cc
+0, 264192, 264192, 2048, 4096, 0xd296d0c4
+0, 266240, 266240, 2048, 4096, 0x619b2a53
+0, 268288, 268288, 2048, 4096, 0x316972d5
+0, 270336, 270336, 2048, 4096, 0xcfd64e21
+0, 272384, 272384, 2048, 4096, 0xcbcb10c6
+0, 274432, 274432, 2048, 4096, 0x20aeff7c
+0, 276480, 276480, 2048, 4096, 0xd205dabd
+0, 278528, 278528, 2048, 4096, 0xac9d3001
+0, 280576, 280576, 2048, 4096, 0x6d53dfdd
+0, 282624, 282624, 2048, 4096, 0xbb9fe15c
+0, 284672, 284672, 2048, 4096, 0x1852b88b
+0, 286720, 286720, 2048, 4096, 0xb0acec01
+0, 288768, 288768, 2048, 4096, 0xb52a9342
+0, 290816, 290816, 2048, 4096, 0x7529faee
+0, 292864, 292864, 2048, 4096, 0x150ff449
+0, 294912, 294912, 2048, 4096, 0xa81d31d9
+0, 296960, 296960, 2048, 4096, 0xbcb8084a
+0, 299008, 299008, 2048, 4096, 0x07229514
+0, 301056, 301056, 2048, 4096, 0xa85cfd88
+0, 303104, 303104, 2048, 4096, 0x0aef9c27
+0, 305152, 305152, 2048, 4096, 0x8ec47b39
+0, 307200, 307200, 2048, 4096, 0x910b0560
+0, 309248, 309248, 2048, 4096, 0x99a8578e
+0, 311296, 311296, 2048, 4096, 0xb3df1d84
+0, 313344, 313344, 2048, 4096, 0x48e52559
+0, 315392, 315392, 2048, 4096, 0xb25c4800
+0, 317440, 317440, 2048, 4096, 0x913bc8ce
+0, 319488, 319488, 2048, 4096, 0xb736cc8c
+0, 321536, 321536, 2048, 4096, 0x13c66646
+0, 323584, 323584, 2048, 4096, 0x70a71221
+0, 325632, 325632, 2048, 4096, 0x3a50a08e
+0, 327680, 327680, 2048, 4096, 0xc0a037b0
+0, 329728, 329728, 2048, 4096, 0x9a789475
+0, 331776, 331776, 2048, 4096, 0xc890ca16
+0, 333824, 333824, 2048, 4096, 0xa0d34bed
+0, 335872, 335872, 2048, 4096, 0x1689fa60
+0, 337920, 337920, 2048, 4096, 0x5bac4c83
+0, 339968, 339968, 684, 1368, 0x904be5e5
diff --git a/gst-libs/ext/libav/tests/ref/fate/g722enc b/gst-libs/ext/libav/tests/ref/fate/g722enc
deleted file mode 100644
index 9b8e469..0000000
--- a/gst-libs/ext/libav/tests/ref/fate/g722enc
+++ /dev/null
@@ -1 +0,0 @@
-94e2f200d6e05b47cec4aa3e94571cf3
diff --git a/gst-libs/ext/libav/tests/ref/fate/g723_1-dec-1 b/gst-libs/ext/libav/tests/ref/fate/g723_1-dec-1
new file mode 100644
index 0000000..a3a7f67
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/g723_1-dec-1
@@ -0,0 +1,3 @@
+#tb 0: 1/8000
+0, 0, 0, 240, 480, 0x7f6f3970
+0, 240, 240, 240, 480, 0x1105a0d3
diff --git a/gst-libs/ext/libav/tests/ref/fate/g723_1-dec-2 b/gst-libs/ext/libav/tests/ref/fate/g723_1-dec-2
new file mode 100644
index 0000000..e7fc9b2
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/g723_1-dec-2
@@ -0,0 +1,27 @@
+#tb 0: 1/8000
+0, 0, 0, 240, 480, 0x5d9d9091
+0, 240, 240, 240, 480, 0x425095b7
+0, 480, 480, 240, 480, 0xe7b6a1a7
+0, 720, 720, 240, 480, 0x9397af19
+0, 960, 960, 240, 480, 0xe671adf7
+0, 1200, 1200, 240, 480, 0x77deb313
+0, 1440, 1440, 240, 480, 0x64abbb5f
+0, 1680, 1680, 240, 480, 0x000bc879
+0, 1920, 1920, 240, 480, 0x5a88c7aa
+0, 2160, 2160, 240, 480, 0xb041cbad
+0, 2400, 2400, 240, 480, 0x3257cd54
+0, 2640, 2640, 240, 480, 0xd6e7d4b3
+0, 2880, 2880, 240, 480, 0x0054d6b6
+0, 3120, 3120, 240, 480, 0x10bcd58e
+0, 3360, 3360, 240, 480, 0x702ed981
+0, 3600, 3600, 240, 480, 0x9870d4e3
+0, 3840, 3840, 240, 480, 0x9c12d6d1
+0, 4080, 4080, 240, 480, 0xc41be449
+0, 4320, 4320, 240, 480, 0xf4bddc5a
+0, 4560, 4560, 240, 480, 0x1c03e0d4
+0, 4800, 4800, 240, 480, 0xc287e4f8
+0, 5040, 5040, 240, 480, 0xf705ec20
+0, 5280, 5280, 240, 480, 0x7835f458
+0, 5520, 5520, 240, 480, 0xa8b3e632
+0, 5760, 5760, 240, 480, 0xd358df57
+0, 6000, 6000, 240, 480, 0x934dab80
diff --git a/gst-libs/ext/libav/tests/ref/fate/g723_1-dec-3 b/gst-libs/ext/libav/tests/ref/fate/g723_1-dec-3
new file mode 100644
index 0000000..d1a2946
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/g723_1-dec-3
@@ -0,0 +1,34 @@
+#tb 0: 1/8000
+0, 0, 0, 240, 480, 0xce908869
+0, 240, 240, 240, 480, 0xfa63588e
+0, 480, 480, 240, 480, 0x11ce850c
+0, 720, 720, 240, 480, 0x76c459cf
+0, 960, 960, 240, 480, 0x13ed8bf0
+0, 1200, 1200, 240, 480, 0x33d10b77
+0, 1440, 1440, 240, 480, 0xdf41e03c
+0, 1680, 1680, 240, 480, 0xa31aad71
+0, 1920, 1920, 240, 480, 0x83c2b48d
+0, 2160, 2160, 240, 480, 0xaf41ba01
+0, 2400, 2400, 240, 480, 0xeeecbadc
+0, 2640, 2640, 240, 480, 0xe253c7e1
+0, 2880, 2880, 240, 480, 0x672cbf0a
+0, 3120, 3120, 240, 480, 0x5f32aa27
+0, 3360, 3360, 240, 480, 0x0b3da147
+0, 3600, 3600, 240, 480, 0x4819e5bc
+0, 3840, 3840, 240, 480, 0x423dec60
+0, 4080, 4080, 240, 480, 0xafefe289
+0, 4320, 4320, 240, 480, 0x8dc5f136
+0, 4560, 4560, 240, 480, 0x549cee78
+0, 4800, 4800, 240, 480, 0xe589ebdc
+0, 5040, 5040, 240, 480, 0x786cef17
+0, 5280, 5280, 240, 480, 0xdafded31
+0, 5520, 5520, 240, 480, 0xe58bedf8
+0, 5760, 5760, 240, 480, 0x44daf26c
+0, 6000, 6000, 240, 480, 0x03fcf149
+0, 6240, 6240, 240, 480, 0x97a5f4ae
+0, 6480, 6480, 240, 480, 0x2114f4f6
+0, 6720, 6720, 240, 480, 0x9a44f234
+0, 6960, 6960, 240, 480, 0x5b47f339
+0, 7200, 7200, 240, 480, 0x9248edcb
+0, 7440, 7440, 240, 480, 0x47caf226
+0, 7680, 7680, 240, 480, 0x73d4ef48
diff --git a/gst-libs/ext/libav/tests/ref/fate/g723_1-dec-4 b/gst-libs/ext/libav/tests/ref/fate/g723_1-dec-4
new file mode 100644
index 0000000..792899d
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/g723_1-dec-4
@@ -0,0 +1,5 @@
+#tb 0: 1/8000
+0, 0, 0, 240, 480, 0xa697b314
+0, 240, 240, 240, 480, 0x43c5dc5a
+0, 480, 480, 240, 480, 0xd2438147
+0, 720, 720, 240, 480, 0x3b1ead64
diff --git a/gst-libs/ext/libav/tests/ref/fate/g723_1-dec-5 b/gst-libs/ext/libav/tests/ref/fate/g723_1-dec-5
new file mode 100644
index 0000000..bdc2982
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/g723_1-dec-5
@@ -0,0 +1,101 @@
+#tb 0: 1/8000
+0, 0, 0, 240, 480, 0x4dce9773
+0, 240, 240, 240, 480, 0xe6367ab8
+0, 480, 480, 240, 480, 0xf36a589d
+0, 720, 720, 240, 480, 0xf94efd31
+0, 960, 960, 240, 480, 0x984e6d33
+0, 1200, 1200, 240, 480, 0x84eaa191
+0, 1440, 1440, 240, 480, 0xed6e0c10
+0, 1680, 1680, 240, 480, 0x3627e7a0
+0, 1920, 1920, 240, 480, 0x2421b42d
+0, 2160, 2160, 240, 480, 0x71e00d6f
+0, 2400, 2400, 240, 480, 0xd49cdb95
+0, 2640, 2640, 240, 480, 0xa167e890
+0, 2880, 2880, 240, 480, 0xbb3fd7c0
+0, 3120, 3120, 240, 480, 0xa3d5bc27
+0, 3360, 3360, 240, 480, 0x8107ca9c
+0, 3600, 3600, 240, 480, 0xcd4ce998
+0, 3840, 3840, 240, 480, 0x14e3ee73
+0, 4080, 4080, 240, 480, 0x5fc3eaf0
+0, 4320, 4320, 240, 480, 0xf166f33d
+0, 4560, 4560, 240, 480, 0xe8b3f701
+0, 4800, 4800, 240, 480, 0x50aaeafd
+0, 5040, 5040, 240, 480, 0xc7f2daec
+0, 5280, 5280, 240, 480, 0x3960e5d0
+0, 5520, 5520, 240, 480, 0xadc8ec32
+0, 5760, 5760, 240, 480, 0x8741e7b0
+0, 6000, 6000, 240, 480, 0x1a1bd910
+0, 6240, 6240, 240, 480, 0x76a4ef7f
+0, 6480, 6480, 240, 480, 0x19e6e5f5
+0, 6720, 6720, 240, 480, 0x6365e871
+0, 6960, 6960, 240, 480, 0xb2bee161
+0, 7200, 7200, 240, 480, 0x5098cba4
+0, 7440, 7440, 240, 480, 0x1009c4c5
+0, 7680, 7680, 240, 480, 0xbf20cfe3
+0, 7920, 7920, 240, 480, 0x91ddd028
+0, 8160, 8160, 240, 480, 0x4fedce37
+0, 8400, 8400, 240, 480, 0x43bcd4d8
+0, 8640, 8640, 240, 480, 0x41b3e782
+0, 8880, 8880, 240, 480, 0xa272f4a6
+0, 9120, 9120, 240, 480, 0x46b2f2cb
+0, 9360, 9360, 240, 480, 0xc47dee7d
+0, 9600, 9600, 240, 480, 0x699fe668
+0, 9840, 9840, 240, 480, 0x72b5daf8
+0, 10080, 10080, 240, 480, 0x0c0cf25e
+0, 10320, 10320, 240, 480, 0xdafff519
+0, 10560, 10560, 240, 480, 0xf1f2e42f
+0, 10800, 10800, 240, 480, 0xe04fe7f4
+0, 11040, 11040, 240, 480, 0x1157d789
+0, 11280, 11280, 240, 480, 0xe598ede6
+0, 11520, 11520, 240, 480, 0xbd06dc2f
+0, 11760, 11760, 240, 480, 0x2aa6d2d9
+0, 12000, 12000, 240, 480, 0xa61ff1a3
+0, 12240, 12240, 240, 480, 0x6f57eb35
+0, 12480, 12480, 240, 480, 0x68c1f4a9
+0, 12720, 12720, 240, 480, 0x5c0ae6f2
+0, 12960, 12960, 240, 480, 0xdffbef45
+0, 13200, 13200, 240, 480, 0xf0daf893
+0, 13440, 13440, 240, 480, 0x680cf0c4
+0, 13680, 13680, 240, 480, 0xbbc1d42f
+0, 13920, 13920, 240, 480, 0x9b66eddd
+0, 14160, 14160, 240, 480, 0xc18be7a3
+0, 14400, 14400, 240, 480, 0x1deae025
+0, 14640, 14640, 240, 480, 0x6c12e002
+0, 14880, 14880, 240, 480, 0x004bf27e
+0, 15120, 15120, 240, 480, 0xc97de444
+0, 15360, 15360, 240, 480, 0xc650de6b
+0, 15600, 15600, 240, 480, 0xe614ecd6
+0, 15840, 15840, 240, 480, 0x2c20d111
+0, 16080, 16080, 240, 480, 0x8562c091
+0, 16320, 16320, 240, 480, 0x4fcddd08
+0, 16560, 16560, 240, 480, 0xc1b2c3cb
+0, 16800, 16800, 240, 480, 0x5dcfdf24
+0, 17040, 17040, 240, 480, 0xf348d7be
+0, 17280, 17280, 240, 480, 0x31b3ead7
+0, 17520, 17520, 240, 480, 0xb30dee68
+0, 17760, 17760, 240, 480, 0x1f44e9ac
+0, 18000, 18000, 240, 480, 0x3cafe61e
+0, 18240, 18240, 240, 480, 0x5800ea95
+0, 18480, 18480, 240, 480, 0xeaeeec19
+0, 18720, 18720, 240, 480, 0x47f9eff3
+0, 18960, 18960, 240, 480, 0xdc10edf1
+0, 19200, 19200, 240, 480, 0x5b1bd3ff
+0, 19440, 19440, 240, 480, 0x039bea64
+0, 19680, 19680, 240, 480, 0xa93ac953
+0, 19920, 19920, 240, 480, 0x1b55f01c
+0, 20160, 20160, 240, 480, 0x32b7db90
+0, 20400, 20400, 240, 480, 0x2f8ce0a8
+0, 20640, 20640, 240, 480, 0x53f4f7d5
+0, 20880, 20880, 240, 480, 0x880ee517
+0, 21120, 21120, 240, 480, 0xe793f2fd
+0, 21360, 21360, 240, 480, 0x498beaf5
+0, 21600, 21600, 240, 480, 0x8c25f623
+0, 21840, 21840, 240, 480, 0xdc0df527
+0, 22080, 22080, 240, 480, 0x9d21e9b4
+0, 22320, 22320, 240, 480, 0x6d51d9e6
+0, 22560, 22560, 240, 480, 0xaf3ee6ba
+0, 22800, 22800, 240, 480, 0xbef0ea44
+0, 23040, 23040, 240, 480, 0x50c6e9ab
+0, 23280, 23280, 240, 480, 0x76a7d80c
+0, 23520, 23520, 240, 480, 0x8d68ef94
+0, 23760, 23760, 240, 480, 0x213ce600
diff --git a/gst-libs/ext/libav/tests/ref/fate/g723_1-dec-6 b/gst-libs/ext/libav/tests/ref/fate/g723_1-dec-6
new file mode 100644
index 0000000..eb0e4fa
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/g723_1-dec-6
@@ -0,0 +1,101 @@
+#tb 0: 1/8000
+0, 0, 0, 240, 480, 0x4fa1aed9
+0, 240, 240, 240, 480, 0x6d7ef391
+0, 480, 480, 240, 480, 0xaecaf2c1
+0, 720, 720, 240, 480, 0xd3b2ed0a
+0, 960, 960, 240, 480, 0x33dceb4e
+0, 1200, 1200, 240, 480, 0xc10eeb64
+0, 1440, 1440, 240, 480, 0x7c0febff
+0, 1680, 1680, 240, 480, 0x0c09eecd
+0, 1920, 1920, 240, 480, 0xa5efdcf8
+0, 2160, 2160, 240, 480, 0xb643edd2
+0, 2400, 2400, 240, 480, 0x46bef26d
+0, 2640, 2640, 240, 480, 0x4310f101
+0, 2880, 2880, 240, 480, 0x3664ec16
+0, 3120, 3120, 240, 480, 0xcc17e5e8
+0, 3360, 3360, 240, 480, 0xff4cf35b
+0, 3600, 3600, 240, 480, 0xdf4cf2e5
+0, 3840, 3840, 240, 480, 0x093bf570
+0, 4080, 4080, 240, 480, 0xd950ec75
+0, 4320, 4320, 240, 480, 0xa469f2f8
+0, 4560, 4560, 240, 480, 0x3558ee9d
+0, 4800, 4800, 240, 480, 0x4102f252
+0, 5040, 5040, 240, 480, 0xf9dff318
+0, 5280, 5280, 240, 480, 0xd7cbef4d
+0, 5520, 5520, 240, 480, 0x76c4eed3
+0, 5760, 5760, 240, 480, 0xe3d6e9d1
+0, 6000, 6000, 240, 480, 0x63baf340
+0, 6240, 6240, 240, 480, 0xd2dff2ff
+0, 6480, 6480, 240, 480, 0x3355ebc4
+0, 6720, 6720, 240, 480, 0x7183ed76
+0, 6960, 6960, 240, 480, 0x9806eff7
+0, 7200, 7200, 240, 480, 0xc090ec04
+0, 7440, 7440, 240, 480, 0xe76ff174
+0, 7680, 7680, 240, 480, 0x2cdfe8f1
+0, 7920, 7920, 240, 480, 0xbb69ee8a
+0, 8160, 8160, 240, 480, 0x3e03f522
+0, 8400, 8400, 240, 480, 0xe7e6e659
+0, 8640, 8640, 240, 480, 0x4dbaf063
+0, 8880, 8880, 240, 480, 0xc9b9f381
+0, 9120, 9120, 240, 480, 0x3866edc9
+0, 9360, 9360, 240, 480, 0x7e0defca
+0, 9600, 9600, 240, 480, 0xa88bf700
+0, 9840, 9840, 240, 480, 0x65a7f029
+0, 10080, 10080, 240, 480, 0xaf8cf09d
+0, 10320, 10320, 240, 480, 0x679bee1e
+0, 10560, 10560, 240, 480, 0x8dc1e9a4
+0, 10800, 10800, 240, 480, 0xe3c2f0ac
+0, 11040, 11040, 240, 480, 0x35d0eb14
+0, 11280, 11280, 240, 480, 0xfeb3ed00
+0, 11520, 11520, 240, 480, 0x9da3ecb4
+0, 11760, 11760, 240, 480, 0xa0e3f3c2
+0, 12000, 12000, 240, 480, 0x05ffe9de
+0, 12240, 12240, 240, 480, 0xf7adef05
+0, 12480, 12480, 240, 480, 0x71bef669
+0, 12720, 12720, 240, 480, 0x4b9feca8
+0, 12960, 12960, 240, 480, 0x85e5ecd8
+0, 13200, 13200, 240, 480, 0xa4cbe90e
+0, 13440, 13440, 240, 480, 0xe689f958
+0, 13680, 13680, 240, 480, 0xa936f168
+0, 13920, 13920, 240, 480, 0x496ff059
+0, 14160, 14160, 240, 480, 0x0bb6eb82
+0, 14400, 14400, 240, 480, 0x7727ef53
+0, 14640, 14640, 240, 480, 0xede3eaab
+0, 14880, 14880, 240, 480, 0xe961ef58
+0, 15120, 15120, 240, 480, 0x454fef58
+0, 15360, 15360, 240, 480, 0x9305e76d
+0, 15600, 15600, 240, 480, 0xfe5ce6ed
+0, 15840, 15840, 240, 480, 0x84d1efdc
+0, 16080, 16080, 240, 480, 0x4b23ed7a
+0, 16320, 16320, 240, 480, 0x1380eb91
+0, 16560, 16560, 240, 480, 0xf705eca3
+0, 16800, 16800, 240, 480, 0x26f7e707
+0, 17040, 17040, 240, 480, 0x3fe3f27f
+0, 17280, 17280, 240, 480, 0xa030f177
+0, 17520, 17520, 240, 480, 0xaf72ed92
+0, 17760, 17760, 240, 480, 0x00b8f1e7
+0, 18000, 18000, 240, 480, 0x681fecca
+0, 18240, 18240, 240, 480, 0x3ca1ef63
+0, 18480, 18480, 240, 480, 0xd6fcedac
+0, 18720, 18720, 240, 480, 0x6928ed04
+0, 18960, 18960, 240, 480, 0x8bdeeebe
+0, 19200, 19200, 240, 480, 0x24b6f59d
+0, 19440, 19440, 240, 480, 0xd49deebf
+0, 19680, 19680, 240, 480, 0xe798f2c8
+0, 19920, 19920, 240, 480, 0x280fefb8
+0, 20160, 20160, 240, 480, 0xe0a8f40d
+0, 20400, 20400, 240, 480, 0x4d48f511
+0, 20640, 20640, 240, 480, 0x6bf3eef0
+0, 20880, 20880, 240, 480, 0x1573f1cd
+0, 21120, 21120, 240, 480, 0x6245e961
+0, 21360, 21360, 240, 480, 0xe05af091
+0, 21600, 21600, 240, 480, 0xfcc3e9e3
+0, 21840, 21840, 240, 480, 0x6d5febae
+0, 22080, 22080, 240, 480, 0x4a96ef58
+0, 22320, 22320, 240, 480, 0x1586f156
+0, 22560, 22560, 240, 480, 0x50b0e99e
+0, 22800, 22800, 240, 480, 0xf25dfa9b
+0, 23040, 23040, 240, 480, 0x49b5f932
+0, 23280, 23280, 240, 480, 0xe1ddef32
+0, 23520, 23520, 240, 480, 0x2307ed94
+0, 23760, 23760, 240, 480, 0x6a2beb17
diff --git a/gst-libs/ext/libav/tests/ref/fate/g723_1-dec-7 b/gst-libs/ext/libav/tests/ref/fate/g723_1-dec-7
new file mode 100644
index 0000000..cc30187
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/g723_1-dec-7
@@ -0,0 +1,12 @@
+#tb 0: 1/8000
+0, 0, 0, 240, 480, 0x35e4a1fd
+0, 240, 240, 240, 480, 0x2f7bdd60
+0, 480, 480, 240, 480, 0x0407e499
+0, 720, 720, 240, 480, 0x5f5ef209
+0, 960, 960, 240, 480, 0xe936e8d1
+0, 1200, 1200, 240, 480, 0x0896ddba
+0, 1440, 1440, 240, 480, 0xa885ea94
+0, 1680, 1680, 240, 480, 0x40bff3d0
+0, 1920, 1920, 240, 480, 0xe05ce4c3
+0, 2160, 2160, 240, 480, 0x80c4f790
+0, 2400, 2400, 240, 480, 0x65d5e8f9
diff --git a/gst-libs/ext/libav/tests/ref/fate/g723_1-dec-8 b/gst-libs/ext/libav/tests/ref/fate/g723_1-dec-8
new file mode 100644
index 0000000..fc4d9f3
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/g723_1-dec-8
@@ -0,0 +1,121 @@
+#tb 0: 1/8000
+0, 0, 0, 240, 480, 0x17930e0f
+0, 240, 240, 240, 480, 0x7c7f4247
+0, 480, 480, 240, 480, 0xbf3489e5
+0, 720, 720, 240, 480, 0x24319fc9
+0, 960, 960, 240, 480, 0xb327eec0
+0, 1200, 1200, 240, 480, 0xc2ddcbca
+0, 1440, 1440, 240, 480, 0xeebad740
+0, 1680, 1680, 240, 480, 0x77fcb933
+0, 1920, 1920, 240, 480, 0x9677c5b7
+0, 2160, 2160, 240, 480, 0xb49dcb9e
+0, 2400, 2400, 240, 480, 0x0e78d7e6
+0, 2640, 2640, 240, 480, 0xf752dc3e
+0, 2880, 2880, 240, 480, 0xc95af091
+0, 3120, 3120, 240, 480, 0xa25de399
+0, 3360, 3360, 240, 480, 0x34e7e0da
+0, 3600, 3600, 240, 480, 0x6c84e3f4
+0, 3840, 3840, 240, 480, 0x2c7dda20
+0, 4080, 4080, 240, 480, 0x00a5f112
+0, 4320, 4320, 240, 480, 0x943ddd89
+0, 4560, 4560, 240, 480, 0x4ad4ebac
+0, 4800, 4800, 240, 480, 0xa4ff0aa8
+0, 5040, 5040, 240, 480, 0xc0f805f2
+0, 5280, 5280, 240, 480, 0x859ce987
+0, 5520, 5520, 240, 480, 0x9ebcd0de
+0, 5760, 5760, 240, 480, 0x3de2db0b
+0, 6000, 6000, 240, 480, 0x0affea9c
+0, 6240, 6240, 240, 480, 0xcb1bf81e
+0, 6480, 6480, 240, 480, 0x8a72d71d
+0, 6720, 6720, 240, 480, 0x583cd5cd
+0, 6960, 6960, 240, 480, 0x4be7dc7b
+0, 7200, 7200, 240, 480, 0xb08108c0
+0, 7440, 7440, 240, 480, 0xd0b3ed59
+0, 7680, 7680, 240, 480, 0x7d33f822
+0, 7920, 7920, 240, 480, 0x199c0111
+0, 8160, 8160, 240, 480, 0x7d29f2a8
+0, 8400, 8400, 240, 480, 0x424dec5e
+0, 8640, 8640, 240, 480, 0x946cf258
+0, 8880, 8880, 240, 480, 0xd429da7a
+0, 9120, 9120, 240, 480, 0x0f11df46
+0, 9360, 9360, 240, 480, 0xf4dce502
+0, 9600, 9600, 240, 480, 0x01c1de78
+0, 9840, 9840, 240, 480, 0xd1d3da59
+0, 10080, 10080, 240, 480, 0x5822f3ec
+0, 10320, 10320, 240, 480, 0xadd5fe67
+0, 10560, 10560, 240, 480, 0xdcf5f2c3
+0, 10800, 10800, 240, 480, 0x5176e39b
+0, 11040, 11040, 240, 480, 0xf947e0b1
+0, 11280, 11280, 240, 480, 0x33b1eb36
+0, 11520, 11520, 240, 480, 0x57bce9bd
+0, 11760, 11760, 240, 480, 0x806eec1f
+0, 12000, 12000, 240, 480, 0x0a60f94a
+0, 12240, 12240, 240, 480, 0x9eddf27d
+0, 12480, 12480, 240, 480, 0x3d28ef2f
+0, 12720, 12720, 240, 480, 0x52f0e562
+0, 12960, 12960, 240, 480, 0xf2d6c8a0
+0, 13200, 13200, 240, 480, 0xfa0df4a1
+0, 13440, 13440, 240, 480, 0x9cccfda9
+0, 13680, 13680, 240, 480, 0xa7c1e528
+0, 13920, 13920, 240, 480, 0xe130e8f9
+0, 14160, 14160, 240, 480, 0x80f6eabe
+0, 14400, 14400, 240, 480, 0x9bbb027e
+0, 14640, 14640, 240, 480, 0x33cdea7f
+0, 14880, 14880, 240, 480, 0x84d8e761
+0, 15120, 15120, 240, 480, 0xb99ce457
+0, 15360, 15360, 240, 480, 0x5dc1e324
+0, 15600, 15600, 240, 480, 0xc914e6c3
+0, 15840, 15840, 240, 480, 0x8e77f5c2
+0, 16080, 16080, 240, 480, 0x3997034d
+0, 16320, 16320, 240, 480, 0x820cfd49
+0, 16560, 16560, 240, 480, 0x8ad5f24c
+0, 16800, 16800, 240, 480, 0xe21be71c
+0, 17040, 17040, 240, 480, 0x516ae8c8
+0, 17280, 17280, 240, 480, 0x595bdc3d
+0, 17520, 17520, 240, 480, 0x8a4bee79
+0, 17760, 17760, 240, 480, 0x307fed64
+0, 18000, 18000, 240, 480, 0xe71cf219
+0, 18240, 18240, 240, 480, 0xdb0be1a1
+0, 18480, 18480, 240, 480, 0x7947dfbd
+0, 18720, 18720, 240, 480, 0x5d90fbf0
+0, 18960, 18960, 240, 480, 0xa449fc55
+0, 19200, 19200, 240, 480, 0x45b2f979
+0, 19440, 19440, 240, 480, 0x2b2be378
+0, 19680, 19680, 240, 480, 0x2d2edf42
+0, 19920, 19920, 240, 480, 0x568ee04f
+0, 20160, 20160, 240, 480, 0x66f0debe
+0, 20400, 20400, 240, 480, 0xc943eab7
+0, 20640, 20640, 240, 480, 0xc9ade3c9
+0, 20880, 20880, 240, 480, 0x6971f92d
+0, 21120, 21120, 240, 480, 0x48d0ecbc
+0, 21360, 21360, 240, 480, 0xf641dc98
+0, 21600, 21600, 240, 480, 0xbb18e167
+0, 21840, 21840, 240, 480, 0x72ce0968
+0, 22080, 22080, 240, 480, 0x15bee6f6
+0, 22320, 22320, 240, 480, 0x93d5e91f
+0, 22560, 22560, 240, 480, 0x7aee010b
+0, 22800, 22800, 240, 480, 0x9e82dc87
+0, 23040, 23040, 240, 480, 0x4ee6f547
+0, 23280, 23280, 240, 480, 0x3072d102
+0, 23520, 23520, 240, 480, 0x74d4fb04
+0, 23760, 23760, 240, 480, 0xc670f958
+0, 24000, 24000, 240, 480, 0x3965c41f
+0, 24240, 24240, 240, 480, 0x6a2de869
+0, 24480, 24480, 240, 480, 0xa757f44b
+0, 24720, 24720, 240, 480, 0x94a5168c
+0, 24960, 24960, 240, 480, 0xef0f0c28
+0, 25200, 25200, 240, 480, 0x3770ebb3
+0, 25440, 25440, 240, 480, 0x4343de6f
+0, 25680, 25680, 240, 480, 0x3ec8d816
+0, 25920, 25920, 240, 480, 0x1661e3d3
+0, 26160, 26160, 240, 480, 0x077cd9fd
+0, 26400, 26400, 240, 480, 0xb5ece07e
+0, 26640, 26640, 240, 480, 0xf303e151
+0, 26880, 26880, 240, 480, 0x95e4d019
+0, 27120, 27120, 240, 480, 0x4bd0ddc0
+0, 27360, 27360, 240, 480, 0x6cebd341
+0, 27600, 27600, 240, 480, 0xea3fea9e
+0, 27840, 27840, 240, 480, 0x5ad30c3f
+0, 28080, 28080, 240, 480, 0x218c02a5
+0, 28320, 28320, 240, 480, 0x662decd0
+0, 28560, 28560, 240, 480, 0x6865e2f2
diff --git a/gst-libs/ext/libav/tests/ref/fate/g726-encode-2bit b/gst-libs/ext/libav/tests/ref/fate/g726-encode-2bit
new file mode 100644
index 0000000..26a1219
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/g726-encode-2bit
@@ -0,0 +1 @@
+MD5=215eaef5778a16e2bf4f3725a557f355
diff --git a/gst-libs/ext/libav/tests/ref/fate/g726-encode-3bit b/gst-libs/ext/libav/tests/ref/fate/g726-encode-3bit
new file mode 100644
index 0000000..f9c6940
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/g726-encode-3bit
@@ -0,0 +1 @@
+MD5=0bebd949dfd5ac0ae3f2c3ceb2e3fac1
diff --git a/gst-libs/ext/libav/tests/ref/fate/g726-encode-4bit b/gst-libs/ext/libav/tests/ref/fate/g726-encode-4bit
new file mode 100644
index 0000000..6d03517
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/g726-encode-4bit
@@ -0,0 +1 @@
+MD5=a21cfea116ab2179eabe5d84b6bfc09a
diff --git a/gst-libs/ext/libav/tests/ref/fate/g726-encode-5bit b/gst-libs/ext/libav/tests/ref/fate/g726-encode-5bit
new file mode 100644
index 0000000..459ebb3
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/g726-encode-5bit
@@ -0,0 +1 @@
+MD5=9cad98cf5205bf76d6e9d1241e56141a
diff --git a/gst-libs/ext/libav/tests/ref/fate/gsm-ms b/gst-libs/ext/libav/tests/ref/fate/gsm-ms
index 76a6f29..6d15cb8 100644
--- a/gst-libs/ext/libav/tests/ref/fate/gsm-ms
+++ b/gst-libs/ext/libav/tests/ref/fate/gsm-ms
@@ -1,89 +1,90 @@
-0, 0, 640, 0xf79c59ee
-0, 3600, 640, 0x6e6248be
-0, 7200, 640, 0x2a5b3aed
-0, 10800, 640, 0xf7012e06
-0, 14400, 640, 0x626645cd
-0, 18000, 640, 0x9f482b66
-0, 21600, 640, 0xea443886
-0, 25200, 640, 0xa79b3dc0
-0, 28800, 640, 0x0161263f
-0, 32400, 640, 0x61b33154
-0, 36000, 640, 0xf7fa388c
-0, 39600, 640, 0xb63038e9
-0, 43200, 640, 0x61b03506
-0, 46800, 640, 0xed4e2eac
-0, 50400, 640, 0x9b8127f1
-0, 54000, 640, 0xe50627be
-0, 57600, 640, 0x6b5038f9
-0, 61200, 640, 0x8e794c10
-0, 64800, 640, 0x426d2c93
-0, 68400, 640, 0x9a373111
-0, 72000, 640, 0x94132ccb
-0, 75600, 640, 0x610b3788
-0, 79200, 640, 0x27204206
-0, 82800, 640, 0xbdf82268
-0, 86400, 640, 0x2e653066
-0, 90000, 640, 0xccfd2328
-0, 93600, 640, 0xf2431e04
-0, 97200, 640, 0x7b412094
-0, 100800, 640, 0x5c2635fa
-0, 104400, 640, 0xdcbd2c60
-0, 108000, 640, 0x65173699
-0, 111600, 640, 0xbcff19ed
-0, 115200, 640, 0xf5b2206c
-0, 118800, 640, 0x587e460c
-0, 122400, 640, 0x2418382d
-0, 126000, 640, 0xbfad2f9b
-0, 129600, 640, 0x87d92d6c
-0, 133200, 640, 0xdc582c69
-0, 136800, 640, 0xcfe52ebf
-0, 140400, 640, 0xe0032e70
-0, 144000, 640, 0xf8a61b57
-0, 147600, 640, 0xa9ef2ee5
-0, 151200, 640, 0x7f513313
-0, 154800, 640, 0x93731177
-0, 158400, 640, 0xed2c2340
-0, 162000, 640, 0x85b02913
-0, 165600, 640, 0xa5a92f3e
-0, 169200, 640, 0x72472490
-0, 172800, 640, 0x856231fc
-0, 176400, 640, 0xda2e3c22
-0, 180000, 640, 0xcce84c36
-0, 183600, 640, 0x39312c78
-0, 187200, 640, 0xf1aa2365
-0, 190800, 640, 0x1dba3f7e
-0, 194400, 640, 0x21953579
-0, 198000, 640, 0xbbd52c22
-0, 201600, 640, 0x45c71537
-0, 205200, 640, 0x26051cec
-0, 208800, 640, 0x27ae223e
-0, 212400, 640, 0x223c0bb8
-0, 216000, 640, 0xc5b72796
-0, 219600, 640, 0xe7fd294d
-0, 223200, 640, 0x19042293
-0, 226800, 640, 0xa6572c6b
-0, 230400, 640, 0x58ac1d16
-0, 234000, 640, 0xd0631bd6
-0, 237600, 640, 0xe74f276c
-0, 241200, 640, 0x87d0295f
-0, 244800, 640, 0x054e3dc8
-0, 248400, 640, 0x0ca51c2d
-0, 252000, 640, 0x17a02616
-0, 255600, 640, 0x56b2235d
-0, 259200, 640, 0x1cd93302
-0, 262800, 640, 0xe3672352
-0, 266400, 640, 0xc99f2e45
-0, 270000, 640, 0x36a43e9d
-0, 273600, 640, 0xfcd73e87
-0, 277200, 640, 0x813b2e20
-0, 280800, 640, 0x8f7a4cac
-0, 284400, 640, 0xcf3e4106
-0, 288000, 640, 0x8a752b07
-0, 291600, 640, 0xe5013dcd
-0, 295200, 640, 0xda4a3d03
-0, 298800, 640, 0x05ce2c64
-0, 302400, 640, 0x1e0f42b5
-0, 306000, 640, 0xe4bd326a
-0, 309600, 640, 0x701c28de
-0, 313200, 640, 0xd0b02f97
-0, 316800, 640, 0x7950419b
+#tb 0: 1/8000
+0, 0, 0, 320, 640, 0xf79c59ee
+0, 320, 320, 320, 640, 0x6e6248be
+0, 640, 640, 320, 640, 0x2a5b3aed
+0, 960, 960, 320, 640, 0xf7012e06
+0, 1280, 1280, 320, 640, 0x626645cd
+0, 1600, 1600, 320, 640, 0x9f482b66
+0, 1920, 1920, 320, 640, 0xea443886
+0, 2240, 2240, 320, 640, 0xa79b3dc0
+0, 2560, 2560, 320, 640, 0x0161263f
+0, 2880, 2880, 320, 640, 0x61b33154
+0, 3200, 3200, 320, 640, 0xf7fa388c
+0, 3520, 3520, 320, 640, 0xb63038e9
+0, 3840, 3840, 320, 640, 0x61b03506
+0, 4160, 4160, 320, 640, 0xed4e2eac
+0, 4480, 4480, 320, 640, 0x9b8127f1
+0, 4800, 4800, 320, 640, 0xe50627be
+0, 5120, 5120, 320, 640, 0x6b5038f9
+0, 5440, 5440, 320, 640, 0x8e794c10
+0, 5760, 5760, 320, 640, 0x426d2c93
+0, 6080, 6080, 320, 640, 0x9a373111
+0, 6400, 6400, 320, 640, 0x94132ccb
+0, 6720, 6720, 320, 640, 0x610b3788
+0, 7040, 7040, 320, 640, 0x27204206
+0, 7360, 7360, 320, 640, 0xbdf82268
+0, 7680, 7680, 320, 640, 0x2e653066
+0, 8000, 8000, 320, 640, 0xccfd2328
+0, 8320, 8320, 320, 640, 0xf2431e04
+0, 8640, 8640, 320, 640, 0x7b412094
+0, 8960, 8960, 320, 640, 0x5c2635fa
+0, 9280, 9280, 320, 640, 0xdcbd2c60
+0, 9600, 9600, 320, 640, 0x65173699
+0, 9920, 9920, 320, 640, 0xbcff19ed
+0, 10240, 10240, 320, 640, 0xf5b2206c
+0, 10560, 10560, 320, 640, 0x587e460c
+0, 10880, 10880, 320, 640, 0x2418382d
+0, 11200, 11200, 320, 640, 0xbfad2f9b
+0, 11520, 11520, 320, 640, 0x87d92d6c
+0, 11840, 11840, 320, 640, 0xdc582c69
+0, 12160, 12160, 320, 640, 0xcfe52ebf
+0, 12480, 12480, 320, 640, 0xe0032e70
+0, 12800, 12800, 320, 640, 0xf8a61b57
+0, 13120, 13120, 320, 640, 0xa9ef2ee5
+0, 13440, 13440, 320, 640, 0x7f513313
+0, 13760, 13760, 320, 640, 0x93731177
+0, 14080, 14080, 320, 640, 0xed2c2340
+0, 14400, 14400, 320, 640, 0x85b02913
+0, 14720, 14720, 320, 640, 0xa5a92f3e
+0, 15040, 15040, 320, 640, 0x72472490
+0, 15360, 15360, 320, 640, 0x856231fc
+0, 15680, 15680, 320, 640, 0xda2e3c22
+0, 16000, 16000, 320, 640, 0xcce84c36
+0, 16320, 16320, 320, 640, 0x39312c78
+0, 16640, 16640, 320, 640, 0xf1aa2365
+0, 16960, 16960, 320, 640, 0x1dba3f7e
+0, 17280, 17280, 320, 640, 0x21953579
+0, 17600, 17600, 320, 640, 0xbbd52c22
+0, 17920, 17920, 320, 640, 0x45c71537
+0, 18240, 18240, 320, 640, 0x26051cec
+0, 18560, 18560, 320, 640, 0x27ae223e
+0, 18880, 18880, 320, 640, 0x223c0bb8
+0, 19200, 19200, 320, 640, 0xc5b72796
+0, 19520, 19520, 320, 640, 0xe7fd294d
+0, 19840, 19840, 320, 640, 0x19042293
+0, 20160, 20160, 320, 640, 0xa6572c6b
+0, 20480, 20480, 320, 640, 0x58ac1d16
+0, 20800, 20800, 320, 640, 0xd0631bd6
+0, 21120, 21120, 320, 640, 0xe74f276c
+0, 21440, 21440, 320, 640, 0x87d0295f
+0, 21760, 21760, 320, 640, 0x054e3dc8
+0, 22080, 22080, 320, 640, 0x0ca51c2d
+0, 22400, 22400, 320, 640, 0x17a02616
+0, 22720, 22720, 320, 640, 0x56b2235d
+0, 23040, 23040, 320, 640, 0x1cd93302
+0, 23360, 23360, 320, 640, 0xe3672352
+0, 23680, 23680, 320, 640, 0xc99f2e45
+0, 24000, 24000, 320, 640, 0x36a43e9d
+0, 24320, 24320, 320, 640, 0xfcd73e87
+0, 24640, 24640, 320, 640, 0x813b2e20
+0, 24960, 24960, 320, 640, 0x8f7a4cac
+0, 25280, 25280, 320, 640, 0xcf3e4106
+0, 25600, 25600, 320, 640, 0x8a752b07
+0, 25920, 25920, 320, 640, 0xe5013dcd
+0, 26240, 26240, 320, 640, 0xda4a3d03
+0, 26560, 26560, 320, 640, 0x05ce2c64
+0, 26880, 26880, 320, 640, 0x1e0f42b5
+0, 27200, 27200, 320, 640, 0xe4bd326a
+0, 27520, 27520, 320, 640, 0x701c28de
+0, 27840, 27840, 320, 640, 0xd0b02f97
+0, 28160, 28160, 320, 640, 0x7950419b
diff --git a/gst-libs/ext/libav/tests/ref/fate/gsm-toast b/gst-libs/ext/libav/tests/ref/fate/gsm-toast
index 89f87d4..721e4e4 100644
--- a/gst-libs/ext/libav/tests/ref/fate/gsm-toast
+++ b/gst-libs/ext/libav/tests/ref/fate/gsm-toast
@@ -1,500 +1,501 @@
-0, 0, 320, 0x4c32ab06
-0, 1800, 320, 0x2052a4e7
-0, 3600, 320, 0xe9aeafca
-0, 5400, 320, 0xde83b450
-0, 7200, 320, 0x06a6a80e
-0, 9000, 320, 0xf6aeb1e2
-0, 10800, 320, 0x2623b40c
-0, 12600, 320, 0x8ec69f25
-0, 14400, 320, 0xddaaac88
-0, 16200, 320, 0x9e60b713
-0, 18000, 320, 0xb738ab30
-0, 19800, 320, 0xdb4bbb92
-0, 21600, 320, 0x0370ae8b
-0, 23400, 320, 0xb611a3fb
-0, 25200, 320, 0x07ee8e3b
-0, 27000, 320, 0xdb1ec628
-0, 28800, 320, 0xd5f1bda2
-0, 30600, 320, 0xcabb9a9c
-0, 32400, 320, 0x16c8ad61
-0, 34200, 320, 0xf76fc25e
-0, 36000, 320, 0x7118a10d
-0, 37800, 320, 0x29f9a0db
-0, 39600, 320, 0x41f2a4ef
-0, 41400, 320, 0x36dfb231
-0, 43200, 320, 0xc5399eda
-0, 45000, 320, 0x17d4b9e0
-0, 46800, 320, 0x2b5797ac
-0, 48600, 320, 0x0128c5e7
-0, 50400, 320, 0xf4f38037
-0, 52200, 320, 0x77d6b5f2
-0, 54000, 320, 0xd94a93e0
-0, 55800, 320, 0x968daae3
-0, 57600, 320, 0xda5ba0ec
-0, 59400, 320, 0x316da1ec
-0, 61200, 320, 0x3a35b2d2
-0, 63000, 320, 0xca0b988f
-0, 64800, 320, 0x1295b0b1
-0, 66600, 320, 0xe121ae72
-0, 68400, 320, 0x7da7ad43
-0, 70200, 320, 0x96a49cfe
-0, 72000, 320, 0x70c2b1de
-0, 73800, 320, 0x668d88c0
-0, 75600, 320, 0x5460b5a8
-0, 77400, 320, 0x6ac78eab
-0, 79200, 320, 0x0d8dab87
-0, 81000, 320, 0xe2be94af
-0, 82800, 320, 0x3487acdc
-0, 84600, 320, 0x5048955a
-0, 86400, 320, 0x2ef4ae0d
-0, 88200, 320, 0xc765b773
-0, 90000, 320, 0xad96a486
-0, 91800, 320, 0xb9fdbf1f
-0, 93600, 320, 0xf26c9ecf
-0, 95400, 320, 0xbcadb535
-0, 97200, 320, 0xa8c897bc
-0, 99000, 320, 0xaa58b520
-0, 100800, 320, 0xcb48a716
-0, 102600, 320, 0x4d5da564
-0, 104400, 320, 0x9809ae28
-0, 106200, 320, 0x5baeb1e4
-0, 108000, 320, 0x6a719b63
-0, 109800, 320, 0xc27d92f0
-0, 111600, 320, 0x0e9b9fe9
-0, 113400, 320, 0xbf9d9bf7
-0, 115200, 320, 0xf35aa64d
-0, 117000, 320, 0x26449ce8
-0, 118800, 320, 0x58f4a997
-0, 120600, 320, 0x155da289
-0, 122400, 320, 0x63b19a5c
-0, 124200, 320, 0xe01aad38
-0, 126000, 320, 0x4e0f9c43
-0, 127800, 320, 0x9447a284
-0, 129600, 320, 0xdb36a433
-0, 131400, 320, 0x799a9b2c
-0, 133200, 320, 0x1526a162
-0, 135000, 320, 0x0a4ea140
-0, 136800, 320, 0xb08f9ed7
-0, 138600, 320, 0x221bab76
-0, 140400, 320, 0x4befacf0
-0, 142200, 320, 0xac489509
-0, 144000, 320, 0x57a1a5b4
-0, 145800, 320, 0x81e8ab97
-0, 147600, 320, 0xc6ada4d6
-0, 149400, 320, 0x12489975
-0, 151200, 320, 0x1da59ba9
-0, 153000, 320, 0xf225ac62
-0, 154800, 320, 0x8c8e9eab
-0, 156600, 320, 0x10599dec
-0, 158400, 320, 0x06c39fa5
-0, 160200, 320, 0xb0efa3c4
-0, 162000, 320, 0x72caadab
-0, 163800, 320, 0xe4619ff0
-0, 165600, 320, 0x49bca017
-0, 167400, 320, 0x413f9fbe
-0, 169200, 320, 0x6eaed0ee
-0, 171000, 320, 0x27e4b1eb
-0, 172800, 320, 0x8c42a30f
-0, 174600, 320, 0x0afaa0f4
-0, 176400, 320, 0x0f74b76b
-0, 178200, 320, 0xa9a2b9d5
-0, 180000, 320, 0xde2a8712
-0, 181800, 320, 0xcfc8b3a2
-0, 183600, 320, 0x768cadce
-0, 185400, 320, 0x3a8a97f1
-0, 187200, 320, 0x502fa59b
-0, 189000, 320, 0x4c3e9b0f
-0, 190800, 320, 0x1cd2b111
-0, 192600, 320, 0xa845a5a3
-0, 194400, 320, 0xa6b8b982
-0, 196200, 320, 0x4d5caab9
-0, 198000, 320, 0x7993b604
-0, 199800, 320, 0x8d19b37b
-0, 201600, 320, 0xbe48adb6
-0, 203400, 320, 0x7d68ab8e
-0, 205200, 320, 0xbfffb0e2
-0, 207000, 320, 0x90b5b7e3
-0, 208800, 320, 0x9fa1b016
-0, 210600, 320, 0x70abafc9
-0, 212400, 320, 0x82cfad9c
-0, 214200, 320, 0x05f6aa2c
-0, 216000, 320, 0x511cbb5b
-0, 217800, 320, 0xd27caaa6
-0, 219600, 320, 0x781ca481
-0, 221400, 320, 0x12e9ad1a
-0, 223200, 320, 0xe46b989d
-0, 225000, 320, 0x76dbb0a7
-0, 226800, 320, 0x10eba486
-0, 228600, 320, 0x2269a7c8
-0, 230400, 320, 0x084a9c7e
-0, 232200, 320, 0x84eda891
-0, 234000, 320, 0x2ef9a639
-0, 235800, 320, 0x8bb2a0dd
-0, 237600, 320, 0x47e5a169
-0, 239400, 320, 0x98faae42
-0, 241200, 320, 0x81d2aba4
-0, 243000, 320, 0x5af8bb33
-0, 244800, 320, 0x331e8d9f
-0, 246600, 320, 0xd9b0c09a
-0, 248400, 320, 0xbaf9bfcf
-0, 250200, 320, 0x54e89ab5
-0, 252000, 320, 0x1d62c1d2
-0, 253800, 320, 0xead6b436
-0, 255600, 320, 0x465f98bc
-0, 257400, 320, 0xe707a346
-0, 259200, 320, 0xf66cb1c2
-0, 261000, 320, 0xcfc89ae6
-0, 262800, 320, 0x0b10b796
-0, 264600, 320, 0xb29caf2c
-0, 266400, 320, 0x0284a9d1
-0, 268200, 320, 0xb966b5fc
-0, 270000, 320, 0x2defa630
-0, 271800, 320, 0xcdcd8ef3
-0, 273600, 320, 0xa81bba2b
-0, 275400, 320, 0x6bc0aeb1
-0, 277200, 320, 0x38d8ac82
-0, 279000, 320, 0xeb66a865
-0, 280800, 320, 0x4fff9cd9
-0, 282600, 320, 0x6819a19b
-0, 284400, 320, 0xfd7c93ce
-0, 286200, 320, 0xa7419f63
-0, 288000, 320, 0x572caacb
-0, 289800, 320, 0x918fb1de
-0, 291600, 320, 0x0088a675
-0, 293400, 320, 0x19229cf7
-0, 295200, 320, 0x827ea812
-0, 297000, 320, 0x6c258ef7
-0, 298800, 320, 0x6a89b8fe
-0, 300600, 320, 0x166c9ce0
-0, 302400, 320, 0x68b39db7
-0, 304200, 320, 0x3d5aa8ec
-0, 306000, 320, 0x25e09ff3
-0, 307800, 320, 0x759aa4ce
-0, 309600, 320, 0xe5aab0ea
-0, 311400, 320, 0xf0359e9a
-0, 313200, 320, 0x51199fff
-0, 315000, 320, 0xb04aa236
-0, 316800, 320, 0xe09da0e3
-0, 318600, 320, 0x144f98a9
-0, 320400, 320, 0x0b4e9f8d
-0, 322200, 320, 0xbb69a090
-0, 324000, 320, 0xec6e9b5b
-0, 325800, 320, 0x4f86a477
-0, 327600, 320, 0x4a179d04
-0, 329400, 320, 0x9682a375
-0, 331200, 320, 0x3c6ba55e
-0, 333000, 320, 0x50c0ab50
-0, 334800, 320, 0xe58ea907
-0, 336600, 320, 0xc5eaa021
-0, 338400, 320, 0x38859f01
-0, 340200, 320, 0x73f8a540
-0, 342000, 320, 0x395da234
-0, 343800, 320, 0x7f50b144
-0, 345600, 320, 0x45568ceb
-0, 347400, 320, 0xd0508dec
-0, 349200, 320, 0x60aba7e4
-0, 351000, 320, 0x4b24b15f
-0, 352800, 320, 0xbfc9afd6
-0, 354600, 320, 0xf0f2ad49
-0, 356400, 320, 0xeea0a426
-0, 358200, 320, 0xff07a7c9
-0, 360000, 320, 0xce1fc788
-0, 361800, 320, 0xc074ae9b
-0, 363600, 320, 0x51649696
-0, 365400, 320, 0x24399744
-0, 367200, 320, 0xfb0eb920
-0, 369000, 320, 0x3bf8af5c
-0, 370800, 320, 0xeab69ee0
-0, 372600, 320, 0x182696bb
-0, 374400, 320, 0x36e6af72
-0, 376200, 320, 0x48cc9ecc
-0, 378000, 320, 0xfb3ca7b8
-0, 379800, 320, 0xe01aa4b4
-0, 381600, 320, 0x5c6dac8c
-0, 383400, 320, 0x072fbd93
-0, 385200, 320, 0xc8899ccc
-0, 387000, 320, 0xdcc990ac
-0, 388800, 320, 0x28e0a9d0
-0, 390600, 320, 0x0cdbaa11
-0, 392400, 320, 0x8f4ca093
-0, 394200, 320, 0x7ee79ea9
-0, 396000, 320, 0xa762b695
-0, 397800, 320, 0x9af0b5da
-0, 399600, 320, 0x1f2cb0e7
-0, 401400, 320, 0x6029b8bb
-0, 403200, 320, 0xf2f7acec
-0, 405000, 320, 0xb3e5b5be
-0, 406800, 320, 0x266ba8a6
-0, 408600, 320, 0x4ff59296
-0, 410400, 320, 0x11d1b9ac
-0, 412200, 320, 0x749197f7
-0, 414000, 320, 0x8192b517
-0, 415800, 320, 0xde129dbe
-0, 417600, 320, 0x85e4a096
-0, 419400, 320, 0xdebf9182
-0, 421200, 320, 0x7a4ba0bf
-0, 423000, 320, 0x55fe9fcd
-0, 424800, 320, 0xd242adec
-0, 426600, 320, 0xeaf5b159
-0, 428400, 320, 0xfcb1a571
-0, 430200, 320, 0x62fabda0
-0, 432000, 320, 0x45a9abcc
-0, 433800, 320, 0x07af974b
-0, 435600, 320, 0xc2a0b4fd
-0, 437400, 320, 0xc30abccd
-0, 439200, 320, 0xd33ca61c
-0, 441000, 320, 0x3c33d11a
-0, 442800, 320, 0x9c2ca0ac
-0, 444600, 320, 0xa5d69777
-0, 446400, 320, 0xb7d2c6b8
-0, 448200, 320, 0x34bbaab9
-0, 450000, 320, 0x3e7baccb
-0, 451800, 320, 0x92c6b7e6
-0, 453600, 320, 0xc810a18a
-0, 455400, 320, 0x06a09f56
-0, 457200, 320, 0x8804a504
-0, 459000, 320, 0x783ba7d5
-0, 460800, 320, 0x24dcada6
-0, 462600, 320, 0x4af796be
-0, 464400, 320, 0x1454b19c
-0, 466200, 320, 0x0ad0a56e
-0, 468000, 320, 0x8944a44e
-0, 469800, 320, 0x31069ebd
-0, 471600, 320, 0x19cb9812
-0, 473400, 320, 0xac75abe2
-0, 475200, 320, 0x0162a200
-0, 477000, 320, 0xa2d7a4b2
-0, 478800, 320, 0x078ca611
-0, 480600, 320, 0x0ec39b40
-0, 482400, 320, 0xe8f794b2
-0, 484200, 320, 0xc2cfb258
-0, 486000, 320, 0xe4759061
-0, 487800, 320, 0xb1b6aea4
-0, 489600, 320, 0x9bfb96df
-0, 491400, 320, 0xcc61b5d3
-0, 493200, 320, 0xd14e8df9
-0, 495000, 320, 0xd9d5bbf5
-0, 496800, 320, 0x4d9fa9b0
-0, 498600, 320, 0xf606abfc
-0, 500400, 320, 0x720baa19
-0, 502200, 320, 0x7f7cac49
-0, 504000, 320, 0xceab9b54
-0, 505800, 320, 0x645fa70a
-0, 507600, 320, 0xa081a40f
-0, 509400, 320, 0x21d78f8c
-0, 511200, 320, 0xedf3abc6
-0, 513000, 320, 0x17679637
-0, 514800, 320, 0x1cb1ae04
-0, 516600, 320, 0x17cd9f62
-0, 518400, 320, 0xf4bca3ab
-0, 520200, 320, 0xb3bd9152
-0, 522000, 320, 0x4e1e9825
-0, 523800, 320, 0x037e9a56
-0, 525600, 320, 0xd7589fcc
-0, 527400, 320, 0x5f949e90
-0, 529200, 320, 0xe133a495
-0, 531000, 320, 0x7cb7a52c
-0, 532800, 320, 0xb8b29d95
-0, 534600, 320, 0x01bca472
-0, 536400, 320, 0xbcc69895
-0, 538200, 320, 0xabffa0ee
-0, 540000, 320, 0xe6629eca
-0, 541800, 320, 0x572da7cd
-0, 543600, 320, 0x3017972d
-0, 545400, 320, 0xac4e9c78
-0, 547200, 320, 0x112f9c45
-0, 549000, 320, 0x05e9a64d
-0, 550800, 320, 0x8f7394d4
-0, 552600, 320, 0xbaeea07e
-0, 554400, 320, 0xd757c00e
-0, 556200, 320, 0x8aa09783
-0, 558000, 320, 0x31d4ae7a
-0, 559800, 320, 0x221493e8
-0, 561600, 320, 0x92f4a3a7
-0, 563400, 320, 0xbd5bafd9
-0, 565200, 320, 0x1895b760
-0, 567000, 320, 0x7a4eacdd
-0, 568800, 320, 0xc9f7a1c3
-0, 570600, 320, 0xd750be06
-0, 572400, 320, 0x641d9a6f
-0, 574200, 320, 0x70d6b6ff
-0, 576000, 320, 0x1fd3a546
-0, 577800, 320, 0x72cfaabe
-0, 579600, 320, 0x2e61b6ce
-0, 581400, 320, 0x4813a091
-0, 583200, 320, 0xbfe7bc0f
-0, 585000, 320, 0x8c759c1f
-0, 586800, 320, 0xf4c1c952
-0, 588600, 320, 0x00fdaa79
-0, 590400, 320, 0x2ffda252
-0, 592200, 320, 0x841aa523
-0, 594000, 320, 0x8c079e5e
-0, 595800, 320, 0x96e9a83f
-0, 597600, 320, 0x5926a639
-0, 599400, 320, 0x02e1a07b
-0, 601200, 320, 0x2972a999
-0, 603000, 320, 0x30c89c62
-0, 604800, 320, 0x83f5a263
-0, 606600, 320, 0xa3909667
-0, 608400, 320, 0xd5309fd4
-0, 610200, 320, 0x3154a571
-0, 612000, 320, 0x51039a5e
-0, 613800, 320, 0xf167a344
-0, 615600, 320, 0x8e709d7d
-0, 617400, 320, 0x936fa0fd
-0, 619200, 320, 0x024b9e3c
-0, 621000, 320, 0x2ea1aa75
-0, 622800, 320, 0x33f0a2bb
-0, 624600, 320, 0xbf079d2d
-0, 626400, 320, 0x847ba2c8
-0, 628200, 320, 0x37e1a767
-0, 630000, 320, 0xb607acbb
-0, 631800, 320, 0x1288ac6d
-0, 633600, 320, 0xf60e98b3
-0, 635400, 320, 0xc6b5abdd
-0, 637200, 320, 0x7feaa710
-0, 639000, 320, 0x77329fcd
-0, 640800, 320, 0x91a6a715
-0, 642600, 320, 0xd0e99f24
-0, 644400, 320, 0x07089f61
-0, 646200, 320, 0x2bbda900
-0, 648000, 320, 0xad3da0d5
-0, 649800, 320, 0x997ba6d2
-0, 651600, 320, 0xb15b9dcb
-0, 653400, 320, 0x17cea82f
-0, 655200, 320, 0xab51a73e
-0, 657000, 320, 0x77a1abd6
-0, 658800, 320, 0x0bddacad
-0, 660600, 320, 0x43b3bdc4
-0, 662400, 320, 0xefe0a9ba
-0, 664200, 320, 0x8eb4bc2f
-0, 666000, 320, 0x39cdc190
-0, 667800, 320, 0x1ef3baff
-0, 669600, 320, 0x1a6ab7e2
-0, 671400, 320, 0x444ccc69
-0, 673200, 320, 0x05ebb598
-0, 675000, 320, 0x4ac5b0ad
-0, 676800, 320, 0x0ee5ba52
-0, 678600, 320, 0x501d9fa0
-0, 680400, 320, 0x2038a9f4
-0, 682200, 320, 0xa61cb8b3
-0, 684000, 320, 0xdd009777
-0, 685800, 320, 0x2a2db86d
-0, 687600, 320, 0xe9bab3bc
-0, 689400, 320, 0xf7f8a056
-0, 691200, 320, 0x514caf14
-0, 693000, 320, 0xa220b149
-0, 694800, 320, 0xbf7ea183
-0, 696600, 320, 0x1d8dc5c6
-0, 698400, 320, 0x9182a8ea
-0, 700200, 320, 0x31eba026
-0, 702000, 320, 0xcfbcc3df
-0, 703800, 320, 0x3d8cb7ae
-0, 705600, 320, 0xbe39aec0
-0, 707400, 320, 0xd236bf71
-0, 709200, 320, 0x9377b0b2
-0, 711000, 320, 0xb5e6b2df
-0, 712800, 320, 0xa3b9bbce
-0, 714600, 320, 0xa7bda251
-0, 716400, 320, 0xbf9ab162
-0, 718200, 320, 0x6928b9cb
-0, 720000, 320, 0xf5cca209
-0, 721800, 320, 0xfdf4afad
-0, 723600, 320, 0xe7e7c216
-0, 725400, 320, 0x0c5797c6
-0, 727200, 320, 0x66c1a9ca
-0, 729000, 320, 0x6b5ca48d
-0, 730800, 320, 0xec04968a
-0, 732600, 320, 0xaaada691
-0, 734400, 320, 0x77c3a624
-0, 736200, 320, 0xaed9a5d5
-0, 738000, 320, 0x360fac41
-0, 739800, 320, 0xa05ea727
-0, 741600, 320, 0x9f7b9f83
-0, 743400, 320, 0x474bc4c2
-0, 745200, 320, 0xb6078d3b
-0, 747000, 320, 0x8e15a8f9
-0, 748800, 320, 0x7dc7d4a8
-0, 750600, 320, 0x55ceab6b
-0, 752400, 320, 0x982cc94f
-0, 754200, 320, 0x6153948f
-0, 756000, 320, 0x5338c621
-0, 757800, 320, 0x2e2db6e8
-0, 759600, 320, 0x28e3a9c3
-0, 761400, 320, 0x74d7b435
-0, 763200, 320, 0xcf17a10c
-0, 765000, 320, 0xf1f9ac8c
-0, 766800, 320, 0x35e0b480
-0, 768600, 320, 0x5e60b3a4
-0, 770400, 320, 0x20579b26
-0, 772200, 320, 0x3e27b89b
-0, 774000, 320, 0x02e4af94
-0, 775800, 320, 0x6d6897f1
-0, 777600, 320, 0x1582b267
-0, 779400, 320, 0x33ba9eb3
-0, 781200, 320, 0xb6acad7d
-0, 783000, 320, 0x1969a6c2
-0, 784800, 320, 0x363fa350
-0, 786600, 320, 0xae50bf65
-0, 788400, 320, 0x0877a50f
-0, 790200, 320, 0x66e2a42f
-0, 792000, 320, 0x0b0abcb3
-0, 793800, 320, 0x23a9afaa
-0, 795600, 320, 0xc3729b40
-0, 797400, 320, 0xdd3fc7e2
-0, 799200, 320, 0x7e0494af
-0, 801000, 320, 0xcbd096fb
-0, 802800, 320, 0x5d71b303
-0, 804600, 320, 0xeedca04a
-0, 806400, 320, 0x2836a47d
-0, 808200, 320, 0x7237c2a0
-0, 810000, 320, 0x7c009bc0
-0, 811800, 320, 0xc9dcb366
-0, 813600, 320, 0x4993aac8
-0, 815400, 320, 0x05ec9954
-0, 817200, 320, 0xa955bd5c
-0, 819000, 320, 0x9018aea3
-0, 820800, 320, 0x780cca52
-0, 822600, 320, 0x9b8f95f6
-0, 824400, 320, 0xcd7bb178
-0, 826200, 320, 0xfec6b443
-0, 828000, 320, 0xe214abb6
-0, 829800, 320, 0xdcbebb38
-0, 831600, 320, 0xe683a30d
-0, 833400, 320, 0xe4cdb197
-0, 835200, 320, 0xa426c432
-0, 837000, 320, 0x761ba6cc
-0, 838800, 320, 0xcc9aa6aa
-0, 840600, 320, 0x742bd03d
-0, 842400, 320, 0x61d9a511
-0, 844200, 320, 0x3021a4dd
-0, 846000, 320, 0x6970bbc0
-0, 847800, 320, 0x76f5a037
-0, 849600, 320, 0x758d91f2
-0, 851400, 320, 0xe854a2f1
-0, 853200, 320, 0xf994a6f8
-0, 855000, 320, 0x31ebaf40
-0, 856800, 320, 0x24699970
-0, 858600, 320, 0x37dda53e
-0, 860400, 320, 0xa857a752
-0, 862200, 320, 0xc483ad1d
-0, 864000, 320, 0x5966add9
-0, 865800, 320, 0x4dbab89c
-0, 867600, 320, 0x2f0bb0e6
-0, 869400, 320, 0x913aaa88
-0, 871200, 320, 0x245dc1c3
-0, 873000, 320, 0xb085c5ad
-0, 874800, 320, 0x9cf1b0fa
-0, 876600, 320, 0x6887b543
-0, 878400, 320, 0xcad69feb
-0, 880200, 320, 0xc12a8ddb
-0, 882000, 320, 0x01d1bc5a
-0, 883800, 320, 0x3018b7e8
-0, 885600, 320, 0x6431b0ef
-0, 887400, 320, 0x3a53998e
-0, 889200, 320, 0x1c80a6c6
-0, 891000, 320, 0x6639adc5
-0, 892800, 320, 0x92489f9a
-0, 894600, 320, 0x8cafad00
-0, 896400, 320, 0xca0392e1
-0, 898200, 320, 0x30a9ae88
+#tb 0: 1/8000
+0, 0, 0, 160, 320, 0x4c32ab06
+0, 160, 160, 160, 320, 0x2052a4e7
+0, 320, 320, 160, 320, 0xe9aeafca
+0, 480, 480, 160, 320, 0xde83b450
+0, 640, 640, 160, 320, 0x06a6a80e
+0, 800, 800, 160, 320, 0xf6aeb1e2
+0, 960, 960, 160, 320, 0x2623b40c
+0, 1120, 1120, 160, 320, 0x8ec69f25
+0, 1280, 1280, 160, 320, 0xddaaac88
+0, 1440, 1440, 160, 320, 0x9e60b713
+0, 1600, 1600, 160, 320, 0xb738ab30
+0, 1760, 1760, 160, 320, 0xdb4bbb92
+0, 1920, 1920, 160, 320, 0x0370ae8b
+0, 2080, 2080, 160, 320, 0xb611a3fb
+0, 2240, 2240, 160, 320, 0x07ee8e3b
+0, 2400, 2400, 160, 320, 0xdb1ec628
+0, 2560, 2560, 160, 320, 0xd5f1bda2
+0, 2720, 2720, 160, 320, 0xcabb9a9c
+0, 2880, 2880, 160, 320, 0x16c8ad61
+0, 3040, 3040, 160, 320, 0xf76fc25e
+0, 3200, 3200, 160, 320, 0x7118a10d
+0, 3360, 3360, 160, 320, 0x29f9a0db
+0, 3520, 3520, 160, 320, 0x41f2a4ef
+0, 3680, 3680, 160, 320, 0x36dfb231
+0, 3840, 3840, 160, 320, 0xc5399eda
+0, 4000, 4000, 160, 320, 0x17d4b9e0
+0, 4160, 4160, 160, 320, 0x2b5797ac
+0, 4320, 4320, 160, 320, 0x0128c5e7
+0, 4480, 4480, 160, 320, 0xf4f38037
+0, 4640, 4640, 160, 320, 0x77d6b5f2
+0, 4800, 4800, 160, 320, 0xd94a93e0
+0, 4960, 4960, 160, 320, 0x968daae3
+0, 5120, 5120, 160, 320, 0xda5ba0ec
+0, 5280, 5280, 160, 320, 0x316da1ec
+0, 5440, 5440, 160, 320, 0x3a35b2d2
+0, 5600, 5600, 160, 320, 0xca0b988f
+0, 5760, 5760, 160, 320, 0x1295b0b1
+0, 5920, 5920, 160, 320, 0xe121ae72
+0, 6080, 6080, 160, 320, 0x7da7ad43
+0, 6240, 6240, 160, 320, 0x96a49cfe
+0, 6400, 6400, 160, 320, 0x70c2b1de
+0, 6560, 6560, 160, 320, 0x668d88c0
+0, 6720, 6720, 160, 320, 0x5460b5a8
+0, 6880, 6880, 160, 320, 0x6ac78eab
+0, 7040, 7040, 160, 320, 0x0d8dab87
+0, 7200, 7200, 160, 320, 0xe2be94af
+0, 7360, 7360, 160, 320, 0x3487acdc
+0, 7520, 7520, 160, 320, 0x5048955a
+0, 7680, 7680, 160, 320, 0x2ef4ae0d
+0, 7840, 7840, 160, 320, 0xc765b773
+0, 8000, 8000, 160, 320, 0xad96a486
+0, 8160, 8160, 160, 320, 0xb9fdbf1f
+0, 8320, 8320, 160, 320, 0xf26c9ecf
+0, 8480, 8480, 160, 320, 0xbcadb535
+0, 8640, 8640, 160, 320, 0xa8c897bc
+0, 8800, 8800, 160, 320, 0xaa58b520
+0, 8960, 8960, 160, 320, 0xcb48a716
+0, 9120, 9120, 160, 320, 0x4d5da564
+0, 9280, 9280, 160, 320, 0x9809ae28
+0, 9440, 9440, 160, 320, 0x5baeb1e4
+0, 9600, 9600, 160, 320, 0x6a719b63
+0, 9760, 9760, 160, 320, 0xc27d92f0
+0, 9920, 9920, 160, 320, 0x0e9b9fe9
+0, 10080, 10080, 160, 320, 0xbf9d9bf7
+0, 10240, 10240, 160, 320, 0xf35aa64d
+0, 10400, 10400, 160, 320, 0x26449ce8
+0, 10560, 10560, 160, 320, 0x58f4a997
+0, 10720, 10720, 160, 320, 0x155da289
+0, 10880, 10880, 160, 320, 0x63b19a5c
+0, 11040, 11040, 160, 320, 0xe01aad38
+0, 11200, 11200, 160, 320, 0x4e0f9c43
+0, 11360, 11360, 160, 320, 0x9447a284
+0, 11520, 11520, 160, 320, 0xdb36a433
+0, 11680, 11680, 160, 320, 0x799a9b2c
+0, 11840, 11840, 160, 320, 0x1526a162
+0, 12000, 12000, 160, 320, 0x0a4ea140
+0, 12160, 12160, 160, 320, 0xb08f9ed7
+0, 12320, 12320, 160, 320, 0x221bab76
+0, 12480, 12480, 160, 320, 0x4befacf0
+0, 12640, 12640, 160, 320, 0xac489509
+0, 12800, 12800, 160, 320, 0x57a1a5b4
+0, 12960, 12960, 160, 320, 0x81e8ab97
+0, 13120, 13120, 160, 320, 0xc6ada4d6
+0, 13280, 13280, 160, 320, 0x12489975
+0, 13440, 13440, 160, 320, 0x1da59ba9
+0, 13600, 13600, 160, 320, 0xf225ac62
+0, 13760, 13760, 160, 320, 0x8c8e9eab
+0, 13920, 13920, 160, 320, 0x10599dec
+0, 14080, 14080, 160, 320, 0x06c39fa5
+0, 14240, 14240, 160, 320, 0xb0efa3c4
+0, 14400, 14400, 160, 320, 0x72caadab
+0, 14560, 14560, 160, 320, 0xe4619ff0
+0, 14720, 14720, 160, 320, 0x49bca017
+0, 14880, 14880, 160, 320, 0x413f9fbe
+0, 15040, 15040, 160, 320, 0x6eaed0ee
+0, 15200, 15200, 160, 320, 0x27e4b1eb
+0, 15360, 15360, 160, 320, 0x8c42a30f
+0, 15520, 15520, 160, 320, 0x0afaa0f4
+0, 15680, 15680, 160, 320, 0x0f74b76b
+0, 15840, 15840, 160, 320, 0xa9a2b9d5
+0, 16000, 16000, 160, 320, 0xde2a8712
+0, 16160, 16160, 160, 320, 0xcfc8b3a2
+0, 16320, 16320, 160, 320, 0x768cadce
+0, 16480, 16480, 160, 320, 0x3a8a97f1
+0, 16640, 16640, 160, 320, 0x502fa59b
+0, 16800, 16800, 160, 320, 0x4c3e9b0f
+0, 16960, 16960, 160, 320, 0x1cd2b111
+0, 17120, 17120, 160, 320, 0xa845a5a3
+0, 17280, 17280, 160, 320, 0xa6b8b982
+0, 17440, 17440, 160, 320, 0x4d5caab9
+0, 17600, 17600, 160, 320, 0x7993b604
+0, 17760, 17760, 160, 320, 0x8d19b37b
+0, 17920, 17920, 160, 320, 0xbe48adb6
+0, 18080, 18080, 160, 320, 0x7d68ab8e
+0, 18240, 18240, 160, 320, 0xbfffb0e2
+0, 18400, 18400, 160, 320, 0x90b5b7e3
+0, 18560, 18560, 160, 320, 0x9fa1b016
+0, 18720, 18720, 160, 320, 0x70abafc9
+0, 18880, 18880, 160, 320, 0x82cfad9c
+0, 19040, 19040, 160, 320, 0x05f6aa2c
+0, 19200, 19200, 160, 320, 0x511cbb5b
+0, 19360, 19360, 160, 320, 0xd27caaa6
+0, 19520, 19520, 160, 320, 0x781ca481
+0, 19680, 19680, 160, 320, 0x12e9ad1a
+0, 19840, 19840, 160, 320, 0xe46b989d
+0, 20000, 20000, 160, 320, 0x76dbb0a7
+0, 20160, 20160, 160, 320, 0x10eba486
+0, 20320, 20320, 160, 320, 0x2269a7c8
+0, 20480, 20480, 160, 320, 0x084a9c7e
+0, 20640, 20640, 160, 320, 0x84eda891
+0, 20800, 20800, 160, 320, 0x2ef9a639
+0, 20960, 20960, 160, 320, 0x8bb2a0dd
+0, 21120, 21120, 160, 320, 0x47e5a169
+0, 21280, 21280, 160, 320, 0x98faae42
+0, 21440, 21440, 160, 320, 0x81d2aba4
+0, 21600, 21600, 160, 320, 0x5af8bb33
+0, 21760, 21760, 160, 320, 0x331e8d9f
+0, 21920, 21920, 160, 320, 0xd9b0c09a
+0, 22080, 22080, 160, 320, 0xbaf9bfcf
+0, 22240, 22240, 160, 320, 0x54e89ab5
+0, 22400, 22400, 160, 320, 0x1d62c1d2
+0, 22560, 22560, 160, 320, 0xead6b436
+0, 22720, 22720, 160, 320, 0x465f98bc
+0, 22880, 22880, 160, 320, 0xe707a346
+0, 23040, 23040, 160, 320, 0xf66cb1c2
+0, 23200, 23200, 160, 320, 0xcfc89ae6
+0, 23360, 23360, 160, 320, 0x0b10b796
+0, 23520, 23520, 160, 320, 0xb29caf2c
+0, 23680, 23680, 160, 320, 0x0284a9d1
+0, 23840, 23840, 160, 320, 0xb966b5fc
+0, 24000, 24000, 160, 320, 0x2defa630
+0, 24160, 24160, 160, 320, 0xcdcd8ef3
+0, 24320, 24320, 160, 320, 0xa81bba2b
+0, 24480, 24480, 160, 320, 0x6bc0aeb1
+0, 24640, 24640, 160, 320, 0x38d8ac82
+0, 24800, 24800, 160, 320, 0xeb66a865
+0, 24960, 24960, 160, 320, 0x4fff9cd9
+0, 25120, 25120, 160, 320, 0x6819a19b
+0, 25280, 25280, 160, 320, 0xfd7c93ce
+0, 25440, 25440, 160, 320, 0xa7419f63
+0, 25600, 25600, 160, 320, 0x572caacb
+0, 25760, 25760, 160, 320, 0x918fb1de
+0, 25920, 25920, 160, 320, 0x0088a675
+0, 26080, 26080, 160, 320, 0x19229cf7
+0, 26240, 26240, 160, 320, 0x827ea812
+0, 26400, 26400, 160, 320, 0x6c258ef7
+0, 26560, 26560, 160, 320, 0x6a89b8fe
+0, 26720, 26720, 160, 320, 0x166c9ce0
+0, 26880, 26880, 160, 320, 0x68b39db7
+0, 27040, 27040, 160, 320, 0x3d5aa8ec
+0, 27200, 27200, 160, 320, 0x25e09ff3
+0, 27360, 27360, 160, 320, 0x759aa4ce
+0, 27520, 27520, 160, 320, 0xe5aab0ea
+0, 27680, 27680, 160, 320, 0xf0359e9a
+0, 27840, 27840, 160, 320, 0x51199fff
+0, 28000, 28000, 160, 320, 0xb04aa236
+0, 28160, 28160, 160, 320, 0xe09da0e3
+0, 28320, 28320, 160, 320, 0x144f98a9
+0, 28480, 28480, 160, 320, 0x0b4e9f8d
+0, 28640, 28640, 160, 320, 0xbb69a090
+0, 28800, 28800, 160, 320, 0xec6e9b5b
+0, 28960, 28960, 160, 320, 0x4f86a477
+0, 29120, 29120, 160, 320, 0x4a179d04
+0, 29280, 29280, 160, 320, 0x9682a375
+0, 29440, 29440, 160, 320, 0x3c6ba55e
+0, 29600, 29600, 160, 320, 0x50c0ab50
+0, 29760, 29760, 160, 320, 0xe58ea907
+0, 29920, 29920, 160, 320, 0xc5eaa021
+0, 30080, 30080, 160, 320, 0x38859f01
+0, 30240, 30240, 160, 320, 0x73f8a540
+0, 30400, 30400, 160, 320, 0x395da234
+0, 30560, 30560, 160, 320, 0x7f50b144
+0, 30720, 30720, 160, 320, 0x45568ceb
+0, 30880, 30880, 160, 320, 0xd0508dec
+0, 31040, 31040, 160, 320, 0x60aba7e4
+0, 31200, 31200, 160, 320, 0x4b24b15f
+0, 31360, 31360, 160, 320, 0xbfc9afd6
+0, 31520, 31520, 160, 320, 0xf0f2ad49
+0, 31680, 31680, 160, 320, 0xeea0a426
+0, 31840, 31840, 160, 320, 0xff07a7c9
+0, 32000, 32000, 160, 320, 0xce1fc788
+0, 32160, 32160, 160, 320, 0xc074ae9b
+0, 32320, 32320, 160, 320, 0x51649696
+0, 32480, 32480, 160, 320, 0x24399744
+0, 32640, 32640, 160, 320, 0xfb0eb920
+0, 32800, 32800, 160, 320, 0x3bf8af5c
+0, 32960, 32960, 160, 320, 0xeab69ee0
+0, 33120, 33120, 160, 320, 0x182696bb
+0, 33280, 33280, 160, 320, 0x36e6af72
+0, 33440, 33440, 160, 320, 0x48cc9ecc
+0, 33600, 33600, 160, 320, 0xfb3ca7b8
+0, 33760, 33760, 160, 320, 0xe01aa4b4
+0, 33920, 33920, 160, 320, 0x5c6dac8c
+0, 34080, 34080, 160, 320, 0x072fbd93
+0, 34240, 34240, 160, 320, 0xc8899ccc
+0, 34400, 34400, 160, 320, 0xdcc990ac
+0, 34560, 34560, 160, 320, 0x28e0a9d0
+0, 34720, 34720, 160, 320, 0x0cdbaa11
+0, 34880, 34880, 160, 320, 0x8f4ca093
+0, 35040, 35040, 160, 320, 0x7ee79ea9
+0, 35200, 35200, 160, 320, 0xa762b695
+0, 35360, 35360, 160, 320, 0x9af0b5da
+0, 35520, 35520, 160, 320, 0x1f2cb0e7
+0, 35680, 35680, 160, 320, 0x6029b8bb
+0, 35840, 35840, 160, 320, 0xf2f7acec
+0, 36000, 36000, 160, 320, 0xb3e5b5be
+0, 36160, 36160, 160, 320, 0x266ba8a6
+0, 36320, 36320, 160, 320, 0x4ff59296
+0, 36480, 36480, 160, 320, 0x11d1b9ac
+0, 36640, 36640, 160, 320, 0x749197f7
+0, 36800, 36800, 160, 320, 0x8192b517
+0, 36960, 36960, 160, 320, 0xde129dbe
+0, 37120, 37120, 160, 320, 0x85e4a096
+0, 37280, 37280, 160, 320, 0xdebf9182
+0, 37440, 37440, 160, 320, 0x7a4ba0bf
+0, 37600, 37600, 160, 320, 0x55fe9fcd
+0, 37760, 37760, 160, 320, 0xd242adec
+0, 37920, 37920, 160, 320, 0xeaf5b159
+0, 38080, 38080, 160, 320, 0xfcb1a571
+0, 38240, 38240, 160, 320, 0x62fabda0
+0, 38400, 38400, 160, 320, 0x45a9abcc
+0, 38560, 38560, 160, 320, 0x07af974b
+0, 38720, 38720, 160, 320, 0xc2a0b4fd
+0, 38880, 38880, 160, 320, 0xc30abccd
+0, 39040, 39040, 160, 320, 0xd33ca61c
+0, 39200, 39200, 160, 320, 0x3c33d11a
+0, 39360, 39360, 160, 320, 0x9c2ca0ac
+0, 39520, 39520, 160, 320, 0xa5d69777
+0, 39680, 39680, 160, 320, 0xb7d2c6b8
+0, 39840, 39840, 160, 320, 0x34bbaab9
+0, 40000, 40000, 160, 320, 0x3e7baccb
+0, 40160, 40160, 160, 320, 0x92c6b7e6
+0, 40320, 40320, 160, 320, 0xc810a18a
+0, 40480, 40480, 160, 320, 0x06a09f56
+0, 40640, 40640, 160, 320, 0x8804a504
+0, 40800, 40800, 160, 320, 0x783ba7d5
+0, 40960, 40960, 160, 320, 0x24dcada6
+0, 41120, 41120, 160, 320, 0x4af796be
+0, 41280, 41280, 160, 320, 0x1454b19c
+0, 41440, 41440, 160, 320, 0x0ad0a56e
+0, 41600, 41600, 160, 320, 0x8944a44e
+0, 41760, 41760, 160, 320, 0x31069ebd
+0, 41920, 41920, 160, 320, 0x19cb9812
+0, 42080, 42080, 160, 320, 0xac75abe2
+0, 42240, 42240, 160, 320, 0x0162a200
+0, 42400, 42400, 160, 320, 0xa2d7a4b2
+0, 42560, 42560, 160, 320, 0x078ca611
+0, 42720, 42720, 160, 320, 0x0ec39b40
+0, 42880, 42880, 160, 320, 0xe8f794b2
+0, 43040, 43040, 160, 320, 0xc2cfb258
+0, 43200, 43200, 160, 320, 0xe4759061
+0, 43360, 43360, 160, 320, 0xb1b6aea4
+0, 43520, 43520, 160, 320, 0x9bfb96df
+0, 43680, 43680, 160, 320, 0xcc61b5d3
+0, 43840, 43840, 160, 320, 0xd14e8df9
+0, 44000, 44000, 160, 320, 0xd9d5bbf5
+0, 44160, 44160, 160, 320, 0x4d9fa9b0
+0, 44320, 44320, 160, 320, 0xf606abfc
+0, 44480, 44480, 160, 320, 0x720baa19
+0, 44640, 44640, 160, 320, 0x7f7cac49
+0, 44800, 44800, 160, 320, 0xceab9b54
+0, 44960, 44960, 160, 320, 0x645fa70a
+0, 45120, 45120, 160, 320, 0xa081a40f
+0, 45280, 45280, 160, 320, 0x21d78f8c
+0, 45440, 45440, 160, 320, 0xedf3abc6
+0, 45600, 45600, 160, 320, 0x17679637
+0, 45760, 45760, 160, 320, 0x1cb1ae04
+0, 45920, 45920, 160, 320, 0x17cd9f62
+0, 46080, 46080, 160, 320, 0xf4bca3ab
+0, 46240, 46240, 160, 320, 0xb3bd9152
+0, 46400, 46400, 160, 320, 0x4e1e9825
+0, 46560, 46560, 160, 320, 0x037e9a56
+0, 46720, 46720, 160, 320, 0xd7589fcc
+0, 46880, 46880, 160, 320, 0x5f949e90
+0, 47040, 47040, 160, 320, 0xe133a495
+0, 47200, 47200, 160, 320, 0x7cb7a52c
+0, 47360, 47360, 160, 320, 0xb8b29d95
+0, 47520, 47520, 160, 320, 0x01bca472
+0, 47680, 47680, 160, 320, 0xbcc69895
+0, 47840, 47840, 160, 320, 0xabffa0ee
+0, 48000, 48000, 160, 320, 0xe6629eca
+0, 48160, 48160, 160, 320, 0x572da7cd
+0, 48320, 48320, 160, 320, 0x3017972d
+0, 48480, 48480, 160, 320, 0xac4e9c78
+0, 48640, 48640, 160, 320, 0x112f9c45
+0, 48800, 48800, 160, 320, 0x05e9a64d
+0, 48960, 48960, 160, 320, 0x8f7394d4
+0, 49120, 49120, 160, 320, 0xbaeea07e
+0, 49280, 49280, 160, 320, 0xd757c00e
+0, 49440, 49440, 160, 320, 0x8aa09783
+0, 49600, 49600, 160, 320, 0x31d4ae7a
+0, 49760, 49760, 160, 320, 0x221493e8
+0, 49920, 49920, 160, 320, 0x92f4a3a7
+0, 50080, 50080, 160, 320, 0xbd5bafd9
+0, 50240, 50240, 160, 320, 0x1895b760
+0, 50400, 50400, 160, 320, 0x7a4eacdd
+0, 50560, 50560, 160, 320, 0xc9f7a1c3
+0, 50720, 50720, 160, 320, 0xd750be06
+0, 50880, 50880, 160, 320, 0x641d9a6f
+0, 51040, 51040, 160, 320, 0x70d6b6ff
+0, 51200, 51200, 160, 320, 0x1fd3a546
+0, 51360, 51360, 160, 320, 0x72cfaabe
+0, 51520, 51520, 160, 320, 0x2e61b6ce
+0, 51680, 51680, 160, 320, 0x4813a091
+0, 51840, 51840, 160, 320, 0xbfe7bc0f
+0, 52000, 52000, 160, 320, 0x8c759c1f
+0, 52160, 52160, 160, 320, 0xf4c1c952
+0, 52320, 52320, 160, 320, 0x00fdaa79
+0, 52480, 52480, 160, 320, 0x2ffda252
+0, 52640, 52640, 160, 320, 0x841aa523
+0, 52800, 52800, 160, 320, 0x8c079e5e
+0, 52960, 52960, 160, 320, 0x96e9a83f
+0, 53120, 53120, 160, 320, 0x5926a639
+0, 53280, 53280, 160, 320, 0x02e1a07b
+0, 53440, 53440, 160, 320, 0x2972a999
+0, 53600, 53600, 160, 320, 0x30c89c62
+0, 53760, 53760, 160, 320, 0x83f5a263
+0, 53920, 53920, 160, 320, 0xa3909667
+0, 54080, 54080, 160, 320, 0xd5309fd4
+0, 54240, 54240, 160, 320, 0x3154a571
+0, 54400, 54400, 160, 320, 0x51039a5e
+0, 54560, 54560, 160, 320, 0xf167a344
+0, 54720, 54720, 160, 320, 0x8e709d7d
+0, 54880, 54880, 160, 320, 0x936fa0fd
+0, 55040, 55040, 160, 320, 0x024b9e3c
+0, 55200, 55200, 160, 320, 0x2ea1aa75
+0, 55360, 55360, 160, 320, 0x33f0a2bb
+0, 55520, 55520, 160, 320, 0xbf079d2d
+0, 55680, 55680, 160, 320, 0x847ba2c8
+0, 55840, 55840, 160, 320, 0x37e1a767
+0, 56000, 56000, 160, 320, 0xb607acbb
+0, 56160, 56160, 160, 320, 0x1288ac6d
+0, 56320, 56320, 160, 320, 0xf60e98b3
+0, 56480, 56480, 160, 320, 0xc6b5abdd
+0, 56640, 56640, 160, 320, 0x7feaa710
+0, 56800, 56800, 160, 320, 0x77329fcd
+0, 56960, 56960, 160, 320, 0x91a6a715
+0, 57120, 57120, 160, 320, 0xd0e99f24
+0, 57280, 57280, 160, 320, 0x07089f61
+0, 57440, 57440, 160, 320, 0x2bbda900
+0, 57600, 57600, 160, 320, 0xad3da0d5
+0, 57760, 57760, 160, 320, 0x997ba6d2
+0, 57920, 57920, 160, 320, 0xb15b9dcb
+0, 58080, 58080, 160, 320, 0x17cea82f
+0, 58240, 58240, 160, 320, 0xab51a73e
+0, 58400, 58400, 160, 320, 0x77a1abd6
+0, 58560, 58560, 160, 320, 0x0bddacad
+0, 58720, 58720, 160, 320, 0x43b3bdc4
+0, 58880, 58880, 160, 320, 0xefe0a9ba
+0, 59040, 59040, 160, 320, 0x8eb4bc2f
+0, 59200, 59200, 160, 320, 0x39cdc190
+0, 59360, 59360, 160, 320, 0x1ef3baff
+0, 59520, 59520, 160, 320, 0x1a6ab7e2
+0, 59680, 59680, 160, 320, 0x444ccc69
+0, 59840, 59840, 160, 320, 0x05ebb598
+0, 60000, 60000, 160, 320, 0x4ac5b0ad
+0, 60160, 60160, 160, 320, 0x0ee5ba52
+0, 60320, 60320, 160, 320, 0x501d9fa0
+0, 60480, 60480, 160, 320, 0x2038a9f4
+0, 60640, 60640, 160, 320, 0xa61cb8b3
+0, 60800, 60800, 160, 320, 0xdd009777
+0, 60960, 60960, 160, 320, 0x2a2db86d
+0, 61120, 61120, 160, 320, 0xe9bab3bc
+0, 61280, 61280, 160, 320, 0xf7f8a056
+0, 61440, 61440, 160, 320, 0x514caf14
+0, 61600, 61600, 160, 320, 0xa220b149
+0, 61760, 61760, 160, 320, 0xbf7ea183
+0, 61920, 61920, 160, 320, 0x1d8dc5c6
+0, 62080, 62080, 160, 320, 0x9182a8ea
+0, 62240, 62240, 160, 320, 0x31eba026
+0, 62400, 62400, 160, 320, 0xcfbcc3df
+0, 62560, 62560, 160, 320, 0x3d8cb7ae
+0, 62720, 62720, 160, 320, 0xbe39aec0
+0, 62880, 62880, 160, 320, 0xd236bf71
+0, 63040, 63040, 160, 320, 0x9377b0b2
+0, 63200, 63200, 160, 320, 0xb5e6b2df
+0, 63360, 63360, 160, 320, 0xa3b9bbce
+0, 63520, 63520, 160, 320, 0xa7bda251
+0, 63680, 63680, 160, 320, 0xbf9ab162
+0, 63840, 63840, 160, 320, 0x6928b9cb
+0, 64000, 64000, 160, 320, 0xf5cca209
+0, 64160, 64160, 160, 320, 0xfdf4afad
+0, 64320, 64320, 160, 320, 0xe7e7c216
+0, 64480, 64480, 160, 320, 0x0c5797c6
+0, 64640, 64640, 160, 320, 0x66c1a9ca
+0, 64800, 64800, 160, 320, 0x6b5ca48d
+0, 64960, 64960, 160, 320, 0xec04968a
+0, 65120, 65120, 160, 320, 0xaaada691
+0, 65280, 65280, 160, 320, 0x77c3a624
+0, 65440, 65440, 160, 320, 0xaed9a5d5
+0, 65600, 65600, 160, 320, 0x360fac41
+0, 65760, 65760, 160, 320, 0xa05ea727
+0, 65920, 65920, 160, 320, 0x9f7b9f83
+0, 66080, 66080, 160, 320, 0x474bc4c2
+0, 66240, 66240, 160, 320, 0xb6078d3b
+0, 66400, 66400, 160, 320, 0x8e15a8f9
+0, 66560, 66560, 160, 320, 0x7dc7d4a8
+0, 66720, 66720, 160, 320, 0x55ceab6b
+0, 66880, 66880, 160, 320, 0x982cc94f
+0, 67040, 67040, 160, 320, 0x6153948f
+0, 67200, 67200, 160, 320, 0x5338c621
+0, 67360, 67360, 160, 320, 0x2e2db6e8
+0, 67520, 67520, 160, 320, 0x28e3a9c3
+0, 67680, 67680, 160, 320, 0x74d7b435
+0, 67840, 67840, 160, 320, 0xcf17a10c
+0, 68000, 68000, 160, 320, 0xf1f9ac8c
+0, 68160, 68160, 160, 320, 0x35e0b480
+0, 68320, 68320, 160, 320, 0x5e60b3a4
+0, 68480, 68480, 160, 320, 0x20579b26
+0, 68640, 68640, 160, 320, 0x3e27b89b
+0, 68800, 68800, 160, 320, 0x02e4af94
+0, 68960, 68960, 160, 320, 0x6d6897f1
+0, 69120, 69120, 160, 320, 0x1582b267
+0, 69280, 69280, 160, 320, 0x33ba9eb3
+0, 69440, 69440, 160, 320, 0xb6acad7d
+0, 69600, 69600, 160, 320, 0x1969a6c2
+0, 69760, 69760, 160, 320, 0x363fa350
+0, 69920, 69920, 160, 320, 0xae50bf65
+0, 70080, 70080, 160, 320, 0x0877a50f
+0, 70240, 70240, 160, 320, 0x66e2a42f
+0, 70400, 70400, 160, 320, 0x0b0abcb3
+0, 70560, 70560, 160, 320, 0x23a9afaa
+0, 70720, 70720, 160, 320, 0xc3729b40
+0, 70880, 70880, 160, 320, 0xdd3fc7e2
+0, 71040, 71040, 160, 320, 0x7e0494af
+0, 71200, 71200, 160, 320, 0xcbd096fb
+0, 71360, 71360, 160, 320, 0x5d71b303
+0, 71520, 71520, 160, 320, 0xeedca04a
+0, 71680, 71680, 160, 320, 0x2836a47d
+0, 71840, 71840, 160, 320, 0x7237c2a0
+0, 72000, 72000, 160, 320, 0x7c009bc0
+0, 72160, 72160, 160, 320, 0xc9dcb366
+0, 72320, 72320, 160, 320, 0x4993aac8
+0, 72480, 72480, 160, 320, 0x05ec9954
+0, 72640, 72640, 160, 320, 0xa955bd5c
+0, 72800, 72800, 160, 320, 0x9018aea3
+0, 72960, 72960, 160, 320, 0x780cca52
+0, 73120, 73120, 160, 320, 0x9b8f95f6
+0, 73280, 73280, 160, 320, 0xcd7bb178
+0, 73440, 73440, 160, 320, 0xfec6b443
+0, 73600, 73600, 160, 320, 0xe214abb6
+0, 73760, 73760, 160, 320, 0xdcbebb38
+0, 73920, 73920, 160, 320, 0xe683a30d
+0, 74080, 74080, 160, 320, 0xe4cdb197
+0, 74240, 74240, 160, 320, 0xa426c432
+0, 74400, 74400, 160, 320, 0x761ba6cc
+0, 74560, 74560, 160, 320, 0xcc9aa6aa
+0, 74720, 74720, 160, 320, 0x742bd03d
+0, 74880, 74880, 160, 320, 0x61d9a511
+0, 75040, 75040, 160, 320, 0x3021a4dd
+0, 75200, 75200, 160, 320, 0x6970bbc0
+0, 75360, 75360, 160, 320, 0x76f5a037
+0, 75520, 75520, 160, 320, 0x758d91f2
+0, 75680, 75680, 160, 320, 0xe854a2f1
+0, 75840, 75840, 160, 320, 0xf994a6f8
+0, 76000, 76000, 160, 320, 0x31ebaf40
+0, 76160, 76160, 160, 320, 0x24699970
+0, 76320, 76320, 160, 320, 0x37dda53e
+0, 76480, 76480, 160, 320, 0xa857a752
+0, 76640, 76640, 160, 320, 0xc483ad1d
+0, 76800, 76800, 160, 320, 0x5966add9
+0, 76960, 76960, 160, 320, 0x4dbab89c
+0, 77120, 77120, 160, 320, 0x2f0bb0e6
+0, 77280, 77280, 160, 320, 0x913aaa88
+0, 77440, 77440, 160, 320, 0x245dc1c3
+0, 77600, 77600, 160, 320, 0xb085c5ad
+0, 77760, 77760, 160, 320, 0x9cf1b0fa
+0, 77920, 77920, 160, 320, 0x6887b543
+0, 78080, 78080, 160, 320, 0xcad69feb
+0, 78240, 78240, 160, 320, 0xc12a8ddb
+0, 78400, 78400, 160, 320, 0x01d1bc5a
+0, 78560, 78560, 160, 320, 0x3018b7e8
+0, 78720, 78720, 160, 320, 0x6431b0ef
+0, 78880, 78880, 160, 320, 0x3a53998e
+0, 79040, 79040, 160, 320, 0x1c80a6c6
+0, 79200, 79200, 160, 320, 0x6639adc5
+0, 79360, 79360, 160, 320, 0x92489f9a
+0, 79520, 79520, 160, 320, 0x8cafad00
+0, 79680, 79680, 160, 320, 0xca0392e1
+0, 79840, 79840, 160, 320, 0x30a9ae88
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-aud_mw_e b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-aud_mw_e
index 202e14e..83c6fae 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-aud_mw_e
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-aud_mw_e
@@ -1,100 +1,101 @@
-0, 0, 38016, 0xa6d63b2e
-0, 3600, 38016, 0x28bae101
-0, 7200, 38016, 0x139f9b29
-0, 10800, 38016, 0xa7b463e8
-0, 14400, 38016, 0xdcdc5130
-0, 18000, 38016, 0x3cf17039
-0, 21600, 38016, 0xdeeb9ae9
-0, 25200, 38016, 0xdc8da889
-0, 28800, 38016, 0x7a32a81c
-0, 32400, 38016, 0xaf15908b
-0, 36000, 38016, 0x4c8b5461
-0, 39600, 38016, 0x1d4826db
-0, 43200, 38016, 0x5ca72731
-0, 46800, 38016, 0xb09732e6
-0, 50400, 38016, 0xa65252eb
-0, 54000, 38016, 0x09fa7644
-0, 57600, 38016, 0x5262af8f
-0, 61200, 38016, 0x50d6c6ac
-0, 64800, 38016, 0x6895c300
-0, 68400, 38016, 0x2d58bf4f
-0, 72000, 38016, 0x50dfc4c0
-0, 75600, 38016, 0x12d2cb90
-0, 79200, 38016, 0xe465c7d7
-0, 82800, 38016, 0x47c5c615
-0, 86400, 38016, 0x76fdc6e6
-0, 90000, 38016, 0xefeec7ae
-0, 93600, 38016, 0x2cebcdf7
-0, 97200, 38016, 0x49abd265
-0, 100800, 38016, 0x157bdfe4
-0, 104400, 38016, 0x3635e5da
-0, 108000, 38016, 0x6263aace
-0, 111600, 38016, 0x7fff72f0
-0, 115200, 38016, 0x83994b85
-0, 118800, 38016, 0xa8c990a7
-0, 122400, 38016, 0xce5204c4
-0, 126000, 38016, 0xf1176131
-0, 129600, 38016, 0x4252bdca
-0, 133200, 38016, 0xd8f447c3
-0, 136800, 38016, 0xc5e79075
-0, 140400, 38016, 0x5291ca60
-0, 144000, 38016, 0x5dffe889
-0, 147600, 38016, 0x6dc4fad6
-0, 151200, 38016, 0xbcc7f16a
-0, 154800, 38016, 0xcd5c059a
-0, 158400, 38016, 0x452314ad
-0, 162000, 38016, 0x19d1fd99
-0, 165600, 38016, 0x93f4ca3c
-0, 169200, 38016, 0x23dd9d81
-0, 172800, 38016, 0x4a4cabdb
-0, 176400, 38016, 0x15a3d785
-0, 180000, 38016, 0xaa34e055
-0, 183600, 38016, 0x8a34b88d
-0, 187200, 38016, 0x1955d649
-0, 190800, 38016, 0xf6dc0782
-0, 194400, 38016, 0x66cb360a
-0, 198000, 38016, 0xf3615cfb
-0, 201600, 38016, 0xca466b6d
-0, 205200, 38016, 0xe0ad3523
-0, 208800, 38016, 0x8181323e
-0, 212400, 38016, 0x93324bab
-0, 216000, 38016, 0xce2c38b6
-0, 219600, 38016, 0xe50a20fc
-0, 223200, 38016, 0x8a74ce30
-0, 226800, 38016, 0x893ca7d8
-0, 230400, 38016, 0x716fd810
-0, 234000, 38016, 0x352aeb3c
-0, 237600, 38016, 0xdf14e4d1
-0, 241200, 38016, 0x7e87dd42
-0, 244800, 38016, 0xe084c706
-0, 248400, 38016, 0x4000ba1f
-0, 252000, 38016, 0x10679f5a
-0, 255600, 38016, 0x5cb686b2
-0, 259200, 38016, 0x5dea8ffe
-0, 262800, 38016, 0x8bd27fc8
-0, 266400, 38016, 0x72912b15
-0, 270000, 38016, 0xb86be965
-0, 273600, 38016, 0x7a42da39
-0, 277200, 38016, 0x9ddacae0
-0, 280800, 38016, 0xb767ff5b
-0, 284400, 38016, 0xa3c64887
-0, 288000, 38016, 0xbc6981f2
-0, 291600, 38016, 0xc2506c22
-0, 295200, 38016, 0x6e785862
-0, 298800, 38016, 0xfade2b2d
-0, 302400, 38016, 0xada1d917
-0, 306000, 38016, 0x459beba1
-0, 309600, 38016, 0x8b491f3c
-0, 313200, 38016, 0x917b0fab
-0, 316800, 38016, 0x053fb1d2
-0, 320400, 38016, 0x96e44e17
-0, 324000, 38016, 0x4d34f7e0
-0, 327600, 38016, 0x2265c386
-0, 331200, 38016, 0xc45dd284
-0, 334800, 38016, 0x0638fca3
-0, 338400, 38016, 0xcd9c2bbc
-0, 342000, 38016, 0x3220dea3
-0, 345600, 38016, 0x72dfb576
-0, 349200, 38016, 0xb804ee86
-0, 352800, 38016, 0xbd516400
-0, 356400, 38016, 0x737fa296
+#tb 0: 1/25
+0, 0, 0, 1, 38016, 0xa6d63b2e
+0, 1, 1, 1, 38016, 0x28bae101
+0, 2, 2, 1, 38016, 0x139f9b29
+0, 3, 3, 1, 38016, 0xa7b463e8
+0, 4, 4, 1, 38016, 0xdcdc5130
+0, 5, 5, 1, 38016, 0x3cf17039
+0, 6, 6, 1, 38016, 0xdeeb9ae9
+0, 7, 7, 1, 38016, 0xdc8da889
+0, 8, 8, 1, 38016, 0x7a32a81c
+0, 9, 9, 1, 38016, 0xaf15908b
+0, 10, 10, 1, 38016, 0x4c8b5461
+0, 11, 11, 1, 38016, 0x1d4826db
+0, 12, 12, 1, 38016, 0x5ca72731
+0, 13, 13, 1, 38016, 0xb09732e6
+0, 14, 14, 1, 38016, 0xa65252eb
+0, 15, 15, 1, 38016, 0x09fa7644
+0, 16, 16, 1, 38016, 0x5262af8f
+0, 17, 17, 1, 38016, 0x50d6c6ac
+0, 18, 18, 1, 38016, 0x6895c300
+0, 19, 19, 1, 38016, 0x2d58bf4f
+0, 20, 20, 1, 38016, 0x50dfc4c0
+0, 21, 21, 1, 38016, 0x12d2cb90
+0, 22, 22, 1, 38016, 0xe465c7d7
+0, 23, 23, 1, 38016, 0x47c5c615
+0, 24, 24, 1, 38016, 0x76fdc6e6
+0, 25, 25, 1, 38016, 0xefeec7ae
+0, 26, 26, 1, 38016, 0x2cebcdf7
+0, 27, 27, 1, 38016, 0x49abd265
+0, 28, 28, 1, 38016, 0x157bdfe4
+0, 29, 29, 1, 38016, 0x3635e5da
+0, 30, 30, 1, 38016, 0x6263aace
+0, 31, 31, 1, 38016, 0x7fff72f0
+0, 32, 32, 1, 38016, 0x83994b85
+0, 33, 33, 1, 38016, 0xa8c990a7
+0, 34, 34, 1, 38016, 0xce5204c4
+0, 35, 35, 1, 38016, 0xf1176131
+0, 36, 36, 1, 38016, 0x4252bdca
+0, 37, 37, 1, 38016, 0xd8f447c3
+0, 38, 38, 1, 38016, 0xc5e79075
+0, 39, 39, 1, 38016, 0x5291ca60
+0, 40, 40, 1, 38016, 0x5dffe889
+0, 41, 41, 1, 38016, 0x6dc4fad6
+0, 42, 42, 1, 38016, 0xbcc7f16a
+0, 43, 43, 1, 38016, 0xcd5c059a
+0, 44, 44, 1, 38016, 0x452314ad
+0, 45, 45, 1, 38016, 0x19d1fd99
+0, 46, 46, 1, 38016, 0x93f4ca3c
+0, 47, 47, 1, 38016, 0x23dd9d81
+0, 48, 48, 1, 38016, 0x4a4cabdb
+0, 49, 49, 1, 38016, 0x15a3d785
+0, 50, 50, 1, 38016, 0xaa34e055
+0, 51, 51, 1, 38016, 0x8a34b88d
+0, 52, 52, 1, 38016, 0x1955d649
+0, 53, 53, 1, 38016, 0xf6dc0782
+0, 54, 54, 1, 38016, 0x66cb360a
+0, 55, 55, 1, 38016, 0xf3615cfb
+0, 56, 56, 1, 38016, 0xca466b6d
+0, 57, 57, 1, 38016, 0xe0ad3523
+0, 58, 58, 1, 38016, 0x8181323e
+0, 59, 59, 1, 38016, 0x93324bab
+0, 60, 60, 1, 38016, 0xce2c38b6
+0, 61, 61, 1, 38016, 0xe50a20fc
+0, 62, 62, 1, 38016, 0x8a74ce30
+0, 63, 63, 1, 38016, 0x893ca7d8
+0, 64, 64, 1, 38016, 0x716fd810
+0, 65, 65, 1, 38016, 0x352aeb3c
+0, 66, 66, 1, 38016, 0xdf14e4d1
+0, 67, 67, 1, 38016, 0x7e87dd42
+0, 68, 68, 1, 38016, 0xe084c706
+0, 69, 69, 1, 38016, 0x4000ba1f
+0, 70, 70, 1, 38016, 0x10679f5a
+0, 71, 71, 1, 38016, 0x5cb686b2
+0, 72, 72, 1, 38016, 0x5dea8ffe
+0, 73, 73, 1, 38016, 0x8bd27fc8
+0, 74, 74, 1, 38016, 0x72912b15
+0, 75, 75, 1, 38016, 0xb86be965
+0, 76, 76, 1, 38016, 0x7a42da39
+0, 77, 77, 1, 38016, 0x9ddacae0
+0, 78, 78, 1, 38016, 0xb767ff5b
+0, 79, 79, 1, 38016, 0xa3c64887
+0, 80, 80, 1, 38016, 0xbc6981f2
+0, 81, 81, 1, 38016, 0xc2506c22
+0, 82, 82, 1, 38016, 0x6e785862
+0, 83, 83, 1, 38016, 0xfade2b2d
+0, 84, 84, 1, 38016, 0xada1d917
+0, 85, 85, 1, 38016, 0x459beba1
+0, 86, 86, 1, 38016, 0x8b491f3c
+0, 87, 87, 1, 38016, 0x917b0fab
+0, 88, 88, 1, 38016, 0x053fb1d2
+0, 89, 89, 1, 38016, 0x96e44e17
+0, 90, 90, 1, 38016, 0x4d34f7e0
+0, 91, 91, 1, 38016, 0x2265c386
+0, 92, 92, 1, 38016, 0xc45dd284
+0, 93, 93, 1, 38016, 0x0638fca3
+0, 94, 94, 1, 38016, 0xcd9c2bbc
+0, 95, 95, 1, 38016, 0x3220dea3
+0, 96, 96, 1, 38016, 0x72dfb576
+0, 97, 97, 1, 38016, 0xb804ee86
+0, 98, 98, 1, 38016, 0xbd516400
+0, 99, 99, 1, 38016, 0x737fa296
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-ba1_ft_c b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-ba1_ft_c
index e97e05c..9f6bc23 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-ba1_ft_c
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-ba1_ft_c
@@ -1,299 +1,300 @@
-0, 0, 152064, 0xa6f9b2a8
-0, 3600, 152064, 0x936a8ed6
-0, 7200, 152064, 0xa9f47652
-0, 10800, 152064, 0xf53ea804
-0, 14400, 152064, 0xc951304d
-0, 18000, 152064, 0x59b786b9
-0, 21600, 152064, 0x01b3d9e9
-0, 25200, 152064, 0x94db5883
-0, 28800, 152064, 0xef01ce6c
-0, 32400, 152064, 0x18401484
-0, 36000, 152064, 0xf8773e58
-0, 39600, 152064, 0x09d07ae7
-0, 43200, 152064, 0xbbec5291
-0, 46800, 152064, 0x1ddcbb1e
-0, 50400, 152064, 0x51b257f2
-0, 54000, 152064, 0x2e537d43
-0, 57600, 152064, 0xc4d3c391
-0, 61200, 152064, 0xe6d0ed1c
-0, 64800, 152064, 0x99d81859
-0, 68400, 152064, 0xba1c1693
-0, 72000, 152064, 0x60a22321
-0, 75600, 152064, 0xfe000aee
-0, 79200, 152064, 0x3b056f2d
-0, 82800, 152064, 0xf735caf9
-0, 86400, 152064, 0x81b94a66
-0, 90000, 152064, 0x28ad08af
-0, 93600, 152064, 0x69b316f5
-0, 97200, 152064, 0xa90e6480
-0, 100800, 152064, 0x2600a97a
-0, 104400, 152064, 0x28b1e894
-0, 108000, 152064, 0x8caaeb3c
-0, 111600, 152064, 0xeaa3cd5d
-0, 115200, 152064, 0x2aeab842
-0, 118800, 152064, 0x8781b8fe
-0, 122400, 152064, 0xd5829de5
-0, 126000, 152064, 0xd04489cd
-0, 129600, 152064, 0xfe268158
-0, 133200, 152064, 0x43917137
-0, 136800, 152064, 0x99963053
-0, 140400, 152064, 0xe085087d
-0, 144000, 152064, 0x0344f8d3
-0, 147600, 152064, 0xe353b02a
-0, 151200, 152064, 0x3f84816d
-0, 154800, 152064, 0x3c3a8145
-0, 158400, 152064, 0x478caf10
-0, 162000, 152064, 0xdc879176
-0, 165600, 152064, 0x502f3b81
-0, 169200, 152064, 0x49997d1a
-0, 172800, 152064, 0x6375e30f
-0, 176400, 152064, 0x2abd5994
-0, 180000, 152064, 0xa32a06a0
-0, 183600, 152064, 0x9a2aed47
-0, 187200, 152064, 0x1963fa9d
-0, 190800, 152064, 0xa429cc58
-0, 194400, 152064, 0x8f08abca
-0, 198000, 152064, 0xdabe3408
-0, 201600, 152064, 0x5b94b0f1
-0, 205200, 152064, 0xb2565ba5
-0, 208800, 152064, 0x6eaf3500
-0, 212400, 152064, 0x04d79374
-0, 216000, 152064, 0x0a9281d7
-0, 219600, 152064, 0x97bf672b
-0, 223200, 152064, 0x996d0b1a
-0, 226800, 152064, 0xb5c4d52d
-0, 230400, 152064, 0x8ab3897b
-0, 234000, 152064, 0xd3303ae0
-0, 237600, 152064, 0x2c217280
-0, 241200, 152064, 0xcc21c7ff
-0, 244800, 152064, 0xf9ae50ea
-0, 248400, 152064, 0xa8af67a2
-0, 252000, 152064, 0xba2cbf40
-0, 255600, 152064, 0x80364875
-0, 259200, 152064, 0xe7028c24
-0, 262800, 152064, 0x6730636d
-0, 266400, 152064, 0xd5d9bf5f
-0, 270000, 152064, 0x2ec4cf74
-0, 273600, 152064, 0x47c0e7ec
-0, 277200, 152064, 0x0e1741fb
-0, 280800, 152064, 0x4b39d9b6
-0, 284400, 152064, 0x30737f2e
-0, 288000, 152064, 0xce133061
-0, 291600, 152064, 0x3b7ce6b9
-0, 295200, 152064, 0x5b11d100
-0, 298800, 152064, 0x8bd801ca
-0, 302400, 152064, 0x5d322cf6
-0, 306000, 152064, 0xdd47a0a3
-0, 309600, 152064, 0x0e3b3c60
-0, 313200, 152064, 0x8b69ac27
-0, 316800, 152064, 0xef66b267
-0, 320400, 152064, 0x29140655
-0, 324000, 152064, 0x25f6ae5c
-0, 327600, 152064, 0xc1a48b89
-0, 331200, 152064, 0xc3eee9e4
-0, 334800, 152064, 0xec23534a
-0, 338400, 152064, 0x9eed2a2e
-0, 342000, 152064, 0x7e5de8e7
-0, 345600, 152064, 0x8d824e10
-0, 349200, 152064, 0x841ebdc5
-0, 352800, 152064, 0x9bc03542
-0, 356400, 152064, 0xd77d5b14
-0, 360000, 152064, 0x2b4597ed
-0, 363600, 152064, 0xf460a0c5
-0, 367200, 152064, 0x01f58bf9
-0, 370800, 152064, 0xa5cb8dd9
-0, 374400, 152064, 0x12e49e6f
-0, 378000, 152064, 0x6aaac311
-0, 381600, 152064, 0x0ff1d37a
-0, 385200, 152064, 0x0e5ca8ce
-0, 388800, 152064, 0x997c3a1f
-0, 392400, 152064, 0x83c1d64e
-0, 396000, 152064, 0xed2379a3
-0, 399600, 152064, 0xe6b83696
-0, 403200, 152064, 0x1a7c1864
-0, 406800, 152064, 0xb0bcf08e
-0, 410400, 152064, 0x74deb96f
-0, 414000, 152064, 0xe86a9396
-0, 417600, 152064, 0xf78a916b
-0, 421200, 152064, 0x8d35a888
-0, 424800, 152064, 0xb01a956d
-0, 428400, 152064, 0xc8d37b7d
-0, 432000, 152064, 0x903251c9
-0, 435600, 152064, 0x93b819ac
-0, 439200, 152064, 0xb949f48f
-0, 442800, 152064, 0x7dbfeaba
-0, 446400, 152064, 0x951903ae
-0, 450000, 152064, 0x05742b8e
-0, 453600, 152064, 0xb270514a
-0, 457200, 152064, 0xf729867a
-0, 460800, 152064, 0x7e05f652
-0, 464400, 152064, 0x32a99f23
-0, 468000, 152064, 0x57e7394b
-0, 471600, 152064, 0xc0ffc453
-0, 475200, 152064, 0x7b1e79fa
-0, 478800, 152064, 0x90ee1d52
-0, 482400, 152064, 0xaed672a8
-0, 486000, 152064, 0xa253ccc4
-0, 489600, 152064, 0x2d0807f9
-0, 493200, 152064, 0xdc7ec4cc
-0, 496800, 152064, 0x3c624e2e
-0, 500400, 152064, 0xfa4a91dd
-0, 504000, 152064, 0xcaa83992
-0, 507600, 152064, 0x81e5c52d
-0, 511200, 152064, 0x46ab76f8
-0, 514800, 152064, 0x4ab115d8
-0, 518400, 152064, 0x65d8c9d7
-0, 522000, 152064, 0xcb1e16b1
-0, 525600, 152064, 0xb766c029
-0, 529200, 152064, 0x2a49c7c0
-0, 532800, 152064, 0x37f35440
-0, 536400, 152064, 0x33b4940f
-0, 540000, 152064, 0x6b22fb9a
-0, 543600, 152064, 0x785e138a
-0, 547200, 152064, 0xc7a1954a
-0, 550800, 152064, 0x6f325026
-0, 554400, 152064, 0x23d6bf8d
-0, 558000, 152064, 0x8e6f5815
-0, 561600, 152064, 0x434c4770
-0, 565200, 152064, 0x22319908
-0, 568800, 152064, 0xec368ac8
-0, 572400, 152064, 0xc69d7306
-0, 576000, 152064, 0xc10ab1c8
-0, 579600, 152064, 0x2497f329
-0, 583200, 152064, 0x95782b50
-0, 586800, 152064, 0xe0481c57
-0, 590400, 152064, 0xa656f1e6
-0, 594000, 152064, 0x562da8a1
-0, 597600, 152064, 0x21716296
-0, 601200, 152064, 0xb1ffd9de
-0, 604800, 152064, 0x49204932
-0, 608400, 152064, 0x88e1ac93
-0, 612000, 152064, 0x6abb5dfb
-0, 615600, 152064, 0xacdede42
-0, 619200, 152064, 0xca28f448
-0, 622800, 152064, 0x6b7e5e84
-0, 626400, 152064, 0x464d4b58
-0, 630000, 152064, 0xd39620f1
-0, 633600, 152064, 0x67336772
-0, 637200, 152064, 0x6de386c2
-0, 640800, 152064, 0x6d8fbc97
-0, 644400, 152064, 0x09fbc88d
-0, 648000, 152064, 0x08dfa188
-0, 651600, 152064, 0xf3461401
-0, 655200, 152064, 0xdd6d1ce5
-0, 658800, 152064, 0x90182ee8
-0, 662400, 152064, 0xcb7cf9a2
-0, 666000, 152064, 0x237e59bd
-0, 669600, 152064, 0xf2efa664
-0, 673200, 152064, 0x6565d69b
-0, 676800, 152064, 0x321ce6e5
-0, 680400, 152064, 0xc7035cb7
-0, 684000, 152064, 0xbfcf2ecc
-0, 687600, 152064, 0x8a2eb353
-0, 691200, 152064, 0x5224b608
-0, 694800, 152064, 0xc0c51491
-0, 698400, 152064, 0xdeadac32
-0, 702000, 152064, 0x8ffd15fe
-0, 705600, 152064, 0x6a7fda8c
-0, 709200, 152064, 0x32ae6c5a
-0, 712800, 152064, 0x9668d580
-0, 716400, 152064, 0xb10325d6
-0, 720000, 152064, 0x1cfa4e12
-0, 723600, 152064, 0x87cb2dc6
-0, 727200, 152064, 0x03636041
-0, 730800, 152064, 0x266df3d6
-0, 734400, 152064, 0x48cd5b1b
-0, 738000, 152064, 0xf42e4dde
-0, 741600, 152064, 0x63b21de2
-0, 745200, 152064, 0xef377b16
-0, 748800, 152064, 0x540a3c21
-0, 752400, 152064, 0xbc7576a4
-0, 756000, 152064, 0x38508049
-0, 759600, 152064, 0x5c120e6f
-0, 763200, 152064, 0x5f7dae8a
-0, 766800, 152064, 0x84632e15
-0, 770400, 152064, 0xe6200a58
-0, 774000, 152064, 0xeef9c63d
-0, 777600, 152064, 0xe5c60794
-0, 781200, 152064, 0x387849c9
-0, 784800, 152064, 0x165744e6
-0, 788400, 152064, 0xdc9cce84
-0, 792000, 152064, 0xea3604e0
-0, 795600, 152064, 0xaf9f5a76
-0, 799200, 152064, 0x05ee7254
-0, 802800, 152064, 0x62ed20cf
-0, 806400, 152064, 0x6e038a86
-0, 810000, 152064, 0xc782f21c
-0, 813600, 152064, 0x9d214e66
-0, 817200, 152064, 0xd33ad489
-0, 820800, 152064, 0x5b04dd7a
-0, 824400, 152064, 0xaf9a865d
-0, 828000, 152064, 0x9eb4912a
-0, 831600, 152064, 0x677628d8
-0, 835200, 152064, 0x0b15e1b6
-0, 838800, 152064, 0xda66848a
-0, 842400, 152064, 0xd29a27a8
-0, 846000, 152064, 0x2d74c6a2
-0, 849600, 152064, 0xafa69b91
-0, 853200, 152064, 0xf065a24b
-0, 856800, 152064, 0xe9d5fe63
-0, 860400, 152064, 0xe0428668
-0, 864000, 152064, 0x2cfe6235
-0, 867600, 152064, 0x6506229d
-0, 871200, 152064, 0xc8cddb6b
-0, 874800, 152064, 0x1b827b12
-0, 878400, 152064, 0x366af54b
-0, 882000, 152064, 0x810b5998
-0, 885600, 152064, 0x40d8d09e
-0, 889200, 152064, 0xf5bd32c5
-0, 892800, 152064, 0xb7af7607
-0, 896400, 152064, 0x005ac53b
-0, 900000, 152064, 0x1a28f754
-0, 903600, 152064, 0x8e15108e
-0, 907200, 152064, 0xb40515ec
-0, 910800, 152064, 0x43a30620
-0, 914400, 152064, 0x000beec8
-0, 918000, 152064, 0x1f6e9253
-0, 921600, 152064, 0x14695f50
-0, 925200, 152064, 0x056359d6
-0, 928800, 152064, 0xdc4360e5
-0, 932400, 152064, 0x3716abb2
-0, 936000, 152064, 0xee1cff6a
-0, 939600, 152064, 0x7b251ba9
-0, 943200, 152064, 0xe4f81d2e
-0, 946800, 152064, 0x01411136
-0, 950400, 152064, 0xcff2f30a
-0, 954000, 152064, 0xc8bcd80d
-0, 957600, 152064, 0x94e8a397
-0, 961200, 152064, 0x6fd071c8
-0, 964800, 152064, 0xb6145d60
-0, 968400, 152064, 0x593f5f70
-0, 972000, 152064, 0xb5133bb7
-0, 975600, 152064, 0x40ad1ae8
-0, 979200, 152064, 0xedfc0faa
-0, 982800, 152064, 0xa2ab0578
-0, 986400, 152064, 0x3038fb4f
-0, 990000, 152064, 0xdf10fb53
-0, 993600, 152064, 0x6b63ff01
-0, 997200, 152064, 0xb34af6cd
-0, 1000800, 152064, 0xc7e9cfb0
-0, 1004400, 152064, 0x22ffb57c
-0, 1008000, 152064, 0xf429b3eb
-0, 1011600, 152064, 0x3861e0db
-0, 1015200, 152064, 0x166321b7
-0, 1018800, 152064, 0x3058744c
-0, 1022400, 152064, 0x6e1dc37a
-0, 1026000, 152064, 0xef2aee63
-0, 1029600, 152064, 0x1a9c3957
-0, 1033200, 152064, 0x93807ed4
-0, 1036800, 152064, 0x117fcbe1
-0, 1040400, 152064, 0x80502017
-0, 1044000, 152064, 0xba5a3dac
-0, 1047600, 152064, 0x157764f1
-0, 1051200, 152064, 0xc7577daf
-0, 1054800, 152064, 0xe9e8ae69
-0, 1058400, 152064, 0x04f9ddac
-0, 1062000, 152064, 0x90441226
-0, 1065600, 152064, 0xaa594ed2
-0, 1069200, 152064, 0x59258b49
-0, 1072800, 152064, 0x13ec85c6
+#tb 0: 1/25
+0, 0, 0, 1, 152064, 0xa6f9b2a8
+0, 1, 1, 1, 152064, 0x936a8ed6
+0, 2, 2, 1, 152064, 0xa9f47652
+0, 3, 3, 1, 152064, 0xf53ea804
+0, 4, 4, 1, 152064, 0xc951304d
+0, 5, 5, 1, 152064, 0x59b786b9
+0, 6, 6, 1, 152064, 0x01b3d9e9
+0, 7, 7, 1, 152064, 0x94db5883
+0, 8, 8, 1, 152064, 0xef01ce6c
+0, 9, 9, 1, 152064, 0x18401484
+0, 10, 10, 1, 152064, 0xf8773e58
+0, 11, 11, 1, 152064, 0x09d07ae7
+0, 12, 12, 1, 152064, 0xbbec5291
+0, 13, 13, 1, 152064, 0x1ddcbb1e
+0, 14, 14, 1, 152064, 0x51b257f2
+0, 15, 15, 1, 152064, 0x2e537d43
+0, 16, 16, 1, 152064, 0xc4d3c391
+0, 17, 17, 1, 152064, 0xe6d0ed1c
+0, 18, 18, 1, 152064, 0x99d81859
+0, 19, 19, 1, 152064, 0xba1c1693
+0, 20, 20, 1, 152064, 0x60a22321
+0, 21, 21, 1, 152064, 0xfe000aee
+0, 22, 22, 1, 152064, 0x3b056f2d
+0, 23, 23, 1, 152064, 0xf735caf9
+0, 24, 24, 1, 152064, 0x81b94a66
+0, 25, 25, 1, 152064, 0x28ad08af
+0, 26, 26, 1, 152064, 0x69b316f5
+0, 27, 27, 1, 152064, 0xa90e6480
+0, 28, 28, 1, 152064, 0x2600a97a
+0, 29, 29, 1, 152064, 0x28b1e894
+0, 30, 30, 1, 152064, 0x8caaeb3c
+0, 31, 31, 1, 152064, 0xeaa3cd5d
+0, 32, 32, 1, 152064, 0x2aeab842
+0, 33, 33, 1, 152064, 0x8781b8fe
+0, 34, 34, 1, 152064, 0xd5829de5
+0, 35, 35, 1, 152064, 0xd04489cd
+0, 36, 36, 1, 152064, 0xfe268158
+0, 37, 37, 1, 152064, 0x43917137
+0, 38, 38, 1, 152064, 0x99963053
+0, 39, 39, 1, 152064, 0xe085087d
+0, 40, 40, 1, 152064, 0x0344f8d3
+0, 41, 41, 1, 152064, 0xe353b02a
+0, 42, 42, 1, 152064, 0x3f84816d
+0, 43, 43, 1, 152064, 0x3c3a8145
+0, 44, 44, 1, 152064, 0x478caf10
+0, 45, 45, 1, 152064, 0xdc879176
+0, 46, 46, 1, 152064, 0x502f3b81
+0, 47, 47, 1, 152064, 0x49997d1a
+0, 48, 48, 1, 152064, 0x6375e30f
+0, 49, 49, 1, 152064, 0x2abd5994
+0, 50, 50, 1, 152064, 0xa32a06a0
+0, 51, 51, 1, 152064, 0x9a2aed47
+0, 52, 52, 1, 152064, 0x1963fa9d
+0, 53, 53, 1, 152064, 0xa429cc58
+0, 54, 54, 1, 152064, 0x8f08abca
+0, 55, 55, 1, 152064, 0xdabe3408
+0, 56, 56, 1, 152064, 0x5b94b0f1
+0, 57, 57, 1, 152064, 0xb2565ba5
+0, 58, 58, 1, 152064, 0x6eaf3500
+0, 59, 59, 1, 152064, 0x04d79374
+0, 60, 60, 1, 152064, 0x0a9281d7
+0, 61, 61, 1, 152064, 0x97bf672b
+0, 62, 62, 1, 152064, 0x996d0b1a
+0, 63, 63, 1, 152064, 0xb5c4d52d
+0, 64, 64, 1, 152064, 0x8ab3897b
+0, 65, 65, 1, 152064, 0xd3303ae0
+0, 66, 66, 1, 152064, 0x2c217280
+0, 67, 67, 1, 152064, 0xcc21c7ff
+0, 68, 68, 1, 152064, 0xf9ae50ea
+0, 69, 69, 1, 152064, 0xa8af67a2
+0, 70, 70, 1, 152064, 0xba2cbf40
+0, 71, 71, 1, 152064, 0x80364875
+0, 72, 72, 1, 152064, 0xe7028c24
+0, 73, 73, 1, 152064, 0x6730636d
+0, 74, 74, 1, 152064, 0xd5d9bf5f
+0, 75, 75, 1, 152064, 0x2ec4cf74
+0, 76, 76, 1, 152064, 0x47c0e7ec
+0, 77, 77, 1, 152064, 0x0e1741fb
+0, 78, 78, 1, 152064, 0x4b39d9b6
+0, 79, 79, 1, 152064, 0x30737f2e
+0, 80, 80, 1, 152064, 0xce133061
+0, 81, 81, 1, 152064, 0x3b7ce6b9
+0, 82, 82, 1, 152064, 0x5b11d100
+0, 83, 83, 1, 152064, 0x8bd801ca
+0, 84, 84, 1, 152064, 0x5d322cf6
+0, 85, 85, 1, 152064, 0xdd47a0a3
+0, 86, 86, 1, 152064, 0x0e3b3c60
+0, 87, 87, 1, 152064, 0x8b69ac27
+0, 88, 88, 1, 152064, 0xef66b267
+0, 89, 89, 1, 152064, 0x29140655
+0, 90, 90, 1, 152064, 0x25f6ae5c
+0, 91, 91, 1, 152064, 0xc1a48b89
+0, 92, 92, 1, 152064, 0xc3eee9e4
+0, 93, 93, 1, 152064, 0xec23534a
+0, 94, 94, 1, 152064, 0x9eed2a2e
+0, 95, 95, 1, 152064, 0x7e5de8e7
+0, 96, 96, 1, 152064, 0x8d824e10
+0, 97, 97, 1, 152064, 0x841ebdc5
+0, 98, 98, 1, 152064, 0x9bc03542
+0, 99, 99, 1, 152064, 0xd77d5b14
+0, 100, 100, 1, 152064, 0x2b4597ed
+0, 101, 101, 1, 152064, 0xf460a0c5
+0, 102, 102, 1, 152064, 0x01f58bf9
+0, 103, 103, 1, 152064, 0xa5cb8dd9
+0, 104, 104, 1, 152064, 0x12e49e6f
+0, 105, 105, 1, 152064, 0x6aaac311
+0, 106, 106, 1, 152064, 0x0ff1d37a
+0, 107, 107, 1, 152064, 0x0e5ca8ce
+0, 108, 108, 1, 152064, 0x997c3a1f
+0, 109, 109, 1, 152064, 0x83c1d64e
+0, 110, 110, 1, 152064, 0xed2379a3
+0, 111, 111, 1, 152064, 0xe6b83696
+0, 112, 112, 1, 152064, 0x1a7c1864
+0, 113, 113, 1, 152064, 0xb0bcf08e
+0, 114, 114, 1, 152064, 0x74deb96f
+0, 115, 115, 1, 152064, 0xe86a9396
+0, 116, 116, 1, 152064, 0xf78a916b
+0, 117, 117, 1, 152064, 0x8d35a888
+0, 118, 118, 1, 152064, 0xb01a956d
+0, 119, 119, 1, 152064, 0xc8d37b7d
+0, 120, 120, 1, 152064, 0x903251c9
+0, 121, 121, 1, 152064, 0x93b819ac
+0, 122, 122, 1, 152064, 0xb949f48f
+0, 123, 123, 1, 152064, 0x7dbfeaba
+0, 124, 124, 1, 152064, 0x951903ae
+0, 125, 125, 1, 152064, 0x05742b8e
+0, 126, 126, 1, 152064, 0xb270514a
+0, 127, 127, 1, 152064, 0xf729867a
+0, 128, 128, 1, 152064, 0x7e05f652
+0, 129, 129, 1, 152064, 0x32a99f23
+0, 130, 130, 1, 152064, 0x57e7394b
+0, 131, 131, 1, 152064, 0xc0ffc453
+0, 132, 132, 1, 152064, 0x7b1e79fa
+0, 133, 133, 1, 152064, 0x90ee1d52
+0, 134, 134, 1, 152064, 0xaed672a8
+0, 135, 135, 1, 152064, 0xa253ccc4
+0, 136, 136, 1, 152064, 0x2d0807f9
+0, 137, 137, 1, 152064, 0xdc7ec4cc
+0, 138, 138, 1, 152064, 0x3c624e2e
+0, 139, 139, 1, 152064, 0xfa4a91dd
+0, 140, 140, 1, 152064, 0xcaa83992
+0, 141, 141, 1, 152064, 0x81e5c52d
+0, 142, 142, 1, 152064, 0x46ab76f8
+0, 143, 143, 1, 152064, 0x4ab115d8
+0, 144, 144, 1, 152064, 0x65d8c9d7
+0, 145, 145, 1, 152064, 0xcb1e16b1
+0, 146, 146, 1, 152064, 0xb766c029
+0, 147, 147, 1, 152064, 0x2a49c7c0
+0, 148, 148, 1, 152064, 0x37f35440
+0, 149, 149, 1, 152064, 0x33b4940f
+0, 150, 150, 1, 152064, 0x6b22fb9a
+0, 151, 151, 1, 152064, 0x785e138a
+0, 152, 152, 1, 152064, 0xc7a1954a
+0, 153, 153, 1, 152064, 0x6f325026
+0, 154, 154, 1, 152064, 0x23d6bf8d
+0, 155, 155, 1, 152064, 0x8e6f5815
+0, 156, 156, 1, 152064, 0x434c4770
+0, 157, 157, 1, 152064, 0x22319908
+0, 158, 158, 1, 152064, 0xec368ac8
+0, 159, 159, 1, 152064, 0xc69d7306
+0, 160, 160, 1, 152064, 0xc10ab1c8
+0, 161, 161, 1, 152064, 0x2497f329
+0, 162, 162, 1, 152064, 0x95782b50
+0, 163, 163, 1, 152064, 0xe0481c57
+0, 164, 164, 1, 152064, 0xa656f1e6
+0, 165, 165, 1, 152064, 0x562da8a1
+0, 166, 166, 1, 152064, 0x21716296
+0, 167, 167, 1, 152064, 0xb1ffd9de
+0, 168, 168, 1, 152064, 0x49204932
+0, 169, 169, 1, 152064, 0x88e1ac93
+0, 170, 170, 1, 152064, 0x6abb5dfb
+0, 171, 171, 1, 152064, 0xacdede42
+0, 172, 172, 1, 152064, 0xca28f448
+0, 173, 173, 1, 152064, 0x6b7e5e84
+0, 174, 174, 1, 152064, 0x464d4b58
+0, 175, 175, 1, 152064, 0xd39620f1
+0, 176, 176, 1, 152064, 0x67336772
+0, 177, 177, 1, 152064, 0x6de386c2
+0, 178, 178, 1, 152064, 0x6d8fbc97
+0, 179, 179, 1, 152064, 0x09fbc88d
+0, 180, 180, 1, 152064, 0x08dfa188
+0, 181, 181, 1, 152064, 0xf3461401
+0, 182, 182, 1, 152064, 0xdd6d1ce5
+0, 183, 183, 1, 152064, 0x90182ee8
+0, 184, 184, 1, 152064, 0xcb7cf9a2
+0, 185, 185, 1, 152064, 0x237e59bd
+0, 186, 186, 1, 152064, 0xf2efa664
+0, 187, 187, 1, 152064, 0x6565d69b
+0, 188, 188, 1, 152064, 0x321ce6e5
+0, 189, 189, 1, 152064, 0xc7035cb7
+0, 190, 190, 1, 152064, 0xbfcf2ecc
+0, 191, 191, 1, 152064, 0x8a2eb353
+0, 192, 192, 1, 152064, 0x5224b608
+0, 193, 193, 1, 152064, 0xc0c51491
+0, 194, 194, 1, 152064, 0xdeadac32
+0, 195, 195, 1, 152064, 0x8ffd15fe
+0, 196, 196, 1, 152064, 0x6a7fda8c
+0, 197, 197, 1, 152064, 0x32ae6c5a
+0, 198, 198, 1, 152064, 0x9668d580
+0, 199, 199, 1, 152064, 0xb10325d6
+0, 200, 200, 1, 152064, 0x1cfa4e12
+0, 201, 201, 1, 152064, 0x87cb2dc6
+0, 202, 202, 1, 152064, 0x03636041
+0, 203, 203, 1, 152064, 0x266df3d6
+0, 204, 204, 1, 152064, 0x48cd5b1b
+0, 205, 205, 1, 152064, 0xf42e4dde
+0, 206, 206, 1, 152064, 0x63b21de2
+0, 207, 207, 1, 152064, 0xef377b16
+0, 208, 208, 1, 152064, 0x540a3c21
+0, 209, 209, 1, 152064, 0xbc7576a4
+0, 210, 210, 1, 152064, 0x38508049
+0, 211, 211, 1, 152064, 0x5c120e6f
+0, 212, 212, 1, 152064, 0x5f7dae8a
+0, 213, 213, 1, 152064, 0x84632e15
+0, 214, 214, 1, 152064, 0xe6200a58
+0, 215, 215, 1, 152064, 0xeef9c63d
+0, 216, 216, 1, 152064, 0xe5c60794
+0, 217, 217, 1, 152064, 0x387849c9
+0, 218, 218, 1, 152064, 0x165744e6
+0, 219, 219, 1, 152064, 0xdc9cce84
+0, 220, 220, 1, 152064, 0xea3604e0
+0, 221, 221, 1, 152064, 0xaf9f5a76
+0, 222, 222, 1, 152064, 0x05ee7254
+0, 223, 223, 1, 152064, 0x62ed20cf
+0, 224, 224, 1, 152064, 0x6e038a86
+0, 225, 225, 1, 152064, 0xc782f21c
+0, 226, 226, 1, 152064, 0x9d214e66
+0, 227, 227, 1, 152064, 0xd33ad489
+0, 228, 228, 1, 152064, 0x5b04dd7a
+0, 229, 229, 1, 152064, 0xaf9a865d
+0, 230, 230, 1, 152064, 0x9eb4912a
+0, 231, 231, 1, 152064, 0x677628d8
+0, 232, 232, 1, 152064, 0x0b15e1b6
+0, 233, 233, 1, 152064, 0xda66848a
+0, 234, 234, 1, 152064, 0xd29a27a8
+0, 235, 235, 1, 152064, 0x2d74c6a2
+0, 236, 236, 1, 152064, 0xafa69b91
+0, 237, 237, 1, 152064, 0xf065a24b
+0, 238, 238, 1, 152064, 0xe9d5fe63
+0, 239, 239, 1, 152064, 0xe0428668
+0, 240, 240, 1, 152064, 0x2cfe6235
+0, 241, 241, 1, 152064, 0x6506229d
+0, 242, 242, 1, 152064, 0xc8cddb6b
+0, 243, 243, 1, 152064, 0x1b827b12
+0, 244, 244, 1, 152064, 0x366af54b
+0, 245, 245, 1, 152064, 0x810b5998
+0, 246, 246, 1, 152064, 0x40d8d09e
+0, 247, 247, 1, 152064, 0xf5bd32c5
+0, 248, 248, 1, 152064, 0xb7af7607
+0, 249, 249, 1, 152064, 0x005ac53b
+0, 250, 250, 1, 152064, 0x1a28f754
+0, 251, 251, 1, 152064, 0x8e15108e
+0, 252, 252, 1, 152064, 0xb40515ec
+0, 253, 253, 1, 152064, 0x43a30620
+0, 254, 254, 1, 152064, 0x000beec8
+0, 255, 255, 1, 152064, 0x1f6e9253
+0, 256, 256, 1, 152064, 0x14695f50
+0, 257, 257, 1, 152064, 0x056359d6
+0, 258, 258, 1, 152064, 0xdc4360e5
+0, 259, 259, 1, 152064, 0x3716abb2
+0, 260, 260, 1, 152064, 0xee1cff6a
+0, 261, 261, 1, 152064, 0x7b251ba9
+0, 262, 262, 1, 152064, 0xe4f81d2e
+0, 263, 263, 1, 152064, 0x01411136
+0, 264, 264, 1, 152064, 0xcff2f30a
+0, 265, 265, 1, 152064, 0xc8bcd80d
+0, 266, 266, 1, 152064, 0x94e8a397
+0, 267, 267, 1, 152064, 0x6fd071c8
+0, 268, 268, 1, 152064, 0xb6145d60
+0, 269, 269, 1, 152064, 0x593f5f70
+0, 270, 270, 1, 152064, 0xb5133bb7
+0, 271, 271, 1, 152064, 0x40ad1ae8
+0, 272, 272, 1, 152064, 0xedfc0faa
+0, 273, 273, 1, 152064, 0xa2ab0578
+0, 274, 274, 1, 152064, 0x3038fb4f
+0, 275, 275, 1, 152064, 0xdf10fb53
+0, 276, 276, 1, 152064, 0x6b63ff01
+0, 277, 277, 1, 152064, 0xb34af6cd
+0, 278, 278, 1, 152064, 0xc7e9cfb0
+0, 279, 279, 1, 152064, 0x22ffb57c
+0, 280, 280, 1, 152064, 0xf429b3eb
+0, 281, 281, 1, 152064, 0x3861e0db
+0, 282, 282, 1, 152064, 0x166321b7
+0, 283, 283, 1, 152064, 0x3058744c
+0, 284, 284, 1, 152064, 0x6e1dc37a
+0, 285, 285, 1, 152064, 0xef2aee63
+0, 286, 286, 1, 152064, 0x1a9c3957
+0, 287, 287, 1, 152064, 0x93807ed4
+0, 288, 288, 1, 152064, 0x117fcbe1
+0, 289, 289, 1, 152064, 0x80502017
+0, 290, 290, 1, 152064, 0xba5a3dac
+0, 291, 291, 1, 152064, 0x157764f1
+0, 292, 292, 1, 152064, 0xc7577daf
+0, 293, 293, 1, 152064, 0xe9e8ae69
+0, 294, 294, 1, 152064, 0x04f9ddac
+0, 295, 295, 1, 152064, 0x90441226
+0, 296, 296, 1, 152064, 0xaa594ed2
+0, 297, 297, 1, 152064, 0x59258b49
+0, 298, 298, 1, 152064, 0x13ec85c6
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-ba1_sony_d b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-ba1_sony_d
index 9eefa53..b0145cd 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-ba1_sony_d
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-ba1_sony_d
@@ -1,17 +1,18 @@
-0, 0, 38016, 0xb3883478
-0, 3600, 38016, 0x99e1fe60
-0, 7200, 38016, 0x65eace24
-0, 10800, 38016, 0xb2b0a513
-0, 14400, 38016, 0x8af47c64
-0, 18000, 38016, 0xa56670c6
-0, 21600, 38016, 0x11d45ac9
-0, 25200, 38016, 0xcd4e4f18
-0, 28800, 38016, 0x399934b2
-0, 32400, 38016, 0xedd23f7b
-0, 36000, 38016, 0x38c350b9
-0, 39600, 38016, 0xdd937244
-0, 43200, 38016, 0x39c67be6
-0, 46800, 38016, 0xabb7a34d
-0, 50400, 38016, 0x535d971f
-0, 54000, 38016, 0xd41c9cf7
-0, 57600, 38016, 0xfddda183
+#tb 0: 1/25
+0, 0, 0, 1, 38016, 0xb3883478
+0, 1, 1, 1, 38016, 0x99e1fe60
+0, 2, 2, 1, 38016, 0x65eace24
+0, 3, 3, 1, 38016, 0xb2b0a513
+0, 4, 4, 1, 38016, 0x8af47c64
+0, 5, 5, 1, 38016, 0xa56670c6
+0, 6, 6, 1, 38016, 0x11d45ac9
+0, 7, 7, 1, 38016, 0xcd4e4f18
+0, 8, 8, 1, 38016, 0x399934b2
+0, 9, 9, 1, 38016, 0xedd23f7b
+0, 10, 10, 1, 38016, 0x38c350b9
+0, 11, 11, 1, 38016, 0xdd937244
+0, 12, 12, 1, 38016, 0x39c67be6
+0, 13, 13, 1, 38016, 0xabb7a34d
+0, 14, 14, 1, 38016, 0x535d971f
+0, 15, 15, 1, 38016, 0xd41c9cf7
+0, 16, 16, 1, 38016, 0xfddda183
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-ba2_sony_f b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-ba2_sony_f
index 126b6e6..13a6462 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-ba2_sony_f
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-ba2_sony_f
@@ -1,300 +1,301 @@
-0, 0, 38016, 0xb3883478
-0, 3600, 38016, 0x47b90d4b
-0, 7200, 38016, 0x3e99dfcf
-0, 10800, 38016, 0xeb18bb85
-0, 14400, 38016, 0xcf1e9658
-0, 18000, 38016, 0xf01b7bf1
-0, 21600, 38016, 0x92e06ac5
-0, 25200, 38016, 0x8ae35c1f
-0, 28800, 38016, 0x4bda52c8
-0, 32400, 38016, 0xbffe59e5
-0, 36000, 38016, 0x56c96cad
-0, 39600, 38016, 0x8a278da1
-0, 43200, 38016, 0xce6f97d6
-0, 46800, 38016, 0x69edad2e
-0, 50400, 38016, 0x5134a67c
-0, 54000, 38016, 0x1abfb2a1
-0, 57600, 38016, 0x4a37b185
-0, 61200, 38016, 0x5270a90e
-0, 64800, 38016, 0xe28f9d5d
-0, 68400, 38016, 0x3fcc87b0
-0, 72000, 38016, 0x719e6605
-0, 75600, 38016, 0x8b824ca3
-0, 79200, 38016, 0x5f6a3544
-0, 82800, 38016, 0x2ecd2ada
-0, 86400, 38016, 0x5d4f3055
-0, 90000, 38016, 0xc54441d3
-0, 93600, 38016, 0x93f83f2c
-0, 97200, 38016, 0xaa4d46a8
-0, 100800, 38016, 0x7ca45c1f
-0, 104400, 38016, 0x59de7854
-0, 108000, 38016, 0xc8f98709
-0, 111600, 38016, 0x9a199eeb
-0, 115200, 38016, 0xfd82b785
-0, 118800, 38016, 0x319fd17f
-0, 122400, 38016, 0xc6ebd362
-0, 126000, 38016, 0xbd60d5dc
-0, 129600, 38016, 0x6e27d260
-0, 133200, 38016, 0x96b7cf93
-0, 136800, 38016, 0x6787cbcf
-0, 140400, 38016, 0x48dacd76
-0, 144000, 38016, 0xbef1d08e
-0, 147600, 38016, 0xbb1bd9a4
-0, 151200, 38016, 0xa420d63b
-0, 154800, 38016, 0xfa26d0ab
-0, 158400, 38016, 0xa349d2e0
-0, 162000, 38016, 0x9946ce09
-0, 165600, 38016, 0xb101cabe
-0, 169200, 38016, 0x9e18c6b2
-0, 172800, 38016, 0xe7cccbd9
-0, 176400, 38016, 0x1067d145
-0, 180000, 38016, 0xae13cd75
-0, 183600, 38016, 0x8e06cce5
-0, 187200, 38016, 0x0b3dcbf8
-0, 190800, 38016, 0xc6cbcfbe
-0, 194400, 38016, 0x1eced2f7
-0, 198000, 38016, 0x5d72da04
-0, 201600, 38016, 0x0643e191
-0, 205200, 38016, 0x3cace7f7
-0, 208800, 38016, 0x5e31f1f0
-0, 212400, 38016, 0x04d1ef46
-0, 216000, 38016, 0xffdbe794
-0, 219600, 38016, 0x106ad275
-0, 223200, 38016, 0x5c64a147
-0, 226800, 38016, 0xb7676212
-0, 230400, 38016, 0x86ea653e
-0, 234000, 38016, 0xabb48937
-0, 237600, 38016, 0x6b1cadc4
-0, 241200, 38016, 0xa4eaf34b
-0, 244800, 38016, 0x4174280f
-0, 248400, 38016, 0xfe845818
-0, 252000, 38016, 0xc64a838e
-0, 255600, 38016, 0x5e24aaf0
-0, 259200, 38016, 0x8bffd9d8
-0, 262800, 38016, 0x00d912c9
-0, 266400, 38016, 0x0dba50f0
-0, 270000, 38016, 0x80958628
-0, 273600, 38016, 0x4e81a356
-0, 277200, 38016, 0x121dc289
-0, 280800, 38016, 0x4885de6f
-0, 284400, 38016, 0x5329e4f9
-0, 288000, 38016, 0xa129ef6b
-0, 291600, 38016, 0x3ea6fd46
-0, 295200, 38016, 0x9a68fbb4
-0, 298800, 38016, 0xea1dffdd
-0, 302400, 38016, 0x7bf9f719
-0, 306000, 38016, 0x9aa5ff2a
-0, 309600, 38016, 0xf050fe90
-0, 313200, 38016, 0xb6f50938
-0, 316800, 38016, 0xbe900b57
-0, 320400, 38016, 0x27b90a6b
-0, 324000, 38016, 0xe87bf703
-0, 327600, 38016, 0xaf0fdbe1
-0, 331200, 38016, 0x3f2cc304
-0, 334800, 38016, 0x0114b42f
-0, 338400, 38016, 0x7f739915
-0, 342000, 38016, 0xcc3da414
-0, 345600, 38016, 0x57e2afe8
-0, 349200, 38016, 0x59b6bdc5
-0, 352800, 38016, 0xb3eacf6a
-0, 356400, 38016, 0xa10ddcd8
-0, 360000, 38016, 0xae05e697
-0, 363600, 38016, 0x8cb9d81c
-0, 367200, 38016, 0x5d5cc3b1
-0, 370800, 38016, 0x8f89c0c0
-0, 374400, 38016, 0x593cda26
-0, 378000, 38016, 0xd5d1f2fc
-0, 381600, 38016, 0x2586ff00
-0, 385200, 38016, 0x1c2613f0
-0, 388800, 38016, 0x236133bd
-0, 392400, 38016, 0x92c5439b
-0, 396000, 38016, 0xd1145724
-0, 399600, 38016, 0xf2fa5c12
-0, 403200, 38016, 0x810d5f50
-0, 406800, 38016, 0x196f4470
-0, 410400, 38016, 0xcba71d6b
-0, 414000, 38016, 0x58ab17b0
-0, 417600, 38016, 0x4a96278d
-0, 421200, 38016, 0x4afe2f7d
-0, 424800, 38016, 0xe1ca3d55
-0, 428400, 38016, 0x4f6844ab
-0, 432000, 38016, 0x7ad24bc5
-0, 435600, 38016, 0x068c49f0
-0, 439200, 38016, 0x23b92dae
-0, 442800, 38016, 0x0e9a0793
-0, 446400, 38016, 0xc1d2dd4a
-0, 450000, 38016, 0x1b5cbc00
-0, 453600, 38016, 0xa951b88d
-0, 457200, 38016, 0x8b4ac1df
-0, 460800, 38016, 0x91d3d98d
-0, 464400, 38016, 0xa42aeb49
-0, 468000, 38016, 0x21b5f1f6
-0, 471600, 38016, 0xd632f07f
-0, 475200, 38016, 0x6566ec26
-0, 478800, 38016, 0x03f4ee70
-0, 482400, 38016, 0x62b6e999
-0, 486000, 38016, 0xfd1de6fb
-0, 489600, 38016, 0xb07bdc79
-0, 493200, 38016, 0xace9d441
-0, 496800, 38016, 0x7d98c788
-0, 500400, 38016, 0x3c7dbae4
-0, 504000, 38016, 0x6e85b20f
-0, 507600, 38016, 0x86a5a6bc
-0, 511200, 38016, 0xacbe93ca
-0, 514800, 38016, 0x8e438bde
-0, 518400, 38016, 0x88b4963d
-0, 522000, 38016, 0x86119504
-0, 525600, 38016, 0x0ccc8932
-0, 529200, 38016, 0x69a45f01
-0, 532800, 38016, 0x8f173148
-0, 536400, 38016, 0x1e320daf
-0, 540000, 38016, 0x3957e834
-0, 543600, 38016, 0x57c1dcee
-0, 547200, 38016, 0x2a9edf52
-0, 550800, 38016, 0x116ed4bc
-0, 554400, 38016, 0x81cfc686
-0, 558000, 38016, 0x6685db47
-0, 561600, 38016, 0xab79fd2f
-0, 565200, 38016, 0x65201bdd
-0, 568800, 38016, 0x06e64eb6
-0, 572400, 38016, 0xbcb77ac0
-0, 576000, 38016, 0x65679028
-0, 579600, 38016, 0xf33e837e
-0, 583200, 38016, 0xa77d7b6c
-0, 586800, 38016, 0x0e7b64f6
-0, 590400, 38016, 0x2d1f597c
-0, 594000, 38016, 0x1b6748a1
-0, 597600, 38016, 0x12a91f4f
-0, 601200, 38016, 0xc09df3ee
-0, 604800, 38016, 0x1b9dcd6f
-0, 608400, 38016, 0xf3c2bce4
-0, 612000, 38016, 0xfe05d34b
-0, 615600, 38016, 0x421deb25
-0, 619200, 38016, 0x0f8d0725
-0, 622800, 38016, 0xa03d0a3d
-0, 626400, 38016, 0xe00cf88f
-0, 630000, 38016, 0xa55abfdf
-0, 633600, 38016, 0x11618891
-0, 637200, 38016, 0x45835caf
-0, 640800, 38016, 0x7be63a3b
-0, 644400, 38016, 0x1ebb2104
-0, 648000, 38016, 0x055b0b26
-0, 651600, 38016, 0x076ef47e
-0, 655200, 38016, 0xa828e6e1
-0, 658800, 38016, 0x0de5eb60
-0, 662400, 38016, 0x5238f229
-0, 666000, 38016, 0x332cff7c
-0, 669600, 38016, 0x74072063
-0, 673200, 38016, 0x1e623ceb
-0, 676800, 38016, 0xad2448c9
-0, 680400, 38016, 0x32065043
-0, 684000, 38016, 0x2e7ff976
-0, 687600, 38016, 0xf1a8c805
-0, 691200, 38016, 0x3f64d1cc
-0, 694800, 38016, 0xc855efbd
-0, 698400, 38016, 0x152b0fed
-0, 702000, 38016, 0x43335881
-0, 705600, 38016, 0xec5c7979
-0, 709200, 38016, 0x150e9488
-0, 712800, 38016, 0x1a63b67a
-0, 716400, 38016, 0x24a4cca6
-0, 720000, 38016, 0x3838dba2
-0, 723600, 38016, 0xef1bec71
-0, 727200, 38016, 0x0478f12a
-0, 730800, 38016, 0x478fee17
-0, 734400, 38016, 0x1d09f0ac
-0, 738000, 38016, 0x3daef591
-0, 741600, 38016, 0xf7f3033c
-0, 745200, 38016, 0xfb09faa0
-0, 748800, 38016, 0xd87de6c9
-0, 752400, 38016, 0xbd99d6bc
-0, 756000, 38016, 0x87d8bd7d
-0, 759600, 38016, 0xf244b18a
-0, 763200, 38016, 0x3a34a2da
-0, 766800, 38016, 0x25739701
-0, 770400, 38016, 0x346b8b9a
-0, 774000, 38016, 0xc67379ec
-0, 777600, 38016, 0xbd30780d
-0, 781200, 38016, 0xc5197c2b
-0, 784800, 38016, 0xd5ce73e8
-0, 788400, 38016, 0x63ce72d1
-0, 792000, 38016, 0x140d688d
-0, 795600, 38016, 0x027158aa
-0, 799200, 38016, 0x90884ce3
-0, 802800, 38016, 0x4faa38c5
-0, 806400, 38016, 0x78693f54
-0, 810000, 38016, 0xe1fa41c1
-0, 813600, 38016, 0x9b524771
-0, 817200, 38016, 0xbb3056c8
-0, 820800, 38016, 0xa93b67df
-0, 824400, 38016, 0xe661909f
-0, 828000, 38016, 0x55a0af6d
-0, 831600, 38016, 0xa5f6d0a8
-0, 835200, 38016, 0xa44300f8
-0, 838800, 38016, 0xc7cc265e
-0, 842400, 38016, 0xe7384598
-0, 846000, 38016, 0x77e4589a
-0, 849600, 38016, 0x073c7054
-0, 853200, 38016, 0xe50e6ea8
-0, 856800, 38016, 0xcedf518f
-0, 860400, 38016, 0x8674266b
-0, 864000, 38016, 0x360e0517
-0, 867600, 38016, 0x19acdb3a
-0, 871200, 38016, 0xd029d91b
-0, 874800, 38016, 0x3101277f
-0, 878400, 38016, 0x3a919153
-0, 882000, 38016, 0x0646ffaf
-0, 885600, 38016, 0xffdd13a5
-0, 889200, 38016, 0x13e2e641
-0, 892800, 38016, 0xc6f6a13b
-0, 896400, 38016, 0x984f2ecd
-0, 900000, 38016, 0xafaec63a
-0, 903600, 38016, 0x9025817a
-0, 907200, 38016, 0x20d574d7
-0, 910800, 38016, 0x72eacc49
-0, 914400, 38016, 0x6297335a
-0, 918000, 38016, 0xc69adba1
-0, 921600, 38016, 0x7852d515
-0, 925200, 38016, 0x0e846003
-0, 928800, 38016, 0xeb294c5e
-0, 932400, 38016, 0x0913448f
-0, 936000, 38016, 0xea2c4fc1
-0, 939600, 38016, 0xb8165b3f
-0, 943200, 38016, 0x5f596c9d
-0, 946800, 38016, 0x3a1370d1
-0, 950400, 38016, 0x25dd6a9a
-0, 954000, 38016, 0x70075f7a
-0, 957600, 38016, 0xaf6749f0
-0, 961200, 38016, 0xd5c22d02
-0, 964800, 38016, 0xf6e80af2
-0, 968400, 38016, 0x42d1dcf7
-0, 972000, 38016, 0x232cb536
-0, 975600, 38016, 0x7c848ebf
-0, 979200, 38016, 0x4c756c28
-0, 982800, 38016, 0x720e1f07
-0, 986400, 38016, 0x2385ccb2
-0, 990000, 38016, 0xcd97bf76
-0, 993600, 38016, 0xebcad10b
-0, 997200, 38016, 0xbed8ceeb
-0, 1000800, 38016, 0x660ffaf8
-0, 1004400, 38016, 0x6a1662a9
-0, 1008000, 38016, 0x71f20775
-0, 1011600, 38016, 0x597ecf26
-0, 1015200, 38016, 0x7a81a050
-0, 1018800, 38016, 0x05f6676a
-0, 1022400, 38016, 0xd0065042
-0, 1026000, 38016, 0x17ca9cd9
-0, 1029600, 38016, 0x76956633
-0, 1033200, 38016, 0x9211a2b0
-0, 1036800, 38016, 0xc134b304
-0, 1040400, 38016, 0xdaca9260
-0, 1044000, 38016, 0x10252d19
-0, 1047600, 38016, 0xf52a44af
-0, 1051200, 38016, 0x4053d2d1
-0, 1054800, 38016, 0x165e0bed
-0, 1058400, 38016, 0x577352d0
-0, 1062000, 38016, 0xf9564a09
-0, 1065600, 38016, 0x78a8295f
-0, 1069200, 38016, 0xb2d7182a
-0, 1072800, 38016, 0x9a0c2487
-0, 1076400, 38016, 0x1b044efa
+#tb 0: 1/25
+0, 0, 0, 1, 38016, 0xb3883478
+0, 1, 1, 1, 38016, 0x47b90d4b
+0, 2, 2, 1, 38016, 0x3e99dfcf
+0, 3, 3, 1, 38016, 0xeb18bb85
+0, 4, 4, 1, 38016, 0xcf1e9658
+0, 5, 5, 1, 38016, 0xf01b7bf1
+0, 6, 6, 1, 38016, 0x92e06ac5
+0, 7, 7, 1, 38016, 0x8ae35c1f
+0, 8, 8, 1, 38016, 0x4bda52c8
+0, 9, 9, 1, 38016, 0xbffe59e5
+0, 10, 10, 1, 38016, 0x56c96cad
+0, 11, 11, 1, 38016, 0x8a278da1
+0, 12, 12, 1, 38016, 0xce6f97d6
+0, 13, 13, 1, 38016, 0x69edad2e
+0, 14, 14, 1, 38016, 0x5134a67c
+0, 15, 15, 1, 38016, 0x1abfb2a1
+0, 16, 16, 1, 38016, 0x4a37b185
+0, 17, 17, 1, 38016, 0x5270a90e
+0, 18, 18, 1, 38016, 0xe28f9d5d
+0, 19, 19, 1, 38016, 0x3fcc87b0
+0, 20, 20, 1, 38016, 0x719e6605
+0, 21, 21, 1, 38016, 0x8b824ca3
+0, 22, 22, 1, 38016, 0x5f6a3544
+0, 23, 23, 1, 38016, 0x2ecd2ada
+0, 24, 24, 1, 38016, 0x5d4f3055
+0, 25, 25, 1, 38016, 0xc54441d3
+0, 26, 26, 1, 38016, 0x93f83f2c
+0, 27, 27, 1, 38016, 0xaa4d46a8
+0, 28, 28, 1, 38016, 0x7ca45c1f
+0, 29, 29, 1, 38016, 0x59de7854
+0, 30, 30, 1, 38016, 0xc8f98709
+0, 31, 31, 1, 38016, 0x9a199eeb
+0, 32, 32, 1, 38016, 0xfd82b785
+0, 33, 33, 1, 38016, 0x319fd17f
+0, 34, 34, 1, 38016, 0xc6ebd362
+0, 35, 35, 1, 38016, 0xbd60d5dc
+0, 36, 36, 1, 38016, 0x6e27d260
+0, 37, 37, 1, 38016, 0x96b7cf93
+0, 38, 38, 1, 38016, 0x6787cbcf
+0, 39, 39, 1, 38016, 0x48dacd76
+0, 40, 40, 1, 38016, 0xbef1d08e
+0, 41, 41, 1, 38016, 0xbb1bd9a4
+0, 42, 42, 1, 38016, 0xa420d63b
+0, 43, 43, 1, 38016, 0xfa26d0ab
+0, 44, 44, 1, 38016, 0xa349d2e0
+0, 45, 45, 1, 38016, 0x9946ce09
+0, 46, 46, 1, 38016, 0xb101cabe
+0, 47, 47, 1, 38016, 0x9e18c6b2
+0, 48, 48, 1, 38016, 0xe7cccbd9
+0, 49, 49, 1, 38016, 0x1067d145
+0, 50, 50, 1, 38016, 0xae13cd75
+0, 51, 51, 1, 38016, 0x8e06cce5
+0, 52, 52, 1, 38016, 0x0b3dcbf8
+0, 53, 53, 1, 38016, 0xc6cbcfbe
+0, 54, 54, 1, 38016, 0x1eced2f7
+0, 55, 55, 1, 38016, 0x5d72da04
+0, 56, 56, 1, 38016, 0x0643e191
+0, 57, 57, 1, 38016, 0x3cace7f7
+0, 58, 58, 1, 38016, 0x5e31f1f0
+0, 59, 59, 1, 38016, 0x04d1ef46
+0, 60, 60, 1, 38016, 0xffdbe794
+0, 61, 61, 1, 38016, 0x106ad275
+0, 62, 62, 1, 38016, 0x5c64a147
+0, 63, 63, 1, 38016, 0xb7676212
+0, 64, 64, 1, 38016, 0x86ea653e
+0, 65, 65, 1, 38016, 0xabb48937
+0, 66, 66, 1, 38016, 0x6b1cadc4
+0, 67, 67, 1, 38016, 0xa4eaf34b
+0, 68, 68, 1, 38016, 0x4174280f
+0, 69, 69, 1, 38016, 0xfe845818
+0, 70, 70, 1, 38016, 0xc64a838e
+0, 71, 71, 1, 38016, 0x5e24aaf0
+0, 72, 72, 1, 38016, 0x8bffd9d8
+0, 73, 73, 1, 38016, 0x00d912c9
+0, 74, 74, 1, 38016, 0x0dba50f0
+0, 75, 75, 1, 38016, 0x80958628
+0, 76, 76, 1, 38016, 0x4e81a356
+0, 77, 77, 1, 38016, 0x121dc289
+0, 78, 78, 1, 38016, 0x4885de6f
+0, 79, 79, 1, 38016, 0x5329e4f9
+0, 80, 80, 1, 38016, 0xa129ef6b
+0, 81, 81, 1, 38016, 0x3ea6fd46
+0, 82, 82, 1, 38016, 0x9a68fbb4
+0, 83, 83, 1, 38016, 0xea1dffdd
+0, 84, 84, 1, 38016, 0x7bf9f719
+0, 85, 85, 1, 38016, 0x9aa5ff2a
+0, 86, 86, 1, 38016, 0xf050fe90
+0, 87, 87, 1, 38016, 0xb6f50938
+0, 88, 88, 1, 38016, 0xbe900b57
+0, 89, 89, 1, 38016, 0x27b90a6b
+0, 90, 90, 1, 38016, 0xe87bf703
+0, 91, 91, 1, 38016, 0xaf0fdbe1
+0, 92, 92, 1, 38016, 0x3f2cc304
+0, 93, 93, 1, 38016, 0x0114b42f
+0, 94, 94, 1, 38016, 0x7f739915
+0, 95, 95, 1, 38016, 0xcc3da414
+0, 96, 96, 1, 38016, 0x57e2afe8
+0, 97, 97, 1, 38016, 0x59b6bdc5
+0, 98, 98, 1, 38016, 0xb3eacf6a
+0, 99, 99, 1, 38016, 0xa10ddcd8
+0, 100, 100, 1, 38016, 0xae05e697
+0, 101, 101, 1, 38016, 0x8cb9d81c
+0, 102, 102, 1, 38016, 0x5d5cc3b1
+0, 103, 103, 1, 38016, 0x8f89c0c0
+0, 104, 104, 1, 38016, 0x593cda26
+0, 105, 105, 1, 38016, 0xd5d1f2fc
+0, 106, 106, 1, 38016, 0x2586ff00
+0, 107, 107, 1, 38016, 0x1c2613f0
+0, 108, 108, 1, 38016, 0x236133bd
+0, 109, 109, 1, 38016, 0x92c5439b
+0, 110, 110, 1, 38016, 0xd1145724
+0, 111, 111, 1, 38016, 0xf2fa5c12
+0, 112, 112, 1, 38016, 0x810d5f50
+0, 113, 113, 1, 38016, 0x196f4470
+0, 114, 114, 1, 38016, 0xcba71d6b
+0, 115, 115, 1, 38016, 0x58ab17b0
+0, 116, 116, 1, 38016, 0x4a96278d
+0, 117, 117, 1, 38016, 0x4afe2f7d
+0, 118, 118, 1, 38016, 0xe1ca3d55
+0, 119, 119, 1, 38016, 0x4f6844ab
+0, 120, 120, 1, 38016, 0x7ad24bc5
+0, 121, 121, 1, 38016, 0x068c49f0
+0, 122, 122, 1, 38016, 0x23b92dae
+0, 123, 123, 1, 38016, 0x0e9a0793
+0, 124, 124, 1, 38016, 0xc1d2dd4a
+0, 125, 125, 1, 38016, 0x1b5cbc00
+0, 126, 126, 1, 38016, 0xa951b88d
+0, 127, 127, 1, 38016, 0x8b4ac1df
+0, 128, 128, 1, 38016, 0x91d3d98d
+0, 129, 129, 1, 38016, 0xa42aeb49
+0, 130, 130, 1, 38016, 0x21b5f1f6
+0, 131, 131, 1, 38016, 0xd632f07f
+0, 132, 132, 1, 38016, 0x6566ec26
+0, 133, 133, 1, 38016, 0x03f4ee70
+0, 134, 134, 1, 38016, 0x62b6e999
+0, 135, 135, 1, 38016, 0xfd1de6fb
+0, 136, 136, 1, 38016, 0xb07bdc79
+0, 137, 137, 1, 38016, 0xace9d441
+0, 138, 138, 1, 38016, 0x7d98c788
+0, 139, 139, 1, 38016, 0x3c7dbae4
+0, 140, 140, 1, 38016, 0x6e85b20f
+0, 141, 141, 1, 38016, 0x86a5a6bc
+0, 142, 142, 1, 38016, 0xacbe93ca
+0, 143, 143, 1, 38016, 0x8e438bde
+0, 144, 144, 1, 38016, 0x88b4963d
+0, 145, 145, 1, 38016, 0x86119504
+0, 146, 146, 1, 38016, 0x0ccc8932
+0, 147, 147, 1, 38016, 0x69a45f01
+0, 148, 148, 1, 38016, 0x8f173148
+0, 149, 149, 1, 38016, 0x1e320daf
+0, 150, 150, 1, 38016, 0x3957e834
+0, 151, 151, 1, 38016, 0x57c1dcee
+0, 152, 152, 1, 38016, 0x2a9edf52
+0, 153, 153, 1, 38016, 0x116ed4bc
+0, 154, 154, 1, 38016, 0x81cfc686
+0, 155, 155, 1, 38016, 0x6685db47
+0, 156, 156, 1, 38016, 0xab79fd2f
+0, 157, 157, 1, 38016, 0x65201bdd
+0, 158, 158, 1, 38016, 0x06e64eb6
+0, 159, 159, 1, 38016, 0xbcb77ac0
+0, 160, 160, 1, 38016, 0x65679028
+0, 161, 161, 1, 38016, 0xf33e837e
+0, 162, 162, 1, 38016, 0xa77d7b6c
+0, 163, 163, 1, 38016, 0x0e7b64f6
+0, 164, 164, 1, 38016, 0x2d1f597c
+0, 165, 165, 1, 38016, 0x1b6748a1
+0, 166, 166, 1, 38016, 0x12a91f4f
+0, 167, 167, 1, 38016, 0xc09df3ee
+0, 168, 168, 1, 38016, 0x1b9dcd6f
+0, 169, 169, 1, 38016, 0xf3c2bce4
+0, 170, 170, 1, 38016, 0xfe05d34b
+0, 171, 171, 1, 38016, 0x421deb25
+0, 172, 172, 1, 38016, 0x0f8d0725
+0, 173, 173, 1, 38016, 0xa03d0a3d
+0, 174, 174, 1, 38016, 0xe00cf88f
+0, 175, 175, 1, 38016, 0xa55abfdf
+0, 176, 176, 1, 38016, 0x11618891
+0, 177, 177, 1, 38016, 0x45835caf
+0, 178, 178, 1, 38016, 0x7be63a3b
+0, 179, 179, 1, 38016, 0x1ebb2104
+0, 180, 180, 1, 38016, 0x055b0b26
+0, 181, 181, 1, 38016, 0x076ef47e
+0, 182, 182, 1, 38016, 0xa828e6e1
+0, 183, 183, 1, 38016, 0x0de5eb60
+0, 184, 184, 1, 38016, 0x5238f229
+0, 185, 185, 1, 38016, 0x332cff7c
+0, 186, 186, 1, 38016, 0x74072063
+0, 187, 187, 1, 38016, 0x1e623ceb
+0, 188, 188, 1, 38016, 0xad2448c9
+0, 189, 189, 1, 38016, 0x32065043
+0, 190, 190, 1, 38016, 0x2e7ff976
+0, 191, 191, 1, 38016, 0xf1a8c805
+0, 192, 192, 1, 38016, 0x3f64d1cc
+0, 193, 193, 1, 38016, 0xc855efbd
+0, 194, 194, 1, 38016, 0x152b0fed
+0, 195, 195, 1, 38016, 0x43335881
+0, 196, 196, 1, 38016, 0xec5c7979
+0, 197, 197, 1, 38016, 0x150e9488
+0, 198, 198, 1, 38016, 0x1a63b67a
+0, 199, 199, 1, 38016, 0x24a4cca6
+0, 200, 200, 1, 38016, 0x3838dba2
+0, 201, 201, 1, 38016, 0xef1bec71
+0, 202, 202, 1, 38016, 0x0478f12a
+0, 203, 203, 1, 38016, 0x478fee17
+0, 204, 204, 1, 38016, 0x1d09f0ac
+0, 205, 205, 1, 38016, 0x3daef591
+0, 206, 206, 1, 38016, 0xf7f3033c
+0, 207, 207, 1, 38016, 0xfb09faa0
+0, 208, 208, 1, 38016, 0xd87de6c9
+0, 209, 209, 1, 38016, 0xbd99d6bc
+0, 210, 210, 1, 38016, 0x87d8bd7d
+0, 211, 211, 1, 38016, 0xf244b18a
+0, 212, 212, 1, 38016, 0x3a34a2da
+0, 213, 213, 1, 38016, 0x25739701
+0, 214, 214, 1, 38016, 0x346b8b9a
+0, 215, 215, 1, 38016, 0xc67379ec
+0, 216, 216, 1, 38016, 0xbd30780d
+0, 217, 217, 1, 38016, 0xc5197c2b
+0, 218, 218, 1, 38016, 0xd5ce73e8
+0, 219, 219, 1, 38016, 0x63ce72d1
+0, 220, 220, 1, 38016, 0x140d688d
+0, 221, 221, 1, 38016, 0x027158aa
+0, 222, 222, 1, 38016, 0x90884ce3
+0, 223, 223, 1, 38016, 0x4faa38c5
+0, 224, 224, 1, 38016, 0x78693f54
+0, 225, 225, 1, 38016, 0xe1fa41c1
+0, 226, 226, 1, 38016, 0x9b524771
+0, 227, 227, 1, 38016, 0xbb3056c8
+0, 228, 228, 1, 38016, 0xa93b67df
+0, 229, 229, 1, 38016, 0xe661909f
+0, 230, 230, 1, 38016, 0x55a0af6d
+0, 231, 231, 1, 38016, 0xa5f6d0a8
+0, 232, 232, 1, 38016, 0xa44300f8
+0, 233, 233, 1, 38016, 0xc7cc265e
+0, 234, 234, 1, 38016, 0xe7384598
+0, 235, 235, 1, 38016, 0x77e4589a
+0, 236, 236, 1, 38016, 0x073c7054
+0, 237, 237, 1, 38016, 0xe50e6ea8
+0, 238, 238, 1, 38016, 0xcedf518f
+0, 239, 239, 1, 38016, 0x8674266b
+0, 240, 240, 1, 38016, 0x360e0517
+0, 241, 241, 1, 38016, 0x19acdb3a
+0, 242, 242, 1, 38016, 0xd029d91b
+0, 243, 243, 1, 38016, 0x3101277f
+0, 244, 244, 1, 38016, 0x3a919153
+0, 245, 245, 1, 38016, 0x0646ffaf
+0, 246, 246, 1, 38016, 0xffdd13a5
+0, 247, 247, 1, 38016, 0x13e2e641
+0, 248, 248, 1, 38016, 0xc6f6a13b
+0, 249, 249, 1, 38016, 0x984f2ecd
+0, 250, 250, 1, 38016, 0xafaec63a
+0, 251, 251, 1, 38016, 0x9025817a
+0, 252, 252, 1, 38016, 0x20d574d7
+0, 253, 253, 1, 38016, 0x72eacc49
+0, 254, 254, 1, 38016, 0x6297335a
+0, 255, 255, 1, 38016, 0xc69adba1
+0, 256, 256, 1, 38016, 0x7852d515
+0, 257, 257, 1, 38016, 0x0e846003
+0, 258, 258, 1, 38016, 0xeb294c5e
+0, 259, 259, 1, 38016, 0x0913448f
+0, 260, 260, 1, 38016, 0xea2c4fc1
+0, 261, 261, 1, 38016, 0xb8165b3f
+0, 262, 262, 1, 38016, 0x5f596c9d
+0, 263, 263, 1, 38016, 0x3a1370d1
+0, 264, 264, 1, 38016, 0x25dd6a9a
+0, 265, 265, 1, 38016, 0x70075f7a
+0, 266, 266, 1, 38016, 0xaf6749f0
+0, 267, 267, 1, 38016, 0xd5c22d02
+0, 268, 268, 1, 38016, 0xf6e80af2
+0, 269, 269, 1, 38016, 0x42d1dcf7
+0, 270, 270, 1, 38016, 0x232cb536
+0, 271, 271, 1, 38016, 0x7c848ebf
+0, 272, 272, 1, 38016, 0x4c756c28
+0, 273, 273, 1, 38016, 0x720e1f07
+0, 274, 274, 1, 38016, 0x2385ccb2
+0, 275, 275, 1, 38016, 0xcd97bf76
+0, 276, 276, 1, 38016, 0xebcad10b
+0, 277, 277, 1, 38016, 0xbed8ceeb
+0, 278, 278, 1, 38016, 0x660ffaf8
+0, 279, 279, 1, 38016, 0x6a1662a9
+0, 280, 280, 1, 38016, 0x71f20775
+0, 281, 281, 1, 38016, 0x597ecf26
+0, 282, 282, 1, 38016, 0x7a81a050
+0, 283, 283, 1, 38016, 0x05f6676a
+0, 284, 284, 1, 38016, 0xd0065042
+0, 285, 285, 1, 38016, 0x17ca9cd9
+0, 286, 286, 1, 38016, 0x76956633
+0, 287, 287, 1, 38016, 0x9211a2b0
+0, 288, 288, 1, 38016, 0xc134b304
+0, 289, 289, 1, 38016, 0xdaca9260
+0, 290, 290, 1, 38016, 0x10252d19
+0, 291, 291, 1, 38016, 0xf52a44af
+0, 292, 292, 1, 38016, 0x4053d2d1
+0, 293, 293, 1, 38016, 0x165e0bed
+0, 294, 294, 1, 38016, 0x577352d0
+0, 295, 295, 1, 38016, 0xf9564a09
+0, 296, 296, 1, 38016, 0x78a8295f
+0, 297, 297, 1, 38016, 0xb2d7182a
+0, 298, 298, 1, 38016, 0x9a0c2487
+0, 299, 299, 1, 38016, 0x1b044efa
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-ba3_sva_c b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-ba3_sva_c
index 2b36542..cb775db 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-ba3_sva_c
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-ba3_sva_c
@@ -1,33 +1,34 @@
-0, 0, 38016, 0xbf5f1df5
-0, 3600, 38016, 0x8de61f39
-0, 7200, 38016, 0xaeec0a18
-0, 10800, 38016, 0x386c2599
-0, 14400, 38016, 0x8fcf2df0
-0, 18000, 38016, 0x34fe57ec
-0, 21600, 38016, 0x7e6c5e1a
-0, 25200, 38016, 0x8f319659
-0, 28800, 38016, 0x1e1291e2
-0, 32400, 38016, 0x97e9bf55
-0, 36000, 38016, 0x35bcad1a
-0, 39600, 38016, 0xea39d354
-0, 43200, 38016, 0xca7db081
-0, 46800, 38016, 0x2c069b6c
-0, 50400, 38016, 0x32f86a99
-0, 54000, 38016, 0xb4019668
-0, 57600, 38016, 0x04038324
-0, 61200, 38016, 0xe4f0b032
-0, 64800, 38016, 0xe6119a63
-0, 68400, 38016, 0xdf17b9fa
-0, 72000, 38016, 0xe199a348
-0, 75600, 38016, 0x6704b749
-0, 79200, 38016, 0x33fc7592
-0, 82800, 38016, 0xc0c371b2
-0, 86400, 38016, 0x017628aa
-0, 90000, 38016, 0xa46b3ab5
-0, 93600, 38016, 0x216f1fdb
-0, 97200, 38016, 0x28c54669
-0, 100800, 38016, 0x070c4ac1
-0, 104400, 38016, 0x4d4c6765
-0, 108000, 38016, 0xb496626c
-0, 111600, 38016, 0x9f767057
-0, 115200, 38016, 0xe2bc4de1
+#tb 0: 1/25
+0, 0, 0, 1, 38016, 0xbf5f1df5
+0, 1, 1, 1, 38016, 0x8de61f39
+0, 2, 2, 1, 38016, 0xaeec0a18
+0, 3, 3, 1, 38016, 0x386c2599
+0, 4, 4, 1, 38016, 0x8fcf2df0
+0, 5, 5, 1, 38016, 0x34fe57ec
+0, 6, 6, 1, 38016, 0x7e6c5e1a
+0, 7, 7, 1, 38016, 0x8f319659
+0, 8, 8, 1, 38016, 0x1e1291e2
+0, 9, 9, 1, 38016, 0x97e9bf55
+0, 10, 10, 1, 38016, 0x35bcad1a
+0, 11, 11, 1, 38016, 0xea39d354
+0, 12, 12, 1, 38016, 0xca7db081
+0, 13, 13, 1, 38016, 0x2c069b6c
+0, 14, 14, 1, 38016, 0x32f86a99
+0, 15, 15, 1, 38016, 0xb4019668
+0, 16, 16, 1, 38016, 0x04038324
+0, 17, 17, 1, 38016, 0xe4f0b032
+0, 18, 18, 1, 38016, 0xe6119a63
+0, 19, 19, 1, 38016, 0xdf17b9fa
+0, 20, 20, 1, 38016, 0xe199a348
+0, 21, 21, 1, 38016, 0x6704b749
+0, 22, 22, 1, 38016, 0x33fc7592
+0, 23, 23, 1, 38016, 0xc0c371b2
+0, 24, 24, 1, 38016, 0x017628aa
+0, 25, 25, 1, 38016, 0xa46b3ab5
+0, 26, 26, 1, 38016, 0x216f1fdb
+0, 27, 27, 1, 38016, 0x28c54669
+0, 28, 28, 1, 38016, 0x070c4ac1
+0, 29, 29, 1, 38016, 0x4d4c6765
+0, 30, 30, 1, 38016, 0xb496626c
+0, 31, 31, 1, 38016, 0x9f767057
+0, 32, 32, 1, 38016, 0xe2bc4de1
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-ba_mw_d b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-ba_mw_d
index b5fbd69..18a6717 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-ba_mw_d
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-ba_mw_d
@@ -1,100 +1,101 @@
-0, 0, 38016, 0x3ae838ee
-0, 3600, 38016, 0x9ed7e141
-0, 7200, 38016, 0x393097f9
-0, 10800, 38016, 0x8fb56676
-0, 14400, 38016, 0x39d64fd2
-0, 18000, 38016, 0x7fad729a
-0, 21600, 38016, 0x7e25955f
-0, 25200, 38016, 0xc4d9a359
-0, 28800, 38016, 0x30afaca4
-0, 32400, 38016, 0x9ee195ea
-0, 36000, 38016, 0x09f65805
-0, 39600, 38016, 0x58d126ab
-0, 43200, 38016, 0x4f29282c
-0, 46800, 38016, 0x8af235a1
-0, 50400, 38016, 0x6dfe525a
-0, 54000, 38016, 0xd51c793f
-0, 57600, 38016, 0x4e90abba
-0, 61200, 38016, 0xe706c5b7
-0, 64800, 38016, 0x35fab7ef
-0, 68400, 38016, 0xed78b8fc
-0, 72000, 38016, 0x2907bb4e
-0, 75600, 38016, 0x1749bb47
-0, 79200, 38016, 0x284ec688
-0, 82800, 38016, 0x534abc24
-0, 86400, 38016, 0xcd01bd13
-0, 90000, 38016, 0xe97bbd51
-0, 93600, 38016, 0xac1cb9e9
-0, 97200, 38016, 0xd861c0a3
-0, 100800, 38016, 0xf0f1ced4
-0, 104400, 38016, 0xa9e8d2bf
-0, 108000, 38016, 0x4c6aa7c5
-0, 111600, 38016, 0xe2eb6bde
-0, 115200, 38016, 0x92eb44a1
-0, 118800, 38016, 0x376b8919
-0, 122400, 38016, 0x291bfdd9
-0, 126000, 38016, 0xed0c60a0
-0, 129600, 38016, 0xf505b70d
-0, 133200, 38016, 0x26b33a9b
-0, 136800, 38016, 0xc9269664
-0, 140400, 38016, 0xe21dc61e
-0, 144000, 38016, 0xe88fe653
-0, 147600, 38016, 0xd4cff39c
-0, 151200, 38016, 0x02bdecdf
-0, 154800, 38016, 0xec48fc13
-0, 158400, 38016, 0x363f071c
-0, 162000, 38016, 0x7fcbf2fd
-0, 165600, 38016, 0xc3d1c265
-0, 169200, 38016, 0x818a94e9
-0, 172800, 38016, 0x30b5a52f
-0, 176400, 38016, 0x7a1acd17
-0, 180000, 38016, 0xb5a6dc91
-0, 183600, 38016, 0x7d39b673
-0, 187200, 38016, 0x341ad3f9
-0, 190800, 38016, 0x264cff5f
-0, 194400, 38016, 0x613a445b
-0, 198000, 38016, 0x42a55cd6
-0, 201600, 38016, 0xe84f6a39
-0, 205200, 38016, 0xd8e93151
-0, 208800, 38016, 0xc7333ac4
-0, 212400, 38016, 0xa08a4b2c
-0, 216000, 38016, 0xeb8a3531
-0, 219600, 38016, 0x88bf1883
-0, 223200, 38016, 0x0043c104
-0, 226800, 38016, 0xa9d6a35d
-0, 230400, 38016, 0x01dec5af
-0, 234000, 38016, 0x673cdf0e
-0, 237600, 38016, 0xc8d0ce67
-0, 241200, 38016, 0xcac2d0bd
-0, 244800, 38016, 0x8575c7b9
-0, 248400, 38016, 0x71c1b4f4
-0, 252000, 38016, 0x2affa1d4
-0, 255600, 38016, 0xae947cfd
-0, 259200, 38016, 0x48b2821d
-0, 262800, 38016, 0x1c5d77f4
-0, 266400, 38016, 0x3625233b
-0, 270000, 38016, 0xcfc8e3ff
-0, 273600, 38016, 0x6d04cfa5
-0, 277200, 38016, 0x2c4ec463
-0, 280800, 38016, 0x72b1ea07
-0, 284400, 38016, 0x448d3996
-0, 288000, 38016, 0x89256b87
-0, 291600, 38016, 0x69af5fea
-0, 295200, 38016, 0x908f46b0
-0, 298800, 38016, 0x56e11a8b
-0, 302400, 38016, 0x7fd4c5f5
-0, 306000, 38016, 0x560bd701
-0, 309600, 38016, 0x71570820
-0, 313200, 38016, 0x11b20b14
-0, 316800, 38016, 0xa3fd9f19
-0, 320400, 38016, 0x4a564d33
-0, 324000, 38016, 0x1722db32
-0, 327600, 38016, 0xf853a971
-0, 331200, 38016, 0xb136bf89
-0, 334800, 38016, 0xb686e8c3
-0, 338400, 38016, 0x8afc1a4c
-0, 342000, 38016, 0xa24adb65
-0, 345600, 38016, 0xd951ae27
-0, 349200, 38016, 0xa731f04e
-0, 352800, 38016, 0xabd65795
-0, 356400, 38016, 0x46bc95e1
+#tb 0: 1/25
+0, 0, 0, 1, 38016, 0x3ae838ee
+0, 1, 1, 1, 38016, 0x9ed7e141
+0, 2, 2, 1, 38016, 0x393097f9
+0, 3, 3, 1, 38016, 0x8fb56676
+0, 4, 4, 1, 38016, 0x39d64fd2
+0, 5, 5, 1, 38016, 0x7fad729a
+0, 6, 6, 1, 38016, 0x7e25955f
+0, 7, 7, 1, 38016, 0xc4d9a359
+0, 8, 8, 1, 38016, 0x30afaca4
+0, 9, 9, 1, 38016, 0x9ee195ea
+0, 10, 10, 1, 38016, 0x09f65805
+0, 11, 11, 1, 38016, 0x58d126ab
+0, 12, 12, 1, 38016, 0x4f29282c
+0, 13, 13, 1, 38016, 0x8af235a1
+0, 14, 14, 1, 38016, 0x6dfe525a
+0, 15, 15, 1, 38016, 0xd51c793f
+0, 16, 16, 1, 38016, 0x4e90abba
+0, 17, 17, 1, 38016, 0xe706c5b7
+0, 18, 18, 1, 38016, 0x35fab7ef
+0, 19, 19, 1, 38016, 0xed78b8fc
+0, 20, 20, 1, 38016, 0x2907bb4e
+0, 21, 21, 1, 38016, 0x1749bb47
+0, 22, 22, 1, 38016, 0x284ec688
+0, 23, 23, 1, 38016, 0x534abc24
+0, 24, 24, 1, 38016, 0xcd01bd13
+0, 25, 25, 1, 38016, 0xe97bbd51
+0, 26, 26, 1, 38016, 0xac1cb9e9
+0, 27, 27, 1, 38016, 0xd861c0a3
+0, 28, 28, 1, 38016, 0xf0f1ced4
+0, 29, 29, 1, 38016, 0xa9e8d2bf
+0, 30, 30, 1, 38016, 0x4c6aa7c5
+0, 31, 31, 1, 38016, 0xe2eb6bde
+0, 32, 32, 1, 38016, 0x92eb44a1
+0, 33, 33, 1, 38016, 0x376b8919
+0, 34, 34, 1, 38016, 0x291bfdd9
+0, 35, 35, 1, 38016, 0xed0c60a0
+0, 36, 36, 1, 38016, 0xf505b70d
+0, 37, 37, 1, 38016, 0x26b33a9b
+0, 38, 38, 1, 38016, 0xc9269664
+0, 39, 39, 1, 38016, 0xe21dc61e
+0, 40, 40, 1, 38016, 0xe88fe653
+0, 41, 41, 1, 38016, 0xd4cff39c
+0, 42, 42, 1, 38016, 0x02bdecdf
+0, 43, 43, 1, 38016, 0xec48fc13
+0, 44, 44, 1, 38016, 0x363f071c
+0, 45, 45, 1, 38016, 0x7fcbf2fd
+0, 46, 46, 1, 38016, 0xc3d1c265
+0, 47, 47, 1, 38016, 0x818a94e9
+0, 48, 48, 1, 38016, 0x30b5a52f
+0, 49, 49, 1, 38016, 0x7a1acd17
+0, 50, 50, 1, 38016, 0xb5a6dc91
+0, 51, 51, 1, 38016, 0x7d39b673
+0, 52, 52, 1, 38016, 0x341ad3f9
+0, 53, 53, 1, 38016, 0x264cff5f
+0, 54, 54, 1, 38016, 0x613a445b
+0, 55, 55, 1, 38016, 0x42a55cd6
+0, 56, 56, 1, 38016, 0xe84f6a39
+0, 57, 57, 1, 38016, 0xd8e93151
+0, 58, 58, 1, 38016, 0xc7333ac4
+0, 59, 59, 1, 38016, 0xa08a4b2c
+0, 60, 60, 1, 38016, 0xeb8a3531
+0, 61, 61, 1, 38016, 0x88bf1883
+0, 62, 62, 1, 38016, 0x0043c104
+0, 63, 63, 1, 38016, 0xa9d6a35d
+0, 64, 64, 1, 38016, 0x01dec5af
+0, 65, 65, 1, 38016, 0x673cdf0e
+0, 66, 66, 1, 38016, 0xc8d0ce67
+0, 67, 67, 1, 38016, 0xcac2d0bd
+0, 68, 68, 1, 38016, 0x8575c7b9
+0, 69, 69, 1, 38016, 0x71c1b4f4
+0, 70, 70, 1, 38016, 0x2affa1d4
+0, 71, 71, 1, 38016, 0xae947cfd
+0, 72, 72, 1, 38016, 0x48b2821d
+0, 73, 73, 1, 38016, 0x1c5d77f4
+0, 74, 74, 1, 38016, 0x3625233b
+0, 75, 75, 1, 38016, 0xcfc8e3ff
+0, 76, 76, 1, 38016, 0x6d04cfa5
+0, 77, 77, 1, 38016, 0x2c4ec463
+0, 78, 78, 1, 38016, 0x72b1ea07
+0, 79, 79, 1, 38016, 0x448d3996
+0, 80, 80, 1, 38016, 0x89256b87
+0, 81, 81, 1, 38016, 0x69af5fea
+0, 82, 82, 1, 38016, 0x908f46b0
+0, 83, 83, 1, 38016, 0x56e11a8b
+0, 84, 84, 1, 38016, 0x7fd4c5f5
+0, 85, 85, 1, 38016, 0x560bd701
+0, 86, 86, 1, 38016, 0x71570820
+0, 87, 87, 1, 38016, 0x11b20b14
+0, 88, 88, 1, 38016, 0xa3fd9f19
+0, 89, 89, 1, 38016, 0x4a564d33
+0, 90, 90, 1, 38016, 0x1722db32
+0, 91, 91, 1, 38016, 0xf853a971
+0, 92, 92, 1, 38016, 0xb136bf89
+0, 93, 93, 1, 38016, 0xb686e8c3
+0, 94, 94, 1, 38016, 0x8afc1a4c
+0, 95, 95, 1, 38016, 0xa24adb65
+0, 96, 96, 1, 38016, 0xd951ae27
+0, 97, 97, 1, 38016, 0xa731f04e
+0, 98, 98, 1, 38016, 0xabd65795
+0, 99, 99, 1, 38016, 0x46bc95e1
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-bamq1_jvc_c b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-bamq1_jvc_c
index 11f4352..4a3066c 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-bamq1_jvc_c
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-bamq1_jvc_c
@@ -1,30 +1,31 @@
-0, 0, 38016, 0x6951213f
-0, 3600, 38016, 0x82ddf39d
-0, 7200, 38016, 0x3f81c6b1
-0, 10800, 38016, 0x55149f23
-0, 14400, 38016, 0x366a74e1
-0, 18000, 38016, 0xe6f465cf
-0, 21600, 38016, 0x14fd4999
-0, 25200, 38016, 0x49273f0f
-0, 28800, 38016, 0xa20a2ebe
-0, 32400, 38016, 0x701b32a4
-0, 36000, 38016, 0x8a394066
-0, 39600, 38016, 0xe9b766a6
-0, 43200, 38016, 0x4e7f766d
-0, 46800, 38016, 0x2c159585
-0, 50400, 38016, 0x31b38c2b
-0, 54000, 38016, 0xde58937f
-0, 57600, 38016, 0xf69e94f9
-0, 61200, 38016, 0x849e8a08
-0, 64800, 38016, 0xe53f79e9
-0, 68400, 38016, 0xf2ce6103
-0, 72000, 38016, 0xe98d3c96
-0, 75600, 38016, 0xea8c17c5
-0, 79200, 38016, 0xea0a01d8
-0, 82800, 38016, 0x6a45fd53
-0, 86400, 38016, 0xaad9fd47
-0, 90000, 38016, 0xabc603b7
-0, 93600, 38016, 0x89410350
-0, 97200, 38016, 0x1fac129b
-0, 100800, 38016, 0x1af529ee
-0, 104400, 38016, 0x384141b6
+#tb 0: 1/25
+0, 0, 0, 1, 38016, 0x6951213f
+0, 1, 1, 1, 38016, 0x82ddf39d
+0, 2, 2, 1, 38016, 0x3f81c6b1
+0, 3, 3, 1, 38016, 0x55149f23
+0, 4, 4, 1, 38016, 0x366a74e1
+0, 5, 5, 1, 38016, 0xe6f465cf
+0, 6, 6, 1, 38016, 0x14fd4999
+0, 7, 7, 1, 38016, 0x49273f0f
+0, 8, 8, 1, 38016, 0xa20a2ebe
+0, 9, 9, 1, 38016, 0x701b32a4
+0, 10, 10, 1, 38016, 0x8a394066
+0, 11, 11, 1, 38016, 0xe9b766a6
+0, 12, 12, 1, 38016, 0x4e7f766d
+0, 13, 13, 1, 38016, 0x2c159585
+0, 14, 14, 1, 38016, 0x31b38c2b
+0, 15, 15, 1, 38016, 0xde58937f
+0, 16, 16, 1, 38016, 0xf69e94f9
+0, 17, 17, 1, 38016, 0x849e8a08
+0, 18, 18, 1, 38016, 0xe53f79e9
+0, 19, 19, 1, 38016, 0xf2ce6103
+0, 20, 20, 1, 38016, 0xe98d3c96
+0, 21, 21, 1, 38016, 0xea8c17c5
+0, 22, 22, 1, 38016, 0xea0a01d8
+0, 23, 23, 1, 38016, 0x6a45fd53
+0, 24, 24, 1, 38016, 0xaad9fd47
+0, 25, 25, 1, 38016, 0xabc603b7
+0, 26, 26, 1, 38016, 0x89410350
+0, 27, 27, 1, 38016, 0x1fac129b
+0, 28, 28, 1, 38016, 0x1af529ee
+0, 29, 29, 1, 38016, 0x384141b6
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-bamq2_jvc_c b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-bamq2_jvc_c
index a16cb05..3308f77 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-bamq2_jvc_c
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-bamq2_jvc_c
@@ -1,30 +1,31 @@
-0, 0, 38016, 0x6951213f
-0, 3600, 38016, 0xd1bbf830
-0, 7200, 38016, 0x79dcc8cb
-0, 10800, 38016, 0xa426a50e
-0, 14400, 38016, 0x002275d6
-0, 18000, 38016, 0xab9a666e
-0, 21600, 38016, 0x9bd54be9
-0, 25200, 38016, 0x09003ed1
-0, 28800, 38016, 0x75e0340a
-0, 32400, 38016, 0x65ae3b23
-0, 36000, 38016, 0x4c1049a8
-0, 39600, 38016, 0x6e336a25
-0, 43200, 38016, 0x4d3579ee
-0, 46800, 38016, 0x81f89545
-0, 50400, 38016, 0xc9358e56
-0, 54000, 38016, 0x3fa69885
-0, 57600, 38016, 0x1ea49bea
-0, 61200, 38016, 0xce939241
-0, 64800, 38016, 0xbc278236
-0, 68400, 38016, 0xf11868d2
-0, 72000, 38016, 0xe4124537
-0, 75600, 38016, 0xd5831e16
-0, 79200, 38016, 0x9f5608e8
-0, 82800, 38016, 0x30ad0448
-0, 86400, 38016, 0x06a00523
-0, 90000, 38016, 0x25e50e24
-0, 93600, 38016, 0x2c220a92
-0, 97200, 38016, 0xd4b7185e
-0, 100800, 38016, 0x80f92d07
-0, 104400, 38016, 0x285a4586
+#tb 0: 1/25
+0, 0, 0, 1, 38016, 0x6951213f
+0, 1, 1, 1, 38016, 0xd1bbf830
+0, 2, 2, 1, 38016, 0x79dcc8cb
+0, 3, 3, 1, 38016, 0xa426a50e
+0, 4, 4, 1, 38016, 0x002275d6
+0, 5, 5, 1, 38016, 0xab9a666e
+0, 6, 6, 1, 38016, 0x9bd54be9
+0, 7, 7, 1, 38016, 0x09003ed1
+0, 8, 8, 1, 38016, 0x75e0340a
+0, 9, 9, 1, 38016, 0x65ae3b23
+0, 10, 10, 1, 38016, 0x4c1049a8
+0, 11, 11, 1, 38016, 0x6e336a25
+0, 12, 12, 1, 38016, 0x4d3579ee
+0, 13, 13, 1, 38016, 0x81f89545
+0, 14, 14, 1, 38016, 0xc9358e56
+0, 15, 15, 1, 38016, 0x3fa69885
+0, 16, 16, 1, 38016, 0x1ea49bea
+0, 17, 17, 1, 38016, 0xce939241
+0, 18, 18, 1, 38016, 0xbc278236
+0, 19, 19, 1, 38016, 0xf11868d2
+0, 20, 20, 1, 38016, 0xe4124537
+0, 21, 21, 1, 38016, 0xd5831e16
+0, 22, 22, 1, 38016, 0x9f5608e8
+0, 23, 23, 1, 38016, 0x30ad0448
+0, 24, 24, 1, 38016, 0x06a00523
+0, 25, 25, 1, 38016, 0x25e50e24
+0, 26, 26, 1, 38016, 0x2c220a92
+0, 27, 27, 1, 38016, 0xd4b7185e
+0, 28, 28, 1, 38016, 0x80f92d07
+0, 29, 29, 1, 38016, 0x285a4586
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-banm_mw_d b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-banm_mw_d
index 188d7a7..6108ca3 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-banm_mw_d
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-banm_mw_d
@@ -1,100 +1,101 @@
-0, 0, 38016, 0x3ae838ee
-0, 3600, 38016, 0x9ed7e141
-0, 7200, 38016, 0xaf9d9753
-0, 10800, 38016, 0x8a6f6906
-0, 14400, 38016, 0xcfe85810
-0, 18000, 38016, 0x00ed737f
-0, 21600, 38016, 0x93509e20
-0, 25200, 38016, 0xa02ba402
-0, 28800, 38016, 0xce09afd9
-0, 32400, 38016, 0xc7a49dcf
-0, 36000, 38016, 0x0da163c6
-0, 39600, 38016, 0xb3be2fcf
-0, 43200, 38016, 0x0d564479
-0, 46800, 38016, 0x5c554f55
-0, 50400, 38016, 0x05d06d25
-0, 54000, 38016, 0x352687bc
-0, 57600, 38016, 0x9e13b74d
-0, 61200, 38016, 0x1c3dd2af
-0, 64800, 38016, 0x3c1ad091
-0, 68400, 38016, 0x0461cad8
-0, 72000, 38016, 0xa002cc91
-0, 75600, 38016, 0x9c06d06e
-0, 79200, 38016, 0xfad0cee0
-0, 82800, 38016, 0x5cbbd4a5
-0, 86400, 38016, 0x9a99d463
-0, 90000, 38016, 0xa115d051
-0, 93600, 38016, 0x5b63cc22
-0, 97200, 38016, 0x53b3cfd2
-0, 100800, 38016, 0x7b22db61
-0, 104400, 38016, 0x4f28e319
-0, 108000, 38016, 0x4c6aa7c5
-0, 111600, 38016, 0xe2eb6bde
-0, 115200, 38016, 0xdfc84927
-0, 118800, 38016, 0xa0098eab
-0, 122400, 38016, 0x607a00e2
-0, 126000, 38016, 0x58da68d0
-0, 129600, 38016, 0x1290c8c6
-0, 133200, 38016, 0x40615120
-0, 136800, 38016, 0x070e9d9c
-0, 140400, 38016, 0x5295d213
-0, 144000, 38016, 0xaaa0f00a
-0, 147600, 38016, 0x0ef7f99d
-0, 151200, 38016, 0x018cf596
-0, 154800, 38016, 0xb9010555
-0, 158400, 38016, 0x54b10d05
-0, 162000, 38016, 0xa06ff53b
-0, 165600, 38016, 0x9a2ec1aa
-0, 169200, 38016, 0x75999938
-0, 172800, 38016, 0xda6ba315
-0, 176400, 38016, 0xaa38cc4e
-0, 180000, 38016, 0x87f6e751
-0, 183600, 38016, 0x2318c2b9
-0, 187200, 38016, 0xdebfd9c8
-0, 190800, 38016, 0xdc9a115f
-0, 194400, 38016, 0x6d1e495d
-0, 198000, 38016, 0x53d46db4
-0, 201600, 38016, 0x53287856
-0, 205200, 38016, 0x0ce93af7
-0, 208800, 38016, 0x44974b42
-0, 212400, 38016, 0x65a16170
-0, 216000, 38016, 0xeb8a3531
-0, 219600, 38016, 0x65da180b
-0, 223200, 38016, 0x6eb1cd77
-0, 226800, 38016, 0xc890b0c1
-0, 230400, 38016, 0x359ad301
-0, 234000, 38016, 0x4be2e140
-0, 237600, 38016, 0x5094da18
-0, 241200, 38016, 0x9ef9d904
-0, 244800, 38016, 0x0ad8cbb4
-0, 248400, 38016, 0xd68cb3db
-0, 252000, 38016, 0x7fcd9d3c
-0, 255600, 38016, 0x017385aa
-0, 259200, 38016, 0xa2328d96
-0, 262800, 38016, 0x18858630
-0, 266400, 38016, 0x795228e0
-0, 270000, 38016, 0xb70ce750
-0, 273600, 38016, 0x55d9da49
-0, 277200, 38016, 0x7714cc94
-0, 280800, 38016, 0xec39f711
-0, 284400, 38016, 0x561e4366
-0, 288000, 38016, 0xd91c83e0
-0, 291600, 38016, 0x8b3379e2
-0, 295200, 38016, 0xdee36b36
-0, 298800, 38016, 0x1b4940fd
-0, 302400, 38016, 0x9b13e7b2
-0, 306000, 38016, 0xb0b2f2eb
-0, 309600, 38016, 0x0e7c2373
-0, 313200, 38016, 0x87401fb0
-0, 316800, 38016, 0xc4bdb8be
-0, 320400, 38016, 0xbbfc4f40
-0, 324000, 38016, 0x1722db32
-0, 327600, 38016, 0xf7e8a749
-0, 331200, 38016, 0x8c66b366
-0, 334800, 38016, 0x9823f33e
-0, 338400, 38016, 0x5013240a
-0, 342000, 38016, 0xf174d83a
-0, 345600, 38016, 0xe49cae19
-0, 349200, 38016, 0xadc2f8f7
-0, 352800, 38016, 0x667961b0
-0, 356400, 38016, 0xcb6d9bcd
+#tb 0: 1/25
+0, 0, 0, 1, 38016, 0x3ae838ee
+0, 1, 1, 1, 38016, 0x9ed7e141
+0, 2, 2, 1, 38016, 0xaf9d9753
+0, 3, 3, 1, 38016, 0x8a6f6906
+0, 4, 4, 1, 38016, 0xcfe85810
+0, 5, 5, 1, 38016, 0x00ed737f
+0, 6, 6, 1, 38016, 0x93509e20
+0, 7, 7, 1, 38016, 0xa02ba402
+0, 8, 8, 1, 38016, 0xce09afd9
+0, 9, 9, 1, 38016, 0xc7a49dcf
+0, 10, 10, 1, 38016, 0x0da163c6
+0, 11, 11, 1, 38016, 0xb3be2fcf
+0, 12, 12, 1, 38016, 0x0d564479
+0, 13, 13, 1, 38016, 0x5c554f55
+0, 14, 14, 1, 38016, 0x05d06d25
+0, 15, 15, 1, 38016, 0x352687bc
+0, 16, 16, 1, 38016, 0x9e13b74d
+0, 17, 17, 1, 38016, 0x1c3dd2af
+0, 18, 18, 1, 38016, 0x3c1ad091
+0, 19, 19, 1, 38016, 0x0461cad8
+0, 20, 20, 1, 38016, 0xa002cc91
+0, 21, 21, 1, 38016, 0x9c06d06e
+0, 22, 22, 1, 38016, 0xfad0cee0
+0, 23, 23, 1, 38016, 0x5cbbd4a5
+0, 24, 24, 1, 38016, 0x9a99d463
+0, 25, 25, 1, 38016, 0xa115d051
+0, 26, 26, 1, 38016, 0x5b63cc22
+0, 27, 27, 1, 38016, 0x53b3cfd2
+0, 28, 28, 1, 38016, 0x7b22db61
+0, 29, 29, 1, 38016, 0x4f28e319
+0, 30, 30, 1, 38016, 0x4c6aa7c5
+0, 31, 31, 1, 38016, 0xe2eb6bde
+0, 32, 32, 1, 38016, 0xdfc84927
+0, 33, 33, 1, 38016, 0xa0098eab
+0, 34, 34, 1, 38016, 0x607a00e2
+0, 35, 35, 1, 38016, 0x58da68d0
+0, 36, 36, 1, 38016, 0x1290c8c6
+0, 37, 37, 1, 38016, 0x40615120
+0, 38, 38, 1, 38016, 0x070e9d9c
+0, 39, 39, 1, 38016, 0x5295d213
+0, 40, 40, 1, 38016, 0xaaa0f00a
+0, 41, 41, 1, 38016, 0x0ef7f99d
+0, 42, 42, 1, 38016, 0x018cf596
+0, 43, 43, 1, 38016, 0xb9010555
+0, 44, 44, 1, 38016, 0x54b10d05
+0, 45, 45, 1, 38016, 0xa06ff53b
+0, 46, 46, 1, 38016, 0x9a2ec1aa
+0, 47, 47, 1, 38016, 0x75999938
+0, 48, 48, 1, 38016, 0xda6ba315
+0, 49, 49, 1, 38016, 0xaa38cc4e
+0, 50, 50, 1, 38016, 0x87f6e751
+0, 51, 51, 1, 38016, 0x2318c2b9
+0, 52, 52, 1, 38016, 0xdebfd9c8
+0, 53, 53, 1, 38016, 0xdc9a115f
+0, 54, 54, 1, 38016, 0x6d1e495d
+0, 55, 55, 1, 38016, 0x53d46db4
+0, 56, 56, 1, 38016, 0x53287856
+0, 57, 57, 1, 38016, 0x0ce93af7
+0, 58, 58, 1, 38016, 0x44974b42
+0, 59, 59, 1, 38016, 0x65a16170
+0, 60, 60, 1, 38016, 0xeb8a3531
+0, 61, 61, 1, 38016, 0x65da180b
+0, 62, 62, 1, 38016, 0x6eb1cd77
+0, 63, 63, 1, 38016, 0xc890b0c1
+0, 64, 64, 1, 38016, 0x359ad301
+0, 65, 65, 1, 38016, 0x4be2e140
+0, 66, 66, 1, 38016, 0x5094da18
+0, 67, 67, 1, 38016, 0x9ef9d904
+0, 68, 68, 1, 38016, 0x0ad8cbb4
+0, 69, 69, 1, 38016, 0xd68cb3db
+0, 70, 70, 1, 38016, 0x7fcd9d3c
+0, 71, 71, 1, 38016, 0x017385aa
+0, 72, 72, 1, 38016, 0xa2328d96
+0, 73, 73, 1, 38016, 0x18858630
+0, 74, 74, 1, 38016, 0x795228e0
+0, 75, 75, 1, 38016, 0xb70ce750
+0, 76, 76, 1, 38016, 0x55d9da49
+0, 77, 77, 1, 38016, 0x7714cc94
+0, 78, 78, 1, 38016, 0xec39f711
+0, 79, 79, 1, 38016, 0x561e4366
+0, 80, 80, 1, 38016, 0xd91c83e0
+0, 81, 81, 1, 38016, 0x8b3379e2
+0, 82, 82, 1, 38016, 0xdee36b36
+0, 83, 83, 1, 38016, 0x1b4940fd
+0, 84, 84, 1, 38016, 0x9b13e7b2
+0, 85, 85, 1, 38016, 0xb0b2f2eb
+0, 86, 86, 1, 38016, 0x0e7c2373
+0, 87, 87, 1, 38016, 0x87401fb0
+0, 88, 88, 1, 38016, 0xc4bdb8be
+0, 89, 89, 1, 38016, 0xbbfc4f40
+0, 90, 90, 1, 38016, 0x1722db32
+0, 91, 91, 1, 38016, 0xf7e8a749
+0, 92, 92, 1, 38016, 0x8c66b366
+0, 93, 93, 1, 38016, 0x9823f33e
+0, 94, 94, 1, 38016, 0x5013240a
+0, 95, 95, 1, 38016, 0xf174d83a
+0, 96, 96, 1, 38016, 0xe49cae19
+0, 97, 97, 1, 38016, 0xadc2f8f7
+0, 98, 98, 1, 38016, 0x667961b0
+0, 99, 99, 1, 38016, 0xcb6d9bcd
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-basqp1_sony_c b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-basqp1_sony_c
index f856547..a5038e4 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-basqp1_sony_c
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-basqp1_sony_c
@@ -1,4 +1,5 @@
-0, 0, 38016, 0xe2d73230
-0, 3600, 38016, 0xda4dfc8e
-0, 7200, 38016, 0x7334cb99
-0, 10800, 38016, 0xd8feab7d
+#tb 0: 1/25
+0, 0, 0, 1, 38016, 0xe2d73230
+0, 1, 1, 1, 38016, 0xda4dfc8e
+0, 2, 2, 1, 38016, 0x7334cb99
+0, 3, 3, 1, 38016, 0xd8feab7d
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-caba1_sony_d b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-caba1_sony_d
index 62232d2..3579820 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-caba1_sony_d
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-caba1_sony_d
@@ -1,50 +1,51 @@
-0, 0, 38016, 0xb3883478
-0, 3600, 38016, 0x99e1fe60
-0, 7200, 38016, 0x65eace24
-0, 10800, 38016, 0xb2b0a513
-0, 14400, 38016, 0x8af47c64
-0, 18000, 38016, 0xa56670c6
-0, 21600, 38016, 0x11d45ac9
-0, 25200, 38016, 0xcd4e4f18
-0, 28800, 38016, 0x399934b2
-0, 32400, 38016, 0xedd23f7b
-0, 36000, 38016, 0x38c350b9
-0, 39600, 38016, 0xdd937244
-0, 43200, 38016, 0x39c67be6
-0, 46800, 38016, 0xabb7a34d
-0, 50400, 38016, 0x535d971f
-0, 54000, 38016, 0xd41c9cf7
-0, 57600, 38016, 0xfddda183
-0, 61200, 38016, 0x7b659dc5
-0, 64800, 38016, 0x06978b0c
-0, 68400, 38016, 0x62596b00
-0, 72000, 38016, 0x5e504719
-0, 75600, 38016, 0x55252349
-0, 79200, 38016, 0xdbdd0d9e
-0, 82800, 38016, 0x550a0918
-0, 86400, 38016, 0xb890feeb
-0, 90000, 38016, 0x8aa01221
-0, 93600, 38016, 0xfcc01085
-0, 97200, 38016, 0x78f11d7d
-0, 100800, 38016, 0xfcd33487
-0, 104400, 38016, 0x9b444cfc
-0, 108000, 38016, 0xed9563d3
-0, 111600, 38016, 0x07e17628
-0, 115200, 38016, 0x9bb792fd
-0, 118800, 38016, 0xa6aea73d
-0, 122400, 38016, 0x4b90b778
-0, 126000, 38016, 0x6df2b998
-0, 129600, 38016, 0x799eb2db
-0, 133200, 38016, 0x48dab272
-0, 136800, 38016, 0x9877b4eb
-0, 140400, 38016, 0x901ab58e
-0, 144000, 38016, 0x32c2beb1
-0, 147600, 38016, 0xe542b56e
-0, 151200, 38016, 0x1edf9ff4
-0, 154800, 38016, 0xf103942c
-0, 158400, 38016, 0x097a8dc7
-0, 162000, 38016, 0xe3728780
-0, 165600, 38016, 0xce9a9026
-0, 169200, 38016, 0x78ba841b
-0, 172800, 38016, 0x5fc687ab
-0, 176400, 38016, 0x03a49472
+#tb 0: 1/25
+0, 0, 0, 1, 38016, 0xb3883478
+0, 1, 1, 1, 38016, 0x99e1fe60
+0, 2, 2, 1, 38016, 0x65eace24
+0, 3, 3, 1, 38016, 0xb2b0a513
+0, 4, 4, 1, 38016, 0x8af47c64
+0, 5, 5, 1, 38016, 0xa56670c6
+0, 6, 6, 1, 38016, 0x11d45ac9
+0, 7, 7, 1, 38016, 0xcd4e4f18
+0, 8, 8, 1, 38016, 0x399934b2
+0, 9, 9, 1, 38016, 0xedd23f7b
+0, 10, 10, 1, 38016, 0x38c350b9
+0, 11, 11, 1, 38016, 0xdd937244
+0, 12, 12, 1, 38016, 0x39c67be6
+0, 13, 13, 1, 38016, 0xabb7a34d
+0, 14, 14, 1, 38016, 0x535d971f
+0, 15, 15, 1, 38016, 0xd41c9cf7
+0, 16, 16, 1, 38016, 0xfddda183
+0, 17, 17, 1, 38016, 0x7b659dc5
+0, 18, 18, 1, 38016, 0x06978b0c
+0, 19, 19, 1, 38016, 0x62596b00
+0, 20, 20, 1, 38016, 0x5e504719
+0, 21, 21, 1, 38016, 0x55252349
+0, 22, 22, 1, 38016, 0xdbdd0d9e
+0, 23, 23, 1, 38016, 0x550a0918
+0, 24, 24, 1, 38016, 0xb890feeb
+0, 25, 25, 1, 38016, 0x8aa01221
+0, 26, 26, 1, 38016, 0xfcc01085
+0, 27, 27, 1, 38016, 0x78f11d7d
+0, 28, 28, 1, 38016, 0xfcd33487
+0, 29, 29, 1, 38016, 0x9b444cfc
+0, 30, 30, 1, 38016, 0xed9563d3
+0, 31, 31, 1, 38016, 0x07e17628
+0, 32, 32, 1, 38016, 0x9bb792fd
+0, 33, 33, 1, 38016, 0xa6aea73d
+0, 34, 34, 1, 38016, 0x4b90b778
+0, 35, 35, 1, 38016, 0x6df2b998
+0, 36, 36, 1, 38016, 0x799eb2db
+0, 37, 37, 1, 38016, 0x48dab272
+0, 38, 38, 1, 38016, 0x9877b4eb
+0, 39, 39, 1, 38016, 0x901ab58e
+0, 40, 40, 1, 38016, 0x32c2beb1
+0, 41, 41, 1, 38016, 0xe542b56e
+0, 42, 42, 1, 38016, 0x1edf9ff4
+0, 43, 43, 1, 38016, 0xf103942c
+0, 44, 44, 1, 38016, 0x097a8dc7
+0, 45, 45, 1, 38016, 0xe3728780
+0, 46, 46, 1, 38016, 0xce9a9026
+0, 47, 47, 1, 38016, 0x78ba841b
+0, 48, 48, 1, 38016, 0x5fc687ab
+0, 49, 49, 1, 38016, 0x03a49472
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-caba1_sva_b b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-caba1_sva_b
index f5b426b..8b255bc 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-caba1_sva_b
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-caba1_sva_b
@@ -1,17 +1,18 @@
-0, 0, 38016, 0xee831fe4
-0, 3600, 38016, 0x1098ff23
-0, 7200, 38016, 0x8fc3e078
-0, 10800, 38016, 0x86530991
-0, 14400, 38016, 0xdc8e279e
-0, 18000, 38016, 0x54ea3234
-0, 21600, 38016, 0x79014662
-0, 25200, 38016, 0x5d0a5a88
-0, 28800, 38016, 0xf712805d
-0, 32400, 38016, 0x0a09937e
-0, 36000, 38016, 0xfa62a1d7
-0, 39600, 38016, 0x67c6a41b
-0, 43200, 38016, 0x6452ab94
-0, 46800, 38016, 0xdb269049
-0, 50400, 38016, 0xc7ab8864
-0, 54000, 38016, 0xbb828f4a
-0, 57600, 38016, 0x4fb3a61a
+#tb 0: 1/25
+0, 0, 0, 1, 38016, 0xee831fe4
+0, 1, 1, 1, 38016, 0x1098ff23
+0, 2, 2, 1, 38016, 0x8fc3e078
+0, 3, 3, 1, 38016, 0x86530991
+0, 4, 4, 1, 38016, 0xdc8e279e
+0, 5, 5, 1, 38016, 0x54ea3234
+0, 6, 6, 1, 38016, 0x79014662
+0, 7, 7, 1, 38016, 0x5d0a5a88
+0, 8, 8, 1, 38016, 0xf712805d
+0, 9, 9, 1, 38016, 0x0a09937e
+0, 10, 10, 1, 38016, 0xfa62a1d7
+0, 11, 11, 1, 38016, 0x67c6a41b
+0, 12, 12, 1, 38016, 0x6452ab94
+0, 13, 13, 1, 38016, 0xdb269049
+0, 14, 14, 1, 38016, 0xc7ab8864
+0, 15, 15, 1, 38016, 0xbb828f4a
+0, 16, 16, 1, 38016, 0x4fb3a61a
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-caba2_sony_e b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-caba2_sony_e
index 0732027..c30083c 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-caba2_sony_e
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-caba2_sony_e
@@ -1,300 +1,301 @@
-0, 0, 38016, 0xb3883478
-0, 3600, 38016, 0x23a30e47
-0, 7200, 38016, 0xa0b7df0f
-0, 10800, 38016, 0x5cd9beed
-0, 14400, 38016, 0x13b09699
-0, 18000, 38016, 0x66697d65
-0, 21600, 38016, 0xf0486d0d
-0, 25200, 38016, 0xaf94644e
-0, 28800, 38016, 0x43c45981
-0, 32400, 38016, 0x8f655e70
-0, 36000, 38016, 0x3d747a52
-0, 39600, 38016, 0x906e95f9
-0, 43200, 38016, 0xdd3ea1a0
-0, 46800, 38016, 0x216eb0ee
-0, 50400, 38016, 0x06cbabfe
-0, 54000, 38016, 0xd41c9cf7
-0, 57600, 38016, 0x6d2fa58e
-0, 61200, 38016, 0x0adca6fc
-0, 64800, 38016, 0x51c49ad9
-0, 68400, 38016, 0x83e57a42
-0, 72000, 38016, 0xe47b5dad
-0, 75600, 38016, 0x5e123c13
-0, 79200, 38016, 0xad682f93
-0, 82800, 38016, 0x77b02d2c
-0, 86400, 38016, 0x976d316e
-0, 90000, 38016, 0x3d923c72
-0, 93600, 38016, 0xf073398d
-0, 97200, 38016, 0x6dc547b4
-0, 100800, 38016, 0xfa9859b3
-0, 104400, 38016, 0xfc3f77b9
-0, 108000, 38016, 0xed9563d3
-0, 111600, 38016, 0xc040929e
-0, 115200, 38016, 0x5562af3c
-0, 118800, 38016, 0xa56abc78
-0, 122400, 38016, 0x702ec702
-0, 126000, 38016, 0x8ee7c909
-0, 129600, 38016, 0x9065c44f
-0, 133200, 38016, 0x11e3c40b
-0, 136800, 38016, 0x20fbc27a
-0, 140400, 38016, 0xaeecc582
-0, 144000, 38016, 0x3b32ca4f
-0, 147600, 38016, 0x5464ce6c
-0, 151200, 38016, 0x41d4cd66
-0, 154800, 38016, 0x8a69c6ef
-0, 158400, 38016, 0x2c63c59e
-0, 162000, 38016, 0xe3728780
-0, 165600, 38016, 0xc60c9ca3
-0, 169200, 38016, 0x8299a65a
-0, 172800, 38016, 0x67d4b3d5
-0, 176400, 38016, 0xd650bd19
-0, 180000, 38016, 0xe8c9b285
-0, 183600, 38016, 0x9a3dba0c
-0, 187200, 38016, 0xb3f4bfc3
-0, 190800, 38016, 0xe3edbe71
-0, 194400, 38016, 0xea7fc14f
-0, 198000, 38016, 0x4560cb94
-0, 201600, 38016, 0x3b48ce1b
-0, 205200, 38016, 0xc668d24c
-0, 208800, 38016, 0x8bdcd514
-0, 212400, 38016, 0xd0f8d380
-0, 216000, 38016, 0x98a59a5a
-0, 219600, 38016, 0x086d9c52
-0, 223200, 38016, 0x50417af3
-0, 226800, 38016, 0xe8ae428b
-0, 230400, 38016, 0xb5663f68
-0, 234000, 38016, 0x452e6045
-0, 237600, 38016, 0x0412991e
-0, 241200, 38016, 0xa791d0c8
-0, 244800, 38016, 0x952c13e8
-0, 248400, 38016, 0x9356462c
-0, 252000, 38016, 0x34026bf3
-0, 255600, 38016, 0x3a109e70
-0, 259200, 38016, 0xc28dccb1
-0, 262800, 38016, 0x445f08e7
-0, 266400, 38016, 0x1e0c4781
-0, 270000, 38016, 0x4c0b3afa
-0, 273600, 38016, 0x90147b21
-0, 277200, 38016, 0xe6fb9ee6
-0, 280800, 38016, 0x3bbac15a
-0, 284400, 38016, 0x113ecc97
-0, 288000, 38016, 0xa271e248
-0, 291600, 38016, 0xbc97f36a
-0, 295200, 38016, 0x2a5af366
-0, 298800, 38016, 0xc171ec49
-0, 302400, 38016, 0x2393e85e
-0, 306000, 38016, 0xbf59eeb0
-0, 309600, 38016, 0xcec2f989
-0, 313200, 38016, 0x3cb8fcb3
-0, 316800, 38016, 0x28150278
-0, 320400, 38016, 0x27f70026
-0, 324000, 38016, 0x8fa69f07
-0, 327600, 38016, 0x198b9a79
-0, 331200, 38016, 0x40928d52
-0, 334800, 38016, 0x1504834e
-0, 338400, 38016, 0xb53677ab
-0, 342000, 38016, 0x2e2c783d
-0, 345600, 38016, 0x5fd38e3a
-0, 349200, 38016, 0x697e9cd3
-0, 352800, 38016, 0x0b18ad4b
-0, 356400, 38016, 0x6ad7b78f
-0, 360000, 38016, 0x6af3c654
-0, 363600, 38016, 0x5aabb804
-0, 367200, 38016, 0x9b5aa6e5
-0, 370800, 38016, 0x2993a311
-0, 374400, 38016, 0x1382b8e5
-0, 378000, 38016, 0xf294a253
-0, 381600, 38016, 0xafa5c2a5
-0, 385200, 38016, 0x621ce2b5
-0, 388800, 38016, 0x676c0440
-0, 392400, 38016, 0xa7c31e07
-0, 396000, 38016, 0x29612ba2
-0, 399600, 38016, 0xb38c3920
-0, 403200, 38016, 0xfcce3ee5
-0, 406800, 38016, 0x3ee81fac
-0, 410400, 38016, 0x635cfdb0
-0, 414000, 38016, 0x222afa63
-0, 417600, 38016, 0x230c09cb
-0, 421200, 38016, 0x2b491802
-0, 424800, 38016, 0x9cac2164
-0, 428400, 38016, 0xa0532de8
-0, 432000, 38016, 0x32e93592
-0, 435600, 38016, 0x724033a9
-0, 439200, 38016, 0x74411884
-0, 442800, 38016, 0xae14efcf
-0, 446400, 38016, 0x0188cdc7
-0, 450000, 38016, 0x5708b5c1
-0, 453600, 38016, 0x54aba6da
-0, 457200, 38016, 0x7364b397
-0, 460800, 38016, 0xf676c547
-0, 464400, 38016, 0x6926db3a
-0, 468000, 38016, 0xccdbe5be
-0, 471600, 38016, 0x8fc8e490
-0, 475200, 38016, 0x5d7fdd35
-0, 478800, 38016, 0x0e27e010
-0, 482400, 38016, 0x8120dd43
-0, 486000, 38016, 0x1612a173
-0, 489600, 38016, 0x3f1cb4b7
-0, 493200, 38016, 0xd1c7b0a6
-0, 496800, 38016, 0x472baad5
-0, 500400, 38016, 0xfe37a1f3
-0, 504000, 38016, 0x42a391ba
-0, 507600, 38016, 0xdb618cac
-0, 511200, 38016, 0x7af879bf
-0, 514800, 38016, 0xe6f27644
-0, 518400, 38016, 0x550a7f0c
-0, 522000, 38016, 0x7d297eaa
-0, 525600, 38016, 0xaeb57623
-0, 529200, 38016, 0x6d5e4995
-0, 532800, 38016, 0x57df1be0
-0, 536400, 38016, 0x7617f825
-0, 540000, 38016, 0xf731aef2
-0, 543600, 38016, 0x489aae6c
-0, 547200, 38016, 0x2d80b7a4
-0, 550800, 38016, 0xe4b6ac4e
-0, 554400, 38016, 0xd243a374
-0, 558000, 38016, 0x5cf9b85b
-0, 561600, 38016, 0xe824d798
-0, 565200, 38016, 0x8a46f630
-0, 568800, 38016, 0x4a03337f
-0, 572400, 38016, 0xefe25cf7
-0, 576000, 38016, 0xed876efa
-0, 579600, 38016, 0xdf1b6b65
-0, 583200, 38016, 0xd3225d8c
-0, 586800, 38016, 0x0cf04d8d
-0, 590400, 38016, 0x0fdc3bb3
-0, 594000, 38016, 0xc31bf5da
-0, 597600, 38016, 0x09e0ec79
-0, 601200, 38016, 0x6521c8fb
-0, 604800, 38016, 0x6f67a94c
-0, 608400, 38016, 0xa0a49f38
-0, 612000, 38016, 0x759fb6f2
-0, 615600, 38016, 0xea41ddf8
-0, 619200, 38016, 0xe559f0a6
-0, 622800, 38016, 0x1dcbec38
-0, 626400, 38016, 0xfb62dc6a
-0, 630000, 38016, 0x3d0fac24
-0, 633600, 38016, 0x87c373a1
-0, 637200, 38016, 0x97a84562
-0, 640800, 38016, 0xe4361c2e
-0, 644400, 38016, 0x21170c47
-0, 648000, 38016, 0x0769ec52
-0, 651600, 38016, 0xac1ad44d
-0, 655200, 38016, 0xdf87cb3e
-0, 658800, 38016, 0x95c0d66f
-0, 662400, 38016, 0xba33da6f
-0, 666000, 38016, 0x71b2e866
-0, 669600, 38016, 0x64540dd1
-0, 673200, 38016, 0x79cb2d92
-0, 676800, 38016, 0xfe8e394b
-0, 680400, 38016, 0x648f443f
-0, 684000, 38016, 0x491eee56
-0, 687600, 38016, 0x6195b91b
-0, 691200, 38016, 0x3935c2b0
-0, 694800, 38016, 0x2408e296
-0, 698400, 38016, 0xe17106b5
-0, 702000, 38016, 0xd8d01ad1
-0, 705600, 38016, 0x85d15104
-0, 709200, 38016, 0xacc16731
-0, 712800, 38016, 0xb6a990b7
-0, 716400, 38016, 0x8153a9cd
-0, 720000, 38016, 0xef5ab92a
-0, 723600, 38016, 0x392acfab
-0, 727200, 38016, 0x7031d48e
-0, 730800, 38016, 0x5d3ed39f
-0, 734400, 38016, 0x004fd516
-0, 738000, 38016, 0x8de7dc94
-0, 741600, 38016, 0x7e21db4a
-0, 745200, 38016, 0x518dd829
-0, 748800, 38016, 0xf780cf45
-0, 752400, 38016, 0x0a49bd6f
-0, 756000, 38016, 0xadb65d17
-0, 759600, 38016, 0xbe79629d
-0, 763200, 38016, 0x2daa65c8
-0, 766800, 38016, 0x0b4a6737
-0, 770400, 38016, 0x8e705885
-0, 774000, 38016, 0x6d2a4af2
-0, 777600, 38016, 0x89fe4b54
-0, 781200, 38016, 0x90cb4dde
-0, 784800, 38016, 0x2d9e4f4e
-0, 788400, 38016, 0x5fcd4a7b
-0, 792000, 38016, 0xdb4143e7
-0, 795600, 38016, 0xd9343662
-0, 799200, 38016, 0xdf4a2af2
-0, 802800, 38016, 0xbe8f1fd2
-0, 806400, 38016, 0x4658200f
-0, 810000, 38016, 0x92b51315
-0, 813600, 38016, 0x441f1576
-0, 817200, 38016, 0x970b29b4
-0, 820800, 38016, 0x93ac40f2
-0, 824400, 38016, 0xa0ac6b06
-0, 828000, 38016, 0xdd5b8f01
-0, 831600, 38016, 0xa921b3d5
-0, 835200, 38016, 0xdd6fdf01
-0, 838800, 38016, 0x1c6c0306
-0, 842400, 38016, 0xcea2235d
-0, 846000, 38016, 0x43853758
-0, 849600, 38016, 0xa0234e29
-0, 853200, 38016, 0x94c85022
-0, 856800, 38016, 0xaf4e33ab
-0, 860400, 38016, 0x07f90e0c
-0, 864000, 38016, 0x99cee4bd
-0, 867600, 38016, 0xb7cdcf79
-0, 871200, 38016, 0x5923c14c
-0, 874800, 38016, 0x771f15d4
-0, 878400, 38016, 0x20f08043
-0, 882000, 38016, 0xb7bfeab2
-0, 885600, 38016, 0x53440996
-0, 889200, 38016, 0x6452d384
-0, 892800, 38016, 0xabcb975e
-0, 896400, 38016, 0x146123b9
-0, 900000, 38016, 0xbeddbfff
-0, 903600, 38016, 0xa0c97c47
-0, 907200, 38016, 0x1dca7308
-0, 910800, 38016, 0x16c5c832
-0, 914400, 38016, 0xcab326b9
-0, 918000, 38016, 0xe952c9bd
-0, 921600, 38016, 0x216ec182
-0, 925200, 38016, 0xb21a5074
-0, 928800, 38016, 0xcbe73c15
-0, 932400, 38016, 0xb5e532de
-0, 936000, 38016, 0x3a693aa5
-0, 939600, 38016, 0x157f4a20
-0, 943200, 38016, 0x9f9a5868
-0, 946800, 38016, 0x50f65ea1
-0, 950400, 38016, 0xe1735d4f
-0, 954000, 38016, 0x15284ec7
-0, 957600, 38016, 0x32433d94
-0, 961200, 38016, 0x768f2092
-0, 964800, 38016, 0x6b01f5ad
-0, 968400, 38016, 0xadcbce27
-0, 972000, 38016, 0x6faca613
-0, 975600, 38016, 0xd9327d40
-0, 979200, 38016, 0xbc1060ef
-0, 982800, 38016, 0xbe071251
-0, 986400, 38016, 0x47abbfaa
-0, 990000, 38016, 0x4851af88
-0, 993600, 38016, 0xff53c772
-0, 997200, 38016, 0xa1dcbef5
-0, 1000800, 38016, 0x106df309
-0, 1004400, 38016, 0x92e65f13
-0, 1008000, 38016, 0x7e8ffdb9
-0, 1011600, 38016, 0x0ba4d317
-0, 1015200, 38016, 0xe038a2a2
-0, 1018800, 38016, 0xc479675b
-0, 1022400, 38016, 0xadbc4d18
-0, 1026000, 38016, 0x2d41a44b
-0, 1029600, 38016, 0x3240617d
-0, 1033200, 38016, 0xa60f9b98
-0, 1036800, 38016, 0x3aeea379
-0, 1040400, 38016, 0x45a0936c
-0, 1044000, 38016, 0xf0c42d2f
-0, 1047600, 38016, 0x930343ee
-0, 1051200, 38016, 0xe074d631
-0, 1054800, 38016, 0xc6f20ab5
-0, 1058400, 38016, 0x3f5a4ef7
-0, 1062000, 38016, 0x94d44b16
-0, 1065600, 38016, 0xa52427da
-0, 1069200, 38016, 0x2f2116a1
-0, 1072800, 38016, 0x566c2541
-0, 1076400, 38016, 0x0b894c8b
+#tb 0: 1/25
+0, 0, 0, 1, 38016, 0xb3883478
+0, 1, 1, 1, 38016, 0x23a30e47
+0, 2, 2, 1, 38016, 0xa0b7df0f
+0, 3, 3, 1, 38016, 0x5cd9beed
+0, 4, 4, 1, 38016, 0x13b09699
+0, 5, 5, 1, 38016, 0x66697d65
+0, 6, 6, 1, 38016, 0xf0486d0d
+0, 7, 7, 1, 38016, 0xaf94644e
+0, 8, 8, 1, 38016, 0x43c45981
+0, 9, 9, 1, 38016, 0x8f655e70
+0, 10, 10, 1, 38016, 0x3d747a52
+0, 11, 11, 1, 38016, 0x906e95f9
+0, 12, 12, 1, 38016, 0xdd3ea1a0
+0, 13, 13, 1, 38016, 0x216eb0ee
+0, 14, 14, 1, 38016, 0x06cbabfe
+0, 15, 15, 1, 38016, 0xd41c9cf7
+0, 16, 16, 1, 38016, 0x6d2fa58e
+0, 17, 17, 1, 38016, 0x0adca6fc
+0, 18, 18, 1, 38016, 0x51c49ad9
+0, 19, 19, 1, 38016, 0x83e57a42
+0, 20, 20, 1, 38016, 0xe47b5dad
+0, 21, 21, 1, 38016, 0x5e123c13
+0, 22, 22, 1, 38016, 0xad682f93
+0, 23, 23, 1, 38016, 0x77b02d2c
+0, 24, 24, 1, 38016, 0x976d316e
+0, 25, 25, 1, 38016, 0x3d923c72
+0, 26, 26, 1, 38016, 0xf073398d
+0, 27, 27, 1, 38016, 0x6dc547b4
+0, 28, 28, 1, 38016, 0xfa9859b3
+0, 29, 29, 1, 38016, 0xfc3f77b9
+0, 30, 30, 1, 38016, 0xed9563d3
+0, 31, 31, 1, 38016, 0xc040929e
+0, 32, 32, 1, 38016, 0x5562af3c
+0, 33, 33, 1, 38016, 0xa56abc78
+0, 34, 34, 1, 38016, 0x702ec702
+0, 35, 35, 1, 38016, 0x8ee7c909
+0, 36, 36, 1, 38016, 0x9065c44f
+0, 37, 37, 1, 38016, 0x11e3c40b
+0, 38, 38, 1, 38016, 0x20fbc27a
+0, 39, 39, 1, 38016, 0xaeecc582
+0, 40, 40, 1, 38016, 0x3b32ca4f
+0, 41, 41, 1, 38016, 0x5464ce6c
+0, 42, 42, 1, 38016, 0x41d4cd66
+0, 43, 43, 1, 38016, 0x8a69c6ef
+0, 44, 44, 1, 38016, 0x2c63c59e
+0, 45, 45, 1, 38016, 0xe3728780
+0, 46, 46, 1, 38016, 0xc60c9ca3
+0, 47, 47, 1, 38016, 0x8299a65a
+0, 48, 48, 1, 38016, 0x67d4b3d5
+0, 49, 49, 1, 38016, 0xd650bd19
+0, 50, 50, 1, 38016, 0xe8c9b285
+0, 51, 51, 1, 38016, 0x9a3dba0c
+0, 52, 52, 1, 38016, 0xb3f4bfc3
+0, 53, 53, 1, 38016, 0xe3edbe71
+0, 54, 54, 1, 38016, 0xea7fc14f
+0, 55, 55, 1, 38016, 0x4560cb94
+0, 56, 56, 1, 38016, 0x3b48ce1b
+0, 57, 57, 1, 38016, 0xc668d24c
+0, 58, 58, 1, 38016, 0x8bdcd514
+0, 59, 59, 1, 38016, 0xd0f8d380
+0, 60, 60, 1, 38016, 0x98a59a5a
+0, 61, 61, 1, 38016, 0x086d9c52
+0, 62, 62, 1, 38016, 0x50417af3
+0, 63, 63, 1, 38016, 0xe8ae428b
+0, 64, 64, 1, 38016, 0xb5663f68
+0, 65, 65, 1, 38016, 0x452e6045
+0, 66, 66, 1, 38016, 0x0412991e
+0, 67, 67, 1, 38016, 0xa791d0c8
+0, 68, 68, 1, 38016, 0x952c13e8
+0, 69, 69, 1, 38016, 0x9356462c
+0, 70, 70, 1, 38016, 0x34026bf3
+0, 71, 71, 1, 38016, 0x3a109e70
+0, 72, 72, 1, 38016, 0xc28dccb1
+0, 73, 73, 1, 38016, 0x445f08e7
+0, 74, 74, 1, 38016, 0x1e0c4781
+0, 75, 75, 1, 38016, 0x4c0b3afa
+0, 76, 76, 1, 38016, 0x90147b21
+0, 77, 77, 1, 38016, 0xe6fb9ee6
+0, 78, 78, 1, 38016, 0x3bbac15a
+0, 79, 79, 1, 38016, 0x113ecc97
+0, 80, 80, 1, 38016, 0xa271e248
+0, 81, 81, 1, 38016, 0xbc97f36a
+0, 82, 82, 1, 38016, 0x2a5af366
+0, 83, 83, 1, 38016, 0xc171ec49
+0, 84, 84, 1, 38016, 0x2393e85e
+0, 85, 85, 1, 38016, 0xbf59eeb0
+0, 86, 86, 1, 38016, 0xcec2f989
+0, 87, 87, 1, 38016, 0x3cb8fcb3
+0, 88, 88, 1, 38016, 0x28150278
+0, 89, 89, 1, 38016, 0x27f70026
+0, 90, 90, 1, 38016, 0x8fa69f07
+0, 91, 91, 1, 38016, 0x198b9a79
+0, 92, 92, 1, 38016, 0x40928d52
+0, 93, 93, 1, 38016, 0x1504834e
+0, 94, 94, 1, 38016, 0xb53677ab
+0, 95, 95, 1, 38016, 0x2e2c783d
+0, 96, 96, 1, 38016, 0x5fd38e3a
+0, 97, 97, 1, 38016, 0x697e9cd3
+0, 98, 98, 1, 38016, 0x0b18ad4b
+0, 99, 99, 1, 38016, 0x6ad7b78f
+0, 100, 100, 1, 38016, 0x6af3c654
+0, 101, 101, 1, 38016, 0x5aabb804
+0, 102, 102, 1, 38016, 0x9b5aa6e5
+0, 103, 103, 1, 38016, 0x2993a311
+0, 104, 104, 1, 38016, 0x1382b8e5
+0, 105, 105, 1, 38016, 0xf294a253
+0, 106, 106, 1, 38016, 0xafa5c2a5
+0, 107, 107, 1, 38016, 0x621ce2b5
+0, 108, 108, 1, 38016, 0x676c0440
+0, 109, 109, 1, 38016, 0xa7c31e07
+0, 110, 110, 1, 38016, 0x29612ba2
+0, 111, 111, 1, 38016, 0xb38c3920
+0, 112, 112, 1, 38016, 0xfcce3ee5
+0, 113, 113, 1, 38016, 0x3ee81fac
+0, 114, 114, 1, 38016, 0x635cfdb0
+0, 115, 115, 1, 38016, 0x222afa63
+0, 116, 116, 1, 38016, 0x230c09cb
+0, 117, 117, 1, 38016, 0x2b491802
+0, 118, 118, 1, 38016, 0x9cac2164
+0, 119, 119, 1, 38016, 0xa0532de8
+0, 120, 120, 1, 38016, 0x32e93592
+0, 121, 121, 1, 38016, 0x724033a9
+0, 122, 122, 1, 38016, 0x74411884
+0, 123, 123, 1, 38016, 0xae14efcf
+0, 124, 124, 1, 38016, 0x0188cdc7
+0, 125, 125, 1, 38016, 0x5708b5c1
+0, 126, 126, 1, 38016, 0x54aba6da
+0, 127, 127, 1, 38016, 0x7364b397
+0, 128, 128, 1, 38016, 0xf676c547
+0, 129, 129, 1, 38016, 0x6926db3a
+0, 130, 130, 1, 38016, 0xccdbe5be
+0, 131, 131, 1, 38016, 0x8fc8e490
+0, 132, 132, 1, 38016, 0x5d7fdd35
+0, 133, 133, 1, 38016, 0x0e27e010
+0, 134, 134, 1, 38016, 0x8120dd43
+0, 135, 135, 1, 38016, 0x1612a173
+0, 136, 136, 1, 38016, 0x3f1cb4b7
+0, 137, 137, 1, 38016, 0xd1c7b0a6
+0, 138, 138, 1, 38016, 0x472baad5
+0, 139, 139, 1, 38016, 0xfe37a1f3
+0, 140, 140, 1, 38016, 0x42a391ba
+0, 141, 141, 1, 38016, 0xdb618cac
+0, 142, 142, 1, 38016, 0x7af879bf
+0, 143, 143, 1, 38016, 0xe6f27644
+0, 144, 144, 1, 38016, 0x550a7f0c
+0, 145, 145, 1, 38016, 0x7d297eaa
+0, 146, 146, 1, 38016, 0xaeb57623
+0, 147, 147, 1, 38016, 0x6d5e4995
+0, 148, 148, 1, 38016, 0x57df1be0
+0, 149, 149, 1, 38016, 0x7617f825
+0, 150, 150, 1, 38016, 0xf731aef2
+0, 151, 151, 1, 38016, 0x489aae6c
+0, 152, 152, 1, 38016, 0x2d80b7a4
+0, 153, 153, 1, 38016, 0xe4b6ac4e
+0, 154, 154, 1, 38016, 0xd243a374
+0, 155, 155, 1, 38016, 0x5cf9b85b
+0, 156, 156, 1, 38016, 0xe824d798
+0, 157, 157, 1, 38016, 0x8a46f630
+0, 158, 158, 1, 38016, 0x4a03337f
+0, 159, 159, 1, 38016, 0xefe25cf7
+0, 160, 160, 1, 38016, 0xed876efa
+0, 161, 161, 1, 38016, 0xdf1b6b65
+0, 162, 162, 1, 38016, 0xd3225d8c
+0, 163, 163, 1, 38016, 0x0cf04d8d
+0, 164, 164, 1, 38016, 0x0fdc3bb3
+0, 165, 165, 1, 38016, 0xc31bf5da
+0, 166, 166, 1, 38016, 0x09e0ec79
+0, 167, 167, 1, 38016, 0x6521c8fb
+0, 168, 168, 1, 38016, 0x6f67a94c
+0, 169, 169, 1, 38016, 0xa0a49f38
+0, 170, 170, 1, 38016, 0x759fb6f2
+0, 171, 171, 1, 38016, 0xea41ddf8
+0, 172, 172, 1, 38016, 0xe559f0a6
+0, 173, 173, 1, 38016, 0x1dcbec38
+0, 174, 174, 1, 38016, 0xfb62dc6a
+0, 175, 175, 1, 38016, 0x3d0fac24
+0, 176, 176, 1, 38016, 0x87c373a1
+0, 177, 177, 1, 38016, 0x97a84562
+0, 178, 178, 1, 38016, 0xe4361c2e
+0, 179, 179, 1, 38016, 0x21170c47
+0, 180, 180, 1, 38016, 0x0769ec52
+0, 181, 181, 1, 38016, 0xac1ad44d
+0, 182, 182, 1, 38016, 0xdf87cb3e
+0, 183, 183, 1, 38016, 0x95c0d66f
+0, 184, 184, 1, 38016, 0xba33da6f
+0, 185, 185, 1, 38016, 0x71b2e866
+0, 186, 186, 1, 38016, 0x64540dd1
+0, 187, 187, 1, 38016, 0x79cb2d92
+0, 188, 188, 1, 38016, 0xfe8e394b
+0, 189, 189, 1, 38016, 0x648f443f
+0, 190, 190, 1, 38016, 0x491eee56
+0, 191, 191, 1, 38016, 0x6195b91b
+0, 192, 192, 1, 38016, 0x3935c2b0
+0, 193, 193, 1, 38016, 0x2408e296
+0, 194, 194, 1, 38016, 0xe17106b5
+0, 195, 195, 1, 38016, 0xd8d01ad1
+0, 196, 196, 1, 38016, 0x85d15104
+0, 197, 197, 1, 38016, 0xacc16731
+0, 198, 198, 1, 38016, 0xb6a990b7
+0, 199, 199, 1, 38016, 0x8153a9cd
+0, 200, 200, 1, 38016, 0xef5ab92a
+0, 201, 201, 1, 38016, 0x392acfab
+0, 202, 202, 1, 38016, 0x7031d48e
+0, 203, 203, 1, 38016, 0x5d3ed39f
+0, 204, 204, 1, 38016, 0x004fd516
+0, 205, 205, 1, 38016, 0x8de7dc94
+0, 206, 206, 1, 38016, 0x7e21db4a
+0, 207, 207, 1, 38016, 0x518dd829
+0, 208, 208, 1, 38016, 0xf780cf45
+0, 209, 209, 1, 38016, 0x0a49bd6f
+0, 210, 210, 1, 38016, 0xadb65d17
+0, 211, 211, 1, 38016, 0xbe79629d
+0, 212, 212, 1, 38016, 0x2daa65c8
+0, 213, 213, 1, 38016, 0x0b4a6737
+0, 214, 214, 1, 38016, 0x8e705885
+0, 215, 215, 1, 38016, 0x6d2a4af2
+0, 216, 216, 1, 38016, 0x89fe4b54
+0, 217, 217, 1, 38016, 0x90cb4dde
+0, 218, 218, 1, 38016, 0x2d9e4f4e
+0, 219, 219, 1, 38016, 0x5fcd4a7b
+0, 220, 220, 1, 38016, 0xdb4143e7
+0, 221, 221, 1, 38016, 0xd9343662
+0, 222, 222, 1, 38016, 0xdf4a2af2
+0, 223, 223, 1, 38016, 0xbe8f1fd2
+0, 224, 224, 1, 38016, 0x4658200f
+0, 225, 225, 1, 38016, 0x92b51315
+0, 226, 226, 1, 38016, 0x441f1576
+0, 227, 227, 1, 38016, 0x970b29b4
+0, 228, 228, 1, 38016, 0x93ac40f2
+0, 229, 229, 1, 38016, 0xa0ac6b06
+0, 230, 230, 1, 38016, 0xdd5b8f01
+0, 231, 231, 1, 38016, 0xa921b3d5
+0, 232, 232, 1, 38016, 0xdd6fdf01
+0, 233, 233, 1, 38016, 0x1c6c0306
+0, 234, 234, 1, 38016, 0xcea2235d
+0, 235, 235, 1, 38016, 0x43853758
+0, 236, 236, 1, 38016, 0xa0234e29
+0, 237, 237, 1, 38016, 0x94c85022
+0, 238, 238, 1, 38016, 0xaf4e33ab
+0, 239, 239, 1, 38016, 0x07f90e0c
+0, 240, 240, 1, 38016, 0x99cee4bd
+0, 241, 241, 1, 38016, 0xb7cdcf79
+0, 242, 242, 1, 38016, 0x5923c14c
+0, 243, 243, 1, 38016, 0x771f15d4
+0, 244, 244, 1, 38016, 0x20f08043
+0, 245, 245, 1, 38016, 0xb7bfeab2
+0, 246, 246, 1, 38016, 0x53440996
+0, 247, 247, 1, 38016, 0x6452d384
+0, 248, 248, 1, 38016, 0xabcb975e
+0, 249, 249, 1, 38016, 0x146123b9
+0, 250, 250, 1, 38016, 0xbeddbfff
+0, 251, 251, 1, 38016, 0xa0c97c47
+0, 252, 252, 1, 38016, 0x1dca7308
+0, 253, 253, 1, 38016, 0x16c5c832
+0, 254, 254, 1, 38016, 0xcab326b9
+0, 255, 255, 1, 38016, 0xe952c9bd
+0, 256, 256, 1, 38016, 0x216ec182
+0, 257, 257, 1, 38016, 0xb21a5074
+0, 258, 258, 1, 38016, 0xcbe73c15
+0, 259, 259, 1, 38016, 0xb5e532de
+0, 260, 260, 1, 38016, 0x3a693aa5
+0, 261, 261, 1, 38016, 0x157f4a20
+0, 262, 262, 1, 38016, 0x9f9a5868
+0, 263, 263, 1, 38016, 0x50f65ea1
+0, 264, 264, 1, 38016, 0xe1735d4f
+0, 265, 265, 1, 38016, 0x15284ec7
+0, 266, 266, 1, 38016, 0x32433d94
+0, 267, 267, 1, 38016, 0x768f2092
+0, 268, 268, 1, 38016, 0x6b01f5ad
+0, 269, 269, 1, 38016, 0xadcbce27
+0, 270, 270, 1, 38016, 0x6faca613
+0, 271, 271, 1, 38016, 0xd9327d40
+0, 272, 272, 1, 38016, 0xbc1060ef
+0, 273, 273, 1, 38016, 0xbe071251
+0, 274, 274, 1, 38016, 0x47abbfaa
+0, 275, 275, 1, 38016, 0x4851af88
+0, 276, 276, 1, 38016, 0xff53c772
+0, 277, 277, 1, 38016, 0xa1dcbef5
+0, 278, 278, 1, 38016, 0x106df309
+0, 279, 279, 1, 38016, 0x92e65f13
+0, 280, 280, 1, 38016, 0x7e8ffdb9
+0, 281, 281, 1, 38016, 0x0ba4d317
+0, 282, 282, 1, 38016, 0xe038a2a2
+0, 283, 283, 1, 38016, 0xc479675b
+0, 284, 284, 1, 38016, 0xadbc4d18
+0, 285, 285, 1, 38016, 0x2d41a44b
+0, 286, 286, 1, 38016, 0x3240617d
+0, 287, 287, 1, 38016, 0xa60f9b98
+0, 288, 288, 1, 38016, 0x3aeea379
+0, 289, 289, 1, 38016, 0x45a0936c
+0, 290, 290, 1, 38016, 0xf0c42d2f
+0, 291, 291, 1, 38016, 0x930343ee
+0, 292, 292, 1, 38016, 0xe074d631
+0, 293, 293, 1, 38016, 0xc6f20ab5
+0, 294, 294, 1, 38016, 0x3f5a4ef7
+0, 295, 295, 1, 38016, 0x94d44b16
+0, 296, 296, 1, 38016, 0xa52427da
+0, 297, 297, 1, 38016, 0x2f2116a1
+0, 298, 298, 1, 38016, 0x566c2541
+0, 299, 299, 1, 38016, 0x0b894c8b
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-caba2_sva_b b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-caba2_sva_b
index af25df7..ca89226 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-caba2_sva_b
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-caba2_sva_b
@@ -1,17 +1,18 @@
-0, 0, 38016, 0xee831fe4
-0, 3600, 38016, 0xd9130e19
-0, 7200, 38016, 0x8ad70cae
-0, 10800, 38016, 0x98f11d0e
-0, 14400, 38016, 0x311d46ea
-0, 18000, 38016, 0xe2f15cc5
-0, 21600, 38016, 0xb4c174c6
-0, 25200, 38016, 0x22708406
-0, 28800, 38016, 0x7116a2d2
-0, 32400, 38016, 0x7937b29b
-0, 36000, 38016, 0xfa62a1d7
-0, 39600, 38016, 0x2066b1c6
-0, 43200, 38016, 0x18ecaa40
-0, 46800, 38016, 0xe5dc8d99
-0, 50400, 38016, 0x77046f4a
-0, 54000, 38016, 0x1c50704f
-0, 57600, 38016, 0x87f1879d
+#tb 0: 1/25
+0, 0, 0, 1, 38016, 0xee831fe4
+0, 1, 1, 1, 38016, 0xd9130e19
+0, 2, 2, 1, 38016, 0x8ad70cae
+0, 3, 3, 1, 38016, 0x98f11d0e
+0, 4, 4, 1, 38016, 0x311d46ea
+0, 5, 5, 1, 38016, 0xe2f15cc5
+0, 6, 6, 1, 38016, 0xb4c174c6
+0, 7, 7, 1, 38016, 0x22708406
+0, 8, 8, 1, 38016, 0x7116a2d2
+0, 9, 9, 1, 38016, 0x7937b29b
+0, 10, 10, 1, 38016, 0xfa62a1d7
+0, 11, 11, 1, 38016, 0x2066b1c6
+0, 12, 12, 1, 38016, 0x18ecaa40
+0, 13, 13, 1, 38016, 0xe5dc8d99
+0, 14, 14, 1, 38016, 0x77046f4a
+0, 15, 15, 1, 38016, 0x1c50704f
+0, 16, 16, 1, 38016, 0x87f1879d
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-caba3_sony_c b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-caba3_sony_c
index d5465b3..c7aee37 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-caba3_sony_c
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-caba3_sony_c
@@ -1,300 +1,301 @@
-0, 0, 38016, 0xb3883478
-0, 3600, 38016, 0xb6261cdd
-0, 7200, 38016, 0x42ecede9
-0, 10800, 38016, 0xfcd6aec1
-0, 14400, 38016, 0xb3ffa014
-0, 18000, 38016, 0xc65383e3
-0, 21600, 38016, 0xa8494fb1
-0, 25200, 38016, 0x7fb14e0f
-0, 28800, 38016, 0x7dd3462a
-0, 32400, 38016, 0x4bd43dda
-0, 36000, 38016, 0x717e736f
-0, 39600, 38016, 0x2a9b8e47
-0, 43200, 38016, 0x1bc272be
-0, 46800, 38016, 0x0127afb5
-0, 50400, 38016, 0xfd7aacda
-0, 54000, 38016, 0xd41c9cf7
-0, 57600, 38016, 0xd205b1ee
-0, 61200, 38016, 0x967ca895
-0, 64800, 38016, 0x25978063
-0, 68400, 38016, 0x632081b3
-0, 72000, 38016, 0x8ccf5f0b
-0, 75600, 38016, 0x21cc2141
-0, 79200, 38016, 0x477d2543
-0, 82800, 38016, 0xff971bb8
-0, 86400, 38016, 0x0dc21005
-0, 90000, 38016, 0xc69c2d90
-0, 93600, 38016, 0xd7922b5d
-0, 97200, 38016, 0x59a3278f
-0, 100800, 38016, 0x83c55d4d
-0, 104400, 38016, 0xaac96f23
-0, 108000, 38016, 0xed9563d3
-0, 111600, 38016, 0xf86b9ef4
-0, 115200, 38016, 0xe616b81c
-0, 118800, 38016, 0xde60a57b
-0, 122400, 38016, 0x5fe8d130
-0, 126000, 38016, 0x11decaca
-0, 129600, 38016, 0x526fa8e2
-0, 133200, 38016, 0xc5e7ccfb
-0, 136800, 38016, 0x10e1c588
-0, 140400, 38016, 0x78aeb05b
-0, 144000, 38016, 0xff85c717
-0, 147600, 38016, 0x3f02c1b2
-0, 151200, 38016, 0xf45eb015
-0, 154800, 38016, 0x0211b84d
-0, 158400, 38016, 0x3864ba1f
-0, 162000, 38016, 0xe3728780
-0, 165600, 38016, 0x575da8b5
-0, 169200, 38016, 0xc841ad98
-0, 172800, 38016, 0xe69ea78f
-0, 176400, 38016, 0x45cabf16
-0, 180000, 38016, 0x0e00b8eb
-0, 183600, 38016, 0xa774a808
-0, 187200, 38016, 0xfb1bbc2b
-0, 190800, 38016, 0xcfb4b41d
-0, 194400, 38016, 0x66abaff8
-0, 198000, 38016, 0xc39ac9a9
-0, 201600, 38016, 0xbec0cc9a
-0, 205200, 38016, 0xf393c7fc
-0, 208800, 38016, 0xedb5d4ef
-0, 212400, 38016, 0x4b0fd4fe
-0, 216000, 38016, 0x98a59a5a
-0, 219600, 38016, 0x0a69a4f3
-0, 223200, 38016, 0x72bc89ce
-0, 226800, 38016, 0xfe8538b6
-0, 230400, 38016, 0xc8a158a3
-0, 234000, 38016, 0x1cb57fcd
-0, 237600, 38016, 0x76c29215
-0, 241200, 38016, 0xdb36ec21
-0, 244800, 38016, 0xc2e22427
-0, 248400, 38016, 0xafb433cd
-0, 252000, 38016, 0x4d736e28
-0, 255600, 38016, 0xc6ab9949
-0, 259200, 38016, 0xaa9bb9e6
-0, 262800, 38016, 0x0d41f894
-0, 266400, 38016, 0x603332b0
-0, 270000, 38016, 0x4c0b3afa
-0, 273600, 38016, 0x8fd3845e
-0, 277200, 38016, 0x8cf09ae3
-0, 280800, 38016, 0x1e02adfb
-0, 284400, 38016, 0x3c9ac38e
-0, 288000, 38016, 0xb5fdd2d9
-0, 291600, 38016, 0x82c5dd7f
-0, 295200, 38016, 0x4b6ee80a
-0, 298800, 38016, 0xaeaee46f
-0, 302400, 38016, 0x390ed382
-0, 306000, 38016, 0xedbfde44
-0, 309600, 38016, 0xabf6eba0
-0, 313200, 38016, 0x5bf5efd0
-0, 316800, 38016, 0x9a88ebe3
-0, 320400, 38016, 0x2af7ec3b
-0, 324000, 38016, 0x8fa69f07
-0, 327600, 38016, 0xff8fb3b5
-0, 331200, 38016, 0xd06fa3c1
-0, 334800, 38016, 0xe5a97d39
-0, 338400, 38016, 0x961e7c6f
-0, 342000, 38016, 0x18b278af
-0, 345600, 38016, 0x9a0d73d2
-0, 349200, 38016, 0x378f9d74
-0, 352800, 38016, 0x42e5a7a3
-0, 356400, 38016, 0x4595a78e
-0, 360000, 38016, 0x6c09c035
-0, 363600, 38016, 0xec58ab98
-0, 367200, 38016, 0x1b4b8d2b
-0, 370800, 38016, 0xf5199117
-0, 374400, 38016, 0xcd31af4d
-0, 378000, 38016, 0xf294a253
-0, 381600, 38016, 0x360dde6b
-0, 385200, 38016, 0x101cf70c
-0, 388800, 38016, 0x4b34ff17
-0, 392400, 38016, 0x520639c0
-0, 396000, 38016, 0x901840a9
-0, 399600, 38016, 0x4cb03284
-0, 403200, 38016, 0x6929470c
-0, 406800, 38016, 0x21282bdf
-0, 410400, 38016, 0xee8df0ec
-0, 414000, 38016, 0x24970e16
-0, 417600, 38016, 0x280118e3
-0, 421200, 38016, 0x00a10b64
-0, 424800, 38016, 0xb0673f83
-0, 428400, 38016, 0x838644de
-0, 432000, 38016, 0x32e93592
-0, 435600, 38016, 0xedfc477a
-0, 439200, 38016, 0x41062501
-0, 442800, 38016, 0xf218ebf2
-0, 446400, 38016, 0x3430dc73
-0, 450000, 38016, 0xb2fab8f0
-0, 453600, 38016, 0x11b19bab
-0, 457200, 38016, 0x8e30b8e7
-0, 460800, 38016, 0xc8b9c646
-0, 464400, 38016, 0xc902d559
-0, 468000, 38016, 0x3a24ec30
-0, 471600, 38016, 0x744de424
-0, 475200, 38016, 0xc40cd059
-0, 478800, 38016, 0xd98dd9ec
-0, 482400, 38016, 0x9719d698
-0, 486000, 38016, 0x1612a173
-0, 489600, 38016, 0xc044b9f1
-0, 493200, 38016, 0xc433af2f
-0, 496800, 38016, 0x559891e3
-0, 500400, 38016, 0x969e9a33
-0, 504000, 38016, 0x8a6a8e77
-0, 507600, 38016, 0x9d7b76bf
-0, 511200, 38016, 0x3725711a
-0, 514800, 38016, 0x5b316bd0
-0, 518400, 38016, 0x4c616abd
-0, 522000, 38016, 0x43637e2b
-0, 525600, 38016, 0xd9e36c4c
-0, 529200, 38016, 0x823d3596
-0, 532800, 38016, 0x57361a59
-0, 536400, 38016, 0x4a91f007
-0, 540000, 38016, 0xf731aef2
-0, 543600, 38016, 0x8ed2c618
-0, 547200, 38016, 0x6f1cc918
-0, 550800, 38016, 0x2a8ba336
-0, 554400, 38016, 0x8159b595
-0, 558000, 38016, 0x07cfced9
-0, 561600, 38016, 0x8804c878
-0, 565200, 38016, 0x624e0656
-0, 568800, 38016, 0x8628302b
-0, 572400, 38016, 0xd155461e
-0, 576000, 38016, 0x3c1c647c
-0, 579600, 38016, 0x8a485727
-0, 583200, 38016, 0x144934f7
-0, 586800, 38016, 0x43183494
-0, 590400, 38016, 0x20fd2ef2
-0, 594000, 38016, 0xc31bf5da
-0, 597600, 38016, 0x4c70f0f2
-0, 601200, 38016, 0xba1bcbcc
-0, 604800, 38016, 0x11039c6c
-0, 608400, 38016, 0x67c59b61
-0, 612000, 38016, 0xdc0aa2ba
-0, 615600, 38016, 0x1e2dbec9
-0, 619200, 38016, 0xacacdc6c
-0, 622800, 38016, 0x2049defe
-0, 626400, 38016, 0x7488cc3e
-0, 630000, 38016, 0x14bca829
-0, 633600, 38016, 0xc19c76ee
-0, 637200, 38016, 0xeca33612
-0, 640800, 38016, 0x93b027a5
-0, 644400, 38016, 0x82ae1e62
-0, 648000, 38016, 0x0769ec52
-0, 651600, 38016, 0x7cdee8dd
-0, 655200, 38016, 0x7d22d43d
-0, 658800, 38016, 0x65d8cd49
-0, 662400, 38016, 0xa7d2ede4
-0, 666000, 38016, 0x6bd2ffa1
-0, 669600, 38016, 0xb4db0734
-0, 673200, 38016, 0x69cb35ac
-0, 676800, 38016, 0x05e52e88
-0, 680400, 38016, 0x4dc92a43
-0, 684000, 38016, 0x8ca0e858
-0, 687600, 38016, 0x74fbae53
-0, 691200, 38016, 0x19f0aa17
-0, 694800, 38016, 0x04c9dc83
-0, 698400, 38016, 0x0a8ff4b9
-0, 702000, 38016, 0xd8d01ad1
-0, 705600, 38016, 0xa41b5100
-0, 709200, 38016, 0xfaf96547
-0, 712800, 38016, 0xadab8265
-0, 716400, 38016, 0x6e12a9c3
-0, 720000, 38016, 0x1de7b7d1
-0, 723600, 38016, 0x2279bc4a
-0, 727200, 38016, 0x4f62ca0f
-0, 730800, 38016, 0xfaf2cc43
-0, 734400, 38016, 0xbf68c7df
-0, 738000, 38016, 0xb927d1ea
-0, 741600, 38016, 0x8b93d7c6
-0, 745200, 38016, 0x13f3d7d6
-0, 748800, 38016, 0x9ee4cc7b
-0, 752400, 38016, 0x16deb1a0
-0, 756000, 38016, 0xadb65d17
-0, 759600, 38016, 0x0b9e7542
-0, 763200, 38016, 0x05777490
-0, 766800, 38016, 0x6805549f
-0, 770400, 38016, 0xe3246225
-0, 774000, 38016, 0x4003551b
-0, 777600, 38016, 0x1e083a01
-0, 781200, 38016, 0x756e4f22
-0, 784800, 38016, 0xf2f24967
-0, 788400, 38016, 0x680d37f2
-0, 792000, 38016, 0x85b34185
-0, 795600, 38016, 0xefa32eeb
-0, 799200, 38016, 0xca791448
-0, 802800, 38016, 0x7c6b2b13
-0, 806400, 38016, 0x0d8232a6
-0, 810000, 38016, 0x92b51315
-0, 813600, 38016, 0xcfde349c
-0, 817200, 38016, 0xdc1a488b
-0, 820800, 38016, 0xdcf94106
-0, 824400, 38016, 0xc205829b
-0, 828000, 38016, 0x0aff9da3
-0, 831600, 38016, 0x3295b04e
-0, 835200, 38016, 0xc42dfaab
-0, 838800, 38016, 0x799e14a2
-0, 842400, 38016, 0xf658150c
-0, 846000, 38016, 0x4c8751fe
-0, 849600, 38016, 0xe57d58ed
-0, 853200, 38016, 0x28f83c49
-0, 856800, 38016, 0x9760453c
-0, 860400, 38016, 0x1d550fcf
-0, 864000, 38016, 0x99cee4bd
-0, 867600, 38016, 0x743ad122
-0, 871200, 38016, 0xb533ab7c
-0, 874800, 38016, 0x5ca5fc65
-0, 878400, 38016, 0x491c7076
-0, 882000, 38016, 0x8a96d9e5
-0, 885600, 38016, 0x23c3f207
-0, 889200, 38016, 0x3181d62d
-0, 892800, 38016, 0xc72e9636
-0, 896400, 38016, 0xe0c31ae9
-0, 900000, 38016, 0x2f91c0ce
-0, 903600, 38016, 0x17937763
-0, 907200, 38016, 0x61986c20
-0, 910800, 38016, 0x6adeca83
-0, 914400, 38016, 0x894a376b
-0, 918000, 38016, 0xe952c9bd
-0, 921600, 38016, 0x0418d8e9
-0, 925200, 38016, 0x30de606e
-0, 928800, 38016, 0xd15e3116
-0, 932400, 38016, 0xee0446ac
-0, 936000, 38016, 0x34ee44f7
-0, 939600, 38016, 0x825745d4
-0, 943200, 38016, 0xb8046176
-0, 946800, 38016, 0xa812588a
-0, 950400, 38016, 0xed754b26
-0, 954000, 38016, 0xa39c51cd
-0, 957600, 38016, 0x315b38d5
-0, 961200, 38016, 0x12550e05
-0, 964800, 38016, 0xbda6fd9a
-0, 968400, 38016, 0xd10bd86c
-0, 972000, 38016, 0x6faca613
-0, 975600, 38016, 0x6268848a
-0, 979200, 38016, 0x2b8367e6
-0, 982800, 38016, 0xdb6806fd
-0, 986400, 38016, 0x4f58d418
-0, 990000, 38016, 0x59beb628
-0, 993600, 38016, 0x8017aae2
-0, 997200, 38016, 0xb26ad1b3
-0, 1000800, 38016, 0xa058f3a3
-0, 1004400, 38016, 0x4fee4ac2
-0, 1008000, 38016, 0x5dd20ae9
-0, 1011600, 38016, 0x6365dbda
-0, 1015200, 38016, 0x25b47f80
-0, 1018800, 38016, 0x468b8ecb
-0, 1022400, 38016, 0x0b0760f9
-0, 1026000, 38016, 0x2d41a44b
-0, 1029600, 38016, 0x4bb47357
-0, 1033200, 38016, 0x2c0ca74c
-0, 1036800, 38016, 0x6484a271
-0, 1040400, 38016, 0xa55871df
-0, 1044000, 38016, 0xa617ecd8
-0, 1047600, 38016, 0xf7231cc5
-0, 1051200, 38016, 0x15dba20b
-0, 1054800, 38016, 0x56a7d8c7
-0, 1058400, 38016, 0x5e78382b
-0, 1062000, 38016, 0x8edf243b
-0, 1065600, 38016, 0x571effaf
-0, 1069200, 38016, 0x274302d2
-0, 1072800, 38016, 0xc950203d
-0, 1076400, 38016, 0x4a744324
+#tb 0: 1/25
+0, 0, 0, 1, 38016, 0xb3883478
+0, 1, 1, 1, 38016, 0xb6261cdd
+0, 2, 2, 1, 38016, 0x42ecede9
+0, 3, 3, 1, 38016, 0xfcd6aec1
+0, 4, 4, 1, 38016, 0xb3ffa014
+0, 5, 5, 1, 38016, 0xc65383e3
+0, 6, 6, 1, 38016, 0xa8494fb1
+0, 7, 7, 1, 38016, 0x7fb14e0f
+0, 8, 8, 1, 38016, 0x7dd3462a
+0, 9, 9, 1, 38016, 0x4bd43dda
+0, 10, 10, 1, 38016, 0x717e736f
+0, 11, 11, 1, 38016, 0x2a9b8e47
+0, 12, 12, 1, 38016, 0x1bc272be
+0, 13, 13, 1, 38016, 0x0127afb5
+0, 14, 14, 1, 38016, 0xfd7aacda
+0, 15, 15, 1, 38016, 0xd41c9cf7
+0, 16, 16, 1, 38016, 0xd205b1ee
+0, 17, 17, 1, 38016, 0x967ca895
+0, 18, 18, 1, 38016, 0x25978063
+0, 19, 19, 1, 38016, 0x632081b3
+0, 20, 20, 1, 38016, 0x8ccf5f0b
+0, 21, 21, 1, 38016, 0x21cc2141
+0, 22, 22, 1, 38016, 0x477d2543
+0, 23, 23, 1, 38016, 0xff971bb8
+0, 24, 24, 1, 38016, 0x0dc21005
+0, 25, 25, 1, 38016, 0xc69c2d90
+0, 26, 26, 1, 38016, 0xd7922b5d
+0, 27, 27, 1, 38016, 0x59a3278f
+0, 28, 28, 1, 38016, 0x83c55d4d
+0, 29, 29, 1, 38016, 0xaac96f23
+0, 30, 30, 1, 38016, 0xed9563d3
+0, 31, 31, 1, 38016, 0xf86b9ef4
+0, 32, 32, 1, 38016, 0xe616b81c
+0, 33, 33, 1, 38016, 0xde60a57b
+0, 34, 34, 1, 38016, 0x5fe8d130
+0, 35, 35, 1, 38016, 0x11decaca
+0, 36, 36, 1, 38016, 0x526fa8e2
+0, 37, 37, 1, 38016, 0xc5e7ccfb
+0, 38, 38, 1, 38016, 0x10e1c588
+0, 39, 39, 1, 38016, 0x78aeb05b
+0, 40, 40, 1, 38016, 0xff85c717
+0, 41, 41, 1, 38016, 0x3f02c1b2
+0, 42, 42, 1, 38016, 0xf45eb015
+0, 43, 43, 1, 38016, 0x0211b84d
+0, 44, 44, 1, 38016, 0x3864ba1f
+0, 45, 45, 1, 38016, 0xe3728780
+0, 46, 46, 1, 38016, 0x575da8b5
+0, 47, 47, 1, 38016, 0xc841ad98
+0, 48, 48, 1, 38016, 0xe69ea78f
+0, 49, 49, 1, 38016, 0x45cabf16
+0, 50, 50, 1, 38016, 0x0e00b8eb
+0, 51, 51, 1, 38016, 0xa774a808
+0, 52, 52, 1, 38016, 0xfb1bbc2b
+0, 53, 53, 1, 38016, 0xcfb4b41d
+0, 54, 54, 1, 38016, 0x66abaff8
+0, 55, 55, 1, 38016, 0xc39ac9a9
+0, 56, 56, 1, 38016, 0xbec0cc9a
+0, 57, 57, 1, 38016, 0xf393c7fc
+0, 58, 58, 1, 38016, 0xedb5d4ef
+0, 59, 59, 1, 38016, 0x4b0fd4fe
+0, 60, 60, 1, 38016, 0x98a59a5a
+0, 61, 61, 1, 38016, 0x0a69a4f3
+0, 62, 62, 1, 38016, 0x72bc89ce
+0, 63, 63, 1, 38016, 0xfe8538b6
+0, 64, 64, 1, 38016, 0xc8a158a3
+0, 65, 65, 1, 38016, 0x1cb57fcd
+0, 66, 66, 1, 38016, 0x76c29215
+0, 67, 67, 1, 38016, 0xdb36ec21
+0, 68, 68, 1, 38016, 0xc2e22427
+0, 69, 69, 1, 38016, 0xafb433cd
+0, 70, 70, 1, 38016, 0x4d736e28
+0, 71, 71, 1, 38016, 0xc6ab9949
+0, 72, 72, 1, 38016, 0xaa9bb9e6
+0, 73, 73, 1, 38016, 0x0d41f894
+0, 74, 74, 1, 38016, 0x603332b0
+0, 75, 75, 1, 38016, 0x4c0b3afa
+0, 76, 76, 1, 38016, 0x8fd3845e
+0, 77, 77, 1, 38016, 0x8cf09ae3
+0, 78, 78, 1, 38016, 0x1e02adfb
+0, 79, 79, 1, 38016, 0x3c9ac38e
+0, 80, 80, 1, 38016, 0xb5fdd2d9
+0, 81, 81, 1, 38016, 0x82c5dd7f
+0, 82, 82, 1, 38016, 0x4b6ee80a
+0, 83, 83, 1, 38016, 0xaeaee46f
+0, 84, 84, 1, 38016, 0x390ed382
+0, 85, 85, 1, 38016, 0xedbfde44
+0, 86, 86, 1, 38016, 0xabf6eba0
+0, 87, 87, 1, 38016, 0x5bf5efd0
+0, 88, 88, 1, 38016, 0x9a88ebe3
+0, 89, 89, 1, 38016, 0x2af7ec3b
+0, 90, 90, 1, 38016, 0x8fa69f07
+0, 91, 91, 1, 38016, 0xff8fb3b5
+0, 92, 92, 1, 38016, 0xd06fa3c1
+0, 93, 93, 1, 38016, 0xe5a97d39
+0, 94, 94, 1, 38016, 0x961e7c6f
+0, 95, 95, 1, 38016, 0x18b278af
+0, 96, 96, 1, 38016, 0x9a0d73d2
+0, 97, 97, 1, 38016, 0x378f9d74
+0, 98, 98, 1, 38016, 0x42e5a7a3
+0, 99, 99, 1, 38016, 0x4595a78e
+0, 100, 100, 1, 38016, 0x6c09c035
+0, 101, 101, 1, 38016, 0xec58ab98
+0, 102, 102, 1, 38016, 0x1b4b8d2b
+0, 103, 103, 1, 38016, 0xf5199117
+0, 104, 104, 1, 38016, 0xcd31af4d
+0, 105, 105, 1, 38016, 0xf294a253
+0, 106, 106, 1, 38016, 0x360dde6b
+0, 107, 107, 1, 38016, 0x101cf70c
+0, 108, 108, 1, 38016, 0x4b34ff17
+0, 109, 109, 1, 38016, 0x520639c0
+0, 110, 110, 1, 38016, 0x901840a9
+0, 111, 111, 1, 38016, 0x4cb03284
+0, 112, 112, 1, 38016, 0x6929470c
+0, 113, 113, 1, 38016, 0x21282bdf
+0, 114, 114, 1, 38016, 0xee8df0ec
+0, 115, 115, 1, 38016, 0x24970e16
+0, 116, 116, 1, 38016, 0x280118e3
+0, 117, 117, 1, 38016, 0x00a10b64
+0, 118, 118, 1, 38016, 0xb0673f83
+0, 119, 119, 1, 38016, 0x838644de
+0, 120, 120, 1, 38016, 0x32e93592
+0, 121, 121, 1, 38016, 0xedfc477a
+0, 122, 122, 1, 38016, 0x41062501
+0, 123, 123, 1, 38016, 0xf218ebf2
+0, 124, 124, 1, 38016, 0x3430dc73
+0, 125, 125, 1, 38016, 0xb2fab8f0
+0, 126, 126, 1, 38016, 0x11b19bab
+0, 127, 127, 1, 38016, 0x8e30b8e7
+0, 128, 128, 1, 38016, 0xc8b9c646
+0, 129, 129, 1, 38016, 0xc902d559
+0, 130, 130, 1, 38016, 0x3a24ec30
+0, 131, 131, 1, 38016, 0x744de424
+0, 132, 132, 1, 38016, 0xc40cd059
+0, 133, 133, 1, 38016, 0xd98dd9ec
+0, 134, 134, 1, 38016, 0x9719d698
+0, 135, 135, 1, 38016, 0x1612a173
+0, 136, 136, 1, 38016, 0xc044b9f1
+0, 137, 137, 1, 38016, 0xc433af2f
+0, 138, 138, 1, 38016, 0x559891e3
+0, 139, 139, 1, 38016, 0x969e9a33
+0, 140, 140, 1, 38016, 0x8a6a8e77
+0, 141, 141, 1, 38016, 0x9d7b76bf
+0, 142, 142, 1, 38016, 0x3725711a
+0, 143, 143, 1, 38016, 0x5b316bd0
+0, 144, 144, 1, 38016, 0x4c616abd
+0, 145, 145, 1, 38016, 0x43637e2b
+0, 146, 146, 1, 38016, 0xd9e36c4c
+0, 147, 147, 1, 38016, 0x823d3596
+0, 148, 148, 1, 38016, 0x57361a59
+0, 149, 149, 1, 38016, 0x4a91f007
+0, 150, 150, 1, 38016, 0xf731aef2
+0, 151, 151, 1, 38016, 0x8ed2c618
+0, 152, 152, 1, 38016, 0x6f1cc918
+0, 153, 153, 1, 38016, 0x2a8ba336
+0, 154, 154, 1, 38016, 0x8159b595
+0, 155, 155, 1, 38016, 0x07cfced9
+0, 156, 156, 1, 38016, 0x8804c878
+0, 157, 157, 1, 38016, 0x624e0656
+0, 158, 158, 1, 38016, 0x8628302b
+0, 159, 159, 1, 38016, 0xd155461e
+0, 160, 160, 1, 38016, 0x3c1c647c
+0, 161, 161, 1, 38016, 0x8a485727
+0, 162, 162, 1, 38016, 0x144934f7
+0, 163, 163, 1, 38016, 0x43183494
+0, 164, 164, 1, 38016, 0x20fd2ef2
+0, 165, 165, 1, 38016, 0xc31bf5da
+0, 166, 166, 1, 38016, 0x4c70f0f2
+0, 167, 167, 1, 38016, 0xba1bcbcc
+0, 168, 168, 1, 38016, 0x11039c6c
+0, 169, 169, 1, 38016, 0x67c59b61
+0, 170, 170, 1, 38016, 0xdc0aa2ba
+0, 171, 171, 1, 38016, 0x1e2dbec9
+0, 172, 172, 1, 38016, 0xacacdc6c
+0, 173, 173, 1, 38016, 0x2049defe
+0, 174, 174, 1, 38016, 0x7488cc3e
+0, 175, 175, 1, 38016, 0x14bca829
+0, 176, 176, 1, 38016, 0xc19c76ee
+0, 177, 177, 1, 38016, 0xeca33612
+0, 178, 178, 1, 38016, 0x93b027a5
+0, 179, 179, 1, 38016, 0x82ae1e62
+0, 180, 180, 1, 38016, 0x0769ec52
+0, 181, 181, 1, 38016, 0x7cdee8dd
+0, 182, 182, 1, 38016, 0x7d22d43d
+0, 183, 183, 1, 38016, 0x65d8cd49
+0, 184, 184, 1, 38016, 0xa7d2ede4
+0, 185, 185, 1, 38016, 0x6bd2ffa1
+0, 186, 186, 1, 38016, 0xb4db0734
+0, 187, 187, 1, 38016, 0x69cb35ac
+0, 188, 188, 1, 38016, 0x05e52e88
+0, 189, 189, 1, 38016, 0x4dc92a43
+0, 190, 190, 1, 38016, 0x8ca0e858
+0, 191, 191, 1, 38016, 0x74fbae53
+0, 192, 192, 1, 38016, 0x19f0aa17
+0, 193, 193, 1, 38016, 0x04c9dc83
+0, 194, 194, 1, 38016, 0x0a8ff4b9
+0, 195, 195, 1, 38016, 0xd8d01ad1
+0, 196, 196, 1, 38016, 0xa41b5100
+0, 197, 197, 1, 38016, 0xfaf96547
+0, 198, 198, 1, 38016, 0xadab8265
+0, 199, 199, 1, 38016, 0x6e12a9c3
+0, 200, 200, 1, 38016, 0x1de7b7d1
+0, 201, 201, 1, 38016, 0x2279bc4a
+0, 202, 202, 1, 38016, 0x4f62ca0f
+0, 203, 203, 1, 38016, 0xfaf2cc43
+0, 204, 204, 1, 38016, 0xbf68c7df
+0, 205, 205, 1, 38016, 0xb927d1ea
+0, 206, 206, 1, 38016, 0x8b93d7c6
+0, 207, 207, 1, 38016, 0x13f3d7d6
+0, 208, 208, 1, 38016, 0x9ee4cc7b
+0, 209, 209, 1, 38016, 0x16deb1a0
+0, 210, 210, 1, 38016, 0xadb65d17
+0, 211, 211, 1, 38016, 0x0b9e7542
+0, 212, 212, 1, 38016, 0x05777490
+0, 213, 213, 1, 38016, 0x6805549f
+0, 214, 214, 1, 38016, 0xe3246225
+0, 215, 215, 1, 38016, 0x4003551b
+0, 216, 216, 1, 38016, 0x1e083a01
+0, 217, 217, 1, 38016, 0x756e4f22
+0, 218, 218, 1, 38016, 0xf2f24967
+0, 219, 219, 1, 38016, 0x680d37f2
+0, 220, 220, 1, 38016, 0x85b34185
+0, 221, 221, 1, 38016, 0xefa32eeb
+0, 222, 222, 1, 38016, 0xca791448
+0, 223, 223, 1, 38016, 0x7c6b2b13
+0, 224, 224, 1, 38016, 0x0d8232a6
+0, 225, 225, 1, 38016, 0x92b51315
+0, 226, 226, 1, 38016, 0xcfde349c
+0, 227, 227, 1, 38016, 0xdc1a488b
+0, 228, 228, 1, 38016, 0xdcf94106
+0, 229, 229, 1, 38016, 0xc205829b
+0, 230, 230, 1, 38016, 0x0aff9da3
+0, 231, 231, 1, 38016, 0x3295b04e
+0, 232, 232, 1, 38016, 0xc42dfaab
+0, 233, 233, 1, 38016, 0x799e14a2
+0, 234, 234, 1, 38016, 0xf658150c
+0, 235, 235, 1, 38016, 0x4c8751fe
+0, 236, 236, 1, 38016, 0xe57d58ed
+0, 237, 237, 1, 38016, 0x28f83c49
+0, 238, 238, 1, 38016, 0x9760453c
+0, 239, 239, 1, 38016, 0x1d550fcf
+0, 240, 240, 1, 38016, 0x99cee4bd
+0, 241, 241, 1, 38016, 0x743ad122
+0, 242, 242, 1, 38016, 0xb533ab7c
+0, 243, 243, 1, 38016, 0x5ca5fc65
+0, 244, 244, 1, 38016, 0x491c7076
+0, 245, 245, 1, 38016, 0x8a96d9e5
+0, 246, 246, 1, 38016, 0x23c3f207
+0, 247, 247, 1, 38016, 0x3181d62d
+0, 248, 248, 1, 38016, 0xc72e9636
+0, 249, 249, 1, 38016, 0xe0c31ae9
+0, 250, 250, 1, 38016, 0x2f91c0ce
+0, 251, 251, 1, 38016, 0x17937763
+0, 252, 252, 1, 38016, 0x61986c20
+0, 253, 253, 1, 38016, 0x6adeca83
+0, 254, 254, 1, 38016, 0x894a376b
+0, 255, 255, 1, 38016, 0xe952c9bd
+0, 256, 256, 1, 38016, 0x0418d8e9
+0, 257, 257, 1, 38016, 0x30de606e
+0, 258, 258, 1, 38016, 0xd15e3116
+0, 259, 259, 1, 38016, 0xee0446ac
+0, 260, 260, 1, 38016, 0x34ee44f7
+0, 261, 261, 1, 38016, 0x825745d4
+0, 262, 262, 1, 38016, 0xb8046176
+0, 263, 263, 1, 38016, 0xa812588a
+0, 264, 264, 1, 38016, 0xed754b26
+0, 265, 265, 1, 38016, 0xa39c51cd
+0, 266, 266, 1, 38016, 0x315b38d5
+0, 267, 267, 1, 38016, 0x12550e05
+0, 268, 268, 1, 38016, 0xbda6fd9a
+0, 269, 269, 1, 38016, 0xd10bd86c
+0, 270, 270, 1, 38016, 0x6faca613
+0, 271, 271, 1, 38016, 0x6268848a
+0, 272, 272, 1, 38016, 0x2b8367e6
+0, 273, 273, 1, 38016, 0xdb6806fd
+0, 274, 274, 1, 38016, 0x4f58d418
+0, 275, 275, 1, 38016, 0x59beb628
+0, 276, 276, 1, 38016, 0x8017aae2
+0, 277, 277, 1, 38016, 0xb26ad1b3
+0, 278, 278, 1, 38016, 0xa058f3a3
+0, 279, 279, 1, 38016, 0x4fee4ac2
+0, 280, 280, 1, 38016, 0x5dd20ae9
+0, 281, 281, 1, 38016, 0x6365dbda
+0, 282, 282, 1, 38016, 0x25b47f80
+0, 283, 283, 1, 38016, 0x468b8ecb
+0, 284, 284, 1, 38016, 0x0b0760f9
+0, 285, 285, 1, 38016, 0x2d41a44b
+0, 286, 286, 1, 38016, 0x4bb47357
+0, 287, 287, 1, 38016, 0x2c0ca74c
+0, 288, 288, 1, 38016, 0x6484a271
+0, 289, 289, 1, 38016, 0xa55871df
+0, 290, 290, 1, 38016, 0xa617ecd8
+0, 291, 291, 1, 38016, 0xf7231cc5
+0, 292, 292, 1, 38016, 0x15dba20b
+0, 293, 293, 1, 38016, 0x56a7d8c7
+0, 294, 294, 1, 38016, 0x5e78382b
+0, 295, 295, 1, 38016, 0x8edf243b
+0, 296, 296, 1, 38016, 0x571effaf
+0, 297, 297, 1, 38016, 0x274302d2
+0, 298, 298, 1, 38016, 0xc950203d
+0, 299, 299, 1, 38016, 0x4a744324
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-caba3_sva_b b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-caba3_sva_b
index 449fb75..7bdb3f8 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-caba3_sva_b
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-caba3_sva_b
@@ -1,33 +1,34 @@
-0, 0, 38016, 0x0e091175
-0, 3600, 38016, 0xe8f81506
-0, 7200, 38016, 0xf706f5cd
-0, 10800, 38016, 0x9aeb21b1
-0, 14400, 38016, 0xdc533379
-0, 18000, 38016, 0xd26d534b
-0, 21600, 38016, 0xdcb25dc5
-0, 25200, 38016, 0x1b258cc2
-0, 28800, 38016, 0xdfb58ff8
-0, 32400, 38016, 0x143abf85
-0, 36000, 38016, 0xace399ea
-0, 39600, 38016, 0x1ad6bb8e
-0, 43200, 38016, 0xf01d9b78
-0, 46800, 38016, 0x5a0c99ed
-0, 50400, 38016, 0x9d4e684c
-0, 54000, 38016, 0xca3d811f
-0, 57600, 38016, 0x388c7bc4
-0, 61200, 38016, 0x36329ae0
-0, 64800, 38016, 0x7ca686ac
-0, 68400, 38016, 0x9d7ababf
-0, 72000, 38016, 0x563eaf2a
-0, 75600, 38016, 0xce22a4be
-0, 79200, 38016, 0xb7cb719a
-0, 82800, 38016, 0x7b706edf
-0, 86400, 38016, 0x009a30b5
-0, 90000, 38016, 0xf1fe3fbc
-0, 93600, 38016, 0x7f732436
-0, 97200, 38016, 0x055147ec
-0, 100800, 38016, 0x1670494c
-0, 104400, 38016, 0xfede7bab
-0, 108000, 38016, 0xa3b660d8
-0, 111600, 38016, 0x33db7209
-0, 115200, 38016, 0xb7b25559
+#tb 0: 1/25
+0, 0, 0, 1, 38016, 0x0e091175
+0, 1, 1, 1, 38016, 0xe8f81506
+0, 2, 2, 1, 38016, 0xf706f5cd
+0, 3, 3, 1, 38016, 0x9aeb21b1
+0, 4, 4, 1, 38016, 0xdc533379
+0, 5, 5, 1, 38016, 0xd26d534b
+0, 6, 6, 1, 38016, 0xdcb25dc5
+0, 7, 7, 1, 38016, 0x1b258cc2
+0, 8, 8, 1, 38016, 0xdfb58ff8
+0, 9, 9, 1, 38016, 0x143abf85
+0, 10, 10, 1, 38016, 0xace399ea
+0, 11, 11, 1, 38016, 0x1ad6bb8e
+0, 12, 12, 1, 38016, 0xf01d9b78
+0, 13, 13, 1, 38016, 0x5a0c99ed
+0, 14, 14, 1, 38016, 0x9d4e684c
+0, 15, 15, 1, 38016, 0xca3d811f
+0, 16, 16, 1, 38016, 0x388c7bc4
+0, 17, 17, 1, 38016, 0x36329ae0
+0, 18, 18, 1, 38016, 0x7ca686ac
+0, 19, 19, 1, 38016, 0x9d7ababf
+0, 20, 20, 1, 38016, 0x563eaf2a
+0, 21, 21, 1, 38016, 0xce22a4be
+0, 22, 22, 1, 38016, 0xb7cb719a
+0, 23, 23, 1, 38016, 0x7b706edf
+0, 24, 24, 1, 38016, 0x009a30b5
+0, 25, 25, 1, 38016, 0xf1fe3fbc
+0, 26, 26, 1, 38016, 0x7f732436
+0, 27, 27, 1, 38016, 0x055147ec
+0, 28, 28, 1, 38016, 0x1670494c
+0, 29, 29, 1, 38016, 0xfede7bab
+0, 30, 30, 1, 38016, 0xa3b660d8
+0, 31, 31, 1, 38016, 0x33db7209
+0, 32, 32, 1, 38016, 0xb7b25559
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-caba3_toshiba_e b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-caba3_toshiba_e
index e874659..b31efe1 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-caba3_toshiba_e
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-caba3_toshiba_e
@@ -1,300 +1,301 @@
-0, 0, 38016, 0x72723ce4
-0, 3600, 38016, 0x347219d7
-0, 7200, 38016, 0x813ff182
-0, 10800, 38016, 0x4e69d41a
-0, 14400, 38016, 0x5e56acb6
-0, 18000, 38016, 0xe72197e5
-0, 21600, 38016, 0xd035807a
-0, 25200, 38016, 0x9ee57559
-0, 28800, 38016, 0xd0f56f28
-0, 32400, 38016, 0xa5097788
-0, 36000, 38016, 0xf108978d
-0, 39600, 38016, 0xf76cb475
-0, 43200, 38016, 0x0184cc3a
-0, 46800, 38016, 0xa4b5dc15
-0, 50400, 38016, 0x209cdc42
-0, 54000, 38016, 0xd9e69a8c
-0, 57600, 38016, 0xa2c3a9ba
-0, 61200, 38016, 0xdf84a52e
-0, 64800, 38016, 0xfe48a7f0
-0, 68400, 38016, 0xb0279a19
-0, 72000, 38016, 0xf3b48652
-0, 75600, 38016, 0xc12b61b5
-0, 79200, 38016, 0x13065a22
-0, 82800, 38016, 0x804853d4
-0, 86400, 38016, 0x40935736
-0, 90000, 38016, 0x1a135ecb
-0, 93600, 38016, 0x125f6116
-0, 97200, 38016, 0x53286da3
-0, 100800, 38016, 0xd49287ac
-0, 104400, 38016, 0xc70a9c2c
-0, 108000, 38016, 0x0c0c6998
-0, 111600, 38016, 0xf37d9141
-0, 115200, 38016, 0xd36eafa2
-0, 118800, 38016, 0x0d1fc298
-0, 122400, 38016, 0xf84ad5d9
-0, 126000, 38016, 0xc1e8d93d
-0, 129600, 38016, 0xe190dabd
-0, 133200, 38016, 0x9542db28
-0, 136800, 38016, 0xa67edc7f
-0, 140400, 38016, 0x65efdfa7
-0, 144000, 38016, 0x7039e6c6
-0, 147600, 38016, 0x8307ee87
-0, 151200, 38016, 0x1f83ec00
-0, 154800, 38016, 0x9e33ea6e
-0, 158400, 38016, 0xb53ef238
-0, 162000, 38016, 0x6d04930c
-0, 165600, 38016, 0xed90a50e
-0, 169200, 38016, 0xd98cb4a6
-0, 172800, 38016, 0xa7f5bd5e
-0, 176400, 38016, 0x4df9ca95
-0, 180000, 38016, 0xc8e7cb40
-0, 183600, 38016, 0x93d9d23c
-0, 187200, 38016, 0xc07fd34f
-0, 190800, 38016, 0xf7c5d645
-0, 194400, 38016, 0x3c1ddf53
-0, 198000, 38016, 0x0bafe394
-0, 201600, 38016, 0x9179ec6f
-0, 205200, 38016, 0x3483efc3
-0, 208800, 38016, 0xf7ccf70d
-0, 212400, 38016, 0x289ef13b
-0, 216000, 38016, 0xb00c99dc
-0, 219600, 38016, 0x59409b34
-0, 223200, 38016, 0x3fc079a2
-0, 226800, 38016, 0x90ad49d9
-0, 230400, 38016, 0x8e7751e2
-0, 234000, 38016, 0xed20743d
-0, 237600, 38016, 0x66a1a470
-0, 241200, 38016, 0x7a77e252
-0, 244800, 38016, 0x6bb427fe
-0, 248400, 38016, 0x87126360
-0, 252000, 38016, 0x330789d0
-0, 255600, 38016, 0xc298b987
-0, 259200, 38016, 0x4959f143
-0, 262800, 38016, 0xa66e3082
-0, 266400, 38016, 0xb9f67824
-0, 270000, 38016, 0x27fe46a2
-0, 273600, 38016, 0xc50c87ed
-0, 277200, 38016, 0x9523a9f6
-0, 280800, 38016, 0xbe28d1d7
-0, 284400, 38016, 0x3c0ee964
-0, 288000, 38016, 0x65c7f36c
-0, 291600, 38016, 0xe5030946
-0, 295200, 38016, 0x4bbb11fa
-0, 298800, 38016, 0xeaf209ed
-0, 302400, 38016, 0x96c80987
-0, 306000, 38016, 0x69820c58
-0, 309600, 38016, 0x5f951aa7
-0, 313200, 38016, 0xfe6122d9
-0, 316800, 38016, 0xa202301a
-0, 320400, 38016, 0xdd2628fb
-0, 324000, 38016, 0xe081a5ff
-0, 327600, 38016, 0x5b858e9e
-0, 331200, 38016, 0x7a368229
-0, 334800, 38016, 0x3791829a
-0, 338400, 38016, 0x9c68723d
-0, 342000, 38016, 0xef26778e
-0, 345600, 38016, 0x39a491cf
-0, 349200, 38016, 0x776ea867
-0, 352800, 38016, 0xda9ac03b
-0, 356400, 38016, 0x653bc9a3
-0, 360000, 38016, 0x79e1da19
-0, 363600, 38016, 0x3b98c6eb
-0, 367200, 38016, 0x42cdb846
-0, 370800, 38016, 0x7872ada1
-0, 374400, 38016, 0xb2f6d2ef
-0, 378000, 38016, 0x9468b16a
-0, 381600, 38016, 0xe793c91a
-0, 385200, 38016, 0x80bde366
-0, 388800, 38016, 0xa7250446
-0, 392400, 38016, 0x7039280b
-0, 396000, 38016, 0x1665350c
-0, 399600, 38016, 0xb5c93f1f
-0, 403200, 38016, 0xf77a4c44
-0, 406800, 38016, 0x3a093143
-0, 410400, 38016, 0x1d6b1005
-0, 414000, 38016, 0xe1a10c01
-0, 417600, 38016, 0x2d4d1d54
-0, 421200, 38016, 0x902f2b14
-0, 424800, 38016, 0xb26e3e73
-0, 428400, 38016, 0xed7a469e
-0, 432000, 38016, 0xbc663d2a
-0, 435600, 38016, 0x60a5488e
-0, 439200, 38016, 0x451b31ca
-0, 442800, 38016, 0x54311166
-0, 446400, 38016, 0x57d9f31e
-0, 450000, 38016, 0x567dd693
-0, 453600, 38016, 0x0e58d88c
-0, 457200, 38016, 0xa555e124
-0, 460800, 38016, 0x94e2f835
-0, 464400, 38016, 0xe49e0ec0
-0, 468000, 38016, 0x585d188e
-0, 471600, 38016, 0x696e1a0d
-0, 475200, 38016, 0xac9014b1
-0, 478800, 38016, 0x915413c6
-0, 482400, 38016, 0x5fa30be7
-0, 486000, 38016, 0x8fbfb69c
-0, 489600, 38016, 0xcaeabfab
-0, 493200, 38016, 0xe494bf5c
-0, 496800, 38016, 0xae03be55
-0, 500400, 38016, 0xb734b4d3
-0, 504000, 38016, 0xdc6fb56f
-0, 507600, 38016, 0xfea0a853
-0, 511200, 38016, 0xb4919381
-0, 514800, 38016, 0x13a792fe
-0, 518400, 38016, 0xc8829fd8
-0, 522000, 38016, 0x2113a62b
-0, 525600, 38016, 0x171f98d2
-0, 529200, 38016, 0x1a6d6d17
-0, 532800, 38016, 0xd4ab41c3
-0, 536400, 38016, 0xd2df1c80
-0, 540000, 38016, 0x14cdbb35
-0, 543600, 38016, 0x2b74b829
-0, 547200, 38016, 0x6433bd55
-0, 550800, 38016, 0xd11dbc28
-0, 554400, 38016, 0x4981ad33
-0, 558000, 38016, 0xc38bbbad
-0, 561600, 38016, 0x048de367
-0, 565200, 38016, 0x6c9a0c5a
-0, 568800, 38016, 0x384c4255
-0, 572400, 38016, 0x3e9873ba
-0, 576000, 38016, 0xe4988671
-0, 579600, 38016, 0x05b4843c
-0, 583200, 38016, 0xed0a7e13
-0, 586800, 38016, 0x750c6f90
-0, 590400, 38016, 0x9d296035
-0, 594000, 38016, 0xbaa006bd
-0, 597600, 38016, 0x8289f8ae
-0, 601200, 38016, 0x3f3de147
-0, 604800, 38016, 0xc5debc49
-0, 608400, 38016, 0x1fe9bbfc
-0, 612000, 38016, 0x006cd4a9
-0, 615600, 38016, 0xe551f2b3
-0, 619200, 38016, 0xb370140e
-0, 622800, 38016, 0xc9441c24
-0, 626400, 38016, 0x7f5c01c5
-0, 630000, 38016, 0x352ad9f6
-0, 633600, 38016, 0xe0909a17
-0, 637200, 38016, 0x49bf5ea8
-0, 640800, 38016, 0x7f1d387b
-0, 644400, 38016, 0x30812233
-0, 648000, 38016, 0xb0bdf16f
-0, 651600, 38016, 0x5372d0e9
-0, 655200, 38016, 0xbf1bc91c
-0, 658800, 38016, 0xaef5d647
-0, 662400, 38016, 0xf007e86c
-0, 666000, 38016, 0x683bf72b
-0, 669600, 38016, 0xbb722114
-0, 673200, 38016, 0xc5864b63
-0, 676800, 38016, 0xfefd5cf4
-0, 680400, 38016, 0xa0f263d5
-0, 684000, 38016, 0x18401a02
-0, 687600, 38016, 0x55cdd97b
-0, 691200, 38016, 0x5a4ee22d
-0, 694800, 38016, 0xa60706b3
-0, 698400, 38016, 0x644422bb
-0, 702000, 38016, 0xc22421c9
-0, 705600, 38016, 0x1d6b54e4
-0, 709200, 38016, 0xc7627820
-0, 712800, 38016, 0x0a6ea609
-0, 716400, 38016, 0x4315c087
-0, 720000, 38016, 0x3164d978
-0, 723600, 38016, 0x08e3e7eb
-0, 727200, 38016, 0x4f04eaed
-0, 730800, 38016, 0x9f83eb5a
-0, 734400, 38016, 0xfbbcf0b2
-0, 738000, 38016, 0xee1efb8a
-0, 741600, 38016, 0x87710ba0
-0, 745200, 38016, 0xb96b05c1
-0, 748800, 38016, 0xd5a4fc50
-0, 752400, 38016, 0xad85ea19
-0, 756000, 38016, 0x5f606058
-0, 759600, 38016, 0xdaf55ad0
-0, 763200, 38016, 0xee8564d6
-0, 766800, 38016, 0xa1846cad
-0, 770400, 38016, 0xcd316a62
-0, 774000, 38016, 0xdcf5638f
-0, 777600, 38016, 0xc5e36d1d
-0, 781200, 38016, 0x958369a6
-0, 784800, 38016, 0x05826bf0
-0, 788400, 38016, 0x22146914
-0, 792000, 38016, 0xf5086111
-0, 795600, 38016, 0x88f35468
-0, 799200, 38016, 0x3ae94126
-0, 802800, 38016, 0xf4473aa8
-0, 806400, 38016, 0x430c3da2
-0, 810000, 38016, 0xaf95113e
-0, 813600, 38016, 0xa8a216d6
-0, 817200, 38016, 0xad2f328c
-0, 820800, 38016, 0xea724415
-0, 824400, 38016, 0x34016af4
-0, 828000, 38016, 0x4829a4cb
-0, 831600, 38016, 0x4b24bc67
-0, 835200, 38016, 0xb523f023
-0, 838800, 38016, 0x5c6d2305
-0, 842400, 38016, 0x39e63adc
-0, 846000, 38016, 0xf7c64a7c
-0, 849600, 38016, 0xd601680a
-0, 853200, 38016, 0xbbad6a12
-0, 856800, 38016, 0xddc1500f
-0, 860400, 38016, 0x1f1726e6
-0, 864000, 38016, 0x48aee68f
-0, 867600, 38016, 0xc1fbd4f0
-0, 871200, 38016, 0x4a89dc83
-0, 874800, 38016, 0xa7cd2b02
-0, 878400, 38016, 0xf52aa0b8
-0, 882000, 38016, 0x1f260626
-0, 885600, 38016, 0x80561eac
-0, 889200, 38016, 0x6687f8ef
-0, 892800, 38016, 0x986ab08f
-0, 896400, 38016, 0xb4923773
-0, 900000, 38016, 0x5cc2d603
-0, 903600, 38016, 0x9e8d93db
-0, 907200, 38016, 0x33fd8981
-0, 910800, 38016, 0xaf45e630
-0, 914400, 38016, 0x1227448e
-0, 918000, 38016, 0x424cccf0
-0, 921600, 38016, 0x03b0cb3e
-0, 925200, 38016, 0x7aad547d
-0, 928800, 38016, 0xbf8544b2
-0, 932400, 38016, 0x54a843ca
-0, 936000, 38016, 0x759d4dd0
-0, 939600, 38016, 0x000162da
-0, 943200, 38016, 0x87ec74b0
-0, 946800, 38016, 0xefee8259
-0, 950400, 38016, 0x7b547eea
-0, 954000, 38016, 0xcae96b73
-0, 957600, 38016, 0x730f59c3
-0, 961200, 38016, 0x7d9b3e82
-0, 964800, 38016, 0x3bb11ef0
-0, 968400, 38016, 0x7581fa6b
-0, 972000, 38016, 0xe594a982
-0, 975600, 38016, 0xde3888d6
-0, 979200, 38016, 0x0e096d6b
-0, 982800, 38016, 0x297c20dc
-0, 986400, 38016, 0x51f7ce7f
-0, 990000, 38016, 0x23d2c247
-0, 993600, 38016, 0x0bdcd0d0
-0, 997200, 38016, 0x63cfd4f3
-0, 1000800, 38016, 0x6d4b01f8
-0, 1004400, 38016, 0xa50d72f0
-0, 1008000, 38016, 0xccad0d72
-0, 1011600, 38016, 0x10c9e33e
-0, 1015200, 38016, 0xba6daf97
-0, 1018800, 38016, 0xd65074e0
-0, 1022400, 38016, 0xd36954aa
-0, 1026000, 38016, 0xd9a2a642
-0, 1029600, 38016, 0xce755f9f
-0, 1033200, 38016, 0x81d29c44
-0, 1036800, 38016, 0x23b0aef5
-0, 1040400, 38016, 0xb0ef9efa
-0, 1044000, 38016, 0xf20d4a7a
-0, 1047600, 38016, 0xa0c86899
-0, 1051200, 38016, 0x1ae4f865
-0, 1054800, 38016, 0x3a5731c8
-0, 1058400, 38016, 0x75f17ec5
-0, 1062000, 38016, 0x8f447aa9
-0, 1065600, 38016, 0x71615441
-0, 1069200, 38016, 0x90c13e26
-0, 1072800, 38016, 0x08d04aaf
-0, 1076400, 38016, 0x14fd7b04
+#tb 0: 1/25
+0, 0, 0, 1, 38016, 0x72723ce4
+0, 1, 1, 1, 38016, 0x347219d7
+0, 2, 2, 1, 38016, 0x813ff182
+0, 3, 3, 1, 38016, 0x4e69d41a
+0, 4, 4, 1, 38016, 0x5e56acb6
+0, 5, 5, 1, 38016, 0xe72197e5
+0, 6, 6, 1, 38016, 0xd035807a
+0, 7, 7, 1, 38016, 0x9ee57559
+0, 8, 8, 1, 38016, 0xd0f56f28
+0, 9, 9, 1, 38016, 0xa5097788
+0, 10, 10, 1, 38016, 0xf108978d
+0, 11, 11, 1, 38016, 0xf76cb475
+0, 12, 12, 1, 38016, 0x0184cc3a
+0, 13, 13, 1, 38016, 0xa4b5dc15
+0, 14, 14, 1, 38016, 0x209cdc42
+0, 15, 15, 1, 38016, 0xd9e69a8c
+0, 16, 16, 1, 38016, 0xa2c3a9ba
+0, 17, 17, 1, 38016, 0xdf84a52e
+0, 18, 18, 1, 38016, 0xfe48a7f0
+0, 19, 19, 1, 38016, 0xb0279a19
+0, 20, 20, 1, 38016, 0xf3b48652
+0, 21, 21, 1, 38016, 0xc12b61b5
+0, 22, 22, 1, 38016, 0x13065a22
+0, 23, 23, 1, 38016, 0x804853d4
+0, 24, 24, 1, 38016, 0x40935736
+0, 25, 25, 1, 38016, 0x1a135ecb
+0, 26, 26, 1, 38016, 0x125f6116
+0, 27, 27, 1, 38016, 0x53286da3
+0, 28, 28, 1, 38016, 0xd49287ac
+0, 29, 29, 1, 38016, 0xc70a9c2c
+0, 30, 30, 1, 38016, 0x0c0c6998
+0, 31, 31, 1, 38016, 0xf37d9141
+0, 32, 32, 1, 38016, 0xd36eafa2
+0, 33, 33, 1, 38016, 0x0d1fc298
+0, 34, 34, 1, 38016, 0xf84ad5d9
+0, 35, 35, 1, 38016, 0xc1e8d93d
+0, 36, 36, 1, 38016, 0xe190dabd
+0, 37, 37, 1, 38016, 0x9542db28
+0, 38, 38, 1, 38016, 0xa67edc7f
+0, 39, 39, 1, 38016, 0x65efdfa7
+0, 40, 40, 1, 38016, 0x7039e6c6
+0, 41, 41, 1, 38016, 0x8307ee87
+0, 42, 42, 1, 38016, 0x1f83ec00
+0, 43, 43, 1, 38016, 0x9e33ea6e
+0, 44, 44, 1, 38016, 0xb53ef238
+0, 45, 45, 1, 38016, 0x6d04930c
+0, 46, 46, 1, 38016, 0xed90a50e
+0, 47, 47, 1, 38016, 0xd98cb4a6
+0, 48, 48, 1, 38016, 0xa7f5bd5e
+0, 49, 49, 1, 38016, 0x4df9ca95
+0, 50, 50, 1, 38016, 0xc8e7cb40
+0, 51, 51, 1, 38016, 0x93d9d23c
+0, 52, 52, 1, 38016, 0xc07fd34f
+0, 53, 53, 1, 38016, 0xf7c5d645
+0, 54, 54, 1, 38016, 0x3c1ddf53
+0, 55, 55, 1, 38016, 0x0bafe394
+0, 56, 56, 1, 38016, 0x9179ec6f
+0, 57, 57, 1, 38016, 0x3483efc3
+0, 58, 58, 1, 38016, 0xf7ccf70d
+0, 59, 59, 1, 38016, 0x289ef13b
+0, 60, 60, 1, 38016, 0xb00c99dc
+0, 61, 61, 1, 38016, 0x59409b34
+0, 62, 62, 1, 38016, 0x3fc079a2
+0, 63, 63, 1, 38016, 0x90ad49d9
+0, 64, 64, 1, 38016, 0x8e7751e2
+0, 65, 65, 1, 38016, 0xed20743d
+0, 66, 66, 1, 38016, 0x66a1a470
+0, 67, 67, 1, 38016, 0x7a77e252
+0, 68, 68, 1, 38016, 0x6bb427fe
+0, 69, 69, 1, 38016, 0x87126360
+0, 70, 70, 1, 38016, 0x330789d0
+0, 71, 71, 1, 38016, 0xc298b987
+0, 72, 72, 1, 38016, 0x4959f143
+0, 73, 73, 1, 38016, 0xa66e3082
+0, 74, 74, 1, 38016, 0xb9f67824
+0, 75, 75, 1, 38016, 0x27fe46a2
+0, 76, 76, 1, 38016, 0xc50c87ed
+0, 77, 77, 1, 38016, 0x9523a9f6
+0, 78, 78, 1, 38016, 0xbe28d1d7
+0, 79, 79, 1, 38016, 0x3c0ee964
+0, 80, 80, 1, 38016, 0x65c7f36c
+0, 81, 81, 1, 38016, 0xe5030946
+0, 82, 82, 1, 38016, 0x4bbb11fa
+0, 83, 83, 1, 38016, 0xeaf209ed
+0, 84, 84, 1, 38016, 0x96c80987
+0, 85, 85, 1, 38016, 0x69820c58
+0, 86, 86, 1, 38016, 0x5f951aa7
+0, 87, 87, 1, 38016, 0xfe6122d9
+0, 88, 88, 1, 38016, 0xa202301a
+0, 89, 89, 1, 38016, 0xdd2628fb
+0, 90, 90, 1, 38016, 0xe081a5ff
+0, 91, 91, 1, 38016, 0x5b858e9e
+0, 92, 92, 1, 38016, 0x7a368229
+0, 93, 93, 1, 38016, 0x3791829a
+0, 94, 94, 1, 38016, 0x9c68723d
+0, 95, 95, 1, 38016, 0xef26778e
+0, 96, 96, 1, 38016, 0x39a491cf
+0, 97, 97, 1, 38016, 0x776ea867
+0, 98, 98, 1, 38016, 0xda9ac03b
+0, 99, 99, 1, 38016, 0x653bc9a3
+0, 100, 100, 1, 38016, 0x79e1da19
+0, 101, 101, 1, 38016, 0x3b98c6eb
+0, 102, 102, 1, 38016, 0x42cdb846
+0, 103, 103, 1, 38016, 0x7872ada1
+0, 104, 104, 1, 38016, 0xb2f6d2ef
+0, 105, 105, 1, 38016, 0x9468b16a
+0, 106, 106, 1, 38016, 0xe793c91a
+0, 107, 107, 1, 38016, 0x80bde366
+0, 108, 108, 1, 38016, 0xa7250446
+0, 109, 109, 1, 38016, 0x7039280b
+0, 110, 110, 1, 38016, 0x1665350c
+0, 111, 111, 1, 38016, 0xb5c93f1f
+0, 112, 112, 1, 38016, 0xf77a4c44
+0, 113, 113, 1, 38016, 0x3a093143
+0, 114, 114, 1, 38016, 0x1d6b1005
+0, 115, 115, 1, 38016, 0xe1a10c01
+0, 116, 116, 1, 38016, 0x2d4d1d54
+0, 117, 117, 1, 38016, 0x902f2b14
+0, 118, 118, 1, 38016, 0xb26e3e73
+0, 119, 119, 1, 38016, 0xed7a469e
+0, 120, 120, 1, 38016, 0xbc663d2a
+0, 121, 121, 1, 38016, 0x60a5488e
+0, 122, 122, 1, 38016, 0x451b31ca
+0, 123, 123, 1, 38016, 0x54311166
+0, 124, 124, 1, 38016, 0x57d9f31e
+0, 125, 125, 1, 38016, 0x567dd693
+0, 126, 126, 1, 38016, 0x0e58d88c
+0, 127, 127, 1, 38016, 0xa555e124
+0, 128, 128, 1, 38016, 0x94e2f835
+0, 129, 129, 1, 38016, 0xe49e0ec0
+0, 130, 130, 1, 38016, 0x585d188e
+0, 131, 131, 1, 38016, 0x696e1a0d
+0, 132, 132, 1, 38016, 0xac9014b1
+0, 133, 133, 1, 38016, 0x915413c6
+0, 134, 134, 1, 38016, 0x5fa30be7
+0, 135, 135, 1, 38016, 0x8fbfb69c
+0, 136, 136, 1, 38016, 0xcaeabfab
+0, 137, 137, 1, 38016, 0xe494bf5c
+0, 138, 138, 1, 38016, 0xae03be55
+0, 139, 139, 1, 38016, 0xb734b4d3
+0, 140, 140, 1, 38016, 0xdc6fb56f
+0, 141, 141, 1, 38016, 0xfea0a853
+0, 142, 142, 1, 38016, 0xb4919381
+0, 143, 143, 1, 38016, 0x13a792fe
+0, 144, 144, 1, 38016, 0xc8829fd8
+0, 145, 145, 1, 38016, 0x2113a62b
+0, 146, 146, 1, 38016, 0x171f98d2
+0, 147, 147, 1, 38016, 0x1a6d6d17
+0, 148, 148, 1, 38016, 0xd4ab41c3
+0, 149, 149, 1, 38016, 0xd2df1c80
+0, 150, 150, 1, 38016, 0x14cdbb35
+0, 151, 151, 1, 38016, 0x2b74b829
+0, 152, 152, 1, 38016, 0x6433bd55
+0, 153, 153, 1, 38016, 0xd11dbc28
+0, 154, 154, 1, 38016, 0x4981ad33
+0, 155, 155, 1, 38016, 0xc38bbbad
+0, 156, 156, 1, 38016, 0x048de367
+0, 157, 157, 1, 38016, 0x6c9a0c5a
+0, 158, 158, 1, 38016, 0x384c4255
+0, 159, 159, 1, 38016, 0x3e9873ba
+0, 160, 160, 1, 38016, 0xe4988671
+0, 161, 161, 1, 38016, 0x05b4843c
+0, 162, 162, 1, 38016, 0xed0a7e13
+0, 163, 163, 1, 38016, 0x750c6f90
+0, 164, 164, 1, 38016, 0x9d296035
+0, 165, 165, 1, 38016, 0xbaa006bd
+0, 166, 166, 1, 38016, 0x8289f8ae
+0, 167, 167, 1, 38016, 0x3f3de147
+0, 168, 168, 1, 38016, 0xc5debc49
+0, 169, 169, 1, 38016, 0x1fe9bbfc
+0, 170, 170, 1, 38016, 0x006cd4a9
+0, 171, 171, 1, 38016, 0xe551f2b3
+0, 172, 172, 1, 38016, 0xb370140e
+0, 173, 173, 1, 38016, 0xc9441c24
+0, 174, 174, 1, 38016, 0x7f5c01c5
+0, 175, 175, 1, 38016, 0x352ad9f6
+0, 176, 176, 1, 38016, 0xe0909a17
+0, 177, 177, 1, 38016, 0x49bf5ea8
+0, 178, 178, 1, 38016, 0x7f1d387b
+0, 179, 179, 1, 38016, 0x30812233
+0, 180, 180, 1, 38016, 0xb0bdf16f
+0, 181, 181, 1, 38016, 0x5372d0e9
+0, 182, 182, 1, 38016, 0xbf1bc91c
+0, 183, 183, 1, 38016, 0xaef5d647
+0, 184, 184, 1, 38016, 0xf007e86c
+0, 185, 185, 1, 38016, 0x683bf72b
+0, 186, 186, 1, 38016, 0xbb722114
+0, 187, 187, 1, 38016, 0xc5864b63
+0, 188, 188, 1, 38016, 0xfefd5cf4
+0, 189, 189, 1, 38016, 0xa0f263d5
+0, 190, 190, 1, 38016, 0x18401a02
+0, 191, 191, 1, 38016, 0x55cdd97b
+0, 192, 192, 1, 38016, 0x5a4ee22d
+0, 193, 193, 1, 38016, 0xa60706b3
+0, 194, 194, 1, 38016, 0x644422bb
+0, 195, 195, 1, 38016, 0xc22421c9
+0, 196, 196, 1, 38016, 0x1d6b54e4
+0, 197, 197, 1, 38016, 0xc7627820
+0, 198, 198, 1, 38016, 0x0a6ea609
+0, 199, 199, 1, 38016, 0x4315c087
+0, 200, 200, 1, 38016, 0x3164d978
+0, 201, 201, 1, 38016, 0x08e3e7eb
+0, 202, 202, 1, 38016, 0x4f04eaed
+0, 203, 203, 1, 38016, 0x9f83eb5a
+0, 204, 204, 1, 38016, 0xfbbcf0b2
+0, 205, 205, 1, 38016, 0xee1efb8a
+0, 206, 206, 1, 38016, 0x87710ba0
+0, 207, 207, 1, 38016, 0xb96b05c1
+0, 208, 208, 1, 38016, 0xd5a4fc50
+0, 209, 209, 1, 38016, 0xad85ea19
+0, 210, 210, 1, 38016, 0x5f606058
+0, 211, 211, 1, 38016, 0xdaf55ad0
+0, 212, 212, 1, 38016, 0xee8564d6
+0, 213, 213, 1, 38016, 0xa1846cad
+0, 214, 214, 1, 38016, 0xcd316a62
+0, 215, 215, 1, 38016, 0xdcf5638f
+0, 216, 216, 1, 38016, 0xc5e36d1d
+0, 217, 217, 1, 38016, 0x958369a6
+0, 218, 218, 1, 38016, 0x05826bf0
+0, 219, 219, 1, 38016, 0x22146914
+0, 220, 220, 1, 38016, 0xf5086111
+0, 221, 221, 1, 38016, 0x88f35468
+0, 222, 222, 1, 38016, 0x3ae94126
+0, 223, 223, 1, 38016, 0xf4473aa8
+0, 224, 224, 1, 38016, 0x430c3da2
+0, 225, 225, 1, 38016, 0xaf95113e
+0, 226, 226, 1, 38016, 0xa8a216d6
+0, 227, 227, 1, 38016, 0xad2f328c
+0, 228, 228, 1, 38016, 0xea724415
+0, 229, 229, 1, 38016, 0x34016af4
+0, 230, 230, 1, 38016, 0x4829a4cb
+0, 231, 231, 1, 38016, 0x4b24bc67
+0, 232, 232, 1, 38016, 0xb523f023
+0, 233, 233, 1, 38016, 0x5c6d2305
+0, 234, 234, 1, 38016, 0x39e63adc
+0, 235, 235, 1, 38016, 0xf7c64a7c
+0, 236, 236, 1, 38016, 0xd601680a
+0, 237, 237, 1, 38016, 0xbbad6a12
+0, 238, 238, 1, 38016, 0xddc1500f
+0, 239, 239, 1, 38016, 0x1f1726e6
+0, 240, 240, 1, 38016, 0x48aee68f
+0, 241, 241, 1, 38016, 0xc1fbd4f0
+0, 242, 242, 1, 38016, 0x4a89dc83
+0, 243, 243, 1, 38016, 0xa7cd2b02
+0, 244, 244, 1, 38016, 0xf52aa0b8
+0, 245, 245, 1, 38016, 0x1f260626
+0, 246, 246, 1, 38016, 0x80561eac
+0, 247, 247, 1, 38016, 0x6687f8ef
+0, 248, 248, 1, 38016, 0x986ab08f
+0, 249, 249, 1, 38016, 0xb4923773
+0, 250, 250, 1, 38016, 0x5cc2d603
+0, 251, 251, 1, 38016, 0x9e8d93db
+0, 252, 252, 1, 38016, 0x33fd8981
+0, 253, 253, 1, 38016, 0xaf45e630
+0, 254, 254, 1, 38016, 0x1227448e
+0, 255, 255, 1, 38016, 0x424cccf0
+0, 256, 256, 1, 38016, 0x03b0cb3e
+0, 257, 257, 1, 38016, 0x7aad547d
+0, 258, 258, 1, 38016, 0xbf8544b2
+0, 259, 259, 1, 38016, 0x54a843ca
+0, 260, 260, 1, 38016, 0x759d4dd0
+0, 261, 261, 1, 38016, 0x000162da
+0, 262, 262, 1, 38016, 0x87ec74b0
+0, 263, 263, 1, 38016, 0xefee8259
+0, 264, 264, 1, 38016, 0x7b547eea
+0, 265, 265, 1, 38016, 0xcae96b73
+0, 266, 266, 1, 38016, 0x730f59c3
+0, 267, 267, 1, 38016, 0x7d9b3e82
+0, 268, 268, 1, 38016, 0x3bb11ef0
+0, 269, 269, 1, 38016, 0x7581fa6b
+0, 270, 270, 1, 38016, 0xe594a982
+0, 271, 271, 1, 38016, 0xde3888d6
+0, 272, 272, 1, 38016, 0x0e096d6b
+0, 273, 273, 1, 38016, 0x297c20dc
+0, 274, 274, 1, 38016, 0x51f7ce7f
+0, 275, 275, 1, 38016, 0x23d2c247
+0, 276, 276, 1, 38016, 0x0bdcd0d0
+0, 277, 277, 1, 38016, 0x63cfd4f3
+0, 278, 278, 1, 38016, 0x6d4b01f8
+0, 279, 279, 1, 38016, 0xa50d72f0
+0, 280, 280, 1, 38016, 0xccad0d72
+0, 281, 281, 1, 38016, 0x10c9e33e
+0, 282, 282, 1, 38016, 0xba6daf97
+0, 283, 283, 1, 38016, 0xd65074e0
+0, 284, 284, 1, 38016, 0xd36954aa
+0, 285, 285, 1, 38016, 0xd9a2a642
+0, 286, 286, 1, 38016, 0xce755f9f
+0, 287, 287, 1, 38016, 0x81d29c44
+0, 288, 288, 1, 38016, 0x23b0aef5
+0, 289, 289, 1, 38016, 0xb0ef9efa
+0, 290, 290, 1, 38016, 0xf20d4a7a
+0, 291, 291, 1, 38016, 0xa0c86899
+0, 292, 292, 1, 38016, 0x1ae4f865
+0, 293, 293, 1, 38016, 0x3a5731c8
+0, 294, 294, 1, 38016, 0x75f17ec5
+0, 295, 295, 1, 38016, 0x8f447aa9
+0, 296, 296, 1, 38016, 0x71615441
+0, 297, 297, 1, 38016, 0x90c13e26
+0, 298, 298, 1, 38016, 0x08d04aaf
+0, 299, 299, 1, 38016, 0x14fd7b04
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cabac_mot_fld0_full b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cabac_mot_fld0_full
index a88e0c1..b131cda 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cabac_mot_fld0_full
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cabac_mot_fld0_full
@@ -1,30 +1,31 @@
-0, 0, 518400, 0xbf168f4e
-0, 3600, 518400, 0xeda5e54f
-0, 7200, 518400, 0xef496d43
-0, 10800, 518400, 0x6b68dad5
-0, 14400, 518400, 0x9a40a7de
-0, 18000, 518400, 0x0c21c018
-0, 21600, 518400, 0x4ac5a846
-0, 25200, 518400, 0x3a1aa817
-0, 28800, 518400, 0xcc4eb434
-0, 32400, 518400, 0x4368a3c2
-0, 36000, 518400, 0xb923682f
-0, 39600, 518400, 0xd95460a8
-0, 43200, 518400, 0x8e8518aa
-0, 46800, 518400, 0x292a1a80
-0, 50400, 518400, 0xbada388e
-0, 54000, 518400, 0xa67f63c9
-0, 57600, 518400, 0x9fc77e21
-0, 61200, 518400, 0xe99dc2ac
-0, 64800, 518400, 0x17d7d080
-0, 68400, 518400, 0x41760c0b
-0, 72000, 518400, 0x3c70f34d
-0, 75600, 518400, 0x0d640285
-0, 79200, 518400, 0x448893e8
-0, 82800, 518400, 0x08194490
-0, 86400, 518400, 0xcf227031
-0, 90000, 518400, 0x8d94587d
-0, 93600, 518400, 0x696fca01
-0, 97200, 518400, 0xe0ab234b
-0, 100800, 518400, 0x0620153b
-0, 104400, 518400, 0xb78c146c
+#tb 0: 1/25
+0, 0, 0, 1, 518400, 0xbf168f4e
+0, 1, 1, 1, 518400, 0xeda5e54f
+0, 2, 2, 1, 518400, 0xef496d43
+0, 3, 3, 1, 518400, 0x6b68dad5
+0, 4, 4, 1, 518400, 0x9a40a7de
+0, 5, 5, 1, 518400, 0x0c21c018
+0, 6, 6, 1, 518400, 0x4ac5a846
+0, 7, 7, 1, 518400, 0x3a1aa817
+0, 8, 8, 1, 518400, 0xcc4eb434
+0, 9, 9, 1, 518400, 0x4368a3c2
+0, 10, 10, 1, 518400, 0xb923682f
+0, 11, 11, 1, 518400, 0xd95460a8
+0, 12, 12, 1, 518400, 0x8e8518aa
+0, 13, 13, 1, 518400, 0x292a1a80
+0, 14, 14, 1, 518400, 0xbada388e
+0, 15, 15, 1, 518400, 0xa67f63c9
+0, 16, 16, 1, 518400, 0x9fc77e21
+0, 17, 17, 1, 518400, 0xe99dc2ac
+0, 18, 18, 1, 518400, 0x17d7d080
+0, 19, 19, 1, 518400, 0x41760c0b
+0, 20, 20, 1, 518400, 0x3c70f34d
+0, 21, 21, 1, 518400, 0x0d640285
+0, 22, 22, 1, 518400, 0x448893e8
+0, 23, 23, 1, 518400, 0x08194490
+0, 24, 24, 1, 518400, 0xcf227031
+0, 25, 25, 1, 518400, 0x8d94587d
+0, 26, 26, 1, 518400, 0x696fca01
+0, 27, 27, 1, 518400, 0xe0ab234b
+0, 28, 28, 1, 518400, 0x0620153b
+0, 29, 29, 1, 518400, 0xb78c146c
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cabac_mot_frm0_full b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cabac_mot_frm0_full
index 437a86b..58949e2 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cabac_mot_frm0_full
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cabac_mot_frm0_full
@@ -1,30 +1,31 @@
-0, 0, 518400, 0x40c7e2d9
-0, 3600, 518400, 0xb16701a5
-0, 7200, 518400, 0x12c2f5b1
-0, 10800, 518400, 0x9832aecc
-0, 14400, 518400, 0x2b8bcdec
-0, 18000, 518400, 0x04448f3a
-0, 21600, 518400, 0xc7ac82d8
-0, 25200, 518400, 0xe746bb8a
-0, 28800, 518400, 0xc7ac92d3
-0, 32400, 518400, 0x38d89443
-0, 36000, 518400, 0xcb9fbe74
-0, 39600, 518400, 0x5543867d
-0, 43200, 518400, 0xaf1b147f
-0, 46800, 518400, 0xe5f07e40
-0, 50400, 518400, 0x66dc6734
-0, 54000, 518400, 0x0f9491be
-0, 57600, 518400, 0xbcdaacac
-0, 61200, 518400, 0xf4480ae7
-0, 64800, 518400, 0xa5cef4d5
-0, 68400, 518400, 0x9e4e4320
-0, 72000, 518400, 0x620c3212
-0, 75600, 518400, 0x4350df1d
-0, 79200, 518400, 0x6360ef84
-0, 82800, 518400, 0xc1866d03
-0, 86400, 518400, 0x38eb3b5b
-0, 90000, 518400, 0x00166df1
-0, 93600, 518400, 0x841ea87c
-0, 97200, 518400, 0x8b40f836
-0, 100800, 518400, 0x3b380ddf
-0, 104400, 518400, 0x275adf46
+#tb 0: 1/25
+0, 0, 0, 1, 518400, 0x40c7e2d9
+0, 1, 1, 1, 518400, 0xb16701a5
+0, 2, 2, 1, 518400, 0x12c2f5b1
+0, 3, 3, 1, 518400, 0x9832aecc
+0, 4, 4, 1, 518400, 0x2b8bcdec
+0, 5, 5, 1, 518400, 0x04448f3a
+0, 6, 6, 1, 518400, 0xc7ac82d8
+0, 7, 7, 1, 518400, 0xe746bb8a
+0, 8, 8, 1, 518400, 0xc7ac92d3
+0, 9, 9, 1, 518400, 0x38d89443
+0, 10, 10, 1, 518400, 0xcb9fbe74
+0, 11, 11, 1, 518400, 0x5543867d
+0, 12, 12, 1, 518400, 0xaf1b147f
+0, 13, 13, 1, 518400, 0xe5f07e40
+0, 14, 14, 1, 518400, 0x66dc6734
+0, 15, 15, 1, 518400, 0x0f9491be
+0, 16, 16, 1, 518400, 0xbcdaacac
+0, 17, 17, 1, 518400, 0xf4480ae7
+0, 18, 18, 1, 518400, 0xa5cef4d5
+0, 19, 19, 1, 518400, 0x9e4e4320
+0, 20, 20, 1, 518400, 0x620c3212
+0, 21, 21, 1, 518400, 0x4350df1d
+0, 22, 22, 1, 518400, 0x6360ef84
+0, 23, 23, 1, 518400, 0xc1866d03
+0, 24, 24, 1, 518400, 0x38eb3b5b
+0, 25, 25, 1, 518400, 0x00166df1
+0, 26, 26, 1, 518400, 0x841ea87c
+0, 27, 27, 1, 518400, 0x8b40f836
+0, 28, 28, 1, 518400, 0x3b380ddf
+0, 29, 29, 1, 518400, 0x275adf46
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cabac_mot_mbaff0_full b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cabac_mot_mbaff0_full
index 0e582f3..1e9313e 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cabac_mot_mbaff0_full
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cabac_mot_mbaff0_full
@@ -1,30 +1,31 @@
-0, 0, 518400, 0x8336b7db
-0, 3600, 518400, 0x9818c309
-0, 7200, 518400, 0x5417b6f9
-0, 10800, 518400, 0x8f0a5de4
-0, 14400, 518400, 0xa4ce43f3
-0, 18000, 518400, 0xfe748339
-0, 21600, 518400, 0xeab93a93
-0, 25200, 518400, 0x095176e4
-0, 28800, 518400, 0x99a45050
-0, 32400, 518400, 0xad3766e8
-0, 36000, 518400, 0xea133c1b
-0, 39600, 518400, 0xdcb2188b
-0, 43200, 518400, 0xec08c8ce
-0, 46800, 518400, 0xf38cd4f2
-0, 50400, 518400, 0x06177f80
-0, 54000, 518400, 0x2c68b642
-0, 57600, 518400, 0x7d290881
-0, 61200, 518400, 0x26c939d8
-0, 64800, 518400, 0xa0391a6e
-0, 68400, 518400, 0x3b9f02c1
-0, 72000, 518400, 0x335a0ff9
-0, 75600, 518400, 0x0deafb41
-0, 79200, 518400, 0xbf00bfe4
-0, 82800, 518400, 0xc9145210
-0, 86400, 518400, 0xb6e16a54
-0, 90000, 518400, 0xc31664da
-0, 93600, 518400, 0xfd3be55d
-0, 97200, 518400, 0xf33b134c
-0, 100800, 518400, 0xc6977304
-0, 104400, 518400, 0xa605bdb6
+#tb 0: 1/25
+0, 0, 0, 1, 518400, 0x8336b7db
+0, 1, 1, 1, 518400, 0x9818c309
+0, 2, 2, 1, 518400, 0x5417b6f9
+0, 3, 3, 1, 518400, 0x8f0a5de4
+0, 4, 4, 1, 518400, 0xa4ce43f3
+0, 5, 5, 1, 518400, 0xfe748339
+0, 6, 6, 1, 518400, 0xeab93a93
+0, 7, 7, 1, 518400, 0x095176e4
+0, 8, 8, 1, 518400, 0x99a45050
+0, 9, 9, 1, 518400, 0xad3766e8
+0, 10, 10, 1, 518400, 0xea133c1b
+0, 11, 11, 1, 518400, 0xdcb2188b
+0, 12, 12, 1, 518400, 0xec08c8ce
+0, 13, 13, 1, 518400, 0xf38cd4f2
+0, 14, 14, 1, 518400, 0x06177f80
+0, 15, 15, 1, 518400, 0x2c68b642
+0, 16, 16, 1, 518400, 0x7d290881
+0, 17, 17, 1, 518400, 0x26c939d8
+0, 18, 18, 1, 518400, 0xa0391a6e
+0, 19, 19, 1, 518400, 0x3b9f02c1
+0, 20, 20, 1, 518400, 0x335a0ff9
+0, 21, 21, 1, 518400, 0x0deafb41
+0, 22, 22, 1, 518400, 0xbf00bfe4
+0, 23, 23, 1, 518400, 0xc9145210
+0, 24, 24, 1, 518400, 0xb6e16a54
+0, 25, 25, 1, 518400, 0xc31664da
+0, 26, 26, 1, 518400, 0xfd3be55d
+0, 27, 27, 1, 518400, 0xf33b134c
+0, 28, 28, 1, 518400, 0xc6977304
+0, 29, 29, 1, 518400, 0xa605bdb6
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cabac_mot_picaff0_full b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cabac_mot_picaff0_full
index f2d6358..484025e 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cabac_mot_picaff0_full
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cabac_mot_picaff0_full
@@ -1,30 +1,31 @@
-0, 0, 518400, 0xd8b58a23
-0, 3600, 518400, 0xe53b4aba
-0, 7200, 518400, 0x6cbca47a
-0, 10800, 518400, 0xceb51253
-0, 14400, 518400, 0x60cb3cdd
-0, 18000, 518400, 0x7b633553
-0, 21600, 518400, 0x10c012c9
-0, 25200, 518400, 0xa340ee20
-0, 28800, 518400, 0x574c22c2
-0, 32400, 518400, 0xbcdb1bf7
-0, 36000, 518400, 0x57811e9a
-0, 39600, 518400, 0xdd4af748
-0, 43200, 518400, 0xb931a637
-0, 46800, 518400, 0xcef6ce95
-0, 50400, 518400, 0xd28c7085
-0, 54000, 518400, 0xae9daf53
-0, 57600, 518400, 0xca29d819
-0, 61200, 518400, 0x3c4bd7eb
-0, 64800, 518400, 0x912ee227
-0, 68400, 518400, 0xb67d0e27
-0, 72000, 518400, 0x8cf7309d
-0, 75600, 518400, 0x358ad344
-0, 79200, 518400, 0x4462c642
-0, 82800, 518400, 0x3bb43428
-0, 86400, 518400, 0x12d6f8ca
-0, 90000, 518400, 0x003f13aa
-0, 93600, 518400, 0x6cd8c432
-0, 97200, 518400, 0xee5ff01b
-0, 100800, 518400, 0xba0616ee
-0, 104400, 518400, 0x37fa7891
+#tb 0: 1/25
+0, 0, 0, 1, 518400, 0xd8b58a23
+0, 1, 1, 1, 518400, 0xe53b4aba
+0, 2, 2, 1, 518400, 0x6cbca47a
+0, 3, 3, 1, 518400, 0xceb51253
+0, 4, 4, 1, 518400, 0x60cb3cdd
+0, 5, 5, 1, 518400, 0x7b633553
+0, 6, 6, 1, 518400, 0x10c012c9
+0, 7, 7, 1, 518400, 0xa340ee20
+0, 8, 8, 1, 518400, 0x574c22c2
+0, 9, 9, 1, 518400, 0xbcdb1bf7
+0, 10, 10, 1, 518400, 0x57811e9a
+0, 11, 11, 1, 518400, 0xdd4af748
+0, 12, 12, 1, 518400, 0xb931a637
+0, 13, 13, 1, 518400, 0xcef6ce95
+0, 14, 14, 1, 518400, 0xd28c7085
+0, 15, 15, 1, 518400, 0xae9daf53
+0, 16, 16, 1, 518400, 0xca29d819
+0, 17, 17, 1, 518400, 0x3c4bd7eb
+0, 18, 18, 1, 518400, 0x912ee227
+0, 19, 19, 1, 518400, 0xb67d0e27
+0, 20, 20, 1, 518400, 0x8cf7309d
+0, 21, 21, 1, 518400, 0x358ad344
+0, 22, 22, 1, 518400, 0x4462c642
+0, 23, 23, 1, 518400, 0x3bb43428
+0, 24, 24, 1, 518400, 0x12d6f8ca
+0, 25, 25, 1, 518400, 0x003f13aa
+0, 26, 26, 1, 518400, 0x6cd8c432
+0, 27, 27, 1, 518400, 0xee5ff01b
+0, 28, 28, 1, 518400, 0xba0616ee
+0, 29, 29, 1, 518400, 0x37fa7891
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cabaci3_sony_b b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cabaci3_sony_b
index f0ea8c2..9dc4884 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cabaci3_sony_b
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cabaci3_sony_b
@@ -1,300 +1,301 @@
-0, 0, 38016, 0x705f2f41
-0, 3600, 38016, 0xa76d1766
-0, 7200, 38016, 0xf367e6f4
-0, 10800, 38016, 0xdce8a69a
-0, 14400, 38016, 0xda9d986e
-0, 18000, 38016, 0x50117ea5
-0, 21600, 38016, 0x07a848eb
-0, 25200, 38016, 0x28ab4f59
-0, 28800, 38016, 0xf6913e4c
-0, 32400, 38016, 0x3daa3500
-0, 36000, 38016, 0xe9f67703
-0, 39600, 38016, 0x9a5289e6
-0, 43200, 38016, 0x9efd705f
-0, 46800, 38016, 0x1193b01d
-0, 50400, 38016, 0x30a5acd7
-0, 54000, 38016, 0x7e3da07d
-0, 57600, 38016, 0x0f85afc6
-0, 61200, 38016, 0x8b7ba455
-0, 64800, 38016, 0xac327dfb
-0, 68400, 38016, 0x3eee7fdb
-0, 72000, 38016, 0x37fa626b
-0, 75600, 38016, 0x2c4f2501
-0, 79200, 38016, 0xa25a239a
-0, 82800, 38016, 0xe69b2327
-0, 86400, 38016, 0x6bd6164e
-0, 90000, 38016, 0xae9c2daa
-0, 93600, 38016, 0xe115331d
-0, 97200, 38016, 0xde8f2833
-0, 100800, 38016, 0xd0b45915
-0, 104400, 38016, 0x3ab16824
-0, 108000, 38016, 0x4df45e8d
-0, 111600, 38016, 0x48569b82
-0, 115200, 38016, 0x75c5b1ee
-0, 118800, 38016, 0x64e5a3ba
-0, 122400, 38016, 0x3190d133
-0, 126000, 38016, 0x4825ce86
-0, 129600, 38016, 0x8f85ab8e
-0, 133200, 38016, 0x3fb1cbc5
-0, 136800, 38016, 0x2b2cbe7d
-0, 140400, 38016, 0xa905a6a6
-0, 144000, 38016, 0x6365c188
-0, 147600, 38016, 0xff23c08d
-0, 151200, 38016, 0x73edada6
-0, 154800, 38016, 0x6be0b8a9
-0, 158400, 38016, 0x604bb6c9
-0, 162000, 38016, 0x62468a3b
-0, 165600, 38016, 0x994aad7a
-0, 169200, 38016, 0xfee1b59e
-0, 172800, 38016, 0xf722aa78
-0, 176400, 38016, 0x0ddfbf68
-0, 180000, 38016, 0x510ab7b1
-0, 183600, 38016, 0x156ca919
-0, 187200, 38016, 0xb176b488
-0, 190800, 38016, 0xd70cb8f8
-0, 194400, 38016, 0x3844b2d2
-0, 198000, 38016, 0x0ed8c6ee
-0, 201600, 38016, 0x0c6ac5ff
-0, 205200, 38016, 0x1284c442
-0, 208800, 38016, 0x0486d06c
-0, 212400, 38016, 0x0d42d1c1
-0, 216000, 38016, 0xd24297f3
-0, 219600, 38016, 0xe05cab59
-0, 223200, 38016, 0x12f1921f
-0, 226800, 38016, 0x0dc6403e
-0, 230400, 38016, 0x277f593c
-0, 234000, 38016, 0xfb7c81f8
-0, 237600, 38016, 0xb31b90b0
-0, 241200, 38016, 0x8be3e8ae
-0, 244800, 38016, 0x9aaa1ff1
-0, 248400, 38016, 0x4e6832b9
-0, 252000, 38016, 0x93fd6a5e
-0, 255600, 38016, 0xd9438f08
-0, 259200, 38016, 0x5e41b067
-0, 262800, 38016, 0xee80f32a
-0, 266400, 38016, 0x75632fe3
-0, 270000, 38016, 0xc0a93ec1
-0, 273600, 38016, 0x4e3e80c4
-0, 277200, 38016, 0x9e5398d6
-0, 280800, 38016, 0xd20aac32
-0, 284400, 38016, 0xacf5c5da
-0, 288000, 38016, 0xbe6bca1a
-0, 291600, 38016, 0x098bdac2
-0, 295200, 38016, 0xe706e491
-0, 298800, 38016, 0xcda7d8ee
-0, 302400, 38016, 0xb1d4d3f4
-0, 306000, 38016, 0x3e20d6cd
-0, 309600, 38016, 0xf368e66a
-0, 313200, 38016, 0xbfbee5b1
-0, 316800, 38016, 0xb580ec3d
-0, 320400, 38016, 0xce8dec65
-0, 324000, 38016, 0xb6fda1c2
-0, 327600, 38016, 0xb2d5ad04
-0, 331200, 38016, 0x28959c5a
-0, 334800, 38016, 0x7b1d7c65
-0, 338400, 38016, 0x357e79cd
-0, 342000, 38016, 0x08f57396
-0, 345600, 38016, 0xe59973b8
-0, 349200, 38016, 0x288a9c28
-0, 352800, 38016, 0x09a4a82f
-0, 356400, 38016, 0x61b5a518
-0, 360000, 38016, 0xddbfb88d
-0, 363600, 38016, 0x14b5a41e
-0, 367200, 38016, 0x56588add
-0, 370800, 38016, 0x7e3890c1
-0, 374400, 38016, 0xbb1eb4df
-0, 378000, 38016, 0x3b34a7d8
-0, 381600, 38016, 0xe15ddc56
-0, 385200, 38016, 0x9ed7ff21
-0, 388800, 38016, 0x03200458
-0, 392400, 38016, 0x74493572
-0, 396000, 38016, 0x73d14274
-0, 399600, 38016, 0x02933587
-0, 403200, 38016, 0x5ea74e05
-0, 406800, 38016, 0xd73d303e
-0, 410400, 38016, 0x0a17f1ea
-0, 414000, 38016, 0x915f0dcd
-0, 417600, 38016, 0xca041a88
-0, 421200, 38016, 0xc6a303b2
-0, 424800, 38016, 0x2c903df2
-0, 428400, 38016, 0x2dd04691
-0, 432000, 38016, 0xfe783551
-0, 435600, 38016, 0x900c419c
-0, 439200, 38016, 0x01b92a15
-0, 442800, 38016, 0xcce4e851
-0, 446400, 38016, 0x0167d6f6
-0, 450000, 38016, 0x023eb3fa
-0, 453600, 38016, 0xafc29caa
-0, 457200, 38016, 0xf205b88c
-0, 460800, 38016, 0x5518cc46
-0, 464400, 38016, 0x64cdd1d5
-0, 468000, 38016, 0x8e9eecb4
-0, 471600, 38016, 0xd1e0e2f8
-0, 475200, 38016, 0xb849cf3c
-0, 478800, 38016, 0xb5e4d916
-0, 482400, 38016, 0xc6c5da7e
-0, 486000, 38016, 0xcbcda68d
-0, 489600, 38016, 0x21d7bd73
-0, 493200, 38016, 0x6737b4b9
-0, 496800, 38016, 0x379f9a5f
-0, 500400, 38016, 0xa13da6cc
-0, 504000, 38016, 0x06fc941a
-0, 507600, 38016, 0x78c57e95
-0, 511200, 38016, 0x2f6674d4
-0, 514800, 38016, 0x37776db9
-0, 518400, 38016, 0x257268db
-0, 522000, 38016, 0x1dbe7e72
-0, 525600, 38016, 0x2cb96bb0
-0, 529200, 38016, 0x46a840f2
-0, 532800, 38016, 0x95951fd6
-0, 536400, 38016, 0x627ef7b2
-0, 540000, 38016, 0xa5b0b2d3
-0, 543600, 38016, 0x69fdcae9
-0, 547200, 38016, 0x0c25c873
-0, 550800, 38016, 0x3533a2cc
-0, 554400, 38016, 0x3a74b6c2
-0, 558000, 38016, 0x9d1dcbc1
-0, 561600, 38016, 0xce33cf86
-0, 565200, 38016, 0xf34201f5
-0, 568800, 38016, 0xab5f2e2b
-0, 572400, 38016, 0xf062405d
-0, 576000, 38016, 0xe7f85f7c
-0, 579600, 38016, 0x684f4ee4
-0, 583200, 38016, 0x41b83014
-0, 586800, 38016, 0x70142f5f
-0, 590400, 38016, 0x3cb229b1
-0, 594000, 38016, 0x6bd1f24c
-0, 597600, 38016, 0x9366ec77
-0, 601200, 38016, 0x6af0c1ec
-0, 604800, 38016, 0xb11a9005
-0, 608400, 38016, 0x83e390b7
-0, 612000, 38016, 0x97679ab5
-0, 615600, 38016, 0xabe3b114
-0, 619200, 38016, 0x2efed19f
-0, 622800, 38016, 0x18eddb2e
-0, 626400, 38016, 0x0a37c6fb
-0, 630000, 38016, 0xddb0a2fe
-0, 633600, 38016, 0xf8627091
-0, 637200, 38016, 0x97123074
-0, 640800, 38016, 0x33af3174
-0, 644400, 38016, 0x5caa22fe
-0, 648000, 38016, 0xa203eccf
-0, 651600, 38016, 0x506eee0c
-0, 655200, 38016, 0x2066d541
-0, 658800, 38016, 0xe08acab1
-0, 662400, 38016, 0x6740ecc4
-0, 666000, 38016, 0x954dfd6d
-0, 669600, 38016, 0xbd7ffef8
-0, 673200, 38016, 0x629f2cca
-0, 676800, 38016, 0xebd92f12
-0, 680400, 38016, 0xe5bd297f
-0, 684000, 38016, 0xcb2be670
-0, 687600, 38016, 0x51d7b529
-0, 691200, 38016, 0x95d7ab30
-0, 694800, 38016, 0x18e3df99
-0, 698400, 38016, 0xae3af726
-0, 702000, 38016, 0x9b831ee3
-0, 705600, 38016, 0x3c614e45
-0, 709200, 38016, 0x3c0a600c
-0, 712800, 38016, 0xdade838b
-0, 716400, 38016, 0xbbe3a0a7
-0, 720000, 38016, 0xd4d5b780
-0, 723600, 38016, 0xceebb4b7
-0, 727200, 38016, 0x1a8ccbb3
-0, 730800, 38016, 0x95dccfab
-0, 734400, 38016, 0xea9bc737
-0, 738000, 38016, 0xa0f6d561
-0, 741600, 38016, 0x7877d698
-0, 745200, 38016, 0xd6aad54c
-0, 748800, 38016, 0xca62c8b7
-0, 752400, 38016, 0xebc9ae1c
-0, 756000, 38016, 0x46c96194
-0, 759600, 38016, 0x61197fc4
-0, 763200, 38016, 0x9ae97570
-0, 766800, 38016, 0x7cd254da
-0, 770400, 38016, 0xe4816953
-0, 774000, 38016, 0x68685b2c
-0, 777600, 38016, 0x08d93f79
-0, 781200, 38016, 0xb4cc526b
-0, 784800, 38016, 0xc0d253d9
-0, 788400, 38016, 0x95b83d64
-0, 792000, 38016, 0xadf7454f
-0, 795600, 38016, 0xaa1d339b
-0, 799200, 38016, 0xae0417f8
-0, 802800, 38016, 0x09d2294d
-0, 806400, 38016, 0xbd892e9d
-0, 810000, 38016, 0xbccd0f97
-0, 813600, 38016, 0x03c13bd3
-0, 817200, 38016, 0x09d045d7
-0, 820800, 38016, 0xaa484278
-0, 824400, 38016, 0x054b8639
-0, 828000, 38016, 0x45e29e62
-0, 831600, 38016, 0x38bbb067
-0, 835200, 38016, 0x9f5cfc30
-0, 838800, 38016, 0x38551b76
-0, 842400, 38016, 0x3e1b18ee
-0, 846000, 38016, 0x7baf4e34
-0, 849600, 38016, 0xff6458d1
-0, 853200, 38016, 0xb7963c49
-0, 856800, 38016, 0xdaee3f6a
-0, 860400, 38016, 0xc88e09c9
-0, 864000, 38016, 0x88a7de38
-0, 867600, 38016, 0x9e81cb62
-0, 871200, 38016, 0x84d0aca7
-0, 874800, 38016, 0x3312f41e
-0, 878400, 38016, 0x550065dc
-0, 882000, 38016, 0x7e88d07e
-0, 885600, 38016, 0x9370ed4f
-0, 889200, 38016, 0xd9c9d592
-0, 892800, 38016, 0xec7589ce
-0, 896400, 38016, 0xeca71251
-0, 900000, 38016, 0xf183b951
-0, 903600, 38016, 0x9a1b740a
-0, 907200, 38016, 0x97ea5ffc
-0, 910800, 38016, 0x058dc572
-0, 914400, 38016, 0xae44345a
-0, 918000, 38016, 0xef22c82e
-0, 921600, 38016, 0x8364d583
-0, 925200, 38016, 0x2f725dfa
-0, 928800, 38016, 0x5eda3160
-0, 932400, 38016, 0x4a464613
-0, 936000, 38016, 0x447f444d
-0, 939600, 38016, 0x076b3dd8
-0, 943200, 38016, 0x690f58de
-0, 946800, 38016, 0xf4635e91
-0, 950400, 38016, 0xd5db44e7
-0, 954000, 38016, 0xced25176
-0, 957600, 38016, 0x227a2f9a
-0, 961200, 38016, 0x72100520
-0, 964800, 38016, 0x6549f9b4
-0, 968400, 38016, 0x3f77cef4
-0, 972000, 38016, 0x3d1ba72f
-0, 975600, 38016, 0xa1dd85d2
-0, 979200, 38016, 0x9a35655e
-0, 982800, 38016, 0xdc900dc6
-0, 986400, 38016, 0xca05d5cb
-0, 990000, 38016, 0xeff0be86
-0, 993600, 38016, 0xdcceb22e
-0, 997200, 38016, 0x5952d133
-0, 1000800, 38016, 0x3ab3facb
-0, 1004400, 38016, 0xdb8d4de4
-0, 1008000, 38016, 0x0afc170d
-0, 1011600, 38016, 0xd14ddc59
-0, 1015200, 38016, 0xbabf89eb
-0, 1018800, 38016, 0x09d38f7b
-0, 1022400, 38016, 0xe4805dba
-0, 1026000, 38016, 0x4d919dcf
-0, 1029600, 38016, 0x3e8c60be
-0, 1033200, 38016, 0x6c1fa94b
-0, 1036800, 38016, 0x6b68a320
-0, 1040400, 38016, 0x9de774f6
-0, 1044000, 38016, 0x38d0ecc6
-0, 1047600, 38016, 0x0623207f
-0, 1051200, 38016, 0x36429915
-0, 1054800, 38016, 0x659fdd42
-0, 1058400, 38016, 0x59c93475
-0, 1062000, 38016, 0xecd1200d
-0, 1065600, 38016, 0x3b2af9c2
-0, 1069200, 38016, 0xd00600da
-0, 1072800, 38016, 0xb0bc21ee
-0, 1076400, 38016, 0xc11f3ec2
+#tb 0: 1/25
+0, 0, 0, 1, 38016, 0x705f2f41
+0, 1, 1, 1, 38016, 0xa76d1766
+0, 2, 2, 1, 38016, 0xf367e6f4
+0, 3, 3, 1, 38016, 0xdce8a69a
+0, 4, 4, 1, 38016, 0xda9d986e
+0, 5, 5, 1, 38016, 0x50117ea5
+0, 6, 6, 1, 38016, 0x07a848eb
+0, 7, 7, 1, 38016, 0x28ab4f59
+0, 8, 8, 1, 38016, 0xf6913e4c
+0, 9, 9, 1, 38016, 0x3daa3500
+0, 10, 10, 1, 38016, 0xe9f67703
+0, 11, 11, 1, 38016, 0x9a5289e6
+0, 12, 12, 1, 38016, 0x9efd705f
+0, 13, 13, 1, 38016, 0x1193b01d
+0, 14, 14, 1, 38016, 0x30a5acd7
+0, 15, 15, 1, 38016, 0x7e3da07d
+0, 16, 16, 1, 38016, 0x0f85afc6
+0, 17, 17, 1, 38016, 0x8b7ba455
+0, 18, 18, 1, 38016, 0xac327dfb
+0, 19, 19, 1, 38016, 0x3eee7fdb
+0, 20, 20, 1, 38016, 0x37fa626b
+0, 21, 21, 1, 38016, 0x2c4f2501
+0, 22, 22, 1, 38016, 0xa25a239a
+0, 23, 23, 1, 38016, 0xe69b2327
+0, 24, 24, 1, 38016, 0x6bd6164e
+0, 25, 25, 1, 38016, 0xae9c2daa
+0, 26, 26, 1, 38016, 0xe115331d
+0, 27, 27, 1, 38016, 0xde8f2833
+0, 28, 28, 1, 38016, 0xd0b45915
+0, 29, 29, 1, 38016, 0x3ab16824
+0, 30, 30, 1, 38016, 0x4df45e8d
+0, 31, 31, 1, 38016, 0x48569b82
+0, 32, 32, 1, 38016, 0x75c5b1ee
+0, 33, 33, 1, 38016, 0x64e5a3ba
+0, 34, 34, 1, 38016, 0x3190d133
+0, 35, 35, 1, 38016, 0x4825ce86
+0, 36, 36, 1, 38016, 0x8f85ab8e
+0, 37, 37, 1, 38016, 0x3fb1cbc5
+0, 38, 38, 1, 38016, 0x2b2cbe7d
+0, 39, 39, 1, 38016, 0xa905a6a6
+0, 40, 40, 1, 38016, 0x6365c188
+0, 41, 41, 1, 38016, 0xff23c08d
+0, 42, 42, 1, 38016, 0x73edada6
+0, 43, 43, 1, 38016, 0x6be0b8a9
+0, 44, 44, 1, 38016, 0x604bb6c9
+0, 45, 45, 1, 38016, 0x62468a3b
+0, 46, 46, 1, 38016, 0x994aad7a
+0, 47, 47, 1, 38016, 0xfee1b59e
+0, 48, 48, 1, 38016, 0xf722aa78
+0, 49, 49, 1, 38016, 0x0ddfbf68
+0, 50, 50, 1, 38016, 0x510ab7b1
+0, 51, 51, 1, 38016, 0x156ca919
+0, 52, 52, 1, 38016, 0xb176b488
+0, 53, 53, 1, 38016, 0xd70cb8f8
+0, 54, 54, 1, 38016, 0x3844b2d2
+0, 55, 55, 1, 38016, 0x0ed8c6ee
+0, 56, 56, 1, 38016, 0x0c6ac5ff
+0, 57, 57, 1, 38016, 0x1284c442
+0, 58, 58, 1, 38016, 0x0486d06c
+0, 59, 59, 1, 38016, 0x0d42d1c1
+0, 60, 60, 1, 38016, 0xd24297f3
+0, 61, 61, 1, 38016, 0xe05cab59
+0, 62, 62, 1, 38016, 0x12f1921f
+0, 63, 63, 1, 38016, 0x0dc6403e
+0, 64, 64, 1, 38016, 0x277f593c
+0, 65, 65, 1, 38016, 0xfb7c81f8
+0, 66, 66, 1, 38016, 0xb31b90b0
+0, 67, 67, 1, 38016, 0x8be3e8ae
+0, 68, 68, 1, 38016, 0x9aaa1ff1
+0, 69, 69, 1, 38016, 0x4e6832b9
+0, 70, 70, 1, 38016, 0x93fd6a5e
+0, 71, 71, 1, 38016, 0xd9438f08
+0, 72, 72, 1, 38016, 0x5e41b067
+0, 73, 73, 1, 38016, 0xee80f32a
+0, 74, 74, 1, 38016, 0x75632fe3
+0, 75, 75, 1, 38016, 0xc0a93ec1
+0, 76, 76, 1, 38016, 0x4e3e80c4
+0, 77, 77, 1, 38016, 0x9e5398d6
+0, 78, 78, 1, 38016, 0xd20aac32
+0, 79, 79, 1, 38016, 0xacf5c5da
+0, 80, 80, 1, 38016, 0xbe6bca1a
+0, 81, 81, 1, 38016, 0x098bdac2
+0, 82, 82, 1, 38016, 0xe706e491
+0, 83, 83, 1, 38016, 0xcda7d8ee
+0, 84, 84, 1, 38016, 0xb1d4d3f4
+0, 85, 85, 1, 38016, 0x3e20d6cd
+0, 86, 86, 1, 38016, 0xf368e66a
+0, 87, 87, 1, 38016, 0xbfbee5b1
+0, 88, 88, 1, 38016, 0xb580ec3d
+0, 89, 89, 1, 38016, 0xce8dec65
+0, 90, 90, 1, 38016, 0xb6fda1c2
+0, 91, 91, 1, 38016, 0xb2d5ad04
+0, 92, 92, 1, 38016, 0x28959c5a
+0, 93, 93, 1, 38016, 0x7b1d7c65
+0, 94, 94, 1, 38016, 0x357e79cd
+0, 95, 95, 1, 38016, 0x08f57396
+0, 96, 96, 1, 38016, 0xe59973b8
+0, 97, 97, 1, 38016, 0x288a9c28
+0, 98, 98, 1, 38016, 0x09a4a82f
+0, 99, 99, 1, 38016, 0x61b5a518
+0, 100, 100, 1, 38016, 0xddbfb88d
+0, 101, 101, 1, 38016, 0x14b5a41e
+0, 102, 102, 1, 38016, 0x56588add
+0, 103, 103, 1, 38016, 0x7e3890c1
+0, 104, 104, 1, 38016, 0xbb1eb4df
+0, 105, 105, 1, 38016, 0x3b34a7d8
+0, 106, 106, 1, 38016, 0xe15ddc56
+0, 107, 107, 1, 38016, 0x9ed7ff21
+0, 108, 108, 1, 38016, 0x03200458
+0, 109, 109, 1, 38016, 0x74493572
+0, 110, 110, 1, 38016, 0x73d14274
+0, 111, 111, 1, 38016, 0x02933587
+0, 112, 112, 1, 38016, 0x5ea74e05
+0, 113, 113, 1, 38016, 0xd73d303e
+0, 114, 114, 1, 38016, 0x0a17f1ea
+0, 115, 115, 1, 38016, 0x915f0dcd
+0, 116, 116, 1, 38016, 0xca041a88
+0, 117, 117, 1, 38016, 0xc6a303b2
+0, 118, 118, 1, 38016, 0x2c903df2
+0, 119, 119, 1, 38016, 0x2dd04691
+0, 120, 120, 1, 38016, 0xfe783551
+0, 121, 121, 1, 38016, 0x900c419c
+0, 122, 122, 1, 38016, 0x01b92a15
+0, 123, 123, 1, 38016, 0xcce4e851
+0, 124, 124, 1, 38016, 0x0167d6f6
+0, 125, 125, 1, 38016, 0x023eb3fa
+0, 126, 126, 1, 38016, 0xafc29caa
+0, 127, 127, 1, 38016, 0xf205b88c
+0, 128, 128, 1, 38016, 0x5518cc46
+0, 129, 129, 1, 38016, 0x64cdd1d5
+0, 130, 130, 1, 38016, 0x8e9eecb4
+0, 131, 131, 1, 38016, 0xd1e0e2f8
+0, 132, 132, 1, 38016, 0xb849cf3c
+0, 133, 133, 1, 38016, 0xb5e4d916
+0, 134, 134, 1, 38016, 0xc6c5da7e
+0, 135, 135, 1, 38016, 0xcbcda68d
+0, 136, 136, 1, 38016, 0x21d7bd73
+0, 137, 137, 1, 38016, 0x6737b4b9
+0, 138, 138, 1, 38016, 0x379f9a5f
+0, 139, 139, 1, 38016, 0xa13da6cc
+0, 140, 140, 1, 38016, 0x06fc941a
+0, 141, 141, 1, 38016, 0x78c57e95
+0, 142, 142, 1, 38016, 0x2f6674d4
+0, 143, 143, 1, 38016, 0x37776db9
+0, 144, 144, 1, 38016, 0x257268db
+0, 145, 145, 1, 38016, 0x1dbe7e72
+0, 146, 146, 1, 38016, 0x2cb96bb0
+0, 147, 147, 1, 38016, 0x46a840f2
+0, 148, 148, 1, 38016, 0x95951fd6
+0, 149, 149, 1, 38016, 0x627ef7b2
+0, 150, 150, 1, 38016, 0xa5b0b2d3
+0, 151, 151, 1, 38016, 0x69fdcae9
+0, 152, 152, 1, 38016, 0x0c25c873
+0, 153, 153, 1, 38016, 0x3533a2cc
+0, 154, 154, 1, 38016, 0x3a74b6c2
+0, 155, 155, 1, 38016, 0x9d1dcbc1
+0, 156, 156, 1, 38016, 0xce33cf86
+0, 157, 157, 1, 38016, 0xf34201f5
+0, 158, 158, 1, 38016, 0xab5f2e2b
+0, 159, 159, 1, 38016, 0xf062405d
+0, 160, 160, 1, 38016, 0xe7f85f7c
+0, 161, 161, 1, 38016, 0x684f4ee4
+0, 162, 162, 1, 38016, 0x41b83014
+0, 163, 163, 1, 38016, 0x70142f5f
+0, 164, 164, 1, 38016, 0x3cb229b1
+0, 165, 165, 1, 38016, 0x6bd1f24c
+0, 166, 166, 1, 38016, 0x9366ec77
+0, 167, 167, 1, 38016, 0x6af0c1ec
+0, 168, 168, 1, 38016, 0xb11a9005
+0, 169, 169, 1, 38016, 0x83e390b7
+0, 170, 170, 1, 38016, 0x97679ab5
+0, 171, 171, 1, 38016, 0xabe3b114
+0, 172, 172, 1, 38016, 0x2efed19f
+0, 173, 173, 1, 38016, 0x18eddb2e
+0, 174, 174, 1, 38016, 0x0a37c6fb
+0, 175, 175, 1, 38016, 0xddb0a2fe
+0, 176, 176, 1, 38016, 0xf8627091
+0, 177, 177, 1, 38016, 0x97123074
+0, 178, 178, 1, 38016, 0x33af3174
+0, 179, 179, 1, 38016, 0x5caa22fe
+0, 180, 180, 1, 38016, 0xa203eccf
+0, 181, 181, 1, 38016, 0x506eee0c
+0, 182, 182, 1, 38016, 0x2066d541
+0, 183, 183, 1, 38016, 0xe08acab1
+0, 184, 184, 1, 38016, 0x6740ecc4
+0, 185, 185, 1, 38016, 0x954dfd6d
+0, 186, 186, 1, 38016, 0xbd7ffef8
+0, 187, 187, 1, 38016, 0x629f2cca
+0, 188, 188, 1, 38016, 0xebd92f12
+0, 189, 189, 1, 38016, 0xe5bd297f
+0, 190, 190, 1, 38016, 0xcb2be670
+0, 191, 191, 1, 38016, 0x51d7b529
+0, 192, 192, 1, 38016, 0x95d7ab30
+0, 193, 193, 1, 38016, 0x18e3df99
+0, 194, 194, 1, 38016, 0xae3af726
+0, 195, 195, 1, 38016, 0x9b831ee3
+0, 196, 196, 1, 38016, 0x3c614e45
+0, 197, 197, 1, 38016, 0x3c0a600c
+0, 198, 198, 1, 38016, 0xdade838b
+0, 199, 199, 1, 38016, 0xbbe3a0a7
+0, 200, 200, 1, 38016, 0xd4d5b780
+0, 201, 201, 1, 38016, 0xceebb4b7
+0, 202, 202, 1, 38016, 0x1a8ccbb3
+0, 203, 203, 1, 38016, 0x95dccfab
+0, 204, 204, 1, 38016, 0xea9bc737
+0, 205, 205, 1, 38016, 0xa0f6d561
+0, 206, 206, 1, 38016, 0x7877d698
+0, 207, 207, 1, 38016, 0xd6aad54c
+0, 208, 208, 1, 38016, 0xca62c8b7
+0, 209, 209, 1, 38016, 0xebc9ae1c
+0, 210, 210, 1, 38016, 0x46c96194
+0, 211, 211, 1, 38016, 0x61197fc4
+0, 212, 212, 1, 38016, 0x9ae97570
+0, 213, 213, 1, 38016, 0x7cd254da
+0, 214, 214, 1, 38016, 0xe4816953
+0, 215, 215, 1, 38016, 0x68685b2c
+0, 216, 216, 1, 38016, 0x08d93f79
+0, 217, 217, 1, 38016, 0xb4cc526b
+0, 218, 218, 1, 38016, 0xc0d253d9
+0, 219, 219, 1, 38016, 0x95b83d64
+0, 220, 220, 1, 38016, 0xadf7454f
+0, 221, 221, 1, 38016, 0xaa1d339b
+0, 222, 222, 1, 38016, 0xae0417f8
+0, 223, 223, 1, 38016, 0x09d2294d
+0, 224, 224, 1, 38016, 0xbd892e9d
+0, 225, 225, 1, 38016, 0xbccd0f97
+0, 226, 226, 1, 38016, 0x03c13bd3
+0, 227, 227, 1, 38016, 0x09d045d7
+0, 228, 228, 1, 38016, 0xaa484278
+0, 229, 229, 1, 38016, 0x054b8639
+0, 230, 230, 1, 38016, 0x45e29e62
+0, 231, 231, 1, 38016, 0x38bbb067
+0, 232, 232, 1, 38016, 0x9f5cfc30
+0, 233, 233, 1, 38016, 0x38551b76
+0, 234, 234, 1, 38016, 0x3e1b18ee
+0, 235, 235, 1, 38016, 0x7baf4e34
+0, 236, 236, 1, 38016, 0xff6458d1
+0, 237, 237, 1, 38016, 0xb7963c49
+0, 238, 238, 1, 38016, 0xdaee3f6a
+0, 239, 239, 1, 38016, 0xc88e09c9
+0, 240, 240, 1, 38016, 0x88a7de38
+0, 241, 241, 1, 38016, 0x9e81cb62
+0, 242, 242, 1, 38016, 0x84d0aca7
+0, 243, 243, 1, 38016, 0x3312f41e
+0, 244, 244, 1, 38016, 0x550065dc
+0, 245, 245, 1, 38016, 0x7e88d07e
+0, 246, 246, 1, 38016, 0x9370ed4f
+0, 247, 247, 1, 38016, 0xd9c9d592
+0, 248, 248, 1, 38016, 0xec7589ce
+0, 249, 249, 1, 38016, 0xeca71251
+0, 250, 250, 1, 38016, 0xf183b951
+0, 251, 251, 1, 38016, 0x9a1b740a
+0, 252, 252, 1, 38016, 0x97ea5ffc
+0, 253, 253, 1, 38016, 0x058dc572
+0, 254, 254, 1, 38016, 0xae44345a
+0, 255, 255, 1, 38016, 0xef22c82e
+0, 256, 256, 1, 38016, 0x8364d583
+0, 257, 257, 1, 38016, 0x2f725dfa
+0, 258, 258, 1, 38016, 0x5eda3160
+0, 259, 259, 1, 38016, 0x4a464613
+0, 260, 260, 1, 38016, 0x447f444d
+0, 261, 261, 1, 38016, 0x076b3dd8
+0, 262, 262, 1, 38016, 0x690f58de
+0, 263, 263, 1, 38016, 0xf4635e91
+0, 264, 264, 1, 38016, 0xd5db44e7
+0, 265, 265, 1, 38016, 0xced25176
+0, 266, 266, 1, 38016, 0x227a2f9a
+0, 267, 267, 1, 38016, 0x72100520
+0, 268, 268, 1, 38016, 0x6549f9b4
+0, 269, 269, 1, 38016, 0x3f77cef4
+0, 270, 270, 1, 38016, 0x3d1ba72f
+0, 271, 271, 1, 38016, 0xa1dd85d2
+0, 272, 272, 1, 38016, 0x9a35655e
+0, 273, 273, 1, 38016, 0xdc900dc6
+0, 274, 274, 1, 38016, 0xca05d5cb
+0, 275, 275, 1, 38016, 0xeff0be86
+0, 276, 276, 1, 38016, 0xdcceb22e
+0, 277, 277, 1, 38016, 0x5952d133
+0, 278, 278, 1, 38016, 0x3ab3facb
+0, 279, 279, 1, 38016, 0xdb8d4de4
+0, 280, 280, 1, 38016, 0x0afc170d
+0, 281, 281, 1, 38016, 0xd14ddc59
+0, 282, 282, 1, 38016, 0xbabf89eb
+0, 283, 283, 1, 38016, 0x09d38f7b
+0, 284, 284, 1, 38016, 0xe4805dba
+0, 285, 285, 1, 38016, 0x4d919dcf
+0, 286, 286, 1, 38016, 0x3e8c60be
+0, 287, 287, 1, 38016, 0x6c1fa94b
+0, 288, 288, 1, 38016, 0x6b68a320
+0, 289, 289, 1, 38016, 0x9de774f6
+0, 290, 290, 1, 38016, 0x38d0ecc6
+0, 291, 291, 1, 38016, 0x0623207f
+0, 292, 292, 1, 38016, 0x36429915
+0, 293, 293, 1, 38016, 0x659fdd42
+0, 294, 294, 1, 38016, 0x59c93475
+0, 295, 295, 1, 38016, 0xecd1200d
+0, 296, 296, 1, 38016, 0x3b2af9c2
+0, 297, 297, 1, 38016, 0xd00600da
+0, 298, 298, 1, 38016, 0xb0bc21ee
+0, 299, 299, 1, 38016, 0xc11f3ec2
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cabast3_sony_e b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cabast3_sony_e
index 06c9f1c..00519ef 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cabast3_sony_e
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cabast3_sony_e
@@ -1,25 +1,26 @@
-0, 0, 152064, 0x96ebb3a2
-0, 3600, 152064, 0x5184d912
-0, 7200, 152064, 0xfa0c9abe
-0, 10800, 152064, 0x6dd81860
-0, 14400, 152064, 0xc5202966
-0, 18000, 152064, 0xa7dfdf71
-0, 21600, 152064, 0xffa5609f
-0, 25200, 152064, 0x352e7ce5
-0, 28800, 152064, 0xc9e52c2a
-0, 32400, 152064, 0x12dfd28d
-0, 36000, 152064, 0x962af5fe
-0, 39600, 152064, 0xa8459cb1
-0, 43200, 152064, 0xc0771945
-0, 46800, 152064, 0xfcbc351d
-0, 50400, 152064, 0xd925dfa3
-0, 54000, 152064, 0x7c627c21
-0, 57600, 152064, 0x617d8d96
-0, 61200, 152064, 0x91816b34
-0, 64800, 152064, 0xece0eaf8
-0, 68400, 152064, 0x7b1408ef
-0, 72000, 152064, 0x7430c4d2
-0, 75600, 152064, 0xdb5844fa
-0, 79200, 152064, 0xcc874ff7
-0, 82800, 152064, 0x97630fb8
-0, 86400, 152064, 0x16ae9c92
+#tb 0: 1/25
+0, 0, 0, 1, 152064, 0x96ebb3a2
+0, 1, 1, 1, 152064, 0x5184d912
+0, 2, 2, 1, 152064, 0xfa0c9abe
+0, 3, 3, 1, 152064, 0x6dd81860
+0, 4, 4, 1, 152064, 0xc5202966
+0, 5, 5, 1, 152064, 0xa7dfdf71
+0, 6, 6, 1, 152064, 0xffa5609f
+0, 7, 7, 1, 152064, 0x352e7ce5
+0, 8, 8, 1, 152064, 0xc9e52c2a
+0, 9, 9, 1, 152064, 0x12dfd28d
+0, 10, 10, 1, 152064, 0x962af5fe
+0, 11, 11, 1, 152064, 0xa8459cb1
+0, 12, 12, 1, 152064, 0xc0771945
+0, 13, 13, 1, 152064, 0xfcbc351d
+0, 14, 14, 1, 152064, 0xd925dfa3
+0, 15, 15, 1, 152064, 0x7c627c21
+0, 16, 16, 1, 152064, 0x617d8d96
+0, 17, 17, 1, 152064, 0x91816b34
+0, 18, 18, 1, 152064, 0xece0eaf8
+0, 19, 19, 1, 152064, 0x7b1408ef
+0, 20, 20, 1, 152064, 0x7430c4d2
+0, 21, 21, 1, 152064, 0xdb5844fa
+0, 22, 22, 1, 152064, 0xcc874ff7
+0, 23, 23, 1, 152064, 0x97630fb8
+0, 24, 24, 1, 152064, 0x16ae9c92
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cabastbr3_sony_b b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cabastbr3_sony_b
index d51959b..765f53f 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cabastbr3_sony_b
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cabastbr3_sony_b
@@ -1,25 +1,26 @@
-0, 0, 152064, 0x96ebb3a2
-0, 3600, 152064, 0x5184d912
-0, 7200, 152064, 0xb7b5ba68
-0, 10800, 152064, 0x6dd81860
-0, 14400, 152064, 0xcffe2ff0
-0, 18000, 152064, 0x27740140
-0, 21600, 152064, 0xffa5609f
-0, 25200, 152064, 0x05e9a6c6
-0, 28800, 152064, 0xa5ea5692
-0, 32400, 152064, 0x78a9dd79
-0, 36000, 152064, 0x2bf218b3
-0, 39600, 152064, 0x4591cadc
-0, 43200, 152064, 0x075428a8
-0, 46800, 152064, 0xbbda56d8
-0, 50400, 152064, 0xc8fa1a28
-0, 54000, 152064, 0x7c627c21
-0, 57600, 152064, 0x9043ba42
-0, 61200, 152064, 0xb426940d
-0, 64800, 152064, 0x51d4058b
-0, 68400, 152064, 0xb7513536
-0, 72000, 152064, 0xe906ffab
-0, 75600, 152064, 0x3d075443
-0, 79200, 152064, 0x85c37afd
-0, 82800, 152064, 0x2ac74040
-0, 86400, 152064, 0x3a08aa90
+#tb 0: 1/25
+0, 0, 0, 1, 152064, 0x96ebb3a2
+0, 1, 1, 1, 152064, 0x5184d912
+0, 2, 2, 1, 152064, 0xb7b5ba68
+0, 3, 3, 1, 152064, 0x6dd81860
+0, 4, 4, 1, 152064, 0xcffe2ff0
+0, 5, 5, 1, 152064, 0x27740140
+0, 6, 6, 1, 152064, 0xffa5609f
+0, 7, 7, 1, 152064, 0x05e9a6c6
+0, 8, 8, 1, 152064, 0xa5ea5692
+0, 9, 9, 1, 152064, 0x78a9dd79
+0, 10, 10, 1, 152064, 0x2bf218b3
+0, 11, 11, 1, 152064, 0x4591cadc
+0, 12, 12, 1, 152064, 0x075428a8
+0, 13, 13, 1, 152064, 0xbbda56d8
+0, 14, 14, 1, 152064, 0xc8fa1a28
+0, 15, 15, 1, 152064, 0x7c627c21
+0, 16, 16, 1, 152064, 0x9043ba42
+0, 17, 17, 1, 152064, 0xb426940d
+0, 18, 18, 1, 152064, 0x51d4058b
+0, 19, 19, 1, 152064, 0xb7513536
+0, 20, 20, 1, 152064, 0xe906ffab
+0, 21, 21, 1, 152064, 0x3d075443
+0, 22, 22, 1, 152064, 0x85c37afd
+0, 23, 23, 1, 152064, 0x2ac74040
+0, 24, 24, 1, 152064, 0x3a08aa90
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cabref3_sand_d b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cabref3_sand_d
index 7d75e01..9e555f6 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cabref3_sand_d
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cabref3_sand_d
@@ -1,50 +1,51 @@
-0, 0, 152064, 0x2061bbd0
-0, 3600, 152064, 0x41adb750
-0, 7200, 152064, 0x6e889e90
-0, 10800, 152064, 0xbb5e60f5
-0, 14400, 152064, 0x5a32eca7
-0, 18000, 152064, 0x5cb05e88
-0, 21600, 152064, 0x2fff3e6c
-0, 25200, 152064, 0xd917c85e
-0, 28800, 152064, 0x6eac446f
-0, 32400, 152064, 0x238b24b0
-0, 36000, 152064, 0x3f3bd44c
-0, 39600, 152064, 0x73982bc5
-0, 43200, 152064, 0xf6188a82
-0, 46800, 152064, 0x818c5b41
-0, 50400, 152064, 0x000d1012
-0, 54000, 152064, 0xc4a8750e
-0, 57600, 152064, 0x1689bb77
-0, 61200, 152064, 0x8f52f338
-0, 64800, 152064, 0xbf5ee06b
-0, 68400, 152064, 0x89508ad7
-0, 72000, 152064, 0x2b1986a6
-0, 75600, 152064, 0xe6fd6b0e
-0, 79200, 152064, 0x883e2e4e
-0, 82800, 152064, 0xd133db07
-0, 86400, 152064, 0x39b3bb22
-0, 90000, 152064, 0x8447410a
-0, 93600, 152064, 0x9c66c6e5
-0, 97200, 152064, 0x514de9cc
-0, 100800, 152064, 0x08d9f1da
-0, 104400, 152064, 0x8f10f536
-0, 108000, 152064, 0x57d4b27b
-0, 111600, 152064, 0x46f56d3c
-0, 115200, 152064, 0x5d260230
-0, 118800, 152064, 0x4a72aeac
-0, 122400, 152064, 0x5cfe187f
-0, 126000, 152064, 0x08e55cb2
-0, 129600, 152064, 0x4727f34f
-0, 133200, 152064, 0xd6a26f1c
-0, 136800, 152064, 0xcc1fcf9c
-0, 140400, 152064, 0x3681b775
-0, 144000, 152064, 0xf580c7d9
-0, 147600, 152064, 0xaa6747fb
-0, 151200, 152064, 0x2e22f9f9
-0, 154800, 152064, 0xb3ee6d81
-0, 158400, 152064, 0x930b0145
-0, 162000, 152064, 0xae36af99
-0, 165600, 152064, 0xeb58fd26
-0, 169200, 152064, 0xb9004da3
-0, 172800, 152064, 0x2b25e444
-0, 176400, 152064, 0xb36927de
+#tb 0: 1/25
+0, 0, 0, 1, 152064, 0x2061bbd0
+0, 1, 1, 1, 152064, 0x41adb750
+0, 2, 2, 1, 152064, 0x6e889e90
+0, 3, 3, 1, 152064, 0xbb5e60f5
+0, 4, 4, 1, 152064, 0x5a32eca7
+0, 5, 5, 1, 152064, 0x5cb05e88
+0, 6, 6, 1, 152064, 0x2fff3e6c
+0, 7, 7, 1, 152064, 0xd917c85e
+0, 8, 8, 1, 152064, 0x6eac446f
+0, 9, 9, 1, 152064, 0x238b24b0
+0, 10, 10, 1, 152064, 0x3f3bd44c
+0, 11, 11, 1, 152064, 0x73982bc5
+0, 12, 12, 1, 152064, 0xf6188a82
+0, 13, 13, 1, 152064, 0x818c5b41
+0, 14, 14, 1, 152064, 0x000d1012
+0, 15, 15, 1, 152064, 0xc4a8750e
+0, 16, 16, 1, 152064, 0x1689bb77
+0, 17, 17, 1, 152064, 0x8f52f338
+0, 18, 18, 1, 152064, 0xbf5ee06b
+0, 19, 19, 1, 152064, 0x89508ad7
+0, 20, 20, 1, 152064, 0x2b1986a6
+0, 21, 21, 1, 152064, 0xe6fd6b0e
+0, 22, 22, 1, 152064, 0x883e2e4e
+0, 23, 23, 1, 152064, 0xd133db07
+0, 24, 24, 1, 152064, 0x39b3bb22
+0, 25, 25, 1, 152064, 0x8447410a
+0, 26, 26, 1, 152064, 0x9c66c6e5
+0, 27, 27, 1, 152064, 0x514de9cc
+0, 28, 28, 1, 152064, 0x08d9f1da
+0, 29, 29, 1, 152064, 0x8f10f536
+0, 30, 30, 1, 152064, 0x57d4b27b
+0, 31, 31, 1, 152064, 0x46f56d3c
+0, 32, 32, 1, 152064, 0x5d260230
+0, 33, 33, 1, 152064, 0x4a72aeac
+0, 34, 34, 1, 152064, 0x5cfe187f
+0, 35, 35, 1, 152064, 0x08e55cb2
+0, 36, 36, 1, 152064, 0x4727f34f
+0, 37, 37, 1, 152064, 0xd6a26f1c
+0, 38, 38, 1, 152064, 0xcc1fcf9c
+0, 39, 39, 1, 152064, 0x3681b775
+0, 40, 40, 1, 152064, 0xf580c7d9
+0, 41, 41, 1, 152064, 0xaa6747fb
+0, 42, 42, 1, 152064, 0x2e22f9f9
+0, 43, 43, 1, 152064, 0xb3ee6d81
+0, 44, 44, 1, 152064, 0x930b0145
+0, 45, 45, 1, 152064, 0xae36af99
+0, 46, 46, 1, 152064, 0xeb58fd26
+0, 47, 47, 1, 152064, 0xb9004da3
+0, 48, 48, 1, 152064, 0x2b25e444
+0, 49, 49, 1, 152064, 0xb36927de
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cacqp3_sony_d b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cacqp3_sony_d
index 56881b3..c368529 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cacqp3_sony_d
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cacqp3_sony_d
@@ -1,50 +1,51 @@
-0, 0, 38016, 0x295a375c
-0, 3600, 38016, 0xd0da1f37
-0, 7200, 38016, 0x0e5ed514
-0, 10800, 38016, 0x477dcbe7
-0, 14400, 38016, 0x2e0980f3
-0, 18000, 38016, 0xf6d0888f
-0, 21600, 38016, 0x884f4bf2
-0, 25200, 38016, 0x75135ea9
-0, 28800, 38016, 0xc85031bd
-0, 32400, 38016, 0x4dde6353
-0, 36000, 38016, 0x8c8f4f2a
-0, 39600, 38016, 0xbdae892b
-0, 43200, 38016, 0x4898783a
-0, 46800, 38016, 0xb4cc9d6b
-0, 50400, 38016, 0xd24f8797
-0, 54000, 38016, 0x74c4a0df
-0, 57600, 38016, 0x43e58a83
-0, 61200, 38016, 0x05bba901
-0, 64800, 38016, 0xe2d57f63
-0, 68400, 38016, 0xdb398611
-0, 72000, 38016, 0x7f143de2
-0, 75600, 38016, 0xff39406f
-0, 79200, 38016, 0xfed61162
-0, 82800, 38016, 0xb9e62a1e
-0, 86400, 38016, 0x65f316d1
-0, 90000, 38016, 0xda782b9c
-0, 93600, 38016, 0xb64b202c
-0, 97200, 38016, 0xb2b141ea
-0, 100800, 38016, 0xdb6b421b
-0, 104400, 38016, 0xf3287342
-0, 108000, 38016, 0xfbb35b92
-0, 111600, 38016, 0x8c77a0de
-0, 115200, 38016, 0x326c9cb4
-0, 118800, 38016, 0x7e73cc0c
-0, 122400, 38016, 0xb948b8e9
-0, 126000, 38016, 0x6f7adb29
-0, 129600, 38016, 0xb629b8c5
-0, 133200, 38016, 0xf798ccd4
-0, 136800, 38016, 0xde5bb331
-0, 140400, 38016, 0xbca4d8dc
-0, 144000, 38016, 0x9369ba10
-0, 147600, 38016, 0x581ed965
-0, 151200, 38016, 0xce7bbd59
-0, 154800, 38016, 0x95d9ce3d
-0, 158400, 38016, 0x6154bd98
-0, 162000, 38016, 0xa279c487
-0, 165600, 38016, 0x8169b5a6
-0, 169200, 38016, 0x709dc334
-0, 172800, 38016, 0x82aabea1
-0, 176400, 38016, 0x6923c4c3
+#tb 0: 1/25
+0, 0, 0, 1, 38016, 0x295a375c
+0, 1, 1, 1, 38016, 0xd0da1f37
+0, 2, 2, 1, 38016, 0x0e5ed514
+0, 3, 3, 1, 38016, 0x477dcbe7
+0, 4, 4, 1, 38016, 0x2e0980f3
+0, 5, 5, 1, 38016, 0xf6d0888f
+0, 6, 6, 1, 38016, 0x884f4bf2
+0, 7, 7, 1, 38016, 0x75135ea9
+0, 8, 8, 1, 38016, 0xc85031bd
+0, 9, 9, 1, 38016, 0x4dde6353
+0, 10, 10, 1, 38016, 0x8c8f4f2a
+0, 11, 11, 1, 38016, 0xbdae892b
+0, 12, 12, 1, 38016, 0x4898783a
+0, 13, 13, 1, 38016, 0xb4cc9d6b
+0, 14, 14, 1, 38016, 0xd24f8797
+0, 15, 15, 1, 38016, 0x74c4a0df
+0, 16, 16, 1, 38016, 0x43e58a83
+0, 17, 17, 1, 38016, 0x05bba901
+0, 18, 18, 1, 38016, 0xe2d57f63
+0, 19, 19, 1, 38016, 0xdb398611
+0, 20, 20, 1, 38016, 0x7f143de2
+0, 21, 21, 1, 38016, 0xff39406f
+0, 22, 22, 1, 38016, 0xfed61162
+0, 23, 23, 1, 38016, 0xb9e62a1e
+0, 24, 24, 1, 38016, 0x65f316d1
+0, 25, 25, 1, 38016, 0xda782b9c
+0, 26, 26, 1, 38016, 0xb64b202c
+0, 27, 27, 1, 38016, 0xb2b141ea
+0, 28, 28, 1, 38016, 0xdb6b421b
+0, 29, 29, 1, 38016, 0xf3287342
+0, 30, 30, 1, 38016, 0xfbb35b92
+0, 31, 31, 1, 38016, 0x8c77a0de
+0, 32, 32, 1, 38016, 0x326c9cb4
+0, 33, 33, 1, 38016, 0x7e73cc0c
+0, 34, 34, 1, 38016, 0xb948b8e9
+0, 35, 35, 1, 38016, 0x6f7adb29
+0, 36, 36, 1, 38016, 0xb629b8c5
+0, 37, 37, 1, 38016, 0xf798ccd4
+0, 38, 38, 1, 38016, 0xde5bb331
+0, 39, 39, 1, 38016, 0xbca4d8dc
+0, 40, 40, 1, 38016, 0x9369ba10
+0, 41, 41, 1, 38016, 0x581ed965
+0, 42, 42, 1, 38016, 0xce7bbd59
+0, 43, 43, 1, 38016, 0x95d9ce3d
+0, 44, 44, 1, 38016, 0x6154bd98
+0, 45, 45, 1, 38016, 0xa279c487
+0, 46, 46, 1, 38016, 0x8169b5a6
+0, 47, 47, 1, 38016, 0x709dc334
+0, 48, 48, 1, 38016, 0x82aabea1
+0, 49, 49, 1, 38016, 0x6923c4c3
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cafi1_sva_c b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cafi1_sva_c
index c652ce2..180adf1 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cafi1_sva_c
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cafi1_sva_c
@@ -1,33 +1,34 @@
-0, 0, 518400, 0x47bd73fa
-0, 3600, 518400, 0xfe3ea7cc
-0, 7200, 518400, 0x9bc549ae
-0, 10800, 518400, 0x7bb7f0a1
-0, 14400, 518400, 0x328903d4
-0, 18000, 518400, 0x96ab366b
-0, 21600, 518400, 0xa923eed3
-0, 25200, 518400, 0x162b08f6
-0, 28800, 518400, 0xe711bd8b
-0, 32400, 518400, 0x55e2d4ed
-0, 36000, 518400, 0x7dd3107b
-0, 39600, 518400, 0x0ed20bcf
-0, 43200, 518400, 0x352f5743
-0, 46800, 518400, 0x0a3aeb5e
-0, 50400, 518400, 0xc458eda3
-0, 54000, 518400, 0xe8d5fec5
-0, 57600, 518400, 0x18fc6c37
-0, 61200, 518400, 0x448add76
-0, 64800, 518400, 0x8741ead7
-0, 68400, 518400, 0x7008a751
-0, 72000, 518400, 0x4ca0633d
-0, 75600, 518400, 0x021ab800
-0, 79200, 518400, 0xfb91ba57
-0, 82800, 518400, 0x90e71dd0
-0, 86400, 518400, 0xac859de5
-0, 90000, 518400, 0xce9790bd
-0, 93600, 518400, 0x010ade8b
-0, 97200, 518400, 0xd0b3a399
-0, 100800, 518400, 0x6cafcff3
-0, 104400, 518400, 0xc32284c0
-0, 108000, 518400, 0x1af8f73e
-0, 111600, 518400, 0x3babd71e
-0, 115200, 518400, 0xd77cb86b
+#tb 0: 1/25
+0, 0, 0, 1, 518400, 0x47bd73fa
+0, 1, 1, 1, 518400, 0xfe3ea7cc
+0, 2, 2, 1, 518400, 0x9bc549ae
+0, 3, 3, 1, 518400, 0x7bb7f0a1
+0, 4, 4, 1, 518400, 0x328903d4
+0, 5, 5, 1, 518400, 0x96ab366b
+0, 6, 6, 1, 518400, 0xa923eed3
+0, 7, 7, 1, 518400, 0x162b08f6
+0, 8, 8, 1, 518400, 0xe711bd8b
+0, 9, 9, 1, 518400, 0x55e2d4ed
+0, 10, 10, 1, 518400, 0x7dd3107b
+0, 11, 11, 1, 518400, 0x0ed20bcf
+0, 12, 12, 1, 518400, 0x352f5743
+0, 13, 13, 1, 518400, 0x0a3aeb5e
+0, 14, 14, 1, 518400, 0xc458eda3
+0, 15, 15, 1, 518400, 0xe8d5fec5
+0, 16, 16, 1, 518400, 0x18fc6c37
+0, 17, 17, 1, 518400, 0x448add76
+0, 18, 18, 1, 518400, 0x8741ead7
+0, 19, 19, 1, 518400, 0x7008a751
+0, 20, 20, 1, 518400, 0x4ca0633d
+0, 21, 21, 1, 518400, 0x021ab800
+0, 22, 22, 1, 518400, 0xfb91ba57
+0, 23, 23, 1, 518400, 0x90e71dd0
+0, 24, 24, 1, 518400, 0xac859de5
+0, 25, 25, 1, 518400, 0xce9790bd
+0, 26, 26, 1, 518400, 0x010ade8b
+0, 27, 27, 1, 518400, 0xd0b3a399
+0, 28, 28, 1, 518400, 0x6cafcff3
+0, 29, 29, 1, 518400, 0xc32284c0
+0, 30, 30, 1, 518400, 0x1af8f73e
+0, 31, 31, 1, 518400, 0x3babd71e
+0, 32, 32, 1, 518400, 0xd77cb86b
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cama1_sony_c b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cama1_sony_c
index 6b309aa..6685216 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cama1_sony_c
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cama1_sony_c
@@ -1,5 +1,6 @@
-0, 0, 518400, 0x75701511
-0, 3600, 518400, 0xa7eeaa16
-0, 7200, 518400, 0xe0f32e35
-0, 10800, 518400, 0x7a1dadd9
-0, 14400, 518400, 0x4a1672a6
+#tb 0: 1/25
+0, 0, 0, 1, 518400, 0x75701511
+0, 1, 1, 1, 518400, 0xa7eeaa16
+0, 2, 2, 1, 518400, 0xe0f32e35
+0, 3, 3, 1, 518400, 0x7a1dadd9
+0, 4, 4, 1, 518400, 0x4a1672a6
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cama1_toshiba_b b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cama1_toshiba_b
index 897e915..ab2da4a 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cama1_toshiba_b
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cama1_toshiba_b
@@ -1,90 +1,91 @@
-0, 0, 152064, 0x9a9ce366
-0, 3600, 152064, 0xf4639828
-0, 7200, 152064, 0x625024a3
-0, 10800, 152064, 0x80dc2f9d
-0, 14400, 152064, 0xb2c4feea
-0, 18000, 152064, 0x4ec6ad64
-0, 21600, 152064, 0x1957bec3
-0, 25200, 152064, 0xb682799d
-0, 28800, 152064, 0x34cd2053
-0, 32400, 152064, 0x81490b4c
-0, 36000, 152064, 0x242dc943
-0, 39600, 152064, 0x3e126734
-0, 43200, 152064, 0x8e474ff8
-0, 46800, 152064, 0x239d2fbd
-0, 50400, 152064, 0x0ca3e16f
-0, 54000, 152064, 0x6161d7c2
-0, 57600, 152064, 0xca7ad1af
-0, 61200, 152064, 0xf8ef9026
-0, 64800, 152064, 0x01f2f4c1
-0, 68400, 152064, 0x510b19ec
-0, 72000, 152064, 0xe489028b
-0, 75600, 152064, 0x7a693c1e
-0, 79200, 152064, 0x276b23fe
-0, 82800, 152064, 0x0e9ced3a
-0, 86400, 152064, 0x658228f7
-0, 90000, 152064, 0x6a271bc3
-0, 93600, 152064, 0x431ecd8b
-0, 97200, 152064, 0x23a5ed14
-0, 100800, 152064, 0x76fbe121
-0, 104400, 152064, 0x471f919d
-0, 108000, 152064, 0x16bfabbc
-0, 111600, 152064, 0x0762993f
-0, 115200, 152064, 0x5a2b0b0e
-0, 118800, 152064, 0x81415ef7
-0, 122400, 152064, 0xb96e4164
-0, 126000, 152064, 0xf77aee83
-0, 129600, 152064, 0x6af81633
-0, 133200, 152064, 0xed78e5b5
-0, 136800, 152064, 0x67e38e2c
-0, 140400, 152064, 0x0417ae01
-0, 144000, 152064, 0x3887b312
-0, 147600, 152064, 0x3a4b70fb
-0, 151200, 152064, 0xcaae9e7f
-0, 154800, 152064, 0xaf9597be
-0, 158400, 152064, 0x9bae63d3
-0, 162000, 152064, 0x0e80825f
-0, 165600, 152064, 0x915661fd
-0, 169200, 152064, 0x67d3dc94
-0, 172800, 152064, 0x3dcf240c
-0, 176400, 152064, 0x127ff832
-0, 180000, 152064, 0xc8969981
-0, 183600, 152064, 0x57179c77
-0, 187200, 152064, 0x9f88656c
-0, 190800, 152064, 0xc28ff5d3
-0, 194400, 152064, 0xf100fad9
-0, 198000, 152064, 0xb570ce12
-0, 201600, 152064, 0xe8f28955
-0, 205200, 152064, 0x1f0a9549
-0, 208800, 152064, 0x22b17e9b
-0, 212400, 152064, 0x7cf1400e
-0, 216000, 152064, 0xafd273b7
-0, 219600, 152064, 0xeb9b712e
-0, 223200, 152064, 0x0f81de24
-0, 226800, 152064, 0x8f4e1953
-0, 230400, 152064, 0x682e2170
-0, 234000, 152064, 0xc32ad1b2
-0, 237600, 152064, 0x53a81d79
-0, 241200, 152064, 0x54002596
-0, 244800, 152064, 0x4b5fdbd9
-0, 248400, 152064, 0x96613368
-0, 252000, 152064, 0xd6ac0171
-0, 255600, 152064, 0xf1c1b7b7
-0, 259200, 152064, 0xc730d82f
-0, 262800, 152064, 0x0415d934
-0, 266400, 152064, 0x5338915e
-0, 270000, 152064, 0x8e9dda6d
-0, 273600, 152064, 0xe3a8b0a0
-0, 277200, 152064, 0x5fa36e44
-0, 280800, 152064, 0x0e63dc72
-0, 284400, 152064, 0xd0dad71f
-0, 288000, 152064, 0x0c4aac94
-0, 291600, 152064, 0x60d50e8d
-0, 295200, 152064, 0x96872d7c
-0, 298800, 152064, 0x4fcefc33
-0, 302400, 152064, 0x6b8157c9
-0, 306000, 152064, 0xa40d527d
-0, 309600, 152064, 0x9884480a
-0, 313200, 152064, 0xff5d9754
-0, 316800, 152064, 0x4a26a74d
-0, 320400, 152064, 0x81059e82
+#tb 0: 1/25
+0, 0, 0, 1, 152064, 0x9a9ce366
+0, 1, 1, 1, 152064, 0xf4639828
+0, 2, 2, 1, 152064, 0x625024a3
+0, 3, 3, 1, 152064, 0x80dc2f9d
+0, 4, 4, 1, 152064, 0xb2c4feea
+0, 5, 5, 1, 152064, 0x4ec6ad64
+0, 6, 6, 1, 152064, 0x1957bec3
+0, 7, 7, 1, 152064, 0xb682799d
+0, 8, 8, 1, 152064, 0x34cd2053
+0, 9, 9, 1, 152064, 0x81490b4c
+0, 10, 10, 1, 152064, 0x242dc943
+0, 11, 11, 1, 152064, 0x3e126734
+0, 12, 12, 1, 152064, 0x8e474ff8
+0, 13, 13, 1, 152064, 0x239d2fbd
+0, 14, 14, 1, 152064, 0x0ca3e16f
+0, 15, 15, 1, 152064, 0x6161d7c2
+0, 16, 16, 1, 152064, 0xca7ad1af
+0, 17, 17, 1, 152064, 0xf8ef9026
+0, 18, 18, 1, 152064, 0x01f2f4c1
+0, 19, 19, 1, 152064, 0x510b19ec
+0, 20, 20, 1, 152064, 0xe489028b
+0, 21, 21, 1, 152064, 0x7a693c1e
+0, 22, 22, 1, 152064, 0x276b23fe
+0, 23, 23, 1, 152064, 0x0e9ced3a
+0, 24, 24, 1, 152064, 0x658228f7
+0, 25, 25, 1, 152064, 0x6a271bc3
+0, 26, 26, 1, 152064, 0x431ecd8b
+0, 27, 27, 1, 152064, 0x23a5ed14
+0, 28, 28, 1, 152064, 0x76fbe121
+0, 29, 29, 1, 152064, 0x471f919d
+0, 30, 30, 1, 152064, 0x16bfabbc
+0, 31, 31, 1, 152064, 0x0762993f
+0, 32, 32, 1, 152064, 0x5a2b0b0e
+0, 33, 33, 1, 152064, 0x81415ef7
+0, 34, 34, 1, 152064, 0xb96e4164
+0, 35, 35, 1, 152064, 0xf77aee83
+0, 36, 36, 1, 152064, 0x6af81633
+0, 37, 37, 1, 152064, 0xed78e5b5
+0, 38, 38, 1, 152064, 0x67e38e2c
+0, 39, 39, 1, 152064, 0x0417ae01
+0, 40, 40, 1, 152064, 0x3887b312
+0, 41, 41, 1, 152064, 0x3a4b70fb
+0, 42, 42, 1, 152064, 0xcaae9e7f
+0, 43, 43, 1, 152064, 0xaf9597be
+0, 44, 44, 1, 152064, 0x9bae63d3
+0, 45, 45, 1, 152064, 0x0e80825f
+0, 46, 46, 1, 152064, 0x915661fd
+0, 47, 47, 1, 152064, 0x67d3dc94
+0, 48, 48, 1, 152064, 0x3dcf240c
+0, 49, 49, 1, 152064, 0x127ff832
+0, 50, 50, 1, 152064, 0xc8969981
+0, 51, 51, 1, 152064, 0x57179c77
+0, 52, 52, 1, 152064, 0x9f88656c
+0, 53, 53, 1, 152064, 0xc28ff5d3
+0, 54, 54, 1, 152064, 0xf100fad9
+0, 55, 55, 1, 152064, 0xb570ce12
+0, 56, 56, 1, 152064, 0xe8f28955
+0, 57, 57, 1, 152064, 0x1f0a9549
+0, 58, 58, 1, 152064, 0x22b17e9b
+0, 59, 59, 1, 152064, 0x7cf1400e
+0, 60, 60, 1, 152064, 0xafd273b7
+0, 61, 61, 1, 152064, 0xeb9b712e
+0, 62, 62, 1, 152064, 0x0f81de24
+0, 63, 63, 1, 152064, 0x8f4e1953
+0, 64, 64, 1, 152064, 0x682e2170
+0, 65, 65, 1, 152064, 0xc32ad1b2
+0, 66, 66, 1, 152064, 0x53a81d79
+0, 67, 67, 1, 152064, 0x54002596
+0, 68, 68, 1, 152064, 0x4b5fdbd9
+0, 69, 69, 1, 152064, 0x96613368
+0, 70, 70, 1, 152064, 0xd6ac0171
+0, 71, 71, 1, 152064, 0xf1c1b7b7
+0, 72, 72, 1, 152064, 0xc730d82f
+0, 73, 73, 1, 152064, 0x0415d934
+0, 74, 74, 1, 152064, 0x5338915e
+0, 75, 75, 1, 152064, 0x8e9dda6d
+0, 76, 76, 1, 152064, 0xe3a8b0a0
+0, 77, 77, 1, 152064, 0x5fa36e44
+0, 78, 78, 1, 152064, 0x0e63dc72
+0, 79, 79, 1, 152064, 0xd0dad71f
+0, 80, 80, 1, 152064, 0x0c4aac94
+0, 81, 81, 1, 152064, 0x60d50e8d
+0, 82, 82, 1, 152064, 0x96872d7c
+0, 83, 83, 1, 152064, 0x4fcefc33
+0, 84, 84, 1, 152064, 0x6b8157c9
+0, 85, 85, 1, 152064, 0xa40d527d
+0, 86, 86, 1, 152064, 0x9884480a
+0, 87, 87, 1, 152064, 0xff5d9754
+0, 88, 88, 1, 152064, 0x4a26a74d
+0, 89, 89, 1, 152064, 0x81059e82
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cama1_vtc_c b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cama1_vtc_c
index 8c0e226..eeb66b0 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cama1_vtc_c
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cama1_vtc_c
@@ -1,4 +1,5 @@
-0, 0, 518400, 0x41c2ce17
-0, 3600, 518400, 0x39f217da
-0, 7200, 518400, 0x5a108db9
-0, 10800, 518400, 0x20cb214c
+#tb 0: 1/25
+0, 0, 0, 1, 518400, 0x41c2ce17
+0, 1, 1, 1, 518400, 0x39f217da
+0, 2, 2, 1, 518400, 0x5a108db9
+0, 3, 3, 1, 518400, 0x20cb214c
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cama2_vtc_b b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cama2_vtc_b
index 8320f1f..0dfe6a9 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cama2_vtc_b
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cama2_vtc_b
@@ -1,4 +1,5 @@
-0, 0, 622080, 0x004bb93f
-0, 3600, 622080, 0xe70e193c
-0, 7200, 622080, 0xd394cf17
-0, 10800, 622080, 0x9e4cc924
+#tb 0: 1/25
+0, 0, 0, 1, 622080, 0x004bb93f
+0, 1, 1, 1, 622080, 0xe70e193c
+0, 2, 2, 1, 622080, 0xd394cf17
+0, 3, 3, 1, 622080, 0x9e4cc924
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cama3_sand_e b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cama3_sand_e
index 77927c9..f89bc40 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cama3_sand_e
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cama3_sand_e
@@ -1,50 +1,51 @@
-0, 0, 152064, 0xf772f152
-0, 3600, 152064, 0x7c501772
-0, 7200, 152064, 0x98ed0a07
-0, 10800, 152064, 0x8f9289ae
-0, 14400, 152064, 0x4047c5e6
-0, 18000, 152064, 0xf1f11922
-0, 21600, 152064, 0xef8d8130
-0, 25200, 152064, 0x6cef489d
-0, 28800, 152064, 0x3743a97f
-0, 32400, 152064, 0x9d6b9846
-0, 36000, 152064, 0x332e05a7
-0, 39600, 152064, 0x7dad10af
-0, 43200, 152064, 0x835c99de
-0, 46800, 152064, 0x2ba3f9bb
-0, 50400, 152064, 0xf8ab5286
-0, 54000, 152064, 0x76624cca
-0, 57600, 152064, 0x8ebf6342
-0, 61200, 152064, 0x8756f87b
-0, 64800, 152064, 0xf005bc2f
-0, 68400, 152064, 0x9b1ae18e
-0, 72000, 152064, 0x3e1154aa
-0, 75600, 152064, 0x851e28d6
-0, 79200, 152064, 0x940a2518
-0, 82800, 152064, 0x861be99c
-0, 86400, 152064, 0x21a788a7
-0, 90000, 152064, 0x53e216eb
-0, 93600, 152064, 0x053cb9ec
-0, 97200, 152064, 0x3bb5cfc6
-0, 100800, 152064, 0x92b250c3
-0, 104400, 152064, 0xacc20f1c
-0, 108000, 152064, 0xb01256d3
-0, 111600, 152064, 0x6db62cf2
-0, 115200, 152064, 0x7fa3074d
-0, 118800, 152064, 0x63385103
-0, 122400, 152064, 0x83ba02b6
-0, 126000, 152064, 0x3731edbb
-0, 129600, 152064, 0xb73d5b99
-0, 133200, 152064, 0xd2e743e2
-0, 136800, 152064, 0x4bcd5bf2
-0, 140400, 152064, 0x45ef7b97
-0, 144000, 152064, 0x757952c6
-0, 147600, 152064, 0xed73e3db
-0, 151200, 152064, 0x8cf41b15
-0, 154800, 152064, 0x86e2b02d
-0, 158400, 152064, 0xf8d16c87
-0, 162000, 152064, 0x6720db65
-0, 165600, 152064, 0x67a5a150
-0, 169200, 152064, 0x1849fa2a
-0, 172800, 152064, 0xb0156742
-0, 176400, 152064, 0xde75b1fd
+#tb 0: 1/25
+0, 0, 0, 1, 152064, 0xf772f152
+0, 1, 1, 1, 152064, 0x7c501772
+0, 2, 2, 1, 152064, 0x98ed0a07
+0, 3, 3, 1, 152064, 0x8f9289ae
+0, 4, 4, 1, 152064, 0x4047c5e6
+0, 5, 5, 1, 152064, 0xf1f11922
+0, 6, 6, 1, 152064, 0xef8d8130
+0, 7, 7, 1, 152064, 0x6cef489d
+0, 8, 8, 1, 152064, 0x3743a97f
+0, 9, 9, 1, 152064, 0x9d6b9846
+0, 10, 10, 1, 152064, 0x332e05a7
+0, 11, 11, 1, 152064, 0x7dad10af
+0, 12, 12, 1, 152064, 0x835c99de
+0, 13, 13, 1, 152064, 0x2ba3f9bb
+0, 14, 14, 1, 152064, 0xf8ab5286
+0, 15, 15, 1, 152064, 0x76624cca
+0, 16, 16, 1, 152064, 0x8ebf6342
+0, 17, 17, 1, 152064, 0x8756f87b
+0, 18, 18, 1, 152064, 0xf005bc2f
+0, 19, 19, 1, 152064, 0x9b1ae18e
+0, 20, 20, 1, 152064, 0x3e1154aa
+0, 21, 21, 1, 152064, 0x851e28d6
+0, 22, 22, 1, 152064, 0x940a2518
+0, 23, 23, 1, 152064, 0x861be99c
+0, 24, 24, 1, 152064, 0x21a788a7
+0, 25, 25, 1, 152064, 0x53e216eb
+0, 26, 26, 1, 152064, 0x053cb9ec
+0, 27, 27, 1, 152064, 0x3bb5cfc6
+0, 28, 28, 1, 152064, 0x92b250c3
+0, 29, 29, 1, 152064, 0xacc20f1c
+0, 30, 30, 1, 152064, 0xb01256d3
+0, 31, 31, 1, 152064, 0x6db62cf2
+0, 32, 32, 1, 152064, 0x7fa3074d
+0, 33, 33, 1, 152064, 0x63385103
+0, 34, 34, 1, 152064, 0x83ba02b6
+0, 35, 35, 1, 152064, 0x3731edbb
+0, 36, 36, 1, 152064, 0xb73d5b99
+0, 37, 37, 1, 152064, 0xd2e743e2
+0, 38, 38, 1, 152064, 0x4bcd5bf2
+0, 39, 39, 1, 152064, 0x45ef7b97
+0, 40, 40, 1, 152064, 0x757952c6
+0, 41, 41, 1, 152064, 0xed73e3db
+0, 42, 42, 1, 152064, 0x8cf41b15
+0, 43, 43, 1, 152064, 0x86e2b02d
+0, 44, 44, 1, 152064, 0xf8d16c87
+0, 45, 45, 1, 152064, 0x6720db65
+0, 46, 46, 1, 152064, 0x67a5a150
+0, 47, 47, 1, 152064, 0x1849fa2a
+0, 48, 48, 1, 152064, 0xb0156742
+0, 49, 49, 1, 152064, 0xde75b1fd
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cama3_vtc_b b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cama3_vtc_b
index 8e7a351..46821c1 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cama3_vtc_b
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cama3_vtc_b
@@ -1,4 +1,5 @@
-0, 0, 622080, 0xf3f0bf86
-0, 3600, 622080, 0x6aaf3d42
-0, 7200, 622080, 0xe53bcd5d
-0, 10800, 622080, 0x8dabca9d
+#tb 0: 1/25
+0, 0, 0, 1, 622080, 0xf3f0bf86
+0, 1, 1, 1, 622080, 0x6aaf3d42
+0, 2, 2, 1, 622080, 0xe53bcd5d
+0, 3, 3, 1, 622080, 0x8dabca9d
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-camaci3_sony_c b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-camaci3_sony_c
index 643d803..5896460 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-camaci3_sony_c
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-camaci3_sony_c
@@ -1,17 +1,18 @@
-0, 0, 36864, 0x9b5dcf28
-0, 3600, 36864, 0xb13d4fee
-0, 7200, 36864, 0x11c512ac
-0, 10800, 36864, 0xc013b0e3
-0, 14400, 36864, 0x25002dae
-0, 18000, 36864, 0xefd0055a
-0, 21600, 36864, 0x6be2d3b2
-0, 25200, 36864, 0xa8a0d525
-0, 28800, 36864, 0x1bf942e8
-0, 32400, 36864, 0x5c08c94f
-0, 36000, 36864, 0x5555e762
-0, 39600, 36864, 0xcc1429c7
-0, 43200, 36864, 0xa3cc1535
-0, 46800, 36864, 0x14dc2b75
-0, 50400, 36864, 0x6b965ce9
-0, 54000, 36864, 0x7424d19b
-0, 57600, 36864, 0xcada6a7f
+#tb 0: 1/25
+0, 0, 0, 1, 36864, 0x9b5dcf28
+0, 1, 1, 1, 36864, 0xb13d4fee
+0, 2, 2, 1, 36864, 0x11c512ac
+0, 3, 3, 1, 36864, 0xc013b0e3
+0, 4, 4, 1, 36864, 0x25002dae
+0, 5, 5, 1, 36864, 0xefd0055a
+0, 6, 6, 1, 36864, 0x6be2d3b2
+0, 7, 7, 1, 36864, 0xa8a0d525
+0, 8, 8, 1, 36864, 0x1bf942e8
+0, 9, 9, 1, 36864, 0x5c08c94f
+0, 10, 10, 1, 36864, 0x5555e762
+0, 11, 11, 1, 36864, 0xcc1429c7
+0, 12, 12, 1, 36864, 0xa3cc1535
+0, 13, 13, 1, 36864, 0x14dc2b75
+0, 14, 14, 1, 36864, 0x6b965ce9
+0, 15, 15, 1, 36864, 0x7424d19b
+0, 16, 16, 1, 36864, 0xcada6a7f
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-camanl1_toshiba_b b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-camanl1_toshiba_b
index 07422b8..2c3c557 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-camanl1_toshiba_b
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-camanl1_toshiba_b
@@ -1,90 +1,91 @@
-0, 0, 152064, 0xb1edd842
-0, 3600, 152064, 0x551f8f45
-0, 7200, 152064, 0xb4931cb2
-0, 10800, 152064, 0x78882b27
-0, 14400, 152064, 0x3afef36d
-0, 18000, 152064, 0x85afad0a
-0, 21600, 152064, 0x3a8bab81
-0, 25200, 152064, 0x2a437174
-0, 28800, 152064, 0x22421437
-0, 32400, 152064, 0x39c5f125
-0, 36000, 152064, 0x256eaad2
-0, 39600, 152064, 0x668a5d31
-0, 43200, 152064, 0x412a4aa7
-0, 46800, 152064, 0x3f091baf
-0, 50400, 152064, 0xbf16d262
-0, 54000, 152064, 0x2fc4ce67
-0, 57600, 152064, 0x119cde3e
-0, 61200, 152064, 0xb40b8632
-0, 64800, 152064, 0x4be4f192
-0, 68400, 152064, 0x906c1237
-0, 72000, 152064, 0x95380024
-0, 75600, 152064, 0x6a833025
-0, 79200, 152064, 0x681d1c4f
-0, 82800, 152064, 0x08c8dea4
-0, 86400, 152064, 0xc69226f0
-0, 90000, 152064, 0x86631102
-0, 93600, 152064, 0x7f40c77a
-0, 97200, 152064, 0xc746ddd4
-0, 100800, 152064, 0x5f2bd3cb
-0, 104400, 152064, 0x643c8316
-0, 108000, 152064, 0x5b7fa380
-0, 111600, 152064, 0x82438cf7
-0, 115200, 152064, 0xdee0f7e7
-0, 118800, 152064, 0xc50d41f1
-0, 122400, 152064, 0xf3453631
-0, 126000, 152064, 0x90bce66b
-0, 129600, 152064, 0x045b03f7
-0, 133200, 152064, 0xf64bd756
-0, 136800, 152064, 0xff997ef2
-0, 140400, 152064, 0x3613a0a5
-0, 144000, 152064, 0xe6a7a8d6
-0, 147600, 152064, 0xb0906c42
-0, 151200, 152064, 0x4dfc912b
-0, 154800, 152064, 0x81e3991c
-0, 158400, 152064, 0x4efc61fb
-0, 162000, 152064, 0xed478395
-0, 165600, 152064, 0x4cb25ab6
-0, 169200, 152064, 0x28e7d51f
-0, 172800, 152064, 0x8bcc1a8d
-0, 176400, 152064, 0x2fe1f240
-0, 180000, 152064, 0xb4978ef8
-0, 183600, 152064, 0xe3929556
-0, 187200, 152064, 0xd370632a
-0, 190800, 152064, 0xba86ffb2
-0, 194400, 152064, 0x444bf18c
-0, 198000, 152064, 0xab40bd14
-0, 201600, 152064, 0xfd488a5d
-0, 205200, 152064, 0xe1f09568
-0, 208800, 152064, 0x09ee7a7e
-0, 212400, 152064, 0x9360397c
-0, 216000, 152064, 0xdbd467e9
-0, 219600, 152064, 0x99726777
-0, 223200, 152064, 0x009fd46c
-0, 226800, 152064, 0xcf770fdb
-0, 230400, 152064, 0x2a890fd9
-0, 234000, 152064, 0x7f40de4b
-0, 237600, 152064, 0x04191304
-0, 241200, 152064, 0x15722022
-0, 244800, 152064, 0x59f4ea93
-0, 248400, 152064, 0x28ba373f
-0, 252000, 152064, 0xf9e400b8
-0, 255600, 152064, 0x85c4bd98
-0, 259200, 152064, 0x6917d2a5
-0, 262800, 152064, 0x61cae234
-0, 266400, 152064, 0x752a9a2d
-0, 270000, 152064, 0x1ee2d9bd
-0, 273600, 152064, 0xdce9ab8e
-0, 277200, 152064, 0x51225fd0
-0, 280800, 152064, 0x10e8cb60
-0, 284400, 152064, 0x8d07cd25
-0, 288000, 152064, 0xb18ba61b
-0, 291600, 152064, 0xb0f10280
-0, 295200, 152064, 0x76a71f13
-0, 298800, 152064, 0x3004f5a1
-0, 302400, 152064, 0x9aba5724
-0, 306000, 152064, 0x5db85385
-0, 309600, 152064, 0xbe9d3f5b
-0, 313200, 152064, 0xa71e85bb
-0, 316800, 152064, 0xdcf59cd7
-0, 320400, 152064, 0x5e319459
+#tb 0: 1/25
+0, 0, 0, 1, 152064, 0xb1edd842
+0, 1, 1, 1, 152064, 0x551f8f45
+0, 2, 2, 1, 152064, 0xb4931cb2
+0, 3, 3, 1, 152064, 0x78882b27
+0, 4, 4, 1, 152064, 0x3afef36d
+0, 5, 5, 1, 152064, 0x85afad0a
+0, 6, 6, 1, 152064, 0x3a8bab81
+0, 7, 7, 1, 152064, 0x2a437174
+0, 8, 8, 1, 152064, 0x22421437
+0, 9, 9, 1, 152064, 0x39c5f125
+0, 10, 10, 1, 152064, 0x256eaad2
+0, 11, 11, 1, 152064, 0x668a5d31
+0, 12, 12, 1, 152064, 0x412a4aa7
+0, 13, 13, 1, 152064, 0x3f091baf
+0, 14, 14, 1, 152064, 0xbf16d262
+0, 15, 15, 1, 152064, 0x2fc4ce67
+0, 16, 16, 1, 152064, 0x119cde3e
+0, 17, 17, 1, 152064, 0xb40b8632
+0, 18, 18, 1, 152064, 0x4be4f192
+0, 19, 19, 1, 152064, 0x906c1237
+0, 20, 20, 1, 152064, 0x95380024
+0, 21, 21, 1, 152064, 0x6a833025
+0, 22, 22, 1, 152064, 0x681d1c4f
+0, 23, 23, 1, 152064, 0x08c8dea4
+0, 24, 24, 1, 152064, 0xc69226f0
+0, 25, 25, 1, 152064, 0x86631102
+0, 26, 26, 1, 152064, 0x7f40c77a
+0, 27, 27, 1, 152064, 0xc746ddd4
+0, 28, 28, 1, 152064, 0x5f2bd3cb
+0, 29, 29, 1, 152064, 0x643c8316
+0, 30, 30, 1, 152064, 0x5b7fa380
+0, 31, 31, 1, 152064, 0x82438cf7
+0, 32, 32, 1, 152064, 0xdee0f7e7
+0, 33, 33, 1, 152064, 0xc50d41f1
+0, 34, 34, 1, 152064, 0xf3453631
+0, 35, 35, 1, 152064, 0x90bce66b
+0, 36, 36, 1, 152064, 0x045b03f7
+0, 37, 37, 1, 152064, 0xf64bd756
+0, 38, 38, 1, 152064, 0xff997ef2
+0, 39, 39, 1, 152064, 0x3613a0a5
+0, 40, 40, 1, 152064, 0xe6a7a8d6
+0, 41, 41, 1, 152064, 0xb0906c42
+0, 42, 42, 1, 152064, 0x4dfc912b
+0, 43, 43, 1, 152064, 0x81e3991c
+0, 44, 44, 1, 152064, 0x4efc61fb
+0, 45, 45, 1, 152064, 0xed478395
+0, 46, 46, 1, 152064, 0x4cb25ab6
+0, 47, 47, 1, 152064, 0x28e7d51f
+0, 48, 48, 1, 152064, 0x8bcc1a8d
+0, 49, 49, 1, 152064, 0x2fe1f240
+0, 50, 50, 1, 152064, 0xb4978ef8
+0, 51, 51, 1, 152064, 0xe3929556
+0, 52, 52, 1, 152064, 0xd370632a
+0, 53, 53, 1, 152064, 0xba86ffb2
+0, 54, 54, 1, 152064, 0x444bf18c
+0, 55, 55, 1, 152064, 0xab40bd14
+0, 56, 56, 1, 152064, 0xfd488a5d
+0, 57, 57, 1, 152064, 0xe1f09568
+0, 58, 58, 1, 152064, 0x09ee7a7e
+0, 59, 59, 1, 152064, 0x9360397c
+0, 60, 60, 1, 152064, 0xdbd467e9
+0, 61, 61, 1, 152064, 0x99726777
+0, 62, 62, 1, 152064, 0x009fd46c
+0, 63, 63, 1, 152064, 0xcf770fdb
+0, 64, 64, 1, 152064, 0x2a890fd9
+0, 65, 65, 1, 152064, 0x7f40de4b
+0, 66, 66, 1, 152064, 0x04191304
+0, 67, 67, 1, 152064, 0x15722022
+0, 68, 68, 1, 152064, 0x59f4ea93
+0, 69, 69, 1, 152064, 0x28ba373f
+0, 70, 70, 1, 152064, 0xf9e400b8
+0, 71, 71, 1, 152064, 0x85c4bd98
+0, 72, 72, 1, 152064, 0x6917d2a5
+0, 73, 73, 1, 152064, 0x61cae234
+0, 74, 74, 1, 152064, 0x752a9a2d
+0, 75, 75, 1, 152064, 0x1ee2d9bd
+0, 76, 76, 1, 152064, 0xdce9ab8e
+0, 77, 77, 1, 152064, 0x51225fd0
+0, 78, 78, 1, 152064, 0x10e8cb60
+0, 79, 79, 1, 152064, 0x8d07cd25
+0, 80, 80, 1, 152064, 0xb18ba61b
+0, 81, 81, 1, 152064, 0xb0f10280
+0, 82, 82, 1, 152064, 0x76a71f13
+0, 83, 83, 1, 152064, 0x3004f5a1
+0, 84, 84, 1, 152064, 0x9aba5724
+0, 85, 85, 1, 152064, 0x5db85385
+0, 86, 86, 1, 152064, 0xbe9d3f5b
+0, 87, 87, 1, 152064, 0xa71e85bb
+0, 88, 88, 1, 152064, 0xdcf59cd7
+0, 89, 89, 1, 152064, 0x5e319459
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-camanl2_toshiba_b b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-camanl2_toshiba_b
index d8959a3..066c57f 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-camanl2_toshiba_b
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-camanl2_toshiba_b
@@ -1,90 +1,91 @@
-0, 0, 152064, 0xb1edd842
-0, 3600, 152064, 0x551f8f45
-0, 7200, 152064, 0xb4931cb2
-0, 10800, 152064, 0x5f352e98
-0, 14400, 152064, 0xeba5fe28
-0, 18000, 152064, 0x85afad0a
-0, 21600, 152064, 0x1120b6a4
-0, 25200, 152064, 0x67506e16
-0, 28800, 152064, 0x22421437
-0, 32400, 152064, 0x929becd6
-0, 36000, 152064, 0x6ffcb4b0
-0, 39600, 152064, 0x668a5d31
-0, 43200, 152064, 0x1b034ebb
-0, 46800, 152064, 0x7e2d213c
-0, 50400, 152064, 0xbf16d262
-0, 54000, 152064, 0xdeaecab3
-0, 57600, 152064, 0xd220d704
-0, 61200, 152064, 0xb40b8632
-0, 64800, 152064, 0xbdf0ef57
-0, 68400, 152064, 0x7e2e10df
-0, 72000, 152064, 0x95380024
-0, 75600, 152064, 0xdb80256d
-0, 79200, 152064, 0xa4561c61
-0, 82800, 152064, 0x08c8dea4
-0, 86400, 152064, 0x7bb917d6
-0, 90000, 152064, 0x796f0e2b
-0, 93600, 152064, 0x7f40c77a
-0, 97200, 152064, 0xda32de2e
-0, 100800, 152064, 0x00ffc15a
-0, 104400, 152064, 0x643c8316
-0, 108000, 152064, 0xb7588f7f
-0, 111600, 152064, 0xa4e07c02
-0, 115200, 152064, 0xdee0f7e7
-0, 118800, 152064, 0x2c3245ee
-0, 122400, 152064, 0x6565355b
-0, 126000, 152064, 0x90bce66b
-0, 129600, 152064, 0x0abffe08
-0, 133200, 152064, 0x119ccc3e
-0, 136800, 152064, 0xff997ef2
-0, 140400, 152064, 0xba4b9820
-0, 144000, 152064, 0xb6dfa596
-0, 147600, 152064, 0xb0906c42
-0, 151200, 152064, 0xf3c29133
-0, 154800, 152064, 0x08cd8e2b
-0, 158400, 152064, 0x4efc61fb
-0, 162000, 152064, 0x5b7c6e48
-0, 165600, 152064, 0xd28a47c2
-0, 169200, 152064, 0x28e7d51f
-0, 172800, 152064, 0x3a5619b1
-0, 176400, 152064, 0xa517e7f2
-0, 180000, 152064, 0xb4978ef8
-0, 183600, 152064, 0x25929175
-0, 187200, 152064, 0x20f05834
-0, 190800, 152064, 0xba86ffb2
-0, 194400, 152064, 0xa265f06f
-0, 198000, 152064, 0x97bbbfb7
-0, 201600, 152064, 0xfd488a5d
-0, 205200, 152064, 0x1b0989da
-0, 208800, 152064, 0xfd1878ce
-0, 212400, 152064, 0x9360397c
-0, 216000, 152064, 0x0d8151a7
-0, 219600, 152064, 0xe7a05bb8
-0, 223200, 152064, 0x009fd46c
-0, 226800, 152064, 0x8751123f
-0, 230400, 152064, 0x8252101a
-0, 234000, 152064, 0x7f40de4b
-0, 237600, 152064, 0x4ea317fe
-0, 241200, 152064, 0x519224d9
-0, 244800, 152064, 0x59f4ea93
-0, 248400, 152064, 0xc93c1dba
-0, 252000, 152064, 0xe3c9fb61
-0, 255600, 152064, 0x85c4bd98
-0, 259200, 152064, 0xcebacfd3
-0, 262800, 152064, 0x7327da99
-0, 266400, 152064, 0x752a9a2d
-0, 270000, 152064, 0x5ea6c8d2
-0, 273600, 152064, 0x66fd8c6f
-0, 277200, 152064, 0x51225fd0
-0, 280800, 152064, 0x58b9be96
-0, 284400, 152064, 0xa5abcdb7
-0, 288000, 152064, 0xb18ba61b
-0, 291600, 152064, 0xc7d20190
-0, 295200, 152064, 0xb6da14aa
-0, 298800, 152064, 0x3004f5a1
-0, 302400, 152064, 0x129354e2
-0, 306000, 152064, 0xffa148d5
-0, 309600, 152064, 0xbe9d3f5b
-0, 313200, 152064, 0x1c7f8976
-0, 316800, 152064, 0xa107a54d
-0, 320400, 152064, 0x5e319459
+#tb 0: 1/25
+0, 0, 0, 1, 152064, 0xb1edd842
+0, 1, 1, 1, 152064, 0x551f8f45
+0, 2, 2, 1, 152064, 0xb4931cb2
+0, 3, 3, 1, 152064, 0x5f352e98
+0, 4, 4, 1, 152064, 0xeba5fe28
+0, 5, 5, 1, 152064, 0x85afad0a
+0, 6, 6, 1, 152064, 0x1120b6a4
+0, 7, 7, 1, 152064, 0x67506e16
+0, 8, 8, 1, 152064, 0x22421437
+0, 9, 9, 1, 152064, 0x929becd6
+0, 10, 10, 1, 152064, 0x6ffcb4b0
+0, 11, 11, 1, 152064, 0x668a5d31
+0, 12, 12, 1, 152064, 0x1b034ebb
+0, 13, 13, 1, 152064, 0x7e2d213c
+0, 14, 14, 1, 152064, 0xbf16d262
+0, 15, 15, 1, 152064, 0xdeaecab3
+0, 16, 16, 1, 152064, 0xd220d704
+0, 17, 17, 1, 152064, 0xb40b8632
+0, 18, 18, 1, 152064, 0xbdf0ef57
+0, 19, 19, 1, 152064, 0x7e2e10df
+0, 20, 20, 1, 152064, 0x95380024
+0, 21, 21, 1, 152064, 0xdb80256d
+0, 22, 22, 1, 152064, 0xa4561c61
+0, 23, 23, 1, 152064, 0x08c8dea4
+0, 24, 24, 1, 152064, 0x7bb917d6
+0, 25, 25, 1, 152064, 0x796f0e2b
+0, 26, 26, 1, 152064, 0x7f40c77a
+0, 27, 27, 1, 152064, 0xda32de2e
+0, 28, 28, 1, 152064, 0x00ffc15a
+0, 29, 29, 1, 152064, 0x643c8316
+0, 30, 30, 1, 152064, 0xb7588f7f
+0, 31, 31, 1, 152064, 0xa4e07c02
+0, 32, 32, 1, 152064, 0xdee0f7e7
+0, 33, 33, 1, 152064, 0x2c3245ee
+0, 34, 34, 1, 152064, 0x6565355b
+0, 35, 35, 1, 152064, 0x90bce66b
+0, 36, 36, 1, 152064, 0x0abffe08
+0, 37, 37, 1, 152064, 0x119ccc3e
+0, 38, 38, 1, 152064, 0xff997ef2
+0, 39, 39, 1, 152064, 0xba4b9820
+0, 40, 40, 1, 152064, 0xb6dfa596
+0, 41, 41, 1, 152064, 0xb0906c42
+0, 42, 42, 1, 152064, 0xf3c29133
+0, 43, 43, 1, 152064, 0x08cd8e2b
+0, 44, 44, 1, 152064, 0x4efc61fb
+0, 45, 45, 1, 152064, 0x5b7c6e48
+0, 46, 46, 1, 152064, 0xd28a47c2
+0, 47, 47, 1, 152064, 0x28e7d51f
+0, 48, 48, 1, 152064, 0x3a5619b1
+0, 49, 49, 1, 152064, 0xa517e7f2
+0, 50, 50, 1, 152064, 0xb4978ef8
+0, 51, 51, 1, 152064, 0x25929175
+0, 52, 52, 1, 152064, 0x20f05834
+0, 53, 53, 1, 152064, 0xba86ffb2
+0, 54, 54, 1, 152064, 0xa265f06f
+0, 55, 55, 1, 152064, 0x97bbbfb7
+0, 56, 56, 1, 152064, 0xfd488a5d
+0, 57, 57, 1, 152064, 0x1b0989da
+0, 58, 58, 1, 152064, 0xfd1878ce
+0, 59, 59, 1, 152064, 0x9360397c
+0, 60, 60, 1, 152064, 0x0d8151a7
+0, 61, 61, 1, 152064, 0xe7a05bb8
+0, 62, 62, 1, 152064, 0x009fd46c
+0, 63, 63, 1, 152064, 0x8751123f
+0, 64, 64, 1, 152064, 0x8252101a
+0, 65, 65, 1, 152064, 0x7f40de4b
+0, 66, 66, 1, 152064, 0x4ea317fe
+0, 67, 67, 1, 152064, 0x519224d9
+0, 68, 68, 1, 152064, 0x59f4ea93
+0, 69, 69, 1, 152064, 0xc93c1dba
+0, 70, 70, 1, 152064, 0xe3c9fb61
+0, 71, 71, 1, 152064, 0x85c4bd98
+0, 72, 72, 1, 152064, 0xcebacfd3
+0, 73, 73, 1, 152064, 0x7327da99
+0, 74, 74, 1, 152064, 0x752a9a2d
+0, 75, 75, 1, 152064, 0x5ea6c8d2
+0, 76, 76, 1, 152064, 0x66fd8c6f
+0, 77, 77, 1, 152064, 0x51225fd0
+0, 78, 78, 1, 152064, 0x58b9be96
+0, 79, 79, 1, 152064, 0xa5abcdb7
+0, 80, 80, 1, 152064, 0xb18ba61b
+0, 81, 81, 1, 152064, 0xc7d20190
+0, 82, 82, 1, 152064, 0xb6da14aa
+0, 83, 83, 1, 152064, 0x3004f5a1
+0, 84, 84, 1, 152064, 0x129354e2
+0, 85, 85, 1, 152064, 0xffa148d5
+0, 86, 86, 1, 152064, 0xbe9d3f5b
+0, 87, 87, 1, 152064, 0x1c7f8976
+0, 88, 88, 1, 152064, 0xa107a54d
+0, 89, 89, 1, 152064, 0x5e319459
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-camanl3_sand_e b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-camanl3_sand_e
index ac8be19..a76170c 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-camanl3_sand_e
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-camanl3_sand_e
@@ -1,50 +1,51 @@
-0, 0, 152064, 0x6c1ff6a7
-0, 3600, 152064, 0x17f1ff3a
-0, 7200, 152064, 0xf7ddcda8
-0, 10800, 152064, 0xdcb64a37
-0, 14400, 152064, 0x4d2ad1db
-0, 18000, 152064, 0x2e49028a
-0, 21600, 152064, 0xcebb0f39
-0, 25200, 152064, 0xac74e574
-0, 28800, 152064, 0x8cd667e5
-0, 32400, 152064, 0xda511cf6
-0, 36000, 152064, 0x795c45c1
-0, 39600, 152064, 0x6034397c
-0, 43200, 152064, 0xafb4b03d
-0, 46800, 152064, 0xd73b1785
-0, 50400, 152064, 0xd873a98f
-0, 54000, 152064, 0x07ac191e
-0, 57600, 152064, 0x14fa5413
-0, 61200, 152064, 0xe6d1667e
-0, 64800, 152064, 0x1cc2a92e
-0, 68400, 152064, 0x4a878e35
-0, 72000, 152064, 0x4adfa52c
-0, 75600, 152064, 0x8dbb370b
-0, 79200, 152064, 0x4d66a69a
-0, 82800, 152064, 0x2dcb66da
-0, 86400, 152064, 0x74591150
-0, 90000, 152064, 0x259eb13f
-0, 93600, 152064, 0xe5c96dd3
-0, 97200, 152064, 0x0fb52fe3
-0, 100800, 152064, 0x47c506a0
-0, 104400, 152064, 0xcc09ca7a
-0, 108000, 152064, 0xc3430f03
-0, 111600, 152064, 0x702b1a73
-0, 115200, 152064, 0x4f385186
-0, 118800, 152064, 0x07a34aa5
-0, 122400, 152064, 0x698310b0
-0, 126000, 152064, 0x5fa469bc
-0, 129600, 152064, 0xb6ab39ef
-0, 133200, 152064, 0xbb6dc59d
-0, 136800, 152064, 0xe5fa7503
-0, 140400, 152064, 0xd367512a
-0, 144000, 152064, 0x215c0ca7
-0, 147600, 152064, 0x6bea4847
-0, 151200, 152064, 0xba03f875
-0, 154800, 152064, 0x3ac282cd
-0, 158400, 152064, 0x23aee807
-0, 162000, 152064, 0x4274c84c
-0, 165600, 152064, 0xdfdacf4b
-0, 169200, 152064, 0xb2de9e6e
-0, 172800, 152064, 0x456b684e
-0, 176400, 152064, 0xa6297c83
+#tb 0: 1/25
+0, 0, 0, 1, 152064, 0x6c1ff6a7
+0, 1, 1, 1, 152064, 0x17f1ff3a
+0, 2, 2, 1, 152064, 0xf7ddcda8
+0, 3, 3, 1, 152064, 0xdcb64a37
+0, 4, 4, 1, 152064, 0x4d2ad1db
+0, 5, 5, 1, 152064, 0x2e49028a
+0, 6, 6, 1, 152064, 0xcebb0f39
+0, 7, 7, 1, 152064, 0xac74e574
+0, 8, 8, 1, 152064, 0x8cd667e5
+0, 9, 9, 1, 152064, 0xda511cf6
+0, 10, 10, 1, 152064, 0x795c45c1
+0, 11, 11, 1, 152064, 0x6034397c
+0, 12, 12, 1, 152064, 0xafb4b03d
+0, 13, 13, 1, 152064, 0xd73b1785
+0, 14, 14, 1, 152064, 0xd873a98f
+0, 15, 15, 1, 152064, 0x07ac191e
+0, 16, 16, 1, 152064, 0x14fa5413
+0, 17, 17, 1, 152064, 0xe6d1667e
+0, 18, 18, 1, 152064, 0x1cc2a92e
+0, 19, 19, 1, 152064, 0x4a878e35
+0, 20, 20, 1, 152064, 0x4adfa52c
+0, 21, 21, 1, 152064, 0x8dbb370b
+0, 22, 22, 1, 152064, 0x4d66a69a
+0, 23, 23, 1, 152064, 0x2dcb66da
+0, 24, 24, 1, 152064, 0x74591150
+0, 25, 25, 1, 152064, 0x259eb13f
+0, 26, 26, 1, 152064, 0xe5c96dd3
+0, 27, 27, 1, 152064, 0x0fb52fe3
+0, 28, 28, 1, 152064, 0x47c506a0
+0, 29, 29, 1, 152064, 0xcc09ca7a
+0, 30, 30, 1, 152064, 0xc3430f03
+0, 31, 31, 1, 152064, 0x702b1a73
+0, 32, 32, 1, 152064, 0x4f385186
+0, 33, 33, 1, 152064, 0x07a34aa5
+0, 34, 34, 1, 152064, 0x698310b0
+0, 35, 35, 1, 152064, 0x5fa469bc
+0, 36, 36, 1, 152064, 0xb6ab39ef
+0, 37, 37, 1, 152064, 0xbb6dc59d
+0, 38, 38, 1, 152064, 0xe5fa7503
+0, 39, 39, 1, 152064, 0xd367512a
+0, 40, 40, 1, 152064, 0x215c0ca7
+0, 41, 41, 1, 152064, 0x6bea4847
+0, 42, 42, 1, 152064, 0xba03f875
+0, 43, 43, 1, 152064, 0x3ac282cd
+0, 44, 44, 1, 152064, 0x23aee807
+0, 45, 45, 1, 152064, 0x4274c84c
+0, 46, 46, 1, 152064, 0xdfdacf4b
+0, 47, 47, 1, 152064, 0xb2de9e6e
+0, 48, 48, 1, 152064, 0x456b684e
+0, 49, 49, 1, 152064, 0xa6297c83
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-camasl3_sony_b b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-camasl3_sony_b
index 73f9b7f..0cb41e1 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-camasl3_sony_b
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-camasl3_sony_b
@@ -1,17 +1,18 @@
-0, 0, 36864, 0xfe2ad849
-0, 3600, 36864, 0x37954ba1
-0, 7200, 36864, 0xaf0e0877
-0, 10800, 36864, 0xf28cadd1
-0, 14400, 36864, 0xe182365a
-0, 18000, 36864, 0xdcdc03b7
-0, 21600, 36864, 0x2eded02f
-0, 25200, 36864, 0xa706ca87
-0, 28800, 36864, 0x446f4c83
-0, 32400, 36864, 0x766acab3
-0, 36000, 36864, 0x651feaed
-0, 39600, 36864, 0x834a2a75
-0, 43200, 36864, 0xb1811822
-0, 46800, 36864, 0xd8e12e21
-0, 50400, 36864, 0x6b445b13
-0, 54000, 36864, 0xa4ded223
-0, 57600, 36864, 0xbd1161b5
+#tb 0: 1/25
+0, 0, 0, 1, 36864, 0xfe2ad849
+0, 1, 1, 1, 36864, 0x37954ba1
+0, 2, 2, 1, 36864, 0xaf0e0877
+0, 3, 3, 1, 36864, 0xf28cadd1
+0, 4, 4, 1, 36864, 0xe182365a
+0, 5, 5, 1, 36864, 0xdcdc03b7
+0, 6, 6, 1, 36864, 0x2eded02f
+0, 7, 7, 1, 36864, 0xa706ca87
+0, 8, 8, 1, 36864, 0x446f4c83
+0, 9, 9, 1, 36864, 0x766acab3
+0, 10, 10, 1, 36864, 0x651feaed
+0, 11, 11, 1, 36864, 0x834a2a75
+0, 12, 12, 1, 36864, 0xb1811822
+0, 13, 13, 1, 36864, 0xd8e12e21
+0, 14, 14, 1, 36864, 0x6b445b13
+0, 15, 15, 1, 36864, 0xa4ded223
+0, 16, 16, 1, 36864, 0xbd1161b5
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-camp_mot_mbaff_l30 b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-camp_mot_mbaff_l30
index f8a1b8c..c4f2782 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-camp_mot_mbaff_l30
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-camp_mot_mbaff_l30
@@ -1,30 +1,31 @@
-0, 0, 518400, 0x672279df
-0, 3600, 518400, 0xb248a762
-0, 7200, 518400, 0x4399de88
-0, 10800, 518400, 0x14200d2d
-0, 14400, 518400, 0x14a704cf
-0, 18000, 518400, 0xcaac5431
-0, 21600, 518400, 0x69d77cee
-0, 25200, 518400, 0x420d5f92
-0, 28800, 518400, 0x083a357d
-0, 32400, 518400, 0x01777426
-0, 36000, 518400, 0x474640e9
-0, 39600, 518400, 0x3d690eab
-0, 43200, 518400, 0x58074830
-0, 46800, 518400, 0x3e3f0fcc
-0, 50400, 518400, 0x8c72de01
-0, 54000, 518400, 0xbf0a4f6f
-0, 57600, 518400, 0xbdea010d
-0, 61200, 518400, 0x54bdc458
-0, 64800, 518400, 0xdcd00ed0
-0, 68400, 518400, 0x64ba9ba9
-0, 72000, 518400, 0x5c0c6790
-0, 75600, 518400, 0x178674ed
-0, 79200, 518400, 0x9ebec8d3
-0, 82800, 518400, 0x375c5426
-0, 86400, 518400, 0x19987af8
-0, 90000, 518400, 0x347ec12c
-0, 93600, 518400, 0x96856c36
-0, 97200, 518400, 0xb81264a6
-0, 100800, 518400, 0xde0a08d6
-0, 104400, 518400, 0x19cb10be
+#tb 0: 1/25
+0, 0, 0, 1, 518400, 0x672279df
+0, 1, 1, 1, 518400, 0xb248a762
+0, 2, 2, 1, 518400, 0x4399de88
+0, 3, 3, 1, 518400, 0x14200d2d
+0, 4, 4, 1, 518400, 0x14a704cf
+0, 5, 5, 1, 518400, 0xcaac5431
+0, 6, 6, 1, 518400, 0x69d77cee
+0, 7, 7, 1, 518400, 0x420d5f92
+0, 8, 8, 1, 518400, 0x083a357d
+0, 9, 9, 1, 518400, 0x01777426
+0, 10, 10, 1, 518400, 0x474640e9
+0, 11, 11, 1, 518400, 0x3d690eab
+0, 12, 12, 1, 518400, 0x58074830
+0, 13, 13, 1, 518400, 0x3e3f0fcc
+0, 14, 14, 1, 518400, 0x8c72de01
+0, 15, 15, 1, 518400, 0xbf0a4f6f
+0, 16, 16, 1, 518400, 0xbdea010d
+0, 17, 17, 1, 518400, 0x54bdc458
+0, 18, 18, 1, 518400, 0xdcd00ed0
+0, 19, 19, 1, 518400, 0x64ba9ba9
+0, 20, 20, 1, 518400, 0x5c0c6790
+0, 21, 21, 1, 518400, 0x178674ed
+0, 22, 22, 1, 518400, 0x9ebec8d3
+0, 23, 23, 1, 518400, 0x375c5426
+0, 24, 24, 1, 518400, 0x19987af8
+0, 25, 25, 1, 518400, 0x347ec12c
+0, 26, 26, 1, 518400, 0x96856c36
+0, 27, 27, 1, 518400, 0xb81264a6
+0, 28, 28, 1, 518400, 0xde0a08d6
+0, 29, 29, 1, 518400, 0x19cb10be
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-camp_mot_mbaff_l31 b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-camp_mot_mbaff_l31
index baccdb8..1bee037 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-camp_mot_mbaff_l31
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-camp_mot_mbaff_l31
@@ -1,30 +1,31 @@
-0, 0, 518400, 0x077637bf
-0, 3600, 518400, 0xbd096d55
-0, 7200, 518400, 0x58b58820
-0, 10800, 518400, 0xdf24aced
-0, 14400, 518400, 0x2354c6a2
-0, 18000, 518400, 0xedaaffdf
-0, 21600, 518400, 0x28a8f027
-0, 25200, 518400, 0x05dee3d2
-0, 28800, 518400, 0x2ae9dbe4
-0, 32400, 518400, 0x361fec4a
-0, 36000, 518400, 0xd9c7b07d
-0, 39600, 518400, 0xa9d69c9f
-0, 43200, 518400, 0x7f44c08c
-0, 46800, 518400, 0xbfed83b4
-0, 50400, 518400, 0x65a5588c
-0, 54000, 518400, 0xf4859855
-0, 57600, 518400, 0xcba96df9
-0, 61200, 518400, 0x8ae11dfd
-0, 64800, 518400, 0xf0e36904
-0, 68400, 518400, 0x45cf1cb3
-0, 72000, 518400, 0xffefde04
-0, 75600, 518400, 0xc2a8edef
-0, 79200, 518400, 0x72b15456
-0, 82800, 518400, 0x67b8dd35
-0, 86400, 518400, 0x8b91f38e
-0, 90000, 518400, 0xe7055df1
-0, 93600, 518400, 0x5c32200d
-0, 97200, 518400, 0xfbb709dc
-0, 100800, 518400, 0x5c45b17f
-0, 104400, 518400, 0x3a25903f
+#tb 0: 1/25
+0, 0, 0, 1, 518400, 0x077637bf
+0, 1, 1, 1, 518400, 0xbd096d55
+0, 2, 2, 1, 518400, 0x58b58820
+0, 3, 3, 1, 518400, 0xdf24aced
+0, 4, 4, 1, 518400, 0x2354c6a2
+0, 5, 5, 1, 518400, 0xedaaffdf
+0, 6, 6, 1, 518400, 0x28a8f027
+0, 7, 7, 1, 518400, 0x05dee3d2
+0, 8, 8, 1, 518400, 0x2ae9dbe4
+0, 9, 9, 1, 518400, 0x361fec4a
+0, 10, 10, 1, 518400, 0xd9c7b07d
+0, 11, 11, 1, 518400, 0xa9d69c9f
+0, 12, 12, 1, 518400, 0x7f44c08c
+0, 13, 13, 1, 518400, 0xbfed83b4
+0, 14, 14, 1, 518400, 0x65a5588c
+0, 15, 15, 1, 518400, 0xf4859855
+0, 16, 16, 1, 518400, 0xcba96df9
+0, 17, 17, 1, 518400, 0x8ae11dfd
+0, 18, 18, 1, 518400, 0xf0e36904
+0, 19, 19, 1, 518400, 0x45cf1cb3
+0, 20, 20, 1, 518400, 0xffefde04
+0, 21, 21, 1, 518400, 0xc2a8edef
+0, 22, 22, 1, 518400, 0x72b15456
+0, 23, 23, 1, 518400, 0x67b8dd35
+0, 24, 24, 1, 518400, 0x8b91f38e
+0, 25, 25, 1, 518400, 0xe7055df1
+0, 26, 26, 1, 518400, 0x5c32200d
+0, 27, 27, 1, 518400, 0xfbb709dc
+0, 28, 28, 1, 518400, 0x5c45b17f
+0, 29, 29, 1, 518400, 0x3a25903f
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-canl1_sony_e b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-canl1_sony_e
index 552caa8..d90e957 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-canl1_sony_e
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-canl1_sony_e
@@ -1,50 +1,51 @@
-0, 0, 38016, 0xc805351d
-0, 3600, 38016, 0x3809fec3
-0, 7200, 38016, 0xf698ce3c
-0, 10800, 38016, 0x7e3da603
-0, 14400, 38016, 0x68b07d81
-0, 18000, 38016, 0xd91f717a
-0, 21600, 38016, 0x48885dd6
-0, 25200, 38016, 0x27e64e8e
-0, 28800, 38016, 0x955835ce
-0, 32400, 38016, 0xf19940a0
-0, 36000, 38016, 0x9a1c51e4
-0, 39600, 38016, 0xf59373af
-0, 43200, 38016, 0x5d6c7d06
-0, 46800, 38016, 0x32fca533
-0, 50400, 38016, 0x37e69987
-0, 54000, 38016, 0x96929e05
-0, 57600, 38016, 0xee37a1f9
-0, 61200, 38016, 0xc6279d8f
-0, 64800, 38016, 0x33d28b0a
-0, 68400, 38016, 0x42946b72
-0, 72000, 38016, 0x51e947bf
-0, 75600, 38016, 0xb10b2399
-0, 79200, 38016, 0x250c0fe4
-0, 82800, 38016, 0x81e20b18
-0, 86400, 38016, 0xb93f00db
-0, 90000, 38016, 0x4f9d13d8
-0, 93600, 38016, 0x7d9c1184
-0, 97200, 38016, 0xd3271d2c
-0, 100800, 38016, 0x9b253539
-0, 104400, 38016, 0xc4fd4d89
-0, 108000, 38016, 0x006f63cc
-0, 111600, 38016, 0xa7d976b4
-0, 115200, 38016, 0x30de94d6
-0, 118800, 38016, 0x2cb7a745
-0, 122400, 38016, 0xa7a2b854
-0, 126000, 38016, 0x1ca1ba1a
-0, 129600, 38016, 0x13b2b430
-0, 133200, 38016, 0x82bbb2de
-0, 136800, 38016, 0x5fa0b4f9
-0, 140400, 38016, 0xedefb64d
-0, 144000, 38016, 0x5ccdbf33
-0, 147600, 38016, 0x4fd0b4bb
-0, 151200, 38016, 0x195fa008
-0, 154800, 38016, 0xda1494e0
-0, 158400, 38016, 0x98ac8fa6
-0, 162000, 38016, 0xd1548835
-0, 165600, 38016, 0x35c790ee
-0, 169200, 38016, 0xecda84f1
-0, 172800, 38016, 0x9d9f8710
-0, 176400, 38016, 0x72d89581
+#tb 0: 1/25
+0, 0, 0, 1, 38016, 0xc805351d
+0, 1, 1, 1, 38016, 0x3809fec3
+0, 2, 2, 1, 38016, 0xf698ce3c
+0, 3, 3, 1, 38016, 0x7e3da603
+0, 4, 4, 1, 38016, 0x68b07d81
+0, 5, 5, 1, 38016, 0xd91f717a
+0, 6, 6, 1, 38016, 0x48885dd6
+0, 7, 7, 1, 38016, 0x27e64e8e
+0, 8, 8, 1, 38016, 0x955835ce
+0, 9, 9, 1, 38016, 0xf19940a0
+0, 10, 10, 1, 38016, 0x9a1c51e4
+0, 11, 11, 1, 38016, 0xf59373af
+0, 12, 12, 1, 38016, 0x5d6c7d06
+0, 13, 13, 1, 38016, 0x32fca533
+0, 14, 14, 1, 38016, 0x37e69987
+0, 15, 15, 1, 38016, 0x96929e05
+0, 16, 16, 1, 38016, 0xee37a1f9
+0, 17, 17, 1, 38016, 0xc6279d8f
+0, 18, 18, 1, 38016, 0x33d28b0a
+0, 19, 19, 1, 38016, 0x42946b72
+0, 20, 20, 1, 38016, 0x51e947bf
+0, 21, 21, 1, 38016, 0xb10b2399
+0, 22, 22, 1, 38016, 0x250c0fe4
+0, 23, 23, 1, 38016, 0x81e20b18
+0, 24, 24, 1, 38016, 0xb93f00db
+0, 25, 25, 1, 38016, 0x4f9d13d8
+0, 26, 26, 1, 38016, 0x7d9c1184
+0, 27, 27, 1, 38016, 0xd3271d2c
+0, 28, 28, 1, 38016, 0x9b253539
+0, 29, 29, 1, 38016, 0xc4fd4d89
+0, 30, 30, 1, 38016, 0x006f63cc
+0, 31, 31, 1, 38016, 0xa7d976b4
+0, 32, 32, 1, 38016, 0x30de94d6
+0, 33, 33, 1, 38016, 0x2cb7a745
+0, 34, 34, 1, 38016, 0xa7a2b854
+0, 35, 35, 1, 38016, 0x1ca1ba1a
+0, 36, 36, 1, 38016, 0x13b2b430
+0, 37, 37, 1, 38016, 0x82bbb2de
+0, 38, 38, 1, 38016, 0x5fa0b4f9
+0, 39, 39, 1, 38016, 0xedefb64d
+0, 40, 40, 1, 38016, 0x5ccdbf33
+0, 41, 41, 1, 38016, 0x4fd0b4bb
+0, 42, 42, 1, 38016, 0x195fa008
+0, 43, 43, 1, 38016, 0xda1494e0
+0, 44, 44, 1, 38016, 0x98ac8fa6
+0, 45, 45, 1, 38016, 0xd1548835
+0, 46, 46, 1, 38016, 0x35c790ee
+0, 47, 47, 1, 38016, 0xecda84f1
+0, 48, 48, 1, 38016, 0x9d9f8710
+0, 49, 49, 1, 38016, 0x72d89581
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-canl1_sva_b b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-canl1_sva_b
index 8594553..0436f43 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-canl1_sva_b
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-canl1_sva_b
@@ -1,17 +1,18 @@
-0, 0, 38016, 0x0bd22424
-0, 3600, 38016, 0x4eb601f0
-0, 7200, 38016, 0xe16de459
-0, 10800, 38016, 0xde2e0c37
-0, 14400, 38016, 0x14a0286b
-0, 18000, 38016, 0x37bc35b5
-0, 21600, 38016, 0xcfa24923
-0, 25200, 38016, 0xac755ba0
-0, 28800, 38016, 0x27d1822a
-0, 32400, 38016, 0xa8039548
-0, 36000, 38016, 0x400ea1fb
-0, 39600, 38016, 0x7d2ca44a
-0, 43200, 38016, 0xd42dae4f
-0, 46800, 38016, 0x39ce9599
-0, 50400, 38016, 0x37498aa1
-0, 54000, 38016, 0x8558911f
-0, 57600, 38016, 0x06a8a9ad
+#tb 0: 1/25
+0, 0, 0, 1, 38016, 0x0bd22424
+0, 1, 1, 1, 38016, 0x4eb601f0
+0, 2, 2, 1, 38016, 0xe16de459
+0, 3, 3, 1, 38016, 0xde2e0c37
+0, 4, 4, 1, 38016, 0x14a0286b
+0, 5, 5, 1, 38016, 0x37bc35b5
+0, 6, 6, 1, 38016, 0xcfa24923
+0, 7, 7, 1, 38016, 0xac755ba0
+0, 8, 8, 1, 38016, 0x27d1822a
+0, 9, 9, 1, 38016, 0xa8039548
+0, 10, 10, 1, 38016, 0x400ea1fb
+0, 11, 11, 1, 38016, 0x7d2ca44a
+0, 12, 12, 1, 38016, 0xd42dae4f
+0, 13, 13, 1, 38016, 0x39ce9599
+0, 14, 14, 1, 38016, 0x37498aa1
+0, 15, 15, 1, 38016, 0x8558911f
+0, 16, 16, 1, 38016, 0x06a8a9ad
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-canl1_toshiba_g b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-canl1_toshiba_g
index 49faee0..ced4c92 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-canl1_toshiba_g
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-canl1_toshiba_g
@@ -1,300 +1,301 @@
-0, 0, 38016, 0x58892149
-0, 3600, 38016, 0xda2ded74
-0, 7200, 38016, 0x2661cdb0
-0, 10800, 38016, 0xb581a73a
-0, 14400, 38016, 0xa04a7e93
-0, 18000, 38016, 0x149e7861
-0, 21600, 38016, 0x53725080
-0, 25200, 38016, 0x341a4d3f
-0, 28800, 38016, 0x2ecc41ac
-0, 32400, 38016, 0x99b85127
-0, 36000, 38016, 0x7bdc50bc
-0, 39600, 38016, 0xd3d58663
-0, 43200, 38016, 0x717485e9
-0, 46800, 38016, 0x2ac29c85
-0, 50400, 38016, 0x36daa429
-0, 54000, 38016, 0x8bb7a48e
-0, 57600, 38016, 0xb38aab11
-0, 61200, 38016, 0xacd89c4c
-0, 64800, 38016, 0x676b71e1
-0, 68400, 38016, 0xa2e7731e
-0, 72000, 38016, 0x4a2f5766
-0, 75600, 38016, 0x04ef1873
-0, 79200, 38016, 0x52ac0171
-0, 82800, 38016, 0xdd0a027a
-0, 86400, 38016, 0x700810c6
-0, 90000, 38016, 0x417f0cd3
-0, 93600, 38016, 0xf8ef0da9
-0, 97200, 38016, 0xfce62a5a
-0, 100800, 38016, 0x03592b0a
-0, 104400, 38016, 0x9b7b5373
-0, 108000, 38016, 0xab015505
-0, 111600, 38016, 0xf3387ae1
-0, 115200, 38016, 0x1d09a5b6
-0, 118800, 38016, 0x9159a5e2
-0, 122400, 38016, 0x8887c177
-0, 126000, 38016, 0x914dbacd
-0, 129600, 38016, 0xaa97c0f6
-0, 133200, 38016, 0x0837b14a
-0, 136800, 38016, 0x0198be16
-0, 140400, 38016, 0xc14bc9c6
-0, 144000, 38016, 0xdb58c2a7
-0, 147600, 38016, 0xa751ae90
-0, 151200, 38016, 0x5813a64d
-0, 154800, 38016, 0x73959f9b
-0, 158400, 38016, 0xb0de8994
-0, 162000, 38016, 0x79ea9214
-0, 165600, 38016, 0x0b388957
-0, 169200, 38016, 0x31aa91c9
-0, 172800, 38016, 0xadcf88ec
-0, 176400, 38016, 0x5bc99b68
-0, 180000, 38016, 0x535e7c2e
-0, 183600, 38016, 0xbfef8e0a
-0, 187200, 38016, 0xc56285aa
-0, 190800, 38016, 0x76758edc
-0, 194400, 38016, 0xd8c3a20b
-0, 198000, 38016, 0xd2aa918b
-0, 201600, 38016, 0xfe1ea23b
-0, 205200, 38016, 0x3533a68d
-0, 208800, 38016, 0xd8679427
-0, 212400, 38016, 0x76be9c98
-0, 216000, 38016, 0xc37a9a7a
-0, 219600, 38016, 0x1ebe9463
-0, 223200, 38016, 0xab4c63d2
-0, 226800, 38016, 0x761b3c50
-0, 230400, 38016, 0xb57c4bb7
-0, 234000, 38016, 0x86117755
-0, 237600, 38016, 0xd89dacf3
-0, 241200, 38016, 0x8940eee9
-0, 244800, 38016, 0x2f7c3abf
-0, 248400, 38016, 0x98366678
-0, 252000, 38016, 0x14348147
-0, 255600, 38016, 0x4e3ba8f8
-0, 259200, 38016, 0xc167c205
-0, 262800, 38016, 0x0581e211
-0, 266400, 38016, 0x62cd0ea6
-0, 270000, 38016, 0x753b3a2b
-0, 273600, 38016, 0x25ce507a
-0, 277200, 38016, 0x726f64af
-0, 280800, 38016, 0xa13c7c58
-0, 284400, 38016, 0xa27b7584
-0, 288000, 38016, 0x45b47c12
-0, 291600, 38016, 0x0f6a9456
-0, 295200, 38016, 0x30ae9e92
-0, 298800, 38016, 0xf59fa16d
-0, 302400, 38016, 0x16d292d7
-0, 306000, 38016, 0x828791cc
-0, 309600, 38016, 0x71769267
-0, 313200, 38016, 0xf297a0e0
-0, 316800, 38016, 0x33a4a00a
-0, 320400, 38016, 0xda96c5b8
-0, 324000, 38016, 0x742daf25
-0, 327600, 38016, 0x603f8bba
-0, 331200, 38016, 0x89d18e70
-0, 334800, 38016, 0x8c2b8c29
-0, 338400, 38016, 0x9ccf6983
-0, 342000, 38016, 0x8ddd5a29
-0, 345600, 38016, 0x5679718d
-0, 349200, 38016, 0x28aa80b3
-0, 352800, 38016, 0x3b08780e
-0, 356400, 38016, 0x9e408cbc
-0, 360000, 38016, 0xe7c18e94
-0, 363600, 38016, 0xaba57f22
-0, 367200, 38016, 0xd8826dc5
-0, 370800, 38016, 0x2ed2710e
-0, 374400, 38016, 0x59748443
-0, 378000, 38016, 0x5076b247
-0, 381600, 38016, 0xf6ae9bcd
-0, 385200, 38016, 0x4d83d68f
-0, 388800, 38016, 0x118ff589
-0, 392400, 38016, 0x65b3f2c0
-0, 396000, 38016, 0x8f341576
-0, 399600, 38016, 0xbeac1816
-0, 403200, 38016, 0x19073cf9
-0, 406800, 38016, 0xcfdb2e55
-0, 410400, 38016, 0x99fd08f8
-0, 414000, 38016, 0x025c0249
-0, 417600, 38016, 0x4d311afc
-0, 421200, 38016, 0xef532038
-0, 424800, 38016, 0x7c353d9a
-0, 428400, 38016, 0x9fed4678
-0, 432000, 38016, 0x67062dad
-0, 435600, 38016, 0x1e5b2069
-0, 439200, 38016, 0x8b25fd3f
-0, 442800, 38016, 0x06a9e566
-0, 446400, 38016, 0x263badf5
-0, 450000, 38016, 0x35a99a45
-0, 453600, 38016, 0x930a8491
-0, 457200, 38016, 0xf9d49dfd
-0, 460800, 38016, 0xbc8cb0a6
-0, 464400, 38016, 0x8f10d1a9
-0, 468000, 38016, 0xb6dbc51b
-0, 471600, 38016, 0x2f1bc747
-0, 475200, 38016, 0xecdac1ac
-0, 478800, 38016, 0x6391bdcc
-0, 482400, 38016, 0x7e5eb209
-0, 486000, 38016, 0x8f5ea1e8
-0, 489600, 38016, 0x969195a9
-0, 493200, 38016, 0x18579903
-0, 496800, 38016, 0x4cfe8893
-0, 500400, 38016, 0x68c57143
-0, 504000, 38016, 0x297f6420
-0, 507600, 38016, 0x36b1669c
-0, 511200, 38016, 0x3d78362e
-0, 514800, 38016, 0xaba14c36
-0, 518400, 38016, 0xe6914a59
-0, 522000, 38016, 0x3733481a
-0, 525600, 38016, 0xb6df4c6d
-0, 529200, 38016, 0x20631838
-0, 532800, 38016, 0x014df835
-0, 536400, 38016, 0xcb36db94
-0, 540000, 38016, 0x4cb8b44a
-0, 543600, 38016, 0xa49da6e5
-0, 547200, 38016, 0x8dbfb72d
-0, 550800, 38016, 0x3ba5b7d5
-0, 554400, 38016, 0xc8ebad2d
-0, 558000, 38016, 0x36fad594
-0, 561600, 38016, 0x6302f0f2
-0, 565200, 38016, 0xc799139e
-0, 568800, 38016, 0x947947d0
-0, 572400, 38016, 0x39756224
-0, 576000, 38016, 0x1d995e51
-0, 579600, 38016, 0x56274435
-0, 583200, 38016, 0x3cfc2b1d
-0, 586800, 38016, 0x5a4a178f
-0, 590400, 38016, 0xca212af1
-0, 594000, 38016, 0x885af884
-0, 597600, 38016, 0x3241c9c1
-0, 601200, 38016, 0x4ef997a4
-0, 604800, 38016, 0x5ecb8030
-0, 608400, 38016, 0x2eb76daa
-0, 612000, 38016, 0x485780ba
-0, 615600, 38016, 0xf5f88241
-0, 619200, 38016, 0x563f97d0
-0, 622800, 38016, 0x4a01a6c4
-0, 626400, 38016, 0xd7ea8457
-0, 630000, 38016, 0x08ae6916
-0, 633600, 38016, 0x4c933e75
-0, 637200, 38016, 0x49541e4a
-0, 640800, 38016, 0xd14e028a
-0, 644400, 38016, 0xabd5f4e6
-0, 648000, 38016, 0xfe3bdd0f
-0, 651600, 38016, 0xbb30cef4
-0, 655200, 38016, 0xd724d0e3
-0, 658800, 38016, 0x7537d6bf
-0, 662400, 38016, 0x3da3e67a
-0, 666000, 38016, 0xf02606eb
-0, 669600, 38016, 0x2dde399b
-0, 673200, 38016, 0xafe94c86
-0, 676800, 38016, 0x923d6081
-0, 680400, 38016, 0x9c733e4e
-0, 684000, 38016, 0x2b16d821
-0, 687600, 38016, 0x1edf9cd1
-0, 691200, 38016, 0xa9c3b601
-0, 694800, 38016, 0x9adeb02b
-0, 698400, 38016, 0xf5eaddc3
-0, 702000, 38016, 0xac871bea
-0, 705600, 38016, 0x060429f4
-0, 709200, 38016, 0xf80b421d
-0, 712800, 38016, 0x7dcd6c50
-0, 716400, 38016, 0x46e46798
-0, 720000, 38016, 0xdbee759f
-0, 723600, 38016, 0xbbe78774
-0, 727200, 38016, 0xb85990ed
-0, 730800, 38016, 0xda0e8530
-0, 734400, 38016, 0x5eaf8508
-0, 738000, 38016, 0x5c2c83fa
-0, 741600, 38016, 0x6dfe9322
-0, 745200, 38016, 0xa3059a60
-0, 748800, 38016, 0x357c8237
-0, 752400, 38016, 0xccae6b20
-0, 756000, 38016, 0x25fe57c1
-0, 759600, 38016, 0xfa65376b
-0, 763200, 38016, 0xd9b12ef8
-0, 766800, 38016, 0x3ab73fa0
-0, 770400, 38016, 0xcb6a2f96
-0, 774000, 38016, 0x8a973915
-0, 777600, 38016, 0x71ac1dd2
-0, 781200, 38016, 0x71802085
-0, 784800, 38016, 0x4de728d9
-0, 788400, 38016, 0xdf3a1de7
-0, 792000, 38016, 0x36270e93
-0, 795600, 38016, 0x90d4fe93
-0, 799200, 38016, 0x3477fb4e
-0, 802800, 38016, 0xd410fa81
-0, 806400, 38016, 0xfc230675
-0, 810000, 38016, 0xbda40c03
-0, 813600, 38016, 0x7a47fc07
-0, 817200, 38016, 0x53fe2a37
-0, 820800, 38016, 0x342d3bec
-0, 824400, 38016, 0xf13163a3
-0, 828000, 38016, 0x03f087da
-0, 831600, 38016, 0xbc03c466
-0, 835200, 38016, 0x6318d676
-0, 838800, 38016, 0xbc2f0b68
-0, 842400, 38016, 0xcb57354b
-0, 846000, 38016, 0x7e9a5b48
-0, 849600, 38016, 0x9dca693a
-0, 853200, 38016, 0xd0776497
-0, 856800, 38016, 0x05a24093
-0, 860400, 38016, 0x69b21063
-0, 864000, 38016, 0x15f3ed8b
-0, 867600, 38016, 0x2417bc52
-0, 871200, 38016, 0xabc2a564
-0, 874800, 38016, 0x67f2dd90
-0, 878400, 38016, 0xa5fe4b6e
-0, 882000, 38016, 0x7801add2
-0, 885600, 38016, 0xf4abc321
-0, 889200, 38016, 0x1d06a837
-0, 892800, 38016, 0x2e0d6fc2
-0, 896400, 38016, 0xc4f30535
-0, 900000, 38016, 0x67d09a80
-0, 903600, 38016, 0xca505a1e
-0, 907200, 38016, 0x2e2e56c8
-0, 910800, 38016, 0x689ea3e2
-0, 914400, 38016, 0x9989165a
-0, 918000, 38016, 0xd8e2c30e
-0, 921600, 38016, 0x2a98bf3f
-0, 925200, 38016, 0x44664d3e
-0, 928800, 38016, 0x53a939de
-0, 932400, 38016, 0x4c153702
-0, 936000, 38016, 0x03c73e88
-0, 939600, 38016, 0x7cd649d4
-0, 943200, 38016, 0x7d7c5687
-0, 946800, 38016, 0x8f3c53a6
-0, 950400, 38016, 0x24634dd1
-0, 954000, 38016, 0x5d00442c
-0, 957600, 38016, 0xdcc72906
-0, 961200, 38016, 0x5def12f3
-0, 964800, 38016, 0x95e6e8be
-0, 968400, 38016, 0x2675c694
-0, 972000, 38016, 0x906aa24e
-0, 975600, 38016, 0x09468fe4
-0, 979200, 38016, 0xaec9736d
-0, 982800, 38016, 0xa5812142
-0, 986400, 38016, 0x9986d55f
-0, 990000, 38016, 0x9f7fc399
-0, 993600, 38016, 0xc345d526
-0, 997200, 38016, 0x3ae3b9bd
-0, 1000800, 38016, 0xb103ec45
-0, 1004400, 38016, 0x3ff462c2
-0, 1008000, 38016, 0x5c07ed68
-0, 1011600, 38016, 0xccbad189
-0, 1015200, 38016, 0x6f3f9a18
-0, 1018800, 38016, 0x26406fa1
-0, 1022400, 38016, 0x06cf5f62
-0, 1026000, 38016, 0x3eb29bd1
-0, 1029600, 38016, 0x12ab807e
-0, 1033200, 38016, 0x7621bf0d
-0, 1036800, 38016, 0x88eabc0c
-0, 1040400, 38016, 0x21386662
-0, 1044000, 38016, 0x5839e3e4
-0, 1047600, 38016, 0xd196ee7c
-0, 1051200, 38016, 0x84dc8477
-0, 1054800, 38016, 0xbf2dcc7a
-0, 1058400, 38016, 0x29e3fe96
-0, 1062000, 38016, 0xf115ffc3
-0, 1065600, 38016, 0x7585d699
-0, 1069200, 38016, 0x7a7dcb8a
-0, 1072800, 38016, 0x03cfdb04
-0, 1076400, 38016, 0xd56e028c
+#tb 0: 1/25
+0, 0, 0, 1, 38016, 0x58892149
+0, 1, 1, 1, 38016, 0xda2ded74
+0, 2, 2, 1, 38016, 0x2661cdb0
+0, 3, 3, 1, 38016, 0xb581a73a
+0, 4, 4, 1, 38016, 0xa04a7e93
+0, 5, 5, 1, 38016, 0x149e7861
+0, 6, 6, 1, 38016, 0x53725080
+0, 7, 7, 1, 38016, 0x341a4d3f
+0, 8, 8, 1, 38016, 0x2ecc41ac
+0, 9, 9, 1, 38016, 0x99b85127
+0, 10, 10, 1, 38016, 0x7bdc50bc
+0, 11, 11, 1, 38016, 0xd3d58663
+0, 12, 12, 1, 38016, 0x717485e9
+0, 13, 13, 1, 38016, 0x2ac29c85
+0, 14, 14, 1, 38016, 0x36daa429
+0, 15, 15, 1, 38016, 0x8bb7a48e
+0, 16, 16, 1, 38016, 0xb38aab11
+0, 17, 17, 1, 38016, 0xacd89c4c
+0, 18, 18, 1, 38016, 0x676b71e1
+0, 19, 19, 1, 38016, 0xa2e7731e
+0, 20, 20, 1, 38016, 0x4a2f5766
+0, 21, 21, 1, 38016, 0x04ef1873
+0, 22, 22, 1, 38016, 0x52ac0171
+0, 23, 23, 1, 38016, 0xdd0a027a
+0, 24, 24, 1, 38016, 0x700810c6
+0, 25, 25, 1, 38016, 0x417f0cd3
+0, 26, 26, 1, 38016, 0xf8ef0da9
+0, 27, 27, 1, 38016, 0xfce62a5a
+0, 28, 28, 1, 38016, 0x03592b0a
+0, 29, 29, 1, 38016, 0x9b7b5373
+0, 30, 30, 1, 38016, 0xab015505
+0, 31, 31, 1, 38016, 0xf3387ae1
+0, 32, 32, 1, 38016, 0x1d09a5b6
+0, 33, 33, 1, 38016, 0x9159a5e2
+0, 34, 34, 1, 38016, 0x8887c177
+0, 35, 35, 1, 38016, 0x914dbacd
+0, 36, 36, 1, 38016, 0xaa97c0f6
+0, 37, 37, 1, 38016, 0x0837b14a
+0, 38, 38, 1, 38016, 0x0198be16
+0, 39, 39, 1, 38016, 0xc14bc9c6
+0, 40, 40, 1, 38016, 0xdb58c2a7
+0, 41, 41, 1, 38016, 0xa751ae90
+0, 42, 42, 1, 38016, 0x5813a64d
+0, 43, 43, 1, 38016, 0x73959f9b
+0, 44, 44, 1, 38016, 0xb0de8994
+0, 45, 45, 1, 38016, 0x79ea9214
+0, 46, 46, 1, 38016, 0x0b388957
+0, 47, 47, 1, 38016, 0x31aa91c9
+0, 48, 48, 1, 38016, 0xadcf88ec
+0, 49, 49, 1, 38016, 0x5bc99b68
+0, 50, 50, 1, 38016, 0x535e7c2e
+0, 51, 51, 1, 38016, 0xbfef8e0a
+0, 52, 52, 1, 38016, 0xc56285aa
+0, 53, 53, 1, 38016, 0x76758edc
+0, 54, 54, 1, 38016, 0xd8c3a20b
+0, 55, 55, 1, 38016, 0xd2aa918b
+0, 56, 56, 1, 38016, 0xfe1ea23b
+0, 57, 57, 1, 38016, 0x3533a68d
+0, 58, 58, 1, 38016, 0xd8679427
+0, 59, 59, 1, 38016, 0x76be9c98
+0, 60, 60, 1, 38016, 0xc37a9a7a
+0, 61, 61, 1, 38016, 0x1ebe9463
+0, 62, 62, 1, 38016, 0xab4c63d2
+0, 63, 63, 1, 38016, 0x761b3c50
+0, 64, 64, 1, 38016, 0xb57c4bb7
+0, 65, 65, 1, 38016, 0x86117755
+0, 66, 66, 1, 38016, 0xd89dacf3
+0, 67, 67, 1, 38016, 0x8940eee9
+0, 68, 68, 1, 38016, 0x2f7c3abf
+0, 69, 69, 1, 38016, 0x98366678
+0, 70, 70, 1, 38016, 0x14348147
+0, 71, 71, 1, 38016, 0x4e3ba8f8
+0, 72, 72, 1, 38016, 0xc167c205
+0, 73, 73, 1, 38016, 0x0581e211
+0, 74, 74, 1, 38016, 0x62cd0ea6
+0, 75, 75, 1, 38016, 0x753b3a2b
+0, 76, 76, 1, 38016, 0x25ce507a
+0, 77, 77, 1, 38016, 0x726f64af
+0, 78, 78, 1, 38016, 0xa13c7c58
+0, 79, 79, 1, 38016, 0xa27b7584
+0, 80, 80, 1, 38016, 0x45b47c12
+0, 81, 81, 1, 38016, 0x0f6a9456
+0, 82, 82, 1, 38016, 0x30ae9e92
+0, 83, 83, 1, 38016, 0xf59fa16d
+0, 84, 84, 1, 38016, 0x16d292d7
+0, 85, 85, 1, 38016, 0x828791cc
+0, 86, 86, 1, 38016, 0x71769267
+0, 87, 87, 1, 38016, 0xf297a0e0
+0, 88, 88, 1, 38016, 0x33a4a00a
+0, 89, 89, 1, 38016, 0xda96c5b8
+0, 90, 90, 1, 38016, 0x742daf25
+0, 91, 91, 1, 38016, 0x603f8bba
+0, 92, 92, 1, 38016, 0x89d18e70
+0, 93, 93, 1, 38016, 0x8c2b8c29
+0, 94, 94, 1, 38016, 0x9ccf6983
+0, 95, 95, 1, 38016, 0x8ddd5a29
+0, 96, 96, 1, 38016, 0x5679718d
+0, 97, 97, 1, 38016, 0x28aa80b3
+0, 98, 98, 1, 38016, 0x3b08780e
+0, 99, 99, 1, 38016, 0x9e408cbc
+0, 100, 100, 1, 38016, 0xe7c18e94
+0, 101, 101, 1, 38016, 0xaba57f22
+0, 102, 102, 1, 38016, 0xd8826dc5
+0, 103, 103, 1, 38016, 0x2ed2710e
+0, 104, 104, 1, 38016, 0x59748443
+0, 105, 105, 1, 38016, 0x5076b247
+0, 106, 106, 1, 38016, 0xf6ae9bcd
+0, 107, 107, 1, 38016, 0x4d83d68f
+0, 108, 108, 1, 38016, 0x118ff589
+0, 109, 109, 1, 38016, 0x65b3f2c0
+0, 110, 110, 1, 38016, 0x8f341576
+0, 111, 111, 1, 38016, 0xbeac1816
+0, 112, 112, 1, 38016, 0x19073cf9
+0, 113, 113, 1, 38016, 0xcfdb2e55
+0, 114, 114, 1, 38016, 0x99fd08f8
+0, 115, 115, 1, 38016, 0x025c0249
+0, 116, 116, 1, 38016, 0x4d311afc
+0, 117, 117, 1, 38016, 0xef532038
+0, 118, 118, 1, 38016, 0x7c353d9a
+0, 119, 119, 1, 38016, 0x9fed4678
+0, 120, 120, 1, 38016, 0x67062dad
+0, 121, 121, 1, 38016, 0x1e5b2069
+0, 122, 122, 1, 38016, 0x8b25fd3f
+0, 123, 123, 1, 38016, 0x06a9e566
+0, 124, 124, 1, 38016, 0x263badf5
+0, 125, 125, 1, 38016, 0x35a99a45
+0, 126, 126, 1, 38016, 0x930a8491
+0, 127, 127, 1, 38016, 0xf9d49dfd
+0, 128, 128, 1, 38016, 0xbc8cb0a6
+0, 129, 129, 1, 38016, 0x8f10d1a9
+0, 130, 130, 1, 38016, 0xb6dbc51b
+0, 131, 131, 1, 38016, 0x2f1bc747
+0, 132, 132, 1, 38016, 0xecdac1ac
+0, 133, 133, 1, 38016, 0x6391bdcc
+0, 134, 134, 1, 38016, 0x7e5eb209
+0, 135, 135, 1, 38016, 0x8f5ea1e8
+0, 136, 136, 1, 38016, 0x969195a9
+0, 137, 137, 1, 38016, 0x18579903
+0, 138, 138, 1, 38016, 0x4cfe8893
+0, 139, 139, 1, 38016, 0x68c57143
+0, 140, 140, 1, 38016, 0x297f6420
+0, 141, 141, 1, 38016, 0x36b1669c
+0, 142, 142, 1, 38016, 0x3d78362e
+0, 143, 143, 1, 38016, 0xaba14c36
+0, 144, 144, 1, 38016, 0xe6914a59
+0, 145, 145, 1, 38016, 0x3733481a
+0, 146, 146, 1, 38016, 0xb6df4c6d
+0, 147, 147, 1, 38016, 0x20631838
+0, 148, 148, 1, 38016, 0x014df835
+0, 149, 149, 1, 38016, 0xcb36db94
+0, 150, 150, 1, 38016, 0x4cb8b44a
+0, 151, 151, 1, 38016, 0xa49da6e5
+0, 152, 152, 1, 38016, 0x8dbfb72d
+0, 153, 153, 1, 38016, 0x3ba5b7d5
+0, 154, 154, 1, 38016, 0xc8ebad2d
+0, 155, 155, 1, 38016, 0x36fad594
+0, 156, 156, 1, 38016, 0x6302f0f2
+0, 157, 157, 1, 38016, 0xc799139e
+0, 158, 158, 1, 38016, 0x947947d0
+0, 159, 159, 1, 38016, 0x39756224
+0, 160, 160, 1, 38016, 0x1d995e51
+0, 161, 161, 1, 38016, 0x56274435
+0, 162, 162, 1, 38016, 0x3cfc2b1d
+0, 163, 163, 1, 38016, 0x5a4a178f
+0, 164, 164, 1, 38016, 0xca212af1
+0, 165, 165, 1, 38016, 0x885af884
+0, 166, 166, 1, 38016, 0x3241c9c1
+0, 167, 167, 1, 38016, 0x4ef997a4
+0, 168, 168, 1, 38016, 0x5ecb8030
+0, 169, 169, 1, 38016, 0x2eb76daa
+0, 170, 170, 1, 38016, 0x485780ba
+0, 171, 171, 1, 38016, 0xf5f88241
+0, 172, 172, 1, 38016, 0x563f97d0
+0, 173, 173, 1, 38016, 0x4a01a6c4
+0, 174, 174, 1, 38016, 0xd7ea8457
+0, 175, 175, 1, 38016, 0x08ae6916
+0, 176, 176, 1, 38016, 0x4c933e75
+0, 177, 177, 1, 38016, 0x49541e4a
+0, 178, 178, 1, 38016, 0xd14e028a
+0, 179, 179, 1, 38016, 0xabd5f4e6
+0, 180, 180, 1, 38016, 0xfe3bdd0f
+0, 181, 181, 1, 38016, 0xbb30cef4
+0, 182, 182, 1, 38016, 0xd724d0e3
+0, 183, 183, 1, 38016, 0x7537d6bf
+0, 184, 184, 1, 38016, 0x3da3e67a
+0, 185, 185, 1, 38016, 0xf02606eb
+0, 186, 186, 1, 38016, 0x2dde399b
+0, 187, 187, 1, 38016, 0xafe94c86
+0, 188, 188, 1, 38016, 0x923d6081
+0, 189, 189, 1, 38016, 0x9c733e4e
+0, 190, 190, 1, 38016, 0x2b16d821
+0, 191, 191, 1, 38016, 0x1edf9cd1
+0, 192, 192, 1, 38016, 0xa9c3b601
+0, 193, 193, 1, 38016, 0x9adeb02b
+0, 194, 194, 1, 38016, 0xf5eaddc3
+0, 195, 195, 1, 38016, 0xac871bea
+0, 196, 196, 1, 38016, 0x060429f4
+0, 197, 197, 1, 38016, 0xf80b421d
+0, 198, 198, 1, 38016, 0x7dcd6c50
+0, 199, 199, 1, 38016, 0x46e46798
+0, 200, 200, 1, 38016, 0xdbee759f
+0, 201, 201, 1, 38016, 0xbbe78774
+0, 202, 202, 1, 38016, 0xb85990ed
+0, 203, 203, 1, 38016, 0xda0e8530
+0, 204, 204, 1, 38016, 0x5eaf8508
+0, 205, 205, 1, 38016, 0x5c2c83fa
+0, 206, 206, 1, 38016, 0x6dfe9322
+0, 207, 207, 1, 38016, 0xa3059a60
+0, 208, 208, 1, 38016, 0x357c8237
+0, 209, 209, 1, 38016, 0xccae6b20
+0, 210, 210, 1, 38016, 0x25fe57c1
+0, 211, 211, 1, 38016, 0xfa65376b
+0, 212, 212, 1, 38016, 0xd9b12ef8
+0, 213, 213, 1, 38016, 0x3ab73fa0
+0, 214, 214, 1, 38016, 0xcb6a2f96
+0, 215, 215, 1, 38016, 0x8a973915
+0, 216, 216, 1, 38016, 0x71ac1dd2
+0, 217, 217, 1, 38016, 0x71802085
+0, 218, 218, 1, 38016, 0x4de728d9
+0, 219, 219, 1, 38016, 0xdf3a1de7
+0, 220, 220, 1, 38016, 0x36270e93
+0, 221, 221, 1, 38016, 0x90d4fe93
+0, 222, 222, 1, 38016, 0x3477fb4e
+0, 223, 223, 1, 38016, 0xd410fa81
+0, 224, 224, 1, 38016, 0xfc230675
+0, 225, 225, 1, 38016, 0xbda40c03
+0, 226, 226, 1, 38016, 0x7a47fc07
+0, 227, 227, 1, 38016, 0x53fe2a37
+0, 228, 228, 1, 38016, 0x342d3bec
+0, 229, 229, 1, 38016, 0xf13163a3
+0, 230, 230, 1, 38016, 0x03f087da
+0, 231, 231, 1, 38016, 0xbc03c466
+0, 232, 232, 1, 38016, 0x6318d676
+0, 233, 233, 1, 38016, 0xbc2f0b68
+0, 234, 234, 1, 38016, 0xcb57354b
+0, 235, 235, 1, 38016, 0x7e9a5b48
+0, 236, 236, 1, 38016, 0x9dca693a
+0, 237, 237, 1, 38016, 0xd0776497
+0, 238, 238, 1, 38016, 0x05a24093
+0, 239, 239, 1, 38016, 0x69b21063
+0, 240, 240, 1, 38016, 0x15f3ed8b
+0, 241, 241, 1, 38016, 0x2417bc52
+0, 242, 242, 1, 38016, 0xabc2a564
+0, 243, 243, 1, 38016, 0x67f2dd90
+0, 244, 244, 1, 38016, 0xa5fe4b6e
+0, 245, 245, 1, 38016, 0x7801add2
+0, 246, 246, 1, 38016, 0xf4abc321
+0, 247, 247, 1, 38016, 0x1d06a837
+0, 248, 248, 1, 38016, 0x2e0d6fc2
+0, 249, 249, 1, 38016, 0xc4f30535
+0, 250, 250, 1, 38016, 0x67d09a80
+0, 251, 251, 1, 38016, 0xca505a1e
+0, 252, 252, 1, 38016, 0x2e2e56c8
+0, 253, 253, 1, 38016, 0x689ea3e2
+0, 254, 254, 1, 38016, 0x9989165a
+0, 255, 255, 1, 38016, 0xd8e2c30e
+0, 256, 256, 1, 38016, 0x2a98bf3f
+0, 257, 257, 1, 38016, 0x44664d3e
+0, 258, 258, 1, 38016, 0x53a939de
+0, 259, 259, 1, 38016, 0x4c153702
+0, 260, 260, 1, 38016, 0x03c73e88
+0, 261, 261, 1, 38016, 0x7cd649d4
+0, 262, 262, 1, 38016, 0x7d7c5687
+0, 263, 263, 1, 38016, 0x8f3c53a6
+0, 264, 264, 1, 38016, 0x24634dd1
+0, 265, 265, 1, 38016, 0x5d00442c
+0, 266, 266, 1, 38016, 0xdcc72906
+0, 267, 267, 1, 38016, 0x5def12f3
+0, 268, 268, 1, 38016, 0x95e6e8be
+0, 269, 269, 1, 38016, 0x2675c694
+0, 270, 270, 1, 38016, 0x906aa24e
+0, 271, 271, 1, 38016, 0x09468fe4
+0, 272, 272, 1, 38016, 0xaec9736d
+0, 273, 273, 1, 38016, 0xa5812142
+0, 274, 274, 1, 38016, 0x9986d55f
+0, 275, 275, 1, 38016, 0x9f7fc399
+0, 276, 276, 1, 38016, 0xc345d526
+0, 277, 277, 1, 38016, 0x3ae3b9bd
+0, 278, 278, 1, 38016, 0xb103ec45
+0, 279, 279, 1, 38016, 0x3ff462c2
+0, 280, 280, 1, 38016, 0x5c07ed68
+0, 281, 281, 1, 38016, 0xccbad189
+0, 282, 282, 1, 38016, 0x6f3f9a18
+0, 283, 283, 1, 38016, 0x26406fa1
+0, 284, 284, 1, 38016, 0x06cf5f62
+0, 285, 285, 1, 38016, 0x3eb29bd1
+0, 286, 286, 1, 38016, 0x12ab807e
+0, 287, 287, 1, 38016, 0x7621bf0d
+0, 288, 288, 1, 38016, 0x88eabc0c
+0, 289, 289, 1, 38016, 0x21386662
+0, 290, 290, 1, 38016, 0x5839e3e4
+0, 291, 291, 1, 38016, 0xd196ee7c
+0, 292, 292, 1, 38016, 0x84dc8477
+0, 293, 293, 1, 38016, 0xbf2dcc7a
+0, 294, 294, 1, 38016, 0x29e3fe96
+0, 295, 295, 1, 38016, 0xf115ffc3
+0, 296, 296, 1, 38016, 0x7585d699
+0, 297, 297, 1, 38016, 0x7a7dcb8a
+0, 298, 298, 1, 38016, 0x03cfdb04
+0, 299, 299, 1, 38016, 0xd56e028c
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-canl2_sony_e b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-canl2_sony_e
index 327e925..9a3b48f 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-canl2_sony_e
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-canl2_sony_e
@@ -1,300 +1,301 @@
-0, 0, 38016, 0xc805351d
-0, 3600, 38016, 0x3017107e
-0, 7200, 38016, 0xe172e2d2
-0, 10800, 38016, 0x7fefbb5b
-0, 14400, 38016, 0x331097e6
-0, 18000, 38016, 0x47de825a
-0, 21600, 38016, 0x0bf36d87
-0, 25200, 38016, 0x03ae60c5
-0, 28800, 38016, 0x986b5930
-0, 32400, 38016, 0x398b6450
-0, 36000, 38016, 0x8e1b77e7
-0, 39600, 38016, 0xefb198a6
-0, 43200, 38016, 0x395aa9ee
-0, 46800, 38016, 0x1918b963
-0, 50400, 38016, 0xe6cab421
-0, 54000, 38016, 0x96929e05
-0, 57600, 38016, 0xf076abc7
-0, 61200, 38016, 0xd0f4ab70
-0, 64800, 38016, 0x7a39a75c
-0, 68400, 38016, 0xb04f8bad
-0, 72000, 38016, 0xe4996ff5
-0, 75600, 38016, 0x096e549a
-0, 79200, 38016, 0x36d73f1a
-0, 82800, 38016, 0x25f53bbf
-0, 86400, 38016, 0x7ebd3f9f
-0, 90000, 38016, 0x464c4b4c
-0, 93600, 38016, 0x2d794a40
-0, 97200, 38016, 0x1599532d
-0, 100800, 38016, 0xf8326999
-0, 104400, 38016, 0x858e789b
-0, 108000, 38016, 0x006f63cc
-0, 111600, 38016, 0x488a9614
-0, 115200, 38016, 0x950fb7cc
-0, 118800, 38016, 0x6deac9dd
-0, 122400, 38016, 0x0a82d725
-0, 126000, 38016, 0x2702d5fe
-0, 129600, 38016, 0xf7ead782
-0, 133200, 38016, 0x560fd1f1
-0, 136800, 38016, 0xa3cdd31a
-0, 140400, 38016, 0xa19ed45c
-0, 144000, 38016, 0x8d85d757
-0, 147600, 38016, 0x7fa6e1b5
-0, 151200, 38016, 0x8a31db0e
-0, 154800, 38016, 0x9dead6ff
-0, 158400, 38016, 0x8a8adf44
-0, 162000, 38016, 0xd1548835
-0, 165600, 38016, 0xf696a62c
-0, 169200, 38016, 0x5edbb219
-0, 172800, 38016, 0x0d9db749
-0, 176400, 38016, 0xc109c379
-0, 180000, 38016, 0xe814c2b1
-0, 183600, 38016, 0x4a8dc84b
-0, 187200, 38016, 0x6bcac28c
-0, 190800, 38016, 0xa37ec8da
-0, 194400, 38016, 0x3202d5e9
-0, 198000, 38016, 0x3d65ddb6
-0, 201600, 38016, 0x165de082
-0, 205200, 38016, 0x5702e231
-0, 208800, 38016, 0x034fe8f4
-0, 212400, 38016, 0x96f0ea58
-0, 216000, 38016, 0x65539ad7
-0, 219600, 38016, 0xdf98a7cf
-0, 223200, 38016, 0xda007de0
-0, 226800, 38016, 0xdf43520e
-0, 230400, 38016, 0xc5d553d2
-0, 234000, 38016, 0xc3327450
-0, 237600, 38016, 0x81c4a2e0
-0, 241200, 38016, 0x7c56e2d1
-0, 244800, 38016, 0x813f20a4
-0, 248400, 38016, 0xe48257ad
-0, 252000, 38016, 0x261b812f
-0, 255600, 38016, 0x8836ae43
-0, 259200, 38016, 0x4c52e30f
-0, 262800, 38016, 0x0614245f
-0, 266400, 38016, 0xbf275e2e
-0, 270000, 38016, 0x2f0f3e49
-0, 273600, 38016, 0xfaf57eb1
-0, 277200, 38016, 0xd1b49f95
-0, 280800, 38016, 0x10f4c2f6
-0, 284400, 38016, 0x2322d359
-0, 288000, 38016, 0x994de596
-0, 291600, 38016, 0x2a0df115
-0, 295200, 38016, 0xfcb7f1ec
-0, 298800, 38016, 0xcbc2ee10
-0, 302400, 38016, 0x49f5ee5c
-0, 306000, 38016, 0x4eb9f286
-0, 309600, 38016, 0xe5d80039
-0, 313200, 38016, 0xfa57fa81
-0, 316800, 38016, 0x2bea01f7
-0, 320400, 38016, 0x4e7c07a0
-0, 324000, 38016, 0x43b6a0f7
-0, 327600, 38016, 0x996e93cc
-0, 331200, 38016, 0x8e5c8a40
-0, 334800, 38016, 0x15cc7fe7
-0, 338400, 38016, 0x7f0a6c35
-0, 342000, 38016, 0x031677a4
-0, 345600, 38016, 0x14dd8b6d
-0, 349200, 38016, 0x143ca592
-0, 352800, 38016, 0x8e56b262
-0, 356400, 38016, 0x01c7c2b9
-0, 360000, 38016, 0xc117cbfa
-0, 363600, 38016, 0x609bbe4b
-0, 367200, 38016, 0x9a9fad05
-0, 370800, 38016, 0xba959d79
-0, 374400, 38016, 0x8773c00e
-0, 378000, 38016, 0xea22a35b
-0, 381600, 38016, 0x4b76c5fa
-0, 385200, 38016, 0x5088e610
-0, 388800, 38016, 0xb6db1234
-0, 392400, 38016, 0xef631cf7
-0, 396000, 38016, 0x7d993030
-0, 399600, 38016, 0xa9b24013
-0, 403200, 38016, 0xc3a14055
-0, 406800, 38016, 0x5e7e2b4c
-0, 410400, 38016, 0xae3505e0
-0, 414000, 38016, 0x48880369
-0, 417600, 38016, 0x844e1316
-0, 421200, 38016, 0x1d501951
-0, 424800, 38016, 0x36ae2e34
-0, 428400, 38016, 0xe48b385f
-0, 432000, 38016, 0xd88d3691
-0, 435600, 38016, 0xf38f3ad4
-0, 439200, 38016, 0x2a0e256e
-0, 442800, 38016, 0x0c25fbbd
-0, 446400, 38016, 0x13dbd8fc
-0, 450000, 38016, 0x8c4dc0b1
-0, 453600, 38016, 0x054bb5d5
-0, 457200, 38016, 0x19f8c259
-0, 460800, 38016, 0x4037d8fd
-0, 464400, 38016, 0x13f4ecda
-0, 468000, 38016, 0xde8af5a1
-0, 471600, 38016, 0x5997f541
-0, 475200, 38016, 0x876bebfe
-0, 478800, 38016, 0x7322ef36
-0, 482400, 38016, 0xe6a7ecc3
-0, 486000, 38016, 0x20e5a1eb
-0, 489600, 38016, 0xd1e5b985
-0, 493200, 38016, 0xe83cb437
-0, 496800, 38016, 0x8928a6f2
-0, 500400, 38016, 0xc6b1a7f4
-0, 504000, 38016, 0xcaf79531
-0, 507600, 38016, 0x3ded956e
-0, 511200, 38016, 0x494b82c5
-0, 514800, 38016, 0x86cb794a
-0, 518400, 38016, 0x548687e6
-0, 522000, 38016, 0x8f478a9f
-0, 525600, 38016, 0x32a97cbb
-0, 529200, 38016, 0x587b56cf
-0, 532800, 38016, 0x933428a9
-0, 536400, 38016, 0xcb610212
-0, 540000, 38016, 0x0d27b12d
-0, 543600, 38016, 0xf5a9b7e0
-0, 547200, 38016, 0x5287bdb7
-0, 550800, 38016, 0xa4e9b762
-0, 554400, 38016, 0x289da6d8
-0, 558000, 38016, 0x1969bb3e
-0, 561600, 38016, 0x29cbe019
-0, 565200, 38016, 0xe01403c6
-0, 568800, 38016, 0xce003f90
-0, 572400, 38016, 0x455d67e1
-0, 576000, 38016, 0xb57f7724
-0, 579600, 38016, 0x7fce73b9
-0, 583200, 38016, 0x7f136bbe
-0, 586800, 38016, 0xf096599f
-0, 590400, 38016, 0xe6df4c3a
-0, 594000, 38016, 0x98d2f70e
-0, 597600, 38016, 0xb500f2d7
-0, 601200, 38016, 0x95d3ce30
-0, 604800, 38016, 0x02a9ae41
-0, 608400, 38016, 0xb146a958
-0, 612000, 38016, 0x86a0bf3d
-0, 615600, 38016, 0x0c58d90a
-0, 619200, 38016, 0x27aef37f
-0, 622800, 38016, 0x3933fc3e
-0, 626400, 38016, 0x9ce9dc1c
-0, 630000, 38016, 0x3161ac45
-0, 633600, 38016, 0x4e8174cd
-0, 637200, 38016, 0xd8904d4b
-0, 640800, 38016, 0x933c2a55
-0, 644400, 38016, 0x85371555
-0, 648000, 38016, 0x3bb3ecd3
-0, 651600, 38016, 0x6b6ad873
-0, 655200, 38016, 0xa04dcf64
-0, 658800, 38016, 0x7869dc82
-0, 662400, 38016, 0x1c11e371
-0, 666000, 38016, 0x91eef557
-0, 669600, 38016, 0x27a30e42
-0, 673200, 38016, 0xcba73491
-0, 676800, 38016, 0xdffc402e
-0, 680400, 38016, 0x49b543c6
-0, 684000, 38016, 0xe3f7f438
-0, 687600, 38016, 0xed3ec663
-0, 691200, 38016, 0x174ad199
-0, 694800, 38016, 0x5330eef8
-0, 698400, 38016, 0x19d9074b
-0, 702000, 38016, 0x25961ad1
-0, 705600, 38016, 0x63024e80
-0, 709200, 38016, 0x25de6e2e
-0, 712800, 38016, 0x4cc594e8
-0, 716400, 38016, 0x8b25afcf
-0, 720000, 38016, 0x7b29bfcf
-0, 723600, 38016, 0x93abce16
-0, 727200, 38016, 0xc7f1d8fb
-0, 730800, 38016, 0x277ed79e
-0, 734400, 38016, 0x30dbdfe4
-0, 738000, 38016, 0xbd8be711
-0, 741600, 38016, 0xf072ea62
-0, 745200, 38016, 0xbfd0e5a5
-0, 748800, 38016, 0xedffdb3d
-0, 752400, 38016, 0x5238cb59
-0, 756000, 38016, 0x39305ec1
-0, 759600, 38016, 0x07816d20
-0, 763200, 38016, 0x61416e5b
-0, 766800, 38016, 0xc39d6ae2
-0, 770400, 38016, 0x1de95fe1
-0, 774000, 38016, 0x0530552f
-0, 777600, 38016, 0xa48f5b19
-0, 781200, 38016, 0x11305e31
-0, 784800, 38016, 0x9ae25bda
-0, 788400, 38016, 0xf16e5b67
-0, 792000, 38016, 0x9a375284
-0, 795600, 38016, 0x5a744019
-0, 799200, 38016, 0x811631e5
-0, 802800, 38016, 0x178a20e6
-0, 806400, 38016, 0xcab02bf2
-0, 810000, 38016, 0x6fca13cb
-0, 813600, 38016, 0xa1a71ba8
-0, 817200, 38016, 0x95f52de5
-0, 820800, 38016, 0xd2744451
-0, 824400, 38016, 0x717f6ef6
-0, 828000, 38016, 0x1f9e8ca9
-0, 831600, 38016, 0xc931b115
-0, 835200, 38016, 0xa4c1db05
-0, 838800, 38016, 0x92e80cc1
-0, 842400, 38016, 0x5ac5276c
-0, 846000, 38016, 0x624340ca
-0, 849600, 38016, 0x774a5a7c
-0, 853200, 38016, 0x1da55863
-0, 856800, 38016, 0x1bbc3b98
-0, 860400, 38016, 0x953b1479
-0, 864000, 38016, 0x8b11e5a8
-0, 867600, 38016, 0xf749d359
-0, 871200, 38016, 0xb54fcb8a
-0, 874800, 38016, 0xb64b1951
-0, 878400, 38016, 0x99778550
-0, 882000, 38016, 0x5e70e9e2
-0, 885600, 38016, 0x22550b80
-0, 889200, 38016, 0xfe3ddcde
-0, 892800, 38016, 0x1e28989e
-0, 896400, 38016, 0x25b926a4
-0, 900000, 38016, 0xf2c3c536
-0, 903600, 38016, 0x534a8643
-0, 907200, 38016, 0xf44b7f07
-0, 910800, 38016, 0x2873c895
-0, 914400, 38016, 0x67a7388d
-0, 918000, 38016, 0x0e5eca3b
-0, 921600, 38016, 0xc50dc747
-0, 925200, 38016, 0x6a3a4f1e
-0, 928800, 38016, 0x77d83b5f
-0, 932400, 38016, 0x91213d43
-0, 936000, 38016, 0x28344889
-0, 939600, 38016, 0xd1155a3f
-0, 943200, 38016, 0x5c7a65c5
-0, 946800, 38016, 0x3d4e7104
-0, 950400, 38016, 0x91d96a37
-0, 954000, 38016, 0xbc7f63f3
-0, 957600, 38016, 0x79275184
-0, 961200, 38016, 0xa6b43348
-0, 964800, 38016, 0x9e1d105a
-0, 968400, 38016, 0x14bce053
-0, 972000, 38016, 0x0ce3a7ca
-0, 975600, 38016, 0x4b5980fe
-0, 979200, 38016, 0x32745e1c
-0, 982800, 38016, 0x85b91358
-0, 986400, 38016, 0x9e26c66c
-0, 990000, 38016, 0x9735b157
-0, 993600, 38016, 0xfeaac3d1
-0, 997200, 38016, 0x8c95ca9f
-0, 1000800, 38016, 0x1336fa92
-0, 1004400, 38016, 0x37bb65f8
-0, 1008000, 38016, 0x830c078a
-0, 1011600, 38016, 0x088dd912
-0, 1015200, 38016, 0x8ef1a5a0
-0, 1018800, 38016, 0x9a1e642d
-0, 1022400, 38016, 0xa165517e
-0, 1026000, 38016, 0x0a34a67f
-0, 1029600, 38016, 0xaf0a662a
-0, 1033200, 38016, 0x3a5fa553
-0, 1036800, 38016, 0xda92b1f8
-0, 1040400, 38016, 0xac2997f4
-0, 1044000, 38016, 0x5df32cfc
-0, 1047600, 38016, 0x5cea491d
-0, 1051200, 38016, 0xeafbd139
-0, 1054800, 38016, 0x9ced0e69
-0, 1058400, 38016, 0x89514e3f
-0, 1062000, 38016, 0x3f0b4842
-0, 1065600, 38016, 0xc9902325
-0, 1069200, 38016, 0xdb3e1585
-0, 1072800, 38016, 0x3cf31e95
-0, 1076400, 38016, 0x60f14679
+#tb 0: 1/25
+0, 0, 0, 1, 38016, 0xc805351d
+0, 1, 1, 1, 38016, 0x3017107e
+0, 2, 2, 1, 38016, 0xe172e2d2
+0, 3, 3, 1, 38016, 0x7fefbb5b
+0, 4, 4, 1, 38016, 0x331097e6
+0, 5, 5, 1, 38016, 0x47de825a
+0, 6, 6, 1, 38016, 0x0bf36d87
+0, 7, 7, 1, 38016, 0x03ae60c5
+0, 8, 8, 1, 38016, 0x986b5930
+0, 9, 9, 1, 38016, 0x398b6450
+0, 10, 10, 1, 38016, 0x8e1b77e7
+0, 11, 11, 1, 38016, 0xefb198a6
+0, 12, 12, 1, 38016, 0x395aa9ee
+0, 13, 13, 1, 38016, 0x1918b963
+0, 14, 14, 1, 38016, 0xe6cab421
+0, 15, 15, 1, 38016, 0x96929e05
+0, 16, 16, 1, 38016, 0xf076abc7
+0, 17, 17, 1, 38016, 0xd0f4ab70
+0, 18, 18, 1, 38016, 0x7a39a75c
+0, 19, 19, 1, 38016, 0xb04f8bad
+0, 20, 20, 1, 38016, 0xe4996ff5
+0, 21, 21, 1, 38016, 0x096e549a
+0, 22, 22, 1, 38016, 0x36d73f1a
+0, 23, 23, 1, 38016, 0x25f53bbf
+0, 24, 24, 1, 38016, 0x7ebd3f9f
+0, 25, 25, 1, 38016, 0x464c4b4c
+0, 26, 26, 1, 38016, 0x2d794a40
+0, 27, 27, 1, 38016, 0x1599532d
+0, 28, 28, 1, 38016, 0xf8326999
+0, 29, 29, 1, 38016, 0x858e789b
+0, 30, 30, 1, 38016, 0x006f63cc
+0, 31, 31, 1, 38016, 0x488a9614
+0, 32, 32, 1, 38016, 0x950fb7cc
+0, 33, 33, 1, 38016, 0x6deac9dd
+0, 34, 34, 1, 38016, 0x0a82d725
+0, 35, 35, 1, 38016, 0x2702d5fe
+0, 36, 36, 1, 38016, 0xf7ead782
+0, 37, 37, 1, 38016, 0x560fd1f1
+0, 38, 38, 1, 38016, 0xa3cdd31a
+0, 39, 39, 1, 38016, 0xa19ed45c
+0, 40, 40, 1, 38016, 0x8d85d757
+0, 41, 41, 1, 38016, 0x7fa6e1b5
+0, 42, 42, 1, 38016, 0x8a31db0e
+0, 43, 43, 1, 38016, 0x9dead6ff
+0, 44, 44, 1, 38016, 0x8a8adf44
+0, 45, 45, 1, 38016, 0xd1548835
+0, 46, 46, 1, 38016, 0xf696a62c
+0, 47, 47, 1, 38016, 0x5edbb219
+0, 48, 48, 1, 38016, 0x0d9db749
+0, 49, 49, 1, 38016, 0xc109c379
+0, 50, 50, 1, 38016, 0xe814c2b1
+0, 51, 51, 1, 38016, 0x4a8dc84b
+0, 52, 52, 1, 38016, 0x6bcac28c
+0, 53, 53, 1, 38016, 0xa37ec8da
+0, 54, 54, 1, 38016, 0x3202d5e9
+0, 55, 55, 1, 38016, 0x3d65ddb6
+0, 56, 56, 1, 38016, 0x165de082
+0, 57, 57, 1, 38016, 0x5702e231
+0, 58, 58, 1, 38016, 0x034fe8f4
+0, 59, 59, 1, 38016, 0x96f0ea58
+0, 60, 60, 1, 38016, 0x65539ad7
+0, 61, 61, 1, 38016, 0xdf98a7cf
+0, 62, 62, 1, 38016, 0xda007de0
+0, 63, 63, 1, 38016, 0xdf43520e
+0, 64, 64, 1, 38016, 0xc5d553d2
+0, 65, 65, 1, 38016, 0xc3327450
+0, 66, 66, 1, 38016, 0x81c4a2e0
+0, 67, 67, 1, 38016, 0x7c56e2d1
+0, 68, 68, 1, 38016, 0x813f20a4
+0, 69, 69, 1, 38016, 0xe48257ad
+0, 70, 70, 1, 38016, 0x261b812f
+0, 71, 71, 1, 38016, 0x8836ae43
+0, 72, 72, 1, 38016, 0x4c52e30f
+0, 73, 73, 1, 38016, 0x0614245f
+0, 74, 74, 1, 38016, 0xbf275e2e
+0, 75, 75, 1, 38016, 0x2f0f3e49
+0, 76, 76, 1, 38016, 0xfaf57eb1
+0, 77, 77, 1, 38016, 0xd1b49f95
+0, 78, 78, 1, 38016, 0x10f4c2f6
+0, 79, 79, 1, 38016, 0x2322d359
+0, 80, 80, 1, 38016, 0x994de596
+0, 81, 81, 1, 38016, 0x2a0df115
+0, 82, 82, 1, 38016, 0xfcb7f1ec
+0, 83, 83, 1, 38016, 0xcbc2ee10
+0, 84, 84, 1, 38016, 0x49f5ee5c
+0, 85, 85, 1, 38016, 0x4eb9f286
+0, 86, 86, 1, 38016, 0xe5d80039
+0, 87, 87, 1, 38016, 0xfa57fa81
+0, 88, 88, 1, 38016, 0x2bea01f7
+0, 89, 89, 1, 38016, 0x4e7c07a0
+0, 90, 90, 1, 38016, 0x43b6a0f7
+0, 91, 91, 1, 38016, 0x996e93cc
+0, 92, 92, 1, 38016, 0x8e5c8a40
+0, 93, 93, 1, 38016, 0x15cc7fe7
+0, 94, 94, 1, 38016, 0x7f0a6c35
+0, 95, 95, 1, 38016, 0x031677a4
+0, 96, 96, 1, 38016, 0x14dd8b6d
+0, 97, 97, 1, 38016, 0x143ca592
+0, 98, 98, 1, 38016, 0x8e56b262
+0, 99, 99, 1, 38016, 0x01c7c2b9
+0, 100, 100, 1, 38016, 0xc117cbfa
+0, 101, 101, 1, 38016, 0x609bbe4b
+0, 102, 102, 1, 38016, 0x9a9fad05
+0, 103, 103, 1, 38016, 0xba959d79
+0, 104, 104, 1, 38016, 0x8773c00e
+0, 105, 105, 1, 38016, 0xea22a35b
+0, 106, 106, 1, 38016, 0x4b76c5fa
+0, 107, 107, 1, 38016, 0x5088e610
+0, 108, 108, 1, 38016, 0xb6db1234
+0, 109, 109, 1, 38016, 0xef631cf7
+0, 110, 110, 1, 38016, 0x7d993030
+0, 111, 111, 1, 38016, 0xa9b24013
+0, 112, 112, 1, 38016, 0xc3a14055
+0, 113, 113, 1, 38016, 0x5e7e2b4c
+0, 114, 114, 1, 38016, 0xae3505e0
+0, 115, 115, 1, 38016, 0x48880369
+0, 116, 116, 1, 38016, 0x844e1316
+0, 117, 117, 1, 38016, 0x1d501951
+0, 118, 118, 1, 38016, 0x36ae2e34
+0, 119, 119, 1, 38016, 0xe48b385f
+0, 120, 120, 1, 38016, 0xd88d3691
+0, 121, 121, 1, 38016, 0xf38f3ad4
+0, 122, 122, 1, 38016, 0x2a0e256e
+0, 123, 123, 1, 38016, 0x0c25fbbd
+0, 124, 124, 1, 38016, 0x13dbd8fc
+0, 125, 125, 1, 38016, 0x8c4dc0b1
+0, 126, 126, 1, 38016, 0x054bb5d5
+0, 127, 127, 1, 38016, 0x19f8c259
+0, 128, 128, 1, 38016, 0x4037d8fd
+0, 129, 129, 1, 38016, 0x13f4ecda
+0, 130, 130, 1, 38016, 0xde8af5a1
+0, 131, 131, 1, 38016, 0x5997f541
+0, 132, 132, 1, 38016, 0x876bebfe
+0, 133, 133, 1, 38016, 0x7322ef36
+0, 134, 134, 1, 38016, 0xe6a7ecc3
+0, 135, 135, 1, 38016, 0x20e5a1eb
+0, 136, 136, 1, 38016, 0xd1e5b985
+0, 137, 137, 1, 38016, 0xe83cb437
+0, 138, 138, 1, 38016, 0x8928a6f2
+0, 139, 139, 1, 38016, 0xc6b1a7f4
+0, 140, 140, 1, 38016, 0xcaf79531
+0, 141, 141, 1, 38016, 0x3ded956e
+0, 142, 142, 1, 38016, 0x494b82c5
+0, 143, 143, 1, 38016, 0x86cb794a
+0, 144, 144, 1, 38016, 0x548687e6
+0, 145, 145, 1, 38016, 0x8f478a9f
+0, 146, 146, 1, 38016, 0x32a97cbb
+0, 147, 147, 1, 38016, 0x587b56cf
+0, 148, 148, 1, 38016, 0x933428a9
+0, 149, 149, 1, 38016, 0xcb610212
+0, 150, 150, 1, 38016, 0x0d27b12d
+0, 151, 151, 1, 38016, 0xf5a9b7e0
+0, 152, 152, 1, 38016, 0x5287bdb7
+0, 153, 153, 1, 38016, 0xa4e9b762
+0, 154, 154, 1, 38016, 0x289da6d8
+0, 155, 155, 1, 38016, 0x1969bb3e
+0, 156, 156, 1, 38016, 0x29cbe019
+0, 157, 157, 1, 38016, 0xe01403c6
+0, 158, 158, 1, 38016, 0xce003f90
+0, 159, 159, 1, 38016, 0x455d67e1
+0, 160, 160, 1, 38016, 0xb57f7724
+0, 161, 161, 1, 38016, 0x7fce73b9
+0, 162, 162, 1, 38016, 0x7f136bbe
+0, 163, 163, 1, 38016, 0xf096599f
+0, 164, 164, 1, 38016, 0xe6df4c3a
+0, 165, 165, 1, 38016, 0x98d2f70e
+0, 166, 166, 1, 38016, 0xb500f2d7
+0, 167, 167, 1, 38016, 0x95d3ce30
+0, 168, 168, 1, 38016, 0x02a9ae41
+0, 169, 169, 1, 38016, 0xb146a958
+0, 170, 170, 1, 38016, 0x86a0bf3d
+0, 171, 171, 1, 38016, 0x0c58d90a
+0, 172, 172, 1, 38016, 0x27aef37f
+0, 173, 173, 1, 38016, 0x3933fc3e
+0, 174, 174, 1, 38016, 0x9ce9dc1c
+0, 175, 175, 1, 38016, 0x3161ac45
+0, 176, 176, 1, 38016, 0x4e8174cd
+0, 177, 177, 1, 38016, 0xd8904d4b
+0, 178, 178, 1, 38016, 0x933c2a55
+0, 179, 179, 1, 38016, 0x85371555
+0, 180, 180, 1, 38016, 0x3bb3ecd3
+0, 181, 181, 1, 38016, 0x6b6ad873
+0, 182, 182, 1, 38016, 0xa04dcf64
+0, 183, 183, 1, 38016, 0x7869dc82
+0, 184, 184, 1, 38016, 0x1c11e371
+0, 185, 185, 1, 38016, 0x91eef557
+0, 186, 186, 1, 38016, 0x27a30e42
+0, 187, 187, 1, 38016, 0xcba73491
+0, 188, 188, 1, 38016, 0xdffc402e
+0, 189, 189, 1, 38016, 0x49b543c6
+0, 190, 190, 1, 38016, 0xe3f7f438
+0, 191, 191, 1, 38016, 0xed3ec663
+0, 192, 192, 1, 38016, 0x174ad199
+0, 193, 193, 1, 38016, 0x5330eef8
+0, 194, 194, 1, 38016, 0x19d9074b
+0, 195, 195, 1, 38016, 0x25961ad1
+0, 196, 196, 1, 38016, 0x63024e80
+0, 197, 197, 1, 38016, 0x25de6e2e
+0, 198, 198, 1, 38016, 0x4cc594e8
+0, 199, 199, 1, 38016, 0x8b25afcf
+0, 200, 200, 1, 38016, 0x7b29bfcf
+0, 201, 201, 1, 38016, 0x93abce16
+0, 202, 202, 1, 38016, 0xc7f1d8fb
+0, 203, 203, 1, 38016, 0x277ed79e
+0, 204, 204, 1, 38016, 0x30dbdfe4
+0, 205, 205, 1, 38016, 0xbd8be711
+0, 206, 206, 1, 38016, 0xf072ea62
+0, 207, 207, 1, 38016, 0xbfd0e5a5
+0, 208, 208, 1, 38016, 0xedffdb3d
+0, 209, 209, 1, 38016, 0x5238cb59
+0, 210, 210, 1, 38016, 0x39305ec1
+0, 211, 211, 1, 38016, 0x07816d20
+0, 212, 212, 1, 38016, 0x61416e5b
+0, 213, 213, 1, 38016, 0xc39d6ae2
+0, 214, 214, 1, 38016, 0x1de95fe1
+0, 215, 215, 1, 38016, 0x0530552f
+0, 216, 216, 1, 38016, 0xa48f5b19
+0, 217, 217, 1, 38016, 0x11305e31
+0, 218, 218, 1, 38016, 0x9ae25bda
+0, 219, 219, 1, 38016, 0xf16e5b67
+0, 220, 220, 1, 38016, 0x9a375284
+0, 221, 221, 1, 38016, 0x5a744019
+0, 222, 222, 1, 38016, 0x811631e5
+0, 223, 223, 1, 38016, 0x178a20e6
+0, 224, 224, 1, 38016, 0xcab02bf2
+0, 225, 225, 1, 38016, 0x6fca13cb
+0, 226, 226, 1, 38016, 0xa1a71ba8
+0, 227, 227, 1, 38016, 0x95f52de5
+0, 228, 228, 1, 38016, 0xd2744451
+0, 229, 229, 1, 38016, 0x717f6ef6
+0, 230, 230, 1, 38016, 0x1f9e8ca9
+0, 231, 231, 1, 38016, 0xc931b115
+0, 232, 232, 1, 38016, 0xa4c1db05
+0, 233, 233, 1, 38016, 0x92e80cc1
+0, 234, 234, 1, 38016, 0x5ac5276c
+0, 235, 235, 1, 38016, 0x624340ca
+0, 236, 236, 1, 38016, 0x774a5a7c
+0, 237, 237, 1, 38016, 0x1da55863
+0, 238, 238, 1, 38016, 0x1bbc3b98
+0, 239, 239, 1, 38016, 0x953b1479
+0, 240, 240, 1, 38016, 0x8b11e5a8
+0, 241, 241, 1, 38016, 0xf749d359
+0, 242, 242, 1, 38016, 0xb54fcb8a
+0, 243, 243, 1, 38016, 0xb64b1951
+0, 244, 244, 1, 38016, 0x99778550
+0, 245, 245, 1, 38016, 0x5e70e9e2
+0, 246, 246, 1, 38016, 0x22550b80
+0, 247, 247, 1, 38016, 0xfe3ddcde
+0, 248, 248, 1, 38016, 0x1e28989e
+0, 249, 249, 1, 38016, 0x25b926a4
+0, 250, 250, 1, 38016, 0xf2c3c536
+0, 251, 251, 1, 38016, 0x534a8643
+0, 252, 252, 1, 38016, 0xf44b7f07
+0, 253, 253, 1, 38016, 0x2873c895
+0, 254, 254, 1, 38016, 0x67a7388d
+0, 255, 255, 1, 38016, 0x0e5eca3b
+0, 256, 256, 1, 38016, 0xc50dc747
+0, 257, 257, 1, 38016, 0x6a3a4f1e
+0, 258, 258, 1, 38016, 0x77d83b5f
+0, 259, 259, 1, 38016, 0x91213d43
+0, 260, 260, 1, 38016, 0x28344889
+0, 261, 261, 1, 38016, 0xd1155a3f
+0, 262, 262, 1, 38016, 0x5c7a65c5
+0, 263, 263, 1, 38016, 0x3d4e7104
+0, 264, 264, 1, 38016, 0x91d96a37
+0, 265, 265, 1, 38016, 0xbc7f63f3
+0, 266, 266, 1, 38016, 0x79275184
+0, 267, 267, 1, 38016, 0xa6b43348
+0, 268, 268, 1, 38016, 0x9e1d105a
+0, 269, 269, 1, 38016, 0x14bce053
+0, 270, 270, 1, 38016, 0x0ce3a7ca
+0, 271, 271, 1, 38016, 0x4b5980fe
+0, 272, 272, 1, 38016, 0x32745e1c
+0, 273, 273, 1, 38016, 0x85b91358
+0, 274, 274, 1, 38016, 0x9e26c66c
+0, 275, 275, 1, 38016, 0x9735b157
+0, 276, 276, 1, 38016, 0xfeaac3d1
+0, 277, 277, 1, 38016, 0x8c95ca9f
+0, 278, 278, 1, 38016, 0x1336fa92
+0, 279, 279, 1, 38016, 0x37bb65f8
+0, 280, 280, 1, 38016, 0x830c078a
+0, 281, 281, 1, 38016, 0x088dd912
+0, 282, 282, 1, 38016, 0x8ef1a5a0
+0, 283, 283, 1, 38016, 0x9a1e642d
+0, 284, 284, 1, 38016, 0xa165517e
+0, 285, 285, 1, 38016, 0x0a34a67f
+0, 286, 286, 1, 38016, 0xaf0a662a
+0, 287, 287, 1, 38016, 0x3a5fa553
+0, 288, 288, 1, 38016, 0xda92b1f8
+0, 289, 289, 1, 38016, 0xac2997f4
+0, 290, 290, 1, 38016, 0x5df32cfc
+0, 291, 291, 1, 38016, 0x5cea491d
+0, 292, 292, 1, 38016, 0xeafbd139
+0, 293, 293, 1, 38016, 0x9ced0e69
+0, 294, 294, 1, 38016, 0x89514e3f
+0, 295, 295, 1, 38016, 0x3f0b4842
+0, 296, 296, 1, 38016, 0xc9902325
+0, 297, 297, 1, 38016, 0xdb3e1585
+0, 298, 298, 1, 38016, 0x3cf31e95
+0, 299, 299, 1, 38016, 0x60f14679
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-canl2_sva_b b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-canl2_sva_b
index 8594553..0436f43 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-canl2_sva_b
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-canl2_sva_b
@@ -1,17 +1,18 @@
-0, 0, 38016, 0x0bd22424
-0, 3600, 38016, 0x4eb601f0
-0, 7200, 38016, 0xe16de459
-0, 10800, 38016, 0xde2e0c37
-0, 14400, 38016, 0x14a0286b
-0, 18000, 38016, 0x37bc35b5
-0, 21600, 38016, 0xcfa24923
-0, 25200, 38016, 0xac755ba0
-0, 28800, 38016, 0x27d1822a
-0, 32400, 38016, 0xa8039548
-0, 36000, 38016, 0x400ea1fb
-0, 39600, 38016, 0x7d2ca44a
-0, 43200, 38016, 0xd42dae4f
-0, 46800, 38016, 0x39ce9599
-0, 50400, 38016, 0x37498aa1
-0, 54000, 38016, 0x8558911f
-0, 57600, 38016, 0x06a8a9ad
+#tb 0: 1/25
+0, 0, 0, 1, 38016, 0x0bd22424
+0, 1, 1, 1, 38016, 0x4eb601f0
+0, 2, 2, 1, 38016, 0xe16de459
+0, 3, 3, 1, 38016, 0xde2e0c37
+0, 4, 4, 1, 38016, 0x14a0286b
+0, 5, 5, 1, 38016, 0x37bc35b5
+0, 6, 6, 1, 38016, 0xcfa24923
+0, 7, 7, 1, 38016, 0xac755ba0
+0, 8, 8, 1, 38016, 0x27d1822a
+0, 9, 9, 1, 38016, 0xa8039548
+0, 10, 10, 1, 38016, 0x400ea1fb
+0, 11, 11, 1, 38016, 0x7d2ca44a
+0, 12, 12, 1, 38016, 0xd42dae4f
+0, 13, 13, 1, 38016, 0x39ce9599
+0, 14, 14, 1, 38016, 0x37498aa1
+0, 15, 15, 1, 38016, 0x8558911f
+0, 16, 16, 1, 38016, 0x06a8a9ad
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-canl3_sony_c b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-canl3_sony_c
index 4d7f0eb..2e726cf 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-canl3_sony_c
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-canl3_sony_c
@@ -1,300 +1,301 @@
-0, 0, 38016, 0xc805351d
-0, 3600, 38016, 0xa0b41fef
-0, 7200, 38016, 0x965cf070
-0, 10800, 38016, 0x4552af45
-0, 14400, 38016, 0x8429a576
-0, 18000, 38016, 0xf6df8fc0
-0, 21600, 38016, 0x5d85554c
-0, 25200, 38016, 0x9c9d5b96
-0, 28800, 38016, 0xbc4a4b71
-0, 32400, 38016, 0xae4d3fc8
-0, 36000, 38016, 0xf4da7f25
-0, 39600, 38016, 0xf7d89a46
-0, 43200, 38016, 0x204977fd
-0, 46800, 38016, 0xa505b626
-0, 50400, 38016, 0xc7b8b3f8
-0, 54000, 38016, 0x96929e05
-0, 57600, 38016, 0xfcfab8cc
-0, 61200, 38016, 0x750caf2d
-0, 64800, 38016, 0xa2c682ca
-0, 68400, 38016, 0x3dcd8f07
-0, 72000, 38016, 0x48fb69b3
-0, 75600, 38016, 0x128e3310
-0, 79200, 38016, 0x03803338
-0, 82800, 38016, 0x11362bda
-0, 86400, 38016, 0xc672229a
-0, 90000, 38016, 0x68e540d0
-0, 93600, 38016, 0x9d3a3deb
-0, 97200, 38016, 0x53b233af
-0, 100800, 38016, 0x3c6767eb
-0, 104400, 38016, 0x2a8d75f2
-0, 108000, 38016, 0x006f63cc
-0, 111600, 38016, 0x3652a79e
-0, 115200, 38016, 0x42f8c0fa
-0, 118800, 38016, 0x052eb292
-0, 122400, 38016, 0xbe7de0e7
-0, 126000, 38016, 0xf9f9d46f
-0, 129600, 38016, 0xb6d9b200
-0, 133200, 38016, 0xc3bcd2d2
-0, 136800, 38016, 0x23b5c8c2
-0, 140400, 38016, 0x67caaf99
-0, 144000, 38016, 0xb365cd31
-0, 147600, 38016, 0x7cabc68f
-0, 151200, 38016, 0xca8bb87a
-0, 154800, 38016, 0x66a4be22
-0, 158400, 38016, 0x2d10c1b0
-0, 162000, 38016, 0xd1548835
-0, 165600, 38016, 0x8b15b359
-0, 169200, 38016, 0x2337b654
-0, 172800, 38016, 0x56cfac2b
-0, 176400, 38016, 0x7ad4c642
-0, 180000, 38016, 0x6666c353
-0, 183600, 38016, 0x053fb0f2
-0, 187200, 38016, 0x2547c115
-0, 190800, 38016, 0xf202c045
-0, 194400, 38016, 0x94a8b95f
-0, 198000, 38016, 0x439ccb13
-0, 201600, 38016, 0xdfe4d54f
-0, 205200, 38016, 0x2a0aceae
-0, 208800, 38016, 0x1293dbd5
-0, 212400, 38016, 0x9a62d994
-0, 216000, 38016, 0x65539ad7
-0, 219600, 38016, 0xc415ad58
-0, 223200, 38016, 0x47bb9417
-0, 226800, 38016, 0x92b745ea
-0, 230400, 38016, 0x8fe8646e
-0, 234000, 38016, 0x2b94857a
-0, 237600, 38016, 0x12ac9aa4
-0, 241200, 38016, 0x856bf0ea
-0, 244800, 38016, 0xdbb32674
-0, 248400, 38016, 0x96b53747
-0, 252000, 38016, 0x875a7548
-0, 255600, 38016, 0xdba4985c
-0, 259200, 38016, 0x47cbb86c
-0, 262800, 38016, 0x32dcfb99
-0, 266400, 38016, 0x18b53b26
-0, 270000, 38016, 0x2f0f3e49
-0, 273600, 38016, 0x27b1880d
-0, 277200, 38016, 0xbcc19dac
-0, 280800, 38016, 0x7b6caeb1
-0, 284400, 38016, 0xf3eece06
-0, 288000, 38016, 0x7d93d4c9
-0, 291600, 38016, 0xe6b8d923
-0, 295200, 38016, 0xf47ce844
-0, 298800, 38016, 0x74fce21c
-0, 302400, 38016, 0x8e87d8cd
-0, 306000, 38016, 0x9675d3ce
-0, 309600, 38016, 0xd797ec75
-0, 313200, 38016, 0x70aeeef1
-0, 316800, 38016, 0x47baef32
-0, 320400, 38016, 0x5054ec56
-0, 324000, 38016, 0x43b6a0f7
-0, 327600, 38016, 0x95dfb688
-0, 331200, 38016, 0xc878a574
-0, 334800, 38016, 0xeb928019
-0, 338400, 38016, 0x304b7fec
-0, 342000, 38016, 0x02cd7ea4
-0, 345600, 38016, 0x505f7a7a
-0, 349200, 38016, 0x09f59eaf
-0, 352800, 38016, 0x513faaf7
-0, 356400, 38016, 0xbd0daaa8
-0, 360000, 38016, 0x8012be0f
-0, 363600, 38016, 0xb663aa15
-0, 367200, 38016, 0xd138981a
-0, 370800, 38016, 0xc16b98a2
-0, 374400, 38016, 0xf43eb8f8
-0, 378000, 38016, 0xea22a35b
-0, 381600, 38016, 0x9a0be0bb
-0, 385200, 38016, 0x2a77ff9d
-0, 388800, 38016, 0x2e350431
-0, 392400, 38016, 0x9d0335ba
-0, 396000, 38016, 0x62f23f21
-0, 399600, 38016, 0x3e973351
-0, 403200, 38016, 0x9d8f4ac5
-0, 406800, 38016, 0x91e132ba
-0, 410400, 38016, 0xfd04f69a
-0, 414000, 38016, 0x481a1778
-0, 417600, 38016, 0x27fa1dc4
-0, 421200, 38016, 0x23ae0a6a
-0, 424800, 38016, 0xc3ec426a
-0, 428400, 38016, 0xc2a54ac1
-0, 432000, 38016, 0xd88d3691
-0, 435600, 38016, 0x46014ba7
-0, 439200, 38016, 0xbf902815
-0, 442800, 38016, 0x2af5ee16
-0, 446400, 38016, 0xd183dc64
-0, 450000, 38016, 0xf0c5bdd8
-0, 453600, 38016, 0xb21aa102
-0, 457200, 38016, 0xb35bbec2
-0, 460800, 38016, 0x7efad1ce
-0, 464400, 38016, 0x04e3d71d
-0, 468000, 38016, 0x901ff71b
-0, 471600, 38016, 0xc6c6e640
-0, 475200, 38016, 0xd292d5d3
-0, 478800, 38016, 0x2ce4e3fe
-0, 482400, 38016, 0xe7fedf8a
-0, 486000, 38016, 0x20e5a1eb
-0, 489600, 38016, 0xbc39be76
-0, 493200, 38016, 0xf749b4dd
-0, 496800, 38016, 0xbc3f97a4
-0, 500400, 38016, 0xa058a244
-0, 504000, 38016, 0x77eb961b
-0, 507600, 38016, 0xa92e7f25
-0, 511200, 38016, 0xc75e796f
-0, 514800, 38016, 0x114c79bd
-0, 518400, 38016, 0x3fb96da3
-0, 522000, 38016, 0x1c6f87b8
-0, 525600, 38016, 0x25567ae4
-0, 529200, 38016, 0xf5dd42b2
-0, 532800, 38016, 0xe6172d0c
-0, 536400, 38016, 0xcec0fd48
-0, 540000, 38016, 0x0d27b12d
-0, 543600, 38016, 0x3ec7cd24
-0, 547200, 38016, 0xb2dccabe
-0, 550800, 38016, 0xa977a844
-0, 554400, 38016, 0x4b3bbfed
-0, 558000, 38016, 0xed6dd876
-0, 561600, 38016, 0x751bd34e
-0, 565200, 38016, 0x80160cf9
-0, 568800, 38016, 0xfbf53be8
-0, 572400, 38016, 0x726e4f3b
-0, 576000, 38016, 0x8ebb730c
-0, 579600, 38016, 0x2c0c5fe6
-0, 583200, 38016, 0x450940c0
-0, 586800, 38016, 0xeed63ff8
-0, 590400, 38016, 0x6f233d75
-0, 594000, 38016, 0x98d2f70e
-0, 597600, 38016, 0x8d38f2e8
-0, 601200, 38016, 0x905dcbc9
-0, 604800, 38016, 0x68c3a0f7
-0, 608400, 38016, 0x4bb8a40c
-0, 612000, 38016, 0x3650b08e
-0, 615600, 38016, 0x3c3bbfd7
-0, 619200, 38016, 0xcbc9da56
-0, 622800, 38016, 0x576de6cd
-0, 626400, 38016, 0x95f5c8c1
-0, 630000, 38016, 0xbbcaacc8
-0, 633600, 38016, 0x1b547ba4
-0, 637200, 38016, 0x8f5238b2
-0, 640800, 38016, 0x4c0f35c4
-0, 644400, 38016, 0x894f278d
-0, 648000, 38016, 0x3bb3ecd3
-0, 651600, 38016, 0x177bf317
-0, 655200, 38016, 0xdb1fdada
-0, 658800, 38016, 0xec27cc28
-0, 662400, 38016, 0x6a12eec7
-0, 666000, 38016, 0x0168ff3f
-0, 669600, 38016, 0x3fa206ba
-0, 673200, 38016, 0x47cc30b5
-0, 676800, 38016, 0xb2d02ddd
-0, 680400, 38016, 0x306626bb
-0, 684000, 38016, 0xfb06eb5b
-0, 687600, 38016, 0x5881b60e
-0, 691200, 38016, 0xd58caaf8
-0, 694800, 38016, 0x840bdd0c
-0, 698400, 38016, 0xb71efac1
-0, 702000, 38016, 0x25961ad1
-0, 705600, 38016, 0xbec156eb
-0, 709200, 38016, 0xe2d1695c
-0, 712800, 38016, 0x3fbe83d4
-0, 716400, 38016, 0x10d8afe2
-0, 720000, 38016, 0xa61fb9aa
-0, 723600, 38016, 0x0c20be29
-0, 727200, 38016, 0xc273cdd4
-0, 730800, 38016, 0xfb21cfa0
-0, 734400, 38016, 0xb1ccc643
-0, 738000, 38016, 0x30f5d7a2
-0, 741600, 38016, 0xe742da0f
-0, 745200, 38016, 0x0a08d6a3
-0, 748800, 38016, 0x85c4cf6c
-0, 752400, 38016, 0xc117b8f4
-0, 756000, 38016, 0x39305ec1
-0, 759600, 38016, 0xf2867b2d
-0, 763200, 38016, 0x81147a22
-0, 766800, 38016, 0x308b59c3
-0, 770400, 38016, 0xfd076bbd
-0, 774000, 38016, 0x11bf57f5
-0, 777600, 38016, 0x8c103fb7
-0, 781200, 38016, 0x4f5e5a48
-0, 784800, 38016, 0xa0fd54dc
-0, 788400, 38016, 0x69d7429b
-0, 792000, 38016, 0x93154a7c
-0, 795600, 38016, 0xc72e3995
-0, 799200, 38016, 0x86541ae0
-0, 802800, 38016, 0xa9c93120
-0, 806400, 38016, 0x602d368a
-0, 810000, 38016, 0x6fca13cb
-0, 813600, 38016, 0x314f3702
-0, 817200, 38016, 0x4d1647bd
-0, 820800, 38016, 0x73673c96
-0, 824400, 38016, 0x62897c6f
-0, 828000, 38016, 0x918e9a7d
-0, 831600, 38016, 0x9fb9ad4f
-0, 835200, 38016, 0xc4c30339
-0, 838800, 38016, 0x137017df
-0, 842400, 38016, 0xa98a1b61
-0, 846000, 38016, 0xf74c4b4f
-0, 849600, 38016, 0x3eac5cb1
-0, 853200, 38016, 0x5d403e50
-0, 856800, 38016, 0xa33a4eb6
-0, 860400, 38016, 0x3f0a13fb
-0, 864000, 38016, 0x8b11e5a8
-0, 867600, 38016, 0x536bca4b
-0, 871200, 38016, 0xe1daa789
-0, 874800, 38016, 0xab37f6d1
-0, 878400, 38016, 0xbefe6f58
-0, 882000, 38016, 0xa5fdd2ff
-0, 885600, 38016, 0x6065ec01
-0, 889200, 38016, 0x939dd93a
-0, 892800, 38016, 0x3a7593d5
-0, 896400, 38016, 0x30fe19fe
-0, 900000, 38016, 0xb507c21c
-0, 903600, 38016, 0xf47f73ac
-0, 907200, 38016, 0xe9fc669a
-0, 910800, 38016, 0x2b85d19a
-0, 914400, 38016, 0x57033999
-0, 918000, 38016, 0x0e5eca3b
-0, 921600, 38016, 0x6a7bda2c
-0, 925200, 38016, 0x3517638d
-0, 928800, 38016, 0x1f5432e3
-0, 932400, 38016, 0x584d4c96
-0, 936000, 38016, 0x92474c0c
-0, 939600, 38016, 0x8c5e44a5
-0, 943200, 38016, 0x07dd64d4
-0, 946800, 38016, 0x828d632b
-0, 950400, 38016, 0x142254b6
-0, 954000, 38016, 0x8f9b60a4
-0, 957600, 38016, 0x44f745dd
-0, 961200, 38016, 0xc3321666
-0, 964800, 38016, 0x95520396
-0, 968400, 38016, 0x3eb3de27
-0, 972000, 38016, 0x0ce3a7ca
-0, 975600, 38016, 0x58258838
-0, 979200, 38016, 0x5725627a
-0, 982800, 38016, 0x901907ab
-0, 986400, 38016, 0xf965da2f
-0, 990000, 38016, 0xf542bae9
-0, 993600, 38016, 0x3dc4b3c3
-0, 997200, 38016, 0x8a1dd1e9
-0, 1000800, 38016, 0x4f6ef803
-0, 1004400, 38016, 0xde384800
-0, 1008000, 38016, 0x7251116f
-0, 1011600, 38016, 0x89f9e1ca
-0, 1015200, 38016, 0xc9818624
-0, 1018800, 38016, 0x30e391a6
-0, 1022400, 38016, 0x7aab6887
-0, 1026000, 38016, 0x0a34a67f
-0, 1029600, 38016, 0xe1258086
-0, 1033200, 38016, 0x5b16a887
-0, 1036800, 38016, 0x3297a135
-0, 1040400, 38016, 0x45a77236
-0, 1044000, 38016, 0xa414013a
-0, 1047600, 38016, 0xfab52c7e
-0, 1051200, 38016, 0x9074aca1
-0, 1054800, 38016, 0x843ad8a6
-0, 1058400, 38016, 0xccc63573
-0, 1062000, 38016, 0x3ba52a5f
-0, 1065600, 38016, 0x2f7b0236
-0, 1069200, 38016, 0x0ad407ec
-0, 1072800, 38016, 0x42082369
-0, 1076400, 38016, 0x5a9d3f63
+#tb 0: 1/25
+0, 0, 0, 1, 38016, 0xc805351d
+0, 1, 1, 1, 38016, 0xa0b41fef
+0, 2, 2, 1, 38016, 0x965cf070
+0, 3, 3, 1, 38016, 0x4552af45
+0, 4, 4, 1, 38016, 0x8429a576
+0, 5, 5, 1, 38016, 0xf6df8fc0
+0, 6, 6, 1, 38016, 0x5d85554c
+0, 7, 7, 1, 38016, 0x9c9d5b96
+0, 8, 8, 1, 38016, 0xbc4a4b71
+0, 9, 9, 1, 38016, 0xae4d3fc8
+0, 10, 10, 1, 38016, 0xf4da7f25
+0, 11, 11, 1, 38016, 0xf7d89a46
+0, 12, 12, 1, 38016, 0x204977fd
+0, 13, 13, 1, 38016, 0xa505b626
+0, 14, 14, 1, 38016, 0xc7b8b3f8
+0, 15, 15, 1, 38016, 0x96929e05
+0, 16, 16, 1, 38016, 0xfcfab8cc
+0, 17, 17, 1, 38016, 0x750caf2d
+0, 18, 18, 1, 38016, 0xa2c682ca
+0, 19, 19, 1, 38016, 0x3dcd8f07
+0, 20, 20, 1, 38016, 0x48fb69b3
+0, 21, 21, 1, 38016, 0x128e3310
+0, 22, 22, 1, 38016, 0x03803338
+0, 23, 23, 1, 38016, 0x11362bda
+0, 24, 24, 1, 38016, 0xc672229a
+0, 25, 25, 1, 38016, 0x68e540d0
+0, 26, 26, 1, 38016, 0x9d3a3deb
+0, 27, 27, 1, 38016, 0x53b233af
+0, 28, 28, 1, 38016, 0x3c6767eb
+0, 29, 29, 1, 38016, 0x2a8d75f2
+0, 30, 30, 1, 38016, 0x006f63cc
+0, 31, 31, 1, 38016, 0x3652a79e
+0, 32, 32, 1, 38016, 0x42f8c0fa
+0, 33, 33, 1, 38016, 0x052eb292
+0, 34, 34, 1, 38016, 0xbe7de0e7
+0, 35, 35, 1, 38016, 0xf9f9d46f
+0, 36, 36, 1, 38016, 0xb6d9b200
+0, 37, 37, 1, 38016, 0xc3bcd2d2
+0, 38, 38, 1, 38016, 0x23b5c8c2
+0, 39, 39, 1, 38016, 0x67caaf99
+0, 40, 40, 1, 38016, 0xb365cd31
+0, 41, 41, 1, 38016, 0x7cabc68f
+0, 42, 42, 1, 38016, 0xca8bb87a
+0, 43, 43, 1, 38016, 0x66a4be22
+0, 44, 44, 1, 38016, 0x2d10c1b0
+0, 45, 45, 1, 38016, 0xd1548835
+0, 46, 46, 1, 38016, 0x8b15b359
+0, 47, 47, 1, 38016, 0x2337b654
+0, 48, 48, 1, 38016, 0x56cfac2b
+0, 49, 49, 1, 38016, 0x7ad4c642
+0, 50, 50, 1, 38016, 0x6666c353
+0, 51, 51, 1, 38016, 0x053fb0f2
+0, 52, 52, 1, 38016, 0x2547c115
+0, 53, 53, 1, 38016, 0xf202c045
+0, 54, 54, 1, 38016, 0x94a8b95f
+0, 55, 55, 1, 38016, 0x439ccb13
+0, 56, 56, 1, 38016, 0xdfe4d54f
+0, 57, 57, 1, 38016, 0x2a0aceae
+0, 58, 58, 1, 38016, 0x1293dbd5
+0, 59, 59, 1, 38016, 0x9a62d994
+0, 60, 60, 1, 38016, 0x65539ad7
+0, 61, 61, 1, 38016, 0xc415ad58
+0, 62, 62, 1, 38016, 0x47bb9417
+0, 63, 63, 1, 38016, 0x92b745ea
+0, 64, 64, 1, 38016, 0x8fe8646e
+0, 65, 65, 1, 38016, 0x2b94857a
+0, 66, 66, 1, 38016, 0x12ac9aa4
+0, 67, 67, 1, 38016, 0x856bf0ea
+0, 68, 68, 1, 38016, 0xdbb32674
+0, 69, 69, 1, 38016, 0x96b53747
+0, 70, 70, 1, 38016, 0x875a7548
+0, 71, 71, 1, 38016, 0xdba4985c
+0, 72, 72, 1, 38016, 0x47cbb86c
+0, 73, 73, 1, 38016, 0x32dcfb99
+0, 74, 74, 1, 38016, 0x18b53b26
+0, 75, 75, 1, 38016, 0x2f0f3e49
+0, 76, 76, 1, 38016, 0x27b1880d
+0, 77, 77, 1, 38016, 0xbcc19dac
+0, 78, 78, 1, 38016, 0x7b6caeb1
+0, 79, 79, 1, 38016, 0xf3eece06
+0, 80, 80, 1, 38016, 0x7d93d4c9
+0, 81, 81, 1, 38016, 0xe6b8d923
+0, 82, 82, 1, 38016, 0xf47ce844
+0, 83, 83, 1, 38016, 0x74fce21c
+0, 84, 84, 1, 38016, 0x8e87d8cd
+0, 85, 85, 1, 38016, 0x9675d3ce
+0, 86, 86, 1, 38016, 0xd797ec75
+0, 87, 87, 1, 38016, 0x70aeeef1
+0, 88, 88, 1, 38016, 0x47baef32
+0, 89, 89, 1, 38016, 0x5054ec56
+0, 90, 90, 1, 38016, 0x43b6a0f7
+0, 91, 91, 1, 38016, 0x95dfb688
+0, 92, 92, 1, 38016, 0xc878a574
+0, 93, 93, 1, 38016, 0xeb928019
+0, 94, 94, 1, 38016, 0x304b7fec
+0, 95, 95, 1, 38016, 0x02cd7ea4
+0, 96, 96, 1, 38016, 0x505f7a7a
+0, 97, 97, 1, 38016, 0x09f59eaf
+0, 98, 98, 1, 38016, 0x513faaf7
+0, 99, 99, 1, 38016, 0xbd0daaa8
+0, 100, 100, 1, 38016, 0x8012be0f
+0, 101, 101, 1, 38016, 0xb663aa15
+0, 102, 102, 1, 38016, 0xd138981a
+0, 103, 103, 1, 38016, 0xc16b98a2
+0, 104, 104, 1, 38016, 0xf43eb8f8
+0, 105, 105, 1, 38016, 0xea22a35b
+0, 106, 106, 1, 38016, 0x9a0be0bb
+0, 107, 107, 1, 38016, 0x2a77ff9d
+0, 108, 108, 1, 38016, 0x2e350431
+0, 109, 109, 1, 38016, 0x9d0335ba
+0, 110, 110, 1, 38016, 0x62f23f21
+0, 111, 111, 1, 38016, 0x3e973351
+0, 112, 112, 1, 38016, 0x9d8f4ac5
+0, 113, 113, 1, 38016, 0x91e132ba
+0, 114, 114, 1, 38016, 0xfd04f69a
+0, 115, 115, 1, 38016, 0x481a1778
+0, 116, 116, 1, 38016, 0x27fa1dc4
+0, 117, 117, 1, 38016, 0x23ae0a6a
+0, 118, 118, 1, 38016, 0xc3ec426a
+0, 119, 119, 1, 38016, 0xc2a54ac1
+0, 120, 120, 1, 38016, 0xd88d3691
+0, 121, 121, 1, 38016, 0x46014ba7
+0, 122, 122, 1, 38016, 0xbf902815
+0, 123, 123, 1, 38016, 0x2af5ee16
+0, 124, 124, 1, 38016, 0xd183dc64
+0, 125, 125, 1, 38016, 0xf0c5bdd8
+0, 126, 126, 1, 38016, 0xb21aa102
+0, 127, 127, 1, 38016, 0xb35bbec2
+0, 128, 128, 1, 38016, 0x7efad1ce
+0, 129, 129, 1, 38016, 0x04e3d71d
+0, 130, 130, 1, 38016, 0x901ff71b
+0, 131, 131, 1, 38016, 0xc6c6e640
+0, 132, 132, 1, 38016, 0xd292d5d3
+0, 133, 133, 1, 38016, 0x2ce4e3fe
+0, 134, 134, 1, 38016, 0xe7fedf8a
+0, 135, 135, 1, 38016, 0x20e5a1eb
+0, 136, 136, 1, 38016, 0xbc39be76
+0, 137, 137, 1, 38016, 0xf749b4dd
+0, 138, 138, 1, 38016, 0xbc3f97a4
+0, 139, 139, 1, 38016, 0xa058a244
+0, 140, 140, 1, 38016, 0x77eb961b
+0, 141, 141, 1, 38016, 0xa92e7f25
+0, 142, 142, 1, 38016, 0xc75e796f
+0, 143, 143, 1, 38016, 0x114c79bd
+0, 144, 144, 1, 38016, 0x3fb96da3
+0, 145, 145, 1, 38016, 0x1c6f87b8
+0, 146, 146, 1, 38016, 0x25567ae4
+0, 147, 147, 1, 38016, 0xf5dd42b2
+0, 148, 148, 1, 38016, 0xe6172d0c
+0, 149, 149, 1, 38016, 0xcec0fd48
+0, 150, 150, 1, 38016, 0x0d27b12d
+0, 151, 151, 1, 38016, 0x3ec7cd24
+0, 152, 152, 1, 38016, 0xb2dccabe
+0, 153, 153, 1, 38016, 0xa977a844
+0, 154, 154, 1, 38016, 0x4b3bbfed
+0, 155, 155, 1, 38016, 0xed6dd876
+0, 156, 156, 1, 38016, 0x751bd34e
+0, 157, 157, 1, 38016, 0x80160cf9
+0, 158, 158, 1, 38016, 0xfbf53be8
+0, 159, 159, 1, 38016, 0x726e4f3b
+0, 160, 160, 1, 38016, 0x8ebb730c
+0, 161, 161, 1, 38016, 0x2c0c5fe6
+0, 162, 162, 1, 38016, 0x450940c0
+0, 163, 163, 1, 38016, 0xeed63ff8
+0, 164, 164, 1, 38016, 0x6f233d75
+0, 165, 165, 1, 38016, 0x98d2f70e
+0, 166, 166, 1, 38016, 0x8d38f2e8
+0, 167, 167, 1, 38016, 0x905dcbc9
+0, 168, 168, 1, 38016, 0x68c3a0f7
+0, 169, 169, 1, 38016, 0x4bb8a40c
+0, 170, 170, 1, 38016, 0x3650b08e
+0, 171, 171, 1, 38016, 0x3c3bbfd7
+0, 172, 172, 1, 38016, 0xcbc9da56
+0, 173, 173, 1, 38016, 0x576de6cd
+0, 174, 174, 1, 38016, 0x95f5c8c1
+0, 175, 175, 1, 38016, 0xbbcaacc8
+0, 176, 176, 1, 38016, 0x1b547ba4
+0, 177, 177, 1, 38016, 0x8f5238b2
+0, 178, 178, 1, 38016, 0x4c0f35c4
+0, 179, 179, 1, 38016, 0x894f278d
+0, 180, 180, 1, 38016, 0x3bb3ecd3
+0, 181, 181, 1, 38016, 0x177bf317
+0, 182, 182, 1, 38016, 0xdb1fdada
+0, 183, 183, 1, 38016, 0xec27cc28
+0, 184, 184, 1, 38016, 0x6a12eec7
+0, 185, 185, 1, 38016, 0x0168ff3f
+0, 186, 186, 1, 38016, 0x3fa206ba
+0, 187, 187, 1, 38016, 0x47cc30b5
+0, 188, 188, 1, 38016, 0xb2d02ddd
+0, 189, 189, 1, 38016, 0x306626bb
+0, 190, 190, 1, 38016, 0xfb06eb5b
+0, 191, 191, 1, 38016, 0x5881b60e
+0, 192, 192, 1, 38016, 0xd58caaf8
+0, 193, 193, 1, 38016, 0x840bdd0c
+0, 194, 194, 1, 38016, 0xb71efac1
+0, 195, 195, 1, 38016, 0x25961ad1
+0, 196, 196, 1, 38016, 0xbec156eb
+0, 197, 197, 1, 38016, 0xe2d1695c
+0, 198, 198, 1, 38016, 0x3fbe83d4
+0, 199, 199, 1, 38016, 0x10d8afe2
+0, 200, 200, 1, 38016, 0xa61fb9aa
+0, 201, 201, 1, 38016, 0x0c20be29
+0, 202, 202, 1, 38016, 0xc273cdd4
+0, 203, 203, 1, 38016, 0xfb21cfa0
+0, 204, 204, 1, 38016, 0xb1ccc643
+0, 205, 205, 1, 38016, 0x30f5d7a2
+0, 206, 206, 1, 38016, 0xe742da0f
+0, 207, 207, 1, 38016, 0x0a08d6a3
+0, 208, 208, 1, 38016, 0x85c4cf6c
+0, 209, 209, 1, 38016, 0xc117b8f4
+0, 210, 210, 1, 38016, 0x39305ec1
+0, 211, 211, 1, 38016, 0xf2867b2d
+0, 212, 212, 1, 38016, 0x81147a22
+0, 213, 213, 1, 38016, 0x308b59c3
+0, 214, 214, 1, 38016, 0xfd076bbd
+0, 215, 215, 1, 38016, 0x11bf57f5
+0, 216, 216, 1, 38016, 0x8c103fb7
+0, 217, 217, 1, 38016, 0x4f5e5a48
+0, 218, 218, 1, 38016, 0xa0fd54dc
+0, 219, 219, 1, 38016, 0x69d7429b
+0, 220, 220, 1, 38016, 0x93154a7c
+0, 221, 221, 1, 38016, 0xc72e3995
+0, 222, 222, 1, 38016, 0x86541ae0
+0, 223, 223, 1, 38016, 0xa9c93120
+0, 224, 224, 1, 38016, 0x602d368a
+0, 225, 225, 1, 38016, 0x6fca13cb
+0, 226, 226, 1, 38016, 0x314f3702
+0, 227, 227, 1, 38016, 0x4d1647bd
+0, 228, 228, 1, 38016, 0x73673c96
+0, 229, 229, 1, 38016, 0x62897c6f
+0, 230, 230, 1, 38016, 0x918e9a7d
+0, 231, 231, 1, 38016, 0x9fb9ad4f
+0, 232, 232, 1, 38016, 0xc4c30339
+0, 233, 233, 1, 38016, 0x137017df
+0, 234, 234, 1, 38016, 0xa98a1b61
+0, 235, 235, 1, 38016, 0xf74c4b4f
+0, 236, 236, 1, 38016, 0x3eac5cb1
+0, 237, 237, 1, 38016, 0x5d403e50
+0, 238, 238, 1, 38016, 0xa33a4eb6
+0, 239, 239, 1, 38016, 0x3f0a13fb
+0, 240, 240, 1, 38016, 0x8b11e5a8
+0, 241, 241, 1, 38016, 0x536bca4b
+0, 242, 242, 1, 38016, 0xe1daa789
+0, 243, 243, 1, 38016, 0xab37f6d1
+0, 244, 244, 1, 38016, 0xbefe6f58
+0, 245, 245, 1, 38016, 0xa5fdd2ff
+0, 246, 246, 1, 38016, 0x6065ec01
+0, 247, 247, 1, 38016, 0x939dd93a
+0, 248, 248, 1, 38016, 0x3a7593d5
+0, 249, 249, 1, 38016, 0x30fe19fe
+0, 250, 250, 1, 38016, 0xb507c21c
+0, 251, 251, 1, 38016, 0xf47f73ac
+0, 252, 252, 1, 38016, 0xe9fc669a
+0, 253, 253, 1, 38016, 0x2b85d19a
+0, 254, 254, 1, 38016, 0x57033999
+0, 255, 255, 1, 38016, 0x0e5eca3b
+0, 256, 256, 1, 38016, 0x6a7bda2c
+0, 257, 257, 1, 38016, 0x3517638d
+0, 258, 258, 1, 38016, 0x1f5432e3
+0, 259, 259, 1, 38016, 0x584d4c96
+0, 260, 260, 1, 38016, 0x92474c0c
+0, 261, 261, 1, 38016, 0x8c5e44a5
+0, 262, 262, 1, 38016, 0x07dd64d4
+0, 263, 263, 1, 38016, 0x828d632b
+0, 264, 264, 1, 38016, 0x142254b6
+0, 265, 265, 1, 38016, 0x8f9b60a4
+0, 266, 266, 1, 38016, 0x44f745dd
+0, 267, 267, 1, 38016, 0xc3321666
+0, 268, 268, 1, 38016, 0x95520396
+0, 269, 269, 1, 38016, 0x3eb3de27
+0, 270, 270, 1, 38016, 0x0ce3a7ca
+0, 271, 271, 1, 38016, 0x58258838
+0, 272, 272, 1, 38016, 0x5725627a
+0, 273, 273, 1, 38016, 0x901907ab
+0, 274, 274, 1, 38016, 0xf965da2f
+0, 275, 275, 1, 38016, 0xf542bae9
+0, 276, 276, 1, 38016, 0x3dc4b3c3
+0, 277, 277, 1, 38016, 0x8a1dd1e9
+0, 278, 278, 1, 38016, 0x4f6ef803
+0, 279, 279, 1, 38016, 0xde384800
+0, 280, 280, 1, 38016, 0x7251116f
+0, 281, 281, 1, 38016, 0x89f9e1ca
+0, 282, 282, 1, 38016, 0xc9818624
+0, 283, 283, 1, 38016, 0x30e391a6
+0, 284, 284, 1, 38016, 0x7aab6887
+0, 285, 285, 1, 38016, 0x0a34a67f
+0, 286, 286, 1, 38016, 0xe1258086
+0, 287, 287, 1, 38016, 0x5b16a887
+0, 288, 288, 1, 38016, 0x3297a135
+0, 289, 289, 1, 38016, 0x45a77236
+0, 290, 290, 1, 38016, 0xa414013a
+0, 291, 291, 1, 38016, 0xfab52c7e
+0, 292, 292, 1, 38016, 0x9074aca1
+0, 293, 293, 1, 38016, 0x843ad8a6
+0, 294, 294, 1, 38016, 0xccc63573
+0, 295, 295, 1, 38016, 0x3ba52a5f
+0, 296, 296, 1, 38016, 0x2f7b0236
+0, 297, 297, 1, 38016, 0x0ad407ec
+0, 298, 298, 1, 38016, 0x42082369
+0, 299, 299, 1, 38016, 0x5a9d3f63
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-canl3_sva_b b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-canl3_sva_b
index 1c575c8..dd56a43 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-canl3_sva_b
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-canl3_sva_b
@@ -1,17 +1,18 @@
-0, 0, 38016, 0x0bd22424
-0, 3600, 38016, 0xc45d1947
-0, 7200, 38016, 0x9d3d1218
-0, 10800, 38016, 0x79b71e03
-0, 14400, 38016, 0xd11e4a14
-0, 18000, 38016, 0x44c66b22
-0, 21600, 38016, 0xb9cc7acf
-0, 25200, 38016, 0x8ccd92a1
-0, 28800, 38016, 0x4a76aec4
-0, 32400, 38016, 0x6e2fc27e
-0, 36000, 38016, 0x400ea1fb
-0, 39600, 38016, 0xd1e2b7c4
-0, 43200, 38016, 0xb45eb08d
-0, 46800, 38016, 0x15079991
-0, 50400, 38016, 0x0fc97188
-0, 54000, 38016, 0xf9fc81af
-0, 57600, 38016, 0x020f992d
+#tb 0: 1/25
+0, 0, 0, 1, 38016, 0x0bd22424
+0, 1, 1, 1, 38016, 0xc45d1947
+0, 2, 2, 1, 38016, 0x9d3d1218
+0, 3, 3, 1, 38016, 0x79b71e03
+0, 4, 4, 1, 38016, 0xd11e4a14
+0, 5, 5, 1, 38016, 0x44c66b22
+0, 6, 6, 1, 38016, 0xb9cc7acf
+0, 7, 7, 1, 38016, 0x8ccd92a1
+0, 8, 8, 1, 38016, 0x4a76aec4
+0, 9, 9, 1, 38016, 0x6e2fc27e
+0, 10, 10, 1, 38016, 0x400ea1fb
+0, 11, 11, 1, 38016, 0xd1e2b7c4
+0, 12, 12, 1, 38016, 0xb45eb08d
+0, 13, 13, 1, 38016, 0x15079991
+0, 14, 14, 1, 38016, 0x0fc97188
+0, 15, 15, 1, 38016, 0xf9fc81af
+0, 16, 16, 1, 38016, 0x020f992d
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-canl4_sva_b b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-canl4_sva_b
index 65555fa..a9a2dd3 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-canl4_sva_b
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-canl4_sva_b
@@ -1,33 +1,34 @@
-0, 0, 38016, 0x5d9514e3
-0, 3600, 38016, 0xf5e8155c
-0, 7200, 38016, 0xc0a5f88b
-0, 10800, 38016, 0x421d2610
-0, 14400, 38016, 0x971838af
-0, 18000, 38016, 0xbd645dfc
-0, 21600, 38016, 0xaab5626a
-0, 25200, 38016, 0xc8fc9b6b
-0, 28800, 38016, 0x8be593f4
-0, 32400, 38016, 0x6560c0f4
-0, 36000, 38016, 0x29009b56
-0, 39600, 38016, 0x20b4bd2a
-0, 43200, 38016, 0xe8a7a51e
-0, 46800, 38016, 0x8c5e906a
-0, 50400, 38016, 0x15496f1e
-0, 54000, 38016, 0xdc788399
-0, 57600, 38016, 0x2b1e89b2
-0, 61200, 38016, 0xe9fda9bd
-0, 64800, 38016, 0x7c319f69
-0, 68400, 38016, 0x2921cbc4
-0, 72000, 38016, 0xb4fab1e2
-0, 75600, 38016, 0x6af6ba57
-0, 79200, 38016, 0xb36e7df5
-0, 82800, 38016, 0x57517aec
-0, 86400, 38016, 0x9f5f331a
-0, 90000, 38016, 0xafde3f8a
-0, 93600, 38016, 0x97f32b54
-0, 97200, 38016, 0x0c194bf7
-0, 100800, 38016, 0x58a054c2
-0, 104400, 38016, 0x6a637e5f
-0, 108000, 38016, 0x8b2d63d0
-0, 111600, 38016, 0x521772c5
-0, 115200, 38016, 0xae555677
+#tb 0: 1/25
+0, 0, 0, 1, 38016, 0x5d9514e3
+0, 1, 1, 1, 38016, 0xf5e8155c
+0, 2, 2, 1, 38016, 0xc0a5f88b
+0, 3, 3, 1, 38016, 0x421d2610
+0, 4, 4, 1, 38016, 0x971838af
+0, 5, 5, 1, 38016, 0xbd645dfc
+0, 6, 6, 1, 38016, 0xaab5626a
+0, 7, 7, 1, 38016, 0xc8fc9b6b
+0, 8, 8, 1, 38016, 0x8be593f4
+0, 9, 9, 1, 38016, 0x6560c0f4
+0, 10, 10, 1, 38016, 0x29009b56
+0, 11, 11, 1, 38016, 0x20b4bd2a
+0, 12, 12, 1, 38016, 0xe8a7a51e
+0, 13, 13, 1, 38016, 0x8c5e906a
+0, 14, 14, 1, 38016, 0x15496f1e
+0, 15, 15, 1, 38016, 0xdc788399
+0, 16, 16, 1, 38016, 0x2b1e89b2
+0, 17, 17, 1, 38016, 0xe9fda9bd
+0, 18, 18, 1, 38016, 0x7c319f69
+0, 19, 19, 1, 38016, 0x2921cbc4
+0, 20, 20, 1, 38016, 0xb4fab1e2
+0, 21, 21, 1, 38016, 0x6af6ba57
+0, 22, 22, 1, 38016, 0xb36e7df5
+0, 23, 23, 1, 38016, 0x57517aec
+0, 24, 24, 1, 38016, 0x9f5f331a
+0, 25, 25, 1, 38016, 0xafde3f8a
+0, 26, 26, 1, 38016, 0x97f32b54
+0, 27, 27, 1, 38016, 0x0c194bf7
+0, 28, 28, 1, 38016, 0x58a054c2
+0, 29, 29, 1, 38016, 0x6a637e5f
+0, 30, 30, 1, 38016, 0x8b2d63d0
+0, 31, 31, 1, 38016, 0x521772c5
+0, 32, 32, 1, 38016, 0xae555677
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-canlma2_sony_c b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-canlma2_sony_c
index 5eff64e..b6a759a 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-canlma2_sony_c
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-canlma2_sony_c
@@ -1,17 +1,18 @@
-0, 0, 518400, 0xfbca00c6
-0, 3600, 518400, 0x82b80adf
-0, 7200, 518400, 0x87ecdf4a
-0, 10800, 518400, 0xf6ca8cbe
-0, 14400, 518400, 0x8e9bb8a0
-0, 18000, 518400, 0x6512caa2
-0, 21600, 518400, 0xc015e43e
-0, 25200, 518400, 0x5f504a5c
-0, 28800, 518400, 0x4c7458a4
-0, 32400, 518400, 0x630f4004
-0, 36000, 518400, 0x889af20e
-0, 39600, 518400, 0x4437a5a4
-0, 43200, 518400, 0x1e19a254
-0, 46800, 518400, 0xb7ef1763
-0, 50400, 518400, 0xc966c95a
-0, 54000, 518400, 0x0c9074d6
-0, 57600, 518400, 0x24c906c9
+#tb 0: 1/25
+0, 0, 0, 1, 518400, 0xfbca00c6
+0, 1, 1, 1, 518400, 0x82b80adf
+0, 2, 2, 1, 518400, 0x87ecdf4a
+0, 3, 3, 1, 518400, 0xf6ca8cbe
+0, 4, 4, 1, 518400, 0x8e9bb8a0
+0, 5, 5, 1, 518400, 0x6512caa2
+0, 6, 6, 1, 518400, 0xc015e43e
+0, 7, 7, 1, 518400, 0x5f504a5c
+0, 8, 8, 1, 518400, 0x4c7458a4
+0, 9, 9, 1, 518400, 0x630f4004
+0, 10, 10, 1, 518400, 0x889af20e
+0, 11, 11, 1, 518400, 0x4437a5a4
+0, 12, 12, 1, 518400, 0x1e19a254
+0, 13, 13, 1, 518400, 0xb7ef1763
+0, 14, 14, 1, 518400, 0xc966c95a
+0, 15, 15, 1, 518400, 0x0c9074d6
+0, 16, 16, 1, 518400, 0x24c906c9
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-canlma3_sony_c b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-canlma3_sony_c
index 9ee15dd..87ce786 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-canlma3_sony_c
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-canlma3_sony_c
@@ -1,17 +1,18 @@
-0, 0, 518400, 0xfbca00c6
-0, 3600, 518400, 0x82b80adf
-0, 7200, 518400, 0x4874c24c
-0, 10800, 518400, 0xdb19528a
-0, 14400, 518400, 0x27888656
-0, 18000, 518400, 0x5e7aa98f
-0, 21600, 518400, 0xb43ecd8b
-0, 25200, 518400, 0xef772cbd
-0, 28800, 518400, 0x4f1e1d7e
-0, 32400, 518400, 0x0e9fe921
-0, 36000, 518400, 0xe4dab3d2
-0, 39600, 518400, 0x9279587b
-0, 43200, 518400, 0xa8248296
-0, 46800, 518400, 0x7be6c0d6
-0, 50400, 518400, 0x85ea92b1
-0, 54000, 518400, 0x0c9074d6
-0, 57600, 518400, 0x5c95bf41
+#tb 0: 1/25
+0, 0, 0, 1, 518400, 0xfbca00c6
+0, 1, 1, 1, 518400, 0x82b80adf
+0, 2, 2, 1, 518400, 0x4874c24c
+0, 3, 3, 1, 518400, 0xdb19528a
+0, 4, 4, 1, 518400, 0x27888656
+0, 5, 5, 1, 518400, 0x5e7aa98f
+0, 6, 6, 1, 518400, 0xb43ecd8b
+0, 7, 7, 1, 518400, 0xef772cbd
+0, 8, 8, 1, 518400, 0x4f1e1d7e
+0, 9, 9, 1, 518400, 0x0e9fe921
+0, 10, 10, 1, 518400, 0xe4dab3d2
+0, 11, 11, 1, 518400, 0x9279587b
+0, 12, 12, 1, 518400, 0xa8248296
+0, 13, 13, 1, 518400, 0x7be6c0d6
+0, 14, 14, 1, 518400, 0x85ea92b1
+0, 15, 15, 1, 518400, 0x0c9074d6
+0, 16, 16, 1, 518400, 0x5c95bf41
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-capa1_toshiba_b b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-capa1_toshiba_b
index 9f1d91f..a0336f8 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-capa1_toshiba_b
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-capa1_toshiba_b
@@ -1,90 +1,91 @@
-0, 0, 152064, 0x4040d2fc
-0, 3600, 152064, 0x0d8f9897
-0, 7200, 152064, 0xc23321cd
-0, 10800, 152064, 0x3c9225eb
-0, 14400, 152064, 0x8927006f
-0, 18000, 152064, 0xf706a302
-0, 21600, 152064, 0x8219c106
-0, 25200, 152064, 0x06c990ea
-0, 28800, 152064, 0x3a0f1135
-0, 32400, 152064, 0x4cff21d3
-0, 36000, 152064, 0x6be0e050
-0, 39600, 152064, 0x718b6c7b
-0, 43200, 152064, 0x24b38713
-0, 46800, 152064, 0x500553fb
-0, 50400, 152064, 0x531ae610
-0, 54000, 152064, 0x46f4ff1b
-0, 57600, 152064, 0xe5abe5ff
-0, 61200, 152064, 0x97daa351
-0, 64800, 152064, 0xfbef0a8f
-0, 68400, 152064, 0xbe76134f
-0, 72000, 152064, 0xa4bf10ea
-0, 75600, 152064, 0xb2fb32af
-0, 79200, 152064, 0xd33027a5
-0, 82800, 152064, 0x78e20c2b
-0, 86400, 152064, 0xefda2d6f
-0, 90000, 152064, 0xb99126f0
-0, 93600, 152064, 0x89d7e465
-0, 97200, 152064, 0x6150ff97
-0, 100800, 152064, 0xde03d937
-0, 104400, 152064, 0xd90ca874
-0, 108000, 152064, 0xb120b294
-0, 111600, 152064, 0x644eade4
-0, 115200, 152064, 0xd1bb004f
-0, 118800, 152064, 0x99806a8b
-0, 122400, 152064, 0x8c6b635f
-0, 126000, 152064, 0xa269fa8b
-0, 129600, 152064, 0xc11c0e64
-0, 133200, 152064, 0xac13f5eb
-0, 136800, 152064, 0x895799cf
-0, 140400, 152064, 0x95a9bea1
-0, 144000, 152064, 0xe998dfba
-0, 147600, 152064, 0xc72d8460
-0, 151200, 152064, 0xd1cb9b9a
-0, 154800, 152064, 0xb49aadd3
-0, 158400, 152064, 0x8bc38547
-0, 162000, 152064, 0x3485984b
-0, 165600, 152064, 0xdf305c0a
-0, 169200, 152064, 0x6a1ec990
-0, 172800, 152064, 0x595e0de4
-0, 176400, 152064, 0xe1baf7c4
-0, 180000, 152064, 0xf08b9b47
-0, 183600, 152064, 0x6532ba6f
-0, 187200, 152064, 0x3de67da6
-0, 190800, 152064, 0x439ffd04
-0, 194400, 152064, 0x6e6c1e97
-0, 198000, 152064, 0x8e5aee7a
-0, 201600, 152064, 0xd634999a
-0, 205200, 152064, 0xadfa9e8b
-0, 208800, 152064, 0x1b9090f5
-0, 212400, 152064, 0x29094dfc
-0, 216000, 152064, 0x56748851
-0, 219600, 152064, 0x2316719d
-0, 223200, 152064, 0x2ee0060b
-0, 226800, 152064, 0x3edb36d4
-0, 230400, 152064, 0x9ef437a3
-0, 234000, 152064, 0x8d9af72e
-0, 237600, 152064, 0xab86389c
-0, 241200, 152064, 0xd3b34576
-0, 244800, 152064, 0x9e5b04f4
-0, 248400, 152064, 0x6a164c17
-0, 252000, 152064, 0xcecf20ab
-0, 255600, 152064, 0x07c8e273
-0, 259200, 152064, 0x9b46fe6a
-0, 262800, 152064, 0xc1e8002b
-0, 266400, 152064, 0xdebdbe53
-0, 270000, 152064, 0x0d2dfd99
-0, 273600, 152064, 0xe8ae925f
-0, 277200, 152064, 0xe1fe6272
-0, 280800, 152064, 0xbb74d5e6
-0, 284400, 152064, 0xc7b5d949
-0, 288000, 152064, 0x9b15b020
-0, 291600, 152064, 0xc8201f44
-0, 295200, 152064, 0x30d03303
-0, 298800, 152064, 0x9f66fbc2
-0, 302400, 152064, 0x482b71ec
-0, 306000, 152064, 0x1c9e50bf
-0, 309600, 152064, 0x89f247e4
-0, 313200, 152064, 0xaa5f9141
-0, 316800, 152064, 0xb816aa8c
-0, 320400, 152064, 0x3112a619
+#tb 0: 1/25
+0, 0, 0, 1, 152064, 0x4040d2fc
+0, 1, 1, 1, 152064, 0x0d8f9897
+0, 2, 2, 1, 152064, 0xc23321cd
+0, 3, 3, 1, 152064, 0x3c9225eb
+0, 4, 4, 1, 152064, 0x8927006f
+0, 5, 5, 1, 152064, 0xf706a302
+0, 6, 6, 1, 152064, 0x8219c106
+0, 7, 7, 1, 152064, 0x06c990ea
+0, 8, 8, 1, 152064, 0x3a0f1135
+0, 9, 9, 1, 152064, 0x4cff21d3
+0, 10, 10, 1, 152064, 0x6be0e050
+0, 11, 11, 1, 152064, 0x718b6c7b
+0, 12, 12, 1, 152064, 0x24b38713
+0, 13, 13, 1, 152064, 0x500553fb
+0, 14, 14, 1, 152064, 0x531ae610
+0, 15, 15, 1, 152064, 0x46f4ff1b
+0, 16, 16, 1, 152064, 0xe5abe5ff
+0, 17, 17, 1, 152064, 0x97daa351
+0, 18, 18, 1, 152064, 0xfbef0a8f
+0, 19, 19, 1, 152064, 0xbe76134f
+0, 20, 20, 1, 152064, 0xa4bf10ea
+0, 21, 21, 1, 152064, 0xb2fb32af
+0, 22, 22, 1, 152064, 0xd33027a5
+0, 23, 23, 1, 152064, 0x78e20c2b
+0, 24, 24, 1, 152064, 0xefda2d6f
+0, 25, 25, 1, 152064, 0xb99126f0
+0, 26, 26, 1, 152064, 0x89d7e465
+0, 27, 27, 1, 152064, 0x6150ff97
+0, 28, 28, 1, 152064, 0xde03d937
+0, 29, 29, 1, 152064, 0xd90ca874
+0, 30, 30, 1, 152064, 0xb120b294
+0, 31, 31, 1, 152064, 0x644eade4
+0, 32, 32, 1, 152064, 0xd1bb004f
+0, 33, 33, 1, 152064, 0x99806a8b
+0, 34, 34, 1, 152064, 0x8c6b635f
+0, 35, 35, 1, 152064, 0xa269fa8b
+0, 36, 36, 1, 152064, 0xc11c0e64
+0, 37, 37, 1, 152064, 0xac13f5eb
+0, 38, 38, 1, 152064, 0x895799cf
+0, 39, 39, 1, 152064, 0x95a9bea1
+0, 40, 40, 1, 152064, 0xe998dfba
+0, 41, 41, 1, 152064, 0xc72d8460
+0, 42, 42, 1, 152064, 0xd1cb9b9a
+0, 43, 43, 1, 152064, 0xb49aadd3
+0, 44, 44, 1, 152064, 0x8bc38547
+0, 45, 45, 1, 152064, 0x3485984b
+0, 46, 46, 1, 152064, 0xdf305c0a
+0, 47, 47, 1, 152064, 0x6a1ec990
+0, 48, 48, 1, 152064, 0x595e0de4
+0, 49, 49, 1, 152064, 0xe1baf7c4
+0, 50, 50, 1, 152064, 0xf08b9b47
+0, 51, 51, 1, 152064, 0x6532ba6f
+0, 52, 52, 1, 152064, 0x3de67da6
+0, 53, 53, 1, 152064, 0x439ffd04
+0, 54, 54, 1, 152064, 0x6e6c1e97
+0, 55, 55, 1, 152064, 0x8e5aee7a
+0, 56, 56, 1, 152064, 0xd634999a
+0, 57, 57, 1, 152064, 0xadfa9e8b
+0, 58, 58, 1, 152064, 0x1b9090f5
+0, 59, 59, 1, 152064, 0x29094dfc
+0, 60, 60, 1, 152064, 0x56748851
+0, 61, 61, 1, 152064, 0x2316719d
+0, 62, 62, 1, 152064, 0x2ee0060b
+0, 63, 63, 1, 152064, 0x3edb36d4
+0, 64, 64, 1, 152064, 0x9ef437a3
+0, 65, 65, 1, 152064, 0x8d9af72e
+0, 66, 66, 1, 152064, 0xab86389c
+0, 67, 67, 1, 152064, 0xd3b34576
+0, 68, 68, 1, 152064, 0x9e5b04f4
+0, 69, 69, 1, 152064, 0x6a164c17
+0, 70, 70, 1, 152064, 0xcecf20ab
+0, 71, 71, 1, 152064, 0x07c8e273
+0, 72, 72, 1, 152064, 0x9b46fe6a
+0, 73, 73, 1, 152064, 0xc1e8002b
+0, 74, 74, 1, 152064, 0xdebdbe53
+0, 75, 75, 1, 152064, 0x0d2dfd99
+0, 76, 76, 1, 152064, 0xe8ae925f
+0, 77, 77, 1, 152064, 0xe1fe6272
+0, 78, 78, 1, 152064, 0xbb74d5e6
+0, 79, 79, 1, 152064, 0xc7b5d949
+0, 80, 80, 1, 152064, 0x9b15b020
+0, 81, 81, 1, 152064, 0xc8201f44
+0, 82, 82, 1, 152064, 0x30d03303
+0, 83, 83, 1, 152064, 0x9f66fbc2
+0, 84, 84, 1, 152064, 0x482b71ec
+0, 85, 85, 1, 152064, 0x1c9e50bf
+0, 86, 86, 1, 152064, 0x89f247e4
+0, 87, 87, 1, 152064, 0xaa5f9141
+0, 88, 88, 1, 152064, 0xb816aa8c
+0, 89, 89, 1, 152064, 0x3112a619
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-capama3_sand_f b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-capama3_sand_f
index 5fb9756..b621b81 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-capama3_sand_f
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-capama3_sand_f
@@ -1,50 +1,51 @@
-0, 0, 152064, 0xf772f152
-0, 3600, 152064, 0xc416d300
-0, 7200, 152064, 0xc2275c94
-0, 10800, 152064, 0x1bd35645
-0, 14400, 152064, 0x60327bf5
-0, 18000, 152064, 0x7f5541bd
-0, 21600, 152064, 0x52e5ebad
-0, 25200, 152064, 0xb8e5c1f3
-0, 28800, 152064, 0x2b4e3653
-0, 32400, 152064, 0x9a8f8499
-0, 36000, 152064, 0x32d4e9fb
-0, 39600, 152064, 0x0bc73d7a
-0, 43200, 152064, 0xb58a8b87
-0, 46800, 152064, 0xddbc5468
-0, 50400, 152064, 0xcfa30b64
-0, 54000, 152064, 0xad411f36
-0, 57600, 152064, 0x2f8c4d9b
-0, 61200, 152064, 0xc8523359
-0, 64800, 152064, 0x86be9861
-0, 68400, 152064, 0x7518d731
-0, 72000, 152064, 0x425fbfab
-0, 75600, 152064, 0x4f00250d
-0, 79200, 152064, 0x12b40617
-0, 82800, 152064, 0x65ff925d
-0, 86400, 152064, 0xc76a94c9
-0, 90000, 152064, 0x640170d5
-0, 93600, 152064, 0xd338a090
-0, 97200, 152064, 0xce715174
-0, 100800, 152064, 0x7bded195
-0, 104400, 152064, 0x09e7d3b9
-0, 108000, 152064, 0x651e1518
-0, 111600, 152064, 0x03cadc5f
-0, 115200, 152064, 0x08906919
-0, 118800, 152064, 0x3303ebe0
-0, 122400, 152064, 0xa28676c5
-0, 126000, 152064, 0x3900ecaf
-0, 129600, 152064, 0xeb795a05
-0, 133200, 152064, 0x870034df
-0, 136800, 152064, 0x69b0527a
-0, 140400, 152064, 0xb2b314f9
-0, 144000, 152064, 0x1a44ea1a
-0, 147600, 152064, 0xe6eaec87
-0, 151200, 152064, 0xd9ad818e
-0, 154800, 152064, 0x9c7ff76e
-0, 158400, 152064, 0x74c45abb
-0, 162000, 152064, 0x2f4fa5c6
-0, 165600, 152064, 0x19620702
-0, 169200, 152064, 0xfc9601f3
-0, 172800, 152064, 0x33e0d8e7
-0, 176400, 152064, 0xdf7f2a80
+#tb 0: 1/25
+0, 0, 0, 1, 152064, 0xf772f152
+0, 1, 1, 1, 152064, 0xc416d300
+0, 2, 2, 1, 152064, 0xc2275c94
+0, 3, 3, 1, 152064, 0x1bd35645
+0, 4, 4, 1, 152064, 0x60327bf5
+0, 5, 5, 1, 152064, 0x7f5541bd
+0, 6, 6, 1, 152064, 0x52e5ebad
+0, 7, 7, 1, 152064, 0xb8e5c1f3
+0, 8, 8, 1, 152064, 0x2b4e3653
+0, 9, 9, 1, 152064, 0x9a8f8499
+0, 10, 10, 1, 152064, 0x32d4e9fb
+0, 11, 11, 1, 152064, 0x0bc73d7a
+0, 12, 12, 1, 152064, 0xb58a8b87
+0, 13, 13, 1, 152064, 0xddbc5468
+0, 14, 14, 1, 152064, 0xcfa30b64
+0, 15, 15, 1, 152064, 0xad411f36
+0, 16, 16, 1, 152064, 0x2f8c4d9b
+0, 17, 17, 1, 152064, 0xc8523359
+0, 18, 18, 1, 152064, 0x86be9861
+0, 19, 19, 1, 152064, 0x7518d731
+0, 20, 20, 1, 152064, 0x425fbfab
+0, 21, 21, 1, 152064, 0x4f00250d
+0, 22, 22, 1, 152064, 0x12b40617
+0, 23, 23, 1, 152064, 0x65ff925d
+0, 24, 24, 1, 152064, 0xc76a94c9
+0, 25, 25, 1, 152064, 0x640170d5
+0, 26, 26, 1, 152064, 0xd338a090
+0, 27, 27, 1, 152064, 0xce715174
+0, 28, 28, 1, 152064, 0x7bded195
+0, 29, 29, 1, 152064, 0x09e7d3b9
+0, 30, 30, 1, 152064, 0x651e1518
+0, 31, 31, 1, 152064, 0x03cadc5f
+0, 32, 32, 1, 152064, 0x08906919
+0, 33, 33, 1, 152064, 0x3303ebe0
+0, 34, 34, 1, 152064, 0xa28676c5
+0, 35, 35, 1, 152064, 0x3900ecaf
+0, 36, 36, 1, 152064, 0xeb795a05
+0, 37, 37, 1, 152064, 0x870034df
+0, 38, 38, 1, 152064, 0x69b0527a
+0, 39, 39, 1, 152064, 0xb2b314f9
+0, 40, 40, 1, 152064, 0x1a44ea1a
+0, 41, 41, 1, 152064, 0xe6eaec87
+0, 42, 42, 1, 152064, 0xd9ad818e
+0, 43, 43, 1, 152064, 0x9c7ff76e
+0, 44, 44, 1, 152064, 0x74c45abb
+0, 45, 45, 1, 152064, 0x2f4fa5c6
+0, 46, 46, 1, 152064, 0x19620702
+0, 47, 47, 1, 152064, 0xfc9601f3
+0, 48, 48, 1, 152064, 0x33e0d8e7
+0, 49, 49, 1, 152064, 0xdf7f2a80
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-capcm1_sand_e b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-capcm1_sand_e
index 3a90eaf..392e8b4 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-capcm1_sand_e
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-capcm1_sand_e
@@ -1,30 +1,31 @@
-0, 0, 152064, 0x9989b588
-0, 3600, 152064, 0x7cbf85d4
-0, 7200, 152064, 0x72615cf1
-0, 10800, 152064, 0xcf98053c
-0, 14400, 152064, 0x42daddb0
-0, 18000, 152064, 0x460ca616
-0, 21600, 152064, 0x54cc5ab1
-0, 25200, 152064, 0xd146396e
-0, 28800, 152064, 0xefbbffc3
-0, 32400, 152064, 0x41ecd870
-0, 36000, 152064, 0x57bba322
-0, 39600, 152064, 0x7e7270f8
-0, 43200, 152064, 0x1f5d1f0e
-0, 46800, 152064, 0x5478eb60
-0, 50400, 152064, 0xd9abb62a
-0, 54000, 152064, 0x97997f6d
-0, 57600, 152064, 0xfc405569
-0, 61200, 152064, 0x4e49329b
-0, 64800, 152064, 0x6b98f9c6
-0, 68400, 152064, 0xa872cf59
-0, 72000, 152064, 0x478a897d
-0, 75600, 152064, 0xf6744e5d
-0, 79200, 152064, 0x7ddf110d
-0, 82800, 152064, 0xe6bde4be
-0, 86400, 152064, 0x5c3ba029
-0, 90000, 152064, 0x07759146
-0, 93600, 152064, 0x4beb510f
-0, 97200, 152064, 0x5b063ad9
-0, 100800, 152064, 0xc2930366
-0, 104400, 152064, 0x5435e658
+#tb 0: 1/25
+0, 0, 0, 1, 152064, 0x9989b588
+0, 1, 1, 1, 152064, 0x7cbf85d4
+0, 2, 2, 1, 152064, 0x72615cf1
+0, 3, 3, 1, 152064, 0xcf98053c
+0, 4, 4, 1, 152064, 0x42daddb0
+0, 5, 5, 1, 152064, 0x460ca616
+0, 6, 6, 1, 152064, 0x54cc5ab1
+0, 7, 7, 1, 152064, 0xd146396e
+0, 8, 8, 1, 152064, 0xefbbffc3
+0, 9, 9, 1, 152064, 0x41ecd870
+0, 10, 10, 1, 152064, 0x57bba322
+0, 11, 11, 1, 152064, 0x7e7270f8
+0, 12, 12, 1, 152064, 0x1f5d1f0e
+0, 13, 13, 1, 152064, 0x5478eb60
+0, 14, 14, 1, 152064, 0xd9abb62a
+0, 15, 15, 1, 152064, 0x97997f6d
+0, 16, 16, 1, 152064, 0xfc405569
+0, 17, 17, 1, 152064, 0x4e49329b
+0, 18, 18, 1, 152064, 0x6b98f9c6
+0, 19, 19, 1, 152064, 0xa872cf59
+0, 20, 20, 1, 152064, 0x478a897d
+0, 21, 21, 1, 152064, 0xf6744e5d
+0, 22, 22, 1, 152064, 0x7ddf110d
+0, 23, 23, 1, 152064, 0xe6bde4be
+0, 24, 24, 1, 152064, 0x5c3ba029
+0, 25, 25, 1, 152064, 0x07759146
+0, 26, 26, 1, 152064, 0x4beb510f
+0, 27, 27, 1, 152064, 0x5b063ad9
+0, 28, 28, 1, 152064, 0xc2930366
+0, 29, 29, 1, 152064, 0x5435e658
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-capcmnl1_sand_e b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-capcmnl1_sand_e
index 02f6a90..baee0ae 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-capcmnl1_sand_e
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-capcmnl1_sand_e
@@ -1,30 +1,31 @@
-0, 0, 152064, 0xf973b384
-0, 3600, 152064, 0x84418532
-0, 7200, 152064, 0x63165bc0
-0, 10800, 152064, 0x54b5049d
-0, 14400, 152064, 0xde66dbbc
-0, 18000, 152064, 0x8001a4f5
-0, 21600, 152064, 0x6b5259b7
-0, 25200, 152064, 0xd15137a1
-0, 28800, 152064, 0x1d19fdb9
-0, 32400, 152064, 0x3533d5a1
-0, 36000, 152064, 0xf82ba039
-0, 39600, 152064, 0x04366ee9
-0, 43200, 152064, 0xf7ac1dfb
-0, 46800, 152064, 0x6d0aebd7
-0, 50400, 152064, 0x4f2bb62d
-0, 54000, 152064, 0x6a7a7d50
-0, 57600, 152064, 0xc9c95422
-0, 61200, 152064, 0x35a13150
-0, 64800, 152064, 0xb576f7e4
-0, 68400, 152064, 0x5ad3cde5
-0, 72000, 152064, 0xbcb18908
-0, 75600, 152064, 0xa2a24ca7
-0, 79200, 152064, 0x95700ea5
-0, 82800, 152064, 0xfdb5e316
-0, 86400, 152064, 0x56e3a003
-0, 90000, 152064, 0x09ae905c
-0, 93600, 152064, 0xa1175024
-0, 97200, 152064, 0x8b82395e
-0, 100800, 152064, 0x032202da
-0, 104400, 152064, 0xae15e5e7
+#tb 0: 1/25
+0, 0, 0, 1, 152064, 0xf973b384
+0, 1, 1, 1, 152064, 0x84418532
+0, 2, 2, 1, 152064, 0x63165bc0
+0, 3, 3, 1, 152064, 0x54b5049d
+0, 4, 4, 1, 152064, 0xde66dbbc
+0, 5, 5, 1, 152064, 0x8001a4f5
+0, 6, 6, 1, 152064, 0x6b5259b7
+0, 7, 7, 1, 152064, 0xd15137a1
+0, 8, 8, 1, 152064, 0x1d19fdb9
+0, 9, 9, 1, 152064, 0x3533d5a1
+0, 10, 10, 1, 152064, 0xf82ba039
+0, 11, 11, 1, 152064, 0x04366ee9
+0, 12, 12, 1, 152064, 0xf7ac1dfb
+0, 13, 13, 1, 152064, 0x6d0aebd7
+0, 14, 14, 1, 152064, 0x4f2bb62d
+0, 15, 15, 1, 152064, 0x6a7a7d50
+0, 16, 16, 1, 152064, 0xc9c95422
+0, 17, 17, 1, 152064, 0x35a13150
+0, 18, 18, 1, 152064, 0xb576f7e4
+0, 19, 19, 1, 152064, 0x5ad3cde5
+0, 20, 20, 1, 152064, 0xbcb18908
+0, 21, 21, 1, 152064, 0xa2a24ca7
+0, 22, 22, 1, 152064, 0x95700ea5
+0, 23, 23, 1, 152064, 0xfdb5e316
+0, 24, 24, 1, 152064, 0x56e3a003
+0, 25, 25, 1, 152064, 0x09ae905c
+0, 26, 26, 1, 152064, 0xa1175024
+0, 27, 27, 1, 152064, 0x8b82395e
+0, 28, 28, 1, 152064, 0x032202da
+0, 29, 29, 1, 152064, 0xae15e5e7
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-capm3_sony_d b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-capm3_sony_d
index 4080b65..ab2b280 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-capm3_sony_d
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-capm3_sony_d
@@ -1,300 +1,301 @@
-0, 0, 38016, 0xa3b72d2f
-0, 3600, 38016, 0x77d918ae
-0, 7200, 38016, 0x181ad684
-0, 10800, 38016, 0x0dafa49c
-0, 14400, 38016, 0x8250a733
-0, 18000, 38016, 0x5d4f79b5
-0, 21600, 38016, 0x59664665
-0, 25200, 38016, 0xdce3491c
-0, 28800, 38016, 0xaffc395f
-0, 32400, 38016, 0xfb09320d
-0, 36000, 38016, 0x9b776724
-0, 39600, 38016, 0x30497da7
-0, 43200, 38016, 0xffd16ea0
-0, 46800, 38016, 0x5b7da1b5
-0, 50400, 38016, 0x764a9cc4
-0, 54000, 38016, 0xc4c79c41
-0, 57600, 38016, 0x883299dd
-0, 61200, 38016, 0xd5f39350
-0, 64800, 38016, 0x892f6808
-0, 68400, 38016, 0x5b0572d7
-0, 72000, 38016, 0x53c84a0c
-0, 75600, 38016, 0xe6ff14e2
-0, 79200, 38016, 0xd66d1924
-0, 82800, 38016, 0x7bec105f
-0, 86400, 38016, 0x405ffc8d
-0, 90000, 38016, 0xfccc2019
-0, 93600, 38016, 0x639f25a2
-0, 97200, 38016, 0xf89e179b
-0, 100800, 38016, 0x3e49456e
-0, 104400, 38016, 0x8d7d5d8e
-0, 108000, 38016, 0x89d15f1e
-0, 111600, 38016, 0x413d8c6a
-0, 115200, 38016, 0xf1a0a555
-0, 118800, 38016, 0x61249a1f
-0, 122400, 38016, 0xbd91c000
-0, 126000, 38016, 0x3209c225
-0, 129600, 38016, 0xfebca72f
-0, 133200, 38016, 0x839abdfd
-0, 136800, 38016, 0xa47cbc00
-0, 140400, 38016, 0x4537a269
-0, 144000, 38016, 0xbf19c0b2
-0, 147600, 38016, 0x7487c290
-0, 151200, 38016, 0xfbf8ab0c
-0, 154800, 38016, 0xce2ab41e
-0, 158400, 38016, 0xb505acf2
-0, 162000, 38016, 0x758489bc
-0, 165600, 38016, 0x7eae9aca
-0, 169200, 38016, 0x67b59692
-0, 172800, 38016, 0x074d9354
-0, 176400, 38016, 0xb6f6ae8a
-0, 180000, 38016, 0xe3b9a825
-0, 183600, 38016, 0x5f4e9cb2
-0, 187200, 38016, 0x88b3abcd
-0, 190800, 38016, 0x0cd7acdb
-0, 194400, 38016, 0xa731a3e4
-0, 198000, 38016, 0x9414c055
-0, 201600, 38016, 0x6cfec34a
-0, 205200, 38016, 0x6c89bce0
-0, 208800, 38016, 0xdabdc781
-0, 212400, 38016, 0x1afcc587
-0, 216000, 38016, 0xb4e79851
-0, 219600, 38016, 0x383ca78a
-0, 223200, 38016, 0x461f83fb
-0, 226800, 38016, 0x55f039e3
-0, 230400, 38016, 0xb6ec5d3f
-0, 234000, 38016, 0x645888af
-0, 237600, 38016, 0x37bc9e52
-0, 241200, 38016, 0x12a4f603
-0, 244800, 38016, 0x63e92df7
-0, 248400, 38016, 0x1a0246e3
-0, 252000, 38016, 0x1a6282fe
-0, 255600, 38016, 0x4e99a785
-0, 259200, 38016, 0xdaefbf23
-0, 262800, 38016, 0x9e8f00f1
-0, 266400, 38016, 0x85ea26c5
-0, 270000, 38016, 0x495e2ddb
-0, 273600, 38016, 0xab6278a4
-0, 277200, 38016, 0x48a78708
-0, 280800, 38016, 0x6fe99535
-0, 284400, 38016, 0xc3d9b8eb
-0, 288000, 38016, 0x4491c577
-0, 291600, 38016, 0x4d42cc30
-0, 295200, 38016, 0x3469d8bd
-0, 298800, 38016, 0x563dd0ad
-0, 302400, 38016, 0x681dbdef
-0, 306000, 38016, 0x5da9d2a7
-0, 309600, 38016, 0x75abdf2e
-0, 313200, 38016, 0x9bf0d13a
-0, 316800, 38016, 0x3c24dd7c
-0, 320400, 38016, 0x5132df96
-0, 324000, 38016, 0x01bd9d86
-0, 327600, 38016, 0x2b97bdfe
-0, 331200, 38016, 0xa7fdb2f1
-0, 334800, 38016, 0xcf908cfd
-0, 338400, 38016, 0xd18e7e52
-0, 342000, 38016, 0x6a1d78d3
-0, 345600, 38016, 0xd9cc83af
-0, 349200, 38016, 0xf6329ca1
-0, 352800, 38016, 0x1976aaeb
-0, 356400, 38016, 0xa3e8a3ce
-0, 360000, 38016, 0x73a2bd65
-0, 363600, 38016, 0xfd00a552
-0, 367200, 38016, 0x2df18642
-0, 370800, 38016, 0x85ad82fb
-0, 374400, 38016, 0x0456a864
-0, 378000, 38016, 0x0d6da3b6
-0, 381600, 38016, 0xabf0de94
-0, 385200, 38016, 0x68aef77e
-0, 388800, 38016, 0xd6aefd84
-0, 392400, 38016, 0x01953184
-0, 396000, 38016, 0xff324067
-0, 399600, 38016, 0x49aa300f
-0, 403200, 38016, 0xc146456b
-0, 406800, 38016, 0xfe5c2980
-0, 410400, 38016, 0x8f4df7eb
-0, 414000, 38016, 0x137c1373
-0, 417600, 38016, 0xfb9d1006
-0, 421200, 38016, 0x7f5409f9
-0, 424800, 38016, 0xa6ff29fc
-0, 428400, 38016, 0xc63e3807
-0, 432000, 38016, 0xd77c313a
-0, 435600, 38016, 0xdd3832dd
-0, 439200, 38016, 0xe70d140c
-0, 442800, 38016, 0xa559d731
-0, 446400, 38016, 0x3593d345
-0, 450000, 38016, 0x7497ad8a
-0, 453600, 38016, 0x9906919f
-0, 457200, 38016, 0x18bfb034
-0, 460800, 38016, 0xa4fbbd76
-0, 464400, 38016, 0xbd6cc31c
-0, 468000, 38016, 0x6ddde005
-0, 471600, 38016, 0x0072dd5f
-0, 475200, 38016, 0x62c5c5c0
-0, 478800, 38016, 0x1093cf81
-0, 482400, 38016, 0x46dbc9ff
-0, 486000, 38016, 0x0269a169
-0, 489600, 38016, 0xc96daa27
-0, 493200, 38016, 0xa0319cf4
-0, 496800, 38016, 0x1cae87fd
-0, 500400, 38016, 0xf1a0977f
-0, 504000, 38016, 0xc4d48a56
-0, 507600, 38016, 0xd3b1704c
-0, 511200, 38016, 0xd5e46a6c
-0, 514800, 38016, 0xb73e68fb
-0, 518400, 38016, 0xc0585fcf
-0, 522000, 38016, 0x1b3978fe
-0, 525600, 38016, 0xdda66c02
-0, 529200, 38016, 0x581033d6
-0, 532800, 38016, 0x0737185f
-0, 536400, 38016, 0xa0c9f494
-0, 540000, 38016, 0x916eae22
-0, 543600, 38016, 0xfdf7d6cd
-0, 547200, 38016, 0x6978ce4c
-0, 550800, 38016, 0x6783b016
-0, 554400, 38016, 0x528ac304
-0, 558000, 38016, 0x245de0ae
-0, 561600, 38016, 0x1dade956
-0, 565200, 38016, 0xa8f316da
-0, 568800, 38016, 0x95f04ca6
-0, 572400, 38016, 0x76615822
-0, 576000, 38016, 0x21de6ff4
-0, 579600, 38016, 0x12be5e8b
-0, 583200, 38016, 0x47ea3cbd
-0, 586800, 38016, 0x113631b5
-0, 590400, 38016, 0x546b2789
-0, 594000, 38016, 0x0505f2bb
-0, 597600, 38016, 0x90eee299
-0, 601200, 38016, 0x305cb341
-0, 604800, 38016, 0x5921841b
-0, 608400, 38016, 0x1449922d
-0, 612000, 38016, 0xca8f9f0a
-0, 615600, 38016, 0x0daeab19
-0, 619200, 38016, 0xde20dc27
-0, 622800, 38016, 0xb6ffd92c
-0, 626400, 38016, 0xedb1bc49
-0, 630000, 38016, 0x4ccf9ff5
-0, 633600, 38016, 0xfb636cd5
-0, 637200, 38016, 0x9c562c3d
-0, 640800, 38016, 0x0b021c95
-0, 644400, 38016, 0x8da50f21
-0, 648000, 38016, 0xa043ec8c
-0, 651600, 38016, 0x0143f4f2
-0, 655200, 38016, 0x77bece5b
-0, 658800, 38016, 0x147ccc68
-0, 662400, 38016, 0xa90cf948
-0, 666000, 38016, 0x8764066e
-0, 669600, 38016, 0x26c61821
-0, 673200, 38016, 0x39dd3be4
-0, 676800, 38016, 0xe2203c69
-0, 680400, 38016, 0x00e73014
-0, 684000, 38016, 0x0024f9eb
-0, 687600, 38016, 0x3a0da880
-0, 691200, 38016, 0x0336a353
-0, 694800, 38016, 0x721ed897
-0, 698400, 38016, 0x1c51f53f
-0, 702000, 38016, 0xeec91a00
-0, 705600, 38016, 0x73074864
-0, 709200, 38016, 0x672e5ff8
-0, 712800, 38016, 0xe7ea7aba
-0, 716400, 38016, 0x11899f08
-0, 720000, 38016, 0xa98daf03
-0, 723600, 38016, 0x4553af5c
-0, 727200, 38016, 0x4892c5d5
-0, 730800, 38016, 0x0ddbc2eb
-0, 734400, 38016, 0x0ce5b867
-0, 738000, 38016, 0xb0e6ce2c
-0, 741600, 38016, 0x8a2bd4da
-0, 745200, 38016, 0xf9f4cbec
-0, 748800, 38016, 0x77aeba8f
-0, 752400, 38016, 0xc1839e46
-0, 756000, 38016, 0x34845d3a
-0, 759600, 38016, 0xc3227ad7
-0, 763200, 38016, 0x2dad7051
-0, 766800, 38016, 0x7145565a
-0, 770400, 38016, 0x1e056ef1
-0, 774000, 38016, 0x9baa5195
-0, 777600, 38016, 0xacb53a1a
-0, 781200, 38016, 0x825d4fb7
-0, 784800, 38016, 0x63194b14
-0, 788400, 38016, 0xcb16360e
-0, 792000, 38016, 0x35104320
-0, 795600, 38016, 0x7e4c33dc
-0, 799200, 38016, 0x84811693
-0, 802800, 38016, 0x242b1811
-0, 806400, 38016, 0xb4af2667
-0, 810000, 38016, 0x77a20da2
-0, 813600, 38016, 0x8e4f36a8
-0, 817200, 38016, 0xe72435cb
-0, 820800, 38016, 0xf38a381b
-0, 824400, 38016, 0xb2b876d6
-0, 828000, 38016, 0x1c359b35
-0, 831600, 38016, 0x4fb8b180
-0, 835200, 38016, 0x90fdf94b
-0, 838800, 38016, 0xb8680c40
-0, 842400, 38016, 0x99331edd
-0, 846000, 38016, 0xd8e3433d
-0, 849600, 38016, 0x6d4d5aa2
-0, 853200, 38016, 0x4c3545c4
-0, 856800, 38016, 0x25b8376f
-0, 860400, 38016, 0xc4fe09df
-0, 864000, 38016, 0x6a9fe4f8
-0, 867600, 38016, 0x8fd2c2f3
-0, 871200, 38016, 0x78199f41
-0, 874800, 38016, 0x27b6e9f0
-0, 878400, 38016, 0xd8316400
-0, 882000, 38016, 0x0a70cd14
-0, 885600, 38016, 0x2075e91c
-0, 889200, 38016, 0xcd3cd7cb
-0, 892800, 38016, 0x4edc8cf5
-0, 896400, 38016, 0xf02e0bc7
-0, 900000, 38016, 0xcdd1b487
-0, 903600, 38016, 0xea5f6c8f
-0, 907200, 38016, 0x6b635e22
-0, 910800, 38016, 0xd548c435
-0, 914400, 38016, 0x455826ee
-0, 918000, 38016, 0x120ac7ed
-0, 921600, 38016, 0xf86adc5a
-0, 925200, 38016, 0x8dbd5c4e
-0, 928800, 38016, 0xe4c62dae
-0, 932400, 38016, 0x0a2a3be7
-0, 936000, 38016, 0xf8a243d7
-0, 939600, 38016, 0x898a3afb
-0, 943200, 38016, 0x39e661bb
-0, 946800, 38016, 0xe4e65f22
-0, 950400, 38016, 0x014846ff
-0, 954000, 38016, 0xf392509c
-0, 957600, 38016, 0x34623207
-0, 961200, 38016, 0xac4a09ed
-0, 964800, 38016, 0x9d18eb07
-0, 968400, 38016, 0x4594c90e
-0, 972000, 38016, 0x624f9b6b
-0, 975600, 38016, 0x8adc89d3
-0, 979200, 38016, 0xf4dd64f6
-0, 982800, 38016, 0x4c121386
-0, 986400, 38016, 0xfb5ddc7e
-0, 990000, 38016, 0x837fc31e
-0, 993600, 38016, 0xa4f4bd31
-0, 997200, 38016, 0x0445def7
-0, 1000800, 38016, 0xbac0fe62
-0, 1004400, 38016, 0x050b5778
-0, 1008000, 38016, 0x3d0723e5
-0, 1011600, 38016, 0x9967eae7
-0, 1015200, 38016, 0xf4be9ec7
-0, 1018800, 38016, 0x870377d2
-0, 1022400, 38016, 0x5c9d648a
-0, 1026000, 38016, 0x2d41a44b
-0, 1029600, 38016, 0xa50e7c6f
-0, 1033200, 38016, 0x2bd1b477
-0, 1036800, 38016, 0xd123ae8d
-0, 1040400, 38016, 0xf2fc7a6b
-0, 1044000, 38016, 0xaa3ee416
-0, 1047600, 38016, 0x5f8801d6
-0, 1051200, 38016, 0xbee7924a
-0, 1054800, 38016, 0x6e47c3e1
-0, 1058400, 38016, 0xf34f1223
-0, 1062000, 38016, 0x7a610876
-0, 1065600, 38016, 0x15e9e47f
-0, 1069200, 38016, 0x557ddcf1
-0, 1072800, 38016, 0xf0cd02e2
-0, 1076400, 38016, 0xe98f1deb
+#tb 0: 1/25
+0, 0, 0, 1, 38016, 0xa3b72d2f
+0, 1, 1, 1, 38016, 0x77d918ae
+0, 2, 2, 1, 38016, 0x181ad684
+0, 3, 3, 1, 38016, 0x0dafa49c
+0, 4, 4, 1, 38016, 0x8250a733
+0, 5, 5, 1, 38016, 0x5d4f79b5
+0, 6, 6, 1, 38016, 0x59664665
+0, 7, 7, 1, 38016, 0xdce3491c
+0, 8, 8, 1, 38016, 0xaffc395f
+0, 9, 9, 1, 38016, 0xfb09320d
+0, 10, 10, 1, 38016, 0x9b776724
+0, 11, 11, 1, 38016, 0x30497da7
+0, 12, 12, 1, 38016, 0xffd16ea0
+0, 13, 13, 1, 38016, 0x5b7da1b5
+0, 14, 14, 1, 38016, 0x764a9cc4
+0, 15, 15, 1, 38016, 0xc4c79c41
+0, 16, 16, 1, 38016, 0x883299dd
+0, 17, 17, 1, 38016, 0xd5f39350
+0, 18, 18, 1, 38016, 0x892f6808
+0, 19, 19, 1, 38016, 0x5b0572d7
+0, 20, 20, 1, 38016, 0x53c84a0c
+0, 21, 21, 1, 38016, 0xe6ff14e2
+0, 22, 22, 1, 38016, 0xd66d1924
+0, 23, 23, 1, 38016, 0x7bec105f
+0, 24, 24, 1, 38016, 0x405ffc8d
+0, 25, 25, 1, 38016, 0xfccc2019
+0, 26, 26, 1, 38016, 0x639f25a2
+0, 27, 27, 1, 38016, 0xf89e179b
+0, 28, 28, 1, 38016, 0x3e49456e
+0, 29, 29, 1, 38016, 0x8d7d5d8e
+0, 30, 30, 1, 38016, 0x89d15f1e
+0, 31, 31, 1, 38016, 0x413d8c6a
+0, 32, 32, 1, 38016, 0xf1a0a555
+0, 33, 33, 1, 38016, 0x61249a1f
+0, 34, 34, 1, 38016, 0xbd91c000
+0, 35, 35, 1, 38016, 0x3209c225
+0, 36, 36, 1, 38016, 0xfebca72f
+0, 37, 37, 1, 38016, 0x839abdfd
+0, 38, 38, 1, 38016, 0xa47cbc00
+0, 39, 39, 1, 38016, 0x4537a269
+0, 40, 40, 1, 38016, 0xbf19c0b2
+0, 41, 41, 1, 38016, 0x7487c290
+0, 42, 42, 1, 38016, 0xfbf8ab0c
+0, 43, 43, 1, 38016, 0xce2ab41e
+0, 44, 44, 1, 38016, 0xb505acf2
+0, 45, 45, 1, 38016, 0x758489bc
+0, 46, 46, 1, 38016, 0x7eae9aca
+0, 47, 47, 1, 38016, 0x67b59692
+0, 48, 48, 1, 38016, 0x074d9354
+0, 49, 49, 1, 38016, 0xb6f6ae8a
+0, 50, 50, 1, 38016, 0xe3b9a825
+0, 51, 51, 1, 38016, 0x5f4e9cb2
+0, 52, 52, 1, 38016, 0x88b3abcd
+0, 53, 53, 1, 38016, 0x0cd7acdb
+0, 54, 54, 1, 38016, 0xa731a3e4
+0, 55, 55, 1, 38016, 0x9414c055
+0, 56, 56, 1, 38016, 0x6cfec34a
+0, 57, 57, 1, 38016, 0x6c89bce0
+0, 58, 58, 1, 38016, 0xdabdc781
+0, 59, 59, 1, 38016, 0x1afcc587
+0, 60, 60, 1, 38016, 0xb4e79851
+0, 61, 61, 1, 38016, 0x383ca78a
+0, 62, 62, 1, 38016, 0x461f83fb
+0, 63, 63, 1, 38016, 0x55f039e3
+0, 64, 64, 1, 38016, 0xb6ec5d3f
+0, 65, 65, 1, 38016, 0x645888af
+0, 66, 66, 1, 38016, 0x37bc9e52
+0, 67, 67, 1, 38016, 0x12a4f603
+0, 68, 68, 1, 38016, 0x63e92df7
+0, 69, 69, 1, 38016, 0x1a0246e3
+0, 70, 70, 1, 38016, 0x1a6282fe
+0, 71, 71, 1, 38016, 0x4e99a785
+0, 72, 72, 1, 38016, 0xdaefbf23
+0, 73, 73, 1, 38016, 0x9e8f00f1
+0, 74, 74, 1, 38016, 0x85ea26c5
+0, 75, 75, 1, 38016, 0x495e2ddb
+0, 76, 76, 1, 38016, 0xab6278a4
+0, 77, 77, 1, 38016, 0x48a78708
+0, 78, 78, 1, 38016, 0x6fe99535
+0, 79, 79, 1, 38016, 0xc3d9b8eb
+0, 80, 80, 1, 38016, 0x4491c577
+0, 81, 81, 1, 38016, 0x4d42cc30
+0, 82, 82, 1, 38016, 0x3469d8bd
+0, 83, 83, 1, 38016, 0x563dd0ad
+0, 84, 84, 1, 38016, 0x681dbdef
+0, 85, 85, 1, 38016, 0x5da9d2a7
+0, 86, 86, 1, 38016, 0x75abdf2e
+0, 87, 87, 1, 38016, 0x9bf0d13a
+0, 88, 88, 1, 38016, 0x3c24dd7c
+0, 89, 89, 1, 38016, 0x5132df96
+0, 90, 90, 1, 38016, 0x01bd9d86
+0, 91, 91, 1, 38016, 0x2b97bdfe
+0, 92, 92, 1, 38016, 0xa7fdb2f1
+0, 93, 93, 1, 38016, 0xcf908cfd
+0, 94, 94, 1, 38016, 0xd18e7e52
+0, 95, 95, 1, 38016, 0x6a1d78d3
+0, 96, 96, 1, 38016, 0xd9cc83af
+0, 97, 97, 1, 38016, 0xf6329ca1
+0, 98, 98, 1, 38016, 0x1976aaeb
+0, 99, 99, 1, 38016, 0xa3e8a3ce
+0, 100, 100, 1, 38016, 0x73a2bd65
+0, 101, 101, 1, 38016, 0xfd00a552
+0, 102, 102, 1, 38016, 0x2df18642
+0, 103, 103, 1, 38016, 0x85ad82fb
+0, 104, 104, 1, 38016, 0x0456a864
+0, 105, 105, 1, 38016, 0x0d6da3b6
+0, 106, 106, 1, 38016, 0xabf0de94
+0, 107, 107, 1, 38016, 0x68aef77e
+0, 108, 108, 1, 38016, 0xd6aefd84
+0, 109, 109, 1, 38016, 0x01953184
+0, 110, 110, 1, 38016, 0xff324067
+0, 111, 111, 1, 38016, 0x49aa300f
+0, 112, 112, 1, 38016, 0xc146456b
+0, 113, 113, 1, 38016, 0xfe5c2980
+0, 114, 114, 1, 38016, 0x8f4df7eb
+0, 115, 115, 1, 38016, 0x137c1373
+0, 116, 116, 1, 38016, 0xfb9d1006
+0, 117, 117, 1, 38016, 0x7f5409f9
+0, 118, 118, 1, 38016, 0xa6ff29fc
+0, 119, 119, 1, 38016, 0xc63e3807
+0, 120, 120, 1, 38016, 0xd77c313a
+0, 121, 121, 1, 38016, 0xdd3832dd
+0, 122, 122, 1, 38016, 0xe70d140c
+0, 123, 123, 1, 38016, 0xa559d731
+0, 124, 124, 1, 38016, 0x3593d345
+0, 125, 125, 1, 38016, 0x7497ad8a
+0, 126, 126, 1, 38016, 0x9906919f
+0, 127, 127, 1, 38016, 0x18bfb034
+0, 128, 128, 1, 38016, 0xa4fbbd76
+0, 129, 129, 1, 38016, 0xbd6cc31c
+0, 130, 130, 1, 38016, 0x6ddde005
+0, 131, 131, 1, 38016, 0x0072dd5f
+0, 132, 132, 1, 38016, 0x62c5c5c0
+0, 133, 133, 1, 38016, 0x1093cf81
+0, 134, 134, 1, 38016, 0x46dbc9ff
+0, 135, 135, 1, 38016, 0x0269a169
+0, 136, 136, 1, 38016, 0xc96daa27
+0, 137, 137, 1, 38016, 0xa0319cf4
+0, 138, 138, 1, 38016, 0x1cae87fd
+0, 139, 139, 1, 38016, 0xf1a0977f
+0, 140, 140, 1, 38016, 0xc4d48a56
+0, 141, 141, 1, 38016, 0xd3b1704c
+0, 142, 142, 1, 38016, 0xd5e46a6c
+0, 143, 143, 1, 38016, 0xb73e68fb
+0, 144, 144, 1, 38016, 0xc0585fcf
+0, 145, 145, 1, 38016, 0x1b3978fe
+0, 146, 146, 1, 38016, 0xdda66c02
+0, 147, 147, 1, 38016, 0x581033d6
+0, 148, 148, 1, 38016, 0x0737185f
+0, 149, 149, 1, 38016, 0xa0c9f494
+0, 150, 150, 1, 38016, 0x916eae22
+0, 151, 151, 1, 38016, 0xfdf7d6cd
+0, 152, 152, 1, 38016, 0x6978ce4c
+0, 153, 153, 1, 38016, 0x6783b016
+0, 154, 154, 1, 38016, 0x528ac304
+0, 155, 155, 1, 38016, 0x245de0ae
+0, 156, 156, 1, 38016, 0x1dade956
+0, 157, 157, 1, 38016, 0xa8f316da
+0, 158, 158, 1, 38016, 0x95f04ca6
+0, 159, 159, 1, 38016, 0x76615822
+0, 160, 160, 1, 38016, 0x21de6ff4
+0, 161, 161, 1, 38016, 0x12be5e8b
+0, 162, 162, 1, 38016, 0x47ea3cbd
+0, 163, 163, 1, 38016, 0x113631b5
+0, 164, 164, 1, 38016, 0x546b2789
+0, 165, 165, 1, 38016, 0x0505f2bb
+0, 166, 166, 1, 38016, 0x90eee299
+0, 167, 167, 1, 38016, 0x305cb341
+0, 168, 168, 1, 38016, 0x5921841b
+0, 169, 169, 1, 38016, 0x1449922d
+0, 170, 170, 1, 38016, 0xca8f9f0a
+0, 171, 171, 1, 38016, 0x0daeab19
+0, 172, 172, 1, 38016, 0xde20dc27
+0, 173, 173, 1, 38016, 0xb6ffd92c
+0, 174, 174, 1, 38016, 0xedb1bc49
+0, 175, 175, 1, 38016, 0x4ccf9ff5
+0, 176, 176, 1, 38016, 0xfb636cd5
+0, 177, 177, 1, 38016, 0x9c562c3d
+0, 178, 178, 1, 38016, 0x0b021c95
+0, 179, 179, 1, 38016, 0x8da50f21
+0, 180, 180, 1, 38016, 0xa043ec8c
+0, 181, 181, 1, 38016, 0x0143f4f2
+0, 182, 182, 1, 38016, 0x77bece5b
+0, 183, 183, 1, 38016, 0x147ccc68
+0, 184, 184, 1, 38016, 0xa90cf948
+0, 185, 185, 1, 38016, 0x8764066e
+0, 186, 186, 1, 38016, 0x26c61821
+0, 187, 187, 1, 38016, 0x39dd3be4
+0, 188, 188, 1, 38016, 0xe2203c69
+0, 189, 189, 1, 38016, 0x00e73014
+0, 190, 190, 1, 38016, 0x0024f9eb
+0, 191, 191, 1, 38016, 0x3a0da880
+0, 192, 192, 1, 38016, 0x0336a353
+0, 193, 193, 1, 38016, 0x721ed897
+0, 194, 194, 1, 38016, 0x1c51f53f
+0, 195, 195, 1, 38016, 0xeec91a00
+0, 196, 196, 1, 38016, 0x73074864
+0, 197, 197, 1, 38016, 0x672e5ff8
+0, 198, 198, 1, 38016, 0xe7ea7aba
+0, 199, 199, 1, 38016, 0x11899f08
+0, 200, 200, 1, 38016, 0xa98daf03
+0, 201, 201, 1, 38016, 0x4553af5c
+0, 202, 202, 1, 38016, 0x4892c5d5
+0, 203, 203, 1, 38016, 0x0ddbc2eb
+0, 204, 204, 1, 38016, 0x0ce5b867
+0, 205, 205, 1, 38016, 0xb0e6ce2c
+0, 206, 206, 1, 38016, 0x8a2bd4da
+0, 207, 207, 1, 38016, 0xf9f4cbec
+0, 208, 208, 1, 38016, 0x77aeba8f
+0, 209, 209, 1, 38016, 0xc1839e46
+0, 210, 210, 1, 38016, 0x34845d3a
+0, 211, 211, 1, 38016, 0xc3227ad7
+0, 212, 212, 1, 38016, 0x2dad7051
+0, 213, 213, 1, 38016, 0x7145565a
+0, 214, 214, 1, 38016, 0x1e056ef1
+0, 215, 215, 1, 38016, 0x9baa5195
+0, 216, 216, 1, 38016, 0xacb53a1a
+0, 217, 217, 1, 38016, 0x825d4fb7
+0, 218, 218, 1, 38016, 0x63194b14
+0, 219, 219, 1, 38016, 0xcb16360e
+0, 220, 220, 1, 38016, 0x35104320
+0, 221, 221, 1, 38016, 0x7e4c33dc
+0, 222, 222, 1, 38016, 0x84811693
+0, 223, 223, 1, 38016, 0x242b1811
+0, 224, 224, 1, 38016, 0xb4af2667
+0, 225, 225, 1, 38016, 0x77a20da2
+0, 226, 226, 1, 38016, 0x8e4f36a8
+0, 227, 227, 1, 38016, 0xe72435cb
+0, 228, 228, 1, 38016, 0xf38a381b
+0, 229, 229, 1, 38016, 0xb2b876d6
+0, 230, 230, 1, 38016, 0x1c359b35
+0, 231, 231, 1, 38016, 0x4fb8b180
+0, 232, 232, 1, 38016, 0x90fdf94b
+0, 233, 233, 1, 38016, 0xb8680c40
+0, 234, 234, 1, 38016, 0x99331edd
+0, 235, 235, 1, 38016, 0xd8e3433d
+0, 236, 236, 1, 38016, 0x6d4d5aa2
+0, 237, 237, 1, 38016, 0x4c3545c4
+0, 238, 238, 1, 38016, 0x25b8376f
+0, 239, 239, 1, 38016, 0xc4fe09df
+0, 240, 240, 1, 38016, 0x6a9fe4f8
+0, 241, 241, 1, 38016, 0x8fd2c2f3
+0, 242, 242, 1, 38016, 0x78199f41
+0, 243, 243, 1, 38016, 0x27b6e9f0
+0, 244, 244, 1, 38016, 0xd8316400
+0, 245, 245, 1, 38016, 0x0a70cd14
+0, 246, 246, 1, 38016, 0x2075e91c
+0, 247, 247, 1, 38016, 0xcd3cd7cb
+0, 248, 248, 1, 38016, 0x4edc8cf5
+0, 249, 249, 1, 38016, 0xf02e0bc7
+0, 250, 250, 1, 38016, 0xcdd1b487
+0, 251, 251, 1, 38016, 0xea5f6c8f
+0, 252, 252, 1, 38016, 0x6b635e22
+0, 253, 253, 1, 38016, 0xd548c435
+0, 254, 254, 1, 38016, 0x455826ee
+0, 255, 255, 1, 38016, 0x120ac7ed
+0, 256, 256, 1, 38016, 0xf86adc5a
+0, 257, 257, 1, 38016, 0x8dbd5c4e
+0, 258, 258, 1, 38016, 0xe4c62dae
+0, 259, 259, 1, 38016, 0x0a2a3be7
+0, 260, 260, 1, 38016, 0xf8a243d7
+0, 261, 261, 1, 38016, 0x898a3afb
+0, 262, 262, 1, 38016, 0x39e661bb
+0, 263, 263, 1, 38016, 0xe4e65f22
+0, 264, 264, 1, 38016, 0x014846ff
+0, 265, 265, 1, 38016, 0xf392509c
+0, 266, 266, 1, 38016, 0x34623207
+0, 267, 267, 1, 38016, 0xac4a09ed
+0, 268, 268, 1, 38016, 0x9d18eb07
+0, 269, 269, 1, 38016, 0x4594c90e
+0, 270, 270, 1, 38016, 0x624f9b6b
+0, 271, 271, 1, 38016, 0x8adc89d3
+0, 272, 272, 1, 38016, 0xf4dd64f6
+0, 273, 273, 1, 38016, 0x4c121386
+0, 274, 274, 1, 38016, 0xfb5ddc7e
+0, 275, 275, 1, 38016, 0x837fc31e
+0, 276, 276, 1, 38016, 0xa4f4bd31
+0, 277, 277, 1, 38016, 0x0445def7
+0, 278, 278, 1, 38016, 0xbac0fe62
+0, 279, 279, 1, 38016, 0x050b5778
+0, 280, 280, 1, 38016, 0x3d0723e5
+0, 281, 281, 1, 38016, 0x9967eae7
+0, 282, 282, 1, 38016, 0xf4be9ec7
+0, 283, 283, 1, 38016, 0x870377d2
+0, 284, 284, 1, 38016, 0x5c9d648a
+0, 285, 285, 1, 38016, 0x2d41a44b
+0, 286, 286, 1, 38016, 0xa50e7c6f
+0, 287, 287, 1, 38016, 0x2bd1b477
+0, 288, 288, 1, 38016, 0xd123ae8d
+0, 289, 289, 1, 38016, 0xf2fc7a6b
+0, 290, 290, 1, 38016, 0xaa3ee416
+0, 291, 291, 1, 38016, 0x5f8801d6
+0, 292, 292, 1, 38016, 0xbee7924a
+0, 293, 293, 1, 38016, 0x6e47c3e1
+0, 294, 294, 1, 38016, 0xf34f1223
+0, 295, 295, 1, 38016, 0x7a610876
+0, 296, 296, 1, 38016, 0x15e9e47f
+0, 297, 297, 1, 38016, 0x557ddcf1
+0, 298, 298, 1, 38016, 0xf0cd02e2
+0, 299, 299, 1, 38016, 0xe98f1deb
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-caqp1_sony_b b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-caqp1_sony_b
index fe023eb..beca1c5 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-caqp1_sony_b
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-caqp1_sony_b
@@ -1,50 +1,51 @@
-0, 0, 38016, 0x25f92b0e
-0, 3600, 38016, 0x2ecbe752
-0, 7200, 38016, 0x3432e744
-0, 10800, 38016, 0x7970aa2e
-0, 14400, 38016, 0x250787bf
-0, 18000, 38016, 0xd58e5e56
-0, 21600, 38016, 0xf4b8580f
-0, 25200, 38016, 0x9acb4096
-0, 28800, 38016, 0xeed0476f
-0, 32400, 38016, 0xe33846ef
-0, 36000, 38016, 0x02da4e76
-0, 39600, 38016, 0xd3e572f8
-0, 43200, 38016, 0x5fd27f8a
-0, 46800, 38016, 0xfa169823
-0, 50400, 38016, 0xcc6b8d76
-0, 54000, 38016, 0xcc4da11f
-0, 57600, 38016, 0x32259b9d
-0, 61200, 38016, 0xf1e39b70
-0, 64800, 38016, 0xb49d7480
-0, 68400, 38016, 0x3dc158e9
-0, 72000, 38016, 0x4ce134db
-0, 75600, 38016, 0x4fb30b43
-0, 79200, 38016, 0xda49fe5f
-0, 82800, 38016, 0x7fda0d68
-0, 86400, 38016, 0x3a8b25e3
-0, 90000, 38016, 0x3df11d4e
-0, 93600, 38016, 0x26e11107
-0, 97200, 38016, 0xdc3b03a7
-0, 100800, 38016, 0x72b2434d
-0, 104400, 38016, 0x2a013e27
-0, 108000, 38016, 0xf95a4c2e
-0, 111600, 38016, 0x1e7b6656
-0, 115200, 38016, 0x776a81c8
-0, 118800, 38016, 0x162cb0bf
-0, 122400, 38016, 0x7ff4aaf5
-0, 126000, 38016, 0x7150b50b
-0, 129600, 38016, 0xf7d0b889
-0, 133200, 38016, 0xbe09b5c2
-0, 136800, 38016, 0xf6f7d29c
-0, 140400, 38016, 0x4356b996
-0, 144000, 38016, 0xb056c4b4
-0, 147600, 38016, 0x38e9c6e6
-0, 151200, 38016, 0x9c64ab45
-0, 154800, 38016, 0x31189eef
-0, 158400, 38016, 0x1ee3a3b1
-0, 162000, 38016, 0x8bed7c95
-0, 165600, 38016, 0x30357cee
-0, 169200, 38016, 0x5d828428
-0, 172800, 38016, 0xc06388b3
-0, 176400, 38016, 0x2af597b4
+#tb 0: 1/25
+0, 0, 0, 1, 38016, 0x25f92b0e
+0, 1, 1, 1, 38016, 0x2ecbe752
+0, 2, 2, 1, 38016, 0x3432e744
+0, 3, 3, 1, 38016, 0x7970aa2e
+0, 4, 4, 1, 38016, 0x250787bf
+0, 5, 5, 1, 38016, 0xd58e5e56
+0, 6, 6, 1, 38016, 0xf4b8580f
+0, 7, 7, 1, 38016, 0x9acb4096
+0, 8, 8, 1, 38016, 0xeed0476f
+0, 9, 9, 1, 38016, 0xe33846ef
+0, 10, 10, 1, 38016, 0x02da4e76
+0, 11, 11, 1, 38016, 0xd3e572f8
+0, 12, 12, 1, 38016, 0x5fd27f8a
+0, 13, 13, 1, 38016, 0xfa169823
+0, 14, 14, 1, 38016, 0xcc6b8d76
+0, 15, 15, 1, 38016, 0xcc4da11f
+0, 16, 16, 1, 38016, 0x32259b9d
+0, 17, 17, 1, 38016, 0xf1e39b70
+0, 18, 18, 1, 38016, 0xb49d7480
+0, 19, 19, 1, 38016, 0x3dc158e9
+0, 20, 20, 1, 38016, 0x4ce134db
+0, 21, 21, 1, 38016, 0x4fb30b43
+0, 22, 22, 1, 38016, 0xda49fe5f
+0, 23, 23, 1, 38016, 0x7fda0d68
+0, 24, 24, 1, 38016, 0x3a8b25e3
+0, 25, 25, 1, 38016, 0x3df11d4e
+0, 26, 26, 1, 38016, 0x26e11107
+0, 27, 27, 1, 38016, 0xdc3b03a7
+0, 28, 28, 1, 38016, 0x72b2434d
+0, 29, 29, 1, 38016, 0x2a013e27
+0, 30, 30, 1, 38016, 0xf95a4c2e
+0, 31, 31, 1, 38016, 0x1e7b6656
+0, 32, 32, 1, 38016, 0x776a81c8
+0, 33, 33, 1, 38016, 0x162cb0bf
+0, 34, 34, 1, 38016, 0x7ff4aaf5
+0, 35, 35, 1, 38016, 0x7150b50b
+0, 36, 36, 1, 38016, 0xf7d0b889
+0, 37, 37, 1, 38016, 0xbe09b5c2
+0, 38, 38, 1, 38016, 0xf6f7d29c
+0, 39, 39, 1, 38016, 0x4356b996
+0, 40, 40, 1, 38016, 0xb056c4b4
+0, 41, 41, 1, 38016, 0x38e9c6e6
+0, 42, 42, 1, 38016, 0x9c64ab45
+0, 43, 43, 1, 38016, 0x31189eef
+0, 44, 44, 1, 38016, 0x1ee3a3b1
+0, 45, 45, 1, 38016, 0x8bed7c95
+0, 46, 46, 1, 38016, 0x30357cee
+0, 47, 47, 1, 38016, 0x5d828428
+0, 48, 48, 1, 38016, 0xc06388b3
+0, 49, 49, 1, 38016, 0x2af597b4
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cavlc_mot_fld0_full_b b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cavlc_mot_fld0_full_b
index 6a77690..f80c3be 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cavlc_mot_fld0_full_b
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cavlc_mot_fld0_full_b
@@ -1,30 +1,31 @@
-0, 0, 518400, 0x99d0df36
-0, 3600, 518400, 0xa8601c1a
-0, 7200, 518400, 0x4a17d235
-0, 10800, 518400, 0x75f23abf
-0, 14400, 518400, 0x746aad53
-0, 18000, 518400, 0xb0b8913e
-0, 21600, 518400, 0x60a27f57
-0, 25200, 518400, 0xfa227f3e
-0, 28800, 518400, 0x7a1e57c2
-0, 32400, 518400, 0xcbbaa84f
-0, 36000, 518400, 0xf9c1bd13
-0, 39600, 518400, 0x9e80caaf
-0, 43200, 518400, 0x14cc6928
-0, 46800, 518400, 0xca0353ef
-0, 50400, 518400, 0xcad65e5f
-0, 54000, 518400, 0xd5bc47b3
-0, 57600, 518400, 0xa9893d36
-0, 61200, 518400, 0x69bd9085
-0, 64800, 518400, 0xff33c476
-0, 68400, 518400, 0x9538adf7
-0, 72000, 518400, 0xd4ff3b62
-0, 75600, 518400, 0x021a11fd
-0, 79200, 518400, 0x293e6f9f
-0, 82800, 518400, 0x5d38e4c3
-0, 86400, 518400, 0xd1f4ad49
-0, 90000, 518400, 0xf13dd946
-0, 93600, 518400, 0x0359e9ff
-0, 97200, 518400, 0xb61098ad
-0, 100800, 518400, 0xa855b11c
-0, 104400, 518400, 0x7fcf9343
+#tb 0: 1/25
+0, 0, 0, 1, 518400, 0x99d0df36
+0, 1, 1, 1, 518400, 0xa8601c1a
+0, 2, 2, 1, 518400, 0x4a17d235
+0, 3, 3, 1, 518400, 0x75f23abf
+0, 4, 4, 1, 518400, 0x746aad53
+0, 5, 5, 1, 518400, 0xb0b8913e
+0, 6, 6, 1, 518400, 0x60a27f57
+0, 7, 7, 1, 518400, 0xfa227f3e
+0, 8, 8, 1, 518400, 0x7a1e57c2
+0, 9, 9, 1, 518400, 0xcbbaa84f
+0, 10, 10, 1, 518400, 0xf9c1bd13
+0, 11, 11, 1, 518400, 0x9e80caaf
+0, 12, 12, 1, 518400, 0x14cc6928
+0, 13, 13, 1, 518400, 0xca0353ef
+0, 14, 14, 1, 518400, 0xcad65e5f
+0, 15, 15, 1, 518400, 0xd5bc47b3
+0, 16, 16, 1, 518400, 0xa9893d36
+0, 17, 17, 1, 518400, 0x69bd9085
+0, 18, 18, 1, 518400, 0xff33c476
+0, 19, 19, 1, 518400, 0x9538adf7
+0, 20, 20, 1, 518400, 0xd4ff3b62
+0, 21, 21, 1, 518400, 0x021a11fd
+0, 22, 22, 1, 518400, 0x293e6f9f
+0, 23, 23, 1, 518400, 0x5d38e4c3
+0, 24, 24, 1, 518400, 0xd1f4ad49
+0, 25, 25, 1, 518400, 0xf13dd946
+0, 26, 26, 1, 518400, 0x0359e9ff
+0, 27, 27, 1, 518400, 0xb61098ad
+0, 28, 28, 1, 518400, 0xa855b11c
+0, 29, 29, 1, 518400, 0x7fcf9343
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cavlc_mot_frm0_full_b b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cavlc_mot_frm0_full_b
index 5d29a40..edee4bf 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cavlc_mot_frm0_full_b
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cavlc_mot_frm0_full_b
@@ -1,30 +1,31 @@
-0, 0, 518400, 0x21baedbf
-0, 3600, 518400, 0x6003273c
-0, 7200, 518400, 0x935d45d7
-0, 10800, 518400, 0x00485000
-0, 14400, 518400, 0x31b191ff
-0, 18000, 518400, 0xe334135a
-0, 21600, 518400, 0xc4d7bf2c
-0, 25200, 518400, 0x7106ac82
-0, 28800, 518400, 0xeb277b07
-0, 32400, 518400, 0xaf1ee80f
-0, 36000, 518400, 0x8c7d1bad
-0, 39600, 518400, 0x0e24ae6c
-0, 43200, 518400, 0x89c216b4
-0, 46800, 518400, 0x991fbcb1
-0, 50400, 518400, 0x87411486
-0, 54000, 518400, 0x0151b48f
-0, 57600, 518400, 0x3f4d5a91
-0, 61200, 518400, 0x48ea911b
-0, 64800, 518400, 0x6bec19a0
-0, 68400, 518400, 0x10233bf6
-0, 72000, 518400, 0x2a36ae4d
-0, 75600, 518400, 0xd8d3224b
-0, 79200, 518400, 0xf5c5f81f
-0, 82800, 518400, 0x30054561
-0, 86400, 518400, 0x67ea1c9f
-0, 90000, 518400, 0xbbda3984
-0, 93600, 518400, 0x9af40c71
-0, 97200, 518400, 0xb0cf0d12
-0, 100800, 518400, 0x569b9866
-0, 104400, 518400, 0xffd72ee5
+#tb 0: 1/25
+0, 0, 0, 1, 518400, 0x21baedbf
+0, 1, 1, 1, 518400, 0x6003273c
+0, 2, 2, 1, 518400, 0x935d45d7
+0, 3, 3, 1, 518400, 0x00485000
+0, 4, 4, 1, 518400, 0x31b191ff
+0, 5, 5, 1, 518400, 0xe334135a
+0, 6, 6, 1, 518400, 0xc4d7bf2c
+0, 7, 7, 1, 518400, 0x7106ac82
+0, 8, 8, 1, 518400, 0xeb277b07
+0, 9, 9, 1, 518400, 0xaf1ee80f
+0, 10, 10, 1, 518400, 0x8c7d1bad
+0, 11, 11, 1, 518400, 0x0e24ae6c
+0, 12, 12, 1, 518400, 0x89c216b4
+0, 13, 13, 1, 518400, 0x991fbcb1
+0, 14, 14, 1, 518400, 0x87411486
+0, 15, 15, 1, 518400, 0x0151b48f
+0, 16, 16, 1, 518400, 0x3f4d5a91
+0, 17, 17, 1, 518400, 0x48ea911b
+0, 18, 18, 1, 518400, 0x6bec19a0
+0, 19, 19, 1, 518400, 0x10233bf6
+0, 20, 20, 1, 518400, 0x2a36ae4d
+0, 21, 21, 1, 518400, 0xd8d3224b
+0, 22, 22, 1, 518400, 0xf5c5f81f
+0, 23, 23, 1, 518400, 0x30054561
+0, 24, 24, 1, 518400, 0x67ea1c9f
+0, 25, 25, 1, 518400, 0xbbda3984
+0, 26, 26, 1, 518400, 0x9af40c71
+0, 27, 27, 1, 518400, 0xb0cf0d12
+0, 28, 28, 1, 518400, 0x569b9866
+0, 29, 29, 1, 518400, 0xffd72ee5
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cavlc_mot_mbaff0_full_b b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cavlc_mot_mbaff0_full_b
index 2b6d0d3..7d3ae3e 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cavlc_mot_mbaff0_full_b
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cavlc_mot_mbaff0_full_b
@@ -1,30 +1,31 @@
-0, 0, 518400, 0x4cecc821
-0, 3600, 518400, 0xee49ea81
-0, 7200, 518400, 0x78b0d65f
-0, 10800, 518400, 0x7fa72010
-0, 14400, 518400, 0xbc7fecdb
-0, 18000, 518400, 0xe54cf951
-0, 21600, 518400, 0x1e2795e0
-0, 25200, 518400, 0x7db968b9
-0, 28800, 518400, 0xcecb446b
-0, 32400, 518400, 0x4f813fc5
-0, 36000, 518400, 0xd0816131
-0, 39600, 518400, 0x6cf66cb7
-0, 43200, 518400, 0xac9913a1
-0, 46800, 518400, 0x0a2dd6ae
-0, 50400, 518400, 0x5de1acef
-0, 54000, 518400, 0x5ac7741e
-0, 57600, 518400, 0x4d2726de
-0, 61200, 518400, 0x6b9b2677
-0, 64800, 518400, 0x99b70e82
-0, 68400, 518400, 0x6a01ed56
-0, 72000, 518400, 0xa6976f95
-0, 75600, 518400, 0x645f6562
-0, 79200, 518400, 0xf750796b
-0, 82800, 518400, 0xe381ee9c
-0, 86400, 518400, 0xb7d45f84
-0, 90000, 518400, 0x7c9d79df
-0, 93600, 518400, 0x8a306a11
-0, 97200, 518400, 0x766fcf15
-0, 100800, 518400, 0x45c3cbdd
-0, 104400, 518400, 0x6a22610e
+#tb 0: 1/25
+0, 0, 0, 1, 518400, 0x4cecc821
+0, 1, 1, 1, 518400, 0xee49ea81
+0, 2, 2, 1, 518400, 0x78b0d65f
+0, 3, 3, 1, 518400, 0x7fa72010
+0, 4, 4, 1, 518400, 0xbc7fecdb
+0, 5, 5, 1, 518400, 0xe54cf951
+0, 6, 6, 1, 518400, 0x1e2795e0
+0, 7, 7, 1, 518400, 0x7db968b9
+0, 8, 8, 1, 518400, 0xcecb446b
+0, 9, 9, 1, 518400, 0x4f813fc5
+0, 10, 10, 1, 518400, 0xd0816131
+0, 11, 11, 1, 518400, 0x6cf66cb7
+0, 12, 12, 1, 518400, 0xac9913a1
+0, 13, 13, 1, 518400, 0x0a2dd6ae
+0, 14, 14, 1, 518400, 0x5de1acef
+0, 15, 15, 1, 518400, 0x5ac7741e
+0, 16, 16, 1, 518400, 0x4d2726de
+0, 17, 17, 1, 518400, 0x6b9b2677
+0, 18, 18, 1, 518400, 0x99b70e82
+0, 19, 19, 1, 518400, 0x6a01ed56
+0, 20, 20, 1, 518400, 0xa6976f95
+0, 21, 21, 1, 518400, 0x645f6562
+0, 22, 22, 1, 518400, 0xf750796b
+0, 23, 23, 1, 518400, 0xe381ee9c
+0, 24, 24, 1, 518400, 0xb7d45f84
+0, 25, 25, 1, 518400, 0x7c9d79df
+0, 26, 26, 1, 518400, 0x8a306a11
+0, 27, 27, 1, 518400, 0x766fcf15
+0, 28, 28, 1, 518400, 0x45c3cbdd
+0, 29, 29, 1, 518400, 0x6a22610e
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cavlc_mot_picaff0_full_b b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cavlc_mot_picaff0_full_b
index 741b94c..ed5e02e 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cavlc_mot_picaff0_full_b
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cavlc_mot_picaff0_full_b
@@ -1,30 +1,31 @@
-0, 0, 518400, 0xf6b83a0e
-0, 3600, 518400, 0xc5e8b8ee
-0, 7200, 518400, 0xb3bc6e43
-0, 10800, 518400, 0x5b08dc73
-0, 14400, 518400, 0x4a7f7690
-0, 18000, 518400, 0x8a9f4275
-0, 21600, 518400, 0xc7cb92fd
-0, 25200, 518400, 0xc721e231
-0, 28800, 518400, 0xfb31371b
-0, 32400, 518400, 0xac57f5d9
-0, 36000, 518400, 0x92b7debc
-0, 39600, 518400, 0xfe3e533e
-0, 43200, 518400, 0x1b3a7a72
-0, 46800, 518400, 0x98df2d81
-0, 50400, 518400, 0xe0ce9c52
-0, 54000, 518400, 0x6a31166d
-0, 57600, 518400, 0x64ffd4d2
-0, 61200, 518400, 0x3ec062ef
-0, 64800, 518400, 0x3480fae1
-0, 68400, 518400, 0xa87ae4b7
-0, 72000, 518400, 0xd301319f
-0, 75600, 518400, 0xa9284989
-0, 79200, 518400, 0x3de73b50
-0, 82800, 518400, 0x30a79f84
-0, 86400, 518400, 0x7d5152d4
-0, 90000, 518400, 0x25514095
-0, 93600, 518400, 0x1749a05f
-0, 97200, 518400, 0x598139a7
-0, 100800, 518400, 0x3cece862
-0, 104400, 518400, 0xe1c27efe
+#tb 0: 1/25
+0, 0, 0, 1, 518400, 0xf6b83a0e
+0, 1, 1, 1, 518400, 0xc5e8b8ee
+0, 2, 2, 1, 518400, 0xb3bc6e43
+0, 3, 3, 1, 518400, 0x5b08dc73
+0, 4, 4, 1, 518400, 0x4a7f7690
+0, 5, 5, 1, 518400, 0x8a9f4275
+0, 6, 6, 1, 518400, 0xc7cb92fd
+0, 7, 7, 1, 518400, 0xc721e231
+0, 8, 8, 1, 518400, 0xfb31371b
+0, 9, 9, 1, 518400, 0xac57f5d9
+0, 10, 10, 1, 518400, 0x92b7debc
+0, 11, 11, 1, 518400, 0xfe3e533e
+0, 12, 12, 1, 518400, 0x1b3a7a72
+0, 13, 13, 1, 518400, 0x98df2d81
+0, 14, 14, 1, 518400, 0xe0ce9c52
+0, 15, 15, 1, 518400, 0x6a31166d
+0, 16, 16, 1, 518400, 0x64ffd4d2
+0, 17, 17, 1, 518400, 0x3ec062ef
+0, 18, 18, 1, 518400, 0x3480fae1
+0, 19, 19, 1, 518400, 0xa87ae4b7
+0, 20, 20, 1, 518400, 0xd301319f
+0, 21, 21, 1, 518400, 0xa9284989
+0, 22, 22, 1, 518400, 0x3de73b50
+0, 23, 23, 1, 518400, 0x30a79f84
+0, 24, 24, 1, 518400, 0x7d5152d4
+0, 25, 25, 1, 518400, 0x25514095
+0, 26, 26, 1, 518400, 0x1749a05f
+0, 27, 27, 1, 518400, 0x598139a7
+0, 28, 28, 1, 518400, 0x3cece862
+0, 29, 29, 1, 518400, 0xe1c27efe
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cawp1_toshiba_e b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cawp1_toshiba_e
index 36223a3..e5a6944 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cawp1_toshiba_e
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cawp1_toshiba_e
@@ -1,90 +1,91 @@
-0, 0, 152064, 0xabf9ae05
-0, 3600, 152064, 0x20418b16
-0, 7200, 152064, 0xc26760ae
-0, 10800, 152064, 0x7ed0c861
-0, 14400, 152064, 0x1a13d207
-0, 18000, 152064, 0x700bdb09
-0, 21600, 152064, 0x7fa6476e
-0, 25200, 152064, 0x951158c6
-0, 28800, 152064, 0x263a2dfc
-0, 32400, 152064, 0xa25c5371
-0, 36000, 152064, 0xd67bd5c5
-0, 39600, 152064, 0x73e6d7c0
-0, 43200, 152064, 0x509967e4
-0, 46800, 152064, 0x27574b8f
-0, 50400, 152064, 0xa701d36f
-0, 54000, 152064, 0x3d457728
-0, 57600, 152064, 0xe9977098
-0, 61200, 152064, 0x33b3542b
-0, 64800, 152064, 0x5635d3fa
-0, 68400, 152064, 0x51dbc0bd
-0, 72000, 152064, 0xa2287df1
-0, 75600, 152064, 0x24533377
-0, 79200, 152064, 0xfd05e083
-0, 82800, 152064, 0xfadce02d
-0, 86400, 152064, 0xf67cc1da
-0, 90000, 152064, 0x4e7bc654
-0, 93600, 152064, 0x5b686f11
-0, 97200, 152064, 0xb8e33dc8
-0, 100800, 152064, 0x0ff224ca
-0, 104400, 152064, 0xcd98c152
-0, 108000, 152064, 0x4fdfb595
-0, 111600, 152064, 0xb1b7f4fc
-0, 115200, 152064, 0x666ccd6a
-0, 118800, 152064, 0x80e9c1a3
-0, 122400, 152064, 0x304b9be3
-0, 126000, 152064, 0x9741fb13
-0, 129600, 152064, 0x5e016501
-0, 133200, 152064, 0x50dd4139
-0, 136800, 152064, 0x9a4ef972
-0, 140400, 152064, 0x03b7da4e
-0, 144000, 152064, 0x17fd7d8a
-0, 147600, 152064, 0xc0137bb0
-0, 151200, 152064, 0xaf167d40
-0, 154800, 152064, 0xde191051
-0, 158400, 152064, 0x1cdcee05
-0, 162000, 152064, 0xa8d1b139
-0, 165600, 152064, 0xade6bf62
-0, 169200, 152064, 0x4515a552
-0, 172800, 152064, 0xb05036fe
-0, 176400, 152064, 0xfa500b17
-0, 180000, 152064, 0x512dec06
-0, 183600, 152064, 0x0e77ff69
-0, 187200, 152064, 0x06f7b2cd
-0, 190800, 152064, 0x9bc99b67
-0, 194400, 152064, 0x6b68301b
-0, 198000, 152064, 0xe31321ba
-0, 201600, 152064, 0x9ad0192e
-0, 205200, 152064, 0xcc14d7c8
-0, 208800, 152064, 0xf6ab91ec
-0, 212400, 152064, 0xf76afbce
-0, 216000, 152064, 0xb7d7f1dc
-0, 219600, 152064, 0xca95e688
-0, 223200, 152064, 0xc36bb8ac
-0, 226800, 152064, 0xc1c06a2e
-0, 230400, 152064, 0xf2a08f2a
-0, 234000, 152064, 0xb81013d2
-0, 237600, 152064, 0xf30cee41
-0, 241200, 152064, 0xad85c0d6
-0, 244800, 152064, 0x087b7807
-0, 248400, 152064, 0x178c39f0
-0, 252000, 152064, 0x6e0e3e66
-0, 255600, 152064, 0x9a020bcf
-0, 259200, 152064, 0xc33d4749
-0, 262800, 152064, 0x6370dbad
-0, 266400, 152064, 0x928cbe47
-0, 270000, 152064, 0xb8b036cc
-0, 273600, 152064, 0x79d92c37
-0, 277200, 152064, 0xc4cf0d8f
-0, 280800, 152064, 0xfe706c76
-0, 284400, 152064, 0x6a37de81
-0, 288000, 152064, 0x659eb2c1
-0, 291600, 152064, 0x0630855f
-0, 295200, 152064, 0xfa964f67
-0, 298800, 152064, 0xc5a1ff95
-0, 302400, 152064, 0xa131b89f
-0, 306000, 152064, 0x73007c16
-0, 309600, 152064, 0x4d237a3b
-0, 313200, 152064, 0xe68f44be
-0, 316800, 152064, 0x065f0be3
-0, 320400, 152064, 0x39cab454
+#tb 0: 1/25
+0, 0, 0, 1, 152064, 0xabf9ae05
+0, 1, 1, 1, 152064, 0x20418b16
+0, 2, 2, 1, 152064, 0xc26760ae
+0, 3, 3, 1, 152064, 0x7ed0c861
+0, 4, 4, 1, 152064, 0x1a13d207
+0, 5, 5, 1, 152064, 0x700bdb09
+0, 6, 6, 1, 152064, 0x7fa6476e
+0, 7, 7, 1, 152064, 0x951158c6
+0, 8, 8, 1, 152064, 0x263a2dfc
+0, 9, 9, 1, 152064, 0xa25c5371
+0, 10, 10, 1, 152064, 0xd67bd5c5
+0, 11, 11, 1, 152064, 0x73e6d7c0
+0, 12, 12, 1, 152064, 0x509967e4
+0, 13, 13, 1, 152064, 0x27574b8f
+0, 14, 14, 1, 152064, 0xa701d36f
+0, 15, 15, 1, 152064, 0x3d457728
+0, 16, 16, 1, 152064, 0xe9977098
+0, 17, 17, 1, 152064, 0x33b3542b
+0, 18, 18, 1, 152064, 0x5635d3fa
+0, 19, 19, 1, 152064, 0x51dbc0bd
+0, 20, 20, 1, 152064, 0xa2287df1
+0, 21, 21, 1, 152064, 0x24533377
+0, 22, 22, 1, 152064, 0xfd05e083
+0, 23, 23, 1, 152064, 0xfadce02d
+0, 24, 24, 1, 152064, 0xf67cc1da
+0, 25, 25, 1, 152064, 0x4e7bc654
+0, 26, 26, 1, 152064, 0x5b686f11
+0, 27, 27, 1, 152064, 0xb8e33dc8
+0, 28, 28, 1, 152064, 0x0ff224ca
+0, 29, 29, 1, 152064, 0xcd98c152
+0, 30, 30, 1, 152064, 0x4fdfb595
+0, 31, 31, 1, 152064, 0xb1b7f4fc
+0, 32, 32, 1, 152064, 0x666ccd6a
+0, 33, 33, 1, 152064, 0x80e9c1a3
+0, 34, 34, 1, 152064, 0x304b9be3
+0, 35, 35, 1, 152064, 0x9741fb13
+0, 36, 36, 1, 152064, 0x5e016501
+0, 37, 37, 1, 152064, 0x50dd4139
+0, 38, 38, 1, 152064, 0x9a4ef972
+0, 39, 39, 1, 152064, 0x03b7da4e
+0, 40, 40, 1, 152064, 0x17fd7d8a
+0, 41, 41, 1, 152064, 0xc0137bb0
+0, 42, 42, 1, 152064, 0xaf167d40
+0, 43, 43, 1, 152064, 0xde191051
+0, 44, 44, 1, 152064, 0x1cdcee05
+0, 45, 45, 1, 152064, 0xa8d1b139
+0, 46, 46, 1, 152064, 0xade6bf62
+0, 47, 47, 1, 152064, 0x4515a552
+0, 48, 48, 1, 152064, 0xb05036fe
+0, 49, 49, 1, 152064, 0xfa500b17
+0, 50, 50, 1, 152064, 0x512dec06
+0, 51, 51, 1, 152064, 0x0e77ff69
+0, 52, 52, 1, 152064, 0x06f7b2cd
+0, 53, 53, 1, 152064, 0x9bc99b67
+0, 54, 54, 1, 152064, 0x6b68301b
+0, 55, 55, 1, 152064, 0xe31321ba
+0, 56, 56, 1, 152064, 0x9ad0192e
+0, 57, 57, 1, 152064, 0xcc14d7c8
+0, 58, 58, 1, 152064, 0xf6ab91ec
+0, 59, 59, 1, 152064, 0xf76afbce
+0, 60, 60, 1, 152064, 0xb7d7f1dc
+0, 61, 61, 1, 152064, 0xca95e688
+0, 62, 62, 1, 152064, 0xc36bb8ac
+0, 63, 63, 1, 152064, 0xc1c06a2e
+0, 64, 64, 1, 152064, 0xf2a08f2a
+0, 65, 65, 1, 152064, 0xb81013d2
+0, 66, 66, 1, 152064, 0xf30cee41
+0, 67, 67, 1, 152064, 0xad85c0d6
+0, 68, 68, 1, 152064, 0x087b7807
+0, 69, 69, 1, 152064, 0x178c39f0
+0, 70, 70, 1, 152064, 0x6e0e3e66
+0, 71, 71, 1, 152064, 0x9a020bcf
+0, 72, 72, 1, 152064, 0xc33d4749
+0, 73, 73, 1, 152064, 0x6370dbad
+0, 74, 74, 1, 152064, 0x928cbe47
+0, 75, 75, 1, 152064, 0xb8b036cc
+0, 76, 76, 1, 152064, 0x79d92c37
+0, 77, 77, 1, 152064, 0xc4cf0d8f
+0, 78, 78, 1, 152064, 0xfe706c76
+0, 79, 79, 1, 152064, 0x6a37de81
+0, 80, 80, 1, 152064, 0x659eb2c1
+0, 81, 81, 1, 152064, 0x0630855f
+0, 82, 82, 1, 152064, 0xfa964f67
+0, 83, 83, 1, 152064, 0xc5a1ff95
+0, 84, 84, 1, 152064, 0xa131b89f
+0, 85, 85, 1, 152064, 0x73007c16
+0, 86, 86, 1, 152064, 0x4d237a3b
+0, 87, 87, 1, 152064, 0xe68f44be
+0, 88, 88, 1, 152064, 0x065f0be3
+0, 89, 89, 1, 152064, 0x39cab454
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cawp5_toshiba_e b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cawp5_toshiba_e
index 30f6912..5b48f8f 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cawp5_toshiba_e
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cawp5_toshiba_e
@@ -1,90 +1,91 @@
-0, 0, 152064, 0xabf9ae05
-0, 3600, 152064, 0x20418b16
-0, 7200, 152064, 0x20f72775
-0, 10800, 152064, 0x57c07111
-0, 14400, 152064, 0x1b49267f
-0, 18000, 152064, 0x024cd238
-0, 21600, 152064, 0x044d1ae0
-0, 25200, 152064, 0xbfec1b59
-0, 28800, 152064, 0x1a91f935
-0, 32400, 152064, 0x9ee184dc
-0, 36000, 152064, 0x65047dbe
-0, 39600, 152064, 0xd1632fb5
-0, 43200, 152064, 0x56f64c3e
-0, 46800, 152064, 0xe6122f37
-0, 50400, 152064, 0x0575e670
-0, 54000, 152064, 0x3d457728
-0, 57600, 152064, 0x6b508105
-0, 61200, 152064, 0xcaaf5ea7
-0, 64800, 152064, 0x9f4e4501
-0, 68400, 152064, 0x1c661a73
-0, 72000, 152064, 0x2fd9d1c8
-0, 75600, 152064, 0x4ac99ab1
-0, 79200, 152064, 0xf2d36809
-0, 82800, 152064, 0xa8e32ffb
-0, 86400, 152064, 0xd4da2fd2
-0, 90000, 152064, 0xac3adde0
-0, 93600, 152064, 0xf014ed0f
-0, 97200, 152064, 0xca2e7d28
-0, 100800, 152064, 0x3a875e51
-0, 104400, 152064, 0xc03e4bda
-0, 108000, 152064, 0x4fdfb595
-0, 111600, 152064, 0x9243f098
-0, 115200, 152064, 0x9361bae6
-0, 118800, 152064, 0x7a1dadee
-0, 122400, 152064, 0x72a59e15
-0, 126000, 152064, 0xb5b47170
-0, 129600, 152064, 0x5eb16651
-0, 133200, 152064, 0xe7894af7
-0, 136800, 152064, 0x2683bb0b
-0, 140400, 152064, 0x90b4c8c5
-0, 144000, 152064, 0xf800c5b5
-0, 147600, 152064, 0xc2f5a895
-0, 151200, 152064, 0x213c65d4
-0, 154800, 152064, 0x01c65a19
-0, 158400, 152064, 0xd9f1b04b
-0, 162000, 152064, 0xa8d1b139
-0, 165600, 152064, 0x2d0cb0cd
-0, 169200, 152064, 0x5b0783fe
-0, 172800, 152064, 0x29e628ec
-0, 176400, 152064, 0x1b8527e5
-0, 180000, 152064, 0x4b46d179
-0, 183600, 152064, 0x6184c708
-0, 187200, 152064, 0x697bb8e2
-0, 190800, 152064, 0x5fd3a772
-0, 194400, 152064, 0x91456c86
-0, 198000, 152064, 0x376c4dae
-0, 201600, 152064, 0x00ba2b3f
-0, 205200, 152064, 0xf6f0f553
-0, 208800, 152064, 0xc0020855
-0, 212400, 152064, 0xec3d13d2
-0, 216000, 152064, 0xb7d7f1dc
-0, 219600, 152064, 0xf9dae37b
-0, 223200, 152064, 0x50d9cc93
-0, 226800, 152064, 0xba1eb592
-0, 230400, 152064, 0x67616557
-0, 234000, 152064, 0x09804760
-0, 237600, 152064, 0xc2ffba00
-0, 241200, 152064, 0xb71fcf46
-0, 244800, 152064, 0x6cd975af
-0, 248400, 152064, 0x19189167
-0, 252000, 152064, 0xbca8fe71
-0, 255600, 152064, 0xb0b3f607
-0, 259200, 152064, 0x7614d73a
-0, 262800, 152064, 0x7de9d87d
-0, 266400, 152064, 0x81f58cf2
-0, 270000, 152064, 0xb8b036cc
-0, 273600, 152064, 0x26d1e2e4
-0, 277200, 152064, 0xb41a1e6c
-0, 280800, 152064, 0x4f9be4a9
-0, 284400, 152064, 0xe95ad5d3
-0, 288000, 152064, 0xdffc9335
-0, 291600, 152064, 0x01d658c0
-0, 295200, 152064, 0x631b4b75
-0, 298800, 152064, 0x80ae282f
-0, 302400, 152064, 0xb34bf688
-0, 306000, 152064, 0xd0cc7d65
-0, 309600, 152064, 0x86aa4590
-0, 313200, 152064, 0xcb515a57
-0, 316800, 152064, 0x68650834
-0, 320400, 152064, 0x444ee2a4
+#tb 0: 1/25
+0, 0, 0, 1, 152064, 0xabf9ae05
+0, 1, 1, 1, 152064, 0x20418b16
+0, 2, 2, 1, 152064, 0x20f72775
+0, 3, 3, 1, 152064, 0x57c07111
+0, 4, 4, 1, 152064, 0x1b49267f
+0, 5, 5, 1, 152064, 0x024cd238
+0, 6, 6, 1, 152064, 0x044d1ae0
+0, 7, 7, 1, 152064, 0xbfec1b59
+0, 8, 8, 1, 152064, 0x1a91f935
+0, 9, 9, 1, 152064, 0x9ee184dc
+0, 10, 10, 1, 152064, 0x65047dbe
+0, 11, 11, 1, 152064, 0xd1632fb5
+0, 12, 12, 1, 152064, 0x56f64c3e
+0, 13, 13, 1, 152064, 0xe6122f37
+0, 14, 14, 1, 152064, 0x0575e670
+0, 15, 15, 1, 152064, 0x3d457728
+0, 16, 16, 1, 152064, 0x6b508105
+0, 17, 17, 1, 152064, 0xcaaf5ea7
+0, 18, 18, 1, 152064, 0x9f4e4501
+0, 19, 19, 1, 152064, 0x1c661a73
+0, 20, 20, 1, 152064, 0x2fd9d1c8
+0, 21, 21, 1, 152064, 0x4ac99ab1
+0, 22, 22, 1, 152064, 0xf2d36809
+0, 23, 23, 1, 152064, 0xa8e32ffb
+0, 24, 24, 1, 152064, 0xd4da2fd2
+0, 25, 25, 1, 152064, 0xac3adde0
+0, 26, 26, 1, 152064, 0xf014ed0f
+0, 27, 27, 1, 152064, 0xca2e7d28
+0, 28, 28, 1, 152064, 0x3a875e51
+0, 29, 29, 1, 152064, 0xc03e4bda
+0, 30, 30, 1, 152064, 0x4fdfb595
+0, 31, 31, 1, 152064, 0x9243f098
+0, 32, 32, 1, 152064, 0x9361bae6
+0, 33, 33, 1, 152064, 0x7a1dadee
+0, 34, 34, 1, 152064, 0x72a59e15
+0, 35, 35, 1, 152064, 0xb5b47170
+0, 36, 36, 1, 152064, 0x5eb16651
+0, 37, 37, 1, 152064, 0xe7894af7
+0, 38, 38, 1, 152064, 0x2683bb0b
+0, 39, 39, 1, 152064, 0x90b4c8c5
+0, 40, 40, 1, 152064, 0xf800c5b5
+0, 41, 41, 1, 152064, 0xc2f5a895
+0, 42, 42, 1, 152064, 0x213c65d4
+0, 43, 43, 1, 152064, 0x01c65a19
+0, 44, 44, 1, 152064, 0xd9f1b04b
+0, 45, 45, 1, 152064, 0xa8d1b139
+0, 46, 46, 1, 152064, 0x2d0cb0cd
+0, 47, 47, 1, 152064, 0x5b0783fe
+0, 48, 48, 1, 152064, 0x29e628ec
+0, 49, 49, 1, 152064, 0x1b8527e5
+0, 50, 50, 1, 152064, 0x4b46d179
+0, 51, 51, 1, 152064, 0x6184c708
+0, 52, 52, 1, 152064, 0x697bb8e2
+0, 53, 53, 1, 152064, 0x5fd3a772
+0, 54, 54, 1, 152064, 0x91456c86
+0, 55, 55, 1, 152064, 0x376c4dae
+0, 56, 56, 1, 152064, 0x00ba2b3f
+0, 57, 57, 1, 152064, 0xf6f0f553
+0, 58, 58, 1, 152064, 0xc0020855
+0, 59, 59, 1, 152064, 0xec3d13d2
+0, 60, 60, 1, 152064, 0xb7d7f1dc
+0, 61, 61, 1, 152064, 0xf9dae37b
+0, 62, 62, 1, 152064, 0x50d9cc93
+0, 63, 63, 1, 152064, 0xba1eb592
+0, 64, 64, 1, 152064, 0x67616557
+0, 65, 65, 1, 152064, 0x09804760
+0, 66, 66, 1, 152064, 0xc2ffba00
+0, 67, 67, 1, 152064, 0xb71fcf46
+0, 68, 68, 1, 152064, 0x6cd975af
+0, 69, 69, 1, 152064, 0x19189167
+0, 70, 70, 1, 152064, 0xbca8fe71
+0, 71, 71, 1, 152064, 0xb0b3f607
+0, 72, 72, 1, 152064, 0x7614d73a
+0, 73, 73, 1, 152064, 0x7de9d87d
+0, 74, 74, 1, 152064, 0x81f58cf2
+0, 75, 75, 1, 152064, 0xb8b036cc
+0, 76, 76, 1, 152064, 0x26d1e2e4
+0, 77, 77, 1, 152064, 0xb41a1e6c
+0, 78, 78, 1, 152064, 0x4f9be4a9
+0, 79, 79, 1, 152064, 0xe95ad5d3
+0, 80, 80, 1, 152064, 0xdffc9335
+0, 81, 81, 1, 152064, 0x01d658c0
+0, 82, 82, 1, 152064, 0x631b4b75
+0, 83, 83, 1, 152064, 0x80ae282f
+0, 84, 84, 1, 152064, 0xb34bf688
+0, 85, 85, 1, 152064, 0xd0cc7d65
+0, 86, 86, 1, 152064, 0x86aa4590
+0, 87, 87, 1, 152064, 0xcb515a57
+0, 88, 88, 1, 152064, 0x68650834
+0, 89, 89, 1, 152064, 0x444ee2a4
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-ci1_ft_b b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-ci1_ft_b
index b2dca70..08e40f4 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-ci1_ft_b
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-ci1_ft_b
@@ -1,291 +1,292 @@
-0, 0, 152064, 0xb291a678
-0, 3600, 152064, 0x913c5a5d
-0, 7200, 152064, 0x9558a372
-0, 10800, 152064, 0x5e521e9b
-0, 14400, 152064, 0xbc2c7bd7
-0, 18000, 152064, 0x8867cc80
-0, 21600, 152064, 0xae394b0b
-0, 25200, 152064, 0x15d9c120
-0, 28800, 152064, 0xffe01d0f
-0, 32400, 152064, 0xf90a1d50
-0, 36000, 152064, 0x7b9b6a02
-0, 39600, 152064, 0x687f5afa
-0, 43200, 152064, 0x6bf7b8a2
-0, 46800, 152064, 0x45cb58e9
-0, 50400, 152064, 0xc4246ef0
-0, 54000, 152064, 0xa19dbe0a
-0, 57600, 152064, 0xe297eaa9
-0, 61200, 152064, 0x8f4300bc
-0, 64800, 152064, 0x9a541a18
-0, 68400, 152064, 0xf3b51480
-0, 72000, 152064, 0x5a191303
-0, 75600, 152064, 0x2e887f27
-0, 79200, 152064, 0xf050d46d
-0, 82800, 152064, 0xc31c6716
-0, 86400, 152064, 0x37761725
-0, 90000, 152064, 0x81141cf6
-0, 93600, 152064, 0x181f7e61
-0, 97200, 152064, 0x9fc2b668
-0, 100800, 152064, 0x3716f5da
-0, 104400, 152064, 0x3b28f0c9
-0, 108000, 152064, 0xe33bd972
-0, 111600, 152064, 0x948ccdaa
-0, 115200, 152064, 0x21fdc6c2
-0, 118800, 152064, 0x3874b6fc
-0, 122400, 152064, 0x07b7a748
-0, 126000, 152064, 0x7aee8b8d
-0, 129600, 152064, 0x013d7552
-0, 133200, 152064, 0x9631487e
-0, 136800, 152064, 0xd9a109d6
-0, 140400, 152064, 0x7b450b1b
-0, 144000, 152064, 0x25f0cb06
-0, 147600, 152064, 0x6542aa9c
-0, 151200, 152064, 0x40ba9bd7
-0, 154800, 152064, 0x2dc7d564
-0, 158400, 152064, 0x4534a83f
-0, 162000, 152064, 0x671551a3
-0, 165600, 152064, 0xc69a9a28
-0, 169200, 152064, 0x899be59a
-0, 172800, 152064, 0x1adb6455
-0, 176400, 152064, 0x5d34066b
-0, 180000, 152064, 0x17f4dcec
-0, 183600, 152064, 0xcc9fd4b1
-0, 187200, 152064, 0x329aaeb5
-0, 190800, 152064, 0x4532a3f0
-0, 194400, 152064, 0xb0440be3
-0, 198000, 152064, 0x9055a9e2
-0, 201600, 152064, 0x1f5b4730
-0, 205200, 152064, 0x55fc2ba8
-0, 208800, 152064, 0x6adc911a
-0, 212400, 152064, 0x4968851f
-0, 216000, 152064, 0x31a86628
-0, 219600, 152064, 0x7223240a
-0, 223200, 152064, 0xb982e88e
-0, 226800, 152064, 0xba45b5ea
-0, 230400, 152064, 0x72f55121
-0, 234000, 152064, 0x36c59af9
-0, 237600, 152064, 0x6fc51449
-0, 241200, 152064, 0xbd9d99b7
-0, 244800, 152064, 0x0bd3a6e7
-0, 248400, 152064, 0x5a5d0203
-0, 252000, 152064, 0x44a26951
-0, 255600, 152064, 0xfe9fcff5
-0, 259200, 152064, 0xce25a939
-0, 262800, 152064, 0xdf7c1b79
-0, 266400, 152064, 0xe82a1c4c
-0, 270000, 152064, 0x946b20d7
-0, 273600, 152064, 0x5d4887d2
-0, 277200, 152064, 0xadfe1034
-0, 280800, 152064, 0x6d20b119
-0, 284400, 152064, 0x8e414e12
-0, 288000, 152064, 0x06effdf9
-0, 291600, 152064, 0x3073e4f5
-0, 295200, 152064, 0xa0ef2291
-0, 298800, 152064, 0x3feb2cf6
-0, 302400, 152064, 0x3e77b0c8
-0, 306000, 152064, 0xdbce3b7a
-0, 309600, 152064, 0x15e0b088
-0, 313200, 152064, 0xb05bb465
-0, 316800, 152064, 0x63423915
-0, 320400, 152064, 0x290210f4
-0, 324000, 152064, 0x4d14cc43
-0, 327600, 152064, 0x4a5509fe
-0, 331200, 152064, 0x110c6420
-0, 334800, 152064, 0xbe614dfb
-0, 338400, 152064, 0xa6311469
-0, 342000, 152064, 0x198b6b73
-0, 345600, 152064, 0xe96fe872
-0, 349200, 152064, 0x7a7a6937
-0, 352800, 152064, 0xfe2b868d
-0, 356400, 152064, 0x9e0bbb2b
-0, 360000, 152064, 0x53dbdf39
-0, 363600, 152064, 0xee90ba8e
-0, 367200, 152064, 0x38bcb94d
-0, 370800, 152064, 0x16a6d9bb
-0, 374400, 152064, 0x450ae454
-0, 378000, 152064, 0x7d98fcf4
-0, 381600, 152064, 0xc54ed4cf
-0, 385200, 152064, 0x560d74ac
-0, 388800, 152064, 0xb203fc98
-0, 392400, 152064, 0xb085b576
-0, 396000, 152064, 0x05e16f79
-0, 399600, 152064, 0x90cd4c73
-0, 403200, 152064, 0x4dd42a7f
-0, 406800, 152064, 0x26b9e35c
-0, 410400, 152064, 0x70cbb417
-0, 414000, 152064, 0x0a1bc4a9
-0, 417600, 152064, 0xe08fdbc9
-0, 421200, 152064, 0x8768cd49
-0, 424800, 152064, 0x80a4b575
-0, 428400, 152064, 0x68478ea6
-0, 432000, 152064, 0x8f8c589d
-0, 435600, 152064, 0x8ee4345c
-0, 439200, 152064, 0x93911901
-0, 442800, 152064, 0x38fb4298
-0, 446400, 152064, 0x8bee60e7
-0, 450000, 152064, 0x3f906dbd
-0, 453600, 152064, 0x9de2a984
-0, 457200, 152064, 0x64c804e0
-0, 460800, 152064, 0x4757c864
-0, 464400, 152064, 0xe6f43905
-0, 468000, 152064, 0x8ad2e577
-0, 471600, 152064, 0x1b06977e
-0, 475200, 152064, 0xe92a2dfa
-0, 478800, 152064, 0x97b993fa
-0, 482400, 152064, 0x1602de2d
-0, 486000, 152064, 0x6dda24f1
-0, 489600, 152064, 0x5552ec9d
-0, 493200, 152064, 0xcce058e8
-0, 496800, 152064, 0x4359bccd
-0, 500400, 152064, 0xe41d77d0
-0, 504000, 152064, 0x05730d21
-0, 507600, 152064, 0xa963bf92
-0, 511200, 152064, 0x3f4d8e29
-0, 514800, 152064, 0x385d2403
-0, 518400, 152064, 0xd8e279d6
-0, 522000, 152064, 0xcfcb3713
-0, 525600, 152064, 0xd68d57d4
-0, 529200, 152064, 0xdaecd2d6
-0, 532800, 152064, 0x7c1805cf
-0, 536400, 152064, 0x19969137
-0, 540000, 152064, 0x15007e0c
-0, 543600, 152064, 0xf4f5011a
-0, 547200, 152064, 0x792793e3
-0, 550800, 152064, 0x1c4126f9
-0, 554400, 152064, 0xfaeb9465
-0, 558000, 152064, 0x3366c5c6
-0, 561600, 152064, 0x8efa29ed
-0, 565200, 152064, 0x2b36d937
-0, 568800, 152064, 0x4cfc993f
-0, 572400, 152064, 0x0809f8f8
-0, 576000, 152064, 0x5be26710
-0, 579600, 152064, 0x6d757860
-0, 583200, 152064, 0xf4e8706d
-0, 586800, 152064, 0xec42387d
-0, 590400, 152064, 0x828f02e1
-0, 594000, 152064, 0x45a0954c
-0, 597600, 152064, 0xbcca1065
-0, 601200, 152064, 0xd5946707
-0, 604800, 152064, 0x6887cbcb
-0, 608400, 152064, 0x63fc7423
-0, 612000, 152064, 0x3339ebc2
-0, 615600, 152064, 0x6419e277
-0, 619200, 152064, 0xe9cd70aa
-0, 622800, 152064, 0x23903b35
-0, 626400, 152064, 0xd83d028a
-0, 630000, 152064, 0x79e21536
-0, 633600, 152064, 0x81cc6027
-0, 637200, 152064, 0x56334e89
-0, 640800, 152064, 0xe32e532e
-0, 644400, 152064, 0x528832b4
-0, 648000, 152064, 0x348da007
-0, 651600, 152064, 0x5104b2e8
-0, 655200, 152064, 0x7b0d1f8f
-0, 658800, 152064, 0x6750c77c
-0, 662400, 152064, 0x3a8f2faa
-0, 666000, 152064, 0x8a24a116
-0, 669600, 152064, 0x82d00d82
-0, 673200, 152064, 0xc6f5b11a
-0, 676800, 152064, 0x2b352039
-0, 680400, 152064, 0x7c067e22
-0, 684000, 152064, 0xc975d80d
-0, 687600, 152064, 0xa49978ed
-0, 691200, 152064, 0x441f703e
-0, 694800, 152064, 0x5cb150c5
-0, 698400, 152064, 0xeeda6c8e
-0, 702000, 152064, 0xe9e0ce47
-0, 705600, 152064, 0xba55acbd
-0, 709200, 152064, 0xae8250e5
-0, 712800, 152064, 0xf438f2e8
-0, 716400, 152064, 0xe6263d10
-0, 720000, 152064, 0x8d13277a
-0, 723600, 152064, 0x4bfb4aab
-0, 727200, 152064, 0x1c0a78ea
-0, 730800, 152064, 0xa0651778
-0, 734400, 152064, 0xa309ca66
-0, 738000, 152064, 0x294c750b
-0, 741600, 152064, 0xd55d6881
-0, 745200, 152064, 0x8d002b72
-0, 748800, 152064, 0xe0ae5976
-0, 752400, 152064, 0xc6f28961
-0, 756000, 152064, 0x6fb5899d
-0, 759600, 152064, 0x046f3445
-0, 763200, 152064, 0x9b2d5779
-0, 766800, 152064, 0xeb9db946
-0, 770400, 152064, 0x190bdc3b
-0, 774000, 152064, 0xb9ae5c7b
-0, 777600, 152064, 0xca07ad32
-0, 781200, 152064, 0x8d1fee22
-0, 784800, 152064, 0x446470dd
-0, 788400, 152064, 0x8802cf93
-0, 792000, 152064, 0x8bbaeb30
-0, 795600, 152064, 0xfe4e7fdf
-0, 799200, 152064, 0xc6379dc7
-0, 802800, 152064, 0xaa53198b
-0, 806400, 152064, 0x88d6d37c
-0, 810000, 152064, 0xd1b89370
-0, 813600, 152064, 0xdab349f4
-0, 817200, 152064, 0x4702c238
-0, 820800, 152064, 0xfaa893bb
-0, 824400, 152064, 0x515b940e
-0, 828000, 152064, 0x4d86d838
-0, 831600, 152064, 0xe3815641
-0, 835200, 152064, 0x0e501c17
-0, 838800, 152064, 0x449df073
-0, 842400, 152064, 0xc06daa27
-0, 846000, 152064, 0x72f5394c
-0, 849600, 152064, 0x18be9f70
-0, 853200, 152064, 0xc508213a
-0, 856800, 152064, 0xa616a322
-0, 860400, 152064, 0x1a5d09e5
-0, 864000, 152064, 0xf6e78051
-0, 867600, 152064, 0x8945ad83
-0, 871200, 152064, 0xa06fd95d
-0, 874800, 152064, 0x7d86f015
-0, 878400, 152064, 0x768af87c
-0, 882000, 152064, 0xffa2e8d9
-0, 885600, 152064, 0x2ac0d2df
-0, 889200, 152064, 0x40c27662
-0, 892800, 152064, 0xfcc7580a
-0, 896400, 152064, 0xcdbd51f0
-0, 900000, 152064, 0xe0d754ec
-0, 903600, 152064, 0xbfb59395
-0, 907200, 152064, 0x26f6db71
-0, 910800, 152064, 0x1d85f144
-0, 914400, 152064, 0xfacbfbd9
-0, 918000, 152064, 0x55bdf6b8
-0, 921600, 152064, 0x9c89e3f8
-0, 925200, 152064, 0x6e90c4bd
-0, 928800, 152064, 0x3b19a944
-0, 932400, 152064, 0xcb527670
-0, 936000, 152064, 0xc0ec5c7b
-0, 939600, 152064, 0x7f5f4814
-0, 943200, 152064, 0xb0983900
-0, 946800, 152064, 0xc57534a6
-0, 950400, 152064, 0xd37b30b9
-0, 954000, 152064, 0x61fe2e9f
-0, 957600, 152064, 0x613d2e8a
-0, 961200, 152064, 0x9bc5224b
-0, 964800, 152064, 0x246122c2
-0, 968400, 152064, 0x28811a8f
-0, 972000, 152064, 0x609cfcbf
-0, 975600, 152064, 0x9c5aee70
-0, 979200, 152064, 0x06d7e997
-0, 982800, 152064, 0xcb3e1e4a
-0, 986400, 152064, 0x65e36256
-0, 990000, 152064, 0x571eb628
-0, 993600, 152064, 0x9e940be8
-0, 997200, 152064, 0x425a374b
-0, 1000800, 152064, 0xbeed72a2
-0, 1004400, 152064, 0x295bb61d
-0, 1008000, 152064, 0xfe2df639
-0, 1011600, 152064, 0xbd4f441a
-0, 1015200, 152064, 0x61ce59bc
-0, 1018800, 152064, 0xd5eb825f
-0, 1022400, 152064, 0xc03cb656
-0, 1026000, 152064, 0xfc10c1f6
-0, 1029600, 152064, 0xb93908dc
-0, 1033200, 152064, 0xbc2d3209
-0, 1036800, 152064, 0xcc267ab3
-0, 1040400, 152064, 0x32629fa0
-0, 1044000, 152064, 0x5d5bb942
+#tb 0: 1/25
+0, 0, 0, 1, 152064, 0xb291a678
+0, 1, 1, 1, 152064, 0x913c5a5d
+0, 2, 2, 1, 152064, 0x9558a372
+0, 3, 3, 1, 152064, 0x5e521e9b
+0, 4, 4, 1, 152064, 0xbc2c7bd7
+0, 5, 5, 1, 152064, 0x8867cc80
+0, 6, 6, 1, 152064, 0xae394b0b
+0, 7, 7, 1, 152064, 0x15d9c120
+0, 8, 8, 1, 152064, 0xffe01d0f
+0, 9, 9, 1, 152064, 0xf90a1d50
+0, 10, 10, 1, 152064, 0x7b9b6a02
+0, 11, 11, 1, 152064, 0x687f5afa
+0, 12, 12, 1, 152064, 0x6bf7b8a2
+0, 13, 13, 1, 152064, 0x45cb58e9
+0, 14, 14, 1, 152064, 0xc4246ef0
+0, 15, 15, 1, 152064, 0xa19dbe0a
+0, 16, 16, 1, 152064, 0xe297eaa9
+0, 17, 17, 1, 152064, 0x8f4300bc
+0, 18, 18, 1, 152064, 0x9a541a18
+0, 19, 19, 1, 152064, 0xf3b51480
+0, 20, 20, 1, 152064, 0x5a191303
+0, 21, 21, 1, 152064, 0x2e887f27
+0, 22, 22, 1, 152064, 0xf050d46d
+0, 23, 23, 1, 152064, 0xc31c6716
+0, 24, 24, 1, 152064, 0x37761725
+0, 25, 25, 1, 152064, 0x81141cf6
+0, 26, 26, 1, 152064, 0x181f7e61
+0, 27, 27, 1, 152064, 0x9fc2b668
+0, 28, 28, 1, 152064, 0x3716f5da
+0, 29, 29, 1, 152064, 0x3b28f0c9
+0, 30, 30, 1, 152064, 0xe33bd972
+0, 31, 31, 1, 152064, 0x948ccdaa
+0, 32, 32, 1, 152064, 0x21fdc6c2
+0, 33, 33, 1, 152064, 0x3874b6fc
+0, 34, 34, 1, 152064, 0x07b7a748
+0, 35, 35, 1, 152064, 0x7aee8b8d
+0, 36, 36, 1, 152064, 0x013d7552
+0, 37, 37, 1, 152064, 0x9631487e
+0, 38, 38, 1, 152064, 0xd9a109d6
+0, 39, 39, 1, 152064, 0x7b450b1b
+0, 40, 40, 1, 152064, 0x25f0cb06
+0, 41, 41, 1, 152064, 0x6542aa9c
+0, 42, 42, 1, 152064, 0x40ba9bd7
+0, 43, 43, 1, 152064, 0x2dc7d564
+0, 44, 44, 1, 152064, 0x4534a83f
+0, 45, 45, 1, 152064, 0x671551a3
+0, 46, 46, 1, 152064, 0xc69a9a28
+0, 47, 47, 1, 152064, 0x899be59a
+0, 48, 48, 1, 152064, 0x1adb6455
+0, 49, 49, 1, 152064, 0x5d34066b
+0, 50, 50, 1, 152064, 0x17f4dcec
+0, 51, 51, 1, 152064, 0xcc9fd4b1
+0, 52, 52, 1, 152064, 0x329aaeb5
+0, 53, 53, 1, 152064, 0x4532a3f0
+0, 54, 54, 1, 152064, 0xb0440be3
+0, 55, 55, 1, 152064, 0x9055a9e2
+0, 56, 56, 1, 152064, 0x1f5b4730
+0, 57, 57, 1, 152064, 0x55fc2ba8
+0, 58, 58, 1, 152064, 0x6adc911a
+0, 59, 59, 1, 152064, 0x4968851f
+0, 60, 60, 1, 152064, 0x31a86628
+0, 61, 61, 1, 152064, 0x7223240a
+0, 62, 62, 1, 152064, 0xb982e88e
+0, 63, 63, 1, 152064, 0xba45b5ea
+0, 64, 64, 1, 152064, 0x72f55121
+0, 65, 65, 1, 152064, 0x36c59af9
+0, 66, 66, 1, 152064, 0x6fc51449
+0, 67, 67, 1, 152064, 0xbd9d99b7
+0, 68, 68, 1, 152064, 0x0bd3a6e7
+0, 69, 69, 1, 152064, 0x5a5d0203
+0, 70, 70, 1, 152064, 0x44a26951
+0, 71, 71, 1, 152064, 0xfe9fcff5
+0, 72, 72, 1, 152064, 0xce25a939
+0, 73, 73, 1, 152064, 0xdf7c1b79
+0, 74, 74, 1, 152064, 0xe82a1c4c
+0, 75, 75, 1, 152064, 0x946b20d7
+0, 76, 76, 1, 152064, 0x5d4887d2
+0, 77, 77, 1, 152064, 0xadfe1034
+0, 78, 78, 1, 152064, 0x6d20b119
+0, 79, 79, 1, 152064, 0x8e414e12
+0, 80, 80, 1, 152064, 0x06effdf9
+0, 81, 81, 1, 152064, 0x3073e4f5
+0, 82, 82, 1, 152064, 0xa0ef2291
+0, 83, 83, 1, 152064, 0x3feb2cf6
+0, 84, 84, 1, 152064, 0x3e77b0c8
+0, 85, 85, 1, 152064, 0xdbce3b7a
+0, 86, 86, 1, 152064, 0x15e0b088
+0, 87, 87, 1, 152064, 0xb05bb465
+0, 88, 88, 1, 152064, 0x63423915
+0, 89, 89, 1, 152064, 0x290210f4
+0, 90, 90, 1, 152064, 0x4d14cc43
+0, 91, 91, 1, 152064, 0x4a5509fe
+0, 92, 92, 1, 152064, 0x110c6420
+0, 93, 93, 1, 152064, 0xbe614dfb
+0, 94, 94, 1, 152064, 0xa6311469
+0, 95, 95, 1, 152064, 0x198b6b73
+0, 96, 96, 1, 152064, 0xe96fe872
+0, 97, 97, 1, 152064, 0x7a7a6937
+0, 98, 98, 1, 152064, 0xfe2b868d
+0, 99, 99, 1, 152064, 0x9e0bbb2b
+0, 100, 100, 1, 152064, 0x53dbdf39
+0, 101, 101, 1, 152064, 0xee90ba8e
+0, 102, 102, 1, 152064, 0x38bcb94d
+0, 103, 103, 1, 152064, 0x16a6d9bb
+0, 104, 104, 1, 152064, 0x450ae454
+0, 105, 105, 1, 152064, 0x7d98fcf4
+0, 106, 106, 1, 152064, 0xc54ed4cf
+0, 107, 107, 1, 152064, 0x560d74ac
+0, 108, 108, 1, 152064, 0xb203fc98
+0, 109, 109, 1, 152064, 0xb085b576
+0, 110, 110, 1, 152064, 0x05e16f79
+0, 111, 111, 1, 152064, 0x90cd4c73
+0, 112, 112, 1, 152064, 0x4dd42a7f
+0, 113, 113, 1, 152064, 0x26b9e35c
+0, 114, 114, 1, 152064, 0x70cbb417
+0, 115, 115, 1, 152064, 0x0a1bc4a9
+0, 116, 116, 1, 152064, 0xe08fdbc9
+0, 117, 117, 1, 152064, 0x8768cd49
+0, 118, 118, 1, 152064, 0x80a4b575
+0, 119, 119, 1, 152064, 0x68478ea6
+0, 120, 120, 1, 152064, 0x8f8c589d
+0, 121, 121, 1, 152064, 0x8ee4345c
+0, 122, 122, 1, 152064, 0x93911901
+0, 123, 123, 1, 152064, 0x38fb4298
+0, 124, 124, 1, 152064, 0x8bee60e7
+0, 125, 125, 1, 152064, 0x3f906dbd
+0, 126, 126, 1, 152064, 0x9de2a984
+0, 127, 127, 1, 152064, 0x64c804e0
+0, 128, 128, 1, 152064, 0x4757c864
+0, 129, 129, 1, 152064, 0xe6f43905
+0, 130, 130, 1, 152064, 0x8ad2e577
+0, 131, 131, 1, 152064, 0x1b06977e
+0, 132, 132, 1, 152064, 0xe92a2dfa
+0, 133, 133, 1, 152064, 0x97b993fa
+0, 134, 134, 1, 152064, 0x1602de2d
+0, 135, 135, 1, 152064, 0x6dda24f1
+0, 136, 136, 1, 152064, 0x5552ec9d
+0, 137, 137, 1, 152064, 0xcce058e8
+0, 138, 138, 1, 152064, 0x4359bccd
+0, 139, 139, 1, 152064, 0xe41d77d0
+0, 140, 140, 1, 152064, 0x05730d21
+0, 141, 141, 1, 152064, 0xa963bf92
+0, 142, 142, 1, 152064, 0x3f4d8e29
+0, 143, 143, 1, 152064, 0x385d2403
+0, 144, 144, 1, 152064, 0xd8e279d6
+0, 145, 145, 1, 152064, 0xcfcb3713
+0, 146, 146, 1, 152064, 0xd68d57d4
+0, 147, 147, 1, 152064, 0xdaecd2d6
+0, 148, 148, 1, 152064, 0x7c1805cf
+0, 149, 149, 1, 152064, 0x19969137
+0, 150, 150, 1, 152064, 0x15007e0c
+0, 151, 151, 1, 152064, 0xf4f5011a
+0, 152, 152, 1, 152064, 0x792793e3
+0, 153, 153, 1, 152064, 0x1c4126f9
+0, 154, 154, 1, 152064, 0xfaeb9465
+0, 155, 155, 1, 152064, 0x3366c5c6
+0, 156, 156, 1, 152064, 0x8efa29ed
+0, 157, 157, 1, 152064, 0x2b36d937
+0, 158, 158, 1, 152064, 0x4cfc993f
+0, 159, 159, 1, 152064, 0x0809f8f8
+0, 160, 160, 1, 152064, 0x5be26710
+0, 161, 161, 1, 152064, 0x6d757860
+0, 162, 162, 1, 152064, 0xf4e8706d
+0, 163, 163, 1, 152064, 0xec42387d
+0, 164, 164, 1, 152064, 0x828f02e1
+0, 165, 165, 1, 152064, 0x45a0954c
+0, 166, 166, 1, 152064, 0xbcca1065
+0, 167, 167, 1, 152064, 0xd5946707
+0, 168, 168, 1, 152064, 0x6887cbcb
+0, 169, 169, 1, 152064, 0x63fc7423
+0, 170, 170, 1, 152064, 0x3339ebc2
+0, 171, 171, 1, 152064, 0x6419e277
+0, 172, 172, 1, 152064, 0xe9cd70aa
+0, 173, 173, 1, 152064, 0x23903b35
+0, 174, 174, 1, 152064, 0xd83d028a
+0, 175, 175, 1, 152064, 0x79e21536
+0, 176, 176, 1, 152064, 0x81cc6027
+0, 177, 177, 1, 152064, 0x56334e89
+0, 178, 178, 1, 152064, 0xe32e532e
+0, 179, 179, 1, 152064, 0x528832b4
+0, 180, 180, 1, 152064, 0x348da007
+0, 181, 181, 1, 152064, 0x5104b2e8
+0, 182, 182, 1, 152064, 0x7b0d1f8f
+0, 183, 183, 1, 152064, 0x6750c77c
+0, 184, 184, 1, 152064, 0x3a8f2faa
+0, 185, 185, 1, 152064, 0x8a24a116
+0, 186, 186, 1, 152064, 0x82d00d82
+0, 187, 187, 1, 152064, 0xc6f5b11a
+0, 188, 188, 1, 152064, 0x2b352039
+0, 189, 189, 1, 152064, 0x7c067e22
+0, 190, 190, 1, 152064, 0xc975d80d
+0, 191, 191, 1, 152064, 0xa49978ed
+0, 192, 192, 1, 152064, 0x441f703e
+0, 193, 193, 1, 152064, 0x5cb150c5
+0, 194, 194, 1, 152064, 0xeeda6c8e
+0, 195, 195, 1, 152064, 0xe9e0ce47
+0, 196, 196, 1, 152064, 0xba55acbd
+0, 197, 197, 1, 152064, 0xae8250e5
+0, 198, 198, 1, 152064, 0xf438f2e8
+0, 199, 199, 1, 152064, 0xe6263d10
+0, 200, 200, 1, 152064, 0x8d13277a
+0, 201, 201, 1, 152064, 0x4bfb4aab
+0, 202, 202, 1, 152064, 0x1c0a78ea
+0, 203, 203, 1, 152064, 0xa0651778
+0, 204, 204, 1, 152064, 0xa309ca66
+0, 205, 205, 1, 152064, 0x294c750b
+0, 206, 206, 1, 152064, 0xd55d6881
+0, 207, 207, 1, 152064, 0x8d002b72
+0, 208, 208, 1, 152064, 0xe0ae5976
+0, 209, 209, 1, 152064, 0xc6f28961
+0, 210, 210, 1, 152064, 0x6fb5899d
+0, 211, 211, 1, 152064, 0x046f3445
+0, 212, 212, 1, 152064, 0x9b2d5779
+0, 213, 213, 1, 152064, 0xeb9db946
+0, 214, 214, 1, 152064, 0x190bdc3b
+0, 215, 215, 1, 152064, 0xb9ae5c7b
+0, 216, 216, 1, 152064, 0xca07ad32
+0, 217, 217, 1, 152064, 0x8d1fee22
+0, 218, 218, 1, 152064, 0x446470dd
+0, 219, 219, 1, 152064, 0x8802cf93
+0, 220, 220, 1, 152064, 0x8bbaeb30
+0, 221, 221, 1, 152064, 0xfe4e7fdf
+0, 222, 222, 1, 152064, 0xc6379dc7
+0, 223, 223, 1, 152064, 0xaa53198b
+0, 224, 224, 1, 152064, 0x88d6d37c
+0, 225, 225, 1, 152064, 0xd1b89370
+0, 226, 226, 1, 152064, 0xdab349f4
+0, 227, 227, 1, 152064, 0x4702c238
+0, 228, 228, 1, 152064, 0xfaa893bb
+0, 229, 229, 1, 152064, 0x515b940e
+0, 230, 230, 1, 152064, 0x4d86d838
+0, 231, 231, 1, 152064, 0xe3815641
+0, 232, 232, 1, 152064, 0x0e501c17
+0, 233, 233, 1, 152064, 0x449df073
+0, 234, 234, 1, 152064, 0xc06daa27
+0, 235, 235, 1, 152064, 0x72f5394c
+0, 236, 236, 1, 152064, 0x18be9f70
+0, 237, 237, 1, 152064, 0xc508213a
+0, 238, 238, 1, 152064, 0xa616a322
+0, 239, 239, 1, 152064, 0x1a5d09e5
+0, 240, 240, 1, 152064, 0xf6e78051
+0, 241, 241, 1, 152064, 0x8945ad83
+0, 242, 242, 1, 152064, 0xa06fd95d
+0, 243, 243, 1, 152064, 0x7d86f015
+0, 244, 244, 1, 152064, 0x768af87c
+0, 245, 245, 1, 152064, 0xffa2e8d9
+0, 246, 246, 1, 152064, 0x2ac0d2df
+0, 247, 247, 1, 152064, 0x40c27662
+0, 248, 248, 1, 152064, 0xfcc7580a
+0, 249, 249, 1, 152064, 0xcdbd51f0
+0, 250, 250, 1, 152064, 0xe0d754ec
+0, 251, 251, 1, 152064, 0xbfb59395
+0, 252, 252, 1, 152064, 0x26f6db71
+0, 253, 253, 1, 152064, 0x1d85f144
+0, 254, 254, 1, 152064, 0xfacbfbd9
+0, 255, 255, 1, 152064, 0x55bdf6b8
+0, 256, 256, 1, 152064, 0x9c89e3f8
+0, 257, 257, 1, 152064, 0x6e90c4bd
+0, 258, 258, 1, 152064, 0x3b19a944
+0, 259, 259, 1, 152064, 0xcb527670
+0, 260, 260, 1, 152064, 0xc0ec5c7b
+0, 261, 261, 1, 152064, 0x7f5f4814
+0, 262, 262, 1, 152064, 0xb0983900
+0, 263, 263, 1, 152064, 0xc57534a6
+0, 264, 264, 1, 152064, 0xd37b30b9
+0, 265, 265, 1, 152064, 0x61fe2e9f
+0, 266, 266, 1, 152064, 0x613d2e8a
+0, 267, 267, 1, 152064, 0x9bc5224b
+0, 268, 268, 1, 152064, 0x246122c2
+0, 269, 269, 1, 152064, 0x28811a8f
+0, 270, 270, 1, 152064, 0x609cfcbf
+0, 271, 271, 1, 152064, 0x9c5aee70
+0, 272, 272, 1, 152064, 0x06d7e997
+0, 273, 273, 1, 152064, 0xcb3e1e4a
+0, 274, 274, 1, 152064, 0x65e36256
+0, 275, 275, 1, 152064, 0x571eb628
+0, 276, 276, 1, 152064, 0x9e940be8
+0, 277, 277, 1, 152064, 0x425a374b
+0, 278, 278, 1, 152064, 0xbeed72a2
+0, 279, 279, 1, 152064, 0x295bb61d
+0, 280, 280, 1, 152064, 0xfe2df639
+0, 281, 281, 1, 152064, 0xbd4f441a
+0, 282, 282, 1, 152064, 0x61ce59bc
+0, 283, 283, 1, 152064, 0xd5eb825f
+0, 284, 284, 1, 152064, 0xc03cb656
+0, 285, 285, 1, 152064, 0xfc10c1f6
+0, 286, 286, 1, 152064, 0xb93908dc
+0, 287, 287, 1, 152064, 0xbc2d3209
+0, 288, 288, 1, 152064, 0xcc267ab3
+0, 289, 289, 1, 152064, 0x32629fa0
+0, 290, 290, 1, 152064, 0x5d5bb942
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-ci_mw_d b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-ci_mw_d
index 193c5c8..7b5a7dc 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-ci_mw_d
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-ci_mw_d
@@ -1,100 +1,101 @@
-0, 0, 38016, 0x3ae838ee
-0, 3600, 38016, 0x8523e136
-0, 7200, 38016, 0xcffc99dd
-0, 10800, 38016, 0xd42c63b0
-0, 14400, 38016, 0x6ba94f84
-0, 18000, 38016, 0xa5c56dd3
-0, 21600, 38016, 0x6f6a929e
-0, 25200, 38016, 0x84f89b27
-0, 28800, 38016, 0x35bd9f0f
-0, 32400, 38016, 0x69058ed2
-0, 36000, 38016, 0x44c05088
-0, 39600, 38016, 0xed9725f0
-0, 43200, 38016, 0x37b92a40
-0, 46800, 38016, 0xbeed3c7c
-0, 50400, 38016, 0x833a5669
-0, 54000, 38016, 0xf37b78b1
-0, 57600, 38016, 0x84e2aff4
-0, 61200, 38016, 0x8c69c59c
-0, 64800, 38016, 0x40fdbe25
-0, 68400, 38016, 0x1c7cba40
-0, 72000, 38016, 0x052abe29
-0, 75600, 38016, 0x398ec317
-0, 79200, 38016, 0xa157bb47
-0, 82800, 38016, 0x6acfc1a0
-0, 86400, 38016, 0xfa77bdba
-0, 90000, 38016, 0x2254bb0d
-0, 93600, 38016, 0xefdfbdb3
-0, 97200, 38016, 0x80eec1f4
-0, 100800, 38016, 0x48b6c903
-0, 104400, 38016, 0x277dd23b
-0, 108000, 38016, 0x4c6aa7c5
-0, 111600, 38016, 0x223f6bb7
-0, 115200, 38016, 0xdbee4420
-0, 118800, 38016, 0x5f888bdc
-0, 122400, 38016, 0xe5aef9b8
-0, 126000, 38016, 0x6a68596e
-0, 129600, 38016, 0x47feb0d4
-0, 133200, 38016, 0x46d13363
-0, 136800, 38016, 0x31758ae0
-0, 140400, 38016, 0xa9b3c513
-0, 144000, 38016, 0x041ce805
-0, 147600, 38016, 0xd3aef1e9
-0, 151200, 38016, 0x8c51ecf8
-0, 154800, 38016, 0x60a5f20d
-0, 158400, 38016, 0xf3c80bfb
-0, 162000, 38016, 0xcec4f6af
-0, 165600, 38016, 0x70a1c28c
-0, 169200, 38016, 0x1c579938
-0, 172800, 38016, 0x07a8a63d
-0, 176400, 38016, 0xd16ccd4e
-0, 180000, 38016, 0xceb5e478
-0, 183600, 38016, 0x81c0bf00
-0, 187200, 38016, 0x4867d846
-0, 190800, 38016, 0xd8650fd3
-0, 194400, 38016, 0x1d8f375c
-0, 198000, 38016, 0x5ce65ef5
-0, 201600, 38016, 0xbc766bf0
-0, 205200, 38016, 0x73cd27ee
-0, 208800, 38016, 0xd1433004
-0, 212400, 38016, 0xc5bc4798
-0, 216000, 38016, 0xeb8a3531
-0, 219600, 38016, 0xd4b014b8
-0, 223200, 38016, 0xaaa2c77e
-0, 226800, 38016, 0xa0a5a94e
-0, 230400, 38016, 0x74edcf2e
-0, 234000, 38016, 0x2925e32a
-0, 237600, 38016, 0x5400da3a
-0, 241200, 38016, 0xc50eda9b
-0, 244800, 38016, 0xfd4acbe7
-0, 248400, 38016, 0xa75eb6ee
-0, 252000, 38016, 0xc0dca463
-0, 255600, 38016, 0xfd1b83b7
-0, 259200, 38016, 0x5b378f02
-0, 262800, 38016, 0x608983d5
-0, 266400, 38016, 0x6f6f2cda
-0, 270000, 38016, 0x9367e1b2
-0, 273600, 38016, 0x12d7d677
-0, 277200, 38016, 0xd02cc0c5
-0, 280800, 38016, 0xbe2fed59
-0, 284400, 38016, 0x66c1402d
-0, 288000, 38016, 0x150e75cf
-0, 291600, 38016, 0x83c959ea
-0, 295200, 38016, 0xa9c048f4
-0, 298800, 38016, 0xffa9237f
-0, 302400, 38016, 0x0ab0d668
-0, 306000, 38016, 0xae4de2a4
-0, 309600, 38016, 0xfc4322e8
-0, 313200, 38016, 0x21f026dd
-0, 316800, 38016, 0x7582b6a6
-0, 320400, 38016, 0x4ddc5306
-0, 324000, 38016, 0x1722db32
-0, 327600, 38016, 0x33a0ace6
-0, 331200, 38016, 0xe96ebd07
-0, 334800, 38016, 0xdff2e5ef
-0, 338400, 38016, 0xbf941880
-0, 342000, 38016, 0x12ffcea4
-0, 345600, 38016, 0x1ef6aaef
-0, 349200, 38016, 0x2b01f811
-0, 352800, 38016, 0x422b5992
-0, 356400, 38016, 0x68ba9d2d
+#tb 0: 1/25
+0, 0, 0, 1, 38016, 0x3ae838ee
+0, 1, 1, 1, 38016, 0x8523e136
+0, 2, 2, 1, 38016, 0xcffc99dd
+0, 3, 3, 1, 38016, 0xd42c63b0
+0, 4, 4, 1, 38016, 0x6ba94f84
+0, 5, 5, 1, 38016, 0xa5c56dd3
+0, 6, 6, 1, 38016, 0x6f6a929e
+0, 7, 7, 1, 38016, 0x84f89b27
+0, 8, 8, 1, 38016, 0x35bd9f0f
+0, 9, 9, 1, 38016, 0x69058ed2
+0, 10, 10, 1, 38016, 0x44c05088
+0, 11, 11, 1, 38016, 0xed9725f0
+0, 12, 12, 1, 38016, 0x37b92a40
+0, 13, 13, 1, 38016, 0xbeed3c7c
+0, 14, 14, 1, 38016, 0x833a5669
+0, 15, 15, 1, 38016, 0xf37b78b1
+0, 16, 16, 1, 38016, 0x84e2aff4
+0, 17, 17, 1, 38016, 0x8c69c59c
+0, 18, 18, 1, 38016, 0x40fdbe25
+0, 19, 19, 1, 38016, 0x1c7cba40
+0, 20, 20, 1, 38016, 0x052abe29
+0, 21, 21, 1, 38016, 0x398ec317
+0, 22, 22, 1, 38016, 0xa157bb47
+0, 23, 23, 1, 38016, 0x6acfc1a0
+0, 24, 24, 1, 38016, 0xfa77bdba
+0, 25, 25, 1, 38016, 0x2254bb0d
+0, 26, 26, 1, 38016, 0xefdfbdb3
+0, 27, 27, 1, 38016, 0x80eec1f4
+0, 28, 28, 1, 38016, 0x48b6c903
+0, 29, 29, 1, 38016, 0x277dd23b
+0, 30, 30, 1, 38016, 0x4c6aa7c5
+0, 31, 31, 1, 38016, 0x223f6bb7
+0, 32, 32, 1, 38016, 0xdbee4420
+0, 33, 33, 1, 38016, 0x5f888bdc
+0, 34, 34, 1, 38016, 0xe5aef9b8
+0, 35, 35, 1, 38016, 0x6a68596e
+0, 36, 36, 1, 38016, 0x47feb0d4
+0, 37, 37, 1, 38016, 0x46d13363
+0, 38, 38, 1, 38016, 0x31758ae0
+0, 39, 39, 1, 38016, 0xa9b3c513
+0, 40, 40, 1, 38016, 0x041ce805
+0, 41, 41, 1, 38016, 0xd3aef1e9
+0, 42, 42, 1, 38016, 0x8c51ecf8
+0, 43, 43, 1, 38016, 0x60a5f20d
+0, 44, 44, 1, 38016, 0xf3c80bfb
+0, 45, 45, 1, 38016, 0xcec4f6af
+0, 46, 46, 1, 38016, 0x70a1c28c
+0, 47, 47, 1, 38016, 0x1c579938
+0, 48, 48, 1, 38016, 0x07a8a63d
+0, 49, 49, 1, 38016, 0xd16ccd4e
+0, 50, 50, 1, 38016, 0xceb5e478
+0, 51, 51, 1, 38016, 0x81c0bf00
+0, 52, 52, 1, 38016, 0x4867d846
+0, 53, 53, 1, 38016, 0xd8650fd3
+0, 54, 54, 1, 38016, 0x1d8f375c
+0, 55, 55, 1, 38016, 0x5ce65ef5
+0, 56, 56, 1, 38016, 0xbc766bf0
+0, 57, 57, 1, 38016, 0x73cd27ee
+0, 58, 58, 1, 38016, 0xd1433004
+0, 59, 59, 1, 38016, 0xc5bc4798
+0, 60, 60, 1, 38016, 0xeb8a3531
+0, 61, 61, 1, 38016, 0xd4b014b8
+0, 62, 62, 1, 38016, 0xaaa2c77e
+0, 63, 63, 1, 38016, 0xa0a5a94e
+0, 64, 64, 1, 38016, 0x74edcf2e
+0, 65, 65, 1, 38016, 0x2925e32a
+0, 66, 66, 1, 38016, 0x5400da3a
+0, 67, 67, 1, 38016, 0xc50eda9b
+0, 68, 68, 1, 38016, 0xfd4acbe7
+0, 69, 69, 1, 38016, 0xa75eb6ee
+0, 70, 70, 1, 38016, 0xc0dca463
+0, 71, 71, 1, 38016, 0xfd1b83b7
+0, 72, 72, 1, 38016, 0x5b378f02
+0, 73, 73, 1, 38016, 0x608983d5
+0, 74, 74, 1, 38016, 0x6f6f2cda
+0, 75, 75, 1, 38016, 0x9367e1b2
+0, 76, 76, 1, 38016, 0x12d7d677
+0, 77, 77, 1, 38016, 0xd02cc0c5
+0, 78, 78, 1, 38016, 0xbe2fed59
+0, 79, 79, 1, 38016, 0x66c1402d
+0, 80, 80, 1, 38016, 0x150e75cf
+0, 81, 81, 1, 38016, 0x83c959ea
+0, 82, 82, 1, 38016, 0xa9c048f4
+0, 83, 83, 1, 38016, 0xffa9237f
+0, 84, 84, 1, 38016, 0x0ab0d668
+0, 85, 85, 1, 38016, 0xae4de2a4
+0, 86, 86, 1, 38016, 0xfc4322e8
+0, 87, 87, 1, 38016, 0x21f026dd
+0, 88, 88, 1, 38016, 0x7582b6a6
+0, 89, 89, 1, 38016, 0x4ddc5306
+0, 90, 90, 1, 38016, 0x1722db32
+0, 91, 91, 1, 38016, 0x33a0ace6
+0, 92, 92, 1, 38016, 0xe96ebd07
+0, 93, 93, 1, 38016, 0xdff2e5ef
+0, 94, 94, 1, 38016, 0xbf941880
+0, 95, 95, 1, 38016, 0x12ffcea4
+0, 96, 96, 1, 38016, 0x1ef6aaef
+0, 97, 97, 1, 38016, 0x2b01f811
+0, 98, 98, 1, 38016, 0x422b5992
+0, 99, 99, 1, 38016, 0x68ba9d2d
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvbs3_sony_c b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvbs3_sony_c
index 7a5db82..ad7485a 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvbs3_sony_c
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvbs3_sony_c
@@ -1,300 +1,301 @@
-0, 0, 38016, 0xb3883478
-0, 3600, 38016, 0xddf01d9d
-0, 7200, 38016, 0xb177ece2
-0, 10800, 38016, 0xfcd6aec1
-0, 14400, 38016, 0x5cb5a017
-0, 18000, 38016, 0xeb3884e7
-0, 21600, 38016, 0xa8494fb1
-0, 25200, 38016, 0xe0084edb
-0, 28800, 38016, 0x605845e7
-0, 32400, 38016, 0xe2103e96
-0, 36000, 38016, 0x3b057699
-0, 39600, 38016, 0x130b9413
-0, 43200, 38016, 0x1af773f6
-0, 46800, 38016, 0x1a77b1f3
-0, 50400, 38016, 0xbb5bac34
-0, 54000, 38016, 0xd41c9cf7
-0, 57600, 38016, 0x6df3ac7f
-0, 61200, 38016, 0xba44a850
-0, 64800, 38016, 0xe8887fc4
-0, 68400, 38016, 0xa50387fa
-0, 72000, 38016, 0x164c6317
-0, 75600, 38016, 0xb9c52925
-0, 79200, 38016, 0xfbcc2f11
-0, 82800, 38016, 0x5c0f258c
-0, 86400, 38016, 0x0d61186e
-0, 90000, 38016, 0xec173b07
-0, 93600, 38016, 0x322c353a
-0, 97200, 38016, 0x30f72be0
-0, 100800, 38016, 0xb0aa5d52
-0, 104400, 38016, 0x915a70e2
-0, 108000, 38016, 0xed9563d3
-0, 111600, 38016, 0x2122a450
-0, 115200, 38016, 0xc8a6ba0a
-0, 118800, 38016, 0x7fbaad08
-0, 122400, 38016, 0xef19d83b
-0, 126000, 38016, 0x4fb1d339
-0, 129600, 38016, 0xe73eb1a3
-0, 133200, 38016, 0xfd23d6f0
-0, 136800, 38016, 0xfc21ca53
-0, 140400, 38016, 0xa6c7b2c9
-0, 144000, 38016, 0x4fb3c8e0
-0, 147600, 38016, 0xdb7acc62
-0, 151200, 38016, 0x281db765
-0, 154800, 38016, 0x2e11b6e9
-0, 158400, 38016, 0x8237b906
-0, 162000, 38016, 0xe3728780
-0, 165600, 38016, 0x2932a82c
-0, 169200, 38016, 0x8a0ab2ca
-0, 172800, 38016, 0xdb38a893
-0, 176400, 38016, 0xd64cbfc3
-0, 180000, 38016, 0x8a53b992
-0, 183600, 38016, 0xef29abc9
-0, 187200, 38016, 0x6d64baf6
-0, 190800, 38016, 0xc402bf13
-0, 194400, 38016, 0x00c7b709
-0, 198000, 38016, 0x55ddcb84
-0, 201600, 38016, 0x22cac705
-0, 205200, 38016, 0xfa1bc59d
-0, 208800, 38016, 0x82a1d3d0
-0, 212400, 38016, 0x7db8d411
-0, 216000, 38016, 0x98a59a5a
-0, 219600, 38016, 0x02bda814
-0, 223200, 38016, 0xc4a288d9
-0, 226800, 38016, 0x799a3804
-0, 230400, 38016, 0x11474f82
-0, 234000, 38016, 0x0b807846
-0, 237600, 38016, 0x2a118c7e
-0, 241200, 38016, 0xa076e441
-0, 244800, 38016, 0x9b2c1c2b
-0, 248400, 38016, 0xf1433098
-0, 252000, 38016, 0xbf68697b
-0, 255600, 38016, 0x0c2c94de
-0, 259200, 38016, 0x5fdcb88b
-0, 262800, 38016, 0x543dfb09
-0, 266400, 38016, 0x4c602fc8
-0, 270000, 38016, 0x4c0b3afa
-0, 273600, 38016, 0x97dd846b
-0, 277200, 38016, 0xb5cb97f7
-0, 280800, 38016, 0x42dba91c
-0, 284400, 38016, 0x827cc117
-0, 288000, 38016, 0xd589cd88
-0, 291600, 38016, 0x15bfdd09
-0, 295200, 38016, 0x77cbe929
-0, 298800, 38016, 0x499edfb2
-0, 302400, 38016, 0x3bd5d22c
-0, 306000, 38016, 0xed0ed545
-0, 309600, 38016, 0x1751e754
-0, 313200, 38016, 0x042feed4
-0, 316800, 38016, 0x24dde6b3
-0, 320400, 38016, 0x8aa2ed66
-0, 324000, 38016, 0x8fa69f07
-0, 327600, 38016, 0xe018ad28
-0, 331200, 38016, 0x0b31992e
-0, 334800, 38016, 0xf8aa6dbc
-0, 338400, 38016, 0x0eb36da4
-0, 342000, 38016, 0x392b6658
-0, 345600, 38016, 0xb8056967
-0, 349200, 38016, 0x16899181
-0, 352800, 38016, 0x44b9a1b2
-0, 356400, 38016, 0x20ee9b98
-0, 360000, 38016, 0x42cdad98
-0, 363600, 38016, 0xd438a3d6
-0, 367200, 38016, 0x551e8751
-0, 370800, 38016, 0x68428f39
-0, 374400, 38016, 0x7449b249
-0, 378000, 38016, 0xf294a253
-0, 381600, 38016, 0x8628d899
-0, 385200, 38016, 0xba05f633
-0, 388800, 38016, 0x329bfacb
-0, 392400, 38016, 0xaa5c33dd
-0, 396000, 38016, 0x2b9437d9
-0, 399600, 38016, 0x8bd8273b
-0, 403200, 38016, 0xc6d541fb
-0, 406800, 38016, 0xb42c1e45
-0, 410400, 38016, 0xdd39e610
-0, 414000, 38016, 0xae56fe66
-0, 417600, 38016, 0x812a16e4
-0, 421200, 38016, 0x47fdff0f
-0, 424800, 38016, 0xfbb33b56
-0, 428400, 38016, 0x792a486f
-0, 432000, 38016, 0x32e93592
-0, 435600, 38016, 0xbd2142ca
-0, 439200, 38016, 0x2d412532
-0, 442800, 38016, 0x5ee8e957
-0, 446400, 38016, 0x57c3de13
-0, 450000, 38016, 0xad94b6f1
-0, 453600, 38016, 0x8cda97a1
-0, 457200, 38016, 0x3563b54e
-0, 460800, 38016, 0x1d2bc4fb
-0, 464400, 38016, 0xada2cf01
-0, 468000, 38016, 0x8dabed0a
-0, 471600, 38016, 0x441ae3c0
-0, 475200, 38016, 0x5514cc85
-0, 478800, 38016, 0xd20cddad
-0, 482400, 38016, 0x5286d569
-0, 486000, 38016, 0x1612a173
-0, 489600, 38016, 0x5946be84
-0, 493200, 38016, 0x1925b1fe
-0, 496800, 38016, 0xf34f93eb
-0, 500400, 38016, 0xac3d9add
-0, 504000, 38016, 0x12d18ba6
-0, 507600, 38016, 0xcc7f7e5a
-0, 511200, 38016, 0x449270ec
-0, 514800, 38016, 0x04416f83
-0, 518400, 38016, 0x50d36abf
-0, 522000, 38016, 0x8605799f
-0, 525600, 38016, 0xe6ec6cfd
-0, 529200, 38016, 0x1f2d3baf
-0, 532800, 38016, 0x9f3e1a4c
-0, 536400, 38016, 0x5c3ef4c8
-0, 540000, 38016, 0xf731aef2
-0, 543600, 38016, 0x90b4c921
-0, 547200, 38016, 0xa12dc74f
-0, 550800, 38016, 0x1fe2a278
-0, 554400, 38016, 0xa6b0b432
-0, 558000, 38016, 0xf9e9cb79
-0, 561600, 38016, 0xef58d10e
-0, 565200, 38016, 0x957805c0
-0, 568800, 38016, 0x76e03b1f
-0, 572400, 38016, 0xcb2a4905
-0, 576000, 38016, 0xb863646d
-0, 579600, 38016, 0x3e5f57fe
-0, 583200, 38016, 0xbe7d3d77
-0, 586800, 38016, 0x4f3c3ce5
-0, 590400, 38016, 0x806033d0
-0, 594000, 38016, 0xc31bf5da
-0, 597600, 38016, 0x6f8ef69e
-0, 601200, 38016, 0x010ac670
-0, 604800, 38016, 0x374e9bdd
-0, 608400, 38016, 0xd8499c26
-0, 612000, 38016, 0x5901a512
-0, 615600, 38016, 0x31b2bcdf
-0, 619200, 38016, 0x972cdda0
-0, 622800, 38016, 0x10c8ded1
-0, 626400, 38016, 0xc6e3c839
-0, 630000, 38016, 0xf661aa12
-0, 633600, 38016, 0x6ca379d0
-0, 637200, 38016, 0xc5a53d41
-0, 640800, 38016, 0x317d353c
-0, 644400, 38016, 0xb9962522
-0, 648000, 38016, 0x0769ec52
-0, 651600, 38016, 0x4463ea8b
-0, 655200, 38016, 0xdd7dd585
-0, 658800, 38016, 0x6039ca99
-0, 662400, 38016, 0x87beeba1
-0, 666000, 38016, 0x2503fd5d
-0, 669600, 38016, 0xde950c40
-0, 673200, 38016, 0xd6f5332f
-0, 676800, 38016, 0xa95b3137
-0, 680400, 38016, 0x37c026b4
-0, 684000, 38016, 0x93f9e3e3
-0, 687600, 38016, 0x5826b471
-0, 691200, 38016, 0xef81ac84
-0, 694800, 38016, 0x6361dfa0
-0, 698400, 38016, 0x9774f041
-0, 702000, 38016, 0xd8d01ad1
-0, 705600, 38016, 0x456252f3
-0, 709200, 38016, 0x448c6119
-0, 712800, 38016, 0x12157fca
-0, 716400, 38016, 0x145ca727
-0, 720000, 38016, 0x17a5b174
-0, 723600, 38016, 0xc0c0bb0c
-0, 727200, 38016, 0x9afbc5e8
-0, 730800, 38016, 0xc8c7cc3a
-0, 734400, 38016, 0x489dc5dd
-0, 738000, 38016, 0x6da6c7c8
-0, 741600, 38016, 0x6408d491
-0, 745200, 38016, 0x0820d9ce
-0, 748800, 38016, 0xebcfc8d6
-0, 752400, 38016, 0xf462b2a2
-0, 756000, 38016, 0xadb65d17
-0, 759600, 38016, 0xecde79e9
-0, 763200, 38016, 0x81786ed0
-0, 766800, 38016, 0x3cfc51f8
-0, 770400, 38016, 0x307560ba
-0, 774000, 38016, 0xc4f95361
-0, 777600, 38016, 0xe2fe384b
-0, 781200, 38016, 0x95de4e60
-0, 784800, 38016, 0x1b6147f9
-0, 788400, 38016, 0xe1bc385b
-0, 792000, 38016, 0x14cc446a
-0, 795600, 38016, 0x5fcb313f
-0, 799200, 38016, 0xf33f1721
-0, 802800, 38016, 0x49fc2fbb
-0, 806400, 38016, 0x33ad3314
-0, 810000, 38016, 0x92b51315
-0, 813600, 38016, 0x7e4d3139
-0, 817200, 38016, 0xb99e432b
-0, 820800, 38016, 0x52cb3c30
-0, 824400, 38016, 0xe5e48199
-0, 828000, 38016, 0x59419769
-0, 831600, 38016, 0x3e90b130
-0, 835200, 38016, 0x85fbfbd6
-0, 838800, 38016, 0xba8912ac
-0, 842400, 38016, 0x3fc3128c
-0, 846000, 38016, 0x61db4d37
-0, 849600, 38016, 0x3c405a46
-0, 853200, 38016, 0x9c113b43
-0, 856800, 38016, 0x739c43f4
-0, 860400, 38016, 0xffab0fe6
-0, 864000, 38016, 0x99cee4bd
-0, 867600, 38016, 0xd76dcff5
-0, 871200, 38016, 0xe8ccb16c
-0, 874800, 38016, 0x43d8ff1f
-0, 878400, 38016, 0xffde708b
-0, 882000, 38016, 0xe5cfd3d4
-0, 885600, 38016, 0x0b67ef9f
-0, 889200, 38016, 0xd54cd697
-0, 892800, 38016, 0x5879926e
-0, 896400, 38016, 0x9cb01428
-0, 900000, 38016, 0x09b0c0b7
-0, 903600, 38016, 0xbbef721e
-0, 907200, 38016, 0xcebd66ea
-0, 910800, 38016, 0x7492c956
-0, 914400, 38016, 0xeaa5317b
-0, 918000, 38016, 0xe952c9bd
-0, 921600, 38016, 0xb4cfd878
-0, 925200, 38016, 0xa8675f14
-0, 928800, 38016, 0x24653121
-0, 932400, 38016, 0xeec9425e
-0, 936000, 38016, 0x14413e58
-0, 939600, 38016, 0xc8e13f0a
-0, 943200, 38016, 0x09045f0f
-0, 946800, 38016, 0xa021583e
-0, 950400, 38016, 0x26384591
-0, 954000, 38016, 0x157b55d2
-0, 957600, 38016, 0x22973c65
-0, 961200, 38016, 0x2fe30f64
-0, 964800, 38016, 0xf640fab4
-0, 968400, 38016, 0x2b82d807
-0, 972000, 38016, 0x6faca613
-0, 975600, 38016, 0x8a5b89c3
-0, 979200, 38016, 0xb7d76316
-0, 982800, 38016, 0x3e3a0a82
-0, 986400, 38016, 0x7d93d78b
-0, 990000, 38016, 0xa3bcc050
-0, 993600, 38016, 0x41d4b2ba
-0, 997200, 38016, 0x7a08d518
-0, 1000800, 38016, 0xd6b0f72b
-0, 1004400, 38016, 0x9c794c7b
-0, 1008000, 38016, 0xc2680d18
-0, 1011600, 38016, 0x9fa6db96
-0, 1015200, 38016, 0xd90c83c3
-0, 1018800, 38016, 0xf1278cf5
-0, 1022400, 38016, 0xf2ce5e19
-0, 1026000, 38016, 0x2d41a44b
-0, 1029600, 38016, 0xade2715b
-0, 1033200, 38016, 0xd21da6fe
-0, 1036800, 38016, 0x37c89e7f
-0, 1040400, 38016, 0x6bad76e8
-0, 1044000, 38016, 0xfefce893
-0, 1047600, 38016, 0xcd301b29
-0, 1051200, 38016, 0x0e80a08d
-0, 1054800, 38016, 0x88f3d605
-0, 1058400, 38016, 0x80273791
-0, 1062000, 38016, 0x36472009
-0, 1065600, 38016, 0xe8b6fc54
-0, 1069200, 38016, 0x5d9bfd2d
-0, 1072800, 38016, 0x61df1820
-0, 1076400, 38016, 0x8db23b5c
+#tb 0: 1/25
+0, 0, 0, 1, 38016, 0xb3883478
+0, 1, 1, 1, 38016, 0xddf01d9d
+0, 2, 2, 1, 38016, 0xb177ece2
+0, 3, 3, 1, 38016, 0xfcd6aec1
+0, 4, 4, 1, 38016, 0x5cb5a017
+0, 5, 5, 1, 38016, 0xeb3884e7
+0, 6, 6, 1, 38016, 0xa8494fb1
+0, 7, 7, 1, 38016, 0xe0084edb
+0, 8, 8, 1, 38016, 0x605845e7
+0, 9, 9, 1, 38016, 0xe2103e96
+0, 10, 10, 1, 38016, 0x3b057699
+0, 11, 11, 1, 38016, 0x130b9413
+0, 12, 12, 1, 38016, 0x1af773f6
+0, 13, 13, 1, 38016, 0x1a77b1f3
+0, 14, 14, 1, 38016, 0xbb5bac34
+0, 15, 15, 1, 38016, 0xd41c9cf7
+0, 16, 16, 1, 38016, 0x6df3ac7f
+0, 17, 17, 1, 38016, 0xba44a850
+0, 18, 18, 1, 38016, 0xe8887fc4
+0, 19, 19, 1, 38016, 0xa50387fa
+0, 20, 20, 1, 38016, 0x164c6317
+0, 21, 21, 1, 38016, 0xb9c52925
+0, 22, 22, 1, 38016, 0xfbcc2f11
+0, 23, 23, 1, 38016, 0x5c0f258c
+0, 24, 24, 1, 38016, 0x0d61186e
+0, 25, 25, 1, 38016, 0xec173b07
+0, 26, 26, 1, 38016, 0x322c353a
+0, 27, 27, 1, 38016, 0x30f72be0
+0, 28, 28, 1, 38016, 0xb0aa5d52
+0, 29, 29, 1, 38016, 0x915a70e2
+0, 30, 30, 1, 38016, 0xed9563d3
+0, 31, 31, 1, 38016, 0x2122a450
+0, 32, 32, 1, 38016, 0xc8a6ba0a
+0, 33, 33, 1, 38016, 0x7fbaad08
+0, 34, 34, 1, 38016, 0xef19d83b
+0, 35, 35, 1, 38016, 0x4fb1d339
+0, 36, 36, 1, 38016, 0xe73eb1a3
+0, 37, 37, 1, 38016, 0xfd23d6f0
+0, 38, 38, 1, 38016, 0xfc21ca53
+0, 39, 39, 1, 38016, 0xa6c7b2c9
+0, 40, 40, 1, 38016, 0x4fb3c8e0
+0, 41, 41, 1, 38016, 0xdb7acc62
+0, 42, 42, 1, 38016, 0x281db765
+0, 43, 43, 1, 38016, 0x2e11b6e9
+0, 44, 44, 1, 38016, 0x8237b906
+0, 45, 45, 1, 38016, 0xe3728780
+0, 46, 46, 1, 38016, 0x2932a82c
+0, 47, 47, 1, 38016, 0x8a0ab2ca
+0, 48, 48, 1, 38016, 0xdb38a893
+0, 49, 49, 1, 38016, 0xd64cbfc3
+0, 50, 50, 1, 38016, 0x8a53b992
+0, 51, 51, 1, 38016, 0xef29abc9
+0, 52, 52, 1, 38016, 0x6d64baf6
+0, 53, 53, 1, 38016, 0xc402bf13
+0, 54, 54, 1, 38016, 0x00c7b709
+0, 55, 55, 1, 38016, 0x55ddcb84
+0, 56, 56, 1, 38016, 0x22cac705
+0, 57, 57, 1, 38016, 0xfa1bc59d
+0, 58, 58, 1, 38016, 0x82a1d3d0
+0, 59, 59, 1, 38016, 0x7db8d411
+0, 60, 60, 1, 38016, 0x98a59a5a
+0, 61, 61, 1, 38016, 0x02bda814
+0, 62, 62, 1, 38016, 0xc4a288d9
+0, 63, 63, 1, 38016, 0x799a3804
+0, 64, 64, 1, 38016, 0x11474f82
+0, 65, 65, 1, 38016, 0x0b807846
+0, 66, 66, 1, 38016, 0x2a118c7e
+0, 67, 67, 1, 38016, 0xa076e441
+0, 68, 68, 1, 38016, 0x9b2c1c2b
+0, 69, 69, 1, 38016, 0xf1433098
+0, 70, 70, 1, 38016, 0xbf68697b
+0, 71, 71, 1, 38016, 0x0c2c94de
+0, 72, 72, 1, 38016, 0x5fdcb88b
+0, 73, 73, 1, 38016, 0x543dfb09
+0, 74, 74, 1, 38016, 0x4c602fc8
+0, 75, 75, 1, 38016, 0x4c0b3afa
+0, 76, 76, 1, 38016, 0x97dd846b
+0, 77, 77, 1, 38016, 0xb5cb97f7
+0, 78, 78, 1, 38016, 0x42dba91c
+0, 79, 79, 1, 38016, 0x827cc117
+0, 80, 80, 1, 38016, 0xd589cd88
+0, 81, 81, 1, 38016, 0x15bfdd09
+0, 82, 82, 1, 38016, 0x77cbe929
+0, 83, 83, 1, 38016, 0x499edfb2
+0, 84, 84, 1, 38016, 0x3bd5d22c
+0, 85, 85, 1, 38016, 0xed0ed545
+0, 86, 86, 1, 38016, 0x1751e754
+0, 87, 87, 1, 38016, 0x042feed4
+0, 88, 88, 1, 38016, 0x24dde6b3
+0, 89, 89, 1, 38016, 0x8aa2ed66
+0, 90, 90, 1, 38016, 0x8fa69f07
+0, 91, 91, 1, 38016, 0xe018ad28
+0, 92, 92, 1, 38016, 0x0b31992e
+0, 93, 93, 1, 38016, 0xf8aa6dbc
+0, 94, 94, 1, 38016, 0x0eb36da4
+0, 95, 95, 1, 38016, 0x392b6658
+0, 96, 96, 1, 38016, 0xb8056967
+0, 97, 97, 1, 38016, 0x16899181
+0, 98, 98, 1, 38016, 0x44b9a1b2
+0, 99, 99, 1, 38016, 0x20ee9b98
+0, 100, 100, 1, 38016, 0x42cdad98
+0, 101, 101, 1, 38016, 0xd438a3d6
+0, 102, 102, 1, 38016, 0x551e8751
+0, 103, 103, 1, 38016, 0x68428f39
+0, 104, 104, 1, 38016, 0x7449b249
+0, 105, 105, 1, 38016, 0xf294a253
+0, 106, 106, 1, 38016, 0x8628d899
+0, 107, 107, 1, 38016, 0xba05f633
+0, 108, 108, 1, 38016, 0x329bfacb
+0, 109, 109, 1, 38016, 0xaa5c33dd
+0, 110, 110, 1, 38016, 0x2b9437d9
+0, 111, 111, 1, 38016, 0x8bd8273b
+0, 112, 112, 1, 38016, 0xc6d541fb
+0, 113, 113, 1, 38016, 0xb42c1e45
+0, 114, 114, 1, 38016, 0xdd39e610
+0, 115, 115, 1, 38016, 0xae56fe66
+0, 116, 116, 1, 38016, 0x812a16e4
+0, 117, 117, 1, 38016, 0x47fdff0f
+0, 118, 118, 1, 38016, 0xfbb33b56
+0, 119, 119, 1, 38016, 0x792a486f
+0, 120, 120, 1, 38016, 0x32e93592
+0, 121, 121, 1, 38016, 0xbd2142ca
+0, 122, 122, 1, 38016, 0x2d412532
+0, 123, 123, 1, 38016, 0x5ee8e957
+0, 124, 124, 1, 38016, 0x57c3de13
+0, 125, 125, 1, 38016, 0xad94b6f1
+0, 126, 126, 1, 38016, 0x8cda97a1
+0, 127, 127, 1, 38016, 0x3563b54e
+0, 128, 128, 1, 38016, 0x1d2bc4fb
+0, 129, 129, 1, 38016, 0xada2cf01
+0, 130, 130, 1, 38016, 0x8dabed0a
+0, 131, 131, 1, 38016, 0x441ae3c0
+0, 132, 132, 1, 38016, 0x5514cc85
+0, 133, 133, 1, 38016, 0xd20cddad
+0, 134, 134, 1, 38016, 0x5286d569
+0, 135, 135, 1, 38016, 0x1612a173
+0, 136, 136, 1, 38016, 0x5946be84
+0, 137, 137, 1, 38016, 0x1925b1fe
+0, 138, 138, 1, 38016, 0xf34f93eb
+0, 139, 139, 1, 38016, 0xac3d9add
+0, 140, 140, 1, 38016, 0x12d18ba6
+0, 141, 141, 1, 38016, 0xcc7f7e5a
+0, 142, 142, 1, 38016, 0x449270ec
+0, 143, 143, 1, 38016, 0x04416f83
+0, 144, 144, 1, 38016, 0x50d36abf
+0, 145, 145, 1, 38016, 0x8605799f
+0, 146, 146, 1, 38016, 0xe6ec6cfd
+0, 147, 147, 1, 38016, 0x1f2d3baf
+0, 148, 148, 1, 38016, 0x9f3e1a4c
+0, 149, 149, 1, 38016, 0x5c3ef4c8
+0, 150, 150, 1, 38016, 0xf731aef2
+0, 151, 151, 1, 38016, 0x90b4c921
+0, 152, 152, 1, 38016, 0xa12dc74f
+0, 153, 153, 1, 38016, 0x1fe2a278
+0, 154, 154, 1, 38016, 0xa6b0b432
+0, 155, 155, 1, 38016, 0xf9e9cb79
+0, 156, 156, 1, 38016, 0xef58d10e
+0, 157, 157, 1, 38016, 0x957805c0
+0, 158, 158, 1, 38016, 0x76e03b1f
+0, 159, 159, 1, 38016, 0xcb2a4905
+0, 160, 160, 1, 38016, 0xb863646d
+0, 161, 161, 1, 38016, 0x3e5f57fe
+0, 162, 162, 1, 38016, 0xbe7d3d77
+0, 163, 163, 1, 38016, 0x4f3c3ce5
+0, 164, 164, 1, 38016, 0x806033d0
+0, 165, 165, 1, 38016, 0xc31bf5da
+0, 166, 166, 1, 38016, 0x6f8ef69e
+0, 167, 167, 1, 38016, 0x010ac670
+0, 168, 168, 1, 38016, 0x374e9bdd
+0, 169, 169, 1, 38016, 0xd8499c26
+0, 170, 170, 1, 38016, 0x5901a512
+0, 171, 171, 1, 38016, 0x31b2bcdf
+0, 172, 172, 1, 38016, 0x972cdda0
+0, 173, 173, 1, 38016, 0x10c8ded1
+0, 174, 174, 1, 38016, 0xc6e3c839
+0, 175, 175, 1, 38016, 0xf661aa12
+0, 176, 176, 1, 38016, 0x6ca379d0
+0, 177, 177, 1, 38016, 0xc5a53d41
+0, 178, 178, 1, 38016, 0x317d353c
+0, 179, 179, 1, 38016, 0xb9962522
+0, 180, 180, 1, 38016, 0x0769ec52
+0, 181, 181, 1, 38016, 0x4463ea8b
+0, 182, 182, 1, 38016, 0xdd7dd585
+0, 183, 183, 1, 38016, 0x6039ca99
+0, 184, 184, 1, 38016, 0x87beeba1
+0, 185, 185, 1, 38016, 0x2503fd5d
+0, 186, 186, 1, 38016, 0xde950c40
+0, 187, 187, 1, 38016, 0xd6f5332f
+0, 188, 188, 1, 38016, 0xa95b3137
+0, 189, 189, 1, 38016, 0x37c026b4
+0, 190, 190, 1, 38016, 0x93f9e3e3
+0, 191, 191, 1, 38016, 0x5826b471
+0, 192, 192, 1, 38016, 0xef81ac84
+0, 193, 193, 1, 38016, 0x6361dfa0
+0, 194, 194, 1, 38016, 0x9774f041
+0, 195, 195, 1, 38016, 0xd8d01ad1
+0, 196, 196, 1, 38016, 0x456252f3
+0, 197, 197, 1, 38016, 0x448c6119
+0, 198, 198, 1, 38016, 0x12157fca
+0, 199, 199, 1, 38016, 0x145ca727
+0, 200, 200, 1, 38016, 0x17a5b174
+0, 201, 201, 1, 38016, 0xc0c0bb0c
+0, 202, 202, 1, 38016, 0x9afbc5e8
+0, 203, 203, 1, 38016, 0xc8c7cc3a
+0, 204, 204, 1, 38016, 0x489dc5dd
+0, 205, 205, 1, 38016, 0x6da6c7c8
+0, 206, 206, 1, 38016, 0x6408d491
+0, 207, 207, 1, 38016, 0x0820d9ce
+0, 208, 208, 1, 38016, 0xebcfc8d6
+0, 209, 209, 1, 38016, 0xf462b2a2
+0, 210, 210, 1, 38016, 0xadb65d17
+0, 211, 211, 1, 38016, 0xecde79e9
+0, 212, 212, 1, 38016, 0x81786ed0
+0, 213, 213, 1, 38016, 0x3cfc51f8
+0, 214, 214, 1, 38016, 0x307560ba
+0, 215, 215, 1, 38016, 0xc4f95361
+0, 216, 216, 1, 38016, 0xe2fe384b
+0, 217, 217, 1, 38016, 0x95de4e60
+0, 218, 218, 1, 38016, 0x1b6147f9
+0, 219, 219, 1, 38016, 0xe1bc385b
+0, 220, 220, 1, 38016, 0x14cc446a
+0, 221, 221, 1, 38016, 0x5fcb313f
+0, 222, 222, 1, 38016, 0xf33f1721
+0, 223, 223, 1, 38016, 0x49fc2fbb
+0, 224, 224, 1, 38016, 0x33ad3314
+0, 225, 225, 1, 38016, 0x92b51315
+0, 226, 226, 1, 38016, 0x7e4d3139
+0, 227, 227, 1, 38016, 0xb99e432b
+0, 228, 228, 1, 38016, 0x52cb3c30
+0, 229, 229, 1, 38016, 0xe5e48199
+0, 230, 230, 1, 38016, 0x59419769
+0, 231, 231, 1, 38016, 0x3e90b130
+0, 232, 232, 1, 38016, 0x85fbfbd6
+0, 233, 233, 1, 38016, 0xba8912ac
+0, 234, 234, 1, 38016, 0x3fc3128c
+0, 235, 235, 1, 38016, 0x61db4d37
+0, 236, 236, 1, 38016, 0x3c405a46
+0, 237, 237, 1, 38016, 0x9c113b43
+0, 238, 238, 1, 38016, 0x739c43f4
+0, 239, 239, 1, 38016, 0xffab0fe6
+0, 240, 240, 1, 38016, 0x99cee4bd
+0, 241, 241, 1, 38016, 0xd76dcff5
+0, 242, 242, 1, 38016, 0xe8ccb16c
+0, 243, 243, 1, 38016, 0x43d8ff1f
+0, 244, 244, 1, 38016, 0xffde708b
+0, 245, 245, 1, 38016, 0xe5cfd3d4
+0, 246, 246, 1, 38016, 0x0b67ef9f
+0, 247, 247, 1, 38016, 0xd54cd697
+0, 248, 248, 1, 38016, 0x5879926e
+0, 249, 249, 1, 38016, 0x9cb01428
+0, 250, 250, 1, 38016, 0x09b0c0b7
+0, 251, 251, 1, 38016, 0xbbef721e
+0, 252, 252, 1, 38016, 0xcebd66ea
+0, 253, 253, 1, 38016, 0x7492c956
+0, 254, 254, 1, 38016, 0xeaa5317b
+0, 255, 255, 1, 38016, 0xe952c9bd
+0, 256, 256, 1, 38016, 0xb4cfd878
+0, 257, 257, 1, 38016, 0xa8675f14
+0, 258, 258, 1, 38016, 0x24653121
+0, 259, 259, 1, 38016, 0xeec9425e
+0, 260, 260, 1, 38016, 0x14413e58
+0, 261, 261, 1, 38016, 0xc8e13f0a
+0, 262, 262, 1, 38016, 0x09045f0f
+0, 263, 263, 1, 38016, 0xa021583e
+0, 264, 264, 1, 38016, 0x26384591
+0, 265, 265, 1, 38016, 0x157b55d2
+0, 266, 266, 1, 38016, 0x22973c65
+0, 267, 267, 1, 38016, 0x2fe30f64
+0, 268, 268, 1, 38016, 0xf640fab4
+0, 269, 269, 1, 38016, 0x2b82d807
+0, 270, 270, 1, 38016, 0x6faca613
+0, 271, 271, 1, 38016, 0x8a5b89c3
+0, 272, 272, 1, 38016, 0xb7d76316
+0, 273, 273, 1, 38016, 0x3e3a0a82
+0, 274, 274, 1, 38016, 0x7d93d78b
+0, 275, 275, 1, 38016, 0xa3bcc050
+0, 276, 276, 1, 38016, 0x41d4b2ba
+0, 277, 277, 1, 38016, 0x7a08d518
+0, 278, 278, 1, 38016, 0xd6b0f72b
+0, 279, 279, 1, 38016, 0x9c794c7b
+0, 280, 280, 1, 38016, 0xc2680d18
+0, 281, 281, 1, 38016, 0x9fa6db96
+0, 282, 282, 1, 38016, 0xd90c83c3
+0, 283, 283, 1, 38016, 0xf1278cf5
+0, 284, 284, 1, 38016, 0xf2ce5e19
+0, 285, 285, 1, 38016, 0x2d41a44b
+0, 286, 286, 1, 38016, 0xade2715b
+0, 287, 287, 1, 38016, 0xd21da6fe
+0, 288, 288, 1, 38016, 0x37c89e7f
+0, 289, 289, 1, 38016, 0x6bad76e8
+0, 290, 290, 1, 38016, 0xfefce893
+0, 291, 291, 1, 38016, 0xcd301b29
+0, 292, 292, 1, 38016, 0x0e80a08d
+0, 293, 293, 1, 38016, 0x88f3d605
+0, 294, 294, 1, 38016, 0x80273791
+0, 295, 295, 1, 38016, 0x36472009
+0, 296, 296, 1, 38016, 0xe8b6fc54
+0, 297, 297, 1, 38016, 0x5d9bfd2d
+0, 298, 298, 1, 38016, 0x61df1820
+0, 299, 299, 1, 38016, 0x8db23b5c
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvcanlma2_sony_c b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvcanlma2_sony_c
index 5eff64e..b6a759a 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvcanlma2_sony_c
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvcanlma2_sony_c
@@ -1,17 +1,18 @@
-0, 0, 518400, 0xfbca00c6
-0, 3600, 518400, 0x82b80adf
-0, 7200, 518400, 0x87ecdf4a
-0, 10800, 518400, 0xf6ca8cbe
-0, 14400, 518400, 0x8e9bb8a0
-0, 18000, 518400, 0x6512caa2
-0, 21600, 518400, 0xc015e43e
-0, 25200, 518400, 0x5f504a5c
-0, 28800, 518400, 0x4c7458a4
-0, 32400, 518400, 0x630f4004
-0, 36000, 518400, 0x889af20e
-0, 39600, 518400, 0x4437a5a4
-0, 43200, 518400, 0x1e19a254
-0, 46800, 518400, 0xb7ef1763
-0, 50400, 518400, 0xc966c95a
-0, 54000, 518400, 0x0c9074d6
-0, 57600, 518400, 0x24c906c9
+#tb 0: 1/25
+0, 0, 0, 1, 518400, 0xfbca00c6
+0, 1, 1, 1, 518400, 0x82b80adf
+0, 2, 2, 1, 518400, 0x87ecdf4a
+0, 3, 3, 1, 518400, 0xf6ca8cbe
+0, 4, 4, 1, 518400, 0x8e9bb8a0
+0, 5, 5, 1, 518400, 0x6512caa2
+0, 6, 6, 1, 518400, 0xc015e43e
+0, 7, 7, 1, 518400, 0x5f504a5c
+0, 8, 8, 1, 518400, 0x4c7458a4
+0, 9, 9, 1, 518400, 0x630f4004
+0, 10, 10, 1, 518400, 0x889af20e
+0, 11, 11, 1, 518400, 0x4437a5a4
+0, 12, 12, 1, 518400, 0x1e19a254
+0, 13, 13, 1, 518400, 0xb7ef1763
+0, 14, 14, 1, 518400, 0xc966c95a
+0, 15, 15, 1, 518400, 0x0c9074d6
+0, 16, 16, 1, 518400, 0x24c906c9
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvfi1_sony_d b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvfi1_sony_d
index aaf0e7b..195c7d6 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvfi1_sony_d
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvfi1_sony_d
@@ -1,17 +1,18 @@
-0, 0, 518400, 0xd9444d71
-0, 3600, 518400, 0x5d8928cd
-0, 7200, 518400, 0xea5bc08b
-0, 10800, 518400, 0xb4465d31
-0, 14400, 518400, 0x983b5dbb
-0, 18000, 518400, 0x54936746
-0, 21600, 518400, 0x7ae38b02
-0, 25200, 518400, 0xc2a0dd83
-0, 28800, 518400, 0x61cac7a6
-0, 32400, 518400, 0xb0038443
-0, 36000, 518400, 0x16514296
-0, 39600, 518400, 0xa68dd470
-0, 43200, 518400, 0x2572f868
-0, 46800, 518400, 0x770a3239
-0, 50400, 518400, 0xdd04f6d2
-0, 54000, 518400, 0xa5e5d01e
-0, 57600, 518400, 0x5fe25c86
+#tb 0: 1/25
+0, 0, 0, 1, 518400, 0xd9444d71
+0, 1, 1, 1, 518400, 0x5d8928cd
+0, 2, 2, 1, 518400, 0xea5bc08b
+0, 3, 3, 1, 518400, 0xb4465d31
+0, 4, 4, 1, 518400, 0x983b5dbb
+0, 5, 5, 1, 518400, 0x54936746
+0, 6, 6, 1, 518400, 0x7ae38b02
+0, 7, 7, 1, 518400, 0xc2a0dd83
+0, 8, 8, 1, 518400, 0x61cac7a6
+0, 9, 9, 1, 518400, 0xb0038443
+0, 10, 10, 1, 518400, 0x16514296
+0, 11, 11, 1, 518400, 0xa68dd470
+0, 12, 12, 1, 518400, 0x2572f868
+0, 13, 13, 1, 518400, 0x770a3239
+0, 14, 14, 1, 518400, 0xdd04f6d2
+0, 15, 15, 1, 518400, 0xa5e5d01e
+0, 16, 16, 1, 518400, 0x5fe25c86
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvfi1_sva_c b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvfi1_sva_c
index bcff3ea..c19bc0d 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvfi1_sva_c
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvfi1_sva_c
@@ -1,7 +1,8 @@
-0, 0, 518400, 0x8f022263
-0, 3600, 518400, 0x02692654
-0, 7200, 518400, 0x55eff579
-0, 10800, 518400, 0x6c1bdf1d
-0, 14400, 518400, 0xbbedf5e4
-0, 18000, 518400, 0xb90d740d
-0, 21600, 518400, 0x81300adb
+#tb 0: 1/25
+0, 0, 0, 1, 518400, 0x8f022263
+0, 1, 1, 1, 518400, 0x02692654
+0, 2, 2, 1, 518400, 0x55eff579
+0, 3, 3, 1, 518400, 0x6c1bdf1d
+0, 4, 4, 1, 518400, 0xbbedf5e4
+0, 5, 5, 1, 518400, 0xb90d740d
+0, 6, 6, 1, 518400, 0x81300adb
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvfi2_sony_h b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvfi2_sony_h
index 1a7743a..0914e22 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvfi2_sony_h
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvfi2_sony_h
@@ -1,17 +1,18 @@
-0, 0, 518400, 0xd9444d71
-0, 3600, 518400, 0x491faf75
-0, 7200, 518400, 0xf8b4d15c
-0, 10800, 518400, 0x99d9f60c
-0, 14400, 518400, 0x46c17a6d
-0, 18000, 518400, 0x30b9447d
-0, 21600, 518400, 0x135d0c76
-0, 25200, 518400, 0x1b831a3c
-0, 28800, 518400, 0x5910def8
-0, 32400, 518400, 0x8db90147
-0, 36000, 518400, 0x6a2b79c7
-0, 39600, 518400, 0xc8d302e5
-0, 43200, 518400, 0x515bb024
-0, 46800, 518400, 0xedf7836c
-0, 50400, 518400, 0x7e247b9d
-0, 54000, 518400, 0x10c9bb10
-0, 57600, 518400, 0xe38e2807
+#tb 0: 1/25
+0, 0, 0, 1, 518400, 0xd9444d71
+0, 1, 1, 1, 518400, 0x491faf75
+0, 2, 2, 1, 518400, 0xf8b4d15c
+0, 3, 3, 1, 518400, 0x99d9f60c
+0, 4, 4, 1, 518400, 0x46c17a6d
+0, 5, 5, 1, 518400, 0x30b9447d
+0, 6, 6, 1, 518400, 0x135d0c76
+0, 7, 7, 1, 518400, 0x1b831a3c
+0, 8, 8, 1, 518400, 0x5910def8
+0, 9, 9, 1, 518400, 0x8db90147
+0, 10, 10, 1, 518400, 0x6a2b79c7
+0, 11, 11, 1, 518400, 0xc8d302e5
+0, 12, 12, 1, 518400, 0x515bb024
+0, 13, 13, 1, 518400, 0xedf7836c
+0, 14, 14, 1, 518400, 0x7e247b9d
+0, 15, 15, 1, 518400, 0x10c9bb10
+0, 16, 16, 1, 518400, 0xe38e2807
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvfi2_sva_c b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvfi2_sva_c
index ffb0a83..7c3162a 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvfi2_sva_c
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvfi2_sva_c
@@ -1,13 +1,14 @@
-0, 0, 518400, 0x4073cc0b
-0, 3600, 518400, 0x5f599a48
-0, 7200, 518400, 0xc6fe555a
-0, 10800, 518400, 0xe63ac345
-0, 14400, 518400, 0x9b4f0c5c
-0, 18000, 518400, 0x98aaba2d
-0, 21600, 518400, 0xd629bd09
-0, 25200, 518400, 0xe9796c37
-0, 28800, 518400, 0xba54d16e
-0, 32400, 518400, 0xe396c3eb
-0, 36000, 518400, 0x63ee4b81
-0, 39600, 518400, 0x68ac6986
-0, 43200, 518400, 0xe0d53000
+#tb 0: 1/25
+0, 0, 0, 1, 518400, 0x4073cc0b
+0, 1, 1, 1, 518400, 0x5f599a48
+0, 2, 2, 1, 518400, 0xc6fe555a
+0, 3, 3, 1, 518400, 0xe63ac345
+0, 4, 4, 1, 518400, 0x9b4f0c5c
+0, 5, 5, 1, 518400, 0x98aaba2d
+0, 6, 6, 1, 518400, 0xd629bd09
+0, 7, 7, 1, 518400, 0xe9796c37
+0, 8, 8, 1, 518400, 0xba54d16e
+0, 9, 9, 1, 518400, 0xe396c3eb
+0, 10, 10, 1, 518400, 0x63ee4b81
+0, 11, 11, 1, 518400, 0x68ac6986
+0, 12, 12, 1, 518400, 0xe0d53000
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvma1_sony_d b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvma1_sony_d
index 6b309aa..6685216 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvma1_sony_d
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvma1_sony_d
@@ -1,5 +1,6 @@
-0, 0, 518400, 0x75701511
-0, 3600, 518400, 0xa7eeaa16
-0, 7200, 518400, 0xe0f32e35
-0, 10800, 518400, 0x7a1dadd9
-0, 14400, 518400, 0x4a1672a6
+#tb 0: 1/25
+0, 0, 0, 1, 518400, 0x75701511
+0, 1, 1, 1, 518400, 0xa7eeaa16
+0, 2, 2, 1, 518400, 0xe0f32e35
+0, 3, 3, 1, 518400, 0x7a1dadd9
+0, 4, 4, 1, 518400, 0x4a1672a6
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvma1_toshiba_b b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvma1_toshiba_b
index 897e915..ab2da4a 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvma1_toshiba_b
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvma1_toshiba_b
@@ -1,90 +1,91 @@
-0, 0, 152064, 0x9a9ce366
-0, 3600, 152064, 0xf4639828
-0, 7200, 152064, 0x625024a3
-0, 10800, 152064, 0x80dc2f9d
-0, 14400, 152064, 0xb2c4feea
-0, 18000, 152064, 0x4ec6ad64
-0, 21600, 152064, 0x1957bec3
-0, 25200, 152064, 0xb682799d
-0, 28800, 152064, 0x34cd2053
-0, 32400, 152064, 0x81490b4c
-0, 36000, 152064, 0x242dc943
-0, 39600, 152064, 0x3e126734
-0, 43200, 152064, 0x8e474ff8
-0, 46800, 152064, 0x239d2fbd
-0, 50400, 152064, 0x0ca3e16f
-0, 54000, 152064, 0x6161d7c2
-0, 57600, 152064, 0xca7ad1af
-0, 61200, 152064, 0xf8ef9026
-0, 64800, 152064, 0x01f2f4c1
-0, 68400, 152064, 0x510b19ec
-0, 72000, 152064, 0xe489028b
-0, 75600, 152064, 0x7a693c1e
-0, 79200, 152064, 0x276b23fe
-0, 82800, 152064, 0x0e9ced3a
-0, 86400, 152064, 0x658228f7
-0, 90000, 152064, 0x6a271bc3
-0, 93600, 152064, 0x431ecd8b
-0, 97200, 152064, 0x23a5ed14
-0, 100800, 152064, 0x76fbe121
-0, 104400, 152064, 0x471f919d
-0, 108000, 152064, 0x16bfabbc
-0, 111600, 152064, 0x0762993f
-0, 115200, 152064, 0x5a2b0b0e
-0, 118800, 152064, 0x81415ef7
-0, 122400, 152064, 0xb96e4164
-0, 126000, 152064, 0xf77aee83
-0, 129600, 152064, 0x6af81633
-0, 133200, 152064, 0xed78e5b5
-0, 136800, 152064, 0x67e38e2c
-0, 140400, 152064, 0x0417ae01
-0, 144000, 152064, 0x3887b312
-0, 147600, 152064, 0x3a4b70fb
-0, 151200, 152064, 0xcaae9e7f
-0, 154800, 152064, 0xaf9597be
-0, 158400, 152064, 0x9bae63d3
-0, 162000, 152064, 0x0e80825f
-0, 165600, 152064, 0x915661fd
-0, 169200, 152064, 0x67d3dc94
-0, 172800, 152064, 0x3dcf240c
-0, 176400, 152064, 0x127ff832
-0, 180000, 152064, 0xc8969981
-0, 183600, 152064, 0x57179c77
-0, 187200, 152064, 0x9f88656c
-0, 190800, 152064, 0xc28ff5d3
-0, 194400, 152064, 0xf100fad9
-0, 198000, 152064, 0xb570ce12
-0, 201600, 152064, 0xe8f28955
-0, 205200, 152064, 0x1f0a9549
-0, 208800, 152064, 0x22b17e9b
-0, 212400, 152064, 0x7cf1400e
-0, 216000, 152064, 0xafd273b7
-0, 219600, 152064, 0xeb9b712e
-0, 223200, 152064, 0x0f81de24
-0, 226800, 152064, 0x8f4e1953
-0, 230400, 152064, 0x682e2170
-0, 234000, 152064, 0xc32ad1b2
-0, 237600, 152064, 0x53a81d79
-0, 241200, 152064, 0x54002596
-0, 244800, 152064, 0x4b5fdbd9
-0, 248400, 152064, 0x96613368
-0, 252000, 152064, 0xd6ac0171
-0, 255600, 152064, 0xf1c1b7b7
-0, 259200, 152064, 0xc730d82f
-0, 262800, 152064, 0x0415d934
-0, 266400, 152064, 0x5338915e
-0, 270000, 152064, 0x8e9dda6d
-0, 273600, 152064, 0xe3a8b0a0
-0, 277200, 152064, 0x5fa36e44
-0, 280800, 152064, 0x0e63dc72
-0, 284400, 152064, 0xd0dad71f
-0, 288000, 152064, 0x0c4aac94
-0, 291600, 152064, 0x60d50e8d
-0, 295200, 152064, 0x96872d7c
-0, 298800, 152064, 0x4fcefc33
-0, 302400, 152064, 0x6b8157c9
-0, 306000, 152064, 0xa40d527d
-0, 309600, 152064, 0x9884480a
-0, 313200, 152064, 0xff5d9754
-0, 316800, 152064, 0x4a26a74d
-0, 320400, 152064, 0x81059e82
+#tb 0: 1/25
+0, 0, 0, 1, 152064, 0x9a9ce366
+0, 1, 1, 1, 152064, 0xf4639828
+0, 2, 2, 1, 152064, 0x625024a3
+0, 3, 3, 1, 152064, 0x80dc2f9d
+0, 4, 4, 1, 152064, 0xb2c4feea
+0, 5, 5, 1, 152064, 0x4ec6ad64
+0, 6, 6, 1, 152064, 0x1957bec3
+0, 7, 7, 1, 152064, 0xb682799d
+0, 8, 8, 1, 152064, 0x34cd2053
+0, 9, 9, 1, 152064, 0x81490b4c
+0, 10, 10, 1, 152064, 0x242dc943
+0, 11, 11, 1, 152064, 0x3e126734
+0, 12, 12, 1, 152064, 0x8e474ff8
+0, 13, 13, 1, 152064, 0x239d2fbd
+0, 14, 14, 1, 152064, 0x0ca3e16f
+0, 15, 15, 1, 152064, 0x6161d7c2
+0, 16, 16, 1, 152064, 0xca7ad1af
+0, 17, 17, 1, 152064, 0xf8ef9026
+0, 18, 18, 1, 152064, 0x01f2f4c1
+0, 19, 19, 1, 152064, 0x510b19ec
+0, 20, 20, 1, 152064, 0xe489028b
+0, 21, 21, 1, 152064, 0x7a693c1e
+0, 22, 22, 1, 152064, 0x276b23fe
+0, 23, 23, 1, 152064, 0x0e9ced3a
+0, 24, 24, 1, 152064, 0x658228f7
+0, 25, 25, 1, 152064, 0x6a271bc3
+0, 26, 26, 1, 152064, 0x431ecd8b
+0, 27, 27, 1, 152064, 0x23a5ed14
+0, 28, 28, 1, 152064, 0x76fbe121
+0, 29, 29, 1, 152064, 0x471f919d
+0, 30, 30, 1, 152064, 0x16bfabbc
+0, 31, 31, 1, 152064, 0x0762993f
+0, 32, 32, 1, 152064, 0x5a2b0b0e
+0, 33, 33, 1, 152064, 0x81415ef7
+0, 34, 34, 1, 152064, 0xb96e4164
+0, 35, 35, 1, 152064, 0xf77aee83
+0, 36, 36, 1, 152064, 0x6af81633
+0, 37, 37, 1, 152064, 0xed78e5b5
+0, 38, 38, 1, 152064, 0x67e38e2c
+0, 39, 39, 1, 152064, 0x0417ae01
+0, 40, 40, 1, 152064, 0x3887b312
+0, 41, 41, 1, 152064, 0x3a4b70fb
+0, 42, 42, 1, 152064, 0xcaae9e7f
+0, 43, 43, 1, 152064, 0xaf9597be
+0, 44, 44, 1, 152064, 0x9bae63d3
+0, 45, 45, 1, 152064, 0x0e80825f
+0, 46, 46, 1, 152064, 0x915661fd
+0, 47, 47, 1, 152064, 0x67d3dc94
+0, 48, 48, 1, 152064, 0x3dcf240c
+0, 49, 49, 1, 152064, 0x127ff832
+0, 50, 50, 1, 152064, 0xc8969981
+0, 51, 51, 1, 152064, 0x57179c77
+0, 52, 52, 1, 152064, 0x9f88656c
+0, 53, 53, 1, 152064, 0xc28ff5d3
+0, 54, 54, 1, 152064, 0xf100fad9
+0, 55, 55, 1, 152064, 0xb570ce12
+0, 56, 56, 1, 152064, 0xe8f28955
+0, 57, 57, 1, 152064, 0x1f0a9549
+0, 58, 58, 1, 152064, 0x22b17e9b
+0, 59, 59, 1, 152064, 0x7cf1400e
+0, 60, 60, 1, 152064, 0xafd273b7
+0, 61, 61, 1, 152064, 0xeb9b712e
+0, 62, 62, 1, 152064, 0x0f81de24
+0, 63, 63, 1, 152064, 0x8f4e1953
+0, 64, 64, 1, 152064, 0x682e2170
+0, 65, 65, 1, 152064, 0xc32ad1b2
+0, 66, 66, 1, 152064, 0x53a81d79
+0, 67, 67, 1, 152064, 0x54002596
+0, 68, 68, 1, 152064, 0x4b5fdbd9
+0, 69, 69, 1, 152064, 0x96613368
+0, 70, 70, 1, 152064, 0xd6ac0171
+0, 71, 71, 1, 152064, 0xf1c1b7b7
+0, 72, 72, 1, 152064, 0xc730d82f
+0, 73, 73, 1, 152064, 0x0415d934
+0, 74, 74, 1, 152064, 0x5338915e
+0, 75, 75, 1, 152064, 0x8e9dda6d
+0, 76, 76, 1, 152064, 0xe3a8b0a0
+0, 77, 77, 1, 152064, 0x5fa36e44
+0, 78, 78, 1, 152064, 0x0e63dc72
+0, 79, 79, 1, 152064, 0xd0dad71f
+0, 80, 80, 1, 152064, 0x0c4aac94
+0, 81, 81, 1, 152064, 0x60d50e8d
+0, 82, 82, 1, 152064, 0x96872d7c
+0, 83, 83, 1, 152064, 0x4fcefc33
+0, 84, 84, 1, 152064, 0x6b8157c9
+0, 85, 85, 1, 152064, 0xa40d527d
+0, 86, 86, 1, 152064, 0x9884480a
+0, 87, 87, 1, 152064, 0xff5d9754
+0, 88, 88, 1, 152064, 0x4a26a74d
+0, 89, 89, 1, 152064, 0x81059e82
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvmanl1_toshiba_b b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvmanl1_toshiba_b
index 07422b8..2c3c557 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvmanl1_toshiba_b
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvmanl1_toshiba_b
@@ -1,90 +1,91 @@
-0, 0, 152064, 0xb1edd842
-0, 3600, 152064, 0x551f8f45
-0, 7200, 152064, 0xb4931cb2
-0, 10800, 152064, 0x78882b27
-0, 14400, 152064, 0x3afef36d
-0, 18000, 152064, 0x85afad0a
-0, 21600, 152064, 0x3a8bab81
-0, 25200, 152064, 0x2a437174
-0, 28800, 152064, 0x22421437
-0, 32400, 152064, 0x39c5f125
-0, 36000, 152064, 0x256eaad2
-0, 39600, 152064, 0x668a5d31
-0, 43200, 152064, 0x412a4aa7
-0, 46800, 152064, 0x3f091baf
-0, 50400, 152064, 0xbf16d262
-0, 54000, 152064, 0x2fc4ce67
-0, 57600, 152064, 0x119cde3e
-0, 61200, 152064, 0xb40b8632
-0, 64800, 152064, 0x4be4f192
-0, 68400, 152064, 0x906c1237
-0, 72000, 152064, 0x95380024
-0, 75600, 152064, 0x6a833025
-0, 79200, 152064, 0x681d1c4f
-0, 82800, 152064, 0x08c8dea4
-0, 86400, 152064, 0xc69226f0
-0, 90000, 152064, 0x86631102
-0, 93600, 152064, 0x7f40c77a
-0, 97200, 152064, 0xc746ddd4
-0, 100800, 152064, 0x5f2bd3cb
-0, 104400, 152064, 0x643c8316
-0, 108000, 152064, 0x5b7fa380
-0, 111600, 152064, 0x82438cf7
-0, 115200, 152064, 0xdee0f7e7
-0, 118800, 152064, 0xc50d41f1
-0, 122400, 152064, 0xf3453631
-0, 126000, 152064, 0x90bce66b
-0, 129600, 152064, 0x045b03f7
-0, 133200, 152064, 0xf64bd756
-0, 136800, 152064, 0xff997ef2
-0, 140400, 152064, 0x3613a0a5
-0, 144000, 152064, 0xe6a7a8d6
-0, 147600, 152064, 0xb0906c42
-0, 151200, 152064, 0x4dfc912b
-0, 154800, 152064, 0x81e3991c
-0, 158400, 152064, 0x4efc61fb
-0, 162000, 152064, 0xed478395
-0, 165600, 152064, 0x4cb25ab6
-0, 169200, 152064, 0x28e7d51f
-0, 172800, 152064, 0x8bcc1a8d
-0, 176400, 152064, 0x2fe1f240
-0, 180000, 152064, 0xb4978ef8
-0, 183600, 152064, 0xe3929556
-0, 187200, 152064, 0xd370632a
-0, 190800, 152064, 0xba86ffb2
-0, 194400, 152064, 0x444bf18c
-0, 198000, 152064, 0xab40bd14
-0, 201600, 152064, 0xfd488a5d
-0, 205200, 152064, 0xe1f09568
-0, 208800, 152064, 0x09ee7a7e
-0, 212400, 152064, 0x9360397c
-0, 216000, 152064, 0xdbd467e9
-0, 219600, 152064, 0x99726777
-0, 223200, 152064, 0x009fd46c
-0, 226800, 152064, 0xcf770fdb
-0, 230400, 152064, 0x2a890fd9
-0, 234000, 152064, 0x7f40de4b
-0, 237600, 152064, 0x04191304
-0, 241200, 152064, 0x15722022
-0, 244800, 152064, 0x59f4ea93
-0, 248400, 152064, 0x28ba373f
-0, 252000, 152064, 0xf9e400b8
-0, 255600, 152064, 0x85c4bd98
-0, 259200, 152064, 0x6917d2a5
-0, 262800, 152064, 0x61cae234
-0, 266400, 152064, 0x752a9a2d
-0, 270000, 152064, 0x1ee2d9bd
-0, 273600, 152064, 0xdce9ab8e
-0, 277200, 152064, 0x51225fd0
-0, 280800, 152064, 0x10e8cb60
-0, 284400, 152064, 0x8d07cd25
-0, 288000, 152064, 0xb18ba61b
-0, 291600, 152064, 0xb0f10280
-0, 295200, 152064, 0x76a71f13
-0, 298800, 152064, 0x3004f5a1
-0, 302400, 152064, 0x9aba5724
-0, 306000, 152064, 0x5db85385
-0, 309600, 152064, 0xbe9d3f5b
-0, 313200, 152064, 0xa71e85bb
-0, 316800, 152064, 0xdcf59cd7
-0, 320400, 152064, 0x5e319459
+#tb 0: 1/25
+0, 0, 0, 1, 152064, 0xb1edd842
+0, 1, 1, 1, 152064, 0x551f8f45
+0, 2, 2, 1, 152064, 0xb4931cb2
+0, 3, 3, 1, 152064, 0x78882b27
+0, 4, 4, 1, 152064, 0x3afef36d
+0, 5, 5, 1, 152064, 0x85afad0a
+0, 6, 6, 1, 152064, 0x3a8bab81
+0, 7, 7, 1, 152064, 0x2a437174
+0, 8, 8, 1, 152064, 0x22421437
+0, 9, 9, 1, 152064, 0x39c5f125
+0, 10, 10, 1, 152064, 0x256eaad2
+0, 11, 11, 1, 152064, 0x668a5d31
+0, 12, 12, 1, 152064, 0x412a4aa7
+0, 13, 13, 1, 152064, 0x3f091baf
+0, 14, 14, 1, 152064, 0xbf16d262
+0, 15, 15, 1, 152064, 0x2fc4ce67
+0, 16, 16, 1, 152064, 0x119cde3e
+0, 17, 17, 1, 152064, 0xb40b8632
+0, 18, 18, 1, 152064, 0x4be4f192
+0, 19, 19, 1, 152064, 0x906c1237
+0, 20, 20, 1, 152064, 0x95380024
+0, 21, 21, 1, 152064, 0x6a833025
+0, 22, 22, 1, 152064, 0x681d1c4f
+0, 23, 23, 1, 152064, 0x08c8dea4
+0, 24, 24, 1, 152064, 0xc69226f0
+0, 25, 25, 1, 152064, 0x86631102
+0, 26, 26, 1, 152064, 0x7f40c77a
+0, 27, 27, 1, 152064, 0xc746ddd4
+0, 28, 28, 1, 152064, 0x5f2bd3cb
+0, 29, 29, 1, 152064, 0x643c8316
+0, 30, 30, 1, 152064, 0x5b7fa380
+0, 31, 31, 1, 152064, 0x82438cf7
+0, 32, 32, 1, 152064, 0xdee0f7e7
+0, 33, 33, 1, 152064, 0xc50d41f1
+0, 34, 34, 1, 152064, 0xf3453631
+0, 35, 35, 1, 152064, 0x90bce66b
+0, 36, 36, 1, 152064, 0x045b03f7
+0, 37, 37, 1, 152064, 0xf64bd756
+0, 38, 38, 1, 152064, 0xff997ef2
+0, 39, 39, 1, 152064, 0x3613a0a5
+0, 40, 40, 1, 152064, 0xe6a7a8d6
+0, 41, 41, 1, 152064, 0xb0906c42
+0, 42, 42, 1, 152064, 0x4dfc912b
+0, 43, 43, 1, 152064, 0x81e3991c
+0, 44, 44, 1, 152064, 0x4efc61fb
+0, 45, 45, 1, 152064, 0xed478395
+0, 46, 46, 1, 152064, 0x4cb25ab6
+0, 47, 47, 1, 152064, 0x28e7d51f
+0, 48, 48, 1, 152064, 0x8bcc1a8d
+0, 49, 49, 1, 152064, 0x2fe1f240
+0, 50, 50, 1, 152064, 0xb4978ef8
+0, 51, 51, 1, 152064, 0xe3929556
+0, 52, 52, 1, 152064, 0xd370632a
+0, 53, 53, 1, 152064, 0xba86ffb2
+0, 54, 54, 1, 152064, 0x444bf18c
+0, 55, 55, 1, 152064, 0xab40bd14
+0, 56, 56, 1, 152064, 0xfd488a5d
+0, 57, 57, 1, 152064, 0xe1f09568
+0, 58, 58, 1, 152064, 0x09ee7a7e
+0, 59, 59, 1, 152064, 0x9360397c
+0, 60, 60, 1, 152064, 0xdbd467e9
+0, 61, 61, 1, 152064, 0x99726777
+0, 62, 62, 1, 152064, 0x009fd46c
+0, 63, 63, 1, 152064, 0xcf770fdb
+0, 64, 64, 1, 152064, 0x2a890fd9
+0, 65, 65, 1, 152064, 0x7f40de4b
+0, 66, 66, 1, 152064, 0x04191304
+0, 67, 67, 1, 152064, 0x15722022
+0, 68, 68, 1, 152064, 0x59f4ea93
+0, 69, 69, 1, 152064, 0x28ba373f
+0, 70, 70, 1, 152064, 0xf9e400b8
+0, 71, 71, 1, 152064, 0x85c4bd98
+0, 72, 72, 1, 152064, 0x6917d2a5
+0, 73, 73, 1, 152064, 0x61cae234
+0, 74, 74, 1, 152064, 0x752a9a2d
+0, 75, 75, 1, 152064, 0x1ee2d9bd
+0, 76, 76, 1, 152064, 0xdce9ab8e
+0, 77, 77, 1, 152064, 0x51225fd0
+0, 78, 78, 1, 152064, 0x10e8cb60
+0, 79, 79, 1, 152064, 0x8d07cd25
+0, 80, 80, 1, 152064, 0xb18ba61b
+0, 81, 81, 1, 152064, 0xb0f10280
+0, 82, 82, 1, 152064, 0x76a71f13
+0, 83, 83, 1, 152064, 0x3004f5a1
+0, 84, 84, 1, 152064, 0x9aba5724
+0, 85, 85, 1, 152064, 0x5db85385
+0, 86, 86, 1, 152064, 0xbe9d3f5b
+0, 87, 87, 1, 152064, 0xa71e85bb
+0, 88, 88, 1, 152064, 0xdcf59cd7
+0, 89, 89, 1, 152064, 0x5e319459
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvmanl2_toshiba_b b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvmanl2_toshiba_b
index d8959a3..066c57f 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvmanl2_toshiba_b
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvmanl2_toshiba_b
@@ -1,90 +1,91 @@
-0, 0, 152064, 0xb1edd842
-0, 3600, 152064, 0x551f8f45
-0, 7200, 152064, 0xb4931cb2
-0, 10800, 152064, 0x5f352e98
-0, 14400, 152064, 0xeba5fe28
-0, 18000, 152064, 0x85afad0a
-0, 21600, 152064, 0x1120b6a4
-0, 25200, 152064, 0x67506e16
-0, 28800, 152064, 0x22421437
-0, 32400, 152064, 0x929becd6
-0, 36000, 152064, 0x6ffcb4b0
-0, 39600, 152064, 0x668a5d31
-0, 43200, 152064, 0x1b034ebb
-0, 46800, 152064, 0x7e2d213c
-0, 50400, 152064, 0xbf16d262
-0, 54000, 152064, 0xdeaecab3
-0, 57600, 152064, 0xd220d704
-0, 61200, 152064, 0xb40b8632
-0, 64800, 152064, 0xbdf0ef57
-0, 68400, 152064, 0x7e2e10df
-0, 72000, 152064, 0x95380024
-0, 75600, 152064, 0xdb80256d
-0, 79200, 152064, 0xa4561c61
-0, 82800, 152064, 0x08c8dea4
-0, 86400, 152064, 0x7bb917d6
-0, 90000, 152064, 0x796f0e2b
-0, 93600, 152064, 0x7f40c77a
-0, 97200, 152064, 0xda32de2e
-0, 100800, 152064, 0x00ffc15a
-0, 104400, 152064, 0x643c8316
-0, 108000, 152064, 0xb7588f7f
-0, 111600, 152064, 0xa4e07c02
-0, 115200, 152064, 0xdee0f7e7
-0, 118800, 152064, 0x2c3245ee
-0, 122400, 152064, 0x6565355b
-0, 126000, 152064, 0x90bce66b
-0, 129600, 152064, 0x0abffe08
-0, 133200, 152064, 0x119ccc3e
-0, 136800, 152064, 0xff997ef2
-0, 140400, 152064, 0xba4b9820
-0, 144000, 152064, 0xb6dfa596
-0, 147600, 152064, 0xb0906c42
-0, 151200, 152064, 0xf3c29133
-0, 154800, 152064, 0x08cd8e2b
-0, 158400, 152064, 0x4efc61fb
-0, 162000, 152064, 0x5b7c6e48
-0, 165600, 152064, 0xd28a47c2
-0, 169200, 152064, 0x28e7d51f
-0, 172800, 152064, 0x3a5619b1
-0, 176400, 152064, 0xa517e7f2
-0, 180000, 152064, 0xb4978ef8
-0, 183600, 152064, 0x25929175
-0, 187200, 152064, 0x20f05834
-0, 190800, 152064, 0xba86ffb2
-0, 194400, 152064, 0xa265f06f
-0, 198000, 152064, 0x97bbbfb7
-0, 201600, 152064, 0xfd488a5d
-0, 205200, 152064, 0x1b0989da
-0, 208800, 152064, 0xfd1878ce
-0, 212400, 152064, 0x9360397c
-0, 216000, 152064, 0x0d8151a7
-0, 219600, 152064, 0xe7a05bb8
-0, 223200, 152064, 0x009fd46c
-0, 226800, 152064, 0x8751123f
-0, 230400, 152064, 0x8252101a
-0, 234000, 152064, 0x7f40de4b
-0, 237600, 152064, 0x4ea317fe
-0, 241200, 152064, 0x519224d9
-0, 244800, 152064, 0x59f4ea93
-0, 248400, 152064, 0xc93c1dba
-0, 252000, 152064, 0xe3c9fb61
-0, 255600, 152064, 0x85c4bd98
-0, 259200, 152064, 0xcebacfd3
-0, 262800, 152064, 0x7327da99
-0, 266400, 152064, 0x752a9a2d
-0, 270000, 152064, 0x5ea6c8d2
-0, 273600, 152064, 0x66fd8c6f
-0, 277200, 152064, 0x51225fd0
-0, 280800, 152064, 0x58b9be96
-0, 284400, 152064, 0xa5abcdb7
-0, 288000, 152064, 0xb18ba61b
-0, 291600, 152064, 0xc7d20190
-0, 295200, 152064, 0xb6da14aa
-0, 298800, 152064, 0x3004f5a1
-0, 302400, 152064, 0x129354e2
-0, 306000, 152064, 0xffa148d5
-0, 309600, 152064, 0xbe9d3f5b
-0, 313200, 152064, 0x1c7f8976
-0, 316800, 152064, 0xa107a54d
-0, 320400, 152064, 0x5e319459
+#tb 0: 1/25
+0, 0, 0, 1, 152064, 0xb1edd842
+0, 1, 1, 1, 152064, 0x551f8f45
+0, 2, 2, 1, 152064, 0xb4931cb2
+0, 3, 3, 1, 152064, 0x5f352e98
+0, 4, 4, 1, 152064, 0xeba5fe28
+0, 5, 5, 1, 152064, 0x85afad0a
+0, 6, 6, 1, 152064, 0x1120b6a4
+0, 7, 7, 1, 152064, 0x67506e16
+0, 8, 8, 1, 152064, 0x22421437
+0, 9, 9, 1, 152064, 0x929becd6
+0, 10, 10, 1, 152064, 0x6ffcb4b0
+0, 11, 11, 1, 152064, 0x668a5d31
+0, 12, 12, 1, 152064, 0x1b034ebb
+0, 13, 13, 1, 152064, 0x7e2d213c
+0, 14, 14, 1, 152064, 0xbf16d262
+0, 15, 15, 1, 152064, 0xdeaecab3
+0, 16, 16, 1, 152064, 0xd220d704
+0, 17, 17, 1, 152064, 0xb40b8632
+0, 18, 18, 1, 152064, 0xbdf0ef57
+0, 19, 19, 1, 152064, 0x7e2e10df
+0, 20, 20, 1, 152064, 0x95380024
+0, 21, 21, 1, 152064, 0xdb80256d
+0, 22, 22, 1, 152064, 0xa4561c61
+0, 23, 23, 1, 152064, 0x08c8dea4
+0, 24, 24, 1, 152064, 0x7bb917d6
+0, 25, 25, 1, 152064, 0x796f0e2b
+0, 26, 26, 1, 152064, 0x7f40c77a
+0, 27, 27, 1, 152064, 0xda32de2e
+0, 28, 28, 1, 152064, 0x00ffc15a
+0, 29, 29, 1, 152064, 0x643c8316
+0, 30, 30, 1, 152064, 0xb7588f7f
+0, 31, 31, 1, 152064, 0xa4e07c02
+0, 32, 32, 1, 152064, 0xdee0f7e7
+0, 33, 33, 1, 152064, 0x2c3245ee
+0, 34, 34, 1, 152064, 0x6565355b
+0, 35, 35, 1, 152064, 0x90bce66b
+0, 36, 36, 1, 152064, 0x0abffe08
+0, 37, 37, 1, 152064, 0x119ccc3e
+0, 38, 38, 1, 152064, 0xff997ef2
+0, 39, 39, 1, 152064, 0xba4b9820
+0, 40, 40, 1, 152064, 0xb6dfa596
+0, 41, 41, 1, 152064, 0xb0906c42
+0, 42, 42, 1, 152064, 0xf3c29133
+0, 43, 43, 1, 152064, 0x08cd8e2b
+0, 44, 44, 1, 152064, 0x4efc61fb
+0, 45, 45, 1, 152064, 0x5b7c6e48
+0, 46, 46, 1, 152064, 0xd28a47c2
+0, 47, 47, 1, 152064, 0x28e7d51f
+0, 48, 48, 1, 152064, 0x3a5619b1
+0, 49, 49, 1, 152064, 0xa517e7f2
+0, 50, 50, 1, 152064, 0xb4978ef8
+0, 51, 51, 1, 152064, 0x25929175
+0, 52, 52, 1, 152064, 0x20f05834
+0, 53, 53, 1, 152064, 0xba86ffb2
+0, 54, 54, 1, 152064, 0xa265f06f
+0, 55, 55, 1, 152064, 0x97bbbfb7
+0, 56, 56, 1, 152064, 0xfd488a5d
+0, 57, 57, 1, 152064, 0x1b0989da
+0, 58, 58, 1, 152064, 0xfd1878ce
+0, 59, 59, 1, 152064, 0x9360397c
+0, 60, 60, 1, 152064, 0x0d8151a7
+0, 61, 61, 1, 152064, 0xe7a05bb8
+0, 62, 62, 1, 152064, 0x009fd46c
+0, 63, 63, 1, 152064, 0x8751123f
+0, 64, 64, 1, 152064, 0x8252101a
+0, 65, 65, 1, 152064, 0x7f40de4b
+0, 66, 66, 1, 152064, 0x4ea317fe
+0, 67, 67, 1, 152064, 0x519224d9
+0, 68, 68, 1, 152064, 0x59f4ea93
+0, 69, 69, 1, 152064, 0xc93c1dba
+0, 70, 70, 1, 152064, 0xe3c9fb61
+0, 71, 71, 1, 152064, 0x85c4bd98
+0, 72, 72, 1, 152064, 0xcebacfd3
+0, 73, 73, 1, 152064, 0x7327da99
+0, 74, 74, 1, 152064, 0x752a9a2d
+0, 75, 75, 1, 152064, 0x5ea6c8d2
+0, 76, 76, 1, 152064, 0x66fd8c6f
+0, 77, 77, 1, 152064, 0x51225fd0
+0, 78, 78, 1, 152064, 0x58b9be96
+0, 79, 79, 1, 152064, 0xa5abcdb7
+0, 80, 80, 1, 152064, 0xb18ba61b
+0, 81, 81, 1, 152064, 0xc7d20190
+0, 82, 82, 1, 152064, 0xb6da14aa
+0, 83, 83, 1, 152064, 0x3004f5a1
+0, 84, 84, 1, 152064, 0x129354e2
+0, 85, 85, 1, 152064, 0xffa148d5
+0, 86, 86, 1, 152064, 0xbe9d3f5b
+0, 87, 87, 1, 152064, 0x1c7f8976
+0, 88, 88, 1, 152064, 0xa107a54d
+0, 89, 89, 1, 152064, 0x5e319459
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvmapaqp3_sony_e b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvmapaqp3_sony_e
index ba89dfc..094fc98 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvmapaqp3_sony_e
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvmapaqp3_sony_e
@@ -1,8 +1,9 @@
-0, 0, 518400, 0x80dffda2
-0, 3600, 518400, 0x9450183b
-0, 7200, 518400, 0x85d429a7
-0, 10800, 518400, 0xe1f3b686
-0, 14400, 518400, 0x2180c761
-0, 18000, 518400, 0x30269c7c
-0, 21600, 518400, 0xe9aa575a
-0, 25200, 518400, 0x7b815a0a
+#tb 0: 1/25
+0, 0, 0, 1, 518400, 0x80dffda2
+0, 1, 1, 1, 518400, 0x9450183b
+0, 2, 2, 1, 518400, 0x85d429a7
+0, 3, 3, 1, 518400, 0xe1f3b686
+0, 4, 4, 1, 518400, 0x2180c761
+0, 5, 5, 1, 518400, 0x30269c7c
+0, 6, 6, 1, 518400, 0xe9aa575a
+0, 7, 7, 1, 518400, 0x7b815a0a
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvmaqp2_sony_g b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvmaqp2_sony_g
index 292aeed..886ea4c 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvmaqp2_sony_g
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvmaqp2_sony_g
@@ -1,17 +1,18 @@
-0, 0, 36864, 0xdee3d4e3
-0, 3600, 36864, 0xaa1a67ca
-0, 7200, 36864, 0xe00e0dec
-0, 10800, 36864, 0x31f0b63f
-0, 14400, 36864, 0xd0cc34d9
-0, 18000, 36864, 0x3e76eba5
-0, 21600, 36864, 0x0e7dcc9c
-0, 25200, 36864, 0xd71bc457
-0, 28800, 36864, 0x11c81ebe
-0, 32400, 36864, 0x1d4ca6d7
-0, 36000, 36864, 0xb191d155
-0, 39600, 36864, 0x435a188c
-0, 43200, 36864, 0x99d7227c
-0, 46800, 36864, 0x700637fc
-0, 50400, 36864, 0x351f7dd3
-0, 54000, 36864, 0x1658c18b
-0, 57600, 36864, 0x60034b90
+#tb 0: 1/25
+0, 0, 0, 1, 36864, 0xdee3d4e3
+0, 1, 1, 1, 36864, 0xaa1a67ca
+0, 2, 2, 1, 36864, 0xe00e0dec
+0, 3, 3, 1, 36864, 0x31f0b63f
+0, 4, 4, 1, 36864, 0xd0cc34d9
+0, 5, 5, 1, 36864, 0x3e76eba5
+0, 6, 6, 1, 36864, 0x0e7dcc9c
+0, 7, 7, 1, 36864, 0xd71bc457
+0, 8, 8, 1, 36864, 0x11c81ebe
+0, 9, 9, 1, 36864, 0x1d4ca6d7
+0, 10, 10, 1, 36864, 0xb191d155
+0, 11, 11, 1, 36864, 0x435a188c
+0, 12, 12, 1, 36864, 0x99d7227c
+0, 13, 13, 1, 36864, 0x700637fc
+0, 14, 14, 1, 36864, 0x351f7dd3
+0, 15, 15, 1, 36864, 0x1658c18b
+0, 16, 16, 1, 36864, 0x60034b90
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvmaqp3_sony_d b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvmaqp3_sony_d
index c029f45..7c3d96d 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvmaqp3_sony_d
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvmaqp3_sony_d
@@ -1,17 +1,18 @@
-0, 0, 36864, 0xdee3d4e3
-0, 3600, 36864, 0xabec8d44
-0, 7200, 36864, 0x95d029fe
-0, 10800, 36864, 0x4daeb4b9
-0, 14400, 36864, 0x320a6301
-0, 18000, 36864, 0x6b881d0c
-0, 21600, 36864, 0xfe6eda15
-0, 25200, 36864, 0xda72d0b2
-0, 28800, 36864, 0x3232651b
-0, 32400, 36864, 0x9f20cbf1
-0, 36000, 36864, 0x5dfbd085
-0, 39600, 36864, 0x2bb62dd1
-0, 43200, 36864, 0xf8ed11cf
-0, 46800, 36864, 0x1ed62476
-0, 50400, 36864, 0x65b18976
-0, 54000, 36864, 0x1658c18b
-0, 57600, 36864, 0x76073a08
+#tb 0: 1/25
+0, 0, 0, 1, 36864, 0xdee3d4e3
+0, 1, 1, 1, 36864, 0xabec8d44
+0, 2, 2, 1, 36864, 0x95d029fe
+0, 3, 3, 1, 36864, 0x4daeb4b9
+0, 4, 4, 1, 36864, 0x320a6301
+0, 5, 5, 1, 36864, 0x6b881d0c
+0, 6, 6, 1, 36864, 0xfe6eda15
+0, 7, 7, 1, 36864, 0xda72d0b2
+0, 8, 8, 1, 36864, 0x3232651b
+0, 9, 9, 1, 36864, 0x9f20cbf1
+0, 10, 10, 1, 36864, 0x5dfbd085
+0, 11, 11, 1, 36864, 0x2bb62dd1
+0, 12, 12, 1, 36864, 0xf8ed11cf
+0, 13, 13, 1, 36864, 0x1ed62476
+0, 14, 14, 1, 36864, 0x65b18976
+0, 15, 15, 1, 36864, 0x1658c18b
+0, 16, 16, 1, 36864, 0x76073a08
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvmp_mot_fld_l30_b b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvmp_mot_fld_l30_b
index ba7caaf..57fa2f7 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvmp_mot_fld_l30_b
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvmp_mot_fld_l30_b
@@ -1,30 +1,31 @@
-0, 0, 518400, 0xe9c7643e
-0, 3600, 518400, 0xba7456ec
-0, 7200, 518400, 0xdeb96749
-0, 10800, 518400, 0xa101a986
-0, 14400, 518400, 0x3db7baa5
-0, 18000, 518400, 0xf3dfcec7
-0, 21600, 518400, 0x79b4f537
-0, 25200, 518400, 0x9e64fe68
-0, 28800, 518400, 0x0e810b53
-0, 32400, 518400, 0x20baf3b8
-0, 36000, 518400, 0x0a49d341
-0, 39600, 518400, 0xa8304ab5
-0, 43200, 518400, 0x2600e98f
-0, 46800, 518400, 0x9253e3e8
-0, 50400, 518400, 0xd6e12783
-0, 54000, 518400, 0x6894fc79
-0, 57600, 518400, 0xfb60d3e3
-0, 61200, 518400, 0x523602be
-0, 64800, 518400, 0x4979f409
-0, 68400, 518400, 0x50d4e2ab
-0, 72000, 518400, 0xa8c2140a
-0, 75600, 518400, 0x45c0bc15
-0, 79200, 518400, 0xaef78cab
-0, 82800, 518400, 0xec539d02
-0, 86400, 518400, 0x602585ea
-0, 90000, 518400, 0xda263463
-0, 93600, 518400, 0xa03d8922
-0, 97200, 518400, 0x43ea1c1d
-0, 100800, 518400, 0xb1e055a6
-0, 104400, 518400, 0x6fff9398
+#tb 0: 1/25
+0, 0, 0, 1, 518400, 0xe9c7643e
+0, 1, 1, 1, 518400, 0xba7456ec
+0, 2, 2, 1, 518400, 0xdeb96749
+0, 3, 3, 1, 518400, 0xa101a986
+0, 4, 4, 1, 518400, 0x3db7baa5
+0, 5, 5, 1, 518400, 0xf3dfcec7
+0, 6, 6, 1, 518400, 0x79b4f537
+0, 7, 7, 1, 518400, 0x9e64fe68
+0, 8, 8, 1, 518400, 0x0e810b53
+0, 9, 9, 1, 518400, 0x20baf3b8
+0, 10, 10, 1, 518400, 0x0a49d341
+0, 11, 11, 1, 518400, 0xa8304ab5
+0, 12, 12, 1, 518400, 0x2600e98f
+0, 13, 13, 1, 518400, 0x9253e3e8
+0, 14, 14, 1, 518400, 0xd6e12783
+0, 15, 15, 1, 518400, 0x6894fc79
+0, 16, 16, 1, 518400, 0xfb60d3e3
+0, 17, 17, 1, 518400, 0x523602be
+0, 18, 18, 1, 518400, 0x4979f409
+0, 19, 19, 1, 518400, 0x50d4e2ab
+0, 20, 20, 1, 518400, 0xa8c2140a
+0, 21, 21, 1, 518400, 0x45c0bc15
+0, 22, 22, 1, 518400, 0xaef78cab
+0, 23, 23, 1, 518400, 0xec539d02
+0, 24, 24, 1, 518400, 0x602585ea
+0, 25, 25, 1, 518400, 0xda263463
+0, 26, 26, 1, 518400, 0xa03d8922
+0, 27, 27, 1, 518400, 0x43ea1c1d
+0, 28, 28, 1, 518400, 0xb1e055a6
+0, 29, 29, 1, 518400, 0x6fff9398
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvmp_mot_frm_l31_b b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvmp_mot_frm_l31_b
index 05827ef..bc7e81e 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvmp_mot_frm_l31_b
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvmp_mot_frm_l31_b
@@ -1,30 +1,31 @@
-0, 0, 518400, 0x7b2475e3
-0, 3600, 518400, 0xda786a87
-0, 7200, 518400, 0xb1dd8108
-0, 10800, 518400, 0x760ed65d
-0, 14400, 518400, 0x8632d20c
-0, 18000, 518400, 0xdd81e625
-0, 21600, 518400, 0x853f1c41
-0, 25200, 518400, 0x20191585
-0, 28800, 518400, 0x0367e357
-0, 32400, 518400, 0x60521167
-0, 36000, 518400, 0xa887d4cc
-0, 39600, 518400, 0x9a450f9e
-0, 43200, 518400, 0xe9620841
-0, 46800, 518400, 0xb482fb0e
-0, 50400, 518400, 0x7b79f670
-0, 54000, 518400, 0x9d37f1d1
-0, 57600, 518400, 0xe358d323
-0, 61200, 518400, 0x62ade59c
-0, 64800, 518400, 0xdd78da66
-0, 68400, 518400, 0xd97b867b
-0, 72000, 518400, 0x8a90cf8c
-0, 75600, 518400, 0x9d386610
-0, 79200, 518400, 0x2c590f46
-0, 82800, 518400, 0x92662861
-0, 86400, 518400, 0x6979f563
-0, 90000, 518400, 0xdd0fa1b2
-0, 93600, 518400, 0xccbf1c1c
-0, 97200, 518400, 0x7e358112
-0, 100800, 518400, 0xb7c0d89d
-0, 104400, 518400, 0xc6b03973
+#tb 0: 1/25
+0, 0, 0, 1, 518400, 0x7b2475e3
+0, 1, 1, 1, 518400, 0xda786a87
+0, 2, 2, 1, 518400, 0xb1dd8108
+0, 3, 3, 1, 518400, 0x760ed65d
+0, 4, 4, 1, 518400, 0x8632d20c
+0, 5, 5, 1, 518400, 0xdd81e625
+0, 6, 6, 1, 518400, 0x853f1c41
+0, 7, 7, 1, 518400, 0x20191585
+0, 8, 8, 1, 518400, 0x0367e357
+0, 9, 9, 1, 518400, 0x60521167
+0, 10, 10, 1, 518400, 0xa887d4cc
+0, 11, 11, 1, 518400, 0x9a450f9e
+0, 12, 12, 1, 518400, 0xe9620841
+0, 13, 13, 1, 518400, 0xb482fb0e
+0, 14, 14, 1, 518400, 0x7b79f670
+0, 15, 15, 1, 518400, 0x9d37f1d1
+0, 16, 16, 1, 518400, 0xe358d323
+0, 17, 17, 1, 518400, 0x62ade59c
+0, 18, 18, 1, 518400, 0xdd78da66
+0, 19, 19, 1, 518400, 0xd97b867b
+0, 20, 20, 1, 518400, 0x8a90cf8c
+0, 21, 21, 1, 518400, 0x9d386610
+0, 22, 22, 1, 518400, 0x2c590f46
+0, 23, 23, 1, 518400, 0x92662861
+0, 24, 24, 1, 518400, 0x6979f563
+0, 25, 25, 1, 518400, 0xdd0fa1b2
+0, 26, 26, 1, 518400, 0xccbf1c1c
+0, 27, 27, 1, 518400, 0x7e358112
+0, 28, 28, 1, 518400, 0xb7c0d89d
+0, 29, 29, 1, 518400, 0xc6b03973
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvnlfi1_sony_c b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvnlfi1_sony_c
index 26fa93a..aa3c220 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvnlfi1_sony_c
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvnlfi1_sony_c
@@ -1,17 +1,18 @@
-0, 0, 518400, 0x0fbb4e71
-0, 3600, 518400, 0x4b816734
-0, 7200, 518400, 0x0c350f19
-0, 10800, 518400, 0xda049cb6
-0, 14400, 518400, 0x1f3e7bb9
-0, 18000, 518400, 0x995cbe66
-0, 21600, 518400, 0x07f7e65c
-0, 25200, 518400, 0xfcb7487f
-0, 28800, 518400, 0xb080f48a
-0, 32400, 518400, 0x3ef5b7e4
-0, 36000, 518400, 0xa1518e1c
-0, 39600, 518400, 0xb36f1cc9
-0, 43200, 518400, 0x86ea48af
-0, 46800, 518400, 0xe42373b7
-0, 50400, 518400, 0xa8435828
-0, 54000, 518400, 0xc942ea0e
-0, 57600, 518400, 0xcc597514
+#tb 0: 1/25
+0, 0, 0, 1, 518400, 0x0fbb4e71
+0, 1, 1, 1, 518400, 0x4b816734
+0, 2, 2, 1, 518400, 0x0c350f19
+0, 3, 3, 1, 518400, 0xda049cb6
+0, 4, 4, 1, 518400, 0x1f3e7bb9
+0, 5, 5, 1, 518400, 0x995cbe66
+0, 6, 6, 1, 518400, 0x07f7e65c
+0, 7, 7, 1, 518400, 0xfcb7487f
+0, 8, 8, 1, 518400, 0xb080f48a
+0, 9, 9, 1, 518400, 0x3ef5b7e4
+0, 10, 10, 1, 518400, 0xa1518e1c
+0, 11, 11, 1, 518400, 0xb36f1cc9
+0, 12, 12, 1, 518400, 0x86ea48af
+0, 13, 13, 1, 518400, 0xe42373b7
+0, 14, 14, 1, 518400, 0xa8435828
+0, 15, 15, 1, 518400, 0xc942ea0e
+0, 16, 16, 1, 518400, 0xcc597514
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvnlfi2_sony_h b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvnlfi2_sony_h
index 045929b..fe2e4d1 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvnlfi2_sony_h
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvnlfi2_sony_h
@@ -1,17 +1,18 @@
-0, 0, 518400, 0x0fbb4e71
-0, 3600, 518400, 0xc46bec04
-0, 7200, 518400, 0xc50ffc1d
-0, 10800, 518400, 0x684b07b7
-0, 14400, 518400, 0xde799af0
-0, 18000, 518400, 0xed497b27
-0, 21600, 518400, 0x3e9d1e3a
-0, 25200, 518400, 0x154d3c5c
-0, 28800, 518400, 0x5257e37c
-0, 32400, 518400, 0x6e15139a
-0, 36000, 518400, 0x5dc39c59
-0, 39600, 518400, 0xe1803100
-0, 43200, 518400, 0xb4d4d535
-0, 46800, 518400, 0x7a97a25d
-0, 50400, 518400, 0xf86b8923
-0, 54000, 518400, 0x3355be98
-0, 57600, 518400, 0x8f555830
+#tb 0: 1/25
+0, 0, 0, 1, 518400, 0x0fbb4e71
+0, 1, 1, 1, 518400, 0xc46bec04
+0, 2, 2, 1, 518400, 0xc50ffc1d
+0, 3, 3, 1, 518400, 0x684b07b7
+0, 4, 4, 1, 518400, 0xde799af0
+0, 5, 5, 1, 518400, 0xed497b27
+0, 6, 6, 1, 518400, 0x3e9d1e3a
+0, 7, 7, 1, 518400, 0x154d3c5c
+0, 8, 8, 1, 518400, 0x5257e37c
+0, 9, 9, 1, 518400, 0x6e15139a
+0, 10, 10, 1, 518400, 0x5dc39c59
+0, 11, 11, 1, 518400, 0xe1803100
+0, 12, 12, 1, 518400, 0xb4d4d535
+0, 13, 13, 1, 518400, 0x7a97a25d
+0, 14, 14, 1, 518400, 0xf86b8923
+0, 15, 15, 1, 518400, 0x3355be98
+0, 16, 16, 1, 518400, 0x8f555830
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvpa1_toshiba_b b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvpa1_toshiba_b
index 6f94315..fd0911b 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvpa1_toshiba_b
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvpa1_toshiba_b
@@ -1,90 +1,91 @@
-0, 0, 152064, 0x128cd77a
-0, 3600, 152064, 0x565b9fc1
-0, 7200, 152064, 0xbe322679
-0, 10800, 152064, 0x0ea4238f
-0, 14400, 152064, 0x1e08fb3c
-0, 18000, 152064, 0x6da3a93c
-0, 21600, 152064, 0x75e5b181
-0, 25200, 152064, 0xa0b39334
-0, 28800, 152064, 0xa0d10d6d
-0, 32400, 152064, 0x33842bcb
-0, 36000, 152064, 0x9a74e1e4
-0, 39600, 152064, 0xc2037244
-0, 43200, 152064, 0x364b8ae4
-0, 46800, 152064, 0x18c04971
-0, 50400, 152064, 0x7234ecb5
-0, 54000, 152064, 0x3719f8bc
-0, 57600, 152064, 0x1285ead1
-0, 61200, 152064, 0xd3bfab18
-0, 64800, 152064, 0x898111e2
-0, 68400, 152064, 0x681c15fc
-0, 72000, 152064, 0x8e501572
-0, 75600, 152064, 0xd7c838be
-0, 79200, 152064, 0xede424b2
-0, 82800, 152064, 0xcfc20240
-0, 86400, 152064, 0x13992e86
-0, 90000, 152064, 0x56fb251a
-0, 93600, 152064, 0xee9be320
-0, 97200, 152064, 0xea650153
-0, 100800, 152064, 0x2cb6dabe
-0, 104400, 152064, 0xf44fa4b5
-0, 108000, 152064, 0xdac2adff
-0, 111600, 152064, 0x9e15a1dc
-0, 115200, 152064, 0x28d00970
-0, 118800, 152064, 0xe4277347
-0, 122400, 152064, 0xebd25ad1
-0, 126000, 152064, 0x029402da
-0, 129600, 152064, 0x1a2311ef
-0, 133200, 152064, 0xb86bf96a
-0, 136800, 152064, 0x67d7a5b0
-0, 140400, 152064, 0x573abc2d
-0, 144000, 152064, 0xbe97dec0
-0, 147600, 152064, 0x592b91a4
-0, 151200, 152064, 0x9adda65e
-0, 154800, 152064, 0x0354b2cb
-0, 158400, 152064, 0x91e27ff9
-0, 162000, 152064, 0x389f8625
-0, 165600, 152064, 0x90175850
-0, 169200, 152064, 0x2d36c427
-0, 172800, 152064, 0xc0dd14ab
-0, 176400, 152064, 0xd49bf131
-0, 180000, 152064, 0x0d4a9b92
-0, 183600, 152064, 0xae9bb2f1
-0, 187200, 152064, 0x36847ade
-0, 190800, 152064, 0x74810382
-0, 194400, 152064, 0xc56d1d9f
-0, 198000, 152064, 0xcfefe3ae
-0, 201600, 152064, 0xeaa39353
-0, 205200, 152064, 0x14289aef
-0, 208800, 152064, 0x74ba8f3b
-0, 212400, 152064, 0xdcaa518d
-0, 216000, 152064, 0x6e4881c2
-0, 219600, 152064, 0xa4db767d
-0, 223200, 152064, 0x239b0b19
-0, 226800, 152064, 0x5d054236
-0, 230400, 152064, 0x6f392d7c
-0, 234000, 152064, 0x5c2af146
-0, 237600, 152064, 0x26b439af
-0, 241200, 152064, 0xba7043ab
-0, 244800, 152064, 0x0816000c
-0, 248400, 152064, 0x3a713c05
-0, 252000, 152064, 0xb3111f6d
-0, 255600, 152064, 0xdbf8dae2
-0, 259200, 152064, 0x09ddf22e
-0, 262800, 152064, 0x8871fa7e
-0, 266400, 152064, 0x9f5db7a1
-0, 270000, 152064, 0xcc38f225
-0, 273600, 152064, 0xa1d18df9
-0, 277200, 152064, 0x9b1c5d6a
-0, 280800, 152064, 0x9f2bc696
-0, 284400, 152064, 0xc39bd11a
-0, 288000, 152064, 0x4ceca7d0
-0, 291600, 152064, 0x63a60f1d
-0, 295200, 152064, 0x4cd31f28
-0, 298800, 152064, 0x9c9af5d1
-0, 302400, 152064, 0x6def65fc
-0, 306000, 152064, 0x1011466d
-0, 309600, 152064, 0xfeca406d
-0, 313200, 152064, 0xd1ca8a1e
-0, 316800, 152064, 0x30caa195
-0, 320400, 152064, 0x31a09a48
+#tb 0: 1/25
+0, 0, 0, 1, 152064, 0x128cd77a
+0, 1, 1, 1, 152064, 0x565b9fc1
+0, 2, 2, 1, 152064, 0xbe322679
+0, 3, 3, 1, 152064, 0x0ea4238f
+0, 4, 4, 1, 152064, 0x1e08fb3c
+0, 5, 5, 1, 152064, 0x6da3a93c
+0, 6, 6, 1, 152064, 0x75e5b181
+0, 7, 7, 1, 152064, 0xa0b39334
+0, 8, 8, 1, 152064, 0xa0d10d6d
+0, 9, 9, 1, 152064, 0x33842bcb
+0, 10, 10, 1, 152064, 0x9a74e1e4
+0, 11, 11, 1, 152064, 0xc2037244
+0, 12, 12, 1, 152064, 0x364b8ae4
+0, 13, 13, 1, 152064, 0x18c04971
+0, 14, 14, 1, 152064, 0x7234ecb5
+0, 15, 15, 1, 152064, 0x3719f8bc
+0, 16, 16, 1, 152064, 0x1285ead1
+0, 17, 17, 1, 152064, 0xd3bfab18
+0, 18, 18, 1, 152064, 0x898111e2
+0, 19, 19, 1, 152064, 0x681c15fc
+0, 20, 20, 1, 152064, 0x8e501572
+0, 21, 21, 1, 152064, 0xd7c838be
+0, 22, 22, 1, 152064, 0xede424b2
+0, 23, 23, 1, 152064, 0xcfc20240
+0, 24, 24, 1, 152064, 0x13992e86
+0, 25, 25, 1, 152064, 0x56fb251a
+0, 26, 26, 1, 152064, 0xee9be320
+0, 27, 27, 1, 152064, 0xea650153
+0, 28, 28, 1, 152064, 0x2cb6dabe
+0, 29, 29, 1, 152064, 0xf44fa4b5
+0, 30, 30, 1, 152064, 0xdac2adff
+0, 31, 31, 1, 152064, 0x9e15a1dc
+0, 32, 32, 1, 152064, 0x28d00970
+0, 33, 33, 1, 152064, 0xe4277347
+0, 34, 34, 1, 152064, 0xebd25ad1
+0, 35, 35, 1, 152064, 0x029402da
+0, 36, 36, 1, 152064, 0x1a2311ef
+0, 37, 37, 1, 152064, 0xb86bf96a
+0, 38, 38, 1, 152064, 0x67d7a5b0
+0, 39, 39, 1, 152064, 0x573abc2d
+0, 40, 40, 1, 152064, 0xbe97dec0
+0, 41, 41, 1, 152064, 0x592b91a4
+0, 42, 42, 1, 152064, 0x9adda65e
+0, 43, 43, 1, 152064, 0x0354b2cb
+0, 44, 44, 1, 152064, 0x91e27ff9
+0, 45, 45, 1, 152064, 0x389f8625
+0, 46, 46, 1, 152064, 0x90175850
+0, 47, 47, 1, 152064, 0x2d36c427
+0, 48, 48, 1, 152064, 0xc0dd14ab
+0, 49, 49, 1, 152064, 0xd49bf131
+0, 50, 50, 1, 152064, 0x0d4a9b92
+0, 51, 51, 1, 152064, 0xae9bb2f1
+0, 52, 52, 1, 152064, 0x36847ade
+0, 53, 53, 1, 152064, 0x74810382
+0, 54, 54, 1, 152064, 0xc56d1d9f
+0, 55, 55, 1, 152064, 0xcfefe3ae
+0, 56, 56, 1, 152064, 0xeaa39353
+0, 57, 57, 1, 152064, 0x14289aef
+0, 58, 58, 1, 152064, 0x74ba8f3b
+0, 59, 59, 1, 152064, 0xdcaa518d
+0, 60, 60, 1, 152064, 0x6e4881c2
+0, 61, 61, 1, 152064, 0xa4db767d
+0, 62, 62, 1, 152064, 0x239b0b19
+0, 63, 63, 1, 152064, 0x5d054236
+0, 64, 64, 1, 152064, 0x6f392d7c
+0, 65, 65, 1, 152064, 0x5c2af146
+0, 66, 66, 1, 152064, 0x26b439af
+0, 67, 67, 1, 152064, 0xba7043ab
+0, 68, 68, 1, 152064, 0x0816000c
+0, 69, 69, 1, 152064, 0x3a713c05
+0, 70, 70, 1, 152064, 0xb3111f6d
+0, 71, 71, 1, 152064, 0xdbf8dae2
+0, 72, 72, 1, 152064, 0x09ddf22e
+0, 73, 73, 1, 152064, 0x8871fa7e
+0, 74, 74, 1, 152064, 0x9f5db7a1
+0, 75, 75, 1, 152064, 0xcc38f225
+0, 76, 76, 1, 152064, 0xa1d18df9
+0, 77, 77, 1, 152064, 0x9b1c5d6a
+0, 78, 78, 1, 152064, 0x9f2bc696
+0, 79, 79, 1, 152064, 0xc39bd11a
+0, 80, 80, 1, 152064, 0x4ceca7d0
+0, 81, 81, 1, 152064, 0x63a60f1d
+0, 82, 82, 1, 152064, 0x4cd31f28
+0, 83, 83, 1, 152064, 0x9c9af5d1
+0, 84, 84, 1, 152064, 0x6def65fc
+0, 85, 85, 1, 152064, 0x1011466d
+0, 86, 86, 1, 152064, 0xfeca406d
+0, 87, 87, 1, 152064, 0xd1ca8a1e
+0, 88, 88, 1, 152064, 0x30caa195
+0, 89, 89, 1, 152064, 0x31a09a48
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvpcmnl1_sva_c b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvpcmnl1_sva_c
index feb3010..95c9903 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvpcmnl1_sva_c
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvpcmnl1_sva_c
@@ -1,30 +1,31 @@
-0, 0, 152064, 0x19b8407d
-0, 3600, 152064, 0xab8bede6
-0, 7200, 152064, 0xf59acd09
-0, 10800, 152064, 0xc905853b
-0, 14400, 152064, 0x1c3d32f8
-0, 18000, 152064, 0x26a91508
-0, 21600, 152064, 0x9443e44a
-0, 25200, 152064, 0x0d158c55
-0, 28800, 152064, 0x4b207062
-0, 32400, 152064, 0x31d8543f
-0, 36000, 152064, 0x43520337
-0, 39600, 152064, 0x4676dd14
-0, 43200, 152064, 0x8b4291d4
-0, 46800, 152064, 0xb35e4950
-0, 50400, 152064, 0xd7164390
-0, 54000, 152064, 0x7cce0af7
-0, 57600, 152064, 0x4f67ca7d
-0, 61200, 152064, 0xd517af08
-0, 64800, 152064, 0x519b8322
-0, 68400, 152064, 0xa87d2987
-0, 72000, 152064, 0xfe8cfd89
-0, 75600, 152064, 0x3b40b919
-0, 79200, 152064, 0x83398526
-0, 82800, 152064, 0x309b6168
-0, 86400, 152064, 0xa8351c37
-0, 90000, 152064, 0x7977f8fd
-0, 93600, 152064, 0x5b24e5a7
-0, 97200, 152064, 0x0ad0a48e
-0, 100800, 152064, 0xd93a7d3e
-0, 104400, 152064, 0xae0f6631
+#tb 0: 1/25
+0, 0, 0, 1, 152064, 0x19b8407d
+0, 1, 1, 1, 152064, 0xab8bede6
+0, 2, 2, 1, 152064, 0xf59acd09
+0, 3, 3, 1, 152064, 0xc905853b
+0, 4, 4, 1, 152064, 0x1c3d32f8
+0, 5, 5, 1, 152064, 0x26a91508
+0, 6, 6, 1, 152064, 0x9443e44a
+0, 7, 7, 1, 152064, 0x0d158c55
+0, 8, 8, 1, 152064, 0x4b207062
+0, 9, 9, 1, 152064, 0x31d8543f
+0, 10, 10, 1, 152064, 0x43520337
+0, 11, 11, 1, 152064, 0x4676dd14
+0, 12, 12, 1, 152064, 0x8b4291d4
+0, 13, 13, 1, 152064, 0xb35e4950
+0, 14, 14, 1, 152064, 0xd7164390
+0, 15, 15, 1, 152064, 0x7cce0af7
+0, 16, 16, 1, 152064, 0x4f67ca7d
+0, 17, 17, 1, 152064, 0xd517af08
+0, 18, 18, 1, 152064, 0x519b8322
+0, 19, 19, 1, 152064, 0xa87d2987
+0, 20, 20, 1, 152064, 0xfe8cfd89
+0, 21, 21, 1, 152064, 0x3b40b919
+0, 22, 22, 1, 152064, 0x83398526
+0, 23, 23, 1, 152064, 0x309b6168
+0, 24, 24, 1, 152064, 0xa8351c37
+0, 25, 25, 1, 152064, 0x7977f8fd
+0, 26, 26, 1, 152064, 0x5b24e5a7
+0, 27, 27, 1, 152064, 0x0ad0a48e
+0, 28, 28, 1, 152064, 0xd93a7d3e
+0, 29, 29, 1, 152064, 0xae0f6631
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvpcmnl2_sva_c b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvpcmnl2_sva_c
index 16a4650..4f92eab 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvpcmnl2_sva_c
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvpcmnl2_sva_c
@@ -1,2 +1,3 @@
-0, 0, 1382400, 0xccbe6bf8
-0, 3600, 1382400, 0x49c0cfd7
+#tb 0: 1/25
+0, 0, 0, 1, 1382400, 0xccbe6bf8
+0, 1, 1, 1, 1382400, 0x49c0cfd7
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvwp1_toshiba_e b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvwp1_toshiba_e
index 6c9b227..b184c84 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvwp1_toshiba_e
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvwp1_toshiba_e
@@ -1,90 +1,91 @@
-0, 0, 152064, 0xabf9ae05
-0, 3600, 152064, 0x20418b16
-0, 7200, 152064, 0xe941572f
-0, 10800, 152064, 0xcf63e20e
-0, 14400, 152064, 0x57dedcde
-0, 18000, 152064, 0x4de7bf34
-0, 21600, 152064, 0xc8014983
-0, 25200, 152064, 0x5ab946fc
-0, 28800, 152064, 0x2ca02582
-0, 32400, 152064, 0x9c95435d
-0, 36000, 152064, 0x8371b963
-0, 39600, 152064, 0xa0f1af67
-0, 43200, 152064, 0xf1155345
-0, 46800, 152064, 0x66a71c79
-0, 50400, 152064, 0x509db08a
-0, 54000, 152064, 0x3d457728
-0, 57600, 152064, 0x66035e2b
-0, 61200, 152064, 0xa4113115
-0, 64800, 152064, 0x3d35d3c0
-0, 68400, 152064, 0x5117d324
-0, 72000, 152064, 0x7b0c7660
-0, 75600, 152064, 0x0eacf9ba
-0, 79200, 152064, 0x358d0486
-0, 82800, 152064, 0xc2dbeadc
-0, 86400, 152064, 0x61b2c275
-0, 90000, 152064, 0xbb3697d2
-0, 93600, 152064, 0x44e58e8a
-0, 97200, 152064, 0x21f6464f
-0, 100800, 152064, 0xdb3416f2
-0, 104400, 152064, 0x8201d928
-0, 108000, 152064, 0x4fdfb595
-0, 111600, 152064, 0x28cff0a5
-0, 115200, 152064, 0x5d77cab2
-0, 118800, 152064, 0x2218b509
-0, 122400, 152064, 0xaf40790a
-0, 126000, 152064, 0xaed42b3b
-0, 129600, 152064, 0x866d2462
-0, 133200, 152064, 0x23a7111a
-0, 136800, 152064, 0xceefc9d0
-0, 140400, 152064, 0x88dba819
-0, 144000, 152064, 0x19b350f3
-0, 147600, 152064, 0x85a857e5
-0, 151200, 152064, 0x02ca7c6f
-0, 154800, 152064, 0xe2de12d0
-0, 158400, 152064, 0x84a36173
-0, 162000, 152064, 0xa8d1b139
-0, 165600, 152064, 0x6b72ab43
-0, 169200, 152064, 0x5fba909e
-0, 172800, 152064, 0x43ab27f2
-0, 176400, 152064, 0x414cdd60
-0, 180000, 152064, 0x080fde7b
-0, 183600, 152064, 0xb1b7e4db
-0, 187200, 152064, 0xf17db2da
-0, 190800, 152064, 0x248b88e9
-0, 194400, 152064, 0x6b68301b
-0, 198000, 152064, 0xc581100d
-0, 201600, 152064, 0x8e9cf443
-0, 205200, 152064, 0x3c4ec87a
-0, 208800, 152064, 0x6e417a1f
-0, 212400, 152064, 0x02c7ecc4
-0, 216000, 152064, 0xb7d7f1dc
-0, 219600, 152064, 0xc44cf3fa
-0, 223200, 152064, 0x0f8db331
-0, 226800, 152064, 0x71fe651b
-0, 230400, 152064, 0xdd0b9b70
-0, 234000, 152064, 0x4f6114c3
-0, 237600, 152064, 0x5a64e819
-0, 241200, 152064, 0x20bce1a1
-0, 244800, 152064, 0x6b196d49
-0, 248400, 152064, 0x7c1535a6
-0, 252000, 152064, 0x9b5225a4
-0, 255600, 152064, 0x72c5f185
-0, 259200, 152064, 0x3da4f50d
-0, 262800, 152064, 0xd7f7af48
-0, 266400, 152064, 0x0e1a8f2e
-0, 270000, 152064, 0xb8b036cc
-0, 273600, 152064, 0x003a2b62
-0, 277200, 152064, 0x7777f6bd
-0, 280800, 152064, 0x91003021
-0, 284400, 152064, 0xb2e1af8c
-0, 288000, 152064, 0xae6676bc
-0, 291600, 152064, 0x72f55c98
-0, 295200, 152064, 0x9dfb52bc
-0, 298800, 152064, 0x4b6b0db4
-0, 302400, 152064, 0xba8bab86
-0, 306000, 152064, 0x775a8da0
-0, 309600, 152064, 0x96a35194
-0, 313200, 152064, 0x17732a58
-0, 316800, 152064, 0x45eef560
-0, 320400, 152064, 0x95c79208
+#tb 0: 1/25
+0, 0, 0, 1, 152064, 0xabf9ae05
+0, 1, 1, 1, 152064, 0x20418b16
+0, 2, 2, 1, 152064, 0xe941572f
+0, 3, 3, 1, 152064, 0xcf63e20e
+0, 4, 4, 1, 152064, 0x57dedcde
+0, 5, 5, 1, 152064, 0x4de7bf34
+0, 6, 6, 1, 152064, 0xc8014983
+0, 7, 7, 1, 152064, 0x5ab946fc
+0, 8, 8, 1, 152064, 0x2ca02582
+0, 9, 9, 1, 152064, 0x9c95435d
+0, 10, 10, 1, 152064, 0x8371b963
+0, 11, 11, 1, 152064, 0xa0f1af67
+0, 12, 12, 1, 152064, 0xf1155345
+0, 13, 13, 1, 152064, 0x66a71c79
+0, 14, 14, 1, 152064, 0x509db08a
+0, 15, 15, 1, 152064, 0x3d457728
+0, 16, 16, 1, 152064, 0x66035e2b
+0, 17, 17, 1, 152064, 0xa4113115
+0, 18, 18, 1, 152064, 0x3d35d3c0
+0, 19, 19, 1, 152064, 0x5117d324
+0, 20, 20, 1, 152064, 0x7b0c7660
+0, 21, 21, 1, 152064, 0x0eacf9ba
+0, 22, 22, 1, 152064, 0x358d0486
+0, 23, 23, 1, 152064, 0xc2dbeadc
+0, 24, 24, 1, 152064, 0x61b2c275
+0, 25, 25, 1, 152064, 0xbb3697d2
+0, 26, 26, 1, 152064, 0x44e58e8a
+0, 27, 27, 1, 152064, 0x21f6464f
+0, 28, 28, 1, 152064, 0xdb3416f2
+0, 29, 29, 1, 152064, 0x8201d928
+0, 30, 30, 1, 152064, 0x4fdfb595
+0, 31, 31, 1, 152064, 0x28cff0a5
+0, 32, 32, 1, 152064, 0x5d77cab2
+0, 33, 33, 1, 152064, 0x2218b509
+0, 34, 34, 1, 152064, 0xaf40790a
+0, 35, 35, 1, 152064, 0xaed42b3b
+0, 36, 36, 1, 152064, 0x866d2462
+0, 37, 37, 1, 152064, 0x23a7111a
+0, 38, 38, 1, 152064, 0xceefc9d0
+0, 39, 39, 1, 152064, 0x88dba819
+0, 40, 40, 1, 152064, 0x19b350f3
+0, 41, 41, 1, 152064, 0x85a857e5
+0, 42, 42, 1, 152064, 0x02ca7c6f
+0, 43, 43, 1, 152064, 0xe2de12d0
+0, 44, 44, 1, 152064, 0x84a36173
+0, 45, 45, 1, 152064, 0xa8d1b139
+0, 46, 46, 1, 152064, 0x6b72ab43
+0, 47, 47, 1, 152064, 0x5fba909e
+0, 48, 48, 1, 152064, 0x43ab27f2
+0, 49, 49, 1, 152064, 0x414cdd60
+0, 50, 50, 1, 152064, 0x080fde7b
+0, 51, 51, 1, 152064, 0xb1b7e4db
+0, 52, 52, 1, 152064, 0xf17db2da
+0, 53, 53, 1, 152064, 0x248b88e9
+0, 54, 54, 1, 152064, 0x6b68301b
+0, 55, 55, 1, 152064, 0xc581100d
+0, 56, 56, 1, 152064, 0x8e9cf443
+0, 57, 57, 1, 152064, 0x3c4ec87a
+0, 58, 58, 1, 152064, 0x6e417a1f
+0, 59, 59, 1, 152064, 0x02c7ecc4
+0, 60, 60, 1, 152064, 0xb7d7f1dc
+0, 61, 61, 1, 152064, 0xc44cf3fa
+0, 62, 62, 1, 152064, 0x0f8db331
+0, 63, 63, 1, 152064, 0x71fe651b
+0, 64, 64, 1, 152064, 0xdd0b9b70
+0, 65, 65, 1, 152064, 0x4f6114c3
+0, 66, 66, 1, 152064, 0x5a64e819
+0, 67, 67, 1, 152064, 0x20bce1a1
+0, 68, 68, 1, 152064, 0x6b196d49
+0, 69, 69, 1, 152064, 0x7c1535a6
+0, 70, 70, 1, 152064, 0x9b5225a4
+0, 71, 71, 1, 152064, 0x72c5f185
+0, 72, 72, 1, 152064, 0x3da4f50d
+0, 73, 73, 1, 152064, 0xd7f7af48
+0, 74, 74, 1, 152064, 0x0e1a8f2e
+0, 75, 75, 1, 152064, 0xb8b036cc
+0, 76, 76, 1, 152064, 0x003a2b62
+0, 77, 77, 1, 152064, 0x7777f6bd
+0, 78, 78, 1, 152064, 0x91003021
+0, 79, 79, 1, 152064, 0xb2e1af8c
+0, 80, 80, 1, 152064, 0xae6676bc
+0, 81, 81, 1, 152064, 0x72f55c98
+0, 82, 82, 1, 152064, 0x9dfb52bc
+0, 83, 83, 1, 152064, 0x4b6b0db4
+0, 84, 84, 1, 152064, 0xba8bab86
+0, 85, 85, 1, 152064, 0x775a8da0
+0, 86, 86, 1, 152064, 0x96a35194
+0, 87, 87, 1, 152064, 0x17732a58
+0, 88, 88, 1, 152064, 0x45eef560
+0, 89, 89, 1, 152064, 0x95c79208
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvwp2_toshiba_e b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvwp2_toshiba_e
index 4e904bc..627f4b8 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvwp2_toshiba_e
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvwp2_toshiba_e
@@ -1,90 +1,91 @@
-0, 0, 152064, 0xf503fb79
-0, 3600, 152064, 0xeaa4ba5d
-0, 7200, 152064, 0x50865a33
-0, 10800, 152064, 0x34125f86
-0, 14400, 152064, 0xc5a8bb68
-0, 18000, 152064, 0xe6e9b376
-0, 21600, 152064, 0x4e41d48e
-0, 25200, 152064, 0xea73cc5d
-0, 28800, 152064, 0xc0c60ac0
-0, 32400, 152064, 0xd7110670
-0, 36000, 152064, 0x00465d0d
-0, 39600, 152064, 0xa37a726b
-0, 43200, 152064, 0x5dd13b2a
-0, 46800, 152064, 0x08471f31
-0, 50400, 152064, 0x2bb2b055
-0, 54000, 152064, 0xd06d7f1c
-0, 57600, 152064, 0x91fde84a
-0, 61200, 152064, 0xdbb52d2b
-0, 64800, 152064, 0x505c08b4
-0, 68400, 152064, 0xd8aeef9f
-0, 72000, 152064, 0x4e3f8721
-0, 75600, 152064, 0xce534aee
-0, 79200, 152064, 0x51f80737
-0, 82800, 152064, 0x8fa0e443
-0, 86400, 152064, 0xe8c9db17
-0, 90000, 152064, 0xc84bcee6
-0, 93600, 152064, 0xa7916158
-0, 97200, 152064, 0x16149c36
-0, 100800, 152064, 0xe55213fd
-0, 104400, 152064, 0xa701e59d
-0, 108000, 152064, 0xad65e200
-0, 111600, 152064, 0x4606dc82
-0, 115200, 152064, 0x582f9f64
-0, 118800, 152064, 0xc630662a
-0, 122400, 152064, 0xe54bacf5
-0, 126000, 152064, 0x230e387f
-0, 129600, 152064, 0x1a9c746c
-0, 133200, 152064, 0xfa002d7c
-0, 136800, 152064, 0xe617c4a9
-0, 140400, 152064, 0xd3a4df19
-0, 144000, 152064, 0x25b9ca8c
-0, 147600, 152064, 0x0c505f7c
-0, 151200, 152064, 0x43f84f88
-0, 154800, 152064, 0x859fb3af
-0, 158400, 152064, 0x9680fc13
-0, 162000, 152064, 0x3fe6ecb6
-0, 165600, 152064, 0xf4c05a9c
-0, 169200, 152064, 0x16ba3b13
-0, 172800, 152064, 0x72f33fb9
-0, 176400, 152064, 0x3076e567
-0, 180000, 152064, 0x4e69b604
-0, 183600, 152064, 0x9c37a98b
-0, 187200, 152064, 0x0d5756c7
-0, 190800, 152064, 0xa4a46a81
-0, 194400, 152064, 0xadfc89d7
-0, 198000, 152064, 0x35693493
-0, 201600, 152064, 0xe3baedbf
-0, 205200, 152064, 0x78cfb405
-0, 208800, 152064, 0xd85c7074
-0, 212400, 152064, 0x14ab350e
-0, 216000, 152064, 0xaf55433e
-0, 219600, 152064, 0x75a8e79f
-0, 223200, 152064, 0x2fb599f6
-0, 226800, 152064, 0xbe30bdfe
-0, 230400, 152064, 0x8b07a5ce
-0, 234000, 152064, 0x99b32730
-0, 237600, 152064, 0x9265182d
-0, 241200, 152064, 0x91e789fd
-0, 244800, 152064, 0x1c1e6d16
-0, 248400, 152064, 0xfa06bdaa
-0, 252000, 152064, 0x7177041f
-0, 255600, 152064, 0xd902f99d
-0, 259200, 152064, 0x29bdc134
-0, 262800, 152064, 0xd713ab76
-0, 266400, 152064, 0x60e4788e
-0, 270000, 152064, 0xb18c7789
-0, 273600, 152064, 0x0b7829a5
-0, 277200, 152064, 0xf676d780
-0, 280800, 152064, 0xa88a3a57
-0, 284400, 152064, 0x825cf289
-0, 288000, 152064, 0x78928201
-0, 291600, 152064, 0x013a589c
-0, 295200, 152064, 0x9269fa64
-0, 298800, 152064, 0x6db5f5fa
-0, 302400, 152064, 0x49ad9d6a
-0, 306000, 152064, 0x1b7c290f
-0, 309600, 152064, 0x99716ad1
-0, 313200, 152064, 0x371527c2
-0, 316800, 152064, 0x9f351841
-0, 320400, 152064, 0x884bb432
+#tb 0: 1/25
+0, 0, 0, 1, 152064, 0xf503fb79
+0, 1, 1, 1, 152064, 0xeaa4ba5d
+0, 2, 2, 1, 152064, 0x50865a33
+0, 3, 3, 1, 152064, 0x34125f86
+0, 4, 4, 1, 152064, 0xc5a8bb68
+0, 5, 5, 1, 152064, 0xe6e9b376
+0, 6, 6, 1, 152064, 0x4e41d48e
+0, 7, 7, 1, 152064, 0xea73cc5d
+0, 8, 8, 1, 152064, 0xc0c60ac0
+0, 9, 9, 1, 152064, 0xd7110670
+0, 10, 10, 1, 152064, 0x00465d0d
+0, 11, 11, 1, 152064, 0xa37a726b
+0, 12, 12, 1, 152064, 0x5dd13b2a
+0, 13, 13, 1, 152064, 0x08471f31
+0, 14, 14, 1, 152064, 0x2bb2b055
+0, 15, 15, 1, 152064, 0xd06d7f1c
+0, 16, 16, 1, 152064, 0x91fde84a
+0, 17, 17, 1, 152064, 0xdbb52d2b
+0, 18, 18, 1, 152064, 0x505c08b4
+0, 19, 19, 1, 152064, 0xd8aeef9f
+0, 20, 20, 1, 152064, 0x4e3f8721
+0, 21, 21, 1, 152064, 0xce534aee
+0, 22, 22, 1, 152064, 0x51f80737
+0, 23, 23, 1, 152064, 0x8fa0e443
+0, 24, 24, 1, 152064, 0xe8c9db17
+0, 25, 25, 1, 152064, 0xc84bcee6
+0, 26, 26, 1, 152064, 0xa7916158
+0, 27, 27, 1, 152064, 0x16149c36
+0, 28, 28, 1, 152064, 0xe55213fd
+0, 29, 29, 1, 152064, 0xa701e59d
+0, 30, 30, 1, 152064, 0xad65e200
+0, 31, 31, 1, 152064, 0x4606dc82
+0, 32, 32, 1, 152064, 0x582f9f64
+0, 33, 33, 1, 152064, 0xc630662a
+0, 34, 34, 1, 152064, 0xe54bacf5
+0, 35, 35, 1, 152064, 0x230e387f
+0, 36, 36, 1, 152064, 0x1a9c746c
+0, 37, 37, 1, 152064, 0xfa002d7c
+0, 38, 38, 1, 152064, 0xe617c4a9
+0, 39, 39, 1, 152064, 0xd3a4df19
+0, 40, 40, 1, 152064, 0x25b9ca8c
+0, 41, 41, 1, 152064, 0x0c505f7c
+0, 42, 42, 1, 152064, 0x43f84f88
+0, 43, 43, 1, 152064, 0x859fb3af
+0, 44, 44, 1, 152064, 0x9680fc13
+0, 45, 45, 1, 152064, 0x3fe6ecb6
+0, 46, 46, 1, 152064, 0xf4c05a9c
+0, 47, 47, 1, 152064, 0x16ba3b13
+0, 48, 48, 1, 152064, 0x72f33fb9
+0, 49, 49, 1, 152064, 0x3076e567
+0, 50, 50, 1, 152064, 0x4e69b604
+0, 51, 51, 1, 152064, 0x9c37a98b
+0, 52, 52, 1, 152064, 0x0d5756c7
+0, 53, 53, 1, 152064, 0xa4a46a81
+0, 54, 54, 1, 152064, 0xadfc89d7
+0, 55, 55, 1, 152064, 0x35693493
+0, 56, 56, 1, 152064, 0xe3baedbf
+0, 57, 57, 1, 152064, 0x78cfb405
+0, 58, 58, 1, 152064, 0xd85c7074
+0, 59, 59, 1, 152064, 0x14ab350e
+0, 60, 60, 1, 152064, 0xaf55433e
+0, 61, 61, 1, 152064, 0x75a8e79f
+0, 62, 62, 1, 152064, 0x2fb599f6
+0, 63, 63, 1, 152064, 0xbe30bdfe
+0, 64, 64, 1, 152064, 0x8b07a5ce
+0, 65, 65, 1, 152064, 0x99b32730
+0, 66, 66, 1, 152064, 0x9265182d
+0, 67, 67, 1, 152064, 0x91e789fd
+0, 68, 68, 1, 152064, 0x1c1e6d16
+0, 69, 69, 1, 152064, 0xfa06bdaa
+0, 70, 70, 1, 152064, 0x7177041f
+0, 71, 71, 1, 152064, 0xd902f99d
+0, 72, 72, 1, 152064, 0x29bdc134
+0, 73, 73, 1, 152064, 0xd713ab76
+0, 74, 74, 1, 152064, 0x60e4788e
+0, 75, 75, 1, 152064, 0xb18c7789
+0, 76, 76, 1, 152064, 0x0b7829a5
+0, 77, 77, 1, 152064, 0xf676d780
+0, 78, 78, 1, 152064, 0xa88a3a57
+0, 79, 79, 1, 152064, 0x825cf289
+0, 80, 80, 1, 152064, 0x78928201
+0, 81, 81, 1, 152064, 0x013a589c
+0, 82, 82, 1, 152064, 0x9269fa64
+0, 83, 83, 1, 152064, 0x6db5f5fa
+0, 84, 84, 1, 152064, 0x49ad9d6a
+0, 85, 85, 1, 152064, 0x1b7c290f
+0, 86, 86, 1, 152064, 0x99716ad1
+0, 87, 87, 1, 152064, 0x371527c2
+0, 88, 88, 1, 152064, 0x9f351841
+0, 89, 89, 1, 152064, 0x884bb432
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvwp3_toshiba_e b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvwp3_toshiba_e
index e78f209..ca3b7b8 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvwp3_toshiba_e
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvwp3_toshiba_e
@@ -1,90 +1,91 @@
-0, 0, 152064, 0x3b3ffd31
-0, 3600, 152064, 0x14e0b899
-0, 7200, 152064, 0x50865a33
-0, 10800, 152064, 0x12e749e5
-0, 14400, 152064, 0xe5921130
-0, 18000, 152064, 0x2ca3b10d
-0, 21600, 152064, 0xa9a39f04
-0, 25200, 152064, 0x2c78761a
-0, 28800, 152064, 0x70890ad7
-0, 32400, 152064, 0x4fc30132
-0, 36000, 152064, 0x10e4d2c9
-0, 39600, 152064, 0xa3326b50
-0, 43200, 152064, 0x8e054bf1
-0, 46800, 152064, 0x5bd91687
-0, 50400, 152064, 0x70bab119
-0, 54000, 152064, 0x9a1ab472
-0, 57600, 152064, 0x490776a0
-0, 61200, 152064, 0xdbb52d2b
-0, 64800, 152064, 0x142714b9
-0, 68400, 152064, 0xa051ee6f
-0, 72000, 152064, 0xafa97fdf
-0, 75600, 152064, 0x1ae67347
-0, 79200, 152064, 0xc4f42ed6
-0, 82800, 152064, 0x4445dc60
-0, 86400, 152064, 0xaef4d04b
-0, 90000, 152064, 0x6a51be82
-0, 93600, 152064, 0x48356190
-0, 97200, 152064, 0xc09b5f5d
-0, 100800, 152064, 0x933d3379
-0, 104400, 152064, 0xfb57e471
-0, 108000, 152064, 0xb5b2f45c
-0, 111600, 152064, 0xce36e45e
-0, 115200, 152064, 0x582f9f64
-0, 118800, 152064, 0x2f45b1fd
-0, 122400, 152064, 0x90708fa0
-0, 126000, 152064, 0xee483b8f
-0, 129600, 152064, 0xd2163e6c
-0, 133200, 152064, 0x39492dfe
-0, 136800, 152064, 0xf89cc57f
-0, 140400, 152064, 0xbfc3c411
-0, 144000, 152064, 0x919eb007
-0, 147600, 152064, 0x2c526309
-0, 151200, 152064, 0x39f067a2
-0, 154800, 152064, 0xb7653abb
-0, 158400, 152064, 0xe26a035c
-0, 162000, 152064, 0xcef1eb3b
-0, 165600, 152064, 0xb8b3c55f
-0, 169200, 152064, 0x16ba3b13
-0, 172800, 152064, 0x153a3117
-0, 176400, 152064, 0x90a21859
-0, 180000, 152064, 0x9231b756
-0, 183600, 152064, 0x65fcbcb9
-0, 187200, 152064, 0x447eaf44
-0, 190800, 152064, 0xa26b6a8e
-0, 194400, 152064, 0x100464f8
-0, 198000, 152064, 0x479648ec
-0, 201600, 152064, 0x6742f51f
-0, 205200, 152064, 0x14e9d906
-0, 208800, 152064, 0xa058ab87
-0, 212400, 152064, 0x8d093874
-0, 216000, 152064, 0xef7f2965
-0, 219600, 152064, 0x200d02bd
-0, 223200, 152064, 0x2fb599f6
-0, 226800, 152064, 0xf65fb6e4
-0, 230400, 152064, 0x489a9152
-0, 234000, 152064, 0xbe8a2fc2
-0, 237600, 152064, 0xea04097e
-0, 241200, 152064, 0xaf0cd627
-0, 244800, 152064, 0xc0a26b27
-0, 248400, 152064, 0x985f67e7
-0, 252000, 152064, 0x7d1b4c4c
-0, 255600, 152064, 0x9908f838
-0, 259200, 152064, 0xb8fef131
-0, 262800, 152064, 0xb1feaf6c
-0, 266400, 152064, 0x37b16bda
-0, 270000, 152064, 0x242471aa
-0, 273600, 152064, 0xf18c3839
-0, 277200, 152064, 0xf676d780
-0, 280800, 152064, 0x17bd0f76
-0, 284400, 152064, 0x3703e7a6
-0, 288000, 152064, 0x69ba8a8a
-0, 291600, 152064, 0x205281b3
-0, 295200, 152064, 0x54bf51e1
-0, 298800, 152064, 0xf6daf8ed
-0, 302400, 152064, 0x8728e805
-0, 306000, 152064, 0xe98cd2b0
-0, 309600, 152064, 0x7ef76e26
-0, 313200, 152064, 0x0fbf5230
-0, 316800, 152064, 0x9e4d104b
-0, 320400, 152064, 0xd562b815
+#tb 0: 1/25
+0, 0, 0, 1, 152064, 0x3b3ffd31
+0, 1, 1, 1, 152064, 0x14e0b899
+0, 2, 2, 1, 152064, 0x50865a33
+0, 3, 3, 1, 152064, 0x12e749e5
+0, 4, 4, 1, 152064, 0xe5921130
+0, 5, 5, 1, 152064, 0x2ca3b10d
+0, 6, 6, 1, 152064, 0xa9a39f04
+0, 7, 7, 1, 152064, 0x2c78761a
+0, 8, 8, 1, 152064, 0x70890ad7
+0, 9, 9, 1, 152064, 0x4fc30132
+0, 10, 10, 1, 152064, 0x10e4d2c9
+0, 11, 11, 1, 152064, 0xa3326b50
+0, 12, 12, 1, 152064, 0x8e054bf1
+0, 13, 13, 1, 152064, 0x5bd91687
+0, 14, 14, 1, 152064, 0x70bab119
+0, 15, 15, 1, 152064, 0x9a1ab472
+0, 16, 16, 1, 152064, 0x490776a0
+0, 17, 17, 1, 152064, 0xdbb52d2b
+0, 18, 18, 1, 152064, 0x142714b9
+0, 19, 19, 1, 152064, 0xa051ee6f
+0, 20, 20, 1, 152064, 0xafa97fdf
+0, 21, 21, 1, 152064, 0x1ae67347
+0, 22, 22, 1, 152064, 0xc4f42ed6
+0, 23, 23, 1, 152064, 0x4445dc60
+0, 24, 24, 1, 152064, 0xaef4d04b
+0, 25, 25, 1, 152064, 0x6a51be82
+0, 26, 26, 1, 152064, 0x48356190
+0, 27, 27, 1, 152064, 0xc09b5f5d
+0, 28, 28, 1, 152064, 0x933d3379
+0, 29, 29, 1, 152064, 0xfb57e471
+0, 30, 30, 1, 152064, 0xb5b2f45c
+0, 31, 31, 1, 152064, 0xce36e45e
+0, 32, 32, 1, 152064, 0x582f9f64
+0, 33, 33, 1, 152064, 0x2f45b1fd
+0, 34, 34, 1, 152064, 0x90708fa0
+0, 35, 35, 1, 152064, 0xee483b8f
+0, 36, 36, 1, 152064, 0xd2163e6c
+0, 37, 37, 1, 152064, 0x39492dfe
+0, 38, 38, 1, 152064, 0xf89cc57f
+0, 39, 39, 1, 152064, 0xbfc3c411
+0, 40, 40, 1, 152064, 0x919eb007
+0, 41, 41, 1, 152064, 0x2c526309
+0, 42, 42, 1, 152064, 0x39f067a2
+0, 43, 43, 1, 152064, 0xb7653abb
+0, 44, 44, 1, 152064, 0xe26a035c
+0, 45, 45, 1, 152064, 0xcef1eb3b
+0, 46, 46, 1, 152064, 0xb8b3c55f
+0, 47, 47, 1, 152064, 0x16ba3b13
+0, 48, 48, 1, 152064, 0x153a3117
+0, 49, 49, 1, 152064, 0x90a21859
+0, 50, 50, 1, 152064, 0x9231b756
+0, 51, 51, 1, 152064, 0x65fcbcb9
+0, 52, 52, 1, 152064, 0x447eaf44
+0, 53, 53, 1, 152064, 0xa26b6a8e
+0, 54, 54, 1, 152064, 0x100464f8
+0, 55, 55, 1, 152064, 0x479648ec
+0, 56, 56, 1, 152064, 0x6742f51f
+0, 57, 57, 1, 152064, 0x14e9d906
+0, 58, 58, 1, 152064, 0xa058ab87
+0, 59, 59, 1, 152064, 0x8d093874
+0, 60, 60, 1, 152064, 0xef7f2965
+0, 61, 61, 1, 152064, 0x200d02bd
+0, 62, 62, 1, 152064, 0x2fb599f6
+0, 63, 63, 1, 152064, 0xf65fb6e4
+0, 64, 64, 1, 152064, 0x489a9152
+0, 65, 65, 1, 152064, 0xbe8a2fc2
+0, 66, 66, 1, 152064, 0xea04097e
+0, 67, 67, 1, 152064, 0xaf0cd627
+0, 68, 68, 1, 152064, 0xc0a26b27
+0, 69, 69, 1, 152064, 0x985f67e7
+0, 70, 70, 1, 152064, 0x7d1b4c4c
+0, 71, 71, 1, 152064, 0x9908f838
+0, 72, 72, 1, 152064, 0xb8fef131
+0, 73, 73, 1, 152064, 0xb1feaf6c
+0, 74, 74, 1, 152064, 0x37b16bda
+0, 75, 75, 1, 152064, 0x242471aa
+0, 76, 76, 1, 152064, 0xf18c3839
+0, 77, 77, 1, 152064, 0xf676d780
+0, 78, 78, 1, 152064, 0x17bd0f76
+0, 79, 79, 1, 152064, 0x3703e7a6
+0, 80, 80, 1, 152064, 0x69ba8a8a
+0, 81, 81, 1, 152064, 0x205281b3
+0, 82, 82, 1, 152064, 0x54bf51e1
+0, 83, 83, 1, 152064, 0xf6daf8ed
+0, 84, 84, 1, 152064, 0x8728e805
+0, 85, 85, 1, 152064, 0xe98cd2b0
+0, 86, 86, 1, 152064, 0x7ef76e26
+0, 87, 87, 1, 152064, 0x0fbf5230
+0, 88, 88, 1, 152064, 0x9e4d104b
+0, 89, 89, 1, 152064, 0xd562b815
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvwp5_toshiba_e b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvwp5_toshiba_e
index 30f6912..5b48f8f 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvwp5_toshiba_e
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-cvwp5_toshiba_e
@@ -1,90 +1,91 @@
-0, 0, 152064, 0xabf9ae05
-0, 3600, 152064, 0x20418b16
-0, 7200, 152064, 0x20f72775
-0, 10800, 152064, 0x57c07111
-0, 14400, 152064, 0x1b49267f
-0, 18000, 152064, 0x024cd238
-0, 21600, 152064, 0x044d1ae0
-0, 25200, 152064, 0xbfec1b59
-0, 28800, 152064, 0x1a91f935
-0, 32400, 152064, 0x9ee184dc
-0, 36000, 152064, 0x65047dbe
-0, 39600, 152064, 0xd1632fb5
-0, 43200, 152064, 0x56f64c3e
-0, 46800, 152064, 0xe6122f37
-0, 50400, 152064, 0x0575e670
-0, 54000, 152064, 0x3d457728
-0, 57600, 152064, 0x6b508105
-0, 61200, 152064, 0xcaaf5ea7
-0, 64800, 152064, 0x9f4e4501
-0, 68400, 152064, 0x1c661a73
-0, 72000, 152064, 0x2fd9d1c8
-0, 75600, 152064, 0x4ac99ab1
-0, 79200, 152064, 0xf2d36809
-0, 82800, 152064, 0xa8e32ffb
-0, 86400, 152064, 0xd4da2fd2
-0, 90000, 152064, 0xac3adde0
-0, 93600, 152064, 0xf014ed0f
-0, 97200, 152064, 0xca2e7d28
-0, 100800, 152064, 0x3a875e51
-0, 104400, 152064, 0xc03e4bda
-0, 108000, 152064, 0x4fdfb595
-0, 111600, 152064, 0x9243f098
-0, 115200, 152064, 0x9361bae6
-0, 118800, 152064, 0x7a1dadee
-0, 122400, 152064, 0x72a59e15
-0, 126000, 152064, 0xb5b47170
-0, 129600, 152064, 0x5eb16651
-0, 133200, 152064, 0xe7894af7
-0, 136800, 152064, 0x2683bb0b
-0, 140400, 152064, 0x90b4c8c5
-0, 144000, 152064, 0xf800c5b5
-0, 147600, 152064, 0xc2f5a895
-0, 151200, 152064, 0x213c65d4
-0, 154800, 152064, 0x01c65a19
-0, 158400, 152064, 0xd9f1b04b
-0, 162000, 152064, 0xa8d1b139
-0, 165600, 152064, 0x2d0cb0cd
-0, 169200, 152064, 0x5b0783fe
-0, 172800, 152064, 0x29e628ec
-0, 176400, 152064, 0x1b8527e5
-0, 180000, 152064, 0x4b46d179
-0, 183600, 152064, 0x6184c708
-0, 187200, 152064, 0x697bb8e2
-0, 190800, 152064, 0x5fd3a772
-0, 194400, 152064, 0x91456c86
-0, 198000, 152064, 0x376c4dae
-0, 201600, 152064, 0x00ba2b3f
-0, 205200, 152064, 0xf6f0f553
-0, 208800, 152064, 0xc0020855
-0, 212400, 152064, 0xec3d13d2
-0, 216000, 152064, 0xb7d7f1dc
-0, 219600, 152064, 0xf9dae37b
-0, 223200, 152064, 0x50d9cc93
-0, 226800, 152064, 0xba1eb592
-0, 230400, 152064, 0x67616557
-0, 234000, 152064, 0x09804760
-0, 237600, 152064, 0xc2ffba00
-0, 241200, 152064, 0xb71fcf46
-0, 244800, 152064, 0x6cd975af
-0, 248400, 152064, 0x19189167
-0, 252000, 152064, 0xbca8fe71
-0, 255600, 152064, 0xb0b3f607
-0, 259200, 152064, 0x7614d73a
-0, 262800, 152064, 0x7de9d87d
-0, 266400, 152064, 0x81f58cf2
-0, 270000, 152064, 0xb8b036cc
-0, 273600, 152064, 0x26d1e2e4
-0, 277200, 152064, 0xb41a1e6c
-0, 280800, 152064, 0x4f9be4a9
-0, 284400, 152064, 0xe95ad5d3
-0, 288000, 152064, 0xdffc9335
-0, 291600, 152064, 0x01d658c0
-0, 295200, 152064, 0x631b4b75
-0, 298800, 152064, 0x80ae282f
-0, 302400, 152064, 0xb34bf688
-0, 306000, 152064, 0xd0cc7d65
-0, 309600, 152064, 0x86aa4590
-0, 313200, 152064, 0xcb515a57
-0, 316800, 152064, 0x68650834
-0, 320400, 152064, 0x444ee2a4
+#tb 0: 1/25
+0, 0, 0, 1, 152064, 0xabf9ae05
+0, 1, 1, 1, 152064, 0x20418b16
+0, 2, 2, 1, 152064, 0x20f72775
+0, 3, 3, 1, 152064, 0x57c07111
+0, 4, 4, 1, 152064, 0x1b49267f
+0, 5, 5, 1, 152064, 0x024cd238
+0, 6, 6, 1, 152064, 0x044d1ae0
+0, 7, 7, 1, 152064, 0xbfec1b59
+0, 8, 8, 1, 152064, 0x1a91f935
+0, 9, 9, 1, 152064, 0x9ee184dc
+0, 10, 10, 1, 152064, 0x65047dbe
+0, 11, 11, 1, 152064, 0xd1632fb5
+0, 12, 12, 1, 152064, 0x56f64c3e
+0, 13, 13, 1, 152064, 0xe6122f37
+0, 14, 14, 1, 152064, 0x0575e670
+0, 15, 15, 1, 152064, 0x3d457728
+0, 16, 16, 1, 152064, 0x6b508105
+0, 17, 17, 1, 152064, 0xcaaf5ea7
+0, 18, 18, 1, 152064, 0x9f4e4501
+0, 19, 19, 1, 152064, 0x1c661a73
+0, 20, 20, 1, 152064, 0x2fd9d1c8
+0, 21, 21, 1, 152064, 0x4ac99ab1
+0, 22, 22, 1, 152064, 0xf2d36809
+0, 23, 23, 1, 152064, 0xa8e32ffb
+0, 24, 24, 1, 152064, 0xd4da2fd2
+0, 25, 25, 1, 152064, 0xac3adde0
+0, 26, 26, 1, 152064, 0xf014ed0f
+0, 27, 27, 1, 152064, 0xca2e7d28
+0, 28, 28, 1, 152064, 0x3a875e51
+0, 29, 29, 1, 152064, 0xc03e4bda
+0, 30, 30, 1, 152064, 0x4fdfb595
+0, 31, 31, 1, 152064, 0x9243f098
+0, 32, 32, 1, 152064, 0x9361bae6
+0, 33, 33, 1, 152064, 0x7a1dadee
+0, 34, 34, 1, 152064, 0x72a59e15
+0, 35, 35, 1, 152064, 0xb5b47170
+0, 36, 36, 1, 152064, 0x5eb16651
+0, 37, 37, 1, 152064, 0xe7894af7
+0, 38, 38, 1, 152064, 0x2683bb0b
+0, 39, 39, 1, 152064, 0x90b4c8c5
+0, 40, 40, 1, 152064, 0xf800c5b5
+0, 41, 41, 1, 152064, 0xc2f5a895
+0, 42, 42, 1, 152064, 0x213c65d4
+0, 43, 43, 1, 152064, 0x01c65a19
+0, 44, 44, 1, 152064, 0xd9f1b04b
+0, 45, 45, 1, 152064, 0xa8d1b139
+0, 46, 46, 1, 152064, 0x2d0cb0cd
+0, 47, 47, 1, 152064, 0x5b0783fe
+0, 48, 48, 1, 152064, 0x29e628ec
+0, 49, 49, 1, 152064, 0x1b8527e5
+0, 50, 50, 1, 152064, 0x4b46d179
+0, 51, 51, 1, 152064, 0x6184c708
+0, 52, 52, 1, 152064, 0x697bb8e2
+0, 53, 53, 1, 152064, 0x5fd3a772
+0, 54, 54, 1, 152064, 0x91456c86
+0, 55, 55, 1, 152064, 0x376c4dae
+0, 56, 56, 1, 152064, 0x00ba2b3f
+0, 57, 57, 1, 152064, 0xf6f0f553
+0, 58, 58, 1, 152064, 0xc0020855
+0, 59, 59, 1, 152064, 0xec3d13d2
+0, 60, 60, 1, 152064, 0xb7d7f1dc
+0, 61, 61, 1, 152064, 0xf9dae37b
+0, 62, 62, 1, 152064, 0x50d9cc93
+0, 63, 63, 1, 152064, 0xba1eb592
+0, 64, 64, 1, 152064, 0x67616557
+0, 65, 65, 1, 152064, 0x09804760
+0, 66, 66, 1, 152064, 0xc2ffba00
+0, 67, 67, 1, 152064, 0xb71fcf46
+0, 68, 68, 1, 152064, 0x6cd975af
+0, 69, 69, 1, 152064, 0x19189167
+0, 70, 70, 1, 152064, 0xbca8fe71
+0, 71, 71, 1, 152064, 0xb0b3f607
+0, 72, 72, 1, 152064, 0x7614d73a
+0, 73, 73, 1, 152064, 0x7de9d87d
+0, 74, 74, 1, 152064, 0x81f58cf2
+0, 75, 75, 1, 152064, 0xb8b036cc
+0, 76, 76, 1, 152064, 0x26d1e2e4
+0, 77, 77, 1, 152064, 0xb41a1e6c
+0, 78, 78, 1, 152064, 0x4f9be4a9
+0, 79, 79, 1, 152064, 0xe95ad5d3
+0, 80, 80, 1, 152064, 0xdffc9335
+0, 81, 81, 1, 152064, 0x01d658c0
+0, 82, 82, 1, 152064, 0x631b4b75
+0, 83, 83, 1, 152064, 0x80ae282f
+0, 84, 84, 1, 152064, 0xb34bf688
+0, 85, 85, 1, 152064, 0xd0cc7d65
+0, 86, 86, 1, 152064, 0x86aa4590
+0, 87, 87, 1, 152064, 0xcb515a57
+0, 88, 88, 1, 152064, 0x68650834
+0, 89, 89, 1, 152064, 0x444ee2a4
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-fi1_sony_e b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-fi1_sony_e
index 5b7f4c8..6b5e0db 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-fi1_sony_e
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-fi1_sony_e
@@ -1,17 +1,18 @@
-0, 0, 36864, 0x3d54d3e3
-0, 3600, 36864, 0xa9573ef0
-0, 7200, 36864, 0x0ea5f263
-0, 10800, 36864, 0x5a849fb9
-0, 14400, 36864, 0x7ddb1eff
-0, 18000, 36864, 0x5e73e3b7
-0, 21600, 36864, 0x7d50d329
-0, 25200, 36864, 0xf2c2cd27
-0, 28800, 36864, 0xdf4f4628
-0, 32400, 36864, 0xddd6d5be
-0, 36000, 36864, 0xb530e1aa
-0, 39600, 36864, 0xeca42470
-0, 43200, 36864, 0xa5701caf
-0, 46800, 36864, 0x6f5d28fc
-0, 50400, 36864, 0xd4ab4ab2
-0, 54000, 36864, 0xf2dfcc22
-0, 57600, 36864, 0xcaa87e79
+#tb 0: 1/25
+0, 0, 0, 1, 36864, 0x3d54d3e3
+0, 1, 1, 1, 36864, 0xa9573ef0
+0, 2, 2, 1, 36864, 0x0ea5f263
+0, 3, 3, 1, 36864, 0x5a849fb9
+0, 4, 4, 1, 36864, 0x7ddb1eff
+0, 5, 5, 1, 36864, 0x5e73e3b7
+0, 6, 6, 1, 36864, 0x7d50d329
+0, 7, 7, 1, 36864, 0xf2c2cd27
+0, 8, 8, 1, 36864, 0xdf4f4628
+0, 9, 9, 1, 36864, 0xddd6d5be
+0, 10, 10, 1, 36864, 0xb530e1aa
+0, 11, 11, 1, 36864, 0xeca42470
+0, 12, 12, 1, 36864, 0xa5701caf
+0, 13, 13, 1, 36864, 0x6f5d28fc
+0, 14, 14, 1, 36864, 0xd4ab4ab2
+0, 15, 15, 1, 36864, 0xf2dfcc22
+0, 16, 16, 1, 36864, 0xcaa87e79
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-alphaconformanceg b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-alphaconformanceg
index 02a7274..dee1c42 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-alphaconformanceg
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-alphaconformanceg
@@ -1,43 +1,44 @@
-0, 0, 783360, 0xbc458a9a
-0, 3600, 783360, 0xc2b4a765
-0, 7200, 783360, 0x40a8ca87
-0, 10800, 783360, 0xdd0cbc2c
-0, 14400, 783360, 0xecf8e434
-0, 18000, 783360, 0xcc87e3d4
-0, 21600, 783360, 0x386e1a34
-0, 25200, 783360, 0x6ac4a62e
-0, 28800, 783360, 0xf23d89bb
-0, 32400, 783360, 0x52f7b94c
-0, 36000, 783360, 0x2b4ea2c2
-0, 39600, 783360, 0x0a43839c
-0, 43200, 783360, 0xad4b81ea
-0, 46800, 783360, 0xcb4fe0d4
-0, 50400, 783360, 0x6c3ca755
-0, 54000, 783360, 0x17d37f49
-0, 57600, 783360, 0x8fdfebec
-0, 61200, 783360, 0x1a177b49
-0, 64800, 783360, 0x72d230ad
-0, 68400, 783360, 0x62147d69
-0, 72000, 783360, 0xeed9b62c
-0, 75600, 783360, 0x7fc45b23
-0, 79200, 783360, 0x5dc60681
-0, 82800, 783360, 0x2d91c001
-0, 86400, 783360, 0x259ab608
-0, 90000, 783360, 0x29112b29
-0, 93600, 783360, 0x7e4d497e
-0, 97200, 783360, 0x616e5507
-0, 100800, 783360, 0x299473c9
-0, 104400, 783360, 0x4d63d722
-0, 108000, 783360, 0xa89e4bc6
-0, 111600, 783360, 0xbdef585a
-0, 115200, 783360, 0x5b12c72c
-0, 118800, 783360, 0x5a884bd8
-0, 122400, 783360, 0x97728ade
-0, 126000, 783360, 0x27dd8999
-0, 129600, 783360, 0x94104d66
-0, 133200, 783360, 0xf30244f1
-0, 136800, 783360, 0xfc98c63e
-0, 140400, 783360, 0x8b27de2e
-0, 144000, 783360, 0xfc6bbbf2
-0, 147600, 783360, 0x4527b6a3
-0, 151200, 783360, 0x4070daf0
+#tb 0: 1/25
+0, 0, 0, 1, 783360, 0xbc458a9a
+0, 1, 1, 1, 783360, 0xc2b4a765
+0, 2, 2, 1, 783360, 0x40a8ca87
+0, 3, 3, 1, 783360, 0xdd0cbc2c
+0, 4, 4, 1, 783360, 0xecf8e434
+0, 5, 5, 1, 783360, 0xcc87e3d4
+0, 6, 6, 1, 783360, 0x386e1a34
+0, 7, 7, 1, 783360, 0x6ac4a62e
+0, 8, 8, 1, 783360, 0xf23d89bb
+0, 9, 9, 1, 783360, 0x52f7b94c
+0, 10, 10, 1, 783360, 0x2b4ea2c2
+0, 11, 11, 1, 783360, 0x0a43839c
+0, 12, 12, 1, 783360, 0xad4b81ea
+0, 13, 13, 1, 783360, 0xcb4fe0d4
+0, 14, 14, 1, 783360, 0x6c3ca755
+0, 15, 15, 1, 783360, 0x17d37f49
+0, 16, 16, 1, 783360, 0x8fdfebec
+0, 17, 17, 1, 783360, 0x1a177b49
+0, 18, 18, 1, 783360, 0x72d230ad
+0, 19, 19, 1, 783360, 0x62147d69
+0, 20, 20, 1, 783360, 0xeed9b62c
+0, 21, 21, 1, 783360, 0x7fc45b23
+0, 22, 22, 1, 783360, 0x5dc60681
+0, 23, 23, 1, 783360, 0x2d91c001
+0, 24, 24, 1, 783360, 0x259ab608
+0, 25, 25, 1, 783360, 0x29112b29
+0, 26, 26, 1, 783360, 0x7e4d497e
+0, 27, 27, 1, 783360, 0x616e5507
+0, 28, 28, 1, 783360, 0x299473c9
+0, 29, 29, 1, 783360, 0x4d63d722
+0, 30, 30, 1, 783360, 0xa89e4bc6
+0, 31, 31, 1, 783360, 0xbdef585a
+0, 32, 32, 1, 783360, 0x5b12c72c
+0, 33, 33, 1, 783360, 0x5a884bd8
+0, 34, 34, 1, 783360, 0x97728ade
+0, 35, 35, 1, 783360, 0x27dd8999
+0, 36, 36, 1, 783360, 0x94104d66
+0, 37, 37, 1, 783360, 0xf30244f1
+0, 38, 38, 1, 783360, 0xfc98c63e
+0, 39, 39, 1, 783360, 0x8b27de2e
+0, 40, 40, 1, 783360, 0xfc6bbbf2
+0, 41, 41, 1, 783360, 0x4527b6a3
+0, 42, 42, 1, 783360, 0x4070daf0
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-bcrm_freh10 b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-bcrm_freh10
index 252214e..272a4aa 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-bcrm_freh10
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-bcrm_freh10
@@ -1,100 +1,101 @@
-0, 0, 152064, 0xbdc2b880
-0, 3600, 152064, 0x4ebf93fe
-0, 7200, 152064, 0xe30d6871
-0, 10800, 152064, 0x04f46b9b
-0, 14400, 152064, 0xd7dd219a
-0, 18000, 152064, 0x02fc6511
-0, 21600, 152064, 0x98868faa
-0, 25200, 152064, 0x54b94f92
-0, 28800, 152064, 0xe3b6be4b
-0, 32400, 152064, 0xf148cf10
-0, 36000, 152064, 0xda3239b8
-0, 39600, 152064, 0x6c5d7331
-0, 43200, 152064, 0x825f1fea
-0, 46800, 152064, 0x47791056
-0, 50400, 152064, 0xc08e8a58
-0, 54000, 152064, 0x020299f3
-0, 57600, 152064, 0x0dfd4457
-0, 61200, 152064, 0xcf005e68
-0, 64800, 152064, 0x1f9e2c32
-0, 68400, 152064, 0xa8359324
-0, 72000, 152064, 0x4b03752d
-0, 75600, 152064, 0xd6281621
-0, 79200, 152064, 0xc97ac928
-0, 82800, 152064, 0xded90dcd
-0, 86400, 152064, 0xd6883255
-0, 90000, 152064, 0x6edb4d4f
-0, 93600, 152064, 0xd6f93a80
-0, 97200, 152064, 0x163d6153
-0, 100800, 152064, 0x04b90c06
-0, 104400, 152064, 0xee8730c1
-0, 108000, 152064, 0xd5f5c669
-0, 111600, 152064, 0xcc600b1f
-0, 115200, 152064, 0x15ddde03
-0, 118800, 152064, 0xd0388dd0
-0, 122400, 152064, 0xa292ab7d
-0, 126000, 152064, 0xacf584e9
-0, 129600, 152064, 0xcef42714
-0, 133200, 152064, 0xeb162f35
-0, 136800, 152064, 0x0a07de7b
-0, 140400, 152064, 0x7ae76c81
-0, 144000, 152064, 0x139c8fda
-0, 147600, 152064, 0x43724411
-0, 151200, 152064, 0x07b2ddea
-0, 154800, 152064, 0x831a1cc7
-0, 158400, 152064, 0x092f5073
-0, 162000, 152064, 0xe5b6d380
-0, 165600, 152064, 0xdd30d69e
-0, 169200, 152064, 0x887020b2
-0, 172800, 152064, 0x84436510
-0, 176400, 152064, 0x49f63606
-0, 180000, 152064, 0x6b96e959
-0, 183600, 152064, 0xc6247cc7
-0, 187200, 152064, 0x7a67c532
-0, 190800, 152064, 0x93f4c476
-0, 194400, 152064, 0x3c119654
-0, 198000, 152064, 0xa45f7c72
-0, 201600, 152064, 0x2ac50cb0
-0, 205200, 152064, 0x9bf16d06
-0, 208800, 152064, 0xfa0750d9
-0, 212400, 152064, 0x02197630
-0, 216000, 152064, 0x6d44f9b5
-0, 219600, 152064, 0x86b211f5
-0, 223200, 152064, 0xf4fda5d0
-0, 226800, 152064, 0x36f840a7
-0, 230400, 152064, 0x42412992
-0, 234000, 152064, 0xd0c9ba37
-0, 237600, 152064, 0xc40eba62
-0, 241200, 152064, 0x2d093b53
-0, 244800, 152064, 0xee39c69c
-0, 248400, 152064, 0xcbbf8968
-0, 252000, 152064, 0xfddc1704
-0, 255600, 152064, 0x8dc47c61
-0, 259200, 152064, 0xf15580bf
-0, 262800, 152064, 0x9c71a8b0
-0, 266400, 152064, 0x19b90b9f
-0, 270000, 152064, 0xb65ae287
-0, 273600, 152064, 0xf265693d
-0, 277200, 152064, 0x721714a1
-0, 280800, 152064, 0x383e8ac5
-0, 284400, 152064, 0x02558677
-0, 288000, 152064, 0xdaab3cdf
-0, 291600, 152064, 0xc939a2f6
-0, 295200, 152064, 0x977afa7f
-0, 298800, 152064, 0xe5e65f35
-0, 302400, 152064, 0x247546fa
-0, 306000, 152064, 0x49ff2094
-0, 309600, 152064, 0x9fd58cda
-0, 313200, 152064, 0x3e31b6e3
-0, 316800, 152064, 0x75c6d796
-0, 320400, 152064, 0x4ab3e7bb
-0, 324000, 152064, 0x393935ea
-0, 327600, 152064, 0xc8e62905
-0, 331200, 152064, 0xbb149e61
-0, 334800, 152064, 0x2553c4c5
-0, 338400, 152064, 0x7f82a8b4
-0, 342000, 152064, 0x26ef31e6
-0, 345600, 152064, 0xf029744a
-0, 349200, 152064, 0x0a6f191a
-0, 352800, 152064, 0x55808643
-0, 356400, 152064, 0x27576172
+#tb 0: 1/25
+0, 0, 0, 1, 152064, 0xbdc2b880
+0, 1, 1, 1, 152064, 0x4ebf93fe
+0, 2, 2, 1, 152064, 0xe30d6871
+0, 3, 3, 1, 152064, 0x04f46b9b
+0, 4, 4, 1, 152064, 0xd7dd219a
+0, 5, 5, 1, 152064, 0x02fc6511
+0, 6, 6, 1, 152064, 0x98868faa
+0, 7, 7, 1, 152064, 0x54b94f92
+0, 8, 8, 1, 152064, 0xe3b6be4b
+0, 9, 9, 1, 152064, 0xf148cf10
+0, 10, 10, 1, 152064, 0xda3239b8
+0, 11, 11, 1, 152064, 0x6c5d7331
+0, 12, 12, 1, 152064, 0x825f1fea
+0, 13, 13, 1, 152064, 0x47791056
+0, 14, 14, 1, 152064, 0xc08e8a58
+0, 15, 15, 1, 152064, 0x020299f3
+0, 16, 16, 1, 152064, 0x0dfd4457
+0, 17, 17, 1, 152064, 0xcf005e68
+0, 18, 18, 1, 152064, 0x1f9e2c32
+0, 19, 19, 1, 152064, 0xa8359324
+0, 20, 20, 1, 152064, 0x4b03752d
+0, 21, 21, 1, 152064, 0xd6281621
+0, 22, 22, 1, 152064, 0xc97ac928
+0, 23, 23, 1, 152064, 0xded90dcd
+0, 24, 24, 1, 152064, 0xd6883255
+0, 25, 25, 1, 152064, 0x6edb4d4f
+0, 26, 26, 1, 152064, 0xd6f93a80
+0, 27, 27, 1, 152064, 0x163d6153
+0, 28, 28, 1, 152064, 0x04b90c06
+0, 29, 29, 1, 152064, 0xee8730c1
+0, 30, 30, 1, 152064, 0xd5f5c669
+0, 31, 31, 1, 152064, 0xcc600b1f
+0, 32, 32, 1, 152064, 0x15ddde03
+0, 33, 33, 1, 152064, 0xd0388dd0
+0, 34, 34, 1, 152064, 0xa292ab7d
+0, 35, 35, 1, 152064, 0xacf584e9
+0, 36, 36, 1, 152064, 0xcef42714
+0, 37, 37, 1, 152064, 0xeb162f35
+0, 38, 38, 1, 152064, 0x0a07de7b
+0, 39, 39, 1, 152064, 0x7ae76c81
+0, 40, 40, 1, 152064, 0x139c8fda
+0, 41, 41, 1, 152064, 0x43724411
+0, 42, 42, 1, 152064, 0x07b2ddea
+0, 43, 43, 1, 152064, 0x831a1cc7
+0, 44, 44, 1, 152064, 0x092f5073
+0, 45, 45, 1, 152064, 0xe5b6d380
+0, 46, 46, 1, 152064, 0xdd30d69e
+0, 47, 47, 1, 152064, 0x887020b2
+0, 48, 48, 1, 152064, 0x84436510
+0, 49, 49, 1, 152064, 0x49f63606
+0, 50, 50, 1, 152064, 0x6b96e959
+0, 51, 51, 1, 152064, 0xc6247cc7
+0, 52, 52, 1, 152064, 0x7a67c532
+0, 53, 53, 1, 152064, 0x93f4c476
+0, 54, 54, 1, 152064, 0x3c119654
+0, 55, 55, 1, 152064, 0xa45f7c72
+0, 56, 56, 1, 152064, 0x2ac50cb0
+0, 57, 57, 1, 152064, 0x9bf16d06
+0, 58, 58, 1, 152064, 0xfa0750d9
+0, 59, 59, 1, 152064, 0x02197630
+0, 60, 60, 1, 152064, 0x6d44f9b5
+0, 61, 61, 1, 152064, 0x86b211f5
+0, 62, 62, 1, 152064, 0xf4fda5d0
+0, 63, 63, 1, 152064, 0x36f840a7
+0, 64, 64, 1, 152064, 0x42412992
+0, 65, 65, 1, 152064, 0xd0c9ba37
+0, 66, 66, 1, 152064, 0xc40eba62
+0, 67, 67, 1, 152064, 0x2d093b53
+0, 68, 68, 1, 152064, 0xee39c69c
+0, 69, 69, 1, 152064, 0xcbbf8968
+0, 70, 70, 1, 152064, 0xfddc1704
+0, 71, 71, 1, 152064, 0x8dc47c61
+0, 72, 72, 1, 152064, 0xf15580bf
+0, 73, 73, 1, 152064, 0x9c71a8b0
+0, 74, 74, 1, 152064, 0x19b90b9f
+0, 75, 75, 1, 152064, 0xb65ae287
+0, 76, 76, 1, 152064, 0xf265693d
+0, 77, 77, 1, 152064, 0x721714a1
+0, 78, 78, 1, 152064, 0x383e8ac5
+0, 79, 79, 1, 152064, 0x02558677
+0, 80, 80, 1, 152064, 0xdaab3cdf
+0, 81, 81, 1, 152064, 0xc939a2f6
+0, 82, 82, 1, 152064, 0x977afa7f
+0, 83, 83, 1, 152064, 0xe5e65f35
+0, 84, 84, 1, 152064, 0x247546fa
+0, 85, 85, 1, 152064, 0x49ff2094
+0, 86, 86, 1, 152064, 0x9fd58cda
+0, 87, 87, 1, 152064, 0x3e31b6e3
+0, 88, 88, 1, 152064, 0x75c6d796
+0, 89, 89, 1, 152064, 0x4ab3e7bb
+0, 90, 90, 1, 152064, 0x393935ea
+0, 91, 91, 1, 152064, 0xc8e62905
+0, 92, 92, 1, 152064, 0xbb149e61
+0, 93, 93, 1, 152064, 0x2553c4c5
+0, 94, 94, 1, 152064, 0x7f82a8b4
+0, 95, 95, 1, 152064, 0x26ef31e6
+0, 96, 96, 1, 152064, 0xf029744a
+0, 97, 97, 1, 152064, 0x0a6f191a
+0, 98, 98, 1, 152064, 0x55808643
+0, 99, 99, 1, 152064, 0x27576172
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-brcm_freh11 b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-brcm_freh11
index fa2e708..3183c4d 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-brcm_freh11
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-brcm_freh11
@@ -1,100 +1,101 @@
-0, 0, 152064, 0x9744ac59
-0, 3600, 152064, 0x3eba88bf
-0, 7200, 152064, 0xd4105c5a
-0, 10800, 152064, 0x452966a3
-0, 14400, 152064, 0x30071add
-0, 18000, 152064, 0x0eb75245
-0, 21600, 152064, 0x4daa80fa
-0, 25200, 152064, 0xf53a43a1
-0, 28800, 152064, 0xa55ab43d
-0, 32400, 152064, 0x915ec82e
-0, 36000, 152064, 0xadce2f9a
-0, 39600, 152064, 0xf7a25715
-0, 43200, 152064, 0x90c91c7d
-0, 46800, 152064, 0x4f0df4ef
-0, 50400, 152064, 0xf6e0783c
-0, 54000, 152064, 0x417c8ca8
-0, 57600, 152064, 0xd33d29d8
-0, 61200, 152064, 0xc9723fa3
-0, 64800, 152064, 0x3e4f22f4
-0, 68400, 152064, 0xd5aa7bd8
-0, 72000, 152064, 0x2a425b54
-0, 75600, 152064, 0x2d400788
-0, 79200, 152064, 0x12fab3a4
-0, 82800, 152064, 0x5544f881
-0, 86400, 152064, 0xd0612cc5
-0, 90000, 152064, 0x157b3654
-0, 93600, 152064, 0x04b61fe0
-0, 97200, 152064, 0x897d600a
-0, 100800, 152064, 0x0d94fa29
-0, 104400, 152064, 0xc0fe249d
-0, 108000, 152064, 0x65abc1d6
-0, 111600, 152064, 0x2bd5f09d
-0, 115200, 152064, 0xd3eebd28
-0, 118800, 152064, 0x93458649
-0, 122400, 152064, 0x55e793a6
-0, 126000, 152064, 0x9fc378ce
-0, 129600, 152064, 0x24c32731
-0, 133200, 152064, 0x3c321c50
-0, 136800, 152064, 0xcef3ca8b
-0, 140400, 152064, 0x97116676
-0, 144000, 152064, 0x73ae78f6
-0, 147600, 152064, 0xdeec219e
-0, 151200, 152064, 0xc061d584
-0, 154800, 152064, 0xcf47f6c9
-0, 158400, 152064, 0x280d3a2d
-0, 162000, 152064, 0xb660c846
-0, 165600, 152064, 0xe167c588
-0, 169200, 152064, 0x08f808de
-0, 172800, 152064, 0x9de65c0b
-0, 176400, 152064, 0xc52a1937
-0, 180000, 152064, 0xf5a4d86f
-0, 183600, 152064, 0xbef86d37
-0, 187200, 152064, 0xa227b21b
-0, 190800, 152064, 0x0601ad35
-0, 194400, 152064, 0x15198730
-0, 198000, 152064, 0x9af764c6
-0, 201600, 152064, 0x1a95e99a
-0, 205200, 152064, 0x6bef5aa8
-0, 208800, 152064, 0x92f03267
-0, 212400, 152064, 0x0a3d56cb
-0, 216000, 152064, 0xd9c9f62e
-0, 219600, 152064, 0xcd81ea16
-0, 223200, 152064, 0x8ed789c0
-0, 226800, 152064, 0x5a5e356f
-0, 230400, 152064, 0x2f260ebf
-0, 234000, 152064, 0xa0379c89
-0, 237600, 152064, 0x100cb40c
-0, 241200, 152064, 0xaad2220a
-0, 244800, 152064, 0xec82aa8d
-0, 248400, 152064, 0x91088303
-0, 252000, 152064, 0x0cce0e9e
-0, 255600, 152064, 0xf3bc716a
-0, 259200, 152064, 0x989879c5
-0, 262800, 152064, 0x491297a0
-0, 266400, 152064, 0xdc16f30d
-0, 270000, 152064, 0xb9bfdd57
-0, 273600, 152064, 0x5fba59c2
-0, 277200, 152064, 0x89c40529
-0, 280800, 152064, 0x1b3e7b54
-0, 284400, 152064, 0x5d0d7903
-0, 288000, 152064, 0x2e3434e1
-0, 291600, 152064, 0x1f47a276
-0, 295200, 152064, 0xa22de2b1
-0, 298800, 152064, 0x77344844
-0, 302400, 152064, 0x6a6b3fce
-0, 306000, 152064, 0x82660651
-0, 309600, 152064, 0x51e67cc9
-0, 313200, 152064, 0xb790ae51
-0, 316800, 152064, 0x906bc6b6
-0, 320400, 152064, 0x55c5dc21
-0, 324000, 152064, 0xb51f3004
-0, 327600, 152064, 0x68500a25
-0, 331200, 152064, 0x5dbc812e
-0, 334800, 152064, 0x895eb6ed
-0, 338400, 152064, 0x2f5594fc
-0, 342000, 152064, 0x04a222a9
-0, 345600, 152064, 0x90036f6a
-0, 349200, 152064, 0x8b8b064c
-0, 352800, 152064, 0xd47c7334
-0, 356400, 152064, 0x13f06213
+#tb 0: 1/25
+0, 0, 0, 1, 152064, 0x9744ac59
+0, 1, 1, 1, 152064, 0x3eba88bf
+0, 2, 2, 1, 152064, 0xd4105c5a
+0, 3, 3, 1, 152064, 0x452966a3
+0, 4, 4, 1, 152064, 0x30071add
+0, 5, 5, 1, 152064, 0x0eb75245
+0, 6, 6, 1, 152064, 0x4daa80fa
+0, 7, 7, 1, 152064, 0xf53a43a1
+0, 8, 8, 1, 152064, 0xa55ab43d
+0, 9, 9, 1, 152064, 0x915ec82e
+0, 10, 10, 1, 152064, 0xadce2f9a
+0, 11, 11, 1, 152064, 0xf7a25715
+0, 12, 12, 1, 152064, 0x90c91c7d
+0, 13, 13, 1, 152064, 0x4f0df4ef
+0, 14, 14, 1, 152064, 0xf6e0783c
+0, 15, 15, 1, 152064, 0x417c8ca8
+0, 16, 16, 1, 152064, 0xd33d29d8
+0, 17, 17, 1, 152064, 0xc9723fa3
+0, 18, 18, 1, 152064, 0x3e4f22f4
+0, 19, 19, 1, 152064, 0xd5aa7bd8
+0, 20, 20, 1, 152064, 0x2a425b54
+0, 21, 21, 1, 152064, 0x2d400788
+0, 22, 22, 1, 152064, 0x12fab3a4
+0, 23, 23, 1, 152064, 0x5544f881
+0, 24, 24, 1, 152064, 0xd0612cc5
+0, 25, 25, 1, 152064, 0x157b3654
+0, 26, 26, 1, 152064, 0x04b61fe0
+0, 27, 27, 1, 152064, 0x897d600a
+0, 28, 28, 1, 152064, 0x0d94fa29
+0, 29, 29, 1, 152064, 0xc0fe249d
+0, 30, 30, 1, 152064, 0x65abc1d6
+0, 31, 31, 1, 152064, 0x2bd5f09d
+0, 32, 32, 1, 152064, 0xd3eebd28
+0, 33, 33, 1, 152064, 0x93458649
+0, 34, 34, 1, 152064, 0x55e793a6
+0, 35, 35, 1, 152064, 0x9fc378ce
+0, 36, 36, 1, 152064, 0x24c32731
+0, 37, 37, 1, 152064, 0x3c321c50
+0, 38, 38, 1, 152064, 0xcef3ca8b
+0, 39, 39, 1, 152064, 0x97116676
+0, 40, 40, 1, 152064, 0x73ae78f6
+0, 41, 41, 1, 152064, 0xdeec219e
+0, 42, 42, 1, 152064, 0xc061d584
+0, 43, 43, 1, 152064, 0xcf47f6c9
+0, 44, 44, 1, 152064, 0x280d3a2d
+0, 45, 45, 1, 152064, 0xb660c846
+0, 46, 46, 1, 152064, 0xe167c588
+0, 47, 47, 1, 152064, 0x08f808de
+0, 48, 48, 1, 152064, 0x9de65c0b
+0, 49, 49, 1, 152064, 0xc52a1937
+0, 50, 50, 1, 152064, 0xf5a4d86f
+0, 51, 51, 1, 152064, 0xbef86d37
+0, 52, 52, 1, 152064, 0xa227b21b
+0, 53, 53, 1, 152064, 0x0601ad35
+0, 54, 54, 1, 152064, 0x15198730
+0, 55, 55, 1, 152064, 0x9af764c6
+0, 56, 56, 1, 152064, 0x1a95e99a
+0, 57, 57, 1, 152064, 0x6bef5aa8
+0, 58, 58, 1, 152064, 0x92f03267
+0, 59, 59, 1, 152064, 0x0a3d56cb
+0, 60, 60, 1, 152064, 0xd9c9f62e
+0, 61, 61, 1, 152064, 0xcd81ea16
+0, 62, 62, 1, 152064, 0x8ed789c0
+0, 63, 63, 1, 152064, 0x5a5e356f
+0, 64, 64, 1, 152064, 0x2f260ebf
+0, 65, 65, 1, 152064, 0xa0379c89
+0, 66, 66, 1, 152064, 0x100cb40c
+0, 67, 67, 1, 152064, 0xaad2220a
+0, 68, 68, 1, 152064, 0xec82aa8d
+0, 69, 69, 1, 152064, 0x91088303
+0, 70, 70, 1, 152064, 0x0cce0e9e
+0, 71, 71, 1, 152064, 0xf3bc716a
+0, 72, 72, 1, 152064, 0x989879c5
+0, 73, 73, 1, 152064, 0x491297a0
+0, 74, 74, 1, 152064, 0xdc16f30d
+0, 75, 75, 1, 152064, 0xb9bfdd57
+0, 76, 76, 1, 152064, 0x5fba59c2
+0, 77, 77, 1, 152064, 0x89c40529
+0, 78, 78, 1, 152064, 0x1b3e7b54
+0, 79, 79, 1, 152064, 0x5d0d7903
+0, 80, 80, 1, 152064, 0x2e3434e1
+0, 81, 81, 1, 152064, 0x1f47a276
+0, 82, 82, 1, 152064, 0xa22de2b1
+0, 83, 83, 1, 152064, 0x77344844
+0, 84, 84, 1, 152064, 0x6a6b3fce
+0, 85, 85, 1, 152064, 0x82660651
+0, 86, 86, 1, 152064, 0x51e67cc9
+0, 87, 87, 1, 152064, 0xb790ae51
+0, 88, 88, 1, 152064, 0x906bc6b6
+0, 89, 89, 1, 152064, 0x55c5dc21
+0, 90, 90, 1, 152064, 0xb51f3004
+0, 91, 91, 1, 152064, 0x68500a25
+0, 92, 92, 1, 152064, 0x5dbc812e
+0, 93, 93, 1, 152064, 0x895eb6ed
+0, 94, 94, 1, 152064, 0x2f5594fc
+0, 95, 95, 1, 152064, 0x04a222a9
+0, 96, 96, 1, 152064, 0x90036f6a
+0, 97, 97, 1, 152064, 0x8b8b064c
+0, 98, 98, 1, 152064, 0xd47c7334
+0, 99, 99, 1, 152064, 0x13f06213
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-brcm_freh3 b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-brcm_freh3
index 4a56710..9a40148 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-brcm_freh3
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-brcm_freh3
@@ -1,100 +1,101 @@
-0, 0, 152064, 0x9f9caf3c
-0, 3600, 152064, 0x4e8e9dc4
-0, 7200, 152064, 0x7eab62be
-0, 10800, 152064, 0x79de6e48
-0, 14400, 152064, 0x6bb843f3
-0, 18000, 152064, 0xd0e96c36
-0, 21600, 152064, 0x061a9036
-0, 25200, 152064, 0x342c42ea
-0, 28800, 152064, 0x9835cfc3
-0, 32400, 152064, 0x129ed3dd
-0, 36000, 152064, 0x81413cf7
-0, 39600, 152064, 0xcd16539e
-0, 43200, 152064, 0x927728cd
-0, 46800, 152064, 0x5ebd1126
-0, 50400, 152064, 0x9ad29eb3
-0, 54000, 152064, 0x0ae5a447
-0, 57600, 152064, 0xaf275266
-0, 61200, 152064, 0x98f96209
-0, 64800, 152064, 0x5fcf241f
-0, 68400, 152064, 0x17507ee5
-0, 72000, 152064, 0xb4ad5f2d
-0, 75600, 152064, 0x02fff6da
-0, 79200, 152064, 0x8726c662
-0, 82800, 152064, 0x8ca707d5
-0, 86400, 152064, 0xe41f3946
-0, 90000, 152064, 0xc7b34d1e
-0, 93600, 152064, 0x25146571
-0, 97200, 152064, 0xeb4868f4
-0, 100800, 152064, 0xd0fe149d
-0, 104400, 152064, 0x31043d0a
-0, 108000, 152064, 0xdaf2ba1c
-0, 111600, 152064, 0xb474076c
-0, 115200, 152064, 0x0cf7f1a2
-0, 118800, 152064, 0x2e427793
-0, 122400, 152064, 0x08d9a655
-0, 126000, 152064, 0x79bc8fc9
-0, 129600, 152064, 0xb9871e5c
-0, 133200, 152064, 0xca1246df
-0, 136800, 152064, 0x08c8d524
-0, 140400, 152064, 0xb9be5ecb
-0, 144000, 152064, 0x807f87f0
-0, 147600, 152064, 0x72eb3ab2
-0, 151200, 152064, 0xf463d15f
-0, 154800, 152064, 0x857d0471
-0, 158400, 152064, 0x5dda5ede
-0, 162000, 152064, 0xec33b550
-0, 165600, 152064, 0x2217b9bb
-0, 169200, 152064, 0x060b0fa4
-0, 172800, 152064, 0x5a785b49
-0, 176400, 152064, 0x6969268b
-0, 180000, 152064, 0xe145d3a4
-0, 183600, 152064, 0xb7256e99
-0, 187200, 152064, 0x5bbebf16
-0, 190800, 152064, 0x9234b31e
-0, 194400, 152064, 0x9f0f8c7e
-0, 198000, 152064, 0x15e271c4
-0, 201600, 152064, 0xe8110297
-0, 205200, 152064, 0x1a4364f3
-0, 208800, 152064, 0xb7b336f8
-0, 212400, 152064, 0x31657acb
-0, 216000, 152064, 0xd8e1de00
-0, 219600, 152064, 0x9a57117a
-0, 223200, 152064, 0xfb828be8
-0, 226800, 152064, 0x30bf2ab7
-0, 230400, 152064, 0xaf840b27
-0, 234000, 152064, 0x900cbcd4
-0, 237600, 152064, 0x6439acfc
-0, 241200, 152064, 0x716036fd
-0, 244800, 152064, 0xc3d9baa8
-0, 248400, 152064, 0x455f7d1f
-0, 252000, 152064, 0x84c10d78
-0, 255600, 152064, 0x2cd76642
-0, 259200, 152064, 0x5c746b3a
-0, 262800, 152064, 0x92e39e7d
-0, 266400, 152064, 0xae610df8
-0, 270000, 152064, 0xc8bac3fa
-0, 273600, 152064, 0x04be8a35
-0, 277200, 152064, 0xaaf91b17
-0, 280800, 152064, 0x5afa8764
-0, 284400, 152064, 0x31828a12
-0, 288000, 152064, 0xf1bd3da9
-0, 291600, 152064, 0xbbb2aaef
-0, 295200, 152064, 0xcf69efa1
-0, 298800, 152064, 0x54e85e1b
-0, 302400, 152064, 0x89ff3a1a
-0, 306000, 152064, 0x86c80511
-0, 309600, 152064, 0x41c886f2
-0, 313200, 152064, 0x9f2ebd74
-0, 316800, 152064, 0x74d3d0e0
-0, 320400, 152064, 0xc79501cc
-0, 324000, 152064, 0x123e23e2
-0, 327600, 152064, 0xb6122ea0
-0, 331200, 152064, 0x551f95df
-0, 334800, 152064, 0x0652ac2d
-0, 338400, 152064, 0x6483a8ad
-0, 342000, 152064, 0x7f632ae2
-0, 345600, 152064, 0xae74622f
-0, 349200, 152064, 0xdd411339
-0, 352800, 152064, 0xff0e7f69
-0, 356400, 152064, 0x8b3a5933
+#tb 0: 1/25
+0, 0, 0, 1, 152064, 0x9f9caf3c
+0, 1, 1, 1, 152064, 0x4e8e9dc4
+0, 2, 2, 1, 152064, 0x7eab62be
+0, 3, 3, 1, 152064, 0x79de6e48
+0, 4, 4, 1, 152064, 0x6bb843f3
+0, 5, 5, 1, 152064, 0xd0e96c36
+0, 6, 6, 1, 152064, 0x061a9036
+0, 7, 7, 1, 152064, 0x342c42ea
+0, 8, 8, 1, 152064, 0x9835cfc3
+0, 9, 9, 1, 152064, 0x129ed3dd
+0, 10, 10, 1, 152064, 0x81413cf7
+0, 11, 11, 1, 152064, 0xcd16539e
+0, 12, 12, 1, 152064, 0x927728cd
+0, 13, 13, 1, 152064, 0x5ebd1126
+0, 14, 14, 1, 152064, 0x9ad29eb3
+0, 15, 15, 1, 152064, 0x0ae5a447
+0, 16, 16, 1, 152064, 0xaf275266
+0, 17, 17, 1, 152064, 0x98f96209
+0, 18, 18, 1, 152064, 0x5fcf241f
+0, 19, 19, 1, 152064, 0x17507ee5
+0, 20, 20, 1, 152064, 0xb4ad5f2d
+0, 21, 21, 1, 152064, 0x02fff6da
+0, 22, 22, 1, 152064, 0x8726c662
+0, 23, 23, 1, 152064, 0x8ca707d5
+0, 24, 24, 1, 152064, 0xe41f3946
+0, 25, 25, 1, 152064, 0xc7b34d1e
+0, 26, 26, 1, 152064, 0x25146571
+0, 27, 27, 1, 152064, 0xeb4868f4
+0, 28, 28, 1, 152064, 0xd0fe149d
+0, 29, 29, 1, 152064, 0x31043d0a
+0, 30, 30, 1, 152064, 0xdaf2ba1c
+0, 31, 31, 1, 152064, 0xb474076c
+0, 32, 32, 1, 152064, 0x0cf7f1a2
+0, 33, 33, 1, 152064, 0x2e427793
+0, 34, 34, 1, 152064, 0x08d9a655
+0, 35, 35, 1, 152064, 0x79bc8fc9
+0, 36, 36, 1, 152064, 0xb9871e5c
+0, 37, 37, 1, 152064, 0xca1246df
+0, 38, 38, 1, 152064, 0x08c8d524
+0, 39, 39, 1, 152064, 0xb9be5ecb
+0, 40, 40, 1, 152064, 0x807f87f0
+0, 41, 41, 1, 152064, 0x72eb3ab2
+0, 42, 42, 1, 152064, 0xf463d15f
+0, 43, 43, 1, 152064, 0x857d0471
+0, 44, 44, 1, 152064, 0x5dda5ede
+0, 45, 45, 1, 152064, 0xec33b550
+0, 46, 46, 1, 152064, 0x2217b9bb
+0, 47, 47, 1, 152064, 0x060b0fa4
+0, 48, 48, 1, 152064, 0x5a785b49
+0, 49, 49, 1, 152064, 0x6969268b
+0, 50, 50, 1, 152064, 0xe145d3a4
+0, 51, 51, 1, 152064, 0xb7256e99
+0, 52, 52, 1, 152064, 0x5bbebf16
+0, 53, 53, 1, 152064, 0x9234b31e
+0, 54, 54, 1, 152064, 0x9f0f8c7e
+0, 55, 55, 1, 152064, 0x15e271c4
+0, 56, 56, 1, 152064, 0xe8110297
+0, 57, 57, 1, 152064, 0x1a4364f3
+0, 58, 58, 1, 152064, 0xb7b336f8
+0, 59, 59, 1, 152064, 0x31657acb
+0, 60, 60, 1, 152064, 0xd8e1de00
+0, 61, 61, 1, 152064, 0x9a57117a
+0, 62, 62, 1, 152064, 0xfb828be8
+0, 63, 63, 1, 152064, 0x30bf2ab7
+0, 64, 64, 1, 152064, 0xaf840b27
+0, 65, 65, 1, 152064, 0x900cbcd4
+0, 66, 66, 1, 152064, 0x6439acfc
+0, 67, 67, 1, 152064, 0x716036fd
+0, 68, 68, 1, 152064, 0xc3d9baa8
+0, 69, 69, 1, 152064, 0x455f7d1f
+0, 70, 70, 1, 152064, 0x84c10d78
+0, 71, 71, 1, 152064, 0x2cd76642
+0, 72, 72, 1, 152064, 0x5c746b3a
+0, 73, 73, 1, 152064, 0x92e39e7d
+0, 74, 74, 1, 152064, 0xae610df8
+0, 75, 75, 1, 152064, 0xc8bac3fa
+0, 76, 76, 1, 152064, 0x04be8a35
+0, 77, 77, 1, 152064, 0xaaf91b17
+0, 78, 78, 1, 152064, 0x5afa8764
+0, 79, 79, 1, 152064, 0x31828a12
+0, 80, 80, 1, 152064, 0xf1bd3da9
+0, 81, 81, 1, 152064, 0xbbb2aaef
+0, 82, 82, 1, 152064, 0xcf69efa1
+0, 83, 83, 1, 152064, 0x54e85e1b
+0, 84, 84, 1, 152064, 0x89ff3a1a
+0, 85, 85, 1, 152064, 0x86c80511
+0, 86, 86, 1, 152064, 0x41c886f2
+0, 87, 87, 1, 152064, 0x9f2ebd74
+0, 88, 88, 1, 152064, 0x74d3d0e0
+0, 89, 89, 1, 152064, 0xc79501cc
+0, 90, 90, 1, 152064, 0x123e23e2
+0, 91, 91, 1, 152064, 0xb6122ea0
+0, 92, 92, 1, 152064, 0x551f95df
+0, 93, 93, 1, 152064, 0x0652ac2d
+0, 94, 94, 1, 152064, 0x6483a8ad
+0, 95, 95, 1, 152064, 0x7f632ae2
+0, 96, 96, 1, 152064, 0xae74622f
+0, 97, 97, 1, 152064, 0xdd411339
+0, 98, 98, 1, 152064, 0xff0e7f69
+0, 99, 99, 1, 152064, 0x8b3a5933
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-brcm_freh4 b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-brcm_freh4
index 8f0305a..ad3a3ec 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-brcm_freh4
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-brcm_freh4
@@ -1,100 +1,101 @@
-0, 0, 152064, 0x9744ac59
-0, 3600, 152064, 0xe1c69d97
-0, 7200, 152064, 0x9ae85f93
-0, 10800, 152064, 0x452966a3
-0, 14400, 152064, 0xe8192823
-0, 18000, 152064, 0x58b764eb
-0, 21600, 152064, 0x51b686b1
-0, 25200, 152064, 0x4bca5822
-0, 28800, 152064, 0x29abc41c
-0, 32400, 152064, 0x850ec94f
-0, 36000, 152064, 0xac2c34f8
-0, 39600, 152064, 0x080c6e67
-0, 43200, 152064, 0x5e4e14d2
-0, 46800, 152064, 0x978b054c
-0, 50400, 152064, 0x861d8c3c
-0, 54000, 152064, 0xe0818918
-0, 57600, 152064, 0x8b834511
-0, 61200, 152064, 0x223f567c
-0, 64800, 152064, 0x6d61298d
-0, 68400, 152064, 0xfe30826e
-0, 72000, 152064, 0x4bad4f98
-0, 75600, 152064, 0x69d5fdca
-0, 79200, 152064, 0xe45bba1b
-0, 82800, 152064, 0xa6d81298
-0, 86400, 152064, 0x7f3f2c91
-0, 90000, 152064, 0x658754b9
-0, 93600, 152064, 0x2c6d3eba
-0, 97200, 152064, 0x4500600c
-0, 100800, 152064, 0xa745f74b
-0, 104400, 152064, 0x2bf21fca
-0, 108000, 152064, 0x08b8bdb3
-0, 111600, 152064, 0x5a9d0a8b
-0, 115200, 152064, 0x3a57d523
-0, 118800, 152064, 0x3606826e
-0, 122400, 152064, 0x3b91a8fb
-0, 126000, 152064, 0x37c28959
-0, 129600, 152064, 0xb51d1e75
-0, 133200, 152064, 0x13be3f58
-0, 136800, 152064, 0x0ed0e7cf
-0, 140400, 152064, 0x298560d4
-0, 144000, 152064, 0x62b68373
-0, 147600, 152064, 0xf8bb4520
-0, 151200, 152064, 0x90dfd6af
-0, 154800, 152064, 0xf4770d20
-0, 158400, 152064, 0x0d9549a0
-0, 162000, 152064, 0x004eccb1
-0, 165600, 152064, 0x3146d46b
-0, 169200, 152064, 0x078d1808
-0, 172800, 152064, 0x5d8d60cd
-0, 176400, 152064, 0x8ff52dd8
-0, 180000, 152064, 0x5aa3ccf7
-0, 183600, 152064, 0x5bec6c39
-0, 187200, 152064, 0xd44cae9d
-0, 190800, 152064, 0xa1b0a151
-0, 194400, 152064, 0xe3be7bb2
-0, 198000, 152064, 0x50096775
-0, 201600, 152064, 0xdffff851
-0, 205200, 152064, 0x1d7250eb
-0, 208800, 152064, 0x69663ca7
-0, 212400, 152064, 0x62f77fc7
-0, 216000, 152064, 0xbab8f471
-0, 219600, 152064, 0x6af31785
-0, 223200, 152064, 0xcbb2a9aa
-0, 226800, 152064, 0xc57c32b9
-0, 230400, 152064, 0xecbe2ce0
-0, 234000, 152064, 0x2fbebf81
-0, 237600, 152064, 0xa168af68
-0, 241200, 152064, 0x1e5631ac
-0, 244800, 152064, 0xe69fc927
-0, 248400, 152064, 0x8e5c81d8
-0, 252000, 152064, 0x42402010
-0, 255600, 152064, 0xd7267482
-0, 259200, 152064, 0x64b280df
-0, 262800, 152064, 0xc4cbafcc
-0, 266400, 152064, 0xcf2f1e8b
-0, 270000, 152064, 0x4d6fdb3f
-0, 273600, 152064, 0xf22d6fed
-0, 277200, 152064, 0x625b167c
-0, 280800, 152064, 0x41348089
-0, 284400, 152064, 0x6db2779b
-0, 288000, 152064, 0xe87030a8
-0, 291600, 152064, 0x91b29cdd
-0, 295200, 152064, 0xe824f242
-0, 298800, 152064, 0xac995380
-0, 302400, 152064, 0x7efe361b
-0, 306000, 152064, 0xe10c0c26
-0, 309600, 152064, 0x93108260
-0, 313200, 152064, 0xbf4caed7
-0, 316800, 152064, 0xb6a4d826
-0, 320400, 152064, 0x78beea4e
-0, 324000, 152064, 0xdf612df9
-0, 327600, 152064, 0xa9ef2830
-0, 331200, 152064, 0x06448895
-0, 334800, 152064, 0x332eb6d5
-0, 338400, 152064, 0x935ba2c5
-0, 342000, 152064, 0x62a22656
-0, 345600, 152064, 0x06a670a7
-0, 349200, 152064, 0xf60b1af0
-0, 352800, 152064, 0x85177c10
-0, 356400, 152064, 0x5e4e5c4b
+#tb 0: 1/25
+0, 0, 0, 1, 152064, 0x9744ac59
+0, 1, 1, 1, 152064, 0xe1c69d97
+0, 2, 2, 1, 152064, 0x9ae85f93
+0, 3, 3, 1, 152064, 0x452966a3
+0, 4, 4, 1, 152064, 0xe8192823
+0, 5, 5, 1, 152064, 0x58b764eb
+0, 6, 6, 1, 152064, 0x51b686b1
+0, 7, 7, 1, 152064, 0x4bca5822
+0, 8, 8, 1, 152064, 0x29abc41c
+0, 9, 9, 1, 152064, 0x850ec94f
+0, 10, 10, 1, 152064, 0xac2c34f8
+0, 11, 11, 1, 152064, 0x080c6e67
+0, 12, 12, 1, 152064, 0x5e4e14d2
+0, 13, 13, 1, 152064, 0x978b054c
+0, 14, 14, 1, 152064, 0x861d8c3c
+0, 15, 15, 1, 152064, 0xe0818918
+0, 16, 16, 1, 152064, 0x8b834511
+0, 17, 17, 1, 152064, 0x223f567c
+0, 18, 18, 1, 152064, 0x6d61298d
+0, 19, 19, 1, 152064, 0xfe30826e
+0, 20, 20, 1, 152064, 0x4bad4f98
+0, 21, 21, 1, 152064, 0x69d5fdca
+0, 22, 22, 1, 152064, 0xe45bba1b
+0, 23, 23, 1, 152064, 0xa6d81298
+0, 24, 24, 1, 152064, 0x7f3f2c91
+0, 25, 25, 1, 152064, 0x658754b9
+0, 26, 26, 1, 152064, 0x2c6d3eba
+0, 27, 27, 1, 152064, 0x4500600c
+0, 28, 28, 1, 152064, 0xa745f74b
+0, 29, 29, 1, 152064, 0x2bf21fca
+0, 30, 30, 1, 152064, 0x08b8bdb3
+0, 31, 31, 1, 152064, 0x5a9d0a8b
+0, 32, 32, 1, 152064, 0x3a57d523
+0, 33, 33, 1, 152064, 0x3606826e
+0, 34, 34, 1, 152064, 0x3b91a8fb
+0, 35, 35, 1, 152064, 0x37c28959
+0, 36, 36, 1, 152064, 0xb51d1e75
+0, 37, 37, 1, 152064, 0x13be3f58
+0, 38, 38, 1, 152064, 0x0ed0e7cf
+0, 39, 39, 1, 152064, 0x298560d4
+0, 40, 40, 1, 152064, 0x62b68373
+0, 41, 41, 1, 152064, 0xf8bb4520
+0, 42, 42, 1, 152064, 0x90dfd6af
+0, 43, 43, 1, 152064, 0xf4770d20
+0, 44, 44, 1, 152064, 0x0d9549a0
+0, 45, 45, 1, 152064, 0x004eccb1
+0, 46, 46, 1, 152064, 0x3146d46b
+0, 47, 47, 1, 152064, 0x078d1808
+0, 48, 48, 1, 152064, 0x5d8d60cd
+0, 49, 49, 1, 152064, 0x8ff52dd8
+0, 50, 50, 1, 152064, 0x5aa3ccf7
+0, 51, 51, 1, 152064, 0x5bec6c39
+0, 52, 52, 1, 152064, 0xd44cae9d
+0, 53, 53, 1, 152064, 0xa1b0a151
+0, 54, 54, 1, 152064, 0xe3be7bb2
+0, 55, 55, 1, 152064, 0x50096775
+0, 56, 56, 1, 152064, 0xdffff851
+0, 57, 57, 1, 152064, 0x1d7250eb
+0, 58, 58, 1, 152064, 0x69663ca7
+0, 59, 59, 1, 152064, 0x62f77fc7
+0, 60, 60, 1, 152064, 0xbab8f471
+0, 61, 61, 1, 152064, 0x6af31785
+0, 62, 62, 1, 152064, 0xcbb2a9aa
+0, 63, 63, 1, 152064, 0xc57c32b9
+0, 64, 64, 1, 152064, 0xecbe2ce0
+0, 65, 65, 1, 152064, 0x2fbebf81
+0, 66, 66, 1, 152064, 0xa168af68
+0, 67, 67, 1, 152064, 0x1e5631ac
+0, 68, 68, 1, 152064, 0xe69fc927
+0, 69, 69, 1, 152064, 0x8e5c81d8
+0, 70, 70, 1, 152064, 0x42402010
+0, 71, 71, 1, 152064, 0xd7267482
+0, 72, 72, 1, 152064, 0x64b280df
+0, 73, 73, 1, 152064, 0xc4cbafcc
+0, 74, 74, 1, 152064, 0xcf2f1e8b
+0, 75, 75, 1, 152064, 0x4d6fdb3f
+0, 76, 76, 1, 152064, 0xf22d6fed
+0, 77, 77, 1, 152064, 0x625b167c
+0, 78, 78, 1, 152064, 0x41348089
+0, 79, 79, 1, 152064, 0x6db2779b
+0, 80, 80, 1, 152064, 0xe87030a8
+0, 81, 81, 1, 152064, 0x91b29cdd
+0, 82, 82, 1, 152064, 0xe824f242
+0, 83, 83, 1, 152064, 0xac995380
+0, 84, 84, 1, 152064, 0x7efe361b
+0, 85, 85, 1, 152064, 0xe10c0c26
+0, 86, 86, 1, 152064, 0x93108260
+0, 87, 87, 1, 152064, 0xbf4caed7
+0, 88, 88, 1, 152064, 0xb6a4d826
+0, 89, 89, 1, 152064, 0x78beea4e
+0, 90, 90, 1, 152064, 0xdf612df9
+0, 91, 91, 1, 152064, 0xa9ef2830
+0, 92, 92, 1, 152064, 0x06448895
+0, 93, 93, 1, 152064, 0x332eb6d5
+0, 94, 94, 1, 152064, 0x935ba2c5
+0, 95, 95, 1, 152064, 0x62a22656
+0, 96, 96, 1, 152064, 0x06a670a7
+0, 97, 97, 1, 152064, 0xf60b1af0
+0, 98, 98, 1, 152064, 0x85177c10
+0, 99, 99, 1, 152064, 0x5e4e5c4b
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-brcm_freh5 b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-brcm_freh5
index dc7efef..9057c82 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-brcm_freh5
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-brcm_freh5
@@ -1,100 +1,101 @@
-0, 0, 152064, 0xd816ae9a
-0, 3600, 152064, 0x970e9c33
-0, 7200, 152064, 0xbdd14635
-0, 10800, 152064, 0x103f667c
-0, 14400, 152064, 0x752b1ebb
-0, 18000, 152064, 0x1e9d59d4
-0, 21600, 152064, 0x4b9d89b6
-0, 25200, 152064, 0x16c1362e
-0, 28800, 152064, 0x3ea9a977
-0, 32400, 152064, 0x24e3c7fe
-0, 36000, 152064, 0xe64132fa
-0, 39600, 152064, 0xb2074e31
-0, 43200, 152064, 0x87e61824
-0, 46800, 152064, 0xf3e7f2d3
-0, 50400, 152064, 0x36856b98
-0, 54000, 152064, 0xe2be97dd
-0, 57600, 152064, 0xb99a3a3d
-0, 61200, 152064, 0xf4d04afa
-0, 64800, 152064, 0x20a92205
-0, 68400, 152064, 0x5f6272ca
-0, 72000, 152064, 0xe1f45d11
-0, 75600, 152064, 0x7ff113ee
-0, 79200, 152064, 0x47e8befb
-0, 82800, 152064, 0x562c03c6
-0, 86400, 152064, 0x197a311c
-0, 90000, 152064, 0x30017402
-0, 93600, 152064, 0x27e6384e
-0, 97200, 152064, 0x456f6152
-0, 100800, 152064, 0x368810d1
-0, 104400, 152064, 0x7be61b5f
-0, 108000, 152064, 0x5fa9aaef
-0, 111600, 152064, 0x957de9da
-0, 115200, 152064, 0x47c6bc4f
-0, 118800, 152064, 0xb2247b98
-0, 122400, 152064, 0xd045a416
-0, 126000, 152064, 0xa0b16da9
-0, 129600, 152064, 0xe9bd1d8f
-0, 133200, 152064, 0xe7881f4d
-0, 136800, 152064, 0x85e2d4a9
-0, 140400, 152064, 0x00a967cd
-0, 144000, 152064, 0x02507278
-0, 147600, 152064, 0xc511370e
-0, 151200, 152064, 0x7963cf0b
-0, 154800, 152064, 0xf99ef0fd
-0, 158400, 152064, 0x00813540
-0, 162000, 152064, 0xa9aeaf2b
-0, 165600, 152064, 0x559eb849
-0, 169200, 152064, 0x315605c1
-0, 172800, 152064, 0xe2594b7c
-0, 176400, 152064, 0x844ef85c
-0, 180000, 152064, 0x5012c785
-0, 183600, 152064, 0x239f600d
-0, 187200, 152064, 0x80a2a156
-0, 190800, 152064, 0xec239895
-0, 194400, 152064, 0xd7387dbe
-0, 198000, 152064, 0xe8aa6125
-0, 201600, 152064, 0x4742d997
-0, 205200, 152064, 0x88515422
-0, 208800, 152064, 0x3dd02167
-0, 212400, 152064, 0xe36855d1
-0, 216000, 152064, 0x202edeb9
-0, 219600, 152064, 0xf5a5eed3
-0, 223200, 152064, 0xd3bc6e68
-0, 226800, 152064, 0xba902a0a
-0, 230400, 152064, 0x4db4f721
-0, 234000, 152064, 0x293c90bd
-0, 237600, 152064, 0xa651a49f
-0, 241200, 152064, 0x5c1a2a7d
-0, 244800, 152064, 0xa67986de
-0, 248400, 152064, 0xe5fe7d26
-0, 252000, 152064, 0xde191b31
-0, 255600, 152064, 0x5e303cb1
-0, 259200, 152064, 0x657f6d5d
-0, 262800, 152064, 0x5c44adaa
-0, 266400, 152064, 0x8c3c0422
-0, 270000, 152064, 0x161cb54f
-0, 273600, 152064, 0xc96355c8
-0, 277200, 152064, 0xeb02fdec
-0, 280800, 152064, 0xd18a7989
-0, 284400, 152064, 0xc7d671bf
-0, 288000, 152064, 0x2e1637cc
-0, 291600, 152064, 0xd0d5958a
-0, 295200, 152064, 0x2f9dd79c
-0, 298800, 152064, 0xa96b4dd1
-0, 302400, 152064, 0x7bfc2eb9
-0, 306000, 152064, 0xc3c91809
-0, 309600, 152064, 0x9e167aa3
-0, 313200, 152064, 0xb47e9f6e
-0, 316800, 152064, 0x70e6c184
-0, 320400, 152064, 0x0d92e4e7
-0, 324000, 152064, 0xf4891b11
-0, 327600, 152064, 0x93f912c7
-0, 331200, 152064, 0xa3bc52c5
-0, 334800, 152064, 0xc6fca440
-0, 338400, 152064, 0x045aa5d4
-0, 342000, 152064, 0x15ba1dd0
-0, 345600, 152064, 0x59f45a8b
-0, 349200, 152064, 0x9dc20832
-0, 352800, 152064, 0x36316eb4
-0, 356400, 152064, 0x28ba54f4
+#tb 0: 1/25
+0, 0, 0, 1, 152064, 0xd816ae9a
+0, 1, 1, 1, 152064, 0x970e9c33
+0, 2, 2, 1, 152064, 0xbdd14635
+0, 3, 3, 1, 152064, 0x103f667c
+0, 4, 4, 1, 152064, 0x752b1ebb
+0, 5, 5, 1, 152064, 0x1e9d59d4
+0, 6, 6, 1, 152064, 0x4b9d89b6
+0, 7, 7, 1, 152064, 0x16c1362e
+0, 8, 8, 1, 152064, 0x3ea9a977
+0, 9, 9, 1, 152064, 0x24e3c7fe
+0, 10, 10, 1, 152064, 0xe64132fa
+0, 11, 11, 1, 152064, 0xb2074e31
+0, 12, 12, 1, 152064, 0x87e61824
+0, 13, 13, 1, 152064, 0xf3e7f2d3
+0, 14, 14, 1, 152064, 0x36856b98
+0, 15, 15, 1, 152064, 0xe2be97dd
+0, 16, 16, 1, 152064, 0xb99a3a3d
+0, 17, 17, 1, 152064, 0xf4d04afa
+0, 18, 18, 1, 152064, 0x20a92205
+0, 19, 19, 1, 152064, 0x5f6272ca
+0, 20, 20, 1, 152064, 0xe1f45d11
+0, 21, 21, 1, 152064, 0x7ff113ee
+0, 22, 22, 1, 152064, 0x47e8befb
+0, 23, 23, 1, 152064, 0x562c03c6
+0, 24, 24, 1, 152064, 0x197a311c
+0, 25, 25, 1, 152064, 0x30017402
+0, 26, 26, 1, 152064, 0x27e6384e
+0, 27, 27, 1, 152064, 0x456f6152
+0, 28, 28, 1, 152064, 0x368810d1
+0, 29, 29, 1, 152064, 0x7be61b5f
+0, 30, 30, 1, 152064, 0x5fa9aaef
+0, 31, 31, 1, 152064, 0x957de9da
+0, 32, 32, 1, 152064, 0x47c6bc4f
+0, 33, 33, 1, 152064, 0xb2247b98
+0, 34, 34, 1, 152064, 0xd045a416
+0, 35, 35, 1, 152064, 0xa0b16da9
+0, 36, 36, 1, 152064, 0xe9bd1d8f
+0, 37, 37, 1, 152064, 0xe7881f4d
+0, 38, 38, 1, 152064, 0x85e2d4a9
+0, 39, 39, 1, 152064, 0x00a967cd
+0, 40, 40, 1, 152064, 0x02507278
+0, 41, 41, 1, 152064, 0xc511370e
+0, 42, 42, 1, 152064, 0x7963cf0b
+0, 43, 43, 1, 152064, 0xf99ef0fd
+0, 44, 44, 1, 152064, 0x00813540
+0, 45, 45, 1, 152064, 0xa9aeaf2b
+0, 46, 46, 1, 152064, 0x559eb849
+0, 47, 47, 1, 152064, 0x315605c1
+0, 48, 48, 1, 152064, 0xe2594b7c
+0, 49, 49, 1, 152064, 0x844ef85c
+0, 50, 50, 1, 152064, 0x5012c785
+0, 51, 51, 1, 152064, 0x239f600d
+0, 52, 52, 1, 152064, 0x80a2a156
+0, 53, 53, 1, 152064, 0xec239895
+0, 54, 54, 1, 152064, 0xd7387dbe
+0, 55, 55, 1, 152064, 0xe8aa6125
+0, 56, 56, 1, 152064, 0x4742d997
+0, 57, 57, 1, 152064, 0x88515422
+0, 58, 58, 1, 152064, 0x3dd02167
+0, 59, 59, 1, 152064, 0xe36855d1
+0, 60, 60, 1, 152064, 0x202edeb9
+0, 61, 61, 1, 152064, 0xf5a5eed3
+0, 62, 62, 1, 152064, 0xd3bc6e68
+0, 63, 63, 1, 152064, 0xba902a0a
+0, 64, 64, 1, 152064, 0x4db4f721
+0, 65, 65, 1, 152064, 0x293c90bd
+0, 66, 66, 1, 152064, 0xa651a49f
+0, 67, 67, 1, 152064, 0x5c1a2a7d
+0, 68, 68, 1, 152064, 0xa67986de
+0, 69, 69, 1, 152064, 0xe5fe7d26
+0, 70, 70, 1, 152064, 0xde191b31
+0, 71, 71, 1, 152064, 0x5e303cb1
+0, 72, 72, 1, 152064, 0x657f6d5d
+0, 73, 73, 1, 152064, 0x5c44adaa
+0, 74, 74, 1, 152064, 0x8c3c0422
+0, 75, 75, 1, 152064, 0x161cb54f
+0, 76, 76, 1, 152064, 0xc96355c8
+0, 77, 77, 1, 152064, 0xeb02fdec
+0, 78, 78, 1, 152064, 0xd18a7989
+0, 79, 79, 1, 152064, 0xc7d671bf
+0, 80, 80, 1, 152064, 0x2e1637cc
+0, 81, 81, 1, 152064, 0xd0d5958a
+0, 82, 82, 1, 152064, 0x2f9dd79c
+0, 83, 83, 1, 152064, 0xa96b4dd1
+0, 84, 84, 1, 152064, 0x7bfc2eb9
+0, 85, 85, 1, 152064, 0xc3c91809
+0, 86, 86, 1, 152064, 0x9e167aa3
+0, 87, 87, 1, 152064, 0xb47e9f6e
+0, 88, 88, 1, 152064, 0x70e6c184
+0, 89, 89, 1, 152064, 0x0d92e4e7
+0, 90, 90, 1, 152064, 0xf4891b11
+0, 91, 91, 1, 152064, 0x93f912c7
+0, 92, 92, 1, 152064, 0xa3bc52c5
+0, 93, 93, 1, 152064, 0xc6fca440
+0, 94, 94, 1, 152064, 0x045aa5d4
+0, 95, 95, 1, 152064, 0x15ba1dd0
+0, 96, 96, 1, 152064, 0x59f45a8b
+0, 97, 97, 1, 152064, 0x9dc20832
+0, 98, 98, 1, 152064, 0x36316eb4
+0, 99, 99, 1, 152064, 0x28ba54f4
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-brcm_freh8 b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-brcm_freh8
index 69a55e1..4cc7f0e 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-brcm_freh8
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-brcm_freh8
@@ -1,100 +1,101 @@
-0, 0, 152064, 0xdcc4ac76
-0, 3600, 152064, 0xfde6871a
-0, 7200, 152064, 0xe8a351b5
-0, 10800, 152064, 0x0e586608
-0, 14400, 152064, 0xbe3c2adc
-0, 18000, 152064, 0x244a5b3c
-0, 21600, 152064, 0x7cad919e
-0, 25200, 152064, 0x24c452c0
-0, 28800, 152064, 0x089dc7f0
-0, 32400, 152064, 0x6ee5d1dd
-0, 36000, 152064, 0x177430f0
-0, 39600, 152064, 0xf2af65f6
-0, 43200, 152064, 0x4c4626a7
-0, 46800, 152064, 0x897af1da
-0, 50400, 152064, 0xf16199b1
-0, 54000, 152064, 0x2979a469
-0, 57600, 152064, 0x5ce345a0
-0, 61200, 152064, 0x1a044ff3
-0, 64800, 152064, 0x9075241f
-0, 68400, 152064, 0xd1457558
-0, 72000, 152064, 0xdfe3669f
-0, 75600, 152064, 0x4961fc7a
-0, 79200, 152064, 0xb84daee5
-0, 82800, 152064, 0xc4efe5c3
-0, 86400, 152064, 0x35f73410
-0, 90000, 152064, 0xf99a2c73
-0, 93600, 152064, 0xe5c12391
-0, 97200, 152064, 0xc2056236
-0, 100800, 152064, 0xce2bff90
-0, 104400, 152064, 0x01d92bb1
-0, 108000, 152064, 0xc55eb558
-0, 111600, 152064, 0xf02ef0ff
-0, 115200, 152064, 0x069dd1c6
-0, 118800, 152064, 0x49718229
-0, 122400, 152064, 0x0e9ea401
-0, 126000, 152064, 0x307e7f8b
-0, 129600, 152064, 0xf5071e31
-0, 133200, 152064, 0xac2c2ad0
-0, 136800, 152064, 0x5586d665
-0, 140400, 152064, 0xa62a6a2b
-0, 144000, 152064, 0xff167d1b
-0, 147600, 152064, 0x02d225c2
-0, 151200, 152064, 0x868ccb0b
-0, 154800, 152064, 0x36edfa29
-0, 158400, 152064, 0xb6244864
-0, 162000, 152064, 0xd891b5dc
-0, 165600, 152064, 0x9246b763
-0, 169200, 152064, 0xea240b61
-0, 172800, 152064, 0x2d985877
-0, 176400, 152064, 0xe6b92603
-0, 180000, 152064, 0x102ac84f
-0, 183600, 152064, 0xddaf709b
-0, 187200, 152064, 0x48dfb25e
-0, 190800, 152064, 0xf2acadbb
-0, 194400, 152064, 0x647685f5
-0, 198000, 152064, 0x893874c9
-0, 201600, 152064, 0xdfd7ed77
-0, 205200, 152064, 0x97b36277
-0, 208800, 152064, 0x59f33282
-0, 212400, 152064, 0xba5c6a0e
-0, 216000, 152064, 0x7856ddf0
-0, 219600, 152064, 0x74e5f095
-0, 223200, 152064, 0x76167a60
-0, 226800, 152064, 0xa6cf2255
-0, 230400, 152064, 0x9f8b1446
-0, 234000, 152064, 0xa775aa79
-0, 237600, 152064, 0x5662a698
-0, 241200, 152064, 0xe6321e5b
-0, 244800, 152064, 0xdaea9a83
-0, 248400, 152064, 0xd89d835f
-0, 252000, 152064, 0x0b1503e2
-0, 255600, 152064, 0x7fef6395
-0, 259200, 152064, 0xc27273f2
-0, 262800, 152064, 0xff9288fd
-0, 266400, 152064, 0xb76aee35
-0, 270000, 152064, 0xbd0dc4b2
-0, 273600, 152064, 0x3085598e
-0, 277200, 152064, 0x22e408f6
-0, 280800, 152064, 0xc054866d
-0, 284400, 152064, 0x881377f8
-0, 288000, 152064, 0x0dd7311e
-0, 291600, 152064, 0x627ea688
-0, 295200, 152064, 0x95bbe693
-0, 298800, 152064, 0x806c480f
-0, 302400, 152064, 0x6feb3d47
-0, 306000, 152064, 0x639f0a72
-0, 309600, 152064, 0x4922909d
-0, 313200, 152064, 0x44bbc195
-0, 316800, 152064, 0xf119ca8f
-0, 320400, 152064, 0x6f46e9c8
-0, 324000, 152064, 0xd68e222a
-0, 327600, 152064, 0xedc716eb
-0, 331200, 152064, 0x090a7702
-0, 334800, 152064, 0xc94eac7a
-0, 338400, 152064, 0x629d8823
-0, 342000, 152064, 0x30a51f8c
-0, 345600, 152064, 0x4265666b
-0, 349200, 152064, 0x766dfd25
-0, 352800, 152064, 0x7dc37c52
-0, 356400, 152064, 0x07c65fbe
+#tb 0: 1/25
+0, 0, 0, 1, 152064, 0xdcc4ac76
+0, 1, 1, 1, 152064, 0xfde6871a
+0, 2, 2, 1, 152064, 0xe8a351b5
+0, 3, 3, 1, 152064, 0x0e586608
+0, 4, 4, 1, 152064, 0xbe3c2adc
+0, 5, 5, 1, 152064, 0x244a5b3c
+0, 6, 6, 1, 152064, 0x7cad919e
+0, 7, 7, 1, 152064, 0x24c452c0
+0, 8, 8, 1, 152064, 0x089dc7f0
+0, 9, 9, 1, 152064, 0x6ee5d1dd
+0, 10, 10, 1, 152064, 0x177430f0
+0, 11, 11, 1, 152064, 0xf2af65f6
+0, 12, 12, 1, 152064, 0x4c4626a7
+0, 13, 13, 1, 152064, 0x897af1da
+0, 14, 14, 1, 152064, 0xf16199b1
+0, 15, 15, 1, 152064, 0x2979a469
+0, 16, 16, 1, 152064, 0x5ce345a0
+0, 17, 17, 1, 152064, 0x1a044ff3
+0, 18, 18, 1, 152064, 0x9075241f
+0, 19, 19, 1, 152064, 0xd1457558
+0, 20, 20, 1, 152064, 0xdfe3669f
+0, 21, 21, 1, 152064, 0x4961fc7a
+0, 22, 22, 1, 152064, 0xb84daee5
+0, 23, 23, 1, 152064, 0xc4efe5c3
+0, 24, 24, 1, 152064, 0x35f73410
+0, 25, 25, 1, 152064, 0xf99a2c73
+0, 26, 26, 1, 152064, 0xe5c12391
+0, 27, 27, 1, 152064, 0xc2056236
+0, 28, 28, 1, 152064, 0xce2bff90
+0, 29, 29, 1, 152064, 0x01d92bb1
+0, 30, 30, 1, 152064, 0xc55eb558
+0, 31, 31, 1, 152064, 0xf02ef0ff
+0, 32, 32, 1, 152064, 0x069dd1c6
+0, 33, 33, 1, 152064, 0x49718229
+0, 34, 34, 1, 152064, 0x0e9ea401
+0, 35, 35, 1, 152064, 0x307e7f8b
+0, 36, 36, 1, 152064, 0xf5071e31
+0, 37, 37, 1, 152064, 0xac2c2ad0
+0, 38, 38, 1, 152064, 0x5586d665
+0, 39, 39, 1, 152064, 0xa62a6a2b
+0, 40, 40, 1, 152064, 0xff167d1b
+0, 41, 41, 1, 152064, 0x02d225c2
+0, 42, 42, 1, 152064, 0x868ccb0b
+0, 43, 43, 1, 152064, 0x36edfa29
+0, 44, 44, 1, 152064, 0xb6244864
+0, 45, 45, 1, 152064, 0xd891b5dc
+0, 46, 46, 1, 152064, 0x9246b763
+0, 47, 47, 1, 152064, 0xea240b61
+0, 48, 48, 1, 152064, 0x2d985877
+0, 49, 49, 1, 152064, 0xe6b92603
+0, 50, 50, 1, 152064, 0x102ac84f
+0, 51, 51, 1, 152064, 0xddaf709b
+0, 52, 52, 1, 152064, 0x48dfb25e
+0, 53, 53, 1, 152064, 0xf2acadbb
+0, 54, 54, 1, 152064, 0x647685f5
+0, 55, 55, 1, 152064, 0x893874c9
+0, 56, 56, 1, 152064, 0xdfd7ed77
+0, 57, 57, 1, 152064, 0x97b36277
+0, 58, 58, 1, 152064, 0x59f33282
+0, 59, 59, 1, 152064, 0xba5c6a0e
+0, 60, 60, 1, 152064, 0x7856ddf0
+0, 61, 61, 1, 152064, 0x74e5f095
+0, 62, 62, 1, 152064, 0x76167a60
+0, 63, 63, 1, 152064, 0xa6cf2255
+0, 64, 64, 1, 152064, 0x9f8b1446
+0, 65, 65, 1, 152064, 0xa775aa79
+0, 66, 66, 1, 152064, 0x5662a698
+0, 67, 67, 1, 152064, 0xe6321e5b
+0, 68, 68, 1, 152064, 0xdaea9a83
+0, 69, 69, 1, 152064, 0xd89d835f
+0, 70, 70, 1, 152064, 0x0b1503e2
+0, 71, 71, 1, 152064, 0x7fef6395
+0, 72, 72, 1, 152064, 0xc27273f2
+0, 73, 73, 1, 152064, 0xff9288fd
+0, 74, 74, 1, 152064, 0xb76aee35
+0, 75, 75, 1, 152064, 0xbd0dc4b2
+0, 76, 76, 1, 152064, 0x3085598e
+0, 77, 77, 1, 152064, 0x22e408f6
+0, 78, 78, 1, 152064, 0xc054866d
+0, 79, 79, 1, 152064, 0x881377f8
+0, 80, 80, 1, 152064, 0x0dd7311e
+0, 81, 81, 1, 152064, 0x627ea688
+0, 82, 82, 1, 152064, 0x95bbe693
+0, 83, 83, 1, 152064, 0x806c480f
+0, 84, 84, 1, 152064, 0x6feb3d47
+0, 85, 85, 1, 152064, 0x639f0a72
+0, 86, 86, 1, 152064, 0x4922909d
+0, 87, 87, 1, 152064, 0x44bbc195
+0, 88, 88, 1, 152064, 0xf119ca8f
+0, 89, 89, 1, 152064, 0x6f46e9c8
+0, 90, 90, 1, 152064, 0xd68e222a
+0, 91, 91, 1, 152064, 0xedc716eb
+0, 92, 92, 1, 152064, 0x090a7702
+0, 93, 93, 1, 152064, 0xc94eac7a
+0, 94, 94, 1, 152064, 0x629d8823
+0, 95, 95, 1, 152064, 0x30a51f8c
+0, 96, 96, 1, 152064, 0x4265666b
+0, 97, 97, 1, 152064, 0x766dfd25
+0, 98, 98, 1, 152064, 0x7dc37c52
+0, 99, 99, 1, 152064, 0x07c65fbe
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-brcm_freh9 b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-brcm_freh9
index 5b21b7f..44d5d1a 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-brcm_freh9
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-brcm_freh9
@@ -1,100 +1,101 @@
-0, 0, 152064, 0x9f9caf3c
-0, 3600, 152064, 0x68f285b1
-0, 7200, 152064, 0x28bd4987
-0, 10800, 152064, 0x79de6e48
-0, 14400, 152064, 0x48301bf9
-0, 18000, 152064, 0x2c9e516c
-0, 21600, 152064, 0xf774946a
-0, 25200, 152064, 0x36534317
-0, 28800, 152064, 0x98b7bd86
-0, 32400, 152064, 0x2aa3d50b
-0, 36000, 152064, 0xc4343429
-0, 39600, 152064, 0x276c5f04
-0, 43200, 152064, 0x042d2916
-0, 46800, 152064, 0x777ee739
-0, 50400, 152064, 0x1ce186d8
-0, 54000, 152064, 0x0ae5a447
-0, 57600, 152064, 0x179435a8
-0, 61200, 152064, 0x96d743b8
-0, 64800, 152064, 0x7dcc26b7
-0, 68400, 152064, 0x72c860c8
-0, 72000, 152064, 0x12a95052
-0, 75600, 152064, 0x1ed00304
-0, 79200, 152064, 0xf9f698be
-0, 82800, 152064, 0x768ef04d
-0, 86400, 152064, 0x873833ee
-0, 90000, 152064, 0x1b4a1e1e
-0, 93600, 152064, 0x67462224
-0, 97200, 152064, 0x0206612a
-0, 100800, 152064, 0xd203f197
-0, 104400, 152064, 0x5dc020b0
-0, 108000, 152064, 0xdaf2ba1c
-0, 111600, 152064, 0xad54e4b2
-0, 115200, 152064, 0x4273c281
-0, 118800, 152064, 0x0655817d
-0, 122400, 152064, 0xdea79e1c
-0, 126000, 152064, 0x60ae6d1e
-0, 129600, 152064, 0x45401d1b
-0, 133200, 152064, 0xc6b12160
-0, 136800, 152064, 0x163fbde9
-0, 140400, 152064, 0x91636a0c
-0, 144000, 152064, 0x442173a4
-0, 147600, 152064, 0x0f941379
-0, 151200, 152064, 0x0649caad
-0, 154800, 152064, 0x1238eaa4
-0, 158400, 152064, 0x86013d55
-0, 162000, 152064, 0xec33b550
-0, 165600, 152064, 0x4cc7b33d
-0, 169200, 152064, 0x4c93f8ab
-0, 172800, 152064, 0x0cf15a34
-0, 176400, 152064, 0x04b71770
-0, 180000, 152064, 0xf860cea8
-0, 183600, 152064, 0x77fb76a3
-0, 187200, 152064, 0xa494b27c
-0, 190800, 152064, 0xf7a0b0b2
-0, 194400, 152064, 0x4cae843b
-0, 198000, 152064, 0x590e6403
-0, 201600, 152064, 0xe439e63e
-0, 205200, 152064, 0xbeca5f92
-0, 208800, 152064, 0x31d9164f
-0, 212400, 152064, 0xedab54a9
-0, 216000, 152064, 0xd8e1de00
-0, 219600, 152064, 0xd04fe391
-0, 223200, 152064, 0xef6568b3
-0, 226800, 152064, 0x859a2811
-0, 230400, 152064, 0x9d5ffe6f
-0, 234000, 152064, 0x5a679908
-0, 237600, 152064, 0xc264a830
-0, 241200, 152064, 0xbfdf08c0
-0, 244800, 152064, 0x4fd68cb7
-0, 248400, 152064, 0x0a7b86f3
-0, 252000, 152064, 0xe4fe043b
-0, 255600, 152064, 0x8b186a22
-0, 259200, 152064, 0xf715765a
-0, 262800, 152064, 0xfd7b77e5
-0, 266400, 152064, 0x9e3fdd06
-0, 270000, 152064, 0xc8bac3fa
-0, 273600, 152064, 0x4e83449f
-0, 277200, 152064, 0xe5fefcff
-0, 280800, 152064, 0x89d77b09
-0, 284400, 152064, 0x77fd6f7e
-0, 288000, 152064, 0xa7ec356c
-0, 291600, 152064, 0x2000aa87
-0, 295200, 152064, 0xa9a1e267
-0, 298800, 152064, 0xf67c3fcc
-0, 302400, 152064, 0x10143acc
-0, 306000, 152064, 0xa5fa0476
-0, 309600, 152064, 0x2e8d8966
-0, 313200, 152064, 0x74ccbbde
-0, 316800, 152064, 0xf903b2cf
-0, 320400, 152064, 0x66a8d7ab
-0, 324000, 152064, 0x123e23e2
-0, 327600, 152064, 0x8bd70865
-0, 331200, 152064, 0x2b017249
-0, 334800, 152064, 0x17f1aba6
-0, 338400, 152064, 0x38368449
-0, 342000, 152064, 0x72ee1b69
-0, 345600, 152064, 0x0f1c6a1d
-0, 349200, 152064, 0xbeea0040
-0, 352800, 152064, 0x4a9e73b9
-0, 356400, 152064, 0x51a46120
+#tb 0: 1/25
+0, 0, 0, 1, 152064, 0x9f9caf3c
+0, 1, 1, 1, 152064, 0x68f285b1
+0, 2, 2, 1, 152064, 0x28bd4987
+0, 3, 3, 1, 152064, 0x79de6e48
+0, 4, 4, 1, 152064, 0x48301bf9
+0, 5, 5, 1, 152064, 0x2c9e516c
+0, 6, 6, 1, 152064, 0xf774946a
+0, 7, 7, 1, 152064, 0x36534317
+0, 8, 8, 1, 152064, 0x98b7bd86
+0, 9, 9, 1, 152064, 0x2aa3d50b
+0, 10, 10, 1, 152064, 0xc4343429
+0, 11, 11, 1, 152064, 0x276c5f04
+0, 12, 12, 1, 152064, 0x042d2916
+0, 13, 13, 1, 152064, 0x777ee739
+0, 14, 14, 1, 152064, 0x1ce186d8
+0, 15, 15, 1, 152064, 0x0ae5a447
+0, 16, 16, 1, 152064, 0x179435a8
+0, 17, 17, 1, 152064, 0x96d743b8
+0, 18, 18, 1, 152064, 0x7dcc26b7
+0, 19, 19, 1, 152064, 0x72c860c8
+0, 20, 20, 1, 152064, 0x12a95052
+0, 21, 21, 1, 152064, 0x1ed00304
+0, 22, 22, 1, 152064, 0xf9f698be
+0, 23, 23, 1, 152064, 0x768ef04d
+0, 24, 24, 1, 152064, 0x873833ee
+0, 25, 25, 1, 152064, 0x1b4a1e1e
+0, 26, 26, 1, 152064, 0x67462224
+0, 27, 27, 1, 152064, 0x0206612a
+0, 28, 28, 1, 152064, 0xd203f197
+0, 29, 29, 1, 152064, 0x5dc020b0
+0, 30, 30, 1, 152064, 0xdaf2ba1c
+0, 31, 31, 1, 152064, 0xad54e4b2
+0, 32, 32, 1, 152064, 0x4273c281
+0, 33, 33, 1, 152064, 0x0655817d
+0, 34, 34, 1, 152064, 0xdea79e1c
+0, 35, 35, 1, 152064, 0x60ae6d1e
+0, 36, 36, 1, 152064, 0x45401d1b
+0, 37, 37, 1, 152064, 0xc6b12160
+0, 38, 38, 1, 152064, 0x163fbde9
+0, 39, 39, 1, 152064, 0x91636a0c
+0, 40, 40, 1, 152064, 0x442173a4
+0, 41, 41, 1, 152064, 0x0f941379
+0, 42, 42, 1, 152064, 0x0649caad
+0, 43, 43, 1, 152064, 0x1238eaa4
+0, 44, 44, 1, 152064, 0x86013d55
+0, 45, 45, 1, 152064, 0xec33b550
+0, 46, 46, 1, 152064, 0x4cc7b33d
+0, 47, 47, 1, 152064, 0x4c93f8ab
+0, 48, 48, 1, 152064, 0x0cf15a34
+0, 49, 49, 1, 152064, 0x04b71770
+0, 50, 50, 1, 152064, 0xf860cea8
+0, 51, 51, 1, 152064, 0x77fb76a3
+0, 52, 52, 1, 152064, 0xa494b27c
+0, 53, 53, 1, 152064, 0xf7a0b0b2
+0, 54, 54, 1, 152064, 0x4cae843b
+0, 55, 55, 1, 152064, 0x590e6403
+0, 56, 56, 1, 152064, 0xe439e63e
+0, 57, 57, 1, 152064, 0xbeca5f92
+0, 58, 58, 1, 152064, 0x31d9164f
+0, 59, 59, 1, 152064, 0xedab54a9
+0, 60, 60, 1, 152064, 0xd8e1de00
+0, 61, 61, 1, 152064, 0xd04fe391
+0, 62, 62, 1, 152064, 0xef6568b3
+0, 63, 63, 1, 152064, 0x859a2811
+0, 64, 64, 1, 152064, 0x9d5ffe6f
+0, 65, 65, 1, 152064, 0x5a679908
+0, 66, 66, 1, 152064, 0xc264a830
+0, 67, 67, 1, 152064, 0xbfdf08c0
+0, 68, 68, 1, 152064, 0x4fd68cb7
+0, 69, 69, 1, 152064, 0x0a7b86f3
+0, 70, 70, 1, 152064, 0xe4fe043b
+0, 71, 71, 1, 152064, 0x8b186a22
+0, 72, 72, 1, 152064, 0xf715765a
+0, 73, 73, 1, 152064, 0xfd7b77e5
+0, 74, 74, 1, 152064, 0x9e3fdd06
+0, 75, 75, 1, 152064, 0xc8bac3fa
+0, 76, 76, 1, 152064, 0x4e83449f
+0, 77, 77, 1, 152064, 0xe5fefcff
+0, 78, 78, 1, 152064, 0x89d77b09
+0, 79, 79, 1, 152064, 0x77fd6f7e
+0, 80, 80, 1, 152064, 0xa7ec356c
+0, 81, 81, 1, 152064, 0x2000aa87
+0, 82, 82, 1, 152064, 0xa9a1e267
+0, 83, 83, 1, 152064, 0xf67c3fcc
+0, 84, 84, 1, 152064, 0x10143acc
+0, 85, 85, 1, 152064, 0xa5fa0476
+0, 86, 86, 1, 152064, 0x2e8d8966
+0, 87, 87, 1, 152064, 0x74ccbbde
+0, 88, 88, 1, 152064, 0xf903b2cf
+0, 89, 89, 1, 152064, 0x66a8d7ab
+0, 90, 90, 1, 152064, 0x123e23e2
+0, 91, 91, 1, 152064, 0x8bd70865
+0, 92, 92, 1, 152064, 0x2b017249
+0, 93, 93, 1, 152064, 0x17f1aba6
+0, 94, 94, 1, 152064, 0x38368449
+0, 95, 95, 1, 152064, 0x72ee1b69
+0, 96, 96, 1, 152064, 0x0f1c6a1d
+0, 97, 97, 1, 152064, 0xbeea0040
+0, 98, 98, 1, 152064, 0x4a9e73b9
+0, 99, 99, 1, 152064, 0x51a46120
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-freh12_b b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-freh12_b
index 12c1959..9455cc2 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-freh12_b
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-freh12_b
@@ -1,100 +1,101 @@
-0, 0, 152064, 0x9f9caf3c
-0, 3600, 152064, 0x0ff688a6
-0, 7200, 152064, 0x247d4215
-0, 10800, 152064, 0x6d075b1b
-0, 14400, 152064, 0x23893f77
-0, 18000, 152064, 0x46db7dfc
-0, 21600, 152064, 0x6438c4b9
-0, 25200, 152064, 0x1f468257
-0, 28800, 152064, 0xd534ff36
-0, 32400, 152064, 0xb230f7b8
-0, 36000, 152064, 0xd8f66983
-0, 39600, 152064, 0x2068b7a9
-0, 43200, 152064, 0xd5748d8c
-0, 46800, 152064, 0x1d701770
-0, 50400, 152064, 0xe505c973
-0, 54000, 152064, 0x0ae5a447
-0, 57600, 152064, 0x3cf356bc
-0, 61200, 152064, 0x7d735625
-0, 64800, 152064, 0x3ce6438f
-0, 68400, 152064, 0xef3d947c
-0, 72000, 152064, 0xa35872be
-0, 75600, 152064, 0xcb9d1a37
-0, 79200, 152064, 0x9ad4cda1
-0, 82800, 152064, 0xc8d00a24
-0, 86400, 152064, 0xadab390b
-0, 90000, 152064, 0x530837a5
-0, 93600, 152064, 0xfda73274
-0, 97200, 152064, 0x7a297022
-0, 100800, 152064, 0x0d5f16a1
-0, 104400, 152064, 0xb0453e15
-0, 108000, 152064, 0xdaf2ba1c
-0, 111600, 152064, 0x55e5f451
-0, 115200, 152064, 0x723ecbce
-0, 118800, 152064, 0xb8376dfa
-0, 122400, 152064, 0xf53d97b7
-0, 126000, 152064, 0x1e2065cb
-0, 129600, 152064, 0x79ab0d75
-0, 133200, 152064, 0xc5da27ed
-0, 136800, 152064, 0x37c9d744
-0, 140400, 152064, 0xa8ab8bc3
-0, 144000, 152064, 0xab16a630
-0, 147600, 152064, 0xbbd76705
-0, 151200, 152064, 0xe67b2032
-0, 154800, 152064, 0xe1e02979
-0, 158400, 152064, 0xe79260b2
-0, 162000, 152064, 0xec33b550
-0, 165600, 152064, 0x679cca25
-0, 169200, 152064, 0x464b0935
-0, 172800, 152064, 0xa4c36a2a
-0, 176400, 152064, 0xe9593764
-0, 180000, 152064, 0x10f9ff42
-0, 183600, 152064, 0x6518a6fa
-0, 187200, 152064, 0xd161e4f3
-0, 190800, 152064, 0xc9d9be11
-0, 194400, 152064, 0x0db78ff6
-0, 198000, 152064, 0xd47d7e0f
-0, 201600, 152064, 0xdf34e3a3
-0, 205200, 152064, 0x13b68bd6
-0, 208800, 152064, 0x90e845bd
-0, 212400, 152064, 0xb434883a
-0, 216000, 152064, 0xd8e1de00
-0, 219600, 152064, 0xc9a3df1f
-0, 223200, 152064, 0x01476f54
-0, 226800, 152064, 0xd52824a4
-0, 230400, 152064, 0x63d43662
-0, 234000, 152064, 0x40a90d0f
-0, 237600, 152064, 0x332b22eb
-0, 241200, 152064, 0x1c267e8c
-0, 244800, 152064, 0x9be230d3
-0, 248400, 152064, 0x0ca308e8
-0, 252000, 152064, 0xfb5c5fdd
-0, 255600, 152064, 0x0d386358
-0, 259200, 152064, 0x3c7148b3
-0, 262800, 152064, 0xc2c07dab
-0, 266400, 152064, 0x76bbf8eb
-0, 270000, 152064, 0xc8bac3fa
-0, 273600, 152064, 0x35ef5e12
-0, 277200, 152064, 0x5d1fea8d
-0, 280800, 152064, 0xafbb54ef
-0, 284400, 152064, 0xf5d3396e
-0, 288000, 152064, 0xc4f4f8eb
-0, 291600, 152064, 0x60a17fa1
-0, 295200, 152064, 0x8804cdf9
-0, 298800, 152064, 0x3227412f
-0, 302400, 152064, 0x130e5026
-0, 306000, 152064, 0xcb17344e
-0, 309600, 152064, 0x4f0dde70
-0, 313200, 152064, 0x57422405
-0, 316800, 152064, 0x48070e40
-0, 320400, 152064, 0x5c2f134d
-0, 324000, 152064, 0x123e23e2
-0, 327600, 152064, 0x393c1185
-0, 331200, 152064, 0x59919a69
-0, 334800, 152064, 0xc1dad5c4
-0, 338400, 152064, 0x49b8c9a9
-0, 342000, 152064, 0x8dab7b1c
-0, 345600, 152064, 0x3a63c0c0
-0, 349200, 152064, 0x224860bc
-0, 352800, 152064, 0xdc40c9b2
-0, 356400, 152064, 0xd3a0b8a1
+#tb 0: 1/25
+0, 0, 0, 1, 152064, 0x9f9caf3c
+0, 1, 1, 1, 152064, 0x0ff688a6
+0, 2, 2, 1, 152064, 0x247d4215
+0, 3, 3, 1, 152064, 0x6d075b1b
+0, 4, 4, 1, 152064, 0x23893f77
+0, 5, 5, 1, 152064, 0x46db7dfc
+0, 6, 6, 1, 152064, 0x6438c4b9
+0, 7, 7, 1, 152064, 0x1f468257
+0, 8, 8, 1, 152064, 0xd534ff36
+0, 9, 9, 1, 152064, 0xb230f7b8
+0, 10, 10, 1, 152064, 0xd8f66983
+0, 11, 11, 1, 152064, 0x2068b7a9
+0, 12, 12, 1, 152064, 0xd5748d8c
+0, 13, 13, 1, 152064, 0x1d701770
+0, 14, 14, 1, 152064, 0xe505c973
+0, 15, 15, 1, 152064, 0x0ae5a447
+0, 16, 16, 1, 152064, 0x3cf356bc
+0, 17, 17, 1, 152064, 0x7d735625
+0, 18, 18, 1, 152064, 0x3ce6438f
+0, 19, 19, 1, 152064, 0xef3d947c
+0, 20, 20, 1, 152064, 0xa35872be
+0, 21, 21, 1, 152064, 0xcb9d1a37
+0, 22, 22, 1, 152064, 0x9ad4cda1
+0, 23, 23, 1, 152064, 0xc8d00a24
+0, 24, 24, 1, 152064, 0xadab390b
+0, 25, 25, 1, 152064, 0x530837a5
+0, 26, 26, 1, 152064, 0xfda73274
+0, 27, 27, 1, 152064, 0x7a297022
+0, 28, 28, 1, 152064, 0x0d5f16a1
+0, 29, 29, 1, 152064, 0xb0453e15
+0, 30, 30, 1, 152064, 0xdaf2ba1c
+0, 31, 31, 1, 152064, 0x55e5f451
+0, 32, 32, 1, 152064, 0x723ecbce
+0, 33, 33, 1, 152064, 0xb8376dfa
+0, 34, 34, 1, 152064, 0xf53d97b7
+0, 35, 35, 1, 152064, 0x1e2065cb
+0, 36, 36, 1, 152064, 0x79ab0d75
+0, 37, 37, 1, 152064, 0xc5da27ed
+0, 38, 38, 1, 152064, 0x37c9d744
+0, 39, 39, 1, 152064, 0xa8ab8bc3
+0, 40, 40, 1, 152064, 0xab16a630
+0, 41, 41, 1, 152064, 0xbbd76705
+0, 42, 42, 1, 152064, 0xe67b2032
+0, 43, 43, 1, 152064, 0xe1e02979
+0, 44, 44, 1, 152064, 0xe79260b2
+0, 45, 45, 1, 152064, 0xec33b550
+0, 46, 46, 1, 152064, 0x679cca25
+0, 47, 47, 1, 152064, 0x464b0935
+0, 48, 48, 1, 152064, 0xa4c36a2a
+0, 49, 49, 1, 152064, 0xe9593764
+0, 50, 50, 1, 152064, 0x10f9ff42
+0, 51, 51, 1, 152064, 0x6518a6fa
+0, 52, 52, 1, 152064, 0xd161e4f3
+0, 53, 53, 1, 152064, 0xc9d9be11
+0, 54, 54, 1, 152064, 0x0db78ff6
+0, 55, 55, 1, 152064, 0xd47d7e0f
+0, 56, 56, 1, 152064, 0xdf34e3a3
+0, 57, 57, 1, 152064, 0x13b68bd6
+0, 58, 58, 1, 152064, 0x90e845bd
+0, 59, 59, 1, 152064, 0xb434883a
+0, 60, 60, 1, 152064, 0xd8e1de00
+0, 61, 61, 1, 152064, 0xc9a3df1f
+0, 62, 62, 1, 152064, 0x01476f54
+0, 63, 63, 1, 152064, 0xd52824a4
+0, 64, 64, 1, 152064, 0x63d43662
+0, 65, 65, 1, 152064, 0x40a90d0f
+0, 66, 66, 1, 152064, 0x332b22eb
+0, 67, 67, 1, 152064, 0x1c267e8c
+0, 68, 68, 1, 152064, 0x9be230d3
+0, 69, 69, 1, 152064, 0x0ca308e8
+0, 70, 70, 1, 152064, 0xfb5c5fdd
+0, 71, 71, 1, 152064, 0x0d386358
+0, 72, 72, 1, 152064, 0x3c7148b3
+0, 73, 73, 1, 152064, 0xc2c07dab
+0, 74, 74, 1, 152064, 0x76bbf8eb
+0, 75, 75, 1, 152064, 0xc8bac3fa
+0, 76, 76, 1, 152064, 0x35ef5e12
+0, 77, 77, 1, 152064, 0x5d1fea8d
+0, 78, 78, 1, 152064, 0xafbb54ef
+0, 79, 79, 1, 152064, 0xf5d3396e
+0, 80, 80, 1, 152064, 0xc4f4f8eb
+0, 81, 81, 1, 152064, 0x60a17fa1
+0, 82, 82, 1, 152064, 0x8804cdf9
+0, 83, 83, 1, 152064, 0x3227412f
+0, 84, 84, 1, 152064, 0x130e5026
+0, 85, 85, 1, 152064, 0xcb17344e
+0, 86, 86, 1, 152064, 0x4f0dde70
+0, 87, 87, 1, 152064, 0x57422405
+0, 88, 88, 1, 152064, 0x48070e40
+0, 89, 89, 1, 152064, 0x5c2f134d
+0, 90, 90, 1, 152064, 0x123e23e2
+0, 91, 91, 1, 152064, 0x393c1185
+0, 92, 92, 1, 152064, 0x59919a69
+0, 93, 93, 1, 152064, 0xc1dad5c4
+0, 94, 94, 1, 152064, 0x49b8c9a9
+0, 95, 95, 1, 152064, 0x8dab7b1c
+0, 96, 96, 1, 152064, 0x3a63c0c0
+0, 97, 97, 1, 152064, 0x224860bc
+0, 98, 98, 1, 152064, 0xdc40c9b2
+0, 99, 99, 1, 152064, 0xd3a0b8a1
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-freh1_b b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-freh1_b
index 4e35e13..c5c0b25 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-freh1_b
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-freh1_b
@@ -1,100 +1,101 @@
-0, 0, 152064, 0x42a3d9ce
-0, 3600, 152064, 0xa95cc2ed
-0, 7200, 152064, 0xc48f8fdc
-0, 10800, 152064, 0x1584b7e8
-0, 14400, 152064, 0xd6f34b7e
-0, 18000, 152064, 0xbb196ee4
-0, 21600, 152064, 0xdfe79cbd
-0, 25200, 152064, 0x023799b7
-0, 28800, 152064, 0x156b1932
-0, 32400, 152064, 0x6dd14765
-0, 36000, 152064, 0xd2bd86b9
-0, 39600, 152064, 0xee62c71d
-0, 43200, 152064, 0x60667d48
-0, 46800, 152064, 0x09df084c
-0, 50400, 152064, 0xc1a0b8d7
-0, 54000, 152064, 0x55adc538
-0, 57600, 152064, 0xf6d28a14
-0, 61200, 152064, 0x1adab322
-0, 64800, 152064, 0xa6c796aa
-0, 68400, 152064, 0x60d8dc6a
-0, 72000, 152064, 0x20f9c609
-0, 75600, 152064, 0x299f4059
-0, 79200, 152064, 0x93eb0fea
-0, 82800, 152064, 0x76e7547e
-0, 86400, 152064, 0xc4b76f90
-0, 90000, 152064, 0x4b7a85ea
-0, 93600, 152064, 0x2e138df4
-0, 97200, 152064, 0x7df1a421
-0, 100800, 152064, 0x0e9a1a3e
-0, 104400, 152064, 0x56124293
-0, 108000, 152064, 0x1faee8f7
-0, 111600, 152064, 0x7f551572
-0, 115200, 152064, 0x8974cbf0
-0, 118800, 152064, 0x1c5dc5e9
-0, 122400, 152064, 0x2498eb5b
-0, 126000, 152064, 0x861ed634
-0, 129600, 152064, 0x0e62a433
-0, 133200, 152064, 0xf3648cc0
-0, 136800, 152064, 0x69bc344b
-0, 140400, 152064, 0x797eaafe
-0, 144000, 152064, 0x722fbff8
-0, 147600, 152064, 0xa8895582
-0, 151200, 152064, 0xde1bcffb
-0, 154800, 152064, 0xf558ed3f
-0, 158400, 152064, 0xa5173e0e
-0, 162000, 152064, 0x6872d018
-0, 165600, 152064, 0x6af6c55d
-0, 169200, 152064, 0x7c6b1f26
-0, 172800, 152064, 0xa8086db3
-0, 176400, 152064, 0x70b762e1
-0, 180000, 152064, 0x85b7eb76
-0, 183600, 152064, 0x3a4393f1
-0, 187200, 152064, 0xdabdda42
-0, 190800, 152064, 0xbb84b84c
-0, 194400, 152064, 0xabe880d8
-0, 198000, 152064, 0xe7303cc5
-0, 201600, 152064, 0xecdcc142
-0, 205200, 152064, 0x591118db
-0, 208800, 152064, 0x37a715c6
-0, 212400, 152064, 0x9106221e
-0, 216000, 152064, 0xb1821a2e
-0, 219600, 152064, 0x3adeccdb
-0, 223200, 152064, 0xd4ac64a8
-0, 226800, 152064, 0x8f34134f
-0, 230400, 152064, 0x1f3cf03d
-0, 234000, 152064, 0x7b5da3b0
-0, 237600, 152064, 0x23f69e68
-0, 241200, 152064, 0x67e62093
-0, 244800, 152064, 0xf226d12e
-0, 248400, 152064, 0x2eb08a1f
-0, 252000, 152064, 0x5bb70c54
-0, 255600, 152064, 0x2edb3578
-0, 259200, 152064, 0x9d0c1b30
-0, 262800, 152064, 0xd8266732
-0, 266400, 152064, 0xad67cd45
-0, 270000, 152064, 0x7a11d3cc
-0, 273600, 152064, 0xac534ec1
-0, 277200, 152064, 0x7ff6ba17
-0, 280800, 152064, 0xf9741b77
-0, 284400, 152064, 0x318d25fa
-0, 288000, 152064, 0xff4ae686
-0, 291600, 152064, 0x26a05ae2
-0, 295200, 152064, 0x95619a34
-0, 298800, 152064, 0xec2b1136
-0, 302400, 152064, 0xf93ebeca
-0, 306000, 152064, 0xd8237aaa
-0, 309600, 152064, 0x1c362a05
-0, 313200, 152064, 0x6fc74faa
-0, 316800, 152064, 0x875e5b67
-0, 320400, 152064, 0xc04093be
-0, 324000, 152064, 0x4c2340a1
-0, 327600, 152064, 0x7af99e63
-0, 331200, 152064, 0xf5b89a4e
-0, 334800, 152064, 0xb7759e48
-0, 338400, 152064, 0x61a15c06
-0, 342000, 152064, 0x91a5ae4c
-0, 345600, 152064, 0x6aedf226
-0, 349200, 152064, 0x870dbf36
-0, 352800, 152064, 0x814d04a3
-0, 356400, 152064, 0xd5a30892
+#tb 0: 1/25
+0, 0, 0, 1, 152064, 0x42a3d9ce
+0, 1, 1, 1, 152064, 0xa95cc2ed
+0, 2, 2, 1, 152064, 0xc48f8fdc
+0, 3, 3, 1, 152064, 0x1584b7e8
+0, 4, 4, 1, 152064, 0xd6f34b7e
+0, 5, 5, 1, 152064, 0xbb196ee4
+0, 6, 6, 1, 152064, 0xdfe79cbd
+0, 7, 7, 1, 152064, 0x023799b7
+0, 8, 8, 1, 152064, 0x156b1932
+0, 9, 9, 1, 152064, 0x6dd14765
+0, 10, 10, 1, 152064, 0xd2bd86b9
+0, 11, 11, 1, 152064, 0xee62c71d
+0, 12, 12, 1, 152064, 0x60667d48
+0, 13, 13, 1, 152064, 0x09df084c
+0, 14, 14, 1, 152064, 0xc1a0b8d7
+0, 15, 15, 1, 152064, 0x55adc538
+0, 16, 16, 1, 152064, 0xf6d28a14
+0, 17, 17, 1, 152064, 0x1adab322
+0, 18, 18, 1, 152064, 0xa6c796aa
+0, 19, 19, 1, 152064, 0x60d8dc6a
+0, 20, 20, 1, 152064, 0x20f9c609
+0, 21, 21, 1, 152064, 0x299f4059
+0, 22, 22, 1, 152064, 0x93eb0fea
+0, 23, 23, 1, 152064, 0x76e7547e
+0, 24, 24, 1, 152064, 0xc4b76f90
+0, 25, 25, 1, 152064, 0x4b7a85ea
+0, 26, 26, 1, 152064, 0x2e138df4
+0, 27, 27, 1, 152064, 0x7df1a421
+0, 28, 28, 1, 152064, 0x0e9a1a3e
+0, 29, 29, 1, 152064, 0x56124293
+0, 30, 30, 1, 152064, 0x1faee8f7
+0, 31, 31, 1, 152064, 0x7f551572
+0, 32, 32, 1, 152064, 0x8974cbf0
+0, 33, 33, 1, 152064, 0x1c5dc5e9
+0, 34, 34, 1, 152064, 0x2498eb5b
+0, 35, 35, 1, 152064, 0x861ed634
+0, 36, 36, 1, 152064, 0x0e62a433
+0, 37, 37, 1, 152064, 0xf3648cc0
+0, 38, 38, 1, 152064, 0x69bc344b
+0, 39, 39, 1, 152064, 0x797eaafe
+0, 40, 40, 1, 152064, 0x722fbff8
+0, 41, 41, 1, 152064, 0xa8895582
+0, 42, 42, 1, 152064, 0xde1bcffb
+0, 43, 43, 1, 152064, 0xf558ed3f
+0, 44, 44, 1, 152064, 0xa5173e0e
+0, 45, 45, 1, 152064, 0x6872d018
+0, 46, 46, 1, 152064, 0x6af6c55d
+0, 47, 47, 1, 152064, 0x7c6b1f26
+0, 48, 48, 1, 152064, 0xa8086db3
+0, 49, 49, 1, 152064, 0x70b762e1
+0, 50, 50, 1, 152064, 0x85b7eb76
+0, 51, 51, 1, 152064, 0x3a4393f1
+0, 52, 52, 1, 152064, 0xdabdda42
+0, 53, 53, 1, 152064, 0xbb84b84c
+0, 54, 54, 1, 152064, 0xabe880d8
+0, 55, 55, 1, 152064, 0xe7303cc5
+0, 56, 56, 1, 152064, 0xecdcc142
+0, 57, 57, 1, 152064, 0x591118db
+0, 58, 58, 1, 152064, 0x37a715c6
+0, 59, 59, 1, 152064, 0x9106221e
+0, 60, 60, 1, 152064, 0xb1821a2e
+0, 61, 61, 1, 152064, 0x3adeccdb
+0, 62, 62, 1, 152064, 0xd4ac64a8
+0, 63, 63, 1, 152064, 0x8f34134f
+0, 64, 64, 1, 152064, 0x1f3cf03d
+0, 65, 65, 1, 152064, 0x7b5da3b0
+0, 66, 66, 1, 152064, 0x23f69e68
+0, 67, 67, 1, 152064, 0x67e62093
+0, 68, 68, 1, 152064, 0xf226d12e
+0, 69, 69, 1, 152064, 0x2eb08a1f
+0, 70, 70, 1, 152064, 0x5bb70c54
+0, 71, 71, 1, 152064, 0x2edb3578
+0, 72, 72, 1, 152064, 0x9d0c1b30
+0, 73, 73, 1, 152064, 0xd8266732
+0, 74, 74, 1, 152064, 0xad67cd45
+0, 75, 75, 1, 152064, 0x7a11d3cc
+0, 76, 76, 1, 152064, 0xac534ec1
+0, 77, 77, 1, 152064, 0x7ff6ba17
+0, 78, 78, 1, 152064, 0xf9741b77
+0, 79, 79, 1, 152064, 0x318d25fa
+0, 80, 80, 1, 152064, 0xff4ae686
+0, 81, 81, 1, 152064, 0x26a05ae2
+0, 82, 82, 1, 152064, 0x95619a34
+0, 83, 83, 1, 152064, 0xec2b1136
+0, 84, 84, 1, 152064, 0xf93ebeca
+0, 85, 85, 1, 152064, 0xd8237aaa
+0, 86, 86, 1, 152064, 0x1c362a05
+0, 87, 87, 1, 152064, 0x6fc74faa
+0, 88, 88, 1, 152064, 0x875e5b67
+0, 89, 89, 1, 152064, 0xc04093be
+0, 90, 90, 1, 152064, 0x4c2340a1
+0, 91, 91, 1, 152064, 0x7af99e63
+0, 92, 92, 1, 152064, 0xf5b89a4e
+0, 93, 93, 1, 152064, 0xb7759e48
+0, 94, 94, 1, 152064, 0x61a15c06
+0, 95, 95, 1, 152064, 0x91a5ae4c
+0, 96, 96, 1, 152064, 0x6aedf226
+0, 97, 97, 1, 152064, 0x870dbf36
+0, 98, 98, 1, 152064, 0x814d04a3
+0, 99, 99, 1, 152064, 0xd5a30892
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-freh2_b b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-freh2_b
index ac9a48c..ff12025 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-freh2_b
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-freh2_b
@@ -1,100 +1,101 @@
-0, 0, 152064, 0x1668b41a
-0, 3600, 152064, 0x953ca7fb
-0, 7200, 152064, 0x3e38bc6e
-0, 10800, 152064, 0x18dff6cc
-0, 14400, 152064, 0x03105f7a
-0, 18000, 152064, 0x6fe79efb
-0, 21600, 152064, 0xbd4ccb6f
-0, 25200, 152064, 0xaf398a10
-0, 28800, 152064, 0x4f281075
-0, 32400, 152064, 0x88f63791
-0, 36000, 152064, 0x7500b606
-0, 39600, 152064, 0xebebd6e6
-0, 43200, 152064, 0x3ed7c35e
-0, 46800, 152064, 0xc95826d6
-0, 50400, 152064, 0x0989ab63
-0, 54000, 152064, 0xddd5d22b
-0, 57600, 152064, 0x11683b8a
-0, 61200, 152064, 0x5ce36d50
-0, 64800, 152064, 0xa5185ccf
-0, 68400, 152064, 0xf47583b5
-0, 72000, 152064, 0xac6e82b6
-0, 75600, 152064, 0xf8dc25c0
-0, 79200, 152064, 0x5a6aba8e
-0, 82800, 152064, 0x43790f6d
-0, 86400, 152064, 0x787c4377
-0, 90000, 152064, 0xe6833159
-0, 93600, 152064, 0xe5c21131
-0, 97200, 152064, 0x16ae69bb
-0, 100800, 152064, 0x754fcc9e
-0, 104400, 152064, 0x71aaf1e1
-0, 108000, 152064, 0xce9de9ee
-0, 111600, 152064, 0x05e6d832
-0, 115200, 152064, 0x5773b413
-0, 118800, 152064, 0xe518881c
-0, 122400, 152064, 0xe248bce9
-0, 126000, 152064, 0x421e8c0d
-0, 129600, 152064, 0x30135143
-0, 133200, 152064, 0xf02347f4
-0, 136800, 152064, 0x3fa71a0e
-0, 140400, 152064, 0x2c14d955
-0, 144000, 152064, 0x18b2d558
-0, 147600, 152064, 0x54cb7fa2
-0, 151200, 152064, 0x90ae2332
-0, 154800, 152064, 0x7957129a
-0, 158400, 152064, 0x6c9b463e
-0, 162000, 152064, 0x8c44e126
-0, 165600, 152064, 0xde3ba475
-0, 169200, 152064, 0x9823e3ed
-0, 172800, 152064, 0x3ce03b21
-0, 176400, 152064, 0x930007a2
-0, 180000, 152064, 0x6f94bf67
-0, 183600, 152064, 0x3e113ce9
-0, 187200, 152064, 0xa31c8828
-0, 190800, 152064, 0xe65260e0
-0, 194400, 152064, 0x4c612620
-0, 198000, 152064, 0xdc41f17f
-0, 201600, 152064, 0x6d3f6a84
-0, 205200, 152064, 0xfb55e9e9
-0, 208800, 152064, 0x21e2c8b5
-0, 212400, 152064, 0x2d0939a9
-0, 216000, 152064, 0xe1f422d2
-0, 219600, 152064, 0xab0ad4a3
-0, 223200, 152064, 0x948f46df
-0, 226800, 152064, 0x61f50c16
-0, 230400, 152064, 0x7f5edb05
-0, 234000, 152064, 0x8d8c4782
-0, 237600, 152064, 0xe8644529
-0, 241200, 152064, 0x1e7ce779
-0, 244800, 152064, 0x22f355a9
-0, 248400, 152064, 0x4dd736d4
-0, 252000, 152064, 0x3d968c63
-0, 255600, 152064, 0xa629c711
-0, 259200, 152064, 0xae87c4c6
-0, 262800, 152064, 0xcd482dd2
-0, 266400, 152064, 0x6bbbbd25
-0, 270000, 152064, 0x4f0ad3d2
-0, 273600, 152064, 0x66052e88
-0, 277200, 152064, 0xa09dff03
-0, 280800, 152064, 0xb3837263
-0, 284400, 152064, 0x3c91fdde
-0, 288000, 152064, 0x4d9309a9
-0, 291600, 152064, 0x6b624164
-0, 295200, 152064, 0xaa425ecb
-0, 298800, 152064, 0x37aec7c9
-0, 302400, 152064, 0xf4b3d359
-0, 306000, 152064, 0x85d3af2b
-0, 309600, 152064, 0xe5c1f190
-0, 313200, 152064, 0x8cb00e09
-0, 316800, 152064, 0x59406ebc
-0, 320400, 152064, 0xd7ac351f
-0, 324000, 152064, 0x998238b6
-0, 327600, 152064, 0x8e89d064
-0, 331200, 152064, 0x644223c5
-0, 334800, 152064, 0x90ad366f
-0, 338400, 152064, 0x40a12122
-0, 342000, 152064, 0x3045024c
-0, 345600, 152064, 0x58673cfb
-0, 349200, 152064, 0x567cf1fe
-0, 352800, 152064, 0x2d236e41
-0, 356400, 152064, 0xc493577d
+#tb 0: 1/25
+0, 0, 0, 1, 152064, 0x1668b41a
+0, 1, 1, 1, 152064, 0x953ca7fb
+0, 2, 2, 1, 152064, 0x3e38bc6e
+0, 3, 3, 1, 152064, 0x18dff6cc
+0, 4, 4, 1, 152064, 0x03105f7a
+0, 5, 5, 1, 152064, 0x6fe79efb
+0, 6, 6, 1, 152064, 0xbd4ccb6f
+0, 7, 7, 1, 152064, 0xaf398a10
+0, 8, 8, 1, 152064, 0x4f281075
+0, 9, 9, 1, 152064, 0x88f63791
+0, 10, 10, 1, 152064, 0x7500b606
+0, 11, 11, 1, 152064, 0xebebd6e6
+0, 12, 12, 1, 152064, 0x3ed7c35e
+0, 13, 13, 1, 152064, 0xc95826d6
+0, 14, 14, 1, 152064, 0x0989ab63
+0, 15, 15, 1, 152064, 0xddd5d22b
+0, 16, 16, 1, 152064, 0x11683b8a
+0, 17, 17, 1, 152064, 0x5ce36d50
+0, 18, 18, 1, 152064, 0xa5185ccf
+0, 19, 19, 1, 152064, 0xf47583b5
+0, 20, 20, 1, 152064, 0xac6e82b6
+0, 21, 21, 1, 152064, 0xf8dc25c0
+0, 22, 22, 1, 152064, 0x5a6aba8e
+0, 23, 23, 1, 152064, 0x43790f6d
+0, 24, 24, 1, 152064, 0x787c4377
+0, 25, 25, 1, 152064, 0xe6833159
+0, 26, 26, 1, 152064, 0xe5c21131
+0, 27, 27, 1, 152064, 0x16ae69bb
+0, 28, 28, 1, 152064, 0x754fcc9e
+0, 29, 29, 1, 152064, 0x71aaf1e1
+0, 30, 30, 1, 152064, 0xce9de9ee
+0, 31, 31, 1, 152064, 0x05e6d832
+0, 32, 32, 1, 152064, 0x5773b413
+0, 33, 33, 1, 152064, 0xe518881c
+0, 34, 34, 1, 152064, 0xe248bce9
+0, 35, 35, 1, 152064, 0x421e8c0d
+0, 36, 36, 1, 152064, 0x30135143
+0, 37, 37, 1, 152064, 0xf02347f4
+0, 38, 38, 1, 152064, 0x3fa71a0e
+0, 39, 39, 1, 152064, 0x2c14d955
+0, 40, 40, 1, 152064, 0x18b2d558
+0, 41, 41, 1, 152064, 0x54cb7fa2
+0, 42, 42, 1, 152064, 0x90ae2332
+0, 43, 43, 1, 152064, 0x7957129a
+0, 44, 44, 1, 152064, 0x6c9b463e
+0, 45, 45, 1, 152064, 0x8c44e126
+0, 46, 46, 1, 152064, 0xde3ba475
+0, 47, 47, 1, 152064, 0x9823e3ed
+0, 48, 48, 1, 152064, 0x3ce03b21
+0, 49, 49, 1, 152064, 0x930007a2
+0, 50, 50, 1, 152064, 0x6f94bf67
+0, 51, 51, 1, 152064, 0x3e113ce9
+0, 52, 52, 1, 152064, 0xa31c8828
+0, 53, 53, 1, 152064, 0xe65260e0
+0, 54, 54, 1, 152064, 0x4c612620
+0, 55, 55, 1, 152064, 0xdc41f17f
+0, 56, 56, 1, 152064, 0x6d3f6a84
+0, 57, 57, 1, 152064, 0xfb55e9e9
+0, 58, 58, 1, 152064, 0x21e2c8b5
+0, 59, 59, 1, 152064, 0x2d0939a9
+0, 60, 60, 1, 152064, 0xe1f422d2
+0, 61, 61, 1, 152064, 0xab0ad4a3
+0, 62, 62, 1, 152064, 0x948f46df
+0, 63, 63, 1, 152064, 0x61f50c16
+0, 64, 64, 1, 152064, 0x7f5edb05
+0, 65, 65, 1, 152064, 0x8d8c4782
+0, 66, 66, 1, 152064, 0xe8644529
+0, 67, 67, 1, 152064, 0x1e7ce779
+0, 68, 68, 1, 152064, 0x22f355a9
+0, 69, 69, 1, 152064, 0x4dd736d4
+0, 70, 70, 1, 152064, 0x3d968c63
+0, 71, 71, 1, 152064, 0xa629c711
+0, 72, 72, 1, 152064, 0xae87c4c6
+0, 73, 73, 1, 152064, 0xcd482dd2
+0, 74, 74, 1, 152064, 0x6bbbbd25
+0, 75, 75, 1, 152064, 0x4f0ad3d2
+0, 76, 76, 1, 152064, 0x66052e88
+0, 77, 77, 1, 152064, 0xa09dff03
+0, 78, 78, 1, 152064, 0xb3837263
+0, 79, 79, 1, 152064, 0x3c91fdde
+0, 80, 80, 1, 152064, 0x4d9309a9
+0, 81, 81, 1, 152064, 0x6b624164
+0, 82, 82, 1, 152064, 0xaa425ecb
+0, 83, 83, 1, 152064, 0x37aec7c9
+0, 84, 84, 1, 152064, 0xf4b3d359
+0, 85, 85, 1, 152064, 0x85d3af2b
+0, 86, 86, 1, 152064, 0xe5c1f190
+0, 87, 87, 1, 152064, 0x8cb00e09
+0, 88, 88, 1, 152064, 0x59406ebc
+0, 89, 89, 1, 152064, 0xd7ac351f
+0, 90, 90, 1, 152064, 0x998238b6
+0, 91, 91, 1, 152064, 0x8e89d064
+0, 92, 92, 1, 152064, 0x644223c5
+0, 93, 93, 1, 152064, 0x90ad366f
+0, 94, 94, 1, 152064, 0x40a12122
+0, 95, 95, 1, 152064, 0x3045024c
+0, 96, 96, 1, 152064, 0x58673cfb
+0, 97, 97, 1, 152064, 0x567cf1fe
+0, 98, 98, 1, 152064, 0x2d236e41
+0, 99, 99, 1, 152064, 0xc493577d
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-freh6 b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-freh6
index 4dd3afd..c769038 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-freh6
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-freh6
@@ -1,100 +1,101 @@
-0, 0, 152064, 0x3b21d6cd
-0, 3600, 152064, 0xc32088c6
-0, 7200, 152064, 0x65a64cee
-0, 10800, 152064, 0x0bd45a5b
-0, 14400, 152064, 0xb2210d4d
-0, 18000, 152064, 0xf5b15527
-0, 21600, 152064, 0x806572ad
-0, 25200, 152064, 0x6ecb1fc8
-0, 28800, 152064, 0xc25e96d5
-0, 32400, 152064, 0x5593b825
-0, 36000, 152064, 0xf3be1cff
-0, 39600, 152064, 0xa9155072
-0, 43200, 152064, 0xd5552e26
-0, 46800, 152064, 0x7bf0dbee
-0, 50400, 152064, 0x998b4911
-0, 54000, 152064, 0xcc71bbe0
-0, 57600, 152064, 0x602415b8
-0, 61200, 152064, 0xcfff37cf
-0, 64800, 152064, 0x7cf824a8
-0, 68400, 152064, 0x34816ee5
-0, 72000, 152064, 0x1480540c
-0, 75600, 152064, 0xc2351aaf
-0, 79200, 152064, 0x3b8eac9f
-0, 82800, 152064, 0x92a8faf8
-0, 86400, 152064, 0x7b6121c8
-0, 90000, 152064, 0xe73a3bac
-0, 93600, 152064, 0xcd6e1e36
-0, 97200, 152064, 0xb24660b1
-0, 100800, 152064, 0xa290ec25
-0, 104400, 152064, 0x308915ff
-0, 108000, 152064, 0x1e8dd4db
-0, 111600, 152064, 0x1372f2e0
-0, 115200, 152064, 0xa07cc1d0
-0, 118800, 152064, 0x34bb872c
-0, 122400, 152064, 0x59e6a565
-0, 126000, 152064, 0x9a097932
-0, 129600, 152064, 0x938f2e20
-0, 133200, 152064, 0x59a8157d
-0, 136800, 152064, 0x5cacd404
-0, 140400, 152064, 0xdad068f5
-0, 144000, 152064, 0x7ba67d47
-0, 147600, 152064, 0xc2a11e2d
-0, 151200, 152064, 0xd37fdef7
-0, 154800, 152064, 0x19a3f80a
-0, 158400, 152064, 0x7ec7426a
-0, 162000, 152064, 0x8ffedb61
-0, 165600, 152064, 0x82aebdd0
-0, 169200, 152064, 0xdfc920cc
-0, 172800, 152064, 0x2a467698
-0, 176400, 152064, 0xd08a37d5
-0, 180000, 152064, 0xe606e66a
-0, 183600, 152064, 0x0e7b8bd8
-0, 187200, 152064, 0xf983c732
-0, 190800, 152064, 0x9b82c2e7
-0, 194400, 152064, 0xa990a47e
-0, 198000, 152064, 0x2d5679f1
-0, 201600, 152064, 0x7f1c0201
-0, 205200, 152064, 0xc38b709d
-0, 208800, 152064, 0x040246d8
-0, 212400, 152064, 0xbc856021
-0, 216000, 152064, 0x81e01a78
-0, 219600, 152064, 0xaff1e7f1
-0, 223200, 152064, 0x1fee7715
-0, 226800, 152064, 0x65053711
-0, 230400, 152064, 0x238a0118
-0, 234000, 152064, 0x563491b4
-0, 237600, 152064, 0x5974a6cc
-0, 241200, 152064, 0xd8682c35
-0, 244800, 152064, 0x85c49e96
-0, 248400, 152064, 0x29486faa
-0, 252000, 152064, 0x1a4f0579
-0, 255600, 152064, 0x6ab86c2f
-0, 259200, 152064, 0x36a36d2b
-0, 262800, 152064, 0x3bd77543
-0, 266400, 152064, 0x8fbddc41
-0, 270000, 152064, 0xccc6e0a5
-0, 273600, 152064, 0x00a9539e
-0, 277200, 152064, 0x07ba0714
-0, 280800, 152064, 0xbab2735d
-0, 284400, 152064, 0x79cb5ba0
-0, 288000, 152064, 0xdbcc1c92
-0, 291600, 152064, 0xffec952c
-0, 295200, 152064, 0xc31ac68e
-0, 298800, 152064, 0x24293eb9
-0, 302400, 152064, 0x7b9b2cb4
-0, 306000, 152064, 0x9dd4fe95
-0, 309600, 152064, 0xb62e8baf
-0, 313200, 152064, 0x9fefc174
-0, 316800, 152064, 0xe027c24e
-0, 320400, 152064, 0xe38adc70
-0, 324000, 152064, 0xc7bf536f
-0, 327600, 152064, 0x4448f330
-0, 331200, 152064, 0x4dad5339
-0, 334800, 152064, 0x48fbab15
-0, 338400, 152064, 0xe6c97b2c
-0, 342000, 152064, 0x3c3829ee
-0, 345600, 152064, 0x927772c0
-0, 349200, 152064, 0xbb0f0ef4
-0, 352800, 152064, 0xe65780a7
-0, 356400, 152064, 0xaf8f6d72
+#tb 0: 1/25
+0, 0, 0, 1, 152064, 0x3b21d6cd
+0, 1, 1, 1, 152064, 0xc32088c6
+0, 2, 2, 1, 152064, 0x65a64cee
+0, 3, 3, 1, 152064, 0x0bd45a5b
+0, 4, 4, 1, 152064, 0xb2210d4d
+0, 5, 5, 1, 152064, 0xf5b15527
+0, 6, 6, 1, 152064, 0x806572ad
+0, 7, 7, 1, 152064, 0x6ecb1fc8
+0, 8, 8, 1, 152064, 0xc25e96d5
+0, 9, 9, 1, 152064, 0x5593b825
+0, 10, 10, 1, 152064, 0xf3be1cff
+0, 11, 11, 1, 152064, 0xa9155072
+0, 12, 12, 1, 152064, 0xd5552e26
+0, 13, 13, 1, 152064, 0x7bf0dbee
+0, 14, 14, 1, 152064, 0x998b4911
+0, 15, 15, 1, 152064, 0xcc71bbe0
+0, 16, 16, 1, 152064, 0x602415b8
+0, 17, 17, 1, 152064, 0xcfff37cf
+0, 18, 18, 1, 152064, 0x7cf824a8
+0, 19, 19, 1, 152064, 0x34816ee5
+0, 20, 20, 1, 152064, 0x1480540c
+0, 21, 21, 1, 152064, 0xc2351aaf
+0, 22, 22, 1, 152064, 0x3b8eac9f
+0, 23, 23, 1, 152064, 0x92a8faf8
+0, 24, 24, 1, 152064, 0x7b6121c8
+0, 25, 25, 1, 152064, 0xe73a3bac
+0, 26, 26, 1, 152064, 0xcd6e1e36
+0, 27, 27, 1, 152064, 0xb24660b1
+0, 28, 28, 1, 152064, 0xa290ec25
+0, 29, 29, 1, 152064, 0x308915ff
+0, 30, 30, 1, 152064, 0x1e8dd4db
+0, 31, 31, 1, 152064, 0x1372f2e0
+0, 32, 32, 1, 152064, 0xa07cc1d0
+0, 33, 33, 1, 152064, 0x34bb872c
+0, 34, 34, 1, 152064, 0x59e6a565
+0, 35, 35, 1, 152064, 0x9a097932
+0, 36, 36, 1, 152064, 0x938f2e20
+0, 37, 37, 1, 152064, 0x59a8157d
+0, 38, 38, 1, 152064, 0x5cacd404
+0, 39, 39, 1, 152064, 0xdad068f5
+0, 40, 40, 1, 152064, 0x7ba67d47
+0, 41, 41, 1, 152064, 0xc2a11e2d
+0, 42, 42, 1, 152064, 0xd37fdef7
+0, 43, 43, 1, 152064, 0x19a3f80a
+0, 44, 44, 1, 152064, 0x7ec7426a
+0, 45, 45, 1, 152064, 0x8ffedb61
+0, 46, 46, 1, 152064, 0x82aebdd0
+0, 47, 47, 1, 152064, 0xdfc920cc
+0, 48, 48, 1, 152064, 0x2a467698
+0, 49, 49, 1, 152064, 0xd08a37d5
+0, 50, 50, 1, 152064, 0xe606e66a
+0, 51, 51, 1, 152064, 0x0e7b8bd8
+0, 52, 52, 1, 152064, 0xf983c732
+0, 53, 53, 1, 152064, 0x9b82c2e7
+0, 54, 54, 1, 152064, 0xa990a47e
+0, 55, 55, 1, 152064, 0x2d5679f1
+0, 56, 56, 1, 152064, 0x7f1c0201
+0, 57, 57, 1, 152064, 0xc38b709d
+0, 58, 58, 1, 152064, 0x040246d8
+0, 59, 59, 1, 152064, 0xbc856021
+0, 60, 60, 1, 152064, 0x81e01a78
+0, 61, 61, 1, 152064, 0xaff1e7f1
+0, 62, 62, 1, 152064, 0x1fee7715
+0, 63, 63, 1, 152064, 0x65053711
+0, 64, 64, 1, 152064, 0x238a0118
+0, 65, 65, 1, 152064, 0x563491b4
+0, 66, 66, 1, 152064, 0x5974a6cc
+0, 67, 67, 1, 152064, 0xd8682c35
+0, 68, 68, 1, 152064, 0x85c49e96
+0, 69, 69, 1, 152064, 0x29486faa
+0, 70, 70, 1, 152064, 0x1a4f0579
+0, 71, 71, 1, 152064, 0x6ab86c2f
+0, 72, 72, 1, 152064, 0x36a36d2b
+0, 73, 73, 1, 152064, 0x3bd77543
+0, 74, 74, 1, 152064, 0x8fbddc41
+0, 75, 75, 1, 152064, 0xccc6e0a5
+0, 76, 76, 1, 152064, 0x00a9539e
+0, 77, 77, 1, 152064, 0x07ba0714
+0, 78, 78, 1, 152064, 0xbab2735d
+0, 79, 79, 1, 152064, 0x79cb5ba0
+0, 80, 80, 1, 152064, 0xdbcc1c92
+0, 81, 81, 1, 152064, 0xffec952c
+0, 82, 82, 1, 152064, 0xc31ac68e
+0, 83, 83, 1, 152064, 0x24293eb9
+0, 84, 84, 1, 152064, 0x7b9b2cb4
+0, 85, 85, 1, 152064, 0x9dd4fe95
+0, 86, 86, 1, 152064, 0xb62e8baf
+0, 87, 87, 1, 152064, 0x9fefc174
+0, 88, 88, 1, 152064, 0xe027c24e
+0, 89, 89, 1, 152064, 0xe38adc70
+0, 90, 90, 1, 152064, 0xc7bf536f
+0, 91, 91, 1, 152064, 0x4448f330
+0, 92, 92, 1, 152064, 0x4dad5339
+0, 93, 93, 1, 152064, 0x48fbab15
+0, 94, 94, 1, 152064, 0xe6c97b2c
+0, 95, 95, 1, 152064, 0x3c3829ee
+0, 96, 96, 1, 152064, 0x927772c0
+0, 97, 97, 1, 152064, 0xbb0f0ef4
+0, 98, 98, 1, 152064, 0xe65780a7
+0, 99, 99, 1, 152064, 0xaf8f6d72
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-freh7_b b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-freh7_b
index 8c397f2..519c346 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-freh7_b
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-freh7_b
@@ -1,100 +1,101 @@
-0, 0, 152064, 0x89f2e8d5
-0, 3600, 152064, 0x35b99397
-0, 7200, 152064, 0x6ef46744
-0, 10800, 152064, 0xec4d6c1c
-0, 14400, 152064, 0xad6e0c70
-0, 18000, 152064, 0x2db534b3
-0, 21600, 152064, 0xcbd25ddd
-0, 25200, 152064, 0xd90708b4
-0, 28800, 152064, 0xc2aa52df
-0, 32400, 152064, 0xbcfc84dc
-0, 36000, 152064, 0xa5a6d269
-0, 39600, 152064, 0x27220ce9
-0, 43200, 152064, 0xf075ee6d
-0, 46800, 152064, 0x9fd3c2ac
-0, 50400, 152064, 0xcba24c2d
-0, 54000, 152064, 0x41cd9441
-0, 57600, 152064, 0x0126efa3
-0, 61200, 152064, 0xf62112af
-0, 64800, 152064, 0x35aff50f
-0, 68400, 152064, 0xcb0b276f
-0, 72000, 152064, 0xc7ef0214
-0, 75600, 152064, 0x7f78d387
-0, 79200, 152064, 0x266c673d
-0, 82800, 152064, 0x1d39c073
-0, 86400, 152064, 0x6a3ae455
-0, 90000, 152064, 0xe4ce0230
-0, 93600, 152064, 0x7f95e87b
-0, 97200, 152064, 0x7c552236
-0, 100800, 152064, 0x24c799b9
-0, 104400, 152064, 0x5042d974
-0, 108000, 152064, 0xe934a5b8
-0, 111600, 152064, 0x6d59c884
-0, 115200, 152064, 0xd00f7fdb
-0, 118800, 152064, 0x62ac3ebd
-0, 122400, 152064, 0xb40a6c25
-0, 126000, 152064, 0x8706188c
-0, 129600, 152064, 0x7682e339
-0, 133200, 152064, 0x1061d943
-0, 136800, 152064, 0x50fa684a
-0, 140400, 152064, 0xab4b1975
-0, 144000, 152064, 0x2d043acb
-0, 147600, 152064, 0xe3c2ec0a
-0, 151200, 152064, 0xb9bc99dc
-0, 154800, 152064, 0x051fb857
-0, 158400, 152064, 0x71d1fe52
-0, 162000, 152064, 0x4230c694
-0, 165600, 152064, 0xb412a137
-0, 169200, 152064, 0x2f50f90d
-0, 172800, 152064, 0x68a1466f
-0, 176400, 152064, 0x77e3f47b
-0, 180000, 152064, 0x4d08de2b
-0, 183600, 152064, 0x1fc663be
-0, 187200, 152064, 0x2c8ba712
-0, 190800, 152064, 0xd50d85b9
-0, 194400, 152064, 0xe8483437
-0, 198000, 152064, 0x4e331e4c
-0, 201600, 152064, 0x0f64a7a0
-0, 205200, 152064, 0x797b0b8c
-0, 208800, 152064, 0x1b91e6d8
-0, 212400, 152064, 0xf3a1f3b6
-0, 216000, 152064, 0x2b94bd52
-0, 219600, 152064, 0x1f30962e
-0, 223200, 152064, 0x853321cf
-0, 226800, 152064, 0x8266c0ac
-0, 230400, 152064, 0x25498be0
-0, 234000, 152064, 0x0f653af9
-0, 237600, 152064, 0x0a025f7e
-0, 241200, 152064, 0x1cfbae04
-0, 244800, 152064, 0x3a874757
-0, 248400, 152064, 0x2c67006e
-0, 252000, 152064, 0x1d409bce
-0, 255600, 152064, 0xfe43121f
-0, 259200, 152064, 0x43411830
-0, 262800, 152064, 0x536d26ca
-0, 266400, 152064, 0x9eb873ea
-0, 270000, 152064, 0x093f93ec
-0, 273600, 152064, 0xdf6f0381
-0, 277200, 152064, 0xa9f4b5e5
-0, 280800, 152064, 0x08f71ef8
-0, 284400, 152064, 0x7a68f820
-0, 288000, 152064, 0xae0c73e7
-0, 291600, 152064, 0x886ae6c7
-0, 295200, 152064, 0x9357f433
-0, 298800, 152064, 0xcc335068
-0, 302400, 152064, 0x2ea108ab
-0, 306000, 152064, 0x06d7dcb0
-0, 309600, 152064, 0x81dc81bc
-0, 313200, 152064, 0xfb32b626
-0, 316800, 152064, 0x2787d1c7
-0, 320400, 152064, 0x69e51118
-0, 324000, 152064, 0xba15d94d
-0, 327600, 152064, 0xc41c09cf
-0, 331200, 152064, 0x7e50e12f
-0, 334800, 152064, 0x0763ddbe
-0, 338400, 152064, 0x8a09bb88
-0, 342000, 152064, 0x530752b7
-0, 345600, 152064, 0x9b159923
-0, 349200, 152064, 0xcbb83ed3
-0, 352800, 152064, 0xdeb5ac0e
-0, 356400, 152064, 0x189299d4
+#tb 0: 1/25
+0, 0, 0, 1, 152064, 0x89f2e8d5
+0, 1, 1, 1, 152064, 0x35b99397
+0, 2, 2, 1, 152064, 0x6ef46744
+0, 3, 3, 1, 152064, 0xec4d6c1c
+0, 4, 4, 1, 152064, 0xad6e0c70
+0, 5, 5, 1, 152064, 0x2db534b3
+0, 6, 6, 1, 152064, 0xcbd25ddd
+0, 7, 7, 1, 152064, 0xd90708b4
+0, 8, 8, 1, 152064, 0xc2aa52df
+0, 9, 9, 1, 152064, 0xbcfc84dc
+0, 10, 10, 1, 152064, 0xa5a6d269
+0, 11, 11, 1, 152064, 0x27220ce9
+0, 12, 12, 1, 152064, 0xf075ee6d
+0, 13, 13, 1, 152064, 0x9fd3c2ac
+0, 14, 14, 1, 152064, 0xcba24c2d
+0, 15, 15, 1, 152064, 0x41cd9441
+0, 16, 16, 1, 152064, 0x0126efa3
+0, 17, 17, 1, 152064, 0xf62112af
+0, 18, 18, 1, 152064, 0x35aff50f
+0, 19, 19, 1, 152064, 0xcb0b276f
+0, 20, 20, 1, 152064, 0xc7ef0214
+0, 21, 21, 1, 152064, 0x7f78d387
+0, 22, 22, 1, 152064, 0x266c673d
+0, 23, 23, 1, 152064, 0x1d39c073
+0, 24, 24, 1, 152064, 0x6a3ae455
+0, 25, 25, 1, 152064, 0xe4ce0230
+0, 26, 26, 1, 152064, 0x7f95e87b
+0, 27, 27, 1, 152064, 0x7c552236
+0, 28, 28, 1, 152064, 0x24c799b9
+0, 29, 29, 1, 152064, 0x5042d974
+0, 30, 30, 1, 152064, 0xe934a5b8
+0, 31, 31, 1, 152064, 0x6d59c884
+0, 32, 32, 1, 152064, 0xd00f7fdb
+0, 33, 33, 1, 152064, 0x62ac3ebd
+0, 34, 34, 1, 152064, 0xb40a6c25
+0, 35, 35, 1, 152064, 0x8706188c
+0, 36, 36, 1, 152064, 0x7682e339
+0, 37, 37, 1, 152064, 0x1061d943
+0, 38, 38, 1, 152064, 0x50fa684a
+0, 39, 39, 1, 152064, 0xab4b1975
+0, 40, 40, 1, 152064, 0x2d043acb
+0, 41, 41, 1, 152064, 0xe3c2ec0a
+0, 42, 42, 1, 152064, 0xb9bc99dc
+0, 43, 43, 1, 152064, 0x051fb857
+0, 44, 44, 1, 152064, 0x71d1fe52
+0, 45, 45, 1, 152064, 0x4230c694
+0, 46, 46, 1, 152064, 0xb412a137
+0, 47, 47, 1, 152064, 0x2f50f90d
+0, 48, 48, 1, 152064, 0x68a1466f
+0, 49, 49, 1, 152064, 0x77e3f47b
+0, 50, 50, 1, 152064, 0x4d08de2b
+0, 51, 51, 1, 152064, 0x1fc663be
+0, 52, 52, 1, 152064, 0x2c8ba712
+0, 53, 53, 1, 152064, 0xd50d85b9
+0, 54, 54, 1, 152064, 0xe8483437
+0, 55, 55, 1, 152064, 0x4e331e4c
+0, 56, 56, 1, 152064, 0x0f64a7a0
+0, 57, 57, 1, 152064, 0x797b0b8c
+0, 58, 58, 1, 152064, 0x1b91e6d8
+0, 59, 59, 1, 152064, 0xf3a1f3b6
+0, 60, 60, 1, 152064, 0x2b94bd52
+0, 61, 61, 1, 152064, 0x1f30962e
+0, 62, 62, 1, 152064, 0x853321cf
+0, 63, 63, 1, 152064, 0x8266c0ac
+0, 64, 64, 1, 152064, 0x25498be0
+0, 65, 65, 1, 152064, 0x0f653af9
+0, 66, 66, 1, 152064, 0x0a025f7e
+0, 67, 67, 1, 152064, 0x1cfbae04
+0, 68, 68, 1, 152064, 0x3a874757
+0, 69, 69, 1, 152064, 0x2c67006e
+0, 70, 70, 1, 152064, 0x1d409bce
+0, 71, 71, 1, 152064, 0xfe43121f
+0, 72, 72, 1, 152064, 0x43411830
+0, 73, 73, 1, 152064, 0x536d26ca
+0, 74, 74, 1, 152064, 0x9eb873ea
+0, 75, 75, 1, 152064, 0x093f93ec
+0, 76, 76, 1, 152064, 0xdf6f0381
+0, 77, 77, 1, 152064, 0xa9f4b5e5
+0, 78, 78, 1, 152064, 0x08f71ef8
+0, 79, 79, 1, 152064, 0x7a68f820
+0, 80, 80, 1, 152064, 0xae0c73e7
+0, 81, 81, 1, 152064, 0x886ae6c7
+0, 82, 82, 1, 152064, 0x9357f433
+0, 83, 83, 1, 152064, 0xcc335068
+0, 84, 84, 1, 152064, 0x2ea108ab
+0, 85, 85, 1, 152064, 0x06d7dcb0
+0, 86, 86, 1, 152064, 0x81dc81bc
+0, 87, 87, 1, 152064, 0xfb32b626
+0, 88, 88, 1, 152064, 0x2787d1c7
+0, 89, 89, 1, 152064, 0x69e51118
+0, 90, 90, 1, 152064, 0xba15d94d
+0, 91, 91, 1, 152064, 0xc41c09cf
+0, 92, 92, 1, 152064, 0x7e50e12f
+0, 93, 93, 1, 152064, 0x0763ddbe
+0, 94, 94, 1, 152064, 0x8a09bb88
+0, 95, 95, 1, 152064, 0x530752b7
+0, 96, 96, 1, 152064, 0x9b159923
+0, 97, 97, 1, 152064, 0xcbb83ed3
+0, 98, 98, 1, 152064, 0xdeb5ac0e
+0, 99, 99, 1, 152064, 0x189299d4
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-frext01_jvc_d b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-frext01_jvc_d
index ae71a63..b82151e 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-frext01_jvc_d
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-frext01_jvc_d
@@ -1,16 +1,17 @@
-0, 0, 152064, 0x31bc935e
-0, 3600, 152064, 0x501ea92a
-0, 7200, 152064, 0x8b2f6ead
-0, 10800, 152064, 0xa86277e3
-0, 14400, 152064, 0xe5936250
-0, 18000, 152064, 0x497794cb
-0, 21600, 152064, 0xcb34c39a
-0, 25200, 152064, 0xa739994d
-0, 28800, 152064, 0x01e804b7
-0, 32400, 152064, 0xfcf00627
-0, 36000, 152064, 0xcd747bda
-0, 39600, 152064, 0x1d979394
-0, 43200, 152064, 0xd5d52a6a
-0, 46800, 152064, 0xd7fb147b
-0, 50400, 152064, 0x5d7cb44a
-0, 54000, 152064, 0x9b87803b
+#tb 0: 1/25
+0, 0, 0, 1, 152064, 0x31bc935e
+0, 1, 1, 1, 152064, 0x501ea92a
+0, 2, 2, 1, 152064, 0x8b2f6ead
+0, 3, 3, 1, 152064, 0xa86277e3
+0, 4, 4, 1, 152064, 0xe5936250
+0, 5, 5, 1, 152064, 0x497794cb
+0, 6, 6, 1, 152064, 0xcb34c39a
+0, 7, 7, 1, 152064, 0xa739994d
+0, 8, 8, 1, 152064, 0x01e804b7
+0, 9, 9, 1, 152064, 0xfcf00627
+0, 10, 10, 1, 152064, 0xcd747bda
+0, 11, 11, 1, 152064, 0x1d979394
+0, 12, 12, 1, 152064, 0xd5d52a6a
+0, 13, 13, 1, 152064, 0xd7fb147b
+0, 14, 14, 1, 152064, 0x5d7cb44a
+0, 15, 15, 1, 152064, 0x9b87803b
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-frext02_jvc_c b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-frext02_jvc_c
index ae71a63..b82151e 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-frext02_jvc_c
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-frext02_jvc_c
@@ -1,16 +1,17 @@
-0, 0, 152064, 0x31bc935e
-0, 3600, 152064, 0x501ea92a
-0, 7200, 152064, 0x8b2f6ead
-0, 10800, 152064, 0xa86277e3
-0, 14400, 152064, 0xe5936250
-0, 18000, 152064, 0x497794cb
-0, 21600, 152064, 0xcb34c39a
-0, 25200, 152064, 0xa739994d
-0, 28800, 152064, 0x01e804b7
-0, 32400, 152064, 0xfcf00627
-0, 36000, 152064, 0xcd747bda
-0, 39600, 152064, 0x1d979394
-0, 43200, 152064, 0xd5d52a6a
-0, 46800, 152064, 0xd7fb147b
-0, 50400, 152064, 0x5d7cb44a
-0, 54000, 152064, 0x9b87803b
+#tb 0: 1/25
+0, 0, 0, 1, 152064, 0x31bc935e
+0, 1, 1, 1, 152064, 0x501ea92a
+0, 2, 2, 1, 152064, 0x8b2f6ead
+0, 3, 3, 1, 152064, 0xa86277e3
+0, 4, 4, 1, 152064, 0xe5936250
+0, 5, 5, 1, 152064, 0x497794cb
+0, 6, 6, 1, 152064, 0xcb34c39a
+0, 7, 7, 1, 152064, 0xa739994d
+0, 8, 8, 1, 152064, 0x01e804b7
+0, 9, 9, 1, 152064, 0xfcf00627
+0, 10, 10, 1, 152064, 0xcd747bda
+0, 11, 11, 1, 152064, 0x1d979394
+0, 12, 12, 1, 152064, 0xd5d52a6a
+0, 13, 13, 1, 152064, 0xd7fb147b
+0, 14, 14, 1, 152064, 0x5d7cb44a
+0, 15, 15, 1, 152064, 0x9b87803b
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-frext1_panasonic_c b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-frext1_panasonic_c
index ec01250..81748f7 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-frext1_panasonic_c
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-frext1_panasonic_c
@@ -1,8 +1,9 @@
-0, 0, 152064, 0xf9c30518
-0, 3600, 152064, 0x509dd18f
-0, 7200, 152064, 0x7f5c8f07
-0, 10800, 152064, 0x8ce42210
-0, 14400, 152064, 0x59fd527a
-0, 18000, 152064, 0xd987ceea
-0, 21600, 152064, 0xc53167fa
-0, 25200, 152064, 0xb3179926
+#tb 0: 1/25
+0, 0, 0, 1, 152064, 0xf9c30518
+0, 1, 1, 1, 152064, 0x509dd18f
+0, 2, 2, 1, 152064, 0x7f5c8f07
+0, 3, 3, 1, 152064, 0x8ce42210
+0, 4, 4, 1, 152064, 0x59fd527a
+0, 5, 5, 1, 152064, 0xd987ceea
+0, 6, 6, 1, 152064, 0xc53167fa
+0, 7, 7, 1, 152064, 0xb3179926
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-frext2_panasonic_b b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-frext2_panasonic_b
index a980a9d..7c53b5c 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-frext2_panasonic_b
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-frext2_panasonic_b
@@ -1,15 +1,16 @@
-0, 0, 152064, 0x0147a2a9
-0, 3600, 152064, 0xe2365351
-0, 7200, 152064, 0xb5f9daee
-0, 10800, 152064, 0xd60818b2
-0, 14400, 152064, 0x21b528e5
-0, 18000, 152064, 0x9c9dda18
-0, 21600, 152064, 0x387fe7de
-0, 25200, 152064, 0x8f0c5a1e
-0, 28800, 152064, 0x02409694
-0, 32400, 152064, 0x2b36a7a7
-0, 36000, 152064, 0x3c6d3863
-0, 39600, 152064, 0xaa7835e1
-0, 43200, 152064, 0x6d105fe7
-0, 46800, 152064, 0x9a348732
-0, 50400, 152064, 0x96a3af13
+#tb 0: 1/25
+0, 0, 0, 1, 152064, 0x0147a2a9
+0, 1, 1, 1, 152064, 0xe2365351
+0, 2, 2, 1, 152064, 0xb5f9daee
+0, 3, 3, 1, 152064, 0xd60818b2
+0, 4, 4, 1, 152064, 0x21b528e5
+0, 5, 5, 1, 152064, 0x9c9dda18
+0, 6, 6, 1, 152064, 0x387fe7de
+0, 7, 7, 1, 152064, 0x8f0c5a1e
+0, 8, 8, 1, 152064, 0x02409694
+0, 9, 9, 1, 152064, 0x2b36a7a7
+0, 10, 10, 1, 152064, 0x3c6d3863
+0, 11, 11, 1, 152064, 0xaa7835e1
+0, 12, 12, 1, 152064, 0x6d105fe7
+0, 13, 13, 1, 152064, 0x9a348732
+0, 14, 14, 1, 152064, 0x96a3af13
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-frext3_panasonic_d b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-frext3_panasonic_d
index 94590b3..71b743e 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-frext3_panasonic_d
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-frext3_panasonic_d
@@ -1,11 +1,12 @@
-0, 0, 152064, 0xdd346292
-0, 3600, 152064, 0xb07e6efd
-0, 7200, 152064, 0x81b4d540
-0, 10800, 152064, 0xc50066cf
-0, 14400, 152064, 0x30a49588
-0, 18000, 152064, 0x57520bfa
-0, 21600, 152064, 0xc0409dd9
-0, 25200, 152064, 0x8e6453e9
-0, 28800, 152064, 0x7ca86d86
-0, 32400, 152064, 0xf937b3b5
-0, 36000, 152064, 0x6c1f4604
+#tb 0: 1/25
+0, 0, 0, 1, 152064, 0xdd346292
+0, 1, 1, 1, 152064, 0xb07e6efd
+0, 2, 2, 1, 152064, 0x81b4d540
+0, 3, 3, 1, 152064, 0xc50066cf
+0, 4, 4, 1, 152064, 0x30a49588
+0, 5, 5, 1, 152064, 0x57520bfa
+0, 6, 6, 1, 152064, 0xc0409dd9
+0, 7, 7, 1, 152064, 0x8e6453e9
+0, 8, 8, 1, 152064, 0x7ca86d86
+0, 9, 9, 1, 152064, 0xf937b3b5
+0, 10, 10, 1, 152064, 0x6c1f4604
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-frext4_panasonic_a b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-frext4_panasonic_a
index 3cf454c..c0886e4 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-frext4_panasonic_a
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-frext4_panasonic_a
@@ -1,10 +1,11 @@
-0, 0, 152064, 0xd604d440
-0, 3600, 152064, 0x08ef262c
-0, 7200, 152064, 0x992fca8e
-0, 10800, 152064, 0x5a02ee15
-0, 14400, 152064, 0xf15d5c66
-0, 18000, 152064, 0x360dda12
-0, 21600, 152064, 0x18b54985
-0, 25200, 152064, 0xf12b6cde
-0, 28800, 152064, 0x3b2e63f7
-0, 32400, 152064, 0x140abcfd
+#tb 0: 1/25
+0, 0, 0, 1, 152064, 0xd604d440
+0, 1, 1, 1, 152064, 0x08ef262c
+0, 2, 2, 1, 152064, 0x992fca8e
+0, 3, 3, 1, 152064, 0x5a02ee15
+0, 4, 4, 1, 152064, 0xf15d5c66
+0, 5, 5, 1, 152064, 0x360dda12
+0, 6, 6, 1, 152064, 0x18b54985
+0, 7, 7, 1, 152064, 0xf12b6cde
+0, 8, 8, 1, 152064, 0x3b2e63f7
+0, 9, 9, 1, 152064, 0x140abcfd
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-frext_mmco4_sony_b b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-frext_mmco4_sony_b
index 117b48b..a964a38 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-frext_mmco4_sony_b
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-frext_mmco4_sony_b
@@ -1,60 +1,61 @@
-0, 0, 152064, 0x24846654
-0, 3600, 152064, 0xd33945be
-0, 7200, 152064, 0x961cbbfb
-0, 10800, 152064, 0x91eb854d
-0, 14400, 152064, 0x998351b4
-0, 18000, 152064, 0xe7515c67
-0, 21600, 152064, 0xd32058ae
-0, 25200, 152064, 0x99cb5695
-0, 28800, 152064, 0x281de175
-0, 32400, 152064, 0xf4146f55
-0, 36000, 152064, 0x63abbb61
-0, 39600, 152064, 0xf44550c5
-0, 43200, 152064, 0x5797a5c2
-0, 46800, 152064, 0x13b15c60
-0, 50400, 152064, 0x6521e682
-0, 54000, 152064, 0x780c32a4
-0, 57600, 152064, 0x6289f37c
-0, 61200, 152064, 0x96d64d81
-0, 64800, 152064, 0x12ac80ef
-0, 68400, 152064, 0x470956e4
-0, 72000, 152064, 0x3954f944
-0, 75600, 152064, 0x2147f0db
-0, 79200, 152064, 0xca7c9a39
-0, 82800, 152064, 0x727e7772
-0, 86400, 152064, 0xb3b0f8c8
-0, 90000, 152064, 0x6d6eb7ba
-0, 93600, 152064, 0x1eaf5734
-0, 97200, 152064, 0xd7938056
-0, 100800, 152064, 0xcae1ead3
-0, 104400, 152064, 0x6411b82c
-0, 108000, 152064, 0x6f001718
-0, 111600, 152064, 0x3724d9b8
-0, 115200, 152064, 0x04501fec
-0, 118800, 152064, 0x3f4d13bb
-0, 122400, 152064, 0x38f2510a
-0, 126000, 152064, 0x5bb71106
-0, 129600, 152064, 0xe888b09d
-0, 133200, 152064, 0xca6f5f6a
-0, 136800, 152064, 0x01c7d329
-0, 140400, 152064, 0x4e670932
-0, 144000, 152064, 0x651b4984
-0, 147600, 152064, 0x76371fa3
-0, 151200, 152064, 0x60574af0
-0, 154800, 152064, 0xcc1f2080
-0, 158400, 152064, 0xdbf29eb6
-0, 162000, 152064, 0x8ff870be
-0, 165600, 152064, 0x5d39ea56
-0, 169200, 152064, 0xabb7c0a5
-0, 172800, 152064, 0xecb15771
-0, 176400, 152064, 0x571ab1ae
-0, 180000, 152064, 0xc0f22bad
-0, 183600, 152064, 0x22e7593f
-0, 187200, 152064, 0x3c3dee75
-0, 190800, 152064, 0x1c80b995
-0, 194400, 152064, 0x5ba442fa
-0, 198000, 152064, 0xe2291c05
-0, 201600, 152064, 0xa780b11e
-0, 205200, 152064, 0x15bf83fa
-0, 208800, 152064, 0x60fb7c11
-0, 212400, 152064, 0x3fb8cee5
+#tb 0: 1/25
+0, 0, 0, 1, 152064, 0x24846654
+0, 1, 1, 1, 152064, 0xd33945be
+0, 2, 2, 1, 152064, 0x961cbbfb
+0, 3, 3, 1, 152064, 0x91eb854d
+0, 4, 4, 1, 152064, 0x998351b4
+0, 5, 5, 1, 152064, 0xe7515c67
+0, 6, 6, 1, 152064, 0xd32058ae
+0, 7, 7, 1, 152064, 0x99cb5695
+0, 8, 8, 1, 152064, 0x281de175
+0, 9, 9, 1, 152064, 0xf4146f55
+0, 10, 10, 1, 152064, 0x63abbb61
+0, 11, 11, 1, 152064, 0xf44550c5
+0, 12, 12, 1, 152064, 0x5797a5c2
+0, 13, 13, 1, 152064, 0x13b15c60
+0, 14, 14, 1, 152064, 0x6521e682
+0, 15, 15, 1, 152064, 0x780c32a4
+0, 16, 16, 1, 152064, 0x6289f37c
+0, 17, 17, 1, 152064, 0x96d64d81
+0, 18, 18, 1, 152064, 0x12ac80ef
+0, 19, 19, 1, 152064, 0x470956e4
+0, 20, 20, 1, 152064, 0x3954f944
+0, 21, 21, 1, 152064, 0x2147f0db
+0, 22, 22, 1, 152064, 0xca7c9a39
+0, 23, 23, 1, 152064, 0x727e7772
+0, 24, 24, 1, 152064, 0xb3b0f8c8
+0, 25, 25, 1, 152064, 0x6d6eb7ba
+0, 26, 26, 1, 152064, 0x1eaf5734
+0, 27, 27, 1, 152064, 0xd7938056
+0, 28, 28, 1, 152064, 0xcae1ead3
+0, 29, 29, 1, 152064, 0x6411b82c
+0, 30, 30, 1, 152064, 0x6f001718
+0, 31, 31, 1, 152064, 0x3724d9b8
+0, 32, 32, 1, 152064, 0x04501fec
+0, 33, 33, 1, 152064, 0x3f4d13bb
+0, 34, 34, 1, 152064, 0x38f2510a
+0, 35, 35, 1, 152064, 0x5bb71106
+0, 36, 36, 1, 152064, 0xe888b09d
+0, 37, 37, 1, 152064, 0xca6f5f6a
+0, 38, 38, 1, 152064, 0x01c7d329
+0, 39, 39, 1, 152064, 0x4e670932
+0, 40, 40, 1, 152064, 0x651b4984
+0, 41, 41, 1, 152064, 0x76371fa3
+0, 42, 42, 1, 152064, 0x60574af0
+0, 43, 43, 1, 152064, 0xcc1f2080
+0, 44, 44, 1, 152064, 0xdbf29eb6
+0, 45, 45, 1, 152064, 0x8ff870be
+0, 46, 46, 1, 152064, 0x5d39ea56
+0, 47, 47, 1, 152064, 0xabb7c0a5
+0, 48, 48, 1, 152064, 0xecb15771
+0, 49, 49, 1, 152064, 0x571ab1ae
+0, 50, 50, 1, 152064, 0xc0f22bad
+0, 51, 51, 1, 152064, 0x22e7593f
+0, 52, 52, 1, 152064, 0x3c3dee75
+0, 53, 53, 1, 152064, 0x1c80b995
+0, 54, 54, 1, 152064, 0x5ba442fa
+0, 55, 55, 1, 152064, 0xe2291c05
+0, 56, 56, 1, 152064, 0xa780b11e
+0, 57, 57, 1, 152064, 0x15bf83fa
+0, 58, 58, 1, 152064, 0x60fb7c11
+0, 59, 59, 1, 152064, 0x3fb8cee5
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-hcaff1_hhi_b b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-hcaff1_hhi_b
index 5e366b4..eb41d46 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-hcaff1_hhi_b
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-hcaff1_hhi_b
@@ -1,10 +1,11 @@
-0, 0, 152064, 0xb055a9bd
-0, 3600, 152064, 0x9e1eadb6
-0, 7200, 152064, 0x48f117d2
-0, 10800, 152064, 0x3e3ff049
-0, 14400, 152064, 0x2ff80943
-0, 18000, 152064, 0xc5ee16a6
-0, 21600, 152064, 0x38c33f28
-0, 25200, 152064, 0x3e8444c7
-0, 28800, 152064, 0x14ca4ab2
-0, 32400, 152064, 0xe20e78f7
+#tb 0: 1/25
+0, 0, 0, 1, 152064, 0xb055a9bd
+0, 1, 1, 1, 152064, 0x9e1eadb6
+0, 2, 2, 1, 152064, 0x48f117d2
+0, 3, 3, 1, 152064, 0x3e3ff049
+0, 4, 4, 1, 152064, 0x2ff80943
+0, 5, 5, 1, 152064, 0xc5ee16a6
+0, 6, 6, 1, 152064, 0x38c33f28
+0, 7, 7, 1, 152064, 0x3e8444c7
+0, 8, 8, 1, 152064, 0x14ca4ab2
+0, 9, 9, 1, 152064, 0xe20e78f7
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-hcafr1_hhi_c b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-hcafr1_hhi_c
index 102fe89..285f057 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-hcafr1_hhi_c
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-hcafr1_hhi_c
@@ -1,10 +1,11 @@
-0, 0, 152064, 0xd48c87b3
-0, 3600, 152064, 0xb7a67f8f
-0, 7200, 152064, 0x3c3f3c11
-0, 10800, 152064, 0xc411af54
-0, 14400, 152064, 0xde2efb95
-0, 18000, 152064, 0xa4787125
-0, 21600, 152064, 0x3c17085a
-0, 25200, 152064, 0xee217266
-0, 28800, 152064, 0xa23a8e9d
-0, 32400, 152064, 0x70a06d90
+#tb 0: 1/25
+0, 0, 0, 1, 152064, 0xd48c87b3
+0, 1, 1, 1, 152064, 0xb7a67f8f
+0, 2, 2, 1, 152064, 0x3c3f3c11
+0, 3, 3, 1, 152064, 0xc411af54
+0, 4, 4, 1, 152064, 0xde2efb95
+0, 5, 5, 1, 152064, 0xa4787125
+0, 6, 6, 1, 152064, 0x3c17085a
+0, 7, 7, 1, 152064, 0xee217266
+0, 8, 8, 1, 152064, 0xa23a8e9d
+0, 9, 9, 1, 152064, 0x70a06d90
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-hcafr2_hhi_a b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-hcafr2_hhi_a
index 516b39d..7149850 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-hcafr2_hhi_a
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-hcafr2_hhi_a
@@ -1,10 +1,11 @@
-0, 0, 152064, 0xd5448f0e
-0, 3600, 152064, 0x93d022ba
-0, 7200, 152064, 0x1eaed76e
-0, 10800, 152064, 0xbbd54f09
-0, 14400, 152064, 0x175d6316
-0, 18000, 152064, 0x15ede384
-0, 21600, 152064, 0xb785e9ac
-0, 25200, 152064, 0xdbbb4ee6
-0, 28800, 152064, 0xaf27c827
-0, 32400, 152064, 0xbf3eeed4
+#tb 0: 1/25
+0, 0, 0, 1, 152064, 0xd5448f0e
+0, 1, 1, 1, 152064, 0x93d022ba
+0, 2, 2, 1, 152064, 0x1eaed76e
+0, 3, 3, 1, 152064, 0xbbd54f09
+0, 4, 4, 1, 152064, 0x175d6316
+0, 5, 5, 1, 152064, 0x15ede384
+0, 6, 6, 1, 152064, 0xb785e9ac
+0, 7, 7, 1, 152064, 0xdbbb4ee6
+0, 8, 8, 1, 152064, 0xaf27c827
+0, 9, 9, 1, 152064, 0xbf3eeed4
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-hcafr3_hhi_a b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-hcafr3_hhi_a
index da60e63..2ec9dce 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-hcafr3_hhi_a
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-hcafr3_hhi_a
@@ -1,10 +1,11 @@
-0, 0, 152064, 0xd5448f0e
-0, 3600, 152064, 0x665e33b5
-0, 7200, 152064, 0x6648e99d
-0, 10800, 152064, 0xbbd54f09
-0, 14400, 152064, 0x3dac7644
-0, 18000, 152064, 0xe980f078
-0, 21600, 152064, 0xb785e9ac
-0, 25200, 152064, 0xa500630e
-0, 28800, 152064, 0x6dade9b0
-0, 32400, 152064, 0xbf3eeed4
+#tb 0: 1/25
+0, 0, 0, 1, 152064, 0xd5448f0e
+0, 1, 1, 1, 152064, 0x665e33b5
+0, 2, 2, 1, 152064, 0x6648e99d
+0, 3, 3, 1, 152064, 0xbbd54f09
+0, 4, 4, 1, 152064, 0x3dac7644
+0, 5, 5, 1, 152064, 0xe980f078
+0, 6, 6, 1, 152064, 0xb785e9ac
+0, 7, 7, 1, 152064, 0xa500630e
+0, 8, 8, 1, 152064, 0x6dade9b0
+0, 9, 9, 1, 152064, 0xbf3eeed4
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-hcafr4_hhi_a b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-hcafr4_hhi_a
index 0dcf5a5..00af8ff 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-hcafr4_hhi_a
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-hcafr4_hhi_a
@@ -1,10 +1,11 @@
-0, 0, 152064, 0xc7d8832d
-0, 3600, 152064, 0x8d9ffc59
-0, 7200, 152064, 0xaf3ea0d1
-0, 10800, 152064, 0x6805671e
-0, 14400, 152064, 0x49202ab8
-0, 18000, 152064, 0x6b06b1ad
-0, 21600, 152064, 0x909f3e4e
-0, 25200, 152064, 0xa4ce28ec
-0, 28800, 152064, 0xc3c5b8bc
-0, 32400, 152064, 0x78744dac
+#tb 0: 1/25
+0, 0, 0, 1, 152064, 0xc7d8832d
+0, 1, 1, 1, 152064, 0x8d9ffc59
+0, 2, 2, 1, 152064, 0xaf3ea0d1
+0, 3, 3, 1, 152064, 0x6805671e
+0, 4, 4, 1, 152064, 0x49202ab8
+0, 5, 5, 1, 152064, 0x6b06b1ad
+0, 6, 6, 1, 152064, 0x909f3e4e
+0, 7, 7, 1, 152064, 0xa4ce28ec
+0, 8, 8, 1, 152064, 0xc3c5b8bc
+0, 9, 9, 1, 152064, 0x78744dac
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-hcamff1_hhi_b b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-hcamff1_hhi_b
index 1dc66a1..df85212 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-hcamff1_hhi_b
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-hcamff1_hhi_b
@@ -1,10 +1,11 @@
-0, 0, 152064, 0x18f494ec
-0, 3600, 152064, 0x7515e6d7
-0, 7200, 152064, 0xaa8ee665
-0, 10800, 152064, 0xa946e180
-0, 14400, 152064, 0xd1467f7e
-0, 18000, 152064, 0xd779f4c2
-0, 21600, 152064, 0xed456fed
-0, 25200, 152064, 0x4ca23a72
-0, 28800, 152064, 0x26381cd2
-0, 32400, 152064, 0x50df40fa
+#tb 0: 1/25
+0, 0, 0, 1, 152064, 0x18f494ec
+0, 1, 1, 1, 152064, 0x7515e6d7
+0, 2, 2, 1, 152064, 0xaa8ee665
+0, 3, 3, 1, 152064, 0xa946e180
+0, 4, 4, 1, 152064, 0xd1467f7e
+0, 5, 5, 1, 152064, 0xd779f4c2
+0, 6, 6, 1, 152064, 0xed456fed
+0, 7, 7, 1, 152064, 0x4ca23a72
+0, 8, 8, 1, 152064, 0x26381cd2
+0, 9, 9, 1, 152064, 0x50df40fa
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-hpca_brcm_c b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-hpca_brcm_c
index cbfc568..d608d89 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-hpca_brcm_c
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-hpca_brcm_c
@@ -1,300 +1,301 @@
-0, 0, 152064, 0x995bb4bd
-0, 3600, 152064, 0xad287357
-0, 7200, 152064, 0x38fa4661
-0, 10800, 152064, 0x8aae73cf
-0, 14400, 152064, 0x4a13eada
-0, 18000, 152064, 0x48b33901
-0, 21600, 152064, 0x011487bc
-0, 25200, 152064, 0xd4ce1925
-0, 28800, 152064, 0x5d679ddd
-0, 32400, 152064, 0x276cd5cf
-0, 36000, 152064, 0x99c625f0
-0, 39600, 152064, 0xb2f756d1
-0, 43200, 152064, 0xb19c2978
-0, 46800, 152064, 0xdac0ff3c
-0, 50400, 152064, 0x3c1c8d63
-0, 54000, 152064, 0x818ea0a8
-0, 57600, 152064, 0xa7c122a5
-0, 61200, 152064, 0x67ad3519
-0, 64800, 152064, 0xc81b2a88
-0, 68400, 152064, 0x8ae6633e
-0, 72000, 152064, 0xed945788
-0, 75600, 152064, 0x4c740bcb
-0, 79200, 152064, 0xd8408d09
-0, 82800, 152064, 0xb710e8b8
-0, 86400, 152064, 0xb8c647b9
-0, 90000, 152064, 0x802b2e23
-0, 93600, 152064, 0x30672529
-0, 97200, 152064, 0x328a72b6
-0, 100800, 152064, 0xeb6dbe94
-0, 104400, 152064, 0x1c19dcc5
-0, 108000, 152064, 0xfdc6b998
-0, 111600, 152064, 0xf9e2cd80
-0, 115200, 152064, 0x025eb15e
-0, 118800, 152064, 0xfd998ad8
-0, 122400, 152064, 0x8fdf736f
-0, 126000, 152064, 0xa5a7554a
-0, 129600, 152064, 0xcea63304
-0, 133200, 152064, 0xcb28ec28
-0, 136800, 152064, 0x92efb591
-0, 140400, 152064, 0x0f2376c3
-0, 144000, 152064, 0xe9cb5ecf
-0, 147600, 152064, 0xcd2d0eba
-0, 151200, 152064, 0xd57fe4fd
-0, 154800, 152064, 0xc486ab8e
-0, 158400, 152064, 0x01a1f709
-0, 162000, 152064, 0x7ac5b13a
-0, 165600, 152064, 0x6f519279
-0, 169200, 152064, 0xfd7cd9a0
-0, 172800, 152064, 0xfae649d2
-0, 176400, 152064, 0x618507ca
-0, 180000, 152064, 0xb177bc15
-0, 183600, 152064, 0x6fa36854
-0, 187200, 152064, 0xc13cb77d
-0, 190800, 152064, 0x6d40cb01
-0, 194400, 152064, 0xa3db96a2
-0, 198000, 152064, 0xe5ba6c99
-0, 201600, 152064, 0xca9ff3ee
-0, 205200, 152064, 0x6c016c65
-0, 208800, 152064, 0xdf93ed80
-0, 212400, 152064, 0x93112ec8
-0, 216000, 152064, 0x8ab3ea14
-0, 219600, 152064, 0x02f5b891
-0, 223200, 152064, 0xdafd562b
-0, 226800, 152064, 0xa96a2bd7
-0, 230400, 152064, 0xdff8bc68
-0, 234000, 152064, 0x8d956b4b
-0, 237600, 152064, 0xb4aeb960
-0, 241200, 152064, 0x391cf0dd
-0, 244800, 152064, 0x03137de9
-0, 248400, 152064, 0x2bfa8c4b
-0, 252000, 152064, 0xfb54d3a5
-0, 255600, 152064, 0x650146e7
-0, 259200, 152064, 0xd3a7765f
-0, 262800, 152064, 0x49d72b90
-0, 266400, 152064, 0xf089b357
-0, 270000, 152064, 0x23a2be41
-0, 273600, 152064, 0x2ea86592
-0, 277200, 152064, 0x99d6f56b
-0, 280800, 152064, 0xc2ca75b9
-0, 284400, 152064, 0x390b7278
-0, 288000, 152064, 0x0f6d1f1e
-0, 291600, 152064, 0x79e2a3f4
-0, 295200, 152064, 0x51d5e1da
-0, 298800, 152064, 0xdb57419a
-0, 302400, 152064, 0xf90a4153
-0, 306000, 152064, 0xd192f6c6
-0, 309600, 152064, 0x8cd3895a
-0, 313200, 152064, 0x0d3ec577
-0, 316800, 152064, 0x146e8492
-0, 320400, 152064, 0xc9939c22
-0, 324000, 152064, 0xf1f4275e
-0, 327600, 152064, 0xb898eb35
-0, 331200, 152064, 0xed315ee9
-0, 334800, 152064, 0x9046b760
-0, 338400, 152064, 0x599a736b
-0, 342000, 152064, 0xaef20726
-0, 345600, 152064, 0x0d136768
-0, 349200, 152064, 0xfe4ed2a8
-0, 352800, 152064, 0x5a85524b
-0, 356400, 152064, 0x6d495dd2
-0, 360000, 152064, 0x04bdb815
-0, 363600, 152064, 0x28aae1c5
-0, 367200, 152064, 0xc20bc8d9
-0, 370800, 152064, 0xa33d9b41
-0, 374400, 152064, 0x6269cb43
-0, 378000, 152064, 0x4f81d636
-0, 381600, 152064, 0xc6062166
-0, 385200, 152064, 0xb027fbcc
-0, 388800, 152064, 0x73a7a584
-0, 392400, 152064, 0xf67e520a
-0, 396000, 152064, 0x94eff023
-0, 399600, 152064, 0xef1da8e5
-0, 403200, 152064, 0x2d9ab411
-0, 406800, 152064, 0xf0c39b5d
-0, 410400, 152064, 0xb2374724
-0, 414000, 152064, 0x939a5243
-0, 417600, 152064, 0xee3438db
-0, 421200, 152064, 0x7da04012
-0, 424800, 152064, 0xac611668
-0, 428400, 152064, 0xdce3062e
-0, 432000, 152064, 0xb57cc00e
-0, 435600, 152064, 0xaf96b59e
-0, 439200, 152064, 0x56789c13
-0, 442800, 152064, 0xb1f678b5
-0, 446400, 152064, 0xb340b8c4
-0, 450000, 152064, 0x86e6e304
-0, 453600, 152064, 0xa056e037
-0, 457200, 152064, 0x16885d27
-0, 460800, 152064, 0x9c5ac065
-0, 464400, 152064, 0x563d5335
-0, 468000, 152064, 0x3ca71c1e
-0, 471600, 152064, 0xad34e16c
-0, 475200, 152064, 0x6d074b27
-0, 478800, 152064, 0x9b1c4909
-0, 482400, 152064, 0xdbced198
-0, 486000, 152064, 0x8a0ded00
-0, 489600, 152064, 0x5ffc209b
-0, 493200, 152064, 0x47cfd269
-0, 496800, 152064, 0xe3c0137e
-0, 500400, 152064, 0xcb6a5e53
-0, 504000, 152064, 0x87cec05f
-0, 507600, 152064, 0x92721dd2
-0, 511200, 152064, 0x3f7d7b3b
-0, 514800, 152064, 0xd63ef417
-0, 518400, 152064, 0xf8e4b05a
-0, 522000, 152064, 0xb5dcb421
-0, 525600, 152064, 0x53c96f6a
-0, 529200, 152064, 0x24ae98a3
-0, 532800, 152064, 0x2e9b5fff
-0, 536400, 152064, 0x7795bf12
-0, 540000, 152064, 0x499d37ca
-0, 543600, 152064, 0xfe478487
-0, 547200, 152064, 0xcd661afb
-0, 550800, 152064, 0x44f8bf00
-0, 554400, 152064, 0x90b67809
-0, 558000, 152064, 0x8f5726d1
-0, 561600, 152064, 0x2e3c39d5
-0, 565200, 152064, 0x4b67c4e6
-0, 568800, 152064, 0x9fecb7cf
-0, 572400, 152064, 0x207766ea
-0, 576000, 152064, 0x5846bf7b
-0, 579600, 152064, 0x4237fba1
-0, 583200, 152064, 0x983e0cbd
-0, 586800, 152064, 0x6be100d1
-0, 590400, 152064, 0x9d0beb8f
-0, 594000, 152064, 0x234b82e7
-0, 597600, 152064, 0x83fb5ef1
-0, 601200, 152064, 0xf503dcb2
-0, 604800, 152064, 0x031a27f2
-0, 608400, 152064, 0x2f1abf24
-0, 612000, 152064, 0x54d77010
-0, 615600, 152064, 0x049fc0fc
-0, 619200, 152064, 0x20f2f7e7
-0, 622800, 152064, 0xc0d57467
-0, 626400, 152064, 0xbe464eef
-0, 630000, 152064, 0x035c9052
-0, 633600, 152064, 0x91cba4fb
-0, 637200, 152064, 0x11cdbbfb
-0, 640800, 152064, 0xe61116d5
-0, 644400, 152064, 0x16db46b8
-0, 648000, 152064, 0x54f30d9f
-0, 651600, 152064, 0x211a8d2d
-0, 655200, 152064, 0x5a74a56b
-0, 658800, 152064, 0x0ff4ba72
-0, 662400, 152064, 0x4c398ad6
-0, 666000, 152064, 0x830814f0
-0, 669600, 152064, 0xa51f4bab
-0, 673200, 152064, 0xf3460de6
-0, 676800, 152064, 0x7e1979a1
-0, 680400, 152064, 0x4b3ebb3a
-0, 684000, 152064, 0x83d1f4f8
-0, 687600, 152064, 0xfbf08683
-0, 691200, 152064, 0x901c07ec
-0, 694800, 152064, 0xbc2dc1c7
-0, 698400, 152064, 0x6e646b3b
-0, 702000, 152064, 0x51a25aab
-0, 705600, 152064, 0xa042ab78
-0, 709200, 152064, 0xb972af58
-0, 712800, 152064, 0xcdca9568
-0, 716400, 152064, 0x17b69d1c
-0, 720000, 152064, 0x41c43ea2
-0, 723600, 152064, 0x195fc7a0
-0, 727200, 152064, 0xf4cec580
-0, 730800, 152064, 0xb3b10936
-0, 734400, 152064, 0x102bc2ec
-0, 738000, 152064, 0xc99d4767
-0, 741600, 152064, 0x60c745b0
-0, 745200, 152064, 0x8176e0cf
-0, 748800, 152064, 0xd47e69b5
-0, 752400, 152064, 0xacce674c
-0, 756000, 152064, 0x031b51f8
-0, 759600, 152064, 0x0eb681ef
-0, 763200, 152064, 0x0b69334b
-0, 766800, 152064, 0xda819c1f
-0, 770400, 152064, 0xa93f62d2
-0, 774000, 152064, 0x51374db5
-0, 777600, 152064, 0x885dccff
-0, 781200, 152064, 0xd0780444
-0, 784800, 152064, 0xa31733ca
-0, 788400, 152064, 0x3f3de84e
-0, 792000, 152064, 0x2af2b2c3
-0, 795600, 152064, 0xa62dceae
-0, 799200, 152064, 0xca1cffd1
-0, 802800, 152064, 0x3c7d561b
-0, 806400, 152064, 0xbc04130a
-0, 810000, 152064, 0xbd2829ae
-0, 813600, 152064, 0xdbbb9820
-0, 817200, 152064, 0xfc3ef628
-0, 820800, 152064, 0xd5da3ec3
-0, 824400, 152064, 0x62d5fcc1
-0, 828000, 152064, 0x455a8dae
-0, 831600, 152064, 0x421c9147
-0, 835200, 152064, 0x6a168484
-0, 838800, 152064, 0x7ba15d32
-0, 842400, 152064, 0xd089ed27
-0, 846000, 152064, 0x8fc4d894
-0, 849600, 152064, 0x99e47125
-0, 853200, 152064, 0xf55dda68
-0, 856800, 152064, 0x6bf06cf1
-0, 860400, 152064, 0x7dc41a9d
-0, 864000, 152064, 0x78b84019
-0, 867600, 152064, 0x85ae8973
-0, 871200, 152064, 0x7b7aeabe
-0, 874800, 152064, 0xf9a8f6bf
-0, 878400, 152064, 0xe195ddcd
-0, 882000, 152064, 0x83edffe9
-0, 885600, 152064, 0x59cce97a
-0, 889200, 152064, 0x15268af1
-0, 892800, 152064, 0x270cca95
-0, 896400, 152064, 0x8bced1f9
-0, 900000, 152064, 0x08ee5cec
-0, 903600, 152064, 0x01e74f95
-0, 907200, 152064, 0x7e19238f
-0, 910800, 152064, 0x6bcb2b9d
-0, 914400, 152064, 0x58111385
-0, 918000, 152064, 0x6c7aa1f7
-0, 921600, 152064, 0xb713a822
-0, 925200, 152064, 0x1d645cee
-0, 928800, 152064, 0x9c592969
-0, 932400, 152064, 0x2472769e
-0, 936000, 152064, 0x71b7a5ad
-0, 939600, 152064, 0xc6bba1c6
-0, 943200, 152064, 0x7351f305
-0, 946800, 152064, 0x579edbba
-0, 950400, 152064, 0x90eda919
-0, 954000, 152064, 0x2833b10d
-0, 957600, 152064, 0x4b967d65
-0, 961200, 152064, 0x6e7d1702
-0, 964800, 152064, 0x59dbcf5b
-0, 968400, 152064, 0xa138847b
-0, 972000, 152064, 0xb2414e8d
-0, 975600, 152064, 0xb90497f6
-0, 979200, 152064, 0xcd728159
-0, 982800, 152064, 0x005d5bdd
-0, 986400, 152064, 0x27c88fb6
-0, 990000, 152064, 0x3ccb8a93
-0, 993600, 152064, 0xc50256dd
-0, 997200, 152064, 0x111e7dee
-0, 1000800, 152064, 0x259d4a5d
-0, 1004400, 152064, 0x9385148b
-0, 1008000, 152064, 0x74002ab0
-0, 1011600, 152064, 0xd2c74adc
-0, 1015200, 152064, 0x72854b2a
-0, 1018800, 152064, 0x638e5c08
-0, 1022400, 152064, 0x9626bbb3
-0, 1026000, 152064, 0xc107c18f
-0, 1029600, 152064, 0x8bd04578
-0, 1033200, 152064, 0xbcdb6db6
-0, 1036800, 152064, 0x9d0c81be
-0, 1040400, 152064, 0xf25106b6
-0, 1044000, 152064, 0x54c25254
-0, 1047600, 152064, 0x4bf74663
-0, 1051200, 152064, 0x0051b054
-0, 1054800, 152064, 0x5193d3d4
-0, 1058400, 152064, 0xb5d0d045
-0, 1062000, 152064, 0x350a31ca
-0, 1065600, 152064, 0xb8fb7264
-0, 1069200, 152064, 0x7fb97645
-0, 1072800, 152064, 0xcd948c41
-0, 1076400, 152064, 0x38c7570a
+#tb 0: 1/25
+0, 0, 0, 1, 152064, 0x995bb4bd
+0, 1, 1, 1, 152064, 0xad287357
+0, 2, 2, 1, 152064, 0x38fa4661
+0, 3, 3, 1, 152064, 0x8aae73cf
+0, 4, 4, 1, 152064, 0x4a13eada
+0, 5, 5, 1, 152064, 0x48b33901
+0, 6, 6, 1, 152064, 0x011487bc
+0, 7, 7, 1, 152064, 0xd4ce1925
+0, 8, 8, 1, 152064, 0x5d679ddd
+0, 9, 9, 1, 152064, 0x276cd5cf
+0, 10, 10, 1, 152064, 0x99c625f0
+0, 11, 11, 1, 152064, 0xb2f756d1
+0, 12, 12, 1, 152064, 0xb19c2978
+0, 13, 13, 1, 152064, 0xdac0ff3c
+0, 14, 14, 1, 152064, 0x3c1c8d63
+0, 15, 15, 1, 152064, 0x818ea0a8
+0, 16, 16, 1, 152064, 0xa7c122a5
+0, 17, 17, 1, 152064, 0x67ad3519
+0, 18, 18, 1, 152064, 0xc81b2a88
+0, 19, 19, 1, 152064, 0x8ae6633e
+0, 20, 20, 1, 152064, 0xed945788
+0, 21, 21, 1, 152064, 0x4c740bcb
+0, 22, 22, 1, 152064, 0xd8408d09
+0, 23, 23, 1, 152064, 0xb710e8b8
+0, 24, 24, 1, 152064, 0xb8c647b9
+0, 25, 25, 1, 152064, 0x802b2e23
+0, 26, 26, 1, 152064, 0x30672529
+0, 27, 27, 1, 152064, 0x328a72b6
+0, 28, 28, 1, 152064, 0xeb6dbe94
+0, 29, 29, 1, 152064, 0x1c19dcc5
+0, 30, 30, 1, 152064, 0xfdc6b998
+0, 31, 31, 1, 152064, 0xf9e2cd80
+0, 32, 32, 1, 152064, 0x025eb15e
+0, 33, 33, 1, 152064, 0xfd998ad8
+0, 34, 34, 1, 152064, 0x8fdf736f
+0, 35, 35, 1, 152064, 0xa5a7554a
+0, 36, 36, 1, 152064, 0xcea63304
+0, 37, 37, 1, 152064, 0xcb28ec28
+0, 38, 38, 1, 152064, 0x92efb591
+0, 39, 39, 1, 152064, 0x0f2376c3
+0, 40, 40, 1, 152064, 0xe9cb5ecf
+0, 41, 41, 1, 152064, 0xcd2d0eba
+0, 42, 42, 1, 152064, 0xd57fe4fd
+0, 43, 43, 1, 152064, 0xc486ab8e
+0, 44, 44, 1, 152064, 0x01a1f709
+0, 45, 45, 1, 152064, 0x7ac5b13a
+0, 46, 46, 1, 152064, 0x6f519279
+0, 47, 47, 1, 152064, 0xfd7cd9a0
+0, 48, 48, 1, 152064, 0xfae649d2
+0, 49, 49, 1, 152064, 0x618507ca
+0, 50, 50, 1, 152064, 0xb177bc15
+0, 51, 51, 1, 152064, 0x6fa36854
+0, 52, 52, 1, 152064, 0xc13cb77d
+0, 53, 53, 1, 152064, 0x6d40cb01
+0, 54, 54, 1, 152064, 0xa3db96a2
+0, 55, 55, 1, 152064, 0xe5ba6c99
+0, 56, 56, 1, 152064, 0xca9ff3ee
+0, 57, 57, 1, 152064, 0x6c016c65
+0, 58, 58, 1, 152064, 0xdf93ed80
+0, 59, 59, 1, 152064, 0x93112ec8
+0, 60, 60, 1, 152064, 0x8ab3ea14
+0, 61, 61, 1, 152064, 0x02f5b891
+0, 62, 62, 1, 152064, 0xdafd562b
+0, 63, 63, 1, 152064, 0xa96a2bd7
+0, 64, 64, 1, 152064, 0xdff8bc68
+0, 65, 65, 1, 152064, 0x8d956b4b
+0, 66, 66, 1, 152064, 0xb4aeb960
+0, 67, 67, 1, 152064, 0x391cf0dd
+0, 68, 68, 1, 152064, 0x03137de9
+0, 69, 69, 1, 152064, 0x2bfa8c4b
+0, 70, 70, 1, 152064, 0xfb54d3a5
+0, 71, 71, 1, 152064, 0x650146e7
+0, 72, 72, 1, 152064, 0xd3a7765f
+0, 73, 73, 1, 152064, 0x49d72b90
+0, 74, 74, 1, 152064, 0xf089b357
+0, 75, 75, 1, 152064, 0x23a2be41
+0, 76, 76, 1, 152064, 0x2ea86592
+0, 77, 77, 1, 152064, 0x99d6f56b
+0, 78, 78, 1, 152064, 0xc2ca75b9
+0, 79, 79, 1, 152064, 0x390b7278
+0, 80, 80, 1, 152064, 0x0f6d1f1e
+0, 81, 81, 1, 152064, 0x79e2a3f4
+0, 82, 82, 1, 152064, 0x51d5e1da
+0, 83, 83, 1, 152064, 0xdb57419a
+0, 84, 84, 1, 152064, 0xf90a4153
+0, 85, 85, 1, 152064, 0xd192f6c6
+0, 86, 86, 1, 152064, 0x8cd3895a
+0, 87, 87, 1, 152064, 0x0d3ec577
+0, 88, 88, 1, 152064, 0x146e8492
+0, 89, 89, 1, 152064, 0xc9939c22
+0, 90, 90, 1, 152064, 0xf1f4275e
+0, 91, 91, 1, 152064, 0xb898eb35
+0, 92, 92, 1, 152064, 0xed315ee9
+0, 93, 93, 1, 152064, 0x9046b760
+0, 94, 94, 1, 152064, 0x599a736b
+0, 95, 95, 1, 152064, 0xaef20726
+0, 96, 96, 1, 152064, 0x0d136768
+0, 97, 97, 1, 152064, 0xfe4ed2a8
+0, 98, 98, 1, 152064, 0x5a85524b
+0, 99, 99, 1, 152064, 0x6d495dd2
+0, 100, 100, 1, 152064, 0x04bdb815
+0, 101, 101, 1, 152064, 0x28aae1c5
+0, 102, 102, 1, 152064, 0xc20bc8d9
+0, 103, 103, 1, 152064, 0xa33d9b41
+0, 104, 104, 1, 152064, 0x6269cb43
+0, 105, 105, 1, 152064, 0x4f81d636
+0, 106, 106, 1, 152064, 0xc6062166
+0, 107, 107, 1, 152064, 0xb027fbcc
+0, 108, 108, 1, 152064, 0x73a7a584
+0, 109, 109, 1, 152064, 0xf67e520a
+0, 110, 110, 1, 152064, 0x94eff023
+0, 111, 111, 1, 152064, 0xef1da8e5
+0, 112, 112, 1, 152064, 0x2d9ab411
+0, 113, 113, 1, 152064, 0xf0c39b5d
+0, 114, 114, 1, 152064, 0xb2374724
+0, 115, 115, 1, 152064, 0x939a5243
+0, 116, 116, 1, 152064, 0xee3438db
+0, 117, 117, 1, 152064, 0x7da04012
+0, 118, 118, 1, 152064, 0xac611668
+0, 119, 119, 1, 152064, 0xdce3062e
+0, 120, 120, 1, 152064, 0xb57cc00e
+0, 121, 121, 1, 152064, 0xaf96b59e
+0, 122, 122, 1, 152064, 0x56789c13
+0, 123, 123, 1, 152064, 0xb1f678b5
+0, 124, 124, 1, 152064, 0xb340b8c4
+0, 125, 125, 1, 152064, 0x86e6e304
+0, 126, 126, 1, 152064, 0xa056e037
+0, 127, 127, 1, 152064, 0x16885d27
+0, 128, 128, 1, 152064, 0x9c5ac065
+0, 129, 129, 1, 152064, 0x563d5335
+0, 130, 130, 1, 152064, 0x3ca71c1e
+0, 131, 131, 1, 152064, 0xad34e16c
+0, 132, 132, 1, 152064, 0x6d074b27
+0, 133, 133, 1, 152064, 0x9b1c4909
+0, 134, 134, 1, 152064, 0xdbced198
+0, 135, 135, 1, 152064, 0x8a0ded00
+0, 136, 136, 1, 152064, 0x5ffc209b
+0, 137, 137, 1, 152064, 0x47cfd269
+0, 138, 138, 1, 152064, 0xe3c0137e
+0, 139, 139, 1, 152064, 0xcb6a5e53
+0, 140, 140, 1, 152064, 0x87cec05f
+0, 141, 141, 1, 152064, 0x92721dd2
+0, 142, 142, 1, 152064, 0x3f7d7b3b
+0, 143, 143, 1, 152064, 0xd63ef417
+0, 144, 144, 1, 152064, 0xf8e4b05a
+0, 145, 145, 1, 152064, 0xb5dcb421
+0, 146, 146, 1, 152064, 0x53c96f6a
+0, 147, 147, 1, 152064, 0x24ae98a3
+0, 148, 148, 1, 152064, 0x2e9b5fff
+0, 149, 149, 1, 152064, 0x7795bf12
+0, 150, 150, 1, 152064, 0x499d37ca
+0, 151, 151, 1, 152064, 0xfe478487
+0, 152, 152, 1, 152064, 0xcd661afb
+0, 153, 153, 1, 152064, 0x44f8bf00
+0, 154, 154, 1, 152064, 0x90b67809
+0, 155, 155, 1, 152064, 0x8f5726d1
+0, 156, 156, 1, 152064, 0x2e3c39d5
+0, 157, 157, 1, 152064, 0x4b67c4e6
+0, 158, 158, 1, 152064, 0x9fecb7cf
+0, 159, 159, 1, 152064, 0x207766ea
+0, 160, 160, 1, 152064, 0x5846bf7b
+0, 161, 161, 1, 152064, 0x4237fba1
+0, 162, 162, 1, 152064, 0x983e0cbd
+0, 163, 163, 1, 152064, 0x6be100d1
+0, 164, 164, 1, 152064, 0x9d0beb8f
+0, 165, 165, 1, 152064, 0x234b82e7
+0, 166, 166, 1, 152064, 0x83fb5ef1
+0, 167, 167, 1, 152064, 0xf503dcb2
+0, 168, 168, 1, 152064, 0x031a27f2
+0, 169, 169, 1, 152064, 0x2f1abf24
+0, 170, 170, 1, 152064, 0x54d77010
+0, 171, 171, 1, 152064, 0x049fc0fc
+0, 172, 172, 1, 152064, 0x20f2f7e7
+0, 173, 173, 1, 152064, 0xc0d57467
+0, 174, 174, 1, 152064, 0xbe464eef
+0, 175, 175, 1, 152064, 0x035c9052
+0, 176, 176, 1, 152064, 0x91cba4fb
+0, 177, 177, 1, 152064, 0x11cdbbfb
+0, 178, 178, 1, 152064, 0xe61116d5
+0, 179, 179, 1, 152064, 0x16db46b8
+0, 180, 180, 1, 152064, 0x54f30d9f
+0, 181, 181, 1, 152064, 0x211a8d2d
+0, 182, 182, 1, 152064, 0x5a74a56b
+0, 183, 183, 1, 152064, 0x0ff4ba72
+0, 184, 184, 1, 152064, 0x4c398ad6
+0, 185, 185, 1, 152064, 0x830814f0
+0, 186, 186, 1, 152064, 0xa51f4bab
+0, 187, 187, 1, 152064, 0xf3460de6
+0, 188, 188, 1, 152064, 0x7e1979a1
+0, 189, 189, 1, 152064, 0x4b3ebb3a
+0, 190, 190, 1, 152064, 0x83d1f4f8
+0, 191, 191, 1, 152064, 0xfbf08683
+0, 192, 192, 1, 152064, 0x901c07ec
+0, 193, 193, 1, 152064, 0xbc2dc1c7
+0, 194, 194, 1, 152064, 0x6e646b3b
+0, 195, 195, 1, 152064, 0x51a25aab
+0, 196, 196, 1, 152064, 0xa042ab78
+0, 197, 197, 1, 152064, 0xb972af58
+0, 198, 198, 1, 152064, 0xcdca9568
+0, 199, 199, 1, 152064, 0x17b69d1c
+0, 200, 200, 1, 152064, 0x41c43ea2
+0, 201, 201, 1, 152064, 0x195fc7a0
+0, 202, 202, 1, 152064, 0xf4cec580
+0, 203, 203, 1, 152064, 0xb3b10936
+0, 204, 204, 1, 152064, 0x102bc2ec
+0, 205, 205, 1, 152064, 0xc99d4767
+0, 206, 206, 1, 152064, 0x60c745b0
+0, 207, 207, 1, 152064, 0x8176e0cf
+0, 208, 208, 1, 152064, 0xd47e69b5
+0, 209, 209, 1, 152064, 0xacce674c
+0, 210, 210, 1, 152064, 0x031b51f8
+0, 211, 211, 1, 152064, 0x0eb681ef
+0, 212, 212, 1, 152064, 0x0b69334b
+0, 213, 213, 1, 152064, 0xda819c1f
+0, 214, 214, 1, 152064, 0xa93f62d2
+0, 215, 215, 1, 152064, 0x51374db5
+0, 216, 216, 1, 152064, 0x885dccff
+0, 217, 217, 1, 152064, 0xd0780444
+0, 218, 218, 1, 152064, 0xa31733ca
+0, 219, 219, 1, 152064, 0x3f3de84e
+0, 220, 220, 1, 152064, 0x2af2b2c3
+0, 221, 221, 1, 152064, 0xa62dceae
+0, 222, 222, 1, 152064, 0xca1cffd1
+0, 223, 223, 1, 152064, 0x3c7d561b
+0, 224, 224, 1, 152064, 0xbc04130a
+0, 225, 225, 1, 152064, 0xbd2829ae
+0, 226, 226, 1, 152064, 0xdbbb9820
+0, 227, 227, 1, 152064, 0xfc3ef628
+0, 228, 228, 1, 152064, 0xd5da3ec3
+0, 229, 229, 1, 152064, 0x62d5fcc1
+0, 230, 230, 1, 152064, 0x455a8dae
+0, 231, 231, 1, 152064, 0x421c9147
+0, 232, 232, 1, 152064, 0x6a168484
+0, 233, 233, 1, 152064, 0x7ba15d32
+0, 234, 234, 1, 152064, 0xd089ed27
+0, 235, 235, 1, 152064, 0x8fc4d894
+0, 236, 236, 1, 152064, 0x99e47125
+0, 237, 237, 1, 152064, 0xf55dda68
+0, 238, 238, 1, 152064, 0x6bf06cf1
+0, 239, 239, 1, 152064, 0x7dc41a9d
+0, 240, 240, 1, 152064, 0x78b84019
+0, 241, 241, 1, 152064, 0x85ae8973
+0, 242, 242, 1, 152064, 0x7b7aeabe
+0, 243, 243, 1, 152064, 0xf9a8f6bf
+0, 244, 244, 1, 152064, 0xe195ddcd
+0, 245, 245, 1, 152064, 0x83edffe9
+0, 246, 246, 1, 152064, 0x59cce97a
+0, 247, 247, 1, 152064, 0x15268af1
+0, 248, 248, 1, 152064, 0x270cca95
+0, 249, 249, 1, 152064, 0x8bced1f9
+0, 250, 250, 1, 152064, 0x08ee5cec
+0, 251, 251, 1, 152064, 0x01e74f95
+0, 252, 252, 1, 152064, 0x7e19238f
+0, 253, 253, 1, 152064, 0x6bcb2b9d
+0, 254, 254, 1, 152064, 0x58111385
+0, 255, 255, 1, 152064, 0x6c7aa1f7
+0, 256, 256, 1, 152064, 0xb713a822
+0, 257, 257, 1, 152064, 0x1d645cee
+0, 258, 258, 1, 152064, 0x9c592969
+0, 259, 259, 1, 152064, 0x2472769e
+0, 260, 260, 1, 152064, 0x71b7a5ad
+0, 261, 261, 1, 152064, 0xc6bba1c6
+0, 262, 262, 1, 152064, 0x7351f305
+0, 263, 263, 1, 152064, 0x579edbba
+0, 264, 264, 1, 152064, 0x90eda919
+0, 265, 265, 1, 152064, 0x2833b10d
+0, 266, 266, 1, 152064, 0x4b967d65
+0, 267, 267, 1, 152064, 0x6e7d1702
+0, 268, 268, 1, 152064, 0x59dbcf5b
+0, 269, 269, 1, 152064, 0xa138847b
+0, 270, 270, 1, 152064, 0xb2414e8d
+0, 271, 271, 1, 152064, 0xb90497f6
+0, 272, 272, 1, 152064, 0xcd728159
+0, 273, 273, 1, 152064, 0x005d5bdd
+0, 274, 274, 1, 152064, 0x27c88fb6
+0, 275, 275, 1, 152064, 0x3ccb8a93
+0, 276, 276, 1, 152064, 0xc50256dd
+0, 277, 277, 1, 152064, 0x111e7dee
+0, 278, 278, 1, 152064, 0x259d4a5d
+0, 279, 279, 1, 152064, 0x9385148b
+0, 280, 280, 1, 152064, 0x74002ab0
+0, 281, 281, 1, 152064, 0xd2c74adc
+0, 282, 282, 1, 152064, 0x72854b2a
+0, 283, 283, 1, 152064, 0x638e5c08
+0, 284, 284, 1, 152064, 0x9626bbb3
+0, 285, 285, 1, 152064, 0xc107c18f
+0, 286, 286, 1, 152064, 0x8bd04578
+0, 287, 287, 1, 152064, 0xbcdb6db6
+0, 288, 288, 1, 152064, 0x9d0c81be
+0, 289, 289, 1, 152064, 0xf25106b6
+0, 290, 290, 1, 152064, 0x54c25254
+0, 291, 291, 1, 152064, 0x4bf74663
+0, 292, 292, 1, 152064, 0x0051b054
+0, 293, 293, 1, 152064, 0x5193d3d4
+0, 294, 294, 1, 152064, 0xb5d0d045
+0, 295, 295, 1, 152064, 0x350a31ca
+0, 296, 296, 1, 152064, 0xb8fb7264
+0, 297, 297, 1, 152064, 0x7fb97645
+0, 298, 298, 1, 152064, 0xcd948c41
+0, 299, 299, 1, 152064, 0x38c7570a
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-hpcadq_brcm_b b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-hpcadq_brcm_b
index b5778dd..49249b3 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-hpcadq_brcm_b
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-hpcadq_brcm_b
@@ -1,300 +1,301 @@
-0, 0, 152064, 0xf3c68dea
-0, 3600, 152064, 0xf52d483f
-0, 7200, 152064, 0x612f1792
-0, 10800, 152064, 0x4df34726
-0, 14400, 152064, 0xfed7c058
-0, 18000, 152064, 0x2d48025c
-0, 21600, 152064, 0x03544ab9
-0, 25200, 152064, 0x20cadfc5
-0, 28800, 152064, 0x7cd3672e
-0, 32400, 152064, 0x5f2b9ede
-0, 36000, 152064, 0xc0bbdf75
-0, 39600, 152064, 0x95571e7c
-0, 43200, 152064, 0x0d1afc5b
-0, 46800, 152064, 0x9c91c11f
-0, 50400, 152064, 0x73e667e4
-0, 54000, 152064, 0xfb7f8892
-0, 57600, 152064, 0x5707f566
-0, 61200, 152064, 0x21032449
-0, 64800, 152064, 0x199e20b7
-0, 68400, 152064, 0x23213179
-0, 72000, 152064, 0x29812daa
-0, 75600, 152064, 0x04e3eb6b
-0, 79200, 152064, 0xab206165
-0, 82800, 152064, 0x392fbf7b
-0, 86400, 152064, 0x137a1c6a
-0, 90000, 152064, 0x9caff265
-0, 93600, 152064, 0x6becf046
-0, 97200, 152064, 0xfc2c3ba6
-0, 100800, 152064, 0xcf4b9b4c
-0, 104400, 152064, 0x4e2ebd37
-0, 108000, 152064, 0xcd419daa
-0, 111600, 152064, 0xe12294b0
-0, 115200, 152064, 0x6bda7493
-0, 118800, 152064, 0xefbf5d0b
-0, 122400, 152064, 0x9500458a
-0, 126000, 152064, 0x6b5d212e
-0, 129600, 152064, 0xb928fc31
-0, 133200, 152064, 0x64f2bb2f
-0, 136800, 152064, 0xf93a724d
-0, 140400, 152064, 0xdd0d32c0
-0, 144000, 152064, 0xe1b51d95
-0, 147600, 152064, 0xbb43d295
-0, 151200, 152064, 0x6dcea069
-0, 154800, 152064, 0x89d79805
-0, 158400, 152064, 0x50b5dd43
-0, 162000, 152064, 0xe3099e3f
-0, 165600, 152064, 0x003b6ace
-0, 169200, 152064, 0x2213b672
-0, 172800, 152064, 0x5b273093
-0, 176400, 152064, 0xdbfbd9bf
-0, 180000, 152064, 0xf26b89d0
-0, 183600, 152064, 0x1470527e
-0, 187200, 152064, 0x0e668970
-0, 190800, 152064, 0x00218692
-0, 194400, 152064, 0xaabf79a8
-0, 198000, 152064, 0xf68b4663
-0, 201600, 152064, 0x4c08d01f
-0, 205200, 152064, 0x48e75380
-0, 208800, 152064, 0x4b8be58f
-0, 212400, 152064, 0x8a6c1365
-0, 216000, 152064, 0x9439ca02
-0, 219600, 152064, 0x831d9855
-0, 223200, 152064, 0xff031ffd
-0, 226800, 152064, 0x3680f4bc
-0, 230400, 152064, 0x794c95a4
-0, 234000, 152064, 0x23e53349
-0, 237600, 152064, 0x85307117
-0, 241200, 152064, 0x0bc0bf5a
-0, 244800, 152064, 0xc79f46c8
-0, 248400, 152064, 0x48be4e21
-0, 252000, 152064, 0x2ad89b4f
-0, 255600, 152064, 0xd454f9a9
-0, 259200, 152064, 0x64852f6d
-0, 262800, 152064, 0xcb7b0c05
-0, 266400, 152064, 0x4e108ced
-0, 270000, 152064, 0xf5e5a37b
-0, 273600, 152064, 0x224e29c7
-0, 277200, 152064, 0xad90d3c2
-0, 280800, 152064, 0x5ddb5d05
-0, 284400, 152064, 0x4ebf4337
-0, 288000, 152064, 0x7e2bfeed
-0, 291600, 152064, 0x00e884c7
-0, 295200, 152064, 0xa4f6a534
-0, 298800, 152064, 0x622f1511
-0, 302400, 152064, 0x8d99233d
-0, 306000, 152064, 0x5910d02c
-0, 309600, 152064, 0x20d6706c
-0, 313200, 152064, 0x8e30a417
-0, 316800, 152064, 0x180d745a
-0, 320400, 152064, 0xc25189b9
-0, 324000, 152064, 0x909101ad
-0, 327600, 152064, 0x9967be1c
-0, 331200, 152064, 0x72ff3206
-0, 334800, 152064, 0x48d07f48
-0, 338400, 152064, 0x7f8244b7
-0, 342000, 152064, 0xf871e21e
-0, 345600, 152064, 0xd4743610
-0, 349200, 152064, 0xc2c7a7b1
-0, 352800, 152064, 0x95be1a75
-0, 356400, 152064, 0x44972b2e
-0, 360000, 152064, 0xa6036c4f
-0, 363600, 152064, 0xecdd8dd6
-0, 367200, 152064, 0xbb7e8551
-0, 370800, 152064, 0x42916e6c
-0, 374400, 152064, 0x972db010
-0, 378000, 152064, 0x80dab6a0
-0, 381600, 152064, 0xc753ecdb
-0, 385200, 152064, 0x0823bffa
-0, 388800, 152064, 0x80876b2d
-0, 392400, 152064, 0x4a8b2118
-0, 396000, 152064, 0x0be2c13d
-0, 399600, 152064, 0xa6966e4f
-0, 403200, 152064, 0xf6a57650
-0, 406800, 152064, 0x49d66fd4
-0, 410400, 152064, 0x21d92047
-0, 414000, 152064, 0x155f20a8
-0, 417600, 152064, 0x5ab90c1d
-0, 421200, 152064, 0xa0c31337
-0, 424800, 152064, 0xd20de1d6
-0, 428400, 152064, 0x300ad916
-0, 432000, 152064, 0xbcb89eb5
-0, 435600, 152064, 0x08759342
-0, 439200, 152064, 0xa5d06e72
-0, 442800, 152064, 0x3b4c537f
-0, 446400, 152064, 0x7f48912b
-0, 450000, 152064, 0x200dbd1f
-0, 453600, 152064, 0x918abfde
-0, 457200, 152064, 0xd8072cdf
-0, 460800, 152064, 0x89d2902b
-0, 464400, 152064, 0xcd2e2e3c
-0, 468000, 152064, 0xf343e4a2
-0, 471600, 152064, 0xc424acad
-0, 475200, 152064, 0xf71e3031
-0, 478800, 152064, 0xf1bc1179
-0, 482400, 152064, 0x9af58d24
-0, 486000, 152064, 0x48a4d01e
-0, 489600, 152064, 0xcf24f721
-0, 493200, 152064, 0x5bc7b4f3
-0, 496800, 152064, 0x8763fc59
-0, 500400, 152064, 0xb6954051
-0, 504000, 152064, 0x044ba446
-0, 507600, 152064, 0xdaaaee7e
-0, 511200, 152064, 0x8eac550d
-0, 514800, 152064, 0x5191d08c
-0, 518400, 152064, 0x3cd76d43
-0, 522000, 152064, 0xf01f8fa9
-0, 525600, 152064, 0x0e283e9b
-0, 529200, 152064, 0x7cef69ee
-0, 532800, 152064, 0xc8e332bc
-0, 536400, 152064, 0x5b1aa484
-0, 540000, 152064, 0x3975234f
-0, 543600, 152064, 0x52b8661e
-0, 547200, 152064, 0xb4b8fed8
-0, 550800, 152064, 0x5aff9f70
-0, 554400, 152064, 0x7b575735
-0, 558000, 152064, 0x77d51523
-0, 561600, 152064, 0xf5131eba
-0, 565200, 152064, 0x4bd2b1ad
-0, 568800, 152064, 0xccfc8dca
-0, 572400, 152064, 0xcf245472
-0, 576000, 152064, 0xe055adf5
-0, 579600, 152064, 0x2a90e171
-0, 583200, 152064, 0x1bd8ea64
-0, 586800, 152064, 0x32f1d794
-0, 590400, 152064, 0xc938c42a
-0, 594000, 152064, 0x12b5644f
-0, 597600, 152064, 0x99003711
-0, 601200, 152064, 0xaecfad1c
-0, 604800, 152064, 0x94b00ae1
-0, 608400, 152064, 0xbb4f982f
-0, 612000, 152064, 0x6f7f5dc1
-0, 615600, 152064, 0x7be7c2cb
-0, 619200, 152064, 0x3b2ee4d3
-0, 622800, 152064, 0xc75f5666
-0, 626400, 152064, 0xff7a3ede
-0, 630000, 152064, 0x55866b59
-0, 633600, 152064, 0x408b8455
-0, 637200, 152064, 0x96c4ab66
-0, 640800, 152064, 0x1d87f575
-0, 644400, 152064, 0x3a3b17ac
-0, 648000, 152064, 0x9c99e591
-0, 651600, 152064, 0xc1fc663d
-0, 655200, 152064, 0x17b982dd
-0, 658800, 152064, 0x24fe9dad
-0, 662400, 152064, 0xea8760ee
-0, 666000, 152064, 0x23dcefad
-0, 669600, 152064, 0xee6d23f0
-0, 673200, 152064, 0xfddc1962
-0, 676800, 152064, 0xb23190df
-0, 680400, 152064, 0xf066a595
-0, 684000, 152064, 0x2200fef8
-0, 687600, 152064, 0x5491ab2f
-0, 691200, 152064, 0xea93fa58
-0, 694800, 152064, 0x3e13d4f4
-0, 698400, 152064, 0x3dda841d
-0, 702000, 152064, 0xfc243577
-0, 705600, 152064, 0xca4a9127
-0, 709200, 152064, 0x41908ec0
-0, 712800, 152064, 0x10a758bd
-0, 716400, 152064, 0x6a849e5b
-0, 720000, 152064, 0xb55a1f2b
-0, 723600, 152064, 0x2bfe9627
-0, 727200, 152064, 0x2bfca28c
-0, 730800, 152064, 0xd166f336
-0, 734400, 152064, 0x9facb32b
-0, 738000, 152064, 0x6a672475
-0, 741600, 152064, 0xc7b219cf
-0, 745200, 152064, 0x2b43ca53
-0, 748800, 152064, 0x43b542c4
-0, 752400, 152064, 0xdc654337
-0, 756000, 152064, 0x68003d7c
-0, 759600, 152064, 0x3cb85724
-0, 763200, 152064, 0x422701c2
-0, 766800, 152064, 0x1c667870
-0, 770400, 152064, 0x75ef3230
-0, 774000, 152064, 0x0ac82643
-0, 777600, 152064, 0x3eb3a0be
-0, 781200, 152064, 0x482bd77e
-0, 784800, 152064, 0xd3ce1171
-0, 788400, 152064, 0xeaefc7e4
-0, 792000, 152064, 0xa9c67939
-0, 795600, 152064, 0x0af0a25b
-0, 799200, 152064, 0xd094d95a
-0, 802800, 152064, 0xfda42fc6
-0, 806400, 152064, 0x4669f952
-0, 810000, 152064, 0x52d40e98
-0, 813600, 152064, 0x27c36cd1
-0, 817200, 152064, 0xa103b6ce
-0, 820800, 152064, 0x2be9026d
-0, 824400, 152064, 0x2f4ecc59
-0, 828000, 152064, 0x53144cef
-0, 831600, 152064, 0x15d54fc9
-0, 835200, 152064, 0x7e302db7
-0, 838800, 152064, 0x82521901
-0, 842400, 152064, 0x1123cdb6
-0, 846000, 152064, 0x3185878a
-0, 849600, 152064, 0xbb294983
-0, 853200, 152064, 0x83d9fe66
-0, 856800, 152064, 0xede9fb08
-0, 860400, 152064, 0xa543b551
-0, 864000, 152064, 0x39e82734
-0, 867600, 152064, 0xd0447fb5
-0, 871200, 152064, 0x8cc6f502
-0, 874800, 152064, 0xda8d1da8
-0, 878400, 152064, 0xcafdccca
-0, 882000, 152064, 0xbf0e04f4
-0, 885600, 152064, 0x0c6eefec
-0, 889200, 152064, 0xb9026d39
-0, 892800, 152064, 0x0121a7a8
-0, 896400, 152064, 0x453ebbc6
-0, 900000, 152064, 0x14ae15e3
-0, 903600, 152064, 0x51d618e1
-0, 907200, 152064, 0x2254f452
-0, 910800, 152064, 0x8c360633
-0, 914400, 152064, 0x8704d9bc
-0, 918000, 152064, 0xe5d48301
-0, 921600, 152064, 0xf25b7b3f
-0, 925200, 152064, 0xd2ad3b73
-0, 928800, 152064, 0x53db0387
-0, 932400, 152064, 0x2486341c
-0, 936000, 152064, 0x4a24570b
-0, 939600, 152064, 0x0694620a
-0, 943200, 152064, 0xbbc2a302
-0, 946800, 152064, 0x08ad9c02
-0, 950400, 152064, 0x601a63ab
-0, 954000, 152064, 0xe4234a48
-0, 957600, 152064, 0x07702235
-0, 961200, 152064, 0x719dbecf
-0, 964800, 152064, 0xf301a7ad
-0, 968400, 152064, 0xf15c70c3
-0, 972000, 152064, 0x0ab93386
-0, 975600, 152064, 0x99c05adb
-0, 979200, 152064, 0x9ed43530
-0, 982800, 152064, 0xa2f62122
-0, 986400, 152064, 0xf16f4525
-0, 990000, 152064, 0xa3403b4a
-0, 993600, 152064, 0x95521096
-0, 997200, 152064, 0x0d412988
-0, 1000800, 152064, 0x829e080a
-0, 1004400, 152064, 0x0805c1b5
-0, 1008000, 152064, 0xa136be48
-0, 1011600, 152064, 0x0f8de228
-0, 1015200, 152064, 0x272cf2d3
-0, 1018800, 152064, 0xa1df2a5e
-0, 1022400, 152064, 0xf9db8350
-0, 1026000, 152064, 0x5536997d
-0, 1029600, 152064, 0xab83e81e
-0, 1033200, 152064, 0xec791b49
-0, 1036800, 152064, 0x04d03e19
-0, 1040400, 152064, 0xd6a2bd21
-0, 1044000, 152064, 0x2d35f0aa
-0, 1047600, 152064, 0x137bf715
-0, 1051200, 152064, 0x56ef5ae1
-0, 1054800, 152064, 0x9bb5821e
-0, 1058400, 152064, 0x533c7fff
-0, 1062000, 152064, 0x469ad380
-0, 1065600, 152064, 0x75710e84
-0, 1069200, 152064, 0xbbd72551
-0, 1072800, 152064, 0xf1137026
-0, 1076400, 152064, 0x6238412b
+#tb 0: 1/25
+0, 0, 0, 1, 152064, 0xf3c68dea
+0, 1, 1, 1, 152064, 0xf52d483f
+0, 2, 2, 1, 152064, 0x612f1792
+0, 3, 3, 1, 152064, 0x4df34726
+0, 4, 4, 1, 152064, 0xfed7c058
+0, 5, 5, 1, 152064, 0x2d48025c
+0, 6, 6, 1, 152064, 0x03544ab9
+0, 7, 7, 1, 152064, 0x20cadfc5
+0, 8, 8, 1, 152064, 0x7cd3672e
+0, 9, 9, 1, 152064, 0x5f2b9ede
+0, 10, 10, 1, 152064, 0xc0bbdf75
+0, 11, 11, 1, 152064, 0x95571e7c
+0, 12, 12, 1, 152064, 0x0d1afc5b
+0, 13, 13, 1, 152064, 0x9c91c11f
+0, 14, 14, 1, 152064, 0x73e667e4
+0, 15, 15, 1, 152064, 0xfb7f8892
+0, 16, 16, 1, 152064, 0x5707f566
+0, 17, 17, 1, 152064, 0x21032449
+0, 18, 18, 1, 152064, 0x199e20b7
+0, 19, 19, 1, 152064, 0x23213179
+0, 20, 20, 1, 152064, 0x29812daa
+0, 21, 21, 1, 152064, 0x04e3eb6b
+0, 22, 22, 1, 152064, 0xab206165
+0, 23, 23, 1, 152064, 0x392fbf7b
+0, 24, 24, 1, 152064, 0x137a1c6a
+0, 25, 25, 1, 152064, 0x9caff265
+0, 26, 26, 1, 152064, 0x6becf046
+0, 27, 27, 1, 152064, 0xfc2c3ba6
+0, 28, 28, 1, 152064, 0xcf4b9b4c
+0, 29, 29, 1, 152064, 0x4e2ebd37
+0, 30, 30, 1, 152064, 0xcd419daa
+0, 31, 31, 1, 152064, 0xe12294b0
+0, 32, 32, 1, 152064, 0x6bda7493
+0, 33, 33, 1, 152064, 0xefbf5d0b
+0, 34, 34, 1, 152064, 0x9500458a
+0, 35, 35, 1, 152064, 0x6b5d212e
+0, 36, 36, 1, 152064, 0xb928fc31
+0, 37, 37, 1, 152064, 0x64f2bb2f
+0, 38, 38, 1, 152064, 0xf93a724d
+0, 39, 39, 1, 152064, 0xdd0d32c0
+0, 40, 40, 1, 152064, 0xe1b51d95
+0, 41, 41, 1, 152064, 0xbb43d295
+0, 42, 42, 1, 152064, 0x6dcea069
+0, 43, 43, 1, 152064, 0x89d79805
+0, 44, 44, 1, 152064, 0x50b5dd43
+0, 45, 45, 1, 152064, 0xe3099e3f
+0, 46, 46, 1, 152064, 0x003b6ace
+0, 47, 47, 1, 152064, 0x2213b672
+0, 48, 48, 1, 152064, 0x5b273093
+0, 49, 49, 1, 152064, 0xdbfbd9bf
+0, 50, 50, 1, 152064, 0xf26b89d0
+0, 51, 51, 1, 152064, 0x1470527e
+0, 52, 52, 1, 152064, 0x0e668970
+0, 53, 53, 1, 152064, 0x00218692
+0, 54, 54, 1, 152064, 0xaabf79a8
+0, 55, 55, 1, 152064, 0xf68b4663
+0, 56, 56, 1, 152064, 0x4c08d01f
+0, 57, 57, 1, 152064, 0x48e75380
+0, 58, 58, 1, 152064, 0x4b8be58f
+0, 59, 59, 1, 152064, 0x8a6c1365
+0, 60, 60, 1, 152064, 0x9439ca02
+0, 61, 61, 1, 152064, 0x831d9855
+0, 62, 62, 1, 152064, 0xff031ffd
+0, 63, 63, 1, 152064, 0x3680f4bc
+0, 64, 64, 1, 152064, 0x794c95a4
+0, 65, 65, 1, 152064, 0x23e53349
+0, 66, 66, 1, 152064, 0x85307117
+0, 67, 67, 1, 152064, 0x0bc0bf5a
+0, 68, 68, 1, 152064, 0xc79f46c8
+0, 69, 69, 1, 152064, 0x48be4e21
+0, 70, 70, 1, 152064, 0x2ad89b4f
+0, 71, 71, 1, 152064, 0xd454f9a9
+0, 72, 72, 1, 152064, 0x64852f6d
+0, 73, 73, 1, 152064, 0xcb7b0c05
+0, 74, 74, 1, 152064, 0x4e108ced
+0, 75, 75, 1, 152064, 0xf5e5a37b
+0, 76, 76, 1, 152064, 0x224e29c7
+0, 77, 77, 1, 152064, 0xad90d3c2
+0, 78, 78, 1, 152064, 0x5ddb5d05
+0, 79, 79, 1, 152064, 0x4ebf4337
+0, 80, 80, 1, 152064, 0x7e2bfeed
+0, 81, 81, 1, 152064, 0x00e884c7
+0, 82, 82, 1, 152064, 0xa4f6a534
+0, 83, 83, 1, 152064, 0x622f1511
+0, 84, 84, 1, 152064, 0x8d99233d
+0, 85, 85, 1, 152064, 0x5910d02c
+0, 86, 86, 1, 152064, 0x20d6706c
+0, 87, 87, 1, 152064, 0x8e30a417
+0, 88, 88, 1, 152064, 0x180d745a
+0, 89, 89, 1, 152064, 0xc25189b9
+0, 90, 90, 1, 152064, 0x909101ad
+0, 91, 91, 1, 152064, 0x9967be1c
+0, 92, 92, 1, 152064, 0x72ff3206
+0, 93, 93, 1, 152064, 0x48d07f48
+0, 94, 94, 1, 152064, 0x7f8244b7
+0, 95, 95, 1, 152064, 0xf871e21e
+0, 96, 96, 1, 152064, 0xd4743610
+0, 97, 97, 1, 152064, 0xc2c7a7b1
+0, 98, 98, 1, 152064, 0x95be1a75
+0, 99, 99, 1, 152064, 0x44972b2e
+0, 100, 100, 1, 152064, 0xa6036c4f
+0, 101, 101, 1, 152064, 0xecdd8dd6
+0, 102, 102, 1, 152064, 0xbb7e8551
+0, 103, 103, 1, 152064, 0x42916e6c
+0, 104, 104, 1, 152064, 0x972db010
+0, 105, 105, 1, 152064, 0x80dab6a0
+0, 106, 106, 1, 152064, 0xc753ecdb
+0, 107, 107, 1, 152064, 0x0823bffa
+0, 108, 108, 1, 152064, 0x80876b2d
+0, 109, 109, 1, 152064, 0x4a8b2118
+0, 110, 110, 1, 152064, 0x0be2c13d
+0, 111, 111, 1, 152064, 0xa6966e4f
+0, 112, 112, 1, 152064, 0xf6a57650
+0, 113, 113, 1, 152064, 0x49d66fd4
+0, 114, 114, 1, 152064, 0x21d92047
+0, 115, 115, 1, 152064, 0x155f20a8
+0, 116, 116, 1, 152064, 0x5ab90c1d
+0, 117, 117, 1, 152064, 0xa0c31337
+0, 118, 118, 1, 152064, 0xd20de1d6
+0, 119, 119, 1, 152064, 0x300ad916
+0, 120, 120, 1, 152064, 0xbcb89eb5
+0, 121, 121, 1, 152064, 0x08759342
+0, 122, 122, 1, 152064, 0xa5d06e72
+0, 123, 123, 1, 152064, 0x3b4c537f
+0, 124, 124, 1, 152064, 0x7f48912b
+0, 125, 125, 1, 152064, 0x200dbd1f
+0, 126, 126, 1, 152064, 0x918abfde
+0, 127, 127, 1, 152064, 0xd8072cdf
+0, 128, 128, 1, 152064, 0x89d2902b
+0, 129, 129, 1, 152064, 0xcd2e2e3c
+0, 130, 130, 1, 152064, 0xf343e4a2
+0, 131, 131, 1, 152064, 0xc424acad
+0, 132, 132, 1, 152064, 0xf71e3031
+0, 133, 133, 1, 152064, 0xf1bc1179
+0, 134, 134, 1, 152064, 0x9af58d24
+0, 135, 135, 1, 152064, 0x48a4d01e
+0, 136, 136, 1, 152064, 0xcf24f721
+0, 137, 137, 1, 152064, 0x5bc7b4f3
+0, 138, 138, 1, 152064, 0x8763fc59
+0, 139, 139, 1, 152064, 0xb6954051
+0, 140, 140, 1, 152064, 0x044ba446
+0, 141, 141, 1, 152064, 0xdaaaee7e
+0, 142, 142, 1, 152064, 0x8eac550d
+0, 143, 143, 1, 152064, 0x5191d08c
+0, 144, 144, 1, 152064, 0x3cd76d43
+0, 145, 145, 1, 152064, 0xf01f8fa9
+0, 146, 146, 1, 152064, 0x0e283e9b
+0, 147, 147, 1, 152064, 0x7cef69ee
+0, 148, 148, 1, 152064, 0xc8e332bc
+0, 149, 149, 1, 152064, 0x5b1aa484
+0, 150, 150, 1, 152064, 0x3975234f
+0, 151, 151, 1, 152064, 0x52b8661e
+0, 152, 152, 1, 152064, 0xb4b8fed8
+0, 153, 153, 1, 152064, 0x5aff9f70
+0, 154, 154, 1, 152064, 0x7b575735
+0, 155, 155, 1, 152064, 0x77d51523
+0, 156, 156, 1, 152064, 0xf5131eba
+0, 157, 157, 1, 152064, 0x4bd2b1ad
+0, 158, 158, 1, 152064, 0xccfc8dca
+0, 159, 159, 1, 152064, 0xcf245472
+0, 160, 160, 1, 152064, 0xe055adf5
+0, 161, 161, 1, 152064, 0x2a90e171
+0, 162, 162, 1, 152064, 0x1bd8ea64
+0, 163, 163, 1, 152064, 0x32f1d794
+0, 164, 164, 1, 152064, 0xc938c42a
+0, 165, 165, 1, 152064, 0x12b5644f
+0, 166, 166, 1, 152064, 0x99003711
+0, 167, 167, 1, 152064, 0xaecfad1c
+0, 168, 168, 1, 152064, 0x94b00ae1
+0, 169, 169, 1, 152064, 0xbb4f982f
+0, 170, 170, 1, 152064, 0x6f7f5dc1
+0, 171, 171, 1, 152064, 0x7be7c2cb
+0, 172, 172, 1, 152064, 0x3b2ee4d3
+0, 173, 173, 1, 152064, 0xc75f5666
+0, 174, 174, 1, 152064, 0xff7a3ede
+0, 175, 175, 1, 152064, 0x55866b59
+0, 176, 176, 1, 152064, 0x408b8455
+0, 177, 177, 1, 152064, 0x96c4ab66
+0, 178, 178, 1, 152064, 0x1d87f575
+0, 179, 179, 1, 152064, 0x3a3b17ac
+0, 180, 180, 1, 152064, 0x9c99e591
+0, 181, 181, 1, 152064, 0xc1fc663d
+0, 182, 182, 1, 152064, 0x17b982dd
+0, 183, 183, 1, 152064, 0x24fe9dad
+0, 184, 184, 1, 152064, 0xea8760ee
+0, 185, 185, 1, 152064, 0x23dcefad
+0, 186, 186, 1, 152064, 0xee6d23f0
+0, 187, 187, 1, 152064, 0xfddc1962
+0, 188, 188, 1, 152064, 0xb23190df
+0, 189, 189, 1, 152064, 0xf066a595
+0, 190, 190, 1, 152064, 0x2200fef8
+0, 191, 191, 1, 152064, 0x5491ab2f
+0, 192, 192, 1, 152064, 0xea93fa58
+0, 193, 193, 1, 152064, 0x3e13d4f4
+0, 194, 194, 1, 152064, 0x3dda841d
+0, 195, 195, 1, 152064, 0xfc243577
+0, 196, 196, 1, 152064, 0xca4a9127
+0, 197, 197, 1, 152064, 0x41908ec0
+0, 198, 198, 1, 152064, 0x10a758bd
+0, 199, 199, 1, 152064, 0x6a849e5b
+0, 200, 200, 1, 152064, 0xb55a1f2b
+0, 201, 201, 1, 152064, 0x2bfe9627
+0, 202, 202, 1, 152064, 0x2bfca28c
+0, 203, 203, 1, 152064, 0xd166f336
+0, 204, 204, 1, 152064, 0x9facb32b
+0, 205, 205, 1, 152064, 0x6a672475
+0, 206, 206, 1, 152064, 0xc7b219cf
+0, 207, 207, 1, 152064, 0x2b43ca53
+0, 208, 208, 1, 152064, 0x43b542c4
+0, 209, 209, 1, 152064, 0xdc654337
+0, 210, 210, 1, 152064, 0x68003d7c
+0, 211, 211, 1, 152064, 0x3cb85724
+0, 212, 212, 1, 152064, 0x422701c2
+0, 213, 213, 1, 152064, 0x1c667870
+0, 214, 214, 1, 152064, 0x75ef3230
+0, 215, 215, 1, 152064, 0x0ac82643
+0, 216, 216, 1, 152064, 0x3eb3a0be
+0, 217, 217, 1, 152064, 0x482bd77e
+0, 218, 218, 1, 152064, 0xd3ce1171
+0, 219, 219, 1, 152064, 0xeaefc7e4
+0, 220, 220, 1, 152064, 0xa9c67939
+0, 221, 221, 1, 152064, 0x0af0a25b
+0, 222, 222, 1, 152064, 0xd094d95a
+0, 223, 223, 1, 152064, 0xfda42fc6
+0, 224, 224, 1, 152064, 0x4669f952
+0, 225, 225, 1, 152064, 0x52d40e98
+0, 226, 226, 1, 152064, 0x27c36cd1
+0, 227, 227, 1, 152064, 0xa103b6ce
+0, 228, 228, 1, 152064, 0x2be9026d
+0, 229, 229, 1, 152064, 0x2f4ecc59
+0, 230, 230, 1, 152064, 0x53144cef
+0, 231, 231, 1, 152064, 0x15d54fc9
+0, 232, 232, 1, 152064, 0x7e302db7
+0, 233, 233, 1, 152064, 0x82521901
+0, 234, 234, 1, 152064, 0x1123cdb6
+0, 235, 235, 1, 152064, 0x3185878a
+0, 236, 236, 1, 152064, 0xbb294983
+0, 237, 237, 1, 152064, 0x83d9fe66
+0, 238, 238, 1, 152064, 0xede9fb08
+0, 239, 239, 1, 152064, 0xa543b551
+0, 240, 240, 1, 152064, 0x39e82734
+0, 241, 241, 1, 152064, 0xd0447fb5
+0, 242, 242, 1, 152064, 0x8cc6f502
+0, 243, 243, 1, 152064, 0xda8d1da8
+0, 244, 244, 1, 152064, 0xcafdccca
+0, 245, 245, 1, 152064, 0xbf0e04f4
+0, 246, 246, 1, 152064, 0x0c6eefec
+0, 247, 247, 1, 152064, 0xb9026d39
+0, 248, 248, 1, 152064, 0x0121a7a8
+0, 249, 249, 1, 152064, 0x453ebbc6
+0, 250, 250, 1, 152064, 0x14ae15e3
+0, 251, 251, 1, 152064, 0x51d618e1
+0, 252, 252, 1, 152064, 0x2254f452
+0, 253, 253, 1, 152064, 0x8c360633
+0, 254, 254, 1, 152064, 0x8704d9bc
+0, 255, 255, 1, 152064, 0xe5d48301
+0, 256, 256, 1, 152064, 0xf25b7b3f
+0, 257, 257, 1, 152064, 0xd2ad3b73
+0, 258, 258, 1, 152064, 0x53db0387
+0, 259, 259, 1, 152064, 0x2486341c
+0, 260, 260, 1, 152064, 0x4a24570b
+0, 261, 261, 1, 152064, 0x0694620a
+0, 262, 262, 1, 152064, 0xbbc2a302
+0, 263, 263, 1, 152064, 0x08ad9c02
+0, 264, 264, 1, 152064, 0x601a63ab
+0, 265, 265, 1, 152064, 0xe4234a48
+0, 266, 266, 1, 152064, 0x07702235
+0, 267, 267, 1, 152064, 0x719dbecf
+0, 268, 268, 1, 152064, 0xf301a7ad
+0, 269, 269, 1, 152064, 0xf15c70c3
+0, 270, 270, 1, 152064, 0x0ab93386
+0, 271, 271, 1, 152064, 0x99c05adb
+0, 272, 272, 1, 152064, 0x9ed43530
+0, 273, 273, 1, 152064, 0xa2f62122
+0, 274, 274, 1, 152064, 0xf16f4525
+0, 275, 275, 1, 152064, 0xa3403b4a
+0, 276, 276, 1, 152064, 0x95521096
+0, 277, 277, 1, 152064, 0x0d412988
+0, 278, 278, 1, 152064, 0x829e080a
+0, 279, 279, 1, 152064, 0x0805c1b5
+0, 280, 280, 1, 152064, 0xa136be48
+0, 281, 281, 1, 152064, 0x0f8de228
+0, 282, 282, 1, 152064, 0x272cf2d3
+0, 283, 283, 1, 152064, 0xa1df2a5e
+0, 284, 284, 1, 152064, 0xf9db8350
+0, 285, 285, 1, 152064, 0x5536997d
+0, 286, 286, 1, 152064, 0xab83e81e
+0, 287, 287, 1, 152064, 0xec791b49
+0, 288, 288, 1, 152064, 0x04d03e19
+0, 289, 289, 1, 152064, 0xd6a2bd21
+0, 290, 290, 1, 152064, 0x2d35f0aa
+0, 291, 291, 1, 152064, 0x137bf715
+0, 292, 292, 1, 152064, 0x56ef5ae1
+0, 293, 293, 1, 152064, 0x9bb5821e
+0, 294, 294, 1, 152064, 0x533c7fff
+0, 295, 295, 1, 152064, 0x469ad380
+0, 296, 296, 1, 152064, 0x75710e84
+0, 297, 297, 1, 152064, 0xbbd72551
+0, 298, 298, 1, 152064, 0xf1137026
+0, 299, 299, 1, 152064, 0x6238412b
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-hpcafl_bcrm_c b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-hpcafl_bcrm_c
index a67b4ba..dbfec43 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-hpcafl_bcrm_c
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-hpcafl_bcrm_c
@@ -1,300 +1,301 @@
-0, 0, 152064, 0x502ec077
-0, 3600, 152064, 0x84807243
-0, 7200, 152064, 0xd7474a6e
-0, 10800, 152064, 0x793469bb
-0, 14400, 152064, 0xb7a0faf7
-0, 18000, 152064, 0x1d3d3cba
-0, 21600, 152064, 0xb62583de
-0, 25200, 152064, 0xc8422fb1
-0, 28800, 152064, 0x321dc699
-0, 32400, 152064, 0x7a34d350
-0, 36000, 152064, 0xaa4c302d
-0, 39600, 152064, 0x45fa7ab0
-0, 43200, 152064, 0xc7262e41
-0, 46800, 152064, 0x3550000c
-0, 50400, 152064, 0xf4bab54b
-0, 54000, 152064, 0xaccf9c1a
-0, 57600, 152064, 0x9bee20e9
-0, 61200, 152064, 0x47fb7720
-0, 64800, 152064, 0x12c63ffb
-0, 68400, 152064, 0xfa2b8b4d
-0, 72000, 152064, 0x279964bd
-0, 75600, 152064, 0xb8b01c7e
-0, 79200, 152064, 0x816fa010
-0, 82800, 152064, 0x59fe1c8c
-0, 86400, 152064, 0x13393fad
-0, 90000, 152064, 0x991a50a4
-0, 93600, 152064, 0x57df3eb7
-0, 97200, 152064, 0x744371df
-0, 100800, 152064, 0xe9f6d3ff
-0, 104400, 152064, 0xc506fba0
-0, 108000, 152064, 0x6295b90e
-0, 111600, 152064, 0xa19cee2d
-0, 115200, 152064, 0xf8c1b3ca
-0, 118800, 152064, 0x69f68ce0
-0, 122400, 152064, 0x80558bb6
-0, 126000, 152064, 0x27824fa5
-0, 129600, 152064, 0x27c929a1
-0, 133200, 152064, 0xc0fe06d1
-0, 136800, 152064, 0xc52bc58c
-0, 140400, 152064, 0x0a5363c7
-0, 144000, 152064, 0xd0f45a0d
-0, 147600, 152064, 0x274710f9
-0, 151200, 152064, 0x89d2d390
-0, 154800, 152064, 0x12a9bfb0
-0, 158400, 152064, 0x04501a93
-0, 162000, 152064, 0xf92cbbf4
-0, 165600, 152064, 0xf6d1b27d
-0, 169200, 152064, 0xe3e904c3
-0, 172800, 152064, 0x58f8516d
-0, 176400, 152064, 0x70370c2b
-0, 180000, 152064, 0xfeebc88c
-0, 183600, 152064, 0x974c6ed6
-0, 187200, 152064, 0x401bdcf2
-0, 190800, 152064, 0xfe61e278
-0, 194400, 152064, 0x96ba8bb9
-0, 198000, 152064, 0x988492fd
-0, 201600, 152064, 0xd1d913a9
-0, 205200, 152064, 0x6bc46f0e
-0, 208800, 152064, 0x695ef706
-0, 212400, 152064, 0x142045c9
-0, 216000, 152064, 0xb390ed87
-0, 219600, 152064, 0xb9e6d2e5
-0, 223200, 152064, 0xe348797f
-0, 226800, 152064, 0x1cbd29d6
-0, 230400, 152064, 0xbd7dd694
-0, 234000, 152064, 0x516873c3
-0, 237600, 152064, 0x27bba182
-0, 241200, 152064, 0x7541f920
-0, 244800, 152064, 0xfdf67042
-0, 248400, 152064, 0x6c3c7896
-0, 252000, 152064, 0xed86c467
-0, 255600, 152064, 0x4ea83ca2
-0, 259200, 152064, 0xa3e6725b
-0, 262800, 152064, 0x917f5f16
-0, 266400, 152064, 0x8cf2d2e1
-0, 270000, 152064, 0x57a8d116
-0, 273600, 152064, 0x0db267d4
-0, 277200, 152064, 0xce782ac5
-0, 280800, 152064, 0x1c9d8518
-0, 284400, 152064, 0x47598ac7
-0, 288000, 152064, 0xc5033d97
-0, 291600, 152064, 0xd7aaa3a4
-0, 295200, 152064, 0x078afc96
-0, 298800, 152064, 0xc9fe673d
-0, 302400, 152064, 0xe9284066
-0, 306000, 152064, 0xbc570982
-0, 309600, 152064, 0x0aac8574
-0, 313200, 152064, 0x098cbeee
-0, 316800, 152064, 0x19c36a9d
-0, 320400, 152064, 0x8fe4a893
-0, 324000, 152064, 0x0b652f17
-0, 327600, 152064, 0x10f2e6bf
-0, 331200, 152064, 0x7ce5634e
-0, 334800, 152064, 0x8fe4ac6c
-0, 338400, 152064, 0xcaba749e
-0, 342000, 152064, 0x5f8a0d5c
-0, 345600, 152064, 0xcaa66bbc
-0, 349200, 152064, 0xc87ae617
-0, 352800, 152064, 0xe8ef4dd7
-0, 356400, 152064, 0xdfca5a07
-0, 360000, 152064, 0x5f7eab7d
-0, 363600, 152064, 0x8a65ebbb
-0, 367200, 152064, 0x4beab4a0
-0, 370800, 152064, 0xb5e6ab30
-0, 374400, 152064, 0x8fe4f4d4
-0, 378000, 152064, 0x95bde1ca
-0, 381600, 152064, 0xcc5e3a53
-0, 385200, 152064, 0xf09f1dd7
-0, 388800, 152064, 0x10179672
-0, 392400, 152064, 0x4ad16184
-0, 396000, 152064, 0x9efa0e23
-0, 399600, 152064, 0x22f59522
-0, 403200, 152064, 0x4d38f09d
-0, 406800, 152064, 0x4c5ebf56
-0, 410400, 152064, 0xb19d5077
-0, 414000, 152064, 0xa98576b9
-0, 417600, 152064, 0x65324239
-0, 421200, 152064, 0x709e4031
-0, 424800, 152064, 0xf8e81681
-0, 428400, 152064, 0x058514e5
-0, 432000, 152064, 0xd1d1c806
-0, 435600, 152064, 0x0e4dde57
-0, 439200, 152064, 0x49e9c2bb
-0, 442800, 152064, 0x01417ce6
-0, 446400, 152064, 0xda7ebbf1
-0, 450000, 152064, 0xa22906b7
-0, 453600, 152064, 0x32e2df87
-0, 457200, 152064, 0x69917c8f
-0, 460800, 152064, 0xea8ed2cc
-0, 464400, 152064, 0x0b8d57f1
-0, 468000, 152064, 0x5f683bcd
-0, 471600, 152064, 0x5162fe2f
-0, 475200, 152064, 0x49c052f8
-0, 478800, 152064, 0x990b69ba
-0, 482400, 152064, 0xa6d4f99f
-0, 486000, 152064, 0xe79ef4da
-0, 489600, 152064, 0x5e8a3847
-0, 493200, 152064, 0x38b1e75f
-0, 496800, 152064, 0xf5c91bed
-0, 500400, 152064, 0xd59a6d26
-0, 504000, 152064, 0xc361de06
-0, 507600, 152064, 0x63ed2229
-0, 511200, 152064, 0xb8229205
-0, 514800, 152064, 0x7c6619af
-0, 518400, 152064, 0x4126b02f
-0, 522000, 152064, 0x9250b99b
-0, 525600, 152064, 0x589778f9
-0, 529200, 152064, 0xed1fa45b
-0, 532800, 152064, 0x700b6f32
-0, 536400, 152064, 0x0590df55
-0, 540000, 152064, 0x3e9c4018
-0, 543600, 152064, 0x957b8860
-0, 547200, 152064, 0x56161560
-0, 550800, 152064, 0xbc43bc3b
-0, 554400, 152064, 0x508d8632
-0, 558000, 152064, 0xbc5736d8
-0, 561600, 152064, 0xed7d3aef
-0, 565200, 152064, 0x1dcdda9f
-0, 568800, 152064, 0x8ef6d5c9
-0, 572400, 152064, 0x15466acc
-0, 576000, 152064, 0x45d4cf67
-0, 579600, 152064, 0x8c900b9d
-0, 583200, 152064, 0x747006e0
-0, 586800, 152064, 0xac920a0c
-0, 590400, 152064, 0xb8210c27
-0, 594000, 152064, 0x7dbb873a
-0, 597600, 152064, 0x0d4d7584
-0, 601200, 152064, 0xefb3fe60
-0, 604800, 152064, 0x905e2644
-0, 608400, 152064, 0x7c04e534
-0, 612000, 152064, 0x8889972a
-0, 615600, 152064, 0x21c7d8ad
-0, 619200, 152064, 0x1c641176
-0, 622800, 152064, 0xf71489a4
-0, 626400, 152064, 0xd7ac5555
-0, 630000, 152064, 0xb4609c6d
-0, 633600, 152064, 0xf5b2bd5e
-0, 637200, 152064, 0x9f43ce57
-0, 640800, 152064, 0x77642dd3
-0, 644400, 152064, 0x3e79565c
-0, 648000, 152064, 0x95f40b8e
-0, 651600, 152064, 0x3c8ca4d4
-0, 655200, 152064, 0xa02ac497
-0, 658800, 152064, 0x4c93b377
-0, 662400, 152064, 0x55f5ac68
-0, 666000, 152064, 0xf8652eca
-0, 669600, 152064, 0x56e94574
-0, 673200, 152064, 0x6d8302e1
-0, 676800, 152064, 0x29a57061
-0, 680400, 152064, 0x24e4cfdc
-0, 684000, 152064, 0xf5a5d62a
-0, 687600, 152064, 0x998870c1
-0, 691200, 152064, 0xa15b1f4e
-0, 694800, 152064, 0xb0ccb51f
-0, 698400, 152064, 0xeaaf59ab
-0, 702000, 152064, 0x7e2b4fe6
-0, 705600, 152064, 0x72299fea
-0, 709200, 152064, 0x769da8b2
-0, 712800, 152064, 0xefad7ef8
-0, 716400, 152064, 0x24819983
-0, 720000, 152064, 0x2aad32ab
-0, 723600, 152064, 0xc80cac79
-0, 727200, 152064, 0x1659d628
-0, 730800, 152064, 0xef941f66
-0, 734400, 152064, 0x0d7fcdb5
-0, 738000, 152064, 0x7c1853fa
-0, 741600, 152064, 0xb94c4d3c
-0, 745200, 152064, 0xc47adfc2
-0, 748800, 152064, 0x366a6729
-0, 752400, 152064, 0x7eb37b70
-0, 756000, 152064, 0xafd54c27
-0, 759600, 152064, 0x67b18636
-0, 763200, 152064, 0x93b22dcf
-0, 766800, 152064, 0xa64991f1
-0, 770400, 152064, 0xd32a7102
-0, 774000, 152064, 0xff665d1c
-0, 777600, 152064, 0xf107cc31
-0, 781200, 152064, 0xf5b25652
-0, 784800, 152064, 0x8caf783d
-0, 788400, 152064, 0x72f3eb00
-0, 792000, 152064, 0xb5aea5f8
-0, 795600, 152064, 0xee70e870
-0, 799200, 152064, 0x7c3a0156
-0, 802800, 152064, 0x871b6383
-0, 806400, 152064, 0x48d831ff
-0, 810000, 152064, 0xca233913
-0, 813600, 152064, 0xe14bc5eb
-0, 817200, 152064, 0x9b1d27e7
-0, 820800, 152064, 0xfb9637f7
-0, 824400, 152064, 0x0c022157
-0, 828000, 152064, 0x16d35fc9
-0, 831600, 152064, 0x6d935f71
-0, 835200, 152064, 0xae4066fa
-0, 838800, 152064, 0xcef94fdc
-0, 842400, 152064, 0xc234edb9
-0, 846000, 152064, 0x26a4f2e2
-0, 849600, 152064, 0xd29ac23e
-0, 853200, 152064, 0xb7604395
-0, 856800, 152064, 0x408084f6
-0, 860400, 152064, 0x0a02026c
-0, 864000, 152064, 0x78b33c7c
-0, 867600, 152064, 0xcb02b874
-0, 871200, 152064, 0xf566513b
-0, 874800, 152064, 0xb34e52b1
-0, 878400, 152064, 0xf55ff493
-0, 882000, 152064, 0xb0e8282a
-0, 885600, 152064, 0xe9510bbe
-0, 889200, 152064, 0x292e8c5a
-0, 892800, 152064, 0x62b9d2b0
-0, 896400, 152064, 0x3a8cc827
-0, 900000, 152064, 0x25cc465e
-0, 903600, 152064, 0xf2bc32e2
-0, 907200, 152064, 0x6141f914
-0, 910800, 152064, 0x1171256f
-0, 914400, 152064, 0x13cb2ded
-0, 918000, 152064, 0x3d4ca557
-0, 921600, 152064, 0xf2b9e72e
-0, 925200, 152064, 0x03f7547a
-0, 928800, 152064, 0xc7302955
-0, 932400, 152064, 0xe78a46d3
-0, 936000, 152064, 0x3726a270
-0, 939600, 152064, 0x2f65722a
-0, 943200, 152064, 0x55acce40
-0, 946800, 152064, 0xf6fa9db2
-0, 950400, 152064, 0x70a36937
-0, 954000, 152064, 0x9313742d
-0, 957600, 152064, 0x2eb14e53
-0, 961200, 152064, 0x3d47c9c3
-0, 964800, 152064, 0xd0a90348
-0, 968400, 152064, 0x6ad48088
-0, 972000, 152064, 0x68e64738
-0, 975600, 152064, 0x04c3735a
-0, 979200, 152064, 0x51d0593f
-0, 982800, 152064, 0x42cf2b48
-0, 986400, 152064, 0xa5496a0c
-0, 990000, 152064, 0x84c25549
-0, 993600, 152064, 0x96691600
-0, 997200, 152064, 0x423135db
-0, 1000800, 152064, 0x8d2e08b6
-0, 1004400, 152064, 0xaeb4c840
-0, 1008000, 152064, 0xf3e71780
-0, 1011600, 152064, 0x8858228b
-0, 1015200, 152064, 0xf28613f8
-0, 1018800, 152064, 0xb5327882
-0, 1022400, 152064, 0xbb60bb85
-0, 1026000, 152064, 0x345ab1c9
-0, 1029600, 152064, 0x8aac2cba
-0, 1033200, 152064, 0x7ce15b4c
-0, 1036800, 152064, 0xc09c55c0
-0, 1040400, 152064, 0x8482ddd6
-0, 1044000, 152064, 0xab222a13
-0, 1047600, 152064, 0xd39b0dea
-0, 1051200, 152064, 0x6dab6e06
-0, 1054800, 152064, 0xec0891bd
-0, 1058400, 152064, 0x88bd9701
-0, 1062000, 152064, 0xdf13072a
-0, 1065600, 152064, 0x23b33081
-0, 1069200, 152064, 0x63943137
-0, 1072800, 152064, 0xab6a9052
-0, 1076400, 152064, 0x05485494
+#tb 0: 1/25
+0, 0, 0, 1, 152064, 0x502ec077
+0, 1, 1, 1, 152064, 0x84807243
+0, 2, 2, 1, 152064, 0xd7474a6e
+0, 3, 3, 1, 152064, 0x793469bb
+0, 4, 4, 1, 152064, 0xb7a0faf7
+0, 5, 5, 1, 152064, 0x1d3d3cba
+0, 6, 6, 1, 152064, 0xb62583de
+0, 7, 7, 1, 152064, 0xc8422fb1
+0, 8, 8, 1, 152064, 0x321dc699
+0, 9, 9, 1, 152064, 0x7a34d350
+0, 10, 10, 1, 152064, 0xaa4c302d
+0, 11, 11, 1, 152064, 0x45fa7ab0
+0, 12, 12, 1, 152064, 0xc7262e41
+0, 13, 13, 1, 152064, 0x3550000c
+0, 14, 14, 1, 152064, 0xf4bab54b
+0, 15, 15, 1, 152064, 0xaccf9c1a
+0, 16, 16, 1, 152064, 0x9bee20e9
+0, 17, 17, 1, 152064, 0x47fb7720
+0, 18, 18, 1, 152064, 0x12c63ffb
+0, 19, 19, 1, 152064, 0xfa2b8b4d
+0, 20, 20, 1, 152064, 0x279964bd
+0, 21, 21, 1, 152064, 0xb8b01c7e
+0, 22, 22, 1, 152064, 0x816fa010
+0, 23, 23, 1, 152064, 0x59fe1c8c
+0, 24, 24, 1, 152064, 0x13393fad
+0, 25, 25, 1, 152064, 0x991a50a4
+0, 26, 26, 1, 152064, 0x57df3eb7
+0, 27, 27, 1, 152064, 0x744371df
+0, 28, 28, 1, 152064, 0xe9f6d3ff
+0, 29, 29, 1, 152064, 0xc506fba0
+0, 30, 30, 1, 152064, 0x6295b90e
+0, 31, 31, 1, 152064, 0xa19cee2d
+0, 32, 32, 1, 152064, 0xf8c1b3ca
+0, 33, 33, 1, 152064, 0x69f68ce0
+0, 34, 34, 1, 152064, 0x80558bb6
+0, 35, 35, 1, 152064, 0x27824fa5
+0, 36, 36, 1, 152064, 0x27c929a1
+0, 37, 37, 1, 152064, 0xc0fe06d1
+0, 38, 38, 1, 152064, 0xc52bc58c
+0, 39, 39, 1, 152064, 0x0a5363c7
+0, 40, 40, 1, 152064, 0xd0f45a0d
+0, 41, 41, 1, 152064, 0x274710f9
+0, 42, 42, 1, 152064, 0x89d2d390
+0, 43, 43, 1, 152064, 0x12a9bfb0
+0, 44, 44, 1, 152064, 0x04501a93
+0, 45, 45, 1, 152064, 0xf92cbbf4
+0, 46, 46, 1, 152064, 0xf6d1b27d
+0, 47, 47, 1, 152064, 0xe3e904c3
+0, 48, 48, 1, 152064, 0x58f8516d
+0, 49, 49, 1, 152064, 0x70370c2b
+0, 50, 50, 1, 152064, 0xfeebc88c
+0, 51, 51, 1, 152064, 0x974c6ed6
+0, 52, 52, 1, 152064, 0x401bdcf2
+0, 53, 53, 1, 152064, 0xfe61e278
+0, 54, 54, 1, 152064, 0x96ba8bb9
+0, 55, 55, 1, 152064, 0x988492fd
+0, 56, 56, 1, 152064, 0xd1d913a9
+0, 57, 57, 1, 152064, 0x6bc46f0e
+0, 58, 58, 1, 152064, 0x695ef706
+0, 59, 59, 1, 152064, 0x142045c9
+0, 60, 60, 1, 152064, 0xb390ed87
+0, 61, 61, 1, 152064, 0xb9e6d2e5
+0, 62, 62, 1, 152064, 0xe348797f
+0, 63, 63, 1, 152064, 0x1cbd29d6
+0, 64, 64, 1, 152064, 0xbd7dd694
+0, 65, 65, 1, 152064, 0x516873c3
+0, 66, 66, 1, 152064, 0x27bba182
+0, 67, 67, 1, 152064, 0x7541f920
+0, 68, 68, 1, 152064, 0xfdf67042
+0, 69, 69, 1, 152064, 0x6c3c7896
+0, 70, 70, 1, 152064, 0xed86c467
+0, 71, 71, 1, 152064, 0x4ea83ca2
+0, 72, 72, 1, 152064, 0xa3e6725b
+0, 73, 73, 1, 152064, 0x917f5f16
+0, 74, 74, 1, 152064, 0x8cf2d2e1
+0, 75, 75, 1, 152064, 0x57a8d116
+0, 76, 76, 1, 152064, 0x0db267d4
+0, 77, 77, 1, 152064, 0xce782ac5
+0, 78, 78, 1, 152064, 0x1c9d8518
+0, 79, 79, 1, 152064, 0x47598ac7
+0, 80, 80, 1, 152064, 0xc5033d97
+0, 81, 81, 1, 152064, 0xd7aaa3a4
+0, 82, 82, 1, 152064, 0x078afc96
+0, 83, 83, 1, 152064, 0xc9fe673d
+0, 84, 84, 1, 152064, 0xe9284066
+0, 85, 85, 1, 152064, 0xbc570982
+0, 86, 86, 1, 152064, 0x0aac8574
+0, 87, 87, 1, 152064, 0x098cbeee
+0, 88, 88, 1, 152064, 0x19c36a9d
+0, 89, 89, 1, 152064, 0x8fe4a893
+0, 90, 90, 1, 152064, 0x0b652f17
+0, 91, 91, 1, 152064, 0x10f2e6bf
+0, 92, 92, 1, 152064, 0x7ce5634e
+0, 93, 93, 1, 152064, 0x8fe4ac6c
+0, 94, 94, 1, 152064, 0xcaba749e
+0, 95, 95, 1, 152064, 0x5f8a0d5c
+0, 96, 96, 1, 152064, 0xcaa66bbc
+0, 97, 97, 1, 152064, 0xc87ae617
+0, 98, 98, 1, 152064, 0xe8ef4dd7
+0, 99, 99, 1, 152064, 0xdfca5a07
+0, 100, 100, 1, 152064, 0x5f7eab7d
+0, 101, 101, 1, 152064, 0x8a65ebbb
+0, 102, 102, 1, 152064, 0x4beab4a0
+0, 103, 103, 1, 152064, 0xb5e6ab30
+0, 104, 104, 1, 152064, 0x8fe4f4d4
+0, 105, 105, 1, 152064, 0x95bde1ca
+0, 106, 106, 1, 152064, 0xcc5e3a53
+0, 107, 107, 1, 152064, 0xf09f1dd7
+0, 108, 108, 1, 152064, 0x10179672
+0, 109, 109, 1, 152064, 0x4ad16184
+0, 110, 110, 1, 152064, 0x9efa0e23
+0, 111, 111, 1, 152064, 0x22f59522
+0, 112, 112, 1, 152064, 0x4d38f09d
+0, 113, 113, 1, 152064, 0x4c5ebf56
+0, 114, 114, 1, 152064, 0xb19d5077
+0, 115, 115, 1, 152064, 0xa98576b9
+0, 116, 116, 1, 152064, 0x65324239
+0, 117, 117, 1, 152064, 0x709e4031
+0, 118, 118, 1, 152064, 0xf8e81681
+0, 119, 119, 1, 152064, 0x058514e5
+0, 120, 120, 1, 152064, 0xd1d1c806
+0, 121, 121, 1, 152064, 0x0e4dde57
+0, 122, 122, 1, 152064, 0x49e9c2bb
+0, 123, 123, 1, 152064, 0x01417ce6
+0, 124, 124, 1, 152064, 0xda7ebbf1
+0, 125, 125, 1, 152064, 0xa22906b7
+0, 126, 126, 1, 152064, 0x32e2df87
+0, 127, 127, 1, 152064, 0x69917c8f
+0, 128, 128, 1, 152064, 0xea8ed2cc
+0, 129, 129, 1, 152064, 0x0b8d57f1
+0, 130, 130, 1, 152064, 0x5f683bcd
+0, 131, 131, 1, 152064, 0x5162fe2f
+0, 132, 132, 1, 152064, 0x49c052f8
+0, 133, 133, 1, 152064, 0x990b69ba
+0, 134, 134, 1, 152064, 0xa6d4f99f
+0, 135, 135, 1, 152064, 0xe79ef4da
+0, 136, 136, 1, 152064, 0x5e8a3847
+0, 137, 137, 1, 152064, 0x38b1e75f
+0, 138, 138, 1, 152064, 0xf5c91bed
+0, 139, 139, 1, 152064, 0xd59a6d26
+0, 140, 140, 1, 152064, 0xc361de06
+0, 141, 141, 1, 152064, 0x63ed2229
+0, 142, 142, 1, 152064, 0xb8229205
+0, 143, 143, 1, 152064, 0x7c6619af
+0, 144, 144, 1, 152064, 0x4126b02f
+0, 145, 145, 1, 152064, 0x9250b99b
+0, 146, 146, 1, 152064, 0x589778f9
+0, 147, 147, 1, 152064, 0xed1fa45b
+0, 148, 148, 1, 152064, 0x700b6f32
+0, 149, 149, 1, 152064, 0x0590df55
+0, 150, 150, 1, 152064, 0x3e9c4018
+0, 151, 151, 1, 152064, 0x957b8860
+0, 152, 152, 1, 152064, 0x56161560
+0, 153, 153, 1, 152064, 0xbc43bc3b
+0, 154, 154, 1, 152064, 0x508d8632
+0, 155, 155, 1, 152064, 0xbc5736d8
+0, 156, 156, 1, 152064, 0xed7d3aef
+0, 157, 157, 1, 152064, 0x1dcdda9f
+0, 158, 158, 1, 152064, 0x8ef6d5c9
+0, 159, 159, 1, 152064, 0x15466acc
+0, 160, 160, 1, 152064, 0x45d4cf67
+0, 161, 161, 1, 152064, 0x8c900b9d
+0, 162, 162, 1, 152064, 0x747006e0
+0, 163, 163, 1, 152064, 0xac920a0c
+0, 164, 164, 1, 152064, 0xb8210c27
+0, 165, 165, 1, 152064, 0x7dbb873a
+0, 166, 166, 1, 152064, 0x0d4d7584
+0, 167, 167, 1, 152064, 0xefb3fe60
+0, 168, 168, 1, 152064, 0x905e2644
+0, 169, 169, 1, 152064, 0x7c04e534
+0, 170, 170, 1, 152064, 0x8889972a
+0, 171, 171, 1, 152064, 0x21c7d8ad
+0, 172, 172, 1, 152064, 0x1c641176
+0, 173, 173, 1, 152064, 0xf71489a4
+0, 174, 174, 1, 152064, 0xd7ac5555
+0, 175, 175, 1, 152064, 0xb4609c6d
+0, 176, 176, 1, 152064, 0xf5b2bd5e
+0, 177, 177, 1, 152064, 0x9f43ce57
+0, 178, 178, 1, 152064, 0x77642dd3
+0, 179, 179, 1, 152064, 0x3e79565c
+0, 180, 180, 1, 152064, 0x95f40b8e
+0, 181, 181, 1, 152064, 0x3c8ca4d4
+0, 182, 182, 1, 152064, 0xa02ac497
+0, 183, 183, 1, 152064, 0x4c93b377
+0, 184, 184, 1, 152064, 0x55f5ac68
+0, 185, 185, 1, 152064, 0xf8652eca
+0, 186, 186, 1, 152064, 0x56e94574
+0, 187, 187, 1, 152064, 0x6d8302e1
+0, 188, 188, 1, 152064, 0x29a57061
+0, 189, 189, 1, 152064, 0x24e4cfdc
+0, 190, 190, 1, 152064, 0xf5a5d62a
+0, 191, 191, 1, 152064, 0x998870c1
+0, 192, 192, 1, 152064, 0xa15b1f4e
+0, 193, 193, 1, 152064, 0xb0ccb51f
+0, 194, 194, 1, 152064, 0xeaaf59ab
+0, 195, 195, 1, 152064, 0x7e2b4fe6
+0, 196, 196, 1, 152064, 0x72299fea
+0, 197, 197, 1, 152064, 0x769da8b2
+0, 198, 198, 1, 152064, 0xefad7ef8
+0, 199, 199, 1, 152064, 0x24819983
+0, 200, 200, 1, 152064, 0x2aad32ab
+0, 201, 201, 1, 152064, 0xc80cac79
+0, 202, 202, 1, 152064, 0x1659d628
+0, 203, 203, 1, 152064, 0xef941f66
+0, 204, 204, 1, 152064, 0x0d7fcdb5
+0, 205, 205, 1, 152064, 0x7c1853fa
+0, 206, 206, 1, 152064, 0xb94c4d3c
+0, 207, 207, 1, 152064, 0xc47adfc2
+0, 208, 208, 1, 152064, 0x366a6729
+0, 209, 209, 1, 152064, 0x7eb37b70
+0, 210, 210, 1, 152064, 0xafd54c27
+0, 211, 211, 1, 152064, 0x67b18636
+0, 212, 212, 1, 152064, 0x93b22dcf
+0, 213, 213, 1, 152064, 0xa64991f1
+0, 214, 214, 1, 152064, 0xd32a7102
+0, 215, 215, 1, 152064, 0xff665d1c
+0, 216, 216, 1, 152064, 0xf107cc31
+0, 217, 217, 1, 152064, 0xf5b25652
+0, 218, 218, 1, 152064, 0x8caf783d
+0, 219, 219, 1, 152064, 0x72f3eb00
+0, 220, 220, 1, 152064, 0xb5aea5f8
+0, 221, 221, 1, 152064, 0xee70e870
+0, 222, 222, 1, 152064, 0x7c3a0156
+0, 223, 223, 1, 152064, 0x871b6383
+0, 224, 224, 1, 152064, 0x48d831ff
+0, 225, 225, 1, 152064, 0xca233913
+0, 226, 226, 1, 152064, 0xe14bc5eb
+0, 227, 227, 1, 152064, 0x9b1d27e7
+0, 228, 228, 1, 152064, 0xfb9637f7
+0, 229, 229, 1, 152064, 0x0c022157
+0, 230, 230, 1, 152064, 0x16d35fc9
+0, 231, 231, 1, 152064, 0x6d935f71
+0, 232, 232, 1, 152064, 0xae4066fa
+0, 233, 233, 1, 152064, 0xcef94fdc
+0, 234, 234, 1, 152064, 0xc234edb9
+0, 235, 235, 1, 152064, 0x26a4f2e2
+0, 236, 236, 1, 152064, 0xd29ac23e
+0, 237, 237, 1, 152064, 0xb7604395
+0, 238, 238, 1, 152064, 0x408084f6
+0, 239, 239, 1, 152064, 0x0a02026c
+0, 240, 240, 1, 152064, 0x78b33c7c
+0, 241, 241, 1, 152064, 0xcb02b874
+0, 242, 242, 1, 152064, 0xf566513b
+0, 243, 243, 1, 152064, 0xb34e52b1
+0, 244, 244, 1, 152064, 0xf55ff493
+0, 245, 245, 1, 152064, 0xb0e8282a
+0, 246, 246, 1, 152064, 0xe9510bbe
+0, 247, 247, 1, 152064, 0x292e8c5a
+0, 248, 248, 1, 152064, 0x62b9d2b0
+0, 249, 249, 1, 152064, 0x3a8cc827
+0, 250, 250, 1, 152064, 0x25cc465e
+0, 251, 251, 1, 152064, 0xf2bc32e2
+0, 252, 252, 1, 152064, 0x6141f914
+0, 253, 253, 1, 152064, 0x1171256f
+0, 254, 254, 1, 152064, 0x13cb2ded
+0, 255, 255, 1, 152064, 0x3d4ca557
+0, 256, 256, 1, 152064, 0xf2b9e72e
+0, 257, 257, 1, 152064, 0x03f7547a
+0, 258, 258, 1, 152064, 0xc7302955
+0, 259, 259, 1, 152064, 0xe78a46d3
+0, 260, 260, 1, 152064, 0x3726a270
+0, 261, 261, 1, 152064, 0x2f65722a
+0, 262, 262, 1, 152064, 0x55acce40
+0, 263, 263, 1, 152064, 0xf6fa9db2
+0, 264, 264, 1, 152064, 0x70a36937
+0, 265, 265, 1, 152064, 0x9313742d
+0, 266, 266, 1, 152064, 0x2eb14e53
+0, 267, 267, 1, 152064, 0x3d47c9c3
+0, 268, 268, 1, 152064, 0xd0a90348
+0, 269, 269, 1, 152064, 0x6ad48088
+0, 270, 270, 1, 152064, 0x68e64738
+0, 271, 271, 1, 152064, 0x04c3735a
+0, 272, 272, 1, 152064, 0x51d0593f
+0, 273, 273, 1, 152064, 0x42cf2b48
+0, 274, 274, 1, 152064, 0xa5496a0c
+0, 275, 275, 1, 152064, 0x84c25549
+0, 276, 276, 1, 152064, 0x96691600
+0, 277, 277, 1, 152064, 0x423135db
+0, 278, 278, 1, 152064, 0x8d2e08b6
+0, 279, 279, 1, 152064, 0xaeb4c840
+0, 280, 280, 1, 152064, 0xf3e71780
+0, 281, 281, 1, 152064, 0x8858228b
+0, 282, 282, 1, 152064, 0xf28613f8
+0, 283, 283, 1, 152064, 0xb5327882
+0, 284, 284, 1, 152064, 0xbb60bb85
+0, 285, 285, 1, 152064, 0x345ab1c9
+0, 286, 286, 1, 152064, 0x8aac2cba
+0, 287, 287, 1, 152064, 0x7ce15b4c
+0, 288, 288, 1, 152064, 0xc09c55c0
+0, 289, 289, 1, 152064, 0x8482ddd6
+0, 290, 290, 1, 152064, 0xab222a13
+0, 291, 291, 1, 152064, 0xd39b0dea
+0, 292, 292, 1, 152064, 0x6dab6e06
+0, 293, 293, 1, 152064, 0xec0891bd
+0, 294, 294, 1, 152064, 0x88bd9701
+0, 295, 295, 1, 152064, 0xdf13072a
+0, 296, 296, 1, 152064, 0x23b33081
+0, 297, 297, 1, 152064, 0x63943137
+0, 298, 298, 1, 152064, 0xab6a9052
+0, 299, 299, 1, 152064, 0x05485494
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-hpcaflnl_bcrm_c b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-hpcaflnl_bcrm_c
index 97d7677..65a366e 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-hpcaflnl_bcrm_c
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-hpcaflnl_bcrm_c
@@ -1,300 +1,301 @@
-0, 0, 152064, 0x3e39c08b
-0, 3600, 152064, 0xabc67990
-0, 7200, 152064, 0x19614e74
-0, 10800, 152064, 0xa3776beb
-0, 14400, 152064, 0xcce6ffdf
-0, 18000, 152064, 0xb0e94746
-0, 21600, 152064, 0xdb1a84ef
-0, 25200, 152064, 0xb2624509
-0, 28800, 152064, 0x32e2d826
-0, 32400, 152064, 0xb3bddf0b
-0, 36000, 152064, 0x2e273ce3
-0, 39600, 152064, 0x67af7e4d
-0, 43200, 152064, 0x505c3261
-0, 46800, 152064, 0xa43d015e
-0, 50400, 152064, 0xad41c1f6
-0, 54000, 152064, 0x633ba55f
-0, 57600, 152064, 0xe80634f0
-0, 61200, 152064, 0x80a07dc9
-0, 64800, 152064, 0x0e7a3bbf
-0, 68400, 152064, 0xcb099196
-0, 72000, 152064, 0x57c96db5
-0, 75600, 152064, 0xccd422fa
-0, 79200, 152064, 0x0850b7a7
-0, 82800, 152064, 0x30e33156
-0, 86400, 152064, 0x34e13f9a
-0, 90000, 152064, 0x03d36000
-0, 93600, 152064, 0xbf7d49da
-0, 97200, 152064, 0x77336d09
-0, 100800, 152064, 0xca8be5a9
-0, 104400, 152064, 0xe57c0b08
-0, 108000, 152064, 0xbe77c093
-0, 111600, 152064, 0x6bf1ff05
-0, 115200, 152064, 0x9142babf
-0, 118800, 152064, 0x08db8e67
-0, 122400, 152064, 0x69ac8cb6
-0, 126000, 152064, 0xaa3b5c88
-0, 129600, 152064, 0x9bd32638
-0, 133200, 152064, 0x7972115a
-0, 136800, 152064, 0x5c1dd47b
-0, 140400, 152064, 0x8a196e02
-0, 144000, 152064, 0xa89672bc
-0, 147600, 152064, 0x27b220e4
-0, 151200, 152064, 0xfa38dc4a
-0, 154800, 152064, 0x4784c639
-0, 158400, 152064, 0xa5e4229a
-0, 162000, 152064, 0xa986bdfc
-0, 165600, 152064, 0x2951b47b
-0, 169200, 152064, 0x4df404a6
-0, 172800, 152064, 0xc75155e8
-0, 176400, 152064, 0xfc05248c
-0, 180000, 152064, 0x5d53da10
-0, 183600, 152064, 0x284376ec
-0, 187200, 152064, 0x19fce380
-0, 190800, 152064, 0x876be6c9
-0, 194400, 152064, 0x39eb8ff9
-0, 198000, 152064, 0x289c9543
-0, 201600, 152064, 0x24dd2356
-0, 205200, 152064, 0x1dc17d3c
-0, 208800, 152064, 0xd17c00ac
-0, 212400, 152064, 0xc2ad54de
-0, 216000, 152064, 0xbe11ee2f
-0, 219600, 152064, 0x3db9dc89
-0, 223200, 152064, 0xac0d7bc2
-0, 226800, 152064, 0x8dab2dde
-0, 230400, 152064, 0x566ad225
-0, 234000, 152064, 0x587c7853
-0, 237600, 152064, 0x601c9c80
-0, 241200, 152064, 0x2afaf751
-0, 244800, 152064, 0x1c9f7e3a
-0, 248400, 152064, 0x899475bf
-0, 252000, 152064, 0x0d65c7d9
-0, 255600, 152064, 0xafd63d12
-0, 259200, 152064, 0x162e62b9
-0, 262800, 152064, 0x5c9554be
-0, 266400, 152064, 0x35fbdaa2
-0, 270000, 152064, 0x6438cbd8
-0, 273600, 152064, 0xde0772c9
-0, 277200, 152064, 0x79f82854
-0, 280800, 152064, 0x86957840
-0, 284400, 152064, 0xd9468cbf
-0, 288000, 152064, 0x23e74609
-0, 291600, 152064, 0x3919a146
-0, 295200, 152064, 0xd641078b
-0, 298800, 152064, 0x24397220
-0, 302400, 152064, 0xe7fc3a7c
-0, 306000, 152064, 0x3997154a
-0, 309600, 152064, 0x2af3952c
-0, 313200, 152064, 0x274ac07a
-0, 316800, 152064, 0x288f7b09
-0, 320400, 152064, 0xe6f9b022
-0, 324000, 152064, 0xf09e2fbb
-0, 327600, 152064, 0x7244e477
-0, 331200, 152064, 0x0dfc72eb
-0, 334800, 152064, 0x0322b21f
-0, 338400, 152064, 0x18b08205
-0, 342000, 152064, 0x6606153e
-0, 345600, 152064, 0x85186272
-0, 349200, 152064, 0x3369f064
-0, 352800, 152064, 0xbe0d5a44
-0, 356400, 152064, 0x320258bb
-0, 360000, 152064, 0x4d6fb091
-0, 363600, 152064, 0xc9bbf5e7
-0, 367200, 152064, 0x0aa1b69b
-0, 370800, 152064, 0x85b9ac11
-0, 374400, 152064, 0xb25ff818
-0, 378000, 152064, 0xa155dc25
-0, 381600, 152064, 0xa8e03bfd
-0, 385200, 152064, 0x0a862956
-0, 388800, 152064, 0x11b49264
-0, 392400, 152064, 0xa94e664e
-0, 396000, 152064, 0x330e0fa2
-0, 399600, 152064, 0xaf3d9518
-0, 403200, 152064, 0x0836f2e8
-0, 406800, 152064, 0xbf6dc578
-0, 410400, 152064, 0x7b524d20
-0, 414000, 152064, 0x9ef7677f
-0, 417600, 152064, 0xeacf3f34
-0, 421200, 152064, 0xfb4e3dbe
-0, 424800, 152064, 0xb46e25cb
-0, 428400, 152064, 0x363c1603
-0, 432000, 152064, 0x263fc542
-0, 435600, 152064, 0xf106e548
-0, 439200, 152064, 0xde43c56a
-0, 442800, 152064, 0xc2c4770a
-0, 446400, 152064, 0x122fce19
-0, 450000, 152064, 0x3ba01434
-0, 453600, 152064, 0x0e8ce5ee
-0, 457200, 152064, 0x6ceb82e1
-0, 460800, 152064, 0xa23ee21c
-0, 464400, 152064, 0xc6d960f9
-0, 468000, 152064, 0x0de15258
-0, 471600, 152064, 0x187b0333
-0, 475200, 152064, 0x92e6582f
-0, 478800, 152064, 0xb9586ce0
-0, 482400, 152064, 0xefd803b5
-0, 486000, 152064, 0x24eafb29
-0, 489600, 152064, 0x20c73b14
-0, 493200, 152064, 0xbd7ceaaa
-0, 496800, 152064, 0x775216c8
-0, 500400, 152064, 0xa08971c7
-0, 504000, 152064, 0xef0ee865
-0, 507600, 152064, 0x9ac61c2f
-0, 511200, 152064, 0x52ae8ea9
-0, 514800, 152064, 0x06571c14
-0, 518400, 152064, 0x6e78ad33
-0, 522000, 152064, 0xad01c627
-0, 525600, 152064, 0xbfe074d3
-0, 529200, 152064, 0x9357a183
-0, 532800, 152064, 0x8de7767f
-0, 536400, 152064, 0xa5e6e76e
-0, 540000, 152064, 0xa6f646fe
-0, 543600, 152064, 0x132e99f8
-0, 547200, 152064, 0xb79f27de
-0, 550800, 152064, 0x36d3cdcf
-0, 554400, 152064, 0xdc938336
-0, 558000, 152064, 0xacaa3a7f
-0, 561600, 152064, 0xc61a37fd
-0, 565200, 152064, 0x4fe1ddf0
-0, 568800, 152064, 0xc0f7d660
-0, 572400, 152064, 0xd72458ea
-0, 576000, 152064, 0x6978d123
-0, 579600, 152064, 0x64e60ccf
-0, 583200, 152064, 0xaa07004c
-0, 586800, 152064, 0x07cd1064
-0, 590400, 152064, 0xa82320e5
-0, 594000, 152064, 0xaedd8d30
-0, 597600, 152064, 0x79b082ea
-0, 601200, 152064, 0x9ed800ab
-0, 604800, 152064, 0xde592bb4
-0, 608400, 152064, 0xd966df88
-0, 612000, 152064, 0xf921988a
-0, 615600, 152064, 0x557ad9ae
-0, 619200, 152064, 0xc3f31a9a
-0, 622800, 152064, 0x65248561
-0, 626400, 152064, 0x63df4aa6
-0, 630000, 152064, 0x618da0a9
-0, 633600, 152064, 0xe6f1c435
-0, 637200, 152064, 0x9f90c38f
-0, 640800, 152064, 0xd2853e14
-0, 644400, 152064, 0x6e0268a9
-0, 648000, 152064, 0x393712d1
-0, 651600, 152064, 0x470da25f
-0, 655200, 152064, 0xaf55cb3d
-0, 658800, 152064, 0x6935b8b9
-0, 662400, 152064, 0x5409a15f
-0, 666000, 152064, 0x09073fee
-0, 669600, 152064, 0xfb274e82
-0, 673200, 152064, 0x1a770581
-0, 676800, 152064, 0x17277d0d
-0, 680400, 152064, 0xd4dcd982
-0, 684000, 152064, 0x6b04eaf3
-0, 687600, 152064, 0x8a3d822e
-0, 691200, 152064, 0x1b971ec9
-0, 694800, 152064, 0x14e0c0f6
-0, 698400, 152064, 0x00667450
-0, 702000, 152064, 0xd2385902
-0, 705600, 152064, 0x905da6ab
-0, 709200, 152064, 0xa3ffb18b
-0, 712800, 152064, 0x10d48b19
-0, 716400, 152064, 0xb2c7a3bd
-0, 720000, 152064, 0x45593e96
-0, 723600, 152064, 0x47a0b60c
-0, 727200, 152064, 0x68c6d1b9
-0, 730800, 152064, 0xbc881fcc
-0, 734400, 152064, 0x422cc6f2
-0, 738000, 152064, 0x9b686410
-0, 741600, 152064, 0x35dc5e86
-0, 745200, 152064, 0x247bedaa
-0, 748800, 152064, 0x22b76fd1
-0, 752400, 152064, 0x67cc7a75
-0, 756000, 152064, 0xa197521e
-0, 759600, 152064, 0x428c8662
-0, 763200, 152064, 0x33dc2c73
-0, 766800, 152064, 0x5b538903
-0, 770400, 152064, 0x3c4176b6
-0, 774000, 152064, 0x774364ba
-0, 777600, 152064, 0xf237d03e
-0, 781200, 152064, 0xac8746fb
-0, 784800, 152064, 0x6b306a84
-0, 788400, 152064, 0xa2ace513
-0, 792000, 152064, 0x709c9be7
-0, 795600, 152064, 0x2403f373
-0, 799200, 152064, 0x147bf717
-0, 802800, 152064, 0xe58964c8
-0, 806400, 152064, 0xa0da36fc
-0, 810000, 152064, 0x1ac1355c
-0, 813600, 152064, 0x8a31c9f2
-0, 817200, 152064, 0x42ba205c
-0, 820800, 152064, 0xa11b3575
-0, 824400, 152064, 0xcb35207c
-0, 828000, 152064, 0x528f6189
-0, 831600, 152064, 0x34f05bd7
-0, 835200, 152064, 0x72317356
-0, 838800, 152064, 0xaabd5028
-0, 842400, 152064, 0x13dbeb7b
-0, 846000, 152064, 0x62f1e8a8
-0, 849600, 152064, 0x1723bfcd
-0, 853200, 152064, 0x5c083c00
-0, 856800, 152064, 0x52137894
-0, 860400, 152064, 0xef1e082c
-0, 864000, 152064, 0x664b3d53
-0, 867600, 152064, 0x2eb9b296
-0, 871200, 152064, 0xd0ca511e
-0, 874800, 152064, 0x012d4724
-0, 878400, 152064, 0xa847f5af
-0, 882000, 152064, 0x483a2fde
-0, 885600, 152064, 0xd1ab0257
-0, 889200, 152064, 0x414692c7
-0, 892800, 152064, 0x0b79df88
-0, 896400, 152064, 0xdaa2c4a3
-0, 900000, 152064, 0xd1b44500
-0, 903600, 152064, 0xfd3d2cf3
-0, 907200, 152064, 0xfdc0f748
-0, 910800, 152064, 0xce762a2a
-0, 914400, 152064, 0x08b63572
-0, 918000, 152064, 0x5a46a38d
-0, 921600, 152064, 0x03cee9c0
-0, 925200, 152064, 0x9ee45473
-0, 928800, 152064, 0x5a432386
-0, 932400, 152064, 0x54c83d87
-0, 936000, 152064, 0xc9caa1de
-0, 939600, 152064, 0xa28367f1
-0, 943200, 152064, 0x2607cdf1
-0, 946800, 152064, 0x06baa8de
-0, 950400, 152064, 0xf5346e32
-0, 954000, 152064, 0x6d3e732b
-0, 957600, 152064, 0x798c584b
-0, 961200, 152064, 0x4076c948
-0, 964800, 152064, 0x868cf63a
-0, 968400, 152064, 0x23107ac5
-0, 972000, 152064, 0x306f3fe2
-0, 975600, 152064, 0xbd1d71d6
-0, 979200, 152064, 0x1429545f
-0, 982800, 152064, 0xaded29aa
-0, 986400, 152064, 0x9b455a94
-0, 990000, 152064, 0xb3774ce7
-0, 993600, 152064, 0x92580986
-0, 997200, 152064, 0x0eae2f95
-0, 1000800, 152064, 0x599208b2
-0, 1004400, 152064, 0x4804c04c
-0, 1008000, 152064, 0x5f730e8f
-0, 1011600, 152064, 0x3e501d1e
-0, 1015200, 152064, 0x32100740
-0, 1018800, 152064, 0x62226ff8
-0, 1022400, 152064, 0x7683b622
-0, 1026000, 152064, 0xc3e0aec1
-0, 1029600, 152064, 0xfac12608
-0, 1033200, 152064, 0xb21a5781
-0, 1036800, 152064, 0x8f1e4964
-0, 1040400, 152064, 0x0f62dd6e
-0, 1044000, 152064, 0xac062ac4
-0, 1047600, 152064, 0x1b320f7a
-0, 1051200, 152064, 0x346e7211
-0, 1054800, 152064, 0xe47592f3
-0, 1058400, 152064, 0xa3a7919c
-0, 1062000, 152064, 0xa3580fa6
-0, 1065600, 152064, 0xc73430c1
-0, 1069200, 152064, 0x994a2c18
-0, 1072800, 152064, 0x0b5d8d45
-0, 1076400, 152064, 0x9eed5109
+#tb 0: 1/25
+0, 0, 0, 1, 152064, 0x3e39c08b
+0, 1, 1, 1, 152064, 0xabc67990
+0, 2, 2, 1, 152064, 0x19614e74
+0, 3, 3, 1, 152064, 0xa3776beb
+0, 4, 4, 1, 152064, 0xcce6ffdf
+0, 5, 5, 1, 152064, 0xb0e94746
+0, 6, 6, 1, 152064, 0xdb1a84ef
+0, 7, 7, 1, 152064, 0xb2624509
+0, 8, 8, 1, 152064, 0x32e2d826
+0, 9, 9, 1, 152064, 0xb3bddf0b
+0, 10, 10, 1, 152064, 0x2e273ce3
+0, 11, 11, 1, 152064, 0x67af7e4d
+0, 12, 12, 1, 152064, 0x505c3261
+0, 13, 13, 1, 152064, 0xa43d015e
+0, 14, 14, 1, 152064, 0xad41c1f6
+0, 15, 15, 1, 152064, 0x633ba55f
+0, 16, 16, 1, 152064, 0xe80634f0
+0, 17, 17, 1, 152064, 0x80a07dc9
+0, 18, 18, 1, 152064, 0x0e7a3bbf
+0, 19, 19, 1, 152064, 0xcb099196
+0, 20, 20, 1, 152064, 0x57c96db5
+0, 21, 21, 1, 152064, 0xccd422fa
+0, 22, 22, 1, 152064, 0x0850b7a7
+0, 23, 23, 1, 152064, 0x30e33156
+0, 24, 24, 1, 152064, 0x34e13f9a
+0, 25, 25, 1, 152064, 0x03d36000
+0, 26, 26, 1, 152064, 0xbf7d49da
+0, 27, 27, 1, 152064, 0x77336d09
+0, 28, 28, 1, 152064, 0xca8be5a9
+0, 29, 29, 1, 152064, 0xe57c0b08
+0, 30, 30, 1, 152064, 0xbe77c093
+0, 31, 31, 1, 152064, 0x6bf1ff05
+0, 32, 32, 1, 152064, 0x9142babf
+0, 33, 33, 1, 152064, 0x08db8e67
+0, 34, 34, 1, 152064, 0x69ac8cb6
+0, 35, 35, 1, 152064, 0xaa3b5c88
+0, 36, 36, 1, 152064, 0x9bd32638
+0, 37, 37, 1, 152064, 0x7972115a
+0, 38, 38, 1, 152064, 0x5c1dd47b
+0, 39, 39, 1, 152064, 0x8a196e02
+0, 40, 40, 1, 152064, 0xa89672bc
+0, 41, 41, 1, 152064, 0x27b220e4
+0, 42, 42, 1, 152064, 0xfa38dc4a
+0, 43, 43, 1, 152064, 0x4784c639
+0, 44, 44, 1, 152064, 0xa5e4229a
+0, 45, 45, 1, 152064, 0xa986bdfc
+0, 46, 46, 1, 152064, 0x2951b47b
+0, 47, 47, 1, 152064, 0x4df404a6
+0, 48, 48, 1, 152064, 0xc75155e8
+0, 49, 49, 1, 152064, 0xfc05248c
+0, 50, 50, 1, 152064, 0x5d53da10
+0, 51, 51, 1, 152064, 0x284376ec
+0, 52, 52, 1, 152064, 0x19fce380
+0, 53, 53, 1, 152064, 0x876be6c9
+0, 54, 54, 1, 152064, 0x39eb8ff9
+0, 55, 55, 1, 152064, 0x289c9543
+0, 56, 56, 1, 152064, 0x24dd2356
+0, 57, 57, 1, 152064, 0x1dc17d3c
+0, 58, 58, 1, 152064, 0xd17c00ac
+0, 59, 59, 1, 152064, 0xc2ad54de
+0, 60, 60, 1, 152064, 0xbe11ee2f
+0, 61, 61, 1, 152064, 0x3db9dc89
+0, 62, 62, 1, 152064, 0xac0d7bc2
+0, 63, 63, 1, 152064, 0x8dab2dde
+0, 64, 64, 1, 152064, 0x566ad225
+0, 65, 65, 1, 152064, 0x587c7853
+0, 66, 66, 1, 152064, 0x601c9c80
+0, 67, 67, 1, 152064, 0x2afaf751
+0, 68, 68, 1, 152064, 0x1c9f7e3a
+0, 69, 69, 1, 152064, 0x899475bf
+0, 70, 70, 1, 152064, 0x0d65c7d9
+0, 71, 71, 1, 152064, 0xafd63d12
+0, 72, 72, 1, 152064, 0x162e62b9
+0, 73, 73, 1, 152064, 0x5c9554be
+0, 74, 74, 1, 152064, 0x35fbdaa2
+0, 75, 75, 1, 152064, 0x6438cbd8
+0, 76, 76, 1, 152064, 0xde0772c9
+0, 77, 77, 1, 152064, 0x79f82854
+0, 78, 78, 1, 152064, 0x86957840
+0, 79, 79, 1, 152064, 0xd9468cbf
+0, 80, 80, 1, 152064, 0x23e74609
+0, 81, 81, 1, 152064, 0x3919a146
+0, 82, 82, 1, 152064, 0xd641078b
+0, 83, 83, 1, 152064, 0x24397220
+0, 84, 84, 1, 152064, 0xe7fc3a7c
+0, 85, 85, 1, 152064, 0x3997154a
+0, 86, 86, 1, 152064, 0x2af3952c
+0, 87, 87, 1, 152064, 0x274ac07a
+0, 88, 88, 1, 152064, 0x288f7b09
+0, 89, 89, 1, 152064, 0xe6f9b022
+0, 90, 90, 1, 152064, 0xf09e2fbb
+0, 91, 91, 1, 152064, 0x7244e477
+0, 92, 92, 1, 152064, 0x0dfc72eb
+0, 93, 93, 1, 152064, 0x0322b21f
+0, 94, 94, 1, 152064, 0x18b08205
+0, 95, 95, 1, 152064, 0x6606153e
+0, 96, 96, 1, 152064, 0x85186272
+0, 97, 97, 1, 152064, 0x3369f064
+0, 98, 98, 1, 152064, 0xbe0d5a44
+0, 99, 99, 1, 152064, 0x320258bb
+0, 100, 100, 1, 152064, 0x4d6fb091
+0, 101, 101, 1, 152064, 0xc9bbf5e7
+0, 102, 102, 1, 152064, 0x0aa1b69b
+0, 103, 103, 1, 152064, 0x85b9ac11
+0, 104, 104, 1, 152064, 0xb25ff818
+0, 105, 105, 1, 152064, 0xa155dc25
+0, 106, 106, 1, 152064, 0xa8e03bfd
+0, 107, 107, 1, 152064, 0x0a862956
+0, 108, 108, 1, 152064, 0x11b49264
+0, 109, 109, 1, 152064, 0xa94e664e
+0, 110, 110, 1, 152064, 0x330e0fa2
+0, 111, 111, 1, 152064, 0xaf3d9518
+0, 112, 112, 1, 152064, 0x0836f2e8
+0, 113, 113, 1, 152064, 0xbf6dc578
+0, 114, 114, 1, 152064, 0x7b524d20
+0, 115, 115, 1, 152064, 0x9ef7677f
+0, 116, 116, 1, 152064, 0xeacf3f34
+0, 117, 117, 1, 152064, 0xfb4e3dbe
+0, 118, 118, 1, 152064, 0xb46e25cb
+0, 119, 119, 1, 152064, 0x363c1603
+0, 120, 120, 1, 152064, 0x263fc542
+0, 121, 121, 1, 152064, 0xf106e548
+0, 122, 122, 1, 152064, 0xde43c56a
+0, 123, 123, 1, 152064, 0xc2c4770a
+0, 124, 124, 1, 152064, 0x122fce19
+0, 125, 125, 1, 152064, 0x3ba01434
+0, 126, 126, 1, 152064, 0x0e8ce5ee
+0, 127, 127, 1, 152064, 0x6ceb82e1
+0, 128, 128, 1, 152064, 0xa23ee21c
+0, 129, 129, 1, 152064, 0xc6d960f9
+0, 130, 130, 1, 152064, 0x0de15258
+0, 131, 131, 1, 152064, 0x187b0333
+0, 132, 132, 1, 152064, 0x92e6582f
+0, 133, 133, 1, 152064, 0xb9586ce0
+0, 134, 134, 1, 152064, 0xefd803b5
+0, 135, 135, 1, 152064, 0x24eafb29
+0, 136, 136, 1, 152064, 0x20c73b14
+0, 137, 137, 1, 152064, 0xbd7ceaaa
+0, 138, 138, 1, 152064, 0x775216c8
+0, 139, 139, 1, 152064, 0xa08971c7
+0, 140, 140, 1, 152064, 0xef0ee865
+0, 141, 141, 1, 152064, 0x9ac61c2f
+0, 142, 142, 1, 152064, 0x52ae8ea9
+0, 143, 143, 1, 152064, 0x06571c14
+0, 144, 144, 1, 152064, 0x6e78ad33
+0, 145, 145, 1, 152064, 0xad01c627
+0, 146, 146, 1, 152064, 0xbfe074d3
+0, 147, 147, 1, 152064, 0x9357a183
+0, 148, 148, 1, 152064, 0x8de7767f
+0, 149, 149, 1, 152064, 0xa5e6e76e
+0, 150, 150, 1, 152064, 0xa6f646fe
+0, 151, 151, 1, 152064, 0x132e99f8
+0, 152, 152, 1, 152064, 0xb79f27de
+0, 153, 153, 1, 152064, 0x36d3cdcf
+0, 154, 154, 1, 152064, 0xdc938336
+0, 155, 155, 1, 152064, 0xacaa3a7f
+0, 156, 156, 1, 152064, 0xc61a37fd
+0, 157, 157, 1, 152064, 0x4fe1ddf0
+0, 158, 158, 1, 152064, 0xc0f7d660
+0, 159, 159, 1, 152064, 0xd72458ea
+0, 160, 160, 1, 152064, 0x6978d123
+0, 161, 161, 1, 152064, 0x64e60ccf
+0, 162, 162, 1, 152064, 0xaa07004c
+0, 163, 163, 1, 152064, 0x07cd1064
+0, 164, 164, 1, 152064, 0xa82320e5
+0, 165, 165, 1, 152064, 0xaedd8d30
+0, 166, 166, 1, 152064, 0x79b082ea
+0, 167, 167, 1, 152064, 0x9ed800ab
+0, 168, 168, 1, 152064, 0xde592bb4
+0, 169, 169, 1, 152064, 0xd966df88
+0, 170, 170, 1, 152064, 0xf921988a
+0, 171, 171, 1, 152064, 0x557ad9ae
+0, 172, 172, 1, 152064, 0xc3f31a9a
+0, 173, 173, 1, 152064, 0x65248561
+0, 174, 174, 1, 152064, 0x63df4aa6
+0, 175, 175, 1, 152064, 0x618da0a9
+0, 176, 176, 1, 152064, 0xe6f1c435
+0, 177, 177, 1, 152064, 0x9f90c38f
+0, 178, 178, 1, 152064, 0xd2853e14
+0, 179, 179, 1, 152064, 0x6e0268a9
+0, 180, 180, 1, 152064, 0x393712d1
+0, 181, 181, 1, 152064, 0x470da25f
+0, 182, 182, 1, 152064, 0xaf55cb3d
+0, 183, 183, 1, 152064, 0x6935b8b9
+0, 184, 184, 1, 152064, 0x5409a15f
+0, 185, 185, 1, 152064, 0x09073fee
+0, 186, 186, 1, 152064, 0xfb274e82
+0, 187, 187, 1, 152064, 0x1a770581
+0, 188, 188, 1, 152064, 0x17277d0d
+0, 189, 189, 1, 152064, 0xd4dcd982
+0, 190, 190, 1, 152064, 0x6b04eaf3
+0, 191, 191, 1, 152064, 0x8a3d822e
+0, 192, 192, 1, 152064, 0x1b971ec9
+0, 193, 193, 1, 152064, 0x14e0c0f6
+0, 194, 194, 1, 152064, 0x00667450
+0, 195, 195, 1, 152064, 0xd2385902
+0, 196, 196, 1, 152064, 0x905da6ab
+0, 197, 197, 1, 152064, 0xa3ffb18b
+0, 198, 198, 1, 152064, 0x10d48b19
+0, 199, 199, 1, 152064, 0xb2c7a3bd
+0, 200, 200, 1, 152064, 0x45593e96
+0, 201, 201, 1, 152064, 0x47a0b60c
+0, 202, 202, 1, 152064, 0x68c6d1b9
+0, 203, 203, 1, 152064, 0xbc881fcc
+0, 204, 204, 1, 152064, 0x422cc6f2
+0, 205, 205, 1, 152064, 0x9b686410
+0, 206, 206, 1, 152064, 0x35dc5e86
+0, 207, 207, 1, 152064, 0x247bedaa
+0, 208, 208, 1, 152064, 0x22b76fd1
+0, 209, 209, 1, 152064, 0x67cc7a75
+0, 210, 210, 1, 152064, 0xa197521e
+0, 211, 211, 1, 152064, 0x428c8662
+0, 212, 212, 1, 152064, 0x33dc2c73
+0, 213, 213, 1, 152064, 0x5b538903
+0, 214, 214, 1, 152064, 0x3c4176b6
+0, 215, 215, 1, 152064, 0x774364ba
+0, 216, 216, 1, 152064, 0xf237d03e
+0, 217, 217, 1, 152064, 0xac8746fb
+0, 218, 218, 1, 152064, 0x6b306a84
+0, 219, 219, 1, 152064, 0xa2ace513
+0, 220, 220, 1, 152064, 0x709c9be7
+0, 221, 221, 1, 152064, 0x2403f373
+0, 222, 222, 1, 152064, 0x147bf717
+0, 223, 223, 1, 152064, 0xe58964c8
+0, 224, 224, 1, 152064, 0xa0da36fc
+0, 225, 225, 1, 152064, 0x1ac1355c
+0, 226, 226, 1, 152064, 0x8a31c9f2
+0, 227, 227, 1, 152064, 0x42ba205c
+0, 228, 228, 1, 152064, 0xa11b3575
+0, 229, 229, 1, 152064, 0xcb35207c
+0, 230, 230, 1, 152064, 0x528f6189
+0, 231, 231, 1, 152064, 0x34f05bd7
+0, 232, 232, 1, 152064, 0x72317356
+0, 233, 233, 1, 152064, 0xaabd5028
+0, 234, 234, 1, 152064, 0x13dbeb7b
+0, 235, 235, 1, 152064, 0x62f1e8a8
+0, 236, 236, 1, 152064, 0x1723bfcd
+0, 237, 237, 1, 152064, 0x5c083c00
+0, 238, 238, 1, 152064, 0x52137894
+0, 239, 239, 1, 152064, 0xef1e082c
+0, 240, 240, 1, 152064, 0x664b3d53
+0, 241, 241, 1, 152064, 0x2eb9b296
+0, 242, 242, 1, 152064, 0xd0ca511e
+0, 243, 243, 1, 152064, 0x012d4724
+0, 244, 244, 1, 152064, 0xa847f5af
+0, 245, 245, 1, 152064, 0x483a2fde
+0, 246, 246, 1, 152064, 0xd1ab0257
+0, 247, 247, 1, 152064, 0x414692c7
+0, 248, 248, 1, 152064, 0x0b79df88
+0, 249, 249, 1, 152064, 0xdaa2c4a3
+0, 250, 250, 1, 152064, 0xd1b44500
+0, 251, 251, 1, 152064, 0xfd3d2cf3
+0, 252, 252, 1, 152064, 0xfdc0f748
+0, 253, 253, 1, 152064, 0xce762a2a
+0, 254, 254, 1, 152064, 0x08b63572
+0, 255, 255, 1, 152064, 0x5a46a38d
+0, 256, 256, 1, 152064, 0x03cee9c0
+0, 257, 257, 1, 152064, 0x9ee45473
+0, 258, 258, 1, 152064, 0x5a432386
+0, 259, 259, 1, 152064, 0x54c83d87
+0, 260, 260, 1, 152064, 0xc9caa1de
+0, 261, 261, 1, 152064, 0xa28367f1
+0, 262, 262, 1, 152064, 0x2607cdf1
+0, 263, 263, 1, 152064, 0x06baa8de
+0, 264, 264, 1, 152064, 0xf5346e32
+0, 265, 265, 1, 152064, 0x6d3e732b
+0, 266, 266, 1, 152064, 0x798c584b
+0, 267, 267, 1, 152064, 0x4076c948
+0, 268, 268, 1, 152064, 0x868cf63a
+0, 269, 269, 1, 152064, 0x23107ac5
+0, 270, 270, 1, 152064, 0x306f3fe2
+0, 271, 271, 1, 152064, 0xbd1d71d6
+0, 272, 272, 1, 152064, 0x1429545f
+0, 273, 273, 1, 152064, 0xaded29aa
+0, 274, 274, 1, 152064, 0x9b455a94
+0, 275, 275, 1, 152064, 0xb3774ce7
+0, 276, 276, 1, 152064, 0x92580986
+0, 277, 277, 1, 152064, 0x0eae2f95
+0, 278, 278, 1, 152064, 0x599208b2
+0, 279, 279, 1, 152064, 0x4804c04c
+0, 280, 280, 1, 152064, 0x5f730e8f
+0, 281, 281, 1, 152064, 0x3e501d1e
+0, 282, 282, 1, 152064, 0x32100740
+0, 283, 283, 1, 152064, 0x62226ff8
+0, 284, 284, 1, 152064, 0x7683b622
+0, 285, 285, 1, 152064, 0xc3e0aec1
+0, 286, 286, 1, 152064, 0xfac12608
+0, 287, 287, 1, 152064, 0xb21a5781
+0, 288, 288, 1, 152064, 0x8f1e4964
+0, 289, 289, 1, 152064, 0x0f62dd6e
+0, 290, 290, 1, 152064, 0xac062ac4
+0, 291, 291, 1, 152064, 0x1b320f7a
+0, 292, 292, 1, 152064, 0x346e7211
+0, 293, 293, 1, 152064, 0xe47592f3
+0, 294, 294, 1, 152064, 0xa3a7919c
+0, 295, 295, 1, 152064, 0xa3580fa6
+0, 296, 296, 1, 152064, 0xc73430c1
+0, 297, 297, 1, 152064, 0x994a2c18
+0, 298, 298, 1, 152064, 0x0b5d8d45
+0, 299, 299, 1, 152064, 0x9eed5109
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-hpcalq_brcm_b b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-hpcalq_brcm_b
index b5778dd..49249b3 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-hpcalq_brcm_b
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-hpcalq_brcm_b
@@ -1,300 +1,301 @@
-0, 0, 152064, 0xf3c68dea
-0, 3600, 152064, 0xf52d483f
-0, 7200, 152064, 0x612f1792
-0, 10800, 152064, 0x4df34726
-0, 14400, 152064, 0xfed7c058
-0, 18000, 152064, 0x2d48025c
-0, 21600, 152064, 0x03544ab9
-0, 25200, 152064, 0x20cadfc5
-0, 28800, 152064, 0x7cd3672e
-0, 32400, 152064, 0x5f2b9ede
-0, 36000, 152064, 0xc0bbdf75
-0, 39600, 152064, 0x95571e7c
-0, 43200, 152064, 0x0d1afc5b
-0, 46800, 152064, 0x9c91c11f
-0, 50400, 152064, 0x73e667e4
-0, 54000, 152064, 0xfb7f8892
-0, 57600, 152064, 0x5707f566
-0, 61200, 152064, 0x21032449
-0, 64800, 152064, 0x199e20b7
-0, 68400, 152064, 0x23213179
-0, 72000, 152064, 0x29812daa
-0, 75600, 152064, 0x04e3eb6b
-0, 79200, 152064, 0xab206165
-0, 82800, 152064, 0x392fbf7b
-0, 86400, 152064, 0x137a1c6a
-0, 90000, 152064, 0x9caff265
-0, 93600, 152064, 0x6becf046
-0, 97200, 152064, 0xfc2c3ba6
-0, 100800, 152064, 0xcf4b9b4c
-0, 104400, 152064, 0x4e2ebd37
-0, 108000, 152064, 0xcd419daa
-0, 111600, 152064, 0xe12294b0
-0, 115200, 152064, 0x6bda7493
-0, 118800, 152064, 0xefbf5d0b
-0, 122400, 152064, 0x9500458a
-0, 126000, 152064, 0x6b5d212e
-0, 129600, 152064, 0xb928fc31
-0, 133200, 152064, 0x64f2bb2f
-0, 136800, 152064, 0xf93a724d
-0, 140400, 152064, 0xdd0d32c0
-0, 144000, 152064, 0xe1b51d95
-0, 147600, 152064, 0xbb43d295
-0, 151200, 152064, 0x6dcea069
-0, 154800, 152064, 0x89d79805
-0, 158400, 152064, 0x50b5dd43
-0, 162000, 152064, 0xe3099e3f
-0, 165600, 152064, 0x003b6ace
-0, 169200, 152064, 0x2213b672
-0, 172800, 152064, 0x5b273093
-0, 176400, 152064, 0xdbfbd9bf
-0, 180000, 152064, 0xf26b89d0
-0, 183600, 152064, 0x1470527e
-0, 187200, 152064, 0x0e668970
-0, 190800, 152064, 0x00218692
-0, 194400, 152064, 0xaabf79a8
-0, 198000, 152064, 0xf68b4663
-0, 201600, 152064, 0x4c08d01f
-0, 205200, 152064, 0x48e75380
-0, 208800, 152064, 0x4b8be58f
-0, 212400, 152064, 0x8a6c1365
-0, 216000, 152064, 0x9439ca02
-0, 219600, 152064, 0x831d9855
-0, 223200, 152064, 0xff031ffd
-0, 226800, 152064, 0x3680f4bc
-0, 230400, 152064, 0x794c95a4
-0, 234000, 152064, 0x23e53349
-0, 237600, 152064, 0x85307117
-0, 241200, 152064, 0x0bc0bf5a
-0, 244800, 152064, 0xc79f46c8
-0, 248400, 152064, 0x48be4e21
-0, 252000, 152064, 0x2ad89b4f
-0, 255600, 152064, 0xd454f9a9
-0, 259200, 152064, 0x64852f6d
-0, 262800, 152064, 0xcb7b0c05
-0, 266400, 152064, 0x4e108ced
-0, 270000, 152064, 0xf5e5a37b
-0, 273600, 152064, 0x224e29c7
-0, 277200, 152064, 0xad90d3c2
-0, 280800, 152064, 0x5ddb5d05
-0, 284400, 152064, 0x4ebf4337
-0, 288000, 152064, 0x7e2bfeed
-0, 291600, 152064, 0x00e884c7
-0, 295200, 152064, 0xa4f6a534
-0, 298800, 152064, 0x622f1511
-0, 302400, 152064, 0x8d99233d
-0, 306000, 152064, 0x5910d02c
-0, 309600, 152064, 0x20d6706c
-0, 313200, 152064, 0x8e30a417
-0, 316800, 152064, 0x180d745a
-0, 320400, 152064, 0xc25189b9
-0, 324000, 152064, 0x909101ad
-0, 327600, 152064, 0x9967be1c
-0, 331200, 152064, 0x72ff3206
-0, 334800, 152064, 0x48d07f48
-0, 338400, 152064, 0x7f8244b7
-0, 342000, 152064, 0xf871e21e
-0, 345600, 152064, 0xd4743610
-0, 349200, 152064, 0xc2c7a7b1
-0, 352800, 152064, 0x95be1a75
-0, 356400, 152064, 0x44972b2e
-0, 360000, 152064, 0xa6036c4f
-0, 363600, 152064, 0xecdd8dd6
-0, 367200, 152064, 0xbb7e8551
-0, 370800, 152064, 0x42916e6c
-0, 374400, 152064, 0x972db010
-0, 378000, 152064, 0x80dab6a0
-0, 381600, 152064, 0xc753ecdb
-0, 385200, 152064, 0x0823bffa
-0, 388800, 152064, 0x80876b2d
-0, 392400, 152064, 0x4a8b2118
-0, 396000, 152064, 0x0be2c13d
-0, 399600, 152064, 0xa6966e4f
-0, 403200, 152064, 0xf6a57650
-0, 406800, 152064, 0x49d66fd4
-0, 410400, 152064, 0x21d92047
-0, 414000, 152064, 0x155f20a8
-0, 417600, 152064, 0x5ab90c1d
-0, 421200, 152064, 0xa0c31337
-0, 424800, 152064, 0xd20de1d6
-0, 428400, 152064, 0x300ad916
-0, 432000, 152064, 0xbcb89eb5
-0, 435600, 152064, 0x08759342
-0, 439200, 152064, 0xa5d06e72
-0, 442800, 152064, 0x3b4c537f
-0, 446400, 152064, 0x7f48912b
-0, 450000, 152064, 0x200dbd1f
-0, 453600, 152064, 0x918abfde
-0, 457200, 152064, 0xd8072cdf
-0, 460800, 152064, 0x89d2902b
-0, 464400, 152064, 0xcd2e2e3c
-0, 468000, 152064, 0xf343e4a2
-0, 471600, 152064, 0xc424acad
-0, 475200, 152064, 0xf71e3031
-0, 478800, 152064, 0xf1bc1179
-0, 482400, 152064, 0x9af58d24
-0, 486000, 152064, 0x48a4d01e
-0, 489600, 152064, 0xcf24f721
-0, 493200, 152064, 0x5bc7b4f3
-0, 496800, 152064, 0x8763fc59
-0, 500400, 152064, 0xb6954051
-0, 504000, 152064, 0x044ba446
-0, 507600, 152064, 0xdaaaee7e
-0, 511200, 152064, 0x8eac550d
-0, 514800, 152064, 0x5191d08c
-0, 518400, 152064, 0x3cd76d43
-0, 522000, 152064, 0xf01f8fa9
-0, 525600, 152064, 0x0e283e9b
-0, 529200, 152064, 0x7cef69ee
-0, 532800, 152064, 0xc8e332bc
-0, 536400, 152064, 0x5b1aa484
-0, 540000, 152064, 0x3975234f
-0, 543600, 152064, 0x52b8661e
-0, 547200, 152064, 0xb4b8fed8
-0, 550800, 152064, 0x5aff9f70
-0, 554400, 152064, 0x7b575735
-0, 558000, 152064, 0x77d51523
-0, 561600, 152064, 0xf5131eba
-0, 565200, 152064, 0x4bd2b1ad
-0, 568800, 152064, 0xccfc8dca
-0, 572400, 152064, 0xcf245472
-0, 576000, 152064, 0xe055adf5
-0, 579600, 152064, 0x2a90e171
-0, 583200, 152064, 0x1bd8ea64
-0, 586800, 152064, 0x32f1d794
-0, 590400, 152064, 0xc938c42a
-0, 594000, 152064, 0x12b5644f
-0, 597600, 152064, 0x99003711
-0, 601200, 152064, 0xaecfad1c
-0, 604800, 152064, 0x94b00ae1
-0, 608400, 152064, 0xbb4f982f
-0, 612000, 152064, 0x6f7f5dc1
-0, 615600, 152064, 0x7be7c2cb
-0, 619200, 152064, 0x3b2ee4d3
-0, 622800, 152064, 0xc75f5666
-0, 626400, 152064, 0xff7a3ede
-0, 630000, 152064, 0x55866b59
-0, 633600, 152064, 0x408b8455
-0, 637200, 152064, 0x96c4ab66
-0, 640800, 152064, 0x1d87f575
-0, 644400, 152064, 0x3a3b17ac
-0, 648000, 152064, 0x9c99e591
-0, 651600, 152064, 0xc1fc663d
-0, 655200, 152064, 0x17b982dd
-0, 658800, 152064, 0x24fe9dad
-0, 662400, 152064, 0xea8760ee
-0, 666000, 152064, 0x23dcefad
-0, 669600, 152064, 0xee6d23f0
-0, 673200, 152064, 0xfddc1962
-0, 676800, 152064, 0xb23190df
-0, 680400, 152064, 0xf066a595
-0, 684000, 152064, 0x2200fef8
-0, 687600, 152064, 0x5491ab2f
-0, 691200, 152064, 0xea93fa58
-0, 694800, 152064, 0x3e13d4f4
-0, 698400, 152064, 0x3dda841d
-0, 702000, 152064, 0xfc243577
-0, 705600, 152064, 0xca4a9127
-0, 709200, 152064, 0x41908ec0
-0, 712800, 152064, 0x10a758bd
-0, 716400, 152064, 0x6a849e5b
-0, 720000, 152064, 0xb55a1f2b
-0, 723600, 152064, 0x2bfe9627
-0, 727200, 152064, 0x2bfca28c
-0, 730800, 152064, 0xd166f336
-0, 734400, 152064, 0x9facb32b
-0, 738000, 152064, 0x6a672475
-0, 741600, 152064, 0xc7b219cf
-0, 745200, 152064, 0x2b43ca53
-0, 748800, 152064, 0x43b542c4
-0, 752400, 152064, 0xdc654337
-0, 756000, 152064, 0x68003d7c
-0, 759600, 152064, 0x3cb85724
-0, 763200, 152064, 0x422701c2
-0, 766800, 152064, 0x1c667870
-0, 770400, 152064, 0x75ef3230
-0, 774000, 152064, 0x0ac82643
-0, 777600, 152064, 0x3eb3a0be
-0, 781200, 152064, 0x482bd77e
-0, 784800, 152064, 0xd3ce1171
-0, 788400, 152064, 0xeaefc7e4
-0, 792000, 152064, 0xa9c67939
-0, 795600, 152064, 0x0af0a25b
-0, 799200, 152064, 0xd094d95a
-0, 802800, 152064, 0xfda42fc6
-0, 806400, 152064, 0x4669f952
-0, 810000, 152064, 0x52d40e98
-0, 813600, 152064, 0x27c36cd1
-0, 817200, 152064, 0xa103b6ce
-0, 820800, 152064, 0x2be9026d
-0, 824400, 152064, 0x2f4ecc59
-0, 828000, 152064, 0x53144cef
-0, 831600, 152064, 0x15d54fc9
-0, 835200, 152064, 0x7e302db7
-0, 838800, 152064, 0x82521901
-0, 842400, 152064, 0x1123cdb6
-0, 846000, 152064, 0x3185878a
-0, 849600, 152064, 0xbb294983
-0, 853200, 152064, 0x83d9fe66
-0, 856800, 152064, 0xede9fb08
-0, 860400, 152064, 0xa543b551
-0, 864000, 152064, 0x39e82734
-0, 867600, 152064, 0xd0447fb5
-0, 871200, 152064, 0x8cc6f502
-0, 874800, 152064, 0xda8d1da8
-0, 878400, 152064, 0xcafdccca
-0, 882000, 152064, 0xbf0e04f4
-0, 885600, 152064, 0x0c6eefec
-0, 889200, 152064, 0xb9026d39
-0, 892800, 152064, 0x0121a7a8
-0, 896400, 152064, 0x453ebbc6
-0, 900000, 152064, 0x14ae15e3
-0, 903600, 152064, 0x51d618e1
-0, 907200, 152064, 0x2254f452
-0, 910800, 152064, 0x8c360633
-0, 914400, 152064, 0x8704d9bc
-0, 918000, 152064, 0xe5d48301
-0, 921600, 152064, 0xf25b7b3f
-0, 925200, 152064, 0xd2ad3b73
-0, 928800, 152064, 0x53db0387
-0, 932400, 152064, 0x2486341c
-0, 936000, 152064, 0x4a24570b
-0, 939600, 152064, 0x0694620a
-0, 943200, 152064, 0xbbc2a302
-0, 946800, 152064, 0x08ad9c02
-0, 950400, 152064, 0x601a63ab
-0, 954000, 152064, 0xe4234a48
-0, 957600, 152064, 0x07702235
-0, 961200, 152064, 0x719dbecf
-0, 964800, 152064, 0xf301a7ad
-0, 968400, 152064, 0xf15c70c3
-0, 972000, 152064, 0x0ab93386
-0, 975600, 152064, 0x99c05adb
-0, 979200, 152064, 0x9ed43530
-0, 982800, 152064, 0xa2f62122
-0, 986400, 152064, 0xf16f4525
-0, 990000, 152064, 0xa3403b4a
-0, 993600, 152064, 0x95521096
-0, 997200, 152064, 0x0d412988
-0, 1000800, 152064, 0x829e080a
-0, 1004400, 152064, 0x0805c1b5
-0, 1008000, 152064, 0xa136be48
-0, 1011600, 152064, 0x0f8de228
-0, 1015200, 152064, 0x272cf2d3
-0, 1018800, 152064, 0xa1df2a5e
-0, 1022400, 152064, 0xf9db8350
-0, 1026000, 152064, 0x5536997d
-0, 1029600, 152064, 0xab83e81e
-0, 1033200, 152064, 0xec791b49
-0, 1036800, 152064, 0x04d03e19
-0, 1040400, 152064, 0xd6a2bd21
-0, 1044000, 152064, 0x2d35f0aa
-0, 1047600, 152064, 0x137bf715
-0, 1051200, 152064, 0x56ef5ae1
-0, 1054800, 152064, 0x9bb5821e
-0, 1058400, 152064, 0x533c7fff
-0, 1062000, 152064, 0x469ad380
-0, 1065600, 152064, 0x75710e84
-0, 1069200, 152064, 0xbbd72551
-0, 1072800, 152064, 0xf1137026
-0, 1076400, 152064, 0x6238412b
+#tb 0: 1/25
+0, 0, 0, 1, 152064, 0xf3c68dea
+0, 1, 1, 1, 152064, 0xf52d483f
+0, 2, 2, 1, 152064, 0x612f1792
+0, 3, 3, 1, 152064, 0x4df34726
+0, 4, 4, 1, 152064, 0xfed7c058
+0, 5, 5, 1, 152064, 0x2d48025c
+0, 6, 6, 1, 152064, 0x03544ab9
+0, 7, 7, 1, 152064, 0x20cadfc5
+0, 8, 8, 1, 152064, 0x7cd3672e
+0, 9, 9, 1, 152064, 0x5f2b9ede
+0, 10, 10, 1, 152064, 0xc0bbdf75
+0, 11, 11, 1, 152064, 0x95571e7c
+0, 12, 12, 1, 152064, 0x0d1afc5b
+0, 13, 13, 1, 152064, 0x9c91c11f
+0, 14, 14, 1, 152064, 0x73e667e4
+0, 15, 15, 1, 152064, 0xfb7f8892
+0, 16, 16, 1, 152064, 0x5707f566
+0, 17, 17, 1, 152064, 0x21032449
+0, 18, 18, 1, 152064, 0x199e20b7
+0, 19, 19, 1, 152064, 0x23213179
+0, 20, 20, 1, 152064, 0x29812daa
+0, 21, 21, 1, 152064, 0x04e3eb6b
+0, 22, 22, 1, 152064, 0xab206165
+0, 23, 23, 1, 152064, 0x392fbf7b
+0, 24, 24, 1, 152064, 0x137a1c6a
+0, 25, 25, 1, 152064, 0x9caff265
+0, 26, 26, 1, 152064, 0x6becf046
+0, 27, 27, 1, 152064, 0xfc2c3ba6
+0, 28, 28, 1, 152064, 0xcf4b9b4c
+0, 29, 29, 1, 152064, 0x4e2ebd37
+0, 30, 30, 1, 152064, 0xcd419daa
+0, 31, 31, 1, 152064, 0xe12294b0
+0, 32, 32, 1, 152064, 0x6bda7493
+0, 33, 33, 1, 152064, 0xefbf5d0b
+0, 34, 34, 1, 152064, 0x9500458a
+0, 35, 35, 1, 152064, 0x6b5d212e
+0, 36, 36, 1, 152064, 0xb928fc31
+0, 37, 37, 1, 152064, 0x64f2bb2f
+0, 38, 38, 1, 152064, 0xf93a724d
+0, 39, 39, 1, 152064, 0xdd0d32c0
+0, 40, 40, 1, 152064, 0xe1b51d95
+0, 41, 41, 1, 152064, 0xbb43d295
+0, 42, 42, 1, 152064, 0x6dcea069
+0, 43, 43, 1, 152064, 0x89d79805
+0, 44, 44, 1, 152064, 0x50b5dd43
+0, 45, 45, 1, 152064, 0xe3099e3f
+0, 46, 46, 1, 152064, 0x003b6ace
+0, 47, 47, 1, 152064, 0x2213b672
+0, 48, 48, 1, 152064, 0x5b273093
+0, 49, 49, 1, 152064, 0xdbfbd9bf
+0, 50, 50, 1, 152064, 0xf26b89d0
+0, 51, 51, 1, 152064, 0x1470527e
+0, 52, 52, 1, 152064, 0x0e668970
+0, 53, 53, 1, 152064, 0x00218692
+0, 54, 54, 1, 152064, 0xaabf79a8
+0, 55, 55, 1, 152064, 0xf68b4663
+0, 56, 56, 1, 152064, 0x4c08d01f
+0, 57, 57, 1, 152064, 0x48e75380
+0, 58, 58, 1, 152064, 0x4b8be58f
+0, 59, 59, 1, 152064, 0x8a6c1365
+0, 60, 60, 1, 152064, 0x9439ca02
+0, 61, 61, 1, 152064, 0x831d9855
+0, 62, 62, 1, 152064, 0xff031ffd
+0, 63, 63, 1, 152064, 0x3680f4bc
+0, 64, 64, 1, 152064, 0x794c95a4
+0, 65, 65, 1, 152064, 0x23e53349
+0, 66, 66, 1, 152064, 0x85307117
+0, 67, 67, 1, 152064, 0x0bc0bf5a
+0, 68, 68, 1, 152064, 0xc79f46c8
+0, 69, 69, 1, 152064, 0x48be4e21
+0, 70, 70, 1, 152064, 0x2ad89b4f
+0, 71, 71, 1, 152064, 0xd454f9a9
+0, 72, 72, 1, 152064, 0x64852f6d
+0, 73, 73, 1, 152064, 0xcb7b0c05
+0, 74, 74, 1, 152064, 0x4e108ced
+0, 75, 75, 1, 152064, 0xf5e5a37b
+0, 76, 76, 1, 152064, 0x224e29c7
+0, 77, 77, 1, 152064, 0xad90d3c2
+0, 78, 78, 1, 152064, 0x5ddb5d05
+0, 79, 79, 1, 152064, 0x4ebf4337
+0, 80, 80, 1, 152064, 0x7e2bfeed
+0, 81, 81, 1, 152064, 0x00e884c7
+0, 82, 82, 1, 152064, 0xa4f6a534
+0, 83, 83, 1, 152064, 0x622f1511
+0, 84, 84, 1, 152064, 0x8d99233d
+0, 85, 85, 1, 152064, 0x5910d02c
+0, 86, 86, 1, 152064, 0x20d6706c
+0, 87, 87, 1, 152064, 0x8e30a417
+0, 88, 88, 1, 152064, 0x180d745a
+0, 89, 89, 1, 152064, 0xc25189b9
+0, 90, 90, 1, 152064, 0x909101ad
+0, 91, 91, 1, 152064, 0x9967be1c
+0, 92, 92, 1, 152064, 0x72ff3206
+0, 93, 93, 1, 152064, 0x48d07f48
+0, 94, 94, 1, 152064, 0x7f8244b7
+0, 95, 95, 1, 152064, 0xf871e21e
+0, 96, 96, 1, 152064, 0xd4743610
+0, 97, 97, 1, 152064, 0xc2c7a7b1
+0, 98, 98, 1, 152064, 0x95be1a75
+0, 99, 99, 1, 152064, 0x44972b2e
+0, 100, 100, 1, 152064, 0xa6036c4f
+0, 101, 101, 1, 152064, 0xecdd8dd6
+0, 102, 102, 1, 152064, 0xbb7e8551
+0, 103, 103, 1, 152064, 0x42916e6c
+0, 104, 104, 1, 152064, 0x972db010
+0, 105, 105, 1, 152064, 0x80dab6a0
+0, 106, 106, 1, 152064, 0xc753ecdb
+0, 107, 107, 1, 152064, 0x0823bffa
+0, 108, 108, 1, 152064, 0x80876b2d
+0, 109, 109, 1, 152064, 0x4a8b2118
+0, 110, 110, 1, 152064, 0x0be2c13d
+0, 111, 111, 1, 152064, 0xa6966e4f
+0, 112, 112, 1, 152064, 0xf6a57650
+0, 113, 113, 1, 152064, 0x49d66fd4
+0, 114, 114, 1, 152064, 0x21d92047
+0, 115, 115, 1, 152064, 0x155f20a8
+0, 116, 116, 1, 152064, 0x5ab90c1d
+0, 117, 117, 1, 152064, 0xa0c31337
+0, 118, 118, 1, 152064, 0xd20de1d6
+0, 119, 119, 1, 152064, 0x300ad916
+0, 120, 120, 1, 152064, 0xbcb89eb5
+0, 121, 121, 1, 152064, 0x08759342
+0, 122, 122, 1, 152064, 0xa5d06e72
+0, 123, 123, 1, 152064, 0x3b4c537f
+0, 124, 124, 1, 152064, 0x7f48912b
+0, 125, 125, 1, 152064, 0x200dbd1f
+0, 126, 126, 1, 152064, 0x918abfde
+0, 127, 127, 1, 152064, 0xd8072cdf
+0, 128, 128, 1, 152064, 0x89d2902b
+0, 129, 129, 1, 152064, 0xcd2e2e3c
+0, 130, 130, 1, 152064, 0xf343e4a2
+0, 131, 131, 1, 152064, 0xc424acad
+0, 132, 132, 1, 152064, 0xf71e3031
+0, 133, 133, 1, 152064, 0xf1bc1179
+0, 134, 134, 1, 152064, 0x9af58d24
+0, 135, 135, 1, 152064, 0x48a4d01e
+0, 136, 136, 1, 152064, 0xcf24f721
+0, 137, 137, 1, 152064, 0x5bc7b4f3
+0, 138, 138, 1, 152064, 0x8763fc59
+0, 139, 139, 1, 152064, 0xb6954051
+0, 140, 140, 1, 152064, 0x044ba446
+0, 141, 141, 1, 152064, 0xdaaaee7e
+0, 142, 142, 1, 152064, 0x8eac550d
+0, 143, 143, 1, 152064, 0x5191d08c
+0, 144, 144, 1, 152064, 0x3cd76d43
+0, 145, 145, 1, 152064, 0xf01f8fa9
+0, 146, 146, 1, 152064, 0x0e283e9b
+0, 147, 147, 1, 152064, 0x7cef69ee
+0, 148, 148, 1, 152064, 0xc8e332bc
+0, 149, 149, 1, 152064, 0x5b1aa484
+0, 150, 150, 1, 152064, 0x3975234f
+0, 151, 151, 1, 152064, 0x52b8661e
+0, 152, 152, 1, 152064, 0xb4b8fed8
+0, 153, 153, 1, 152064, 0x5aff9f70
+0, 154, 154, 1, 152064, 0x7b575735
+0, 155, 155, 1, 152064, 0x77d51523
+0, 156, 156, 1, 152064, 0xf5131eba
+0, 157, 157, 1, 152064, 0x4bd2b1ad
+0, 158, 158, 1, 152064, 0xccfc8dca
+0, 159, 159, 1, 152064, 0xcf245472
+0, 160, 160, 1, 152064, 0xe055adf5
+0, 161, 161, 1, 152064, 0x2a90e171
+0, 162, 162, 1, 152064, 0x1bd8ea64
+0, 163, 163, 1, 152064, 0x32f1d794
+0, 164, 164, 1, 152064, 0xc938c42a
+0, 165, 165, 1, 152064, 0x12b5644f
+0, 166, 166, 1, 152064, 0x99003711
+0, 167, 167, 1, 152064, 0xaecfad1c
+0, 168, 168, 1, 152064, 0x94b00ae1
+0, 169, 169, 1, 152064, 0xbb4f982f
+0, 170, 170, 1, 152064, 0x6f7f5dc1
+0, 171, 171, 1, 152064, 0x7be7c2cb
+0, 172, 172, 1, 152064, 0x3b2ee4d3
+0, 173, 173, 1, 152064, 0xc75f5666
+0, 174, 174, 1, 152064, 0xff7a3ede
+0, 175, 175, 1, 152064, 0x55866b59
+0, 176, 176, 1, 152064, 0x408b8455
+0, 177, 177, 1, 152064, 0x96c4ab66
+0, 178, 178, 1, 152064, 0x1d87f575
+0, 179, 179, 1, 152064, 0x3a3b17ac
+0, 180, 180, 1, 152064, 0x9c99e591
+0, 181, 181, 1, 152064, 0xc1fc663d
+0, 182, 182, 1, 152064, 0x17b982dd
+0, 183, 183, 1, 152064, 0x24fe9dad
+0, 184, 184, 1, 152064, 0xea8760ee
+0, 185, 185, 1, 152064, 0x23dcefad
+0, 186, 186, 1, 152064, 0xee6d23f0
+0, 187, 187, 1, 152064, 0xfddc1962
+0, 188, 188, 1, 152064, 0xb23190df
+0, 189, 189, 1, 152064, 0xf066a595
+0, 190, 190, 1, 152064, 0x2200fef8
+0, 191, 191, 1, 152064, 0x5491ab2f
+0, 192, 192, 1, 152064, 0xea93fa58
+0, 193, 193, 1, 152064, 0x3e13d4f4
+0, 194, 194, 1, 152064, 0x3dda841d
+0, 195, 195, 1, 152064, 0xfc243577
+0, 196, 196, 1, 152064, 0xca4a9127
+0, 197, 197, 1, 152064, 0x41908ec0
+0, 198, 198, 1, 152064, 0x10a758bd
+0, 199, 199, 1, 152064, 0x6a849e5b
+0, 200, 200, 1, 152064, 0xb55a1f2b
+0, 201, 201, 1, 152064, 0x2bfe9627
+0, 202, 202, 1, 152064, 0x2bfca28c
+0, 203, 203, 1, 152064, 0xd166f336
+0, 204, 204, 1, 152064, 0x9facb32b
+0, 205, 205, 1, 152064, 0x6a672475
+0, 206, 206, 1, 152064, 0xc7b219cf
+0, 207, 207, 1, 152064, 0x2b43ca53
+0, 208, 208, 1, 152064, 0x43b542c4
+0, 209, 209, 1, 152064, 0xdc654337
+0, 210, 210, 1, 152064, 0x68003d7c
+0, 211, 211, 1, 152064, 0x3cb85724
+0, 212, 212, 1, 152064, 0x422701c2
+0, 213, 213, 1, 152064, 0x1c667870
+0, 214, 214, 1, 152064, 0x75ef3230
+0, 215, 215, 1, 152064, 0x0ac82643
+0, 216, 216, 1, 152064, 0x3eb3a0be
+0, 217, 217, 1, 152064, 0x482bd77e
+0, 218, 218, 1, 152064, 0xd3ce1171
+0, 219, 219, 1, 152064, 0xeaefc7e4
+0, 220, 220, 1, 152064, 0xa9c67939
+0, 221, 221, 1, 152064, 0x0af0a25b
+0, 222, 222, 1, 152064, 0xd094d95a
+0, 223, 223, 1, 152064, 0xfda42fc6
+0, 224, 224, 1, 152064, 0x4669f952
+0, 225, 225, 1, 152064, 0x52d40e98
+0, 226, 226, 1, 152064, 0x27c36cd1
+0, 227, 227, 1, 152064, 0xa103b6ce
+0, 228, 228, 1, 152064, 0x2be9026d
+0, 229, 229, 1, 152064, 0x2f4ecc59
+0, 230, 230, 1, 152064, 0x53144cef
+0, 231, 231, 1, 152064, 0x15d54fc9
+0, 232, 232, 1, 152064, 0x7e302db7
+0, 233, 233, 1, 152064, 0x82521901
+0, 234, 234, 1, 152064, 0x1123cdb6
+0, 235, 235, 1, 152064, 0x3185878a
+0, 236, 236, 1, 152064, 0xbb294983
+0, 237, 237, 1, 152064, 0x83d9fe66
+0, 238, 238, 1, 152064, 0xede9fb08
+0, 239, 239, 1, 152064, 0xa543b551
+0, 240, 240, 1, 152064, 0x39e82734
+0, 241, 241, 1, 152064, 0xd0447fb5
+0, 242, 242, 1, 152064, 0x8cc6f502
+0, 243, 243, 1, 152064, 0xda8d1da8
+0, 244, 244, 1, 152064, 0xcafdccca
+0, 245, 245, 1, 152064, 0xbf0e04f4
+0, 246, 246, 1, 152064, 0x0c6eefec
+0, 247, 247, 1, 152064, 0xb9026d39
+0, 248, 248, 1, 152064, 0x0121a7a8
+0, 249, 249, 1, 152064, 0x453ebbc6
+0, 250, 250, 1, 152064, 0x14ae15e3
+0, 251, 251, 1, 152064, 0x51d618e1
+0, 252, 252, 1, 152064, 0x2254f452
+0, 253, 253, 1, 152064, 0x8c360633
+0, 254, 254, 1, 152064, 0x8704d9bc
+0, 255, 255, 1, 152064, 0xe5d48301
+0, 256, 256, 1, 152064, 0xf25b7b3f
+0, 257, 257, 1, 152064, 0xd2ad3b73
+0, 258, 258, 1, 152064, 0x53db0387
+0, 259, 259, 1, 152064, 0x2486341c
+0, 260, 260, 1, 152064, 0x4a24570b
+0, 261, 261, 1, 152064, 0x0694620a
+0, 262, 262, 1, 152064, 0xbbc2a302
+0, 263, 263, 1, 152064, 0x08ad9c02
+0, 264, 264, 1, 152064, 0x601a63ab
+0, 265, 265, 1, 152064, 0xe4234a48
+0, 266, 266, 1, 152064, 0x07702235
+0, 267, 267, 1, 152064, 0x719dbecf
+0, 268, 268, 1, 152064, 0xf301a7ad
+0, 269, 269, 1, 152064, 0xf15c70c3
+0, 270, 270, 1, 152064, 0x0ab93386
+0, 271, 271, 1, 152064, 0x99c05adb
+0, 272, 272, 1, 152064, 0x9ed43530
+0, 273, 273, 1, 152064, 0xa2f62122
+0, 274, 274, 1, 152064, 0xf16f4525
+0, 275, 275, 1, 152064, 0xa3403b4a
+0, 276, 276, 1, 152064, 0x95521096
+0, 277, 277, 1, 152064, 0x0d412988
+0, 278, 278, 1, 152064, 0x829e080a
+0, 279, 279, 1, 152064, 0x0805c1b5
+0, 280, 280, 1, 152064, 0xa136be48
+0, 281, 281, 1, 152064, 0x0f8de228
+0, 282, 282, 1, 152064, 0x272cf2d3
+0, 283, 283, 1, 152064, 0xa1df2a5e
+0, 284, 284, 1, 152064, 0xf9db8350
+0, 285, 285, 1, 152064, 0x5536997d
+0, 286, 286, 1, 152064, 0xab83e81e
+0, 287, 287, 1, 152064, 0xec791b49
+0, 288, 288, 1, 152064, 0x04d03e19
+0, 289, 289, 1, 152064, 0xd6a2bd21
+0, 290, 290, 1, 152064, 0x2d35f0aa
+0, 291, 291, 1, 152064, 0x137bf715
+0, 292, 292, 1, 152064, 0x56ef5ae1
+0, 293, 293, 1, 152064, 0x9bb5821e
+0, 294, 294, 1, 152064, 0x533c7fff
+0, 295, 295, 1, 152064, 0x469ad380
+0, 296, 296, 1, 152064, 0x75710e84
+0, 297, 297, 1, 152064, 0xbbd72551
+0, 298, 298, 1, 152064, 0xf1137026
+0, 299, 299, 1, 152064, 0x6238412b
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-hpcamapalq_bcrm_b b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-hpcamapalq_bcrm_b
index 4f6f2ba..a81e91f 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-hpcamapalq_bcrm_b
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-hpcamapalq_bcrm_b
@@ -1,300 +1,301 @@
-0, 0, 152064, 0xf8248ceb
-0, 3600, 152064, 0xb6204c81
-0, 7200, 152064, 0x22fb1737
-0, 10800, 152064, 0xce8c3fd7
-0, 14400, 152064, 0xee88cedc
-0, 18000, 152064, 0x1d4209ca
-0, 21600, 152064, 0x6fb15238
-0, 25200, 152064, 0x505200c2
-0, 28800, 152064, 0xb73574ba
-0, 32400, 152064, 0x0586a097
-0, 36000, 152064, 0xed50fe02
-0, 39600, 152064, 0x222221ab
-0, 43200, 152064, 0x8afefd46
-0, 46800, 152064, 0x6832c5cc
-0, 50400, 152064, 0xba4c8110
-0, 54000, 152064, 0x95c07e1e
-0, 57600, 152064, 0xc5d6fde9
-0, 61200, 152064, 0xe75a4921
-0, 64800, 152064, 0x53b61688
-0, 68400, 152064, 0x0335424b
-0, 72000, 152064, 0x621742c7
-0, 75600, 152064, 0x4f69f41b
-0, 79200, 152064, 0x6b3f65d7
-0, 82800, 152064, 0x8dfde04f
-0, 86400, 152064, 0x30750ff5
-0, 90000, 152064, 0xe3d70f3c
-0, 93600, 152064, 0x0c1af825
-0, 97200, 152064, 0x58a53935
-0, 100800, 152064, 0xc63d9e98
-0, 104400, 152064, 0xa85fdc48
-0, 108000, 152064, 0x01bb9784
-0, 111600, 152064, 0xdd5cb509
-0, 115200, 152064, 0x29ae7d2b
-0, 118800, 152064, 0xdb08593e
-0, 122400, 152064, 0x372d5d4e
-0, 126000, 152064, 0x31522664
-0, 129600, 152064, 0x3f13f335
-0, 133200, 152064, 0xfd10c19a
-0, 136800, 152064, 0xef728975
-0, 140400, 152064, 0x8e79234d
-0, 144000, 152064, 0x47022791
-0, 147600, 152064, 0x1ef9d297
-0, 151200, 152064, 0x77bf9738
-0, 154800, 152064, 0xd6bc8f03
-0, 158400, 152064, 0x283ded4a
-0, 162000, 152064, 0xd87098d1
-0, 165600, 152064, 0x300077a2
-0, 169200, 152064, 0x30ffbea4
-0, 172800, 152064, 0x5dc5356b
-0, 176400, 152064, 0x31cce185
-0, 180000, 152064, 0x47fc9148
-0, 183600, 152064, 0x1641491e
-0, 187200, 152064, 0x2184937d
-0, 190800, 152064, 0x126eb74a
-0, 194400, 152064, 0x25c07593
-0, 198000, 152064, 0xb1294e7e
-0, 201600, 152064, 0x8b35f45d
-0, 205200, 152064, 0x54765025
-0, 208800, 152064, 0x1d17e901
-0, 212400, 152064, 0xaeab358d
-0, 216000, 152064, 0xf682c91f
-0, 219600, 152064, 0x0b4c9b06
-0, 223200, 152064, 0x45f326dc
-0, 226800, 152064, 0x132eeda3
-0, 230400, 152064, 0x3c9b8e16
-0, 234000, 152064, 0x1be133c1
-0, 237600, 152064, 0xfa876720
-0, 241200, 152064, 0x1666cdb8
-0, 244800, 152064, 0x362f418f
-0, 248400, 152064, 0x926b4a96
-0, 252000, 152064, 0xee3da1df
-0, 255600, 152064, 0xc11f025d
-0, 259200, 152064, 0x9ba62c19
-0, 262800, 152064, 0x0d66194f
-0, 266400, 152064, 0x2fd09340
-0, 270000, 152064, 0x3dfb9e4d
-0, 273600, 152064, 0xa3192ce6
-0, 277200, 152064, 0x6bfce0e1
-0, 280800, 152064, 0x3b7c5286
-0, 284400, 152064, 0xb52f4bf5
-0, 288000, 152064, 0x30870027
-0, 291600, 152064, 0x6f8e71c3
-0, 295200, 152064, 0x8d41b09a
-0, 298800, 152064, 0xc1ff1d05
-0, 302400, 152064, 0xca54125c
-0, 306000, 152064, 0x3342d823
-0, 309600, 152064, 0xcc4a7542
-0, 313200, 152064, 0x21fc9a9d
-0, 316800, 152064, 0x91587574
-0, 320400, 152064, 0x30929cc2
-0, 324000, 152064, 0xf07606b7
-0, 327600, 152064, 0x0476b876
-0, 331200, 152064, 0x213333dc
-0, 334800, 152064, 0x87c67597
-0, 338400, 152064, 0x05434641
-0, 342000, 152064, 0x959eeffc
-0, 345600, 152064, 0x92a130b4
-0, 349200, 152064, 0x53d0b544
-0, 352800, 152064, 0xaf8c233e
-0, 356400, 152064, 0xd3d4259a
-0, 360000, 152064, 0xa0287753
-0, 363600, 152064, 0xfa23972a
-0, 367200, 152064, 0xacae756d
-0, 370800, 152064, 0xd8b58b5c
-0, 374400, 152064, 0x7db2c755
-0, 378000, 152064, 0x31e7b79a
-0, 381600, 152064, 0xd8660d98
-0, 385200, 152064, 0xdcf0d10d
-0, 388800, 152064, 0x3e6567e6
-0, 392400, 152064, 0xec3530fd
-0, 396000, 152064, 0xf686c61a
-0, 399600, 152064, 0x6e706804
-0, 403200, 152064, 0x5fd4a1a3
-0, 406800, 152064, 0xbb3384f7
-0, 410400, 152064, 0x8ffb14dd
-0, 414000, 152064, 0x01253a73
-0, 417600, 152064, 0xf89c15df
-0, 421200, 152064, 0xda2b0b4c
-0, 424800, 152064, 0xfc9dfcc1
-0, 428400, 152064, 0xfef4f0fa
-0, 432000, 152064, 0x91669bea
-0, 435600, 152064, 0x3664a565
-0, 439200, 152064, 0x32dd7923
-0, 442800, 152064, 0x26825231
-0, 446400, 152064, 0x5f81896e
-0, 450000, 152064, 0x0c64ca2f
-0, 453600, 152064, 0x488bb665
-0, 457200, 152064, 0x4d183a0f
-0, 460800, 152064, 0xed169321
-0, 464400, 152064, 0xcec22917
-0, 468000, 152064, 0xbe04ea6c
-0, 471600, 152064, 0x32b8bf9f
-0, 475200, 152064, 0x9c7c2e13
-0, 478800, 152064, 0x232e3016
-0, 482400, 152064, 0x1b76c08e
-0, 486000, 152064, 0x7425d821
-0, 489600, 152064, 0x0818ff3c
-0, 493200, 152064, 0xb4f2c42b
-0, 496800, 152064, 0xe029f979
-0, 500400, 152064, 0x97c54c2f
-0, 504000, 152064, 0xd101c3b5
-0, 507600, 152064, 0x5ed1f5d4
-0, 511200, 152064, 0xc28264d1
-0, 514800, 152064, 0xa162dd31
-0, 518400, 152064, 0x2ee872ce
-0, 522000, 152064, 0x809a8fce
-0, 525600, 152064, 0xcfcc3ef9
-0, 529200, 152064, 0xa5be6ce3
-0, 532800, 152064, 0xd75930a0
-0, 536400, 152064, 0x28acb80f
-0, 540000, 152064, 0x223f2152
-0, 543600, 152064, 0x0cf070cb
-0, 547200, 152064, 0xcc7d011e
-0, 550800, 152064, 0xb2c2a63c
-0, 554400, 152064, 0x15514caa
-0, 558000, 152064, 0x0c6d18ee
-0, 561600, 152064, 0x33b4265d
-0, 565200, 152064, 0xb4abaaaf
-0, 568800, 152064, 0x26a7a856
-0, 572400, 152064, 0xc75249cc
-0, 576000, 152064, 0x59ccb0e1
-0, 579600, 152064, 0xc613f202
-0, 583200, 152064, 0xd1c0e171
-0, 586800, 152064, 0xa195da2b
-0, 590400, 152064, 0xbc7ed475
-0, 594000, 152064, 0x99206e2c
-0, 597600, 152064, 0x0ef04e03
-0, 601200, 152064, 0x68cbc6a1
-0, 604800, 152064, 0x2a5304b1
-0, 608400, 152064, 0xf017978b
-0, 612000, 152064, 0x94f5641a
-0, 615600, 152064, 0xd681bd8f
-0, 619200, 152064, 0x16e1e3a3
-0, 622800, 152064, 0xe4486c7e
-0, 626400, 152064, 0xa1bd394e
-0, 630000, 152064, 0x49ad5959
-0, 633600, 152064, 0x82219b70
-0, 637200, 152064, 0x64e2abcf
-0, 640800, 152064, 0x6d7d05d8
-0, 644400, 152064, 0xd9ac2251
-0, 648000, 152064, 0xf477eee5
-0, 651600, 152064, 0xb9826a78
-0, 655200, 152064, 0x97828a37
-0, 658800, 152064, 0x12099b1f
-0, 662400, 152064, 0x1ec45fa7
-0, 666000, 152064, 0xfd5501c9
-0, 669600, 152064, 0x6a8b26a3
-0, 673200, 152064, 0xae58ff40
-0, 676800, 152064, 0xc0f47aa1
-0, 680400, 152064, 0x08bfa548
-0, 684000, 152064, 0x7f2ff5ef
-0, 687600, 152064, 0x5efa94a3
-0, 691200, 152064, 0xf786f970
-0, 694800, 152064, 0xab6bc712
-0, 698400, 152064, 0x25647bee
-0, 702000, 152064, 0x54333ad5
-0, 705600, 152064, 0xb3a99413
-0, 709200, 152064, 0xe7a78a0d
-0, 712800, 152064, 0xa5054abc
-0, 716400, 152064, 0xb94896ea
-0, 720000, 152064, 0x9f641bca
-0, 723600, 152064, 0x7363901c
-0, 727200, 152064, 0xd340a000
-0, 730800, 152064, 0x0217f413
-0, 734400, 152064, 0xbbdba6e6
-0, 738000, 152064, 0xabc42617
-0, 741600, 152064, 0xa3442925
-0, 745200, 152064, 0x7d06c7e9
-0, 748800, 152064, 0xa45e32df
-0, 752400, 152064, 0xf5ed407f
-0, 756000, 152064, 0x5ec235d5
-0, 759600, 152064, 0xa5706635
-0, 763200, 152064, 0xa44a209b
-0, 766800, 152064, 0xf2137e37
-0, 770400, 152064, 0x5220508f
-0, 774000, 152064, 0xae6b37da
-0, 777600, 152064, 0xdf09b6cd
-0, 781200, 152064, 0x2d39e1c0
-0, 784800, 152064, 0xc8284a76
-0, 788400, 152064, 0x7d7bbe76
-0, 792000, 152064, 0xcfed7416
-0, 795600, 152064, 0x81caaedd
-0, 799200, 152064, 0x9dcdd771
-0, 802800, 152064, 0x46c1331b
-0, 806400, 152064, 0xace60efa
-0, 810000, 152064, 0x9e0909f7
-0, 813600, 152064, 0x72f5a321
-0, 817200, 152064, 0x68f8cdcc
-0, 820800, 152064, 0xcc59fdd9
-0, 824400, 152064, 0xc0a700c6
-0, 828000, 152064, 0xf4254dcf
-0, 831600, 152064, 0xc59b46d1
-0, 835200, 152064, 0x2e5b2524
-0, 838800, 152064, 0x46051293
-0, 842400, 152064, 0x3cbcd1cd
-0, 846000, 152064, 0x9f308587
-0, 849600, 152064, 0x6b91633f
-0, 853200, 152064, 0xb7191012
-0, 856800, 152064, 0xd2fd030f
-0, 860400, 152064, 0x15a0ae2e
-0, 864000, 152064, 0xac3920d0
-0, 867600, 152064, 0x0eef80aa
-0, 871200, 152064, 0x319008f1
-0, 874800, 152064, 0x7734450c
-0, 878400, 152064, 0xf112df62
-0, 882000, 152064, 0x1dd8ffae
-0, 885600, 152064, 0x655ef429
-0, 889200, 152064, 0x27026213
-0, 892800, 152064, 0x5c14b015
-0, 896400, 152064, 0x9512abeb
-0, 900000, 152064, 0x961812b2
-0, 903600, 152064, 0xb8890aea
-0, 907200, 152064, 0x4519db9a
-0, 910800, 152064, 0xf358034a
-0, 914400, 152064, 0x45d9f2ab
-0, 918000, 152064, 0xebd47e7d
-0, 921600, 152064, 0x15578be9
-0, 925200, 152064, 0x1b373b2d
-0, 928800, 152064, 0xbbe707e5
-0, 932400, 152064, 0x5bf62385
-0, 936000, 152064, 0x832e6ef5
-0, 939600, 152064, 0x761e5968
-0, 943200, 152064, 0x251f984d
-0, 946800, 152064, 0xbda48899
-0, 950400, 152064, 0x3fd843b9
-0, 954000, 152064, 0x00485425
-0, 957600, 152064, 0x4e282b39
-0, 961200, 152064, 0x2630a8ea
-0, 964800, 152064, 0x5ea5c973
-0, 968400, 152064, 0xfc436d21
-0, 972000, 152064, 0x69852ef5
-0, 975600, 152064, 0x44cb5589
-0, 979200, 152064, 0x32f32725
-0, 982800, 152064, 0x54d50aca
-0, 986400, 152064, 0xe7a639bb
-0, 990000, 152064, 0x01be2ad5
-0, 993600, 152064, 0x5c63eca4
-0, 997200, 152064, 0x94e91116
-0, 1000800, 152064, 0x9a8be637
-0, 1004400, 152064, 0x165d9a12
-0, 1008000, 152064, 0x8c25ca0a
-0, 1011600, 152064, 0x4ee2ed32
-0, 1015200, 152064, 0x4b2fe0c6
-0, 1018800, 152064, 0x521e434e
-0, 1022400, 152064, 0x97679d7e
-0, 1026000, 152064, 0x886b9506
-0, 1029600, 152064, 0x4283eda8
-0, 1033200, 152064, 0xef793c49
-0, 1036800, 152064, 0x68ac2afe
-0, 1040400, 152064, 0x3d1ab510
-0, 1044000, 152064, 0x98d3ec95
-0, 1047600, 152064, 0x09f7e512
-0, 1051200, 152064, 0x801355dd
-0, 1054800, 152064, 0xf2e87a11
-0, 1058400, 152064, 0x16757601
-0, 1062000, 152064, 0x3074d74a
-0, 1065600, 152064, 0xec8c1290
-0, 1069200, 152064, 0x46fb1877
-0, 1072800, 152064, 0xf0b662c4
-0, 1076400, 152064, 0xf8683940
+#tb 0: 1/25
+0, 0, 0, 1, 152064, 0xf8248ceb
+0, 1, 1, 1, 152064, 0xb6204c81
+0, 2, 2, 1, 152064, 0x22fb1737
+0, 3, 3, 1, 152064, 0xce8c3fd7
+0, 4, 4, 1, 152064, 0xee88cedc
+0, 5, 5, 1, 152064, 0x1d4209ca
+0, 6, 6, 1, 152064, 0x6fb15238
+0, 7, 7, 1, 152064, 0x505200c2
+0, 8, 8, 1, 152064, 0xb73574ba
+0, 9, 9, 1, 152064, 0x0586a097
+0, 10, 10, 1, 152064, 0xed50fe02
+0, 11, 11, 1, 152064, 0x222221ab
+0, 12, 12, 1, 152064, 0x8afefd46
+0, 13, 13, 1, 152064, 0x6832c5cc
+0, 14, 14, 1, 152064, 0xba4c8110
+0, 15, 15, 1, 152064, 0x95c07e1e
+0, 16, 16, 1, 152064, 0xc5d6fde9
+0, 17, 17, 1, 152064, 0xe75a4921
+0, 18, 18, 1, 152064, 0x53b61688
+0, 19, 19, 1, 152064, 0x0335424b
+0, 20, 20, 1, 152064, 0x621742c7
+0, 21, 21, 1, 152064, 0x4f69f41b
+0, 22, 22, 1, 152064, 0x6b3f65d7
+0, 23, 23, 1, 152064, 0x8dfde04f
+0, 24, 24, 1, 152064, 0x30750ff5
+0, 25, 25, 1, 152064, 0xe3d70f3c
+0, 26, 26, 1, 152064, 0x0c1af825
+0, 27, 27, 1, 152064, 0x58a53935
+0, 28, 28, 1, 152064, 0xc63d9e98
+0, 29, 29, 1, 152064, 0xa85fdc48
+0, 30, 30, 1, 152064, 0x01bb9784
+0, 31, 31, 1, 152064, 0xdd5cb509
+0, 32, 32, 1, 152064, 0x29ae7d2b
+0, 33, 33, 1, 152064, 0xdb08593e
+0, 34, 34, 1, 152064, 0x372d5d4e
+0, 35, 35, 1, 152064, 0x31522664
+0, 36, 36, 1, 152064, 0x3f13f335
+0, 37, 37, 1, 152064, 0xfd10c19a
+0, 38, 38, 1, 152064, 0xef728975
+0, 39, 39, 1, 152064, 0x8e79234d
+0, 40, 40, 1, 152064, 0x47022791
+0, 41, 41, 1, 152064, 0x1ef9d297
+0, 42, 42, 1, 152064, 0x77bf9738
+0, 43, 43, 1, 152064, 0xd6bc8f03
+0, 44, 44, 1, 152064, 0x283ded4a
+0, 45, 45, 1, 152064, 0xd87098d1
+0, 46, 46, 1, 152064, 0x300077a2
+0, 47, 47, 1, 152064, 0x30ffbea4
+0, 48, 48, 1, 152064, 0x5dc5356b
+0, 49, 49, 1, 152064, 0x31cce185
+0, 50, 50, 1, 152064, 0x47fc9148
+0, 51, 51, 1, 152064, 0x1641491e
+0, 52, 52, 1, 152064, 0x2184937d
+0, 53, 53, 1, 152064, 0x126eb74a
+0, 54, 54, 1, 152064, 0x25c07593
+0, 55, 55, 1, 152064, 0xb1294e7e
+0, 56, 56, 1, 152064, 0x8b35f45d
+0, 57, 57, 1, 152064, 0x54765025
+0, 58, 58, 1, 152064, 0x1d17e901
+0, 59, 59, 1, 152064, 0xaeab358d
+0, 60, 60, 1, 152064, 0xf682c91f
+0, 61, 61, 1, 152064, 0x0b4c9b06
+0, 62, 62, 1, 152064, 0x45f326dc
+0, 63, 63, 1, 152064, 0x132eeda3
+0, 64, 64, 1, 152064, 0x3c9b8e16
+0, 65, 65, 1, 152064, 0x1be133c1
+0, 66, 66, 1, 152064, 0xfa876720
+0, 67, 67, 1, 152064, 0x1666cdb8
+0, 68, 68, 1, 152064, 0x362f418f
+0, 69, 69, 1, 152064, 0x926b4a96
+0, 70, 70, 1, 152064, 0xee3da1df
+0, 71, 71, 1, 152064, 0xc11f025d
+0, 72, 72, 1, 152064, 0x9ba62c19
+0, 73, 73, 1, 152064, 0x0d66194f
+0, 74, 74, 1, 152064, 0x2fd09340
+0, 75, 75, 1, 152064, 0x3dfb9e4d
+0, 76, 76, 1, 152064, 0xa3192ce6
+0, 77, 77, 1, 152064, 0x6bfce0e1
+0, 78, 78, 1, 152064, 0x3b7c5286
+0, 79, 79, 1, 152064, 0xb52f4bf5
+0, 80, 80, 1, 152064, 0x30870027
+0, 81, 81, 1, 152064, 0x6f8e71c3
+0, 82, 82, 1, 152064, 0x8d41b09a
+0, 83, 83, 1, 152064, 0xc1ff1d05
+0, 84, 84, 1, 152064, 0xca54125c
+0, 85, 85, 1, 152064, 0x3342d823
+0, 86, 86, 1, 152064, 0xcc4a7542
+0, 87, 87, 1, 152064, 0x21fc9a9d
+0, 88, 88, 1, 152064, 0x91587574
+0, 89, 89, 1, 152064, 0x30929cc2
+0, 90, 90, 1, 152064, 0xf07606b7
+0, 91, 91, 1, 152064, 0x0476b876
+0, 92, 92, 1, 152064, 0x213333dc
+0, 93, 93, 1, 152064, 0x87c67597
+0, 94, 94, 1, 152064, 0x05434641
+0, 95, 95, 1, 152064, 0x959eeffc
+0, 96, 96, 1, 152064, 0x92a130b4
+0, 97, 97, 1, 152064, 0x53d0b544
+0, 98, 98, 1, 152064, 0xaf8c233e
+0, 99, 99, 1, 152064, 0xd3d4259a
+0, 100, 100, 1, 152064, 0xa0287753
+0, 101, 101, 1, 152064, 0xfa23972a
+0, 102, 102, 1, 152064, 0xacae756d
+0, 103, 103, 1, 152064, 0xd8b58b5c
+0, 104, 104, 1, 152064, 0x7db2c755
+0, 105, 105, 1, 152064, 0x31e7b79a
+0, 106, 106, 1, 152064, 0xd8660d98
+0, 107, 107, 1, 152064, 0xdcf0d10d
+0, 108, 108, 1, 152064, 0x3e6567e6
+0, 109, 109, 1, 152064, 0xec3530fd
+0, 110, 110, 1, 152064, 0xf686c61a
+0, 111, 111, 1, 152064, 0x6e706804
+0, 112, 112, 1, 152064, 0x5fd4a1a3
+0, 113, 113, 1, 152064, 0xbb3384f7
+0, 114, 114, 1, 152064, 0x8ffb14dd
+0, 115, 115, 1, 152064, 0x01253a73
+0, 116, 116, 1, 152064, 0xf89c15df
+0, 117, 117, 1, 152064, 0xda2b0b4c
+0, 118, 118, 1, 152064, 0xfc9dfcc1
+0, 119, 119, 1, 152064, 0xfef4f0fa
+0, 120, 120, 1, 152064, 0x91669bea
+0, 121, 121, 1, 152064, 0x3664a565
+0, 122, 122, 1, 152064, 0x32dd7923
+0, 123, 123, 1, 152064, 0x26825231
+0, 124, 124, 1, 152064, 0x5f81896e
+0, 125, 125, 1, 152064, 0x0c64ca2f
+0, 126, 126, 1, 152064, 0x488bb665
+0, 127, 127, 1, 152064, 0x4d183a0f
+0, 128, 128, 1, 152064, 0xed169321
+0, 129, 129, 1, 152064, 0xcec22917
+0, 130, 130, 1, 152064, 0xbe04ea6c
+0, 131, 131, 1, 152064, 0x32b8bf9f
+0, 132, 132, 1, 152064, 0x9c7c2e13
+0, 133, 133, 1, 152064, 0x232e3016
+0, 134, 134, 1, 152064, 0x1b76c08e
+0, 135, 135, 1, 152064, 0x7425d821
+0, 136, 136, 1, 152064, 0x0818ff3c
+0, 137, 137, 1, 152064, 0xb4f2c42b
+0, 138, 138, 1, 152064, 0xe029f979
+0, 139, 139, 1, 152064, 0x97c54c2f
+0, 140, 140, 1, 152064, 0xd101c3b5
+0, 141, 141, 1, 152064, 0x5ed1f5d4
+0, 142, 142, 1, 152064, 0xc28264d1
+0, 143, 143, 1, 152064, 0xa162dd31
+0, 144, 144, 1, 152064, 0x2ee872ce
+0, 145, 145, 1, 152064, 0x809a8fce
+0, 146, 146, 1, 152064, 0xcfcc3ef9
+0, 147, 147, 1, 152064, 0xa5be6ce3
+0, 148, 148, 1, 152064, 0xd75930a0
+0, 149, 149, 1, 152064, 0x28acb80f
+0, 150, 150, 1, 152064, 0x223f2152
+0, 151, 151, 1, 152064, 0x0cf070cb
+0, 152, 152, 1, 152064, 0xcc7d011e
+0, 153, 153, 1, 152064, 0xb2c2a63c
+0, 154, 154, 1, 152064, 0x15514caa
+0, 155, 155, 1, 152064, 0x0c6d18ee
+0, 156, 156, 1, 152064, 0x33b4265d
+0, 157, 157, 1, 152064, 0xb4abaaaf
+0, 158, 158, 1, 152064, 0x26a7a856
+0, 159, 159, 1, 152064, 0xc75249cc
+0, 160, 160, 1, 152064, 0x59ccb0e1
+0, 161, 161, 1, 152064, 0xc613f202
+0, 162, 162, 1, 152064, 0xd1c0e171
+0, 163, 163, 1, 152064, 0xa195da2b
+0, 164, 164, 1, 152064, 0xbc7ed475
+0, 165, 165, 1, 152064, 0x99206e2c
+0, 166, 166, 1, 152064, 0x0ef04e03
+0, 167, 167, 1, 152064, 0x68cbc6a1
+0, 168, 168, 1, 152064, 0x2a5304b1
+0, 169, 169, 1, 152064, 0xf017978b
+0, 170, 170, 1, 152064, 0x94f5641a
+0, 171, 171, 1, 152064, 0xd681bd8f
+0, 172, 172, 1, 152064, 0x16e1e3a3
+0, 173, 173, 1, 152064, 0xe4486c7e
+0, 174, 174, 1, 152064, 0xa1bd394e
+0, 175, 175, 1, 152064, 0x49ad5959
+0, 176, 176, 1, 152064, 0x82219b70
+0, 177, 177, 1, 152064, 0x64e2abcf
+0, 178, 178, 1, 152064, 0x6d7d05d8
+0, 179, 179, 1, 152064, 0xd9ac2251
+0, 180, 180, 1, 152064, 0xf477eee5
+0, 181, 181, 1, 152064, 0xb9826a78
+0, 182, 182, 1, 152064, 0x97828a37
+0, 183, 183, 1, 152064, 0x12099b1f
+0, 184, 184, 1, 152064, 0x1ec45fa7
+0, 185, 185, 1, 152064, 0xfd5501c9
+0, 186, 186, 1, 152064, 0x6a8b26a3
+0, 187, 187, 1, 152064, 0xae58ff40
+0, 188, 188, 1, 152064, 0xc0f47aa1
+0, 189, 189, 1, 152064, 0x08bfa548
+0, 190, 190, 1, 152064, 0x7f2ff5ef
+0, 191, 191, 1, 152064, 0x5efa94a3
+0, 192, 192, 1, 152064, 0xf786f970
+0, 193, 193, 1, 152064, 0xab6bc712
+0, 194, 194, 1, 152064, 0x25647bee
+0, 195, 195, 1, 152064, 0x54333ad5
+0, 196, 196, 1, 152064, 0xb3a99413
+0, 197, 197, 1, 152064, 0xe7a78a0d
+0, 198, 198, 1, 152064, 0xa5054abc
+0, 199, 199, 1, 152064, 0xb94896ea
+0, 200, 200, 1, 152064, 0x9f641bca
+0, 201, 201, 1, 152064, 0x7363901c
+0, 202, 202, 1, 152064, 0xd340a000
+0, 203, 203, 1, 152064, 0x0217f413
+0, 204, 204, 1, 152064, 0xbbdba6e6
+0, 205, 205, 1, 152064, 0xabc42617
+0, 206, 206, 1, 152064, 0xa3442925
+0, 207, 207, 1, 152064, 0x7d06c7e9
+0, 208, 208, 1, 152064, 0xa45e32df
+0, 209, 209, 1, 152064, 0xf5ed407f
+0, 210, 210, 1, 152064, 0x5ec235d5
+0, 211, 211, 1, 152064, 0xa5706635
+0, 212, 212, 1, 152064, 0xa44a209b
+0, 213, 213, 1, 152064, 0xf2137e37
+0, 214, 214, 1, 152064, 0x5220508f
+0, 215, 215, 1, 152064, 0xae6b37da
+0, 216, 216, 1, 152064, 0xdf09b6cd
+0, 217, 217, 1, 152064, 0x2d39e1c0
+0, 218, 218, 1, 152064, 0xc8284a76
+0, 219, 219, 1, 152064, 0x7d7bbe76
+0, 220, 220, 1, 152064, 0xcfed7416
+0, 221, 221, 1, 152064, 0x81caaedd
+0, 222, 222, 1, 152064, 0x9dcdd771
+0, 223, 223, 1, 152064, 0x46c1331b
+0, 224, 224, 1, 152064, 0xace60efa
+0, 225, 225, 1, 152064, 0x9e0909f7
+0, 226, 226, 1, 152064, 0x72f5a321
+0, 227, 227, 1, 152064, 0x68f8cdcc
+0, 228, 228, 1, 152064, 0xcc59fdd9
+0, 229, 229, 1, 152064, 0xc0a700c6
+0, 230, 230, 1, 152064, 0xf4254dcf
+0, 231, 231, 1, 152064, 0xc59b46d1
+0, 232, 232, 1, 152064, 0x2e5b2524
+0, 233, 233, 1, 152064, 0x46051293
+0, 234, 234, 1, 152064, 0x3cbcd1cd
+0, 235, 235, 1, 152064, 0x9f308587
+0, 236, 236, 1, 152064, 0x6b91633f
+0, 237, 237, 1, 152064, 0xb7191012
+0, 238, 238, 1, 152064, 0xd2fd030f
+0, 239, 239, 1, 152064, 0x15a0ae2e
+0, 240, 240, 1, 152064, 0xac3920d0
+0, 241, 241, 1, 152064, 0x0eef80aa
+0, 242, 242, 1, 152064, 0x319008f1
+0, 243, 243, 1, 152064, 0x7734450c
+0, 244, 244, 1, 152064, 0xf112df62
+0, 245, 245, 1, 152064, 0x1dd8ffae
+0, 246, 246, 1, 152064, 0x655ef429
+0, 247, 247, 1, 152064, 0x27026213
+0, 248, 248, 1, 152064, 0x5c14b015
+0, 249, 249, 1, 152064, 0x9512abeb
+0, 250, 250, 1, 152064, 0x961812b2
+0, 251, 251, 1, 152064, 0xb8890aea
+0, 252, 252, 1, 152064, 0x4519db9a
+0, 253, 253, 1, 152064, 0xf358034a
+0, 254, 254, 1, 152064, 0x45d9f2ab
+0, 255, 255, 1, 152064, 0xebd47e7d
+0, 256, 256, 1, 152064, 0x15578be9
+0, 257, 257, 1, 152064, 0x1b373b2d
+0, 258, 258, 1, 152064, 0xbbe707e5
+0, 259, 259, 1, 152064, 0x5bf62385
+0, 260, 260, 1, 152064, 0x832e6ef5
+0, 261, 261, 1, 152064, 0x761e5968
+0, 262, 262, 1, 152064, 0x251f984d
+0, 263, 263, 1, 152064, 0xbda48899
+0, 264, 264, 1, 152064, 0x3fd843b9
+0, 265, 265, 1, 152064, 0x00485425
+0, 266, 266, 1, 152064, 0x4e282b39
+0, 267, 267, 1, 152064, 0x2630a8ea
+0, 268, 268, 1, 152064, 0x5ea5c973
+0, 269, 269, 1, 152064, 0xfc436d21
+0, 270, 270, 1, 152064, 0x69852ef5
+0, 271, 271, 1, 152064, 0x44cb5589
+0, 272, 272, 1, 152064, 0x32f32725
+0, 273, 273, 1, 152064, 0x54d50aca
+0, 274, 274, 1, 152064, 0xe7a639bb
+0, 275, 275, 1, 152064, 0x01be2ad5
+0, 276, 276, 1, 152064, 0x5c63eca4
+0, 277, 277, 1, 152064, 0x94e91116
+0, 278, 278, 1, 152064, 0x9a8be637
+0, 279, 279, 1, 152064, 0x165d9a12
+0, 280, 280, 1, 152064, 0x8c25ca0a
+0, 281, 281, 1, 152064, 0x4ee2ed32
+0, 282, 282, 1, 152064, 0x4b2fe0c6
+0, 283, 283, 1, 152064, 0x521e434e
+0, 284, 284, 1, 152064, 0x97679d7e
+0, 285, 285, 1, 152064, 0x886b9506
+0, 286, 286, 1, 152064, 0x4283eda8
+0, 287, 287, 1, 152064, 0xef793c49
+0, 288, 288, 1, 152064, 0x68ac2afe
+0, 289, 289, 1, 152064, 0x3d1ab510
+0, 290, 290, 1, 152064, 0x98d3ec95
+0, 291, 291, 1, 152064, 0x09f7e512
+0, 292, 292, 1, 152064, 0x801355dd
+0, 293, 293, 1, 152064, 0xf2e87a11
+0, 294, 294, 1, 152064, 0x16757601
+0, 295, 295, 1, 152064, 0x3074d74a
+0, 296, 296, 1, 152064, 0xec8c1290
+0, 297, 297, 1, 152064, 0x46fb1877
+0, 298, 298, 1, 152064, 0xf0b662c4
+0, 299, 299, 1, 152064, 0xf8683940
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-hpcamolq_brcm_b b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-hpcamolq_brcm_b
index 6d2e27a..00f04fd 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-hpcamolq_brcm_b
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-hpcamolq_brcm_b
@@ -1,100 +1,101 @@
-0, 0, 152064, 0xac83f54f
-0, 3600, 152064, 0x4d673b43
-0, 7200, 152064, 0x9050731f
-0, 10800, 152064, 0x4a0741f3
-0, 14400, 152064, 0xb2371c28
-0, 18000, 152064, 0x42210524
-0, 21600, 152064, 0x385f4be5
-0, 25200, 152064, 0xe44ec27a
-0, 28800, 152064, 0xfc668399
-0, 32400, 152064, 0x903fe200
-0, 36000, 152064, 0x4da1deaa
-0, 39600, 152064, 0x68c956ab
-0, 43200, 152064, 0x9cfad799
-0, 46800, 152064, 0x841ed3cd
-0, 50400, 152064, 0x99e66b48
-0, 54000, 152064, 0xcfa28482
-0, 57600, 152064, 0x72f2c717
-0, 61200, 152064, 0xd1d92c80
-0, 64800, 152064, 0x595063eb
-0, 68400, 152064, 0x87373979
-0, 72000, 152064, 0xfa0e75ac
-0, 75600, 152064, 0x0cef3592
-0, 79200, 152064, 0xecfc9c9a
-0, 82800, 152064, 0x5776ff23
-0, 86400, 152064, 0x83419e37
-0, 90000, 152064, 0x4bb31524
-0, 93600, 152064, 0xad8e1bdc
-0, 97200, 152064, 0x7243b6cb
-0, 100800, 152064, 0xf016cda0
-0, 104400, 152064, 0xa2c1d730
-0, 108000, 152064, 0x7999d704
-0, 111600, 152064, 0x86ad0baf
-0, 115200, 152064, 0x35dafe62
-0, 118800, 152064, 0xcb2f5de2
-0, 122400, 152064, 0x3542eb82
-0, 126000, 152064, 0xa704dd92
-0, 129600, 152064, 0x3e50ed92
-0, 133200, 152064, 0x2fe5428a
-0, 136800, 152064, 0xf05dab9d
-0, 140400, 152064, 0xef40c2a3
-0, 144000, 152064, 0x2df8983f
-0, 147600, 152064, 0x0a205c93
-0, 151200, 152064, 0x505562ea
-0, 154800, 152064, 0x24114860
-0, 158400, 152064, 0x2eecccc1
-0, 162000, 152064, 0xc809105f
-0, 165600, 152064, 0x394ab285
-0, 169200, 152064, 0xfda68f17
-0, 172800, 152064, 0x2fd66a51
-0, 176400, 152064, 0x3abb891a
-0, 180000, 152064, 0x62266682
-0, 183600, 152064, 0x68fb38e9
-0, 187200, 152064, 0xae4b9d9b
-0, 190800, 152064, 0xdaf8e150
-0, 194400, 152064, 0x2fd8bf74
-0, 198000, 152064, 0xd2ad6c38
-0, 201600, 152064, 0x76290574
-0, 205200, 152064, 0xaea6b9be
-0, 208800, 152064, 0xd0d797d7
-0, 212400, 152064, 0x87ad00b2
-0, 216000, 152064, 0xe57d11d0
-0, 219600, 152064, 0x25a5c567
-0, 223200, 152064, 0x477e2202
-0, 226800, 152064, 0xaa0618ca
-0, 230400, 152064, 0xb5d2262b
-0, 234000, 152064, 0xae7c135d
-0, 237600, 152064, 0xddb86a7c
-0, 241200, 152064, 0x59bad3ba
-0, 244800, 152064, 0x0b155178
-0, 248400, 152064, 0xc2f265d9
-0, 252000, 152064, 0xb550e8a8
-0, 255600, 152064, 0x1fef6cbc
-0, 259200, 152064, 0xd3d4e578
-0, 262800, 152064, 0x70d20c0d
-0, 266400, 152064, 0xbb8e95a9
-0, 270000, 152064, 0x2a92cda3
-0, 273600, 152064, 0xc0a5e7e0
-0, 277200, 152064, 0x15b99dab
-0, 280800, 152064, 0x536d44e8
-0, 284400, 152064, 0xe43fb4fa
-0, 288000, 152064, 0xdb0873b0
-0, 291600, 152064, 0xc7901e9b
-0, 295200, 152064, 0x36b69923
-0, 298800, 152064, 0xc6a8ac8d
-0, 302400, 152064, 0xd7e4c595
-0, 306000, 152064, 0x2d64cf38
-0, 309600, 152064, 0x007878b1
-0, 313200, 152064, 0xc9c997d4
-0, 316800, 152064, 0xf9de12de
-0, 320400, 152064, 0x25982d54
-0, 324000, 152064, 0xea5eef7c
-0, 327600, 152064, 0x108aceb2
-0, 331200, 152064, 0x3cbac8c8
-0, 334800, 152064, 0x581ec9e1
-0, 338400, 152064, 0xc898bd7d
-0, 342000, 152064, 0x142a0235
-0, 345600, 152064, 0xf9d0aa7e
-0, 349200, 152064, 0xb9fe0bc4
-0, 352800, 152064, 0x21889912
-0, 356400, 152064, 0x3fb2ab18
+#tb 0: 1/25
+0, 0, 0, 1, 152064, 0xac83f54f
+0, 1, 1, 1, 152064, 0x4d673b43
+0, 2, 2, 1, 152064, 0x9050731f
+0, 3, 3, 1, 152064, 0x4a0741f3
+0, 4, 4, 1, 152064, 0xb2371c28
+0, 5, 5, 1, 152064, 0x42210524
+0, 6, 6, 1, 152064, 0x385f4be5
+0, 7, 7, 1, 152064, 0xe44ec27a
+0, 8, 8, 1, 152064, 0xfc668399
+0, 9, 9, 1, 152064, 0x903fe200
+0, 10, 10, 1, 152064, 0x4da1deaa
+0, 11, 11, 1, 152064, 0x68c956ab
+0, 12, 12, 1, 152064, 0x9cfad799
+0, 13, 13, 1, 152064, 0x841ed3cd
+0, 14, 14, 1, 152064, 0x99e66b48
+0, 15, 15, 1, 152064, 0xcfa28482
+0, 16, 16, 1, 152064, 0x72f2c717
+0, 17, 17, 1, 152064, 0xd1d92c80
+0, 18, 18, 1, 152064, 0x595063eb
+0, 19, 19, 1, 152064, 0x87373979
+0, 20, 20, 1, 152064, 0xfa0e75ac
+0, 21, 21, 1, 152064, 0x0cef3592
+0, 22, 22, 1, 152064, 0xecfc9c9a
+0, 23, 23, 1, 152064, 0x5776ff23
+0, 24, 24, 1, 152064, 0x83419e37
+0, 25, 25, 1, 152064, 0x4bb31524
+0, 26, 26, 1, 152064, 0xad8e1bdc
+0, 27, 27, 1, 152064, 0x7243b6cb
+0, 28, 28, 1, 152064, 0xf016cda0
+0, 29, 29, 1, 152064, 0xa2c1d730
+0, 30, 30, 1, 152064, 0x7999d704
+0, 31, 31, 1, 152064, 0x86ad0baf
+0, 32, 32, 1, 152064, 0x35dafe62
+0, 33, 33, 1, 152064, 0xcb2f5de2
+0, 34, 34, 1, 152064, 0x3542eb82
+0, 35, 35, 1, 152064, 0xa704dd92
+0, 36, 36, 1, 152064, 0x3e50ed92
+0, 37, 37, 1, 152064, 0x2fe5428a
+0, 38, 38, 1, 152064, 0xf05dab9d
+0, 39, 39, 1, 152064, 0xef40c2a3
+0, 40, 40, 1, 152064, 0x2df8983f
+0, 41, 41, 1, 152064, 0x0a205c93
+0, 42, 42, 1, 152064, 0x505562ea
+0, 43, 43, 1, 152064, 0x24114860
+0, 44, 44, 1, 152064, 0x2eecccc1
+0, 45, 45, 1, 152064, 0xc809105f
+0, 46, 46, 1, 152064, 0x394ab285
+0, 47, 47, 1, 152064, 0xfda68f17
+0, 48, 48, 1, 152064, 0x2fd66a51
+0, 49, 49, 1, 152064, 0x3abb891a
+0, 50, 50, 1, 152064, 0x62266682
+0, 51, 51, 1, 152064, 0x68fb38e9
+0, 52, 52, 1, 152064, 0xae4b9d9b
+0, 53, 53, 1, 152064, 0xdaf8e150
+0, 54, 54, 1, 152064, 0x2fd8bf74
+0, 55, 55, 1, 152064, 0xd2ad6c38
+0, 56, 56, 1, 152064, 0x76290574
+0, 57, 57, 1, 152064, 0xaea6b9be
+0, 58, 58, 1, 152064, 0xd0d797d7
+0, 59, 59, 1, 152064, 0x87ad00b2
+0, 60, 60, 1, 152064, 0xe57d11d0
+0, 61, 61, 1, 152064, 0x25a5c567
+0, 62, 62, 1, 152064, 0x477e2202
+0, 63, 63, 1, 152064, 0xaa0618ca
+0, 64, 64, 1, 152064, 0xb5d2262b
+0, 65, 65, 1, 152064, 0xae7c135d
+0, 66, 66, 1, 152064, 0xddb86a7c
+0, 67, 67, 1, 152064, 0x59bad3ba
+0, 68, 68, 1, 152064, 0x0b155178
+0, 69, 69, 1, 152064, 0xc2f265d9
+0, 70, 70, 1, 152064, 0xb550e8a8
+0, 71, 71, 1, 152064, 0x1fef6cbc
+0, 72, 72, 1, 152064, 0xd3d4e578
+0, 73, 73, 1, 152064, 0x70d20c0d
+0, 74, 74, 1, 152064, 0xbb8e95a9
+0, 75, 75, 1, 152064, 0x2a92cda3
+0, 76, 76, 1, 152064, 0xc0a5e7e0
+0, 77, 77, 1, 152064, 0x15b99dab
+0, 78, 78, 1, 152064, 0x536d44e8
+0, 79, 79, 1, 152064, 0xe43fb4fa
+0, 80, 80, 1, 152064, 0xdb0873b0
+0, 81, 81, 1, 152064, 0xc7901e9b
+0, 82, 82, 1, 152064, 0x36b69923
+0, 83, 83, 1, 152064, 0xc6a8ac8d
+0, 84, 84, 1, 152064, 0xd7e4c595
+0, 85, 85, 1, 152064, 0x2d64cf38
+0, 86, 86, 1, 152064, 0x007878b1
+0, 87, 87, 1, 152064, 0xc9c997d4
+0, 88, 88, 1, 152064, 0xf9de12de
+0, 89, 89, 1, 152064, 0x25982d54
+0, 90, 90, 1, 152064, 0xea5eef7c
+0, 91, 91, 1, 152064, 0x108aceb2
+0, 92, 92, 1, 152064, 0x3cbac8c8
+0, 93, 93, 1, 152064, 0x581ec9e1
+0, 94, 94, 1, 152064, 0xc898bd7d
+0, 95, 95, 1, 152064, 0x142a0235
+0, 96, 96, 1, 152064, 0xf9d0aa7e
+0, 97, 97, 1, 152064, 0xb9fe0bc4
+0, 98, 98, 1, 152064, 0x21889912
+0, 99, 99, 1, 152064, 0x3fb2ab18
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-hpcanl_brcm_c b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-hpcanl_brcm_c
index fe47465..23ad267 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-hpcanl_brcm_c
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-hpcanl_brcm_c
@@ -1,300 +1,301 @@
-0, 0, 152064, 0x2744afa1
-0, 3600, 152064, 0x17246583
-0, 7200, 152064, 0x501836ed
-0, 10800, 152064, 0xe90d6961
-0, 14400, 152064, 0x27abe1ad
-0, 18000, 152064, 0xcfc730e4
-0, 21600, 152064, 0xeaaa83ee
-0, 25200, 152064, 0xb5d80ebd
-0, 28800, 152064, 0x1e1b9d03
-0, 32400, 152064, 0x60e7cf33
-0, 36000, 152064, 0xc44616b1
-0, 39600, 152064, 0x0a2a5906
-0, 43200, 152064, 0xf101309c
-0, 46800, 152064, 0x0b57f348
-0, 50400, 152064, 0x4f018c05
-0, 54000, 152064, 0x22359c60
-0, 57600, 152064, 0x020f1cc3
-0, 61200, 152064, 0x15be3892
-0, 64800, 152064, 0x834a2e23
-0, 68400, 152064, 0x1176586c
-0, 72000, 152064, 0x9cf25641
-0, 75600, 152064, 0xc1c4051d
-0, 79200, 152064, 0x790d8bfa
-0, 82800, 152064, 0x4dcbe7d7
-0, 86400, 152064, 0xe81d3b7b
-0, 90000, 152064, 0xe9e21309
-0, 93600, 152064, 0x22021dbc
-0, 97200, 152064, 0x430c5ecb
-0, 100800, 152064, 0xf524be8b
-0, 104400, 152064, 0xa437dadc
-0, 108000, 152064, 0xff00b440
-0, 111600, 152064, 0x4bd1bf15
-0, 115200, 152064, 0x1f46a3ea
-0, 118800, 152064, 0x60b47c5e
-0, 122400, 152064, 0x45117ac6
-0, 126000, 152064, 0x43894fca
-0, 129600, 152064, 0x21572b55
-0, 133200, 152064, 0xe96def09
-0, 136800, 152064, 0x4d2ab41f
-0, 140400, 152064, 0x072d6b06
-0, 144000, 152064, 0x81865687
-0, 147600, 152064, 0x8d9a0ea6
-0, 151200, 152064, 0x1484d3cd
-0, 154800, 152064, 0xbdabae6b
-0, 158400, 152064, 0x4211edbe
-0, 162000, 152064, 0xd84dad6d
-0, 165600, 152064, 0xe4e79344
-0, 169200, 152064, 0x9c1addd7
-0, 172800, 152064, 0xdcf94283
-0, 176400, 152064, 0x6bd005b2
-0, 180000, 152064, 0x9679bd10
-0, 183600, 152064, 0x052064ab
-0, 187200, 152064, 0x915db3f3
-0, 190800, 152064, 0xec2fbd58
-0, 194400, 152064, 0x26728258
-0, 198000, 152064, 0x2b2b617f
-0, 201600, 152064, 0x2339eb3d
-0, 205200, 152064, 0xcf6e6773
-0, 208800, 152064, 0xb993efe4
-0, 212400, 152064, 0x4054253d
-0, 216000, 152064, 0x4befe5b5
-0, 219600, 152064, 0x0678c0fa
-0, 223200, 152064, 0xe3c54a03
-0, 226800, 152064, 0xffa3210c
-0, 230400, 152064, 0xed04b823
-0, 234000, 152064, 0x00926457
-0, 237600, 152064, 0xd56aaaf0
-0, 241200, 152064, 0x6047ef6e
-0, 244800, 152064, 0x44316d07
-0, 248400, 152064, 0xe8a879b7
-0, 252000, 152064, 0x1856cd86
-0, 255600, 152064, 0x6528349a
-0, 259200, 152064, 0xdeff676e
-0, 262800, 152064, 0xda412e47
-0, 266400, 152064, 0xa2c2a96f
-0, 270000, 152064, 0xc703b8cd
-0, 273600, 152064, 0x20b0650b
-0, 277200, 152064, 0x8c14faa5
-0, 280800, 152064, 0xa442706c
-0, 284400, 152064, 0x6e456137
-0, 288000, 152064, 0x6dde11c6
-0, 291600, 152064, 0xb017978a
-0, 295200, 152064, 0xc0bad34b
-0, 298800, 152064, 0x8bd439ee
-0, 302400, 152064, 0xa92735e4
-0, 306000, 152064, 0x1623f501
-0, 309600, 152064, 0x5be980b2
-0, 313200, 152064, 0x4306b9bf
-0, 316800, 152064, 0xb4f18976
-0, 320400, 152064, 0x4ffb9b46
-0, 324000, 152064, 0x23082275
-0, 327600, 152064, 0xc7f0e087
-0, 331200, 152064, 0x68b95327
-0, 334800, 152064, 0xd030a8e4
-0, 338400, 152064, 0xf8f9615c
-0, 342000, 152064, 0x1b26fe3e
-0, 345600, 152064, 0x3381608d
-0, 349200, 152064, 0x9939d49d
-0, 352800, 152064, 0x575f4f94
-0, 356400, 152064, 0x436c581c
-0, 360000, 152064, 0x8f47aa58
-0, 363600, 152064, 0xd251d95a
-0, 367200, 152064, 0x3c33b32c
-0, 370800, 152064, 0xa1e19413
-0, 374400, 152064, 0x8d95cbad
-0, 378000, 152064, 0x98cbd35e
-0, 381600, 152064, 0xceb81a0f
-0, 385200, 152064, 0x5490fab1
-0, 388800, 152064, 0x8e57a38c
-0, 392400, 152064, 0xc379517a
-0, 396000, 152064, 0xafc4f747
-0, 399600, 152064, 0xbc9c9be4
-0, 403200, 152064, 0xd602b2f5
-0, 406800, 152064, 0x8d85a450
-0, 410400, 152064, 0x48183c74
-0, 414000, 152064, 0xd1725590
-0, 417600, 152064, 0x5ef42ed7
-0, 421200, 152064, 0xad3a3883
-0, 424800, 152064, 0x7a3e0ddd
-0, 428400, 152064, 0x59bdfd38
-0, 432000, 152064, 0x5ac3ba9f
-0, 435600, 152064, 0x266cbd00
-0, 439200, 152064, 0x97d29e00
-0, 442800, 152064, 0x620774c2
-0, 446400, 152064, 0xaae8b96f
-0, 450000, 152064, 0x5f6bdfb6
-0, 453600, 152064, 0xb239da53
-0, 457200, 152064, 0x654b5680
-0, 460800, 152064, 0xd796b723
-0, 464400, 152064, 0xd5c84a81
-0, 468000, 152064, 0x2a761652
-0, 471600, 152064, 0x1137e145
-0, 475200, 152064, 0x1a9a451b
-0, 478800, 152064, 0x5ca751c4
-0, 482400, 152064, 0x074acec7
-0, 486000, 152064, 0x9ddfe77d
-0, 489600, 152064, 0xfb211c29
-0, 493200, 152064, 0x681ad4dd
-0, 496800, 152064, 0x702c12cc
-0, 500400, 152064, 0x556c5101
-0, 504000, 152064, 0x39d4bb54
-0, 507600, 152064, 0xa3a118d6
-0, 511200, 152064, 0xb78b7db1
-0, 514800, 152064, 0x4e20eed5
-0, 518400, 152064, 0x6555a9df
-0, 522000, 152064, 0xb607a9a4
-0, 525600, 152064, 0x3cf96a94
-0, 529200, 152064, 0xb2679007
-0, 532800, 152064, 0xf09d5b85
-0, 536400, 152064, 0x3961ba07
-0, 540000, 152064, 0x0c28363a
-0, 543600, 152064, 0x0a017c2d
-0, 547200, 152064, 0x3a661de3
-0, 550800, 152064, 0xf8d1bdee
-0, 554400, 152064, 0x6f47791b
-0, 558000, 152064, 0xe05b22c6
-0, 561600, 152064, 0x7cc93bb0
-0, 565200, 152064, 0xeb90c3d8
-0, 568800, 152064, 0x1a1eac98
-0, 572400, 152064, 0x92985671
-0, 576000, 152064, 0x2fe3ce53
-0, 579600, 152064, 0x61def691
-0, 583200, 152064, 0x90820730
-0, 586800, 152064, 0x17630372
-0, 590400, 152064, 0xaf6cea12
-0, 594000, 152064, 0xfe3b7ecc
-0, 597600, 152064, 0x904a5b2e
-0, 601200, 152064, 0x0d88d5f2
-0, 604800, 152064, 0x498d22b1
-0, 608400, 152064, 0x56baba83
-0, 612000, 152064, 0xda4d6dfa
-0, 615600, 152064, 0xaa38cbdd
-0, 619200, 152064, 0x4077f15d
-0, 622800, 152064, 0x7e006ec2
-0, 626400, 152064, 0x59964a89
-0, 630000, 152064, 0x04c078e3
-0, 633600, 152064, 0x7a5faf97
-0, 637200, 152064, 0xc517b3e9
-0, 640800, 152064, 0xfcc81af5
-0, 644400, 152064, 0xdcb44f62
-0, 648000, 152064, 0x2a080b72
-0, 651600, 152064, 0x91f88c67
-0, 655200, 152064, 0xd39caf81
-0, 658800, 152064, 0x0764ae31
-0, 662400, 152064, 0x0ddb82ed
-0, 666000, 152064, 0xed6d17e4
-0, 669600, 152064, 0xb4f74712
-0, 673200, 152064, 0x23a20787
-0, 676800, 152064, 0x853e7b33
-0, 680400, 152064, 0xc6bac173
-0, 684000, 152064, 0xb590ec15
-0, 687600, 152064, 0xfdd2943c
-0, 691200, 152064, 0xba5d1160
-0, 694800, 152064, 0xe732c5a7
-0, 698400, 152064, 0x279f6ce9
-0, 702000, 152064, 0xb3835829
-0, 705600, 152064, 0x0901b2a1
-0, 709200, 152064, 0x3df2b8f8
-0, 712800, 152064, 0x374496a4
-0, 716400, 152064, 0x1bc6a4ae
-0, 720000, 152064, 0xdb4b372e
-0, 723600, 152064, 0x8c11c214
-0, 727200, 152064, 0xd2d5c093
-0, 730800, 152064, 0x8dda094e
-0, 734400, 152064, 0x9b2cc401
-0, 738000, 152064, 0x1a3b49d5
-0, 741600, 152064, 0xaf5342ff
-0, 745200, 152064, 0x74c0de83
-0, 748800, 152064, 0xcf486137
-0, 752400, 152064, 0xcf005b3b
-0, 756000, 152064, 0x86a64c55
-0, 759600, 152064, 0xdd3f7ae9
-0, 763200, 152064, 0xb0d01e53
-0, 766800, 152064, 0x83219065
-0, 770400, 152064, 0x17a35d27
-0, 774000, 152064, 0xf92645b5
-0, 777600, 152064, 0x8322bdbf
-0, 781200, 152064, 0xd589f6a2
-0, 784800, 152064, 0x80a62d9e
-0, 788400, 152064, 0x05b3e0d1
-0, 792000, 152064, 0xd657aa0b
-0, 795600, 152064, 0xec5ac2dd
-0, 799200, 152064, 0xbf0ff969
-0, 802800, 152064, 0xc34a5140
-0, 806400, 152064, 0x814705c4
-0, 810000, 152064, 0xe9592008
-0, 813600, 152064, 0xf12c933c
-0, 817200, 152064, 0x2daee178
-0, 820800, 152064, 0xa2573028
-0, 824400, 152064, 0x6109f58d
-0, 828000, 152064, 0x64ab8ce4
-0, 831600, 152064, 0x13a88b6e
-0, 835200, 152064, 0x8f0181a9
-0, 838800, 152064, 0xd5295fd4
-0, 842400, 152064, 0xfdbeeb0d
-0, 846000, 152064, 0x05ecd231
-0, 849600, 152064, 0x48d164cd
-0, 853200, 152064, 0xc279cf63
-0, 856800, 152064, 0x1d5e6a03
-0, 860400, 152064, 0xd9dc1807
-0, 864000, 152064, 0xbcc83676
-0, 867600, 152064, 0x65a9811e
-0, 871200, 152064, 0x3ccfe5a8
-0, 874800, 152064, 0x2f2ff051
-0, 878400, 152064, 0x9193e093
-0, 882000, 152064, 0x9a30fdc6
-0, 885600, 152064, 0x90b7ea10
-0, 889200, 152064, 0x3291910c
-0, 892800, 152064, 0x2335d186
-0, 896400, 152064, 0x2890cf1d
-0, 900000, 152064, 0x8c8b6245
-0, 903600, 152064, 0x24b84eda
-0, 907200, 152064, 0x04a12446
-0, 910800, 152064, 0xd9d91d51
-0, 914400, 152064, 0xbf450adf
-0, 918000, 152064, 0xa19a9a41
-0, 921600, 152064, 0x2211ab01
-0, 925200, 152064, 0x8fe85430
-0, 928800, 152064, 0x5a152861
-0, 932400, 152064, 0x7fe76995
-0, 936000, 152064, 0x508b99cd
-0, 939600, 152064, 0x92e79437
-0, 943200, 152064, 0x8572eac9
-0, 946800, 152064, 0x42e3d513
-0, 950400, 152064, 0x6bee9e38
-0, 954000, 152064, 0x2858ad4b
-0, 957600, 152064, 0x96d87d00
-0, 961200, 152064, 0x749f1032
-0, 964800, 152064, 0x668fca6c
-0, 968400, 152064, 0x11d278d9
-0, 972000, 152064, 0x10fd46ea
-0, 975600, 152064, 0xc8b193c8
-0, 979200, 152064, 0x035e7d02
-0, 982800, 152064, 0x067f583c
-0, 986400, 152064, 0xd9648a1e
-0, 990000, 152064, 0x92487b7e
-0, 993600, 152064, 0xc7b35421
-0, 997200, 152064, 0x2ed57c1c
-0, 1000800, 152064, 0xefe24c5f
-0, 1004400, 152064, 0x8df0118b
-0, 1008000, 152064, 0x18f0278d
-0, 1011600, 152064, 0x63ac45ad
-0, 1015200, 152064, 0xd79849f0
-0, 1018800, 152064, 0x1f1d4dab
-0, 1022400, 152064, 0x736fb5b8
-0, 1026000, 152064, 0xc24eb80c
-0, 1029600, 152064, 0x64ca3b11
-0, 1033200, 152064, 0x35d8674c
-0, 1036800, 152064, 0x3c5a7b51
-0, 1040400, 152064, 0x97550b81
-0, 1044000, 152064, 0x731454b5
-0, 1047600, 152064, 0x01de43bc
-0, 1051200, 152064, 0xbda7afae
-0, 1054800, 152064, 0xeb34d714
-0, 1058400, 152064, 0x1260cc98
-0, 1062000, 152064, 0x7e592c36
-0, 1065600, 152064, 0x40b3676e
-0, 1069200, 152064, 0x8c9d6b94
-0, 1072800, 152064, 0xc7988665
-0, 1076400, 152064, 0xf2994d52
+#tb 0: 1/25
+0, 0, 0, 1, 152064, 0x2744afa1
+0, 1, 1, 1, 152064, 0x17246583
+0, 2, 2, 1, 152064, 0x501836ed
+0, 3, 3, 1, 152064, 0xe90d6961
+0, 4, 4, 1, 152064, 0x27abe1ad
+0, 5, 5, 1, 152064, 0xcfc730e4
+0, 6, 6, 1, 152064, 0xeaaa83ee
+0, 7, 7, 1, 152064, 0xb5d80ebd
+0, 8, 8, 1, 152064, 0x1e1b9d03
+0, 9, 9, 1, 152064, 0x60e7cf33
+0, 10, 10, 1, 152064, 0xc44616b1
+0, 11, 11, 1, 152064, 0x0a2a5906
+0, 12, 12, 1, 152064, 0xf101309c
+0, 13, 13, 1, 152064, 0x0b57f348
+0, 14, 14, 1, 152064, 0x4f018c05
+0, 15, 15, 1, 152064, 0x22359c60
+0, 16, 16, 1, 152064, 0x020f1cc3
+0, 17, 17, 1, 152064, 0x15be3892
+0, 18, 18, 1, 152064, 0x834a2e23
+0, 19, 19, 1, 152064, 0x1176586c
+0, 20, 20, 1, 152064, 0x9cf25641
+0, 21, 21, 1, 152064, 0xc1c4051d
+0, 22, 22, 1, 152064, 0x790d8bfa
+0, 23, 23, 1, 152064, 0x4dcbe7d7
+0, 24, 24, 1, 152064, 0xe81d3b7b
+0, 25, 25, 1, 152064, 0xe9e21309
+0, 26, 26, 1, 152064, 0x22021dbc
+0, 27, 27, 1, 152064, 0x430c5ecb
+0, 28, 28, 1, 152064, 0xf524be8b
+0, 29, 29, 1, 152064, 0xa437dadc
+0, 30, 30, 1, 152064, 0xff00b440
+0, 31, 31, 1, 152064, 0x4bd1bf15
+0, 32, 32, 1, 152064, 0x1f46a3ea
+0, 33, 33, 1, 152064, 0x60b47c5e
+0, 34, 34, 1, 152064, 0x45117ac6
+0, 35, 35, 1, 152064, 0x43894fca
+0, 36, 36, 1, 152064, 0x21572b55
+0, 37, 37, 1, 152064, 0xe96def09
+0, 38, 38, 1, 152064, 0x4d2ab41f
+0, 39, 39, 1, 152064, 0x072d6b06
+0, 40, 40, 1, 152064, 0x81865687
+0, 41, 41, 1, 152064, 0x8d9a0ea6
+0, 42, 42, 1, 152064, 0x1484d3cd
+0, 43, 43, 1, 152064, 0xbdabae6b
+0, 44, 44, 1, 152064, 0x4211edbe
+0, 45, 45, 1, 152064, 0xd84dad6d
+0, 46, 46, 1, 152064, 0xe4e79344
+0, 47, 47, 1, 152064, 0x9c1addd7
+0, 48, 48, 1, 152064, 0xdcf94283
+0, 49, 49, 1, 152064, 0x6bd005b2
+0, 50, 50, 1, 152064, 0x9679bd10
+0, 51, 51, 1, 152064, 0x052064ab
+0, 52, 52, 1, 152064, 0x915db3f3
+0, 53, 53, 1, 152064, 0xec2fbd58
+0, 54, 54, 1, 152064, 0x26728258
+0, 55, 55, 1, 152064, 0x2b2b617f
+0, 56, 56, 1, 152064, 0x2339eb3d
+0, 57, 57, 1, 152064, 0xcf6e6773
+0, 58, 58, 1, 152064, 0xb993efe4
+0, 59, 59, 1, 152064, 0x4054253d
+0, 60, 60, 1, 152064, 0x4befe5b5
+0, 61, 61, 1, 152064, 0x0678c0fa
+0, 62, 62, 1, 152064, 0xe3c54a03
+0, 63, 63, 1, 152064, 0xffa3210c
+0, 64, 64, 1, 152064, 0xed04b823
+0, 65, 65, 1, 152064, 0x00926457
+0, 66, 66, 1, 152064, 0xd56aaaf0
+0, 67, 67, 1, 152064, 0x6047ef6e
+0, 68, 68, 1, 152064, 0x44316d07
+0, 69, 69, 1, 152064, 0xe8a879b7
+0, 70, 70, 1, 152064, 0x1856cd86
+0, 71, 71, 1, 152064, 0x6528349a
+0, 72, 72, 1, 152064, 0xdeff676e
+0, 73, 73, 1, 152064, 0xda412e47
+0, 74, 74, 1, 152064, 0xa2c2a96f
+0, 75, 75, 1, 152064, 0xc703b8cd
+0, 76, 76, 1, 152064, 0x20b0650b
+0, 77, 77, 1, 152064, 0x8c14faa5
+0, 78, 78, 1, 152064, 0xa442706c
+0, 79, 79, 1, 152064, 0x6e456137
+0, 80, 80, 1, 152064, 0x6dde11c6
+0, 81, 81, 1, 152064, 0xb017978a
+0, 82, 82, 1, 152064, 0xc0bad34b
+0, 83, 83, 1, 152064, 0x8bd439ee
+0, 84, 84, 1, 152064, 0xa92735e4
+0, 85, 85, 1, 152064, 0x1623f501
+0, 86, 86, 1, 152064, 0x5be980b2
+0, 87, 87, 1, 152064, 0x4306b9bf
+0, 88, 88, 1, 152064, 0xb4f18976
+0, 89, 89, 1, 152064, 0x4ffb9b46
+0, 90, 90, 1, 152064, 0x23082275
+0, 91, 91, 1, 152064, 0xc7f0e087
+0, 92, 92, 1, 152064, 0x68b95327
+0, 93, 93, 1, 152064, 0xd030a8e4
+0, 94, 94, 1, 152064, 0xf8f9615c
+0, 95, 95, 1, 152064, 0x1b26fe3e
+0, 96, 96, 1, 152064, 0x3381608d
+0, 97, 97, 1, 152064, 0x9939d49d
+0, 98, 98, 1, 152064, 0x575f4f94
+0, 99, 99, 1, 152064, 0x436c581c
+0, 100, 100, 1, 152064, 0x8f47aa58
+0, 101, 101, 1, 152064, 0xd251d95a
+0, 102, 102, 1, 152064, 0x3c33b32c
+0, 103, 103, 1, 152064, 0xa1e19413
+0, 104, 104, 1, 152064, 0x8d95cbad
+0, 105, 105, 1, 152064, 0x98cbd35e
+0, 106, 106, 1, 152064, 0xceb81a0f
+0, 107, 107, 1, 152064, 0x5490fab1
+0, 108, 108, 1, 152064, 0x8e57a38c
+0, 109, 109, 1, 152064, 0xc379517a
+0, 110, 110, 1, 152064, 0xafc4f747
+0, 111, 111, 1, 152064, 0xbc9c9be4
+0, 112, 112, 1, 152064, 0xd602b2f5
+0, 113, 113, 1, 152064, 0x8d85a450
+0, 114, 114, 1, 152064, 0x48183c74
+0, 115, 115, 1, 152064, 0xd1725590
+0, 116, 116, 1, 152064, 0x5ef42ed7
+0, 117, 117, 1, 152064, 0xad3a3883
+0, 118, 118, 1, 152064, 0x7a3e0ddd
+0, 119, 119, 1, 152064, 0x59bdfd38
+0, 120, 120, 1, 152064, 0x5ac3ba9f
+0, 121, 121, 1, 152064, 0x266cbd00
+0, 122, 122, 1, 152064, 0x97d29e00
+0, 123, 123, 1, 152064, 0x620774c2
+0, 124, 124, 1, 152064, 0xaae8b96f
+0, 125, 125, 1, 152064, 0x5f6bdfb6
+0, 126, 126, 1, 152064, 0xb239da53
+0, 127, 127, 1, 152064, 0x654b5680
+0, 128, 128, 1, 152064, 0xd796b723
+0, 129, 129, 1, 152064, 0xd5c84a81
+0, 130, 130, 1, 152064, 0x2a761652
+0, 131, 131, 1, 152064, 0x1137e145
+0, 132, 132, 1, 152064, 0x1a9a451b
+0, 133, 133, 1, 152064, 0x5ca751c4
+0, 134, 134, 1, 152064, 0x074acec7
+0, 135, 135, 1, 152064, 0x9ddfe77d
+0, 136, 136, 1, 152064, 0xfb211c29
+0, 137, 137, 1, 152064, 0x681ad4dd
+0, 138, 138, 1, 152064, 0x702c12cc
+0, 139, 139, 1, 152064, 0x556c5101
+0, 140, 140, 1, 152064, 0x39d4bb54
+0, 141, 141, 1, 152064, 0xa3a118d6
+0, 142, 142, 1, 152064, 0xb78b7db1
+0, 143, 143, 1, 152064, 0x4e20eed5
+0, 144, 144, 1, 152064, 0x6555a9df
+0, 145, 145, 1, 152064, 0xb607a9a4
+0, 146, 146, 1, 152064, 0x3cf96a94
+0, 147, 147, 1, 152064, 0xb2679007
+0, 148, 148, 1, 152064, 0xf09d5b85
+0, 149, 149, 1, 152064, 0x3961ba07
+0, 150, 150, 1, 152064, 0x0c28363a
+0, 151, 151, 1, 152064, 0x0a017c2d
+0, 152, 152, 1, 152064, 0x3a661de3
+0, 153, 153, 1, 152064, 0xf8d1bdee
+0, 154, 154, 1, 152064, 0x6f47791b
+0, 155, 155, 1, 152064, 0xe05b22c6
+0, 156, 156, 1, 152064, 0x7cc93bb0
+0, 157, 157, 1, 152064, 0xeb90c3d8
+0, 158, 158, 1, 152064, 0x1a1eac98
+0, 159, 159, 1, 152064, 0x92985671
+0, 160, 160, 1, 152064, 0x2fe3ce53
+0, 161, 161, 1, 152064, 0x61def691
+0, 162, 162, 1, 152064, 0x90820730
+0, 163, 163, 1, 152064, 0x17630372
+0, 164, 164, 1, 152064, 0xaf6cea12
+0, 165, 165, 1, 152064, 0xfe3b7ecc
+0, 166, 166, 1, 152064, 0x904a5b2e
+0, 167, 167, 1, 152064, 0x0d88d5f2
+0, 168, 168, 1, 152064, 0x498d22b1
+0, 169, 169, 1, 152064, 0x56baba83
+0, 170, 170, 1, 152064, 0xda4d6dfa
+0, 171, 171, 1, 152064, 0xaa38cbdd
+0, 172, 172, 1, 152064, 0x4077f15d
+0, 173, 173, 1, 152064, 0x7e006ec2
+0, 174, 174, 1, 152064, 0x59964a89
+0, 175, 175, 1, 152064, 0x04c078e3
+0, 176, 176, 1, 152064, 0x7a5faf97
+0, 177, 177, 1, 152064, 0xc517b3e9
+0, 178, 178, 1, 152064, 0xfcc81af5
+0, 179, 179, 1, 152064, 0xdcb44f62
+0, 180, 180, 1, 152064, 0x2a080b72
+0, 181, 181, 1, 152064, 0x91f88c67
+0, 182, 182, 1, 152064, 0xd39caf81
+0, 183, 183, 1, 152064, 0x0764ae31
+0, 184, 184, 1, 152064, 0x0ddb82ed
+0, 185, 185, 1, 152064, 0xed6d17e4
+0, 186, 186, 1, 152064, 0xb4f74712
+0, 187, 187, 1, 152064, 0x23a20787
+0, 188, 188, 1, 152064, 0x853e7b33
+0, 189, 189, 1, 152064, 0xc6bac173
+0, 190, 190, 1, 152064, 0xb590ec15
+0, 191, 191, 1, 152064, 0xfdd2943c
+0, 192, 192, 1, 152064, 0xba5d1160
+0, 193, 193, 1, 152064, 0xe732c5a7
+0, 194, 194, 1, 152064, 0x279f6ce9
+0, 195, 195, 1, 152064, 0xb3835829
+0, 196, 196, 1, 152064, 0x0901b2a1
+0, 197, 197, 1, 152064, 0x3df2b8f8
+0, 198, 198, 1, 152064, 0x374496a4
+0, 199, 199, 1, 152064, 0x1bc6a4ae
+0, 200, 200, 1, 152064, 0xdb4b372e
+0, 201, 201, 1, 152064, 0x8c11c214
+0, 202, 202, 1, 152064, 0xd2d5c093
+0, 203, 203, 1, 152064, 0x8dda094e
+0, 204, 204, 1, 152064, 0x9b2cc401
+0, 205, 205, 1, 152064, 0x1a3b49d5
+0, 206, 206, 1, 152064, 0xaf5342ff
+0, 207, 207, 1, 152064, 0x74c0de83
+0, 208, 208, 1, 152064, 0xcf486137
+0, 209, 209, 1, 152064, 0xcf005b3b
+0, 210, 210, 1, 152064, 0x86a64c55
+0, 211, 211, 1, 152064, 0xdd3f7ae9
+0, 212, 212, 1, 152064, 0xb0d01e53
+0, 213, 213, 1, 152064, 0x83219065
+0, 214, 214, 1, 152064, 0x17a35d27
+0, 215, 215, 1, 152064, 0xf92645b5
+0, 216, 216, 1, 152064, 0x8322bdbf
+0, 217, 217, 1, 152064, 0xd589f6a2
+0, 218, 218, 1, 152064, 0x80a62d9e
+0, 219, 219, 1, 152064, 0x05b3e0d1
+0, 220, 220, 1, 152064, 0xd657aa0b
+0, 221, 221, 1, 152064, 0xec5ac2dd
+0, 222, 222, 1, 152064, 0xbf0ff969
+0, 223, 223, 1, 152064, 0xc34a5140
+0, 224, 224, 1, 152064, 0x814705c4
+0, 225, 225, 1, 152064, 0xe9592008
+0, 226, 226, 1, 152064, 0xf12c933c
+0, 227, 227, 1, 152064, 0x2daee178
+0, 228, 228, 1, 152064, 0xa2573028
+0, 229, 229, 1, 152064, 0x6109f58d
+0, 230, 230, 1, 152064, 0x64ab8ce4
+0, 231, 231, 1, 152064, 0x13a88b6e
+0, 232, 232, 1, 152064, 0x8f0181a9
+0, 233, 233, 1, 152064, 0xd5295fd4
+0, 234, 234, 1, 152064, 0xfdbeeb0d
+0, 235, 235, 1, 152064, 0x05ecd231
+0, 236, 236, 1, 152064, 0x48d164cd
+0, 237, 237, 1, 152064, 0xc279cf63
+0, 238, 238, 1, 152064, 0x1d5e6a03
+0, 239, 239, 1, 152064, 0xd9dc1807
+0, 240, 240, 1, 152064, 0xbcc83676
+0, 241, 241, 1, 152064, 0x65a9811e
+0, 242, 242, 1, 152064, 0x3ccfe5a8
+0, 243, 243, 1, 152064, 0x2f2ff051
+0, 244, 244, 1, 152064, 0x9193e093
+0, 245, 245, 1, 152064, 0x9a30fdc6
+0, 246, 246, 1, 152064, 0x90b7ea10
+0, 247, 247, 1, 152064, 0x3291910c
+0, 248, 248, 1, 152064, 0x2335d186
+0, 249, 249, 1, 152064, 0x2890cf1d
+0, 250, 250, 1, 152064, 0x8c8b6245
+0, 251, 251, 1, 152064, 0x24b84eda
+0, 252, 252, 1, 152064, 0x04a12446
+0, 253, 253, 1, 152064, 0xd9d91d51
+0, 254, 254, 1, 152064, 0xbf450adf
+0, 255, 255, 1, 152064, 0xa19a9a41
+0, 256, 256, 1, 152064, 0x2211ab01
+0, 257, 257, 1, 152064, 0x8fe85430
+0, 258, 258, 1, 152064, 0x5a152861
+0, 259, 259, 1, 152064, 0x7fe76995
+0, 260, 260, 1, 152064, 0x508b99cd
+0, 261, 261, 1, 152064, 0x92e79437
+0, 262, 262, 1, 152064, 0x8572eac9
+0, 263, 263, 1, 152064, 0x42e3d513
+0, 264, 264, 1, 152064, 0x6bee9e38
+0, 265, 265, 1, 152064, 0x2858ad4b
+0, 266, 266, 1, 152064, 0x96d87d00
+0, 267, 267, 1, 152064, 0x749f1032
+0, 268, 268, 1, 152064, 0x668fca6c
+0, 269, 269, 1, 152064, 0x11d278d9
+0, 270, 270, 1, 152064, 0x10fd46ea
+0, 271, 271, 1, 152064, 0xc8b193c8
+0, 272, 272, 1, 152064, 0x035e7d02
+0, 273, 273, 1, 152064, 0x067f583c
+0, 274, 274, 1, 152064, 0xd9648a1e
+0, 275, 275, 1, 152064, 0x92487b7e
+0, 276, 276, 1, 152064, 0xc7b35421
+0, 277, 277, 1, 152064, 0x2ed57c1c
+0, 278, 278, 1, 152064, 0xefe24c5f
+0, 279, 279, 1, 152064, 0x8df0118b
+0, 280, 280, 1, 152064, 0x18f0278d
+0, 281, 281, 1, 152064, 0x63ac45ad
+0, 282, 282, 1, 152064, 0xd79849f0
+0, 283, 283, 1, 152064, 0x1f1d4dab
+0, 284, 284, 1, 152064, 0x736fb5b8
+0, 285, 285, 1, 152064, 0xc24eb80c
+0, 286, 286, 1, 152064, 0x64ca3b11
+0, 287, 287, 1, 152064, 0x35d8674c
+0, 288, 288, 1, 152064, 0x3c5a7b51
+0, 289, 289, 1, 152064, 0x97550b81
+0, 290, 290, 1, 152064, 0x731454b5
+0, 291, 291, 1, 152064, 0x01de43bc
+0, 292, 292, 1, 152064, 0xbda7afae
+0, 293, 293, 1, 152064, 0xeb34d714
+0, 294, 294, 1, 152064, 0x1260cc98
+0, 295, 295, 1, 152064, 0x7e592c36
+0, 296, 296, 1, 152064, 0x40b3676e
+0, 297, 297, 1, 152064, 0x8c9d6b94
+0, 298, 298, 1, 152064, 0xc7988665
+0, 299, 299, 1, 152064, 0xf2994d52
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-hpcaq2lq_brcm_b b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-hpcaq2lq_brcm_b
index bc41f24..460f86c 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-hpcaq2lq_brcm_b
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-hpcaq2lq_brcm_b
@@ -1,100 +1,101 @@
-0, 0, 152064, 0x712a2ad3
-0, 3600, 152064, 0x83420c9d
-0, 7200, 152064, 0xf3d77f46
-0, 10800, 152064, 0x67eab1a2
-0, 14400, 152064, 0x41df4534
-0, 18000, 152064, 0x68f268ce
-0, 21600, 152064, 0x288debdf
-0, 25200, 152064, 0x46ae56a7
-0, 28800, 152064, 0x1720f327
-0, 32400, 152064, 0x64752592
-0, 36000, 152064, 0x43e17a27
-0, 39600, 152064, 0x39f7cc52
-0, 43200, 152064, 0xc19a785c
-0, 46800, 152064, 0x562df0d4
-0, 50400, 152064, 0x50c96da0
-0, 54000, 152064, 0x1da8bdb5
-0, 57600, 152064, 0x02ddfb59
-0, 61200, 152064, 0x4d0c3e0e
-0, 64800, 152064, 0x1605371b
-0, 68400, 152064, 0x9772464d
-0, 72000, 152064, 0xc603441c
-0, 75600, 152064, 0xf9581917
-0, 79200, 152064, 0x4dbf74af
-0, 82800, 152064, 0x04b8b820
-0, 86400, 152064, 0x75061cdf
-0, 90000, 152064, 0x760bea90
-0, 93600, 152064, 0x7114cab3
-0, 97200, 152064, 0x89e14328
-0, 100800, 152064, 0x402ba116
-0, 104400, 152064, 0x8af2ccc6
-0, 108000, 152064, 0x1294333a
-0, 111600, 152064, 0xe466aa9f
-0, 115200, 152064, 0x7ce28426
-0, 118800, 152064, 0x21c16487
-0, 122400, 152064, 0xde3d5fc9
-0, 126000, 152064, 0x58cb2906
-0, 129600, 152064, 0x1df514ec
-0, 133200, 152064, 0x7e45bfb6
-0, 136800, 152064, 0xcdaaafc0
-0, 140400, 152064, 0x70a58eac
-0, 144000, 152064, 0xca7263b0
-0, 147600, 152064, 0x022621e0
-0, 151200, 152064, 0x938901c2
-0, 154800, 152064, 0x8c099e47
-0, 158400, 152064, 0xebfecda0
-0, 162000, 152064, 0x5a3aff71
-0, 165600, 152064, 0xb47c6692
-0, 169200, 152064, 0xde04b626
-0, 172800, 152064, 0xb1c61c94
-0, 176400, 152064, 0xbcc7eb35
-0, 180000, 152064, 0x801b958d
-0, 183600, 152064, 0xf5254f5d
-0, 187200, 152064, 0x4336da49
-0, 190800, 152064, 0x3139bcaf
-0, 194400, 152064, 0xb8359026
-0, 198000, 152064, 0xb6d39756
-0, 201600, 152064, 0xdf5c1c14
-0, 205200, 152064, 0x3f587336
-0, 208800, 152064, 0x105eeb74
-0, 212400, 152064, 0xffe23c19
-0, 216000, 152064, 0xfb1a1c5e
-0, 219600, 152064, 0xb8edb942
-0, 223200, 152064, 0x7ca92b27
-0, 226800, 152064, 0xd2fe1e24
-0, 230400, 152064, 0xd6b8939a
-0, 234000, 152064, 0xd59743da
-0, 237600, 152064, 0x005d9e7a
-0, 241200, 152064, 0x4c5cb03e
-0, 244800, 152064, 0x4a7c363a
-0, 248400, 152064, 0x627c88a8
-0, 252000, 152064, 0x3fcd8650
-0, 255600, 152064, 0x75b7f0b3
-0, 259200, 152064, 0xcbb95a00
-0, 262800, 152064, 0xc9871783
-0, 266400, 152064, 0xe9c2b471
-0, 270000, 152064, 0x513f0eb3
-0, 273600, 152064, 0x5a5c4fdc
-0, 277200, 152064, 0xdc8cbab6
-0, 280800, 152064, 0x86fe75d2
-0, 284400, 152064, 0xa6d52ce2
-0, 288000, 152064, 0xde74a975
-0, 291600, 152064, 0xc1bf3ef2
-0, 295200, 152064, 0xa1a1b832
-0, 298800, 152064, 0x0b23f718
-0, 302400, 152064, 0x842eed85
-0, 306000, 152064, 0xda96923b
-0, 309600, 152064, 0x7d011f83
-0, 313200, 152064, 0x26a25528
-0, 316800, 152064, 0x117b7971
-0, 320400, 152064, 0x3f17b29d
-0, 324000, 152064, 0x428654c0
-0, 327600, 152064, 0xc2343316
-0, 331200, 152064, 0x284371fe
-0, 334800, 152064, 0x388ef972
-0, 338400, 152064, 0x5f046560
-0, 342000, 152064, 0x6e9ac7e9
-0, 345600, 152064, 0x0cd6277c
-0, 349200, 152064, 0xfc7ba0b1
-0, 352800, 152064, 0x4d840475
-0, 356400, 152064, 0xd4cb26a6
+#tb 0: 1/25
+0, 0, 0, 1, 152064, 0x712a2ad3
+0, 1, 1, 1, 152064, 0x83420c9d
+0, 2, 2, 1, 152064, 0xf3d77f46
+0, 3, 3, 1, 152064, 0x67eab1a2
+0, 4, 4, 1, 152064, 0x41df4534
+0, 5, 5, 1, 152064, 0x68f268ce
+0, 6, 6, 1, 152064, 0x288debdf
+0, 7, 7, 1, 152064, 0x46ae56a7
+0, 8, 8, 1, 152064, 0x1720f327
+0, 9, 9, 1, 152064, 0x64752592
+0, 10, 10, 1, 152064, 0x43e17a27
+0, 11, 11, 1, 152064, 0x39f7cc52
+0, 12, 12, 1, 152064, 0xc19a785c
+0, 13, 13, 1, 152064, 0x562df0d4
+0, 14, 14, 1, 152064, 0x50c96da0
+0, 15, 15, 1, 152064, 0x1da8bdb5
+0, 16, 16, 1, 152064, 0x02ddfb59
+0, 17, 17, 1, 152064, 0x4d0c3e0e
+0, 18, 18, 1, 152064, 0x1605371b
+0, 19, 19, 1, 152064, 0x9772464d
+0, 20, 20, 1, 152064, 0xc603441c
+0, 21, 21, 1, 152064, 0xf9581917
+0, 22, 22, 1, 152064, 0x4dbf74af
+0, 23, 23, 1, 152064, 0x04b8b820
+0, 24, 24, 1, 152064, 0x75061cdf
+0, 25, 25, 1, 152064, 0x760bea90
+0, 26, 26, 1, 152064, 0x7114cab3
+0, 27, 27, 1, 152064, 0x89e14328
+0, 28, 28, 1, 152064, 0x402ba116
+0, 29, 29, 1, 152064, 0x8af2ccc6
+0, 30, 30, 1, 152064, 0x1294333a
+0, 31, 31, 1, 152064, 0xe466aa9f
+0, 32, 32, 1, 152064, 0x7ce28426
+0, 33, 33, 1, 152064, 0x21c16487
+0, 34, 34, 1, 152064, 0xde3d5fc9
+0, 35, 35, 1, 152064, 0x58cb2906
+0, 36, 36, 1, 152064, 0x1df514ec
+0, 37, 37, 1, 152064, 0x7e45bfb6
+0, 38, 38, 1, 152064, 0xcdaaafc0
+0, 39, 39, 1, 152064, 0x70a58eac
+0, 40, 40, 1, 152064, 0xca7263b0
+0, 41, 41, 1, 152064, 0x022621e0
+0, 42, 42, 1, 152064, 0x938901c2
+0, 43, 43, 1, 152064, 0x8c099e47
+0, 44, 44, 1, 152064, 0xebfecda0
+0, 45, 45, 1, 152064, 0x5a3aff71
+0, 46, 46, 1, 152064, 0xb47c6692
+0, 47, 47, 1, 152064, 0xde04b626
+0, 48, 48, 1, 152064, 0xb1c61c94
+0, 49, 49, 1, 152064, 0xbcc7eb35
+0, 50, 50, 1, 152064, 0x801b958d
+0, 51, 51, 1, 152064, 0xf5254f5d
+0, 52, 52, 1, 152064, 0x4336da49
+0, 53, 53, 1, 152064, 0x3139bcaf
+0, 54, 54, 1, 152064, 0xb8359026
+0, 55, 55, 1, 152064, 0xb6d39756
+0, 56, 56, 1, 152064, 0xdf5c1c14
+0, 57, 57, 1, 152064, 0x3f587336
+0, 58, 58, 1, 152064, 0x105eeb74
+0, 59, 59, 1, 152064, 0xffe23c19
+0, 60, 60, 1, 152064, 0xfb1a1c5e
+0, 61, 61, 1, 152064, 0xb8edb942
+0, 62, 62, 1, 152064, 0x7ca92b27
+0, 63, 63, 1, 152064, 0xd2fe1e24
+0, 64, 64, 1, 152064, 0xd6b8939a
+0, 65, 65, 1, 152064, 0xd59743da
+0, 66, 66, 1, 152064, 0x005d9e7a
+0, 67, 67, 1, 152064, 0x4c5cb03e
+0, 68, 68, 1, 152064, 0x4a7c363a
+0, 69, 69, 1, 152064, 0x627c88a8
+0, 70, 70, 1, 152064, 0x3fcd8650
+0, 71, 71, 1, 152064, 0x75b7f0b3
+0, 72, 72, 1, 152064, 0xcbb95a00
+0, 73, 73, 1, 152064, 0xc9871783
+0, 74, 74, 1, 152064, 0xe9c2b471
+0, 75, 75, 1, 152064, 0x513f0eb3
+0, 76, 76, 1, 152064, 0x5a5c4fdc
+0, 77, 77, 1, 152064, 0xdc8cbab6
+0, 78, 78, 1, 152064, 0x86fe75d2
+0, 79, 79, 1, 152064, 0xa6d52ce2
+0, 80, 80, 1, 152064, 0xde74a975
+0, 81, 81, 1, 152064, 0xc1bf3ef2
+0, 82, 82, 1, 152064, 0xa1a1b832
+0, 83, 83, 1, 152064, 0x0b23f718
+0, 84, 84, 1, 152064, 0x842eed85
+0, 85, 85, 1, 152064, 0xda96923b
+0, 86, 86, 1, 152064, 0x7d011f83
+0, 87, 87, 1, 152064, 0x26a25528
+0, 88, 88, 1, 152064, 0x117b7971
+0, 89, 89, 1, 152064, 0x3f17b29d
+0, 90, 90, 1, 152064, 0x428654c0
+0, 91, 91, 1, 152064, 0xc2343316
+0, 92, 92, 1, 152064, 0x284371fe
+0, 93, 93, 1, 152064, 0x388ef972
+0, 94, 94, 1, 152064, 0x5f046560
+0, 95, 95, 1, 152064, 0x6e9ac7e9
+0, 96, 96, 1, 152064, 0x0cd6277c
+0, 97, 97, 1, 152064, 0xfc7ba0b1
+0, 98, 98, 1, 152064, 0x4d840475
+0, 99, 99, 1, 152064, 0xd4cb26a6
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-hpcv_brcm_a b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-hpcv_brcm_a
index cbfc568..d608d89 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-hpcv_brcm_a
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-hpcv_brcm_a
@@ -1,300 +1,301 @@
-0, 0, 152064, 0x995bb4bd
-0, 3600, 152064, 0xad287357
-0, 7200, 152064, 0x38fa4661
-0, 10800, 152064, 0x8aae73cf
-0, 14400, 152064, 0x4a13eada
-0, 18000, 152064, 0x48b33901
-0, 21600, 152064, 0x011487bc
-0, 25200, 152064, 0xd4ce1925
-0, 28800, 152064, 0x5d679ddd
-0, 32400, 152064, 0x276cd5cf
-0, 36000, 152064, 0x99c625f0
-0, 39600, 152064, 0xb2f756d1
-0, 43200, 152064, 0xb19c2978
-0, 46800, 152064, 0xdac0ff3c
-0, 50400, 152064, 0x3c1c8d63
-0, 54000, 152064, 0x818ea0a8
-0, 57600, 152064, 0xa7c122a5
-0, 61200, 152064, 0x67ad3519
-0, 64800, 152064, 0xc81b2a88
-0, 68400, 152064, 0x8ae6633e
-0, 72000, 152064, 0xed945788
-0, 75600, 152064, 0x4c740bcb
-0, 79200, 152064, 0xd8408d09
-0, 82800, 152064, 0xb710e8b8
-0, 86400, 152064, 0xb8c647b9
-0, 90000, 152064, 0x802b2e23
-0, 93600, 152064, 0x30672529
-0, 97200, 152064, 0x328a72b6
-0, 100800, 152064, 0xeb6dbe94
-0, 104400, 152064, 0x1c19dcc5
-0, 108000, 152064, 0xfdc6b998
-0, 111600, 152064, 0xf9e2cd80
-0, 115200, 152064, 0x025eb15e
-0, 118800, 152064, 0xfd998ad8
-0, 122400, 152064, 0x8fdf736f
-0, 126000, 152064, 0xa5a7554a
-0, 129600, 152064, 0xcea63304
-0, 133200, 152064, 0xcb28ec28
-0, 136800, 152064, 0x92efb591
-0, 140400, 152064, 0x0f2376c3
-0, 144000, 152064, 0xe9cb5ecf
-0, 147600, 152064, 0xcd2d0eba
-0, 151200, 152064, 0xd57fe4fd
-0, 154800, 152064, 0xc486ab8e
-0, 158400, 152064, 0x01a1f709
-0, 162000, 152064, 0x7ac5b13a
-0, 165600, 152064, 0x6f519279
-0, 169200, 152064, 0xfd7cd9a0
-0, 172800, 152064, 0xfae649d2
-0, 176400, 152064, 0x618507ca
-0, 180000, 152064, 0xb177bc15
-0, 183600, 152064, 0x6fa36854
-0, 187200, 152064, 0xc13cb77d
-0, 190800, 152064, 0x6d40cb01
-0, 194400, 152064, 0xa3db96a2
-0, 198000, 152064, 0xe5ba6c99
-0, 201600, 152064, 0xca9ff3ee
-0, 205200, 152064, 0x6c016c65
-0, 208800, 152064, 0xdf93ed80
-0, 212400, 152064, 0x93112ec8
-0, 216000, 152064, 0x8ab3ea14
-0, 219600, 152064, 0x02f5b891
-0, 223200, 152064, 0xdafd562b
-0, 226800, 152064, 0xa96a2bd7
-0, 230400, 152064, 0xdff8bc68
-0, 234000, 152064, 0x8d956b4b
-0, 237600, 152064, 0xb4aeb960
-0, 241200, 152064, 0x391cf0dd
-0, 244800, 152064, 0x03137de9
-0, 248400, 152064, 0x2bfa8c4b
-0, 252000, 152064, 0xfb54d3a5
-0, 255600, 152064, 0x650146e7
-0, 259200, 152064, 0xd3a7765f
-0, 262800, 152064, 0x49d72b90
-0, 266400, 152064, 0xf089b357
-0, 270000, 152064, 0x23a2be41
-0, 273600, 152064, 0x2ea86592
-0, 277200, 152064, 0x99d6f56b
-0, 280800, 152064, 0xc2ca75b9
-0, 284400, 152064, 0x390b7278
-0, 288000, 152064, 0x0f6d1f1e
-0, 291600, 152064, 0x79e2a3f4
-0, 295200, 152064, 0x51d5e1da
-0, 298800, 152064, 0xdb57419a
-0, 302400, 152064, 0xf90a4153
-0, 306000, 152064, 0xd192f6c6
-0, 309600, 152064, 0x8cd3895a
-0, 313200, 152064, 0x0d3ec577
-0, 316800, 152064, 0x146e8492
-0, 320400, 152064, 0xc9939c22
-0, 324000, 152064, 0xf1f4275e
-0, 327600, 152064, 0xb898eb35
-0, 331200, 152064, 0xed315ee9
-0, 334800, 152064, 0x9046b760
-0, 338400, 152064, 0x599a736b
-0, 342000, 152064, 0xaef20726
-0, 345600, 152064, 0x0d136768
-0, 349200, 152064, 0xfe4ed2a8
-0, 352800, 152064, 0x5a85524b
-0, 356400, 152064, 0x6d495dd2
-0, 360000, 152064, 0x04bdb815
-0, 363600, 152064, 0x28aae1c5
-0, 367200, 152064, 0xc20bc8d9
-0, 370800, 152064, 0xa33d9b41
-0, 374400, 152064, 0x6269cb43
-0, 378000, 152064, 0x4f81d636
-0, 381600, 152064, 0xc6062166
-0, 385200, 152064, 0xb027fbcc
-0, 388800, 152064, 0x73a7a584
-0, 392400, 152064, 0xf67e520a
-0, 396000, 152064, 0x94eff023
-0, 399600, 152064, 0xef1da8e5
-0, 403200, 152064, 0x2d9ab411
-0, 406800, 152064, 0xf0c39b5d
-0, 410400, 152064, 0xb2374724
-0, 414000, 152064, 0x939a5243
-0, 417600, 152064, 0xee3438db
-0, 421200, 152064, 0x7da04012
-0, 424800, 152064, 0xac611668
-0, 428400, 152064, 0xdce3062e
-0, 432000, 152064, 0xb57cc00e
-0, 435600, 152064, 0xaf96b59e
-0, 439200, 152064, 0x56789c13
-0, 442800, 152064, 0xb1f678b5
-0, 446400, 152064, 0xb340b8c4
-0, 450000, 152064, 0x86e6e304
-0, 453600, 152064, 0xa056e037
-0, 457200, 152064, 0x16885d27
-0, 460800, 152064, 0x9c5ac065
-0, 464400, 152064, 0x563d5335
-0, 468000, 152064, 0x3ca71c1e
-0, 471600, 152064, 0xad34e16c
-0, 475200, 152064, 0x6d074b27
-0, 478800, 152064, 0x9b1c4909
-0, 482400, 152064, 0xdbced198
-0, 486000, 152064, 0x8a0ded00
-0, 489600, 152064, 0x5ffc209b
-0, 493200, 152064, 0x47cfd269
-0, 496800, 152064, 0xe3c0137e
-0, 500400, 152064, 0xcb6a5e53
-0, 504000, 152064, 0x87cec05f
-0, 507600, 152064, 0x92721dd2
-0, 511200, 152064, 0x3f7d7b3b
-0, 514800, 152064, 0xd63ef417
-0, 518400, 152064, 0xf8e4b05a
-0, 522000, 152064, 0xb5dcb421
-0, 525600, 152064, 0x53c96f6a
-0, 529200, 152064, 0x24ae98a3
-0, 532800, 152064, 0x2e9b5fff
-0, 536400, 152064, 0x7795bf12
-0, 540000, 152064, 0x499d37ca
-0, 543600, 152064, 0xfe478487
-0, 547200, 152064, 0xcd661afb
-0, 550800, 152064, 0x44f8bf00
-0, 554400, 152064, 0x90b67809
-0, 558000, 152064, 0x8f5726d1
-0, 561600, 152064, 0x2e3c39d5
-0, 565200, 152064, 0x4b67c4e6
-0, 568800, 152064, 0x9fecb7cf
-0, 572400, 152064, 0x207766ea
-0, 576000, 152064, 0x5846bf7b
-0, 579600, 152064, 0x4237fba1
-0, 583200, 152064, 0x983e0cbd
-0, 586800, 152064, 0x6be100d1
-0, 590400, 152064, 0x9d0beb8f
-0, 594000, 152064, 0x234b82e7
-0, 597600, 152064, 0x83fb5ef1
-0, 601200, 152064, 0xf503dcb2
-0, 604800, 152064, 0x031a27f2
-0, 608400, 152064, 0x2f1abf24
-0, 612000, 152064, 0x54d77010
-0, 615600, 152064, 0x049fc0fc
-0, 619200, 152064, 0x20f2f7e7
-0, 622800, 152064, 0xc0d57467
-0, 626400, 152064, 0xbe464eef
-0, 630000, 152064, 0x035c9052
-0, 633600, 152064, 0x91cba4fb
-0, 637200, 152064, 0x11cdbbfb
-0, 640800, 152064, 0xe61116d5
-0, 644400, 152064, 0x16db46b8
-0, 648000, 152064, 0x54f30d9f
-0, 651600, 152064, 0x211a8d2d
-0, 655200, 152064, 0x5a74a56b
-0, 658800, 152064, 0x0ff4ba72
-0, 662400, 152064, 0x4c398ad6
-0, 666000, 152064, 0x830814f0
-0, 669600, 152064, 0xa51f4bab
-0, 673200, 152064, 0xf3460de6
-0, 676800, 152064, 0x7e1979a1
-0, 680400, 152064, 0x4b3ebb3a
-0, 684000, 152064, 0x83d1f4f8
-0, 687600, 152064, 0xfbf08683
-0, 691200, 152064, 0x901c07ec
-0, 694800, 152064, 0xbc2dc1c7
-0, 698400, 152064, 0x6e646b3b
-0, 702000, 152064, 0x51a25aab
-0, 705600, 152064, 0xa042ab78
-0, 709200, 152064, 0xb972af58
-0, 712800, 152064, 0xcdca9568
-0, 716400, 152064, 0x17b69d1c
-0, 720000, 152064, 0x41c43ea2
-0, 723600, 152064, 0x195fc7a0
-0, 727200, 152064, 0xf4cec580
-0, 730800, 152064, 0xb3b10936
-0, 734400, 152064, 0x102bc2ec
-0, 738000, 152064, 0xc99d4767
-0, 741600, 152064, 0x60c745b0
-0, 745200, 152064, 0x8176e0cf
-0, 748800, 152064, 0xd47e69b5
-0, 752400, 152064, 0xacce674c
-0, 756000, 152064, 0x031b51f8
-0, 759600, 152064, 0x0eb681ef
-0, 763200, 152064, 0x0b69334b
-0, 766800, 152064, 0xda819c1f
-0, 770400, 152064, 0xa93f62d2
-0, 774000, 152064, 0x51374db5
-0, 777600, 152064, 0x885dccff
-0, 781200, 152064, 0xd0780444
-0, 784800, 152064, 0xa31733ca
-0, 788400, 152064, 0x3f3de84e
-0, 792000, 152064, 0x2af2b2c3
-0, 795600, 152064, 0xa62dceae
-0, 799200, 152064, 0xca1cffd1
-0, 802800, 152064, 0x3c7d561b
-0, 806400, 152064, 0xbc04130a
-0, 810000, 152064, 0xbd2829ae
-0, 813600, 152064, 0xdbbb9820
-0, 817200, 152064, 0xfc3ef628
-0, 820800, 152064, 0xd5da3ec3
-0, 824400, 152064, 0x62d5fcc1
-0, 828000, 152064, 0x455a8dae
-0, 831600, 152064, 0x421c9147
-0, 835200, 152064, 0x6a168484
-0, 838800, 152064, 0x7ba15d32
-0, 842400, 152064, 0xd089ed27
-0, 846000, 152064, 0x8fc4d894
-0, 849600, 152064, 0x99e47125
-0, 853200, 152064, 0xf55dda68
-0, 856800, 152064, 0x6bf06cf1
-0, 860400, 152064, 0x7dc41a9d
-0, 864000, 152064, 0x78b84019
-0, 867600, 152064, 0x85ae8973
-0, 871200, 152064, 0x7b7aeabe
-0, 874800, 152064, 0xf9a8f6bf
-0, 878400, 152064, 0xe195ddcd
-0, 882000, 152064, 0x83edffe9
-0, 885600, 152064, 0x59cce97a
-0, 889200, 152064, 0x15268af1
-0, 892800, 152064, 0x270cca95
-0, 896400, 152064, 0x8bced1f9
-0, 900000, 152064, 0x08ee5cec
-0, 903600, 152064, 0x01e74f95
-0, 907200, 152064, 0x7e19238f
-0, 910800, 152064, 0x6bcb2b9d
-0, 914400, 152064, 0x58111385
-0, 918000, 152064, 0x6c7aa1f7
-0, 921600, 152064, 0xb713a822
-0, 925200, 152064, 0x1d645cee
-0, 928800, 152064, 0x9c592969
-0, 932400, 152064, 0x2472769e
-0, 936000, 152064, 0x71b7a5ad
-0, 939600, 152064, 0xc6bba1c6
-0, 943200, 152064, 0x7351f305
-0, 946800, 152064, 0x579edbba
-0, 950400, 152064, 0x90eda919
-0, 954000, 152064, 0x2833b10d
-0, 957600, 152064, 0x4b967d65
-0, 961200, 152064, 0x6e7d1702
-0, 964800, 152064, 0x59dbcf5b
-0, 968400, 152064, 0xa138847b
-0, 972000, 152064, 0xb2414e8d
-0, 975600, 152064, 0xb90497f6
-0, 979200, 152064, 0xcd728159
-0, 982800, 152064, 0x005d5bdd
-0, 986400, 152064, 0x27c88fb6
-0, 990000, 152064, 0x3ccb8a93
-0, 993600, 152064, 0xc50256dd
-0, 997200, 152064, 0x111e7dee
-0, 1000800, 152064, 0x259d4a5d
-0, 1004400, 152064, 0x9385148b
-0, 1008000, 152064, 0x74002ab0
-0, 1011600, 152064, 0xd2c74adc
-0, 1015200, 152064, 0x72854b2a
-0, 1018800, 152064, 0x638e5c08
-0, 1022400, 152064, 0x9626bbb3
-0, 1026000, 152064, 0xc107c18f
-0, 1029600, 152064, 0x8bd04578
-0, 1033200, 152064, 0xbcdb6db6
-0, 1036800, 152064, 0x9d0c81be
-0, 1040400, 152064, 0xf25106b6
-0, 1044000, 152064, 0x54c25254
-0, 1047600, 152064, 0x4bf74663
-0, 1051200, 152064, 0x0051b054
-0, 1054800, 152064, 0x5193d3d4
-0, 1058400, 152064, 0xb5d0d045
-0, 1062000, 152064, 0x350a31ca
-0, 1065600, 152064, 0xb8fb7264
-0, 1069200, 152064, 0x7fb97645
-0, 1072800, 152064, 0xcd948c41
-0, 1076400, 152064, 0x38c7570a
+#tb 0: 1/25
+0, 0, 0, 1, 152064, 0x995bb4bd
+0, 1, 1, 1, 152064, 0xad287357
+0, 2, 2, 1, 152064, 0x38fa4661
+0, 3, 3, 1, 152064, 0x8aae73cf
+0, 4, 4, 1, 152064, 0x4a13eada
+0, 5, 5, 1, 152064, 0x48b33901
+0, 6, 6, 1, 152064, 0x011487bc
+0, 7, 7, 1, 152064, 0xd4ce1925
+0, 8, 8, 1, 152064, 0x5d679ddd
+0, 9, 9, 1, 152064, 0x276cd5cf
+0, 10, 10, 1, 152064, 0x99c625f0
+0, 11, 11, 1, 152064, 0xb2f756d1
+0, 12, 12, 1, 152064, 0xb19c2978
+0, 13, 13, 1, 152064, 0xdac0ff3c
+0, 14, 14, 1, 152064, 0x3c1c8d63
+0, 15, 15, 1, 152064, 0x818ea0a8
+0, 16, 16, 1, 152064, 0xa7c122a5
+0, 17, 17, 1, 152064, 0x67ad3519
+0, 18, 18, 1, 152064, 0xc81b2a88
+0, 19, 19, 1, 152064, 0x8ae6633e
+0, 20, 20, 1, 152064, 0xed945788
+0, 21, 21, 1, 152064, 0x4c740bcb
+0, 22, 22, 1, 152064, 0xd8408d09
+0, 23, 23, 1, 152064, 0xb710e8b8
+0, 24, 24, 1, 152064, 0xb8c647b9
+0, 25, 25, 1, 152064, 0x802b2e23
+0, 26, 26, 1, 152064, 0x30672529
+0, 27, 27, 1, 152064, 0x328a72b6
+0, 28, 28, 1, 152064, 0xeb6dbe94
+0, 29, 29, 1, 152064, 0x1c19dcc5
+0, 30, 30, 1, 152064, 0xfdc6b998
+0, 31, 31, 1, 152064, 0xf9e2cd80
+0, 32, 32, 1, 152064, 0x025eb15e
+0, 33, 33, 1, 152064, 0xfd998ad8
+0, 34, 34, 1, 152064, 0x8fdf736f
+0, 35, 35, 1, 152064, 0xa5a7554a
+0, 36, 36, 1, 152064, 0xcea63304
+0, 37, 37, 1, 152064, 0xcb28ec28
+0, 38, 38, 1, 152064, 0x92efb591
+0, 39, 39, 1, 152064, 0x0f2376c3
+0, 40, 40, 1, 152064, 0xe9cb5ecf
+0, 41, 41, 1, 152064, 0xcd2d0eba
+0, 42, 42, 1, 152064, 0xd57fe4fd
+0, 43, 43, 1, 152064, 0xc486ab8e
+0, 44, 44, 1, 152064, 0x01a1f709
+0, 45, 45, 1, 152064, 0x7ac5b13a
+0, 46, 46, 1, 152064, 0x6f519279
+0, 47, 47, 1, 152064, 0xfd7cd9a0
+0, 48, 48, 1, 152064, 0xfae649d2
+0, 49, 49, 1, 152064, 0x618507ca
+0, 50, 50, 1, 152064, 0xb177bc15
+0, 51, 51, 1, 152064, 0x6fa36854
+0, 52, 52, 1, 152064, 0xc13cb77d
+0, 53, 53, 1, 152064, 0x6d40cb01
+0, 54, 54, 1, 152064, 0xa3db96a2
+0, 55, 55, 1, 152064, 0xe5ba6c99
+0, 56, 56, 1, 152064, 0xca9ff3ee
+0, 57, 57, 1, 152064, 0x6c016c65
+0, 58, 58, 1, 152064, 0xdf93ed80
+0, 59, 59, 1, 152064, 0x93112ec8
+0, 60, 60, 1, 152064, 0x8ab3ea14
+0, 61, 61, 1, 152064, 0x02f5b891
+0, 62, 62, 1, 152064, 0xdafd562b
+0, 63, 63, 1, 152064, 0xa96a2bd7
+0, 64, 64, 1, 152064, 0xdff8bc68
+0, 65, 65, 1, 152064, 0x8d956b4b
+0, 66, 66, 1, 152064, 0xb4aeb960
+0, 67, 67, 1, 152064, 0x391cf0dd
+0, 68, 68, 1, 152064, 0x03137de9
+0, 69, 69, 1, 152064, 0x2bfa8c4b
+0, 70, 70, 1, 152064, 0xfb54d3a5
+0, 71, 71, 1, 152064, 0x650146e7
+0, 72, 72, 1, 152064, 0xd3a7765f
+0, 73, 73, 1, 152064, 0x49d72b90
+0, 74, 74, 1, 152064, 0xf089b357
+0, 75, 75, 1, 152064, 0x23a2be41
+0, 76, 76, 1, 152064, 0x2ea86592
+0, 77, 77, 1, 152064, 0x99d6f56b
+0, 78, 78, 1, 152064, 0xc2ca75b9
+0, 79, 79, 1, 152064, 0x390b7278
+0, 80, 80, 1, 152064, 0x0f6d1f1e
+0, 81, 81, 1, 152064, 0x79e2a3f4
+0, 82, 82, 1, 152064, 0x51d5e1da
+0, 83, 83, 1, 152064, 0xdb57419a
+0, 84, 84, 1, 152064, 0xf90a4153
+0, 85, 85, 1, 152064, 0xd192f6c6
+0, 86, 86, 1, 152064, 0x8cd3895a
+0, 87, 87, 1, 152064, 0x0d3ec577
+0, 88, 88, 1, 152064, 0x146e8492
+0, 89, 89, 1, 152064, 0xc9939c22
+0, 90, 90, 1, 152064, 0xf1f4275e
+0, 91, 91, 1, 152064, 0xb898eb35
+0, 92, 92, 1, 152064, 0xed315ee9
+0, 93, 93, 1, 152064, 0x9046b760
+0, 94, 94, 1, 152064, 0x599a736b
+0, 95, 95, 1, 152064, 0xaef20726
+0, 96, 96, 1, 152064, 0x0d136768
+0, 97, 97, 1, 152064, 0xfe4ed2a8
+0, 98, 98, 1, 152064, 0x5a85524b
+0, 99, 99, 1, 152064, 0x6d495dd2
+0, 100, 100, 1, 152064, 0x04bdb815
+0, 101, 101, 1, 152064, 0x28aae1c5
+0, 102, 102, 1, 152064, 0xc20bc8d9
+0, 103, 103, 1, 152064, 0xa33d9b41
+0, 104, 104, 1, 152064, 0x6269cb43
+0, 105, 105, 1, 152064, 0x4f81d636
+0, 106, 106, 1, 152064, 0xc6062166
+0, 107, 107, 1, 152064, 0xb027fbcc
+0, 108, 108, 1, 152064, 0x73a7a584
+0, 109, 109, 1, 152064, 0xf67e520a
+0, 110, 110, 1, 152064, 0x94eff023
+0, 111, 111, 1, 152064, 0xef1da8e5
+0, 112, 112, 1, 152064, 0x2d9ab411
+0, 113, 113, 1, 152064, 0xf0c39b5d
+0, 114, 114, 1, 152064, 0xb2374724
+0, 115, 115, 1, 152064, 0x939a5243
+0, 116, 116, 1, 152064, 0xee3438db
+0, 117, 117, 1, 152064, 0x7da04012
+0, 118, 118, 1, 152064, 0xac611668
+0, 119, 119, 1, 152064, 0xdce3062e
+0, 120, 120, 1, 152064, 0xb57cc00e
+0, 121, 121, 1, 152064, 0xaf96b59e
+0, 122, 122, 1, 152064, 0x56789c13
+0, 123, 123, 1, 152064, 0xb1f678b5
+0, 124, 124, 1, 152064, 0xb340b8c4
+0, 125, 125, 1, 152064, 0x86e6e304
+0, 126, 126, 1, 152064, 0xa056e037
+0, 127, 127, 1, 152064, 0x16885d27
+0, 128, 128, 1, 152064, 0x9c5ac065
+0, 129, 129, 1, 152064, 0x563d5335
+0, 130, 130, 1, 152064, 0x3ca71c1e
+0, 131, 131, 1, 152064, 0xad34e16c
+0, 132, 132, 1, 152064, 0x6d074b27
+0, 133, 133, 1, 152064, 0x9b1c4909
+0, 134, 134, 1, 152064, 0xdbced198
+0, 135, 135, 1, 152064, 0x8a0ded00
+0, 136, 136, 1, 152064, 0x5ffc209b
+0, 137, 137, 1, 152064, 0x47cfd269
+0, 138, 138, 1, 152064, 0xe3c0137e
+0, 139, 139, 1, 152064, 0xcb6a5e53
+0, 140, 140, 1, 152064, 0x87cec05f
+0, 141, 141, 1, 152064, 0x92721dd2
+0, 142, 142, 1, 152064, 0x3f7d7b3b
+0, 143, 143, 1, 152064, 0xd63ef417
+0, 144, 144, 1, 152064, 0xf8e4b05a
+0, 145, 145, 1, 152064, 0xb5dcb421
+0, 146, 146, 1, 152064, 0x53c96f6a
+0, 147, 147, 1, 152064, 0x24ae98a3
+0, 148, 148, 1, 152064, 0x2e9b5fff
+0, 149, 149, 1, 152064, 0x7795bf12
+0, 150, 150, 1, 152064, 0x499d37ca
+0, 151, 151, 1, 152064, 0xfe478487
+0, 152, 152, 1, 152064, 0xcd661afb
+0, 153, 153, 1, 152064, 0x44f8bf00
+0, 154, 154, 1, 152064, 0x90b67809
+0, 155, 155, 1, 152064, 0x8f5726d1
+0, 156, 156, 1, 152064, 0x2e3c39d5
+0, 157, 157, 1, 152064, 0x4b67c4e6
+0, 158, 158, 1, 152064, 0x9fecb7cf
+0, 159, 159, 1, 152064, 0x207766ea
+0, 160, 160, 1, 152064, 0x5846bf7b
+0, 161, 161, 1, 152064, 0x4237fba1
+0, 162, 162, 1, 152064, 0x983e0cbd
+0, 163, 163, 1, 152064, 0x6be100d1
+0, 164, 164, 1, 152064, 0x9d0beb8f
+0, 165, 165, 1, 152064, 0x234b82e7
+0, 166, 166, 1, 152064, 0x83fb5ef1
+0, 167, 167, 1, 152064, 0xf503dcb2
+0, 168, 168, 1, 152064, 0x031a27f2
+0, 169, 169, 1, 152064, 0x2f1abf24
+0, 170, 170, 1, 152064, 0x54d77010
+0, 171, 171, 1, 152064, 0x049fc0fc
+0, 172, 172, 1, 152064, 0x20f2f7e7
+0, 173, 173, 1, 152064, 0xc0d57467
+0, 174, 174, 1, 152064, 0xbe464eef
+0, 175, 175, 1, 152064, 0x035c9052
+0, 176, 176, 1, 152064, 0x91cba4fb
+0, 177, 177, 1, 152064, 0x11cdbbfb
+0, 178, 178, 1, 152064, 0xe61116d5
+0, 179, 179, 1, 152064, 0x16db46b8
+0, 180, 180, 1, 152064, 0x54f30d9f
+0, 181, 181, 1, 152064, 0x211a8d2d
+0, 182, 182, 1, 152064, 0x5a74a56b
+0, 183, 183, 1, 152064, 0x0ff4ba72
+0, 184, 184, 1, 152064, 0x4c398ad6
+0, 185, 185, 1, 152064, 0x830814f0
+0, 186, 186, 1, 152064, 0xa51f4bab
+0, 187, 187, 1, 152064, 0xf3460de6
+0, 188, 188, 1, 152064, 0x7e1979a1
+0, 189, 189, 1, 152064, 0x4b3ebb3a
+0, 190, 190, 1, 152064, 0x83d1f4f8
+0, 191, 191, 1, 152064, 0xfbf08683
+0, 192, 192, 1, 152064, 0x901c07ec
+0, 193, 193, 1, 152064, 0xbc2dc1c7
+0, 194, 194, 1, 152064, 0x6e646b3b
+0, 195, 195, 1, 152064, 0x51a25aab
+0, 196, 196, 1, 152064, 0xa042ab78
+0, 197, 197, 1, 152064, 0xb972af58
+0, 198, 198, 1, 152064, 0xcdca9568
+0, 199, 199, 1, 152064, 0x17b69d1c
+0, 200, 200, 1, 152064, 0x41c43ea2
+0, 201, 201, 1, 152064, 0x195fc7a0
+0, 202, 202, 1, 152064, 0xf4cec580
+0, 203, 203, 1, 152064, 0xb3b10936
+0, 204, 204, 1, 152064, 0x102bc2ec
+0, 205, 205, 1, 152064, 0xc99d4767
+0, 206, 206, 1, 152064, 0x60c745b0
+0, 207, 207, 1, 152064, 0x8176e0cf
+0, 208, 208, 1, 152064, 0xd47e69b5
+0, 209, 209, 1, 152064, 0xacce674c
+0, 210, 210, 1, 152064, 0x031b51f8
+0, 211, 211, 1, 152064, 0x0eb681ef
+0, 212, 212, 1, 152064, 0x0b69334b
+0, 213, 213, 1, 152064, 0xda819c1f
+0, 214, 214, 1, 152064, 0xa93f62d2
+0, 215, 215, 1, 152064, 0x51374db5
+0, 216, 216, 1, 152064, 0x885dccff
+0, 217, 217, 1, 152064, 0xd0780444
+0, 218, 218, 1, 152064, 0xa31733ca
+0, 219, 219, 1, 152064, 0x3f3de84e
+0, 220, 220, 1, 152064, 0x2af2b2c3
+0, 221, 221, 1, 152064, 0xa62dceae
+0, 222, 222, 1, 152064, 0xca1cffd1
+0, 223, 223, 1, 152064, 0x3c7d561b
+0, 224, 224, 1, 152064, 0xbc04130a
+0, 225, 225, 1, 152064, 0xbd2829ae
+0, 226, 226, 1, 152064, 0xdbbb9820
+0, 227, 227, 1, 152064, 0xfc3ef628
+0, 228, 228, 1, 152064, 0xd5da3ec3
+0, 229, 229, 1, 152064, 0x62d5fcc1
+0, 230, 230, 1, 152064, 0x455a8dae
+0, 231, 231, 1, 152064, 0x421c9147
+0, 232, 232, 1, 152064, 0x6a168484
+0, 233, 233, 1, 152064, 0x7ba15d32
+0, 234, 234, 1, 152064, 0xd089ed27
+0, 235, 235, 1, 152064, 0x8fc4d894
+0, 236, 236, 1, 152064, 0x99e47125
+0, 237, 237, 1, 152064, 0xf55dda68
+0, 238, 238, 1, 152064, 0x6bf06cf1
+0, 239, 239, 1, 152064, 0x7dc41a9d
+0, 240, 240, 1, 152064, 0x78b84019
+0, 241, 241, 1, 152064, 0x85ae8973
+0, 242, 242, 1, 152064, 0x7b7aeabe
+0, 243, 243, 1, 152064, 0xf9a8f6bf
+0, 244, 244, 1, 152064, 0xe195ddcd
+0, 245, 245, 1, 152064, 0x83edffe9
+0, 246, 246, 1, 152064, 0x59cce97a
+0, 247, 247, 1, 152064, 0x15268af1
+0, 248, 248, 1, 152064, 0x270cca95
+0, 249, 249, 1, 152064, 0x8bced1f9
+0, 250, 250, 1, 152064, 0x08ee5cec
+0, 251, 251, 1, 152064, 0x01e74f95
+0, 252, 252, 1, 152064, 0x7e19238f
+0, 253, 253, 1, 152064, 0x6bcb2b9d
+0, 254, 254, 1, 152064, 0x58111385
+0, 255, 255, 1, 152064, 0x6c7aa1f7
+0, 256, 256, 1, 152064, 0xb713a822
+0, 257, 257, 1, 152064, 0x1d645cee
+0, 258, 258, 1, 152064, 0x9c592969
+0, 259, 259, 1, 152064, 0x2472769e
+0, 260, 260, 1, 152064, 0x71b7a5ad
+0, 261, 261, 1, 152064, 0xc6bba1c6
+0, 262, 262, 1, 152064, 0x7351f305
+0, 263, 263, 1, 152064, 0x579edbba
+0, 264, 264, 1, 152064, 0x90eda919
+0, 265, 265, 1, 152064, 0x2833b10d
+0, 266, 266, 1, 152064, 0x4b967d65
+0, 267, 267, 1, 152064, 0x6e7d1702
+0, 268, 268, 1, 152064, 0x59dbcf5b
+0, 269, 269, 1, 152064, 0xa138847b
+0, 270, 270, 1, 152064, 0xb2414e8d
+0, 271, 271, 1, 152064, 0xb90497f6
+0, 272, 272, 1, 152064, 0xcd728159
+0, 273, 273, 1, 152064, 0x005d5bdd
+0, 274, 274, 1, 152064, 0x27c88fb6
+0, 275, 275, 1, 152064, 0x3ccb8a93
+0, 276, 276, 1, 152064, 0xc50256dd
+0, 277, 277, 1, 152064, 0x111e7dee
+0, 278, 278, 1, 152064, 0x259d4a5d
+0, 279, 279, 1, 152064, 0x9385148b
+0, 280, 280, 1, 152064, 0x74002ab0
+0, 281, 281, 1, 152064, 0xd2c74adc
+0, 282, 282, 1, 152064, 0x72854b2a
+0, 283, 283, 1, 152064, 0x638e5c08
+0, 284, 284, 1, 152064, 0x9626bbb3
+0, 285, 285, 1, 152064, 0xc107c18f
+0, 286, 286, 1, 152064, 0x8bd04578
+0, 287, 287, 1, 152064, 0xbcdb6db6
+0, 288, 288, 1, 152064, 0x9d0c81be
+0, 289, 289, 1, 152064, 0xf25106b6
+0, 290, 290, 1, 152064, 0x54c25254
+0, 291, 291, 1, 152064, 0x4bf74663
+0, 292, 292, 1, 152064, 0x0051b054
+0, 293, 293, 1, 152064, 0x5193d3d4
+0, 294, 294, 1, 152064, 0xb5d0d045
+0, 295, 295, 1, 152064, 0x350a31ca
+0, 296, 296, 1, 152064, 0xb8fb7264
+0, 297, 297, 1, 152064, 0x7fb97645
+0, 298, 298, 1, 152064, 0xcd948c41
+0, 299, 299, 1, 152064, 0x38c7570a
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-hpcvfl_bcrm_a b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-hpcvfl_bcrm_a
index a67b4ba..dbfec43 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-hpcvfl_bcrm_a
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-hpcvfl_bcrm_a
@@ -1,300 +1,301 @@
-0, 0, 152064, 0x502ec077
-0, 3600, 152064, 0x84807243
-0, 7200, 152064, 0xd7474a6e
-0, 10800, 152064, 0x793469bb
-0, 14400, 152064, 0xb7a0faf7
-0, 18000, 152064, 0x1d3d3cba
-0, 21600, 152064, 0xb62583de
-0, 25200, 152064, 0xc8422fb1
-0, 28800, 152064, 0x321dc699
-0, 32400, 152064, 0x7a34d350
-0, 36000, 152064, 0xaa4c302d
-0, 39600, 152064, 0x45fa7ab0
-0, 43200, 152064, 0xc7262e41
-0, 46800, 152064, 0x3550000c
-0, 50400, 152064, 0xf4bab54b
-0, 54000, 152064, 0xaccf9c1a
-0, 57600, 152064, 0x9bee20e9
-0, 61200, 152064, 0x47fb7720
-0, 64800, 152064, 0x12c63ffb
-0, 68400, 152064, 0xfa2b8b4d
-0, 72000, 152064, 0x279964bd
-0, 75600, 152064, 0xb8b01c7e
-0, 79200, 152064, 0x816fa010
-0, 82800, 152064, 0x59fe1c8c
-0, 86400, 152064, 0x13393fad
-0, 90000, 152064, 0x991a50a4
-0, 93600, 152064, 0x57df3eb7
-0, 97200, 152064, 0x744371df
-0, 100800, 152064, 0xe9f6d3ff
-0, 104400, 152064, 0xc506fba0
-0, 108000, 152064, 0x6295b90e
-0, 111600, 152064, 0xa19cee2d
-0, 115200, 152064, 0xf8c1b3ca
-0, 118800, 152064, 0x69f68ce0
-0, 122400, 152064, 0x80558bb6
-0, 126000, 152064, 0x27824fa5
-0, 129600, 152064, 0x27c929a1
-0, 133200, 152064, 0xc0fe06d1
-0, 136800, 152064, 0xc52bc58c
-0, 140400, 152064, 0x0a5363c7
-0, 144000, 152064, 0xd0f45a0d
-0, 147600, 152064, 0x274710f9
-0, 151200, 152064, 0x89d2d390
-0, 154800, 152064, 0x12a9bfb0
-0, 158400, 152064, 0x04501a93
-0, 162000, 152064, 0xf92cbbf4
-0, 165600, 152064, 0xf6d1b27d
-0, 169200, 152064, 0xe3e904c3
-0, 172800, 152064, 0x58f8516d
-0, 176400, 152064, 0x70370c2b
-0, 180000, 152064, 0xfeebc88c
-0, 183600, 152064, 0x974c6ed6
-0, 187200, 152064, 0x401bdcf2
-0, 190800, 152064, 0xfe61e278
-0, 194400, 152064, 0x96ba8bb9
-0, 198000, 152064, 0x988492fd
-0, 201600, 152064, 0xd1d913a9
-0, 205200, 152064, 0x6bc46f0e
-0, 208800, 152064, 0x695ef706
-0, 212400, 152064, 0x142045c9
-0, 216000, 152064, 0xb390ed87
-0, 219600, 152064, 0xb9e6d2e5
-0, 223200, 152064, 0xe348797f
-0, 226800, 152064, 0x1cbd29d6
-0, 230400, 152064, 0xbd7dd694
-0, 234000, 152064, 0x516873c3
-0, 237600, 152064, 0x27bba182
-0, 241200, 152064, 0x7541f920
-0, 244800, 152064, 0xfdf67042
-0, 248400, 152064, 0x6c3c7896
-0, 252000, 152064, 0xed86c467
-0, 255600, 152064, 0x4ea83ca2
-0, 259200, 152064, 0xa3e6725b
-0, 262800, 152064, 0x917f5f16
-0, 266400, 152064, 0x8cf2d2e1
-0, 270000, 152064, 0x57a8d116
-0, 273600, 152064, 0x0db267d4
-0, 277200, 152064, 0xce782ac5
-0, 280800, 152064, 0x1c9d8518
-0, 284400, 152064, 0x47598ac7
-0, 288000, 152064, 0xc5033d97
-0, 291600, 152064, 0xd7aaa3a4
-0, 295200, 152064, 0x078afc96
-0, 298800, 152064, 0xc9fe673d
-0, 302400, 152064, 0xe9284066
-0, 306000, 152064, 0xbc570982
-0, 309600, 152064, 0x0aac8574
-0, 313200, 152064, 0x098cbeee
-0, 316800, 152064, 0x19c36a9d
-0, 320400, 152064, 0x8fe4a893
-0, 324000, 152064, 0x0b652f17
-0, 327600, 152064, 0x10f2e6bf
-0, 331200, 152064, 0x7ce5634e
-0, 334800, 152064, 0x8fe4ac6c
-0, 338400, 152064, 0xcaba749e
-0, 342000, 152064, 0x5f8a0d5c
-0, 345600, 152064, 0xcaa66bbc
-0, 349200, 152064, 0xc87ae617
-0, 352800, 152064, 0xe8ef4dd7
-0, 356400, 152064, 0xdfca5a07
-0, 360000, 152064, 0x5f7eab7d
-0, 363600, 152064, 0x8a65ebbb
-0, 367200, 152064, 0x4beab4a0
-0, 370800, 152064, 0xb5e6ab30
-0, 374400, 152064, 0x8fe4f4d4
-0, 378000, 152064, 0x95bde1ca
-0, 381600, 152064, 0xcc5e3a53
-0, 385200, 152064, 0xf09f1dd7
-0, 388800, 152064, 0x10179672
-0, 392400, 152064, 0x4ad16184
-0, 396000, 152064, 0x9efa0e23
-0, 399600, 152064, 0x22f59522
-0, 403200, 152064, 0x4d38f09d
-0, 406800, 152064, 0x4c5ebf56
-0, 410400, 152064, 0xb19d5077
-0, 414000, 152064, 0xa98576b9
-0, 417600, 152064, 0x65324239
-0, 421200, 152064, 0x709e4031
-0, 424800, 152064, 0xf8e81681
-0, 428400, 152064, 0x058514e5
-0, 432000, 152064, 0xd1d1c806
-0, 435600, 152064, 0x0e4dde57
-0, 439200, 152064, 0x49e9c2bb
-0, 442800, 152064, 0x01417ce6
-0, 446400, 152064, 0xda7ebbf1
-0, 450000, 152064, 0xa22906b7
-0, 453600, 152064, 0x32e2df87
-0, 457200, 152064, 0x69917c8f
-0, 460800, 152064, 0xea8ed2cc
-0, 464400, 152064, 0x0b8d57f1
-0, 468000, 152064, 0x5f683bcd
-0, 471600, 152064, 0x5162fe2f
-0, 475200, 152064, 0x49c052f8
-0, 478800, 152064, 0x990b69ba
-0, 482400, 152064, 0xa6d4f99f
-0, 486000, 152064, 0xe79ef4da
-0, 489600, 152064, 0x5e8a3847
-0, 493200, 152064, 0x38b1e75f
-0, 496800, 152064, 0xf5c91bed
-0, 500400, 152064, 0xd59a6d26
-0, 504000, 152064, 0xc361de06
-0, 507600, 152064, 0x63ed2229
-0, 511200, 152064, 0xb8229205
-0, 514800, 152064, 0x7c6619af
-0, 518400, 152064, 0x4126b02f
-0, 522000, 152064, 0x9250b99b
-0, 525600, 152064, 0x589778f9
-0, 529200, 152064, 0xed1fa45b
-0, 532800, 152064, 0x700b6f32
-0, 536400, 152064, 0x0590df55
-0, 540000, 152064, 0x3e9c4018
-0, 543600, 152064, 0x957b8860
-0, 547200, 152064, 0x56161560
-0, 550800, 152064, 0xbc43bc3b
-0, 554400, 152064, 0x508d8632
-0, 558000, 152064, 0xbc5736d8
-0, 561600, 152064, 0xed7d3aef
-0, 565200, 152064, 0x1dcdda9f
-0, 568800, 152064, 0x8ef6d5c9
-0, 572400, 152064, 0x15466acc
-0, 576000, 152064, 0x45d4cf67
-0, 579600, 152064, 0x8c900b9d
-0, 583200, 152064, 0x747006e0
-0, 586800, 152064, 0xac920a0c
-0, 590400, 152064, 0xb8210c27
-0, 594000, 152064, 0x7dbb873a
-0, 597600, 152064, 0x0d4d7584
-0, 601200, 152064, 0xefb3fe60
-0, 604800, 152064, 0x905e2644
-0, 608400, 152064, 0x7c04e534
-0, 612000, 152064, 0x8889972a
-0, 615600, 152064, 0x21c7d8ad
-0, 619200, 152064, 0x1c641176
-0, 622800, 152064, 0xf71489a4
-0, 626400, 152064, 0xd7ac5555
-0, 630000, 152064, 0xb4609c6d
-0, 633600, 152064, 0xf5b2bd5e
-0, 637200, 152064, 0x9f43ce57
-0, 640800, 152064, 0x77642dd3
-0, 644400, 152064, 0x3e79565c
-0, 648000, 152064, 0x95f40b8e
-0, 651600, 152064, 0x3c8ca4d4
-0, 655200, 152064, 0xa02ac497
-0, 658800, 152064, 0x4c93b377
-0, 662400, 152064, 0x55f5ac68
-0, 666000, 152064, 0xf8652eca
-0, 669600, 152064, 0x56e94574
-0, 673200, 152064, 0x6d8302e1
-0, 676800, 152064, 0x29a57061
-0, 680400, 152064, 0x24e4cfdc
-0, 684000, 152064, 0xf5a5d62a
-0, 687600, 152064, 0x998870c1
-0, 691200, 152064, 0xa15b1f4e
-0, 694800, 152064, 0xb0ccb51f
-0, 698400, 152064, 0xeaaf59ab
-0, 702000, 152064, 0x7e2b4fe6
-0, 705600, 152064, 0x72299fea
-0, 709200, 152064, 0x769da8b2
-0, 712800, 152064, 0xefad7ef8
-0, 716400, 152064, 0x24819983
-0, 720000, 152064, 0x2aad32ab
-0, 723600, 152064, 0xc80cac79
-0, 727200, 152064, 0x1659d628
-0, 730800, 152064, 0xef941f66
-0, 734400, 152064, 0x0d7fcdb5
-0, 738000, 152064, 0x7c1853fa
-0, 741600, 152064, 0xb94c4d3c
-0, 745200, 152064, 0xc47adfc2
-0, 748800, 152064, 0x366a6729
-0, 752400, 152064, 0x7eb37b70
-0, 756000, 152064, 0xafd54c27
-0, 759600, 152064, 0x67b18636
-0, 763200, 152064, 0x93b22dcf
-0, 766800, 152064, 0xa64991f1
-0, 770400, 152064, 0xd32a7102
-0, 774000, 152064, 0xff665d1c
-0, 777600, 152064, 0xf107cc31
-0, 781200, 152064, 0xf5b25652
-0, 784800, 152064, 0x8caf783d
-0, 788400, 152064, 0x72f3eb00
-0, 792000, 152064, 0xb5aea5f8
-0, 795600, 152064, 0xee70e870
-0, 799200, 152064, 0x7c3a0156
-0, 802800, 152064, 0x871b6383
-0, 806400, 152064, 0x48d831ff
-0, 810000, 152064, 0xca233913
-0, 813600, 152064, 0xe14bc5eb
-0, 817200, 152064, 0x9b1d27e7
-0, 820800, 152064, 0xfb9637f7
-0, 824400, 152064, 0x0c022157
-0, 828000, 152064, 0x16d35fc9
-0, 831600, 152064, 0x6d935f71
-0, 835200, 152064, 0xae4066fa
-0, 838800, 152064, 0xcef94fdc
-0, 842400, 152064, 0xc234edb9
-0, 846000, 152064, 0x26a4f2e2
-0, 849600, 152064, 0xd29ac23e
-0, 853200, 152064, 0xb7604395
-0, 856800, 152064, 0x408084f6
-0, 860400, 152064, 0x0a02026c
-0, 864000, 152064, 0x78b33c7c
-0, 867600, 152064, 0xcb02b874
-0, 871200, 152064, 0xf566513b
-0, 874800, 152064, 0xb34e52b1
-0, 878400, 152064, 0xf55ff493
-0, 882000, 152064, 0xb0e8282a
-0, 885600, 152064, 0xe9510bbe
-0, 889200, 152064, 0x292e8c5a
-0, 892800, 152064, 0x62b9d2b0
-0, 896400, 152064, 0x3a8cc827
-0, 900000, 152064, 0x25cc465e
-0, 903600, 152064, 0xf2bc32e2
-0, 907200, 152064, 0x6141f914
-0, 910800, 152064, 0x1171256f
-0, 914400, 152064, 0x13cb2ded
-0, 918000, 152064, 0x3d4ca557
-0, 921600, 152064, 0xf2b9e72e
-0, 925200, 152064, 0x03f7547a
-0, 928800, 152064, 0xc7302955
-0, 932400, 152064, 0xe78a46d3
-0, 936000, 152064, 0x3726a270
-0, 939600, 152064, 0x2f65722a
-0, 943200, 152064, 0x55acce40
-0, 946800, 152064, 0xf6fa9db2
-0, 950400, 152064, 0x70a36937
-0, 954000, 152064, 0x9313742d
-0, 957600, 152064, 0x2eb14e53
-0, 961200, 152064, 0x3d47c9c3
-0, 964800, 152064, 0xd0a90348
-0, 968400, 152064, 0x6ad48088
-0, 972000, 152064, 0x68e64738
-0, 975600, 152064, 0x04c3735a
-0, 979200, 152064, 0x51d0593f
-0, 982800, 152064, 0x42cf2b48
-0, 986400, 152064, 0xa5496a0c
-0, 990000, 152064, 0x84c25549
-0, 993600, 152064, 0x96691600
-0, 997200, 152064, 0x423135db
-0, 1000800, 152064, 0x8d2e08b6
-0, 1004400, 152064, 0xaeb4c840
-0, 1008000, 152064, 0xf3e71780
-0, 1011600, 152064, 0x8858228b
-0, 1015200, 152064, 0xf28613f8
-0, 1018800, 152064, 0xb5327882
-0, 1022400, 152064, 0xbb60bb85
-0, 1026000, 152064, 0x345ab1c9
-0, 1029600, 152064, 0x8aac2cba
-0, 1033200, 152064, 0x7ce15b4c
-0, 1036800, 152064, 0xc09c55c0
-0, 1040400, 152064, 0x8482ddd6
-0, 1044000, 152064, 0xab222a13
-0, 1047600, 152064, 0xd39b0dea
-0, 1051200, 152064, 0x6dab6e06
-0, 1054800, 152064, 0xec0891bd
-0, 1058400, 152064, 0x88bd9701
-0, 1062000, 152064, 0xdf13072a
-0, 1065600, 152064, 0x23b33081
-0, 1069200, 152064, 0x63943137
-0, 1072800, 152064, 0xab6a9052
-0, 1076400, 152064, 0x05485494
+#tb 0: 1/25
+0, 0, 0, 1, 152064, 0x502ec077
+0, 1, 1, 1, 152064, 0x84807243
+0, 2, 2, 1, 152064, 0xd7474a6e
+0, 3, 3, 1, 152064, 0x793469bb
+0, 4, 4, 1, 152064, 0xb7a0faf7
+0, 5, 5, 1, 152064, 0x1d3d3cba
+0, 6, 6, 1, 152064, 0xb62583de
+0, 7, 7, 1, 152064, 0xc8422fb1
+0, 8, 8, 1, 152064, 0x321dc699
+0, 9, 9, 1, 152064, 0x7a34d350
+0, 10, 10, 1, 152064, 0xaa4c302d
+0, 11, 11, 1, 152064, 0x45fa7ab0
+0, 12, 12, 1, 152064, 0xc7262e41
+0, 13, 13, 1, 152064, 0x3550000c
+0, 14, 14, 1, 152064, 0xf4bab54b
+0, 15, 15, 1, 152064, 0xaccf9c1a
+0, 16, 16, 1, 152064, 0x9bee20e9
+0, 17, 17, 1, 152064, 0x47fb7720
+0, 18, 18, 1, 152064, 0x12c63ffb
+0, 19, 19, 1, 152064, 0xfa2b8b4d
+0, 20, 20, 1, 152064, 0x279964bd
+0, 21, 21, 1, 152064, 0xb8b01c7e
+0, 22, 22, 1, 152064, 0x816fa010
+0, 23, 23, 1, 152064, 0x59fe1c8c
+0, 24, 24, 1, 152064, 0x13393fad
+0, 25, 25, 1, 152064, 0x991a50a4
+0, 26, 26, 1, 152064, 0x57df3eb7
+0, 27, 27, 1, 152064, 0x744371df
+0, 28, 28, 1, 152064, 0xe9f6d3ff
+0, 29, 29, 1, 152064, 0xc506fba0
+0, 30, 30, 1, 152064, 0x6295b90e
+0, 31, 31, 1, 152064, 0xa19cee2d
+0, 32, 32, 1, 152064, 0xf8c1b3ca
+0, 33, 33, 1, 152064, 0x69f68ce0
+0, 34, 34, 1, 152064, 0x80558bb6
+0, 35, 35, 1, 152064, 0x27824fa5
+0, 36, 36, 1, 152064, 0x27c929a1
+0, 37, 37, 1, 152064, 0xc0fe06d1
+0, 38, 38, 1, 152064, 0xc52bc58c
+0, 39, 39, 1, 152064, 0x0a5363c7
+0, 40, 40, 1, 152064, 0xd0f45a0d
+0, 41, 41, 1, 152064, 0x274710f9
+0, 42, 42, 1, 152064, 0x89d2d390
+0, 43, 43, 1, 152064, 0x12a9bfb0
+0, 44, 44, 1, 152064, 0x04501a93
+0, 45, 45, 1, 152064, 0xf92cbbf4
+0, 46, 46, 1, 152064, 0xf6d1b27d
+0, 47, 47, 1, 152064, 0xe3e904c3
+0, 48, 48, 1, 152064, 0x58f8516d
+0, 49, 49, 1, 152064, 0x70370c2b
+0, 50, 50, 1, 152064, 0xfeebc88c
+0, 51, 51, 1, 152064, 0x974c6ed6
+0, 52, 52, 1, 152064, 0x401bdcf2
+0, 53, 53, 1, 152064, 0xfe61e278
+0, 54, 54, 1, 152064, 0x96ba8bb9
+0, 55, 55, 1, 152064, 0x988492fd
+0, 56, 56, 1, 152064, 0xd1d913a9
+0, 57, 57, 1, 152064, 0x6bc46f0e
+0, 58, 58, 1, 152064, 0x695ef706
+0, 59, 59, 1, 152064, 0x142045c9
+0, 60, 60, 1, 152064, 0xb390ed87
+0, 61, 61, 1, 152064, 0xb9e6d2e5
+0, 62, 62, 1, 152064, 0xe348797f
+0, 63, 63, 1, 152064, 0x1cbd29d6
+0, 64, 64, 1, 152064, 0xbd7dd694
+0, 65, 65, 1, 152064, 0x516873c3
+0, 66, 66, 1, 152064, 0x27bba182
+0, 67, 67, 1, 152064, 0x7541f920
+0, 68, 68, 1, 152064, 0xfdf67042
+0, 69, 69, 1, 152064, 0x6c3c7896
+0, 70, 70, 1, 152064, 0xed86c467
+0, 71, 71, 1, 152064, 0x4ea83ca2
+0, 72, 72, 1, 152064, 0xa3e6725b
+0, 73, 73, 1, 152064, 0x917f5f16
+0, 74, 74, 1, 152064, 0x8cf2d2e1
+0, 75, 75, 1, 152064, 0x57a8d116
+0, 76, 76, 1, 152064, 0x0db267d4
+0, 77, 77, 1, 152064, 0xce782ac5
+0, 78, 78, 1, 152064, 0x1c9d8518
+0, 79, 79, 1, 152064, 0x47598ac7
+0, 80, 80, 1, 152064, 0xc5033d97
+0, 81, 81, 1, 152064, 0xd7aaa3a4
+0, 82, 82, 1, 152064, 0x078afc96
+0, 83, 83, 1, 152064, 0xc9fe673d
+0, 84, 84, 1, 152064, 0xe9284066
+0, 85, 85, 1, 152064, 0xbc570982
+0, 86, 86, 1, 152064, 0x0aac8574
+0, 87, 87, 1, 152064, 0x098cbeee
+0, 88, 88, 1, 152064, 0x19c36a9d
+0, 89, 89, 1, 152064, 0x8fe4a893
+0, 90, 90, 1, 152064, 0x0b652f17
+0, 91, 91, 1, 152064, 0x10f2e6bf
+0, 92, 92, 1, 152064, 0x7ce5634e
+0, 93, 93, 1, 152064, 0x8fe4ac6c
+0, 94, 94, 1, 152064, 0xcaba749e
+0, 95, 95, 1, 152064, 0x5f8a0d5c
+0, 96, 96, 1, 152064, 0xcaa66bbc
+0, 97, 97, 1, 152064, 0xc87ae617
+0, 98, 98, 1, 152064, 0xe8ef4dd7
+0, 99, 99, 1, 152064, 0xdfca5a07
+0, 100, 100, 1, 152064, 0x5f7eab7d
+0, 101, 101, 1, 152064, 0x8a65ebbb
+0, 102, 102, 1, 152064, 0x4beab4a0
+0, 103, 103, 1, 152064, 0xb5e6ab30
+0, 104, 104, 1, 152064, 0x8fe4f4d4
+0, 105, 105, 1, 152064, 0x95bde1ca
+0, 106, 106, 1, 152064, 0xcc5e3a53
+0, 107, 107, 1, 152064, 0xf09f1dd7
+0, 108, 108, 1, 152064, 0x10179672
+0, 109, 109, 1, 152064, 0x4ad16184
+0, 110, 110, 1, 152064, 0x9efa0e23
+0, 111, 111, 1, 152064, 0x22f59522
+0, 112, 112, 1, 152064, 0x4d38f09d
+0, 113, 113, 1, 152064, 0x4c5ebf56
+0, 114, 114, 1, 152064, 0xb19d5077
+0, 115, 115, 1, 152064, 0xa98576b9
+0, 116, 116, 1, 152064, 0x65324239
+0, 117, 117, 1, 152064, 0x709e4031
+0, 118, 118, 1, 152064, 0xf8e81681
+0, 119, 119, 1, 152064, 0x058514e5
+0, 120, 120, 1, 152064, 0xd1d1c806
+0, 121, 121, 1, 152064, 0x0e4dde57
+0, 122, 122, 1, 152064, 0x49e9c2bb
+0, 123, 123, 1, 152064, 0x01417ce6
+0, 124, 124, 1, 152064, 0xda7ebbf1
+0, 125, 125, 1, 152064, 0xa22906b7
+0, 126, 126, 1, 152064, 0x32e2df87
+0, 127, 127, 1, 152064, 0x69917c8f
+0, 128, 128, 1, 152064, 0xea8ed2cc
+0, 129, 129, 1, 152064, 0x0b8d57f1
+0, 130, 130, 1, 152064, 0x5f683bcd
+0, 131, 131, 1, 152064, 0x5162fe2f
+0, 132, 132, 1, 152064, 0x49c052f8
+0, 133, 133, 1, 152064, 0x990b69ba
+0, 134, 134, 1, 152064, 0xa6d4f99f
+0, 135, 135, 1, 152064, 0xe79ef4da
+0, 136, 136, 1, 152064, 0x5e8a3847
+0, 137, 137, 1, 152064, 0x38b1e75f
+0, 138, 138, 1, 152064, 0xf5c91bed
+0, 139, 139, 1, 152064, 0xd59a6d26
+0, 140, 140, 1, 152064, 0xc361de06
+0, 141, 141, 1, 152064, 0x63ed2229
+0, 142, 142, 1, 152064, 0xb8229205
+0, 143, 143, 1, 152064, 0x7c6619af
+0, 144, 144, 1, 152064, 0x4126b02f
+0, 145, 145, 1, 152064, 0x9250b99b
+0, 146, 146, 1, 152064, 0x589778f9
+0, 147, 147, 1, 152064, 0xed1fa45b
+0, 148, 148, 1, 152064, 0x700b6f32
+0, 149, 149, 1, 152064, 0x0590df55
+0, 150, 150, 1, 152064, 0x3e9c4018
+0, 151, 151, 1, 152064, 0x957b8860
+0, 152, 152, 1, 152064, 0x56161560
+0, 153, 153, 1, 152064, 0xbc43bc3b
+0, 154, 154, 1, 152064, 0x508d8632
+0, 155, 155, 1, 152064, 0xbc5736d8
+0, 156, 156, 1, 152064, 0xed7d3aef
+0, 157, 157, 1, 152064, 0x1dcdda9f
+0, 158, 158, 1, 152064, 0x8ef6d5c9
+0, 159, 159, 1, 152064, 0x15466acc
+0, 160, 160, 1, 152064, 0x45d4cf67
+0, 161, 161, 1, 152064, 0x8c900b9d
+0, 162, 162, 1, 152064, 0x747006e0
+0, 163, 163, 1, 152064, 0xac920a0c
+0, 164, 164, 1, 152064, 0xb8210c27
+0, 165, 165, 1, 152064, 0x7dbb873a
+0, 166, 166, 1, 152064, 0x0d4d7584
+0, 167, 167, 1, 152064, 0xefb3fe60
+0, 168, 168, 1, 152064, 0x905e2644
+0, 169, 169, 1, 152064, 0x7c04e534
+0, 170, 170, 1, 152064, 0x8889972a
+0, 171, 171, 1, 152064, 0x21c7d8ad
+0, 172, 172, 1, 152064, 0x1c641176
+0, 173, 173, 1, 152064, 0xf71489a4
+0, 174, 174, 1, 152064, 0xd7ac5555
+0, 175, 175, 1, 152064, 0xb4609c6d
+0, 176, 176, 1, 152064, 0xf5b2bd5e
+0, 177, 177, 1, 152064, 0x9f43ce57
+0, 178, 178, 1, 152064, 0x77642dd3
+0, 179, 179, 1, 152064, 0x3e79565c
+0, 180, 180, 1, 152064, 0x95f40b8e
+0, 181, 181, 1, 152064, 0x3c8ca4d4
+0, 182, 182, 1, 152064, 0xa02ac497
+0, 183, 183, 1, 152064, 0x4c93b377
+0, 184, 184, 1, 152064, 0x55f5ac68
+0, 185, 185, 1, 152064, 0xf8652eca
+0, 186, 186, 1, 152064, 0x56e94574
+0, 187, 187, 1, 152064, 0x6d8302e1
+0, 188, 188, 1, 152064, 0x29a57061
+0, 189, 189, 1, 152064, 0x24e4cfdc
+0, 190, 190, 1, 152064, 0xf5a5d62a
+0, 191, 191, 1, 152064, 0x998870c1
+0, 192, 192, 1, 152064, 0xa15b1f4e
+0, 193, 193, 1, 152064, 0xb0ccb51f
+0, 194, 194, 1, 152064, 0xeaaf59ab
+0, 195, 195, 1, 152064, 0x7e2b4fe6
+0, 196, 196, 1, 152064, 0x72299fea
+0, 197, 197, 1, 152064, 0x769da8b2
+0, 198, 198, 1, 152064, 0xefad7ef8
+0, 199, 199, 1, 152064, 0x24819983
+0, 200, 200, 1, 152064, 0x2aad32ab
+0, 201, 201, 1, 152064, 0xc80cac79
+0, 202, 202, 1, 152064, 0x1659d628
+0, 203, 203, 1, 152064, 0xef941f66
+0, 204, 204, 1, 152064, 0x0d7fcdb5
+0, 205, 205, 1, 152064, 0x7c1853fa
+0, 206, 206, 1, 152064, 0xb94c4d3c
+0, 207, 207, 1, 152064, 0xc47adfc2
+0, 208, 208, 1, 152064, 0x366a6729
+0, 209, 209, 1, 152064, 0x7eb37b70
+0, 210, 210, 1, 152064, 0xafd54c27
+0, 211, 211, 1, 152064, 0x67b18636
+0, 212, 212, 1, 152064, 0x93b22dcf
+0, 213, 213, 1, 152064, 0xa64991f1
+0, 214, 214, 1, 152064, 0xd32a7102
+0, 215, 215, 1, 152064, 0xff665d1c
+0, 216, 216, 1, 152064, 0xf107cc31
+0, 217, 217, 1, 152064, 0xf5b25652
+0, 218, 218, 1, 152064, 0x8caf783d
+0, 219, 219, 1, 152064, 0x72f3eb00
+0, 220, 220, 1, 152064, 0xb5aea5f8
+0, 221, 221, 1, 152064, 0xee70e870
+0, 222, 222, 1, 152064, 0x7c3a0156
+0, 223, 223, 1, 152064, 0x871b6383
+0, 224, 224, 1, 152064, 0x48d831ff
+0, 225, 225, 1, 152064, 0xca233913
+0, 226, 226, 1, 152064, 0xe14bc5eb
+0, 227, 227, 1, 152064, 0x9b1d27e7
+0, 228, 228, 1, 152064, 0xfb9637f7
+0, 229, 229, 1, 152064, 0x0c022157
+0, 230, 230, 1, 152064, 0x16d35fc9
+0, 231, 231, 1, 152064, 0x6d935f71
+0, 232, 232, 1, 152064, 0xae4066fa
+0, 233, 233, 1, 152064, 0xcef94fdc
+0, 234, 234, 1, 152064, 0xc234edb9
+0, 235, 235, 1, 152064, 0x26a4f2e2
+0, 236, 236, 1, 152064, 0xd29ac23e
+0, 237, 237, 1, 152064, 0xb7604395
+0, 238, 238, 1, 152064, 0x408084f6
+0, 239, 239, 1, 152064, 0x0a02026c
+0, 240, 240, 1, 152064, 0x78b33c7c
+0, 241, 241, 1, 152064, 0xcb02b874
+0, 242, 242, 1, 152064, 0xf566513b
+0, 243, 243, 1, 152064, 0xb34e52b1
+0, 244, 244, 1, 152064, 0xf55ff493
+0, 245, 245, 1, 152064, 0xb0e8282a
+0, 246, 246, 1, 152064, 0xe9510bbe
+0, 247, 247, 1, 152064, 0x292e8c5a
+0, 248, 248, 1, 152064, 0x62b9d2b0
+0, 249, 249, 1, 152064, 0x3a8cc827
+0, 250, 250, 1, 152064, 0x25cc465e
+0, 251, 251, 1, 152064, 0xf2bc32e2
+0, 252, 252, 1, 152064, 0x6141f914
+0, 253, 253, 1, 152064, 0x1171256f
+0, 254, 254, 1, 152064, 0x13cb2ded
+0, 255, 255, 1, 152064, 0x3d4ca557
+0, 256, 256, 1, 152064, 0xf2b9e72e
+0, 257, 257, 1, 152064, 0x03f7547a
+0, 258, 258, 1, 152064, 0xc7302955
+0, 259, 259, 1, 152064, 0xe78a46d3
+0, 260, 260, 1, 152064, 0x3726a270
+0, 261, 261, 1, 152064, 0x2f65722a
+0, 262, 262, 1, 152064, 0x55acce40
+0, 263, 263, 1, 152064, 0xf6fa9db2
+0, 264, 264, 1, 152064, 0x70a36937
+0, 265, 265, 1, 152064, 0x9313742d
+0, 266, 266, 1, 152064, 0x2eb14e53
+0, 267, 267, 1, 152064, 0x3d47c9c3
+0, 268, 268, 1, 152064, 0xd0a90348
+0, 269, 269, 1, 152064, 0x6ad48088
+0, 270, 270, 1, 152064, 0x68e64738
+0, 271, 271, 1, 152064, 0x04c3735a
+0, 272, 272, 1, 152064, 0x51d0593f
+0, 273, 273, 1, 152064, 0x42cf2b48
+0, 274, 274, 1, 152064, 0xa5496a0c
+0, 275, 275, 1, 152064, 0x84c25549
+0, 276, 276, 1, 152064, 0x96691600
+0, 277, 277, 1, 152064, 0x423135db
+0, 278, 278, 1, 152064, 0x8d2e08b6
+0, 279, 279, 1, 152064, 0xaeb4c840
+0, 280, 280, 1, 152064, 0xf3e71780
+0, 281, 281, 1, 152064, 0x8858228b
+0, 282, 282, 1, 152064, 0xf28613f8
+0, 283, 283, 1, 152064, 0xb5327882
+0, 284, 284, 1, 152064, 0xbb60bb85
+0, 285, 285, 1, 152064, 0x345ab1c9
+0, 286, 286, 1, 152064, 0x8aac2cba
+0, 287, 287, 1, 152064, 0x7ce15b4c
+0, 288, 288, 1, 152064, 0xc09c55c0
+0, 289, 289, 1, 152064, 0x8482ddd6
+0, 290, 290, 1, 152064, 0xab222a13
+0, 291, 291, 1, 152064, 0xd39b0dea
+0, 292, 292, 1, 152064, 0x6dab6e06
+0, 293, 293, 1, 152064, 0xec0891bd
+0, 294, 294, 1, 152064, 0x88bd9701
+0, 295, 295, 1, 152064, 0xdf13072a
+0, 296, 296, 1, 152064, 0x23b33081
+0, 297, 297, 1, 152064, 0x63943137
+0, 298, 298, 1, 152064, 0xab6a9052
+0, 299, 299, 1, 152064, 0x05485494
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-hpcvflnl_bcrm_a b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-hpcvflnl_bcrm_a
index 97d7677..65a366e 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-hpcvflnl_bcrm_a
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-hpcvflnl_bcrm_a
@@ -1,300 +1,301 @@
-0, 0, 152064, 0x3e39c08b
-0, 3600, 152064, 0xabc67990
-0, 7200, 152064, 0x19614e74
-0, 10800, 152064, 0xa3776beb
-0, 14400, 152064, 0xcce6ffdf
-0, 18000, 152064, 0xb0e94746
-0, 21600, 152064, 0xdb1a84ef
-0, 25200, 152064, 0xb2624509
-0, 28800, 152064, 0x32e2d826
-0, 32400, 152064, 0xb3bddf0b
-0, 36000, 152064, 0x2e273ce3
-0, 39600, 152064, 0x67af7e4d
-0, 43200, 152064, 0x505c3261
-0, 46800, 152064, 0xa43d015e
-0, 50400, 152064, 0xad41c1f6
-0, 54000, 152064, 0x633ba55f
-0, 57600, 152064, 0xe80634f0
-0, 61200, 152064, 0x80a07dc9
-0, 64800, 152064, 0x0e7a3bbf
-0, 68400, 152064, 0xcb099196
-0, 72000, 152064, 0x57c96db5
-0, 75600, 152064, 0xccd422fa
-0, 79200, 152064, 0x0850b7a7
-0, 82800, 152064, 0x30e33156
-0, 86400, 152064, 0x34e13f9a
-0, 90000, 152064, 0x03d36000
-0, 93600, 152064, 0xbf7d49da
-0, 97200, 152064, 0x77336d09
-0, 100800, 152064, 0xca8be5a9
-0, 104400, 152064, 0xe57c0b08
-0, 108000, 152064, 0xbe77c093
-0, 111600, 152064, 0x6bf1ff05
-0, 115200, 152064, 0x9142babf
-0, 118800, 152064, 0x08db8e67
-0, 122400, 152064, 0x69ac8cb6
-0, 126000, 152064, 0xaa3b5c88
-0, 129600, 152064, 0x9bd32638
-0, 133200, 152064, 0x7972115a
-0, 136800, 152064, 0x5c1dd47b
-0, 140400, 152064, 0x8a196e02
-0, 144000, 152064, 0xa89672bc
-0, 147600, 152064, 0x27b220e4
-0, 151200, 152064, 0xfa38dc4a
-0, 154800, 152064, 0x4784c639
-0, 158400, 152064, 0xa5e4229a
-0, 162000, 152064, 0xa986bdfc
-0, 165600, 152064, 0x2951b47b
-0, 169200, 152064, 0x4df404a6
-0, 172800, 152064, 0xc75155e8
-0, 176400, 152064, 0xfc05248c
-0, 180000, 152064, 0x5d53da10
-0, 183600, 152064, 0x284376ec
-0, 187200, 152064, 0x19fce380
-0, 190800, 152064, 0x876be6c9
-0, 194400, 152064, 0x39eb8ff9
-0, 198000, 152064, 0x289c9543
-0, 201600, 152064, 0x24dd2356
-0, 205200, 152064, 0x1dc17d3c
-0, 208800, 152064, 0xd17c00ac
-0, 212400, 152064, 0xc2ad54de
-0, 216000, 152064, 0xbe11ee2f
-0, 219600, 152064, 0x3db9dc89
-0, 223200, 152064, 0xac0d7bc2
-0, 226800, 152064, 0x8dab2dde
-0, 230400, 152064, 0x566ad225
-0, 234000, 152064, 0x587c7853
-0, 237600, 152064, 0x601c9c80
-0, 241200, 152064, 0x2afaf751
-0, 244800, 152064, 0x1c9f7e3a
-0, 248400, 152064, 0x899475bf
-0, 252000, 152064, 0x0d65c7d9
-0, 255600, 152064, 0xafd63d12
-0, 259200, 152064, 0x162e62b9
-0, 262800, 152064, 0x5c9554be
-0, 266400, 152064, 0x35fbdaa2
-0, 270000, 152064, 0x6438cbd8
-0, 273600, 152064, 0xde0772c9
-0, 277200, 152064, 0x79f82854
-0, 280800, 152064, 0x86957840
-0, 284400, 152064, 0xd9468cbf
-0, 288000, 152064, 0x23e74609
-0, 291600, 152064, 0x3919a146
-0, 295200, 152064, 0xd641078b
-0, 298800, 152064, 0x24397220
-0, 302400, 152064, 0xe7fc3a7c
-0, 306000, 152064, 0x3997154a
-0, 309600, 152064, 0x2af3952c
-0, 313200, 152064, 0x274ac07a
-0, 316800, 152064, 0x288f7b09
-0, 320400, 152064, 0xe6f9b022
-0, 324000, 152064, 0xf09e2fbb
-0, 327600, 152064, 0x7244e477
-0, 331200, 152064, 0x0dfc72eb
-0, 334800, 152064, 0x0322b21f
-0, 338400, 152064, 0x18b08205
-0, 342000, 152064, 0x6606153e
-0, 345600, 152064, 0x85186272
-0, 349200, 152064, 0x3369f064
-0, 352800, 152064, 0xbe0d5a44
-0, 356400, 152064, 0x320258bb
-0, 360000, 152064, 0x4d6fb091
-0, 363600, 152064, 0xc9bbf5e7
-0, 367200, 152064, 0x0aa1b69b
-0, 370800, 152064, 0x85b9ac11
-0, 374400, 152064, 0xb25ff818
-0, 378000, 152064, 0xa155dc25
-0, 381600, 152064, 0xa8e03bfd
-0, 385200, 152064, 0x0a862956
-0, 388800, 152064, 0x11b49264
-0, 392400, 152064, 0xa94e664e
-0, 396000, 152064, 0x330e0fa2
-0, 399600, 152064, 0xaf3d9518
-0, 403200, 152064, 0x0836f2e8
-0, 406800, 152064, 0xbf6dc578
-0, 410400, 152064, 0x7b524d20
-0, 414000, 152064, 0x9ef7677f
-0, 417600, 152064, 0xeacf3f34
-0, 421200, 152064, 0xfb4e3dbe
-0, 424800, 152064, 0xb46e25cb
-0, 428400, 152064, 0x363c1603
-0, 432000, 152064, 0x263fc542
-0, 435600, 152064, 0xf106e548
-0, 439200, 152064, 0xde43c56a
-0, 442800, 152064, 0xc2c4770a
-0, 446400, 152064, 0x122fce19
-0, 450000, 152064, 0x3ba01434
-0, 453600, 152064, 0x0e8ce5ee
-0, 457200, 152064, 0x6ceb82e1
-0, 460800, 152064, 0xa23ee21c
-0, 464400, 152064, 0xc6d960f9
-0, 468000, 152064, 0x0de15258
-0, 471600, 152064, 0x187b0333
-0, 475200, 152064, 0x92e6582f
-0, 478800, 152064, 0xb9586ce0
-0, 482400, 152064, 0xefd803b5
-0, 486000, 152064, 0x24eafb29
-0, 489600, 152064, 0x20c73b14
-0, 493200, 152064, 0xbd7ceaaa
-0, 496800, 152064, 0x775216c8
-0, 500400, 152064, 0xa08971c7
-0, 504000, 152064, 0xef0ee865
-0, 507600, 152064, 0x9ac61c2f
-0, 511200, 152064, 0x52ae8ea9
-0, 514800, 152064, 0x06571c14
-0, 518400, 152064, 0x6e78ad33
-0, 522000, 152064, 0xad01c627
-0, 525600, 152064, 0xbfe074d3
-0, 529200, 152064, 0x9357a183
-0, 532800, 152064, 0x8de7767f
-0, 536400, 152064, 0xa5e6e76e
-0, 540000, 152064, 0xa6f646fe
-0, 543600, 152064, 0x132e99f8
-0, 547200, 152064, 0xb79f27de
-0, 550800, 152064, 0x36d3cdcf
-0, 554400, 152064, 0xdc938336
-0, 558000, 152064, 0xacaa3a7f
-0, 561600, 152064, 0xc61a37fd
-0, 565200, 152064, 0x4fe1ddf0
-0, 568800, 152064, 0xc0f7d660
-0, 572400, 152064, 0xd72458ea
-0, 576000, 152064, 0x6978d123
-0, 579600, 152064, 0x64e60ccf
-0, 583200, 152064, 0xaa07004c
-0, 586800, 152064, 0x07cd1064
-0, 590400, 152064, 0xa82320e5
-0, 594000, 152064, 0xaedd8d30
-0, 597600, 152064, 0x79b082ea
-0, 601200, 152064, 0x9ed800ab
-0, 604800, 152064, 0xde592bb4
-0, 608400, 152064, 0xd966df88
-0, 612000, 152064, 0xf921988a
-0, 615600, 152064, 0x557ad9ae
-0, 619200, 152064, 0xc3f31a9a
-0, 622800, 152064, 0x65248561
-0, 626400, 152064, 0x63df4aa6
-0, 630000, 152064, 0x618da0a9
-0, 633600, 152064, 0xe6f1c435
-0, 637200, 152064, 0x9f90c38f
-0, 640800, 152064, 0xd2853e14
-0, 644400, 152064, 0x6e0268a9
-0, 648000, 152064, 0x393712d1
-0, 651600, 152064, 0x470da25f
-0, 655200, 152064, 0xaf55cb3d
-0, 658800, 152064, 0x6935b8b9
-0, 662400, 152064, 0x5409a15f
-0, 666000, 152064, 0x09073fee
-0, 669600, 152064, 0xfb274e82
-0, 673200, 152064, 0x1a770581
-0, 676800, 152064, 0x17277d0d
-0, 680400, 152064, 0xd4dcd982
-0, 684000, 152064, 0x6b04eaf3
-0, 687600, 152064, 0x8a3d822e
-0, 691200, 152064, 0x1b971ec9
-0, 694800, 152064, 0x14e0c0f6
-0, 698400, 152064, 0x00667450
-0, 702000, 152064, 0xd2385902
-0, 705600, 152064, 0x905da6ab
-0, 709200, 152064, 0xa3ffb18b
-0, 712800, 152064, 0x10d48b19
-0, 716400, 152064, 0xb2c7a3bd
-0, 720000, 152064, 0x45593e96
-0, 723600, 152064, 0x47a0b60c
-0, 727200, 152064, 0x68c6d1b9
-0, 730800, 152064, 0xbc881fcc
-0, 734400, 152064, 0x422cc6f2
-0, 738000, 152064, 0x9b686410
-0, 741600, 152064, 0x35dc5e86
-0, 745200, 152064, 0x247bedaa
-0, 748800, 152064, 0x22b76fd1
-0, 752400, 152064, 0x67cc7a75
-0, 756000, 152064, 0xa197521e
-0, 759600, 152064, 0x428c8662
-0, 763200, 152064, 0x33dc2c73
-0, 766800, 152064, 0x5b538903
-0, 770400, 152064, 0x3c4176b6
-0, 774000, 152064, 0x774364ba
-0, 777600, 152064, 0xf237d03e
-0, 781200, 152064, 0xac8746fb
-0, 784800, 152064, 0x6b306a84
-0, 788400, 152064, 0xa2ace513
-0, 792000, 152064, 0x709c9be7
-0, 795600, 152064, 0x2403f373
-0, 799200, 152064, 0x147bf717
-0, 802800, 152064, 0xe58964c8
-0, 806400, 152064, 0xa0da36fc
-0, 810000, 152064, 0x1ac1355c
-0, 813600, 152064, 0x8a31c9f2
-0, 817200, 152064, 0x42ba205c
-0, 820800, 152064, 0xa11b3575
-0, 824400, 152064, 0xcb35207c
-0, 828000, 152064, 0x528f6189
-0, 831600, 152064, 0x34f05bd7
-0, 835200, 152064, 0x72317356
-0, 838800, 152064, 0xaabd5028
-0, 842400, 152064, 0x13dbeb7b
-0, 846000, 152064, 0x62f1e8a8
-0, 849600, 152064, 0x1723bfcd
-0, 853200, 152064, 0x5c083c00
-0, 856800, 152064, 0x52137894
-0, 860400, 152064, 0xef1e082c
-0, 864000, 152064, 0x664b3d53
-0, 867600, 152064, 0x2eb9b296
-0, 871200, 152064, 0xd0ca511e
-0, 874800, 152064, 0x012d4724
-0, 878400, 152064, 0xa847f5af
-0, 882000, 152064, 0x483a2fde
-0, 885600, 152064, 0xd1ab0257
-0, 889200, 152064, 0x414692c7
-0, 892800, 152064, 0x0b79df88
-0, 896400, 152064, 0xdaa2c4a3
-0, 900000, 152064, 0xd1b44500
-0, 903600, 152064, 0xfd3d2cf3
-0, 907200, 152064, 0xfdc0f748
-0, 910800, 152064, 0xce762a2a
-0, 914400, 152064, 0x08b63572
-0, 918000, 152064, 0x5a46a38d
-0, 921600, 152064, 0x03cee9c0
-0, 925200, 152064, 0x9ee45473
-0, 928800, 152064, 0x5a432386
-0, 932400, 152064, 0x54c83d87
-0, 936000, 152064, 0xc9caa1de
-0, 939600, 152064, 0xa28367f1
-0, 943200, 152064, 0x2607cdf1
-0, 946800, 152064, 0x06baa8de
-0, 950400, 152064, 0xf5346e32
-0, 954000, 152064, 0x6d3e732b
-0, 957600, 152064, 0x798c584b
-0, 961200, 152064, 0x4076c948
-0, 964800, 152064, 0x868cf63a
-0, 968400, 152064, 0x23107ac5
-0, 972000, 152064, 0x306f3fe2
-0, 975600, 152064, 0xbd1d71d6
-0, 979200, 152064, 0x1429545f
-0, 982800, 152064, 0xaded29aa
-0, 986400, 152064, 0x9b455a94
-0, 990000, 152064, 0xb3774ce7
-0, 993600, 152064, 0x92580986
-0, 997200, 152064, 0x0eae2f95
-0, 1000800, 152064, 0x599208b2
-0, 1004400, 152064, 0x4804c04c
-0, 1008000, 152064, 0x5f730e8f
-0, 1011600, 152064, 0x3e501d1e
-0, 1015200, 152064, 0x32100740
-0, 1018800, 152064, 0x62226ff8
-0, 1022400, 152064, 0x7683b622
-0, 1026000, 152064, 0xc3e0aec1
-0, 1029600, 152064, 0xfac12608
-0, 1033200, 152064, 0xb21a5781
-0, 1036800, 152064, 0x8f1e4964
-0, 1040400, 152064, 0x0f62dd6e
-0, 1044000, 152064, 0xac062ac4
-0, 1047600, 152064, 0x1b320f7a
-0, 1051200, 152064, 0x346e7211
-0, 1054800, 152064, 0xe47592f3
-0, 1058400, 152064, 0xa3a7919c
-0, 1062000, 152064, 0xa3580fa6
-0, 1065600, 152064, 0xc73430c1
-0, 1069200, 152064, 0x994a2c18
-0, 1072800, 152064, 0x0b5d8d45
-0, 1076400, 152064, 0x9eed5109
+#tb 0: 1/25
+0, 0, 0, 1, 152064, 0x3e39c08b
+0, 1, 1, 1, 152064, 0xabc67990
+0, 2, 2, 1, 152064, 0x19614e74
+0, 3, 3, 1, 152064, 0xa3776beb
+0, 4, 4, 1, 152064, 0xcce6ffdf
+0, 5, 5, 1, 152064, 0xb0e94746
+0, 6, 6, 1, 152064, 0xdb1a84ef
+0, 7, 7, 1, 152064, 0xb2624509
+0, 8, 8, 1, 152064, 0x32e2d826
+0, 9, 9, 1, 152064, 0xb3bddf0b
+0, 10, 10, 1, 152064, 0x2e273ce3
+0, 11, 11, 1, 152064, 0x67af7e4d
+0, 12, 12, 1, 152064, 0x505c3261
+0, 13, 13, 1, 152064, 0xa43d015e
+0, 14, 14, 1, 152064, 0xad41c1f6
+0, 15, 15, 1, 152064, 0x633ba55f
+0, 16, 16, 1, 152064, 0xe80634f0
+0, 17, 17, 1, 152064, 0x80a07dc9
+0, 18, 18, 1, 152064, 0x0e7a3bbf
+0, 19, 19, 1, 152064, 0xcb099196
+0, 20, 20, 1, 152064, 0x57c96db5
+0, 21, 21, 1, 152064, 0xccd422fa
+0, 22, 22, 1, 152064, 0x0850b7a7
+0, 23, 23, 1, 152064, 0x30e33156
+0, 24, 24, 1, 152064, 0x34e13f9a
+0, 25, 25, 1, 152064, 0x03d36000
+0, 26, 26, 1, 152064, 0xbf7d49da
+0, 27, 27, 1, 152064, 0x77336d09
+0, 28, 28, 1, 152064, 0xca8be5a9
+0, 29, 29, 1, 152064, 0xe57c0b08
+0, 30, 30, 1, 152064, 0xbe77c093
+0, 31, 31, 1, 152064, 0x6bf1ff05
+0, 32, 32, 1, 152064, 0x9142babf
+0, 33, 33, 1, 152064, 0x08db8e67
+0, 34, 34, 1, 152064, 0x69ac8cb6
+0, 35, 35, 1, 152064, 0xaa3b5c88
+0, 36, 36, 1, 152064, 0x9bd32638
+0, 37, 37, 1, 152064, 0x7972115a
+0, 38, 38, 1, 152064, 0x5c1dd47b
+0, 39, 39, 1, 152064, 0x8a196e02
+0, 40, 40, 1, 152064, 0xa89672bc
+0, 41, 41, 1, 152064, 0x27b220e4
+0, 42, 42, 1, 152064, 0xfa38dc4a
+0, 43, 43, 1, 152064, 0x4784c639
+0, 44, 44, 1, 152064, 0xa5e4229a
+0, 45, 45, 1, 152064, 0xa986bdfc
+0, 46, 46, 1, 152064, 0x2951b47b
+0, 47, 47, 1, 152064, 0x4df404a6
+0, 48, 48, 1, 152064, 0xc75155e8
+0, 49, 49, 1, 152064, 0xfc05248c
+0, 50, 50, 1, 152064, 0x5d53da10
+0, 51, 51, 1, 152064, 0x284376ec
+0, 52, 52, 1, 152064, 0x19fce380
+0, 53, 53, 1, 152064, 0x876be6c9
+0, 54, 54, 1, 152064, 0x39eb8ff9
+0, 55, 55, 1, 152064, 0x289c9543
+0, 56, 56, 1, 152064, 0x24dd2356
+0, 57, 57, 1, 152064, 0x1dc17d3c
+0, 58, 58, 1, 152064, 0xd17c00ac
+0, 59, 59, 1, 152064, 0xc2ad54de
+0, 60, 60, 1, 152064, 0xbe11ee2f
+0, 61, 61, 1, 152064, 0x3db9dc89
+0, 62, 62, 1, 152064, 0xac0d7bc2
+0, 63, 63, 1, 152064, 0x8dab2dde
+0, 64, 64, 1, 152064, 0x566ad225
+0, 65, 65, 1, 152064, 0x587c7853
+0, 66, 66, 1, 152064, 0x601c9c80
+0, 67, 67, 1, 152064, 0x2afaf751
+0, 68, 68, 1, 152064, 0x1c9f7e3a
+0, 69, 69, 1, 152064, 0x899475bf
+0, 70, 70, 1, 152064, 0x0d65c7d9
+0, 71, 71, 1, 152064, 0xafd63d12
+0, 72, 72, 1, 152064, 0x162e62b9
+0, 73, 73, 1, 152064, 0x5c9554be
+0, 74, 74, 1, 152064, 0x35fbdaa2
+0, 75, 75, 1, 152064, 0x6438cbd8
+0, 76, 76, 1, 152064, 0xde0772c9
+0, 77, 77, 1, 152064, 0x79f82854
+0, 78, 78, 1, 152064, 0x86957840
+0, 79, 79, 1, 152064, 0xd9468cbf
+0, 80, 80, 1, 152064, 0x23e74609
+0, 81, 81, 1, 152064, 0x3919a146
+0, 82, 82, 1, 152064, 0xd641078b
+0, 83, 83, 1, 152064, 0x24397220
+0, 84, 84, 1, 152064, 0xe7fc3a7c
+0, 85, 85, 1, 152064, 0x3997154a
+0, 86, 86, 1, 152064, 0x2af3952c
+0, 87, 87, 1, 152064, 0x274ac07a
+0, 88, 88, 1, 152064, 0x288f7b09
+0, 89, 89, 1, 152064, 0xe6f9b022
+0, 90, 90, 1, 152064, 0xf09e2fbb
+0, 91, 91, 1, 152064, 0x7244e477
+0, 92, 92, 1, 152064, 0x0dfc72eb
+0, 93, 93, 1, 152064, 0x0322b21f
+0, 94, 94, 1, 152064, 0x18b08205
+0, 95, 95, 1, 152064, 0x6606153e
+0, 96, 96, 1, 152064, 0x85186272
+0, 97, 97, 1, 152064, 0x3369f064
+0, 98, 98, 1, 152064, 0xbe0d5a44
+0, 99, 99, 1, 152064, 0x320258bb
+0, 100, 100, 1, 152064, 0x4d6fb091
+0, 101, 101, 1, 152064, 0xc9bbf5e7
+0, 102, 102, 1, 152064, 0x0aa1b69b
+0, 103, 103, 1, 152064, 0x85b9ac11
+0, 104, 104, 1, 152064, 0xb25ff818
+0, 105, 105, 1, 152064, 0xa155dc25
+0, 106, 106, 1, 152064, 0xa8e03bfd
+0, 107, 107, 1, 152064, 0x0a862956
+0, 108, 108, 1, 152064, 0x11b49264
+0, 109, 109, 1, 152064, 0xa94e664e
+0, 110, 110, 1, 152064, 0x330e0fa2
+0, 111, 111, 1, 152064, 0xaf3d9518
+0, 112, 112, 1, 152064, 0x0836f2e8
+0, 113, 113, 1, 152064, 0xbf6dc578
+0, 114, 114, 1, 152064, 0x7b524d20
+0, 115, 115, 1, 152064, 0x9ef7677f
+0, 116, 116, 1, 152064, 0xeacf3f34
+0, 117, 117, 1, 152064, 0xfb4e3dbe
+0, 118, 118, 1, 152064, 0xb46e25cb
+0, 119, 119, 1, 152064, 0x363c1603
+0, 120, 120, 1, 152064, 0x263fc542
+0, 121, 121, 1, 152064, 0xf106e548
+0, 122, 122, 1, 152064, 0xde43c56a
+0, 123, 123, 1, 152064, 0xc2c4770a
+0, 124, 124, 1, 152064, 0x122fce19
+0, 125, 125, 1, 152064, 0x3ba01434
+0, 126, 126, 1, 152064, 0x0e8ce5ee
+0, 127, 127, 1, 152064, 0x6ceb82e1
+0, 128, 128, 1, 152064, 0xa23ee21c
+0, 129, 129, 1, 152064, 0xc6d960f9
+0, 130, 130, 1, 152064, 0x0de15258
+0, 131, 131, 1, 152064, 0x187b0333
+0, 132, 132, 1, 152064, 0x92e6582f
+0, 133, 133, 1, 152064, 0xb9586ce0
+0, 134, 134, 1, 152064, 0xefd803b5
+0, 135, 135, 1, 152064, 0x24eafb29
+0, 136, 136, 1, 152064, 0x20c73b14
+0, 137, 137, 1, 152064, 0xbd7ceaaa
+0, 138, 138, 1, 152064, 0x775216c8
+0, 139, 139, 1, 152064, 0xa08971c7
+0, 140, 140, 1, 152064, 0xef0ee865
+0, 141, 141, 1, 152064, 0x9ac61c2f
+0, 142, 142, 1, 152064, 0x52ae8ea9
+0, 143, 143, 1, 152064, 0x06571c14
+0, 144, 144, 1, 152064, 0x6e78ad33
+0, 145, 145, 1, 152064, 0xad01c627
+0, 146, 146, 1, 152064, 0xbfe074d3
+0, 147, 147, 1, 152064, 0x9357a183
+0, 148, 148, 1, 152064, 0x8de7767f
+0, 149, 149, 1, 152064, 0xa5e6e76e
+0, 150, 150, 1, 152064, 0xa6f646fe
+0, 151, 151, 1, 152064, 0x132e99f8
+0, 152, 152, 1, 152064, 0xb79f27de
+0, 153, 153, 1, 152064, 0x36d3cdcf
+0, 154, 154, 1, 152064, 0xdc938336
+0, 155, 155, 1, 152064, 0xacaa3a7f
+0, 156, 156, 1, 152064, 0xc61a37fd
+0, 157, 157, 1, 152064, 0x4fe1ddf0
+0, 158, 158, 1, 152064, 0xc0f7d660
+0, 159, 159, 1, 152064, 0xd72458ea
+0, 160, 160, 1, 152064, 0x6978d123
+0, 161, 161, 1, 152064, 0x64e60ccf
+0, 162, 162, 1, 152064, 0xaa07004c
+0, 163, 163, 1, 152064, 0x07cd1064
+0, 164, 164, 1, 152064, 0xa82320e5
+0, 165, 165, 1, 152064, 0xaedd8d30
+0, 166, 166, 1, 152064, 0x79b082ea
+0, 167, 167, 1, 152064, 0x9ed800ab
+0, 168, 168, 1, 152064, 0xde592bb4
+0, 169, 169, 1, 152064, 0xd966df88
+0, 170, 170, 1, 152064, 0xf921988a
+0, 171, 171, 1, 152064, 0x557ad9ae
+0, 172, 172, 1, 152064, 0xc3f31a9a
+0, 173, 173, 1, 152064, 0x65248561
+0, 174, 174, 1, 152064, 0x63df4aa6
+0, 175, 175, 1, 152064, 0x618da0a9
+0, 176, 176, 1, 152064, 0xe6f1c435
+0, 177, 177, 1, 152064, 0x9f90c38f
+0, 178, 178, 1, 152064, 0xd2853e14
+0, 179, 179, 1, 152064, 0x6e0268a9
+0, 180, 180, 1, 152064, 0x393712d1
+0, 181, 181, 1, 152064, 0x470da25f
+0, 182, 182, 1, 152064, 0xaf55cb3d
+0, 183, 183, 1, 152064, 0x6935b8b9
+0, 184, 184, 1, 152064, 0x5409a15f
+0, 185, 185, 1, 152064, 0x09073fee
+0, 186, 186, 1, 152064, 0xfb274e82
+0, 187, 187, 1, 152064, 0x1a770581
+0, 188, 188, 1, 152064, 0x17277d0d
+0, 189, 189, 1, 152064, 0xd4dcd982
+0, 190, 190, 1, 152064, 0x6b04eaf3
+0, 191, 191, 1, 152064, 0x8a3d822e
+0, 192, 192, 1, 152064, 0x1b971ec9
+0, 193, 193, 1, 152064, 0x14e0c0f6
+0, 194, 194, 1, 152064, 0x00667450
+0, 195, 195, 1, 152064, 0xd2385902
+0, 196, 196, 1, 152064, 0x905da6ab
+0, 197, 197, 1, 152064, 0xa3ffb18b
+0, 198, 198, 1, 152064, 0x10d48b19
+0, 199, 199, 1, 152064, 0xb2c7a3bd
+0, 200, 200, 1, 152064, 0x45593e96
+0, 201, 201, 1, 152064, 0x47a0b60c
+0, 202, 202, 1, 152064, 0x68c6d1b9
+0, 203, 203, 1, 152064, 0xbc881fcc
+0, 204, 204, 1, 152064, 0x422cc6f2
+0, 205, 205, 1, 152064, 0x9b686410
+0, 206, 206, 1, 152064, 0x35dc5e86
+0, 207, 207, 1, 152064, 0x247bedaa
+0, 208, 208, 1, 152064, 0x22b76fd1
+0, 209, 209, 1, 152064, 0x67cc7a75
+0, 210, 210, 1, 152064, 0xa197521e
+0, 211, 211, 1, 152064, 0x428c8662
+0, 212, 212, 1, 152064, 0x33dc2c73
+0, 213, 213, 1, 152064, 0x5b538903
+0, 214, 214, 1, 152064, 0x3c4176b6
+0, 215, 215, 1, 152064, 0x774364ba
+0, 216, 216, 1, 152064, 0xf237d03e
+0, 217, 217, 1, 152064, 0xac8746fb
+0, 218, 218, 1, 152064, 0x6b306a84
+0, 219, 219, 1, 152064, 0xa2ace513
+0, 220, 220, 1, 152064, 0x709c9be7
+0, 221, 221, 1, 152064, 0x2403f373
+0, 222, 222, 1, 152064, 0x147bf717
+0, 223, 223, 1, 152064, 0xe58964c8
+0, 224, 224, 1, 152064, 0xa0da36fc
+0, 225, 225, 1, 152064, 0x1ac1355c
+0, 226, 226, 1, 152064, 0x8a31c9f2
+0, 227, 227, 1, 152064, 0x42ba205c
+0, 228, 228, 1, 152064, 0xa11b3575
+0, 229, 229, 1, 152064, 0xcb35207c
+0, 230, 230, 1, 152064, 0x528f6189
+0, 231, 231, 1, 152064, 0x34f05bd7
+0, 232, 232, 1, 152064, 0x72317356
+0, 233, 233, 1, 152064, 0xaabd5028
+0, 234, 234, 1, 152064, 0x13dbeb7b
+0, 235, 235, 1, 152064, 0x62f1e8a8
+0, 236, 236, 1, 152064, 0x1723bfcd
+0, 237, 237, 1, 152064, 0x5c083c00
+0, 238, 238, 1, 152064, 0x52137894
+0, 239, 239, 1, 152064, 0xef1e082c
+0, 240, 240, 1, 152064, 0x664b3d53
+0, 241, 241, 1, 152064, 0x2eb9b296
+0, 242, 242, 1, 152064, 0xd0ca511e
+0, 243, 243, 1, 152064, 0x012d4724
+0, 244, 244, 1, 152064, 0xa847f5af
+0, 245, 245, 1, 152064, 0x483a2fde
+0, 246, 246, 1, 152064, 0xd1ab0257
+0, 247, 247, 1, 152064, 0x414692c7
+0, 248, 248, 1, 152064, 0x0b79df88
+0, 249, 249, 1, 152064, 0xdaa2c4a3
+0, 250, 250, 1, 152064, 0xd1b44500
+0, 251, 251, 1, 152064, 0xfd3d2cf3
+0, 252, 252, 1, 152064, 0xfdc0f748
+0, 253, 253, 1, 152064, 0xce762a2a
+0, 254, 254, 1, 152064, 0x08b63572
+0, 255, 255, 1, 152064, 0x5a46a38d
+0, 256, 256, 1, 152064, 0x03cee9c0
+0, 257, 257, 1, 152064, 0x9ee45473
+0, 258, 258, 1, 152064, 0x5a432386
+0, 259, 259, 1, 152064, 0x54c83d87
+0, 260, 260, 1, 152064, 0xc9caa1de
+0, 261, 261, 1, 152064, 0xa28367f1
+0, 262, 262, 1, 152064, 0x2607cdf1
+0, 263, 263, 1, 152064, 0x06baa8de
+0, 264, 264, 1, 152064, 0xf5346e32
+0, 265, 265, 1, 152064, 0x6d3e732b
+0, 266, 266, 1, 152064, 0x798c584b
+0, 267, 267, 1, 152064, 0x4076c948
+0, 268, 268, 1, 152064, 0x868cf63a
+0, 269, 269, 1, 152064, 0x23107ac5
+0, 270, 270, 1, 152064, 0x306f3fe2
+0, 271, 271, 1, 152064, 0xbd1d71d6
+0, 272, 272, 1, 152064, 0x1429545f
+0, 273, 273, 1, 152064, 0xaded29aa
+0, 274, 274, 1, 152064, 0x9b455a94
+0, 275, 275, 1, 152064, 0xb3774ce7
+0, 276, 276, 1, 152064, 0x92580986
+0, 277, 277, 1, 152064, 0x0eae2f95
+0, 278, 278, 1, 152064, 0x599208b2
+0, 279, 279, 1, 152064, 0x4804c04c
+0, 280, 280, 1, 152064, 0x5f730e8f
+0, 281, 281, 1, 152064, 0x3e501d1e
+0, 282, 282, 1, 152064, 0x32100740
+0, 283, 283, 1, 152064, 0x62226ff8
+0, 284, 284, 1, 152064, 0x7683b622
+0, 285, 285, 1, 152064, 0xc3e0aec1
+0, 286, 286, 1, 152064, 0xfac12608
+0, 287, 287, 1, 152064, 0xb21a5781
+0, 288, 288, 1, 152064, 0x8f1e4964
+0, 289, 289, 1, 152064, 0x0f62dd6e
+0, 290, 290, 1, 152064, 0xac062ac4
+0, 291, 291, 1, 152064, 0x1b320f7a
+0, 292, 292, 1, 152064, 0x346e7211
+0, 293, 293, 1, 152064, 0xe47592f3
+0, 294, 294, 1, 152064, 0xa3a7919c
+0, 295, 295, 1, 152064, 0xa3580fa6
+0, 296, 296, 1, 152064, 0xc73430c1
+0, 297, 297, 1, 152064, 0x994a2c18
+0, 298, 298, 1, 152064, 0x0b5d8d45
+0, 299, 299, 1, 152064, 0x9eed5109
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-hpcvmolq_brcm_b b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-hpcvmolq_brcm_b
index 9db3fe5..4179ace 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-hpcvmolq_brcm_b
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-hpcvmolq_brcm_b
@@ -1,100 +1,101 @@
-0, 0, 152064, 0xa18cfb97
-0, 3600, 152064, 0x509b54d2
-0, 7200, 152064, 0x1ba0fb8e
-0, 10800, 152064, 0x43e7721f
-0, 14400, 152064, 0xed196624
-0, 18000, 152064, 0x4277f1e8
-0, 21600, 152064, 0x88015cd6
-0, 25200, 152064, 0x0f230af3
-0, 28800, 152064, 0x91bbd664
-0, 32400, 152064, 0x117c65dd
-0, 36000, 152064, 0x8eebe5e8
-0, 39600, 152064, 0xd205cc10
-0, 43200, 152064, 0x4084a356
-0, 46800, 152064, 0x37385081
-0, 50400, 152064, 0xb7d34d8a
-0, 54000, 152064, 0x96648874
-0, 57600, 152064, 0x0623e65b
-0, 61200, 152064, 0x7d5b0173
-0, 64800, 152064, 0x0b6428e4
-0, 68400, 152064, 0xf3ca22a8
-0, 72000, 152064, 0x092e322c
-0, 75600, 152064, 0xe82c2971
-0, 79200, 152064, 0x29bf6111
-0, 82800, 152064, 0x84f1ea0d
-0, 86400, 152064, 0x45f822eb
-0, 90000, 152064, 0x9672b2a7
-0, 93600, 152064, 0xdb98e020
-0, 97200, 152064, 0x729879eb
-0, 100800, 152064, 0x3f629eae
-0, 104400, 152064, 0x02e0ddb7
-0, 108000, 152064, 0xbb1a0bb1
-0, 111600, 152064, 0x9b85b55b
-0, 115200, 152064, 0x2bae448b
-0, 118800, 152064, 0xa8f28bfa
-0, 122400, 152064, 0x687479da
-0, 126000, 152064, 0xe1ec3111
-0, 129600, 152064, 0x8afa37f1
-0, 133200, 152064, 0x4af89faf
-0, 136800, 152064, 0x1d9da53a
-0, 140400, 152064, 0xdc599bcd
-0, 144000, 152064, 0x01fb2e11
-0, 147600, 152064, 0x2a33498e
-0, 151200, 152064, 0x87874877
-0, 154800, 152064, 0xdcd095c6
-0, 158400, 152064, 0x4f14e6fb
-0, 162000, 152064, 0x65fd165e
-0, 165600, 152064, 0x4c267122
-0, 169200, 152064, 0x18adf3aa
-0, 172800, 152064, 0x74044daa
-0, 176400, 152064, 0xa03bca1e
-0, 180000, 152064, 0x7c1463fe
-0, 183600, 152064, 0x688a14e3
-0, 187200, 152064, 0x35c91c4e
-0, 190800, 152064, 0xeaf51d07
-0, 194400, 152064, 0xee61b9b1
-0, 198000, 152064, 0xbab75db3
-0, 201600, 152064, 0x199af472
-0, 205200, 152064, 0x3bcf96db
-0, 208800, 152064, 0x3fecdb09
-0, 212400, 152064, 0x07be2431
-0, 216000, 152064, 0x61432984
-0, 219600, 152064, 0xdb12a3b9
-0, 223200, 152064, 0xc2b8403e
-0, 226800, 152064, 0x34c60bde
-0, 230400, 152064, 0x08639859
-0, 234000, 152064, 0xfc0fc556
-0, 237600, 152064, 0x9cc27272
-0, 241200, 152064, 0x3ef7dbb0
-0, 244800, 152064, 0xbb74d9a3
-0, 248400, 152064, 0x4007fc6e
-0, 252000, 152064, 0x3d902f9b
-0, 255600, 152064, 0xfbd0a76a
-0, 259200, 152064, 0x4f1a4631
-0, 262800, 152064, 0x4f58ee25
-0, 266400, 152064, 0xd2c39501
-0, 270000, 152064, 0x23de68d5
-0, 273600, 152064, 0x4bf7d4ce
-0, 277200, 152064, 0x2bdccc79
-0, 280800, 152064, 0xc26b8f81
-0, 284400, 152064, 0xe77fa90a
-0, 288000, 152064, 0x48528308
-0, 291600, 152064, 0xab19b66b
-0, 295200, 152064, 0x04db5b4a
-0, 298800, 152064, 0x9fade901
-0, 302400, 152064, 0x1b7274ba
-0, 306000, 152064, 0x387a0191
-0, 309600, 152064, 0x2b3a8128
-0, 313200, 152064, 0x2a0dab30
-0, 316800, 152064, 0x5f5fc2da
-0, 320400, 152064, 0x5a5c8150
-0, 324000, 152064, 0xe0f5095e
-0, 327600, 152064, 0xb87c8072
-0, 331200, 152064, 0x08155daf
-0, 334800, 152064, 0xc308353f
-0, 338400, 152064, 0x2a04e8e4
-0, 342000, 152064, 0xabe75987
-0, 345600, 152064, 0x8733fb98
-0, 349200, 152064, 0x810f53a0
-0, 352800, 152064, 0xb3e4ea37
-0, 356400, 152064, 0xb7a70980
+#tb 0: 1/25
+0, 0, 0, 1, 152064, 0xa18cfb97
+0, 1, 1, 1, 152064, 0x509b54d2
+0, 2, 2, 1, 152064, 0x1ba0fb8e
+0, 3, 3, 1, 152064, 0x43e7721f
+0, 4, 4, 1, 152064, 0xed196624
+0, 5, 5, 1, 152064, 0x4277f1e8
+0, 6, 6, 1, 152064, 0x88015cd6
+0, 7, 7, 1, 152064, 0x0f230af3
+0, 8, 8, 1, 152064, 0x91bbd664
+0, 9, 9, 1, 152064, 0x117c65dd
+0, 10, 10, 1, 152064, 0x8eebe5e8
+0, 11, 11, 1, 152064, 0xd205cc10
+0, 12, 12, 1, 152064, 0x4084a356
+0, 13, 13, 1, 152064, 0x37385081
+0, 14, 14, 1, 152064, 0xb7d34d8a
+0, 15, 15, 1, 152064, 0x96648874
+0, 16, 16, 1, 152064, 0x0623e65b
+0, 17, 17, 1, 152064, 0x7d5b0173
+0, 18, 18, 1, 152064, 0x0b6428e4
+0, 19, 19, 1, 152064, 0xf3ca22a8
+0, 20, 20, 1, 152064, 0x092e322c
+0, 21, 21, 1, 152064, 0xe82c2971
+0, 22, 22, 1, 152064, 0x29bf6111
+0, 23, 23, 1, 152064, 0x84f1ea0d
+0, 24, 24, 1, 152064, 0x45f822eb
+0, 25, 25, 1, 152064, 0x9672b2a7
+0, 26, 26, 1, 152064, 0xdb98e020
+0, 27, 27, 1, 152064, 0x729879eb
+0, 28, 28, 1, 152064, 0x3f629eae
+0, 29, 29, 1, 152064, 0x02e0ddb7
+0, 30, 30, 1, 152064, 0xbb1a0bb1
+0, 31, 31, 1, 152064, 0x9b85b55b
+0, 32, 32, 1, 152064, 0x2bae448b
+0, 33, 33, 1, 152064, 0xa8f28bfa
+0, 34, 34, 1, 152064, 0x687479da
+0, 35, 35, 1, 152064, 0xe1ec3111
+0, 36, 36, 1, 152064, 0x8afa37f1
+0, 37, 37, 1, 152064, 0x4af89faf
+0, 38, 38, 1, 152064, 0x1d9da53a
+0, 39, 39, 1, 152064, 0xdc599bcd
+0, 40, 40, 1, 152064, 0x01fb2e11
+0, 41, 41, 1, 152064, 0x2a33498e
+0, 42, 42, 1, 152064, 0x87874877
+0, 43, 43, 1, 152064, 0xdcd095c6
+0, 44, 44, 1, 152064, 0x4f14e6fb
+0, 45, 45, 1, 152064, 0x65fd165e
+0, 46, 46, 1, 152064, 0x4c267122
+0, 47, 47, 1, 152064, 0x18adf3aa
+0, 48, 48, 1, 152064, 0x74044daa
+0, 49, 49, 1, 152064, 0xa03bca1e
+0, 50, 50, 1, 152064, 0x7c1463fe
+0, 51, 51, 1, 152064, 0x688a14e3
+0, 52, 52, 1, 152064, 0x35c91c4e
+0, 53, 53, 1, 152064, 0xeaf51d07
+0, 54, 54, 1, 152064, 0xee61b9b1
+0, 55, 55, 1, 152064, 0xbab75db3
+0, 56, 56, 1, 152064, 0x199af472
+0, 57, 57, 1, 152064, 0x3bcf96db
+0, 58, 58, 1, 152064, 0x3fecdb09
+0, 59, 59, 1, 152064, 0x07be2431
+0, 60, 60, 1, 152064, 0x61432984
+0, 61, 61, 1, 152064, 0xdb12a3b9
+0, 62, 62, 1, 152064, 0xc2b8403e
+0, 63, 63, 1, 152064, 0x34c60bde
+0, 64, 64, 1, 152064, 0x08639859
+0, 65, 65, 1, 152064, 0xfc0fc556
+0, 66, 66, 1, 152064, 0x9cc27272
+0, 67, 67, 1, 152064, 0x3ef7dbb0
+0, 68, 68, 1, 152064, 0xbb74d9a3
+0, 69, 69, 1, 152064, 0x4007fc6e
+0, 70, 70, 1, 152064, 0x3d902f9b
+0, 71, 71, 1, 152064, 0xfbd0a76a
+0, 72, 72, 1, 152064, 0x4f1a4631
+0, 73, 73, 1, 152064, 0x4f58ee25
+0, 74, 74, 1, 152064, 0xd2c39501
+0, 75, 75, 1, 152064, 0x23de68d5
+0, 76, 76, 1, 152064, 0x4bf7d4ce
+0, 77, 77, 1, 152064, 0x2bdccc79
+0, 78, 78, 1, 152064, 0xc26b8f81
+0, 79, 79, 1, 152064, 0xe77fa90a
+0, 80, 80, 1, 152064, 0x48528308
+0, 81, 81, 1, 152064, 0xab19b66b
+0, 82, 82, 1, 152064, 0x04db5b4a
+0, 83, 83, 1, 152064, 0x9fade901
+0, 84, 84, 1, 152064, 0x1b7274ba
+0, 85, 85, 1, 152064, 0x387a0191
+0, 86, 86, 1, 152064, 0x2b3a8128
+0, 87, 87, 1, 152064, 0x2a0dab30
+0, 88, 88, 1, 152064, 0x5f5fc2da
+0, 89, 89, 1, 152064, 0x5a5c8150
+0, 90, 90, 1, 152064, 0xe0f5095e
+0, 91, 91, 1, 152064, 0xb87c8072
+0, 92, 92, 1, 152064, 0x08155daf
+0, 93, 93, 1, 152064, 0xc308353f
+0, 94, 94, 1, 152064, 0x2a04e8e4
+0, 95, 95, 1, 152064, 0xabe75987
+0, 96, 96, 1, 152064, 0x8733fb98
+0, 97, 97, 1, 152064, 0x810f53a0
+0, 98, 98, 1, 152064, 0xb3e4ea37
+0, 99, 99, 1, 152064, 0xb7a70980
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-hpcvnl_brcm_a b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-hpcvnl_brcm_a
index fe47465..23ad267 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-hpcvnl_brcm_a
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-hpcvnl_brcm_a
@@ -1,300 +1,301 @@
-0, 0, 152064, 0x2744afa1
-0, 3600, 152064, 0x17246583
-0, 7200, 152064, 0x501836ed
-0, 10800, 152064, 0xe90d6961
-0, 14400, 152064, 0x27abe1ad
-0, 18000, 152064, 0xcfc730e4
-0, 21600, 152064, 0xeaaa83ee
-0, 25200, 152064, 0xb5d80ebd
-0, 28800, 152064, 0x1e1b9d03
-0, 32400, 152064, 0x60e7cf33
-0, 36000, 152064, 0xc44616b1
-0, 39600, 152064, 0x0a2a5906
-0, 43200, 152064, 0xf101309c
-0, 46800, 152064, 0x0b57f348
-0, 50400, 152064, 0x4f018c05
-0, 54000, 152064, 0x22359c60
-0, 57600, 152064, 0x020f1cc3
-0, 61200, 152064, 0x15be3892
-0, 64800, 152064, 0x834a2e23
-0, 68400, 152064, 0x1176586c
-0, 72000, 152064, 0x9cf25641
-0, 75600, 152064, 0xc1c4051d
-0, 79200, 152064, 0x790d8bfa
-0, 82800, 152064, 0x4dcbe7d7
-0, 86400, 152064, 0xe81d3b7b
-0, 90000, 152064, 0xe9e21309
-0, 93600, 152064, 0x22021dbc
-0, 97200, 152064, 0x430c5ecb
-0, 100800, 152064, 0xf524be8b
-0, 104400, 152064, 0xa437dadc
-0, 108000, 152064, 0xff00b440
-0, 111600, 152064, 0x4bd1bf15
-0, 115200, 152064, 0x1f46a3ea
-0, 118800, 152064, 0x60b47c5e
-0, 122400, 152064, 0x45117ac6
-0, 126000, 152064, 0x43894fca
-0, 129600, 152064, 0x21572b55
-0, 133200, 152064, 0xe96def09
-0, 136800, 152064, 0x4d2ab41f
-0, 140400, 152064, 0x072d6b06
-0, 144000, 152064, 0x81865687
-0, 147600, 152064, 0x8d9a0ea6
-0, 151200, 152064, 0x1484d3cd
-0, 154800, 152064, 0xbdabae6b
-0, 158400, 152064, 0x4211edbe
-0, 162000, 152064, 0xd84dad6d
-0, 165600, 152064, 0xe4e79344
-0, 169200, 152064, 0x9c1addd7
-0, 172800, 152064, 0xdcf94283
-0, 176400, 152064, 0x6bd005b2
-0, 180000, 152064, 0x9679bd10
-0, 183600, 152064, 0x052064ab
-0, 187200, 152064, 0x915db3f3
-0, 190800, 152064, 0xec2fbd58
-0, 194400, 152064, 0x26728258
-0, 198000, 152064, 0x2b2b617f
-0, 201600, 152064, 0x2339eb3d
-0, 205200, 152064, 0xcf6e6773
-0, 208800, 152064, 0xb993efe4
-0, 212400, 152064, 0x4054253d
-0, 216000, 152064, 0x4befe5b5
-0, 219600, 152064, 0x0678c0fa
-0, 223200, 152064, 0xe3c54a03
-0, 226800, 152064, 0xffa3210c
-0, 230400, 152064, 0xed04b823
-0, 234000, 152064, 0x00926457
-0, 237600, 152064, 0xd56aaaf0
-0, 241200, 152064, 0x6047ef6e
-0, 244800, 152064, 0x44316d07
-0, 248400, 152064, 0xe8a879b7
-0, 252000, 152064, 0x1856cd86
-0, 255600, 152064, 0x6528349a
-0, 259200, 152064, 0xdeff676e
-0, 262800, 152064, 0xda412e47
-0, 266400, 152064, 0xa2c2a96f
-0, 270000, 152064, 0xc703b8cd
-0, 273600, 152064, 0x20b0650b
-0, 277200, 152064, 0x8c14faa5
-0, 280800, 152064, 0xa442706c
-0, 284400, 152064, 0x6e456137
-0, 288000, 152064, 0x6dde11c6
-0, 291600, 152064, 0xb017978a
-0, 295200, 152064, 0xc0bad34b
-0, 298800, 152064, 0x8bd439ee
-0, 302400, 152064, 0xa92735e4
-0, 306000, 152064, 0x1623f501
-0, 309600, 152064, 0x5be980b2
-0, 313200, 152064, 0x4306b9bf
-0, 316800, 152064, 0xb4f18976
-0, 320400, 152064, 0x4ffb9b46
-0, 324000, 152064, 0x23082275
-0, 327600, 152064, 0xc7f0e087
-0, 331200, 152064, 0x68b95327
-0, 334800, 152064, 0xd030a8e4
-0, 338400, 152064, 0xf8f9615c
-0, 342000, 152064, 0x1b26fe3e
-0, 345600, 152064, 0x3381608d
-0, 349200, 152064, 0x9939d49d
-0, 352800, 152064, 0x575f4f94
-0, 356400, 152064, 0x436c581c
-0, 360000, 152064, 0x8f47aa58
-0, 363600, 152064, 0xd251d95a
-0, 367200, 152064, 0x3c33b32c
-0, 370800, 152064, 0xa1e19413
-0, 374400, 152064, 0x8d95cbad
-0, 378000, 152064, 0x98cbd35e
-0, 381600, 152064, 0xceb81a0f
-0, 385200, 152064, 0x5490fab1
-0, 388800, 152064, 0x8e57a38c
-0, 392400, 152064, 0xc379517a
-0, 396000, 152064, 0xafc4f747
-0, 399600, 152064, 0xbc9c9be4
-0, 403200, 152064, 0xd602b2f5
-0, 406800, 152064, 0x8d85a450
-0, 410400, 152064, 0x48183c74
-0, 414000, 152064, 0xd1725590
-0, 417600, 152064, 0x5ef42ed7
-0, 421200, 152064, 0xad3a3883
-0, 424800, 152064, 0x7a3e0ddd
-0, 428400, 152064, 0x59bdfd38
-0, 432000, 152064, 0x5ac3ba9f
-0, 435600, 152064, 0x266cbd00
-0, 439200, 152064, 0x97d29e00
-0, 442800, 152064, 0x620774c2
-0, 446400, 152064, 0xaae8b96f
-0, 450000, 152064, 0x5f6bdfb6
-0, 453600, 152064, 0xb239da53
-0, 457200, 152064, 0x654b5680
-0, 460800, 152064, 0xd796b723
-0, 464400, 152064, 0xd5c84a81
-0, 468000, 152064, 0x2a761652
-0, 471600, 152064, 0x1137e145
-0, 475200, 152064, 0x1a9a451b
-0, 478800, 152064, 0x5ca751c4
-0, 482400, 152064, 0x074acec7
-0, 486000, 152064, 0x9ddfe77d
-0, 489600, 152064, 0xfb211c29
-0, 493200, 152064, 0x681ad4dd
-0, 496800, 152064, 0x702c12cc
-0, 500400, 152064, 0x556c5101
-0, 504000, 152064, 0x39d4bb54
-0, 507600, 152064, 0xa3a118d6
-0, 511200, 152064, 0xb78b7db1
-0, 514800, 152064, 0x4e20eed5
-0, 518400, 152064, 0x6555a9df
-0, 522000, 152064, 0xb607a9a4
-0, 525600, 152064, 0x3cf96a94
-0, 529200, 152064, 0xb2679007
-0, 532800, 152064, 0xf09d5b85
-0, 536400, 152064, 0x3961ba07
-0, 540000, 152064, 0x0c28363a
-0, 543600, 152064, 0x0a017c2d
-0, 547200, 152064, 0x3a661de3
-0, 550800, 152064, 0xf8d1bdee
-0, 554400, 152064, 0x6f47791b
-0, 558000, 152064, 0xe05b22c6
-0, 561600, 152064, 0x7cc93bb0
-0, 565200, 152064, 0xeb90c3d8
-0, 568800, 152064, 0x1a1eac98
-0, 572400, 152064, 0x92985671
-0, 576000, 152064, 0x2fe3ce53
-0, 579600, 152064, 0x61def691
-0, 583200, 152064, 0x90820730
-0, 586800, 152064, 0x17630372
-0, 590400, 152064, 0xaf6cea12
-0, 594000, 152064, 0xfe3b7ecc
-0, 597600, 152064, 0x904a5b2e
-0, 601200, 152064, 0x0d88d5f2
-0, 604800, 152064, 0x498d22b1
-0, 608400, 152064, 0x56baba83
-0, 612000, 152064, 0xda4d6dfa
-0, 615600, 152064, 0xaa38cbdd
-0, 619200, 152064, 0x4077f15d
-0, 622800, 152064, 0x7e006ec2
-0, 626400, 152064, 0x59964a89
-0, 630000, 152064, 0x04c078e3
-0, 633600, 152064, 0x7a5faf97
-0, 637200, 152064, 0xc517b3e9
-0, 640800, 152064, 0xfcc81af5
-0, 644400, 152064, 0xdcb44f62
-0, 648000, 152064, 0x2a080b72
-0, 651600, 152064, 0x91f88c67
-0, 655200, 152064, 0xd39caf81
-0, 658800, 152064, 0x0764ae31
-0, 662400, 152064, 0x0ddb82ed
-0, 666000, 152064, 0xed6d17e4
-0, 669600, 152064, 0xb4f74712
-0, 673200, 152064, 0x23a20787
-0, 676800, 152064, 0x853e7b33
-0, 680400, 152064, 0xc6bac173
-0, 684000, 152064, 0xb590ec15
-0, 687600, 152064, 0xfdd2943c
-0, 691200, 152064, 0xba5d1160
-0, 694800, 152064, 0xe732c5a7
-0, 698400, 152064, 0x279f6ce9
-0, 702000, 152064, 0xb3835829
-0, 705600, 152064, 0x0901b2a1
-0, 709200, 152064, 0x3df2b8f8
-0, 712800, 152064, 0x374496a4
-0, 716400, 152064, 0x1bc6a4ae
-0, 720000, 152064, 0xdb4b372e
-0, 723600, 152064, 0x8c11c214
-0, 727200, 152064, 0xd2d5c093
-0, 730800, 152064, 0x8dda094e
-0, 734400, 152064, 0x9b2cc401
-0, 738000, 152064, 0x1a3b49d5
-0, 741600, 152064, 0xaf5342ff
-0, 745200, 152064, 0x74c0de83
-0, 748800, 152064, 0xcf486137
-0, 752400, 152064, 0xcf005b3b
-0, 756000, 152064, 0x86a64c55
-0, 759600, 152064, 0xdd3f7ae9
-0, 763200, 152064, 0xb0d01e53
-0, 766800, 152064, 0x83219065
-0, 770400, 152064, 0x17a35d27
-0, 774000, 152064, 0xf92645b5
-0, 777600, 152064, 0x8322bdbf
-0, 781200, 152064, 0xd589f6a2
-0, 784800, 152064, 0x80a62d9e
-0, 788400, 152064, 0x05b3e0d1
-0, 792000, 152064, 0xd657aa0b
-0, 795600, 152064, 0xec5ac2dd
-0, 799200, 152064, 0xbf0ff969
-0, 802800, 152064, 0xc34a5140
-0, 806400, 152064, 0x814705c4
-0, 810000, 152064, 0xe9592008
-0, 813600, 152064, 0xf12c933c
-0, 817200, 152064, 0x2daee178
-0, 820800, 152064, 0xa2573028
-0, 824400, 152064, 0x6109f58d
-0, 828000, 152064, 0x64ab8ce4
-0, 831600, 152064, 0x13a88b6e
-0, 835200, 152064, 0x8f0181a9
-0, 838800, 152064, 0xd5295fd4
-0, 842400, 152064, 0xfdbeeb0d
-0, 846000, 152064, 0x05ecd231
-0, 849600, 152064, 0x48d164cd
-0, 853200, 152064, 0xc279cf63
-0, 856800, 152064, 0x1d5e6a03
-0, 860400, 152064, 0xd9dc1807
-0, 864000, 152064, 0xbcc83676
-0, 867600, 152064, 0x65a9811e
-0, 871200, 152064, 0x3ccfe5a8
-0, 874800, 152064, 0x2f2ff051
-0, 878400, 152064, 0x9193e093
-0, 882000, 152064, 0x9a30fdc6
-0, 885600, 152064, 0x90b7ea10
-0, 889200, 152064, 0x3291910c
-0, 892800, 152064, 0x2335d186
-0, 896400, 152064, 0x2890cf1d
-0, 900000, 152064, 0x8c8b6245
-0, 903600, 152064, 0x24b84eda
-0, 907200, 152064, 0x04a12446
-0, 910800, 152064, 0xd9d91d51
-0, 914400, 152064, 0xbf450adf
-0, 918000, 152064, 0xa19a9a41
-0, 921600, 152064, 0x2211ab01
-0, 925200, 152064, 0x8fe85430
-0, 928800, 152064, 0x5a152861
-0, 932400, 152064, 0x7fe76995
-0, 936000, 152064, 0x508b99cd
-0, 939600, 152064, 0x92e79437
-0, 943200, 152064, 0x8572eac9
-0, 946800, 152064, 0x42e3d513
-0, 950400, 152064, 0x6bee9e38
-0, 954000, 152064, 0x2858ad4b
-0, 957600, 152064, 0x96d87d00
-0, 961200, 152064, 0x749f1032
-0, 964800, 152064, 0x668fca6c
-0, 968400, 152064, 0x11d278d9
-0, 972000, 152064, 0x10fd46ea
-0, 975600, 152064, 0xc8b193c8
-0, 979200, 152064, 0x035e7d02
-0, 982800, 152064, 0x067f583c
-0, 986400, 152064, 0xd9648a1e
-0, 990000, 152064, 0x92487b7e
-0, 993600, 152064, 0xc7b35421
-0, 997200, 152064, 0x2ed57c1c
-0, 1000800, 152064, 0xefe24c5f
-0, 1004400, 152064, 0x8df0118b
-0, 1008000, 152064, 0x18f0278d
-0, 1011600, 152064, 0x63ac45ad
-0, 1015200, 152064, 0xd79849f0
-0, 1018800, 152064, 0x1f1d4dab
-0, 1022400, 152064, 0x736fb5b8
-0, 1026000, 152064, 0xc24eb80c
-0, 1029600, 152064, 0x64ca3b11
-0, 1033200, 152064, 0x35d8674c
-0, 1036800, 152064, 0x3c5a7b51
-0, 1040400, 152064, 0x97550b81
-0, 1044000, 152064, 0x731454b5
-0, 1047600, 152064, 0x01de43bc
-0, 1051200, 152064, 0xbda7afae
-0, 1054800, 152064, 0xeb34d714
-0, 1058400, 152064, 0x1260cc98
-0, 1062000, 152064, 0x7e592c36
-0, 1065600, 152064, 0x40b3676e
-0, 1069200, 152064, 0x8c9d6b94
-0, 1072800, 152064, 0xc7988665
-0, 1076400, 152064, 0xf2994d52
+#tb 0: 1/25
+0, 0, 0, 1, 152064, 0x2744afa1
+0, 1, 1, 1, 152064, 0x17246583
+0, 2, 2, 1, 152064, 0x501836ed
+0, 3, 3, 1, 152064, 0xe90d6961
+0, 4, 4, 1, 152064, 0x27abe1ad
+0, 5, 5, 1, 152064, 0xcfc730e4
+0, 6, 6, 1, 152064, 0xeaaa83ee
+0, 7, 7, 1, 152064, 0xb5d80ebd
+0, 8, 8, 1, 152064, 0x1e1b9d03
+0, 9, 9, 1, 152064, 0x60e7cf33
+0, 10, 10, 1, 152064, 0xc44616b1
+0, 11, 11, 1, 152064, 0x0a2a5906
+0, 12, 12, 1, 152064, 0xf101309c
+0, 13, 13, 1, 152064, 0x0b57f348
+0, 14, 14, 1, 152064, 0x4f018c05
+0, 15, 15, 1, 152064, 0x22359c60
+0, 16, 16, 1, 152064, 0x020f1cc3
+0, 17, 17, 1, 152064, 0x15be3892
+0, 18, 18, 1, 152064, 0x834a2e23
+0, 19, 19, 1, 152064, 0x1176586c
+0, 20, 20, 1, 152064, 0x9cf25641
+0, 21, 21, 1, 152064, 0xc1c4051d
+0, 22, 22, 1, 152064, 0x790d8bfa
+0, 23, 23, 1, 152064, 0x4dcbe7d7
+0, 24, 24, 1, 152064, 0xe81d3b7b
+0, 25, 25, 1, 152064, 0xe9e21309
+0, 26, 26, 1, 152064, 0x22021dbc
+0, 27, 27, 1, 152064, 0x430c5ecb
+0, 28, 28, 1, 152064, 0xf524be8b
+0, 29, 29, 1, 152064, 0xa437dadc
+0, 30, 30, 1, 152064, 0xff00b440
+0, 31, 31, 1, 152064, 0x4bd1bf15
+0, 32, 32, 1, 152064, 0x1f46a3ea
+0, 33, 33, 1, 152064, 0x60b47c5e
+0, 34, 34, 1, 152064, 0x45117ac6
+0, 35, 35, 1, 152064, 0x43894fca
+0, 36, 36, 1, 152064, 0x21572b55
+0, 37, 37, 1, 152064, 0xe96def09
+0, 38, 38, 1, 152064, 0x4d2ab41f
+0, 39, 39, 1, 152064, 0x072d6b06
+0, 40, 40, 1, 152064, 0x81865687
+0, 41, 41, 1, 152064, 0x8d9a0ea6
+0, 42, 42, 1, 152064, 0x1484d3cd
+0, 43, 43, 1, 152064, 0xbdabae6b
+0, 44, 44, 1, 152064, 0x4211edbe
+0, 45, 45, 1, 152064, 0xd84dad6d
+0, 46, 46, 1, 152064, 0xe4e79344
+0, 47, 47, 1, 152064, 0x9c1addd7
+0, 48, 48, 1, 152064, 0xdcf94283
+0, 49, 49, 1, 152064, 0x6bd005b2
+0, 50, 50, 1, 152064, 0x9679bd10
+0, 51, 51, 1, 152064, 0x052064ab
+0, 52, 52, 1, 152064, 0x915db3f3
+0, 53, 53, 1, 152064, 0xec2fbd58
+0, 54, 54, 1, 152064, 0x26728258
+0, 55, 55, 1, 152064, 0x2b2b617f
+0, 56, 56, 1, 152064, 0x2339eb3d
+0, 57, 57, 1, 152064, 0xcf6e6773
+0, 58, 58, 1, 152064, 0xb993efe4
+0, 59, 59, 1, 152064, 0x4054253d
+0, 60, 60, 1, 152064, 0x4befe5b5
+0, 61, 61, 1, 152064, 0x0678c0fa
+0, 62, 62, 1, 152064, 0xe3c54a03
+0, 63, 63, 1, 152064, 0xffa3210c
+0, 64, 64, 1, 152064, 0xed04b823
+0, 65, 65, 1, 152064, 0x00926457
+0, 66, 66, 1, 152064, 0xd56aaaf0
+0, 67, 67, 1, 152064, 0x6047ef6e
+0, 68, 68, 1, 152064, 0x44316d07
+0, 69, 69, 1, 152064, 0xe8a879b7
+0, 70, 70, 1, 152064, 0x1856cd86
+0, 71, 71, 1, 152064, 0x6528349a
+0, 72, 72, 1, 152064, 0xdeff676e
+0, 73, 73, 1, 152064, 0xda412e47
+0, 74, 74, 1, 152064, 0xa2c2a96f
+0, 75, 75, 1, 152064, 0xc703b8cd
+0, 76, 76, 1, 152064, 0x20b0650b
+0, 77, 77, 1, 152064, 0x8c14faa5
+0, 78, 78, 1, 152064, 0xa442706c
+0, 79, 79, 1, 152064, 0x6e456137
+0, 80, 80, 1, 152064, 0x6dde11c6
+0, 81, 81, 1, 152064, 0xb017978a
+0, 82, 82, 1, 152064, 0xc0bad34b
+0, 83, 83, 1, 152064, 0x8bd439ee
+0, 84, 84, 1, 152064, 0xa92735e4
+0, 85, 85, 1, 152064, 0x1623f501
+0, 86, 86, 1, 152064, 0x5be980b2
+0, 87, 87, 1, 152064, 0x4306b9bf
+0, 88, 88, 1, 152064, 0xb4f18976
+0, 89, 89, 1, 152064, 0x4ffb9b46
+0, 90, 90, 1, 152064, 0x23082275
+0, 91, 91, 1, 152064, 0xc7f0e087
+0, 92, 92, 1, 152064, 0x68b95327
+0, 93, 93, 1, 152064, 0xd030a8e4
+0, 94, 94, 1, 152064, 0xf8f9615c
+0, 95, 95, 1, 152064, 0x1b26fe3e
+0, 96, 96, 1, 152064, 0x3381608d
+0, 97, 97, 1, 152064, 0x9939d49d
+0, 98, 98, 1, 152064, 0x575f4f94
+0, 99, 99, 1, 152064, 0x436c581c
+0, 100, 100, 1, 152064, 0x8f47aa58
+0, 101, 101, 1, 152064, 0xd251d95a
+0, 102, 102, 1, 152064, 0x3c33b32c
+0, 103, 103, 1, 152064, 0xa1e19413
+0, 104, 104, 1, 152064, 0x8d95cbad
+0, 105, 105, 1, 152064, 0x98cbd35e
+0, 106, 106, 1, 152064, 0xceb81a0f
+0, 107, 107, 1, 152064, 0x5490fab1
+0, 108, 108, 1, 152064, 0x8e57a38c
+0, 109, 109, 1, 152064, 0xc379517a
+0, 110, 110, 1, 152064, 0xafc4f747
+0, 111, 111, 1, 152064, 0xbc9c9be4
+0, 112, 112, 1, 152064, 0xd602b2f5
+0, 113, 113, 1, 152064, 0x8d85a450
+0, 114, 114, 1, 152064, 0x48183c74
+0, 115, 115, 1, 152064, 0xd1725590
+0, 116, 116, 1, 152064, 0x5ef42ed7
+0, 117, 117, 1, 152064, 0xad3a3883
+0, 118, 118, 1, 152064, 0x7a3e0ddd
+0, 119, 119, 1, 152064, 0x59bdfd38
+0, 120, 120, 1, 152064, 0x5ac3ba9f
+0, 121, 121, 1, 152064, 0x266cbd00
+0, 122, 122, 1, 152064, 0x97d29e00
+0, 123, 123, 1, 152064, 0x620774c2
+0, 124, 124, 1, 152064, 0xaae8b96f
+0, 125, 125, 1, 152064, 0x5f6bdfb6
+0, 126, 126, 1, 152064, 0xb239da53
+0, 127, 127, 1, 152064, 0x654b5680
+0, 128, 128, 1, 152064, 0xd796b723
+0, 129, 129, 1, 152064, 0xd5c84a81
+0, 130, 130, 1, 152064, 0x2a761652
+0, 131, 131, 1, 152064, 0x1137e145
+0, 132, 132, 1, 152064, 0x1a9a451b
+0, 133, 133, 1, 152064, 0x5ca751c4
+0, 134, 134, 1, 152064, 0x074acec7
+0, 135, 135, 1, 152064, 0x9ddfe77d
+0, 136, 136, 1, 152064, 0xfb211c29
+0, 137, 137, 1, 152064, 0x681ad4dd
+0, 138, 138, 1, 152064, 0x702c12cc
+0, 139, 139, 1, 152064, 0x556c5101
+0, 140, 140, 1, 152064, 0x39d4bb54
+0, 141, 141, 1, 152064, 0xa3a118d6
+0, 142, 142, 1, 152064, 0xb78b7db1
+0, 143, 143, 1, 152064, 0x4e20eed5
+0, 144, 144, 1, 152064, 0x6555a9df
+0, 145, 145, 1, 152064, 0xb607a9a4
+0, 146, 146, 1, 152064, 0x3cf96a94
+0, 147, 147, 1, 152064, 0xb2679007
+0, 148, 148, 1, 152064, 0xf09d5b85
+0, 149, 149, 1, 152064, 0x3961ba07
+0, 150, 150, 1, 152064, 0x0c28363a
+0, 151, 151, 1, 152064, 0x0a017c2d
+0, 152, 152, 1, 152064, 0x3a661de3
+0, 153, 153, 1, 152064, 0xf8d1bdee
+0, 154, 154, 1, 152064, 0x6f47791b
+0, 155, 155, 1, 152064, 0xe05b22c6
+0, 156, 156, 1, 152064, 0x7cc93bb0
+0, 157, 157, 1, 152064, 0xeb90c3d8
+0, 158, 158, 1, 152064, 0x1a1eac98
+0, 159, 159, 1, 152064, 0x92985671
+0, 160, 160, 1, 152064, 0x2fe3ce53
+0, 161, 161, 1, 152064, 0x61def691
+0, 162, 162, 1, 152064, 0x90820730
+0, 163, 163, 1, 152064, 0x17630372
+0, 164, 164, 1, 152064, 0xaf6cea12
+0, 165, 165, 1, 152064, 0xfe3b7ecc
+0, 166, 166, 1, 152064, 0x904a5b2e
+0, 167, 167, 1, 152064, 0x0d88d5f2
+0, 168, 168, 1, 152064, 0x498d22b1
+0, 169, 169, 1, 152064, 0x56baba83
+0, 170, 170, 1, 152064, 0xda4d6dfa
+0, 171, 171, 1, 152064, 0xaa38cbdd
+0, 172, 172, 1, 152064, 0x4077f15d
+0, 173, 173, 1, 152064, 0x7e006ec2
+0, 174, 174, 1, 152064, 0x59964a89
+0, 175, 175, 1, 152064, 0x04c078e3
+0, 176, 176, 1, 152064, 0x7a5faf97
+0, 177, 177, 1, 152064, 0xc517b3e9
+0, 178, 178, 1, 152064, 0xfcc81af5
+0, 179, 179, 1, 152064, 0xdcb44f62
+0, 180, 180, 1, 152064, 0x2a080b72
+0, 181, 181, 1, 152064, 0x91f88c67
+0, 182, 182, 1, 152064, 0xd39caf81
+0, 183, 183, 1, 152064, 0x0764ae31
+0, 184, 184, 1, 152064, 0x0ddb82ed
+0, 185, 185, 1, 152064, 0xed6d17e4
+0, 186, 186, 1, 152064, 0xb4f74712
+0, 187, 187, 1, 152064, 0x23a20787
+0, 188, 188, 1, 152064, 0x853e7b33
+0, 189, 189, 1, 152064, 0xc6bac173
+0, 190, 190, 1, 152064, 0xb590ec15
+0, 191, 191, 1, 152064, 0xfdd2943c
+0, 192, 192, 1, 152064, 0xba5d1160
+0, 193, 193, 1, 152064, 0xe732c5a7
+0, 194, 194, 1, 152064, 0x279f6ce9
+0, 195, 195, 1, 152064, 0xb3835829
+0, 196, 196, 1, 152064, 0x0901b2a1
+0, 197, 197, 1, 152064, 0x3df2b8f8
+0, 198, 198, 1, 152064, 0x374496a4
+0, 199, 199, 1, 152064, 0x1bc6a4ae
+0, 200, 200, 1, 152064, 0xdb4b372e
+0, 201, 201, 1, 152064, 0x8c11c214
+0, 202, 202, 1, 152064, 0xd2d5c093
+0, 203, 203, 1, 152064, 0x8dda094e
+0, 204, 204, 1, 152064, 0x9b2cc401
+0, 205, 205, 1, 152064, 0x1a3b49d5
+0, 206, 206, 1, 152064, 0xaf5342ff
+0, 207, 207, 1, 152064, 0x74c0de83
+0, 208, 208, 1, 152064, 0xcf486137
+0, 209, 209, 1, 152064, 0xcf005b3b
+0, 210, 210, 1, 152064, 0x86a64c55
+0, 211, 211, 1, 152064, 0xdd3f7ae9
+0, 212, 212, 1, 152064, 0xb0d01e53
+0, 213, 213, 1, 152064, 0x83219065
+0, 214, 214, 1, 152064, 0x17a35d27
+0, 215, 215, 1, 152064, 0xf92645b5
+0, 216, 216, 1, 152064, 0x8322bdbf
+0, 217, 217, 1, 152064, 0xd589f6a2
+0, 218, 218, 1, 152064, 0x80a62d9e
+0, 219, 219, 1, 152064, 0x05b3e0d1
+0, 220, 220, 1, 152064, 0xd657aa0b
+0, 221, 221, 1, 152064, 0xec5ac2dd
+0, 222, 222, 1, 152064, 0xbf0ff969
+0, 223, 223, 1, 152064, 0xc34a5140
+0, 224, 224, 1, 152064, 0x814705c4
+0, 225, 225, 1, 152064, 0xe9592008
+0, 226, 226, 1, 152064, 0xf12c933c
+0, 227, 227, 1, 152064, 0x2daee178
+0, 228, 228, 1, 152064, 0xa2573028
+0, 229, 229, 1, 152064, 0x6109f58d
+0, 230, 230, 1, 152064, 0x64ab8ce4
+0, 231, 231, 1, 152064, 0x13a88b6e
+0, 232, 232, 1, 152064, 0x8f0181a9
+0, 233, 233, 1, 152064, 0xd5295fd4
+0, 234, 234, 1, 152064, 0xfdbeeb0d
+0, 235, 235, 1, 152064, 0x05ecd231
+0, 236, 236, 1, 152064, 0x48d164cd
+0, 237, 237, 1, 152064, 0xc279cf63
+0, 238, 238, 1, 152064, 0x1d5e6a03
+0, 239, 239, 1, 152064, 0xd9dc1807
+0, 240, 240, 1, 152064, 0xbcc83676
+0, 241, 241, 1, 152064, 0x65a9811e
+0, 242, 242, 1, 152064, 0x3ccfe5a8
+0, 243, 243, 1, 152064, 0x2f2ff051
+0, 244, 244, 1, 152064, 0x9193e093
+0, 245, 245, 1, 152064, 0x9a30fdc6
+0, 246, 246, 1, 152064, 0x90b7ea10
+0, 247, 247, 1, 152064, 0x3291910c
+0, 248, 248, 1, 152064, 0x2335d186
+0, 249, 249, 1, 152064, 0x2890cf1d
+0, 250, 250, 1, 152064, 0x8c8b6245
+0, 251, 251, 1, 152064, 0x24b84eda
+0, 252, 252, 1, 152064, 0x04a12446
+0, 253, 253, 1, 152064, 0xd9d91d51
+0, 254, 254, 1, 152064, 0xbf450adf
+0, 255, 255, 1, 152064, 0xa19a9a41
+0, 256, 256, 1, 152064, 0x2211ab01
+0, 257, 257, 1, 152064, 0x8fe85430
+0, 258, 258, 1, 152064, 0x5a152861
+0, 259, 259, 1, 152064, 0x7fe76995
+0, 260, 260, 1, 152064, 0x508b99cd
+0, 261, 261, 1, 152064, 0x92e79437
+0, 262, 262, 1, 152064, 0x8572eac9
+0, 263, 263, 1, 152064, 0x42e3d513
+0, 264, 264, 1, 152064, 0x6bee9e38
+0, 265, 265, 1, 152064, 0x2858ad4b
+0, 266, 266, 1, 152064, 0x96d87d00
+0, 267, 267, 1, 152064, 0x749f1032
+0, 268, 268, 1, 152064, 0x668fca6c
+0, 269, 269, 1, 152064, 0x11d278d9
+0, 270, 270, 1, 152064, 0x10fd46ea
+0, 271, 271, 1, 152064, 0xc8b193c8
+0, 272, 272, 1, 152064, 0x035e7d02
+0, 273, 273, 1, 152064, 0x067f583c
+0, 274, 274, 1, 152064, 0xd9648a1e
+0, 275, 275, 1, 152064, 0x92487b7e
+0, 276, 276, 1, 152064, 0xc7b35421
+0, 277, 277, 1, 152064, 0x2ed57c1c
+0, 278, 278, 1, 152064, 0xefe24c5f
+0, 279, 279, 1, 152064, 0x8df0118b
+0, 280, 280, 1, 152064, 0x18f0278d
+0, 281, 281, 1, 152064, 0x63ac45ad
+0, 282, 282, 1, 152064, 0xd79849f0
+0, 283, 283, 1, 152064, 0x1f1d4dab
+0, 284, 284, 1, 152064, 0x736fb5b8
+0, 285, 285, 1, 152064, 0xc24eb80c
+0, 286, 286, 1, 152064, 0x64ca3b11
+0, 287, 287, 1, 152064, 0x35d8674c
+0, 288, 288, 1, 152064, 0x3c5a7b51
+0, 289, 289, 1, 152064, 0x97550b81
+0, 290, 290, 1, 152064, 0x731454b5
+0, 291, 291, 1, 152064, 0x01de43bc
+0, 292, 292, 1, 152064, 0xbda7afae
+0, 293, 293, 1, 152064, 0xeb34d714
+0, 294, 294, 1, 152064, 0x1260cc98
+0, 295, 295, 1, 152064, 0x7e592c36
+0, 296, 296, 1, 152064, 0x40b3676e
+0, 297, 297, 1, 152064, 0x8c9d6b94
+0, 298, 298, 1, 152064, 0xc7988665
+0, 299, 299, 1, 152064, 0xf2994d52
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-pph10i1_panasonic_a b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-pph10i1_panasonic_a
index 1cfc313..91e3436 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-pph10i1_panasonic_a
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-pph10i1_panasonic_a
@@ -1,10 +1,11 @@
-0, 0, 2764800, 0xcc4df07d
-0, 3600, 2764800, 0x85f9e6d4
-0, 7200, 2764800, 0x23ffe90d
-0, 10800, 2764800, 0xf0a6d453
-0, 14400, 2764800, 0x913a6392
-0, 18000, 2764800, 0xcc5f9736
-0, 21600, 2764800, 0x43f9f9ce
-0, 25200, 2764800, 0xc874b44e
-0, 28800, 2764800, 0x83b665e6
-0, 32400, 2764800, 0x5ea2e31e
+#tb 0: 1/25
+0, 0, 0, 1, 2764800, 0xcc4df07d
+0, 1, 1, 1, 2764800, 0x85f9e6d4
+0, 2, 2, 1, 2764800, 0x23ffe90d
+0, 3, 3, 1, 2764800, 0xf0a6d453
+0, 4, 4, 1, 2764800, 0x913a6392
+0, 5, 5, 1, 2764800, 0xcc5f9736
+0, 6, 6, 1, 2764800, 0x43f9f9ce
+0, 7, 7, 1, 2764800, 0xc874b44e
+0, 8, 8, 1, 2764800, 0x83b665e6
+0, 9, 9, 1, 2764800, 0x5ea2e31e
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-pph10i2_panasonic_a b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-pph10i2_panasonic_a
index 274bdaf..1d6d4b5 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-pph10i2_panasonic_a
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-pph10i2_panasonic_a
@@ -1,10 +1,11 @@
-0, 0, 2764800, 0x4f710132
-0, 3600, 2764800, 0x57e5b713
-0, 7200, 2764800, 0xcca01477
-0, 10800, 2764800, 0xa19a95cd
-0, 14400, 2764800, 0x700a757d
-0, 18000, 2764800, 0xd8c6f60f
-0, 21600, 2764800, 0x95a1bbc7
-0, 25200, 2764800, 0x0582077a
-0, 28800, 2764800, 0x91595f91
-0, 32400, 2764800, 0xf5fe034a
+#tb 0: 1/25
+0, 0, 0, 1, 2764800, 0x4f710132
+0, 1, 1, 1, 2764800, 0x57e5b713
+0, 2, 2, 1, 2764800, 0xcca01477
+0, 3, 3, 1, 2764800, 0xa19a95cd
+0, 4, 4, 1, 2764800, 0x700a757d
+0, 5, 5, 1, 2764800, 0xd8c6f60f
+0, 6, 6, 1, 2764800, 0x95a1bbc7
+0, 7, 7, 1, 2764800, 0x0582077a
+0, 8, 8, 1, 2764800, 0x91595f91
+0, 9, 9, 1, 2764800, 0xf5fe034a
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-pph10i3_panasonic_a b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-pph10i3_panasonic_a
index 195e45a..a09e397 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-pph10i3_panasonic_a
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-pph10i3_panasonic_a
@@ -1,10 +1,11 @@
-0, 0, 2764800, 0xda69f69e
-0, 3600, 2764800, 0x29ed832f
-0, 7200, 2764800, 0xb3244cc4
-0, 10800, 2764800, 0xe41a312c
-0, 14400, 2764800, 0xac0b344b
-0, 18000, 2764800, 0xc585aa20
-0, 21600, 2764800, 0x0952054c
-0, 25200, 2764800, 0xd1a02f87
-0, 28800, 2764800, 0xfcbfe87c
-0, 32400, 2764800, 0xe4e9b8a2
+#tb 0: 1/25
+0, 0, 0, 1, 2764800, 0xda69f69e
+0, 1, 1, 1, 2764800, 0x29ed832f
+0, 2, 2, 1, 2764800, 0xb3244cc4
+0, 3, 3, 1, 2764800, 0xe41a312c
+0, 4, 4, 1, 2764800, 0xac0b344b
+0, 5, 5, 1, 2764800, 0xc585aa20
+0, 6, 6, 1, 2764800, 0x0952054c
+0, 7, 7, 1, 2764800, 0xd1a02f87
+0, 8, 8, 1, 2764800, 0xfcbfe87c
+0, 9, 9, 1, 2764800, 0xe4e9b8a2
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-pph10i4_panasonic_a b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-pph10i4_panasonic_a
index a06c457..adec664 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-pph10i4_panasonic_a
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-pph10i4_panasonic_a
@@ -1,10 +1,11 @@
-0, 0, 6220800, 0xca2a2a5e
-0, 3600, 6220800, 0x8009a65e
-0, 7200, 6220800, 0x63e72b3b
-0, 10800, 6220800, 0x7459a1cc
-0, 14400, 6220800, 0x02191aa9
-0, 18000, 6220800, 0x88dca590
-0, 21600, 6220800, 0x4484d484
-0, 25200, 6220800, 0x8afdb53f
-0, 28800, 6220800, 0xd3d6017a
-0, 32400, 6220800, 0xf5162af0
+#tb 0: 1/25
+0, 0, 0, 1, 6220800, 0xca2a2a5e
+0, 1, 1, 1, 6220800, 0x8009a65e
+0, 2, 2, 1, 6220800, 0x63e72b3b
+0, 3, 3, 1, 6220800, 0x7459a1cc
+0, 4, 4, 1, 6220800, 0x02191aa9
+0, 5, 5, 1, 6220800, 0x88dca590
+0, 6, 6, 1, 6220800, 0x4484d484
+0, 7, 7, 1, 6220800, 0x8afdb53f
+0, 8, 8, 1, 6220800, 0xd3d6017a
+0, 9, 9, 1, 6220800, 0xf5162af0
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-pph10i5_panasonic_a b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-pph10i5_panasonic_a
index 1afbac0..a475197 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-pph10i5_panasonic_a
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-pph10i5_panasonic_a
@@ -1,10 +1,11 @@
-0, 0, 6220800, 0x1df58ce9
-0, 3600, 6220800, 0x8f2859ce
-0, 7200, 6220800, 0x229cc7ff
-0, 10800, 6220800, 0x73e86984
-0, 14400, 6220800, 0xb6d4504b
-0, 18000, 6220800, 0x4e7d4883
-0, 21600, 6220800, 0xbec3f0f7
-0, 25200, 6220800, 0x1d9af065
-0, 28800, 6220800, 0x44851549
-0, 32400, 6220800, 0xfcf8728e
+#tb 0: 1/25
+0, 0, 0, 1, 6220800, 0x1df58ce9
+0, 1, 1, 1, 6220800, 0x8f2859ce
+0, 2, 2, 1, 6220800, 0x229cc7ff
+0, 3, 3, 1, 6220800, 0x73e86984
+0, 4, 4, 1, 6220800, 0xb6d4504b
+0, 5, 5, 1, 6220800, 0x4e7d4883
+0, 6, 6, 1, 6220800, 0xbec3f0f7
+0, 7, 7, 1, 6220800, 0x1d9af065
+0, 8, 8, 1, 6220800, 0x44851549
+0, 9, 9, 1, 6220800, 0xfcf8728e
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-pph10i6_panasonic_a b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-pph10i6_panasonic_a
index 6d10546..25d0eec 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-pph10i6_panasonic_a
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-pph10i6_panasonic_a
@@ -1,10 +1,11 @@
-0, 0, 6220800, 0x408daf70
-0, 3600, 6220800, 0x59b254a3
-0, 7200, 6220800, 0x4cf4279c
-0, 10800, 6220800, 0x5c9437ae
-0, 14400, 6220800, 0x986c3eb8
-0, 18000, 6220800, 0x23fd883e
-0, 21600, 6220800, 0x84f222fe
-0, 25200, 6220800, 0xe7f91107
-0, 28800, 6220800, 0xb544b31e
-0, 32400, 6220800, 0x1ebdde56
+#tb 0: 1/25
+0, 0, 0, 1, 6220800, 0x408daf70
+0, 1, 1, 1, 6220800, 0x59b254a3
+0, 2, 2, 1, 6220800, 0x4cf4279c
+0, 3, 3, 1, 6220800, 0x5c9437ae
+0, 4, 4, 1, 6220800, 0x986c3eb8
+0, 5, 5, 1, 6220800, 0x23fd883e
+0, 6, 6, 1, 6220800, 0x84f222fe
+0, 7, 7, 1, 6220800, 0xe7f91107
+0, 8, 8, 1, 6220800, 0xb544b31e
+0, 9, 9, 1, 6220800, 0x1ebdde56
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-pph10i7_panasonic_a b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-pph10i7_panasonic_a
index 2882544..1090b49 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-pph10i7_panasonic_a
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-frext-pph10i7_panasonic_a
@@ -1,10 +1,11 @@
-0, 0, 6220800, 0xf81873fe
-0, 3600, 6220800, 0x7b96fbdc
-0, 7200, 6220800, 0x75dbafc4
-0, 10800, 6220800, 0x7524301e
-0, 14400, 6220800, 0x0f3621ab
-0, 18000, 6220800, 0xa5e25b35
-0, 21600, 6220800, 0x063a8116
-0, 25200, 6220800, 0x48ebc8ff
-0, 28800, 6220800, 0x1f635df8
-0, 32400, 6220800, 0xe282c8bd
+#tb 0: 1/25
+0, 0, 0, 1, 6220800, 0xf81873fe
+0, 1, 1, 1, 6220800, 0x7b96fbdc
+0, 2, 2, 1, 6220800, 0x75dbafc4
+0, 3, 3, 1, 6220800, 0x7524301e
+0, 4, 4, 1, 6220800, 0x0f3621ab
+0, 5, 5, 1, 6220800, 0xa5e25b35
+0, 6, 6, 1, 6220800, 0x063a8116
+0, 7, 7, 1, 6220800, 0x48ebc8ff
+0, 8, 8, 1, 6220800, 0x1f635df8
+0, 9, 9, 1, 6220800, 0xe282c8bd
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-hcbp2_hhi_a b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-hcbp2_hhi_a
index 87a9db1..977107e 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-hcbp2_hhi_a
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-hcbp2_hhi_a
@@ -1,250 +1,251 @@
-0, 0, 152064, 0xf9deb95a
-0, 3600, 152064, 0xdce9c541
-0, 7200, 152064, 0xc45a8a77
-0, 10800, 152064, 0x5132a470
-0, 14400, 152064, 0x65542c98
-0, 18000, 152064, 0x2df95883
-0, 21600, 152064, 0x9f4f1280
-0, 25200, 152064, 0x11c9f32c
-0, 28800, 152064, 0x66535f0c
-0, 32400, 152064, 0x5b13770c
-0, 36000, 152064, 0xadcd3278
-0, 39600, 152064, 0x06e00e91
-0, 43200, 152064, 0x1fa1886f
-0, 46800, 152064, 0xd524b6a3
-0, 50400, 152064, 0x45f82b73
-0, 54000, 152064, 0x0fd301aa
-0, 57600, 152064, 0x2983acdd
-0, 61200, 152064, 0xe74004c6
-0, 64800, 152064, 0xe279328a
-0, 68400, 152064, 0x85be8f85
-0, 72000, 152064, 0xec503b6b
-0, 75600, 152064, 0x3d4495db
-0, 79200, 152064, 0x3a9774d2
-0, 82800, 152064, 0x80a07a42
-0, 86400, 152064, 0x484427ce
-0, 90000, 152064, 0x9e6b773f
-0, 93600, 152064, 0xd3be5f07
-0, 97200, 152064, 0x69a76c5e
-0, 100800, 152064, 0xd448fde2
-0, 104400, 152064, 0x04a34635
-0, 108000, 152064, 0xd4e3e0e1
-0, 111600, 152064, 0x2564cf13
-0, 115200, 152064, 0x98bc5167
-0, 118800, 152064, 0xcf06991f
-0, 122400, 152064, 0x3edf621f
-0, 126000, 152064, 0x47039967
-0, 129600, 152064, 0x299636b5
-0, 133200, 152064, 0x2bc0849d
-0, 136800, 152064, 0xe94946a6
-0, 140400, 152064, 0x5a5768ac
-0, 144000, 152064, 0xfe4ce9cd
-0, 147600, 152064, 0xbeb34b2e
-0, 151200, 152064, 0xa26020e3
-0, 154800, 152064, 0xb2514c55
-0, 158400, 152064, 0x723be4b1
-0, 162000, 152064, 0xeef4434e
-0, 165600, 152064, 0x1237e1db
-0, 169200, 152064, 0x4814c1fb
-0, 172800, 152064, 0xe7544446
-0, 176400, 152064, 0xd93a53d9
-0, 180000, 152064, 0x90e029c6
-0, 183600, 152064, 0xfa493dfc
-0, 187200, 152064, 0x081fa2d9
-0, 190800, 152064, 0x9782ef8c
-0, 194400, 152064, 0x1daf911c
-0, 198000, 152064, 0xc9058a57
-0, 201600, 152064, 0x68a90f04
-0, 205200, 152064, 0xc7115091
-0, 208800, 152064, 0xe9731898
-0, 212400, 152064, 0xd7bc206e
-0, 216000, 152064, 0xf760baac
-0, 219600, 152064, 0x6f9700e3
-0, 223200, 152064, 0xec54b42d
-0, 226800, 152064, 0x0dc5bf77
-0, 230400, 152064, 0x196e33c3
-0, 234000, 152064, 0x090cae46
-0, 237600, 152064, 0x06897499
-0, 241200, 152064, 0xf54cd959
-0, 244800, 152064, 0x24167906
-0, 248400, 152064, 0xea06e67b
-0, 252000, 152064, 0xa97ed69c
-0, 255600, 152064, 0x03c4ce82
-0, 259200, 152064, 0xca864ddd
-0, 262800, 152064, 0x1bc9956f
-0, 266400, 152064, 0x7864908c
-0, 270000, 152064, 0x52f3be55
-0, 273600, 152064, 0x78b469b5
-0, 277200, 152064, 0x8b3bb23e
-0, 280800, 152064, 0x5bed7f47
-0, 284400, 152064, 0x401b7e9c
-0, 288000, 152064, 0x4cbc3193
-0, 291600, 152064, 0xa00b7ed2
-0, 295200, 152064, 0xda548927
-0, 298800, 152064, 0x30a5cffb
-0, 302400, 152064, 0x9536bdf0
-0, 306000, 152064, 0x927e3cf4
-0, 309600, 152064, 0x95533148
-0, 313200, 152064, 0x763c553a
-0, 316800, 152064, 0x7010f280
-0, 320400, 152064, 0xa537667c
-0, 324000, 152064, 0xe599927a
-0, 327600, 152064, 0x72dde2ab
-0, 331200, 152064, 0x02089d51
-0, 334800, 152064, 0x4ca8231a
-0, 338400, 152064, 0x90b126aa
-0, 342000, 152064, 0x65a9260f
-0, 345600, 152064, 0xf37cf34a
-0, 349200, 152064, 0xf21f63f6
-0, 352800, 152064, 0x95209e85
-0, 356400, 152064, 0x0df00a65
-0, 360000, 152064, 0x0ce71e2b
-0, 363600, 152064, 0x6cbf8843
-0, 367200, 152064, 0x17f29296
-0, 370800, 152064, 0x88278aa9
-0, 374400, 152064, 0x84ad74d0
-0, 378000, 152064, 0xda48eea1
-0, 381600, 152064, 0xcaf33b25
-0, 385200, 152064, 0x9b288538
-0, 388800, 152064, 0xd1b7561f
-0, 392400, 152064, 0x4bfcbdac
-0, 396000, 152064, 0x1dd5b920
-0, 399600, 152064, 0xde50ceeb
-0, 403200, 152064, 0xa552963b
-0, 406800, 152064, 0xb2f5ef15
-0, 410400, 152064, 0x5abf061c
-0, 414000, 152064, 0x9b4c45f6
-0, 417600, 152064, 0xe61d1b02
-0, 421200, 152064, 0xe5728c4e
-0, 424800, 152064, 0xcb944655
-0, 428400, 152064, 0x648b951a
-0, 432000, 152064, 0xc3671a38
-0, 435600, 152064, 0x7d3fbcf3
-0, 439200, 152064, 0x3c0ba1c5
-0, 442800, 152064, 0xf5ac0d3a
-0, 446400, 152064, 0x87faf534
-0, 450000, 152064, 0xb3f05d11
-0, 453600, 152064, 0x825e3423
-0, 457200, 152064, 0xade45431
-0, 460800, 152064, 0x7715d496
-0, 464400, 152064, 0x983c45fa
-0, 468000, 152064, 0xe8d621d8
-0, 471600, 152064, 0x71ec7553
-0, 475200, 152064, 0xb20d5556
-0, 478800, 152064, 0xfa6bd00b
-0, 482400, 152064, 0x2a18acf1
-0, 486000, 152064, 0xa241c342
-0, 489600, 152064, 0xa3597426
-0, 493200, 152064, 0x6f72ff61
-0, 496800, 152064, 0xceffe8af
-0, 500400, 152064, 0x76853b09
-0, 504000, 152064, 0x3f58cc0c
-0, 507600, 152064, 0x16080a6d
-0, 511200, 152064, 0x752ae0aa
-0, 514800, 152064, 0x7dadf81b
-0, 518400, 152064, 0x9828aa7c
-0, 522000, 152064, 0x05a51e04
-0, 525600, 152064, 0xf9a92ae6
-0, 529200, 152064, 0xce0169f9
-0, 532800, 152064, 0x784d405b
-0, 536400, 152064, 0x531b9869
-0, 540000, 152064, 0xdf6a6129
-0, 543600, 152064, 0x5cdf5aac
-0, 547200, 152064, 0x28dd0050
-0, 550800, 152064, 0x76bd5ea7
-0, 554400, 152064, 0xcf3036bf
-0, 558000, 152064, 0x20365c0d
-0, 561600, 152064, 0x171ad303
-0, 565200, 152064, 0x1388416d
-0, 568800, 152064, 0x9b92f171
-0, 572400, 152064, 0xe2bc377a
-0, 576000, 152064, 0x90639e6c
-0, 579600, 152064, 0x1b50e759
-0, 583200, 152064, 0x43a9b680
-0, 586800, 152064, 0xb1780015
-0, 590400, 152064, 0x9a6783a6
-0, 594000, 152064, 0x1471e2e4
-0, 597600, 152064, 0xb1899be2
-0, 601200, 152064, 0x2facd37c
-0, 604800, 152064, 0x197361fc
-0, 608400, 152064, 0x823ffce1
-0, 612000, 152064, 0x9ce3cb14
-0, 615600, 152064, 0x16620232
-0, 619200, 152064, 0x4fedb29e
-0, 622800, 152064, 0xb45cd8b4
-0, 626400, 152064, 0x84387e9d
-0, 630000, 152064, 0xd5017ca0
-0, 633600, 152064, 0x106002a5
-0, 637200, 152064, 0x20c44a82
-0, 640800, 152064, 0x0694fbb2
-0, 644400, 152064, 0x849cfdf3
-0, 648000, 152064, 0xef827c85
-0, 651600, 152064, 0xc04ecde3
-0, 655200, 152064, 0x2f81bee2
-0, 658800, 152064, 0x86dbe8cc
-0, 662400, 152064, 0x9ee67bcd
-0, 666000, 152064, 0xa2618f39
-0, 669600, 152064, 0x35a40f36
-0, 673200, 152064, 0x9f6b0b54
-0, 676800, 152064, 0xcee2c0b5
-0, 680400, 152064, 0x3c3cb8f3
-0, 684000, 152064, 0xf3ab2e21
-0, 687600, 152064, 0xc51afcbc
-0, 691200, 152064, 0x272bbb4d
-0, 694800, 152064, 0x1448f2cc
-0, 698400, 152064, 0xd286e217
-0, 702000, 152064, 0xd6abf89e
-0, 705600, 152064, 0xf908bb8a
-0, 709200, 152064, 0x8a17ddd6
-0, 712800, 152064, 0xc30d9039
-0, 716400, 152064, 0xb8c6a557
-0, 720000, 152064, 0xf1675620
-0, 723600, 152064, 0xbb41b898
-0, 727200, 152064, 0x662298b2
-0, 730800, 152064, 0x0f8271aa
-0, 734400, 152064, 0x34d90197
-0, 738000, 152064, 0x15254eb2
-0, 741600, 152064, 0x4d942235
-0, 745200, 152064, 0xa2cefa6a
-0, 748800, 152064, 0x909a7050
-0, 752400, 152064, 0x219abae7
-0, 756000, 152064, 0x0166bc37
-0, 759600, 152064, 0x8b960965
-0, 763200, 152064, 0x71f6af2a
-0, 766800, 152064, 0x8d69f377
-0, 770400, 152064, 0x27b1a17d
-0, 774000, 152064, 0x6b09b049
-0, 777600, 152064, 0x733472e7
-0, 781200, 152064, 0x986efe32
-0, 784800, 152064, 0x99a37cc5
-0, 788400, 152064, 0x82433283
-0, 792000, 152064, 0x4698c0bd
-0, 795600, 152064, 0x1f6ce7f9
-0, 799200, 152064, 0x6e398d44
-0, 802800, 152064, 0x14ae5d85
-0, 806400, 152064, 0xef2f1e28
-0, 810000, 152064, 0x9dfe46ae
-0, 813600, 152064, 0x91997a8f
-0, 817200, 152064, 0x6c828dda
-0, 820800, 152064, 0x723f3f5c
-0, 824400, 152064, 0xcb86883d
-0, 828000, 152064, 0x1c25cbed
-0, 831600, 152064, 0x3cad814a
-0, 835200, 152064, 0xe0d8f5e7
-0, 838800, 152064, 0xaefb35cc
-0, 842400, 152064, 0x5dfc2181
-0, 846000, 152064, 0x13f26603
-0, 849600, 152064, 0x97a3dd0d
-0, 853200, 152064, 0xbecff890
-0, 856800, 152064, 0xd226badc
-0, 860400, 152064, 0x7f4adbd1
-0, 864000, 152064, 0x5da1565a
-0, 867600, 152064, 0x35cbac9c
-0, 871200, 152064, 0xf1b26f8a
-0, 874800, 152064, 0xc8d08d07
-0, 878400, 152064, 0xa9f643c2
-0, 882000, 152064, 0xc420b0ba
-0, 885600, 152064, 0x8871a4f5
-0, 889200, 152064, 0x4e7647b4
-0, 892800, 152064, 0xb4dad812
-0, 896400, 152064, 0x6a3d00d5
+#tb 0: 1/25
+0, 0, 0, 1, 152064, 0xf9deb95a
+0, 1, 1, 1, 152064, 0xdce9c541
+0, 2, 2, 1, 152064, 0xc45a8a77
+0, 3, 3, 1, 152064, 0x5132a470
+0, 4, 4, 1, 152064, 0x65542c98
+0, 5, 5, 1, 152064, 0x2df95883
+0, 6, 6, 1, 152064, 0x9f4f1280
+0, 7, 7, 1, 152064, 0x11c9f32c
+0, 8, 8, 1, 152064, 0x66535f0c
+0, 9, 9, 1, 152064, 0x5b13770c
+0, 10, 10, 1, 152064, 0xadcd3278
+0, 11, 11, 1, 152064, 0x06e00e91
+0, 12, 12, 1, 152064, 0x1fa1886f
+0, 13, 13, 1, 152064, 0xd524b6a3
+0, 14, 14, 1, 152064, 0x45f82b73
+0, 15, 15, 1, 152064, 0x0fd301aa
+0, 16, 16, 1, 152064, 0x2983acdd
+0, 17, 17, 1, 152064, 0xe74004c6
+0, 18, 18, 1, 152064, 0xe279328a
+0, 19, 19, 1, 152064, 0x85be8f85
+0, 20, 20, 1, 152064, 0xec503b6b
+0, 21, 21, 1, 152064, 0x3d4495db
+0, 22, 22, 1, 152064, 0x3a9774d2
+0, 23, 23, 1, 152064, 0x80a07a42
+0, 24, 24, 1, 152064, 0x484427ce
+0, 25, 25, 1, 152064, 0x9e6b773f
+0, 26, 26, 1, 152064, 0xd3be5f07
+0, 27, 27, 1, 152064, 0x69a76c5e
+0, 28, 28, 1, 152064, 0xd448fde2
+0, 29, 29, 1, 152064, 0x04a34635
+0, 30, 30, 1, 152064, 0xd4e3e0e1
+0, 31, 31, 1, 152064, 0x2564cf13
+0, 32, 32, 1, 152064, 0x98bc5167
+0, 33, 33, 1, 152064, 0xcf06991f
+0, 34, 34, 1, 152064, 0x3edf621f
+0, 35, 35, 1, 152064, 0x47039967
+0, 36, 36, 1, 152064, 0x299636b5
+0, 37, 37, 1, 152064, 0x2bc0849d
+0, 38, 38, 1, 152064, 0xe94946a6
+0, 39, 39, 1, 152064, 0x5a5768ac
+0, 40, 40, 1, 152064, 0xfe4ce9cd
+0, 41, 41, 1, 152064, 0xbeb34b2e
+0, 42, 42, 1, 152064, 0xa26020e3
+0, 43, 43, 1, 152064, 0xb2514c55
+0, 44, 44, 1, 152064, 0x723be4b1
+0, 45, 45, 1, 152064, 0xeef4434e
+0, 46, 46, 1, 152064, 0x1237e1db
+0, 47, 47, 1, 152064, 0x4814c1fb
+0, 48, 48, 1, 152064, 0xe7544446
+0, 49, 49, 1, 152064, 0xd93a53d9
+0, 50, 50, 1, 152064, 0x90e029c6
+0, 51, 51, 1, 152064, 0xfa493dfc
+0, 52, 52, 1, 152064, 0x081fa2d9
+0, 53, 53, 1, 152064, 0x9782ef8c
+0, 54, 54, 1, 152064, 0x1daf911c
+0, 55, 55, 1, 152064, 0xc9058a57
+0, 56, 56, 1, 152064, 0x68a90f04
+0, 57, 57, 1, 152064, 0xc7115091
+0, 58, 58, 1, 152064, 0xe9731898
+0, 59, 59, 1, 152064, 0xd7bc206e
+0, 60, 60, 1, 152064, 0xf760baac
+0, 61, 61, 1, 152064, 0x6f9700e3
+0, 62, 62, 1, 152064, 0xec54b42d
+0, 63, 63, 1, 152064, 0x0dc5bf77
+0, 64, 64, 1, 152064, 0x196e33c3
+0, 65, 65, 1, 152064, 0x090cae46
+0, 66, 66, 1, 152064, 0x06897499
+0, 67, 67, 1, 152064, 0xf54cd959
+0, 68, 68, 1, 152064, 0x24167906
+0, 69, 69, 1, 152064, 0xea06e67b
+0, 70, 70, 1, 152064, 0xa97ed69c
+0, 71, 71, 1, 152064, 0x03c4ce82
+0, 72, 72, 1, 152064, 0xca864ddd
+0, 73, 73, 1, 152064, 0x1bc9956f
+0, 74, 74, 1, 152064, 0x7864908c
+0, 75, 75, 1, 152064, 0x52f3be55
+0, 76, 76, 1, 152064, 0x78b469b5
+0, 77, 77, 1, 152064, 0x8b3bb23e
+0, 78, 78, 1, 152064, 0x5bed7f47
+0, 79, 79, 1, 152064, 0x401b7e9c
+0, 80, 80, 1, 152064, 0x4cbc3193
+0, 81, 81, 1, 152064, 0xa00b7ed2
+0, 82, 82, 1, 152064, 0xda548927
+0, 83, 83, 1, 152064, 0x30a5cffb
+0, 84, 84, 1, 152064, 0x9536bdf0
+0, 85, 85, 1, 152064, 0x927e3cf4
+0, 86, 86, 1, 152064, 0x95533148
+0, 87, 87, 1, 152064, 0x763c553a
+0, 88, 88, 1, 152064, 0x7010f280
+0, 89, 89, 1, 152064, 0xa537667c
+0, 90, 90, 1, 152064, 0xe599927a
+0, 91, 91, 1, 152064, 0x72dde2ab
+0, 92, 92, 1, 152064, 0x02089d51
+0, 93, 93, 1, 152064, 0x4ca8231a
+0, 94, 94, 1, 152064, 0x90b126aa
+0, 95, 95, 1, 152064, 0x65a9260f
+0, 96, 96, 1, 152064, 0xf37cf34a
+0, 97, 97, 1, 152064, 0xf21f63f6
+0, 98, 98, 1, 152064, 0x95209e85
+0, 99, 99, 1, 152064, 0x0df00a65
+0, 100, 100, 1, 152064, 0x0ce71e2b
+0, 101, 101, 1, 152064, 0x6cbf8843
+0, 102, 102, 1, 152064, 0x17f29296
+0, 103, 103, 1, 152064, 0x88278aa9
+0, 104, 104, 1, 152064, 0x84ad74d0
+0, 105, 105, 1, 152064, 0xda48eea1
+0, 106, 106, 1, 152064, 0xcaf33b25
+0, 107, 107, 1, 152064, 0x9b288538
+0, 108, 108, 1, 152064, 0xd1b7561f
+0, 109, 109, 1, 152064, 0x4bfcbdac
+0, 110, 110, 1, 152064, 0x1dd5b920
+0, 111, 111, 1, 152064, 0xde50ceeb
+0, 112, 112, 1, 152064, 0xa552963b
+0, 113, 113, 1, 152064, 0xb2f5ef15
+0, 114, 114, 1, 152064, 0x5abf061c
+0, 115, 115, 1, 152064, 0x9b4c45f6
+0, 116, 116, 1, 152064, 0xe61d1b02
+0, 117, 117, 1, 152064, 0xe5728c4e
+0, 118, 118, 1, 152064, 0xcb944655
+0, 119, 119, 1, 152064, 0x648b951a
+0, 120, 120, 1, 152064, 0xc3671a38
+0, 121, 121, 1, 152064, 0x7d3fbcf3
+0, 122, 122, 1, 152064, 0x3c0ba1c5
+0, 123, 123, 1, 152064, 0xf5ac0d3a
+0, 124, 124, 1, 152064, 0x87faf534
+0, 125, 125, 1, 152064, 0xb3f05d11
+0, 126, 126, 1, 152064, 0x825e3423
+0, 127, 127, 1, 152064, 0xade45431
+0, 128, 128, 1, 152064, 0x7715d496
+0, 129, 129, 1, 152064, 0x983c45fa
+0, 130, 130, 1, 152064, 0xe8d621d8
+0, 131, 131, 1, 152064, 0x71ec7553
+0, 132, 132, 1, 152064, 0xb20d5556
+0, 133, 133, 1, 152064, 0xfa6bd00b
+0, 134, 134, 1, 152064, 0x2a18acf1
+0, 135, 135, 1, 152064, 0xa241c342
+0, 136, 136, 1, 152064, 0xa3597426
+0, 137, 137, 1, 152064, 0x6f72ff61
+0, 138, 138, 1, 152064, 0xceffe8af
+0, 139, 139, 1, 152064, 0x76853b09
+0, 140, 140, 1, 152064, 0x3f58cc0c
+0, 141, 141, 1, 152064, 0x16080a6d
+0, 142, 142, 1, 152064, 0x752ae0aa
+0, 143, 143, 1, 152064, 0x7dadf81b
+0, 144, 144, 1, 152064, 0x9828aa7c
+0, 145, 145, 1, 152064, 0x05a51e04
+0, 146, 146, 1, 152064, 0xf9a92ae6
+0, 147, 147, 1, 152064, 0xce0169f9
+0, 148, 148, 1, 152064, 0x784d405b
+0, 149, 149, 1, 152064, 0x531b9869
+0, 150, 150, 1, 152064, 0xdf6a6129
+0, 151, 151, 1, 152064, 0x5cdf5aac
+0, 152, 152, 1, 152064, 0x28dd0050
+0, 153, 153, 1, 152064, 0x76bd5ea7
+0, 154, 154, 1, 152064, 0xcf3036bf
+0, 155, 155, 1, 152064, 0x20365c0d
+0, 156, 156, 1, 152064, 0x171ad303
+0, 157, 157, 1, 152064, 0x1388416d
+0, 158, 158, 1, 152064, 0x9b92f171
+0, 159, 159, 1, 152064, 0xe2bc377a
+0, 160, 160, 1, 152064, 0x90639e6c
+0, 161, 161, 1, 152064, 0x1b50e759
+0, 162, 162, 1, 152064, 0x43a9b680
+0, 163, 163, 1, 152064, 0xb1780015
+0, 164, 164, 1, 152064, 0x9a6783a6
+0, 165, 165, 1, 152064, 0x1471e2e4
+0, 166, 166, 1, 152064, 0xb1899be2
+0, 167, 167, 1, 152064, 0x2facd37c
+0, 168, 168, 1, 152064, 0x197361fc
+0, 169, 169, 1, 152064, 0x823ffce1
+0, 170, 170, 1, 152064, 0x9ce3cb14
+0, 171, 171, 1, 152064, 0x16620232
+0, 172, 172, 1, 152064, 0x4fedb29e
+0, 173, 173, 1, 152064, 0xb45cd8b4
+0, 174, 174, 1, 152064, 0x84387e9d
+0, 175, 175, 1, 152064, 0xd5017ca0
+0, 176, 176, 1, 152064, 0x106002a5
+0, 177, 177, 1, 152064, 0x20c44a82
+0, 178, 178, 1, 152064, 0x0694fbb2
+0, 179, 179, 1, 152064, 0x849cfdf3
+0, 180, 180, 1, 152064, 0xef827c85
+0, 181, 181, 1, 152064, 0xc04ecde3
+0, 182, 182, 1, 152064, 0x2f81bee2
+0, 183, 183, 1, 152064, 0x86dbe8cc
+0, 184, 184, 1, 152064, 0x9ee67bcd
+0, 185, 185, 1, 152064, 0xa2618f39
+0, 186, 186, 1, 152064, 0x35a40f36
+0, 187, 187, 1, 152064, 0x9f6b0b54
+0, 188, 188, 1, 152064, 0xcee2c0b5
+0, 189, 189, 1, 152064, 0x3c3cb8f3
+0, 190, 190, 1, 152064, 0xf3ab2e21
+0, 191, 191, 1, 152064, 0xc51afcbc
+0, 192, 192, 1, 152064, 0x272bbb4d
+0, 193, 193, 1, 152064, 0x1448f2cc
+0, 194, 194, 1, 152064, 0xd286e217
+0, 195, 195, 1, 152064, 0xd6abf89e
+0, 196, 196, 1, 152064, 0xf908bb8a
+0, 197, 197, 1, 152064, 0x8a17ddd6
+0, 198, 198, 1, 152064, 0xc30d9039
+0, 199, 199, 1, 152064, 0xb8c6a557
+0, 200, 200, 1, 152064, 0xf1675620
+0, 201, 201, 1, 152064, 0xbb41b898
+0, 202, 202, 1, 152064, 0x662298b2
+0, 203, 203, 1, 152064, 0x0f8271aa
+0, 204, 204, 1, 152064, 0x34d90197
+0, 205, 205, 1, 152064, 0x15254eb2
+0, 206, 206, 1, 152064, 0x4d942235
+0, 207, 207, 1, 152064, 0xa2cefa6a
+0, 208, 208, 1, 152064, 0x909a7050
+0, 209, 209, 1, 152064, 0x219abae7
+0, 210, 210, 1, 152064, 0x0166bc37
+0, 211, 211, 1, 152064, 0x8b960965
+0, 212, 212, 1, 152064, 0x71f6af2a
+0, 213, 213, 1, 152064, 0x8d69f377
+0, 214, 214, 1, 152064, 0x27b1a17d
+0, 215, 215, 1, 152064, 0x6b09b049
+0, 216, 216, 1, 152064, 0x733472e7
+0, 217, 217, 1, 152064, 0x986efe32
+0, 218, 218, 1, 152064, 0x99a37cc5
+0, 219, 219, 1, 152064, 0x82433283
+0, 220, 220, 1, 152064, 0x4698c0bd
+0, 221, 221, 1, 152064, 0x1f6ce7f9
+0, 222, 222, 1, 152064, 0x6e398d44
+0, 223, 223, 1, 152064, 0x14ae5d85
+0, 224, 224, 1, 152064, 0xef2f1e28
+0, 225, 225, 1, 152064, 0x9dfe46ae
+0, 226, 226, 1, 152064, 0x91997a8f
+0, 227, 227, 1, 152064, 0x6c828dda
+0, 228, 228, 1, 152064, 0x723f3f5c
+0, 229, 229, 1, 152064, 0xcb86883d
+0, 230, 230, 1, 152064, 0x1c25cbed
+0, 231, 231, 1, 152064, 0x3cad814a
+0, 232, 232, 1, 152064, 0xe0d8f5e7
+0, 233, 233, 1, 152064, 0xaefb35cc
+0, 234, 234, 1, 152064, 0x5dfc2181
+0, 235, 235, 1, 152064, 0x13f26603
+0, 236, 236, 1, 152064, 0x97a3dd0d
+0, 237, 237, 1, 152064, 0xbecff890
+0, 238, 238, 1, 152064, 0xd226badc
+0, 239, 239, 1, 152064, 0x7f4adbd1
+0, 240, 240, 1, 152064, 0x5da1565a
+0, 241, 241, 1, 152064, 0x35cbac9c
+0, 242, 242, 1, 152064, 0xf1b26f8a
+0, 243, 243, 1, 152064, 0xc8d08d07
+0, 244, 244, 1, 152064, 0xa9f643c2
+0, 245, 245, 1, 152064, 0xc420b0ba
+0, 246, 246, 1, 152064, 0x8871a4f5
+0, 247, 247, 1, 152064, 0x4e7647b4
+0, 248, 248, 1, 152064, 0xb4dad812
+0, 249, 249, 1, 152064, 0x6a3d00d5
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-hcmp1_hhi_a b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-hcmp1_hhi_a
index 88b758d..be619da 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-hcmp1_hhi_a
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-hcmp1_hhi_a
@@ -1,250 +1,251 @@
-0, 0, 152064, 0xda244f3f
-0, 3600, 152064, 0x35a1cb02
-0, 7200, 152064, 0xa729d9ca
-0, 10800, 152064, 0x69d90602
-0, 14400, 152064, 0x4ccdae72
-0, 18000, 152064, 0x06f9d8b9
-0, 21600, 152064, 0x0a14a736
-0, 25200, 152064, 0xc344b167
-0, 28800, 152064, 0xf3303e92
-0, 32400, 152064, 0xbe28813f
-0, 36000, 152064, 0x971f4980
-0, 39600, 152064, 0x69124d31
-0, 43200, 152064, 0x6d93e7f2
-0, 46800, 152064, 0x5c1315e4
-0, 50400, 152064, 0xb011cfe4
-0, 54000, 152064, 0x65a0d147
-0, 57600, 152064, 0x463d8c39
-0, 61200, 152064, 0x15f2a757
-0, 64800, 152064, 0xc2418f1f
-0, 68400, 152064, 0x7a48b94c
-0, 72000, 152064, 0x1c079ec9
-0, 75600, 152064, 0x348ced32
-0, 79200, 152064, 0x6014d525
-0, 82800, 152064, 0x146ed41f
-0, 86400, 152064, 0x543177e6
-0, 90000, 152064, 0x79a4b44e
-0, 93600, 152064, 0x4401a7ae
-0, 97200, 152064, 0xc0aec3c1
-0, 100800, 152064, 0x92348852
-0, 104400, 152064, 0x90eece70
-0, 108000, 152064, 0x19efd00f
-0, 111600, 152064, 0x608912ac
-0, 115200, 152064, 0xa707bdb1
-0, 118800, 152064, 0x926e1ffe
-0, 122400, 152064, 0x56863ca8
-0, 126000, 152064, 0xe18e81b4
-0, 129600, 152064, 0xf17466f2
-0, 133200, 152064, 0x2281feef
-0, 136800, 152064, 0x33603b66
-0, 140400, 152064, 0xe30fad28
-0, 144000, 152064, 0x66efb21e
-0, 147600, 152064, 0x405f32d6
-0, 151200, 152064, 0xe90f262b
-0, 154800, 152064, 0xf85144b0
-0, 158400, 152064, 0xcff4feab
-0, 162000, 152064, 0x02b63e49
-0, 165600, 152064, 0x91d9ff77
-0, 169200, 152064, 0x2c6c0d2a
-0, 172800, 152064, 0xacad9e66
-0, 176400, 152064, 0x83951353
-0, 180000, 152064, 0x549c16e4
-0, 183600, 152064, 0xcad9610c
-0, 187200, 152064, 0x264e4b57
-0, 190800, 152064, 0x9758afe8
-0, 194400, 152064, 0x0273a81d
-0, 198000, 152064, 0x31c6f1a0
-0, 201600, 152064, 0x80d1c9cf
-0, 205200, 152064, 0x41b861f7
-0, 208800, 152064, 0xad416fe7
-0, 212400, 152064, 0xdde59bf0
-0, 216000, 152064, 0x886c491c
-0, 219600, 152064, 0x4bf4a21f
-0, 223200, 152064, 0x2581a06e
-0, 226800, 152064, 0x8188cf9b
-0, 230400, 152064, 0xbfaf82ce
-0, 234000, 152064, 0xed9ef8b1
-0, 237600, 152064, 0xf5f4e0c0
-0, 241200, 152064, 0xa24421ac
-0, 244800, 152064, 0xf0cdde38
-0, 248400, 152064, 0x7f211f2c
-0, 252000, 152064, 0x241ff38b
-0, 255600, 152064, 0x19bc25a6
-0, 259200, 152064, 0xd9d5ede9
-0, 262800, 152064, 0x88f98579
-0, 266400, 152064, 0x630da1aa
-0, 270000, 152064, 0x19abf44f
-0, 273600, 152064, 0x3a95d341
-0, 277200, 152064, 0xdeb9333e
-0, 280800, 152064, 0x0c994783
-0, 284400, 152064, 0xb58b7d26
-0, 288000, 152064, 0x6e392b24
-0, 291600, 152064, 0x1f7e2d63
-0, 295200, 152064, 0x732342d3
-0, 298800, 152064, 0xbda4a761
-0, 302400, 152064, 0xdc387777
-0, 306000, 152064, 0xd5d00469
-0, 309600, 152064, 0xc840cf6d
-0, 313200, 152064, 0x3dfef3d9
-0, 316800, 152064, 0xf731594f
-0, 320400, 152064, 0x126fef41
-0, 324000, 152064, 0x5705b1e3
-0, 327600, 152064, 0xa8ecbe94
-0, 331200, 152064, 0xcbcd0e48
-0, 334800, 152064, 0x3da860da
-0, 338400, 152064, 0x97882d5f
-0, 342000, 152064, 0x19803d16
-0, 345600, 152064, 0xa639b969
-0, 349200, 152064, 0xc0a00bc3
-0, 352800, 152064, 0xb12f0617
-0, 356400, 152064, 0x0e53481c
-0, 360000, 152064, 0x1fa0e47d
-0, 363600, 152064, 0x818119fa
-0, 367200, 152064, 0xc28ffc3e
-0, 370800, 152064, 0x8abdfb3c
-0, 374400, 152064, 0x670cb951
-0, 378000, 152064, 0x172808bd
-0, 381600, 152064, 0x6be1ea7f
-0, 385200, 152064, 0x05dbfadc
-0, 388800, 152064, 0xcfcfbcec
-0, 392400, 152064, 0x9306e1d2
-0, 396000, 152064, 0xcf3ccc54
-0, 399600, 152064, 0xf36ad41a
-0, 403200, 152064, 0x751b835b
-0, 406800, 152064, 0x7ebed47b
-0, 410400, 152064, 0x9659d022
-0, 414000, 152064, 0xef7701ae
-0, 417600, 152064, 0x5cdee3b0
-0, 421200, 152064, 0xf6c3ed42
-0, 424800, 152064, 0x412ee2fb
-0, 428400, 152064, 0x309cd2bd
-0, 432000, 152064, 0x50f09af5
-0, 435600, 152064, 0x4a05087a
-0, 439200, 152064, 0xaedc2125
-0, 442800, 152064, 0x54e2692a
-0, 446400, 152064, 0x0403590c
-0, 450000, 152064, 0x8a4c9833
-0, 453600, 152064, 0x36b6893e
-0, 457200, 152064, 0x21fd9204
-0, 460800, 152064, 0xa1cd3bc7
-0, 464400, 152064, 0x3cfa3d18
-0, 468000, 152064, 0xb5f7fefd
-0, 471600, 152064, 0x133cf831
-0, 475200, 152064, 0xcaabdd54
-0, 478800, 152064, 0xcab45366
-0, 482400, 152064, 0x8b6f4c90
-0, 486000, 152064, 0x4de74903
-0, 489600, 152064, 0x2dde0c4f
-0, 493200, 152064, 0x09364c1d
-0, 496800, 152064, 0x610318b9
-0, 500400, 152064, 0xd85109d5
-0, 504000, 152064, 0x27a1eac7
-0, 507600, 152064, 0xafd50e70
-0, 511200, 152064, 0x96ac088c
-0, 514800, 152064, 0x1332091c
-0, 518400, 152064, 0x9d38ce90
-0, 522000, 152064, 0xeff10d8e
-0, 525600, 152064, 0x6c320de3
-0, 529200, 152064, 0xeb683437
-0, 532800, 152064, 0xe8a73715
-0, 536400, 152064, 0x53a27669
-0, 540000, 152064, 0xd5665cdc
-0, 543600, 152064, 0x76bc4f86
-0, 547200, 152064, 0xb5282913
-0, 550800, 152064, 0xf788398b
-0, 554400, 152064, 0xa2a74268
-0, 558000, 152064, 0x1e8c57c4
-0, 561600, 152064, 0x12c0542f
-0, 565200, 152064, 0x8dbe9945
-0, 568800, 152064, 0x0f7583cd
-0, 572400, 152064, 0x814e9e0b
-0, 576000, 152064, 0x39575c04
-0, 579600, 152064, 0x75a07f38
-0, 583200, 152064, 0x8a6247c1
-0, 586800, 152064, 0x0f8d606e
-0, 590400, 152064, 0x7dcc4169
-0, 594000, 152064, 0x039d6df2
-0, 597600, 152064, 0x16b779c4
-0, 601200, 152064, 0x8b3a9767
-0, 604800, 152064, 0x281e6d83
-0, 608400, 152064, 0x7d22a528
-0, 612000, 152064, 0x93778828
-0, 615600, 152064, 0xd54c95fc
-0, 619200, 152064, 0xf4e76d9a
-0, 622800, 152064, 0xaa7ba3fd
-0, 626400, 152064, 0x94d88d91
-0, 630000, 152064, 0xa46b9c34
-0, 633600, 152064, 0x9dcb4d0c
-0, 637200, 152064, 0x347d0983
-0, 640800, 152064, 0x870ecd2b
-0, 644400, 152064, 0x5dafe6d6
-0, 648000, 152064, 0x10d77857
-0, 651600, 152064, 0xddc1d127
-0, 655200, 152064, 0x2732a13c
-0, 658800, 152064, 0x3d81bac9
-0, 662400, 152064, 0x619d3dd3
-0, 666000, 152064, 0x2db3e1ac
-0, 669600, 152064, 0x63a7e7e5
-0, 673200, 152064, 0x902a4c92
-0, 676800, 152064, 0x9c38e0f6
-0, 680400, 152064, 0x8ceb3a46
-0, 684000, 152064, 0x73cbb6bd
-0, 687600, 152064, 0x5f6fa7d6
-0, 691200, 152064, 0x8cdad086
-0, 694800, 152064, 0xe7cf083f
-0, 698400, 152064, 0x18c0f6b9
-0, 702000, 152064, 0xfe582ddf
-0, 705600, 152064, 0x5fca4740
-0, 709200, 152064, 0x072981ab
-0, 712800, 152064, 0xcb874172
-0, 716400, 152064, 0xfa153e05
-0, 720000, 152064, 0x259ae495
-0, 723600, 152064, 0x1714beb4
-0, 727200, 152064, 0xa051721e
-0, 730800, 152064, 0x52d17b85
-0, 734400, 152064, 0x9cbf5da3
-0, 738000, 152064, 0x28d69092
-0, 741600, 152064, 0xbdb942e7
-0, 745200, 152064, 0xeefe2253
-0, 748800, 152064, 0xbef2af4d
-0, 752400, 152064, 0x622dee36
-0, 756000, 152064, 0x61decf4e
-0, 759600, 152064, 0x8dfefdbe
-0, 763200, 152064, 0x78d67e90
-0, 766800, 152064, 0x9cddaa58
-0, 770400, 152064, 0x8d487f4d
-0, 774000, 152064, 0x67f58715
-0, 777600, 152064, 0xc9203f22
-0, 781200, 152064, 0x0fec8343
-0, 784800, 152064, 0xb57e7b6a
-0, 788400, 152064, 0xa2ed7700
-0, 792000, 152064, 0x34722cad
-0, 795600, 152064, 0x02c83b2a
-0, 799200, 152064, 0x91b11583
-0, 802800, 152064, 0x7676166d
-0, 806400, 152064, 0x76a9d5fc
-0, 810000, 152064, 0x4fcd1750
-0, 813600, 152064, 0xaa6ff7bf
-0, 817200, 152064, 0x5e2bfab6
-0, 820800, 152064, 0x3abec811
-0, 824400, 152064, 0x0711eb85
-0, 828000, 152064, 0xb10ebf41
-0, 831600, 152064, 0x32d8cb56
-0, 835200, 152064, 0x9b1ca411
-0, 838800, 152064, 0x771f0768
-0, 842400, 152064, 0x69e1258e
-0, 846000, 152064, 0xe8b352e2
-0, 849600, 152064, 0x3ee638d8
-0, 853200, 152064, 0x0bc48414
-0, 856800, 152064, 0xc1df5925
-0, 860400, 152064, 0xb30f705e
-0, 864000, 152064, 0x90654127
-0, 867600, 152064, 0x000e5f43
-0, 871200, 152064, 0x1f5e5e15
-0, 874800, 152064, 0x4aa48433
-0, 878400, 152064, 0xb74a56a3
-0, 882000, 152064, 0x94347a06
-0, 885600, 152064, 0xd14e58d4
-0, 889200, 152064, 0x60116d97
-0, 892800, 152064, 0xf2962979
-0, 896400, 152064, 0x7f176514
+#tb 0: 1/25
+0, 0, 0, 1, 152064, 0xda244f3f
+0, 1, 1, 1, 152064, 0x35a1cb02
+0, 2, 2, 1, 152064, 0xa729d9ca
+0, 3, 3, 1, 152064, 0x69d90602
+0, 4, 4, 1, 152064, 0x4ccdae72
+0, 5, 5, 1, 152064, 0x06f9d8b9
+0, 6, 6, 1, 152064, 0x0a14a736
+0, 7, 7, 1, 152064, 0xc344b167
+0, 8, 8, 1, 152064, 0xf3303e92
+0, 9, 9, 1, 152064, 0xbe28813f
+0, 10, 10, 1, 152064, 0x971f4980
+0, 11, 11, 1, 152064, 0x69124d31
+0, 12, 12, 1, 152064, 0x6d93e7f2
+0, 13, 13, 1, 152064, 0x5c1315e4
+0, 14, 14, 1, 152064, 0xb011cfe4
+0, 15, 15, 1, 152064, 0x65a0d147
+0, 16, 16, 1, 152064, 0x463d8c39
+0, 17, 17, 1, 152064, 0x15f2a757
+0, 18, 18, 1, 152064, 0xc2418f1f
+0, 19, 19, 1, 152064, 0x7a48b94c
+0, 20, 20, 1, 152064, 0x1c079ec9
+0, 21, 21, 1, 152064, 0x348ced32
+0, 22, 22, 1, 152064, 0x6014d525
+0, 23, 23, 1, 152064, 0x146ed41f
+0, 24, 24, 1, 152064, 0x543177e6
+0, 25, 25, 1, 152064, 0x79a4b44e
+0, 26, 26, 1, 152064, 0x4401a7ae
+0, 27, 27, 1, 152064, 0xc0aec3c1
+0, 28, 28, 1, 152064, 0x92348852
+0, 29, 29, 1, 152064, 0x90eece70
+0, 30, 30, 1, 152064, 0x19efd00f
+0, 31, 31, 1, 152064, 0x608912ac
+0, 32, 32, 1, 152064, 0xa707bdb1
+0, 33, 33, 1, 152064, 0x926e1ffe
+0, 34, 34, 1, 152064, 0x56863ca8
+0, 35, 35, 1, 152064, 0xe18e81b4
+0, 36, 36, 1, 152064, 0xf17466f2
+0, 37, 37, 1, 152064, 0x2281feef
+0, 38, 38, 1, 152064, 0x33603b66
+0, 39, 39, 1, 152064, 0xe30fad28
+0, 40, 40, 1, 152064, 0x66efb21e
+0, 41, 41, 1, 152064, 0x405f32d6
+0, 42, 42, 1, 152064, 0xe90f262b
+0, 43, 43, 1, 152064, 0xf85144b0
+0, 44, 44, 1, 152064, 0xcff4feab
+0, 45, 45, 1, 152064, 0x02b63e49
+0, 46, 46, 1, 152064, 0x91d9ff77
+0, 47, 47, 1, 152064, 0x2c6c0d2a
+0, 48, 48, 1, 152064, 0xacad9e66
+0, 49, 49, 1, 152064, 0x83951353
+0, 50, 50, 1, 152064, 0x549c16e4
+0, 51, 51, 1, 152064, 0xcad9610c
+0, 52, 52, 1, 152064, 0x264e4b57
+0, 53, 53, 1, 152064, 0x9758afe8
+0, 54, 54, 1, 152064, 0x0273a81d
+0, 55, 55, 1, 152064, 0x31c6f1a0
+0, 56, 56, 1, 152064, 0x80d1c9cf
+0, 57, 57, 1, 152064, 0x41b861f7
+0, 58, 58, 1, 152064, 0xad416fe7
+0, 59, 59, 1, 152064, 0xdde59bf0
+0, 60, 60, 1, 152064, 0x886c491c
+0, 61, 61, 1, 152064, 0x4bf4a21f
+0, 62, 62, 1, 152064, 0x2581a06e
+0, 63, 63, 1, 152064, 0x8188cf9b
+0, 64, 64, 1, 152064, 0xbfaf82ce
+0, 65, 65, 1, 152064, 0xed9ef8b1
+0, 66, 66, 1, 152064, 0xf5f4e0c0
+0, 67, 67, 1, 152064, 0xa24421ac
+0, 68, 68, 1, 152064, 0xf0cdde38
+0, 69, 69, 1, 152064, 0x7f211f2c
+0, 70, 70, 1, 152064, 0x241ff38b
+0, 71, 71, 1, 152064, 0x19bc25a6
+0, 72, 72, 1, 152064, 0xd9d5ede9
+0, 73, 73, 1, 152064, 0x88f98579
+0, 74, 74, 1, 152064, 0x630da1aa
+0, 75, 75, 1, 152064, 0x19abf44f
+0, 76, 76, 1, 152064, 0x3a95d341
+0, 77, 77, 1, 152064, 0xdeb9333e
+0, 78, 78, 1, 152064, 0x0c994783
+0, 79, 79, 1, 152064, 0xb58b7d26
+0, 80, 80, 1, 152064, 0x6e392b24
+0, 81, 81, 1, 152064, 0x1f7e2d63
+0, 82, 82, 1, 152064, 0x732342d3
+0, 83, 83, 1, 152064, 0xbda4a761
+0, 84, 84, 1, 152064, 0xdc387777
+0, 85, 85, 1, 152064, 0xd5d00469
+0, 86, 86, 1, 152064, 0xc840cf6d
+0, 87, 87, 1, 152064, 0x3dfef3d9
+0, 88, 88, 1, 152064, 0xf731594f
+0, 89, 89, 1, 152064, 0x126fef41
+0, 90, 90, 1, 152064, 0x5705b1e3
+0, 91, 91, 1, 152064, 0xa8ecbe94
+0, 92, 92, 1, 152064, 0xcbcd0e48
+0, 93, 93, 1, 152064, 0x3da860da
+0, 94, 94, 1, 152064, 0x97882d5f
+0, 95, 95, 1, 152064, 0x19803d16
+0, 96, 96, 1, 152064, 0xa639b969
+0, 97, 97, 1, 152064, 0xc0a00bc3
+0, 98, 98, 1, 152064, 0xb12f0617
+0, 99, 99, 1, 152064, 0x0e53481c
+0, 100, 100, 1, 152064, 0x1fa0e47d
+0, 101, 101, 1, 152064, 0x818119fa
+0, 102, 102, 1, 152064, 0xc28ffc3e
+0, 103, 103, 1, 152064, 0x8abdfb3c
+0, 104, 104, 1, 152064, 0x670cb951
+0, 105, 105, 1, 152064, 0x172808bd
+0, 106, 106, 1, 152064, 0x6be1ea7f
+0, 107, 107, 1, 152064, 0x05dbfadc
+0, 108, 108, 1, 152064, 0xcfcfbcec
+0, 109, 109, 1, 152064, 0x9306e1d2
+0, 110, 110, 1, 152064, 0xcf3ccc54
+0, 111, 111, 1, 152064, 0xf36ad41a
+0, 112, 112, 1, 152064, 0x751b835b
+0, 113, 113, 1, 152064, 0x7ebed47b
+0, 114, 114, 1, 152064, 0x9659d022
+0, 115, 115, 1, 152064, 0xef7701ae
+0, 116, 116, 1, 152064, 0x5cdee3b0
+0, 117, 117, 1, 152064, 0xf6c3ed42
+0, 118, 118, 1, 152064, 0x412ee2fb
+0, 119, 119, 1, 152064, 0x309cd2bd
+0, 120, 120, 1, 152064, 0x50f09af5
+0, 121, 121, 1, 152064, 0x4a05087a
+0, 122, 122, 1, 152064, 0xaedc2125
+0, 123, 123, 1, 152064, 0x54e2692a
+0, 124, 124, 1, 152064, 0x0403590c
+0, 125, 125, 1, 152064, 0x8a4c9833
+0, 126, 126, 1, 152064, 0x36b6893e
+0, 127, 127, 1, 152064, 0x21fd9204
+0, 128, 128, 1, 152064, 0xa1cd3bc7
+0, 129, 129, 1, 152064, 0x3cfa3d18
+0, 130, 130, 1, 152064, 0xb5f7fefd
+0, 131, 131, 1, 152064, 0x133cf831
+0, 132, 132, 1, 152064, 0xcaabdd54
+0, 133, 133, 1, 152064, 0xcab45366
+0, 134, 134, 1, 152064, 0x8b6f4c90
+0, 135, 135, 1, 152064, 0x4de74903
+0, 136, 136, 1, 152064, 0x2dde0c4f
+0, 137, 137, 1, 152064, 0x09364c1d
+0, 138, 138, 1, 152064, 0x610318b9
+0, 139, 139, 1, 152064, 0xd85109d5
+0, 140, 140, 1, 152064, 0x27a1eac7
+0, 141, 141, 1, 152064, 0xafd50e70
+0, 142, 142, 1, 152064, 0x96ac088c
+0, 143, 143, 1, 152064, 0x1332091c
+0, 144, 144, 1, 152064, 0x9d38ce90
+0, 145, 145, 1, 152064, 0xeff10d8e
+0, 146, 146, 1, 152064, 0x6c320de3
+0, 147, 147, 1, 152064, 0xeb683437
+0, 148, 148, 1, 152064, 0xe8a73715
+0, 149, 149, 1, 152064, 0x53a27669
+0, 150, 150, 1, 152064, 0xd5665cdc
+0, 151, 151, 1, 152064, 0x76bc4f86
+0, 152, 152, 1, 152064, 0xb5282913
+0, 153, 153, 1, 152064, 0xf788398b
+0, 154, 154, 1, 152064, 0xa2a74268
+0, 155, 155, 1, 152064, 0x1e8c57c4
+0, 156, 156, 1, 152064, 0x12c0542f
+0, 157, 157, 1, 152064, 0x8dbe9945
+0, 158, 158, 1, 152064, 0x0f7583cd
+0, 159, 159, 1, 152064, 0x814e9e0b
+0, 160, 160, 1, 152064, 0x39575c04
+0, 161, 161, 1, 152064, 0x75a07f38
+0, 162, 162, 1, 152064, 0x8a6247c1
+0, 163, 163, 1, 152064, 0x0f8d606e
+0, 164, 164, 1, 152064, 0x7dcc4169
+0, 165, 165, 1, 152064, 0x039d6df2
+0, 166, 166, 1, 152064, 0x16b779c4
+0, 167, 167, 1, 152064, 0x8b3a9767
+0, 168, 168, 1, 152064, 0x281e6d83
+0, 169, 169, 1, 152064, 0x7d22a528
+0, 170, 170, 1, 152064, 0x93778828
+0, 171, 171, 1, 152064, 0xd54c95fc
+0, 172, 172, 1, 152064, 0xf4e76d9a
+0, 173, 173, 1, 152064, 0xaa7ba3fd
+0, 174, 174, 1, 152064, 0x94d88d91
+0, 175, 175, 1, 152064, 0xa46b9c34
+0, 176, 176, 1, 152064, 0x9dcb4d0c
+0, 177, 177, 1, 152064, 0x347d0983
+0, 178, 178, 1, 152064, 0x870ecd2b
+0, 179, 179, 1, 152064, 0x5dafe6d6
+0, 180, 180, 1, 152064, 0x10d77857
+0, 181, 181, 1, 152064, 0xddc1d127
+0, 182, 182, 1, 152064, 0x2732a13c
+0, 183, 183, 1, 152064, 0x3d81bac9
+0, 184, 184, 1, 152064, 0x619d3dd3
+0, 185, 185, 1, 152064, 0x2db3e1ac
+0, 186, 186, 1, 152064, 0x63a7e7e5
+0, 187, 187, 1, 152064, 0x902a4c92
+0, 188, 188, 1, 152064, 0x9c38e0f6
+0, 189, 189, 1, 152064, 0x8ceb3a46
+0, 190, 190, 1, 152064, 0x73cbb6bd
+0, 191, 191, 1, 152064, 0x5f6fa7d6
+0, 192, 192, 1, 152064, 0x8cdad086
+0, 193, 193, 1, 152064, 0xe7cf083f
+0, 194, 194, 1, 152064, 0x18c0f6b9
+0, 195, 195, 1, 152064, 0xfe582ddf
+0, 196, 196, 1, 152064, 0x5fca4740
+0, 197, 197, 1, 152064, 0x072981ab
+0, 198, 198, 1, 152064, 0xcb874172
+0, 199, 199, 1, 152064, 0xfa153e05
+0, 200, 200, 1, 152064, 0x259ae495
+0, 201, 201, 1, 152064, 0x1714beb4
+0, 202, 202, 1, 152064, 0xa051721e
+0, 203, 203, 1, 152064, 0x52d17b85
+0, 204, 204, 1, 152064, 0x9cbf5da3
+0, 205, 205, 1, 152064, 0x28d69092
+0, 206, 206, 1, 152064, 0xbdb942e7
+0, 207, 207, 1, 152064, 0xeefe2253
+0, 208, 208, 1, 152064, 0xbef2af4d
+0, 209, 209, 1, 152064, 0x622dee36
+0, 210, 210, 1, 152064, 0x61decf4e
+0, 211, 211, 1, 152064, 0x8dfefdbe
+0, 212, 212, 1, 152064, 0x78d67e90
+0, 213, 213, 1, 152064, 0x9cddaa58
+0, 214, 214, 1, 152064, 0x8d487f4d
+0, 215, 215, 1, 152064, 0x67f58715
+0, 216, 216, 1, 152064, 0xc9203f22
+0, 217, 217, 1, 152064, 0x0fec8343
+0, 218, 218, 1, 152064, 0xb57e7b6a
+0, 219, 219, 1, 152064, 0xa2ed7700
+0, 220, 220, 1, 152064, 0x34722cad
+0, 221, 221, 1, 152064, 0x02c83b2a
+0, 222, 222, 1, 152064, 0x91b11583
+0, 223, 223, 1, 152064, 0x7676166d
+0, 224, 224, 1, 152064, 0x76a9d5fc
+0, 225, 225, 1, 152064, 0x4fcd1750
+0, 226, 226, 1, 152064, 0xaa6ff7bf
+0, 227, 227, 1, 152064, 0x5e2bfab6
+0, 228, 228, 1, 152064, 0x3abec811
+0, 229, 229, 1, 152064, 0x0711eb85
+0, 230, 230, 1, 152064, 0xb10ebf41
+0, 231, 231, 1, 152064, 0x32d8cb56
+0, 232, 232, 1, 152064, 0x9b1ca411
+0, 233, 233, 1, 152064, 0x771f0768
+0, 234, 234, 1, 152064, 0x69e1258e
+0, 235, 235, 1, 152064, 0xe8b352e2
+0, 236, 236, 1, 152064, 0x3ee638d8
+0, 237, 237, 1, 152064, 0x0bc48414
+0, 238, 238, 1, 152064, 0xc1df5925
+0, 239, 239, 1, 152064, 0xb30f705e
+0, 240, 240, 1, 152064, 0x90654127
+0, 241, 241, 1, 152064, 0x000e5f43
+0, 242, 242, 1, 152064, 0x1f5e5e15
+0, 243, 243, 1, 152064, 0x4aa48433
+0, 244, 244, 1, 152064, 0xb74a56a3
+0, 245, 245, 1, 152064, 0x94347a06
+0, 246, 246, 1, 152064, 0xd14e58d4
+0, 247, 247, 1, 152064, 0x60116d97
+0, 248, 248, 1, 152064, 0xf2962979
+0, 249, 249, 1, 152064, 0x7f176514
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-ls_sva_d b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-ls_sva_d
index d458641..9d1d219 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-ls_sva_d
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-ls_sva_d
@@ -1,1700 +1,1701 @@
-0, 0, 38016, 0x85d20fc6
-0, 3600, 38016, 0xc0432c21
-0, 7200, 38016, 0x1450168f
-0, 10800, 38016, 0xeddb1833
-0, 14400, 38016, 0x631216d4
-0, 18000, 38016, 0xfcd1138b
-0, 21600, 38016, 0x181f17d5
-0, 25200, 38016, 0x3dc91855
-0, 28800, 38016, 0x92b71924
-0, 32400, 38016, 0xfcb6228d
-0, 36000, 38016, 0x11d04b4a
-0, 39600, 38016, 0x743a6a06
-0, 43200, 38016, 0xac511cc3
-0, 46800, 38016, 0x66bc1e2d
-0, 50400, 38016, 0x6c761ef3
-0, 54000, 38016, 0xa08a1ef5
-0, 57600, 38016, 0x777270da
-0, 61200, 38016, 0x9a738d9f
-0, 64800, 38016, 0x31a8afa2
-0, 68400, 38016, 0x1148cc11
-0, 72000, 38016, 0xf5fa1f26
-0, 75600, 38016, 0xc0481fbc
-0, 79200, 38016, 0x461b2228
-0, 82800, 38016, 0x27bb209d
-0, 86400, 38016, 0xbe921f04
-0, 90000, 38016, 0xabdbd493
-0, 93600, 38016, 0x4f6ad36e
-0, 97200, 38016, 0xe2f8d0ca
-0, 100800, 38016, 0xd82aaea2
-0, 104400, 38016, 0xb208854b
-0, 108000, 38016, 0xfe632920
-0, 111600, 38016, 0x1a8128ce
-0, 115200, 38016, 0xd9ea2be9
-0, 118800, 38016, 0x258b2ab0
-0, 122400, 38016, 0xb5812bef
-0, 126000, 38016, 0x00c92cdf
-0, 129600, 38016, 0x4a6b9f6f
-0, 133200, 38016, 0xb589b0a1
-0, 136800, 38016, 0xf2d0bbca
-0, 140400, 38016, 0xe614cce3
-0, 144000, 38016, 0x6d81d01c
-0, 147600, 38016, 0x7f32d175
-0, 151200, 38016, 0x6abc2f40
-0, 154800, 38016, 0x767d2f6a
-0, 158400, 38016, 0xd64b30cf
-0, 162000, 38016, 0xf83d3000
-0, 165600, 38016, 0x5f3230d5
-0, 169200, 38016, 0x80b330a0
-0, 172800, 38016, 0x42c4326e
-0, 176400, 38016, 0x7cb8d069
-0, 180000, 38016, 0xb7bb9d2f
-0, 183600, 38016, 0xf4f47c47
-0, 187200, 38016, 0xe3455aa0
-0, 190800, 38016, 0x3b074630
-0, 194400, 38016, 0x1fd44e63
-0, 198000, 38016, 0x5ecb6a07
-0, 201600, 38016, 0xe3a130c9
-0, 205200, 38016, 0x307f311a
-0, 208800, 38016, 0x4e2d3202
-0, 212400, 38016, 0x06ac31c1
-0, 216000, 38016, 0x767931ab
-0, 219600, 38016, 0xcb6433aa
-0, 223200, 38016, 0xc88e3597
-0, 226800, 38016, 0xfe06371f
-0, 230400, 38016, 0x9e3c8a14
-0, 234000, 38016, 0xba819e5b
-0, 237600, 38016, 0x0017a693
-0, 241200, 38016, 0x25aca2dd
-0, 244800, 38016, 0x3bf5980d
-0, 248400, 38016, 0x2a0ba2ae
-0, 252000, 38016, 0x99e19853
-0, 255600, 38016, 0x5e7a9699
-0, 259200, 38016, 0x11983c1a
-0, 262800, 38016, 0x5ab53cbf
-0, 266400, 38016, 0x49803f12
-0, 270000, 38016, 0xf1633fdc
-0, 273600, 38016, 0x91de3ff3
-0, 277200, 38016, 0x418942a1
-0, 280800, 38016, 0x670c4277
-0, 284400, 38016, 0xc04e403e
-0, 288000, 38016, 0xa33e40ad
-0, 291600, 38016, 0x7f959a9c
-0, 295200, 38016, 0x096696ae
-0, 298800, 38016, 0xdb41933c
-0, 302400, 38016, 0xb26086b4
-0, 306000, 38016, 0x80c97e07
-0, 309600, 38016, 0xa7416837
-0, 313200, 38016, 0xa82f6342
-0, 316800, 38016, 0x8da16527
-0, 320400, 38016, 0x1c1965a9
-0, 324000, 38016, 0x09ad470c
-0, 327600, 38016, 0x3f694725
-0, 331200, 38016, 0xa7034699
-0, 334800, 38016, 0x38104981
-0, 338400, 38016, 0x216048b7
-0, 342000, 38016, 0x24e04c22
-0, 345600, 38016, 0xbb7e4871
-0, 349200, 38016, 0x8c074b97
-0, 352800, 38016, 0x92aa4b79
-0, 356400, 38016, 0x073c4d97
-0, 360000, 38016, 0xe225f953
-0, 363600, 38016, 0xcaccf96b
-0, 367200, 38016, 0xc395cd82
-0, 370800, 38016, 0x8c61ad55
-0, 374400, 38016, 0x6fb988f2
-0, 378000, 38016, 0x99fe7aea
-0, 381600, 38016, 0xab3c73bf
-0, 385200, 38016, 0xcdb06bc4
-0, 388800, 38016, 0x65a1540a
-0, 392400, 38016, 0xc22f4fb0
-0, 396000, 38016, 0xe5ca4830
-0, 399600, 38016, 0x06b346f9
-0, 403200, 38016, 0x02154629
-0, 406800, 38016, 0x3d5e4467
-0, 410400, 38016, 0x6aa4460c
-0, 414000, 38016, 0x05bc47c4
-0, 417600, 38016, 0xc46e4666
-0, 421200, 38016, 0xc28145f5
-0, 424800, 38016, 0xf57f4811
-0, 428400, 38016, 0x1bbc49f8
-0, 432000, 38016, 0x34e14c2c
-0, 435600, 38016, 0x7e7d7740
-0, 439200, 38016, 0x97d798f3
-0, 442800, 38016, 0x7d71ca3b
-0, 446400, 38016, 0xc6bc0776
-0, 450000, 38016, 0xda052645
-0, 453600, 38016, 0xf0b32de9
-0, 457200, 38016, 0x996f23cf
-0, 460800, 38016, 0x22ea1a43
-0, 464400, 38016, 0xbde61021
-0, 468000, 38016, 0x8180079d
-0, 471600, 38016, 0x3ac6f314
-0, 475200, 38016, 0x93604f67
-0, 478800, 38016, 0xb9a55213
-0, 482400, 38016, 0x89c8523c
-0, 486000, 38016, 0x670a511b
-0, 489600, 38016, 0x62395128
-0, 493200, 38016, 0x01605431
-0, 496800, 38016, 0x677253cd
-0, 500400, 38016, 0xc57f56b1
-0, 504000, 38016, 0x767f5679
-0, 507600, 38016, 0x4abc5717
-0, 511200, 38016, 0x838657dc
-0, 514800, 38016, 0x63bf56ad
-0, 518400, 38016, 0x7019c8ad
-0, 522000, 38016, 0xebbaa7bf
-0, 525600, 38016, 0xebbc8ddb
-0, 529200, 38016, 0xea609f00
-0, 532800, 38016, 0x88e6b1e4
-0, 536400, 38016, 0x7f9edd6b
-0, 540000, 38016, 0xeaf354a6
-0, 543600, 38016, 0xf30274c9
-0, 547200, 38016, 0x05a756da
-0, 550800, 38016, 0xacea1ca6
-0, 554400, 38016, 0x1520d86d
-0, 558000, 38016, 0xb0f7afa4
-0, 561600, 38016, 0xe33c5802
-0, 565200, 38016, 0xce2a58cd
-0, 568800, 38016, 0xd3ad5a30
-0, 572400, 38016, 0x29aa5955
-0, 576000, 38016, 0x59015aef
-0, 579600, 38016, 0x247c5a72
-0, 583200, 38016, 0x79a85b27
-0, 586800, 38016, 0x6cf858fe
-0, 590400, 38016, 0x78ec5b20
-0, 594000, 38016, 0x7cb158c5
-0, 597600, 38016, 0xc52c581f
-0, 601200, 38016, 0x125c58bd
-0, 604800, 38016, 0xf8b257c9
-0, 608400, 38016, 0x20329756
-0, 612000, 38016, 0x60a07c12
-0, 615600, 38016, 0xa2c26ad1
-0, 619200, 38016, 0xcbbc681b
-0, 622800, 38016, 0x2c0562ad
-0, 626400, 38016, 0x8a72640d
-0, 630000, 38016, 0xe6e7756a
-0, 633600, 38016, 0x64608a48
-0, 637200, 38016, 0xe9bea9fa
-0, 640800, 38016, 0x24bac776
-0, 644400, 38016, 0x6aa9d01b
-0, 648000, 38016, 0xf41ebb02
-0, 651600, 38016, 0x28017154
-0, 655200, 38016, 0x3fc55eb4
-0, 658800, 38016, 0xe7bc5f22
-0, 662400, 38016, 0xe6706162
-0, 666000, 38016, 0xee385fe2
-0, 669600, 38016, 0x79c0600b
-0, 673200, 38016, 0x735a603f
-0, 676800, 38016, 0xe7916199
-0, 680400, 38016, 0x542d601d
-0, 684000, 38016, 0xbfaa611a
-0, 687600, 38016, 0xb7504e05
-0, 691200, 38016, 0xd1964339
-0, 694800, 38016, 0x4213278a
-0, 698400, 38016, 0xb503229f
-0, 702000, 38016, 0x166a091c
-0, 705600, 38016, 0x37176bbc
-0, 709200, 38016, 0x95977cc3
-0, 712800, 38016, 0x5bab93f4
-0, 716400, 38016, 0x71d5d142
-0, 720000, 38016, 0x97d1cfa6
-0, 723600, 38016, 0xac82ff20
-0, 727200, 38016, 0x489a1fa1
-0, 730800, 38016, 0x32944930
-0, 734400, 38016, 0x72a2647c
-0, 738000, 38016, 0x95b685d6
-0, 741600, 38016, 0xb7e19840
-0, 745200, 38016, 0x85569129
-0, 748800, 38016, 0x6bc6a197
-0, 752400, 38016, 0x55ccace8
-0, 756000, 38016, 0x9bbdc9c2
-0, 759600, 38016, 0xbce4ade3
-0, 763200, 38016, 0x39c7c48a
-0, 766800, 38016, 0x498ac4aa
-0, 770400, 38016, 0xeda3b715
-0, 774000, 38016, 0x700db089
-0, 777600, 38016, 0xf6b6bf36
-0, 781200, 38016, 0x6abebf1c
-0, 784800, 38016, 0x8855c17c
-0, 788400, 38016, 0xfba09dd5
-0, 792000, 38016, 0xd5868240
-0, 795600, 38016, 0x438074a2
-0, 799200, 38016, 0xc8b2c501
-0, 802800, 38016, 0xd48ec1ef
-0, 806400, 38016, 0xa715c4be
-0, 810000, 38016, 0xd758c281
-0, 813600, 38016, 0x07c25900
-0, 817200, 38016, 0xee7950e6
-0, 820800, 38016, 0x3e154be9
-0, 824400, 38016, 0xa8f33bb7
-0, 828000, 38016, 0xf493bc3c
-0, 831600, 38016, 0x9d69bccb
-0, 835200, 38016, 0xbf9fbafa
-0, 838800, 38016, 0x2e62b9a8
-0, 842400, 38016, 0x2f41bae1
-0, 846000, 38016, 0xd820355d
-0, 849600, 38016, 0xf3623118
-0, 853200, 38016, 0x659b4459
-0, 856800, 38016, 0xdcd74654
-0, 860400, 38016, 0x73f33f73
-0, 864000, 38016, 0xbf96b5ec
-0, 867600, 38016, 0xe9ebb550
-0, 871200, 38016, 0xfe12b5dd
-0, 874800, 38016, 0x9908b6d5
-0, 878400, 38016, 0xe805b8cf
-0, 882000, 38016, 0x1a8eb68a
-0, 885600, 38016, 0x6aed288d
-0, 889200, 38016, 0x162f167f
-0, 892800, 38016, 0x49110ae5
-0, 896400, 38016, 0xab060059
-0, 900000, 38016, 0x0fb8a0a8
-0, 903600, 38016, 0xf3b0b384
-0, 907200, 38016, 0x6f32bb1b
-0, 910800, 38016, 0x7278bb3a
-0, 914400, 38016, 0xdeb1bdcf
-0, 918000, 38016, 0x90efbc5c
-0, 921600, 38016, 0xd2f6bb28
-0, 925200, 38016, 0xba4dba32
-0, 928800, 38016, 0x0751ba19
-0, 932400, 38016, 0xc3f7b9db
-0, 936000, 38016, 0xca22c433
-0, 939600, 38016, 0x82a7e336
-0, 943200, 38016, 0x45e90a19
-0, 946800, 38016, 0x82cd2c11
-0, 950400, 38016, 0x4e2e56cc
-0, 954000, 38016, 0x0ad281c6
-0, 957600, 38016, 0x8685b8b7
-0, 961200, 38016, 0xe502b7b3
-0, 964800, 38016, 0x4898b696
-0, 968400, 38016, 0xe0fcb729
-0, 972000, 38016, 0xe5e0b822
-0, 975600, 38016, 0x9030b82c
-0, 979200, 38016, 0x7dc6b93c
-0, 982800, 38016, 0x727cb981
-0, 986400, 38016, 0xb08999c9
-0, 990000, 38016, 0x3e54b6d7
-0, 993600, 38016, 0x5d15c1e2
-0, 997200, 38016, 0x5840d8d7
-0, 1000800, 38016, 0x1109d730
-0, 1004400, 38016, 0xb898c47e
-0, 1008000, 38016, 0xbde196c6
-0, 1011600, 38016, 0x75999430
-0, 1015200, 38016, 0xa17db11e
-0, 1018800, 38016, 0xb428b220
-0, 1022400, 38016, 0x1537b1ed
-0, 1026000, 38016, 0x102ab213
-0, 1029600, 38016, 0xee38af9e
-0, 1033200, 38016, 0xc9c5b34e
-0, 1036800, 38016, 0x8618af6d
-0, 1040400, 38016, 0x97f3af7a
-0, 1044000, 38016, 0x222eb095
-0, 1047600, 38016, 0xb1508324
-0, 1051200, 38016, 0x2149ad09
-0, 1054800, 38016, 0x67261443
-0, 1058400, 38016, 0x90918df5
-0, 1062000, 38016, 0x5d43e726
-0, 1065600, 38016, 0x1d77dfa3
-0, 1069200, 38016, 0xa60b941c
-0, 1072800, 38016, 0x48813a99
-0, 1076400, 38016, 0x2324b77a
-0, 1080000, 38016, 0xdfd99d0d
-0, 1083600, 38016, 0x44129be1
-0, 1087200, 38016, 0x1137a099
-0, 1090800, 38016, 0xbd24a0a1
-0, 1094400, 38016, 0x3883a310
-0, 1098000, 38016, 0x0680a358
-0, 1101600, 38016, 0xf333a501
-0, 1105200, 38016, 0x3945a6ac
-0, 1108800, 38016, 0x79eea741
-0, 1112400, 38016, 0x8c7aa6b0
-0, 1116000, 38016, 0x0342642f
-0, 1119600, 38016, 0x83632b63
-0, 1123200, 38016, 0x1503ff51
-0, 1126800, 38016, 0xa4bcea0f
-0, 1130400, 38016, 0x37dcd11b
-0, 1134000, 38016, 0x9aa7287a
-0, 1137600, 38016, 0x34deae76
-0, 1141200, 38016, 0x51710057
-0, 1144800, 38016, 0x9ee6fc0a
-0, 1148400, 38016, 0xa419ea79
-0, 1152000, 38016, 0x49388f7e
-0, 1155600, 38016, 0x08498b2d
-0, 1159200, 38016, 0x104f8c4d
-0, 1162800, 38016, 0xdb998d74
-0, 1166400, 38016, 0xd54e8c95
-0, 1170000, 38016, 0x54a48e5e
-0, 1173600, 38016, 0xbe6f8cd0
-0, 1177200, 38016, 0x2a7f8ec2
-0, 1180800, 38016, 0x23848f19
-0, 1184400, 38016, 0x9b168ee3
-0, 1188000, 38016, 0xc2628fb6
-0, 1191600, 38016, 0xe2bdfd4e
-0, 1195200, 38016, 0xfdae1546
-0, 1198800, 38016, 0xb1fe20db
-0, 1202400, 38016, 0x5ebf23f0
-0, 1206000, 38016, 0xecbc1fcb
-0, 1209600, 38016, 0xe72e141c
-0, 1213200, 38016, 0xbad7f54d
-0, 1216800, 38016, 0x95ead3c6
-0, 1220400, 38016, 0xf5c6b948
-0, 1224000, 38016, 0x2f8b80ab
-0, 1227600, 38016, 0x0aed47a7
-0, 1231200, 38016, 0xdcb278e3
-0, 1234800, 38016, 0x2a677958
-0, 1238400, 38016, 0x45427ae8
-0, 1242000, 38016, 0xebce78de
-0, 1245600, 38016, 0xaf007bb1
-0, 1249200, 38016, 0xb4677cdb
-0, 1252800, 38016, 0xbf6d8024
-0, 1256400, 38016, 0xb67180de
-0, 1260000, 38016, 0xb1581358
-0, 1263600, 38016, 0x258f140d
-0, 1267200, 38016, 0x753d17e6
-0, 1270800, 38016, 0xf33816b4
-0, 1274400, 38016, 0x0d011c76
-0, 1278000, 38016, 0x48cfd85d
-0, 1281600, 38016, 0x13ce822d
-0, 1285200, 38016, 0x221a4468
-0, 1288800, 38016, 0x11364be7
-0, 1292400, 38016, 0xafc047b0
-0, 1296000, 38016, 0xeafd4217
-0, 1299600, 38016, 0x930b8a41
-0, 1303200, 38016, 0x2dda0bd2
-0, 1306800, 38016, 0x461cc3f2
-0, 1310400, 38016, 0xa99e962a
-0, 1314000, 38016, 0xc1d954ba
-0, 1317600, 38016, 0x0ce91a87
-0, 1321200, 38016, 0x10701e2d
-0, 1324800, 38016, 0x98c22205
-0, 1328400, 38016, 0xb76622f1
-0, 1332000, 38016, 0x6d1a22d4
-0, 1335600, 38016, 0x00ee23c5
-0, 1339200, 38016, 0xc38125e6
-0, 1342800, 38016, 0x8de52597
-0, 1346400, 38016, 0xec282293
-0, 1350000, 38016, 0xb50f2238
-0, 1353600, 38016, 0xbdcf1f9f
-0, 1357200, 38016, 0x5c6c1780
-0, 1360800, 38016, 0x41941237
-0, 1364400, 38016, 0x95ee1e69
-0, 1368000, 38016, 0x84b65009
-0, 1371600, 38016, 0x27bbf0ab
-0, 1375200, 38016, 0xdd86f4fb
-0, 1378800, 38016, 0x97733086
-0, 1382400, 38016, 0x3241472f
-0, 1386000, 38016, 0x5d050c50
-0, 1389600, 38016, 0x8378aa9b
-0, 1393200, 38016, 0x94f174cd
-0, 1396800, 38016, 0x5825df16
-0, 1400400, 38016, 0x5f362875
-0, 1404000, 38016, 0x30704cd6
-0, 1407600, 38016, 0xc74e3614
-0, 1411200, 38016, 0xe033eb04
-0, 1414800, 38016, 0x665be967
-0, 1418400, 38016, 0x95d5ed67
-0, 1422000, 38016, 0x37dfefc1
-0, 1425600, 38016, 0x1908ee8e
-0, 1429200, 38016, 0xf0cfee38
-0, 1432800, 38016, 0x871df078
-0, 1436400, 38016, 0xb2f2f0f9
-0, 1440000, 38016, 0xf955621f
-0, 1443600, 38016, 0xbd2365a5
-0, 1447200, 38016, 0xe70d6bb0
-0, 1450800, 38016, 0x857e6d00
-0, 1454400, 38016, 0x000d6ee5
-0, 1458000, 38016, 0x9a2f7244
-0, 1461600, 38016, 0xe8c2f83c
-0, 1465200, 38016, 0x23eb0377
-0, 1468800, 38016, 0xe0802a7f
-0, 1472400, 38016, 0x5dbc4d69
-0, 1476000, 38016, 0xa3031f36
-0, 1479600, 38016, 0x27fbb378
-0, 1483200, 38016, 0xeee9a313
-0, 1486800, 38016, 0x189b1e68
-0, 1490400, 38016, 0x9a90678a
-0, 1494000, 38016, 0x1a65ed20
-0, 1497600, 38016, 0x2f51beb7
-0, 1501200, 38016, 0x671ada9d
-0, 1504800, 38016, 0x30af355a
-0, 1508400, 38016, 0x1804d4f9
-0, 1512000, 38016, 0xee227951
-0, 1515600, 38016, 0x20dc3900
-0, 1519200, 38016, 0x334f82dc
-0, 1522800, 38016, 0xb1728506
-0, 1526400, 38016, 0x2236fc10
-0, 1530000, 38016, 0x80d2964d
-0, 1533600, 38016, 0x5e368712
-0, 1537200, 38016, 0x10408765
-0, 1540800, 38016, 0x4b3084c5
-0, 1544400, 38016, 0x975c473f
-0, 1548000, 38016, 0x6f16efa3
-0, 1551600, 38016, 0xe73aac5e
-0, 1555200, 38016, 0x996b6e24
-0, 1558800, 38016, 0x424f6f55
-0, 1562400, 38016, 0x33786d10
-0, 1566000, 38016, 0x8a0f6870
-0, 1569600, 38016, 0x5e8556d4
-0, 1573200, 38016, 0x863b2366
-0, 1576800, 38016, 0x3fa74842
-0, 1580400, 38016, 0x70208948
-0, 1584000, 38016, 0xcf005140
-0, 1587600, 38016, 0xa7585013
-0, 1591200, 38016, 0x61145096
-0, 1594800, 38016, 0x92b952a5
-0, 1598400, 38016, 0x35575235
-0, 1602000, 38016, 0x3e47ec63
-0, 1605600, 38016, 0xfce57b69
-0, 1609200, 38016, 0xf03815e6
-0, 1612800, 38016, 0xb5b6af64
-0, 1616400, 38016, 0x5e3f1b08
-0, 1620000, 38016, 0xd3f9ee61
-0, 1623600, 38016, 0xb8e2ee66
-0, 1627200, 38016, 0x86f8f4b5
-0, 1630800, 38016, 0x23c8f499
-0, 1634400, 38016, 0x634df498
-0, 1638000, 38016, 0xd2b3f570
-0, 1641600, 38016, 0x053e67d3
-0, 1645200, 38016, 0x8d2cbeb3
-0, 1648800, 38016, 0xba0b1e1c
-0, 1652400, 38016, 0x0f5c7d73
-0, 1656000, 38016, 0x46b2118a
-0, 1659600, 38016, 0x818ebae5
-0, 1663200, 38016, 0x4a7af8a9
-0, 1666800, 38016, 0x0c22f937
-0, 1670400, 38016, 0x967ef9b3
-0, 1674000, 38016, 0x530afd34
-0, 1677600, 38016, 0x2a00fdb6
-0, 1681200, 38016, 0xca14f913
-0, 1684800, 38016, 0x82b6f7bc
-0, 1688400, 38016, 0xd32879ec
-0, 1692000, 38016, 0x242b6920
-0, 1695600, 38016, 0x44fd66e4
-0, 1699200, 38016, 0x69d3479c
-0, 1702800, 38016, 0x41a63899
-0, 1706400, 38016, 0xfb370720
-0, 1710000, 38016, 0x5cf0f42d
-0, 1713600, 38016, 0x74e8ca33
-0, 1717200, 38016, 0x1f09cb30
-0, 1720800, 38016, 0xc5e8c1d8
-0, 1724400, 38016, 0x3a82bd74
-0, 1728000, 38016, 0xada0bd71
-0, 1731600, 38016, 0xe695bcc9
-0, 1735200, 38016, 0xc255bb45
-0, 1738800, 38016, 0x6deebbcd
-0, 1742400, 38016, 0x6bf5cef2
-0, 1746000, 38016, 0x8eaed078
-0, 1749600, 38016, 0x3a8addb0
-0, 1753200, 38016, 0x0f2bfe11
-0, 1756800, 38016, 0xe13d2e3b
-0, 1760400, 38016, 0x9bb7606f
-0, 1764000, 38016, 0x9fcc8899
-0, 1767600, 38016, 0xfa22a313
-0, 1771200, 38016, 0xc599b318
-0, 1774800, 38016, 0x33ecb361
-0, 1778400, 38016, 0x2ba8b2df
-0, 1782000, 38016, 0x0debb343
-0, 1785600, 38016, 0x8bbcb7cd
-0, 1789200, 38016, 0x093fbb20
-0, 1792800, 38016, 0x4340c0d2
-0, 1796400, 38016, 0xd765bcb8
-0, 1800000, 38016, 0xe9ea3103
-0, 1803600, 38016, 0x24d7a1ae
-0, 1807200, 38016, 0x9b9ac80f
-0, 1810800, 38016, 0x81b7da0c
-0, 1814400, 38016, 0xb7c5f017
-0, 1818000, 38016, 0xa0e9f9c1
-0, 1821600, 38016, 0x932111a9
-0, 1825200, 38016, 0x15fc17ba
-0, 1828800, 38016, 0x3c7710bd
-0, 1832400, 38016, 0xae1b0ba8
-0, 1836000, 38016, 0x7dc24093
-0, 1839600, 38016, 0x8b9042ad
-0, 1843200, 38016, 0x257f4c1c
-0, 1846800, 38016, 0xaa0442d8
-0, 1850400, 38016, 0xbedd462c
-0, 1854000, 38016, 0xa9bd4905
-0, 1857600, 38016, 0x69d74f50
-0, 1861200, 38016, 0x18143c0d
-0, 1864800, 38016, 0xd2eb5820
-0, 1868400, 38016, 0x94fb5e93
-0, 1872000, 38016, 0x3072f80d
-0, 1875600, 38016, 0xd838f186
-0, 1879200, 38016, 0x3e41e695
-0, 1882800, 38016, 0x66eef2cd
-0, 1886400, 38016, 0x3854ec56
-0, 1890000, 38016, 0x05d3f9c2
-0, 1893600, 38016, 0x53820cc3
-0, 1897200, 38016, 0x09d413ea
-0, 1900800, 38016, 0x82f217f2
-0, 1904400, 38016, 0x07b21d50
-0, 1908000, 38016, 0xd72155c2
-0, 1911600, 38016, 0x20b04c74
-0, 1915200, 38016, 0x5b8962f6
-0, 1918800, 38016, 0xfb8b72c9
-0, 1922400, 38016, 0x6d0f56a7
-0, 1926000, 38016, 0x97876300
-0, 1929600, 38016, 0xfd7f655f
-0, 1933200, 38016, 0x3e405ff6
-0, 1936800, 38016, 0x5ad27a20
-0, 1940400, 38016, 0x46125305
-0, 1944000, 38016, 0x91017b86
-0, 1947600, 38016, 0x5c150c66
-0, 1951200, 38016, 0xc3430969
-0, 1954800, 38016, 0x5f400689
-0, 1958400, 38016, 0x21ddf969
-0, 1962000, 38016, 0x5feff594
-0, 1965600, 38016, 0xb304f3c1
-0, 1969200, 38016, 0xa9c3f70e
-0, 1972800, 38016, 0x6014fa8e
-0, 1976400, 38016, 0x7198f22e
-0, 1980000, 38016, 0xe338e495
-0, 1983600, 38016, 0x9a69ea32
-0, 1987200, 38016, 0xc0cc5d05
-0, 1990800, 38016, 0xefa16044
-0, 1994400, 38016, 0x3e3c6120
-0, 1998000, 38016, 0x06ef63e1
-0, 2001600, 38016, 0x25d5631f
-0, 2005200, 38016, 0xbc8963ee
-0, 2008800, 38016, 0xc2336218
-0, 2012400, 38016, 0xb23965fd
-0, 2016000, 38016, 0x84c9651f
-0, 2019600, 38016, 0x41f6647a
-0, 2023200, 38016, 0xddbe6572
-0, 2026800, 38016, 0x113f65f2
-0, 2030400, 38016, 0x89beec24
-0, 2034000, 38016, 0x6490f37b
-0, 2037600, 38016, 0x15ecf84d
-0, 2041200, 38016, 0xa439f491
-0, 2044800, 38016, 0xda8bf5c4
-0, 2048400, 38016, 0x6bc2f96a
-0, 2052000, 38016, 0x243d0bac
-0, 2055600, 38016, 0xb7c611a2
-0, 2059200, 38016, 0x99243328
-0, 2062800, 38016, 0xa9534571
-0, 2066400, 38016, 0xa5a657bd
-0, 2070000, 38016, 0xd8d06892
-0, 2073600, 38016, 0xb4eb6c8d
-0, 2077200, 38016, 0xa3d36ca8
-0, 2080800, 38016, 0x153a6e9e
-0, 2084400, 38016, 0xf2607081
-0, 2088000, 38016, 0x799d7081
-0, 2091600, 38016, 0x377570cd
-0, 2095200, 38016, 0x90496e54
-0, 2098800, 38016, 0x1d4c746c
-0, 2102400, 38016, 0xbe5e72bb
-0, 2106000, 38016, 0x3c6a760d
-0, 2109600, 38016, 0xd4097614
-0, 2113200, 38016, 0xf45a7a28
-0, 2116800, 38016, 0x8fe37bb8
-0, 2120400, 38016, 0x966295dc
-0, 2124000, 38016, 0xb40da3df
-0, 2127600, 38016, 0x9714b2ac
-0, 2131200, 38016, 0xbdb3c61d
-0, 2134800, 38016, 0x12fcd320
-0, 2138400, 38016, 0x1ee8d858
-0, 2142000, 38016, 0x49e5e217
-0, 2145600, 38016, 0x92aef38e
-0, 2149200, 38016, 0xc26c0476
-0, 2152800, 38016, 0x8eed0e04
-0, 2156400, 38016, 0xe4e3118d
-0, 2160000, 38016, 0x282ce796
-0, 2163600, 38016, 0xbec801e1
-0, 2167200, 38016, 0x864afaf2
-0, 2170800, 38016, 0xe0860383
-0, 2174400, 38016, 0x4261001d
-0, 2178000, 38016, 0x976c0005
-0, 2181600, 38016, 0x69c40af3
-0, 2185200, 38016, 0xb3c00e18
-0, 2188800, 38016, 0x28300c2c
-0, 2192400, 38016, 0xf2d9ff9d
-0, 2196000, 38016, 0xcaeaf979
-0, 2199600, 38016, 0x6733f58e
-0, 2203200, 38016, 0x2bb80869
-0, 2206800, 38016, 0x3c370085
-0, 2210400, 38016, 0x11a2fa2a
-0, 2214000, 38016, 0x828ff770
-0, 2217600, 38016, 0x79bcf490
-0, 2221200, 38016, 0x31d5ee87
-0, 2224800, 38016, 0x6336f00d
-0, 2228400, 38016, 0x058af9d1
-0, 2232000, 38016, 0xff29eb2f
-0, 2235600, 38016, 0x3c3be1f4
-0, 2239200, 38016, 0xfbf5ddc2
-0, 2242800, 38016, 0x22a4d324
-0, 2246400, 38016, 0xb2d4d1d4
-0, 2250000, 38016, 0xa159171f
-0, 2253600, 38016, 0x61a80251
-0, 2257200, 38016, 0xe0429283
-0, 2260800, 38016, 0x5c255bd4
-0, 2264400, 38016, 0xdb0f57ac
-0, 2268000, 38016, 0x3c8bcbf0
-0, 2271600, 38016, 0x2be3d2ef
-0, 2275200, 38016, 0xcd2dc8cc
-0, 2278800, 38016, 0x6905c4cf
-0, 2282400, 38016, 0xd9c9c590
-0, 2286000, 38016, 0xa945cb51
-0, 2289600, 38016, 0x5c8458d3
-0, 2293200, 38016, 0xa1624b6e
-0, 2296800, 38016, 0xb167532e
-0, 2300400, 38016, 0x149d6413
-0, 2304000, 38016, 0x85d97340
-0, 2307600, 38016, 0x8f478203
-0, 2311200, 38016, 0x1902cc8e
-0, 2314800, 38016, 0x1521c5e5
-0, 2318400, 38016, 0xf2d6c7d8
-0, 2322000, 38016, 0x7150c510
-0, 2325600, 38016, 0xfc0ec330
-0, 2329200, 38016, 0x91c4c933
-0, 2332800, 38016, 0x5ec6cbc8
-0, 2336400, 38016, 0x23c0955c
-0, 2340000, 38016, 0x76fb7c27
-0, 2343600, 38016, 0x33c07597
-0, 2347200, 38016, 0x797b6acd
-0, 2350800, 38016, 0xc4945313
-0, 2354400, 38016, 0xa50f25da
-0, 2358000, 38016, 0x7bb6096c
-0, 2361600, 38016, 0x8a1acc48
-0, 2365200, 38016, 0x19a1c9b4
-0, 2368800, 38016, 0x4436cd03
-0, 2372400, 38016, 0xfd73d6fe
-0, 2376000, 38016, 0x25d3d4f0
-0, 2379600, 38016, 0x3acfcd98
-0, 2383200, 38016, 0x2ed3d071
-0, 2386800, 38016, 0x246fd4bd
-0, 2390400, 38016, 0x3e410c62
-0, 2394000, 38016, 0x29da1177
-0, 2397600, 38016, 0x039f1e46
-0, 2401200, 38016, 0x178d1e1a
-0, 2404800, 38016, 0x75561d47
-0, 2408400, 38016, 0x7d65193c
-0, 2412000, 38016, 0xd38d19a8
-0, 2415600, 38016, 0x39c92b20
-0, 2419200, 38016, 0x6c8aebc3
-0, 2422800, 38016, 0xd8d4f9be
-0, 2426400, 38016, 0x7e730a4a
-0, 2430000, 38016, 0xbfae1fee
-0, 2433600, 38016, 0x398f3484
-0, 2437200, 38016, 0xd8e84019
-0, 2440800, 38016, 0x2cf64db3
-0, 2444400, 38016, 0x7e074f09
-0, 2448000, 38016, 0xac384b5a
-0, 2451600, 38016, 0xd28b3a83
-0, 2455200, 38016, 0xa5ce5610
-0, 2458800, 38016, 0xde8565f7
-0, 2462400, 38016, 0x01397a1a
-0, 2466000, 38016, 0xdbdf7fb7
-0, 2469600, 38016, 0x8c1f8ba6
-0, 2473200, 38016, 0xab2a943c
-0, 2476800, 38016, 0x4f8b8421
-0, 2480400, 38016, 0x36f57b3a
-0, 2484000, 38016, 0x565c4dd9
-0, 2487600, 38016, 0x53c34715
-0, 2491200, 38016, 0x38fd4aaa
-0, 2494800, 38016, 0x4dca43eb
-0, 2498400, 38016, 0x1afe40f3
-0, 2502000, 38016, 0xc3dc43cc
-0, 2505600, 38016, 0x1d92431d
-0, 2509200, 38016, 0x3f794765
-0, 2512800, 38016, 0x1c5d4a71
-0, 2516400, 38016, 0xb601531e
-0, 2520000, 38016, 0x4d925d7c
-0, 2523600, 38016, 0x1c605f1e
-0, 2527200, 38016, 0x50ff5608
-0, 2530800, 38016, 0x8da14815
-0, 2534400, 38016, 0x53cc3007
-0, 2538000, 38016, 0x5ce82198
-0, 2541600, 38016, 0x074e15bc
-0, 2545200, 38016, 0x59fb13c9
-0, 2548800, 38016, 0xe28e13a6
-0, 2552400, 38016, 0xcb4f3fa8
-0, 2556000, 38016, 0x7fad560c
-0, 2559600, 38016, 0x7dbc614a
-0, 2563200, 38016, 0xe96f6d9c
-0, 2566800, 38016, 0xf3c47a74
-0, 2570400, 38016, 0xd2af8027
-0, 2574000, 38016, 0x504779d1
-0, 2577600, 38016, 0x876e7f5f
-0, 2581200, 38016, 0x959f8c3d
-0, 2584800, 38016, 0x64d690be
-0, 2588400, 38016, 0xdb899760
-0, 2592000, 38016, 0xbd229ba1
-0, 2595600, 38016, 0xdace575b
-0, 2599200, 38016, 0xfda46324
-0, 2602800, 38016, 0x57b75dbd
-0, 2606400, 38016, 0x264a59cf
-0, 2610000, 38016, 0xfde95cc8
-0, 2613600, 38016, 0x5116601b
-0, 2617200, 38016, 0x72e67205
-0, 2620800, 38016, 0xf1057674
-0, 2624400, 38016, 0x7e917eb9
-0, 2628000, 38016, 0x50ed8b28
-0, 2631600, 38016, 0x357a826c
-0, 2635200, 38016, 0xd68fa449
-0, 2638800, 38016, 0x3a839e39
-0, 2642400, 38016, 0x79469a1b
-0, 2646000, 38016, 0xa9ca9590
-0, 2649600, 38016, 0xbf399686
-0, 2653200, 38016, 0x40499eaf
-0, 2656800, 38016, 0x9972a76d
-0, 2660400, 38016, 0xa3d0aff4
-0, 2664000, 38016, 0xdf27b647
-0, 2667600, 38016, 0x4147c66e
-0, 2671200, 38016, 0x1378d1db
-0, 2674800, 38016, 0x1ca3d444
-0, 2678400, 38016, 0x464d9538
-0, 2682000, 38016, 0xaed28de9
-0, 2685600, 38016, 0xc77a9f86
-0, 2689200, 38016, 0x0882aa10
-0, 2692800, 38016, 0x206ac330
-0, 2696400, 38016, 0x63efd763
-0, 2700000, 38016, 0xbfe2e663
-0, 2703600, 38016, 0xfe6ff1ad
-0, 2707200, 38016, 0x60f9f47e
-0, 2710800, 38016, 0xba1cf0c0
-0, 2714400, 38016, 0x1880eb3d
-0, 2718000, 38016, 0xf0fdd350
-0, 2721600, 38016, 0xb678eedb
-0, 2725200, 38016, 0xa17cf5e4
-0, 2728800, 38016, 0x567fff2a
-0, 2732400, 38016, 0x52ab043b
-0, 2736000, 38016, 0x8e8b0bd9
-0, 2739600, 38016, 0x0f131a7e
-0, 2743200, 38016, 0x26aa2303
-0, 2746800, 38016, 0x70c12bab
-0, 2750400, 38016, 0xa8a93858
-0, 2754000, 38016, 0x289f3b94
-0, 2757600, 38016, 0x3d883605
-0, 2761200, 38016, 0xe171329e
-0, 2764800, 38016, 0x75292865
-0, 2768400, 38016, 0x1d2ac8dc
-0, 2772000, 38016, 0xa336aa94
-0, 2775600, 38016, 0xcede9906
-0, 2779200, 38016, 0x1c9a8b52
-0, 2782800, 38016, 0x2a9c8a78
-0, 2786400, 38016, 0x920a8583
-0, 2790000, 38016, 0xb3ee7e2d
-0, 2793600, 38016, 0x96be75fc
-0, 2797200, 38016, 0x2a8a68d2
-0, 2800800, 38016, 0xdf8e6baf
-0, 2804400, 38016, 0xd46570d1
-0, 2808000, 38016, 0x765b71af
-0, 2811600, 38016, 0x25fe71df
-0, 2815200, 38016, 0x9ca124e3
-0, 2818800, 38016, 0x77c51bab
-0, 2822400, 38016, 0x0b380db9
-0, 2826000, 38016, 0xb0be108b
-0, 2829600, 38016, 0x5c4808b8
-0, 2833200, 38016, 0x73331227
-0, 2836800, 38016, 0xce790cf2
-0, 2840400, 38016, 0x46ac0dfc
-0, 2844000, 38016, 0xdc310caf
-0, 2847600, 38016, 0x909c0606
-0, 2851200, 38016, 0x0756fb3e
-0, 2854800, 38016, 0x4eb0fb0d
-0, 2858400, 38016, 0x6276f6e2
-0, 2862000, 38016, 0x92e0f070
-0, 2865600, 38016, 0x6f2d793f
-0, 2869200, 38016, 0x215f704b
-0, 2872800, 38016, 0xf9b7765e
-0, 2876400, 38016, 0xdb6176bf
-0, 2880000, 38016, 0x2b5165eb
-0, 2883600, 38016, 0xf1145c06
-0, 2887200, 38016, 0x343f698d
-0, 2890800, 38016, 0xcb96713f
-0, 2894400, 38016, 0xc50f775a
-0, 2898000, 38016, 0xbb927e81
-0, 2901600, 38016, 0xa2497bd4
-0, 2905200, 38016, 0xe52b80fa
-0, 2908800, 38016, 0x900f7ac7
-0, 2912400, 38016, 0x77e77d0e
-0, 2916000, 38016, 0xdb33f302
-0, 2919600, 38016, 0xf0519288
-0, 2923200, 38016, 0x4552f487
-0, 2926800, 38016, 0xe7b5f34c
-0, 2930400, 38016, 0x0db18be6
-0, 2934000, 38016, 0xb9ba87c2
-0, 2937600, 38016, 0x1dc2f805
-0, 2941200, 38016, 0x4986f535
-0, 2944800, 38016, 0xc099f301
-0, 2948400, 38016, 0x3d8c6787
-0, 2952000, 38016, 0xd3a4796f
-0, 2955600, 38016, 0xfe01635f
-0, 2959200, 38016, 0xba8df082
-0, 2962800, 38016, 0x55f3f017
-0, 2966400, 38016, 0xf2d7f36a
-0, 2970000, 38016, 0x8bd8f7a1
-0, 2973600, 38016, 0xabcd638b
-0, 2977200, 38016, 0x69ae59ea
-0, 2980800, 38016, 0x5bf43408
-0, 2984400, 38016, 0x6466fd67
-0, 2988000, 38016, 0xc90effb4
-0, 2991600, 38016, 0x82110480
-0, 2995200, 38016, 0xb364f74b
-0, 2998800, 38016, 0x7f1efd76
-0, 3002400, 38016, 0x1a20f30f
-0, 3006000, 38016, 0x4b0fe377
-0, 3009600, 38016, 0x57b4c896
-0, 3013200, 38016, 0x92b1ab52
-0, 3016800, 38016, 0x10ceaf82
-0, 3020400, 38016, 0xc4d3b0b8
-0, 3024000, 38016, 0x68b9f314
-0, 3027600, 38016, 0xc627fd70
-0, 3031200, 38016, 0x5fc108dc
-0, 3034800, 38016, 0x0f1f12d7
-0, 3038400, 38016, 0x6edc208e
-0, 3042000, 38016, 0x91f824eb
-0, 3045600, 38016, 0x1464b836
-0, 3049200, 38016, 0x84c7c412
-0, 3052800, 38016, 0x3e8dd049
-0, 3056400, 38016, 0x493dd1a7
-0, 3060000, 38016, 0x25dfbd00
-0, 3063600, 38016, 0x140bbd33
-0, 3067200, 38016, 0x488e2db6
-0, 3070800, 38016, 0x9e4f2c0a
-0, 3074400, 38016, 0xd60928d3
-0, 3078000, 38016, 0x38b61e0b
-0, 3081600, 38016, 0xb6331660
-0, 3085200, 38016, 0x0a3a0e4c
-0, 3088800, 38016, 0x6ad9105b
-0, 3092400, 38016, 0x29a8cd6b
-0, 3096000, 38016, 0x35e1da7d
-0, 3099600, 38016, 0x824de492
-0, 3103200, 38016, 0x1c76d83c
-0, 3106800, 38016, 0xbe25d98d
-0, 3110400, 38016, 0x5efaf222
-0, 3114000, 38016, 0x17370266
-0, 3117600, 38016, 0x417a2375
-0, 3121200, 38016, 0xb7e423d3
-0, 3124800, 38016, 0x224020fe
-0, 3128400, 38016, 0x4bbe1ee9
-0, 3132000, 38016, 0x72aa1f21
-0, 3135600, 38016, 0xc810126d
-0, 3139200, 38016, 0x42730cd4
-0, 3142800, 38016, 0xfd510c5d
-0, 3146400, 38016, 0x7c6f1313
-0, 3150000, 38016, 0xc1b31b89
-0, 3153600, 38016, 0x57772339
-0, 3157200, 38016, 0x20922349
-0, 3160800, 38016, 0xea4f1a45
-0, 3164400, 38016, 0x79e214d2
-0, 3168000, 38016, 0x77521b5d
-0, 3171600, 38016, 0x5929276c
-0, 3175200, 38016, 0x40b3130d
-0, 3178800, 38016, 0x040a157e
-0, 3182400, 38016, 0x0de31983
-0, 3186000, 38016, 0xdb0a1852
-0, 3189600, 38016, 0x73111b91
-0, 3193200, 38016, 0xf7a61765
-0, 3196800, 38016, 0xc5dd2557
-0, 3200400, 38016, 0xabc32e16
-0, 3204000, 38016, 0x5f093823
-0, 3207600, 38016, 0x9f462f1e
-0, 3211200, 38016, 0x29822c19
-0, 3214800, 38016, 0x259a2697
-0, 3218400, 38016, 0x7ad61867
-0, 3222000, 38016, 0x32fe111f
-0, 3225600, 38016, 0xf65c1142
-0, 3229200, 38016, 0xc5b91a6d
-0, 3232800, 38016, 0x4461191e
-0, 3236400, 38016, 0x0458193a
-0, 3240000, 38016, 0x3ed084a9
-0, 3243600, 38016, 0x4dd28047
-0, 3247200, 38016, 0x18dd8523
-0, 3250800, 38016, 0x4ab87d32
-0, 3254400, 38016, 0xecd0824c
-0, 3258000, 38016, 0xae567d36
-0, 3261600, 38016, 0xfa2e82d0
-0, 3265200, 38016, 0xbce08c2e
-0, 3268800, 38016, 0x125094c4
-0, 3272400, 38016, 0x475e9b1d
-0, 3276000, 38016, 0x9b921150
-0, 3279600, 38016, 0x6f7b1124
-0, 3283200, 38016, 0xa1fe0d8b
-0, 3286800, 38016, 0x12930955
-0, 3290400, 38016, 0x3d981105
-0, 3294000, 38016, 0x92d92e3b
-0, 3297600, 38016, 0x29a33ed5
-0, 3301200, 38016, 0x8d0b578e
-0, 3304800, 38016, 0xda5571ba
-0, 3308400, 38016, 0xbc638172
-0, 3312000, 38016, 0x73fd9abb
-0, 3315600, 38016, 0x53df952b
-0, 3319200, 38016, 0xe1758a4c
-0, 3322800, 38016, 0x064f8812
-0, 3326400, 38016, 0xd9b08971
-0, 3330000, 38016, 0xfe6688a9
-0, 3333600, 38016, 0x3b50938b
-0, 3337200, 38016, 0x4e1a9c13
-0, 3340800, 38016, 0x63599bf0
-0, 3344400, 38016, 0x97e0957f
-0, 3348000, 38016, 0x5a6e98d7
-0, 3351600, 38016, 0xa4be8cf2
-0, 3355200, 38016, 0x53bb901e
-0, 3358800, 38016, 0x15f0994e
-0, 3362400, 38016, 0x71499a4b
-0, 3366000, 38016, 0xf41a87a5
-0, 3369600, 38016, 0x3e237999
-0, 3373200, 38016, 0xf77f5dd2
-0, 3376800, 38016, 0x89874799
-0, 3380400, 38016, 0x02d82294
-0, 3384000, 38016, 0xc5920154
-0, 3387600, 38016, 0x6e61f375
-0, 3391200, 38016, 0x41a6940c
-0, 3394800, 38016, 0x130b97f7
-0, 3398400, 38016, 0xdff09b51
-0, 3402000, 38016, 0xb2999bd6
-0, 3405600, 38016, 0x0bb99d20
-0, 3409200, 38016, 0x9f819633
-0, 3412800, 38016, 0x5bda9640
-0, 3416400, 38016, 0xdcf29321
-0, 3420000, 38016, 0xa6838a63
-0, 3423600, 38016, 0x820a825e
-0, 3427200, 38016, 0x69bb7859
-0, 3430800, 38016, 0x4a8c79c2
-0, 3434400, 38016, 0x1e97e67d
-0, 3438000, 38016, 0x1ad4de1b
-0, 3441600, 38016, 0xe8abeb33
-0, 3445200, 38016, 0xf3a51523
-0, 3448800, 38016, 0xb997399c
-0, 3452400, 38016, 0x9fee8105
-0, 3456000, 38016, 0xf2b6ada3
-0, 3459600, 38016, 0xe6f5bbb3
-0, 3463200, 38016, 0x8ed7ca9f
-0, 3466800, 38016, 0x711abc1a
-0, 3470400, 38016, 0x707ab544
-0, 3474000, 38016, 0x03b8af51
-0, 3477600, 38016, 0x50497b2c
-0, 3481200, 38016, 0x72b57a30
-0, 3484800, 38016, 0xfb6d8164
-0, 3488400, 38016, 0x88618e82
-0, 3492000, 38016, 0xb7369e49
-0, 3495600, 38016, 0x2502a3ca
-0, 3499200, 38016, 0x793aa276
-0, 3502800, 38016, 0x883a8ec6
-0, 3506400, 38016, 0x5f7784e5
-0, 3510000, 38016, 0xddfa7e94
-0, 3513600, 38016, 0xdb877fb8
-0, 3517200, 38016, 0x07e07f39
-0, 3520800, 38016, 0x412590fb
-0, 3524400, 38016, 0x1bd1b527
-0, 3528000, 38016, 0xbb6098c3
-0, 3531600, 38016, 0x5f1b8788
-0, 3535200, 38016, 0x42f068e8
-0, 3538800, 38016, 0x316b53bb
-0, 3542400, 38016, 0xbdbb3fa0
-0, 3546000, 38016, 0xa68f506c
-0, 3549600, 38016, 0xca355d03
-0, 3553200, 38016, 0xfafc6b88
-0, 3556800, 38016, 0x0f106535
-0, 3560400, 38016, 0xa4ae4e63
-0, 3564000, 38016, 0xb206400f
-0, 3567600, 38016, 0x3a5946d1
-0, 3571200, 38016, 0xca739868
-0, 3574800, 38016, 0xe6939d41
-0, 3578400, 38016, 0x2ec19a76
-0, 3582000, 38016, 0x614e96a4
-0, 3585600, 38016, 0x2c2b9348
-0, 3589200, 38016, 0xa00c7f1f
-0, 3592800, 38016, 0x95cb6eca
-0, 3596400, 38016, 0x069d6c4c
-0, 3600000, 38016, 0xe17e03e3
-0, 3603600, 38016, 0xa7491870
-0, 3607200, 38016, 0xacc91e48
-0, 3610800, 38016, 0x99eb1e2a
-0, 3614400, 38016, 0xb2eb1279
-0, 3618000, 38016, 0xa5020c77
-0, 3621600, 38016, 0xde966613
-0, 3625200, 38016, 0xac7f6e1e
-0, 3628800, 38016, 0x1c378a7a
-0, 3632400, 38016, 0x32e6d8a4
-0, 3636000, 38016, 0xecb8d286
-0, 3639600, 38016, 0xa497d941
-0, 3643200, 38016, 0x8ad7d36e
-0, 3646800, 38016, 0xdbd8a91a
-0, 3650400, 38016, 0x718f61d7
-0, 3654000, 38016, 0x862619cf
-0, 3657600, 38016, 0xaa049781
-0, 3661200, 38016, 0xd3986887
-0, 3664800, 38016, 0x9e9f5782
-0, 3668400, 38016, 0x2a9d4f70
-0, 3672000, 38016, 0x62b91421
-0, 3675600, 38016, 0x32313eaa
-0, 3679200, 38016, 0xf9bf1879
-0, 3682800, 38016, 0xc33c0811
-0, 3686400, 38016, 0xe9c21227
-0, 3690000, 38016, 0xf2922db6
-0, 3693600, 38016, 0x669d0627
-0, 3697200, 38016, 0x64c1048a
-0, 3700800, 38016, 0xdd28fa70
-0, 3704400, 38016, 0xd88e8b77
-0, 3708000, 38016, 0x3716bdb8
-0, 3711600, 38016, 0x1834ef57
-0, 3715200, 38016, 0xddb800b7
-0, 3718800, 38016, 0x140302cc
-0, 3722400, 38016, 0x7fa60568
-0, 3726000, 38016, 0x7cc6fd4b
-0, 3729600, 38016, 0xf14c2568
-0, 3733200, 38016, 0x2ee88bbc
-0, 3736800, 38016, 0x915cd143
-0, 3740400, 38016, 0x13ede5fa
-0, 3744000, 38016, 0x6615f63b
-0, 3747600, 38016, 0x8814f54f
-0, 3751200, 38016, 0xb53ef24a
-0, 3754800, 38016, 0xc6a8ee80
-0, 3758400, 38016, 0x9473ee09
-0, 3762000, 38016, 0x9b77d932
-0, 3765600, 38016, 0x142fc69a
-0, 3769200, 38016, 0xb238c6a2
-0, 3772800, 38016, 0x4364d302
-0, 3776400, 38016, 0xde39d174
-0, 3780000, 38016, 0x7fca7fa6
-0, 3783600, 38016, 0x77678d42
-0, 3787200, 38016, 0xaa7e8b68
-0, 3790800, 38016, 0xeecb8c89
-0, 3794400, 38016, 0x6e5e8980
-0, 3798000, 38016, 0x4f4a80de
-0, 3801600, 38016, 0xb3b5cee6
-0, 3805200, 38016, 0x0c72cf1c
-0, 3808800, 38016, 0xd83fd12d
-0, 3812400, 38016, 0x8deeda59
-0, 3816000, 38016, 0xe7fae46e
-0, 3819600, 38016, 0x8233ecd5
-0, 3823200, 38016, 0x0c32808c
-0, 3826800, 38016, 0xf43f8571
-0, 3830400, 38016, 0xae898f01
-0, 3834000, 38016, 0x5a4a99e9
-0, 3837600, 38016, 0x589f9b80
-0, 3841200, 38016, 0x6ca5a33b
-0, 3844800, 38016, 0x3811af0a
-0, 3848400, 38016, 0x8272eda7
-0, 3852000, 38016, 0xa807f046
-0, 3855600, 38016, 0x5b4fec80
-0, 3859200, 38016, 0xb6e6e7fa
-0, 3862800, 38016, 0x250cdb5c
-0, 3866400, 38016, 0x3f38e876
-0, 3870000, 38016, 0x8110e94a
-0, 3873600, 38016, 0x0f19abd7
-0, 3877200, 38016, 0x9e1ca9bd
-0, 3880800, 38016, 0x1f33abae
-0, 3884400, 38016, 0xff18ad65
-0, 3888000, 38016, 0x3d02b300
-0, 3891600, 38016, 0xb7a9b4b2
-0, 3895200, 38016, 0xd8cab454
-0, 3898800, 38016, 0xb48ab772
-0, 3902400, 38016, 0x7f98fe59
-0, 3906000, 38016, 0x786c1795
-0, 3909600, 38016, 0x013437ff
-0, 3913200, 38016, 0xba28622a
-0, 3916800, 38016, 0xf48486e1
-0, 3920400, 38016, 0xc13695c4
-0, 3924000, 38016, 0x1fc5a4d2
-0, 3927600, 38016, 0x016caefd
-0, 3931200, 38016, 0x76b8bc54
-0, 3934800, 38016, 0xcf63bdbc
-0, 3938400, 38016, 0xeb02c0e2
-0, 3942000, 38016, 0xb57dc067
-0, 3945600, 38016, 0x8ec8c058
-0, 3949200, 38016, 0xcb04be49
-0, 3952800, 38016, 0xceccbfac
-0, 3956400, 38016, 0x3408c0c3
-0, 3960000, 38016, 0xee526afa
-0, 3963600, 38016, 0xd7529aad
-0, 3967200, 38016, 0x98bd9221
-0, 3970800, 38016, 0x2fbd7e5a
-0, 3974400, 38016, 0x0fb8a8fc
-0, 3978000, 38016, 0xfd28af91
-0, 3981600, 38016, 0x81db9907
-0, 3985200, 38016, 0x1f0a8ae7
-0, 3988800, 38016, 0xd91e93e3
-0, 3992400, 38016, 0x5fe6b043
-0, 3996000, 38016, 0x2a618a48
-0, 3999600, 38016, 0xef1c8cc2
-0, 4003200, 38016, 0x928595ce
-0, 4006800, 38016, 0xf2a59a43
-0, 4010400, 38016, 0x61bf92d0
-0, 4014000, 38016, 0x584d840f
-0, 4017600, 38016, 0x42177cb1
-0, 4021200, 38016, 0x08867c3b
-0, 4024800, 38016, 0x5a89813b
-0, 4028400, 38016, 0xba558022
-0, 4032000, 38016, 0x3d58878a
-0, 4035600, 38016, 0x8d215911
-0, 4039200, 38016, 0xea27370c
-0, 4042800, 38016, 0x7e2a1a9c
-0, 4046400, 38016, 0xbb86f763
-0, 4050000, 38016, 0xf03fd3c7
-0, 4053600, 38016, 0x1eaac263
-0, 4057200, 38016, 0x8a4bd0e1
-0, 4060800, 38016, 0x5adcf66d
-0, 4064400, 38016, 0xa0320a89
-0, 4068000, 38016, 0x77338f96
-0, 4071600, 38016, 0xf3498f6a
-0, 4075200, 38016, 0x7e248dcf
-0, 4078800, 38016, 0xf7f68dcc
-0, 4082400, 38016, 0x5da597c9
-0, 4086000, 38016, 0x63db9d00
-0, 4089600, 38016, 0xd1f09e52
-0, 4093200, 38016, 0xfc7ba2e1
-0, 4096800, 38016, 0x8c26ab25
-0, 4100400, 38016, 0x6a45add3
-0, 4104000, 38016, 0x0dd7b2a2
-0, 4107600, 38016, 0x70c00c4f
-0, 4111200, 38016, 0x437e255e
-0, 4114800, 38016, 0x63dd455b
-0, 4118400, 38016, 0x01453a2e
-0, 4122000, 38016, 0x08c120af
-0, 4125600, 38016, 0xf3111451
-0, 4129200, 38016, 0xf3f10603
-0, 4132800, 38016, 0xb154fa41
-0, 4136400, 38016, 0x4734ee73
-0, 4140000, 38016, 0x28ca7926
-0, 4143600, 38016, 0xbb628234
-0, 4147200, 38016, 0x0ca1b42f
-0, 4150800, 38016, 0x8397b202
-0, 4154400, 38016, 0x9d92b832
-0, 4158000, 38016, 0x8fbeb4b2
-0, 4161600, 38016, 0x056aa904
-0, 4165200, 38016, 0x4e78a55c
-0, 4168800, 38016, 0xe8a8a265
-0, 4172400, 38016, 0xb703a17b
-0, 4176000, 38016, 0xe79e9d71
-0, 4179600, 38016, 0xbd769f5d
-0, 4183200, 38016, 0x602ea70f
-0, 4186800, 38016, 0x034caf76
-0, 4190400, 38016, 0x28dd9702
-0, 4194000, 38016, 0xc8879c85
-0, 4197600, 38016, 0x15b098f2
-0, 4201200, 38016, 0xf34b9ce5
-0, 4204800, 38016, 0x6d159fbf
-0, 4208400, 38016, 0x22eb9cac
-0, 4212000, 38016, 0xae42a220
-0, 4215600, 38016, 0x1275a131
-0, 4219200, 38016, 0x8188a057
-0, 4222800, 38016, 0x65dea0d1
-0, 4226400, 38016, 0x5bd19be2
-0, 4230000, 38016, 0xfbd99219
-0, 4233600, 38016, 0xad19b3a2
-0, 4237200, 38016, 0xa897bb92
-0, 4240800, 38016, 0x5b1fbf2e
-0, 4244400, 38016, 0x02a5cb24
-0, 4248000, 38016, 0xd6ead6fe
-0, 4251600, 38016, 0x3083de8a
-0, 4255200, 38016, 0xbf1decb4
-0, 4258800, 38016, 0xd92af986
-0, 4262400, 38016, 0x4c520154
-0, 4266000, 38016, 0xd45805a1
-0, 4269600, 38016, 0x25e2084d
-0, 4273200, 38016, 0x4e3d0960
-0, 4276800, 38016, 0x5b449ef2
-0, 4280400, 38016, 0xda15abcc
-0, 4284000, 38016, 0x1b3ba622
-0, 4287600, 38016, 0xaf61a32a
-0, 4291200, 38016, 0xcfa39e3d
-0, 4294800, 38016, 0x8865a56c
-0, 4298400, 38016, 0x3bc9af9b
-0, 4302000, 38016, 0x0a83c081
-0, 4305600, 38016, 0x5ccec976
-0, 4309200, 38016, 0x1f1fc906
-0, 4312800, 38016, 0x1ef6cc46
-0, 4316400, 38016, 0x7776c39e
-0, 4320000, 38016, 0x5860a212
-0, 4323600, 38016, 0x2d9092a3
-0, 4327200, 38016, 0x964d9f81
-0, 4330800, 38016, 0xc35c9691
-0, 4334400, 38016, 0x5e0dc673
-0, 4338000, 38016, 0xada3b7d6
-0, 4341600, 38016, 0x4f3a8d03
-0, 4345200, 38016, 0xfcb4861a
-0, 4348800, 38016, 0xfa908149
-0, 4352400, 38016, 0x6994c514
-0, 4356000, 38016, 0x37c5aaa9
-0, 4359600, 38016, 0x207abcfe
-0, 4363200, 38016, 0x778d7a2d
-0, 4366800, 38016, 0x60b773ff
-0, 4370400, 38016, 0x41cd67d5
-0, 4374000, 38016, 0x3c595a99
-0, 4377600, 38016, 0xd672b14c
-0, 4381200, 38016, 0x7db2c0fd
-0, 4384800, 38016, 0x3d21cf34
-0, 4388400, 38016, 0xdd1cf044
-0, 4392000, 38016, 0xc4594bcb
-0, 4395600, 38016, 0x595e4356
-0, 4399200, 38016, 0x9cc53c0d
-0, 4402800, 38016, 0x78fc325f
-0, 4406400, 38016, 0xc632324f
-0, 4410000, 38016, 0x18b1f5c1
-0, 4413600, 38016, 0x63aff55e
-0, 4417200, 38016, 0x8a50fb04
-0, 4420800, 38016, 0x7d5e20f6
-0, 4424400, 38016, 0xc31114bb
-0, 4428000, 38016, 0xf4852e6e
-0, 4431600, 38016, 0x9b6927ba
-0, 4435200, 38016, 0x024836c2
-0, 4438800, 38016, 0x20843b21
-0, 4442400, 38016, 0x19134055
-0, 4446000, 38016, 0x1cd843f7
-0, 4449600, 38016, 0x122705b1
-0, 4453200, 38016, 0x1880fc3d
-0, 4456800, 38016, 0x78dbfeaf
-0, 4460400, 38016, 0x212c273d
-0, 4464000, 38016, 0xff2eb7be
-0, 4467600, 38016, 0xe0bd752d
-0, 4471200, 38016, 0x277b478a
-0, 4474800, 38016, 0x59e84ab2
-0, 4478400, 38016, 0x338a50e4
-0, 4482000, 38016, 0xaf715a99
-0, 4485600, 38016, 0xd1e459a8
-0, 4489200, 38016, 0x70da4ac9
-0, 4492800, 38016, 0xa695540d
-0, 4496400, 38016, 0x9385320b
-0, 4500000, 38016, 0x9a8703cd
-0, 4503600, 38016, 0xbeda239e
-0, 4507200, 38016, 0x5bf262c1
-0, 4510800, 38016, 0x9b216899
-0, 4514400, 38016, 0x52f24135
-0, 4518000, 38016, 0x75a23955
-0, 4521600, 38016, 0xb92f4ea2
-0, 4525200, 38016, 0xdac95333
-0, 4528800, 38016, 0x1a2d4ed4
-0, 4532400, 38016, 0xfce25650
-0, 4536000, 38016, 0x1e264fdd
-0, 4539600, 38016, 0xe77349b8
-0, 4543200, 38016, 0x7d2046b0
-0, 4546800, 38016, 0x65373899
-0, 4550400, 38016, 0x3b3569ae
-0, 4554000, 38016, 0x346485d0
-0, 4557600, 38016, 0x80b93e57
-0, 4561200, 38016, 0xeb724ba5
-0, 4564800, 38016, 0x533d7459
-0, 4568400, 38016, 0x60f957a7
-0, 4572000, 38016, 0x900281b2
-0, 4575600, 38016, 0xf4489e06
-0, 4579200, 38016, 0xe77730c9
-0, 4582800, 38016, 0x41b23060
-0, 4586400, 38016, 0x4e8c3012
-0, 4590000, 38016, 0x651f2cff
-0, 4593600, 38016, 0x787b2e99
-0, 4597200, 38016, 0x541e2d10
-0, 4600800, 38016, 0x27a824a3
-0, 4604400, 38016, 0xe1e72121
-0, 4608000, 38016, 0xffb52626
-0, 4611600, 38016, 0x7677c8c9
-0, 4615200, 38016, 0xa501d38f
-0, 4618800, 38016, 0xa6d2c5dc
-0, 4622400, 38016, 0xba94d1c1
-0, 4626000, 38016, 0x137dac4d
-0, 4629600, 38016, 0x65c1bd6e
-0, 4633200, 38016, 0x7a32cd65
-0, 4636800, 38016, 0x518adf61
-0, 4640400, 38016, 0x8baaee58
-0, 4644000, 38016, 0xe7642712
-0, 4647600, 38016, 0xba191b45
-0, 4651200, 38016, 0x93dd16b1
-0, 4654800, 38016, 0x22831478
-0, 4658400, 38016, 0xe48c103a
-0, 4662000, 38016, 0x7c2709e7
-0, 4665600, 38016, 0xd7d8f454
-0, 4669200, 38016, 0xc504f31a
-0, 4672800, 38016, 0x2510e4ae
-0, 4676400, 38016, 0x0b56d119
-0, 4680000, 38016, 0x6c248150
-0, 4683600, 38016, 0xbac4be42
-0, 4687200, 38016, 0x5787c4a8
-0, 4690800, 38016, 0x65b3d0bd
-0, 4694400, 38016, 0xdcc4efbd
-0, 4698000, 38016, 0xfe92f78b
-0, 4701600, 38016, 0xfda60c1c
-0, 4705200, 38016, 0x4997238e
-0, 4708800, 38016, 0xfaca43ca
-0, 4712400, 38016, 0x81fe533c
-0, 4716000, 38016, 0x350bcb11
-0, 4719600, 38016, 0xacfdcde4
-0, 4723200, 38016, 0xb039c663
-0, 4726800, 38016, 0x3402c942
-0, 4730400, 38016, 0x388bc3d0
-0, 4734000, 38016, 0x85dec11a
-0, 4737600, 38016, 0xdfc2be86
-0, 4741200, 38016, 0x515cc1a9
-0, 4744800, 38016, 0xc7ddb990
-0, 4748400, 38016, 0x043fb332
-0, 4752000, 38016, 0x5b05b3a7
-0, 4755600, 38016, 0xacdf9836
-0, 4759200, 38016, 0x55079a49
-0, 4762800, 38016, 0x5de2d90d
-0, 4766400, 38016, 0x7f9deb52
-0, 4770000, 38016, 0x83ddc6d9
-0, 4773600, 38016, 0x77ecdc93
-0, 4777200, 38016, 0x745fe832
-0, 4780800, 38016, 0x920bf8e7
-0, 4784400, 38016, 0xd9fc1803
-0, 4788000, 38016, 0x06c13052
-0, 4791600, 38016, 0x4a962b49
-0, 4795200, 38016, 0xd4a7b571
-0, 4798800, 38016, 0xdb76bd1e
-0, 4802400, 38016, 0x11a4be41
-0, 4806000, 38016, 0x575eb740
-0, 4809600, 38016, 0x7f11bb5c
-0, 4813200, 38016, 0x0f97b9b5
-0, 4816800, 38016, 0xa421bc1e
-0, 4820400, 38016, 0x2510bda8
-0, 4824000, 38016, 0x5ec1c3c2
-0, 4827600, 38016, 0xab02c212
-0, 4831200, 38016, 0x7862c24a
-0, 4834800, 38016, 0x3654c47c
-0, 4838400, 38016, 0x6e4f3fd5
-0, 4842000, 38016, 0x77b54c6f
-0, 4845600, 38016, 0x51016691
-0, 4849200, 38016, 0x5c2e7a7a
-0, 4852800, 38016, 0x29aea461
-0, 4856400, 38016, 0x8f4397b1
-0, 4860000, 38016, 0x8af41dba
-0, 4863600, 38016, 0x4c1154ca
-0, 4867200, 38016, 0xe23e6e91
-0, 4870800, 38016, 0xd0617571
-0, 4874400, 38016, 0x2ab88348
-0, 4878000, 38016, 0x8bf1a109
-0, 4881600, 38016, 0xfdd4c390
-0, 4885200, 38016, 0x17b8c6bf
-0, 4888800, 38016, 0xa012bd5d
-0, 4892400, 38016, 0x4c16cee2
-0, 4896000, 38016, 0x739fcfae
-0, 4899600, 38016, 0x3edae498
-0, 4903200, 38016, 0x0d38e4ad
-0, 4906800, 38016, 0x896cea10
-0, 4910400, 38016, 0x13a0f1a9
-0, 4914000, 38016, 0xfe70eeb4
-0, 4917600, 38016, 0x540bf40e
-0, 4921200, 38016, 0xee20f65e
-0, 4924800, 38016, 0x8404fdf7
-0, 4928400, 38016, 0x1c71b182
-0, 4932000, 38016, 0x96e4c5cc
-0, 4935600, 38016, 0x6aa1dcf1
-0, 4939200, 38016, 0x4549ed9b
-0, 4942800, 38016, 0xd50bffba
-0, 4946400, 38016, 0x22701379
-0, 4950000, 38016, 0x19462a6b
-0, 4953600, 38016, 0x4f6b41e0
-0, 4957200, 38016, 0x9d344fcc
-0, 4960800, 38016, 0x60625fa9
-0, 4964400, 38016, 0xeb377eae
-0, 4968000, 38016, 0x0d9f945d
-0, 4971600, 38016, 0x4d0fb1dc
-0, 4975200, 38016, 0x0b580421
-0, 4978800, 38016, 0x30f3191a
-0, 4982400, 38016, 0xc5f7295c
-0, 4986000, 38016, 0xc4ad35e9
-0, 4989600, 38016, 0x25964387
-0, 4993200, 38016, 0x3a805820
-0, 4996800, 38016, 0x67e26985
-0, 5000400, 38016, 0x518f7941
-0, 5004000, 38016, 0x2a7982e1
-0, 5007600, 38016, 0x54aa84f0
-0, 5011200, 38016, 0x3d808f45
-0, 5014800, 38016, 0x5dae923c
-0, 5018400, 38016, 0xa2a99ccf
-0, 5022000, 38016, 0xefdd9a77
-0, 5025600, 38016, 0x246fcfa5
-0, 5029200, 38016, 0xe315cbcd
-0, 5032800, 38016, 0x4825df58
-0, 5036400, 38016, 0x0e241554
-0, 5040000, 38016, 0x968d8433
-0, 5043600, 38016, 0x97eec628
-0, 5047200, 38016, 0x7c4cb603
-0, 5050800, 38016, 0x6d11e7bf
-0, 5054400, 38016, 0xae041b61
-0, 5058000, 38016, 0x385e040c
-0, 5061600, 38016, 0x449e357a
-0, 5065200, 38016, 0x997f4aac
-0, 5068800, 38016, 0xd68c4f8b
-0, 5072400, 38016, 0xb3b962eb
-0, 5076000, 38016, 0x4685adc2
-0, 5079600, 38016, 0xed0d7473
-0, 5083200, 38016, 0xd069c0bb
-0, 5086800, 38016, 0x76abcd8e
-0, 5090400, 38016, 0xd6c096da
-0, 5094000, 38016, 0x76c2bab5
-0, 5097600, 38016, 0x1461dfb3
-0, 5101200, 38016, 0xf979f59f
-0, 5104800, 38016, 0x0554f985
-0, 5108400, 38016, 0x11c6d2a3
-0, 5112000, 38016, 0xe6e3faee
-0, 5115600, 38016, 0x6ceafbcc
-0, 5119200, 38016, 0x429b02e1
-0, 5122800, 38016, 0x97bd03f1
-0, 5126400, 38016, 0x78330c48
-0, 5130000, 38016, 0xb2720325
-0, 5133600, 38016, 0x26d412ab
-0, 5137200, 38016, 0xb6fb1b5c
-0, 5140800, 38016, 0xde8d300a
-0, 5144400, 38016, 0x7d28450e
-0, 5148000, 38016, 0xb3c5fbef
-0, 5151600, 38016, 0x2222f726
-0, 5155200, 38016, 0x66f7f42f
-0, 5158800, 38016, 0xef8af722
-0, 5162400, 38016, 0x4ac0f8d7
-0, 5166000, 38016, 0x5bfe5c81
-0, 5169600, 38016, 0x4afb6df9
-0, 5173200, 38016, 0xa8128a37
-0, 5176800, 38016, 0x1fc79ed0
-0, 5180400, 38016, 0x9967a997
-0, 5184000, 38016, 0x7bb5f6e1
-0, 5187600, 38016, 0xdda90122
-0, 5191200, 38016, 0x81700c1a
-0, 5194800, 38016, 0x9e121e77
-0, 5198400, 38016, 0xf58926a3
-0, 5202000, 38016, 0x4d1431a4
-0, 5205600, 38016, 0x0de6e741
-0, 5209200, 38016, 0x3ae9f601
-0, 5212800, 38016, 0xbed2e950
-0, 5216400, 38016, 0x619f100d
-0, 5220000, 38016, 0x6fa4a4e2
-0, 5223600, 38016, 0x316cddcd
-0, 5227200, 38016, 0x03132791
-0, 5230800, 38016, 0x10122784
-0, 5234400, 38016, 0x0e732980
-0, 5238000, 38016, 0x382d26f9
-0, 5241600, 38016, 0x651028fd
-0, 5245200, 38016, 0x61732850
-0, 5248800, 38016, 0x47912dde
-0, 5252400, 38016, 0xe3a12fdc
-0, 5256000, 38016, 0x8bc332ff
-0, 5259600, 38016, 0xcc3a3cdc
-0, 5263200, 38016, 0x190e2fec
-0, 5266800, 38016, 0x236c3291
-0, 5270400, 38016, 0xc0e55dd3
-0, 5274000, 38016, 0x06c85411
-0, 5277600, 38016, 0x0c0b3091
-0, 5281200, 38016, 0x8c1333cd
-0, 5284800, 38016, 0x51b339a5
-0, 5288400, 38016, 0x2d5b33ef
-0, 5292000, 38016, 0x73f0395b
-0, 5295600, 38016, 0x505b42d3
-0, 5299200, 38016, 0x56e44c7f
-0, 5302800, 38016, 0x26465781
-0, 5306400, 38016, 0x1d14800d
-0, 5310000, 38016, 0x752cb297
-0, 5313600, 38016, 0x0c3ab720
-0, 5317200, 38016, 0x21c2f136
-0, 5320800, 38016, 0xbae8b293
-0, 5324400, 38016, 0xe4b2fe9b
-0, 5328000, 38016, 0xfaaf0394
-0, 5331600, 38016, 0xa6f61d4b
-0, 5335200, 38016, 0x0e205192
-0, 5338800, 38016, 0x9b3c5c1f
-0, 5342400, 38016, 0x3b93552f
-0, 5346000, 38016, 0xe56e5b54
-0, 5349600, 38016, 0xa1c26095
-0, 5353200, 38016, 0x1eb66e41
-0, 5356800, 38016, 0x83eb6e83
-0, 5360400, 38016, 0xc8a979d3
-0, 5364000, 38016, 0x81fb7b32
-0, 5367600, 38016, 0xe07928b7
-0, 5371200, 38016, 0x38591267
-0, 5374800, 38016, 0xce563165
-0, 5378400, 38016, 0x5fec3563
-0, 5382000, 38016, 0xd7402c7c
-0, 5385600, 38016, 0xf2a93af4
-0, 5389200, 38016, 0x78f22fe7
-0, 5392800, 38016, 0x25554875
-0, 5396400, 38016, 0x79546ca2
-0, 5400000, 38016, 0xdae2814a
-0, 5403600, 38016, 0xf1ef9a9e
-0, 5407200, 38016, 0xb76d8b83
-0, 5410800, 38016, 0x1abf8fa8
-0, 5414400, 38016, 0x8f098fa4
-0, 5418000, 38016, 0xb098843c
-0, 5421600, 38016, 0x1d5186d3
-0, 5425200, 38016, 0x93f4923c
-0, 5428800, 38016, 0x496094e2
-0, 5432400, 38016, 0x7aea93f1
-0, 5436000, 38016, 0x556c6675
-0, 5439600, 38016, 0x90566aca
-0, 5443200, 38016, 0x14899a93
-0, 5446800, 38016, 0xd269e0e7
-0, 5450400, 38016, 0x1261d2cc
-0, 5454000, 38016, 0x299c9301
-0, 5457600, 38016, 0xee9c9ba5
-0, 5461200, 38016, 0xb48ab676
-0, 5464800, 38016, 0x4ef9b1c5
-0, 5468400, 38016, 0x8aae9912
-0, 5472000, 38016, 0x1bc09f53
-0, 5475600, 38016, 0x2e089c6b
-0, 5479200, 38016, 0x67598f8d
-0, 5482800, 38016, 0xacd394e1
-0, 5486400, 38016, 0xe2979b75
-0, 5490000, 38016, 0xb9749ff9
-0, 5493600, 38016, 0x02bda2f0
-0, 5497200, 38016, 0xe6caa499
-0, 5500800, 38016, 0xc6d9a547
-0, 5504400, 38016, 0x1c89aa34
-0, 5508000, 38016, 0x61feb4fc
-0, 5511600, 38016, 0x2a40b1f4
-0, 5515200, 38016, 0x4ad3ac08
-0, 5518800, 38016, 0xf5e8b06d
-0, 5522400, 38016, 0xb0eea800
-0, 5526000, 38016, 0x430cc535
-0, 5529600, 38016, 0x8e66b9cf
-0, 5533200, 38016, 0x5c68b4c4
-0, 5536800, 38016, 0x9381c64b
-0, 5540400, 38016, 0x4234bed7
-0, 5544000, 38016, 0xce72bf02
-0, 5547600, 38016, 0xb8cfbcd7
-0, 5551200, 38016, 0x75a5b1bd
-0, 5554800, 38016, 0xc27fb9eb
-0, 5558400, 38016, 0xa1b1bc62
-0, 5562000, 38016, 0x1cdeb0a3
-0, 5565600, 38016, 0xaea6a799
-0, 5569200, 38016, 0x8152ac4f
-0, 5572800, 38016, 0x59c1a66d
-0, 5576400, 38016, 0x6bd99f24
-0, 5580000, 38016, 0x96a73236
-0, 5583600, 38016, 0xb27e4856
-0, 5587200, 38016, 0x8b57447a
-0, 5590800, 38016, 0xcef84a21
-0, 5594400, 38016, 0x5babc7cc
-0, 5598000, 38016, 0x6ed2cec3
-0, 5601600, 38016, 0xa2efdc17
-0, 5605200, 38016, 0x47bad971
-0, 5608800, 38016, 0x150dffd4
-0, 5612400, 38016, 0x3ecef2ad
-0, 5616000, 38016, 0x355cdade
-0, 5619600, 38016, 0x3b15e809
-0, 5623200, 38016, 0x37fcf890
-0, 5626800, 38016, 0x8ca606d1
-0, 5630400, 38016, 0x51cafefe
-0, 5634000, 38016, 0x736be64a
-0, 5637600, 38016, 0x4f2052c1
-0, 5641200, 38016, 0xc6715e93
-0, 5644800, 38016, 0x765c5a58
-0, 5648400, 38016, 0x5abe5617
-0, 5652000, 38016, 0xb1ac540a
-0, 5655600, 38016, 0xd9f75c21
-0, 5659200, 38016, 0x0c1946c0
-0, 5662800, 38016, 0x93363a34
-0, 5666400, 38016, 0x2c9f2fe4
-0, 5670000, 38016, 0x023c321a
-0, 5673600, 38016, 0x1931314b
-0, 5677200, 38016, 0x16782d59
-0, 5680800, 38016, 0x29aa289f
-0, 5684400, 38016, 0xea0ddb85
-0, 5688000, 38016, 0xe09ae656
-0, 5691600, 38016, 0x682ff29f
-0, 5695200, 38016, 0xf3ac29ca
-0, 5698800, 38016, 0x95160cad
-0, 5702400, 38016, 0x9afa093c
-0, 5706000, 38016, 0x2ad30958
-0, 5709600, 38016, 0x4b600e3a
-0, 5713200, 38016, 0x5b0e099b
-0, 5716800, 38016, 0x2d2aff9b
-0, 5720400, 38016, 0x8bb10aa6
-0, 5724000, 38016, 0xfebe1f1d
-0, 5727600, 38016, 0xa4431abd
-0, 5731200, 38016, 0xef7729a6
-0, 5734800, 38016, 0x7b5b1f78
-0, 5738400, 38016, 0x903b203e
-0, 5742000, 38016, 0xbcc716a2
-0, 5745600, 38016, 0xee6c1f4c
-0, 5749200, 38016, 0xc78c2ab8
-0, 5752800, 38016, 0xa77a255a
-0, 5756400, 38016, 0x9d5815fc
-0, 5760000, 38016, 0x7d5e7d79
-0, 5763600, 38016, 0xf7989072
-0, 5767200, 38016, 0x45499feb
-0, 5770800, 38016, 0xc58aae7b
-0, 5774400, 38016, 0x882aa1cb
-0, 5778000, 38016, 0x56cd97bf
-0, 5781600, 38016, 0x2d6af920
-0, 5785200, 38016, 0x43c312eb
-0, 5788800, 38016, 0x12872b9f
-0, 5792400, 38016, 0x3c623ffe
-0, 5796000, 38016, 0x120e302d
-0, 5799600, 38016, 0x9cb43964
-0, 5803200, 38016, 0xb371311c
-0, 5806800, 38016, 0x28b523d4
-0, 5810400, 38016, 0x58031bff
-0, 5814000, 38016, 0xe6691818
-0, 5817600, 38016, 0x6a9b29c3
-0, 5821200, 38016, 0x794b25ce
-0, 5824800, 38016, 0xfc273119
-0, 5828400, 38016, 0x82ad2a3a
-0, 5832000, 38016, 0x9d2da281
-0, 5835600, 38016, 0x11271ba1
-0, 5839200, 38016, 0x1558b618
-0, 5842800, 38016, 0xf5d8c22f
-0, 5846400, 38016, 0xf20214f9
-0, 5850000, 38016, 0x15b01f3a
-0, 5853600, 38016, 0x68f2b533
-0, 5857200, 38016, 0x9686a827
-0, 5860800, 38016, 0xf214a2dc
-0, 5864400, 38016, 0x3d421eb0
-0, 5868000, 38016, 0x78251e60
-0, 5871600, 38016, 0xab092856
-0, 5875200, 38016, 0x5eaba7bc
-0, 5878800, 38016, 0x612fb699
-0, 5882400, 38016, 0x8a83a3fd
-0, 5886000, 38016, 0xbcd9919b
-0, 5889600, 38016, 0xb9063049
-0, 5893200, 38016, 0x5cb22fde
-0, 5896800, 38016, 0x7db92390
-0, 5900400, 38016, 0x801b241b
-0, 5904000, 38016, 0x6eeb8e1b
-0, 5907600, 38016, 0x660b9568
-0, 5911200, 38016, 0x2a5b8b3d
-0, 5914800, 38016, 0x15098b9a
-0, 5918400, 38016, 0xd29284f5
-0, 5922000, 38016, 0x839323c6
-0, 5925600, 38016, 0xd6a4212c
-0, 5929200, 38016, 0x1c1c2259
-0, 5932800, 38016, 0x0b1d2ef2
-0, 5936400, 38016, 0xecd52cfc
-0, 5940000, 38016, 0x419326cb
-0, 5943600, 38016, 0xea813e68
-0, 5947200, 38016, 0xba9a33ba
-0, 5950800, 38016, 0x703b3b25
-0, 5954400, 38016, 0x391c3cce
-0, 5958000, 38016, 0xd1533fe3
-0, 5961600, 38016, 0xb9361f10
-0, 5965200, 38016, 0x8d652ea6
-0, 5968800, 38016, 0x22dc15ae
-0, 5972400, 38016, 0x2e5e0ee7
-0, 5976000, 38016, 0xd6bd15cf
-0, 5979600, 38016, 0xb16f198a
-0, 5983200, 38016, 0xd9653e95
-0, 5986800, 38016, 0x39da2e3a
-0, 5990400, 38016, 0x01b12526
-0, 5994000, 38016, 0x94a52dde
-0, 5997600, 38016, 0xda0c32d8
-0, 6001200, 38016, 0x89af2566
-0, 6004800, 38016, 0x71961a43
-0, 6008400, 38016, 0x5fb91337
-0, 6012000, 38016, 0x6e430a84
-0, 6015600, 38016, 0x1defffb2
-0, 6019200, 38016, 0xcc93023f
-0, 6022800, 38016, 0xfcd60168
-0, 6026400, 38016, 0x8a3201d4
-0, 6030000, 38016, 0x5235fef3
-0, 6033600, 38016, 0x989121b9
-0, 6037200, 38016, 0x067a1d36
-0, 6040800, 38016, 0xa168242b
-0, 6044400, 38016, 0x425f2475
-0, 6048000, 38016, 0x298f14d9
-0, 6051600, 38016, 0x3a7c1838
-0, 6055200, 38016, 0xd173155a
-0, 6058800, 38016, 0x210113ec
-0, 6062400, 38016, 0xa0c2f88f
-0, 6066000, 38016, 0x4fa1f4e2
-0, 6069600, 38016, 0x812df750
-0, 6073200, 38016, 0xfd5cea45
-0, 6076800, 38016, 0xb823ee4a
-0, 6080400, 38016, 0x3555d6bf
-0, 6084000, 38016, 0x6dabf021
-0, 6087600, 38016, 0x7ae0f191
-0, 6091200, 38016, 0xabdc1546
-0, 6094800, 38016, 0x36dd0dbb
-0, 6098400, 38016, 0x008ffe5f
-0, 6102000, 38016, 0xe956f9c0
-0, 6105600, 38016, 0x9823ee03
-0, 6109200, 38016, 0xf63fedde
-0, 6112800, 38016, 0x67530afb
-0, 6116400, 38016, 0x2da5e470
+#tb 0: 1/25
+0, 0, 0, 1, 38016, 0x85d20fc6
+0, 1, 1, 1, 38016, 0xc0432c21
+0, 2, 2, 1, 38016, 0x1450168f
+0, 3, 3, 1, 38016, 0xeddb1833
+0, 4, 4, 1, 38016, 0x631216d4
+0, 5, 5, 1, 38016, 0xfcd1138b
+0, 6, 6, 1, 38016, 0x181f17d5
+0, 7, 7, 1, 38016, 0x3dc91855
+0, 8, 8, 1, 38016, 0x92b71924
+0, 9, 9, 1, 38016, 0xfcb6228d
+0, 10, 10, 1, 38016, 0x11d04b4a
+0, 11, 11, 1, 38016, 0x743a6a06
+0, 12, 12, 1, 38016, 0xac511cc3
+0, 13, 13, 1, 38016, 0x66bc1e2d
+0, 14, 14, 1, 38016, 0x6c761ef3
+0, 15, 15, 1, 38016, 0xa08a1ef5
+0, 16, 16, 1, 38016, 0x777270da
+0, 17, 17, 1, 38016, 0x9a738d9f
+0, 18, 18, 1, 38016, 0x31a8afa2
+0, 19, 19, 1, 38016, 0x1148cc11
+0, 20, 20, 1, 38016, 0xf5fa1f26
+0, 21, 21, 1, 38016, 0xc0481fbc
+0, 22, 22, 1, 38016, 0x461b2228
+0, 23, 23, 1, 38016, 0x27bb209d
+0, 24, 24, 1, 38016, 0xbe921f04
+0, 25, 25, 1, 38016, 0xabdbd493
+0, 26, 26, 1, 38016, 0x4f6ad36e
+0, 27, 27, 1, 38016, 0xe2f8d0ca
+0, 28, 28, 1, 38016, 0xd82aaea2
+0, 29, 29, 1, 38016, 0xb208854b
+0, 30, 30, 1, 38016, 0xfe632920
+0, 31, 31, 1, 38016, 0x1a8128ce
+0, 32, 32, 1, 38016, 0xd9ea2be9
+0, 33, 33, 1, 38016, 0x258b2ab0
+0, 34, 34, 1, 38016, 0xb5812bef
+0, 35, 35, 1, 38016, 0x00c92cdf
+0, 36, 36, 1, 38016, 0x4a6b9f6f
+0, 37, 37, 1, 38016, 0xb589b0a1
+0, 38, 38, 1, 38016, 0xf2d0bbca
+0, 39, 39, 1, 38016, 0xe614cce3
+0, 40, 40, 1, 38016, 0x6d81d01c
+0, 41, 41, 1, 38016, 0x7f32d175
+0, 42, 42, 1, 38016, 0x6abc2f40
+0, 43, 43, 1, 38016, 0x767d2f6a
+0, 44, 44, 1, 38016, 0xd64b30cf
+0, 45, 45, 1, 38016, 0xf83d3000
+0, 46, 46, 1, 38016, 0x5f3230d5
+0, 47, 47, 1, 38016, 0x80b330a0
+0, 48, 48, 1, 38016, 0x42c4326e
+0, 49, 49, 1, 38016, 0x7cb8d069
+0, 50, 50, 1, 38016, 0xb7bb9d2f
+0, 51, 51, 1, 38016, 0xf4f47c47
+0, 52, 52, 1, 38016, 0xe3455aa0
+0, 53, 53, 1, 38016, 0x3b074630
+0, 54, 54, 1, 38016, 0x1fd44e63
+0, 55, 55, 1, 38016, 0x5ecb6a07
+0, 56, 56, 1, 38016, 0xe3a130c9
+0, 57, 57, 1, 38016, 0x307f311a
+0, 58, 58, 1, 38016, 0x4e2d3202
+0, 59, 59, 1, 38016, 0x06ac31c1
+0, 60, 60, 1, 38016, 0x767931ab
+0, 61, 61, 1, 38016, 0xcb6433aa
+0, 62, 62, 1, 38016, 0xc88e3597
+0, 63, 63, 1, 38016, 0xfe06371f
+0, 64, 64, 1, 38016, 0x9e3c8a14
+0, 65, 65, 1, 38016, 0xba819e5b
+0, 66, 66, 1, 38016, 0x0017a693
+0, 67, 67, 1, 38016, 0x25aca2dd
+0, 68, 68, 1, 38016, 0x3bf5980d
+0, 69, 69, 1, 38016, 0x2a0ba2ae
+0, 70, 70, 1, 38016, 0x99e19853
+0, 71, 71, 1, 38016, 0x5e7a9699
+0, 72, 72, 1, 38016, 0x11983c1a
+0, 73, 73, 1, 38016, 0x5ab53cbf
+0, 74, 74, 1, 38016, 0x49803f12
+0, 75, 75, 1, 38016, 0xf1633fdc
+0, 76, 76, 1, 38016, 0x91de3ff3
+0, 77, 77, 1, 38016, 0x418942a1
+0, 78, 78, 1, 38016, 0x670c4277
+0, 79, 79, 1, 38016, 0xc04e403e
+0, 80, 80, 1, 38016, 0xa33e40ad
+0, 81, 81, 1, 38016, 0x7f959a9c
+0, 82, 82, 1, 38016, 0x096696ae
+0, 83, 83, 1, 38016, 0xdb41933c
+0, 84, 84, 1, 38016, 0xb26086b4
+0, 85, 85, 1, 38016, 0x80c97e07
+0, 86, 86, 1, 38016, 0xa7416837
+0, 87, 87, 1, 38016, 0xa82f6342
+0, 88, 88, 1, 38016, 0x8da16527
+0, 89, 89, 1, 38016, 0x1c1965a9
+0, 90, 90, 1, 38016, 0x09ad470c
+0, 91, 91, 1, 38016, 0x3f694725
+0, 92, 92, 1, 38016, 0xa7034699
+0, 93, 93, 1, 38016, 0x38104981
+0, 94, 94, 1, 38016, 0x216048b7
+0, 95, 95, 1, 38016, 0x24e04c22
+0, 96, 96, 1, 38016, 0xbb7e4871
+0, 97, 97, 1, 38016, 0x8c074b97
+0, 98, 98, 1, 38016, 0x92aa4b79
+0, 99, 99, 1, 38016, 0x073c4d97
+0, 100, 100, 1, 38016, 0xe225f953
+0, 101, 101, 1, 38016, 0xcaccf96b
+0, 102, 102, 1, 38016, 0xc395cd82
+0, 103, 103, 1, 38016, 0x8c61ad55
+0, 104, 104, 1, 38016, 0x6fb988f2
+0, 105, 105, 1, 38016, 0x99fe7aea
+0, 106, 106, 1, 38016, 0xab3c73bf
+0, 107, 107, 1, 38016, 0xcdb06bc4
+0, 108, 108, 1, 38016, 0x65a1540a
+0, 109, 109, 1, 38016, 0xc22f4fb0
+0, 110, 110, 1, 38016, 0xe5ca4830
+0, 111, 111, 1, 38016, 0x06b346f9
+0, 112, 112, 1, 38016, 0x02154629
+0, 113, 113, 1, 38016, 0x3d5e4467
+0, 114, 114, 1, 38016, 0x6aa4460c
+0, 115, 115, 1, 38016, 0x05bc47c4
+0, 116, 116, 1, 38016, 0xc46e4666
+0, 117, 117, 1, 38016, 0xc28145f5
+0, 118, 118, 1, 38016, 0xf57f4811
+0, 119, 119, 1, 38016, 0x1bbc49f8
+0, 120, 120, 1, 38016, 0x34e14c2c
+0, 121, 121, 1, 38016, 0x7e7d7740
+0, 122, 122, 1, 38016, 0x97d798f3
+0, 123, 123, 1, 38016, 0x7d71ca3b
+0, 124, 124, 1, 38016, 0xc6bc0776
+0, 125, 125, 1, 38016, 0xda052645
+0, 126, 126, 1, 38016, 0xf0b32de9
+0, 127, 127, 1, 38016, 0x996f23cf
+0, 128, 128, 1, 38016, 0x22ea1a43
+0, 129, 129, 1, 38016, 0xbde61021
+0, 130, 130, 1, 38016, 0x8180079d
+0, 131, 131, 1, 38016, 0x3ac6f314
+0, 132, 132, 1, 38016, 0x93604f67
+0, 133, 133, 1, 38016, 0xb9a55213
+0, 134, 134, 1, 38016, 0x89c8523c
+0, 135, 135, 1, 38016, 0x670a511b
+0, 136, 136, 1, 38016, 0x62395128
+0, 137, 137, 1, 38016, 0x01605431
+0, 138, 138, 1, 38016, 0x677253cd
+0, 139, 139, 1, 38016, 0xc57f56b1
+0, 140, 140, 1, 38016, 0x767f5679
+0, 141, 141, 1, 38016, 0x4abc5717
+0, 142, 142, 1, 38016, 0x838657dc
+0, 143, 143, 1, 38016, 0x63bf56ad
+0, 144, 144, 1, 38016, 0x7019c8ad
+0, 145, 145, 1, 38016, 0xebbaa7bf
+0, 146, 146, 1, 38016, 0xebbc8ddb
+0, 147, 147, 1, 38016, 0xea609f00
+0, 148, 148, 1, 38016, 0x88e6b1e4
+0, 149, 149, 1, 38016, 0x7f9edd6b
+0, 150, 150, 1, 38016, 0xeaf354a6
+0, 151, 151, 1, 38016, 0xf30274c9
+0, 152, 152, 1, 38016, 0x05a756da
+0, 153, 153, 1, 38016, 0xacea1ca6
+0, 154, 154, 1, 38016, 0x1520d86d
+0, 155, 155, 1, 38016, 0xb0f7afa4
+0, 156, 156, 1, 38016, 0xe33c5802
+0, 157, 157, 1, 38016, 0xce2a58cd
+0, 158, 158, 1, 38016, 0xd3ad5a30
+0, 159, 159, 1, 38016, 0x29aa5955
+0, 160, 160, 1, 38016, 0x59015aef
+0, 161, 161, 1, 38016, 0x247c5a72
+0, 162, 162, 1, 38016, 0x79a85b27
+0, 163, 163, 1, 38016, 0x6cf858fe
+0, 164, 164, 1, 38016, 0x78ec5b20
+0, 165, 165, 1, 38016, 0x7cb158c5
+0, 166, 166, 1, 38016, 0xc52c581f
+0, 167, 167, 1, 38016, 0x125c58bd
+0, 168, 168, 1, 38016, 0xf8b257c9
+0, 169, 169, 1, 38016, 0x20329756
+0, 170, 170, 1, 38016, 0x60a07c12
+0, 171, 171, 1, 38016, 0xa2c26ad1
+0, 172, 172, 1, 38016, 0xcbbc681b
+0, 173, 173, 1, 38016, 0x2c0562ad
+0, 174, 174, 1, 38016, 0x8a72640d
+0, 175, 175, 1, 38016, 0xe6e7756a
+0, 176, 176, 1, 38016, 0x64608a48
+0, 177, 177, 1, 38016, 0xe9bea9fa
+0, 178, 178, 1, 38016, 0x24bac776
+0, 179, 179, 1, 38016, 0x6aa9d01b
+0, 180, 180, 1, 38016, 0xf41ebb02
+0, 181, 181, 1, 38016, 0x28017154
+0, 182, 182, 1, 38016, 0x3fc55eb4
+0, 183, 183, 1, 38016, 0xe7bc5f22
+0, 184, 184, 1, 38016, 0xe6706162
+0, 185, 185, 1, 38016, 0xee385fe2
+0, 186, 186, 1, 38016, 0x79c0600b
+0, 187, 187, 1, 38016, 0x735a603f
+0, 188, 188, 1, 38016, 0xe7916199
+0, 189, 189, 1, 38016, 0x542d601d
+0, 190, 190, 1, 38016, 0xbfaa611a
+0, 191, 191, 1, 38016, 0xb7504e05
+0, 192, 192, 1, 38016, 0xd1964339
+0, 193, 193, 1, 38016, 0x4213278a
+0, 194, 194, 1, 38016, 0xb503229f
+0, 195, 195, 1, 38016, 0x166a091c
+0, 196, 196, 1, 38016, 0x37176bbc
+0, 197, 197, 1, 38016, 0x95977cc3
+0, 198, 198, 1, 38016, 0x5bab93f4
+0, 199, 199, 1, 38016, 0x71d5d142
+0, 200, 200, 1, 38016, 0x97d1cfa6
+0, 201, 201, 1, 38016, 0xac82ff20
+0, 202, 202, 1, 38016, 0x489a1fa1
+0, 203, 203, 1, 38016, 0x32944930
+0, 204, 204, 1, 38016, 0x72a2647c
+0, 205, 205, 1, 38016, 0x95b685d6
+0, 206, 206, 1, 38016, 0xb7e19840
+0, 207, 207, 1, 38016, 0x85569129
+0, 208, 208, 1, 38016, 0x6bc6a197
+0, 209, 209, 1, 38016, 0x55ccace8
+0, 210, 210, 1, 38016, 0x9bbdc9c2
+0, 211, 211, 1, 38016, 0xbce4ade3
+0, 212, 212, 1, 38016, 0x39c7c48a
+0, 213, 213, 1, 38016, 0x498ac4aa
+0, 214, 214, 1, 38016, 0xeda3b715
+0, 215, 215, 1, 38016, 0x700db089
+0, 216, 216, 1, 38016, 0xf6b6bf36
+0, 217, 217, 1, 38016, 0x6abebf1c
+0, 218, 218, 1, 38016, 0x8855c17c
+0, 219, 219, 1, 38016, 0xfba09dd5
+0, 220, 220, 1, 38016, 0xd5868240
+0, 221, 221, 1, 38016, 0x438074a2
+0, 222, 222, 1, 38016, 0xc8b2c501
+0, 223, 223, 1, 38016, 0xd48ec1ef
+0, 224, 224, 1, 38016, 0xa715c4be
+0, 225, 225, 1, 38016, 0xd758c281
+0, 226, 226, 1, 38016, 0x07c25900
+0, 227, 227, 1, 38016, 0xee7950e6
+0, 228, 228, 1, 38016, 0x3e154be9
+0, 229, 229, 1, 38016, 0xa8f33bb7
+0, 230, 230, 1, 38016, 0xf493bc3c
+0, 231, 231, 1, 38016, 0x9d69bccb
+0, 232, 232, 1, 38016, 0xbf9fbafa
+0, 233, 233, 1, 38016, 0x2e62b9a8
+0, 234, 234, 1, 38016, 0x2f41bae1
+0, 235, 235, 1, 38016, 0xd820355d
+0, 236, 236, 1, 38016, 0xf3623118
+0, 237, 237, 1, 38016, 0x659b4459
+0, 238, 238, 1, 38016, 0xdcd74654
+0, 239, 239, 1, 38016, 0x73f33f73
+0, 240, 240, 1, 38016, 0xbf96b5ec
+0, 241, 241, 1, 38016, 0xe9ebb550
+0, 242, 242, 1, 38016, 0xfe12b5dd
+0, 243, 243, 1, 38016, 0x9908b6d5
+0, 244, 244, 1, 38016, 0xe805b8cf
+0, 245, 245, 1, 38016, 0x1a8eb68a
+0, 246, 246, 1, 38016, 0x6aed288d
+0, 247, 247, 1, 38016, 0x162f167f
+0, 248, 248, 1, 38016, 0x49110ae5
+0, 249, 249, 1, 38016, 0xab060059
+0, 250, 250, 1, 38016, 0x0fb8a0a8
+0, 251, 251, 1, 38016, 0xf3b0b384
+0, 252, 252, 1, 38016, 0x6f32bb1b
+0, 253, 253, 1, 38016, 0x7278bb3a
+0, 254, 254, 1, 38016, 0xdeb1bdcf
+0, 255, 255, 1, 38016, 0x90efbc5c
+0, 256, 256, 1, 38016, 0xd2f6bb28
+0, 257, 257, 1, 38016, 0xba4dba32
+0, 258, 258, 1, 38016, 0x0751ba19
+0, 259, 259, 1, 38016, 0xc3f7b9db
+0, 260, 260, 1, 38016, 0xca22c433
+0, 261, 261, 1, 38016, 0x82a7e336
+0, 262, 262, 1, 38016, 0x45e90a19
+0, 263, 263, 1, 38016, 0x82cd2c11
+0, 264, 264, 1, 38016, 0x4e2e56cc
+0, 265, 265, 1, 38016, 0x0ad281c6
+0, 266, 266, 1, 38016, 0x8685b8b7
+0, 267, 267, 1, 38016, 0xe502b7b3
+0, 268, 268, 1, 38016, 0x4898b696
+0, 269, 269, 1, 38016, 0xe0fcb729
+0, 270, 270, 1, 38016, 0xe5e0b822
+0, 271, 271, 1, 38016, 0x9030b82c
+0, 272, 272, 1, 38016, 0x7dc6b93c
+0, 273, 273, 1, 38016, 0x727cb981
+0, 274, 274, 1, 38016, 0xb08999c9
+0, 275, 275, 1, 38016, 0x3e54b6d7
+0, 276, 276, 1, 38016, 0x5d15c1e2
+0, 277, 277, 1, 38016, 0x5840d8d7
+0, 278, 278, 1, 38016, 0x1109d730
+0, 279, 279, 1, 38016, 0xb898c47e
+0, 280, 280, 1, 38016, 0xbde196c6
+0, 281, 281, 1, 38016, 0x75999430
+0, 282, 282, 1, 38016, 0xa17db11e
+0, 283, 283, 1, 38016, 0xb428b220
+0, 284, 284, 1, 38016, 0x1537b1ed
+0, 285, 285, 1, 38016, 0x102ab213
+0, 286, 286, 1, 38016, 0xee38af9e
+0, 287, 287, 1, 38016, 0xc9c5b34e
+0, 288, 288, 1, 38016, 0x8618af6d
+0, 289, 289, 1, 38016, 0x97f3af7a
+0, 290, 290, 1, 38016, 0x222eb095
+0, 291, 291, 1, 38016, 0xb1508324
+0, 292, 292, 1, 38016, 0x2149ad09
+0, 293, 293, 1, 38016, 0x67261443
+0, 294, 294, 1, 38016, 0x90918df5
+0, 295, 295, 1, 38016, 0x5d43e726
+0, 296, 296, 1, 38016, 0x1d77dfa3
+0, 297, 297, 1, 38016, 0xa60b941c
+0, 298, 298, 1, 38016, 0x48813a99
+0, 299, 299, 1, 38016, 0x2324b77a
+0, 300, 300, 1, 38016, 0xdfd99d0d
+0, 301, 301, 1, 38016, 0x44129be1
+0, 302, 302, 1, 38016, 0x1137a099
+0, 303, 303, 1, 38016, 0xbd24a0a1
+0, 304, 304, 1, 38016, 0x3883a310
+0, 305, 305, 1, 38016, 0x0680a358
+0, 306, 306, 1, 38016, 0xf333a501
+0, 307, 307, 1, 38016, 0x3945a6ac
+0, 308, 308, 1, 38016, 0x79eea741
+0, 309, 309, 1, 38016, 0x8c7aa6b0
+0, 310, 310, 1, 38016, 0x0342642f
+0, 311, 311, 1, 38016, 0x83632b63
+0, 312, 312, 1, 38016, 0x1503ff51
+0, 313, 313, 1, 38016, 0xa4bcea0f
+0, 314, 314, 1, 38016, 0x37dcd11b
+0, 315, 315, 1, 38016, 0x9aa7287a
+0, 316, 316, 1, 38016, 0x34deae76
+0, 317, 317, 1, 38016, 0x51710057
+0, 318, 318, 1, 38016, 0x9ee6fc0a
+0, 319, 319, 1, 38016, 0xa419ea79
+0, 320, 320, 1, 38016, 0x49388f7e
+0, 321, 321, 1, 38016, 0x08498b2d
+0, 322, 322, 1, 38016, 0x104f8c4d
+0, 323, 323, 1, 38016, 0xdb998d74
+0, 324, 324, 1, 38016, 0xd54e8c95
+0, 325, 325, 1, 38016, 0x54a48e5e
+0, 326, 326, 1, 38016, 0xbe6f8cd0
+0, 327, 327, 1, 38016, 0x2a7f8ec2
+0, 328, 328, 1, 38016, 0x23848f19
+0, 329, 329, 1, 38016, 0x9b168ee3
+0, 330, 330, 1, 38016, 0xc2628fb6
+0, 331, 331, 1, 38016, 0xe2bdfd4e
+0, 332, 332, 1, 38016, 0xfdae1546
+0, 333, 333, 1, 38016, 0xb1fe20db
+0, 334, 334, 1, 38016, 0x5ebf23f0
+0, 335, 335, 1, 38016, 0xecbc1fcb
+0, 336, 336, 1, 38016, 0xe72e141c
+0, 337, 337, 1, 38016, 0xbad7f54d
+0, 338, 338, 1, 38016, 0x95ead3c6
+0, 339, 339, 1, 38016, 0xf5c6b948
+0, 340, 340, 1, 38016, 0x2f8b80ab
+0, 341, 341, 1, 38016, 0x0aed47a7
+0, 342, 342, 1, 38016, 0xdcb278e3
+0, 343, 343, 1, 38016, 0x2a677958
+0, 344, 344, 1, 38016, 0x45427ae8
+0, 345, 345, 1, 38016, 0xebce78de
+0, 346, 346, 1, 38016, 0xaf007bb1
+0, 347, 347, 1, 38016, 0xb4677cdb
+0, 348, 348, 1, 38016, 0xbf6d8024
+0, 349, 349, 1, 38016, 0xb67180de
+0, 350, 350, 1, 38016, 0xb1581358
+0, 351, 351, 1, 38016, 0x258f140d
+0, 352, 352, 1, 38016, 0x753d17e6
+0, 353, 353, 1, 38016, 0xf33816b4
+0, 354, 354, 1, 38016, 0x0d011c76
+0, 355, 355, 1, 38016, 0x48cfd85d
+0, 356, 356, 1, 38016, 0x13ce822d
+0, 357, 357, 1, 38016, 0x221a4468
+0, 358, 358, 1, 38016, 0x11364be7
+0, 359, 359, 1, 38016, 0xafc047b0
+0, 360, 360, 1, 38016, 0xeafd4217
+0, 361, 361, 1, 38016, 0x930b8a41
+0, 362, 362, 1, 38016, 0x2dda0bd2
+0, 363, 363, 1, 38016, 0x461cc3f2
+0, 364, 364, 1, 38016, 0xa99e962a
+0, 365, 365, 1, 38016, 0xc1d954ba
+0, 366, 366, 1, 38016, 0x0ce91a87
+0, 367, 367, 1, 38016, 0x10701e2d
+0, 368, 368, 1, 38016, 0x98c22205
+0, 369, 369, 1, 38016, 0xb76622f1
+0, 370, 370, 1, 38016, 0x6d1a22d4
+0, 371, 371, 1, 38016, 0x00ee23c5
+0, 372, 372, 1, 38016, 0xc38125e6
+0, 373, 373, 1, 38016, 0x8de52597
+0, 374, 374, 1, 38016, 0xec282293
+0, 375, 375, 1, 38016, 0xb50f2238
+0, 376, 376, 1, 38016, 0xbdcf1f9f
+0, 377, 377, 1, 38016, 0x5c6c1780
+0, 378, 378, 1, 38016, 0x41941237
+0, 379, 379, 1, 38016, 0x95ee1e69
+0, 380, 380, 1, 38016, 0x84b65009
+0, 381, 381, 1, 38016, 0x27bbf0ab
+0, 382, 382, 1, 38016, 0xdd86f4fb
+0, 383, 383, 1, 38016, 0x97733086
+0, 384, 384, 1, 38016, 0x3241472f
+0, 385, 385, 1, 38016, 0x5d050c50
+0, 386, 386, 1, 38016, 0x8378aa9b
+0, 387, 387, 1, 38016, 0x94f174cd
+0, 388, 388, 1, 38016, 0x5825df16
+0, 389, 389, 1, 38016, 0x5f362875
+0, 390, 390, 1, 38016, 0x30704cd6
+0, 391, 391, 1, 38016, 0xc74e3614
+0, 392, 392, 1, 38016, 0xe033eb04
+0, 393, 393, 1, 38016, 0x665be967
+0, 394, 394, 1, 38016, 0x95d5ed67
+0, 395, 395, 1, 38016, 0x37dfefc1
+0, 396, 396, 1, 38016, 0x1908ee8e
+0, 397, 397, 1, 38016, 0xf0cfee38
+0, 398, 398, 1, 38016, 0x871df078
+0, 399, 399, 1, 38016, 0xb2f2f0f9
+0, 400, 400, 1, 38016, 0xf955621f
+0, 401, 401, 1, 38016, 0xbd2365a5
+0, 402, 402, 1, 38016, 0xe70d6bb0
+0, 403, 403, 1, 38016, 0x857e6d00
+0, 404, 404, 1, 38016, 0x000d6ee5
+0, 405, 405, 1, 38016, 0x9a2f7244
+0, 406, 406, 1, 38016, 0xe8c2f83c
+0, 407, 407, 1, 38016, 0x23eb0377
+0, 408, 408, 1, 38016, 0xe0802a7f
+0, 409, 409, 1, 38016, 0x5dbc4d69
+0, 410, 410, 1, 38016, 0xa3031f36
+0, 411, 411, 1, 38016, 0x27fbb378
+0, 412, 412, 1, 38016, 0xeee9a313
+0, 413, 413, 1, 38016, 0x189b1e68
+0, 414, 414, 1, 38016, 0x9a90678a
+0, 415, 415, 1, 38016, 0x1a65ed20
+0, 416, 416, 1, 38016, 0x2f51beb7
+0, 417, 417, 1, 38016, 0x671ada9d
+0, 418, 418, 1, 38016, 0x30af355a
+0, 419, 419, 1, 38016, 0x1804d4f9
+0, 420, 420, 1, 38016, 0xee227951
+0, 421, 421, 1, 38016, 0x20dc3900
+0, 422, 422, 1, 38016, 0x334f82dc
+0, 423, 423, 1, 38016, 0xb1728506
+0, 424, 424, 1, 38016, 0x2236fc10
+0, 425, 425, 1, 38016, 0x80d2964d
+0, 426, 426, 1, 38016, 0x5e368712
+0, 427, 427, 1, 38016, 0x10408765
+0, 428, 428, 1, 38016, 0x4b3084c5
+0, 429, 429, 1, 38016, 0x975c473f
+0, 430, 430, 1, 38016, 0x6f16efa3
+0, 431, 431, 1, 38016, 0xe73aac5e
+0, 432, 432, 1, 38016, 0x996b6e24
+0, 433, 433, 1, 38016, 0x424f6f55
+0, 434, 434, 1, 38016, 0x33786d10
+0, 435, 435, 1, 38016, 0x8a0f6870
+0, 436, 436, 1, 38016, 0x5e8556d4
+0, 437, 437, 1, 38016, 0x863b2366
+0, 438, 438, 1, 38016, 0x3fa74842
+0, 439, 439, 1, 38016, 0x70208948
+0, 440, 440, 1, 38016, 0xcf005140
+0, 441, 441, 1, 38016, 0xa7585013
+0, 442, 442, 1, 38016, 0x61145096
+0, 443, 443, 1, 38016, 0x92b952a5
+0, 444, 444, 1, 38016, 0x35575235
+0, 445, 445, 1, 38016, 0x3e47ec63
+0, 446, 446, 1, 38016, 0xfce57b69
+0, 447, 447, 1, 38016, 0xf03815e6
+0, 448, 448, 1, 38016, 0xb5b6af64
+0, 449, 449, 1, 38016, 0x5e3f1b08
+0, 450, 450, 1, 38016, 0xd3f9ee61
+0, 451, 451, 1, 38016, 0xb8e2ee66
+0, 452, 452, 1, 38016, 0x86f8f4b5
+0, 453, 453, 1, 38016, 0x23c8f499
+0, 454, 454, 1, 38016, 0x634df498
+0, 455, 455, 1, 38016, 0xd2b3f570
+0, 456, 456, 1, 38016, 0x053e67d3
+0, 457, 457, 1, 38016, 0x8d2cbeb3
+0, 458, 458, 1, 38016, 0xba0b1e1c
+0, 459, 459, 1, 38016, 0x0f5c7d73
+0, 460, 460, 1, 38016, 0x46b2118a
+0, 461, 461, 1, 38016, 0x818ebae5
+0, 462, 462, 1, 38016, 0x4a7af8a9
+0, 463, 463, 1, 38016, 0x0c22f937
+0, 464, 464, 1, 38016, 0x967ef9b3
+0, 465, 465, 1, 38016, 0x530afd34
+0, 466, 466, 1, 38016, 0x2a00fdb6
+0, 467, 467, 1, 38016, 0xca14f913
+0, 468, 468, 1, 38016, 0x82b6f7bc
+0, 469, 469, 1, 38016, 0xd32879ec
+0, 470, 470, 1, 38016, 0x242b6920
+0, 471, 471, 1, 38016, 0x44fd66e4
+0, 472, 472, 1, 38016, 0x69d3479c
+0, 473, 473, 1, 38016, 0x41a63899
+0, 474, 474, 1, 38016, 0xfb370720
+0, 475, 475, 1, 38016, 0x5cf0f42d
+0, 476, 476, 1, 38016, 0x74e8ca33
+0, 477, 477, 1, 38016, 0x1f09cb30
+0, 478, 478, 1, 38016, 0xc5e8c1d8
+0, 479, 479, 1, 38016, 0x3a82bd74
+0, 480, 480, 1, 38016, 0xada0bd71
+0, 481, 481, 1, 38016, 0xe695bcc9
+0, 482, 482, 1, 38016, 0xc255bb45
+0, 483, 483, 1, 38016, 0x6deebbcd
+0, 484, 484, 1, 38016, 0x6bf5cef2
+0, 485, 485, 1, 38016, 0x8eaed078
+0, 486, 486, 1, 38016, 0x3a8addb0
+0, 487, 487, 1, 38016, 0x0f2bfe11
+0, 488, 488, 1, 38016, 0xe13d2e3b
+0, 489, 489, 1, 38016, 0x9bb7606f
+0, 490, 490, 1, 38016, 0x9fcc8899
+0, 491, 491, 1, 38016, 0xfa22a313
+0, 492, 492, 1, 38016, 0xc599b318
+0, 493, 493, 1, 38016, 0x33ecb361
+0, 494, 494, 1, 38016, 0x2ba8b2df
+0, 495, 495, 1, 38016, 0x0debb343
+0, 496, 496, 1, 38016, 0x8bbcb7cd
+0, 497, 497, 1, 38016, 0x093fbb20
+0, 498, 498, 1, 38016, 0x4340c0d2
+0, 499, 499, 1, 38016, 0xd765bcb8
+0, 500, 500, 1, 38016, 0xe9ea3103
+0, 501, 501, 1, 38016, 0x24d7a1ae
+0, 502, 502, 1, 38016, 0x9b9ac80f
+0, 503, 503, 1, 38016, 0x81b7da0c
+0, 504, 504, 1, 38016, 0xb7c5f017
+0, 505, 505, 1, 38016, 0xa0e9f9c1
+0, 506, 506, 1, 38016, 0x932111a9
+0, 507, 507, 1, 38016, 0x15fc17ba
+0, 508, 508, 1, 38016, 0x3c7710bd
+0, 509, 509, 1, 38016, 0xae1b0ba8
+0, 510, 510, 1, 38016, 0x7dc24093
+0, 511, 511, 1, 38016, 0x8b9042ad
+0, 512, 512, 1, 38016, 0x257f4c1c
+0, 513, 513, 1, 38016, 0xaa0442d8
+0, 514, 514, 1, 38016, 0xbedd462c
+0, 515, 515, 1, 38016, 0xa9bd4905
+0, 516, 516, 1, 38016, 0x69d74f50
+0, 517, 517, 1, 38016, 0x18143c0d
+0, 518, 518, 1, 38016, 0xd2eb5820
+0, 519, 519, 1, 38016, 0x94fb5e93
+0, 520, 520, 1, 38016, 0x3072f80d
+0, 521, 521, 1, 38016, 0xd838f186
+0, 522, 522, 1, 38016, 0x3e41e695
+0, 523, 523, 1, 38016, 0x66eef2cd
+0, 524, 524, 1, 38016, 0x3854ec56
+0, 525, 525, 1, 38016, 0x05d3f9c2
+0, 526, 526, 1, 38016, 0x53820cc3
+0, 527, 527, 1, 38016, 0x09d413ea
+0, 528, 528, 1, 38016, 0x82f217f2
+0, 529, 529, 1, 38016, 0x07b21d50
+0, 530, 530, 1, 38016, 0xd72155c2
+0, 531, 531, 1, 38016, 0x20b04c74
+0, 532, 532, 1, 38016, 0x5b8962f6
+0, 533, 533, 1, 38016, 0xfb8b72c9
+0, 534, 534, 1, 38016, 0x6d0f56a7
+0, 535, 535, 1, 38016, 0x97876300
+0, 536, 536, 1, 38016, 0xfd7f655f
+0, 537, 537, 1, 38016, 0x3e405ff6
+0, 538, 538, 1, 38016, 0x5ad27a20
+0, 539, 539, 1, 38016, 0x46125305
+0, 540, 540, 1, 38016, 0x91017b86
+0, 541, 541, 1, 38016, 0x5c150c66
+0, 542, 542, 1, 38016, 0xc3430969
+0, 543, 543, 1, 38016, 0x5f400689
+0, 544, 544, 1, 38016, 0x21ddf969
+0, 545, 545, 1, 38016, 0x5feff594
+0, 546, 546, 1, 38016, 0xb304f3c1
+0, 547, 547, 1, 38016, 0xa9c3f70e
+0, 548, 548, 1, 38016, 0x6014fa8e
+0, 549, 549, 1, 38016, 0x7198f22e
+0, 550, 550, 1, 38016, 0xe338e495
+0, 551, 551, 1, 38016, 0x9a69ea32
+0, 552, 552, 1, 38016, 0xc0cc5d05
+0, 553, 553, 1, 38016, 0xefa16044
+0, 554, 554, 1, 38016, 0x3e3c6120
+0, 555, 555, 1, 38016, 0x06ef63e1
+0, 556, 556, 1, 38016, 0x25d5631f
+0, 557, 557, 1, 38016, 0xbc8963ee
+0, 558, 558, 1, 38016, 0xc2336218
+0, 559, 559, 1, 38016, 0xb23965fd
+0, 560, 560, 1, 38016, 0x84c9651f
+0, 561, 561, 1, 38016, 0x41f6647a
+0, 562, 562, 1, 38016, 0xddbe6572
+0, 563, 563, 1, 38016, 0x113f65f2
+0, 564, 564, 1, 38016, 0x89beec24
+0, 565, 565, 1, 38016, 0x6490f37b
+0, 566, 566, 1, 38016, 0x15ecf84d
+0, 567, 567, 1, 38016, 0xa439f491
+0, 568, 568, 1, 38016, 0xda8bf5c4
+0, 569, 569, 1, 38016, 0x6bc2f96a
+0, 570, 570, 1, 38016, 0x243d0bac
+0, 571, 571, 1, 38016, 0xb7c611a2
+0, 572, 572, 1, 38016, 0x99243328
+0, 573, 573, 1, 38016, 0xa9534571
+0, 574, 574, 1, 38016, 0xa5a657bd
+0, 575, 575, 1, 38016, 0xd8d06892
+0, 576, 576, 1, 38016, 0xb4eb6c8d
+0, 577, 577, 1, 38016, 0xa3d36ca8
+0, 578, 578, 1, 38016, 0x153a6e9e
+0, 579, 579, 1, 38016, 0xf2607081
+0, 580, 580, 1, 38016, 0x799d7081
+0, 581, 581, 1, 38016, 0x377570cd
+0, 582, 582, 1, 38016, 0x90496e54
+0, 583, 583, 1, 38016, 0x1d4c746c
+0, 584, 584, 1, 38016, 0xbe5e72bb
+0, 585, 585, 1, 38016, 0x3c6a760d
+0, 586, 586, 1, 38016, 0xd4097614
+0, 587, 587, 1, 38016, 0xf45a7a28
+0, 588, 588, 1, 38016, 0x8fe37bb8
+0, 589, 589, 1, 38016, 0x966295dc
+0, 590, 590, 1, 38016, 0xb40da3df
+0, 591, 591, 1, 38016, 0x9714b2ac
+0, 592, 592, 1, 38016, 0xbdb3c61d
+0, 593, 593, 1, 38016, 0x12fcd320
+0, 594, 594, 1, 38016, 0x1ee8d858
+0, 595, 595, 1, 38016, 0x49e5e217
+0, 596, 596, 1, 38016, 0x92aef38e
+0, 597, 597, 1, 38016, 0xc26c0476
+0, 598, 598, 1, 38016, 0x8eed0e04
+0, 599, 599, 1, 38016, 0xe4e3118d
+0, 600, 600, 1, 38016, 0x282ce796
+0, 601, 601, 1, 38016, 0xbec801e1
+0, 602, 602, 1, 38016, 0x864afaf2
+0, 603, 603, 1, 38016, 0xe0860383
+0, 604, 604, 1, 38016, 0x4261001d
+0, 605, 605, 1, 38016, 0x976c0005
+0, 606, 606, 1, 38016, 0x69c40af3
+0, 607, 607, 1, 38016, 0xb3c00e18
+0, 608, 608, 1, 38016, 0x28300c2c
+0, 609, 609, 1, 38016, 0xf2d9ff9d
+0, 610, 610, 1, 38016, 0xcaeaf979
+0, 611, 611, 1, 38016, 0x6733f58e
+0, 612, 612, 1, 38016, 0x2bb80869
+0, 613, 613, 1, 38016, 0x3c370085
+0, 614, 614, 1, 38016, 0x11a2fa2a
+0, 615, 615, 1, 38016, 0x828ff770
+0, 616, 616, 1, 38016, 0x79bcf490
+0, 617, 617, 1, 38016, 0x31d5ee87
+0, 618, 618, 1, 38016, 0x6336f00d
+0, 619, 619, 1, 38016, 0x058af9d1
+0, 620, 620, 1, 38016, 0xff29eb2f
+0, 621, 621, 1, 38016, 0x3c3be1f4
+0, 622, 622, 1, 38016, 0xfbf5ddc2
+0, 623, 623, 1, 38016, 0x22a4d324
+0, 624, 624, 1, 38016, 0xb2d4d1d4
+0, 625, 625, 1, 38016, 0xa159171f
+0, 626, 626, 1, 38016, 0x61a80251
+0, 627, 627, 1, 38016, 0xe0429283
+0, 628, 628, 1, 38016, 0x5c255bd4
+0, 629, 629, 1, 38016, 0xdb0f57ac
+0, 630, 630, 1, 38016, 0x3c8bcbf0
+0, 631, 631, 1, 38016, 0x2be3d2ef
+0, 632, 632, 1, 38016, 0xcd2dc8cc
+0, 633, 633, 1, 38016, 0x6905c4cf
+0, 634, 634, 1, 38016, 0xd9c9c590
+0, 635, 635, 1, 38016, 0xa945cb51
+0, 636, 636, 1, 38016, 0x5c8458d3
+0, 637, 637, 1, 38016, 0xa1624b6e
+0, 638, 638, 1, 38016, 0xb167532e
+0, 639, 639, 1, 38016, 0x149d6413
+0, 640, 640, 1, 38016, 0x85d97340
+0, 641, 641, 1, 38016, 0x8f478203
+0, 642, 642, 1, 38016, 0x1902cc8e
+0, 643, 643, 1, 38016, 0x1521c5e5
+0, 644, 644, 1, 38016, 0xf2d6c7d8
+0, 645, 645, 1, 38016, 0x7150c510
+0, 646, 646, 1, 38016, 0xfc0ec330
+0, 647, 647, 1, 38016, 0x91c4c933
+0, 648, 648, 1, 38016, 0x5ec6cbc8
+0, 649, 649, 1, 38016, 0x23c0955c
+0, 650, 650, 1, 38016, 0x76fb7c27
+0, 651, 651, 1, 38016, 0x33c07597
+0, 652, 652, 1, 38016, 0x797b6acd
+0, 653, 653, 1, 38016, 0xc4945313
+0, 654, 654, 1, 38016, 0xa50f25da
+0, 655, 655, 1, 38016, 0x7bb6096c
+0, 656, 656, 1, 38016, 0x8a1acc48
+0, 657, 657, 1, 38016, 0x19a1c9b4
+0, 658, 658, 1, 38016, 0x4436cd03
+0, 659, 659, 1, 38016, 0xfd73d6fe
+0, 660, 660, 1, 38016, 0x25d3d4f0
+0, 661, 661, 1, 38016, 0x3acfcd98
+0, 662, 662, 1, 38016, 0x2ed3d071
+0, 663, 663, 1, 38016, 0x246fd4bd
+0, 664, 664, 1, 38016, 0x3e410c62
+0, 665, 665, 1, 38016, 0x29da1177
+0, 666, 666, 1, 38016, 0x039f1e46
+0, 667, 667, 1, 38016, 0x178d1e1a
+0, 668, 668, 1, 38016, 0x75561d47
+0, 669, 669, 1, 38016, 0x7d65193c
+0, 670, 670, 1, 38016, 0xd38d19a8
+0, 671, 671, 1, 38016, 0x39c92b20
+0, 672, 672, 1, 38016, 0x6c8aebc3
+0, 673, 673, 1, 38016, 0xd8d4f9be
+0, 674, 674, 1, 38016, 0x7e730a4a
+0, 675, 675, 1, 38016, 0xbfae1fee
+0, 676, 676, 1, 38016, 0x398f3484
+0, 677, 677, 1, 38016, 0xd8e84019
+0, 678, 678, 1, 38016, 0x2cf64db3
+0, 679, 679, 1, 38016, 0x7e074f09
+0, 680, 680, 1, 38016, 0xac384b5a
+0, 681, 681, 1, 38016, 0xd28b3a83
+0, 682, 682, 1, 38016, 0xa5ce5610
+0, 683, 683, 1, 38016, 0xde8565f7
+0, 684, 684, 1, 38016, 0x01397a1a
+0, 685, 685, 1, 38016, 0xdbdf7fb7
+0, 686, 686, 1, 38016, 0x8c1f8ba6
+0, 687, 687, 1, 38016, 0xab2a943c
+0, 688, 688, 1, 38016, 0x4f8b8421
+0, 689, 689, 1, 38016, 0x36f57b3a
+0, 690, 690, 1, 38016, 0x565c4dd9
+0, 691, 691, 1, 38016, 0x53c34715
+0, 692, 692, 1, 38016, 0x38fd4aaa
+0, 693, 693, 1, 38016, 0x4dca43eb
+0, 694, 694, 1, 38016, 0x1afe40f3
+0, 695, 695, 1, 38016, 0xc3dc43cc
+0, 696, 696, 1, 38016, 0x1d92431d
+0, 697, 697, 1, 38016, 0x3f794765
+0, 698, 698, 1, 38016, 0x1c5d4a71
+0, 699, 699, 1, 38016, 0xb601531e
+0, 700, 700, 1, 38016, 0x4d925d7c
+0, 701, 701, 1, 38016, 0x1c605f1e
+0, 702, 702, 1, 38016, 0x50ff5608
+0, 703, 703, 1, 38016, 0x8da14815
+0, 704, 704, 1, 38016, 0x53cc3007
+0, 705, 705, 1, 38016, 0x5ce82198
+0, 706, 706, 1, 38016, 0x074e15bc
+0, 707, 707, 1, 38016, 0x59fb13c9
+0, 708, 708, 1, 38016, 0xe28e13a6
+0, 709, 709, 1, 38016, 0xcb4f3fa8
+0, 710, 710, 1, 38016, 0x7fad560c
+0, 711, 711, 1, 38016, 0x7dbc614a
+0, 712, 712, 1, 38016, 0xe96f6d9c
+0, 713, 713, 1, 38016, 0xf3c47a74
+0, 714, 714, 1, 38016, 0xd2af8027
+0, 715, 715, 1, 38016, 0x504779d1
+0, 716, 716, 1, 38016, 0x876e7f5f
+0, 717, 717, 1, 38016, 0x959f8c3d
+0, 718, 718, 1, 38016, 0x64d690be
+0, 719, 719, 1, 38016, 0xdb899760
+0, 720, 720, 1, 38016, 0xbd229ba1
+0, 721, 721, 1, 38016, 0xdace575b
+0, 722, 722, 1, 38016, 0xfda46324
+0, 723, 723, 1, 38016, 0x57b75dbd
+0, 724, 724, 1, 38016, 0x264a59cf
+0, 725, 725, 1, 38016, 0xfde95cc8
+0, 726, 726, 1, 38016, 0x5116601b
+0, 727, 727, 1, 38016, 0x72e67205
+0, 728, 728, 1, 38016, 0xf1057674
+0, 729, 729, 1, 38016, 0x7e917eb9
+0, 730, 730, 1, 38016, 0x50ed8b28
+0, 731, 731, 1, 38016, 0x357a826c
+0, 732, 732, 1, 38016, 0xd68fa449
+0, 733, 733, 1, 38016, 0x3a839e39
+0, 734, 734, 1, 38016, 0x79469a1b
+0, 735, 735, 1, 38016, 0xa9ca9590
+0, 736, 736, 1, 38016, 0xbf399686
+0, 737, 737, 1, 38016, 0x40499eaf
+0, 738, 738, 1, 38016, 0x9972a76d
+0, 739, 739, 1, 38016, 0xa3d0aff4
+0, 740, 740, 1, 38016, 0xdf27b647
+0, 741, 741, 1, 38016, 0x4147c66e
+0, 742, 742, 1, 38016, 0x1378d1db
+0, 743, 743, 1, 38016, 0x1ca3d444
+0, 744, 744, 1, 38016, 0x464d9538
+0, 745, 745, 1, 38016, 0xaed28de9
+0, 746, 746, 1, 38016, 0xc77a9f86
+0, 747, 747, 1, 38016, 0x0882aa10
+0, 748, 748, 1, 38016, 0x206ac330
+0, 749, 749, 1, 38016, 0x63efd763
+0, 750, 750, 1, 38016, 0xbfe2e663
+0, 751, 751, 1, 38016, 0xfe6ff1ad
+0, 752, 752, 1, 38016, 0x60f9f47e
+0, 753, 753, 1, 38016, 0xba1cf0c0
+0, 754, 754, 1, 38016, 0x1880eb3d
+0, 755, 755, 1, 38016, 0xf0fdd350
+0, 756, 756, 1, 38016, 0xb678eedb
+0, 757, 757, 1, 38016, 0xa17cf5e4
+0, 758, 758, 1, 38016, 0x567fff2a
+0, 759, 759, 1, 38016, 0x52ab043b
+0, 760, 760, 1, 38016, 0x8e8b0bd9
+0, 761, 761, 1, 38016, 0x0f131a7e
+0, 762, 762, 1, 38016, 0x26aa2303
+0, 763, 763, 1, 38016, 0x70c12bab
+0, 764, 764, 1, 38016, 0xa8a93858
+0, 765, 765, 1, 38016, 0x289f3b94
+0, 766, 766, 1, 38016, 0x3d883605
+0, 767, 767, 1, 38016, 0xe171329e
+0, 768, 768, 1, 38016, 0x75292865
+0, 769, 769, 1, 38016, 0x1d2ac8dc
+0, 770, 770, 1, 38016, 0xa336aa94
+0, 771, 771, 1, 38016, 0xcede9906
+0, 772, 772, 1, 38016, 0x1c9a8b52
+0, 773, 773, 1, 38016, 0x2a9c8a78
+0, 774, 774, 1, 38016, 0x920a8583
+0, 775, 775, 1, 38016, 0xb3ee7e2d
+0, 776, 776, 1, 38016, 0x96be75fc
+0, 777, 777, 1, 38016, 0x2a8a68d2
+0, 778, 778, 1, 38016, 0xdf8e6baf
+0, 779, 779, 1, 38016, 0xd46570d1
+0, 780, 780, 1, 38016, 0x765b71af
+0, 781, 781, 1, 38016, 0x25fe71df
+0, 782, 782, 1, 38016, 0x9ca124e3
+0, 783, 783, 1, 38016, 0x77c51bab
+0, 784, 784, 1, 38016, 0x0b380db9
+0, 785, 785, 1, 38016, 0xb0be108b
+0, 786, 786, 1, 38016, 0x5c4808b8
+0, 787, 787, 1, 38016, 0x73331227
+0, 788, 788, 1, 38016, 0xce790cf2
+0, 789, 789, 1, 38016, 0x46ac0dfc
+0, 790, 790, 1, 38016, 0xdc310caf
+0, 791, 791, 1, 38016, 0x909c0606
+0, 792, 792, 1, 38016, 0x0756fb3e
+0, 793, 793, 1, 38016, 0x4eb0fb0d
+0, 794, 794, 1, 38016, 0x6276f6e2
+0, 795, 795, 1, 38016, 0x92e0f070
+0, 796, 796, 1, 38016, 0x6f2d793f
+0, 797, 797, 1, 38016, 0x215f704b
+0, 798, 798, 1, 38016, 0xf9b7765e
+0, 799, 799, 1, 38016, 0xdb6176bf
+0, 800, 800, 1, 38016, 0x2b5165eb
+0, 801, 801, 1, 38016, 0xf1145c06
+0, 802, 802, 1, 38016, 0x343f698d
+0, 803, 803, 1, 38016, 0xcb96713f
+0, 804, 804, 1, 38016, 0xc50f775a
+0, 805, 805, 1, 38016, 0xbb927e81
+0, 806, 806, 1, 38016, 0xa2497bd4
+0, 807, 807, 1, 38016, 0xe52b80fa
+0, 808, 808, 1, 38016, 0x900f7ac7
+0, 809, 809, 1, 38016, 0x77e77d0e
+0, 810, 810, 1, 38016, 0xdb33f302
+0, 811, 811, 1, 38016, 0xf0519288
+0, 812, 812, 1, 38016, 0x4552f487
+0, 813, 813, 1, 38016, 0xe7b5f34c
+0, 814, 814, 1, 38016, 0x0db18be6
+0, 815, 815, 1, 38016, 0xb9ba87c2
+0, 816, 816, 1, 38016, 0x1dc2f805
+0, 817, 817, 1, 38016, 0x4986f535
+0, 818, 818, 1, 38016, 0xc099f301
+0, 819, 819, 1, 38016, 0x3d8c6787
+0, 820, 820, 1, 38016, 0xd3a4796f
+0, 821, 821, 1, 38016, 0xfe01635f
+0, 822, 822, 1, 38016, 0xba8df082
+0, 823, 823, 1, 38016, 0x55f3f017
+0, 824, 824, 1, 38016, 0xf2d7f36a
+0, 825, 825, 1, 38016, 0x8bd8f7a1
+0, 826, 826, 1, 38016, 0xabcd638b
+0, 827, 827, 1, 38016, 0x69ae59ea
+0, 828, 828, 1, 38016, 0x5bf43408
+0, 829, 829, 1, 38016, 0x6466fd67
+0, 830, 830, 1, 38016, 0xc90effb4
+0, 831, 831, 1, 38016, 0x82110480
+0, 832, 832, 1, 38016, 0xb364f74b
+0, 833, 833, 1, 38016, 0x7f1efd76
+0, 834, 834, 1, 38016, 0x1a20f30f
+0, 835, 835, 1, 38016, 0x4b0fe377
+0, 836, 836, 1, 38016, 0x57b4c896
+0, 837, 837, 1, 38016, 0x92b1ab52
+0, 838, 838, 1, 38016, 0x10ceaf82
+0, 839, 839, 1, 38016, 0xc4d3b0b8
+0, 840, 840, 1, 38016, 0x68b9f314
+0, 841, 841, 1, 38016, 0xc627fd70
+0, 842, 842, 1, 38016, 0x5fc108dc
+0, 843, 843, 1, 38016, 0x0f1f12d7
+0, 844, 844, 1, 38016, 0x6edc208e
+0, 845, 845, 1, 38016, 0x91f824eb
+0, 846, 846, 1, 38016, 0x1464b836
+0, 847, 847, 1, 38016, 0x84c7c412
+0, 848, 848, 1, 38016, 0x3e8dd049
+0, 849, 849, 1, 38016, 0x493dd1a7
+0, 850, 850, 1, 38016, 0x25dfbd00
+0, 851, 851, 1, 38016, 0x140bbd33
+0, 852, 852, 1, 38016, 0x488e2db6
+0, 853, 853, 1, 38016, 0x9e4f2c0a
+0, 854, 854, 1, 38016, 0xd60928d3
+0, 855, 855, 1, 38016, 0x38b61e0b
+0, 856, 856, 1, 38016, 0xb6331660
+0, 857, 857, 1, 38016, 0x0a3a0e4c
+0, 858, 858, 1, 38016, 0x6ad9105b
+0, 859, 859, 1, 38016, 0x29a8cd6b
+0, 860, 860, 1, 38016, 0x35e1da7d
+0, 861, 861, 1, 38016, 0x824de492
+0, 862, 862, 1, 38016, 0x1c76d83c
+0, 863, 863, 1, 38016, 0xbe25d98d
+0, 864, 864, 1, 38016, 0x5efaf222
+0, 865, 865, 1, 38016, 0x17370266
+0, 866, 866, 1, 38016, 0x417a2375
+0, 867, 867, 1, 38016, 0xb7e423d3
+0, 868, 868, 1, 38016, 0x224020fe
+0, 869, 869, 1, 38016, 0x4bbe1ee9
+0, 870, 870, 1, 38016, 0x72aa1f21
+0, 871, 871, 1, 38016, 0xc810126d
+0, 872, 872, 1, 38016, 0x42730cd4
+0, 873, 873, 1, 38016, 0xfd510c5d
+0, 874, 874, 1, 38016, 0x7c6f1313
+0, 875, 875, 1, 38016, 0xc1b31b89
+0, 876, 876, 1, 38016, 0x57772339
+0, 877, 877, 1, 38016, 0x20922349
+0, 878, 878, 1, 38016, 0xea4f1a45
+0, 879, 879, 1, 38016, 0x79e214d2
+0, 880, 880, 1, 38016, 0x77521b5d
+0, 881, 881, 1, 38016, 0x5929276c
+0, 882, 882, 1, 38016, 0x40b3130d
+0, 883, 883, 1, 38016, 0x040a157e
+0, 884, 884, 1, 38016, 0x0de31983
+0, 885, 885, 1, 38016, 0xdb0a1852
+0, 886, 886, 1, 38016, 0x73111b91
+0, 887, 887, 1, 38016, 0xf7a61765
+0, 888, 888, 1, 38016, 0xc5dd2557
+0, 889, 889, 1, 38016, 0xabc32e16
+0, 890, 890, 1, 38016, 0x5f093823
+0, 891, 891, 1, 38016, 0x9f462f1e
+0, 892, 892, 1, 38016, 0x29822c19
+0, 893, 893, 1, 38016, 0x259a2697
+0, 894, 894, 1, 38016, 0x7ad61867
+0, 895, 895, 1, 38016, 0x32fe111f
+0, 896, 896, 1, 38016, 0xf65c1142
+0, 897, 897, 1, 38016, 0xc5b91a6d
+0, 898, 898, 1, 38016, 0x4461191e
+0, 899, 899, 1, 38016, 0x0458193a
+0, 900, 900, 1, 38016, 0x3ed084a9
+0, 901, 901, 1, 38016, 0x4dd28047
+0, 902, 902, 1, 38016, 0x18dd8523
+0, 903, 903, 1, 38016, 0x4ab87d32
+0, 904, 904, 1, 38016, 0xecd0824c
+0, 905, 905, 1, 38016, 0xae567d36
+0, 906, 906, 1, 38016, 0xfa2e82d0
+0, 907, 907, 1, 38016, 0xbce08c2e
+0, 908, 908, 1, 38016, 0x125094c4
+0, 909, 909, 1, 38016, 0x475e9b1d
+0, 910, 910, 1, 38016, 0x9b921150
+0, 911, 911, 1, 38016, 0x6f7b1124
+0, 912, 912, 1, 38016, 0xa1fe0d8b
+0, 913, 913, 1, 38016, 0x12930955
+0, 914, 914, 1, 38016, 0x3d981105
+0, 915, 915, 1, 38016, 0x92d92e3b
+0, 916, 916, 1, 38016, 0x29a33ed5
+0, 917, 917, 1, 38016, 0x8d0b578e
+0, 918, 918, 1, 38016, 0xda5571ba
+0, 919, 919, 1, 38016, 0xbc638172
+0, 920, 920, 1, 38016, 0x73fd9abb
+0, 921, 921, 1, 38016, 0x53df952b
+0, 922, 922, 1, 38016, 0xe1758a4c
+0, 923, 923, 1, 38016, 0x064f8812
+0, 924, 924, 1, 38016, 0xd9b08971
+0, 925, 925, 1, 38016, 0xfe6688a9
+0, 926, 926, 1, 38016, 0x3b50938b
+0, 927, 927, 1, 38016, 0x4e1a9c13
+0, 928, 928, 1, 38016, 0x63599bf0
+0, 929, 929, 1, 38016, 0x97e0957f
+0, 930, 930, 1, 38016, 0x5a6e98d7
+0, 931, 931, 1, 38016, 0xa4be8cf2
+0, 932, 932, 1, 38016, 0x53bb901e
+0, 933, 933, 1, 38016, 0x15f0994e
+0, 934, 934, 1, 38016, 0x71499a4b
+0, 935, 935, 1, 38016, 0xf41a87a5
+0, 936, 936, 1, 38016, 0x3e237999
+0, 937, 937, 1, 38016, 0xf77f5dd2
+0, 938, 938, 1, 38016, 0x89874799
+0, 939, 939, 1, 38016, 0x02d82294
+0, 940, 940, 1, 38016, 0xc5920154
+0, 941, 941, 1, 38016, 0x6e61f375
+0, 942, 942, 1, 38016, 0x41a6940c
+0, 943, 943, 1, 38016, 0x130b97f7
+0, 944, 944, 1, 38016, 0xdff09b51
+0, 945, 945, 1, 38016, 0xb2999bd6
+0, 946, 946, 1, 38016, 0x0bb99d20
+0, 947, 947, 1, 38016, 0x9f819633
+0, 948, 948, 1, 38016, 0x5bda9640
+0, 949, 949, 1, 38016, 0xdcf29321
+0, 950, 950, 1, 38016, 0xa6838a63
+0, 951, 951, 1, 38016, 0x820a825e
+0, 952, 952, 1, 38016, 0x69bb7859
+0, 953, 953, 1, 38016, 0x4a8c79c2
+0, 954, 954, 1, 38016, 0x1e97e67d
+0, 955, 955, 1, 38016, 0x1ad4de1b
+0, 956, 956, 1, 38016, 0xe8abeb33
+0, 957, 957, 1, 38016, 0xf3a51523
+0, 958, 958, 1, 38016, 0xb997399c
+0, 959, 959, 1, 38016, 0x9fee8105
+0, 960, 960, 1, 38016, 0xf2b6ada3
+0, 961, 961, 1, 38016, 0xe6f5bbb3
+0, 962, 962, 1, 38016, 0x8ed7ca9f
+0, 963, 963, 1, 38016, 0x711abc1a
+0, 964, 964, 1, 38016, 0x707ab544
+0, 965, 965, 1, 38016, 0x03b8af51
+0, 966, 966, 1, 38016, 0x50497b2c
+0, 967, 967, 1, 38016, 0x72b57a30
+0, 968, 968, 1, 38016, 0xfb6d8164
+0, 969, 969, 1, 38016, 0x88618e82
+0, 970, 970, 1, 38016, 0xb7369e49
+0, 971, 971, 1, 38016, 0x2502a3ca
+0, 972, 972, 1, 38016, 0x793aa276
+0, 973, 973, 1, 38016, 0x883a8ec6
+0, 974, 974, 1, 38016, 0x5f7784e5
+0, 975, 975, 1, 38016, 0xddfa7e94
+0, 976, 976, 1, 38016, 0xdb877fb8
+0, 977, 977, 1, 38016, 0x07e07f39
+0, 978, 978, 1, 38016, 0x412590fb
+0, 979, 979, 1, 38016, 0x1bd1b527
+0, 980, 980, 1, 38016, 0xbb6098c3
+0, 981, 981, 1, 38016, 0x5f1b8788
+0, 982, 982, 1, 38016, 0x42f068e8
+0, 983, 983, 1, 38016, 0x316b53bb
+0, 984, 984, 1, 38016, 0xbdbb3fa0
+0, 985, 985, 1, 38016, 0xa68f506c
+0, 986, 986, 1, 38016, 0xca355d03
+0, 987, 987, 1, 38016, 0xfafc6b88
+0, 988, 988, 1, 38016, 0x0f106535
+0, 989, 989, 1, 38016, 0xa4ae4e63
+0, 990, 990, 1, 38016, 0xb206400f
+0, 991, 991, 1, 38016, 0x3a5946d1
+0, 992, 992, 1, 38016, 0xca739868
+0, 993, 993, 1, 38016, 0xe6939d41
+0, 994, 994, 1, 38016, 0x2ec19a76
+0, 995, 995, 1, 38016, 0x614e96a4
+0, 996, 996, 1, 38016, 0x2c2b9348
+0, 997, 997, 1, 38016, 0xa00c7f1f
+0, 998, 998, 1, 38016, 0x95cb6eca
+0, 999, 999, 1, 38016, 0x069d6c4c
+0, 1000, 1000, 1, 38016, 0xe17e03e3
+0, 1001, 1001, 1, 38016, 0xa7491870
+0, 1002, 1002, 1, 38016, 0xacc91e48
+0, 1003, 1003, 1, 38016, 0x99eb1e2a
+0, 1004, 1004, 1, 38016, 0xb2eb1279
+0, 1005, 1005, 1, 38016, 0xa5020c77
+0, 1006, 1006, 1, 38016, 0xde966613
+0, 1007, 1007, 1, 38016, 0xac7f6e1e
+0, 1008, 1008, 1, 38016, 0x1c378a7a
+0, 1009, 1009, 1, 38016, 0x32e6d8a4
+0, 1010, 1010, 1, 38016, 0xecb8d286
+0, 1011, 1011, 1, 38016, 0xa497d941
+0, 1012, 1012, 1, 38016, 0x8ad7d36e
+0, 1013, 1013, 1, 38016, 0xdbd8a91a
+0, 1014, 1014, 1, 38016, 0x718f61d7
+0, 1015, 1015, 1, 38016, 0x862619cf
+0, 1016, 1016, 1, 38016, 0xaa049781
+0, 1017, 1017, 1, 38016, 0xd3986887
+0, 1018, 1018, 1, 38016, 0x9e9f5782
+0, 1019, 1019, 1, 38016, 0x2a9d4f70
+0, 1020, 1020, 1, 38016, 0x62b91421
+0, 1021, 1021, 1, 38016, 0x32313eaa
+0, 1022, 1022, 1, 38016, 0xf9bf1879
+0, 1023, 1023, 1, 38016, 0xc33c0811
+0, 1024, 1024, 1, 38016, 0xe9c21227
+0, 1025, 1025, 1, 38016, 0xf2922db6
+0, 1026, 1026, 1, 38016, 0x669d0627
+0, 1027, 1027, 1, 38016, 0x64c1048a
+0, 1028, 1028, 1, 38016, 0xdd28fa70
+0, 1029, 1029, 1, 38016, 0xd88e8b77
+0, 1030, 1030, 1, 38016, 0x3716bdb8
+0, 1031, 1031, 1, 38016, 0x1834ef57
+0, 1032, 1032, 1, 38016, 0xddb800b7
+0, 1033, 1033, 1, 38016, 0x140302cc
+0, 1034, 1034, 1, 38016, 0x7fa60568
+0, 1035, 1035, 1, 38016, 0x7cc6fd4b
+0, 1036, 1036, 1, 38016, 0xf14c2568
+0, 1037, 1037, 1, 38016, 0x2ee88bbc
+0, 1038, 1038, 1, 38016, 0x915cd143
+0, 1039, 1039, 1, 38016, 0x13ede5fa
+0, 1040, 1040, 1, 38016, 0x6615f63b
+0, 1041, 1041, 1, 38016, 0x8814f54f
+0, 1042, 1042, 1, 38016, 0xb53ef24a
+0, 1043, 1043, 1, 38016, 0xc6a8ee80
+0, 1044, 1044, 1, 38016, 0x9473ee09
+0, 1045, 1045, 1, 38016, 0x9b77d932
+0, 1046, 1046, 1, 38016, 0x142fc69a
+0, 1047, 1047, 1, 38016, 0xb238c6a2
+0, 1048, 1048, 1, 38016, 0x4364d302
+0, 1049, 1049, 1, 38016, 0xde39d174
+0, 1050, 1050, 1, 38016, 0x7fca7fa6
+0, 1051, 1051, 1, 38016, 0x77678d42
+0, 1052, 1052, 1, 38016, 0xaa7e8b68
+0, 1053, 1053, 1, 38016, 0xeecb8c89
+0, 1054, 1054, 1, 38016, 0x6e5e8980
+0, 1055, 1055, 1, 38016, 0x4f4a80de
+0, 1056, 1056, 1, 38016, 0xb3b5cee6
+0, 1057, 1057, 1, 38016, 0x0c72cf1c
+0, 1058, 1058, 1, 38016, 0xd83fd12d
+0, 1059, 1059, 1, 38016, 0x8deeda59
+0, 1060, 1060, 1, 38016, 0xe7fae46e
+0, 1061, 1061, 1, 38016, 0x8233ecd5
+0, 1062, 1062, 1, 38016, 0x0c32808c
+0, 1063, 1063, 1, 38016, 0xf43f8571
+0, 1064, 1064, 1, 38016, 0xae898f01
+0, 1065, 1065, 1, 38016, 0x5a4a99e9
+0, 1066, 1066, 1, 38016, 0x589f9b80
+0, 1067, 1067, 1, 38016, 0x6ca5a33b
+0, 1068, 1068, 1, 38016, 0x3811af0a
+0, 1069, 1069, 1, 38016, 0x8272eda7
+0, 1070, 1070, 1, 38016, 0xa807f046
+0, 1071, 1071, 1, 38016, 0x5b4fec80
+0, 1072, 1072, 1, 38016, 0xb6e6e7fa
+0, 1073, 1073, 1, 38016, 0x250cdb5c
+0, 1074, 1074, 1, 38016, 0x3f38e876
+0, 1075, 1075, 1, 38016, 0x8110e94a
+0, 1076, 1076, 1, 38016, 0x0f19abd7
+0, 1077, 1077, 1, 38016, 0x9e1ca9bd
+0, 1078, 1078, 1, 38016, 0x1f33abae
+0, 1079, 1079, 1, 38016, 0xff18ad65
+0, 1080, 1080, 1, 38016, 0x3d02b300
+0, 1081, 1081, 1, 38016, 0xb7a9b4b2
+0, 1082, 1082, 1, 38016, 0xd8cab454
+0, 1083, 1083, 1, 38016, 0xb48ab772
+0, 1084, 1084, 1, 38016, 0x7f98fe59
+0, 1085, 1085, 1, 38016, 0x786c1795
+0, 1086, 1086, 1, 38016, 0x013437ff
+0, 1087, 1087, 1, 38016, 0xba28622a
+0, 1088, 1088, 1, 38016, 0xf48486e1
+0, 1089, 1089, 1, 38016, 0xc13695c4
+0, 1090, 1090, 1, 38016, 0x1fc5a4d2
+0, 1091, 1091, 1, 38016, 0x016caefd
+0, 1092, 1092, 1, 38016, 0x76b8bc54
+0, 1093, 1093, 1, 38016, 0xcf63bdbc
+0, 1094, 1094, 1, 38016, 0xeb02c0e2
+0, 1095, 1095, 1, 38016, 0xb57dc067
+0, 1096, 1096, 1, 38016, 0x8ec8c058
+0, 1097, 1097, 1, 38016, 0xcb04be49
+0, 1098, 1098, 1, 38016, 0xceccbfac
+0, 1099, 1099, 1, 38016, 0x3408c0c3
+0, 1100, 1100, 1, 38016, 0xee526afa
+0, 1101, 1101, 1, 38016, 0xd7529aad
+0, 1102, 1102, 1, 38016, 0x98bd9221
+0, 1103, 1103, 1, 38016, 0x2fbd7e5a
+0, 1104, 1104, 1, 38016, 0x0fb8a8fc
+0, 1105, 1105, 1, 38016, 0xfd28af91
+0, 1106, 1106, 1, 38016, 0x81db9907
+0, 1107, 1107, 1, 38016, 0x1f0a8ae7
+0, 1108, 1108, 1, 38016, 0xd91e93e3
+0, 1109, 1109, 1, 38016, 0x5fe6b043
+0, 1110, 1110, 1, 38016, 0x2a618a48
+0, 1111, 1111, 1, 38016, 0xef1c8cc2
+0, 1112, 1112, 1, 38016, 0x928595ce
+0, 1113, 1113, 1, 38016, 0xf2a59a43
+0, 1114, 1114, 1, 38016, 0x61bf92d0
+0, 1115, 1115, 1, 38016, 0x584d840f
+0, 1116, 1116, 1, 38016, 0x42177cb1
+0, 1117, 1117, 1, 38016, 0x08867c3b
+0, 1118, 1118, 1, 38016, 0x5a89813b
+0, 1119, 1119, 1, 38016, 0xba558022
+0, 1120, 1120, 1, 38016, 0x3d58878a
+0, 1121, 1121, 1, 38016, 0x8d215911
+0, 1122, 1122, 1, 38016, 0xea27370c
+0, 1123, 1123, 1, 38016, 0x7e2a1a9c
+0, 1124, 1124, 1, 38016, 0xbb86f763
+0, 1125, 1125, 1, 38016, 0xf03fd3c7
+0, 1126, 1126, 1, 38016, 0x1eaac263
+0, 1127, 1127, 1, 38016, 0x8a4bd0e1
+0, 1128, 1128, 1, 38016, 0x5adcf66d
+0, 1129, 1129, 1, 38016, 0xa0320a89
+0, 1130, 1130, 1, 38016, 0x77338f96
+0, 1131, 1131, 1, 38016, 0xf3498f6a
+0, 1132, 1132, 1, 38016, 0x7e248dcf
+0, 1133, 1133, 1, 38016, 0xf7f68dcc
+0, 1134, 1134, 1, 38016, 0x5da597c9
+0, 1135, 1135, 1, 38016, 0x63db9d00
+0, 1136, 1136, 1, 38016, 0xd1f09e52
+0, 1137, 1137, 1, 38016, 0xfc7ba2e1
+0, 1138, 1138, 1, 38016, 0x8c26ab25
+0, 1139, 1139, 1, 38016, 0x6a45add3
+0, 1140, 1140, 1, 38016, 0x0dd7b2a2
+0, 1141, 1141, 1, 38016, 0x70c00c4f
+0, 1142, 1142, 1, 38016, 0x437e255e
+0, 1143, 1143, 1, 38016, 0x63dd455b
+0, 1144, 1144, 1, 38016, 0x01453a2e
+0, 1145, 1145, 1, 38016, 0x08c120af
+0, 1146, 1146, 1, 38016, 0xf3111451
+0, 1147, 1147, 1, 38016, 0xf3f10603
+0, 1148, 1148, 1, 38016, 0xb154fa41
+0, 1149, 1149, 1, 38016, 0x4734ee73
+0, 1150, 1150, 1, 38016, 0x28ca7926
+0, 1151, 1151, 1, 38016, 0xbb628234
+0, 1152, 1152, 1, 38016, 0x0ca1b42f
+0, 1153, 1153, 1, 38016, 0x8397b202
+0, 1154, 1154, 1, 38016, 0x9d92b832
+0, 1155, 1155, 1, 38016, 0x8fbeb4b2
+0, 1156, 1156, 1, 38016, 0x056aa904
+0, 1157, 1157, 1, 38016, 0x4e78a55c
+0, 1158, 1158, 1, 38016, 0xe8a8a265
+0, 1159, 1159, 1, 38016, 0xb703a17b
+0, 1160, 1160, 1, 38016, 0xe79e9d71
+0, 1161, 1161, 1, 38016, 0xbd769f5d
+0, 1162, 1162, 1, 38016, 0x602ea70f
+0, 1163, 1163, 1, 38016, 0x034caf76
+0, 1164, 1164, 1, 38016, 0x28dd9702
+0, 1165, 1165, 1, 38016, 0xc8879c85
+0, 1166, 1166, 1, 38016, 0x15b098f2
+0, 1167, 1167, 1, 38016, 0xf34b9ce5
+0, 1168, 1168, 1, 38016, 0x6d159fbf
+0, 1169, 1169, 1, 38016, 0x22eb9cac
+0, 1170, 1170, 1, 38016, 0xae42a220
+0, 1171, 1171, 1, 38016, 0x1275a131
+0, 1172, 1172, 1, 38016, 0x8188a057
+0, 1173, 1173, 1, 38016, 0x65dea0d1
+0, 1174, 1174, 1, 38016, 0x5bd19be2
+0, 1175, 1175, 1, 38016, 0xfbd99219
+0, 1176, 1176, 1, 38016, 0xad19b3a2
+0, 1177, 1177, 1, 38016, 0xa897bb92
+0, 1178, 1178, 1, 38016, 0x5b1fbf2e
+0, 1179, 1179, 1, 38016, 0x02a5cb24
+0, 1180, 1180, 1, 38016, 0xd6ead6fe
+0, 1181, 1181, 1, 38016, 0x3083de8a
+0, 1182, 1182, 1, 38016, 0xbf1decb4
+0, 1183, 1183, 1, 38016, 0xd92af986
+0, 1184, 1184, 1, 38016, 0x4c520154
+0, 1185, 1185, 1, 38016, 0xd45805a1
+0, 1186, 1186, 1, 38016, 0x25e2084d
+0, 1187, 1187, 1, 38016, 0x4e3d0960
+0, 1188, 1188, 1, 38016, 0x5b449ef2
+0, 1189, 1189, 1, 38016, 0xda15abcc
+0, 1190, 1190, 1, 38016, 0x1b3ba622
+0, 1191, 1191, 1, 38016, 0xaf61a32a
+0, 1192, 1192, 1, 38016, 0xcfa39e3d
+0, 1193, 1193, 1, 38016, 0x8865a56c
+0, 1194, 1194, 1, 38016, 0x3bc9af9b
+0, 1195, 1195, 1, 38016, 0x0a83c081
+0, 1196, 1196, 1, 38016, 0x5ccec976
+0, 1197, 1197, 1, 38016, 0x1f1fc906
+0, 1198, 1198, 1, 38016, 0x1ef6cc46
+0, 1199, 1199, 1, 38016, 0x7776c39e
+0, 1200, 1200, 1, 38016, 0x5860a212
+0, 1201, 1201, 1, 38016, 0x2d9092a3
+0, 1202, 1202, 1, 38016, 0x964d9f81
+0, 1203, 1203, 1, 38016, 0xc35c9691
+0, 1204, 1204, 1, 38016, 0x5e0dc673
+0, 1205, 1205, 1, 38016, 0xada3b7d6
+0, 1206, 1206, 1, 38016, 0x4f3a8d03
+0, 1207, 1207, 1, 38016, 0xfcb4861a
+0, 1208, 1208, 1, 38016, 0xfa908149
+0, 1209, 1209, 1, 38016, 0x6994c514
+0, 1210, 1210, 1, 38016, 0x37c5aaa9
+0, 1211, 1211, 1, 38016, 0x207abcfe
+0, 1212, 1212, 1, 38016, 0x778d7a2d
+0, 1213, 1213, 1, 38016, 0x60b773ff
+0, 1214, 1214, 1, 38016, 0x41cd67d5
+0, 1215, 1215, 1, 38016, 0x3c595a99
+0, 1216, 1216, 1, 38016, 0xd672b14c
+0, 1217, 1217, 1, 38016, 0x7db2c0fd
+0, 1218, 1218, 1, 38016, 0x3d21cf34
+0, 1219, 1219, 1, 38016, 0xdd1cf044
+0, 1220, 1220, 1, 38016, 0xc4594bcb
+0, 1221, 1221, 1, 38016, 0x595e4356
+0, 1222, 1222, 1, 38016, 0x9cc53c0d
+0, 1223, 1223, 1, 38016, 0x78fc325f
+0, 1224, 1224, 1, 38016, 0xc632324f
+0, 1225, 1225, 1, 38016, 0x18b1f5c1
+0, 1226, 1226, 1, 38016, 0x63aff55e
+0, 1227, 1227, 1, 38016, 0x8a50fb04
+0, 1228, 1228, 1, 38016, 0x7d5e20f6
+0, 1229, 1229, 1, 38016, 0xc31114bb
+0, 1230, 1230, 1, 38016, 0xf4852e6e
+0, 1231, 1231, 1, 38016, 0x9b6927ba
+0, 1232, 1232, 1, 38016, 0x024836c2
+0, 1233, 1233, 1, 38016, 0x20843b21
+0, 1234, 1234, 1, 38016, 0x19134055
+0, 1235, 1235, 1, 38016, 0x1cd843f7
+0, 1236, 1236, 1, 38016, 0x122705b1
+0, 1237, 1237, 1, 38016, 0x1880fc3d
+0, 1238, 1238, 1, 38016, 0x78dbfeaf
+0, 1239, 1239, 1, 38016, 0x212c273d
+0, 1240, 1240, 1, 38016, 0xff2eb7be
+0, 1241, 1241, 1, 38016, 0xe0bd752d
+0, 1242, 1242, 1, 38016, 0x277b478a
+0, 1243, 1243, 1, 38016, 0x59e84ab2
+0, 1244, 1244, 1, 38016, 0x338a50e4
+0, 1245, 1245, 1, 38016, 0xaf715a99
+0, 1246, 1246, 1, 38016, 0xd1e459a8
+0, 1247, 1247, 1, 38016, 0x70da4ac9
+0, 1248, 1248, 1, 38016, 0xa695540d
+0, 1249, 1249, 1, 38016, 0x9385320b
+0, 1250, 1250, 1, 38016, 0x9a8703cd
+0, 1251, 1251, 1, 38016, 0xbeda239e
+0, 1252, 1252, 1, 38016, 0x5bf262c1
+0, 1253, 1253, 1, 38016, 0x9b216899
+0, 1254, 1254, 1, 38016, 0x52f24135
+0, 1255, 1255, 1, 38016, 0x75a23955
+0, 1256, 1256, 1, 38016, 0xb92f4ea2
+0, 1257, 1257, 1, 38016, 0xdac95333
+0, 1258, 1258, 1, 38016, 0x1a2d4ed4
+0, 1259, 1259, 1, 38016, 0xfce25650
+0, 1260, 1260, 1, 38016, 0x1e264fdd
+0, 1261, 1261, 1, 38016, 0xe77349b8
+0, 1262, 1262, 1, 38016, 0x7d2046b0
+0, 1263, 1263, 1, 38016, 0x65373899
+0, 1264, 1264, 1, 38016, 0x3b3569ae
+0, 1265, 1265, 1, 38016, 0x346485d0
+0, 1266, 1266, 1, 38016, 0x80b93e57
+0, 1267, 1267, 1, 38016, 0xeb724ba5
+0, 1268, 1268, 1, 38016, 0x533d7459
+0, 1269, 1269, 1, 38016, 0x60f957a7
+0, 1270, 1270, 1, 38016, 0x900281b2
+0, 1271, 1271, 1, 38016, 0xf4489e06
+0, 1272, 1272, 1, 38016, 0xe77730c9
+0, 1273, 1273, 1, 38016, 0x41b23060
+0, 1274, 1274, 1, 38016, 0x4e8c3012
+0, 1275, 1275, 1, 38016, 0x651f2cff
+0, 1276, 1276, 1, 38016, 0x787b2e99
+0, 1277, 1277, 1, 38016, 0x541e2d10
+0, 1278, 1278, 1, 38016, 0x27a824a3
+0, 1279, 1279, 1, 38016, 0xe1e72121
+0, 1280, 1280, 1, 38016, 0xffb52626
+0, 1281, 1281, 1, 38016, 0x7677c8c9
+0, 1282, 1282, 1, 38016, 0xa501d38f
+0, 1283, 1283, 1, 38016, 0xa6d2c5dc
+0, 1284, 1284, 1, 38016, 0xba94d1c1
+0, 1285, 1285, 1, 38016, 0x137dac4d
+0, 1286, 1286, 1, 38016, 0x65c1bd6e
+0, 1287, 1287, 1, 38016, 0x7a32cd65
+0, 1288, 1288, 1, 38016, 0x518adf61
+0, 1289, 1289, 1, 38016, 0x8baaee58
+0, 1290, 1290, 1, 38016, 0xe7642712
+0, 1291, 1291, 1, 38016, 0xba191b45
+0, 1292, 1292, 1, 38016, 0x93dd16b1
+0, 1293, 1293, 1, 38016, 0x22831478
+0, 1294, 1294, 1, 38016, 0xe48c103a
+0, 1295, 1295, 1, 38016, 0x7c2709e7
+0, 1296, 1296, 1, 38016, 0xd7d8f454
+0, 1297, 1297, 1, 38016, 0xc504f31a
+0, 1298, 1298, 1, 38016, 0x2510e4ae
+0, 1299, 1299, 1, 38016, 0x0b56d119
+0, 1300, 1300, 1, 38016, 0x6c248150
+0, 1301, 1301, 1, 38016, 0xbac4be42
+0, 1302, 1302, 1, 38016, 0x5787c4a8
+0, 1303, 1303, 1, 38016, 0x65b3d0bd
+0, 1304, 1304, 1, 38016, 0xdcc4efbd
+0, 1305, 1305, 1, 38016, 0xfe92f78b
+0, 1306, 1306, 1, 38016, 0xfda60c1c
+0, 1307, 1307, 1, 38016, 0x4997238e
+0, 1308, 1308, 1, 38016, 0xfaca43ca
+0, 1309, 1309, 1, 38016, 0x81fe533c
+0, 1310, 1310, 1, 38016, 0x350bcb11
+0, 1311, 1311, 1, 38016, 0xacfdcde4
+0, 1312, 1312, 1, 38016, 0xb039c663
+0, 1313, 1313, 1, 38016, 0x3402c942
+0, 1314, 1314, 1, 38016, 0x388bc3d0
+0, 1315, 1315, 1, 38016, 0x85dec11a
+0, 1316, 1316, 1, 38016, 0xdfc2be86
+0, 1317, 1317, 1, 38016, 0x515cc1a9
+0, 1318, 1318, 1, 38016, 0xc7ddb990
+0, 1319, 1319, 1, 38016, 0x043fb332
+0, 1320, 1320, 1, 38016, 0x5b05b3a7
+0, 1321, 1321, 1, 38016, 0xacdf9836
+0, 1322, 1322, 1, 38016, 0x55079a49
+0, 1323, 1323, 1, 38016, 0x5de2d90d
+0, 1324, 1324, 1, 38016, 0x7f9deb52
+0, 1325, 1325, 1, 38016, 0x83ddc6d9
+0, 1326, 1326, 1, 38016, 0x77ecdc93
+0, 1327, 1327, 1, 38016, 0x745fe832
+0, 1328, 1328, 1, 38016, 0x920bf8e7
+0, 1329, 1329, 1, 38016, 0xd9fc1803
+0, 1330, 1330, 1, 38016, 0x06c13052
+0, 1331, 1331, 1, 38016, 0x4a962b49
+0, 1332, 1332, 1, 38016, 0xd4a7b571
+0, 1333, 1333, 1, 38016, 0xdb76bd1e
+0, 1334, 1334, 1, 38016, 0x11a4be41
+0, 1335, 1335, 1, 38016, 0x575eb740
+0, 1336, 1336, 1, 38016, 0x7f11bb5c
+0, 1337, 1337, 1, 38016, 0x0f97b9b5
+0, 1338, 1338, 1, 38016, 0xa421bc1e
+0, 1339, 1339, 1, 38016, 0x2510bda8
+0, 1340, 1340, 1, 38016, 0x5ec1c3c2
+0, 1341, 1341, 1, 38016, 0xab02c212
+0, 1342, 1342, 1, 38016, 0x7862c24a
+0, 1343, 1343, 1, 38016, 0x3654c47c
+0, 1344, 1344, 1, 38016, 0x6e4f3fd5
+0, 1345, 1345, 1, 38016, 0x77b54c6f
+0, 1346, 1346, 1, 38016, 0x51016691
+0, 1347, 1347, 1, 38016, 0x5c2e7a7a
+0, 1348, 1348, 1, 38016, 0x29aea461
+0, 1349, 1349, 1, 38016, 0x8f4397b1
+0, 1350, 1350, 1, 38016, 0x8af41dba
+0, 1351, 1351, 1, 38016, 0x4c1154ca
+0, 1352, 1352, 1, 38016, 0xe23e6e91
+0, 1353, 1353, 1, 38016, 0xd0617571
+0, 1354, 1354, 1, 38016, 0x2ab88348
+0, 1355, 1355, 1, 38016, 0x8bf1a109
+0, 1356, 1356, 1, 38016, 0xfdd4c390
+0, 1357, 1357, 1, 38016, 0x17b8c6bf
+0, 1358, 1358, 1, 38016, 0xa012bd5d
+0, 1359, 1359, 1, 38016, 0x4c16cee2
+0, 1360, 1360, 1, 38016, 0x739fcfae
+0, 1361, 1361, 1, 38016, 0x3edae498
+0, 1362, 1362, 1, 38016, 0x0d38e4ad
+0, 1363, 1363, 1, 38016, 0x896cea10
+0, 1364, 1364, 1, 38016, 0x13a0f1a9
+0, 1365, 1365, 1, 38016, 0xfe70eeb4
+0, 1366, 1366, 1, 38016, 0x540bf40e
+0, 1367, 1367, 1, 38016, 0xee20f65e
+0, 1368, 1368, 1, 38016, 0x8404fdf7
+0, 1369, 1369, 1, 38016, 0x1c71b182
+0, 1370, 1370, 1, 38016, 0x96e4c5cc
+0, 1371, 1371, 1, 38016, 0x6aa1dcf1
+0, 1372, 1372, 1, 38016, 0x4549ed9b
+0, 1373, 1373, 1, 38016, 0xd50bffba
+0, 1374, 1374, 1, 38016, 0x22701379
+0, 1375, 1375, 1, 38016, 0x19462a6b
+0, 1376, 1376, 1, 38016, 0x4f6b41e0
+0, 1377, 1377, 1, 38016, 0x9d344fcc
+0, 1378, 1378, 1, 38016, 0x60625fa9
+0, 1379, 1379, 1, 38016, 0xeb377eae
+0, 1380, 1380, 1, 38016, 0x0d9f945d
+0, 1381, 1381, 1, 38016, 0x4d0fb1dc
+0, 1382, 1382, 1, 38016, 0x0b580421
+0, 1383, 1383, 1, 38016, 0x30f3191a
+0, 1384, 1384, 1, 38016, 0xc5f7295c
+0, 1385, 1385, 1, 38016, 0xc4ad35e9
+0, 1386, 1386, 1, 38016, 0x25964387
+0, 1387, 1387, 1, 38016, 0x3a805820
+0, 1388, 1388, 1, 38016, 0x67e26985
+0, 1389, 1389, 1, 38016, 0x518f7941
+0, 1390, 1390, 1, 38016, 0x2a7982e1
+0, 1391, 1391, 1, 38016, 0x54aa84f0
+0, 1392, 1392, 1, 38016, 0x3d808f45
+0, 1393, 1393, 1, 38016, 0x5dae923c
+0, 1394, 1394, 1, 38016, 0xa2a99ccf
+0, 1395, 1395, 1, 38016, 0xefdd9a77
+0, 1396, 1396, 1, 38016, 0x246fcfa5
+0, 1397, 1397, 1, 38016, 0xe315cbcd
+0, 1398, 1398, 1, 38016, 0x4825df58
+0, 1399, 1399, 1, 38016, 0x0e241554
+0, 1400, 1400, 1, 38016, 0x968d8433
+0, 1401, 1401, 1, 38016, 0x97eec628
+0, 1402, 1402, 1, 38016, 0x7c4cb603
+0, 1403, 1403, 1, 38016, 0x6d11e7bf
+0, 1404, 1404, 1, 38016, 0xae041b61
+0, 1405, 1405, 1, 38016, 0x385e040c
+0, 1406, 1406, 1, 38016, 0x449e357a
+0, 1407, 1407, 1, 38016, 0x997f4aac
+0, 1408, 1408, 1, 38016, 0xd68c4f8b
+0, 1409, 1409, 1, 38016, 0xb3b962eb
+0, 1410, 1410, 1, 38016, 0x4685adc2
+0, 1411, 1411, 1, 38016, 0xed0d7473
+0, 1412, 1412, 1, 38016, 0xd069c0bb
+0, 1413, 1413, 1, 38016, 0x76abcd8e
+0, 1414, 1414, 1, 38016, 0xd6c096da
+0, 1415, 1415, 1, 38016, 0x76c2bab5
+0, 1416, 1416, 1, 38016, 0x1461dfb3
+0, 1417, 1417, 1, 38016, 0xf979f59f
+0, 1418, 1418, 1, 38016, 0x0554f985
+0, 1419, 1419, 1, 38016, 0x11c6d2a3
+0, 1420, 1420, 1, 38016, 0xe6e3faee
+0, 1421, 1421, 1, 38016, 0x6ceafbcc
+0, 1422, 1422, 1, 38016, 0x429b02e1
+0, 1423, 1423, 1, 38016, 0x97bd03f1
+0, 1424, 1424, 1, 38016, 0x78330c48
+0, 1425, 1425, 1, 38016, 0xb2720325
+0, 1426, 1426, 1, 38016, 0x26d412ab
+0, 1427, 1427, 1, 38016, 0xb6fb1b5c
+0, 1428, 1428, 1, 38016, 0xde8d300a
+0, 1429, 1429, 1, 38016, 0x7d28450e
+0, 1430, 1430, 1, 38016, 0xb3c5fbef
+0, 1431, 1431, 1, 38016, 0x2222f726
+0, 1432, 1432, 1, 38016, 0x66f7f42f
+0, 1433, 1433, 1, 38016, 0xef8af722
+0, 1434, 1434, 1, 38016, 0x4ac0f8d7
+0, 1435, 1435, 1, 38016, 0x5bfe5c81
+0, 1436, 1436, 1, 38016, 0x4afb6df9
+0, 1437, 1437, 1, 38016, 0xa8128a37
+0, 1438, 1438, 1, 38016, 0x1fc79ed0
+0, 1439, 1439, 1, 38016, 0x9967a997
+0, 1440, 1440, 1, 38016, 0x7bb5f6e1
+0, 1441, 1441, 1, 38016, 0xdda90122
+0, 1442, 1442, 1, 38016, 0x81700c1a
+0, 1443, 1443, 1, 38016, 0x9e121e77
+0, 1444, 1444, 1, 38016, 0xf58926a3
+0, 1445, 1445, 1, 38016, 0x4d1431a4
+0, 1446, 1446, 1, 38016, 0x0de6e741
+0, 1447, 1447, 1, 38016, 0x3ae9f601
+0, 1448, 1448, 1, 38016, 0xbed2e950
+0, 1449, 1449, 1, 38016, 0x619f100d
+0, 1450, 1450, 1, 38016, 0x6fa4a4e2
+0, 1451, 1451, 1, 38016, 0x316cddcd
+0, 1452, 1452, 1, 38016, 0x03132791
+0, 1453, 1453, 1, 38016, 0x10122784
+0, 1454, 1454, 1, 38016, 0x0e732980
+0, 1455, 1455, 1, 38016, 0x382d26f9
+0, 1456, 1456, 1, 38016, 0x651028fd
+0, 1457, 1457, 1, 38016, 0x61732850
+0, 1458, 1458, 1, 38016, 0x47912dde
+0, 1459, 1459, 1, 38016, 0xe3a12fdc
+0, 1460, 1460, 1, 38016, 0x8bc332ff
+0, 1461, 1461, 1, 38016, 0xcc3a3cdc
+0, 1462, 1462, 1, 38016, 0x190e2fec
+0, 1463, 1463, 1, 38016, 0x236c3291
+0, 1464, 1464, 1, 38016, 0xc0e55dd3
+0, 1465, 1465, 1, 38016, 0x06c85411
+0, 1466, 1466, 1, 38016, 0x0c0b3091
+0, 1467, 1467, 1, 38016, 0x8c1333cd
+0, 1468, 1468, 1, 38016, 0x51b339a5
+0, 1469, 1469, 1, 38016, 0x2d5b33ef
+0, 1470, 1470, 1, 38016, 0x73f0395b
+0, 1471, 1471, 1, 38016, 0x505b42d3
+0, 1472, 1472, 1, 38016, 0x56e44c7f
+0, 1473, 1473, 1, 38016, 0x26465781
+0, 1474, 1474, 1, 38016, 0x1d14800d
+0, 1475, 1475, 1, 38016, 0x752cb297
+0, 1476, 1476, 1, 38016, 0x0c3ab720
+0, 1477, 1477, 1, 38016, 0x21c2f136
+0, 1478, 1478, 1, 38016, 0xbae8b293
+0, 1479, 1479, 1, 38016, 0xe4b2fe9b
+0, 1480, 1480, 1, 38016, 0xfaaf0394
+0, 1481, 1481, 1, 38016, 0xa6f61d4b
+0, 1482, 1482, 1, 38016, 0x0e205192
+0, 1483, 1483, 1, 38016, 0x9b3c5c1f
+0, 1484, 1484, 1, 38016, 0x3b93552f
+0, 1485, 1485, 1, 38016, 0xe56e5b54
+0, 1486, 1486, 1, 38016, 0xa1c26095
+0, 1487, 1487, 1, 38016, 0x1eb66e41
+0, 1488, 1488, 1, 38016, 0x83eb6e83
+0, 1489, 1489, 1, 38016, 0xc8a979d3
+0, 1490, 1490, 1, 38016, 0x81fb7b32
+0, 1491, 1491, 1, 38016, 0xe07928b7
+0, 1492, 1492, 1, 38016, 0x38591267
+0, 1493, 1493, 1, 38016, 0xce563165
+0, 1494, 1494, 1, 38016, 0x5fec3563
+0, 1495, 1495, 1, 38016, 0xd7402c7c
+0, 1496, 1496, 1, 38016, 0xf2a93af4
+0, 1497, 1497, 1, 38016, 0x78f22fe7
+0, 1498, 1498, 1, 38016, 0x25554875
+0, 1499, 1499, 1, 38016, 0x79546ca2
+0, 1500, 1500, 1, 38016, 0xdae2814a
+0, 1501, 1501, 1, 38016, 0xf1ef9a9e
+0, 1502, 1502, 1, 38016, 0xb76d8b83
+0, 1503, 1503, 1, 38016, 0x1abf8fa8
+0, 1504, 1504, 1, 38016, 0x8f098fa4
+0, 1505, 1505, 1, 38016, 0xb098843c
+0, 1506, 1506, 1, 38016, 0x1d5186d3
+0, 1507, 1507, 1, 38016, 0x93f4923c
+0, 1508, 1508, 1, 38016, 0x496094e2
+0, 1509, 1509, 1, 38016, 0x7aea93f1
+0, 1510, 1510, 1, 38016, 0x556c6675
+0, 1511, 1511, 1, 38016, 0x90566aca
+0, 1512, 1512, 1, 38016, 0x14899a93
+0, 1513, 1513, 1, 38016, 0xd269e0e7
+0, 1514, 1514, 1, 38016, 0x1261d2cc
+0, 1515, 1515, 1, 38016, 0x299c9301
+0, 1516, 1516, 1, 38016, 0xee9c9ba5
+0, 1517, 1517, 1, 38016, 0xb48ab676
+0, 1518, 1518, 1, 38016, 0x4ef9b1c5
+0, 1519, 1519, 1, 38016, 0x8aae9912
+0, 1520, 1520, 1, 38016, 0x1bc09f53
+0, 1521, 1521, 1, 38016, 0x2e089c6b
+0, 1522, 1522, 1, 38016, 0x67598f8d
+0, 1523, 1523, 1, 38016, 0xacd394e1
+0, 1524, 1524, 1, 38016, 0xe2979b75
+0, 1525, 1525, 1, 38016, 0xb9749ff9
+0, 1526, 1526, 1, 38016, 0x02bda2f0
+0, 1527, 1527, 1, 38016, 0xe6caa499
+0, 1528, 1528, 1, 38016, 0xc6d9a547
+0, 1529, 1529, 1, 38016, 0x1c89aa34
+0, 1530, 1530, 1, 38016, 0x61feb4fc
+0, 1531, 1531, 1, 38016, 0x2a40b1f4
+0, 1532, 1532, 1, 38016, 0x4ad3ac08
+0, 1533, 1533, 1, 38016, 0xf5e8b06d
+0, 1534, 1534, 1, 38016, 0xb0eea800
+0, 1535, 1535, 1, 38016, 0x430cc535
+0, 1536, 1536, 1, 38016, 0x8e66b9cf
+0, 1537, 1537, 1, 38016, 0x5c68b4c4
+0, 1538, 1538, 1, 38016, 0x9381c64b
+0, 1539, 1539, 1, 38016, 0x4234bed7
+0, 1540, 1540, 1, 38016, 0xce72bf02
+0, 1541, 1541, 1, 38016, 0xb8cfbcd7
+0, 1542, 1542, 1, 38016, 0x75a5b1bd
+0, 1543, 1543, 1, 38016, 0xc27fb9eb
+0, 1544, 1544, 1, 38016, 0xa1b1bc62
+0, 1545, 1545, 1, 38016, 0x1cdeb0a3
+0, 1546, 1546, 1, 38016, 0xaea6a799
+0, 1547, 1547, 1, 38016, 0x8152ac4f
+0, 1548, 1548, 1, 38016, 0x59c1a66d
+0, 1549, 1549, 1, 38016, 0x6bd99f24
+0, 1550, 1550, 1, 38016, 0x96a73236
+0, 1551, 1551, 1, 38016, 0xb27e4856
+0, 1552, 1552, 1, 38016, 0x8b57447a
+0, 1553, 1553, 1, 38016, 0xcef84a21
+0, 1554, 1554, 1, 38016, 0x5babc7cc
+0, 1555, 1555, 1, 38016, 0x6ed2cec3
+0, 1556, 1556, 1, 38016, 0xa2efdc17
+0, 1557, 1557, 1, 38016, 0x47bad971
+0, 1558, 1558, 1, 38016, 0x150dffd4
+0, 1559, 1559, 1, 38016, 0x3ecef2ad
+0, 1560, 1560, 1, 38016, 0x355cdade
+0, 1561, 1561, 1, 38016, 0x3b15e809
+0, 1562, 1562, 1, 38016, 0x37fcf890
+0, 1563, 1563, 1, 38016, 0x8ca606d1
+0, 1564, 1564, 1, 38016, 0x51cafefe
+0, 1565, 1565, 1, 38016, 0x736be64a
+0, 1566, 1566, 1, 38016, 0x4f2052c1
+0, 1567, 1567, 1, 38016, 0xc6715e93
+0, 1568, 1568, 1, 38016, 0x765c5a58
+0, 1569, 1569, 1, 38016, 0x5abe5617
+0, 1570, 1570, 1, 38016, 0xb1ac540a
+0, 1571, 1571, 1, 38016, 0xd9f75c21
+0, 1572, 1572, 1, 38016, 0x0c1946c0
+0, 1573, 1573, 1, 38016, 0x93363a34
+0, 1574, 1574, 1, 38016, 0x2c9f2fe4
+0, 1575, 1575, 1, 38016, 0x023c321a
+0, 1576, 1576, 1, 38016, 0x1931314b
+0, 1577, 1577, 1, 38016, 0x16782d59
+0, 1578, 1578, 1, 38016, 0x29aa289f
+0, 1579, 1579, 1, 38016, 0xea0ddb85
+0, 1580, 1580, 1, 38016, 0xe09ae656
+0, 1581, 1581, 1, 38016, 0x682ff29f
+0, 1582, 1582, 1, 38016, 0xf3ac29ca
+0, 1583, 1583, 1, 38016, 0x95160cad
+0, 1584, 1584, 1, 38016, 0x9afa093c
+0, 1585, 1585, 1, 38016, 0x2ad30958
+0, 1586, 1586, 1, 38016, 0x4b600e3a
+0, 1587, 1587, 1, 38016, 0x5b0e099b
+0, 1588, 1588, 1, 38016, 0x2d2aff9b
+0, 1589, 1589, 1, 38016, 0x8bb10aa6
+0, 1590, 1590, 1, 38016, 0xfebe1f1d
+0, 1591, 1591, 1, 38016, 0xa4431abd
+0, 1592, 1592, 1, 38016, 0xef7729a6
+0, 1593, 1593, 1, 38016, 0x7b5b1f78
+0, 1594, 1594, 1, 38016, 0x903b203e
+0, 1595, 1595, 1, 38016, 0xbcc716a2
+0, 1596, 1596, 1, 38016, 0xee6c1f4c
+0, 1597, 1597, 1, 38016, 0xc78c2ab8
+0, 1598, 1598, 1, 38016, 0xa77a255a
+0, 1599, 1599, 1, 38016, 0x9d5815fc
+0, 1600, 1600, 1, 38016, 0x7d5e7d79
+0, 1601, 1601, 1, 38016, 0xf7989072
+0, 1602, 1602, 1, 38016, 0x45499feb
+0, 1603, 1603, 1, 38016, 0xc58aae7b
+0, 1604, 1604, 1, 38016, 0x882aa1cb
+0, 1605, 1605, 1, 38016, 0x56cd97bf
+0, 1606, 1606, 1, 38016, 0x2d6af920
+0, 1607, 1607, 1, 38016, 0x43c312eb
+0, 1608, 1608, 1, 38016, 0x12872b9f
+0, 1609, 1609, 1, 38016, 0x3c623ffe
+0, 1610, 1610, 1, 38016, 0x120e302d
+0, 1611, 1611, 1, 38016, 0x9cb43964
+0, 1612, 1612, 1, 38016, 0xb371311c
+0, 1613, 1613, 1, 38016, 0x28b523d4
+0, 1614, 1614, 1, 38016, 0x58031bff
+0, 1615, 1615, 1, 38016, 0xe6691818
+0, 1616, 1616, 1, 38016, 0x6a9b29c3
+0, 1617, 1617, 1, 38016, 0x794b25ce
+0, 1618, 1618, 1, 38016, 0xfc273119
+0, 1619, 1619, 1, 38016, 0x82ad2a3a
+0, 1620, 1620, 1, 38016, 0x9d2da281
+0, 1621, 1621, 1, 38016, 0x11271ba1
+0, 1622, 1622, 1, 38016, 0x1558b618
+0, 1623, 1623, 1, 38016, 0xf5d8c22f
+0, 1624, 1624, 1, 38016, 0xf20214f9
+0, 1625, 1625, 1, 38016, 0x15b01f3a
+0, 1626, 1626, 1, 38016, 0x68f2b533
+0, 1627, 1627, 1, 38016, 0x9686a827
+0, 1628, 1628, 1, 38016, 0xf214a2dc
+0, 1629, 1629, 1, 38016, 0x3d421eb0
+0, 1630, 1630, 1, 38016, 0x78251e60
+0, 1631, 1631, 1, 38016, 0xab092856
+0, 1632, 1632, 1, 38016, 0x5eaba7bc
+0, 1633, 1633, 1, 38016, 0x612fb699
+0, 1634, 1634, 1, 38016, 0x8a83a3fd
+0, 1635, 1635, 1, 38016, 0xbcd9919b
+0, 1636, 1636, 1, 38016, 0xb9063049
+0, 1637, 1637, 1, 38016, 0x5cb22fde
+0, 1638, 1638, 1, 38016, 0x7db92390
+0, 1639, 1639, 1, 38016, 0x801b241b
+0, 1640, 1640, 1, 38016, 0x6eeb8e1b
+0, 1641, 1641, 1, 38016, 0x660b9568
+0, 1642, 1642, 1, 38016, 0x2a5b8b3d
+0, 1643, 1643, 1, 38016, 0x15098b9a
+0, 1644, 1644, 1, 38016, 0xd29284f5
+0, 1645, 1645, 1, 38016, 0x839323c6
+0, 1646, 1646, 1, 38016, 0xd6a4212c
+0, 1647, 1647, 1, 38016, 0x1c1c2259
+0, 1648, 1648, 1, 38016, 0x0b1d2ef2
+0, 1649, 1649, 1, 38016, 0xecd52cfc
+0, 1650, 1650, 1, 38016, 0x419326cb
+0, 1651, 1651, 1, 38016, 0xea813e68
+0, 1652, 1652, 1, 38016, 0xba9a33ba
+0, 1653, 1653, 1, 38016, 0x703b3b25
+0, 1654, 1654, 1, 38016, 0x391c3cce
+0, 1655, 1655, 1, 38016, 0xd1533fe3
+0, 1656, 1656, 1, 38016, 0xb9361f10
+0, 1657, 1657, 1, 38016, 0x8d652ea6
+0, 1658, 1658, 1, 38016, 0x22dc15ae
+0, 1659, 1659, 1, 38016, 0x2e5e0ee7
+0, 1660, 1660, 1, 38016, 0xd6bd15cf
+0, 1661, 1661, 1, 38016, 0xb16f198a
+0, 1662, 1662, 1, 38016, 0xd9653e95
+0, 1663, 1663, 1, 38016, 0x39da2e3a
+0, 1664, 1664, 1, 38016, 0x01b12526
+0, 1665, 1665, 1, 38016, 0x94a52dde
+0, 1666, 1666, 1, 38016, 0xda0c32d8
+0, 1667, 1667, 1, 38016, 0x89af2566
+0, 1668, 1668, 1, 38016, 0x71961a43
+0, 1669, 1669, 1, 38016, 0x5fb91337
+0, 1670, 1670, 1, 38016, 0x6e430a84
+0, 1671, 1671, 1, 38016, 0x1defffb2
+0, 1672, 1672, 1, 38016, 0xcc93023f
+0, 1673, 1673, 1, 38016, 0xfcd60168
+0, 1674, 1674, 1, 38016, 0x8a3201d4
+0, 1675, 1675, 1, 38016, 0x5235fef3
+0, 1676, 1676, 1, 38016, 0x989121b9
+0, 1677, 1677, 1, 38016, 0x067a1d36
+0, 1678, 1678, 1, 38016, 0xa168242b
+0, 1679, 1679, 1, 38016, 0x425f2475
+0, 1680, 1680, 1, 38016, 0x298f14d9
+0, 1681, 1681, 1, 38016, 0x3a7c1838
+0, 1682, 1682, 1, 38016, 0xd173155a
+0, 1683, 1683, 1, 38016, 0x210113ec
+0, 1684, 1684, 1, 38016, 0xa0c2f88f
+0, 1685, 1685, 1, 38016, 0x4fa1f4e2
+0, 1686, 1686, 1, 38016, 0x812df750
+0, 1687, 1687, 1, 38016, 0xfd5cea45
+0, 1688, 1688, 1, 38016, 0xb823ee4a
+0, 1689, 1689, 1, 38016, 0x3555d6bf
+0, 1690, 1690, 1, 38016, 0x6dabf021
+0, 1691, 1691, 1, 38016, 0x7ae0f191
+0, 1692, 1692, 1, 38016, 0xabdc1546
+0, 1693, 1693, 1, 38016, 0x36dd0dbb
+0, 1694, 1694, 1, 38016, 0x008ffe5f
+0, 1695, 1695, 1, 38016, 0xe956f9c0
+0, 1696, 1696, 1, 38016, 0x9823ee03
+0, 1697, 1697, 1, 38016, 0xf63fedde
+0, 1698, 1698, 1, 38016, 0x67530afb
+0, 1699, 1699, 1, 38016, 0x2da5e470
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-midr_mw_d b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-midr_mw_d
index afffdc8..51b7c0e 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-midr_mw_d
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-midr_mw_d
@@ -1,100 +1,101 @@
-0, 0, 38016, 0x3ae838ee
-0, 3600, 38016, 0x9ed7e141
-0, 7200, 38016, 0x393097f9
-0, 10800, 38016, 0x8fb56676
-0, 14400, 38016, 0x39d64fd2
-0, 18000, 38016, 0x7fad729a
-0, 21600, 38016, 0x7e25955f
-0, 25200, 38016, 0xc4d9a359
-0, 28800, 38016, 0x30afaca4
-0, 32400, 38016, 0x9ee195ea
-0, 36000, 38016, 0x09f65805
-0, 39600, 38016, 0x58d126ab
-0, 43200, 38016, 0x4f29282c
-0, 46800, 38016, 0x8af235a1
-0, 50400, 38016, 0x6dfe525a
-0, 54000, 38016, 0xd51c793f
-0, 57600, 38016, 0x4e90abba
-0, 61200, 38016, 0xe706c5b7
-0, 64800, 38016, 0x35fab7ef
-0, 68400, 38016, 0xed78b8fc
-0, 72000, 38016, 0x2907bb4e
-0, 75600, 38016, 0x1749bb47
-0, 79200, 38016, 0x284ec688
-0, 82800, 38016, 0x534abc24
-0, 86400, 38016, 0xcd01bd13
-0, 90000, 38016, 0xe97bbd51
-0, 93600, 38016, 0xac1cb9e9
-0, 97200, 38016, 0xd861c0a3
-0, 100800, 38016, 0xf0f1ced4
-0, 104400, 38016, 0xa9e8d2bf
-0, 108000, 38016, 0x4c6aa7c5
-0, 111600, 38016, 0xb20079ac
-0, 115200, 38016, 0xbfc3563b
-0, 118800, 38016, 0x48259358
-0, 122400, 38016, 0x1bce0434
-0, 126000, 38016, 0xa0ac59db
-0, 129600, 38016, 0x87bdb608
-0, 133200, 38016, 0x318037eb
-0, 136800, 38016, 0x0f7d8496
-0, 140400, 38016, 0x9e65bc1e
-0, 144000, 38016, 0xc56be1ea
-0, 147600, 38016, 0xc31fefb7
-0, 151200, 38016, 0xcbcee4e4
-0, 154800, 38016, 0xcf03f238
-0, 158400, 38016, 0xc6a903a1
-0, 162000, 38016, 0xfdabee4f
-0, 165600, 38016, 0x9054bb39
-0, 169200, 38016, 0xe9bf8cd8
-0, 172800, 38016, 0x943d9e0a
-0, 176400, 38016, 0x404cc87d
-0, 180000, 38016, 0x3cd9dd49
-0, 183600, 38016, 0x5eabbdf1
-0, 187200, 38016, 0xd206d9ef
-0, 190800, 38016, 0x75e310ad
-0, 194400, 38016, 0x01893e25
-0, 198000, 38016, 0xda5360e6
-0, 201600, 38016, 0x80656a39
-0, 205200, 38016, 0x85452c84
-0, 208800, 38016, 0x48d92ef7
-0, 212400, 38016, 0x0edc45b2
-0, 216000, 38016, 0xeb8a3531
-0, 219600, 38016, 0x7b5914b5
-0, 223200, 38016, 0xf1b6c7fa
-0, 226800, 38016, 0x68fca853
-0, 230400, 38016, 0x68ebcc02
-0, 234000, 38016, 0x793edc8e
-0, 237600, 38016, 0x9c86d139
-0, 241200, 38016, 0x2aeed2f9
-0, 244800, 38016, 0xb8cfc89d
-0, 248400, 38016, 0x22d2b5c4
-0, 252000, 38016, 0x01ae9d2d
-0, 255600, 38016, 0x4e9b7c84
-0, 259200, 38016, 0xa52c8553
-0, 262800, 38016, 0x50df78d0
-0, 266400, 38016, 0x4dc31f1c
-0, 270000, 38016, 0xf24ee29a
-0, 273600, 38016, 0xced0d363
-0, 277200, 38016, 0x2263bfdc
-0, 280800, 38016, 0x1363f580
-0, 284400, 38016, 0xfc7f3a50
-0, 288000, 38016, 0x38427007
-0, 291600, 38016, 0xfc5757eb
-0, 295200, 38016, 0xf20f4d0b
-0, 298800, 38016, 0x64871ca3
-0, 302400, 38016, 0xcb66cd99
-0, 306000, 38016, 0xaacdda1f
-0, 309600, 38016, 0xd52206c8
-0, 313200, 38016, 0xcb461142
-0, 316800, 38016, 0x9e36a3b3
-0, 320400, 38016, 0xf3b44a7c
-0, 324000, 38016, 0x1722db32
-0, 327600, 38016, 0xa943d602
-0, 331200, 38016, 0xc899e7bf
-0, 334800, 38016, 0xacd10bdc
-0, 338400, 38016, 0x703b3802
-0, 342000, 38016, 0xe246efb4
-0, 345600, 38016, 0x1ebfccb2
-0, 349200, 38016, 0x57380778
-0, 352800, 38016, 0xb70e7313
-0, 356400, 38016, 0x0cd4af3d
+#tb 0: 1/25
+0, 0, 0, 1, 38016, 0x3ae838ee
+0, 1, 1, 1, 38016, 0x9ed7e141
+0, 2, 2, 1, 38016, 0x393097f9
+0, 3, 3, 1, 38016, 0x8fb56676
+0, 4, 4, 1, 38016, 0x39d64fd2
+0, 5, 5, 1, 38016, 0x7fad729a
+0, 6, 6, 1, 38016, 0x7e25955f
+0, 7, 7, 1, 38016, 0xc4d9a359
+0, 8, 8, 1, 38016, 0x30afaca4
+0, 9, 9, 1, 38016, 0x9ee195ea
+0, 10, 10, 1, 38016, 0x09f65805
+0, 11, 11, 1, 38016, 0x58d126ab
+0, 12, 12, 1, 38016, 0x4f29282c
+0, 13, 13, 1, 38016, 0x8af235a1
+0, 14, 14, 1, 38016, 0x6dfe525a
+0, 15, 15, 1, 38016, 0xd51c793f
+0, 16, 16, 1, 38016, 0x4e90abba
+0, 17, 17, 1, 38016, 0xe706c5b7
+0, 18, 18, 1, 38016, 0x35fab7ef
+0, 19, 19, 1, 38016, 0xed78b8fc
+0, 20, 20, 1, 38016, 0x2907bb4e
+0, 21, 21, 1, 38016, 0x1749bb47
+0, 22, 22, 1, 38016, 0x284ec688
+0, 23, 23, 1, 38016, 0x534abc24
+0, 24, 24, 1, 38016, 0xcd01bd13
+0, 25, 25, 1, 38016, 0xe97bbd51
+0, 26, 26, 1, 38016, 0xac1cb9e9
+0, 27, 27, 1, 38016, 0xd861c0a3
+0, 28, 28, 1, 38016, 0xf0f1ced4
+0, 29, 29, 1, 38016, 0xa9e8d2bf
+0, 30, 30, 1, 38016, 0x4c6aa7c5
+0, 31, 31, 1, 38016, 0xb20079ac
+0, 32, 32, 1, 38016, 0xbfc3563b
+0, 33, 33, 1, 38016, 0x48259358
+0, 34, 34, 1, 38016, 0x1bce0434
+0, 35, 35, 1, 38016, 0xa0ac59db
+0, 36, 36, 1, 38016, 0x87bdb608
+0, 37, 37, 1, 38016, 0x318037eb
+0, 38, 38, 1, 38016, 0x0f7d8496
+0, 39, 39, 1, 38016, 0x9e65bc1e
+0, 40, 40, 1, 38016, 0xc56be1ea
+0, 41, 41, 1, 38016, 0xc31fefb7
+0, 42, 42, 1, 38016, 0xcbcee4e4
+0, 43, 43, 1, 38016, 0xcf03f238
+0, 44, 44, 1, 38016, 0xc6a903a1
+0, 45, 45, 1, 38016, 0xfdabee4f
+0, 46, 46, 1, 38016, 0x9054bb39
+0, 47, 47, 1, 38016, 0xe9bf8cd8
+0, 48, 48, 1, 38016, 0x943d9e0a
+0, 49, 49, 1, 38016, 0x404cc87d
+0, 50, 50, 1, 38016, 0x3cd9dd49
+0, 51, 51, 1, 38016, 0x5eabbdf1
+0, 52, 52, 1, 38016, 0xd206d9ef
+0, 53, 53, 1, 38016, 0x75e310ad
+0, 54, 54, 1, 38016, 0x01893e25
+0, 55, 55, 1, 38016, 0xda5360e6
+0, 56, 56, 1, 38016, 0x80656a39
+0, 57, 57, 1, 38016, 0x85452c84
+0, 58, 58, 1, 38016, 0x48d92ef7
+0, 59, 59, 1, 38016, 0x0edc45b2
+0, 60, 60, 1, 38016, 0xeb8a3531
+0, 61, 61, 1, 38016, 0x7b5914b5
+0, 62, 62, 1, 38016, 0xf1b6c7fa
+0, 63, 63, 1, 38016, 0x68fca853
+0, 64, 64, 1, 38016, 0x68ebcc02
+0, 65, 65, 1, 38016, 0x793edc8e
+0, 66, 66, 1, 38016, 0x9c86d139
+0, 67, 67, 1, 38016, 0x2aeed2f9
+0, 68, 68, 1, 38016, 0xb8cfc89d
+0, 69, 69, 1, 38016, 0x22d2b5c4
+0, 70, 70, 1, 38016, 0x01ae9d2d
+0, 71, 71, 1, 38016, 0x4e9b7c84
+0, 72, 72, 1, 38016, 0xa52c8553
+0, 73, 73, 1, 38016, 0x50df78d0
+0, 74, 74, 1, 38016, 0x4dc31f1c
+0, 75, 75, 1, 38016, 0xf24ee29a
+0, 76, 76, 1, 38016, 0xced0d363
+0, 77, 77, 1, 38016, 0x2263bfdc
+0, 78, 78, 1, 38016, 0x1363f580
+0, 79, 79, 1, 38016, 0xfc7f3a50
+0, 80, 80, 1, 38016, 0x38427007
+0, 81, 81, 1, 38016, 0xfc5757eb
+0, 82, 82, 1, 38016, 0xf20f4d0b
+0, 83, 83, 1, 38016, 0x64871ca3
+0, 84, 84, 1, 38016, 0xcb66cd99
+0, 85, 85, 1, 38016, 0xaacdda1f
+0, 86, 86, 1, 38016, 0xd52206c8
+0, 87, 87, 1, 38016, 0xcb461142
+0, 88, 88, 1, 38016, 0x9e36a3b3
+0, 89, 89, 1, 38016, 0xf3b44a7c
+0, 90, 90, 1, 38016, 0x1722db32
+0, 91, 91, 1, 38016, 0xa943d602
+0, 92, 92, 1, 38016, 0xc899e7bf
+0, 93, 93, 1, 38016, 0xacd10bdc
+0, 94, 94, 1, 38016, 0x703b3802
+0, 95, 95, 1, 38016, 0xe246efb4
+0, 96, 96, 1, 38016, 0x1ebfccb2
+0, 97, 97, 1, 38016, 0x57380778
+0, 98, 98, 1, 38016, 0xb70e7313
+0, 99, 99, 1, 38016, 0x0cd4af3d
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-mps_mw_a b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-mps_mw_a
index 47e7feb..959a0ae 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-mps_mw_a
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-mps_mw_a
@@ -1,150 +1,151 @@
-0, 0, 38016, 0x06150e88
-0, 3600, 38016, 0x32d90103
-0, 7200, 38016, 0x5b5f2fae
-0, 10800, 38016, 0xba6e6302
-0, 14400, 38016, 0x6c4b8e95
-0, 18000, 38016, 0x6d51ab43
-0, 21600, 38016, 0x5582a7c5
-0, 25200, 38016, 0xf48e6545
-0, 28800, 38016, 0x083a8481
-0, 32400, 38016, 0x0576a254
-0, 36000, 38016, 0x07429a61
-0, 39600, 38016, 0xd1e26eb1
-0, 43200, 38016, 0x94032564
-0, 46800, 38016, 0xc9d217c0
-0, 50400, 38016, 0xf0ee3f46
-0, 54000, 38016, 0xe8fc4d97
-0, 57600, 38016, 0xd3b0488d
-0, 61200, 38016, 0xc4243d99
-0, 64800, 38016, 0xa65b36ed
-0, 68400, 38016, 0x84ca1844
-0, 72000, 38016, 0xcd6706bf
-0, 75600, 38016, 0x1c03ec0a
-0, 79200, 38016, 0xf1380127
-0, 82800, 38016, 0xa499e0a5
-0, 86400, 38016, 0x5fca87ce
-0, 90000, 38016, 0x0b385064
-0, 93600, 38016, 0x6a4f49c4
-0, 97200, 38016, 0x97e0464b
-0, 100800, 38016, 0xcbf98750
-0, 104400, 38016, 0xa9efe0cd
-0, 108000, 38016, 0x9ea7d82e
-0, 111600, 38016, 0x28cec5ce
-0, 115200, 38016, 0xaec6ac1e
-0, 118800, 38016, 0x8cba69b3
-0, 122400, 38016, 0x727720c1
-0, 126000, 38016, 0xee4f4822
-0, 129600, 38016, 0x9d456e11
-0, 133200, 38016, 0x14123f91
-0, 136800, 38016, 0xf5e1d1a3
-0, 140400, 38016, 0xaadd9435
-0, 144000, 38016, 0x94df6e5e
-0, 147600, 38016, 0x18805412
-0, 151200, 38016, 0x0ba26c8c
-0, 154800, 38016, 0x4548a5c1
-0, 158400, 38016, 0x9217cb5f
-0, 162000, 38016, 0x2ea74a9e
-0, 165600, 38016, 0xeb0c57b6
-0, 169200, 38016, 0xf968a4a5
-0, 172800, 38016, 0xa410ef43
-0, 176400, 38016, 0x55813001
-0, 180000, 38016, 0x9cea4512
-0, 183600, 38016, 0x27754fa6
-0, 187200, 38016, 0x9824548a
-0, 190800, 38016, 0x7f1047eb
-0, 194400, 38016, 0x75fb2e10
-0, 198000, 38016, 0xe50df970
-0, 201600, 38016, 0x6ed6dfb4
-0, 205200, 38016, 0x8e97ccee
-0, 208800, 38016, 0x7f96c5f0
-0, 212400, 38016, 0x0940c200
-0, 216000, 38016, 0x86b98701
-0, 219600, 38016, 0x977d759a
-0, 223200, 38016, 0xf2b17bff
-0, 226800, 38016, 0xee1496d7
-0, 230400, 38016, 0x6cb1c1b5
-0, 234000, 38016, 0xa6bc0db9
-0, 237600, 38016, 0x902f660d
-0, 241200, 38016, 0x7bf7a434
-0, 244800, 38016, 0x97f9c2a6
-0, 248400, 38016, 0xf8bf9241
-0, 252000, 38016, 0x8639502b
-0, 255600, 38016, 0x82c2537f
-0, 259200, 38016, 0x1141243a
-0, 262800, 38016, 0xcaef5ae5
-0, 266400, 38016, 0xe2c4d308
-0, 270000, 38016, 0x35530a2c
-0, 273600, 38016, 0x22a3b317
-0, 277200, 38016, 0xda988427
-0, 280800, 38016, 0x54616f11
-0, 284400, 38016, 0xc38fc57c
-0, 288000, 38016, 0x7039d019
-0, 291600, 38016, 0x0fd6e6d9
-0, 295200, 38016, 0xc213e48e
-0, 298800, 38016, 0xf469b8e1
-0, 302400, 38016, 0x1f5c706c
-0, 306000, 38016, 0x69652db3
-0, 309600, 38016, 0xe1b9d46d
-0, 313200, 38016, 0x4e7522aa
-0, 316800, 38016, 0x8f4025a4
-0, 320400, 38016, 0xbc0483f6
-0, 324000, 38016, 0xae91d342
-0, 327600, 38016, 0xb1435578
-0, 331200, 38016, 0xf7535863
-0, 334800, 38016, 0xc16ff613
-0, 338400, 38016, 0x55bc394f
-0, 342000, 38016, 0xc7b76458
-0, 345600, 38016, 0xd3fd69ae
-0, 349200, 38016, 0x4b44d724
-0, 352800, 38016, 0x740b99c5
-0, 356400, 38016, 0x40c7c625
-0, 360000, 38016, 0x1691a7ef
-0, 363600, 38016, 0x6ea9392e
-0, 367200, 38016, 0xf958200f
-0, 370800, 38016, 0x916d75eb
-0, 374400, 38016, 0x6b4bee69
-0, 378000, 38016, 0x87adf9de
-0, 381600, 38016, 0x92dc586e
-0, 385200, 38016, 0x3c5aa531
-0, 388800, 38016, 0x00f81488
-0, 392400, 38016, 0x981aeb9f
-0, 396000, 38016, 0x49cf8e5f
-0, 399600, 38016, 0xfd56b231
-0, 403200, 38016, 0x419aaa2e
-0, 406800, 38016, 0xae155602
-0, 410400, 38016, 0x1e530aa1
-0, 414000, 38016, 0x60ca2c1b
-0, 417600, 38016, 0x0e7bdec7
-0, 421200, 38016, 0xe858b864
-0, 424800, 38016, 0x47378c1d
-0, 428400, 38016, 0x90008a4d
-0, 432000, 38016, 0xa1293af0
-0, 435600, 38016, 0x596964a8
-0, 439200, 38016, 0xb25d9ccf
-0, 442800, 38016, 0xccdbb7a0
-0, 446400, 38016, 0x3becf25a
-0, 450000, 38016, 0x918d1816
-0, 453600, 38016, 0x71d02564
-0, 457200, 38016, 0x643015fd
-0, 460800, 38016, 0x3af5f577
-0, 464400, 38016, 0x77b5ecea
-0, 468000, 38016, 0x7f940014
-0, 471600, 38016, 0x726f0bf3
-0, 475200, 38016, 0xb728078f
-0, 478800, 38016, 0x46e1f70a
-0, 482400, 38016, 0x79ccdd3e
-0, 486000, 38016, 0x80d2ca75
-0, 489600, 38016, 0xc87dc034
-0, 493200, 38016, 0x7535c12a
-0, 496800, 38016, 0x2d32bd77
-0, 500400, 38016, 0x2fceb360
-0, 504000, 38016, 0x8d0aa592
-0, 507600, 38016, 0xc9b9bb80
-0, 511200, 38016, 0xa667dd9c
-0, 514800, 38016, 0x7b5df35b
-0, 518400, 38016, 0x5feb1125
-0, 522000, 38016, 0x222a306f
-0, 525600, 38016, 0x64c84c75
-0, 529200, 38016, 0x5e605c79
-0, 532800, 38016, 0x2d2f78f3
-0, 536400, 38016, 0x7b72973d
+#tb 0: 1/25
+0, 0, 0, 1, 38016, 0x06150e88
+0, 1, 1, 1, 38016, 0x32d90103
+0, 2, 2, 1, 38016, 0x5b5f2fae
+0, 3, 3, 1, 38016, 0xba6e6302
+0, 4, 4, 1, 38016, 0x6c4b8e95
+0, 5, 5, 1, 38016, 0x6d51ab43
+0, 6, 6, 1, 38016, 0x5582a7c5
+0, 7, 7, 1, 38016, 0xf48e6545
+0, 8, 8, 1, 38016, 0x083a8481
+0, 9, 9, 1, 38016, 0x0576a254
+0, 10, 10, 1, 38016, 0x07429a61
+0, 11, 11, 1, 38016, 0xd1e26eb1
+0, 12, 12, 1, 38016, 0x94032564
+0, 13, 13, 1, 38016, 0xc9d217c0
+0, 14, 14, 1, 38016, 0xf0ee3f46
+0, 15, 15, 1, 38016, 0xe8fc4d97
+0, 16, 16, 1, 38016, 0xd3b0488d
+0, 17, 17, 1, 38016, 0xc4243d99
+0, 18, 18, 1, 38016, 0xa65b36ed
+0, 19, 19, 1, 38016, 0x84ca1844
+0, 20, 20, 1, 38016, 0xcd6706bf
+0, 21, 21, 1, 38016, 0x1c03ec0a
+0, 22, 22, 1, 38016, 0xf1380127
+0, 23, 23, 1, 38016, 0xa499e0a5
+0, 24, 24, 1, 38016, 0x5fca87ce
+0, 25, 25, 1, 38016, 0x0b385064
+0, 26, 26, 1, 38016, 0x6a4f49c4
+0, 27, 27, 1, 38016, 0x97e0464b
+0, 28, 28, 1, 38016, 0xcbf98750
+0, 29, 29, 1, 38016, 0xa9efe0cd
+0, 30, 30, 1, 38016, 0x9ea7d82e
+0, 31, 31, 1, 38016, 0x28cec5ce
+0, 32, 32, 1, 38016, 0xaec6ac1e
+0, 33, 33, 1, 38016, 0x8cba69b3
+0, 34, 34, 1, 38016, 0x727720c1
+0, 35, 35, 1, 38016, 0xee4f4822
+0, 36, 36, 1, 38016, 0x9d456e11
+0, 37, 37, 1, 38016, 0x14123f91
+0, 38, 38, 1, 38016, 0xf5e1d1a3
+0, 39, 39, 1, 38016, 0xaadd9435
+0, 40, 40, 1, 38016, 0x94df6e5e
+0, 41, 41, 1, 38016, 0x18805412
+0, 42, 42, 1, 38016, 0x0ba26c8c
+0, 43, 43, 1, 38016, 0x4548a5c1
+0, 44, 44, 1, 38016, 0x9217cb5f
+0, 45, 45, 1, 38016, 0x2ea74a9e
+0, 46, 46, 1, 38016, 0xeb0c57b6
+0, 47, 47, 1, 38016, 0xf968a4a5
+0, 48, 48, 1, 38016, 0xa410ef43
+0, 49, 49, 1, 38016, 0x55813001
+0, 50, 50, 1, 38016, 0x9cea4512
+0, 51, 51, 1, 38016, 0x27754fa6
+0, 52, 52, 1, 38016, 0x9824548a
+0, 53, 53, 1, 38016, 0x7f1047eb
+0, 54, 54, 1, 38016, 0x75fb2e10
+0, 55, 55, 1, 38016, 0xe50df970
+0, 56, 56, 1, 38016, 0x6ed6dfb4
+0, 57, 57, 1, 38016, 0x8e97ccee
+0, 58, 58, 1, 38016, 0x7f96c5f0
+0, 59, 59, 1, 38016, 0x0940c200
+0, 60, 60, 1, 38016, 0x86b98701
+0, 61, 61, 1, 38016, 0x977d759a
+0, 62, 62, 1, 38016, 0xf2b17bff
+0, 63, 63, 1, 38016, 0xee1496d7
+0, 64, 64, 1, 38016, 0x6cb1c1b5
+0, 65, 65, 1, 38016, 0xa6bc0db9
+0, 66, 66, 1, 38016, 0x902f660d
+0, 67, 67, 1, 38016, 0x7bf7a434
+0, 68, 68, 1, 38016, 0x97f9c2a6
+0, 69, 69, 1, 38016, 0xf8bf9241
+0, 70, 70, 1, 38016, 0x8639502b
+0, 71, 71, 1, 38016, 0x82c2537f
+0, 72, 72, 1, 38016, 0x1141243a
+0, 73, 73, 1, 38016, 0xcaef5ae5
+0, 74, 74, 1, 38016, 0xe2c4d308
+0, 75, 75, 1, 38016, 0x35530a2c
+0, 76, 76, 1, 38016, 0x22a3b317
+0, 77, 77, 1, 38016, 0xda988427
+0, 78, 78, 1, 38016, 0x54616f11
+0, 79, 79, 1, 38016, 0xc38fc57c
+0, 80, 80, 1, 38016, 0x7039d019
+0, 81, 81, 1, 38016, 0x0fd6e6d9
+0, 82, 82, 1, 38016, 0xc213e48e
+0, 83, 83, 1, 38016, 0xf469b8e1
+0, 84, 84, 1, 38016, 0x1f5c706c
+0, 85, 85, 1, 38016, 0x69652db3
+0, 86, 86, 1, 38016, 0xe1b9d46d
+0, 87, 87, 1, 38016, 0x4e7522aa
+0, 88, 88, 1, 38016, 0x8f4025a4
+0, 89, 89, 1, 38016, 0xbc0483f6
+0, 90, 90, 1, 38016, 0xae91d342
+0, 91, 91, 1, 38016, 0xb1435578
+0, 92, 92, 1, 38016, 0xf7535863
+0, 93, 93, 1, 38016, 0xc16ff613
+0, 94, 94, 1, 38016, 0x55bc394f
+0, 95, 95, 1, 38016, 0xc7b76458
+0, 96, 96, 1, 38016, 0xd3fd69ae
+0, 97, 97, 1, 38016, 0x4b44d724
+0, 98, 98, 1, 38016, 0x740b99c5
+0, 99, 99, 1, 38016, 0x40c7c625
+0, 100, 100, 1, 38016, 0x1691a7ef
+0, 101, 101, 1, 38016, 0x6ea9392e
+0, 102, 102, 1, 38016, 0xf958200f
+0, 103, 103, 1, 38016, 0x916d75eb
+0, 104, 104, 1, 38016, 0x6b4bee69
+0, 105, 105, 1, 38016, 0x87adf9de
+0, 106, 106, 1, 38016, 0x92dc586e
+0, 107, 107, 1, 38016, 0x3c5aa531
+0, 108, 108, 1, 38016, 0x00f81488
+0, 109, 109, 1, 38016, 0x981aeb9f
+0, 110, 110, 1, 38016, 0x49cf8e5f
+0, 111, 111, 1, 38016, 0xfd56b231
+0, 112, 112, 1, 38016, 0x419aaa2e
+0, 113, 113, 1, 38016, 0xae155602
+0, 114, 114, 1, 38016, 0x1e530aa1
+0, 115, 115, 1, 38016, 0x60ca2c1b
+0, 116, 116, 1, 38016, 0x0e7bdec7
+0, 117, 117, 1, 38016, 0xe858b864
+0, 118, 118, 1, 38016, 0x47378c1d
+0, 119, 119, 1, 38016, 0x90008a4d
+0, 120, 120, 1, 38016, 0xa1293af0
+0, 121, 121, 1, 38016, 0x596964a8
+0, 122, 122, 1, 38016, 0xb25d9ccf
+0, 123, 123, 1, 38016, 0xccdbb7a0
+0, 124, 124, 1, 38016, 0x3becf25a
+0, 125, 125, 1, 38016, 0x918d1816
+0, 126, 126, 1, 38016, 0x71d02564
+0, 127, 127, 1, 38016, 0x643015fd
+0, 128, 128, 1, 38016, 0x3af5f577
+0, 129, 129, 1, 38016, 0x77b5ecea
+0, 130, 130, 1, 38016, 0x7f940014
+0, 131, 131, 1, 38016, 0x726f0bf3
+0, 132, 132, 1, 38016, 0xb728078f
+0, 133, 133, 1, 38016, 0x46e1f70a
+0, 134, 134, 1, 38016, 0x79ccdd3e
+0, 135, 135, 1, 38016, 0x80d2ca75
+0, 136, 136, 1, 38016, 0xc87dc034
+0, 137, 137, 1, 38016, 0x7535c12a
+0, 138, 138, 1, 38016, 0x2d32bd77
+0, 139, 139, 1, 38016, 0x2fceb360
+0, 140, 140, 1, 38016, 0x8d0aa592
+0, 141, 141, 1, 38016, 0xc9b9bb80
+0, 142, 142, 1, 38016, 0xa667dd9c
+0, 143, 143, 1, 38016, 0x7b5df35b
+0, 144, 144, 1, 38016, 0x5feb1125
+0, 145, 145, 1, 38016, 0x222a306f
+0, 146, 146, 1, 38016, 0x64c84c75
+0, 147, 147, 1, 38016, 0x5e605c79
+0, 148, 148, 1, 38016, 0x2d2f78f3
+0, 149, 149, 1, 38016, 0x7b72973d
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-mr1_bt_a b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-mr1_bt_a
index b077cd4..11eb590 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-mr1_bt_a
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-mr1_bt_a
@@ -1,62 +1,63 @@
-0, 0, 38016, 0xc6658719
-0, 3600, 38016, 0x8a7c7423
-0, 7200, 38016, 0x97e99b66
-0, 10800, 38016, 0x73c4c4f7
-0, 14400, 38016, 0xb45bfb44
-0, 18000, 38016, 0x1bc3249c
-0, 21600, 38016, 0xd98a3121
-0, 25200, 38016, 0x6f0aefc1
-0, 28800, 38016, 0x6287f651
-0, 32400, 38016, 0x2a4a1630
-0, 36000, 38016, 0x5e7b5a35
-0, 39600, 38016, 0x58847533
-0, 43200, 38016, 0x2bad942b
-0, 46800, 38016, 0x17d75cb1
-0, 50400, 38016, 0x6d8e818d
-0, 54000, 38016, 0xfa3165db
-0, 57600, 38016, 0x6a6e249f
-0, 61200, 38016, 0x2d232ece
-0, 64800, 38016, 0xfba6616e
-0, 68400, 38016, 0xa9e7533f
-0, 72000, 38016, 0x7c4827e6
-0, 75600, 38016, 0xf570f8ca
-0, 79200, 38016, 0x0dac953f
-0, 82800, 38016, 0x74cb5f30
-0, 86400, 38016, 0x038ce61b
-0, 90000, 38016, 0x291f8ecb
-0, 93600, 38016, 0x768a6539
-0, 97200, 38016, 0x27a960e6
-0, 100800, 38016, 0x4d8ab279
-0, 104400, 38016, 0x7da78115
-0, 108000, 38016, 0x27beadcf
-0, 111600, 38016, 0x98c43180
-0, 115200, 38016, 0x566d55db
-0, 118800, 38016, 0xddc19fda
-0, 122400, 38016, 0xe353c891
-0, 126000, 38016, 0x17e2e3ab
-0, 129600, 38016, 0x8759e7c3
-0, 133200, 38016, 0x9d93bca9
-0, 136800, 38016, 0x8b77af4e
-0, 140400, 38016, 0x9b799dac
-0, 144000, 38016, 0xcb8bc504
-0, 147600, 38016, 0x58e989c8
-0, 151200, 38016, 0x4e4dbb7f
-0, 154800, 38016, 0xdfa6934e
-0, 158400, 38016, 0x14947459
-0, 162000, 38016, 0x7a31ff6a
-0, 165600, 38016, 0xc044fbc3
-0, 169200, 38016, 0xcaa723d1
-0, 172800, 38016, 0x325c1dca
-0, 176400, 38016, 0x62fb027d
-0, 180000, 38016, 0x710f3ae9
-0, 183600, 38016, 0xdbbf1804
-0, 187200, 38016, 0x1487f491
-0, 190800, 38016, 0x6a722d73
-0, 194400, 38016, 0xeb7258dd
-0, 198000, 38016, 0x685e8a68
-0, 201600, 38016, 0x1627800e
-0, 205200, 38016, 0xa88a9a31
-0, 208800, 38016, 0x4d5eaf56
-0, 212400, 38016, 0xe3a9af0a
-0, 216000, 38016, 0x3c38b8b2
-0, 219600, 38016, 0x991fc29e
+#tb 0: 1/25
+0, 0, 0, 1, 38016, 0xc6658719
+0, 1, 1, 1, 38016, 0x8a7c7423
+0, 2, 2, 1, 38016, 0x97e99b66
+0, 3, 3, 1, 38016, 0x73c4c4f7
+0, 4, 4, 1, 38016, 0xb45bfb44
+0, 5, 5, 1, 38016, 0x1bc3249c
+0, 6, 6, 1, 38016, 0xd98a3121
+0, 7, 7, 1, 38016, 0x6f0aefc1
+0, 8, 8, 1, 38016, 0x6287f651
+0, 9, 9, 1, 38016, 0x2a4a1630
+0, 10, 10, 1, 38016, 0x5e7b5a35
+0, 11, 11, 1, 38016, 0x58847533
+0, 12, 12, 1, 38016, 0x2bad942b
+0, 13, 13, 1, 38016, 0x17d75cb1
+0, 14, 14, 1, 38016, 0x6d8e818d
+0, 15, 15, 1, 38016, 0xfa3165db
+0, 16, 16, 1, 38016, 0x6a6e249f
+0, 17, 17, 1, 38016, 0x2d232ece
+0, 18, 18, 1, 38016, 0xfba6616e
+0, 19, 19, 1, 38016, 0xa9e7533f
+0, 20, 20, 1, 38016, 0x7c4827e6
+0, 21, 21, 1, 38016, 0xf570f8ca
+0, 22, 22, 1, 38016, 0x0dac953f
+0, 23, 23, 1, 38016, 0x74cb5f30
+0, 24, 24, 1, 38016, 0x038ce61b
+0, 25, 25, 1, 38016, 0x291f8ecb
+0, 26, 26, 1, 38016, 0x768a6539
+0, 27, 27, 1, 38016, 0x27a960e6
+0, 28, 28, 1, 38016, 0x4d8ab279
+0, 29, 29, 1, 38016, 0x7da78115
+0, 30, 30, 1, 38016, 0x27beadcf
+0, 31, 31, 1, 38016, 0x98c43180
+0, 32, 32, 1, 38016, 0x566d55db
+0, 33, 33, 1, 38016, 0xddc19fda
+0, 34, 34, 1, 38016, 0xe353c891
+0, 35, 35, 1, 38016, 0x17e2e3ab
+0, 36, 36, 1, 38016, 0x8759e7c3
+0, 37, 37, 1, 38016, 0x9d93bca9
+0, 38, 38, 1, 38016, 0x8b77af4e
+0, 39, 39, 1, 38016, 0x9b799dac
+0, 40, 40, 1, 38016, 0xcb8bc504
+0, 41, 41, 1, 38016, 0x58e989c8
+0, 42, 42, 1, 38016, 0x4e4dbb7f
+0, 43, 43, 1, 38016, 0xdfa6934e
+0, 44, 44, 1, 38016, 0x14947459
+0, 45, 45, 1, 38016, 0x7a31ff6a
+0, 46, 46, 1, 38016, 0xc044fbc3
+0, 47, 47, 1, 38016, 0xcaa723d1
+0, 48, 48, 1, 38016, 0x325c1dca
+0, 49, 49, 1, 38016, 0x62fb027d
+0, 50, 50, 1, 38016, 0x710f3ae9
+0, 51, 51, 1, 38016, 0xdbbf1804
+0, 52, 52, 1, 38016, 0x1487f491
+0, 53, 53, 1, 38016, 0x6a722d73
+0, 54, 54, 1, 38016, 0xeb7258dd
+0, 55, 55, 1, 38016, 0x685e8a68
+0, 56, 56, 1, 38016, 0x1627800e
+0, 57, 57, 1, 38016, 0xa88a9a31
+0, 58, 58, 1, 38016, 0x4d5eaf56
+0, 59, 59, 1, 38016, 0xe3a9af0a
+0, 60, 60, 1, 38016, 0x3c38b8b2
+0, 61, 61, 1, 38016, 0x991fc29e
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-mr1_mw_a b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-mr1_mw_a
index 98f112c..da7631d 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-mr1_mw_a
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-mr1_mw_a
@@ -1,150 +1,151 @@
-0, 0, 38016, 0xc8981780
-0, 3600, 38016, 0xf089d880
-0, 7200, 38016, 0x5eee0731
-0, 10800, 38016, 0x79604e7c
-0, 14400, 38016, 0xb92186a9
-0, 18000, 38016, 0xe18ea8d9
-0, 21600, 38016, 0xedb599dd
-0, 25200, 38016, 0xc2665a04
-0, 28800, 38016, 0x88387c78
-0, 32400, 38016, 0x70b09638
-0, 36000, 38016, 0xb5629ba8
-0, 39600, 38016, 0xc8ee696b
-0, 43200, 38016, 0x9af12088
-0, 46800, 38016, 0x044f1510
-0, 50400, 38016, 0x04153fcc
-0, 54000, 38016, 0x6a433225
-0, 57600, 38016, 0x8fb43d81
-0, 61200, 38016, 0x708c5884
-0, 64800, 38016, 0xb2fa310d
-0, 68400, 38016, 0xa54f23bf
-0, 72000, 38016, 0x875d12a9
-0, 75600, 38016, 0xa7c2f3e5
-0, 79200, 38016, 0xba120362
-0, 82800, 38016, 0xf922ead0
-0, 86400, 38016, 0x23c38ae4
-0, 90000, 38016, 0x8e705ad0
-0, 93600, 38016, 0x60854be9
-0, 97200, 38016, 0x63163fd9
-0, 100800, 38016, 0x6d5886bd
-0, 104400, 38016, 0xd66fdaaa
-0, 108000, 38016, 0xcda78bc1
-0, 111600, 38016, 0x7e11aa47
-0, 115200, 38016, 0x4ac4ceba
-0, 118800, 38016, 0x80a45b77
-0, 122400, 38016, 0x6d1a19f9
-0, 126000, 38016, 0xd2b93d81
-0, 129600, 38016, 0x4532dc5a
-0, 133200, 38016, 0x874c3d28
-0, 136800, 38016, 0xbeb4552c
-0, 140400, 38016, 0xd85e8b6d
-0, 144000, 38016, 0x4c3a6953
-0, 147600, 38016, 0xf8615235
-0, 151200, 38016, 0x9b3e613a
-0, 154800, 38016, 0xfbba9dd5
-0, 158400, 38016, 0x435fbc73
-0, 162000, 38016, 0x15746d9d
-0, 165600, 38016, 0xfc6c2960
-0, 169200, 38016, 0x80c41d21
-0, 172800, 38016, 0xa621c891
-0, 176400, 38016, 0x24ce0e8b
-0, 180000, 38016, 0x15552d28
-0, 183600, 38016, 0xbc0b3703
-0, 187200, 38016, 0x81643dee
-0, 190800, 38016, 0x479c42ea
-0, 194400, 38016, 0x63d426db
-0, 198000, 38016, 0x5830f8e4
-0, 201600, 38016, 0xce24d921
-0, 205200, 38016, 0x0224c7b9
-0, 208800, 38016, 0x8f44bf31
-0, 212400, 38016, 0xc3d5c00f
-0, 216000, 38016, 0x13268498
-0, 219600, 38016, 0x83b99095
-0, 223200, 38016, 0xbb66a4b3
-0, 226800, 38016, 0x9b849565
-0, 230400, 38016, 0x81edbe5a
-0, 234000, 38016, 0x43781090
-0, 237600, 38016, 0x449c6974
-0, 241200, 38016, 0xbe61a0e0
-0, 244800, 38016, 0x5128c18e
-0, 248400, 38016, 0x2bf68f94
-0, 252000, 38016, 0x0fea4bbb
-0, 255600, 38016, 0x7dd650d2
-0, 259200, 38016, 0xc4332d1d
-0, 262800, 38016, 0xc7946d1c
-0, 266400, 38016, 0x6856e33f
-0, 270000, 38016, 0x567f7cc2
-0, 273600, 38016, 0x378bafed
-0, 277200, 38016, 0x3f710f7c
-0, 280800, 38016, 0x5d866a75
-0, 284400, 38016, 0xe264bdc7
-0, 288000, 38016, 0x48b2cbe9
-0, 291600, 38016, 0x0a4be700
-0, 295200, 38016, 0xcc4ed40d
-0, 298800, 38016, 0x93acaf5a
-0, 302400, 38016, 0xdd7465f2
-0, 306000, 38016, 0x4d492419
-0, 309600, 38016, 0xc2c2ca96
-0, 313200, 38016, 0x190324d8
-0, 316800, 38016, 0xd8962520
-0, 320400, 38016, 0x8d917eea
-0, 324000, 38016, 0x08ec794f
-0, 327600, 38016, 0x7ab598a6
-0, 331200, 38016, 0xaaec0ef7
-0, 334800, 38016, 0x7f6ffbe3
-0, 338400, 38016, 0x116d37cb
-0, 342000, 38016, 0x7b3a59fd
-0, 345600, 38016, 0xed5361cb
-0, 349200, 38016, 0x9c558a98
-0, 352800, 38016, 0x292e84ea
-0, 356400, 38016, 0x0d35bf44
-0, 360000, 38016, 0xaad7bedd
-0, 363600, 38016, 0xa6111b87
-0, 367200, 38016, 0x3c8bfc27
-0, 370800, 38016, 0x65ce6703
-0, 374400, 38016, 0x60ece2ec
-0, 378000, 38016, 0x8abbb25f
-0, 381600, 38016, 0x41108b27
-0, 385200, 38016, 0xac26284e
-0, 388800, 38016, 0x5f4c0db0
-0, 392400, 38016, 0xcccbee91
-0, 396000, 38016, 0x34238dc1
-0, 399600, 38016, 0x7479b326
-0, 403200, 38016, 0xaaf8a957
-0, 406800, 38016, 0xc49b55cb
-0, 410400, 38016, 0x338b129f
-0, 414000, 38016, 0xf0ed3328
-0, 417600, 38016, 0x39f8dcb3
-0, 421200, 38016, 0x7aecb808
-0, 424800, 38016, 0x35e8827a
-0, 428400, 38016, 0x16ac8b9d
-0, 432000, 38016, 0x3abdcb78
-0, 435600, 38016, 0xdfbfba7f
-0, 439200, 38016, 0x692a964e
-0, 442800, 38016, 0x11a5ebdb
-0, 446400, 38016, 0x46bc156d
-0, 450000, 38016, 0x1b153144
-0, 453600, 38016, 0xdd23349a
-0, 457200, 38016, 0xbad02161
-0, 460800, 38016, 0xc5030168
-0, 464400, 38016, 0x3e4ff28d
-0, 468000, 38016, 0x17faffe2
-0, 471600, 38016, 0xba04122f
-0, 475200, 38016, 0x8a8e0e1e
-0, 478800, 38016, 0xe5d6fc7d
-0, 482400, 38016, 0x22e3e630
-0, 486000, 38016, 0x7eb1a935
-0, 489600, 38016, 0xde46bead
-0, 493200, 38016, 0x34abc542
-0, 496800, 38016, 0x10ceaea3
-0, 500400, 38016, 0xb86fa676
-0, 504000, 38016, 0xbd9d9d3c
-0, 507600, 38016, 0x355fb37f
-0, 511200, 38016, 0xfb6fd3b0
-0, 514800, 38016, 0x3062edf4
-0, 518400, 38016, 0xf6940b60
-0, 522000, 38016, 0x78bd2f4e
-0, 525600, 38016, 0x51fc444f
-0, 529200, 38016, 0x118957cc
-0, 532800, 38016, 0x53777a50
-0, 536400, 38016, 0xeeaa9761
+#tb 0: 1/25
+0, 0, 0, 1, 38016, 0xc8981780
+0, 1, 1, 1, 38016, 0xf089d880
+0, 2, 2, 1, 38016, 0x5eee0731
+0, 3, 3, 1, 38016, 0x79604e7c
+0, 4, 4, 1, 38016, 0xb92186a9
+0, 5, 5, 1, 38016, 0xe18ea8d9
+0, 6, 6, 1, 38016, 0xedb599dd
+0, 7, 7, 1, 38016, 0xc2665a04
+0, 8, 8, 1, 38016, 0x88387c78
+0, 9, 9, 1, 38016, 0x70b09638
+0, 10, 10, 1, 38016, 0xb5629ba8
+0, 11, 11, 1, 38016, 0xc8ee696b
+0, 12, 12, 1, 38016, 0x9af12088
+0, 13, 13, 1, 38016, 0x044f1510
+0, 14, 14, 1, 38016, 0x04153fcc
+0, 15, 15, 1, 38016, 0x6a433225
+0, 16, 16, 1, 38016, 0x8fb43d81
+0, 17, 17, 1, 38016, 0x708c5884
+0, 18, 18, 1, 38016, 0xb2fa310d
+0, 19, 19, 1, 38016, 0xa54f23bf
+0, 20, 20, 1, 38016, 0x875d12a9
+0, 21, 21, 1, 38016, 0xa7c2f3e5
+0, 22, 22, 1, 38016, 0xba120362
+0, 23, 23, 1, 38016, 0xf922ead0
+0, 24, 24, 1, 38016, 0x23c38ae4
+0, 25, 25, 1, 38016, 0x8e705ad0
+0, 26, 26, 1, 38016, 0x60854be9
+0, 27, 27, 1, 38016, 0x63163fd9
+0, 28, 28, 1, 38016, 0x6d5886bd
+0, 29, 29, 1, 38016, 0xd66fdaaa
+0, 30, 30, 1, 38016, 0xcda78bc1
+0, 31, 31, 1, 38016, 0x7e11aa47
+0, 32, 32, 1, 38016, 0x4ac4ceba
+0, 33, 33, 1, 38016, 0x80a45b77
+0, 34, 34, 1, 38016, 0x6d1a19f9
+0, 35, 35, 1, 38016, 0xd2b93d81
+0, 36, 36, 1, 38016, 0x4532dc5a
+0, 37, 37, 1, 38016, 0x874c3d28
+0, 38, 38, 1, 38016, 0xbeb4552c
+0, 39, 39, 1, 38016, 0xd85e8b6d
+0, 40, 40, 1, 38016, 0x4c3a6953
+0, 41, 41, 1, 38016, 0xf8615235
+0, 42, 42, 1, 38016, 0x9b3e613a
+0, 43, 43, 1, 38016, 0xfbba9dd5
+0, 44, 44, 1, 38016, 0x435fbc73
+0, 45, 45, 1, 38016, 0x15746d9d
+0, 46, 46, 1, 38016, 0xfc6c2960
+0, 47, 47, 1, 38016, 0x80c41d21
+0, 48, 48, 1, 38016, 0xa621c891
+0, 49, 49, 1, 38016, 0x24ce0e8b
+0, 50, 50, 1, 38016, 0x15552d28
+0, 51, 51, 1, 38016, 0xbc0b3703
+0, 52, 52, 1, 38016, 0x81643dee
+0, 53, 53, 1, 38016, 0x479c42ea
+0, 54, 54, 1, 38016, 0x63d426db
+0, 55, 55, 1, 38016, 0x5830f8e4
+0, 56, 56, 1, 38016, 0xce24d921
+0, 57, 57, 1, 38016, 0x0224c7b9
+0, 58, 58, 1, 38016, 0x8f44bf31
+0, 59, 59, 1, 38016, 0xc3d5c00f
+0, 60, 60, 1, 38016, 0x13268498
+0, 61, 61, 1, 38016, 0x83b99095
+0, 62, 62, 1, 38016, 0xbb66a4b3
+0, 63, 63, 1, 38016, 0x9b849565
+0, 64, 64, 1, 38016, 0x81edbe5a
+0, 65, 65, 1, 38016, 0x43781090
+0, 66, 66, 1, 38016, 0x449c6974
+0, 67, 67, 1, 38016, 0xbe61a0e0
+0, 68, 68, 1, 38016, 0x5128c18e
+0, 69, 69, 1, 38016, 0x2bf68f94
+0, 70, 70, 1, 38016, 0x0fea4bbb
+0, 71, 71, 1, 38016, 0x7dd650d2
+0, 72, 72, 1, 38016, 0xc4332d1d
+0, 73, 73, 1, 38016, 0xc7946d1c
+0, 74, 74, 1, 38016, 0x6856e33f
+0, 75, 75, 1, 38016, 0x567f7cc2
+0, 76, 76, 1, 38016, 0x378bafed
+0, 77, 77, 1, 38016, 0x3f710f7c
+0, 78, 78, 1, 38016, 0x5d866a75
+0, 79, 79, 1, 38016, 0xe264bdc7
+0, 80, 80, 1, 38016, 0x48b2cbe9
+0, 81, 81, 1, 38016, 0x0a4be700
+0, 82, 82, 1, 38016, 0xcc4ed40d
+0, 83, 83, 1, 38016, 0x93acaf5a
+0, 84, 84, 1, 38016, 0xdd7465f2
+0, 85, 85, 1, 38016, 0x4d492419
+0, 86, 86, 1, 38016, 0xc2c2ca96
+0, 87, 87, 1, 38016, 0x190324d8
+0, 88, 88, 1, 38016, 0xd8962520
+0, 89, 89, 1, 38016, 0x8d917eea
+0, 90, 90, 1, 38016, 0x08ec794f
+0, 91, 91, 1, 38016, 0x7ab598a6
+0, 92, 92, 1, 38016, 0xaaec0ef7
+0, 93, 93, 1, 38016, 0x7f6ffbe3
+0, 94, 94, 1, 38016, 0x116d37cb
+0, 95, 95, 1, 38016, 0x7b3a59fd
+0, 96, 96, 1, 38016, 0xed5361cb
+0, 97, 97, 1, 38016, 0x9c558a98
+0, 98, 98, 1, 38016, 0x292e84ea
+0, 99, 99, 1, 38016, 0x0d35bf44
+0, 100, 100, 1, 38016, 0xaad7bedd
+0, 101, 101, 1, 38016, 0xa6111b87
+0, 102, 102, 1, 38016, 0x3c8bfc27
+0, 103, 103, 1, 38016, 0x65ce6703
+0, 104, 104, 1, 38016, 0x60ece2ec
+0, 105, 105, 1, 38016, 0x8abbb25f
+0, 106, 106, 1, 38016, 0x41108b27
+0, 107, 107, 1, 38016, 0xac26284e
+0, 108, 108, 1, 38016, 0x5f4c0db0
+0, 109, 109, 1, 38016, 0xcccbee91
+0, 110, 110, 1, 38016, 0x34238dc1
+0, 111, 111, 1, 38016, 0x7479b326
+0, 112, 112, 1, 38016, 0xaaf8a957
+0, 113, 113, 1, 38016, 0xc49b55cb
+0, 114, 114, 1, 38016, 0x338b129f
+0, 115, 115, 1, 38016, 0xf0ed3328
+0, 116, 116, 1, 38016, 0x39f8dcb3
+0, 117, 117, 1, 38016, 0x7aecb808
+0, 118, 118, 1, 38016, 0x35e8827a
+0, 119, 119, 1, 38016, 0x16ac8b9d
+0, 120, 120, 1, 38016, 0x3abdcb78
+0, 121, 121, 1, 38016, 0xdfbfba7f
+0, 122, 122, 1, 38016, 0x692a964e
+0, 123, 123, 1, 38016, 0x11a5ebdb
+0, 124, 124, 1, 38016, 0x46bc156d
+0, 125, 125, 1, 38016, 0x1b153144
+0, 126, 126, 1, 38016, 0xdd23349a
+0, 127, 127, 1, 38016, 0xbad02161
+0, 128, 128, 1, 38016, 0xc5030168
+0, 129, 129, 1, 38016, 0x3e4ff28d
+0, 130, 130, 1, 38016, 0x17faffe2
+0, 131, 131, 1, 38016, 0xba04122f
+0, 132, 132, 1, 38016, 0x8a8e0e1e
+0, 133, 133, 1, 38016, 0xe5d6fc7d
+0, 134, 134, 1, 38016, 0x22e3e630
+0, 135, 135, 1, 38016, 0x7eb1a935
+0, 136, 136, 1, 38016, 0xde46bead
+0, 137, 137, 1, 38016, 0x34abc542
+0, 138, 138, 1, 38016, 0x10ceaea3
+0, 139, 139, 1, 38016, 0xb86fa676
+0, 140, 140, 1, 38016, 0xbd9d9d3c
+0, 141, 141, 1, 38016, 0x355fb37f
+0, 142, 142, 1, 38016, 0xfb6fd3b0
+0, 143, 143, 1, 38016, 0x3062edf4
+0, 144, 144, 1, 38016, 0xf6940b60
+0, 145, 145, 1, 38016, 0x78bd2f4e
+0, 146, 146, 1, 38016, 0x51fc444f
+0, 147, 147, 1, 38016, 0x118957cc
+0, 148, 148, 1, 38016, 0x53777a50
+0, 149, 149, 1, 38016, 0xeeaa9761
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-mr2_mw_a b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-mr2_mw_a
index e172849..fd4b5d9 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-mr2_mw_a
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-mr2_mw_a
@@ -1,300 +1,301 @@
-0, 0, 38016, 0x06150e88
-0, 3600, 38016, 0x32d90103
-0, 7200, 38016, 0xb32d338f
-0, 10800, 38016, 0x653c5fc3
-0, 14400, 38016, 0x69ec8bce
-0, 18000, 38016, 0x354fa53a
-0, 21600, 38016, 0x2ee79c2c
-0, 25200, 38016, 0x2c50666c
-0, 28800, 38016, 0x65ea824d
-0, 32400, 38016, 0x7419948b
-0, 36000, 38016, 0x19b298a0
-0, 39600, 38016, 0x29087291
-0, 43200, 38016, 0x92be1e95
-0, 46800, 38016, 0x9699119a
-0, 50400, 38016, 0xa4863bff
-0, 54000, 38016, 0x7dfc4f6b
-0, 57600, 38016, 0x946e5cfa
-0, 61200, 38016, 0x57287bdc
-0, 64800, 38016, 0xe7ae8bbe
-0, 68400, 38016, 0x21d367c7
-0, 72000, 38016, 0x9d0551c2
-0, 75600, 38016, 0xecc980b5
-0, 79200, 38016, 0x0ac4a749
-0, 82800, 38016, 0x9162262f
-0, 86400, 38016, 0x4a071c14
-0, 90000, 38016, 0x8571fae8
-0, 93600, 38016, 0xc0843707
-0, 97200, 38016, 0x7b4a63b0
-0, 100800, 38016, 0x5faf5d86
-0, 104400, 38016, 0x64623f6b
-0, 108000, 38016, 0xa97b523a
-0, 111600, 38016, 0x4048459a
-0, 115200, 38016, 0x56ba3d73
-0, 118800, 38016, 0x5394355a
-0, 122400, 38016, 0xb6c0176e
-0, 126000, 38016, 0x668c0772
-0, 129600, 38016, 0x86feeae8
-0, 133200, 38016, 0x9e75f9af
-0, 136800, 38016, 0xd72de054
-0, 140400, 38016, 0x39eb8743
-0, 144000, 38016, 0xd07b4d8e
-0, 147600, 38016, 0x89c045a9
-0, 151200, 38016, 0x209542e6
-0, 154800, 38016, 0xc43886ed
-0, 158400, 38016, 0xe091e433
-0, 162000, 38016, 0x176b1f65
-0, 165600, 38016, 0xd7730c3e
-0, 169200, 38016, 0x2bb90778
-0, 172800, 38016, 0x9b4540a8
-0, 176400, 38016, 0xd34c50db
-0, 180000, 38016, 0xf8007af9
-0, 183600, 38016, 0x54748466
-0, 187200, 38016, 0x20ab88a5
-0, 190800, 38016, 0x6aca8887
-0, 194400, 38016, 0xa1bf899f
-0, 198000, 38016, 0x8145966d
-0, 201600, 38016, 0x98f5a29c
-0, 205200, 38016, 0x4ed1b4d1
-0, 208800, 38016, 0x3177b95c
-0, 212400, 38016, 0x2b2cc4b2
-0, 216000, 38016, 0xf389db1e
-0, 219600, 38016, 0xfc6fca35
-0, 223200, 38016, 0x5f06af41
-0, 226800, 38016, 0x93a368d6
-0, 230400, 38016, 0x3de421f3
-0, 234000, 38016, 0x1e3f4b8d
-0, 237600, 38016, 0x6c3e6d4a
-0, 241200, 38016, 0x96ab4569
-0, 244800, 38016, 0x0de2d417
-0, 248400, 38016, 0x1a8a8d91
-0, 252000, 38016, 0xffb96503
-0, 255600, 38016, 0x1e1b4959
-0, 259200, 38016, 0x6aa267cd
-0, 262800, 38016, 0xcb87a00c
-0, 266400, 38016, 0x3b8ac17c
-0, 270000, 38016, 0x1348bf7b
-0, 273600, 38016, 0x1807b42d
-0, 277200, 38016, 0x22dfa6cb
-0, 280800, 38016, 0x3d23a622
-0, 284400, 38016, 0x662cb1e0
-0, 288000, 38016, 0x6ecfafaf
-0, 291600, 38016, 0xbffcaa71
-0, 295200, 38016, 0xf75ab93f
-0, 298800, 38016, 0xaea796bf
-0, 302400, 38016, 0x4a547fe8
-0, 306000, 38016, 0x2f1a800f
-0, 309600, 38016, 0xc7788261
-0, 313200, 38016, 0x8be17fd3
-0, 316800, 38016, 0xe830830c
-0, 320400, 38016, 0x62345ab7
-0, 324000, 38016, 0x70f926c6
-0, 327600, 38016, 0x37e94bf0
-0, 331200, 38016, 0xb1509312
-0, 334800, 38016, 0xc70fea7a
-0, 338400, 38016, 0x8062243b
-0, 342000, 38016, 0xe64a48b1
-0, 345600, 38016, 0x6f0c4dd7
-0, 349200, 38016, 0x5f9c53b4
-0, 352800, 38016, 0x4c5e506c
-0, 356400, 38016, 0xb7c631ef
-0, 360000, 38016, 0x30f302a9
-0, 363600, 38016, 0x4f28ebf0
-0, 367200, 38016, 0x3145d3d3
-0, 370800, 38016, 0x69b6c92f
-0, 374400, 38016, 0xa3b2c646
-0, 378000, 38016, 0x5ee00dec
-0, 381600, 38016, 0x313ee3ea
-0, 385200, 38016, 0x4002070e
-0, 388800, 38016, 0x5e0106b1
-0, 392400, 38016, 0xd03b2c4d
-0, 396000, 38016, 0xdd085316
-0, 399600, 38016, 0xb47a5f86
-0, 403200, 38016, 0xc25d5750
-0, 406800, 38016, 0x16ad52b3
-0, 410400, 38016, 0xa4fe2754
-0, 414000, 38016, 0xac5dfb18
-0, 417600, 38016, 0xe36ee83b
-0, 421200, 38016, 0xc708e54e
-0, 424800, 38016, 0x6c4beb85
-0, 428400, 38016, 0xf19fd825
-0, 432000, 38016, 0x94e7bb13
-0, 435600, 38016, 0x026e9ddf
-0, 439200, 38016, 0xdc71a591
-0, 442800, 38016, 0xb46eb169
-0, 446400, 38016, 0x25f5d5f4
-0, 450000, 38016, 0x27da203d
-0, 453600, 38016, 0xed217513
-0, 457200, 38016, 0x78d7bb08
-0, 460800, 38016, 0x623dd66d
-0, 464400, 38016, 0xd68c9f82
-0, 468000, 38016, 0x88b059e2
-0, 471600, 38016, 0x623159aa
-0, 475200, 38016, 0x1782245b
-0, 478800, 38016, 0x64f55b4a
-0, 482400, 38016, 0x83c7d154
-0, 486000, 38016, 0x43461c7c
-0, 489600, 38016, 0xc3e38c36
-0, 493200, 38016, 0x763394b4
-0, 496800, 38016, 0xff99749d
-0, 500400, 38016, 0x76ca13d0
-0, 504000, 38016, 0x29510aea
-0, 507600, 38016, 0x385f4309
-0, 511200, 38016, 0x142f5339
-0, 514800, 38016, 0x980ca66e
-0, 518400, 38016, 0xc330c0db
-0, 522000, 38016, 0xa7dbca0f
-0, 525600, 38016, 0x4261c683
-0, 529200, 38016, 0x6d467d81
-0, 532800, 38016, 0x1a107d17
-0, 536400, 38016, 0xd91e765a
-0, 540000, 38016, 0x789cfb94
-0, 543600, 38016, 0xc9bc9ee1
-0, 547200, 38016, 0x32f8754c
-0, 550800, 38016, 0xad906454
-0, 554400, 38016, 0xe5d6b78d
-0, 558000, 38016, 0x307bc291
-0, 561600, 38016, 0x629bdec9
-0, 565200, 38016, 0xf23ccd36
-0, 568800, 38016, 0x6105aa1b
-0, 572400, 38016, 0x3da66383
-0, 576000, 38016, 0x48ce2141
-0, 579600, 38016, 0x09fac5fd
-0, 583200, 38016, 0xa0bc208d
-0, 586800, 38016, 0x49892a74
-0, 590400, 38016, 0xfcb48093
-0, 594000, 38016, 0x850e7e4c
-0, 597600, 38016, 0x7cf24f55
-0, 601200, 38016, 0x654845f4
-0, 604800, 38016, 0x35ac5d63
-0, 608400, 38016, 0x795ea726
-0, 612000, 38016, 0xf387a03d
-0, 615600, 38016, 0x29279e19
-0, 619200, 38016, 0x48e3b03d
-0, 622800, 38016, 0xbcfb8192
-0, 626400, 38016, 0x3fe2749a
-0, 630000, 38016, 0xe0a04bbd
-0, 633600, 38016, 0x9a912cd7
-0, 637200, 38016, 0x39781e59
-0, 640800, 38016, 0x90e5131a
-0, 644400, 38016, 0x8bd90b4b
-0, 648000, 38016, 0x410dda61
-0, 651600, 38016, 0x33eb60fd
-0, 655200, 38016, 0x08e8632b
-0, 658800, 38016, 0x6163fd94
-0, 662400, 38016, 0x60af34e1
-0, 666000, 38016, 0x00016227
-0, 669600, 38016, 0xe6bd71bd
-0, 673200, 38016, 0xb40cdf28
-0, 676800, 38016, 0x3cdeb88e
-0, 680400, 38016, 0xb9ffe0d6
-0, 684000, 38016, 0xd630ce53
-0, 687600, 38016, 0x120056c2
-0, 691200, 38016, 0x0940399e
-0, 694800, 38016, 0x3d337fd0
-0, 698400, 38016, 0x6ef1f4b9
-0, 702000, 38016, 0x7e20f462
-0, 705600, 38016, 0xe397f30a
-0, 709200, 38016, 0x6eadf916
-0, 712800, 38016, 0x850e07b9
-0, 716400, 38016, 0x131b10db
-0, 720000, 38016, 0x17961d0e
-0, 723600, 38016, 0x447557da
-0, 727200, 38016, 0x93da7c0e
-0, 730800, 38016, 0xd6259239
-0, 734400, 38016, 0x2db99d95
-0, 738000, 38016, 0x648ea2bd
-0, 741600, 38016, 0xf8f46ef6
-0, 745200, 38016, 0xb85a7405
-0, 748800, 38016, 0x55dc7bbd
-0, 752400, 38016, 0xf38d76f8
-0, 756000, 38016, 0x9e860b96
-0, 759600, 38016, 0x7c5a5da7
-0, 763200, 38016, 0xdf36a619
-0, 766800, 38016, 0x327d1144
-0, 770400, 38016, 0x4a01eabd
-0, 774000, 38016, 0xee8b8717
-0, 777600, 38016, 0x874eaf23
-0, 781200, 38016, 0xddaaaf38
-0, 784800, 38016, 0xcab85271
-0, 788400, 38016, 0x970f0d3f
-0, 792000, 38016, 0x2a042dcc
-0, 795600, 38016, 0xa240e0e7
-0, 799200, 38016, 0x9564c081
-0, 802800, 38016, 0x894d82b4
-0, 806400, 38016, 0xb0748d24
-0, 810000, 38016, 0xafa56340
-0, 813600, 38016, 0x614287c6
-0, 817200, 38016, 0x4dfcaaac
-0, 820800, 38016, 0x58dab168
-0, 824400, 38016, 0x19fbb779
-0, 828000, 38016, 0x25adb4c9
-0, 831600, 38016, 0x5fc1bdae
-0, 835200, 38016, 0x6581a5d0
-0, 838800, 38016, 0x81d57061
-0, 842400, 38016, 0x43445964
-0, 846000, 38016, 0x68224a19
-0, 849600, 38016, 0xa85d390a
-0, 853200, 38016, 0xb571344d
-0, 856800, 38016, 0xd3632bfd
-0, 860400, 38016, 0x5af52535
-0, 864000, 38016, 0x21b93882
-0, 867600, 38016, 0x8da56743
-0, 871200, 38016, 0x9e7b9da2
-0, 874800, 38016, 0xc1a6bbd9
-0, 878400, 38016, 0xd77be9aa
-0, 882000, 38016, 0x2715100f
-0, 885600, 38016, 0xac8c1e30
-0, 889200, 38016, 0x110c14b9
-0, 892800, 38016, 0x5a8ff5c4
-0, 896400, 38016, 0x25d4ef19
-0, 900000, 38016, 0x080ffe7f
-0, 903600, 38016, 0x7f5b15ef
-0, 907200, 38016, 0xf97f10e1
-0, 910800, 38016, 0xdd80f7e5
-0, 914400, 38016, 0xb177df60
-0, 918000, 38016, 0x406023f6
-0, 921600, 38016, 0xf396220f
-0, 925200, 38016, 0x50fc2e7a
-0, 928800, 38016, 0x959b42da
-0, 932400, 38016, 0x61c7484a
-0, 936000, 38016, 0x09825cd1
-0, 939600, 38016, 0x0e7b6bd9
-0, 943200, 38016, 0x4a386b9e
-0, 946800, 38016, 0x817b5e14
-0, 950400, 38016, 0x51696069
-0, 954000, 38016, 0x84a35f51
-0, 957600, 38016, 0xf7758da3
-0, 961200, 38016, 0x787b6659
-0, 964800, 38016, 0xedb95942
-0, 968400, 38016, 0x4d4d8eb5
-0, 972000, 38016, 0x716cb36a
-0, 975600, 38016, 0x6556b912
-0, 979200, 38016, 0xbdd8c0b6
-0, 982800, 38016, 0xd9ffbba5
-0, 986400, 38016, 0xb5d7b4a7
-0, 990000, 38016, 0x4690a4ed
-0, 993600, 38016, 0x6fc8bdc4
-0, 997200, 38016, 0x827de512
-0, 1000800, 38016, 0x897bfc43
-0, 1004400, 38016, 0x41f8144a
-0, 1008000, 38016, 0xff7d369e
-0, 1011600, 38016, 0x526f48fa
-0, 1015200, 38016, 0x53245921
-0, 1018800, 38016, 0x69a3791e
-0, 1022400, 38016, 0x3de095df
-0, 1026000, 38016, 0x9ae2a0f2
-0, 1029600, 38016, 0xd1668593
-0, 1033200, 38016, 0x322c4f5b
-0, 1036800, 38016, 0x15882875
-0, 1040400, 38016, 0xa8886b9a
-0, 1044000, 38016, 0xc6f07ac1
-0, 1047600, 38016, 0xf9446d58
-0, 1051200, 38016, 0x98ef5ffc
-0, 1054800, 38016, 0x23434b21
-0, 1058400, 38016, 0xa1f353d2
-0, 1062000, 38016, 0x6b3d4452
-0, 1065600, 38016, 0xd4ac32bf
-0, 1069200, 38016, 0xc577065d
-0, 1072800, 38016, 0x2d01111d
-0, 1076400, 38016, 0xf51721d4
+#tb 0: 1/25
+0, 0, 0, 1, 38016, 0x06150e88
+0, 1, 1, 1, 38016, 0x32d90103
+0, 2, 2, 1, 38016, 0xb32d338f
+0, 3, 3, 1, 38016, 0x653c5fc3
+0, 4, 4, 1, 38016, 0x69ec8bce
+0, 5, 5, 1, 38016, 0x354fa53a
+0, 6, 6, 1, 38016, 0x2ee79c2c
+0, 7, 7, 1, 38016, 0x2c50666c
+0, 8, 8, 1, 38016, 0x65ea824d
+0, 9, 9, 1, 38016, 0x7419948b
+0, 10, 10, 1, 38016, 0x19b298a0
+0, 11, 11, 1, 38016, 0x29087291
+0, 12, 12, 1, 38016, 0x92be1e95
+0, 13, 13, 1, 38016, 0x9699119a
+0, 14, 14, 1, 38016, 0xa4863bff
+0, 15, 15, 1, 38016, 0x7dfc4f6b
+0, 16, 16, 1, 38016, 0x946e5cfa
+0, 17, 17, 1, 38016, 0x57287bdc
+0, 18, 18, 1, 38016, 0xe7ae8bbe
+0, 19, 19, 1, 38016, 0x21d367c7
+0, 20, 20, 1, 38016, 0x9d0551c2
+0, 21, 21, 1, 38016, 0xecc980b5
+0, 22, 22, 1, 38016, 0x0ac4a749
+0, 23, 23, 1, 38016, 0x9162262f
+0, 24, 24, 1, 38016, 0x4a071c14
+0, 25, 25, 1, 38016, 0x8571fae8
+0, 26, 26, 1, 38016, 0xc0843707
+0, 27, 27, 1, 38016, 0x7b4a63b0
+0, 28, 28, 1, 38016, 0x5faf5d86
+0, 29, 29, 1, 38016, 0x64623f6b
+0, 30, 30, 1, 38016, 0xa97b523a
+0, 31, 31, 1, 38016, 0x4048459a
+0, 32, 32, 1, 38016, 0x56ba3d73
+0, 33, 33, 1, 38016, 0x5394355a
+0, 34, 34, 1, 38016, 0xb6c0176e
+0, 35, 35, 1, 38016, 0x668c0772
+0, 36, 36, 1, 38016, 0x86feeae8
+0, 37, 37, 1, 38016, 0x9e75f9af
+0, 38, 38, 1, 38016, 0xd72de054
+0, 39, 39, 1, 38016, 0x39eb8743
+0, 40, 40, 1, 38016, 0xd07b4d8e
+0, 41, 41, 1, 38016, 0x89c045a9
+0, 42, 42, 1, 38016, 0x209542e6
+0, 43, 43, 1, 38016, 0xc43886ed
+0, 44, 44, 1, 38016, 0xe091e433
+0, 45, 45, 1, 38016, 0x176b1f65
+0, 46, 46, 1, 38016, 0xd7730c3e
+0, 47, 47, 1, 38016, 0x2bb90778
+0, 48, 48, 1, 38016, 0x9b4540a8
+0, 49, 49, 1, 38016, 0xd34c50db
+0, 50, 50, 1, 38016, 0xf8007af9
+0, 51, 51, 1, 38016, 0x54748466
+0, 52, 52, 1, 38016, 0x20ab88a5
+0, 53, 53, 1, 38016, 0x6aca8887
+0, 54, 54, 1, 38016, 0xa1bf899f
+0, 55, 55, 1, 38016, 0x8145966d
+0, 56, 56, 1, 38016, 0x98f5a29c
+0, 57, 57, 1, 38016, 0x4ed1b4d1
+0, 58, 58, 1, 38016, 0x3177b95c
+0, 59, 59, 1, 38016, 0x2b2cc4b2
+0, 60, 60, 1, 38016, 0xf389db1e
+0, 61, 61, 1, 38016, 0xfc6fca35
+0, 62, 62, 1, 38016, 0x5f06af41
+0, 63, 63, 1, 38016, 0x93a368d6
+0, 64, 64, 1, 38016, 0x3de421f3
+0, 65, 65, 1, 38016, 0x1e3f4b8d
+0, 66, 66, 1, 38016, 0x6c3e6d4a
+0, 67, 67, 1, 38016, 0x96ab4569
+0, 68, 68, 1, 38016, 0x0de2d417
+0, 69, 69, 1, 38016, 0x1a8a8d91
+0, 70, 70, 1, 38016, 0xffb96503
+0, 71, 71, 1, 38016, 0x1e1b4959
+0, 72, 72, 1, 38016, 0x6aa267cd
+0, 73, 73, 1, 38016, 0xcb87a00c
+0, 74, 74, 1, 38016, 0x3b8ac17c
+0, 75, 75, 1, 38016, 0x1348bf7b
+0, 76, 76, 1, 38016, 0x1807b42d
+0, 77, 77, 1, 38016, 0x22dfa6cb
+0, 78, 78, 1, 38016, 0x3d23a622
+0, 79, 79, 1, 38016, 0x662cb1e0
+0, 80, 80, 1, 38016, 0x6ecfafaf
+0, 81, 81, 1, 38016, 0xbffcaa71
+0, 82, 82, 1, 38016, 0xf75ab93f
+0, 83, 83, 1, 38016, 0xaea796bf
+0, 84, 84, 1, 38016, 0x4a547fe8
+0, 85, 85, 1, 38016, 0x2f1a800f
+0, 86, 86, 1, 38016, 0xc7788261
+0, 87, 87, 1, 38016, 0x8be17fd3
+0, 88, 88, 1, 38016, 0xe830830c
+0, 89, 89, 1, 38016, 0x62345ab7
+0, 90, 90, 1, 38016, 0x70f926c6
+0, 91, 91, 1, 38016, 0x37e94bf0
+0, 92, 92, 1, 38016, 0xb1509312
+0, 93, 93, 1, 38016, 0xc70fea7a
+0, 94, 94, 1, 38016, 0x8062243b
+0, 95, 95, 1, 38016, 0xe64a48b1
+0, 96, 96, 1, 38016, 0x6f0c4dd7
+0, 97, 97, 1, 38016, 0x5f9c53b4
+0, 98, 98, 1, 38016, 0x4c5e506c
+0, 99, 99, 1, 38016, 0xb7c631ef
+0, 100, 100, 1, 38016, 0x30f302a9
+0, 101, 101, 1, 38016, 0x4f28ebf0
+0, 102, 102, 1, 38016, 0x3145d3d3
+0, 103, 103, 1, 38016, 0x69b6c92f
+0, 104, 104, 1, 38016, 0xa3b2c646
+0, 105, 105, 1, 38016, 0x5ee00dec
+0, 106, 106, 1, 38016, 0x313ee3ea
+0, 107, 107, 1, 38016, 0x4002070e
+0, 108, 108, 1, 38016, 0x5e0106b1
+0, 109, 109, 1, 38016, 0xd03b2c4d
+0, 110, 110, 1, 38016, 0xdd085316
+0, 111, 111, 1, 38016, 0xb47a5f86
+0, 112, 112, 1, 38016, 0xc25d5750
+0, 113, 113, 1, 38016, 0x16ad52b3
+0, 114, 114, 1, 38016, 0xa4fe2754
+0, 115, 115, 1, 38016, 0xac5dfb18
+0, 116, 116, 1, 38016, 0xe36ee83b
+0, 117, 117, 1, 38016, 0xc708e54e
+0, 118, 118, 1, 38016, 0x6c4beb85
+0, 119, 119, 1, 38016, 0xf19fd825
+0, 120, 120, 1, 38016, 0x94e7bb13
+0, 121, 121, 1, 38016, 0x026e9ddf
+0, 122, 122, 1, 38016, 0xdc71a591
+0, 123, 123, 1, 38016, 0xb46eb169
+0, 124, 124, 1, 38016, 0x25f5d5f4
+0, 125, 125, 1, 38016, 0x27da203d
+0, 126, 126, 1, 38016, 0xed217513
+0, 127, 127, 1, 38016, 0x78d7bb08
+0, 128, 128, 1, 38016, 0x623dd66d
+0, 129, 129, 1, 38016, 0xd68c9f82
+0, 130, 130, 1, 38016, 0x88b059e2
+0, 131, 131, 1, 38016, 0x623159aa
+0, 132, 132, 1, 38016, 0x1782245b
+0, 133, 133, 1, 38016, 0x64f55b4a
+0, 134, 134, 1, 38016, 0x83c7d154
+0, 135, 135, 1, 38016, 0x43461c7c
+0, 136, 136, 1, 38016, 0xc3e38c36
+0, 137, 137, 1, 38016, 0x763394b4
+0, 138, 138, 1, 38016, 0xff99749d
+0, 139, 139, 1, 38016, 0x76ca13d0
+0, 140, 140, 1, 38016, 0x29510aea
+0, 141, 141, 1, 38016, 0x385f4309
+0, 142, 142, 1, 38016, 0x142f5339
+0, 143, 143, 1, 38016, 0x980ca66e
+0, 144, 144, 1, 38016, 0xc330c0db
+0, 145, 145, 1, 38016, 0xa7dbca0f
+0, 146, 146, 1, 38016, 0x4261c683
+0, 147, 147, 1, 38016, 0x6d467d81
+0, 148, 148, 1, 38016, 0x1a107d17
+0, 149, 149, 1, 38016, 0xd91e765a
+0, 150, 150, 1, 38016, 0x789cfb94
+0, 151, 151, 1, 38016, 0xc9bc9ee1
+0, 152, 152, 1, 38016, 0x32f8754c
+0, 153, 153, 1, 38016, 0xad906454
+0, 154, 154, 1, 38016, 0xe5d6b78d
+0, 155, 155, 1, 38016, 0x307bc291
+0, 156, 156, 1, 38016, 0x629bdec9
+0, 157, 157, 1, 38016, 0xf23ccd36
+0, 158, 158, 1, 38016, 0x6105aa1b
+0, 159, 159, 1, 38016, 0x3da66383
+0, 160, 160, 1, 38016, 0x48ce2141
+0, 161, 161, 1, 38016, 0x09fac5fd
+0, 162, 162, 1, 38016, 0xa0bc208d
+0, 163, 163, 1, 38016, 0x49892a74
+0, 164, 164, 1, 38016, 0xfcb48093
+0, 165, 165, 1, 38016, 0x850e7e4c
+0, 166, 166, 1, 38016, 0x7cf24f55
+0, 167, 167, 1, 38016, 0x654845f4
+0, 168, 168, 1, 38016, 0x35ac5d63
+0, 169, 169, 1, 38016, 0x795ea726
+0, 170, 170, 1, 38016, 0xf387a03d
+0, 171, 171, 1, 38016, 0x29279e19
+0, 172, 172, 1, 38016, 0x48e3b03d
+0, 173, 173, 1, 38016, 0xbcfb8192
+0, 174, 174, 1, 38016, 0x3fe2749a
+0, 175, 175, 1, 38016, 0xe0a04bbd
+0, 176, 176, 1, 38016, 0x9a912cd7
+0, 177, 177, 1, 38016, 0x39781e59
+0, 178, 178, 1, 38016, 0x90e5131a
+0, 179, 179, 1, 38016, 0x8bd90b4b
+0, 180, 180, 1, 38016, 0x410dda61
+0, 181, 181, 1, 38016, 0x33eb60fd
+0, 182, 182, 1, 38016, 0x08e8632b
+0, 183, 183, 1, 38016, 0x6163fd94
+0, 184, 184, 1, 38016, 0x60af34e1
+0, 185, 185, 1, 38016, 0x00016227
+0, 186, 186, 1, 38016, 0xe6bd71bd
+0, 187, 187, 1, 38016, 0xb40cdf28
+0, 188, 188, 1, 38016, 0x3cdeb88e
+0, 189, 189, 1, 38016, 0xb9ffe0d6
+0, 190, 190, 1, 38016, 0xd630ce53
+0, 191, 191, 1, 38016, 0x120056c2
+0, 192, 192, 1, 38016, 0x0940399e
+0, 193, 193, 1, 38016, 0x3d337fd0
+0, 194, 194, 1, 38016, 0x6ef1f4b9
+0, 195, 195, 1, 38016, 0x7e20f462
+0, 196, 196, 1, 38016, 0xe397f30a
+0, 197, 197, 1, 38016, 0x6eadf916
+0, 198, 198, 1, 38016, 0x850e07b9
+0, 199, 199, 1, 38016, 0x131b10db
+0, 200, 200, 1, 38016, 0x17961d0e
+0, 201, 201, 1, 38016, 0x447557da
+0, 202, 202, 1, 38016, 0x93da7c0e
+0, 203, 203, 1, 38016, 0xd6259239
+0, 204, 204, 1, 38016, 0x2db99d95
+0, 205, 205, 1, 38016, 0x648ea2bd
+0, 206, 206, 1, 38016, 0xf8f46ef6
+0, 207, 207, 1, 38016, 0xb85a7405
+0, 208, 208, 1, 38016, 0x55dc7bbd
+0, 209, 209, 1, 38016, 0xf38d76f8
+0, 210, 210, 1, 38016, 0x9e860b96
+0, 211, 211, 1, 38016, 0x7c5a5da7
+0, 212, 212, 1, 38016, 0xdf36a619
+0, 213, 213, 1, 38016, 0x327d1144
+0, 214, 214, 1, 38016, 0x4a01eabd
+0, 215, 215, 1, 38016, 0xee8b8717
+0, 216, 216, 1, 38016, 0x874eaf23
+0, 217, 217, 1, 38016, 0xddaaaf38
+0, 218, 218, 1, 38016, 0xcab85271
+0, 219, 219, 1, 38016, 0x970f0d3f
+0, 220, 220, 1, 38016, 0x2a042dcc
+0, 221, 221, 1, 38016, 0xa240e0e7
+0, 222, 222, 1, 38016, 0x9564c081
+0, 223, 223, 1, 38016, 0x894d82b4
+0, 224, 224, 1, 38016, 0xb0748d24
+0, 225, 225, 1, 38016, 0xafa56340
+0, 226, 226, 1, 38016, 0x614287c6
+0, 227, 227, 1, 38016, 0x4dfcaaac
+0, 228, 228, 1, 38016, 0x58dab168
+0, 229, 229, 1, 38016, 0x19fbb779
+0, 230, 230, 1, 38016, 0x25adb4c9
+0, 231, 231, 1, 38016, 0x5fc1bdae
+0, 232, 232, 1, 38016, 0x6581a5d0
+0, 233, 233, 1, 38016, 0x81d57061
+0, 234, 234, 1, 38016, 0x43445964
+0, 235, 235, 1, 38016, 0x68224a19
+0, 236, 236, 1, 38016, 0xa85d390a
+0, 237, 237, 1, 38016, 0xb571344d
+0, 238, 238, 1, 38016, 0xd3632bfd
+0, 239, 239, 1, 38016, 0x5af52535
+0, 240, 240, 1, 38016, 0x21b93882
+0, 241, 241, 1, 38016, 0x8da56743
+0, 242, 242, 1, 38016, 0x9e7b9da2
+0, 243, 243, 1, 38016, 0xc1a6bbd9
+0, 244, 244, 1, 38016, 0xd77be9aa
+0, 245, 245, 1, 38016, 0x2715100f
+0, 246, 246, 1, 38016, 0xac8c1e30
+0, 247, 247, 1, 38016, 0x110c14b9
+0, 248, 248, 1, 38016, 0x5a8ff5c4
+0, 249, 249, 1, 38016, 0x25d4ef19
+0, 250, 250, 1, 38016, 0x080ffe7f
+0, 251, 251, 1, 38016, 0x7f5b15ef
+0, 252, 252, 1, 38016, 0xf97f10e1
+0, 253, 253, 1, 38016, 0xdd80f7e5
+0, 254, 254, 1, 38016, 0xb177df60
+0, 255, 255, 1, 38016, 0x406023f6
+0, 256, 256, 1, 38016, 0xf396220f
+0, 257, 257, 1, 38016, 0x50fc2e7a
+0, 258, 258, 1, 38016, 0x959b42da
+0, 259, 259, 1, 38016, 0x61c7484a
+0, 260, 260, 1, 38016, 0x09825cd1
+0, 261, 261, 1, 38016, 0x0e7b6bd9
+0, 262, 262, 1, 38016, 0x4a386b9e
+0, 263, 263, 1, 38016, 0x817b5e14
+0, 264, 264, 1, 38016, 0x51696069
+0, 265, 265, 1, 38016, 0x84a35f51
+0, 266, 266, 1, 38016, 0xf7758da3
+0, 267, 267, 1, 38016, 0x787b6659
+0, 268, 268, 1, 38016, 0xedb95942
+0, 269, 269, 1, 38016, 0x4d4d8eb5
+0, 270, 270, 1, 38016, 0x716cb36a
+0, 271, 271, 1, 38016, 0x6556b912
+0, 272, 272, 1, 38016, 0xbdd8c0b6
+0, 273, 273, 1, 38016, 0xd9ffbba5
+0, 274, 274, 1, 38016, 0xb5d7b4a7
+0, 275, 275, 1, 38016, 0x4690a4ed
+0, 276, 276, 1, 38016, 0x6fc8bdc4
+0, 277, 277, 1, 38016, 0x827de512
+0, 278, 278, 1, 38016, 0x897bfc43
+0, 279, 279, 1, 38016, 0x41f8144a
+0, 280, 280, 1, 38016, 0xff7d369e
+0, 281, 281, 1, 38016, 0x526f48fa
+0, 282, 282, 1, 38016, 0x53245921
+0, 283, 283, 1, 38016, 0x69a3791e
+0, 284, 284, 1, 38016, 0x3de095df
+0, 285, 285, 1, 38016, 0x9ae2a0f2
+0, 286, 286, 1, 38016, 0xd1668593
+0, 287, 287, 1, 38016, 0x322c4f5b
+0, 288, 288, 1, 38016, 0x15882875
+0, 289, 289, 1, 38016, 0xa8886b9a
+0, 290, 290, 1, 38016, 0xc6f07ac1
+0, 291, 291, 1, 38016, 0xf9446d58
+0, 292, 292, 1, 38016, 0x98ef5ffc
+0, 293, 293, 1, 38016, 0x23434b21
+0, 294, 294, 1, 38016, 0xa1f353d2
+0, 295, 295, 1, 38016, 0x6b3d4452
+0, 296, 296, 1, 38016, 0xd4ac32bf
+0, 297, 297, 1, 38016, 0xc577065d
+0, 298, 298, 1, 38016, 0x2d01111d
+0, 299, 299, 1, 38016, 0xf51721d4
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-mr2_tandberg_e b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-mr2_tandberg_e
index f47730f..8fbac9f 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-mr2_tandberg_e
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-mr2_tandberg_e
@@ -1,300 +1,301 @@
-0, 0, 38016, 0xb96f1feb
-0, 3600, 38016, 0xca461abd
-0, 7200, 38016, 0x578a0c87
-0, 10800, 38016, 0xb3cc1ecb
-0, 14400, 38016, 0xd2c84463
-0, 18000, 38016, 0x815d6363
-0, 21600, 38016, 0x7cc17319
-0, 25200, 38016, 0x0f7e8cab
-0, 28800, 38016, 0x1876abee
-0, 32400, 38016, 0x8f25bccd
-0, 36000, 38016, 0xc1c7bb9c
-0, 39600, 38016, 0xf861bdb5
-0, 43200, 38016, 0xae1ac352
-0, 46800, 38016, 0x9b6f990b
-0, 50400, 38016, 0xa5217121
-0, 54000, 38016, 0x12ac8367
-0, 57600, 38016, 0x687f8526
-0, 61200, 38016, 0x9b009a01
-0, 64800, 38016, 0x9c629e04
-0, 68400, 38016, 0xfee5a366
-0, 72000, 38016, 0x264e9b00
-0, 75600, 38016, 0xf89f9508
-0, 79200, 38016, 0x19247145
-0, 82800, 38016, 0xc4cd41bd
-0, 86400, 38016, 0x035c2696
-0, 90000, 38016, 0x22310e7f
-0, 93600, 38016, 0xdd771898
-0, 97200, 38016, 0x61522adf
-0, 100800, 38016, 0x5eee412f
-0, 104400, 38016, 0x03f05077
-0, 108000, 38016, 0x69625001
-0, 111600, 38016, 0x8e025073
-0, 115200, 38016, 0x37374607
-0, 118800, 38016, 0xc90547ea
-0, 122400, 38016, 0xe9eb4193
-0, 126000, 38016, 0xf7214070
-0, 129600, 38016, 0xc3ce38de
-0, 133200, 38016, 0xb99933cb
-0, 136800, 38016, 0x5ee12b39
-0, 140400, 38016, 0x13c921be
-0, 144000, 38016, 0x66341136
-0, 147600, 38016, 0x97710eef
-0, 151200, 38016, 0xe5910c52
-0, 154800, 38016, 0xbf9d0fbb
-0, 158400, 38016, 0x0405177d
-0, 162000, 38016, 0x25ec13da
-0, 165600, 38016, 0xda29f457
-0, 169200, 38016, 0x8e7dbe67
-0, 172800, 38016, 0x64809802
-0, 176400, 38016, 0xbd45731d
-0, 180000, 38016, 0xf9e75c5b
-0, 183600, 38016, 0x4509551e
-0, 187200, 38016, 0xd73b54c9
-0, 190800, 38016, 0x434d430e
-0, 194400, 38016, 0xfbd940fe
-0, 198000, 38016, 0xddb1612a
-0, 201600, 38016, 0xffec797a
-0, 205200, 38016, 0x4355aa0c
-0, 208800, 38016, 0x1776d3e0
-0, 212400, 38016, 0x7a64dd7f
-0, 216000, 38016, 0xe619e56c
-0, 219600, 38016, 0x43b0d8e7
-0, 223200, 38016, 0x2103caf1
-0, 226800, 38016, 0x808fbb8d
-0, 230400, 38016, 0x0654ae1e
-0, 234000, 38016, 0x8b6da03f
-0, 237600, 38016, 0x15ee6b73
-0, 241200, 38016, 0x8ab049c4
-0, 244800, 38016, 0x7c6d351c
-0, 248400, 38016, 0xe3fa3794
-0, 252000, 38016, 0x5b3c581c
-0, 255600, 38016, 0xf07a70e8
-0, 259200, 38016, 0xcc378cb4
-0, 262800, 38016, 0x15f49788
-0, 266400, 38016, 0x23de74b4
-0, 270000, 38016, 0x2e842db6
-0, 273600, 38016, 0xd23cf2b9
-0, 277200, 38016, 0xfbb7cea3
-0, 280800, 38016, 0x05039bf0
-0, 284400, 38016, 0x854d8c6c
-0, 288000, 38016, 0x7d2770d7
-0, 291600, 38016, 0x7e5f6374
-0, 295200, 38016, 0x204753ee
-0, 298800, 38016, 0x66906f4d
-0, 302400, 38016, 0xf6ae700b
-0, 306000, 38016, 0x64438aba
-0, 309600, 38016, 0xc93aa41f
-0, 313200, 38016, 0x27bdbdb7
-0, 316800, 38016, 0x7aceb0a3
-0, 320400, 38016, 0x751d81bd
-0, 324000, 38016, 0xa86e3940
-0, 327600, 38016, 0x9d022dd6
-0, 331200, 38016, 0x0a484d7c
-0, 334800, 38016, 0x6d555adb
-0, 338400, 38016, 0xfe9799e0
-0, 342000, 38016, 0x245ad49b
-0, 345600, 38016, 0x6d22e3e3
-0, 349200, 38016, 0xdffc00df
-0, 352800, 38016, 0x34ec1984
-0, 356400, 38016, 0x15172b1a
-0, 360000, 38016, 0x05d742d8
-0, 363600, 38016, 0xc94350fc
-0, 367200, 38016, 0x3af65a84
-0, 370800, 38016, 0xfbf96492
-0, 374400, 38016, 0x1c8f6e2e
-0, 378000, 38016, 0xe41677dc
-0, 381600, 38016, 0xd36284e1
-0, 385200, 38016, 0xa5f57f14
-0, 388800, 38016, 0x6a7d70f4
-0, 392400, 38016, 0x4c1a584f
-0, 396000, 38016, 0x4f093dd3
-0, 399600, 38016, 0x5a1634b3
-0, 403200, 38016, 0xdd1a29b5
-0, 406800, 38016, 0x28c81aa3
-0, 410400, 38016, 0x681a0e29
-0, 414000, 38016, 0x74110802
-0, 417600, 38016, 0x468afe8a
-0, 421200, 38016, 0xfbb609e0
-0, 424800, 38016, 0x79d60da0
-0, 428400, 38016, 0x0774036d
-0, 432000, 38016, 0x904bf22d
-0, 435600, 38016, 0xddeaedb5
-0, 439200, 38016, 0x5de1d5af
-0, 442800, 38016, 0xb9bad4cf
-0, 446400, 38016, 0x452bcf0e
-0, 450000, 38016, 0x9ab9cca8
-0, 453600, 38016, 0x9b77d6ba
-0, 457200, 38016, 0xb9f5dfaf
-0, 460800, 38016, 0x7b33fac4
-0, 464400, 38016, 0x25e41c67
-0, 468000, 38016, 0x6af749b5
-0, 471600, 38016, 0xe6576d07
-0, 475200, 38016, 0x55a49498
-0, 478800, 38016, 0x3bf4bd93
-0, 482400, 38016, 0xba65cabb
-0, 486000, 38016, 0x0c02de64
-0, 489600, 38016, 0xdb86e742
-0, 493200, 38016, 0x37acdf69
-0, 496800, 38016, 0x8c1ea6be
-0, 500400, 38016, 0x5295739e
-0, 504000, 38016, 0xb2f85eb7
-0, 507600, 38016, 0x17394375
-0, 511200, 38016, 0x8a7f7528
-0, 514800, 38016, 0x17c3e7a5
-0, 518400, 38016, 0xbe1763ef
-0, 522000, 38016, 0x236eab70
-0, 525600, 38016, 0x4b3e9bbb
-0, 529200, 38016, 0xc1d664f9
-0, 532800, 38016, 0xc2300411
-0, 536400, 38016, 0x1cf2903c
-0, 540000, 38016, 0xd8783451
-0, 543600, 38016, 0xf3c8ff31
-0, 547200, 38016, 0xf6dfd324
-0, 550800, 38016, 0x7b93b5d0
-0, 554400, 38016, 0xf246a0f4
-0, 558000, 38016, 0x5e970b10
-0, 561600, 38016, 0xcb98878e
-0, 565200, 38016, 0xc804f169
-0, 568800, 38016, 0x801fec84
-0, 572400, 38016, 0xb242ee41
-0, 576000, 38016, 0xb8a7f3c1
-0, 579600, 38016, 0x24b10420
-0, 583200, 38016, 0x4b7601ab
-0, 586800, 38016, 0x4c30f75a
-0, 590400, 38016, 0x8e8cf5ae
-0, 594000, 38016, 0xd94fefd2
-0, 597600, 38016, 0x31c9c604
-0, 601200, 38016, 0x09d29f6f
-0, 604800, 38016, 0xa55e8075
-0, 608400, 38016, 0x482d53da
-0, 612000, 38016, 0x957e36f1
-0, 615600, 38016, 0xcd261153
-0, 619200, 38016, 0xbf08d284
-0, 622800, 38016, 0x42957a37
-0, 626400, 38016, 0x28b73287
-0, 630000, 38016, 0xe6e33893
-0, 633600, 38016, 0x7f0e3db5
-0, 637200, 38016, 0xb80b46a3
-0, 640800, 38016, 0x1ccca614
-0, 644400, 38016, 0x531e2dfa
-0, 648000, 38016, 0x0d95ef09
-0, 651600, 38016, 0xb631a635
-0, 655200, 38016, 0x4ed86a94
-0, 658800, 38016, 0x919832ab
-0, 662400, 38016, 0x724b60d5
-0, 666000, 38016, 0x9965f58f
-0, 669600, 38016, 0x7b04f567
-0, 673200, 38016, 0x774740d6
-0, 676800, 38016, 0xf8204134
-0, 680400, 38016, 0xcbadfa7a
-0, 684000, 38016, 0x9748728a
-0, 687600, 38016, 0x973047e7
-0, 691200, 38016, 0xcc52aa4d
-0, 694800, 38016, 0x3fa7d81f
-0, 698400, 38016, 0x7a33eddd
-0, 702000, 38016, 0xe51ed885
-0, 705600, 38016, 0xcc93b1a2
-0, 709200, 38016, 0xf70cab47
-0, 712800, 38016, 0x983eb17e
-0, 716400, 38016, 0xdb02d6bb
-0, 720000, 38016, 0xad99c4f9
-0, 723600, 38016, 0xd0e5618c
-0, 727200, 38016, 0x5eb05134
-0, 730800, 38016, 0x4ce0cf23
-0, 734400, 38016, 0x70de3edb
-0, 738000, 38016, 0x3519c858
-0, 741600, 38016, 0x1a4e785f
-0, 745200, 38016, 0x8d09b6ee
-0, 748800, 38016, 0x79b2fd7e
-0, 752400, 38016, 0xcd5aa9a4
-0, 756000, 38016, 0x1e1effd2
-0, 759600, 38016, 0xa1d1b497
-0, 763200, 38016, 0x5c036e34
-0, 766800, 38016, 0x937f152b
-0, 770400, 38016, 0xe434bed9
-0, 774000, 38016, 0x09eb8913
-0, 777600, 38016, 0x4d671935
-0, 781200, 38016, 0x9c62f30c
-0, 784800, 38016, 0x4d080e9c
-0, 788400, 38016, 0x7fe23bb4
-0, 792000, 38016, 0x95399638
-0, 795600, 38016, 0x6aa41ac2
-0, 799200, 38016, 0xe748bc32
-0, 802800, 38016, 0x5fab449b
-0, 806400, 38016, 0x8798bb84
-0, 810000, 38016, 0x4e700879
-0, 813600, 38016, 0x6d794fa4
-0, 817200, 38016, 0xf40c9e13
-0, 820800, 38016, 0x92330fdb
-0, 824400, 38016, 0x558b899a
-0, 828000, 38016, 0xec2320ed
-0, 831600, 38016, 0x3179f275
-0, 835200, 38016, 0x86cfd19d
-0, 838800, 38016, 0x2c88c48a
-0, 842400, 38016, 0x0c84b86f
-0, 846000, 38016, 0x95069c90
-0, 849600, 38016, 0x82da8061
-0, 853200, 38016, 0x847f7634
-0, 856800, 38016, 0x48d46d89
-0, 860400, 38016, 0x220d81f3
-0, 864000, 38016, 0x5cbe9a7e
-0, 867600, 38016, 0xc0e9d5b9
-0, 871200, 38016, 0xcc26ff97
-0, 874800, 38016, 0x01332392
-0, 878400, 38016, 0x44e44439
-0, 882000, 38016, 0xfe8751ee
-0, 885600, 38016, 0x010d74a1
-0, 889200, 38016, 0xbf4a7c2d
-0, 892800, 38016, 0x77869402
-0, 896400, 38016, 0x1ae8b176
-0, 900000, 38016, 0x917cc0b8
-0, 903600, 38016, 0x3eb6d02a
-0, 907200, 38016, 0x815ed568
-0, 910800, 38016, 0xcd6bcd54
-0, 914400, 38016, 0xd3e5bfcd
-0, 918000, 38016, 0x95e2bd36
-0, 921600, 38016, 0x102ca664
-0, 925200, 38016, 0x95c59672
-0, 928800, 38016, 0x1d5b8845
-0, 932400, 38016, 0x3d988a4d
-0, 936000, 38016, 0x4139a121
-0, 939600, 38016, 0x9eeca508
-0, 943200, 38016, 0xf9f2a9cc
-0, 946800, 38016, 0x9420b177
-0, 950400, 38016, 0x13edadd7
-0, 954000, 38016, 0x3d18a416
-0, 957600, 38016, 0x88b09166
-0, 961200, 38016, 0x2e1c939c
-0, 964800, 38016, 0x4f8381c3
-0, 968400, 38016, 0x36647382
-0, 972000, 38016, 0x26a272c1
-0, 975600, 38016, 0x9a5a7cc8
-0, 979200, 38016, 0xc2fc7734
-0, 982800, 38016, 0xd21b7e6c
-0, 986400, 38016, 0x948c77a0
-0, 990000, 38016, 0x179e7d1a
-0, 993600, 38016, 0xbfd17561
-0, 997200, 38016, 0x30f97511
-0, 1000800, 38016, 0x893e6f54
-0, 1004400, 38016, 0x76036ecb
-0, 1008000, 38016, 0x3f0e6966
-0, 1011600, 38016, 0xed946afe
-0, 1015200, 38016, 0x2c2676de
-0, 1018800, 38016, 0x7b348c94
-0, 1022400, 38016, 0x77f5afc8
-0, 1026000, 38016, 0xdb54cea0
-0, 1029600, 38016, 0xc9fed974
-0, 1033200, 38016, 0x04bbe454
-0, 1036800, 38016, 0x7320ffb9
-0, 1040400, 38016, 0x841b199a
-0, 1044000, 38016, 0x7d792ee3
-0, 1047600, 38016, 0x5ce33607
-0, 1051200, 38016, 0xec52432e
-0, 1054800, 38016, 0xe6a04efe
-0, 1058400, 38016, 0xc7b45cef
-0, 1062000, 38016, 0xdbe76bf9
-0, 1065600, 38016, 0xd57f7e18
-0, 1069200, 38016, 0x8e03915d
-0, 1072800, 38016, 0x30779ec6
-0, 1076400, 38016, 0x89b1aa42
+#tb 0: 1/25
+0, 0, 0, 1, 38016, 0xb96f1feb
+0, 1, 1, 1, 38016, 0xca461abd
+0, 2, 2, 1, 38016, 0x578a0c87
+0, 3, 3, 1, 38016, 0xb3cc1ecb
+0, 4, 4, 1, 38016, 0xd2c84463
+0, 5, 5, 1, 38016, 0x815d6363
+0, 6, 6, 1, 38016, 0x7cc17319
+0, 7, 7, 1, 38016, 0x0f7e8cab
+0, 8, 8, 1, 38016, 0x1876abee
+0, 9, 9, 1, 38016, 0x8f25bccd
+0, 10, 10, 1, 38016, 0xc1c7bb9c
+0, 11, 11, 1, 38016, 0xf861bdb5
+0, 12, 12, 1, 38016, 0xae1ac352
+0, 13, 13, 1, 38016, 0x9b6f990b
+0, 14, 14, 1, 38016, 0xa5217121
+0, 15, 15, 1, 38016, 0x12ac8367
+0, 16, 16, 1, 38016, 0x687f8526
+0, 17, 17, 1, 38016, 0x9b009a01
+0, 18, 18, 1, 38016, 0x9c629e04
+0, 19, 19, 1, 38016, 0xfee5a366
+0, 20, 20, 1, 38016, 0x264e9b00
+0, 21, 21, 1, 38016, 0xf89f9508
+0, 22, 22, 1, 38016, 0x19247145
+0, 23, 23, 1, 38016, 0xc4cd41bd
+0, 24, 24, 1, 38016, 0x035c2696
+0, 25, 25, 1, 38016, 0x22310e7f
+0, 26, 26, 1, 38016, 0xdd771898
+0, 27, 27, 1, 38016, 0x61522adf
+0, 28, 28, 1, 38016, 0x5eee412f
+0, 29, 29, 1, 38016, 0x03f05077
+0, 30, 30, 1, 38016, 0x69625001
+0, 31, 31, 1, 38016, 0x8e025073
+0, 32, 32, 1, 38016, 0x37374607
+0, 33, 33, 1, 38016, 0xc90547ea
+0, 34, 34, 1, 38016, 0xe9eb4193
+0, 35, 35, 1, 38016, 0xf7214070
+0, 36, 36, 1, 38016, 0xc3ce38de
+0, 37, 37, 1, 38016, 0xb99933cb
+0, 38, 38, 1, 38016, 0x5ee12b39
+0, 39, 39, 1, 38016, 0x13c921be
+0, 40, 40, 1, 38016, 0x66341136
+0, 41, 41, 1, 38016, 0x97710eef
+0, 42, 42, 1, 38016, 0xe5910c52
+0, 43, 43, 1, 38016, 0xbf9d0fbb
+0, 44, 44, 1, 38016, 0x0405177d
+0, 45, 45, 1, 38016, 0x25ec13da
+0, 46, 46, 1, 38016, 0xda29f457
+0, 47, 47, 1, 38016, 0x8e7dbe67
+0, 48, 48, 1, 38016, 0x64809802
+0, 49, 49, 1, 38016, 0xbd45731d
+0, 50, 50, 1, 38016, 0xf9e75c5b
+0, 51, 51, 1, 38016, 0x4509551e
+0, 52, 52, 1, 38016, 0xd73b54c9
+0, 53, 53, 1, 38016, 0x434d430e
+0, 54, 54, 1, 38016, 0xfbd940fe
+0, 55, 55, 1, 38016, 0xddb1612a
+0, 56, 56, 1, 38016, 0xffec797a
+0, 57, 57, 1, 38016, 0x4355aa0c
+0, 58, 58, 1, 38016, 0x1776d3e0
+0, 59, 59, 1, 38016, 0x7a64dd7f
+0, 60, 60, 1, 38016, 0xe619e56c
+0, 61, 61, 1, 38016, 0x43b0d8e7
+0, 62, 62, 1, 38016, 0x2103caf1
+0, 63, 63, 1, 38016, 0x808fbb8d
+0, 64, 64, 1, 38016, 0x0654ae1e
+0, 65, 65, 1, 38016, 0x8b6da03f
+0, 66, 66, 1, 38016, 0x15ee6b73
+0, 67, 67, 1, 38016, 0x8ab049c4
+0, 68, 68, 1, 38016, 0x7c6d351c
+0, 69, 69, 1, 38016, 0xe3fa3794
+0, 70, 70, 1, 38016, 0x5b3c581c
+0, 71, 71, 1, 38016, 0xf07a70e8
+0, 72, 72, 1, 38016, 0xcc378cb4
+0, 73, 73, 1, 38016, 0x15f49788
+0, 74, 74, 1, 38016, 0x23de74b4
+0, 75, 75, 1, 38016, 0x2e842db6
+0, 76, 76, 1, 38016, 0xd23cf2b9
+0, 77, 77, 1, 38016, 0xfbb7cea3
+0, 78, 78, 1, 38016, 0x05039bf0
+0, 79, 79, 1, 38016, 0x854d8c6c
+0, 80, 80, 1, 38016, 0x7d2770d7
+0, 81, 81, 1, 38016, 0x7e5f6374
+0, 82, 82, 1, 38016, 0x204753ee
+0, 83, 83, 1, 38016, 0x66906f4d
+0, 84, 84, 1, 38016, 0xf6ae700b
+0, 85, 85, 1, 38016, 0x64438aba
+0, 86, 86, 1, 38016, 0xc93aa41f
+0, 87, 87, 1, 38016, 0x27bdbdb7
+0, 88, 88, 1, 38016, 0x7aceb0a3
+0, 89, 89, 1, 38016, 0x751d81bd
+0, 90, 90, 1, 38016, 0xa86e3940
+0, 91, 91, 1, 38016, 0x9d022dd6
+0, 92, 92, 1, 38016, 0x0a484d7c
+0, 93, 93, 1, 38016, 0x6d555adb
+0, 94, 94, 1, 38016, 0xfe9799e0
+0, 95, 95, 1, 38016, 0x245ad49b
+0, 96, 96, 1, 38016, 0x6d22e3e3
+0, 97, 97, 1, 38016, 0xdffc00df
+0, 98, 98, 1, 38016, 0x34ec1984
+0, 99, 99, 1, 38016, 0x15172b1a
+0, 100, 100, 1, 38016, 0x05d742d8
+0, 101, 101, 1, 38016, 0xc94350fc
+0, 102, 102, 1, 38016, 0x3af65a84
+0, 103, 103, 1, 38016, 0xfbf96492
+0, 104, 104, 1, 38016, 0x1c8f6e2e
+0, 105, 105, 1, 38016, 0xe41677dc
+0, 106, 106, 1, 38016, 0xd36284e1
+0, 107, 107, 1, 38016, 0xa5f57f14
+0, 108, 108, 1, 38016, 0x6a7d70f4
+0, 109, 109, 1, 38016, 0x4c1a584f
+0, 110, 110, 1, 38016, 0x4f093dd3
+0, 111, 111, 1, 38016, 0x5a1634b3
+0, 112, 112, 1, 38016, 0xdd1a29b5
+0, 113, 113, 1, 38016, 0x28c81aa3
+0, 114, 114, 1, 38016, 0x681a0e29
+0, 115, 115, 1, 38016, 0x74110802
+0, 116, 116, 1, 38016, 0x468afe8a
+0, 117, 117, 1, 38016, 0xfbb609e0
+0, 118, 118, 1, 38016, 0x79d60da0
+0, 119, 119, 1, 38016, 0x0774036d
+0, 120, 120, 1, 38016, 0x904bf22d
+0, 121, 121, 1, 38016, 0xddeaedb5
+0, 122, 122, 1, 38016, 0x5de1d5af
+0, 123, 123, 1, 38016, 0xb9bad4cf
+0, 124, 124, 1, 38016, 0x452bcf0e
+0, 125, 125, 1, 38016, 0x9ab9cca8
+0, 126, 126, 1, 38016, 0x9b77d6ba
+0, 127, 127, 1, 38016, 0xb9f5dfaf
+0, 128, 128, 1, 38016, 0x7b33fac4
+0, 129, 129, 1, 38016, 0x25e41c67
+0, 130, 130, 1, 38016, 0x6af749b5
+0, 131, 131, 1, 38016, 0xe6576d07
+0, 132, 132, 1, 38016, 0x55a49498
+0, 133, 133, 1, 38016, 0x3bf4bd93
+0, 134, 134, 1, 38016, 0xba65cabb
+0, 135, 135, 1, 38016, 0x0c02de64
+0, 136, 136, 1, 38016, 0xdb86e742
+0, 137, 137, 1, 38016, 0x37acdf69
+0, 138, 138, 1, 38016, 0x8c1ea6be
+0, 139, 139, 1, 38016, 0x5295739e
+0, 140, 140, 1, 38016, 0xb2f85eb7
+0, 141, 141, 1, 38016, 0x17394375
+0, 142, 142, 1, 38016, 0x8a7f7528
+0, 143, 143, 1, 38016, 0x17c3e7a5
+0, 144, 144, 1, 38016, 0xbe1763ef
+0, 145, 145, 1, 38016, 0x236eab70
+0, 146, 146, 1, 38016, 0x4b3e9bbb
+0, 147, 147, 1, 38016, 0xc1d664f9
+0, 148, 148, 1, 38016, 0xc2300411
+0, 149, 149, 1, 38016, 0x1cf2903c
+0, 150, 150, 1, 38016, 0xd8783451
+0, 151, 151, 1, 38016, 0xf3c8ff31
+0, 152, 152, 1, 38016, 0xf6dfd324
+0, 153, 153, 1, 38016, 0x7b93b5d0
+0, 154, 154, 1, 38016, 0xf246a0f4
+0, 155, 155, 1, 38016, 0x5e970b10
+0, 156, 156, 1, 38016, 0xcb98878e
+0, 157, 157, 1, 38016, 0xc804f169
+0, 158, 158, 1, 38016, 0x801fec84
+0, 159, 159, 1, 38016, 0xb242ee41
+0, 160, 160, 1, 38016, 0xb8a7f3c1
+0, 161, 161, 1, 38016, 0x24b10420
+0, 162, 162, 1, 38016, 0x4b7601ab
+0, 163, 163, 1, 38016, 0x4c30f75a
+0, 164, 164, 1, 38016, 0x8e8cf5ae
+0, 165, 165, 1, 38016, 0xd94fefd2
+0, 166, 166, 1, 38016, 0x31c9c604
+0, 167, 167, 1, 38016, 0x09d29f6f
+0, 168, 168, 1, 38016, 0xa55e8075
+0, 169, 169, 1, 38016, 0x482d53da
+0, 170, 170, 1, 38016, 0x957e36f1
+0, 171, 171, 1, 38016, 0xcd261153
+0, 172, 172, 1, 38016, 0xbf08d284
+0, 173, 173, 1, 38016, 0x42957a37
+0, 174, 174, 1, 38016, 0x28b73287
+0, 175, 175, 1, 38016, 0xe6e33893
+0, 176, 176, 1, 38016, 0x7f0e3db5
+0, 177, 177, 1, 38016, 0xb80b46a3
+0, 178, 178, 1, 38016, 0x1ccca614
+0, 179, 179, 1, 38016, 0x531e2dfa
+0, 180, 180, 1, 38016, 0x0d95ef09
+0, 181, 181, 1, 38016, 0xb631a635
+0, 182, 182, 1, 38016, 0x4ed86a94
+0, 183, 183, 1, 38016, 0x919832ab
+0, 184, 184, 1, 38016, 0x724b60d5
+0, 185, 185, 1, 38016, 0x9965f58f
+0, 186, 186, 1, 38016, 0x7b04f567
+0, 187, 187, 1, 38016, 0x774740d6
+0, 188, 188, 1, 38016, 0xf8204134
+0, 189, 189, 1, 38016, 0xcbadfa7a
+0, 190, 190, 1, 38016, 0x9748728a
+0, 191, 191, 1, 38016, 0x973047e7
+0, 192, 192, 1, 38016, 0xcc52aa4d
+0, 193, 193, 1, 38016, 0x3fa7d81f
+0, 194, 194, 1, 38016, 0x7a33eddd
+0, 195, 195, 1, 38016, 0xe51ed885
+0, 196, 196, 1, 38016, 0xcc93b1a2
+0, 197, 197, 1, 38016, 0xf70cab47
+0, 198, 198, 1, 38016, 0x983eb17e
+0, 199, 199, 1, 38016, 0xdb02d6bb
+0, 200, 200, 1, 38016, 0xad99c4f9
+0, 201, 201, 1, 38016, 0xd0e5618c
+0, 202, 202, 1, 38016, 0x5eb05134
+0, 203, 203, 1, 38016, 0x4ce0cf23
+0, 204, 204, 1, 38016, 0x70de3edb
+0, 205, 205, 1, 38016, 0x3519c858
+0, 206, 206, 1, 38016, 0x1a4e785f
+0, 207, 207, 1, 38016, 0x8d09b6ee
+0, 208, 208, 1, 38016, 0x79b2fd7e
+0, 209, 209, 1, 38016, 0xcd5aa9a4
+0, 210, 210, 1, 38016, 0x1e1effd2
+0, 211, 211, 1, 38016, 0xa1d1b497
+0, 212, 212, 1, 38016, 0x5c036e34
+0, 213, 213, 1, 38016, 0x937f152b
+0, 214, 214, 1, 38016, 0xe434bed9
+0, 215, 215, 1, 38016, 0x09eb8913
+0, 216, 216, 1, 38016, 0x4d671935
+0, 217, 217, 1, 38016, 0x9c62f30c
+0, 218, 218, 1, 38016, 0x4d080e9c
+0, 219, 219, 1, 38016, 0x7fe23bb4
+0, 220, 220, 1, 38016, 0x95399638
+0, 221, 221, 1, 38016, 0x6aa41ac2
+0, 222, 222, 1, 38016, 0xe748bc32
+0, 223, 223, 1, 38016, 0x5fab449b
+0, 224, 224, 1, 38016, 0x8798bb84
+0, 225, 225, 1, 38016, 0x4e700879
+0, 226, 226, 1, 38016, 0x6d794fa4
+0, 227, 227, 1, 38016, 0xf40c9e13
+0, 228, 228, 1, 38016, 0x92330fdb
+0, 229, 229, 1, 38016, 0x558b899a
+0, 230, 230, 1, 38016, 0xec2320ed
+0, 231, 231, 1, 38016, 0x3179f275
+0, 232, 232, 1, 38016, 0x86cfd19d
+0, 233, 233, 1, 38016, 0x2c88c48a
+0, 234, 234, 1, 38016, 0x0c84b86f
+0, 235, 235, 1, 38016, 0x95069c90
+0, 236, 236, 1, 38016, 0x82da8061
+0, 237, 237, 1, 38016, 0x847f7634
+0, 238, 238, 1, 38016, 0x48d46d89
+0, 239, 239, 1, 38016, 0x220d81f3
+0, 240, 240, 1, 38016, 0x5cbe9a7e
+0, 241, 241, 1, 38016, 0xc0e9d5b9
+0, 242, 242, 1, 38016, 0xcc26ff97
+0, 243, 243, 1, 38016, 0x01332392
+0, 244, 244, 1, 38016, 0x44e44439
+0, 245, 245, 1, 38016, 0xfe8751ee
+0, 246, 246, 1, 38016, 0x010d74a1
+0, 247, 247, 1, 38016, 0xbf4a7c2d
+0, 248, 248, 1, 38016, 0x77869402
+0, 249, 249, 1, 38016, 0x1ae8b176
+0, 250, 250, 1, 38016, 0x917cc0b8
+0, 251, 251, 1, 38016, 0x3eb6d02a
+0, 252, 252, 1, 38016, 0x815ed568
+0, 253, 253, 1, 38016, 0xcd6bcd54
+0, 254, 254, 1, 38016, 0xd3e5bfcd
+0, 255, 255, 1, 38016, 0x95e2bd36
+0, 256, 256, 1, 38016, 0x102ca664
+0, 257, 257, 1, 38016, 0x95c59672
+0, 258, 258, 1, 38016, 0x1d5b8845
+0, 259, 259, 1, 38016, 0x3d988a4d
+0, 260, 260, 1, 38016, 0x4139a121
+0, 261, 261, 1, 38016, 0x9eeca508
+0, 262, 262, 1, 38016, 0xf9f2a9cc
+0, 263, 263, 1, 38016, 0x9420b177
+0, 264, 264, 1, 38016, 0x13edadd7
+0, 265, 265, 1, 38016, 0x3d18a416
+0, 266, 266, 1, 38016, 0x88b09166
+0, 267, 267, 1, 38016, 0x2e1c939c
+0, 268, 268, 1, 38016, 0x4f8381c3
+0, 269, 269, 1, 38016, 0x36647382
+0, 270, 270, 1, 38016, 0x26a272c1
+0, 271, 271, 1, 38016, 0x9a5a7cc8
+0, 272, 272, 1, 38016, 0xc2fc7734
+0, 273, 273, 1, 38016, 0xd21b7e6c
+0, 274, 274, 1, 38016, 0x948c77a0
+0, 275, 275, 1, 38016, 0x179e7d1a
+0, 276, 276, 1, 38016, 0xbfd17561
+0, 277, 277, 1, 38016, 0x30f97511
+0, 278, 278, 1, 38016, 0x893e6f54
+0, 279, 279, 1, 38016, 0x76036ecb
+0, 280, 280, 1, 38016, 0x3f0e6966
+0, 281, 281, 1, 38016, 0xed946afe
+0, 282, 282, 1, 38016, 0x2c2676de
+0, 283, 283, 1, 38016, 0x7b348c94
+0, 284, 284, 1, 38016, 0x77f5afc8
+0, 285, 285, 1, 38016, 0xdb54cea0
+0, 286, 286, 1, 38016, 0xc9fed974
+0, 287, 287, 1, 38016, 0x04bbe454
+0, 288, 288, 1, 38016, 0x7320ffb9
+0, 289, 289, 1, 38016, 0x841b199a
+0, 290, 290, 1, 38016, 0x7d792ee3
+0, 291, 291, 1, 38016, 0x5ce33607
+0, 292, 292, 1, 38016, 0xec52432e
+0, 293, 293, 1, 38016, 0xe6a04efe
+0, 294, 294, 1, 38016, 0xc7b45cef
+0, 295, 295, 1, 38016, 0xdbe76bf9
+0, 296, 296, 1, 38016, 0xd57f7e18
+0, 297, 297, 1, 38016, 0x8e03915d
+0, 298, 298, 1, 38016, 0x30779ec6
+0, 299, 299, 1, 38016, 0x89b1aa42
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-mr3_tandberg_b b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-mr3_tandberg_b
index ce9813e..ee8014e 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-mr3_tandberg_b
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-mr3_tandberg_b
@@ -1,300 +1,301 @@
-0, 0, 38016, 0xb96f1feb
-0, 3600, 38016, 0xca461abd
-0, 7200, 38016, 0x578a0c87
-0, 10800, 38016, 0xb3cc1ecb
-0, 14400, 38016, 0xd2c84463
-0, 18000, 38016, 0x815d6363
-0, 21600, 38016, 0x7cc17319
-0, 25200, 38016, 0x0f7e8cab
-0, 28800, 38016, 0x1876abee
-0, 32400, 38016, 0xda748c2f
-0, 36000, 38016, 0x7b4dbff0
-0, 39600, 38016, 0xd4a1b24a
-0, 43200, 38016, 0x714cb4cc
-0, 46800, 38016, 0x2c6d80f0
-0, 50400, 38016, 0x92266151
-0, 54000, 38016, 0x6b766a23
-0, 57600, 38016, 0xb24f7efe
-0, 61200, 38016, 0x8410838e
-0, 64800, 38016, 0x67fe872a
-0, 68400, 38016, 0x55b49d36
-0, 72000, 38016, 0x7a1c9c41
-0, 75600, 38016, 0xb4818e0e
-0, 79200, 38016, 0x25f6683c
-0, 82800, 38016, 0xe4d141a4
-0, 86400, 38016, 0x808216ad
-0, 90000, 38016, 0x2acf0baf
-0, 93600, 38016, 0xf3de13c4
-0, 97200, 38016, 0x5f412187
-0, 100800, 38016, 0xb31a340a
-0, 104400, 38016, 0x019d42d1
-0, 108000, 38016, 0xeeb94b9b
-0, 111600, 38016, 0xef55472e
-0, 115200, 38016, 0xdb5e3697
-0, 118800, 38016, 0x8565303e
-0, 122400, 38016, 0x5f9c2c1b
-0, 126000, 38016, 0xeb3d27f4
-0, 129600, 38016, 0x9a43282d
-0, 133200, 38016, 0xe04720c6
-0, 136800, 38016, 0x19cc0eba
-0, 140400, 38016, 0x218efeb6
-0, 144000, 38016, 0x7733f491
-0, 147600, 38016, 0x7f3bede9
-0, 151200, 38016, 0x49c5ec0d
-0, 154800, 38016, 0x803cf19e
-0, 158400, 38016, 0x31de0d3f
-0, 162000, 38016, 0xa7e30426
-0, 165600, 38016, 0xba37f068
-0, 169200, 38016, 0x2842bdf8
-0, 172800, 38016, 0x76df97dc
-0, 176400, 38016, 0xf3246d26
-0, 180000, 38016, 0x0a384d72
-0, 183600, 38016, 0x40964f41
-0, 187200, 38016, 0x46364324
-0, 190800, 38016, 0x7cbf3db4
-0, 194400, 38016, 0x7a223bec
-0, 198000, 38016, 0x458651c1
-0, 201600, 38016, 0xb82d7e3c
-0, 205200, 38016, 0x0f50a55d
-0, 208800, 38016, 0xc306cae4
-0, 212400, 38016, 0x9d6ddfcb
-0, 216000, 38016, 0xb602e8e9
-0, 219600, 38016, 0xbf0ae386
-0, 223200, 38016, 0x0a8bd46e
-0, 226800, 38016, 0xd437c5c1
-0, 230400, 38016, 0xd61d9959
-0, 234000, 38016, 0x70639b56
-0, 237600, 38016, 0x36fd407b
-0, 241200, 38016, 0x58ce3ddd
-0, 244800, 38016, 0x86cc1d8c
-0, 248400, 38016, 0xee422dc2
-0, 252000, 38016, 0xab475639
-0, 255600, 38016, 0xc1327ad8
-0, 259200, 38016, 0x63d196d4
-0, 262800, 38016, 0x1aba8ebd
-0, 266400, 38016, 0x74a269ac
-0, 270000, 38016, 0x267f3563
-0, 273600, 38016, 0xa18ff180
-0, 277200, 38016, 0x70c9c9fd
-0, 280800, 38016, 0xa6c59f9c
-0, 284400, 38016, 0xd7cd8927
-0, 288000, 38016, 0xd30b7345
-0, 291600, 38016, 0x679a4dda
-0, 295200, 38016, 0xeb0562de
-0, 298800, 38016, 0xdd7d6cdb
-0, 302400, 38016, 0xd6e26b73
-0, 306000, 38016, 0xa65a860f
-0, 309600, 38016, 0xae95c71e
-0, 313200, 38016, 0x1a89ca86
-0, 316800, 38016, 0xa33ecee6
-0, 320400, 38016, 0x821da6cb
-0, 324000, 38016, 0xf0e1612f
-0, 327600, 38016, 0x67b8516b
-0, 331200, 38016, 0x62f965bc
-0, 334800, 38016, 0xd1917aa6
-0, 338400, 38016, 0xe72db54d
-0, 342000, 38016, 0x9b64e721
-0, 345600, 38016, 0xa819efda
-0, 349200, 38016, 0xeacfdacb
-0, 352800, 38016, 0x52f235e1
-0, 356400, 38016, 0x2b512cb8
-0, 360000, 38016, 0xaac73fb3
-0, 363600, 38016, 0x7d2d504f
-0, 367200, 38016, 0x396d503a
-0, 370800, 38016, 0x97905235
-0, 374400, 38016, 0xf0056693
-0, 378000, 38016, 0x728a6a9e
-0, 381600, 38016, 0x0eed7824
-0, 385200, 38016, 0x59506237
-0, 388800, 38016, 0xd4304c93
-0, 392400, 38016, 0x7e663ee8
-0, 396000, 38016, 0x0ebc2d11
-0, 399600, 38016, 0x52db2112
-0, 403200, 38016, 0x74aa1815
-0, 406800, 38016, 0x57a60dc6
-0, 410400, 38016, 0x86e9fa32
-0, 414000, 38016, 0x67e8ff09
-0, 417600, 38016, 0x26e8f7ea
-0, 421200, 38016, 0x183dff56
-0, 424800, 38016, 0xa470af8d
-0, 428400, 38016, 0xe017d594
-0, 432000, 38016, 0xb899d48b
-0, 435600, 38016, 0x0d3bc5f7
-0, 439200, 38016, 0xd68bbb0d
-0, 442800, 38016, 0x8bf5b4cb
-0, 446400, 38016, 0x6bfcaa47
-0, 450000, 38016, 0x29a9b01b
-0, 453600, 38016, 0xcdedbdb7
-0, 457200, 38016, 0xdb5ad9c3
-0, 460800, 38016, 0x468aeef6
-0, 464400, 38016, 0xdc2b143e
-0, 468000, 38016, 0x6776277c
-0, 471600, 38016, 0xb78d5294
-0, 475200, 38016, 0x1dfb63ab
-0, 478800, 38016, 0xbd1f99bc
-0, 482400, 38016, 0xde16b89a
-0, 486000, 38016, 0xbf46edca
-0, 489600, 38016, 0x6306e8c4
-0, 493200, 38016, 0x7b09d224
-0, 496800, 38016, 0xfea1aff6
-0, 500400, 38016, 0x183686b0
-0, 504000, 38016, 0x665a61ff
-0, 507600, 38016, 0xc8af42d1
-0, 511200, 38016, 0xe2326bc1
-0, 514800, 38016, 0x56dbde82
-0, 518400, 38016, 0xa0254f97
-0, 522000, 38016, 0x3b74a0b4
-0, 525600, 38016, 0x9aee9b7f
-0, 529200, 38016, 0xd94b6133
-0, 532800, 38016, 0x5819f795
-0, 536400, 38016, 0xc45a8c02
-0, 540000, 38016, 0x2f9204a0
-0, 543600, 38016, 0xbe09e051
-0, 547200, 38016, 0xb542badd
-0, 550800, 38016, 0x23bd9e00
-0, 554400, 38016, 0x4f338d3d
-0, 558000, 38016, 0x8c91e8f3
-0, 561600, 38016, 0xa7347d57
-0, 565200, 38016, 0x6d91de4d
-0, 568800, 38016, 0x3443d936
-0, 572400, 38016, 0x9d25b4e2
-0, 576000, 38016, 0xd93cd4b3
-0, 579600, 38016, 0xa1c9e9a0
-0, 583200, 38016, 0x1482f220
-0, 586800, 38016, 0x1295f270
-0, 590400, 38016, 0x399ae9da
-0, 594000, 38016, 0x85dcdf28
-0, 597600, 38016, 0x4207b9e5
-0, 601200, 38016, 0xad1c9d75
-0, 604800, 38016, 0x4a266c14
-0, 608400, 38016, 0x3afc4508
-0, 612000, 38016, 0x2b1b2385
-0, 615600, 38016, 0x738f005f
-0, 619200, 38016, 0xfec3d833
-0, 622800, 38016, 0x3f7f6ae9
-0, 626400, 38016, 0xd8551823
-0, 630000, 38016, 0x6df03570
-0, 633600, 38016, 0x767c3054
-0, 637200, 38016, 0x89bd342c
-0, 640800, 38016, 0x77ba806c
-0, 644400, 38016, 0x1c98005c
-0, 648000, 38016, 0xa13ce2a3
-0, 651600, 38016, 0x1be59915
-0, 655200, 38016, 0x279c6027
-0, 658800, 38016, 0x96ac11a2
-0, 662400, 38016, 0x3ae95131
-0, 666000, 38016, 0xae19f7fe
-0, 669600, 38016, 0xcde4efe6
-0, 673200, 38016, 0x5ecc3f7a
-0, 676800, 38016, 0x79645152
-0, 680400, 38016, 0x1ee2e89f
-0, 684000, 38016, 0x91d34bb4
-0, 687600, 38016, 0xf019d464
-0, 691200, 38016, 0x8eb07205
-0, 694800, 38016, 0x5399bb5b
-0, 698400, 38016, 0x61f0c77a
-0, 702000, 38016, 0xb2bd8726
-0, 705600, 38016, 0x47b89243
-0, 709200, 38016, 0xebfe4d76
-0, 712800, 38016, 0xe8f87d91
-0, 716400, 38016, 0x5e9fb239
-0, 720000, 38016, 0x357ca1f8
-0, 723600, 38016, 0x757d2e02
-0, 727200, 38016, 0x40672e7c
-0, 730800, 38016, 0xd966abca
-0, 734400, 38016, 0xe98d0d47
-0, 738000, 38016, 0x341babf5
-0, 741600, 38016, 0xd12d5a0c
-0, 745200, 38016, 0xea2f99ab
-0, 748800, 38016, 0x14bce88e
-0, 752400, 38016, 0xe4bda9e8
-0, 756000, 38016, 0x2c57ec89
-0, 759600, 38016, 0x28bbb83e
-0, 763200, 38016, 0xf8444b54
-0, 766800, 38016, 0x3aba03cd
-0, 770400, 38016, 0x373daa20
-0, 774000, 38016, 0x69586597
-0, 777600, 38016, 0xc0c70d53
-0, 781200, 38016, 0x76a5df5a
-0, 784800, 38016, 0x1afde8f0
-0, 788400, 38016, 0x9638285a
-0, 792000, 38016, 0x9f0686c0
-0, 795600, 38016, 0xc65b2238
-0, 799200, 38016, 0x0d61b610
-0, 802800, 38016, 0x78e14e1f
-0, 806400, 38016, 0xcf80ac4a
-0, 810000, 38016, 0xe094083d
-0, 813600, 38016, 0xee5e612e
-0, 817200, 38016, 0x51cdad9d
-0, 820800, 38016, 0xae41100e
-0, 824400, 38016, 0x77558f58
-0, 828000, 38016, 0xb9503b95
-0, 831600, 38016, 0xb71dffeb
-0, 835200, 38016, 0x1872e3e6
-0, 838800, 38016, 0x29c3d252
-0, 842400, 38016, 0x1c77c6ec
-0, 846000, 38016, 0x26feb194
-0, 849600, 38016, 0x3307c3c4
-0, 853200, 38016, 0x8e5a8080
-0, 856800, 38016, 0x933472f7
-0, 860400, 38016, 0xd4768d84
-0, 864000, 38016, 0x3324485f
-0, 867600, 38016, 0xd50af078
-0, 871200, 38016, 0x53820752
-0, 874800, 38016, 0xbe7f1c47
-0, 878400, 38016, 0xe43d3a34
-0, 882000, 38016, 0x57194b82
-0, 885600, 38016, 0x68a052ed
-0, 889200, 38016, 0x5c898052
-0, 892800, 38016, 0x7104a6ad
-0, 896400, 38016, 0x1676b5e8
-0, 900000, 38016, 0xe1cfd375
-0, 903600, 38016, 0x16fede04
-0, 907200, 38016, 0xca49dd4a
-0, 910800, 38016, 0x7b98d9d1
-0, 914400, 38016, 0x4020d210
-0, 918000, 38016, 0x62c5d1e4
-0, 921600, 38016, 0x756abdb4
-0, 925200, 38016, 0x558fb00f
-0, 928800, 38016, 0x4ab0b1f1
-0, 932400, 38016, 0x7c9fb0c2
-0, 936000, 38016, 0xcecfbdd0
-0, 939600, 38016, 0x70e6d174
-0, 943200, 38016, 0x83d7ddde
-0, 946800, 38016, 0xbbcde2d9
-0, 950400, 38016, 0xc89eeaef
-0, 954000, 38016, 0x8565e15c
-0, 957600, 38016, 0x28e0db24
-0, 961200, 38016, 0x1d9dd334
-0, 964800, 38016, 0xce02c452
-0, 968400, 38016, 0xe29dbd0c
-0, 972000, 38016, 0x4aa3b638
-0, 975600, 38016, 0x5533c135
-0, 979200, 38016, 0x6c57b65f
-0, 982800, 38016, 0x23d3b851
-0, 986400, 38016, 0xd8cbb960
-0, 990000, 38016, 0x02edb916
-0, 993600, 38016, 0xa622bd42
-0, 997200, 38016, 0x4ba5be1c
-0, 1000800, 38016, 0xe69bb625
-0, 1004400, 38016, 0xbca5b292
-0, 1008000, 38016, 0xde38b1c8
-0, 1011600, 38016, 0xe9e3b617
-0, 1015200, 38016, 0x216cc574
-0, 1018800, 38016, 0x3780c5ad
-0, 1022400, 38016, 0x5531e3f9
-0, 1026000, 38016, 0xe2c5f5d4
-0, 1029600, 38016, 0x24cefc6e
-0, 1033200, 38016, 0xa3ce003d
-0, 1036800, 38016, 0x42d01c9e
-0, 1040400, 38016, 0xbfc13689
-0, 1044000, 38016, 0x122647a9
-0, 1047600, 38016, 0xe45254da
-0, 1051200, 38016, 0xad955b0c
-0, 1054800, 38016, 0x4b086abb
-0, 1058400, 38016, 0xd4857b8c
-0, 1062000, 38016, 0xa71594ce
-0, 1065600, 38016, 0x04e4a73d
-0, 1069200, 38016, 0x295abf63
-0, 1072800, 38016, 0xbe4ed5dd
-0, 1076400, 38016, 0x087bcf64
+#tb 0: 1/25
+0, 0, 0, 1, 38016, 0xb96f1feb
+0, 1, 1, 1, 38016, 0xca461abd
+0, 2, 2, 1, 38016, 0x578a0c87
+0, 3, 3, 1, 38016, 0xb3cc1ecb
+0, 4, 4, 1, 38016, 0xd2c84463
+0, 5, 5, 1, 38016, 0x815d6363
+0, 6, 6, 1, 38016, 0x7cc17319
+0, 7, 7, 1, 38016, 0x0f7e8cab
+0, 8, 8, 1, 38016, 0x1876abee
+0, 9, 9, 1, 38016, 0xda748c2f
+0, 10, 10, 1, 38016, 0x7b4dbff0
+0, 11, 11, 1, 38016, 0xd4a1b24a
+0, 12, 12, 1, 38016, 0x714cb4cc
+0, 13, 13, 1, 38016, 0x2c6d80f0
+0, 14, 14, 1, 38016, 0x92266151
+0, 15, 15, 1, 38016, 0x6b766a23
+0, 16, 16, 1, 38016, 0xb24f7efe
+0, 17, 17, 1, 38016, 0x8410838e
+0, 18, 18, 1, 38016, 0x67fe872a
+0, 19, 19, 1, 38016, 0x55b49d36
+0, 20, 20, 1, 38016, 0x7a1c9c41
+0, 21, 21, 1, 38016, 0xb4818e0e
+0, 22, 22, 1, 38016, 0x25f6683c
+0, 23, 23, 1, 38016, 0xe4d141a4
+0, 24, 24, 1, 38016, 0x808216ad
+0, 25, 25, 1, 38016, 0x2acf0baf
+0, 26, 26, 1, 38016, 0xf3de13c4
+0, 27, 27, 1, 38016, 0x5f412187
+0, 28, 28, 1, 38016, 0xb31a340a
+0, 29, 29, 1, 38016, 0x019d42d1
+0, 30, 30, 1, 38016, 0xeeb94b9b
+0, 31, 31, 1, 38016, 0xef55472e
+0, 32, 32, 1, 38016, 0xdb5e3697
+0, 33, 33, 1, 38016, 0x8565303e
+0, 34, 34, 1, 38016, 0x5f9c2c1b
+0, 35, 35, 1, 38016, 0xeb3d27f4
+0, 36, 36, 1, 38016, 0x9a43282d
+0, 37, 37, 1, 38016, 0xe04720c6
+0, 38, 38, 1, 38016, 0x19cc0eba
+0, 39, 39, 1, 38016, 0x218efeb6
+0, 40, 40, 1, 38016, 0x7733f491
+0, 41, 41, 1, 38016, 0x7f3bede9
+0, 42, 42, 1, 38016, 0x49c5ec0d
+0, 43, 43, 1, 38016, 0x803cf19e
+0, 44, 44, 1, 38016, 0x31de0d3f
+0, 45, 45, 1, 38016, 0xa7e30426
+0, 46, 46, 1, 38016, 0xba37f068
+0, 47, 47, 1, 38016, 0x2842bdf8
+0, 48, 48, 1, 38016, 0x76df97dc
+0, 49, 49, 1, 38016, 0xf3246d26
+0, 50, 50, 1, 38016, 0x0a384d72
+0, 51, 51, 1, 38016, 0x40964f41
+0, 52, 52, 1, 38016, 0x46364324
+0, 53, 53, 1, 38016, 0x7cbf3db4
+0, 54, 54, 1, 38016, 0x7a223bec
+0, 55, 55, 1, 38016, 0x458651c1
+0, 56, 56, 1, 38016, 0xb82d7e3c
+0, 57, 57, 1, 38016, 0x0f50a55d
+0, 58, 58, 1, 38016, 0xc306cae4
+0, 59, 59, 1, 38016, 0x9d6ddfcb
+0, 60, 60, 1, 38016, 0xb602e8e9
+0, 61, 61, 1, 38016, 0xbf0ae386
+0, 62, 62, 1, 38016, 0x0a8bd46e
+0, 63, 63, 1, 38016, 0xd437c5c1
+0, 64, 64, 1, 38016, 0xd61d9959
+0, 65, 65, 1, 38016, 0x70639b56
+0, 66, 66, 1, 38016, 0x36fd407b
+0, 67, 67, 1, 38016, 0x58ce3ddd
+0, 68, 68, 1, 38016, 0x86cc1d8c
+0, 69, 69, 1, 38016, 0xee422dc2
+0, 70, 70, 1, 38016, 0xab475639
+0, 71, 71, 1, 38016, 0xc1327ad8
+0, 72, 72, 1, 38016, 0x63d196d4
+0, 73, 73, 1, 38016, 0x1aba8ebd
+0, 74, 74, 1, 38016, 0x74a269ac
+0, 75, 75, 1, 38016, 0x267f3563
+0, 76, 76, 1, 38016, 0xa18ff180
+0, 77, 77, 1, 38016, 0x70c9c9fd
+0, 78, 78, 1, 38016, 0xa6c59f9c
+0, 79, 79, 1, 38016, 0xd7cd8927
+0, 80, 80, 1, 38016, 0xd30b7345
+0, 81, 81, 1, 38016, 0x679a4dda
+0, 82, 82, 1, 38016, 0xeb0562de
+0, 83, 83, 1, 38016, 0xdd7d6cdb
+0, 84, 84, 1, 38016, 0xd6e26b73
+0, 85, 85, 1, 38016, 0xa65a860f
+0, 86, 86, 1, 38016, 0xae95c71e
+0, 87, 87, 1, 38016, 0x1a89ca86
+0, 88, 88, 1, 38016, 0xa33ecee6
+0, 89, 89, 1, 38016, 0x821da6cb
+0, 90, 90, 1, 38016, 0xf0e1612f
+0, 91, 91, 1, 38016, 0x67b8516b
+0, 92, 92, 1, 38016, 0x62f965bc
+0, 93, 93, 1, 38016, 0xd1917aa6
+0, 94, 94, 1, 38016, 0xe72db54d
+0, 95, 95, 1, 38016, 0x9b64e721
+0, 96, 96, 1, 38016, 0xa819efda
+0, 97, 97, 1, 38016, 0xeacfdacb
+0, 98, 98, 1, 38016, 0x52f235e1
+0, 99, 99, 1, 38016, 0x2b512cb8
+0, 100, 100, 1, 38016, 0xaac73fb3
+0, 101, 101, 1, 38016, 0x7d2d504f
+0, 102, 102, 1, 38016, 0x396d503a
+0, 103, 103, 1, 38016, 0x97905235
+0, 104, 104, 1, 38016, 0xf0056693
+0, 105, 105, 1, 38016, 0x728a6a9e
+0, 106, 106, 1, 38016, 0x0eed7824
+0, 107, 107, 1, 38016, 0x59506237
+0, 108, 108, 1, 38016, 0xd4304c93
+0, 109, 109, 1, 38016, 0x7e663ee8
+0, 110, 110, 1, 38016, 0x0ebc2d11
+0, 111, 111, 1, 38016, 0x52db2112
+0, 112, 112, 1, 38016, 0x74aa1815
+0, 113, 113, 1, 38016, 0x57a60dc6
+0, 114, 114, 1, 38016, 0x86e9fa32
+0, 115, 115, 1, 38016, 0x67e8ff09
+0, 116, 116, 1, 38016, 0x26e8f7ea
+0, 117, 117, 1, 38016, 0x183dff56
+0, 118, 118, 1, 38016, 0xa470af8d
+0, 119, 119, 1, 38016, 0xe017d594
+0, 120, 120, 1, 38016, 0xb899d48b
+0, 121, 121, 1, 38016, 0x0d3bc5f7
+0, 122, 122, 1, 38016, 0xd68bbb0d
+0, 123, 123, 1, 38016, 0x8bf5b4cb
+0, 124, 124, 1, 38016, 0x6bfcaa47
+0, 125, 125, 1, 38016, 0x29a9b01b
+0, 126, 126, 1, 38016, 0xcdedbdb7
+0, 127, 127, 1, 38016, 0xdb5ad9c3
+0, 128, 128, 1, 38016, 0x468aeef6
+0, 129, 129, 1, 38016, 0xdc2b143e
+0, 130, 130, 1, 38016, 0x6776277c
+0, 131, 131, 1, 38016, 0xb78d5294
+0, 132, 132, 1, 38016, 0x1dfb63ab
+0, 133, 133, 1, 38016, 0xbd1f99bc
+0, 134, 134, 1, 38016, 0xde16b89a
+0, 135, 135, 1, 38016, 0xbf46edca
+0, 136, 136, 1, 38016, 0x6306e8c4
+0, 137, 137, 1, 38016, 0x7b09d224
+0, 138, 138, 1, 38016, 0xfea1aff6
+0, 139, 139, 1, 38016, 0x183686b0
+0, 140, 140, 1, 38016, 0x665a61ff
+0, 141, 141, 1, 38016, 0xc8af42d1
+0, 142, 142, 1, 38016, 0xe2326bc1
+0, 143, 143, 1, 38016, 0x56dbde82
+0, 144, 144, 1, 38016, 0xa0254f97
+0, 145, 145, 1, 38016, 0x3b74a0b4
+0, 146, 146, 1, 38016, 0x9aee9b7f
+0, 147, 147, 1, 38016, 0xd94b6133
+0, 148, 148, 1, 38016, 0x5819f795
+0, 149, 149, 1, 38016, 0xc45a8c02
+0, 150, 150, 1, 38016, 0x2f9204a0
+0, 151, 151, 1, 38016, 0xbe09e051
+0, 152, 152, 1, 38016, 0xb542badd
+0, 153, 153, 1, 38016, 0x23bd9e00
+0, 154, 154, 1, 38016, 0x4f338d3d
+0, 155, 155, 1, 38016, 0x8c91e8f3
+0, 156, 156, 1, 38016, 0xa7347d57
+0, 157, 157, 1, 38016, 0x6d91de4d
+0, 158, 158, 1, 38016, 0x3443d936
+0, 159, 159, 1, 38016, 0x9d25b4e2
+0, 160, 160, 1, 38016, 0xd93cd4b3
+0, 161, 161, 1, 38016, 0xa1c9e9a0
+0, 162, 162, 1, 38016, 0x1482f220
+0, 163, 163, 1, 38016, 0x1295f270
+0, 164, 164, 1, 38016, 0x399ae9da
+0, 165, 165, 1, 38016, 0x85dcdf28
+0, 166, 166, 1, 38016, 0x4207b9e5
+0, 167, 167, 1, 38016, 0xad1c9d75
+0, 168, 168, 1, 38016, 0x4a266c14
+0, 169, 169, 1, 38016, 0x3afc4508
+0, 170, 170, 1, 38016, 0x2b1b2385
+0, 171, 171, 1, 38016, 0x738f005f
+0, 172, 172, 1, 38016, 0xfec3d833
+0, 173, 173, 1, 38016, 0x3f7f6ae9
+0, 174, 174, 1, 38016, 0xd8551823
+0, 175, 175, 1, 38016, 0x6df03570
+0, 176, 176, 1, 38016, 0x767c3054
+0, 177, 177, 1, 38016, 0x89bd342c
+0, 178, 178, 1, 38016, 0x77ba806c
+0, 179, 179, 1, 38016, 0x1c98005c
+0, 180, 180, 1, 38016, 0xa13ce2a3
+0, 181, 181, 1, 38016, 0x1be59915
+0, 182, 182, 1, 38016, 0x279c6027
+0, 183, 183, 1, 38016, 0x96ac11a2
+0, 184, 184, 1, 38016, 0x3ae95131
+0, 185, 185, 1, 38016, 0xae19f7fe
+0, 186, 186, 1, 38016, 0xcde4efe6
+0, 187, 187, 1, 38016, 0x5ecc3f7a
+0, 188, 188, 1, 38016, 0x79645152
+0, 189, 189, 1, 38016, 0x1ee2e89f
+0, 190, 190, 1, 38016, 0x91d34bb4
+0, 191, 191, 1, 38016, 0xf019d464
+0, 192, 192, 1, 38016, 0x8eb07205
+0, 193, 193, 1, 38016, 0x5399bb5b
+0, 194, 194, 1, 38016, 0x61f0c77a
+0, 195, 195, 1, 38016, 0xb2bd8726
+0, 196, 196, 1, 38016, 0x47b89243
+0, 197, 197, 1, 38016, 0xebfe4d76
+0, 198, 198, 1, 38016, 0xe8f87d91
+0, 199, 199, 1, 38016, 0x5e9fb239
+0, 200, 200, 1, 38016, 0x357ca1f8
+0, 201, 201, 1, 38016, 0x757d2e02
+0, 202, 202, 1, 38016, 0x40672e7c
+0, 203, 203, 1, 38016, 0xd966abca
+0, 204, 204, 1, 38016, 0xe98d0d47
+0, 205, 205, 1, 38016, 0x341babf5
+0, 206, 206, 1, 38016, 0xd12d5a0c
+0, 207, 207, 1, 38016, 0xea2f99ab
+0, 208, 208, 1, 38016, 0x14bce88e
+0, 209, 209, 1, 38016, 0xe4bda9e8
+0, 210, 210, 1, 38016, 0x2c57ec89
+0, 211, 211, 1, 38016, 0x28bbb83e
+0, 212, 212, 1, 38016, 0xf8444b54
+0, 213, 213, 1, 38016, 0x3aba03cd
+0, 214, 214, 1, 38016, 0x373daa20
+0, 215, 215, 1, 38016, 0x69586597
+0, 216, 216, 1, 38016, 0xc0c70d53
+0, 217, 217, 1, 38016, 0x76a5df5a
+0, 218, 218, 1, 38016, 0x1afde8f0
+0, 219, 219, 1, 38016, 0x9638285a
+0, 220, 220, 1, 38016, 0x9f0686c0
+0, 221, 221, 1, 38016, 0xc65b2238
+0, 222, 222, 1, 38016, 0x0d61b610
+0, 223, 223, 1, 38016, 0x78e14e1f
+0, 224, 224, 1, 38016, 0xcf80ac4a
+0, 225, 225, 1, 38016, 0xe094083d
+0, 226, 226, 1, 38016, 0xee5e612e
+0, 227, 227, 1, 38016, 0x51cdad9d
+0, 228, 228, 1, 38016, 0xae41100e
+0, 229, 229, 1, 38016, 0x77558f58
+0, 230, 230, 1, 38016, 0xb9503b95
+0, 231, 231, 1, 38016, 0xb71dffeb
+0, 232, 232, 1, 38016, 0x1872e3e6
+0, 233, 233, 1, 38016, 0x29c3d252
+0, 234, 234, 1, 38016, 0x1c77c6ec
+0, 235, 235, 1, 38016, 0x26feb194
+0, 236, 236, 1, 38016, 0x3307c3c4
+0, 237, 237, 1, 38016, 0x8e5a8080
+0, 238, 238, 1, 38016, 0x933472f7
+0, 239, 239, 1, 38016, 0xd4768d84
+0, 240, 240, 1, 38016, 0x3324485f
+0, 241, 241, 1, 38016, 0xd50af078
+0, 242, 242, 1, 38016, 0x53820752
+0, 243, 243, 1, 38016, 0xbe7f1c47
+0, 244, 244, 1, 38016, 0xe43d3a34
+0, 245, 245, 1, 38016, 0x57194b82
+0, 246, 246, 1, 38016, 0x68a052ed
+0, 247, 247, 1, 38016, 0x5c898052
+0, 248, 248, 1, 38016, 0x7104a6ad
+0, 249, 249, 1, 38016, 0x1676b5e8
+0, 250, 250, 1, 38016, 0xe1cfd375
+0, 251, 251, 1, 38016, 0x16fede04
+0, 252, 252, 1, 38016, 0xca49dd4a
+0, 253, 253, 1, 38016, 0x7b98d9d1
+0, 254, 254, 1, 38016, 0x4020d210
+0, 255, 255, 1, 38016, 0x62c5d1e4
+0, 256, 256, 1, 38016, 0x756abdb4
+0, 257, 257, 1, 38016, 0x558fb00f
+0, 258, 258, 1, 38016, 0x4ab0b1f1
+0, 259, 259, 1, 38016, 0x7c9fb0c2
+0, 260, 260, 1, 38016, 0xcecfbdd0
+0, 261, 261, 1, 38016, 0x70e6d174
+0, 262, 262, 1, 38016, 0x83d7ddde
+0, 263, 263, 1, 38016, 0xbbcde2d9
+0, 264, 264, 1, 38016, 0xc89eeaef
+0, 265, 265, 1, 38016, 0x8565e15c
+0, 266, 266, 1, 38016, 0x28e0db24
+0, 267, 267, 1, 38016, 0x1d9dd334
+0, 268, 268, 1, 38016, 0xce02c452
+0, 269, 269, 1, 38016, 0xe29dbd0c
+0, 270, 270, 1, 38016, 0x4aa3b638
+0, 271, 271, 1, 38016, 0x5533c135
+0, 272, 272, 1, 38016, 0x6c57b65f
+0, 273, 273, 1, 38016, 0x23d3b851
+0, 274, 274, 1, 38016, 0xd8cbb960
+0, 275, 275, 1, 38016, 0x02edb916
+0, 276, 276, 1, 38016, 0xa622bd42
+0, 277, 277, 1, 38016, 0x4ba5be1c
+0, 278, 278, 1, 38016, 0xe69bb625
+0, 279, 279, 1, 38016, 0xbca5b292
+0, 280, 280, 1, 38016, 0xde38b1c8
+0, 281, 281, 1, 38016, 0xe9e3b617
+0, 282, 282, 1, 38016, 0x216cc574
+0, 283, 283, 1, 38016, 0x3780c5ad
+0, 284, 284, 1, 38016, 0x5531e3f9
+0, 285, 285, 1, 38016, 0xe2c5f5d4
+0, 286, 286, 1, 38016, 0x24cefc6e
+0, 287, 287, 1, 38016, 0xa3ce003d
+0, 288, 288, 1, 38016, 0x42d01c9e
+0, 289, 289, 1, 38016, 0xbfc13689
+0, 290, 290, 1, 38016, 0x122647a9
+0, 291, 291, 1, 38016, 0xe45254da
+0, 292, 292, 1, 38016, 0xad955b0c
+0, 293, 293, 1, 38016, 0x4b086abb
+0, 294, 294, 1, 38016, 0xd4857b8c
+0, 295, 295, 1, 38016, 0xa71594ce
+0, 296, 296, 1, 38016, 0x04e4a73d
+0, 297, 297, 1, 38016, 0x295abf63
+0, 298, 298, 1, 38016, 0xbe4ed5dd
+0, 299, 299, 1, 38016, 0x087bcf64
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-mr4_tandberg_c b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-mr4_tandberg_c
index 5aceda2..0d5f646 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-mr4_tandberg_c
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-mr4_tandberg_c
@@ -1,300 +1,301 @@
-0, 0, 38016, 0xb96f1feb
-0, 3600, 38016, 0x0ff111f0
-0, 7200, 38016, 0xbac70271
-0, 10800, 38016, 0x8c361866
-0, 14400, 38016, 0x9d9640be
-0, 18000, 38016, 0xd36b563b
-0, 21600, 38016, 0xe5966f5f
-0, 25200, 38016, 0xb8b28ab0
-0, 28800, 38016, 0xf817a3e6
-0, 32400, 38016, 0xba26acd8
-0, 36000, 38016, 0x453dba2f
-0, 39600, 38016, 0xe50bd16e
-0, 43200, 38016, 0x95c2c1f7
-0, 46800, 38016, 0xc6a59679
-0, 50400, 38016, 0x9f468726
-0, 54000, 38016, 0x371091eb
-0, 57600, 38016, 0xd499d26b
-0, 61200, 38016, 0x172fd389
-0, 64800, 38016, 0x3c04de2a
-0, 68400, 38016, 0xa461aed2
-0, 72000, 38016, 0x098cdef2
-0, 75600, 38016, 0x5d8d9c7d
-0, 79200, 38016, 0x087db718
-0, 82800, 38016, 0x064191ef
-0, 86400, 38016, 0x2f842ef5
-0, 90000, 38016, 0x2b5b0e77
-0, 93600, 38016, 0xcc671b7f
-0, 97200, 38016, 0x859f4f75
-0, 100800, 38016, 0x132a7a48
-0, 104400, 38016, 0x6e8987ab
-0, 108000, 38016, 0x02db8591
-0, 111600, 38016, 0x30567d9b
-0, 115200, 38016, 0x92ea3b53
-0, 118800, 38016, 0xae807c6e
-0, 122400, 38016, 0xbfbc7458
-0, 126000, 38016, 0x66294d04
-0, 129600, 38016, 0xdb2a5f10
-0, 133200, 38016, 0xb19112fe
-0, 136800, 38016, 0xdd26490e
-0, 140400, 38016, 0x51cd31de
-0, 144000, 38016, 0xf6cc2dad
-0, 147600, 38016, 0x0c302dfd
-0, 151200, 38016, 0xb846245d
-0, 154800, 38016, 0xd61c2e88
-0, 158400, 38016, 0xf8264117
-0, 162000, 38016, 0x13862a3d
-0, 165600, 38016, 0xfb481750
-0, 169200, 38016, 0x6377e4af
-0, 172800, 38016, 0x1759c1b4
-0, 176400, 38016, 0xca03942b
-0, 180000, 38016, 0x0126810b
-0, 183600, 38016, 0x3c8c820b
-0, 187200, 38016, 0x863379ec
-0, 190800, 38016, 0xaf9b6d52
-0, 194400, 38016, 0x9ba86946
-0, 198000, 38016, 0xf97980fb
-0, 201600, 38016, 0x9cf4785c
-0, 205200, 38016, 0x51cdcdc7
-0, 208800, 38016, 0x923de162
-0, 212400, 38016, 0xdcd3c3cb
-0, 216000, 38016, 0x6f9fea31
-0, 219600, 38016, 0x7ab7b133
-0, 223200, 38016, 0xb8a2c99f
-0, 226800, 38016, 0x040a99c6
-0, 230400, 38016, 0xa8c4b28f
-0, 234000, 38016, 0x4c577509
-0, 237600, 38016, 0xb30f7277
-0, 241200, 38016, 0xb5f73b46
-0, 244800, 38016, 0x723f3ccc
-0, 248400, 38016, 0x3e4a0cca
-0, 252000, 38016, 0xe0df386e
-0, 255600, 38016, 0xc4832c7b
-0, 259200, 38016, 0x014a2d9f
-0, 262800, 38016, 0xae4272d9
-0, 266400, 38016, 0xcde25e0f
-0, 270000, 38016, 0xdecb13d6
-0, 273600, 38016, 0x9d8ae5d9
-0, 277200, 38016, 0x280abccf
-0, 280800, 38016, 0x885a9fcc
-0, 284400, 38016, 0x9b328b6f
-0, 288000, 38016, 0x8fb7663c
-0, 291600, 38016, 0x35fd4c32
-0, 295200, 38016, 0xdd484efb
-0, 298800, 38016, 0xb8f576b1
-0, 302400, 38016, 0xe8016312
-0, 306000, 38016, 0x65a88d55
-0, 309600, 38016, 0x83dca3a9
-0, 313200, 38016, 0xfc3ba542
-0, 316800, 38016, 0x3d55ac26
-0, 320400, 38016, 0xb91f6bbe
-0, 324000, 38016, 0x67bd2f75
-0, 327600, 38016, 0x0af12875
-0, 331200, 38016, 0xc18a2d55
-0, 334800, 38016, 0x22fd4e01
-0, 338400, 38016, 0x466b8dcd
-0, 342000, 38016, 0xfe93c2d9
-0, 345600, 38016, 0x2cc0e638
-0, 349200, 38016, 0xbe550d40
-0, 352800, 38016, 0x65900ffc
-0, 356400, 38016, 0xcc61228c
-0, 360000, 38016, 0x8ae34904
-0, 363600, 38016, 0x74b8411a
-0, 367200, 38016, 0xae36408d
-0, 370800, 38016, 0x251429ad
-0, 374400, 38016, 0x4d8e6dc6
-0, 378000, 38016, 0x9e07801e
-0, 381600, 38016, 0x8fdd83ef
-0, 385200, 38016, 0x976084a1
-0, 388800, 38016, 0x69f7609f
-0, 392400, 38016, 0x48971b09
-0, 396000, 38016, 0x78e63ff4
-0, 399600, 38016, 0x0852365b
-0, 403200, 38016, 0x8044232c
-0, 406800, 38016, 0x9ec3178d
-0, 410400, 38016, 0x6f260955
-0, 414000, 38016, 0x903cfe23
-0, 417600, 38016, 0x441afbe4
-0, 421200, 38016, 0xe4420313
-0, 424800, 38016, 0xf86d0c34
-0, 428400, 38016, 0xafe5f3c3
-0, 432000, 38016, 0x9f61e43b
-0, 435600, 38016, 0x9330e186
-0, 439200, 38016, 0xc900ce86
-0, 442800, 38016, 0xffd6c4a6
-0, 446400, 38016, 0xd7b3cd79
-0, 450000, 38016, 0x8015c914
-0, 453600, 38016, 0x36d3c884
-0, 457200, 38016, 0x2981db44
-0, 460800, 38016, 0x94f40162
-0, 464400, 38016, 0x091022c5
-0, 468000, 38016, 0xd554203f
-0, 471600, 38016, 0xdcf26c7e
-0, 475200, 38016, 0xdc398ff4
-0, 478800, 38016, 0xeb5ca01c
-0, 482400, 38016, 0x4931c311
-0, 486000, 38016, 0x0ddabf2a
-0, 489600, 38016, 0x2432a265
-0, 493200, 38016, 0x65409b4f
-0, 496800, 38016, 0x466e6957
-0, 500400, 38016, 0x82a08bb4
-0, 504000, 38016, 0xdb6a35c4
-0, 507600, 38016, 0xda5b0d28
-0, 511200, 38016, 0x2be76f6d
-0, 514800, 38016, 0x7587a456
-0, 518400, 38016, 0x69994004
-0, 522000, 38016, 0xaefd46ec
-0, 525600, 38016, 0x88094d53
-0, 529200, 38016, 0xfcb82a4c
-0, 532800, 38016, 0x2877c850
-0, 536400, 38016, 0x327f5e88
-0, 540000, 38016, 0xaa1c4a3f
-0, 543600, 38016, 0x1950dfbd
-0, 547200, 38016, 0x8580b472
-0, 550800, 38016, 0xb5ef90c0
-0, 554400, 38016, 0x0906b3e7
-0, 558000, 38016, 0x026b12fa
-0, 561600, 38016, 0xe8ef556a
-0, 565200, 38016, 0x2e1afe7f
-0, 568800, 38016, 0xef2ad28a
-0, 572400, 38016, 0xe6d7d947
-0, 576000, 38016, 0x25ebd549
-0, 579600, 38016, 0xc443f3cf
-0, 583200, 38016, 0x9dc7dcad
-0, 586800, 38016, 0x8b7ce835
-0, 590400, 38016, 0x27a3e48b
-0, 594000, 38016, 0x0b6bc8a9
-0, 597600, 38016, 0xdb98d21e
-0, 601200, 38016, 0x4cb89812
-0, 604800, 38016, 0x41f35c5e
-0, 608400, 38016, 0xfd764d91
-0, 612000, 38016, 0xb7cc313f
-0, 615600, 38016, 0x51ba22d1
-0, 619200, 38016, 0x00d8deee
-0, 622800, 38016, 0x50db806a
-0, 626400, 38016, 0xbf022623
-0, 630000, 38016, 0xf2fe22ba
-0, 633600, 38016, 0x7055191b
-0, 637200, 38016, 0xbefb8590
-0, 640800, 38016, 0x90e59103
-0, 644400, 38016, 0x61d443da
-0, 648000, 38016, 0x6ad0e637
-0, 651600, 38016, 0xda39f9c1
-0, 655200, 38016, 0x03408181
-0, 658800, 38016, 0xee973480
-0, 662400, 38016, 0x9674d65d
-0, 666000, 38016, 0x1fdd5529
-0, 669600, 38016, 0x51a219bb
-0, 673200, 38016, 0x9cd9747e
-0, 676800, 38016, 0xa58a3c33
-0, 680400, 38016, 0xdf1905a9
-0, 684000, 38016, 0x44a52c69
-0, 687600, 38016, 0x0cf6e56b
-0, 691200, 38016, 0xe2115e06
-0, 694800, 38016, 0x15efa840
-0, 698400, 38016, 0x0811bad8
-0, 702000, 38016, 0x8240a91d
-0, 705600, 38016, 0xdfe46b7d
-0, 709200, 38016, 0xcead819a
-0, 712800, 38016, 0xe8f87d91
-0, 716400, 38016, 0x951ebd82
-0, 720000, 38016, 0x37d98ecb
-0, 723600, 38016, 0x54fb54da
-0, 727200, 38016, 0xb306302e
-0, 730800, 38016, 0xa8acd0dc
-0, 734400, 38016, 0x68e43757
-0, 738000, 38016, 0x7018cd48
-0, 741600, 38016, 0x1c34824e
-0, 745200, 38016, 0x22e7e478
-0, 748800, 38016, 0x534a0470
-0, 752400, 38016, 0x1a65bc45
-0, 756000, 38016, 0x5e78223b
-0, 759600, 38016, 0xc3c9c912
-0, 763200, 38016, 0x52557c74
-0, 766800, 38016, 0xf5ff1f9a
-0, 770400, 38016, 0x56afe047
-0, 774000, 38016, 0x50259235
-0, 777600, 38016, 0xca19311d
-0, 781200, 38016, 0xd96eeb53
-0, 784800, 38016, 0x21a218b7
-0, 788400, 38016, 0x24162395
-0, 792000, 38016, 0xadf9b983
-0, 795600, 38016, 0x68443df2
-0, 799200, 38016, 0xa970df8a
-0, 802800, 38016, 0x8381bbee
-0, 806400, 38016, 0x36fe1d22
-0, 810000, 38016, 0xa0326ddf
-0, 813600, 38016, 0x01dc7ca7
-0, 817200, 38016, 0xf485d505
-0, 820800, 38016, 0xb5a8fe68
-0, 824400, 38016, 0x6385f303
-0, 828000, 38016, 0x4d099ef1
-0, 831600, 38016, 0xeaa54d25
-0, 835200, 38016, 0x5c32c503
-0, 838800, 38016, 0xd52538b3
-0, 842400, 38016, 0x1ca2e4c2
-0, 846000, 38016, 0xe3a95b82
-0, 849600, 38016, 0x14393895
-0, 853200, 38016, 0xd77cef50
-0, 856800, 38016, 0x47b901b8
-0, 860400, 38016, 0x14d70226
-0, 864000, 38016, 0xab32b360
-0, 867600, 38016, 0xb92d3090
-0, 871200, 38016, 0xbd50ae43
-0, 874800, 38016, 0x5ea8d59a
-0, 878400, 38016, 0xb6d7fe63
-0, 882000, 38016, 0xe228050d
-0, 885600, 38016, 0x09e251ed
-0, 889200, 38016, 0xcea332d0
-0, 892800, 38016, 0x048838af
-0, 896400, 38016, 0x0a625a93
-0, 900000, 38016, 0x018aa719
-0, 903600, 38016, 0x630e70a8
-0, 907200, 38016, 0x93cb4c39
-0, 910800, 38016, 0x3cdb7cf8
-0, 914400, 38016, 0x48491fb4
-0, 918000, 38016, 0x06aa4101
-0, 921600, 38016, 0x4b402d3e
-0, 925200, 38016, 0x13cbf927
-0, 928800, 38016, 0xdc7528b6
-0, 932400, 38016, 0x652d0576
-0, 936000, 38016, 0xa3a504d6
-0, 939600, 38016, 0x5bd33fe4
-0, 943200, 38016, 0xae11267b
-0, 946800, 38016, 0xb58b5613
-0, 950400, 38016, 0x50160d80
-0, 954000, 38016, 0x4a643ed0
-0, 957600, 38016, 0xe3983ed6
-0, 961200, 38016, 0xa1fb3338
-0, 964800, 38016, 0x48d0286d
-0, 968400, 38016, 0x67043801
-0, 972000, 38016, 0x00bafaad
-0, 975600, 38016, 0xf07de35a
-0, 979200, 38016, 0x493e4579
-0, 982800, 38016, 0xa917532b
-0, 986400, 38016, 0x463fcc89
-0, 990000, 38016, 0xd47c1b1b
-0, 993600, 38016, 0x3543c596
-0, 997200, 38016, 0x65d6cd5b
-0, 1000800, 38016, 0x22cbd5ef
-0, 1004400, 38016, 0x08e0f250
-0, 1008000, 38016, 0x4e4aeb0a
-0, 1011600, 38016, 0x7895e0bd
-0, 1015200, 38016, 0xc11cea95
-0, 1018800, 38016, 0x13b3bcf8
-0, 1022400, 38016, 0xcb312186
-0, 1026000, 38016, 0x791007ca
-0, 1029600, 38016, 0xaa77354f
-0, 1033200, 38016, 0x1dbc2a67
-0, 1036800, 38016, 0x00646a65
-0, 1040400, 38016, 0x19db488d
-0, 1044000, 38016, 0x16c155e5
-0, 1047600, 38016, 0xb760898e
-0, 1051200, 38016, 0xbd6691e8
-0, 1054800, 38016, 0x06829781
-0, 1058400, 38016, 0xcebab8ad
-0, 1062000, 38016, 0xe2f38e79
-0, 1065600, 38016, 0x1e00c08e
-0, 1069200, 38016, 0x86d6c935
-0, 1072800, 38016, 0xaa88dfdc
-0, 1076400, 38016, 0xa9029b45
+#tb 0: 1/25
+0, 0, 0, 1, 38016, 0xb96f1feb
+0, 1, 1, 1, 38016, 0x0ff111f0
+0, 2, 2, 1, 38016, 0xbac70271
+0, 3, 3, 1, 38016, 0x8c361866
+0, 4, 4, 1, 38016, 0x9d9640be
+0, 5, 5, 1, 38016, 0xd36b563b
+0, 6, 6, 1, 38016, 0xe5966f5f
+0, 7, 7, 1, 38016, 0xb8b28ab0
+0, 8, 8, 1, 38016, 0xf817a3e6
+0, 9, 9, 1, 38016, 0xba26acd8
+0, 10, 10, 1, 38016, 0x453dba2f
+0, 11, 11, 1, 38016, 0xe50bd16e
+0, 12, 12, 1, 38016, 0x95c2c1f7
+0, 13, 13, 1, 38016, 0xc6a59679
+0, 14, 14, 1, 38016, 0x9f468726
+0, 15, 15, 1, 38016, 0x371091eb
+0, 16, 16, 1, 38016, 0xd499d26b
+0, 17, 17, 1, 38016, 0x172fd389
+0, 18, 18, 1, 38016, 0x3c04de2a
+0, 19, 19, 1, 38016, 0xa461aed2
+0, 20, 20, 1, 38016, 0x098cdef2
+0, 21, 21, 1, 38016, 0x5d8d9c7d
+0, 22, 22, 1, 38016, 0x087db718
+0, 23, 23, 1, 38016, 0x064191ef
+0, 24, 24, 1, 38016, 0x2f842ef5
+0, 25, 25, 1, 38016, 0x2b5b0e77
+0, 26, 26, 1, 38016, 0xcc671b7f
+0, 27, 27, 1, 38016, 0x859f4f75
+0, 28, 28, 1, 38016, 0x132a7a48
+0, 29, 29, 1, 38016, 0x6e8987ab
+0, 30, 30, 1, 38016, 0x02db8591
+0, 31, 31, 1, 38016, 0x30567d9b
+0, 32, 32, 1, 38016, 0x92ea3b53
+0, 33, 33, 1, 38016, 0xae807c6e
+0, 34, 34, 1, 38016, 0xbfbc7458
+0, 35, 35, 1, 38016, 0x66294d04
+0, 36, 36, 1, 38016, 0xdb2a5f10
+0, 37, 37, 1, 38016, 0xb19112fe
+0, 38, 38, 1, 38016, 0xdd26490e
+0, 39, 39, 1, 38016, 0x51cd31de
+0, 40, 40, 1, 38016, 0xf6cc2dad
+0, 41, 41, 1, 38016, 0x0c302dfd
+0, 42, 42, 1, 38016, 0xb846245d
+0, 43, 43, 1, 38016, 0xd61c2e88
+0, 44, 44, 1, 38016, 0xf8264117
+0, 45, 45, 1, 38016, 0x13862a3d
+0, 46, 46, 1, 38016, 0xfb481750
+0, 47, 47, 1, 38016, 0x6377e4af
+0, 48, 48, 1, 38016, 0x1759c1b4
+0, 49, 49, 1, 38016, 0xca03942b
+0, 50, 50, 1, 38016, 0x0126810b
+0, 51, 51, 1, 38016, 0x3c8c820b
+0, 52, 52, 1, 38016, 0x863379ec
+0, 53, 53, 1, 38016, 0xaf9b6d52
+0, 54, 54, 1, 38016, 0x9ba86946
+0, 55, 55, 1, 38016, 0xf97980fb
+0, 56, 56, 1, 38016, 0x9cf4785c
+0, 57, 57, 1, 38016, 0x51cdcdc7
+0, 58, 58, 1, 38016, 0x923de162
+0, 59, 59, 1, 38016, 0xdcd3c3cb
+0, 60, 60, 1, 38016, 0x6f9fea31
+0, 61, 61, 1, 38016, 0x7ab7b133
+0, 62, 62, 1, 38016, 0xb8a2c99f
+0, 63, 63, 1, 38016, 0x040a99c6
+0, 64, 64, 1, 38016, 0xa8c4b28f
+0, 65, 65, 1, 38016, 0x4c577509
+0, 66, 66, 1, 38016, 0xb30f7277
+0, 67, 67, 1, 38016, 0xb5f73b46
+0, 68, 68, 1, 38016, 0x723f3ccc
+0, 69, 69, 1, 38016, 0x3e4a0cca
+0, 70, 70, 1, 38016, 0xe0df386e
+0, 71, 71, 1, 38016, 0xc4832c7b
+0, 72, 72, 1, 38016, 0x014a2d9f
+0, 73, 73, 1, 38016, 0xae4272d9
+0, 74, 74, 1, 38016, 0xcde25e0f
+0, 75, 75, 1, 38016, 0xdecb13d6
+0, 76, 76, 1, 38016, 0x9d8ae5d9
+0, 77, 77, 1, 38016, 0x280abccf
+0, 78, 78, 1, 38016, 0x885a9fcc
+0, 79, 79, 1, 38016, 0x9b328b6f
+0, 80, 80, 1, 38016, 0x8fb7663c
+0, 81, 81, 1, 38016, 0x35fd4c32
+0, 82, 82, 1, 38016, 0xdd484efb
+0, 83, 83, 1, 38016, 0xb8f576b1
+0, 84, 84, 1, 38016, 0xe8016312
+0, 85, 85, 1, 38016, 0x65a88d55
+0, 86, 86, 1, 38016, 0x83dca3a9
+0, 87, 87, 1, 38016, 0xfc3ba542
+0, 88, 88, 1, 38016, 0x3d55ac26
+0, 89, 89, 1, 38016, 0xb91f6bbe
+0, 90, 90, 1, 38016, 0x67bd2f75
+0, 91, 91, 1, 38016, 0x0af12875
+0, 92, 92, 1, 38016, 0xc18a2d55
+0, 93, 93, 1, 38016, 0x22fd4e01
+0, 94, 94, 1, 38016, 0x466b8dcd
+0, 95, 95, 1, 38016, 0xfe93c2d9
+0, 96, 96, 1, 38016, 0x2cc0e638
+0, 97, 97, 1, 38016, 0xbe550d40
+0, 98, 98, 1, 38016, 0x65900ffc
+0, 99, 99, 1, 38016, 0xcc61228c
+0, 100, 100, 1, 38016, 0x8ae34904
+0, 101, 101, 1, 38016, 0x74b8411a
+0, 102, 102, 1, 38016, 0xae36408d
+0, 103, 103, 1, 38016, 0x251429ad
+0, 104, 104, 1, 38016, 0x4d8e6dc6
+0, 105, 105, 1, 38016, 0x9e07801e
+0, 106, 106, 1, 38016, 0x8fdd83ef
+0, 107, 107, 1, 38016, 0x976084a1
+0, 108, 108, 1, 38016, 0x69f7609f
+0, 109, 109, 1, 38016, 0x48971b09
+0, 110, 110, 1, 38016, 0x78e63ff4
+0, 111, 111, 1, 38016, 0x0852365b
+0, 112, 112, 1, 38016, 0x8044232c
+0, 113, 113, 1, 38016, 0x9ec3178d
+0, 114, 114, 1, 38016, 0x6f260955
+0, 115, 115, 1, 38016, 0x903cfe23
+0, 116, 116, 1, 38016, 0x441afbe4
+0, 117, 117, 1, 38016, 0xe4420313
+0, 118, 118, 1, 38016, 0xf86d0c34
+0, 119, 119, 1, 38016, 0xafe5f3c3
+0, 120, 120, 1, 38016, 0x9f61e43b
+0, 121, 121, 1, 38016, 0x9330e186
+0, 122, 122, 1, 38016, 0xc900ce86
+0, 123, 123, 1, 38016, 0xffd6c4a6
+0, 124, 124, 1, 38016, 0xd7b3cd79
+0, 125, 125, 1, 38016, 0x8015c914
+0, 126, 126, 1, 38016, 0x36d3c884
+0, 127, 127, 1, 38016, 0x2981db44
+0, 128, 128, 1, 38016, 0x94f40162
+0, 129, 129, 1, 38016, 0x091022c5
+0, 130, 130, 1, 38016, 0xd554203f
+0, 131, 131, 1, 38016, 0xdcf26c7e
+0, 132, 132, 1, 38016, 0xdc398ff4
+0, 133, 133, 1, 38016, 0xeb5ca01c
+0, 134, 134, 1, 38016, 0x4931c311
+0, 135, 135, 1, 38016, 0x0ddabf2a
+0, 136, 136, 1, 38016, 0x2432a265
+0, 137, 137, 1, 38016, 0x65409b4f
+0, 138, 138, 1, 38016, 0x466e6957
+0, 139, 139, 1, 38016, 0x82a08bb4
+0, 140, 140, 1, 38016, 0xdb6a35c4
+0, 141, 141, 1, 38016, 0xda5b0d28
+0, 142, 142, 1, 38016, 0x2be76f6d
+0, 143, 143, 1, 38016, 0x7587a456
+0, 144, 144, 1, 38016, 0x69994004
+0, 145, 145, 1, 38016, 0xaefd46ec
+0, 146, 146, 1, 38016, 0x88094d53
+0, 147, 147, 1, 38016, 0xfcb82a4c
+0, 148, 148, 1, 38016, 0x2877c850
+0, 149, 149, 1, 38016, 0x327f5e88
+0, 150, 150, 1, 38016, 0xaa1c4a3f
+0, 151, 151, 1, 38016, 0x1950dfbd
+0, 152, 152, 1, 38016, 0x8580b472
+0, 153, 153, 1, 38016, 0xb5ef90c0
+0, 154, 154, 1, 38016, 0x0906b3e7
+0, 155, 155, 1, 38016, 0x026b12fa
+0, 156, 156, 1, 38016, 0xe8ef556a
+0, 157, 157, 1, 38016, 0x2e1afe7f
+0, 158, 158, 1, 38016, 0xef2ad28a
+0, 159, 159, 1, 38016, 0xe6d7d947
+0, 160, 160, 1, 38016, 0x25ebd549
+0, 161, 161, 1, 38016, 0xc443f3cf
+0, 162, 162, 1, 38016, 0x9dc7dcad
+0, 163, 163, 1, 38016, 0x8b7ce835
+0, 164, 164, 1, 38016, 0x27a3e48b
+0, 165, 165, 1, 38016, 0x0b6bc8a9
+0, 166, 166, 1, 38016, 0xdb98d21e
+0, 167, 167, 1, 38016, 0x4cb89812
+0, 168, 168, 1, 38016, 0x41f35c5e
+0, 169, 169, 1, 38016, 0xfd764d91
+0, 170, 170, 1, 38016, 0xb7cc313f
+0, 171, 171, 1, 38016, 0x51ba22d1
+0, 172, 172, 1, 38016, 0x00d8deee
+0, 173, 173, 1, 38016, 0x50db806a
+0, 174, 174, 1, 38016, 0xbf022623
+0, 175, 175, 1, 38016, 0xf2fe22ba
+0, 176, 176, 1, 38016, 0x7055191b
+0, 177, 177, 1, 38016, 0xbefb8590
+0, 178, 178, 1, 38016, 0x90e59103
+0, 179, 179, 1, 38016, 0x61d443da
+0, 180, 180, 1, 38016, 0x6ad0e637
+0, 181, 181, 1, 38016, 0xda39f9c1
+0, 182, 182, 1, 38016, 0x03408181
+0, 183, 183, 1, 38016, 0xee973480
+0, 184, 184, 1, 38016, 0x9674d65d
+0, 185, 185, 1, 38016, 0x1fdd5529
+0, 186, 186, 1, 38016, 0x51a219bb
+0, 187, 187, 1, 38016, 0x9cd9747e
+0, 188, 188, 1, 38016, 0xa58a3c33
+0, 189, 189, 1, 38016, 0xdf1905a9
+0, 190, 190, 1, 38016, 0x44a52c69
+0, 191, 191, 1, 38016, 0x0cf6e56b
+0, 192, 192, 1, 38016, 0xe2115e06
+0, 193, 193, 1, 38016, 0x15efa840
+0, 194, 194, 1, 38016, 0x0811bad8
+0, 195, 195, 1, 38016, 0x8240a91d
+0, 196, 196, 1, 38016, 0xdfe46b7d
+0, 197, 197, 1, 38016, 0xcead819a
+0, 198, 198, 1, 38016, 0xe8f87d91
+0, 199, 199, 1, 38016, 0x951ebd82
+0, 200, 200, 1, 38016, 0x37d98ecb
+0, 201, 201, 1, 38016, 0x54fb54da
+0, 202, 202, 1, 38016, 0xb306302e
+0, 203, 203, 1, 38016, 0xa8acd0dc
+0, 204, 204, 1, 38016, 0x68e43757
+0, 205, 205, 1, 38016, 0x7018cd48
+0, 206, 206, 1, 38016, 0x1c34824e
+0, 207, 207, 1, 38016, 0x22e7e478
+0, 208, 208, 1, 38016, 0x534a0470
+0, 209, 209, 1, 38016, 0x1a65bc45
+0, 210, 210, 1, 38016, 0x5e78223b
+0, 211, 211, 1, 38016, 0xc3c9c912
+0, 212, 212, 1, 38016, 0x52557c74
+0, 213, 213, 1, 38016, 0xf5ff1f9a
+0, 214, 214, 1, 38016, 0x56afe047
+0, 215, 215, 1, 38016, 0x50259235
+0, 216, 216, 1, 38016, 0xca19311d
+0, 217, 217, 1, 38016, 0xd96eeb53
+0, 218, 218, 1, 38016, 0x21a218b7
+0, 219, 219, 1, 38016, 0x24162395
+0, 220, 220, 1, 38016, 0xadf9b983
+0, 221, 221, 1, 38016, 0x68443df2
+0, 222, 222, 1, 38016, 0xa970df8a
+0, 223, 223, 1, 38016, 0x8381bbee
+0, 224, 224, 1, 38016, 0x36fe1d22
+0, 225, 225, 1, 38016, 0xa0326ddf
+0, 226, 226, 1, 38016, 0x01dc7ca7
+0, 227, 227, 1, 38016, 0xf485d505
+0, 228, 228, 1, 38016, 0xb5a8fe68
+0, 229, 229, 1, 38016, 0x6385f303
+0, 230, 230, 1, 38016, 0x4d099ef1
+0, 231, 231, 1, 38016, 0xeaa54d25
+0, 232, 232, 1, 38016, 0x5c32c503
+0, 233, 233, 1, 38016, 0xd52538b3
+0, 234, 234, 1, 38016, 0x1ca2e4c2
+0, 235, 235, 1, 38016, 0xe3a95b82
+0, 236, 236, 1, 38016, 0x14393895
+0, 237, 237, 1, 38016, 0xd77cef50
+0, 238, 238, 1, 38016, 0x47b901b8
+0, 239, 239, 1, 38016, 0x14d70226
+0, 240, 240, 1, 38016, 0xab32b360
+0, 241, 241, 1, 38016, 0xb92d3090
+0, 242, 242, 1, 38016, 0xbd50ae43
+0, 243, 243, 1, 38016, 0x5ea8d59a
+0, 244, 244, 1, 38016, 0xb6d7fe63
+0, 245, 245, 1, 38016, 0xe228050d
+0, 246, 246, 1, 38016, 0x09e251ed
+0, 247, 247, 1, 38016, 0xcea332d0
+0, 248, 248, 1, 38016, 0x048838af
+0, 249, 249, 1, 38016, 0x0a625a93
+0, 250, 250, 1, 38016, 0x018aa719
+0, 251, 251, 1, 38016, 0x630e70a8
+0, 252, 252, 1, 38016, 0x93cb4c39
+0, 253, 253, 1, 38016, 0x3cdb7cf8
+0, 254, 254, 1, 38016, 0x48491fb4
+0, 255, 255, 1, 38016, 0x06aa4101
+0, 256, 256, 1, 38016, 0x4b402d3e
+0, 257, 257, 1, 38016, 0x13cbf927
+0, 258, 258, 1, 38016, 0xdc7528b6
+0, 259, 259, 1, 38016, 0x652d0576
+0, 260, 260, 1, 38016, 0xa3a504d6
+0, 261, 261, 1, 38016, 0x5bd33fe4
+0, 262, 262, 1, 38016, 0xae11267b
+0, 263, 263, 1, 38016, 0xb58b5613
+0, 264, 264, 1, 38016, 0x50160d80
+0, 265, 265, 1, 38016, 0x4a643ed0
+0, 266, 266, 1, 38016, 0xe3983ed6
+0, 267, 267, 1, 38016, 0xa1fb3338
+0, 268, 268, 1, 38016, 0x48d0286d
+0, 269, 269, 1, 38016, 0x67043801
+0, 270, 270, 1, 38016, 0x00bafaad
+0, 271, 271, 1, 38016, 0xf07de35a
+0, 272, 272, 1, 38016, 0x493e4579
+0, 273, 273, 1, 38016, 0xa917532b
+0, 274, 274, 1, 38016, 0x463fcc89
+0, 275, 275, 1, 38016, 0xd47c1b1b
+0, 276, 276, 1, 38016, 0x3543c596
+0, 277, 277, 1, 38016, 0x65d6cd5b
+0, 278, 278, 1, 38016, 0x22cbd5ef
+0, 279, 279, 1, 38016, 0x08e0f250
+0, 280, 280, 1, 38016, 0x4e4aeb0a
+0, 281, 281, 1, 38016, 0x7895e0bd
+0, 282, 282, 1, 38016, 0xc11cea95
+0, 283, 283, 1, 38016, 0x13b3bcf8
+0, 284, 284, 1, 38016, 0xcb312186
+0, 285, 285, 1, 38016, 0x791007ca
+0, 286, 286, 1, 38016, 0xaa77354f
+0, 287, 287, 1, 38016, 0x1dbc2a67
+0, 288, 288, 1, 38016, 0x00646a65
+0, 289, 289, 1, 38016, 0x19db488d
+0, 290, 290, 1, 38016, 0x16c155e5
+0, 291, 291, 1, 38016, 0xb760898e
+0, 292, 292, 1, 38016, 0xbd6691e8
+0, 293, 293, 1, 38016, 0x06829781
+0, 294, 294, 1, 38016, 0xcebab8ad
+0, 295, 295, 1, 38016, 0xe2f38e79
+0, 296, 296, 1, 38016, 0x1e00c08e
+0, 297, 297, 1, 38016, 0x86d6c935
+0, 298, 298, 1, 38016, 0xaa88dfdc
+0, 299, 299, 1, 38016, 0xa9029b45
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-mr5_tandberg_c b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-mr5_tandberg_c
index 5aceda2..0d5f646 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-mr5_tandberg_c
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-mr5_tandberg_c
@@ -1,300 +1,301 @@
-0, 0, 38016, 0xb96f1feb
-0, 3600, 38016, 0x0ff111f0
-0, 7200, 38016, 0xbac70271
-0, 10800, 38016, 0x8c361866
-0, 14400, 38016, 0x9d9640be
-0, 18000, 38016, 0xd36b563b
-0, 21600, 38016, 0xe5966f5f
-0, 25200, 38016, 0xb8b28ab0
-0, 28800, 38016, 0xf817a3e6
-0, 32400, 38016, 0xba26acd8
-0, 36000, 38016, 0x453dba2f
-0, 39600, 38016, 0xe50bd16e
-0, 43200, 38016, 0x95c2c1f7
-0, 46800, 38016, 0xc6a59679
-0, 50400, 38016, 0x9f468726
-0, 54000, 38016, 0x371091eb
-0, 57600, 38016, 0xd499d26b
-0, 61200, 38016, 0x172fd389
-0, 64800, 38016, 0x3c04de2a
-0, 68400, 38016, 0xa461aed2
-0, 72000, 38016, 0x098cdef2
-0, 75600, 38016, 0x5d8d9c7d
-0, 79200, 38016, 0x087db718
-0, 82800, 38016, 0x064191ef
-0, 86400, 38016, 0x2f842ef5
-0, 90000, 38016, 0x2b5b0e77
-0, 93600, 38016, 0xcc671b7f
-0, 97200, 38016, 0x859f4f75
-0, 100800, 38016, 0x132a7a48
-0, 104400, 38016, 0x6e8987ab
-0, 108000, 38016, 0x02db8591
-0, 111600, 38016, 0x30567d9b
-0, 115200, 38016, 0x92ea3b53
-0, 118800, 38016, 0xae807c6e
-0, 122400, 38016, 0xbfbc7458
-0, 126000, 38016, 0x66294d04
-0, 129600, 38016, 0xdb2a5f10
-0, 133200, 38016, 0xb19112fe
-0, 136800, 38016, 0xdd26490e
-0, 140400, 38016, 0x51cd31de
-0, 144000, 38016, 0xf6cc2dad
-0, 147600, 38016, 0x0c302dfd
-0, 151200, 38016, 0xb846245d
-0, 154800, 38016, 0xd61c2e88
-0, 158400, 38016, 0xf8264117
-0, 162000, 38016, 0x13862a3d
-0, 165600, 38016, 0xfb481750
-0, 169200, 38016, 0x6377e4af
-0, 172800, 38016, 0x1759c1b4
-0, 176400, 38016, 0xca03942b
-0, 180000, 38016, 0x0126810b
-0, 183600, 38016, 0x3c8c820b
-0, 187200, 38016, 0x863379ec
-0, 190800, 38016, 0xaf9b6d52
-0, 194400, 38016, 0x9ba86946
-0, 198000, 38016, 0xf97980fb
-0, 201600, 38016, 0x9cf4785c
-0, 205200, 38016, 0x51cdcdc7
-0, 208800, 38016, 0x923de162
-0, 212400, 38016, 0xdcd3c3cb
-0, 216000, 38016, 0x6f9fea31
-0, 219600, 38016, 0x7ab7b133
-0, 223200, 38016, 0xb8a2c99f
-0, 226800, 38016, 0x040a99c6
-0, 230400, 38016, 0xa8c4b28f
-0, 234000, 38016, 0x4c577509
-0, 237600, 38016, 0xb30f7277
-0, 241200, 38016, 0xb5f73b46
-0, 244800, 38016, 0x723f3ccc
-0, 248400, 38016, 0x3e4a0cca
-0, 252000, 38016, 0xe0df386e
-0, 255600, 38016, 0xc4832c7b
-0, 259200, 38016, 0x014a2d9f
-0, 262800, 38016, 0xae4272d9
-0, 266400, 38016, 0xcde25e0f
-0, 270000, 38016, 0xdecb13d6
-0, 273600, 38016, 0x9d8ae5d9
-0, 277200, 38016, 0x280abccf
-0, 280800, 38016, 0x885a9fcc
-0, 284400, 38016, 0x9b328b6f
-0, 288000, 38016, 0x8fb7663c
-0, 291600, 38016, 0x35fd4c32
-0, 295200, 38016, 0xdd484efb
-0, 298800, 38016, 0xb8f576b1
-0, 302400, 38016, 0xe8016312
-0, 306000, 38016, 0x65a88d55
-0, 309600, 38016, 0x83dca3a9
-0, 313200, 38016, 0xfc3ba542
-0, 316800, 38016, 0x3d55ac26
-0, 320400, 38016, 0xb91f6bbe
-0, 324000, 38016, 0x67bd2f75
-0, 327600, 38016, 0x0af12875
-0, 331200, 38016, 0xc18a2d55
-0, 334800, 38016, 0x22fd4e01
-0, 338400, 38016, 0x466b8dcd
-0, 342000, 38016, 0xfe93c2d9
-0, 345600, 38016, 0x2cc0e638
-0, 349200, 38016, 0xbe550d40
-0, 352800, 38016, 0x65900ffc
-0, 356400, 38016, 0xcc61228c
-0, 360000, 38016, 0x8ae34904
-0, 363600, 38016, 0x74b8411a
-0, 367200, 38016, 0xae36408d
-0, 370800, 38016, 0x251429ad
-0, 374400, 38016, 0x4d8e6dc6
-0, 378000, 38016, 0x9e07801e
-0, 381600, 38016, 0x8fdd83ef
-0, 385200, 38016, 0x976084a1
-0, 388800, 38016, 0x69f7609f
-0, 392400, 38016, 0x48971b09
-0, 396000, 38016, 0x78e63ff4
-0, 399600, 38016, 0x0852365b
-0, 403200, 38016, 0x8044232c
-0, 406800, 38016, 0x9ec3178d
-0, 410400, 38016, 0x6f260955
-0, 414000, 38016, 0x903cfe23
-0, 417600, 38016, 0x441afbe4
-0, 421200, 38016, 0xe4420313
-0, 424800, 38016, 0xf86d0c34
-0, 428400, 38016, 0xafe5f3c3
-0, 432000, 38016, 0x9f61e43b
-0, 435600, 38016, 0x9330e186
-0, 439200, 38016, 0xc900ce86
-0, 442800, 38016, 0xffd6c4a6
-0, 446400, 38016, 0xd7b3cd79
-0, 450000, 38016, 0x8015c914
-0, 453600, 38016, 0x36d3c884
-0, 457200, 38016, 0x2981db44
-0, 460800, 38016, 0x94f40162
-0, 464400, 38016, 0x091022c5
-0, 468000, 38016, 0xd554203f
-0, 471600, 38016, 0xdcf26c7e
-0, 475200, 38016, 0xdc398ff4
-0, 478800, 38016, 0xeb5ca01c
-0, 482400, 38016, 0x4931c311
-0, 486000, 38016, 0x0ddabf2a
-0, 489600, 38016, 0x2432a265
-0, 493200, 38016, 0x65409b4f
-0, 496800, 38016, 0x466e6957
-0, 500400, 38016, 0x82a08bb4
-0, 504000, 38016, 0xdb6a35c4
-0, 507600, 38016, 0xda5b0d28
-0, 511200, 38016, 0x2be76f6d
-0, 514800, 38016, 0x7587a456
-0, 518400, 38016, 0x69994004
-0, 522000, 38016, 0xaefd46ec
-0, 525600, 38016, 0x88094d53
-0, 529200, 38016, 0xfcb82a4c
-0, 532800, 38016, 0x2877c850
-0, 536400, 38016, 0x327f5e88
-0, 540000, 38016, 0xaa1c4a3f
-0, 543600, 38016, 0x1950dfbd
-0, 547200, 38016, 0x8580b472
-0, 550800, 38016, 0xb5ef90c0
-0, 554400, 38016, 0x0906b3e7
-0, 558000, 38016, 0x026b12fa
-0, 561600, 38016, 0xe8ef556a
-0, 565200, 38016, 0x2e1afe7f
-0, 568800, 38016, 0xef2ad28a
-0, 572400, 38016, 0xe6d7d947
-0, 576000, 38016, 0x25ebd549
-0, 579600, 38016, 0xc443f3cf
-0, 583200, 38016, 0x9dc7dcad
-0, 586800, 38016, 0x8b7ce835
-0, 590400, 38016, 0x27a3e48b
-0, 594000, 38016, 0x0b6bc8a9
-0, 597600, 38016, 0xdb98d21e
-0, 601200, 38016, 0x4cb89812
-0, 604800, 38016, 0x41f35c5e
-0, 608400, 38016, 0xfd764d91
-0, 612000, 38016, 0xb7cc313f
-0, 615600, 38016, 0x51ba22d1
-0, 619200, 38016, 0x00d8deee
-0, 622800, 38016, 0x50db806a
-0, 626400, 38016, 0xbf022623
-0, 630000, 38016, 0xf2fe22ba
-0, 633600, 38016, 0x7055191b
-0, 637200, 38016, 0xbefb8590
-0, 640800, 38016, 0x90e59103
-0, 644400, 38016, 0x61d443da
-0, 648000, 38016, 0x6ad0e637
-0, 651600, 38016, 0xda39f9c1
-0, 655200, 38016, 0x03408181
-0, 658800, 38016, 0xee973480
-0, 662400, 38016, 0x9674d65d
-0, 666000, 38016, 0x1fdd5529
-0, 669600, 38016, 0x51a219bb
-0, 673200, 38016, 0x9cd9747e
-0, 676800, 38016, 0xa58a3c33
-0, 680400, 38016, 0xdf1905a9
-0, 684000, 38016, 0x44a52c69
-0, 687600, 38016, 0x0cf6e56b
-0, 691200, 38016, 0xe2115e06
-0, 694800, 38016, 0x15efa840
-0, 698400, 38016, 0x0811bad8
-0, 702000, 38016, 0x8240a91d
-0, 705600, 38016, 0xdfe46b7d
-0, 709200, 38016, 0xcead819a
-0, 712800, 38016, 0xe8f87d91
-0, 716400, 38016, 0x951ebd82
-0, 720000, 38016, 0x37d98ecb
-0, 723600, 38016, 0x54fb54da
-0, 727200, 38016, 0xb306302e
-0, 730800, 38016, 0xa8acd0dc
-0, 734400, 38016, 0x68e43757
-0, 738000, 38016, 0x7018cd48
-0, 741600, 38016, 0x1c34824e
-0, 745200, 38016, 0x22e7e478
-0, 748800, 38016, 0x534a0470
-0, 752400, 38016, 0x1a65bc45
-0, 756000, 38016, 0x5e78223b
-0, 759600, 38016, 0xc3c9c912
-0, 763200, 38016, 0x52557c74
-0, 766800, 38016, 0xf5ff1f9a
-0, 770400, 38016, 0x56afe047
-0, 774000, 38016, 0x50259235
-0, 777600, 38016, 0xca19311d
-0, 781200, 38016, 0xd96eeb53
-0, 784800, 38016, 0x21a218b7
-0, 788400, 38016, 0x24162395
-0, 792000, 38016, 0xadf9b983
-0, 795600, 38016, 0x68443df2
-0, 799200, 38016, 0xa970df8a
-0, 802800, 38016, 0x8381bbee
-0, 806400, 38016, 0x36fe1d22
-0, 810000, 38016, 0xa0326ddf
-0, 813600, 38016, 0x01dc7ca7
-0, 817200, 38016, 0xf485d505
-0, 820800, 38016, 0xb5a8fe68
-0, 824400, 38016, 0x6385f303
-0, 828000, 38016, 0x4d099ef1
-0, 831600, 38016, 0xeaa54d25
-0, 835200, 38016, 0x5c32c503
-0, 838800, 38016, 0xd52538b3
-0, 842400, 38016, 0x1ca2e4c2
-0, 846000, 38016, 0xe3a95b82
-0, 849600, 38016, 0x14393895
-0, 853200, 38016, 0xd77cef50
-0, 856800, 38016, 0x47b901b8
-0, 860400, 38016, 0x14d70226
-0, 864000, 38016, 0xab32b360
-0, 867600, 38016, 0xb92d3090
-0, 871200, 38016, 0xbd50ae43
-0, 874800, 38016, 0x5ea8d59a
-0, 878400, 38016, 0xb6d7fe63
-0, 882000, 38016, 0xe228050d
-0, 885600, 38016, 0x09e251ed
-0, 889200, 38016, 0xcea332d0
-0, 892800, 38016, 0x048838af
-0, 896400, 38016, 0x0a625a93
-0, 900000, 38016, 0x018aa719
-0, 903600, 38016, 0x630e70a8
-0, 907200, 38016, 0x93cb4c39
-0, 910800, 38016, 0x3cdb7cf8
-0, 914400, 38016, 0x48491fb4
-0, 918000, 38016, 0x06aa4101
-0, 921600, 38016, 0x4b402d3e
-0, 925200, 38016, 0x13cbf927
-0, 928800, 38016, 0xdc7528b6
-0, 932400, 38016, 0x652d0576
-0, 936000, 38016, 0xa3a504d6
-0, 939600, 38016, 0x5bd33fe4
-0, 943200, 38016, 0xae11267b
-0, 946800, 38016, 0xb58b5613
-0, 950400, 38016, 0x50160d80
-0, 954000, 38016, 0x4a643ed0
-0, 957600, 38016, 0xe3983ed6
-0, 961200, 38016, 0xa1fb3338
-0, 964800, 38016, 0x48d0286d
-0, 968400, 38016, 0x67043801
-0, 972000, 38016, 0x00bafaad
-0, 975600, 38016, 0xf07de35a
-0, 979200, 38016, 0x493e4579
-0, 982800, 38016, 0xa917532b
-0, 986400, 38016, 0x463fcc89
-0, 990000, 38016, 0xd47c1b1b
-0, 993600, 38016, 0x3543c596
-0, 997200, 38016, 0x65d6cd5b
-0, 1000800, 38016, 0x22cbd5ef
-0, 1004400, 38016, 0x08e0f250
-0, 1008000, 38016, 0x4e4aeb0a
-0, 1011600, 38016, 0x7895e0bd
-0, 1015200, 38016, 0xc11cea95
-0, 1018800, 38016, 0x13b3bcf8
-0, 1022400, 38016, 0xcb312186
-0, 1026000, 38016, 0x791007ca
-0, 1029600, 38016, 0xaa77354f
-0, 1033200, 38016, 0x1dbc2a67
-0, 1036800, 38016, 0x00646a65
-0, 1040400, 38016, 0x19db488d
-0, 1044000, 38016, 0x16c155e5
-0, 1047600, 38016, 0xb760898e
-0, 1051200, 38016, 0xbd6691e8
-0, 1054800, 38016, 0x06829781
-0, 1058400, 38016, 0xcebab8ad
-0, 1062000, 38016, 0xe2f38e79
-0, 1065600, 38016, 0x1e00c08e
-0, 1069200, 38016, 0x86d6c935
-0, 1072800, 38016, 0xaa88dfdc
-0, 1076400, 38016, 0xa9029b45
+#tb 0: 1/25
+0, 0, 0, 1, 38016, 0xb96f1feb
+0, 1, 1, 1, 38016, 0x0ff111f0
+0, 2, 2, 1, 38016, 0xbac70271
+0, 3, 3, 1, 38016, 0x8c361866
+0, 4, 4, 1, 38016, 0x9d9640be
+0, 5, 5, 1, 38016, 0xd36b563b
+0, 6, 6, 1, 38016, 0xe5966f5f
+0, 7, 7, 1, 38016, 0xb8b28ab0
+0, 8, 8, 1, 38016, 0xf817a3e6
+0, 9, 9, 1, 38016, 0xba26acd8
+0, 10, 10, 1, 38016, 0x453dba2f
+0, 11, 11, 1, 38016, 0xe50bd16e
+0, 12, 12, 1, 38016, 0x95c2c1f7
+0, 13, 13, 1, 38016, 0xc6a59679
+0, 14, 14, 1, 38016, 0x9f468726
+0, 15, 15, 1, 38016, 0x371091eb
+0, 16, 16, 1, 38016, 0xd499d26b
+0, 17, 17, 1, 38016, 0x172fd389
+0, 18, 18, 1, 38016, 0x3c04de2a
+0, 19, 19, 1, 38016, 0xa461aed2
+0, 20, 20, 1, 38016, 0x098cdef2
+0, 21, 21, 1, 38016, 0x5d8d9c7d
+0, 22, 22, 1, 38016, 0x087db718
+0, 23, 23, 1, 38016, 0x064191ef
+0, 24, 24, 1, 38016, 0x2f842ef5
+0, 25, 25, 1, 38016, 0x2b5b0e77
+0, 26, 26, 1, 38016, 0xcc671b7f
+0, 27, 27, 1, 38016, 0x859f4f75
+0, 28, 28, 1, 38016, 0x132a7a48
+0, 29, 29, 1, 38016, 0x6e8987ab
+0, 30, 30, 1, 38016, 0x02db8591
+0, 31, 31, 1, 38016, 0x30567d9b
+0, 32, 32, 1, 38016, 0x92ea3b53
+0, 33, 33, 1, 38016, 0xae807c6e
+0, 34, 34, 1, 38016, 0xbfbc7458
+0, 35, 35, 1, 38016, 0x66294d04
+0, 36, 36, 1, 38016, 0xdb2a5f10
+0, 37, 37, 1, 38016, 0xb19112fe
+0, 38, 38, 1, 38016, 0xdd26490e
+0, 39, 39, 1, 38016, 0x51cd31de
+0, 40, 40, 1, 38016, 0xf6cc2dad
+0, 41, 41, 1, 38016, 0x0c302dfd
+0, 42, 42, 1, 38016, 0xb846245d
+0, 43, 43, 1, 38016, 0xd61c2e88
+0, 44, 44, 1, 38016, 0xf8264117
+0, 45, 45, 1, 38016, 0x13862a3d
+0, 46, 46, 1, 38016, 0xfb481750
+0, 47, 47, 1, 38016, 0x6377e4af
+0, 48, 48, 1, 38016, 0x1759c1b4
+0, 49, 49, 1, 38016, 0xca03942b
+0, 50, 50, 1, 38016, 0x0126810b
+0, 51, 51, 1, 38016, 0x3c8c820b
+0, 52, 52, 1, 38016, 0x863379ec
+0, 53, 53, 1, 38016, 0xaf9b6d52
+0, 54, 54, 1, 38016, 0x9ba86946
+0, 55, 55, 1, 38016, 0xf97980fb
+0, 56, 56, 1, 38016, 0x9cf4785c
+0, 57, 57, 1, 38016, 0x51cdcdc7
+0, 58, 58, 1, 38016, 0x923de162
+0, 59, 59, 1, 38016, 0xdcd3c3cb
+0, 60, 60, 1, 38016, 0x6f9fea31
+0, 61, 61, 1, 38016, 0x7ab7b133
+0, 62, 62, 1, 38016, 0xb8a2c99f
+0, 63, 63, 1, 38016, 0x040a99c6
+0, 64, 64, 1, 38016, 0xa8c4b28f
+0, 65, 65, 1, 38016, 0x4c577509
+0, 66, 66, 1, 38016, 0xb30f7277
+0, 67, 67, 1, 38016, 0xb5f73b46
+0, 68, 68, 1, 38016, 0x723f3ccc
+0, 69, 69, 1, 38016, 0x3e4a0cca
+0, 70, 70, 1, 38016, 0xe0df386e
+0, 71, 71, 1, 38016, 0xc4832c7b
+0, 72, 72, 1, 38016, 0x014a2d9f
+0, 73, 73, 1, 38016, 0xae4272d9
+0, 74, 74, 1, 38016, 0xcde25e0f
+0, 75, 75, 1, 38016, 0xdecb13d6
+0, 76, 76, 1, 38016, 0x9d8ae5d9
+0, 77, 77, 1, 38016, 0x280abccf
+0, 78, 78, 1, 38016, 0x885a9fcc
+0, 79, 79, 1, 38016, 0x9b328b6f
+0, 80, 80, 1, 38016, 0x8fb7663c
+0, 81, 81, 1, 38016, 0x35fd4c32
+0, 82, 82, 1, 38016, 0xdd484efb
+0, 83, 83, 1, 38016, 0xb8f576b1
+0, 84, 84, 1, 38016, 0xe8016312
+0, 85, 85, 1, 38016, 0x65a88d55
+0, 86, 86, 1, 38016, 0x83dca3a9
+0, 87, 87, 1, 38016, 0xfc3ba542
+0, 88, 88, 1, 38016, 0x3d55ac26
+0, 89, 89, 1, 38016, 0xb91f6bbe
+0, 90, 90, 1, 38016, 0x67bd2f75
+0, 91, 91, 1, 38016, 0x0af12875
+0, 92, 92, 1, 38016, 0xc18a2d55
+0, 93, 93, 1, 38016, 0x22fd4e01
+0, 94, 94, 1, 38016, 0x466b8dcd
+0, 95, 95, 1, 38016, 0xfe93c2d9
+0, 96, 96, 1, 38016, 0x2cc0e638
+0, 97, 97, 1, 38016, 0xbe550d40
+0, 98, 98, 1, 38016, 0x65900ffc
+0, 99, 99, 1, 38016, 0xcc61228c
+0, 100, 100, 1, 38016, 0x8ae34904
+0, 101, 101, 1, 38016, 0x74b8411a
+0, 102, 102, 1, 38016, 0xae36408d
+0, 103, 103, 1, 38016, 0x251429ad
+0, 104, 104, 1, 38016, 0x4d8e6dc6
+0, 105, 105, 1, 38016, 0x9e07801e
+0, 106, 106, 1, 38016, 0x8fdd83ef
+0, 107, 107, 1, 38016, 0x976084a1
+0, 108, 108, 1, 38016, 0x69f7609f
+0, 109, 109, 1, 38016, 0x48971b09
+0, 110, 110, 1, 38016, 0x78e63ff4
+0, 111, 111, 1, 38016, 0x0852365b
+0, 112, 112, 1, 38016, 0x8044232c
+0, 113, 113, 1, 38016, 0x9ec3178d
+0, 114, 114, 1, 38016, 0x6f260955
+0, 115, 115, 1, 38016, 0x903cfe23
+0, 116, 116, 1, 38016, 0x441afbe4
+0, 117, 117, 1, 38016, 0xe4420313
+0, 118, 118, 1, 38016, 0xf86d0c34
+0, 119, 119, 1, 38016, 0xafe5f3c3
+0, 120, 120, 1, 38016, 0x9f61e43b
+0, 121, 121, 1, 38016, 0x9330e186
+0, 122, 122, 1, 38016, 0xc900ce86
+0, 123, 123, 1, 38016, 0xffd6c4a6
+0, 124, 124, 1, 38016, 0xd7b3cd79
+0, 125, 125, 1, 38016, 0x8015c914
+0, 126, 126, 1, 38016, 0x36d3c884
+0, 127, 127, 1, 38016, 0x2981db44
+0, 128, 128, 1, 38016, 0x94f40162
+0, 129, 129, 1, 38016, 0x091022c5
+0, 130, 130, 1, 38016, 0xd554203f
+0, 131, 131, 1, 38016, 0xdcf26c7e
+0, 132, 132, 1, 38016, 0xdc398ff4
+0, 133, 133, 1, 38016, 0xeb5ca01c
+0, 134, 134, 1, 38016, 0x4931c311
+0, 135, 135, 1, 38016, 0x0ddabf2a
+0, 136, 136, 1, 38016, 0x2432a265
+0, 137, 137, 1, 38016, 0x65409b4f
+0, 138, 138, 1, 38016, 0x466e6957
+0, 139, 139, 1, 38016, 0x82a08bb4
+0, 140, 140, 1, 38016, 0xdb6a35c4
+0, 141, 141, 1, 38016, 0xda5b0d28
+0, 142, 142, 1, 38016, 0x2be76f6d
+0, 143, 143, 1, 38016, 0x7587a456
+0, 144, 144, 1, 38016, 0x69994004
+0, 145, 145, 1, 38016, 0xaefd46ec
+0, 146, 146, 1, 38016, 0x88094d53
+0, 147, 147, 1, 38016, 0xfcb82a4c
+0, 148, 148, 1, 38016, 0x2877c850
+0, 149, 149, 1, 38016, 0x327f5e88
+0, 150, 150, 1, 38016, 0xaa1c4a3f
+0, 151, 151, 1, 38016, 0x1950dfbd
+0, 152, 152, 1, 38016, 0x8580b472
+0, 153, 153, 1, 38016, 0xb5ef90c0
+0, 154, 154, 1, 38016, 0x0906b3e7
+0, 155, 155, 1, 38016, 0x026b12fa
+0, 156, 156, 1, 38016, 0xe8ef556a
+0, 157, 157, 1, 38016, 0x2e1afe7f
+0, 158, 158, 1, 38016, 0xef2ad28a
+0, 159, 159, 1, 38016, 0xe6d7d947
+0, 160, 160, 1, 38016, 0x25ebd549
+0, 161, 161, 1, 38016, 0xc443f3cf
+0, 162, 162, 1, 38016, 0x9dc7dcad
+0, 163, 163, 1, 38016, 0x8b7ce835
+0, 164, 164, 1, 38016, 0x27a3e48b
+0, 165, 165, 1, 38016, 0x0b6bc8a9
+0, 166, 166, 1, 38016, 0xdb98d21e
+0, 167, 167, 1, 38016, 0x4cb89812
+0, 168, 168, 1, 38016, 0x41f35c5e
+0, 169, 169, 1, 38016, 0xfd764d91
+0, 170, 170, 1, 38016, 0xb7cc313f
+0, 171, 171, 1, 38016, 0x51ba22d1
+0, 172, 172, 1, 38016, 0x00d8deee
+0, 173, 173, 1, 38016, 0x50db806a
+0, 174, 174, 1, 38016, 0xbf022623
+0, 175, 175, 1, 38016, 0xf2fe22ba
+0, 176, 176, 1, 38016, 0x7055191b
+0, 177, 177, 1, 38016, 0xbefb8590
+0, 178, 178, 1, 38016, 0x90e59103
+0, 179, 179, 1, 38016, 0x61d443da
+0, 180, 180, 1, 38016, 0x6ad0e637
+0, 181, 181, 1, 38016, 0xda39f9c1
+0, 182, 182, 1, 38016, 0x03408181
+0, 183, 183, 1, 38016, 0xee973480
+0, 184, 184, 1, 38016, 0x9674d65d
+0, 185, 185, 1, 38016, 0x1fdd5529
+0, 186, 186, 1, 38016, 0x51a219bb
+0, 187, 187, 1, 38016, 0x9cd9747e
+0, 188, 188, 1, 38016, 0xa58a3c33
+0, 189, 189, 1, 38016, 0xdf1905a9
+0, 190, 190, 1, 38016, 0x44a52c69
+0, 191, 191, 1, 38016, 0x0cf6e56b
+0, 192, 192, 1, 38016, 0xe2115e06
+0, 193, 193, 1, 38016, 0x15efa840
+0, 194, 194, 1, 38016, 0x0811bad8
+0, 195, 195, 1, 38016, 0x8240a91d
+0, 196, 196, 1, 38016, 0xdfe46b7d
+0, 197, 197, 1, 38016, 0xcead819a
+0, 198, 198, 1, 38016, 0xe8f87d91
+0, 199, 199, 1, 38016, 0x951ebd82
+0, 200, 200, 1, 38016, 0x37d98ecb
+0, 201, 201, 1, 38016, 0x54fb54da
+0, 202, 202, 1, 38016, 0xb306302e
+0, 203, 203, 1, 38016, 0xa8acd0dc
+0, 204, 204, 1, 38016, 0x68e43757
+0, 205, 205, 1, 38016, 0x7018cd48
+0, 206, 206, 1, 38016, 0x1c34824e
+0, 207, 207, 1, 38016, 0x22e7e478
+0, 208, 208, 1, 38016, 0x534a0470
+0, 209, 209, 1, 38016, 0x1a65bc45
+0, 210, 210, 1, 38016, 0x5e78223b
+0, 211, 211, 1, 38016, 0xc3c9c912
+0, 212, 212, 1, 38016, 0x52557c74
+0, 213, 213, 1, 38016, 0xf5ff1f9a
+0, 214, 214, 1, 38016, 0x56afe047
+0, 215, 215, 1, 38016, 0x50259235
+0, 216, 216, 1, 38016, 0xca19311d
+0, 217, 217, 1, 38016, 0xd96eeb53
+0, 218, 218, 1, 38016, 0x21a218b7
+0, 219, 219, 1, 38016, 0x24162395
+0, 220, 220, 1, 38016, 0xadf9b983
+0, 221, 221, 1, 38016, 0x68443df2
+0, 222, 222, 1, 38016, 0xa970df8a
+0, 223, 223, 1, 38016, 0x8381bbee
+0, 224, 224, 1, 38016, 0x36fe1d22
+0, 225, 225, 1, 38016, 0xa0326ddf
+0, 226, 226, 1, 38016, 0x01dc7ca7
+0, 227, 227, 1, 38016, 0xf485d505
+0, 228, 228, 1, 38016, 0xb5a8fe68
+0, 229, 229, 1, 38016, 0x6385f303
+0, 230, 230, 1, 38016, 0x4d099ef1
+0, 231, 231, 1, 38016, 0xeaa54d25
+0, 232, 232, 1, 38016, 0x5c32c503
+0, 233, 233, 1, 38016, 0xd52538b3
+0, 234, 234, 1, 38016, 0x1ca2e4c2
+0, 235, 235, 1, 38016, 0xe3a95b82
+0, 236, 236, 1, 38016, 0x14393895
+0, 237, 237, 1, 38016, 0xd77cef50
+0, 238, 238, 1, 38016, 0x47b901b8
+0, 239, 239, 1, 38016, 0x14d70226
+0, 240, 240, 1, 38016, 0xab32b360
+0, 241, 241, 1, 38016, 0xb92d3090
+0, 242, 242, 1, 38016, 0xbd50ae43
+0, 243, 243, 1, 38016, 0x5ea8d59a
+0, 244, 244, 1, 38016, 0xb6d7fe63
+0, 245, 245, 1, 38016, 0xe228050d
+0, 246, 246, 1, 38016, 0x09e251ed
+0, 247, 247, 1, 38016, 0xcea332d0
+0, 248, 248, 1, 38016, 0x048838af
+0, 249, 249, 1, 38016, 0x0a625a93
+0, 250, 250, 1, 38016, 0x018aa719
+0, 251, 251, 1, 38016, 0x630e70a8
+0, 252, 252, 1, 38016, 0x93cb4c39
+0, 253, 253, 1, 38016, 0x3cdb7cf8
+0, 254, 254, 1, 38016, 0x48491fb4
+0, 255, 255, 1, 38016, 0x06aa4101
+0, 256, 256, 1, 38016, 0x4b402d3e
+0, 257, 257, 1, 38016, 0x13cbf927
+0, 258, 258, 1, 38016, 0xdc7528b6
+0, 259, 259, 1, 38016, 0x652d0576
+0, 260, 260, 1, 38016, 0xa3a504d6
+0, 261, 261, 1, 38016, 0x5bd33fe4
+0, 262, 262, 1, 38016, 0xae11267b
+0, 263, 263, 1, 38016, 0xb58b5613
+0, 264, 264, 1, 38016, 0x50160d80
+0, 265, 265, 1, 38016, 0x4a643ed0
+0, 266, 266, 1, 38016, 0xe3983ed6
+0, 267, 267, 1, 38016, 0xa1fb3338
+0, 268, 268, 1, 38016, 0x48d0286d
+0, 269, 269, 1, 38016, 0x67043801
+0, 270, 270, 1, 38016, 0x00bafaad
+0, 271, 271, 1, 38016, 0xf07de35a
+0, 272, 272, 1, 38016, 0x493e4579
+0, 273, 273, 1, 38016, 0xa917532b
+0, 274, 274, 1, 38016, 0x463fcc89
+0, 275, 275, 1, 38016, 0xd47c1b1b
+0, 276, 276, 1, 38016, 0x3543c596
+0, 277, 277, 1, 38016, 0x65d6cd5b
+0, 278, 278, 1, 38016, 0x22cbd5ef
+0, 279, 279, 1, 38016, 0x08e0f250
+0, 280, 280, 1, 38016, 0x4e4aeb0a
+0, 281, 281, 1, 38016, 0x7895e0bd
+0, 282, 282, 1, 38016, 0xc11cea95
+0, 283, 283, 1, 38016, 0x13b3bcf8
+0, 284, 284, 1, 38016, 0xcb312186
+0, 285, 285, 1, 38016, 0x791007ca
+0, 286, 286, 1, 38016, 0xaa77354f
+0, 287, 287, 1, 38016, 0x1dbc2a67
+0, 288, 288, 1, 38016, 0x00646a65
+0, 289, 289, 1, 38016, 0x19db488d
+0, 290, 290, 1, 38016, 0x16c155e5
+0, 291, 291, 1, 38016, 0xb760898e
+0, 292, 292, 1, 38016, 0xbd6691e8
+0, 293, 293, 1, 38016, 0x06829781
+0, 294, 294, 1, 38016, 0xcebab8ad
+0, 295, 295, 1, 38016, 0xe2f38e79
+0, 296, 296, 1, 38016, 0x1e00c08e
+0, 297, 297, 1, 38016, 0x86d6c935
+0, 298, 298, 1, 38016, 0xaa88dfdc
+0, 299, 299, 1, 38016, 0xa9029b45
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-mr6_bt_b b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-mr6_bt_b
index 8deff75..3b02506 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-mr6_bt_b
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-mr6_bt_b
@@ -1,60 +1,61 @@
-0, 0, 36864, 0x954464be
-0, 3600, 36864, 0xace1d90b
-0, 7200, 36864, 0x8f149f03
-0, 10800, 36864, 0xea9b21eb
-0, 14400, 36864, 0xb51d9fe3
-0, 18000, 36864, 0x61bd11d7
-0, 21600, 36864, 0x9d36980f
-0, 25200, 36864, 0xa4192c5e
-0, 28800, 36864, 0x11006433
-0, 32400, 36864, 0x4a243e46
-0, 36000, 36864, 0x1807b5e8
-0, 39600, 36864, 0xbe37743c
-0, 43200, 36864, 0x82491319
-0, 46800, 36864, 0x006e9914
-0, 50400, 36864, 0xa5261884
-0, 54000, 36864, 0x2030c9d6
-0, 57600, 36864, 0xc80eb1ce
-0, 61200, 36864, 0x4d559791
-0, 64800, 36864, 0xf5f900ee
-0, 68400, 36864, 0x2cc9c0d7
-0, 72000, 36864, 0x5ba14186
-0, 75600, 36864, 0x47a46865
-0, 79200, 36864, 0x5ba180b7
-0, 82800, 36864, 0xc67c4876
-0, 86400, 36864, 0x4311d75d
-0, 90000, 36864, 0x56edb851
-0, 93600, 36864, 0x7e5aa3e0
-0, 97200, 36864, 0x8df8283a
-0, 100800, 36864, 0xb8583ddf
-0, 104400, 36864, 0xf33fb779
-0, 108000, 36864, 0xe9942ddc
-0, 111600, 36864, 0x2bc5f7fa
-0, 115200, 36864, 0xc7b66c65
-0, 118800, 36864, 0x1a524319
-0, 122400, 36864, 0xf60c6141
-0, 126000, 36864, 0x113f41f2
-0, 129600, 36864, 0xad191a31
-0, 133200, 36864, 0x3898264a
-0, 136800, 36864, 0x3c2f34a4
-0, 140400, 36864, 0xd0fc76aa
-0, 144000, 36864, 0x2870b546
-0, 147600, 36864, 0x7d326fb4
-0, 151200, 36864, 0xd7ed14e1
-0, 154800, 36864, 0x205174aa
-0, 158400, 36864, 0xa3a88be9
-0, 162000, 36864, 0xd6f01751
-0, 165600, 36864, 0x5420bb80
-0, 169200, 36864, 0xe14518f9
-0, 172800, 36864, 0x931db61e
-0, 176400, 36864, 0x052ecfae
-0, 180000, 36864, 0x29b1b0f5
-0, 183600, 36864, 0xa3057117
-0, 187200, 36864, 0x954464be
-0, 190800, 36864, 0xace1d90b
-0, 194400, 36864, 0x8f149f03
-0, 198000, 36864, 0x485722c5
-0, 201600, 36864, 0x534b18f9
-0, 205200, 36864, 0xc893a0a6
-0, 208800, 36864, 0x8b04e1dd
-0, 212400, 36864, 0xaf536964
+#tb 0: 1/25
+0, 0, 0, 1, 36864, 0x954464be
+0, 1, 1, 1, 36864, 0xace1d90b
+0, 2, 2, 1, 36864, 0x8f149f03
+0, 3, 3, 1, 36864, 0xea9b21eb
+0, 4, 4, 1, 36864, 0xb51d9fe3
+0, 5, 5, 1, 36864, 0x61bd11d7
+0, 6, 6, 1, 36864, 0x9d36980f
+0, 7, 7, 1, 36864, 0xa4192c5e
+0, 8, 8, 1, 36864, 0x11006433
+0, 9, 9, 1, 36864, 0x4a243e46
+0, 10, 10, 1, 36864, 0x1807b5e8
+0, 11, 11, 1, 36864, 0xbe37743c
+0, 12, 12, 1, 36864, 0x82491319
+0, 13, 13, 1, 36864, 0x006e9914
+0, 14, 14, 1, 36864, 0xa5261884
+0, 15, 15, 1, 36864, 0x2030c9d6
+0, 16, 16, 1, 36864, 0xc80eb1ce
+0, 17, 17, 1, 36864, 0x4d559791
+0, 18, 18, 1, 36864, 0xf5f900ee
+0, 19, 19, 1, 36864, 0x2cc9c0d7
+0, 20, 20, 1, 36864, 0x5ba14186
+0, 21, 21, 1, 36864, 0x47a46865
+0, 22, 22, 1, 36864, 0x5ba180b7
+0, 23, 23, 1, 36864, 0xc67c4876
+0, 24, 24, 1, 36864, 0x4311d75d
+0, 25, 25, 1, 36864, 0x56edb851
+0, 26, 26, 1, 36864, 0x7e5aa3e0
+0, 27, 27, 1, 36864, 0x8df8283a
+0, 28, 28, 1, 36864, 0xb8583ddf
+0, 29, 29, 1, 36864, 0xf33fb779
+0, 30, 30, 1, 36864, 0xe9942ddc
+0, 31, 31, 1, 36864, 0x2bc5f7fa
+0, 32, 32, 1, 36864, 0xc7b66c65
+0, 33, 33, 1, 36864, 0x1a524319
+0, 34, 34, 1, 36864, 0xf60c6141
+0, 35, 35, 1, 36864, 0x113f41f2
+0, 36, 36, 1, 36864, 0xad191a31
+0, 37, 37, 1, 36864, 0x3898264a
+0, 38, 38, 1, 36864, 0x3c2f34a4
+0, 39, 39, 1, 36864, 0xd0fc76aa
+0, 40, 40, 1, 36864, 0x2870b546
+0, 41, 41, 1, 36864, 0x7d326fb4
+0, 42, 42, 1, 36864, 0xd7ed14e1
+0, 43, 43, 1, 36864, 0x205174aa
+0, 44, 44, 1, 36864, 0xa3a88be9
+0, 45, 45, 1, 36864, 0xd6f01751
+0, 46, 46, 1, 36864, 0x5420bb80
+0, 47, 47, 1, 36864, 0xe14518f9
+0, 48, 48, 1, 36864, 0x931db61e
+0, 49, 49, 1, 36864, 0x052ecfae
+0, 50, 50, 1, 36864, 0x29b1b0f5
+0, 51, 51, 1, 36864, 0xa3057117
+0, 52, 52, 1, 36864, 0x954464be
+0, 53, 53, 1, 36864, 0xace1d90b
+0, 54, 54, 1, 36864, 0x8f149f03
+0, 55, 55, 1, 36864, 0x485722c5
+0, 56, 56, 1, 36864, 0x534b18f9
+0, 57, 57, 1, 36864, 0xc893a0a6
+0, 58, 58, 1, 36864, 0x8b04e1dd
+0, 59, 59, 1, 36864, 0xaf536964
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-mr7_bt_b b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-mr7_bt_b
index 3d40bde..25b7054 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-mr7_bt_b
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-mr7_bt_b
@@ -1,60 +1,61 @@
-0, 0, 36864, 0x579e6274
-0, 3600, 36864, 0x8650c61c
-0, 7200, 36864, 0xbc359647
-0, 10800, 36864, 0x08d91c13
-0, 14400, 36864, 0xe8b79043
-0, 18000, 36864, 0x2f16085a
-0, 21600, 36864, 0x81e89739
-0, 25200, 36864, 0xf2f324dd
-0, 28800, 36864, 0x592b5a01
-0, 32400, 36864, 0x4c2f2d91
-0, 36000, 36864, 0x8baeb610
-0, 39600, 36864, 0x86d47617
-0, 43200, 36864, 0xf11011cc
-0, 46800, 36864, 0xe56a9daa
-0, 50400, 36864, 0xd57119d6
-0, 54000, 36864, 0xe28fcde7
-0, 57600, 36864, 0x9aeeba86
-0, 61200, 36864, 0xa518a7c5
-0, 64800, 36864, 0x9af410be
-0, 68400, 36864, 0x1fedd12f
-0, 72000, 36864, 0xa8032e03
-0, 75600, 36864, 0x579e6274
-0, 79200, 36864, 0x99846ef6
-0, 82800, 36864, 0xb5ad3ca7
-0, 86400, 36864, 0x7845cb90
-0, 90000, 36864, 0x569fae24
-0, 93600, 36864, 0x8a3c9f98
-0, 97200, 36864, 0x0b7722af
-0, 100800, 36864, 0x699c2dd8
-0, 104400, 36864, 0xd477af13
-0, 108000, 36864, 0x17b62d7c
-0, 111600, 36864, 0xb1ecf6a7
-0, 115200, 36864, 0xf9c17e4c
-0, 118800, 36864, 0xe7c44618
-0, 122400, 36864, 0x7e23654e
-0, 126000, 36864, 0xd8a0457c
-0, 129600, 36864, 0x57e11df1
-0, 133200, 36864, 0xd54d2a43
-0, 136800, 36864, 0xc6f03950
-0, 140400, 36864, 0x687e750e
-0, 144000, 36864, 0x2870b546
-0, 147600, 36864, 0xda0370d0
-0, 151200, 36864, 0x5a2e0bff
-0, 154800, 36864, 0xe1f07533
-0, 158400, 36864, 0x3de892b9
-0, 162000, 36864, 0xe5c31505
-0, 165600, 36864, 0x96b8c082
-0, 169200, 36864, 0x55391423
-0, 172800, 36864, 0xc285bd71
-0, 176400, 36864, 0xf702d9f3
-0, 180000, 36864, 0x7afbadf8
-0, 183600, 36864, 0xd9b568f7
-0, 187200, 36864, 0x579e6274
-0, 190800, 36864, 0x8650c61c
-0, 194400, 36864, 0xbc359647
-0, 198000, 36864, 0x5522328c
-0, 201600, 36864, 0x02821fd6
-0, 205200, 36864, 0xb4ee9562
-0, 208800, 36864, 0xcefedb68
-0, 212400, 36864, 0xd959782e
+#tb 0: 1/25
+0, 0, 0, 1, 36864, 0x579e6274
+0, 1, 1, 1, 36864, 0x8650c61c
+0, 2, 2, 1, 36864, 0xbc359647
+0, 3, 3, 1, 36864, 0x08d91c13
+0, 4, 4, 1, 36864, 0xe8b79043
+0, 5, 5, 1, 36864, 0x2f16085a
+0, 6, 6, 1, 36864, 0x81e89739
+0, 7, 7, 1, 36864, 0xf2f324dd
+0, 8, 8, 1, 36864, 0x592b5a01
+0, 9, 9, 1, 36864, 0x4c2f2d91
+0, 10, 10, 1, 36864, 0x8baeb610
+0, 11, 11, 1, 36864, 0x86d47617
+0, 12, 12, 1, 36864, 0xf11011cc
+0, 13, 13, 1, 36864, 0xe56a9daa
+0, 14, 14, 1, 36864, 0xd57119d6
+0, 15, 15, 1, 36864, 0xe28fcde7
+0, 16, 16, 1, 36864, 0x9aeeba86
+0, 17, 17, 1, 36864, 0xa518a7c5
+0, 18, 18, 1, 36864, 0x9af410be
+0, 19, 19, 1, 36864, 0x1fedd12f
+0, 20, 20, 1, 36864, 0xa8032e03
+0, 21, 21, 1, 36864, 0x579e6274
+0, 22, 22, 1, 36864, 0x99846ef6
+0, 23, 23, 1, 36864, 0xb5ad3ca7
+0, 24, 24, 1, 36864, 0x7845cb90
+0, 25, 25, 1, 36864, 0x569fae24
+0, 26, 26, 1, 36864, 0x8a3c9f98
+0, 27, 27, 1, 36864, 0x0b7722af
+0, 28, 28, 1, 36864, 0x699c2dd8
+0, 29, 29, 1, 36864, 0xd477af13
+0, 30, 30, 1, 36864, 0x17b62d7c
+0, 31, 31, 1, 36864, 0xb1ecf6a7
+0, 32, 32, 1, 36864, 0xf9c17e4c
+0, 33, 33, 1, 36864, 0xe7c44618
+0, 34, 34, 1, 36864, 0x7e23654e
+0, 35, 35, 1, 36864, 0xd8a0457c
+0, 36, 36, 1, 36864, 0x57e11df1
+0, 37, 37, 1, 36864, 0xd54d2a43
+0, 38, 38, 1, 36864, 0xc6f03950
+0, 39, 39, 1, 36864, 0x687e750e
+0, 40, 40, 1, 36864, 0x2870b546
+0, 41, 41, 1, 36864, 0xda0370d0
+0, 42, 42, 1, 36864, 0x5a2e0bff
+0, 43, 43, 1, 36864, 0xe1f07533
+0, 44, 44, 1, 36864, 0x3de892b9
+0, 45, 45, 1, 36864, 0xe5c31505
+0, 46, 46, 1, 36864, 0x96b8c082
+0, 47, 47, 1, 36864, 0x55391423
+0, 48, 48, 1, 36864, 0xc285bd71
+0, 49, 49, 1, 36864, 0xf702d9f3
+0, 50, 50, 1, 36864, 0x7afbadf8
+0, 51, 51, 1, 36864, 0xd9b568f7
+0, 52, 52, 1, 36864, 0x579e6274
+0, 53, 53, 1, 36864, 0x8650c61c
+0, 54, 54, 1, 36864, 0xbc359647
+0, 55, 55, 1, 36864, 0x5522328c
+0, 56, 56, 1, 36864, 0x02821fd6
+0, 57, 57, 1, 36864, 0xb4ee9562
+0, 58, 58, 1, 36864, 0xcefedb68
+0, 59, 59, 1, 36864, 0xd959782e
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-mr8_bt_b b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-mr8_bt_b
index ab35869..220acf1 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-mr8_bt_b
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-mr8_bt_b
@@ -1,58 +1,59 @@
-0, 0, 36864, 0x36df68f4
-0, 3600, 36864, 0x52d4c6d9
-0, 7200, 36864, 0xad16b0be
-0, 10800, 36864, 0xf8c72556
-0, 14400, 36864, 0x70aaad30
-0, 18000, 36864, 0x53cffd5e
-0, 21600, 36864, 0xb3fa8abc
-0, 25200, 36864, 0x9c894009
-0, 28800, 36864, 0xfbc08050
-0, 32400, 36864, 0x9d5b2d65
-0, 36000, 36864, 0x3bd8bb5d
-0, 39600, 36864, 0x8d976ecf
-0, 43200, 36864, 0x25010368
-0, 46800, 36864, 0xb6e6a11c
-0, 50400, 36864, 0x595a3967
-0, 54000, 36864, 0x4fbcb9a8
-0, 57600, 36864, 0xc7c5c16b
-0, 61200, 36864, 0x661ae1eb
-0, 64800, 36864, 0x169f04a7
-0, 68400, 36864, 0xd124c93a
-0, 72000, 36864, 0x3f642dba
-0, 75600, 36864, 0xe7ad6956
-0, 79200, 36864, 0x47dc76d3
-0, 82800, 36864, 0x496a3917
-0, 86400, 36864, 0xa976d5f3
-0, 90000, 36864, 0x507bb685
-0, 93600, 36864, 0x2f61ac12
-0, 97200, 36864, 0x527818d8
-0, 100800, 36864, 0xa4983396
-0, 104400, 36864, 0x3ec9b07b
-0, 108000, 36864, 0x7db52d99
-0, 111600, 36864, 0xe974fd00
-0, 115200, 36864, 0x9c677a4f
-0, 118800, 36864, 0x108f3a05
-0, 122400, 36864, 0x23a56ba2
-0, 126000, 36864, 0x4c8d47e8
-0, 129600, 36864, 0x9e0b0f09
-0, 133200, 36864, 0x4d262b16
-0, 136800, 36864, 0x6122402e
-0, 140400, 36864, 0xed037036
-0, 144000, 36864, 0x62b3ba08
-0, 147600, 36864, 0x7f876930
-0, 151200, 36864, 0x4a6c0983
-0, 154800, 36864, 0xf9787086
-0, 158400, 36864, 0x01d1b1b5
-0, 162000, 36864, 0xc1622655
-0, 165600, 36864, 0x27e8e0f7
-0, 169200, 36864, 0xc1622655
-0, 172800, 36864, 0x12c2b7e9
-0, 176400, 36864, 0xd752d2ef
-0, 180000, 36864, 0xcbb1c3a7
-0, 183600, 36864, 0x18c56fba
-0, 187200, 36864, 0xb1b3771c
-0, 190800, 36864, 0x284ef3c4
-0, 194400, 36864, 0xda6eb5a0
-0, 198000, 36864, 0x17ad337c
-0, 201600, 36864, 0xe2801e4f
-0, 205200, 36864, 0x6c33bd17
+#tb 0: 1/25
+0, 0, 0, 1, 36864, 0x36df68f4
+0, 1, 1, 1, 36864, 0x52d4c6d9
+0, 2, 2, 1, 36864, 0xad16b0be
+0, 3, 3, 1, 36864, 0xf8c72556
+0, 4, 4, 1, 36864, 0x70aaad30
+0, 5, 5, 1, 36864, 0x53cffd5e
+0, 6, 6, 1, 36864, 0xb3fa8abc
+0, 7, 7, 1, 36864, 0x9c894009
+0, 8, 8, 1, 36864, 0xfbc08050
+0, 9, 9, 1, 36864, 0x9d5b2d65
+0, 10, 10, 1, 36864, 0x3bd8bb5d
+0, 11, 11, 1, 36864, 0x8d976ecf
+0, 12, 12, 1, 36864, 0x25010368
+0, 13, 13, 1, 36864, 0xb6e6a11c
+0, 14, 14, 1, 36864, 0x595a3967
+0, 15, 15, 1, 36864, 0x4fbcb9a8
+0, 16, 16, 1, 36864, 0xc7c5c16b
+0, 17, 17, 1, 36864, 0x661ae1eb
+0, 18, 18, 1, 36864, 0x169f04a7
+0, 19, 19, 1, 36864, 0xd124c93a
+0, 20, 20, 1, 36864, 0x3f642dba
+0, 21, 21, 1, 36864, 0xe7ad6956
+0, 22, 22, 1, 36864, 0x47dc76d3
+0, 23, 23, 1, 36864, 0x496a3917
+0, 24, 24, 1, 36864, 0xa976d5f3
+0, 25, 25, 1, 36864, 0x507bb685
+0, 26, 26, 1, 36864, 0x2f61ac12
+0, 27, 27, 1, 36864, 0x527818d8
+0, 28, 28, 1, 36864, 0xa4983396
+0, 29, 29, 1, 36864, 0x3ec9b07b
+0, 30, 30, 1, 36864, 0x7db52d99
+0, 31, 31, 1, 36864, 0xe974fd00
+0, 32, 32, 1, 36864, 0x9c677a4f
+0, 33, 33, 1, 36864, 0x108f3a05
+0, 34, 34, 1, 36864, 0x23a56ba2
+0, 35, 35, 1, 36864, 0x4c8d47e8
+0, 36, 36, 1, 36864, 0x9e0b0f09
+0, 37, 37, 1, 36864, 0x4d262b16
+0, 38, 38, 1, 36864, 0x6122402e
+0, 39, 39, 1, 36864, 0xed037036
+0, 40, 40, 1, 36864, 0x62b3ba08
+0, 41, 41, 1, 36864, 0x7f876930
+0, 42, 42, 1, 36864, 0x4a6c0983
+0, 43, 43, 1, 36864, 0xf9787086
+0, 44, 44, 1, 36864, 0x01d1b1b5
+0, 45, 45, 1, 36864, 0xc1622655
+0, 46, 46, 1, 36864, 0x27e8e0f7
+0, 47, 47, 1, 36864, 0xc1622655
+0, 48, 48, 1, 36864, 0x12c2b7e9
+0, 49, 49, 1, 36864, 0xd752d2ef
+0, 50, 50, 1, 36864, 0xcbb1c3a7
+0, 51, 51, 1, 36864, 0x18c56fba
+0, 52, 52, 1, 36864, 0xb1b3771c
+0, 53, 53, 1, 36864, 0x284ef3c4
+0, 54, 54, 1, 36864, 0xda6eb5a0
+0, 55, 55, 1, 36864, 0x17ad337c
+0, 56, 56, 1, 36864, 0xe2801e4f
+0, 57, 57, 1, 36864, 0x6c33bd17
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-mr9_bt_b b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-mr9_bt_b
index dcf0b42..3744802 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-mr9_bt_b
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-mr9_bt_b
@@ -1,58 +1,59 @@
-0, 0, 36864, 0xb4c5642e
-0, 3600, 36864, 0x929fd05f
-0, 7200, 36864, 0x447c9b69
-0, 10800, 36864, 0xab0712da
-0, 14400, 36864, 0xd9f69216
-0, 18000, 36864, 0xec04f6dc
-0, 21600, 36864, 0x5ffa86cc
-0, 25200, 36864, 0x75122807
-0, 28800, 36864, 0x27036a2b
-0, 32400, 36864, 0x00072654
-0, 36000, 36864, 0x49fab4fd
-0, 39600, 36864, 0x975a7545
-0, 43200, 36864, 0x9b080a2f
-0, 46800, 36864, 0x78db960e
-0, 50400, 36864, 0xd7a928d4
-0, 54000, 36864, 0x0a83ba1b
-0, 57600, 36864, 0xad6bb30c
-0, 61200, 36864, 0xf6addb0d
-0, 64800, 36864, 0x00540a0a
-0, 68400, 36864, 0x049cc748
-0, 72000, 36864, 0x5b1e2291
-0, 75600, 36864, 0x2367706e
-0, 79200, 36864, 0x88ef6b11
-0, 82800, 36864, 0x85b73230
-0, 86400, 36864, 0xe46cd522
-0, 90000, 36864, 0x98489c05
-0, 93600, 36864, 0x7e439564
-0, 97200, 36864, 0x71330799
-0, 100800, 36864, 0x81a6239e
-0, 104400, 36864, 0x8005a302
-0, 108000, 36864, 0xdf132e3f
-0, 111600, 36864, 0x2a1d00de
-0, 115200, 36864, 0x7bb57e14
-0, 118800, 36864, 0xf2a637cf
-0, 122400, 36864, 0xae6f6916
-0, 126000, 36864, 0x2f1d4763
-0, 129600, 36864, 0xa4e1145e
-0, 133200, 36864, 0xc1644392
-0, 136800, 36864, 0x21853537
-0, 140400, 36864, 0x0bc45bac
-0, 144000, 36864, 0x84ccb8ee
-0, 147600, 36864, 0x65de651c
-0, 151200, 36864, 0x33ff027e
-0, 154800, 36864, 0xefe47056
-0, 158400, 36864, 0x8952b47c
-0, 162000, 36864, 0x78730fcf
-0, 165600, 36864, 0x14bae79f
-0, 169200, 36864, 0x53230fbe
-0, 172800, 36864, 0x15b0b245
-0, 176400, 36864, 0x45fbd155
-0, 180000, 36864, 0x41cfbac4
-0, 183600, 36864, 0x0d635d61
-0, 187200, 36864, 0x55aa8d3c
-0, 190800, 36864, 0x8f02fbaf
-0, 194400, 36864, 0xb17fac3f
-0, 198000, 36864, 0xc12627f9
-0, 201600, 36864, 0xa5971e4a
-0, 205200, 36864, 0x3677abfe
+#tb 0: 1/25
+0, 0, 0, 1, 36864, 0xb4c5642e
+0, 1, 1, 1, 36864, 0x929fd05f
+0, 2, 2, 1, 36864, 0x447c9b69
+0, 3, 3, 1, 36864, 0xab0712da
+0, 4, 4, 1, 36864, 0xd9f69216
+0, 5, 5, 1, 36864, 0xec04f6dc
+0, 6, 6, 1, 36864, 0x5ffa86cc
+0, 7, 7, 1, 36864, 0x75122807
+0, 8, 8, 1, 36864, 0x27036a2b
+0, 9, 9, 1, 36864, 0x00072654
+0, 10, 10, 1, 36864, 0x49fab4fd
+0, 11, 11, 1, 36864, 0x975a7545
+0, 12, 12, 1, 36864, 0x9b080a2f
+0, 13, 13, 1, 36864, 0x78db960e
+0, 14, 14, 1, 36864, 0xd7a928d4
+0, 15, 15, 1, 36864, 0x0a83ba1b
+0, 16, 16, 1, 36864, 0xad6bb30c
+0, 17, 17, 1, 36864, 0xf6addb0d
+0, 18, 18, 1, 36864, 0x00540a0a
+0, 19, 19, 1, 36864, 0x049cc748
+0, 20, 20, 1, 36864, 0x5b1e2291
+0, 21, 21, 1, 36864, 0x2367706e
+0, 22, 22, 1, 36864, 0x88ef6b11
+0, 23, 23, 1, 36864, 0x85b73230
+0, 24, 24, 1, 36864, 0xe46cd522
+0, 25, 25, 1, 36864, 0x98489c05
+0, 26, 26, 1, 36864, 0x7e439564
+0, 27, 27, 1, 36864, 0x71330799
+0, 28, 28, 1, 36864, 0x81a6239e
+0, 29, 29, 1, 36864, 0x8005a302
+0, 30, 30, 1, 36864, 0xdf132e3f
+0, 31, 31, 1, 36864, 0x2a1d00de
+0, 32, 32, 1, 36864, 0x7bb57e14
+0, 33, 33, 1, 36864, 0xf2a637cf
+0, 34, 34, 1, 36864, 0xae6f6916
+0, 35, 35, 1, 36864, 0x2f1d4763
+0, 36, 36, 1, 36864, 0xa4e1145e
+0, 37, 37, 1, 36864, 0xc1644392
+0, 38, 38, 1, 36864, 0x21853537
+0, 39, 39, 1, 36864, 0x0bc45bac
+0, 40, 40, 1, 36864, 0x84ccb8ee
+0, 41, 41, 1, 36864, 0x65de651c
+0, 42, 42, 1, 36864, 0x33ff027e
+0, 43, 43, 1, 36864, 0xefe47056
+0, 44, 44, 1, 36864, 0x8952b47c
+0, 45, 45, 1, 36864, 0x78730fcf
+0, 46, 46, 1, 36864, 0x14bae79f
+0, 47, 47, 1, 36864, 0x53230fbe
+0, 48, 48, 1, 36864, 0x15b0b245
+0, 49, 49, 1, 36864, 0x45fbd155
+0, 50, 50, 1, 36864, 0x41cfbac4
+0, 51, 51, 1, 36864, 0x0d635d61
+0, 52, 52, 1, 36864, 0x55aa8d3c
+0, 53, 53, 1, 36864, 0x8f02fbaf
+0, 54, 54, 1, 36864, 0xb17fac3f
+0, 55, 55, 1, 36864, 0xc12627f9
+0, 56, 56, 1, 36864, 0xa5971e4a
+0, 57, 57, 1, 36864, 0x3677abfe
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-mv1_brcm_d b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-mv1_brcm_d
index f7ce1d6..47517ee 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-mv1_brcm_d
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-mv1_brcm_d
@@ -1,257 +1,258 @@
-0, 0, 518400, 0x230d7aa6
-0, 3600, 518400, 0x9fc976e0
-0, 7200, 518400, 0x51052db9
-0, 10800, 518400, 0xad82d599
-0, 14400, 518400, 0xa122c6a7
-0, 18000, 518400, 0x0c3a81a0
-0, 21600, 518400, 0x6235364e
-0, 25200, 518400, 0x4d5104f8
-0, 28800, 518400, 0x09cc49b1
-0, 32400, 518400, 0xcdb05c19
-0, 36000, 518400, 0x894be6de
-0, 39600, 518400, 0x53a41fc3
-0, 43200, 518400, 0x7568ccee
-0, 46800, 518400, 0x2b5ae37b
-0, 50400, 518400, 0xd0b994bb
-0, 54000, 518400, 0x1b161358
-0, 57600, 518400, 0xc5434edc
-0, 61200, 518400, 0xc4709590
-0, 64800, 518400, 0x60c6803a
-0, 68400, 518400, 0xdff3edcd
-0, 72000, 518400, 0x8a02b8b4
-0, 75600, 518400, 0x478cf791
-0, 79200, 518400, 0x7c42fed0
-0, 82800, 518400, 0x12b1336d
-0, 86400, 518400, 0xe16e765e
-0, 90000, 518400, 0x002c291e
-0, 93600, 518400, 0x50810b53
-0, 97200, 518400, 0xda7e2453
-0, 100800, 518400, 0x6e330093
-0, 104400, 518400, 0xf30740b3
-0, 108000, 518400, 0xc27ae19d
-0, 111600, 518400, 0xe49da8c2
-0, 115200, 518400, 0xa739372c
-0, 118800, 518400, 0x4b44788c
-0, 122400, 518400, 0xfdf9e6cf
-0, 126000, 518400, 0xee205413
-0, 129600, 518400, 0x8792dc0e
-0, 133200, 518400, 0x6820d611
-0, 136800, 518400, 0x106cbc2c
-0, 140400, 518400, 0x7d8e3e92
-0, 144000, 518400, 0xbfe48709
-0, 147600, 518400, 0xc5d5a55d
-0, 151200, 518400, 0x7c234886
-0, 154800, 518400, 0x852372b0
-0, 158400, 518400, 0x43d697f9
-0, 162000, 518400, 0xc3460806
-0, 165600, 518400, 0x0600abea
-0, 169200, 518400, 0xf6e3ab0e
-0, 172800, 518400, 0x651f9a46
-0, 176400, 518400, 0xed467ba0
-0, 180000, 518400, 0x62312c3f
-0, 183600, 518400, 0xb121898d
-0, 187200, 518400, 0xb1f96406
-0, 190800, 518400, 0x78003318
-0, 194400, 518400, 0x1032b15b
-0, 198000, 518400, 0x72683d37
-0, 201600, 518400, 0xd1349f12
-0, 205200, 518400, 0x4162f707
-0, 208800, 518400, 0x894711c9
-0, 212400, 518400, 0xca37429b
-0, 216000, 518400, 0xb8e91eb5
-0, 219600, 518400, 0xe5eb3103
-0, 223200, 518400, 0x56a33cea
-0, 226800, 518400, 0x79ef0227
-0, 230400, 518400, 0x7ceaab75
-0, 234000, 518400, 0x3f4787b2
-0, 237600, 518400, 0x9e6d2abb
-0, 241200, 518400, 0xedb0cf82
-0, 244800, 518400, 0x19c8723f
-0, 248400, 518400, 0x35d8399b
-0, 252000, 518400, 0xe0224dc8
-0, 255600, 518400, 0xc95467bf
-0, 259200, 518400, 0x99662844
-0, 262800, 518400, 0x10a322c9
-0, 266400, 518400, 0xe6313d98
-0, 270000, 518400, 0x2e2a63d1
-0, 273600, 518400, 0x2c9d0715
-0, 277200, 518400, 0xf31d9e19
-0, 280800, 518400, 0xcea1f9f8
-0, 284400, 518400, 0xece1cd92
-0, 288000, 518400, 0xa8d35347
-0, 291600, 518400, 0xd8cd2228
-0, 295200, 518400, 0xe040993a
-0, 298800, 518400, 0xebc2b387
-0, 302400, 518400, 0xc3e81e85
-0, 306000, 518400, 0xcc507bc9
-0, 309600, 518400, 0xb98c4902
-0, 313200, 518400, 0x454a2a50
-0, 316800, 518400, 0x1460c5dd
-0, 320400, 518400, 0x37d7a99d
-0, 324000, 518400, 0x1de7a047
-0, 327600, 518400, 0xc7b83c21
-0, 331200, 518400, 0xe06d1c9b
-0, 334800, 518400, 0xfd8259b5
-0, 338400, 518400, 0xc3df7e1a
-0, 342000, 518400, 0x60c9ccec
-0, 345600, 518400, 0x7d163c04
-0, 349200, 518400, 0x8fc61e9d
-0, 352800, 518400, 0xa5f520e6
-0, 356400, 518400, 0x8d709ec1
-0, 360000, 518400, 0xca2b6287
-0, 363600, 518400, 0x8531bb18
-0, 367200, 518400, 0x830f9187
-0, 370800, 518400, 0x67c5d413
-0, 374400, 518400, 0x428aeecd
-0, 378000, 518400, 0xbf8e3448
-0, 381600, 518400, 0x847389f0
-0, 385200, 518400, 0x18d0b3ba
-0, 388800, 518400, 0xbee957ea
-0, 392400, 518400, 0x34941f3e
-0, 396000, 518400, 0x850e0126
-0, 399600, 518400, 0xab992409
-0, 403200, 518400, 0xb7d8d01f
-0, 406800, 518400, 0xe602576c
-0, 410400, 518400, 0x22388048
-0, 414000, 518400, 0x81ab9f4a
-0, 417600, 518400, 0xc5977820
-0, 421200, 518400, 0xc43f98bd
-0, 424800, 518400, 0xfd5e6d12
-0, 428400, 518400, 0xb9f12c73
-0, 432000, 518400, 0x44be16b9
-0, 435600, 518400, 0x32f0d9b9
-0, 439200, 518400, 0x6e9c3113
-0, 442800, 518400, 0x00618755
-0, 446400, 518400, 0x080c9955
-0, 450000, 518400, 0xb21d6096
-0, 453600, 518400, 0x51502f54
-0, 457200, 518400, 0xf062e38b
-0, 460800, 518400, 0x66f05988
-0, 464400, 518400, 0x37d569f1
-0, 468000, 518400, 0xba78ae5e
-0, 471600, 518400, 0x634a2d25
-0, 475200, 518400, 0x283e5e4a
-0, 478800, 518400, 0x9344d41c
-0, 482400, 518400, 0x1fdb5c18
-0, 486000, 518400, 0xd8139683
-0, 489600, 518400, 0xd27f555e
-0, 493200, 518400, 0x34ed517f
-0, 496800, 518400, 0x1f55ad2d
-0, 500400, 518400, 0x9a8bd368
-0, 504000, 518400, 0x9726e3bf
-0, 507600, 518400, 0xaf8945ee
-0, 511200, 518400, 0x28c20699
-0, 514800, 518400, 0x43e180c9
-0, 518400, 518400, 0x0c88e592
-0, 522000, 518400, 0xdcb8825e
-0, 525600, 518400, 0x1ec09a5e
-0, 529200, 518400, 0x149768b2
-0, 532800, 518400, 0x1eeab153
-0, 536400, 518400, 0x25666d6f
-0, 540000, 518400, 0x691cad89
-0, 543600, 518400, 0x2d9f8ced
-0, 547200, 518400, 0xd80b768d
-0, 550800, 518400, 0xe4f23a79
-0, 554400, 518400, 0xd51d0150
-0, 558000, 518400, 0x060156f4
-0, 561600, 518400, 0x800720fb
-0, 565200, 518400, 0x2a433b28
-0, 568800, 518400, 0xffc79782
-0, 572400, 518400, 0x31ba693b
-0, 576000, 518400, 0xd13c8395
-0, 579600, 518400, 0x07d9f752
-0, 583200, 518400, 0xabb81043
-0, 586800, 518400, 0xba0ee926
-0, 590400, 518400, 0xa17e7ea9
-0, 594000, 518400, 0x9d709e52
-0, 597600, 518400, 0x7fa02633
-0, 601200, 518400, 0x5cdc5217
-0, 604800, 518400, 0x888be0b0
-0, 608400, 518400, 0xe1bac436
-0, 612000, 518400, 0xa479b1b8
-0, 615600, 518400, 0xb61feb17
-0, 619200, 518400, 0xa0745cd4
-0, 622800, 518400, 0x871cffe5
-0, 626400, 518400, 0x01f7deea
-0, 630000, 518400, 0xdaf6f9f5
-0, 633600, 518400, 0xfee4849c
-0, 637200, 518400, 0xc3b9b428
-0, 640800, 518400, 0x50b4b47f
-0, 644400, 518400, 0xe8e58b82
-0, 648000, 518400, 0x7c6f94e0
-0, 651600, 518400, 0x0cfe7c08
-0, 655200, 518400, 0xb2975466
-0, 658800, 518400, 0xa1245de1
-0, 662400, 518400, 0x46ae79b7
-0, 666000, 518400, 0x8344a9b2
-0, 669600, 518400, 0x1e805013
-0, 673200, 518400, 0x19b61baf
-0, 676800, 518400, 0xd018383b
-0, 680400, 518400, 0xc9248d31
-0, 684000, 518400, 0x838ad8ec
-0, 687600, 518400, 0xa848824a
-0, 691200, 518400, 0xc6a46ebd
-0, 694800, 518400, 0x2a7c489c
-0, 698400, 518400, 0xb1db6cef
-0, 702000, 518400, 0xd24a999f
-0, 705600, 518400, 0xce47efcd
-0, 709200, 518400, 0xf3e058cb
-0, 712800, 518400, 0x25d7f6e3
-0, 716400, 518400, 0xe3daa12d
-0, 720000, 518400, 0xb3de8475
-0, 723600, 518400, 0x13efffdc
-0, 727200, 518400, 0xfb37e048
-0, 730800, 518400, 0x599a6daf
-0, 734400, 518400, 0x84bf6814
-0, 738000, 518400, 0x83c03a3f
-0, 741600, 518400, 0x3a319ae9
-0, 745200, 518400, 0x0af252c3
-0, 748800, 518400, 0xeb8f2f43
-0, 752400, 518400, 0x3bdcd421
-0, 756000, 518400, 0x9107e0f2
-0, 759600, 518400, 0x5f4fe3cf
-0, 763200, 518400, 0x38f1e8ef
-0, 766800, 518400, 0xb0359a0b
-0, 770400, 518400, 0xdddd4645
-0, 774000, 518400, 0xe14ffb0b
-0, 777600, 518400, 0x34a31c96
-0, 781200, 518400, 0x1f4406de
-0, 784800, 518400, 0x042b82b6
-0, 788400, 518400, 0x6af16a4d
-0, 792000, 518400, 0x3cfba41a
-0, 795600, 518400, 0xa054b6e8
-0, 799200, 518400, 0x2d55721b
-0, 802800, 518400, 0x55391f75
-0, 806400, 518400, 0xc2d46fa6
-0, 810000, 518400, 0x3a2576d9
-0, 813600, 518400, 0xea9ea26d
-0, 817200, 518400, 0xe2ec8962
-0, 820800, 518400, 0x47568769
-0, 824400, 518400, 0xc55e0186
-0, 828000, 518400, 0x73a44453
-0, 831600, 518400, 0xe36b1c77
-0, 835200, 518400, 0x414db365
-0, 838800, 518400, 0xfb25f7f6
-0, 842400, 518400, 0x5b4847a7
-0, 846000, 518400, 0xe96babf4
-0, 849600, 518400, 0x15edbf63
-0, 853200, 518400, 0x08a984c6
-0, 856800, 518400, 0x47ec41af
-0, 860400, 518400, 0x1912eaca
-0, 864000, 518400, 0xe058b0cc
-0, 867600, 518400, 0x03e9660b
-0, 871200, 518400, 0x85fea285
-0, 874800, 518400, 0xdf02bdd6
-0, 878400, 518400, 0xad3e6849
-0, 882000, 518400, 0x0ad866b6
-0, 885600, 518400, 0x1b994f78
-0, 889200, 518400, 0xc5916af5
-0, 892800, 518400, 0x5f66adeb
-0, 896400, 518400, 0x1c9f96a1
-0, 900000, 518400, 0xfc390832
-0, 903600, 518400, 0x0352ff56
-0, 907200, 518400, 0x6803c8f4
-0, 910800, 518400, 0x0f0b8686
-0, 914400, 518400, 0xdc3a5bce
-0, 918000, 518400, 0x96dd28d1
-0, 921600, 518400, 0x51d56824
+#tb 0: 1/25
+0, 0, 0, 1, 518400, 0x230d7aa6
+0, 1, 1, 1, 518400, 0x9fc976e0
+0, 2, 2, 1, 518400, 0x51052db9
+0, 3, 3, 1, 518400, 0xad82d599
+0, 4, 4, 1, 518400, 0xa122c6a7
+0, 5, 5, 1, 518400, 0x0c3a81a0
+0, 6, 6, 1, 518400, 0x6235364e
+0, 7, 7, 1, 518400, 0x4d5104f8
+0, 8, 8, 1, 518400, 0x09cc49b1
+0, 9, 9, 1, 518400, 0xcdb05c19
+0, 10, 10, 1, 518400, 0x894be6de
+0, 11, 11, 1, 518400, 0x53a41fc3
+0, 12, 12, 1, 518400, 0x7568ccee
+0, 13, 13, 1, 518400, 0x2b5ae37b
+0, 14, 14, 1, 518400, 0xd0b994bb
+0, 15, 15, 1, 518400, 0x1b161358
+0, 16, 16, 1, 518400, 0xc5434edc
+0, 17, 17, 1, 518400, 0xc4709590
+0, 18, 18, 1, 518400, 0x60c6803a
+0, 19, 19, 1, 518400, 0xdff3edcd
+0, 20, 20, 1, 518400, 0x8a02b8b4
+0, 21, 21, 1, 518400, 0x478cf791
+0, 22, 22, 1, 518400, 0x7c42fed0
+0, 23, 23, 1, 518400, 0x12b1336d
+0, 24, 24, 1, 518400, 0xe16e765e
+0, 25, 25, 1, 518400, 0x002c291e
+0, 26, 26, 1, 518400, 0x50810b53
+0, 27, 27, 1, 518400, 0xda7e2453
+0, 28, 28, 1, 518400, 0x6e330093
+0, 29, 29, 1, 518400, 0xf30740b3
+0, 30, 30, 1, 518400, 0xc27ae19d
+0, 31, 31, 1, 518400, 0xe49da8c2
+0, 32, 32, 1, 518400, 0xa739372c
+0, 33, 33, 1, 518400, 0x4b44788c
+0, 34, 34, 1, 518400, 0xfdf9e6cf
+0, 35, 35, 1, 518400, 0xee205413
+0, 36, 36, 1, 518400, 0x8792dc0e
+0, 37, 37, 1, 518400, 0x6820d611
+0, 38, 38, 1, 518400, 0x106cbc2c
+0, 39, 39, 1, 518400, 0x7d8e3e92
+0, 40, 40, 1, 518400, 0xbfe48709
+0, 41, 41, 1, 518400, 0xc5d5a55d
+0, 42, 42, 1, 518400, 0x7c234886
+0, 43, 43, 1, 518400, 0x852372b0
+0, 44, 44, 1, 518400, 0x43d697f9
+0, 45, 45, 1, 518400, 0xc3460806
+0, 46, 46, 1, 518400, 0x0600abea
+0, 47, 47, 1, 518400, 0xf6e3ab0e
+0, 48, 48, 1, 518400, 0x651f9a46
+0, 49, 49, 1, 518400, 0xed467ba0
+0, 50, 50, 1, 518400, 0x62312c3f
+0, 51, 51, 1, 518400, 0xb121898d
+0, 52, 52, 1, 518400, 0xb1f96406
+0, 53, 53, 1, 518400, 0x78003318
+0, 54, 54, 1, 518400, 0x1032b15b
+0, 55, 55, 1, 518400, 0x72683d37
+0, 56, 56, 1, 518400, 0xd1349f12
+0, 57, 57, 1, 518400, 0x4162f707
+0, 58, 58, 1, 518400, 0x894711c9
+0, 59, 59, 1, 518400, 0xca37429b
+0, 60, 60, 1, 518400, 0xb8e91eb5
+0, 61, 61, 1, 518400, 0xe5eb3103
+0, 62, 62, 1, 518400, 0x56a33cea
+0, 63, 63, 1, 518400, 0x79ef0227
+0, 64, 64, 1, 518400, 0x7ceaab75
+0, 65, 65, 1, 518400, 0x3f4787b2
+0, 66, 66, 1, 518400, 0x9e6d2abb
+0, 67, 67, 1, 518400, 0xedb0cf82
+0, 68, 68, 1, 518400, 0x19c8723f
+0, 69, 69, 1, 518400, 0x35d8399b
+0, 70, 70, 1, 518400, 0xe0224dc8
+0, 71, 71, 1, 518400, 0xc95467bf
+0, 72, 72, 1, 518400, 0x99662844
+0, 73, 73, 1, 518400, 0x10a322c9
+0, 74, 74, 1, 518400, 0xe6313d98
+0, 75, 75, 1, 518400, 0x2e2a63d1
+0, 76, 76, 1, 518400, 0x2c9d0715
+0, 77, 77, 1, 518400, 0xf31d9e19
+0, 78, 78, 1, 518400, 0xcea1f9f8
+0, 79, 79, 1, 518400, 0xece1cd92
+0, 80, 80, 1, 518400, 0xa8d35347
+0, 81, 81, 1, 518400, 0xd8cd2228
+0, 82, 82, 1, 518400, 0xe040993a
+0, 83, 83, 1, 518400, 0xebc2b387
+0, 84, 84, 1, 518400, 0xc3e81e85
+0, 85, 85, 1, 518400, 0xcc507bc9
+0, 86, 86, 1, 518400, 0xb98c4902
+0, 87, 87, 1, 518400, 0x454a2a50
+0, 88, 88, 1, 518400, 0x1460c5dd
+0, 89, 89, 1, 518400, 0x37d7a99d
+0, 90, 90, 1, 518400, 0x1de7a047
+0, 91, 91, 1, 518400, 0xc7b83c21
+0, 92, 92, 1, 518400, 0xe06d1c9b
+0, 93, 93, 1, 518400, 0xfd8259b5
+0, 94, 94, 1, 518400, 0xc3df7e1a
+0, 95, 95, 1, 518400, 0x60c9ccec
+0, 96, 96, 1, 518400, 0x7d163c04
+0, 97, 97, 1, 518400, 0x8fc61e9d
+0, 98, 98, 1, 518400, 0xa5f520e6
+0, 99, 99, 1, 518400, 0x8d709ec1
+0, 100, 100, 1, 518400, 0xca2b6287
+0, 101, 101, 1, 518400, 0x8531bb18
+0, 102, 102, 1, 518400, 0x830f9187
+0, 103, 103, 1, 518400, 0x67c5d413
+0, 104, 104, 1, 518400, 0x428aeecd
+0, 105, 105, 1, 518400, 0xbf8e3448
+0, 106, 106, 1, 518400, 0x847389f0
+0, 107, 107, 1, 518400, 0x18d0b3ba
+0, 108, 108, 1, 518400, 0xbee957ea
+0, 109, 109, 1, 518400, 0x34941f3e
+0, 110, 110, 1, 518400, 0x850e0126
+0, 111, 111, 1, 518400, 0xab992409
+0, 112, 112, 1, 518400, 0xb7d8d01f
+0, 113, 113, 1, 518400, 0xe602576c
+0, 114, 114, 1, 518400, 0x22388048
+0, 115, 115, 1, 518400, 0x81ab9f4a
+0, 116, 116, 1, 518400, 0xc5977820
+0, 117, 117, 1, 518400, 0xc43f98bd
+0, 118, 118, 1, 518400, 0xfd5e6d12
+0, 119, 119, 1, 518400, 0xb9f12c73
+0, 120, 120, 1, 518400, 0x44be16b9
+0, 121, 121, 1, 518400, 0x32f0d9b9
+0, 122, 122, 1, 518400, 0x6e9c3113
+0, 123, 123, 1, 518400, 0x00618755
+0, 124, 124, 1, 518400, 0x080c9955
+0, 125, 125, 1, 518400, 0xb21d6096
+0, 126, 126, 1, 518400, 0x51502f54
+0, 127, 127, 1, 518400, 0xf062e38b
+0, 128, 128, 1, 518400, 0x66f05988
+0, 129, 129, 1, 518400, 0x37d569f1
+0, 130, 130, 1, 518400, 0xba78ae5e
+0, 131, 131, 1, 518400, 0x634a2d25
+0, 132, 132, 1, 518400, 0x283e5e4a
+0, 133, 133, 1, 518400, 0x9344d41c
+0, 134, 134, 1, 518400, 0x1fdb5c18
+0, 135, 135, 1, 518400, 0xd8139683
+0, 136, 136, 1, 518400, 0xd27f555e
+0, 137, 137, 1, 518400, 0x34ed517f
+0, 138, 138, 1, 518400, 0x1f55ad2d
+0, 139, 139, 1, 518400, 0x9a8bd368
+0, 140, 140, 1, 518400, 0x9726e3bf
+0, 141, 141, 1, 518400, 0xaf8945ee
+0, 142, 142, 1, 518400, 0x28c20699
+0, 143, 143, 1, 518400, 0x43e180c9
+0, 144, 144, 1, 518400, 0x0c88e592
+0, 145, 145, 1, 518400, 0xdcb8825e
+0, 146, 146, 1, 518400, 0x1ec09a5e
+0, 147, 147, 1, 518400, 0x149768b2
+0, 148, 148, 1, 518400, 0x1eeab153
+0, 149, 149, 1, 518400, 0x25666d6f
+0, 150, 150, 1, 518400, 0x691cad89
+0, 151, 151, 1, 518400, 0x2d9f8ced
+0, 152, 152, 1, 518400, 0xd80b768d
+0, 153, 153, 1, 518400, 0xe4f23a79
+0, 154, 154, 1, 518400, 0xd51d0150
+0, 155, 155, 1, 518400, 0x060156f4
+0, 156, 156, 1, 518400, 0x800720fb
+0, 157, 157, 1, 518400, 0x2a433b28
+0, 158, 158, 1, 518400, 0xffc79782
+0, 159, 159, 1, 518400, 0x31ba693b
+0, 160, 160, 1, 518400, 0xd13c8395
+0, 161, 161, 1, 518400, 0x07d9f752
+0, 162, 162, 1, 518400, 0xabb81043
+0, 163, 163, 1, 518400, 0xba0ee926
+0, 164, 164, 1, 518400, 0xa17e7ea9
+0, 165, 165, 1, 518400, 0x9d709e52
+0, 166, 166, 1, 518400, 0x7fa02633
+0, 167, 167, 1, 518400, 0x5cdc5217
+0, 168, 168, 1, 518400, 0x888be0b0
+0, 169, 169, 1, 518400, 0xe1bac436
+0, 170, 170, 1, 518400, 0xa479b1b8
+0, 171, 171, 1, 518400, 0xb61feb17
+0, 172, 172, 1, 518400, 0xa0745cd4
+0, 173, 173, 1, 518400, 0x871cffe5
+0, 174, 174, 1, 518400, 0x01f7deea
+0, 175, 175, 1, 518400, 0xdaf6f9f5
+0, 176, 176, 1, 518400, 0xfee4849c
+0, 177, 177, 1, 518400, 0xc3b9b428
+0, 178, 178, 1, 518400, 0x50b4b47f
+0, 179, 179, 1, 518400, 0xe8e58b82
+0, 180, 180, 1, 518400, 0x7c6f94e0
+0, 181, 181, 1, 518400, 0x0cfe7c08
+0, 182, 182, 1, 518400, 0xb2975466
+0, 183, 183, 1, 518400, 0xa1245de1
+0, 184, 184, 1, 518400, 0x46ae79b7
+0, 185, 185, 1, 518400, 0x8344a9b2
+0, 186, 186, 1, 518400, 0x1e805013
+0, 187, 187, 1, 518400, 0x19b61baf
+0, 188, 188, 1, 518400, 0xd018383b
+0, 189, 189, 1, 518400, 0xc9248d31
+0, 190, 190, 1, 518400, 0x838ad8ec
+0, 191, 191, 1, 518400, 0xa848824a
+0, 192, 192, 1, 518400, 0xc6a46ebd
+0, 193, 193, 1, 518400, 0x2a7c489c
+0, 194, 194, 1, 518400, 0xb1db6cef
+0, 195, 195, 1, 518400, 0xd24a999f
+0, 196, 196, 1, 518400, 0xce47efcd
+0, 197, 197, 1, 518400, 0xf3e058cb
+0, 198, 198, 1, 518400, 0x25d7f6e3
+0, 199, 199, 1, 518400, 0xe3daa12d
+0, 200, 200, 1, 518400, 0xb3de8475
+0, 201, 201, 1, 518400, 0x13efffdc
+0, 202, 202, 1, 518400, 0xfb37e048
+0, 203, 203, 1, 518400, 0x599a6daf
+0, 204, 204, 1, 518400, 0x84bf6814
+0, 205, 205, 1, 518400, 0x83c03a3f
+0, 206, 206, 1, 518400, 0x3a319ae9
+0, 207, 207, 1, 518400, 0x0af252c3
+0, 208, 208, 1, 518400, 0xeb8f2f43
+0, 209, 209, 1, 518400, 0x3bdcd421
+0, 210, 210, 1, 518400, 0x9107e0f2
+0, 211, 211, 1, 518400, 0x5f4fe3cf
+0, 212, 212, 1, 518400, 0x38f1e8ef
+0, 213, 213, 1, 518400, 0xb0359a0b
+0, 214, 214, 1, 518400, 0xdddd4645
+0, 215, 215, 1, 518400, 0xe14ffb0b
+0, 216, 216, 1, 518400, 0x34a31c96
+0, 217, 217, 1, 518400, 0x1f4406de
+0, 218, 218, 1, 518400, 0x042b82b6
+0, 219, 219, 1, 518400, 0x6af16a4d
+0, 220, 220, 1, 518400, 0x3cfba41a
+0, 221, 221, 1, 518400, 0xa054b6e8
+0, 222, 222, 1, 518400, 0x2d55721b
+0, 223, 223, 1, 518400, 0x55391f75
+0, 224, 224, 1, 518400, 0xc2d46fa6
+0, 225, 225, 1, 518400, 0x3a2576d9
+0, 226, 226, 1, 518400, 0xea9ea26d
+0, 227, 227, 1, 518400, 0xe2ec8962
+0, 228, 228, 1, 518400, 0x47568769
+0, 229, 229, 1, 518400, 0xc55e0186
+0, 230, 230, 1, 518400, 0x73a44453
+0, 231, 231, 1, 518400, 0xe36b1c77
+0, 232, 232, 1, 518400, 0x414db365
+0, 233, 233, 1, 518400, 0xfb25f7f6
+0, 234, 234, 1, 518400, 0x5b4847a7
+0, 235, 235, 1, 518400, 0xe96babf4
+0, 236, 236, 1, 518400, 0x15edbf63
+0, 237, 237, 1, 518400, 0x08a984c6
+0, 238, 238, 1, 518400, 0x47ec41af
+0, 239, 239, 1, 518400, 0x1912eaca
+0, 240, 240, 1, 518400, 0xe058b0cc
+0, 241, 241, 1, 518400, 0x03e9660b
+0, 242, 242, 1, 518400, 0x85fea285
+0, 243, 243, 1, 518400, 0xdf02bdd6
+0, 244, 244, 1, 518400, 0xad3e6849
+0, 245, 245, 1, 518400, 0x0ad866b6
+0, 246, 246, 1, 518400, 0x1b994f78
+0, 247, 247, 1, 518400, 0xc5916af5
+0, 248, 248, 1, 518400, 0x5f66adeb
+0, 249, 249, 1, 518400, 0x1c9f96a1
+0, 250, 250, 1, 518400, 0xfc390832
+0, 251, 251, 1, 518400, 0x0352ff56
+0, 252, 252, 1, 518400, 0x6803c8f4
+0, 253, 253, 1, 518400, 0x0f0b8686
+0, 254, 254, 1, 518400, 0xdc3a5bce
+0, 255, 255, 1, 518400, 0x96dd28d1
+0, 256, 256, 1, 518400, 0x51d56824
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-nl1_sony_d b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-nl1_sony_d
index 5528f9e..98a5673 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-nl1_sony_d
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-nl1_sony_d
@@ -1,17 +1,18 @@
-0, 0, 38016, 0xc805351d
-0, 3600, 38016, 0x3809fec3
-0, 7200, 38016, 0xf698ce3c
-0, 10800, 38016, 0x7e3da603
-0, 14400, 38016, 0x68b07d81
-0, 18000, 38016, 0xd91f717a
-0, 21600, 38016, 0x48885dd6
-0, 25200, 38016, 0x27e64e8e
-0, 28800, 38016, 0x955835ce
-0, 32400, 38016, 0xf19940a0
-0, 36000, 38016, 0x9a1c51e4
-0, 39600, 38016, 0xf59373af
-0, 43200, 38016, 0x5d6c7d06
-0, 46800, 38016, 0x32fca533
-0, 50400, 38016, 0x37e69987
-0, 54000, 38016, 0x96929e05
-0, 57600, 38016, 0xee37a1f9
+#tb 0: 1/25
+0, 0, 0, 1, 38016, 0xc805351d
+0, 1, 1, 1, 38016, 0x3809fec3
+0, 2, 2, 1, 38016, 0xf698ce3c
+0, 3, 3, 1, 38016, 0x7e3da603
+0, 4, 4, 1, 38016, 0x68b07d81
+0, 5, 5, 1, 38016, 0xd91f717a
+0, 6, 6, 1, 38016, 0x48885dd6
+0, 7, 7, 1, 38016, 0x27e64e8e
+0, 8, 8, 1, 38016, 0x955835ce
+0, 9, 9, 1, 38016, 0xf19940a0
+0, 10, 10, 1, 38016, 0x9a1c51e4
+0, 11, 11, 1, 38016, 0xf59373af
+0, 12, 12, 1, 38016, 0x5d6c7d06
+0, 13, 13, 1, 38016, 0x32fca533
+0, 14, 14, 1, 38016, 0x37e69987
+0, 15, 15, 1, 38016, 0x96929e05
+0, 16, 16, 1, 38016, 0xee37a1f9
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-nl2_sony_h b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-nl2_sony_h
index 41d811f..73eb858 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-nl2_sony_h
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-nl2_sony_h
@@ -1,300 +1,301 @@
-0, 0, 38016, 0xc805351d
-0, 3600, 38016, 0x320510a8
-0, 7200, 38016, 0x3ef6e4c6
-0, 10800, 38016, 0x3b94c5e0
-0, 14400, 38016, 0x4be4a689
-0, 18000, 38016, 0x70919210
-0, 21600, 38016, 0x78a07b5a
-0, 25200, 38016, 0x8bd86efc
-0, 28800, 38016, 0xe3976cab
-0, 32400, 38016, 0x77fa735e
-0, 36000, 38016, 0x62488adb
-0, 39600, 38016, 0x5b07a6a4
-0, 43200, 38016, 0x7058b15f
-0, 46800, 38016, 0xa22dc9e2
-0, 50400, 38016, 0xc9d5cae3
-0, 54000, 38016, 0x16cbd6e1
-0, 57600, 38016, 0x4b23d9e9
-0, 61200, 38016, 0x96f7d798
-0, 64800, 38016, 0xdbcdcfdd
-0, 68400, 38016, 0x9314b847
-0, 72000, 38016, 0x0a209c28
-0, 75600, 38016, 0x6c757322
-0, 79200, 38016, 0x3d1a6376
-0, 82800, 38016, 0x155f5df7
-0, 86400, 38016, 0xd4446441
-0, 90000, 38016, 0xe1006713
-0, 93600, 38016, 0x5d226a3e
-0, 97200, 38016, 0xe839790c
-0, 100800, 38016, 0xa28c8b9a
-0, 104400, 38016, 0xde469f7a
-0, 108000, 38016, 0xf800b7ad
-0, 111600, 38016, 0xf2f9ccac
-0, 115200, 38016, 0x60feeb52
-0, 118800, 38016, 0xad39fd4f
-0, 122400, 38016, 0x4075fce6
-0, 126000, 38016, 0x5f2f036e
-0, 129600, 38016, 0x3e180450
-0, 133200, 38016, 0xd806fc04
-0, 136800, 38016, 0x3f15fbc6
-0, 140400, 38016, 0xb881faa4
-0, 144000, 38016, 0xf1cafdc8
-0, 147600, 38016, 0xd881f881
-0, 151200, 38016, 0x6314fdc8
-0, 154800, 38016, 0x8fa6f0d3
-0, 158400, 38016, 0x90d0f40d
-0, 162000, 38016, 0x1d30ee93
-0, 165600, 38016, 0x87f6ecca
-0, 169200, 38016, 0xca9ae712
-0, 172800, 38016, 0x02c6eb47
-0, 176400, 38016, 0xc263f492
-0, 180000, 38016, 0x717def51
-0, 183600, 38016, 0x0d3af240
-0, 187200, 38016, 0xc232ea7d
-0, 190800, 38016, 0x3c41f195
-0, 194400, 38016, 0x5d77f7fb
-0, 198000, 38016, 0x2901fb90
-0, 201600, 38016, 0x3b35033e
-0, 205200, 38016, 0xca4d034f
-0, 208800, 38016, 0x1e730e22
-0, 212400, 38016, 0x69b60d52
-0, 216000, 38016, 0xe50107bc
-0, 219600, 38016, 0x44b6f25f
-0, 223200, 38016, 0x222ebc66
-0, 226800, 38016, 0x165b7bca
-0, 230400, 38016, 0x12a37e44
-0, 234000, 38016, 0xcce9a1dc
-0, 237600, 38016, 0x273dd1a9
-0, 241200, 38016, 0x72b00e90
-0, 244800, 38016, 0x449a4fa6
-0, 248400, 38016, 0x203d8582
-0, 252000, 38016, 0x3fa7aaeb
-0, 255600, 38016, 0x0b47d491
-0, 259200, 38016, 0x1fa70639
-0, 262800, 38016, 0xf9fe391e
-0, 266400, 38016, 0x91c6786c
-0, 270000, 38016, 0x7ab99bb2
-0, 273600, 38016, 0x73f2c0f5
-0, 277200, 38016, 0xcffad748
-0, 280800, 38016, 0xe2b0ee34
-0, 284400, 38016, 0x6025f6d6
-0, 288000, 38016, 0xd722017c
-0, 291600, 38016, 0x321f0c24
-0, 295200, 38016, 0x336f0e81
-0, 298800, 38016, 0x783a012f
-0, 302400, 38016, 0x134cf484
-0, 306000, 38016, 0xec4bf2db
-0, 309600, 38016, 0xb481012e
-0, 313200, 38016, 0x76ff026c
-0, 316800, 38016, 0xaf3b102a
-0, 320400, 38016, 0x2eaf0bd6
-0, 324000, 38016, 0x39b8f833
-0, 327600, 38016, 0xe928d7ea
-0, 331200, 38016, 0xbe7ac2f8
-0, 334800, 38016, 0x3683b5c4
-0, 338400, 38016, 0xb3559d1c
-0, 342000, 38016, 0x73fb9f71
-0, 345600, 38016, 0x3e97b5aa
-0, 349200, 38016, 0x0c9dc525
-0, 352800, 38016, 0xecead941
-0, 356400, 38016, 0x4999e247
-0, 360000, 38016, 0x11ddea7c
-0, 363600, 38016, 0x4882cf24
-0, 367200, 38016, 0xae9ac0c6
-0, 370800, 38016, 0x4f88b589
-0, 374400, 38016, 0xc677d43f
-0, 378000, 38016, 0x5f46f219
-0, 381600, 38016, 0x5c1ffa13
-0, 385200, 38016, 0x162e11a3
-0, 388800, 38016, 0xd0b631d4
-0, 392400, 38016, 0x7133441a
-0, 396000, 38016, 0xbb085604
-0, 399600, 38016, 0x54a960d2
-0, 403200, 38016, 0xc0b468e7
-0, 406800, 38016, 0xe1ef485a
-0, 410400, 38016, 0x025f27e6
-0, 414000, 38016, 0x14da215e
-0, 417600, 38016, 0xe8f2394a
-0, 421200, 38016, 0x7c7a44e8
-0, 424800, 38016, 0xdb2e54c3
-0, 428400, 38016, 0xae5c5eee
-0, 432000, 38016, 0x74ae643f
-0, 435600, 38016, 0x70146b61
-0, 439200, 38016, 0x545c5265
-0, 442800, 38016, 0xe5a92556
-0, 446400, 38016, 0xf19e04e8
-0, 450000, 38016, 0xda51e574
-0, 453600, 38016, 0x4c17ded9
-0, 457200, 38016, 0x51fce958
-0, 460800, 38016, 0xae96fd16
-0, 464400, 38016, 0x7a610e32
-0, 468000, 38016, 0x06f31a06
-0, 471600, 38016, 0x658a1998
-0, 475200, 38016, 0xda370e80
-0, 478800, 38016, 0xe7a00dca
-0, 482400, 38016, 0xb07a0810
-0, 486000, 38016, 0x193c01a3
-0, 489600, 38016, 0xa700fd8f
-0, 493200, 38016, 0x8c14ed46
-0, 496800, 38016, 0xcd81dc72
-0, 500400, 38016, 0x67acd3bb
-0, 504000, 38016, 0x662cc586
-0, 507600, 38016, 0xa09ac106
-0, 511200, 38016, 0xf1abab73
-0, 514800, 38016, 0xfd9ba674
-0, 518400, 38016, 0x7686ae41
-0, 522000, 38016, 0x7185a2e9
-0, 525600, 38016, 0x2b5898da
-0, 529200, 38016, 0x3cdd6c42
-0, 532800, 38016, 0x0299414d
-0, 536400, 38016, 0x2b851a52
-0, 540000, 38016, 0x01c8ff7b
-0, 543600, 38016, 0x55d3f715
-0, 547200, 38016, 0xbe5ff38e
-0, 550800, 38016, 0xc31fe232
-0, 554400, 38016, 0x3201dc26
-0, 558000, 38016, 0xf8feed84
-0, 561600, 38016, 0x0a471009
-0, 565200, 38016, 0xef0d351d
-0, 568800, 38016, 0x79de6f09
-0, 572400, 38016, 0xa5039be4
-0, 576000, 38016, 0x4e1cafa6
-0, 579600, 38016, 0x2a71aea1
-0, 583200, 38016, 0xa99e9d08
-0, 586800, 38016, 0x80aa8a6a
-0, 590400, 38016, 0x9f287bb9
-0, 594000, 38016, 0x2ddc5ef7
-0, 597600, 38016, 0x31843470
-0, 601200, 38016, 0x08f3074e
-0, 604800, 38016, 0xa639e58d
-0, 608400, 38016, 0xcf31d61f
-0, 612000, 38016, 0x1ac7e986
-0, 615600, 38016, 0x9bbbfe98
-0, 619200, 38016, 0x3e0d0ce1
-0, 622800, 38016, 0x53240e4c
-0, 626400, 38016, 0xda6bf0d5
-0, 630000, 38016, 0x1701c355
-0, 633600, 38016, 0x572c8b1d
-0, 637200, 38016, 0x1f4f5a14
-0, 640800, 38016, 0x0fea3e61
-0, 644400, 38016, 0xa71c29ed
-0, 648000, 38016, 0xd3b218fb
-0, 651600, 38016, 0x228e05f8
-0, 655200, 38016, 0x4b8bfa9e
-0, 658800, 38016, 0x13d505ab
-0, 662400, 38016, 0xa58808b3
-0, 666000, 38016, 0x4b2a1329
-0, 669600, 38016, 0x13c63567
-0, 673200, 38016, 0x4ece56f8
-0, 676800, 38016, 0x934f67c3
-0, 680400, 38016, 0x2b606f56
-0, 684000, 38016, 0xba481841
-0, 687600, 38016, 0x1488ea11
-0, 691200, 38016, 0x066cefeb
-0, 694800, 38016, 0xb23105b7
-0, 698400, 38016, 0x64312267
-0, 702000, 38016, 0xd0cf6a37
-0, 705600, 38016, 0xb5a482c5
-0, 709200, 38016, 0x61289957
-0, 712800, 38016, 0x26a6ba47
-0, 716400, 38016, 0xb771d25e
-0, 720000, 38016, 0xedb5de8d
-0, 723600, 38016, 0x4fd2e829
-0, 727200, 38016, 0xbef3ef1f
-0, 730800, 38016, 0x5e0ef333
-0, 734400, 38016, 0x5081f460
-0, 738000, 38016, 0x6798fe84
-0, 741600, 38016, 0x28ce0078
-0, 745200, 38016, 0x9fb4f6a1
-0, 748800, 38016, 0x0a02e822
-0, 752400, 38016, 0x5615d41e
-0, 756000, 38016, 0x1a3bc214
-0, 759600, 38016, 0x5333b48a
-0, 763200, 38016, 0x646da3c9
-0, 766800, 38016, 0x024fa1b1
-0, 770400, 38016, 0x7b4892de
-0, 774000, 38016, 0x10ab8953
-0, 777600, 38016, 0x8aa28410
-0, 781200, 38016, 0xcbd185be
-0, 784800, 38016, 0xfa49818a
-0, 788400, 38016, 0x0f7a82d5
-0, 792000, 38016, 0xb86f716d
-0, 795600, 38016, 0xd22a6050
-0, 799200, 38016, 0x89a4520e
-0, 802800, 38016, 0x8a1147cf
-0, 806400, 38016, 0xa02a4196
-0, 810000, 38016, 0xece240f7
-0, 813600, 38016, 0xa5b940ff
-0, 817200, 38016, 0x9b274ce8
-0, 820800, 38016, 0xba0b68c7
-0, 824400, 38016, 0x39f28a91
-0, 828000, 38016, 0xc070af11
-0, 831600, 38016, 0x2a26d309
-0, 835200, 38016, 0xfa9afe77
-0, 838800, 38016, 0xe2f22ebf
-0, 842400, 38016, 0xf8ee4a45
-0, 846000, 38016, 0x14186047
-0, 849600, 38016, 0xe3407152
-0, 853200, 38016, 0xcef578b8
-0, 856800, 38016, 0x3fc06964
-0, 860400, 38016, 0xa7da3ade
-0, 864000, 38016, 0xa46d1b2b
-0, 867600, 38016, 0x14abfac5
-0, 871200, 38016, 0xbffbf269
-0, 874800, 38016, 0x1d9c3ade
-0, 878400, 38016, 0xc9c39c46
-0, 882000, 38016, 0x824afa80
-0, 885600, 38016, 0xc76611b8
-0, 889200, 38016, 0x31fce0d6
-0, 892800, 38016, 0x6740a03f
-0, 896400, 38016, 0x91d63134
-0, 900000, 38016, 0xb0f6cc86
-0, 903600, 38016, 0x3d878a14
-0, 907200, 38016, 0x1d008063
-0, 910800, 38016, 0xe47cd260
-0, 914400, 38016, 0x56503400
-0, 918000, 38016, 0xb201dc61
-0, 921600, 38016, 0xba42de1b
-0, 925200, 38016, 0x9c115ccb
-0, 928800, 38016, 0xe9be47d9
-0, 932400, 38016, 0xa7684b02
-0, 936000, 38016, 0xb4d74f42
-0, 939600, 38016, 0xbe006415
-0, 943200, 38016, 0xa30c7858
-0, 946800, 38016, 0x838f7f47
-0, 950400, 38016, 0xc1c28346
-0, 954000, 38016, 0xc7737219
-0, 957600, 38016, 0xa19a5fd5
-0, 961200, 38016, 0x56a64b00
-0, 964800, 38016, 0x6b672497
-0, 968400, 38016, 0x4cfafbe2
-0, 972000, 38016, 0xbe53d51b
-0, 975600, 38016, 0x4a86acc7
-0, 979200, 38016, 0x297288b0
-0, 982800, 38016, 0xd4bd2ec9
-0, 986400, 38016, 0x3697e2f6
-0, 990000, 38016, 0xa493d289
-0, 993600, 38016, 0xb2b9e324
-0, 997200, 38016, 0x998de275
-0, 1000800, 38016, 0x422a10cb
-0, 1004400, 38016, 0x845383b4
-0, 1008000, 38016, 0xb4a72107
-0, 1011600, 38016, 0x0e0eef6b
-0, 1015200, 38016, 0xbd8bbd01
-0, 1018800, 38016, 0x2f217c45
-0, 1022400, 38016, 0xb3515be7
-0, 1026000, 38016, 0xb633a542
-0, 1029600, 38016, 0x7e7a7086
-0, 1033200, 38016, 0xef64a834
-0, 1036800, 38016, 0x7b81bdad
-0, 1040400, 38016, 0x0fc7a7d2
-0, 1044000, 38016, 0x9111351d
-0, 1047600, 38016, 0x161c43dc
-0, 1051200, 38016, 0x945fce2a
-0, 1054800, 38016, 0x48780c38
-0, 1058400, 38016, 0x28904d31
-0, 1062000, 38016, 0x140d47d5
-0, 1065600, 38016, 0x1f5e257c
-0, 1069200, 38016, 0xb36a159c
-0, 1072800, 38016, 0x85ad2465
-0, 1076400, 38016, 0x973649e0
+#tb 0: 1/25
+0, 0, 0, 1, 38016, 0xc805351d
+0, 1, 1, 1, 38016, 0x320510a8
+0, 2, 2, 1, 38016, 0x3ef6e4c6
+0, 3, 3, 1, 38016, 0x3b94c5e0
+0, 4, 4, 1, 38016, 0x4be4a689
+0, 5, 5, 1, 38016, 0x70919210
+0, 6, 6, 1, 38016, 0x78a07b5a
+0, 7, 7, 1, 38016, 0x8bd86efc
+0, 8, 8, 1, 38016, 0xe3976cab
+0, 9, 9, 1, 38016, 0x77fa735e
+0, 10, 10, 1, 38016, 0x62488adb
+0, 11, 11, 1, 38016, 0x5b07a6a4
+0, 12, 12, 1, 38016, 0x7058b15f
+0, 13, 13, 1, 38016, 0xa22dc9e2
+0, 14, 14, 1, 38016, 0xc9d5cae3
+0, 15, 15, 1, 38016, 0x16cbd6e1
+0, 16, 16, 1, 38016, 0x4b23d9e9
+0, 17, 17, 1, 38016, 0x96f7d798
+0, 18, 18, 1, 38016, 0xdbcdcfdd
+0, 19, 19, 1, 38016, 0x9314b847
+0, 20, 20, 1, 38016, 0x0a209c28
+0, 21, 21, 1, 38016, 0x6c757322
+0, 22, 22, 1, 38016, 0x3d1a6376
+0, 23, 23, 1, 38016, 0x155f5df7
+0, 24, 24, 1, 38016, 0xd4446441
+0, 25, 25, 1, 38016, 0xe1006713
+0, 26, 26, 1, 38016, 0x5d226a3e
+0, 27, 27, 1, 38016, 0xe839790c
+0, 28, 28, 1, 38016, 0xa28c8b9a
+0, 29, 29, 1, 38016, 0xde469f7a
+0, 30, 30, 1, 38016, 0xf800b7ad
+0, 31, 31, 1, 38016, 0xf2f9ccac
+0, 32, 32, 1, 38016, 0x60feeb52
+0, 33, 33, 1, 38016, 0xad39fd4f
+0, 34, 34, 1, 38016, 0x4075fce6
+0, 35, 35, 1, 38016, 0x5f2f036e
+0, 36, 36, 1, 38016, 0x3e180450
+0, 37, 37, 1, 38016, 0xd806fc04
+0, 38, 38, 1, 38016, 0x3f15fbc6
+0, 39, 39, 1, 38016, 0xb881faa4
+0, 40, 40, 1, 38016, 0xf1cafdc8
+0, 41, 41, 1, 38016, 0xd881f881
+0, 42, 42, 1, 38016, 0x6314fdc8
+0, 43, 43, 1, 38016, 0x8fa6f0d3
+0, 44, 44, 1, 38016, 0x90d0f40d
+0, 45, 45, 1, 38016, 0x1d30ee93
+0, 46, 46, 1, 38016, 0x87f6ecca
+0, 47, 47, 1, 38016, 0xca9ae712
+0, 48, 48, 1, 38016, 0x02c6eb47
+0, 49, 49, 1, 38016, 0xc263f492
+0, 50, 50, 1, 38016, 0x717def51
+0, 51, 51, 1, 38016, 0x0d3af240
+0, 52, 52, 1, 38016, 0xc232ea7d
+0, 53, 53, 1, 38016, 0x3c41f195
+0, 54, 54, 1, 38016, 0x5d77f7fb
+0, 55, 55, 1, 38016, 0x2901fb90
+0, 56, 56, 1, 38016, 0x3b35033e
+0, 57, 57, 1, 38016, 0xca4d034f
+0, 58, 58, 1, 38016, 0x1e730e22
+0, 59, 59, 1, 38016, 0x69b60d52
+0, 60, 60, 1, 38016, 0xe50107bc
+0, 61, 61, 1, 38016, 0x44b6f25f
+0, 62, 62, 1, 38016, 0x222ebc66
+0, 63, 63, 1, 38016, 0x165b7bca
+0, 64, 64, 1, 38016, 0x12a37e44
+0, 65, 65, 1, 38016, 0xcce9a1dc
+0, 66, 66, 1, 38016, 0x273dd1a9
+0, 67, 67, 1, 38016, 0x72b00e90
+0, 68, 68, 1, 38016, 0x449a4fa6
+0, 69, 69, 1, 38016, 0x203d8582
+0, 70, 70, 1, 38016, 0x3fa7aaeb
+0, 71, 71, 1, 38016, 0x0b47d491
+0, 72, 72, 1, 38016, 0x1fa70639
+0, 73, 73, 1, 38016, 0xf9fe391e
+0, 74, 74, 1, 38016, 0x91c6786c
+0, 75, 75, 1, 38016, 0x7ab99bb2
+0, 76, 76, 1, 38016, 0x73f2c0f5
+0, 77, 77, 1, 38016, 0xcffad748
+0, 78, 78, 1, 38016, 0xe2b0ee34
+0, 79, 79, 1, 38016, 0x6025f6d6
+0, 80, 80, 1, 38016, 0xd722017c
+0, 81, 81, 1, 38016, 0x321f0c24
+0, 82, 82, 1, 38016, 0x336f0e81
+0, 83, 83, 1, 38016, 0x783a012f
+0, 84, 84, 1, 38016, 0x134cf484
+0, 85, 85, 1, 38016, 0xec4bf2db
+0, 86, 86, 1, 38016, 0xb481012e
+0, 87, 87, 1, 38016, 0x76ff026c
+0, 88, 88, 1, 38016, 0xaf3b102a
+0, 89, 89, 1, 38016, 0x2eaf0bd6
+0, 90, 90, 1, 38016, 0x39b8f833
+0, 91, 91, 1, 38016, 0xe928d7ea
+0, 92, 92, 1, 38016, 0xbe7ac2f8
+0, 93, 93, 1, 38016, 0x3683b5c4
+0, 94, 94, 1, 38016, 0xb3559d1c
+0, 95, 95, 1, 38016, 0x73fb9f71
+0, 96, 96, 1, 38016, 0x3e97b5aa
+0, 97, 97, 1, 38016, 0x0c9dc525
+0, 98, 98, 1, 38016, 0xecead941
+0, 99, 99, 1, 38016, 0x4999e247
+0, 100, 100, 1, 38016, 0x11ddea7c
+0, 101, 101, 1, 38016, 0x4882cf24
+0, 102, 102, 1, 38016, 0xae9ac0c6
+0, 103, 103, 1, 38016, 0x4f88b589
+0, 104, 104, 1, 38016, 0xc677d43f
+0, 105, 105, 1, 38016, 0x5f46f219
+0, 106, 106, 1, 38016, 0x5c1ffa13
+0, 107, 107, 1, 38016, 0x162e11a3
+0, 108, 108, 1, 38016, 0xd0b631d4
+0, 109, 109, 1, 38016, 0x7133441a
+0, 110, 110, 1, 38016, 0xbb085604
+0, 111, 111, 1, 38016, 0x54a960d2
+0, 112, 112, 1, 38016, 0xc0b468e7
+0, 113, 113, 1, 38016, 0xe1ef485a
+0, 114, 114, 1, 38016, 0x025f27e6
+0, 115, 115, 1, 38016, 0x14da215e
+0, 116, 116, 1, 38016, 0xe8f2394a
+0, 117, 117, 1, 38016, 0x7c7a44e8
+0, 118, 118, 1, 38016, 0xdb2e54c3
+0, 119, 119, 1, 38016, 0xae5c5eee
+0, 120, 120, 1, 38016, 0x74ae643f
+0, 121, 121, 1, 38016, 0x70146b61
+0, 122, 122, 1, 38016, 0x545c5265
+0, 123, 123, 1, 38016, 0xe5a92556
+0, 124, 124, 1, 38016, 0xf19e04e8
+0, 125, 125, 1, 38016, 0xda51e574
+0, 126, 126, 1, 38016, 0x4c17ded9
+0, 127, 127, 1, 38016, 0x51fce958
+0, 128, 128, 1, 38016, 0xae96fd16
+0, 129, 129, 1, 38016, 0x7a610e32
+0, 130, 130, 1, 38016, 0x06f31a06
+0, 131, 131, 1, 38016, 0x658a1998
+0, 132, 132, 1, 38016, 0xda370e80
+0, 133, 133, 1, 38016, 0xe7a00dca
+0, 134, 134, 1, 38016, 0xb07a0810
+0, 135, 135, 1, 38016, 0x193c01a3
+0, 136, 136, 1, 38016, 0xa700fd8f
+0, 137, 137, 1, 38016, 0x8c14ed46
+0, 138, 138, 1, 38016, 0xcd81dc72
+0, 139, 139, 1, 38016, 0x67acd3bb
+0, 140, 140, 1, 38016, 0x662cc586
+0, 141, 141, 1, 38016, 0xa09ac106
+0, 142, 142, 1, 38016, 0xf1abab73
+0, 143, 143, 1, 38016, 0xfd9ba674
+0, 144, 144, 1, 38016, 0x7686ae41
+0, 145, 145, 1, 38016, 0x7185a2e9
+0, 146, 146, 1, 38016, 0x2b5898da
+0, 147, 147, 1, 38016, 0x3cdd6c42
+0, 148, 148, 1, 38016, 0x0299414d
+0, 149, 149, 1, 38016, 0x2b851a52
+0, 150, 150, 1, 38016, 0x01c8ff7b
+0, 151, 151, 1, 38016, 0x55d3f715
+0, 152, 152, 1, 38016, 0xbe5ff38e
+0, 153, 153, 1, 38016, 0xc31fe232
+0, 154, 154, 1, 38016, 0x3201dc26
+0, 155, 155, 1, 38016, 0xf8feed84
+0, 156, 156, 1, 38016, 0x0a471009
+0, 157, 157, 1, 38016, 0xef0d351d
+0, 158, 158, 1, 38016, 0x79de6f09
+0, 159, 159, 1, 38016, 0xa5039be4
+0, 160, 160, 1, 38016, 0x4e1cafa6
+0, 161, 161, 1, 38016, 0x2a71aea1
+0, 162, 162, 1, 38016, 0xa99e9d08
+0, 163, 163, 1, 38016, 0x80aa8a6a
+0, 164, 164, 1, 38016, 0x9f287bb9
+0, 165, 165, 1, 38016, 0x2ddc5ef7
+0, 166, 166, 1, 38016, 0x31843470
+0, 167, 167, 1, 38016, 0x08f3074e
+0, 168, 168, 1, 38016, 0xa639e58d
+0, 169, 169, 1, 38016, 0xcf31d61f
+0, 170, 170, 1, 38016, 0x1ac7e986
+0, 171, 171, 1, 38016, 0x9bbbfe98
+0, 172, 172, 1, 38016, 0x3e0d0ce1
+0, 173, 173, 1, 38016, 0x53240e4c
+0, 174, 174, 1, 38016, 0xda6bf0d5
+0, 175, 175, 1, 38016, 0x1701c355
+0, 176, 176, 1, 38016, 0x572c8b1d
+0, 177, 177, 1, 38016, 0x1f4f5a14
+0, 178, 178, 1, 38016, 0x0fea3e61
+0, 179, 179, 1, 38016, 0xa71c29ed
+0, 180, 180, 1, 38016, 0xd3b218fb
+0, 181, 181, 1, 38016, 0x228e05f8
+0, 182, 182, 1, 38016, 0x4b8bfa9e
+0, 183, 183, 1, 38016, 0x13d505ab
+0, 184, 184, 1, 38016, 0xa58808b3
+0, 185, 185, 1, 38016, 0x4b2a1329
+0, 186, 186, 1, 38016, 0x13c63567
+0, 187, 187, 1, 38016, 0x4ece56f8
+0, 188, 188, 1, 38016, 0x934f67c3
+0, 189, 189, 1, 38016, 0x2b606f56
+0, 190, 190, 1, 38016, 0xba481841
+0, 191, 191, 1, 38016, 0x1488ea11
+0, 192, 192, 1, 38016, 0x066cefeb
+0, 193, 193, 1, 38016, 0xb23105b7
+0, 194, 194, 1, 38016, 0x64312267
+0, 195, 195, 1, 38016, 0xd0cf6a37
+0, 196, 196, 1, 38016, 0xb5a482c5
+0, 197, 197, 1, 38016, 0x61289957
+0, 198, 198, 1, 38016, 0x26a6ba47
+0, 199, 199, 1, 38016, 0xb771d25e
+0, 200, 200, 1, 38016, 0xedb5de8d
+0, 201, 201, 1, 38016, 0x4fd2e829
+0, 202, 202, 1, 38016, 0xbef3ef1f
+0, 203, 203, 1, 38016, 0x5e0ef333
+0, 204, 204, 1, 38016, 0x5081f460
+0, 205, 205, 1, 38016, 0x6798fe84
+0, 206, 206, 1, 38016, 0x28ce0078
+0, 207, 207, 1, 38016, 0x9fb4f6a1
+0, 208, 208, 1, 38016, 0x0a02e822
+0, 209, 209, 1, 38016, 0x5615d41e
+0, 210, 210, 1, 38016, 0x1a3bc214
+0, 211, 211, 1, 38016, 0x5333b48a
+0, 212, 212, 1, 38016, 0x646da3c9
+0, 213, 213, 1, 38016, 0x024fa1b1
+0, 214, 214, 1, 38016, 0x7b4892de
+0, 215, 215, 1, 38016, 0x10ab8953
+0, 216, 216, 1, 38016, 0x8aa28410
+0, 217, 217, 1, 38016, 0xcbd185be
+0, 218, 218, 1, 38016, 0xfa49818a
+0, 219, 219, 1, 38016, 0x0f7a82d5
+0, 220, 220, 1, 38016, 0xb86f716d
+0, 221, 221, 1, 38016, 0xd22a6050
+0, 222, 222, 1, 38016, 0x89a4520e
+0, 223, 223, 1, 38016, 0x8a1147cf
+0, 224, 224, 1, 38016, 0xa02a4196
+0, 225, 225, 1, 38016, 0xece240f7
+0, 226, 226, 1, 38016, 0xa5b940ff
+0, 227, 227, 1, 38016, 0x9b274ce8
+0, 228, 228, 1, 38016, 0xba0b68c7
+0, 229, 229, 1, 38016, 0x39f28a91
+0, 230, 230, 1, 38016, 0xc070af11
+0, 231, 231, 1, 38016, 0x2a26d309
+0, 232, 232, 1, 38016, 0xfa9afe77
+0, 233, 233, 1, 38016, 0xe2f22ebf
+0, 234, 234, 1, 38016, 0xf8ee4a45
+0, 235, 235, 1, 38016, 0x14186047
+0, 236, 236, 1, 38016, 0xe3407152
+0, 237, 237, 1, 38016, 0xcef578b8
+0, 238, 238, 1, 38016, 0x3fc06964
+0, 239, 239, 1, 38016, 0xa7da3ade
+0, 240, 240, 1, 38016, 0xa46d1b2b
+0, 241, 241, 1, 38016, 0x14abfac5
+0, 242, 242, 1, 38016, 0xbffbf269
+0, 243, 243, 1, 38016, 0x1d9c3ade
+0, 244, 244, 1, 38016, 0xc9c39c46
+0, 245, 245, 1, 38016, 0x824afa80
+0, 246, 246, 1, 38016, 0xc76611b8
+0, 247, 247, 1, 38016, 0x31fce0d6
+0, 248, 248, 1, 38016, 0x6740a03f
+0, 249, 249, 1, 38016, 0x91d63134
+0, 250, 250, 1, 38016, 0xb0f6cc86
+0, 251, 251, 1, 38016, 0x3d878a14
+0, 252, 252, 1, 38016, 0x1d008063
+0, 253, 253, 1, 38016, 0xe47cd260
+0, 254, 254, 1, 38016, 0x56503400
+0, 255, 255, 1, 38016, 0xb201dc61
+0, 256, 256, 1, 38016, 0xba42de1b
+0, 257, 257, 1, 38016, 0x9c115ccb
+0, 258, 258, 1, 38016, 0xe9be47d9
+0, 259, 259, 1, 38016, 0xa7684b02
+0, 260, 260, 1, 38016, 0xb4d74f42
+0, 261, 261, 1, 38016, 0xbe006415
+0, 262, 262, 1, 38016, 0xa30c7858
+0, 263, 263, 1, 38016, 0x838f7f47
+0, 264, 264, 1, 38016, 0xc1c28346
+0, 265, 265, 1, 38016, 0xc7737219
+0, 266, 266, 1, 38016, 0xa19a5fd5
+0, 267, 267, 1, 38016, 0x56a64b00
+0, 268, 268, 1, 38016, 0x6b672497
+0, 269, 269, 1, 38016, 0x4cfafbe2
+0, 270, 270, 1, 38016, 0xbe53d51b
+0, 271, 271, 1, 38016, 0x4a86acc7
+0, 272, 272, 1, 38016, 0x297288b0
+0, 273, 273, 1, 38016, 0xd4bd2ec9
+0, 274, 274, 1, 38016, 0x3697e2f6
+0, 275, 275, 1, 38016, 0xa493d289
+0, 276, 276, 1, 38016, 0xb2b9e324
+0, 277, 277, 1, 38016, 0x998de275
+0, 278, 278, 1, 38016, 0x422a10cb
+0, 279, 279, 1, 38016, 0x845383b4
+0, 280, 280, 1, 38016, 0xb4a72107
+0, 281, 281, 1, 38016, 0x0e0eef6b
+0, 282, 282, 1, 38016, 0xbd8bbd01
+0, 283, 283, 1, 38016, 0x2f217c45
+0, 284, 284, 1, 38016, 0xb3515be7
+0, 285, 285, 1, 38016, 0xb633a542
+0, 286, 286, 1, 38016, 0x7e7a7086
+0, 287, 287, 1, 38016, 0xef64a834
+0, 288, 288, 1, 38016, 0x7b81bdad
+0, 289, 289, 1, 38016, 0x0fc7a7d2
+0, 290, 290, 1, 38016, 0x9111351d
+0, 291, 291, 1, 38016, 0x161c43dc
+0, 292, 292, 1, 38016, 0x945fce2a
+0, 293, 293, 1, 38016, 0x48780c38
+0, 294, 294, 1, 38016, 0x28904d31
+0, 295, 295, 1, 38016, 0x140d47d5
+0, 296, 296, 1, 38016, 0x1f5e257c
+0, 297, 297, 1, 38016, 0xb36a159c
+0, 298, 298, 1, 38016, 0x85ad2465
+0, 299, 299, 1, 38016, 0x973649e0
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-nl3_sva_e b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-nl3_sva_e
index 4664afb..a4d6db6 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-nl3_sva_e
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-nl3_sva_e
@@ -1,33 +1,34 @@
-0, 0, 38016, 0x2fad15e2
-0, 3600, 38016, 0x7e391566
-0, 7200, 38016, 0x954001d4
-0, 10800, 38016, 0xe5ae2057
-0, 14400, 38016, 0xface3d5e
-0, 18000, 38016, 0x2b2361cd
-0, 21600, 38016, 0x5e906b5a
-0, 25200, 38016, 0xa46398e5
-0, 28800, 38016, 0x2a3ea141
-0, 32400, 38016, 0xa2a0beac
-0, 36000, 38016, 0x4830ab90
-0, 39600, 38016, 0xdd53d0fc
-0, 43200, 38016, 0x4d71ae7d
-0, 46800, 38016, 0x2290a25e
-0, 50400, 38016, 0x8baa6cca
-0, 54000, 38016, 0xc3e99458
-0, 57600, 38016, 0x5c608374
-0, 61200, 38016, 0x6443aa6c
-0, 64800, 38016, 0x1ef7991c
-0, 68400, 38016, 0xd246b49b
-0, 72000, 38016, 0xe181a026
-0, 75600, 38016, 0x878db497
-0, 79200, 38016, 0x071079c2
-0, 82800, 38016, 0xa94a62fa
-0, 86400, 38016, 0xa9da278f
-0, 90000, 38016, 0x247b3195
-0, 93600, 38016, 0xd7f81a90
-0, 97200, 38016, 0x9c303cdc
-0, 100800, 38016, 0x646e42a1
-0, 104400, 38016, 0x474a613d
-0, 108000, 38016, 0x63255932
-0, 111600, 38016, 0x2f0569e4
-0, 115200, 38016, 0x1f525192
+#tb 0: 1/25
+0, 0, 0, 1, 38016, 0x2fad15e2
+0, 1, 1, 1, 38016, 0x7e391566
+0, 2, 2, 1, 38016, 0x954001d4
+0, 3, 3, 1, 38016, 0xe5ae2057
+0, 4, 4, 1, 38016, 0xface3d5e
+0, 5, 5, 1, 38016, 0x2b2361cd
+0, 6, 6, 1, 38016, 0x5e906b5a
+0, 7, 7, 1, 38016, 0xa46398e5
+0, 8, 8, 1, 38016, 0x2a3ea141
+0, 9, 9, 1, 38016, 0xa2a0beac
+0, 10, 10, 1, 38016, 0x4830ab90
+0, 11, 11, 1, 38016, 0xdd53d0fc
+0, 12, 12, 1, 38016, 0x4d71ae7d
+0, 13, 13, 1, 38016, 0x2290a25e
+0, 14, 14, 1, 38016, 0x8baa6cca
+0, 15, 15, 1, 38016, 0xc3e99458
+0, 16, 16, 1, 38016, 0x5c608374
+0, 17, 17, 1, 38016, 0x6443aa6c
+0, 18, 18, 1, 38016, 0x1ef7991c
+0, 19, 19, 1, 38016, 0xd246b49b
+0, 20, 20, 1, 38016, 0xe181a026
+0, 21, 21, 1, 38016, 0x878db497
+0, 22, 22, 1, 38016, 0x071079c2
+0, 23, 23, 1, 38016, 0xa94a62fa
+0, 24, 24, 1, 38016, 0xa9da278f
+0, 25, 25, 1, 38016, 0x247b3195
+0, 26, 26, 1, 38016, 0xd7f81a90
+0, 27, 27, 1, 38016, 0x9c303cdc
+0, 28, 28, 1, 38016, 0x646e42a1
+0, 29, 29, 1, 38016, 0x474a613d
+0, 30, 30, 1, 38016, 0x63255932
+0, 31, 31, 1, 38016, 0x2f0569e4
+0, 32, 32, 1, 38016, 0x1f525192
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-nlmq1_jvc_c b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-nlmq1_jvc_c
index e9fca86..3030125 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-nlmq1_jvc_c
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-nlmq1_jvc_c
@@ -1,30 +1,31 @@
-0, 0, 38016, 0xde1a2194
-0, 3600, 38016, 0x2957f3e5
-0, 7200, 38016, 0x9df4c6cf
-0, 10800, 38016, 0xf3db9f2d
-0, 14400, 38016, 0xd97474db
-0, 18000, 38016, 0x8e3065fa
-0, 21600, 38016, 0xc0be49b1
-0, 25200, 38016, 0xa69c3f06
-0, 28800, 38016, 0x96bb2e92
-0, 32400, 38016, 0x1ca232c1
-0, 36000, 38016, 0x3a06409d
-0, 39600, 38016, 0xcdce66e5
-0, 43200, 38016, 0x96387681
-0, 46800, 38016, 0xd0309561
-0, 50400, 38016, 0xb7b08c49
-0, 54000, 38016, 0xf5709355
-0, 57600, 38016, 0x3c1594ea
-0, 61200, 38016, 0x9be48a2c
-0, 64800, 38016, 0xdf7279c3
-0, 68400, 38016, 0xe3b660f3
-0, 72000, 38016, 0xd72a3cbe
-0, 75600, 38016, 0x06a117d1
-0, 79200, 38016, 0x8f5501b7
-0, 82800, 38016, 0x8f5afd81
-0, 86400, 38016, 0x98ecfd2b
-0, 90000, 38016, 0xd0b103bf
-0, 93600, 38016, 0xb9a7035c
-0, 97200, 38016, 0x866c12c7
-0, 100800, 38016, 0x3a0329f3
-0, 104400, 38016, 0x725141c1
+#tb 0: 1/25
+0, 0, 0, 1, 38016, 0xde1a2194
+0, 1, 1, 1, 38016, 0x2957f3e5
+0, 2, 2, 1, 38016, 0x9df4c6cf
+0, 3, 3, 1, 38016, 0xf3db9f2d
+0, 4, 4, 1, 38016, 0xd97474db
+0, 5, 5, 1, 38016, 0x8e3065fa
+0, 6, 6, 1, 38016, 0xc0be49b1
+0, 7, 7, 1, 38016, 0xa69c3f06
+0, 8, 8, 1, 38016, 0x96bb2e92
+0, 9, 9, 1, 38016, 0x1ca232c1
+0, 10, 10, 1, 38016, 0x3a06409d
+0, 11, 11, 1, 38016, 0xcdce66e5
+0, 12, 12, 1, 38016, 0x96387681
+0, 13, 13, 1, 38016, 0xd0309561
+0, 14, 14, 1, 38016, 0xb7b08c49
+0, 15, 15, 1, 38016, 0xf5709355
+0, 16, 16, 1, 38016, 0x3c1594ea
+0, 17, 17, 1, 38016, 0x9be48a2c
+0, 18, 18, 1, 38016, 0xdf7279c3
+0, 19, 19, 1, 38016, 0xe3b660f3
+0, 20, 20, 1, 38016, 0xd72a3cbe
+0, 21, 21, 1, 38016, 0x06a117d1
+0, 22, 22, 1, 38016, 0x8f5501b7
+0, 23, 23, 1, 38016, 0x8f5afd81
+0, 24, 24, 1, 38016, 0x98ecfd2b
+0, 25, 25, 1, 38016, 0xd0b103bf
+0, 26, 26, 1, 38016, 0xb9a7035c
+0, 27, 27, 1, 38016, 0x866c12c7
+0, 28, 28, 1, 38016, 0x3a0329f3
+0, 29, 29, 1, 38016, 0x725141c1
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-nlmq2_jvc_c b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-nlmq2_jvc_c
index a2c7c5a..5258eb2 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-nlmq2_jvc_c
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-nlmq2_jvc_c
@@ -1,30 +1,31 @@
-0, 0, 38016, 0xde1a2194
-0, 3600, 38016, 0x8b6cf842
-0, 7200, 38016, 0x6dc7c88b
-0, 10800, 38016, 0xdaefa55d
-0, 14400, 38016, 0x61b77631
-0, 18000, 38016, 0xfd096789
-0, 21600, 38016, 0x69204c43
-0, 25200, 38016, 0x2c8e40c0
-0, 28800, 38016, 0xa4f33298
-0, 32400, 38016, 0x67193923
-0, 36000, 38016, 0x0b634893
-0, 39600, 38016, 0x7ced69e1
-0, 43200, 38016, 0xc20179dc
-0, 46800, 38016, 0x9d4d94b9
-0, 50400, 38016, 0xf4158e1a
-0, 54000, 38016, 0xf24b986a
-0, 57600, 38016, 0x3fd39baf
-0, 61200, 38016, 0xc0f991b9
-0, 64800, 38016, 0xe3a98216
-0, 68400, 38016, 0x37246882
-0, 72000, 38016, 0xad5745b0
-0, 75600, 38016, 0x42831ea7
-0, 79200, 38016, 0x14530a1b
-0, 82800, 38016, 0x1a9f03a8
-0, 86400, 38016, 0x34f905f3
-0, 90000, 38016, 0x94300e93
-0, 93600, 38016, 0xcda00be5
-0, 97200, 38016, 0x607516d6
-0, 100800, 38016, 0xabb02c3b
-0, 104400, 38016, 0xcf3746bf
+#tb 0: 1/25
+0, 0, 0, 1, 38016, 0xde1a2194
+0, 1, 1, 1, 38016, 0x8b6cf842
+0, 2, 2, 1, 38016, 0x6dc7c88b
+0, 3, 3, 1, 38016, 0xdaefa55d
+0, 4, 4, 1, 38016, 0x61b77631
+0, 5, 5, 1, 38016, 0xfd096789
+0, 6, 6, 1, 38016, 0x69204c43
+0, 7, 7, 1, 38016, 0x2c8e40c0
+0, 8, 8, 1, 38016, 0xa4f33298
+0, 9, 9, 1, 38016, 0x67193923
+0, 10, 10, 1, 38016, 0x0b634893
+0, 11, 11, 1, 38016, 0x7ced69e1
+0, 12, 12, 1, 38016, 0xc20179dc
+0, 13, 13, 1, 38016, 0x9d4d94b9
+0, 14, 14, 1, 38016, 0xf4158e1a
+0, 15, 15, 1, 38016, 0xf24b986a
+0, 16, 16, 1, 38016, 0x3fd39baf
+0, 17, 17, 1, 38016, 0xc0f991b9
+0, 18, 18, 1, 38016, 0xe3a98216
+0, 19, 19, 1, 38016, 0x37246882
+0, 20, 20, 1, 38016, 0xad5745b0
+0, 21, 21, 1, 38016, 0x42831ea7
+0, 22, 22, 1, 38016, 0x14530a1b
+0, 23, 23, 1, 38016, 0x1a9f03a8
+0, 24, 24, 1, 38016, 0x34f905f3
+0, 25, 25, 1, 38016, 0x94300e93
+0, 26, 26, 1, 38016, 0xcda00be5
+0, 27, 27, 1, 38016, 0x607516d6
+0, 28, 28, 1, 38016, 0xabb02c3b
+0, 29, 29, 1, 38016, 0xcf3746bf
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-nrf_mw_e b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-nrf_mw_e
index 425ee75..ee5f719 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-nrf_mw_e
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-nrf_mw_e
@@ -1,100 +1,101 @@
-0, 0, 38016, 0x3ae838ee
-0, 3600, 38016, 0x9ed7e141
-0, 7200, 38016, 0x354e83ed
-0, 10800, 38016, 0x96754ff4
-0, 14400, 38016, 0x2a013a3c
-0, 18000, 38016, 0x57ab4cf2
-0, 21600, 38016, 0x55037493
-0, 25200, 38016, 0x910b8920
-0, 28800, 38016, 0x457785a1
-0, 32400, 38016, 0x9d6864ad
-0, 36000, 38016, 0xe80131ce
-0, 39600, 38016, 0x4cd7f487
-0, 43200, 38016, 0x030df59a
-0, 46800, 38016, 0x6ea60426
-0, 50400, 38016, 0x35311f71
-0, 54000, 38016, 0x731450d8
-0, 57600, 38016, 0x29368c47
-0, 61200, 38016, 0x006292b0
-0, 64800, 38016, 0x961493b1
-0, 68400, 38016, 0xb2e99a07
-0, 72000, 38016, 0xa52f98be
-0, 75600, 38016, 0x8c0a8f70
-0, 79200, 38016, 0xdc5b992c
-0, 82800, 38016, 0xa4a49787
-0, 86400, 38016, 0x7a959608
-0, 90000, 38016, 0xc9619c0a
-0, 93600, 38016, 0xb5519a7e
-0, 97200, 38016, 0x05ea9d9b
-0, 100800, 38016, 0xf73fac90
-0, 104400, 38016, 0x0cd4b3d8
-0, 108000, 38016, 0xb3119df6
-0, 111600, 38016, 0xb8db5d78
-0, 115200, 38016, 0xfb633ee0
-0, 118800, 38016, 0xed1c8935
-0, 122400, 38016, 0x421fedd1
-0, 126000, 38016, 0xa4b84473
-0, 129600, 38016, 0x25598f81
-0, 133200, 38016, 0x92de1dd7
-0, 136800, 38016, 0x776b68c5
-0, 140400, 38016, 0x07b49a7a
-0, 144000, 38016, 0x883ccd79
-0, 147600, 38016, 0xb351e0fc
-0, 151200, 38016, 0x5577d53b
-0, 154800, 38016, 0xffd9ef7d
-0, 158400, 38016, 0x38c1fc8b
-0, 162000, 38016, 0xb9abf3e6
-0, 165600, 38016, 0x2191b0d6
-0, 169200, 38016, 0x313397a3
-0, 172800, 38016, 0x96bca02a
-0, 176400, 38016, 0xd39ac859
-0, 180000, 38016, 0xfb31e18f
-0, 183600, 38016, 0xe182b468
-0, 187200, 38016, 0x8af7dfd6
-0, 190800, 38016, 0x7c19fd4f
-0, 194400, 38016, 0xa8373bae
-0, 198000, 38016, 0x91055016
-0, 201600, 38016, 0x432b5d52
-0, 205200, 38016, 0x81301b3f
-0, 208800, 38016, 0x0d6c2367
-0, 212400, 38016, 0xf0023ac2
-0, 216000, 38016, 0xb9f33791
-0, 219600, 38016, 0xdab62201
-0, 223200, 38016, 0xfab7cfdd
-0, 226800, 38016, 0xfbb2a78f
-0, 230400, 38016, 0xe317c687
-0, 234000, 38016, 0xe4f5d939
-0, 237600, 38016, 0x022dda5b
-0, 241200, 38016, 0x8b5cdf2c
-0, 244800, 38016, 0x3dfec699
-0, 248400, 38016, 0x9484a75c
-0, 252000, 38016, 0x763a911b
-0, 255600, 38016, 0xb1fb7cc8
-0, 259200, 38016, 0x56bf7f7b
-0, 262800, 38016, 0x87567e3e
-0, 266400, 38016, 0x1aa1209e
-0, 270000, 38016, 0xe2b0da25
-0, 273600, 38016, 0xd250c706
-0, 277200, 38016, 0xbea1be9d
-0, 280800, 38016, 0x02f0e6fb
-0, 284400, 38016, 0xd18d382b
-0, 288000, 38016, 0xd0fa57f3
-0, 291600, 38016, 0x873b43e3
-0, 295200, 38016, 0x75b33855
-0, 298800, 38016, 0xcabbe932
-0, 302400, 38016, 0xeded9c0f
-0, 306000, 38016, 0x86b0b9ec
-0, 309600, 38016, 0xb461e10d
-0, 313200, 38016, 0x6702dbbe
-0, 316800, 38016, 0xb3e47c8c
-0, 320400, 38016, 0xd71333ee
-0, 324000, 38016, 0x15c3f15d
-0, 327600, 38016, 0xa7e6bb4e
-0, 331200, 38016, 0x5d5bd15b
-0, 334800, 38016, 0x2476f6b0
-0, 338400, 38016, 0xbee21b05
-0, 342000, 38016, 0x8172d7b9
-0, 345600, 38016, 0x4893b4b2
-0, 349200, 38016, 0xfda7ed23
-0, 352800, 38016, 0xc1ff4cb4
-0, 356400, 38016, 0x9fdc8cc4
+#tb 0: 1/25
+0, 0, 0, 1, 38016, 0x3ae838ee
+0, 1, 1, 1, 38016, 0x9ed7e141
+0, 2, 2, 1, 38016, 0x354e83ed
+0, 3, 3, 1, 38016, 0x96754ff4
+0, 4, 4, 1, 38016, 0x2a013a3c
+0, 5, 5, 1, 38016, 0x57ab4cf2
+0, 6, 6, 1, 38016, 0x55037493
+0, 7, 7, 1, 38016, 0x910b8920
+0, 8, 8, 1, 38016, 0x457785a1
+0, 9, 9, 1, 38016, 0x9d6864ad
+0, 10, 10, 1, 38016, 0xe80131ce
+0, 11, 11, 1, 38016, 0x4cd7f487
+0, 12, 12, 1, 38016, 0x030df59a
+0, 13, 13, 1, 38016, 0x6ea60426
+0, 14, 14, 1, 38016, 0x35311f71
+0, 15, 15, 1, 38016, 0x731450d8
+0, 16, 16, 1, 38016, 0x29368c47
+0, 17, 17, 1, 38016, 0x006292b0
+0, 18, 18, 1, 38016, 0x961493b1
+0, 19, 19, 1, 38016, 0xb2e99a07
+0, 20, 20, 1, 38016, 0xa52f98be
+0, 21, 21, 1, 38016, 0x8c0a8f70
+0, 22, 22, 1, 38016, 0xdc5b992c
+0, 23, 23, 1, 38016, 0xa4a49787
+0, 24, 24, 1, 38016, 0x7a959608
+0, 25, 25, 1, 38016, 0xc9619c0a
+0, 26, 26, 1, 38016, 0xb5519a7e
+0, 27, 27, 1, 38016, 0x05ea9d9b
+0, 28, 28, 1, 38016, 0xf73fac90
+0, 29, 29, 1, 38016, 0x0cd4b3d8
+0, 30, 30, 1, 38016, 0xb3119df6
+0, 31, 31, 1, 38016, 0xb8db5d78
+0, 32, 32, 1, 38016, 0xfb633ee0
+0, 33, 33, 1, 38016, 0xed1c8935
+0, 34, 34, 1, 38016, 0x421fedd1
+0, 35, 35, 1, 38016, 0xa4b84473
+0, 36, 36, 1, 38016, 0x25598f81
+0, 37, 37, 1, 38016, 0x92de1dd7
+0, 38, 38, 1, 38016, 0x776b68c5
+0, 39, 39, 1, 38016, 0x07b49a7a
+0, 40, 40, 1, 38016, 0x883ccd79
+0, 41, 41, 1, 38016, 0xb351e0fc
+0, 42, 42, 1, 38016, 0x5577d53b
+0, 43, 43, 1, 38016, 0xffd9ef7d
+0, 44, 44, 1, 38016, 0x38c1fc8b
+0, 45, 45, 1, 38016, 0xb9abf3e6
+0, 46, 46, 1, 38016, 0x2191b0d6
+0, 47, 47, 1, 38016, 0x313397a3
+0, 48, 48, 1, 38016, 0x96bca02a
+0, 49, 49, 1, 38016, 0xd39ac859
+0, 50, 50, 1, 38016, 0xfb31e18f
+0, 51, 51, 1, 38016, 0xe182b468
+0, 52, 52, 1, 38016, 0x8af7dfd6
+0, 53, 53, 1, 38016, 0x7c19fd4f
+0, 54, 54, 1, 38016, 0xa8373bae
+0, 55, 55, 1, 38016, 0x91055016
+0, 56, 56, 1, 38016, 0x432b5d52
+0, 57, 57, 1, 38016, 0x81301b3f
+0, 58, 58, 1, 38016, 0x0d6c2367
+0, 59, 59, 1, 38016, 0xf0023ac2
+0, 60, 60, 1, 38016, 0xb9f33791
+0, 61, 61, 1, 38016, 0xdab62201
+0, 62, 62, 1, 38016, 0xfab7cfdd
+0, 63, 63, 1, 38016, 0xfbb2a78f
+0, 64, 64, 1, 38016, 0xe317c687
+0, 65, 65, 1, 38016, 0xe4f5d939
+0, 66, 66, 1, 38016, 0x022dda5b
+0, 67, 67, 1, 38016, 0x8b5cdf2c
+0, 68, 68, 1, 38016, 0x3dfec699
+0, 69, 69, 1, 38016, 0x9484a75c
+0, 70, 70, 1, 38016, 0x763a911b
+0, 71, 71, 1, 38016, 0xb1fb7cc8
+0, 72, 72, 1, 38016, 0x56bf7f7b
+0, 73, 73, 1, 38016, 0x87567e3e
+0, 74, 74, 1, 38016, 0x1aa1209e
+0, 75, 75, 1, 38016, 0xe2b0da25
+0, 76, 76, 1, 38016, 0xd250c706
+0, 77, 77, 1, 38016, 0xbea1be9d
+0, 78, 78, 1, 38016, 0x02f0e6fb
+0, 79, 79, 1, 38016, 0xd18d382b
+0, 80, 80, 1, 38016, 0xd0fa57f3
+0, 81, 81, 1, 38016, 0x873b43e3
+0, 82, 82, 1, 38016, 0x75b33855
+0, 83, 83, 1, 38016, 0xcabbe932
+0, 84, 84, 1, 38016, 0xeded9c0f
+0, 85, 85, 1, 38016, 0x86b0b9ec
+0, 86, 86, 1, 38016, 0xb461e10d
+0, 87, 87, 1, 38016, 0x6702dbbe
+0, 88, 88, 1, 38016, 0xb3e47c8c
+0, 89, 89, 1, 38016, 0xd71333ee
+0, 90, 90, 1, 38016, 0x15c3f15d
+0, 91, 91, 1, 38016, 0xa7e6bb4e
+0, 92, 92, 1, 38016, 0x5d5bd15b
+0, 93, 93, 1, 38016, 0x2476f6b0
+0, 94, 94, 1, 38016, 0xbee21b05
+0, 95, 95, 1, 38016, 0x8172d7b9
+0, 96, 96, 1, 38016, 0x4893b4b2
+0, 97, 97, 1, 38016, 0xfda7ed23
+0, 98, 98, 1, 38016, 0xc1ff4cb4
+0, 99, 99, 1, 38016, 0x9fdc8cc4
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-sharp_mp_field_1_b b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-sharp_mp_field_1_b
index 7fc503e..8512102 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-sharp_mp_field_1_b
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-sharp_mp_field_1_b
@@ -1,15 +1,16 @@
-0, 0, 518400, 0xc93c7c47
-0, 3600, 518400, 0xa3f2e502
-0, 7200, 518400, 0xb98920a4
-0, 10800, 518400, 0xad098ec1
-0, 14400, 518400, 0x3009b7aa
-0, 18000, 518400, 0xcf514018
-0, 21600, 518400, 0xd869038d
-0, 25200, 518400, 0x3ce5e188
-0, 28800, 518400, 0x029b4c14
-0, 32400, 518400, 0xd2224afc
-0, 36000, 518400, 0xbbca027c
-0, 39600, 518400, 0x1f3fa0ac
-0, 43200, 518400, 0x823b0125
-0, 46800, 518400, 0xaaa27cfb
-0, 50400, 518400, 0x5e926a4a
+#tb 0: 1/25
+0, 0, 0, 1, 518400, 0xc93c7c47
+0, 1, 1, 1, 518400, 0xa3f2e502
+0, 2, 2, 1, 518400, 0xb98920a4
+0, 3, 3, 1, 518400, 0xad098ec1
+0, 4, 4, 1, 518400, 0x3009b7aa
+0, 5, 5, 1, 518400, 0xcf514018
+0, 6, 6, 1, 518400, 0xd869038d
+0, 7, 7, 1, 518400, 0x3ce5e188
+0, 8, 8, 1, 518400, 0x029b4c14
+0, 9, 9, 1, 518400, 0xd2224afc
+0, 10, 10, 1, 518400, 0xbbca027c
+0, 11, 11, 1, 518400, 0x1f3fa0ac
+0, 12, 12, 1, 518400, 0x823b0125
+0, 13, 13, 1, 518400, 0xaaa27cfb
+0, 14, 14, 1, 518400, 0x5e926a4a
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-sharp_mp_field_2_b b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-sharp_mp_field_2_b
index ec278fa..5808141 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-sharp_mp_field_2_b
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-sharp_mp_field_2_b
@@ -1,15 +1,16 @@
-0, 0, 518400, 0xc93c7c47
-0, 3600, 518400, 0xf0c4b44a
-0, 7200, 518400, 0x3f5dc91c
-0, 10800, 518400, 0x03dc8453
-0, 14400, 518400, 0x5e5227af
-0, 18000, 518400, 0x9e7136af
-0, 21600, 518400, 0x963a2e3a
-0, 25200, 518400, 0xa544be6c
-0, 28800, 518400, 0xefa1f63a
-0, 32400, 518400, 0x62155ff1
-0, 36000, 518400, 0x253eb857
-0, 39600, 518400, 0x73530327
-0, 43200, 518400, 0x8920c9a3
-0, 46800, 518400, 0x4bdd038c
-0, 50400, 518400, 0xea6016dd
+#tb 0: 1/25
+0, 0, 0, 1, 518400, 0xc93c7c47
+0, 1, 1, 1, 518400, 0xf0c4b44a
+0, 2, 2, 1, 518400, 0x3f5dc91c
+0, 3, 3, 1, 518400, 0x03dc8453
+0, 4, 4, 1, 518400, 0x5e5227af
+0, 5, 5, 1, 518400, 0x9e7136af
+0, 6, 6, 1, 518400, 0x963a2e3a
+0, 7, 7, 1, 518400, 0xa544be6c
+0, 8, 8, 1, 518400, 0xefa1f63a
+0, 9, 9, 1, 518400, 0x62155ff1
+0, 10, 10, 1, 518400, 0x253eb857
+0, 11, 11, 1, 518400, 0x73530327
+0, 12, 12, 1, 518400, 0x8920c9a3
+0, 13, 13, 1, 518400, 0x4bdd038c
+0, 14, 14, 1, 518400, 0xea6016dd
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-sharp_mp_field_3_b b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-sharp_mp_field_3_b
index efdd491..a572030 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-sharp_mp_field_3_b
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-sharp_mp_field_3_b
@@ -1,15 +1,16 @@
-0, 0, 518400, 0xc93c7c47
-0, 3600, 518400, 0x7112ac25
-0, 7200, 518400, 0x28bc28d2
-0, 10800, 518400, 0x6fc36875
-0, 14400, 518400, 0x3de99be0
-0, 18000, 518400, 0x97125499
-0, 21600, 518400, 0xb96fca3a
-0, 25200, 518400, 0x1ec56c0f
-0, 28800, 518400, 0xc65901d0
-0, 32400, 518400, 0x2baa1bfa
-0, 36000, 518400, 0x244fc6b7
-0, 39600, 518400, 0xc3536383
-0, 43200, 518400, 0xbcf40d5a
-0, 46800, 518400, 0x955f4734
-0, 50400, 518400, 0xe1b0275e
+#tb 0: 1/25
+0, 0, 0, 1, 518400, 0xc93c7c47
+0, 1, 1, 1, 518400, 0x7112ac25
+0, 2, 2, 1, 518400, 0x28bc28d2
+0, 3, 3, 1, 518400, 0x6fc36875
+0, 4, 4, 1, 518400, 0x3de99be0
+0, 5, 5, 1, 518400, 0x97125499
+0, 6, 6, 1, 518400, 0xb96fca3a
+0, 7, 7, 1, 518400, 0x1ec56c0f
+0, 8, 8, 1, 518400, 0xc65901d0
+0, 9, 9, 1, 518400, 0x2baa1bfa
+0, 10, 10, 1, 518400, 0x244fc6b7
+0, 11, 11, 1, 518400, 0xc3536383
+0, 12, 12, 1, 518400, 0xbcf40d5a
+0, 13, 13, 1, 518400, 0x955f4734
+0, 14, 14, 1, 518400, 0xe1b0275e
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-sharp_mp_paff_1r2 b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-sharp_mp_paff_1r2
index 0824132..d1a347f 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-sharp_mp_paff_1r2
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-sharp_mp_paff_1r2
@@ -1,15 +1,16 @@
-0, 0, 518400, 0xc93c7c47
-0, 3600, 518400, 0xfb452a9c
-0, 7200, 518400, 0x2f7a35bd
-0, 10800, 518400, 0xe63e30b9
-0, 14400, 518400, 0x39628205
-0, 18000, 518400, 0x17fa1ea4
-0, 21600, 518400, 0xd5ee83e2
-0, 25200, 518400, 0x611ee98d
-0, 28800, 518400, 0x07c1eeb8
-0, 32400, 518400, 0x9dff3418
-0, 36000, 518400, 0x87cd2f56
-0, 39600, 518400, 0x88675628
-0, 43200, 518400, 0x9bb8c9a0
-0, 46800, 518400, 0xe6c1df00
-0, 50400, 518400, 0xfcaab7a7
+#tb 0: 1/25
+0, 0, 0, 1, 518400, 0xc93c7c47
+0, 1, 1, 1, 518400, 0xfb452a9c
+0, 2, 2, 1, 518400, 0x2f7a35bd
+0, 3, 3, 1, 518400, 0xe63e30b9
+0, 4, 4, 1, 518400, 0x39628205
+0, 5, 5, 1, 518400, 0x17fa1ea4
+0, 6, 6, 1, 518400, 0xd5ee83e2
+0, 7, 7, 1, 518400, 0x611ee98d
+0, 8, 8, 1, 518400, 0x07c1eeb8
+0, 9, 9, 1, 518400, 0x9dff3418
+0, 10, 10, 1, 518400, 0x87cd2f56
+0, 11, 11, 1, 518400, 0x88675628
+0, 12, 12, 1, 518400, 0x9bb8c9a0
+0, 13, 13, 1, 518400, 0xe6c1df00
+0, 14, 14, 1, 518400, 0xfcaab7a7
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-sharp_mp_paff_2r b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-sharp_mp_paff_2r
index b41a131..f2bf06f 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-sharp_mp_paff_2r
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-sharp_mp_paff_2r
@@ -1,15 +1,16 @@
-0, 0, 518400, 0xc93c7c47
-0, 3600, 518400, 0xfb452a9c
-0, 7200, 518400, 0x2f7a35bd
-0, 10800, 518400, 0xe63e30b9
-0, 14400, 518400, 0x39628205
-0, 18000, 518400, 0x17fa1ea4
-0, 21600, 518400, 0xd5ee83e2
-0, 25200, 518400, 0x4fd6d5c9
-0, 28800, 518400, 0x8703c999
-0, 32400, 518400, 0x1a87e2d3
-0, 36000, 518400, 0xa27fc4d0
-0, 39600, 518400, 0x6effab5d
-0, 43200, 518400, 0x51ea02c9
-0, 46800, 518400, 0xbcf84c88
-0, 50400, 518400, 0x1d41076b
+#tb 0: 1/25
+0, 0, 0, 1, 518400, 0xc93c7c47
+0, 1, 1, 1, 518400, 0xfb452a9c
+0, 2, 2, 1, 518400, 0x2f7a35bd
+0, 3, 3, 1, 518400, 0xe63e30b9
+0, 4, 4, 1, 518400, 0x39628205
+0, 5, 5, 1, 518400, 0x17fa1ea4
+0, 6, 6, 1, 518400, 0xd5ee83e2
+0, 7, 7, 1, 518400, 0x4fd6d5c9
+0, 8, 8, 1, 518400, 0x8703c999
+0, 9, 9, 1, 518400, 0x1a87e2d3
+0, 10, 10, 1, 518400, 0xa27fc4d0
+0, 11, 11, 1, 518400, 0x6effab5d
+0, 12, 12, 1, 518400, 0x51ea02c9
+0, 13, 13, 1, 518400, 0xbcf84c88
+0, 14, 14, 1, 518400, 0x1d41076b
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-sl1_sva_b b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-sl1_sva_b
index b218a58..a2f16b4 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-sl1_sva_b
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-sl1_sva_b
@@ -1,33 +1,34 @@
-0, 0, 38016, 0x666c110c
-0, 3600, 38016, 0xc87421f6
-0, 7200, 38016, 0x1b74033d
-0, 10800, 38016, 0x21fe21c7
-0, 14400, 38016, 0x8f03321e
-0, 18000, 38016, 0xdbd46290
-0, 21600, 38016, 0x316a57d4
-0, 25200, 38016, 0x0a688f29
-0, 28800, 38016, 0x8bb890d5
-0, 32400, 38016, 0x4210c0a4
-0, 36000, 38016, 0x45f6b0e7
-0, 39600, 38016, 0x5feed346
-0, 43200, 38016, 0x22aea97e
-0, 46800, 38016, 0x8d96a049
-0, 50400, 38016, 0xe623654c
-0, 54000, 38016, 0xccd17c75
-0, 57600, 38016, 0x32ca7712
-0, 61200, 38016, 0x2fe49df2
-0, 64800, 38016, 0x6ee49068
-0, 68400, 38016, 0x74a0ba36
-0, 72000, 38016, 0x5079a13c
-0, 75600, 38016, 0xfd20a991
-0, 79200, 38016, 0xfc987386
-0, 82800, 38016, 0xa1f66a0b
-0, 86400, 38016, 0xd7112683
-0, 90000, 38016, 0xb60b3784
-0, 93600, 38016, 0x9e621ca3
-0, 97200, 38016, 0xd9264308
-0, 100800, 38016, 0x00db43fb
-0, 104400, 38016, 0x665a5b34
-0, 108000, 38016, 0x582050ce
-0, 111600, 38016, 0x52b95de5
-0, 115200, 38016, 0x95d8445e
+#tb 0: 1/25
+0, 0, 0, 1, 38016, 0x666c110c
+0, 1, 1, 1, 38016, 0xc87421f6
+0, 2, 2, 1, 38016, 0x1b74033d
+0, 3, 3, 1, 38016, 0x21fe21c7
+0, 4, 4, 1, 38016, 0x8f03321e
+0, 5, 5, 1, 38016, 0xdbd46290
+0, 6, 6, 1, 38016, 0x316a57d4
+0, 7, 7, 1, 38016, 0x0a688f29
+0, 8, 8, 1, 38016, 0x8bb890d5
+0, 9, 9, 1, 38016, 0x4210c0a4
+0, 10, 10, 1, 38016, 0x45f6b0e7
+0, 11, 11, 1, 38016, 0x5feed346
+0, 12, 12, 1, 38016, 0x22aea97e
+0, 13, 13, 1, 38016, 0x8d96a049
+0, 14, 14, 1, 38016, 0xe623654c
+0, 15, 15, 1, 38016, 0xccd17c75
+0, 16, 16, 1, 38016, 0x32ca7712
+0, 17, 17, 1, 38016, 0x2fe49df2
+0, 18, 18, 1, 38016, 0x6ee49068
+0, 19, 19, 1, 38016, 0x74a0ba36
+0, 20, 20, 1, 38016, 0x5079a13c
+0, 21, 21, 1, 38016, 0xfd20a991
+0, 22, 22, 1, 38016, 0xfc987386
+0, 23, 23, 1, 38016, 0xa1f66a0b
+0, 24, 24, 1, 38016, 0xd7112683
+0, 25, 25, 1, 38016, 0xb60b3784
+0, 26, 26, 1, 38016, 0x9e621ca3
+0, 27, 27, 1, 38016, 0xd9264308
+0, 28, 28, 1, 38016, 0x00db43fb
+0, 29, 29, 1, 38016, 0x665a5b34
+0, 30, 30, 1, 38016, 0x582050ce
+0, 31, 31, 1, 38016, 0x52b95de5
+0, 32, 32, 1, 38016, 0x95d8445e
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-sva_ba1_b b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-sva_ba1_b
index 0cb825a..cc55ac9 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-sva_ba1_b
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-sva_ba1_b
@@ -1,17 +1,18 @@
-0, 0, 38016, 0x359316a1
-0, 3600, 38016, 0xd5fafa54
-0, 7200, 38016, 0xea99e9be
-0, 10800, 38016, 0xd680f3db
-0, 14400, 38016, 0x8b771545
-0, 18000, 38016, 0xff8c3073
-0, 21600, 38016, 0x543d403a
-0, 25200, 38016, 0xd2136010
-0, 28800, 38016, 0x11d17cd3
-0, 32400, 38016, 0xd8c69527
-0, 36000, 38016, 0x070d9a08
-0, 39600, 38016, 0xc8e3b21d
-0, 43200, 38016, 0xe903b09e
-0, 46800, 38016, 0x30ba9ece
-0, 50400, 38016, 0xb32482a4
-0, 54000, 38016, 0x56cf8ea3
-0, 57600, 38016, 0x0b41abd0
+#tb 0: 1/25
+0, 0, 0, 1, 38016, 0x359316a1
+0, 1, 1, 1, 38016, 0xd5fafa54
+0, 2, 2, 1, 38016, 0xea99e9be
+0, 3, 3, 1, 38016, 0xd680f3db
+0, 4, 4, 1, 38016, 0x8b771545
+0, 5, 5, 1, 38016, 0xff8c3073
+0, 6, 6, 1, 38016, 0x543d403a
+0, 7, 7, 1, 38016, 0xd2136010
+0, 8, 8, 1, 38016, 0x11d17cd3
+0, 9, 9, 1, 38016, 0xd8c69527
+0, 10, 10, 1, 38016, 0x070d9a08
+0, 11, 11, 1, 38016, 0xc8e3b21d
+0, 12, 12, 1, 38016, 0xe903b09e
+0, 13, 13, 1, 38016, 0x30ba9ece
+0, 14, 14, 1, 38016, 0xb32482a4
+0, 15, 15, 1, 38016, 0x56cf8ea3
+0, 16, 16, 1, 38016, 0x0b41abd0
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-sva_ba2_d b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-sva_ba2_d
index 90337a2..b94086f 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-sva_ba2_d
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-sva_ba2_d
@@ -1,17 +1,18 @@
-0, 0, 38016, 0x359316a1
-0, 3600, 38016, 0xd7bb1285
-0, 7200, 38016, 0x3c36059f
-0, 10800, 38016, 0x983d195f
-0, 14400, 38016, 0xba323cc5
-0, 18000, 38016, 0xc9db4f32
-0, 21600, 38016, 0xc2a06817
-0, 25200, 38016, 0x18018392
-0, 28800, 38016, 0x8b4da14c
-0, 32400, 38016, 0x5a33b0f5
-0, 36000, 38016, 0x5b48b808
-0, 39600, 38016, 0xfc13c523
-0, 43200, 38016, 0xb915c169
-0, 46800, 38016, 0xfaab94ed
-0, 50400, 38016, 0xe455786f
-0, 54000, 38016, 0x529182a8
-0, 57600, 38016, 0xfb6893a9
+#tb 0: 1/25
+0, 0, 0, 1, 38016, 0x359316a1
+0, 1, 1, 1, 38016, 0xd7bb1285
+0, 2, 2, 1, 38016, 0x3c36059f
+0, 3, 3, 1, 38016, 0x983d195f
+0, 4, 4, 1, 38016, 0xba323cc5
+0, 5, 5, 1, 38016, 0xc9db4f32
+0, 6, 6, 1, 38016, 0xc2a06817
+0, 7, 7, 1, 38016, 0x18018392
+0, 8, 8, 1, 38016, 0x8b4da14c
+0, 9, 9, 1, 38016, 0x5a33b0f5
+0, 10, 10, 1, 38016, 0x5b48b808
+0, 11, 11, 1, 38016, 0xfc13c523
+0, 12, 12, 1, 38016, 0xb915c169
+0, 13, 13, 1, 38016, 0xfaab94ed
+0, 14, 14, 1, 38016, 0xe455786f
+0, 15, 15, 1, 38016, 0x529182a8
+0, 16, 16, 1, 38016, 0xfb6893a9
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-sva_base_b b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-sva_base_b
index 56cc9c6..30663ff 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-sva_base_b
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-sva_base_b
@@ -1,17 +1,18 @@
-0, 0, 38016, 0x1c131302
-0, 3600, 38016, 0xbbca0c4f
-0, 7200, 38016, 0x81f5fd7b
-0, 10800, 38016, 0xc8990c96
-0, 14400, 38016, 0xd4c337ce
-0, 18000, 38016, 0xc4544ee1
-0, 21600, 38016, 0x5de26832
-0, 25200, 38016, 0xc1fc7ba9
-0, 28800, 38016, 0x5fea9c67
-0, 32400, 38016, 0xfa0aaf63
-0, 36000, 38016, 0xa7f6c07d
-0, 39600, 38016, 0x11a0c6ff
-0, 43200, 38016, 0xfdefc3a0
-0, 46800, 38016, 0xdb729a49
-0, 50400, 38016, 0x9b5e7f0b
-0, 54000, 38016, 0x6a047ea9
-0, 57600, 38016, 0xd8c29302
+#tb 0: 1/25
+0, 0, 0, 1, 38016, 0x1c131302
+0, 1, 1, 1, 38016, 0xbbca0c4f
+0, 2, 2, 1, 38016, 0x81f5fd7b
+0, 3, 3, 1, 38016, 0xc8990c96
+0, 4, 4, 1, 38016, 0xd4c337ce
+0, 5, 5, 1, 38016, 0xc4544ee1
+0, 6, 6, 1, 38016, 0x5de26832
+0, 7, 7, 1, 38016, 0xc1fc7ba9
+0, 8, 8, 1, 38016, 0x5fea9c67
+0, 9, 9, 1, 38016, 0xfa0aaf63
+0, 10, 10, 1, 38016, 0xa7f6c07d
+0, 11, 11, 1, 38016, 0x11a0c6ff
+0, 12, 12, 1, 38016, 0xfdefc3a0
+0, 13, 13, 1, 38016, 0xdb729a49
+0, 14, 14, 1, 38016, 0x9b5e7f0b
+0, 15, 15, 1, 38016, 0x6a047ea9
+0, 16, 16, 1, 38016, 0xd8c29302
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-sva_cl1_e b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-sva_cl1_e
index af1dbab..27cba6d 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-sva_cl1_e
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-sva_cl1_e
@@ -1,50 +1,51 @@
-0, 0, 38016, 0x6811161f
-0, 3600, 38016, 0x243a0d4e
-0, 7200, 38016, 0x0bc700de
-0, 10800, 38016, 0x30db1659
-0, 14400, 38016, 0xf88d3f1a
-0, 18000, 38016, 0xb37d5bd2
-0, 21600, 38016, 0x93f46c04
-0, 25200, 38016, 0xdb9878d0
-0, 28800, 38016, 0x92509f3a
-0, 32400, 38016, 0xd63badea
-0, 36000, 38016, 0xb942b664
-0, 39600, 38016, 0x703bc4ee
-0, 43200, 38016, 0xa78abfcd
-0, 46800, 38016, 0x4e1b96d8
-0, 50400, 38016, 0xaed371ac
-0, 54000, 38016, 0x2c917f89
-0, 57600, 38016, 0x57c29c96
-0, 61200, 38016, 0xaf1fb16a
-0, 64800, 38016, 0x257eb325
-0, 68400, 38016, 0x7701b0f9
-0, 72000, 38016, 0x7074c151
-0, 75600, 38016, 0x9778b1fe
-0, 79200, 38016, 0x9c2e8c0c
-0, 82800, 38016, 0x394276e9
-0, 86400, 38016, 0x2f5157bc
-0, 90000, 38016, 0xfb313ee7
-0, 93600, 38016, 0xbc6349c3
-0, 97200, 38016, 0xdca95a0c
-0, 100800, 38016, 0x53c46d45
-0, 104400, 38016, 0x62867764
-0, 108000, 38016, 0x87847fa3
-0, 111600, 38016, 0x74527d90
-0, 115200, 38016, 0x5c7a7779
-0, 118800, 38016, 0xeafd7e73
-0, 122400, 38016, 0x63aa7d06
-0, 126000, 38016, 0x2bc06fd2
-0, 129600, 38016, 0x058a7eae
-0, 133200, 38016, 0xc51a6f85
-0, 136800, 38016, 0xb49e6b0b
-0, 140400, 38016, 0x881a5997
-0, 144000, 38016, 0x5e4956b7
-0, 147600, 38016, 0x835441a0
-0, 151200, 38016, 0x212933cd
-0, 154800, 38016, 0x914031bd
-0, 158400, 38016, 0x29b63d29
-0, 162000, 38016, 0x03a03b60
-0, 165600, 38016, 0x282e1a0f
-0, 169200, 38016, 0x8964f214
-0, 172800, 38016, 0x23a9c5f9
-0, 176400, 38016, 0x04f9a780
+#tb 0: 1/25
+0, 0, 0, 1, 38016, 0x6811161f
+0, 1, 1, 1, 38016, 0x243a0d4e
+0, 2, 2, 1, 38016, 0x0bc700de
+0, 3, 3, 1, 38016, 0x30db1659
+0, 4, 4, 1, 38016, 0xf88d3f1a
+0, 5, 5, 1, 38016, 0xb37d5bd2
+0, 6, 6, 1, 38016, 0x93f46c04
+0, 7, 7, 1, 38016, 0xdb9878d0
+0, 8, 8, 1, 38016, 0x92509f3a
+0, 9, 9, 1, 38016, 0xd63badea
+0, 10, 10, 1, 38016, 0xb942b664
+0, 11, 11, 1, 38016, 0x703bc4ee
+0, 12, 12, 1, 38016, 0xa78abfcd
+0, 13, 13, 1, 38016, 0x4e1b96d8
+0, 14, 14, 1, 38016, 0xaed371ac
+0, 15, 15, 1, 38016, 0x2c917f89
+0, 16, 16, 1, 38016, 0x57c29c96
+0, 17, 17, 1, 38016, 0xaf1fb16a
+0, 18, 18, 1, 38016, 0x257eb325
+0, 19, 19, 1, 38016, 0x7701b0f9
+0, 20, 20, 1, 38016, 0x7074c151
+0, 21, 21, 1, 38016, 0x9778b1fe
+0, 22, 22, 1, 38016, 0x9c2e8c0c
+0, 23, 23, 1, 38016, 0x394276e9
+0, 24, 24, 1, 38016, 0x2f5157bc
+0, 25, 25, 1, 38016, 0xfb313ee7
+0, 26, 26, 1, 38016, 0xbc6349c3
+0, 27, 27, 1, 38016, 0xdca95a0c
+0, 28, 28, 1, 38016, 0x53c46d45
+0, 29, 29, 1, 38016, 0x62867764
+0, 30, 30, 1, 38016, 0x87847fa3
+0, 31, 31, 1, 38016, 0x74527d90
+0, 32, 32, 1, 38016, 0x5c7a7779
+0, 33, 33, 1, 38016, 0xeafd7e73
+0, 34, 34, 1, 38016, 0x63aa7d06
+0, 35, 35, 1, 38016, 0x2bc06fd2
+0, 36, 36, 1, 38016, 0x058a7eae
+0, 37, 37, 1, 38016, 0xc51a6f85
+0, 38, 38, 1, 38016, 0xb49e6b0b
+0, 39, 39, 1, 38016, 0x881a5997
+0, 40, 40, 1, 38016, 0x5e4956b7
+0, 41, 41, 1, 38016, 0x835441a0
+0, 42, 42, 1, 38016, 0x212933cd
+0, 43, 43, 1, 38016, 0x914031bd
+0, 44, 44, 1, 38016, 0x29b63d29
+0, 45, 45, 1, 38016, 0x03a03b60
+0, 46, 46, 1, 38016, 0x282e1a0f
+0, 47, 47, 1, 38016, 0x8964f214
+0, 48, 48, 1, 38016, 0x23a9c5f9
+0, 49, 49, 1, 38016, 0x04f9a780
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-sva_fm1_e b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-sva_fm1_e
index f83a51b..0e5f3e0 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-sva_fm1_e
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-sva_fm1_e
@@ -1,17 +1,18 @@
-0, 0, 38016, 0x1c131302
-0, 3600, 38016, 0x89dd0c15
-0, 7200, 38016, 0xaf7700bd
-0, 10800, 38016, 0x220d1115
-0, 14400, 38016, 0x76d0354e
-0, 18000, 38016, 0x9e514b93
-0, 21600, 38016, 0x20ff5e7c
-0, 25200, 38016, 0xd9cb7e01
-0, 28800, 38016, 0x26b7992d
-0, 32400, 38016, 0xa29dac84
-0, 36000, 38016, 0x407cb6e8
-0, 39600, 38016, 0xe82cc064
-0, 43200, 38016, 0x63ddb80f
-0, 46800, 38016, 0xec6f93a1
-0, 50400, 38016, 0x5f217759
-0, 54000, 38016, 0x341982ba
-0, 57600, 38016, 0x3f48980c
+#tb 0: 1/25
+0, 0, 0, 1, 38016, 0x1c131302
+0, 1, 1, 1, 38016, 0x89dd0c15
+0, 2, 2, 1, 38016, 0xaf7700bd
+0, 3, 3, 1, 38016, 0x220d1115
+0, 4, 4, 1, 38016, 0x76d0354e
+0, 5, 5, 1, 38016, 0x9e514b93
+0, 6, 6, 1, 38016, 0x20ff5e7c
+0, 7, 7, 1, 38016, 0xd9cb7e01
+0, 8, 8, 1, 38016, 0x26b7992d
+0, 9, 9, 1, 38016, 0xa29dac84
+0, 10, 10, 1, 38016, 0x407cb6e8
+0, 11, 11, 1, 38016, 0xe82cc064
+0, 12, 12, 1, 38016, 0x63ddb80f
+0, 13, 13, 1, 38016, 0xec6f93a1
+0, 14, 14, 1, 38016, 0x5f217759
+0, 15, 15, 1, 38016, 0x341982ba
+0, 16, 16, 1, 38016, 0x3f48980c
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-sva_nl1_b b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-sva_nl1_b
index 074e656..f2033d8 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-sva_nl1_b
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-sva_nl1_b
@@ -1,17 +1,18 @@
-0, 0, 38016, 0xb9ac19bd
-0, 3600, 38016, 0x3898fc35
-0, 7200, 38016, 0xf6f4ed19
-0, 10800, 38016, 0xc31af64b
-0, 14400, 38016, 0x42161687
-0, 18000, 38016, 0xe88133a3
-0, 21600, 38016, 0xebb5415a
-0, 25200, 38016, 0x643c62ac
-0, 28800, 38016, 0x7ad68041
-0, 32400, 38016, 0x2625981b
-0, 36000, 38016, 0x1a839bbf
-0, 39600, 38016, 0xe41db3a9
-0, 43200, 38016, 0x894eb2dd
-0, 46800, 38016, 0x4633a2a2
-0, 50400, 38016, 0xeb848787
-0, 54000, 38016, 0x23c590b0
-0, 57600, 38016, 0xc7cbaf63
+#tb 0: 1/25
+0, 0, 0, 1, 38016, 0xb9ac19bd
+0, 1, 1, 1, 38016, 0x3898fc35
+0, 2, 2, 1, 38016, 0xf6f4ed19
+0, 3, 3, 1, 38016, 0xc31af64b
+0, 4, 4, 1, 38016, 0x42161687
+0, 5, 5, 1, 38016, 0xe88133a3
+0, 6, 6, 1, 38016, 0xebb5415a
+0, 7, 7, 1, 38016, 0x643c62ac
+0, 8, 8, 1, 38016, 0x7ad68041
+0, 9, 9, 1, 38016, 0x2625981b
+0, 10, 10, 1, 38016, 0x1a839bbf
+0, 11, 11, 1, 38016, 0xe41db3a9
+0, 12, 12, 1, 38016, 0x894eb2dd
+0, 13, 13, 1, 38016, 0x4633a2a2
+0, 14, 14, 1, 38016, 0xeb848787
+0, 15, 15, 1, 38016, 0x23c590b0
+0, 16, 16, 1, 38016, 0xc7cbaf63
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-sva_nl2_e b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-sva_nl2_e
index 6c0a40e..1770eff 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-conformance-sva_nl2_e
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-conformance-sva_nl2_e
@@ -1,17 +1,18 @@
-0, 0, 38016, 0xb9ac19bd
-0, 3600, 38016, 0x53c91566
-0, 7200, 38016, 0xb5bd089f
-0, 10800, 38016, 0xb81320bb
-0, 14400, 38016, 0x7c793dce
-0, 18000, 38016, 0x3d605b31
-0, 21600, 38016, 0x40216830
-0, 25200, 38016, 0x11c48f52
-0, 28800, 38016, 0x0f37a013
-0, 32400, 38016, 0xb06cb753
-0, 36000, 38016, 0x6233ca83
-0, 39600, 38016, 0x02b6d5a1
-0, 43200, 38016, 0xf76cc409
-0, 46800, 38016, 0xd19fa5c3
-0, 50400, 38016, 0x8d1c8a02
-0, 54000, 38016, 0x6802966d
-0, 57600, 38016, 0x107fb055
+#tb 0: 1/25
+0, 0, 0, 1, 38016, 0xb9ac19bd
+0, 1, 1, 1, 38016, 0x53c91566
+0, 2, 2, 1, 38016, 0xb5bd089f
+0, 3, 3, 1, 38016, 0xb81320bb
+0, 4, 4, 1, 38016, 0x7c793dce
+0, 5, 5, 1, 38016, 0x3d605b31
+0, 6, 6, 1, 38016, 0x40216830
+0, 7, 7, 1, 38016, 0x11c48f52
+0, 8, 8, 1, 38016, 0x0f37a013
+0, 9, 9, 1, 38016, 0xb06cb753
+0, 10, 10, 1, 38016, 0x6233ca83
+0, 11, 11, 1, 38016, 0x02b6d5a1
+0, 12, 12, 1, 38016, 0xf76cc409
+0, 13, 13, 1, 38016, 0xd19fa5c3
+0, 14, 14, 1, 38016, 0x8d1c8a02
+0, 15, 15, 1, 38016, 0x6802966d
+0, 16, 16, 1, 38016, 0x107fb055
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-extreme-plane-pred b/gst-libs/ext/libav/tests/ref/fate/h264-extreme-plane-pred
index d8bee85..db85e99 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-extreme-plane-pred
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-extreme-plane-pred
@@ -1,100 +1,101 @@
-0, 0, 152064, 1e857d2dfeea75297e090ffe9e37a249
-0, 3600, 152064, 29d8336b4e9b77298025074dbad641d1
-0, 7200, 152064, 3f1a87d2088a7708f4ed06890c8cd018
-0, 10800, 152064, 56b8b8d9fefbd501c4f7918f21f9b015
-0, 14400, 152064, 597392c162ea79af1e5d3dd552ffeb47
-0, 18000, 152064, 064fdd170aa24463409b1cb0ddc7f5b6
-0, 21600, 152064, 9924da4026b10110fa644039e73f92c1
-0, 25200, 152064, afdb77f4a4c87faaf35988bf2d1d7c18
-0, 28800, 152064, 80714dc3bf376f38c00f8c67fc534fae
-0, 32400, 152064, fb0ab4028e1e9879b0bf0e414c0ccb33
-0, 36000, 152064, 03c694f4b9e6116214078131f3edff91
-0, 39600, 152064, 22d2de0d8f9e5477230b50c50ec46269
-0, 43200, 152064, 470e9a6c5bbb15e151afbfd6b2f254a3
-0, 46800, 152064, b585555552169640b1a896094335b624
-0, 50400, 152064, e261e0f650e6d649a35773520e7f5bff
-0, 54000, 152064, 2d1bf889eef057016e473a041fbceac0
-0, 57600, 152064, b1a3f8ebf1de26bc8c32d47a4a53c862
-0, 61200, 152064, d5cdb80386dbb996ca007a0e210a9905
-0, 64800, 152064, 05a200df7b8baa19d2a0309476727dd7
-0, 68400, 152064, 890d62163f4aa70a2055d50de0395a35
-0, 72000, 152064, c00bdd1c5f0d69bae66ba46a897ad0ad
-0, 75600, 152064, 65f76c6d453822eb48b180ac630cbdce
-0, 79200, 152064, d6b85fc02c6d8efa53a9f0f148a0520e
-0, 82800, 152064, adcb1621c5100b8e201592328bcd11be
-0, 86400, 152064, bad7da936734cf4304c1564d6d3e74b9
-0, 90000, 152064, a98d1232d0c22e6967415700d980c67f
-0, 93600, 152064, 3fa1110c3ada7d37f0495a26774a58fb
-0, 97200, 152064, 37613c65cfd3d77e8dda3b5b913e467f
-0, 100800, 152064, 42a5cf583a82e722e04c04b10fd36542
-0, 104400, 152064, 41c2870e102e3584780cd0243baa1900
-0, 108000, 152064, da389397c874f5fd974c57278bd1e327
-0, 111600, 152064, 238c265971ef9144d3fe6bc95a2ea060
-0, 115200, 152064, 085c83a54aa9327e1e3ee76ffa337538
-0, 118800, 152064, f462966f59018b39c10f9a65a80a41f8
-0, 122400, 152064, 6e9697b7c8193b38551af4ef56861b7a
-0, 126000, 152064, e68113abf3e81a28cafd95d91871886e
-0, 129600, 152064, 35a78df5ac1ff6ee469626b750241c9b
-0, 133200, 152064, b3302a87e334634a9f92ce51acf96ab3
-0, 136800, 152064, 52198528552cefe90004a2b045b33e8f
-0, 140400, 152064, 12d9ad991d4bb7935342c8b6474d1726
-0, 144000, 152064, 2e6a508aba965f292c7b2e82bd0debbe
-0, 147600, 152064, 8daff69112bb5fbc0158cbbf7fbe057e
-0, 151200, 152064, 5495a0bb6c88a115957d98b272b0d643
-0, 154800, 152064, 955db92ab0c482381200247a207e12bc
-0, 158400, 152064, c0f81c5f95fd658c153798a514fedd22
-0, 162000, 152064, 3cfc7b9c2d73621cdb04d7e7e8bc2b3b
-0, 165600, 152064, e8b6d1d526d6443cba2e64ccd5393a4f
-0, 169200, 152064, 7722e2420db0279c9eb7c6f7dfa89c07
-0, 172800, 152064, 41b908a50b97a2e927f2e6e285e27592
-0, 176400, 152064, e05f0ddd08debc2a0578893662c33ce0
-0, 180000, 152064, 1edcedca921dbb68c0ce53371abddd8f
-0, 183600, 152064, cdbf0c89feb336e58472f0163e43b02b
-0, 187200, 152064, 39c4d20ecfeee09800feae5ad783e0bd
-0, 190800, 152064, f60d05d20b3f338aa5917490d2b58f77
-0, 194400, 152064, 76e5eae7a5205f6f6aaf8099197dbb1f
-0, 198000, 152064, f7c4c80e79b691826915b7810ab7c2a6
-0, 201600, 152064, afbc098dcaa8c2a3f41dfc3e846e8e7b
-0, 205200, 152064, 6582805bbe4ab9a9138a23deb2ca45a8
-0, 208800, 152064, 54444ce52dd1ce7bc24e9cbaba89dc59
-0, 212400, 152064, c81193469c0cd5a50c451d869e07a786
-0, 216000, 152064, 89f2295b63db3adce2961630569749a5
-0, 219600, 152064, 3f4d6dd4dd819168a358384d6b134d00
-0, 223200, 152064, 45d3b5c72609a15c1be5a45f790a24c4
-0, 226800, 152064, f2283a8bf9599754d2e251c5f0861199
-0, 230400, 152064, 06a9ccf8132c494884954bb4cc148c11
-0, 234000, 152064, e20e0143fc840db46a88a8556d887ea2
-0, 237600, 152064, bcb1ca471f70109293a15b7e1b0f3a7f
-0, 241200, 152064, 0c5f59f091b3fd5ced9bb626e5b66ec8
-0, 244800, 152064, 4dd6cf80daf74390afe0423f726c2fb6
-0, 248400, 152064, fd52e6d570960cf100ac7c973dbd222e
-0, 252000, 152064, 684758faa9b5517b2e5dbbabccc6125b
-0, 255600, 152064, e538a3bcb2125c8ac324a5be49470960
-0, 259200, 152064, 0c91795b7f52e942a1c28b4c6510c6fa
-0, 262800, 152064, b33315c61d714bd70d2adce3309633fe
-0, 266400, 152064, af2554b6b1d3f215641f85494a78ad3d
-0, 270000, 152064, e59b20b3b2c5ec215ea34ab4850f940e
-0, 273600, 152064, fb543e874bdd9749aaa710d1551e0ebd
-0, 277200, 152064, 4383abaf938da0282fecabed153bca0e
-0, 280800, 152064, 4ce40ffa75b42320593e40596c34862a
-0, 284400, 152064, f337d0cc81b5c1b1b92c3f367ed5f9cd
-0, 288000, 152064, 0f5a8c41fb7334811a485239d9126808
-0, 291600, 152064, 0daf3d981474940bdf10a93148d69353
-0, 295200, 152064, 21a51f1686071a6af7973df92361964b
-0, 298800, 152064, 1f0d471c7b1fa86f236c2dee32822464
-0, 302400, 152064, cedc6fd29d67976f899a6a8afba6b38d
-0, 306000, 152064, 4af936d3d3b456953c7beb551476824a
-0, 309600, 152064, bcaf539953adb1952fefc2cdec6c2f60
-0, 313200, 152064, d1dfeafa0939fddc256986c2b00f73c7
-0, 316800, 152064, 99c9a2c7b198e2c8cfe007ff4330f036
-0, 320400, 152064, 4db6a7edfc44389536983aeeb15edb66
-0, 324000, 152064, 8d840674b90e3b488a34e04645430ee7
-0, 327600, 152064, ad7b3e55a2eb62fc5102cc5af49301aa
-0, 331200, 152064, f24484a975ec64acb50df3e9f9e8eddd
-0, 334800, 152064, 5794617c7e40bfcb7f024bda2f2a991d
-0, 338400, 152064, ae1c22fcfa7f3b3b62dd2ace4e4b4dc7
-0, 342000, 152064, ad9d13345ae5322a578e43653e9a9c16
-0, 345600, 152064, be1b86ee130ea9255d9640117559818d
-0, 349200, 152064, 81ed195d2831e62fc2cd4fa886de8e20
-0, 352800, 152064, 8dde0af730b03ea8b3acd14d42daba04
-0, 356400, 152064, c8ffbd5ba1af8b881daf511e4d8c26f3
+#tb 0: 1/25
+0, 0, 0, 1, 152064, 1e857d2dfeea75297e090ffe9e37a249
+0, 1, 1, 1, 152064, 29d8336b4e9b77298025074dbad641d1
+0, 2, 2, 1, 152064, 3f1a87d2088a7708f4ed06890c8cd018
+0, 3, 3, 1, 152064, 56b8b8d9fefbd501c4f7918f21f9b015
+0, 4, 4, 1, 152064, 597392c162ea79af1e5d3dd552ffeb47
+0, 5, 5, 1, 152064, 064fdd170aa24463409b1cb0ddc7f5b6
+0, 6, 6, 1, 152064, 9924da4026b10110fa644039e73f92c1
+0, 7, 7, 1, 152064, afdb77f4a4c87faaf35988bf2d1d7c18
+0, 8, 8, 1, 152064, 80714dc3bf376f38c00f8c67fc534fae
+0, 9, 9, 1, 152064, fb0ab4028e1e9879b0bf0e414c0ccb33
+0, 10, 10, 1, 152064, 03c694f4b9e6116214078131f3edff91
+0, 11, 11, 1, 152064, 22d2de0d8f9e5477230b50c50ec46269
+0, 12, 12, 1, 152064, 470e9a6c5bbb15e151afbfd6b2f254a3
+0, 13, 13, 1, 152064, b585555552169640b1a896094335b624
+0, 14, 14, 1, 152064, e261e0f650e6d649a35773520e7f5bff
+0, 15, 15, 1, 152064, 2d1bf889eef057016e473a041fbceac0
+0, 16, 16, 1, 152064, b1a3f8ebf1de26bc8c32d47a4a53c862
+0, 17, 17, 1, 152064, d5cdb80386dbb996ca007a0e210a9905
+0, 18, 18, 1, 152064, 05a200df7b8baa19d2a0309476727dd7
+0, 19, 19, 1, 152064, 890d62163f4aa70a2055d50de0395a35
+0, 20, 20, 1, 152064, c00bdd1c5f0d69bae66ba46a897ad0ad
+0, 21, 21, 1, 152064, 65f76c6d453822eb48b180ac630cbdce
+0, 22, 22, 1, 152064, d6b85fc02c6d8efa53a9f0f148a0520e
+0, 23, 23, 1, 152064, adcb1621c5100b8e201592328bcd11be
+0, 24, 24, 1, 152064, bad7da936734cf4304c1564d6d3e74b9
+0, 25, 25, 1, 152064, a98d1232d0c22e6967415700d980c67f
+0, 26, 26, 1, 152064, 3fa1110c3ada7d37f0495a26774a58fb
+0, 27, 27, 1, 152064, 37613c65cfd3d77e8dda3b5b913e467f
+0, 28, 28, 1, 152064, 42a5cf583a82e722e04c04b10fd36542
+0, 29, 29, 1, 152064, 41c2870e102e3584780cd0243baa1900
+0, 30, 30, 1, 152064, da389397c874f5fd974c57278bd1e327
+0, 31, 31, 1, 152064, 238c265971ef9144d3fe6bc95a2ea060
+0, 32, 32, 1, 152064, 085c83a54aa9327e1e3ee76ffa337538
+0, 33, 33, 1, 152064, f462966f59018b39c10f9a65a80a41f8
+0, 34, 34, 1, 152064, 6e9697b7c8193b38551af4ef56861b7a
+0, 35, 35, 1, 152064, e68113abf3e81a28cafd95d91871886e
+0, 36, 36, 1, 152064, 35a78df5ac1ff6ee469626b750241c9b
+0, 37, 37, 1, 152064, b3302a87e334634a9f92ce51acf96ab3
+0, 38, 38, 1, 152064, 52198528552cefe90004a2b045b33e8f
+0, 39, 39, 1, 152064, 12d9ad991d4bb7935342c8b6474d1726
+0, 40, 40, 1, 152064, 2e6a508aba965f292c7b2e82bd0debbe
+0, 41, 41, 1, 152064, 8daff69112bb5fbc0158cbbf7fbe057e
+0, 42, 42, 1, 152064, 5495a0bb6c88a115957d98b272b0d643
+0, 43, 43, 1, 152064, 955db92ab0c482381200247a207e12bc
+0, 44, 44, 1, 152064, c0f81c5f95fd658c153798a514fedd22
+0, 45, 45, 1, 152064, 3cfc7b9c2d73621cdb04d7e7e8bc2b3b
+0, 46, 46, 1, 152064, e8b6d1d526d6443cba2e64ccd5393a4f
+0, 47, 47, 1, 152064, 7722e2420db0279c9eb7c6f7dfa89c07
+0, 48, 48, 1, 152064, 41b908a50b97a2e927f2e6e285e27592
+0, 49, 49, 1, 152064, e05f0ddd08debc2a0578893662c33ce0
+0, 50, 50, 1, 152064, 1edcedca921dbb68c0ce53371abddd8f
+0, 51, 51, 1, 152064, cdbf0c89feb336e58472f0163e43b02b
+0, 52, 52, 1, 152064, 39c4d20ecfeee09800feae5ad783e0bd
+0, 53, 53, 1, 152064, f60d05d20b3f338aa5917490d2b58f77
+0, 54, 54, 1, 152064, 76e5eae7a5205f6f6aaf8099197dbb1f
+0, 55, 55, 1, 152064, f7c4c80e79b691826915b7810ab7c2a6
+0, 56, 56, 1, 152064, afbc098dcaa8c2a3f41dfc3e846e8e7b
+0, 57, 57, 1, 152064, 6582805bbe4ab9a9138a23deb2ca45a8
+0, 58, 58, 1, 152064, 54444ce52dd1ce7bc24e9cbaba89dc59
+0, 59, 59, 1, 152064, c81193469c0cd5a50c451d869e07a786
+0, 60, 60, 1, 152064, 89f2295b63db3adce2961630569749a5
+0, 61, 61, 1, 152064, 3f4d6dd4dd819168a358384d6b134d00
+0, 62, 62, 1, 152064, 45d3b5c72609a15c1be5a45f790a24c4
+0, 63, 63, 1, 152064, f2283a8bf9599754d2e251c5f0861199
+0, 64, 64, 1, 152064, 06a9ccf8132c494884954bb4cc148c11
+0, 65, 65, 1, 152064, e20e0143fc840db46a88a8556d887ea2
+0, 66, 66, 1, 152064, bcb1ca471f70109293a15b7e1b0f3a7f
+0, 67, 67, 1, 152064, 0c5f59f091b3fd5ced9bb626e5b66ec8
+0, 68, 68, 1, 152064, 4dd6cf80daf74390afe0423f726c2fb6
+0, 69, 69, 1, 152064, fd52e6d570960cf100ac7c973dbd222e
+0, 70, 70, 1, 152064, 684758faa9b5517b2e5dbbabccc6125b
+0, 71, 71, 1, 152064, e538a3bcb2125c8ac324a5be49470960
+0, 72, 72, 1, 152064, 0c91795b7f52e942a1c28b4c6510c6fa
+0, 73, 73, 1, 152064, b33315c61d714bd70d2adce3309633fe
+0, 74, 74, 1, 152064, af2554b6b1d3f215641f85494a78ad3d
+0, 75, 75, 1, 152064, e59b20b3b2c5ec215ea34ab4850f940e
+0, 76, 76, 1, 152064, fb543e874bdd9749aaa710d1551e0ebd
+0, 77, 77, 1, 152064, 4383abaf938da0282fecabed153bca0e
+0, 78, 78, 1, 152064, 4ce40ffa75b42320593e40596c34862a
+0, 79, 79, 1, 152064, f337d0cc81b5c1b1b92c3f367ed5f9cd
+0, 80, 80, 1, 152064, 0f5a8c41fb7334811a485239d9126808
+0, 81, 81, 1, 152064, 0daf3d981474940bdf10a93148d69353
+0, 82, 82, 1, 152064, 21a51f1686071a6af7973df92361964b
+0, 83, 83, 1, 152064, 1f0d471c7b1fa86f236c2dee32822464
+0, 84, 84, 1, 152064, cedc6fd29d67976f899a6a8afba6b38d
+0, 85, 85, 1, 152064, 4af936d3d3b456953c7beb551476824a
+0, 86, 86, 1, 152064, bcaf539953adb1952fefc2cdec6c2f60
+0, 87, 87, 1, 152064, d1dfeafa0939fddc256986c2b00f73c7
+0, 88, 88, 1, 152064, 99c9a2c7b198e2c8cfe007ff4330f036
+0, 89, 89, 1, 152064, 4db6a7edfc44389536983aeeb15edb66
+0, 90, 90, 1, 152064, 8d840674b90e3b488a34e04645430ee7
+0, 91, 91, 1, 152064, ad7b3e55a2eb62fc5102cc5af49301aa
+0, 92, 92, 1, 152064, f24484a975ec64acb50df3e9f9e8eddd
+0, 93, 93, 1, 152064, 5794617c7e40bfcb7f024bda2f2a991d
+0, 94, 94, 1, 152064, ae1c22fcfa7f3b3b62dd2ace4e4b4dc7
+0, 95, 95, 1, 152064, ad9d13345ae5322a578e43653e9a9c16
+0, 96, 96, 1, 152064, be1b86ee130ea9255d9640117559818d
+0, 97, 97, 1, 152064, 81ed195d2831e62fc2cd4fa886de8e20
+0, 98, 98, 1, 152064, 8dde0af730b03ea8b3acd14d42daba04
+0, 99, 99, 1, 152064, c8ffbd5ba1af8b881daf511e4d8c26f3
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-interlace-crop b/gst-libs/ext/libav/tests/ref/fate/h264-interlace-crop
index 2202c08..81b979c 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-interlace-crop
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-interlace-crop
@@ -1,3 +1,4 @@
-0, 0, 345600, 0xa9cb7e5a
-0, 3600, 345600, 0x73e47555
-0, 7200, 345600, 0x87aac593
+#tb 0: 1/25
+0, 0, 0, 1, 345600, 0xa9cb7e5a
+0, 1, 1, 1, 345600, 0x73e47555
+0, 2, 2, 1, 345600, 0x87aac593
diff --git a/gst-libs/ext/libav/tests/ref/fate/h264-lossless b/gst-libs/ext/libav/tests/ref/fate/h264-lossless
index 30a70b5..11cc4d0 100644
--- a/gst-libs/ext/libav/tests/ref/fate/h264-lossless
+++ b/gst-libs/ext/libav/tests/ref/fate/h264-lossless
@@ -1,10 +1,11 @@
-0, 0, 460800, 0x7731dd2f
-0, 3600, 460800, 0x944b8c64
-0, 7200, 460800, 0xbe833041
-0, 10800, 460800, 0xbe95d96a
-0, 14400, 460800, 0xfe7ea5e6
-0, 18000, 460800, 0x381743c7
-0, 21600, 460800, 0x63fcc2e9
-0, 25200, 460800, 0x79574960
-0, 28800, 460800, 0xdab9e18a
-0, 32400, 460800, 0xd88e8fe8
+#tb 0: 1/25
+0, 0, 0, 1, 460800, 0x7731dd2f
+0, 1, 1, 1, 460800, 0x944b8c64
+0, 2, 2, 1, 460800, 0xbe833041
+0, 3, 3, 1, 460800, 0xbe95d96a
+0, 4, 4, 1, 460800, 0xfe7ea5e6
+0, 5, 5, 1, 460800, 0x381743c7
+0, 6, 6, 1, 460800, 0x63fcc2e9
+0, 7, 7, 1, 460800, 0x79574960
+0, 8, 8, 1, 460800, 0xdab9e18a
+0, 9, 9, 1, 460800, 0xd88e8fe8
diff --git a/gst-libs/ext/libav/tests/ref/fate/id-cin-video b/gst-libs/ext/libav/tests/ref/fate/id-cin-video
index 174cef8..241cae5 100644
--- a/gst-libs/ext/libav/tests/ref/fate/id-cin-video
+++ b/gst-libs/ext/libav/tests/ref/fate/id-cin-video
@@ -1,105 +1,107 @@
-0, 0, 230400, 0x00000000
-1, 0, 6300, 0xdd759df8
-0, 6429, 230400, 0x3a3486b4
-1, 6429, 6300, 0x43aa398c
-0, 12857, 230400, 0xb6a9b772
-1, 12857, 6300, 0x61a7b9fd
-0, 19286, 230400, 0x8e2d4c03
-1, 19286, 6300, 0xfc8adbc8
-0, 25714, 230400, 0x5df342a9
-1, 25714, 6300, 0x84c4dffc
-0, 32143, 230400, 0x00f95cc9
-1, 32143, 6300, 0x3044ede1
-0, 38571, 230400, 0x72ee1c4c
-1, 38571, 6300, 0x6de5b64c
-0, 45000, 230400, 0x2bd991e8
-1, 45000, 6300, 0x1d9df1b0
-0, 51429, 230400, 0x84cf471e
-1, 51429, 6300, 0xb5864b86
-0, 57857, 230400, 0x75253428
-1, 57857, 6300, 0xf2f7fbc2
-0, 64286, 230400, 0x57246d42
-1, 64286, 6300, 0xe61307a8
-0, 70714, 230400, 0x57246d42
-1, 70714, 6300, 0x07fcd607
-0, 77143, 230400, 0x57246d42
-1, 77143, 6300, 0xb8dfbdf6
-0, 83571, 230400, 0x7072be1b
-1, 83571, 6300, 0xf308e40c
-0, 90000, 230400, 0x2e9ffcf2
-1, 90000, 6300, 0xa6163aa8
-0, 96429, 230400, 0x2e9ffcf2
-1, 96429, 6300, 0x3f74c286
-0, 102857, 230400, 0x1a5cb24d
-1, 102857, 6300, 0xcece754c
-0, 109286, 230400, 0x1a06c797
-1, 109286, 6300, 0x7c5b47b9
-0, 115714, 230400, 0x9e51b953
-1, 115714, 6300, 0x3a7baf37
-0, 122143, 230400, 0x9e51b953
-1, 122143, 6300, 0x56fd368e
-0, 128571, 230400, 0x9e51b953
-1, 128571, 6300, 0x68db250e
-0, 135000, 230400, 0x9e51b953
-1, 135000, 6300, 0x37d2d710
-0, 141429, 230400, 0x9e51b953
-1, 141429, 6300, 0xf458b88e
-0, 147857, 230400, 0xccd7c68d
-1, 147857, 6300, 0xed38430f
-0, 154286, 230400, 0x776da8bc
-1, 154286, 6300, 0xd5982d28
-0, 160714, 230400, 0x495bec1c
-1, 160714, 6300, 0x17465fb3
-0, 167143, 230400, 0x495bec1c
-1, 167143, 6300, 0xe4591d73
-0, 173571, 230400, 0x495bec1c
-1, 173571, 6300, 0x4cbbf957
-0, 180000, 230400, 0x495bec1c
-1, 180000, 6300, 0x4f031f50
-0, 186429, 230400, 0x495bec1c
-1, 186429, 6300, 0xc03f8ca1
-0, 192857, 230400, 0x495bec1c
-1, 192857, 6300, 0x1f0d133c
-0, 199286, 230400, 0x495bec1c
-1, 199286, 6300, 0x18dbbeb4
-0, 205714, 230400, 0xa1cae3f3
-1, 205714, 6300, 0xef3fa45f
-0, 212143, 230400, 0x5cd567eb
-1, 212143, 6300, 0x7880f935
-0, 218571, 230400, 0x57bbfe30
-1, 218571, 6300, 0x5eeca5d5
-0, 225000, 230400, 0xc7763926
-1, 225000, 6300, 0xda99accc
-0, 231429, 230400, 0xc7763926
-1, 231429, 6300, 0x90aea270
-0, 237857, 230400, 0xc7763926
-1, 237857, 6300, 0x7fc9da4e
-0, 244286, 230400, 0xc7763926
-1, 244286, 6300, 0xb64d34d4
-0, 250714, 230400, 0xc7763926
-1, 250714, 6300, 0x385ed9e7
-0, 257143, 230400, 0xc7763926
-1, 257143, 6300, 0xd2f5be45
-0, 263571, 230400, 0xc7763926
-1, 263571, 6300, 0x763fa974
-0, 270000, 230400, 0x0e68cb2f
-1, 270000, 6300, 0x5a785ec4
-0, 276429, 230400, 0x1a5d96ba
-1, 276429, 6300, 0x2877c5a5
-0, 282857, 230400, 0xff3554f4
-1, 282857, 6300, 0x667e81a5
-0, 289286, 230400, 0x74438207
-1, 289286, 6300, 0xdcfeffeb
-0, 295714, 230400, 0x488de02d
-1, 295714, 6300, 0x1aae1606
-0, 302143, 230400, 0x488de02d
-1, 302143, 6300, 0x37e0550f
-0, 308571, 230400, 0x488de02d
-1, 308571, 6300, 0x018202e9
-0, 315000, 230400, 0x488de02d
-1, 315000, 6300, 0x2b13de85
-0, 321429, 230400, 0x488de02d
-1, 321429, 6300, 0xe3bfa403
-0, 327857, 230400, 0x488de02d
-1, 327857, 6300, 0x2c5bd9c9
-0, 334286, 230400, 0x488de02d
+#tb 0: 1/14
+#tb 1: 1/22050
+0, 0, 0, 1, 230400, 0x00000000
+1, 0, 0, 1575, 6300, 0xdd759df8
+0, 1, 1, 1, 230400, 0x3a3486b4
+1, 1575, 1575, 1575, 6300, 0x43aa398c
+0, 2, 2, 1, 230400, 0xb6a9b772
+1, 3150, 3150, 1575, 6300, 0x61a7b9fd
+0, 3, 3, 1, 230400, 0x8e2d4c03
+1, 4725, 4725, 1575, 6300, 0xfc8adbc8
+0, 4, 4, 1, 230400, 0x5df342a9
+1, 6300, 6300, 1575, 6300, 0x84c4dffc
+0, 5, 5, 1, 230400, 0x00f95cc9
+1, 7875, 7875, 1575, 6300, 0x3044ede1
+0, 6, 6, 1, 230400, 0x72ee1c4c
+1, 9450, 9450, 1575, 6300, 0x6de5b64c
+0, 7, 7, 1, 230400, 0x2bd991e8
+1, 11025, 11025, 1575, 6300, 0x1d9df1b0
+0, 8, 8, 1, 230400, 0x84cf471e
+1, 12600, 12600, 1575, 6300, 0xb5864b86
+0, 9, 9, 1, 230400, 0x75253428
+1, 14175, 14175, 1575, 6300, 0xf2f7fbc2
+0, 10, 10, 1, 230400, 0x57246d42
+1, 15750, 15750, 1575, 6300, 0xe61307a8
+0, 11, 11, 1, 230400, 0x57246d42
+1, 17325, 17325, 1575, 6300, 0x07fcd607
+0, 12, 12, 1, 230400, 0x57246d42
+1, 18900, 18900, 1575, 6300, 0xb8dfbdf6
+0, 13, 13, 1, 230400, 0x7072be1b
+1, 20475, 20475, 1575, 6300, 0xf308e40c
+0, 14, 14, 1, 230400, 0x2e9ffcf2
+1, 22050, 22050, 1575, 6300, 0xa6163aa8
+0, 15, 15, 1, 230400, 0x2e9ffcf2
+1, 23625, 23625, 1575, 6300, 0x3f74c286
+0, 16, 16, 1, 230400, 0x1a5cb24d
+1, 25200, 25200, 1575, 6300, 0xcece754c
+0, 17, 17, 1, 230400, 0x1a06c797
+1, 26775, 26775, 1575, 6300, 0x7c5b47b9
+0, 18, 18, 1, 230400, 0x9e51b953
+1, 28350, 28350, 1575, 6300, 0x3a7baf37
+0, 19, 19, 1, 230400, 0x9e51b953
+1, 29925, 29925, 1575, 6300, 0x56fd368e
+0, 20, 20, 1, 230400, 0x9e51b953
+1, 31500, 31500, 1575, 6300, 0x68db250e
+0, 21, 21, 1, 230400, 0x9e51b953
+1, 33075, 33075, 1575, 6300, 0x37d2d710
+0, 22, 22, 1, 230400, 0x9e51b953
+1, 34650, 34650, 1575, 6300, 0xf458b88e
+0, 23, 23, 1, 230400, 0xccd7c68d
+1, 36225, 36225, 1575, 6300, 0xed38430f
+0, 24, 24, 1, 230400, 0x776da8bc
+1, 37800, 37800, 1575, 6300, 0xd5982d28
+0, 25, 25, 1, 230400, 0x495bec1c
+1, 39375, 39375, 1575, 6300, 0x17465fb3
+0, 26, 26, 1, 230400, 0x495bec1c
+1, 40950, 40950, 1575, 6300, 0xe4591d73
+0, 27, 27, 1, 230400, 0x495bec1c
+1, 42525, 42525, 1575, 6300, 0x4cbbf957
+0, 28, 28, 1, 230400, 0x495bec1c
+1, 44100, 44100, 1575, 6300, 0x4f031f50
+0, 29, 29, 1, 230400, 0x495bec1c
+1, 45675, 45675, 1575, 6300, 0xc03f8ca1
+0, 30, 30, 1, 230400, 0x495bec1c
+1, 47250, 47250, 1575, 6300, 0x1f0d133c
+0, 31, 31, 1, 230400, 0x495bec1c
+1, 48825, 48825, 1575, 6300, 0x18dbbeb4
+0, 32, 32, 1, 230400, 0xa1cae3f3
+1, 50400, 50400, 1575, 6300, 0xef3fa45f
+0, 33, 33, 1, 230400, 0x5cd567eb
+1, 51975, 51975, 1575, 6300, 0x7880f935
+0, 34, 34, 1, 230400, 0x57bbfe30
+1, 53550, 53550, 1575, 6300, 0x5eeca5d5
+0, 35, 35, 1, 230400, 0xc7763926
+1, 55125, 55125, 1575, 6300, 0xda99accc
+0, 36, 36, 1, 230400, 0xc7763926
+1, 56700, 56700, 1575, 6300, 0x90aea270
+0, 37, 37, 1, 230400, 0xc7763926
+1, 58275, 58275, 1575, 6300, 0x7fc9da4e
+0, 38, 38, 1, 230400, 0xc7763926
+1, 59850, 59850, 1575, 6300, 0xb64d34d4
+0, 39, 39, 1, 230400, 0xc7763926
+1, 61425, 61425, 1575, 6300, 0x385ed9e7
+0, 40, 40, 1, 230400, 0xc7763926
+1, 63000, 63000, 1575, 6300, 0xd2f5be45
+0, 41, 41, 1, 230400, 0xc7763926
+1, 64575, 64575, 1575, 6300, 0x763fa974
+0, 42, 42, 1, 230400, 0x0e68cb2f
+1, 66150, 66150, 1575, 6300, 0x5a785ec4
+0, 43, 43, 1, 230400, 0x1a5d96ba
+1, 67725, 67725, 1575, 6300, 0x2877c5a5
+0, 44, 44, 1, 230400, 0xff3554f4
+1, 69300, 69300, 1575, 6300, 0x667e81a5
+0, 45, 45, 1, 230400, 0x74438207
+1, 70875, 70875, 1575, 6300, 0xdcfeffeb
+0, 46, 46, 1, 230400, 0x488de02d
+1, 72450, 72450, 1575, 6300, 0x1aae1606
+0, 47, 47, 1, 230400, 0x488de02d
+1, 74025, 74025, 1575, 6300, 0x37e0550f
+0, 48, 48, 1, 230400, 0x488de02d
+1, 75600, 75600, 1575, 6300, 0x018202e9
+0, 49, 49, 1, 230400, 0x488de02d
+1, 77175, 77175, 1575, 6300, 0x2b13de85
+0, 50, 50, 1, 230400, 0x488de02d
+1, 78750, 78750, 1575, 6300, 0xe3bfa403
+0, 51, 51, 1, 230400, 0x488de02d
+1, 80325, 80325, 1575, 6300, 0x2c5bd9c9
+0, 52, 52, 1, 230400, 0x488de02d
diff --git a/gst-libs/ext/libav/tests/ref/fate/idroq-video-encode b/gst-libs/ext/libav/tests/ref/fate/idroq-video-encode
index 4c89de8..badb06d 100644
--- a/gst-libs/ext/libav/tests/ref/fate/idroq-video-encode
+++ b/gst-libs/ext/libav/tests/ref/fate/idroq-video-encode
@@ -1 +1 @@
-75df9ce475c1b185fc3dbc219596edd3
+2ac89fa0e5600152667bcbc661f06cfe
diff --git a/gst-libs/ext/libav/tests/ref/fate/iff-byterun1 b/gst-libs/ext/libav/tests/ref/fate/iff-byterun1
index 8620c86..6f80c72 100644
--- a/gst-libs/ext/libav/tests/ref/fate/iff-byterun1
+++ b/gst-libs/ext/libav/tests/ref/fate/iff-byterun1
@@ -1 +1,2 @@
-0, 0, 230400, 0x35e51c62
+#tb 0: 1/90000
+0, 0, 0, 0, 230400, 0x35e51c62
diff --git a/gst-libs/ext/libav/tests/ref/fate/iff-ilbm b/gst-libs/ext/libav/tests/ref/fate/iff-ilbm
index eb253a0..a801aff 100644
--- a/gst-libs/ext/libav/tests/ref/fate/iff-ilbm
+++ b/gst-libs/ext/libav/tests/ref/fate/iff-ilbm
@@ -1 +1,2 @@
-0, 0, 230400, 0x0929e342
+#tb 0: 1/90000
+0, 0, 0, 0, 230400, 0x0929e342
diff --git a/gst-libs/ext/libav/tests/ref/fate/indeo2 b/gst-libs/ext/libav/tests/ref/fate/indeo2
index 49fabb4..9f80f35 100644
--- a/gst-libs/ext/libav/tests/ref/fate/indeo2
+++ b/gst-libs/ext/libav/tests/ref/fate/indeo2
@@ -1,130 +1,131 @@
-0, 0, 21600, 0x57a2ba42
-0, 6000, 21600, 0x61e09615
-0, 12000, 21600, 0x826e4e63
-0, 18000, 21600, 0x107716ec
-0, 24000, 21600, 0xb35ce1f4
-0, 30000, 21600, 0x12cab085
-0, 36000, 21600, 0x2f917f69
-0, 42000, 21600, 0x25aa3d6e
-0, 48000, 21600, 0xab1bfbed
-0, 54000, 21600, 0x9936dff9
-0, 60000, 21600, 0xc23cd8e5
-0, 66000, 21600, 0xa7ebbcaa
-0, 72000, 21600, 0xd4dda045
-0, 78000, 21600, 0xcbce6d7d
-0, 84000, 21600, 0x3cf35baf
-0, 90000, 21600, 0x16de6008
-0, 96000, 21600, 0x49d41acf
-0, 102001, 21600, 0x8c630034
-0, 108001, 21600, 0x0b310296
-0, 114001, 21600, 0x4887067d
-0, 120001, 21600, 0x1219f29e
-0, 126001, 21600, 0x3f3fc0c8
-0, 132001, 21600, 0x1bd1d0fc
-0, 138001, 21600, 0x913f9d4c
-0, 144001, 21600, 0x69e9a6b4
-0, 150001, 21600, 0xcc2e917f
-0, 156001, 21600, 0xf6967e30
-0, 162001, 21600, 0xdf816593
-0, 168001, 21600, 0xfd945b75
-0, 174001, 21600, 0x7d7e0224
-0, 180001, 21600, 0x7246f584
-0, 186001, 21600, 0x07b7ce82
-0, 192001, 21600, 0xee16c291
-0, 198001, 21600, 0xf4efb53a
-0, 204001, 21600, 0x2e73a208
-0, 210001, 21600, 0x1c2b6068
-0, 216001, 21600, 0x004250de
-0, 222001, 21600, 0x61d957d9
-0, 228001, 21600, 0x8b5d2cb0
-0, 234001, 21600, 0xc0a91fbc
-0, 240001, 21600, 0xa38108fc
-0, 246001, 21600, 0x551f03b9
-0, 252001, 21600, 0x93def5ca
-0, 258001, 21600, 0xe8ecf8bb
-0, 264001, 21600, 0x4c04fbb0
-0, 270001, 21600, 0x0e41dae4
-0, 276001, 21600, 0xca9fb0df
-0, 282001, 21600, 0xb123af19
-0, 288001, 21600, 0xfd59be7a
-0, 294001, 21600, 0x2c88b7a6
-0, 300002, 21600, 0x64cc9a1f
-0, 306002, 21600, 0x73d6a9ba
-0, 312002, 21600, 0x79198a11
-0, 318002, 21600, 0x0d4a8610
-0, 324002, 21600, 0x352e71bc
-0, 330002, 21600, 0x08aa627e
-0, 336002, 21600, 0xbee36e45
-0, 342002, 21600, 0x30de5c1b
-0, 348002, 21600, 0x21d75484
-0, 354002, 21600, 0xe0e91d52
-0, 360002, 21600, 0x678c2ebb
-0, 366002, 21600, 0x2080397b
-0, 372002, 21600, 0x7dbc1333
-0, 378002, 21600, 0x9c730ad0
-0, 384002, 21600, 0x4da50f55
-0, 390002, 21600, 0xdde5eaa7
-0, 396002, 21600, 0x949ed4fa
-0, 402002, 21600, 0x5d63bc54
-0, 408002, 21600, 0xc5dcba4f
-0, 414002, 21600, 0xd68caee1
-0, 420002, 21600, 0xf7409fc9
-0, 426002, 21600, 0x6b0ca3e5
-0, 432002, 21600, 0xd133a108
-0, 438002, 21600, 0xf2687b81
-0, 444002, 21600, 0x6e94645d
-0, 450002, 21600, 0xff7e7524
-0, 456002, 21600, 0x8c7255dd
-0, 462002, 21600, 0x84e979cf
-0, 468002, 21600, 0xaa4e7127
-0, 474002, 21600, 0x0b56708c
-0, 480002, 21600, 0x38f086c4
-0, 486002, 21600, 0x6a7086f6
-0, 492002, 21600, 0x57a3619d
-0, 498002, 21600, 0xee27639a
-0, 504003, 21600, 0x754b7ec6
-0, 510003, 21600, 0x2f7b428c
-0, 516003, 21600, 0x0dc94603
-0, 522003, 21600, 0xeede54d8
-0, 528003, 21600, 0x587b4725
-0, 534003, 21600, 0xe7c72c7a
-0, 540003, 21600, 0x523949cb
-0, 546003, 21600, 0xeade5385
-0, 552003, 21600, 0x1a8f45c8
-0, 558003, 21600, 0x814a393c
-0, 564003, 21600, 0xe7b34887
-0, 570003, 21600, 0x8eef3f5f
-0, 576003, 21600, 0x56f12f08
-0, 582003, 21600, 0xb2d02448
-0, 588003, 21600, 0xb7d936db
-0, 594003, 21600, 0x45f726ab
-0, 600003, 21600, 0x6012404d
-0, 606003, 21600, 0x273c254e
-0, 612003, 21600, 0x38e82c19
-0, 618003, 21600, 0x73653274
-0, 624003, 21600, 0x2ff63b0c
-0, 630003, 21600, 0x96d03611
-0, 636003, 21600, 0xee8c29d7
-0, 642003, 21600, 0xac043199
-0, 648003, 21600, 0xd2c741a7
-0, 654003, 21600, 0xdc7b2b81
-0, 660003, 21600, 0x376f438f
-0, 666003, 21600, 0x55442ff7
-0, 672003, 21600, 0x653b1472
-0, 678003, 21600, 0xc4293779
-0, 684003, 21600, 0xc6553740
-0, 690003, 21600, 0xcf441053
-0, 696003, 21600, 0xb1531bce
-0, 702004, 21600, 0x145323b3
-0, 708004, 21600, 0x916c2e9e
-0, 714004, 21600, 0xb89bfecc
-0, 720004, 21600, 0x8e2415b9
-0, 726004, 21600, 0x5af23021
-0, 732004, 21600, 0x53e81c10
-0, 738004, 21600, 0xf7f82a6f
-0, 744004, 21600, 0x851121a2
-0, 750004, 21600, 0xa8432bd2
-0, 756004, 21600, 0x1a381799
-0, 762004, 21600, 0xbb761384
-0, 768004, 21600, 0xc8f328d5
-0, 774004, 21600, 0xb3742e8a
+#tb 0: 66667/1000000
+0, 0, 0, 1, 21600, 0x57a2ba42
+0, 1, 1, 1, 21600, 0x61e09615
+0, 2, 2, 1, 21600, 0x826e4e63
+0, 3, 3, 1, 21600, 0x107716ec
+0, 4, 4, 1, 21600, 0xb35ce1f4
+0, 5, 5, 1, 21600, 0x12cab085
+0, 6, 6, 1, 21600, 0x2f917f69
+0, 7, 7, 1, 21600, 0x25aa3d6e
+0, 8, 8, 1, 21600, 0xab1bfbed
+0, 9, 9, 1, 21600, 0x9936dff9
+0, 10, 10, 1, 21600, 0xc23cd8e5
+0, 11, 11, 1, 21600, 0xa7ebbcaa
+0, 12, 12, 1, 21600, 0xd4dda045
+0, 13, 13, 1, 21600, 0xcbce6d7d
+0, 14, 14, 1, 21600, 0x3cf35baf
+0, 15, 15, 1, 21600, 0x16de6008
+0, 16, 16, 1, 21600, 0x49d41acf
+0, 17, 17, 1, 21600, 0x8c630034
+0, 18, 18, 1, 21600, 0x0b310296
+0, 19, 19, 1, 21600, 0x4887067d
+0, 20, 20, 1, 21600, 0x1219f29e
+0, 21, 21, 1, 21600, 0x3f3fc0c8
+0, 22, 22, 1, 21600, 0x1bd1d0fc
+0, 23, 23, 1, 21600, 0x913f9d4c
+0, 24, 24, 1, 21600, 0x69e9a6b4
+0, 25, 25, 1, 21600, 0xcc2e917f
+0, 26, 26, 1, 21600, 0xf6967e30
+0, 27, 27, 1, 21600, 0xdf816593
+0, 28, 28, 1, 21600, 0xfd945b75
+0, 29, 29, 1, 21600, 0x7d7e0224
+0, 30, 30, 1, 21600, 0x7246f584
+0, 31, 31, 1, 21600, 0x07b7ce82
+0, 32, 32, 1, 21600, 0xee16c291
+0, 33, 33, 1, 21600, 0xf4efb53a
+0, 34, 34, 1, 21600, 0x2e73a208
+0, 35, 35, 1, 21600, 0x1c2b6068
+0, 36, 36, 1, 21600, 0x004250de
+0, 37, 37, 1, 21600, 0x61d957d9
+0, 38, 38, 1, 21600, 0x8b5d2cb0
+0, 39, 39, 1, 21600, 0xc0a91fbc
+0, 40, 40, 1, 21600, 0xa38108fc
+0, 41, 41, 1, 21600, 0x551f03b9
+0, 42, 42, 1, 21600, 0x93def5ca
+0, 43, 43, 1, 21600, 0xe8ecf8bb
+0, 44, 44, 1, 21600, 0x4c04fbb0
+0, 45, 45, 1, 21600, 0x0e41dae4
+0, 46, 46, 1, 21600, 0xca9fb0df
+0, 47, 47, 1, 21600, 0xb123af19
+0, 48, 48, 1, 21600, 0xfd59be7a
+0, 49, 49, 1, 21600, 0x2c88b7a6
+0, 50, 50, 1, 21600, 0x64cc9a1f
+0, 51, 51, 1, 21600, 0x73d6a9ba
+0, 52, 52, 1, 21600, 0x79198a11
+0, 53, 53, 1, 21600, 0x0d4a8610
+0, 54, 54, 1, 21600, 0x352e71bc
+0, 55, 55, 1, 21600, 0x08aa627e
+0, 56, 56, 1, 21600, 0xbee36e45
+0, 57, 57, 1, 21600, 0x30de5c1b
+0, 58, 58, 1, 21600, 0x21d75484
+0, 59, 59, 1, 21600, 0xe0e91d52
+0, 60, 60, 1, 21600, 0x678c2ebb
+0, 61, 61, 1, 21600, 0x2080397b
+0, 62, 62, 1, 21600, 0x7dbc1333
+0, 63, 63, 1, 21600, 0x9c730ad0
+0, 64, 64, 1, 21600, 0x4da50f55
+0, 65, 65, 1, 21600, 0xdde5eaa7
+0, 66, 66, 1, 21600, 0x949ed4fa
+0, 67, 67, 1, 21600, 0x5d63bc54
+0, 68, 68, 1, 21600, 0xc5dcba4f
+0, 69, 69, 1, 21600, 0xd68caee1
+0, 70, 70, 1, 21600, 0xf7409fc9
+0, 71, 71, 1, 21600, 0x6b0ca3e5
+0, 72, 72, 1, 21600, 0xd133a108
+0, 73, 73, 1, 21600, 0xf2687b81
+0, 74, 74, 1, 21600, 0x6e94645d
+0, 75, 75, 1, 21600, 0xff7e7524
+0, 76, 76, 1, 21600, 0x8c7255dd
+0, 77, 77, 1, 21600, 0x84e979cf
+0, 78, 78, 1, 21600, 0xaa4e7127
+0, 79, 79, 1, 21600, 0x0b56708c
+0, 80, 80, 1, 21600, 0x38f086c4
+0, 81, 81, 1, 21600, 0x6a7086f6
+0, 82, 82, 1, 21600, 0x57a3619d
+0, 83, 83, 1, 21600, 0xee27639a
+0, 84, 84, 1, 21600, 0x754b7ec6
+0, 85, 85, 1, 21600, 0x2f7b428c
+0, 86, 86, 1, 21600, 0x0dc94603
+0, 87, 87, 1, 21600, 0xeede54d8
+0, 88, 88, 1, 21600, 0x587b4725
+0, 89, 89, 1, 21600, 0xe7c72c7a
+0, 90, 90, 1, 21600, 0x523949cb
+0, 91, 91, 1, 21600, 0xeade5385
+0, 92, 92, 1, 21600, 0x1a8f45c8
+0, 93, 93, 1, 21600, 0x814a393c
+0, 94, 94, 1, 21600, 0xe7b34887
+0, 95, 95, 1, 21600, 0x8eef3f5f
+0, 96, 96, 1, 21600, 0x56f12f08
+0, 97, 97, 1, 21600, 0xb2d02448
+0, 98, 98, 1, 21600, 0xb7d936db
+0, 99, 99, 1, 21600, 0x45f726ab
+0, 100, 100, 1, 21600, 0x6012404d
+0, 101, 101, 1, 21600, 0x273c254e
+0, 102, 102, 1, 21600, 0x38e82c19
+0, 103, 103, 1, 21600, 0x73653274
+0, 104, 104, 1, 21600, 0x2ff63b0c
+0, 105, 105, 1, 21600, 0x96d03611
+0, 106, 106, 1, 21600, 0xee8c29d7
+0, 107, 107, 1, 21600, 0xac043199
+0, 108, 108, 1, 21600, 0xd2c741a7
+0, 109, 109, 1, 21600, 0xdc7b2b81
+0, 110, 110, 1, 21600, 0x376f438f
+0, 111, 111, 1, 21600, 0x55442ff7
+0, 112, 112, 1, 21600, 0x653b1472
+0, 113, 113, 1, 21600, 0xc4293779
+0, 114, 114, 1, 21600, 0xc6553740
+0, 115, 115, 1, 21600, 0xcf441053
+0, 116, 116, 1, 21600, 0xb1531bce
+0, 117, 117, 1, 21600, 0x145323b3
+0, 118, 118, 1, 21600, 0x916c2e9e
+0, 119, 119, 1, 21600, 0xb89bfecc
+0, 120, 120, 1, 21600, 0x8e2415b9
+0, 121, 121, 1, 21600, 0x5af23021
+0, 122, 122, 1, 21600, 0x53e81c10
+0, 123, 123, 1, 21600, 0xf7f82a6f
+0, 124, 124, 1, 21600, 0x851121a2
+0, 125, 125, 1, 21600, 0xa8432bd2
+0, 126, 126, 1, 21600, 0x1a381799
+0, 127, 127, 1, 21600, 0xbb761384
+0, 128, 128, 1, 21600, 0xc8f328d5
+0, 129, 129, 1, 21600, 0xb3742e8a
diff --git a/gst-libs/ext/libav/tests/ref/fate/indeo3 b/gst-libs/ext/libav/tests/ref/fate/indeo3
index ee34b27..e294f70 100644
--- a/gst-libs/ext/libav/tests/ref/fate/indeo3
+++ b/gst-libs/ext/libav/tests/ref/fate/indeo3
@@ -1,40 +1,41 @@
-0, 0, 21600, 0x845098fc
-0, 9000, 21600, 0xc28e8bf0
-0, 18000, 21600, 0x2f418fb4
-0, 27000, 21600, 0x051d7a0e
-0, 36000, 21600, 0x1b36aa7c
-0, 45000, 21600, 0xb9e2ad38
-0, 54000, 21600, 0x8dc99b60
-0, 63000, 21600, 0xa3fa789a
-0, 72000, 21600, 0x1fdbade2
-0, 81000, 21600, 0x4f4ac164
-0, 90000, 21600, 0x0ea5cb50
-0, 99000, 21600, 0xfb659528
-0, 108000, 21600, 0xac5790f8
-0, 117000, 21600, 0x9762beb4
-0, 126000, 21600, 0x29b0da0a
-0, 135000, 21600, 0x6d88b0da
-0, 144000, 21600, 0x687b8efa
-0, 153000, 21600, 0xcd726220
-0, 162000, 21600, 0xa1766598
-0, 171000, 21600, 0xff4b8074
-0, 180000, 21600, 0x845098fc
-0, 189000, 21600, 0xdb259e08
-0, 198000, 21600, 0xb6bda5a0
-0, 207000, 21600, 0xbb998962
-0, 216000, 21600, 0x28aa7b7c
-0, 225000, 21600, 0x1ad1a15c
-0, 234000, 21600, 0xb535a128
-0, 243000, 21600, 0x4dbf968a
-0, 252000, 21600, 0xfe90a8d6
-0, 261000, 21600, 0xf63fabf0
-0, 270000, 21600, 0xd6fabe58
-0, 279000, 21600, 0x172eb09c
-0, 288000, 21600, 0x44f8a8fe
-0, 297000, 21600, 0x29429a06
-0, 306000, 21600, 0xb12f8cc4
-0, 315000, 21600, 0xd0c78cb4
-0, 324000, 21600, 0x97e17e0c
-0, 333000, 21600, 0xf8ac6700
-0, 342000, 21600, 0xf9c17c94
-0, 351000, 21600, 0xb10e8c54
+#tb 0: 1/600
+0, 0, 0, 1, 21600, 0x845098fc
+0, 60, 60, 1, 21600, 0xc28e8bf0
+0, 120, 120, 1, 21600, 0x2f418fb4
+0, 180, 180, 1, 21600, 0x051d7a0e
+0, 240, 240, 1, 21600, 0x1b36aa7c
+0, 300, 300, 1, 21600, 0xb9e2ad38
+0, 360, 360, 1, 21600, 0x8dc99b60
+0, 420, 420, 1, 21600, 0xa3fa789a
+0, 480, 480, 1, 21600, 0x1fdbade2
+0, 540, 540, 1, 21600, 0x4f4ac164
+0, 600, 600, 1, 21600, 0x0ea5cb50
+0, 660, 660, 1, 21600, 0xfb659528
+0, 720, 720, 1, 21600, 0xac5790f8
+0, 780, 780, 1, 21600, 0x9762beb4
+0, 840, 840, 1, 21600, 0x29b0da0a
+0, 900, 900, 1, 21600, 0x6d88b0da
+0, 960, 960, 1, 21600, 0x687b8efa
+0, 1020, 1020, 1, 21600, 0xcd726220
+0, 1080, 1080, 1, 21600, 0xa1766598
+0, 1140, 1140, 1, 21600, 0xff4b8074
+0, 1200, 1200, 1, 21600, 0x845098fc
+0, 1260, 1260, 1, 21600, 0xdb259e08
+0, 1320, 1320, 1, 21600, 0xb6bda5a0
+0, 1380, 1380, 1, 21600, 0xbb998962
+0, 1440, 1440, 1, 21600, 0x28aa7b7c
+0, 1500, 1500, 1, 21600, 0x1ad1a15c
+0, 1560, 1560, 1, 21600, 0xb535a128
+0, 1620, 1620, 1, 21600, 0x4dbf968a
+0, 1680, 1680, 1, 21600, 0xfe90a8d6
+0, 1740, 1740, 1, 21600, 0xf63fabf0
+0, 1800, 1800, 1, 21600, 0xd6fabe58
+0, 1860, 1860, 1, 21600, 0x172eb09c
+0, 1920, 1920, 1, 21600, 0x44f8a8fe
+0, 1980, 1980, 1, 21600, 0x29429a06
+0, 2040, 2040, 1, 21600, 0xb12f8cc4
+0, 2100, 2100, 1, 21600, 0xd0c78cb4
+0, 2160, 2160, 1, 21600, 0x97e17e0c
+0, 2220, 2220, 1, 21600, 0xf8ac6700
+0, 2280, 2280, 1, 21600, 0xf9c17c94
+0, 2340, 2340, 1, 21600, 0xb10e8c54
diff --git a/gst-libs/ext/libav/tests/ref/fate/indeo4 b/gst-libs/ext/libav/tests/ref/fate/indeo4
index 0f088ec..7f60461 100644
--- a/gst-libs/ext/libav/tests/ref/fate/indeo4
+++ b/gst-libs/ext/libav/tests/ref/fate/indeo4
@@ -1,100 +1,101 @@
-0, 0, 86400, 0x98f5e422
-0, 6000, 86400, 0x1864cb06
-0, 12000, 86400, 0xb09532ef
-0, 18000, 86400, 0x3cd3dcdc
-0, 24000, 86400, 0xe738847f
-0, 30000, 86400, 0xc9b13afb
-0, 36000, 86400, 0x5005d035
-0, 42000, 86400, 0x22f63e17
-0, 48000, 86400, 0x93391f02
-0, 54000, 86400, 0x264830fd
-0, 60000, 86400, 0x8fff9f5f
-0, 66000, 86400, 0x524997fe
-0, 72000, 86400, 0x54e330f9
-0, 78000, 86400, 0x1d766a22
-0, 84000, 86400, 0x683a70ac
-0, 90000, 86400, 0x553b7b3d
-0, 96000, 86400, 0x822c79bc
-0, 102000, 86400, 0xe1087a1c
-0, 108000, 86400, 0xff397595
-0, 114000, 86400, 0x1b6b7717
-0, 120000, 86400, 0x6c5275c1
-0, 126000, 86400, 0x4e6a7189
-0, 132000, 86400, 0x285c6eba
-0, 138000, 86400, 0xce647227
-0, 144000, 86400, 0xa0d07b1c
-0, 150000, 86400, 0x5b567861
-0, 156000, 86400, 0x105873ec
-0, 162000, 86400, 0x59267fa0
-0, 168000, 86400, 0xaeac839f
-0, 174000, 86400, 0x2faf7402
-0, 180000, 86400, 0xc8547a30
-0, 186000, 86400, 0x3d357d49
-0, 192000, 86400, 0x75db6d6c
-0, 198000, 86400, 0x9fbf68e9
-0, 204000, 86400, 0x56a64d26
-0, 210000, 86400, 0xce9e1f43
-0, 216000, 86400, 0xa4d7fddc
-0, 222000, 86400, 0x3e20d77c
-0, 228000, 86400, 0x4680661d
-0, 234000, 86400, 0xf1b20af3
-0, 240000, 86400, 0xb79d8045
-0, 246000, 86400, 0x9479fc8a
-0, 252000, 86400, 0x232965c3
-0, 258000, 86400, 0xd18bca17
-0, 264000, 86400, 0xb9064249
-0, 270000, 86400, 0xcc48ab34
-0, 276000, 86400, 0xe25018cd
-0, 282000, 86400, 0x8da489ee
-0, 288000, 86400, 0x90de0fc1
-0, 294000, 86400, 0x2428dcee
-0, 300000, 86400, 0x4316e1ae
-0, 306000, 86400, 0x2b25e54c
-0, 312000, 86400, 0x736ce020
-0, 318000, 86400, 0x9a6be09a
-0, 324000, 86400, 0x23bddbcd
-0, 330000, 86400, 0x9368e465
-0, 336000, 86400, 0x1ae9bb87
-0, 342000, 86400, 0x4e591f32
-0, 348000, 86400, 0xba1bf9dc
-0, 354000, 86400, 0x07f0aa60
-0, 360000, 86400, 0xf5a2cfa2
-0, 366000, 86400, 0xcba5fc18
-0, 372000, 86400, 0x858c0cfe
-0, 378000, 86400, 0xac73ecd4
-0, 384000, 86400, 0xf41bf03c
-0, 390000, 86400, 0x928ed146
-0, 396000, 86400, 0x9ff5990a
-0, 402000, 86400, 0xc2fabc3d
-0, 408000, 86400, 0x94af87a3
-0, 414000, 86400, 0x9bae514c
-0, 420000, 86400, 0xe0da267a
-0, 426000, 86400, 0x1d40f55c
-0, 432000, 86400, 0xe6173b68
-0, 438000, 86400, 0x1445490d
-0, 444000, 86400, 0x8d8753c1
-0, 450000, 86400, 0xe5a7779d
-0, 456000, 86400, 0x3cfc66ef
-0, 462000, 86400, 0xa5d45608
-0, 468000, 86400, 0x62f17be1
-0, 474000, 86400, 0xa64c84d3
-0, 480000, 86400, 0xf98162f0
-0, 486000, 86400, 0x0db77d9f
-0, 492000, 86400, 0x0f0cbac9
-0, 498000, 86400, 0xb9934e97
-0, 504000, 86400, 0x7f8fa248
-0, 510000, 86400, 0xdfd96768
-0, 516000, 86400, 0x81b07919
-0, 522000, 86400, 0x66c11e9f
-0, 528000, 86400, 0xd86eb114
-0, 534000, 86400, 0x67f20c1f
-0, 540000, 86400, 0x66915de5
-0, 546000, 86400, 0x2b8aa76f
-0, 552000, 86400, 0x85b5a3d2
-0, 558000, 86400, 0x80d29ed6
-0, 564000, 86400, 0x4d508e2c
-0, 570000, 86400, 0x0d407374
-0, 576000, 86400, 0xd4068016
-0, 582000, 86400, 0x6ffab98f
-0, 588000, 86400, 0x2360903d
-0, 594000, 86400, 0x470e04a0
+#tb 0: 1/15
+0, 0, 0, 1, 86400, 0x98f5e422
+0, 1, 1, 1, 86400, 0x1864cb06
+0, 2, 2, 1, 86400, 0xb09532ef
+0, 3, 3, 1, 86400, 0x3cd3dcdc
+0, 4, 4, 1, 86400, 0xe738847f
+0, 5, 5, 1, 86400, 0xc9b13afb
+0, 6, 6, 1, 86400, 0x5005d035
+0, 7, 7, 1, 86400, 0x22f63e17
+0, 8, 8, 1, 86400, 0x93391f02
+0, 9, 9, 1, 86400, 0x264830fd
+0, 10, 10, 1, 86400, 0x8fff9f5f
+0, 11, 11, 1, 86400, 0x524997fe
+0, 12, 12, 1, 86400, 0x54e330f9
+0, 13, 13, 1, 86400, 0x1d766a22
+0, 14, 14, 1, 86400, 0x683a70ac
+0, 15, 15, 1, 86400, 0x553b7b3d
+0, 16, 16, 1, 86400, 0x822c79bc
+0, 17, 17, 1, 86400, 0xe1087a1c
+0, 18, 18, 1, 86400, 0xff397595
+0, 19, 19, 1, 86400, 0x1b6b7717
+0, 20, 20, 1, 86400, 0x6c5275c1
+0, 21, 21, 1, 86400, 0x4e6a7189
+0, 22, 22, 1, 86400, 0x285c6eba
+0, 23, 23, 1, 86400, 0xce647227
+0, 24, 24, 1, 86400, 0xa0d07b1c
+0, 25, 25, 1, 86400, 0x5b567861
+0, 26, 26, 1, 86400, 0x105873ec
+0, 27, 27, 1, 86400, 0x59267fa0
+0, 28, 28, 1, 86400, 0xaeac839f
+0, 29, 29, 1, 86400, 0x2faf7402
+0, 30, 30, 1, 86400, 0xc8547a30
+0, 31, 31, 1, 86400, 0x3d357d49
+0, 32, 32, 1, 86400, 0x75db6d6c
+0, 33, 33, 1, 86400, 0x9fbf68e9
+0, 34, 34, 1, 86400, 0x56a64d26
+0, 35, 35, 1, 86400, 0xce9e1f43
+0, 36, 36, 1, 86400, 0xa4d7fddc
+0, 37, 37, 1, 86400, 0x3e20d77c
+0, 38, 38, 1, 86400, 0x4680661d
+0, 39, 39, 1, 86400, 0xf1b20af3
+0, 40, 40, 1, 86400, 0xb79d8045
+0, 41, 41, 1, 86400, 0x9479fc8a
+0, 42, 42, 1, 86400, 0x232965c3
+0, 43, 43, 1, 86400, 0xd18bca17
+0, 44, 44, 1, 86400, 0xb9064249
+0, 45, 45, 1, 86400, 0xcc48ab34
+0, 46, 46, 1, 86400, 0xe25018cd
+0, 47, 47, 1, 86400, 0x8da489ee
+0, 48, 48, 1, 86400, 0x90de0fc1
+0, 49, 49, 1, 86400, 0x2428dcee
+0, 50, 50, 1, 86400, 0x4316e1ae
+0, 51, 51, 1, 86400, 0x2b25e54c
+0, 52, 52, 1, 86400, 0x736ce020
+0, 53, 53, 1, 86400, 0x9a6be09a
+0, 54, 54, 1, 86400, 0x23bddbcd
+0, 55, 55, 1, 86400, 0x9368e465
+0, 56, 56, 1, 86400, 0x1ae9bb87
+0, 57, 57, 1, 86400, 0x4e591f32
+0, 58, 58, 1, 86400, 0xba1bf9dc
+0, 59, 59, 1, 86400, 0x07f0aa60
+0, 60, 60, 1, 86400, 0xf5a2cfa2
+0, 61, 61, 1, 86400, 0xcba5fc18
+0, 62, 62, 1, 86400, 0x858c0cfe
+0, 63, 63, 1, 86400, 0xac73ecd4
+0, 64, 64, 1, 86400, 0xf41bf03c
+0, 65, 65, 1, 86400, 0x928ed146
+0, 66, 66, 1, 86400, 0x9ff5990a
+0, 67, 67, 1, 86400, 0xc2fabc3d
+0, 68, 68, 1, 86400, 0x94af87a3
+0, 69, 69, 1, 86400, 0x9bae514c
+0, 70, 70, 1, 86400, 0xe0da267a
+0, 71, 71, 1, 86400, 0x1d40f55c
+0, 72, 72, 1, 86400, 0xe6173b68
+0, 73, 73, 1, 86400, 0x1445490d
+0, 74, 74, 1, 86400, 0x8d8753c1
+0, 75, 75, 1, 86400, 0xe5a7779d
+0, 76, 76, 1, 86400, 0x3cfc66ef
+0, 77, 77, 1, 86400, 0xa5d45608
+0, 78, 78, 1, 86400, 0x62f17be1
+0, 79, 79, 1, 86400, 0xa64c84d3
+0, 80, 80, 1, 86400, 0xf98162f0
+0, 81, 81, 1, 86400, 0x0db77d9f
+0, 82, 82, 1, 86400, 0x0f0cbac9
+0, 83, 83, 1, 86400, 0xb9934e97
+0, 84, 84, 1, 86400, 0x7f8fa248
+0, 85, 85, 1, 86400, 0xdfd96768
+0, 86, 86, 1, 86400, 0x81b07919
+0, 87, 87, 1, 86400, 0x66c11e9f
+0, 88, 88, 1, 86400, 0xd86eb114
+0, 89, 89, 1, 86400, 0x67f20c1f
+0, 90, 90, 1, 86400, 0x66915de5
+0, 91, 91, 1, 86400, 0x2b8aa76f
+0, 92, 92, 1, 86400, 0x85b5a3d2
+0, 93, 93, 1, 86400, 0x80d29ed6
+0, 94, 94, 1, 86400, 0x4d508e2c
+0, 95, 95, 1, 86400, 0x0d407374
+0, 96, 96, 1, 86400, 0xd4068016
+0, 97, 97, 1, 86400, 0x6ffab98f
+0, 98, 98, 1, 86400, 0x2360903d
+0, 99, 99, 1, 86400, 0x470e04a0
diff --git a/gst-libs/ext/libav/tests/ref/fate/indeo5 b/gst-libs/ext/libav/tests/ref/fate/indeo5
index 73fe74c..3f0adfb 100644
--- a/gst-libs/ext/libav/tests/ref/fate/indeo5
+++ b/gst-libs/ext/libav/tests/ref/fate/indeo5
@@ -1,134 +1,135 @@
-0, 0, 48600, 0x72d4193b
-0, 6000, 48600, 0x72d4193b
-0, 12000, 48600, 0x36abd6f3
-0, 18000, 48600, 0x99e582f7
-0, 24000, 48600, 0xa4cb6fb7
-0, 30000, 48600, 0xf9b5657b
-0, 36000, 48600, 0xb7d666a4
-0, 42000, 48600, 0xb7345308
-0, 48000, 48600, 0x4f5339b9
-0, 54000, 48600, 0x1a9a02c7
-0, 60000, 48600, 0x4ed40866
-0, 66000, 48600, 0x635bf2af
-0, 72000, 48600, 0x12c02f49
-0, 78000, 48600, 0xc548a36d
-0, 84000, 48600, 0x9d9ffbf0
-0, 90000, 48600, 0x4f9dba66
-0, 96000, 48600, 0x2332b0e4
-0, 102000, 48600, 0x6c64342d
-0, 108000, 48600, 0x81156d54
-0, 114000, 48600, 0x8bfb9f04
-0, 120000, 48600, 0xd6bc38db
-0, 126000, 48600, 0x64de39d7
-0, 132000, 48600, 0xbddb3c37
-0, 138000, 48600, 0x15b75a31
-0, 144000, 48600, 0xa2dd7bdf
-0, 150000, 48600, 0xe4fb9b25
-0, 156000, 48600, 0xf2788234
-0, 162000, 48600, 0xa481a3d0
-0, 168000, 48600, 0x6087c790
-0, 174000, 48600, 0xf1dacfa1
-0, 180000, 48600, 0xe29e2e78
-0, 186000, 48600, 0x505b2db1
-0, 192000, 48600, 0x7bc56b02
-0, 198000, 48600, 0x3f7640de
-0, 204000, 48600, 0xd21a3f0b
-0, 210000, 48600, 0x92dc9b72
-0, 216000, 48600, 0x26e6804e
-0, 222000, 48600, 0xc3867fdc
-0, 228000, 48600, 0xe135c689
-0, 234000, 48600, 0xf0fda68b
-0, 240000, 48600, 0x7e07a430
-0, 246000, 48600, 0xb0809c56
-0, 252000, 48600, 0xd3f3d4b0
-0, 258000, 48600, 0x068ce7b9
-0, 264000, 48600, 0x3ae5ebb7
-0, 270000, 48600, 0x2274d1d8
-0, 276000, 48600, 0x9a2b95b7
-0, 282000, 48600, 0xe864dc3d
-0, 288000, 48600, 0xdf39d4db
-0, 294000, 48600, 0x5155c707
-0, 300000, 48600, 0xa26e9879
-0, 306000, 48600, 0x91b5747c
-0, 312000, 48600, 0xe7925589
-0, 318000, 48600, 0x582f1cb2
-0, 324000, 48600, 0x13180bdb
-0, 330000, 48600, 0x1623d914
-0, 336000, 48600, 0xfeeea068
-0, 342000, 48600, 0x61f8679c
-0, 348000, 48600, 0xcb678447
-0, 354000, 48600, 0xd0028749
-0, 360000, 48600, 0xec116a9c
-0, 366000, 48600, 0x16926417
-0, 372000, 48600, 0x342c6014
-0, 378000, 48600, 0xb81a3ec3
-0, 384000, 48600, 0xfd0d4654
-0, 390000, 48600, 0x741cc27a
-0, 396000, 48600, 0x2c53a9fe
-0, 402000, 48600, 0x795dc493
-0, 408000, 48600, 0x46eebc82
-0, 414000, 48600, 0xa2b7b84b
-0, 420000, 48600, 0x2274c95e
-0, 426000, 48600, 0x0ba5ac69
-0, 432000, 48600, 0x8335eb20
-0, 438000, 48600, 0xca80ef55
-0, 444000, 48600, 0xbb7cec8a
-0, 450000, 48600, 0x775bdde2
-0, 456000, 48600, 0x68a5a673
-0, 462000, 48600, 0x091ccca2
-0, 468000, 48600, 0xced6d065
-0, 474000, 48600, 0xed7fca50
-0, 480000, 48600, 0x5c77be3f
-0, 486000, 48600, 0x84719fe6
-0, 492000, 48600, 0x571cc076
-0, 498000, 48600, 0xa3b5be2a
-0, 504000, 48600, 0x0218bc6f
-0, 510000, 48600, 0x5ec1fa4c
-0, 516000, 48600, 0xcd3035fa
-0, 522000, 48600, 0xb8d2a741
-0, 528000, 48600, 0x6d39847c
-0, 534000, 48600, 0x0ffefc73
-0, 540000, 48600, 0x2bb74b68
-0, 546000, 48600, 0xf541d49f
-0, 552000, 48600, 0x6f7c9066
-0, 558000, 48600, 0x70d58548
-0, 564000, 48600, 0x92d38b55
-0, 570000, 48600, 0x5f4bdaa6
-0, 576000, 48600, 0x43868008
-0, 582000, 48600, 0xddb8e551
-0, 588000, 48600, 0xcd0cbd5f
-0, 594000, 48600, 0xf97e6bbd
-0, 600000, 48600, 0x5f1b31eb
-0, 606000, 48600, 0x10ff924d
-0, 612000, 48600, 0xcc31ca3f
-0, 618000, 48600, 0x5f27f9ff
-0, 624000, 48600, 0xd6fe4b71
-0, 630000, 48600, 0xa7d3b2c4
-0, 636000, 48600, 0x9992d6c7
-0, 642000, 48600, 0xd283089b
-0, 648000, 48600, 0x6ab52ede
-0, 654000, 48600, 0x495b1bad
-0, 660000, 48600, 0x3a4d1b72
-0, 666000, 48600, 0xdb421ba3
-0, 672000, 48600, 0x8ad11baa
-0, 678000, 48600, 0x17701bcc
-0, 684000, 48600, 0x4b771b6a
-0, 690000, 48600, 0x5345067e
-0, 696000, 48600, 0x2cd403a7
-0, 702000, 48600, 0x2cc5fd60
-0, 708000, 48600, 0xfa9cf1d4
-0, 714000, 48600, 0x8498e2d6
-0, 720000, 48600, 0x93dcc863
-0, 726000, 48600, 0xd46ac5d5
-0, 732000, 48600, 0x34e8c01b
-0, 738000, 48600, 0x4ad3b246
-0, 744000, 48600, 0x9848a6ca
-0, 750000, 48600, 0x7b7e8bee
-0, 756000, 48600, 0xaee0896b
-0, 762000, 48600, 0x263a812c
-0, 768000, 48600, 0x5d7b7782
-0, 774000, 48600, 0x3a2b6ad2
-0, 780000, 48600, 0xcf2a4ef3
-0, 786000, 48600, 0xc0134c9b
-0, 792000, 48600, 0x93c342d2
-0, 798000, 48600, 0x8d90393c
+#tb 0: 1/15
+0, 0, 0, 1, 48600, 0x72d4193b
+0, 1, 1, 1, 48600, 0x72d4193b
+0, 2, 2, 1, 48600, 0x36abd6f3
+0, 3, 3, 1, 48600, 0x99e582f7
+0, 4, 4, 1, 48600, 0xa4cb6fb7
+0, 5, 5, 1, 48600, 0xf9b5657b
+0, 6, 6, 1, 48600, 0xb7d666a4
+0, 7, 7, 1, 48600, 0xb7345308
+0, 8, 8, 1, 48600, 0x4f5339b9
+0, 9, 9, 1, 48600, 0x1a9a02c7
+0, 10, 10, 1, 48600, 0x4ed40866
+0, 11, 11, 1, 48600, 0x635bf2af
+0, 12, 12, 1, 48600, 0x12c02f49
+0, 13, 13, 1, 48600, 0xc548a36d
+0, 14, 14, 1, 48600, 0x9d9ffbf0
+0, 15, 15, 1, 48600, 0x4f9dba66
+0, 16, 16, 1, 48600, 0x2332b0e4
+0, 17, 17, 1, 48600, 0x6c64342d
+0, 18, 18, 1, 48600, 0x81156d54
+0, 19, 19, 1, 48600, 0x8bfb9f04
+0, 20, 20, 1, 48600, 0xd6bc38db
+0, 21, 21, 1, 48600, 0x64de39d7
+0, 22, 22, 1, 48600, 0xbddb3c37
+0, 23, 23, 1, 48600, 0x15b75a31
+0, 24, 24, 1, 48600, 0xa2dd7bdf
+0, 25, 25, 1, 48600, 0xe4fb9b25
+0, 26, 26, 1, 48600, 0xf2788234
+0, 27, 27, 1, 48600, 0xa481a3d0
+0, 28, 28, 1, 48600, 0x6087c790
+0, 29, 29, 1, 48600, 0xf1dacfa1
+0, 30, 30, 1, 48600, 0xe29e2e78
+0, 31, 31, 1, 48600, 0x505b2db1
+0, 32, 32, 1, 48600, 0x7bc56b02
+0, 33, 33, 1, 48600, 0x3f7640de
+0, 34, 34, 1, 48600, 0xd21a3f0b
+0, 35, 35, 1, 48600, 0x92dc9b72
+0, 36, 36, 1, 48600, 0x26e6804e
+0, 37, 37, 1, 48600, 0xc3867fdc
+0, 38, 38, 1, 48600, 0xe135c689
+0, 39, 39, 1, 48600, 0xf0fda68b
+0, 40, 40, 1, 48600, 0x7e07a430
+0, 41, 41, 1, 48600, 0xb0809c56
+0, 42, 42, 1, 48600, 0xd3f3d4b0
+0, 43, 43, 1, 48600, 0x068ce7b9
+0, 44, 44, 1, 48600, 0x3ae5ebb7
+0, 45, 45, 1, 48600, 0x2274d1d8
+0, 46, 46, 1, 48600, 0x9a2b95b7
+0, 47, 47, 1, 48600, 0xe864dc3d
+0, 48, 48, 1, 48600, 0xdf39d4db
+0, 49, 49, 1, 48600, 0x5155c707
+0, 50, 50, 1, 48600, 0xa26e9879
+0, 51, 51, 1, 48600, 0x91b5747c
+0, 52, 52, 1, 48600, 0xe7925589
+0, 53, 53, 1, 48600, 0x582f1cb2
+0, 54, 54, 1, 48600, 0x13180bdb
+0, 55, 55, 1, 48600, 0x1623d914
+0, 56, 56, 1, 48600, 0xfeeea068
+0, 57, 57, 1, 48600, 0x61f8679c
+0, 58, 58, 1, 48600, 0xcb678447
+0, 59, 59, 1, 48600, 0xd0028749
+0, 60, 60, 1, 48600, 0xec116a9c
+0, 61, 61, 1, 48600, 0x16926417
+0, 62, 62, 1, 48600, 0x342c6014
+0, 63, 63, 1, 48600, 0xb81a3ec3
+0, 64, 64, 1, 48600, 0xfd0d4654
+0, 65, 65, 1, 48600, 0x741cc27a
+0, 66, 66, 1, 48600, 0x2c53a9fe
+0, 67, 67, 1, 48600, 0x795dc493
+0, 68, 68, 1, 48600, 0x46eebc82
+0, 69, 69, 1, 48600, 0xa2b7b84b
+0, 70, 70, 1, 48600, 0x2274c95e
+0, 71, 71, 1, 48600, 0x0ba5ac69
+0, 72, 72, 1, 48600, 0x8335eb20
+0, 73, 73, 1, 48600, 0xca80ef55
+0, 74, 74, 1, 48600, 0xbb7cec8a
+0, 75, 75, 1, 48600, 0x775bdde2
+0, 76, 76, 1, 48600, 0x68a5a673
+0, 77, 77, 1, 48600, 0x091ccca2
+0, 78, 78, 1, 48600, 0xced6d065
+0, 79, 79, 1, 48600, 0xed7fca50
+0, 80, 80, 1, 48600, 0x5c77be3f
+0, 81, 81, 1, 48600, 0x84719fe6
+0, 82, 82, 1, 48600, 0x571cc076
+0, 83, 83, 1, 48600, 0xa3b5be2a
+0, 84, 84, 1, 48600, 0x0218bc6f
+0, 85, 85, 1, 48600, 0x5ec1fa4c
+0, 86, 86, 1, 48600, 0xcd3035fa
+0, 87, 87, 1, 48600, 0xb8d2a741
+0, 88, 88, 1, 48600, 0x6d39847c
+0, 89, 89, 1, 48600, 0x0ffefc73
+0, 90, 90, 1, 48600, 0x2bb74b68
+0, 91, 91, 1, 48600, 0xf541d49f
+0, 92, 92, 1, 48600, 0x6f7c9066
+0, 93, 93, 1, 48600, 0x70d58548
+0, 94, 94, 1, 48600, 0x92d38b55
+0, 95, 95, 1, 48600, 0x5f4bdaa6
+0, 96, 96, 1, 48600, 0x43868008
+0, 97, 97, 1, 48600, 0xddb8e551
+0, 98, 98, 1, 48600, 0xcd0cbd5f
+0, 99, 99, 1, 48600, 0xf97e6bbd
+0, 100, 100, 1, 48600, 0x5f1b31eb
+0, 101, 101, 1, 48600, 0x10ff924d
+0, 102, 102, 1, 48600, 0xcc31ca3f
+0, 103, 103, 1, 48600, 0x5f27f9ff
+0, 104, 104, 1, 48600, 0xd6fe4b71
+0, 105, 105, 1, 48600, 0xa7d3b2c4
+0, 106, 106, 1, 48600, 0x9992d6c7
+0, 107, 107, 1, 48600, 0xd283089b
+0, 108, 108, 1, 48600, 0x6ab52ede
+0, 109, 109, 1, 48600, 0x495b1bad
+0, 110, 110, 1, 48600, 0x3a4d1b72
+0, 111, 111, 1, 48600, 0xdb421ba3
+0, 112, 112, 1, 48600, 0x8ad11baa
+0, 113, 113, 1, 48600, 0x17701bcc
+0, 114, 114, 1, 48600, 0x4b771b6a
+0, 115, 115, 1, 48600, 0x5345067e
+0, 116, 116, 1, 48600, 0x2cd403a7
+0, 117, 117, 1, 48600, 0x2cc5fd60
+0, 118, 118, 1, 48600, 0xfa9cf1d4
+0, 119, 119, 1, 48600, 0x8498e2d6
+0, 120, 120, 1, 48600, 0x93dcc863
+0, 121, 121, 1, 48600, 0xd46ac5d5
+0, 122, 122, 1, 48600, 0x34e8c01b
+0, 123, 123, 1, 48600, 0x4ad3b246
+0, 124, 124, 1, 48600, 0x9848a6ca
+0, 125, 125, 1, 48600, 0x7b7e8bee
+0, 126, 126, 1, 48600, 0xaee0896b
+0, 127, 127, 1, 48600, 0x263a812c
+0, 128, 128, 1, 48600, 0x5d7b7782
+0, 129, 129, 1, 48600, 0x3a2b6ad2
+0, 130, 130, 1, 48600, 0xcf2a4ef3
+0, 131, 131, 1, 48600, 0xc0134c9b
+0, 132, 132, 1, 48600, 0x93c342d2
+0, 133, 133, 1, 48600, 0x8d90393c
diff --git a/gst-libs/ext/libav/tests/ref/fate/interplay-mve-16bit b/gst-libs/ext/libav/tests/ref/fate/interplay-mve-16bit
index 74f0b35..2469aaa 100644
--- a/gst-libs/ext/libav/tests/ref/fate/interplay-mve-16bit
+++ b/gst-libs/ext/libav/tests/ref/fate/interplay-mve-16bit
@@ -1,129 +1,51 @@
-0, 0, 614400, 0x00000000
-1, 0, 5788, 0x916d2db8
-1, 2953, 5888, 0xc65cb069
-0, 3002, 614400, 0x00000000
-1, 5957, 5888, 0xd8ec1acc
-0, 6005, 614400, 0xa17ea4ec
-1, 8961, 5888, 0xb22af0d6
-0, 9007, 614400, 0x4fd207fb
-1, 11965, 5888, 0x86bb50d9
-0, 12010, 614400, 0xd7a510fb
-1, 14969, 5888, 0x7674d923
-0, 15012, 614400, 0xe901e2f4
-1, 17973, 5888, 0xb97c5500
-0, 18014, 614400, 0x4ac5d3c4
-1, 20978, 5888, 0xecea1249
-0, 21017, 614400, 0x32e3e99c
-1, 23982, 5888, 0x0f4fea81
-0, 24019, 614400, 0x7a2ff20c
-1, 26986, 5888, 0x997914d8
-0, 27022, 614400, 0x59941193
-1, 29990, 5888, 0xd012f03a
-0, 30024, 614400, 0x92773a2b
-1, 32994, 5888, 0x03fd5248
-0, 33026, 614400, 0x4cd14313
-1, 35998, 5888, 0x3041a288
-0, 36029, 614400, 0x2a093fa3
-1, 39002, 5888, 0xe6105de1
-0, 39031, 614400, 0xf68b8463
-1, 42006, 5888, 0xaa38c7bd
-0, 42034, 614400, 0xa9e1969b
-1, 45010, 5888, 0xbfff702c
-0, 45036, 614400, 0x461996bb
-1, 48014, 5888, 0xbe4319a3
-0, 48038, 614400, 0xae58d053
-1, 51018, 5888, 0x2e89d262
-0, 51041, 614400, 0x7693015a
-1, 54022, 5888, 0x10992b9c
-0, 54043, 614400, 0x0b3507fa
-1, 57027, 5888, 0x972904bf
-0, 57046, 614400, 0xff5c2492
-1, 60031, 5888, 0x0093501c
-0, 60048, 614400, 0x636e3e32
-1, 63035, 5888, 0x8994ad0e
-0, 63050, 614400, 0x1acd6d0a
-1, 66039, 5888, 0x9db37d21
-0, 66053, 614400, 0x67039232
-1, 69043, 5888, 0xa8c7300f
-0, 69055, 614400, 0x8ab9c75a
-1, 72047, 5888, 0x1b7073b5
-0, 72058, 614400, 0xe824bbe2
-1, 75051, 5888, 0x56ad7f7b
-0, 75060, 614400, 0x5133e9ea
-1, 78055, 5888, 0x9706a8fb
-0, 78062, 614400, 0xcecf1249
-1, 81059, 5888, 0x16c9420e
-0, 81065, 614400, 0xe6d928c1
-1, 84063, 5888, 0x3e11be0a
-0, 84067, 614400, 0x8da46ff1
-1, 87067, 5888, 0x3e534a32
-0, 87070, 614400, 0x1c778319
-1, 90071, 5788, 0x0ffae5f4
-0, 90072, 614400, 0x35a19451
-1, 93024, 5888, 0xc2018f82
-0, 93074, 614400, 0x5145d1b9
-1, 96029, 5888, 0x2a11f529
-0, 96077, 614400, 0x146ee231
-1, 99033, 5888, 0xec282167
-0, 99079, 614400, 0xd9b33380
-1, 102037, 5888, 0xd61b5a05
-0, 102082, 614400, 0x8b112ef8
-1, 105041, 5888, 0x61de2741
-0, 105084, 614400, 0xb9e79ab0
-1, 108045, 5888, 0x17aaff8c
-0, 108086, 614400, 0x62d3a498
-1, 111049, 5888, 0xd40cd7a6
-0, 111089, 614400, 0xaeaaaa58
-1, 114053, 5888, 0x840840d4
-0, 114091, 614400, 0x8922c440
-1, 117057, 5888, 0x7c97ddcf
-0, 117094, 614400, 0xd62ef758
-1, 120061, 5888, 0xed9150f7
-0, 120096, 614400, 0x2a53149f
-1, 123065, 5888, 0xbccf973e
-0, 123098, 614400, 0x13da47df
-1, 126069, 5888, 0x74bda5ea
-0, 126101, 614400, 0x27c05c3f
-1, 129073, 5888, 0xd083892a
-0, 129103, 614400, 0x41ff7ca7
-1, 132078, 5888, 0x16e444b2
-0, 132106, 614400, 0x6b0e8a07
-1, 135082, 5888, 0x68a9cedb
-0, 135108, 614400, 0xa200ad9f
-1, 138086, 5888, 0x80849f36
-0, 138110, 614400, 0x9da7cc77
-1, 141090, 5888, 0x63cb7df9
-0, 141113, 614400, 0x2f5703be
-1, 144094, 5888, 0xf90f754d
-0, 144115, 614400, 0x91c720f6
-1, 147098, 5888, 0x9c2c867d
-0, 147118, 614400, 0x927a882e
-1, 150102, 5888, 0x337994a4
-1, 153106, 5888, 0xf354a28d
-1, 156110, 5888, 0x70933738
-1, 159114, 5888, 0x3c019219
-1, 162118, 5888, 0xe0c21295
-1, 165122, 5888, 0x21869515
-1, 168127, 5888, 0xe9b1ec7d
-1, 171131, 5888, 0x57825497
-1, 174135, 5888, 0xae02ebeb
-1, 177139, 5888, 0x0c62e14f
-1, 180143, 5788, 0x8a255f8f
-1, 183096, 5888, 0x38993359
-1, 186100, 5888, 0x390baf95
-1, 189104, 5888, 0xb72c72ea
-1, 192108, 5888, 0xbbd3c6fe
-1, 195112, 5888, 0xefb26f0a
-1, 198116, 5888, 0xcc404dd0
-1, 201120, 5888, 0xffa23082
-1, 204124, 5888, 0xd0c43567
-1, 207129, 5888, 0x4d3b7958
-1, 210133, 5888, 0x47125aa1
-1, 213137, 5888, 0x99286cf3
-1, 216141, 5888, 0x478d61e2
-1, 219145, 5888, 0xac65b47e
-1, 222149, 5888, 0x333c1d1a
-1, 225153, 5888, 0x8f960ecf
-1, 228157, 5888, 0x58f76aec
-1, 231161, 5888, 0xb5e0dded
-1, 234165, 5888, 0xaf1a8f9a
+#tb 0: 1/1000000
+0, 0, 0, 0, 614400, 0x00000000
+0, 33360, 33360, 0, 614400, 0x00000000
+0, 66720, 66720, 0, 614400, 0xa17ea4ec
+0, 100080, 100080, 0, 614400, 0x4fd207fb
+0, 133440, 133440, 0, 614400, 0xd7a510fb
+0, 166800, 166800, 0, 614400, 0xe901e2f4
+0, 200160, 200160, 0, 614400, 0x4ac5d3c4
+0, 233520, 233520, 0, 614400, 0x32e3e99c
+0, 266880, 266880, 0, 614400, 0x7a2ff20c
+0, 300240, 300240, 0, 614400, 0x59941193
+0, 333600, 333600, 0, 614400, 0x92773a2b
+0, 366960, 366960, 0, 614400, 0x4cd14313
+0, 400320, 400320, 0, 614400, 0x2a093fa3
+0, 433680, 433680, 0, 614400, 0xf68b8463
+0, 467040, 467040, 0, 614400, 0xa9e1969b
+0, 500400, 500400, 0, 614400, 0x461996bb
+0, 533760, 533760, 0, 614400, 0xae58d053
+0, 567120, 567120, 0, 614400, 0x7693015a
+0, 600480, 600480, 0, 614400, 0x0b3507fa
+0, 633840, 633840, 0, 614400, 0xff5c2492
+0, 667200, 667200, 0, 614400, 0x636e3e32
+0, 700560, 700560, 0, 614400, 0x1acd6d0a
+0, 733920, 733920, 0, 614400, 0x67039232
+0, 767280, 767280, 0, 614400, 0x8ab9c75a
+0, 800640, 800640, 0, 614400, 0xe824bbe2
+0, 834000, 834000, 0, 614400, 0x5133e9ea
+0, 867360, 867360, 0, 614400, 0xcecf1249
+0, 900720, 900720, 0, 614400, 0xe6d928c1
+0, 934080, 934080, 0, 614400, 0x8da46ff1
+0, 967440, 967440, 0, 614400, 0x1c778319
+0, 1000800, 1000800, 0, 614400, 0x35a19451
+0, 1034160, 1034160, 0, 614400, 0x5145d1b9
+0, 1067520, 1067520, 0, 614400, 0x146ee231
+0, 1100880, 1100880, 0, 614400, 0xd9b33380
+0, 1134240, 1134240, 0, 614400, 0x8b112ef8
+0, 1167600, 1167600, 0, 614400, 0xb9e79ab0
+0, 1200960, 1200960, 0, 614400, 0x62d3a498
+0, 1234320, 1234320, 0, 614400, 0xaeaaaa58
+0, 1267680, 1267680, 0, 614400, 0x8922c440
+0, 1301040, 1301040, 0, 614400, 0xd62ef758
+0, 1334400, 1334400, 0, 614400, 0x2a53149f
+0, 1367760, 1367760, 0, 614400, 0x13da47df
+0, 1401120, 1401120, 0, 614400, 0x27c05c3f
+0, 1434480, 1434480, 0, 614400, 0x41ff7ca7
+0, 1467840, 1467840, 0, 614400, 0x6b0e8a07
+0, 1501200, 1501200, 0, 614400, 0xa200ad9f
+0, 1534560, 1534560, 0, 614400, 0x9da7cc77
+0, 1567920, 1567920, 0, 614400, 0x2f5703be
+0, 1601280, 1601280, 0, 614400, 0x91c720f6
+0, 1634640, 1634640, 0, 614400, 0x927a882e
diff --git a/gst-libs/ext/libav/tests/ref/fate/interplay-mve-8bit b/gst-libs/ext/libav/tests/ref/fate/interplay-mve-8bit
index 13959c3..abd86eb 100644
--- a/gst-libs/ext/libav/tests/ref/fate/interplay-mve-8bit
+++ b/gst-libs/ext/libav/tests/ref/fate/interplay-mve-8bit
@@ -1,234 +1,111 @@
-0, 0, 414720, 0xa5cd50ca
-1, 0, 5848, 0xea04292b
-1, 5967, 5888, 0x0e59e942
-0, 6006, 414720, 0x3facd321
-1, 11976, 5888, 0x56d480f6
-0, 12011, 414720, 0x849e6d4b
-1, 17984, 5888, 0xcb560b22
-0, 18017, 414720, 0xe649363f
-1, 23992, 5888, 0xca26865b
-0, 24022, 414720, 0x5bbd7b14
-1, 30000, 5888, 0xa434392f
-0, 30028, 414720, 0xe246ab51
-1, 36008, 5888, 0xa0615fe4
-0, 36033, 414720, 0x5721b22e
-1, 42016, 5888, 0x85b241cd
-0, 42039, 414720, 0xe391e107
-1, 48024, 5888, 0x2c417a43
-0, 48044, 414720, 0x04d851ff
-1, 54033, 5888, 0x2d5ed665
-0, 54050, 414720, 0x8d80d580
-1, 60041, 5888, 0x37267a2d
-0, 60055, 414720, 0x5a24b0bc
-1, 66049, 5888, 0x1f803c67
-0, 66061, 414720, 0x06cd6960
-1, 72057, 5888, 0xfb7940ef
-0, 72066, 414720, 0xf5ca48b4
-1, 78065, 5888, 0x1a5371e8
-0, 78072, 414720, 0x24700f94
-1, 84073, 5888, 0x37e29b21
-0, 84077, 414720, 0xb0bfe451
-1, 90082, 5848, 0x70065769
-0, 90083, 414720, 0x00e9f3d1
-1, 96049, 5888, 0xaf624f3d
-0, 96088, 414720, 0x0efbffd1
-1, 102057, 5888, 0x8f5e5b57
-0, 102094, 414720, 0x2ecdfc8d
-1, 108065, 5888, 0x93545968
-0, 108099, 414720, 0x94b531fc
-1, 114073, 5888, 0x915f268f
-0, 114105, 414720, 0x2c2579f8
-1, 120082, 5888, 0x9cd48ac4
-0, 120110, 414720, 0x6c7ecfb8
-1, 126090, 5888, 0x812c8e13
-0, 126116, 414720, 0x08982527
-1, 132098, 5888, 0xe794a2a7
-0, 132121, 414720, 0x5c0161b3
-1, 138106, 5888, 0x4a056e4b
-0, 138127, 414720, 0x453ce413
-1, 144114, 5888, 0xa3589992
-0, 144132, 414720, 0x634e36b2
-1, 150122, 5888, 0x19ea7ec5
-0, 150138, 414720, 0x401a683a
-1, 156131, 5888, 0x422d5097
-0, 156144, 414720, 0x3c5f442e
-1, 162139, 5888, 0xc9fd963f
-0, 162149, 414720, 0x075ef787
-1, 168147, 5888, 0xc556a5ea
-0, 168155, 414720, 0x8501a04f
-1, 174155, 5888, 0x51557e0f
-0, 174160, 414720, 0x3620093b
-1, 180163, 5848, 0x4903ad21
-0, 180166, 414720, 0xa42d9480
-1, 186131, 5888, 0xb1c85e85
-0, 186171, 414720, 0x09b150b4
-1, 192139, 5888, 0x68963d65
-0, 192177, 414720, 0xcad407f0
-1, 198147, 5888, 0x62a3124e
-0, 198182, 414720, 0x69e5eecd
-1, 204155, 5888, 0x4ff1878f
-0, 204188, 414720, 0xb92ad2d9
-1, 210163, 5888, 0x8b09ac18
-0, 210193, 414720, 0xc78eaf29
-1, 216171, 5888, 0x67d85338
-0, 216199, 414720, 0x47c3fa91
-1, 222180, 5888, 0x82eca0a6
-0, 222204, 414720, 0x8847b7b8
-1, 228188, 5888, 0x81a17eb8
-0, 228210, 414720, 0x864cab2f
-1, 234196, 5888, 0x7108478c
-0, 234215, 414720, 0x78d653e2
-1, 240204, 5888, 0xbfc18b09
-0, 240221, 414720, 0xda15cbd2
-1, 246212, 5888, 0xad93711f
-0, 246226, 414720, 0xdf9ce28a
-1, 252220, 5888, 0xf8d25e39
-0, 252232, 414720, 0xe88c49ca
-1, 258229, 5888, 0x41edd04e
-0, 258237, 414720, 0xd6bcbc07
-1, 264237, 5888, 0xa6557ee2
-0, 264243, 414720, 0xf0b4a7bf
-1, 270245, 5848, 0xc14d5456
-0, 270248, 414720, 0x74f9bfbf
-1, 276212, 5888, 0x20a7821f
-0, 276254, 414720, 0x904ce103
-1, 282220, 5888, 0x9f1a8f9d
-0, 282259, 414720, 0xca877e4a
-1, 288229, 5888, 0x2f3c6cc8
-0, 288265, 414720, 0x588effd6
-1, 294237, 5888, 0x757c894a
-0, 294270, 414720, 0x6dff8b71
-1, 300245, 5888, 0x483e98bb
-0, 300276, 414720, 0xbeaae788
-1, 306253, 5888, 0x84289c75
-0, 306282, 414720, 0x1a4d1242
-1, 312261, 5888, 0xf79d5a91
-0, 312287, 414720, 0x4ae98ea0
-1, 318269, 5888, 0x395b5228
-0, 318293, 414720, 0x41ed6d22
-1, 324278, 5888, 0x9c937a14
-0, 324298, 414720, 0x486e70aa
-1, 330286, 5888, 0x40c169cf
-0, 330304, 414720, 0xfddc103e
-1, 336294, 5888, 0x3e7f99b0
-0, 336309, 414720, 0x8620f03e
-1, 342302, 5888, 0xd4de993e
-0, 342315, 414720, 0x0e4ec273
-1, 348310, 5888, 0xae856b09
-0, 348320, 414720, 0xb2298b3e
-1, 354318, 5888, 0xa2369c95
-0, 354326, 414720, 0xb4f50176
-1, 360327, 5848, 0x992d516b
-0, 360331, 414720, 0xb9c7a495
-1, 366294, 5888, 0xcd785ba9
-0, 366337, 414720, 0xed270702
-1, 372302, 5888, 0x55ea3bce
-0, 372342, 414720, 0x98b72586
-1, 378310, 5888, 0xf06d4bbf
-0, 378348, 414720, 0xd8977cb1
-1, 384318, 5888, 0x2a9d4c1a
-0, 384353, 414720, 0xff3d3851
-1, 390327, 5888, 0xd5e348a3
-0, 390359, 414720, 0x7e4f0424
-1, 396335, 5888, 0x6431a24c
-0, 396364, 414720, 0xa9e75006
-1, 402343, 5888, 0x41f9908c
-0, 402370, 414720, 0x8f98cba9
-1, 408351, 5888, 0x0ed99656
-0, 408375, 414720, 0x25ecd620
-1, 414359, 5888, 0x635a6392
-0, 414381, 414720, 0x78cf5c58
-1, 420367, 5888, 0x690c750c
-0, 420386, 414720, 0x3fb4b81a
-1, 426376, 5888, 0xf9d97b23
-0, 426392, 414720, 0xd7b655fa
-1, 432384, 5888, 0x75e1606b
-0, 432397, 414720, 0xd9158db3
-1, 438392, 5888, 0x1bcb43b0
-0, 438403, 414720, 0x2e651852
-1, 444400, 5888, 0x48c295cb
-0, 444408, 414720, 0x9f9adb64
-1, 450408, 5848, 0xe47f7b5d
-0, 450414, 414720, 0xe9d16e81
-1, 456376, 5888, 0x20be7f3e
-0, 456420, 414720, 0xbe73daf5
-1, 462384, 5888, 0x8c2428c4
-0, 462425, 414720, 0x3d164329
-1, 468392, 5888, 0x851379af
-0, 468431, 414720, 0x1d5a9bc8
-1, 474400, 5888, 0x5916647d
-0, 474436, 414720, 0x8e8debbe
-1, 480408, 5888, 0xef9c6281
-0, 480442, 414720, 0x4e7a2bf0
-1, 486416, 5888, 0x49660d32
-0, 486447, 414720, 0x4a13804d
-1, 492424, 5888, 0x62cf36a1
-0, 492453, 414720, 0x5dd188d8
-1, 498433, 5888, 0x56dff39c
-0, 498458, 414720, 0xbe7f4963
-1, 504441, 5888, 0x4e6b5b02
-0, 504464, 414720, 0xcff3b767
-1, 510449, 5888, 0xb8697067
-0, 510469, 414720, 0xbbd3afa0
-1, 516457, 5888, 0xcb4e2706
-0, 516475, 414720, 0xaf9dec62
-1, 522465, 5888, 0x6eaa9669
-0, 522480, 414720, 0xc74816a1
-1, 528473, 5888, 0xfd9d7dba
-0, 528486, 414720, 0x51488bfc
-1, 534482, 5888, 0xfe137923
-0, 534491, 414720, 0x68c10a2c
-1, 540490, 5848, 0x1931296f
-0, 540497, 414720, 0x10179c4e
-1, 546457, 5888, 0xa09a7c03
-0, 546502, 414720, 0x18d559b7
-1, 552465, 5888, 0xded9802d
-0, 552508, 414720, 0x8257aa55
-1, 558473, 5888, 0x9f6723b7
-0, 558513, 414720, 0x9ea24501
-1, 564482, 5888, 0x3ad02476
-0, 564519, 414720, 0x238605cc
-1, 570490, 5888, 0xa1647e32
-0, 570524, 414720, 0xb552deaa
-1, 576498, 5888, 0x728672da
-0, 576530, 414720, 0x07c3348d
-1, 582506, 5888, 0x9c098090
-0, 582535, 414720, 0x82f4f9b0
-1, 588514, 5888, 0x32a65ea3
-0, 588541, 414720, 0xf5d76bc5
-1, 594522, 5888, 0xdde141d5
-0, 594546, 414720, 0x34b3a1e6
-1, 600531, 5888, 0x816c5fb4
-0, 600552, 414720, 0xda25e11b
-1, 606539, 5888, 0x75e17581
-0, 606558, 414720, 0x2b19936b
-1, 612547, 5888, 0x59035469
-0, 612563, 414720, 0xe91f9f73
-1, 618555, 5888, 0x20d340cd
-0, 618569, 414720, 0x48d09aab
-1, 624563, 5888, 0xa89a8790
-0, 624574, 414720, 0xac42bf83
-1, 630571, 5848, 0x12b74c34
-0, 630580, 414720, 0x2d8ca14e
-1, 636539, 5888, 0xcd3b3bef
-0, 636585, 414720, 0xe65462fd
-1, 642547, 5888, 0xe5c44bf3
-0, 642591, 414720, 0xe5bfc929
-1, 648555, 5888, 0xb82c4fa4
-0, 648596, 414720, 0x66784c58
-1, 654563, 5888, 0x05b2443a
-0, 654602, 414720, 0x70dbeca8
-1, 660571, 5888, 0x78028172
-1, 666580, 5888, 0xdfcac19a
-1, 672588, 5888, 0x0761a0b9
-1, 678596, 5888, 0x77d88607
-1, 684604, 5888, 0xdd7f4d77
-1, 690612, 5888, 0x366bf58a
-1, 696620, 5888, 0x9a3d59b5
-1, 702629, 5888, 0x16cb777f
-1, 708637, 5888, 0x1d4afe64
-1, 714645, 5888, 0xc0fe1e73
-1, 720653, 5848, 0xcceb69c8
-1, 726620, 5888, 0x89449643
-1, 732629, 5888, 0x5fe595b7
-1, 738637, 5888, 0x400a8c77
+#tb 0: 1/1000000
+0, 0, 0, 0, 414720, 0xa5cd50ca
+0, 66728, 66728, 0, 414720, 0x3facd321
+0, 133456, 133456, 0, 414720, 0x849e6d4b
+0, 200184, 200184, 0, 414720, 0xe649363f
+0, 266912, 266912, 0, 414720, 0x5bbd7b14
+0, 333640, 333640, 0, 414720, 0xe246ab51
+0, 400368, 400368, 0, 414720, 0x5721b22e
+0, 467096, 467096, 0, 414720, 0xe391e107
+0, 533824, 533824, 0, 414720, 0x04d851ff
+0, 600552, 600552, 0, 414720, 0x8d80d580
+0, 667280, 667280, 0, 414720, 0x5a24b0bc
+0, 734008, 734008, 0, 414720, 0x06cd6960
+0, 800736, 800736, 0, 414720, 0xf5ca48b4
+0, 867464, 867464, 0, 414720, 0x24700f94
+0, 934192, 934192, 0, 414720, 0xb0bfe451
+0, 1000920, 1000920, 0, 414720, 0x00e9f3d1
+0, 1067648, 1067648, 0, 414720, 0x0efbffd1
+0, 1134376, 1134376, 0, 414720, 0x2ecdfc8d
+0, 1201104, 1201104, 0, 414720, 0x94b531fc
+0, 1267832, 1267832, 0, 414720, 0x2c2579f8
+0, 1334560, 1334560, 0, 414720, 0x6c7ecfb8
+0, 1401288, 1401288, 0, 414720, 0x08982527
+0, 1468016, 1468016, 0, 414720, 0x5c0161b3
+0, 1534744, 1534744, 0, 414720, 0x453ce413
+0, 1601472, 1601472, 0, 414720, 0x634e36b2
+0, 1668200, 1668200, 0, 414720, 0x401a683a
+0, 1734928, 1734928, 0, 414720, 0x3c5f442e
+0, 1801656, 1801656, 0, 414720, 0x075ef787
+0, 1868384, 1868384, 0, 414720, 0x8501a04f
+0, 1935112, 1935112, 0, 414720, 0x3620093b
+0, 2001840, 2001840, 0, 414720, 0xa42d9480
+0, 2068568, 2068568, 0, 414720, 0x09b150b4
+0, 2135296, 2135296, 0, 414720, 0xcad407f0
+0, 2202024, 2202024, 0, 414720, 0x69e5eecd
+0, 2268752, 2268752, 0, 414720, 0xb92ad2d9
+0, 2335480, 2335480, 0, 414720, 0xc78eaf29
+0, 2402208, 2402208, 0, 414720, 0x47c3fa91
+0, 2468936, 2468936, 0, 414720, 0x8847b7b8
+0, 2535664, 2535664, 0, 414720, 0x864cab2f
+0, 2602392, 2602392, 0, 414720, 0x78d653e2
+0, 2669120, 2669120, 0, 414720, 0xda15cbd2
+0, 2735848, 2735848, 0, 414720, 0xdf9ce28a
+0, 2802576, 2802576, 0, 414720, 0xe88c49ca
+0, 2869304, 2869304, 0, 414720, 0xd6bcbc07
+0, 2936032, 2936032, 0, 414720, 0xf0b4a7bf
+0, 3002760, 3002760, 0, 414720, 0x74f9bfbf
+0, 3069488, 3069488, 0, 414720, 0x904ce103
+0, 3136216, 3136216, 0, 414720, 0xca877e4a
+0, 3202944, 3202944, 0, 414720, 0x588effd6
+0, 3269672, 3269672, 0, 414720, 0x6dff8b71
+0, 3336400, 3336400, 0, 414720, 0xbeaae788
+0, 3403128, 3403128, 0, 414720, 0x1a4d1242
+0, 3469856, 3469856, 0, 414720, 0x4ae98ea0
+0, 3536584, 3536584, 0, 414720, 0x41ed6d22
+0, 3603312, 3603312, 0, 414720, 0x486e70aa
+0, 3670040, 3670040, 0, 414720, 0xfddc103e
+0, 3736768, 3736768, 0, 414720, 0x8620f03e
+0, 3803496, 3803496, 0, 414720, 0x0e4ec273
+0, 3870224, 3870224, 0, 414720, 0xb2298b3e
+0, 3936952, 3936952, 0, 414720, 0xb4f50176
+0, 4003680, 4003680, 0, 414720, 0xb9c7a495
+0, 4070408, 4070408, 0, 414720, 0xed270702
+0, 4137136, 4137136, 0, 414720, 0x98b72586
+0, 4203864, 4203864, 0, 414720, 0xd8977cb1
+0, 4270592, 4270592, 0, 414720, 0xff3d3851
+0, 4337320, 4337320, 0, 414720, 0x7e4f0424
+0, 4404048, 4404048, 0, 414720, 0xa9e75006
+0, 4470776, 4470776, 0, 414720, 0x8f98cba9
+0, 4537504, 4537504, 0, 414720, 0x25ecd620
+0, 4604232, 4604232, 0, 414720, 0x78cf5c58
+0, 4670960, 4670960, 0, 414720, 0x3fb4b81a
+0, 4737688, 4737688, 0, 414720, 0xd7b655fa
+0, 4804416, 4804416, 0, 414720, 0xd9158db3
+0, 4871144, 4871144, 0, 414720, 0x2e651852
+0, 4937872, 4937872, 0, 414720, 0x9f9adb64
+0, 5004600, 5004600, 0, 414720, 0xe9d16e81
+0, 5071328, 5071328, 0, 414720, 0xbe73daf5
+0, 5138056, 5138056, 0, 414720, 0x3d164329
+0, 5204784, 5204784, 0, 414720, 0x1d5a9bc8
+0, 5271512, 5271512, 0, 414720, 0x8e8debbe
+0, 5338240, 5338240, 0, 414720, 0x4e7a2bf0
+0, 5404968, 5404968, 0, 414720, 0x4a13804d
+0, 5471696, 5471696, 0, 414720, 0x5dd188d8
+0, 5538424, 5538424, 0, 414720, 0xbe7f4963
+0, 5605152, 5605152, 0, 414720, 0xcff3b767
+0, 5671880, 5671880, 0, 414720, 0xbbd3afa0
+0, 5738608, 5738608, 0, 414720, 0xaf9dec62
+0, 5805336, 5805336, 0, 414720, 0xc74816a1
+0, 5872064, 5872064, 0, 414720, 0x51488bfc
+0, 5938792, 5938792, 0, 414720, 0x68c10a2c
+0, 6005520, 6005520, 0, 414720, 0x10179c4e
+0, 6072248, 6072248, 0, 414720, 0x18d559b7
+0, 6138976, 6138976, 0, 414720, 0x8257aa55
+0, 6205704, 6205704, 0, 414720, 0x9ea24501
+0, 6272432, 6272432, 0, 414720, 0x238605cc
+0, 6339160, 6339160, 0, 414720, 0xb552deaa
+0, 6405888, 6405888, 0, 414720, 0x07c3348d
+0, 6472616, 6472616, 0, 414720, 0x82f4f9b0
+0, 6539344, 6539344, 0, 414720, 0xf5d76bc5
+0, 6606072, 6606072, 0, 414720, 0x34b3a1e6
+0, 6672800, 6672800, 0, 414720, 0xda25e11b
+0, 6739528, 6739528, 0, 414720, 0x2b19936b
+0, 6806256, 6806256, 0, 414720, 0xe91f9f73
+0, 6872984, 6872984, 0, 414720, 0x48d09aab
+0, 6939712, 6939712, 0, 414720, 0xac42bf83
+0, 7006440, 7006440, 0, 414720, 0x2d8ca14e
+0, 7073168, 7073168, 0, 414720, 0xe65462fd
+0, 7139896, 7139896, 0, 414720, 0xe5bfc929
+0, 7206624, 7206624, 0, 414720, 0x66784c58
+0, 7273352, 7273352, 0, 414720, 0x70dbeca8
diff --git a/gst-libs/ext/libav/tests/ref/fate/iv8-demux b/gst-libs/ext/libav/tests/ref/fate/iv8-demux
index 87217f9..56a54a1 100644
--- a/gst-libs/ext/libav/tests/ref/fate/iv8-demux
+++ b/gst-libs/ext/libav/tests/ref/fate/iv8-demux
@@ -1,25 +1,26 @@
-0, 0, 20883, 0x347191e2
-0, 0, 20882, 0xe1573905
-0, 3600, 20894, 0xd54f516a
-0, 7200, 20891, 0x1b5c5039
-0, 10800, 20883, 0x8e785b4d
-0, 14400, 20870, 0xd26ca1f6
-0, 18000, 21448, 0x946f5b2b
-0, 21600, 21433, 0xb18687c5
-0, 25200, 20865, 0xc0eb3fce
-0, 28800, 20842, 0x9d0728ba
-0, 32399, 20878, 0xf60f5dee
-0, 35999, 20866, 0x3bde568f
-0, 39600, 20884, 0x22736993
-0, 43200, 20860, 0xf56f2fca
-0, 46800, 20872, 0xf39e3cb3
-0, 50400, 20835, 0xa3c4363b
-0, 53999, 20905, 0x552853d1
-0, 57600, 20874, 0xed0b91ec
-0, 61200, 20877, 0xe1623e01
-0, 64799, 20933, 0x19906564
-0, 68399, 20891, 0x3d064fd3
-0, 72000, 20834, 0xcb774dbc
-0, 75600, 20870, 0xbc536589
-0, 79200, 21421, 0xc99a68e4
-0, 82800, 12869, 0x5684e304
+#tb 0: 1/90000
+0, 0, 0, 0, 20883, 0x347191e2
+0, 0, 3600, 0, 20882, 0xe1573905
+0, 3600, 7200, 0, 20894, 0xd54f516a
+0, 7200, 10800, 0, 20891, 0x1b5c5039
+0, 10800, 14400, 0, 20883, 0x8e785b4d
+0, 14400, 18000, 0, 20870, 0xd26ca1f6
+0, 18000, 21600, 0, 21448, 0x946f5b2b
+0, 21600, 25200, 0, 21433, 0xb18687c5
+0, 25200, 28800, 0, 20865, 0xc0eb3fce
+0, 28800, 32399, 0, 20842, 0x9d0728ba
+0, 32399, 35999, 0, 20878, 0xf60f5dee
+0, 35999, 39600, 0, 20866, 0x3bde568f
+0, 39600, 43200, 0, 20884, 0x22736993
+0, 43200, 46800, 0, 20860, 0xf56f2fca
+0, 46800, 50400, 0, 20872, 0xf39e3cb3
+0, 50400, 53999, 0, 20835, 0xa3c4363b
+0, 53999, 57600, 0, 20905, 0x552853d1
+0, 57600, 61200, 0, 20874, 0xed0b91ec
+0, 61200, 64799, 0, 20877, 0xe1623e01
+0, 64799, 68399, 0, 20933, 0x19906564
+0, 68399, 72000, 3600, 20891, 0x3d064fd3
+0, 72000, 75600, 3600, 20834, 0xcb774dbc
+0, 75600, 79200, 3600, 20870, 0xbc536589
+0, 79200, 82800, 3600, 21421, 0xc99a68e4
+0, 82800, 86400, 3600, 12869, 0x5684e304
diff --git a/gst-libs/ext/libav/tests/ref/fate/kgv1 b/gst-libs/ext/libav/tests/ref/fate/kgv1
new file mode 100644
index 0000000..6f35893
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/kgv1
@@ -0,0 +1,314 @@
+#tb 0: 1/60
+0, 0, 0, 1, 153600, 0x00000000
+0, 1, 1, 1, 153600, 0x00000000
+0, 2, 2, 1, 153600, 0x00000000
+0, 3, 3, 1, 153600, 0x00000000
+0, 4, 4, 1, 153600, 0x00000000
+0, 5, 5, 1, 153600, 0x00000000
+0, 6, 6, 1, 153600, 0x00000000
+0, 7, 7, 1, 153600, 0x00000000
+0, 8, 8, 1, 153600, 0x00000000
+0, 9, 9, 1, 153600, 0x00000000
+0, 10, 10, 1, 153600, 0x00000000
+0, 11, 11, 1, 153600, 0x00000000
+0, 12, 12, 1, 153600, 0x00000000
+0, 13, 13, 1, 153600, 0x00000000
+0, 14, 14, 1, 153600, 0x00000000
+0, 15, 15, 1, 153600, 0x00000000
+0, 16, 16, 1, 153600, 0x00000000
+0, 17, 17, 1, 153600, 0x00000000
+0, 18, 18, 1, 153600, 0x00000000
+0, 19, 19, 1, 153600, 0x00000000
+0, 20, 20, 1, 153600, 0x00000000
+0, 21, 21, 1, 153600, 0x00000000
+0, 22, 22, 1, 153600, 0x00000000
+0, 23, 23, 1, 153600, 0x00000000
+0, 24, 24, 1, 153600, 0x00000000
+0, 25, 25, 1, 153600, 0x00000000
+0, 26, 26, 1, 153600, 0x00000000
+0, 27, 27, 1, 153600, 0x00000000
+0, 28, 28, 1, 153600, 0x00000000
+0, 29, 29, 1, 153600, 0x00000000
+0, 30, 30, 1, 153600, 0x00000000
+0, 31, 31, 1, 153600, 0x00000000
+0, 32, 32, 1, 153600, 0x00000000
+0, 33, 33, 1, 153600, 0x00000000
+0, 34, 34, 1, 153600, 0x00000000
+0, 35, 35, 1, 153600, 0x00000000
+0, 36, 36, 1, 153600, 0x00000000
+0, 37, 37, 1, 153600, 0x00000000
+0, 38, 38, 1, 153600, 0x00000000
+0, 39, 39, 1, 153600, 0x00000000
+0, 40, 40, 1, 153600, 0x00000000
+0, 41, 41, 1, 153600, 0x00000000
+0, 42, 42, 1, 153600, 0x00000000
+0, 43, 43, 1, 153600, 0x00000000
+0, 44, 44, 1, 153600, 0x00000000
+0, 45, 45, 1, 153600, 0x00000000
+0, 46, 46, 1, 153600, 0x00000000
+0, 47, 47, 1, 153600, 0xab738fc1
+0, 48, 48, 1, 153600, 0x520c9bd3
+0, 49, 49, 1, 153600, 0x19347233
+0, 50, 50, 1, 153600, 0x9e81fe64
+0, 51, 51, 1, 153600, 0x75be7504
+0, 52, 52, 1, 153600, 0x29374d04
+0, 53, 53, 1, 153600, 0xc6b92fd4
+0, 54, 54, 1, 153600, 0xeeec5124
+0, 55, 55, 1, 153600, 0x2fc36324
+0, 56, 56, 1, 153600, 0x112580f4
+0, 57, 57, 1, 153600, 0x177b9a84
+0, 58, 58, 1, 153600, 0x214abb44
+0, 59, 59, 1, 153600, 0x83580173
+0, 60, 60, 1, 153600, 0x95f49284
+0, 61, 61, 1, 153600, 0xe31c5984
+0, 62, 62, 1, 153600, 0xf1756984
+0, 63, 63, 1, 153600, 0x6c004804
+0, 64, 64, 1, 153600, 0xbe6631b4
+0, 65, 65, 1, 153600, 0x1d910494
+0, 66, 66, 1, 153600, 0xd8ecfc25
+0, 67, 67, 1, 153600, 0xdd281364
+0, 68, 68, 1, 153600, 0x52545084
+0, 69, 69, 1, 153600, 0xfed6b944
+0, 70, 70, 1, 153600, 0x6e0b7ee4
+0, 71, 71, 1, 153600, 0x516a5724
+0, 72, 72, 1, 153600, 0xaffd7844
+0, 73, 73, 1, 153600, 0x5a304ba4
+0, 74, 74, 1, 153600, 0xea365ce4
+0, 75, 75, 1, 153600, 0xef654a84
+0, 76, 76, 1, 153600, 0x32d14584
+0, 77, 77, 1, 153600, 0x6bf843e4
+0, 78, 78, 1, 153600, 0x023d5b94
+0, 79, 79, 1, 153600, 0xd4506154
+0, 80, 80, 1, 153600, 0xeaf0bd24
+0, 81, 81, 1, 153600, 0x426efb94
+0, 82, 82, 1, 153600, 0x98bcde64
+0, 83, 83, 1, 153600, 0xa1bbb4a4
+0, 84, 84, 1, 153600, 0x36688414
+0, 85, 85, 1, 153600, 0x2e4b75d4
+0, 86, 86, 1, 153600, 0x33885884
+0, 87, 87, 1, 153600, 0x6c065224
+0, 88, 88, 1, 153600, 0x1a0252b4
+0, 89, 89, 1, 153600, 0x55896084
+0, 90, 90, 1, 153600, 0xb9df7a04
+0, 91, 91, 1, 153600, 0x6f8a9734
+0, 92, 92, 1, 153600, 0xa3d3dbb4
+0, 93, 93, 1, 153600, 0x907a2483
+0, 94, 94, 1, 153600, 0xf4816ad3
+0, 95, 95, 1, 153600, 0x4e9195e3
+0, 96, 96, 1, 153600, 0xf486a373
+0, 97, 97, 1, 153600, 0x8f6aa693
+0, 98, 98, 1, 153600, 0x8f6aa693
+0, 99, 99, 1, 153600, 0x8f6aa693
+0, 100, 100, 1, 153600, 0x8f6aa693
+0, 101, 101, 1, 153600, 0x8f6aa693
+0, 102, 102, 1, 153600, 0x8f6aa693
+0, 103, 103, 1, 153600, 0x17d9c117
+0, 104, 104, 1, 153600, 0x17d9c117
+0, 105, 105, 1, 153600, 0x17d9c117
+0, 106, 106, 1, 153600, 0x17d9c117
+0, 107, 107, 1, 153600, 0x17d9c117
+0, 108, 108, 1, 153600, 0x7a47386f
+0, 109, 109, 1, 153600, 0x7a47386f
+0, 110, 110, 1, 153600, 0x7a47386f
+0, 111, 111, 1, 153600, 0x7a47386f
+0, 112, 112, 1, 153600, 0x7a47386f
+0, 113, 113, 1, 153600, 0x829dccaa
+0, 114, 114, 1, 153600, 0x829dccaa
+0, 115, 115, 1, 153600, 0x829dccaa
+0, 116, 116, 1, 153600, 0x829dccaa
+0, 117, 117, 1, 153600, 0x829dccaa
+0, 118, 118, 1, 153600, 0x2d58ab4a
+0, 119, 119, 1, 153600, 0x2d58ab4a
+0, 120, 120, 1, 153600, 0x2d58ab4a
+0, 121, 121, 1, 153600, 0x2d58ab4a
+0, 122, 122, 1, 153600, 0x2d58ab4a
+0, 123, 123, 1, 153600, 0x2d58ab4a
+0, 124, 124, 1, 153600, 0x2d58ab4a
+0, 125, 125, 1, 153600, 0x2d58ab4a
+0, 126, 126, 1, 153600, 0x2d58ab4a
+0, 127, 127, 1, 153600, 0x2d58ab4a
+0, 128, 128, 1, 153600, 0x2d58ab4a
+0, 129, 129, 1, 153600, 0x2d58ab4a
+0, 130, 130, 1, 153600, 0x2d58ab4a
+0, 131, 131, 1, 153600, 0x2d58ab4a
+0, 132, 132, 1, 153600, 0x2d58ab4a
+0, 133, 133, 1, 153600, 0x2d58ab4a
+0, 134, 134, 1, 153600, 0x2d58ab4a
+0, 135, 135, 1, 153600, 0x2d58ab4a
+0, 136, 136, 1, 153600, 0x2d58ab4a
+0, 137, 137, 1, 153600, 0x2d58ab4a
+0, 138, 138, 1, 153600, 0x2d58ab4a
+0, 139, 139, 1, 153600, 0x2d58ab4a
+0, 140, 140, 1, 153600, 0x2d58ab4a
+0, 141, 141, 1, 153600, 0x2d58ab4a
+0, 142, 142, 1, 153600, 0x2d58ab4a
+0, 143, 143, 1, 153600, 0x2d58ab4a
+0, 144, 144, 1, 153600, 0x2d58ab4a
+0, 145, 145, 1, 153600, 0x2d58ab4a
+0, 146, 146, 1, 153600, 0x2d58ab4a
+0, 147, 147, 1, 153600, 0x2d58ab4a
+0, 148, 148, 1, 153600, 0x2d58ab4a
+0, 149, 149, 1, 153600, 0x2d58ab4a
+0, 150, 150, 1, 153600, 0x2d58ab4a
+0, 151, 151, 1, 153600, 0x2d58ab4a
+0, 152, 152, 1, 153600, 0x2d58ab4a
+0, 153, 153, 1, 153600, 0x2d58ab4a
+0, 154, 154, 1, 153600, 0x2d58ab4a
+0, 155, 155, 1, 153600, 0x2d58ab4a
+0, 156, 156, 1, 153600, 0x2d58ab4a
+0, 157, 157, 1, 153600, 0x2d58ab4a
+0, 158, 158, 1, 153600, 0x2d58ab4a
+0, 159, 159, 1, 153600, 0x2d58ab4a
+0, 160, 160, 1, 153600, 0x2d58ab4a
+0, 161, 161, 1, 153600, 0x2d58ab4a
+0, 162, 162, 1, 153600, 0x2d58ab4a
+0, 163, 163, 1, 153600, 0x2d58ab4a
+0, 164, 164, 1, 153600, 0x2d58ab4a
+0, 165, 165, 1, 153600, 0x2d58ab4a
+0, 166, 166, 1, 153600, 0x2d58ab4a
+0, 167, 167, 1, 153600, 0x2d58ab4a
+0, 168, 168, 1, 153600, 0x2d58ab4a
+0, 169, 169, 1, 153600, 0x2d58ab4a
+0, 170, 170, 1, 153600, 0x2d58ab4a
+0, 171, 171, 1, 153600, 0x2d58ab4a
+0, 172, 172, 1, 153600, 0x2d58ab4a
+0, 173, 173, 1, 153600, 0x2d58ab4a
+0, 174, 174, 1, 153600, 0x2d58ab4a
+0, 175, 175, 1, 153600, 0x2d58ab4a
+0, 176, 176, 1, 153600, 0x2d58ab4a
+0, 177, 177, 1, 153600, 0x2d58ab4a
+0, 178, 178, 1, 153600, 0x2d58ab4a
+0, 179, 179, 1, 153600, 0x2d58ab4a
+0, 180, 180, 1, 153600, 0x2d58ab4a
+0, 181, 181, 1, 153600, 0x2d58ab4a
+0, 182, 182, 1, 153600, 0x2d58ab4a
+0, 183, 183, 1, 153600, 0x2d58ab4a
+0, 184, 184, 1, 153600, 0x2d58ab4a
+0, 185, 185, 1, 153600, 0x2d58ab4a
+0, 186, 186, 1, 153600, 0x2d58ab4a
+0, 187, 187, 1, 153600, 0x2d58ab4a
+0, 188, 188, 1, 153600, 0x2d58ab4a
+0, 189, 189, 1, 153600, 0x2d58ab4a
+0, 190, 190, 1, 153600, 0x2d58ab4a
+0, 191, 191, 1, 153600, 0x2d58ab4a
+0, 192, 192, 1, 153600, 0x2d58ab4a
+0, 193, 193, 1, 153600, 0x2d58ab4a
+0, 194, 194, 1, 153600, 0x2d58ab4a
+0, 195, 195, 1, 153600, 0x2d58ab4a
+0, 196, 196, 1, 153600, 0x2d58ab4a
+0, 197, 197, 1, 153600, 0x2d58ab4a
+0, 198, 198, 1, 153600, 0x2d58ab4a
+0, 199, 199, 1, 153600, 0x2d58ab4a
+0, 200, 200, 1, 153600, 0x2d58ab4a
+0, 201, 201, 1, 153600, 0x2d58ab4a
+0, 202, 202, 1, 153600, 0x2d58ab4a
+0, 203, 203, 1, 153600, 0x2d58ab4a
+0, 204, 204, 1, 153600, 0x2d58ab4a
+0, 205, 205, 1, 153600, 0x2d58ab4a
+0, 206, 206, 1, 153600, 0x2d58ab4a
+0, 207, 207, 1, 153600, 0x2d58ab4a
+0, 208, 208, 1, 153600, 0x2d58ab4a
+0, 209, 209, 1, 153600, 0x2d58ab4a
+0, 210, 210, 1, 153600, 0x2d58ab4a
+0, 211, 211, 1, 153600, 0x2d58ab4a
+0, 212, 212, 1, 153600, 0x2d58ab4a
+0, 213, 213, 1, 153600, 0x2d58ab4a
+0, 214, 214, 1, 153600, 0x2d58ab4a
+0, 215, 215, 1, 153600, 0x2d58ab4a
+0, 216, 216, 1, 153600, 0x2d58ab4a
+0, 217, 217, 1, 153600, 0x2d58ab4a
+0, 218, 218, 1, 153600, 0x2d58ab4a
+0, 219, 219, 1, 153600, 0x2d58ab4a
+0, 220, 220, 1, 153600, 0x2d58ab4a
+0, 221, 221, 1, 153600, 0x2d58ab4a
+0, 222, 222, 1, 153600, 0x2d58ab4a
+0, 223, 223, 1, 153600, 0x2d58ab4a
+0, 224, 224, 1, 153600, 0x2d58ab4a
+0, 225, 225, 1, 153600, 0x2d58ab4a
+0, 226, 226, 1, 153600, 0x2d58ab4a
+0, 227, 227, 1, 153600, 0x2d58ab4a
+0, 228, 228, 1, 153600, 0x2d58ab4a
+0, 229, 229, 1, 153600, 0x2d58ab4a
+0, 230, 230, 1, 153600, 0x2d58ab4a
+0, 231, 231, 1, 153600, 0x2d58ab4a
+0, 232, 232, 1, 153600, 0x2d58ab4a
+0, 233, 233, 1, 153600, 0x2d58ab4a
+0, 234, 234, 1, 153600, 0x2d58ab4a
+0, 235, 235, 1, 153600, 0x2d58ab4a
+0, 236, 236, 1, 153600, 0x2d58ab4a
+0, 237, 237, 1, 153600, 0x2d58ab4a
+0, 238, 238, 1, 153600, 0x2d58ab4a
+0, 239, 239, 1, 153600, 0x2d58ab4a
+0, 240, 240, 1, 153600, 0x2d58ab4a
+0, 241, 241, 1, 153600, 0x2d58ab4a
+0, 242, 242, 1, 153600, 0x2d58ab4a
+0, 243, 243, 1, 153600, 0x2d58ab4a
+0, 244, 244, 1, 153600, 0x2d58ab4a
+0, 245, 245, 1, 153600, 0x2d58ab4a
+0, 246, 246, 1, 153600, 0x2d58ab4a
+0, 247, 247, 1, 153600, 0x2d58ab4a
+0, 248, 248, 1, 153600, 0x2d58ab4a
+0, 249, 249, 1, 153600, 0x2d58ab4a
+0, 250, 250, 1, 153600, 0x2d58ab4a
+0, 251, 251, 1, 153600, 0x2d58ab4a
+0, 252, 252, 1, 153600, 0x2d58ab4a
+0, 253, 253, 1, 153600, 0x2d58ab4a
+0, 254, 254, 1, 153600, 0x2d58ab4a
+0, 255, 255, 1, 153600, 0x2d58ab4a
+0, 256, 256, 1, 153600, 0x2d58ab4a
+0, 257, 257, 1, 153600, 0x2d58ab4a
+0, 258, 258, 1, 153600, 0x2d58ab4a
+0, 259, 259, 1, 153600, 0x2d58ab4a
+0, 260, 260, 1, 153600, 0x2d58ab4a
+0, 261, 261, 1, 153600, 0x2d58ab4a
+0, 262, 262, 1, 153600, 0x2d58ab4a
+0, 263, 263, 1, 153600, 0x2d58ab4a
+0, 264, 264, 1, 153600, 0x2d58ab4a
+0, 265, 265, 1, 153600, 0x2d58ab4a
+0, 266, 266, 1, 153600, 0x2d58ab4a
+0, 267, 267, 1, 153600, 0x2d58ab4a
+0, 268, 268, 1, 153600, 0x2d58ab4a
+0, 269, 269, 1, 153600, 0x2d58ab4a
+0, 270, 270, 1, 153600, 0x2d58ab4a
+0, 271, 271, 1, 153600, 0x2d58ab4a
+0, 272, 272, 1, 153600, 0x2d58ab4a
+0, 273, 273, 1, 153600, 0x2d58ab4a
+0, 274, 274, 1, 153600, 0x2d58ab4a
+0, 275, 275, 1, 153600, 0x2d58ab4a
+0, 276, 276, 1, 153600, 0x2d58ab4a
+0, 277, 277, 1, 153600, 0x2d58ab4a
+0, 278, 278, 1, 153600, 0x2d58ab4a
+0, 279, 279, 1, 153600, 0x2d58ab4a
+0, 280, 280, 1, 153600, 0x2d58ab4a
+0, 281, 281, 1, 153600, 0x2d58ab4a
+0, 282, 282, 1, 153600, 0x2d58ab4a
+0, 283, 283, 1, 153600, 0x2d58ab4a
+0, 284, 284, 1, 153600, 0x7815bb72
+0, 285, 285, 1, 153600, 0x47ec1353
+0, 286, 286, 1, 153600, 0x6599fabc
+0, 287, 287, 1, 153600, 0x3d8a8690
+0, 288, 288, 1, 153600, 0xc0bc1ba5
+0, 289, 289, 1, 153600, 0x07368f2a
+0, 290, 290, 1, 153600, 0x81c54b89
+0, 291, 291, 1, 153600, 0xbfcae7bf
+0, 292, 292, 1, 153600, 0x1348310e
+0, 293, 293, 1, 153600, 0xb5489dad
+0, 294, 294, 1, 153600, 0xa1eb1408
+0, 295, 295, 1, 153600, 0x15e1832c
+0, 296, 296, 1, 153600, 0xb789cba5
+0, 297, 297, 1, 153600, 0x3ee86e4f
+0, 298, 298, 1, 153600, 0x06ea3883
+0, 299, 299, 1, 153600, 0xcedd02b7
+0, 300, 300, 1, 153600, 0xbce6ce58
+0, 301, 301, 1, 153600, 0xaadf9a00
+0, 302, 302, 1, 153600, 0x98c865a0
+0, 303, 303, 1, 153600, 0x4c8432e0
+0, 304, 304, 1, 153600, 0x00000000
+0, 305, 305, 1, 153600, 0x00000000
+0, 306, 306, 1, 153600, 0x00000000
+0, 307, 307, 1, 153600, 0x00000000
+0, 308, 308, 1, 153600, 0x00000000
+0, 309, 309, 1, 153600, 0x00000000
+0, 310, 310, 1, 153600, 0x00000000
+0, 311, 311, 1, 153600, 0x00000000
+0, 312, 312, 1, 153600, 0x00000000
diff --git a/gst-libs/ext/libav/tests/ref/fate/kmvc b/gst-libs/ext/libav/tests/ref/fate/kmvc
index eb7bcda..8a733bb 100644
--- a/gst-libs/ext/libav/tests/ref/fate/kmvc
+++ b/gst-libs/ext/libav/tests/ref/fate/kmvc
@@ -1,75 +1,76 @@
-0, 0, 153600, 0x00000000
-0, 3600, 153600, 0x00000000
-0, 7200, 153600, 0x00000000
-0, 10800, 153600, 0x3ad906f0
-0, 14400, 153600, 0x9f7c2e80
-0, 18000, 153600, 0x548c9e10
-0, 21600, 153600, 0xab4154e7
-0, 25200, 153600, 0x762964be
-0, 28800, 153600, 0xea6beab1
-0, 32400, 153600, 0x00805c23
-0, 36000, 153600, 0x932eebd2
-0, 39600, 153600, 0x73a9a1c4
-0, 43200, 153600, 0x3ecf80a2
-0, 46800, 153600, 0xb7266fcc
-0, 50400, 153600, 0xf9a75e02
-0, 54000, 153600, 0xa4cb4c00
-0, 57600, 153600, 0x8cc653fa
-0, 61200, 153600, 0xf0735df0
-0, 64800, 153600, 0x46945766
-0, 68400, 153600, 0x1cf75120
-0, 72000, 153600, 0x015d4476
-0, 75600, 153600, 0x4ad6419c
-0, 79200, 153600, 0xf97a1292
-0, 82800, 153600, 0x8048c6bd
-0, 86400, 153600, 0x0aa97f7f
-0, 90000, 153600, 0xcd1a0531
-0, 93600, 153600, 0xeb9e72b4
-0, 97200, 153600, 0x5a61d657
-0, 100800, 153600, 0xc4eb1759
-0, 104400, 153600, 0x07b05b0c
-0, 108000, 153600, 0x9c417927
-0, 111600, 153600, 0xa3a28516
-0, 115200, 153600, 0x78e97511
-0, 118800, 153600, 0x05c94e38
-0, 122400, 153600, 0x0003ffa4
-0, 126000, 153600, 0x46489827
-0, 129600, 153600, 0xa6ac0ea6
-0, 133200, 153600, 0xf4ae7e9a
-0, 136800, 153600, 0xe07dd526
-0, 140400, 153600, 0x5c0d0ab9
-0, 144000, 153600, 0xad542525
-0, 147600, 153600, 0xa72a35b1
-0, 151200, 153600, 0x373d3cbd
-0, 154800, 153600, 0x242c3cad
-0, 158400, 153600, 0xbe4f44e5
-0, 162000, 153600, 0x3b883575
-0, 165600, 153600, 0xcd7d2995
-0, 169200, 153600, 0x89a01f99
-0, 172800, 153600, 0x79ac0861
-0, 176400, 153600, 0xefb6ee22
-0, 180000, 153600, 0x4498d6b2
-0, 183600, 153600, 0x99efd0a6
-0, 187200, 153600, 0xd937c282
-0, 190800, 153600, 0xa6c6bbb2
-0, 194400, 153600, 0xf667bf0e
-0, 198000, 153600, 0x83b2c12e
-0, 201600, 153600, 0xcbd6c766
-0, 205200, 153600, 0xc5b3c762
-0, 208800, 153600, 0xe51fc5fa
-0, 212400, 153600, 0x6542c5ee
-0, 216000, 153600, 0x59d2c946
-0, 219600, 153600, 0xccaacdde
-0, 223200, 153600, 0x884ec6aa
-0, 226800, 153600, 0xb3d7c2de
-0, 230400, 153600, 0xd4e8c1a2
-0, 234000, 153600, 0xa416c3ba
-0, 237600, 153600, 0x6905b62e
-0, 241200, 153600, 0xce16b456
-0, 244800, 153600, 0xcbd9a67e
-0, 248400, 153600, 0x6785afd6
-0, 252000, 153600, 0x6fd7b1fa
-0, 255600, 153600, 0x2a65b77e
-0, 259200, 153600, 0xa162aff6
-0, 262800, 153600, 0x227ea802
-0, 266400, 153600, 0x98de79fa
+#tb 0: 1/25
+0, 0, 0, 1, 153600, 0x00000000
+0, 1, 1, 1, 153600, 0x00000000
+0, 2, 2, 1, 153600, 0x00000000
+0, 3, 3, 1, 153600, 0x3ad906f0
+0, 4, 4, 1, 153600, 0x9f7c2e80
+0, 5, 5, 1, 153600, 0x548c9e10
+0, 6, 6, 1, 153600, 0xab4154e7
+0, 7, 7, 1, 153600, 0x762964be
+0, 8, 8, 1, 153600, 0xea6beab1
+0, 9, 9, 1, 153600, 0x00805c23
+0, 10, 10, 1, 153600, 0x932eebd2
+0, 11, 11, 1, 153600, 0x73a9a1c4
+0, 12, 12, 1, 153600, 0x3ecf80a2
+0, 13, 13, 1, 153600, 0xb7266fcc
+0, 14, 14, 1, 153600, 0xf9a75e02
+0, 15, 15, 1, 153600, 0xa4cb4c00
+0, 16, 16, 1, 153600, 0x8cc653fa
+0, 17, 17, 1, 153600, 0xf0735df0
+0, 18, 18, 1, 153600, 0x46945766
+0, 19, 19, 1, 153600, 0x1cf75120
+0, 20, 20, 1, 153600, 0x015d4476
+0, 21, 21, 1, 153600, 0x4ad6419c
+0, 22, 22, 1, 153600, 0xf97a1292
+0, 23, 23, 1, 153600, 0x8048c6bd
+0, 24, 24, 1, 153600, 0x0aa97f7f
+0, 25, 25, 1, 153600, 0xcd1a0531
+0, 26, 26, 1, 153600, 0xeb9e72b4
+0, 27, 27, 1, 153600, 0x5a61d657
+0, 28, 28, 1, 153600, 0xc4eb1759
+0, 29, 29, 1, 153600, 0x07b05b0c
+0, 30, 30, 1, 153600, 0x9c417927
+0, 31, 31, 1, 153600, 0xa3a28516
+0, 32, 32, 1, 153600, 0x78e97511
+0, 33, 33, 1, 153600, 0x05c94e38
+0, 34, 34, 1, 153600, 0x0003ffa4
+0, 35, 35, 1, 153600, 0x46489827
+0, 36, 36, 1, 153600, 0xa6ac0ea6
+0, 37, 37, 1, 153600, 0xf4ae7e9a
+0, 38, 38, 1, 153600, 0xe07dd526
+0, 39, 39, 1, 153600, 0x5c0d0ab9
+0, 40, 40, 1, 153600, 0xad542525
+0, 41, 41, 1, 153600, 0xa72a35b1
+0, 42, 42, 1, 153600, 0x373d3cbd
+0, 43, 43, 1, 153600, 0x242c3cad
+0, 44, 44, 1, 153600, 0xbe4f44e5
+0, 45, 45, 1, 153600, 0x3b883575
+0, 46, 46, 1, 153600, 0xcd7d2995
+0, 47, 47, 1, 153600, 0x89a01f99
+0, 48, 48, 1, 153600, 0x79ac0861
+0, 49, 49, 1, 153600, 0xefb6ee22
+0, 50, 50, 1, 153600, 0x4498d6b2
+0, 51, 51, 1, 153600, 0x99efd0a6
+0, 52, 52, 1, 153600, 0xd937c282
+0, 53, 53, 1, 153600, 0xa6c6bbb2
+0, 54, 54, 1, 153600, 0xf667bf0e
+0, 55, 55, 1, 153600, 0x83b2c12e
+0, 56, 56, 1, 153600, 0xcbd6c766
+0, 57, 57, 1, 153600, 0xc5b3c762
+0, 58, 58, 1, 153600, 0xe51fc5fa
+0, 59, 59, 1, 153600, 0x6542c5ee
+0, 60, 60, 1, 153600, 0x59d2c946
+0, 61, 61, 1, 153600, 0xccaacdde
+0, 62, 62, 1, 153600, 0x884ec6aa
+0, 63, 63, 1, 153600, 0xb3d7c2de
+0, 64, 64, 1, 153600, 0xd4e8c1a2
+0, 65, 65, 1, 153600, 0xa416c3ba
+0, 66, 66, 1, 153600, 0x6905b62e
+0, 67, 67, 1, 153600, 0xce16b456
+0, 68, 68, 1, 153600, 0xcbd9a67e
+0, 69, 69, 1, 153600, 0x6785afd6
+0, 70, 70, 1, 153600, 0x6fd7b1fa
+0, 71, 71, 1, 153600, 0x2a65b77e
+0, 72, 72, 1, 153600, 0xa162aff6
+0, 73, 73, 1, 153600, 0x227ea802
+0, 74, 74, 1, 153600, 0x98de79fa
diff --git a/gst-libs/ext/libav/tests/ref/fate/lagarith-rgb24 b/gst-libs/ext/libav/tests/ref/fate/lagarith-rgb24
new file mode 100644
index 0000000..1eb2bc4
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/lagarith-rgb24
@@ -0,0 +1,5 @@
+#tb 0: 100/2997
+0, 0, 0, 1, 368640, 0x26f74db2
+0, 1, 1, 1, 368640, 0x63b29ea4
+0, 2, 2, 1, 368640, 0x19467f03
+0, 3, 3, 1, 368640, 0x5fdc3575
diff --git a/gst-libs/ext/libav/tests/ref/fate/lagarith-rgb32 b/gst-libs/ext/libav/tests/ref/fate/lagarith-rgb32
new file mode 100644
index 0000000..490e2e5
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/lagarith-rgb32
@@ -0,0 +1,26 @@
+#tb 0: 1001/24000
+0, 0, 0, 1, 1382400, 0x00000000
+0, 1, 1, 1, 1382400, 0x00000000
+0, 2, 2, 1, 1382400, 0x00000000
+0, 3, 3, 1, 1382400, 0x00000000
+0, 4, 4, 1, 1382400, 0x00000000
+0, 5, 5, 1, 1382400, 0xf95bde46
+0, 6, 6, 1, 1382400, 0x4f4c0393
+0, 7, 7, 1, 1382400, 0xe5aa40db
+0, 8, 8, 1, 1382400, 0xc25a8ba2
+0, 9, 9, 1, 1382400, 0x9db3150d
+0, 10, 10, 1, 1382400, 0x730e64b3
+0, 11, 11, 1, 1382400, 0xf8fd7edf
+0, 12, 12, 1, 1382400, 0x0114798a
+0, 13, 13, 1, 1382400, 0x7571210f
+0, 14, 14, 1, 1382400, 0x552ae59d
+0, 15, 15, 1, 1382400, 0x7ae0c946
+0, 16, 16, 1, 1382400, 0x0818c3ef
+0, 17, 17, 1, 1382400, 0x8257cac4
+0, 18, 18, 1, 1382400, 0x7762a979
+0, 19, 19, 1, 1382400, 0x282af57a
+0, 20, 20, 1, 1382400, 0x3f42de50
+0, 21, 21, 1, 1382400, 0xc42d5f93
+0, 22, 22, 1, 1382400, 0x18775c90
+0, 23, 23, 1, 1382400, 0x34befa90
+0, 24, 24, 1, 1382400, 0xd33d5f53
diff --git a/gst-libs/ext/libav/tests/ref/fate/lagarith-yuy2 b/gst-libs/ext/libav/tests/ref/fate/lagarith-yuy2
new file mode 100644
index 0000000..c5aed92
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/lagarith-yuy2
@@ -0,0 +1,2 @@
+#tb 0: 1/10
+0, 0, 0, 1, 1572864, 0xeed76a7d
diff --git a/gst-libs/ext/libav/tests/ref/fate/lagarith-yv12 b/gst-libs/ext/libav/tests/ref/fate/lagarith-yv12
new file mode 100644
index 0000000..c9c9ff3
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/lagarith-yv12
@@ -0,0 +1,3 @@
+#tb 0: 1/60
+0, 0, 0, 1, 92160, 0x1dfdf5c1
+0, 1, 1, 1, 92160, 0x6965884f
diff --git a/gst-libs/ext/libav/tests/ref/fate/lmlm4-demux b/gst-libs/ext/libav/tests/ref/fate/lmlm4-demux
index f321423..0546135 100644
--- a/gst-libs/ext/libav/tests/ref/fate/lmlm4-demux
+++ b/gst-libs/ext/libav/tests/ref/fate/lmlm4-demux
@@ -1,215 +1,217 @@
-0, 0, 5951, 0xe9118e0d
-1, 0, 768, 0xaebcbebb
-1, 2160, 768, 0xaebcbebb
-0, 3003, 1672, 0x4b80d4ca
-1, 4320, 768, 0xaebcbebb
-0, 6006, 1604, 0x99e1b0a7
-1, 6480, 768, 0x866fe37a
-1, 8640, 768, 0x05d76890
-0, 9009, 1204, 0x9559038a
-1, 10800, 768, 0x858f5511
-0, 12012, 1482, 0x60056564
-1, 12960, 768, 0x97cb65ef
-0, 15015, 1105, 0xf508cef4
-1, 15120, 768, 0xe269742c
-1, 17280, 768, 0xa6015f8d
-0, 18018, 1193, 0xc8e0fd36
-1, 19440, 768, 0x759163e0
-0, 21021, 1247, 0x8dd202e5
-1, 21600, 768, 0xb1e16082
-1, 23760, 768, 0x1b616429
-0, 24024, 1367, 0xf59435e5
-1, 25920, 768, 0x7e4364f7
-0, 27027, 1406, 0x68ba4a7e
-1, 28080, 768, 0x59bd64f7
-0, 30030, 1262, 0x82c04123
-1, 30240, 768, 0xc3116fc6
-1, 32400, 768, 0x6a1c6b56
-0, 33033, 1381, 0x02335cf9
-1, 34560, 768, 0x285a64cf
-0, 36036, 1450, 0x7be46fd1
-1, 36720, 768, 0x79b16d65
-1, 38880, 768, 0x09b47635
-0, 39039, 1362, 0x75cc381a
-1, 41040, 768, 0x81597446
-0, 42042, 1409, 0x9ed74f3f
-1, 43200, 768, 0xfeb66eee
-0, 45045, 1253, 0x82400ae1
-1, 45360, 768, 0x78557618
-1, 47520, 768, 0x3af170bf
-0, 48048, 5499, 0xed286805
-1, 49680, 768, 0xefbd6399
-0, 51051, 1403, 0x483c4cbc
-1, 51840, 768, 0xc98e7492
-1, 54000, 768, 0x010d7149
-0, 54054, 1632, 0xa9ebcd6c
-1, 56160, 768, 0xce838b07
-0, 57057, 1207, 0xc8580724
-1, 58320, 768, 0xed18726c
-0, 60060, 1289, 0x61fb2fd2
-1, 60480, 768, 0x017e6712
-1, 62640, 768, 0x7f9268e9
-0, 63063, 1230, 0xf348f53c
-1, 64800, 768, 0xf6f258fc
-0, 66066, 1579, 0xa260b1ac
-1, 66960, 768, 0x9a1a6f31
-0, 69069, 949, 0x91849002
-1, 69120, 768, 0x14b47b23
-1, 71280, 768, 0x9bdc6a50
-0, 72072, 786, 0x3e33576f
-1, 73440, 768, 0x0fc46dab
-0, 75075, 894, 0x9ac36a61
-1, 75600, 768, 0x6c387372
-1, 77760, 768, 0x581e71cd
-0, 78078, 1186, 0x6bfc116e
-1, 79920, 768, 0x00cb785f
-0, 81081, 1187, 0xcfc512ae
-1, 82080, 768, 0x1dda7032
-0, 84084, 1527, 0x5c2c965a
-1, 84240, 768, 0xf57c7103
-1, 86400, 768, 0x2d927183
-0, 87087, 1536, 0x5ba7ac29
-1, 88560, 768, 0xdae86cdf
-0, 90090, 1095, 0xce06eb96
-1, 90720, 768, 0x2a2f6c3c
-1, 92880, 768, 0x44696eba
-0, 93093, 1402, 0x642f6b0d
-1, 95040, 768, 0xf67c71c4
-0, 96096, 5551, 0xf01a9c08
-1, 97200, 768, 0xc1ce7237
-0, 99099, 1211, 0x350206f7
-1, 99360, 768, 0xd9c36ef5
-1, 101520, 768, 0x63b06b03
-0, 102102, 887, 0x08767619
-1, 103680, 768, 0x8de97ebe
-0, 105105, 1042, 0xcc81a9ed
-1, 105840, 768, 0xbf117c32
-1, 108000, 768, 0x82897497
-0, 108108, 1247, 0x6f320614
-1, 110160, 768, 0x7a347abb
-0, 111111, 1459, 0xd28975b5
-1, 112320, 768, 0xc99b691e
-0, 114114, 1116, 0x1ab1e9db
-1, 114480, 768, 0xf4fc6e74
-1, 116640, 768, 0x511d6ec4
-0, 117117, 1110, 0x6411f66a
-1, 118800, 768, 0xb8c06b5f
-0, 120120, 1282, 0xd468375d
-1, 120960, 768, 0xf1776aed
-1, 123120, 768, 0xe6fe7fb4
-0, 123123, 1077, 0x1273c6e3
-1, 125280, 768, 0x36907aff
-0, 126126, 1043, 0x12dbd3ae
-1, 127440, 768, 0xddf666bb
-0, 129129, 1087, 0x3e70d37a
-1, 129600, 768, 0x8e896ebc
-1, 131760, 768, 0x0aa47dfa
-0, 132132, 992, 0x0651a71c
-1, 133920, 768, 0xc1736811
-0, 135135, 1012, 0x6a069f8c
-1, 136080, 768, 0xb3e87009
-0, 138138, 1320, 0x92803d69
-1, 138240, 768, 0xf23e6c00
-1, 140400, 768, 0x993a71d2
-0, 141141, 1080, 0xe0ffbe95
-1, 142560, 768, 0xa53466dd
-0, 144144, 5639, 0x658ca26b
-1, 144720, 768, 0xb43a74b0
-1, 146880, 768, 0x348f615c
-0, 147147, 1385, 0xbcb96241
-1, 149040, 768, 0x298f6e1b
-0, 150150, 1142, 0x8c6df318
-1, 151200, 768, 0x5db469c8
-0, 153153, 1175, 0xcac1faef
-1, 153360, 768, 0x08f16c2c
-1, 155520, 768, 0x4a0474cb
-0, 156156, 1091, 0xa937e32a
-1, 157680, 768, 0x077c760b
-0, 159159, 1174, 0xfa50040d
-1, 159840, 768, 0xa5777c2e
-1, 162000, 768, 0x0d157ea6
-0, 162162, 1293, 0x0c8d2740
-1, 164160, 768, 0x9bc26f86
-0, 165165, 1262, 0x502c0c35
-1, 166320, 768, 0x1a72742d
-0, 168168, 1038, 0x5e98c0cd
-1, 168480, 768, 0xa5bb6bbb
-1, 170640, 768, 0x48496c4c
-0, 171171, 1362, 0x256e43cf
-1, 172800, 768, 0x800d78f0
-0, 174174, 1200, 0x29e6f055
-1, 174960, 768, 0x40db840c
-1, 177120, 768, 0xadc96a6b
-0, 177177, 1495, 0x88e9b973
-1, 179280, 768, 0xff986b03
-0, 180180, 1386, 0x849297d2
-1, 181440, 768, 0x152473d6
-0, 183183, 1572, 0x63b7dc79
-1, 183600, 768, 0x01567323
-1, 185760, 768, 0xe5f26fe5
-0, 186186, 1190, 0x32ccf4cb
-1, 187920, 768, 0xa8fd72cd
-0, 189189, 1395, 0xa6ec4ae9
-1, 190080, 768, 0x8857655b
-0, 192192, 5692, 0x81aed6f3
-1, 192240, 768, 0x84017b13
-1, 194400, 768, 0xe6a968b3
-0, 195195, 1335, 0xe98a5497
-1, 196560, 768, 0xb03a7566
-0, 198198, 1361, 0x8ae15ab5
-1, 198720, 768, 0x8bea5f62
-1, 200880, 768, 0xac7570b0
-0, 201201, 1525, 0xed2bc1e8
-1, 203040, 768, 0x11306fac
-0, 204204, 1570, 0xba70d74b
-1, 205200, 768, 0xf2af5b28
-0, 207207, 1349, 0xd97a687d
-1, 207360, 768, 0x3069681f
-1, 209520, 768, 0x7ff07033
-0, 210210, 1270, 0xca8c3ca8
-1, 211680, 768, 0xd74973f2
-0, 213213, 1016, 0x32d0c81a
-1, 213840, 768, 0xb3627304
-1, 216000, 768, 0x11ff7589
-0, 216216, 983, 0x536faa97
-1, 218160, 768, 0x4a156c63
-0, 219219, 1111, 0x44ade015
-1, 220320, 768, 0xcb036127
-0, 222222, 1314, 0xce7c477d
-1, 222480, 768, 0x0b796bb9
-1, 224640, 768, 0x1d516c35
-0, 225225, 1005, 0x0196b491
-1, 226800, 768, 0xa9146da1
-0, 228228, 1162, 0xb8f6ebe6
-1, 228960, 768, 0x6d176392
-1, 231120, 768, 0x6f966269
-0, 231231, 1440, 0xfca67c72
-1, 233280, 768, 0x7ee17724
-0, 234234, 1437, 0x491181b1
-1, 235440, 768, 0x3f07614a
-0, 237237, 1261, 0xf0cd1898
-1, 237600, 768, 0x49d56945
-1, 239760, 768, 0x68eb660a
-0, 240240, 5638, 0x3a25a9f2
-1, 241920, 768, 0xe7c96677
-0, 243243, 1091, 0x67d9c693
-1, 244080, 768, 0x7dc07a35
-1, 246240, 768, 0x1e9c6397
-0, 246246, 875, 0x52147bb1
-1, 248400, 768, 0x93ef5de4
-0, 249249, 1188, 0x8522000f
-1, 250560, 768, 0x34af6803
-0, 252252, 1360, 0x89b82e7b
-1, 252720, 768, 0x77e068be
-1, 254880, 768, 0x65e274de
-0, 255255, 1378, 0xe8644914
-1, 257040, 768, 0xb7ad6a8a
-0, 258258, 1194, 0x89fef83d
-1, 259200, 768, 0x84b3635f
-0, 261261, 1422, 0x99daa18b
-1, 261360, 768, 0x066b78f2
-1, 263520, 768, 0xda137428
-0, 264264, 1049, 0x72a9cec1
-1, 265680, 768, 0xfd6c7597
-0, 267267, 1327, 0x7d15307c
-1, 267840, 768, 0x8d766d40
+#tb 0: 1001/30000
+#tb 1: 1/90000
+0, 0, -9223372036854775808, 1, 5951, 0xe9118e0d
+1, 0, 0, 2160, 768, 0xaebcbebb
+1, 2160, 2160, 2160, 768, 0xaebcbebb
+0, 1, -9223372036854775808, 1, 1672, 0x4b80d4ca
+1, 4320, 4320, 2160, 768, 0xaebcbebb
+0, 2, -9223372036854775808, 1, 1604, 0x99e1b0a7
+1, 6480, 6480, 2160, 768, 0x866fe37a
+1, 8640, 8640, 2160, 768, 0x05d76890
+0, 3, -9223372036854775808, 1, 1204, 0x9559038a
+1, 10800, 10800, 2160, 768, 0x858f5511
+0, 4, -9223372036854775808, 1, 1482, 0x60056564
+1, 12960, 12960, 2160, 768, 0x97cb65ef
+0, 5, -9223372036854775808, 1, 1105, 0xf508cef4
+1, 15120, 15120, 2160, 768, 0xe269742c
+1, 17280, 17280, 2160, 768, 0xa6015f8d
+0, 6, -9223372036854775808, 1, 1193, 0xc8e0fd36
+1, 19440, 19440, 2160, 768, 0x759163e0
+0, 7, -9223372036854775808, 1, 1247, 0x8dd202e5
+1, 21600, 21600, 2160, 768, 0xb1e16082
+1, 23760, 23760, 2160, 768, 0x1b616429
+0, 8, -9223372036854775808, 1, 1367, 0xf59435e5
+1, 25920, 25920, 2160, 768, 0x7e4364f7
+0, 9, -9223372036854775808, 1, 1406, 0x68ba4a7e
+1, 28080, 28080, 2160, 768, 0x59bd64f7
+0, 10, -9223372036854775808, 1, 1262, 0x82c04123
+1, 30240, 30240, 2160, 768, 0xc3116fc6
+1, 32400, 32400, 2160, 768, 0x6a1c6b56
+0, 11, -9223372036854775808, 1, 1381, 0x02335cf9
+1, 34560, 34560, 2160, 768, 0x285a64cf
+0, 12, -9223372036854775808, 1, 1450, 0x7be46fd1
+1, 36720, 36720, 2160, 768, 0x79b16d65
+1, 38880, 38880, 2160, 768, 0x09b47635
+0, 13, -9223372036854775808, 1, 1362, 0x75cc381a
+1, 41040, 41040, 2160, 768, 0x81597446
+0, 14, -9223372036854775808, 1, 1409, 0x9ed74f3f
+1, 43200, 43200, 2160, 768, 0xfeb66eee
+0, 15, -9223372036854775808, 1, 1253, 0x82400ae1
+1, 45360, 45360, 2160, 768, 0x78557618
+1, 47520, 47520, 2160, 768, 0x3af170bf
+0, 16, -9223372036854775808, 1, 5499, 0xed286805
+1, 49680, 49680, 2160, 768, 0xefbd6399
+0, 17, -9223372036854775808, 1, 1403, 0x483c4cbc
+1, 51840, 51840, 2160, 768, 0xc98e7492
+1, 54000, 54000, 2160, 768, 0x010d7149
+0, 18, -9223372036854775808, 1, 1632, 0xa9ebcd6c
+1, 56160, 56160, 2160, 768, 0xce838b07
+0, 19, -9223372036854775808, 1, 1207, 0xc8580724
+1, 58320, 58320, 2160, 768, 0xed18726c
+0, 20, -9223372036854775808, 1, 1289, 0x61fb2fd2
+1, 60480, 60480, 2160, 768, 0x017e6712
+1, 62640, 62640, 2160, 768, 0x7f9268e9
+0, 21, -9223372036854775808, 1, 1230, 0xf348f53c
+1, 64800, 64800, 2160, 768, 0xf6f258fc
+0, 22, -9223372036854775808, 1, 1579, 0xa260b1ac
+1, 66960, 66960, 2160, 768, 0x9a1a6f31
+0, 23, -9223372036854775808, 1, 949, 0x91849002
+1, 69120, 69120, 2160, 768, 0x14b47b23
+1, 71280, 71280, 2160, 768, 0x9bdc6a50
+0, 24, -9223372036854775808, 1, 786, 0x3e33576f
+1, 73440, 73440, 2160, 768, 0x0fc46dab
+0, 25, -9223372036854775808, 1, 894, 0x9ac36a61
+1, 75600, 75600, 2160, 768, 0x6c387372
+1, 77760, 77760, 2160, 768, 0x581e71cd
+0, 26, -9223372036854775808, 1, 1186, 0x6bfc116e
+1, 79920, 79920, 2160, 768, 0x00cb785f
+0, 27, -9223372036854775808, 1, 1187, 0xcfc512ae
+1, 82080, 82080, 2160, 768, 0x1dda7032
+0, 28, -9223372036854775808, 1, 1527, 0x5c2c965a
+1, 84240, 84240, 2160, 768, 0xf57c7103
+1, 86400, 86400, 2160, 768, 0x2d927183
+0, 29, -9223372036854775808, 1, 1536, 0x5ba7ac29
+1, 88560, 88560, 2160, 768, 0xdae86cdf
+0, 30, -9223372036854775808, 1, 1095, 0xce06eb96
+1, 90720, 90720, 2160, 768, 0x2a2f6c3c
+1, 92880, 92880, 2160, 768, 0x44696eba
+0, 31, -9223372036854775808, 1, 1402, 0x642f6b0d
+1, 95040, 95040, 2160, 768, 0xf67c71c4
+0, 32, -9223372036854775808, 1, 5551, 0xf01a9c08
+1, 97200, 97200, 2160, 768, 0xc1ce7237
+0, 33, -9223372036854775808, 1, 1211, 0x350206f7
+1, 99360, 99360, 2160, 768, 0xd9c36ef5
+1, 101520, 101520, 2160, 768, 0x63b06b03
+0, 34, -9223372036854775808, 1, 887, 0x08767619
+1, 103680, 103680, 2160, 768, 0x8de97ebe
+0, 35, -9223372036854775808, 1, 1042, 0xcc81a9ed
+1, 105840, 105840, 2160, 768, 0xbf117c32
+1, 108000, 108000, 2160, 768, 0x82897497
+0, 36, -9223372036854775808, 1, 1247, 0x6f320614
+1, 110160, 110160, 2160, 768, 0x7a347abb
+0, 37, -9223372036854775808, 1, 1459, 0xd28975b5
+1, 112320, 112320, 2160, 768, 0xc99b691e
+0, 38, -9223372036854775808, 1, 1116, 0x1ab1e9db
+1, 114480, 114480, 2160, 768, 0xf4fc6e74
+1, 116640, 116640, 2160, 768, 0x511d6ec4
+0, 39, -9223372036854775808, 1, 1110, 0x6411f66a
+1, 118800, 118800, 2160, 768, 0xb8c06b5f
+0, 40, -9223372036854775808, 1, 1282, 0xd468375d
+1, 120960, 120960, 2160, 768, 0xf1776aed
+1, 123120, 123120, 2160, 768, 0xe6fe7fb4
+0, 41, -9223372036854775808, 1, 1077, 0x1273c6e3
+1, 125280, 125280, 2160, 768, 0x36907aff
+0, 42, -9223372036854775808, 1, 1043, 0x12dbd3ae
+1, 127440, 127440, 2160, 768, 0xddf666bb
+0, 43, -9223372036854775808, 1, 1087, 0x3e70d37a
+1, 129600, 129600, 2160, 768, 0x8e896ebc
+1, 131760, 131760, 2160, 768, 0x0aa47dfa
+0, 44, -9223372036854775808, 1, 992, 0x0651a71c
+1, 133920, 133920, 2160, 768, 0xc1736811
+0, 45, -9223372036854775808, 1, 1012, 0x6a069f8c
+1, 136080, 136080, 2160, 768, 0xb3e87009
+0, 46, -9223372036854775808, 1, 1320, 0x92803d69
+1, 138240, 138240, 2160, 768, 0xf23e6c00
+1, 140400, 140400, 2160, 768, 0x993a71d2
+0, 47, -9223372036854775808, 1, 1080, 0xe0ffbe95
+1, 142560, 142560, 2160, 768, 0xa53466dd
+0, 48, -9223372036854775808, 1, 5639, 0x658ca26b
+1, 144720, 144720, 2160, 768, 0xb43a74b0
+1, 146880, 146880, 2160, 768, 0x348f615c
+0, 49, -9223372036854775808, 1, 1385, 0xbcb96241
+1, 149040, 149040, 2160, 768, 0x298f6e1b
+0, 50, -9223372036854775808, 1, 1142, 0x8c6df318
+1, 151200, 151200, 2160, 768, 0x5db469c8
+0, 51, -9223372036854775808, 1, 1175, 0xcac1faef
+1, 153360, 153360, 2160, 768, 0x08f16c2c
+1, 155520, 155520, 2160, 768, 0x4a0474cb
+0, 52, -9223372036854775808, 1, 1091, 0xa937e32a
+1, 157680, 157680, 2160, 768, 0x077c760b
+0, 53, -9223372036854775808, 1, 1174, 0xfa50040d
+1, 159840, 159840, 2160, 768, 0xa5777c2e
+1, 162000, 162000, 2160, 768, 0x0d157ea6
+0, 54, -9223372036854775808, 1, 1293, 0x0c8d2740
+1, 164160, 164160, 2160, 768, 0x9bc26f86
+0, 55, -9223372036854775808, 1, 1262, 0x502c0c35
+1, 166320, 166320, 2160, 768, 0x1a72742d
+0, 56, -9223372036854775808, 1, 1038, 0x5e98c0cd
+1, 168480, 168480, 2160, 768, 0xa5bb6bbb
+1, 170640, 170640, 2160, 768, 0x48496c4c
+0, 57, -9223372036854775808, 1, 1362, 0x256e43cf
+1, 172800, 172800, 2160, 768, 0x800d78f0
+0, 58, -9223372036854775808, 1, 1200, 0x29e6f055
+1, 174960, 174960, 2160, 768, 0x40db840c
+1, 177120, 177120, 2160, 768, 0xadc96a6b
+0, 59, -9223372036854775808, 1, 1495, 0x88e9b973
+1, 179280, 179280, 2160, 768, 0xff986b03
+0, 60, -9223372036854775808, 1, 1386, 0x849297d2
+1, 181440, 181440, 2160, 768, 0x152473d6
+0, 61, -9223372036854775808, 1, 1572, 0x63b7dc79
+1, 183600, 183600, 2160, 768, 0x01567323
+1, 185760, 185760, 2160, 768, 0xe5f26fe5
+0, 62, -9223372036854775808, 1, 1190, 0x32ccf4cb
+1, 187920, 187920, 2160, 768, 0xa8fd72cd
+0, 63, -9223372036854775808, 1, 1395, 0xa6ec4ae9
+1, 190080, 190080, 2160, 768, 0x8857655b
+0, 64, -9223372036854775808, 1, 5692, 0x81aed6f3
+1, 192240, 192240, 2160, 768, 0x84017b13
+1, 194400, 194400, 2160, 768, 0xe6a968b3
+0, 65, -9223372036854775808, 1, 1335, 0xe98a5497
+1, 196560, 196560, 2160, 768, 0xb03a7566
+0, 66, -9223372036854775808, 1, 1361, 0x8ae15ab5
+1, 198720, 198720, 2160, 768, 0x8bea5f62
+1, 200880, 200880, 2160, 768, 0xac7570b0
+0, 67, -9223372036854775808, 1, 1525, 0xed2bc1e8
+1, 203040, 203040, 2160, 768, 0x11306fac
+0, 68, -9223372036854775808, 1, 1570, 0xba70d74b
+1, 205200, 205200, 2160, 768, 0xf2af5b28
+0, 69, -9223372036854775808, 1, 1349, 0xd97a687d
+1, 207360, 207360, 2160, 768, 0x3069681f
+1, 209520, 209520, 2160, 768, 0x7ff07033
+0, 70, -9223372036854775808, 1, 1270, 0xca8c3ca8
+1, 211680, 211680, 2160, 768, 0xd74973f2
+0, 71, -9223372036854775808, 1, 1016, 0x32d0c81a
+1, 213840, 213840, 2160, 768, 0xb3627304
+1, 216000, 216000, 2160, 768, 0x11ff7589
+0, 72, -9223372036854775808, 1, 983, 0x536faa97
+1, 218160, 218160, 2160, 768, 0x4a156c63
+0, 73, -9223372036854775808, 1, 1111, 0x44ade015
+1, 220320, 220320, 2160, 768, 0xcb036127
+0, 74, -9223372036854775808, 1, 1314, 0xce7c477d
+1, 222480, 222480, 2160, 768, 0x0b796bb9
+1, 224640, 224640, 2160, 768, 0x1d516c35
+0, 75, -9223372036854775808, 1, 1005, 0x0196b491
+1, 226800, 226800, 2160, 768, 0xa9146da1
+0, 76, -9223372036854775808, 1, 1162, 0xb8f6ebe6
+1, 228960, 228960, 2160, 768, 0x6d176392
+1, 231120, 231120, 2160, 768, 0x6f966269
+0, 77, -9223372036854775808, 1, 1440, 0xfca67c72
+1, 233280, 233280, 2160, 768, 0x7ee17724
+0, 78, -9223372036854775808, 1, 1437, 0x491181b1
+1, 235440, 235440, 2160, 768, 0x3f07614a
+0, 79, -9223372036854775808, 1, 1261, 0xf0cd1898
+1, 237600, 237600, 2160, 768, 0x49d56945
+1, 239760, 239760, 2160, 768, 0x68eb660a
+0, 80, -9223372036854775808, 1, 5638, 0x3a25a9f2
+1, 241920, 241920, 2160, 768, 0xe7c96677
+0, 81, -9223372036854775808, 1, 1091, 0x67d9c693
+1, 244080, 244080, 2160, 768, 0x7dc07a35
+1, 246240, 246240, 2160, 768, 0x1e9c6397
+0, 82, -9223372036854775808, 1, 875, 0x52147bb1
+1, 248400, 248400, 2160, 768, 0x93ef5de4
+0, 83, -9223372036854775808, 1, 1188, 0x8522000f
+1, 250560, 250560, 2160, 768, 0x34af6803
+0, 84, -9223372036854775808, 1, 1360, 0x89b82e7b
+1, 252720, 252720, 2160, 768, 0x77e068be
+1, 254880, 254880, 2160, 768, 0x65e274de
+0, 85, -9223372036854775808, 1, 1378, 0xe8644914
+1, 257040, 257040, 2160, 768, 0xb7ad6a8a
+0, 86, -9223372036854775808, 1, 1194, 0x89fef83d
+1, 259200, 259200, 2160, 768, 0x84b3635f
+0, 87, -9223372036854775808, 1, 1422, 0x99daa18b
+1, 261360, 261360, 2160, 768, 0x066b78f2
+1, 263520, 263520, 2160, 768, 0xda137428
+0, 88, -9223372036854775808, 1, 1049, 0x72a9cec1
+1, 265680, 265680, 2160, 768, 0xfd6c7597
+0, 89, -9223372036854775808, 1, 1327, 0x7d15307c
+1, 267840, 267840, 2160, 768, 0x8d766d40
diff --git a/gst-libs/ext/libav/tests/ref/fate/loco-rgb b/gst-libs/ext/libav/tests/ref/fate/loco-rgb
index 4d2790b..ad199f1 100644
--- a/gst-libs/ext/libav/tests/ref/fate/loco-rgb
+++ b/gst-libs/ext/libav/tests/ref/fate/loco-rgb
@@ -1,5 +1,6 @@
-0, 0, 72192, 0x1847500c
-0, 12780, 72192, 0x1b0e2e87
-0, 25560, 72192, 0x293276c8
-0, 38340, 72192, 0x743b9705
-0, 51120, 72192, 0xcc1b2530
+#tb 0: 71/500
+0, 0, 0, 1, 72192, 0x1847500c
+0, 1, 1, 1, 72192, 0x1b0e2e87
+0, 2, 2, 1, 72192, 0x293276c8
+0, 3, 3, 1, 72192, 0x743b9705
+0, 4, 4, 1, 72192, 0xcc1b2530
diff --git a/gst-libs/ext/libav/tests/ref/fate/loco-yuy2 b/gst-libs/ext/libav/tests/ref/fate/loco-yuy2
index d3d68df..60a06bc 100644
--- a/gst-libs/ext/libav/tests/ref/fate/loco-yuy2
+++ b/gst-libs/ext/libav/tests/ref/fate/loco-yuy2
@@ -1,3 +1,4 @@
-0, 0, 48128, 0x7795782d
-0, 12780, 48128, 0x3d89bcf7
-0, 25560, 48128, 0x170d200a
+#tb 0: 71/500
+0, 0, 0, 1, 48128, 0x7795782d
+0, 1, 1, 1, 48128, 0x3d89bcf7
+0, 2, 2, 1, 48128, 0x170d200a
diff --git a/gst-libs/ext/libav/tests/ref/fate/lossless-wavpack b/gst-libs/ext/libav/tests/ref/fate/lossless-wavpack
deleted file mode 100644
index 6281924..0000000
--- a/gst-libs/ext/libav/tests/ref/fate/lossless-wavpack
+++ /dev/null
@@ -1 +0,0 @@
-97223f65c91213694a660d52f87f35aa
diff --git a/gst-libs/ext/libav/tests/ref/fate/lossless-wma b/gst-libs/ext/libav/tests/ref/fate/lossless-wma
new file mode 100644
index 0000000..5bea19b
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/lossless-wma
@@ -0,0 +1 @@
+35dc840f91cbcece02178d03c8f2fe26
diff --git a/gst-libs/ext/libav/tests/ref/fate/maxis-xa b/gst-libs/ext/libav/tests/ref/fate/maxis-xa
index 0dd23db..c29738c 100644
--- a/gst-libs/ext/libav/tests/ref/fate/maxis-xa
+++ b/gst-libs/ext/libav/tests/ref/fate/maxis-xa
@@ -1 +1,31 @@
-b4cd52fc080bffefeea94ce7c116046f
+#tb 0: 1/22050
+0, 0, 0, 28, 30, 0x51750711
+0, 28, 28, 28, 30, 0x9ca20c2a
+0, 56, 56, 28, 30, 0x7551081f
+0, 84, 84, 28, 30, 0x09540063
+0, 112, 112, 28, 30, 0x02c40018
+0, 140, 140, 28, 30, 0x0f6c0117
+0, 168, 168, 28, 30, 0x2aab0315
+0, 196, 196, 28, 30, 0x0e6d0117
+0, 224, 224, 28, 30, 0x04770036
+0, 252, 252, 28, 30, 0x939c090f
+0, 280, 280, 28, 30, 0xde511116
+0, 308, 308, 28, 30, 0x2f0f13f5
+0, 336, 336, 28, 30, 0x65bb0630
+0, 364, 364, 28, 30, 0x1f7a0333
+0, 392, 392, 28, 30, 0xa3d71008
+0, 420, 420, 28, 30, 0x69120801
+0, 448, 448, 28, 30, 0x1e7b0207
+0, 476, 476, 28, 30, 0x02c40018
+0, 504, 504, 28, 30, 0x0d050126
+0, 532, 532, 28, 30, 0x41c10333
+0, 560, 560, 28, 30, 0x16a10207
+0, 588, 588, 28, 30, 0x0f210207
+0, 616, 616, 28, 30, 0x4e4b073e
+0, 644, 644, 28, 30, 0xa6f20d1a
+0, 672, 672, 28, 30, 0xe1e40ff9
+0, 700, 700, 28, 30, 0x868b090f
+0, 728, 728, 28, 30, 0x8c85091e
+0, 756, 756, 28, 30, 0x5a21094b
+0, 784, 784, 28, 30, 0x993c0900
+0, 812, 812, 28, 30, 0x5b6b04e6
diff --git a/gst-libs/ext/libav/tests/ref/fate/mdec b/gst-libs/ext/libav/tests/ref/fate/mdec
new file mode 100644
index 0000000..b7aab62
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/mdec
@@ -0,0 +1,135 @@
+#tb 0: 1/15
+0, 0, 0, 1, 102144, 0x6edc83de
+0, 1, 1, 1, 102144, 0xd0534fda
+0, 2, 2, 1, 102144, 0x6447911f
+0, 3, 3, 1, 102144, 0xf21f3b46
+0, 4, 4, 1, 102144, 0x0975077a
+0, 5, 5, 1, 102144, 0xb9a12d8e
+0, 6, 6, 1, 102144, 0x17413513
+0, 7, 7, 1, 102144, 0x1e622a04
+0, 8, 8, 1, 102144, 0x7489224e
+0, 9, 9, 1, 102144, 0xae14956e
+0, 10, 10, 1, 102144, 0x104fd3a0
+0, 11, 11, 1, 102144, 0xea63a940
+0, 12, 12, 1, 102144, 0x0cf81588
+0, 13, 13, 1, 102144, 0xe4a5b2fd
+0, 14, 14, 1, 102144, 0x0c9aaf77
+0, 15, 15, 1, 102144, 0x065007d7
+0, 16, 16, 1, 102144, 0x54c0c29b
+0, 17, 17, 1, 102144, 0x1114cb8e
+0, 18, 18, 1, 102144, 0xe4270462
+0, 19, 19, 1, 102144, 0x61e5b7fd
+0, 20, 20, 1, 102144, 0x7cbeaca6
+0, 21, 21, 1, 102144, 0xed92daa4
+0, 22, 22, 1, 102144, 0xd8654d0d
+0, 23, 23, 1, 102144, 0x854e842b
+0, 24, 24, 1, 102144, 0x56407c3a
+0, 25, 25, 1, 102144, 0x17db3f90
+0, 26, 26, 1, 102144, 0x8b133b9a
+0, 27, 27, 1, 102144, 0xe4899db9
+0, 28, 28, 1, 102144, 0x579cf092
+0, 29, 29, 1, 102144, 0x19fa5062
+0, 30, 30, 1, 102144, 0x71339792
+0, 31, 31, 1, 102144, 0x970e5c0c
+0, 32, 32, 1, 102144, 0x84ee616a
+0, 33, 33, 1, 102144, 0x1d6f9a23
+0, 34, 34, 1, 102144, 0xc28e19db
+0, 35, 35, 1, 102144, 0x0e898967
+0, 36, 36, 1, 102144, 0x52a8b671
+0, 37, 37, 1, 102144, 0x3f45ea83
+0, 38, 38, 1, 102144, 0x7b0fc603
+0, 39, 39, 1, 102144, 0x14f94469
+0, 40, 40, 1, 102144, 0x5b9f37cc
+0, 41, 41, 1, 102144, 0xf902b7c7
+0, 42, 42, 1, 102144, 0x326836e0
+0, 43, 43, 1, 102144, 0x2e4aebba
+0, 44, 44, 1, 102144, 0xd10ae58c
+0, 45, 45, 1, 102144, 0xbd084ecf
+0, 46, 46, 1, 102144, 0xb2157c0a
+0, 47, 47, 1, 102144, 0xd7f158d4
+0, 48, 48, 1, 102144, 0x3cf86462
+0, 49, 49, 1, 102144, 0x53ecddab
+0, 50, 50, 1, 102144, 0xcdaba8ef
+0, 51, 51, 1, 102144, 0xab9ede18
+0, 52, 52, 1, 102144, 0xb6706e79
+0, 53, 53, 1, 102144, 0x76371069
+0, 54, 54, 1, 102144, 0x3a365016
+0, 55, 55, 1, 102144, 0x52177c09
+0, 56, 56, 1, 102144, 0xc33eb4fb
+0, 57, 57, 1, 102144, 0x16098436
+0, 58, 58, 1, 102144, 0x715d6a2b
+0, 59, 59, 1, 102144, 0xd3abc960
+0, 60, 60, 1, 102144, 0x7f34b0d4
+0, 61, 61, 1, 102144, 0xe3219b9c
+0, 62, 62, 1, 102144, 0x5fa54f54
+0, 63, 63, 1, 102144, 0x0fb746cb
+0, 64, 64, 1, 102144, 0xa6bd2da2
+0, 65, 65, 1, 102144, 0x04579119
+0, 66, 66, 1, 102144, 0xda818691
+0, 67, 67, 1, 102144, 0xe9d44445
+0, 68, 68, 1, 102144, 0x94868dc9
+0, 69, 69, 1, 102144, 0x3ca52ce6
+0, 70, 70, 1, 102144, 0xd7eb4c4f
+0, 71, 71, 1, 102144, 0xfcdfafca
+0, 72, 72, 1, 102144, 0x473a4a5a
+0, 73, 73, 1, 102144, 0xe5a5f3cb
+0, 74, 74, 1, 102144, 0x34070219
+0, 75, 75, 1, 102144, 0x0faa965a
+0, 76, 76, 1, 102144, 0xe2c6acda
+0, 77, 77, 1, 102144, 0xe22776d5
+0, 78, 78, 1, 102144, 0x80d85602
+0, 79, 79, 1, 102144, 0x2f3fa190
+0, 80, 80, 1, 102144, 0x70b461b1
+0, 81, 81, 1, 102144, 0x366c8b27
+0, 82, 82, 1, 102144, 0x65cc0866
+0, 83, 83, 1, 102144, 0x903beb14
+0, 84, 84, 1, 102144, 0xb6c5f5c7
+0, 85, 85, 1, 102144, 0xaa813725
+0, 86, 86, 1, 102144, 0x014a84a0
+0, 87, 87, 1, 102144, 0xd286ece1
+0, 88, 88, 1, 102144, 0x48b1c27d
+0, 89, 89, 1, 102144, 0xa611ef42
+0, 90, 90, 1, 102144, 0x98627584
+0, 91, 91, 1, 102144, 0x43de7c75
+0, 92, 92, 1, 102144, 0xa9e22c68
+0, 93, 93, 1, 102144, 0x84ac34d4
+0, 94, 94, 1, 102144, 0x6abd00ba
+0, 95, 95, 1, 102144, 0x5d11066e
+0, 96, 96, 1, 102144, 0xb6b083aa
+0, 97, 97, 1, 102144, 0x5d152a11
+0, 98, 98, 1, 102144, 0x0c0aec67
+0, 99, 99, 1, 102144, 0xa248bd10
+0, 100, 100, 1, 102144, 0x4e6c12cc
+0, 101, 101, 1, 102144, 0xca1d6753
+0, 102, 102, 1, 102144, 0x116310c3
+0, 103, 103, 1, 102144, 0x16903cd0
+0, 104, 104, 1, 102144, 0x239adfed
+0, 105, 105, 1, 102144, 0x0970ce49
+0, 106, 106, 1, 102144, 0xb628adc1
+0, 107, 107, 1, 102144, 0x473613f7
+0, 108, 108, 1, 102144, 0x3eef3987
+0, 109, 109, 1, 102144, 0x935b99ca
+0, 110, 110, 1, 102144, 0xb9f4d6ee
+0, 111, 111, 1, 102144, 0xac811656
+0, 112, 112, 1, 102144, 0xd1f84af0
+0, 113, 113, 1, 102144, 0xf2fd25f4
+0, 114, 114, 1, 102144, 0x935bbed9
+0, 115, 115, 1, 102144, 0x8c8c3e53
+0, 116, 116, 1, 102144, 0x24afc20f
+0, 117, 117, 1, 102144, 0xad20a451
+0, 118, 118, 1, 102144, 0xd1a0df13
+0, 119, 119, 1, 102144, 0xb0ee53f8
+0, 120, 120, 1, 102144, 0x08cdb591
+0, 121, 121, 1, 102144, 0x89b985b0
+0, 122, 122, 1, 102144, 0xdd27d51f
+0, 123, 123, 1, 102144, 0xa783fce0
+0, 124, 124, 1, 102144, 0xfe5602e8
+0, 125, 125, 1, 102144, 0xfb989934
+0, 126, 126, 1, 102144, 0xf857eb2b
+0, 127, 127, 1, 102144, 0x987a7098
+0, 128, 128, 1, 102144, 0xbc749f42
+0, 129, 129, 1, 102144, 0x221e48a6
+0, 130, 130, 1, 102144, 0x4c4b5da2
+0, 131, 131, 1, 102144, 0x32140027
+0, 132, 132, 1, 102144, 0xbeb4bf18
+0, 133, 133, 1, 102144, 0x523012e5
diff --git a/gst-libs/ext/libav/tests/ref/fate/mdec-v3 b/gst-libs/ext/libav/tests/ref/fate/mdec-v3
new file mode 100644
index 0000000..7e4bbdb
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/mdec-v3
@@ -0,0 +1,60 @@
+#tb 0: 1/15
+0, 0, 0, 1, 76800, 0x2677be82
+0, 1, 1, 1, 76800, 0x1f323c75
+0, 2, 2, 1, 76800, 0xc8be3be9
+0, 3, 3, 1, 76800, 0x1f323c75
+0, 4, 4, 1, 76800, 0x7e484488
+0, 5, 5, 1, 76800, 0x8bd644aa
+0, 6, 6, 1, 76800, 0xaa62e7b8
+0, 7, 7, 1, 76800, 0xaa62e7b8
+0, 8, 8, 1, 76800, 0x53fadb39
+0, 9, 9, 1, 76800, 0x53fadb39
+0, 10, 10, 1, 76800, 0x1ff9d964
+0, 11, 11, 1, 76800, 0x1ff9d964
+0, 12, 12, 1, 76800, 0xd8c8d947
+0, 13, 13, 1, 76800, 0xd8c8d947
+0, 14, 14, 1, 76800, 0x6d0bd94c
+0, 15, 15, 1, 76800, 0x6d0bd94c
+0, 16, 16, 1, 76800, 0x7e66d948
+0, 17, 17, 1, 76800, 0x7e66d948
+0, 18, 18, 1, 76800, 0x8eecfd72
+0, 19, 19, 1, 76800, 0xb15f29ab
+0, 20, 20, 1, 76800, 0x08e5502e
+0, 21, 21, 1, 76800, 0xaa58796d
+0, 22, 22, 1, 76800, 0xe254a27c
+0, 23, 23, 1, 76800, 0xeec8cf68
+0, 24, 24, 1, 76800, 0x812bf8ee
+0, 25, 25, 1, 76800, 0x929922ef
+0, 26, 26, 1, 76800, 0xe1174e06
+0, 27, 27, 1, 76800, 0x2da77bf1
+0, 28, 28, 1, 76800, 0xd0f6a727
+0, 29, 29, 1, 76800, 0x31bfd168
+0, 30, 30, 1, 76800, 0xb87af225
+0, 31, 31, 1, 76800, 0xd0080859
+0, 32, 32, 1, 76800, 0x99ab15ba
+0, 33, 33, 1, 76800, 0x99ab15ba
+0, 34, 34, 1, 76800, 0x99ab15ba
+0, 35, 35, 1, 76800, 0x99ab15ba
+0, 36, 36, 1, 76800, 0x99ab15ba
+0, 37, 37, 1, 76800, 0x99ab15ba
+0, 38, 38, 1, 76800, 0x99ab15ba
+0, 39, 39, 1, 76800, 0x99ab15ba
+0, 40, 40, 1, 76800, 0x99ab15ba
+0, 41, 41, 1, 76800, 0x99ab15ba
+0, 42, 42, 1, 76800, 0x99ab15ba
+0, 43, 43, 1, 76800, 0x99ab15ba
+0, 44, 44, 1, 76800, 0x99ab15ba
+0, 45, 45, 1, 76800, 0x99ab15ba
+0, 46, 46, 1, 76800, 0x99ab15ba
+0, 47, 47, 1, 76800, 0x99ab15ba
+0, 48, 48, 1, 76800, 0x0c1617d5
+0, 49, 49, 1, 76800, 0xb1c81b5d
+0, 50, 50, 1, 76800, 0xb4e41e44
+0, 51, 51, 1, 76800, 0x765725e2
+0, 52, 52, 1, 76800, 0x25cd3109
+0, 53, 53, 1, 76800, 0xa42b5291
+0, 54, 54, 1, 76800, 0x15bb6ee4
+0, 55, 55, 1, 76800, 0xb33c9f50
+0, 56, 56, 1, 76800, 0x1ca1b874
+0, 57, 57, 1, 76800, 0x7506e92a
+0, 58, 58, 1, 76800, 0x97c9030a
diff --git a/gst-libs/ext/libav/tests/ref/fate/mimic b/gst-libs/ext/libav/tests/ref/fate/mimic
index 8195cdc..217d487 100644
--- a/gst-libs/ext/libav/tests/ref/fate/mimic
+++ b/gst-libs/ext/libav/tests/ref/fate/mimic
@@ -1,76 +1,77 @@
-0, 0, 115200, 0xa974d407
-0, 90, 115200, 0x72618b84
-0, 180, 115200, 0x87768573
-0, 270, 115200, 0x5d218e3e
-0, 360, 115200, 0x0c0db41c
-0, 450, 115200, 0xb777fd48
-0, 540, 115200, 0x40765de7
-0, 630, 115200, 0x370a3c90
-0, 720, 115200, 0xc605785a
-0, 810, 115200, 0x49468b23
-0, 900, 115200, 0x986b6fd4
-0, 990, 115200, 0x30f22ef8
-0, 1080, 115200, 0xa90bd608
-0, 1170, 115200, 0x9cf36518
-0, 1260, 115200, 0x4ef1a679
-0, 1350, 115200, 0x0df65873
-0, 1440, 115200, 0xfecd4233
-0, 1530, 115200, 0xee2f26cb
-0, 1620, 115200, 0x795f612d
-0, 1710, 115200, 0xbbb90125
-0, 1800, 115200, 0x9230fb6e
-0, 1890, 115200, 0x11869996
-0, 1980, 115200, 0x6b5c892b
-0, 2070, 115200, 0x88bdb9cd
-0, 2160, 115200, 0x364bc5a0
-0, 2250, 115200, 0x6b66d817
-0, 2340, 115200, 0xd3a41252
-0, 2430, 115200, 0x0cf5612f
-0, 2520, 115200, 0x9752d055
-0, 2610, 115200, 0x486e9f6f
-0, 2700, 115200, 0x3eab62f8
-0, 2790, 115200, 0xa7f52762
-0, 2880, 115200, 0xfd4c4bbc
-0, 2970, 115200, 0x194023f6
-0, 3060, 115200, 0xd4668dad
-0, 3150, 115200, 0x6b20d64b
-0, 3240, 115200, 0xf2572aae
-0, 3330, 115200, 0xc3554f25
-0, 3420, 115200, 0xeeb5073a
-0, 3510, 115200, 0xbd46291f
-0, 3600, 115200, 0x0526838d
-0, 3690, 115200, 0x85b2e864
-0, 3780, 115200, 0xcfd894bc
-0, 3870, 115200, 0x644f10fb
-0, 3960, 115200, 0x556e4d88
-0, 4050, 115200, 0x93243614
-0, 4140, 115200, 0x754275c5
-0, 4230, 115200, 0x7f648bf3
-0, 4320, 115200, 0xece18c9b
-0, 4410, 115200, 0x385d52c1
-0, 4500, 115200, 0xafc58e4a
-0, 4590, 115200, 0x50daf750
-0, 4680, 115200, 0xf6bc67d1
-0, 4770, 115200, 0xb64b6e07
-0, 4860, 115200, 0x8751ed15
-0, 4950, 115200, 0x329ce803
-0, 5040, 115200, 0x40b2cb05
-0, 5130, 115200, 0x60f3517d
-0, 5220, 115200, 0xe0d46fdf
-0, 5310, 115200, 0x204529fa
-0, 5400, 115200, 0xd5afaf22
-0, 5490, 115200, 0xd3cb3d4c
-0, 5580, 115200, 0x87973a79
-0, 5670, 115200, 0xe3b2f917
-0, 5760, 115200, 0xf1923238
-0, 5850, 115200, 0x51494d71
-0, 5940, 115200, 0x58bc59bb
-0, 6030, 115200, 0xd0273fdb
-0, 6120, 115200, 0x6cc79700
-0, 6210, 115200, 0xc8172d31
-0, 6300, 115200, 0x8eb037ef
-0, 6390, 115200, 0xc0bc2d76
-0, 6480, 115200, 0x663c467a
-0, 6570, 115200, 0xd085e950
-0, 6660, 115200, 0x7d198d72
-0, 6750, 115200, 0x6ebacda0
+#tb 0: 1/1000
+0, 0, 0, 0, 115200, 0xa974d407
+0, 548, 548, 0, 115200, 0x72618b84
+0, 1088, 1088, 0, 115200, 0x87768573
+0, 1759, 1759, 0, 115200, 0x5d218e3e
+0, 2437, 2437, 0, 115200, 0x0c0db41c
+0, 3076, 3076, 0, 115200, 0xb777fd48
+0, 3908, 3908, 0, 115200, 0x40765de7
+0, 4545, 4545, 0, 115200, 0x370a3c90
+0, 5092, 5092, 0, 115200, 0xc605785a
+0, 6016, 6016, 0, 115200, 0x49468b23
+0, 6560, 6560, 0, 115200, 0x986b6fd4
+0, 7648, 7648, 0, 115200, 0x30f22ef8
+0, 8164, 8164, 0, 115200, 0xa90bd608
+0, 8836, 8836, 0, 115200, 0x9cf36518
+0, 9632, 9632, 0, 115200, 0x4ef1a679
+0, 9922, 9922, 0, 115200, 0x0df65873
+0, 10316, 10316, 0, 115200, 0xfecd4233
+0, 11104, 11104, 0, 115200, 0xee2f26cb
+0, 11776, 11776, 0, 115200, 0x795f612d
+0, 12321, 12321, 0, 115200, 0xbbb90125
+0, 12992, 12992, 0, 115200, 0x9230fb6e
+0, 13805, 13805, 0, 115200, 0x11869996
+0, 14468, 14468, 0, 115200, 0x6b5c892b
+0, 15136, 15136, 0, 115200, 0x88bdb9cd
+0, 15937, 15937, 0, 115200, 0x364bc5a0
+0, 16608, 16608, 0, 115200, 0x6b66d817
+0, 17281, 17281, 0, 115200, 0xd3a41252
+0, 18089, 18089, 0, 115200, 0x0cf5612f
+0, 18754, 18754, 0, 115200, 0x9752d055
+0, 19808, 19808, 0, 115200, 0x486e9f6f
+0, 20484, 20484, 0, 115200, 0x3eab62f8
+0, 21031, 21031, 0, 115200, 0xa7f52762
+0, 21957, 21957, 0, 115200, 0xfd4c4bbc
+0, 22498, 22498, 0, 115200, 0x194023f6
+0, 22880, 22880, 0, 115200, 0xd4668dad
+0, 23680, 23680, 0, 115200, 0x6b20d64b
+0, 24353, 24353, 0, 115200, 0xf2572aae
+0, 24901, 24901, 0, 115200, 0xc3554f25
+0, 25695, 25695, 0, 115200, 0xeeb5073a
+0, 26495, 26495, 0, 115200, 0xbd46291f
+0, 27040, 27040, 0, 115200, 0x0526838d
+0, 28107, 28107, 0, 115200, 0x85b2e864
+0, 28778, 28778, 0, 115200, 0xcfd894bc
+0, 29316, 29316, 0, 115200, 0x644f10fb
+0, 30240, 30240, 0, 115200, 0x556e4d88
+0, 30786, 30786, 0, 115200, 0x93243614
+0, 31983, 31983, 0, 115200, 0x754275c5
+0, 32929, 32929, 0, 115200, 0x7f648bf3
+0, 33600, 33600, 0, 115200, 0xece18c9b
+0, 34271, 34271, 0, 115200, 0x385d52c1
+0, 35201, 35201, 0, 115200, 0xafc58e4a
+0, 35743, 35743, 0, 115200, 0x50daf750
+0, 36384, 36384, 0, 115200, 0xf6bc67d1
+0, 37344, 37344, 0, 115200, 0xb64b6e07
+0, 38028, 38028, 0, 115200, 0x8751ed15
+0, 38657, 38657, 0, 115200, 0x329ce803
+0, 39334, 39334, 0, 115200, 0x40b2cb05
+0, 40129, 40129, 0, 115200, 0x60f3517d
+0, 40802, 40802, 0, 115200, 0xe0d46fdf
+0, 41472, 41472, 0, 115200, 0x204529fa
+0, 42276, 42276, 0, 115200, 0xd5afaf22
+0, 42944, 42944, 0, 115200, 0xd3cb3d4c
+0, 43616, 43616, 0, 115200, 0x87973a79
+0, 44421, 44421, 0, 115200, 0xe3b2f917
+0, 45092, 45092, 0, 115200, 0xf1923238
+0, 45632, 45632, 0, 115200, 0x51494d71
+0, 46561, 46561, 0, 115200, 0x58bc59bb
+0, 47105, 47105, 0, 115200, 0xd0273fdb
+0, 47776, 47776, 0, 115200, 0x6cc79700
+0, 48294, 48294, 0, 115200, 0xc8172d31
+0, 48960, 48960, 0, 115200, 0x8eb037ef
+0, 49504, 49504, 0, 115200, 0xc0bc2d76
+0, 50053, 50053, 0, 115200, 0x663c467a
+0, 50597, 50597, 0, 115200, 0xd085e950
+0, 51520, 51520, 0, 115200, 0x7d198d72
+0, 52092, 52092, 0, 115200, 0x6ebacda0
diff --git a/gst-libs/ext/libav/tests/ref/fate/mjpegb b/gst-libs/ext/libav/tests/ref/fate/mjpegb
index f2d0ec8..e4887f4 100644
--- a/gst-libs/ext/libav/tests/ref/fate/mjpegb
+++ b/gst-libs/ext/libav/tests/ref/fate/mjpegb
@@ -1,10 +1,11 @@
-0, 0, 38400, 0x45311080
-0, 7500, 38400, 0x9474f731
-0, 15000, 38400, 0x429ebb12
-0, 22500, 38400, 0x472c199a
-0, 30000, 38400, 0xefd49dae
-0, 37500, 38400, 0x78627fa9
-0, 45000, 38400, 0x2a8d9148
-0, 52500, 38400, 0x21cc6738
-0, 60000, 38400, 0x0bc4703f
-0, 67500, 38400, 0x1ddcc035
+#tb 0: 1/1200
+0, 0, 0, 0, 38400, 0x45311080
+0, 100, 100, 0, 38400, 0x9474f731
+0, 200, 200, 0, 38400, 0x429ebb12
+0, 300, 300, 0, 38400, 0x472c199a
+0, 400, 400, 0, 38400, 0xefd49dae
+0, 500, 500, 0, 38400, 0x78627fa9
+0, 600, 600, 0, 38400, 0x2a8d9148
+0, 700, 700, 0, 38400, 0x21cc6738
+0, 800, 800, 0, 38400, 0x0bc4703f
+0, 900, 900, 0, 38400, 0x1ddcc035
diff --git a/gst-libs/ext/libav/tests/ref/fate/motionpixels b/gst-libs/ext/libav/tests/ref/fate/motionpixels
index fa86f73..97d8edf 100644
--- a/gst-libs/ext/libav/tests/ref/fate/motionpixels
+++ b/gst-libs/ext/libav/tests/ref/fate/motionpixels
@@ -1,111 +1,112 @@
-0, 0, 230400, 0xee05b509
-0, 6000, 230400, 0x71048964
-0, 12000, 230400, 0x2ebe4ba1
-0, 18000, 230400, 0xeedc45a6
-0, 24000, 230400, 0x218e8656
-0, 30000, 230400, 0x5792b17e
-0, 36000, 230400, 0x51b0a062
-0, 42000, 230400, 0x5dc4fd9c
-0, 48000, 230400, 0x9b0261b1
-0, 54000, 230400, 0x35086ffc
-0, 60000, 230400, 0xcf9352ff
-0, 66000, 230400, 0x0b5139a1
-0, 72000, 230400, 0x22e8a31e
-0, 78000, 230400, 0x82f61a81
-0, 84000, 230400, 0xc5741ab5
-0, 90000, 230400, 0xb5e7b2ff
-0, 96000, 230400, 0x583289ca
-0, 102001, 230400, 0xee52afbb
-0, 108001, 230400, 0xfdb4dc1a
-0, 114001, 230400, 0xf5ce99c0
-0, 120001, 230400, 0xae222255
-0, 126001, 230400, 0xc4f4439d
-0, 132001, 230400, 0x1758f224
-0, 138001, 230400, 0x5f517926
-0, 144001, 230400, 0x73a8bed8
-0, 150001, 230400, 0x7ef8410c
-0, 156001, 230400, 0xfcb693c7
-0, 162001, 230400, 0x5292832e
-0, 168001, 230400, 0x591261d7
-0, 174001, 230400, 0x28cca691
-0, 180001, 230400, 0x22cf40ef
-0, 186001, 230400, 0x517b10f9
-0, 192001, 230400, 0x8197e939
-0, 198001, 230400, 0x9654ffdb
-0, 204001, 230400, 0x803f10dd
-0, 210001, 230400, 0xff9f67af
-0, 216001, 230400, 0x4847244c
-0, 222001, 230400, 0xff31638f
-0, 228001, 230400, 0x9692def5
-0, 234001, 230400, 0x67f0a5fb
-0, 240001, 230400, 0xce192074
-0, 246001, 230400, 0x33d6c4a5
-0, 252001, 230400, 0xaf7b5a03
-0, 258001, 230400, 0xd956b0c0
-0, 264001, 230400, 0x58ff1a65
-0, 270001, 230400, 0x044758a1
-0, 276001, 230400, 0xe8045b65
-0, 282001, 230400, 0xf504c5fb
-0, 288001, 230400, 0x17a9a2b0
-0, 294001, 230400, 0xf68bab8c
-0, 300002, 230400, 0xd06dd0cb
-0, 306002, 230400, 0xc47d2673
-0, 312002, 230400, 0x2112f291
-0, 318002, 230400, 0x4c07c83c
-0, 324002, 230400, 0x22ca0113
-0, 330002, 230400, 0x25b0c8b1
-0, 336002, 230400, 0xb6afc645
-0, 342002, 230400, 0x663b1c09
-0, 348002, 230400, 0x9006ef1f
-0, 354002, 230400, 0x54f81b11
-0, 360002, 230400, 0x456b79f2
-0, 366002, 230400, 0xb08f24d0
-0, 372002, 230400, 0x652ad875
-0, 378002, 230400, 0xc6ecd67f
-0, 384002, 230400, 0x78dad721
-0, 390002, 230400, 0x1d2a4f71
-0, 396002, 230400, 0xc71721d1
-0, 402002, 230400, 0x64e3a7df
-0, 408002, 230400, 0x3bb18e71
-0, 414002, 230400, 0xb571d58c
-0, 420002, 230400, 0xdae6ed5c
-0, 426002, 230400, 0xdd91504b
-0, 432002, 230400, 0xd5a807a5
-0, 438002, 230400, 0x39a67b03
-0, 444002, 230400, 0xe245c8ac
-0, 450002, 230400, 0x5b0d7858
-0, 456002, 230400, 0x501b8097
-0, 462002, 230400, 0xf7b10d48
-0, 468002, 230400, 0x769db0bd
-0, 474002, 230400, 0x600f1086
-0, 480002, 230400, 0x874f5565
-0, 486002, 230400, 0x14322f73
-0, 492002, 230400, 0x0eaa36a5
-0, 498002, 230400, 0x97178d13
-0, 504003, 230400, 0xd4c7a0d1
-0, 510003, 230400, 0x1d424ec8
-0, 516003, 230400, 0x695ad8d9
-0, 522003, 230400, 0xe7cc3ecf
-0, 528003, 230400, 0xfd25fd8c
-0, 534003, 230400, 0xef4bc203
-0, 540003, 230400, 0x2a113bec
-0, 546003, 230400, 0x6e7ad403
-0, 552003, 230400, 0xc6714d2b
-0, 558003, 230400, 0x77df8ba6
-0, 564003, 230400, 0xcd283106
-0, 570003, 230400, 0xcb95676f
-0, 576003, 230400, 0xb0b70393
-0, 582003, 230400, 0x4c40bd63
-0, 588003, 230400, 0x557e8ccf
-0, 594003, 230400, 0x9d5934b2
-0, 600003, 230400, 0x43c1793f
-0, 606003, 230400, 0x0232361e
-0, 612003, 230400, 0x92ed91e4
-0, 618003, 230400, 0x99769789
-0, 624003, 230400, 0xd49c2c5b
-0, 630003, 230400, 0x66b03495
-0, 636003, 230400, 0xb88a4658
-0, 642003, 230400, 0x9c21e4c2
-0, 648003, 230400, 0xb343f372
-0, 654003, 230400, 0xf7f1e588
-0, 660003, 230400, 0x9682bdb2
+#tb 0: 66667/1000000
+0, 0, 0, 1, 230400, 0xee05b509
+0, 1, 1, 1, 230400, 0x71048964
+0, 2, 2, 1, 230400, 0x2ebe4ba1
+0, 3, 3, 1, 230400, 0xeedc45a6
+0, 4, 4, 1, 230400, 0x218e8656
+0, 5, 5, 1, 230400, 0x5792b17e
+0, 6, 6, 1, 230400, 0x51b0a062
+0, 7, 7, 1, 230400, 0x5dc4fd9c
+0, 8, 8, 1, 230400, 0x9b0261b1
+0, 9, 9, 1, 230400, 0x35086ffc
+0, 10, 10, 1, 230400, 0xcf9352ff
+0, 11, 11, 1, 230400, 0x0b5139a1
+0, 12, 12, 1, 230400, 0x22e8a31e
+0, 13, 13, 1, 230400, 0x82f61a81
+0, 14, 14, 1, 230400, 0xc5741ab5
+0, 15, 15, 1, 230400, 0xb5e7b2ff
+0, 16, 16, 1, 230400, 0x583289ca
+0, 17, 17, 1, 230400, 0xee52afbb
+0, 18, 18, 1, 230400, 0xfdb4dc1a
+0, 19, 19, 1, 230400, 0xf5ce99c0
+0, 20, 20, 1, 230400, 0xae222255
+0, 21, 21, 1, 230400, 0xc4f4439d
+0, 22, 22, 1, 230400, 0x1758f224
+0, 23, 23, 1, 230400, 0x5f517926
+0, 24, 24, 1, 230400, 0x73a8bed8
+0, 25, 25, 1, 230400, 0x7ef8410c
+0, 26, 26, 1, 230400, 0xfcb693c7
+0, 27, 27, 1, 230400, 0x5292832e
+0, 28, 28, 1, 230400, 0x591261d7
+0, 29, 29, 1, 230400, 0x28cca691
+0, 30, 30, 1, 230400, 0x22cf40ef
+0, 31, 31, 1, 230400, 0x517b10f9
+0, 32, 32, 1, 230400, 0x8197e939
+0, 33, 33, 1, 230400, 0x9654ffdb
+0, 34, 34, 1, 230400, 0x803f10dd
+0, 35, 35, 1, 230400, 0xff9f67af
+0, 36, 36, 1, 230400, 0x4847244c
+0, 37, 37, 1, 230400, 0xff31638f
+0, 38, 38, 1, 230400, 0x9692def5
+0, 39, 39, 1, 230400, 0x67f0a5fb
+0, 40, 40, 1, 230400, 0xce192074
+0, 41, 41, 1, 230400, 0x33d6c4a5
+0, 42, 42, 1, 230400, 0xaf7b5a03
+0, 43, 43, 1, 230400, 0xd956b0c0
+0, 44, 44, 1, 230400, 0x58ff1a65
+0, 45, 45, 1, 230400, 0x044758a1
+0, 46, 46, 1, 230400, 0xe8045b65
+0, 47, 47, 1, 230400, 0xf504c5fb
+0, 48, 48, 1, 230400, 0x17a9a2b0
+0, 49, 49, 1, 230400, 0xf68bab8c
+0, 50, 50, 1, 230400, 0xd06dd0cb
+0, 51, 51, 1, 230400, 0xc47d2673
+0, 52, 52, 1, 230400, 0x2112f291
+0, 53, 53, 1, 230400, 0x4c07c83c
+0, 54, 54, 1, 230400, 0x22ca0113
+0, 55, 55, 1, 230400, 0x25b0c8b1
+0, 56, 56, 1, 230400, 0xb6afc645
+0, 57, 57, 1, 230400, 0x663b1c09
+0, 58, 58, 1, 230400, 0x9006ef1f
+0, 59, 59, 1, 230400, 0x54f81b11
+0, 60, 60, 1, 230400, 0x456b79f2
+0, 61, 61, 1, 230400, 0xb08f24d0
+0, 62, 62, 1, 230400, 0x652ad875
+0, 63, 63, 1, 230400, 0xc6ecd67f
+0, 64, 64, 1, 230400, 0x78dad721
+0, 65, 65, 1, 230400, 0x1d2a4f71
+0, 66, 66, 1, 230400, 0xc71721d1
+0, 67, 67, 1, 230400, 0x64e3a7df
+0, 68, 68, 1, 230400, 0x3bb18e71
+0, 69, 69, 1, 230400, 0xb571d58c
+0, 70, 70, 1, 230400, 0xdae6ed5c
+0, 71, 71, 1, 230400, 0xdd91504b
+0, 72, 72, 1, 230400, 0xd5a807a5
+0, 73, 73, 1, 230400, 0x39a67b03
+0, 74, 74, 1, 230400, 0xe245c8ac
+0, 75, 75, 1, 230400, 0x5b0d7858
+0, 76, 76, 1, 230400, 0x501b8097
+0, 77, 77, 1, 230400, 0xf7b10d48
+0, 78, 78, 1, 230400, 0x769db0bd
+0, 79, 79, 1, 230400, 0x600f1086
+0, 80, 80, 1, 230400, 0x874f5565
+0, 81, 81, 1, 230400, 0x14322f73
+0, 82, 82, 1, 230400, 0x0eaa36a5
+0, 83, 83, 1, 230400, 0x97178d13
+0, 84, 84, 1, 230400, 0xd4c7a0d1
+0, 85, 85, 1, 230400, 0x1d424ec8
+0, 86, 86, 1, 230400, 0x695ad8d9
+0, 87, 87, 1, 230400, 0xe7cc3ecf
+0, 88, 88, 1, 230400, 0xfd25fd8c
+0, 89, 89, 1, 230400, 0xef4bc203
+0, 90, 90, 1, 230400, 0x2a113bec
+0, 91, 91, 1, 230400, 0x6e7ad403
+0, 92, 92, 1, 230400, 0xc6714d2b
+0, 93, 93, 1, 230400, 0x77df8ba6
+0, 94, 94, 1, 230400, 0xcd283106
+0, 95, 95, 1, 230400, 0xcb95676f
+0, 96, 96, 1, 230400, 0xb0b70393
+0, 97, 97, 1, 230400, 0x4c40bd63
+0, 98, 98, 1, 230400, 0x557e8ccf
+0, 99, 99, 1, 230400, 0x9d5934b2
+0, 100, 100, 1, 230400, 0x43c1793f
+0, 101, 101, 1, 230400, 0x0232361e
+0, 102, 102, 1, 230400, 0x92ed91e4
+0, 103, 103, 1, 230400, 0x99769789
+0, 104, 104, 1, 230400, 0xd49c2c5b
+0, 105, 105, 1, 230400, 0x66b03495
+0, 106, 106, 1, 230400, 0xb88a4658
+0, 107, 107, 1, 230400, 0x9c21e4c2
+0, 108, 108, 1, 230400, 0xb343f372
+0, 109, 109, 1, 230400, 0xf7f1e588
+0, 110, 110, 1, 230400, 0x9682bdb2
diff --git a/gst-libs/ext/libav/tests/ref/fate/mpeg2-field-enc b/gst-libs/ext/libav/tests/ref/fate/mpeg2-field-enc
index 9ae5d62..079aae4 100644
--- a/gst-libs/ext/libav/tests/ref/fate/mpeg2-field-enc
+++ b/gst-libs/ext/libav/tests/ref/fate/mpeg2-field-enc
@@ -1,31 +1,32 @@
-0, 0, 622080, 0xb3b66c5c
-0, 3600, 622080, 0x088ec02b
-0, 7200, 622080, 0x7a36db21
-0, 10800, 622080, 0x541b286f
-0, 14400, 622080, 0xb6c3e590
-0, 18000, 622080, 0x39dbed51
-0, 21600, 622080, 0x973dc728
-0, 25200, 622080, 0xd7a4f804
-0, 28800, 622080, 0xa2484762
-0, 32400, 622080, 0x0cd268d1
-0, 36000, 622080, 0x72eb663d
-0, 39600, 622080, 0x8fdbac59
-0, 43200, 622080, 0xa6f4feb9
-0, 46800, 622080, 0xadb828c6
-0, 50400, 622080, 0xea630a63
-0, 54000, 622080, 0xa901d925
-0, 57600, 622080, 0xac5e7087
-0, 61200, 622080, 0x10274a2b
-0, 64800, 622080, 0x143d541c
-0, 68400, 622080, 0xee94c93a
-0, 72000, 622080, 0xca030208
-0, 75600, 622080, 0x26f30ead
-0, 79200, 622080, 0xfc22f32c
-0, 82800, 622080, 0x940a5ff8
-0, 86400, 622080, 0x2164f805
-0, 90000, 622080, 0xa76f5aba
-0, 93600, 622080, 0x8c311471
-0, 97200, 622080, 0xa45e1d95
-0, 100800, 622080, 0x6cc61d6c
-0, 104400, 622080, 0x6983b417
-0, 108000, 622080, 0x982363c0
+#tb 0: 1/90000
+0, 32400, 32400, 0, 622080, 0xb3b66c5c
+0, 36000, 36000, 0, 622080, 0x088ec02b
+0, 39600, 39600, 0, 622080, 0x7a36db21
+0, 43200, 43200, 0, 622080, 0x541b286f
+0, 46800, 46800, 0, 622080, 0xb6c3e590
+0, 50400, 50400, 0, 622080, 0x39dbed51
+0, 54000, 54000, 0, 622080, 0x973dc728
+0, 57600, 57600, 0, 622080, 0xd7a4f804
+0, 61200, 61200, 0, 622080, 0xa2484762
+0, 64800, 64800, 0, 622080, 0x0cd268d1
+0, 68400, 68400, 0, 622080, 0x72eb663d
+0, 72000, 72000, 0, 622080, 0x8fdbac59
+0, 75600, 75600, 0, 622080, 0xa6f4feb9
+0, 79200, 79200, 0, 622080, 0xadb828c6
+0, 82800, 82800, 0, 622080, 0xea630a63
+0, 86400, 86400, 0, 622080, 0xa901d925
+0, 90000, 90000, 0, 622080, 0xac5e7087
+0, 93600, 93600, 0, 622080, 0x10274a2b
+0, 97200, 97200, 0, 622080, 0x143d541c
+0, 100800, 100800, 0, 622080, 0xee94c93a
+0, 104400, 104400, 0, 622080, 0xca030208
+0, 108000, 108000, 0, 622080, 0x26f30ead
+0, 111600, 111600, 0, 622080, 0xfc22f32c
+0, 115200, 115200, 0, 622080, 0x940a5ff8
+0, 118800, 118800, 0, 622080, 0x2164f805
+0, 122400, 122400, 0, 622080, 0xa76f5aba
+0, 126000, 126000, 0, 622080, 0x8c311471
+0, 129600, 129600, 0, 622080, 0xa45e1d95
+0, 133200, 133200, 0, 622080, 0x6cc61d6c
+0, 136800, 136800, 0, 622080, 0x6983b417
+0, 140400, 140400, 0, 622080, 0x982363c0
diff --git a/gst-libs/ext/libav/tests/ref/fate/msmpeg4v1 b/gst-libs/ext/libav/tests/ref/fate/msmpeg4v1
index d6fea22..d67a0ef 100644
--- a/gst-libs/ext/libav/tests/ref/fate/msmpeg4v1
+++ b/gst-libs/ext/libav/tests/ref/fate/msmpeg4v1
@@ -1,50 +1,51 @@
-0, 0, 126720, 0x84284323
-0, 3003, 126720, 0x336fe236
-0, 6006, 126720, 0x901f1299
-0, 9009, 126720, 0x3b8be5fe
-0, 12012, 126720, 0x6da06397
-0, 15015, 126720, 0xe83de744
-0, 18018, 126720, 0xef2ed2bb
-0, 21021, 126720, 0x3ed1797f
-0, 24024, 126720, 0xf8c81785
-0, 27027, 126720, 0xf38239e0
-0, 30030, 126720, 0x005a2d6d
-0, 33033, 126720, 0xd6be525d
-0, 36036, 126720, 0x39482727
-0, 39039, 126720, 0xc8d95bc5
-0, 42042, 126720, 0xbaebd1e7
-0, 45045, 126720, 0xc94d60b3
-0, 48048, 126720, 0x80886d64
-0, 51051, 126720, 0xf99a39ee
-0, 54054, 126720, 0xbc8b6c26
-0, 57057, 126720, 0x2270acf1
-0, 60060, 126720, 0x754b5965
-0, 63063, 126720, 0x5312dc30
-0, 66066, 126720, 0x2254cc6e
-0, 69069, 126720, 0x58b4bdcc
-0, 72072, 126720, 0xd1ed63ee
-0, 75075, 126720, 0x4442dec5
-0, 78078, 126720, 0x53403cef
-0, 81081, 126720, 0x495d575f
-0, 84084, 126720, 0x3ebfc7e8
-0, 87087, 126720, 0x8f0abe01
-0, 90090, 126720, 0x9540ba61
-0, 93093, 126720, 0xb011e3cf
-0, 96096, 126720, 0x70b4b1f4
-0, 99099, 126720, 0x803b67f9
-0, 102102, 126720, 0xa1c92662
-0, 105105, 126720, 0x3a3d9e4c
-0, 108108, 126720, 0x12660aa2
-0, 111111, 126720, 0xb84c7602
-0, 114114, 126720, 0x920df241
-0, 117117, 126720, 0x5f9db168
-0, 120120, 126720, 0xe3f524a6
-0, 123123, 126720, 0x5f390fa7
-0, 126126, 126720, 0xa9503b4f
-0, 129129, 126720, 0x259c08e2
-0, 132132, 126720, 0xef7a0279
-0, 135135, 126720, 0x4d31ed35
-0, 138138, 126720, 0xe10e3c7e
-0, 141141, 126720, 0xc35f191e
-0, 144144, 126720, 0x3401e9a9
-0, 147147, 126720, 0xd50603f9
+#tb 0: 100/2997
+0, 0, 0, 1, 126720, 0x84284323
+0, 1, 1, 1, 126720, 0x336fe236
+0, 2, 2, 1, 126720, 0x901f1299
+0, 3, 3, 1, 126720, 0x3b8be5fe
+0, 4, 4, 1, 126720, 0x6da06397
+0, 5, 5, 1, 126720, 0xe83de744
+0, 6, 6, 1, 126720, 0xef2ed2bb
+0, 7, 7, 1, 126720, 0x3ed1797f
+0, 8, 8, 1, 126720, 0xf8c81785
+0, 9, 9, 1, 126720, 0xf38239e0
+0, 10, 10, 1, 126720, 0x005a2d6d
+0, 11, 11, 1, 126720, 0xd6be525d
+0, 12, 12, 1, 126720, 0x39482727
+0, 13, 13, 1, 126720, 0xc8d95bc5
+0, 14, 14, 1, 126720, 0xbaebd1e7
+0, 15, 15, 1, 126720, 0xc94d60b3
+0, 16, 16, 1, 126720, 0x80886d64
+0, 17, 17, 1, 126720, 0xf99a39ee
+0, 18, 18, 1, 126720, 0xbc8b6c26
+0, 19, 19, 1, 126720, 0x2270acf1
+0, 20, 20, 1, 126720, 0x754b5965
+0, 21, 21, 1, 126720, 0x5312dc30
+0, 22, 22, 1, 126720, 0x2254cc6e
+0, 23, 23, 1, 126720, 0x58b4bdcc
+0, 24, 24, 1, 126720, 0xd1ed63ee
+0, 25, 25, 1, 126720, 0x4442dec5
+0, 26, 26, 1, 126720, 0x53403cef
+0, 27, 27, 1, 126720, 0x495d575f
+0, 28, 28, 1, 126720, 0x3ebfc7e8
+0, 29, 29, 1, 126720, 0x8f0abe01
+0, 30, 30, 1, 126720, 0x9540ba61
+0, 31, 31, 1, 126720, 0xb011e3cf
+0, 32, 32, 1, 126720, 0x70b4b1f4
+0, 33, 33, 1, 126720, 0x803b67f9
+0, 34, 34, 1, 126720, 0xa1c92662
+0, 35, 35, 1, 126720, 0x3a3d9e4c
+0, 36, 36, 1, 126720, 0x12660aa2
+0, 37, 37, 1, 126720, 0xb84c7602
+0, 38, 38, 1, 126720, 0x920df241
+0, 39, 39, 1, 126720, 0x5f9db168
+0, 40, 40, 1, 126720, 0xe3f524a6
+0, 41, 41, 1, 126720, 0x5f390fa7
+0, 42, 42, 1, 126720, 0xa9503b4f
+0, 43, 43, 1, 126720, 0x259c08e2
+0, 44, 44, 1, 126720, 0xef7a0279
+0, 45, 45, 1, 126720, 0x4d31ed35
+0, 46, 46, 1, 126720, 0xe10e3c7e
+0, 47, 47, 1, 126720, 0xc35f191e
+0, 48, 48, 1, 126720, 0x3401e9a9
+0, 49, 49, 1, 126720, 0xd50603f9
diff --git a/gst-libs/ext/libav/tests/ref/fate/msrle-8bit b/gst-libs/ext/libav/tests/ref/fate/msrle-8bit
index b2374cd..5db1c24 100644
--- a/gst-libs/ext/libav/tests/ref/fate/msrle-8bit
+++ b/gst-libs/ext/libav/tests/ref/fate/msrle-8bit
@@ -1,29 +1,30 @@
-0, 0, 11520, 0xaf416a66
-0, 15000, 11520, 0x8ab76654
-0, 30000, 11520, 0xd22880c4
-0, 45000, 11520, 0x9d2f612a
-0, 60000, 11520, 0xf538600a
-0, 75000, 11520, 0x371d64e6
-0, 90000, 11520, 0x49043fbf
-0, 105000, 11520, 0x49043fbf
-0, 120000, 11520, 0x12d16528
-0, 134999, 11520, 0x1e0a6109
-0, 149999, 11520, 0x9d2f612a
-0, 164999, 11520, 0x96e083ca
-0, 179999, 11520, 0x8ab76654
-0, 194999, 11520, 0x43ac6de7
-0, 209999, 11520, 0x43ac6de7
-0, 224999, 11520, 0x5c3e6819
-0, 239999, 11520, 0x22758af0
-0, 254999, 11520, 0x88845eba
-0, 269999, 11520, 0x4b38848a
-0, 284999, 11520, 0x4f7495d3
-0, 299999, 11520, 0x736b702c
-0, 314999, 11520, 0x736b702c
-0, 329999, 11520, 0x4f7495d3
-0, 344999, 11520, 0x4b38848a
-0, 359999, 11520, 0x88845eba
-0, 374999, 11520, 0x22758af0
-0, 389998, 11520, 0x5c3e6819
-0, 404998, 11520, 0x43ac6de7
-0, 419998, 11520, 0x43ac6de7
+#tb 0: 83333/500000
+0, 0, 0, 1, 11520, 0xaf416a66
+0, 1, 1, 1, 11520, 0x8ab76654
+0, 2, 2, 1, 11520, 0xd22880c4
+0, 3, 3, 1, 11520, 0x9d2f612a
+0, 4, 4, 1, 11520, 0xf538600a
+0, 5, 5, 1, 11520, 0x371d64e6
+0, 6, 6, 1, 11520, 0x49043fbf
+0, 7, 7, 1, 11520, 0x49043fbf
+0, 8, 8, 1, 11520, 0x12d16528
+0, 9, 9, 1, 11520, 0x1e0a6109
+0, 10, 10, 1, 11520, 0x9d2f612a
+0, 11, 11, 1, 11520, 0x96e083ca
+0, 12, 12, 1, 11520, 0x8ab76654
+0, 13, 13, 1, 11520, 0x43ac6de7
+0, 14, 14, 1, 11520, 0x43ac6de7
+0, 15, 15, 1, 11520, 0x5c3e6819
+0, 16, 16, 1, 11520, 0x22758af0
+0, 17, 17, 1, 11520, 0x88845eba
+0, 18, 18, 1, 11520, 0x4b38848a
+0, 19, 19, 1, 11520, 0x4f7495d3
+0, 20, 20, 1, 11520, 0x736b702c
+0, 21, 21, 1, 11520, 0x736b702c
+0, 22, 22, 1, 11520, 0x4f7495d3
+0, 23, 23, 1, 11520, 0x4b38848a
+0, 24, 24, 1, 11520, 0x88845eba
+0, 25, 25, 1, 11520, 0x22758af0
+0, 26, 26, 1, 11520, 0x5c3e6819
+0, 27, 27, 1, 11520, 0x43ac6de7
+0, 28, 28, 1, 11520, 0x43ac6de7
diff --git a/gst-libs/ext/libav/tests/ref/fate/msvideo1-16bit b/gst-libs/ext/libav/tests/ref/fate/msvideo1-16bit
index b403311..fffdea2 100644
--- a/gst-libs/ext/libav/tests/ref/fate/msvideo1-16bit
+++ b/gst-libs/ext/libav/tests/ref/fate/msvideo1-16bit
@@ -1,30 +1,31 @@
-0, 0, 65712, 0x917e0076
-0, 6006, 65712, 0xfe76fd1f
-0, 12013, 65712, 0xd85820ee
-0, 18019, 65712, 0x1b410f6e
-0, 24026, 65712, 0x53c50436
-0, 30032, 65712, 0xa191044d
-0, 36039, 65712, 0xcf02ff1f
-0, 42045, 65712, 0xc2abf85f
-0, 48051, 65712, 0xe273087e
-0, 54058, 65712, 0x087d0936
-0, 60064, 65712, 0x4e4f2e96
-0, 66071, 65712, 0x91b51896
-0, 72077, 65712, 0x2798450e
-0, 78083, 65712, 0x9fea1d06
-0, 84090, 65712, 0xc64a2506
-0, 90096, 65712, 0x0551fe07
-0, 96103, 65712, 0xc64a042e
-0, 102109, 65712, 0xf3680dc6
-0, 108116, 65712, 0x2ea5356e
-0, 114122, 65712, 0x0315ed3f
-0, 120128, 65712, 0xc1d1f917
-0, 126135, 65712, 0xc0f6e607
-0, 132141, 65712, 0x5b0a092e
-0, 138148, 65712, 0x1551f16f
-0, 144154, 65712, 0x8440ee87
-0, 150161, 65712, 0xf7581ae6
-0, 156167, 65712, 0xee67037e
-0, 162173, 65712, 0x4a212ca6
-0, 168180, 65712, 0x693e0aa6
-0, 174186, 65712, 0x13e31116
+#tb 0: 33369/500000
+0, 0, 0, 1, 65712, 0x917e0076
+0, 1, 1, 1, 65712, 0xfe76fd1f
+0, 2, 2, 1, 65712, 0xd85820ee
+0, 3, 3, 1, 65712, 0x1b410f6e
+0, 4, 4, 1, 65712, 0x53c50436
+0, 5, 5, 1, 65712, 0xa191044d
+0, 6, 6, 1, 65712, 0xcf02ff1f
+0, 7, 7, 1, 65712, 0xc2abf85f
+0, 8, 8, 1, 65712, 0xe273087e
+0, 9, 9, 1, 65712, 0x087d0936
+0, 10, 10, 1, 65712, 0x4e4f2e96
+0, 11, 11, 1, 65712, 0x91b51896
+0, 12, 12, 1, 65712, 0x2798450e
+0, 13, 13, 1, 65712, 0x9fea1d06
+0, 14, 14, 1, 65712, 0xc64a2506
+0, 15, 15, 1, 65712, 0x0551fe07
+0, 16, 16, 1, 65712, 0xc64a042e
+0, 17, 17, 1, 65712, 0xf3680dc6
+0, 18, 18, 1, 65712, 0x2ea5356e
+0, 19, 19, 1, 65712, 0x0315ed3f
+0, 20, 20, 1, 65712, 0xc1d1f917
+0, 21, 21, 1, 65712, 0xc0f6e607
+0, 22, 22, 1, 65712, 0x5b0a092e
+0, 23, 23, 1, 65712, 0x1551f16f
+0, 24, 24, 1, 65712, 0x8440ee87
+0, 25, 25, 1, 65712, 0xf7581ae6
+0, 26, 26, 1, 65712, 0xee67037e
+0, 27, 27, 1, 65712, 0x4a212ca6
+0, 28, 28, 1, 65712, 0x693e0aa6
+0, 29, 29, 1, 65712, 0x13e31116
diff --git a/gst-libs/ext/libav/tests/ref/fate/msvideo1-8bit b/gst-libs/ext/libav/tests/ref/fate/msvideo1-8bit
index e0c7033..6e6bc0b 100644
--- a/gst-libs/ext/libav/tests/ref/fate/msvideo1-8bit
+++ b/gst-libs/ext/libav/tests/ref/fate/msvideo1-8bit
@@ -1,31 +1,32 @@
-0, 0, 57600, 0x8c3c5ee8
-0, 3000, 57600, 0xb79800b1
-0, 6000, 57600, 0x54a221be
-0, 9000, 57600, 0xb377ffb3
-0, 12000, 57600, 0x46efd210
-0, 15000, 57600, 0x46efd210
-0, 18000, 57600, 0x46efd210
-0, 21000, 57600, 0x92751fbc
-0, 24000, 57600, 0xd7287442
-0, 27000, 57600, 0xcf1153ee
-0, 30000, 57600, 0xda5de91a
-0, 33000, 57600, 0xa11cd513
-0, 36000, 57600, 0xa8edac2a
-0, 39000, 57600, 0xefd2a392
-0, 42000, 57600, 0x2d7060cf
-0, 45000, 57600, 0xbda3130d
-0, 48000, 57600, 0xacb8e940
-0, 50999, 57600, 0x93778985
-0, 53999, 57600, 0x25ed4d97
-0, 56999, 57600, 0x5be924bf
-0, 59999, 57600, 0xde5ee1f7
-0, 62999, 57600, 0x39850ab6
-0, 65999, 57600, 0x77da195d
-0, 68999, 57600, 0x6dad13c0
-0, 71999, 57600, 0x69897c48
-0, 74999, 57600, 0xfbe74728
-0, 77999, 57600, 0x908af79d
-0, 80999, 57600, 0x4ec4a868
-0, 83999, 57600, 0x7db370a1
-0, 86999, 57600, 0x2b1e52f6
-0, 89999, 57600, 0x2141467c
+#tb 0: 10000/300003
+0, 0, 0, 1, 57600, 0x8c3c5ee8
+0, 1, 1, 1, 57600, 0xb79800b1
+0, 2, 2, 1, 57600, 0x54a221be
+0, 3, 3, 1, 57600, 0xb377ffb3
+0, 4, 4, 1, 57600, 0x46efd210
+0, 5, 5, 1, 57600, 0x46efd210
+0, 6, 6, 1, 57600, 0x46efd210
+0, 7, 7, 1, 57600, 0x92751fbc
+0, 8, 8, 1, 57600, 0xd7287442
+0, 9, 9, 1, 57600, 0xcf1153ee
+0, 10, 10, 1, 57600, 0xda5de91a
+0, 11, 11, 1, 57600, 0xa11cd513
+0, 12, 12, 1, 57600, 0xa8edac2a
+0, 13, 13, 1, 57600, 0xefd2a392
+0, 14, 14, 1, 57600, 0x2d7060cf
+0, 15, 15, 1, 57600, 0xbda3130d
+0, 16, 16, 1, 57600, 0xacb8e940
+0, 17, 17, 1, 57600, 0x93778985
+0, 18, 18, 1, 57600, 0x25ed4d97
+0, 19, 19, 1, 57600, 0x5be924bf
+0, 20, 20, 1, 57600, 0xde5ee1f7
+0, 21, 21, 1, 57600, 0x39850ab6
+0, 22, 22, 1, 57600, 0x77da195d
+0, 23, 23, 1, 57600, 0x6dad13c0
+0, 24, 24, 1, 57600, 0x69897c48
+0, 25, 25, 1, 57600, 0xfbe74728
+0, 26, 26, 1, 57600, 0x908af79d
+0, 27, 27, 1, 57600, 0x4ec4a868
+0, 28, 28, 1, 57600, 0x7db370a1
+0, 29, 29, 1, 57600, 0x2b1e52f6
+0, 30, 30, 1, 57600, 0x2141467c
diff --git a/gst-libs/ext/libav/tests/ref/fate/mszh b/gst-libs/ext/libav/tests/ref/fate/mszh
index ba6221f..4ff76ff 100644
--- a/gst-libs/ext/libav/tests/ref/fate/mszh
+++ b/gst-libs/ext/libav/tests/ref/fate/mszh
@@ -1 +1,2 @@
-0, 0, 253440, 0x94af61e5
+#tb 0: 100/2997
+0, 0, 0, 1, 253440, 0x94af61e5
diff --git a/gst-libs/ext/libav/tests/ref/fate/mtv b/gst-libs/ext/libav/tests/ref/fate/mtv
index 6699f62..4f8f616 100644
--- a/gst-libs/ext/libav/tests/ref/fate/mtv
+++ b/gst-libs/ext/libav/tests/ref/fate/mtv
@@ -1,135 +1,138 @@
-0, 0, 18432, 0xbd7e0ac8
-1, 0, 417, 0xae1cc66a
-1, 2351, 418, 0xdc3ec850
-1, 4702, 418, 0x4e8ed05f
-0, 5625, 18432, 0xbd7e0ac8
-1, 7053, 418, 0xeb43d574
-1, 9404, 418, 0x9357c91d
-0, 11250, 18432, 0x902e0ab4
-1, 11755, 418, 0x5306d16b
-1, 14106, 418, 0x46e0d4da
-1, 16457, 418, 0xac11ce79
-0, 16875, 18432, 0xf1940b28
-1, 18808, 418, 0xffdfc4ad
-1, 21159, 418, 0xf8a8c2ff
-0, 22500, 18432, 0x2c180ac8
-1, 23510, 418, 0x2d66d83f
-1, 25861, 418, 0x65c0da12
-0, 28125, 18432, 0x2eae0b34
-1, 28212, 418, 0x0eafd20f
-1, 30563, 418, 0x8c6dd949
-1, 32914, 418, 0x9094c02d
-0, 33750, 18432, 0x2eae0b34
-1, 35265, 418, 0xb47bd944
-1, 37616, 418, 0x935ccce7
-0, 39375, 18432, 0x2eae0b34
-1, 39967, 418, 0x6e3ed020
-1, 42318, 418, 0x8922cd6c
-1, 44669, 418, 0xe811c8f8
-0, 45000, 18432, 0x2eae0b34
-1, 47020, 418, 0xb84adc72
-1, 49371, 418, 0xa2bbc5f4
-0, 50625, 18432, 0x2eae0b34
-1, 51722, 418, 0xec0cb67d
-1, 54073, 418, 0x89d1d014
-0, 56250, 18432, 0x2eae0b34
-1, 56424, 418, 0xfb5bc872
-1, 58776, 417, 0x8bfcc7a0
-1, 61127, 418, 0xeb4ac61b
-0, 61875, 18432, 0x2eae0b34
-1, 63478, 418, 0xd3cbc3c4
-1, 65829, 418, 0xa272d092
-0, 67500, 18432, 0x2eae0b34
-1, 68180, 418, 0x611ec37e
-1, 70531, 418, 0x70a3d423
-1, 72882, 418, 0xeff9ccf4
-0, 73125, 18432, 0x2eae0b34
-1, 75233, 418, 0x9788c65b
-1, 77584, 418, 0xe9a8cb8c
-0, 78750, 18432, 0x2eae0b34
-1, 79935, 418, 0x5834c300
-1, 82286, 418, 0xa4b8cd3a
-0, 84375, 18432, 0x2eae0b34
-1, 84637, 418, 0x6de2c7f9
-1, 86988, 418, 0x961bbbf3
-1, 89339, 418, 0x53edc13a
-0, 90000, 18432, 0x2c180ac8
-1, 91690, 418, 0x2fedc4b0
-1, 94041, 418, 0xb756c18b
-0, 95625, 18432, 0x2eae0b34
-1, 96392, 418, 0xaf0ed0e4
-1, 98743, 418, 0x019fd3f0
-1, 101094, 418, 0x6e29d83e
-0, 101250, 18432, 0x2c180ac8
-1, 103445, 418, 0x2ddad6bb
-1, 105796, 418, 0xafefca99
-0, 106875, 18432, 0x2eae0b34
-1, 108147, 418, 0x366ed013
-1, 110498, 418, 0x532ac7e0
-0, 112500, 18432, 0x2c180ac8
-1, 112849, 418, 0x1d0cd1ce
-1, 115200, 417, 0x572ad1e3
-1, 117551, 418, 0x858cd91f
-0, 118125, 18432, 0x2eae0b34
-1, 119902, 418, 0x82cacdfd
-1, 122253, 418, 0xf4dcc6ed
-0, 123750, 18432, 0x2c180ac8
-1, 124604, 418, 0x2cf3ca72
-1, 126955, 418, 0x5963c859
-1, 129306, 418, 0xa667c53d
-0, 129375, 18432, 0x2eae0b34
-1, 131657, 418, 0xb2f1d09c
-1, 134008, 418, 0x2ec1c8d3
-0, 135000, 18432, 0x2eae0b34
-1, 136359, 418, 0x5754d2e8
-1, 138710, 418, 0x1956bdba
-0, 140625, 18432, 0x2eae0b34
-1, 141061, 418, 0x3e18bd55
-1, 143412, 418, 0xe4cfc339
-1, 145763, 418, 0xb426c835
-0, 146250, 18432, 0x2eae0b34
-1, 148114, 418, 0xd7b6cbcf
-1, 150465, 418, 0x340ec315
-0, 151875, 18432, 0x2eae0b34
-1, 152816, 418, 0x23a9baec
-1, 155167, 418, 0x9f04cd01
-0, 157500, 18432, 0x2eae0b34
-1, 157518, 418, 0xa80ec223
-1, 159869, 418, 0x23d6bd5d
-1, 162220, 418, 0xcb25cf5b
-0, 163125, 18432, 0x2eae0b34
-1, 164571, 418, 0xccccc217
-1, 166922, 418, 0x757abbfe
-0, 168750, 18432, 0x2eae0b34
-1, 169273, 418, 0xa2e6cc68
-1, 171624, 418, 0xdf77cc05
-1, 173976, 417, 0xe9d2c5d5
-0, 174375, 18432, 0x2eae0b34
-1, 176327, 418, 0x50dec174
-1, 178678, 418, 0xf654b27e
-0, 180000, 18432, 0x2c180ac8
-1, 181029, 418, 0x4d8bc26e
-1, 183380, 418, 0xccd2bf37
-0, 185625, 18432, 0x2eae0b34
-1, 185731, 418, 0x6ce2c18a
-1, 188082, 418, 0xb3cdcf0c
-1, 190433, 418, 0x55eebe9a
-0, 191250, 18432, 0x2c180ac8
-1, 192784, 418, 0x9031c9ec
-1, 195135, 418, 0xb037c49d
-0, 196875, 18432, 0x2eae0b34
-1, 197486, 418, 0x377bcc78
-1, 199837, 418, 0x3762c725
-1, 202188, 418, 0x39afbd4d
-0, 202500, 18432, 0x2c180ac8
-1, 204539, 418, 0x655ed6cd
-1, 206890, 418, 0x09aec202
-0, 208125, 18432, 0x2eae0b34
-1, 209241, 418, 0xf2d2ce55
-1, 211592, 418, 0x254ebf04
-0, 213750, 18432, 0x2c180ac8
-1, 213943, 418, 0xa105cdcc
-1, 216294, 418, 0x1477ba58
-1, 218645, 418, 0x8d0dcdb2
-1, 220996, 418, 0x0d7cbef4
-1, 223347, 294, 0x5e2b87c4
+#tb 0: 1/16
+#tb 1: 1/44100
+0, 0, 0, 1, 12288, 0xc2258ebc
+1, 0, 0, 1152, 417, 0xae1cc66a
+1, 1152, 1152, 1152, 418, 0xdc3ec850
+1, 2304, 2304, 1152, 418, 0x4e8ed05f
+0, 1, 1, 1, 12288, 0xc2258ebc
+1, 3456, 3456, 1152, 418, 0xeb43d574
+1, 4608, 4608, 1152, 418, 0x9357c91d
+0, 2, 2, 1, 12288, 0xb3fe829c
+1, 5760, 5760, 1152, 418, 0x5306d16b
+1, 6912, 6912, 1152, 418, 0x46e0d4da
+1, 8064, 8064, 1152, 418, 0xac11ce79
+0, 3, 3, 1, 12288, 0x2315884a
+1, 9216, 9216, 1152, 418, 0xffdfc4ad
+1, 10368, 10368, 1152, 418, 0xf8a8c2ff
+0, 4, 4, 1, 12288, 0x95a08046
+1, 11520, 11520, 1152, 418, 0x2d66d83f
+1, 12672, 12672, 1152, 418, 0x65c0da12
+0, 5, 5, 1, 12288, 0xdb49886b
+1, 13824, 13824, 1152, 418, 0x0eafd20f
+1, 14976, 14976, 1152, 418, 0x8c6dd949
+1, 16128, 16128, 1152, 418, 0x9094c02d
+0, 6, 6, 1, 12288, 0xdb49886b
+1, 17280, 17280, 1152, 418, 0xb47bd944
+1, 18432, 18432, 1152, 418, 0x935ccce7
+0, 7, 7, 1, 12288, 0xdb49886b
+1, 19584, 19584, 1152, 418, 0x6e3ed020
+1, 20736, 20736, 1152, 418, 0x8922cd6c
+1, 21888, 21888, 1152, 418, 0xe811c8f8
+0, 8, 8, 1, 12288, 0xdb49886b
+1, 23040, 23040, 1152, 418, 0xb84adc72
+1, 24192, 24192, 1152, 418, 0xa2bbc5f4
+0, 9, 9, 1, 12288, 0xdb49886b
+1, 25344, 25344, 1152, 418, 0xec0cb67d
+1, 26496, 26496, 1152, 418, 0x89d1d014
+0, 10, 10, 1, 12288, 0xdb49886b
+1, 27648, 27648, 1152, 418, 0xfb5bc872
+1, 28800, 28800, 1152, 417, 0x8bfcc7a0
+1, 29952, 29952, 1152, 418, 0xeb4ac61b
+0, 11, 11, 1, 12288, 0xdb49886b
+1, 31104, 31104, 1152, 418, 0xd3cbc3c4
+1, 32256, 32256, 1152, 418, 0xa272d092
+0, 12, 12, 1, 12288, 0xdb49886b
+1, 33408, 33408, 1152, 418, 0x611ec37e
+1, 34560, 34560, 1152, 418, 0x70a3d423
+1, 35712, 35712, 1152, 418, 0xeff9ccf4
+0, 13, 13, 1, 12288, 0xdb49886b
+1, 36864, 36864, 1152, 418, 0x9788c65b
+1, 38016, 38016, 1152, 418, 0xe9a8cb8c
+0, 14, 14, 1, 12288, 0xdb49886b
+1, 39168, 39168, 1152, 418, 0x5834c300
+1, 40320, 40320, 1152, 418, 0xa4b8cd3a
+0, 15, 15, 1, 12288, 0xdb49886b
+1, 41472, 41472, 1152, 418, 0x6de2c7f9
+1, 42624, 42624, 1152, 418, 0x961bbbf3
+1, 43776, 43776, 1152, 418, 0x53edc13a
+0, 16, 16, 1, 12288, 0x95a08046
+1, 44928, 44928, 1152, 418, 0x2fedc4b0
+1, 46080, 46080, 1152, 418, 0xb756c18b
+0, 17, 17, 1, 12288, 0xdb49886b
+1, 47232, 47232, 1152, 418, 0xaf0ed0e4
+1, 48384, 48384, 1152, 418, 0x019fd3f0
+1, 49536, 49536, 1152, 418, 0x6e29d83e
+0, 18, 18, 1, 12288, 0x95a08046
+1, 50688, 50688, 1152, 418, 0x2ddad6bb
+1, 51840, 51840, 1152, 418, 0xafefca99
+0, 19, 19, 1, 12288, 0xdb49886b
+1, 52992, 52992, 1152, 418, 0x366ed013
+1, 54144, 54144, 1152, 418, 0x532ac7e0
+0, 20, 20, 1, 12288, 0x95a08046
+1, 55296, 55296, 1152, 418, 0x1d0cd1ce
+1, 56448, 56448, 1152, 417, 0x572ad1e3
+1, 57600, 57600, 1152, 418, 0x858cd91f
+0, 21, 21, 1, 12288, 0xdb49886b
+1, 58752, 58752, 1152, 418, 0x82cacdfd
+1, 59904, 59904, 1152, 418, 0xf4dcc6ed
+0, 22, 22, 1, 12288, 0x95a08046
+1, 61056, 61056, 1152, 418, 0x2cf3ca72
+1, 62208, 62208, 1152, 418, 0x5963c859
+1, 63360, 63360, 1152, 418, 0xa667c53d
+0, 23, 23, 1, 12288, 0xdb49886b
+1, 64512, 64512, 1152, 418, 0xb2f1d09c
+1, 65664, 65664, 1152, 418, 0x2ec1c8d3
+0, 24, 24, 1, 12288, 0xdb49886b
+1, 66816, 66816, 1152, 418, 0x5754d2e8
+1, 67968, 67968, 1152, 418, 0x1956bdba
+0, 25, 25, 1, 12288, 0xdb49886b
+1, 69120, 69120, 1152, 418, 0x3e18bd55
+1, 70272, 70272, 1152, 418, 0xe4cfc339
+1, 71424, 71424, 1152, 418, 0xb426c835
+0, 26, 26, 1, 12288, 0xdb49886b
+1, 72576, 72576, 1152, 418, 0xd7b6cbcf
+1, 73728, 73728, 1152, 418, 0x340ec315
+0, 27, 27, 1, 12288, 0xdb49886b
+1, 74880, 74880, 1152, 418, 0x23a9baec
+1, 76032, 76032, 1152, 418, 0x9f04cd01
+0, 28, 28, 1, 12288, 0xdb49886b
+1, 77184, 77184, 1152, 418, 0xa80ec223
+1, 78336, 78336, 1152, 418, 0x23d6bd5d
+1, 79488, 79488, 1152, 418, 0xcb25cf5b
+0, 29, 29, 1, 12288, 0xdb49886b
+1, 80640, 80640, 1152, 418, 0xccccc217
+1, 81792, 81792, 1152, 418, 0x757abbfe
+0, 30, 30, 1, 12288, 0xdb49886b
+1, 82944, 82944, 1152, 418, 0xa2e6cc68
+1, 84096, 84096, 1152, 418, 0xdf77cc05
+1, 85248, 85248, 1152, 417, 0xe9d2c5d5
+0, 31, 31, 1, 12288, 0xdb49886b
+1, 86400, 86400, 1152, 418, 0x50dec174
+1, 87552, 87552, 1152, 418, 0xf654b27e
+0, 32, 32, 1, 12288, 0x95a08046
+1, 88704, 88704, 1152, 418, 0x4d8bc26e
+1, 89856, 89856, 1152, 418, 0xccd2bf37
+0, 33, 33, 1, 12288, 0xdb49886b
+1, 91008, 91008, 1152, 418, 0x6ce2c18a
+1, 92160, 92160, 1152, 418, 0xb3cdcf0c
+1, 93312, 93312, 1152, 418, 0x55eebe9a
+0, 34, 34, 1, 12288, 0x95a08046
+1, 94464, 94464, 1152, 418, 0x9031c9ec
+1, 95616, 95616, 1152, 418, 0xb037c49d
+0, 35, 35, 1, 12288, 0xdb49886b
+1, 96768, 96768, 1152, 418, 0x377bcc78
+1, 97920, 97920, 1152, 418, 0x3762c725
+1, 99072, 99072, 1152, 418, 0x39afbd4d
+0, 36, 36, 1, 12288, 0x95a08046
+1, 100224, 100224, 1152, 418, 0x655ed6cd
+1, 101376, 101376, 1152, 418, 0x09aec202
+0, 37, 37, 1, 12288, 0xdb49886b
+1, 102528, 102528, 1152, 418, 0xf2d2ce55
+1, 103680, 103680, 1152, 418, 0x254ebf04
+0, 38, 38, 1, 12288, 0x95a08046
+1, 104832, 104832, 1152, 418, 0xa105cdcc
+1, 105984, 105984, 1152, 418, 0x1477ba58
+1, 107136, 107136, 1152, 418, 0x8d0dcdb2
+0, 39, 39, 1, 3584, 0x0354c435
+1, 108288, 108288, 1152, 418, 0x0d7cbef4
+1, 109440, 109440, 1152, 294, 0x5e2b87c4
diff --git a/gst-libs/ext/libav/tests/ref/fate/mxf-demux b/gst-libs/ext/libav/tests/ref/fate/mxf-demux
index 8774753..e162775 100644
--- a/gst-libs/ext/libav/tests/ref/fate/mxf-demux
+++ b/gst-libs/ext/libav/tests/ref/fate/mxf-demux
@@ -1,97 +1,99 @@
-0, 0, 8468, 0xc0855553
-1, 0, 32000, 0x479155e6
-0, 3600, 3814, 0xa10783b4
-0, 7200, 3747, 0xb7bf6973
-0, 10800, 3705, 0x5462a600
-0, 14400, 3704, 0x1e564943
-0, 18000, 3760, 0x10464b9a
-0, 21600, 3799, 0xd41d6dcf
-0, 25200, 3832, 0x5cf6999e
-0, 28800, 3778, 0xe5fc7b9e
-0, 32400, 38193, 0xd34e5dd4
-0, 36000, 8520, 0x2a203e68
-0, 39600, 3832, 0xe4c4b2fe
-0, 43200, 3787, 0x0cf95fee
-0, 46800, 3766, 0x9e019d14
-0, 50400, 3785, 0x0ea9ae75
-0, 54000, 3703, 0x11d349ff
-0, 57600, 3731, 0x5cf358ef
-0, 61200, 3785, 0x01c8962f
-0, 64800, 3741, 0xb2c47d53
-0, 68400, 38150, 0x08fa1f55
-0, 72000, 8487, 0x0c234b9a
-0, 75600, 3791, 0x831192ef
-0, 79200, 3612, 0x598944fb
-0, 82800, 3710, 0xccbb711a
-0, 86400, 3864, 0x4385966e
-0, 90000, 3919, 0x24e2abc3
-0, 93600, 3777, 0x210c6219
-0, 97200, 3811, 0x23bf68c2
-0, 100800, 3802, 0x52688862
-0, 104400, 38027, 0x3d5aa8b9
-0, 108000, 8333, 0x617de950
-0, 111600, 3831, 0x13fad8fc
-0, 115200, 3719, 0xbc317470
-0, 118800, 3761, 0xeac460b6
-0, 122400, 3637, 0x27d64b32
-0, 126000, 3666, 0xf0f700a5
-0, 129600, 3788, 0x1c4662a8
-0, 133200, 3960, 0xef6b9e99
-0, 136800, 3793, 0x3a6ca832
-0, 140400, 38312, 0xce1317cc
-0, 144000, 8548, 0x4ca944d4
-0, 147600, 3866, 0x4e85bf0f
-0, 151200, 3644, 0x030338e5
-0, 154800, 3634, 0xa95f4512
-0, 158400, 3925, 0x7583ba86
-0, 162000, 3675, 0x979f423f
-0, 165600, 3703, 0x11375f7a
-0, 169200, 3705, 0xb7de5d16
-0, 172800, 3688, 0x1db45852
-0, 176400, 38412, 0x2ee26a63
-0, 180000, 8385, 0x0bc20a27
-1, 180000, 32000, 0x8f7e5009
-0, 183600, 3733, 0xa3e2a9a0
-0, 187200, 3773, 0x27769caa
-0, 190800, 3670, 0xc8335e98
-0, 194400, 3596, 0xd6512fb0
-0, 198000, 3579, 0xa621fbc2
-0, 201600, 3641, 0x2f4f46ca
-0, 205200, 3686, 0x0a92385a
-0, 208800, 3672, 0xe65137b9
-0, 212400, 39065, 0xc723bf8b
-0, 216000, 8611, 0x5d177f40
-0, 219600, 3758, 0x33d59966
-0, 223200, 3674, 0x54f37902
-0, 226800, 3615, 0xa0f045fa
-0, 230400, 3719, 0x41cf93ff
-0, 234000, 3757, 0x3a1b7e8f
-0, 237600, 3762, 0xe7f9714d
-0, 241200, 3738, 0x8121805b
-0, 244800, 3733, 0x13e262db
-0, 248400, 38433, 0x3d58c500
-0, 252000, 8410, 0xa4f7fd2e
-0, 255600, 3711, 0x0e112d3c
-0, 259200, 3692, 0xb46574b2
-0, 262800, 3563, 0xad43343d
-0, 266400, 3613, 0x5cd85c4f
-0, 270000, 3653, 0xe15a2853
-0, 273600, 3684, 0x9ddd58cb
-0, 277200, 3256, 0xd7f89f2e
-0, 280800, 3698, 0x2b82624a
-0, 284400, 39520, 0xd3f2b7c5
-0, 288000, 8493, 0x163559be
-0, 291600, 3719, 0x6fa0916f
-0, 295200, 3655, 0xa9233de1
-0, 298800, 3684, 0xa6125737
-0, 302400, 3688, 0xa9da6686
-0, 306000, 3685, 0x674d634e
-0, 309600, 3677, 0x7a85535d
-0, 313200, 3666, 0xce3600a2
-0, 316800, 3837, 0x3a7090e1
-0, 320400, 38696, 0x12c59cd2
-0, 324000, 8022, 0xd343433f
-0, 327600, 5157, 0x440c14e5
-0, 331200, 5003, 0xf8e1daff
-0, 334800, 4954, 0x89866344
-0, 338400, 53664, 0xeb0c4c42
+#tb 0: 1/25
+#tb 1: 1/25
+0, 0, -9223372036854775808, 1, 8468, 0xc0855553
+1, 0, 0, 50, 32000, 0x479155e6
+0, 1, -9223372036854775808, 1, 3814, 0xa10783b4
+0, 2, -9223372036854775808, 1, 3747, 0xb7bf6973
+0, 3, -9223372036854775808, 1, 3705, 0x5462a600
+0, 4, -9223372036854775808, 1, 3704, 0x1e564943
+0, 5, -9223372036854775808, 1, 3760, 0x10464b9a
+0, 6, -9223372036854775808, 1, 3799, 0xd41d6dcf
+0, 7, -9223372036854775808, 1, 3832, 0x5cf6999e
+0, 8, -9223372036854775808, 1, 3778, 0xe5fc7b9e
+0, 9, -9223372036854775808, 1, 38193, 0xd34e5dd4
+0, 10, -9223372036854775808, 1, 8520, 0x2a203e68
+0, 11, -9223372036854775808, 1, 3832, 0xe4c4b2fe
+0, 12, -9223372036854775808, 1, 3787, 0x0cf95fee
+0, 13, -9223372036854775808, 1, 3766, 0x9e019d14
+0, 14, -9223372036854775808, 1, 3785, 0x0ea9ae75
+0, 15, -9223372036854775808, 1, 3703, 0x11d349ff
+0, 16, -9223372036854775808, 1, 3731, 0x5cf358ef
+0, 17, -9223372036854775808, 1, 3785, 0x01c8962f
+0, 18, -9223372036854775808, 1, 3741, 0xb2c47d53
+0, 19, -9223372036854775808, 1, 38150, 0x08fa1f55
+0, 20, -9223372036854775808, 1, 8487, 0x0c234b9a
+0, 21, -9223372036854775808, 1, 3791, 0x831192ef
+0, 22, -9223372036854775808, 1, 3612, 0x598944fb
+0, 23, -9223372036854775808, 1, 3710, 0xccbb711a
+0, 24, -9223372036854775808, 1, 3864, 0x4385966e
+0, 25, -9223372036854775808, 1, 3919, 0x24e2abc3
+0, 26, -9223372036854775808, 1, 3777, 0x210c6219
+0, 27, -9223372036854775808, 1, 3811, 0x23bf68c2
+0, 28, -9223372036854775808, 1, 3802, 0x52688862
+0, 29, -9223372036854775808, 1, 38027, 0x3d5aa8b9
+0, 30, -9223372036854775808, 1, 8333, 0x617de950
+0, 31, -9223372036854775808, 1, 3831, 0x13fad8fc
+0, 32, -9223372036854775808, 1, 3719, 0xbc317470
+0, 33, -9223372036854775808, 1, 3761, 0xeac460b6
+0, 34, -9223372036854775808, 1, 3637, 0x27d64b32
+0, 35, -9223372036854775808, 1, 3666, 0xf0f700a5
+0, 36, -9223372036854775808, 1, 3788, 0x1c4662a8
+0, 37, -9223372036854775808, 1, 3960, 0xef6b9e99
+0, 38, -9223372036854775808, 1, 3793, 0x3a6ca832
+0, 39, -9223372036854775808, 1, 38312, 0xce1317cc
+0, 40, -9223372036854775808, 1, 8548, 0x4ca944d4
+0, 41, -9223372036854775808, 1, 3866, 0x4e85bf0f
+0, 42, -9223372036854775808, 1, 3644, 0x030338e5
+0, 43, -9223372036854775808, 1, 3634, 0xa95f4512
+0, 44, -9223372036854775808, 1, 3925, 0x7583ba86
+0, 45, -9223372036854775808, 1, 3675, 0x979f423f
+0, 46, -9223372036854775808, 1, 3703, 0x11375f7a
+0, 47, -9223372036854775808, 1, 3705, 0xb7de5d16
+0, 48, -9223372036854775808, 1, 3688, 0x1db45852
+0, 49, -9223372036854775808, 1, 38412, 0x2ee26a63
+0, 50, -9223372036854775808, 1, 8385, 0x0bc20a27
+1, 50, 50, 50, 32000, 0x8f7e5009
+0, 51, -9223372036854775808, 1, 3733, 0xa3e2a9a0
+0, 52, -9223372036854775808, 1, 3773, 0x27769caa
+0, 53, -9223372036854775808, 1, 3670, 0xc8335e98
+0, 54, -9223372036854775808, 1, 3596, 0xd6512fb0
+0, 55, -9223372036854775808, 1, 3579, 0xa621fbc2
+0, 56, -9223372036854775808, 1, 3641, 0x2f4f46ca
+0, 57, -9223372036854775808, 1, 3686, 0x0a92385a
+0, 58, -9223372036854775808, 1, 3672, 0xe65137b9
+0, 59, -9223372036854775808, 1, 39065, 0xc723bf8b
+0, 60, -9223372036854775808, 1, 8611, 0x5d177f40
+0, 61, -9223372036854775808, 1, 3758, 0x33d59966
+0, 62, -9223372036854775808, 1, 3674, 0x54f37902
+0, 63, -9223372036854775808, 1, 3615, 0xa0f045fa
+0, 64, -9223372036854775808, 1, 3719, 0x41cf93ff
+0, 65, -9223372036854775808, 1, 3757, 0x3a1b7e8f
+0, 66, -9223372036854775808, 1, 3762, 0xe7f9714d
+0, 67, -9223372036854775808, 1, 3738, 0x8121805b
+0, 68, -9223372036854775808, 1, 3733, 0x13e262db
+0, 69, -9223372036854775808, 1, 38433, 0x3d58c500
+0, 70, -9223372036854775808, 1, 8410, 0xa4f7fd2e
+0, 71, -9223372036854775808, 1, 3711, 0x0e112d3c
+0, 72, -9223372036854775808, 1, 3692, 0xb46574b2
+0, 73, -9223372036854775808, 1, 3563, 0xad43343d
+0, 74, -9223372036854775808, 1, 3613, 0x5cd85c4f
+0, 75, -9223372036854775808, 1, 3653, 0xe15a2853
+0, 76, -9223372036854775808, 1, 3684, 0x9ddd58cb
+0, 77, -9223372036854775808, 1, 3256, 0xd7f89f2e
+0, 78, -9223372036854775808, 1, 3698, 0x2b82624a
+0, 79, -9223372036854775808, 1, 39520, 0xd3f2b7c5
+0, 80, -9223372036854775808, 1, 8493, 0x163559be
+0, 81, -9223372036854775808, 1, 3719, 0x6fa0916f
+0, 82, -9223372036854775808, 1, 3655, 0xa9233de1
+0, 83, -9223372036854775808, 1, 3684, 0xa6125737
+0, 84, -9223372036854775808, 1, 3688, 0xa9da6686
+0, 85, -9223372036854775808, 1, 3685, 0x674d634e
+0, 86, -9223372036854775808, 1, 3677, 0x7a85535d
+0, 87, -9223372036854775808, 1, 3666, 0xce3600a2
+0, 88, -9223372036854775808, 1, 3837, 0x3a7090e1
+0, 89, -9223372036854775808, 1, 38696, 0x12c59cd2
+0, 90, -9223372036854775808, 1, 8022, 0xd343433f
+0, 91, -9223372036854775808, 1, 5157, 0x440c14e5
+0, 92, -9223372036854775808, 1, 5003, 0xf8e1daff
+0, 93, -9223372036854775808, 1, 4954, 0x89866344
+0, 94, -9223372036854775808, 1, 53664, 0xeb0c4c42
diff --git a/gst-libs/ext/libav/tests/ref/fate/nc-demux b/gst-libs/ext/libav/tests/ref/fate/nc-demux
index adc03f0..1d00f8e 100644
--- a/gst-libs/ext/libav/tests/ref/fate/nc-demux
+++ b/gst-libs/ext/libav/tests/ref/fate/nc-demux
@@ -1,91 +1,92 @@
-0, 0, 19787, 0x75e463f3
-0, 900, 11913, 0x0f429c34
-0, 1800, 14225, 0xbd3c704c
-0, 2700, 10357, 0xbf232393
-0, 3600, 9595, 0xf565d39e
-0, 4500, 9262, 0x2afd6ce0
-0, 5400, 12214, 0x6ae81d9b
-0, 6300, 13920, 0x31b5b307
-0, 7200, 10164, 0x141eca4e
-0, 8100, 9516, 0xd5f2c42b
-0, 9000, 10006, 0x80850a76
-0, 9900, 11791, 0x10bc2dcd
-0, 10800, 13756, 0xda1fee08
-0, 11700, 10452, 0xbb3d62b0
-0, 12600, 9171, 0x64ae10f6
-0, 13500, 8816, 0x31ad8fcb
-0, 14400, 13168, 0xea1085ac
-0, 15300, 12797, 0x25143d22
-0, 16200, 11324, 0x3a54b38e
-0, 17100, 9173, 0x8b2bf552
-0, 18000, 9247, 0x2e87226b
-0, 18900, 14140, 0x1063786c
-0, 19800, 14437, 0xde123a17
-0, 20700, 11938, 0x3f1168f4
-0, 21600, 11966, 0xdd6786ec
-0, 22500, 13213, 0x8ab27c58
-0, 23400, 11843, 0x90415d8b
-0, 24300, 13345, 0x3c0e1793
-0, 25200, 9977, 0x74fc7f4b
-0, 26100, 9158, 0x0b5426a5
-0, 27000, 12715, 0x0035d569
-0, 27900, 19944, 0xe2887ba8
-0, 28800, 12762, 0xb0f17939
-0, 29700, 10260, 0x182b27aa
-0, 30600, 7405, 0x227fe9bf
-0, 31500, 13317, 0x1a678c62
-0, 32400, 11304, 0x3277af6d
-0, 33300, 13291, 0xe267616a
-0, 34200, 8975, 0xe7eeacea
-0, 35100, 8473, 0x8bb1cbff
-0, 36000, 13878, 0xfd3d55bb
-0, 36900, 11278, 0x61c7c55e
-0, 37800, 13785, 0x2acbf88f
-0, 38700, 9521, 0x99e2d065
-0, 39600, 9340, 0xe5c96510
-0, 40500, 12777, 0x4c3c7844
-0, 41400, 10685, 0x39e0f42e
-0, 42300, 14237, 0x9398d07f
-0, 43200, 9021, 0x3343c7ec
-0, 44100, 9327, 0xad489e86
-0, 45000, 13507, 0xb1344f1c
-0, 45900, 10199, 0x9a8868bf
-0, 46800, 14535, 0xddb13f41
-0, 47700, 8773, 0x3d8b6a79
-0, 48600, 16084, 0x5d915de4
-0, 49500, 9156, 0x5cb08a6a
-0, 50400, 15027, 0xc23b1dc8
-0, 51300, 8240, 0xd6d3526c
-0, 52200, 8720, 0x439c43bf
-0, 53100, 13684, 0x18fc82f0
-0, 54000, 8829, 0xa3ebeb30
-0, 54900, 14650, 0x99e8678c
-0, 55800, 19626, 0x80a7ee5c
-0, 56700, 7762, 0x7c209a12
-0, 57600, 13636, 0xc89c1aa3
-0, 58500, 8337, 0x749bf76a
-0, 59400, 15098, 0xc98bc6dc
-0, 60300, 9070, 0xcd4cf7f1
-0, 61200, 8269, 0x90e95d54
-0, 62100, 12672, 0x034888d0
-0, 63000, 7519, 0x6c089672
-0, 63900, 14439, 0x5d2478b9
-0, 64800, 6928, 0x98fbaa67
-0, 65700, 8735, 0x07643f1e
-0, 66600, 13522, 0x55034cdb
-0, 67500, 7807, 0xf5983103
-0, 68400, 14484, 0xfc9cf260
-0, 69300, 7193, 0x170a0fa1
-0, 70200, 9444, 0x6f9be36f
-0, 71100, 12598, 0x69b7609d
-0, 72000, 7650, 0x1abaec9e
-0, 72900, 15162, 0x2a87f723
-0, 73800, 7752, 0xcca248aa
-0, 74700, 9085, 0x1ca7d7e5
-0, 75600, 13187, 0xababcc64
-0, 76500, 7968, 0x64a28f46
-0, 77400, 15474, 0xf34c587c
-0, 78300, 8615, 0x61301034
-0, 79200, 14129, 0x42c88bea
-0, 80100, 7223, 0x675d7500
-0, 81000, 3072, 0x4cb6254c
+#tb 0: 1/100
+0, 0, -9223372036854775808, 1, 19787, 0x75e463f3
+0, 1, -9223372036854775808, 1, 11913, 0x0f429c34
+0, 2, -9223372036854775808, 1, 14225, 0xbd3c704c
+0, 3, -9223372036854775808, 1, 10357, 0xbf232393
+0, 4, -9223372036854775808, 1, 9595, 0xf565d39e
+0, 5, -9223372036854775808, 1, 9262, 0x2afd6ce0
+0, 6, -9223372036854775808, 1, 12214, 0x6ae81d9b
+0, 7, -9223372036854775808, 1, 13920, 0x31b5b307
+0, 8, -9223372036854775808, 1, 10164, 0x141eca4e
+0, 9, -9223372036854775808, 1, 9516, 0xd5f2c42b
+0, 10, -9223372036854775808, 1, 10006, 0x80850a76
+0, 11, -9223372036854775808, 1, 11791, 0x10bc2dcd
+0, 12, -9223372036854775808, 1, 13756, 0xda1fee08
+0, 13, -9223372036854775808, 1, 10452, 0xbb3d62b0
+0, 14, -9223372036854775808, 1, 9171, 0x64ae10f6
+0, 15, -9223372036854775808, 1, 8816, 0x31ad8fcb
+0, 16, -9223372036854775808, 1, 13168, 0xea1085ac
+0, 17, -9223372036854775808, 1, 12797, 0x25143d22
+0, 18, -9223372036854775808, 1, 11324, 0x3a54b38e
+0, 19, -9223372036854775808, 1, 9173, 0x8b2bf552
+0, 20, -9223372036854775808, 1, 9247, 0x2e87226b
+0, 21, -9223372036854775808, 1, 14140, 0x1063786c
+0, 22, -9223372036854775808, 1, 14437, 0xde123a17
+0, 23, -9223372036854775808, 1, 11938, 0x3f1168f4
+0, 24, -9223372036854775808, 1, 11966, 0xdd6786ec
+0, 25, -9223372036854775808, 1, 13213, 0x8ab27c58
+0, 26, -9223372036854775808, 1, 11843, 0x90415d8b
+0, 27, -9223372036854775808, 1, 13345, 0x3c0e1793
+0, 28, -9223372036854775808, 1, 9977, 0x74fc7f4b
+0, 29, -9223372036854775808, 1, 9158, 0x0b5426a5
+0, 30, -9223372036854775808, 1, 12715, 0x0035d569
+0, 31, -9223372036854775808, 1, 19944, 0xe2887ba8
+0, 32, -9223372036854775808, 1, 12762, 0xb0f17939
+0, 33, -9223372036854775808, 1, 10260, 0x182b27aa
+0, 34, -9223372036854775808, 1, 7405, 0x227fe9bf
+0, 35, -9223372036854775808, 1, 13317, 0x1a678c62
+0, 36, -9223372036854775808, 1, 11304, 0x3277af6d
+0, 37, -9223372036854775808, 1, 13291, 0xe267616a
+0, 38, -9223372036854775808, 1, 8975, 0xe7eeacea
+0, 39, -9223372036854775808, 1, 8473, 0x8bb1cbff
+0, 40, -9223372036854775808, 1, 13878, 0xfd3d55bb
+0, 41, -9223372036854775808, 1, 11278, 0x61c7c55e
+0, 42, -9223372036854775808, 1, 13785, 0x2acbf88f
+0, 43, -9223372036854775808, 1, 9521, 0x99e2d065
+0, 44, -9223372036854775808, 1, 9340, 0xe5c96510
+0, 45, -9223372036854775808, 1, 12777, 0x4c3c7844
+0, 46, -9223372036854775808, 1, 10685, 0x39e0f42e
+0, 47, -9223372036854775808, 1, 14237, 0x9398d07f
+0, 48, -9223372036854775808, 1, 9021, 0x3343c7ec
+0, 49, -9223372036854775808, 1, 9327, 0xad489e86
+0, 50, -9223372036854775808, 1, 13507, 0xb1344f1c
+0, 51, -9223372036854775808, 1, 10199, 0x9a8868bf
+0, 52, -9223372036854775808, 1, 14535, 0xddb13f41
+0, 53, -9223372036854775808, 1, 8773, 0x3d8b6a79
+0, 54, -9223372036854775808, 1, 16084, 0x5d915de4
+0, 55, -9223372036854775808, 1, 9156, 0x5cb08a6a
+0, 56, -9223372036854775808, 1, 15027, 0xc23b1dc8
+0, 57, -9223372036854775808, 1, 8240, 0xd6d3526c
+0, 58, -9223372036854775808, 1, 8720, 0x439c43bf
+0, 59, -9223372036854775808, 1, 13684, 0x18fc82f0
+0, 60, -9223372036854775808, 1, 8829, 0xa3ebeb30
+0, 61, -9223372036854775808, 1, 14650, 0x99e8678c
+0, 62, -9223372036854775808, 1, 19626, 0x80a7ee5c
+0, 63, -9223372036854775808, 1, 7762, 0x7c209a12
+0, 64, -9223372036854775808, 1, 13636, 0xc89c1aa3
+0, 65, -9223372036854775808, 1, 8337, 0x749bf76a
+0, 66, -9223372036854775808, 1, 15098, 0xc98bc6dc
+0, 67, -9223372036854775808, 1, 9070, 0xcd4cf7f1
+0, 68, -9223372036854775808, 1, 8269, 0x90e95d54
+0, 69, -9223372036854775808, 1, 12672, 0x034888d0
+0, 70, -9223372036854775808, 1, 7519, 0x6c089672
+0, 71, -9223372036854775808, 1, 14439, 0x5d2478b9
+0, 72, -9223372036854775808, 1, 6928, 0x98fbaa67
+0, 73, -9223372036854775808, 1, 8735, 0x07643f1e
+0, 74, -9223372036854775808, 1, 13522, 0x55034cdb
+0, 75, -9223372036854775808, 1, 7807, 0xf5983103
+0, 76, -9223372036854775808, 1, 14484, 0xfc9cf260
+0, 77, -9223372036854775808, 1, 7193, 0x170a0fa1
+0, 78, -9223372036854775808, 1, 9444, 0x6f9be36f
+0, 79, -9223372036854775808, 1, 12598, 0x69b7609d
+0, 80, -9223372036854775808, 1, 7650, 0x1abaec9e
+0, 81, -9223372036854775808, 1, 15162, 0x2a87f723
+0, 82, -9223372036854775808, 1, 7752, 0xcca248aa
+0, 83, -9223372036854775808, 1, 9085, 0x1ca7d7e5
+0, 84, -9223372036854775808, 1, 13187, 0xababcc64
+0, 85, -9223372036854775808, 1, 7968, 0x64a28f46
+0, 86, -9223372036854775808, 1, 15474, 0xf34c587c
+0, 87, -9223372036854775808, 1, 8615, 0x61301034
+0, 88, -9223372036854775808, 1, 14129, 0x42c88bea
+0, 89, -9223372036854775808, 1, 7223, 0x675d7500
+0, 90, -9223372036854775808, 1, 3072, 0x4cb6254c
diff --git a/gst-libs/ext/libav/tests/ref/fate/nsv-demux b/gst-libs/ext/libav/tests/ref/fate/nsv-demux
index 620dfa0..0f09446 100644
--- a/gst-libs/ext/libav/tests/ref/fate/nsv-demux
+++ b/gst-libs/ext/libav/tests/ref/fate/nsv-demux
@@ -1,171 +1,173 @@
-0, 0, 12, 0x1396035f
-0, 6006, 24, 0x8ab80ac7
-0, 12012, 208, 0x1de1603e
-1, 12522, 104, 0x8ae85dc9
-1, 17224, 105, 0xb7033847
-0, 18018, 364, 0xffb4b341
-1, 21926, 104, 0x5f853482
-0, 24024, 456, 0x7a4deaeb
-1, 26628, 105, 0xfcb731fd
-0, 30030, 432, 0xf4ddd813
-1, 31330, 104, 0x4f8232bb
-1, 36032, 105, 0x2f543039
-0, 36036, 572, 0xc84c21ff
-1, 40734, 104, 0xe4cc34a1
-0, 42042, 500, 0x0e6bf9f4
-1, 45436, 105, 0xea663711
-0, 48048, 508, 0x2d6efe2a
-1, 50138, 104, 0x3c583098
-0, 54054, 436, 0x7d07d3c5
-1, 54840, 105, 0xbe6c33ff
-1, 59542, 104, 0x56de2d7a
-0, 60060, 620, 0xa9313342
-1, 64244, 105, 0x4e80385d
-0, 66066, 1384, 0x9b97c579
-1, 68946, 104, 0x34eb340d
-0, 72072, 760, 0xd1aa8183
-1, 73648, 105, 0x87e82f74
-0, 78078, 836, 0x261da980
-1, 78350, 104, 0xa546377d
-1, 83052, 105, 0x92bd349d
-0, 84084, 860, 0x52f0afa0
-1, 87754, 104, 0xdba53f3d
-0, 90090, 696, 0x63845855
-1, 92456, 105, 0xd3c3384e
-0, 96096, 460, 0x2916e7be
-1, 97158, 104, 0xdf7d30ce
-1, 101860, 105, 0xae20344e
-0, 102102, 328, 0xab8caaca
-1, 106562, 104, 0xe4cc33b7
-0, 108108, 396, 0xc775bc8e
-1, 111264, 105, 0xda993806
-0, 114114, 344, 0x114ea25a
-1, 115966, 104, 0xd6d12edd
-1, 120668, 105, 0x6b9c2ed5
-1, 125370, 104, 0xce6c3b04
-0, 126126, 532, 0xd5650f54
-1, 130072, 105, 0x31db399e
-1, 134775, 104, 0xd50b347a
-0, 138138, 476, 0x77f1f3a7
-1, 139477, 105, 0xe87734d6
-1, 144179, 104, 0x21873412
-0, 150150, 976, 0x2f7cf7ae
-1, 150420, 105, 0x29c03514
-1, 155122, 104, 0x91a5347a
-1, 159824, 105, 0xdbbf3696
-0, 162162, 104, 0x8fbf2f65
-1, 164526, 104, 0x3b463afc
-1, 169228, 105, 0xddf53845
-1, 173930, 104, 0x94c23d1a
-0, 174174, 652, 0xa9244ac0
-1, 178632, 105, 0xc0fd36c4
-1, 183334, 104, 0x36d535e0
-0, 186186, 152, 0x97804cc1
-1, 188036, 105, 0xe81a35da
-1, 192738, 104, 0x2b4e3699
-1, 197440, 105, 0x3978392c
-0, 198198, 156, 0xca434d31
-1, 202142, 104, 0xca903459
-0, 204204, 196, 0x1ff16161
-1, 206844, 105, 0xedc4374a
-0, 210210, 176, 0x9b455230
-1, 211546, 104, 0x0b3938d2
-0, 216216, 156, 0xbbbf4bf3
-1, 216249, 105, 0xb2653246
-1, 220951, 104, 0x76333479
-0, 222222, 220, 0x77a97152
-1, 225653, 105, 0x779138c4
-0, 228228, 204, 0x667d5ecf
-1, 230355, 104, 0xfe142f55
-0, 234234, 232, 0x3a266ccd
-1, 235057, 105, 0x39aa3410
-1, 239759, 104, 0x520f330d
-0, 240240, 308, 0x844a95b7
-1, 244461, 104, 0x1aad37b0
-0, 246246, 384, 0x71d2c695
-1, 249163, 105, 0x164038eb
-1, 253865, 104, 0x21d434bd
-0, 258258, 520, 0x4f9d012a
-1, 258567, 105, 0x9c1236d4
-1, 263269, 104, 0x6aa933c3
-1, 267971, 105, 0xec5c371e
-0, 270270, 648, 0xabd13b29
-1, 272673, 104, 0xedb33251
-1, 277375, 105, 0x4f953476
-1, 282077, 104, 0x7da13400
-0, 282282, 604, 0x006b328f
-1, 286779, 105, 0x57a83aaa
-1, 291481, 104, 0x8b822f2f
-0, 294294, 492, 0xa150fac1
-1, 296183, 105, 0x3b31341a
-1, 300885, 104, 0x74a4316d
-1, 305587, 105, 0x05013469
-0, 306306, 456, 0xd3e9e52c
-1, 310289, 104, 0xcc8932cb
-1, 314991, 105, 0xd9233422
-0, 318318, 340, 0x7229a1b7
-1, 319693, 104, 0x5c603350
-1, 324395, 105, 0x76e631bc
-1, 329097, 104, 0x657e3b35
-0, 330330, 280, 0x48948b60
-1, 333799, 105, 0x9d283226
-1, 338502, 104, 0x574936ef
-0, 342342, 304, 0x3ae68dcf
-1, 343204, 105, 0x1b923555
-1, 347906, 104, 0x2a9f3583
-1, 352608, 105, 0xb8cd306f
-0, 354354, 324, 0x005da2ab
-1, 357310, 104, 0xa21d3475
-1, 362012, 105, 0x651539ea
-0, 366366, 348, 0x3230a873
-1, 366714, 104, 0x7b7235b8
-1, 371416, 105, 0x2bbb337a
-1, 376118, 104, 0x26c332eb
-0, 378378, 336, 0x8655ad2d
-1, 380820, 105, 0x990838d8
-1, 385522, 104, 0x4dc63ad4
-1, 390224, 105, 0xfb8e3418
-0, 390390, 380, 0x742ebc44
-1, 394926, 104, 0x1882388e
-1, 399628, 105, 0xe6b534cc
-0, 402402, 340, 0xfc1aa74e
-1, 404330, 104, 0x60fe35d0
-1, 409032, 105, 0x5164354a
-1, 413734, 104, 0x92ee3115
-0, 414414, 332, 0x3cfba56c
-1, 418436, 105, 0x9b32327e
-1, 423138, 104, 0x9b9e394a
-0, 426426, 332, 0xc024ad4c
-1, 427840, 105, 0xce3c337f
-1, 432542, 104, 0x7a4e33c5
-0, 438438, 3432, 0xcdfcd1c9
-1, 440868, 105, 0x0e3d34eb
-1, 445570, 104, 0xd23e338e
-1, 450272, 105, 0x4abf340c
-0, 450450, 792, 0xe7df949f
-1, 454974, 104, 0xe7522e15
-1, 459676, 105, 0x995037ba
-0, 462462, 912, 0xbc61d549
-1, 464378, 104, 0x5ef12e9b
-1, 469080, 105, 0x5c3b3166
-1, 473782, 104, 0xfc38314b
-0, 474474, 956, 0x809bdff0
-1, 478484, 104, 0x5e3636e4
-1, 483186, 105, 0xae7b3345
-0, 486486, 652, 0x88d3484f
-1, 487888, 104, 0x635c317a
-1, 492590, 105, 0xa90c361a
-1, 497292, 104, 0x8f563594
-0, 498498, 1284, 0xecc37164
-1, 501468, 105, 0x028e3985
-1, 506170, 104, 0x4fd135f6
-0, 510510, 428, 0x4794e174
-1, 510872, 105, 0xaaf539ac
-1, 515574, 104, 0x668b3265
-1, 520276, 105, 0x74ad3b4b
-0, 522522, 460, 0x7253d94a
-1, 524978, 104, 0xbde5332f
-1, 529680, 105, 0xdc3631e7
-1, 534382, 104, 0x3e363a1e
-0, 534534, 24, 0x664206ba
-1, 539084, 105, 0x48b63926
+#tb 0: 1001/15000
+#tb 1: 1/30000000
+0, 0, 0, 1, 12, 0x1396035f
+0, 1, 1, 1, 24, 0x8ab80ac7
+0, 2, 2, 1, 208, 0x1de1603e
+1, 4173848, 4173848, 1567346, 104, 0x8ae85dc9
+1, 5741194, 5741194, 1567346, 105, 0xb7033847
+0, 3, 3, 1, 364, 0xffb4b341
+1, 7308540, 7308540, 1567346, 104, 0x5f853482
+0, 4, 4, 1, 456, 0x7a4deaeb
+1, 8875886, 8875886, 1567346, 105, 0xfcb731fd
+0, 5, 5, 1, 432, 0xf4ddd813
+1, 10443232, 10443232, 1567346, 104, 0x4f8232bb
+1, 12010578, 12010578, 1567346, 105, 0x2f543039
+0, 6, 6, 1, 572, 0xc84c21ff
+1, 13577924, 13577924, 1567346, 104, 0xe4cc34a1
+0, 7, 7, 1, 500, 0x0e6bf9f4
+1, 15145270, 15145270, 1567346, 105, 0xea663711
+0, 8, 8, 1, 508, 0x2d6efe2a
+1, 16712616, 16712616, 1567346, 104, 0x3c583098
+0, 9, 9, 1, 436, 0x7d07d3c5
+1, 18279962, 18279962, 1567346, 105, 0xbe6c33ff
+1, 19847308, 19847308, 1567346, 104, 0x56de2d7a
+0, 10, 10, 1, 620, 0xa9313342
+1, 21414654, 21414654, 1567346, 105, 0x4e80385d
+0, 11, 11, 1, 1384, 0x9b97c579
+1, 22982000, 22982000, 1567346, 104, 0x34eb340d
+0, 12, 12, 1, 760, 0xd1aa8183
+1, 24549346, 24549346, 1567346, 105, 0x87e82f74
+0, 13, 13, 1, 836, 0x261da980
+1, 26116692, 26116692, 1567346, 104, 0xa546377d
+1, 27684038, 27684038, 1567346, 105, 0x92bd349d
+0, 14, 14, 1, 860, 0x52f0afa0
+1, 29251384, 29251384, 1567346, 104, 0xdba53f3d
+0, 15, 15, 1, 696, 0x63845855
+1, 30818730, 30818730, 1567346, 105, 0xd3c3384e
+0, 16, 16, 1, 460, 0x2916e7be
+1, 32386076, 32386076, 1567346, 104, 0xdf7d30ce
+1, 33953422, 33953422, 1567346, 105, 0xae20344e
+0, 17, 17, 1, 328, 0xab8caaca
+1, 35520768, 35520768, 1567346, 104, 0xe4cc33b7
+0, 18, 18, 1, 396, 0xc775bc8e
+1, 37088114, 37088114, 1567346, 105, 0xda993806
+0, 19, 19, 1, 344, 0x114ea25a
+1, 38655460, 38655460, 1567346, 104, 0xd6d12edd
+1, 40222806, 40222806, 1567346, 105, 0x6b9c2ed5
+1, 41790152, 41790152, 1567346, 104, 0xce6c3b04
+0, 21, 21, 1, 532, 0xd5650f54
+1, 43357498, 43357498, 1567346, 105, 0x31db399e
+1, 44924844, 44924844, 1567346, 104, 0xd50b347a
+0, 23, 23, 1, 476, 0x77f1f3a7
+1, 46492190, 46492190, 1567346, 105, 0xe87734d6
+1, 48059536, 48059536, 1567346, 104, 0x21873412
+0, 25, 25, 1, 976, 0x2f7cf7ae
+1, 50140000, 50140000, 1567346, 105, 0x29c03514
+1, 51707346, 51707346, 1567346, 104, 0x91a5347a
+1, 53274692, 53274692, 1567346, 105, 0xdbbf3696
+0, 27, 27, 1, 104, 0x8fbf2f65
+1, 54842038, 54842038, 1567346, 104, 0x3b463afc
+1, 56409384, 56409384, 1567346, 105, 0xddf53845
+1, 57976730, 57976730, 1567346, 104, 0x94c23d1a
+0, 29, 29, 1, 652, 0xa9244ac0
+1, 59544076, 59544076, 1567346, 105, 0xc0fd36c4
+1, 61111422, 61111422, 1567346, 104, 0x36d535e0
+0, 31, 31, 1, 152, 0x97804cc1
+1, 62678768, 62678768, 1567346, 105, 0xe81a35da
+1, 64246114, 64246114, 1567346, 104, 0x2b4e3699
+1, 65813460, 65813460, 1567346, 105, 0x3978392c
+0, 33, 33, 1, 156, 0xca434d31
+1, 67380806, 67380806, 1567346, 104, 0xca903459
+0, 34, 34, 1, 196, 0x1ff16161
+1, 68948152, 68948152, 1567346, 105, 0xedc4374a
+0, 35, 35, 1, 176, 0x9b455230
+1, 70515498, 70515498, 1567346, 104, 0x0b3938d2
+0, 36, 36, 1, 156, 0xbbbf4bf3
+1, 72082844, 72082844, 1567346, 105, 0xb2653246
+1, 73650190, 73650190, 1567346, 104, 0x76333479
+0, 37, 37, 1, 220, 0x77a97152
+1, 75217536, 75217536, 1567346, 105, 0x779138c4
+0, 38, 38, 1, 204, 0x667d5ecf
+1, 76784882, 76784882, 1567346, 104, 0xfe142f55
+0, 39, 39, 1, 232, 0x3a266ccd
+1, 78352228, 78352228, 1567346, 105, 0x39aa3410
+1, 79919574, 79919574, 1567346, 104, 0x520f330d
+0, 40, 40, 1, 308, 0x844a95b7
+1, 81486920, 81486920, 1567346, 104, 0x1aad37b0
+0, 41, 41, 1, 384, 0x71d2c695
+1, 83054266, 83054266, 1567346, 105, 0x164038eb
+1, 84621612, 84621612, 1567346, 104, 0x21d434bd
+0, 43, 43, 1, 520, 0x4f9d012a
+1, 86188958, 86188958, 1567346, 105, 0x9c1236d4
+1, 87756304, 87756304, 1567346, 104, 0x6aa933c3
+1, 89323650, 89323650, 1567346, 105, 0xec5c371e
+0, 45, 45, 1, 648, 0xabd13b29
+1, 90890996, 90890996, 1567346, 104, 0xedb33251
+1, 92458342, 92458342, 1567346, 105, 0x4f953476
+1, 94025688, 94025688, 1567346, 104, 0x7da13400
+0, 47, 47, 1, 604, 0x006b328f
+1, 95593034, 95593034, 1567346, 105, 0x57a83aaa
+1, 97160380, 97160380, 1567346, 104, 0x8b822f2f
+0, 49, 49, 1, 492, 0xa150fac1
+1, 98727726, 98727726, 1567346, 105, 0x3b31341a
+1, 100295072, 100295072, 1567346, 104, 0x74a4316d
+1, 101862418, 101862418, 1567346, 105, 0x05013469
+0, 51, 51, 1, 456, 0xd3e9e52c
+1, 103429764, 103429764, 1567346, 104, 0xcc8932cb
+1, 104997110, 104997110, 1567346, 105, 0xd9233422
+0, 53, 53, 1, 340, 0x7229a1b7
+1, 106564456, 106564456, 1567346, 104, 0x5c603350
+1, 108131802, 108131802, 1567346, 105, 0x76e631bc
+1, 109699148, 109699148, 1567346, 104, 0x657e3b35
+0, 55, 55, 1, 280, 0x48948b60
+1, 111266494, 111266494, 1567346, 105, 0x9d283226
+1, 112833840, 112833840, 1567346, 104, 0x574936ef
+0, 57, 57, 1, 304, 0x3ae68dcf
+1, 114401186, 114401186, 1567346, 105, 0x1b923555
+1, 115968532, 115968532, 1567346, 104, 0x2a9f3583
+1, 117535878, 117535878, 1567346, 105, 0xb8cd306f
+0, 59, 59, 1, 324, 0x005da2ab
+1, 119103224, 119103224, 1567346, 104, 0xa21d3475
+1, 120670570, 120670570, 1567346, 105, 0x651539ea
+0, 61, 61, 1, 348, 0x3230a873
+1, 122237916, 122237916, 1567346, 104, 0x7b7235b8
+1, 123805262, 123805262, 1567346, 105, 0x2bbb337a
+1, 125372608, 125372608, 1567346, 104, 0x26c332eb
+0, 63, 63, 1, 336, 0x8655ad2d
+1, 126939954, 126939954, 1567346, 105, 0x990838d8
+1, 128507300, 128507300, 1567346, 104, 0x4dc63ad4
+1, 130074646, 130074646, 1567346, 105, 0xfb8e3418
+0, 65, 65, 1, 380, 0x742ebc44
+1, 131641992, 131641992, 1567346, 104, 0x1882388e
+1, 133209338, 133209338, 1567346, 105, 0xe6b534cc
+0, 67, 67, 1, 340, 0xfc1aa74e
+1, 134776684, 134776684, 1567346, 104, 0x60fe35d0
+1, 136344030, 136344030, 1567346, 105, 0x5164354a
+1, 137911376, 137911376, 1567346, 104, 0x92ee3115
+0, 69, 69, 1, 332, 0x3cfba56c
+1, 139478722, 139478722, 1567346, 105, 0x9b32327e
+1, 141046068, 141046068, 1567346, 104, 0x9b9e394a
+0, 71, 71, 1, 332, 0xc024ad4c
+1, 142613414, 142613414, 1567346, 105, 0xce3c337f
+1, 144180760, 144180760, 1567346, 104, 0x7a4e33c5
+0, 73, 73, 1, 3432, 0xcdfcd1c9
+1, 146956000, 146956000, 1567346, 105, 0x0e3d34eb
+1, 148523346, 148523346, 1567346, 104, 0xd23e338e
+1, 150090692, 150090692, 1567346, 105, 0x4abf340c
+0, 75, 75, 1, 792, 0xe7df949f
+1, 151658038, 151658038, 1567346, 104, 0xe7522e15
+1, 153225384, 153225384, 1567346, 105, 0x995037ba
+0, 77, 77, 1, 912, 0xbc61d549
+1, 154792730, 154792730, 1567346, 104, 0x5ef12e9b
+1, 156360076, 156360076, 1567346, 105, 0x5c3b3166
+1, 157927422, 157927422, 1567346, 104, 0xfc38314b
+0, 79, 79, 1, 956, 0x809bdff0
+1, 159494768, 159494768, 1567346, 104, 0x5e3636e4
+1, 161062114, 161062114, 1567346, 105, 0xae7b3345
+0, 81, 81, 1, 652, 0x88d3484f
+1, 162629460, 162629460, 1567346, 104, 0x635c317a
+1, 164196806, 164196806, 1567346, 105, 0xa90c361a
+1, 165764152, 165764152, 1567346, 104, 0x8f563594
+0, 83, 83, 1, 1284, 0xecc37164
+1, 167156000, 167156000, 1567346, 105, 0x028e3985
+1, 168723346, 168723346, 1567346, 104, 0x4fd135f6
+0, 85, 85, 1, 428, 0x4794e174
+1, 170290692, 170290692, 1567346, 105, 0xaaf539ac
+1, 171858038, 171858038, 1567346, 104, 0x668b3265
+1, 173425384, 173425384, 1567346, 105, 0x74ad3b4b
+0, 87, 87, 1, 460, 0x7253d94a
+1, 174992730, 174992730, 1567346, 104, 0xbde5332f
+1, 176560076, 176560076, 1567346, 105, 0xdc3631e7
+1, 178127422, 178127422, 1567346, 104, 0x3e363a1e
+0, 89, 89, 1, 24, 0x664206ba
+1, 179694768, 179694768, 1567346, 105, 0x48b63926
diff --git a/gst-libs/ext/libav/tests/ref/fate/nuv b/gst-libs/ext/libav/tests/ref/fate/nuv
deleted file mode 100644
index f1fcae3..0000000
--- a/gst-libs/ext/libav/tests/ref/fate/nuv
+++ /dev/null
@@ -1,27 +0,0 @@
-0, 0, 460800, 0x54aedafe
-1, 0, 4096, 0x00000000
-1, 2090, 4096, 0x4dfae7a6
-0, 3003, 460800, 0xb7aa8b56
-1, 4180, 4096, 0x3fd9f5c6
-0, 6006, 460800, 0x283ea3b5
-1, 6269, 4096, 0x7b86e310
-1, 8359, 4096, 0x611cece5
-0, 9009, 460800, 0x283ea3b5
-1, 10449, 4096, 0xb7d8e872
-0, 12012, 460800, 0x10e577de
-1, 12539, 4096, 0x072ef72b
-1, 14629, 4096, 0xb3560144
-0, 15015, 460800, 0x4e091ee2
-1, 16718, 4096, 0x0a3d119e
-0, 18018, 460800, 0x2ea88828
-1, 18808, 4096, 0xbe391aa4
-1, 20898, 4096, 0x28f7c6e5
-0, 21021, 460800, 0x4b7f4df0
-1, 22988, 4096, 0xca9d9df2
-0, 24024, 460800, 0xb30eb322
-1, 25078, 4096, 0x5c6b95a9
-1, 27167, 4096, 0x0bdfc0bf
-1, 29257, 4096, 0xd95a9277
-1, 31347, 4096, 0xae2bef2c
-1, 33437, 4096, 0xbf031e83
-1, 35527, 4096, 0x4c83e2d1
diff --git a/gst-libs/ext/libav/tests/ref/fate/nuv-rtjpeg b/gst-libs/ext/libav/tests/ref/fate/nuv-rtjpeg
new file mode 100644
index 0000000..e9286d6
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/nuv-rtjpeg
@@ -0,0 +1,10 @@
+#tb 0: 1/1000
+0, 118, 118, 0, 460800, 0x54aedafe
+0, 152, 152, 0, 460800, 0xb7aa8b56
+0, 177, 177, 0, 460800, 0x283ea3b5
+0, 202, 202, 0, 460800, 0x283ea3b5
+0, 235, 235, 0, 460800, 0x10e577de
+0, 269, 269, 0, 460800, 0x4e091ee2
+0, 302, 302, 0, 460800, 0x2ea88828
+0, 335, 335, 0, 460800, 0x4b7f4df0
+0, 369, 369, 0, 460800, 0xb30eb322
diff --git a/gst-libs/ext/libav/tests/ref/fate/nuv-rtjpeg-fh b/gst-libs/ext/libav/tests/ref/fate/nuv-rtjpeg-fh
new file mode 100644
index 0000000..92aa122
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/nuv-rtjpeg-fh
@@ -0,0 +1,51 @@
+#tb 0: 1/1000
+0, 0, 0, 0, 221184, 0xf48c94f6
+0, 40, 40, 0, 221184, 0x89b625b2
+0, 60, 60, 0, 221184, 0x37e04714
+0, 80, 80, 0, 221184, 0x4f4c5224
+0, 100, 100, 0, 221184, 0x9193c9f1
+0, 120, 120, 0, 221184, 0x5d1a6197
+0, 140, 140, 0, 221184, 0x40cd51e7
+0, 160, 160, 0, 221184, 0xb2c1a729
+0, 200, 200, 0, 221184, 0x998d6144
+0, 220, 220, 0, 221184, 0xf5d52311
+0, 240, 240, 0, 221184, 0xea9dd6bf
+0, 260, 260, 0, 221184, 0x0e2ed854
+0, 280, 280, 0, 221184, 0xe295ba58
+0, 300, 300, 0, 221184, 0x8aedbb69
+0, 320, 320, 0, 221184, 0x253c9aaa
+0, 340, 340, 0, 221184, 0x5eaf9fb1
+0, 360, 360, 0, 221184, 0xcdb5a0cb
+0, 380, 380, 0, 221184, 0xcdb5a0cb
+0, 400, 400, 0, 221184, 0x23f89994
+0, 420, 420, 0, 221184, 0x23f89994
+0, 440, 440, 0, 221184, 0x10dc98d6
+0, 460, 460, 0, 221184, 0x799b9d98
+0, 480, 480, 0, 221184, 0xb226996c
+0, 500, 500, 0, 221184, 0x0ac59a42
+0, 520, 520, 0, 221184, 0x87c2a654
+0, 540, 540, 0, 221184, 0xf4c1a711
+0, 560, 560, 0, 221184, 0xf60fa72e
+0, 580, 580, 0, 221184, 0xc8f8b6fc
+0, 600, 600, 0, 221184, 0xd709b813
+0, 620, 620, 0, 221184, 0x5fdfb76b
+0, 640, 640, 0, 221184, 0x5798b0aa
+0, 660, 660, 0, 221184, 0xf572b1c3
+0, 680, 680, 0, 221184, 0x14b0afdf
+0, 700, 700, 0, 221184, 0x0a66b5b8
+0, 720, 720, 0, 221184, 0xe316c620
+0, 740, 740, 0, 221184, 0xbc76c5c2
+0, 760, 760, 0, 221184, 0x77c7c5e5
+0, 780, 780, 0, 221184, 0xfc7ac63e
+0, 800, 800, 0, 221184, 0x05a29ffe
+0, 820, 820, 0, 221184, 0x9bffbf6c
+0, 840, 840, 0, 221184, 0x3c55be40
+0, 860, 860, 0, 221184, 0x6f46c14e
+0, 880, 880, 0, 221184, 0x9cf4ae70
+0, 900, 900, 0, 221184, 0xf205b2f8
+0, 920, 920, 0, 221184, 0x7180aff8
+0, 940, 940, 0, 221184, 0x125eaffe
+0, 960, 960, 0, 221184, 0x6970a32d
+0, 980, 980, 0, 221184, 0xaea79f62
+0, 1000, 1000, 0, 221184, 0x48d2a093
+0, 1020, 1020, 0, 221184, 0x10a59eb5
diff --git a/gst-libs/ext/libav/tests/ref/fate/parseutils b/gst-libs/ext/libav/tests/ref/fate/parseutils
new file mode 100644
index 0000000..01f6e08
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/parseutils
@@ -0,0 +1,45 @@
+Testing av_parse_video_rate()
+'-inf' -> -1/0 ERROR
+'inf' -> 1/0 ERROR
+'nan' -> 0/0 ERROR
+'123/0' -> 1/0 ERROR
+'-123 / 0' -> -1/0 ERROR
+'' -> 0/0 ERROR
+'/' -> 0/0 ERROR
+' 123 / 321' -> 41/107 OK
+'foo/foo' -> 0/0 ERROR
+'foo/1' -> 0/0 ERROR
+'1/foo' -> 0/0 ERROR
+'0/0' -> 0/0 ERROR
+'/0' -> 0/0 ERROR
+'1/' -> 0/0 ERROR
+'1' -> 1/1 OK
+'0' -> 0/1 ERROR
+'-123/123' -> -1/1 ERROR
+'-foo' -> 0/0 ERROR
+'123.23' -> 12323/100 OK
+'.23' -> 23/100 OK
+'-.23' -> -23/100 ERROR
+'-0.234' -> -117/500 ERROR
+'-0.0000001' -> 0/1 ERROR
+' 21332.2324 ' -> 917286/43 OK
+' -21332.2324 ' -> -917286/43 ERROR
+
+Testing av_parse_color()
+red -> R(255) G(0) B(0) A(255)
+RED -> R(255) G(0) B(0) A(255)
+Violet -> R(238) G(130) B(238) A(255)
+Yellow -> R(255) G(255) B(0) A(255)
+Red -> R(255) G(0) B(0) A(255)
+0x000000 -> R(0) G(0) B(0) A(255)
+0xff000000 -> R(255) G(0) B(0) A(0)
+0x3e34ff -> R(62) G(52) B(255) A(255)
+0x3e34ffaa -> R(62) G(52) B(255) A(170)
+#ff0000 -> R(255) G(0) B(0) A(255)
+ff0000 -> R(255) G(0) B(0) A(255)
+0xff0000@1.0 -> R(255) G(0) B(0) A(255)
+red@0xf -> R(255) G(0) B(0) A(15)
+red@0.1 -> R(255) G(0) B(0) A(25)
+red@0.5 -> R(255) G(0) B(0) A(127)
+red@1.0 -> R(255) G(0) B(0) A(255)
+red@-0.0 -> R(255) G(0) B(0) A(0)
diff --git a/gst-libs/ext/libav/tests/ref/fate/pcm-planar b/gst-libs/ext/libav/tests/ref/fate/pcm-planar
new file mode 100644
index 0000000..91b4a78
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/pcm-planar
@@ -0,0 +1,143 @@
+#tb 0: 1/44100
+0, 0, 0, 1471, 5884, 0x00000000
+0, 1471, 1471, 1471, 5884, 0x00000000
+0, 2942, 2942, 1472, 5888, 0x00000000
+0, 4414, 4414, 1471, 5884, 0x00000000
+0, 5885, 5885, 1472, 5888, 0x00000000
+0, 7357, 7357, 1471, 5884, 0x00000000
+0, 8828, 8828, 1472, 5888, 0x00000000
+0, 10300, 10300, 1471, 5884, 0x00000000
+0, 11771, 11771, 1472, 5888, 0x00000000
+0, 13243, 13243, 1471, 5884, 0x00000000
+0, 14714, 14714, 1472, 5888, 0x174b2bd4
+0, 16186, 16186, 1471, 5884, 0xfab9563d
+0, 17657, 17657, 1472, 5888, 0x0129a4f5
+0, 19129, 19129, 1471, 5884, 0xf12b15dd
+0, 20600, 20600, 1472, 5888, 0x60c8c922
+0, 22072, 22072, 1471, 5884, 0x85693c81
+0, 23543, 23543, 1472, 5888, 0xcefcf0e0
+0, 25015, 25015, 1471, 5884, 0x243974ff
+0, 26486, 26486, 1471, 5884, 0x9101b901
+0, 27957, 27957, 1472, 5888, 0xe3c68cb9
+0, 29429, 29429, 1471, 5884, 0x80f2ff5f
+0, 30900, 30900, 1472, 5888, 0xfc2d19dc
+0, 32372, 32372, 1471, 5884, 0xb6e0af21
+0, 33843, 33843, 1472, 5888, 0x476e74ff
+0, 35315, 35315, 1471, 5884, 0x3921bc7f
+0, 36786, 36786, 1472, 5888, 0x44180a3f
+0, 38258, 38258, 1471, 5884, 0x01b5a119
+0, 39729, 39729, 1472, 5888, 0xdd7ad621
+0, 41201, 41201, 1471, 5884, 0xadabe898
+0, 42672, 42672, 1472, 5888, 0x2141ff8e
+0, 44144, 44144, 1471, 5884, 0xfb5118fb
+0, 45615, 45615, 1472, 5888, 0x06d31461
+0, 47087, 47087, 1471, 5884, 0x80ce34c1
+0, 48558, 48558, 1472, 5888, 0x72bf392f
+0, 50030, 50030, 1471, 5884, 0x9d9237cf
+0, 51501, 51501, 1471, 5884, 0xf5c9ce23
+0, 52972, 52972, 1472, 5888, 0x12a05dc5
+0, 54444, 54444, 1471, 5884, 0xd3ed5d4b
+0, 55915, 55915, 1472, 5888, 0x06557401
+0, 57387, 57387, 1471, 5884, 0x53d81662
+0, 58858, 58858, 1472, 5888, 0xd7e0d98d
+0, 60330, 60330, 1471, 5884, 0xdf00752e
+0, 61801, 61801, 1472, 5888, 0x82f1d7a9
+0, 63273, 63273, 1471, 5884, 0x9cb3aba9
+0, 64744, 64744, 1472, 5888, 0xd6f98e91
+0, 66216, 66216, 1471, 5884, 0xaa7f7c09
+0, 67687, 67687, 1472, 5888, 0xb97a82a7
+0, 69159, 69159, 1471, 5884, 0x375a3d53
+0, 70630, 70630, 1472, 5888, 0xa0a460cb
+0, 72102, 72102, 1471, 5884, 0xe05efbab
+0, 73573, 73573, 1472, 5888, 0x95e151f0
+0, 75045, 75045, 1471, 5884, 0x44ac688d
+0, 76516, 76516, 1471, 5884, 0xfc6d929f
+0, 77987, 77987, 1472, 5888, 0x6406c5f1
+0, 79459, 79459, 1471, 5884, 0x4ee9e48c
+0, 80930, 80930, 1472, 5888, 0xd55d43d0
+0, 82402, 82402, 1471, 5884, 0xcae69baf
+0, 83873, 83873, 1472, 5888, 0x4c01f1f5
+0, 85345, 85345, 1471, 5884, 0xf7d6dab6
+0, 86816, 86816, 1472, 5888, 0x1affdeb5
+0, 88288, 88288, 1471, 5884, 0x6db72487
+0, 89759, 89759, 1472, 5888, 0x4f344e49
+0, 91231, 91231, 1471, 5884, 0x2df3827b
+0, 92702, 92702, 1472, 5888, 0x1d1fc283
+0, 94174, 94174, 1471, 5884, 0x22eb1dd5
+0, 95645, 95645, 1472, 5888, 0x734e7093
+0, 97117, 97117, 1471, 5884, 0x357c9531
+0, 98588, 98588, 1472, 5888, 0x108c102d
+0, 100060, 100060, 1471, 5884, 0x96ad26c6
+0, 101531, 101531, 1472, 5888, 0x7bea1996
+0, 103003, 103003, 1471, 5884, 0x124a1f8e
+0, 104474, 104474, 1471, 5884, 0x08d272fb
+0, 105945, 105945, 1472, 5888, 0x88832c6b
+0, 107417, 107417, 1471, 5884, 0xedf41493
+0, 108888, 108888, 1472, 5888, 0xc4f226d7
+0, 110360, 110360, 1471, 5884, 0x97730397
+0, 111831, 111831, 1472, 5888, 0xbc3540e9
+0, 113303, 113303, 1471, 5884, 0x8adfa135
+0, 114774, 114774, 1472, 5888, 0x6d4be121
+0, 116246, 116246, 1471, 5884, 0xc3daea85
+0, 117717, 117717, 1472, 5888, 0x5498e9f0
+0, 119189, 119189, 1471, 5884, 0xa0eb691f
+0, 120660, 120660, 1472, 5888, 0x775c7c59
+0, 122132, 122132, 1471, 5884, 0x9f108fd1
+0, 123603, 123603, 1472, 5888, 0x72d53062
+0, 125075, 125075, 1471, 5884, 0x13a93faa
+0, 126546, 126546, 1472, 5888, 0x64773c8e
+0, 128018, 128018, 1471, 5884, 0xaf696999
+0, 129489, 129489, 1471, 5884, 0xf45e7e81
+0, 130960, 130960, 1472, 5888, 0x00000000
+0, 132432, 132432, 1471, 5884, 0x00000000
+0, 133903, 133903, 1472, 5888, 0x00000000
+0, 135375, 135375, 1471, 5884, 0x00000000
+0, 136846, 136846, 1472, 5888, 0x00000000
+0, 138318, 138318, 1471, 5884, 0x00000000
+0, 139789, 139789, 1472, 5888, 0x00000000
+0, 141261, 141261, 1471, 5884, 0x00000000
+0, 142732, 142732, 1472, 5888, 0x00000000
+0, 144204, 144204, 1471, 5884, 0x00000000
+0, 145675, 145675, 1472, 5888, 0x00000000
+0, 147147, 147147, 1471, 5884, 0x00000000
+0, 148618, 148618, 1472, 5888, 0x00000000
+0, 150090, 150090, 1471, 5884, 0x00000000
+0, 151561, 151561, 1472, 5888, 0x00000000
+0, 153033, 153033, 1471, 5884, 0x00000000
+0, 154504, 154504, 1471, 5884, 0x00000000
+0, 155975, 155975, 1472, 5888, 0x00000000
+0, 157447, 157447, 1471, 5884, 0x00000000
+0, 158918, 158918, 1472, 5888, 0x00000000
+0, 160390, 160390, 1471, 5884, 0x00000000
+0, 161861, 161861, 1472, 5888, 0x00000000
+0, 163333, 163333, 1471, 5884, 0x00000000
+0, 164804, 164804, 1472, 5888, 0x00000000
+0, 166276, 166276, 1471, 5884, 0x00000000
+0, 167747, 167747, 1472, 5888, 0x00000000
+0, 169219, 169219, 1471, 5884, 0x00000000
+0, 170690, 170690, 1472, 5888, 0x00000000
+0, 172162, 172162, 1471, 5884, 0xfe4b2bd4
+0, 173633, 173633, 1472, 5888, 0x00000000
+0, 175105, 175105, 1471, 5884, 0x00000000
+0, 176576, 176576, 1472, 5888, 0x00000000
+0, 178048, 178048, 1471, 5884, 0x00000000
+0, 179519, 179519, 1471, 5884, 0x00000000
+0, 180990, 180990, 1472, 5888, 0x00000000
+0, 182462, 182462, 1471, 5884, 0x00000000
+0, 183933, 183933, 1472, 5888, 0x00000000
+0, 185405, 185405, 1471, 5884, 0x00000000
+0, 186876, 186876, 1472, 5888, 0x00000000
+0, 188348, 188348, 1471, 5884, 0x00000000
+0, 189819, 189819, 1472, 5888, 0x00000000
+0, 191291, 191291, 1471, 5884, 0x00000000
+0, 192762, 192762, 1472, 5888, 0x00000000
+0, 194234, 194234, 1471, 5884, 0x00000000
+0, 195705, 195705, 1472, 5888, 0x00000000
+0, 197177, 197177, 1471, 5884, 0x00000000
+0, 198648, 198648, 1472, 5888, 0x00000000
+0, 200120, 200120, 1471, 5884, 0x00000000
+0, 201591, 201591, 1472, 5888, 0x00000000
+0, 203063, 203063, 1471, 5884, 0x00000000
+0, 204534, 204534, 1472, 5888, 0x00000000
+0, 206006, 206006, 1471, 5884, 0x00000000
+0, 207477, 207477, 1262, 5048, 0x00000000
diff --git a/gst-libs/ext/libav/tests/ref/fate/pcm_dvd b/gst-libs/ext/libav/tests/ref/fate/pcm_dvd
index 475fce4..6037451 100644
--- a/gst-libs/ext/libav/tests/ref/fate/pcm_dvd
+++ b/gst-libs/ext/libav/tests/ref/fate/pcm_dvd
@@ -1,123 +1,124 @@
-0, 0, 1336, 0x8e3c0abc
-0, 626, 1336, 0x99c41108
-0, 1253, 1336, 0xd65be322
-0, 1879, 1336, 0x15b575fb
-0, 2505, 1336, 0x366f742a
-0, 3131, 1336, 0xed72ad83
-0, 3758, 1336, 0x73f21c93
-0, 4384, 1336, 0x4be7a770
-0, 5010, 1336, 0x69ecf80c
-0, 5636, 1336, 0x835dc0e5
-0, 6263, 1336, 0x3089458d
-0, 6889, 1336, 0xc73b8cdc
-0, 7515, 1336, 0xc1cdaa8f
-0, 8141, 1336, 0x47a49186
-0, 8768, 1336, 0x2db387e2
-0, 9394, 1336, 0x90da9a97
-0, 10020, 1336, 0xcd34a467
-0, 10646, 1336, 0xdca8bd29
-0, 11273, 1336, 0xa09f9da3
-0, 11899, 1336, 0x47c8acf6
-0, 12525, 1336, 0x94dfa20e
-0, 13151, 1336, 0x2123a5f6
-0, 13778, 1336, 0x2f1badde
-0, 14404, 1336, 0x47579528
-0, 15030, 1336, 0x028daa10
-0, 15656, 1336, 0x5ed7adcd
-0, 16283, 1336, 0xc5ee8f10
-0, 16909, 1336, 0xcfacb489
-0, 17535, 1336, 0x07de937b
-0, 18161, 1336, 0x07bd8f8b
-0, 18788, 1336, 0x4660912e
-0, 19414, 1336, 0x047f97ad
-0, 20040, 1336, 0xe0e8a11f
-0, 20666, 1336, 0xcd9898e6
-0, 21293, 1336, 0xccfda786
-0, 21919, 1336, 0xab1b9e40
-0, 22545, 1336, 0x2ea79ea1
-0, 23171, 1336, 0xade2ad7e
-0, 23798, 1336, 0xe5cf9684
-0, 24424, 1336, 0xb57184cf
-0, 25050, 1336, 0x0668a5ce
-0, 25676, 1336, 0x643a9d96
-0, 26303, 1336, 0x97dc8ecc
-0, 26929, 1336, 0x72c2b174
-0, 27555, 1336, 0xe39d8fc3
-0, 28181, 1336, 0x56fc76d2
-0, 28808, 1336, 0x91a884b3
-0, 29434, 1336, 0x7b039a4e
-0, 30060, 1336, 0x3770a9dd
-0, 30686, 1336, 0x317c9cb8
-0, 31313, 1336, 0xdd97ad48
-0, 31939, 1336, 0x98066c1b
-0, 32565, 1336, 0xecd3a31c
-0, 33191, 1336, 0x0578b329
-0, 33818, 1336, 0x6942881c
-0, 34444, 1336, 0x56b5af29
-0, 35070, 1336, 0xf111a48a
-0, 35696, 1336, 0x1f5a8d45
-0, 36323, 1336, 0x39abdded
-0, 36949, 1336, 0xdb997fe8
-0, 37575, 1336, 0xd7f0d0b2
-0, 38201, 1336, 0xf3219413
-0, 38828, 1336, 0x9d80899d
-0, 39454, 1336, 0x7238bd63
-0, 40080, 1336, 0x7376703e
-0, 40706, 1336, 0x0fd56d02
-0, 41333, 1336, 0xa6c0951e
-0, 41959, 1336, 0xfacb674e
-0, 42585, 1336, 0x805bd289
-0, 43211, 1336, 0xa2a51a12
-0, 43838, 1336, 0x8a75d91b
-0, 44464, 1336, 0x34b1ef80
-0, 45090, 1336, 0x902921e0
-0, 45716, 1336, 0xc2db7895
-0, 46343, 1336, 0x7a0db9e1
-0, 46969, 1336, 0x66a93277
-0, 47595, 1336, 0x30830a83
-0, 48221, 1336, 0x251cf132
-0, 48848, 1336, 0x08dd852c
-0, 49474, 1336, 0x22ea164c
-0, 50100, 1336, 0x3bdd91c4
-0, 50726, 1336, 0xa4c0fbd7
-0, 51353, 1336, 0x83aa81bd
-0, 51979, 1336, 0x8a7b0fdb
-0, 52605, 1336, 0x35c37b01
-0, 53231, 1336, 0xdede811e
-0, 53858, 1336, 0x7473a657
-0, 54484, 1336, 0x5b917e2b
-0, 55110, 1336, 0x1c5a7cfc
-0, 55736, 1336, 0xeb7bab0d
-0, 56363, 1336, 0x7337795c
-0, 56989, 1336, 0x68da9d08
-0, 57615, 1336, 0xe93b87fe
-0, 58241, 1336, 0xd4639f00
-0, 58868, 1336, 0x1070a91d
-0, 59494, 1336, 0x50e3788f
-0, 60120, 1336, 0x1dac6691
-0, 60746, 1336, 0xf62c709d
-0, 61373, 1336, 0x2369648d
-0, 61999, 1336, 0xbfc792e6
-0, 62625, 1336, 0x975eb8e3
-0, 63251, 1336, 0x35c49ba6
-0, 63878, 1336, 0xe6198aa9
-0, 64504, 1336, 0x99f37d9d
-0, 65130, 1336, 0x4815aff1
-0, 65756, 1336, 0x4fd366ca
-0, 66383, 1336, 0x43cf7bb4
-0, 67009, 1336, 0x14a576ac
-0, 67635, 1336, 0xc6986978
-0, 68261, 1336, 0x10f67dc4
-0, 68888, 1336, 0xcca07f7a
-0, 69514, 1336, 0x6d0a5dfe
-0, 70140, 1336, 0x4e0761ef
-0, 70766, 1336, 0x31368e66
-0, 71393, 1336, 0x14b895c1
-0, 72019, 1336, 0x4bb7c111
-0, 72645, 1336, 0x1676a8bb
-0, 73271, 1336, 0xddaaa459
-0, 73898, 1336, 0xc43eabce
-0, 74524, 1336, 0x4d9f8d54
-0, 75150, 1336, 0x0ac292cb
-0, 75776, 1336, 0x2d9c74e4
-0, 76403, 1336, 0xe73da38f
+#tb 0: 1/48000
+0, 0, 0, 334, 1336, 0x8e3c0abc
+0, 400, 400, 334, 1336, 0x99c41108
+0, 720, 720, 334, 1336, 0xd65be322
+0, 1040, 1040, 334, 1336, 0x15b575fb
+0, 1360, 1360, 334, 1336, 0x366f742a
+0, 1680, 1680, 334, 1336, 0xed72ad83
+0, 2000, 2000, 334, 1336, 0x73f21c93
+0, 2400, 2400, 334, 1336, 0x4be7a770
+0, 2720, 2720, 334, 1336, 0x69ecf80c
+0, 3040, 3040, 334, 1336, 0x835dc0e5
+0, 3360, 3360, 334, 1336, 0x3089458d
+0, 3680, 3680, 334, 1336, 0xc73b8cdc
+0, 4080, 4080, 334, 1336, 0xc1cdaa8f
+0, 4400, 4400, 334, 1336, 0x47a49186
+0, 4720, 4720, 334, 1336, 0x2db387e2
+0, 5040, 5040, 334, 1336, 0x90da9a97
+0, 5360, 5360, 334, 1336, 0xcd34a467
+0, 5680, 5680, 334, 1336, 0xdca8bd29
+0, 6080, 6080, 334, 1336, 0xa09f9da3
+0, 6400, 6400, 334, 1336, 0x47c8acf6
+0, 6720, 6720, 334, 1336, 0x94dfa20e
+0, 7040, 7040, 334, 1336, 0x2123a5f6
+0, 7360, 7360, 334, 1336, 0x2f1badde
+0, 7680, 7680, 334, 1336, 0x47579528
+0, 8080, 8080, 334, 1336, 0x028daa10
+0, 8400, 8400, 334, 1336, 0x5ed7adcd
+0, 8720, 8720, 334, 1336, 0xc5ee8f10
+0, 9040, 9040, 334, 1336, 0xcfacb489
+0, 9360, 9360, 334, 1336, 0x07de937b
+0, 9760, 9760, 334, 1336, 0x07bd8f8b
+0, 10080, 10080, 334, 1336, 0x4660912e
+0, 10400, 10400, 334, 1336, 0x047f97ad
+0, 10720, 10720, 334, 1336, 0xe0e8a11f
+0, 11040, 11040, 334, 1336, 0xcd9898e6
+0, 11360, 11360, 334, 1336, 0xccfda786
+0, 11760, 11760, 334, 1336, 0xab1b9e40
+0, 12080, 12080, 334, 1336, 0x2ea79ea1
+0, 12400, 12400, 334, 1336, 0xade2ad7e
+0, 12720, 12720, 334, 1336, 0xe5cf9684
+0, 13040, 13040, 334, 1336, 0xb57184cf
+0, 13360, 13360, 334, 1336, 0x0668a5ce
+0, 13760, 13760, 334, 1336, 0x643a9d96
+0, 14080, 14080, 334, 1336, 0x97dc8ecc
+0, 14400, 14400, 334, 1336, 0x72c2b174
+0, 14720, 14720, 334, 1336, 0xe39d8fc3
+0, 15040, 15040, 334, 1336, 0x56fc76d2
+0, 15360, 15360, 334, 1336, 0x91a884b3
+0, 15760, 15760, 334, 1336, 0x7b039a4e
+0, 16080, 16080, 334, 1336, 0x3770a9dd
+0, 16400, 16400, 334, 1336, 0x317c9cb8
+0, 16720, 16720, 334, 1336, 0xdd97ad48
+0, 17040, 17040, 334, 1336, 0x98066c1b
+0, 17440, 17440, 334, 1336, 0xecd3a31c
+0, 17760, 17760, 334, 1336, 0x0578b329
+0, 18080, 18080, 334, 1336, 0x6942881c
+0, 18400, 18400, 334, 1336, 0x56b5af29
+0, 18720, 18720, 334, 1336, 0xf111a48a
+0, 19040, 19040, 334, 1336, 0x1f5a8d45
+0, 19440, 19440, 334, 1336, 0x39abdded
+0, 19760, 19760, 334, 1336, 0xdb997fe8
+0, 20080, 20080, 334, 1336, 0xd7f0d0b2
+0, 20400, 20400, 334, 1336, 0xf3219413
+0, 20720, 20720, 334, 1336, 0x9d80899d
+0, 21040, 21040, 334, 1336, 0x7238bd63
+0, 21440, 21440, 334, 1336, 0x7376703e
+0, 21760, 21760, 334, 1336, 0x0fd56d02
+0, 22080, 22080, 334, 1336, 0xa6c0951e
+0, 22400, 22400, 334, 1336, 0xfacb674e
+0, 22720, 22720, 334, 1336, 0x805bd289
+0, 23120, 23120, 334, 1336, 0xa2a51a12
+0, 23440, 23440, 334, 1336, 0x8a75d91b
+0, 23760, 23760, 334, 1336, 0x34b1ef80
+0, 24080, 24080, 334, 1336, 0x902921e0
+0, 24400, 24400, 334, 1336, 0xc2db7895
+0, 24720, 24720, 334, 1336, 0x7a0db9e1
+0, 25120, 25120, 334, 1336, 0x66a93277
+0, 25440, 25440, 334, 1336, 0x30830a83
+0, 25760, 25760, 334, 1336, 0x251cf132
+0, 26080, 26080, 334, 1336, 0x08dd852c
+0, 26400, 26400, 334, 1336, 0x22ea164c
+0, 26720, 26720, 334, 1336, 0x3bdd91c4
+0, 27120, 27120, 334, 1336, 0xa4c0fbd7
+0, 27440, 27440, 334, 1336, 0x83aa81bd
+0, 27760, 27760, 334, 1336, 0x8a7b0fdb
+0, 28080, 28080, 334, 1336, 0x35c37b01
+0, 28400, 28400, 334, 1336, 0xdede811e
+0, 28720, 28720, 334, 1336, 0x7473a657
+0, 29120, 29120, 334, 1336, 0x5b917e2b
+0, 29440, 29440, 334, 1336, 0x1c5a7cfc
+0, 29760, 29760, 334, 1336, 0xeb7bab0d
+0, 30080, 30080, 334, 1336, 0x7337795c
+0, 30400, 30400, 334, 1336, 0x68da9d08
+0, 30800, 30800, 334, 1336, 0xe93b87fe
+0, 31120, 31120, 334, 1336, 0xd4639f00
+0, 31440, 31440, 334, 1336, 0x1070a91d
+0, 31760, 31760, 334, 1336, 0x50e3788f
+0, 32080, 32080, 334, 1336, 0x1dac6691
+0, 32400, 32400, 334, 1336, 0xf62c709d
+0, 32800, 32800, 334, 1336, 0x2369648d
+0, 33120, 33120, 334, 1336, 0xbfc792e6
+0, 33440, 33440, 334, 1336, 0x975eb8e3
+0, 33760, 33760, 334, 1336, 0x35c49ba6
+0, 34080, 34080, 334, 1336, 0xe6198aa9
+0, 34400, 34400, 334, 1336, 0x99f37d9d
+0, 34800, 34800, 334, 1336, 0x4815aff1
+0, 35120, 35120, 334, 1336, 0x4fd366ca
+0, 35440, 35440, 334, 1336, 0x43cf7bb4
+0, 35760, 35760, 334, 1336, 0x14a576ac
+0, 36080, 36080, 334, 1336, 0xc6986978
+0, 36480, 36480, 334, 1336, 0x10f67dc4
+0, 36800, 36800, 334, 1336, 0xcca07f7a
+0, 37120, 37120, 334, 1336, 0x6d0a5dfe
+0, 37440, 37440, 334, 1336, 0x4e0761ef
+0, 37760, 37760, 334, 1336, 0x31368e66
+0, 38080, 38080, 334, 1336, 0x14b895c1
+0, 38480, 38480, 334, 1336, 0x4bb7c111
+0, 38800, 38800, 334, 1336, 0x1676a8bb
+0, 39120, 39120, 334, 1336, 0xddaaa459
+0, 39440, 39440, 334, 1336, 0xc43eabce
+0, 39760, 39760, 334, 1336, 0x4d9f8d54
+0, 40080, 40080, 334, 1336, 0x0ac292cb
+0, 40480, 40480, 334, 1336, 0x2d9c74e4
+0, 40800, 40800, 334, 1336, 0xe73da38f
diff --git a/gst-libs/ext/libav/tests/ref/fate/pictor b/gst-libs/ext/libav/tests/ref/fate/pictor
index 3fa0f31..3dc4344 100644
--- a/gst-libs/ext/libav/tests/ref/fate/pictor
+++ b/gst-libs/ext/libav/tests/ref/fate/pictor
@@ -1 +1,2 @@
-0, 0, 192816, 0xf97e2ba1
+#tb 0: 1/25
+0, 0, 0, 1, 192816, 0xf97e2ba1
diff --git a/gst-libs/ext/libav/tests/ref/fate/prores-422 b/gst-libs/ext/libav/tests/ref/fate/prores-422
index 8d6f3ab..379739f 100644
--- a/gst-libs/ext/libav/tests/ref/fate/prores-422
+++ b/gst-libs/ext/libav/tests/ref/fate/prores-422
@@ -1,2 +1,3 @@
-0, 0, 8294400, 0xe8e9d448
-0, 3003, 8294400, 0xe8e9d448
+#tb 0: 1/2997
+0, 0, 0, 0, 8294400, 0xe8e9d448
+0, 100, 100, 0, 8294400, 0xe8e9d448
diff --git a/gst-libs/ext/libav/tests/ref/fate/prores-422_hq b/gst-libs/ext/libav/tests/ref/fate/prores-422_hq
index 8ce6937..dc93c33 100644
--- a/gst-libs/ext/libav/tests/ref/fate/prores-422_hq
+++ b/gst-libs/ext/libav/tests/ref/fate/prores-422_hq
@@ -1,2 +1,3 @@
-0, 0, 8294400, 0x817063b0
-0, 3003, 8294400, 0x817063b0
+#tb 0: 1/2997
+0, 0, 0, 0, 8294400, 0x817063b0
+0, 100, 100, 0, 8294400, 0x817063b0
diff --git a/gst-libs/ext/libav/tests/ref/fate/prores-422_lt b/gst-libs/ext/libav/tests/ref/fate/prores-422_lt
index e9d0437..1c50840 100644
--- a/gst-libs/ext/libav/tests/ref/fate/prores-422_lt
+++ b/gst-libs/ext/libav/tests/ref/fate/prores-422_lt
@@ -1,2 +1,3 @@
-0, 0, 8294400, 0xcd4ccde1
-0, 3003, 8294400, 0xcd4ccde1
+#tb 0: 1/2997
+0, 0, 0, 0, 8294400, 0xcd4ccde1
+0, 100, 100, 0, 8294400, 0xcd4ccde1
diff --git a/gst-libs/ext/libav/tests/ref/fate/prores-422_proxy b/gst-libs/ext/libav/tests/ref/fate/prores-422_proxy
index c9e454f..3763b00 100644
--- a/gst-libs/ext/libav/tests/ref/fate/prores-422_proxy
+++ b/gst-libs/ext/libav/tests/ref/fate/prores-422_proxy
@@ -1,2 +1,3 @@
-0, 0, 8294400, 0x51d29320
-0, 3003, 8294400, 0x51d29320
+#tb 0: 1/2997
+0, 0, 0, 0, 8294400, 0x51d29320
+0, 100, 100, 0, 8294400, 0x51d29320
diff --git a/gst-libs/ext/libav/tests/ref/fate/prores-alpha b/gst-libs/ext/libav/tests/ref/fate/prores-alpha
index 4592652..80442fe 100644
--- a/gst-libs/ext/libav/tests/ref/fate/prores-alpha
+++ b/gst-libs/ext/libav/tests/ref/fate/prores-alpha
@@ -1,2 +1,3 @@
-0, 0, 12441600, 0x9d3dc525
-0, 3003, 12441600, 0x9d3dc525
+#tb 0: 1/2997
+0, 0, 0, 0, 12441600, 0x254d8f95
+0, 100, 100, 0, 12441600, 0x254d8f95
diff --git a/gst-libs/ext/libav/tests/ref/fate/psx-str b/gst-libs/ext/libav/tests/ref/fate/psx-str
deleted file mode 100644
index 3872e28..0000000
--- a/gst-libs/ext/libav/tests/ref/fate/psx-str
+++ /dev/null
@@ -1,200 +0,0 @@
-0, 0, 115200, 0x6b106a56
-1, 0, 8064, 0x02260037
-1, 4800, 8064, 0x4ee9f4e9
-0, 6000, 115200, 0x53c16930
-1, 9600, 8064, 0xf8fd82aa
-0, 12000, 115200, 0xe2126f03
-1, 14400, 8064, 0xc100792b
-0, 18000, 115200, 0xc3c18ba0
-1, 19200, 8064, 0xf11a5316
-0, 24000, 115200, 0xe281b655
-1, 24000, 8064, 0x6937f8c0
-1, 28800, 8064, 0xed194e42
-0, 30000, 115200, 0x7b1e0536
-1, 33600, 8064, 0x619ce54b
-0, 36000, 115200, 0xbbd868c5
-1, 38400, 8064, 0x544999ec
-0, 42000, 115200, 0xfc67bf8e
-1, 43200, 8064, 0x0ea877b4
-0, 48000, 115200, 0xb463151c
-1, 48000, 8064, 0xb764d1c0
-1, 52800, 8064, 0x7a2fd211
-0, 54000, 115200, 0x6e686846
-1, 57600, 8064, 0xff69f6c5
-0, 60000, 115200, 0xca36b835
-1, 62400, 8064, 0x26c11ec7
-0, 66000, 115200, 0x17b91efc
-1, 67200, 8064, 0xfb4ecc0c
-0, 72000, 115200, 0xc051a49a
-1, 72000, 8064, 0x111d799b
-1, 76800, 8064, 0xc704dc91
-0, 78000, 115200, 0xc68c227b
-1, 81600, 8064, 0xa9f372fb
-0, 84000, 115200, 0x9ba6b521
-1, 86400, 8064, 0xa3f0ad0f
-0, 90000, 115200, 0x09d56ecc
-1, 91200, 8064, 0x958719b9
-0, 96000, 115200, 0xc20e3485
-1, 96000, 8064, 0x9b011bf7
-1, 100800, 8064, 0x466d96fb
-0, 102000, 115200, 0xf07e2c48
-1, 105600, 8064, 0x6ed4eb29
-0, 108000, 115200, 0x551c6da1
-1, 110400, 8064, 0x066966db
-0, 114000, 115200, 0xed65bacd
-1, 115200, 8064, 0xf60fe0bc
-0, 120000, 115200, 0x51a23a3b
-1, 120000, 8064, 0x2c845167
-1, 124800, 8064, 0x7d63894f
-0, 126000, 115200, 0x559ddce1
-1, 129600, 8064, 0x0682ee36
-0, 132000, 115200, 0x1fef6373
-1, 134400, 8064, 0xcaeb7c70
-0, 138000, 115200, 0x11b2dece
-1, 139200, 8064, 0x93948697
-0, 144000, 115200, 0x851b877c
-1, 144000, 8064, 0x5805f0d6
-1, 148800, 8064, 0xcfb641ff
-0, 150000, 115200, 0x5f9a7c99
-1, 153600, 8064, 0xe3499bb1
-0, 156000, 115200, 0x9ffe6153
-1, 158400, 8064, 0x689fe483
-0, 162000, 115200, 0x950b0de8
-1, 163200, 8064, 0x1b8f2f2d
-0, 168000, 115200, 0x6ec4c89a
-1, 168000, 8064, 0x23852e71
-1, 172800, 8064, 0x15e7b298
-0, 174000, 115200, 0xa9234812
-1, 177600, 8064, 0x5345a9a3
-0, 180000, 115200, 0xc834f491
-1, 182400, 8064, 0x257b6ecf
-0, 186000, 115200, 0x2cc1a2aa
-1, 187200, 8064, 0xaf62836c
-0, 192000, 115200, 0x5df53b71
-1, 192000, 8064, 0xc3a401e3
-1, 196800, 8064, 0x2b98fdf1
-0, 198000, 115200, 0xe1d0cb31
-1, 201600, 8064, 0x37168697
-0, 204000, 115200, 0xa0d2f8ab
-1, 206400, 8064, 0x2d876c89
-0, 210000, 115200, 0x9342d739
-1, 211200, 8064, 0xc40a6ada
-0, 216000, 115200, 0x586bc658
-1, 216000, 8064, 0xcca6b829
-1, 220800, 8064, 0x6667550a
-0, 222000, 115200, 0x76902834
-1, 225600, 8064, 0x99c1b5cb
-0, 228000, 115200, 0x91f25616
-1, 230400, 8064, 0xc05d3ed3
-0, 234000, 115200, 0xce8c95fb
-1, 235200, 8064, 0xdd641781
-0, 240000, 115200, 0xdf0d3de6
-1, 240000, 8064, 0xa65d49dc
-1, 244800, 8064, 0x2a0d5df7
-0, 246000, 115200, 0x120db7ae
-1, 249600, 8064, 0xa6348438
-0, 252000, 115200, 0x2143e287
-1, 254400, 8064, 0xf2e1412d
-0, 258000, 115200, 0x2498d3b6
-1, 259200, 8064, 0xc41c6a7a
-0, 264000, 115200, 0x99975ff8
-1, 264000, 8064, 0x147edc3d
-1, 268800, 8064, 0x17e3cfe7
-0, 270000, 115200, 0xbad65f9f
-1, 273600, 8064, 0x01fe3969
-0, 276000, 115200, 0x5066605b
-1, 278400, 8064, 0xc437ac11
-0, 282000, 115200, 0x6f8a61a0
-1, 283200, 8064, 0xbbf747c1
-0, 288000, 115200, 0x80c96143
-1, 288000, 8064, 0x2a4b88c0
-1, 292800, 8064, 0xcd149c80
-0, 294000, 115200, 0x663c6198
-1, 297600, 8064, 0xcf339dfc
-0, 300000, 115200, 0x0354620b
-1, 302400, 8064, 0xc81ff84b
-0, 306000, 115200, 0xfe186346
-1, 307200, 8064, 0x4d978100
-0, 312000, 115200, 0x844962f8
-1, 312000, 8064, 0x6da6665b
-1, 316800, 8064, 0x12fa354f
-0, 318000, 115200, 0x917c672f
-1, 321600, 8064, 0x6baedae6
-0, 324000, 115200, 0x45086647
-1, 326400, 8064, 0xddd77327
-0, 330000, 115200, 0xace06816
-1, 331200, 8064, 0x0a31c118
-0, 336000, 115200, 0x4ef26aa2
-1, 336000, 8064, 0x7652ee6e
-1, 340800, 8064, 0x486a24cc
-0, 342000, 115200, 0xf2046bb3
-1, 345600, 8064, 0xf6cf01ee
-0, 348000, 115200, 0x846b6eb0
-1, 350400, 8064, 0x2a19e830
-0, 354000, 115200, 0x8a17716d
-1, 355200, 8064, 0xde675a31
-0, 360000, 115200, 0x36127568
-1, 360000, 8064, 0xeefcc9af
-1, 364800, 8064, 0xaec4c989
-0, 366000, 115200, 0x3e877b5c
-1, 369600, 8064, 0x16b73de9
-0, 372000, 115200, 0xea5681e8
-1, 374400, 8064, 0x188a582a
-0, 378000, 115200, 0x41bc8a39
-1, 379200, 8064, 0xc092e73d
-0, 384000, 115200, 0x6f839446
-1, 384000, 8064, 0xf7ebca97
-1, 388800, 8064, 0x170ce07a
-0, 390000, 115200, 0xef74a005
-1, 393600, 8064, 0xa0705384
-0, 396000, 115200, 0x4354b2c2
-1, 398400, 8064, 0xd0154a3c
-0, 402000, 115200, 0x4607cf99
-1, 403200, 8064, 0x57c73c6c
-0, 408000, 115200, 0x4c18e8db
-1, 408000, 8064, 0x590c9ddb
-1, 412800, 8064, 0x2cbe552f
-0, 414000, 115200, 0x04d71efb
-1, 417600, 8064, 0x0d286932
-0, 420000, 115200, 0x32f4b9ae
-1, 422400, 8064, 0x5931cea3
-0, 426000, 115200, 0x4dd48d01
-1, 427200, 8064, 0xaf0fb80d
-0, 432000, 115200, 0x5fa9627f
-1, 432000, 8064, 0x7fb61e9b
-1, 436800, 8064, 0xf17134bb
-0, 438000, 115200, 0x7a413f88
-1, 441600, 8064, 0xd647859a
-0, 444000, 115200, 0xf1b7e5b6
-1, 446400, 8064, 0x55a60921
-0, 450000, 115200, 0x3d720e05
-1, 451200, 8064, 0x3811fa58
-0, 456000, 115200, 0x49243fd8
-1, 456000, 8064, 0xaceeccea
-1, 460800, 8064, 0x5fcedf14
-0, 462000, 115200, 0x9834b697
-1, 465600, 8064, 0xd8c64abf
-0, 468000, 115200, 0x4b8bc217
-1, 470400, 8064, 0x79495e8d
-0, 474000, 115200, 0x3eaf5504
-1, 475200, 8064, 0x4b7db039
-0, 480000, 115200, 0x057a3701
-1, 480000, 8064, 0x7152f86d
-1, 484800, 8064, 0xd92cfc1a
-0, 486000, 115200, 0x6e88f21a
-1, 489600, 8064, 0x75c540ef
-0, 492000, 115200, 0x236c5226
-1, 494400, 8064, 0x9c03ef5e
-0, 498000, 115200, 0x92212d84
-1, 499200, 8064, 0x7b2911c8
-0, 504000, 115200, 0xf6b0a4ff
-1, 504000, 8064, 0x69d9d553
-1, 508800, 8064, 0xcb45d7c5
-0, 510000, 115200, 0xb49e9b4e
-1, 513600, 8064, 0x37ec8b0a
-0, 516000, 115200, 0x4a252440
-1, 518400, 8064, 0xe4354221
-0, 522000, 115200, 0x65f3339a
-1, 523200, 8064, 0xc0d91cdb
-0, 528000, 115200, 0x38e40a20
-1, 528000, 8064, 0xea0be175
diff --git a/gst-libs/ext/libav/tests/ref/fate/psx-str-demux b/gst-libs/ext/libav/tests/ref/fate/psx-str-demux
new file mode 100644
index 0000000..42c5731
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/psx-str-demux
@@ -0,0 +1,202 @@
+#tb 0: 1/15
+#tb 1: 4/75
+0, 0, 0, 1, 8832, 0x01ad3eeb
+1, 0, 0, 1, 2304, 0xf0ad1000
+1, 1, 1, 1, 2304, 0x69269ce6
+0, 1, 1, 1, 8968, 0xe0033799
+1, 2, 2, 1, 2304, 0x124a995d
+0, 2, 2, 1, 9036, 0xd6189ab7
+1, 3, 3, 1, 2304, 0x3fc0ca07
+0, 3, 3, 1, 9192, 0xb44b9ffa
+1, 4, 4, 1, 2304, 0x40a1b447
+0, 4, 4, 1, 9404, 0xe94dfd40
+1, 5, 5, 1, 2304, 0x150dae9f
+1, 6, 6, 1, 2304, 0xad16bc63
+0, 5, 5, 1, 9492, 0xf73f2541
+1, 7, 7, 1, 2304, 0xe989b175
+0, 6, 6, 1, 9652, 0x243d53f8
+1, 8, 8, 1, 2304, 0x3c77cd39
+0, 7, 7, 1, 9872, 0x83f3ea7a
+1, 9, 9, 1, 2304, 0x93f0c2ba
+0, 8, 8, 1, 10052, 0x7604247a
+1, 10, 10, 1, 2304, 0x6e2ad2d0
+1, 11, 11, 1, 2304, 0xf8eab90a
+0, 9, 9, 1, 10100, 0x077107fd
+1, 12, 12, 1, 2304, 0xc039bf0d
+0, 10, 10, 1, 10264, 0xae675eb6
+1, 13, 13, 1, 2304, 0x0900c7e8
+0, 11, 11, 1, 10464, 0x428f83ae
+1, 14, 14, 1, 2304, 0x9722d580
+0, 12, 12, 1, 10580, 0x1bdcd71b
+1, 15, 15, 1, 2304, 0x02eec8de
+1, 16, 16, 1, 2304, 0x4807a2b3
+0, 13, 13, 1, 10800, 0xde75213a
+1, 17, 17, 1, 2304, 0x4643be06
+0, 14, 14, 1, 11236, 0x9387cc8e
+1, 18, 18, 1, 2304, 0x5bd9d249
+0, 15, 15, 1, 11420, 0x3a7d321b
+1, 19, 19, 1, 2304, 0x4e33c2bc
+0, 16, 16, 1, 11632, 0x7edc9cdf
+1, 20, 20, 1, 2304, 0x085ca51d
+1, 21, 21, 1, 2304, 0xa205b202
+0, 17, 17, 1, 11936, 0xf0521017
+1, 22, 22, 1, 2304, 0x71b9bcca
+0, 18, 18, 1, 11804, 0x53b22066
+1, 23, 23, 1, 2304, 0xcb769e5f
+0, 19, 19, 1, 11852, 0x9425fb21
+1, 24, 24, 1, 2304, 0x9322d85a
+0, 20, 20, 1, 12108, 0xc386941d
+1, 25, 25, 1, 2304, 0x7f13bf6e
+1, 26, 26, 1, 2304, 0xd302a5cd
+0, 21, 21, 1, 12796, 0x8b7e5dab
+1, 27, 27, 1, 2304, 0x7a7a9e30
+0, 22, 22, 1, 13316, 0x81235102
+1, 28, 28, 1, 2304, 0x6ffccfdd
+0, 23, 23, 1, 13724, 0xe5fc2bca
+1, 29, 29, 1, 2304, 0xae88bf7a
+0, 24, 24, 1, 14304, 0xa5b1f811
+1, 30, 30, 1, 2304, 0xf816c2f5
+1, 31, 31, 1, 2304, 0xdb42a783
+0, 25, 25, 1, 15216, 0xf4996763
+1, 32, 32, 1, 2304, 0xfc55c021
+0, 26, 26, 1, 16224, 0xe30b0679
+1, 33, 33, 1, 2304, 0x9da68fc1
+0, 27, 27, 1, 10640, 0xaeb122c9
+1, 34, 34, 1, 2304, 0x2f65bb0f
+0, 28, 28, 1, 11652, 0x087d18b1
+1, 35, 35, 1, 2304, 0x6e5da2c7
+1, 36, 36, 1, 2304, 0xb0b0c5f8
+0, 29, 29, 1, 12008, 0x1eeeac41
+1, 37, 37, 1, 2304, 0x32559dc6
+0, 30, 30, 1, 12344, 0x488c64ec
+1, 38, 38, 1, 2304, 0x9168aed0
+0, 31, 31, 1, 13004, 0x02a69339
+1, 39, 39, 1, 2304, 0x32069bce
+0, 32, 32, 1, 14092, 0x348a7d3f
+1, 40, 40, 1, 2304, 0x763ca8e0
+1, 41, 41, 1, 2304, 0x70c7a44e
+0, 33, 33, 1, 15048, 0xa55ef200
+1, 42, 42, 1, 2304, 0x7dc1b275
+0, 34, 34, 1, 16100, 0xac17de5b
+1, 43, 43, 1, 2304, 0x2e26ceae
+0, 35, 35, 1, 13180, 0x4d874f61
+1, 44, 44, 1, 2304, 0xa071a7e2
+0, 36, 36, 1, 14592, 0x5f58f505
+1, 45, 45, 1, 2304, 0xe434ad92
+1, 46, 46, 1, 2304, 0xb4469381
+0, 37, 37, 1, 14372, 0x369bb5d9
+1, 47, 47, 1, 2304, 0x3f20a7c5
+0, 38, 38, 1, 16172, 0x513a97b6
+1, 48, 48, 1, 2304, 0x68ef9ef9
+0, 39, 39, 1, 15136, 0x7f9a3865
+1, 49, 49, 1, 2304, 0x32dbb3e2
+0, 40, 40, 1, 16336, 0x1339ba5f
+1, 50, 50, 1, 2304, 0xdd90c7c3
+1, 51, 51, 1, 2304, 0xd106adb5
+0, 41, 41, 1, 16944, 0x122f71b7
+1, 52, 52, 1, 2304, 0x11dca8c4
+0, 42, 42, 1, 17536, 0x7461b152
+1, 53, 53, 1, 2304, 0x646d98bc
+0, 43, 43, 1, 13940, 0xf5278274
+1, 54, 54, 1, 2304, 0x6f019e81
+0, 44, 44, 1, 8592, 0x4bb2eaea
+1, 55, 55, 1, 2304, 0xc872a896
+1, 56, 56, 1, 2304, 0xc7d7a0bc
+0, 45, 45, 1, 8584, 0x2ff1e3db
+1, 57, 57, 1, 2304, 0x181b880a
+0, 46, 46, 1, 8548, 0xadfd01b4
+1, 58, 58, 1, 2304, 0x6486b158
+0, 47, 47, 1, 8548, 0x9e2ec85f
+1, 59, 59, 1, 2304, 0x26d5a3db
+0, 48, 48, 1, 8540, 0x9e2ad166
+1, 60, 60, 1, 2304, 0x4ff89a4d
+1, 61, 61, 1, 2304, 0xc42e9552
+0, 49, 49, 1, 8524, 0x047bc406
+1, 62, 62, 1, 2304, 0x0dc1c346
+0, 50, 50, 1, 8508, 0xd051ddbb
+1, 63, 63, 1, 2304, 0x5e51b7a5
+0, 51, 51, 1, 8572, 0x40b5004c
+1, 64, 64, 1, 2304, 0xbd49c142
+0, 52, 52, 1, 8564, 0xb379db59
+1, 65, 65, 1, 2304, 0x373da274
+1, 66, 66, 1, 2304, 0xde97b1bb
+0, 53, 53, 1, 8592, 0x22d0bc35
+1, 67, 67, 1, 2304, 0x9715bf29
+0, 54, 54, 1, 8656, 0xa58917d5
+1, 68, 68, 1, 2304, 0xc341b4ef
+0, 55, 55, 1, 8616, 0xc9e4f431
+1, 69, 69, 1, 2304, 0xc610adc6
+0, 56, 56, 1, 8660, 0x7a90ffd1
+1, 70, 70, 1, 2304, 0x67bba315
+1, 71, 71, 1, 2304, 0x949b9c16
+0, 57, 57, 1, 8636, 0xec8ce437
+1, 72, 72, 1, 2304, 0xc7c1a8ca
+0, 58, 58, 1, 8668, 0x8b73139f
+1, 73, 73, 1, 2304, 0x1929bc7e
+0, 59, 59, 1, 8640, 0x3ee30f9c
+1, 74, 74, 1, 2304, 0x5fc97897
+0, 60, 60, 1, 8728, 0xdbe12a94
+1, 75, 75, 1, 2304, 0x272da8d3
+1, 76, 76, 1, 2304, 0x141e904d
+0, 61, 61, 1, 8748, 0xc4132fd5
+1, 77, 77, 1, 2304, 0x9880b0ed
+0, 62, 62, 1, 8720, 0x7ac9316a
+1, 78, 78, 1, 2304, 0x0438932a
+0, 63, 63, 1, 8756, 0xf47d843d
+1, 79, 79, 1, 2304, 0x27069761
+0, 64, 64, 1, 8840, 0x82808e79
+1, 80, 80, 1, 2304, 0x0baba2b7
+1, 81, 81, 1, 2304, 0x4bc491af
+0, 65, 65, 1, 8908, 0x63568647
+1, 82, 82, 1, 2304, 0x72e18e82
+0, 66, 66, 1, 8968, 0xbd26de31
+1, 83, 83, 1, 2304, 0xf85d8a91
+0, 67, 67, 1, 9168, 0xe1cd43a3
+1, 84, 84, 1, 2304, 0x653582e3
+0, 68, 68, 1, 9272, 0x0cc64c79
+1, 85, 85, 1, 2304, 0x6b5e8084
+1, 86, 86, 1, 2304, 0x8cc27d10
+0, 69, 69, 1, 9700, 0x5cd2be73
+1, 87, 87, 1, 2304, 0xcf8f9e1d
+0, 70, 70, 1, 9868, 0x9b1629ae
+1, 88, 88, 1, 2304, 0xecbe89df
+0, 71, 71, 1, 10264, 0xa13cb7db
+1, 89, 89, 1, 2304, 0xa433753d
+0, 72, 72, 1, 10908, 0xe995858e
+1, 90, 90, 1, 2304, 0xe386afe9
+1, 91, 91, 1, 2304, 0x90409771
+0, 73, 73, 1, 11272, 0xebea53f6
+1, 92, 92, 1, 2304, 0x29c88ae5
+0, 74, 74, 1, 12128, 0xdfa8b7aa
+1, 93, 93, 1, 2304, 0x900b9e6a
+0, 75, 75, 1, 12560, 0x46048576
+1, 94, 94, 1, 2304, 0x958cbb49
+0, 76, 76, 1, 12900, 0x5b3aeb76
+1, 95, 95, 1, 2304, 0xf83da537
+1, 96, 96, 1, 2304, 0x5fad9e5f
+0, 77, 77, 1, 13544, 0x0f98fb94
+1, 97, 97, 1, 2304, 0xae15902a
+0, 78, 78, 1, 13968, 0x7c17c4c2
+1, 98, 98, 1, 2304, 0xf2a8b9d8
+0, 79, 79, 1, 15020, 0xe8faa930
+1, 99, 99, 1, 2304, 0x7bc99f71
+0, 80, 80, 1, 16152, 0x3f004f78
+1, 100, 100, 1, 2304, 0x3f199672
+1, 101, 101, 1, 2304, 0x4e258c38
+0, 81, 81, 1, 17224, 0x103f3935
+1, 102, 102, 1, 2304, 0x5119b909
+0, 82, 82, 1, 11956, 0x7af9354a
+1, 103, 103, 1, 2304, 0xad57a533
+0, 83, 83, 1, 12644, 0xe113a4b2
+1, 104, 104, 1, 2304, 0xe40eb453
+0, 84, 84, 1, 13420, 0xdf3ec8a4
+1, 105, 105, 1, 2304, 0x502cc37e
+1, 106, 106, 1, 2304, 0x5b7bae9a
+0, 85, 85, 1, 14140, 0x0ad8a165
+1, 107, 107, 1, 2304, 0x0458a92d
+0, 86, 86, 1, 15192, 0xc55f45cd
+1, 108, 108, 1, 2304, 0x1529aba8
+0, 87, 87, 1, 12740, 0xa13c85db
+1, 109, 109, 1, 2304, 0x1a52a9d1
+0, 88, 88, 1, 14416, 0x9e68b57d
+1, 110, 110, 1, 2304, 0x76a2a7c9
diff --git a/gst-libs/ext/libav/tests/ref/fate/psx-str-v3-mdec b/gst-libs/ext/libav/tests/ref/fate/psx-str-v3-mdec
deleted file mode 100644
index 52a3835..0000000
--- a/gst-libs/ext/libav/tests/ref/fate/psx-str-v3-mdec
+++ /dev/null
@@ -1,59 +0,0 @@
-0, 0, 76800, 0x2677be82
-0, 6000, 76800, 0x1f323c75
-0, 12000, 76800, 0xc8be3be9
-0, 18000, 76800, 0x1f323c75
-0, 24000, 76800, 0x7e484488
-0, 30000, 76800, 0x8bd644aa
-0, 36000, 76800, 0xaa62e7b8
-0, 42000, 76800, 0xaa62e7b8
-0, 48000, 76800, 0x53fadb39
-0, 54000, 76800, 0x53fadb39
-0, 60000, 76800, 0x1ff9d964
-0, 66000, 76800, 0x1ff9d964
-0, 72000, 76800, 0xd8c8d947
-0, 78000, 76800, 0xd8c8d947
-0, 84000, 76800, 0x6d0bd94c
-0, 90000, 76800, 0x6d0bd94c
-0, 96000, 76800, 0x7e66d948
-0, 102000, 76800, 0x7e66d948
-0, 108000, 76800, 0x8eecfd72
-0, 114000, 76800, 0xb15f29ab
-0, 120000, 76800, 0x08e5502e
-0, 126000, 76800, 0xaa58796d
-0, 132000, 76800, 0xe254a27c
-0, 138000, 76800, 0xeec8cf68
-0, 144000, 76800, 0x812bf8ee
-0, 150000, 76800, 0x929922ef
-0, 156000, 76800, 0xe1174e06
-0, 162000, 76800, 0x2da77bf1
-0, 168000, 76800, 0xd0f6a727
-0, 174000, 76800, 0x31bfd168
-0, 180000, 76800, 0xb87af225
-0, 186000, 76800, 0xd0080859
-0, 192000, 76800, 0x99ab15ba
-0, 198000, 76800, 0x99ab15ba
-0, 204000, 76800, 0x99ab15ba
-0, 210000, 76800, 0x99ab15ba
-0, 216000, 76800, 0x99ab15ba
-0, 222000, 76800, 0x99ab15ba
-0, 228000, 76800, 0x99ab15ba
-0, 234000, 76800, 0x99ab15ba
-0, 240000, 76800, 0x99ab15ba
-0, 246000, 76800, 0x99ab15ba
-0, 252000, 76800, 0x99ab15ba
-0, 258000, 76800, 0x99ab15ba
-0, 264000, 76800, 0x99ab15ba
-0, 270000, 76800, 0x99ab15ba
-0, 276000, 76800, 0x99ab15ba
-0, 282000, 76800, 0x99ab15ba
-0, 288000, 76800, 0x0c1617d5
-0, 294000, 76800, 0xb1c81b5d
-0, 300000, 76800, 0xb4e41e44
-0, 306000, 76800, 0x765725e2
-0, 312000, 76800, 0x25cd3109
-0, 318000, 76800, 0xa42b5291
-0, 324000, 76800, 0x15bb6ee4
-0, 330000, 76800, 0xb33c9f50
-0, 336000, 76800, 0x1ca1b874
-0, 342000, 76800, 0x7506e92a
-0, 348000, 76800, 0x97c9030a
diff --git a/gst-libs/ext/libav/tests/ref/fate/ptx b/gst-libs/ext/libav/tests/ref/fate/ptx
index e1688bb..fad2a50 100644
--- a/gst-libs/ext/libav/tests/ref/fate/ptx
+++ b/gst-libs/ext/libav/tests/ref/fate/ptx
@@ -1 +1,2 @@
-0, 0, 393216, 0xda280efc
+#tb 0: 1/25
+0, 0, 0, 1, 393216, 0xda280efc
diff --git a/gst-libs/ext/libav/tests/ref/fate/pva-demux b/gst-libs/ext/libav/tests/ref/fate/pva-demux
index 511f652..69b1d40 100644
--- a/gst-libs/ext/libav/tests/ref/fate/pva-demux
+++ b/gst-libs/ext/libav/tests/ref/fate/pva-demux
@@ -1,25 +1,26 @@
-1, 0, 384, 0x071abcc8
-1, 0, 384, 0x31c9aee0
-1, 2160, 384, 0xa50eaa94
-1, 4320, 384, 0x9e86ba0e
-1, 8640, 384, 0x2321b800
-1, 10800, 384, 0x2347afa8
-1, 12960, 384, 0x0831b8d3
-1, 15120, 384, 0xd5acafa1
-1, 17280, 384, 0xc975b9d2
-1, 19440, 384, 0x2e10b02a
-1, 21600, 384, 0x501eadd0
-1, 23760, 384, 0x153fc171
-1, 25920, 384, 0xc5f0b3c2
-1, 28080, 384, 0xf731b200
-1, 30240, 384, 0x2e16b713
-1, 32400, 384, 0x61f6bba9
-1, 34560, 384, 0x1b9eb0ff
-1, 36720, 384, 0x2ab4b7bd
-1, 38880, 384, 0xd66eb45c
-1, 41040, 384, 0x145ab426
-1, 43200, 384, 0x297cb370
-1, 45360, 384, 0x287bb6b7
-1, 47520, 384, 0xfddbb7df
-1, 49680, 384, 0xbbb2af0c
-1, 51840, 384, 0x8f03b5fc
+#tb 0: 1/90000
+0, 0, 0, 2160, 384, 0x071abcc8
+0, 2160, 2160, 2160, 384, 0x31c9aee0
+0, 4320, 4320, 2160, 384, 0xa50eaa94
+0, 6480, 6480, 2160, 384, 0x9e86ba0e
+0, 8640, 8640, 2160, 384, 0x2321b800
+0, 10800, 10800, 2160, 384, 0x2347afa8
+0, 12960, 12960, 2160, 384, 0x0831b8d3
+0, 15120, 15120, 2160, 384, 0xd5acafa1
+0, 17280, 17280, 2160, 384, 0xc975b9d2
+0, 19440, 19440, 2160, 384, 0x2e10b02a
+0, 21600, 21600, 2160, 384, 0x501eadd0
+0, 23760, 23760, 2160, 384, 0x153fc171
+0, 25920, 25920, 2160, 384, 0xc5f0b3c2
+0, 28080, 28080, 2160, 384, 0xf731b200
+0, 30240, 30240, 2160, 384, 0x2e16b713
+0, 32400, 32400, 2160, 384, 0x61f6bba9
+0, 34560, 34560, 2160, 384, 0x1b9eb0ff
+0, 36720, 36720, 2160, 384, 0x2ab4b7bd
+0, 38880, 38880, 2160, 384, 0xd66eb45c
+0, 41040, 41040, 2160, 384, 0x145ab426
+0, 43200, 43200, 2160, 384, 0x297cb370
+0, 45360, 45360, 2160, 384, 0x287bb6b7
+0, 47520, 47520, 2160, 384, 0xfddbb7df
+0, 49680, 49680, 2160, 384, 0xbbb2af0c
+0, 51840, 51840, 2160, 384, 0x8f03b5fc
diff --git a/gst-libs/ext/libav/tests/ref/fate/qpeg b/gst-libs/ext/libav/tests/ref/fate/qpeg
index b7d698c..eca2924 100644
--- a/gst-libs/ext/libav/tests/ref/fate/qpeg
+++ b/gst-libs/ext/libav/tests/ref/fate/qpeg
@@ -1,100 +1,101 @@
-0, 0, 230400, 0x0b712fba
-0, 3600, 230400, 0x30252ac7
-0, 7200, 230400, 0x6d98a787
-0, 10800, 230400, 0x5d1f6ce7
-0, 14400, 230400, 0xccb79136
-0, 18000, 230400, 0x394093e1
-0, 21600, 230400, 0x3e76c5e9
-0, 25200, 230400, 0xd6cdc8f1
-0, 28800, 230400, 0xd355371d
-0, 32400, 230400, 0x2c1519ca
-0, 36000, 230400, 0xd82427e1
-0, 39600, 230400, 0x4202e3b4
-0, 43200, 230400, 0x27c15cda
-0, 46800, 230400, 0x3fd7d5db
-0, 50400, 230400, 0x03838791
-0, 54000, 230400, 0x8253d774
-0, 57600, 230400, 0x833e9c9f
-0, 61200, 230400, 0xe30aba05
-0, 64800, 230400, 0x81056b68
-0, 68400, 230400, 0xe6454d37
-0, 72000, 230400, 0x6bb65f77
-0, 75600, 230400, 0x95b652eb
-0, 79200, 230400, 0x4f585a73
-0, 82800, 230400, 0x9bc2c9d8
-0, 86400, 230400, 0x09f00930
-0, 90000, 230400, 0x6be9d11a
-0, 93600, 230400, 0x5cdd4ea5
-0, 97200, 230400, 0x77508d67
-0, 100800, 230400, 0x76b21fdd
-0, 104400, 230400, 0x39e2dddb
-0, 108000, 230400, 0x8b16d389
-0, 111600, 230400, 0xb2b329fb
-0, 115200, 230400, 0x8e998c17
-0, 118800, 230400, 0x3852049f
-0, 122400, 230400, 0x5a7f6302
-0, 126000, 230400, 0xdd7d9d86
-0, 129600, 230400, 0x337298bd
-0, 133200, 230400, 0x2fa38668
-0, 136800, 230400, 0xfc42afcd
-0, 140400, 230400, 0x20ff7b1d
-0, 144000, 230400, 0xa9190f28
-0, 147600, 230400, 0x2ca26827
-0, 151200, 230400, 0x1106bd55
-0, 154800, 230400, 0xb965748e
-0, 158400, 230400, 0x2c2d2691
-0, 162000, 230400, 0x8096db4d
-0, 165600, 230400, 0x7b223871
-0, 169200, 230400, 0xf9edbca9
-0, 172800, 230400, 0x0e607f74
-0, 176400, 230400, 0x3e64ed79
-0, 180000, 230400, 0x2198f77a
-0, 183600, 230400, 0x3cf4925a
-0, 187200, 230400, 0x2de0ebdb
-0, 190800, 230400, 0x5104c55f
-0, 194400, 230400, 0xebd7f8f7
-0, 198000, 230400, 0xfce8a2ae
-0, 201600, 230400, 0xeb073121
-0, 205200, 230400, 0x8f2ed47d
-0, 208800, 230400, 0xdcb72934
-0, 212400, 230400, 0xf69e75a1
-0, 216000, 230400, 0xc45ab599
-0, 219600, 230400, 0x0d218766
-0, 223200, 230400, 0x4a6aafce
-0, 226800, 230400, 0x642153ca
-0, 230400, 230400, 0x8bd7a2a4
-0, 234000, 230400, 0x04abeeed
-0, 237600, 230400, 0x37bf9f2c
-0, 241200, 230400, 0x1d966ae5
-0, 244800, 230400, 0x3a2ef337
-0, 248400, 230400, 0x9edaf34f
-0, 252000, 230400, 0x7f3c0ff8
-0, 255600, 230400, 0x403cbdee
-0, 259200, 230400, 0x86b340e8
-0, 262800, 230400, 0x5a57c916
-0, 266400, 230400, 0x35763ab3
-0, 270000, 230400, 0xd135a1ba
-0, 273600, 230400, 0x56a7b1db
-0, 277200, 230400, 0x6e8d2910
-0, 280800, 230400, 0xc8d9c4e1
-0, 284400, 230400, 0xb61fd11f
-0, 288000, 230400, 0x8949b165
-0, 291600, 230400, 0x60082f69
-0, 295200, 230400, 0xf9c74a14
-0, 298800, 230400, 0x1f0af3f4
-0, 302400, 230400, 0x1abe4a3b
-0, 306000, 230400, 0xdf762ffb
-0, 309600, 230400, 0x38513b73
-0, 313200, 230400, 0xf3b01fcf
-0, 316800, 230400, 0xea7d486c
-0, 320400, 230400, 0xfabc7a89
-0, 324000, 230400, 0xc72f6977
-0, 327600, 230400, 0x1c9e4590
-0, 331200, 230400, 0x51abf71e
-0, 334800, 230400, 0x39c9d819
-0, 338400, 230400, 0xfc62d8e0
-0, 342000, 230400, 0x40bb8c0d
-0, 345600, 230400, 0xa0bd86d2
-0, 349200, 230400, 0x610dfe19
-0, 352800, 230400, 0x997e1572
-0, 356400, 230400, 0x49919319
+#tb 0: 1/25
+0, 0, 0, 1, 230400, 0x0b712fba
+0, 1, 1, 1, 230400, 0x30252ac7
+0, 2, 2, 1, 230400, 0x6d98a787
+0, 3, 3, 1, 230400, 0x5d1f6ce7
+0, 4, 4, 1, 230400, 0xccb79136
+0, 5, 5, 1, 230400, 0x394093e1
+0, 6, 6, 1, 230400, 0x3e76c5e9
+0, 7, 7, 1, 230400, 0xd6cdc8f1
+0, 8, 8, 1, 230400, 0xd355371d
+0, 9, 9, 1, 230400, 0x2c1519ca
+0, 10, 10, 1, 230400, 0xd82427e1
+0, 11, 11, 1, 230400, 0x4202e3b4
+0, 12, 12, 1, 230400, 0x27c15cda
+0, 13, 13, 1, 230400, 0x3fd7d5db
+0, 14, 14, 1, 230400, 0x03838791
+0, 15, 15, 1, 230400, 0x8253d774
+0, 16, 16, 1, 230400, 0x833e9c9f
+0, 17, 17, 1, 230400, 0xe30aba05
+0, 18, 18, 1, 230400, 0x81056b68
+0, 19, 19, 1, 230400, 0xe6454d37
+0, 20, 20, 1, 230400, 0x6bb65f77
+0, 21, 21, 1, 230400, 0x95b652eb
+0, 22, 22, 1, 230400, 0x4f585a73
+0, 23, 23, 1, 230400, 0x9bc2c9d8
+0, 24, 24, 1, 230400, 0x09f00930
+0, 25, 25, 1, 230400, 0x6be9d11a
+0, 26, 26, 1, 230400, 0x5cdd4ea5
+0, 27, 27, 1, 230400, 0x77508d67
+0, 28, 28, 1, 230400, 0x76b21fdd
+0, 29, 29, 1, 230400, 0x39e2dddb
+0, 30, 30, 1, 230400, 0x8b16d389
+0, 31, 31, 1, 230400, 0xb2b329fb
+0, 32, 32, 1, 230400, 0x8e998c17
+0, 33, 33, 1, 230400, 0x3852049f
+0, 34, 34, 1, 230400, 0x5a7f6302
+0, 35, 35, 1, 230400, 0xdd7d9d86
+0, 36, 36, 1, 230400, 0x337298bd
+0, 37, 37, 1, 230400, 0x2fa38668
+0, 38, 38, 1, 230400, 0xfc42afcd
+0, 39, 39, 1, 230400, 0x20ff7b1d
+0, 40, 40, 1, 230400, 0xa9190f28
+0, 41, 41, 1, 230400, 0x2ca26827
+0, 42, 42, 1, 230400, 0x1106bd55
+0, 43, 43, 1, 230400, 0xb965748e
+0, 44, 44, 1, 230400, 0x2c2d2691
+0, 45, 45, 1, 230400, 0x8096db4d
+0, 46, 46, 1, 230400, 0x7b223871
+0, 47, 47, 1, 230400, 0xf9edbca9
+0, 48, 48, 1, 230400, 0x0e607f74
+0, 49, 49, 1, 230400, 0x3e64ed79
+0, 50, 50, 1, 230400, 0x2198f77a
+0, 51, 51, 1, 230400, 0x3cf4925a
+0, 52, 52, 1, 230400, 0x2de0ebdb
+0, 53, 53, 1, 230400, 0x5104c55f
+0, 54, 54, 1, 230400, 0xebd7f8f7
+0, 55, 55, 1, 230400, 0xfce8a2ae
+0, 56, 56, 1, 230400, 0xeb073121
+0, 57, 57, 1, 230400, 0x8f2ed47d
+0, 58, 58, 1, 230400, 0xdcb72934
+0, 59, 59, 1, 230400, 0xf69e75a1
+0, 60, 60, 1, 230400, 0xc45ab599
+0, 61, 61, 1, 230400, 0x0d218766
+0, 62, 62, 1, 230400, 0x4a6aafce
+0, 63, 63, 1, 230400, 0x642153ca
+0, 64, 64, 1, 230400, 0x8bd7a2a4
+0, 65, 65, 1, 230400, 0x04abeeed
+0, 66, 66, 1, 230400, 0x37bf9f2c
+0, 67, 67, 1, 230400, 0x1d966ae5
+0, 68, 68, 1, 230400, 0x3a2ef337
+0, 69, 69, 1, 230400, 0x9edaf34f
+0, 70, 70, 1, 230400, 0x7f3c0ff8
+0, 71, 71, 1, 230400, 0x403cbdee
+0, 72, 72, 1, 230400, 0x86b340e8
+0, 73, 73, 1, 230400, 0x5a57c916
+0, 74, 74, 1, 230400, 0x35763ab3
+0, 75, 75, 1, 230400, 0xd135a1ba
+0, 76, 76, 1, 230400, 0x56a7b1db
+0, 77, 77, 1, 230400, 0x6e8d2910
+0, 78, 78, 1, 230400, 0xc8d9c4e1
+0, 79, 79, 1, 230400, 0xb61fd11f
+0, 80, 80, 1, 230400, 0x8949b165
+0, 81, 81, 1, 230400, 0x60082f69
+0, 82, 82, 1, 230400, 0xf9c74a14
+0, 83, 83, 1, 230400, 0x1f0af3f4
+0, 84, 84, 1, 230400, 0x1abe4a3b
+0, 85, 85, 1, 230400, 0xdf762ffb
+0, 86, 86, 1, 230400, 0x38513b73
+0, 87, 87, 1, 230400, 0xf3b01fcf
+0, 88, 88, 1, 230400, 0xea7d486c
+0, 89, 89, 1, 230400, 0xfabc7a89
+0, 90, 90, 1, 230400, 0xc72f6977
+0, 91, 91, 1, 230400, 0x1c9e4590
+0, 92, 92, 1, 230400, 0x51abf71e
+0, 93, 93, 1, 230400, 0x39c9d819
+0, 94, 94, 1, 230400, 0xfc62d8e0
+0, 95, 95, 1, 230400, 0x40bb8c0d
+0, 96, 96, 1, 230400, 0xa0bd86d2
+0, 97, 97, 1, 230400, 0x610dfe19
+0, 98, 98, 1, 230400, 0x997e1572
+0, 99, 99, 1, 230400, 0x49919319
diff --git a/gst-libs/ext/libav/tests/ref/fate/qtrle-16bit b/gst-libs/ext/libav/tests/ref/fate/qtrle-16bit
index 2f0ca48..d0d71b5 100644
--- a/gst-libs/ext/libav/tests/ref/fate/qtrle-16bit
+++ b/gst-libs/ext/libav/tests/ref/fate/qtrle-16bit
@@ -1,83 +1,84 @@
-0, 0, 57600, 0xe6b0a48c
-0, 6000, 57600, 0xe064d51c
-0, 12000, 57600, 0xbfce6b33
-0, 18000, 57600, 0x371bab02
-0, 24000, 57600, 0x0d2d7456
-0, 30000, 57600, 0x9184eecb
-0, 36000, 57600, 0xb482e8db
-0, 42000, 57600, 0x0f4cd4be
-0, 48000, 57600, 0xe276cccb
-0, 54000, 57600, 0x04c21c62
-0, 60000, 57600, 0x848960a2
-0, 66000, 57600, 0xc4c8cf03
-0, 72000, 57600, 0xb4094866
-0, 78000, 57600, 0xf22da043
-0, 84000, 57600, 0x6517b67b
-0, 90000, 57600, 0x23e39ccb
-0, 96000, 57600, 0x41525ca3
-0, 102000, 57600, 0xc3edc5f3
-0, 108000, 57600, 0x8ce81c7e
-0, 114000, 57600, 0x56829443
-0, 120000, 57600, 0x511ce287
-0, 126000, 57600, 0x8f029a5b
-0, 132000, 57600, 0x2b47cf43
-0, 138000, 57600, 0x8e7ecf4b
-0, 144000, 57600, 0xd620317e
-0, 150000, 57600, 0x5987646e
-0, 156000, 57600, 0xcfedb7df
-0, 162000, 57600, 0x33746e7b
-0, 168000, 57600, 0x1d318573
-0, 174000, 57600, 0xc851848b
-0, 180000, 57600, 0x939db1d7
-0, 186000, 57600, 0x1719aed3
-0, 192000, 57600, 0x1ba3e18c
-0, 198000, 57600, 0x04f355fb
-0, 204000, 57600, 0x6fafd5f4
-0, 210000, 57600, 0x434f800b
-0, 216000, 57600, 0xed42179b
-0, 222000, 57600, 0x3b33118b
-0, 228000, 57600, 0xf81880cb
-0, 234000, 57600, 0xd2c58e1b
-0, 240000, 57600, 0xd96f50eb
-0, 246000, 57600, 0x64ef63fb
-0, 252000, 57600, 0x7b14b6fc
-0, 258000, 57600, 0xeb1c9054
-0, 264000, 57600, 0x3b30c97c
-0, 270000, 57600, 0xc93e9484
-0, 276000, 57600, 0xe012c0cc
-0, 282000, 57600, 0x48e2dda4
-0, 288000, 57600, 0x13eb55fb
-0, 294000, 57600, 0xa5edbedc
-0, 300000, 57600, 0x0123a484
-0, 306000, 57600, 0xc624a7ac
-0, 312000, 57600, 0xd83cf45c
-0, 318000, 57600, 0x8f9bf4b4
-0, 324000, 57600, 0x2d494b8c
-0, 330000, 57600, 0xb246f07c
-0, 336000, 57600, 0x5750e67c
-0, 342000, 57600, 0x6643e9ac
-0, 348000, 57600, 0x8d3b86b3
-0, 354000, 57600, 0x4bb0546b
-0, 360000, 57600, 0xfe439333
-0, 366000, 57600, 0x0cc76233
-0, 372000, 57600, 0xb6fe40ae
-0, 378000, 57600, 0xf79fe0d7
-0, 384000, 57600, 0xdc90dcbb
-0, 390000, 57600, 0x371e7c2b
-0, 396000, 57600, 0x7c4590bb
-0, 402000, 57600, 0x66f5454b
-0, 408000, 57600, 0x1678ae5b
-0, 414000, 57600, 0x1ee8fdec
-0, 420000, 57600, 0x98d2a083
-0, 426000, 57600, 0x86d29e5b
-0, 432000, 57600, 0x23d2bc83
-0, 438000, 57600, 0x3fc729f2
-0, 444000, 57600, 0x821d61da
-0, 450000, 57600, 0xdd549e0e
-0, 456000, 57600, 0x641234e2
-0, 462000, 57600, 0x9a282112
-0, 468000, 57600, 0x6587e2fb
-0, 474000, 57600, 0x043d0cb2
-0, 480000, 57600, 0x90328707
-0, 486000, 57600, 0x5744d313
-0, 492000, 57600, 0x6e1b95cb
+#tb 0: 1/600
+0, 0, 0, 1, 57600, 0xe6b0a48c
+0, 40, 40, 1, 57600, 0xe064d51c
+0, 80, 80, 1, 57600, 0xbfce6b33
+0, 120, 120, 1, 57600, 0x371bab02
+0, 160, 160, 1, 57600, 0x0d2d7456
+0, 200, 200, 1, 57600, 0x9184eecb
+0, 240, 240, 1, 57600, 0xb482e8db
+0, 280, 280, 1, 57600, 0x0f4cd4be
+0, 320, 320, 1, 57600, 0xe276cccb
+0, 360, 360, 1, 57600, 0x04c21c62
+0, 400, 400, 1, 57600, 0x848960a2
+0, 440, 440, 1, 57600, 0xc4c8cf03
+0, 480, 480, 1, 57600, 0xb4094866
+0, 520, 520, 1, 57600, 0xf22da043
+0, 560, 560, 1, 57600, 0x6517b67b
+0, 600, 600, 1, 57600, 0x23e39ccb
+0, 640, 640, 1, 57600, 0x41525ca3
+0, 680, 680, 1, 57600, 0xc3edc5f3
+0, 720, 720, 1, 57600, 0x8ce81c7e
+0, 760, 760, 1, 57600, 0x56829443
+0, 800, 800, 1, 57600, 0x511ce287
+0, 840, 840, 1, 57600, 0x8f029a5b
+0, 880, 880, 1, 57600, 0x2b47cf43
+0, 920, 920, 1, 57600, 0x8e7ecf4b
+0, 960, 960, 1, 57600, 0xd620317e
+0, 1000, 1000, 1, 57600, 0x5987646e
+0, 1040, 1040, 1, 57600, 0xcfedb7df
+0, 1080, 1080, 1, 57600, 0x33746e7b
+0, 1120, 1120, 1, 57600, 0x1d318573
+0, 1160, 1160, 1, 57600, 0xc851848b
+0, 1200, 1200, 1, 57600, 0x939db1d7
+0, 1240, 1240, 1, 57600, 0x1719aed3
+0, 1280, 1280, 1, 57600, 0x1ba3e18c
+0, 1320, 1320, 1, 57600, 0x04f355fb
+0, 1360, 1360, 1, 57600, 0x6fafd5f4
+0, 1400, 1400, 1, 57600, 0x434f800b
+0, 1440, 1440, 1, 57600, 0xed42179b
+0, 1480, 1480, 1, 57600, 0x3b33118b
+0, 1520, 1520, 1, 57600, 0xf81880cb
+0, 1560, 1560, 1, 57600, 0xd2c58e1b
+0, 1600, 1600, 1, 57600, 0xd96f50eb
+0, 1640, 1640, 1, 57600, 0x64ef63fb
+0, 1680, 1680, 1, 57600, 0x7b14b6fc
+0, 1720, 1720, 1, 57600, 0xeb1c9054
+0, 1760, 1760, 1, 57600, 0x3b30c97c
+0, 1800, 1800, 1, 57600, 0xc93e9484
+0, 1840, 1840, 1, 57600, 0xe012c0cc
+0, 1880, 1880, 1, 57600, 0x48e2dda4
+0, 1920, 1920, 1, 57600, 0x13eb55fb
+0, 1960, 1960, 1, 57600, 0xa5edbedc
+0, 2000, 2000, 1, 57600, 0x0123a484
+0, 2040, 2040, 1, 57600, 0xc624a7ac
+0, 2080, 2080, 1, 57600, 0xd83cf45c
+0, 2120, 2120, 1, 57600, 0x8f9bf4b4
+0, 2160, 2160, 1, 57600, 0x2d494b8c
+0, 2200, 2200, 1, 57600, 0xb246f07c
+0, 2240, 2240, 1, 57600, 0x5750e67c
+0, 2280, 2280, 1, 57600, 0x6643e9ac
+0, 2320, 2320, 1, 57600, 0x8d3b86b3
+0, 2360, 2360, 1, 57600, 0x4bb0546b
+0, 2400, 2400, 1, 57600, 0xfe439333
+0, 2440, 2440, 1, 57600, 0x0cc76233
+0, 2480, 2480, 1, 57600, 0xb6fe40ae
+0, 2520, 2520, 1, 57600, 0xf79fe0d7
+0, 2560, 2560, 1, 57600, 0xdc90dcbb
+0, 2600, 2600, 1, 57600, 0x371e7c2b
+0, 2640, 2640, 1, 57600, 0x7c4590bb
+0, 2680, 2680, 1, 57600, 0x66f5454b
+0, 2720, 2720, 1, 57600, 0x1678ae5b
+0, 2760, 2760, 1, 57600, 0x1ee8fdec
+0, 2800, 2800, 1, 57600, 0x98d2a083
+0, 2840, 2840, 1, 57600, 0x86d29e5b
+0, 2880, 2880, 1, 57600, 0x23d2bc83
+0, 2920, 2920, 1, 57600, 0x3fc729f2
+0, 2960, 2960, 1, 57600, 0x821d61da
+0, 3000, 3000, 1, 57600, 0xdd549e0e
+0, 3040, 3040, 1, 57600, 0x641234e2
+0, 3080, 3080, 1, 57600, 0x9a282112
+0, 3120, 3120, 1, 57600, 0x6587e2fb
+0, 3160, 3160, 1, 57600, 0x043d0cb2
+0, 3200, 3200, 1, 57600, 0x90328707
+0, 3240, 3240, 1, 57600, 0x5744d313
+0, 3280, 3280, 1, 57600, 0x6e1b95cb
diff --git a/gst-libs/ext/libav/tests/ref/fate/qtrle-1bit b/gst-libs/ext/libav/tests/ref/fate/qtrle-1bit
index 040c9bf..a424e47 100644
--- a/gst-libs/ext/libav/tests/ref/fate/qtrle-1bit
+++ b/gst-libs/ext/libav/tests/ref/fate/qtrle-1bit
@@ -1,107 +1,39 @@
-0, 0, 9600, 0xc1632102
-1, 0, 2040, 0x0a157db4
-1, 4163, 2040, 0x00c63e08
-0, 7500, 9600, 0x0f6c0521
-1, 8327, 2040, 0xacf2a25b
-1, 12490, 2040, 0xd6189e85
-0, 15000, 9600, 0x04b90b5a
-1, 16653, 2040, 0x8276f843
-1, 20816, 2040, 0xadebae73
-0, 22500, 9600, 0x2ebd4500
-1, 24980, 2040, 0x5da76697
-1, 29143, 2040, 0x469d0ea7
-0, 30000, 9600, 0x726f46f4
-1, 33306, 2040, 0x0d7412e1
-1, 37469, 2040, 0x2f2cc63f
-0, 37500, 9600, 0x37f6968e
-1, 41633, 2040, 0x10106eb7
-0, 45000, 9600, 0x7305872e
-1, 45796, 2040, 0x300124c7
-1, 49959, 2040, 0xa329f8e8
-0, 52500, 9600, 0x222eff5e
-1, 54122, 2040, 0xcea35ca5
-1, 58286, 2040, 0x55105aef
-0, 60000, 9600, 0x9317e227
-1, 62449, 2040, 0x08980ce1
-1, 66612, 2040, 0x367faf24
-0, 67500, 9600, 0x421eee9d
-1, 70776, 2040, 0x75bfef06
-1, 74939, 2040, 0x34f1daf4
-0, 75000, 9600, 0xcbcfaaff
-1, 79102, 2040, 0x97050317
-0, 82500, 9600, 0xe7d43be2
-1, 83265, 2040, 0xd297c536
-1, 87429, 2040, 0xa8abad5a
-0, 90000, 9600, 0x0b71e28c
-1, 91592, 2040, 0x445ce8e0
-1, 95755, 2040, 0xa3f4d940
-0, 97500, 9600, 0xd6a050ca
-1, 99918, 2040, 0x0ebb7b26
-1, 104082, 2040, 0x4372f6f6
-0, 105000, 9600, 0x0ac6dbf5
-1, 108245, 2040, 0xd4365079
-1, 112408, 2040, 0x56f902f7
-0, 112500, 9600, 0x5c036038
-1, 116571, 2040, 0x4153938a
-0, 120000, 9600, 0x6e417ed6
-1, 120735, 2040, 0x14996d86
-1, 124898, 2040, 0x3f99c318
-0, 127500, 9600, 0x8bd0dc22
-1, 129061, 2040, 0x939978a5
-1, 133224, 2040, 0x7086bd44
-0, 135000, 9600, 0xdf3b0877
-1, 137388, 276, 0x25b89d22
-1, 137951, 2040, 0xf3edb106
-1, 142114, 2040, 0x0ca61430
-0, 142500, 9600, 0xae6e7823
-1, 146278, 2040, 0x7229c458
-0, 150000, 9600, 0x8ff0ac32
-1, 150441, 2040, 0xc37edd31
-1, 154604, 2040, 0xa3da98b4
-0, 157500, 9600, 0xa2d9e2ce
-1, 158767, 2040, 0x69704803
-1, 162931, 2040, 0xa79bf334
-0, 165000, 9600, 0x5fd92b65
-1, 167094, 2040, 0x59d8d4c4
-1, 171257, 2040, 0xf9ff0271
-0, 172500, 9600, 0x81c1c824
-1, 175420, 2040, 0xc4ced9d6
-1, 179584, 2040, 0x859f1912
-0, 180000, 9600, 0xb8a2ace4
-1, 183747, 2040, 0xe7955aa6
-0, 187500, 9600, 0x65b70404
-1, 187910, 2040, 0x374624fd
-1, 192073, 2040, 0x52121097
-0, 195000, 9600, 0xc5349eb2
-1, 196237, 2040, 0x660fe645
-1, 200400, 2040, 0xf624176a
-0, 202500, 9600, 0xf60cc2b8
-1, 204563, 2040, 0x1f2246dd
-1, 208727, 2040, 0x940e0a32
-0, 210000, 9600, 0x31474595
-1, 212890, 2040, 0x9c6d338c
-1, 217053, 2040, 0xfce0d30a
-0, 217500, 9600, 0xf602635b
-1, 221216, 2040, 0xd0ec9aa5
-0, 225000, 9600, 0x873cbd87
-1, 225380, 2040, 0x58012141
-1, 229543, 2040, 0xde67fc43
-0, 232500, 9600, 0xb9793ffe
-1, 233706, 2040, 0x6baa0450
-1, 237869, 2040, 0xf4f80252
-0, 240000, 9600, 0x42eb2831
-1, 242033, 2040, 0x0cd47ee3
-1, 246196, 2040, 0x129cbaa7
-0, 247500, 9600, 0x44cc1dab
-1, 250359, 2040, 0x5ef5c0a1
-1, 254522, 2040, 0xf660baa7
-0, 255000, 9600, 0xbdcbbb87
-1, 258686, 2040, 0xe48bc0a1
-0, 262500, 9600, 0x29c22df7
-1, 262849, 2040, 0xdfeabaa7
-1, 267012, 2040, 0xed04c0a1
-0, 270000, 9600, 0xde502ef5
-1, 271176, 2040, 0xd771baa7
-1, 275339, 300, 0x521f24e9
-1, 275951, 1476, 0x9b9394b1
-0, 277500, 9600, 0xaf311aeb
+#tb 0: 1/1200
+0, 0, 0, 0, 9600, 0xc5921aa2
+0, 100, 100, 0, 9600, 0x9032fc52
+0, 200, 200, 0, 9600, 0x7db0038e
+0, 300, 300, 0, 9600, 0x95b73c41
+0, 400, 400, 0, 9600, 0x531e4189
+0, 500, 500, 0, 9600, 0xb73390ec
+0, 600, 600, 0, 9600, 0x958e8221
+0, 700, 700, 0, 9600, 0xd393f8a6
+0, 800, 800, 0, 9600, 0xa085da1c
+0, 900, 900, 0, 9600, 0x57ace74f
+0, 1000, 1000, 0, 9600, 0x5d11a308
+0, 1100, 1100, 0, 9600, 0x13e133b7
+0, 1200, 1200, 0, 9600, 0x494edb86
+0, 1300, 1300, 0, 9600, 0x43a448ea
+0, 1400, 1400, 0, 9600, 0x3562d35b
+0, 1500, 1500, 0, 9600, 0x0bc655d2
+0, 1600, 1600, 0, 9600, 0xbece73a1
+0, 1700, 1700, 0, 9600, 0x82e7cfa1
+0, 1800, 1800, 0, 9600, 0xda29fd8f
+0, 1900, 1900, 0, 9600, 0x70fb700b
+0, 2000, 2000, 0, 9600, 0xaf57a6b0
+0, 2100, 2100, 0, 9600, 0x0a5ed9b9
+0, 2200, 2200, 0, 9600, 0xf7c62c38
+0, 2300, 2300, 0, 9600, 0x0aa2ccfd
+0, 2400, 2400, 0, 9600, 0xc9adabae
+0, 2500, 2500, 0, 9600, 0x67ff0aba
+0, 2600, 2600, 0, 9600, 0xea79a465
+0, 2700, 2700, 0, 9600, 0x8928c626
+0, 2800, 2800, 0, 9600, 0x8dab4111
+0, 2900, 2900, 0, 9600, 0x81ef63f9
+0, 3000, 3000, 0, 9600, 0xf977bc5e
+0, 3100, 3100, 0, 9600, 0x9e6a3f4a
+0, 3200, 3200, 0, 9600, 0x77c92865
+0, 3300, 3300, 0, 9600, 0x3915170d
+0, 3400, 3400, 0, 9600, 0xbe19b995
+0, 3500, 3500, 0, 9600, 0x3e8a3077
+0, 3600, 3600, 0, 9600, 0x1331342e
+0, 3700, 3700, 0, 9600, 0x4d692175
diff --git a/gst-libs/ext/libav/tests/ref/fate/qtrle-24bit b/gst-libs/ext/libav/tests/ref/fate/qtrle-24bit
index da8fec4..7a162b8 100644
--- a/gst-libs/ext/libav/tests/ref/fate/qtrle-24bit
+++ b/gst-libs/ext/libav/tests/ref/fate/qtrle-24bit
@@ -1,34 +1,35 @@
-0, 0, 57600, 0x3718ad00
-0, 9000, 57600, 0x54861558
-0, 18000, 57600, 0xea1d6233
-0, 27000, 57600, 0xf669a2fd
-0, 36000, 57600, 0xc9f76f31
-0, 45000, 57600, 0xe23c6d7b
-0, 54000, 57600, 0xbc9d6167
-0, 63000, 57600, 0x0ca63477
-0, 72000, 57600, 0xc0850d22
-0, 81000, 57600, 0x735d10b2
-0, 90000, 57600, 0x561f3c4a
-0, 99000, 57600, 0x84db9cf1
-0, 108000, 57600, 0x9fb841f4
-0, 117000, 57600, 0xeaf262ab
-0, 126000, 57600, 0x264886b4
-0, 135000, 57600, 0x5edc5518
-0, 144000, 57600, 0xd3e60c72
-0, 153000, 57600, 0x9cabaed7
-0, 162000, 57600, 0x616716cf
-0, 171000, 57600, 0xa43f61aa
-0, 180000, 57600, 0xdba3a0bd
-0, 189000, 57600, 0xa7dd6dfa
-0, 198000, 57600, 0xc3fa6c84
-0, 207000, 57600, 0xb1275fb8
-0, 216000, 57600, 0x2e39331f
-0, 225000, 57600, 0x5b9e0bca
-0, 234000, 57600, 0x0e760f5a
-0, 243000, 57600, 0xc56c3e69
-0, 252000, 57600, 0x51da9fb8
-0, 261000, 57600, 0xe3a1432b
-0, 270000, 57600, 0xe1b360a3
-0, 279000, 57600, 0x30b383cd
-0, 288000, 57600, 0x950c5439
-0, 297000, 57600, 0x8f9d0ca2
+#tb 0: 1/600
+0, 0, 0, 1, 57600, 0x3718ad00
+0, 60, 60, 1, 57600, 0x54861558
+0, 120, 120, 1, 57600, 0xea1d6233
+0, 180, 180, 1, 57600, 0xf669a2fd
+0, 240, 240, 1, 57600, 0xc9f76f31
+0, 300, 300, 1, 57600, 0xe23c6d7b
+0, 360, 360, 1, 57600, 0xbc9d6167
+0, 420, 420, 1, 57600, 0x0ca63477
+0, 480, 480, 1, 57600, 0xc0850d22
+0, 540, 540, 1, 57600, 0x735d10b2
+0, 600, 600, 1, 57600, 0x561f3c4a
+0, 660, 660, 1, 57600, 0x84db9cf1
+0, 720, 720, 1, 57600, 0x9fb841f4
+0, 780, 780, 1, 57600, 0xeaf262ab
+0, 840, 840, 1, 57600, 0x264886b4
+0, 900, 900, 1, 57600, 0x5edc5518
+0, 960, 960, 1, 57600, 0xd3e60c72
+0, 1020, 1020, 1, 57600, 0x9cabaed7
+0, 1080, 1080, 1, 57600, 0x616716cf
+0, 1140, 1140, 1, 57600, 0xa43f61aa
+0, 1200, 1200, 1, 57600, 0xdba3a0bd
+0, 1260, 1260, 1, 57600, 0xa7dd6dfa
+0, 1320, 1320, 1, 57600, 0xc3fa6c84
+0, 1380, 1380, 1, 57600, 0xb1275fb8
+0, 1440, 1440, 1, 57600, 0x2e39331f
+0, 1500, 1500, 1, 57600, 0x5b9e0bca
+0, 1560, 1560, 1, 57600, 0x0e760f5a
+0, 1620, 1620, 1, 57600, 0xc56c3e69
+0, 1680, 1680, 1, 57600, 0x51da9fb8
+0, 1740, 1740, 1, 57600, 0xe3a1432b
+0, 1800, 1800, 1, 57600, 0xe1b360a3
+0, 1860, 1860, 1, 57600, 0x30b383cd
+0, 1920, 1920, 1, 57600, 0x950c5439
+0, 1980, 1980, 1, 57600, 0x8f9d0ca2
diff --git a/gst-libs/ext/libav/tests/ref/fate/qtrle-2bit b/gst-libs/ext/libav/tests/ref/fate/qtrle-2bit
index c7e3fe6..5866db5 100644
--- a/gst-libs/ext/libav/tests/ref/fate/qtrle-2bit
+++ b/gst-libs/ext/libav/tests/ref/fate/qtrle-2bit
@@ -1,107 +1,39 @@
-0, 0, 230400, 0xb1ee55dc
-1, 0, 2040, 0x0a157db4
-1, 4163, 2040, 0x00c63e08
-0, 7500, 230400, 0x97c580bf
-1, 8327, 2040, 0xacf2a25b
-1, 12490, 2040, 0xd6189e85
-0, 15000, 230400, 0xd4bd57e8
-1, 16653, 2040, 0x8276f843
-1, 20816, 2040, 0xadebae73
-0, 22500, 230400, 0x412b79aa
-1, 24980, 2040, 0x5da76697
-1, 29143, 2040, 0x469d0ea7
-0, 30000, 230400, 0x928a44d1
-1, 33306, 2040, 0x0d7412e1
-1, 37469, 2040, 0x2f2cc63f
-0, 37500, 230400, 0x6bbdc0e4
-1, 41633, 2040, 0x10106eb7
-0, 45000, 230400, 0x382e960f
-1, 45796, 2040, 0x300124c7
-1, 49959, 2040, 0xa329f8e8
-0, 52500, 230400, 0x62c863ea
-1, 54122, 2040, 0xcea35ca5
-1, 58286, 2040, 0x55105aef
-0, 60000, 230400, 0xbfccd3ce
-1, 62449, 2040, 0x08980ce1
-1, 66612, 2040, 0x367faf24
-0, 67500, 230400, 0x1987cdd4
-1, 70776, 2040, 0x75bfef06
-1, 74939, 2040, 0x34f1daf4
-0, 75000, 230400, 0x40279727
-1, 79102, 2040, 0x97050317
-0, 82500, 230400, 0x9d4f6746
-1, 83265, 2040, 0xd297c536
-1, 87429, 2040, 0xa8abad5a
-0, 90000, 230400, 0x7b8a77ec
-1, 91592, 2040, 0x445ce8e0
-1, 95755, 2040, 0xa3f4d940
-0, 97500, 230400, 0x2ce7a781
-1, 99918, 2040, 0x0ebb7b26
-1, 104082, 2040, 0x4372f6f6
-0, 105000, 230400, 0xb749815e
-1, 108245, 2040, 0xd4365079
-1, 112408, 2040, 0x56f902f7
-0, 112500, 230400, 0x61c88610
-1, 116571, 2040, 0x4153938a
-0, 120000, 230400, 0x8449114d
-1, 120735, 2040, 0x14996d86
-1, 124898, 2040, 0x3f99c318
-0, 127500, 230400, 0x5f73e666
-1, 129061, 2040, 0x939978a5
-1, 133224, 2040, 0x7086bd44
-0, 135000, 230400, 0xbde53ce6
-1, 137388, 276, 0x25b89d22
-1, 137951, 2040, 0xf3edb106
-1, 142114, 2040, 0x0ca61430
-0, 142500, 230400, 0x8c7406fd
-1, 146278, 2040, 0x7229c458
-0, 150000, 230400, 0xf9e9a3ef
-1, 150441, 2040, 0xc37edd31
-1, 154604, 2040, 0xa3da98b4
-0, 157500, 230400, 0x7e0a3077
-1, 158767, 2040, 0x69704803
-1, 162931, 2040, 0xa79bf334
-0, 165000, 230400, 0xd9245c5f
-1, 167094, 2040, 0x59d8d4c4
-1, 171257, 2040, 0xf9ff0271
-0, 172500, 230400, 0x6d077ea2
-1, 175420, 2040, 0xc4ced9d6
-1, 179584, 2040, 0x859f1912
-0, 180000, 230400, 0xf622bb2a
-1, 183747, 2040, 0xe7955aa6
-0, 187500, 230400, 0x35292dc8
-1, 187910, 2040, 0x374624fd
-1, 192073, 2040, 0x52121097
-0, 195000, 230400, 0xc0cea946
-1, 196237, 2040, 0x660fe645
-1, 200400, 2040, 0xf624176a
-0, 202500, 230400, 0x98b27b60
-1, 204563, 2040, 0x1f2246dd
-1, 208727, 2040, 0x940e0a32
-0, 210000, 230400, 0x668ef6bd
-1, 212890, 2040, 0x9c6d338c
-1, 217053, 2040, 0xfce0d30a
-0, 217500, 230400, 0x6c07a31c
-1, 221216, 2040, 0xd0ec9aa5
-0, 225000, 230400, 0x0b4a6ae1
-1, 225380, 2040, 0x58012141
-1, 229543, 2040, 0xde67fc43
-0, 232500, 230400, 0x945b9878
-1, 233706, 2040, 0x6baa0450
-1, 237869, 2040, 0xf4f80252
-0, 240000, 230400, 0xab28031c
-1, 242033, 2040, 0x0cd47ee3
-1, 246196, 2040, 0x129cbaa7
-0, 247500, 230400, 0x977252b0
-1, 250359, 2040, 0x5ef5c0a1
-1, 254522, 2040, 0xf660baa7
-0, 255000, 230400, 0x6c3d9706
-1, 258686, 2040, 0xe48bc0a1
-0, 262500, 230400, 0xe053bc2a
-1, 262849, 2040, 0xdfeabaa7
-1, 267012, 2040, 0xed04c0a1
-0, 270000, 230400, 0x4cf2fc7c
-1, 271176, 2040, 0xd771baa7
-1, 275339, 300, 0x521f24e9
-1, 275951, 1476, 0x9b9394b1
-0, 277500, 230400, 0x610beda7
+#tb 0: 1/1200
+0, 0, 0, 0, 230400, 0xb1ee55dc
+0, 100, 100, 0, 230400, 0x97c580bf
+0, 200, 200, 0, 230400, 0xd4bd57e8
+0, 300, 300, 0, 230400, 0x412b79aa
+0, 400, 400, 0, 230400, 0x928a44d1
+0, 500, 500, 0, 230400, 0x6bbdc0e4
+0, 600, 600, 0, 230400, 0x382e960f
+0, 700, 700, 0, 230400, 0x62c863ea
+0, 800, 800, 0, 230400, 0xbfccd3ce
+0, 900, 900, 0, 230400, 0x1987cdd4
+0, 1000, 1000, 0, 230400, 0x40279727
+0, 1100, 1100, 0, 230400, 0x9d4f6746
+0, 1200, 1200, 0, 230400, 0x7b8a77ec
+0, 1300, 1300, 0, 230400, 0x2ce7a781
+0, 1400, 1400, 0, 230400, 0xb749815e
+0, 1500, 1500, 0, 230400, 0x61c88610
+0, 1600, 1600, 0, 230400, 0x8449114d
+0, 1700, 1700, 0, 230400, 0x5f73e666
+0, 1800, 1800, 0, 230400, 0xbde53ce6
+0, 1900, 1900, 0, 230400, 0x8c7406fd
+0, 2000, 2000, 0, 230400, 0xf9e9a3ef
+0, 2100, 2100, 0, 230400, 0x7e0a3077
+0, 2200, 2200, 0, 230400, 0xd9245c5f
+0, 2300, 2300, 0, 230400, 0x6d077ea2
+0, 2400, 2400, 0, 230400, 0xf622bb2a
+0, 2500, 2500, 0, 230400, 0x35292dc8
+0, 2600, 2600, 0, 230400, 0xc0cea946
+0, 2700, 2700, 0, 230400, 0x98b27b60
+0, 2800, 2800, 0, 230400, 0x668ef6bd
+0, 2900, 2900, 0, 230400, 0x6c07a31c
+0, 3000, 3000, 0, 230400, 0x0b4a6ae1
+0, 3100, 3100, 0, 230400, 0x945b9878
+0, 3200, 3200, 0, 230400, 0xab28031c
+0, 3300, 3300, 0, 230400, 0x977252b0
+0, 3400, 3400, 0, 230400, 0x6c3d9706
+0, 3500, 3500, 0, 230400, 0xe053bc2a
+0, 3600, 3600, 0, 230400, 0x4cf2fc7c
+0, 3700, 3700, 0, 230400, 0x610beda7
diff --git a/gst-libs/ext/libav/tests/ref/fate/qtrle-32bit b/gst-libs/ext/libav/tests/ref/fate/qtrle-32bit
index a5e9c8a..bbdd464 100644
--- a/gst-libs/ext/libav/tests/ref/fate/qtrle-32bit
+++ b/gst-libs/ext/libav/tests/ref/fate/qtrle-32bit
@@ -1,26 +1,27 @@
-0, 0, 1036800, 0x2a90d062
-0, 3003, 1036800, 0x6565aded
-0, 6006, 1036800, 0xf0b587d2
-0, 9009, 1036800, 0xf0b4e53f
-0, 12012, 1036800, 0x5ba4b96a
-0, 15015, 1036800, 0x501df9c1
-0, 18018, 1036800, 0xcf45b940
-0, 21021, 1036800, 0xa454df07
-0, 24024, 1036800, 0xc504d152
-0, 27027, 1036800, 0xd90ecac7
-0, 30030, 1036800, 0xe30368df
-0, 33033, 1036800, 0x0ca35522
-0, 36036, 1036800, 0xe76b8d43
-0, 39039, 1036800, 0x7c85a447
-0, 42042, 1036800, 0x3e2d1b5f
-0, 45045, 1036800, 0x230fa5a6
-0, 48048, 1036800, 0x4fad025e
-0, 51051, 1036800, 0x7d3366ae
-0, 54054, 1036800, 0xa83720f7
-0, 57057, 1036800, 0x5dbd13b1
-0, 60060, 1036800, 0xd0ebd56d
-0, 63063, 1036800, 0x4d7c67f3
-0, 66066, 1036800, 0x226baa3f
-0, 69069, 1036800, 0xc0e93acf
-0, 72072, 1036800, 0x5a466c17
-0, 75075, 1036800, 0xfdb7d2ea
+#tb 0: 1/2997
+0, 0, 0, 0, 1036800, 0x2a90d062
+0, 100, 100, 0, 1036800, 0x6565aded
+0, 200, 200, 0, 1036800, 0xf0b587d2
+0, 300, 300, 0, 1036800, 0xf0b4e53f
+0, 400, 400, 0, 1036800, 0x5ba4b96a
+0, 500, 500, 0, 1036800, 0x501df9c1
+0, 600, 600, 0, 1036800, 0xcf45b940
+0, 700, 700, 0, 1036800, 0xa454df07
+0, 800, 800, 0, 1036800, 0xc504d152
+0, 900, 900, 0, 1036800, 0xd90ecac7
+0, 1000, 1000, 0, 1036800, 0xe30368df
+0, 1100, 1100, 0, 1036800, 0x0ca35522
+0, 1200, 1200, 0, 1036800, 0xe76b8d43
+0, 1300, 1300, 0, 1036800, 0x7c85a447
+0, 1400, 1400, 0, 1036800, 0x3e2d1b5f
+0, 1500, 1500, 0, 1036800, 0x230fa5a6
+0, 1600, 1600, 0, 1036800, 0x4fad025e
+0, 1700, 1700, 0, 1036800, 0x7d3366ae
+0, 1800, 1800, 0, 1036800, 0xa83720f7
+0, 1900, 1900, 0, 1036800, 0x5dbd13b1
+0, 2000, 2000, 0, 1036800, 0xd0ebd56d
+0, 2100, 2100, 0, 1036800, 0x4d7c67f3
+0, 2200, 2200, 0, 1036800, 0x226baa3f
+0, 2300, 2300, 0, 1036800, 0xc0e93acf
+0, 2400, 2400, 0, 1036800, 0x5a466c17
+0, 2500, 2500, 0, 1036800, 0xfdb7d2ea
diff --git a/gst-libs/ext/libav/tests/ref/fate/qtrle-4bit b/gst-libs/ext/libav/tests/ref/fate/qtrle-4bit
index 5678096..cc09e78 100644
--- a/gst-libs/ext/libav/tests/ref/fate/qtrle-4bit
+++ b/gst-libs/ext/libav/tests/ref/fate/qtrle-4bit
@@ -1,38 +1,39 @@
-0, 0, 230400, 0x0655b3d9
-0, 7500, 230400, 0x9c626fd3
-0, 15000, 230400, 0x5bc95868
-0, 22500, 230400, 0x55a38387
-0, 30000, 230400, 0xd3495b60
-0, 37500, 230400, 0xecdb2d15
-0, 45000, 230400, 0x7f9b373e
-0, 52500, 230400, 0x51caac22
-0, 60000, 230400, 0x0f2ac153
-0, 67500, 230400, 0xe5a6f9e7
-0, 75000, 230400, 0xfc2b2250
-0, 82500, 230400, 0x24e2da1b
-0, 90000, 230400, 0x2723d7dd
-0, 97500, 230400, 0x024a4989
-0, 105000, 230400, 0xdbafb92d
-0, 112500, 230400, 0x6b9b5056
-0, 120000, 230400, 0x010cabb4
-0, 127500, 230400, 0xf75bc1c0
-0, 135000, 230400, 0x6c7fd744
-0, 142500, 230400, 0xabe4371a
-0, 150000, 230400, 0xe41fb781
-0, 157500, 230400, 0x42c5649e
-0, 165000, 230400, 0xf5511deb
-0, 172500, 230400, 0xebf5ab32
-0, 180000, 230400, 0x44398194
-0, 187500, 230400, 0xfd63510c
-0, 195000, 230400, 0xa013975e
-0, 202500, 230400, 0xe0aa028d
-0, 210000, 230400, 0x349f6f3b
-0, 217500, 230400, 0x2446032c
-0, 225000, 230400, 0x648f122c
-0, 232500, 230400, 0xbda221fd
-0, 240000, 230400, 0xf0f97642
-0, 247500, 230400, 0x6a1737de
-0, 255000, 230400, 0x808a8179
-0, 262500, 230400, 0x121641cf
-0, 270000, 230400, 0x275d11ea
-0, 277500, 230400, 0x92adf2cf
+#tb 0: 1/1200
+0, 0, 0, 0, 230400, 0x0655b3d9
+0, 100, 100, 0, 230400, 0x9c626fd3
+0, 200, 200, 0, 230400, 0x5bc95868
+0, 300, 300, 0, 230400, 0x55a38387
+0, 400, 400, 0, 230400, 0xd3495b60
+0, 500, 500, 0, 230400, 0xecdb2d15
+0, 600, 600, 0, 230400, 0x7f9b373e
+0, 700, 700, 0, 230400, 0x51caac22
+0, 800, 800, 0, 230400, 0x0f2ac153
+0, 900, 900, 0, 230400, 0xe5a6f9e7
+0, 1000, 1000, 0, 230400, 0xfc2b2250
+0, 1100, 1100, 0, 230400, 0x24e2da1b
+0, 1200, 1200, 0, 230400, 0x2723d7dd
+0, 1300, 1300, 0, 230400, 0x024a4989
+0, 1400, 1400, 0, 230400, 0xdbafb92d
+0, 1500, 1500, 0, 230400, 0x6b9b5056
+0, 1600, 1600, 0, 230400, 0x010cabb4
+0, 1700, 1700, 0, 230400, 0xf75bc1c0
+0, 1800, 1800, 0, 230400, 0x6c7fd744
+0, 1900, 1900, 0, 230400, 0xabe4371a
+0, 2000, 2000, 0, 230400, 0xe41fb781
+0, 2100, 2100, 0, 230400, 0x42c5649e
+0, 2200, 2200, 0, 230400, 0xf5511deb
+0, 2300, 2300, 0, 230400, 0xebf5ab32
+0, 2400, 2400, 0, 230400, 0x44398194
+0, 2500, 2500, 0, 230400, 0xfd63510c
+0, 2600, 2600, 0, 230400, 0xa013975e
+0, 2700, 2700, 0, 230400, 0xe0aa028d
+0, 2800, 2800, 0, 230400, 0x349f6f3b
+0, 2900, 2900, 0, 230400, 0x2446032c
+0, 3000, 3000, 0, 230400, 0x648f122c
+0, 3100, 3100, 0, 230400, 0xbda221fd
+0, 3200, 3200, 0, 230400, 0xf0f97642
+0, 3300, 3300, 0, 230400, 0x6a1737de
+0, 3400, 3400, 0, 230400, 0x808a8179
+0, 3500, 3500, 0, 230400, 0x121641cf
+0, 3600, 3600, 0, 230400, 0x275d11ea
+0, 3700, 3700, 0, 230400, 0x92adf2cf
diff --git a/gst-libs/ext/libav/tests/ref/fate/qtrle-8bit b/gst-libs/ext/libav/tests/ref/fate/qtrle-8bit
index 62f7482..bef2358 100644
--- a/gst-libs/ext/libav/tests/ref/fate/qtrle-8bit
+++ b/gst-libs/ext/libav/tests/ref/fate/qtrle-8bit
@@ -1,167 +1,168 @@
-0, 0, 921600, 0x1492e3ed
-0, 6000, 921600, 0x1492e3ed
-0, 12000, 921600, 0x1492e3ed
-0, 18000, 921600, 0x23ef4fc7
-0, 24000, 921600, 0x23ef4fc7
-0, 30000, 921600, 0xe406d4be
-0, 36000, 921600, 0xe406d4be
-0, 42000, 921600, 0xe406d4be
-0, 48000, 921600, 0x62b8b5a1
-0, 54000, 921600, 0x62b8b5a1
-0, 60000, 921600, 0x7d8ba674
-0, 66000, 921600, 0x7d8ba674
-0, 72000, 921600, 0x7d8ba674
-0, 78000, 921600, 0xfe666be7
-0, 84000, 921600, 0xfe666be7
-0, 90000, 921600, 0x721baec0
-0, 96000, 921600, 0x721baec0
-0, 102000, 921600, 0x721baec0
-0, 108000, 921600, 0xc237180a
-0, 114000, 921600, 0xc237180a
-0, 120000, 921600, 0xf03a7482
-0, 126000, 921600, 0xf03a7482
-0, 132000, 921600, 0xf03a7482
-0, 138000, 921600, 0x5612a391
-0, 144000, 921600, 0x5612a391
-0, 150000, 921600, 0x9dbcc46a
-0, 156000, 921600, 0x9dbcc46a
-0, 162000, 921600, 0x9dbcc46a
-0, 168000, 921600, 0xa128a5d5
-0, 174000, 921600, 0xa128a5d5
-0, 180000, 921600, 0x63e0025c
-0, 186000, 921600, 0x63e0025c
-0, 192000, 921600, 0x63e0025c
-0, 198000, 921600, 0x262359ed
-0, 204000, 921600, 0x262359ed
-0, 210000, 921600, 0x343688e8
-0, 216000, 921600, 0x343688e8
-0, 222000, 921600, 0x343688e8
-0, 228000, 921600, 0x343688e8
-0, 234000, 921600, 0x343688e8
-0, 240000, 921600, 0x343688e8
-0, 246000, 921600, 0x343688e8
-0, 252000, 921600, 0x343688e8
-0, 258000, 921600, 0x343688e8
-0, 264000, 921600, 0x343688e8
-0, 270000, 921600, 0xe4b29d57
-0, 276000, 921600, 0xe4b29d57
-0, 282000, 921600, 0xe4b29d57
-0, 288000, 921600, 0x198e8a4a
-0, 294000, 921600, 0x198e8a4a
-0, 300000, 921600, 0x0cad8dc9
-0, 306000, 921600, 0x0cad8dc9
-0, 312000, 921600, 0x0cad8dc9
-0, 318000, 921600, 0x1f74cf3d
-0, 324000, 921600, 0x1f74cf3d
-0, 330000, 921600, 0xec5b5449
-0, 336000, 921600, 0xec5b5449
-0, 342000, 921600, 0xec5b5449
-0, 348000, 921600, 0x39829711
-0, 354000, 921600, 0x39829711
-0, 360000, 921600, 0x6de5b9c6
-0, 366000, 921600, 0x6de5b9c6
-0, 372000, 921600, 0x6de5b9c6
-0, 378000, 921600, 0x47b0e9d4
-0, 384000, 921600, 0x47b0e9d4
-0, 390000, 921600, 0x756452b8
-0, 396000, 921600, 0x756452b8
-0, 402000, 921600, 0x756452b8
-0, 408000, 921600, 0x6fce3478
-0, 414000, 921600, 0x6fce3478
-0, 420000, 921600, 0x372397cd
-0, 426000, 921600, 0x372397cd
-0, 432000, 921600, 0x372397cd
-0, 438000, 921600, 0xe3999ba1
-0, 444000, 921600, 0xe3999ba1
-0, 450000, 921600, 0x6ba26b43
-0, 456000, 921600, 0x6ba26b43
-0, 462000, 921600, 0x6ba26b43
-0, 468000, 921600, 0x4e9ee49e
-0, 474000, 921600, 0x4e9ee49e
-0, 480000, 921600, 0xdb5fd6e7
-0, 486000, 921600, 0xdb5fd6e7
-0, 492000, 921600, 0xdb5fd6e7
-0, 498000, 921600, 0x8f2254a5
-0, 504000, 921600, 0x8f2254a5
-0, 510000, 921600, 0x8f2254a5
-0, 516000, 921600, 0x8f2254a5
-0, 522000, 921600, 0x8f2254a5
-0, 528000, 921600, 0x8f2254a5
-0, 534000, 921600, 0x8f2254a5
-0, 540000, 921600, 0x8f2254a5
-0, 546000, 921600, 0x8f2254a5
-0, 552000, 921600, 0x8f2254a5
-0, 558000, 921600, 0x57e95c32
-0, 564000, 921600, 0x57e95c32
-0, 570000, 921600, 0x41627a9b
-0, 576000, 921600, 0x41627a9b
-0, 582000, 921600, 0x41627a9b
-0, 588000, 921600, 0x7412dcee
-0, 594000, 921600, 0x7412dcee
-0, 600000, 921600, 0xaebe10ed
-0, 606000, 921600, 0xaebe10ed
-0, 612000, 921600, 0xaebe10ed
-0, 618000, 921600, 0x411a91f6
-0, 624000, 921600, 0x411a91f6
-0, 630000, 921600, 0xb059df3f
-0, 636000, 921600, 0xb059df3f
-0, 642000, 921600, 0xb059df3f
-0, 648000, 921600, 0x4d6f5a77
-0, 654000, 921600, 0x4d6f5a77
-0, 660000, 921600, 0xbbf06df4
-0, 666000, 921600, 0xbbf06df4
-0, 672000, 921600, 0xbbf06df4
-0, 678000, 921600, 0xe27f7bf6
-0, 684000, 921600, 0xe27f7bf6
-0, 690000, 921600, 0xd7e8360e
-0, 696000, 921600, 0xd7e8360e
-0, 702000, 921600, 0xd7e8360e
-0, 708000, 921600, 0x1dd4c344
-0, 714000, 921600, 0x1dd4c344
-0, 720000, 921600, 0x7995a7ce
-0, 726000, 921600, 0x7995a7ce
-0, 732000, 921600, 0x7995a7ce
-0, 738000, 921600, 0x2ef3c566
-0, 744000, 921600, 0x2ef3c566
-0, 750000, 921600, 0xf296736e
-0, 756000, 921600, 0xf296736e
-0, 762000, 921600, 0xf296736e
-0, 768000, 921600, 0xf296736e
-0, 774000, 921600, 0xf296736e
-0, 780000, 921600, 0xf296736e
-0, 786000, 921600, 0xf296736e
-0, 792000, 921600, 0xf296736e
-0, 798000, 921600, 0xf296736e
-0, 804000, 921600, 0xf296736e
-0, 810000, 921600, 0x1a488311
-0, 816000, 921600, 0x1a488311
-0, 822000, 921600, 0x1a488311
-0, 828000, 921600, 0x9e28011b
-0, 834000, 921600, 0x9e28011b
-0, 840000, 921600, 0x84d1ea80
-0, 846000, 921600, 0x84d1ea80
-0, 852000, 921600, 0x84d1ea80
-0, 858000, 921600, 0x9ed41052
-0, 864000, 921600, 0x9ed41052
-0, 870000, 921600, 0xd4db7206
-0, 876000, 921600, 0xd4db7206
-0, 882000, 921600, 0xd4db7206
-0, 888000, 921600, 0x55f695a9
-0, 894000, 921600, 0x55f695a9
-0, 900000, 921600, 0x9d8c667f
-0, 906000, 921600, 0x9d8c667f
-0, 912000, 921600, 0x9d8c667f
-0, 918000, 921600, 0x9b6037ec
-0, 924000, 921600, 0x9b6037ec
-0, 930000, 921600, 0x57c5e835
-0, 936000, 921600, 0x57c5e835
-0, 942000, 921600, 0x57c5e835
-0, 948000, 921600, 0x476dad89
-0, 954000, 921600, 0x476dad89
-0, 960000, 921600, 0xcfd6ad2b
-0, 966000, 921600, 0xcfd6ad2b
-0, 972000, 921600, 0xcfd6ad2b
-0, 978000, 921600, 0x3b372379
-0, 984000, 921600, 0x3b372379
-0, 990000, 921600, 0x36f245f5
-0, 996000, 921600, 0x36f245f5
+#tb 0: 1/600
+0, 0, 0, 1, 921600, 0x1492e3ed
+0, 40, 40, 1, 921600, 0x1492e3ed
+0, 80, 80, 1, 921600, 0x1492e3ed
+0, 120, 120, 1, 921600, 0x23ef4fc7
+0, 160, 160, 1, 921600, 0x23ef4fc7
+0, 200, 200, 1, 921600, 0xe406d4be
+0, 240, 240, 1, 921600, 0xe406d4be
+0, 280, 280, 1, 921600, 0xe406d4be
+0, 320, 320, 1, 921600, 0x62b8b5a1
+0, 360, 360, 1, 921600, 0x62b8b5a1
+0, 400, 400, 1, 921600, 0x7d8ba674
+0, 440, 440, 1, 921600, 0x7d8ba674
+0, 480, 480, 1, 921600, 0x7d8ba674
+0, 520, 520, 1, 921600, 0xfe666be7
+0, 560, 560, 1, 921600, 0xfe666be7
+0, 600, 600, 1, 921600, 0x721baec0
+0, 640, 640, 1, 921600, 0x721baec0
+0, 680, 680, 1, 921600, 0x721baec0
+0, 720, 720, 1, 921600, 0xc237180a
+0, 760, 760, 1, 921600, 0xc237180a
+0, 800, 800, 1, 921600, 0xf03a7482
+0, 840, 840, 1, 921600, 0xf03a7482
+0, 880, 880, 1, 921600, 0xf03a7482
+0, 920, 920, 1, 921600, 0x5612a391
+0, 960, 960, 1, 921600, 0x5612a391
+0, 1000, 1000, 1, 921600, 0x9dbcc46a
+0, 1040, 1040, 1, 921600, 0x9dbcc46a
+0, 1080, 1080, 1, 921600, 0x9dbcc46a
+0, 1120, 1120, 1, 921600, 0xa128a5d5
+0, 1160, 1160, 1, 921600, 0xa128a5d5
+0, 1200, 1200, 1, 921600, 0x63e0025c
+0, 1240, 1240, 1, 921600, 0x63e0025c
+0, 1280, 1280, 1, 921600, 0x63e0025c
+0, 1320, 1320, 1, 921600, 0x262359ed
+0, 1360, 1360, 1, 921600, 0x262359ed
+0, 1400, 1400, 1, 921600, 0x343688e8
+0, 1440, 1440, 1, 921600, 0x343688e8
+0, 1480, 1480, 1, 921600, 0x343688e8
+0, 1520, 1520, 1, 921600, 0x343688e8
+0, 1560, 1560, 1, 921600, 0x343688e8
+0, 1600, 1600, 1, 921600, 0x343688e8
+0, 1640, 1640, 1, 921600, 0x343688e8
+0, 1680, 1680, 1, 921600, 0x343688e8
+0, 1720, 1720, 1, 921600, 0x343688e8
+0, 1760, 1760, 1, 921600, 0x343688e8
+0, 1800, 1800, 1, 921600, 0xe4b29d57
+0, 1840, 1840, 1, 921600, 0xe4b29d57
+0, 1880, 1880, 1, 921600, 0xe4b29d57
+0, 1920, 1920, 1, 921600, 0x198e8a4a
+0, 1960, 1960, 1, 921600, 0x198e8a4a
+0, 2000, 2000, 1, 921600, 0x0cad8dc9
+0, 2040, 2040, 1, 921600, 0x0cad8dc9
+0, 2080, 2080, 1, 921600, 0x0cad8dc9
+0, 2120, 2120, 1, 921600, 0x1f74cf3d
+0, 2160, 2160, 1, 921600, 0x1f74cf3d
+0, 2200, 2200, 1, 921600, 0xec5b5449
+0, 2240, 2240, 1, 921600, 0xec5b5449
+0, 2280, 2280, 1, 921600, 0xec5b5449
+0, 2320, 2320, 1, 921600, 0x39829711
+0, 2360, 2360, 1, 921600, 0x39829711
+0, 2400, 2400, 1, 921600, 0x6de5b9c6
+0, 2440, 2440, 1, 921600, 0x6de5b9c6
+0, 2480, 2480, 1, 921600, 0x6de5b9c6
+0, 2520, 2520, 1, 921600, 0x47b0e9d4
+0, 2560, 2560, 1, 921600, 0x47b0e9d4
+0, 2600, 2600, 1, 921600, 0x756452b8
+0, 2640, 2640, 1, 921600, 0x756452b8
+0, 2680, 2680, 1, 921600, 0x756452b8
+0, 2720, 2720, 1, 921600, 0x6fce3478
+0, 2760, 2760, 1, 921600, 0x6fce3478
+0, 2800, 2800, 1, 921600, 0x372397cd
+0, 2840, 2840, 1, 921600, 0x372397cd
+0, 2880, 2880, 1, 921600, 0x372397cd
+0, 2920, 2920, 1, 921600, 0xe3999ba1
+0, 2960, 2960, 1, 921600, 0xe3999ba1
+0, 3000, 3000, 1, 921600, 0x6ba26b43
+0, 3040, 3040, 1, 921600, 0x6ba26b43
+0, 3080, 3080, 1, 921600, 0x6ba26b43
+0, 3120, 3120, 1, 921600, 0x4e9ee49e
+0, 3160, 3160, 1, 921600, 0x4e9ee49e
+0, 3200, 3200, 1, 921600, 0xdb5fd6e7
+0, 3240, 3240, 1, 921600, 0xdb5fd6e7
+0, 3280, 3280, 1, 921600, 0xdb5fd6e7
+0, 3320, 3320, 1, 921600, 0x8f2254a5
+0, 3360, 3360, 1, 921600, 0x8f2254a5
+0, 3400, 3400, 1, 921600, 0x8f2254a5
+0, 3440, 3440, 1, 921600, 0x8f2254a5
+0, 3480, 3480, 1, 921600, 0x8f2254a5
+0, 3520, 3520, 1, 921600, 0x8f2254a5
+0, 3560, 3560, 1, 921600, 0x8f2254a5
+0, 3600, 3600, 1, 921600, 0x8f2254a5
+0, 3640, 3640, 1, 921600, 0x8f2254a5
+0, 3680, 3680, 1, 921600, 0x8f2254a5
+0, 3720, 3720, 1, 921600, 0x57e95c32
+0, 3760, 3760, 1, 921600, 0x57e95c32
+0, 3800, 3800, 1, 921600, 0x41627a9b
+0, 3840, 3840, 1, 921600, 0x41627a9b
+0, 3880, 3880, 1, 921600, 0x41627a9b
+0, 3920, 3920, 1, 921600, 0x7412dcee
+0, 3960, 3960, 1, 921600, 0x7412dcee
+0, 4000, 4000, 1, 921600, 0xaebe10ed
+0, 4040, 4040, 1, 921600, 0xaebe10ed
+0, 4080, 4080, 1, 921600, 0xaebe10ed
+0, 4120, 4120, 1, 921600, 0x411a91f6
+0, 4160, 4160, 1, 921600, 0x411a91f6
+0, 4200, 4200, 1, 921600, 0xb059df3f
+0, 4240, 4240, 1, 921600, 0xb059df3f
+0, 4280, 4280, 1, 921600, 0xb059df3f
+0, 4320, 4320, 1, 921600, 0x4d6f5a77
+0, 4360, 4360, 1, 921600, 0x4d6f5a77
+0, 4400, 4400, 1, 921600, 0xbbf06df4
+0, 4440, 4440, 1, 921600, 0xbbf06df4
+0, 4480, 4480, 1, 921600, 0xbbf06df4
+0, 4520, 4520, 1, 921600, 0xe27f7bf6
+0, 4560, 4560, 1, 921600, 0xe27f7bf6
+0, 4600, 4600, 1, 921600, 0xd7e8360e
+0, 4640, 4640, 1, 921600, 0xd7e8360e
+0, 4680, 4680, 1, 921600, 0xd7e8360e
+0, 4720, 4720, 1, 921600, 0x1dd4c344
+0, 4760, 4760, 1, 921600, 0x1dd4c344
+0, 4800, 4800, 1, 921600, 0x7995a7ce
+0, 4840, 4840, 1, 921600, 0x7995a7ce
+0, 4880, 4880, 1, 921600, 0x7995a7ce
+0, 4920, 4920, 1, 921600, 0x2ef3c566
+0, 4960, 4960, 1, 921600, 0x2ef3c566
+0, 5000, 5000, 1, 921600, 0xf296736e
+0, 5040, 5040, 1, 921600, 0xf296736e
+0, 5080, 5080, 1, 921600, 0xf296736e
+0, 5120, 5120, 1, 921600, 0xf296736e
+0, 5160, 5160, 1, 921600, 0xf296736e
+0, 5200, 5200, 1, 921600, 0xf296736e
+0, 5240, 5240, 1, 921600, 0xf296736e
+0, 5280, 5280, 1, 921600, 0xf296736e
+0, 5320, 5320, 1, 921600, 0xf296736e
+0, 5360, 5360, 1, 921600, 0xf296736e
+0, 5400, 5400, 1, 921600, 0x1a488311
+0, 5440, 5440, 1, 921600, 0x1a488311
+0, 5480, 5480, 1, 921600, 0x1a488311
+0, 5520, 5520, 1, 921600, 0x9e28011b
+0, 5560, 5560, 1, 921600, 0x9e28011b
+0, 5600, 5600, 1, 921600, 0x84d1ea80
+0, 5640, 5640, 1, 921600, 0x84d1ea80
+0, 5680, 5680, 1, 921600, 0x84d1ea80
+0, 5720, 5720, 1, 921600, 0x9ed41052
+0, 5760, 5760, 1, 921600, 0x9ed41052
+0, 5800, 5800, 1, 921600, 0xd4db7206
+0, 5840, 5840, 1, 921600, 0xd4db7206
+0, 5880, 5880, 1, 921600, 0xd4db7206
+0, 5920, 5920, 1, 921600, 0x55f695a9
+0, 5960, 5960, 1, 921600, 0x55f695a9
+0, 6000, 6000, 1, 921600, 0x9d8c667f
+0, 6040, 6040, 1, 921600, 0x9d8c667f
+0, 6080, 6080, 1, 921600, 0x9d8c667f
+0, 6120, 6120, 1, 921600, 0x9b6037ec
+0, 6160, 6160, 1, 921600, 0x9b6037ec
+0, 6200, 6200, 1, 921600, 0x57c5e835
+0, 6240, 6240, 1, 921600, 0x57c5e835
+0, 6280, 6280, 1, 921600, 0x57c5e835
+0, 6320, 6320, 1, 921600, 0x476dad89
+0, 6360, 6360, 1, 921600, 0x476dad89
+0, 6400, 6400, 1, 921600, 0xcfd6ad2b
+0, 6440, 6440, 1, 921600, 0xcfd6ad2b
+0, 6480, 6480, 1, 921600, 0xcfd6ad2b
+0, 6520, 6520, 1, 921600, 0x3b372379
+0, 6560, 6560, 1, 921600, 0x3b372379
+0, 6600, 6600, 1, 921600, 0x36f245f5
+0, 6620, 6620, 1, 921600, 0x36f245f5
diff --git a/gst-libs/ext/libav/tests/ref/fate/quickdraw b/gst-libs/ext/libav/tests/ref/fate/quickdraw
index 5d6303b..9a55ad5 100644
--- a/gst-libs/ext/libav/tests/ref/fate/quickdraw
+++ b/gst-libs/ext/libav/tests/ref/fate/quickdraw
@@ -1,2 +1,3 @@
-0, 0, 921600, 0xc0e68764
-0, 6000, 921600, 0x01a16629
+#tb 0: 1/600
+0, 0, 0, 1, 921600, 0xc0e68764
+0, 80, 80, 1, 921600, 0x01a16629
diff --git a/gst-libs/ext/libav/tests/ref/fate/r210 b/gst-libs/ext/libav/tests/ref/fate/r210
index 238a136..45bb10c 100644
--- a/gst-libs/ext/libav/tests/ref/fate/r210
+++ b/gst-libs/ext/libav/tests/ref/fate/r210
@@ -1,3 +1,4 @@
-0, 0, 1843200, 0xbd414b93
-0, 3003, 1843200, 0x23298f1f
-0, 6006, 1843200, 0x5a56df19
+#tb 0: 1001/30000
+0, 0, 0, 1, 1843200, 0xbd414b93
+0, 1, 1, 1, 1843200, 0x23298f1f
+0, 2, 2, 1, 1843200, 0x5a56df19
diff --git a/gst-libs/ext/libav/tests/ref/fate/real-14_4 b/gst-libs/ext/libav/tests/ref/fate/ra-144
index 4710566..4710566 100644
--- a/gst-libs/ext/libav/tests/ref/fate/real-14_4
+++ b/gst-libs/ext/libav/tests/ref/fate/ra-144
diff --git a/gst-libs/ext/libav/tests/ref/fate/ralf b/gst-libs/ext/libav/tests/ref/fate/ralf
new file mode 100644
index 0000000..fb31c3f
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/ralf
@@ -0,0 +1 @@
+10da0398e06a470a0b97817fe113abcb
diff --git a/gst-libs/ext/libav/tests/ref/fate/real-rv40 b/gst-libs/ext/libav/tests/ref/fate/real-rv40
deleted file mode 100644
index c63c525..0000000
--- a/gst-libs/ext/libav/tests/ref/fate/real-rv40
+++ /dev/null
@@ -1,240 +0,0 @@
-0, 0, 276480, 0x5f7a0d4f
-0, 3754, 276480, 0x5f7a0d4f
-0, 7507, 276480, 0x5f7a0d4f
-0, 11261, 276480, 0x5f7a0d4f
-0, 15015, 276480, 0x5f7a0d4f
-0, 18769, 276480, 0x5f7a0d4f
-0, 22522, 276480, 0x5f7a0d4f
-0, 26276, 276480, 0x5f7a0d4f
-0, 30030, 276480, 0x5f7a0d4f
-0, 33784, 276480, 0x5f7a0d4f
-0, 37537, 276480, 0x5f7a0d4f
-0, 41291, 276480, 0x5f7a0d4f
-0, 45045, 276480, 0x5f7a0d4f
-0, 48799, 276480, 0x5f7a0d4f
-0, 52552, 276480, 0x5f7a0d4f
-0, 56306, 276480, 0x5f7a0d4f
-0, 60060, 276480, 0x5f7a0d4f
-0, 63814, 276480, 0x5f7a0d4f
-0, 67567, 276480, 0x5f7a0d4f
-0, 71321, 276480, 0x5f7a0d4f
-0, 75075, 276480, 0x5f7a0d4f
-0, 78829, 276480, 0x5f7a0d4f
-0, 82582, 276480, 0x5f7a0d4f
-0, 86336, 276480, 0x5f7a0d4f
-0, 90090, 276480, 0x5f7a0d4f
-0, 93844, 276480, 0x5f7a0d4f
-0, 97597, 276480, 0x5f7a0d4f
-0, 101351, 276480, 0x5f7a0d4f
-0, 105105, 276480, 0x5f7a0d4f
-0, 108859, 276480, 0x5f7a0d4f
-0, 112612, 276480, 0x5f7a0d4f
-0, 116366, 276480, 0x5f7a0d4f
-0, 120120, 276480, 0x5f7a0d4f
-0, 123874, 276480, 0x75641594
-0, 127627, 276480, 0x32ee3526
-0, 131381, 276480, 0xcb53479a
-0, 135135, 276480, 0x7ca9658e
-0, 138889, 276480, 0x5ce39368
-0, 142642, 276480, 0x4ec1e418
-0, 146396, 276480, 0xb3790499
-0, 150150, 276480, 0xa9f1506f
-0, 153904, 276480, 0x85cbc3b5
-0, 157657, 276480, 0x377c7b46
-0, 161411, 276480, 0x1a61d8db
-0, 165165, 276480, 0xe1de7f0a
-0, 168919, 276480, 0x756a4a2e
-0, 172672, 276480, 0xcb379547
-0, 176426, 276480, 0xbae14484
-0, 180180, 276480, 0x8e12331c
-0, 183934, 276480, 0x99c085be
-0, 187687, 276480, 0xe479ffed
-0, 191441, 276480, 0x99c82949
-0, 195195, 276480, 0xac7672dd
-0, 198949, 276480, 0x1e4fae19
-0, 202702, 276480, 0x776412ef
-0, 206456, 276480, 0x7d9b579f
-0, 210210, 276480, 0x1cd1ab29
-0, 213964, 276480, 0x58ce0f38
-0, 217717, 276480, 0x5ab69b27
-0, 221471, 276480, 0x0afad610
-0, 225225, 276480, 0x9eca3f11
-0, 228979, 276480, 0xc3db9706
-0, 232732, 276480, 0xc9c57884
-0, 236486, 276480, 0xd9fbb2cf
-0, 240240, 276480, 0xdc07f3c9
-0, 243994, 276480, 0x000b5269
-0, 247747, 276480, 0x27ff7a5d
-0, 251501, 276480, 0xd92e2017
-0, 255255, 276480, 0x18d4b27d
-0, 259009, 276480, 0x70647530
-0, 262762, 276480, 0x97612c4b
-0, 266516, 276480, 0xc9d4ac78
-0, 270270, 276480, 0x4ec4d57f
-0, 274024, 276480, 0xdf4e04d7
-0, 277777, 276480, 0xbd98f57c
-0, 281531, 276480, 0x7247ea3e
-0, 285285, 276480, 0xa5d670ec
-0, 289039, 276480, 0x5163b29b
-0, 292792, 276480, 0x99170e64
-0, 296546, 276480, 0x37f4c0b0
-0, 300300, 276480, 0x7a4f2561
-0, 304053, 276480, 0x8a4e991f
-0, 307807, 276480, 0x6a45425f
-0, 311561, 276480, 0x1f0e2bb6
-0, 315315, 276480, 0xd75482c6
-0, 319068, 276480, 0x7bf6b1ef
-0, 322822, 276480, 0x6de1e34b
-0, 326576, 276480, 0x4526c89b
-0, 330330, 276480, 0xf964e18e
-0, 334083, 276480, 0xdcaaa99a
-0, 337837, 276480, 0xd1e98808
-0, 341591, 276480, 0x556b2365
-0, 345345, 276480, 0x0cf65540
-0, 349098, 276480, 0x6e2d524e
-0, 352852, 276480, 0x22c50a3d
-0, 356606, 276480, 0x293f19af
-0, 360360, 276480, 0xf4b1c461
-0, 364113, 276480, 0x62b76407
-0, 367867, 276480, 0x51e9b3eb
-0, 371621, 276480, 0x7b910bc7
-0, 375375, 276480, 0x6dd14ca6
-0, 379128, 276480, 0x441f7afd
-0, 382882, 276480, 0xfb01efc6
-0, 386636, 276480, 0x4f73ccea
-0, 390390, 276480, 0x5ac8e06f
-0, 394143, 276480, 0x294bb441
-0, 397897, 276480, 0xe04ac45e
-0, 401651, 276480, 0xa7a38d41
-0, 405405, 276480, 0xf688a3ed
-0, 409158, 276480, 0x58f275ea
-0, 412912, 276480, 0xf0b3b71b
-0, 416666, 276480, 0x3ce773bf
-0, 420420, 276480, 0x01840548
-0, 424173, 276480, 0x674e34e4
-0, 427927, 276480, 0x41dda2d9
-0, 431681, 276480, 0xc5b60838
-0, 435435, 276480, 0x9b209f41
-0, 439188, 276480, 0xf46ba7fb
-0, 442942, 276480, 0x28b54815
-0, 446696, 276480, 0xb605a933
-0, 450450, 276480, 0x34484aff
-0, 454203, 276480, 0xaf2b5d89
-0, 457957, 276480, 0x8facba58
-0, 461711, 276480, 0xbbe3e99f
-0, 465465, 276480, 0x02162c7c
-0, 469218, 276480, 0x28a63236
-0, 472972, 276480, 0x1ad43fd7
-0, 476726, 276480, 0xe37883e5
-0, 480480, 276480, 0x2b8a89c5
-0, 484233, 276480, 0x71507bd2
-0, 487987, 276480, 0x35626022
-0, 491741, 276480, 0x461fc3e7
-0, 495495, 276480, 0xce5af1ec
-0, 499248, 276480, 0x7c1139b3
-0, 503002, 276480, 0x7fd73a99
-0, 506756, 276480, 0x4ae4c3a6
-0, 510510, 276480, 0xcb60725a
-0, 514263, 276480, 0xb52e1aa2
-0, 518017, 276480, 0xd6f82cae
-0, 521771, 276480, 0x6310e665
-0, 525525, 276480, 0xfa88a483
-0, 529278, 276480, 0xf88f75d4
-0, 533032, 276480, 0x04a8e3ee
-0, 536786, 276480, 0x54766a12
-0, 540540, 276480, 0x0b41f0d7
-0, 544293, 276480, 0xa29f5b01
-0, 548047, 276480, 0x754ceaf5
-0, 551801, 276480, 0x150c0423
-0, 555555, 276480, 0xde084059
-0, 559308, 276480, 0x5a38b4af
-0, 563062, 276480, 0xfcebc261
-0, 566816, 276480, 0x0eb9770d
-0, 570570, 276480, 0x046394ae
-0, 574323, 276480, 0x3d3ca985
-0, 578077, 276480, 0x94a03c75
-0, 581831, 276480, 0x800eea2d
-0, 585585, 276480, 0x6a841f41
-0, 589338, 276480, 0x2f98911c
-0, 593092, 276480, 0x923b9937
-0, 596846, 276480, 0xe82f8e0f
-0, 600600, 276480, 0xee82d657
-0, 604353, 276480, 0xefab7ffd
-0, 608107, 276480, 0x6b9fbc80
-0, 611861, 276480, 0x4a1ada47
-0, 615614, 276480, 0x6d4b49d7
-0, 619368, 276480, 0xe4bdbd1e
-0, 623122, 276480, 0x225a56c0
-0, 626876, 276480, 0xd4adadad
-0, 630629, 276480, 0xff4e1a8c
-0, 634383, 276480, 0xf58b1b7c
-0, 638137, 276480, 0xbaffcdcc
-0, 641891, 276480, 0x374f88f0
-0, 645644, 276480, 0x3d861ae6
-0, 649398, 276480, 0xeb6eb88f
-0, 653152, 276480, 0xdb753d35
-0, 656906, 276480, 0x9aa543af
-0, 660659, 276480, 0xb24c8016
-0, 664413, 276480, 0xea80a82e
-0, 668167, 276480, 0x2aae902a
-0, 671921, 276480, 0x5bba3cfb
-0, 675674, 276480, 0x5c6e97a9
-0, 679428, 276480, 0x9b9ee961
-0, 683182, 276480, 0xaa12b6fd
-0, 686936, 276480, 0xe9d2439f
-0, 690689, 276480, 0xbf09053c
-0, 694443, 276480, 0x50c31e73
-0, 698197, 276480, 0xdd9fb89f
-0, 701951, 276480, 0x3e4e5aec
-0, 705704, 276480, 0x0b752d28
-0, 709458, 276480, 0xaf82399a
-0, 713212, 276480, 0x7ce5f23c
-0, 716966, 276480, 0xad135d0f
-0, 720719, 276480, 0x55dadd30
-0, 724473, 276480, 0x5aaa7519
-0, 728227, 276480, 0xe45a5599
-0, 731981, 276480, 0xc8e89913
-0, 735734, 276480, 0x2f447fd3
-0, 739488, 276480, 0x704411fb
-0, 743242, 276480, 0x9d7430a1
-0, 746996, 276480, 0x24dd5fd3
-0, 750749, 276480, 0x51cb657c
-0, 754503, 276480, 0x2c230702
-0, 758257, 276480, 0x4a4f76cd
-0, 762011, 276480, 0xdcd71e88
-0, 765764, 276480, 0x87160f99
-0, 769518, 276480, 0x27f54854
-0, 773272, 276480, 0x694d76e3
-0, 777026, 276480, 0xcbe93c19
-0, 780779, 276480, 0x50742e1b
-0, 784533, 276480, 0x525463e2
-0, 788287, 276480, 0x819898f9
-0, 792041, 276480, 0x08fac755
-0, 795794, 276480, 0x35c46927
-0, 799548, 276480, 0xeeed00fc
-0, 803302, 276480, 0xb6f99ee3
-0, 807056, 276480, 0xd87f4c73
-0, 810809, 276480, 0xde97d9fd
-0, 814563, 276480, 0xefc83107
-0, 818317, 276480, 0xbb22e024
-0, 822071, 276480, 0x53a7cfcb
-0, 825824, 276480, 0xbe1fbb19
-0, 829578, 276480, 0x300f922a
-0, 833332, 276480, 0x826fc3bd
-0, 837086, 276480, 0x679aa57a
-0, 840839, 276480, 0x5497097b
-0, 844593, 276480, 0x679a53f8
-0, 848347, 276480, 0x976c9e93
-0, 852101, 276480, 0xe80f87f2
-0, 855854, 276480, 0xdc2d7c6c
-0, 859608, 276480, 0xb194656e
-0, 863362, 276480, 0xf002c5ca
-0, 867116, 276480, 0x43fc1c64
-0, 870869, 276480, 0xf62d8581
-0, 874623, 276480, 0xb243dda5
-0, 878377, 276480, 0x1700efbb
-0, 882131, 276480, 0x9ebe6ba2
-0, 885884, 276480, 0x8f316c66
-0, 889638, 276480, 0x6348ecf5
-0, 893392, 276480, 0x34b5b78a
-0, 897146, 276480, 0xcbf66922
diff --git a/gst-libs/ext/libav/tests/ref/fate/redcode-demux b/gst-libs/ext/libav/tests/ref/fate/redcode-demux
index 2a4db65..34a2924 100644
--- a/gst-libs/ext/libav/tests/ref/fate/redcode-demux
+++ b/gst-libs/ext/libav/tests/ref/fate/redcode-demux
@@ -1,5 +1,7 @@
-0, 0, 1626280, 0x5768c7d6
-1, 0, 14816, 0xd185e8c7
-0, 3754, 1626092, 0x070bd882
-1, 6803, 32736, 0x791b737a
-0, 7508, 893932, 0x8c7cd0a6
+#tb 0: 1/240000
+#tb 1: 1/240000
+0, 0, 0, 10010, 1626280, 0x5768c7d6
+1, 0, 0, 18140, 14816, 0xd185e8c7
+0, 10010, 10010, 10010, 1626092, 0x070bd882
+1, 18140, 18140, 40920, 32736, 0x791b737a
+0, 20020, 20020, 10010, 893932, 0x8c7cd0a6
diff --git a/gst-libs/ext/libav/tests/ref/fate/rl2 b/gst-libs/ext/libav/tests/ref/fate/rl2
index 7a2146d..d7dd23d 100644
--- a/gst-libs/ext/libav/tests/ref/fate/rl2
+++ b/gst-libs/ext/libav/tests/ref/fate/rl2
@@ -1,108 +1,109 @@
-0, 0, 192000, 0x7112a667
-0, 9559, 192000, 0x6936abf3
-0, 19118, 192000, 0xb1f08981
-0, 28678, 192000, 0x4ce7fece
-0, 38237, 192000, 0xf04decde
-0, 47796, 192000, 0x47fef74b
-0, 57355, 192000, 0x99b42ac2
-0, 66914, 192000, 0x3c4c419d
-0, 76473, 192000, 0x66bf5588
-0, 86033, 192000, 0xe1de4725
-0, 95592, 192000, 0x348b2af9
-0, 105151, 192000, 0x1ce73e83
-0, 114710, 192000, 0xcdaa6e02
-0, 124269, 192000, 0x370dc2ce
-0, 133829, 192000, 0x1e1e40fe
-0, 143388, 192000, 0x491470a4
-0, 152947, 192000, 0x88c43e9a
-0, 162506, 192000, 0x036f3f44
-0, 172065, 192000, 0xc8be7e25
-0, 181624, 192000, 0xbedb397d
-0, 191184, 192000, 0x97c410f4
-0, 200743, 192000, 0xc2c8225d
-0, 210302, 192000, 0xe396bccb
-0, 219861, 192000, 0x7e89c24c
-0, 229420, 192000, 0xb044954c
-0, 238980, 192000, 0x335890dd
-0, 248539, 192000, 0x58a457c0
-0, 258098, 192000, 0xeb0f4798
-0, 267657, 192000, 0x0bfc39a1
-0, 277216, 192000, 0x06a6905a
-0, 286776, 192000, 0x5300c99b
-0, 296335, 192000, 0x38f3f845
-0, 305894, 192000, 0x6afa3543
-0, 315453, 192000, 0x5106a8e0
-0, 325012, 192000, 0xc76f0dab
-0, 334571, 192000, 0x8efa6939
-0, 344131, 192000, 0x64ea23d7
-0, 353690, 192000, 0x421a2817
-0, 363249, 192000, 0xc854fa18
-0, 372808, 192000, 0x4a10d59c
-0, 382367, 192000, 0x72637829
-0, 391927, 192000, 0xdbbe2796
-0, 401486, 192000, 0xff742e6b
-0, 411045, 192000, 0xf94b9346
-0, 420604, 192000, 0xc90ea53c
-0, 430163, 192000, 0x177483bb
-0, 439722, 192000, 0x3510369c
-0, 449282, 192000, 0x501034bf
-0, 458841, 192000, 0x315c744b
-0, 468400, 192000, 0xdb5048ae
-0, 477959, 192000, 0x09a86221
-0, 487518, 192000, 0xb9c9568a
-0, 497078, 192000, 0x5eee665b
-0, 506637, 192000, 0xdef85517
-0, 516196, 192000, 0x7896b5ad
-0, 525755, 192000, 0x19fbad39
-0, 535314, 192000, 0x63358748
-0, 544873, 192000, 0xca0196a3
-0, 554433, 192000, 0x0b321da3
-0, 563992, 192000, 0xa07af07e
-0, 573551, 192000, 0x21f9310c
-0, 583110, 192000, 0x62d59874
-0, 592669, 192000, 0x021227b4
-0, 602229, 192000, 0x01dac0c2
-0, 611788, 192000, 0xf3c33a74
-0, 621347, 192000, 0xeebe83b7
-0, 630906, 192000, 0x9ec77f97
-0, 640465, 192000, 0xc91c2e37
-0, 650024, 192000, 0x7b58751d
-0, 659584, 192000, 0xb178dfbb
-0, 669143, 192000, 0x2a63b5be
-0, 678702, 192000, 0x44a407ac
-0, 688261, 192000, 0x9a8e17dd
-0, 697820, 192000, 0x5546f4c8
-0, 707380, 192000, 0xeda94586
-0, 716939, 192000, 0x941dfa6b
-0, 726498, 192000, 0x9772301d
-0, 736057, 192000, 0x8be16b16
-0, 745616, 192000, 0x26dd4496
-0, 755176, 192000, 0x27823797
-0, 764735, 192000, 0xacc914f7
-0, 774294, 192000, 0xcbb72c9b
-0, 783853, 192000, 0x4bd3391c
-0, 793412, 192000, 0x4e6adbfe
-0, 802971, 192000, 0x7a791c75
-0, 812531, 192000, 0xc4f59c94
-0, 822090, 192000, 0xc4f59c94
-0, 831649, 192000, 0x984a4a0b
-0, 841208, 192000, 0x3353f31f
-0, 850767, 192000, 0xa9d4dc5a
-0, 860327, 192000, 0xb33425d0
-0, 869886, 192000, 0x546d768a
-0, 879445, 192000, 0xfefbe5c9
-0, 889004, 192000, 0xbd6be61d
-0, 898563, 192000, 0xf5792731
-0, 908122, 192000, 0xccde0582
-0, 917682, 192000, 0x857d58ee
-0, 927241, 192000, 0xe914ce48
-0, 936800, 192000, 0x1f736298
-0, 946359, 192000, 0xec0b4846
-0, 955918, 192000, 0xe1422624
-0, 965478, 192000, 0x56e2b0e0
-0, 975037, 192000, 0xc4190640
-0, 984596, 192000, 0x7c461977
-0, 994155, 192000, 0x34b1d5e8
-0, 1003714, 192000, 0xbdc70f7a
-0, 1013273, 192000, 0xb466cd8d
-0, 1022833, 192000, 0x0e86a04c
+#tb 0: 1171/11025
+0, 0, 0, 1, 192000, 0x7112a667
+0, 1, 1, 1, 192000, 0x6936abf3
+0, 2, 2, 1, 192000, 0xb1f08981
+0, 3, 3, 1, 192000, 0x4ce7fece
+0, 4, 4, 1, 192000, 0xf04decde
+0, 5, 5, 1, 192000, 0x47fef74b
+0, 6, 6, 1, 192000, 0x99b42ac2
+0, 7, 7, 1, 192000, 0x3c4c419d
+0, 8, 8, 1, 192000, 0x66bf5588
+0, 9, 9, 1, 192000, 0xe1de4725
+0, 10, 10, 1, 192000, 0x348b2af9
+0, 11, 11, 1, 192000, 0x1ce73e83
+0, 12, 12, 1, 192000, 0xcdaa6e02
+0, 13, 13, 1, 192000, 0x370dc2ce
+0, 14, 14, 1, 192000, 0x1e1e40fe
+0, 15, 15, 1, 192000, 0x491470a4
+0, 16, 16, 1, 192000, 0x88c43e9a
+0, 17, 17, 1, 192000, 0x036f3f44
+0, 18, 18, 1, 192000, 0xc8be7e25
+0, 19, 19, 1, 192000, 0xbedb397d
+0, 20, 20, 1, 192000, 0x97c410f4
+0, 21, 21, 1, 192000, 0xc2c8225d
+0, 22, 22, 1, 192000, 0xe396bccb
+0, 23, 23, 1, 192000, 0x7e89c24c
+0, 24, 24, 1, 192000, 0xb044954c
+0, 25, 25, 1, 192000, 0x335890dd
+0, 26, 26, 1, 192000, 0x58a457c0
+0, 27, 27, 1, 192000, 0xeb0f4798
+0, 28, 28, 1, 192000, 0x0bfc39a1
+0, 29, 29, 1, 192000, 0x06a6905a
+0, 30, 30, 1, 192000, 0x5300c99b
+0, 31, 31, 1, 192000, 0x38f3f845
+0, 32, 32, 1, 192000, 0x6afa3543
+0, 33, 33, 1, 192000, 0x5106a8e0
+0, 34, 34, 1, 192000, 0xc76f0dab
+0, 35, 35, 1, 192000, 0x8efa6939
+0, 36, 36, 1, 192000, 0x64ea23d7
+0, 37, 37, 1, 192000, 0x421a2817
+0, 38, 38, 1, 192000, 0xc854fa18
+0, 39, 39, 1, 192000, 0x4a10d59c
+0, 40, 40, 1, 192000, 0x72637829
+0, 41, 41, 1, 192000, 0xdbbe2796
+0, 42, 42, 1, 192000, 0xff742e6b
+0, 43, 43, 1, 192000, 0xf94b9346
+0, 44, 44, 1, 192000, 0xc90ea53c
+0, 45, 45, 1, 192000, 0x177483bb
+0, 46, 46, 1, 192000, 0x3510369c
+0, 47, 47, 1, 192000, 0x501034bf
+0, 48, 48, 1, 192000, 0x315c744b
+0, 49, 49, 1, 192000, 0xdb5048ae
+0, 50, 50, 1, 192000, 0x09a86221
+0, 51, 51, 1, 192000, 0xb9c9568a
+0, 52, 52, 1, 192000, 0x5eee665b
+0, 53, 53, 1, 192000, 0xdef85517
+0, 54, 54, 1, 192000, 0x7896b5ad
+0, 55, 55, 1, 192000, 0x19fbad39
+0, 56, 56, 1, 192000, 0x63358748
+0, 57, 57, 1, 192000, 0xca0196a3
+0, 58, 58, 1, 192000, 0x0b321da3
+0, 59, 59, 1, 192000, 0xa07af07e
+0, 60, 60, 1, 192000, 0x21f9310c
+0, 61, 61, 1, 192000, 0x62d59874
+0, 62, 62, 1, 192000, 0x021227b4
+0, 63, 63, 1, 192000, 0x01dac0c2
+0, 64, 64, 1, 192000, 0xf3c33a74
+0, 65, 65, 1, 192000, 0xeebe83b7
+0, 66, 66, 1, 192000, 0x9ec77f97
+0, 67, 67, 1, 192000, 0xc91c2e37
+0, 68, 68, 1, 192000, 0x7b58751d
+0, 69, 69, 1, 192000, 0xb178dfbb
+0, 70, 70, 1, 192000, 0x2a63b5be
+0, 71, 71, 1, 192000, 0x44a407ac
+0, 72, 72, 1, 192000, 0x9a8e17dd
+0, 73, 73, 1, 192000, 0x5546f4c8
+0, 74, 74, 1, 192000, 0xeda94586
+0, 75, 75, 1, 192000, 0x941dfa6b
+0, 76, 76, 1, 192000, 0x9772301d
+0, 77, 77, 1, 192000, 0x8be16b16
+0, 78, 78, 1, 192000, 0x26dd4496
+0, 79, 79, 1, 192000, 0x27823797
+0, 80, 80, 1, 192000, 0xacc914f7
+0, 81, 81, 1, 192000, 0xcbb72c9b
+0, 82, 82, 1, 192000, 0x4bd3391c
+0, 83, 83, 1, 192000, 0x4e6adbfe
+0, 84, 84, 1, 192000, 0x7a791c75
+0, 85, 85, 1, 192000, 0xc4f59c94
+0, 86, 86, 1, 192000, 0xc4f59c94
+0, 87, 87, 1, 192000, 0x984a4a0b
+0, 88, 88, 1, 192000, 0x3353f31f
+0, 89, 89, 1, 192000, 0xa9d4dc5a
+0, 90, 90, 1, 192000, 0xb33425d0
+0, 91, 91, 1, 192000, 0x546d768a
+0, 92, 92, 1, 192000, 0xfefbe5c9
+0, 93, 93, 1, 192000, 0xbd6be61d
+0, 94, 94, 1, 192000, 0xf5792731
+0, 95, 95, 1, 192000, 0xccde0582
+0, 96, 96, 1, 192000, 0x857d58ee
+0, 97, 97, 1, 192000, 0xe914ce48
+0, 98, 98, 1, 192000, 0x1f736298
+0, 99, 99, 1, 192000, 0xec0b4846
+0, 100, 100, 1, 192000, 0xe1422624
+0, 101, 101, 1, 192000, 0x56e2b0e0
+0, 102, 102, 1, 192000, 0xc4190640
+0, 103, 103, 1, 192000, 0x7c461977
+0, 104, 104, 1, 192000, 0x34b1d5e8
+0, 105, 105, 1, 192000, 0xbdc70f7a
+0, 106, 106, 1, 192000, 0xb466cd8d
+0, 107, 107, 1, 192000, 0x0e86a04c
diff --git a/gst-libs/ext/libav/tests/ref/fate/roqvideo b/gst-libs/ext/libav/tests/ref/fate/roqvideo
new file mode 100644
index 0000000..9febedb
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/roqvideo
@@ -0,0 +1,211 @@
+#tb 0: 1/30
+0, 0, 0, 1, 393216, 0x56995aac
+0, 1, 1, 1, 393216, 0xf9ed5d6c
+0, 2, 2, 1, 393216, 0xd3285d75
+0, 3, 3, 1, 393216, 0x82d15d62
+0, 4, 4, 1, 393216, 0x893e5d6f
+0, 5, 5, 1, 393216, 0x82d15d62
+0, 6, 6, 1, 393216, 0x893e5d6f
+0, 7, 7, 1, 393216, 0x82d15d62
+0, 8, 8, 1, 393216, 0x893e5d6f
+0, 9, 9, 1, 393216, 0x82d15d62
+0, 10, 10, 1, 393216, 0x893e5d6f
+0, 11, 11, 1, 393216, 0x82d15d62
+0, 12, 12, 1, 393216, 0x893e5d6f
+0, 13, 13, 1, 393216, 0x82d15d62
+0, 14, 14, 1, 393216, 0x893e5d6f
+0, 15, 15, 1, 393216, 0x82d15d62
+0, 16, 16, 1, 393216, 0x2ae39eca
+0, 17, 17, 1, 393216, 0x9254be70
+0, 18, 18, 1, 393216, 0x4b2ed384
+0, 19, 19, 1, 393216, 0xbbd9d8f7
+0, 20, 20, 1, 393216, 0x1f2be0c3
+0, 21, 21, 1, 393216, 0x2434eb25
+0, 22, 22, 1, 393216, 0xa6cced4e
+0, 23, 23, 1, 393216, 0xd116f38b
+0, 24, 24, 1, 393216, 0x6b86f380
+0, 25, 25, 1, 393216, 0xc1b3f8e9
+0, 26, 26, 1, 393216, 0x2993fd5d
+0, 27, 27, 1, 393216, 0xf489fe18
+0, 28, 28, 1, 393216, 0x9ef10501
+0, 29, 29, 1, 393216, 0x8faf0512
+0, 30, 30, 1, 393216, 0xa54d0736
+0, 31, 31, 1, 393216, 0xf4ef01e0
+0, 32, 32, 1, 393216, 0xe241ef51
+0, 33, 33, 1, 393216, 0xcc38e51f
+0, 34, 34, 1, 393216, 0xb1345876
+0, 35, 35, 1, 393216, 0xf9b0968b
+0, 36, 36, 1, 393216, 0x6bb1523f
+0, 37, 37, 1, 393216, 0x83469a05
+0, 38, 38, 1, 393216, 0x73e30882
+0, 39, 39, 1, 393216, 0x8673da66
+0, 40, 40, 1, 393216, 0xb67596d3
+0, 41, 41, 1, 393216, 0xf7638710
+0, 42, 42, 1, 393216, 0x813a8f47
+0, 43, 43, 1, 393216, 0xb3526555
+0, 44, 44, 1, 393216, 0x1b167be3
+0, 45, 45, 1, 393216, 0x99114562
+0, 46, 46, 1, 393216, 0xfafb0693
+0, 47, 47, 1, 393216, 0x121d96c8
+0, 48, 48, 1, 393216, 0xb3c68c5d
+0, 49, 49, 1, 393216, 0x2035b97f
+0, 50, 50, 1, 393216, 0xfbcaeb62
+0, 51, 51, 1, 393216, 0xfd5aea5d
+0, 52, 52, 1, 393216, 0x66efbddd
+0, 53, 53, 1, 393216, 0xf1e17862
+0, 54, 54, 1, 393216, 0x27fa584d
+0, 55, 55, 1, 393216, 0xe644ec5f
+0, 56, 56, 1, 393216, 0x7e3067ba
+0, 57, 57, 1, 393216, 0x1b6ba6fd
+0, 58, 58, 1, 393216, 0x55bdba34
+0, 59, 59, 1, 393216, 0xc67db2e4
+0, 60, 60, 1, 393216, 0x359de8a2
+0, 61, 61, 1, 393216, 0x7b7a32ef
+0, 62, 62, 1, 393216, 0xbe512a66
+0, 63, 63, 1, 393216, 0x681d82bf
+0, 64, 64, 1, 393216, 0xa2320ec5
+0, 65, 65, 1, 393216, 0xcfbd9954
+0, 66, 66, 1, 393216, 0x7fee9854
+0, 67, 67, 1, 393216, 0x70eec155
+0, 68, 68, 1, 393216, 0x114f684e
+0, 69, 69, 1, 393216, 0xe27f034f
+0, 70, 70, 1, 393216, 0xfbbd89b4
+0, 71, 71, 1, 393216, 0xcef4c58a
+0, 72, 72, 1, 393216, 0x9eea88e9
+0, 73, 73, 1, 393216, 0x911cea42
+0, 74, 74, 1, 393216, 0xec5727ea
+0, 75, 75, 1, 393216, 0xda998c33
+0, 76, 76, 1, 393216, 0xc82140ed
+0, 77, 77, 1, 393216, 0x4caa8591
+0, 78, 78, 1, 393216, 0x4944206c
+0, 79, 79, 1, 393216, 0xd4676a94
+0, 80, 80, 1, 393216, 0x9e0340b3
+0, 81, 81, 1, 393216, 0xbdef7f94
+0, 82, 82, 1, 393216, 0xfac05cb0
+0, 83, 83, 1, 393216, 0xfef5a369
+0, 84, 84, 1, 393216, 0x9fcb3711
+0, 85, 85, 1, 393216, 0x6d93f761
+0, 86, 86, 1, 393216, 0xe95dc1ae
+0, 87, 87, 1, 393216, 0x3e561557
+0, 88, 88, 1, 393216, 0x0fa7a049
+0, 89, 89, 1, 393216, 0xf16afb95
+0, 90, 90, 1, 393216, 0xe53a2064
+0, 91, 91, 1, 393216, 0x57f046a4
+0, 92, 92, 1, 393216, 0xf6f16a0c
+0, 93, 93, 1, 393216, 0xcba0c8b0
+0, 94, 94, 1, 393216, 0x5bdbe522
+0, 95, 95, 1, 393216, 0x0fed0151
+0, 96, 96, 1, 393216, 0xbf86faf8
+0, 97, 97, 1, 393216, 0x39854c5f
+0, 98, 98, 1, 393216, 0xd9b7760a
+0, 99, 99, 1, 393216, 0x8edcc1d9
+0, 100, 100, 1, 393216, 0x44ae1435
+0, 101, 101, 1, 393216, 0xbc3d6d73
+0, 102, 102, 1, 393216, 0xedd82647
+0, 103, 103, 1, 393216, 0x1c2e5ce3
+0, 104, 104, 1, 393216, 0x04e29afe
+0, 105, 105, 1, 393216, 0xb191578e
+0, 106, 106, 1, 393216, 0x31d75a06
+0, 107, 107, 1, 393216, 0xfdb6c56e
+0, 108, 108, 1, 393216, 0xf528f484
+0, 109, 109, 1, 393216, 0x87af758e
+0, 110, 110, 1, 393216, 0xc8bdafb7
+0, 111, 111, 1, 393216, 0x573afe93
+0, 112, 112, 1, 393216, 0xb03cb8f5
+0, 113, 113, 1, 393216, 0x6e03ac71
+0, 114, 114, 1, 393216, 0xf919164e
+0, 115, 115, 1, 393216, 0x80059f3c
+0, 116, 116, 1, 393216, 0xf4ea0b1a
+0, 117, 117, 1, 393216, 0xe7720ffb
+0, 118, 118, 1, 393216, 0x1ec0cd56
+0, 119, 119, 1, 393216, 0x2bc8cf18
+0, 120, 120, 1, 393216, 0xe0bf17b5
+0, 121, 121, 1, 393216, 0x660247e1
+0, 122, 122, 1, 393216, 0xcf66f2a9
+0, 123, 123, 1, 393216, 0x5494d5ab
+0, 124, 124, 1, 393216, 0x2c02f2c4
+0, 125, 125, 1, 393216, 0x93fa3783
+0, 126, 126, 1, 393216, 0x4cc50633
+0, 127, 127, 1, 393216, 0x3f179386
+0, 128, 128, 1, 393216, 0x2bca9e1b
+0, 129, 129, 1, 393216, 0x3e4af867
+0, 130, 130, 1, 393216, 0x7e7df93c
+0, 131, 131, 1, 393216, 0x577e4fb0
+0, 132, 132, 1, 393216, 0x34487f0a
+0, 133, 133, 1, 393216, 0x0937bcfc
+0, 134, 134, 1, 393216, 0xa9e75a5e
+0, 135, 135, 1, 393216, 0xf7bc0c89
+0, 136, 136, 1, 393216, 0x06dacca6
+0, 137, 137, 1, 393216, 0x7baaa4bd
+0, 138, 138, 1, 393216, 0x95477f5f
+0, 139, 139, 1, 393216, 0x51117526
+0, 140, 140, 1, 393216, 0x69656d03
+0, 141, 141, 1, 393216, 0xcbd061bb
+0, 142, 142, 1, 393216, 0x8d1d5be2
+0, 143, 143, 1, 393216, 0x43e55930
+0, 144, 144, 1, 393216, 0xb56f5872
+0, 145, 145, 1, 393216, 0x09a255e9
+0, 146, 146, 1, 393216, 0xcaaa5456
+0, 147, 147, 1, 393216, 0xd267501f
+0, 148, 148, 1, 393216, 0x7bef4eca
+0, 149, 149, 1, 393216, 0x9aa94af3
+0, 150, 150, 1, 393216, 0xd39d4a29
+0, 151, 151, 1, 393216, 0x7a754960
+0, 152, 152, 1, 393216, 0x3f004921
+0, 153, 153, 1, 393216, 0x0f784ca8
+0, 154, 154, 1, 393216, 0x2a062c70
+0, 155, 155, 1, 393216, 0x114ef770
+0, 156, 156, 1, 393216, 0xfb7673bf
+0, 157, 157, 1, 393216, 0xbaea88f7
+0, 158, 158, 1, 393216, 0x6fdfe2ec
+0, 159, 159, 1, 393216, 0xb7b2b398
+0, 160, 160, 1, 393216, 0x14ba127e
+0, 161, 161, 1, 393216, 0x660b3041
+0, 162, 162, 1, 393216, 0xe3f3302a
+0, 163, 163, 1, 393216, 0x34c7f1c9
+0, 164, 164, 1, 393216, 0xa8257bf4
+0, 165, 165, 1, 393216, 0xd63fc649
+0, 166, 166, 1, 393216, 0xf8e5b79c
+0, 167, 167, 1, 393216, 0xa67b52ab
+0, 168, 168, 1, 393216, 0xef8f9c74
+0, 169, 169, 1, 393216, 0x6d3aa6b6
+0, 170, 170, 1, 393216, 0x8c174ee6
+0, 171, 171, 1, 393216, 0x2dfbc524
+0, 172, 172, 1, 393216, 0x7d0808b6
+0, 173, 173, 1, 393216, 0x6cbdf6f5
+0, 174, 174, 1, 393216, 0xfe39bc53
+0, 175, 175, 1, 393216, 0xa3d869b0
+0, 176, 176, 1, 393216, 0x09f00057
+0, 177, 177, 1, 393216, 0x6ba56343
+0, 178, 178, 1, 393216, 0xb696ca3e
+0, 179, 179, 1, 393216, 0x4eba0225
+0, 180, 180, 1, 393216, 0xdd45464b
+0, 181, 181, 1, 393216, 0x2909a9ea
+0, 182, 182, 1, 393216, 0x12aa3f85
+0, 183, 183, 1, 393216, 0x59421352
+0, 184, 184, 1, 393216, 0x57ea0313
+0, 185, 185, 1, 393216, 0x4e5f3a38
+0, 186, 186, 1, 393216, 0x55bc932d
+0, 187, 187, 1, 393216, 0x666ee55d
+0, 188, 188, 1, 393216, 0xb0f84a69
+0, 189, 189, 1, 393216, 0xad3ae63f
+0, 190, 190, 1, 393216, 0x970fd47d
+0, 191, 191, 1, 393216, 0x86c418e0
+0, 192, 192, 1, 393216, 0x52c9ce50
+0, 193, 193, 1, 393216, 0xd54c98c8
+0, 194, 194, 1, 393216, 0xb40e5fea
+0, 195, 195, 1, 393216, 0x2aa74875
+0, 196, 196, 1, 393216, 0x305b251e
+0, 197, 197, 1, 393216, 0xab8c0780
+0, 198, 198, 1, 393216, 0x0101dd0e
+0, 199, 199, 1, 393216, 0x23739cab
+0, 200, 200, 1, 393216, 0xf05196a0
+0, 201, 201, 1, 393216, 0x932d1e00
+0, 202, 202, 1, 393216, 0x932d1e00
+0, 203, 203, 1, 393216, 0x932d1e00
+0, 204, 204, 1, 393216, 0x932d1e00
+0, 205, 205, 1, 393216, 0x932d1e00
+0, 206, 206, 1, 393216, 0x932d1e00
+0, 207, 207, 1, 393216, 0x932d1e00
+0, 208, 208, 1, 393216, 0x932d1e00
+0, 209, 209, 1, 393216, 0x932d1e00
diff --git a/gst-libs/ext/libav/tests/ref/fate/rpza b/gst-libs/ext/libav/tests/ref/fate/rpza
index 32ea1cf..a1c5333 100644
--- a/gst-libs/ext/libav/tests/ref/fate/rpza
+++ b/gst-libs/ext/libav/tests/ref/fate/rpza
@@ -1,30 +1,31 @@
-0, 0, 230400, 0x4aec80a3
-0, 6000, 230400, 0xb6c41452
-0, 12000, 230400, 0xa6c27f12
-0, 18000, 230400, 0x309bd2d2
-0, 24000, 230400, 0x597a7341
-0, 30000, 230400, 0x597a7341
-0, 36000, 230400, 0xd6d6c569
-0, 42000, 230400, 0x31413d89
-0, 48000, 230400, 0x464e42e9
-0, 54000, 230400, 0x502d7c71
-0, 60000, 230400, 0x502d7c71
-0, 66000, 230400, 0xc96f23d1
-0, 72000, 230400, 0xc96f23d1
-0, 78000, 230400, 0x5bfd2bc7
-0, 84000, 230400, 0x821640a7
-0, 90000, 230400, 0x8f001967
-0, 96000, 230400, 0x406ba109
-0, 102000, 230400, 0x85d99b50
-0, 108000, 230400, 0x2fdb4018
-0, 114000, 230400, 0xfa127259
-0, 120000, 230400, 0xe6427b9b
-0, 126000, 230400, 0xe6427b9b
-0, 132000, 230400, 0x3a279000
-0, 138000, 230400, 0x710755ee
-0, 144000, 230400, 0x76549d35
-0, 150000, 230400, 0xf4d0132c
-0, 156000, 230400, 0xf4d0132c
-0, 162000, 230400, 0x19d7ec14
-0, 168000, 230400, 0x19d7ec14
-0, 174000, 230400, 0x5f24b7e1
+#tb 0: 1/600
+0, 0, 0, 1, 230400, 0x4aec80a3
+0, 40, 40, 1, 230400, 0xb6c41452
+0, 80, 80, 1, 230400, 0xa6c27f12
+0, 120, 120, 1, 230400, 0x309bd2d2
+0, 160, 160, 1, 230400, 0x597a7341
+0, 200, 200, 1, 230400, 0x597a7341
+0, 240, 240, 1, 230400, 0xd6d6c569
+0, 280, 280, 1, 230400, 0x31413d89
+0, 320, 320, 1, 230400, 0x464e42e9
+0, 360, 360, 1, 230400, 0x502d7c71
+0, 400, 400, 1, 230400, 0x502d7c71
+0, 440, 440, 1, 230400, 0xc96f23d1
+0, 480, 480, 1, 230400, 0xc96f23d1
+0, 520, 520, 1, 230400, 0x5bfd2bc7
+0, 560, 560, 1, 230400, 0x821640a7
+0, 600, 600, 1, 230400, 0x8f001967
+0, 640, 640, 1, 230400, 0x406ba109
+0, 680, 680, 1, 230400, 0x85d99b50
+0, 720, 720, 1, 230400, 0x2fdb4018
+0, 760, 760, 1, 230400, 0xfa127259
+0, 800, 800, 1, 230400, 0xe6427b9b
+0, 840, 840, 1, 230400, 0xe6427b9b
+0, 880, 880, 1, 230400, 0x3a279000
+0, 920, 920, 1, 230400, 0x710755ee
+0, 960, 960, 1, 230400, 0x76549d35
+0, 1000, 1000, 1, 230400, 0xf4d0132c
+0, 1040, 1040, 1, 230400, 0xf4d0132c
+0, 1080, 1080, 1, 230400, 0x19d7ec14
+0, 1120, 1120, 1, 230400, 0x19d7ec14
+0, 1160, 1160, 1, 230400, 0x5f24b7e1
diff --git a/gst-libs/ext/libav/tests/ref/fate/rv30 b/gst-libs/ext/libav/tests/ref/fate/rv30
index a3c5dcf..89a9d8c 100644
--- a/gst-libs/ext/libav/tests/ref/fate/rv30
+++ b/gst-libs/ext/libav/tests/ref/fate/rv30
@@ -1,109 +1,110 @@
-0, 0, 126720, 0xcefaec47
-0, 3003, 126720, 0xa416ece5
-0, 6006, 126720, 0xa416ece5
-0, 9009, 126720, 0xa416ece5
-0, 12012, 126720, 0x60d6ed27
-0, 15015, 126720, 0x259af497
-0, 18018, 126720, 0x5e6ff4d7
-0, 21021, 126720, 0xcc10f4b7
-0, 24024, 126720, 0x763ab817
-0, 27027, 126720, 0xeb6fb8d7
-0, 30030, 126720, 0xda71b917
-0, 33033, 126720, 0x0967b8f7
-0, 36036, 126720, 0x4b62b947
-0, 39039, 126720, 0xbb1abbb7
-0, 42042, 126720, 0x273fbc37
-0, 45045, 126720, 0x16eebbd7
-0, 48048, 126720, 0x105eb927
-0, 51051, 126720, 0x7fa3ae27
-0, 54054, 126720, 0x722e99f7
-0, 57057, 126720, 0x5ac9a827
-0, 60060, 126720, 0x07beba77
-0, 63063, 126720, 0x29d6a887
-0, 66066, 126720, 0xa5caab87
-0, 69069, 126720, 0x9ca7aac7
-0, 72072, 126720, 0xb7debcd7
-0, 75075, 126720, 0xd115a757
-0, 78078, 126720, 0x6ddaef32
-0, 81081, 126720, 0xde1bb900
-0, 84084, 126720, 0xac6c071b
-0, 87087, 126720, 0x04e7897c
-0, 90090, 126720, 0x5eee050f
-0, 93093, 126720, 0xe675be59
-0, 96096, 126720, 0xdc3e0837
-0, 99099, 126720, 0x68cfda2b
-0, 102102, 126720, 0xe572dfc9
-0, 105105, 126720, 0x582fb176
-0, 108108, 126720, 0xa9477df0
-0, 111111, 126720, 0xbc3cc34f
-0, 114114, 126720, 0xcf8cb0e2
-0, 117117, 126720, 0xcff1db35
-0, 120120, 126720, 0xc6e10f9f
-0, 123123, 126720, 0x75ae61b6
-0, 126126, 126720, 0x12af3119
-0, 129129, 126720, 0x85597543
-0, 132132, 126720, 0x68c27aca
-0, 135135, 126720, 0x554fe3e4
-0, 138138, 126720, 0x72ecea95
-0, 141141, 126720, 0xf4d003d1
-0, 144144, 126720, 0x9bf6a605
-0, 147147, 126720, 0x5d00b5fe
-0, 150150, 126720, 0x93f7b040
-0, 153153, 126720, 0x0d6ad154
-0, 156156, 126720, 0x4be8b4ea
-0, 159159, 126720, 0xe39bba0d
-0, 162162, 126720, 0x9c21bad8
-0, 165165, 126720, 0xa567f25b
-0, 168168, 126720, 0x7a82663a
-0, 171171, 126720, 0x72f2a47d
-0, 174174, 126720, 0x4f639ebe
-0, 177177, 126720, 0xab0fce83
-0, 180180, 126720, 0x6cf87d39
-0, 183183, 126720, 0x534a10cc
-0, 186186, 126720, 0x6bbcf44c
-0, 189189, 126720, 0xfdca11d3
-0, 192192, 126720, 0x7e58f5a6
-0, 195195, 126720, 0x5fd753d8
-0, 198198, 126720, 0x0c735615
-0, 201201, 126720, 0x2a034ebf
-0, 204204, 126720, 0xeaf3dd0b
-0, 207207, 126720, 0x0eaf0c1b
-0, 210210, 126720, 0xce5e6794
-0, 213213, 126720, 0xf27c31c3
-0, 216216, 126720, 0xb64af168
-0, 219219, 126720, 0x14cf7974
-0, 222222, 126720, 0x1c2a513d
-0, 225225, 126720, 0xa3f515ab
-0, 228228, 126720, 0xcfd62765
-0, 231231, 126720, 0xbc513f2a
-0, 234234, 126720, 0xbc303fae
-0, 237237, 126720, 0x2f8f69b9
-0, 240240, 126720, 0x0a22cc69
-0, 243243, 126720, 0xd9f67585
-0, 246246, 126720, 0x20403001
-0, 249249, 126720, 0xf92b2a25
-0, 252252, 126720, 0x3c170aad
-0, 255255, 126720, 0x3378251f
-0, 258258, 126720, 0xb3ed5911
-0, 261261, 126720, 0x35d24ef8
-0, 264264, 126720, 0x8da30275
-0, 267267, 126720, 0xc15a3577
-0, 270270, 126720, 0xf2942f53
-0, 273273, 126720, 0x44d8304a
-0, 276276, 126720, 0xd688a932
-0, 279279, 126720, 0x0a24f256
-0, 282282, 126720, 0xfab9c45d
-0, 285285, 126720, 0x10e939ce
-0, 288288, 126720, 0x97fcaa3a
-0, 291291, 126720, 0x45464610
-0, 294294, 126720, 0xfe2e057d
-0, 297297, 126720, 0x0b6718ae
-0, 300300, 126720, 0x5284da7b
-0, 303303, 126720, 0x23efdc35
-0, 306306, 126720, 0xc387b2b3
-0, 309309, 126720, 0xc9e92bf1
-0, 312312, 126720, 0xfbf20a01
-0, 315315, 126720, 0x4d888b2e
-0, 318318, 126720, 0xdd0d74df
-0, 321321, 126720, 0x49d07aa4
-0, 324324, 126720, 0x08382b8e
+#tb 0: 1/1000
+0, 1, 1, 0, 126720, 0xcefaec47
+0, 33, 33, 0, 126720, 0xa416ece5
+0, 66, 66, 0, 126720, 0xa416ece5
+0, 100, 100, 0, 126720, 0xa416ece5
+0, 133, 133, 0, 126720, 0x60d6ed27
+0, 166, 166, 0, 126720, 0x259af497
+0, 200, 200, 0, 126720, 0x5e6ff4d7
+0, 233, 233, 0, 126720, 0xcc10f4b7
+0, 266, 266, 0, 126720, 0x763ab817
+0, 300, 300, 0, 126720, 0xe95fb8d7
+0, 333, 333, 0, 126720, 0xe2b1b917
+0, 367, 367, 0, 126720, 0x11abb8f7
+0, 400, 400, 0, 126720, 0x4b62b947
+0, 433, 433, 0, 126720, 0xcaf2bbb7
+0, 467, 467, 0, 126720, 0x2953bc37
+0, 500, 500, 0, 126720, 0x1dd9bbd7
+0, 533, 533, 0, 126720, 0x105eb927
+0, 567, 567, 0, 126720, 0x7fa3ae27
+0, 600, 600, 0, 126720, 0x722e99f7
+0, 633, 633, 0, 126720, 0x5ac9a827
+0, 667, 667, 0, 126720, 0x07beba77
+0, 700, 700, 0, 126720, 0x29d6a887
+0, 734, 734, 0, 126720, 0xa5caab87
+0, 767, 767, 0, 126720, 0x9ca7aac7
+0, 800, 800, 0, 126720, 0xb7debcd7
+0, 834, 834, 0, 126720, 0xd115a757
+0, 867, 867, 0, 126720, 0x6ddaef32
+0, 900, 900, 0, 126720, 0xde1bb900
+0, 934, 934, 0, 126720, 0xac6c071b
+0, 967, 967, 0, 126720, 0x4a9f897c
+0, 1000, 1000, 0, 126720, 0xd8fa050f
+0, 1034, 1034, 0, 126720, 0x5d06be59
+0, 1067, 1067, 0, 126720, 0xdc3e0837
+0, 1101, 1101, 0, 126720, 0xcac6da2b
+0, 1134, 1134, 0, 126720, 0x6672dfc9
+0, 1167, 1167, 0, 126720, 0x7491b176
+0, 1201, 1201, 0, 126720, 0xa9477df0
+0, 1234, 1234, 0, 126720, 0xe976c34f
+0, 1267, 1267, 0, 126720, 0xdb7ab0e2
+0, 1301, 1301, 0, 126720, 0x1b42db35
+0, 1334, 1334, 0, 126720, 0xc6e10f9f
+0, 1368, 1368, 0, 126720, 0x169d61b6
+0, 1401, 1401, 0, 126720, 0xc7623119
+0, 1434, 1434, 0, 126720, 0x5b9b7543
+0, 1468, 1468, 0, 126720, 0x68c27aca
+0, 1501, 1501, 0, 126720, 0xa0e4e1c9
+0, 1534, 1534, 0, 126720, 0xbbdae87e
+0, 1568, 1568, 0, 126720, 0xe67e00a1
+0, 1601, 1601, 0, 126720, 0x648ea605
+0, 1634, 1634, 0, 126720, 0x5becb718
+0, 1668, 1668, 0, 126720, 0xb79ab1da
+0, 1701, 1701, 0, 126720, 0x0d52d1dc
+0, 1735, 1735, 0, 126720, 0x1277b853
+0, 1768, 1768, 0, 126720, 0xc57cbc83
+0, 1801, 1801, 0, 126720, 0x2126bdc3
+0, 1835, 1835, 0, 126720, 0x4c1ef41f
+0, 1868, 1868, 0, 126720, 0x185f6a2c
+0, 1901, 1901, 0, 126720, 0xb2b5a7d3
+0, 1935, 1935, 0, 126720, 0x32d7a26d
+0, 1968, 1968, 0, 126720, 0x0bffd118
+0, 2001, 2001, 0, 126720, 0x2eed823a
+0, 2035, 2035, 0, 126720, 0xc4c0147c
+0, 2068, 2068, 0, 126720, 0x1f8bf8ac
+0, 2102, 2102, 0, 126720, 0xfcb715e8
+0, 2135, 2135, 0, 126720, 0xc3e9fa9c
+0, 2168, 2168, 0, 126720, 0x9ad8572c
+0, 2202, 2202, 0, 126720, 0x2800596d
+0, 2235, 2235, 0, 126720, 0x3caa5094
+0, 2268, 2268, 0, 126720, 0x6162e000
+0, 2302, 2302, 0, 126720, 0x18200f2c
+0, 2335, 2335, 0, 126720, 0x649e699f
+0, 2369, 2369, 0, 126720, 0x5f513367
+0, 2402, 2402, 0, 126720, 0x71fbf4a8
+0, 2435, 2435, 0, 126720, 0x5bff7b97
+0, 2469, 2469, 0, 126720, 0xbad453d4
+0, 2502, 2502, 0, 126720, 0x56e6161d
+0, 2535, 2535, 0, 126720, 0x524f2980
+0, 2569, 2569, 0, 126720, 0x0589405a
+0, 2602, 2602, 0, 126720, 0x5c264043
+0, 2635, 2635, 0, 126720, 0x2394696f
+0, 2669, 2669, 0, 126720, 0x1aa0cd15
+0, 2702, 2702, 0, 126720, 0xd6ec7840
+0, 2736, 2736, 0, 126720, 0xde5531f0
+0, 2769, 2769, 0, 126720, 0x03a42c3a
+0, 2802, 2802, 0, 126720, 0xbdee0efb
+0, 2836, 2836, 0, 126720, 0xa6012736
+0, 2869, 2869, 0, 126720, 0x448f5ae6
+0, 2902, 2902, 0, 126720, 0x8a2550c3
+0, 2936, 2936, 0, 126720, 0x143104e7
+0, 2969, 2969, 0, 126720, 0x75db363d
+0, 3002, 3002, 0, 126720, 0x906d2f9d
+0, 3036, 3036, 0, 126720, 0xfc7b30ab
+0, 3069, 3069, 0, 126720, 0xd3edaa62
+0, 3103, 3103, 0, 126720, 0x6267f3fc
+0, 3136, 3136, 0, 126720, 0x87b6c67f
+0, 3169, 3169, 0, 126720, 0x84da3b79
+0, 3203, 3203, 0, 126720, 0x72fbae15
+0, 3236, 3236, 0, 126720, 0xb8474a80
+0, 3269, 3269, 0, 126720, 0xbeae088b
+0, 3303, 3303, 0, 126720, 0x538b1a14
+0, 3336, 3336, 0, 126720, 0x07bbddcd
+0, 3370, 3370, 0, 126720, 0x807ddf8f
+0, 3403, 3403, 0, 126720, 0x325bb46d
+0, 3436, 3436, 0, 126720, 0xd80c2f2a
+0, 3470, 3470, 0, 126720, 0xfc1b0dec
+0, 3503, 3503, 0, 126720, 0x46068ebc
+0, 3536, 3536, 0, 126720, 0xcd987941
+0, 3570, 3570, 0, 126720, 0x52f37f2e
+0, 3603, 3603, 0, 126720, 0xc96931a2
diff --git a/gst-libs/ext/libav/tests/ref/fate/rv40 b/gst-libs/ext/libav/tests/ref/fate/rv40
new file mode 100644
index 0000000..d5cb265
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/rv40
@@ -0,0 +1,240 @@
+#tb 0: 1/1000
+0, -41, -41, 0, 276480, 0x5f7a0d4f
+0, 42, 42, 0, 276480, 0x5f7a0d4f
+0, 83, 83, 0, 276480, 0x5f7a0d4f
+0, 125, 125, 0, 276480, 0x5f7a0d4f
+0, 167, 167, 0, 276480, 0x5f7a0d4f
+0, 209, 209, 0, 276480, 0x5f7a0d4f
+0, 250, 250, 0, 276480, 0x5f7a0d4f
+0, 292, 292, 0, 276480, 0x5f7a0d4f
+0, 334, 334, 0, 276480, 0x5f7a0d4f
+0, 375, 375, 0, 276480, 0x5f7a0d4f
+0, 417, 417, 0, 276480, 0x5f7a0d4f
+0, 459, 459, 0, 276480, 0x5f7a0d4f
+0, 501, 501, 0, 276480, 0x5f7a0d4f
+0, 542, 542, 0, 276480, 0x5f7a0d4f
+0, 584, 584, 0, 276480, 0x5f7a0d4f
+0, 626, 626, 0, 276480, 0x5f7a0d4f
+0, 667, 667, 0, 276480, 0x5f7a0d4f
+0, 709, 709, 0, 276480, 0x5f7a0d4f
+0, 751, 751, 0, 276480, 0x5f7a0d4f
+0, 792, 792, 0, 276480, 0x5f7a0d4f
+0, 834, 834, 0, 276480, 0x5f7a0d4f
+0, 876, 876, 0, 276480, 0x5f7a0d4f
+0, 918, 918, 0, 276480, 0x5f7a0d4f
+0, 959, 959, 0, 276480, 0x5f7a0d4f
+0, 1001, 1001, 0, 276480, 0x5f7a0d4f
+0, 1043, 1043, 0, 276480, 0x5f7a0d4f
+0, 1084, 1084, 0, 276480, 0x5f7a0d4f
+0, 1126, 1126, 0, 276480, 0x5f7a0d4f
+0, 1168, 1168, 0, 276480, 0x5f7a0d4f
+0, 1210, 1210, 0, 276480, 0x5f7a0d4f
+0, 1251, 1251, 0, 276480, 0x5f7a0d4f
+0, 1293, 1293, 0, 276480, 0x5f7a0d4f
+0, 1335, 1335, 0, 276480, 0x5f7a0d4f
+0, 1376, 1376, 0, 276480, 0x75641594
+0, 1418, 1418, 0, 276480, 0x32ee3526
+0, 1460, 1460, 0, 276480, 0xcb53479a
+0, 1502, 1502, 0, 276480, 0x7ca9658e
+0, 1543, 1543, 0, 276480, 0x5ce39368
+0, 1585, 1585, 0, 276480, 0x4ec1e418
+0, 1627, 1627, 0, 276480, 0xb3790499
+0, 1668, 1668, 0, 276480, 0xa9f1506f
+0, 1710, 1710, 0, 276480, 0x85cbc3b5
+0, 1752, 1752, 0, 276480, 0x377c7b46
+0, 1793, 1793, 0, 276480, 0x1a61d8db
+0, 1835, 1835, 0, 276480, 0xe1de7f0a
+0, 1877, 1877, 0, 276480, 0x756a4a2e
+0, 1919, 1919, 0, 276480, 0xcb379547
+0, 1960, 1960, 0, 276480, 0xbae14484
+0, 2002, 2002, 0, 276480, 0x8e12331c
+0, 2044, 2044, 0, 276480, 0x99c085be
+0, 2085, 2085, 0, 276480, 0xe479ffed
+0, 2127, 2127, 0, 276480, 0x99c82949
+0, 2169, 2169, 0, 276480, 0xac7672dd
+0, 2211, 2211, 0, 276480, 0x1e4fae19
+0, 2252, 2252, 0, 276480, 0x776412ef
+0, 2294, 2294, 0, 276480, 0x7d9b579f
+0, 2336, 2336, 0, 276480, 0x1cd1ab29
+0, 2377, 2377, 0, 276480, 0x58ce0f38
+0, 2419, 2419, 0, 276480, 0x5ab69b27
+0, 2461, 2461, 0, 276480, 0x0afad610
+0, 2503, 2503, 0, 276480, 0x9eca3f11
+0, 2544, 2544, 0, 276480, 0xc3db9706
+0, 2586, 2586, 0, 276480, 0xc9c57884
+0, 2628, 2628, 0, 276480, 0xd9fbb2cf
+0, 2669, 2669, 0, 276480, 0xdc07f3c9
+0, 2711, 2711, 0, 276480, 0x000b5269
+0, 2753, 2753, 0, 276480, 0x27ff7a5d
+0, 2794, 2794, 0, 276480, 0xd92e2017
+0, 2836, 2836, 0, 276480, 0x18d4b27d
+0, 2878, 2878, 0, 276480, 0x70647530
+0, 2920, 2920, 0, 276480, 0x97612c4b
+0, 2961, 2961, 0, 276480, 0xc9d4ac78
+0, 3003, 3003, 0, 276480, 0x4ec4d57f
+0, 3045, 3045, 0, 276480, 0xdf4e04d7
+0, 3086, 3086, 0, 276480, 0xbd98f57c
+0, 3128, 3128, 0, 276480, 0x7247ea3e
+0, 3170, 3170, 0, 276480, 0xa5d670ec
+0, 3212, 3212, 0, 276480, 0x5163b29b
+0, 3253, 3253, 0, 276480, 0x99170e64
+0, 3295, 3295, 0, 276480, 0x37f4c0b0
+0, 3337, 3337, 0, 276480, 0x7a4f2561
+0, 3378, 3378, 0, 276480, 0x8a4e991f
+0, 3420, 3420, 0, 276480, 0x6a45425f
+0, 3462, 3462, 0, 276480, 0x1f0e2bb6
+0, 3504, 3504, 0, 276480, 0xd75482c6
+0, 3545, 3545, 0, 276480, 0x7bf6b1ef
+0, 3587, 3587, 0, 276480, 0x6de1e34b
+0, 3629, 3629, 0, 276480, 0x4526c89b
+0, 3670, 3670, 0, 276480, 0xf964e18e
+0, 3712, 3712, 0, 276480, 0xdcaaa99a
+0, 3754, 3754, 0, 276480, 0xd1e98808
+0, 3795, 3795, 0, 276480, 0x556b2365
+0, 3837, 3837, 0, 276480, 0x0cf65540
+0, 3879, 3879, 0, 276480, 0x6e2d524e
+0, 3921, 3921, 0, 276480, 0x22c50a3d
+0, 3962, 3962, 0, 276480, 0x293f19af
+0, 4004, 4004, 0, 276480, 0xf4b1c461
+0, 4046, 4046, 0, 276480, 0x62b76407
+0, 4087, 4087, 0, 276480, 0x51e9b3eb
+0, 4129, 4129, 0, 276480, 0x7b910bc7
+0, 4171, 4171, 0, 276480, 0x6dd14ca6
+0, 4213, 4213, 0, 276480, 0x441f7afd
+0, 4254, 4254, 0, 276480, 0xfb01efc6
+0, 4296, 4296, 0, 276480, 0x4f73ccea
+0, 4338, 4338, 0, 276480, 0x5ac8e06f
+0, 4379, 4379, 0, 276480, 0x294bb441
+0, 4421, 4421, 0, 276480, 0xe04ac45e
+0, 4463, 4463, 0, 276480, 0xa7a38d41
+0, 4505, 4505, 0, 276480, 0xf688a3ed
+0, 4546, 4546, 0, 276480, 0x58f275ea
+0, 4588, 4588, 0, 276480, 0xf0b3b71b
+0, 4630, 4630, 0, 276480, 0x3ce773bf
+0, 4671, 4671, 0, 276480, 0x01840548
+0, 4713, 4713, 0, 276480, 0x674e34e4
+0, 4755, 4755, 0, 276480, 0x41dda2d9
+0, 4796, 4796, 0, 276480, 0xc5b60838
+0, 4838, 4838, 0, 276480, 0x9b209f41
+0, 4880, 4880, 0, 276480, 0xf46ba7fb
+0, 4922, 4922, 0, 276480, 0x28b54815
+0, 4963, 4963, 0, 276480, 0xb605a933
+0, 5005, 5005, 0, 276480, 0x34484aff
+0, 5047, 5047, 0, 276480, 0xaf2b5d89
+0, 5088, 5088, 0, 276480, 0x8facba58
+0, 5130, 5130, 0, 276480, 0xbbe3e99f
+0, 5172, 5172, 0, 276480, 0x02162c7c
+0, 5214, 5214, 0, 276480, 0x28a63236
+0, 5255, 5255, 0, 276480, 0x1ad43fd7
+0, 5297, 5297, 0, 276480, 0xe37883e5
+0, 5339, 5339, 0, 276480, 0x2b8a89c5
+0, 5380, 5380, 0, 276480, 0x71507bd2
+0, 5422, 5422, 0, 276480, 0x35626022
+0, 5464, 5464, 0, 276480, 0x461fc3e7
+0, 5506, 5506, 0, 276480, 0xce5af1ec
+0, 5547, 5547, 0, 276480, 0x7c1139b3
+0, 5589, 5589, 0, 276480, 0x7fd73a99
+0, 5631, 5631, 0, 276480, 0x4ae4c3a6
+0, 5672, 5672, 0, 276480, 0xcb60725a
+0, 5714, 5714, 0, 276480, 0xb52e1aa2
+0, 5756, 5756, 0, 276480, 0xd6f82cae
+0, 5797, 5797, 0, 276480, 0x6310e665
+0, 5839, 5839, 0, 276480, 0xfa88a483
+0, 5881, 5881, 0, 276480, 0xf88f75d4
+0, 5923, 5923, 0, 276480, 0x04a8e3ee
+0, 5964, 5964, 0, 276480, 0x54766a12
+0, 6006, 6006, 0, 276480, 0x0b41f0d7
+0, 6048, 6048, 0, 276480, 0xa29f5b01
+0, 6089, 6089, 0, 276480, 0x754ceaf5
+0, 6131, 6131, 0, 276480, 0x150c0423
+0, 6173, 6173, 0, 276480, 0xde084059
+0, 6215, 6215, 0, 276480, 0x5a38b4af
+0, 6256, 6256, 0, 276480, 0xfcebc261
+0, 6298, 6298, 0, 276480, 0x0eb9770d
+0, 6340, 6340, 0, 276480, 0x046394ae
+0, 6381, 6381, 0, 276480, 0x3d3ca985
+0, 6423, 6423, 0, 276480, 0x94a03c75
+0, 6465, 6465, 0, 276480, 0x800eea2d
+0, 6507, 6507, 0, 276480, 0x6a841f41
+0, 6548, 6548, 0, 276480, 0x2f98911c
+0, 6590, 6590, 0, 276480, 0x923b9937
+0, 6632, 6632, 0, 276480, 0xe82f8e0f
+0, 6673, 6673, 0, 276480, 0xee82d657
+0, 6715, 6715, 0, 276480, 0xefab7ffd
+0, 6757, 6757, 0, 276480, 0x6b9fbc80
+0, 6798, 6798, 0, 276480, 0x4a1ada47
+0, 6840, 6840, 0, 276480, 0x6d4b49d7
+0, 6882, 6882, 0, 276480, 0xe4bdbd1e
+0, 6924, 6924, 0, 276480, 0x225a56c0
+0, 6965, 6965, 0, 276480, 0xd4adadad
+0, 7007, 7007, 0, 276480, 0xff4e1a8c
+0, 7049, 7049, 0, 276480, 0xf58b1b7c
+0, 7090, 7090, 0, 276480, 0xbaffcdcc
+0, 7132, 7132, 0, 276480, 0x374f88f0
+0, 7174, 7174, 0, 276480, 0x3d861ae6
+0, 7216, 7216, 0, 276480, 0xeb6eb88f
+0, 7257, 7257, 0, 276480, 0xdb753d35
+0, 7299, 7299, 0, 276480, 0x9aa543af
+0, 7341, 7341, 0, 276480, 0xb24c8016
+0, 7382, 7382, 0, 276480, 0xea80a82e
+0, 7424, 7424, 0, 276480, 0x2aae902a
+0, 7466, 7466, 0, 276480, 0x5bba3cfb
+0, 7508, 7508, 0, 276480, 0x5c6e97a9
+0, 7549, 7549, 0, 276480, 0x9b9ee961
+0, 7591, 7591, 0, 276480, 0xaa12b6fd
+0, 7633, 7633, 0, 276480, 0xe9d2439f
+0, 7674, 7674, 0, 276480, 0xbf09053c
+0, 7716, 7716, 0, 276480, 0x50c31e73
+0, 7758, 7758, 0, 276480, 0xdd9fb89f
+0, 7799, 7799, 0, 276480, 0x3e4e5aec
+0, 7841, 7841, 0, 276480, 0x0b752d28
+0, 7883, 7883, 0, 276480, 0xaf82399a
+0, 7925, 7925, 0, 276480, 0x7ce5f23c
+0, 7966, 7966, 0, 276480, 0xad135d0f
+0, 8008, 8008, 0, 276480, 0x55dadd30
+0, 8050, 8050, 0, 276480, 0x5aaa7519
+0, 8091, 8091, 0, 276480, 0xe45a5599
+0, 8133, 8133, 0, 276480, 0xc8e89913
+0, 8175, 8175, 0, 276480, 0x2f447fd3
+0, 8217, 8217, 0, 276480, 0x704411fb
+0, 8258, 8258, 0, 276480, 0x9d7430a1
+0, 8300, 8300, 0, 276480, 0x24dd5fd3
+0, 8342, 8342, 0, 276480, 0x51cb657c
+0, 8383, 8383, 0, 276480, 0x2c230702
+0, 8425, 8425, 0, 276480, 0x4a4f76cd
+0, 8467, 8467, 0, 276480, 0xdcd71e88
+0, 8509, 8509, 0, 276480, 0x87160f99
+0, 8550, 8550, 0, 276480, 0x27f54854
+0, 8592, 8592, 0, 276480, 0x694d76e3
+0, 8634, 8634, 0, 276480, 0xcbe93c19
+0, 8675, 8675, 0, 276480, 0x50742e1b
+0, 8717, 8717, 0, 276480, 0x525463e2
+0, 8759, 8759, 0, 276480, 0x819898f9
+0, 8800, 8800, 0, 276480, 0x08fac755
+0, 8842, 8842, 0, 276480, 0x35c46927
+0, 8884, 8884, 0, 276480, 0xeeed00fc
+0, 8926, 8926, 0, 276480, 0xb6f99ee3
+0, 8967, 8967, 0, 276480, 0xd87f4c73
+0, 9009, 9009, 0, 276480, 0xde97d9fd
+0, 9051, 9051, 0, 276480, 0xefc83107
+0, 9092, 9092, 0, 276480, 0xbb22e024
+0, 9134, 9134, 0, 276480, 0x53a7cfcb
+0, 9176, 9176, 0, 276480, 0xbe1fbb19
+0, 9218, 9218, 0, 276480, 0x300f922a
+0, 9259, 9259, 0, 276480, 0x826fc3bd
+0, 9301, 9301, 0, 276480, 0x679aa57a
+0, 9343, 9343, 0, 276480, 0x5497097b
+0, 9384, 9384, 0, 276480, 0x679a53f8
+0, 9426, 9426, 0, 276480, 0x976c9e93
+0, 9468, 9468, 0, 276480, 0xe80f87f2
+0, 9510, 9510, 0, 276480, 0xdc2d7c6c
+0, 9551, 9551, 0, 276480, 0xb194656e
+0, 9593, 9593, 0, 276480, 0xf002c5ca
+0, 9635, 9635, 0, 276480, 0x43fc1c64
+0, 9676, 9676, 0, 276480, 0xf62d8581
+0, 9718, 9718, 0, 276480, 0xb243dda5
+0, 9760, 9760, 0, 276480, 0x1700efbb
+0, 9801, 9801, 0, 276480, 0x9ebe6ba2
+0, 9843, 9843, 0, 276480, 0x8f316c66
+0, 9885, 9885, 0, 276480, 0x6348ecf5
+0, 9927, 9927, 0, 276480, 0x34b5b78a
diff --git a/gst-libs/ext/libav/tests/ref/fate/sierra-vmd b/gst-libs/ext/libav/tests/ref/fate/sierra-vmd
deleted file mode 100644
index 8ea1570..0000000
--- a/gst-libs/ext/libav/tests/ref/fate/sierra-vmd
+++ /dev/null
@@ -1,332 +0,0 @@
-0, 0, 230400, 0x0224ab01
-1, 0, 123480, 0x3a794c13
-0, 9000, 230400, 0x449e4d81
-0, 18000, 230400, 0x3e15e07a
-0, 27000, 230400, 0xdabe4172
-0, 36000, 230400, 0x0947b7db
-0, 45000, 230400, 0x934e243b
-0, 54000, 230400, 0x6b5c5b6c
-0, 63000, 230400, 0x4bf7bbb5
-0, 72000, 230400, 0x423eec8e
-0, 81000, 230400, 0x63663b5e
-0, 90000, 230400, 0x9c258a67
-0, 99000, 230400, 0x1c92b6e0
-0, 108000, 230400, 0xdd0a0e28
-0, 117000, 230400, 0x51d64af1
-0, 126000, 230400, 0x5776ac12
-0, 135000, 230400, 0x49070132
-0, 144000, 230400, 0xa59635ab
-0, 153000, 230400, 0xb1f99504
-0, 162000, 230400, 0x61fac725
-0, 171000, 230400, 0xc32c28d5
-0, 180000, 230400, 0x2b7a91d6
-0, 189000, 230400, 0x917be717
-0, 198000, 230400, 0xd3c5a2ff
-0, 207000, 230400, 0x0678a707
-0, 216000, 230400, 0x122504e6
-0, 225000, 230400, 0x76aebdae
-0, 234000, 230400, 0x81357545
-0, 243000, 230400, 0x38baeebd
-0, 252000, 230400, 0x1c5c44d4
-1, 252000, 4410, 0x109d04e0
-0, 261000, 230400, 0x60e189cc
-1, 261000, 4410, 0x224d244f
-0, 270000, 230400, 0xb1f4381c
-1, 270000, 4410, 0xbb72413d
-0, 279000, 230400, 0xb5048fed
-1, 279000, 4410, 0xaa5f5b86
-0, 288000, 230400, 0xc947c30e
-1, 288000, 4410, 0x94e7aea7
-0, 297000, 230400, 0xe8e31c07
-1, 297000, 4410, 0xad497ca0
-0, 306000, 230400, 0x6d49dd02
-1, 306000, 4410, 0x1de10c9e
-0, 315000, 230400, 0x293e15d3
-1, 315000, 4410, 0x9f55efa8
-0, 324000, 230400, 0x354d792e
-1, 324000, 4410, 0x220a072a
-0, 333000, 230400, 0x35468780
-1, 333000, 4410, 0xa7dafb29
-0, 342000, 230400, 0x365d3991
-1, 342000, 4410, 0xd5e29c7a
-0, 351000, 230400, 0xc9debef2
-1, 351000, 4410, 0xb8465006
-0, 360000, 230400, 0x4c4634c2
-1, 360000, 4410, 0x518669c7
-0, 369000, 230400, 0x347c2dca
-1, 369000, 4410, 0xb5b5efca
-0, 378000, 230400, 0x1efa0aaa
-1, 378000, 4410, 0x8600015d
-0, 387000, 230400, 0xa79a0b5a
-1, 387000, 4410, 0xe2f68fe9
-0, 396000, 230400, 0xfdb2dcdb
-1, 396000, 4410, 0x8d3458d9
-0, 405000, 230400, 0x42dbea33
-1, 405000, 4410, 0xf1ff4775
-0, 414000, 230400, 0x2a207e43
-1, 414000, 4410, 0x830f67c9
-0, 423000, 230400, 0x86573783
-1, 423000, 4410, 0x110e0bc1
-0, 432000, 230400, 0xc3968473
-1, 432000, 4410, 0x71682f47
-0, 441000, 230400, 0x8f62a7b4
-1, 441000, 4410, 0x38119095
-0, 450000, 230400, 0x5a2e3073
-1, 450000, 4410, 0xd2494db6
-0, 459000, 230400, 0xd24f5e2c
-1, 459000, 4410, 0x8b552509
-0, 468000, 230400, 0x1df3c67d
-1, 468000, 4410, 0x71e52909
-0, 477000, 230400, 0xe4fd884d
-1, 477000, 4410, 0x9f0a6f4d
-0, 486000, 230400, 0x9a228555
-1, 486000, 4410, 0x901302f2
-0, 495000, 230400, 0x9eba8ed5
-1, 495000, 4410, 0x855d5222
-0, 504000, 230400, 0x3d808a3d
-1, 504000, 4410, 0x324bb2fe
-0, 513000, 230400, 0xf57e866d
-1, 513000, 4410, 0xe85f583f
-0, 522000, 230400, 0x85f594f5
-1, 522000, 4410, 0x2cbc67c4
-0, 531000, 230400, 0xb09f99dd
-1, 531000, 4410, 0xc82e6aa1
-0, 540000, 230400, 0x2b368475
-1, 540000, 4410, 0xb9fc423c
-0, 549000, 230400, 0xa2417afd
-1, 549000, 4410, 0x6b9b4ef9
-0, 558000, 230400, 0x590b709d
-1, 558000, 4410, 0x39290f10
-0, 567000, 230400, 0x5d617705
-1, 567000, 4410, 0xad718eb4
-0, 576000, 230400, 0xabf981ad
-1, 576000, 4410, 0x82f463ac
-0, 585000, 230400, 0x5a8590cd
-1, 585000, 4410, 0xfac87cac
-0, 594000, 230400, 0x1bff853d
-1, 594000, 4410, 0x9e8bcca7
-0, 603000, 230400, 0x71d08055
-1, 603000, 4410, 0x52f79c99
-0, 612000, 230400, 0x2ebd817d
-1, 612000, 4410, 0xf2d14de2
-0, 621000, 230400, 0x6e838255
-1, 621000, 4410, 0x367f95e1
-0, 630000, 230400, 0x043984cd
-1, 630000, 4410, 0x8bfac293
-0, 639000, 230400, 0x7ff18495
-1, 639000, 4410, 0x01ea5040
-0, 648000, 230400, 0xa43b8385
-1, 648000, 4410, 0x8ff5e212
-0, 657000, 230400, 0x72b5825d
-1, 657000, 4410, 0x93f32824
-0, 666000, 230400, 0x3a178085
-1, 666000, 4410, 0x998f90dc
-0, 675000, 230400, 0x67748245
-1, 675000, 4410, 0x65231170
-0, 684000, 230400, 0xeddf81d5
-1, 684000, 4410, 0xc79039a1
-0, 693000, 230400, 0x8b088665
-1, 693000, 4410, 0x0b0e58bd
-0, 702000, 230400, 0x6c408e15
-1, 702000, 4410, 0xc24ab4fa
-0, 711000, 230400, 0x81f196dd
-1, 711000, 4410, 0xd3796a8e
-0, 720000, 230400, 0xab9f953d
-1, 720000, 4410, 0xa37f8295
-0, 729000, 230400, 0xa5f69795
-1, 729000, 4410, 0xb760fed7
-0, 738000, 230400, 0xa772950d
-1, 738000, 4410, 0x05495a34
-0, 747000, 230400, 0x6a5596d5
-1, 747000, 4410, 0x6f203437
-0, 756000, 230400, 0x1355958d
-1, 756000, 4410, 0x71299402
-0, 765000, 230400, 0x4134981d
-1, 765000, 4410, 0x72e7b346
-0, 774000, 230400, 0x8b929515
-1, 774000, 4410, 0x879b0dae
-0, 783000, 230400, 0x482f95c5
-1, 783000, 4410, 0x041aa1bd
-0, 792000, 230400, 0x7a9795d5
-1, 792000, 4410, 0x18a962e6
-0, 801000, 230400, 0x21c29abd
-1, 801000, 4410, 0x21d20539
-0, 810000, 230400, 0x9ae6a475
-1, 810000, 4410, 0x8f449267
-0, 819000, 230400, 0x3734aee5
-1, 819000, 4410, 0xecdc01d6
-0, 828000, 230400, 0xa0a1b365
-1, 828000, 4410, 0x458abd5a
-0, 837000, 230400, 0x2dcab1c5
-1, 837000, 4410, 0xa070ea63
-0, 846000, 230400, 0x9c8b6c44
-1, 846000, 4410, 0xc25b26ce
-0, 855000, 230400, 0x5da75feb
-1, 855000, 4410, 0x4d9237ca
-0, 864000, 230400, 0x4d02f8e3
-1, 864000, 4410, 0x748e1801
-0, 873000, 230400, 0x66824f3a
-1, 873000, 4410, 0xc96b69e6
-0, 882000, 230400, 0x0c9257e2
-1, 882000, 4410, 0x6663186c
-0, 891000, 230400, 0xb2927092
-1, 891000, 4410, 0x7f6d3081
-0, 900000, 230400, 0xb5dc6e9a
-1, 900000, 4410, 0x1a0343b5
-0, 909000, 230400, 0x6e567bc6
-1, 909000, 4410, 0xc48e338c
-0, 918000, 230400, 0xbf9e0f7a
-1, 918000, 4410, 0x26fc03c8
-0, 927000, 230400, 0xb16f684a
-1, 927000, 4410, 0x69be7e2d
-0, 936000, 230400, 0xf9e55e81
-1, 936000, 4410, 0x69a74da1
-0, 945000, 230400, 0xd8d0bcba
-1, 945000, 4410, 0x85bd2ab3
-0, 954000, 230400, 0x44720ac0
-1, 954000, 4410, 0xeff05426
-0, 963000, 230400, 0x7d4c2058
-1, 963000, 4410, 0x292829e0
-0, 972000, 230400, 0xb0973eb9
-1, 972000, 4410, 0x8f741798
-0, 981000, 230400, 0x405a13ce
-1, 981000, 4410, 0x6b9337e9
-0, 990000, 230400, 0x6422f00a
-1, 990000, 4410, 0xe4e1703f
-0, 999000, 230400, 0x924b6c1e
-1, 999000, 4410, 0x043d6c35
-0, 1008000, 230400, 0xcf7809c0
-1, 1008000, 4410, 0x3a8988e7
-0, 1017000, 230400, 0x883a3863
-1, 1017000, 4410, 0x1fa7d2a9
-0, 1026000, 230400, 0x6adc9e03
-1, 1026000, 4410, 0xe28799e3
-0, 1035000, 230400, 0x4f5ab7a8
-1, 1035000, 4410, 0xc2df4470
-0, 1044000, 230400, 0xdc0aab94
-1, 1044000, 4410, 0x694d0cf5
-1, 1053000, 4410, 0x5aac2dcf
-1, 1062000, 4410, 0x259fa2db
-1, 1071000, 4410, 0xd16d6803
-1, 1080000, 4410, 0xa4b3478a
-1, 1089000, 4410, 0xdbe0443d
-1, 1098000, 4410, 0x26c16119
-1, 1107000, 4410, 0x0c06475c
-1, 1116000, 4410, 0x6ffaba2d
-1, 1125000, 4410, 0x5b287192
-1, 1134000, 4410, 0xf2cf2651
-1, 1143000, 4410, 0x3857673a
-1, 1152000, 4410, 0x5b555feb
-1, 1161000, 4410, 0x93f997af
-1, 1170000, 4410, 0xb3ba8d35
-1, 1179000, 4410, 0x66433944
-1, 1188000, 4410, 0xf0005a5f
-1, 1197000, 4410, 0xb948541f
-1, 1206000, 4410, 0xc8f1b16f
-1, 1215000, 4410, 0x7d4b7506
-1, 1224000, 4410, 0xac723c55
-1, 1233000, 4410, 0x2926fab5
-1, 1242000, 4410, 0x31684995
-1, 1251000, 4410, 0x35ebfca4
-1, 1260000, 4410, 0x9cd42c18
-1, 1269000, 4410, 0xd7ecd7b1
-1, 1278000, 4410, 0x5e13c602
-1, 1287000, 4410, 0xe955b5e3
-1, 1296000, 4410, 0xefad19a1
-1, 1305000, 4410, 0x435950de
-1, 1314000, 4410, 0x9d624ebe
-1, 1323000, 4410, 0x774a9158
-1, 1332000, 4410, 0x8c41e66a
-1, 1341000, 4410, 0x70112740
-1, 1350000, 4410, 0x55abc7a2
-1, 1359000, 4410, 0x0ec3183c
-1, 1368000, 4410, 0x54609c56
-1, 1377000, 4410, 0x60d49f92
-1, 1386000, 4410, 0x5fb061c8
-1, 1395000, 4410, 0x6e119c98
-1, 1404000, 4410, 0x3f39fc69
-1, 1413000, 4410, 0xef466d0e
-1, 1422000, 4410, 0xf4cb6fe1
-1, 1431000, 4410, 0xc4434439
-1, 1440000, 4410, 0xd02329d2
-1, 1449000, 4410, 0x216cffaf
-1, 1458000, 4410, 0x7e59e8c1
-1, 1467000, 4410, 0xc7c3346d
-1, 1476000, 4410, 0x5b3723af
-1, 1485000, 4410, 0x76097270
-1, 1494000, 4410, 0xae39a233
-1, 1503000, 4410, 0x686a471c
-1, 1512000, 4410, 0x3af3c5e0
-1, 1521000, 4410, 0x11ac711e
-1, 1530000, 4410, 0xcd8da8ce
-1, 1539000, 4410, 0x21296e3a
-1, 1548000, 4410, 0x77168188
-1, 1557000, 4410, 0x5fcf59cd
-1, 1566000, 4410, 0x390c8717
-1, 1575000, 4410, 0x3d5d5b3c
-1, 1584000, 4410, 0x3b8f13d3
-1, 1593000, 4410, 0x5b002c2f
-1, 1602000, 4410, 0x9e1d2b08
-1, 1611000, 4410, 0x69454ebd
-1, 1620000, 4410, 0x62a54bec
-1, 1629000, 4410, 0x4d231fdb
-1, 1638000, 4410, 0x65624ff7
-1, 1647000, 4410, 0x6fc66932
-1, 1656000, 4410, 0x23200cf6
-1, 1665000, 4410, 0xf8033122
-1, 1674000, 4410, 0x0fce0744
-1, 1683000, 4410, 0x9302683e
-1, 1692000, 4410, 0xd2380245
-1, 1701000, 4410, 0x482e0872
-1, 1710000, 4410, 0xe98e6461
-1, 1719000, 4410, 0x1db404e3
-1, 1728000, 4410, 0x47a26d45
-1, 1737000, 4410, 0x449a348a
-1, 1746000, 4410, 0xee874f84
-1, 1755000, 4410, 0xc4ecf965
-1, 1764000, 4410, 0xcc450bc8
-1, 1773000, 4410, 0xb18d044b
-1, 1782000, 4410, 0x895435e8
-1, 1791000, 4410, 0x57e7574e
-1, 1800000, 4410, 0x8041ad3d
-1, 1809000, 4410, 0x853d1616
-1, 1818000, 4410, 0xa11bb32b
-1, 1827000, 4410, 0xe10ea0de
-1, 1836000, 4410, 0xdf2ee328
-1, 1845000, 4410, 0xd5a6dcae
-1, 1854000, 4410, 0xd176c00b
-1, 1863000, 4410, 0x9cd6bcf3
-1, 1872000, 4410, 0x2569690a
-1, 1881000, 4410, 0x6824aa1d
-1, 1890000, 4410, 0xa9110afa
-1, 1899000, 4410, 0x115c25be
-1, 1908000, 4410, 0x1100f085
-1, 1917000, 4410, 0x00000000
-1, 1926000, 4410, 0x00000000
-1, 1935000, 4410, 0x00000000
-1, 1944000, 4410, 0x00000000
-1, 1953000, 4410, 0x00000000
-1, 1962000, 4410, 0x00000000
-1, 1971000, 4410, 0x00000000
-1, 1980000, 4410, 0x00000000
-1, 1989000, 4410, 0x00000000
-1, 1998000, 4410, 0x00000000
-1, 2007000, 4410, 0x00000000
-1, 2016000, 4410, 0x00000000
-1, 2025000, 4410, 0x00000000
-1, 2034000, 4410, 0x00000000
-1, 2043000, 4410, 0x00000000
-1, 2052000, 4410, 0x00000000
-1, 2061000, 4410, 0x00000000
-1, 2070000, 4410, 0x00000000
-1, 2079000, 4410, 0x00000000
-1, 2088000, 4410, 0x00000000
-1, 2097000, 4410, 0x00000000
-1, 2106000, 4410, 0x00000000
-1, 2115000, 4410, 0x00000000
-1, 2124000, 4410, 0x00000000
-1, 2133000, 4410, 0x00000000
-1, 2142000, 4410, 0x00000000
-1, 2151000, 4410, 0x00000000
-1, 2160000, 4410, 0x00000000
-1, 2169000, 4410, 0x00000000
diff --git a/gst-libs/ext/libav/tests/ref/fate/sierra-vmd-audio b/gst-libs/ext/libav/tests/ref/fate/sierra-vmd-audio
new file mode 100644
index 0000000..13d3567
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/sierra-vmd-audio
@@ -0,0 +1,216 @@
+#tb 0: 1/22050
+0, 0, 0, 61740, 123480, 0x3a794c13
+0, 61740, 61740, 2205, 4410, 0x109d04e0
+0, 63945, 63945, 2205, 4410, 0x224d244f
+0, 66150, 66150, 2205, 4410, 0xbb72413d
+0, 68355, 68355, 2205, 4410, 0xaa5f5b86
+0, 70560, 70560, 2205, 4410, 0x94e7aea7
+0, 72765, 72765, 2205, 4410, 0xad497ca0
+0, 74970, 74970, 2205, 4410, 0x1de10c9e
+0, 77175, 77175, 2205, 4410, 0x9f55efa8
+0, 79380, 79380, 2205, 4410, 0x220a072a
+0, 81585, 81585, 2205, 4410, 0xa7dafb29
+0, 83790, 83790, 2205, 4410, 0xd5e29c7a
+0, 85995, 85995, 2205, 4410, 0xb8465006
+0, 88200, 88200, 2205, 4410, 0x518669c7
+0, 90405, 90405, 2205, 4410, 0xb5b5efca
+0, 92610, 92610, 2205, 4410, 0x8600015d
+0, 94815, 94815, 2205, 4410, 0xe2f68fe9
+0, 97020, 97020, 2205, 4410, 0x8d3458d9
+0, 99225, 99225, 2205, 4410, 0xf1ff4775
+0, 101430, 101430, 2205, 4410, 0x830f67c9
+0, 103635, 103635, 2205, 4410, 0x110e0bc1
+0, 105840, 105840, 2205, 4410, 0x71682f47
+0, 108045, 108045, 2205, 4410, 0x38119095
+0, 110250, 110250, 2205, 4410, 0xd2494db6
+0, 112455, 112455, 2205, 4410, 0x8b552509
+0, 114660, 114660, 2205, 4410, 0x71e52909
+0, 116865, 116865, 2205, 4410, 0x9f0a6f4d
+0, 119070, 119070, 2205, 4410, 0x901302f2
+0, 121275, 121275, 2205, 4410, 0x855d5222
+0, 123480, 123480, 2205, 4410, 0x324bb2fe
+0, 125685, 125685, 2205, 4410, 0xe85f583f
+0, 127890, 127890, 2205, 4410, 0x2cbc67c4
+0, 130095, 130095, 2205, 4410, 0xc82e6aa1
+0, 132300, 132300, 2205, 4410, 0xb9fc423c
+0, 134505, 134505, 2205, 4410, 0x6b9b4ef9
+0, 136710, 136710, 2205, 4410, 0x39290f10
+0, 138915, 138915, 2205, 4410, 0xad718eb4
+0, 141120, 141120, 2205, 4410, 0x82f463ac
+0, 143325, 143325, 2205, 4410, 0xfac87cac
+0, 145530, 145530, 2205, 4410, 0x9e8bcca7
+0, 147735, 147735, 2205, 4410, 0x52f79c99
+0, 149940, 149940, 2205, 4410, 0xf2d14de2
+0, 152145, 152145, 2205, 4410, 0x367f95e1
+0, 154350, 154350, 2205, 4410, 0x8bfac293
+0, 156555, 156555, 2205, 4410, 0x01ea5040
+0, 158760, 158760, 2205, 4410, 0x8ff5e212
+0, 160965, 160965, 2205, 4410, 0x93f32824
+0, 163170, 163170, 2205, 4410, 0x998f90dc
+0, 165375, 165375, 2205, 4410, 0x65231170
+0, 167580, 167580, 2205, 4410, 0xc79039a1
+0, 169785, 169785, 2205, 4410, 0x0b0e58bd
+0, 171990, 171990, 2205, 4410, 0xc24ab4fa
+0, 174195, 174195, 2205, 4410, 0xd3796a8e
+0, 176400, 176400, 2205, 4410, 0xa37f8295
+0, 178605, 178605, 2205, 4410, 0xb760fed7
+0, 180810, 180810, 2205, 4410, 0x05495a34
+0, 183015, 183015, 2205, 4410, 0x6f203437
+0, 185220, 185220, 2205, 4410, 0x71299402
+0, 187425, 187425, 2205, 4410, 0x72e7b346
+0, 189630, 189630, 2205, 4410, 0x879b0dae
+0, 191835, 191835, 2205, 4410, 0x041aa1bd
+0, 194040, 194040, 2205, 4410, 0x18a962e6
+0, 196245, 196245, 2205, 4410, 0x21d20539
+0, 198450, 198450, 2205, 4410, 0x8f449267
+0, 200655, 200655, 2205, 4410, 0xecdc01d6
+0, 202860, 202860, 2205, 4410, 0x458abd5a
+0, 205065, 205065, 2205, 4410, 0xa070ea63
+0, 207270, 207270, 2205, 4410, 0xc25b26ce
+0, 209475, 209475, 2205, 4410, 0x4d9237ca
+0, 211680, 211680, 2205, 4410, 0x748e1801
+0, 213885, 213885, 2205, 4410, 0xc96b69e6
+0, 216090, 216090, 2205, 4410, 0x6663186c
+0, 218295, 218295, 2205, 4410, 0x7f6d3081
+0, 220500, 220500, 2205, 4410, 0x1a0343b5
+0, 222705, 222705, 2205, 4410, 0xc48e338c
+0, 224910, 224910, 2205, 4410, 0x26fc03c8
+0, 227115, 227115, 2205, 4410, 0x69be7e2d
+0, 229320, 229320, 2205, 4410, 0x69a74da1
+0, 231525, 231525, 2205, 4410, 0x85bd2ab3
+0, 233730, 233730, 2205, 4410, 0xeff05426
+0, 235935, 235935, 2205, 4410, 0x292829e0
+0, 238140, 238140, 2205, 4410, 0x8f741798
+0, 240345, 240345, 2205, 4410, 0x6b9337e9
+0, 242550, 242550, 2205, 4410, 0xe4e1703f
+0, 244755, 244755, 2205, 4410, 0x043d6c35
+0, 246960, 246960, 2205, 4410, 0x3a8988e7
+0, 249165, 249165, 2205, 4410, 0x1fa7d2a9
+0, 251370, 251370, 2205, 4410, 0xe28799e3
+0, 253575, 253575, 2205, 4410, 0xc2df4470
+0, 255780, 255780, 2205, 4410, 0x694d0cf5
+0, 257985, 257985, 2205, 4410, 0x5aac2dcf
+0, 260190, 260190, 2205, 4410, 0x259fa2db
+0, 262395, 262395, 2205, 4410, 0xd16d6803
+0, 264600, 264600, 2205, 4410, 0xa4b3478a
+0, 266805, 266805, 2205, 4410, 0xdbe0443d
+0, 269010, 269010, 2205, 4410, 0x26c16119
+0, 271215, 271215, 2205, 4410, 0x0c06475c
+0, 273420, 273420, 2205, 4410, 0x6ffaba2d
+0, 275625, 275625, 2205, 4410, 0x5b287192
+0, 277830, 277830, 2205, 4410, 0xf2cf2651
+0, 280035, 280035, 2205, 4410, 0x3857673a
+0, 282240, 282240, 2205, 4410, 0x5b555feb
+0, 284445, 284445, 2205, 4410, 0x93f997af
+0, 286650, 286650, 2205, 4410, 0xb3ba8d35
+0, 288855, 288855, 2205, 4410, 0x66433944
+0, 291060, 291060, 2205, 4410, 0xf0005a5f
+0, 293265, 293265, 2205, 4410, 0xb948541f
+0, 295470, 295470, 2205, 4410, 0xc8f1b16f
+0, 297675, 297675, 2205, 4410, 0x7d4b7506
+0, 299880, 299880, 2205, 4410, 0xac723c55
+0, 302085, 302085, 2205, 4410, 0x2926fab5
+0, 304290, 304290, 2205, 4410, 0x31684995
+0, 306495, 306495, 2205, 4410, 0x35ebfca4
+0, 308700, 308700, 2205, 4410, 0x9cd42c18
+0, 310905, 310905, 2205, 4410, 0xd7ecd7b1
+0, 313110, 313110, 2205, 4410, 0x5e13c602
+0, 315315, 315315, 2205, 4410, 0xe955b5e3
+0, 317520, 317520, 2205, 4410, 0xefad19a1
+0, 319725, 319725, 2205, 4410, 0x435950de
+0, 321930, 321930, 2205, 4410, 0x9d624ebe
+0, 324135, 324135, 2205, 4410, 0x774a9158
+0, 326340, 326340, 2205, 4410, 0x8c41e66a
+0, 328545, 328545, 2205, 4410, 0x70112740
+0, 330750, 330750, 2205, 4410, 0x55abc7a2
+0, 332955, 332955, 2205, 4410, 0x0ec3183c
+0, 335160, 335160, 2205, 4410, 0x54609c56
+0, 337365, 337365, 2205, 4410, 0x60d49f92
+0, 339570, 339570, 2205, 4410, 0x5fb061c8
+0, 341775, 341775, 2205, 4410, 0x6e119c98
+0, 343980, 343980, 2205, 4410, 0x3f39fc69
+0, 346185, 346185, 2205, 4410, 0xef466d0e
+0, 348390, 348390, 2205, 4410, 0xf4cb6fe1
+0, 350595, 350595, 2205, 4410, 0xc4434439
+0, 352800, 352800, 2205, 4410, 0xd02329d2
+0, 355005, 355005, 2205, 4410, 0x216cffaf
+0, 357210, 357210, 2205, 4410, 0x7e59e8c1
+0, 359415, 359415, 2205, 4410, 0xc7c3346d
+0, 361620, 361620, 2205, 4410, 0x5b3723af
+0, 363825, 363825, 2205, 4410, 0x76097270
+0, 366030, 366030, 2205, 4410, 0xae39a233
+0, 368235, 368235, 2205, 4410, 0x686a471c
+0, 370440, 370440, 2205, 4410, 0x3af3c5e0
+0, 372645, 372645, 2205, 4410, 0x11ac711e
+0, 374850, 374850, 2205, 4410, 0xcd8da8ce
+0, 377055, 377055, 2205, 4410, 0x21296e3a
+0, 379260, 379260, 2205, 4410, 0x77168188
+0, 381465, 381465, 2205, 4410, 0x5fcf59cd
+0, 383670, 383670, 2205, 4410, 0x390c8717
+0, 385875, 385875, 2205, 4410, 0x3d5d5b3c
+0, 388080, 388080, 2205, 4410, 0x3b8f13d3
+0, 390285, 390285, 2205, 4410, 0x5b002c2f
+0, 392490, 392490, 2205, 4410, 0x9e1d2b08
+0, 394695, 394695, 2205, 4410, 0x69454ebd
+0, 396900, 396900, 2205, 4410, 0x62a54bec
+0, 399105, 399105, 2205, 4410, 0x4d231fdb
+0, 401310, 401310, 2205, 4410, 0x65624ff7
+0, 403515, 403515, 2205, 4410, 0x6fc66932
+0, 405720, 405720, 2205, 4410, 0x23200cf6
+0, 407925, 407925, 2205, 4410, 0xf8033122
+0, 410130, 410130, 2205, 4410, 0x0fce0744
+0, 412335, 412335, 2205, 4410, 0x9302683e
+0, 414540, 414540, 2205, 4410, 0xd2380245
+0, 416745, 416745, 2205, 4410, 0x482e0872
+0, 418950, 418950, 2205, 4410, 0xe98e6461
+0, 421155, 421155, 2205, 4410, 0x1db404e3
+0, 423360, 423360, 2205, 4410, 0x47a26d45
+0, 425565, 425565, 2205, 4410, 0x449a348a
+0, 427770, 427770, 2205, 4410, 0xee874f84
+0, 429975, 429975, 2205, 4410, 0xc4ecf965
+0, 432180, 432180, 2205, 4410, 0xcc450bc8
+0, 434385, 434385, 2205, 4410, 0xb18d044b
+0, 436590, 436590, 2205, 4410, 0x895435e8
+0, 438795, 438795, 2205, 4410, 0x57e7574e
+0, 441000, 441000, 2205, 4410, 0x8041ad3d
+0, 443205, 443205, 2205, 4410, 0x853d1616
+0, 445410, 445410, 2205, 4410, 0xa11bb32b
+0, 447615, 447615, 2205, 4410, 0xe10ea0de
+0, 449820, 449820, 2205, 4410, 0xdf2ee328
+0, 452025, 452025, 2205, 4410, 0xd5a6dcae
+0, 454230, 454230, 2205, 4410, 0xd176c00b
+0, 456435, 456435, 2205, 4410, 0x9cd6bcf3
+0, 458640, 458640, 2205, 4410, 0x2569690a
+0, 460845, 460845, 2205, 4410, 0x6824aa1d
+0, 463050, 463050, 2205, 4410, 0xa9110afa
+0, 465255, 465255, 2205, 4410, 0x115c25be
+0, 467460, 467460, 2205, 4410, 0x1100f085
+0, 469665, 469665, 2205, 4410, 0x00000000
+0, 471870, 471870, 2205, 4410, 0x00000000
+0, 474075, 474075, 2205, 4410, 0x00000000
+0, 476280, 476280, 2205, 4410, 0x00000000
+0, 478485, 478485, 2205, 4410, 0x00000000
+0, 480690, 480690, 2205, 4410, 0x00000000
+0, 482895, 482895, 2205, 4410, 0x00000000
+0, 485100, 485100, 2205, 4410, 0x00000000
+0, 487305, 487305, 2205, 4410, 0x00000000
+0, 489510, 489510, 2205, 4410, 0x00000000
+0, 491715, 491715, 2205, 4410, 0x00000000
+0, 493920, 493920, 2205, 4410, 0x00000000
+0, 496125, 496125, 2205, 4410, 0x00000000
+0, 498330, 498330, 2205, 4410, 0x00000000
+0, 500535, 500535, 2205, 4410, 0x00000000
+0, 502740, 502740, 2205, 4410, 0x00000000
+0, 504945, 504945, 2205, 4410, 0x00000000
+0, 507150, 507150, 2205, 4410, 0x00000000
+0, 509355, 509355, 2205, 4410, 0x00000000
+0, 511560, 511560, 2205, 4410, 0x00000000
+0, 513765, 513765, 2205, 4410, 0x00000000
+0, 515970, 515970, 2205, 4410, 0x00000000
+0, 518175, 518175, 2205, 4410, 0x00000000
+0, 520380, 520380, 2205, 4410, 0x00000000
+0, 522585, 522585, 2205, 4410, 0x00000000
+0, 524790, 524790, 2205, 4410, 0x00000000
+0, 526995, 526995, 2205, 4410, 0x00000000
+0, 529200, 529200, 2205, 4410, 0x00000000
+0, 531405, 531405, 2205, 4410, 0x00000000
diff --git a/gst-libs/ext/libav/tests/ref/fate/sierra-vmd-video b/gst-libs/ext/libav/tests/ref/fate/sierra-vmd-video
new file mode 100644
index 0000000..5b9dde1
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/sierra-vmd-video
@@ -0,0 +1,118 @@
+#tb 0: 1/10
+0, 0, 0, 1, 230400, 0x0224ab01
+0, 1, 1, 1, 230400, 0x449e4d81
+0, 2, 2, 1, 230400, 0x3e15e07a
+0, 3, 3, 1, 230400, 0xdabe4172
+0, 4, 4, 1, 230400, 0x0947b7db
+0, 5, 5, 1, 230400, 0x934e243b
+0, 6, 6, 1, 230400, 0x6b5c5b6c
+0, 7, 7, 1, 230400, 0x4bf7bbb5
+0, 8, 8, 1, 230400, 0x423eec8e
+0, 9, 9, 1, 230400, 0x63663b5e
+0, 10, 10, 1, 230400, 0x9c258a67
+0, 11, 11, 1, 230400, 0x1c92b6e0
+0, 12, 12, 1, 230400, 0xdd0a0e28
+0, 13, 13, 1, 230400, 0x51d64af1
+0, 14, 14, 1, 230400, 0x5776ac12
+0, 15, 15, 1, 230400, 0x49070132
+0, 16, 16, 1, 230400, 0xa59635ab
+0, 17, 17, 1, 230400, 0xb1f99504
+0, 18, 18, 1, 230400, 0x61fac725
+0, 19, 19, 1, 230400, 0xc32c28d5
+0, 20, 20, 1, 230400, 0x2b7a91d6
+0, 21, 21, 1, 230400, 0x917be717
+0, 22, 22, 1, 230400, 0xd3c5a2ff
+0, 23, 23, 1, 230400, 0x0678a707
+0, 24, 24, 1, 230400, 0x122504e6
+0, 25, 25, 1, 230400, 0x76aebdae
+0, 26, 26, 1, 230400, 0x81357545
+0, 27, 27, 1, 230400, 0x38baeebd
+0, 28, 28, 1, 230400, 0x1c5c44d4
+0, 29, 29, 1, 230400, 0x60e189cc
+0, 30, 30, 1, 230400, 0xb1f4381c
+0, 31, 31, 1, 230400, 0xb5048fed
+0, 32, 32, 1, 230400, 0xc947c30e
+0, 33, 33, 1, 230400, 0xe8e31c07
+0, 34, 34, 1, 230400, 0x6d49dd02
+0, 35, 35, 1, 230400, 0x293e15d3
+0, 36, 36, 1, 230400, 0x354d792e
+0, 37, 37, 1, 230400, 0x35468780
+0, 38, 38, 1, 230400, 0x365d3991
+0, 39, 39, 1, 230400, 0xc9debef2
+0, 40, 40, 1, 230400, 0x4c4634c2
+0, 41, 41, 1, 230400, 0x347c2dca
+0, 42, 42, 1, 230400, 0x1efa0aaa
+0, 43, 43, 1, 230400, 0xa79a0b5a
+0, 44, 44, 1, 230400, 0xfdb2dcdb
+0, 45, 45, 1, 230400, 0x42dbea33
+0, 46, 46, 1, 230400, 0x2a207e43
+0, 47, 47, 1, 230400, 0x86573783
+0, 48, 48, 1, 230400, 0xc3968473
+0, 49, 49, 1, 230400, 0x8f62a7b4
+0, 50, 50, 1, 230400, 0x5a2e3073
+0, 51, 51, 1, 230400, 0xd24f5e2c
+0, 52, 52, 1, 230400, 0x1df3c67d
+0, 53, 53, 1, 230400, 0xe4fd884d
+0, 57, 57, 1, 230400, 0x9a228555
+0, 58, 58, 1, 230400, 0x9eba8ed5
+0, 59, 59, 1, 230400, 0x3d808a3d
+0, 60, 60, 1, 230400, 0xf57e866d
+0, 61, 61, 1, 230400, 0x85f594f5
+0, 62, 62, 1, 230400, 0xb09f99dd
+0, 63, 63, 1, 230400, 0x2b368475
+0, 64, 64, 1, 230400, 0xa2417afd
+0, 65, 65, 1, 230400, 0x590b709d
+0, 66, 66, 1, 230400, 0x5d617705
+0, 67, 67, 1, 230400, 0xabf981ad
+0, 68, 68, 1, 230400, 0x5a8590cd
+0, 69, 69, 1, 230400, 0x1bff853d
+0, 70, 70, 1, 230400, 0x71d08055
+0, 71, 71, 1, 230400, 0x2ebd817d
+0, 72, 72, 1, 230400, 0x6e838255
+0, 73, 73, 1, 230400, 0x043984cd
+0, 74, 74, 1, 230400, 0x7ff18495
+0, 75, 75, 1, 230400, 0xa43b8385
+0, 76, 76, 1, 230400, 0x72b5825d
+0, 77, 77, 1, 230400, 0x3a178085
+0, 78, 78, 1, 230400, 0x67748245
+0, 79, 79, 1, 230400, 0xeddf81d5
+0, 80, 80, 1, 230400, 0x8b088665
+0, 81, 81, 1, 230400, 0x6c408e15
+0, 82, 82, 1, 230400, 0x81f196dd
+0, 83, 83, 1, 230400, 0xab9f953d
+0, 84, 84, 1, 230400, 0xa5f69795
+0, 85, 85, 1, 230400, 0xa772950d
+0, 86, 86, 1, 230400, 0x6a5596d5
+0, 87, 87, 1, 230400, 0x1355958d
+0, 88, 88, 1, 230400, 0x4134981d
+0, 89, 89, 1, 230400, 0x8b929515
+0, 90, 90, 1, 230400, 0x482f95c5
+0, 91, 91, 1, 230400, 0x7a9795d5
+0, 92, 92, 1, 230400, 0x21c29abd
+0, 93, 93, 1, 230400, 0x9ae6a475
+0, 94, 94, 1, 230400, 0x3734aee5
+0, 95, 95, 1, 230400, 0xa0a1b365
+0, 96, 96, 1, 230400, 0x2dcab1c5
+0, 97, 97, 1, 230400, 0x9c8b6c44
+0, 98, 98, 1, 230400, 0x5da75feb
+0, 99, 99, 1, 230400, 0x4d02f8e3
+0, 100, 100, 1, 230400, 0x66824f3a
+0, 101, 101, 1, 230400, 0x0c9257e2
+0, 102, 102, 1, 230400, 0xb2927092
+0, 103, 103, 1, 230400, 0xb5dc6e9a
+0, 104, 104, 1, 230400, 0x6e567bc6
+0, 105, 105, 1, 230400, 0xbf9e0f7a
+0, 106, 106, 1, 230400, 0xb16f684a
+0, 107, 107, 1, 230400, 0xf9e55e81
+0, 108, 108, 1, 230400, 0xd8d0bcba
+0, 109, 109, 1, 230400, 0x44720ac0
+0, 110, 110, 1, 230400, 0x7d4c2058
+0, 113, 113, 1, 230400, 0xb0973eb9
+0, 114, 114, 1, 230400, 0x405a13ce
+0, 115, 115, 1, 230400, 0x6422f00a
+0, 116, 116, 1, 230400, 0x924b6c1e
+0, 145, 145, 1, 230400, 0xcf7809c0
+0, 146, 146, 1, 230400, 0x883a3863
+0, 147, 147, 1, 230400, 0x6adc9e03
+0, 148, 148, 1, 230400, 0x4f5ab7a8
+0, 214, 214, 1, 230400, 0xdc0aab94
diff --git a/gst-libs/ext/libav/tests/ref/fate/siff b/gst-libs/ext/libav/tests/ref/fate/siff
index 05c12c2..8cc6d7f 100644
--- a/gst-libs/ext/libav/tests/ref/fate/siff
+++ b/gst-libs/ext/libav/tests/ref/fate/siff
@@ -1,39 +1,41 @@
-0, 0, 230400, 0x3bd1d731
-1, 0, 44100, 0xd0a49e09
-0, 7500, 230400, 0x9d0774c3
-0, 15000, 230400, 0xa0faafe2
-0, 22500, 230400, 0x38325309
-0, 30000, 230400, 0xe90a1b1e
-0, 37500, 230400, 0x8efbc904
-0, 45000, 230400, 0x0a8476f3
-0, 52500, 230400, 0x5d94587d
-0, 60000, 230400, 0x280b905d
-0, 67500, 230400, 0x07178dd9
-0, 75000, 230400, 0xf52b8db4
-0, 82500, 230400, 0x2b70c1dc
-0, 90000, 230400, 0x8157a6e9
-1, 90000, 44100, 0xf151af4d
-0, 97500, 230400, 0xd4a3c357
-0, 105000, 230400, 0x703861bb
-0, 112500, 230400, 0xa13cf75e
-0, 120000, 230400, 0x140e487f
-0, 127500, 230400, 0x05cca333
-0, 135000, 230400, 0x0506ee2b
-0, 142500, 230400, 0xe3e13466
-0, 150000, 230400, 0x8a24118c
-0, 157500, 230400, 0x22050962
-0, 165000, 230400, 0x0f5c8a0d
-0, 172500, 230400, 0x3475df44
-0, 180000, 230400, 0x65354e06
-1, 180000, 44100, 0xecd3cd08
-0, 187500, 230400, 0xb9a01978
-0, 195000, 230400, 0x15207ee1
-0, 202500, 230400, 0x3b214f0b
-0, 210000, 230400, 0xf9461bbb
-0, 217500, 230400, 0x1469290f
-0, 225000, 230400, 0x8ddfd514
-0, 232500, 230400, 0x1bffa6a1
-0, 240000, 230400, 0x5a04d712
-0, 247500, 230400, 0xaa8de439
-0, 255000, 230400, 0x610c5439
-0, 262500, 230400, 0xd02d3e7c
+#tb 0: 1/12
+#tb 1: 1/22050
+0, 0, 0, 1, 230400, 0x3bd1d731
+1, 0, 0, 22050, 44100, 0xd0a49e09
+0, 1, 1, 1, 230400, 0x9d0774c3
+0, 2, 2, 1, 230400, 0xa0faafe2
+0, 3, 3, 1, 230400, 0x38325309
+0, 4, 4, 1, 230400, 0xe90a1b1e
+0, 5, 5, 1, 230400, 0x8efbc904
+0, 6, 6, 1, 230400, 0x0a8476f3
+0, 7, 7, 1, 230400, 0x5d94587d
+0, 8, 8, 1, 230400, 0x280b905d
+0, 9, 9, 1, 230400, 0x07178dd9
+0, 10, 10, 1, 230400, 0xf52b8db4
+0, 11, 11, 1, 230400, 0x2b70c1dc
+0, 12, 12, 1, 230400, 0x8157a6e9
+1, 22050, 22050, 22050, 44100, 0xf151af4d
+0, 13, 13, 1, 230400, 0xd4a3c357
+0, 14, 14, 1, 230400, 0x703861bb
+0, 15, 15, 1, 230400, 0xa13cf75e
+0, 16, 16, 1, 230400, 0x140e487f
+0, 17, 17, 1, 230400, 0x05cca333
+0, 18, 18, 1, 230400, 0x0506ee2b
+0, 19, 19, 1, 230400, 0xe3e13466
+0, 20, 20, 1, 230400, 0x8a24118c
+0, 21, 21, 1, 230400, 0x22050962
+0, 22, 22, 1, 230400, 0x0f5c8a0d
+0, 23, 23, 1, 230400, 0x3475df44
+0, 24, 24, 1, 230400, 0x65354e06
+1, 44100, 44100, 22050, 44100, 0xecd3cd08
+0, 25, 25, 1, 230400, 0xb9a01978
+0, 26, 26, 1, 230400, 0x15207ee1
+0, 27, 27, 1, 230400, 0x3b214f0b
+0, 28, 28, 1, 230400, 0xf9461bbb
+0, 29, 29, 1, 230400, 0x1469290f
+0, 30, 30, 1, 230400, 0x8ddfd514
+0, 31, 31, 1, 230400, 0x1bffa6a1
+0, 32, 32, 1, 230400, 0x5a04d712
+0, 33, 33, 1, 230400, 0xaa8de439
+0, 34, 34, 1, 230400, 0x610c5439
+0, 35, 35, 1, 230400, 0xd02d3e7c
diff --git a/gst-libs/ext/libav/tests/ref/fate/smacker b/gst-libs/ext/libav/tests/ref/fate/smacker
deleted file mode 100644
index df88a4a..0000000
--- a/gst-libs/ext/libav/tests/ref/fate/smacker
+++ /dev/null
@@ -1,186 +0,0 @@
-0, 0, 192000, 0x8926d7fc
-1, 0, 47240, 0x9974897c
-0, 6390, 192000, 0x2506d384
-0, 12780, 192000, 0x9a8dc93a
-0, 19170, 192000, 0x4badb7f2
-0, 25560, 192000, 0xc1fc9631
-0, 31950, 192000, 0xfc906592
-0, 38340, 192000, 0xeddd28e2
-0, 44730, 192000, 0xeee0dcf5
-0, 51120, 192000, 0x76798c91
-0, 57510, 192000, 0x8a034c1b
-0, 63900, 192000, 0x4df3127c
-0, 70290, 192000, 0x2eefd36f
-0, 76680, 192000, 0x58a2a1d6
-0, 83070, 192000, 0x1a3d7971
-0, 89460, 192000, 0xa1a65bd5
-0, 95850, 192000, 0x344957b9
-1, 96408, 3128, 0x7e4064b4
-0, 102240, 192000, 0xe23b5f4e
-1, 102792, 3128, 0x80883301
-0, 108630, 192000, 0xb5c2710b
-1, 109176, 3136, 0x2ad2d341
-0, 115020, 192000, 0x7a25938f
-1, 115576, 3128, 0xda8468e3
-0, 121410, 192000, 0x0a84e4c9
-1, 121959, 3136, 0x9d6f6cdf
-0, 127800, 192000, 0x94209b0d
-1, 128359, 3128, 0x1aaa64b5
-0, 134190, 192000, 0xf940e51f
-1, 134743, 3128, 0x9182728b
-0, 140580, 192000, 0xb9fdec42
-1, 141127, 3136, 0xfa8e17b3
-0, 146970, 192000, 0x7b04a376
-1, 147527, 3128, 0x0dc3c1cf
-0, 153360, 192000, 0x5fe0026b
-1, 153910, 3136, 0x0109639d
-0, 159750, 192000, 0x775aca39
-1, 160310, 3128, 0x6d8a12d9
-0, 166140, 192000, 0xae14fb32
-1, 166694, 3128, 0x4b9a9597
-0, 172530, 192000, 0x661106e5
-1, 173078, 3136, 0x9112710e
-0, 178920, 192000, 0xe8658dbf
-1, 179478, 3128, 0x8cccf522
-0, 185310, 192000, 0x5359f0f9
-1, 185861, 3128, 0x6594bbf3
-0, 191700, 192000, 0xc1ec80f4
-1, 192245, 3136, 0xd878a7d5
-0, 198090, 192000, 0xca53806b
-1, 198645, 3128, 0xaa6e3905
-0, 204480, 192000, 0xf0766b2e
-1, 205029, 3136, 0x2a062e04
-0, 210870, 192000, 0x39962da8
-1, 211429, 3128, 0x84e4006a
-0, 217260, 192000, 0x4171c37f
-1, 217812, 3128, 0x85183633
-0, 223650, 192000, 0x3abf3b46
-1, 224196, 3136, 0xb62d4b02
-0, 230040, 192000, 0xecc68313
-1, 230596, 3128, 0xe209462a
-0, 236430, 192000, 0xea339baf
-1, 236980, 3136, 0x57c4824b
-0, 242820, 192000, 0x616b8f16
-1, 243380, 3128, 0x664a9163
-0, 249210, 192000, 0xf77a8581
-1, 249763, 3128, 0xb4287874
-0, 255600, 192000, 0xb315678b
-1, 256147, 3136, 0xde626885
-0, 261990, 192000, 0x0a4a5218
-1, 262547, 3128, 0x919763c2
-0, 268380, 192000, 0x98802be4
-1, 268931, 3128, 0xa4f664e1
-0, 274770, 192000, 0xa2f0fd94
-1, 275314, 3136, 0xa0bab0d4
-0, 281160, 192000, 0x6671c84f
-1, 281714, 3128, 0xe938939c
-0, 287550, 192000, 0x38327e31
-1, 288098, 3136, 0x3679bfc7
-0, 293940, 192000, 0xb85d3e08
-1, 294498, 3128, 0xc96c55c3
-0, 300330, 192000, 0xdc69eba9
-1, 300882, 3128, 0x119114d6
-0, 306720, 192000, 0x8955a0b3
-1, 307265, 3136, 0x42f3800f
-0, 313110, 192000, 0x714a548b
-1, 313665, 3128, 0x4250c4ad
-0, 319500, 192000, 0xc0471de9
-1, 320049, 3136, 0x5cdd4925
-0, 325890, 192000, 0x2e16e039
-1, 326449, 3128, 0xa4c12360
-0, 332280, 192000, 0x9fa4b033
-1, 332833, 3128, 0x849f48de
-0, 338670, 192000, 0x4a0f9402
-1, 339216, 3136, 0x6acd8ff9
-0, 345060, 192000, 0x1f3e6843
-1, 345616, 3128, 0xb2758556
-0, 351450, 192000, 0x31774850
-1, 352000, 3128, 0x10f2fcb1
-0, 357840, 192000, 0x9d5336a2
-1, 358384, 3136, 0xf0f02b23
-0, 364230, 192000, 0xf7de27a2
-1, 364784, 3128, 0x64f759c6
-0, 370620, 192000, 0x98c717ce
-1, 371167, 3136, 0x7ec075e3
-0, 377010, 192000, 0x615b10b8
-1, 377567, 3128, 0xf981d51e
-0, 383400, 192000, 0xd5bc0e7e
-1, 383951, 3128, 0xc622e8b9
-0, 389790, 192000, 0xd5bc0e7e
-1, 390335, 3136, 0xf632e2f8
-0, 396180, 192000, 0xd5bc0e7e
-1, 396735, 3128, 0xda561864
-0, 402570, 192000, 0xd5bc0e7e
-1, 403118, 3136, 0x14d2e888
-0, 408960, 192000, 0xd5bc0e7e
-1, 409518, 3128, 0x015bb869
-0, 415350, 192000, 0xd5bc0e7e
-1, 415902, 3128, 0xedb1fb62
-0, 421740, 192000, 0xd5bc0e7e
-1, 422286, 3136, 0xe0560c41
-0, 428130, 192000, 0xd5bc0e7e
-1, 428686, 3128, 0x14773c9a
-0, 434520, 192000, 0xd5bc0e7e
-1, 435069, 3136, 0x850f1c82
-0, 440910, 192000, 0xd5bc0e7e
-1, 441469, 3128, 0xb0bd5347
-0, 447300, 192000, 0xd5bc0e7e
-1, 447853, 3128, 0x8f82edbf
-0, 453690, 192000, 0xd5bc0e7e
-1, 454237, 3136, 0x493abee2
-0, 460080, 192000, 0xd5bc0e7e
-1, 460637, 3128, 0xf5daff3f
-0, 466470, 192000, 0xd5bc0e7e
-1, 467020, 3128, 0x78ad2690
-0, 472860, 192000, 0xd5bc0e7e
-1, 473404, 3136, 0x490ebafc
-0, 479250, 192000, 0xd5bc0e7e
-1, 479804, 3128, 0x70333fd2
-0, 485640, 192000, 0xd5bc0e7e
-1, 486188, 3136, 0x8cb1c350
-0, 492030, 192000, 0xd5bc0e7e
-1, 492588, 3128, 0x8bd057cb
-0, 498420, 192000, 0xd5bc0e7e
-1, 498971, 3128, 0x161b3dbc
-0, 504810, 192000, 0xd5bc0e7e
-1, 505355, 3136, 0xb47fb88a
-0, 511200, 192000, 0xd5bc0e7e
-1, 511755, 3128, 0x474b381e
-0, 517590, 192000, 0xd5bc0e7e
-1, 518139, 3136, 0x07c519bb
-0, 523980, 192000, 0xd5bc0e7e
-1, 524539, 3128, 0x15b916c8
-0, 530370, 192000, 0xd5bc0e7e
-1, 530922, 3128, 0x0ed7f6fb
-0, 536760, 192000, 0xd5bc0e7e
-1, 537306, 3136, 0x54d6397b
-0, 543150, 192000, 0xd5bc0e7e
-1, 543706, 3128, 0x437242bb
-0, 549540, 192000, 0xd5bc0e7e
-1, 550090, 3128, 0x38f05c4d
-0, 555930, 192000, 0xd5bc0e7e
-1, 556473, 3136, 0x5d000e59
-0, 562320, 192000, 0xd5bc0e7e
-1, 562873, 3128, 0xdeab2d04
-0, 568710, 192000, 0xd5bc0e7e
-1, 569257, 3136, 0x77de6880
-0, 575100, 192000, 0xd5bc0e7e
-1, 575657, 3128, 0xbc87ef25
-0, 581490, 192000, 0xd5bc0e7e
-1, 582041, 3128, 0xc1638ade
-0, 587880, 192000, 0xd5bc0e7e
-1, 588424, 3136, 0xcfb64a5f
-0, 594270, 192000, 0xd5bc0e7e
-1, 594824, 3128, 0x90b1b826
-0, 600660, 192000, 0xd5bc0e7e
-1, 601208, 3136, 0x00000000
-0, 607050, 192000, 0xd5bc0e7e
-1, 607608, 3128, 0x00000000
-0, 613440, 192000, 0xd5bc0e7e
-1, 613992, 3128, 0x00000000
-0, 619830, 192000, 0xd5bc0e7e
-1, 620376, 3136, 0x00000000
-0, 626220, 192000, 0xd5bc0e7e
-1, 626776, 3128, 0x00000000
-0, 632610, 192000, 0xd5bc0e7e
-1, 633159, 2856, 0x00000000
diff --git a/gst-libs/ext/libav/tests/ref/fate/smacker-audio b/gst-libs/ext/libav/tests/ref/fate/smacker-audio
new file mode 100644
index 0000000..442f479
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/smacker-audio
@@ -0,0 +1,87 @@
+#tb 0: 1/22050
+0, 0, 0, 23620, 47240, 0x9974897c
+0, 23620, 23620, 1564, 3128, 0x7e4064b4
+0, 25184, 25184, 1564, 3128, 0x80883301
+0, 26748, 26748, 1568, 3136, 0x2ad2d341
+0, 28316, 28316, 1564, 3128, 0xda8468e3
+0, 29880, 29880, 1568, 3136, 0x9d6f6cdf
+0, 31448, 31448, 1564, 3128, 0x1aaa64b5
+0, 33012, 33012, 1564, 3128, 0x9182728b
+0, 34576, 34576, 1568, 3136, 0xfa8e17b3
+0, 36144, 36144, 1564, 3128, 0x0dc3c1cf
+0, 37708, 37708, 1568, 3136, 0x0109639d
+0, 39276, 39276, 1564, 3128, 0x6d8a12d9
+0, 40840, 40840, 1564, 3128, 0x4b9a9597
+0, 42404, 42404, 1568, 3136, 0x9112710e
+0, 43972, 43972, 1564, 3128, 0x8cccf522
+0, 45536, 45536, 1564, 3128, 0x6594bbf3
+0, 47100, 47100, 1568, 3136, 0xd878a7d5
+0, 48668, 48668, 1564, 3128, 0xaa6e3905
+0, 50232, 50232, 1568, 3136, 0x2a062e04
+0, 51800, 51800, 1564, 3128, 0x84e4006a
+0, 53364, 53364, 1564, 3128, 0x85183633
+0, 54928, 54928, 1568, 3136, 0xb62d4b02
+0, 56496, 56496, 1564, 3128, 0xe209462a
+0, 58060, 58060, 1568, 3136, 0x57c4824b
+0, 59628, 59628, 1564, 3128, 0x664a9163
+0, 61192, 61192, 1564, 3128, 0xb4287874
+0, 62756, 62756, 1568, 3136, 0xde626885
+0, 64324, 64324, 1564, 3128, 0x919763c2
+0, 65888, 65888, 1564, 3128, 0xa4f664e1
+0, 67452, 67452, 1568, 3136, 0xa0bab0d4
+0, 69020, 69020, 1564, 3128, 0xe938939c
+0, 70584, 70584, 1568, 3136, 0x3679bfc7
+0, 72152, 72152, 1564, 3128, 0xc96c55c3
+0, 73716, 73716, 1564, 3128, 0x119114d6
+0, 75280, 75280, 1568, 3136, 0x42f3800f
+0, 76848, 76848, 1564, 3128, 0x4250c4ad
+0, 78412, 78412, 1568, 3136, 0x5cdd4925
+0, 79980, 79980, 1564, 3128, 0xa4c12360
+0, 81544, 81544, 1564, 3128, 0x849f48de
+0, 83108, 83108, 1568, 3136, 0x6acd8ff9
+0, 84676, 84676, 1564, 3128, 0xb2758556
+0, 86240, 86240, 1564, 3128, 0x10f2fcb1
+0, 87804, 87804, 1568, 3136, 0xf0f02b23
+0, 89372, 89372, 1564, 3128, 0x64f759c6
+0, 90936, 90936, 1568, 3136, 0x7ec075e3
+0, 92504, 92504, 1564, 3128, 0xf981d51e
+0, 94068, 94068, 1564, 3128, 0xc622e8b9
+0, 95632, 95632, 1568, 3136, 0xf632e2f8
+0, 97200, 97200, 1564, 3128, 0xda561864
+0, 98764, 98764, 1568, 3136, 0x14d2e888
+0, 100332, 100332, 1564, 3128, 0x015bb869
+0, 101896, 101896, 1564, 3128, 0xedb1fb62
+0, 103460, 103460, 1568, 3136, 0xe0560c41
+0, 105028, 105028, 1564, 3128, 0x14773c9a
+0, 106592, 106592, 1568, 3136, 0x850f1c82
+0, 108160, 108160, 1564, 3128, 0xb0bd5347
+0, 109724, 109724, 1564, 3128, 0x8f82edbf
+0, 111288, 111288, 1568, 3136, 0x493abee2
+0, 112856, 112856, 1564, 3128, 0xf5daff3f
+0, 114420, 114420, 1564, 3128, 0x78ad2690
+0, 115984, 115984, 1568, 3136, 0x490ebafc
+0, 117552, 117552, 1564, 3128, 0x70333fd2
+0, 119116, 119116, 1568, 3136, 0x8cb1c350
+0, 120684, 120684, 1564, 3128, 0x8bd057cb
+0, 122248, 122248, 1564, 3128, 0x161b3dbc
+0, 123812, 123812, 1568, 3136, 0xb47fb88a
+0, 125380, 125380, 1564, 3128, 0x474b381e
+0, 126944, 126944, 1568, 3136, 0x07c519bb
+0, 128512, 128512, 1564, 3128, 0x15b916c8
+0, 130076, 130076, 1564, 3128, 0x0ed7f6fb
+0, 131640, 131640, 1568, 3136, 0x54d6397b
+0, 133208, 133208, 1564, 3128, 0x437242bb
+0, 134772, 134772, 1564, 3128, 0x38f05c4d
+0, 136336, 136336, 1568, 3136, 0x5d000e59
+0, 137904, 137904, 1564, 3128, 0xdeab2d04
+0, 139468, 139468, 1568, 3136, 0x77de6880
+0, 141036, 141036, 1564, 3128, 0xbc87ef25
+0, 142600, 142600, 1564, 3128, 0xc1638ade
+0, 144164, 144164, 1568, 3136, 0xcfb64a5f
+0, 145732, 145732, 1564, 3128, 0x90b1b826
+0, 147296, 147296, 1568, 3136, 0x00000000
+0, 148864, 148864, 1564, 3128, 0x00000000
+0, 150428, 150428, 1564, 3128, 0x00000000
+0, 151992, 151992, 1568, 3136, 0x00000000
+0, 153560, 153560, 1564, 3128, 0x00000000
+0, 155124, 155124, 1428, 2856, 0x00000000
diff --git a/gst-libs/ext/libav/tests/ref/fate/smacker-video b/gst-libs/ext/libav/tests/ref/fate/smacker-video
new file mode 100644
index 0000000..8bd3071
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/smacker-video
@@ -0,0 +1,101 @@
+#tb 0: 71/1000
+0, 0, 0, 1, 192000, 0x8926d7fc
+0, 1, 1, 1, 192000, 0x2506d384
+0, 2, 2, 1, 192000, 0x9a8dc93a
+0, 3, 3, 1, 192000, 0x4badb7f2
+0, 4, 4, 1, 192000, 0xc1fc9631
+0, 5, 5, 1, 192000, 0xfc906592
+0, 6, 6, 1, 192000, 0xeddd28e2
+0, 7, 7, 1, 192000, 0xeee0dcf5
+0, 8, 8, 1, 192000, 0x76798c91
+0, 9, 9, 1, 192000, 0x8a034c1b
+0, 10, 10, 1, 192000, 0x4df3127c
+0, 11, 11, 1, 192000, 0x2eefd36f
+0, 12, 12, 1, 192000, 0x58a2a1d6
+0, 13, 13, 1, 192000, 0x1a3d7971
+0, 14, 14, 1, 192000, 0xa1a65bd5
+0, 15, 15, 1, 192000, 0x344957b9
+0, 16, 16, 1, 192000, 0xe23b5f4e
+0, 17, 17, 1, 192000, 0xb5c2710b
+0, 18, 18, 1, 192000, 0x7a25938f
+0, 19, 19, 1, 192000, 0x0a84e4c9
+0, 20, 20, 1, 192000, 0x94209b0d
+0, 21, 21, 1, 192000, 0xf940e51f
+0, 22, 22, 1, 192000, 0xb9fdec42
+0, 23, 23, 1, 192000, 0x7b04a376
+0, 24, 24, 1, 192000, 0x5fe0026b
+0, 25, 25, 1, 192000, 0x775aca39
+0, 26, 26, 1, 192000, 0xae14fb32
+0, 27, 27, 1, 192000, 0x661106e5
+0, 28, 28, 1, 192000, 0xe8658dbf
+0, 29, 29, 1, 192000, 0x5359f0f9
+0, 30, 30, 1, 192000, 0xc1ec80f4
+0, 31, 31, 1, 192000, 0xca53806b
+0, 32, 32, 1, 192000, 0xf0766b2e
+0, 33, 33, 1, 192000, 0x39962da8
+0, 34, 34, 1, 192000, 0x4171c37f
+0, 35, 35, 1, 192000, 0x3abf3b46
+0, 36, 36, 1, 192000, 0xecc68313
+0, 37, 37, 1, 192000, 0xea339baf
+0, 38, 38, 1, 192000, 0x616b8f16
+0, 39, 39, 1, 192000, 0xf77a8581
+0, 40, 40, 1, 192000, 0xb315678b
+0, 41, 41, 1, 192000, 0x0a4a5218
+0, 42, 42, 1, 192000, 0x98802be4
+0, 43, 43, 1, 192000, 0xa2f0fd94
+0, 44, 44, 1, 192000, 0x6671c84f
+0, 45, 45, 1, 192000, 0x38327e31
+0, 46, 46, 1, 192000, 0xb85d3e08
+0, 47, 47, 1, 192000, 0xdc69eba9
+0, 48, 48, 1, 192000, 0x8955a0b3
+0, 49, 49, 1, 192000, 0x714a548b
+0, 50, 50, 1, 192000, 0xc0471de9
+0, 51, 51, 1, 192000, 0x2e16e039
+0, 52, 52, 1, 192000, 0x9fa4b033
+0, 53, 53, 1, 192000, 0x4a0f9402
+0, 54, 54, 1, 192000, 0x1f3e6843
+0, 55, 55, 1, 192000, 0x31774850
+0, 56, 56, 1, 192000, 0x9d5336a2
+0, 57, 57, 1, 192000, 0xf7de27a2
+0, 58, 58, 1, 192000, 0x98c717ce
+0, 59, 59, 1, 192000, 0x615b10b8
+0, 60, 60, 1, 192000, 0xd5bc0e7e
+0, 61, 61, 1, 192000, 0xd5bc0e7e
+0, 62, 62, 1, 192000, 0xd5bc0e7e
+0, 63, 63, 1, 192000, 0xd5bc0e7e
+0, 64, 64, 1, 192000, 0xd5bc0e7e
+0, 65, 65, 1, 192000, 0xd5bc0e7e
+0, 66, 66, 1, 192000, 0xd5bc0e7e
+0, 67, 67, 1, 192000, 0xd5bc0e7e
+0, 68, 68, 1, 192000, 0xd5bc0e7e
+0, 69, 69, 1, 192000, 0xd5bc0e7e
+0, 70, 70, 1, 192000, 0xd5bc0e7e
+0, 71, 71, 1, 192000, 0xd5bc0e7e
+0, 72, 72, 1, 192000, 0xd5bc0e7e
+0, 73, 73, 1, 192000, 0xd5bc0e7e
+0, 74, 74, 1, 192000, 0xd5bc0e7e
+0, 75, 75, 1, 192000, 0xd5bc0e7e
+0, 76, 76, 1, 192000, 0xd5bc0e7e
+0, 77, 77, 1, 192000, 0xd5bc0e7e
+0, 78, 78, 1, 192000, 0xd5bc0e7e
+0, 79, 79, 1, 192000, 0xd5bc0e7e
+0, 80, 80, 1, 192000, 0xd5bc0e7e
+0, 81, 81, 1, 192000, 0xd5bc0e7e
+0, 82, 82, 1, 192000, 0xd5bc0e7e
+0, 83, 83, 1, 192000, 0xd5bc0e7e
+0, 84, 84, 1, 192000, 0xd5bc0e7e
+0, 85, 85, 1, 192000, 0xd5bc0e7e
+0, 86, 86, 1, 192000, 0xd5bc0e7e
+0, 87, 87, 1, 192000, 0xd5bc0e7e
+0, 88, 88, 1, 192000, 0xd5bc0e7e
+0, 89, 89, 1, 192000, 0xd5bc0e7e
+0, 90, 90, 1, 192000, 0xd5bc0e7e
+0, 91, 91, 1, 192000, 0xd5bc0e7e
+0, 92, 92, 1, 192000, 0xd5bc0e7e
+0, 93, 93, 1, 192000, 0xd5bc0e7e
+0, 94, 94, 1, 192000, 0xd5bc0e7e
+0, 95, 95, 1, 192000, 0xd5bc0e7e
+0, 96, 96, 1, 192000, 0xd5bc0e7e
+0, 97, 97, 1, 192000, 0xd5bc0e7e
+0, 98, 98, 1, 192000, 0xd5bc0e7e
+0, 99, 99, 1, 192000, 0xd5bc0e7e
diff --git a/gst-libs/ext/libav/tests/ref/fate/smc b/gst-libs/ext/libav/tests/ref/fate/smc
index 2901b90..cdfc3d5 100644
--- a/gst-libs/ext/libav/tests/ref/fate/smc
+++ b/gst-libs/ext/libav/tests/ref/fate/smc
@@ -1,120 +1,121 @@
-0, 0, 230400, 0xf814fc90
-0, 9000, 230400, 0xe1b13137
-0, 18000, 230400, 0xa7f4d408
-0, 27000, 230400, 0x4b86e1d5
-0, 36000, 230400, 0xc663af5a
-0, 45000, 230400, 0x943b5757
-0, 54000, 230400, 0x0d7ee496
-0, 63000, 230400, 0x78792de4
-0, 72000, 230400, 0xd102fb8d
-0, 81000, 230400, 0xf9006139
-0, 90000, 230400, 0x216bd87d
-0, 99000, 230400, 0x1e4c902c
-0, 108000, 230400, 0x5aaa7742
-0, 117000, 230400, 0x48699d93
-0, 126000, 230400, 0xd1e22a5c
-0, 135000, 230400, 0x18929315
-0, 144000, 230400, 0x680dd4d3
-0, 153000, 230400, 0x4cdbcbcb
-0, 162000, 230400, 0x6f810d98
-0, 171000, 230400, 0xb4f68204
-0, 180000, 230400, 0xbd3bb19e
-0, 189000, 230400, 0xab27b424
-0, 198000, 230400, 0xe5dd675d
-0, 207000, 230400, 0x811e45a1
-0, 216000, 230400, 0x951011f7
-0, 225000, 230400, 0x2f1e2b99
-0, 234000, 230400, 0x6657c0d6
-0, 243000, 230400, 0xfd29177d
-0, 252000, 230400, 0x4b4c01d7
-0, 261000, 230400, 0x9af286aa
-0, 270000, 230400, 0xc4e9b193
-0, 279000, 230400, 0x05dc28ec
-0, 288000, 230400, 0x68352119
-0, 297000, 230400, 0x0b87e79c
-0, 306000, 230400, 0x8358b180
-0, 315000, 230400, 0x8debbc9d
-0, 324000, 230400, 0x961c58ce
-0, 333000, 230400, 0xd8a809c8
-0, 342000, 230400, 0x5351789d
-0, 351000, 230400, 0xa7ca598c
-0, 360000, 230400, 0xc5ce1812
-0, 369000, 230400, 0x74496550
-0, 378000, 230400, 0x326e366e
-0, 387000, 230400, 0x27ae9a92
-0, 396000, 230400, 0xadbc8794
-0, 405000, 230400, 0x7f3587d8
-0, 414000, 230400, 0xf0400ca6
-0, 423000, 230400, 0x59a5138e
-0, 432000, 230400, 0x456d62a5
-0, 441000, 230400, 0xf1a5e5f1
-0, 450000, 230400, 0x75c712e4
-0, 459000, 230400, 0xd160780a
-0, 468000, 230400, 0xc6c23cf0
-0, 477000, 230400, 0x0339a2ac
-0, 486000, 230400, 0x0e27a2e2
-0, 495000, 230400, 0x84976300
-0, 504000, 230400, 0xb368f3c4
-0, 513000, 230400, 0xa5231fb8
-0, 522000, 230400, 0x17c036d4
-0, 531000, 230400, 0xfc81a2c0
-0, 540000, 230400, 0x99faa403
-0, 549000, 230400, 0xff59efd3
-0, 558000, 230400, 0xcece1d23
-0, 567000, 230400, 0x56c785d9
-0, 576000, 230400, 0xe5a9f222
-0, 585000, 230400, 0xb80946f8
-0, 594000, 230400, 0xf6b642c6
-0, 603000, 230400, 0x69573aed
-0, 612000, 230400, 0xfb69a1fd
-0, 621000, 230400, 0x100b47f4
-0, 630000, 230400, 0x6edf9543
-0, 639000, 230400, 0x11fdf43c
-0, 648000, 230400, 0xd143bf2a
-0, 657000, 230400, 0x7ca747c4
-0, 666000, 230400, 0xd984bd73
-0, 675000, 230400, 0xc5477e8d
-0, 684000, 230400, 0xf7d58300
-0, 693000, 230400, 0x7a1b9463
-0, 702000, 230400, 0x47a29342
-0, 711000, 230400, 0xdf437f9d
-0, 720000, 230400, 0xf836ef5d
-0, 729000, 230400, 0xc98937af
-0, 738000, 230400, 0x9258695b
-0, 747000, 230400, 0xd4fe179c
-0, 756000, 230400, 0x35d524d3
-0, 765000, 230400, 0xd9ce5484
-0, 774000, 230400, 0xdef776ed
-0, 783000, 230400, 0x154c4057
-0, 792000, 230400, 0xf5c764f1
-0, 801000, 230400, 0x41979b13
-0, 810000, 230400, 0xae4e83db
-0, 819000, 230400, 0x09fc0f83
-0, 828000, 230400, 0x60267fdf
-0, 837000, 230400, 0xeaafc525
-0, 846000, 230400, 0x80cc35e5
-0, 855000, 230400, 0xd82c6164
-0, 864000, 230400, 0xd68b8111
-0, 873000, 230400, 0x96f874a3
-0, 882000, 230400, 0x7fc861c4
-0, 891000, 230400, 0xb911f310
-0, 900000, 230400, 0x35bbf5aa
-0, 909000, 230400, 0xa922b683
-0, 918000, 230400, 0xbf6ae353
-0, 927000, 230400, 0x6bd3984c
-0, 936000, 230400, 0xe51768c0
-0, 945000, 230400, 0xee691624
-0, 954000, 230400, 0xd546fed7
-0, 963000, 230400, 0x98d375e6
-0, 972000, 230400, 0x3b9ca990
-0, 981000, 230400, 0x27128ad1
-0, 990000, 230400, 0x2788e38c
-0, 999000, 230400, 0xb0cf3381
-0, 1008000, 230400, 0x4fc86d39
-0, 1017000, 230400, 0xf5632fff
-0, 1026000, 230400, 0x7fa1e6c2
-0, 1035000, 230400, 0xffeef044
-0, 1044000, 230400, 0x932af385
-0, 1053000, 230400, 0x76738428
-0, 1062000, 230400, 0xf6771ba2
-0, 1071000, 230400, 0x17e2ff27
+#tb 0: 1/30
+0, 0, 0, 1, 230400, 0xf814fc90
+0, 3, 3, 1, 230400, 0xe1b13137
+0, 6, 6, 1, 230400, 0xa7f4d408
+0, 9, 9, 1, 230400, 0x4b86e1d5
+0, 12, 12, 1, 230400, 0xc663af5a
+0, 15, 15, 1, 230400, 0x943b5757
+0, 18, 18, 1, 230400, 0x0d7ee496
+0, 21, 21, 1, 230400, 0x78792de4
+0, 24, 24, 1, 230400, 0xd102fb8d
+0, 27, 27, 1, 230400, 0xf9006139
+0, 30, 30, 1, 230400, 0x216bd87d
+0, 33, 33, 1, 230400, 0x1e4c902c
+0, 36, 36, 1, 230400, 0x5aaa7742
+0, 39, 39, 1, 230400, 0x48699d93
+0, 42, 42, 1, 230400, 0xd1e22a5c
+0, 45, 45, 1, 230400, 0x18929315
+0, 48, 48, 1, 230400, 0x680dd4d3
+0, 51, 51, 1, 230400, 0x4cdbcbcb
+0, 54, 54, 1, 230400, 0x6f810d98
+0, 57, 57, 1, 230400, 0xb4f68204
+0, 60, 60, 1, 230400, 0xbd3bb19e
+0, 63, 63, 1, 230400, 0xab27b424
+0, 66, 66, 1, 230400, 0xe5dd675d
+0, 69, 69, 1, 230400, 0x811e45a1
+0, 72, 72, 1, 230400, 0x951011f7
+0, 75, 75, 1, 230400, 0x2f1e2b99
+0, 78, 78, 1, 230400, 0x6657c0d6
+0, 81, 81, 1, 230400, 0xfd29177d
+0, 84, 84, 1, 230400, 0x4b4c01d7
+0, 87, 87, 1, 230400, 0x9af286aa
+0, 90, 90, 1, 230400, 0xc4e9b193
+0, 93, 93, 1, 230400, 0x05dc28ec
+0, 96, 96, 1, 230400, 0x68352119
+0, 99, 99, 1, 230400, 0x0b87e79c
+0, 102, 102, 1, 230400, 0x8358b180
+0, 105, 105, 1, 230400, 0x8debbc9d
+0, 108, 108, 1, 230400, 0x961c58ce
+0, 111, 111, 1, 230400, 0xd8a809c8
+0, 114, 114, 1, 230400, 0x5351789d
+0, 117, 117, 1, 230400, 0xa7ca598c
+0, 120, 120, 1, 230400, 0xc5ce1812
+0, 123, 123, 1, 230400, 0x74496550
+0, 126, 126, 1, 230400, 0x326e366e
+0, 129, 129, 1, 230400, 0x27ae9a92
+0, 132, 132, 1, 230400, 0xadbc8794
+0, 135, 135, 1, 230400, 0x7f3587d8
+0, 138, 138, 1, 230400, 0xf0400ca6
+0, 141, 141, 1, 230400, 0x59a5138e
+0, 144, 144, 1, 230400, 0x456d62a5
+0, 147, 147, 1, 230400, 0xf1a5e5f1
+0, 150, 150, 1, 230400, 0x75c712e4
+0, 153, 153, 1, 230400, 0xd160780a
+0, 156, 156, 1, 230400, 0xc6c23cf0
+0, 159, 159, 1, 230400, 0x0339a2ac
+0, 162, 162, 1, 230400, 0x0e27a2e2
+0, 165, 165, 1, 230400, 0x84976300
+0, 168, 168, 1, 230400, 0xb368f3c4
+0, 171, 171, 1, 230400, 0xa5231fb8
+0, 174, 174, 1, 230400, 0x17c036d4
+0, 177, 177, 1, 230400, 0xfc81a2c0
+0, 180, 180, 1, 230400, 0x99faa403
+0, 183, 183, 1, 230400, 0xff59efd3
+0, 186, 186, 1, 230400, 0xcece1d23
+0, 189, 189, 1, 230400, 0x56c785d9
+0, 192, 192, 1, 230400, 0xe5a9f222
+0, 195, 195, 1, 230400, 0xb80946f8
+0, 198, 198, 1, 230400, 0xf6b642c6
+0, 201, 201, 1, 230400, 0x69573aed
+0, 204, 204, 1, 230400, 0xfb69a1fd
+0, 207, 207, 1, 230400, 0x100b47f4
+0, 210, 210, 1, 230400, 0x6edf9543
+0, 213, 213, 1, 230400, 0x11fdf43c
+0, 216, 216, 1, 230400, 0xd143bf2a
+0, 219, 219, 1, 230400, 0x7ca747c4
+0, 222, 222, 1, 230400, 0xd984bd73
+0, 225, 225, 1, 230400, 0xc5477e8d
+0, 228, 228, 1, 230400, 0xf7d58300
+0, 231, 231, 1, 230400, 0x7a1b9463
+0, 234, 234, 1, 230400, 0x47a29342
+0, 237, 237, 1, 230400, 0xdf437f9d
+0, 240, 240, 1, 230400, 0xf836ef5d
+0, 243, 243, 1, 230400, 0xc98937af
+0, 246, 246, 1, 230400, 0x9258695b
+0, 249, 249, 1, 230400, 0xd4fe179c
+0, 252, 252, 1, 230400, 0x35d524d3
+0, 255, 255, 1, 230400, 0xd9ce5484
+0, 258, 258, 1, 230400, 0xdef776ed
+0, 261, 261, 1, 230400, 0x154c4057
+0, 264, 264, 1, 230400, 0xf5c764f1
+0, 267, 267, 1, 230400, 0x41979b13
+0, 270, 270, 1, 230400, 0xae4e83db
+0, 273, 273, 1, 230400, 0x09fc0f83
+0, 276, 276, 1, 230400, 0x60267fdf
+0, 279, 279, 1, 230400, 0xeaafc525
+0, 282, 282, 1, 230400, 0x80cc35e5
+0, 285, 285, 1, 230400, 0xd82c6164
+0, 288, 288, 1, 230400, 0xd68b8111
+0, 291, 291, 1, 230400, 0x96f874a3
+0, 294, 294, 1, 230400, 0x7fc861c4
+0, 297, 297, 1, 230400, 0xb911f310
+0, 300, 300, 1, 230400, 0x35bbf5aa
+0, 303, 303, 1, 230400, 0xa922b683
+0, 306, 306, 1, 230400, 0xbf6ae353
+0, 309, 309, 1, 230400, 0x6bd3984c
+0, 312, 312, 1, 230400, 0xe51768c0
+0, 315, 315, 1, 230400, 0xee691624
+0, 318, 318, 1, 230400, 0xd546fed7
+0, 321, 321, 1, 230400, 0x98d375e6
+0, 324, 324, 1, 230400, 0x3b9ca990
+0, 327, 327, 1, 230400, 0x27128ad1
+0, 330, 330, 1, 230400, 0x2788e38c
+0, 333, 333, 1, 230400, 0xb0cf3381
+0, 336, 336, 1, 230400, 0x4fc86d39
+0, 339, 339, 1, 230400, 0xf5632fff
+0, 342, 342, 1, 230400, 0x7fa1e6c2
+0, 345, 345, 1, 230400, 0xffeef044
+0, 348, 348, 1, 230400, 0x932af385
+0, 351, 351, 1, 230400, 0x76738428
+0, 354, 354, 1, 230400, 0xf6771ba2
+0, 357, 357, 1, 230400, 0x17e2ff27
diff --git a/gst-libs/ext/libav/tests/ref/fate/smjpeg b/gst-libs/ext/libav/tests/ref/fate/smjpeg
deleted file mode 100644
index ec91959..0000000
--- a/gst-libs/ext/libav/tests/ref/fate/smjpeg
+++ /dev/null
@@ -1,423 +0,0 @@
-0, 0, 734, 0x5a042c2c
-1, 0, 1024, 0x00000000
-1, 2090, 1024, 0x00000000
-1, 4180, 1024, 0xd89a448e
-1, 6269, 1024, 0x695b369c
-1, 8359, 1024, 0xc8ba5707
-0, 9990, 763, 0xb5893f2f
-1, 10449, 1024, 0xdf241fc6
-1, 12539, 1024, 0x61cf4166
-1, 14629, 1024, 0x97cbc386
-1, 16718, 1024, 0x44899d04
-1, 18808, 1024, 0xa7cbaa62
-0, 19980, 3023, 0x0f3907d3
-1, 20898, 1024, 0xa7aea60c
-1, 22988, 1024, 0xd7b18a89
-1, 25078, 1024, 0x268e81f6
-1, 27167, 1024, 0x9cf83a2f
-1, 29257, 1024, 0x5559b508
-0, 29970, 4800, 0x22e6e18a
-1, 31347, 1024, 0xe1b9e71c
-1, 33437, 1024, 0xdcee733e
-1, 35527, 1024, 0xe5918f60
-1, 37616, 1024, 0x29dbd209
-1, 39706, 1024, 0x9bcbcf16
-0, 39960, 6417, 0x427adde5
-1, 41796, 1024, 0x86f5f458
-1, 43886, 1024, 0xabcbda86
-1, 45976, 1024, 0xc51f77b9
-1, 48065, 1024, 0xf6b3a504
-0, 49950, 6776, 0x7a74c6ad
-1, 50155, 1024, 0x1af3e40e
-1, 52245, 1024, 0x3866b03b
-1, 54335, 1024, 0xbc005403
-1, 56424, 1024, 0xe9dfcc51
-1, 58514, 1024, 0x83c837cb
-0, 59940, 6808, 0x1f6eb7c3
-1, 60604, 1024, 0xfa649580
-1, 62694, 1024, 0x519452ea
-1, 64784, 1024, 0xd4978774
-1, 66873, 1024, 0xe2a3b1cd
-1, 68963, 1024, 0x9a9472ad
-0, 69930, 6726, 0x452087e6
-1, 71053, 1024, 0xa12d4060
-1, 73143, 1024, 0x31fb0646
-1, 75233, 1024, 0xfc44343f
-1, 77322, 1024, 0x0847751a
-1, 79412, 1024, 0x227968a2
-0, 79920, 6829, 0xee82b109
-1, 81502, 1024, 0x7cce9f1c
-1, 83592, 1024, 0xb8356713
-1, 85682, 1024, 0xb29f6e6f
-1, 87771, 1024, 0x9e1430ab
-1, 89861, 1024, 0x26d85423
-0, 89910, 7055, 0xf41f1108
-1, 91951, 1024, 0x6496547d
-1, 94041, 1024, 0x316b1a86
-1, 96131, 1024, 0x3cd83afc
-1, 98220, 1024, 0x993ff633
-0, 99990, 6977, 0xf8fe1ede
-1, 100310, 1024, 0x0708d1a2
-1, 102400, 1024, 0xd7230db9
-1, 104490, 1024, 0xbb0779ca
-1, 106580, 1024, 0xc6094e1b
-1, 108669, 1024, 0x15a8b039
-0, 109980, 6942, 0x9ad105c6
-1, 110759, 1024, 0xd6dbe88c
-1, 112849, 1024, 0x7e8d1140
-1, 114939, 1024, 0xef88e525
-1, 117029, 1024, 0x44e21149
-1, 119118, 1024, 0x65b0f5f4
-0, 119970, 6926, 0xe239dad6
-1, 121208, 1024, 0xb955f687
-1, 123298, 1024, 0xc85fba9c
-1, 125388, 1024, 0xf59655ad
-1, 127478, 1024, 0x6de80bf1
-1, 129567, 1024, 0x2dcf6e41
-0, 129960, 6966, 0x81dcfab1
-1, 131657, 1024, 0xd0ddcf8a
-1, 133747, 1024, 0x00135c2d
-1, 135837, 1024, 0x697f8efd
-1, 137927, 1024, 0x7a9bada5
-0, 139950, 6896, 0x31e6cc02
-1, 140016, 1024, 0x0d22783c
-1, 142106, 1024, 0x7726d07d
-1, 144196, 1024, 0xa2f14f67
-1, 146286, 1024, 0x7f51060d
-1, 148376, 1024, 0xc4ec6aea
-0, 149940, 6889, 0x1cc1006e
-1, 150465, 1024, 0x9bb37ca4
-1, 152555, 1024, 0x9b085577
-1, 154645, 1024, 0x8812f8af
-1, 156735, 1024, 0x788f5221
-1, 158824, 1024, 0x3a2ce642
-0, 159930, 6933, 0xc303f87f
-1, 160914, 1024, 0x72415692
-1, 163004, 1024, 0xe3dcc105
-1, 165094, 1024, 0xb26c0599
-1, 167184, 1024, 0x5c9e55eb
-1, 169273, 1024, 0x8fe88707
-0, 169920, 7034, 0xb4970a20
-1, 171363, 1024, 0xc5d7beb6
-1, 173453, 1024, 0xe1d3a3b4
-1, 175543, 1024, 0x012da0c6
-1, 177633, 1024, 0x8d010922
-1, 179722, 1024, 0x3366eb0d
-0, 179910, 6961, 0xf064095d
-1, 181812, 1024, 0xc9381a27
-1, 183902, 1024, 0x0774f685
-1, 185992, 1024, 0xc5cae0a5
-1, 188082, 1024, 0xa6f4737c
-0, 189990, 7089, 0x5ba350f9
-1, 190171, 1024, 0x8fb6d0d1
-1, 192261, 1024, 0x05f579c2
-1, 194351, 1024, 0x56905d99
-1, 196441, 1024, 0x002ee18d
-1, 198531, 1024, 0xeb37ef51
-0, 199980, 7078, 0xa83f3e88
-1, 200620, 1024, 0x38025635
-1, 202710, 1024, 0x4fe643c8
-1, 204800, 1024, 0x11d66ab1
-1, 206890, 1024, 0xcc3051e9
-1, 208980, 1024, 0xcd93e854
-0, 209970, 7147, 0xcda66cfc
-1, 211069, 1024, 0x38f1196d
-1, 213159, 1024, 0x657a15fc
-1, 215249, 1024, 0x669ce2a9
-1, 217339, 1024, 0x95862dda
-1, 219429, 1024, 0x1726a7b2
-0, 219960, 7173, 0xb7455859
-1, 221518, 1024, 0xd6ece2a1
-1, 223608, 1024, 0x33ab9553
-1, 225698, 1024, 0xd50c73a6
-1, 227788, 1024, 0xfe25b63a
-1, 229878, 1024, 0x7e2959e3
-0, 229950, 7213, 0x97b89994
-1, 231967, 1024, 0xa4c07b34
-1, 234057, 1024, 0xd6d8f15c
-1, 236147, 1024, 0x1eccddd7
-1, 238237, 1024, 0x2b69f9cb
-0, 239940, 7170, 0xca8b2948
-1, 240327, 1024, 0x667b775f
-1, 242416, 1024, 0xad3b84e9
-1, 244506, 1024, 0x4f29fc67
-1, 246596, 1024, 0x8d611ab7
-1, 248686, 1024, 0x278966ea
-0, 249930, 7174, 0xc7cc6bbb
-1, 250776, 1024, 0xaf33812b
-1, 252865, 1024, 0xa55f4265
-1, 254955, 1024, 0x023cb51c
-1, 257045, 1024, 0x1d1f1005
-1, 259135, 1024, 0x874cccf7
-0, 259920, 7235, 0xc2e68d2b
-1, 261224, 1024, 0xda705428
-1, 263314, 1024, 0x48d9b440
-1, 265404, 1024, 0xa14e0712
-1, 267494, 1024, 0x7efbad1f
-1, 269584, 1024, 0xdb82c17f
-0, 270000, 7261, 0x8204a423
-1, 271673, 1024, 0xcbe87613
-1, 273763, 1024, 0x3a63df1d
-1, 275853, 1024, 0xd5636bba
-1, 277943, 1024, 0x9397af23
-0, 279990, 7353, 0xacc7e7c0
-1, 280033, 1024, 0x32a07c98
-1, 282122, 1024, 0x202ca667
-1, 284212, 1024, 0xdf969011
-1, 286302, 1024, 0xc434d238
-1, 288392, 1024, 0xe9ad7562
-0, 289980, 7065, 0x45035c5c
-1, 290482, 1024, 0xb51b6b50
-1, 292571, 1024, 0xe70aecd3
-1, 294661, 1024, 0x03c816b2
-1, 296751, 1024, 0x869fdf25
-1, 298841, 1024, 0xd40a0a62
-0, 299970, 7269, 0x72edbb76
-1, 300931, 1024, 0x5af7dd35
-1, 303020, 1024, 0x891ffc72
-1, 305110, 1024, 0x1ff68a08
-1, 307200, 1024, 0x5a7517a9
-1, 309290, 1024, 0x0f959f74
-0, 309960, 7220, 0xb926772f
-1, 311380, 1024, 0xe92a12a2
-1, 313469, 1024, 0x38000e55
-1, 315559, 1024, 0x39fbdd70
-1, 317649, 1024, 0xca3d9184
-1, 319739, 1024, 0x66c8995b
-0, 319950, 7326, 0x0a66c632
-1, 321829, 1024, 0xac25acea
-1, 323918, 1024, 0x3cd1046c
-1, 326008, 1024, 0x6a1df31c
-1, 328098, 1024, 0x21ca10a1
-0, 329940, 7225, 0xe39076ab
-1, 330188, 1024, 0x1aeccedc
-1, 332278, 1024, 0xddea1335
-1, 334367, 1024, 0x19f5ca9f
-1, 336457, 1024, 0x88e95e43
-1, 338547, 1024, 0x726284fe
-0, 339930, 7265, 0xe0209036
-1, 340637, 1024, 0x6b85b40e
-1, 342727, 1024, 0x111fee2a
-1, 344816, 1024, 0x3656b588
-1, 346906, 1024, 0xa5a2b552
-1, 348996, 1024, 0x38fb2467
-0, 349920, 7337, 0x7a5dc093
-1, 351086, 1024, 0xaa919ccc
-1, 353176, 1024, 0x15993dbc
-1, 355265, 1024, 0xbe01a7b9
-1, 357355, 1024, 0xefe93c09
-1, 359445, 1024, 0x1bb566e5
-0, 360000, 7246, 0x519a7a3c
-1, 361535, 1024, 0x15ce6237
-1, 363624, 1024, 0xa8552e66
-1, 365714, 1024, 0x9d80187e
-1, 367804, 1024, 0x5df3fc30
-1, 369894, 1024, 0x1a312aa5
-0, 369990, 7266, 0x352c8078
-1, 371984, 1024, 0x6bb8e302
-1, 374073, 1024, 0xbd9684bb
-1, 376163, 1024, 0x78b0b166
-1, 378253, 1024, 0xd9af5eae
-0, 379980, 7323, 0xcaf69d7c
-1, 380343, 1024, 0xdb90fe82
-1, 382433, 1024, 0x327614e9
-1, 384522, 1024, 0x1f19b7fe
-1, 386612, 1024, 0x46c53f96
-1, 388702, 1024, 0x921b2189
-0, 389970, 7309, 0x98c1e6f7
-1, 390792, 1024, 0xa8fbc85a
-1, 392882, 1024, 0xabfdaaae
-1, 394971, 1024, 0x6acc7387
-1, 397061, 1024, 0x0d9c27b5
-1, 399151, 1024, 0xba4dd809
-0, 399960, 7121, 0x913d5bd6
-1, 401241, 1024, 0x2a2ad521
-1, 403331, 1024, 0x892de38a
-1, 405420, 1024, 0xdc97a2eb
-1, 407510, 1024, 0x4f614ca4
-1, 409600, 1024, 0x9c8a77ea
-0, 409950, 7088, 0x56302362
-1, 411690, 1024, 0x2d30e646
-1, 413780, 1024, 0x74e800a7
-1, 415869, 1024, 0x1e01fb02
-1, 417959, 1024, 0x4ed2c1d8
-0, 419940, 7104, 0xc0d14f78
-1, 420049, 1024, 0xf2fdbe63
-1, 422139, 1024, 0x8d6f63a1
-1, 424229, 1024, 0xded468d9
-1, 426318, 1024, 0xccad839e
-1, 428408, 1024, 0xdde7c082
-0, 429930, 7169, 0xd03c825b
-1, 430498, 1024, 0x548613c5
-1, 432588, 1024, 0x383909bd
-1, 434678, 1024, 0xfd37627b
-1, 436767, 1024, 0x6d95a481
-1, 438857, 1024, 0x56aa87fa
-0, 439920, 7038, 0x1ecc201d
-1, 440947, 1024, 0x7b67258c
-1, 443037, 1024, 0x7dd99a92
-1, 445127, 1024, 0x4a66d102
-1, 447216, 1024, 0x7b3fce51
-1, 449306, 1024, 0xbbd968aa
-0, 450000, 7015, 0x83c94454
-1, 451396, 1024, 0x8283ec36
-1, 453486, 1024, 0x3c96493d
-1, 455576, 1024, 0xfa4f8cf8
-1, 457665, 1024, 0xe2cf872d
-1, 459755, 1024, 0x0a9e7aa6
-0, 459990, 6983, 0x9e51f54d
-1, 461845, 1024, 0x6e7a0550
-1, 463935, 1024, 0x3acfea2f
-1, 466024, 1024, 0x7111d0fa
-1, 468114, 1024, 0xe9a1eca9
-0, 469980, 7088, 0x70d33de1
-1, 470204, 1024, 0x24da6c46
-1, 472294, 1024, 0x117cff37
-1, 474384, 1024, 0x0f27cab6
-1, 476473, 1024, 0x69b6b4e6
-1, 478563, 1024, 0x1e6cc841
-0, 479970, 7096, 0x4d0f81b5
-1, 480653, 1024, 0xb01e2365
-1, 482743, 1024, 0x14e200d3
-1, 484833, 1024, 0xd1184c98
-1, 486922, 1024, 0xef9140e9
-1, 489012, 1024, 0x4cbb645e
-0, 489960, 7106, 0xd1a83ddc
-1, 491102, 1024, 0xe7fe2f06
-1, 493192, 1024, 0xf8c45028
-1, 495282, 1024, 0x561358f4
-1, 497371, 1024, 0xd0129b77
-1, 499461, 1024, 0xcc636e88
-0, 499950, 7219, 0x20f47fe4
-1, 501551, 1024, 0xe9406321
-1, 503641, 1024, 0x9f16a041
-1, 505731, 1024, 0x468bf409
-1, 507820, 1024, 0x3df70f7b
-1, 509910, 1024, 0xa880b11b
-0, 509940, 7184, 0x45dc6a0e
-1, 512000, 1024, 0x3286c489
-1, 514090, 1024, 0x39fe9ebc
-1, 516180, 1024, 0xc533d83b
-1, 518269, 1024, 0x153b195d
-0, 519930, 7222, 0x488c6499
-1, 520359, 1024, 0xd84786a1
-1, 522449, 1024, 0xdc295aaa
-1, 524539, 1024, 0xfb764d8c
-1, 526629, 1024, 0xeebc9db9
-1, 528718, 1024, 0x7ba9403e
-0, 529920, 7254, 0xbd097ba7
-1, 530808, 1024, 0x4e5571ec
-1, 532898, 1024, 0xd965fad4
-1, 534988, 1024, 0x87e259f2
-1, 537078, 1024, 0xae7e533b
-1, 539167, 1024, 0x313cf4d6
-0, 540000, 7189, 0x46e06d43
-1, 541257, 1024, 0xe1844c90
-1, 543347, 1024, 0xbb057b44
-1, 545437, 1024, 0xa5099687
-1, 547527, 1024, 0xbff10707
-1, 549616, 1024, 0x37c4ffc0
-0, 549990, 7283, 0x19dd7319
-1, 551706, 1024, 0xf9fb6caa
-1, 553796, 1024, 0x3b6a3a1f
-1, 555886, 1024, 0x83431edb
-1, 557976, 1024, 0x1eb713cf
-0, 559980, 7161, 0x23171d02
-1, 560065, 1024, 0xd7b07a6d
-1, 562155, 1024, 0x81ae3391
-1, 564245, 1024, 0xf150130a
-1, 566335, 1024, 0x09678eaa
-1, 568424, 1024, 0xb94e06f1
-0, 569970, 6976, 0xcc610c26
-1, 570514, 1024, 0x67b1dbc9
-1, 572604, 1024, 0xd6edc235
-1, 574694, 1024, 0x34e4c499
-1, 576784, 1024, 0xeefd89c0
-1, 578873, 1024, 0x38afdaf1
-0, 579960, 7056, 0x6cd917b0
-1, 580963, 1024, 0x29a60d76
-1, 583053, 1024, 0xe28a4372
-1, 585143, 1024, 0x7089454d
-1, 587233, 1024, 0x0c01bb7b
-1, 589322, 1024, 0xbd776a72
-0, 589950, 6736, 0x02b78951
-1, 591412, 1024, 0x86776fd0
-1, 593502, 1024, 0xb37c88f7
-1, 595592, 1024, 0x5f90aaf8
-1, 597682, 1024, 0x203d4222
-1, 599771, 1024, 0x382692a6
-0, 599940, 6540, 0x767e0854
-1, 601861, 1024, 0xf37c95fd
-1, 603951, 1024, 0x6c0b8877
-1, 606041, 1024, 0x2e54a8b6
-1, 608131, 1024, 0x7f266488
-0, 609930, 6170, 0xc84962fb
-1, 610220, 1024, 0xfbf20f9a
-1, 612310, 1024, 0xf2985cc0
-1, 614400, 1024, 0xc7075340
-1, 616490, 1024, 0xe4585695
-1, 618580, 1024, 0xbdffa380
-0, 619920, 6169, 0x27e06c03
-1, 620669, 1024, 0x2422a8a9
-1, 622759, 1024, 0x59cbd75f
-1, 624849, 1024, 0x04ad1a8c
-1, 626939, 1024, 0x33c09191
-1, 629029, 1024, 0x55efa6fd
-0, 630000, 5864, 0xd14db83f
-1, 631118, 1024, 0xf73d0e5d
-1, 633208, 1024, 0x6141ebae
-1, 635298, 1024, 0x7db17a68
-1, 637388, 1024, 0xa6c690b6
-1, 639478, 1024, 0xa6fd6725
-0, 639990, 5375, 0x4a21055d
-1, 641567, 1024, 0x50a90b9b
-1, 643657, 1024, 0xef990dc8
-1, 645747, 1024, 0x75adf6b5
-1, 647837, 1024, 0x61eac43e
-1, 649927, 1024, 0x67797a19
-0, 649980, 5206, 0x95ead3cb
-1, 652016, 1024, 0xf325277a
-1, 654106, 1024, 0x18bf254a
-1, 656196, 1024, 0x2ce6bee3
-1, 658286, 1024, 0x8d320860
-0, 659970, 5220, 0xcfdcc37e
-1, 660376, 1024, 0xc979b6e8
-1, 662465, 1024, 0xdb644b41
-1, 664555, 1024, 0xe1b368ba
-1, 666645, 1024, 0xacc53d15
-1, 668735, 1024, 0x42ea8c18
-0, 669960, 4946, 0x2d864a77
-1, 670824, 1024, 0xe52c99a4
-1, 672914, 1024, 0xd7db54a6
-1, 675004, 1024, 0x7f27a7e3
-1, 677094, 1024, 0xf7ffeaa9
-1, 679184, 1024, 0x792b6088
-0, 679950, 4390, 0x2ab9f462
-1, 681273, 1024, 0x61d99724
-1, 683363, 1024, 0x5213720e
-1, 685453, 1024, 0xac09dd30
-1, 687543, 1024, 0x960bf6bb
-1, 689633, 1024, 0xc90168e1
-0, 689940, 4051, 0x1d09592e
-1, 691722, 1024, 0x43b45768
-1, 693812, 1024, 0x935d60a1
-1, 695902, 1024, 0x9a342ef2
-1, 697992, 1024, 0xc894709f
-0, 699930, 3680, 0x39bd6a12
-1, 700082, 1024, 0x59b43b07
-1, 702171, 1024, 0x36a1a98d
-1, 704261, 1024, 0x9e1a121c
-1, 706351, 1024, 0x02208b78
-1, 708441, 1024, 0xd1d7b274
-0, 709920, 2910, 0x6337ece9
-1, 710531, 1024, 0xdacd5096
-1, 712620, 1024, 0x51b71ead
-1, 714710, 1024, 0xd009a7ca
-1, 716800, 1024, 0xb6d5a938
-1, 718890, 1024, 0xf3d45e47
-0, 720000, 2153, 0xf4e3bc17
-1, 720980, 1024, 0xea8e04fc
-1, 723069, 1024, 0x0b928bd8
-1, 725159, 1024, 0x0f02caec
-1, 727249, 1024, 0xe2b137a8
-1, 729339, 1024, 0xd5f94892
diff --git a/gst-libs/ext/libav/tests/ref/fate/smjpeg-demux b/gst-libs/ext/libav/tests/ref/fate/smjpeg-demux
new file mode 100644
index 0000000..4fcd614
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/smjpeg-demux
@@ -0,0 +1,425 @@
+#tb 0: 1/1000
+#tb 1: 1/1000
+0, 0, 0, 0, 734, 0x5a042c2c
+1, 0, 0, 23, 260, 0x00000000
+1, 23, 23, 23, 260, 0x00000000
+1, 46, 46, 23, 260, 0xac9e0a9b
+1, 69, 69, 23, 260, 0x89256f5b
+1, 92, 92, 23, 260, 0x8e646e36
+0, 111, 111, 0, 763, 0xb5893f2f
+1, 116, 116, 23, 260, 0x3ab972fc
+1, 139, 139, 23, 260, 0xaea86bb2
+1, 162, 162, 23, 260, 0x2366447a
+1, 185, 185, 23, 260, 0x82c14f9c
+1, 208, 208, 23, 260, 0xcdcf6fa8
+0, 222, 222, 0, 3023, 0x0f3907d3
+1, 232, 232, 23, 260, 0xb3ed64bd
+1, 255, 255, 23, 260, 0xac304b92
+1, 278, 278, 23, 260, 0xc8bc553b
+1, 301, 301, 23, 260, 0xd35572b4
+1, 325, 325, 23, 260, 0x182f6190
+0, 333, 333, 0, 4800, 0x22e6e18a
+1, 348, 348, 23, 260, 0xbf9145c0
+1, 371, 371, 23, 260, 0x0ec85a7e
+1, 394, 394, 23, 260, 0x3684720e
+1, 417, 417, 23, 260, 0xe985616a
+1, 441, 441, 23, 260, 0x12b147dc
+0, 444, 444, 0, 6417, 0x427adde5
+1, 464, 464, 23, 260, 0xb8b55dd9
+1, 487, 487, 23, 260, 0xfd4a7007
+1, 510, 510, 23, 260, 0xfcc05c9a
+1, 534, 534, 23, 260, 0x20f74aea
+0, 555, 555, 0, 6776, 0x7a74c6ad
+1, 557, 557, 23, 260, 0x025359ca
+1, 580, 580, 23, 260, 0xace44ba1
+1, 603, 603, 23, 260, 0x03506929
+1, 626, 626, 23, 260, 0x8a926f17
+1, 650, 650, 23, 260, 0x4a7061e7
+0, 666, 666, 0, 6808, 0x1f6eb7c3
+1, 673, 673, 23, 260, 0xf8b66cc9
+1, 696, 696, 23, 260, 0xe8c96dec
+1, 719, 719, 23, 260, 0x672a54a6
+1, 743, 743, 23, 260, 0xe97b5698
+1, 766, 766, 23, 260, 0x377f684d
+0, 777, 777, 0, 6726, 0x452087e6
+1, 789, 789, 23, 260, 0xe9a66786
+1, 812, 812, 23, 260, 0xf8e17080
+1, 835, 835, 23, 260, 0x65eb662a
+1, 859, 859, 23, 260, 0xd8d361e9
+1, 882, 882, 23, 260, 0xb8115a0b
+0, 888, 888, 0, 6829, 0xee82b109
+1, 905, 905, 23, 260, 0xa5a85461
+1, 928, 928, 23, 260, 0xf401663b
+1, 952, 952, 23, 260, 0x042f714e
+1, 975, 975, 23, 260, 0xdf195820
+1, 998, 998, 23, 260, 0x0a67653c
+0, 999, 999, 0, 7055, 0xf41f1108
+1, 1021, 1021, 23, 260, 0xe9b44d02
+1, 1044, 1044, 23, 260, 0xbd4747b9
+1, 1068, 1068, 23, 260, 0x3ef66738
+1, 1091, 1091, 23, 260, 0x0f4a6e44
+0, 1111, 1111, 0, 6977, 0xf8fe1ede
+1, 1114, 1114, 23, 260, 0xaa3d6eb6
+1, 1137, 1137, 23, 260, 0xb9a46c4a
+1, 1160, 1160, 23, 260, 0x4f974c2e
+1, 1184, 1184, 23, 260, 0x9e714a00
+1, 1207, 1207, 23, 260, 0x601a7152
+0, 1222, 1222, 0, 6942, 0x9ad105c6
+1, 1230, 1230, 23, 260, 0xaf317064
+1, 1253, 1253, 23, 260, 0x163d4829
+1, 1277, 1277, 23, 260, 0xc56b4f1a
+1, 1300, 1300, 23, 260, 0x7623729c
+1, 1323, 1323, 23, 260, 0xa514694f
+0, 1333, 1333, 0, 6926, 0xe239dad6
+1, 1346, 1346, 23, 260, 0x93ee4ad8
+1, 1369, 1369, 23, 260, 0x6d8e573f
+1, 1393, 1393, 23, 260, 0x13256d68
+1, 1416, 1416, 23, 260, 0x187761a2
+1, 1439, 1439, 23, 260, 0x426045e7
+0, 1444, 1444, 0, 6966, 0x81dcfab1
+1, 1462, 1462, 23, 260, 0x7e7e5891
+1, 1486, 1486, 23, 260, 0xd6926dcc
+1, 1509, 1509, 23, 260, 0xf0196061
+1, 1532, 1532, 23, 260, 0x7cac49a3
+0, 1555, 1555, 0, 6896, 0x31e6cc02
+1, 1555, 1555, 23, 260, 0x24f4549a
+1, 1578, 1578, 23, 260, 0x937f551d
+1, 1602, 1602, 23, 260, 0x9bf462c5
+1, 1625, 1625, 23, 260, 0xd1e07436
+1, 1648, 1648, 23, 260, 0xdab36215
+0, 1666, 1666, 0, 6889, 0x1cc1006e
+1, 1671, 1671, 23, 260, 0xabc5662b
+1, 1695, 1695, 23, 260, 0xa24f6bf1
+1, 1718, 1718, 23, 260, 0x39e664b2
+1, 1741, 1741, 23, 260, 0xf5dc54ca
+1, 1764, 1764, 23, 260, 0xc3b16974
+0, 1777, 1777, 0, 6933, 0xc303f87f
+1, 1787, 1787, 23, 260, 0x6cf46bca
+1, 1811, 1811, 23, 260, 0x7a6b69b9
+1, 1834, 1834, 23, 260, 0xc02f69b9
+1, 1857, 1857, 23, 260, 0x7fc764a9
+1, 1880, 1880, 23, 260, 0xd9705b09
+0, 1888, 1888, 0, 7034, 0xb4970a20
+1, 1904, 1904, 23, 260, 0x17b05f49
+1, 1927, 1927, 23, 260, 0x10ad647c
+1, 1950, 1950, 23, 260, 0xf9636d69
+1, 1973, 1973, 23, 260, 0x622b5ad9
+1, 1996, 1996, 23, 260, 0x175b646d
+0, 1999, 1999, 0, 6961, 0xf064095d
+1, 2020, 2020, 23, 260, 0x722b5827
+1, 2043, 2043, 23, 260, 0x83614974
+1, 2066, 2066, 23, 260, 0x80366587
+1, 2089, 2089, 23, 260, 0x050f6bf9
+0, 2111, 2111, 0, 7089, 0x5ba350f9
+1, 2113, 2113, 23, 260, 0x949d6735
+1, 2136, 2136, 23, 260, 0x62cd7184
+1, 2159, 2159, 23, 260, 0x21e45713
+1, 2182, 2182, 23, 260, 0x56314509
+1, 2205, 2205, 23, 260, 0x7a1570d3
+0, 2222, 2222, 0, 7078, 0xa83f3e88
+1, 2229, 2229, 23, 260, 0x205a6ffb
+1, 2252, 2252, 23, 260, 0xead94483
+1, 2275, 2275, 23, 260, 0x93c84f10
+1, 2298, 2298, 23, 260, 0xdf45726f
+1, 2321, 2321, 23, 260, 0x35016f1e
+0, 2333, 2333, 0, 7147, 0xcda66cfc
+1, 2345, 2345, 23, 260, 0xa8114bcd
+1, 2368, 2368, 23, 260, 0x14c45130
+1, 2391, 2391, 23, 260, 0x97b07052
+1, 2414, 2414, 23, 260, 0x039b6c77
+1, 2438, 2438, 23, 260, 0x46f74635
+0, 2444, 2444, 0, 7173, 0xb7455859
+1, 2461, 2461, 23, 260, 0x4116540d
+1, 2484, 2484, 23, 260, 0x26747067
+1, 2507, 2507, 23, 260, 0x37f16485
+1, 2530, 2530, 23, 260, 0x631d4a33
+1, 2554, 2554, 23, 260, 0x14ed598d
+0, 2555, 2555, 0, 7213, 0x97b89994
+1, 2577, 2577, 23, 260, 0x3f9349e7
+1, 2600, 2600, 23, 260, 0x91295757
+1, 2623, 2623, 23, 260, 0x95de72bc
+1, 2647, 2647, 23, 260, 0xc7ee5ddb
+0, 2666, 2666, 0, 7170, 0xca8b2948
+1, 2670, 2670, 23, 260, 0x38e965cd
+1, 2693, 2693, 23, 260, 0xfae169e9
+1, 2716, 2716, 23, 260, 0x9c226143
+1, 2739, 2739, 23, 260, 0x1a804dbe
+1, 2763, 2763, 23, 260, 0x4aeb633c
+0, 2777, 2777, 0, 7174, 0xc7cc6bbb
+1, 2786, 2786, 23, 260, 0xa66e6bbb
+1, 2809, 2809, 23, 260, 0x51d17109
+1, 2832, 2832, 23, 260, 0x2bc86b9b
+1, 2856, 2856, 23, 260, 0xe56e6378
+1, 2879, 2879, 23, 260, 0x95665b47
+0, 2888, 2888, 0, 7235, 0xc2e68d2b
+1, 2902, 2902, 23, 260, 0x1c255fdb
+1, 2925, 2925, 23, 260, 0x3a2456cb
+1, 2948, 2948, 23, 260, 0xe18e7270
+1, 2972, 2972, 23, 260, 0x55b65c60
+1, 2995, 2995, 23, 260, 0x62be6515
+0, 3000, 3000, 0, 7261, 0x8204a423
+1, 3018, 3018, 23, 260, 0xdba25d09
+1, 3041, 3041, 23, 260, 0xd7cc4e40
+1, 3065, 3065, 23, 260, 0x335661be
+1, 3088, 3088, 23, 260, 0xc3286de3
+0, 3111, 3111, 0, 7353, 0xacc7e7c0
+1, 3111, 3111, 23, 260, 0x47e76e35
+1, 3134, 3134, 23, 260, 0x4b716f77
+1, 3157, 3157, 23, 260, 0x0716519e
+1, 3181, 3181, 23, 260, 0x032b4490
+1, 3204, 3204, 23, 260, 0x15f067e8
+0, 3222, 3222, 0, 7065, 0x45035c5c
+1, 3227, 3227, 23, 260, 0x16766ffa
+1, 3250, 3250, 23, 260, 0xc94154ac
+1, 3274, 3274, 23, 260, 0x74764bcd
+1, 3297, 3297, 23, 260, 0x3fad6f8f
+1, 3320, 3320, 23, 260, 0x5fa972a9
+0, 3333, 3333, 0, 7269, 0x72edbb76
+1, 3343, 3343, 23, 260, 0xde2a4b7b
+1, 3366, 3366, 23, 260, 0xd8494408
+1, 3390, 3390, 23, 260, 0x843d71a6
+1, 3413, 3413, 23, 260, 0x87fd6b60
+1, 3436, 3436, 23, 260, 0x1cc04a39
+0, 3444, 3444, 0, 7220, 0xb926772f
+1, 3459, 3459, 23, 260, 0x9ca24d94
+1, 3482, 3482, 23, 260, 0x820a7087
+1, 3506, 3506, 23, 260, 0x631166b2
+1, 3529, 3529, 23, 260, 0x2f20492a
+1, 3552, 3552, 23, 260, 0x932156d0
+0, 3555, 3555, 0, 7326, 0x0a66c632
+1, 3575, 3575, 23, 260, 0xdad54c90
+1, 3599, 3599, 23, 260, 0xcce84fc9
+1, 3622, 3622, 23, 260, 0xba317486
+1, 3645, 3645, 23, 260, 0xf5a4626a
+0, 3666, 3666, 0, 7225, 0xe39076ab
+1, 3668, 3668, 23, 260, 0x324669fd
+1, 3691, 3691, 23, 260, 0xc7d37113
+1, 3715, 3715, 23, 260, 0xc6e0644f
+1, 3738, 3738, 23, 260, 0x1b91522e
+1, 3761, 3761, 23, 260, 0x9b84667d
+0, 3777, 3777, 0, 7265, 0xe0209036
+1, 3784, 3784, 23, 260, 0xed7e66eb
+1, 3808, 3808, 23, 260, 0xaf806d1f
+1, 3831, 3831, 23, 260, 0x13a66941
+1, 3854, 3854, 23, 260, 0x13095a41
+1, 3877, 3877, 23, 260, 0x5ba05491
+0, 3888, 3888, 0, 7337, 0x7a5dc093
+1, 3900, 3900, 23, 260, 0xbf785887
+1, 3924, 3924, 23, 260, 0x21965973
+1, 3947, 3947, 23, 260, 0xd9aa7134
+1, 3970, 3970, 23, 260, 0x3add62bc
+1, 3993, 3993, 23, 260, 0xb9626260
+0, 4000, 4000, 0, 7246, 0x519a7a3c
+1, 4017, 4017, 23, 260, 0x5b08629f
+1, 4040, 4040, 23, 260, 0x43a34659
+1, 4063, 4063, 23, 260, 0x68575bda
+1, 4086, 4086, 23, 260, 0xd98b715a
+1, 4109, 4109, 23, 260, 0x7d816a77
+0, 4111, 4111, 0, 7266, 0x352c8078
+1, 4133, 4133, 23, 260, 0x16af6ff1
+1, 4156, 4156, 23, 260, 0x6d4557a7
+1, 4179, 4179, 23, 260, 0x0743401a
+1, 4202, 4202, 23, 260, 0x410563d8
+0, 4222, 4222, 0, 7323, 0xcaf69d7c
+1, 4226, 4226, 23, 260, 0x561371d1
+1, 4249, 4249, 23, 260, 0x3ef15872
+1, 4272, 4272, 23, 260, 0x1dd04972
+1, 4295, 4295, 23, 260, 0xed226c62
+1, 4318, 4318, 23, 260, 0x20857046
+0, 4333, 4333, 0, 7309, 0x98c1e6f7
+1, 4342, 4342, 23, 260, 0xed7f4724
+1, 4365, 4365, 23, 260, 0x7a7445cf
+1, 4388, 4388, 23, 260, 0x06ad6a93
+1, 4411, 4411, 23, 260, 0xdd1b6c91
+1, 4435, 4435, 23, 260, 0x05b94d27
+0, 4444, 4444, 111, 7121, 0x913d5bd6
+1, 4458, 4458, 23, 260, 0x12cc5062
+1, 4481, 4481, 23, 260, 0x44526d0f
+1, 4504, 4504, 23, 260, 0xf2ac6d95
+1, 4527, 4527, 23, 260, 0x27174b0f
+1, 4551, 4551, 23, 260, 0xcf125efe
+0, 4555, 4555, 111, 7088, 0x56302362
+1, 4574, 4574, 23, 260, 0xb8ce45a1
+1, 4597, 4597, 23, 260, 0x91895627
+1, 4620, 4620, 23, 260, 0x6edb706a
+1, 4643, 4643, 23, 260, 0x4e16674b
+0, 4666, 4666, 111, 7104, 0xc0d14f78
+1, 4667, 4667, 23, 260, 0xa9d66370
+1, 4690, 4690, 23, 260, 0x8f007043
+1, 4713, 4713, 23, 260, 0xdc1a5583
+1, 4736, 4736, 23, 260, 0x2f025511
+1, 4760, 4760, 23, 260, 0x2a4d6ddb
+0, 4777, 4777, 111, 7169, 0xd03c825b
+1, 4783, 4783, 23, 260, 0x54806f14
+1, 4806, 4806, 23, 260, 0xe0ac6d80
+1, 4829, 4829, 23, 260, 0xd9cf6c97
+1, 4852, 4852, 23, 260, 0xba705b6d
+1, 4876, 4876, 23, 260, 0x0be158e0
+0, 4888, 4888, 111, 7038, 0x1ecc201d
+1, 4899, 4899, 23, 260, 0x32b3645d
+1, 4922, 4922, 23, 260, 0x4a0a55b4
+1, 4945, 4945, 23, 260, 0x078b6fd8
+1, 4969, 4969, 23, 260, 0xc2816368
+1, 4992, 4992, 23, 260, 0xbdee5e4d
+0, 5000, 5000, 111, 7015, 0x83c94454
+1, 5015, 5015, 23, 260, 0x475366aa
+1, 5038, 5038, 23, 260, 0x2f9a44b9
+1, 5061, 5061, 23, 260, 0x91745ee5
+1, 5085, 5085, 23, 260, 0xc29b6e16
+1, 5108, 5108, 23, 260, 0x6ebb6b0e
+0, 5111, 5111, 111, 6983, 0x9e51f54d
+1, 5131, 5131, 23, 260, 0x4e7d7043
+1, 5154, 5154, 23, 260, 0x10b45caf
+1, 5178, 5178, 23, 260, 0x1b1e4e54
+1, 5201, 5201, 23, 260, 0xcc7b6443
+0, 5222, 5222, 111, 7088, 0x70d33de1
+1, 5224, 5224, 23, 260, 0x29936fdd
+1, 5247, 5247, 23, 260, 0x395256e3
+1, 5270, 5270, 23, 260, 0x50fb459f
+1, 5294, 5294, 23, 260, 0x0bef64ec
+1, 5317, 5317, 23, 260, 0xadd372dd
+0, 5333, 5333, 111, 7096, 0x4d0f81b5
+1, 5340, 5340, 23, 260, 0xc49e56dc
+1, 5363, 5363, 23, 260, 0x44e749c1
+1, 5387, 5387, 23, 260, 0x030e6c8a
+1, 5410, 5410, 23, 260, 0x82a47261
+1, 5433, 5433, 23, 260, 0xa3764fcc
+0, 5444, 5444, 111, 7106, 0xd1a83ddc
+1, 5456, 5456, 23, 260, 0xb1a1498a
+1, 5479, 5479, 23, 260, 0xbf9c7184
+1, 5503, 5503, 23, 260, 0xa45f6da8
+1, 5526, 5526, 23, 260, 0x9a2e4d51
+1, 5549, 5549, 23, 260, 0xa15c56ed
+0, 5555, 5555, 111, 7219, 0x20f47fe4
+1, 5572, 5572, 23, 260, 0x7029496c
+1, 5596, 5596, 23, 260, 0xf3595213
+1, 5619, 5619, 23, 260, 0x0dab6c5a
+1, 5642, 5642, 23, 260, 0x0e2367da
+1, 5665, 5665, 23, 260, 0xbb56610a
+0, 5666, 5666, 111, 7184, 0x45dc6a0e
+1, 5688, 5688, 23, 260, 0xcc916c92
+1, 5712, 5712, 23, 260, 0x886c5ba9
+1, 5735, 5735, 23, 260, 0x1b255a69
+1, 5758, 5758, 23, 260, 0xb7a66792
+0, 5777, 5777, 111, 7222, 0x488c6499
+1, 5781, 5781, 23, 260, 0x7d946b0e
+1, 5804, 5804, 23, 260, 0x07d16714
+1, 5828, 5828, 23, 260, 0x77ef6755
+1, 5851, 5851, 23, 260, 0xb2fe6849
+1, 5874, 5874, 23, 260, 0x601b5325
+0, 5888, 5888, 111, 7254, 0xbd097ba7
+1, 5897, 5897, 23, 260, 0x309c68d0
+1, 5921, 5921, 23, 260, 0x7bbe5d49
+1, 5944, 5944, 23, 260, 0x77bc6e47
+1, 5967, 5967, 23, 260, 0x3e0a6b0b
+1, 5990, 5990, 23, 260, 0x2ae458c4
+0, 6000, 6000, 111, 7189, 0x46e06d43
+1, 6013, 6013, 23, 260, 0x17576d4f
+1, 6037, 6037, 23, 260, 0x496c4bbd
+1, 6060, 6060, 23, 260, 0x972758a0
+1, 6083, 6083, 23, 260, 0xa9897452
+1, 6106, 6106, 23, 260, 0xf58c6b92
+0, 6111, 6111, 111, 7283, 0x19dd7319
+1, 6130, 6130, 23, 260, 0x8368709a
+1, 6153, 6153, 23, 260, 0x3890643f
+1, 6176, 6176, 23, 260, 0xdcc1472c
+1, 6199, 6199, 23, 260, 0xb601605c
+0, 6222, 6222, 111, 7161, 0x23171d02
+1, 6222, 6222, 23, 260, 0xfafd6e13
+1, 6246, 6246, 23, 260, 0x20a55dbf
+1, 6269, 6269, 23, 260, 0x84a147e6
+1, 6292, 6292, 23, 260, 0xe2c75bfd
+1, 6315, 6315, 23, 260, 0x52f672c4
+0, 6333, 6333, 111, 6976, 0xcc610c26
+1, 6339, 6339, 23, 260, 0x98af579a
+1, 6362, 6362, 23, 260, 0xf2034f37
+1, 6385, 6385, 23, 260, 0x75576856
+1, 6408, 6408, 23, 260, 0x4a796f1b
+1, 6431, 6431, 23, 260, 0x3a7a5612
+0, 6444, 6444, 111, 7056, 0x6cd917b0
+1, 6455, 6455, 23, 260, 0x1c0646bd
+1, 6478, 6478, 23, 260, 0xfccd6e2c
+1, 6501, 6501, 23, 260, 0x2bdd7139
+1, 6524, 6524, 23, 260, 0xadb4519a
+1, 6548, 6548, 23, 260, 0x8ef655b5
+0, 6555, 6555, 111, 6736, 0x02b78951
+1, 6571, 6571, 23, 260, 0x157852f6
+1, 6594, 6594, 23, 260, 0xec3a4aa8
+1, 6617, 6617, 23, 260, 0x5fa77041
+1, 6640, 6640, 23, 260, 0xe862690f
+1, 6664, 6664, 23, 260, 0xad1759ce
+0, 6666, 6666, 111, 6540, 0x767e0854
+1, 6687, 6687, 23, 260, 0x856f6d2e
+1, 6710, 6710, 23, 260, 0x19496938
+1, 6733, 6733, 23, 260, 0xf3135c06
+1, 6757, 6757, 23, 260, 0xbec861ab
+0, 6777, 6777, 111, 6170, 0xc84962fb
+1, 6780, 6780, 23, 260, 0x97486f09
+1, 6803, 6803, 23, 260, 0x2dcb64ed
+1, 6826, 6826, 23, 260, 0xac196fe8
+1, 6849, 6849, 23, 260, 0xa7d460f8
+1, 6873, 6873, 23, 260, 0x02e55631
+0, 6888, 6888, 111, 6169, 0x27e06c03
+1, 6896, 6896, 23, 260, 0x92556737
+1, 6919, 6919, 23, 260, 0x9ab25599
+1, 6942, 6942, 23, 260, 0x48017498
+1, 6965, 6965, 23, 260, 0x3f376d65
+1, 6989, 6989, 23, 260, 0x553750e2
+0, 7000, 7000, 111, 5864, 0xd14db83f
+1, 7012, 7012, 23, 260, 0x430a6cb9
+1, 7035, 7035, 23, 260, 0x0d4f3b7e
+1, 7058, 7058, 23, 260, 0xc5ee5733
+1, 7082, 7082, 23, 260, 0xec33744f
+1, 7105, 7105, 23, 260, 0xb7ca6c50
+0, 7111, 7111, 111, 5375, 0x4a21055d
+1, 7128, 7128, 23, 260, 0xca8e6e09
+1, 7151, 7151, 23, 260, 0xde7b67d9
+1, 7174, 7174, 23, 260, 0x1eeb47c6
+1, 7198, 7198, 23, 260, 0x97e355f6
+1, 7221, 7221, 23, 260, 0x4cb871da
+0, 7222, 7222, 111, 5206, 0x95ead3cb
+1, 7244, 7244, 23, 260, 0xf9d65f42
+1, 7267, 7267, 23, 260, 0x4df447f9
+1, 7291, 7291, 23, 260, 0x6da55c39
+1, 7314, 7314, 23, 260, 0xf8487192
+0, 7333, 7333, 111, 5220, 0xcfdcc37e
+1, 7337, 7337, 23, 260, 0xa5ef5e84
+1, 7360, 7360, 23, 260, 0xc750404d
+1, 7383, 7383, 23, 260, 0xe62d5ba7
+1, 7407, 7407, 23, 260, 0xa362739c
+1, 7430, 7430, 23, 260, 0x784c57f9
+0, 7444, 7444, 111, 4946, 0x2d864a77
+1, 7453, 7453, 23, 260, 0xac224b6f
+1, 7476, 7476, 23, 260, 0x34506907
+1, 7500, 7500, 23, 260, 0x94207121
+1, 7523, 7523, 23, 260, 0x018754e6
+1, 7546, 7546, 23, 260, 0xa5355133
+0, 7555, 7555, 111, 4390, 0x2ab9f462
+1, 7569, 7569, 23, 260, 0x93724dac
+1, 7592, 7592, 23, 260, 0x41e24c4c
+1, 7616, 7616, 23, 260, 0x1b2a7301
+1, 7639, 7639, 23, 260, 0xcce36e61
+1, 7662, 7662, 23, 260, 0xb323585a
+0, 7666, 7666, 111, 4051, 0x1d09592e
+1, 7685, 7685, 23, 260, 0x6f7c624d
+1, 7709, 7709, 23, 260, 0x87b96a4a
+1, 7732, 7732, 23, 260, 0xf567622a
+1, 7755, 7755, 23, 260, 0x52ce5d35
+0, 7777, 7777, 111, 3680, 0x39bd6a12
+1, 7778, 7778, 23, 260, 0x58a46c28
+1, 7801, 7801, 23, 260, 0x8e3e6d9a
+1, 7825, 7825, 23, 260, 0x5ef66906
+1, 7848, 7848, 23, 260, 0x351b5f9f
+1, 7871, 7871, 23, 260, 0x90b9588a
+0, 7888, 7888, 111, 2910, 0x6337ece9
+1, 7894, 7894, 23, 260, 0x34e8615f
+1, 7918, 7918, 23, 260, 0xcef75ab9
+1, 7941, 7941, 23, 260, 0x471f6bc8
+1, 7964, 7964, 23, 260, 0xd4756c62
+1, 7987, 7987, 23, 260, 0x7c554702
+0, 8000, 8000, 111, 2153, 0xf4e3bc17
+1, 8010, 8010, 23, 260, 0x185272f1
+1, 8034, 8034, 23, 260, 0x0c364348
+1, 8057, 8057, 23, 260, 0x24354467
+1, 8080, 8080, 23, 260, 0x837d5472
+1, 8103, 8103, 23, 260, 0xece2344f
diff --git a/gst-libs/ext/libav/tests/ref/fate/sp5x b/gst-libs/ext/libav/tests/ref/fate/sp5x
index ed06a77..986c111 100644
--- a/gst-libs/ext/libav/tests/ref/fate/sp5x
+++ b/gst-libs/ext/libav/tests/ref/fate/sp5x
@@ -1,19 +1,21 @@
-0, 0, 115200, 0x8ebcb7f8
-1, 0, 2048, 0x366ee71c
-0, 9234, 115200, 0x1fa8e673
-1, 11520, 2048, 0xc62f0414
-0, 18468, 115200, 0xec07fb6a
-1, 23040, 2048, 0x754e0f19
-0, 27702, 115200, 0x6773a8c3
-1, 34560, 2048, 0x4a44152a
-0, 36936, 115200, 0x0d279643
-1, 46080, 2048, 0x4fd3ff01
-0, 46170, 115200, 0xb33796e4
-0, 55404, 115200, 0xfe11fc79
-1, 57600, 2048, 0x11c3fa1b
-0, 64638, 115200, 0x4ac8e31b
-1, 69120, 2048, 0x9945fa06
-0, 73872, 115200, 0x15317942
-1, 80640, 2048, 0x12e5071a
-0, 83106, 115200, 0x07803f0e
-1, 92160, 44, 0x7ad110e8
+#tb 0: 513/5000
+#tb 1: 1/8000
+0, 0, 0, 1, 115200, 0x8ebcb7f8
+1, 0, 0, 1024, 2048, 0x366ee71c
+0, 1, 1, 1, 115200, 0x1fa8e673
+1, 1024, 1024, 1024, 2048, 0xc62f0414
+0, 2, 2, 1, 115200, 0xec07fb6a
+1, 2048, 2048, 1024, 2048, 0x754e0f19
+0, 3, 3, 1, 115200, 0x6773a8c3
+1, 3072, 3072, 1024, 2048, 0x4a44152a
+0, 4, 4, 1, 115200, 0x0d279643
+1, 4096, 4096, 1024, 2048, 0x4fd3ff01
+0, 5, 5, 1, 115200, 0xb33796e4
+0, 6, 6, 1, 115200, 0xfe11fc79
+1, 5120, 5120, 1024, 2048, 0x11c3fa1b
+0, 7, 7, 1, 115200, 0x4ac8e31b
+1, 6144, 6144, 1024, 2048, 0x9945fa06
+0, 8, 8, 1, 115200, 0x15317942
+1, 7168, 7168, 1024, 2048, 0x12e5071a
+0, 9, 9, 1, 115200, 0x07803f0e
+1, 8192, 8192, 22, 44, 0x7ad110e8
diff --git a/gst-libs/ext/libav/tests/ref/fate/sunraster-1bit-raw b/gst-libs/ext/libav/tests/ref/fate/sunraster-1bit-raw
index 40babe7..123e245 100644
--- a/gst-libs/ext/libav/tests/ref/fate/sunraster-1bit-raw
+++ b/gst-libs/ext/libav/tests/ref/fate/sunraster-1bit-raw
@@ -1 +1,2 @@
-0, 0, 32768, 0x6d16e246
+#tb 0: 1/25
+0, 0, 0, 1, 32768, 0x6d16e246
diff --git a/gst-libs/ext/libav/tests/ref/fate/sunraster-1bit-rle b/gst-libs/ext/libav/tests/ref/fate/sunraster-1bit-rle
index 40babe7..123e245 100644
--- a/gst-libs/ext/libav/tests/ref/fate/sunraster-1bit-rle
+++ b/gst-libs/ext/libav/tests/ref/fate/sunraster-1bit-rle
@@ -1 +1,2 @@
-0, 0, 32768, 0x6d16e246
+#tb 0: 1/25
+0, 0, 0, 1, 32768, 0x6d16e246
diff --git a/gst-libs/ext/libav/tests/ref/fate/sunraster-24bit-raw b/gst-libs/ext/libav/tests/ref/fate/sunraster-24bit-raw
index 0b0dafc..fa059ef 100644
--- a/gst-libs/ext/libav/tests/ref/fate/sunraster-24bit-raw
+++ b/gst-libs/ext/libav/tests/ref/fate/sunraster-24bit-raw
@@ -1 +1,2 @@
-0, 0, 786432, 0xb4d417bf
+#tb 0: 1/25
+0, 0, 0, 1, 786432, 0xb4d417bf
diff --git a/gst-libs/ext/libav/tests/ref/fate/sunraster-24bit-rle b/gst-libs/ext/libav/tests/ref/fate/sunraster-24bit-rle
index 0b0dafc..fa059ef 100644
--- a/gst-libs/ext/libav/tests/ref/fate/sunraster-24bit-rle
+++ b/gst-libs/ext/libav/tests/ref/fate/sunraster-24bit-rle
@@ -1 +1,2 @@
-0, 0, 786432, 0xb4d417bf
+#tb 0: 1/25
+0, 0, 0, 1, 786432, 0xb4d417bf
diff --git a/gst-libs/ext/libav/tests/ref/fate/sunraster-8bit-raw b/gst-libs/ext/libav/tests/ref/fate/sunraster-8bit-raw
index 3f22c8f..659b433 100644
--- a/gst-libs/ext/libav/tests/ref/fate/sunraster-8bit-raw
+++ b/gst-libs/ext/libav/tests/ref/fate/sunraster-8bit-raw
@@ -1 +1,2 @@
-0, 0, 786432, 0xf4364008
+#tb 0: 1/25
+0, 0, 0, 1, 786432, 0xf4364008
diff --git a/gst-libs/ext/libav/tests/ref/fate/sunraster-8bit-rle b/gst-libs/ext/libav/tests/ref/fate/sunraster-8bit-rle
index 3f22c8f..659b433 100644
--- a/gst-libs/ext/libav/tests/ref/fate/sunraster-8bit-rle
+++ b/gst-libs/ext/libav/tests/ref/fate/sunraster-8bit-rle
@@ -1 +1,2 @@
-0, 0, 786432, 0xf4364008
+#tb 0: 1/25
+0, 0, 0, 1, 786432, 0xf4364008
diff --git a/gst-libs/ext/libav/tests/ref/fate/sunraster-8bit_gray-raw b/gst-libs/ext/libav/tests/ref/fate/sunraster-8bit_gray-raw
new file mode 100644
index 0000000..455af5f
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/sunraster-8bit_gray-raw
@@ -0,0 +1,2 @@
+#tb 0: 1/25
+0, 0, 0, 1, 786432, 0x5859b48e
diff --git a/gst-libs/ext/libav/tests/ref/fate/svq1 b/gst-libs/ext/libav/tests/ref/fate/svq1
index b048681..3b26d1f 100644
--- a/gst-libs/ext/libav/tests/ref/fate/svq1
+++ b/gst-libs/ext/libav/tests/ref/fate/svq1
@@ -1,150 +1,151 @@
-0, 0, 21600, 0x7f9389e3
-0, 6000, 21600, 0xcebb8896
-0, 12000, 21600, 0xef51860a
-0, 18000, 21600, 0x88d97e7d
-0, 24000, 21600, 0xc7757c88
-0, 30000, 21600, 0x2f537ade
-0, 36000, 21600, 0xd50a7eff
-0, 42000, 21600, 0xdcfb7fc6
-0, 48000, 21600, 0x0d608299
-0, 54000, 21600, 0x97ca81b4
-0, 60000, 21600, 0x791f80e7
-0, 66000, 21600, 0x96ae7d33
-0, 72000, 21600, 0x4d7474a8
-0, 78000, 21600, 0x2ae76f37
-0, 84000, 21600, 0x7da76265
-0, 90000, 21600, 0x93ae3eb6
-0, 96000, 21600, 0xebfd3868
-0, 102000, 21600, 0x54f82ffa
-0, 108000, 21600, 0x8d5b2ad0
-0, 114000, 21600, 0xe67128e6
-0, 120000, 21600, 0xb7bf613e
-0, 126000, 21600, 0xefd0f51b
-0, 132000, 21600, 0x31b7da59
-0, 138000, 21600, 0x7a84a8f7
-0, 144000, 21600, 0x0351ad27
-0, 150000, 21600, 0xed6f434d
-0, 156000, 21600, 0x0e771127
-0, 162000, 21600, 0x37bf0b95
-0, 168000, 21600, 0x30e10a77
-0, 174000, 21600, 0x1a48288a
-0, 180000, 21600, 0xf43c6770
-0, 186000, 21600, 0x3c43ae68
-0, 192000, 21600, 0x04dc0949
-0, 198000, 21600, 0x7920758d
-0, 204000, 21600, 0x6c12bab5
-0, 210000, 21600, 0x1ac23706
-0, 216000, 21600, 0x7a95cb5f
-0, 222000, 21600, 0xf1bfbb46
-0, 228000, 21600, 0x773d1d0c
-0, 234000, 21600, 0x2e7bea65
-0, 240000, 21600, 0xdb1a086f
-0, 246000, 21600, 0x5b36b78d
-0, 252000, 21600, 0x7b533ca6
-0, 258000, 21600, 0x65d75105
-0, 264000, 21600, 0xfe6f6207
-0, 270000, 21600, 0x44c4ce57
-0, 276000, 21600, 0x220f3dae
-0, 282000, 21600, 0xb4d20ffb
-0, 288000, 21600, 0x8907ad72
-0, 294000, 21600, 0xc6418998
-0, 300000, 21600, 0x395b6670
-0, 306000, 21600, 0x83495b88
-0, 312000, 21600, 0x8920d683
-0, 318000, 21600, 0xd7fc64ea
-0, 324000, 21600, 0x21a3b222
-0, 330000, 21600, 0xc11f2dbd
-0, 336000, 21600, 0xd1d5495d
-0, 342000, 21600, 0x70f2de20
-0, 348000, 21600, 0x10adc9a9
-0, 354000, 21600, 0xf713c0ec
-0, 360000, 21600, 0xa346b3fe
-0, 366000, 21600, 0x7945c29b
-0, 372000, 21600, 0xb07ceb91
-0, 378000, 21600, 0xe1eaf9ef
-0, 384000, 21600, 0x6fa915c7
-0, 390000, 21600, 0x61952055
-0, 396000, 21600, 0x4bca2382
-0, 402000, 21600, 0x36161fe2
-0, 408000, 21600, 0xf93a28f7
-0, 414000, 21600, 0xa02a3d47
-0, 420000, 21600, 0x925b3609
-0, 426000, 21600, 0x5b6941db
-0, 432000, 21600, 0x33154a91
-0, 438000, 21600, 0xb1d75c50
-0, 444000, 21600, 0x1cb369bd
-0, 450000, 21600, 0x3be4eff2
-0, 456000, 21600, 0xbb89c301
-0, 462000, 21600, 0xc7630d85
-0, 468000, 21600, 0xf7441c67
-0, 474000, 21600, 0xc23611ef
-0, 480000, 21600, 0x840efb21
-0, 486000, 21600, 0x7d470a0f
-0, 492000, 21600, 0xfe093210
-0, 498000, 21600, 0x0f3ea098
-0, 504000, 21600, 0xcd72286f
-0, 510000, 21600, 0x826f8030
-0, 516000, 21600, 0xcda3ace8
-0, 522000, 21600, 0x39cb4cd0
-0, 528000, 21600, 0xa86a60ac
-0, 534000, 21600, 0xcd32ed8e
-0, 540000, 21600, 0x769b285d
-0, 546000, 21600, 0x10234cd0
-0, 552000, 21600, 0x951036b8
-0, 558000, 21600, 0xaef248fa
-0, 564000, 21600, 0x74e36e84
-0, 570000, 21600, 0x3908531b
-0, 576000, 21600, 0x342f2a9d
-0, 582000, 21600, 0x291d58f3
-0, 588000, 21600, 0xcf24b1e5
-0, 594000, 21600, 0x3e7c7959
-0, 600000, 21600, 0x6517e573
-0, 606000, 21600, 0x304cc6db
-0, 612000, 21600, 0x272895e4
-0, 618000, 21600, 0x52325837
-0, 624000, 21600, 0xd01344bd
-0, 630000, 21600, 0xd25a370b
-0, 636000, 21600, 0x274e0ae9
-0, 642000, 21600, 0x6f66138f
-0, 648000, 21600, 0xd35a0f60
-0, 654000, 21600, 0xe0610863
-0, 660000, 21600, 0x920b05fb
-0, 666000, 21600, 0x5befe39d
-0, 672000, 21600, 0xd167bd58
-0, 678000, 21600, 0x653ac504
-0, 684000, 21600, 0x8372c6d7
-0, 690000, 21600, 0x0302c276
-0, 696000, 21600, 0xa176b694
-0, 702000, 21600, 0x4c2e935a
-0, 708000, 21600, 0xf7ea844e
-0, 714000, 21600, 0x76d6c07b
-0, 720000, 21600, 0x0a14d610
-0, 726000, 21600, 0x0ec9f3f3
-0, 732000, 21600, 0xdc90f6ea
-0, 738000, 21600, 0xc841f9ef
-0, 744000, 21600, 0x7ab5f9b9
-0, 750000, 21600, 0xda40f3c2
-0, 756000, 21600, 0x0040fb72
-0, 762000, 21600, 0x705b0786
-0, 768000, 21600, 0x26d5198d
-0, 774000, 21600, 0x6f5153ad
-0, 780000, 21600, 0x9f26624b
-0, 786000, 21600, 0x0d3ea7af
-0, 792000, 21600, 0xb957ca79
-0, 798000, 21600, 0x03a60612
-0, 804000, 21600, 0x3ddc4ff1
-0, 810000, 21600, 0x8fe5697f
-0, 816000, 21600, 0x3d199b09
-0, 822000, 21600, 0x97e2b504
-0, 828000, 21600, 0x7563f784
-0, 834000, 21600, 0x9a473879
-0, 840000, 21600, 0x2e2054e5
-0, 846000, 21600, 0x06b3658b
-0, 852000, 21600, 0xa37ee249
-0, 858000, 21600, 0xa527efa1
-0, 864000, 21600, 0x12791532
-0, 870000, 21600, 0xc5350145
-0, 876000, 21600, 0xcd44f1ac
-0, 882000, 21600, 0xe610edfb
-0, 888000, 21600, 0x5642f672
-0, 894000, 21600, 0xf2bc3e5b
+#tb 0: 1/600
+0, 0, 0, 1, 21600, 0x7f9389e3
+0, 40, 40, 1, 21600, 0xcebb8896
+0, 80, 80, 1, 21600, 0xef51860a
+0, 120, 120, 1, 21600, 0x88d97e7d
+0, 160, 160, 1, 21600, 0xc7757c88
+0, 200, 200, 1, 21600, 0x2f537ade
+0, 240, 240, 1, 21600, 0xd50a7eff
+0, 280, 280, 1, 21600, 0xdcfb7fc6
+0, 320, 320, 1, 21600, 0x0d608299
+0, 360, 360, 1, 21600, 0x97ca81b4
+0, 400, 400, 1, 21600, 0x791f80e7
+0, 440, 440, 1, 21600, 0x96ae7d33
+0, 480, 480, 1, 21600, 0x4d7474a8
+0, 520, 520, 1, 21600, 0x2ae76f37
+0, 560, 560, 1, 21600, 0x7da76265
+0, 600, 600, 1, 21600, 0x93ae3eb6
+0, 640, 640, 1, 21600, 0xebfd3868
+0, 680, 680, 1, 21600, 0x54f82ffa
+0, 720, 720, 1, 21600, 0x8d5b2ad0
+0, 760, 760, 1, 21600, 0xe67128e6
+0, 800, 800, 1, 21600, 0xb7bf613e
+0, 840, 840, 1, 21600, 0xefd0f51b
+0, 880, 880, 1, 21600, 0x31b7da59
+0, 920, 920, 1, 21600, 0x7a84a8f7
+0, 960, 960, 1, 21600, 0x0351ad27
+0, 1000, 1000, 1, 21600, 0xed6f434d
+0, 1040, 1040, 1, 21600, 0x0e771127
+0, 1080, 1080, 1, 21600, 0x37bf0b95
+0, 1120, 1120, 1, 21600, 0x30e10a77
+0, 1160, 1160, 1, 21600, 0x1a48288a
+0, 1200, 1200, 1, 21600, 0xf43c6770
+0, 1240, 1240, 1, 21600, 0x3c43ae68
+0, 1280, 1280, 1, 21600, 0x04dc0949
+0, 1320, 1320, 1, 21600, 0x7920758d
+0, 1360, 1360, 1, 21600, 0x6c12bab5
+0, 1400, 1400, 1, 21600, 0x1ac23706
+0, 1440, 1440, 1, 21600, 0x7a95cb5f
+0, 1480, 1480, 1, 21600, 0xf1bfbb46
+0, 1520, 1520, 1, 21600, 0x773d1d0c
+0, 1560, 1560, 1, 21600, 0x2e7bea65
+0, 1600, 1600, 1, 21600, 0xdb1a086f
+0, 1640, 1640, 1, 21600, 0x5b36b78d
+0, 1680, 1680, 1, 21600, 0x7b533ca6
+0, 1720, 1720, 1, 21600, 0x65d75105
+0, 1760, 1760, 1, 21600, 0xfe6f6207
+0, 1800, 1800, 1, 21600, 0x44c4ce57
+0, 1840, 1840, 1, 21600, 0x220f3dae
+0, 1880, 1880, 1, 21600, 0xb4d20ffb
+0, 1920, 1920, 1, 21600, 0x8907ad72
+0, 1960, 1960, 1, 21600, 0xc6418998
+0, 2000, 2000, 1, 21600, 0x395b6670
+0, 2040, 2040, 1, 21600, 0x83495b88
+0, 2080, 2080, 1, 21600, 0x8920d683
+0, 2120, 2120, 1, 21600, 0xd7fc64ea
+0, 2160, 2160, 1, 21600, 0x21a3b222
+0, 2200, 2200, 1, 21600, 0xc11f2dbd
+0, 2240, 2240, 1, 21600, 0xd1d5495d
+0, 2280, 2280, 1, 21600, 0x70f2de20
+0, 2320, 2320, 1, 21600, 0x10adc9a9
+0, 2360, 2360, 1, 21600, 0xf713c0ec
+0, 2400, 2400, 1, 21600, 0xa346b3fe
+0, 2440, 2440, 1, 21600, 0x7945c29b
+0, 2480, 2480, 1, 21600, 0xb07ceb91
+0, 2520, 2520, 1, 21600, 0xe1eaf9ef
+0, 2560, 2560, 1, 21600, 0x6fa915c7
+0, 2600, 2600, 1, 21600, 0x61952055
+0, 2640, 2640, 1, 21600, 0x4bca2382
+0, 2680, 2680, 1, 21600, 0x36161fe2
+0, 2720, 2720, 1, 21600, 0xf93a28f7
+0, 2760, 2760, 1, 21600, 0xa02a3d47
+0, 2800, 2800, 1, 21600, 0x925b3609
+0, 2840, 2840, 1, 21600, 0x5b6941db
+0, 2880, 2880, 1, 21600, 0x33154a91
+0, 2920, 2920, 1, 21600, 0xb1d75c50
+0, 2960, 2960, 1, 21600, 0x1cb369bd
+0, 3000, 3000, 1, 21600, 0x3be4eff2
+0, 3040, 3040, 1, 21600, 0xbb89c301
+0, 3080, 3080, 1, 21600, 0xc7630d85
+0, 3120, 3120, 1, 21600, 0xf7441c67
+0, 3160, 3160, 1, 21600, 0xc23611ef
+0, 3200, 3200, 1, 21600, 0x840efb21
+0, 3240, 3240, 1, 21600, 0x7d470a0f
+0, 3280, 3280, 1, 21600, 0xfe093210
+0, 3320, 3320, 1, 21600, 0x0f3ea098
+0, 3360, 3360, 1, 21600, 0xcd72286f
+0, 3400, 3400, 1, 21600, 0x826f8030
+0, 3440, 3440, 1, 21600, 0xcda3ace8
+0, 3480, 3480, 1, 21600, 0x39cb4cd0
+0, 3520, 3520, 1, 21600, 0xa86a60ac
+0, 3560, 3560, 1, 21600, 0xcd32ed8e
+0, 3600, 3600, 1, 21600, 0x769b285d
+0, 3640, 3640, 1, 21600, 0x10234cd0
+0, 3680, 3680, 1, 21600, 0x951036b8
+0, 3720, 3720, 1, 21600, 0xaef248fa
+0, 3760, 3760, 1, 21600, 0x74e36e84
+0, 3800, 3800, 1, 21600, 0x3908531b
+0, 3840, 3840, 1, 21600, 0x342f2a9d
+0, 3880, 3880, 1, 21600, 0x291d58f3
+0, 3920, 3920, 1, 21600, 0xcf24b1e5
+0, 3960, 3960, 1, 21600, 0x3e7c7959
+0, 4000, 4000, 1, 21600, 0x6517e573
+0, 4040, 4040, 1, 21600, 0x304cc6db
+0, 4080, 4080, 1, 21600, 0x272895e4
+0, 4120, 4120, 1, 21600, 0x52325837
+0, 4160, 4160, 1, 21600, 0xd01344bd
+0, 4200, 4200, 1, 21600, 0xd25a370b
+0, 4240, 4240, 1, 21600, 0x274e0ae9
+0, 4280, 4280, 1, 21600, 0x6f66138f
+0, 4320, 4320, 1, 21600, 0xd35a0f60
+0, 4360, 4360, 1, 21600, 0xe0610863
+0, 4400, 4400, 1, 21600, 0x920b05fb
+0, 4440, 4440, 1, 21600, 0x5befe39d
+0, 4480, 4480, 1, 21600, 0xd167bd58
+0, 4520, 4520, 1, 21600, 0x653ac504
+0, 4560, 4560, 1, 21600, 0x8372c6d7
+0, 4600, 4600, 1, 21600, 0x0302c276
+0, 4640, 4640, 1, 21600, 0xa176b694
+0, 4680, 4680, 1, 21600, 0x4c2e935a
+0, 4720, 4720, 1, 21600, 0xf7ea844e
+0, 4760, 4760, 1, 21600, 0x76d6c07b
+0, 4800, 4800, 1, 21600, 0x0a14d610
+0, 4840, 4840, 1, 21600, 0x0ec9f3f3
+0, 4880, 4880, 1, 21600, 0xdc90f6ea
+0, 4920, 4920, 1, 21600, 0xc841f9ef
+0, 4960, 4960, 1, 21600, 0x7ab5f9b9
+0, 5000, 5000, 1, 21600, 0xda40f3c2
+0, 5040, 5040, 1, 21600, 0x0040fb72
+0, 5080, 5080, 1, 21600, 0x705b0786
+0, 5120, 5120, 1, 21600, 0x26d5198d
+0, 5160, 5160, 1, 21600, 0x6f5153ad
+0, 5200, 5200, 1, 21600, 0x9f26624b
+0, 5240, 5240, 1, 21600, 0x0d3ea7af
+0, 5280, 5280, 1, 21600, 0xb957ca79
+0, 5320, 5320, 1, 21600, 0x03a60612
+0, 5360, 5360, 1, 21600, 0x3ddc4ff1
+0, 5400, 5400, 1, 21600, 0x8fe5697f
+0, 5440, 5440, 1, 21600, 0x3d199b09
+0, 5480, 5480, 1, 21600, 0x97e2b504
+0, 5520, 5520, 1, 21600, 0x7563f784
+0, 5560, 5560, 1, 21600, 0x9a473879
+0, 5600, 5600, 1, 21600, 0x2e2054e5
+0, 5640, 5640, 1, 21600, 0x06b3658b
+0, 5680, 5680, 1, 21600, 0xa37ee249
+0, 5720, 5720, 1, 21600, 0xa527efa1
+0, 5760, 5760, 1, 21600, 0x12791532
+0, 5800, 5800, 1, 21600, 0xc5350145
+0, 5840, 5840, 1, 21600, 0xcd44f1ac
+0, 5880, 5880, 1, 21600, 0xe610edfb
+0, 5920, 5920, 1, 21600, 0x5642f672
+0, 5960, 5960, 1, 21600, 0xf2bc3e5b
diff --git a/gst-libs/ext/libav/tests/ref/fate/svq3 b/gst-libs/ext/libav/tests/ref/fate/svq3
index 324c363..141300a 100644
--- a/gst-libs/ext/libav/tests/ref/fate/svq3
+++ b/gst-libs/ext/libav/tests/ref/fate/svq3
@@ -1,180 +1,181 @@
-0, 0, 115200, 0x2c810465
-0, 3000, 115200, 0x010b5765
-0, 6000, 115200, 0x2be11a4e
-0, 9000, 115200, 0x99445d06
-0, 12000, 115200, 0x6b54d83c
-0, 15000, 115200, 0x3832b76a
-0, 18000, 115200, 0x3832b76a
-0, 21000, 115200, 0xe18385db
-0, 24000, 115200, 0x847d4bf0
-0, 27000, 115200, 0x0d650f50
-0, 30000, 115200, 0x4b85c44c
-0, 33000, 115200, 0xce1927a6
-0, 36000, 115200, 0x89353747
-0, 39000, 115200, 0x58da43f2
-0, 42000, 115200, 0xee9a4eef
-0, 45000, 115200, 0xce9453d9
-0, 48000, 115200, 0x804a5eb0
-0, 51000, 115200, 0xb3d46605
-0, 54000, 115200, 0x45b5668e
-0, 57000, 115200, 0xdd0d4c5a
-0, 60000, 115200, 0x99101301
-0, 63000, 115200, 0xf0c3f272
-0, 66000, 115200, 0xea21f8b1
-0, 69000, 115200, 0xd8e7fbb1
-0, 72000, 115200, 0x89d90aa1
-0, 75000, 115200, 0x882e19da
-0, 78000, 115200, 0xfc0f2709
-0, 81000, 115200, 0x9b732f3f
-0, 84000, 115200, 0xec453cda
-0, 87000, 115200, 0xa77e4989
-0, 90000, 115200, 0xad935834
-0, 93000, 115200, 0x3a5a6177
-0, 96000, 115200, 0xd3c07999
-0, 99000, 115200, 0xfad388dd
-0, 102000, 115200, 0xaf6e9520
-0, 105000, 115200, 0xdb64a4b3
-0, 108000, 115200, 0xc6f9b49e
-0, 111000, 115200, 0x4446c315
-0, 114000, 115200, 0x660bd01c
-0, 117000, 115200, 0x963fdd7d
-0, 120000, 115200, 0x8733e7b3
-0, 123000, 115200, 0x41aaf1d5
-0, 126000, 115200, 0xa803fd81
-0, 129000, 115200, 0xe2b4077f
-0, 132000, 115200, 0xfe6707cb
-0, 135000, 115200, 0x027c122d
-0, 138000, 115200, 0xbcb81ea8
-0, 141000, 115200, 0xd2ac2405
-0, 144000, 115200, 0x3d893006
-0, 147000, 115200, 0xbdcc3ba8
-0, 150000, 115200, 0x83ed4c6b
-0, 153000, 115200, 0x69ee5e7c
-0, 156000, 115200, 0xfe317411
-0, 159000, 115200, 0x849e84e6
-0, 162000, 115200, 0x040f945f
-0, 165000, 115200, 0x6481ac89
-0, 168000, 115200, 0x8a48be9e
-0, 171000, 115200, 0xb162ce94
-0, 174000, 115200, 0x178dd69a
-0, 177000, 115200, 0x64fdecaa
-0, 180000, 115200, 0x4b51297e
-0, 183000, 115200, 0x3d39a1ae
-0, 186000, 115200, 0x900fd939
-0, 189000, 115200, 0x7704fb19
-0, 192000, 115200, 0xa426137e
-0, 195000, 115200, 0x9a112706
-0, 198000, 115200, 0x294931f7
-0, 201000, 115200, 0x0d0e4372
-0, 204000, 115200, 0x33bd50e4
-0, 207000, 115200, 0x9c86e3e2
-0, 210000, 115200, 0x714af5d5
-0, 213000, 115200, 0xc5f9fcd0
-0, 216000, 115200, 0x184602bb
-0, 219000, 115200, 0x6958e9e6
-0, 222000, 115200, 0x5a214952
-0, 225000, 115200, 0x706cca0e
-0, 228000, 115200, 0x67689363
-0, 231000, 115200, 0x459f410c
-0, 234000, 115200, 0xa8f4c365
-0, 237000, 115200, 0xf1fc50c5
-0, 240000, 115200, 0xc22af545
-0, 243000, 115200, 0xd39802a2
-0, 246000, 115200, 0xb76c04b6
-0, 249000, 115200, 0x7a548db4
-0, 252000, 115200, 0x79e56765
-0, 255000, 115200, 0x3f273a17
-0, 258000, 115200, 0xe04366db
-0, 261000, 115200, 0x8e10939b
-0, 264000, 115200, 0x49220ea2
-0, 267000, 115200, 0x35361889
-0, 270000, 115200, 0x9b20bdfa
-0, 273000, 115200, 0x5d472eaf
-0, 276000, 115200, 0xeda43081
-0, 279000, 115200, 0x59bae8b4
-0, 282000, 115200, 0xf126d6a4
-0, 285000, 115200, 0x18106464
-0, 288000, 115200, 0x85530c73
-0, 291000, 115200, 0xcef32c78
-0, 294000, 115200, 0xfd6233a0
-0, 297000, 115200, 0xae9d6fc3
-0, 300000, 115200, 0x3d0cce10
-0, 303000, 115200, 0xfce5f124
-0, 306000, 115200, 0x90b10802
-0, 309000, 115200, 0xeea44201
-0, 312000, 115200, 0x1cefb56d
-0, 315000, 115200, 0xd6daa0b1
-0, 318000, 115200, 0xd700cef4
-0, 321000, 115200, 0x36dbf58f
-0, 324000, 115200, 0xdb20d060
-0, 327000, 115200, 0x5ca61fd5
-0, 330000, 115200, 0x4f271361
-0, 333000, 115200, 0xcaf03743
-0, 336000, 115200, 0x520f351a
-0, 339000, 115200, 0x40bc7b89
-0, 342000, 115200, 0xd0af0b08
-0, 345000, 115200, 0x6a45290c
-0, 348000, 115200, 0x57210c14
-0, 351000, 115200, 0xc1e233f9
-0, 354000, 115200, 0x96fdfc54
-0, 357000, 115200, 0x43a8359c
-0, 360000, 115200, 0xd493bfde
-0, 363000, 115200, 0xd5339d13
-0, 366000, 115200, 0x7542baa0
-0, 369000, 115200, 0x268d2cb9
-0, 372000, 115200, 0xaf3888bb
-0, 375000, 115200, 0xb82f520a
-0, 378000, 115200, 0x0feb2981
-0, 381000, 115200, 0x45314b58
-0, 384000, 115200, 0xb26a193a
-0, 387000, 115200, 0xdfdffc38
-0, 390000, 115200, 0xec6a55f5
-0, 393000, 115200, 0xf6e35716
-0, 396000, 115200, 0x5ce8544e
-0, 399000, 115200, 0x3e38ddce
-0, 402000, 115200, 0x964a2006
-0, 405000, 115200, 0xaba138d6
-0, 408000, 115200, 0x2f46949c
-0, 411000, 115200, 0xbdbdb587
-0, 414000, 115200, 0x1bf11e1d
-0, 417000, 115200, 0x2632f558
-0, 420000, 115200, 0x0e58078b
-0, 423000, 115200, 0x2ab2f9be
-0, 426000, 115200, 0x9205f1d8
-0, 429000, 115200, 0x6a4bd949
-0, 432000, 115200, 0xedc1552f
-0, 435000, 115200, 0x0a60974d
-0, 438000, 115200, 0xe1a1400e
-0, 441000, 115200, 0x45f06952
-0, 444000, 115200, 0xc5163125
-0, 447000, 115200, 0x151da156
-0, 450000, 115200, 0x3f34b048
-0, 453000, 115200, 0xcf7c1e5d
-0, 456000, 115200, 0xed9c4e1c
-0, 459000, 115200, 0x47e06453
-0, 462000, 115200, 0xc8ce6f19
-0, 465000, 115200, 0xac619619
-0, 468000, 115200, 0x64711e2d
-0, 471000, 115200, 0x1f502b52
-0, 474000, 115200, 0x39592c9d
-0, 477000, 115200, 0x7dffb901
-0, 480000, 115200, 0xc75fa3ce
-0, 483000, 115200, 0x625bc977
-0, 486000, 115200, 0x15c7fda3
-0, 489000, 115200, 0x6e5d35b5
-0, 492000, 115200, 0xf847cf88
-0, 495000, 115200, 0xc10867fe
-0, 498000, 115200, 0xae07fbfc
-0, 501000, 115200, 0xc1571542
-0, 504000, 115200, 0x4c7d5602
-0, 507000, 115200, 0xbe7045aa
-0, 510000, 115200, 0xc8b4835b
-0, 513000, 115200, 0xf9b7d427
-0, 516000, 115200, 0x7fa7c112
-0, 519000, 115200, 0xe0105feb
-0, 522000, 115200, 0x70784740
-0, 525000, 115200, 0xa6801ef5
-0, 528000, 115200, 0x9cf35921
-0, 531000, 115200, 0x4d956630
-0, 534000, 115200, 0x717a25c1
-0, 537000, 115200, 0x8f5e39de
+#tb 0: 1/600
+0, 0, 0, 1, 115200, 0x2c810465
+0, 20, 20, 1, 115200, 0x010b5765
+0, 40, 40, 1, 115200, 0x2be11a4e
+0, 60, 60, 1, 115200, 0x99445d06
+0, 80, 80, 1, 115200, 0x6b54d83c
+0, 100, 100, 1, 115200, 0x3832b76a
+0, 120, 120, 1, 115200, 0x3832b76a
+0, 140, 140, 1, 115200, 0xe18385db
+0, 160, 160, 1, 115200, 0x847d4bf0
+0, 180, 180, 1, 115200, 0x0d650f50
+0, 200, 200, 1, 115200, 0x4b85c44c
+0, 220, 220, 1, 115200, 0xce1927a6
+0, 240, 240, 1, 115200, 0x89353747
+0, 260, 260, 1, 115200, 0x58da43f2
+0, 280, 280, 1, 115200, 0xee9a4eef
+0, 300, 300, 1, 115200, 0xce9453d9
+0, 320, 320, 1, 115200, 0x804a5eb0
+0, 340, 340, 1, 115200, 0xb3d46605
+0, 360, 360, 1, 115200, 0x45b5668e
+0, 380, 380, 1, 115200, 0xdd0d4c5a
+0, 400, 400, 1, 115200, 0x99101301
+0, 420, 420, 1, 115200, 0xf0c3f272
+0, 440, 440, 1, 115200, 0xea21f8b1
+0, 460, 460, 1, 115200, 0xd8e7fbb1
+0, 480, 480, 1, 115200, 0x89d90aa1
+0, 500, 500, 1, 115200, 0x882e19da
+0, 520, 520, 1, 115200, 0xfc0f2709
+0, 540, 540, 1, 115200, 0x9b732f3f
+0, 560, 560, 1, 115200, 0xec453cda
+0, 580, 580, 1, 115200, 0xa77e4989
+0, 600, 600, 1, 115200, 0xad935834
+0, 620, 620, 1, 115200, 0x3a5a6177
+0, 640, 640, 1, 115200, 0xd3c07999
+0, 660, 660, 1, 115200, 0xfad388dd
+0, 680, 680, 1, 115200, 0xaf6e9520
+0, 700, 700, 1, 115200, 0xdb64a4b3
+0, 720, 720, 1, 115200, 0xc6f9b49e
+0, 740, 740, 1, 115200, 0x4446c315
+0, 760, 760, 1, 115200, 0x660bd01c
+0, 780, 780, 1, 115200, 0x963fdd7d
+0, 800, 800, 1, 115200, 0x8733e7b3
+0, 820, 820, 1, 115200, 0x41aaf1d5
+0, 840, 840, 1, 115200, 0xa803fd81
+0, 860, 860, 1, 115200, 0xe2b4077f
+0, 880, 880, 1, 115200, 0xfe6707cb
+0, 900, 900, 1, 115200, 0x027c122d
+0, 920, 920, 1, 115200, 0xbcb81ea8
+0, 940, 940, 1, 115200, 0xd2ac2405
+0, 960, 960, 1, 115200, 0x3d893006
+0, 980, 980, 1, 115200, 0xbdcc3ba8
+0, 1000, 1000, 1, 115200, 0x83ed4c6b
+0, 1020, 1020, 1, 115200, 0x69ee5e7c
+0, 1040, 1040, 1, 115200, 0xfe317411
+0, 1060, 1060, 1, 115200, 0x849e84e6
+0, 1080, 1080, 1, 115200, 0x040f945f
+0, 1100, 1100, 1, 115200, 0x6481ac89
+0, 1120, 1120, 1, 115200, 0x8a48be9e
+0, 1140, 1140, 1, 115200, 0xb162ce94
+0, 1160, 1160, 1, 115200, 0x178dd69a
+0, 1180, 1180, 1, 115200, 0x64fdecaa
+0, 1200, 1200, 1, 115200, 0x4b51297e
+0, 1220, 1220, 1, 115200, 0x3d39a1ae
+0, 1240, 1240, 1, 115200, 0x900fd939
+0, 1260, 1260, 1, 115200, 0x7704fb19
+0, 1280, 1280, 1, 115200, 0xa426137e
+0, 1300, 1300, 1, 115200, 0x9a112706
+0, 1320, 1320, 1, 115200, 0x294931f7
+0, 1340, 1340, 1, 115200, 0x0d0e4372
+0, 1360, 1360, 1, 115200, 0x33bd50e4
+0, 1380, 1380, 1, 115200, 0x9c86e3e2
+0, 1400, 1400, 1, 115200, 0x714af5d5
+0, 1420, 1420, 1, 115200, 0xc5f9fcd0
+0, 1440, 1440, 1, 115200, 0x184602bb
+0, 1460, 1460, 1, 115200, 0x6958e9e6
+0, 1480, 1480, 1, 115200, 0x5a214952
+0, 1500, 1500, 1, 115200, 0x706cca0e
+0, 1520, 1520, 1, 115200, 0x67689363
+0, 1540, 1540, 1, 115200, 0x459f410c
+0, 1560, 1560, 1, 115200, 0xa8f4c365
+0, 1580, 1580, 1, 115200, 0xf1fc50c5
+0, 1600, 1600, 1, 115200, 0xc22af545
+0, 1620, 1620, 1, 115200, 0xd39802a2
+0, 1640, 1640, 1, 115200, 0xb76c04b6
+0, 1660, 1660, 1, 115200, 0x7a548db4
+0, 1680, 1680, 1, 115200, 0x79e56765
+0, 1700, 1700, 1, 115200, 0x3f273a17
+0, 1720, 1720, 1, 115200, 0xe04366db
+0, 1740, 1740, 1, 115200, 0x8e10939b
+0, 1760, 1760, 1, 115200, 0x49220ea2
+0, 1780, 1780, 1, 115200, 0x35361889
+0, 1800, 1800, 1, 115200, 0x9b20bdfa
+0, 1820, 1820, 1, 115200, 0x5d472eaf
+0, 1840, 1840, 1, 115200, 0xeda43081
+0, 1860, 1860, 1, 115200, 0x59bae8b4
+0, 1880, 1880, 1, 115200, 0xf126d6a4
+0, 1900, 1900, 1, 115200, 0x18106464
+0, 1920, 1920, 1, 115200, 0x85530c73
+0, 1940, 1940, 1, 115200, 0xcef32c78
+0, 1960, 1960, 1, 115200, 0xfd6233a0
+0, 1980, 1980, 1, 115200, 0xae9d6fc3
+0, 2000, 2000, 1, 115200, 0x3d0cce10
+0, 2020, 2020, 1, 115200, 0xfce5f124
+0, 2040, 2040, 1, 115200, 0x90b10802
+0, 2060, 2060, 1, 115200, 0xeea44201
+0, 2080, 2080, 1, 115200, 0x1cefb56d
+0, 2100, 2100, 1, 115200, 0xd6daa0b1
+0, 2120, 2120, 1, 115200, 0xd700cef4
+0, 2140, 2140, 1, 115200, 0x36dbf58f
+0, 2160, 2160, 1, 115200, 0xdb20d060
+0, 2180, 2180, 1, 115200, 0x5ca61fd5
+0, 2200, 2200, 1, 115200, 0x4f271361
+0, 2220, 2220, 1, 115200, 0xcaf03743
+0, 2240, 2240, 1, 115200, 0x520f351a
+0, 2260, 2260, 1, 115200, 0x40bc7b89
+0, 2280, 2280, 1, 115200, 0xd0af0b08
+0, 2300, 2300, 1, 115200, 0x6a45290c
+0, 2320, 2320, 1, 115200, 0x57210c14
+0, 2340, 2340, 1, 115200, 0xc1e233f9
+0, 2360, 2360, 1, 115200, 0x96fdfc54
+0, 2380, 2380, 1, 115200, 0x43a8359c
+0, 2400, 2400, 1, 115200, 0xd493bfde
+0, 2420, 2420, 1, 115200, 0xd5339d13
+0, 2440, 2440, 1, 115200, 0x7542baa0
+0, 2460, 2460, 1, 115200, 0x268d2cb9
+0, 2480, 2480, 1, 115200, 0xaf3888bb
+0, 2500, 2500, 1, 115200, 0xb82f520a
+0, 2520, 2520, 1, 115200, 0x0feb2981
+0, 2540, 2540, 1, 115200, 0x45314b58
+0, 2560, 2560, 1, 115200, 0xb26a193a
+0, 2580, 2580, 1, 115200, 0xdfdffc38
+0, 2600, 2600, 1, 115200, 0xec6a55f5
+0, 2620, 2620, 1, 115200, 0xf6e35716
+0, 2640, 2640, 1, 115200, 0x5ce8544e
+0, 2660, 2660, 1, 115200, 0x3e38ddce
+0, 2680, 2680, 1, 115200, 0x964a2006
+0, 2700, 2700, 1, 115200, 0xaba138d6
+0, 2720, 2720, 1, 115200, 0x2f46949c
+0, 2740, 2740, 1, 115200, 0xbdbdb587
+0, 2760, 2760, 1, 115200, 0x1bf11e1d
+0, 2780, 2780, 1, 115200, 0x2632f558
+0, 2800, 2800, 1, 115200, 0x0e58078b
+0, 2820, 2820, 1, 115200, 0x2ab2f9be
+0, 2840, 2840, 1, 115200, 0x9205f1d8
+0, 2860, 2860, 1, 115200, 0x6a4bd949
+0, 2880, 2880, 1, 115200, 0xedc1552f
+0, 2900, 2900, 1, 115200, 0x0a60974d
+0, 2920, 2920, 1, 115200, 0xe1a1400e
+0, 2940, 2940, 1, 115200, 0x45f06952
+0, 2960, 2960, 1, 115200, 0xc5163125
+0, 2980, 2980, 1, 115200, 0x151da156
+0, 3000, 3000, 1, 115200, 0x3f34b048
+0, 3020, 3020, 1, 115200, 0xcf7c1e5d
+0, 3040, 3040, 1, 115200, 0xed9c4e1c
+0, 3060, 3060, 1, 115200, 0x47e06453
+0, 3080, 3080, 1, 115200, 0xc8ce6f19
+0, 3100, 3100, 1, 115200, 0xac619619
+0, 3120, 3120, 1, 115200, 0x64711e2d
+0, 3140, 3140, 1, 115200, 0x1f502b52
+0, 3160, 3160, 1, 115200, 0x39592c9d
+0, 3180, 3180, 1, 115200, 0x7dffb901
+0, 3200, 3200, 1, 115200, 0xc75fa3ce
+0, 3220, 3220, 1, 115200, 0x625bc977
+0, 3240, 3240, 1, 115200, 0x15c7fda3
+0, 3260, 3260, 1, 115200, 0x6e5d35b5
+0, 3280, 3280, 1, 115200, 0xf847cf88
+0, 3300, 3300, 1, 115200, 0xc10867fe
+0, 3320, 3320, 1, 115200, 0xae07fbfc
+0, 3340, 3340, 1, 115200, 0xc1571542
+0, 3360, 3360, 1, 115200, 0x4c7d5602
+0, 3380, 3380, 1, 115200, 0xbe7045aa
+0, 3400, 3400, 1, 115200, 0xc8b4835b
+0, 3420, 3420, 1, 115200, 0xf9b7d427
+0, 3440, 3440, 1, 115200, 0x7fa7c112
+0, 3460, 3460, 1, 115200, 0xe0105feb
+0, 3480, 3480, 1, 115200, 0x70784740
+0, 3500, 3500, 1, 115200, 0xa6801ef5
+0, 3520, 3520, 1, 115200, 0x9cf35921
+0, 3540, 3540, 1, 115200, 0x4d956630
+0, 3560, 3560, 1, 115200, 0x717a25c1
+0, 3580, 3580, 1, 115200, 0x8f5e39de
diff --git a/gst-libs/ext/libav/tests/ref/fate/targa-conformance-CBW8 b/gst-libs/ext/libav/tests/ref/fate/targa-conformance-CBW8
index 4ff3a9d..60270d7 100644
--- a/gst-libs/ext/libav/tests/ref/fate/targa-conformance-CBW8
+++ b/gst-libs/ext/libav/tests/ref/fate/targa-conformance-CBW8
@@ -1 +1,2 @@
-0, 0, 16384, 0x267e21ef
+#tb 0: 1/25
+0, 0, 0, 1, 16384, 0x267e21ef
diff --git a/gst-libs/ext/libav/tests/ref/fate/targa-conformance-CCM8 b/gst-libs/ext/libav/tests/ref/fate/targa-conformance-CCM8
index acc3068..aad3bfc 100644
--- a/gst-libs/ext/libav/tests/ref/fate/targa-conformance-CCM8
+++ b/gst-libs/ext/libav/tests/ref/fate/targa-conformance-CCM8
@@ -1 +1,2 @@
-0, 0, 65536, 0xcf98bc29
+#tb 0: 1/25
+0, 0, 0, 1, 65536, 0xcf98bc29
diff --git a/gst-libs/ext/libav/tests/ref/fate/targa-conformance-CTC16 b/gst-libs/ext/libav/tests/ref/fate/targa-conformance-CTC16
index d2c75f6..e848ff8 100644
--- a/gst-libs/ext/libav/tests/ref/fate/targa-conformance-CTC16
+++ b/gst-libs/ext/libav/tests/ref/fate/targa-conformance-CTC16
@@ -1 +1,2 @@
-0, 0, 32768, 0xa6b3d20d
+#tb 0: 1/25
+0, 0, 0, 1, 32768, 0xa6b3d20d
diff --git a/gst-libs/ext/libav/tests/ref/fate/targa-conformance-CTC24 b/gst-libs/ext/libav/tests/ref/fate/targa-conformance-CTC24
index 42e1271..c95f406 100644
--- a/gst-libs/ext/libav/tests/ref/fate/targa-conformance-CTC24
+++ b/gst-libs/ext/libav/tests/ref/fate/targa-conformance-CTC24
@@ -1 +1,2 @@
-0, 0, 49152, 0xaca4bc29
+#tb 0: 1/25
+0, 0, 0, 1, 49152, 0xaca4bc29
diff --git a/gst-libs/ext/libav/tests/ref/fate/targa-conformance-CTC32 b/gst-libs/ext/libav/tests/ref/fate/targa-conformance-CTC32
index acc3068..aad3bfc 100644
--- a/gst-libs/ext/libav/tests/ref/fate/targa-conformance-CTC32
+++ b/gst-libs/ext/libav/tests/ref/fate/targa-conformance-CTC32
@@ -1 +1,2 @@
-0, 0, 65536, 0xcf98bc29
+#tb 0: 1/25
+0, 0, 0, 1, 65536, 0xcf98bc29
diff --git a/gst-libs/ext/libav/tests/ref/fate/targa-conformance-UBW8 b/gst-libs/ext/libav/tests/ref/fate/targa-conformance-UBW8
index 4ff3a9d..60270d7 100644
--- a/gst-libs/ext/libav/tests/ref/fate/targa-conformance-UBW8
+++ b/gst-libs/ext/libav/tests/ref/fate/targa-conformance-UBW8
@@ -1 +1,2 @@
-0, 0, 16384, 0x267e21ef
+#tb 0: 1/25
+0, 0, 0, 1, 16384, 0x267e21ef
diff --git a/gst-libs/ext/libav/tests/ref/fate/targa-conformance-UCM8 b/gst-libs/ext/libav/tests/ref/fate/targa-conformance-UCM8
index acc3068..aad3bfc 100644
--- a/gst-libs/ext/libav/tests/ref/fate/targa-conformance-UCM8
+++ b/gst-libs/ext/libav/tests/ref/fate/targa-conformance-UCM8
@@ -1 +1,2 @@
-0, 0, 65536, 0xcf98bc29
+#tb 0: 1/25
+0, 0, 0, 1, 65536, 0xcf98bc29
diff --git a/gst-libs/ext/libav/tests/ref/fate/targa-conformance-UTC16 b/gst-libs/ext/libav/tests/ref/fate/targa-conformance-UTC16
index d2c75f6..e848ff8 100644
--- a/gst-libs/ext/libav/tests/ref/fate/targa-conformance-UTC16
+++ b/gst-libs/ext/libav/tests/ref/fate/targa-conformance-UTC16
@@ -1 +1,2 @@
-0, 0, 32768, 0xa6b3d20d
+#tb 0: 1/25
+0, 0, 0, 1, 32768, 0xa6b3d20d
diff --git a/gst-libs/ext/libav/tests/ref/fate/targa-conformance-UTC24 b/gst-libs/ext/libav/tests/ref/fate/targa-conformance-UTC24
index 42e1271..c95f406 100644
--- a/gst-libs/ext/libav/tests/ref/fate/targa-conformance-UTC24
+++ b/gst-libs/ext/libav/tests/ref/fate/targa-conformance-UTC24
@@ -1 +1,2 @@
-0, 0, 49152, 0xaca4bc29
+#tb 0: 1/25
+0, 0, 0, 1, 49152, 0xaca4bc29
diff --git a/gst-libs/ext/libav/tests/ref/fate/targa-conformance-UTC32 b/gst-libs/ext/libav/tests/ref/fate/targa-conformance-UTC32
index acc3068..aad3bfc 100644
--- a/gst-libs/ext/libav/tests/ref/fate/targa-conformance-UTC32
+++ b/gst-libs/ext/libav/tests/ref/fate/targa-conformance-UTC32
@@ -1 +1,2 @@
-0, 0, 65536, 0xcf98bc29
+#tb 0: 1/25
+0, 0, 0, 1, 65536, 0xcf98bc29
diff --git a/gst-libs/ext/libav/tests/ref/fate/targa-top-to-bottom b/gst-libs/ext/libav/tests/ref/fate/targa-top-to-bottom
index e9d53bb..4d9577a 100644
--- a/gst-libs/ext/libav/tests/ref/fate/targa-top-to-bottom
+++ b/gst-libs/ext/libav/tests/ref/fate/targa-top-to-bottom
@@ -1 +1,2 @@
-0, 0, 196608, 0xb29ec51a
+#tb 0: 1/25
+0, 0, 0, 1, 196608, 0xb29ec51a
diff --git a/gst-libs/ext/libav/tests/ref/fate/thp b/gst-libs/ext/libav/tests/ref/fate/thp
new file mode 100644
index 0000000..52dd059
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/thp
@@ -0,0 +1,73 @@
+#tb 0: 524288/15712911
+0, 0, 0, 1, 291840, 0xbd7e0b22
+0, 1, 1, 1, 291840, 0xf6e12ca5
+0, 2, 2, 1, 291840, 0x528c7049
+0, 3, 3, 1, 291840, 0x93055de9
+0, 4, 4, 1, 291840, 0xf95a51c1
+0, 5, 5, 1, 291840, 0x6ad3a65a
+0, 6, 6, 1, 291840, 0x494684a7
+0, 7, 7, 1, 291840, 0x74c14eb1
+0, 8, 8, 1, 291840, 0x149fcb7e
+0, 9, 9, 1, 291840, 0x25649761
+0, 10, 10, 1, 291840, 0xbc3f9052
+0, 11, 11, 1, 291840, 0x080edfff
+0, 12, 12, 1, 291840, 0x6d7ad684
+0, 13, 13, 1, 291840, 0x6d53844d
+0, 14, 14, 1, 291840, 0xf7ad5385
+0, 15, 15, 1, 291840, 0x0241b56a
+0, 16, 16, 1, 291840, 0x120122c8
+0, 17, 17, 1, 291840, 0x31b0f32a
+0, 18, 18, 1, 291840, 0x14068b98
+0, 19, 19, 1, 291840, 0xeeec658b
+0, 20, 20, 1, 291840, 0x9376374c
+0, 21, 21, 1, 291840, 0x091e8c6e
+0, 22, 22, 1, 291840, 0x744ad07f
+0, 23, 23, 1, 291840, 0xf99c554e
+0, 24, 24, 1, 291840, 0xc84bd677
+0, 25, 25, 1, 291840, 0x3898d474
+0, 26, 26, 1, 291840, 0x1e2910c8
+0, 27, 27, 1, 291840, 0xb11f58bc
+0, 28, 28, 1, 291840, 0xf89170ee
+0, 29, 29, 1, 291840, 0x8f239dc3
+0, 30, 30, 1, 291840, 0x8538c76c
+0, 31, 31, 1, 291840, 0x162ee66f
+0, 32, 32, 1, 291840, 0x5f8708a5
+0, 33, 33, 1, 291840, 0x95802dfb
+0, 34, 34, 1, 291840, 0xc424630d
+0, 35, 35, 1, 291840, 0xfb8a8667
+0, 36, 36, 1, 291840, 0xbad79af5
+0, 37, 37, 1, 291840, 0xc733b325
+0, 38, 38, 1, 291840, 0x4bfbcd70
+0, 39, 39, 1, 291840, 0x502cd950
+0, 40, 40, 1, 291840, 0x8461ca2c
+0, 41, 41, 1, 291840, 0x00219b0d
+0, 42, 42, 1, 291840, 0xa4de45e1
+0, 43, 43, 1, 291840, 0xacd3f4df
+0, 44, 44, 1, 291840, 0x2203a369
+0, 45, 45, 1, 291840, 0x0a66effa
+0, 46, 46, 1, 291840, 0x7ac1fd91
+0, 47, 47, 1, 291840, 0x84970aa7
+0, 48, 48, 1, 291840, 0x569d145f
+0, 49, 49, 1, 291840, 0xe51efe1b
+0, 50, 50, 1, 291840, 0x38e2cd78
+0, 51, 51, 1, 291840, 0x93428ea2
+0, 52, 52, 1, 291840, 0x3d3f5b17
+0, 53, 53, 1, 291840, 0x9546127d
+0, 54, 54, 1, 291840, 0x4178be54
+0, 55, 55, 1, 291840, 0x0d0f8036
+0, 56, 56, 1, 291840, 0xc20557b9
+0, 57, 57, 1, 291840, 0x6d4b2d64
+0, 58, 58, 1, 291840, 0xa750125d
+0, 59, 59, 1, 291840, 0x04623ce3
+0, 60, 60, 1, 291840, 0xc7f2bbc7
+0, 61, 61, 1, 291840, 0x6e271336
+0, 62, 62, 1, 291840, 0xcfbd4246
+0, 63, 63, 1, 291840, 0xe1493be9
+0, 64, 64, 1, 291840, 0x6c731194
+0, 65, 65, 1, 291840, 0x0fc30cc2
+0, 66, 66, 1, 291840, 0x967427f3
+0, 67, 67, 1, 291840, 0x55ae3b00
+0, 68, 68, 1, 291840, 0xbe4f200c
+0, 69, 69, 1, 291840, 0xc515e443
+0, 70, 70, 1, 291840, 0xd738bd69
+0, 71, 71, 1, 291840, 0xa8e0ab69
diff --git a/gst-libs/ext/libav/tests/ref/fate/tiertex-seq b/gst-libs/ext/libav/tests/ref/fate/tiertex-seq
index 24819eb..74407e7 100644
--- a/gst-libs/ext/libav/tests/ref/fate/tiertex-seq
+++ b/gst-libs/ext/libav/tests/ref/fate/tiertex-seq
@@ -1,98 +1,100 @@
-0, 0, 98304, 0x2e5db4a4
-1, 0, 1764, 0x00000000
-0, 3600, 98304, 0xb20c19d0
-1, 3600, 1764, 0x80a253d9
-0, 7200, 98304, 0x6b8538c0
-1, 7200, 1764, 0x95a16721
-0, 10800, 98304, 0x172207e3
-1, 10800, 1764, 0x0f0d4cb6
-0, 14400, 98304, 0x63fb7dc1
-1, 14400, 1764, 0x75026779
-0, 18000, 98304, 0x37cf1601
-1, 18000, 1764, 0xb4356e37
-0, 21600, 98304, 0x82941990
-1, 21600, 1764, 0xfafa64cb
-0, 25200, 98304, 0xe0a5309e
-1, 25200, 1764, 0xe8fd7970
-0, 28800, 98304, 0x164cb67d
-1, 28800, 1764, 0x666879b7
-0, 32400, 98304, 0xed2189f8
-1, 32400, 1764, 0xf2cd7770
-0, 36000, 98304, 0x7215e529
-1, 36000, 1764, 0x54317a1c
-0, 39600, 98304, 0x170c783b
-1, 39600, 1764, 0x9c396930
-0, 43200, 98304, 0xf6bd74c7
-1, 43200, 1764, 0x87115ec4
-0, 46800, 98304, 0x1efd38c4
-1, 46800, 1764, 0x0c9b69b6
-0, 50400, 98304, 0x29c26bba
-1, 50400, 1764, 0x8c3a758a
-0, 54000, 98304, 0x880a6313
-1, 54000, 1764, 0x605d776a
-0, 57600, 98304, 0x73f5bb00
-1, 57600, 1764, 0x0556852d
-0, 61200, 98304, 0xc85b19ec
-1, 61200, 1764, 0x7d4363f8
-0, 64800, 98304, 0x00000000
-1, 64800, 1764, 0xc5cd75d0
-0, 68400, 98304, 0x00000000
-1, 68400, 1764, 0x3ff3646d
-0, 72000, 98304, 0x00000000
-1, 72000, 1764, 0x10136d25
-1, 75600, 1764, 0xeb1a6cd0
-1, 79200, 1764, 0xef937ed1
-1, 82800, 1764, 0x2d2b6f79
-1, 86400, 1764, 0x6f457231
-1, 90000, 1764, 0x56267c9d
-1, 93600, 1764, 0xd49e79c8
-1, 97200, 1764, 0xc726703d
-1, 100800, 1764, 0x2abf8074
-1, 104400, 1764, 0xb50c556d
-1, 108000, 1764, 0xc1f2523c
-1, 111600, 1764, 0x850a6f93
-1, 115200, 1764, 0x8da76c31
-1, 118800, 1764, 0xfcccdf13
-1, 122400, 1764, 0x00000000
-1, 126000, 1764, 0x00000000
-1, 129600, 1764, 0x00000000
-1, 133200, 1764, 0x00000000
-1, 136800, 1764, 0x00000000
-1, 140400, 1764, 0x00000000
-1, 144000, 1764, 0x00000000
-1, 147600, 1764, 0x00000000
-1, 151200, 1764, 0x00000000
-1, 154800, 1764, 0x00000000
-1, 158400, 1764, 0x00000000
-1, 162000, 1764, 0x00000000
-1, 165600, 1764, 0x00000000
-1, 169200, 1764, 0x00000000
-1, 172800, 1764, 0x00000000
-1, 176400, 1764, 0x00000000
-1, 180000, 1764, 0x00000000
-1, 183600, 1764, 0x00000000
-1, 187200, 1764, 0x00000000
-1, 190800, 1764, 0x00000000
-1, 194400, 1764, 0x00000000
-1, 198000, 1764, 0x00000000
-1, 201600, 1764, 0x00000000
-1, 205200, 1764, 0x00000000
-1, 208800, 1764, 0x00000000
-1, 212400, 1764, 0x00000000
-1, 216000, 1764, 0x00000000
-1, 219600, 1764, 0x00000000
-1, 223200, 1764, 0x00000000
-1, 226800, 1764, 0x00000000
-1, 230400, 1764, 0x00000000
-1, 234000, 1764, 0x00000000
-1, 237600, 1764, 0x00000000
-1, 241200, 1764, 0x00000000
-1, 244800, 1764, 0x00000000
-1, 248400, 1764, 0x00000000
-1, 252000, 1764, 0x00000000
-1, 255600, 1764, 0x00000000
-1, 259200, 1764, 0x00000000
-1, 262800, 1764, 0x00000000
-1, 266400, 1764, 0x00000000
-1, 270000, 1764, 0x00000000
-1, 273600, 1764, 0x00000000
+#tb 0: 1/25
+#tb 1: 1/22050
+1, 0, 0, 882, 1764, 0x00000000
+1, 882, 882, 882, 1764, 0x80a253d9
+0, 2, 2, 1, 98304, 0x2e5db4a4
+1, 1764, 1764, 882, 1764, 0x95a16721
+1, 2646, 2646, 882, 1764, 0x0f0d4cb6
+1, 3528, 3528, 882, 1764, 0x75026779
+1, 4410, 4410, 882, 1764, 0xb4356e37
+0, 6, 6, 1, 98304, 0xb20c19d0
+1, 5292, 5292, 882, 1764, 0xfafa64cb
+1, 6174, 6174, 882, 1764, 0xe8fd7970
+1, 7056, 7056, 882, 1764, 0x666879b7
+0, 9, 9, 1, 98304, 0x6b8538c0
+1, 7938, 7938, 882, 1764, 0xf2cd7770
+1, 8820, 8820, 882, 1764, 0x54317a1c
+1, 9702, 9702, 882, 1764, 0x9c396930
+1, 10584, 10584, 882, 1764, 0x87115ec4
+0, 13, 13, 1, 98304, 0x172207e3
+1, 11466, 11466, 882, 1764, 0x0c9b69b6
+1, 12348, 12348, 882, 1764, 0x8c3a758a
+1, 13230, 13230, 882, 1764, 0x605d776a
+0, 16, 16, 1, 98304, 0x63fb7dc1
+1, 14112, 14112, 882, 1764, 0x0556852d
+1, 14994, 14994, 882, 1764, 0x7d4363f8
+1, 15876, 15876, 882, 1764, 0xc5cd75d0
+1, 16758, 16758, 882, 1764, 0x3ff3646d
+0, 20, 20, 1, 98304, 0x37cf1601
+1, 17640, 17640, 882, 1764, 0x10136d25
+1, 18522, 18522, 882, 1764, 0xeb1a6cd0
+1, 19404, 19404, 882, 1764, 0xef937ed1
+1, 20286, 20286, 882, 1764, 0x2d2b6f79
+0, 24, 24, 1, 98304, 0x82941990
+1, 21168, 21168, 882, 1764, 0x6f457231
+1, 22050, 22050, 882, 1764, 0x56267c9d
+1, 22932, 22932, 882, 1764, 0xd49e79c8
+0, 27, 27, 1, 98304, 0xe0a5309e
+1, 23814, 23814, 882, 1764, 0xc726703d
+1, 24696, 24696, 882, 1764, 0x2abf8074
+1, 25578, 25578, 882, 1764, 0xb50c556d
+1, 26460, 26460, 882, 1764, 0xc1f2523c
+0, 31, 31, 1, 98304, 0x164cb67d
+1, 27342, 27342, 882, 1764, 0x850a6f93
+1, 28224, 28224, 882, 1764, 0x8da76c31
+1, 29106, 29106, 882, 1764, 0xfcccdf13
+0, 34, 34, 1, 98304, 0xed2189f8
+1, 29988, 29988, 882, 1764, 0x00000000
+1, 30870, 30870, 882, 1764, 0x00000000
+1, 31752, 31752, 882, 1764, 0x00000000
+1, 32634, 32634, 882, 1764, 0x00000000
+0, 38, 38, 1, 98304, 0x7215e529
+1, 33516, 33516, 882, 1764, 0x00000000
+1, 34398, 34398, 882, 1764, 0x00000000
+1, 35280, 35280, 882, 1764, 0x00000000
+0, 41, 41, 1, 98304, 0x170c783b
+1, 36162, 36162, 882, 1764, 0x00000000
+1, 37044, 37044, 882, 1764, 0x00000000
+1, 37926, 37926, 882, 1764, 0x00000000
+1, 38808, 38808, 882, 1764, 0x00000000
+0, 45, 45, 1, 98304, 0xf6bd74c7
+1, 39690, 39690, 882, 1764, 0x00000000
+1, 40572, 40572, 882, 1764, 0x00000000
+1, 41454, 41454, 882, 1764, 0x00000000
+1, 42336, 42336, 882, 1764, 0x00000000
+0, 49, 49, 1, 98304, 0x1efd38c4
+1, 43218, 43218, 882, 1764, 0x00000000
+1, 44100, 44100, 882, 1764, 0x00000000
+1, 44982, 44982, 882, 1764, 0x00000000
+0, 52, 52, 1, 98304, 0x29c26bba
+1, 45864, 45864, 882, 1764, 0x00000000
+1, 46746, 46746, 882, 1764, 0x00000000
+1, 47628, 47628, 882, 1764, 0x00000000
+1, 48510, 48510, 882, 1764, 0x00000000
+0, 56, 56, 1, 98304, 0x880a6313
+1, 49392, 49392, 882, 1764, 0x00000000
+1, 50274, 50274, 882, 1764, 0x00000000
+1, 51156, 51156, 882, 1764, 0x00000000
+0, 59, 59, 1, 98304, 0x73f5bb00
+1, 52038, 52038, 882, 1764, 0x00000000
+1, 52920, 52920, 882, 1764, 0x00000000
+1, 53802, 53802, 882, 1764, 0x00000000
+1, 54684, 54684, 882, 1764, 0x00000000
+0, 63, 63, 1, 98304, 0xc85b19ec
+1, 55566, 55566, 882, 1764, 0x00000000
+1, 56448, 56448, 882, 1764, 0x00000000
+1, 57330, 57330, 882, 1764, 0x00000000
+0, 66, 66, 1, 98304, 0x00000000
+1, 58212, 58212, 882, 1764, 0x00000000
+1, 59094, 59094, 882, 1764, 0x00000000
+1, 59976, 59976, 882, 1764, 0x00000000
+1, 60858, 60858, 882, 1764, 0x00000000
+0, 70, 70, 1, 98304, 0x00000000
+1, 61740, 61740, 882, 1764, 0x00000000
+1, 62622, 62622, 882, 1764, 0x00000000
+1, 63504, 63504, 882, 1764, 0x00000000
+1, 64386, 64386, 882, 1764, 0x00000000
+0, 74, 74, 1, 98304, 0x00000000
+1, 65268, 65268, 882, 1764, 0x00000000
+1, 66150, 66150, 882, 1764, 0x00000000
+1, 67032, 67032, 882, 1764, 0x00000000
diff --git a/gst-libs/ext/libav/tests/ref/fate/tiff-fax-g3 b/gst-libs/ext/libav/tests/ref/fate/tiff-fax-g3
index b712dd2..fa7bc2f 100644
--- a/gst-libs/ext/libav/tests/ref/fate/tiff-fax-g3
+++ b/gst-libs/ext/libav/tests/ref/fate/tiff-fax-g3
@@ -1 +1,2 @@
-0, 0, 1000384, 0xb758eb8b
+#tb 0: 1/25
+0, 0, 0, 1, 1000384, 0xb758eb8b
diff --git a/gst-libs/ext/libav/tests/ref/fate/tiff-fax-g3s b/gst-libs/ext/libav/tests/ref/fate/tiff-fax-g3s
index b712dd2..fa7bc2f 100644
--- a/gst-libs/ext/libav/tests/ref/fate/tiff-fax-g3s
+++ b/gst-libs/ext/libav/tests/ref/fate/tiff-fax-g3s
@@ -1 +1,2 @@
-0, 0, 1000384, 0xb758eb8b
+#tb 0: 1/25
+0, 0, 0, 1, 1000384, 0xb758eb8b
diff --git a/gst-libs/ext/libav/tests/ref/fate/tmv b/gst-libs/ext/libav/tests/ref/fate/tmv
index feca20e..6203e86 100644
--- a/gst-libs/ext/libav/tests/ref/fate/tmv
+++ b/gst-libs/ext/libav/tests/ref/fate/tmv
@@ -1,220 +1,222 @@
-0, 0, 192000, 0xc698297a
-1, 0, 736, 0xf63db497
-0, 1501, 192000, 0x8d5bd6be
-1, 1501, 736, 0xbc42caef
-0, 3003, 192000, 0x21c32083
-1, 3003, 736, 0x5619a45a
-0, 4504, 192000, 0x849cd4c0
-1, 4504, 736, 0x1b8ac0f9
-0, 6006, 192000, 0x8c63a4f0
-1, 6006, 736, 0x55dcac78
-0, 7507, 192000, 0x5dbee9ab
-1, 7507, 736, 0xd9f2a266
-0, 9009, 192000, 0x2b12d9bb
-1, 9009, 736, 0x22f8af51
-0, 10510, 192000, 0x1a737e17
-1, 10510, 736, 0x838bacb8
-0, 12012, 192000, 0x90536c29
-1, 12012, 736, 0x7b29b4f9
-0, 13513, 192000, 0xd7795243
-1, 13513, 736, 0x5a01b505
-0, 15015, 192000, 0x08847e17
-1, 15015, 736, 0xc330abb4
-0, 16516, 192000, 0x47aa5a3b
-1, 16516, 736, 0x84d6c49d
-0, 18018, 192000, 0x9435266f
-1, 18018, 736, 0xd0a1a588
-0, 19519, 192000, 0x87e7ea9c
-1, 19519, 736, 0x9083a382
-0, 21021, 192000, 0x6dc00285
-1, 21021, 736, 0x291eb335
-0, 22522, 192000, 0xf6407ddf
-1, 22522, 736, 0xdda2b452
-0, 24024, 192000, 0x55541c09
-1, 24024, 736, 0x82feab67
-0, 25525, 192000, 0xf1c4f5be
-1, 25525, 736, 0xfca6b943
-0, 27027, 192000, 0xe59ff74c
-1, 27027, 736, 0x2a4ea1fd
-0, 28528, 192000, 0x0fedcf04
-1, 28528, 736, 0xbb4bc783
-0, 30030, 192000, 0x04b893dd
-1, 30030, 736, 0x8c10a799
-0, 31531, 192000, 0xfef47d83
-1, 31531, 736, 0x8751a53b
-0, 33033, 192000, 0x07bde9ed
-1, 33033, 736, 0x4b3c9fc3
-0, 34534, 192000, 0xb8003fd2
-1, 34534, 736, 0x5dad9b46
-0, 36036, 192000, 0x4eb6b3ed
-1, 36036, 736, 0xe106a3e6
-0, 37537, 192000, 0x320b0b34
-1, 37537, 736, 0xa42a9a3b
-0, 39039, 192000, 0x5156e90f
-1, 39039, 736, 0xb5069901
-0, 40540, 192000, 0x34778cde
-1, 40540, 736, 0x3556c3c3
-0, 42042, 192000, 0xd8d96e44
-1, 42042, 736, 0xa870c1ee
-0, 43543, 192000, 0x962ae9f3
-1, 43543, 736, 0xc388b6d8
-0, 45045, 192000, 0x3d29d85a
-1, 45045, 736, 0xe167a2b0
-0, 46546, 192000, 0x838554fa
-1, 46546, 736, 0x15aeb59d
-0, 48048, 192000, 0xd64a3b93
-1, 48048, 736, 0xa576c0bc
-0, 49549, 192000, 0x380ef140
-1, 49549, 736, 0x44f3b827
-0, 51051, 192000, 0x076b38c0
-1, 51051, 736, 0xfa5ecd84
-0, 52552, 192000, 0xd9a67c7c
-1, 52552, 736, 0xb7b996f6
-0, 54054, 192000, 0xc2849a50
-1, 54054, 736, 0xb390c311
-0, 55555, 192000, 0x9b94a347
-1, 55555, 736, 0xc5a9ab0f
-0, 57057, 192000, 0xe3ba9c07
-1, 57057, 736, 0x1a3aa3f6
-0, 58558, 192000, 0xef0011f5
-1, 58558, 736, 0xdaaf9e42
-0, 60060, 192000, 0xa98381e8
-1, 60060, 736, 0xad8fb0ba
-0, 61561, 192000, 0x27e5ce9b
-1, 61561, 736, 0x9cce9e05
-0, 63063, 192000, 0x8568e33f
-1, 63063, 736, 0x70639e6f
-0, 64564, 192000, 0x540633b6
-1, 64564, 736, 0xc5e1ba9b
-0, 66066, 192000, 0xd8fcfbed
-1, 66066, 736, 0x9e6cb422
-0, 67567, 192000, 0x15609e04
-1, 67567, 736, 0x5c559a1e
-0, 69069, 192000, 0x7e4f5c9b
-1, 69069, 736, 0xb071c2da
-0, 70570, 192000, 0xef14950d
-1, 70570, 736, 0xd9bdb9eb
-0, 72072, 192000, 0x9e0b85b9
-1, 72072, 736, 0x5ecab2d5
-0, 73573, 192000, 0xf3b69b95
-1, 73573, 736, 0x0f78a8fe
-0, 75075, 192000, 0x09b6db39
-1, 75075, 736, 0x74ebaccd
-0, 76576, 192000, 0x4dc9a300
-1, 76576, 736, 0x2cfab78e
-0, 78078, 192000, 0x29d9fdde
-1, 78078, 736, 0x32c6c26e
-0, 79579, 192000, 0x22e79283
-1, 79579, 736, 0xbe339d74
-0, 81081, 192000, 0x5f5c95aa
-1, 81081, 736, 0x2c31b687
-0, 82582, 192000, 0x4d76efde
-1, 82582, 736, 0xcbb0b8d5
-0, 84084, 192000, 0xb1d79f6a
-1, 84084, 736, 0x17bcb56a
-0, 85585, 192000, 0xedfe6012
-1, 85585, 736, 0x116fb70c
-0, 87087, 192000, 0x4a56033a
-1, 87087, 736, 0xa22eb34f
-0, 88588, 192000, 0xdbc9f746
-1, 88588, 736, 0x130bc9bb
-0, 90090, 192000, 0xedff8a16
-1, 90090, 736, 0xbb0b77aa
-0, 91591, 192000, 0x46b5f843
-1, 91591, 736, 0xafb5a9f0
-0, 93093, 192000, 0xbd12dbfc
-1, 93093, 736, 0xaf55f1a3
-0, 94594, 192000, 0xacf2a336
-1, 94594, 736, 0x988e9669
-0, 96096, 192000, 0x13843e7f
-1, 96096, 736, 0x4e2cc9ab
-0, 97597, 192000, 0x6fda777f
-1, 97597, 736, 0x34b3b7ea
-0, 99099, 192000, 0x16ffef07
-1, 99099, 736, 0x1252a16b
-0, 100600, 192000, 0xb36c06c6
-1, 100600, 736, 0x04279e74
-0, 102102, 192000, 0xd65746b1
-1, 102102, 736, 0x9c2ecb2e
-0, 103603, 192000, 0x2817079b
-1, 103603, 736, 0x6c16945a
-0, 105105, 192000, 0xadb60837
-1, 105105, 736, 0x2c0cc1f9
-0, 106606, 192000, 0x60cb0d87
-1, 106606, 736, 0x52fba868
-0, 108108, 192000, 0x14e5b02b
-1, 108108, 736, 0xe2a2a5be
-0, 109609, 192000, 0x574fd8f4
-1, 109609, 736, 0x2f56a95b
-0, 111111, 192000, 0xffb9a8fa
-1, 111111, 736, 0x573196a0
-0, 112612, 192000, 0xc2904a3e
-1, 112612, 736, 0xb542c1dc
-0, 114114, 192000, 0x22e77c9b
-1, 114114, 736, 0x7f6a9964
-0, 115615, 192000, 0xd76d81c2
-1, 115615, 736, 0xc39db324
-0, 117117, 192000, 0xf5b0fcc8
-1, 117117, 736, 0xa2dbb058
-0, 118618, 192000, 0xc452ce4d
-1, 118618, 736, 0x8bfac722
-0, 120120, 192000, 0x64a53e4f
-1, 120120, 736, 0x5e679406
-0, 121621, 192000, 0xe6c115da
-1, 121621, 736, 0xd7a8c2aa
-0, 123123, 192000, 0x959d45fe
-1, 123123, 736, 0x5ec6a7a0
-0, 124624, 192000, 0xabb270b6
-1, 124624, 736, 0x9f33c47f
-0, 126126, 192000, 0x451642b8
-1, 126126, 736, 0x4c4998bf
-0, 127627, 192000, 0x028b2202
-1, 127627, 736, 0x2363c344
-0, 129129, 192000, 0xf5d79b86
-1, 129129, 736, 0xecf9a09f
-0, 130630, 192000, 0xebe0623e
-1, 130630, 736, 0x5a069e69
-0, 132132, 192000, 0x7560d1eb
-1, 132132, 736, 0xe2e5b106
-0, 133633, 192000, 0xcbf85785
-1, 133633, 736, 0x7ff4b09e
-0, 135135, 192000, 0x180f6aca
-1, 135135, 736, 0x0157acd2
-0, 136636, 192000, 0xea8ecb95
-1, 136636, 736, 0x64849b5a
-0, 138138, 192000, 0x6a5e3639
-1, 138138, 736, 0x0399b037
-0, 139639, 192000, 0x5aa6c22c
-1, 139639, 736, 0xa57ea80f
-0, 141141, 192000, 0xdbb50948
-1, 141141, 736, 0x233eb2a4
-0, 142642, 192000, 0x0184a90a
-1, 142642, 736, 0x8aa5dfa0
-0, 144144, 192000, 0x0efc1358
-1, 144144, 736, 0x0c9fa877
-0, 145645, 192000, 0x29053255
-1, 145645, 736, 0xbe6faef2
-0, 147147, 192000, 0x3a7e239d
-1, 147147, 736, 0xf800c0f2
-0, 148648, 192000, 0x3bd99ca5
-1, 148648, 736, 0x1d68a964
-0, 150150, 192000, 0xe1b5a4d6
-1, 150150, 736, 0x0e4f8872
-0, 151651, 192000, 0xf487f8bb
-1, 151651, 736, 0x31c6ed1c
-0, 153153, 192000, 0x8b14387c
-1, 153153, 736, 0x7448a8d2
-0, 154654, 192000, 0xdaeb9cb4
-1, 154654, 736, 0x79a2ac09
-0, 156156, 192000, 0xdc1d2f5b
-1, 156156, 736, 0xbdbfa397
-0, 157657, 192000, 0x4dcab167
-1, 157657, 736, 0xa5deb8bb
-0, 159159, 192000, 0x87fcf0d3
-1, 159159, 736, 0x4565d179
-0, 160660, 192000, 0x36d37542
-1, 160660, 736, 0x64d89f91
-0, 162162, 192000, 0x59ba49c5
-1, 162162, 736, 0x32319f68
-0, 163663, 192000, 0xf679b712
-1, 163663, 736, 0x3efdc04f
+#tb 0: 184/11029
+#tb 1: 1/22058
+0, 0, 0, 1, 192000, 0xc698297a
+1, 0, 0, 368, 736, 0xf63db497
+0, 1, 1, 1, 192000, 0x8d5bd6be
+1, 368, 368, 368, 736, 0xbc42caef
+0, 2, 2, 1, 192000, 0x21c32083
+1, 736, 736, 368, 736, 0x5619a45a
+0, 3, 3, 1, 192000, 0x849cd4c0
+1, 1104, 1104, 368, 736, 0x1b8ac0f9
+0, 4, 4, 1, 192000, 0x8c63a4f0
+1, 1472, 1472, 368, 736, 0x55dcac78
+0, 5, 5, 1, 192000, 0x5dbee9ab
+1, 1840, 1840, 368, 736, 0xd9f2a266
+0, 6, 6, 1, 192000, 0x2b12d9bb
+1, 2208, 2208, 368, 736, 0x22f8af51
+0, 7, 7, 1, 192000, 0x1a737e17
+1, 2576, 2576, 368, 736, 0x838bacb8
+0, 8, 8, 1, 192000, 0x90536c29
+1, 2944, 2944, 368, 736, 0x7b29b4f9
+0, 9, 9, 1, 192000, 0xd7795243
+1, 3312, 3312, 368, 736, 0x5a01b505
+0, 10, 10, 1, 192000, 0x08847e17
+1, 3680, 3680, 368, 736, 0xc330abb4
+0, 11, 11, 1, 192000, 0x47aa5a3b
+1, 4048, 4048, 368, 736, 0x84d6c49d
+0, 12, 12, 1, 192000, 0x9435266f
+1, 4416, 4416, 368, 736, 0xd0a1a588
+0, 13, 13, 1, 192000, 0x87e7ea9c
+1, 4784, 4784, 368, 736, 0x9083a382
+0, 14, 14, 1, 192000, 0x6dc00285
+1, 5152, 5152, 368, 736, 0x291eb335
+0, 15, 15, 1, 192000, 0xf6407ddf
+1, 5520, 5520, 368, 736, 0xdda2b452
+0, 16, 16, 1, 192000, 0x55541c09
+1, 5888, 5888, 368, 736, 0x82feab67
+0, 17, 17, 1, 192000, 0xf1c4f5be
+1, 6256, 6256, 368, 736, 0xfca6b943
+0, 18, 18, 1, 192000, 0xe59ff74c
+1, 6624, 6624, 368, 736, 0x2a4ea1fd
+0, 19, 19, 1, 192000, 0x0fedcf04
+1, 6992, 6992, 368, 736, 0xbb4bc783
+0, 20, 20, 1, 192000, 0x04b893dd
+1, 7360, 7360, 368, 736, 0x8c10a799
+0, 21, 21, 1, 192000, 0xfef47d83
+1, 7728, 7728, 368, 736, 0x8751a53b
+0, 22, 22, 1, 192000, 0x07bde9ed
+1, 8096, 8096, 368, 736, 0x4b3c9fc3
+0, 23, 23, 1, 192000, 0xb8003fd2
+1, 8464, 8464, 368, 736, 0x5dad9b46
+0, 24, 24, 1, 192000, 0x4eb6b3ed
+1, 8832, 8832, 368, 736, 0xe106a3e6
+0, 25, 25, 1, 192000, 0x320b0b34
+1, 9200, 9200, 368, 736, 0xa42a9a3b
+0, 26, 26, 1, 192000, 0x5156e90f
+1, 9568, 9568, 368, 736, 0xb5069901
+0, 27, 27, 1, 192000, 0x34778cde
+1, 9936, 9936, 368, 736, 0x3556c3c3
+0, 28, 28, 1, 192000, 0xd8d96e44
+1, 10304, 10304, 368, 736, 0xa870c1ee
+0, 29, 29, 1, 192000, 0x962ae9f3
+1, 10672, 10672, 368, 736, 0xc388b6d8
+0, 30, 30, 1, 192000, 0x3d29d85a
+1, 11040, 11040, 368, 736, 0xe167a2b0
+0, 31, 31, 1, 192000, 0x838554fa
+1, 11408, 11408, 368, 736, 0x15aeb59d
+0, 32, 32, 1, 192000, 0xd64a3b93
+1, 11776, 11776, 368, 736, 0xa576c0bc
+0, 33, 33, 1, 192000, 0x380ef140
+1, 12144, 12144, 368, 736, 0x44f3b827
+0, 34, 34, 1, 192000, 0x076b38c0
+1, 12512, 12512, 368, 736, 0xfa5ecd84
+0, 35, 35, 1, 192000, 0xd9a67c7c
+1, 12880, 12880, 368, 736, 0xb7b996f6
+0, 36, 36, 1, 192000, 0xc2849a50
+1, 13248, 13248, 368, 736, 0xb390c311
+0, 37, 37, 1, 192000, 0x9b94a347
+1, 13616, 13616, 368, 736, 0xc5a9ab0f
+0, 38, 38, 1, 192000, 0xe3ba9c07
+1, 13984, 13984, 368, 736, 0x1a3aa3f6
+0, 39, 39, 1, 192000, 0xef0011f5
+1, 14352, 14352, 368, 736, 0xdaaf9e42
+0, 40, 40, 1, 192000, 0xa98381e8
+1, 14720, 14720, 368, 736, 0xad8fb0ba
+0, 41, 41, 1, 192000, 0x27e5ce9b
+1, 15088, 15088, 368, 736, 0x9cce9e05
+0, 42, 42, 1, 192000, 0x8568e33f
+1, 15456, 15456, 368, 736, 0x70639e6f
+0, 43, 43, 1, 192000, 0x540633b6
+1, 15824, 15824, 368, 736, 0xc5e1ba9b
+0, 44, 44, 1, 192000, 0xd8fcfbed
+1, 16192, 16192, 368, 736, 0x9e6cb422
+0, 45, 45, 1, 192000, 0x15609e04
+1, 16560, 16560, 368, 736, 0x5c559a1e
+0, 46, 46, 1, 192000, 0x7e4f5c9b
+1, 16928, 16928, 368, 736, 0xb071c2da
+0, 47, 47, 1, 192000, 0xef14950d
+1, 17296, 17296, 368, 736, 0xd9bdb9eb
+0, 48, 48, 1, 192000, 0x9e0b85b9
+1, 17664, 17664, 368, 736, 0x5ecab2d5
+0, 49, 49, 1, 192000, 0xf3b69b95
+1, 18032, 18032, 368, 736, 0x0f78a8fe
+0, 50, 50, 1, 192000, 0x09b6db39
+1, 18400, 18400, 368, 736, 0x74ebaccd
+0, 51, 51, 1, 192000, 0x4dc9a300
+1, 18768, 18768, 368, 736, 0x2cfab78e
+0, 52, 52, 1, 192000, 0x29d9fdde
+1, 19136, 19136, 368, 736, 0x32c6c26e
+0, 53, 53, 1, 192000, 0x22e79283
+1, 19504, 19504, 368, 736, 0xbe339d74
+0, 54, 54, 1, 192000, 0x5f5c95aa
+1, 19872, 19872, 368, 736, 0x2c31b687
+0, 55, 55, 1, 192000, 0x4d76efde
+1, 20240, 20240, 368, 736, 0xcbb0b8d5
+0, 56, 56, 1, 192000, 0xb1d79f6a
+1, 20608, 20608, 368, 736, 0x17bcb56a
+0, 57, 57, 1, 192000, 0xedfe6012
+1, 20976, 20976, 368, 736, 0x116fb70c
+0, 58, 58, 1, 192000, 0x4a56033a
+1, 21344, 21344, 368, 736, 0xa22eb34f
+0, 59, 59, 1, 192000, 0xdbc9f746
+1, 21712, 21712, 368, 736, 0x130bc9bb
+0, 60, 60, 1, 192000, 0xedff8a16
+1, 22080, 22080, 368, 736, 0xbb0b77aa
+0, 61, 61, 1, 192000, 0x46b5f843
+1, 22448, 22448, 368, 736, 0xafb5a9f0
+0, 62, 62, 1, 192000, 0xbd12dbfc
+1, 22816, 22816, 368, 736, 0xaf55f1a3
+0, 63, 63, 1, 192000, 0xacf2a336
+1, 23184, 23184, 368, 736, 0x988e9669
+0, 64, 64, 1, 192000, 0x13843e7f
+1, 23552, 23552, 368, 736, 0x4e2cc9ab
+0, 65, 65, 1, 192000, 0x6fda777f
+1, 23920, 23920, 368, 736, 0x34b3b7ea
+0, 66, 66, 1, 192000, 0x16ffef07
+1, 24288, 24288, 368, 736, 0x1252a16b
+0, 67, 67, 1, 192000, 0xb36c06c6
+1, 24656, 24656, 368, 736, 0x04279e74
+0, 68, 68, 1, 192000, 0xd65746b1
+1, 25024, 25024, 368, 736, 0x9c2ecb2e
+0, 69, 69, 1, 192000, 0x2817079b
+1, 25392, 25392, 368, 736, 0x6c16945a
+0, 70, 70, 1, 192000, 0xadb60837
+1, 25760, 25760, 368, 736, 0x2c0cc1f9
+0, 71, 71, 1, 192000, 0x60cb0d87
+1, 26128, 26128, 368, 736, 0x52fba868
+0, 72, 72, 1, 192000, 0x14e5b02b
+1, 26496, 26496, 368, 736, 0xe2a2a5be
+0, 73, 73, 1, 192000, 0x574fd8f4
+1, 26864, 26864, 368, 736, 0x2f56a95b
+0, 74, 74, 1, 192000, 0xffb9a8fa
+1, 27232, 27232, 368, 736, 0x573196a0
+0, 75, 75, 1, 192000, 0xc2904a3e
+1, 27600, 27600, 368, 736, 0xb542c1dc
+0, 76, 76, 1, 192000, 0x22e77c9b
+1, 27968, 27968, 368, 736, 0x7f6a9964
+0, 77, 77, 1, 192000, 0xd76d81c2
+1, 28336, 28336, 368, 736, 0xc39db324
+0, 78, 78, 1, 192000, 0xf5b0fcc8
+1, 28704, 28704, 368, 736, 0xa2dbb058
+0, 79, 79, 1, 192000, 0xc452ce4d
+1, 29072, 29072, 368, 736, 0x8bfac722
+0, 80, 80, 1, 192000, 0x64a53e4f
+1, 29440, 29440, 368, 736, 0x5e679406
+0, 81, 81, 1, 192000, 0xe6c115da
+1, 29808, 29808, 368, 736, 0xd7a8c2aa
+0, 82, 82, 1, 192000, 0x959d45fe
+1, 30176, 30176, 368, 736, 0x5ec6a7a0
+0, 83, 83, 1, 192000, 0xabb270b6
+1, 30544, 30544, 368, 736, 0x9f33c47f
+0, 84, 84, 1, 192000, 0x451642b8
+1, 30912, 30912, 368, 736, 0x4c4998bf
+0, 85, 85, 1, 192000, 0x028b2202
+1, 31280, 31280, 368, 736, 0x2363c344
+0, 86, 86, 1, 192000, 0xf5d79b86
+1, 31648, 31648, 368, 736, 0xecf9a09f
+0, 87, 87, 1, 192000, 0xebe0623e
+1, 32016, 32016, 368, 736, 0x5a069e69
+0, 88, 88, 1, 192000, 0x7560d1eb
+1, 32384, 32384, 368, 736, 0xe2e5b106
+0, 89, 89, 1, 192000, 0xcbf85785
+1, 32752, 32752, 368, 736, 0x7ff4b09e
+0, 90, 90, 1, 192000, 0x180f6aca
+1, 33120, 33120, 368, 736, 0x0157acd2
+0, 91, 91, 1, 192000, 0xea8ecb95
+1, 33488, 33488, 368, 736, 0x64849b5a
+0, 92, 92, 1, 192000, 0x6a5e3639
+1, 33856, 33856, 368, 736, 0x0399b037
+0, 93, 93, 1, 192000, 0x5aa6c22c
+1, 34224, 34224, 368, 736, 0xa57ea80f
+0, 94, 94, 1, 192000, 0xdbb50948
+1, 34592, 34592, 368, 736, 0x233eb2a4
+0, 95, 95, 1, 192000, 0x0184a90a
+1, 34960, 34960, 368, 736, 0x8aa5dfa0
+0, 96, 96, 1, 192000, 0x0efc1358
+1, 35328, 35328, 368, 736, 0x0c9fa877
+0, 97, 97, 1, 192000, 0x29053255
+1, 35696, 35696, 368, 736, 0xbe6faef2
+0, 98, 98, 1, 192000, 0x3a7e239d
+1, 36064, 36064, 368, 736, 0xf800c0f2
+0, 99, 99, 1, 192000, 0x3bd99ca5
+1, 36432, 36432, 368, 736, 0x1d68a964
+0, 100, 100, 1, 192000, 0xe1b5a4d6
+1, 36800, 36800, 368, 736, 0x0e4f8872
+0, 101, 101, 1, 192000, 0xf487f8bb
+1, 37168, 37168, 368, 736, 0x31c6ed1c
+0, 102, 102, 1, 192000, 0x8b14387c
+1, 37536, 37536, 368, 736, 0x7448a8d2
+0, 103, 103, 1, 192000, 0xdaeb9cb4
+1, 37904, 37904, 368, 736, 0x79a2ac09
+0, 104, 104, 1, 192000, 0xdc1d2f5b
+1, 38272, 38272, 368, 736, 0xbdbfa397
+0, 105, 105, 1, 192000, 0x4dcab167
+1, 38640, 38640, 368, 736, 0xa5deb8bb
+0, 106, 106, 1, 192000, 0x87fcf0d3
+1, 39008, 39008, 368, 736, 0x4565d179
+0, 107, 107, 1, 192000, 0x36d37542
+1, 39376, 39376, 368, 736, 0x64d89f91
+0, 108, 108, 1, 192000, 0x59ba49c5
+1, 39744, 39744, 368, 736, 0x32319f68
+0, 109, 109, 1, 192000, 0xf679b712
+1, 40112, 40112, 368, 736, 0x3efdc04f
diff --git a/gst-libs/ext/libav/tests/ref/fate/truemotion1-15 b/gst-libs/ext/libav/tests/ref/fate/truemotion1-15
index d9925c7..6b5281d 100644
--- a/gst-libs/ext/libav/tests/ref/fate/truemotion1-15
+++ b/gst-libs/ext/libav/tests/ref/fate/truemotion1-15
@@ -1,218 +1,106 @@
-0, 0, 161280, 0x7041748d
-1, 0, 10836, 0x2a531236
-1, 5529, 10836, 0xc58f45af
-0, 6000, 161280, 0x3cc4dfb5
-1, 11057, 10836, 0x436cf135
-0, 12000, 161280, 0xca3af22d
-1, 16586, 10836, 0x3a6022cc
-0, 18000, 161280, 0x23ad1d85
-1, 22114, 10836, 0x57e83a4a
-0, 24000, 161280, 0x9c9cf364
-1, 27643, 10836, 0xca4b3a1b
-0, 30000, 161280, 0x1551d6a8
-1, 33171, 10836, 0xc3da7536
-0, 36000, 161280, 0xc39f6b95
-1, 38700, 10836, 0x8c57d47b
-0, 42000, 161280, 0x3b036dcc
-1, 44229, 10836, 0x9a79572b
-0, 48000, 161280, 0xa6fac1db
-1, 49757, 10836, 0x7dbd6fd3
-0, 54000, 161280, 0x67656b62
-1, 55286, 10836, 0x4454fdde
-0, 60000, 161280, 0xb41f47d1
-1, 60814, 10836, 0x68aae686
-0, 66000, 161280, 0xc207249e
-1, 66343, 10836, 0x61f2df35
-1, 71871, 10836, 0xe36883c6
-0, 72000, 161280, 0xbee8f843
-1, 77400, 10836, 0xefa62217
-0, 78000, 161280, 0x092acf46
-1, 82929, 10836, 0x63b92479
-0, 84000, 161280, 0x8d9e2680
-1, 88457, 10836, 0xaf452579
-0, 90000, 161280, 0x8becc20c
-1, 93986, 10836, 0xdbb10001
-0, 96000, 161280, 0x655e444e
-1, 99514, 10836, 0xafb7f7a7
-0, 102000, 161280, 0x5c112da0
-1, 105043, 10836, 0xd4b1e591
-0, 108000, 161280, 0x232fa9eb
-1, 110571, 10836, 0x4d44b3bb
-0, 114000, 161280, 0x9721745d
-1, 116100, 10836, 0xff2ea5b3
-0, 120000, 161280, 0x92f1d880
-1, 121629, 10836, 0x214e88ad
-0, 126000, 161280, 0x16233978
-1, 127157, 10836, 0xde8bfc9a
-0, 132000, 161280, 0x19a27e69
-1, 132686, 10836, 0xb3cc4b6a
-0, 138000, 161280, 0x7b6ad73a
-1, 138214, 10836, 0x670bce40
-1, 143743, 10836, 0xc17d31b2
-0, 144000, 161280, 0xa7a674aa
-1, 149271, 10836, 0x7bcb9392
-0, 150000, 161280, 0x4e434abb
-1, 154800, 10836, 0x230e28c9
-0, 156000, 161280, 0xb96eea14
-1, 160329, 10836, 0x42df4204
-0, 162000, 161280, 0x1350188c
-1, 165857, 10836, 0xfa9134b9
-0, 168000, 161280, 0x79c6f305
-1, 171386, 10836, 0x418c1844
-0, 174000, 161280, 0xa9c7782d
-1, 176914, 10836, 0x93ba66b6
-0, 180000, 161280, 0x40a4f456
-1, 182443, 10836, 0x264a4ffa
-0, 186000, 161280, 0xaf291ed6
-1, 187971, 10836, 0x82c78a8e
-0, 192000, 161280, 0xab29b4e1
-1, 193500, 10836, 0x10d22fdc
-0, 198000, 161280, 0xbfcd2712
-1, 199029, 10836, 0x2d25906b
-0, 204000, 161280, 0xff22a0d7
-1, 204557, 10836, 0xa8a111fb
-0, 210000, 161280, 0xb0ae88a9
-1, 210086, 10836, 0xbd95df87
-1, 215614, 10836, 0x500ddec0
-0, 216000, 161280, 0x811d1259
-1, 221143, 10836, 0x95d9350b
-0, 222000, 161280, 0x593c39a1
-1, 226671, 10836, 0xfa54ea1f
-0, 228000, 161280, 0x5a5a97f8
-1, 232200, 10836, 0x51b2467e
-0, 234000, 161280, 0xa5639ecf
-1, 237729, 10836, 0x5d772af9
-0, 240000, 161280, 0x543920c6
-1, 243257, 10836, 0xae25dd8d
-0, 246000, 161280, 0xb41689ee
-1, 248786, 10836, 0xe4bd0cb0
-0, 252000, 161280, 0xc0ad83de
-1, 254314, 10836, 0xb33544f0
-0, 258000, 161280, 0x9e9e7456
-1, 259843, 10836, 0xd5658b12
-0, 264000, 161280, 0x777ccbfe
-1, 265371, 10836, 0xeff66e5d
-0, 270000, 161280, 0x9c2df916
-1, 270900, 10836, 0xb1fff6c5
-0, 276000, 161280, 0xe0c13b35
-1, 276429, 10836, 0x84db56b5
-1, 281957, 10836, 0x0230e3c9
-0, 282000, 161280, 0x39bfa5a5
-1, 287486, 10836, 0xe58a7faf
-0, 288000, 161280, 0x35dfb264
-1, 293014, 10836, 0xc4003e2a
-0, 294000, 161280, 0x43018613
-1, 298543, 10836, 0x6360cbbf
-0, 300000, 161280, 0x43584b8a
-1, 304071, 10836, 0xc29c2a05
-0, 306000, 161280, 0xa5cd230a
-1, 309600, 10836, 0xb294dd11
-0, 312000, 161280, 0x6fe2cfb3
-1, 315129, 10836, 0x4388b43b
-0, 318000, 161280, 0x88a7c0db
-1, 320657, 10836, 0xdd7be367
-0, 324000, 161280, 0x476f1cd2
-1, 326186, 10836, 0xb9f612a9
-0, 330000, 161280, 0x96401d49
-1, 331714, 10836, 0xb64a39fe
-0, 336000, 161280, 0x7d932919
-1, 337243, 10836, 0x6eba6594
-0, 342000, 161280, 0x06465481
-1, 342771, 10836, 0xb4af35c1
-0, 348000, 161280, 0x39631520
-1, 348300, 10836, 0x4e581c49
-1, 353829, 10836, 0xb062a19f
-0, 354000, 161280, 0xc3fff780
-1, 359357, 10836, 0x87cd6135
-0, 360000, 161280, 0xa81faf28
-1, 364886, 10836, 0x37bffbd6
-0, 366000, 161280, 0x7a311f4f
-1, 370414, 10836, 0x6c797900
-0, 372000, 161280, 0x52f9b931
-1, 375943, 10836, 0x1615df36
-0, 378000, 161280, 0x938cf016
-1, 381471, 10836, 0xb472d9e9
-0, 384000, 161280, 0xf8f6e19c
-1, 387000, 10836, 0xdfff626e
-0, 390000, 161280, 0xca90561b
-1, 392529, 10836, 0xffa6d771
-0, 396000, 161280, 0x8594d06b
-1, 398057, 10836, 0xa7f3cf96
-0, 402000, 161280, 0xea32bf3b
-1, 403586, 10836, 0xf556b50a
-0, 408000, 161280, 0x4646111a
-1, 409114, 10836, 0x99b86b39
-0, 414000, 161280, 0xee891162
-1, 414643, 10836, 0x886920d3
-0, 420000, 161280, 0xcfc32082
-1, 420171, 10836, 0xefb0305a
-1, 425700, 10836, 0x4ab7aa32
-0, 426000, 161280, 0x863c281a
-1, 431229, 10836, 0x7f106530
-0, 432000, 161280, 0x01b591aa
-1, 436757, 10836, 0x6461559a
-0, 438000, 161280, 0x211fbc62
-1, 442286, 10836, 0x25e3b12b
-0, 444000, 161280, 0xae2bafe2
-1, 447814, 10836, 0x32cfa3ba
-0, 450000, 161280, 0xcfe46dca
-1, 453343, 10836, 0x0bff78a4
-0, 456000, 161280, 0xcf8fe8a3
-1, 458871, 10836, 0xe4323d53
-0, 462000, 161280, 0x3f8474eb
-1, 464400, 10836, 0x70b35196
-0, 468000, 161280, 0x06da345a
-1, 469929, 10836, 0xf2b8b07f
-0, 474000, 161280, 0xbd4d3280
-1, 475457, 10836, 0x826cc972
-0, 480000, 161280, 0xb5e70fea
-1, 480986, 10836, 0x8a0fdce8
-0, 486000, 161280, 0x0c99c804
-1, 486514, 10836, 0xa072a503
-0, 492000, 161280, 0x19841ed4
-1, 492043, 10836, 0xd698d8e7
-1, 497571, 10836, 0xfe80e794
-0, 498000, 161280, 0xf81dea50
-1, 503100, 10836, 0xdd580a5a
-0, 504000, 161280, 0x7777d81c
-1, 508629, 10836, 0x121bc1bb
-0, 510000, 161280, 0x0497cfd8
-1, 514157, 10836, 0x8cebd7d9
-0, 516000, 161280, 0x50b6eb64
-1, 519686, 10836, 0x6eaef4d7
-0, 522000, 161280, 0x5071fc07
-1, 525214, 10836, 0x8f0b5d0b
-0, 528000, 161280, 0xbb7527fb
-1, 530743, 10836, 0x40ccf61f
-0, 534000, 161280, 0x13054f1f
-1, 536271, 10836, 0xb6db5f1d
-0, 540000, 161280, 0x4b78fb27
-1, 541800, 10836, 0xa089f250
-0, 546000, 161280, 0xf504968f
-1, 547329, 10836, 0xd3512f2b
-0, 552000, 161280, 0x555b10b7
-1, 552857, 10836, 0xfa127f74
-0, 558000, 161280, 0xcc0dde40
-1, 558386, 10836, 0xd6a60ead
-1, 563914, 10836, 0x00000000
-0, 564000, 161280, 0xcc0dde40
-1, 569443, 10836, 0x00000000
-0, 570000, 161280, 0x367f60c8
-1, 574971, 10836, 0x00000000
-0, 576000, 161280, 0x367f60c8
-1, 580500, 10836, 0x00000000
-0, 582000, 161280, 0x367f60c8
-1, 586029, 10836, 0x00000000
-0, 588000, 161280, 0x367f60c8
-1, 591557, 10836, 0x00000000
-0, 594000, 161280, 0x367f60c8
-1, 597086, 10836, 0x00000000
-0, 600000, 161280, 0x367f60c8
-1, 602614, 10836, 0x00000000
-0, 606000, 161280, 0x367f60c8
-1, 608143, 10836, 0x00000000
-0, 612000, 161280, 0x367f60c8
-1, 613671, 10836, 0x00000000
-0, 618000, 161280, 0x367f60c8
-1, 619200, 10836, 0x00000000
-0, 624000, 161280, 0x367f60c8
+#tb 0: 1/15
+0, 0, 0, 1, 161280, 0x7041748d
+0, 1, 1, 1, 161280, 0x3cc4dfb5
+0, 2, 2, 1, 161280, 0xca3af22d
+0, 3, 3, 1, 161280, 0x23ad1d85
+0, 4, 4, 1, 161280, 0x9c9cf364
+0, 5, 5, 1, 161280, 0x1551d6a8
+0, 6, 6, 1, 161280, 0xc39f6b95
+0, 7, 7, 1, 161280, 0x3b036dcc
+0, 8, 8, 1, 161280, 0xa6fac1db
+0, 9, 9, 1, 161280, 0x67656b62
+0, 10, 10, 1, 161280, 0xb41f47d1
+0, 11, 11, 1, 161280, 0xc207249e
+0, 12, 12, 1, 161280, 0xbee8f843
+0, 13, 13, 1, 161280, 0x092acf46
+0, 14, 14, 1, 161280, 0x8d9e2680
+0, 15, 15, 1, 161280, 0x8becc20c
+0, 16, 16, 1, 161280, 0x655e444e
+0, 17, 17, 1, 161280, 0x5c112da0
+0, 18, 18, 1, 161280, 0x232fa9eb
+0, 19, 19, 1, 161280, 0x9721745d
+0, 20, 20, 1, 161280, 0x92f1d880
+0, 21, 21, 1, 161280, 0x16233978
+0, 22, 22, 1, 161280, 0x19a27e69
+0, 23, 23, 1, 161280, 0x7b6ad73a
+0, 24, 24, 1, 161280, 0xa7a674aa
+0, 25, 25, 1, 161280, 0x4e434abb
+0, 26, 26, 1, 161280, 0xb96eea14
+0, 27, 27, 1, 161280, 0x1350188c
+0, 28, 28, 1, 161280, 0x79c6f305
+0, 29, 29, 1, 161280, 0xa9c7782d
+0, 30, 30, 1, 161280, 0x40a4f456
+0, 31, 31, 1, 161280, 0xaf291ed6
+0, 32, 32, 1, 161280, 0xab29b4e1
+0, 33, 33, 1, 161280, 0xbfcd2712
+0, 34, 34, 1, 161280, 0xff22a0d7
+0, 35, 35, 1, 161280, 0xb0ae88a9
+0, 36, 36, 1, 161280, 0x811d1259
+0, 37, 37, 1, 161280, 0x593c39a1
+0, 38, 38, 1, 161280, 0x5a5a97f8
+0, 39, 39, 1, 161280, 0xa5639ecf
+0, 40, 40, 1, 161280, 0x543920c6
+0, 41, 41, 1, 161280, 0xb41689ee
+0, 42, 42, 1, 161280, 0xc0ad83de
+0, 43, 43, 1, 161280, 0x9e9e7456
+0, 44, 44, 1, 161280, 0x777ccbfe
+0, 45, 45, 1, 161280, 0x9c2df916
+0, 46, 46, 1, 161280, 0xe0c13b35
+0, 47, 47, 1, 161280, 0x39bfa5a5
+0, 48, 48, 1, 161280, 0x35dfb264
+0, 49, 49, 1, 161280, 0x43018613
+0, 50, 50, 1, 161280, 0x43584b8a
+0, 51, 51, 1, 161280, 0xa5cd230a
+0, 52, 52, 1, 161280, 0x6fe2cfb3
+0, 53, 53, 1, 161280, 0x88a7c0db
+0, 54, 54, 1, 161280, 0x476f1cd2
+0, 55, 55, 1, 161280, 0x96401d49
+0, 56, 56, 1, 161280, 0x7d932919
+0, 57, 57, 1, 161280, 0x06465481
+0, 58, 58, 1, 161280, 0x39631520
+0, 59, 59, 1, 161280, 0xc3fff780
+0, 60, 60, 1, 161280, 0xa81faf28
+0, 61, 61, 1, 161280, 0x7a311f4f
+0, 62, 62, 1, 161280, 0x52f9b931
+0, 63, 63, 1, 161280, 0x938cf016
+0, 64, 64, 1, 161280, 0xf8f6e19c
+0, 65, 65, 1, 161280, 0xca90561b
+0, 66, 66, 1, 161280, 0x8594d06b
+0, 67, 67, 1, 161280, 0xea32bf3b
+0, 68, 68, 1, 161280, 0x4646111a
+0, 69, 69, 1, 161280, 0xee891162
+0, 70, 70, 1, 161280, 0xcfc32082
+0, 71, 71, 1, 161280, 0x863c281a
+0, 72, 72, 1, 161280, 0x01b591aa
+0, 73, 73, 1, 161280, 0x211fbc62
+0, 74, 74, 1, 161280, 0xae2bafe2
+0, 75, 75, 1, 161280, 0xcfe46dca
+0, 76, 76, 1, 161280, 0xcf8fe8a3
+0, 77, 77, 1, 161280, 0x3f8474eb
+0, 78, 78, 1, 161280, 0x06da345a
+0, 79, 79, 1, 161280, 0xbd4d3280
+0, 80, 80, 1, 161280, 0xb5e70fea
+0, 81, 81, 1, 161280, 0x0c99c804
+0, 82, 82, 1, 161280, 0x19841ed4
+0, 83, 83, 1, 161280, 0xf81dea50
+0, 84, 84, 1, 161280, 0x7777d81c
+0, 85, 85, 1, 161280, 0x0497cfd8
+0, 86, 86, 1, 161280, 0x50b6eb64
+0, 87, 87, 1, 161280, 0x5071fc07
+0, 88, 88, 1, 161280, 0xbb7527fb
+0, 89, 89, 1, 161280, 0x13054f1f
+0, 90, 90, 1, 161280, 0x4b78fb27
+0, 91, 91, 1, 161280, 0xf504968f
+0, 92, 92, 1, 161280, 0x555b10b7
+0, 93, 93, 1, 161280, 0xcc0dde40
+0, 94, 94, 1, 161280, 0xcc0dde40
+0, 95, 95, 1, 161280, 0x367f60c8
+0, 96, 96, 1, 161280, 0x367f60c8
+0, 97, 97, 1, 161280, 0x367f60c8
+0, 98, 98, 1, 161280, 0x367f60c8
+0, 99, 99, 1, 161280, 0x367f60c8
+0, 100, 100, 1, 161280, 0x367f60c8
+0, 101, 101, 1, 161280, 0x367f60c8
+0, 102, 102, 1, 161280, 0x367f60c8
+0, 103, 103, 1, 161280, 0x367f60c8
+0, 104, 104, 1, 161280, 0x367f60c8
diff --git a/gst-libs/ext/libav/tests/ref/fate/truemotion1-24 b/gst-libs/ext/libav/tests/ref/fate/truemotion1-24
index 054f6b3..f097ed0 100644
--- a/gst-libs/ext/libav/tests/ref/fate/truemotion1-24
+++ b/gst-libs/ext/libav/tests/ref/fate/truemotion1-24
@@ -1,43 +1,16 @@
-0, 0, 69120, 0x68beb30f
-1, 0, 10836, 0xedecb6a7
-1, 5529, 10836, 0x8098a323
-0, 6000, 69120, 0x3976f5cf
-1, 11057, 10836, 0xcfa1112e
-0, 12000, 69120, 0xf815bc3c
-1, 16586, 10836, 0xe241ede4
-0, 18000, 69120, 0xa7cc0ae6
-1, 22114, 10836, 0xddf254bb
-0, 24000, 69120, 0xd85ac282
-1, 27643, 10836, 0xa16c8507
-0, 30000, 69120, 0xf7fd7edb
-1, 33171, 10836, 0xbe211f93
-0, 36000, 69120, 0x433bb6f6
-1, 38700, 10836, 0x26c7283d
-0, 42000, 69120, 0xdbac8bee
-1, 44229, 10836, 0x4d18be56
-0, 48000, 69120, 0x88e2a799
-1, 49757, 10836, 0x57b9af6f
-0, 54000, 69120, 0x49617b26
-1, 55286, 10836, 0xd5864280
-0, 60000, 69120, 0xeb44ca01
-1, 60814, 10836, 0xd582b451
-0, 66000, 69120, 0x6fea37e8
-1, 66343, 10836, 0xec13731d
-1, 71871, 10836, 0xe3d4fbb8
-0, 72000, 69120, 0xf55d74c7
-1, 77400, 10836, 0xcbb54d18
-0, 78000, 69120, 0xb5082ca7
-1, 82929, 10836, 0xff7e7133
-0, 84000, 69120, 0x5876d758
-1, 88457, 10836, 0xcc28b1a7
-1, 93986, 10836, 0xbf9e07a5
-1, 99514, 10836, 0x16408f38
-1, 105043, 10836, 0x2b000c9f
-1, 110571, 10836, 0x0ccd9811
-1, 116100, 10836, 0xf9575d48
-1, 121629, 10836, 0x1ee68190
-1, 127157, 10836, 0xde435373
-1, 132686, 10836, 0xd83be17a
-1, 138214, 10836, 0x9a7f0bbe
-1, 143743, 10836, 0x8709e4d3
-1, 149271, 10836, 0xde1879cb
+#tb 0: 1/15
+0, 0, 0, 1, 69120, 0x68beb30f
+0, 1, 1, 1, 69120, 0x3976f5cf
+0, 2, 2, 1, 69120, 0xf815bc3c
+0, 3, 3, 1, 69120, 0xa7cc0ae6
+0, 4, 4, 1, 69120, 0xd85ac282
+0, 5, 5, 1, 69120, 0xf7fd7edb
+0, 6, 6, 1, 69120, 0x433bb6f6
+0, 7, 7, 1, 69120, 0xdbac8bee
+0, 8, 8, 1, 69120, 0x88e2a799
+0, 9, 9, 1, 69120, 0x49617b26
+0, 10, 10, 1, 69120, 0xeb44ca01
+0, 11, 11, 1, 69120, 0x6fea37e8
+0, 12, 12, 1, 69120, 0xf55d74c7
+0, 13, 13, 1, 69120, 0xb5082ca7
+0, 14, 14, 1, 69120, 0x5876d758
diff --git a/gst-libs/ext/libav/tests/ref/fate/truemotion2 b/gst-libs/ext/libav/tests/ref/fate/truemotion2
index e7c4ee4..c263ba4 100644
--- a/gst-libs/ext/libav/tests/ref/fate/truemotion2
+++ b/gst-libs/ext/libav/tests/ref/fate/truemotion2
@@ -1,30 +1,31 @@
-0, 0, 230400, 0x135cb509
-0, 6000, 230400, 0x919a1ab7
-0, 12000, 230400, 0x0af8722b
-0, 18000, 230400, 0xc9616809
-0, 24000, 230400, 0xe16ecaf7
-0, 30000, 230400, 0xa86f8d1b
-0, 36000, 230400, 0xd351b5a4
-0, 42000, 230400, 0xd112b5b7
-0, 48000, 230400, 0xc9c3c9b1
-0, 54000, 230400, 0x4f91e572
-0, 60000, 230400, 0xb1d8c4d3
-0, 66000, 230400, 0x34de10c1
-0, 72000, 230400, 0xbd4f3b29
-0, 78000, 230400, 0xfeaf1477
-0, 84000, 230400, 0x718ffa17
-0, 90000, 230400, 0x23b46ef3
-0, 96000, 230400, 0x6346d9b8
-0, 102000, 230400, 0xdb66bf57
-0, 108000, 230400, 0xeb74a2ff
-0, 114000, 230400, 0xe0750470
-0, 120000, 230400, 0x645eb109
-0, 126000, 230400, 0xbb96489a
-0, 132000, 230400, 0x58a70e35
-0, 138000, 230400, 0xc7563441
-0, 144000, 230400, 0x6098f07e
-0, 150000, 230400, 0x579ece15
-0, 156000, 230400, 0xe1ca8d03
-0, 162000, 230400, 0x8928cf34
-0, 168000, 230400, 0xf621620e
-0, 174000, 230400, 0x98a344ea
+#tb 0: 1/15
+0, 0, 0, 1, 230400, 0x135cb509
+0, 1, 1, 1, 230400, 0x919a1ab7
+0, 2, 2, 1, 230400, 0x0af8722b
+0, 3, 3, 1, 230400, 0xc9616809
+0, 4, 4, 1, 230400, 0xe16ecaf7
+0, 5, 5, 1, 230400, 0xa86f8d1b
+0, 6, 6, 1, 230400, 0xd351b5a4
+0, 7, 7, 1, 230400, 0xd112b5b7
+0, 8, 8, 1, 230400, 0xc9c3c9b1
+0, 9, 9, 1, 230400, 0x4f91e572
+0, 10, 10, 1, 230400, 0xb1d8c4d3
+0, 11, 11, 1, 230400, 0x34de10c1
+0, 12, 12, 1, 230400, 0xbd4f3b29
+0, 13, 13, 1, 230400, 0xfeaf1477
+0, 14, 14, 1, 230400, 0x718ffa17
+0, 15, 15, 1, 230400, 0x23b46ef3
+0, 16, 16, 1, 230400, 0x6346d9b8
+0, 17, 17, 1, 230400, 0xdb66bf57
+0, 18, 18, 1, 230400, 0xeb74a2ff
+0, 19, 19, 1, 230400, 0xe0750470
+0, 20, 20, 1, 230400, 0x645eb109
+0, 21, 21, 1, 230400, 0xbb96489a
+0, 22, 22, 1, 230400, 0x58a70e35
+0, 23, 23, 1, 230400, 0xc7563441
+0, 24, 24, 1, 230400, 0x6098f07e
+0, 25, 25, 1, 230400, 0x579ece15
+0, 26, 26, 1, 230400, 0xe1ca8d03
+0, 27, 27, 1, 230400, 0x8928cf34
+0, 28, 28, 1, 230400, 0xf621620e
+0, 29, 29, 1, 230400, 0x98a344ea
diff --git a/gst-libs/ext/libav/tests/ref/fate/tscc-15bit b/gst-libs/ext/libav/tests/ref/fate/tscc-15bit
index bc55f0f..372b165 100644
--- a/gst-libs/ext/libav/tests/ref/fate/tscc-15bit
+++ b/gst-libs/ext/libav/tests/ref/fate/tscc-15bit
@@ -1,240 +1,242 @@
-0, 0, 657600, 0xaf456809
-1, 0, 22050, 0x1740aaec
-0, 6000, 657600, 0xaf456809
-0, 12000, 657600, 0xaf456809
-0, 18000, 657600, 0x2dbe6889
-0, 24000, 657600, 0x2dbe6889
-0, 30000, 657600, 0x2dbe6889
-0, 36000, 657600, 0x2dbe6889
-0, 42000, 657600, 0x2dbe6889
-0, 48000, 657600, 0x2dbe6889
-0, 54000, 657600, 0x2dbe6889
-0, 60000, 657600, 0x2dbe6889
-0, 66000, 657600, 0x2dbe6889
-0, 72000, 657600, 0x2dbe6889
-0, 78000, 657600, 0x2dbe6889
-0, 84000, 657600, 0x2dbe6889
-0, 90000, 657600, 0x2dbe6889
-1, 90000, 22050, 0x75ed6086
-0, 96000, 657600, 0x2dbe6889
-0, 102000, 657600, 0x2dbe6889
-0, 108000, 657600, 0x2dbe6889
-0, 114000, 657600, 0x2dbe6889
-0, 120000, 657600, 0x2dbe6889
-0, 126000, 657600, 0x92796e59
-0, 132000, 657600, 0x92796e59
-0, 138000, 657600, 0x92796e59
-0, 144000, 657600, 0x64cb6889
-0, 150000, 657600, 0x64cb6889
-0, 156000, 657600, 0x64cb6889
-0, 162000, 657600, 0x64cb6889
-0, 168000, 657600, 0x64cb6889
-0, 174000, 657600, 0x64cb6889
-0, 180000, 657600, 0x42036b71
-1, 180000, 22050, 0xca52a4e9
-0, 186000, 657600, 0x42036b71
-0, 192000, 657600, 0x42036b71
-0, 198000, 657600, 0xc40a6889
-0, 204000, 657600, 0xc40a6889
-0, 210000, 657600, 0xc40a6889
-0, 216000, 657600, 0xaa6f7429
-0, 222000, 657600, 0xaa6f7429
-0, 228000, 657600, 0xaa6f7429
-0, 234000, 657600, 0x854172d9
-0, 240000, 657600, 0x854172d9
-0, 246000, 657600, 0x854172d9
-0, 252000, 657600, 0x22d10de0
-0, 258000, 657600, 0xa75f0d60
-0, 264000, 657600, 0x7a440be0
-0, 270000, 657600, 0x40095d50
-1, 270000, 22050, 0xb306d419
-0, 276000, 657600, 0x40095d50
-0, 282000, 657600, 0x64766320
-0, 288000, 657600, 0x64766320
-0, 294000, 657600, 0x64766320
-0, 300000, 657600, 0x64766320
-0, 306000, 657600, 0x64766320
-0, 312000, 657600, 0x64766320
-0, 318000, 657600, 0x64766320
-0, 324000, 657600, 0x64766320
-0, 330000, 657600, 0x64766320
-0, 336000, 657600, 0x64766320
-0, 342000, 657600, 0xf51adc49
-0, 348000, 657600, 0xf51adc49
-0, 354000, 657600, 0xf51adc49
-0, 360000, 657600, 0xdd47af59
-1, 360000, 22050, 0x8cbb9625
-0, 366000, 657600, 0xdd47af59
-0, 372000, 657600, 0xffa8acf1
-0, 378000, 657600, 0x5994b059
-0, 384000, 657600, 0x5994b059
-0, 390000, 657600, 0x5994b059
-0, 396000, 657600, 0x03ffae71
-0, 402000, 657600, 0x03ffae71
-0, 408000, 657600, 0x03ffae71
-0, 414000, 657600, 0xe33ab89e
-0, 420000, 657600, 0xe33ab89e
-0, 426000, 657600, 0xe33ab89e
-0, 432000, 657600, 0xbe37b549
-0, 438000, 657600, 0xbe37b549
-0, 444000, 657600, 0x1d395bf9
-0, 450000, 657600, 0x1d395bf9
-1, 450000, 22050, 0x34a11f66
-0, 456000, 657600, 0x1d395bf9
-0, 462000, 657600, 0x1d395bf9
-0, 468000, 657600, 0x2ec36f37
-0, 474000, 657600, 0x2ec36f37
-0, 480000, 657600, 0xb04a6eb7
-0, 486000, 657600, 0x66610458
-0, 492000, 657600, 0x66610458
-0, 498000, 657600, 0xaf8901f0
-0, 504000, 657600, 0x3ae41c48
-0, 510000, 657600, 0x5b870b70
-0, 516000, 657600, 0x11490c60
-0, 522000, 657600, 0x70064801
-0, 528000, 657600, 0x80d54519
-0, 534000, 657600, 0xe8c942b1
-0, 540000, 657600, 0x830d8c24
-1, 540000, 22050, 0x1ae81230
-0, 546000, 657600, 0x830d8c24
-0, 552000, 657600, 0x830d8c24
-0, 558000, 657600, 0xf3c4707c
-0, 564000, 657600, 0x6ace707c
-0, 570000, 657600, 0x6ace707c
-0, 576000, 657600, 0x6ace707c
-0, 582000, 657600, 0x6ace707c
-0, 588000, 657600, 0x6ace707c
-0, 594000, 657600, 0x5f461aae
-0, 600000, 657600, 0x5f461aae
-0, 606000, 657600, 0x221ceecf
-0, 612000, 657600, 0x221ceecf
-0, 618000, 657600, 0x221ceecf
-0, 624000, 657600, 0x221ceecf
-0, 630000, 657600, 0x221ceecf
-1, 630000, 22050, 0x1217eeba
-0, 636000, 657600, 0x221ceecf
-0, 642000, 657600, 0x221ceecf
-0, 648000, 657600, 0x3bf6f39f
-0, 654000, 657600, 0x3bf6f39f
-0, 660000, 657600, 0x3bf6f39f
-0, 666000, 657600, 0xc2caeecf
-0, 672000, 657600, 0xc2caeecf
-0, 678000, 657600, 0xc2caeecf
-0, 684000, 657600, 0xc316d63e
-0, 690000, 657600, 0xc316d63e
-0, 696000, 657600, 0xc316d63e
-0, 702000, 657600, 0x41f6218d
-0, 708000, 657600, 0x41f6218d
-0, 714000, 657600, 0x41f6218d
-0, 720000, 657600, 0xff43ec36
-1, 720000, 22050, 0x50e70baa
-0, 726000, 657600, 0x0b10eb16
-0, 732000, 657600, 0x0b10eb16
-0, 738000, 657600, 0xbdf41aa5
-0, 744000, 657600, 0xbdf41aa5
-0, 750000, 657600, 0xbdf41aa5
-0, 756000, 657600, 0xd502ca06
-0, 762000, 657600, 0xd502ca06
-0, 768000, 657600, 0xd502ca06
-0, 774000, 657600, 0x8446f89e
-0, 780000, 657600, 0x8446f89e
-0, 786000, 657600, 0x8446f89e
-0, 792000, 657600, 0x3d4ccf06
-0, 798000, 657600, 0x0897d1de
-0, 804000, 657600, 0x0897d1de
-0, 810000, 657600, 0x3e27e01e
-1, 810000, 22050, 0xb19e89c0
-0, 816000, 657600, 0x3e27e01e
-0, 822000, 657600, 0x3e27e01e
-0, 828000, 657600, 0x3e27e01e
-0, 834000, 657600, 0x3e27e01e
-0, 840000, 657600, 0x3e27e01e
-0, 846000, 657600, 0xe51078a8
-0, 852000, 657600, 0xe51078a8
-0, 858000, 657600, 0xe9967a40
-0, 864000, 657600, 0xe9967a40
-0, 870000, 657600, 0xe9967a40
-0, 876000, 657600, 0xe9967a40
-0, 882000, 657600, 0xe9967a40
-0, 888000, 657600, 0xe9967a40
-0, 894000, 657600, 0xe9967a40
-0, 900000, 657600, 0x726cb6b8
-1, 900000, 22050, 0x78526696
-0, 906000, 657600, 0x2960b6e8
-0, 912000, 657600, 0x2960b6e8
-0, 918000, 657600, 0x1637d6c8
-0, 924000, 657600, 0x6f2fd9b0
-0, 930000, 657600, 0x27a7d6c8
-0, 936000, 657600, 0xe855d6c8
-0, 942000, 657600, 0xe855d6c8
-0, 948000, 657600, 0xe855d6c8
-0, 954000, 657600, 0x1a8ad6c8
-0, 960000, 657600, 0x9c11d648
-0, 966000, 657600, 0x6136d648
-0, 972000, 657600, 0xdfa0d6c8
-0, 978000, 657600, 0xdfa0d6c8
-0, 984000, 657600, 0xdfa0d6c8
-0, 990000, 657600, 0xdfa0d6c8
-1, 990000, 22050, 0x48e3bb21
-0, 996000, 657600, 0xdfa0d6c8
-0, 1002000, 657600, 0xdfa0d6c8
-0, 1008000, 657600, 0xdfa0d6c8
-0, 1014000, 657600, 0xdfa0d6c8
-0, 1020000, 657600, 0xdfa0d6c8
-0, 1026000, 657600, 0x125cd9b0
-0, 1032000, 657600, 0x125cd9b0
-0, 1038000, 657600, 0x8a7ed6c8
-0, 1044000, 657600, 0x09a6d9b0
-0, 1050000, 657600, 0x09a6d9b0
-0, 1056000, 657600, 0x09a6d9b0
-0, 1062000, 657600, 0x85e87a68
-0, 1068000, 657600, 0x85e87a68
-0, 1074000, 657600, 0x85e87a68
-0, 1080000, 657600, 0xb0a141a8
-1, 1080000, 22050, 0xbc32204a
-0, 1086000, 657600, 0xb0a141a8
-0, 1092000, 657600, 0xf3333bd8
-0, 1098000, 657600, 0xea090688
-0, 1104000, 657600, 0xa017fe41
-0, 1110000, 657600, 0xa017fe41
-0, 1116000, 657600, 0x32e93bd8
-0, 1122000, 657600, 0x7fe640c0
-0, 1128000, 657600, 0x7fe640c0
-0, 1134000, 657600, 0xcd8995b2
-0, 1140000, 657600, 0x84278a92
-0, 1146000, 657600, 0x84278a92
-0, 1152000, 657600, 0xf1d2874a
-0, 1158000, 657600, 0xf1d2874a
-0, 1164000, 657600, 0xf1d2874a
-0, 1170000, 657600, 0xa58d6742
-1, 1170000, 22050, 0xdf6f1e46
-0, 1176000, 657600, 0xa58d6742
-0, 1182000, 657600, 0xa58d6742
-0, 1188000, 657600, 0xb0cd11bb
-0, 1194000, 657600, 0xb0cd11bb
-0, 1200000, 657600, 0xc55610bb
-0, 1206000, 657600, 0x4ee1168b
-0, 1212000, 657600, 0x61c513a3
-0, 1218000, 657600, 0xd26410bb
-0, 1224000, 657600, 0xe7c410bb
-0, 1230000, 657600, 0x444a0dd3
-0, 1236000, 657600, 0x444a0dd3
-0, 1242000, 657600, 0x97ac10bb
-0, 1248000, 657600, 0x97ac10bb
-0, 1254000, 657600, 0xe8b30dd3
-0, 1260000, 657600, 0x3d0c10bb
-1, 1260000, 22050, 0x4c91da9d
-0, 1266000, 657600, 0x8d2b0dd3
-0, 1272000, 657600, 0x8d2b0dd3
-0, 1278000, 657600, 0xa5760dd3
-0, 1284000, 657600, 0xa5760dd3
-0, 1290000, 657600, 0xa5760dd3
-0, 1296000, 657600, 0x31a30dd3
-0, 1302000, 657600, 0x31a30dd3
-0, 1308000, 657600, 0x31a30dd3
-0, 1314000, 657600, 0x31a30dd3
-0, 1320000, 657600, 0x31a30dd3
-0, 1326000, 657600, 0x31a30dd3
-0, 1332000, 657600, 0x31a30dd3
-0, 1338000, 657600, 0x31a30dd3
-0, 1344000, 657600, 0x31a30dd3
+#tb 0: 1/15
+#tb 1: 1/11025
+0, 0, 0, 1, 657600, 0xaf456809
+1, 0, 0, 11025, 22050, 0x1740aaec
+0, 1, 1, 1, 657600, 0xaf456809
+0, 2, 2, 1, 657600, 0xaf456809
+0, 3, 3, 1, 657600, 0x2dbe6889
+0, 4, 4, 1, 657600, 0x2dbe6889
+0, 5, 5, 1, 657600, 0x2dbe6889
+0, 6, 6, 1, 657600, 0x2dbe6889
+0, 7, 7, 1, 657600, 0x2dbe6889
+0, 8, 8, 1, 657600, 0x2dbe6889
+0, 9, 9, 1, 657600, 0x2dbe6889
+0, 10, 10, 1, 657600, 0x2dbe6889
+0, 11, 11, 1, 657600, 0x2dbe6889
+0, 12, 12, 1, 657600, 0x2dbe6889
+0, 13, 13, 1, 657600, 0x2dbe6889
+0, 14, 14, 1, 657600, 0x2dbe6889
+0, 15, 15, 1, 657600, 0x2dbe6889
+1, 11025, 11025, 11025, 22050, 0x75ed6086
+0, 16, 16, 1, 657600, 0x2dbe6889
+0, 17, 17, 1, 657600, 0x2dbe6889
+0, 18, 18, 1, 657600, 0x2dbe6889
+0, 19, 19, 1, 657600, 0x2dbe6889
+0, 20, 20, 1, 657600, 0x2dbe6889
+0, 21, 21, 1, 657600, 0x92796e59
+0, 22, 22, 1, 657600, 0x92796e59
+0, 23, 23, 1, 657600, 0x92796e59
+0, 24, 24, 1, 657600, 0x64cb6889
+0, 25, 25, 1, 657600, 0x64cb6889
+0, 26, 26, 1, 657600, 0x64cb6889
+0, 27, 27, 1, 657600, 0x64cb6889
+0, 28, 28, 1, 657600, 0x64cb6889
+0, 29, 29, 1, 657600, 0x64cb6889
+0, 30, 30, 1, 657600, 0x42036b71
+1, 22050, 22050, 11025, 22050, 0xca52a4e9
+0, 31, 31, 1, 657600, 0x42036b71
+0, 32, 32, 1, 657600, 0x42036b71
+0, 33, 33, 1, 657600, 0xc40a6889
+0, 34, 34, 1, 657600, 0xc40a6889
+0, 35, 35, 1, 657600, 0xc40a6889
+0, 36, 36, 1, 657600, 0xaa6f7429
+0, 37, 37, 1, 657600, 0xaa6f7429
+0, 38, 38, 1, 657600, 0xaa6f7429
+0, 39, 39, 1, 657600, 0x854172d9
+0, 40, 40, 1, 657600, 0x854172d9
+0, 41, 41, 1, 657600, 0x854172d9
+0, 42, 42, 1, 657600, 0x22d10de0
+0, 43, 43, 1, 657600, 0xa75f0d60
+0, 44, 44, 1, 657600, 0x7a440be0
+0, 45, 45, 1, 657600, 0x40095d50
+1, 33075, 33075, 11025, 22050, 0xb306d419
+0, 46, 46, 1, 657600, 0x40095d50
+0, 47, 47, 1, 657600, 0x64766320
+0, 48, 48, 1, 657600, 0x64766320
+0, 49, 49, 1, 657600, 0x64766320
+0, 50, 50, 1, 657600, 0x64766320
+0, 51, 51, 1, 657600, 0x64766320
+0, 52, 52, 1, 657600, 0x64766320
+0, 53, 53, 1, 657600, 0x64766320
+0, 54, 54, 1, 657600, 0x64766320
+0, 55, 55, 1, 657600, 0x64766320
+0, 56, 56, 1, 657600, 0x64766320
+0, 57, 57, 1, 657600, 0xf51adc49
+0, 58, 58, 1, 657600, 0xf51adc49
+0, 59, 59, 1, 657600, 0xf51adc49
+0, 60, 60, 1, 657600, 0xdd47af59
+1, 44100, 44100, 11025, 22050, 0x8cbb9625
+0, 61, 61, 1, 657600, 0xdd47af59
+0, 62, 62, 1, 657600, 0xffa8acf1
+0, 63, 63, 1, 657600, 0x5994b059
+0, 64, 64, 1, 657600, 0x5994b059
+0, 65, 65, 1, 657600, 0x5994b059
+0, 66, 66, 1, 657600, 0x03ffae71
+0, 67, 67, 1, 657600, 0x03ffae71
+0, 68, 68, 1, 657600, 0x03ffae71
+0, 69, 69, 1, 657600, 0xe33ab89e
+0, 70, 70, 1, 657600, 0xe33ab89e
+0, 71, 71, 1, 657600, 0xe33ab89e
+0, 72, 72, 1, 657600, 0xbe37b549
+0, 73, 73, 1, 657600, 0xbe37b549
+0, 74, 74, 1, 657600, 0x1d395bf9
+0, 75, 75, 1, 657600, 0x1d395bf9
+1, 55125, 55125, 11025, 22050, 0x34a11f66
+0, 76, 76, 1, 657600, 0x1d395bf9
+0, 77, 77, 1, 657600, 0x1d395bf9
+0, 78, 78, 1, 657600, 0x2ec36f37
+0, 79, 79, 1, 657600, 0x2ec36f37
+0, 80, 80, 1, 657600, 0xb04a6eb7
+0, 81, 81, 1, 657600, 0x66610458
+0, 82, 82, 1, 657600, 0x66610458
+0, 83, 83, 1, 657600, 0xaf8901f0
+0, 84, 84, 1, 657600, 0x3ae41c48
+0, 85, 85, 1, 657600, 0x5b870b70
+0, 86, 86, 1, 657600, 0x11490c60
+0, 87, 87, 1, 657600, 0x70064801
+0, 88, 88, 1, 657600, 0x80d54519
+0, 89, 89, 1, 657600, 0xe8c942b1
+0, 90, 90, 1, 657600, 0x830d8c24
+1, 66150, 66150, 11025, 22050, 0x1ae81230
+0, 91, 91, 1, 657600, 0x830d8c24
+0, 92, 92, 1, 657600, 0x830d8c24
+0, 93, 93, 1, 657600, 0xf3c4707c
+0, 94, 94, 1, 657600, 0x6ace707c
+0, 95, 95, 1, 657600, 0x6ace707c
+0, 96, 96, 1, 657600, 0x6ace707c
+0, 97, 97, 1, 657600, 0x6ace707c
+0, 98, 98, 1, 657600, 0x6ace707c
+0, 99, 99, 1, 657600, 0x5f461aae
+0, 100, 100, 1, 657600, 0x5f461aae
+0, 101, 101, 1, 657600, 0x221ceecf
+0, 102, 102, 1, 657600, 0x221ceecf
+0, 103, 103, 1, 657600, 0x221ceecf
+0, 104, 104, 1, 657600, 0x221ceecf
+0, 105, 105, 1, 657600, 0x221ceecf
+1, 77175, 77175, 11025, 22050, 0x1217eeba
+0, 106, 106, 1, 657600, 0x221ceecf
+0, 107, 107, 1, 657600, 0x221ceecf
+0, 108, 108, 1, 657600, 0x3bf6f39f
+0, 109, 109, 1, 657600, 0x3bf6f39f
+0, 110, 110, 1, 657600, 0x3bf6f39f
+0, 111, 111, 1, 657600, 0xc2caeecf
+0, 112, 112, 1, 657600, 0xc2caeecf
+0, 113, 113, 1, 657600, 0xc2caeecf
+0, 114, 114, 1, 657600, 0xc316d63e
+0, 115, 115, 1, 657600, 0xc316d63e
+0, 116, 116, 1, 657600, 0xc316d63e
+0, 117, 117, 1, 657600, 0x41f6218d
+0, 118, 118, 1, 657600, 0x41f6218d
+0, 119, 119, 1, 657600, 0x41f6218d
+0, 120, 120, 1, 657600, 0xff43ec36
+1, 88200, 88200, 11025, 22050, 0x50e70baa
+0, 121, 121, 1, 657600, 0x0b10eb16
+0, 122, 122, 1, 657600, 0x0b10eb16
+0, 123, 123, 1, 657600, 0xbdf41aa5
+0, 124, 124, 1, 657600, 0xbdf41aa5
+0, 125, 125, 1, 657600, 0xbdf41aa5
+0, 126, 126, 1, 657600, 0xd502ca06
+0, 127, 127, 1, 657600, 0xd502ca06
+0, 128, 128, 1, 657600, 0xd502ca06
+0, 129, 129, 1, 657600, 0x8446f89e
+0, 130, 130, 1, 657600, 0x8446f89e
+0, 131, 131, 1, 657600, 0x8446f89e
+0, 132, 132, 1, 657600, 0x3d4ccf06
+0, 133, 133, 1, 657600, 0x0897d1de
+0, 134, 134, 1, 657600, 0x0897d1de
+0, 135, 135, 1, 657600, 0x3e27e01e
+1, 99225, 99225, 11025, 22050, 0xb19e89c0
+0, 136, 136, 1, 657600, 0x3e27e01e
+0, 137, 137, 1, 657600, 0x3e27e01e
+0, 138, 138, 1, 657600, 0x3e27e01e
+0, 139, 139, 1, 657600, 0x3e27e01e
+0, 140, 140, 1, 657600, 0x3e27e01e
+0, 141, 141, 1, 657600, 0xe51078a8
+0, 142, 142, 1, 657600, 0xe51078a8
+0, 143, 143, 1, 657600, 0xe9967a40
+0, 144, 144, 1, 657600, 0xe9967a40
+0, 145, 145, 1, 657600, 0xe9967a40
+0, 146, 146, 1, 657600, 0xe9967a40
+0, 147, 147, 1, 657600, 0xe9967a40
+0, 148, 148, 1, 657600, 0xe9967a40
+0, 149, 149, 1, 657600, 0xe9967a40
+0, 150, 150, 1, 657600, 0x726cb6b8
+1, 110250, 110250, 11025, 22050, 0x78526696
+0, 151, 151, 1, 657600, 0x2960b6e8
+0, 152, 152, 1, 657600, 0x2960b6e8
+0, 153, 153, 1, 657600, 0x1637d6c8
+0, 154, 154, 1, 657600, 0x6f2fd9b0
+0, 155, 155, 1, 657600, 0x27a7d6c8
+0, 156, 156, 1, 657600, 0xe855d6c8
+0, 157, 157, 1, 657600, 0xe855d6c8
+0, 158, 158, 1, 657600, 0xe855d6c8
+0, 159, 159, 1, 657600, 0x1a8ad6c8
+0, 160, 160, 1, 657600, 0x9c11d648
+0, 161, 161, 1, 657600, 0x6136d648
+0, 162, 162, 1, 657600, 0xdfa0d6c8
+0, 163, 163, 1, 657600, 0xdfa0d6c8
+0, 164, 164, 1, 657600, 0xdfa0d6c8
+0, 165, 165, 1, 657600, 0xdfa0d6c8
+1, 121275, 121275, 11025, 22050, 0x48e3bb21
+0, 166, 166, 1, 657600, 0xdfa0d6c8
+0, 167, 167, 1, 657600, 0xdfa0d6c8
+0, 168, 168, 1, 657600, 0xdfa0d6c8
+0, 169, 169, 1, 657600, 0xdfa0d6c8
+0, 170, 170, 1, 657600, 0xdfa0d6c8
+0, 171, 171, 1, 657600, 0x125cd9b0
+0, 172, 172, 1, 657600, 0x125cd9b0
+0, 173, 173, 1, 657600, 0x8a7ed6c8
+0, 174, 174, 1, 657600, 0x09a6d9b0
+0, 175, 175, 1, 657600, 0x09a6d9b0
+0, 176, 176, 1, 657600, 0x09a6d9b0
+0, 177, 177, 1, 657600, 0x85e87a68
+0, 178, 178, 1, 657600, 0x85e87a68
+0, 179, 179, 1, 657600, 0x85e87a68
+0, 180, 180, 1, 657600, 0xb0a141a8
+1, 132300, 132300, 11025, 22050, 0xbc32204a
+0, 181, 181, 1, 657600, 0xb0a141a8
+0, 182, 182, 1, 657600, 0xf3333bd8
+0, 183, 183, 1, 657600, 0xea090688
+0, 184, 184, 1, 657600, 0xa017fe41
+0, 185, 185, 1, 657600, 0xa017fe41
+0, 186, 186, 1, 657600, 0x32e93bd8
+0, 187, 187, 1, 657600, 0x7fe640c0
+0, 188, 188, 1, 657600, 0x7fe640c0
+0, 189, 189, 1, 657600, 0xcd8995b2
+0, 190, 190, 1, 657600, 0x84278a92
+0, 191, 191, 1, 657600, 0x84278a92
+0, 192, 192, 1, 657600, 0xf1d2874a
+0, 193, 193, 1, 657600, 0xf1d2874a
+0, 194, 194, 1, 657600, 0xf1d2874a
+0, 195, 195, 1, 657600, 0xa58d6742
+1, 143325, 143325, 11025, 22050, 0xdf6f1e46
+0, 196, 196, 1, 657600, 0xa58d6742
+0, 197, 197, 1, 657600, 0xa58d6742
+0, 198, 198, 1, 657600, 0xb0cd11bb
+0, 199, 199, 1, 657600, 0xb0cd11bb
+0, 200, 200, 1, 657600, 0xc55610bb
+0, 201, 201, 1, 657600, 0x4ee1168b
+0, 202, 202, 1, 657600, 0x61c513a3
+0, 203, 203, 1, 657600, 0xd26410bb
+0, 204, 204, 1, 657600, 0xe7c410bb
+0, 205, 205, 1, 657600, 0x444a0dd3
+0, 206, 206, 1, 657600, 0x444a0dd3
+0, 207, 207, 1, 657600, 0x97ac10bb
+0, 208, 208, 1, 657600, 0x97ac10bb
+0, 209, 209, 1, 657600, 0xe8b30dd3
+0, 210, 210, 1, 657600, 0x3d0c10bb
+1, 154350, 154350, 11025, 22050, 0x4c91da9d
+0, 211, 211, 1, 657600, 0x8d2b0dd3
+0, 212, 212, 1, 657600, 0x8d2b0dd3
+0, 213, 213, 1, 657600, 0xa5760dd3
+0, 214, 214, 1, 657600, 0xa5760dd3
+0, 215, 215, 1, 657600, 0xa5760dd3
+0, 216, 216, 1, 657600, 0x31a30dd3
+0, 217, 217, 1, 657600, 0x31a30dd3
+0, 218, 218, 1, 657600, 0x31a30dd3
+0, 219, 219, 1, 657600, 0x31a30dd3
+0, 220, 220, 1, 657600, 0x31a30dd3
+0, 221, 221, 1, 657600, 0x31a30dd3
+0, 222, 222, 1, 657600, 0x31a30dd3
+0, 223, 223, 1, 657600, 0x31a30dd3
+0, 224, 224, 1, 657600, 0x31a30dd3
diff --git a/gst-libs/ext/libav/tests/ref/fate/tscc-32bit b/gst-libs/ext/libav/tests/ref/fate/tscc-32bit
index 90deaf5..4eef490 100644
--- a/gst-libs/ext/libav/tests/ref/fate/tscc-32bit
+++ b/gst-libs/ext/libav/tests/ref/fate/tscc-32bit
@@ -1,156 +1,157 @@
-0, 0, 2359296, 0x76cccaa7
-0, 6000, 2359296, 0x09c52bbf
-0, 12000, 2359296, 0xc8746009
-0, 18000, 2359296, 0xe48ff59b
-0, 24000, 2359296, 0xa2f1fddb
-0, 30000, 2359296, 0xbb0e0026
-0, 36000, 2359296, 0x66a905ab
-0, 42000, 2359296, 0xe990f855
-0, 48000, 2359296, 0xe990f855
-0, 54000, 2359296, 0x3ec2c64e
-0, 60000, 2359296, 0xda3ba3cf
-0, 66000, 2359296, 0x60a070fd
-0, 72000, 2359296, 0x42e5fedc
-0, 78000, 2359296, 0x42e5fedc
-0, 84000, 2359296, 0x699cf990
-0, 90000, 2359296, 0x699cf990
-0, 96000, 2359296, 0x699cf990
-0, 102000, 2359296, 0x699cf990
-0, 108000, 2359296, 0x699cf990
-0, 114000, 2359296, 0x699cf990
-0, 120000, 2359296, 0x699cf990
-0, 126000, 2359296, 0x1524160c
-0, 132000, 2359296, 0x1524160c
-0, 138000, 2359296, 0x1524160c
-0, 144000, 2359296, 0x1524160c
-0, 150000, 2359296, 0x1524160c
-0, 156000, 2359296, 0x1524160c
-0, 162000, 2359296, 0x1524160c
-0, 168000, 2359296, 0x33df0c8c
-0, 174000, 2359296, 0x33df0c8c
-0, 180000, 2359296, 0x33df0c8c
-0, 186000, 2359296, 0x33df0c8c
-0, 192000, 2359296, 0x33df0c8c
-0, 198000, 2359296, 0x33df0c8c
-0, 204000, 2359296, 0x33df0c8c
-0, 210000, 2359296, 0xfe3d29f8
-0, 216000, 2359296, 0xfe3d29f8
-0, 222000, 2359296, 0xfe3d29f8
-0, 228000, 2359296, 0xfe3d29f8
-0, 234000, 2359296, 0xfe3d29f8
-0, 240000, 2359296, 0xfe3d29f8
-0, 246000, 2359296, 0xfe3d29f8
-0, 252000, 2359296, 0x1b9d197f
-0, 258000, 2359296, 0x1b9d197f
-0, 264000, 2359296, 0x1b9d197f
-0, 270000, 2359296, 0x1b9d197f
-0, 276000, 2359296, 0x1b9d197f
-0, 282000, 2359296, 0x1b9d197f
-0, 288000, 2359296, 0x1b9d197f
-0, 294000, 2359296, 0x48c126fb
-0, 300000, 2359296, 0x48c126fb
-0, 306000, 2359296, 0x48c126fb
-0, 312000, 2359296, 0x48c126fb
-0, 318000, 2359296, 0x48c126fb
-0, 324000, 2359296, 0x48c126fb
-0, 330000, 2359296, 0x48c126fb
-0, 336000, 2359296, 0xcaa31c7c
-0, 342000, 2359296, 0xcaa31c7c
-0, 348000, 2359296, 0xcaa31c7c
-0, 354000, 2359296, 0xcaa31c7c
-0, 360000, 2359296, 0xcaa31c7c
-0, 366000, 2359296, 0xcaa31c7c
-0, 372000, 2359296, 0xcaa31c7c
-0, 378000, 2359296, 0xc6a333ee
-0, 384000, 2359296, 0xc6a333ee
-0, 390000, 2359296, 0xc6a333ee
-0, 396000, 2359296, 0xc6a333ee
-0, 402000, 2359296, 0xc6a333ee
-0, 408000, 2359296, 0xc6a333ee
-0, 414000, 2359296, 0xc6a333ee
-0, 420000, 2359296, 0xb96d1583
-0, 426000, 2359296, 0xb96d1583
-0, 432000, 2359296, 0xb96d1583
-0, 438000, 2359296, 0xb96d1583
-0, 444000, 2359296, 0xb96d1583
-0, 450000, 2359296, 0xb96d1583
-0, 456000, 2359296, 0xb96d1583
-0, 462000, 2359296, 0x878135ec
-0, 468000, 2359296, 0x878135ec
-0, 474000, 2359296, 0x878135ec
-0, 480000, 2359296, 0x878135ec
-0, 486000, 2359296, 0x878135ec
-0, 492000, 2359296, 0x878135ec
-0, 498000, 2359296, 0x878135ec
-0, 504000, 2359296, 0x76922870
-0, 510000, 2359296, 0x76922870
-0, 516000, 2359296, 0x76922870
-0, 522000, 2359296, 0x76922870
-0, 528000, 2359296, 0x76922870
-0, 534000, 2359296, 0x76922870
-0, 540000, 2359296, 0x76922870
-0, 546000, 2359296, 0xb0e031f0
-0, 552000, 2359296, 0xb0e031f0
-0, 558000, 2359296, 0xb0e031f0
-0, 564000, 2359296, 0xb0e031f0
-0, 570000, 2359296, 0xb0e031f0
-0, 576000, 2359296, 0xb0e031f0
-0, 582000, 2359296, 0xb0e031f0
-0, 588000, 2359296, 0xb2ef2a6e
-0, 594000, 2359296, 0xb2ef2a6e
-0, 600000, 2359296, 0xb2ef2a6e
-0, 606000, 2359296, 0x083c2474
-0, 612000, 2359296, 0x083c2474
-0, 618000, 2359296, 0x083c2474
-0, 624000, 2359296, 0x083c2474
-0, 630000, 2359296, 0xbdfe2ef3
-0, 636000, 2359296, 0xbdfe2ef3
-0, 642000, 2359296, 0xbdfe2ef3
-0, 648000, 2359296, 0xbdfe2ef3
-0, 654000, 2359296, 0xbdfe2ef3
-0, 660000, 2359296, 0xbdfe2ef3
-0, 666000, 2359296, 0xbdfe2ef3
-0, 672000, 2359296, 0x934b1484
-0, 678000, 2359296, 0x934b1484
-0, 684000, 2359296, 0x934b1484
-0, 690000, 2359296, 0x934b1484
-0, 696000, 2359296, 0x3e0d1a7e
-0, 702000, 2359296, 0x3e0d1a7e
-0, 708000, 2359296, 0x3e0d1a7e
-0, 714000, 2359296, 0x3ce539e8
-0, 720000, 2359296, 0x3ce539e8
-0, 726000, 2359296, 0x3ce539e8
-0, 732000, 2359296, 0x3ce539e8
-0, 738000, 2359296, 0x3ce539e8
-0, 744000, 2359296, 0x3ce539e8
-0, 750000, 2359296, 0x3ce539e8
-0, 756000, 2359296, 0xd46c2f69
-0, 762000, 2359296, 0xd46c2f69
-0, 768000, 2359296, 0xd46c2f69
-0, 774000, 2359296, 0xd46c2f69
-0, 780000, 2359296, 0xd46c2f69
-0, 786000, 2359296, 0xd46c2f69
-0, 792000, 2359296, 0xd46c2f69
-0, 798000, 2359296, 0x8d2933ee
-0, 804000, 2359296, 0x8d2933ee
-0, 810000, 2359296, 0x8d2933ee
-0, 816000, 2359296, 0x8d2933ee
-0, 822000, 2359296, 0x8d2933ee
-0, 828000, 2359296, 0x8d2933ee
-0, 834000, 2359296, 0x8d2933ee
-0, 840000, 2359296, 0xb6092b6d
-0, 846000, 2359296, 0xb6092b6d
-0, 852000, 2359296, 0xb6092b6d
-0, 858000, 2359296, 0xb6092b6d
-0, 864000, 2359296, 0xb6092b6d
-0, 870000, 2359296, 0xb6092b6d
-0, 876000, 2359296, 0xb6092b6d
-0, 882000, 2359296, 0xe4ef27fa
-0, 888000, 2359296, 0xe4ef27fa
-0, 894000, 2359296, 0xe4ef27fa
-0, 900000, 2359296, 0xe4ef27fa
-0, 906000, 2359296, 0xe4ef27fa
-0, 912000, 2359296, 0xe4ef27fa
-0, 918000, 2359296, 0xe4ef27fa
-0, 924000, 2359296, 0x5e5b2672
-0, 930000, 2359296, 0x5e5b2672
+#tb 0: 1/15
+0, 0, 0, 1, 2359296, 0x76cccaa7
+0, 1, 1, 1, 2359296, 0x09c52bbf
+0, 2, 2, 1, 2359296, 0xc8746009
+0, 3, 3, 1, 2359296, 0xe48ff59b
+0, 4, 4, 1, 2359296, 0xa2f1fddb
+0, 5, 5, 1, 2359296, 0xbb0e0026
+0, 6, 6, 1, 2359296, 0x66a905ab
+0, 7, 7, 1, 2359296, 0xe990f855
+0, 8, 8, 1, 2359296, 0xe990f855
+0, 9, 9, 1, 2359296, 0x3ec2c64e
+0, 13, 13, 1, 2359296, 0xda3ba3cf
+0, 14, 14, 1, 2359296, 0x60a070fd
+0, 15, 15, 1, 2359296, 0x42e5fedc
+0, 16, 16, 1, 2359296, 0x42e5fedc
+0, 17, 17, 1, 2359296, 0x699cf990
+0, 18, 18, 1, 2359296, 0x699cf990
+0, 19, 19, 1, 2359296, 0x699cf990
+0, 20, 20, 1, 2359296, 0x699cf990
+0, 21, 21, 1, 2359296, 0x699cf990
+0, 22, 22, 1, 2359296, 0x699cf990
+0, 23, 23, 1, 2359296, 0x699cf990
+0, 24, 24, 1, 2359296, 0x1524160c
+0, 25, 25, 1, 2359296, 0x1524160c
+0, 26, 26, 1, 2359296, 0x1524160c
+0, 27, 27, 1, 2359296, 0x1524160c
+0, 28, 28, 1, 2359296, 0x1524160c
+0, 29, 29, 1, 2359296, 0x1524160c
+0, 30, 30, 1, 2359296, 0x1524160c
+0, 31, 31, 1, 2359296, 0x33df0c8c
+0, 32, 32, 1, 2359296, 0x33df0c8c
+0, 33, 33, 1, 2359296, 0x33df0c8c
+0, 34, 34, 1, 2359296, 0x33df0c8c
+0, 35, 35, 1, 2359296, 0x33df0c8c
+0, 36, 36, 1, 2359296, 0x33df0c8c
+0, 37, 37, 1, 2359296, 0x33df0c8c
+0, 38, 38, 1, 2359296, 0xfe3d29f8
+0, 39, 39, 1, 2359296, 0xfe3d29f8
+0, 40, 40, 1, 2359296, 0xfe3d29f8
+0, 41, 41, 1, 2359296, 0xfe3d29f8
+0, 42, 42, 1, 2359296, 0xfe3d29f8
+0, 43, 43, 1, 2359296, 0xfe3d29f8
+0, 44, 44, 1, 2359296, 0xfe3d29f8
+0, 45, 45, 1, 2359296, 0x1b9d197f
+0, 46, 46, 1, 2359296, 0x1b9d197f
+0, 47, 47, 1, 2359296, 0x1b9d197f
+0, 48, 48, 1, 2359296, 0x1b9d197f
+0, 49, 49, 1, 2359296, 0x1b9d197f
+0, 50, 50, 1, 2359296, 0x1b9d197f
+0, 51, 51, 1, 2359296, 0x1b9d197f
+0, 52, 52, 1, 2359296, 0x48c126fb
+0, 53, 53, 1, 2359296, 0x48c126fb
+0, 54, 54, 1, 2359296, 0x48c126fb
+0, 55, 55, 1, 2359296, 0x48c126fb
+0, 56, 56, 1, 2359296, 0x48c126fb
+0, 57, 57, 1, 2359296, 0x48c126fb
+0, 58, 58, 1, 2359296, 0x48c126fb
+0, 59, 59, 1, 2359296, 0xcaa31c7c
+0, 60, 60, 1, 2359296, 0xcaa31c7c
+0, 61, 61, 1, 2359296, 0xcaa31c7c
+0, 62, 62, 1, 2359296, 0xcaa31c7c
+0, 63, 63, 1, 2359296, 0xcaa31c7c
+0, 64, 64, 1, 2359296, 0xcaa31c7c
+0, 65, 65, 1, 2359296, 0xcaa31c7c
+0, 66, 66, 1, 2359296, 0xc6a333ee
+0, 67, 67, 1, 2359296, 0xc6a333ee
+0, 68, 68, 1, 2359296, 0xc6a333ee
+0, 69, 69, 1, 2359296, 0xc6a333ee
+0, 70, 70, 1, 2359296, 0xc6a333ee
+0, 71, 71, 1, 2359296, 0xc6a333ee
+0, 72, 72, 1, 2359296, 0xc6a333ee
+0, 73, 73, 1, 2359296, 0xb96d1583
+0, 74, 74, 1, 2359296, 0xb96d1583
+0, 75, 75, 1, 2359296, 0xb96d1583
+0, 76, 76, 1, 2359296, 0xb96d1583
+0, 77, 77, 1, 2359296, 0xb96d1583
+0, 78, 78, 1, 2359296, 0xb96d1583
+0, 79, 79, 1, 2359296, 0xb96d1583
+0, 80, 80, 1, 2359296, 0x878135ec
+0, 82, 82, 1, 2359296, 0x878135ec
+0, 83, 83, 1, 2359296, 0x878135ec
+0, 84, 84, 1, 2359296, 0x878135ec
+0, 85, 85, 1, 2359296, 0x878135ec
+0, 86, 86, 1, 2359296, 0x878135ec
+0, 87, 87, 1, 2359296, 0x878135ec
+0, 88, 88, 1, 2359296, 0x76922870
+0, 89, 89, 1, 2359296, 0x76922870
+0, 90, 90, 1, 2359296, 0x76922870
+0, 91, 91, 1, 2359296, 0x76922870
+0, 92, 92, 1, 2359296, 0x76922870
+0, 93, 93, 1, 2359296, 0x76922870
+0, 94, 94, 1, 2359296, 0x76922870
+0, 95, 95, 1, 2359296, 0xb0e031f0
+0, 96, 96, 1, 2359296, 0xb0e031f0
+0, 97, 97, 1, 2359296, 0xb0e031f0
+0, 98, 98, 1, 2359296, 0xb0e031f0
+0, 99, 99, 1, 2359296, 0xb0e031f0
+0, 100, 100, 1, 2359296, 0xb0e031f0
+0, 101, 101, 1, 2359296, 0xb0e031f0
+0, 102, 102, 1, 2359296, 0xb2ef2a6e
+0, 103, 103, 1, 2359296, 0xb2ef2a6e
+0, 104, 104, 1, 2359296, 0xb2ef2a6e
+0, 105, 105, 1, 2359296, 0x083c2474
+0, 106, 106, 1, 2359296, 0x083c2474
+0, 107, 107, 1, 2359296, 0x083c2474
+0, 108, 108, 1, 2359296, 0x083c2474
+0, 109, 109, 1, 2359296, 0xbdfe2ef3
+0, 110, 110, 1, 2359296, 0xbdfe2ef3
+0, 111, 111, 1, 2359296, 0xbdfe2ef3
+0, 112, 112, 1, 2359296, 0xbdfe2ef3
+0, 113, 113, 1, 2359296, 0xbdfe2ef3
+0, 114, 114, 1, 2359296, 0xbdfe2ef3
+0, 115, 115, 1, 2359296, 0xbdfe2ef3
+0, 116, 116, 1, 2359296, 0x934b1484
+0, 117, 117, 1, 2359296, 0x934b1484
+0, 118, 118, 1, 2359296, 0x934b1484
+0, 119, 119, 1, 2359296, 0x934b1484
+0, 120, 120, 1, 2359296, 0x3e0d1a7e
+0, 121, 121, 1, 2359296, 0x3e0d1a7e
+0, 122, 122, 1, 2359296, 0x3e0d1a7e
+0, 123, 123, 1, 2359296, 0x3ce539e8
+0, 124, 124, 1, 2359296, 0x3ce539e8
+0, 125, 125, 1, 2359296, 0x3ce539e8
+0, 126, 126, 1, 2359296, 0x3ce539e8
+0, 127, 127, 1, 2359296, 0x3ce539e8
+0, 128, 128, 1, 2359296, 0x3ce539e8
+0, 129, 129, 1, 2359296, 0x3ce539e8
+0, 130, 130, 1, 2359296, 0xd46c2f69
+0, 131, 131, 1, 2359296, 0xd46c2f69
+0, 132, 132, 1, 2359296, 0xd46c2f69
+0, 133, 133, 1, 2359296, 0xd46c2f69
+0, 134, 134, 1, 2359296, 0xd46c2f69
+0, 135, 135, 1, 2359296, 0xd46c2f69
+0, 136, 136, 1, 2359296, 0xd46c2f69
+0, 137, 137, 1, 2359296, 0x8d2933ee
+0, 138, 138, 1, 2359296, 0x8d2933ee
+0, 139, 139, 1, 2359296, 0x8d2933ee
+0, 140, 140, 1, 2359296, 0x8d2933ee
+0, 141, 141, 1, 2359296, 0x8d2933ee
+0, 142, 142, 1, 2359296, 0x8d2933ee
+0, 143, 143, 1, 2359296, 0x8d2933ee
+0, 144, 144, 1, 2359296, 0xb6092b6d
+0, 145, 145, 1, 2359296, 0xb6092b6d
+0, 146, 146, 1, 2359296, 0xb6092b6d
+0, 147, 147, 1, 2359296, 0xb6092b6d
+0, 148, 148, 1, 2359296, 0xb6092b6d
+0, 149, 149, 1, 2359296, 0xb6092b6d
+0, 150, 150, 1, 2359296, 0xb6092b6d
+0, 151, 151, 1, 2359296, 0xe4ef27fa
+0, 152, 152, 1, 2359296, 0xe4ef27fa
+0, 153, 153, 1, 2359296, 0xe4ef27fa
+0, 154, 154, 1, 2359296, 0xe4ef27fa
+0, 155, 155, 1, 2359296, 0xe4ef27fa
+0, 156, 156, 1, 2359296, 0xe4ef27fa
+0, 157, 157, 1, 2359296, 0xe4ef27fa
+0, 158, 158, 1, 2359296, 0x5e5b2672
+0, 159, 159, 1, 2359296, 0x5e5b2672
diff --git a/gst-libs/ext/libav/tests/ref/fate/txd-16bpp b/gst-libs/ext/libav/tests/ref/fate/txd-16bpp
index aa5979e..3a23c0b 100644
--- a/gst-libs/ext/libav/tests/ref/fate/txd-16bpp
+++ b/gst-libs/ext/libav/tests/ref/fate/txd-16bpp
@@ -1,11 +1,12 @@
-0, 0, 16384, 0x213f9ea8
-0, 18000, 16384, 0x8185fdb1
-0, 36000, 16384, 0xf03581d1
-0, 54000, 16384, 0x629cd573
-0, 72000, 16384, 0xfe7a5b63
-0, 90000, 16384, 0x4afc05b2
-0, 108000, 16384, 0x074b8515
-0, 126000, 16384, 0x17fde900
-0, 144000, 16384, 0x831bac76
-0, 162000, 16384, 0x2fb579f3
-0, 180000, 16384, 0x68762bed
+#tb 0: 1/90000
+0, 0, 0, 0, 16384, 0x213f9ea8
+0, 18000, 18000, 0, 16384, 0x8185fdb1
+0, 36000, 36000, 0, 16384, 0xf03581d1
+0, 54000, 54000, 0, 16384, 0x629cd573
+0, 72000, 72000, 0, 16384, 0xfe7a5b63
+0, 90000, 90000, 0, 16384, 0x4afc05b2
+0, 108000, 108000, 0, 16384, 0x074b8515
+0, 126000, 126000, 0, 16384, 0x17fde900
+0, 144000, 144000, 0, 16384, 0x831bac76
+0, 162000, 162000, 0, 16384, 0x2fb579f3
+0, 180000, 180000, 0, 16384, 0x68762bed
diff --git a/gst-libs/ext/libav/tests/ref/fate/txd-pal8 b/gst-libs/ext/libav/tests/ref/fate/txd-pal8
index 8d8f2a5..3f0aab2 100644
--- a/gst-libs/ext/libav/tests/ref/fate/txd-pal8
+++ b/gst-libs/ext/libav/tests/ref/fate/txd-pal8
@@ -1 +1,2 @@
-0, 0, 786432, 0x56654d61
+#tb 0: 1/90000
+0, 0, 0, 0, 786432, 0x56654d61
diff --git a/gst-libs/ext/libav/tests/ref/fate/ulti b/gst-libs/ext/libav/tests/ref/fate/ulti
index 820dcfd..4e9968b 100644
--- a/gst-libs/ext/libav/tests/ref/fate/ulti
+++ b/gst-libs/ext/libav/tests/ref/fate/ulti
@@ -1,62 +1,63 @@
-0, 0, 86400, 0x5d58253d
-0, 7500, 86400, 0x0626d90d
-0, 15000, 86400, 0x4ecb5048
-0, 22500, 86400, 0xf54ea8f7
-0, 30000, 86400, 0xa777c21b
-0, 37500, 86400, 0x7d71e329
-0, 45000, 86400, 0x2903252a
-0, 52500, 86400, 0xbe7302c1
-0, 60000, 86400, 0x734423a8
-0, 67500, 86400, 0x4f422bab
-0, 75000, 86400, 0x21fbf200
-0, 82500, 86400, 0xabf299a7
-0, 90000, 86400, 0x400b4bf8
-0, 97500, 86400, 0x61d044f9
-0, 105000, 86400, 0x72fb94af
-0, 112500, 86400, 0xf522e717
-0, 120000, 86400, 0xad3e0297
-0, 127500, 86400, 0xbef57a5f
-0, 135000, 86400, 0x450ca6e7
-0, 142500, 86400, 0x76ae56e6
-0, 150000, 86400, 0x7b9b7555
-0, 157500, 86400, 0xb522ce0d
-0, 165000, 86400, 0xaa9b8536
-0, 172500, 86400, 0x019d00c4
-0, 180000, 86400, 0xb0f4dee5
-0, 187500, 86400, 0xa7482e52
-0, 195000, 86400, 0x3c87fc35
-0, 202500, 86400, 0xb6d1dede
-0, 210000, 86400, 0x926ee647
-0, 217500, 86400, 0x8747bfc7
-0, 225000, 86400, 0x61569e9b
-0, 232500, 86400, 0x9209a5f6
-0, 240000, 86400, 0x5f89ef12
-0, 247500, 86400, 0x00bfc18f
-0, 255000, 86400, 0xcc6f2f62
-0, 262500, 86400, 0x3ab9cfbf
-0, 270000, 86400, 0x936f2386
-0, 277500, 86400, 0x2203a76c
-0, 285000, 86400, 0xd3d248a3
-0, 292500, 86400, 0x148af7b8
-0, 300000, 86400, 0x437bffae
-0, 307500, 86400, 0x6876c6d5
-0, 315000, 86400, 0x49fc1429
-0, 322500, 86400, 0x181efd2c
-0, 330000, 86400, 0x26ecd294
-0, 337500, 86400, 0xdcdb609e
-0, 345000, 86400, 0xd3cb0ecb
-0, 352500, 86400, 0x528ffc4b
-0, 360000, 86400, 0xb536c7b4
-0, 367500, 86400, 0xae4ab8c5
-0, 375000, 86400, 0xe14fee77
-0, 382500, 86400, 0xcd3e9e85
-0, 390000, 86400, 0x71cfba54
-0, 397500, 86400, 0x9b309c62
-0, 405000, 86400, 0x91b31881
-0, 412500, 86400, 0xae8bda28
-0, 420000, 86400, 0x8db0f87a
-0, 427500, 86400, 0xcd974e98
-0, 435000, 86400, 0x4405116e
-0, 442500, 86400, 0xfe4cc7b4
-0, 450000, 86400, 0x17d27206
-0, 457500, 86400, 0x11743762
+#tb 0: 1/12
+0, 0, 0, 1, 86400, 0x5d58253d
+0, 1, 1, 1, 86400, 0x0626d90d
+0, 2, 2, 1, 86400, 0x4ecb5048
+0, 3, 3, 1, 86400, 0xf54ea8f7
+0, 4, 4, 1, 86400, 0xa777c21b
+0, 5, 5, 1, 86400, 0x7d71e329
+0, 6, 6, 1, 86400, 0x2903252a
+0, 7, 7, 1, 86400, 0xbe7302c1
+0, 8, 8, 1, 86400, 0x734423a8
+0, 9, 9, 1, 86400, 0x4f422bab
+0, 10, 10, 1, 86400, 0x21fbf200
+0, 11, 11, 1, 86400, 0xabf299a7
+0, 12, 12, 1, 86400, 0x400b4bf8
+0, 13, 13, 1, 86400, 0x61d044f9
+0, 14, 14, 1, 86400, 0x72fb94af
+0, 15, 15, 1, 86400, 0xf522e717
+0, 16, 16, 1, 86400, 0xad3e0297
+0, 17, 17, 1, 86400, 0xbef57a5f
+0, 18, 18, 1, 86400, 0x450ca6e7
+0, 19, 19, 1, 86400, 0x76ae56e6
+0, 20, 20, 1, 86400, 0x7b9b7555
+0, 21, 21, 1, 86400, 0xb522ce0d
+0, 22, 22, 1, 86400, 0xaa9b8536
+0, 23, 23, 1, 86400, 0x019d00c4
+0, 24, 24, 1, 86400, 0xb0f4dee5
+0, 25, 25, 1, 86400, 0xa7482e52
+0, 26, 26, 1, 86400, 0x3c87fc35
+0, 27, 27, 1, 86400, 0xb6d1dede
+0, 28, 28, 1, 86400, 0x926ee647
+0, 29, 29, 1, 86400, 0x8747bfc7
+0, 30, 30, 1, 86400, 0x61569e9b
+0, 31, 31, 1, 86400, 0x9209a5f6
+0, 32, 32, 1, 86400, 0x5f89ef12
+0, 33, 33, 1, 86400, 0x00bfc18f
+0, 34, 34, 1, 86400, 0xcc6f2f62
+0, 35, 35, 1, 86400, 0x3ab9cfbf
+0, 36, 36, 1, 86400, 0x936f2386
+0, 37, 37, 1, 86400, 0x2203a76c
+0, 38, 38, 1, 86400, 0xd3d248a3
+0, 39, 39, 1, 86400, 0x148af7b8
+0, 40, 40, 1, 86400, 0x437bffae
+0, 41, 41, 1, 86400, 0x6876c6d5
+0, 42, 42, 1, 86400, 0x49fc1429
+0, 43, 43, 1, 86400, 0x181efd2c
+0, 44, 44, 1, 86400, 0x26ecd294
+0, 45, 45, 1, 86400, 0xdcdb609e
+0, 46, 46, 1, 86400, 0xd3cb0ecb
+0, 47, 47, 1, 86400, 0x528ffc4b
+0, 48, 48, 1, 86400, 0xb536c7b4
+0, 49, 49, 1, 86400, 0xae4ab8c5
+0, 50, 50, 1, 86400, 0xe14fee77
+0, 51, 51, 1, 86400, 0xcd3e9e85
+0, 52, 52, 1, 86400, 0x71cfba54
+0, 53, 53, 1, 86400, 0x9b309c62
+0, 54, 54, 1, 86400, 0x91b31881
+0, 55, 55, 1, 86400, 0xae8bda28
+0, 56, 56, 1, 86400, 0x8db0f87a
+0, 57, 57, 1, 86400, 0xcd974e98
+0, 58, 58, 1, 86400, 0x4405116e
+0, 59, 59, 1, 86400, 0xfe4cc7b4
+0, 60, 60, 1, 86400, 0x17d27206
+0, 61, 61, 1, 86400, 0x11743762
diff --git a/gst-libs/ext/libav/tests/ref/fate/url b/gst-libs/ext/libav/tests/ref/fate/url
new file mode 100644
index 0000000..1a6051e
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/url
@@ -0,0 +1,13 @@
+baz
+/foo/baz
+/baz
+/baz
+http://server/foo/baz
+http://server/foo/baz
+http://server/baz
+http://server/baz
+http://server/baz
+https://other/url
+http://server/baz
+http://server/foo/bar?someparam
+http://other/url
diff --git a/gst-libs/ext/libav/tests/ref/fate/utvideo_rgb_left b/gst-libs/ext/libav/tests/ref/fate/utvideo_rgb_left
index 5d2b73c..d19a6b1 100644
--- a/gst-libs/ext/libav/tests/ref/fate/utvideo_rgb_left
+++ b/gst-libs/ext/libav/tests/ref/fate/utvideo_rgb_left
@@ -1,4 +1,5 @@
-0, 0, 921600, 0x27e6001e
-0, 3003, 921600, 0x7c0a92bc
-0, 6006, 921600, 0x4d2be42c
-0, 9009, 921600, 0x58ddd0be
+#tb 0: 1001/30000
+0, 0, 0, 1, 921600, 0x27e6001e
+0, 1, 1, 1, 921600, 0x7c0a92bc
+0, 2, 2, 1, 921600, 0x4d2be42c
+0, 3, 3, 1, 921600, 0x58ddd0be
diff --git a/gst-libs/ext/libav/tests/ref/fate/utvideo_rgb_median b/gst-libs/ext/libav/tests/ref/fate/utvideo_rgb_median
index 6914153..f041285 100644
--- a/gst-libs/ext/libav/tests/ref/fate/utvideo_rgb_median
+++ b/gst-libs/ext/libav/tests/ref/fate/utvideo_rgb_median
@@ -1,5 +1,6 @@
-0, 0, 921600, 0x9776611f
-0, 3003, 921600, 0xdbfa64f4
-0, 6006, 921600, 0xed2a0580
-0, 9009, 921600, 0x6ecc80bc
-0, 12012, 921600, 0x58ddd0be
+#tb 0: 1001/30000
+0, 0, 0, 1, 921600, 0x9776611f
+0, 1, 1, 1, 921600, 0xdbfa64f4
+0, 2, 2, 1, 921600, 0xed2a0580
+0, 3, 3, 1, 921600, 0x6ecc80bc
+0, 4, 4, 1, 921600, 0x58ddd0be
diff --git a/gst-libs/ext/libav/tests/ref/fate/utvideo_rgba_left b/gst-libs/ext/libav/tests/ref/fate/utvideo_rgba_left
index 7d3800e..a7e0ed4 100644
--- a/gst-libs/ext/libav/tests/ref/fate/utvideo_rgba_left
+++ b/gst-libs/ext/libav/tests/ref/fate/utvideo_rgba_left
@@ -1,5 +1,6 @@
-0, 0, 1228800, 0xf1bc9432
-0, 3003, 1228800, 0x8480d1e5
-0, 6006, 1228800, 0xb01d5fb2
-0, 9009, 1228800, 0x53cb42c4
-0, 12012, 1228800, 0x2b2ea176
+#tb 0: 1001/30000
+0, 0, 0, 1, 1228800, 0xf1bc9432
+0, 1, 1, 1, 1228800, 0x8480d1e5
+0, 2, 2, 1, 1228800, 0xb01d5fb2
+0, 3, 3, 1, 1228800, 0x53cb42c4
+0, 4, 4, 1, 1228800, 0x2b2ea176
diff --git a/gst-libs/ext/libav/tests/ref/fate/utvideo_rgba_median b/gst-libs/ext/libav/tests/ref/fate/utvideo_rgba_median
index 7d3800e..a7e0ed4 100644
--- a/gst-libs/ext/libav/tests/ref/fate/utvideo_rgba_median
+++ b/gst-libs/ext/libav/tests/ref/fate/utvideo_rgba_median
@@ -1,5 +1,6 @@
-0, 0, 1228800, 0xf1bc9432
-0, 3003, 1228800, 0x8480d1e5
-0, 6006, 1228800, 0xb01d5fb2
-0, 9009, 1228800, 0x53cb42c4
-0, 12012, 1228800, 0x2b2ea176
+#tb 0: 1001/30000
+0, 0, 0, 1, 1228800, 0xf1bc9432
+0, 1, 1, 1, 1228800, 0x8480d1e5
+0, 2, 2, 1, 1228800, 0xb01d5fb2
+0, 3, 3, 1, 1228800, 0x53cb42c4
+0, 4, 4, 1, 1228800, 0x2b2ea176
diff --git a/gst-libs/ext/libav/tests/ref/fate/utvideo_rgba_single_symbol b/gst-libs/ext/libav/tests/ref/fate/utvideo_rgba_single_symbol
new file mode 100644
index 0000000..c0e0d98
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/utvideo_rgba_single_symbol
@@ -0,0 +1,2 @@
+#tb 0: 1/24
+0, 0, 0, 1, 3145728, 0xac95c593
diff --git a/gst-libs/ext/libav/tests/ref/fate/utvideo_yuv420_left b/gst-libs/ext/libav/tests/ref/fate/utvideo_yuv420_left
index bdb90a6..026f8fb 100644
--- a/gst-libs/ext/libav/tests/ref/fate/utvideo_yuv420_left
+++ b/gst-libs/ext/libav/tests/ref/fate/utvideo_yuv420_left
@@ -1,7 +1,8 @@
-0, 0, 460800, 0xece98fc8
-0, 3003, 460800, 0x9baf786b
-0, 6006, 460800, 0x8e8e0510
-0, 9009, 460800, 0x27c1f2ba
-0, 12012, 460800, 0x6a817987
-0, 15015, 460800, 0x2f713ec2
-0, 18018, 460800, 0x003b560e
+#tb 0: 1001/30000
+0, 0, 0, 1, 460800, 0xece98fc8
+0, 1, 1, 1, 460800, 0x9baf786b
+0, 2, 2, 1, 460800, 0x8e8e0510
+0, 3, 3, 1, 460800, 0x27c1f2ba
+0, 4, 4, 1, 460800, 0x6a817987
+0, 5, 5, 1, 460800, 0x2f713ec2
+0, 6, 6, 1, 460800, 0x003b560e
diff --git a/gst-libs/ext/libav/tests/ref/fate/utvideo_yuv420_median b/gst-libs/ext/libav/tests/ref/fate/utvideo_yuv420_median
index 5cd3bc8..5662d8c 100644
--- a/gst-libs/ext/libav/tests/ref/fate/utvideo_yuv420_median
+++ b/gst-libs/ext/libav/tests/ref/fate/utvideo_yuv420_median
@@ -1,4 +1,5 @@
-0, 0, 460800, 0x6a817987
-0, 3003, 460800, 0x2f713ec2
-0, 6006, 460800, 0x003b560e
-0, 9009, 460800, 0x9e1bbf63
+#tb 0: 1001/30000
+0, 0, 0, 1, 460800, 0x6a817987
+0, 1, 1, 1, 460800, 0x2f713ec2
+0, 2, 2, 1, 460800, 0x003b560e
+0, 3, 3, 1, 460800, 0x9e1bbf63
diff --git a/gst-libs/ext/libav/tests/ref/fate/utvideo_yuv422_left b/gst-libs/ext/libav/tests/ref/fate/utvideo_yuv422_left
index d68bf4e..438b32a 100644
--- a/gst-libs/ext/libav/tests/ref/fate/utvideo_yuv422_left
+++ b/gst-libs/ext/libav/tests/ref/fate/utvideo_yuv422_left
@@ -1,4 +1,5 @@
-0, 0, 614400, 0x9a6b8802
-0, 3003, 614400, 0xaa8687e2
-0, 6006, 614400, 0x2fe5bd40
-0, 9009, 614400, 0x1c8f3737
+#tb 0: 1001/30000
+0, 0, 0, 1, 614400, 0x9a6b8802
+0, 1, 1, 1, 614400, 0xaa8687e2
+0, 2, 2, 1, 614400, 0x2fe5bd40
+0, 3, 3, 1, 614400, 0x1c8f3737
diff --git a/gst-libs/ext/libav/tests/ref/fate/utvideo_yuv422_median b/gst-libs/ext/libav/tests/ref/fate/utvideo_yuv422_median
index d68bf4e..438b32a 100644
--- a/gst-libs/ext/libav/tests/ref/fate/utvideo_yuv422_median
+++ b/gst-libs/ext/libav/tests/ref/fate/utvideo_yuv422_median
@@ -1,4 +1,5 @@
-0, 0, 614400, 0x9a6b8802
-0, 3003, 614400, 0xaa8687e2
-0, 6006, 614400, 0x2fe5bd40
-0, 9009, 614400, 0x1c8f3737
+#tb 0: 1001/30000
+0, 0, 0, 1, 614400, 0x9a6b8802
+0, 1, 1, 1, 614400, 0xaa8687e2
+0, 2, 2, 1, 614400, 0x2fe5bd40
+0, 3, 3, 1, 614400, 0x1c8f3737
diff --git a/gst-libs/ext/libav/tests/ref/fate/utvideoenc_rgb_left b/gst-libs/ext/libav/tests/ref/fate/utvideoenc_rgb_left
new file mode 100644
index 0000000..99d1182
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/utvideoenc_rgb_left
@@ -0,0 +1,51 @@
+#tb 0: 1/25
+0, 0, 0, 1, 182328, cd084b244939d7e0008d8e5ab3429dc1
+0, 1, 1, 1, 182336, c9c40672750f372134185901147fb776
+0, 2, 2, 1, 182956, c728911ca73225f2dc7453533c9be95e
+0, 3, 3, 1, 182384, 54521f709b461a25198db755bce582fa
+0, 4, 4, 1, 181704, 5e03ab58b4480a6613f54857f10c39e5
+0, 5, 5, 1, 182136, c623fb06b90fdd7a5ba0b4f217b6a388
+0, 6, 6, 1, 181552, 5d03be9dfc01ad99364fc3cc8378af72
+0, 7, 7, 1, 182292, fc90878278c82b2f835151dc6d43dd47
+0, 8, 8, 1, 181424, 9b6339a0d3af2d3034162183cd4d79e4
+0, 9, 9, 1, 182316, 7e45bb5ffe57f98a433420abaffe78cc
+0, 10, 10, 1, 182064, d9525605a7d7d75a8e33502f61733af1
+0, 11, 11, 1, 182596, 62e87fa5c33a8d208deaa8719682b9a5
+0, 12, 12, 1, 180900, 149059d3d56c55358c7044c7d569730f
+0, 13, 13, 1, 181920, 0d20f588c27471a038e159a131e9c8ea
+0, 14, 14, 1, 182824, a301a411ff11042ecb583e1e3b12dbda
+0, 15, 15, 1, 182452, 0ee2a9ed39fb8569a8d6c2b3afb8f80a
+0, 16, 16, 1, 182312, 68dd3b820adf2cbc6686a7d48fa22c6e
+0, 17, 17, 1, 181856, 1897926cfe9b7acaf9c21714c449ce41
+0, 18, 18, 1, 181108, 15d2af460733fdd896078632cdfef9fd
+0, 19, 19, 1, 181388, 8b8e7a4b7d355f41f7e836120c4792ac
+0, 20, 20, 1, 180936, e18e27aa027f2470bfa95c536a0a89af
+0, 21, 21, 1, 180900, eb663ae3c5ffa8e751280e0dbb260e02
+0, 22, 22, 1, 181936, 7514bbe06cee027f54710dc900297863
+0, 23, 23, 1, 182304, 8cb2dcdbd4c919b4c977f45bee46c54c
+0, 24, 24, 1, 182580, 9185ed53b7e8339b61d3abe230bbab71
+0, 25, 25, 1, 182572, 81f8bdd3255b91d6621e9ebd3c9d7679
+0, 26, 26, 1, 182356, 1f9ff40700881054c62e33acde06910d
+0, 27, 27, 1, 181532, 10d2477aa1e319a61e517d25fd6c95d0
+0, 28, 28, 1, 179580, 3012480c43d15866ccc4a81d56650ee2
+0, 29, 29, 1, 179528, 5e0fbd62a164dc72cf511023da792175
+0, 30, 30, 1, 180760, 679f430c86dca203456f532e978dffc2
+0, 31, 31, 1, 181564, 64d31faf01cb7b52d7d7e20280e6652b
+0, 32, 32, 1, 181428, 04961d71aa3c81b33d28b39ead20ee1d
+0, 33, 33, 1, 182980, 51361c802005721002f5f4924f081708
+0, 34, 34, 1, 182624, 67c5582c45e3ee7e6aca49fdc0a980b8
+0, 35, 35, 1, 182352, 4fade9db12f2d6ce633556fdb8914971
+0, 36, 36, 1, 181336, ac8fbab67b36d58c4e8374bfb07458e7
+0, 37, 37, 1, 181528, f798157b6d4d04c767ecb76346922ddc
+0, 38, 38, 1, 179776, 01d407ed0b86eeb2c3ee3c24dd452d8d
+0, 39, 39, 1, 180100, 062e4af150100d7accf86a907a4b99b5
+0, 40, 40, 1, 180228, 23c617b76ef8f274bd089016fb8516c7
+0, 41, 41, 1, 180592, 55f538ae5e44b60209138b7536d5c199
+0, 42, 42, 1, 181188, d39d52f5b690661434b1abd8717b3e30
+0, 43, 43, 1, 181300, 9e202444287234bafd103fab83b1a974
+0, 44, 44, 1, 180812, 602165271de71594132cce98af56a7b2
+0, 45, 45, 1, 178816, c427d67196f43ece6bf3855e1256d7bb
+0, 46, 46, 1, 178196, 0d05902e2870a85333a216c723077e98
+0, 47, 47, 1, 178772, 57f528eb984b5b7181c89b48b58271f3
+0, 48, 48, 1, 178652, 5cd1031b0ada3ba9c2d4c2f2b7c8e277
+0, 49, 49, 1, 178512, d3c0c84fc63f1e32a4a026e2cd39b161
diff --git a/gst-libs/ext/libav/tests/ref/fate/utvideoenc_rgb_median b/gst-libs/ext/libav/tests/ref/fate/utvideoenc_rgb_median
new file mode 100644
index 0000000..5983ddf
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/utvideoenc_rgb_median
@@ -0,0 +1,51 @@
+#tb 0: 1/25
+0, 0, 0, 1, 182160, abcf4f477f74b696faca2fcff1f62aa9
+0, 1, 1, 1, 182104, 7cbcf339fa40c24522067295b39d637f
+0, 2, 2, 1, 183108, dfc2c418f4379a89654c16b34ff19446
+0, 3, 3, 1, 182320, 62a4647b05709d86c51a18be16877e98
+0, 4, 4, 1, 181920, 61d63520703503f6e17fad67cbc08794
+0, 5, 5, 1, 182424, f467638396feabe613b3c851289452d8
+0, 6, 6, 1, 182248, 8a0cba950d6c5d63ba9603212ca95b0e
+0, 7, 7, 1, 181876, 91432f472cf373d5d4036bd100950f3e
+0, 8, 8, 1, 182104, 1c8852d82a48c1b01911ffbedf0ac1f4
+0, 9, 9, 1, 182540, f36b9d48123b55f2141ae10dd26e1ca0
+0, 10, 10, 1, 182120, e6ecdb9af6591916153ca9aeba76b9d0
+0, 11, 11, 1, 182136, 7dc7b828a5b7c652df612474fad66f6b
+0, 12, 12, 1, 181296, 347eac6563435a62f75298cefe13d3a6
+0, 13, 13, 1, 182136, 3bbcd8afacdf9549da9ebd736df548a7
+0, 14, 14, 1, 182412, 17f8c6ef692b4085624ce1ef7efbc963
+0, 15, 15, 1, 182732, 9212760fa11fe4fa193ba1aa259e9765
+0, 16, 16, 1, 181944, 7dd6d6a7084f97a77ec09ec6c62f0ab8
+0, 17, 17, 1, 182232, 518552687d47ae93726679f0ed962ef4
+0, 18, 18, 1, 181512, 29a66924742add13a0cae65d93d38ea9
+0, 19, 19, 1, 181424, 67c965637248333f92da9d493bf7546e
+0, 20, 20, 1, 180764, 298457c6c2b3f4ebcda87a12579f094d
+0, 21, 21, 1, 181072, 493ea592b7d59eebf01c002e7e22fc43
+0, 22, 22, 1, 181160, e30195fcc16ecfbb9348943cff01623f
+0, 23, 23, 1, 182156, d26cfac33e19b4ca11210c9e6cb91955
+0, 24, 24, 1, 182260, 963c157d3f0023b49d23099d53d60c8b
+0, 25, 25, 1, 181976, 2494d481bf2be97692eaeda95f279b0d
+0, 26, 26, 1, 181832, f1be95c840d4fcb0c8d4b7aed5b197c5
+0, 27, 27, 1, 181424, 03d92e89358a8b9b9e7cf302edde307e
+0, 28, 28, 1, 180632, 09f9e162fdaf28342c442172179a75c9
+0, 29, 29, 1, 180624, 481e7f7730ab3ba67c06faa620a8bd5e
+0, 30, 30, 1, 181024, 7a1d1b06b73d2bf41563eb749805780c
+0, 31, 31, 1, 181844, 8a6ce6dd6f79e423a3bb6c2b163adc55
+0, 32, 32, 1, 181712, a68007bbdf0169c9ed2dffae3dc63221
+0, 33, 33, 1, 182008, f37dd0635de369761e2de979ee799c3a
+0, 34, 34, 1, 181800, 14029ba1c364eca476559ce553919e99
+0, 35, 35, 1, 181840, ee227d15f15c3cd564dcad2160453fb7
+0, 36, 36, 1, 181848, 13b5d0892cc76a25b4914f2d706a0ad5
+0, 37, 37, 1, 181976, 1a0be9f2cefe0d867c5c03d6b3987ad8
+0, 38, 38, 1, 181216, 79795d735f9e0f92091203bf8b9eb9ed
+0, 39, 39, 1, 181236, 2d006c8c4ba448ca7841df76e44ffa88
+0, 40, 40, 1, 180672, ed5210abdae49042fcae9bde2f65a057
+0, 41, 41, 1, 181324, fbbc7839c595cd0f0efc0917edfed2c3
+0, 42, 42, 1, 180980, c6120b5a9440f4a0d83731627eb96d98
+0, 43, 43, 1, 181204, ac4371912d16f657c90e8a00cfafdfd2
+0, 44, 44, 1, 180720, d392d95c67349296d922dbf53ec3f832
+0, 45, 45, 1, 180028, 37a2717fbd5aaeb128812298484f8267
+0, 46, 46, 1, 179704, e8716f4856e4ccdc541632a218894f62
+0, 47, 47, 1, 179648, e99cbe5d1bbd7bce241ae500b4de06c2
+0, 48, 48, 1, 179424, 6f8a5e356fb77b61d9dfcabdf97340b9
+0, 49, 49, 1, 178980, 75a7700b822236b0ecb169fd692910f1
diff --git a/gst-libs/ext/libav/tests/ref/fate/utvideoenc_rgb_none b/gst-libs/ext/libav/tests/ref/fate/utvideoenc_rgb_none
new file mode 100644
index 0000000..d6c6962
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/utvideoenc_rgb_none
@@ -0,0 +1,51 @@
+#tb 0: 1/25
+0, 0, 0, 1, 301052, 8645cb98470205cceea3c2026223b69f
+0, 1, 1, 1, 301068, 9123c3c31ac0bc0832bb07e8c6d5b372
+0, 2, 2, 1, 300840, 394aa034eba2b306efa8171efc5fb960
+0, 3, 3, 1, 300904, 1abc4512d268bb7bb4b9f467aa19e5a8
+0, 4, 4, 1, 300912, e117d6f8d2bbd89bdce86cd5c4cf6206
+0, 5, 5, 1, 300936, d6a6c100e6dfd0e4dcdaa67ec59a757a
+0, 6, 6, 1, 300944, 3a0bf05461965bf2e538f5ed1067e784
+0, 7, 7, 1, 301044, 66e2fef970e8d997bb52f28eed9ad6fe
+0, 8, 8, 1, 301076, 6ae8f26125255c46be8c6da07d21ba35
+0, 9, 9, 1, 301044, 024d41f9d3b217b58ad6ba2a8f3b680d
+0, 10, 10, 1, 300944, 5dc0387f32b68e365c467f9dcc62b923
+0, 11, 11, 1, 300912, 47db16c6118feb2143fe0d1ec909bb51
+0, 12, 12, 1, 301044, 7161af85d2c85529b83548a701c6f5b7
+0, 13, 13, 1, 300964, 2dd90b4edcfc8d2b84168f42c7a47785
+0, 14, 14, 1, 300868, 76b296949227e7b22f204bec90dd02af
+0, 15, 15, 1, 300880, 44f9c830be2c9efdda335bf774f3b6c6
+0, 16, 16, 1, 301020, 70c1883ae4ff2ae8b0d5a608a75c839c
+0, 17, 17, 1, 301072, bac10cb932595594e4e8146831bbe00b
+0, 18, 18, 1, 301192, 46c2aa31dc33baa4d37f71f9873cbe6f
+0, 19, 19, 1, 301224, 396c406acf79cbe79c064ccbe7a3b648
+0, 20, 20, 1, 301180, 8d5d2071ddc79335f6785a921851905e
+0, 21, 21, 1, 301180, 9767bc30cadd23f0625e665e9b70ac31
+0, 22, 22, 1, 301116, fba702e0ab727d9446a7796790a10545
+0, 23, 23, 1, 301060, 9a08113dd947874b57d4cc85d56343ca
+0, 24, 24, 1, 301128, a58b1ebeb28fac3c88f64c8ba15f0591
+0, 25, 25, 1, 301144, e071b28b961f8d9c5da9b1ff41c24c2a
+0, 26, 26, 1, 301088, d19bed9054db25a718724d746d22c800
+0, 27, 27, 1, 301232, 70b2832bb0eb5f8a74e0bee411f66a46
+0, 28, 28, 1, 301152, 470bd72096d3ef6b5490b03cfdea438d
+0, 29, 29, 1, 301224, f3c285eb28a3c5b820276d3a68976df4
+0, 30, 30, 1, 301224, a432bfc1e022f189a70cbc963d716596
+0, 31, 31, 1, 301160, fbde0ac1bb6e5dbd870c1c6d8f03190c
+0, 32, 32, 1, 301120, 61f251db3d73483206609718063cfbb9
+0, 33, 33, 1, 301096, 6c1908eac263c8c3368683ced8078da4
+0, 34, 34, 1, 301000, 4b8df4fa83c085ea36369dbdd37f58bd
+0, 35, 35, 1, 301152, e2ceb9ff6b72b815e4b511a85dc0ae38
+0, 36, 36, 1, 301232, 27cc508ff5081f9c901c4eabd62e5835
+0, 37, 37, 1, 301228, bdb62b975b1cfe4ba8be08be1e8b1a5e
+0, 38, 38, 1, 301296, 13fc07f3935b70e98922233cf81bc7a4
+0, 39, 39, 1, 301296, 5fe19496257987b809e56e3c11192c43
+0, 40, 40, 1, 301308, a86115cd10e74c795739e8e325403ac6
+0, 41, 41, 1, 301268, 6c1f7bbf077ff58486f256e2ce9d01e6
+0, 42, 42, 1, 301344, 3fda739956dfa07a15cc5bd7e054568d
+0, 43, 43, 1, 301308, 54584061bcce46feb19aafa37922f923
+0, 44, 44, 1, 301292, 092e08d230dcfe4abd1460ef26c31421
+0, 45, 45, 1, 301344, 39ca46f9f38434aee15660263921f392
+0, 46, 46, 1, 301432, f7b76bebcfc614537c20bd6b20096d78
+0, 47, 47, 1, 301440, 86c97147d03bf7aee71073127c7fad32
+0, 48, 48, 1, 301460, 3fdbe5ae0b7e6b7ec0bc5668ba50a491
+0, 49, 49, 1, 301444, 8ef2e62af67f91e886b8f25456b38869
diff --git a/gst-libs/ext/libav/tests/ref/fate/utvideoenc_rgba_left b/gst-libs/ext/libav/tests/ref/fate/utvideoenc_rgba_left
new file mode 100644
index 0000000..757febe
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/utvideoenc_rgba_left
@@ -0,0 +1,51 @@
+#tb 0: 1/25
+0, 0, 0, 1, 195264, 5869dee2126d98ecc1fab1e69720906a
+0, 1, 1, 1, 195272, 1bd08dcde1061b0d9273bdc6dd901382
+0, 2, 2, 1, 195892, 2b3fc3632bcd1cc44f777fb97a56f79b
+0, 3, 3, 1, 195320, 792870fc50a4145ad561b1004a8b6451
+0, 4, 4, 1, 194640, c3d4031c46d6dc64e632e2d38b48fc96
+0, 5, 5, 1, 195072, 27e4b09e7f8446a8dd8dd7dcbc578e2b
+0, 6, 6, 1, 194488, e44441beb8d3e358112e2776a0116ea9
+0, 7, 7, 1, 195228, 0519afd694512aea2c839fe0456e518c
+0, 8, 8, 1, 194360, 7296944c86296fb256188975db6e5620
+0, 9, 9, 1, 195252, 40b53999a36ce413256c7a81c3aa0c44
+0, 10, 10, 1, 195000, 925fe520c460f94ae7a05cf0e6cf8dd8
+0, 11, 11, 1, 195532, af417aac106af9b4e8c04cf1a84d3bd8
+0, 12, 12, 1, 193836, 0eadf04f475a93ebef3979d32c13ee92
+0, 13, 13, 1, 194856, 5814ff44b233d68e4c991703c0fa6f44
+0, 14, 14, 1, 195760, e9a66bbeadeab4ed3f34296346eafc27
+0, 15, 15, 1, 195388, 17d33cd676c8b464d1b97ce0f0234716
+0, 16, 16, 1, 195248, 1054b945cd6e11e70d8b348e540e4dd5
+0, 17, 17, 1, 194792, f0a6ceee9014f6cf8a999f344897ad3e
+0, 18, 18, 1, 194044, 4fbf2b9fd8b7e8233f65b5bf61e326c0
+0, 19, 19, 1, 194324, eb90b72edafab7bbe5e9ff561313927c
+0, 20, 20, 1, 193872, 6ebc973b9f66e1ebdb3029f1aadd9a24
+0, 21, 21, 1, 193836, cde713fba6bede0361779c45f7a6d80b
+0, 22, 22, 1, 194872, 64225b7d92c8371ed0335d7693902f60
+0, 23, 23, 1, 195240, b11e0b10b4e713caffec706d952edb7b
+0, 24, 24, 1, 195516, 932244aee01b068f1bfb5132f092675b
+0, 25, 25, 1, 195508, 2745faafa2ec34dcf2cec2f5f791f49b
+0, 26, 26, 1, 195292, 6ff67783eabad9c72b146d510ffa0b7e
+0, 27, 27, 1, 194468, cc5aa248fe507ac3fbb839b9388856bc
+0, 28, 28, 1, 192516, 13063bb195380953743ab24a73ff6ddd
+0, 29, 29, 1, 192464, a391b0d795b2f565cc3e351975fb528d
+0, 30, 30, 1, 193696, 4239c695d1b9eaa44c2d037a9c39da20
+0, 31, 31, 1, 194500, 5857b4c4cc86a9a0f38d833c236e396c
+0, 32, 32, 1, 194364, ad0eeec7622c76bd996deac7e99390e5
+0, 33, 33, 1, 195916, b98da9283eef85f6dffe308774161441
+0, 34, 34, 1, 195560, 32f924fc40bb777c951481b623a8f46b
+0, 35, 35, 1, 195288, 96a7bb386420902fbb98b8267d4496ca
+0, 36, 36, 1, 194272, 98b88d6092708ffff416417d8f628477
+0, 37, 37, 1, 194464, 3c8295490b77415c2e4ebb7ce9b8cc53
+0, 38, 38, 1, 192712, 17798a13ba5f82939d98dfd619a68e18
+0, 39, 39, 1, 193036, b92ab54b363c1bd29042feeb3b9f5631
+0, 40, 40, 1, 193164, a971b68bb49148afdf510be5f5793933
+0, 41, 41, 1, 193528, 6fbf07d240e0073e57d295bdd0d32465
+0, 42, 42, 1, 194124, 4b1ddea464b8e40da48418e77b4fdf7a
+0, 43, 43, 1, 194236, d46914a9e2bdda30bf84b3282924bb3d
+0, 44, 44, 1, 193748, 3d4587081c6d73366d85e5df42c87810
+0, 45, 45, 1, 191752, 996274b3852ac6af30db8f9e242895e0
+0, 46, 46, 1, 191132, 5a1e47e4d1cc9e18e94041b4357a5de4
+0, 47, 47, 1, 191708, e3048c5ba2b9a494791cad3cbf843780
+0, 48, 48, 1, 191588, dbc63170a9b7be348497162c42a1b9f1
+0, 49, 49, 1, 191448, db923a15f424e69bbf8c8af2a2f7e157
diff --git a/gst-libs/ext/libav/tests/ref/fate/utvideoenc_rgba_median b/gst-libs/ext/libav/tests/ref/fate/utvideoenc_rgba_median
new file mode 100644
index 0000000..1198a33
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/utvideoenc_rgba_median
@@ -0,0 +1,51 @@
+#tb 0: 1/25
+0, 0, 0, 1, 195096, 29ad3287ab4d7f4d46968c6d38ba049b
+0, 1, 1, 1, 195040, 2c7b4f5f0aee96dca6dc30ce01b3c74d
+0, 2, 2, 1, 196044, 7ffc6ab3c4a2eee436ef6a59c72ffb04
+0, 3, 3, 1, 195256, f4453470d77c246cbb30d00c13512359
+0, 4, 4, 1, 194856, b84c4d56bf28033db539e4e0cad3d342
+0, 5, 5, 1, 195360, d2d3371b96f679f9b7c62d98b5d54af9
+0, 6, 6, 1, 195184, 8e3782bc12b24023a5899eb4806ffed6
+0, 7, 7, 1, 194812, 4fcf24a0660606304c58c93db2baf7de
+0, 8, 8, 1, 195040, 6ab57a9dcb4c99df7848a0971335a6b4
+0, 9, 9, 1, 195476, 66a3d66c3dc2f5b0847266a21927fa77
+0, 10, 10, 1, 195056, 530b251a8497af21bc56cd73af5c7ddf
+0, 11, 11, 1, 195072, 2904d24eca3db9734ed78dc8d557a334
+0, 12, 12, 1, 194232, 97566b596b113bf94a12ee1c02058a95
+0, 13, 13, 1, 195072, dceefd5df6efc5fefc8cfa1543b1a20e
+0, 14, 14, 1, 195348, d5b75f298fa6d474435333467b3497ae
+0, 15, 15, 1, 195668, 519f63be313f311cbb3fb48970a19f15
+0, 16, 16, 1, 194880, ab2da22767f540f8adea7e43dd6c1d0c
+0, 17, 17, 1, 195168, 667b85c19dd2d8ae105594f1294297b9
+0, 18, 18, 1, 194448, 575bc4b46f6158e76e503e8028902aaa
+0, 19, 19, 1, 194360, 851acbaf04c464689c8e2c4af3b9ed14
+0, 20, 20, 1, 193700, 1a477e0d665dcd088da6edeef77f21b1
+0, 21, 21, 1, 194008, b0d752c2201235e51ba0bbb59046fa60
+0, 22, 22, 1, 194096, 099df2b23c41ee54a6bd11aa6c92c390
+0, 23, 23, 1, 195092, e4d4dc89b8afba245355cec57ddcae40
+0, 24, 24, 1, 195196, 070c27e0499cf0210d729242ebc1a24e
+0, 25, 25, 1, 194912, 0fb78b7892035ecbec6ee9be6a13831c
+0, 26, 26, 1, 194768, 3ff6a05e68d6e33eeea22232e71bdf9a
+0, 27, 27, 1, 194360, 3828288e90a780d0c338ba5ab046aaa5
+0, 28, 28, 1, 193568, 60afb0ae9e6cbc9d8e4081764de7b4e6
+0, 29, 29, 1, 193560, 6b22fcfce4bff96b2afcb891f4fa9cf3
+0, 30, 30, 1, 193960, cae9eddb4464627fdc4413c3b5159575
+0, 31, 31, 1, 194780, 9e3d730fb835d3acaf92b7be368ea89e
+0, 32, 32, 1, 194648, 1ac7f5ae1b392ee8630266317a1818df
+0, 33, 33, 1, 194944, 374142509500017bbc29e157569bca2f
+0, 34, 34, 1, 194736, 0072a43b8de988683340c81e5bd4dba6
+0, 35, 35, 1, 194776, d5add7706f49a6a2f8d6bf3ed0ce3410
+0, 36, 36, 1, 194784, 7a1d38bc73fd293afef5fbcf9d34decd
+0, 37, 37, 1, 194912, 695e2d4c5d613245d591ae58100323bd
+0, 38, 38, 1, 194152, d4c9adb4f6340bc5f10b5b13f71d07bd
+0, 39, 39, 1, 194172, 0c7419c5c550e784e01a8c9927ecf59a
+0, 40, 40, 1, 193608, 4abff529172476d76c2956179041b2e4
+0, 41, 41, 1, 194260, dfa07971b01032b6a653d0d6715ffa8c
+0, 42, 42, 1, 193916, 6ffe1e68c74d51ea0cba0ede10b0f6f0
+0, 43, 43, 1, 194140, 46e18d23810193dd352fcc49b7c5ef6e
+0, 44, 44, 1, 193656, 4339d3e8b9dbeb376a1e19c4b86824f3
+0, 45, 45, 1, 192964, ff4680c71688f9944cd494105d2ab0b5
+0, 46, 46, 1, 192640, 62ce4b6d3311c34c73c6af1399fedfdc
+0, 47, 47, 1, 192584, f71b06a232a1a62a45ddac80c6f75090
+0, 48, 48, 1, 192360, 6642b9838eb32ed81d4d10a46ab9f954
+0, 49, 49, 1, 191916, d3ed1686383cfa7130ecc17c1ab52432
diff --git a/gst-libs/ext/libav/tests/ref/fate/utvideoenc_rgba_none b/gst-libs/ext/libav/tests/ref/fate/utvideoenc_rgba_none
new file mode 100644
index 0000000..555409f
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/utvideoenc_rgba_none
@@ -0,0 +1,51 @@
+#tb 0: 1/25
+0, 0, 0, 1, 301312, 6912d70f7c20db0b5079a99443ffe65c
+0, 1, 1, 1, 301328, 53f1b7d3c2f87ecfe9c9d305771421c5
+0, 2, 2, 1, 301100, 7040f2b50dc10b2565fa899ba007983d
+0, 3, 3, 1, 301164, 2bfe87a43842b21b083c166a5fcae979
+0, 4, 4, 1, 301172, e6535559b9cafb81d0f5312e6982228f
+0, 5, 5, 1, 301196, 899d3b7f4daca28b8d08fd80b9732332
+0, 6, 6, 1, 301204, 9ba8d921eb9345b9b90e5ec690cedbc6
+0, 7, 7, 1, 301304, 89d5758e5a4966d28fa3e6811822c9e6
+0, 8, 8, 1, 301336, b3f805d45e2cba1f3273fdc30e3d3d9c
+0, 9, 9, 1, 301304, 83c9ce5fdf5b20b29fc787ae20c5aa8f
+0, 10, 10, 1, 301204, 2cb730d551309ac307b69fb1e0f0bcbb
+0, 11, 11, 1, 301172, dc5d09bbd04e7b0a20521e67dbbad5f2
+0, 12, 12, 1, 301304, 9e08281b8be73b732b2793f7ffcf3bd4
+0, 13, 13, 1, 301224, 430fa7e9cc87e9292811601473bb03f9
+0, 14, 14, 1, 301128, 32eab97914c2f165e270e42e3c348ea0
+0, 15, 15, 1, 301140, c38233a19e22cc41957cd5a2e13bbca0
+0, 16, 16, 1, 301280, b87e1697217b744404d7998ec3dfac80
+0, 17, 17, 1, 301332, 231912bca1a1d4b54bc7ad392ca437c5
+0, 18, 18, 1, 301452, 30ce746afa3750735872fc9f2680e5b0
+0, 19, 19, 1, 301484, 9a56d219bcfb153190d17c8d89a0c5e3
+0, 20, 20, 1, 301440, c864010df06930259e712f7029a428b4
+0, 21, 21, 1, 301440, 1a4b6bf6557c65d5f088829602440819
+0, 22, 22, 1, 301376, f0ce8402bf00fcde4399da2f4088cd9f
+0, 23, 23, 1, 301320, 27d296bfd2df72c2fcf790098d2129cd
+0, 24, 24, 1, 301388, 0e78fec341c4d137959491e53ab23d92
+0, 25, 25, 1, 301404, 1ec3ca66bd6005cb754c00e346cdd895
+0, 26, 26, 1, 301348, b78ad47e42cfa510ab92d3ffc99371cf
+0, 27, 27, 1, 301492, 558f35abf593bf29a82e6353c75052d2
+0, 28, 28, 1, 301412, f44dae5d90ac9907b8847db0966e8d0b
+0, 29, 29, 1, 301484, 40d87d4e7c51bc2b3dede754c25e1b7e
+0, 30, 30, 1, 301484, 15dda8edd88e97f3db294bce9397e681
+0, 31, 31, 1, 301420, ff1dd12c16b295c83098a6b0135bd951
+0, 32, 32, 1, 301380, a290b1944381632a50fbb680f3f1af9e
+0, 33, 33, 1, 301356, 73d66b8546ac0698975af841dcea7a4c
+0, 34, 34, 1, 301260, 408ab0a50a74e7aaf196a202fd781892
+0, 35, 35, 1, 301412, bde264649818ed761d74281bf92a871e
+0, 36, 36, 1, 301492, c3612f4a8a748ffd6b43ccf24b2db821
+0, 37, 37, 1, 301488, 068ec12d90d1236e367caaf87f14da03
+0, 38, 38, 1, 301556, 000ee987cce47ab701e743d21a6607e6
+0, 39, 39, 1, 301556, 41277aa578fe7367c138a70b532bdf59
+0, 40, 40, 1, 301568, ebf086337aedfac24afc5c17715424d2
+0, 41, 41, 1, 301528, d8f0c31897748dfc761033f237f31f7f
+0, 42, 42, 1, 301604, 50b67f1d579eb8e7c5e0bdc438bf0ee2
+0, 43, 43, 1, 301568, 8297516127bb32a4326d6a859b2d8407
+0, 44, 44, 1, 301552, 1f9e1272e7249467631c4b9bd88bddcf
+0, 45, 45, 1, 301604, d835d90e9fc37583978c053bab5a96ed
+0, 46, 46, 1, 301692, fcb67990a58d25bff135fcc970714c4a
+0, 47, 47, 1, 301700, a4b0a26ed1626a4e46effa7987a32034
+0, 48, 48, 1, 301720, 44d53eab1be166c9bcc4b7b8bc3f80c9
+0, 49, 49, 1, 301704, 34314d5b44ea555b7d52958dec489fde
diff --git a/gst-libs/ext/libav/tests/ref/fate/utvideoenc_yuv420_left b/gst-libs/ext/libav/tests/ref/fate/utvideoenc_yuv420_left
new file mode 100644
index 0000000..cec5a28
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/utvideoenc_yuv420_left
@@ -0,0 +1,51 @@
+#tb 0: 1/25
+0, 0, 0, 1, 59796, a7136363bc4b9ac663178e5c7f24bae7
+0, 1, 1, 1, 60012, d296cf24776234599e22526598de838c
+0, 2, 2, 1, 61040, e889f81df51b75acf8131de97f9da4e3
+0, 3, 3, 1, 59656, a63c343139b1117260cf6f790ba87968
+0, 4, 4, 1, 58592, e2170222ac38ddc0703f5b537b4beb79
+0, 5, 5, 1, 60248, 0ea350ecf7d8a440b06a60550b5dfa4c
+0, 6, 6, 1, 60480, 792694fa65994c407fd76d06fdbbdc34
+0, 7, 7, 1, 59888, eaef81fd1fa459feb9a3b15817c861a4
+0, 8, 8, 1, 60080, 610a75f3c275ffef75006fb862642993
+0, 9, 9, 1, 60320, 1e1cc244d2ea6b259d06384d1a95cc89
+0, 10, 10, 1, 60300, ddbb7eb36b73cd4f1dc28ded5217952e
+0, 11, 11, 1, 60288, 13f14eed47e1c4fec9f99b47316f82b6
+0, 12, 12, 1, 59172, c7c205489a3b389290f2c56e66bf8ddb
+0, 13, 13, 1, 59664, 81eead1a1fe199e4b66e9bc2f04ac892
+0, 14, 14, 1, 61004, d02e17515451d4259d7179741d208b28
+0, 15, 15, 1, 61088, 4f1c9877caf59dc5ebf5646fe98b3ef5
+0, 16, 16, 1, 60072, 5c4c41d25e9aa0da07da89475275513b
+0, 17, 17, 1, 59876, aeeb1f7a68a23f9fd0503831bfeb2ed1
+0, 18, 18, 1, 59396, 154d2a0717aeb78e47e20bbc9d4aa69a
+0, 19, 19, 1, 59076, 3fdcb2330689aed91d92d515a9eb015a
+0, 20, 20, 1, 58740, 71a054852adaf0da188550fd77ae2069
+0, 21, 21, 1, 58584, 403746356fd559e9bace9bb37557e58e
+0, 22, 22, 1, 58952, 1a3d80d21e00ca5ce8c378da373c65d8
+0, 23, 23, 1, 59696, f66ace9c237d6ee91a4c23a957fde2a1
+0, 24, 24, 1, 60664, 69e6f45d9adf351650648b3fd6fc41b8
+0, 25, 25, 1, 59748, ed9e5524584eb0438f88e12af331009e
+0, 26, 26, 1, 59088, 4325aa8c838b5793364c6ab6ed904d84
+0, 27, 27, 1, 58752, 46a17359055b7ac3285c845af9701c74
+0, 28, 28, 1, 56928, a1fb544e10ee9806c80b5b80d85ef813
+0, 29, 29, 1, 56960, e17a9082644d542b3d589346d3421c51
+0, 30, 30, 1, 58140, f5ae6688db909252b67c3fbe62d783ff
+0, 31, 31, 1, 58980, 71a7053ff0857fa0651e2b8c5626598c
+0, 32, 32, 1, 59548, 60b3d97b4f3893b791894968b7586e99
+0, 33, 33, 1, 61248, ceb9cccd0327ae4c52d8a2cf009d15f7
+0, 34, 34, 1, 60032, ea2ce622422c4efa41069707b231fd52
+0, 35, 35, 1, 59252, b891818e1aba1e29c23fecbf405b03c0
+0, 36, 36, 1, 58568, 0aec4492ddb9608bf217f8b828378680
+0, 37, 37, 1, 58744, 0f218bdc62102270393e7973caa251aa
+0, 38, 38, 1, 58280, 89c93e37590d56c7c32f4955e59b7c54
+0, 39, 39, 1, 58236, 9575ac5076c1c347069b48aa8cb6381f
+0, 40, 40, 1, 57308, e4ede1a1ab344b39399b231fec0cf420
+0, 41, 41, 1, 58964, 9f9c800eddf1fbb093c7ae1320f2ec19
+0, 42, 42, 1, 58800, 9729551ff14d80a3b647bb9688e38cd1
+0, 43, 43, 1, 58716, f0d81b0b287bbe1decd18eac2873166b
+0, 44, 44, 1, 58136, e6aa11b60f8be9cd3d3e9d5c22b326ff
+0, 45, 45, 1, 56772, c3dd97f5d29511103b80edfcf39d2fe3
+0, 46, 46, 1, 55904, ae67aee10ae3b04ac2dc19158bb9c69f
+0, 47, 47, 1, 56344, f3c9c3dd5238c1f29f9204e1efeb6235
+0, 48, 48, 1, 56396, 93b8a198ac7c7118da0b581a50633df9
+0, 49, 49, 1, 55480, b2907ad8da8252dd6403b72eeb49b141
diff --git a/gst-libs/ext/libav/tests/ref/fate/utvideoenc_yuv420_median b/gst-libs/ext/libav/tests/ref/fate/utvideoenc_yuv420_median
new file mode 100644
index 0000000..ddd074b
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/utvideoenc_yuv420_median
@@ -0,0 +1,51 @@
+#tb 0: 1/25
+0, 0, 0, 1, 62876, c21650baa099fb2dfd35d4f8ddce16d1
+0, 1, 1, 1, 62832, 034a1996d13c15ee0bf482ddc398aac9
+0, 2, 2, 1, 64076, 1f39fd5fc926195b90a3374682a80eac
+0, 3, 3, 1, 62724, 4007f9193b9e3b19e991497bb73679ab
+0, 4, 4, 1, 61664, 3e86c3a2cd07807433ed7f46ede959ec
+0, 5, 5, 1, 63296, 4e7d334f3713ecc07fca77c945c758b7
+0, 6, 6, 1, 63528, 15b8f92a1d84e77521c539a9a02379ac
+0, 7, 7, 1, 62784, 07ead8344bde0c0a060c3313f39cf92e
+0, 8, 8, 1, 63176, 0a8d9329d7f66008a0d41c6ba4749b09
+0, 9, 9, 1, 63492, eefa6ba63516dd2ff9fb0a4e81169977
+0, 10, 10, 1, 63328, 991fd8fcb392774d11b1766cc1dbe0d7
+0, 11, 11, 1, 63328, e2745a89e96a7f0c641fa25a6ed2da83
+0, 12, 12, 1, 62384, 2dd300b64a32ae2d6fb65e88128e5147
+0, 13, 13, 1, 62944, 076331793373fe43cd213ae56fc19e0f
+0, 14, 14, 1, 63932, 37b6b50e7219ba0e593e4ce1de02a864
+0, 15, 15, 1, 64020, ed66d034f605621266054a54714feec9
+0, 16, 16, 1, 62940, fb6a921a8551db3d33b0a24e7e9a3ced
+0, 17, 17, 1, 63052, abac96a9e0128efd4362ec28e66464d2
+0, 18, 18, 1, 62408, 0351d4c9579779dbb398f68f0e4e02e4
+0, 19, 19, 1, 62148, b4f7ed147a1326cf5adae50af6db56ca
+0, 20, 20, 1, 61692, 48a9cdf3d4600768feca7616614dc46d
+0, 21, 21, 1, 61704, d8e6c2daa6ae50caf7d5ee9324812389
+0, 22, 22, 1, 61964, 3983f0bf566d206cde013982722d4453
+0, 23, 23, 1, 62812, b12b44c4df634f608380e2bfb26b717d
+0, 24, 24, 1, 63480, 30ad52da50e0d4f1fc811d24a01e777b
+0, 25, 25, 1, 62708, 2827bd4dec0fa603eaf92bae8c4deb72
+0, 26, 26, 1, 62252, fd7c3a5bcaf83701dd7f2da225f3ce69
+0, 27, 27, 1, 61752, ea9740f3a5f52baaa923e245f649f7c7
+0, 28, 28, 1, 60248, cf4a142fc28437cca11ad1d127a2948f
+0, 29, 29, 1, 60232, 6cd0b708ec41cd10357f8944ae8288bd
+0, 30, 30, 1, 61240, c4a44f902a295f3a6e85276087adcbc0
+0, 31, 31, 1, 62228, a36d5eafa03b784f35303b131ac5d3a0
+0, 32, 32, 1, 62636, e09ca8f58690f991e1ce3986c2864924
+0, 33, 33, 1, 63840, 830de5062cb9c8be8844118c7db4bcef
+0, 34, 34, 1, 62996, e008d4add85b595840a2773d01465147
+0, 35, 35, 1, 62480, 04a38e7c231697aa97e5a401d4329105
+0, 36, 36, 1, 61744, 4cb276703869f45a6ab798e53e615fc0
+0, 37, 37, 1, 62012, dfca9b52389b01d750a4b94d10a8e2e0
+0, 38, 38, 1, 61748, bf2ec90514c268440313fecf68e2f41f
+0, 39, 39, 1, 61688, 99f1c565dc76bde773ccb91b8dbb3860
+0, 40, 40, 1, 60528, 7b66ad4e019964ead8ed1a9eadad9721
+0, 41, 41, 1, 62248, 795e2a8351ac78bc482e341be3af98bb
+0, 42, 42, 1, 61832, d7fc01097c5ec0247d20727aec2adab6
+0, 43, 43, 1, 61688, 4492ffefcaed530fce3221f4bb61ef80
+0, 44, 44, 1, 61216, d9a91c3007686b7166f297bc1dddb9a9
+0, 45, 45, 1, 60192, 7c808c46b376c49fa3d5bd5ba97fce1c
+0, 46, 46, 1, 59388, 6d2a2a72d14ff5c800295de6b2e23465
+0, 47, 47, 1, 59620, 5c1aa124bb6ffb9cd33a6430bf07ea9f
+0, 48, 48, 1, 59584, efc1012cca50e509856e406622d760fe
+0, 49, 49, 1, 58800, fa8563a0bc6022f8f5c5fc70ce0d46f3
diff --git a/gst-libs/ext/libav/tests/ref/fate/utvideoenc_yuv420_none b/gst-libs/ext/libav/tests/ref/fate/utvideoenc_yuv420_none
new file mode 100644
index 0000000..555eee2
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/utvideoenc_yuv420_none
@@ -0,0 +1,51 @@
+#tb 0: 1/25
+0, 0, 0, 1, 144508, 83af3948090ebb44a0091815e4edc61e
+0, 1, 1, 1, 144496, 950742e357ee489fcda4f783b8df3b4c
+0, 2, 2, 1, 144376, 4b818cf0a50e9338fea26101073e445e
+0, 3, 3, 1, 144420, 0335c3b97dca65e9118a12e3cceb1e24
+0, 4, 4, 1, 144588, a9f7e6cb2d9129d97342c4eb67349aa8
+0, 5, 5, 1, 144444, b956115c6bab18a01594103bcb2ba9e0
+0, 6, 6, 1, 144408, 81761b3135ab3f4d5efd6f2790b6b70f
+0, 7, 7, 1, 144408, 566c53ee4126e31b78f6572292f97f55
+0, 8, 8, 1, 144320, 0c24c346a65cb945f8d804817f67f42e
+0, 9, 9, 1, 144316, 7920264636a6933c776b41567181f2d9
+0, 10, 10, 1, 144248, c1c1b10356f27fca35e03fdc67dd1638
+0, 11, 11, 1, 144168, 5a590c4f603aaddd01d4efbf5571426e
+0, 12, 12, 1, 144452, 10459aa8f48f7e8e0ebc03f15f795acd
+0, 13, 13, 1, 144312, 436658612212e706c4ed9f4bdcf45f38
+0, 14, 14, 1, 144252, 7a5612c485c501669e27039c435ac5d3
+0, 15, 15, 1, 144232, 81018c3b49d376d69af71a4ee2c910a9
+0, 16, 16, 1, 144312, 4280abfc59ee6cfddbf45474a42c5cd5
+0, 17, 17, 1, 144348, 0a48ba8ad15f7431830feeb2ac0f2118
+0, 18, 18, 1, 144356, 6c8f0a396195a840a225aca3ada427ff
+0, 19, 19, 1, 144360, 4a0a959d9c3ebb293d94ef37b4f7f19e
+0, 20, 20, 1, 144380, e61b564126a2d8255a7457b70af74514
+0, 21, 21, 1, 144416, fe434ae640e63fb774d6e7c864d02e49
+0, 22, 22, 1, 144344, 9e106257c640b66ca31919668c4da334
+0, 23, 23, 1, 144376, c0cdd6b2aa1bf4d89c82b602f09fa2e0
+0, 24, 24, 1, 144376, 8be60289a2a4c22355b3bd43f2f85fe4
+0, 25, 25, 1, 144320, 124127b8fcacfa5c5e0ee7f0324da7a0
+0, 26, 26, 1, 144408, a5639aedbdbfff34f36dda8872992cde
+0, 27, 27, 1, 144516, fbe3cf39fd764e6a3d05c63be35a4d58
+0, 28, 28, 1, 144676, 6ee82422712e11740d7b003eab69d5bd
+0, 29, 29, 1, 144648, e5f446835709b1baaca14af3aa6fbbb7
+0, 30, 30, 1, 144496, 3b23fb07c528ad824e9c8f10143ae06a
+0, 31, 31, 1, 144496, 4e4dddd0c72f9d3a555b8d32ae82c10e
+0, 32, 32, 1, 144372, 1dfe88fbe0c1193bb04a06840dfab155
+0, 33, 33, 1, 144168, e03b3d67fcbbde71c6985955feebabfe
+0, 34, 34, 1, 144180, 5d5a24b49cff98cbb85f69b547b43e87
+0, 35, 35, 1, 144348, bb9172de1a4c7a00fe80bb673484781b
+0, 36, 36, 1, 144544, 7824a6c4bb8b919306904be6f67f2736
+0, 37, 37, 1, 144516, 456c3884817909b4cca38f8138c079d4
+0, 38, 38, 1, 144532, 0e63cf833a33a9fac9e5969342817fc2
+0, 39, 39, 1, 144452, 9c0155cdd0a5ae42b79475ab47ba87f7
+0, 40, 40, 1, 144532, eefee218d181e74a80a1d2ec27932e91
+0, 41, 41, 1, 144348, fbd4fd20565350dd927005af590912ff
+0, 42, 42, 1, 144332, eac5c49230fb807c81e8a0c9e9721697
+0, 43, 43, 1, 144428, 9ee3fe8be6c4477b0d8ff1d91049634e
+0, 44, 44, 1, 144480, b58fb19549e4497e82491a26d67c1567
+0, 45, 45, 1, 144596, 1c8059bf14f4df3da9db6b89f87a52b9
+0, 46, 46, 1, 144592, db8a5750beb049ea835895d23e924cab
+0, 47, 47, 1, 144512, 58c69889edb9bdab219d698f6a44d2cf
+0, 48, 48, 1, 144468, 3da8e5ae1f1ff9da72abd3d2ac87a7b9
+0, 49, 49, 1, 144500, 4f80ccdb6f9549190ed72407dd7af2c1
diff --git a/gst-libs/ext/libav/tests/ref/fate/utvideoenc_yuv422_left b/gst-libs/ext/libav/tests/ref/fate/utvideoenc_yuv422_left
new file mode 100644
index 0000000..d9afc2c
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/utvideoenc_yuv422_left
@@ -0,0 +1,51 @@
+#tb 0: 1/25
+0, 0, 0, 1, 91788, e14e576f1f9abd095f13ceca627adb59
+0, 1, 1, 1, 92140, 4b7db11c2d35fa91ff1b6f65c184e3fa
+0, 2, 2, 1, 93268, 6ef5cb83a4db2afbf14467cbc4b6c4f7
+0, 3, 3, 1, 91612, f08ae129a2867a08770bdb61381bf366
+0, 4, 4, 1, 90456, ed3edabe09b9f6cfbf452a08dafa556d
+0, 5, 5, 1, 92180, a0760e91b3af27a7c1bb0264f128ca50
+0, 6, 6, 1, 92200, 2fda4c87dfa34206173e852b67841406
+0, 7, 7, 1, 91872, 944e7c88c7ebeae9e1efac859ea4fe7d
+0, 8, 8, 1, 91952, 34112ec99382b80c397d26cef93573c7
+0, 9, 9, 1, 92312, 63698686348ccd80cc920e9e73a195aa
+0, 10, 10, 1, 92308, 6a675d6678b7b78fac6375d44f325d06
+0, 11, 11, 1, 92272, bc1401e0acd3864ad30711ca4b61578d
+0, 12, 12, 1, 90920, cd7ecda23a4f312abe71bd3fc28af3e7
+0, 13, 13, 1, 91612, 91ebce52e2594296349476f3bf6a6408
+0, 14, 14, 1, 93112, 34be111d02130ed7389c0c62768041de
+0, 15, 15, 1, 93140, e1b440cad63dbf8ff034f424cd1194cc
+0, 16, 16, 1, 92080, 94181fde8563af0b6810f778f6b1d92b
+0, 17, 17, 1, 91816, ed0997f9b341fc3ab6a8c5d9a4067bd2
+0, 18, 18, 1, 91204, d833b0c3b3dfe60b079b746c4c3aed7f
+0, 19, 19, 1, 90880, 0d4702abb70d7cbc8843a96e3a74117a
+0, 20, 20, 1, 90408, 409860b79fe10ffbffd581c19445fa91
+0, 21, 21, 1, 90280, 5360fa4f1afd8c2c55cf33675a928a14
+0, 22, 22, 1, 90808, fe2ca67d315fb1d8806ee04470d06378
+0, 23, 23, 1, 91584, 84168a6fe20ee00ddd9f54ce8f1e1810
+0, 24, 24, 1, 92684, 6fb3d7193d3bb5400c449717358827e0
+0, 25, 25, 1, 91580, acd2aa86dbae6e133183e5bf2ca389a3
+0, 26, 26, 1, 90928, cc0df9c8e00df5985e39ae486eb59eff
+0, 27, 27, 1, 90536, 8f9d294190c03435f3cee266cca2a31a
+0, 28, 28, 1, 88364, ae9564ad4eb3c1fc03e4befb4b1e719e
+0, 29, 29, 1, 88404, 745a16947203cd7017900b137fca70eb
+0, 30, 30, 1, 89844, 1b7e75be9edb25ffe91c54e270eb8f46
+0, 31, 31, 1, 90752, 9ff03fa3b28f2c84a4da41779e0a2aa4
+0, 32, 32, 1, 91320, 409ed4c3eced8793760505cf8095f51a
+0, 33, 33, 1, 93204, 70865d89c930919474500befe0e2ec3f
+0, 34, 34, 1, 92036, 7388d12a6954b9870749ab6a5f05815f
+0, 35, 35, 1, 91144, b47bfdaec4c00177a9258a03e864400f
+0, 36, 36, 1, 90368, 418df89a063f66cfbb1f806d68aca6a2
+0, 37, 37, 1, 90628, 3f90314ab7311ad0f4bd4808d62a1e80
+0, 38, 38, 1, 89836, 414f90d0efc65b993f6e1fc8f2c1d860
+0, 39, 39, 1, 89792, a07cf9fc580ffee5d61c241dce116ae6
+0, 40, 40, 1, 88896, 3d583229da6b7455b6876843b3b747c7
+0, 41, 41, 1, 90572, cbef36619e7c8e62fc21a735c7701514
+0, 42, 42, 1, 90544, 144816eaeaf0412fca6bf40e6f3e6d3f
+0, 43, 43, 1, 90416, 76f0d9dd1f4fd00b68223dd7c6024b2e
+0, 44, 44, 1, 89788, ce0b66e45ed3c50124680f84614c5ac0
+0, 45, 45, 1, 88120, 5d59770b187109e2e6824f5cb42b9b73
+0, 46, 46, 1, 87164, bb52ce20f4a21ef82a2cc3316ba69e1c
+0, 47, 47, 1, 87632, 87f44c3ecebd09b2ffa94d8ace01f3f3
+0, 48, 48, 1, 87700, cbaed2ac667bdc9aa17ffc68ebaea790
+0, 49, 49, 1, 86624, 21797bc69a89976f9b4b552603a63267
diff --git a/gst-libs/ext/libav/tests/ref/fate/utvideoenc_yuv422_median b/gst-libs/ext/libav/tests/ref/fate/utvideoenc_yuv422_median
new file mode 100644
index 0000000..e1c8fcd
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/utvideoenc_yuv422_median
@@ -0,0 +1,51 @@
+#tb 0: 1/25
+0, 0, 0, 1, 89732, 698174b0d0d68e98774363ca7926f6e1
+0, 1, 1, 1, 89652, f0789b7c32ef44207dfc5a454bb5ccee
+0, 2, 2, 1, 90868, 6df1dcb1957efca736e88adfbad8557b
+0, 3, 3, 1, 89520, 9cee942e7f03a97cd2cdf8cea429fb31
+0, 4, 4, 1, 88508, 798f4e8c00f4d949882cdc3f89be0bf6
+0, 5, 5, 1, 90140, 70fc5f4f240b0ca30332b0f37632d1cb
+0, 6, 6, 1, 90176, 1c2747fc56d5eb70ff8f4f361cb70610
+0, 7, 7, 1, 89392, bd8764124753f784d5984cd829c8ca90
+0, 8, 8, 1, 89848, 1dc30ed23a8634f6b2661ac8583fe8cc
+0, 9, 9, 1, 90356, 0910ae7c3a6924031453f458009354fa
+0, 10, 10, 1, 89984, 61da06bf1ed667b54ee749c69ab031eb
+0, 11, 11, 1, 90012, 11d05491f86014f19b34cab3111a95d2
+0, 12, 12, 1, 89072, 4598f16727472daa1710c39b4840efdc
+0, 13, 13, 1, 89776, ed6c0da32acf621e9f79b76a3afaa280
+0, 14, 14, 1, 90680, 05f3a9232bc14ca8721ef04243177a20
+0, 15, 15, 1, 90852, e4deff113ea503656efecb227f6b702a
+0, 16, 16, 1, 89844, 5ee70abd6f1d2e5c55117b28840327e6
+0, 17, 17, 1, 89852, 6721997ae0563009adbdeed31f437ce4
+0, 18, 18, 1, 89144, 8a40f0af74afb4ff05e6242a41c7789f
+0, 19, 19, 1, 88880, 8824c3526629a30fbf9a53abc448844c
+0, 20, 20, 1, 88344, 18a656127a16bb50113bb2e98b11a26d
+0, 21, 21, 1, 88464, 19a3b9510e6347a7782f695b48736991
+0, 22, 22, 1, 88588, e3d22d15b4812c26214db546ce17c7dd
+0, 23, 23, 1, 89720, afe800faa0188dff0899cd83af6301d6
+0, 24, 24, 1, 90216, a9d9ece70c978c595e1d724a0f644f56
+0, 25, 25, 1, 89456, 9bf3e8f87f072d55095acc9351a09f45
+0, 26, 26, 1, 88992, 40d1b1858f1ba0bebd9eb9f5263cda9d
+0, 27, 27, 1, 88632, 1df39644ac99bccab4c6bd72498284c4
+0, 28, 28, 1, 87048, 9983cd95307c1bab653170ba2aecdc55
+0, 29, 29, 1, 87120, 006b48403af94a0bc5121900b48af9c1
+0, 30, 30, 1, 88044, 652d17c8805de56cd83824d99888822e
+0, 31, 31, 1, 89016, 652a971973d088b5098a06b216137151
+0, 32, 32, 1, 89324, 2775a087358ead0281ce188f4006050d
+0, 33, 33, 1, 90328, 564e119bdf5f3c780c0613990ca487db
+0, 34, 34, 1, 89684, 1f5fb4ec22234aee771791b71881b630
+0, 35, 35, 1, 89216, dde7a003cfe5b47f9be407f28dcdfb3f
+0, 36, 36, 1, 88644, 1fed2d2f72ec9488181a06606aaf4e12
+0, 37, 37, 1, 89000, 8f916bee0ad8efe8d3572e4af4bf4b8e
+0, 38, 38, 1, 88628, d802fb5634d3acd72a96bd99c22dd566
+0, 39, 39, 1, 88448, a4d438df349f1f2ff1620fb965d08513
+0, 40, 40, 1, 87332, 18a8527dcfc5c1fa8ae7aa8a83781d2d
+0, 41, 41, 1, 88856, 63179f19a5d60d3ea9fa14c00ca5c493
+0, 42, 42, 1, 88556, 92b568c24ed53e823b54fa6c064d16ac
+0, 43, 43, 1, 88380, c204b982e3ab7fc1aa6b1b132c4ae462
+0, 44, 44, 1, 87888, 45f1cd55d454a0b611b047b6e5172b30
+0, 45, 45, 1, 86876, c668ac58b31feb51902b78fdfcdc1064
+0, 46, 46, 1, 86272, 24a94950de7065cb236e52502c9c8e67
+0, 47, 47, 1, 86388, 51dad738cd8896616694a4fb52b47fbd
+0, 48, 48, 1, 86188, dc6709cd2722eb8dd927f405c6a30915
+0, 49, 49, 1, 85244, 68f40045a250ab0799a7325aa16ec80c
diff --git a/gst-libs/ext/libav/tests/ref/fate/utvideoenc_yuv422_none b/gst-libs/ext/libav/tests/ref/fate/utvideoenc_yuv422_none
new file mode 100644
index 0000000..ca77177
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/utvideoenc_yuv422_none
@@ -0,0 +1,51 @@
+#tb 0: 1/25
+0, 0, 0, 1, 191800, 0e1d199f87997ba47e98596b6087d7d4
+0, 1, 1, 1, 191820, b35714d0635214095ac06d35da00ed32
+0, 2, 2, 1, 191668, 8336829e44f5b90034e5da33dcd27f1f
+0, 3, 3, 1, 191696, ebff701893f27b026fe6fec4a1cbd90b
+0, 4, 4, 1, 191976, c2729ecde4337a51192da71b0ef36e7d
+0, 5, 5, 1, 191760, e2ef2db5ef30019d5fd24cd32c696318
+0, 6, 6, 1, 191708, 638eb1c1b68bc9f4cc315ebdd3bd86f5
+0, 7, 7, 1, 191688, aca858d2cce189eb60012a33ea74d10b
+0, 8, 8, 1, 191576, aa933dea9aac9b61fea004747e3b8e6a
+0, 9, 9, 1, 191544, 6c410ec9e2492d464d439a58e6e338c3
+0, 10, 10, 1, 191472, 7c7661ff35671b3912b2b216bc6df478
+0, 11, 11, 1, 191280, 73c1ff53a0cd5c65eb2ae75a45efbf72
+0, 12, 12, 1, 191700, 201b0b4834878513e6e13bd9f5977a28
+0, 13, 13, 1, 191424, 0affff549b2da09c7852c5e8dbd1c84a
+0, 14, 14, 1, 191420, e0e80adf520953c4bc4033efc77b9092
+0, 15, 15, 1, 191408, 4fa22efbf2101b7f6bfffae227ce1d23
+0, 16, 16, 1, 191500, fef8df893234b38be36803d5f5656e16
+0, 17, 17, 1, 191580, 3585b500a77344fd87f8f18e3816f1a8
+0, 18, 18, 1, 191608, 419189483180612b72491dab5864c6e7
+0, 19, 19, 1, 191616, 197fa32c8a164eeea73defb7422657d1
+0, 20, 20, 1, 191596, a660a6c630f7e55c3ca2f9a37d599223
+0, 21, 21, 1, 191660, d98445b0387c3d54034f8defe1d03ea6
+0, 22, 22, 1, 191540, ef4522aa762b82d1c715805a779c7c1e
+0, 23, 23, 1, 191576, 32d109d2040c69b3944471b0bd399a65
+0, 24, 24, 1, 191636, 58e2f3a01de4175ba7f915e2d065ba36
+0, 25, 25, 1, 191524, 0989a64e78613cfc26124e195cfc0cde
+0, 26, 26, 1, 191640, b9e252a5c4583736a8ba248d15c429aa
+0, 27, 27, 1, 191800, 1541cccc66cb63d3e1ef675a16a1258e
+0, 28, 28, 1, 192028, 5dada6bf987738caebca210067d13c39
+0, 29, 29, 1, 191964, 8d55bb4a1464ac74364d4b1e416d4a0c
+0, 30, 30, 1, 191736, 88c279b9f3e96485f85dbca09177fe26
+0, 31, 31, 1, 191788, aa75795116428edb57dea8b54527e13b
+0, 32, 32, 1, 191636, aa45e4ec1fcc038ea2e48046e5047417
+0, 33, 33, 1, 191400, 7b2861b3ca8bfcdca010d859c0595e03
+0, 34, 34, 1, 191332, 956acfcc00661d9a9ba7575e8c1a011b
+0, 35, 35, 1, 191548, 3b5b7c3b9a6a5ebe10f178077a5fea4d
+0, 36, 36, 1, 191852, 835219e1689946f3e26457ffce197181
+0, 37, 37, 1, 191828, f67a1e4640472287baf194c02f24dc29
+0, 38, 38, 1, 191812, 978f44d430859044350ea20913ae4194
+0, 39, 39, 1, 191700, 92e21c9ded61f69f793c649eece071c4
+0, 40, 40, 1, 191812, 0a460bc35daad68e8042917f26dac542
+0, 41, 41, 1, 191548, 7c7a65b9257f9b4439002c5c414c401c
+0, 42, 42, 1, 191544, b03d903c46536dc336461827fd4d34db
+0, 43, 43, 1, 191700, 75b391d84b120e63ec229fcb48808d19
+0, 44, 44, 1, 191780, c953dcd42a8aa19eb4d4be0149894bbe
+0, 45, 45, 1, 191952, 64be44b2e21f8301f4234e32a10cb1c9
+0, 46, 46, 1, 191916, a6c805f651f3f57a84681b1aab6fe3ef
+0, 47, 47, 1, 191784, 9cc8db3cb63a026645f634aabc89c37b
+0, 48, 48, 1, 191716, e2f0c7543b3484a726411eac4e9a79cd
+0, 49, 49, 1, 191728, 50277180199917d1259e0cad42f52d4c
diff --git a/gst-libs/ext/libav/tests/ref/fate/v210 b/gst-libs/ext/libav/tests/ref/fate/v210
index 6a551a5..2847564 100644
--- a/gst-libs/ext/libav/tests/ref/fate/v210
+++ b/gst-libs/ext/libav/tests/ref/fate/v210
@@ -1 +1,2 @@
-0, 0, 3686400, 0x75ee1dde
+#tb 0: 1/50
+0, 0, 0, 1, 3686400, 0x75ee1dde
diff --git a/gst-libs/ext/libav/tests/ref/fate/v410dec b/gst-libs/ext/libav/tests/ref/fate/v410dec
index f72d74f..98b2816 100644
--- a/gst-libs/ext/libav/tests/ref/fate/v410dec
+++ b/gst-libs/ext/libav/tests/ref/fate/v410dec
@@ -1 +1,2 @@
-0, 0, 393216, 0xfe11a6b0
+#tb 0: 1/25
+0, 0, 0, 1, 393216, 0xfe11a6b0
diff --git a/gst-libs/ext/libav/tests/ref/fate/v410enc b/gst-libs/ext/libav/tests/ref/fate/v410enc
index e5332de..ab219bb 100644
--- a/gst-libs/ext/libav/tests/ref/fate/v410enc
+++ b/gst-libs/ext/libav/tests/ref/fate/v410enc
@@ -1 +1 @@
-979c9a9a09e8eaaf6467b8c22c0ac8bb
+e5c0b1f17d2a64a416dcf9bf7a38d9d9
diff --git a/gst-libs/ext/libav/tests/ref/fate/vble b/gst-libs/ext/libav/tests/ref/fate/vble
index 748052e..8c4250f 100644
--- a/gst-libs/ext/libav/tests/ref/fate/vble
+++ b/gst-libs/ext/libav/tests/ref/fate/vble
@@ -1,4 +1,5 @@
-0, 0, 1382400, 0x5e1bc307
-0, 3003, 1382400, 0x198795f7
-0, 6006, 1382400, 0xa9102ac2
-0, 9009, 1382400, 0x9e347932
+#tb 0: 1001/30000
+0, 0, 0, 1, 1382400, 0x5e1bc307
+0, 1, 1, 1, 1382400, 0x198795f7
+0, 2, 2, 1, 1382400, 0xa9102ac2
+0, 3, 3, 1, 1382400, 0x9e347932
diff --git a/gst-libs/ext/libav/tests/ref/fate/vc1-ism b/gst-libs/ext/libav/tests/ref/fate/vc1-ism
index 886e583..4daca95 100644
--- a/gst-libs/ext/libav/tests/ref/fate/vc1-ism
+++ b/gst-libs/ext/libav/tests/ref/fate/vc1-ism
@@ -1,120 +1,121 @@
-0, 0, 37440, 0xd1bc5235
-0, 3750, 37440, 0x158e6167
-0, 7500, 37440, 0x0faa4481
-0, 11250, 37440, 0x427158c5
-0, 15000, 37440, 0x4eb53ac6
-0, 18750, 37440, 0x99304eea
-0, 22500, 37440, 0xcc554a6f
-0, 26250, 37440, 0xabeb6c35
-0, 30000, 37440, 0xddfc7e18
-0, 33750, 37440, 0xaa79b504
-0, 37500, 37440, 0x5cb1c839
-0, 41250, 37440, 0x7e36ecca
-0, 45000, 37440, 0xf486f425
-0, 48750, 37440, 0xf1b4138f
-0, 52500, 37440, 0x966f1a49
-0, 56250, 37440, 0x5eff21da
-0, 60000, 37440, 0x333f39b1
-0, 63750, 37440, 0x62e5963e
-0, 67500, 37440, 0x26930671
-0, 71250, 37440, 0x27b4bb6c
-0, 75000, 37440, 0xdbd07766
-0, 78750, 37440, 0x04260104
-0, 82500, 37440, 0x9b1e078b
-0, 86250, 37440, 0xdf4e2474
-0, 90000, 37440, 0x57d44986
-0, 93750, 37440, 0x8780e34c
-0, 97500, 37440, 0xf80c8bc0
-0, 101250, 37440, 0x630a7583
-0, 105000, 37440, 0x235ae089
-0, 108750, 37440, 0x984b8f0e
-0, 112500, 37440, 0x865cf592
-0, 116250, 37440, 0x70f376f2
-0, 120000, 37440, 0x8b30c035
-0, 123750, 37440, 0xde772d79
-0, 127500, 37440, 0x8e076be5
-0, 131250, 37440, 0x3dc2bd9f
-0, 135000, 37440, 0xb782eb67
-0, 138750, 37440, 0x02025d73
-0, 142500, 37440, 0x86bbbce8
-0, 146250, 37440, 0xd6554f62
-0, 150000, 37440, 0xb831b917
-0, 153750, 37440, 0x80643560
-0, 157500, 37440, 0x4ecf9afd
-0, 161250, 37440, 0x9ce51e0b
-0, 165000, 37440, 0x179466cd
-0, 168750, 37440, 0x145fc900
-0, 172500, 37440, 0xb1b50402
-0, 176250, 37440, 0x0a87552a
-0, 180000, 37440, 0x8f53821d
-0, 183750, 37440, 0x1c07c825
-0, 187500, 37440, 0x49dde82f
-0, 191250, 37440, 0xb1a32605
-0, 195000, 37440, 0x410f3cd5
-0, 198750, 37440, 0xff5e6696
-0, 202500, 37440, 0x96f678c9
-0, 206250, 37440, 0x6c9e9e68
-0, 210000, 37440, 0x79a2a655
-0, 213750, 37440, 0xf237bd6c
-0, 217500, 37440, 0x4051b611
-0, 221250, 37440, 0xc7ccc918
-0, 225000, 37440, 0xbd02c122
-0, 228750, 37440, 0xacb3c881
-0, 232500, 37440, 0x2abdb940
-0, 236250, 37440, 0x19d5be85
-0, 240000, 37440, 0xfa5fb1ba
-0, 243750, 37440, 0xdae7a7aa
-0, 247500, 37440, 0x6b0f9f69
-0, 251250, 37440, 0x353e8201
-0, 255000, 37440, 0xa21443aa
-0, 258750, 37440, 0x66c8d7e0
-0, 262500, 37440, 0xc332068e
-0, 266250, 37440, 0x71431b9b
-0, 270000, 37440, 0x392f15cb
-0, 273750, 37440, 0x95a146bb
-0, 277500, 37440, 0x7c51740a
-0, 281250, 37440, 0xa3bdd43c
-0, 285000, 37440, 0xa079f965
-0, 288750, 37440, 0xa95423ea
-0, 292500, 37440, 0xd1bd2c67
-0, 296250, 37440, 0x6cf82844
-0, 300000, 37440, 0xd401e128
-0, 303750, 37440, 0x1f7db118
-0, 307500, 37440, 0x2e0a65a9
-0, 311250, 37440, 0x321c1c40
-0, 315000, 37440, 0x95b2a127
-0, 318750, 37440, 0xa1471f4b
-0, 322500, 37440, 0x29d148c0
-0, 326250, 37440, 0x24c07107
-0, 330000, 37440, 0x0ead678d
-0, 333750, 37440, 0xd0ca6495
-0, 337500, 37440, 0x08f935ef
-0, 341250, 37440, 0xb5ec3c38
-0, 345000, 37440, 0xce371628
-0, 348750, 37440, 0x68170812
-0, 352500, 37440, 0xe222699e
-0, 356250, 37440, 0xd688706c
-0, 360000, 37440, 0x81a033f9
-0, 363750, 37440, 0x28bd0fbf
-0, 367500, 37440, 0xe36db7b2
-0, 371250, 37440, 0x30559121
-0, 375000, 37440, 0xbf2b5fc8
-0, 378750, 37440, 0x4b427672
-0, 382500, 37440, 0x0544b0b4
-0, 386250, 37440, 0x38a70b06
-0, 390000, 37440, 0x4ed62607
-0, 393750, 37440, 0x6efe8ea6
-0, 397500, 37440, 0x81197e11
-0, 401250, 37440, 0xf4060050
-0, 405000, 37440, 0xaf205f13
-0, 408750, 37440, 0x5fa21382
-0, 412500, 37440, 0x8627ad05
-0, 416250, 37440, 0xf7130133
-0, 420000, 37440, 0x76dea7ba
-0, 423750, 37440, 0x1dbae1be
-0, 427500, 37440, 0x74a933f7
-0, 431250, 37440, 0xbdcd41a3
-0, 435000, 37440, 0xf0fe8c1c
-0, 438750, 37440, 0xc0036222
-0, 442500, 37440, 0x3058385c
-0, 446250, 37440, 0x68141016
+#tb 0: 1/10000000
+0, 423334, 423334, 0, 37440, 0xd1bc5235
+0, 840000, 840000, 0, 37440, 0x158e6167
+0, 1256666, 1256666, 0, 37440, 0x0faa4481
+0, 1670000, 1670000, 0, 37440, 0x427158c5
+0, 2086666, 2086666, 0, 37440, 0x4eb53ac6
+0, 2500000, 2500000, 0, 37440, 0x99304eea
+0, 2916666, 2916666, 0, 37440, 0xcc554a6f
+0, 3340000, 3340000, 0, 37440, 0xabeb6c35
+0, 3756666, 3756666, 0, 37440, 0xddfc7e18
+0, 4170000, 4170000, 0, 37440, 0xaa79b504
+0, 4586666, 4586666, 0, 37440, 0x5cb1c839
+0, 5000000, 5000000, 0, 37440, 0x7e36ecca
+0, 5416666, 5416666, 0, 37440, 0xf486f425
+0, 5840000, 5840000, 0, 37440, 0xf1b4138f
+0, 6256666, 6256666, 0, 37440, 0x966f1a49
+0, 6670000, 6670000, 0, 37440, 0x5eff21da
+0, 7086666, 7086666, 0, 37440, 0x333f39b1
+0, 7500000, 7500000, 0, 37440, 0x62e5963e
+0, 7916666, 7916666, 0, 37440, 0x26930671
+0, 8340000, 8340000, 0, 37440, 0x27b4bb6c
+0, 8756666, 8756666, 0, 37440, 0xdbd07766
+0, 9170000, 9170000, 0, 37440, 0x04260104
+0, 9586666, 9586666, 0, 37440, 0x9b1e078b
+0, 10000000, 10000000, 0, 37440, 0xdf4e2474
+0, 10416666, 10416666, 0, 37440, 0x57d44986
+0, 10840000, 10840000, 0, 37440, 0x8780e34c
+0, 11256666, 11256666, 0, 37440, 0xf80c8bc0
+0, 11670000, 11670000, 0, 37440, 0x630a7583
+0, 12086666, 12086666, 0, 37440, 0x235ae089
+0, 12500000, 12500000, 0, 37440, 0x984b8f0e
+0, 12916666, 12916666, 0, 37440, 0x865cf592
+0, 13340000, 13340000, 0, 37440, 0x70f376f2
+0, 13756666, 13756666, 0, 37440, 0x8b30c035
+0, 14170000, 14170000, 0, 37440, 0xde772d79
+0, 14586666, 14586666, 0, 37440, 0x8e076be5
+0, 15000000, 15000000, 0, 37440, 0x3dc2bd9f
+0, 15416666, 15416666, 0, 37440, 0xb782eb67
+0, 15840000, 15840000, 0, 37440, 0x02025d73
+0, 16256666, 16256666, 0, 37440, 0x86bbbce8
+0, 16670000, 16670000, 0, 37440, 0xd6554f62
+0, 17086666, 17086666, 0, 37440, 0xb831b917
+0, 17500000, 17500000, 0, 37440, 0x80643560
+0, 17916666, 17916666, 0, 37440, 0x4ecf9afd
+0, 18340000, 18340000, 0, 37440, 0x9ce51e0b
+0, 18756666, 18756666, 0, 37440, 0x179466cd
+0, 19170000, 19170000, 0, 37440, 0x145fc900
+0, 19586666, 19586666, 0, 37440, 0xb1b50402
+0, 20000000, 20000000, 0, 37440, 0x0a87552a
+0, 20416666, 20416666, 0, 37440, 0x8f53821d
+0, 20840000, 20840000, 0, 37440, 0x1c07c825
+0, 21256666, 21256666, 0, 37440, 0x49dde82f
+0, 21670000, 21670000, 0, 37440, 0xb1a32605
+0, 22086666, 22086666, 0, 37440, 0x410f3cd5
+0, 22500000, 22500000, 0, 37440, 0xff5e6696
+0, 22916666, 22916666, 0, 37440, 0x96f678c9
+0, 23340000, 23340000, 0, 37440, 0x6c9e9e68
+0, 23756666, 23756666, 0, 37440, 0x79a2a655
+0, 24170000, 24170000, 0, 37440, 0xf237bd6c
+0, 24586666, 24586666, 0, 37440, 0x4051b611
+0, 25000000, 25000000, 0, 37440, 0xc7ccc918
+0, 25416666, 25416666, 0, 37440, 0xbd02c122
+0, 25840000, 25840000, 0, 37440, 0xacb3c881
+0, 26256666, 26256666, 0, 37440, 0x2abdb940
+0, 26670000, 26670000, 0, 37440, 0x19d5be85
+0, 27086666, 27086666, 0, 37440, 0xfa5fb1ba
+0, 27503332, 27503332, 0, 37440, 0xdae7a7aa
+0, 27919998, 27919998, 0, 37440, 0x6b0f9f69
+0, 28340000, 28340000, 0, 37440, 0x353e8201
+0, 28756666, 28756666, 0, 37440, 0xa21443aa
+0, 29170000, 29170000, 0, 37440, 0x66c8d7e0
+0, 29586666, 29586666, 0, 37440, 0xc332068e
+0, 30000000, 30000000, 0, 37440, 0x71431b9b
+0, 30416666, 30416666, 0, 37440, 0x392f15cb
+0, 30840000, 30840000, 0, 37440, 0x95a146bb
+0, 31256666, 31256666, 0, 37440, 0x7c51740a
+0, 31670000, 31670000, 0, 37440, 0xa3bdd43c
+0, 32086666, 32086666, 0, 37440, 0xa079f965
+0, 32500000, 32500000, 0, 37440, 0xa95423ea
+0, 32916666, 32916666, 0, 37440, 0xd1bd2c67
+0, 33340000, 33340000, 0, 37440, 0x6cf82844
+0, 33756666, 33756666, 0, 37440, 0xd401e128
+0, 34170000, 34170000, 0, 37440, 0x1f7db118
+0, 34586666, 34586666, 0, 37440, 0x2e0a65a9
+0, 35000000, 35000000, 0, 37440, 0x321c1c40
+0, 35416666, 35416666, 0, 37440, 0x95b2a127
+0, 35840000, 35840000, 0, 37440, 0xa1471f4b
+0, 36256666, 36256666, 0, 37440, 0x29d148c0
+0, 36670000, 36670000, 0, 37440, 0x24c07107
+0, 37086666, 37086666, 0, 37440, 0x0ead678d
+0, 37500000, 37500000, 0, 37440, 0xd0ca6495
+0, 37916666, 37916666, 0, 37440, 0x08f935ef
+0, 38340000, 38340000, 0, 37440, 0xb5ec3c38
+0, 38756666, 38756666, 0, 37440, 0xce371628
+0, 39170000, 39170000, 0, 37440, 0x68170812
+0, 39586666, 39586666, 0, 37440, 0xe222699e
+0, 40000000, 40000000, 0, 37440, 0xd688706c
+0, 40416666, 40416666, 0, 37440, 0x81a033f9
+0, 40840000, 40840000, 0, 37440, 0x28bd0fbf
+0, 41256666, 41256666, 0, 37440, 0xe36db7b2
+0, 41670000, 41670000, 0, 37440, 0x30559121
+0, 42086666, 42086666, 0, 37440, 0xbf2b5fc8
+0, 42500000, 42500000, 0, 37440, 0x4b427672
+0, 42916666, 42916666, 0, 37440, 0x0544b0b4
+0, 43340000, 43340000, 0, 37440, 0x38a70b06
+0, 43756666, 43756666, 0, 37440, 0x4ed62607
+0, 44170000, 44170000, 0, 37440, 0x6efe8ea6
+0, 44586666, 44586666, 0, 37440, 0x81197e11
+0, 45000000, 45000000, 0, 37440, 0xf4060050
+0, 45416666, 45416666, 0, 37440, 0xaf205f13
+0, 45840000, 45840000, 0, 37440, 0x5fa21382
+0, 46256666, 46256666, 0, 37440, 0x8627ad05
+0, 46670000, 46670000, 0, 37440, 0xf7130133
+0, 47086666, 47086666, 0, 37440, 0x76dea7ba
+0, 47500000, 47500000, 0, 37440, 0x1dbae1be
+0, 47916666, 47916666, 0, 37440, 0x74a933f7
+0, 48340000, 48340000, 0, 37440, 0xbdcd41a3
+0, 48756666, 48756666, 0, 37440, 0xf0fe8c1c
+0, 49170000, 49170000, 0, 37440, 0xc0036222
+0, 49586666, 49586666, 0, 37440, 0x3058385c
+0, 49586667, 49586667, 0, 37440, 0x68141016
diff --git a/gst-libs/ext/libav/tests/ref/fate/vc1_sa00040 b/gst-libs/ext/libav/tests/ref/fate/vc1_sa00040
index 901f81a..79bff27 100644
--- a/gst-libs/ext/libav/tests/ref/fate/vc1_sa00040
+++ b/gst-libs/ext/libav/tests/ref/fate/vc1_sa00040
@@ -1,15 +1,16 @@
-0, 0, 38016, 0xa6f15db5
-0, 3600, 38016, 0xa6f15db5
-0, 7200, 38016, 0xa6f15db5
-0, 10800, 38016, 0x5c4ef0e7
-0, 14400, 38016, 0x53a42d1d
-0, 18000, 38016, 0x68f7d89e
-0, 21600, 38016, 0xc15f4368
-0, 25200, 38016, 0xc15f4368
-0, 28800, 38016, 0xd1bd47a8
-0, 32400, 38016, 0xd1bd47a8
-0, 36000, 38016, 0xe1e821ca
-0, 39600, 38016, 0xe1e821ca
-0, 43200, 38016, 0xe1e821ca
-0, 46800, 38016, 0xe1e821ca
-0, 50400, 38016, 0xe1e821ca
+#tb 0: 1/25
+0, 0, 0, 1, 38016, 0xa6f15db5
+0, 1, 1, 1, 38016, 0xa6f15db5
+0, 2, 2, 1, 38016, 0xa6f15db5
+0, 4, 4, 1, 38016, 0x5c4ef0e7
+0, 5, 5, 1, 38016, 0x53a42d1d
+0, 6, 6, 1, 38016, 0x68f7d89e
+0, 7, 7, 1, 38016, 0xc15f4368
+0, 8, 8, 1, 38016, 0xc15f4368
+0, 9, 9, 1, 38016, 0xd1bd47a8
+0, 10, 10, 1, 38016, 0xd1bd47a8
+0, 11, 11, 1, 38016, 0xe1e821ca
+0, 12, 12, 1, 38016, 0xe1e821ca
+0, 13, 13, 1, 38016, 0xe1e821ca
+0, 14, 14, 1, 38016, 0xe1e821ca
+0, 15, 15, 1, 38016, 0xe1e821ca
diff --git a/gst-libs/ext/libav/tests/ref/fate/vc1_sa00050 b/gst-libs/ext/libav/tests/ref/fate/vc1_sa00050
index 3eb27bd..89a3840 100644
--- a/gst-libs/ext/libav/tests/ref/fate/vc1_sa00050
+++ b/gst-libs/ext/libav/tests/ref/fate/vc1_sa00050
@@ -1,30 +1,31 @@
-0, 0, 115200, 0xb8830eef
-0, 3600, 115200, 0xb8830eef
-0, 7200, 115200, 0xb8830eef
-0, 10800, 115200, 0x952ff5e1
-0, 14400, 115200, 0xa4362b14
-0, 18000, 115200, 0x32bacbe7
-0, 21600, 115200, 0x509eb814
-0, 25200, 115200, 0x509eb814
-0, 28800, 115200, 0x11a76c3e
-0, 32400, 115200, 0x11a76c3e
-0, 36000, 115200, 0x00cf734a
-0, 39600, 115200, 0x00cf734a
-0, 43200, 115200, 0x00cf734a
-0, 46800, 115200, 0x00cf734a
-0, 50400, 115200, 0x00cf734a
-0, 54000, 115200, 0x00cf734a
-0, 57600, 115200, 0x00cf734a
-0, 61200, 115200, 0x00cf734a
-0, 64800, 115200, 0xfddf48e6
-0, 68400, 115200, 0xfddf48e6
-0, 72000, 115200, 0x1eccebbf
-0, 75600, 115200, 0x3da2f77e
-0, 79200, 115200, 0x7c232572
-0, 82800, 115200, 0xedf426e5
-0, 86400, 115200, 0x5324ab20
-0, 90000, 115200, 0x5324ab20
-0, 93600, 115200, 0xa23e66bb
-0, 97200, 115200, 0x680a50ff
-0, 100800, 115200, 0x680a50ff
-0, 104400, 115200, 0x680a50ff
+#tb 0: 1/25
+0, 0, 0, 1, 115200, 0xb8830eef
+0, 1, 1, 1, 115200, 0xb8830eef
+0, 2, 2, 1, 115200, 0xb8830eef
+0, 4, 4, 1, 115200, 0x952ff5e1
+0, 5, 5, 1, 115200, 0xa4362b14
+0, 6, 6, 1, 115200, 0x32bacbe7
+0, 7, 7, 1, 115200, 0x509eb814
+0, 8, 8, 1, 115200, 0x509eb814
+0, 9, 9, 1, 115200, 0x11a76c3e
+0, 10, 10, 1, 115200, 0x11a76c3e
+0, 11, 11, 1, 115200, 0x00cf734a
+0, 12, 12, 1, 115200, 0x00cf734a
+0, 13, 13, 1, 115200, 0x00cf734a
+0, 14, 14, 1, 115200, 0x00cf734a
+0, 15, 15, 1, 115200, 0x00cf734a
+0, 16, 16, 1, 115200, 0x00cf734a
+0, 17, 17, 1, 115200, 0x00cf734a
+0, 18, 18, 1, 115200, 0x00cf734a
+0, 19, 19, 1, 115200, 0xfddf48e6
+0, 20, 20, 1, 115200, 0xfddf48e6
+0, 21, 21, 1, 115200, 0x1eccebbf
+0, 22, 22, 1, 115200, 0x3da2f77e
+0, 23, 23, 1, 115200, 0x7c232572
+0, 24, 24, 1, 115200, 0xedf426e5
+0, 25, 25, 1, 115200, 0x5324ab20
+0, 26, 26, 1, 115200, 0x5324ab20
+0, 27, 27, 1, 115200, 0xa23e66bb
+0, 28, 28, 1, 115200, 0x680a50ff
+0, 29, 29, 1, 115200, 0x680a50ff
+0, 30, 30, 1, 115200, 0x680a50ff
diff --git a/gst-libs/ext/libav/tests/ref/fate/vc1_sa10091 b/gst-libs/ext/libav/tests/ref/fate/vc1_sa10091
index c121090..33326d6 100644
--- a/gst-libs/ext/libav/tests/ref/fate/vc1_sa10091
+++ b/gst-libs/ext/libav/tests/ref/fate/vc1_sa10091
@@ -1,30 +1,31 @@
-0, 0, 518400, 0xae20b4fa
-0, 3600, 518400, 0x2b4ccdf9
-0, 7200, 518400, 0x2b4ccdf9
-0, 10800, 518400, 0x2b4ccdf9
-0, 14400, 518400, 0x2b4ccdf9
-0, 18000, 518400, 0x2b4ccdf9
-0, 21600, 518400, 0x70d9a891
-0, 25200, 518400, 0x70d9a891
-0, 28800, 518400, 0x70d9a891
-0, 32400, 518400, 0xa461ee86
-0, 36000, 518400, 0x722bc6e8
-0, 39600, 518400, 0x722bc6e8
-0, 43200, 518400, 0x722bc6e8
-0, 46800, 518400, 0xf752fd2c
-0, 50400, 518400, 0xf752fd2c
-0, 54000, 518400, 0x91abcaca
-0, 57600, 518400, 0x572727c3
-0, 61200, 518400, 0x572727c3
-0, 64800, 518400, 0x24c12382
-0, 68400, 518400, 0x24c12382
-0, 72000, 518400, 0x9aa39fe8
-0, 75600, 518400, 0x9aa39fe8
-0, 79200, 518400, 0x5cb6bd19
-0, 82800, 518400, 0x704d9300
-0, 86400, 518400, 0x590fad49
-0, 90000, 518400, 0x590fad49
-0, 93600, 518400, 0x590fad49
-0, 97200, 518400, 0x46bea10b
-0, 100800, 518400, 0x46bea10b
-0, 104400, 518400, 0x46bea10b
+#tb 0: 1/25
+0, 0, 0, 1, 518400, 0xae20b4fa
+0, 2, 2, 1, 518400, 0x2b4ccdf9
+0, 3, 3, 1, 518400, 0x2b4ccdf9
+0, 4, 4, 1, 518400, 0x2b4ccdf9
+0, 5, 5, 1, 518400, 0x2b4ccdf9
+0, 6, 6, 1, 518400, 0x2b4ccdf9
+0, 7, 7, 1, 518400, 0x70d9a891
+0, 8, 8, 1, 518400, 0x70d9a891
+0, 9, 9, 1, 518400, 0x70d9a891
+0, 10, 10, 1, 518400, 0xa461ee86
+0, 11, 11, 1, 518400, 0x722bc6e8
+0, 12, 12, 1, 518400, 0x722bc6e8
+0, 13, 13, 1, 518400, 0x722bc6e8
+0, 14, 14, 1, 518400, 0xf752fd2c
+0, 15, 15, 1, 518400, 0xf752fd2c
+0, 16, 16, 1, 518400, 0x91abcaca
+0, 17, 17, 1, 518400, 0x572727c3
+0, 18, 18, 1, 518400, 0x572727c3
+0, 19, 19, 1, 518400, 0x24c12382
+0, 20, 20, 1, 518400, 0x24c12382
+0, 21, 21, 1, 518400, 0x9aa39fe8
+0, 22, 22, 1, 518400, 0x9aa39fe8
+0, 23, 23, 1, 518400, 0x5cb6bd19
+0, 24, 24, 1, 518400, 0x704d9300
+0, 25, 25, 1, 518400, 0x590fad49
+0, 26, 26, 1, 518400, 0x590fad49
+0, 27, 27, 1, 518400, 0x590fad49
+0, 28, 28, 1, 518400, 0x46bea10b
+0, 29, 29, 1, 518400, 0x46bea10b
+0, 30, 30, 1, 518400, 0x46bea10b
diff --git a/gst-libs/ext/libav/tests/ref/fate/vc1_sa10143 b/gst-libs/ext/libav/tests/ref/fate/vc1_sa10143
new file mode 100644
index 0000000..a008356
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/vc1_sa10143
@@ -0,0 +1,31 @@
+#tb 0: 1/25
+0, 0, 0, 1, 518400, 0x89407f55
+0, 2, 2, 1, 518400, 0xeb8d84a1
+0, 3, 3, 1, 518400, 0x2121ff57
+0, 4, 4, 1, 518400, 0xd81adb3d
+0, 5, 5, 1, 518400, 0x01e36aa2
+0, 6, 6, 1, 518400, 0x6b802361
+0, 7, 7, 1, 518400, 0xc8403c77
+0, 8, 8, 1, 518400, 0xdd342b5d
+0, 9, 9, 1, 518400, 0x2100eea5
+0, 10, 10, 1, 518400, 0x92a22da6
+0, 11, 11, 1, 518400, 0x6bacdef7
+0, 12, 12, 1, 518400, 0x4a00715f
+0, 13, 13, 1, 518400, 0x59b98727
+0, 14, 14, 1, 518400, 0xbf912ee1
+0, 15, 15, 1, 518400, 0x8c966cd6
+0, 16, 16, 1, 518400, 0x2c9a2535
+0, 17, 17, 1, 518400, 0x29085c06
+0, 18, 18, 1, 518400, 0x46ae6b7d
+0, 19, 19, 1, 518400, 0x283100f4
+0, 20, 20, 1, 518400, 0x2731b5ff
+0, 21, 21, 1, 518400, 0x1132ea54
+0, 22, 22, 1, 518400, 0x37cbe539
+0, 23, 23, 1, 518400, 0x08ff75cf
+0, 24, 24, 1, 518400, 0xafb6bc45
+0, 25, 25, 1, 518400, 0x19d3873d
+0, 26, 26, 1, 518400, 0xd494a8be
+0, 27, 27, 1, 518400, 0x285f41ef
+0, 28, 28, 1, 518400, 0xd4b1ffa1
+0, 29, 29, 1, 518400, 0xc3876c3a
+0, 30, 30, 1, 518400, 0xb73dbb62
diff --git a/gst-libs/ext/libav/tests/ref/fate/vc1_sa20021 b/gst-libs/ext/libav/tests/ref/fate/vc1_sa20021
index aae607b..22989a0 100644
--- a/gst-libs/ext/libav/tests/ref/fate/vc1_sa20021
+++ b/gst-libs/ext/libav/tests/ref/fate/vc1_sa20021
@@ -1,60 +1,61 @@
-0, 0, 506880, 0x884bc093
-0, 3600, 506880, 0x4b09548f
-0, 7200, 506880, 0x195cbee1
-0, 10800, 506880, 0xc8141e28
-0, 14400, 506880, 0xb170c49b
-0, 18000, 506880, 0x2782268a
-0, 21600, 506880, 0x2782268a
-0, 25200, 506880, 0x2782268a
-0, 28800, 506880, 0x2782268a
-0, 32400, 506880, 0xe6803b32
-0, 36000, 506880, 0xe6803b32
-0, 39600, 506880, 0xa5ef9baf
-0, 43200, 506880, 0xa5ef9baf
-0, 46800, 506880, 0x46e8cbcb
-0, 50400, 506880, 0x28a2239b
-0, 54000, 506880, 0x7667af2f
-0, 57600, 506880, 0x7667af2f
-0, 61200, 506880, 0x8011bcaf
-0, 64800, 506880, 0xd422115b
-0, 68400, 506880, 0xd422115b
-0, 72000, 506880, 0xd422115b
-0, 75600, 506880, 0xbcee0b5b
-0, 79200, 506880, 0x08fe9ec8
-0, 82800, 506880, 0xc8fb8b37
-0, 86400, 506880, 0xc8fb8b37
-0, 90000, 506880, 0x2c698b52
-0, 93600, 506880, 0x2c698b52
-0, 97200, 506880, 0x2c698b52
-0, 100800, 506880, 0x2b4ad9bc
-0, 104400, 506880, 0x2b4ad9bc
-0, 108000, 506880, 0x2b4ad9bc
-0, 111600, 506880, 0x2b4ad9bc
-0, 115200, 506880, 0x92e84ebb
-0, 118800, 506880, 0x92e84ebb
-0, 122400, 506880, 0xdb877da3
-0, 126000, 506880, 0xdb877da3
-0, 129600, 506880, 0xdb877da3
-0, 133200, 506880, 0x44610654
-0, 136800, 506880, 0x44610654
-0, 140400, 506880, 0xe254ce67
-0, 144000, 506880, 0xa6085385
-0, 147600, 506880, 0x2d45d744
-0, 151200, 506880, 0x2d45d744
-0, 154800, 506880, 0x6e684f51
-0, 158400, 506880, 0xe96186cf
-0, 162000, 506880, 0xb535d369
-0, 165600, 506880, 0xb535d369
-0, 169200, 506880, 0xb535d369
-0, 172800, 506880, 0xeed0b7e0
-0, 176400, 506880, 0xeed0b7e0
-0, 180000, 506880, 0xeed0b7e0
-0, 183600, 506880, 0xeed0b7e0
-0, 187200, 506880, 0x8789b20b
-0, 190800, 506880, 0x0a0f42fb
-0, 194400, 506880, 0x09bbac2d
-0, 198000, 506880, 0x09bbac2d
-0, 201600, 506880, 0x09bbac2d
-0, 205200, 506880, 0x09bbac2d
-0, 208800, 506880, 0x09bbac2d
-0, 212400, 506880, 0xda77f0df
+#tb 0: 1/25
+0, 0, 0, 1, 506880, 0x884bc093
+0, 2, 2, 1, 506880, 0x4b09548f
+0, 3, 3, 1, 506880, 0x195cbee1
+0, 4, 4, 1, 506880, 0xc8141e28
+0, 5, 5, 1, 506880, 0xb170c49b
+0, 6, 6, 1, 506880, 0x2782268a
+0, 7, 7, 1, 506880, 0x2782268a
+0, 8, 8, 1, 506880, 0x2782268a
+0, 9, 9, 1, 506880, 0x2782268a
+0, 10, 10, 1, 506880, 0xe6803b32
+0, 11, 11, 1, 506880, 0xe6803b32
+0, 12, 12, 1, 506880, 0xa5ef9baf
+0, 13, 13, 1, 506880, 0xa5ef9baf
+0, 14, 14, 1, 506880, 0x46e8cbcb
+0, 15, 15, 1, 506880, 0x28a2239b
+0, 16, 16, 1, 506880, 0x7667af2f
+0, 17, 17, 1, 506880, 0x7667af2f
+0, 18, 18, 1, 506880, 0x8011bcaf
+0, 19, 19, 1, 506880, 0xd422115b
+0, 20, 20, 1, 506880, 0xd422115b
+0, 21, 21, 1, 506880, 0xd422115b
+0, 22, 22, 1, 506880, 0xbcee0b5b
+0, 23, 23, 1, 506880, 0x08fe9ec8
+0, 24, 24, 1, 506880, 0xc8fb8b37
+0, 25, 25, 1, 506880, 0xc8fb8b37
+0, 26, 26, 1, 506880, 0x2c698b52
+0, 27, 27, 1, 506880, 0x2c698b52
+0, 28, 28, 1, 506880, 0x2c698b52
+0, 29, 29, 1, 506880, 0x2b4ad9bc
+0, 30, 30, 1, 506880, 0x2b4ad9bc
+0, 31, 31, 1, 506880, 0x2b4ad9bc
+0, 32, 32, 1, 506880, 0x2b4ad9bc
+0, 33, 33, 1, 506880, 0x92e84ebb
+0, 34, 34, 1, 506880, 0x92e84ebb
+0, 35, 35, 1, 506880, 0xdb877da3
+0, 36, 36, 1, 506880, 0xdb877da3
+0, 37, 37, 1, 506880, 0xdb877da3
+0, 38, 38, 1, 506880, 0x44610654
+0, 39, 39, 1, 506880, 0x44610654
+0, 40, 40, 1, 506880, 0xe254ce67
+0, 41, 41, 1, 506880, 0xa6085385
+0, 42, 42, 1, 506880, 0x2d45d744
+0, 43, 43, 1, 506880, 0x2d45d744
+0, 44, 44, 1, 506880, 0x6e684f51
+0, 45, 45, 1, 506880, 0xe96186cf
+0, 46, 46, 1, 506880, 0xb535d369
+0, 47, 47, 1, 506880, 0xb535d369
+0, 48, 48, 1, 506880, 0xb535d369
+0, 49, 49, 1, 506880, 0xeed0b7e0
+0, 50, 50, 1, 506880, 0xeed0b7e0
+0, 51, 51, 1, 506880, 0xeed0b7e0
+0, 52, 52, 1, 506880, 0xeed0b7e0
+0, 53, 53, 1, 506880, 0x8789b20b
+0, 54, 54, 1, 506880, 0x0a0f42fb
+0, 55, 55, 1, 506880, 0x09bbac2d
+0, 56, 56, 1, 506880, 0x09bbac2d
+0, 57, 57, 1, 506880, 0x09bbac2d
+0, 58, 58, 1, 506880, 0x09bbac2d
+0, 59, 59, 1, 506880, 0x09bbac2d
+0, 60, 60, 1, 506880, 0xda77f0df
diff --git a/gst-libs/ext/libav/tests/ref/fate/vcr1 b/gst-libs/ext/libav/tests/ref/fate/vcr1
index 22f817c..da21df4 100644
--- a/gst-libs/ext/libav/tests/ref/fate/vcr1
+++ b/gst-libs/ext/libav/tests/ref/fate/vcr1
@@ -1,128 +1,129 @@
-0, 0, 28512, 0x7165286d
-0, 5949, 28512, 0x2b842acc
-0, 11898, 28512, 0x6d1b8e85
-0, 17847, 28512, 0xc5042fab
-0, 23796, 28512, 0x8b84fa8d
-0, 29745, 28512, 0x2ba34ee5
-0, 35693, 28512, 0x48493c3a
-0, 41642, 28512, 0xbd774ff0
-0, 47591, 28512, 0xf2e2edcd
-0, 53540, 28512, 0x9364c39e
-0, 59489, 28512, 0x7203d4d0
-0, 65438, 28512, 0x3771e23e
-0, 71387, 28512, 0xf332b71e
-0, 77336, 28512, 0x64d9aedb
-0, 83285, 28512, 0xc8f9cdbe
-0, 89234, 28512, 0xf077a6e8
-0, 95183, 28512, 0xa9958897
-0, 101131, 28512, 0x89fb6c6e
-0, 107080, 28512, 0x05b7350c
-0, 113029, 28512, 0x23cf3ec8
-0, 118978, 28512, 0xf9105aa6
-0, 124927, 28512, 0x37ed48cb
-0, 130876, 28512, 0xf4b15ce3
-0, 136825, 28512, 0x64b994b8
-0, 142774, 28512, 0x6731c26b
-0, 148723, 28512, 0x650d110b
-0, 154672, 28512, 0xbbb248ca
-0, 160621, 28512, 0x426ab4ab
-0, 166569, 28512, 0xb7f2e361
-0, 172518, 28512, 0xced16599
-0, 178467, 28512, 0xebf11860
-0, 184416, 28512, 0xefe1df5f
-0, 190365, 28512, 0x2afc432e
-0, 196314, 28512, 0x07bd3eea
-0, 202263, 28512, 0x8b133899
-0, 208212, 28512, 0x0830f148
-0, 214161, 28512, 0x871fc549
-0, 220110, 28512, 0x0082c863
-0, 226059, 28512, 0x6144bdce
-0, 232007, 28512, 0x0af772ea
-0, 237956, 28512, 0x982b8707
-0, 243905, 28512, 0x565a3bfe
-0, 249854, 28512, 0xdf14192e
-0, 255803, 28512, 0x0c5ffcc1
-0, 261752, 28512, 0x87532564
-0, 267701, 28512, 0x0ba1661b
-0, 273650, 28512, 0xd0e7a750
-0, 279599, 28512, 0x5add4281
-0, 285548, 28512, 0x9f45c597
-0, 291497, 28512, 0x921736d0
-0, 297446, 28512, 0xab177a89
-0, 303394, 28512, 0xb83a6f7c
-0, 309343, 28512, 0x9bf6716b
-0, 315292, 28512, 0xc8ca0f4f
-0, 321241, 28512, 0x2ca6c753
-0, 327190, 28512, 0xc2f67d1f
-0, 333139, 28512, 0x9b0e1d7b
-0, 339088, 28512, 0x5257c5d0
-0, 345037, 28512, 0xf256bd2f
-0, 350986, 28512, 0x1b04bd04
-0, 356935, 28512, 0x83deb9e4
-0, 362884, 28512, 0x5f3aa6b4
-0, 368832, 28512, 0x9313c5f3
-0, 374781, 28512, 0x1cfe0c23
-0, 380730, 28512, 0x3e9b37bf
-0, 386679, 28512, 0x1603b386
-0, 392628, 28512, 0x3e70da87
-0, 398577, 28512, 0xa6684712
-0, 404526, 28512, 0x0454bbb7
-0, 410475, 28512, 0x7cf2f717
-0, 416424, 28512, 0xdfbd424c
-0, 422373, 28512, 0x7318a177
-0, 428322, 28512, 0xbffcd503
-0, 434270, 28512, 0x85db177d
-0, 440219, 28512, 0x2a8269d1
-0, 446168, 28512, 0xb5455cd5
-0, 452117, 28512, 0x5fd79a35
-0, 458066, 28512, 0xc1a7c005
-0, 464015, 28512, 0x55230bb0
-0, 469964, 28512, 0x5acf45d9
-0, 475913, 28512, 0xdf1259bf
-0, 481862, 28512, 0xe04e87eb
-0, 487811, 28512, 0xfd25abc0
-0, 493760, 28512, 0x38c4d017
-0, 499708, 28512, 0x7b15d521
-0, 505657, 28512, 0xb156b981
-0, 511606, 28512, 0xcc99cd09
-0, 517555, 28512, 0x633a9cec
-0, 523504, 28512, 0xf00a7c1b
-0, 529453, 28512, 0x426250e9
-0, 535402, 28512, 0xfad02714
-0, 541351, 28512, 0x1ea5d8d2
-0, 547300, 28512, 0x581ea622
-0, 553249, 28512, 0x6b225f61
-0, 559198, 28512, 0x68f337e6
-0, 565146, 28512, 0x85f7060e
-0, 571095, 28512, 0xaa3b1086
-0, 577044, 28512, 0x91fa1371
-0, 582993, 28512, 0x92acd34a
-0, 588942, 28512, 0x0ae8c1e6
-0, 594891, 28512, 0x1335a5b3
-0, 600840, 28512, 0xc364a5e7
-0, 606789, 28512, 0x19b9819a
-0, 612738, 28512, 0xd42d7045
-0, 618687, 28512, 0x4c866a18
-0, 624636, 28512, 0xf0a99685
-0, 630584, 28512, 0x47a4a1bd
-0, 636533, 28512, 0x8dd09006
-0, 642482, 28512, 0x3f0b742d
-0, 648431, 28512, 0x1acf52be
-0, 654380, 28512, 0x9e5d1460
-0, 660329, 28512, 0xd6852de9
-0, 666278, 28512, 0x36e00f16
-0, 672227, 28512, 0xe83dea09
-0, 678176, 28512, 0xbb71daf1
-0, 684125, 28512, 0xaeedf763
-0, 690074, 28512, 0xa793ed91
-0, 696022, 28512, 0x9b0f093f
-0, 701971, 28512, 0xc8504b43
-0, 707920, 28512, 0x08c68319
-0, 713869, 28512, 0x2284b24a
-0, 719818, 28512, 0x5980e906
-0, 725767, 28512, 0x6ffd2c14
-0, 731716, 28512, 0x5c6c3c27
-0, 737665, 28512, 0x20d2efec
-0, 743614, 28512, 0x69ffec11
-0, 749563, 28512, 0x8721f8ab
-0, 755512, 28512, 0xb606e164
+#tb 0: 66099/1000000
+0, 0, 0, 1, 28512, 0x7165286d
+0, 1, 1, 1, 28512, 0x2b842acc
+0, 2, 2, 1, 28512, 0x6d1b8e85
+0, 3, 3, 1, 28512, 0xc5042fab
+0, 4, 4, 1, 28512, 0x8b84fa8d
+0, 5, 5, 1, 28512, 0x2ba34ee5
+0, 6, 6, 1, 28512, 0x48493c3a
+0, 7, 7, 1, 28512, 0xbd774ff0
+0, 8, 8, 1, 28512, 0xf2e2edcd
+0, 9, 9, 1, 28512, 0x9364c39e
+0, 10, 10, 1, 28512, 0x7203d4d0
+0, 11, 11, 1, 28512, 0x3771e23e
+0, 12, 12, 1, 28512, 0xf332b71e
+0, 13, 13, 1, 28512, 0x64d9aedb
+0, 14, 14, 1, 28512, 0xc8f9cdbe
+0, 15, 15, 1, 28512, 0xf077a6e8
+0, 16, 16, 1, 28512, 0xa9958897
+0, 17, 17, 1, 28512, 0x89fb6c6e
+0, 18, 18, 1, 28512, 0x05b7350c
+0, 19, 19, 1, 28512, 0x23cf3ec8
+0, 20, 20, 1, 28512, 0xf9105aa6
+0, 21, 21, 1, 28512, 0x37ed48cb
+0, 22, 22, 1, 28512, 0xf4b15ce3
+0, 23, 23, 1, 28512, 0x64b994b8
+0, 24, 24, 1, 28512, 0x6731c26b
+0, 25, 25, 1, 28512, 0x650d110b
+0, 26, 26, 1, 28512, 0xbbb248ca
+0, 27, 27, 1, 28512, 0x426ab4ab
+0, 28, 28, 1, 28512, 0xb7f2e361
+0, 29, 29, 1, 28512, 0xced16599
+0, 30, 30, 1, 28512, 0xebf11860
+0, 31, 31, 1, 28512, 0xefe1df5f
+0, 32, 32, 1, 28512, 0x2afc432e
+0, 33, 33, 1, 28512, 0x07bd3eea
+0, 34, 34, 1, 28512, 0x8b133899
+0, 35, 35, 1, 28512, 0x0830f148
+0, 36, 36, 1, 28512, 0x871fc549
+0, 37, 37, 1, 28512, 0x0082c863
+0, 38, 38, 1, 28512, 0x6144bdce
+0, 39, 39, 1, 28512, 0x0af772ea
+0, 40, 40, 1, 28512, 0x982b8707
+0, 41, 41, 1, 28512, 0x565a3bfe
+0, 42, 42, 1, 28512, 0xdf14192e
+0, 43, 43, 1, 28512, 0x0c5ffcc1
+0, 44, 44, 1, 28512, 0x87532564
+0, 45, 45, 1, 28512, 0x0ba1661b
+0, 46, 46, 1, 28512, 0xd0e7a750
+0, 47, 47, 1, 28512, 0x5add4281
+0, 48, 48, 1, 28512, 0x9f45c597
+0, 49, 49, 1, 28512, 0x921736d0
+0, 50, 50, 1, 28512, 0xab177a89
+0, 51, 51, 1, 28512, 0xb83a6f7c
+0, 52, 52, 1, 28512, 0x9bf6716b
+0, 53, 53, 1, 28512, 0xc8ca0f4f
+0, 54, 54, 1, 28512, 0x2ca6c753
+0, 55, 55, 1, 28512, 0xc2f67d1f
+0, 56, 56, 1, 28512, 0x9b0e1d7b
+0, 57, 57, 1, 28512, 0x5257c5d0
+0, 58, 58, 1, 28512, 0xf256bd2f
+0, 59, 59, 1, 28512, 0x1b04bd04
+0, 60, 60, 1, 28512, 0x83deb9e4
+0, 61, 61, 1, 28512, 0x5f3aa6b4
+0, 62, 62, 1, 28512, 0x9313c5f3
+0, 63, 63, 1, 28512, 0x1cfe0c23
+0, 64, 64, 1, 28512, 0x3e9b37bf
+0, 65, 65, 1, 28512, 0x1603b386
+0, 66, 66, 1, 28512, 0x3e70da87
+0, 67, 67, 1, 28512, 0xa6684712
+0, 68, 68, 1, 28512, 0x0454bbb7
+0, 69, 69, 1, 28512, 0x7cf2f717
+0, 70, 70, 1, 28512, 0xdfbd424c
+0, 71, 71, 1, 28512, 0x7318a177
+0, 72, 72, 1, 28512, 0xbffcd503
+0, 73, 73, 1, 28512, 0x85db177d
+0, 74, 74, 1, 28512, 0x2a8269d1
+0, 75, 75, 1, 28512, 0xb5455cd5
+0, 76, 76, 1, 28512, 0x5fd79a35
+0, 77, 77, 1, 28512, 0xc1a7c005
+0, 78, 78, 1, 28512, 0x55230bb0
+0, 79, 79, 1, 28512, 0x5acf45d9
+0, 80, 80, 1, 28512, 0xdf1259bf
+0, 81, 81, 1, 28512, 0xe04e87eb
+0, 82, 82, 1, 28512, 0xfd25abc0
+0, 83, 83, 1, 28512, 0x38c4d017
+0, 84, 84, 1, 28512, 0x7b15d521
+0, 85, 85, 1, 28512, 0xb156b981
+0, 86, 86, 1, 28512, 0xcc99cd09
+0, 87, 87, 1, 28512, 0x633a9cec
+0, 88, 88, 1, 28512, 0xf00a7c1b
+0, 89, 89, 1, 28512, 0x426250e9
+0, 90, 90, 1, 28512, 0xfad02714
+0, 91, 91, 1, 28512, 0x1ea5d8d2
+0, 92, 92, 1, 28512, 0x581ea622
+0, 93, 93, 1, 28512, 0x6b225f61
+0, 94, 94, 1, 28512, 0x68f337e6
+0, 95, 95, 1, 28512, 0x85f7060e
+0, 96, 96, 1, 28512, 0xaa3b1086
+0, 97, 97, 1, 28512, 0x91fa1371
+0, 98, 98, 1, 28512, 0x92acd34a
+0, 99, 99, 1, 28512, 0x0ae8c1e6
+0, 100, 100, 1, 28512, 0x1335a5b3
+0, 101, 101, 1, 28512, 0xc364a5e7
+0, 102, 102, 1, 28512, 0x19b9819a
+0, 103, 103, 1, 28512, 0xd42d7045
+0, 104, 104, 1, 28512, 0x4c866a18
+0, 105, 105, 1, 28512, 0xf0a99685
+0, 106, 106, 1, 28512, 0x47a4a1bd
+0, 107, 107, 1, 28512, 0x8dd09006
+0, 108, 108, 1, 28512, 0x3f0b742d
+0, 109, 109, 1, 28512, 0x1acf52be
+0, 110, 110, 1, 28512, 0x9e5d1460
+0, 111, 111, 1, 28512, 0xd6852de9
+0, 112, 112, 1, 28512, 0x36e00f16
+0, 113, 113, 1, 28512, 0xe83dea09
+0, 114, 114, 1, 28512, 0xbb71daf1
+0, 115, 115, 1, 28512, 0xaeedf763
+0, 116, 116, 1, 28512, 0xa793ed91
+0, 117, 117, 1, 28512, 0x9b0f093f
+0, 118, 118, 1, 28512, 0xc8504b43
+0, 119, 119, 1, 28512, 0x08c68319
+0, 120, 120, 1, 28512, 0x2284b24a
+0, 121, 121, 1, 28512, 0x5980e906
+0, 122, 122, 1, 28512, 0x6ffd2c14
+0, 123, 123, 1, 28512, 0x5c6c3c27
+0, 124, 124, 1, 28512, 0x20d2efec
+0, 125, 125, 1, 28512, 0x69ffec11
+0, 126, 126, 1, 28512, 0x8721f8ab
+0, 127, 127, 1, 28512, 0xb606e164
diff --git a/gst-libs/ext/libav/tests/ref/fate/videoxl b/gst-libs/ext/libav/tests/ref/fate/videoxl
index aca0864..4d2db37 100644
--- a/gst-libs/ext/libav/tests/ref/fate/videoxl
+++ b/gst-libs/ext/libav/tests/ref/fate/videoxl
@@ -1,40 +1,41 @@
-0, 0, 36096, 0xab1c53c1
-0, 12780, 36096, 0x8b598ff3
-0, 25560, 36096, 0xe9a5f3eb
-0, 38340, 36096, 0x10584b30
-0, 51120, 36096, 0x19d8c5d2
-0, 63900, 36096, 0x43a453b9
-0, 76680, 36096, 0xb32db13b
-0, 89460, 36096, 0xf117e7b3
-0, 102240, 36096, 0x9171fb33
-0, 115020, 36096, 0xdf84081c
-0, 127800, 36096, 0xc9d9527e
-0, 140580, 36096, 0x72fa295e
-0, 153360, 36096, 0xce02060e
-0, 166140, 36096, 0x31f5fdbd
-0, 178920, 36096, 0x4179dc07
-0, 191700, 36096, 0xf250c03f
-0, 204480, 36096, 0xc4aca7c5
-0, 217260, 36096, 0xd9b1837f
-0, 230040, 36096, 0x0af164ef
-0, 242820, 36096, 0x90123fcd
-0, 255600, 36096, 0x60392815
-0, 268380, 36096, 0x7a7b0ac9
-0, 281160, 36096, 0x36c1fe9c
-0, 293940, 36096, 0x50bed8a4
-0, 306720, 36096, 0x10f3b998
-0, 319500, 36096, 0x18e5b516
-0, 332280, 36096, 0x860597dc
-0, 345060, 36096, 0x05488146
-0, 357840, 36096, 0xac577cec
-0, 370620, 36096, 0xc9f95550
-0, 383400, 36096, 0xa0c95270
-0, 396180, 36096, 0x977c5bf2
-0, 408960, 36096, 0xc9f95550
-0, 421740, 36096, 0xa0c95270
-0, 434520, 36096, 0x977c5bf2
-0, 447300, 36096, 0xc9f95550
-0, 460080, 36096, 0xa0c95270
-0, 472860, 36096, 0x977c5bf2
-0, 485640, 36096, 0xc9f95550
-0, 498420, 36096, 0xa0c95270
+#tb 0: 71/500
+0, 0, 0, 1, 36096, 0xab1c53c1
+0, 1, 1, 1, 36096, 0x8b598ff3
+0, 2, 2, 1, 36096, 0xe9a5f3eb
+0, 3, 3, 1, 36096, 0x10584b30
+0, 4, 4, 1, 36096, 0x19d8c5d2
+0, 5, 5, 1, 36096, 0x43a453b9
+0, 6, 6, 1, 36096, 0xb32db13b
+0, 7, 7, 1, 36096, 0xf117e7b3
+0, 8, 8, 1, 36096, 0x9171fb33
+0, 9, 9, 1, 36096, 0xdf84081c
+0, 10, 10, 1, 36096, 0xc9d9527e
+0, 11, 11, 1, 36096, 0x72fa295e
+0, 12, 12, 1, 36096, 0xce02060e
+0, 13, 13, 1, 36096, 0x31f5fdbd
+0, 14, 14, 1, 36096, 0x4179dc07
+0, 15, 15, 1, 36096, 0xf250c03f
+0, 16, 16, 1, 36096, 0xc4aca7c5
+0, 17, 17, 1, 36096, 0xd9b1837f
+0, 18, 18, 1, 36096, 0x0af164ef
+0, 19, 19, 1, 36096, 0x90123fcd
+0, 20, 20, 1, 36096, 0x60392815
+0, 21, 21, 1, 36096, 0x7a7b0ac9
+0, 22, 22, 1, 36096, 0x36c1fe9c
+0, 23, 23, 1, 36096, 0x50bed8a4
+0, 24, 24, 1, 36096, 0x10f3b998
+0, 25, 25, 1, 36096, 0x18e5b516
+0, 26, 26, 1, 36096, 0x860597dc
+0, 27, 27, 1, 36096, 0x05488146
+0, 28, 28, 1, 36096, 0xac577cec
+0, 29, 29, 1, 36096, 0xc9f95550
+0, 30, 30, 1, 36096, 0xa0c95270
+0, 31, 31, 1, 36096, 0x977c5bf2
+0, 32, 32, 1, 36096, 0xc9f95550
+0, 33, 33, 1, 36096, 0xa0c95270
+0, 34, 34, 1, 36096, 0x977c5bf2
+0, 35, 35, 1, 36096, 0xc9f95550
+0, 36, 36, 1, 36096, 0xa0c95270
+0, 37, 37, 1, 36096, 0x977c5bf2
+0, 38, 38, 1, 36096, 0xc9f95550
+0, 39, 39, 1, 36096, 0xa0c95270
diff --git a/gst-libs/ext/libav/tests/ref/fate/vmnc-16bit b/gst-libs/ext/libav/tests/ref/fate/vmnc-16bit
index a298877..2a1848e 100644
--- a/gst-libs/ext/libav/tests/ref/fate/vmnc-16bit
+++ b/gst-libs/ext/libav/tests/ref/fate/vmnc-16bit
@@ -1,192 +1,193 @@
-0, 0, 864000, 0x9b1cee65
-0, 18000, 864000, 0x82950e3f
-0, 36000, 864000, 0x335f9678
-0, 54000, 864000, 0x6b86b7e7
-0, 72000, 864000, 0x25618cf2
-0, 90000, 864000, 0xed2196c9
-0, 108000, 864000, 0xbeaa31ba
-0, 126000, 864000, 0x14e6c8ab
-0, 144000, 864000, 0x17e5c196
-0, 162000, 864000, 0x4aa15110
-0, 180000, 864000, 0x4aa15110
-0, 198000, 864000, 0x4aa15110
-0, 216000, 864000, 0x3c2d3809
-0, 234000, 864000, 0xd075f4d0
-0, 252000, 864000, 0x0c3f2833
-0, 270000, 864000, 0xe7471872
-0, 288000, 864000, 0x4300b71d
-0, 306000, 864000, 0x6b5844ec
-0, 324000, 864000, 0xb3ebc395
-0, 342000, 864000, 0x39aa8a7d
-0, 360000, 864000, 0x52a3d93d
-0, 378000, 864000, 0x73adbdac
-0, 396000, 864000, 0xa9fd6cdc
-0, 414000, 864000, 0x4a085344
-0, 432000, 864000, 0xc21b943c
-0, 450000, 864000, 0xfaef6ed4
-0, 468000, 864000, 0xa3e9163c
-0, 486000, 864000, 0x917e2be4
-0, 504000, 864000, 0x2d89d534
-0, 522000, 864000, 0x6fe5a9e4
-0, 540000, 864000, 0x71af29ec
-0, 558000, 864000, 0x8f33f6ad
-0, 576000, 864000, 0xe7d46a24
-0, 594000, 864000, 0xb631e044
-0, 612000, 864000, 0x77db01cb
-0, 630000, 864000, 0x9861b6ec
-0, 648000, 864000, 0x973bd263
-0, 666000, 864000, 0xdd4c175b
-0, 684000, 864000, 0xdc28469b
-0, 702000, 864000, 0x67393ebb
-0, 720000, 864000, 0x01a06813
-0, 738000, 864000, 0x63e88f73
-0, 756000, 864000, 0x3ffbdd73
-0, 774000, 864000, 0xd25f790b
-0, 792000, 864000, 0x14e3c5d3
-0, 810000, 864000, 0x0d3d1202
-0, 828000, 864000, 0x69decf03
-0, 846000, 864000, 0x1b20ab93
-0, 864000, 864000, 0xee2f8d4a
-0, 882000, 864000, 0xaac44c52
-0, 900000, 864000, 0x3f874a5a
-0, 918000, 864000, 0x239b2d7a
-0, 936000, 864000, 0xb85db552
-0, 954000, 864000, 0xb12962a2
-0, 972000, 864000, 0xb8270fd9
-0, 990000, 864000, 0x14930601
-0, 1008000, 864000, 0x827a15c1
-0, 1026000, 864000, 0xe31011d1
-0, 1044000, 864000, 0xcd2154c1
-0, 1062000, 864000, 0xad02dbd9
-0, 1080000, 864000, 0x40c17d58
-0, 1098000, 864000, 0x8219e3b9
-0, 1116000, 864000, 0x2d348340
-0, 1134000, 864000, 0x6b61dfc9
-0, 1152000, 864000, 0xc8d95be1
-0, 1170000, 864000, 0x70ba0918
-0, 1188000, 864000, 0xdc728131
-0, 1206000, 864000, 0x9b054a10
-0, 1224000, 864000, 0x3983f751
-0, 1242000, 864000, 0x325fe1a9
-0, 1260000, 864000, 0x7a41eac0
-0, 1278000, 864000, 0x324372a8
-0, 1296000, 864000, 0xc014ea18
-0, 1314000, 864000, 0x1a506a1f
-0, 1332000, 864000, 0x47b59557
-0, 1350000, 864000, 0x5f2e194f
-0, 1368000, 864000, 0x9f6abb68
-0, 1386000, 864000, 0x831d2b97
-0, 1404000, 864000, 0x0635af7f
-0, 1422000, 864000, 0xe54a5626
-0, 1440000, 864000, 0x704dca4f
-0, 1458000, 864000, 0x47de6676
-0, 1476000, 864000, 0x609705fd
-0, 1494000, 864000, 0x8d92e086
-0, 1512000, 864000, 0xdb7dab5e
-0, 1530000, 864000, 0xe6ccb686
-0, 1548000, 864000, 0x0d137f66
-0, 1566000, 864000, 0xd200035d
-0, 1584000, 864000, 0x7dcb959d
-0, 1602000, 864000, 0xee849f75
-0, 1620000, 864000, 0x89d14acd
-0, 1638000, 864000, 0x3738029d
-0, 1656000, 864000, 0x6f4c4395
-0, 1674000, 864000, 0x06334395
-0, 1692000, 864000, 0x238b7c94
-0, 1710000, 864000, 0xfa5d1e14
-0, 1728000, 864000, 0x50b10e54
-0, 1746000, 864000, 0x9ed3b6e4
-0, 1764000, 864000, 0x68da9374
-0, 1782000, 864000, 0xb32a137c
-0, 1800000, 864000, 0x577d5084
-0, 1818000, 864000, 0xd262176b
-0, 1836000, 864000, 0xf58b44b3
-0, 1854000, 864000, 0xd0828edc
-0, 1872000, 864000, 0xc91a7544
-0, 1890000, 864000, 0x18ae7f1c
-0, 1908000, 864000, 0x82623643
-0, 1926000, 864000, 0x9cf82cfb
-0, 1944000, 864000, 0x93ad116b
-0, 1962000, 864000, 0xa669044b
-0, 1980000, 864000, 0x8adf88c3
-0, 1998000, 864000, 0xb83fb413
-0, 2016000, 864000, 0xb9e291f3
-0, 2034000, 864000, 0x5833dcc3
-0, 2052000, 864000, 0x4ab825aa
-0, 2070000, 864000, 0xb52c3b53
-0, 2088000, 864000, 0x0cb0dd53
-0, 2106000, 864000, 0x98b8dd52
-0, 2124000, 864000, 0x989230ba
-0, 2142000, 864000, 0xaed4c073
-0, 2160000, 864000, 0x76a7c83a
-0, 2178000, 864000, 0x02711eea
-0, 2196000, 864000, 0x8de65fe2
-0, 2214000, 864000, 0xc1163689
-0, 2232000, 864000, 0xc04f8b31
-0, 2250000, 864000, 0x69218d2a
-0, 2268000, 864000, 0x7e3abe62
-0, 2286000, 864000, 0x00ebe27a
-0, 2304000, 864000, 0x34803f11
-0, 2322000, 864000, 0x85591cd9
-0, 2340000, 864000, 0x8422fb51
-0, 2358000, 864000, 0x67c759e1
-0, 2376000, 864000, 0x4ac36af1
-0, 2394000, 864000, 0xdf00fca2
-0, 2412000, 864000, 0x74c633d1
-0, 2430000, 864000, 0x00251c31
-0, 2448000, 864000, 0x6d12a499
-0, 2466000, 864000, 0x1b6492e1
-0, 2484000, 864000, 0xdfc9a2a1
-0, 2502000, 864000, 0x33dcac79
-0, 2520000, 864000, 0x2305a499
-0, 2538000, 864000, 0xe1f3ae71
-0, 2556000, 864000, 0xc0cc92e1
-0, 2574000, 864000, 0x53d3b261
-0, 2592000, 864000, 0xf953aa81
-0, 2610000, 864000, 0x4108da69
-0, 2628000, 864000, 0xd6acf9e9
-0, 2646000, 864000, 0xb97ed900
-0, 2664000, 864000, 0x1d8b7a80
-0, 2682000, 864000, 0xd5406cb8
-0, 2700000, 864000, 0x5aa34948
-0, 2718000, 864000, 0x328eee01
-0, 2736000, 864000, 0xac92e621
-0, 2754000, 864000, 0x4fa1f5e1
-0, 2772000, 864000, 0xf7c4e8a8
-0, 2790000, 864000, 0xc358bd58
-0, 2808000, 864000, 0x29ec4b27
-0, 2826000, 864000, 0xf7219c88
-0, 2844000, 864000, 0xe77ff130
-0, 2862000, 864000, 0x73683417
-0, 2880000, 864000, 0x08b6be77
-0, 2898000, 864000, 0x3a7eea6f
-0, 2916000, 864000, 0xb319cce7
-0, 2934000, 864000, 0x9607b13e
-0, 2952000, 864000, 0x30543f0d
-0, 2970000, 864000, 0x56915a9e
-0, 2988000, 864000, 0x79f158a6
-0, 3006000, 864000, 0x498b8bd6
-0, 3024000, 864000, 0xe9ad7046
-0, 3042000, 864000, 0xe9ad7046
-0, 3060000, 864000, 0x10317e0e
-0, 3078000, 864000, 0x10317e0e
-0, 3096000, 864000, 0x10317e0e
-0, 3114000, 864000, 0x99ec7046
-0, 3132000, 864000, 0x924d46ee
-0, 3150000, 864000, 0x98bf333e
-0, 3168000, 864000, 0xb2625c96
-0, 3186000, 864000, 0xb46b3926
-0, 3204000, 864000, 0xeb4e5c96
-0, 3222000, 864000, 0x87154ece
-0, 3240000, 864000, 0x9e4c666e
-0, 3258000, 864000, 0x65b53d16
-0, 3276000, 864000, 0x99e85e8e
-0, 3294000, 864000, 0x650ba17e
-0, 3312000, 864000, 0x1ecb000e
-0, 3330000, 864000, 0xb942327d
-0, 3348000, 864000, 0x1bf20925
-0, 3366000, 864000, 0x61dba6a5
-0, 3384000, 864000, 0x5de16d8d
-0, 3402000, 864000, 0x4eb1f75d
-0, 3420000, 864000, 0x4eb1f75d
-0, 3438000, 864000, 0xd0750144
+#tb 0: 1/5
+0, 0, 0, 1, 864000, 0x9b1cee65
+0, 1, 1, 1, 864000, 0x82950e3f
+0, 2, 2, 1, 864000, 0x335f9678
+0, 3, 3, 1, 864000, 0x6b86b7e7
+0, 4, 4, 1, 864000, 0x25618cf2
+0, 5, 5, 1, 864000, 0xed2196c9
+0, 6, 6, 1, 864000, 0xbeaa31ba
+0, 7, 7, 1, 864000, 0x14e6c8ab
+0, 8, 8, 1, 864000, 0x17e5c196
+0, 9, 9, 1, 864000, 0x4aa15110
+0, 10, 10, 1, 864000, 0x4aa15110
+0, 11, 11, 1, 864000, 0x4aa15110
+0, 12, 12, 1, 864000, 0x3c2d3809
+0, 13, 13, 1, 864000, 0xd075f4d0
+0, 14, 14, 1, 864000, 0x0c3f2833
+0, 15, 15, 1, 864000, 0xe7471872
+0, 16, 16, 1, 864000, 0x4300b71d
+0, 17, 17, 1, 864000, 0x6b5844ec
+0, 18, 18, 1, 864000, 0xb3ebc395
+0, 19, 19, 1, 864000, 0x39aa8a7d
+0, 20, 20, 1, 864000, 0x52a3d93d
+0, 21, 21, 1, 864000, 0x73adbdac
+0, 22, 22, 1, 864000, 0xa9fd6cdc
+0, 23, 23, 1, 864000, 0x4a085344
+0, 24, 24, 1, 864000, 0xc21b943c
+0, 25, 25, 1, 864000, 0xfaef6ed4
+0, 26, 26, 1, 864000, 0xa3e9163c
+0, 27, 27, 1, 864000, 0x917e2be4
+0, 28, 28, 1, 864000, 0x2d89d534
+0, 29, 29, 1, 864000, 0x6fe5a9e4
+0, 30, 30, 1, 864000, 0x71af29ec
+0, 31, 31, 1, 864000, 0x8f33f6ad
+0, 32, 32, 1, 864000, 0xe7d46a24
+0, 33, 33, 1, 864000, 0xb631e044
+0, 34, 34, 1, 864000, 0x77db01cb
+0, 35, 35, 1, 864000, 0x9861b6ec
+0, 36, 36, 1, 864000, 0x973bd263
+0, 37, 37, 1, 864000, 0xdd4c175b
+0, 38, 38, 1, 864000, 0xdc28469b
+0, 39, 39, 1, 864000, 0x67393ebb
+0, 40, 40, 1, 864000, 0x01a06813
+0, 41, 41, 1, 864000, 0x63e88f73
+0, 42, 42, 1, 864000, 0x3ffbdd73
+0, 43, 43, 1, 864000, 0xd25f790b
+0, 44, 44, 1, 864000, 0x14e3c5d3
+0, 45, 45, 1, 864000, 0x0d3d1202
+0, 46, 46, 1, 864000, 0x69decf03
+0, 47, 47, 1, 864000, 0x1b20ab93
+0, 48, 48, 1, 864000, 0xee2f8d4a
+0, 49, 49, 1, 864000, 0xaac44c52
+0, 50, 50, 1, 864000, 0x3f874a5a
+0, 51, 51, 1, 864000, 0x239b2d7a
+0, 52, 52, 1, 864000, 0xb85db552
+0, 53, 53, 1, 864000, 0xb12962a2
+0, 54, 54, 1, 864000, 0xb8270fd9
+0, 55, 55, 1, 864000, 0x14930601
+0, 56, 56, 1, 864000, 0x827a15c1
+0, 57, 57, 1, 864000, 0xe31011d1
+0, 58, 58, 1, 864000, 0xcd2154c1
+0, 59, 59, 1, 864000, 0xad02dbd9
+0, 60, 60, 1, 864000, 0x40c17d58
+0, 61, 61, 1, 864000, 0x8219e3b9
+0, 62, 62, 1, 864000, 0x2d348340
+0, 63, 63, 1, 864000, 0x6b61dfc9
+0, 64, 64, 1, 864000, 0xc8d95be1
+0, 65, 65, 1, 864000, 0x70ba0918
+0, 66, 66, 1, 864000, 0xdc728131
+0, 67, 67, 1, 864000, 0x9b054a10
+0, 68, 68, 1, 864000, 0x3983f751
+0, 69, 69, 1, 864000, 0x325fe1a9
+0, 70, 70, 1, 864000, 0x7a41eac0
+0, 71, 71, 1, 864000, 0x324372a8
+0, 72, 72, 1, 864000, 0xc014ea18
+0, 73, 73, 1, 864000, 0x1a506a1f
+0, 74, 74, 1, 864000, 0x47b59557
+0, 75, 75, 1, 864000, 0x5f2e194f
+0, 76, 76, 1, 864000, 0x9f6abb68
+0, 77, 77, 1, 864000, 0x831d2b97
+0, 78, 78, 1, 864000, 0x0635af7f
+0, 79, 79, 1, 864000, 0xe54a5626
+0, 80, 80, 1, 864000, 0x704dca4f
+0, 81, 81, 1, 864000, 0x47de6676
+0, 82, 82, 1, 864000, 0x609705fd
+0, 83, 83, 1, 864000, 0x8d92e086
+0, 84, 84, 1, 864000, 0xdb7dab5e
+0, 85, 85, 1, 864000, 0xe6ccb686
+0, 86, 86, 1, 864000, 0x0d137f66
+0, 87, 87, 1, 864000, 0xd200035d
+0, 88, 88, 1, 864000, 0x7dcb959d
+0, 89, 89, 1, 864000, 0xee849f75
+0, 90, 90, 1, 864000, 0x89d14acd
+0, 91, 91, 1, 864000, 0x3738029d
+0, 92, 92, 1, 864000, 0x6f4c4395
+0, 93, 93, 1, 864000, 0x06334395
+0, 94, 94, 1, 864000, 0x238b7c94
+0, 95, 95, 1, 864000, 0xfa5d1e14
+0, 96, 96, 1, 864000, 0x50b10e54
+0, 97, 97, 1, 864000, 0x9ed3b6e4
+0, 98, 98, 1, 864000, 0x68da9374
+0, 99, 99, 1, 864000, 0xb32a137c
+0, 100, 100, 1, 864000, 0x577d5084
+0, 101, 101, 1, 864000, 0xd262176b
+0, 102, 102, 1, 864000, 0xf58b44b3
+0, 103, 103, 1, 864000, 0xd0828edc
+0, 104, 104, 1, 864000, 0xc91a7544
+0, 105, 105, 1, 864000, 0x18ae7f1c
+0, 106, 106, 1, 864000, 0x82623643
+0, 107, 107, 1, 864000, 0x9cf82cfb
+0, 108, 108, 1, 864000, 0x93ad116b
+0, 109, 109, 1, 864000, 0xa669044b
+0, 110, 110, 1, 864000, 0x8adf88c3
+0, 111, 111, 1, 864000, 0xb83fb413
+0, 112, 112, 1, 864000, 0xb9e291f3
+0, 113, 113, 1, 864000, 0x5833dcc3
+0, 114, 114, 1, 864000, 0x4ab825aa
+0, 115, 115, 1, 864000, 0xb52c3b53
+0, 116, 116, 1, 864000, 0x0cb0dd53
+0, 117, 117, 1, 864000, 0x98b8dd52
+0, 118, 118, 1, 864000, 0x989230ba
+0, 119, 119, 1, 864000, 0xaed4c073
+0, 120, 120, 1, 864000, 0x76a7c83a
+0, 121, 121, 1, 864000, 0x02711eea
+0, 122, 122, 1, 864000, 0x8de65fe2
+0, 123, 123, 1, 864000, 0xc1163689
+0, 124, 124, 1, 864000, 0xc04f8b31
+0, 125, 125, 1, 864000, 0x69218d2a
+0, 126, 126, 1, 864000, 0x7e3abe62
+0, 127, 127, 1, 864000, 0x00ebe27a
+0, 128, 128, 1, 864000, 0x34803f11
+0, 129, 129, 1, 864000, 0x85591cd9
+0, 130, 130, 1, 864000, 0x8422fb51
+0, 131, 131, 1, 864000, 0x67c759e1
+0, 132, 132, 1, 864000, 0x4ac36af1
+0, 133, 133, 1, 864000, 0xdf00fca2
+0, 134, 134, 1, 864000, 0x74c633d1
+0, 135, 135, 1, 864000, 0x00251c31
+0, 136, 136, 1, 864000, 0x6d12a499
+0, 137, 137, 1, 864000, 0x1b6492e1
+0, 138, 138, 1, 864000, 0xdfc9a2a1
+0, 139, 139, 1, 864000, 0x33dcac79
+0, 140, 140, 1, 864000, 0x2305a499
+0, 141, 141, 1, 864000, 0xe1f3ae71
+0, 142, 142, 1, 864000, 0xc0cc92e1
+0, 143, 143, 1, 864000, 0x53d3b261
+0, 144, 144, 1, 864000, 0xf953aa81
+0, 145, 145, 1, 864000, 0x4108da69
+0, 146, 146, 1, 864000, 0xd6acf9e9
+0, 147, 147, 1, 864000, 0xb97ed900
+0, 148, 148, 1, 864000, 0x1d8b7a80
+0, 149, 149, 1, 864000, 0xd5406cb8
+0, 150, 150, 1, 864000, 0x5aa34948
+0, 151, 151, 1, 864000, 0x328eee01
+0, 152, 152, 1, 864000, 0xac92e621
+0, 153, 153, 1, 864000, 0x4fa1f5e1
+0, 154, 154, 1, 864000, 0xf7c4e8a8
+0, 155, 155, 1, 864000, 0xc358bd58
+0, 156, 156, 1, 864000, 0x29ec4b27
+0, 157, 157, 1, 864000, 0xf7219c88
+0, 158, 158, 1, 864000, 0xe77ff130
+0, 159, 159, 1, 864000, 0x73683417
+0, 160, 160, 1, 864000, 0x08b6be77
+0, 161, 161, 1, 864000, 0x3a7eea6f
+0, 162, 162, 1, 864000, 0xb319cce7
+0, 163, 163, 1, 864000, 0x9607b13e
+0, 164, 164, 1, 864000, 0x30543f0d
+0, 165, 165, 1, 864000, 0x56915a9e
+0, 166, 166, 1, 864000, 0x79f158a6
+0, 167, 167, 1, 864000, 0x498b8bd6
+0, 168, 168, 1, 864000, 0xe9ad7046
+0, 169, 169, 1, 864000, 0xe9ad7046
+0, 170, 170, 1, 864000, 0x10317e0e
+0, 171, 171, 1, 864000, 0x10317e0e
+0, 172, 172, 1, 864000, 0x10317e0e
+0, 173, 173, 1, 864000, 0x99ec7046
+0, 174, 174, 1, 864000, 0x924d46ee
+0, 175, 175, 1, 864000, 0x98bf333e
+0, 176, 176, 1, 864000, 0xb2625c96
+0, 177, 177, 1, 864000, 0xb46b3926
+0, 178, 178, 1, 864000, 0xeb4e5c96
+0, 179, 179, 1, 864000, 0x87154ece
+0, 180, 180, 1, 864000, 0x9e4c666e
+0, 181, 181, 1, 864000, 0x65b53d16
+0, 182, 182, 1, 864000, 0x99e85e8e
+0, 183, 183, 1, 864000, 0x650ba17e
+0, 184, 184, 1, 864000, 0x1ecb000e
+0, 185, 185, 1, 864000, 0xb942327d
+0, 186, 186, 1, 864000, 0x1bf20925
+0, 187, 187, 1, 864000, 0x61dba6a5
+0, 188, 188, 1, 864000, 0x5de16d8d
+0, 189, 189, 1, 864000, 0x4eb1f75d
+0, 190, 190, 1, 864000, 0x4eb1f75d
+0, 191, 191, 1, 864000, 0xd0750144
diff --git a/gst-libs/ext/libav/tests/ref/fate/vmnc-32bit b/gst-libs/ext/libav/tests/ref/fate/vmnc-32bit
index 6abcd0d..d55d88f 100644
--- a/gst-libs/ext/libav/tests/ref/fate/vmnc-32bit
+++ b/gst-libs/ext/libav/tests/ref/fate/vmnc-32bit
@@ -1,49 +1,50 @@
-0, 0, 3655644, 0x87973530
-0, 18000, 3655644, 0x87973530
-0, 36000, 3655644, 0x3c3167fd
-0, 54000, 3655644, 0x87973530
-0, 72000, 3655644, 0x3c3167fd
-0, 90000, 3655644, 0x87973530
-0, 108000, 3655644, 0x87973530
-0, 126000, 3655644, 0x3c3167fd
-0, 144000, 3655644, 0x87973530
-0, 162000, 3655644, 0x4f0da763
-0, 180000, 3655644, 0x66a4a763
-0, 198000, 3655644, 0xb20a7496
-0, 216000, 3655644, 0x66a4a763
-0, 234000, 3655644, 0x5600644a
-0, 252000, 3655644, 0xce5880ee
-0, 270000, 3655644, 0xa993ef3d
-0, 288000, 3655644, 0x73564014
-0, 306000, 3655644, 0x2a6e1e8c
-0, 324000, 3655644, 0xbae02e7c
-0, 342000, 3655644, 0x55af4a2d
-0, 360000, 3655644, 0x54b7ff2d
-0, 378000, 3655644, 0x39af1aed
-0, 396000, 3655644, 0xe48dd11c
-0, 414000, 3655644, 0xba15c78d
-0, 432000, 3655644, 0x39af1aed
-0, 450000, 3655644, 0x27f96cd8
-0, 468000, 3655644, 0xf4f068dc
-0, 486000, 3655644, 0xf1c55cf5
-0, 504000, 3655644, 0xd932633d
-0, 522000, 3655644, 0xc6e95e0a
-0, 540000, 3655644, 0x9a63c9de
-0, 558000, 3655644, 0xf166ad4f
-0, 576000, 3655644, 0xe9eeba41
-0, 594000, 3655644, 0x7e598ad7
-0, 612000, 3655644, 0xf3bd257e
-0, 630000, 3655644, 0xf35b3852
-0, 648000, 3655644, 0x9d553959
-0, 666000, 3655644, 0x0a9de8e2
-0, 684000, 3655644, 0xf2325b6c
-0, 702000, 3655644, 0xcf924028
-0, 720000, 3655644, 0x8dae55bc
-0, 738000, 3655644, 0x57b08ced
-0, 756000, 3655644, 0xef89a1d8
-0, 774000, 3655644, 0x69e5503a
-0, 792000, 3655644, 0xc3de7b3f
-0, 810000, 3655644, 0x88eea64a
-0, 828000, 3655644, 0xe39cce1f
-0, 846000, 3655644, 0xf0ed0d04
-0, 864000, 3655644, 0x32490d3e
+#tb 0: 1/5
+0, 0, 0, 1, 3655644, 0x87973530
+0, 1, 1, 1, 3655644, 0x87973530
+0, 2, 2, 1, 3655644, 0x3c3167fd
+0, 5, 5, 1, 3655644, 0x87973530
+0, 7, 7, 1, 3655644, 0x3c3167fd
+0, 10, 10, 1, 3655644, 0x87973530
+0, 11, 11, 1, 3655644, 0x87973530
+0, 12, 12, 1, 3655644, 0x3c3167fd
+0, 15, 15, 1, 3655644, 0x87973530
+0, 18, 18, 1, 3655644, 0x4f0da763
+0, 19, 19, 1, 3655644, 0x66a4a763
+0, 20, 20, 1, 3655644, 0xb20a7496
+0, 23, 23, 1, 3655644, 0x66a4a763
+0, 24, 24, 1, 3655644, 0x5600644a
+0, 26, 26, 1, 3655644, 0xce5880ee
+0, 49, 49, 1, 3655644, 0xa993ef3d
+0, 61, 61, 1, 3655644, 0x73564014
+0, 64, 64, 1, 3655644, 0x2a6e1e8c
+0, 68, 68, 1, 3655644, 0xbae02e7c
+0, 72, 72, 1, 3655644, 0x55af4a2d
+0, 73, 73, 1, 3655644, 0x54b7ff2d
+0, 77, 77, 1, 3655644, 0x39af1aed
+0, 82, 82, 1, 3655644, 0xe48dd11c
+0, 89, 89, 1, 3655644, 0xba15c78d
+0, 96, 96, 1, 3655644, 0x39af1aed
+0, 103, 103, 1, 3655644, 0x27f96cd8
+0, 110, 110, 1, 3655644, 0xf4f068dc
+0, 111, 111, 1, 3655644, 0xf1c55cf5
+0, 113, 113, 1, 3655644, 0xd932633d
+0, 114, 114, 1, 3655644, 0xc6e95e0a
+0, 115, 115, 1, 3655644, 0x9a63c9de
+0, 116, 116, 1, 3655644, 0xf166ad4f
+0, 117, 117, 1, 3655644, 0xe9eeba41
+0, 118, 118, 1, 3655644, 0x7e598ad7
+0, 123, 123, 1, 3655644, 0xf3bd257e
+0, 127, 127, 1, 3655644, 0xf35b3852
+0, 128, 128, 1, 3655644, 0x9d553959
+0, 129, 129, 1, 3655644, 0x0a9de8e2
+0, 135, 135, 1, 3655644, 0xf2325b6c
+0, 137, 137, 1, 3655644, 0xcf924028
+0, 139, 139, 1, 3655644, 0x8dae55bc
+0, 141, 141, 1, 3655644, 0x57b08ced
+0, 143, 143, 1, 3655644, 0xef89a1d8
+0, 145, 145, 1, 3655644, 0x69e5503a
+0, 147, 147, 1, 3655644, 0xc3de7b3f
+0, 149, 149, 1, 3655644, 0x88eea64a
+0, 162, 162, 1, 3655644, 0xe39cce1f
+0, 166, 166, 1, 3655644, 0xf0ed0d04
+0, 171, 171, 1, 3655644, 0x32490d3e
diff --git a/gst-libs/ext/libav/tests/ref/fate/vp3-coeff-level64 b/gst-libs/ext/libav/tests/ref/fate/vp3-coeff-level64
index 31a49aa..d6abb62 100644
--- a/gst-libs/ext/libav/tests/ref/fate/vp3-coeff-level64
+++ b/gst-libs/ext/libav/tests/ref/fate/vp3-coeff-level64
@@ -1,8 +1,9 @@
-0, 0, 4617600, 0x4ba6df50
-0, 6000, 4617600, 0x419fdeaf
-0, 12000, 4617600, 0xeb2edced
-0, 18000, 4617600, 0xa2bb3a1a
-0, 24000, 4617600, 0x411cfb36
-0, 30000, 4617600, 0xb2dc22ed
-0, 36000, 4617600, 0x236d23b5
-0, 42000, 4617600, 0x7fef275e
+#tb 0: 1/1000
+0, 0, 0, 0, 4617600, 0x4ba6df50
+0, 66, 66, 0, 4617600, 0x419fdeaf
+0, 132, 132, 0, 4617600, 0xeb2edced
+0, 198, 198, 0, 4617600, 0xa2bb3a1a
+0, 264, 264, 0, 4617600, 0x411cfb36
+0, 330, 330, 0, 4617600, 0xb2dc22ed
+0, 396, 396, 0, 4617600, 0x236d23b5
+0, 462, 462, 0, 4617600, 0x7fef275e
diff --git a/gst-libs/ext/libav/tests/ref/fate/vp31 b/gst-libs/ext/libav/tests/ref/fate/vp31
index 7c3d7d1..48221c1 100644
--- a/gst-libs/ext/libav/tests/ref/fate/vp31
+++ b/gst-libs/ext/libav/tests/ref/fate/vp31
@@ -1,114 +1,115 @@
-0, 0, 261120, 0xc50dec2b
-0, 3600, 261120, 0xaa8d4441
-0, 7200, 261120, 0x932b0d44
-0, 10800, 261120, 0x125e1af7
-0, 14400, 261120, 0x09a763a5
-0, 18000, 261120, 0x56939852
-0, 21600, 261120, 0x0eda6d35
-0, 25200, 261120, 0x2f0d3869
-0, 28800, 261120, 0xe177c34c
-0, 32400, 261120, 0x5d4e833a
-0, 36000, 261120, 0x42e26e7a
-0, 39600, 261120, 0xf5a60b4c
-0, 43200, 261120, 0x29938341
-0, 46800, 261120, 0x0a9ebb80
-0, 50400, 261120, 0xd18c6a11
-0, 54000, 261120, 0x4b8212ac
-0, 57600, 261120, 0x7902aabc
-0, 61200, 261120, 0x4babac44
-0, 64800, 261120, 0xf33efa46
-0, 68400, 261120, 0x110dd40a
-0, 72000, 261120, 0xae327a8a
-0, 75600, 261120, 0xab757d75
-0, 79200, 261120, 0xfbd1402d
-0, 82800, 261120, 0x4f2c5d31
-0, 86400, 261120, 0xc7ea2149
-0, 90000, 261120, 0x86072cf7
-0, 93600, 261120, 0x37c2f2ed
-0, 97200, 261120, 0x1d51ee83
-0, 100800, 261120, 0x72291b8b
-0, 104400, 261120, 0xe9c8ffaf
-0, 108000, 261120, 0x657a1615
-0, 111600, 261120, 0x6f832019
-0, 115200, 261120, 0xf4445a22
-0, 118800, 261120, 0x105306f0
-0, 122400, 261120, 0x34c0c36b
-0, 126000, 261120, 0x7767be18
-0, 129600, 261120, 0x88a7eaeb
-0, 133200, 261120, 0x797e69e4
-0, 136800, 261120, 0x78901f02
-0, 140400, 261120, 0xbc91758e
-0, 144000, 261120, 0x35d47b24
-0, 147600, 261120, 0xaf0ebc82
-0, 151200, 261120, 0x40e63004
-0, 154800, 261120, 0x70d1c5c1
-0, 158400, 261120, 0x8aea2b70
-0, 162000, 261120, 0x51f3cd81
-0, 165600, 261120, 0x8f8584b7
-0, 169200, 261120, 0x921541fb
-0, 172800, 261120, 0xddd3f1ea
-0, 176400, 261120, 0x6be2e960
-0, 180000, 261120, 0x72997a1f
-0, 183600, 261120, 0xe70fc009
-0, 187200, 261120, 0x816a0687
-0, 190800, 261120, 0x2aa79e82
-0, 194400, 261120, 0x85f2fe5c
-0, 198000, 261120, 0x000dd8b6
-0, 201600, 261120, 0x1be19dd4
-0, 205200, 261120, 0xadea80e5
-0, 208800, 261120, 0x0cc2204f
-0, 212400, 261120, 0xd62968a8
-0, 216000, 261120, 0x0afc75c2
-0, 219600, 261120, 0x82341f09
-0, 223200, 261120, 0xbf7e66cd
-0, 226800, 261120, 0x8f3491df
-0, 230400, 261120, 0xc316d383
-0, 234000, 261120, 0x3de7f632
-0, 237600, 261120, 0xda55cfb0
-0, 241200, 261120, 0xbd88bb46
-0, 244800, 261120, 0x75444b17
-0, 248400, 261120, 0x798cc498
-0, 252000, 261120, 0xf9a60fa6
-0, 255600, 261120, 0xbd8debd7
-0, 259200, 261120, 0x7c890029
-0, 262800, 261120, 0x7a75e44a
-0, 266400, 261120, 0x1f04611c
-0, 270000, 261120, 0x96b3ee93
-0, 273600, 261120, 0x7fc11f39
-0, 277200, 261120, 0xe87d6864
-0, 280800, 261120, 0x6797d904
-0, 284400, 261120, 0x9e3e7bde
-0, 288000, 261120, 0xc31a8039
-0, 291600, 261120, 0xe3ef4cf7
-0, 295200, 261120, 0x83c56fc9
-0, 298800, 261120, 0xb304f7aa
-0, 302400, 261120, 0x039a7080
-0, 306000, 261120, 0xffb08224
-0, 309600, 261120, 0xa7be783a
-0, 313200, 261120, 0x572beff3
-0, 316800, 261120, 0x1bc59ae8
-0, 320400, 261120, 0x11c8feb4
-0, 324000, 261120, 0xe2398651
-0, 327600, 261120, 0x37c3efba
-0, 331200, 261120, 0xb32f0dd4
-0, 334800, 261120, 0x66880c50
-0, 338400, 261120, 0x4f7392c8
-0, 342000, 261120, 0x3d5c08f6
-0, 345600, 261120, 0xfd129211
-0, 349200, 261120, 0x9b396ebe
-0, 352800, 261120, 0x75ab9a4a
-0, 356400, 261120, 0xf8c4e7ea
-0, 360000, 261120, 0xdd48c7c3
-0, 363600, 261120, 0xdebf20e6
-0, 367200, 261120, 0x35c32091
-0, 370800, 261120, 0xce5a49c7
-0, 374400, 261120, 0x69fc8e0d
-0, 378000, 261120, 0x43a08b41
-0, 381600, 261120, 0x01a0513c
-0, 385200, 261120, 0x1d3f490a
-0, 388800, 261120, 0xb44df252
-0, 392400, 261120, 0x1259753e
-0, 396000, 261120, 0x4a1538d6
-0, 399600, 261120, 0xd5ed4bd5
-0, 403200, 261120, 0xa21590b5
-0, 406800, 261120, 0xfb2de1f7
+#tb 0: 1/25
+0, 0, 0, 1, 261120, 0xc50dec2b
+0, 1, 1, 1, 261120, 0xaa8d4441
+0, 2, 2, 1, 261120, 0x932b0d44
+0, 3, 3, 1, 261120, 0x125e1af7
+0, 4, 4, 1, 261120, 0x09a763a5
+0, 5, 5, 1, 261120, 0x56939852
+0, 6, 6, 1, 261120, 0x0eda6d35
+0, 7, 7, 1, 261120, 0x2f0d3869
+0, 8, 8, 1, 261120, 0xe177c34c
+0, 9, 9, 1, 261120, 0x5d4e833a
+0, 10, 10, 1, 261120, 0x42e26e7a
+0, 11, 11, 1, 261120, 0xf5a60b4c
+0, 12, 12, 1, 261120, 0x29938341
+0, 13, 13, 1, 261120, 0x0a9ebb80
+0, 14, 14, 1, 261120, 0xd18c6a11
+0, 15, 15, 1, 261120, 0x4b8212ac
+0, 16, 16, 1, 261120, 0x7902aabc
+0, 17, 17, 1, 261120, 0x4babac44
+0, 18, 18, 1, 261120, 0xf33efa46
+0, 19, 19, 1, 261120, 0x110dd40a
+0, 20, 20, 1, 261120, 0xae327a8a
+0, 21, 21, 1, 261120, 0xab757d75
+0, 22, 22, 1, 261120, 0xfbd1402d
+0, 23, 23, 1, 261120, 0x4f2c5d31
+0, 24, 24, 1, 261120, 0xc7ea2149
+0, 25, 25, 1, 261120, 0x86072cf7
+0, 26, 26, 1, 261120, 0x37c2f2ed
+0, 27, 27, 1, 261120, 0x1d51ee83
+0, 28, 28, 1, 261120, 0x72291b8b
+0, 29, 29, 1, 261120, 0xe9c8ffaf
+0, 30, 30, 1, 261120, 0x657a1615
+0, 31, 31, 1, 261120, 0x6f832019
+0, 32, 32, 1, 261120, 0xf4445a22
+0, 33, 33, 1, 261120, 0x105306f0
+0, 34, 34, 1, 261120, 0x34c0c36b
+0, 35, 35, 1, 261120, 0x7767be18
+0, 36, 36, 1, 261120, 0x88a7eaeb
+0, 37, 37, 1, 261120, 0x797e69e4
+0, 38, 38, 1, 261120, 0x78901f02
+0, 39, 39, 1, 261120, 0xbc91758e
+0, 40, 40, 1, 261120, 0x35d47b24
+0, 41, 41, 1, 261120, 0xaf0ebc82
+0, 42, 42, 1, 261120, 0x40e63004
+0, 43, 43, 1, 261120, 0x70d1c5c1
+0, 44, 44, 1, 261120, 0x8aea2b70
+0, 45, 45, 1, 261120, 0x51f3cd81
+0, 46, 46, 1, 261120, 0x8f8584b7
+0, 47, 47, 1, 261120, 0x921541fb
+0, 48, 48, 1, 261120, 0xddd3f1ea
+0, 49, 49, 1, 261120, 0x6be2e960
+0, 50, 50, 1, 261120, 0x72997a1f
+0, 51, 51, 1, 261120, 0xe70fc009
+0, 52, 52, 1, 261120, 0x816a0687
+0, 53, 53, 1, 261120, 0x2aa79e82
+0, 54, 54, 1, 261120, 0x85f2fe5c
+0, 55, 55, 1, 261120, 0x000dd8b6
+0, 56, 56, 1, 261120, 0x1be19dd4
+0, 57, 57, 1, 261120, 0xadea80e5
+0, 58, 58, 1, 261120, 0x0cc2204f
+0, 59, 59, 1, 261120, 0xd62968a8
+0, 60, 60, 1, 261120, 0x0afc75c2
+0, 61, 61, 1, 261120, 0x82341f09
+0, 62, 62, 1, 261120, 0xbf7e66cd
+0, 63, 63, 1, 261120, 0x8f3491df
+0, 64, 64, 1, 261120, 0xc316d383
+0, 65, 65, 1, 261120, 0x3de7f632
+0, 66, 66, 1, 261120, 0xda55cfb0
+0, 67, 67, 1, 261120, 0xbd88bb46
+0, 68, 68, 1, 261120, 0x75444b17
+0, 69, 69, 1, 261120, 0x798cc498
+0, 70, 70, 1, 261120, 0xf9a60fa6
+0, 71, 71, 1, 261120, 0xbd8debd7
+0, 72, 72, 1, 261120, 0x7c890029
+0, 73, 73, 1, 261120, 0x7a75e44a
+0, 74, 74, 1, 261120, 0x1f04611c
+0, 75, 75, 1, 261120, 0x96b3ee93
+0, 76, 76, 1, 261120, 0x7fc11f39
+0, 77, 77, 1, 261120, 0xe87d6864
+0, 78, 78, 1, 261120, 0x6797d904
+0, 79, 79, 1, 261120, 0x9e3e7bde
+0, 80, 80, 1, 261120, 0xc31a8039
+0, 81, 81, 1, 261120, 0xe3ef4cf7
+0, 82, 82, 1, 261120, 0x83c56fc9
+0, 83, 83, 1, 261120, 0xb304f7aa
+0, 84, 84, 1, 261120, 0x039a7080
+0, 85, 85, 1, 261120, 0xffb08224
+0, 86, 86, 1, 261120, 0xa7be783a
+0, 87, 87, 1, 261120, 0x572beff3
+0, 88, 88, 1, 261120, 0x1bc59ae8
+0, 89, 89, 1, 261120, 0x11c8feb4
+0, 90, 90, 1, 261120, 0xe2398651
+0, 91, 91, 1, 261120, 0x37c3efba
+0, 92, 92, 1, 261120, 0xb32f0dd4
+0, 93, 93, 1, 261120, 0x66880c50
+0, 94, 94, 1, 261120, 0x4f7392c8
+0, 95, 95, 1, 261120, 0x3d5c08f6
+0, 96, 96, 1, 261120, 0xfd129211
+0, 97, 97, 1, 261120, 0x9b396ebe
+0, 98, 98, 1, 261120, 0x75ab9a4a
+0, 99, 99, 1, 261120, 0xf8c4e7ea
+0, 100, 100, 1, 261120, 0xdd48c7c3
+0, 101, 101, 1, 261120, 0xdebf20e6
+0, 102, 102, 1, 261120, 0x35c32091
+0, 103, 103, 1, 261120, 0xce5a49c7
+0, 104, 104, 1, 261120, 0x69fc8e0d
+0, 105, 105, 1, 261120, 0x43a08b41
+0, 106, 106, 1, 261120, 0x01a0513c
+0, 107, 107, 1, 261120, 0x1d3f490a
+0, 108, 108, 1, 261120, 0xb44df252
+0, 109, 109, 1, 261120, 0x1259753e
+0, 110, 110, 1, 261120, 0x4a1538d6
+0, 111, 111, 1, 261120, 0xd5ed4bd5
+0, 112, 112, 1, 261120, 0xa21590b5
+0, 113, 113, 1, 261120, 0xfb2de1f7
diff --git a/gst-libs/ext/libav/tests/ref/fate/vp5 b/gst-libs/ext/libav/tests/ref/fate/vp5
index bf67801..791fe60 100644
--- a/gst-libs/ext/libav/tests/ref/fate/vp5
+++ b/gst-libs/ext/libav/tests/ref/fate/vp5
@@ -1,246 +1,247 @@
-0, 0, 233472, 0x27488413
-0, 3754, 233472, 0x4af384b5
-0, 7508, 233472, 0x948d845d
-0, 11261, 233472, 0xd6ed845e
-0, 15015, 233472, 0x230f8444
-0, 18769, 233472, 0x230f8444
-0, 22523, 233472, 0x230f8444
-0, 26276, 233472, 0xa5078424
-0, 30030, 233472, 0xa5078424
-0, 33784, 233472, 0xa5078424
-0, 37538, 233472, 0xa5078424
-0, 41291, 233472, 0xa5078424
-0, 45045, 233472, 0xa5078424
-0, 48799, 233472, 0xa5078424
-0, 52553, 233472, 0xa5078424
-0, 56306, 233472, 0xa5078424
-0, 60060, 233472, 0xa5078424
-0, 63814, 233472, 0xa5078424
-0, 67568, 233472, 0xa5078424
-0, 71321, 233472, 0xa5078424
-0, 75075, 233472, 0xa5078424
-0, 78829, 233472, 0xa5078424
-0, 82583, 233472, 0xa5078424
-0, 86336, 233472, 0xa5078424
-0, 90090, 233472, 0xa5078424
-0, 93844, 233472, 0xa5078424
-0, 97598, 233472, 0xa5078424
-0, 101351, 233472, 0xa5078424
-0, 105105, 233472, 0xa5078424
-0, 108859, 233472, 0xa5078424
-0, 112613, 233472, 0xa5078424
-0, 116366, 233472, 0xa5078424
-0, 120120, 233472, 0xa5078424
-0, 123874, 233472, 0xa5078424
-0, 127628, 233472, 0xa5078424
-0, 131381, 233472, 0xa5078424
-0, 135135, 233472, 0xa5078424
-0, 138889, 233472, 0xa5078424
-0, 142643, 233472, 0xa5078424
-0, 146396, 233472, 0xa5078424
-0, 150150, 233472, 0x05667dea
-0, 153904, 233472, 0x6ae1823e
-0, 157658, 233472, 0x3c8a7ea9
-0, 161411, 233472, 0xcae2832a
-0, 165165, 233472, 0x547a7ec2
-0, 168919, 233472, 0xa6628327
-0, 172673, 233472, 0xecd77edc
-0, 176426, 233472, 0xe9538356
-0, 180180, 233472, 0xca297eb1
-0, 183934, 233472, 0xe5648329
-0, 187688, 233472, 0xad8c7e94
-0, 191441, 233472, 0xca0d82fc
-0, 195195, 233472, 0x62277e8d
-0, 198949, 233472, 0x7ef782f5
-0, 202703, 233472, 0x09b27e8d
-0, 206456, 233472, 0x66f382f5
-0, 210210, 233472, 0x0aaa7e8d
-0, 213964, 233472, 0x676b82f5
-0, 217718, 233472, 0x0a8a7e8d
-0, 221471, 233472, 0x670b82f5
-0, 225225, 233472, 0x09fa7e8d
-0, 228979, 233472, 0x671b82f5
-0, 232733, 233472, 0x0ac27e8d
-0, 236486, 233472, 0x674382f5
-0, 240240, 233472, 0x0a727e8d
-0, 243994, 233472, 0x673382f5
-0, 247748, 233472, 0x0a127e8d
-0, 251501, 233472, 0x66f382f5
-0, 255255, 233472, 0x0aaa7e8d
-0, 259009, 233472, 0x676b82f5
-0, 262763, 233472, 0x0a8a7e8d
-0, 266516, 233472, 0x670b82f5
-0, 270270, 233472, 0x09fa7e8d
-0, 274024, 233472, 0x671b82f5
-0, 277778, 233472, 0x0ac27e8d
-0, 281531, 233472, 0x674382f5
-0, 285285, 233472, 0x0a727e8d
-0, 289039, 233472, 0x673382f5
-0, 292793, 233472, 0x0a127e8d
-0, 296546, 233472, 0xa3917e7f
-0, 300300, 233472, 0x0554868d
-0, 304054, 233472, 0x05ba6d7a
-0, 307808, 233472, 0x05ba6d7a
-0, 311561, 233472, 0x05ba6d7a
-0, 315315, 233472, 0x05ba6d7a
-0, 319069, 233472, 0x05ba6d7a
-0, 322823, 233472, 0x05ba6d7a
-0, 326576, 233472, 0x05ba6d7a
-0, 330330, 233472, 0x05ba6d7a
-0, 334084, 233472, 0x05ba6d7a
-0, 337838, 233472, 0x05ba6d7a
-0, 341591, 233472, 0x05ba6d7a
-0, 345345, 233472, 0x05ba6d7a
-0, 349099, 233472, 0x05ba6d7a
-0, 352853, 233472, 0x05ba6d7a
-0, 356606, 233472, 0x05ba6d7a
-0, 360360, 233472, 0x05ba6d7a
-0, 364114, 233472, 0x05ba6d7a
-0, 367868, 233472, 0x05ba6d7a
-0, 371621, 233472, 0x05ba6d7a
-0, 375375, 233472, 0x05ba6d7a
-0, 379129, 233472, 0x05ba6d7a
-0, 382883, 233472, 0x05ba6d7a
-0, 386636, 233472, 0x05ba6d7a
-0, 390390, 233472, 0x3a6a6d61
-0, 394144, 233472, 0x0bab7adc
-0, 397898, 233472, 0x12b44993
-0, 401651, 233472, 0xa20ad6d1
-0, 405405, 233472, 0xfd916a4a
-0, 409159, 233472, 0xd34f3e95
-0, 412913, 233472, 0x19571d5c
-0, 416666, 233472, 0x7c8351ad
-0, 420420, 233472, 0xea279823
-0, 424174, 233472, 0xc5011cfd
-0, 427928, 233472, 0xbd7fb9af
-0, 431681, 233472, 0xdfb3bb7c
-0, 435435, 233472, 0x6d631236
-0, 439189, 233472, 0xdb579a7b
-0, 442943, 233472, 0x47584a3e
-0, 446696, 233472, 0x7a27a914
-0, 450450, 233472, 0x2996270d
-0, 454204, 233472, 0xefeaa7ed
-0, 457958, 233472, 0xa3e74ae1
-0, 461711, 233472, 0x8a51d61c
-0, 465465, 233472, 0x25085ee7
-0, 469219, 233472, 0x0a811253
-0, 472973, 233472, 0x7d3eda84
-0, 476726, 233472, 0xd0a0887d
-0, 480480, 233472, 0xc9e6702c
-0, 484234, 233472, 0x0da14346
-0, 487988, 233472, 0x040f0605
-0, 491741, 233472, 0x76ea841a
-0, 495495, 233472, 0x105b6600
-0, 499249, 233472, 0x73015e08
-0, 503003, 233472, 0xe77d6662
-0, 506756, 233472, 0x7514fcd1
-0, 510510, 233472, 0xb091a850
-0, 514264, 233472, 0x74ccdccd
-0, 518018, 233472, 0xd1c002fc
-0, 521771, 233472, 0x7bfcfdac
-0, 525525, 233472, 0xf48a133f
-0, 529279, 233472, 0x279c16dd
-0, 533033, 233472, 0x58427907
-0, 536786, 233472, 0x4668a8f2
-0, 540540, 233472, 0x93fb555f
-0, 544294, 233472, 0x49ed3cf2
-0, 548048, 233472, 0xd620fac9
-0, 551801, 233472, 0xe4efae83
-0, 555555, 233472, 0xe4d377be
-0, 559309, 233472, 0x6fc229c1
-0, 563063, 233472, 0xab5a8898
-0, 566816, 233472, 0x58a493dd
-0, 570570, 233472, 0x5c1c1093
-0, 574324, 233472, 0x2d831af9
-0, 578078, 233472, 0x9a0d3cdf
-0, 581831, 233472, 0x2be78f0b
-0, 585585, 233472, 0xfc7cc656
-0, 589339, 233472, 0xaa8624b7
-0, 593093, 233472, 0xb9c9afc1
-0, 596846, 233472, 0x709e8009
-0, 600600, 233472, 0xd2260830
-0, 604354, 233472, 0xadb3954e
-0, 608108, 233472, 0x74fc3e65
-0, 611861, 233472, 0xb4bcdea4
-0, 615615, 233472, 0x60c46cf5
-0, 619369, 233472, 0x0e48eff8
-0, 623123, 233472, 0x60e46733
-0, 626876, 233472, 0x708ec89f
-0, 630630, 233472, 0x1f11264e
-0, 634384, 233472, 0x6cba8300
-0, 638138, 233472, 0xd1a5d756
-0, 641891, 233472, 0xb936621e
-0, 645645, 233472, 0x1667b4af
-0, 649399, 233472, 0xc212276d
-0, 653153, 233472, 0x9d7a871d
-0, 656906, 233472, 0xb52834f9
-0, 660660, 233472, 0x983bde84
-0, 664414, 233472, 0xd1c63d88
-0, 668168, 233472, 0xa38cb687
-0, 671921, 233472, 0xd81bf8ff
-0, 675675, 233472, 0x688b231a
-0, 679429, 233472, 0xd5ad3038
-0, 683183, 233472, 0xcd227f74
-0, 686936, 233472, 0x81ec23d6
-0, 690690, 233472, 0x52c1cd86
-0, 694444, 233472, 0xa4199853
-0, 698198, 233472, 0xe82c83e4
-0, 701951, 233472, 0xe9810f88
-0, 705705, 233472, 0x37e95ae7
-0, 709459, 233472, 0xf6974d5d
-0, 713213, 233472, 0x31788551
-0, 716966, 233472, 0x00d6c539
-0, 720720, 233472, 0xdbb52151
-0, 724474, 233472, 0x594433d3
-0, 728228, 233472, 0xeec44f91
-0, 731981, 233472, 0x302894bf
-0, 735735, 233472, 0x44f5ddc3
-0, 739489, 233472, 0x6c1edd28
-0, 743243, 233472, 0x7fd1e412
-0, 746996, 233472, 0xd771f11b
-0, 750750, 233472, 0x09c675d5
-0, 754504, 233472, 0x8fd9112e
-0, 758258, 233472, 0x602002e5
-0, 762011, 233472, 0xb9a22029
-0, 765765, 233472, 0x18e99807
-0, 769519, 233472, 0x3d8657d8
-0, 773273, 233472, 0x4cd73a85
-0, 777026, 233472, 0x84ddb474
-0, 780780, 233472, 0x69636bb8
-0, 784534, 233472, 0xa0436d50
-0, 788288, 233472, 0x93c86d78
-0, 792041, 233472, 0x05ba6d7a
-0, 795795, 233472, 0x05ba6d7a
-0, 799549, 233472, 0x05ba6d7a
-0, 803303, 233472, 0x126c6406
-0, 807056, 233472, 0xe3885a3a
-0, 810810, 233472, 0xf1256fe9
-0, 814564, 233472, 0x5a84377e
-0, 818318, 233472, 0x7c392d90
-0, 822071, 233472, 0x8a74df48
-0, 825825, 233472, 0xfa394653
-0, 829579, 233472, 0xcbe0cc1b
-0, 833333, 233472, 0xbf8639cf
-0, 837086, 233472, 0x7dd2c935
-0, 840840, 233472, 0x1093148f
-0, 844594, 233472, 0x624d7d3e
-0, 848348, 233472, 0xb340cd65
-0, 852101, 233472, 0x6c0ae5c6
-0, 855855, 233472, 0x0c5eaf73
-0, 859609, 233472, 0x27be64ce
-0, 863363, 233472, 0xac8990f4
-0, 867116, 233472, 0x1f935102
-0, 870870, 233472, 0x6e57d96f
-0, 874624, 233472, 0xf246ea4d
-0, 878378, 233472, 0x18058011
-0, 882131, 233472, 0x5951fe6e
-0, 885885, 233472, 0x0f10371d
-0, 889639, 233472, 0xe1481043
-0, 893393, 233472, 0xdedeefcc
-0, 897146, 233472, 0xf8865db2
-0, 900900, 233472, 0xe1b3d4d6
-0, 904654, 233472, 0x81962c43
-0, 908408, 233472, 0xe903d0bb
-0, 912161, 233472, 0x6f530ac6
-0, 915915, 233472, 0x94f7466c
-0, 919669, 233472, 0xa8c1d365
+#tb 0: 1001/24000
+0, 0, 0, 1, 233472, 0x27488413
+0, 1, 1, 1, 233472, 0x4af384b5
+0, 2, 2, 1, 233472, 0x948d845d
+0, 3, 3, 1, 233472, 0xd6ed845e
+0, 4, 4, 1, 233472, 0x230f8444
+0, 5, 5, 1, 233472, 0x230f8444
+0, 6, 6, 1, 233472, 0x230f8444
+0, 7, 7, 1, 233472, 0xa5078424
+0, 8, 8, 1, 233472, 0xa5078424
+0, 9, 9, 1, 233472, 0xa5078424
+0, 10, 10, 1, 233472, 0xa5078424
+0, 11, 11, 1, 233472, 0xa5078424
+0, 12, 12, 1, 233472, 0xa5078424
+0, 13, 13, 1, 233472, 0xa5078424
+0, 14, 14, 1, 233472, 0xa5078424
+0, 15, 15, 1, 233472, 0xa5078424
+0, 16, 16, 1, 233472, 0xa5078424
+0, 17, 17, 1, 233472, 0xa5078424
+0, 18, 18, 1, 233472, 0xa5078424
+0, 19, 19, 1, 233472, 0xa5078424
+0, 20, 20, 1, 233472, 0xa5078424
+0, 21, 21, 1, 233472, 0xa5078424
+0, 22, 22, 1, 233472, 0xa5078424
+0, 23, 23, 1, 233472, 0xa5078424
+0, 24, 24, 1, 233472, 0xa5078424
+0, 25, 25, 1, 233472, 0xa5078424
+0, 26, 26, 1, 233472, 0xa5078424
+0, 27, 27, 1, 233472, 0xa5078424
+0, 28, 28, 1, 233472, 0xa5078424
+0, 29, 29, 1, 233472, 0xa5078424
+0, 30, 30, 1, 233472, 0xa5078424
+0, 31, 31, 1, 233472, 0xa5078424
+0, 32, 32, 1, 233472, 0xa5078424
+0, 33, 33, 1, 233472, 0xa5078424
+0, 34, 34, 1, 233472, 0xa5078424
+0, 35, 35, 1, 233472, 0xa5078424
+0, 36, 36, 1, 233472, 0xa5078424
+0, 37, 37, 1, 233472, 0xa5078424
+0, 38, 38, 1, 233472, 0xa5078424
+0, 39, 39, 1, 233472, 0xa5078424
+0, 40, 40, 1, 233472, 0x05667dea
+0, 41, 41, 1, 233472, 0x6ae1823e
+0, 42, 42, 1, 233472, 0x3c8a7ea9
+0, 43, 43, 1, 233472, 0xcae2832a
+0, 44, 44, 1, 233472, 0x547a7ec2
+0, 45, 45, 1, 233472, 0xa6628327
+0, 46, 46, 1, 233472, 0xecd77edc
+0, 47, 47, 1, 233472, 0xe9538356
+0, 48, 48, 1, 233472, 0xca297eb1
+0, 49, 49, 1, 233472, 0xe5648329
+0, 50, 50, 1, 233472, 0xad8c7e94
+0, 51, 51, 1, 233472, 0xca0d82fc
+0, 52, 52, 1, 233472, 0x62277e8d
+0, 53, 53, 1, 233472, 0x7ef782f5
+0, 54, 54, 1, 233472, 0x09b27e8d
+0, 55, 55, 1, 233472, 0x66f382f5
+0, 56, 56, 1, 233472, 0x0aaa7e8d
+0, 57, 57, 1, 233472, 0x676b82f5
+0, 58, 58, 1, 233472, 0x0a8a7e8d
+0, 59, 59, 1, 233472, 0x670b82f5
+0, 60, 60, 1, 233472, 0x09fa7e8d
+0, 61, 61, 1, 233472, 0x671b82f5
+0, 62, 62, 1, 233472, 0x0ac27e8d
+0, 63, 63, 1, 233472, 0x674382f5
+0, 64, 64, 1, 233472, 0x0a727e8d
+0, 65, 65, 1, 233472, 0x673382f5
+0, 66, 66, 1, 233472, 0x0a127e8d
+0, 67, 67, 1, 233472, 0x66f382f5
+0, 68, 68, 1, 233472, 0x0aaa7e8d
+0, 69, 69, 1, 233472, 0x676b82f5
+0, 70, 70, 1, 233472, 0x0a8a7e8d
+0, 71, 71, 1, 233472, 0x670b82f5
+0, 72, 72, 1, 233472, 0x09fa7e8d
+0, 73, 73, 1, 233472, 0x671b82f5
+0, 74, 74, 1, 233472, 0x0ac27e8d
+0, 75, 75, 1, 233472, 0x674382f5
+0, 76, 76, 1, 233472, 0x0a727e8d
+0, 77, 77, 1, 233472, 0x673382f5
+0, 78, 78, 1, 233472, 0x0a127e8d
+0, 79, 79, 1, 233472, 0xa3917e7f
+0, 80, 80, 1, 233472, 0x0554868d
+0, 81, 81, 1, 233472, 0x05ba6d7a
+0, 82, 82, 1, 233472, 0x05ba6d7a
+0, 83, 83, 1, 233472, 0x05ba6d7a
+0, 84, 84, 1, 233472, 0x05ba6d7a
+0, 85, 85, 1, 233472, 0x05ba6d7a
+0, 86, 86, 1, 233472, 0x05ba6d7a
+0, 87, 87, 1, 233472, 0x05ba6d7a
+0, 88, 88, 1, 233472, 0x05ba6d7a
+0, 89, 89, 1, 233472, 0x05ba6d7a
+0, 90, 90, 1, 233472, 0x05ba6d7a
+0, 91, 91, 1, 233472, 0x05ba6d7a
+0, 92, 92, 1, 233472, 0x05ba6d7a
+0, 93, 93, 1, 233472, 0x05ba6d7a
+0, 94, 94, 1, 233472, 0x05ba6d7a
+0, 95, 95, 1, 233472, 0x05ba6d7a
+0, 96, 96, 1, 233472, 0x05ba6d7a
+0, 97, 97, 1, 233472, 0x05ba6d7a
+0, 98, 98, 1, 233472, 0x05ba6d7a
+0, 99, 99, 1, 233472, 0x05ba6d7a
+0, 100, 100, 1, 233472, 0x05ba6d7a
+0, 101, 101, 1, 233472, 0x05ba6d7a
+0, 102, 102, 1, 233472, 0x05ba6d7a
+0, 103, 103, 1, 233472, 0x05ba6d7a
+0, 104, 104, 1, 233472, 0x3a6a6d61
+0, 105, 105, 1, 233472, 0x0bab7adc
+0, 106, 106, 1, 233472, 0x12b44993
+0, 107, 107, 1, 233472, 0xa20ad6d1
+0, 108, 108, 1, 233472, 0xfd916a4a
+0, 109, 109, 1, 233472, 0xd34f3e95
+0, 110, 110, 1, 233472, 0x19571d5c
+0, 111, 111, 1, 233472, 0x7c8351ad
+0, 112, 112, 1, 233472, 0xea279823
+0, 113, 113, 1, 233472, 0xc5011cfd
+0, 114, 114, 1, 233472, 0xbd7fb9af
+0, 115, 115, 1, 233472, 0xdfb3bb7c
+0, 116, 116, 1, 233472, 0x6d631236
+0, 117, 117, 1, 233472, 0xdb579a7b
+0, 118, 118, 1, 233472, 0x47584a3e
+0, 119, 119, 1, 233472, 0x7a27a914
+0, 120, 120, 1, 233472, 0x2996270d
+0, 121, 121, 1, 233472, 0xefeaa7ed
+0, 122, 122, 1, 233472, 0xa3e74ae1
+0, 123, 123, 1, 233472, 0x8a51d61c
+0, 124, 124, 1, 233472, 0x25085ee7
+0, 125, 125, 1, 233472, 0x0a811253
+0, 126, 126, 1, 233472, 0x7d3eda84
+0, 127, 127, 1, 233472, 0xd0a0887d
+0, 128, 128, 1, 233472, 0xc9e6702c
+0, 129, 129, 1, 233472, 0x0da14346
+0, 130, 130, 1, 233472, 0x040f0605
+0, 131, 131, 1, 233472, 0x76ea841a
+0, 132, 132, 1, 233472, 0x105b6600
+0, 133, 133, 1, 233472, 0x73015e08
+0, 134, 134, 1, 233472, 0xe77d6662
+0, 135, 135, 1, 233472, 0x7514fcd1
+0, 136, 136, 1, 233472, 0xb091a850
+0, 137, 137, 1, 233472, 0x74ccdccd
+0, 138, 138, 1, 233472, 0xd1c002fc
+0, 139, 139, 1, 233472, 0x7bfcfdac
+0, 140, 140, 1, 233472, 0xf48a133f
+0, 141, 141, 1, 233472, 0x279c16dd
+0, 142, 142, 1, 233472, 0x58427907
+0, 143, 143, 1, 233472, 0x4668a8f2
+0, 144, 144, 1, 233472, 0x93fb555f
+0, 145, 145, 1, 233472, 0x49ed3cf2
+0, 146, 146, 1, 233472, 0xd620fac9
+0, 147, 147, 1, 233472, 0xe4efae83
+0, 148, 148, 1, 233472, 0xe4d377be
+0, 149, 149, 1, 233472, 0x6fc229c1
+0, 150, 150, 1, 233472, 0xab5a8898
+0, 151, 151, 1, 233472, 0x58a493dd
+0, 152, 152, 1, 233472, 0x5c1c1093
+0, 153, 153, 1, 233472, 0x2d831af9
+0, 154, 154, 1, 233472, 0x9a0d3cdf
+0, 155, 155, 1, 233472, 0x2be78f0b
+0, 156, 156, 1, 233472, 0xfc7cc656
+0, 157, 157, 1, 233472, 0xaa8624b7
+0, 158, 158, 1, 233472, 0xb9c9afc1
+0, 159, 159, 1, 233472, 0x709e8009
+0, 160, 160, 1, 233472, 0xd2260830
+0, 161, 161, 1, 233472, 0xadb3954e
+0, 162, 162, 1, 233472, 0x74fc3e65
+0, 163, 163, 1, 233472, 0xb4bcdea4
+0, 164, 164, 1, 233472, 0x60c46cf5
+0, 165, 165, 1, 233472, 0x0e48eff8
+0, 166, 166, 1, 233472, 0x60e46733
+0, 167, 167, 1, 233472, 0x708ec89f
+0, 168, 168, 1, 233472, 0x1f11264e
+0, 169, 169, 1, 233472, 0x6cba8300
+0, 170, 170, 1, 233472, 0xd1a5d756
+0, 171, 171, 1, 233472, 0xb936621e
+0, 172, 172, 1, 233472, 0x1667b4af
+0, 173, 173, 1, 233472, 0xc212276d
+0, 174, 174, 1, 233472, 0x9d7a871d
+0, 175, 175, 1, 233472, 0xb52834f9
+0, 176, 176, 1, 233472, 0x983bde84
+0, 177, 177, 1, 233472, 0xd1c63d88
+0, 178, 178, 1, 233472, 0xa38cb687
+0, 179, 179, 1, 233472, 0xd81bf8ff
+0, 180, 180, 1, 233472, 0x688b231a
+0, 181, 181, 1, 233472, 0xd5ad3038
+0, 182, 182, 1, 233472, 0xcd227f74
+0, 183, 183, 1, 233472, 0x81ec23d6
+0, 184, 184, 1, 233472, 0x52c1cd86
+0, 185, 185, 1, 233472, 0xa4199853
+0, 186, 186, 1, 233472, 0xe82c83e4
+0, 187, 187, 1, 233472, 0xe9810f88
+0, 188, 188, 1, 233472, 0x37e95ae7
+0, 189, 189, 1, 233472, 0xf6974d5d
+0, 190, 190, 1, 233472, 0x31788551
+0, 191, 191, 1, 233472, 0x00d6c539
+0, 192, 192, 1, 233472, 0xdbb52151
+0, 193, 193, 1, 233472, 0x594433d3
+0, 194, 194, 1, 233472, 0xeec44f91
+0, 195, 195, 1, 233472, 0x302894bf
+0, 196, 196, 1, 233472, 0x44f5ddc3
+0, 197, 197, 1, 233472, 0x6c1edd28
+0, 198, 198, 1, 233472, 0x7fd1e412
+0, 199, 199, 1, 233472, 0xd771f11b
+0, 200, 200, 1, 233472, 0x09c675d5
+0, 201, 201, 1, 233472, 0x8fd9112e
+0, 202, 202, 1, 233472, 0x602002e5
+0, 203, 203, 1, 233472, 0xb9a22029
+0, 204, 204, 1, 233472, 0x18e99807
+0, 205, 205, 1, 233472, 0x3d8657d8
+0, 206, 206, 1, 233472, 0x4cd73a85
+0, 207, 207, 1, 233472, 0x84ddb474
+0, 208, 208, 1, 233472, 0x69636bb8
+0, 209, 209, 1, 233472, 0xa0436d50
+0, 210, 210, 1, 233472, 0x93c86d78
+0, 211, 211, 1, 233472, 0x05ba6d7a
+0, 212, 212, 1, 233472, 0x05ba6d7a
+0, 213, 213, 1, 233472, 0x05ba6d7a
+0, 214, 214, 1, 233472, 0x126c6406
+0, 215, 215, 1, 233472, 0xe3885a3a
+0, 216, 216, 1, 233472, 0xf1256fe9
+0, 217, 217, 1, 233472, 0x5a84377e
+0, 218, 218, 1, 233472, 0x7c392d90
+0, 219, 219, 1, 233472, 0x8a74df48
+0, 220, 220, 1, 233472, 0xfa394653
+0, 221, 221, 1, 233472, 0xcbe0cc1b
+0, 222, 222, 1, 233472, 0xbf8639cf
+0, 223, 223, 1, 233472, 0x7dd2c935
+0, 224, 224, 1, 233472, 0x1093148f
+0, 225, 225, 1, 233472, 0x624d7d3e
+0, 226, 226, 1, 233472, 0xb340cd65
+0, 227, 227, 1, 233472, 0x6c0ae5c6
+0, 228, 228, 1, 233472, 0x0c5eaf73
+0, 229, 229, 1, 233472, 0x27be64ce
+0, 230, 230, 1, 233472, 0xac8990f4
+0, 231, 231, 1, 233472, 0x1f935102
+0, 232, 232, 1, 233472, 0x6e57d96f
+0, 233, 233, 1, 233472, 0xf246ea4d
+0, 234, 234, 1, 233472, 0x18058011
+0, 235, 235, 1, 233472, 0x5951fe6e
+0, 236, 236, 1, 233472, 0x0f10371d
+0, 237, 237, 1, 233472, 0xe1481043
+0, 238, 238, 1, 233472, 0xdedeefcc
+0, 239, 239, 1, 233472, 0xf8865db2
+0, 240, 240, 1, 233472, 0xe1b3d4d6
+0, 241, 241, 1, 233472, 0x81962c43
+0, 242, 242, 1, 233472, 0xe903d0bb
+0, 243, 243, 1, 233472, 0x6f530ac6
+0, 244, 244, 1, 233472, 0x94f7466c
+0, 245, 245, 1, 233472, 0xa8c1d365
diff --git a/gst-libs/ext/libav/tests/ref/fate/vp60 b/gst-libs/ext/libav/tests/ref/fate/vp60
new file mode 100644
index 0000000..5e4b62c
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/vp60
@@ -0,0 +1,134 @@
+#tb 0: 32767/982027
+0, 0, 0, 1, 55296, 0x6a3202a3
+0, 1, 1, 1, 55296, 0x2af202eb
+0, 2, 2, 1, 55296, 0xa1a40388
+0, 3, 3, 1, 55296, 0x61c90426
+0, 4, 4, 1, 55296, 0x17720594
+0, 5, 5, 1, 55296, 0x49440805
+0, 6, 6, 1, 55296, 0x5b2e0d32
+0, 7, 7, 1, 55296, 0x207891c1
+0, 8, 8, 1, 55296, 0x502da4cd
+0, 9, 9, 1, 55296, 0x75a22a75
+0, 10, 10, 1, 55296, 0xd55099af
+0, 11, 11, 1, 55296, 0x48778bb6
+0, 12, 12, 1, 55296, 0xe76b7df7
+0, 13, 13, 1, 55296, 0x5a049f33
+0, 14, 14, 1, 55296, 0xc83d9b90
+0, 15, 15, 1, 55296, 0x567877b8
+0, 16, 16, 1, 55296, 0x334c7f6e
+0, 17, 17, 1, 55296, 0x8717945c
+0, 18, 18, 1, 55296, 0xe432831e
+0, 19, 19, 1, 55296, 0x032e8d2d
+0, 20, 20, 1, 55296, 0x37109fd6
+0, 21, 21, 1, 55296, 0xe9b0b61b
+0, 22, 22, 1, 55296, 0x7385dae8
+0, 23, 23, 1, 55296, 0x74b8a9f5
+0, 24, 24, 1, 55296, 0xbce2e218
+0, 25, 25, 1, 55296, 0x0ab6c623
+0, 26, 26, 1, 55296, 0x2234d6d6
+0, 27, 27, 1, 55296, 0xd18be4d6
+0, 28, 28, 1, 55296, 0x5247ecc9
+0, 29, 29, 1, 55296, 0xc89f10ca
+0, 30, 30, 1, 55296, 0x16181f87
+0, 31, 31, 1, 55296, 0x893bfa85
+0, 32, 32, 1, 55296, 0x1fd9f1c0
+0, 33, 33, 1, 55296, 0xa2e8e6a9
+0, 34, 34, 1, 55296, 0x1b42dfd5
+0, 35, 35, 1, 55296, 0x0fa9f509
+0, 36, 36, 1, 55296, 0x4449c216
+0, 37, 37, 1, 55296, 0xb66baa36
+0, 38, 38, 1, 55296, 0x38c19f3b
+0, 39, 39, 1, 55296, 0xcdce83a0
+0, 40, 40, 1, 55296, 0xac4ea82b
+0, 41, 41, 1, 55296, 0xb77a6979
+0, 42, 42, 1, 55296, 0xc8834ec2
+0, 43, 43, 1, 55296, 0x181d3f0f
+0, 44, 44, 1, 55296, 0x2ae04252
+0, 45, 45, 1, 55296, 0x07633c18
+0, 46, 46, 1, 55296, 0xdc6a3340
+0, 47, 47, 1, 55296, 0xa456ebb1
+0, 48, 48, 1, 55296, 0xbf7de5e2
+0, 49, 49, 1, 55296, 0x54a1c39b
+0, 50, 50, 1, 55296, 0x08fc9423
+0, 51, 51, 1, 55296, 0x926f968a
+0, 52, 52, 1, 55296, 0x5c908481
+0, 53, 53, 1, 55296, 0x6b257f16
+0, 54, 54, 1, 55296, 0xbaf8658a
+0, 55, 55, 1, 55296, 0x61c957b1
+0, 56, 56, 1, 55296, 0xa6d181ff
+0, 57, 57, 1, 55296, 0xef476e69
+0, 58, 58, 1, 55296, 0x74f72f9a
+0, 59, 59, 1, 55296, 0x3a9328e9
+0, 60, 60, 1, 55296, 0xbe962874
+0, 61, 61, 1, 55296, 0x5f8b58cc
+0, 62, 62, 1, 55296, 0x1e066d22
+0, 63, 63, 1, 55296, 0x9ef72b34
+0, 64, 64, 1, 55296, 0x525c2bb1
+0, 65, 65, 1, 55296, 0x8e5a20a3
+0, 66, 66, 1, 55296, 0x1c6723d0
+0, 67, 67, 1, 55296, 0x2b1023c8
+0, 68, 68, 1, 55296, 0x8f682691
+0, 69, 69, 1, 55296, 0x3a0624f5
+0, 70, 70, 1, 55296, 0xbc1046fb
+0, 71, 71, 1, 55296, 0x2859470e
+0, 72, 72, 1, 55296, 0x61d45a12
+0, 73, 73, 1, 55296, 0xa68853b6
+0, 74, 74, 1, 55296, 0x36543ce4
+0, 75, 75, 1, 55296, 0x95b953d4
+0, 76, 76, 1, 55296, 0x804b3c53
+0, 77, 77, 1, 55296, 0x743960f6
+0, 78, 78, 1, 55296, 0x23916b9c
+0, 79, 79, 1, 55296, 0x8f5a59e3
+0, 80, 80, 1, 55296, 0xf1285f83
+0, 81, 81, 1, 55296, 0xde75640f
+0, 82, 82, 1, 55296, 0xde146188
+0, 83, 83, 1, 55296, 0xb5315cc9
+0, 84, 84, 1, 55296, 0xa85f6861
+0, 85, 85, 1, 55296, 0x4fda562f
+0, 86, 86, 1, 55296, 0xa0185863
+0, 87, 87, 1, 55296, 0xe4dc5a5f
+0, 88, 88, 1, 55296, 0x8a2aabb6
+0, 89, 89, 1, 55296, 0x3ba89b4f
+0, 90, 90, 1, 55296, 0x82b07c21
+0, 91, 91, 1, 55296, 0xb7998478
+0, 92, 92, 1, 55296, 0xceca8046
+0, 93, 93, 1, 55296, 0xe652b325
+0, 94, 94, 1, 55296, 0xc26bb607
+0, 95, 95, 1, 55296, 0x40c99200
+0, 96, 96, 1, 55296, 0x61bc9b27
+0, 97, 97, 1, 55296, 0x1e4baa30
+0, 98, 98, 1, 55296, 0xd8a7adb0
+0, 99, 99, 1, 55296, 0x0d0aa8fb
+0, 100, 100, 1, 55296, 0x1f1ba33c
+0, 101, 101, 1, 55296, 0xa000a80b
+0, 102, 102, 1, 55296, 0xb49dd332
+0, 103, 103, 1, 55296, 0x6b8ac499
+0, 104, 104, 1, 55296, 0x9636ed15
+0, 105, 105, 1, 55296, 0xa152f03d
+0, 106, 106, 1, 55296, 0x47a8cfc7
+0, 107, 107, 1, 55296, 0x9f94c82a
+0, 108, 108, 1, 55296, 0xe208d626
+0, 109, 109, 1, 55296, 0x28cc0616
+0, 110, 110, 1, 55296, 0xc545179e
+0, 111, 111, 1, 55296, 0xdf9205af
+0, 112, 112, 1, 55296, 0x31d6ed99
+0, 113, 113, 1, 55296, 0x866bf86e
+0, 114, 114, 1, 55296, 0x0490fbd1
+0, 115, 115, 1, 55296, 0xe1102987
+0, 116, 116, 1, 55296, 0x7f860c29
+0, 117, 117, 1, 55296, 0xc3a91f7a
+0, 118, 118, 1, 55296, 0x69641a52
+0, 119, 119, 1, 55296, 0x05b12204
+0, 120, 120, 1, 55296, 0x715b6206
+0, 121, 121, 1, 55296, 0xdcf55139
+0, 122, 122, 1, 55296, 0x1369f746
+0, 123, 123, 1, 55296, 0xc1533ef5
+0, 124, 124, 1, 55296, 0xc00ff85f
+0, 125, 125, 1, 55296, 0x4f5f70dc
+0, 126, 126, 1, 55296, 0x85720ccc
+0, 127, 127, 1, 55296, 0xfdff0780
+0, 128, 128, 1, 55296, 0x57ef04ff
+0, 129, 129, 1, 55296, 0xbf94041f
+0, 130, 130, 1, 55296, 0x4cee0392
+0, 131, 131, 1, 55296, 0x80160314
+0, 132, 132, 1, 55296, 0x396802af
diff --git a/gst-libs/ext/libav/tests/ref/fate/vp61 b/gst-libs/ext/libav/tests/ref/fate/vp61
new file mode 100644
index 0000000..be1fe53
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/vp61
@@ -0,0 +1,121 @@
+#tb 0: 32767/982027
+0, 0, 0, 1, 18816, 0xc3fe9fc7
+0, 1, 1, 1, 18816, 0x6ddf972f
+0, 2, 2, 1, 18816, 0x72808b6e
+0, 3, 3, 1, 18816, 0x8f09857f
+0, 4, 4, 1, 18816, 0xe8027c00
+0, 5, 5, 1, 18816, 0x308670cf
+0, 6, 6, 1, 18816, 0x0e656170
+0, 7, 7, 1, 18816, 0x594e54a4
+0, 8, 8, 1, 18816, 0x36944b05
+0, 9, 9, 1, 18816, 0x87013a34
+0, 10, 10, 1, 18816, 0xc0f32f0d
+0, 11, 11, 1, 18816, 0x911f1951
+0, 12, 12, 1, 18816, 0xad590d59
+0, 13, 13, 1, 18816, 0x943afff0
+0, 14, 14, 1, 18816, 0x7f5ef719
+0, 15, 15, 1, 18816, 0x889feafc
+0, 16, 16, 1, 18816, 0x4334e12b
+0, 17, 17, 1, 18816, 0xd080cc67
+0, 18, 18, 1, 18816, 0xc3c1c04c
+0, 19, 19, 1, 18816, 0x816bae4b
+0, 20, 20, 1, 18816, 0xed23a5c7
+0, 21, 21, 1, 18816, 0x86689c2f
+0, 22, 22, 1, 18816, 0x63408c52
+0, 23, 23, 1, 18816, 0x399c79d6
+0, 24, 24, 1, 18816, 0xf0ff63bf
+0, 25, 25, 1, 18816, 0xa6185353
+0, 26, 26, 1, 18816, 0xe33d46fc
+0, 27, 27, 1, 18816, 0xd58d3c6d
+0, 28, 28, 1, 18816, 0xc94a27ea
+0, 29, 29, 1, 18816, 0x62f31c59
+0, 30, 30, 1, 18816, 0x71880825
+0, 31, 31, 1, 18816, 0xa6ce01d7
+0, 32, 32, 1, 18816, 0xa1d4fc06
+0, 33, 33, 1, 18816, 0xc208f570
+0, 34, 34, 1, 18816, 0xc862e637
+0, 35, 35, 1, 18816, 0xcf9ed93a
+0, 36, 36, 1, 18816, 0x85a8cbcc
+0, 37, 37, 1, 18816, 0x650ac6c1
+0, 38, 38, 1, 18816, 0xb418c12b
+0, 39, 39, 1, 18816, 0x9fe5b412
+0, 40, 40, 1, 18816, 0x80f6a7c1
+0, 41, 41, 1, 18816, 0x283299e4
+0, 42, 42, 1, 18816, 0x15429202
+0, 43, 43, 1, 18816, 0x9f0f8c8a
+0, 44, 44, 1, 18816, 0x8e828811
+0, 45, 45, 1, 18816, 0xaac67993
+0, 46, 46, 1, 18816, 0x8f3b6f4f
+0, 47, 47, 1, 18816, 0x0b125f95
+0, 48, 48, 1, 18816, 0xb4e75d14
+0, 49, 49, 1, 18816, 0x1bac5933
+0, 50, 50, 1, 18816, 0x300b521b
+0, 51, 51, 1, 18816, 0x51174590
+0, 52, 52, 1, 18816, 0x03df3d70
+0, 53, 53, 1, 18816, 0x338a344a
+0, 54, 54, 1, 18816, 0x45ad328d
+0, 55, 55, 1, 18816, 0x2d4e321a
+0, 56, 56, 1, 18816, 0x15932563
+0, 57, 57, 1, 18816, 0x9b4f1c76
+0, 58, 58, 1, 18816, 0x8e31153c
+0, 59, 59, 1, 18816, 0xfb391185
+0, 60, 60, 1, 18816, 0x93ee0cdc
+0, 61, 61, 1, 18816, 0xddeb0642
+0, 62, 62, 1, 18816, 0xda6cf529
+0, 63, 63, 1, 18816, 0xdbd6f085
+0, 64, 64, 1, 18816, 0x357aec81
+0, 65, 65, 1, 18816, 0x36eaecca
+0, 66, 66, 1, 18816, 0x6535ee02
+0, 67, 67, 1, 18816, 0xb7dfe466
+0, 68, 68, 1, 18816, 0x58d3d86b
+0, 69, 69, 1, 18816, 0xd8aad64b
+0, 70, 70, 1, 18816, 0x37ecd588
+0, 71, 71, 1, 18816, 0xe2f9cee4
+0, 72, 72, 1, 18816, 0xcd1ac93e
+0, 73, 73, 1, 18816, 0x18e1be81
+0, 74, 74, 1, 18816, 0xa05bb9d7
+0, 75, 75, 1, 18816, 0xe0ebb663
+0, 76, 76, 1, 18816, 0x7d61b39a
+0, 77, 77, 1, 18816, 0x01b8acb5
+0, 78, 78, 1, 18816, 0x7577aa8b
+0, 79, 79, 1, 18816, 0x6bbda4b5
+0, 80, 80, 1, 18816, 0xd0cc9b29
+0, 81, 81, 1, 18816, 0xb2858cbb
+0, 82, 82, 1, 18816, 0x93608c9d
+0, 83, 83, 1, 18816, 0x80c38e03
+0, 84, 84, 1, 18816, 0x37d6843c
+0, 85, 85, 1, 18816, 0xacc47b9a
+0, 86, 86, 1, 18816, 0xc4317178
+0, 87, 87, 1, 18816, 0xc92f6ebd
+0, 88, 88, 1, 18816, 0xc1217a3b
+0, 89, 89, 1, 18816, 0x03a37ccb
+0, 90, 90, 1, 18816, 0xf38c71a2
+0, 91, 91, 1, 18816, 0x68ff697d
+0, 92, 92, 1, 18816, 0x0fe358e5
+0, 93, 93, 1, 18816, 0x58455870
+0, 94, 94, 1, 18816, 0xc9075ce7
+0, 95, 95, 1, 18816, 0x16685773
+0, 96, 96, 1, 18816, 0x1b434c0e
+0, 97, 97, 1, 18816, 0x008e4c97
+0, 98, 98, 1, 18816, 0xb4d04f4f
+0, 99, 99, 1, 18816, 0xc8c94848
+0, 100, 100, 1, 18816, 0x64664191
+0, 101, 101, 1, 18816, 0xd591367f
+0, 102, 102, 1, 18816, 0xc70d3141
+0, 103, 103, 1, 18816, 0x8d492655
+0, 104, 104, 1, 18816, 0x7e7f22c8
+0, 105, 105, 1, 18816, 0x335d23f9
+0, 106, 106, 1, 18816, 0x0a7f22b6
+0, 107, 107, 1, 18816, 0x6cf51cb2
+0, 108, 108, 1, 18816, 0x312516e1
+0, 109, 109, 1, 18816, 0x8a3c0c7a
+0, 110, 110, 1, 18816, 0x997d0d20
+0, 111, 111, 1, 18816, 0xffbd117e
+0, 112, 112, 1, 18816, 0x855808ca
+0, 113, 113, 1, 18816, 0xe335fb94
+0, 114, 114, 1, 18816, 0x12e6f95c
+0, 115, 115, 1, 18816, 0x2d62f845
+0, 116, 116, 1, 18816, 0x7e63f591
+0, 117, 117, 1, 18816, 0x7463f175
+0, 118, 118, 1, 18816, 0x1521e0d2
+0, 119, 119, 1, 18816, 0x96a8dbce
diff --git a/gst-libs/ext/libav/tests/ref/fate/vp6a b/gst-libs/ext/libav/tests/ref/fate/vp6a
index e6ea0bc..6ce8486 100644
--- a/gst-libs/ext/libav/tests/ref/fate/vp6a
+++ b/gst-libs/ext/libav/tests/ref/fate/vp6a
@@ -1,93 +1,94 @@
-0, 0, 135000, 0x9dceed6d
-0, 22500, 135000, 0xcb87787f
-0, 45000, 135000, 0xdb4361ce
-0, 67500, 135000, 0xb8fd81c2
-0, 90000, 135000, 0xbf86a7af
-0, 112500, 135000, 0x2e7787e3
-0, 135000, 135000, 0x6cec6ebd
-0, 157500, 135000, 0xa4d08c07
-0, 180000, 135000, 0x1be48faf
-0, 202500, 135000, 0xf3cd8ede
-0, 225000, 135000, 0x33ec8a49
-0, 247500, 135000, 0x11e887ec
-0, 270000, 135000, 0x3e215c25
-0, 292500, 135000, 0x1a2cb3f8
-0, 315000, 135000, 0x7fb0e48a
-0, 337500, 135000, 0x749f3738
-0, 360000, 135000, 0x686e78e9
-0, 382500, 135000, 0x29515bc7
-0, 405000, 135000, 0x987126bd
-0, 427500, 135000, 0xdf77bb13
-0, 450000, 135000, 0x5fb1468a
-0, 472500, 135000, 0x06ea50ea
-0, 495000, 135000, 0x7bd9c715
-0, 517500, 135000, 0xdd6e6831
-0, 540000, 135000, 0x0ee3760f
-0, 562500, 135000, 0xc7984dc8
-0, 585000, 135000, 0x7e385bff
-0, 607500, 135000, 0xae155ab9
-0, 630000, 135000, 0xc05ee8f7
-0, 652500, 135000, 0x93de3392
-0, 675000, 135000, 0xfe45b38b
-0, 697500, 135000, 0xeb5ed72c
-0, 720000, 135000, 0x0794cb57
-0, 742500, 135000, 0x2578c6e5
-0, 765000, 135000, 0x78486707
-0, 787500, 135000, 0x41e1f0e6
-0, 810000, 135000, 0x4508eb76
-0, 832500, 135000, 0xd8c087f3
-0, 855000, 135000, 0x1a8db89a
-0, 877500, 135000, 0x6dbd90c6
-0, 900000, 135000, 0x0845e400
-0, 922500, 135000, 0xe8b02fc2
-0, 945000, 135000, 0x8007d813
-0, 967500, 135000, 0xdfb04e69
-0, 990000, 135000, 0x5746cf71
-0, 1012500, 135000, 0xe510299f
-0, 1035000, 135000, 0xeea0c829
-0, 1057500, 135000, 0x7c0578ab
-0, 1080000, 135000, 0xb1569ce9
-0, 1102500, 135000, 0x6c233986
-0, 1125000, 135000, 0x95b77f3d
-0, 1147500, 135000, 0xfc368d80
-0, 1170000, 135000, 0x5c73b064
-0, 1192500, 135000, 0x2206da8d
-0, 1215000, 135000, 0x62bb599e
-0, 1237500, 135000, 0x15a68991
-0, 1260000, 135000, 0x5f5eb810
-0, 1282500, 135000, 0x85a9634a
-0, 1305000, 135000, 0xf24b5c1a
-0, 1327500, 135000, 0x38034850
-0, 1350000, 135000, 0x48fd3599
-0, 1372500, 135000, 0xb9d62408
-0, 1395000, 135000, 0xaf202a21
-0, 1417500, 135000, 0x341aa582
-0, 1440000, 135000, 0x90cdc9bb
-0, 1462500, 135000, 0x0b52f319
-0, 1485000, 135000, 0xce61aa5e
-0, 1507500, 135000, 0x988acb45
-0, 1530000, 135000, 0xcd353664
-0, 1552500, 135000, 0xa80c8ce9
-0, 1575000, 135000, 0x15dce784
-0, 1597500, 135000, 0x16bd4519
-0, 1620000, 135000, 0x571712f3
-0, 1642500, 135000, 0x6b109f1e
-0, 1665000, 135000, 0x8e4c19aa
-0, 1687500, 135000, 0x4132bd4c
-0, 1710000, 135000, 0x5babafe2
-0, 1732500, 135000, 0xddef6313
-0, 1755000, 135000, 0x76d6b48b
-0, 1777500, 135000, 0x929e7702
-0, 1800000, 135000, 0x33f5e4a1
-0, 1822500, 135000, 0xdb7041bf
-0, 1845000, 135000, 0xbc761e04
-0, 1867500, 135000, 0x0b2a81e6
-0, 1890000, 135000, 0xf6fd20ea
-0, 1912500, 135000, 0x1894a26c
-0, 1935000, 135000, 0xb25e216f
-0, 1957500, 135000, 0x83bb02ee
-0, 1980000, 135000, 0x6952a3c3
-0, 2002500, 135000, 0x372184d6
-0, 2025000, 135000, 0x2ac47afe
-0, 2047500, 135000, 0x14c33a35
-0, 2070000, 135000, 0xdc08470e
+#tb 0: 1/1000
+0, 0, 0, 0, 135000, 0x9dceed6d
+0, 249, 249, 0, 135000, 0xcb87787f
+0, 499, 499, 0, 135000, 0xdb4361ce
+0, 749, 749, 0, 135000, 0xb8fd81c2
+0, 1000, 1000, 0, 135000, 0xbf86a7af
+0, 1249, 1249, 0, 135000, 0x2e7787e3
+0, 1499, 1499, 0, 135000, 0x6cec6ebd
+0, 1749, 1749, 0, 135000, 0xa4d08c07
+0, 2000, 2000, 0, 135000, 0x1be48faf
+0, 2249, 2249, 0, 135000, 0xf3cd8ede
+0, 2499, 2499, 0, 135000, 0x33ec8a49
+0, 2749, 2749, 0, 135000, 0x11e887ec
+0, 3000, 3000, 0, 135000, 0x3e215c25
+0, 3249, 3249, 0, 135000, 0x1a2cb3f8
+0, 3499, 3499, 0, 135000, 0x7fb0e48a
+0, 3749, 3749, 0, 135000, 0x749f3738
+0, 4000, 4000, 0, 135000, 0x686e78e9
+0, 4249, 4249, 0, 135000, 0x29515bc7
+0, 4499, 4499, 0, 135000, 0x987126bd
+0, 4749, 4749, 0, 135000, 0xdf77bb13
+0, 5000, 5000, 0, 135000, 0x5fb1468a
+0, 5249, 5249, 0, 135000, 0x06ea50ea
+0, 5499, 5499, 0, 135000, 0x7bd9c715
+0, 5749, 5749, 0, 135000, 0xdd6e6831
+0, 6000, 6000, 0, 135000, 0x0ee3760f
+0, 6249, 6249, 0, 135000, 0xc7984dc8
+0, 6499, 6499, 0, 135000, 0x7e385bff
+0, 6749, 6749, 0, 135000, 0xae155ab9
+0, 7000, 7000, 0, 135000, 0xc05ee8f7
+0, 7249, 7249, 0, 135000, 0x93de3392
+0, 7499, 7499, 0, 135000, 0xfe45b38b
+0, 7749, 7749, 0, 135000, 0xeb5ed72c
+0, 8000, 8000, 0, 135000, 0x0794cb57
+0, 8249, 8249, 0, 135000, 0x2578c6e5
+0, 8499, 8499, 0, 135000, 0x78486707
+0, 8749, 8749, 0, 135000, 0x41e1f0e6
+0, 9000, 9000, 0, 135000, 0x4508eb76
+0, 9249, 9249, 0, 135000, 0xd8c087f3
+0, 9499, 9499, 0, 135000, 0x1a8db89a
+0, 9749, 9749, 0, 135000, 0x6dbd90c6
+0, 10000, 10000, 0, 135000, 0x0845e400
+0, 10249, 10249, 0, 135000, 0xe8b02fc2
+0, 10499, 10499, 0, 135000, 0x8007d813
+0, 10749, 10749, 0, 135000, 0xdfb04e69
+0, 11000, 11000, 0, 135000, 0x5746cf71
+0, 11249, 11249, 0, 135000, 0xe510299f
+0, 11499, 11499, 0, 135000, 0xeea0c829
+0, 11749, 11749, 0, 135000, 0x7c0578ab
+0, 12000, 12000, 0, 135000, 0xb1569ce9
+0, 12249, 12249, 0, 135000, 0x6c233986
+0, 12499, 12499, 0, 135000, 0x95b77f3d
+0, 12749, 12749, 0, 135000, 0xfc368d80
+0, 13000, 13000, 0, 135000, 0x5c73b064
+0, 13249, 13249, 0, 135000, 0x2206da8d
+0, 13499, 13499, 0, 135000, 0x62bb599e
+0, 13749, 13749, 0, 135000, 0x15a68991
+0, 14000, 14000, 0, 135000, 0x5f5eb810
+0, 14249, 14249, 0, 135000, 0x85a9634a
+0, 14499, 14499, 0, 135000, 0xf24b5c1a
+0, 14749, 14749, 0, 135000, 0x38034850
+0, 15000, 15000, 0, 135000, 0x48fd3599
+0, 15249, 15249, 0, 135000, 0xb9d62408
+0, 15499, 15499, 0, 135000, 0xaf202a21
+0, 15749, 15749, 0, 135000, 0x341aa582
+0, 16000, 16000, 0, 135000, 0x90cdc9bb
+0, 16249, 16249, 0, 135000, 0x0b52f319
+0, 16499, 16499, 0, 135000, 0xce61aa5e
+0, 16749, 16749, 0, 135000, 0x988acb45
+0, 17000, 17000, 0, 135000, 0xcd353664
+0, 17249, 17249, 0, 135000, 0xa80c8ce9
+0, 17499, 17499, 0, 135000, 0x15dce784
+0, 17749, 17749, 0, 135000, 0x16bd4519
+0, 18000, 18000, 0, 135000, 0x571712f3
+0, 18249, 18249, 0, 135000, 0x6b109f1e
+0, 18499, 18499, 0, 135000, 0x8e4c19aa
+0, 18749, 18749, 0, 135000, 0x4132bd4c
+0, 19000, 19000, 0, 135000, 0x5babafe2
+0, 19249, 19249, 0, 135000, 0xddef6313
+0, 19499, 19499, 0, 135000, 0x76d6b48b
+0, 19749, 19749, 0, 135000, 0x929e7702
+0, 20000, 20000, 0, 135000, 0x33f5e4a1
+0, 20249, 20249, 0, 135000, 0xdb7041bf
+0, 20499, 20499, 0, 135000, 0xbc761e04
+0, 20749, 20749, 0, 135000, 0x0b2a81e6
+0, 21000, 21000, 0, 135000, 0xf6fd20ea
+0, 21249, 21249, 0, 135000, 0x1894a26c
+0, 21499, 21499, 0, 135000, 0xb25e216f
+0, 21749, 21749, 0, 135000, 0x83bb02ee
+0, 22000, 22000, 0, 135000, 0x6952a3c3
+0, 22249, 22249, 0, 135000, 0x372184d6
+0, 22499, 22499, 0, 135000, 0x2ac47afe
+0, 22749, 22749, 0, 135000, 0x14c33a35
+0, 23000, 23000, 0, 135000, 0xdc08470e
diff --git a/gst-libs/ext/libav/tests/ref/fate/vp6f b/gst-libs/ext/libav/tests/ref/fate/vp6f
index b942685..8795042 100644
--- a/gst-libs/ext/libav/tests/ref/fate/vp6f
+++ b/gst-libs/ext/libav/tests/ref/fate/vp6f
@@ -1,174 +1,175 @@
-0, 0, 13440, 0x7cb0a22f
-0, 9000, 13440, 0xdfcea6ba
-0, 18000, 13440, 0x59b2a5da
-0, 27000, 13440, 0x12f1b2d8
-0, 36000, 13440, 0x280fb9f6
-0, 45000, 13440, 0x7bace8b3
-0, 54000, 13440, 0x4ec91480
-0, 63000, 13440, 0xa8010450
-0, 72000, 13440, 0x61d8fc46
-0, 81000, 13440, 0x242bb24e
-0, 90000, 13440, 0x88397a36
-0, 99000, 13440, 0x10e15726
-0, 108000, 13440, 0x3018438c
-0, 117000, 13440, 0xbbb94c21
-0, 126000, 13440, 0xfc3e5e2b
-0, 135000, 13440, 0xeaa69354
-0, 144000, 13440, 0x96f1cc01
-0, 153000, 13440, 0x333fdaff
-0, 162000, 13440, 0xb5230ed2
-0, 171000, 13440, 0x59383446
-0, 180000, 13440, 0x954939e6
-0, 189000, 13440, 0x53813d2f
-0, 198000, 13440, 0x3ca53600
-0, 207000, 13440, 0x7b30227a
-0, 216000, 13440, 0x5145bbfe
-0, 225000, 13440, 0xa0979632
-0, 234000, 13440, 0x08026e21
-0, 243000, 13440, 0x3f456d1e
-0, 252000, 13440, 0x7d036b62
-0, 261000, 13440, 0x508085fb
-0, 270000, 13440, 0x251dc193
-0, 279000, 13440, 0xf3121c9b
-0, 288000, 13440, 0xf5da772e
-0, 297000, 13440, 0x8179ccf7
-0, 306000, 13440, 0xd57ceeb3
-0, 315000, 13440, 0xc8f2169c
-0, 324000, 13440, 0xbf8296c3
-0, 333000, 13440, 0xee1927d0
-0, 342000, 13440, 0xdd84e8d1
-0, 351000, 13440, 0x7be57be2
-0, 360000, 13440, 0xae353f91
-0, 369000, 13440, 0x3ae927f2
-0, 378000, 13440, 0x417227c6
-0, 387000, 13440, 0x32572bea
-0, 396000, 13440, 0x8b9e4839
-0, 405000, 13440, 0xad669441
-0, 414000, 13440, 0xc9de99a6
-0, 423000, 13440, 0xb3ffb88b
-0, 432000, 13440, 0xb321b8a0
-0, 441000, 13440, 0x2efdbf53
-0, 450000, 13440, 0x9b7aa566
-0, 459000, 13440, 0x563c8d60
-0, 468000, 13440, 0xe3848ee8
-0, 477000, 13440, 0xa84b8f1d
-0, 486000, 13440, 0x52da9f9f
-0, 495000, 13440, 0x2ed56d97
-0, 504000, 13440, 0x4e8534c2
-0, 513000, 13440, 0x318900a6
-0, 522000, 13440, 0xda96de39
-0, 531000, 13440, 0xaae7ac0b
-0, 540000, 13440, 0x7533ad99
-0, 549000, 13440, 0x4e70c2c9
-0, 558000, 13440, 0x9ce5e3fa
-0, 567000, 13440, 0xc788fbbc
-0, 576000, 13440, 0xd36604a9
-0, 585000, 13440, 0x246221a4
-0, 594000, 13440, 0x290c5c2b
-0, 603000, 13440, 0xde6c68ec
-0, 612000, 13440, 0x56248dbf
-0, 621000, 13440, 0x5b898cbd
-0, 630000, 13440, 0x090574b9
-0, 639000, 13440, 0x8df2814a
-0, 648000, 13440, 0xd4a6b285
-0, 657000, 13440, 0xa016e921
-0, 666000, 13440, 0x7f93fdc1
-0, 675000, 13440, 0xfd0dee6f
-0, 684000, 13440, 0xef04ce0e
-0, 693000, 13440, 0x7560bee3
-0, 702000, 13440, 0x5a8cdc85
-0, 711000, 13440, 0x4788f7bc
-0, 720000, 13440, 0xc001e34d
-0, 729000, 13440, 0xc687eb74
-0, 738000, 13440, 0xbf20feba
-0, 747000, 13440, 0xd32647a8
-0, 756000, 13440, 0xe69a955a
-0, 765000, 13440, 0x1b56951f
-0, 774000, 13440, 0xd1977378
-0, 783000, 13440, 0x1620357d
-0, 792000, 13440, 0x2596116f
-0, 801000, 13440, 0x7473feca
-0, 810000, 13440, 0x7f92bb47
-0, 819000, 13440, 0x6866a683
-0, 828000, 13440, 0xe9b08d7e
-0, 837000, 13440, 0xa3fd7546
-0, 846000, 13440, 0xa4416522
-0, 855000, 13440, 0xd8f5572e
-0, 864000, 13440, 0xf5746dbd
-0, 873000, 13440, 0x256a87c6
-0, 882000, 13440, 0x722aa2c8
-0, 891000, 13440, 0xb26de5f5
-0, 900000, 13440, 0x117f0841
-0, 909000, 13440, 0xda2d192c
-0, 918000, 13440, 0xb022442d
-0, 927000, 13440, 0xbc4044f2
-0, 936000, 13440, 0x68b330da
-0, 945000, 13440, 0xc07228cf
-0, 954000, 13440, 0xaa3f3d44
-0, 963000, 13440, 0x25867aad
-0, 972000, 13440, 0xa3ecb432
-0, 981000, 13440, 0x93ccdcbb
-0, 990000, 13440, 0x8302fa4f
-0, 999000, 13440, 0x2f960f33
-0, 1008000, 13440, 0x15d41d14
-0, 1017000, 13440, 0x636529d0
-0, 1026000, 13440, 0x11035be5
-0, 1035000, 13440, 0x9b6e9167
-0, 1044000, 13440, 0x7b01adc7
-0, 1053000, 13440, 0xa237e05d
-0, 1062000, 13440, 0xd2f4f134
-0, 1071000, 13440, 0x2052d368
-0, 1080000, 13440, 0x08f7ae0d
-0, 1089000, 13440, 0xa89185bc
-0, 1098000, 13440, 0xfa628236
-0, 1107000, 13440, 0xdf79848b
-0, 1116000, 13440, 0xd19a906f
-0, 1125000, 13440, 0x219f9324
-0, 1134000, 13440, 0x46509b6d
-0, 1143000, 13440, 0xc5d9a568
-0, 1152000, 13440, 0xb21aaaa8
-0, 1161000, 13440, 0x925a97ed
-0, 1170000, 13440, 0xc5e3557f
-0, 1179000, 13440, 0x7c57155a
-0, 1188000, 13440, 0x6b26d005
-0, 1197000, 13440, 0xfdc7b369
-0, 1206000, 13440, 0x99919fc2
-0, 1215000, 13440, 0xcfe889e4
-0, 1224000, 13440, 0xd1196856
-0, 1233000, 13440, 0xec8348c6
-0, 1242000, 13440, 0x5ede0d9a
-0, 1251000, 13440, 0x198ef66e
-0, 1260000, 13440, 0x62fcefdf
-0, 1269000, 13440, 0x7791f415
-0, 1278000, 13440, 0xfbdb0029
-0, 1287000, 13440, 0xdab12b01
-0, 1296000, 13440, 0x646b2d5f
-0, 1305000, 13440, 0x5410f52e
-0, 1314000, 13440, 0x7186eef8
-0, 1323000, 13440, 0xca251ef6
-0, 1332000, 13440, 0x757c3b43
-0, 1341000, 13440, 0x59ff4982
-0, 1350000, 13440, 0xbe8ff084
-0, 1359000, 13440, 0xc85a9e38
-0, 1368000, 13440, 0x541b9a19
-0, 1377000, 13440, 0x274893c9
-0, 1386000, 13440, 0x7634b5d2
-0, 1395000, 13440, 0x1bd8e10c
-0, 1404000, 13440, 0xa661dfb1
-0, 1413000, 13440, 0x9d01bf92
-0, 1422000, 13440, 0xcb1eb220
-0, 1431000, 13440, 0x0ce27d25
-0, 1440000, 13440, 0x523b594f
-0, 1449000, 13440, 0xf0a04c4f
-0, 1458000, 13440, 0x0f0ffc3d
-0, 1467000, 13440, 0xb0d8b778
-0, 1476000, 13440, 0x5137a642
-0, 1485000, 13440, 0xd213a552
-0, 1494000, 13440, 0xc2fbc9b1
-0, 1503000, 13440, 0xfc2ee379
-0, 1512000, 13440, 0xfb80f737
-0, 1521000, 13440, 0xd6cb2447
-0, 1530000, 13440, 0x124b606d
-0, 1539000, 13440, 0xf788a066
-0, 1548000, 13440, 0xa16eed6e
-0, 1557000, 13440, 0x73ff0f82
+#tb 0: 1/1000
+0, 0, 0, 0, 13440, 0x7cb0a22f
+0, 100, 100, 0, 13440, 0xdfcea6ba
+0, 200, 200, 0, 13440, 0x59b2a5da
+0, 300, 300, 0, 13440, 0x12f1b2d8
+0, 400, 400, 0, 13440, 0x280fb9f6
+0, 500, 500, 0, 13440, 0x7bace8b3
+0, 600, 600, 0, 13440, 0x4ec91480
+0, 700, 700, 0, 13440, 0xa8010450
+0, 800, 800, 0, 13440, 0x61d8fc46
+0, 900, 900, 0, 13440, 0x242bb24e
+0, 1000, 1000, 0, 13440, 0x88397a36
+0, 1100, 1100, 0, 13440, 0x10e15726
+0, 1200, 1200, 0, 13440, 0x3018438c
+0, 1300, 1300, 0, 13440, 0xbbb94c21
+0, 1400, 1400, 0, 13440, 0xfc3e5e2b
+0, 1500, 1500, 0, 13440, 0xeaa69354
+0, 1600, 1600, 0, 13440, 0x96f1cc01
+0, 1700, 1700, 0, 13440, 0x333fdaff
+0, 1800, 1800, 0, 13440, 0xb5230ed2
+0, 1900, 1900, 0, 13440, 0x59383446
+0, 2000, 2000, 0, 13440, 0x954939e6
+0, 2100, 2100, 0, 13440, 0x53813d2f
+0, 2200, 2200, 0, 13440, 0x3ca53600
+0, 2300, 2300, 0, 13440, 0x7b30227a
+0, 2400, 2400, 0, 13440, 0x5145bbfe
+0, 2500, 2500, 0, 13440, 0xa0979632
+0, 2600, 2600, 0, 13440, 0x08026e21
+0, 2700, 2700, 0, 13440, 0x3f456d1e
+0, 2800, 2800, 0, 13440, 0x7d036b62
+0, 2900, 2900, 0, 13440, 0x508085fb
+0, 3000, 3000, 0, 13440, 0x251dc193
+0, 3100, 3100, 0, 13440, 0xf3121c9b
+0, 3200, 3200, 0, 13440, 0xf5da772e
+0, 3300, 3300, 0, 13440, 0x8179ccf7
+0, 3400, 3400, 0, 13440, 0xd57ceeb3
+0, 3500, 3500, 0, 13440, 0xc8f2169c
+0, 3600, 3600, 0, 13440, 0xbf8296c3
+0, 3700, 3700, 0, 13440, 0xee1927d0
+0, 3800, 3800, 0, 13440, 0xdd84e8d1
+0, 3900, 3900, 0, 13440, 0x7be57be2
+0, 4000, 4000, 0, 13440, 0xae353f91
+0, 4100, 4100, 0, 13440, 0x3ae927f2
+0, 4200, 4200, 0, 13440, 0x417227c6
+0, 4300, 4300, 0, 13440, 0x32572bea
+0, 4400, 4400, 0, 13440, 0x8b9e4839
+0, 4500, 4500, 0, 13440, 0xad669441
+0, 4600, 4600, 0, 13440, 0xc9de99a6
+0, 4700, 4700, 0, 13440, 0xb3ffb88b
+0, 4800, 4800, 0, 13440, 0xb321b8a0
+0, 4900, 4900, 0, 13440, 0x2efdbf53
+0, 5000, 5000, 0, 13440, 0x9b7aa566
+0, 5100, 5100, 0, 13440, 0x563c8d60
+0, 5200, 5200, 0, 13440, 0xe3848ee8
+0, 5300, 5300, 0, 13440, 0xa84b8f1d
+0, 5400, 5400, 0, 13440, 0x52da9f9f
+0, 5500, 5500, 0, 13440, 0x2ed56d97
+0, 5600, 5600, 0, 13440, 0x4e8534c2
+0, 5700, 5700, 0, 13440, 0x318900a6
+0, 5800, 5800, 0, 13440, 0xda96de39
+0, 5900, 5900, 0, 13440, 0xaae7ac0b
+0, 6000, 6000, 0, 13440, 0x7533ad99
+0, 6100, 6100, 0, 13440, 0x4e70c2c9
+0, 6200, 6200, 0, 13440, 0x9ce5e3fa
+0, 6300, 6300, 0, 13440, 0xc788fbbc
+0, 6400, 6400, 0, 13440, 0xd36604a9
+0, 6500, 6500, 0, 13440, 0x246221a4
+0, 6600, 6600, 0, 13440, 0x290c5c2b
+0, 6700, 6700, 0, 13440, 0xde6c68ec
+0, 6800, 6800, 0, 13440, 0x56248dbf
+0, 6900, 6900, 0, 13440, 0x5b898cbd
+0, 7000, 7000, 0, 13440, 0x090574b9
+0, 7100, 7100, 0, 13440, 0x8df2814a
+0, 7200, 7200, 0, 13440, 0xd4a6b285
+0, 7300, 7300, 0, 13440, 0xa016e921
+0, 7400, 7400, 0, 13440, 0x7f93fdc1
+0, 7500, 7500, 0, 13440, 0xfd0dee6f
+0, 7600, 7600, 0, 13440, 0xef04ce0e
+0, 7700, 7700, 0, 13440, 0x7560bee3
+0, 7800, 7800, 0, 13440, 0x5a8cdc85
+0, 7900, 7900, 0, 13440, 0x4788f7bc
+0, 8000, 8000, 0, 13440, 0xc001e34d
+0, 8100, 8100, 0, 13440, 0xc687eb74
+0, 8200, 8200, 0, 13440, 0xbf20feba
+0, 8300, 8300, 0, 13440, 0xd32647a8
+0, 8400, 8400, 0, 13440, 0xe69a955a
+0, 8500, 8500, 0, 13440, 0x1b56951f
+0, 8600, 8600, 0, 13440, 0xd1977378
+0, 8700, 8700, 0, 13440, 0x1620357d
+0, 8800, 8800, 0, 13440, 0x2596116f
+0, 8900, 8900, 0, 13440, 0x7473feca
+0, 9000, 9000, 0, 13440, 0x7f92bb47
+0, 9100, 9100, 0, 13440, 0x6866a683
+0, 9200, 9200, 0, 13440, 0xe9b08d7e
+0, 9300, 9300, 0, 13440, 0xa3fd7546
+0, 9400, 9400, 0, 13440, 0xa4416522
+0, 9500, 9500, 0, 13440, 0xd8f5572e
+0, 9600, 9600, 0, 13440, 0xf5746dbd
+0, 9700, 9700, 0, 13440, 0x256a87c6
+0, 9800, 9800, 0, 13440, 0x722aa2c8
+0, 9900, 9900, 0, 13440, 0xb26de5f5
+0, 10000, 10000, 0, 13440, 0x117f0841
+0, 10100, 10100, 0, 13440, 0xda2d192c
+0, 10200, 10200, 0, 13440, 0xb022442d
+0, 10300, 10300, 0, 13440, 0xbc4044f2
+0, 10400, 10400, 0, 13440, 0x68b330da
+0, 10500, 10500, 0, 13440, 0xc07228cf
+0, 10600, 10600, 0, 13440, 0xaa3f3d44
+0, 10700, 10700, 0, 13440, 0x25867aad
+0, 10800, 10800, 0, 13440, 0xa3ecb432
+0, 10900, 10900, 0, 13440, 0x93ccdcbb
+0, 11000, 11000, 0, 13440, 0x8302fa4f
+0, 11100, 11100, 0, 13440, 0x2f960f33
+0, 11200, 11200, 0, 13440, 0x15d41d14
+0, 11300, 11300, 0, 13440, 0x636529d0
+0, 11400, 11400, 0, 13440, 0x11035be5
+0, 11500, 11500, 0, 13440, 0x9b6e9167
+0, 11600, 11600, 0, 13440, 0x7b01adc7
+0, 11700, 11700, 0, 13440, 0xa237e05d
+0, 11800, 11800, 0, 13440, 0xd2f4f134
+0, 11900, 11900, 0, 13440, 0x2052d368
+0, 12000, 12000, 0, 13440, 0x08f7ae0d
+0, 12100, 12100, 0, 13440, 0xa89185bc
+0, 12200, 12200, 0, 13440, 0xfa628236
+0, 12300, 12300, 0, 13440, 0xdf79848b
+0, 12400, 12400, 0, 13440, 0xd19a906f
+0, 12500, 12500, 0, 13440, 0x219f9324
+0, 12600, 12600, 0, 13440, 0x46509b6d
+0, 12700, 12700, 0, 13440, 0xc5d9a568
+0, 12800, 12800, 0, 13440, 0xb21aaaa8
+0, 12900, 12900, 0, 13440, 0x925a97ed
+0, 13000, 13000, 0, 13440, 0xc5e3557f
+0, 13100, 13100, 0, 13440, 0x7c57155a
+0, 13200, 13200, 0, 13440, 0x6b26d005
+0, 13300, 13300, 0, 13440, 0xfdc7b369
+0, 13400, 13400, 0, 13440, 0x99919fc2
+0, 13500, 13500, 0, 13440, 0xcfe889e4
+0, 13600, 13600, 0, 13440, 0xd1196856
+0, 13700, 13700, 0, 13440, 0xec8348c6
+0, 13800, 13800, 0, 13440, 0x5ede0d9a
+0, 13900, 13900, 0, 13440, 0x198ef66e
+0, 14000, 14000, 0, 13440, 0x62fcefdf
+0, 14100, 14100, 0, 13440, 0x7791f415
+0, 14200, 14200, 0, 13440, 0xfbdb0029
+0, 14300, 14300, 0, 13440, 0xdab12b01
+0, 14400, 14400, 0, 13440, 0x646b2d5f
+0, 14500, 14500, 0, 13440, 0x5410f52e
+0, 14600, 14600, 0, 13440, 0x7186eef8
+0, 14700, 14700, 0, 13440, 0xca251ef6
+0, 14800, 14800, 0, 13440, 0x757c3b43
+0, 14900, 14900, 0, 13440, 0x59ff4982
+0, 15000, 15000, 0, 13440, 0xbe8ff084
+0, 15100, 15100, 0, 13440, 0xc85a9e38
+0, 15200, 15200, 0, 13440, 0x541b9a19
+0, 15300, 15300, 0, 13440, 0x274893c9
+0, 15400, 15400, 0, 13440, 0x7634b5d2
+0, 15500, 15500, 0, 13440, 0x1bd8e10c
+0, 15600, 15600, 0, 13440, 0xa661dfb1
+0, 15700, 15700, 0, 13440, 0x9d01bf92
+0, 15800, 15800, 0, 13440, 0xcb1eb220
+0, 15900, 15900, 0, 13440, 0x0ce27d25
+0, 16000, 16000, 0, 13440, 0x523b594f
+0, 16100, 16100, 0, 13440, 0xf0a04c4f
+0, 16200, 16200, 0, 13440, 0x0f0ffc3d
+0, 16300, 16300, 0, 13440, 0xb0d8b778
+0, 16400, 16400, 0, 13440, 0x5137a642
+0, 16500, 16500, 0, 13440, 0xd213a552
+0, 16600, 16600, 0, 13440, 0xc2fbc9b1
+0, 16700, 16700, 0, 13440, 0xfc2ee379
+0, 16800, 16800, 0, 13440, 0xfb80f737
+0, 16900, 16900, 0, 13440, 0xd6cb2447
+0, 17000, 17000, 0, 13440, 0x124b606d
+0, 17100, 17100, 0, 13440, 0xf788a066
+0, 17200, 17200, 0, 13440, 0xa16eed6e
+0, 17300, 17300, 0, 13440, 0x73ff0f82
diff --git a/gst-libs/ext/libav/tests/ref/fate/vp8-sign-bias b/gst-libs/ext/libav/tests/ref/fate/vp8-sign-bias
index 4e4f6c4..77b69ed 100644
--- a/gst-libs/ext/libav/tests/ref/fate/vp8-sign-bias
+++ b/gst-libs/ext/libav/tests/ref/fate/vp8-sign-bias
@@ -1,9 +1,9 @@
-0, 0, 614880, 12ce23b288485be3ddbc1db28c21517f
-0, 3750, 614880, ce352e1079535ea058c0e9ad50f7cdb8
-0, 7500, 614880, 9f6bf2739a027dfd12c81586cf75d3a3
-0, 11250, 614880, 7593a85ab7790eb39d65fc53f769ed8b
-0, 15000, 614880, 52f47f1e0348f3297d9f233fb5405e8b
-0, 18750, 614880, cd51d2c200bfd66e8e1b0fd6b404570f
-0, 22500, 614880, cf535cf0a53e903cd98a9a944b72da6d
-0, 26250, 614880, 1b270fd2b56daa7892102c2885d23201
-0, 30000, 614880, ff373c0c8a4a319c84e72b1c3d76b399
+#tb 0: 1/24
+0, 0, 0, 1, 614880, 12ce23b288485be3ddbc1db28c21517f
+0, 2, 2, 1, 614880, ce352e1079535ea058c0e9ad50f7cdb8
+0, 3, 3, 1, 614880, 9f6bf2739a027dfd12c81586cf75d3a3
+0, 4, 4, 1, 614880, 7593a85ab7790eb39d65fc53f769ed8b
+0, 5, 5, 1, 614880, 52f47f1e0348f3297d9f233fb5405e8b
+0, 6, 6, 1, 614880, cd51d2c200bfd66e8e1b0fd6b404570f
+0, 7, 7, 1, 614880, cf535cf0a53e903cd98a9a944b72da6d
+0, 8, 8, 1, 614880, ff373c0c8a4a319c84e72b1c3d76b399
diff --git a/gst-libs/ext/libav/tests/ref/fate/vp8-size-change b/gst-libs/ext/libav/tests/ref/fate/vp8-size-change
new file mode 100644
index 0000000..d87c563
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/vp8-size-change
@@ -0,0 +1,31 @@
+#tb 0: 1/1000
+0, 0, 0, 0, 3110400, 649f0f2e3e09e6938161bb07bede5282
+0, 33, 33, 0, 3110400, f24f632d50eafef73fa89391ca98c375
+0, 67, 67, 0, 3110400, 57b6d2ed51bfaf6588f39eb73e7922b8
+0, 100, 100, 0, 3110400, 463e0988ce28eb1c30669c06113deb4c
+0, 133, 133, 0, 3110400, 3c4ac119f998a0ccd7d3a6361f4d10a0
+0, 167, 167, 0, 3110400, 0f11c5cc9c1ac9055e21e417e1259c69
+0, 200, 200, 0, 3110400, 08c6e70f101c61013f2969b6a370d3f9
+0, 233, 233, 0, 3110400, ea8cb37017d8a9d20bf443b730fd8365
+0, 267, 267, 0, 3110400, 3f614203f054c89151680f4b1b0c6c4c
+0, 300, 300, 0, 3110400, 90488ee40d06c0f05eee8348dde57325
+0, 333, 333, 0, 3110400, f48117b74ac7455e69fd14e9b68ce95d
+0, 367, 367, 0, 3110400, 37ee06b6267b5ec25fd642525cf4469a
+0, 400, 400, 0, 3110400, cd5e0988e7c084f29bda4a18cb38c1e8
+0, 433, 433, 0, 3110400, 1fe943b01f00b8bc0cb5722010cef03c
+0, 467, 467, 0, 3110400, 40d8e8150326c7eb061d3f6cfd307d97
+0, 500, 500, 0, 3110400, 49812cbf928858cb56331c8c8aaaf556
+0, 533, 533, 0, 3110400, 3df607c752273ebcac21123e2c4c010c
+0, 567, 567, 0, 3110400, 020a0ae162c8326f83f8f4d8bf1627d2
+0, 600, 600, 0, 3110400, 459ac9f9488a6a2f4e378703a6b2a45a
+0, 633, 633, 0, 3110400, b1baf9a56f7667e4b8f4e3007b9ebe0f
+0, 667, 667, 0, 3110400, eea61a72a05c380450a96b575ba25f65
+0, 700, 700, 0, 3110400, e013a9f233824631d8c6e3f93106eebe
+0, 733, 733, 0, 3110400, 6c64147ebdee4b36728c6978b290ffb5
+0, 767, 767, 0, 3110400, c37956235667345d92fdfc7c62496e84
+0, 800, 800, 0, 3110400, 0ac58c28575b804d9e63395653c3aef2
+0, 833, 833, 0, 3110400, 641f2a78e338c733ef159bd36ec7966f
+0, 867, 867, 0, 3110400, 9402d455fa5bd556b85f479c42c3a4d2
+0, 900, 900, 0, 3110400, ca86e16b05db0c79b028d709c19e1f13
+0, 933, 933, 0, 3110400, 9167d622809df07eef9bcb3cb09de0f0
+0, 967, 967, 0, 3110400, e1d52ae2a2eb6aabb9bdc7e7ed05253e
diff --git a/gst-libs/ext/libav/tests/ref/fate/vp8-test-vector-001 b/gst-libs/ext/libav/tests/ref/fate/vp8-test-vector-001
index df13892..64accc4 100644
--- a/gst-libs/ext/libav/tests/ref/fate/vp8-test-vector-001
+++ b/gst-libs/ext/libav/tests/ref/fate/vp8-test-vector-001
@@ -1,29 +1,30 @@
-0, 0, 38016, 83c78b5db579710f61f9354d5c51e8c8
-0, 3000, 38016, 8d089d226f52d6cdaffdb3fcc080b75b
-0, 6000, 38016, acaae81ca812145e85e0be83bdf54226
-0, 9000, 38016, e94651d798b6bf5f09a9bba10cacaf7a
-0, 12000, 38016, 60c2607913e528d501962bf407341731
-0, 15000, 38016, e683f2bf28b31e36db88087bd03b6917
-0, 18000, 38016, 0c2923785051bc9b90c2447a85527764
-0, 21000, 38016, 1bc97b6b2e4ca36b149c3768495747ac
-0, 24000, 38016, 0586d948ed3fd479c6dd08055973bcb4
-0, 27000, 38016, c9a1198e1680487c77a2d1631695aeec
-0, 30000, 38016, 547d8ffce9c085231c74717a9b815625
-0, 33000, 38016, d31c02a5591eb7bd8e73703252e1a1ab
-0, 36000, 38016, 23bafc8e22b2ed7e8c5e52369095cd30
-0, 39000, 38016, 9725d52d7810a19b20dcc9bb0fa36abd
-0, 42000, 38016, 7aefaabdcd2595939fd05078d01b484b
-0, 45000, 38016, 828e758d6f0b29b2693b2dc6b09249a6
-0, 48000, 38016, 53f09380dde1420ba270b74d8819537c
-0, 51000, 38016, 09791a7db3bc28258350cfdc95d8f224
-0, 54000, 38016, 2050271dc4ba3f3e427cf8088c96e28d
-0, 57000, 38016, 4e69d3f7cea45844b740368fcd4dd815
-0, 60000, 38016, 4ed07697e239b7f12ee6a97ad09c08fb
-0, 63000, 38016, 1437c129bfbda63ca1d39a94ee91b097
-0, 66000, 38016, 4fc951bf45e164b711591155a59c73fa
-0, 69000, 38016, 97d1007e27b4b9072751e87e8d1f1415
-0, 72000, 38016, 18c809835dcc3d30c93ae1be569dcd24
-0, 75000, 38016, de0fd0035a542791c4dda5735657efc5
-0, 78000, 38016, 27a70ff95d0cfa10f54652c9fb8a9db2
-0, 81000, 38016, 2285b9324ec91099626191f769962e44
-0, 84000, 38016, 56794d911b02190212bca92f88ad60c6
+#tb 0: 1/30
+0, 0, 0, 1, 38016, 83c78b5db579710f61f9354d5c51e8c8
+0, 1, 1, 1, 38016, 8d089d226f52d6cdaffdb3fcc080b75b
+0, 2, 2, 1, 38016, acaae81ca812145e85e0be83bdf54226
+0, 3, 3, 1, 38016, e94651d798b6bf5f09a9bba10cacaf7a
+0, 4, 4, 1, 38016, 60c2607913e528d501962bf407341731
+0, 5, 5, 1, 38016, e683f2bf28b31e36db88087bd03b6917
+0, 6, 6, 1, 38016, 0c2923785051bc9b90c2447a85527764
+0, 7, 7, 1, 38016, 1bc97b6b2e4ca36b149c3768495747ac
+0, 8, 8, 1, 38016, 0586d948ed3fd479c6dd08055973bcb4
+0, 9, 9, 1, 38016, c9a1198e1680487c77a2d1631695aeec
+0, 10, 10, 1, 38016, 547d8ffce9c085231c74717a9b815625
+0, 11, 11, 1, 38016, d31c02a5591eb7bd8e73703252e1a1ab
+0, 12, 12, 1, 38016, 23bafc8e22b2ed7e8c5e52369095cd30
+0, 13, 13, 1, 38016, 9725d52d7810a19b20dcc9bb0fa36abd
+0, 14, 14, 1, 38016, 7aefaabdcd2595939fd05078d01b484b
+0, 15, 15, 1, 38016, 828e758d6f0b29b2693b2dc6b09249a6
+0, 16, 16, 1, 38016, 53f09380dde1420ba270b74d8819537c
+0, 17, 17, 1, 38016, 09791a7db3bc28258350cfdc95d8f224
+0, 18, 18, 1, 38016, 2050271dc4ba3f3e427cf8088c96e28d
+0, 19, 19, 1, 38016, 4e69d3f7cea45844b740368fcd4dd815
+0, 20, 20, 1, 38016, 4ed07697e239b7f12ee6a97ad09c08fb
+0, 21, 21, 1, 38016, 1437c129bfbda63ca1d39a94ee91b097
+0, 22, 22, 1, 38016, 4fc951bf45e164b711591155a59c73fa
+0, 23, 23, 1, 38016, 97d1007e27b4b9072751e87e8d1f1415
+0, 24, 24, 1, 38016, 18c809835dcc3d30c93ae1be569dcd24
+0, 25, 25, 1, 38016, de0fd0035a542791c4dda5735657efc5
+0, 26, 26, 1, 38016, 27a70ff95d0cfa10f54652c9fb8a9db2
+0, 27, 27, 1, 38016, 2285b9324ec91099626191f769962e44
+0, 28, 28, 1, 38016, 56794d911b02190212bca92f88ad60c6
diff --git a/gst-libs/ext/libav/tests/ref/fate/vp8-test-vector-002 b/gst-libs/ext/libav/tests/ref/fate/vp8-test-vector-002
index 0ec5af8..d42674a 100644
--- a/gst-libs/ext/libav/tests/ref/fate/vp8-test-vector-002
+++ b/gst-libs/ext/libav/tests/ref/fate/vp8-test-vector-002
@@ -1,49 +1,50 @@
-0, 0, 38016, 872e9922f37f0e92c767d33e0a15b8e0
-0, 3750, 38016, ea5ad6c6ee4355018fc0ba83b5172836
-0, 7500, 38016, fe744612b2167c9ba6e1dc81c031e16a
-0, 11250, 38016, 744359695caee3f32307a2d7eef09e85
-0, 15000, 38016, 07211ac8d8bae4d931ade402ff6e3c12
-0, 18750, 38016, 2ce02854f228b1378d9dc34cab8d343b
-0, 22500, 38016, af5222ad42c4f22f22fbf19c26c02dcb
-0, 26250, 38016, 88538d39f2647df8fedf15bd1b767bbf
-0, 30000, 38016, d0d936471dd4e9922eb067c0f09eacab
-0, 33750, 38016, 03cb1f5c5026e96f6e686aa1fa9b1028
-0, 37500, 38016, 2ebe35e23d2244c5b0f777fbc01f8f37
-0, 41250, 38016, f9314f5ea91ebbaaed6e37ca0701ed67
-0, 45000, 38016, 37dca7530d09fd1e8bad154b9e312ea2
-0, 48750, 38016, 9841dc8ff6424abe362c4dfe03b5fbd0
-0, 52500, 38016, 72bd0b70c576dfb544f622c488217491
-0, 56250, 38016, 309b21c126153f20f312e38a8dad44e1
-0, 60000, 38016, 0acbb170ede66ebdae4e9d8e56908f75
-0, 63750, 38016, 318c9c3e531d00734b5f78433da176c9
-0, 67500, 38016, 0388dfdb2a792148b44bdb705cc2df99
-0, 71250, 38016, f440adff2b44888becbf3ca16e425441
-0, 75000, 38016, ac41431627d8d1712d40412ab8c3200c
-0, 78750, 38016, 417e1abbfe2a078663dae688ae4a9bb1
-0, 82500, 38016, 73d493bdf4a29d5cfeec610109f582a8
-0, 86250, 38016, 3c026a536ef36467d4a9db6bcc20cec1
-0, 90000, 38016, 57836430f2f10862b84541d99cca062c
-0, 93750, 38016, 04ad6fa97e1ff49931b574bdaaddd5db
-0, 97500, 38016, e94f2ec4cbf2b9067a4a4307eadebb6f
-0, 101250, 38016, e3542cdee672d97c65ab06dbe611247d
-0, 105000, 38016, 6c83c6c76aa8bf73646eb7a714cb42bf
-0, 108750, 38016, b5f64c6fc6d0c777a0a0b9097862f171
-0, 112500, 38016, 293dccaf5027759679bb9e8696b6381a
-0, 116250, 38016, 1a3d015ff9b164cb7922aef0aeac520e
-0, 120000, 38016, 93f9152d9425f0ec43160a0c01c485b2
-0, 123750, 38016, c7c4a8f78f781f70cedc44edc1d06911
-0, 127500, 38016, 21330442d5bef415fd765759d867c98b
-0, 131250, 38016, 6164258040f85206a3833aeb4f27a34f
-0, 135000, 38016, 3213e1405dfe6588a7334a8bc2b1e47f
-0, 138750, 38016, a619fa73f0081a349dfa2b000de19045
-0, 142500, 38016, 1f3cec4bb793dc4a118ddcf500090f37
-0, 146250, 38016, 12308ec77632ca10f1451aec8e62b82f
-0, 150000, 38016, 018c7f50ed4a494a9fcd32fdfed6705f
-0, 153750, 38016, a7282728fbd7e0b49a6967b0ea4e1f61
-0, 157500, 38016, 6aa15ab83e82f246ee9c7b7a040bfaac
-0, 161250, 38016, e4c17d2603e03753d54a142491cf5dc0
-0, 165000, 38016, 0a7331aa707e42e732f04e9175438195
-0, 168750, 38016, b522cfa3f3c706d1901231bb9e6b4b8a
-0, 172500, 38016, 7b2a70e47d9af98cfa6216ed2a7d528c
-0, 176250, 38016, b56e22bc9beacff9c3207b2757fc7f94
-0, 180000, 38016, a3dfc9461c0480cf56ee465ddabf0de1
+#tb 0: 1/24
+0, 0, 0, 1, 38016, 872e9922f37f0e92c767d33e0a15b8e0
+0, 1, 1, 1, 38016, ea5ad6c6ee4355018fc0ba83b5172836
+0, 2, 2, 1, 38016, fe744612b2167c9ba6e1dc81c031e16a
+0, 3, 3, 1, 38016, 744359695caee3f32307a2d7eef09e85
+0, 4, 4, 1, 38016, 07211ac8d8bae4d931ade402ff6e3c12
+0, 5, 5, 1, 38016, 2ce02854f228b1378d9dc34cab8d343b
+0, 6, 6, 1, 38016, af5222ad42c4f22f22fbf19c26c02dcb
+0, 7, 7, 1, 38016, 88538d39f2647df8fedf15bd1b767bbf
+0, 8, 8, 1, 38016, d0d936471dd4e9922eb067c0f09eacab
+0, 9, 9, 1, 38016, 03cb1f5c5026e96f6e686aa1fa9b1028
+0, 10, 10, 1, 38016, 2ebe35e23d2244c5b0f777fbc01f8f37
+0, 11, 11, 1, 38016, f9314f5ea91ebbaaed6e37ca0701ed67
+0, 12, 12, 1, 38016, 37dca7530d09fd1e8bad154b9e312ea2
+0, 13, 13, 1, 38016, 9841dc8ff6424abe362c4dfe03b5fbd0
+0, 14, 14, 1, 38016, 72bd0b70c576dfb544f622c488217491
+0, 15, 15, 1, 38016, 309b21c126153f20f312e38a8dad44e1
+0, 16, 16, 1, 38016, 0acbb170ede66ebdae4e9d8e56908f75
+0, 17, 17, 1, 38016, 318c9c3e531d00734b5f78433da176c9
+0, 18, 18, 1, 38016, 0388dfdb2a792148b44bdb705cc2df99
+0, 19, 19, 1, 38016, f440adff2b44888becbf3ca16e425441
+0, 20, 20, 1, 38016, ac41431627d8d1712d40412ab8c3200c
+0, 21, 21, 1, 38016, 417e1abbfe2a078663dae688ae4a9bb1
+0, 22, 22, 1, 38016, 73d493bdf4a29d5cfeec610109f582a8
+0, 23, 23, 1, 38016, 3c026a536ef36467d4a9db6bcc20cec1
+0, 24, 24, 1, 38016, 57836430f2f10862b84541d99cca062c
+0, 25, 25, 1, 38016, 04ad6fa97e1ff49931b574bdaaddd5db
+0, 26, 26, 1, 38016, e94f2ec4cbf2b9067a4a4307eadebb6f
+0, 27, 27, 1, 38016, e3542cdee672d97c65ab06dbe611247d
+0, 28, 28, 1, 38016, 6c83c6c76aa8bf73646eb7a714cb42bf
+0, 29, 29, 1, 38016, b5f64c6fc6d0c777a0a0b9097862f171
+0, 30, 30, 1, 38016, 293dccaf5027759679bb9e8696b6381a
+0, 31, 31, 1, 38016, 1a3d015ff9b164cb7922aef0aeac520e
+0, 32, 32, 1, 38016, 93f9152d9425f0ec43160a0c01c485b2
+0, 33, 33, 1, 38016, c7c4a8f78f781f70cedc44edc1d06911
+0, 34, 34, 1, 38016, 21330442d5bef415fd765759d867c98b
+0, 35, 35, 1, 38016, 6164258040f85206a3833aeb4f27a34f
+0, 36, 36, 1, 38016, 3213e1405dfe6588a7334a8bc2b1e47f
+0, 37, 37, 1, 38016, a619fa73f0081a349dfa2b000de19045
+0, 38, 38, 1, 38016, 1f3cec4bb793dc4a118ddcf500090f37
+0, 39, 39, 1, 38016, 12308ec77632ca10f1451aec8e62b82f
+0, 40, 40, 1, 38016, 018c7f50ed4a494a9fcd32fdfed6705f
+0, 41, 41, 1, 38016, a7282728fbd7e0b49a6967b0ea4e1f61
+0, 42, 42, 1, 38016, 6aa15ab83e82f246ee9c7b7a040bfaac
+0, 43, 43, 1, 38016, e4c17d2603e03753d54a142491cf5dc0
+0, 44, 44, 1, 38016, 0a7331aa707e42e732f04e9175438195
+0, 45, 45, 1, 38016, b522cfa3f3c706d1901231bb9e6b4b8a
+0, 46, 46, 1, 38016, 7b2a70e47d9af98cfa6216ed2a7d528c
+0, 47, 47, 1, 38016, b56e22bc9beacff9c3207b2757fc7f94
+0, 48, 48, 1, 38016, a3dfc9461c0480cf56ee465ddabf0de1
diff --git a/gst-libs/ext/libav/tests/ref/fate/vp8-test-vector-003 b/gst-libs/ext/libav/tests/ref/fate/vp8-test-vector-003
index 9ff4200..504766f 100644
--- a/gst-libs/ext/libav/tests/ref/fate/vp8-test-vector-003
+++ b/gst-libs/ext/libav/tests/ref/fate/vp8-test-vector-003
@@ -1,49 +1,50 @@
-0, 0, 38016, 96e6ce168b5ef377053e86ab5484e7f9
-0, 3750, 38016, 10fd750292d8522ab7ee577043604789
-0, 7500, 38016, e040995173dc5c85abbbe38f6823ff9a
-0, 11250, 38016, 5aa18f4fbd8b5b887d74f84cc92075dc
-0, 15000, 38016, f0dc7f520e88b94e5cb924d804b0472a
-0, 18750, 38016, 2375955dce3bb0a824779a800cd1555b
-0, 22500, 38016, 3e96a0e477de39530e1950cff284a854
-0, 26250, 38016, 6cd40fa8a89221f2b990bd8af2a9ee14
-0, 30000, 38016, 0b929243ceeffce836279e2aa84647cd
-0, 33750, 38016, 1e95f0ad25fe033076b57c3852bb3550
-0, 37500, 38016, 81aa93a3f9c56d2aa4b8285d3507e6b4
-0, 41250, 38016, cf9947a302dec306d7f487cf3a2731b0
-0, 45000, 38016, 3b9ca47752db95a049678da07974b476
-0, 48750, 38016, aa6788405dc47dd44867fca6c95ba3d9
-0, 52500, 38016, 276d1c62b908c081c7bbb78f943b0de1
-0, 56250, 38016, eb006b6218e457fd794e9b3a5dfbf638
-0, 60000, 38016, 9dd5312833e770286c5aa5436a00376e
-0, 63750, 38016, 7899278e66aa255ce5bf69a6e1137d0f
-0, 67500, 38016, 0ac7d062ea7550fa0717723b1272abc2
-0, 71250, 38016, d8f1bb881a46ecafcbbe457a004a71f1
-0, 75000, 38016, cc3a04b98159189a74b5241df540d8fb
-0, 78750, 38016, 4e29eb2c8c465ae9ffcfa28ec0b3694b
-0, 82500, 38016, 608fb6ba526e6aa4ad1c0290aedaa69d
-0, 86250, 38016, 4acc6a73547be6310b9a275436c55805
-0, 90000, 38016, 482cf409b86242d30f3a78a6c85364df
-0, 93750, 38016, a22cb76770f112eb1169218cc87c1e4f
-0, 97500, 38016, e74675b051ff05e178a9a24893721d99
-0, 101250, 38016, ee5061bff62c8c8603b7bc2bb2bb29e8
-0, 105000, 38016, a3c0ab11f338bd488c69f2b62e1e5a74
-0, 108750, 38016, 9f6b7e30e0ed4e272393b9a9957752e1
-0, 112500, 38016, 9cce9f2ffff1766d05bda04e46eff997
-0, 116250, 38016, 5105a2ba923bc6f21ea3d32ab1bc7bf8
-0, 120000, 38016, 957d619a1001e2b5e52db166b66b7f50
-0, 123750, 38016, fdb4e71cddeec8a321d9c8d4ffc506ce
-0, 127500, 38016, 9ee646940fb8ac2312d29e9f1c3b6d40
-0, 131250, 38016, a110e81d2105beae81cd36b15bc5ac2f
-0, 135000, 38016, 804b6d8fc99fadb9c6bfdae3becee6b5
-0, 138750, 38016, e217627bbaeebf30456e38aeb1f0746b
-0, 142500, 38016, 56468a2c548dd3085b4bce88c4a1e41d
-0, 146250, 38016, ef170e7f21e2b262525b43d6b25dec4c
-0, 150000, 38016, 3acc3c47def8a0fa0561eaacaf9e41a1
-0, 153750, 38016, 0c3e2187f13e4504fb4b246706bba83c
-0, 157500, 38016, 397326a22e6e49487309c39d64037df8
-0, 161250, 38016, 95236c1319b6f1f692b3998547811ee7
-0, 165000, 38016, 5aff1957504884abf74d6fb74b74b032
-0, 168750, 38016, 6de06343435a8926a746037cab5f633c
-0, 172500, 38016, 3de68e05ddf2c60ee9110048ceefeb6a
-0, 176250, 38016, e637fef689edad6ffd6eeb4a29004bf7
-0, 180000, 38016, bb809114af8df5cb4ed82d3a1d11a673
+#tb 0: 1/24
+0, 0, 0, 1, 38016, 96e6ce168b5ef377053e86ab5484e7f9
+0, 1, 1, 1, 38016, 10fd750292d8522ab7ee577043604789
+0, 2, 2, 1, 38016, e040995173dc5c85abbbe38f6823ff9a
+0, 3, 3, 1, 38016, 5aa18f4fbd8b5b887d74f84cc92075dc
+0, 4, 4, 1, 38016, f0dc7f520e88b94e5cb924d804b0472a
+0, 5, 5, 1, 38016, 2375955dce3bb0a824779a800cd1555b
+0, 6, 6, 1, 38016, 3e96a0e477de39530e1950cff284a854
+0, 7, 7, 1, 38016, 6cd40fa8a89221f2b990bd8af2a9ee14
+0, 8, 8, 1, 38016, 0b929243ceeffce836279e2aa84647cd
+0, 9, 9, 1, 38016, 1e95f0ad25fe033076b57c3852bb3550
+0, 10, 10, 1, 38016, 81aa93a3f9c56d2aa4b8285d3507e6b4
+0, 11, 11, 1, 38016, cf9947a302dec306d7f487cf3a2731b0
+0, 12, 12, 1, 38016, 3b9ca47752db95a049678da07974b476
+0, 13, 13, 1, 38016, aa6788405dc47dd44867fca6c95ba3d9
+0, 14, 14, 1, 38016, 276d1c62b908c081c7bbb78f943b0de1
+0, 15, 15, 1, 38016, eb006b6218e457fd794e9b3a5dfbf638
+0, 16, 16, 1, 38016, 9dd5312833e770286c5aa5436a00376e
+0, 17, 17, 1, 38016, 7899278e66aa255ce5bf69a6e1137d0f
+0, 18, 18, 1, 38016, 0ac7d062ea7550fa0717723b1272abc2
+0, 19, 19, 1, 38016, d8f1bb881a46ecafcbbe457a004a71f1
+0, 20, 20, 1, 38016, cc3a04b98159189a74b5241df540d8fb
+0, 21, 21, 1, 38016, 4e29eb2c8c465ae9ffcfa28ec0b3694b
+0, 22, 22, 1, 38016, 608fb6ba526e6aa4ad1c0290aedaa69d
+0, 23, 23, 1, 38016, 4acc6a73547be6310b9a275436c55805
+0, 24, 24, 1, 38016, 482cf409b86242d30f3a78a6c85364df
+0, 25, 25, 1, 38016, a22cb76770f112eb1169218cc87c1e4f
+0, 26, 26, 1, 38016, e74675b051ff05e178a9a24893721d99
+0, 27, 27, 1, 38016, ee5061bff62c8c8603b7bc2bb2bb29e8
+0, 28, 28, 1, 38016, a3c0ab11f338bd488c69f2b62e1e5a74
+0, 29, 29, 1, 38016, 9f6b7e30e0ed4e272393b9a9957752e1
+0, 30, 30, 1, 38016, 9cce9f2ffff1766d05bda04e46eff997
+0, 31, 31, 1, 38016, 5105a2ba923bc6f21ea3d32ab1bc7bf8
+0, 32, 32, 1, 38016, 957d619a1001e2b5e52db166b66b7f50
+0, 33, 33, 1, 38016, fdb4e71cddeec8a321d9c8d4ffc506ce
+0, 34, 34, 1, 38016, 9ee646940fb8ac2312d29e9f1c3b6d40
+0, 35, 35, 1, 38016, a110e81d2105beae81cd36b15bc5ac2f
+0, 36, 36, 1, 38016, 804b6d8fc99fadb9c6bfdae3becee6b5
+0, 37, 37, 1, 38016, e217627bbaeebf30456e38aeb1f0746b
+0, 38, 38, 1, 38016, 56468a2c548dd3085b4bce88c4a1e41d
+0, 39, 39, 1, 38016, ef170e7f21e2b262525b43d6b25dec4c
+0, 40, 40, 1, 38016, 3acc3c47def8a0fa0561eaacaf9e41a1
+0, 41, 41, 1, 38016, 0c3e2187f13e4504fb4b246706bba83c
+0, 42, 42, 1, 38016, 397326a22e6e49487309c39d64037df8
+0, 43, 43, 1, 38016, 95236c1319b6f1f692b3998547811ee7
+0, 44, 44, 1, 38016, 5aff1957504884abf74d6fb74b74b032
+0, 45, 45, 1, 38016, 6de06343435a8926a746037cab5f633c
+0, 46, 46, 1, 38016, 3de68e05ddf2c60ee9110048ceefeb6a
+0, 47, 47, 1, 38016, e637fef689edad6ffd6eeb4a29004bf7
+0, 48, 48, 1, 38016, bb809114af8df5cb4ed82d3a1d11a673
diff --git a/gst-libs/ext/libav/tests/ref/fate/vp8-test-vector-004 b/gst-libs/ext/libav/tests/ref/fate/vp8-test-vector-004
index 56e05b2..f402372 100644
--- a/gst-libs/ext/libav/tests/ref/fate/vp8-test-vector-004
+++ b/gst-libs/ext/libav/tests/ref/fate/vp8-test-vector-004
@@ -1,29 +1,30 @@
-0, 0, 38016, 83c78b5db579710f61f9354d5c51e8c8
-0, 3000, 38016, d173eb8a8211a05672b43206609c9034
-0, 6000, 38016, 204e3e91613d647d30244c00fa2b9563
-0, 9000, 38016, 3cc1a395bd10a49b006741778285925b
-0, 12000, 38016, 024548b00dea4f104d6b9a728be05786
-0, 15000, 38016, 01401e9418f2e00ab4ffdb3296d40ffa
-0, 18000, 38016, 35d8b3c1ef9cb864315b7502b93629b2
-0, 21000, 38016, aeb44f0fe4c2eecb26c0bd657d65b00b
-0, 24000, 38016, 42e40bed012bacf59f0c41d4cfd3e52a
-0, 27000, 38016, 9796191fa2bd4572123ea043396e8485
-0, 30000, 38016, 2d6d68b902129f3c3f1730e73b98f9c9
-0, 33000, 38016, ba348b89248b92d0b86d794dc413e6a0
-0, 36000, 38016, 5ce49bf164033d49bef1b23120d202d6
-0, 39000, 38016, 54837a426c63a9c40ef8750232615dad
-0, 42000, 38016, 350bcddf9a34f5003f6f655aaa020a00
-0, 45000, 38016, babb82b1e2ca9315816b6f43b8ef84a0
-0, 48000, 38016, c770825785c51fa374fd5bb08ff9f536
-0, 51000, 38016, e9e0f92e416fcd27ca2e93a0804ac938
-0, 54000, 38016, e0f2b89423da549eaa8b2b89f956f0f8
-0, 57000, 38016, 9926b7e13b51115735eb0af8bb5e4ea1
-0, 60000, 38016, d6b30a058b854c54068ebfc2b05f8fa0
-0, 63000, 38016, a03048df79e41ada8a3ecc15a85e3f94
-0, 66000, 38016, 34bef9af0633a43434841fd5189c161c
-0, 69000, 38016, 219b447552b1ee409c1b9b56176d36bf
-0, 72000, 38016, 95ea99459eaebc2f7233feeaf0549224
-0, 75000, 38016, 34e08ce4067ca67ee9014cf628b6bb1c
-0, 78000, 38016, 066c09a20d11b9dc3fa6972fd7f242c4
-0, 81000, 38016, aed02c1951070ae5febea21ad54add55
-0, 84000, 38016, f5a0fde2d818c4aaabd29b069ced6aea
+#tb 0: 1/30
+0, 0, 0, 1, 38016, 83c78b5db579710f61f9354d5c51e8c8
+0, 1, 1, 1, 38016, d173eb8a8211a05672b43206609c9034
+0, 2, 2, 1, 38016, 204e3e91613d647d30244c00fa2b9563
+0, 3, 3, 1, 38016, 3cc1a395bd10a49b006741778285925b
+0, 4, 4, 1, 38016, 024548b00dea4f104d6b9a728be05786
+0, 5, 5, 1, 38016, 01401e9418f2e00ab4ffdb3296d40ffa
+0, 6, 6, 1, 38016, 35d8b3c1ef9cb864315b7502b93629b2
+0, 7, 7, 1, 38016, aeb44f0fe4c2eecb26c0bd657d65b00b
+0, 8, 8, 1, 38016, 42e40bed012bacf59f0c41d4cfd3e52a
+0, 9, 9, 1, 38016, 9796191fa2bd4572123ea043396e8485
+0, 10, 10, 1, 38016, 2d6d68b902129f3c3f1730e73b98f9c9
+0, 11, 11, 1, 38016, ba348b89248b92d0b86d794dc413e6a0
+0, 12, 12, 1, 38016, 5ce49bf164033d49bef1b23120d202d6
+0, 13, 13, 1, 38016, 54837a426c63a9c40ef8750232615dad
+0, 14, 14, 1, 38016, 350bcddf9a34f5003f6f655aaa020a00
+0, 15, 15, 1, 38016, babb82b1e2ca9315816b6f43b8ef84a0
+0, 16, 16, 1, 38016, c770825785c51fa374fd5bb08ff9f536
+0, 17, 17, 1, 38016, e9e0f92e416fcd27ca2e93a0804ac938
+0, 18, 18, 1, 38016, e0f2b89423da549eaa8b2b89f956f0f8
+0, 19, 19, 1, 38016, 9926b7e13b51115735eb0af8bb5e4ea1
+0, 20, 20, 1, 38016, d6b30a058b854c54068ebfc2b05f8fa0
+0, 21, 21, 1, 38016, a03048df79e41ada8a3ecc15a85e3f94
+0, 22, 22, 1, 38016, 34bef9af0633a43434841fd5189c161c
+0, 23, 23, 1, 38016, 219b447552b1ee409c1b9b56176d36bf
+0, 24, 24, 1, 38016, 95ea99459eaebc2f7233feeaf0549224
+0, 25, 25, 1, 38016, 34e08ce4067ca67ee9014cf628b6bb1c
+0, 26, 26, 1, 38016, 066c09a20d11b9dc3fa6972fd7f242c4
+0, 27, 27, 1, 38016, aed02c1951070ae5febea21ad54add55
+0, 28, 28, 1, 38016, f5a0fde2d818c4aaabd29b069ced6aea
diff --git a/gst-libs/ext/libav/tests/ref/fate/vp8-test-vector-005 b/gst-libs/ext/libav/tests/ref/fate/vp8-test-vector-005
index b672ee9..3569dee 100644
--- a/gst-libs/ext/libav/tests/ref/fate/vp8-test-vector-005
+++ b/gst-libs/ext/libav/tests/ref/fate/vp8-test-vector-005
@@ -1,49 +1,50 @@
-0, 0, 38016, e7a4be434df4bb524ba56a03cba901f4
-0, 3750, 38016, d903ade6d49e51485627c044fbb2190c
-0, 7500, 38016, af07ee39629b852870104cb9a9dde9e3
-0, 11250, 38016, 388a5f736db2de15342b62294fda4c82
-0, 15000, 38016, a072600936aa77738fa2fa88ba212849
-0, 18750, 38016, 0f96b1fb05b92498c0e1fcb6552e7e79
-0, 22500, 38016, 68b0db002a0127ee79a7c70062aa8c3a
-0, 26250, 38016, f9bc8edfeb9ceca9227a20cdab6788de
-0, 30000, 38016, bfe2115b000565abc3dce1d38f804ed7
-0, 33750, 38016, 67f17f96177f5464af1b97452560d2af
-0, 37500, 38016, 658278016e5409b69d014fab0d94d0ea
-0, 41250, 38016, 04dfd36afa0ddf22993d21c0a0fc715e
-0, 45000, 38016, 088e5a7cc75a895f01f7a4362f104bc1
-0, 48750, 38016, fb622a1a421b3689950f1adde9296dbb
-0, 52500, 38016, 3711ac7adc816614a2efda9e138f53fc
-0, 56250, 38016, 8e6fe3e68ccf53f23dd430b611fbfa6d
-0, 60000, 38016, 1c77dd651cd38d3308671f0705d29926
-0, 63750, 38016, bb5d7afccebc5d8a29f5980d21530d61
-0, 67500, 38016, e51f2eeb39afa50ea243eaca39974f82
-0, 71250, 38016, 7a73b1546fb5d8d4b05ebd4c839f74f8
-0, 75000, 38016, 62a0db46717d7fb6523c62968fd3bc85
-0, 78750, 38016, 98d6e520a164c42c5d19167c0ad48b22
-0, 82500, 38016, 9749a21ea432221323c1a6b61ea59d51
-0, 86250, 38016, 45fa9a9583db0139611b860bed8f6bc1
-0, 90000, 38016, aac06fe351759ca81a5028f2f4a7b534
-0, 93750, 38016, 7b7c7c16a377d61b6fe474541a18f0cd
-0, 97500, 38016, 2a84883fdfa8450d46b8b9352b7d5a87
-0, 101250, 38016, 3fc42d7dd6fa25ec17d8f2881f81b376
-0, 105000, 38016, bfb243be1eada17adab5580b748248e7
-0, 108750, 38016, 531fd799989db62210efc1999397d280
-0, 112500, 38016, 1c1e68673b295e17fca1b14d1eb1995e
-0, 116250, 38016, 12ee0f8810a1a3574337ef98987cf919
-0, 120000, 38016, 0c6ef1cec243c552e83054d5ac56a8c1
-0, 123750, 38016, cf0af3fb96e57143d335086485fbfa5c
-0, 127500, 38016, f5df68bb123d1f2f59ba471fbd118a9e
-0, 131250, 38016, 0b4a0cf5dd7968fd26959ad2849655b0
-0, 135000, 38016, 0ba766224688a95bfa43ac2453555972
-0, 138750, 38016, ef3f9fd7e5509bb880377fa1997d318c
-0, 142500, 38016, d7486c3176cef98c0046522acbdaa4f0
-0, 146250, 38016, f8dd15973993f4a2acd1d34b3610622e
-0, 150000, 38016, e99b7f294e6bdd9ae18f013f62174fcd
-0, 153750, 38016, 68ccf7e14a1055b24c5faf1b3a1888e7
-0, 157500, 38016, 2f230afb6e5c67e4b7e000317638e919
-0, 161250, 38016, 9cab31ac76ed26a879ac8b88bf7d33a1
-0, 165000, 38016, 1e2affc0f458808b4564bd0453565a81
-0, 168750, 38016, 79669092f6c73053c3de6d0d1408cc8c
-0, 172500, 38016, 7b27977ba84341b9af4d58a7864f763a
-0, 176250, 38016, 2481a387d65e7a16fe831b8da2200985
-0, 180000, 38016, fa5e3bc265877b30ca71de0a2b14663b
+#tb 0: 1/24
+0, 0, 0, 1, 38016, e7a4be434df4bb524ba56a03cba901f4
+0, 1, 1, 1, 38016, d903ade6d49e51485627c044fbb2190c
+0, 2, 2, 1, 38016, af07ee39629b852870104cb9a9dde9e3
+0, 3, 3, 1, 38016, 388a5f736db2de15342b62294fda4c82
+0, 4, 4, 1, 38016, a072600936aa77738fa2fa88ba212849
+0, 5, 5, 1, 38016, 0f96b1fb05b92498c0e1fcb6552e7e79
+0, 6, 6, 1, 38016, 68b0db002a0127ee79a7c70062aa8c3a
+0, 7, 7, 1, 38016, f9bc8edfeb9ceca9227a20cdab6788de
+0, 8, 8, 1, 38016, bfe2115b000565abc3dce1d38f804ed7
+0, 9, 9, 1, 38016, 67f17f96177f5464af1b97452560d2af
+0, 10, 10, 1, 38016, 658278016e5409b69d014fab0d94d0ea
+0, 11, 11, 1, 38016, 04dfd36afa0ddf22993d21c0a0fc715e
+0, 12, 12, 1, 38016, 088e5a7cc75a895f01f7a4362f104bc1
+0, 13, 13, 1, 38016, fb622a1a421b3689950f1adde9296dbb
+0, 14, 14, 1, 38016, 3711ac7adc816614a2efda9e138f53fc
+0, 15, 15, 1, 38016, 8e6fe3e68ccf53f23dd430b611fbfa6d
+0, 16, 16, 1, 38016, 1c77dd651cd38d3308671f0705d29926
+0, 17, 17, 1, 38016, bb5d7afccebc5d8a29f5980d21530d61
+0, 18, 18, 1, 38016, e51f2eeb39afa50ea243eaca39974f82
+0, 19, 19, 1, 38016, 7a73b1546fb5d8d4b05ebd4c839f74f8
+0, 20, 20, 1, 38016, 62a0db46717d7fb6523c62968fd3bc85
+0, 21, 21, 1, 38016, 98d6e520a164c42c5d19167c0ad48b22
+0, 22, 22, 1, 38016, 9749a21ea432221323c1a6b61ea59d51
+0, 23, 23, 1, 38016, 45fa9a9583db0139611b860bed8f6bc1
+0, 24, 24, 1, 38016, aac06fe351759ca81a5028f2f4a7b534
+0, 25, 25, 1, 38016, 7b7c7c16a377d61b6fe474541a18f0cd
+0, 26, 26, 1, 38016, 2a84883fdfa8450d46b8b9352b7d5a87
+0, 27, 27, 1, 38016, 3fc42d7dd6fa25ec17d8f2881f81b376
+0, 28, 28, 1, 38016, bfb243be1eada17adab5580b748248e7
+0, 29, 29, 1, 38016, 531fd799989db62210efc1999397d280
+0, 30, 30, 1, 38016, 1c1e68673b295e17fca1b14d1eb1995e
+0, 31, 31, 1, 38016, 12ee0f8810a1a3574337ef98987cf919
+0, 32, 32, 1, 38016, 0c6ef1cec243c552e83054d5ac56a8c1
+0, 33, 33, 1, 38016, cf0af3fb96e57143d335086485fbfa5c
+0, 34, 34, 1, 38016, f5df68bb123d1f2f59ba471fbd118a9e
+0, 35, 35, 1, 38016, 0b4a0cf5dd7968fd26959ad2849655b0
+0, 36, 36, 1, 38016, 0ba766224688a95bfa43ac2453555972
+0, 37, 37, 1, 38016, ef3f9fd7e5509bb880377fa1997d318c
+0, 38, 38, 1, 38016, d7486c3176cef98c0046522acbdaa4f0
+0, 39, 39, 1, 38016, f8dd15973993f4a2acd1d34b3610622e
+0, 40, 40, 1, 38016, e99b7f294e6bdd9ae18f013f62174fcd
+0, 41, 41, 1, 38016, 68ccf7e14a1055b24c5faf1b3a1888e7
+0, 42, 42, 1, 38016, 2f230afb6e5c67e4b7e000317638e919
+0, 43, 43, 1, 38016, 9cab31ac76ed26a879ac8b88bf7d33a1
+0, 44, 44, 1, 38016, 1e2affc0f458808b4564bd0453565a81
+0, 45, 45, 1, 38016, 79669092f6c73053c3de6d0d1408cc8c
+0, 46, 46, 1, 38016, 7b27977ba84341b9af4d58a7864f763a
+0, 47, 47, 1, 38016, 2481a387d65e7a16fe831b8da2200985
+0, 48, 48, 1, 38016, fa5e3bc265877b30ca71de0a2b14663b
diff --git a/gst-libs/ext/libav/tests/ref/fate/vp8-test-vector-006 b/gst-libs/ext/libav/tests/ref/fate/vp8-test-vector-006
index bbdf814..38b92c4 100644
--- a/gst-libs/ext/libav/tests/ref/fate/vp8-test-vector-006
+++ b/gst-libs/ext/libav/tests/ref/fate/vp8-test-vector-006
@@ -1,48 +1,49 @@
-0, 0, 37697, 9ca5df27b0158aca2a38dff946f58c41
-0, 3750, 37697, 627129a99538ec1ac51be910ca92ebc4
-0, 7500, 37697, 6c2df1f21af317aa5bb68b161ca96c70
-0, 11250, 37697, d66db823863838ca5b7f9125609e7de3
-0, 15000, 37697, ecc970f8846290c0b7bf8d0865975cb7
-0, 18750, 37697, 2fe7575c448562e291933e297335e1c8
-0, 22500, 37697, e2a6fb8af11f65ce1153d6021df39e5f
-0, 26250, 37697, 4536008cd0a425c9a9d93cbb3e8ba640
-0, 30000, 37697, 478f042fff1cf0b6fd2eed391879c7ba
-0, 33750, 37697, f079ee39021b1dd730f80bfaff9a6ae4
-0, 37500, 37697, cb9b166c785ceabecf79e12e6068d4e4
-0, 41250, 37697, 6bd6f77dc9c45cec08949a42aa1c2653
-0, 45000, 37697, 1433577eb50b3270c0f1d6d26fb26277
-0, 48750, 37697, 2765b207d230efd9a3e2e93c641b8553
-0, 52500, 37697, a67e2f6bcf3b03e250c0ad8f1384ffb6
-0, 56250, 37697, b5ea80e2dbffefdd8a613c25ee7f5f0c
-0, 60000, 37697, e4b58bf735a8258842ad3c364eb9418c
-0, 63750, 37697, 8e5fc5d4c78eb495f62e4a014a6a2a6c
-0, 67500, 37697, 53bee2faf4cfae16037cda36a6194a57
-0, 71250, 37697, e5c2e1de872a7107f80966ae857557d4
-0, 75000, 37697, 882e46851681e6e3b376b5d1d9e139fb
-0, 78750, 37697, 40b199fe02b5885947af22ce1314a085
-0, 82500, 37697, 942b79dd5360c2a114db760424620a84
-0, 86250, 37697, fe9f69dd6fc113ceec9127d9e12b3958
-0, 90000, 37697, db13edae7e8e8a91d1ec84227c8f818f
-0, 93750, 37697, 1963ea61c3e93150f7604ee6fa09b12c
-0, 97500, 37697, 8cf43556160454d2353cedb9ba5675aa
-0, 101250, 37697, a5e6b5b00fea3d9b1bdbd01fda712f27
-0, 105000, 37697, 35f006cb6e570999b9011282c49c6d22
-0, 108750, 37697, d884d482371cb2727e26475bb390d38b
-0, 112500, 37697, a7233206056d3af69c6cff343b57de84
-0, 116250, 37697, 437492f3e594576e1c17065e0091aa2d
-0, 120000, 37697, 47f0677d9aff054056a194755628fdb8
-0, 123750, 37697, fc93105a16501763a6e6ba3445ee6f32
-0, 127500, 37697, 68612903d08399e0f0d9e28c1f18f6ea
-0, 131250, 37697, a340fbba24c73372e6248f10e878f11b
-0, 135000, 37697, 58c3561b06f9d866587f728877c08860
-0, 138750, 37697, f2dd2a029515ad9c0655ccf86a2c524b
-0, 142500, 37697, 789d43f63cbb302dad9f3e4b33713746
-0, 146250, 37697, d8f979aca1774470269283da048a505b
-0, 150000, 37697, ecc06e2175290319cb36614370c8ad62
-0, 153750, 37697, 5ba26b83766b666007b502a7194170e3
-0, 157500, 37697, 8163a20e9a345b70579c625c50e7ec73
-0, 161250, 37697, 1f1a497d768c4bcd57de11b21baf9138
-0, 165000, 37697, a21e9a52a982675815c9937b49ebb0ff
-0, 168750, 37697, dcc0bd83ce31ac99577cd2f9ced69096
-0, 172500, 37697, df36b27588b8515580d5015e5f66dbf9
-0, 176250, 37697, 156a6351549949953ce3197b990760a9
+#tb 0: 1/24
+0, 0, 0, 1, 37697, 9ca5df27b0158aca2a38dff946f58c41
+0, 1, 1, 1, 37697, 627129a99538ec1ac51be910ca92ebc4
+0, 2, 2, 1, 37697, 6c2df1f21af317aa5bb68b161ca96c70
+0, 3, 3, 1, 37697, d66db823863838ca5b7f9125609e7de3
+0, 4, 4, 1, 37697, ecc970f8846290c0b7bf8d0865975cb7
+0, 5, 5, 1, 37697, 2fe7575c448562e291933e297335e1c8
+0, 6, 6, 1, 37697, e2a6fb8af11f65ce1153d6021df39e5f
+0, 7, 7, 1, 37697, 4536008cd0a425c9a9d93cbb3e8ba640
+0, 8, 8, 1, 37697, 478f042fff1cf0b6fd2eed391879c7ba
+0, 9, 9, 1, 37697, f079ee39021b1dd730f80bfaff9a6ae4
+0, 10, 10, 1, 37697, cb9b166c785ceabecf79e12e6068d4e4
+0, 11, 11, 1, 37697, 6bd6f77dc9c45cec08949a42aa1c2653
+0, 12, 12, 1, 37697, 1433577eb50b3270c0f1d6d26fb26277
+0, 13, 13, 1, 37697, 2765b207d230efd9a3e2e93c641b8553
+0, 14, 14, 1, 37697, a67e2f6bcf3b03e250c0ad8f1384ffb6
+0, 15, 15, 1, 37697, b5ea80e2dbffefdd8a613c25ee7f5f0c
+0, 16, 16, 1, 37697, e4b58bf735a8258842ad3c364eb9418c
+0, 17, 17, 1, 37697, 8e5fc5d4c78eb495f62e4a014a6a2a6c
+0, 18, 18, 1, 37697, 53bee2faf4cfae16037cda36a6194a57
+0, 19, 19, 1, 37697, e5c2e1de872a7107f80966ae857557d4
+0, 20, 20, 1, 37697, 882e46851681e6e3b376b5d1d9e139fb
+0, 21, 21, 1, 37697, 40b199fe02b5885947af22ce1314a085
+0, 22, 22, 1, 37697, 942b79dd5360c2a114db760424620a84
+0, 23, 23, 1, 37697, fe9f69dd6fc113ceec9127d9e12b3958
+0, 24, 24, 1, 37697, db13edae7e8e8a91d1ec84227c8f818f
+0, 25, 25, 1, 37697, 1963ea61c3e93150f7604ee6fa09b12c
+0, 26, 26, 1, 37697, 8cf43556160454d2353cedb9ba5675aa
+0, 27, 27, 1, 37697, a5e6b5b00fea3d9b1bdbd01fda712f27
+0, 28, 28, 1, 37697, 35f006cb6e570999b9011282c49c6d22
+0, 29, 29, 1, 37697, d884d482371cb2727e26475bb390d38b
+0, 30, 30, 1, 37697, a7233206056d3af69c6cff343b57de84
+0, 31, 31, 1, 37697, 437492f3e594576e1c17065e0091aa2d
+0, 32, 32, 1, 37697, 47f0677d9aff054056a194755628fdb8
+0, 33, 33, 1, 37697, fc93105a16501763a6e6ba3445ee6f32
+0, 34, 34, 1, 37697, 68612903d08399e0f0d9e28c1f18f6ea
+0, 35, 35, 1, 37697, a340fbba24c73372e6248f10e878f11b
+0, 36, 36, 1, 37697, 58c3561b06f9d866587f728877c08860
+0, 37, 37, 1, 37697, f2dd2a029515ad9c0655ccf86a2c524b
+0, 38, 38, 1, 37697, 789d43f63cbb302dad9f3e4b33713746
+0, 39, 39, 1, 37697, d8f979aca1774470269283da048a505b
+0, 40, 40, 1, 37697, ecc06e2175290319cb36614370c8ad62
+0, 41, 41, 1, 37697, 5ba26b83766b666007b502a7194170e3
+0, 42, 42, 1, 37697, 8163a20e9a345b70579c625c50e7ec73
+0, 43, 43, 1, 37697, 1f1a497d768c4bcd57de11b21baf9138
+0, 44, 44, 1, 37697, a21e9a52a982675815c9937b49ebb0ff
+0, 45, 45, 1, 37697, dcc0bd83ce31ac99577cd2f9ced69096
+0, 46, 46, 1, 37697, df36b27588b8515580d5015e5f66dbf9
+0, 47, 47, 1, 37697, 156a6351549949953ce3197b990760a9
diff --git a/gst-libs/ext/libav/tests/ref/fate/vp8-test-vector-007 b/gst-libs/ext/libav/tests/ref/fate/vp8-test-vector-007
index d4aa997..8d9b912 100644
--- a/gst-libs/ext/libav/tests/ref/fate/vp8-test-vector-007
+++ b/gst-libs/ext/libav/tests/ref/fate/vp8-test-vector-007
@@ -1,29 +1,30 @@
-0, 0, 38016, 98bd0af6928c144888a9c320270e9f0e
-0, 3000, 38016, 9ff7cff703d58481acd233451388377c
-0, 6000, 38016, e4cd8815527846cc782ea61ef5a46e49
-0, 9000, 38016, db45275b87e194e5b505dd8c47da4f5d
-0, 12000, 38016, c889d0f7bd34faf4df0e0a9eb9fc292a
-0, 15000, 38016, 4dbfb1727baf9b75980e7fdd44ca0924
-0, 18000, 38016, 5f217ac95c891dc81f7193fc5352d582
-0, 21000, 38016, 11166789635e472f629510f551b11e2c
-0, 24000, 38016, 336e6e42e67e1ccb7cda6298cb63f192
-0, 27000, 38016, 02dbcff56882e304d5043d0f9b1ff9ff
-0, 30000, 38016, fe033ea2c6b8b81a9328b470f8b0d6bb
-0, 33000, 38016, 0e3330fe9a7c0439ff53f18f0d15eb48
-0, 36000, 38016, 6c0d7e042a3bb32a128c4a405f59b426
-0, 39000, 38016, 7e51afc33dbf4b77fc5735f5d9ec0248
-0, 42000, 38016, a8381f193f34a5071b8eeba7f5cd1968
-0, 45000, 38016, 501a7914b47ff85c24f0533ee98b9fe9
-0, 48000, 38016, 00bd5fbb7e3b66514e6c77c3a5f118c3
-0, 51000, 38016, 23e296d12a45909cadda252b9f4e67bd
-0, 54000, 38016, fa0b5c69bacf766551bebdde0910eb9f
-0, 57000, 38016, f5cc24d10d58ebc50503ca321db708cc
-0, 60000, 38016, 3997eb9ff6231dee9e23752776113cd6
-0, 63000, 38016, 68d4c9cd494d91dd70e7a94c7a4b9a12
-0, 66000, 38016, 647b34f3aa7318adce68803ba00104fb
-0, 69000, 38016, ffed5301bd6fddd1d24d12e6096cc8a6
-0, 72000, 38016, 9511388180811c10d166886868d6e71c
-0, 75000, 38016, a9b330803b8ccd91596591c0449423ab
-0, 78000, 38016, 69b192888cda09dac658d5820183a2e8
-0, 81000, 38016, 8886e5851e60a7474cc9e214ba6373ad
-0, 84000, 38016, f59e354deedb129a90ab3922838b03d3
+#tb 0: 1/30
+0, 0, 0, 1, 38016, 98bd0af6928c144888a9c320270e9f0e
+0, 1, 1, 1, 38016, 9ff7cff703d58481acd233451388377c
+0, 2, 2, 1, 38016, e4cd8815527846cc782ea61ef5a46e49
+0, 3, 3, 1, 38016, db45275b87e194e5b505dd8c47da4f5d
+0, 4, 4, 1, 38016, c889d0f7bd34faf4df0e0a9eb9fc292a
+0, 5, 5, 1, 38016, 4dbfb1727baf9b75980e7fdd44ca0924
+0, 6, 6, 1, 38016, 5f217ac95c891dc81f7193fc5352d582
+0, 7, 7, 1, 38016, 11166789635e472f629510f551b11e2c
+0, 8, 8, 1, 38016, 336e6e42e67e1ccb7cda6298cb63f192
+0, 9, 9, 1, 38016, 02dbcff56882e304d5043d0f9b1ff9ff
+0, 10, 10, 1, 38016, fe033ea2c6b8b81a9328b470f8b0d6bb
+0, 11, 11, 1, 38016, 0e3330fe9a7c0439ff53f18f0d15eb48
+0, 12, 12, 1, 38016, 6c0d7e042a3bb32a128c4a405f59b426
+0, 13, 13, 1, 38016, 7e51afc33dbf4b77fc5735f5d9ec0248
+0, 14, 14, 1, 38016, a8381f193f34a5071b8eeba7f5cd1968
+0, 15, 15, 1, 38016, 501a7914b47ff85c24f0533ee98b9fe9
+0, 16, 16, 1, 38016, 00bd5fbb7e3b66514e6c77c3a5f118c3
+0, 17, 17, 1, 38016, 23e296d12a45909cadda252b9f4e67bd
+0, 18, 18, 1, 38016, fa0b5c69bacf766551bebdde0910eb9f
+0, 19, 19, 1, 38016, f5cc24d10d58ebc50503ca321db708cc
+0, 20, 20, 1, 38016, 3997eb9ff6231dee9e23752776113cd6
+0, 21, 21, 1, 38016, 68d4c9cd494d91dd70e7a94c7a4b9a12
+0, 22, 22, 1, 38016, 647b34f3aa7318adce68803ba00104fb
+0, 23, 23, 1, 38016, ffed5301bd6fddd1d24d12e6096cc8a6
+0, 24, 24, 1, 38016, 9511388180811c10d166886868d6e71c
+0, 25, 25, 1, 38016, a9b330803b8ccd91596591c0449423ab
+0, 26, 26, 1, 38016, 69b192888cda09dac658d5820183a2e8
+0, 27, 27, 1, 38016, 8886e5851e60a7474cc9e214ba6373ad
+0, 28, 28, 1, 38016, f59e354deedb129a90ab3922838b03d3
diff --git a/gst-libs/ext/libav/tests/ref/fate/vp8-test-vector-008 b/gst-libs/ext/libav/tests/ref/fate/vp8-test-vector-008
index 105b6b4..9be8d73 100644
--- a/gst-libs/ext/libav/tests/ref/fate/vp8-test-vector-008
+++ b/gst-libs/ext/libav/tests/ref/fate/vp8-test-vector-008
@@ -1,2 +1,3 @@
-0, 0, 1907424, 7146d3a72b6cb8e43ee5280ef8d661fe
-0, 3913, 1907424, 5a537e9710158efb5ad2683a1d3b4c72
+#tb 0: 1/23
+0, 0, 0, 1, 1907424, 7146d3a72b6cb8e43ee5280ef8d661fe
+0, 1, 1, 1, 1907424, 5a537e9710158efb5ad2683a1d3b4c72
diff --git a/gst-libs/ext/libav/tests/ref/fate/vp8-test-vector-009 b/gst-libs/ext/libav/tests/ref/fate/vp8-test-vector-009
index c65210e..fae204d 100644
--- a/gst-libs/ext/libav/tests/ref/fate/vp8-test-vector-009
+++ b/gst-libs/ext/libav/tests/ref/fate/vp8-test-vector-009
@@ -1,49 +1,50 @@
-0, 0, 38016, b3a3121c796a60c88988fef5240a07fe
-0, 3750, 38016, f25147764829cf837e00b8fd6383e2c4
-0, 7500, 38016, 1b1552291a89c97d5deea145ab0ac0cd
-0, 11250, 38016, 0b2e75bbbe8f4248eb1519b6542efc96
-0, 15000, 38016, 99e8fc68547e119253ee3b8d79efa774
-0, 18750, 38016, 3aaf9210819238da7f704339bd8f262c
-0, 22500, 38016, de80b11f4c325e6d467d4abe5ad0db51
-0, 26250, 38016, 93d2fba68721768018b35ccac27b6bb1
-0, 30000, 38016, 07d7d4f8ad4151a013b652bec21ea9b8
-0, 33750, 38016, aaa95e4d39aa31cf68fdb8da268827e5
-0, 37500, 38016, 3607fcda0733e0b0fd10a8f7fbe6e39e
-0, 41250, 38016, 6d8cc24ea3b9827ef0147c8b7cc6938d
-0, 45000, 38016, 977a6b65d41b1b70dd4df9f526045675
-0, 48750, 38016, 9258b0e5fc2217c3aebbd96bb06c937a
-0, 52500, 38016, 887378a3aad18346a3827cd0aadc6873
-0, 56250, 38016, c2a3ff302d74eefd0855f2c862766aca
-0, 60000, 38016, 1a7d835f5a977e1fd8cc37bdd8d029ca
-0, 63750, 38016, 232be1f7e334001c3abbed550cc60c34
-0, 67500, 38016, e8cb3470b9a3ffbc7014793514dc89cf
-0, 71250, 38016, 54b20adca41910f003790a975ff7b50d
-0, 75000, 38016, 2c5fce4dcdd538f1d9377fa071f3d615
-0, 78750, 38016, d559840da8cef1f0b1379a592f708f0a
-0, 82500, 38016, ffab5f1060938a62cf8ef9df30ec8a33
-0, 86250, 38016, b7d93c8eda8cce4d387f2ea78c415704
-0, 90000, 38016, 7840aa27333e6350d114b256ab4304f1
-0, 93750, 38016, dc1f3b125177d0ad7f53dd058bba03e7
-0, 97500, 38016, 37134fcaad963a22f4df04c0765af455
-0, 101250, 38016, 4dc062fb76943a75e7b2428e5babbb3c
-0, 105000, 38016, dfda91bc05efc72073a2b6b62f294327
-0, 108750, 38016, 7ffc690c63a1c54e35978336dc5828a3
-0, 112500, 38016, 9ae31bacbc097c2ccf1500ff89882e46
-0, 116250, 38016, 1450c24713dcad41aeba1c44007bf12f
-0, 120000, 38016, f125bb52b8a1b11e076de55cca1069ee
-0, 123750, 38016, 555e1f2a6d293a0bdc9f92e9c3b3118d
-0, 127500, 38016, ec9a8d577a07a4f0d5deae63b3cea6dd
-0, 131250, 38016, a54f74e0ee329db4a78851bb7e54b2ba
-0, 135000, 38016, 99fcfe7ed9028bc443a790f9cf8eb812
-0, 138750, 38016, b9b994ffbe0150945b752a2120b4a475
-0, 142500, 38016, f00d70d8a28cecaaec1eb84592e3f6c3
-0, 146250, 38016, 3bc8ed07fc92c4d339164891e6624306
-0, 150000, 38016, d755777560d745d6bdfa01b9e9cbbcc0
-0, 153750, 38016, bcefb5ef8fae173e413406b4a60e2255
-0, 157500, 38016, fb47098c334b82764e30819066b13096
-0, 161250, 38016, 9e31f68fc96045bba43cf1253eedc419
-0, 165000, 38016, 53522d46d2ba91ab23693db7d41ecda7
-0, 168750, 38016, d66a074ebe6123590622e5cb308d75e5
-0, 172500, 38016, 6574fce175632a22fcc05b47157318e4
-0, 176250, 38016, 31f7fb05d060c1dea46044787772baaf
-0, 180000, 38016, cec733062ae526ae71b39ae0dc402482
+#tb 0: 1/24
+0, 0, 0, 1, 38016, b3a3121c796a60c88988fef5240a07fe
+0, 1, 1, 1, 38016, f25147764829cf837e00b8fd6383e2c4
+0, 2, 2, 1, 38016, 1b1552291a89c97d5deea145ab0ac0cd
+0, 3, 3, 1, 38016, 0b2e75bbbe8f4248eb1519b6542efc96
+0, 4, 4, 1, 38016, 99e8fc68547e119253ee3b8d79efa774
+0, 5, 5, 1, 38016, 3aaf9210819238da7f704339bd8f262c
+0, 6, 6, 1, 38016, de80b11f4c325e6d467d4abe5ad0db51
+0, 7, 7, 1, 38016, 93d2fba68721768018b35ccac27b6bb1
+0, 8, 8, 1, 38016, 07d7d4f8ad4151a013b652bec21ea9b8
+0, 9, 9, 1, 38016, aaa95e4d39aa31cf68fdb8da268827e5
+0, 10, 10, 1, 38016, 3607fcda0733e0b0fd10a8f7fbe6e39e
+0, 11, 11, 1, 38016, 6d8cc24ea3b9827ef0147c8b7cc6938d
+0, 12, 12, 1, 38016, 977a6b65d41b1b70dd4df9f526045675
+0, 13, 13, 1, 38016, 9258b0e5fc2217c3aebbd96bb06c937a
+0, 14, 14, 1, 38016, 887378a3aad18346a3827cd0aadc6873
+0, 15, 15, 1, 38016, c2a3ff302d74eefd0855f2c862766aca
+0, 16, 16, 1, 38016, 1a7d835f5a977e1fd8cc37bdd8d029ca
+0, 17, 17, 1, 38016, 232be1f7e334001c3abbed550cc60c34
+0, 18, 18, 1, 38016, e8cb3470b9a3ffbc7014793514dc89cf
+0, 19, 19, 1, 38016, 54b20adca41910f003790a975ff7b50d
+0, 20, 20, 1, 38016, 2c5fce4dcdd538f1d9377fa071f3d615
+0, 21, 21, 1, 38016, d559840da8cef1f0b1379a592f708f0a
+0, 22, 22, 1, 38016, ffab5f1060938a62cf8ef9df30ec8a33
+0, 23, 23, 1, 38016, b7d93c8eda8cce4d387f2ea78c415704
+0, 24, 24, 1, 38016, 7840aa27333e6350d114b256ab4304f1
+0, 25, 25, 1, 38016, dc1f3b125177d0ad7f53dd058bba03e7
+0, 26, 26, 1, 38016, 37134fcaad963a22f4df04c0765af455
+0, 27, 27, 1, 38016, 4dc062fb76943a75e7b2428e5babbb3c
+0, 28, 28, 1, 38016, dfda91bc05efc72073a2b6b62f294327
+0, 29, 29, 1, 38016, 7ffc690c63a1c54e35978336dc5828a3
+0, 30, 30, 1, 38016, 9ae31bacbc097c2ccf1500ff89882e46
+0, 31, 31, 1, 38016, 1450c24713dcad41aeba1c44007bf12f
+0, 32, 32, 1, 38016, f125bb52b8a1b11e076de55cca1069ee
+0, 33, 33, 1, 38016, 555e1f2a6d293a0bdc9f92e9c3b3118d
+0, 34, 34, 1, 38016, ec9a8d577a07a4f0d5deae63b3cea6dd
+0, 35, 35, 1, 38016, a54f74e0ee329db4a78851bb7e54b2ba
+0, 36, 36, 1, 38016, 99fcfe7ed9028bc443a790f9cf8eb812
+0, 37, 37, 1, 38016, b9b994ffbe0150945b752a2120b4a475
+0, 38, 38, 1, 38016, f00d70d8a28cecaaec1eb84592e3f6c3
+0, 39, 39, 1, 38016, 3bc8ed07fc92c4d339164891e6624306
+0, 40, 40, 1, 38016, d755777560d745d6bdfa01b9e9cbbcc0
+0, 41, 41, 1, 38016, bcefb5ef8fae173e413406b4a60e2255
+0, 42, 42, 1, 38016, fb47098c334b82764e30819066b13096
+0, 43, 43, 1, 38016, 9e31f68fc96045bba43cf1253eedc419
+0, 44, 44, 1, 38016, 53522d46d2ba91ab23693db7d41ecda7
+0, 45, 45, 1, 38016, d66a074ebe6123590622e5cb308d75e5
+0, 46, 46, 1, 38016, 6574fce175632a22fcc05b47157318e4
+0, 47, 47, 1, 38016, 31f7fb05d060c1dea46044787772baaf
+0, 48, 48, 1, 38016, cec733062ae526ae71b39ae0dc402482
diff --git a/gst-libs/ext/libav/tests/ref/fate/vp8-test-vector-010 b/gst-libs/ext/libav/tests/ref/fate/vp8-test-vector-010
index ea5c8f3..b250ad9 100644
--- a/gst-libs/ext/libav/tests/ref/fate/vp8-test-vector-010
+++ b/gst-libs/ext/libav/tests/ref/fate/vp8-test-vector-010
@@ -1,57 +1,58 @@
-0, 0, 115200, 3441ec1a9b9d325c9aeda44e3b68377d
-0, 3000, 115200, bff86a84fd673394f45c09d19a1ee0ac
-0, 6000, 115200, 8cd920f0de408e8cd883f9241680ff80
-0, 9000, 115200, d1b27cbb40859bbbb6da40dce6ddbf1b
-0, 12000, 115200, ca102ed86e45fe452f55a2cf0253de21
-0, 15000, 115200, ac7630be64017becd6e958df360263b5
-0, 18000, 115200, a044041ede746687d33ba6342d8d3edb
-0, 21000, 115200, 75d7c0eec357afd0c2d54e769f551b20
-0, 24000, 115200, eebd916e4fba53a66fc8e6ab98091a0f
-0, 27000, 115200, c0044160a944dcac81efe9f63def4bc2
-0, 30000, 115200, 9ba8b2ccbea045b39bd150ea383abc00
-0, 33000, 115200, 8d7654804fc62f7d52d5bf3d47f536e9
-0, 36000, 115200, 9fd6cd81fbe6cfc43e03cdf166c7ea93
-0, 39000, 115200, a1a494064dba27238005227c0808c5f6
-0, 42000, 115200, b8dca72164ea72b3f257c97c3ad87416
-0, 45000, 115200, 90ae005c0f3ddb4318318805b8fc29cf
-0, 48000, 115200, 8183e7b60f18887a9530a7905db4b417
-0, 51000, 115200, 1650ad1fff9076141f59b660c562f0f2
-0, 54000, 115200, e9ee675cafd270c366ac9d3ced5af879
-0, 57000, 115200, 2257172d6e8628b4dd4d9bf97e9ee2c3
-0, 60000, 115200, 577438f88feca7a876381a6fcf094684
-0, 63000, 115200, 4b37e90eb35cba66d31616169020c039
-0, 66000, 115200, 2c631ab87b8d3b7df13f888e3d6f1690
-0, 69000, 115200, e0d46e04d6a57b20c2b056cd0a0ca1ec
-0, 72000, 115200, 65bd3e207b8ed966b71f40a04f1900b8
-0, 75000, 115200, fd842606a20fb297463b7b3dd6efa2c2
-0, 78000, 115200, 778cd96eabe785320254db7692583f47
-0, 81000, 115200, 094272ad385a64fbc70a62f958e27eff
-0, 84000, 115200, cf5f7b3b94a00938b633ea1d9aa8e8dc
-0, 87000, 115200, 032e2f3649484ca17c739cf89052de77
-0, 90000, 115200, 9afe92189c21675745609e3b21a75941
-0, 93000, 115200, a5e087c496798bfbc64d6c26eee0b3af
-0, 96000, 115200, efb2716347ba2e01f7dc103d2a6cebb4
-0, 99000, 115200, c83541678dcca8937e372102bc4d1f68
-0, 102000, 115200, 3401ed97a9296610c8473dcf03e13f20
-0, 105000, 115200, 35af1327fafe026b6539951a9baee282
-0, 108000, 115200, f320e2d64192849c08c4c5e6d79e4ecf
-0, 111000, 115200, 5a661af83f451d8651cf081399d451b2
-0, 114000, 115200, 625d271b60d91229699f1de35d232b13
-0, 117000, 115200, 8e504154fa8eba5f9807bf40c647eea8
-0, 120000, 115200, 094ecb39a65c71e85d15a587472bb336
-0, 123000, 115200, 4d08bfe5771f00e13646be49e3471c4c
-0, 126000, 115200, 20841206e07721fb631088d492622543
-0, 129000, 115200, edf969142e1b053f951c1a5756f2b5d9
-0, 132000, 115200, 4959a13f20311d9b435e501fd753c94b
-0, 135000, 115200, a7f34e6c985d630af07a9f6dc47ea50e
-0, 138000, 115200, 96f6667d849f3abe4e85e3ce368b76ee
-0, 141000, 115200, a47d443c8aa5f2d2e3b44deab3f4f8e7
-0, 144000, 115200, 4ebda78d96facc4472ecdb4f667be0c6
-0, 147000, 115200, 6ba744c47edab85c6e77584e35e1b735
-0, 150000, 115200, 4d2e6882f15356171e4383111ec70e6e
-0, 153000, 115200, 85077fc81dff947b1251bfbd981aaf52
-0, 156000, 115200, f03e8879a5218387c502eaab31682df9
-0, 159000, 115200, 90f6128298cb52f769d697f9f842df27
-0, 162000, 115200, 700a705680c1a940141bc03ae5de391b
-0, 165000, 115200, 049b3df3ed9673ab8e0f0d0d896f65c2
-0, 168000, 115200, ca8c3e5509211dc92078371f06dc8635
+#tb 0: 1/30
+0, 0, 0, 1, 115200, 3441ec1a9b9d325c9aeda44e3b68377d
+0, 1, 1, 1, 115200, bff86a84fd673394f45c09d19a1ee0ac
+0, 2, 2, 1, 115200, 8cd920f0de408e8cd883f9241680ff80
+0, 3, 3, 1, 115200, d1b27cbb40859bbbb6da40dce6ddbf1b
+0, 4, 4, 1, 115200, ca102ed86e45fe452f55a2cf0253de21
+0, 5, 5, 1, 115200, ac7630be64017becd6e958df360263b5
+0, 6, 6, 1, 115200, a044041ede746687d33ba6342d8d3edb
+0, 7, 7, 1, 115200, 75d7c0eec357afd0c2d54e769f551b20
+0, 8, 8, 1, 115200, eebd916e4fba53a66fc8e6ab98091a0f
+0, 9, 9, 1, 115200, c0044160a944dcac81efe9f63def4bc2
+0, 10, 10, 1, 115200, 9ba8b2ccbea045b39bd150ea383abc00
+0, 11, 11, 1, 115200, 8d7654804fc62f7d52d5bf3d47f536e9
+0, 12, 12, 1, 115200, 9fd6cd81fbe6cfc43e03cdf166c7ea93
+0, 13, 13, 1, 115200, a1a494064dba27238005227c0808c5f6
+0, 14, 14, 1, 115200, b8dca72164ea72b3f257c97c3ad87416
+0, 15, 15, 1, 115200, 90ae005c0f3ddb4318318805b8fc29cf
+0, 16, 16, 1, 115200, 8183e7b60f18887a9530a7905db4b417
+0, 17, 17, 1, 115200, 1650ad1fff9076141f59b660c562f0f2
+0, 18, 18, 1, 115200, e9ee675cafd270c366ac9d3ced5af879
+0, 19, 19, 1, 115200, 2257172d6e8628b4dd4d9bf97e9ee2c3
+0, 20, 20, 1, 115200, 577438f88feca7a876381a6fcf094684
+0, 21, 21, 1, 115200, 4b37e90eb35cba66d31616169020c039
+0, 22, 22, 1, 115200, 2c631ab87b8d3b7df13f888e3d6f1690
+0, 23, 23, 1, 115200, e0d46e04d6a57b20c2b056cd0a0ca1ec
+0, 24, 24, 1, 115200, 65bd3e207b8ed966b71f40a04f1900b8
+0, 25, 25, 1, 115200, fd842606a20fb297463b7b3dd6efa2c2
+0, 26, 26, 1, 115200, 778cd96eabe785320254db7692583f47
+0, 27, 27, 1, 115200, 094272ad385a64fbc70a62f958e27eff
+0, 28, 28, 1, 115200, cf5f7b3b94a00938b633ea1d9aa8e8dc
+0, 29, 29, 1, 115200, 032e2f3649484ca17c739cf89052de77
+0, 30, 30, 1, 115200, 9afe92189c21675745609e3b21a75941
+0, 31, 31, 1, 115200, a5e087c496798bfbc64d6c26eee0b3af
+0, 32, 32, 1, 115200, efb2716347ba2e01f7dc103d2a6cebb4
+0, 33, 33, 1, 115200, c83541678dcca8937e372102bc4d1f68
+0, 34, 34, 1, 115200, 3401ed97a9296610c8473dcf03e13f20
+0, 35, 35, 1, 115200, 35af1327fafe026b6539951a9baee282
+0, 36, 36, 1, 115200, f320e2d64192849c08c4c5e6d79e4ecf
+0, 37, 37, 1, 115200, 5a661af83f451d8651cf081399d451b2
+0, 38, 38, 1, 115200, 625d271b60d91229699f1de35d232b13
+0, 39, 39, 1, 115200, 8e504154fa8eba5f9807bf40c647eea8
+0, 40, 40, 1, 115200, 094ecb39a65c71e85d15a587472bb336
+0, 41, 41, 1, 115200, 4d08bfe5771f00e13646be49e3471c4c
+0, 42, 42, 1, 115200, 20841206e07721fb631088d492622543
+0, 43, 43, 1, 115200, edf969142e1b053f951c1a5756f2b5d9
+0, 44, 44, 1, 115200, 4959a13f20311d9b435e501fd753c94b
+0, 45, 45, 1, 115200, a7f34e6c985d630af07a9f6dc47ea50e
+0, 46, 46, 1, 115200, 96f6667d849f3abe4e85e3ce368b76ee
+0, 47, 47, 1, 115200, a47d443c8aa5f2d2e3b44deab3f4f8e7
+0, 48, 48, 1, 115200, 4ebda78d96facc4472ecdb4f667be0c6
+0, 49, 49, 1, 115200, 6ba744c47edab85c6e77584e35e1b735
+0, 50, 50, 1, 115200, 4d2e6882f15356171e4383111ec70e6e
+0, 51, 51, 1, 115200, 85077fc81dff947b1251bfbd981aaf52
+0, 52, 52, 1, 115200, f03e8879a5218387c502eaab31682df9
+0, 53, 53, 1, 115200, 90f6128298cb52f769d697f9f842df27
+0, 54, 54, 1, 115200, 700a705680c1a940141bc03ae5de391b
+0, 55, 55, 1, 115200, 049b3df3ed9673ab8e0f0d0d896f65c2
+0, 56, 56, 1, 115200, ca8c3e5509211dc92078371f06dc8635
diff --git a/gst-libs/ext/libav/tests/ref/fate/vp8-test-vector-011 b/gst-libs/ext/libav/tests/ref/fate/vp8-test-vector-011
index 99409cd..d591ec7 100644
--- a/gst-libs/ext/libav/tests/ref/fate/vp8-test-vector-011
+++ b/gst-libs/ext/libav/tests/ref/fate/vp8-test-vector-011
@@ -1,29 +1,30 @@
-0, 0, 38016, 83c78b5db579710f61f9354d5c51e8c8
-0, 3000, 38016, 9b755a63c7c5352660a265f6e24991e1
-0, 6000, 38016, a591f0b04447d6d6dd9bb990502594aa
-0, 9000, 38016, 6ebbd38d20a4104a842c66df53a8b86e
-0, 12000, 38016, a114c37e74a4252ed66c5c4e7c8df84b
-0, 15000, 38016, 4bad182348dcfb627b3e15bc228a3c8f
-0, 18000, 38016, a843b5c80266f890044a4ba1f59de8ed
-0, 21000, 38016, 34816d9129f252afcbd56d6ad1df94c7
-0, 24000, 38016, 7d7d46cd08e18aea6fc52c0ec58a4803
-0, 27000, 38016, c96c3357d89534fce32251a0d52c68c5
-0, 30000, 38016, 5eb1329f955ab80696d8220605a51552
-0, 33000, 38016, 68b3d5162cd5b004a6dfeac705c75afa
-0, 36000, 38016, b79647c678fbbb9ffbd8c4ff63c05e43
-0, 39000, 38016, 4566eb5f995852d72b6913d2ca2e321c
-0, 42000, 38016, 02e7e951ac9e42eafb1260defaecf685
-0, 45000, 38016, ddbfa0f81a009c41271c9aa587e88baa
-0, 48000, 38016, 27d31dba74cb2170c456830a9f888c0b
-0, 51000, 38016, 0537650a41bb087a5fd33d6347fe9036
-0, 54000, 38016, df2205297d4f00164a3440c8fa1ac4ee
-0, 57000, 38016, 9942b757bd3839c1cd6b1068c68967f2
-0, 60000, 38016, d9284e1e989cd38d0226b1a3c6e89409
-0, 63000, 38016, 12427a3fdc22461fe9d6ff9dd5863bef
-0, 66000, 38016, 63f75f2a63630347671c0e6dd2f88bcb
-0, 69000, 38016, b161169a678e3959b492d83a03d47dee
-0, 72000, 38016, 50a6d4c8722197f0abd1028b968dce58
-0, 75000, 38016, c0f81ef6b25034cff00db1e3c369be97
-0, 78000, 38016, 01b502a4b69d5be7a82f292e735aa087
-0, 81000, 38016, 6bbff03307f93a654e4529e2a5092887
-0, 84000, 38016, 17ef5fd4bd1cc6030e1370a43f1d19bf
+#tb 0: 1/30
+0, 0, 0, 1, 38016, 83c78b5db579710f61f9354d5c51e8c8
+0, 1, 1, 1, 38016, 9b755a63c7c5352660a265f6e24991e1
+0, 2, 2, 1, 38016, a591f0b04447d6d6dd9bb990502594aa
+0, 3, 3, 1, 38016, 6ebbd38d20a4104a842c66df53a8b86e
+0, 4, 4, 1, 38016, a114c37e74a4252ed66c5c4e7c8df84b
+0, 5, 5, 1, 38016, 4bad182348dcfb627b3e15bc228a3c8f
+0, 6, 6, 1, 38016, a843b5c80266f890044a4ba1f59de8ed
+0, 7, 7, 1, 38016, 34816d9129f252afcbd56d6ad1df94c7
+0, 8, 8, 1, 38016, 7d7d46cd08e18aea6fc52c0ec58a4803
+0, 9, 9, 1, 38016, c96c3357d89534fce32251a0d52c68c5
+0, 10, 10, 1, 38016, 5eb1329f955ab80696d8220605a51552
+0, 11, 11, 1, 38016, 68b3d5162cd5b004a6dfeac705c75afa
+0, 12, 12, 1, 38016, b79647c678fbbb9ffbd8c4ff63c05e43
+0, 13, 13, 1, 38016, 4566eb5f995852d72b6913d2ca2e321c
+0, 14, 14, 1, 38016, 02e7e951ac9e42eafb1260defaecf685
+0, 15, 15, 1, 38016, ddbfa0f81a009c41271c9aa587e88baa
+0, 16, 16, 1, 38016, 27d31dba74cb2170c456830a9f888c0b
+0, 17, 17, 1, 38016, 0537650a41bb087a5fd33d6347fe9036
+0, 18, 18, 1, 38016, df2205297d4f00164a3440c8fa1ac4ee
+0, 19, 19, 1, 38016, 9942b757bd3839c1cd6b1068c68967f2
+0, 20, 20, 1, 38016, d9284e1e989cd38d0226b1a3c6e89409
+0, 21, 21, 1, 38016, 12427a3fdc22461fe9d6ff9dd5863bef
+0, 22, 22, 1, 38016, 63f75f2a63630347671c0e6dd2f88bcb
+0, 23, 23, 1, 38016, b161169a678e3959b492d83a03d47dee
+0, 24, 24, 1, 38016, 50a6d4c8722197f0abd1028b968dce58
+0, 25, 25, 1, 38016, c0f81ef6b25034cff00db1e3c369be97
+0, 26, 26, 1, 38016, 01b502a4b69d5be7a82f292e735aa087
+0, 27, 27, 1, 38016, 6bbff03307f93a654e4529e2a5092887
+0, 28, 28, 1, 38016, 17ef5fd4bd1cc6030e1370a43f1d19bf
diff --git a/gst-libs/ext/libav/tests/ref/fate/vp8-test-vector-012 b/gst-libs/ext/libav/tests/ref/fate/vp8-test-vector-012
index 5af0e4c..4d5adcb 100644
--- a/gst-libs/ext/libav/tests/ref/fate/vp8-test-vector-012
+++ b/gst-libs/ext/libav/tests/ref/fate/vp8-test-vector-012
@@ -1,29 +1,30 @@
-0, 0, 38016, cc3069a59b6f4319761af2b39923a6e5
-0, 3000, 38016, c0bc935941d994c6af6a864f02a90a62
-0, 6000, 38016, 5b6073ce4a03967aa87e56dfa27e32c2
-0, 9000, 38016, 5310a9d6bf938ed89b10727f11e131c4
-0, 12000, 38016, 290fb1310ea10b862b51d37ff9d79f7c
-0, 15000, 38016, 0ca1accba77dc867df682b8e3768d6e2
-0, 18000, 38016, 2a90659dd4cd5d2f825641be55609d97
-0, 21000, 38016, e003db31fbfeab54385252e8c64197fc
-0, 24000, 38016, 0778609bd9626652e8a8dd07d5ef9f45
-0, 27000, 38016, 36eecf49c4aa2d8c3f232a1dbbb5f4ca
-0, 30000, 38016, f69f30dd8ebb7db4c51e0371f6a23736
-0, 33000, 38016, e9d5293db5122b9683a0853c2ef678cb
-0, 36000, 38016, 75d6a09bca67a82c8aacabb710558330
-0, 39000, 38016, 973d73aa4bb4e3de2cb1ba97685e08ca
-0, 42000, 38016, daf9ce67baaaa02bc56f49b540f22a30
-0, 45000, 38016, d08fd3b942e1219132015819c553f2c2
-0, 48000, 38016, 0aeea73b030e47bbd80bb0fb33fb6ebd
-0, 51000, 38016, 6e9f5f98fffe27abfae52304c693ae44
-0, 54000, 38016, 961c71a47741a1ac47fcaebf958647c8
-0, 57000, 38016, e75e53160b9f33eca0dfba999d8002eb
-0, 60000, 38016, ebb5d79336f75c44a09971dbba6947f3
-0, 63000, 38016, f02317fae5e143103a114ca692b58c25
-0, 66000, 38016, 8282867aa63fa23c48cc0216e21933cc
-0, 69000, 38016, d0d74ebbf56ca62825641028b66cdb20
-0, 72000, 38016, a8df24b0a22fe4fb334ea7063cba8754
-0, 75000, 38016, 8a570e42ad6ab42ead80b5022c2eb2f1
-0, 78000, 38016, dae566f13fa69de11db3ba7673e6211d
-0, 81000, 38016, 914ed8403cdbf4c54d0b9cb1eeee6832
-0, 84000, 38016, 18aa8d4bfe06a04ec4e9ccf9c7a92643
+#tb 0: 1/30
+0, 0, 0, 1, 38016, cc3069a59b6f4319761af2b39923a6e5
+0, 1, 1, 1, 38016, c0bc935941d994c6af6a864f02a90a62
+0, 2, 2, 1, 38016, 5b6073ce4a03967aa87e56dfa27e32c2
+0, 3, 3, 1, 38016, 5310a9d6bf938ed89b10727f11e131c4
+0, 4, 4, 1, 38016, 290fb1310ea10b862b51d37ff9d79f7c
+0, 5, 5, 1, 38016, 0ca1accba77dc867df682b8e3768d6e2
+0, 6, 6, 1, 38016, 2a90659dd4cd5d2f825641be55609d97
+0, 7, 7, 1, 38016, e003db31fbfeab54385252e8c64197fc
+0, 8, 8, 1, 38016, 0778609bd9626652e8a8dd07d5ef9f45
+0, 9, 9, 1, 38016, 36eecf49c4aa2d8c3f232a1dbbb5f4ca
+0, 10, 10, 1, 38016, f69f30dd8ebb7db4c51e0371f6a23736
+0, 11, 11, 1, 38016, e9d5293db5122b9683a0853c2ef678cb
+0, 12, 12, 1, 38016, 75d6a09bca67a82c8aacabb710558330
+0, 13, 13, 1, 38016, 973d73aa4bb4e3de2cb1ba97685e08ca
+0, 14, 14, 1, 38016, daf9ce67baaaa02bc56f49b540f22a30
+0, 15, 15, 1, 38016, d08fd3b942e1219132015819c553f2c2
+0, 16, 16, 1, 38016, 0aeea73b030e47bbd80bb0fb33fb6ebd
+0, 17, 17, 1, 38016, 6e9f5f98fffe27abfae52304c693ae44
+0, 18, 18, 1, 38016, 961c71a47741a1ac47fcaebf958647c8
+0, 19, 19, 1, 38016, e75e53160b9f33eca0dfba999d8002eb
+0, 20, 20, 1, 38016, ebb5d79336f75c44a09971dbba6947f3
+0, 21, 21, 1, 38016, f02317fae5e143103a114ca692b58c25
+0, 22, 22, 1, 38016, 8282867aa63fa23c48cc0216e21933cc
+0, 23, 23, 1, 38016, d0d74ebbf56ca62825641028b66cdb20
+0, 24, 24, 1, 38016, a8df24b0a22fe4fb334ea7063cba8754
+0, 25, 25, 1, 38016, 8a570e42ad6ab42ead80b5022c2eb2f1
+0, 26, 26, 1, 38016, dae566f13fa69de11db3ba7673e6211d
+0, 27, 27, 1, 38016, 914ed8403cdbf4c54d0b9cb1eeee6832
+0, 28, 28, 1, 38016, 18aa8d4bfe06a04ec4e9ccf9c7a92643
diff --git a/gst-libs/ext/libav/tests/ref/fate/vp8-test-vector-013 b/gst-libs/ext/libav/tests/ref/fate/vp8-test-vector-013
index fbb1117..de7c0b3 100644
--- a/gst-libs/ext/libav/tests/ref/fate/vp8-test-vector-013
+++ b/gst-libs/ext/libav/tests/ref/fate/vp8-test-vector-013
@@ -1,29 +1,30 @@
-0, 0, 38016, ad137b9eae93daed28fe31fd5165b4d0
-0, 3000, 38016, 7cd527f647680c0eb305050d27fb8092
-0, 6000, 38016, f306e07a2e86c82a8cc1333be3812326
-0, 9000, 38016, 4ffd6065ef6af716fdb7388479cf300e
-0, 12000, 38016, e776c698ae335107d5794c02cf00d3ee
-0, 15000, 38016, c0043e3283b96a4aa58d2265b007e67e
-0, 18000, 38016, 235dd358e6adb3e144d7d957458e74a0
-0, 21000, 38016, 4d34b966a406e7c2d5cef029ddc76021
-0, 24000, 38016, 65f9eb823a63e17710b111892c415b70
-0, 27000, 38016, 84d4a1d510d1c1aa8f3e7232d574ba9d
-0, 30000, 38016, f3218df364f0e283df56b5d4a9cdfca9
-0, 33000, 38016, 3079d93a140b51fe3e7b4889fd5fdd24
-0, 36000, 38016, 4b76d7f904960792b78378c95453b77a
-0, 39000, 38016, 26cdd39f9cd862b383352bf769d212a0
-0, 42000, 38016, d98dbe7d7b8a5ccc50cb3a2e3dcacec8
-0, 45000, 38016, a931f142064062d7d2d1245278c6edd9
-0, 48000, 38016, 0c6dae06c59c040801be386d7e883f52
-0, 51000, 38016, cec4a68182fb14185360f57de81e73cb
-0, 54000, 38016, 7e819d1d928f974f25d45023a89a6765
-0, 57000, 38016, 6d9a9fd28212940497f881ef4886d756
-0, 60000, 38016, f22969fc06edc0c9190cae8bb22243ae
-0, 63000, 38016, 2fcd676dbf66f842e91649a3d6c80f50
-0, 66000, 38016, ce16e8920e91ec208dfb241addfc612b
-0, 69000, 38016, 3a205f364751ff5e72d7da20e5713f53
-0, 72000, 38016, 2305bcde500197d7697eec4ba89f1533
-0, 75000, 38016, 23712ae207ea2381f886ed038ec3852b
-0, 78000, 38016, 7197e717541573be07f9cda50ba524a9
-0, 81000, 38016, 3f3e3ec6d1d6f49021affbadb75c1fda
-0, 84000, 38016, 424fe8391a419b005a6f142ec65d802b
+#tb 0: 1/30
+0, 0, 0, 1, 38016, ad137b9eae93daed28fe31fd5165b4d0
+0, 1, 1, 1, 38016, 7cd527f647680c0eb305050d27fb8092
+0, 2, 2, 1, 38016, f306e07a2e86c82a8cc1333be3812326
+0, 3, 3, 1, 38016, 4ffd6065ef6af716fdb7388479cf300e
+0, 4, 4, 1, 38016, e776c698ae335107d5794c02cf00d3ee
+0, 5, 5, 1, 38016, c0043e3283b96a4aa58d2265b007e67e
+0, 6, 6, 1, 38016, 235dd358e6adb3e144d7d957458e74a0
+0, 7, 7, 1, 38016, 4d34b966a406e7c2d5cef029ddc76021
+0, 8, 8, 1, 38016, 65f9eb823a63e17710b111892c415b70
+0, 9, 9, 1, 38016, 84d4a1d510d1c1aa8f3e7232d574ba9d
+0, 10, 10, 1, 38016, f3218df364f0e283df56b5d4a9cdfca9
+0, 11, 11, 1, 38016, 3079d93a140b51fe3e7b4889fd5fdd24
+0, 12, 12, 1, 38016, 4b76d7f904960792b78378c95453b77a
+0, 13, 13, 1, 38016, 26cdd39f9cd862b383352bf769d212a0
+0, 14, 14, 1, 38016, d98dbe7d7b8a5ccc50cb3a2e3dcacec8
+0, 15, 15, 1, 38016, a931f142064062d7d2d1245278c6edd9
+0, 16, 16, 1, 38016, 0c6dae06c59c040801be386d7e883f52
+0, 17, 17, 1, 38016, cec4a68182fb14185360f57de81e73cb
+0, 18, 18, 1, 38016, 7e819d1d928f974f25d45023a89a6765
+0, 19, 19, 1, 38016, 6d9a9fd28212940497f881ef4886d756
+0, 20, 20, 1, 38016, f22969fc06edc0c9190cae8bb22243ae
+0, 21, 21, 1, 38016, 2fcd676dbf66f842e91649a3d6c80f50
+0, 22, 22, 1, 38016, ce16e8920e91ec208dfb241addfc612b
+0, 23, 23, 1, 38016, 3a205f364751ff5e72d7da20e5713f53
+0, 24, 24, 1, 38016, 2305bcde500197d7697eec4ba89f1533
+0, 25, 25, 1, 38016, 23712ae207ea2381f886ed038ec3852b
+0, 26, 26, 1, 38016, 7197e717541573be07f9cda50ba524a9
+0, 27, 27, 1, 38016, 3f3e3ec6d1d6f49021affbadb75c1fda
+0, 28, 28, 1, 38016, 424fe8391a419b005a6f142ec65d802b
diff --git a/gst-libs/ext/libav/tests/ref/fate/vp8-test-vector-014 b/gst-libs/ext/libav/tests/ref/fate/vp8-test-vector-014
index 5ce3cef..4341e59 100644
--- a/gst-libs/ext/libav/tests/ref/fate/vp8-test-vector-014
+++ b/gst-libs/ext/libav/tests/ref/fate/vp8-test-vector-014
@@ -1,49 +1,50 @@
-0, 0, 37697, 7a0356dc950e79744d79c98e391ebee9
-0, 3000, 37697, 96e221e75c290dd847b8e55865073366
-0, 6000, 37697, 67638290841837c90f180a01094f9191
-0, 9000, 37697, 93c8e234e123f7a641c5eb44903b75ab
-0, 12000, 37697, b4fa5ce6089221863002019d99ae7f9d
-0, 15000, 37697, 5d3b48fbb681ef2b6a0a5e60c03ee5bd
-0, 18000, 37697, 26635956a9ed343428b36947723b4b94
-0, 21000, 37697, 18e9b11e10350ab20b89482c5d1c5cea
-0, 24000, 37697, 44fe40a7ce85552ccf95a451c5732e57
-0, 27000, 37697, f38758bf6d522023961d08719e92d3ce
-0, 30000, 37697, 28a2a9ebb3633a0822c9a283ab1ddea6
-0, 33000, 37697, 4b4485c9419710ad6d3e6aa11fe3a91b
-0, 36000, 37697, e3f6850a934c6e3e2fed3026e1e53066
-0, 39000, 37697, 4acff1abe788a4944474b82d10af172d
-0, 42000, 37697, 4cbfcc008923e8303df170d4e7b1cf34
-0, 45000, 37697, dde5de0c676f60b4cea26bbf024bbfb7
-0, 48000, 37697, fe1b0890eef18cd4989d251dbc3b7ef2
-0, 51000, 37697, 462303741de9904a13bd46534010f588
-0, 54000, 37697, 7ab2068505dbccdf522a08a65373b6b6
-0, 57000, 37697, cb63092b6880bbdbaa40b40d738aa4dd
-0, 60000, 37697, dca7556869370de600afbda82bb45fae
-0, 63000, 37697, 5f5cae9db9e3aa3f300706ebc3874987
-0, 66000, 37697, eaf7ba4f48eb5722c09420f2be4bc5f3
-0, 69000, 37697, dd5b43b72c8b9c3ad53afef0f8869a68
-0, 72000, 37697, f5d81cadb4b1f69e9700293e38ea36a2
-0, 75000, 37697, 1e56a6becf3099db71fbc7a996c4fbba
-0, 78000, 37697, 7e0676c4af74b59d9560d8b42d400de2
-0, 81000, 37697, 6717c3c344b45e9e202e808d19c9baa8
-0, 84000, 37697, 42b92f6fbd4cc5d4cf4f9b364a8a7741
-0, 87000, 37697, 6caca9fcc03e8b9d326aec18eaaae928
-0, 90000, 37697, cfa2798d156cabe81160c00939102d90
-0, 93000, 37697, 5d018cfac7da660819da2e5d25e8126e
-0, 96000, 37697, 761b7b2b64b22abadb89c58ab294520b
-0, 99000, 37697, 4e066fa627d4dbf3635148eb6b2a0477
-0, 102000, 37697, e0d6dd242cb99c7bc9826a05895344c5
-0, 105000, 37697, 84e7beedcba6da53feb722f30211d2f8
-0, 108000, 37697, af49b3fcc56b02ca746792b1d3bbe1c8
-0, 111000, 37697, cdd9f17b4501bc7f7bedb70f2e33f282
-0, 114000, 37697, 69d853dfd9b09d299faec521acb4e765
-0, 117000, 37697, c3497292359c1a1de81cd5fb062e5175
-0, 120000, 37697, 0e3994e4a62d8c922dbde51186615ea7
-0, 123000, 37697, 86bc5561c72bd17e7473f54f6b6311f1
-0, 126000, 37697, 0c747481e3dc575c6aad4507f8e62d8e
-0, 129000, 37697, 6779dfe5b6a7d4ba5ae5355058f54bc9
-0, 132000, 37697, d7d4e85f48d38c1106a031bd9b57d909
-0, 135000, 37697, a0ab20a38891925fd77ac2b075f0046f
-0, 138000, 37697, 88655045ce8c5cb4c4aa3a5071f1beba
-0, 141000, 37697, 7e849d493185a8f782b53a71151bae26
-0, 144000, 37697, a5b9a0cbfac73d2227118c0718cf9d14
+#tb 0: 1/30
+0, 0, 0, 1, 37697, 7a0356dc950e79744d79c98e391ebee9
+0, 1, 1, 1, 37697, 96e221e75c290dd847b8e55865073366
+0, 2, 2, 1, 37697, 67638290841837c90f180a01094f9191
+0, 3, 3, 1, 37697, 93c8e234e123f7a641c5eb44903b75ab
+0, 4, 4, 1, 37697, b4fa5ce6089221863002019d99ae7f9d
+0, 5, 5, 1, 37697, 5d3b48fbb681ef2b6a0a5e60c03ee5bd
+0, 6, 6, 1, 37697, 26635956a9ed343428b36947723b4b94
+0, 7, 7, 1, 37697, 18e9b11e10350ab20b89482c5d1c5cea
+0, 8, 8, 1, 37697, 44fe40a7ce85552ccf95a451c5732e57
+0, 9, 9, 1, 37697, f38758bf6d522023961d08719e92d3ce
+0, 10, 10, 1, 37697, 28a2a9ebb3633a0822c9a283ab1ddea6
+0, 11, 11, 1, 37697, 4b4485c9419710ad6d3e6aa11fe3a91b
+0, 12, 12, 1, 37697, e3f6850a934c6e3e2fed3026e1e53066
+0, 13, 13, 1, 37697, 4acff1abe788a4944474b82d10af172d
+0, 14, 14, 1, 37697, 4cbfcc008923e8303df170d4e7b1cf34
+0, 15, 15, 1, 37697, dde5de0c676f60b4cea26bbf024bbfb7
+0, 16, 16, 1, 37697, fe1b0890eef18cd4989d251dbc3b7ef2
+0, 17, 17, 1, 37697, 462303741de9904a13bd46534010f588
+0, 18, 18, 1, 37697, 7ab2068505dbccdf522a08a65373b6b6
+0, 19, 19, 1, 37697, cb63092b6880bbdbaa40b40d738aa4dd
+0, 20, 20, 1, 37697, dca7556869370de600afbda82bb45fae
+0, 21, 21, 1, 37697, 5f5cae9db9e3aa3f300706ebc3874987
+0, 22, 22, 1, 37697, eaf7ba4f48eb5722c09420f2be4bc5f3
+0, 23, 23, 1, 37697, dd5b43b72c8b9c3ad53afef0f8869a68
+0, 24, 24, 1, 37697, f5d81cadb4b1f69e9700293e38ea36a2
+0, 25, 25, 1, 37697, 1e56a6becf3099db71fbc7a996c4fbba
+0, 26, 26, 1, 37697, 7e0676c4af74b59d9560d8b42d400de2
+0, 27, 27, 1, 37697, 6717c3c344b45e9e202e808d19c9baa8
+0, 28, 28, 1, 37697, 42b92f6fbd4cc5d4cf4f9b364a8a7741
+0, 29, 29, 1, 37697, 6caca9fcc03e8b9d326aec18eaaae928
+0, 30, 30, 1, 37697, cfa2798d156cabe81160c00939102d90
+0, 31, 31, 1, 37697, 5d018cfac7da660819da2e5d25e8126e
+0, 32, 32, 1, 37697, 761b7b2b64b22abadb89c58ab294520b
+0, 33, 33, 1, 37697, 4e066fa627d4dbf3635148eb6b2a0477
+0, 34, 34, 1, 37697, e0d6dd242cb99c7bc9826a05895344c5
+0, 35, 35, 1, 37697, 84e7beedcba6da53feb722f30211d2f8
+0, 36, 36, 1, 37697, af49b3fcc56b02ca746792b1d3bbe1c8
+0, 37, 37, 1, 37697, cdd9f17b4501bc7f7bedb70f2e33f282
+0, 38, 38, 1, 37697, 69d853dfd9b09d299faec521acb4e765
+0, 39, 39, 1, 37697, c3497292359c1a1de81cd5fb062e5175
+0, 40, 40, 1, 37697, 0e3994e4a62d8c922dbde51186615ea7
+0, 41, 41, 1, 37697, 86bc5561c72bd17e7473f54f6b6311f1
+0, 42, 42, 1, 37697, 0c747481e3dc575c6aad4507f8e62d8e
+0, 43, 43, 1, 37697, 6779dfe5b6a7d4ba5ae5355058f54bc9
+0, 44, 44, 1, 37697, d7d4e85f48d38c1106a031bd9b57d909
+0, 45, 45, 1, 37697, a0ab20a38891925fd77ac2b075f0046f
+0, 46, 46, 1, 37697, 88655045ce8c5cb4c4aa3a5071f1beba
+0, 47, 47, 1, 37697, 7e849d493185a8f782b53a71151bae26
+0, 48, 48, 1, 37697, a5b9a0cbfac73d2227118c0718cf9d14
diff --git a/gst-libs/ext/libav/tests/ref/fate/vp8-test-vector-015 b/gst-libs/ext/libav/tests/ref/fate/vp8-test-vector-015
index 7e97342..b32f233 100644
--- a/gst-libs/ext/libav/tests/ref/fate/vp8-test-vector-015
+++ b/gst-libs/ext/libav/tests/ref/fate/vp8-test-vector-015
@@ -1,260 +1,261 @@
-0, 0, 115200, 6b4c7cc0c6a7218362e43cffef6618c9
-0, 3000, 115200, e132a7b1bb4fb15b1019092aedc0e599
-0, 6000, 115200, b36975db60f24088d95385ff7e8b7b8a
-0, 9000, 115200, 4ae6a13ae0435afb2eac66f15a07b143
-0, 12000, 115200, d1de33515e29053171c9fbe969a33fa1
-0, 15000, 115200, cf01450481865c10765995a3b92b440f
-0, 18000, 115200, 274461d33aeab30885b23bf2818ad150
-0, 21000, 115200, cb434c5a829b3d6d15a6e76f05abd51f
-0, 24000, 115200, 512019fa16b1cd6bf308c91d6577cf2a
-0, 27000, 115200, 2d1174741c144b2162806373d0092739
-0, 30000, 115200, 8ec38a17566342a35598bd5ab6d290d5
-0, 33000, 115200, 262b71c9874cc7a5138b12b294575572
-0, 36000, 115200, bfe5e37095dc450dc717fda5ef77b6fe
-0, 39000, 115200, 7fbcdb00872206a597bb69ebe9221b03
-0, 42000, 115200, b599ac8568b6780dec25de4211e071ef
-0, 45000, 115200, 797085b07f4c1e4f4b0116d329403cf8
-0, 48000, 115200, a0d0821365658bee14767698877cc066
-0, 51000, 115200, 286a917e787d474eb78b4797a0909a5e
-0, 54000, 115200, 3548a320f6954c40a00ddf2e4ee212bd
-0, 57000, 115200, 80af737ca733afa28fdae06421b3cf8d
-0, 60000, 115200, f31a2b62cb69bc680b314a033f91881b
-0, 63000, 115200, 02e4a780b3a0d83a8897988ef17b548c
-0, 66000, 115200, 844929e7492b389fc520c5f75d37aa77
-0, 69000, 115200, 558ac4c1c11da425baf832a73e1ac2da
-0, 72000, 115200, 41b21109a7aa5f163ac0967ecd11f792
-0, 75000, 115200, a2a050c04eaa97db43a5a0a96d20a143
-0, 78000, 115200, 18d1881d44ab9dc959c34d92c0cabd36
-0, 81000, 115200, 53618af318cd187b4fcd5a3c22d3ab79
-0, 84000, 115200, 8028e6a6a6dadc8331e39cff1ba2b899
-0, 87000, 115200, 2c32a58d68595ff4100cec4fc1637c55
-0, 90000, 115200, 8ecc02d32f36edd167cabe2a7bc66683
-0, 93000, 115200, 7caa9ce69ac9f71170a69fbcef4c4b34
-0, 96000, 115200, df06a6a8a81979c39f2c3546eb03a3c2
-0, 99000, 115200, 2bfd578fa08335e975d498e11eadc8bc
-0, 102000, 115200, 0d78c5656d56e423ff31cab09855a335
-0, 105000, 115200, 7152d9e35748a7ec2e8da37f0b943325
-0, 108000, 115200, eb9e0e5cba76f0819da6256136ffd4e3
-0, 111000, 115200, c4e5ef875132c06a80f0afb3ee894684
-0, 114000, 115200, d2feb49297dd2f0a532479341d607e64
-0, 117000, 115200, d092d165608f405161fbf73a19df26ca
-0, 120000, 115200, cb228940384c3021af42b0ab81c65d7a
-0, 123000, 115200, 426decfbf29a025a7a5e376951c34b83
-0, 126000, 115200, 42c25e24bfd048bde0f9105d934cb81e
-0, 129000, 115200, 4bf37f8ccb2c4f42fa64a52a4699883f
-0, 132000, 115200, 5a00d85407910d4170d11511f03cc3a7
-0, 135000, 115200, 032072b8713a2cd7434b5be706a8667d
-0, 138000, 115200, e729c561b318aa14d7dbf96299c4675d
-0, 141000, 115200, e7e1d71c1c59bb759c89f15c6e8970f0
-0, 144000, 115200, 9c04011f4d92257a6dc112c5acad0f59
-0, 147000, 115200, ca7c7cbf52dd7af9a62212f3a9bd1f74
-0, 150000, 115200, 3cc9c4d3857d692e0dbfee682d63d32c
-0, 153000, 115200, 1188fc9620cf0d23af21d8823c127b80
-0, 156000, 115200, c614690b8d4d3bea47f1b236ff32d1d8
-0, 159000, 115200, d6ccde3360e6a05b61013e85f96de9e9
-0, 162000, 115200, 7f11cacc42d14121aeab487975ec190b
-0, 165000, 115200, cdd8b538ff107f88c5f0dc7128bc331e
-0, 168000, 115200, f43a387e9bb2f4db387d3f44da16457b
-0, 171000, 115200, b7ba01b86fce2252105f99848e2ac95c
-0, 174000, 115200, 094200f775b6ced838d0c37e0d0b34e6
-0, 177000, 115200, b2d2fa96666b96b7cb624133cf404b09
-0, 180000, 115200, d935644161a2b06f0efc75dc6d0fcf46
-0, 183000, 115200, 2a3be6460f313d7fdd6f6f9c70092a50
-0, 186000, 115200, f8254b6469b807ce0e9a1ea4b98a59db
-0, 189000, 115200, 43639a3293ec640b203e0c8a97e6f45e
-0, 192000, 115200, 055762cccc279c8dd27450ec1d512d5f
-0, 195000, 115200, a90dac910f3cdd216293bebc46b36501
-0, 198000, 115200, 3531ef2a4a59271f89ca0972b65d06aa
-0, 201000, 115200, 1f87adde14795639105be714247d0bd0
-0, 204000, 115200, e991cdd7912266937ca6f0d59199645b
-0, 207000, 115200, 5b98019db0fca644da5ee73e0160c7c5
-0, 210000, 115200, 6276f3907e4bb87885d21e11150d044d
-0, 213000, 115200, 985785d7a788dcc07bd5fb72d3dc758e
-0, 216000, 115200, 3379548a573d068d47d5f54aaf79c8a9
-0, 219000, 115200, a2b36848e7d19383cfabf8bdcabd241a
-0, 222000, 115200, 0aeda76888a5a2426ae3b390e38aba52
-0, 225000, 115200, 2c652e7850ccc10cbc7a3266f1fb6c00
-0, 228000, 115200, 5dfc9e4dce69f1f644fad5b69c0b4008
-0, 231000, 115200, da775fc1469012a0c717ebe5dc940e26
-0, 234000, 115200, 6185a863f7d023ddb2b049e265aab1bb
-0, 237000, 115200, 7a56397397191ab1b7c93a4bdc9b57c1
-0, 240000, 115200, 3e95a3f2c2660dc28ec64efef29615f0
-0, 243000, 115200, b9ba03bd7c09224174368a60af389b9c
-0, 246000, 115200, bfd23a13e077843506a01e44adb27c04
-0, 249000, 115200, 9025dff58a57abcc25da69fd233e312a
-0, 252000, 115200, ba4b91b0fe4d36f77b62ec3fe7b10a96
-0, 255000, 115200, 7955419ff2bc42b703dfc976576a5bd4
-0, 258000, 115200, 36d6a723ebb35c45128bfa8a7bba0d49
-0, 261000, 115200, 77503cc79e3cb0fc74745bac967fee1d
-0, 264000, 115200, a05af40cb4fc009fe94be6dbf148b453
-0, 267000, 115200, 35bc39585679f7c07f1b196879719ce6
-0, 270000, 115200, 48831c2e2212134ab192a123e847c157
-0, 273000, 115200, c09c37f9fd929185452a8beb3c61b839
-0, 276000, 115200, c534a38d586f3cac998240a7013c636c
-0, 279000, 115200, b598c6999442cf0c53ed6a19d1215eb8
-0, 282000, 115200, c639685c8f4af3d006df1833950943aa
-0, 285000, 115200, 351e1c089ba5b9024de6e311c4a4afd3
-0, 288000, 115200, 67d8ea902179548d0b01544249b2411f
-0, 291000, 115200, 3717ddf0edbb2020a5b974678d358d25
-0, 294000, 115200, 85f7c6861241e3f43fc63c397c8c3c37
-0, 297000, 115200, c5b23b4d3d141d8cfbc5354ca1cfd34d
-0, 300000, 115200, c2e42fa6b11cdc3abcf3ee0c3f75a459
-0, 303000, 115200, 34df411aa928d5df3628644d9a38c768
-0, 306000, 115200, a768b448b6c894d9b927bc880249079a
-0, 309000, 115200, a2e9ad0d0ad733b8ccacf0379b05f6f9
-0, 312000, 115200, 4b485e9496ab4d417b8cffaf8754f5cb
-0, 315000, 115200, 47007fabfacd9e9c5a3997fb70d45895
-0, 318000, 115200, 4962433241c7509801b46bea70f38269
-0, 321000, 115200, 7b4593b45606650e78aec67722cfc2bf
-0, 324000, 115200, 882bcbf7d2c12e93df2fbebc6ac19dd8
-0, 327000, 115200, a2998a9c648817236bfffdae454f9fa1
-0, 330000, 115200, 56775760fa99e9a9b7293ddc78a44ece
-0, 333000, 115200, bb245d095424c28dd2ace22a5a511d6a
-0, 336000, 115200, 598c54d2b207190ed549dec7390a4190
-0, 339000, 115200, c73f16b2709527fce3d725ade5aab2fc
-0, 342000, 115200, 32dcad6eb17bee583884029fe18c07a7
-0, 345000, 115200, a1297c404a0d22e0e8e1e4ef67696606
-0, 348000, 115200, 2fef1ac7becf9b8c9f3ac2310f444e3b
-0, 351000, 115200, 0f03614ed3daec6c37c5b564ad24f595
-0, 354000, 115200, 9b175a6353ec377da408b0cf03388081
-0, 357000, 115200, 37b991b4a216a4847d0768a3b878284a
-0, 360000, 115200, faafcd544080a6a4f87a0d0a393ba37b
-0, 363000, 115200, 43ede087f37c1b0392829bbc668242fc
-0, 366000, 115200, b7ed1274016c4d1810d8999d495b7370
-0, 369000, 115200, 22af7bfc83c6e1f2eff2ae26e115b446
-0, 372000, 115200, 969b22455f3be057036ddd5a329b1de3
-0, 375000, 115200, 63c24b8a3d6c3a4c2fd47c48860abff9
-0, 378000, 115200, b407ddc89c538d7b6fb70e48493f872c
-0, 381000, 115200, 5de69fb9e1cd425cd3931116803f5391
-0, 384000, 115200, 07fc7a5cb360edae97db999c2a8d2716
-0, 387000, 115200, 602a17c58cac811e6e71e33448931ce5
-0, 390000, 115200, 44087725484198c8e846d112583e574b
-0, 393000, 115200, 0d81da0d23d196ff972894878bd17b73
-0, 396000, 115200, b3cd65f1bd2274895e54da99bb4c4f07
-0, 399000, 115200, ae8ca35672d8352af49f37f5174c8fbd
-0, 402000, 115200, 9eea1ff900cf680e8208cd5d07a4d284
-0, 405000, 115200, 5a47f272dfda3fe61955875f761a71f2
-0, 408000, 115200, 544558333008db01451c886ac0b62c47
-0, 411000, 115200, 5f8e4f3b11d7f5a28ff5cd9f3a6853bb
-0, 414000, 115200, e9bc3da7060457f2d52a5bf6fe3bb515
-0, 417000, 115200, 6aea6851a092260ae6594c6d9170ea8e
-0, 420000, 115200, 38e7fa5bea809a984a5f810940ca0e49
-0, 423000, 115200, 9e8a23ac9067a1acf8472d7aa3b9811e
-0, 426000, 115200, 6f25f5873afd5c341ca6b3eb284be809
-0, 429000, 115200, 40c3240e6cde94aae793a52cb46487da
-0, 432000, 115200, b7f1f13842fbf0c6e085280eb89b956f
-0, 435000, 115200, 1f059372d8bf4dadf78d8e215bbf9786
-0, 438000, 115200, 50c1d6b76930e765bff5ecbaaae686fe
-0, 441000, 115200, 5bd8cb05ebc034192e08ca8ce18a7964
-0, 444000, 115200, ffc0c20b07e26857dc4f2c079a2ad675
-0, 447000, 115200, 5dafb6ac0953c254182dba124e213c07
-0, 450000, 115200, c774ed25712a38603fe2e224802768cb
-0, 453000, 115200, de549cc803a6138d483be15b28ef2286
-0, 456000, 115200, c963d9bc79c1dd2a47f7f8424c56239e
-0, 459000, 115200, 9df993e0bef1bedbce1a6b596f2c64f4
-0, 462000, 115200, 875792bde0f45358009b506840be68e1
-0, 465000, 115200, 7f8c57083d2df08db6287cb025260788
-0, 468000, 115200, 47eb13bc0942b5cafeea324fc5bf5cd5
-0, 471000, 115200, d89129c7528ff7372f23d1191c75e336
-0, 474000, 115200, bdd14e38b00075d8da485d1517dbbd65
-0, 477000, 115200, 0e8e21a50a5dd1ac6fc881ad38ec38bd
-0, 480000, 115200, a0fce98c23a053b4073715c554b9dc44
-0, 483000, 115200, 18bda80360c72d04c60016682b1f6c8d
-0, 486000, 115200, 306d7556c18dcf58c8183959d1c34c2a
-0, 489000, 115200, 7ada9d23b96ef41322497d1077b00c4d
-0, 492000, 115200, d7df0508be4bd0c3e83f346f0b9a1868
-0, 495000, 115200, 749725f425f6fd4a79269bca900d09ae
-0, 498000, 115200, ed30973158a576e2919e2fcfd00987fc
-0, 501000, 115200, 2486d8b742ccc50cf8683af7f4502aec
-0, 504000, 115200, bdfb21e4236c904aeacd7b094fcffe98
-0, 507000, 115200, df2ef3e452731053ade82506c013164e
-0, 510000, 115200, 4695bfd9aa8e5667572f8f2142c6e538
-0, 513000, 115200, 649f5315cff1d28f0183144bf4d4eea4
-0, 516000, 115200, 450e987b9d6075d32e21d030bc385833
-0, 519000, 115200, 7aec79b25dabfcc2eb2f32e7dbff85f2
-0, 522000, 115200, c9c2a96239ad556a2ee496d7c4c965c1
-0, 525000, 115200, 3a038e48aa1238b62d431823653bc45a
-0, 528000, 115200, 6d5c8de6a281dbce68998b2c38063f33
-0, 531000, 115200, 045032f57d6a50ae148f4372f5083a62
-0, 534000, 115200, 5f39172951e083e712c3b1c528e61a4f
-0, 537000, 115200, 5a49eea76b6a86e305fb207fc1479264
-0, 540000, 115200, 33ca5fb5f3e4ff3a24235da71c5730d5
-0, 543000, 115200, 81f231d20426c5cbd02a85a425f5d0b8
-0, 546000, 115200, 302d94aa9a8d3828cf74c8b2b7e7fdd5
-0, 549000, 115200, c56f4f0c32b0f2c409b64ed10216a40a
-0, 552000, 115200, 9cf7f51e1527f11c38c395bac94849d9
-0, 555000, 115200, 0f17e427d14db658131eb0ccdc2a97ef
-0, 558000, 115200, 2624dd6b8e4e95770f132d90aa6f6119
-0, 561000, 115200, 9ddabfd5f803014443c2a0686869c546
-0, 564000, 115200, 0170cb86a377d791d7cbee2af0836db7
-0, 567000, 115200, f43a7c63bcafb51ead65e2831610612c
-0, 570000, 115200, e7000913b11bdeb74ba4eca110df8470
-0, 573000, 115200, a4208c5fcd101ceb5a976838ae9a811f
-0, 576000, 115200, 8ddcb546ac632c967e879fb5101afa24
-0, 579000, 115200, 547007771194373dd246586744130f7c
-0, 582000, 115200, 3608a46fee2731341ae9f71d3a80918a
-0, 585000, 115200, 758692e173552eb3439a572c953dda0f
-0, 588000, 115200, 481f456d6c6ac2e0325acba5eeabcd26
-0, 591000, 115200, c749a3ef8641d5ec4f25c611ffad1000
-0, 594000, 115200, 93f089f7f1e78b1a4185c0b0d99875fb
-0, 597000, 115200, 1159712bb4dbaed38d2a7558335f4037
-0, 600000, 115200, e8dab85a977f525d4d9b448e4278a34b
-0, 603000, 115200, 780055af1414e7693777a18428b20a07
-0, 606000, 115200, 59252515451fd96ca3f1194d5aadc3a7
-0, 609000, 115200, 0a977d6db761c149316417988657610a
-0, 612000, 115200, ed81d3a10369c12543f9bb6822a249b6
-0, 615000, 115200, 341e844231f6b55ee3c1eb22ca1bac8e
-0, 618000, 115200, d0a180c7d15e30a71e297fda0452c153
-0, 621000, 115200, 58d6f2522ecd8e5fea34cc9f10da2a88
-0, 624000, 115200, dc8f96811577f4fd3e6624abae42f449
-0, 627000, 115200, 3624a2e95f94a0a4413e464f4bf93dcd
-0, 630000, 115200, cb0deeb5f2d570ca23e3be3ab9231fe9
-0, 633000, 115200, 5080848626a52e30eb0f64f234ca3e57
-0, 636000, 115200, a31c9fe4255318d86e7855f01588220f
-0, 639000, 115200, 6c25fd8d1f0e898f6078decc4220d47d
-0, 642000, 115200, 77e52da08ab57ba5784ce42872cc01cb
-0, 645000, 115200, b4a87059745b3b862ef7431a9630f16a
-0, 648000, 115200, 1dadc814514ef00f11010df21d8a9494
-0, 651000, 115200, 5c816a0bbc8ed8fca166aa454093cb59
-0, 654000, 115200, 10320c174423d1712d9ce812701bcaf9
-0, 657000, 115200, 279c9398657af129e072165f41e0fb8c
-0, 660000, 115200, 49d88374bc4d965d3cee3274c7cd9906
-0, 663000, 115200, 48871e22f635f50569dea1bd5ca40d5c
-0, 666000, 115200, 3b8396580f8fbd99daca4df13662f1fc
-0, 669000, 115200, 569245e1bf3cb42aa95f765a8449980f
-0, 672000, 115200, c5cab497d244447df0ab832dcc9c5968
-0, 675000, 115200, 0a98ca4f1d771c4bc0286b825d085955
-0, 678000, 115200, e4a55f175c3933f02ccf74ccf2961da2
-0, 681000, 115200, 462dca7f377d708e753ef0bbde19a090
-0, 684000, 115200, 6f1680f498b0ed6f89a834b5700cc48a
-0, 687000, 115200, 996414e2e3a4bac5868ceeb25b84e6e4
-0, 690000, 115200, 6ecb4d4b857578d32f716c56dc7e6be9
-0, 693000, 115200, e05c8e33157e20c8e8f255e937d6b6cb
-0, 696000, 115200, 6542744da147d16533e41dad287a54fc
-0, 699000, 115200, bb4b6921d2855025fbcaff4c12299d02
-0, 702000, 115200, 6bc3e605759725012f7e44f1285b0899
-0, 705000, 115200, 0be37ecb7cec0cf8a0f9bbc3c590ba98
-0, 708000, 115200, 4f1103e5923ba8dea3e99c8b75eaed3c
-0, 711000, 115200, 220a8fb0409112c4f4ee769880717fea
-0, 714000, 115200, e4c612263cfbc0f41283fd1e88e2ff52
-0, 717000, 115200, ede2bc67ad87cd78191b742dd56419b5
-0, 720000, 115200, ded6a1d0690603aea233e4d624aa60a9
-0, 723000, 115200, 59c8b53e47ebdab696547a887163b272
-0, 726000, 115200, 985f8afbc6df2d64d601d2fdc93571d7
-0, 729000, 115200, e595f0aa7b6b62094f0ad84252105f55
-0, 732000, 115200, c2fe4382a1740bcfc2f4c3573c6c3176
-0, 735000, 115200, 880d8c906a8b39a61b68eb0ada857e5f
-0, 738000, 115200, 9a3ca55d2d75e3c41a86aea2ec87ff76
-0, 741000, 115200, f800751663dbefa61c33c3ebbd5430b4
-0, 744000, 115200, d904333c0c76235c8ffdfc81dffddb46
-0, 747000, 115200, 6a633a9a7686a9a02bd252ec8bcff4fc
-0, 750000, 115200, 930d06ecc252a911a60c2d9d4f2618e6
-0, 753000, 115200, bb146a4410c34bba74883d8ae478f47b
-0, 756000, 115200, be8ab9fc95685ebec64ff1f8129afa35
-0, 759000, 115200, d1f871ea3ceb38bf2b6d00ebfc38187a
-0, 762000, 115200, ba33366e050a5f5abbf8202e0afbb9e8
-0, 765000, 115200, f706356e12cf4082337bb8f7a5a10673
-0, 768000, 115200, 6e8200d3c1cccc0f810985ea2a2030f6
-0, 771000, 115200, caafdc1810556197df6f42336edcc07b
-0, 774000, 115200, 5321ff525f5bb5063443a3dc43fc42af
-0, 777000, 115200, c24bdd3b935f7ca6e9e105b1ae8504db
+#tb 0: 1/30
+0, 0, 0, 1, 115200, 6b4c7cc0c6a7218362e43cffef6618c9
+0, 1, 1, 1, 115200, e132a7b1bb4fb15b1019092aedc0e599
+0, 2, 2, 1, 115200, b36975db60f24088d95385ff7e8b7b8a
+0, 3, 3, 1, 115200, 4ae6a13ae0435afb2eac66f15a07b143
+0, 4, 4, 1, 115200, d1de33515e29053171c9fbe969a33fa1
+0, 5, 5, 1, 115200, cf01450481865c10765995a3b92b440f
+0, 6, 6, 1, 115200, 274461d33aeab30885b23bf2818ad150
+0, 7, 7, 1, 115200, cb434c5a829b3d6d15a6e76f05abd51f
+0, 8, 8, 1, 115200, 512019fa16b1cd6bf308c91d6577cf2a
+0, 9, 9, 1, 115200, 2d1174741c144b2162806373d0092739
+0, 10, 10, 1, 115200, 8ec38a17566342a35598bd5ab6d290d5
+0, 11, 11, 1, 115200, 262b71c9874cc7a5138b12b294575572
+0, 12, 12, 1, 115200, bfe5e37095dc450dc717fda5ef77b6fe
+0, 13, 13, 1, 115200, 7fbcdb00872206a597bb69ebe9221b03
+0, 14, 14, 1, 115200, b599ac8568b6780dec25de4211e071ef
+0, 15, 15, 1, 115200, 797085b07f4c1e4f4b0116d329403cf8
+0, 16, 16, 1, 115200, a0d0821365658bee14767698877cc066
+0, 17, 17, 1, 115200, 286a917e787d474eb78b4797a0909a5e
+0, 18, 18, 1, 115200, 3548a320f6954c40a00ddf2e4ee212bd
+0, 19, 19, 1, 115200, 80af737ca733afa28fdae06421b3cf8d
+0, 20, 20, 1, 115200, f31a2b62cb69bc680b314a033f91881b
+0, 21, 21, 1, 115200, 02e4a780b3a0d83a8897988ef17b548c
+0, 22, 22, 1, 115200, 844929e7492b389fc520c5f75d37aa77
+0, 23, 23, 1, 115200, 558ac4c1c11da425baf832a73e1ac2da
+0, 24, 24, 1, 115200, 41b21109a7aa5f163ac0967ecd11f792
+0, 25, 25, 1, 115200, a2a050c04eaa97db43a5a0a96d20a143
+0, 26, 26, 1, 115200, 18d1881d44ab9dc959c34d92c0cabd36
+0, 27, 27, 1, 115200, 53618af318cd187b4fcd5a3c22d3ab79
+0, 28, 28, 1, 115200, 8028e6a6a6dadc8331e39cff1ba2b899
+0, 29, 29, 1, 115200, 2c32a58d68595ff4100cec4fc1637c55
+0, 30, 30, 1, 115200, 8ecc02d32f36edd167cabe2a7bc66683
+0, 31, 31, 1, 115200, 7caa9ce69ac9f71170a69fbcef4c4b34
+0, 32, 32, 1, 115200, df06a6a8a81979c39f2c3546eb03a3c2
+0, 33, 33, 1, 115200, 2bfd578fa08335e975d498e11eadc8bc
+0, 34, 34, 1, 115200, 0d78c5656d56e423ff31cab09855a335
+0, 35, 35, 1, 115200, 7152d9e35748a7ec2e8da37f0b943325
+0, 36, 36, 1, 115200, eb9e0e5cba76f0819da6256136ffd4e3
+0, 37, 37, 1, 115200, c4e5ef875132c06a80f0afb3ee894684
+0, 38, 38, 1, 115200, d2feb49297dd2f0a532479341d607e64
+0, 39, 39, 1, 115200, d092d165608f405161fbf73a19df26ca
+0, 40, 40, 1, 115200, cb228940384c3021af42b0ab81c65d7a
+0, 41, 41, 1, 115200, 426decfbf29a025a7a5e376951c34b83
+0, 42, 42, 1, 115200, 42c25e24bfd048bde0f9105d934cb81e
+0, 43, 43, 1, 115200, 4bf37f8ccb2c4f42fa64a52a4699883f
+0, 44, 44, 1, 115200, 5a00d85407910d4170d11511f03cc3a7
+0, 45, 45, 1, 115200, 032072b8713a2cd7434b5be706a8667d
+0, 46, 46, 1, 115200, e729c561b318aa14d7dbf96299c4675d
+0, 47, 47, 1, 115200, e7e1d71c1c59bb759c89f15c6e8970f0
+0, 48, 48, 1, 115200, 9c04011f4d92257a6dc112c5acad0f59
+0, 49, 49, 1, 115200, ca7c7cbf52dd7af9a62212f3a9bd1f74
+0, 50, 50, 1, 115200, 3cc9c4d3857d692e0dbfee682d63d32c
+0, 51, 51, 1, 115200, 1188fc9620cf0d23af21d8823c127b80
+0, 52, 52, 1, 115200, c614690b8d4d3bea47f1b236ff32d1d8
+0, 53, 53, 1, 115200, d6ccde3360e6a05b61013e85f96de9e9
+0, 54, 54, 1, 115200, 7f11cacc42d14121aeab487975ec190b
+0, 55, 55, 1, 115200, cdd8b538ff107f88c5f0dc7128bc331e
+0, 56, 56, 1, 115200, f43a387e9bb2f4db387d3f44da16457b
+0, 57, 57, 1, 115200, b7ba01b86fce2252105f99848e2ac95c
+0, 58, 58, 1, 115200, 094200f775b6ced838d0c37e0d0b34e6
+0, 59, 59, 1, 115200, b2d2fa96666b96b7cb624133cf404b09
+0, 60, 60, 1, 115200, d935644161a2b06f0efc75dc6d0fcf46
+0, 61, 61, 1, 115200, 2a3be6460f313d7fdd6f6f9c70092a50
+0, 62, 62, 1, 115200, f8254b6469b807ce0e9a1ea4b98a59db
+0, 63, 63, 1, 115200, 43639a3293ec640b203e0c8a97e6f45e
+0, 64, 64, 1, 115200, 055762cccc279c8dd27450ec1d512d5f
+0, 65, 65, 1, 115200, a90dac910f3cdd216293bebc46b36501
+0, 66, 66, 1, 115200, 3531ef2a4a59271f89ca0972b65d06aa
+0, 67, 67, 1, 115200, 1f87adde14795639105be714247d0bd0
+0, 68, 68, 1, 115200, e991cdd7912266937ca6f0d59199645b
+0, 69, 69, 1, 115200, 5b98019db0fca644da5ee73e0160c7c5
+0, 70, 70, 1, 115200, 6276f3907e4bb87885d21e11150d044d
+0, 71, 71, 1, 115200, 985785d7a788dcc07bd5fb72d3dc758e
+0, 72, 72, 1, 115200, 3379548a573d068d47d5f54aaf79c8a9
+0, 73, 73, 1, 115200, a2b36848e7d19383cfabf8bdcabd241a
+0, 74, 74, 1, 115200, 0aeda76888a5a2426ae3b390e38aba52
+0, 75, 75, 1, 115200, 2c652e7850ccc10cbc7a3266f1fb6c00
+0, 76, 76, 1, 115200, 5dfc9e4dce69f1f644fad5b69c0b4008
+0, 77, 77, 1, 115200, da775fc1469012a0c717ebe5dc940e26
+0, 78, 78, 1, 115200, 6185a863f7d023ddb2b049e265aab1bb
+0, 79, 79, 1, 115200, 7a56397397191ab1b7c93a4bdc9b57c1
+0, 80, 80, 1, 115200, 3e95a3f2c2660dc28ec64efef29615f0
+0, 81, 81, 1, 115200, b9ba03bd7c09224174368a60af389b9c
+0, 82, 82, 1, 115200, bfd23a13e077843506a01e44adb27c04
+0, 83, 83, 1, 115200, 9025dff58a57abcc25da69fd233e312a
+0, 84, 84, 1, 115200, ba4b91b0fe4d36f77b62ec3fe7b10a96
+0, 85, 85, 1, 115200, 7955419ff2bc42b703dfc976576a5bd4
+0, 86, 86, 1, 115200, 36d6a723ebb35c45128bfa8a7bba0d49
+0, 87, 87, 1, 115200, 77503cc79e3cb0fc74745bac967fee1d
+0, 88, 88, 1, 115200, a05af40cb4fc009fe94be6dbf148b453
+0, 89, 89, 1, 115200, 35bc39585679f7c07f1b196879719ce6
+0, 90, 90, 1, 115200, 48831c2e2212134ab192a123e847c157
+0, 91, 91, 1, 115200, c09c37f9fd929185452a8beb3c61b839
+0, 92, 92, 1, 115200, c534a38d586f3cac998240a7013c636c
+0, 93, 93, 1, 115200, b598c6999442cf0c53ed6a19d1215eb8
+0, 94, 94, 1, 115200, c639685c8f4af3d006df1833950943aa
+0, 95, 95, 1, 115200, 351e1c089ba5b9024de6e311c4a4afd3
+0, 96, 96, 1, 115200, 67d8ea902179548d0b01544249b2411f
+0, 97, 97, 1, 115200, 3717ddf0edbb2020a5b974678d358d25
+0, 98, 98, 1, 115200, 85f7c6861241e3f43fc63c397c8c3c37
+0, 99, 99, 1, 115200, c5b23b4d3d141d8cfbc5354ca1cfd34d
+0, 100, 100, 1, 115200, c2e42fa6b11cdc3abcf3ee0c3f75a459
+0, 101, 101, 1, 115200, 34df411aa928d5df3628644d9a38c768
+0, 102, 102, 1, 115200, a768b448b6c894d9b927bc880249079a
+0, 103, 103, 1, 115200, a2e9ad0d0ad733b8ccacf0379b05f6f9
+0, 104, 104, 1, 115200, 4b485e9496ab4d417b8cffaf8754f5cb
+0, 105, 105, 1, 115200, 47007fabfacd9e9c5a3997fb70d45895
+0, 106, 106, 1, 115200, 4962433241c7509801b46bea70f38269
+0, 107, 107, 1, 115200, 7b4593b45606650e78aec67722cfc2bf
+0, 108, 108, 1, 115200, 882bcbf7d2c12e93df2fbebc6ac19dd8
+0, 109, 109, 1, 115200, a2998a9c648817236bfffdae454f9fa1
+0, 110, 110, 1, 115200, 56775760fa99e9a9b7293ddc78a44ece
+0, 111, 111, 1, 115200, bb245d095424c28dd2ace22a5a511d6a
+0, 112, 112, 1, 115200, 598c54d2b207190ed549dec7390a4190
+0, 113, 113, 1, 115200, c73f16b2709527fce3d725ade5aab2fc
+0, 114, 114, 1, 115200, 32dcad6eb17bee583884029fe18c07a7
+0, 115, 115, 1, 115200, a1297c404a0d22e0e8e1e4ef67696606
+0, 116, 116, 1, 115200, 2fef1ac7becf9b8c9f3ac2310f444e3b
+0, 117, 117, 1, 115200, 0f03614ed3daec6c37c5b564ad24f595
+0, 118, 118, 1, 115200, 9b175a6353ec377da408b0cf03388081
+0, 119, 119, 1, 115200, 37b991b4a216a4847d0768a3b878284a
+0, 120, 120, 1, 115200, faafcd544080a6a4f87a0d0a393ba37b
+0, 121, 121, 1, 115200, 43ede087f37c1b0392829bbc668242fc
+0, 122, 122, 1, 115200, b7ed1274016c4d1810d8999d495b7370
+0, 123, 123, 1, 115200, 22af7bfc83c6e1f2eff2ae26e115b446
+0, 124, 124, 1, 115200, 969b22455f3be057036ddd5a329b1de3
+0, 125, 125, 1, 115200, 63c24b8a3d6c3a4c2fd47c48860abff9
+0, 126, 126, 1, 115200, b407ddc89c538d7b6fb70e48493f872c
+0, 127, 127, 1, 115200, 5de69fb9e1cd425cd3931116803f5391
+0, 128, 128, 1, 115200, 07fc7a5cb360edae97db999c2a8d2716
+0, 129, 129, 1, 115200, 602a17c58cac811e6e71e33448931ce5
+0, 130, 130, 1, 115200, 44087725484198c8e846d112583e574b
+0, 131, 131, 1, 115200, 0d81da0d23d196ff972894878bd17b73
+0, 132, 132, 1, 115200, b3cd65f1bd2274895e54da99bb4c4f07
+0, 133, 133, 1, 115200, ae8ca35672d8352af49f37f5174c8fbd
+0, 134, 134, 1, 115200, 9eea1ff900cf680e8208cd5d07a4d284
+0, 135, 135, 1, 115200, 5a47f272dfda3fe61955875f761a71f2
+0, 136, 136, 1, 115200, 544558333008db01451c886ac0b62c47
+0, 137, 137, 1, 115200, 5f8e4f3b11d7f5a28ff5cd9f3a6853bb
+0, 138, 138, 1, 115200, e9bc3da7060457f2d52a5bf6fe3bb515
+0, 139, 139, 1, 115200, 6aea6851a092260ae6594c6d9170ea8e
+0, 140, 140, 1, 115200, 38e7fa5bea809a984a5f810940ca0e49
+0, 141, 141, 1, 115200, 9e8a23ac9067a1acf8472d7aa3b9811e
+0, 142, 142, 1, 115200, 6f25f5873afd5c341ca6b3eb284be809
+0, 143, 143, 1, 115200, 40c3240e6cde94aae793a52cb46487da
+0, 144, 144, 1, 115200, b7f1f13842fbf0c6e085280eb89b956f
+0, 145, 145, 1, 115200, 1f059372d8bf4dadf78d8e215bbf9786
+0, 146, 146, 1, 115200, 50c1d6b76930e765bff5ecbaaae686fe
+0, 147, 147, 1, 115200, 5bd8cb05ebc034192e08ca8ce18a7964
+0, 148, 148, 1, 115200, ffc0c20b07e26857dc4f2c079a2ad675
+0, 149, 149, 1, 115200, 5dafb6ac0953c254182dba124e213c07
+0, 150, 150, 1, 115200, c774ed25712a38603fe2e224802768cb
+0, 151, 151, 1, 115200, de549cc803a6138d483be15b28ef2286
+0, 152, 152, 1, 115200, c963d9bc79c1dd2a47f7f8424c56239e
+0, 153, 153, 1, 115200, 9df993e0bef1bedbce1a6b596f2c64f4
+0, 154, 154, 1, 115200, 875792bde0f45358009b506840be68e1
+0, 155, 155, 1, 115200, 7f8c57083d2df08db6287cb025260788
+0, 156, 156, 1, 115200, 47eb13bc0942b5cafeea324fc5bf5cd5
+0, 157, 157, 1, 115200, d89129c7528ff7372f23d1191c75e336
+0, 158, 158, 1, 115200, bdd14e38b00075d8da485d1517dbbd65
+0, 159, 159, 1, 115200, 0e8e21a50a5dd1ac6fc881ad38ec38bd
+0, 160, 160, 1, 115200, a0fce98c23a053b4073715c554b9dc44
+0, 161, 161, 1, 115200, 18bda80360c72d04c60016682b1f6c8d
+0, 162, 162, 1, 115200, 306d7556c18dcf58c8183959d1c34c2a
+0, 163, 163, 1, 115200, 7ada9d23b96ef41322497d1077b00c4d
+0, 164, 164, 1, 115200, d7df0508be4bd0c3e83f346f0b9a1868
+0, 165, 165, 1, 115200, 749725f425f6fd4a79269bca900d09ae
+0, 166, 166, 1, 115200, ed30973158a576e2919e2fcfd00987fc
+0, 167, 167, 1, 115200, 2486d8b742ccc50cf8683af7f4502aec
+0, 168, 168, 1, 115200, bdfb21e4236c904aeacd7b094fcffe98
+0, 169, 169, 1, 115200, df2ef3e452731053ade82506c013164e
+0, 170, 170, 1, 115200, 4695bfd9aa8e5667572f8f2142c6e538
+0, 171, 171, 1, 115200, 649f5315cff1d28f0183144bf4d4eea4
+0, 172, 172, 1, 115200, 450e987b9d6075d32e21d030bc385833
+0, 173, 173, 1, 115200, 7aec79b25dabfcc2eb2f32e7dbff85f2
+0, 174, 174, 1, 115200, c9c2a96239ad556a2ee496d7c4c965c1
+0, 175, 175, 1, 115200, 3a038e48aa1238b62d431823653bc45a
+0, 176, 176, 1, 115200, 6d5c8de6a281dbce68998b2c38063f33
+0, 177, 177, 1, 115200, 045032f57d6a50ae148f4372f5083a62
+0, 178, 178, 1, 115200, 5f39172951e083e712c3b1c528e61a4f
+0, 179, 179, 1, 115200, 5a49eea76b6a86e305fb207fc1479264
+0, 180, 180, 1, 115200, 33ca5fb5f3e4ff3a24235da71c5730d5
+0, 181, 181, 1, 115200, 81f231d20426c5cbd02a85a425f5d0b8
+0, 182, 182, 1, 115200, 302d94aa9a8d3828cf74c8b2b7e7fdd5
+0, 183, 183, 1, 115200, c56f4f0c32b0f2c409b64ed10216a40a
+0, 184, 184, 1, 115200, 9cf7f51e1527f11c38c395bac94849d9
+0, 185, 185, 1, 115200, 0f17e427d14db658131eb0ccdc2a97ef
+0, 186, 186, 1, 115200, 2624dd6b8e4e95770f132d90aa6f6119
+0, 187, 187, 1, 115200, 9ddabfd5f803014443c2a0686869c546
+0, 188, 188, 1, 115200, 0170cb86a377d791d7cbee2af0836db7
+0, 189, 189, 1, 115200, f43a7c63bcafb51ead65e2831610612c
+0, 190, 190, 1, 115200, e7000913b11bdeb74ba4eca110df8470
+0, 191, 191, 1, 115200, a4208c5fcd101ceb5a976838ae9a811f
+0, 192, 192, 1, 115200, 8ddcb546ac632c967e879fb5101afa24
+0, 193, 193, 1, 115200, 547007771194373dd246586744130f7c
+0, 194, 194, 1, 115200, 3608a46fee2731341ae9f71d3a80918a
+0, 195, 195, 1, 115200, 758692e173552eb3439a572c953dda0f
+0, 196, 196, 1, 115200, 481f456d6c6ac2e0325acba5eeabcd26
+0, 197, 197, 1, 115200, c749a3ef8641d5ec4f25c611ffad1000
+0, 198, 198, 1, 115200, 93f089f7f1e78b1a4185c0b0d99875fb
+0, 199, 199, 1, 115200, 1159712bb4dbaed38d2a7558335f4037
+0, 200, 200, 1, 115200, e8dab85a977f525d4d9b448e4278a34b
+0, 201, 201, 1, 115200, 780055af1414e7693777a18428b20a07
+0, 202, 202, 1, 115200, 59252515451fd96ca3f1194d5aadc3a7
+0, 203, 203, 1, 115200, 0a977d6db761c149316417988657610a
+0, 204, 204, 1, 115200, ed81d3a10369c12543f9bb6822a249b6
+0, 205, 205, 1, 115200, 341e844231f6b55ee3c1eb22ca1bac8e
+0, 206, 206, 1, 115200, d0a180c7d15e30a71e297fda0452c153
+0, 207, 207, 1, 115200, 58d6f2522ecd8e5fea34cc9f10da2a88
+0, 208, 208, 1, 115200, dc8f96811577f4fd3e6624abae42f449
+0, 209, 209, 1, 115200, 3624a2e95f94a0a4413e464f4bf93dcd
+0, 210, 210, 1, 115200, cb0deeb5f2d570ca23e3be3ab9231fe9
+0, 211, 211, 1, 115200, 5080848626a52e30eb0f64f234ca3e57
+0, 212, 212, 1, 115200, a31c9fe4255318d86e7855f01588220f
+0, 213, 213, 1, 115200, 6c25fd8d1f0e898f6078decc4220d47d
+0, 214, 214, 1, 115200, 77e52da08ab57ba5784ce42872cc01cb
+0, 215, 215, 1, 115200, b4a87059745b3b862ef7431a9630f16a
+0, 216, 216, 1, 115200, 1dadc814514ef00f11010df21d8a9494
+0, 217, 217, 1, 115200, 5c816a0bbc8ed8fca166aa454093cb59
+0, 218, 218, 1, 115200, 10320c174423d1712d9ce812701bcaf9
+0, 219, 219, 1, 115200, 279c9398657af129e072165f41e0fb8c
+0, 220, 220, 1, 115200, 49d88374bc4d965d3cee3274c7cd9906
+0, 221, 221, 1, 115200, 48871e22f635f50569dea1bd5ca40d5c
+0, 222, 222, 1, 115200, 3b8396580f8fbd99daca4df13662f1fc
+0, 223, 223, 1, 115200, 569245e1bf3cb42aa95f765a8449980f
+0, 224, 224, 1, 115200, c5cab497d244447df0ab832dcc9c5968
+0, 225, 225, 1, 115200, 0a98ca4f1d771c4bc0286b825d085955
+0, 226, 226, 1, 115200, e4a55f175c3933f02ccf74ccf2961da2
+0, 227, 227, 1, 115200, 462dca7f377d708e753ef0bbde19a090
+0, 228, 228, 1, 115200, 6f1680f498b0ed6f89a834b5700cc48a
+0, 229, 229, 1, 115200, 996414e2e3a4bac5868ceeb25b84e6e4
+0, 230, 230, 1, 115200, 6ecb4d4b857578d32f716c56dc7e6be9
+0, 231, 231, 1, 115200, e05c8e33157e20c8e8f255e937d6b6cb
+0, 232, 232, 1, 115200, 6542744da147d16533e41dad287a54fc
+0, 233, 233, 1, 115200, bb4b6921d2855025fbcaff4c12299d02
+0, 234, 234, 1, 115200, 6bc3e605759725012f7e44f1285b0899
+0, 235, 235, 1, 115200, 0be37ecb7cec0cf8a0f9bbc3c590ba98
+0, 236, 236, 1, 115200, 4f1103e5923ba8dea3e99c8b75eaed3c
+0, 237, 237, 1, 115200, 220a8fb0409112c4f4ee769880717fea
+0, 238, 238, 1, 115200, e4c612263cfbc0f41283fd1e88e2ff52
+0, 239, 239, 1, 115200, ede2bc67ad87cd78191b742dd56419b5
+0, 240, 240, 1, 115200, ded6a1d0690603aea233e4d624aa60a9
+0, 241, 241, 1, 115200, 59c8b53e47ebdab696547a887163b272
+0, 242, 242, 1, 115200, 985f8afbc6df2d64d601d2fdc93571d7
+0, 243, 243, 1, 115200, e595f0aa7b6b62094f0ad84252105f55
+0, 244, 244, 1, 115200, c2fe4382a1740bcfc2f4c3573c6c3176
+0, 245, 245, 1, 115200, 880d8c906a8b39a61b68eb0ada857e5f
+0, 246, 246, 1, 115200, 9a3ca55d2d75e3c41a86aea2ec87ff76
+0, 247, 247, 1, 115200, f800751663dbefa61c33c3ebbd5430b4
+0, 248, 248, 1, 115200, d904333c0c76235c8ffdfc81dffddb46
+0, 249, 249, 1, 115200, 6a633a9a7686a9a02bd252ec8bcff4fc
+0, 250, 250, 1, 115200, 930d06ecc252a911a60c2d9d4f2618e6
+0, 251, 251, 1, 115200, bb146a4410c34bba74883d8ae478f47b
+0, 252, 252, 1, 115200, be8ab9fc95685ebec64ff1f8129afa35
+0, 253, 253, 1, 115200, d1f871ea3ceb38bf2b6d00ebfc38187a
+0, 254, 254, 1, 115200, ba33366e050a5f5abbf8202e0afbb9e8
+0, 255, 255, 1, 115200, f706356e12cf4082337bb8f7a5a10673
+0, 256, 256, 1, 115200, 6e8200d3c1cccc0f810985ea2a2030f6
+0, 257, 257, 1, 115200, caafdc1810556197df6f42336edcc07b
+0, 258, 258, 1, 115200, 5321ff525f5bb5063443a3dc43fc42af
+0, 259, 259, 1, 115200, c24bdd3b935f7ca6e9e105b1ae8504db
diff --git a/gst-libs/ext/libav/tests/ref/fate/vp8-test-vector-016 b/gst-libs/ext/libav/tests/ref/fate/vp8-test-vector-016
index 1a82145..291e7fe 100644
--- a/gst-libs/ext/libav/tests/ref/fate/vp8-test-vector-016
+++ b/gst-libs/ext/libav/tests/ref/fate/vp8-test-vector-016
@@ -1,29 +1,30 @@
-0, 0, 38016, 905a823da31f71f9c25ebb8dfc9ddd3c
-0, 3000, 38016, 9a1b97859b2f774954dbf96f45a22a0a
-0, 6000, 38016, f0f5651b32577549dc2e6e3050125229
-0, 9000, 38016, 9edf800d31dc653a23ed71d0f3fc32e4
-0, 12000, 38016, 78dd1fa96e63c177f2b90d702c92f48c
-0, 15000, 38016, e1cec336383c4ea63ccaff8bfa5c8e24
-0, 18000, 38016, e8b5a454e178ab7ba9b83dfc10b4171e
-0, 21000, 38016, 572dbaaf319f1681749135c49940c64e
-0, 24000, 38016, b0e8313de033cc75a78532789bb6a3cb
-0, 27000, 38016, ffc5581d83ff67b549d63c7de1a1e8cb
-0, 30000, 38016, 8ae3fcd3d74947d434b7c5f9ee08bbbf
-0, 33000, 38016, 3adff74d92ae0a463dddc6f89965f706
-0, 36000, 38016, f08355430fdf5bb16a91eef05f03186b
-0, 39000, 38016, d477eb8150a1a94dd6af7f067e8c0429
-0, 42000, 38016, f860f225e27871a17060373b79007ec6
-0, 45000, 38016, 22a25c07ac5e7c67df793e0d3169386c
-0, 48000, 38016, a96f9cef4efe74db0cce039c85c03c4d
-0, 51000, 38016, ff9c93cbc364976044144ee631f89bd2
-0, 54000, 38016, 3a6b43090adb6c8b5188d544a08295a8
-0, 57000, 38016, 7f41a10ada80865d24585860065aa5e4
-0, 60000, 38016, 099847f606672fd065e6841000cafcb3
-0, 63000, 38016, fbf543c12ce48633e6d10717862c35a7
-0, 66000, 38016, 1b9956d8a6c45e39d219da33ff7c334a
-0, 69000, 38016, 911eb8f478485c0f4eef1d03f53aa80b
-0, 72000, 38016, b801570a437439ce12c5037df0235742
-0, 75000, 38016, 8d231805d741abe79670a0e9f13712ea
-0, 78000, 38016, 87bfcc2c88c4471067c07fbcf635870d
-0, 81000, 38016, d51b6999afde880bc77597063b58d28f
-0, 84000, 38016, c69c07a34bfad3b5a95b19a84e991c13
+#tb 0: 1/30
+0, 0, 0, 1, 38016, 905a823da31f71f9c25ebb8dfc9ddd3c
+0, 1, 1, 1, 38016, 9a1b97859b2f774954dbf96f45a22a0a
+0, 2, 2, 1, 38016, f0f5651b32577549dc2e6e3050125229
+0, 3, 3, 1, 38016, 9edf800d31dc653a23ed71d0f3fc32e4
+0, 4, 4, 1, 38016, 78dd1fa96e63c177f2b90d702c92f48c
+0, 5, 5, 1, 38016, e1cec336383c4ea63ccaff8bfa5c8e24
+0, 6, 6, 1, 38016, e8b5a454e178ab7ba9b83dfc10b4171e
+0, 7, 7, 1, 38016, 572dbaaf319f1681749135c49940c64e
+0, 8, 8, 1, 38016, b0e8313de033cc75a78532789bb6a3cb
+0, 9, 9, 1, 38016, ffc5581d83ff67b549d63c7de1a1e8cb
+0, 10, 10, 1, 38016, 8ae3fcd3d74947d434b7c5f9ee08bbbf
+0, 11, 11, 1, 38016, 3adff74d92ae0a463dddc6f89965f706
+0, 12, 12, 1, 38016, f08355430fdf5bb16a91eef05f03186b
+0, 13, 13, 1, 38016, d477eb8150a1a94dd6af7f067e8c0429
+0, 14, 14, 1, 38016, f860f225e27871a17060373b79007ec6
+0, 15, 15, 1, 38016, 22a25c07ac5e7c67df793e0d3169386c
+0, 16, 16, 1, 38016, a96f9cef4efe74db0cce039c85c03c4d
+0, 17, 17, 1, 38016, ff9c93cbc364976044144ee631f89bd2
+0, 18, 18, 1, 38016, 3a6b43090adb6c8b5188d544a08295a8
+0, 19, 19, 1, 38016, 7f41a10ada80865d24585860065aa5e4
+0, 20, 20, 1, 38016, 099847f606672fd065e6841000cafcb3
+0, 21, 21, 1, 38016, fbf543c12ce48633e6d10717862c35a7
+0, 22, 22, 1, 38016, 1b9956d8a6c45e39d219da33ff7c334a
+0, 23, 23, 1, 38016, 911eb8f478485c0f4eef1d03f53aa80b
+0, 24, 24, 1, 38016, b801570a437439ce12c5037df0235742
+0, 25, 25, 1, 38016, 8d231805d741abe79670a0e9f13712ea
+0, 26, 26, 1, 38016, 87bfcc2c88c4471067c07fbcf635870d
+0, 27, 27, 1, 38016, d51b6999afde880bc77597063b58d28f
+0, 28, 28, 1, 38016, c69c07a34bfad3b5a95b19a84e991c13
diff --git a/gst-libs/ext/libav/tests/ref/fate/vp8-test-vector-017 b/gst-libs/ext/libav/tests/ref/fate/vp8-test-vector-017
index c461420..a8ccda8 100644
--- a/gst-libs/ext/libav/tests/ref/fate/vp8-test-vector-017
+++ b/gst-libs/ext/libav/tests/ref/fate/vp8-test-vector-017
@@ -1,29 +1,30 @@
-0, 0, 38016, 905a823da31f71f9c25ebb8dfc9ddd3c
-0, 3000, 38016, f0f411dd067bff05d5d9c64e3f52a4b1
-0, 6000, 38016, c8696f8fa56b4adf18f3db0c384d968f
-0, 9000, 38016, 5772aa26a95092b4a8a117e97d6dde49
-0, 12000, 38016, fc52254ea1cbcc2e7a5b126d8c44a023
-0, 15000, 38016, bf6208554657f568ad69d5c60f692fdb
-0, 18000, 38016, 3a68eef642b250177592455f4aa925d9
-0, 21000, 38016, 98102b7bd56cbe456d86c93e8cdd48eb
-0, 24000, 38016, 59d54b7d97600b2890c8abab2af9a7dc
-0, 27000, 38016, ba4b4bb534ee2a00f418828b9723d996
-0, 30000, 38016, feb1115136fa96d5e9425ac18261de7c
-0, 33000, 38016, ef7eb6dc656c2bd7447c7d8f650108c1
-0, 36000, 38016, 89ec385a0d34c8fd5b1334d8756c96b9
-0, 39000, 38016, 27bc439dd8e6d50c3c7a6e0b390e7418
-0, 42000, 38016, ec36c065d8b668fabb6b16ecc01eea0a
-0, 45000, 38016, 5c94f9b441fc70f62856c835f9e9ad50
-0, 48000, 38016, 4b6c1bd876b00052b39e6ca91cad9c05
-0, 51000, 38016, 1099121afd681cf3218dffb9714a0fd7
-0, 54000, 38016, d0c1de888fab35f33c1148dc80494d20
-0, 57000, 38016, 745941ea768d06ea27c3fbca782e3591
-0, 60000, 38016, 09f85054f188da6f7260debf6b71bbb1
-0, 63000, 38016, 2bdd642a7551681f1ca9680a0d9183a8
-0, 66000, 38016, 054aba9db9790a0f1c79db491a6cac6d
-0, 69000, 38016, fa4b52162f6da0c15100f4382d92d7e4
-0, 72000, 38016, 88c589535811dd394bd1723172329629
-0, 75000, 38016, c11cc1a30199d46db048120969dc4118
-0, 78000, 38016, c61207280f40620f8cd5e962f3aa160f
-0, 81000, 38016, 8a721ecbad0b2f17aabb2d06e27c00aa
-0, 84000, 38016, da32f1d272e065cd31415b23f86837cc
+#tb 0: 1/30
+0, 0, 0, 1, 38016, 905a823da31f71f9c25ebb8dfc9ddd3c
+0, 1, 1, 1, 38016, f0f411dd067bff05d5d9c64e3f52a4b1
+0, 2, 2, 1, 38016, c8696f8fa56b4adf18f3db0c384d968f
+0, 3, 3, 1, 38016, 5772aa26a95092b4a8a117e97d6dde49
+0, 4, 4, 1, 38016, fc52254ea1cbcc2e7a5b126d8c44a023
+0, 5, 5, 1, 38016, bf6208554657f568ad69d5c60f692fdb
+0, 6, 6, 1, 38016, 3a68eef642b250177592455f4aa925d9
+0, 7, 7, 1, 38016, 98102b7bd56cbe456d86c93e8cdd48eb
+0, 8, 8, 1, 38016, 59d54b7d97600b2890c8abab2af9a7dc
+0, 9, 9, 1, 38016, ba4b4bb534ee2a00f418828b9723d996
+0, 10, 10, 1, 38016, feb1115136fa96d5e9425ac18261de7c
+0, 11, 11, 1, 38016, ef7eb6dc656c2bd7447c7d8f650108c1
+0, 12, 12, 1, 38016, 89ec385a0d34c8fd5b1334d8756c96b9
+0, 13, 13, 1, 38016, 27bc439dd8e6d50c3c7a6e0b390e7418
+0, 14, 14, 1, 38016, ec36c065d8b668fabb6b16ecc01eea0a
+0, 15, 15, 1, 38016, 5c94f9b441fc70f62856c835f9e9ad50
+0, 16, 16, 1, 38016, 4b6c1bd876b00052b39e6ca91cad9c05
+0, 17, 17, 1, 38016, 1099121afd681cf3218dffb9714a0fd7
+0, 18, 18, 1, 38016, d0c1de888fab35f33c1148dc80494d20
+0, 19, 19, 1, 38016, 745941ea768d06ea27c3fbca782e3591
+0, 20, 20, 1, 38016, 09f85054f188da6f7260debf6b71bbb1
+0, 21, 21, 1, 38016, 2bdd642a7551681f1ca9680a0d9183a8
+0, 22, 22, 1, 38016, 054aba9db9790a0f1c79db491a6cac6d
+0, 23, 23, 1, 38016, fa4b52162f6da0c15100f4382d92d7e4
+0, 24, 24, 1, 38016, 88c589535811dd394bd1723172329629
+0, 25, 25, 1, 38016, c11cc1a30199d46db048120969dc4118
+0, 26, 26, 1, 38016, c61207280f40620f8cd5e962f3aa160f
+0, 27, 27, 1, 38016, 8a721ecbad0b2f17aabb2d06e27c00aa
+0, 28, 28, 1, 38016, da32f1d272e065cd31415b23f86837cc
diff --git a/gst-libs/ext/libav/tests/ref/fate/vqa-cc b/gst-libs/ext/libav/tests/ref/fate/vqa-cc
index d7d7f10..d3c5e6a 100644
--- a/gst-libs/ext/libav/tests/ref/fate/vqa-cc
+++ b/gst-libs/ext/libav/tests/ref/fate/vqa-cc
@@ -1,78 +1,39 @@
-0, 0, 192000, 0x00000000
-1, 0, 22048, 0x0665d7f4
-0, 6000, 192000, 0x00000000
-0, 12000, 192000, 0x00000000
-0, 18000, 192000, 0x00000000
-0, 24000, 192000, 0xcd900ccc
-0, 30000, 192000, 0xfd496438
-0, 36000, 192000, 0x965f0bf3
-0, 42000, 192000, 0x378fca5f
-1, 44996, 2940, 0x0f3c64cb
-0, 48000, 192000, 0x5ccd8966
-1, 50996, 2940, 0xc90b9e78
-0, 54000, 192000, 0x859676f9
-1, 56996, 2940, 0x146246a3
-0, 60000, 192000, 0x820bfb1c
-1, 62996, 2940, 0xd22c714e
-0, 66000, 192000, 0x7570cc05
-1, 68996, 2940, 0xd86b681e
-0, 72000, 192000, 0xf38bdb06
-1, 74996, 2940, 0x12ec8186
-0, 78000, 192000, 0x9b0cbb44
-1, 80996, 2940, 0x69aa85b6
-0, 84000, 192000, 0x0ed70665
-1, 86996, 2940, 0xb24d33b0
-0, 90000, 192000, 0xd16de7fc
-1, 92996, 2940, 0x3f7b0f0d
-0, 96000, 192000, 0x97afb484
-1, 98996, 2940, 0x64f10f7e
-0, 102000, 192000, 0x012893f3
-1, 104996, 2940, 0xd6ea379a
-0, 108000, 192000, 0x742a4b43
-1, 110996, 2940, 0x7c38e830
-0, 114000, 192000, 0x309dcd75
-1, 116996, 2940, 0xc28ff132
-0, 120000, 192000, 0xed7814ac
-1, 122996, 2940, 0xe7b11629
-0, 126000, 192000, 0xdb7de3d7
-1, 128996, 2940, 0xeb86fdcb
-0, 132000, 192000, 0xe18679a3
-1, 134996, 2940, 0x5508f586
-0, 138000, 192000, 0xb1f213f4
-1, 140996, 2940, 0xf4fa1f1b
-0, 144000, 192000, 0x33c99b5c
-1, 146996, 2940, 0x9e5ff976
-0, 150000, 192000, 0xf66c0c91
-1, 152996, 2940, 0xcfc4e08f
-0, 156000, 192000, 0x929cdc73
-1, 158996, 2940, 0x74bde7ed
-0, 162000, 192000, 0xa723fc3b
-1, 164996, 2940, 0x3e4ae245
-0, 168000, 192000, 0xe6395ccc
-1, 170996, 2940, 0x4c6a8e56
-0, 174000, 192000, 0x147fbf74
-1, 176996, 2940, 0xa09d86ab
-0, 180000, 192000, 0x3ec62d28
-1, 182996, 2940, 0xc8531912
-0, 186000, 192000, 0x22104ffb
-1, 188996, 2940, 0xa5f266aa
-0, 192000, 192000, 0x91f25f58
-1, 194996, 2940, 0x587a4187
-0, 198000, 192000, 0xc91b0e4e
-1, 200996, 2940, 0x14752d45
-0, 204000, 192000, 0x4683df56
-1, 206996, 2940, 0x558cde10
-0, 210000, 192000, 0x8ef8932a
-1, 212996, 2940, 0x735fee38
-0, 216000, 192000, 0xce6c0ec0
-1, 218996, 2940, 0xac8bb6c8
-0, 222000, 192000, 0xcc10e2a0
-1, 224996, 2940, 0xa503c73b
-1, 230996, 2940, 0x7cd588a3
-1, 236996, 2940, 0xa6974b04
-1, 242996, 2940, 0xbf448241
-1, 248996, 2940, 0x2a5c2759
-1, 254996, 2940, 0xd0de5ce0
-1, 260996, 2940, 0xc0486649
-1, 266996, 2940, 0x48b040af
-1, 272996, 2940, 0x82a338a9
+#tb 0: 1/15
+0, 0, 0, 1, 192000, 0x00000000
+0, 1, 1, 1, 192000, 0x00000000
+0, 2, 2, 1, 192000, 0x00000000
+0, 3, 3, 1, 192000, 0x00000000
+0, 4, 4, 1, 192000, 0xcd900ccc
+0, 5, 5, 1, 192000, 0xfd496438
+0, 6, 6, 1, 192000, 0x965f0bf3
+0, 7, 7, 1, 192000, 0x378fca5f
+0, 8, 8, 1, 192000, 0x5ccd8966
+0, 9, 9, 1, 192000, 0x859676f9
+0, 10, 10, 1, 192000, 0x820bfb1c
+0, 11, 11, 1, 192000, 0x7570cc05
+0, 12, 12, 1, 192000, 0xf38bdb06
+0, 13, 13, 1, 192000, 0x9b0cbb44
+0, 14, 14, 1, 192000, 0x0ed70665
+0, 15, 15, 1, 192000, 0xd16de7fc
+0, 16, 16, 1, 192000, 0x97afb484
+0, 17, 17, 1, 192000, 0x012893f3
+0, 18, 18, 1, 192000, 0x742a4b43
+0, 19, 19, 1, 192000, 0x309dcd75
+0, 20, 20, 1, 192000, 0xed7814ac
+0, 21, 21, 1, 192000, 0xdb7de3d7
+0, 22, 22, 1, 192000, 0xe18679a3
+0, 23, 23, 1, 192000, 0xb1f213f4
+0, 24, 24, 1, 192000, 0x33c99b5c
+0, 25, 25, 1, 192000, 0xf66c0c91
+0, 26, 26, 1, 192000, 0x929cdc73
+0, 27, 27, 1, 192000, 0xa723fc3b
+0, 28, 28, 1, 192000, 0xe6395ccc
+0, 29, 29, 1, 192000, 0x147fbf74
+0, 30, 30, 1, 192000, 0x3ec62d28
+0, 31, 31, 1, 192000, 0x22104ffb
+0, 32, 32, 1, 192000, 0x91f25f58
+0, 33, 33, 1, 192000, 0xc91b0e4e
+0, 34, 34, 1, 192000, 0x4683df56
+0, 35, 35, 1, 192000, 0x8ef8932a
+0, 36, 36, 1, 192000, 0xce6c0ec0
+0, 37, 37, 1, 192000, 0xcc10e2a0
diff --git a/gst-libs/ext/libav/tests/ref/fate/vqf-demux b/gst-libs/ext/libav/tests/ref/fate/vqf-demux
index a06fff3..3acae60 100644
--- a/gst-libs/ext/libav/tests/ref/fate/vqf-demux
+++ b/gst-libs/ext/libav/tests/ref/fate/vqf-demux
@@ -1 +1 @@
-48313c746da06b157711b13675f37312
+d72fb75fb22f4bcc94a1dc7af5356ec1
diff --git a/gst-libs/ext/libav/tests/ref/fate/wavpack-channels-4.0 b/gst-libs/ext/libav/tests/ref/fate/wavpack-channels-4.0
new file mode 100644
index 0000000..4cf6764
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/wavpack-channels-4.0
@@ -0,0 +1 @@
+a03999c3ad17423f3a7e3d537fea8589
diff --git a/gst-libs/ext/libav/tests/ref/fate/wavpack-channels-5.1 b/gst-libs/ext/libav/tests/ref/fate/wavpack-channels-5.1
new file mode 100644
index 0000000..49fe876
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/wavpack-channels-5.1
@@ -0,0 +1 @@
+4ab874ad4a47141073f6db9aeec422a8
diff --git a/gst-libs/ext/libav/tests/ref/fate/wavpack-channels-6.1 b/gst-libs/ext/libav/tests/ref/fate/wavpack-channels-6.1
new file mode 100644
index 0000000..ed46b7c
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/wavpack-channels-6.1
@@ -0,0 +1 @@
+a524a76c85f55b7d63914fc1543a5268
diff --git a/gst-libs/ext/libav/tests/ref/fate/wavpack-channels-7.1 b/gst-libs/ext/libav/tests/ref/fate/wavpack-channels-7.1
new file mode 100644
index 0000000..1f54afe
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/wavpack-channels-7.1
@@ -0,0 +1 @@
+cffe4d47290ff3cef974e5aa6bc32559
diff --git a/gst-libs/ext/libav/tests/ref/fate/wavpack-channels-monofloat b/gst-libs/ext/libav/tests/ref/fate/wavpack-channels-monofloat
new file mode 100644
index 0000000..41d94fa
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/wavpack-channels-monofloat
@@ -0,0 +1 @@
+71386c0f63105e414220f0f0d369a0e6
diff --git a/gst-libs/ext/libav/tests/ref/fate/wavpack-channels-monoint b/gst-libs/ext/libav/tests/ref/fate/wavpack-channels-monoint
new file mode 100644
index 0000000..204ab6d
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/wavpack-channels-monoint
@@ -0,0 +1 @@
+931f27e3ec69fae0952548504461d97c
diff --git a/gst-libs/ext/libav/tests/ref/fate/wavpack-clipping b/gst-libs/ext/libav/tests/ref/fate/wavpack-clipping
new file mode 100644
index 0000000..fd19f93
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/wavpack-clipping
@@ -0,0 +1 @@
+d18d0b2dc7d329aefcbb889dc99383ab
diff --git a/gst-libs/ext/libav/tests/ref/fate/wavpack-cuesheet b/gst-libs/ext/libav/tests/ref/fate/wavpack-cuesheet
new file mode 100644
index 0000000..e013bb0
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/wavpack-cuesheet
@@ -0,0 +1 @@
+85eb2940491442ca25c2a702a6f30e5f
diff --git a/gst-libs/ext/libav/tests/ref/fate/wavpack-falsestereo b/gst-libs/ext/libav/tests/ref/fate/wavpack-falsestereo
new file mode 100644
index 0000000..458ce65
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/wavpack-falsestereo
@@ -0,0 +1 @@
+e3fdd584bef84e85f4ca84e2769306f8
diff --git a/gst-libs/ext/libav/tests/ref/fate/wavpack-lossless-12bit b/gst-libs/ext/libav/tests/ref/fate/wavpack-lossless-12bit
new file mode 100644
index 0000000..2adf043
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/wavpack-lossless-12bit
@@ -0,0 +1 @@
+925e047ac0d4c874a9cff3cc9117ac91
diff --git a/gst-libs/ext/libav/tests/ref/fate/wavpack-lossless-16bit b/gst-libs/ext/libav/tests/ref/fate/wavpack-lossless-16bit
new file mode 100644
index 0000000..04fc280
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/wavpack-lossless-16bit
@@ -0,0 +1 @@
+e2dc4b85377b275a48c8bd2a4f5b91fd
diff --git a/gst-libs/ext/libav/tests/ref/fate/wavpack-lossless-24bit b/gst-libs/ext/libav/tests/ref/fate/wavpack-lossless-24bit
new file mode 100644
index 0000000..1fd8dca
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/wavpack-lossless-24bit
@@ -0,0 +1 @@
+9d7bc1a45bd3ba9d1eb5706f0dfc3e47
diff --git a/gst-libs/ext/libav/tests/ref/fate/wavpack-lossless-32bit b/gst-libs/ext/libav/tests/ref/fate/wavpack-lossless-32bit
new file mode 100644
index 0000000..cef05f3
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/wavpack-lossless-32bit
@@ -0,0 +1 @@
+c35f539bb5796ed93908c987fab1c26c
diff --git a/gst-libs/ext/libav/tests/ref/fate/wavpack-lossless-8bit b/gst-libs/ext/libav/tests/ref/fate/wavpack-lossless-8bit
new file mode 100644
index 0000000..58cdb99
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/wavpack-lossless-8bit
@@ -0,0 +1 @@
+e4e65e2048ba373d89836907328cfb27
diff --git a/gst-libs/ext/libav/tests/ref/fate/wavpack-lossless-float b/gst-libs/ext/libav/tests/ref/fate/wavpack-lossless-float
new file mode 100644
index 0000000..6081ae1
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/wavpack-lossless-float
@@ -0,0 +1 @@
+04b860cf4f9ecba36c053fdf83dac14a
diff --git a/gst-libs/ext/libav/tests/ref/fate/wavpack-lossy-16bit b/gst-libs/ext/libav/tests/ref/fate/wavpack-lossy-16bit
new file mode 100644
index 0000000..3adeaa0
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/wavpack-lossy-16bit
@@ -0,0 +1 @@
+c2aa8d83d14f799a9289b73bb6263fbc
diff --git a/gst-libs/ext/libav/tests/ref/fate/wavpack-lossy-24bit b/gst-libs/ext/libav/tests/ref/fate/wavpack-lossy-24bit
new file mode 100644
index 0000000..566ec6d
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/wavpack-lossy-24bit
@@ -0,0 +1 @@
+0c04941424ba0981eac0e681130788f7
diff --git a/gst-libs/ext/libav/tests/ref/fate/wavpack-lossy-32bit b/gst-libs/ext/libav/tests/ref/fate/wavpack-lossy-32bit
new file mode 100644
index 0000000..6b66d0a
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/wavpack-lossy-32bit
@@ -0,0 +1 @@
+7b94c7ab8ec78ddf59bd7967199cdc8e
diff --git a/gst-libs/ext/libav/tests/ref/fate/wavpack-lossy-8bit b/gst-libs/ext/libav/tests/ref/fate/wavpack-lossy-8bit
new file mode 100644
index 0000000..d921ea6
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/wavpack-lossy-8bit
@@ -0,0 +1 @@
+f0e452d762d5e7b675970e6e67b781e7
diff --git a/gst-libs/ext/libav/tests/ref/fate/wavpack-lossy-float b/gst-libs/ext/libav/tests/ref/fate/wavpack-lossy-float
new file mode 100644
index 0000000..9f984ac
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/wavpack-lossy-float
@@ -0,0 +1 @@
+d4733e795e5af80da9a265cf83a6da69
diff --git a/gst-libs/ext/libav/tests/ref/fate/wavpack-matroskamode b/gst-libs/ext/libav/tests/ref/fate/wavpack-matroskamode
new file mode 100644
index 0000000..1f54afe
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/wavpack-matroskamode
@@ -0,0 +1 @@
+cffe4d47290ff3cef974e5aa6bc32559
diff --git a/gst-libs/ext/libav/tests/ref/fate/wavpack-speed-default b/gst-libs/ext/libav/tests/ref/fate/wavpack-speed-default
new file mode 100644
index 0000000..9dc559f
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/wavpack-speed-default
@@ -0,0 +1 @@
+a57bec3f270c3b294d1e5ea07760514c
diff --git a/gst-libs/ext/libav/tests/ref/fate/wavpack-speed-fast b/gst-libs/ext/libav/tests/ref/fate/wavpack-speed-fast
new file mode 100644
index 0000000..181d7dd
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/wavpack-speed-fast
@@ -0,0 +1 @@
+ebff08f89073e3f662f822df428711d5
diff --git a/gst-libs/ext/libav/tests/ref/fate/wavpack-speed-high b/gst-libs/ext/libav/tests/ref/fate/wavpack-speed-high
new file mode 100644
index 0000000..3d85201
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/wavpack-speed-high
@@ -0,0 +1 @@
+a28c4d0f1d0c6ac7739e05150a8c401a
diff --git a/gst-libs/ext/libav/tests/ref/fate/wavpack-speed-vhigh b/gst-libs/ext/libav/tests/ref/fate/wavpack-speed-vhigh
new file mode 100644
index 0000000..3d85201
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/wavpack-speed-vhigh
@@ -0,0 +1 @@
+a28c4d0f1d0c6ac7739e05150a8c401a
diff --git a/gst-libs/ext/libav/tests/ref/fate/wavpack-zerolsbs b/gst-libs/ext/libav/tests/ref/fate/wavpack-zerolsbs
new file mode 100644
index 0000000..cc16fb9
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/wavpack-zerolsbs
@@ -0,0 +1 @@
+33c09fedba88693f6cc423ca3763e7fe
diff --git a/gst-libs/ext/libav/tests/ref/fate/wc3movie-xan b/gst-libs/ext/libav/tests/ref/fate/wc3movie-xan
index 8fd2282..57b7f70 100644
--- a/gst-libs/ext/libav/tests/ref/fate/wc3movie-xan
+++ b/gst-libs/ext/libav/tests/ref/fate/wc3movie-xan
@@ -1,70 +1,72 @@
-0, 0, 158400, 0x25aec781
-1, 0, 2940, 0x92cee2a6
-0, 6000, 158400, 0xda4dbf70
-1, 6000, 2940, 0x126902c3
-0, 12000, 158400, 0x2d8fc909
-1, 12000, 2940, 0x4977b9e6
-0, 18000, 158400, 0xea93c5ab
-1, 18000, 2940, 0x5144d68c
-0, 24000, 158400, 0xa1f5bf60
-1, 24000, 2940, 0x282ebf71
-0, 30000, 158400, 0x739ecfa9
-1, 30000, 2940, 0xc2e7c73c
-0, 36000, 158400, 0xe9830c7e
-1, 36000, 2940, 0x717d6fc5
-0, 42000, 158400, 0xd885665b
-1, 42000, 2940, 0x78538428
-0, 48000, 158400, 0x3235f8ad
-1, 48000, 2940, 0x94ffd1ad
-0, 54000, 158400, 0xd8550cca
-1, 54000, 2940, 0xad43de8b
-0, 60000, 158400, 0x05e9e231
-1, 60000, 2940, 0x65e4b604
-0, 66000, 158400, 0xce9dd29b
-1, 66000, 2940, 0xd6d6c30f
-0, 72000, 158400, 0x857494a6
-1, 72000, 2940, 0x7b897e4e
-0, 78000, 158400, 0x9cad464a
-1, 78000, 2940, 0xf79546ad
-0, 84000, 158400, 0x04c3177a
-1, 84000, 2940, 0x658c904e
-0, 90000, 158400, 0xa3d2399a
-1, 90000, 2940, 0xb7b8cd8c
-0, 96000, 158400, 0x12cdd418
-1, 96000, 2940, 0x2f2da7c5
-0, 102000, 158400, 0x5ef67c9e
-1, 102000, 2940, 0x51938cf8
-0, 108000, 158400, 0xba7a7f11
-1, 108000, 2940, 0xdf61c87a
-0, 114000, 158400, 0x084b60e7
-1, 114000, 2940, 0xf72a7069
-0, 120000, 158400, 0xef95a6a5
-1, 120000, 2940, 0x9af2a425
-0, 126000, 158400, 0x55f392f1
-1, 126000, 2940, 0x4c3f5ac7
-0, 132000, 158400, 0x63fca6bb
-1, 132000, 2940, 0xfe4cb0b2
-0, 138000, 158400, 0x0f7e62fe
-1, 138000, 2940, 0x732a35ed
-0, 144000, 158400, 0xf35febc1
-1, 144000, 2940, 0x526b9e0f
-0, 150000, 158400, 0x6bf6f219
-1, 150000, 2940, 0x4bd9d4e2
-0, 156000, 158400, 0xbdf13e77
-1, 156000, 2940, 0x84340827
-0, 162000, 158400, 0x88490e47
-1, 162000, 2940, 0xe54f7911
-0, 168000, 158400, 0xdb786540
-1, 168000, 2940, 0x0bbdef52
-0, 174000, 158400, 0x7335c045
-1, 174000, 2940, 0xc1aac5e1
-0, 180000, 158400, 0x6b78015a
-1, 180000, 2940, 0x515ea512
-0, 186000, 158400, 0x9e9b6d16
-1, 186000, 2940, 0x9e7fdac1
-0, 192000, 158400, 0xe618e024
-1, 192000, 2940, 0xf1d4c9cc
-0, 198000, 158400, 0x56cd60f7
-1, 198000, 2940, 0x1bc9b6ee
-0, 204000, 158400, 0xf08e22fe
-1, 204000, 2940, 0xff8ac114
+#tb 0: 1/15
+#tb 1: 1/22050
+0, 0, 0, 1, 158400, 0x25aec781
+1, 0, 0, 1470, 2940, 0x92cee2a6
+0, 1, 1, 1, 158400, 0xda4dbf70
+1, 1470, 1470, 1470, 2940, 0x126902c3
+0, 2, 2, 1, 158400, 0x2d8fc909
+1, 2940, 2940, 1470, 2940, 0x4977b9e6
+0, 3, 3, 1, 158400, 0xea93c5ab
+1, 4410, 4410, 1470, 2940, 0x5144d68c
+0, 4, 4, 1, 158400, 0xa1f5bf60
+1, 5880, 5880, 1470, 2940, 0x282ebf71
+0, 5, 5, 1, 158400, 0x739ecfa9
+1, 7350, 7350, 1470, 2940, 0xc2e7c73c
+0, 6, 6, 1, 158400, 0xe9830c7e
+1, 8820, 8820, 1470, 2940, 0x717d6fc5
+0, 7, 7, 1, 158400, 0xd885665b
+1, 10290, 10290, 1470, 2940, 0x78538428
+0, 8, 8, 1, 158400, 0x3235f8ad
+1, 11760, 11760, 1470, 2940, 0x94ffd1ad
+0, 9, 9, 1, 158400, 0xd8550cca
+1, 13230, 13230, 1470, 2940, 0xad43de8b
+0, 10, 10, 1, 158400, 0x05e9e231
+1, 14700, 14700, 1470, 2940, 0x65e4b604
+0, 11, 11, 1, 158400, 0xce9dd29b
+1, 16170, 16170, 1470, 2940, 0xd6d6c30f
+0, 12, 12, 1, 158400, 0x857494a6
+1, 17640, 17640, 1470, 2940, 0x7b897e4e
+0, 13, 13, 1, 158400, 0x9cad464a
+1, 19110, 19110, 1470, 2940, 0xf79546ad
+0, 14, 14, 1, 158400, 0x04c3177a
+1, 20580, 20580, 1470, 2940, 0x658c904e
+0, 15, 15, 1, 158400, 0xa3d2399a
+1, 22050, 22050, 1470, 2940, 0xb7b8cd8c
+0, 16, 16, 1, 158400, 0x12cdd418
+1, 23520, 23520, 1470, 2940, 0x2f2da7c5
+0, 17, 17, 1, 158400, 0x5ef67c9e
+1, 24990, 24990, 1470, 2940, 0x51938cf8
+0, 18, 18, 1, 158400, 0xba7a7f11
+1, 26460, 26460, 1470, 2940, 0xdf61c87a
+0, 19, 19, 1, 158400, 0x084b60e7
+1, 27930, 27930, 1470, 2940, 0xf72a7069
+0, 20, 20, 1, 158400, 0xef95a6a5
+1, 29400, 29400, 1470, 2940, 0x9af2a425
+0, 21, 21, 1, 158400, 0x55f392f1
+1, 30870, 30870, 1470, 2940, 0x4c3f5ac7
+0, 22, 22, 1, 158400, 0x63fca6bb
+1, 32340, 32340, 1470, 2940, 0xfe4cb0b2
+0, 23, 23, 1, 158400, 0x0f7e62fe
+1, 33810, 33810, 1470, 2940, 0x732a35ed
+0, 24, 24, 1, 158400, 0xf35febc1
+1, 35280, 35280, 1470, 2940, 0x526b9e0f
+0, 25, 25, 1, 158400, 0x6bf6f219
+1, 36750, 36750, 1470, 2940, 0x4bd9d4e2
+0, 26, 26, 1, 158400, 0xbdf13e77
+1, 38220, 38220, 1470, 2940, 0x84340827
+0, 27, 27, 1, 158400, 0x88490e47
+1, 39690, 39690, 1470, 2940, 0xe54f7911
+0, 28, 28, 1, 158400, 0xdb786540
+1, 41160, 41160, 1470, 2940, 0x0bbdef52
+0, 29, 29, 1, 158400, 0x7335c045
+1, 42630, 42630, 1470, 2940, 0xc1aac5e1
+0, 30, 30, 1, 158400, 0x6b78015a
+1, 44100, 44100, 1470, 2940, 0x515ea512
+0, 31, 31, 1, 158400, 0x9e9b6d16
+1, 45570, 45570, 1470, 2940, 0x9e7fdac1
+0, 32, 32, 1, 158400, 0xe618e024
+1, 47040, 47040, 1470, 2940, 0xf1d4c9cc
+0, 33, 33, 1, 158400, 0x56cd60f7
+1, 48510, 48510, 1470, 2940, 0x1bc9b6ee
+0, 34, 34, 1, 158400, 0xf08e22fe
+1, 49980, 49980, 1470, 2940, 0xff8ac114
diff --git a/gst-libs/ext/libav/tests/ref/fate/westwood-aud b/gst-libs/ext/libav/tests/ref/fate/westwood-aud
index f8bec10..9fab241 100644
--- a/gst-libs/ext/libav/tests/ref/fate/westwood-aud
+++ b/gst-libs/ext/libav/tests/ref/fate/westwood-aud
@@ -1 +1,12 @@
-5c2528488729035c17c21486797a2a23
+#tb 0: 1/22050
+0, 0, 0, 1024, 512, 0x6694cc55
+0, 1024, 1024, 1024, 512, 0xdbc5cb22
+0, 2048, 2048, 1024, 512, 0x8e5bcbfd
+0, 3072, 3072, 1024, 512, 0x7b2ac519
+0, 4096, 4096, 1024, 512, 0x6ae0cb0c
+0, 5120, 5120, 1024, 512, 0x055ec435
+0, 6144, 6144, 1024, 512, 0x9424c8d6
+0, 7168, 7168, 1024, 512, 0x58fccb7d
+0, 8192, 8192, 1024, 512, 0x348fd253
+0, 9216, 9216, 1024, 512, 0xe1b1c24e
+0, 10240, 10240, 192, 96, 0x95f81350
diff --git a/gst-libs/ext/libav/tests/ref/fate/wmv8-drm b/gst-libs/ext/libav/tests/ref/fate/wmv8-drm
index e18309b..c2a6dd5 100644
--- a/gst-libs/ext/libav/tests/ref/fate/wmv8-drm
+++ b/gst-libs/ext/libav/tests/ref/fate/wmv8-drm
@@ -1,130 +1,131 @@
-0, 0, 84480, 0x7760a00b
-0, 3750, 84480, 0xfe39a1db
-0, 7500, 84480, 0xd71961b4
-0, 11250, 84480, 0xc80dedba
-0, 15000, 84480, 0x34d8b538
-0, 18750, 84480, 0x1a86b8e5
-0, 22500, 84480, 0xabf7c25d
-0, 26250, 84480, 0x912600ee
-0, 30000, 84480, 0x7ee7c70b
-0, 33750, 84480, 0x09c5b0d1
-0, 37500, 84480, 0x6dbe6c0c
-0, 41250, 84480, 0x0fe0a120
-0, 45000, 84480, 0x2352d3a2
-0, 48750, 84480, 0xb22ce92e
-0, 52500, 84480, 0x31db0099
-0, 56250, 84480, 0xad2dd73a
-0, 60000, 84480, 0xb9af8e20
-0, 63750, 84480, 0x7b956549
-0, 67500, 84480, 0x3f774b87
-0, 71250, 84480, 0x824a23a3
-0, 75000, 84480, 0x4469a8d8
-0, 78750, 84480, 0xc80c7a0a
-0, 82500, 84480, 0xcf958549
-0, 86250, 84480, 0x449746e3
-0, 90000, 84480, 0xbac66a82
-0, 93750, 84480, 0x99e85855
-0, 97500, 84480, 0xa4a17d17
-0, 101250, 84480, 0xe29c7587
-0, 105000, 84480, 0x551de592
-0, 108750, 84480, 0xe0877bce
-0, 112500, 84480, 0x9660eb35
-0, 116250, 84480, 0x0a34b644
-0, 120000, 84480, 0x352919f0
-0, 123750, 84480, 0xef56ce27
-0, 127500, 84480, 0x030fe862
-0, 131250, 84480, 0x2eba33e2
-0, 135000, 84480, 0x242de401
-0, 138750, 84480, 0xbadd61ca
-0, 142500, 84480, 0x2060465b
-0, 146250, 84480, 0x256e6965
-0, 150000, 84480, 0x243b7084
-0, 153750, 84480, 0x8b3c0b47
-0, 157500, 84480, 0xc174a9af
-0, 161250, 84480, 0xb6d48686
-0, 165000, 84480, 0xa3dd1871
-0, 168750, 84480, 0x04cdcaf7
-0, 172500, 84480, 0x55f89c94
-0, 176250, 84480, 0xda657032
-0, 180000, 84480, 0x38ba7698
-0, 183750, 84480, 0x4d03a7f2
-0, 187500, 84480, 0x115d9035
-0, 191250, 84480, 0x24c6acc6
-0, 195000, 84480, 0xdd2bbcae
-0, 198750, 84480, 0xb4fee0b9
-0, 202500, 84480, 0xc51c14e0
-0, 206250, 84480, 0xfb7737de
-0, 210000, 84480, 0x38675fb0
-0, 213750, 84480, 0x4752c710
-0, 217500, 84480, 0xfeb7491b
-0, 221250, 84480, 0xaa248122
-0, 225000, 84480, 0x9a4af87c
-0, 228750, 84480, 0xedcf09df
-0, 232500, 84480, 0x563a05df
-0, 236250, 84480, 0x0dde1e03
-0, 240000, 84480, 0xd8f0ff65
-0, 243750, 84480, 0xbeb9ae1a
-0, 247500, 84480, 0x416d1468
-0, 251250, 84480, 0x66c87d4c
-0, 255000, 84480, 0xa67c0774
-0, 258750, 84480, 0xd8f8aec1
-0, 262500, 84480, 0xadfa502b
-0, 266250, 84480, 0x50bf20e4
-0, 270000, 84480, 0xbcb3d8cc
-0, 273750, 84480, 0xa54677d7
-0, 277500, 84480, 0x3566042d
-0, 281250, 84480, 0x4c9eed57
-0, 285000, 84480, 0xc3b90e58
-0, 288750, 84480, 0x3c042bfa
-0, 292500, 84480, 0x19f8e890
-0, 296250, 84480, 0xd3dacfb9
-0, 300000, 84480, 0x2365fc6f
-0, 303750, 84480, 0xa2c19d00
-0, 307500, 84480, 0xce94336f
-0, 311250, 84480, 0xfa9bcf14
-0, 315000, 84480, 0x24d6a243
-0, 318750, 84480, 0xae1c8854
-0, 322500, 84480, 0xbb8968bf
-0, 326250, 84480, 0x6f923623
-0, 330000, 84480, 0x22e98029
-0, 333750, 84480, 0x8ac33af3
-0, 337500, 84480, 0x05947b6e
-0, 341250, 84480, 0xfc35661a
-0, 345000, 84480, 0x0e6b6e47
-0, 348750, 84480, 0x82c764bb
-0, 352500, 84480, 0x57a36833
-0, 356250, 84480, 0xc8dd690a
-0, 360000, 84480, 0x02c47232
-0, 363750, 84480, 0x6645715d
-0, 367500, 84480, 0xc64860f7
-0, 371250, 84480, 0x4f5614b3
-0, 375000, 84480, 0xa70842ca
-0, 378750, 84480, 0x379d8458
-0, 382500, 84480, 0xa14701cf
-0, 386250, 84480, 0xad1aa2b2
-0, 390000, 84480, 0xee28f320
-0, 393750, 84480, 0x505801e9
-0, 397500, 84480, 0x7947233b
-0, 401250, 84480, 0x3ce72a9d
-0, 405000, 84480, 0xa6834e64
-0, 408750, 84480, 0xfebf4d70
-0, 412500, 84480, 0x4a0775e2
-0, 416250, 84480, 0x9d7e945b
-0, 420000, 84480, 0xaa9eadd9
-0, 423750, 84480, 0xaa85c9b1
-0, 427500, 84480, 0xa005edaf
-0, 431250, 84480, 0x7fc4e5cc
-0, 435000, 84480, 0xb0f6e8d1
-0, 438750, 84480, 0x9ef9f330
-0, 442500, 84480, 0xbe14ff1f
-0, 446250, 84480, 0xd494048c
-0, 450000, 84480, 0x046166a7
-0, 453750, 84480, 0x052a09b2
-0, 457500, 84480, 0x71fff4ab
-0, 461250, 84480, 0xb9684e41
-0, 465000, 84480, 0x1ddce068
-0, 468750, 84480, 0xb9de300e
-0, 472500, 84480, 0x13962590
-0, 476250, 84480, 0xde79482f
-0, 480000, 84480, 0x7d1ca064
-0, 483750, 84480, 0x2676a064
+#tb 0: 1/1000
+0, 0, 0, 0, 84480, 0x7760a00b
+0, 1208, 1208, 0, 84480, 0xfe39a1db
+0, 1250, 1250, 0, 84480, 0xd71961b4
+0, 1291, 1291, 0, 84480, 0xc80dedba
+0, 1333, 1333, 0, 84480, 0x34d8b538
+0, 1375, 1375, 0, 84480, 0x1a86b8e5
+0, 1416, 1416, 0, 84480, 0xabf7c25d
+0, 1458, 1458, 0, 84480, 0x912600ee
+0, 1500, 1500, 0, 84480, 0x7ee7c70b
+0, 1541, 1541, 0, 84480, 0x09c5b0d1
+0, 1583, 1583, 0, 84480, 0x6dbe6c0c
+0, 1625, 1625, 0, 84480, 0x0fe0a120
+0, 1666, 1666, 0, 84480, 0x2352d3a2
+0, 1708, 1708, 0, 84480, 0xb22ce92e
+0, 1750, 1750, 0, 84480, 0x31db0099
+0, 1791, 1791, 0, 84480, 0xad2dd73a
+0, 1833, 1833, 0, 84480, 0xb9af8e20
+0, 1875, 1875, 0, 84480, 0x7b956549
+0, 1916, 1916, 0, 84480, 0x3f774b87
+0, 1958, 1958, 0, 84480, 0x824a23a3
+0, 2000, 2000, 0, 84480, 0x4469a8d8
+0, 2041, 2041, 0, 84480, 0xc80c7a0a
+0, 2083, 2083, 0, 84480, 0xcf958549
+0, 2125, 2125, 0, 84480, 0x449746e3
+0, 2166, 2166, 0, 84480, 0xbac66a82
+0, 2208, 2208, 0, 84480, 0x99e85855
+0, 2250, 2250, 0, 84480, 0xa4a17d17
+0, 2291, 2291, 0, 84480, 0xe29c7587
+0, 2333, 2333, 0, 84480, 0x551de592
+0, 2375, 2375, 0, 84480, 0xe0877bce
+0, 2416, 2416, 0, 84480, 0x9660eb35
+0, 2458, 2458, 0, 84480, 0x0a34b644
+0, 2500, 2500, 0, 84480, 0x352919f0
+0, 2541, 2541, 0, 84480, 0xef56ce27
+0, 2583, 2583, 0, 84480, 0x030fe862
+0, 2625, 2625, 0, 84480, 0x2eba33e2
+0, 2666, 2666, 0, 84480, 0x242de401
+0, 2708, 2708, 0, 84480, 0xbadd61ca
+0, 2750, 2750, 0, 84480, 0x2060465b
+0, 2791, 2791, 0, 84480, 0x256e6965
+0, 2833, 2833, 0, 84480, 0x243b7084
+0, 2875, 2875, 0, 84480, 0x8b3c0b47
+0, 2916, 2916, 0, 84480, 0xc174a9af
+0, 2958, 2958, 0, 84480, 0xb6d48686
+0, 3000, 3000, 0, 84480, 0xa3dd1871
+0, 3041, 3041, 0, 84480, 0x04cdcaf7
+0, 3083, 3083, 0, 84480, 0x55f89c94
+0, 3125, 3125, 0, 84480, 0xda657032
+0, 3166, 3166, 0, 84480, 0x38ba7698
+0, 3208, 3208, 0, 84480, 0x4d03a7f2
+0, 3250, 3250, 0, 84480, 0x115d9035
+0, 3291, 3291, 0, 84480, 0x24c6acc6
+0, 3333, 3333, 0, 84480, 0xdd2bbcae
+0, 3375, 3375, 0, 84480, 0xb4fee0b9
+0, 3416, 3416, 0, 84480, 0xc51c14e0
+0, 3458, 3458, 0, 84480, 0xfb7737de
+0, 3500, 3500, 0, 84480, 0x38675fb0
+0, 3541, 3541, 0, 84480, 0x4752c710
+0, 3583, 3583, 0, 84480, 0xfeb7491b
+0, 3625, 3625, 0, 84480, 0xaa248122
+0, 3666, 3666, 0, 84480, 0x9a4af87c
+0, 3708, 3708, 0, 84480, 0xedcf09df
+0, 3750, 3750, 0, 84480, 0x563a05df
+0, 3791, 3791, 0, 84480, 0x0dde1e03
+0, 3833, 3833, 0, 84480, 0xd8f0ff65
+0, 3875, 3875, 0, 84480, 0xbeb9ae1a
+0, 3916, 3916, 0, 84480, 0x416d1468
+0, 3958, 3958, 0, 84480, 0x66c87d4c
+0, 4000, 4000, 0, 84480, 0xa67c0774
+0, 4041, 4041, 0, 84480, 0xd8f8aec1
+0, 4083, 4083, 0, 84480, 0xadfa502b
+0, 4125, 4125, 0, 84480, 0x50bf20e4
+0, 4166, 4166, 0, 84480, 0xbcb3d8cc
+0, 4208, 4208, 0, 84480, 0xa54677d7
+0, 4250, 4250, 0, 84480, 0x3566042d
+0, 4291, 4291, 0, 84480, 0x4c9eed57
+0, 4333, 4333, 0, 84480, 0xc3b90e58
+0, 4375, 4375, 0, 84480, 0x3c042bfa
+0, 4416, 4416, 0, 84480, 0x19f8e890
+0, 4458, 4458, 0, 84480, 0xd3dacfb9
+0, 4500, 4500, 0, 84480, 0x2365fc6f
+0, 4541, 4541, 0, 84480, 0xa2c19d00
+0, 4583, 4583, 0, 84480, 0xce94336f
+0, 4625, 4625, 0, 84480, 0xfa9bcf14
+0, 4916, 4916, 0, 84480, 0x24d6a243
+0, 4958, 4958, 0, 84480, 0xae1c8854
+0, 5000, 5000, 0, 84480, 0xbb8968bf
+0, 5041, 5041, 0, 84480, 0x6f923623
+0, 5083, 5083, 0, 84480, 0x22e98029
+0, 5125, 5125, 0, 84480, 0x8ac33af3
+0, 5166, 5166, 0, 84480, 0x05947b6e
+0, 5208, 5208, 0, 84480, 0xfc35661a
+0, 5250, 5250, 0, 84480, 0x0e6b6e47
+0, 5291, 5291, 0, 84480, 0x82c764bb
+0, 5333, 5333, 0, 84480, 0x57a36833
+0, 5375, 5375, 0, 84480, 0xc8dd690a
+0, 5416, 5416, 0, 84480, 0x02c47232
+0, 5458, 5458, 0, 84480, 0x6645715d
+0, 5500, 5500, 0, 84480, 0xc64860f7
+0, 5541, 5541, 0, 84480, 0x4f5614b3
+0, 5583, 5583, 0, 84480, 0xa70842ca
+0, 5625, 5625, 0, 84480, 0x379d8458
+0, 5666, 5666, 0, 84480, 0xa14701cf
+0, 5708, 5708, 0, 84480, 0xad1aa2b2
+0, 5750, 5750, 0, 84480, 0xee28f320
+0, 5791, 5791, 0, 84480, 0x505801e9
+0, 5833, 5833, 0, 84480, 0x7947233b
+0, 5875, 5875, 0, 84480, 0x3ce72a9d
+0, 5916, 5916, 0, 84480, 0xa6834e64
+0, 5958, 5958, 0, 84480, 0xfebf4d70
+0, 6000, 6000, 0, 84480, 0x4a0775e2
+0, 6041, 6041, 0, 84480, 0x9d7e945b
+0, 6083, 6083, 0, 84480, 0xaa9eadd9
+0, 6125, 6125, 0, 84480, 0xaa85c9b1
+0, 6166, 6166, 0, 84480, 0xa005edaf
+0, 6208, 6208, 0, 84480, 0x7fc4e5cc
+0, 6250, 6250, 0, 84480, 0xb0f6e8d1
+0, 6291, 6291, 0, 84480, 0x9ef9f330
+0, 6333, 6333, 0, 84480, 0xbe14ff1f
+0, 6375, 6375, 0, 84480, 0xd494048c
+0, 6416, 6416, 0, 84480, 0x046166a7
+0, 6458, 6458, 0, 84480, 0x052a09b2
+0, 6500, 6500, 0, 84480, 0x71fff4ab
+0, 6541, 6541, 0, 84480, 0xb9684e41
+0, 6583, 6583, 0, 84480, 0x1ddce068
+0, 6625, 6625, 0, 84480, 0xb9de300e
+0, 6666, 6666, 0, 84480, 0x13962590
+0, 6708, 6708, 0, 84480, 0xde79482f
+0, 6750, 6750, 0, 84480, 0x7d1ca064
+0, 6791, 6791, 0, 84480, 0x2676a064
diff --git a/gst-libs/ext/libav/tests/ref/fate/wmv8-drm-nodec b/gst-libs/ext/libav/tests/ref/fate/wmv8-drm-nodec
index 1a70fa5..d6bf15e 100644
--- a/gst-libs/ext/libav/tests/ref/fate/wmv8-drm-nodec
+++ b/gst-libs/ext/libav/tests/ref/fate/wmv8-drm-nodec
@@ -1,150 +1,152 @@
-0, 0, 282, 0x000d949a
-1, 0, 1088, 0x5cd379bb
-1, 39150, 1088, 0x8dfa1368
-1, 66600, 1088, 0xc0d211be
-1, 92070, 1088, 0x8238113a
-0, 108720, 137, 0x903c415e
-0, 112500, 942, 0xd5b7d2aa
-0, 116190, 841, 0xaffd8ce6
-1, 117540, 1088, 0x9f8924b7
-0, 119970, 1164, 0x4ed84836
-0, 123750, 1492, 0x37f3e8aa
-0, 127440, 1663, 0xc091392d
-0, 131220, 1443, 0x6162c718
-0, 135000, 1721, 0x7bdb3dd0
-0, 138690, 1410, 0xde689881
-0, 142470, 1258, 0xb5b86920
-1, 143010, 1088, 0x767f317a
-0, 146250, 2050, 0x99b6d7c7
-0, 149940, 1242, 0x9ba35009
-0, 153720, 1630, 0x17f10192
-0, 157500, 1747, 0xbbee59d7
-0, 161190, 1565, 0xb09b00d9
-0, 164970, 1573, 0xd2e62201
-1, 168480, 1088, 0x57000d38
-0, 168750, 1353, 0x2305a24d
-0, 172440, 1425, 0xf41bbb46
-0, 176220, 1355, 0xfc08a762
-0, 180000, 1363, 0x98cda71d
-0, 183690, 1547, 0x8742f11f
-0, 187470, 1967, 0x43d61723
-0, 191250, 1378, 0xde22c753
-0, 194940, 961, 0x2418a4da
-1, 197820, 1088, 0xad977261
-0, 198720, 968, 0x0d04ba51
-0, 202500, 1140, 0x737f3543
-0, 206190, 1119, 0x3c050388
-0, 209970, 1078, 0xeac8d981
-0, 213750, 1113, 0xebfa0314
-0, 217440, 1229, 0x95dc3cb5
-0, 221220, 1311, 0x8a6f5bda
-0, 225000, 1270, 0x2e66540a
-0, 228690, 1408, 0x5f489779
-0, 232470, 1359, 0x8bd085f5
-0, 236250, 1428, 0xef9ba480
-0, 239940, 1179, 0x5bb221a8
-0, 243720, 1108, 0x9a6019a8
-0, 247500, 1205, 0xccba4d22
-0, 251190, 1306, 0xde708c19
-0, 254970, 1724, 0xa70b521e
-0, 258750, 1336, 0xdf3974b9
-0, 262440, 1259, 0x1f6b4307
-0, 266220, 1194, 0x635f5a43
-0, 270000, 1183, 0x1dd47115
-0, 273690, 1126, 0x5bac3cc8
-0, 277470, 1360, 0x1fe2d981
-0, 281250, 1261, 0x34288acb
-0, 284940, 1250, 0x26bd72b3
-0, 288720, 1147, 0x02e81ba0
-0, 292500, 1368, 0xb8146962
-0, 296190, 1377, 0xf7b6ce65
-0, 299970, 1396, 0x88467dee
-0, 303750, 1408, 0x5585c25c
-0, 307440, 1551, 0x42002c8d
-0, 311220, 1524, 0xbcb609e3
-1, 313380, 1088, 0xdce57471
-0, 315000, 1554, 0x3d740564
-0, 318690, 1467, 0xc349f2d7
-0, 322470, 1066, 0xb7401462
-0, 326250, 1502, 0x3ee602ed
-0, 329940, 1148, 0xba463637
-0, 333720, 1351, 0x5e85ae79
-0, 337500, 1187, 0xed8d6055
-0, 341190, 1200, 0x64185be6
-0, 344970, 1175, 0x12ad3c1e
-0, 348750, 1179, 0x7e034570
-0, 352440, 1136, 0x5c633c51
-1, 352620, 1088, 0xf3887977
-0, 356220, 1064, 0x5eb51d89
-0, 360000, 953, 0xe148bbdd
-0, 363690, 989, 0x901ec306
-0, 367470, 1030, 0x680de26f
-0, 371250, 1078, 0x86e0ee43
-0, 374940, 1232, 0x98546a86
-0, 378720, 1164, 0x93305074
-0, 382500, 1348, 0x27cfa91b
-0, 386190, 1417, 0x2312d70e
-0, 389970, 1285, 0x46ca4cca
-1, 391770, 1088, 0x1d6c8ed2
-0, 393750, 1037, 0xcf09dd3d
-0, 397440, 1005, 0xe780cf1f
-0, 401220, 890, 0x8b1d8c1b
-0, 405000, 1023, 0xd1dbd506
-0, 408690, 803, 0x935e775e
-0, 412470, 1035, 0x6a220483
-0, 416250, 466, 0xd88bb237
-1, 431010, 1088, 0x09115bae
-0, 442440, 945, 0x8f2eb1ec
-0, 446220, 1190, 0x4c451c1b
-0, 450000, 1811, 0x727c52cb
-0, 453690, 1552, 0x73f82bff
-0, 457470, 1544, 0xa7241ece
-0, 461250, 1707, 0x3d1a6464
-0, 464940, 1103, 0x06b22710
-0, 468720, 1122, 0x656725b8
-1, 470160, 1088, 0x0c8b9372
-0, 472500, 1150, 0xf9674678
-0, 476190, 1438, 0x03fac426
-0, 479970, 1623, 0x7adb1321
-0, 483750, 1677, 0x0b9a3e62
-0, 487440, 1124, 0x769c0ea2
-0, 491220, 1221, 0xd942409f
-0, 495000, 1698, 0xd7ca3fe3
-0, 498690, 1262, 0xb994692f
-0, 502470, 2097, 0xf4eb663f
-0, 506250, 1251, 0xfd4f633a
-1, 509310, 1088, 0x75a82540
-0, 509940, 1633, 0xb7e1290e
-0, 513720, 1739, 0xecd18c38
-0, 517500, 1132, 0xc83e1828
-0, 521190, 825, 0xdd02867c
-0, 524970, 903, 0x349ba205
-0, 528750, 1013, 0x1366ec2a
-0, 532440, 1340, 0xeaa2a231
-0, 536220, 1102, 0x82de2889
-0, 540000, 1834, 0x59b99b92
-1, 540720, 1088, 0x690312b0
-0, 543690, 1332, 0x0610813a
-0, 547470, 1275, 0x5b0d7be7
-0, 551250, 1376, 0xd915b0fe
-0, 554940, 1417, 0x8606b34a
-0, 558720, 1360, 0x3bcd93d3
-0, 562500, 1330, 0xd0439c93
-0, 566190, 1562, 0xb2560a09
-1, 568080, 1088, 0x76d50ff3
-0, 569970, 1376, 0x4f9eb447
-0, 573750, 1405, 0x85d3b084
-0, 577440, 1344, 0xcdbda2ae
-0, 581220, 1313, 0xe3067b35
-0, 585000, 1459, 0xf9d2c56f
-0, 588690, 1275, 0xf5536d81
-0, 592470, 1209, 0x3b5b4ea5
-1, 593550, 1088, 0x8766276f
-0, 596250, 1352, 0x7b199d28
-0, 599940, 1349, 0x02adaaf3
-0, 603720, 1464, 0x20d7cfd2
-0, 607500, 1377, 0x78e0b1f4
-0, 611190, 289, 0x1f2e9246
-1, 619020, 1088, 0x678f20fd
-1, 644490, 1088, 0x718afa20
-1, 669960, 1088, 0x758f0939
+#tb 0: 1/1000
+#tb 1: 1/1000
+0, 0, 0, 0, 282, 0x000d949a
+1, 0, 0, 0, 1088, 0x5cd379bb
+1, 435, 435, 0, 1088, 0x8dfa1368
+1, 740, 740, 0, 1088, 0xc0d211be
+1, 1023, 1023, 0, 1088, 0x8238113a
+0, 1208, 1208, 0, 137, 0x903c415e
+0, 1250, 1250, 0, 942, 0xd5b7d2aa
+0, 1291, 1291, 0, 841, 0xaffd8ce6
+1, 1306, 1306, 0, 1088, 0x9f8924b7
+0, 1333, 1333, 0, 1164, 0x4ed84836
+0, 1375, 1375, 0, 1492, 0x37f3e8aa
+0, 1416, 1416, 0, 1663, 0xc091392d
+0, 1458, 1458, 0, 1443, 0x6162c718
+0, 1500, 1500, 0, 1721, 0x7bdb3dd0
+0, 1541, 1541, 0, 1410, 0xde689881
+0, 1583, 1583, 0, 1258, 0xb5b86920
+1, 1589, 1589, 0, 1088, 0x767f317a
+0, 1625, 1625, 0, 2050, 0x99b6d7c7
+0, 1666, 1666, 0, 1242, 0x9ba35009
+0, 1708, 1708, 0, 1630, 0x17f10192
+0, 1750, 1750, 0, 1747, 0xbbee59d7
+0, 1791, 1791, 0, 1565, 0xb09b00d9
+0, 1833, 1833, 0, 1573, 0xd2e62201
+1, 1872, 1872, 0, 1088, 0x57000d38
+0, 1875, 1875, 0, 1353, 0x2305a24d
+0, 1916, 1916, 0, 1425, 0xf41bbb46
+0, 1958, 1958, 0, 1355, 0xfc08a762
+0, 2000, 2000, 0, 1363, 0x98cda71d
+0, 2041, 2041, 0, 1547, 0x8742f11f
+0, 2083, 2083, 0, 1967, 0x43d61723
+0, 2125, 2125, 0, 1378, 0xde22c753
+0, 2166, 2166, 0, 961, 0x2418a4da
+1, 2198, 2198, 0, 1088, 0xad977261
+0, 2208, 2208, 0, 968, 0x0d04ba51
+0, 2250, 2250, 0, 1140, 0x737f3543
+0, 2291, 2291, 0, 1119, 0x3c050388
+0, 2333, 2333, 0, 1078, 0xeac8d981
+0, 2375, 2375, 0, 1113, 0xebfa0314
+0, 2416, 2416, 0, 1229, 0x95dc3cb5
+0, 2458, 2458, 0, 1311, 0x8a6f5bda
+0, 2500, 2500, 0, 1270, 0x2e66540a
+0, 2541, 2541, 0, 1408, 0x5f489779
+0, 2583, 2583, 0, 1359, 0x8bd085f5
+0, 2625, 2625, 0, 1428, 0xef9ba480
+0, 2666, 2666, 0, 1179, 0x5bb221a8
+0, 2708, 2708, 0, 1108, 0x9a6019a8
+0, 2750, 2750, 0, 1205, 0xccba4d22
+0, 2791, 2791, 0, 1306, 0xde708c19
+0, 2833, 2833, 41, 1724, 0xa70b521e
+0, 2875, 2875, 41, 1336, 0xdf3974b9
+0, 2916, 2916, 41, 1259, 0x1f6b4307
+0, 2958, 2958, 41, 1194, 0x635f5a43
+0, 3000, 3000, 41, 1183, 0x1dd47115
+0, 3041, 3041, 41, 1126, 0x5bac3cc8
+0, 3083, 3083, 41, 1360, 0x1fe2d981
+0, 3125, 3125, 41, 1261, 0x34288acb
+0, 3166, 3166, 41, 1250, 0x26bd72b3
+0, 3208, 3208, 41, 1147, 0x02e81ba0
+0, 3250, 3250, 41, 1368, 0xb8146962
+0, 3291, 3291, 41, 1377, 0xf7b6ce65
+0, 3333, 3333, 41, 1396, 0x88467dee
+0, 3375, 3375, 41, 1408, 0x5585c25c
+0, 3416, 3416, 41, 1551, 0x42002c8d
+0, 3458, 3458, 41, 1524, 0xbcb609e3
+1, 3482, 3482, 0, 1088, 0xdce57471
+0, 3500, 3500, 41, 1554, 0x3d740564
+0, 3541, 3541, 41, 1467, 0xc349f2d7
+0, 3583, 3583, 41, 1066, 0xb7401462
+0, 3625, 3625, 41, 1502, 0x3ee602ed
+0, 3666, 3666, 41, 1148, 0xba463637
+0, 3708, 3708, 41, 1351, 0x5e85ae79
+0, 3750, 3750, 41, 1187, 0xed8d6055
+0, 3791, 3791, 41, 1200, 0x64185be6
+0, 3833, 3833, 41, 1175, 0x12ad3c1e
+0, 3875, 3875, 41, 1179, 0x7e034570
+0, 3916, 3916, 41, 1136, 0x5c633c51
+1, 3918, 3918, 0, 1088, 0xf3887977
+0, 3958, 3958, 41, 1064, 0x5eb51d89
+0, 4000, 4000, 41, 953, 0xe148bbdd
+0, 4041, 4041, 41, 989, 0x901ec306
+0, 4083, 4083, 41, 1030, 0x680de26f
+0, 4125, 4125, 41, 1078, 0x86e0ee43
+0, 4166, 4166, 41, 1232, 0x98546a86
+0, 4208, 4208, 41, 1164, 0x93305074
+0, 4250, 4250, 41, 1348, 0x27cfa91b
+0, 4291, 4291, 41, 1417, 0x2312d70e
+0, 4333, 4333, 41, 1285, 0x46ca4cca
+1, 4353, 4353, 0, 1088, 0x1d6c8ed2
+0, 4375, 4375, 41, 1037, 0xcf09dd3d
+0, 4416, 4416, 41, 1005, 0xe780cf1f
+0, 4458, 4458, 41, 890, 0x8b1d8c1b
+0, 4500, 4500, 41, 1023, 0xd1dbd506
+0, 4541, 4541, 41, 803, 0x935e775e
+0, 4583, 4583, 41, 1035, 0x6a220483
+0, 4625, 4625, 41, 466, 0xd88bb237
+1, 4789, 4789, 0, 1088, 0x09115bae
+0, 4916, 4916, 41, 945, 0x8f2eb1ec
+0, 4958, 4958, 41, 1190, 0x4c451c1b
+0, 5000, 5000, 41, 1811, 0x727c52cb
+0, 5041, 5041, 41, 1552, 0x73f82bff
+0, 5083, 5083, 41, 1544, 0xa7241ece
+0, 5125, 5125, 41, 1707, 0x3d1a6464
+0, 5166, 5166, 41, 1103, 0x06b22710
+0, 5208, 5208, 41, 1122, 0x656725b8
+1, 5224, 5224, 0, 1088, 0x0c8b9372
+0, 5250, 5250, 41, 1150, 0xf9674678
+0, 5291, 5291, 41, 1438, 0x03fac426
+0, 5333, 5333, 41, 1623, 0x7adb1321
+0, 5375, 5375, 41, 1677, 0x0b9a3e62
+0, 5416, 5416, 41, 1124, 0x769c0ea2
+0, 5458, 5458, 41, 1221, 0xd942409f
+0, 5500, 5500, 41, 1698, 0xd7ca3fe3
+0, 5541, 5541, 41, 1262, 0xb994692f
+0, 5583, 5583, 41, 2097, 0xf4eb663f
+0, 5625, 5625, 41, 1251, 0xfd4f633a
+1, 5659, 5659, 0, 1088, 0x75a82540
+0, 5666, 5666, 41, 1633, 0xb7e1290e
+0, 5708, 5708, 41, 1739, 0xecd18c38
+0, 5750, 5750, 41, 1132, 0xc83e1828
+0, 5791, 5791, 41, 825, 0xdd02867c
+0, 5833, 5833, 41, 903, 0x349ba205
+0, 5875, 5875, 41, 1013, 0x1366ec2a
+0, 5916, 5916, 41, 1340, 0xeaa2a231
+0, 5958, 5958, 41, 1102, 0x82de2889
+0, 6000, 6000, 41, 1834, 0x59b99b92
+1, 6008, 6008, 0, 1088, 0x690312b0
+0, 6041, 6041, 41, 1332, 0x0610813a
+0, 6083, 6083, 41, 1275, 0x5b0d7be7
+0, 6125, 6125, 41, 1376, 0xd915b0fe
+0, 6166, 6166, 41, 1417, 0x8606b34a
+0, 6208, 6208, 41, 1360, 0x3bcd93d3
+0, 6250, 6250, 41, 1330, 0xd0439c93
+0, 6291, 6291, 41, 1562, 0xb2560a09
+1, 6312, 6312, 0, 1088, 0x76d50ff3
+0, 6333, 6333, 41, 1376, 0x4f9eb447
+0, 6375, 6375, 41, 1405, 0x85d3b084
+0, 6416, 6416, 41, 1344, 0xcdbda2ae
+0, 6458, 6458, 41, 1313, 0xe3067b35
+0, 6500, 6500, 41, 1459, 0xf9d2c56f
+0, 6541, 6541, 41, 1275, 0xf5536d81
+0, 6583, 6583, 41, 1209, 0x3b5b4ea5
+1, 6595, 6595, 0, 1088, 0x8766276f
+0, 6625, 6625, 41, 1352, 0x7b199d28
+0, 6666, 6666, 41, 1349, 0x02adaaf3
+0, 6708, 6708, 41, 1464, 0x20d7cfd2
+0, 6750, 6750, 41, 1377, 0x78e0b1f4
+0, 6791, 6791, 41, 289, 0x1f2e9246
+1, 6878, 6878, 0, 1088, 0x678f20fd
+1, 7161, 7161, 0, 1088, 0x718afa20
+1, 7444, 7444, 0, 1088, 0x758f0939
diff --git a/gst-libs/ext/libav/tests/ref/fate/wnv1 b/gst-libs/ext/libav/tests/ref/fate/wnv1
index e7fd7ae..4de35bf 100644
--- a/gst-libs/ext/libav/tests/ref/fate/wnv1
+++ b/gst-libs/ext/libav/tests/ref/fate/wnv1
@@ -1,86 +1,87 @@
-0, 0, 38400, 0x4c3fdc2f
-0, 6000, 38400, 0x11c9d0cb
-0, 12000, 38400, 0x6c37fd7f
-0, 18000, 38400, 0x7e6c9b93
-0, 23999, 38400, 0xc9d4c5f7
-0, 29999, 38400, 0x5038088a
-0, 35999, 38400, 0xa48411b6
-0, 41999, 38400, 0xb9b7e97b
-0, 47999, 38400, 0xce37e037
-0, 53999, 38400, 0x5df528da
-0, 59999, 38400, 0xe4e65876
-0, 65998, 38400, 0x5bf4a46e
-0, 71998, 38400, 0xee478c2a
-0, 77998, 38400, 0x51a555c2
-0, 83998, 38400, 0x30a4030a
-0, 89998, 38400, 0xb13802d6
-0, 95998, 38400, 0x45ef5482
-0, 101997, 38400, 0x00aef51b
-0, 107997, 38400, 0xe8a71d7e
-0, 113997, 38400, 0x3d185142
-0, 119997, 38400, 0x221f59ea
-0, 125997, 38400, 0x1ae13572
-0, 131997, 38400, 0xe498450e
-0, 137997, 38400, 0xe744747a
-0, 143996, 38400, 0x44ee3352
-0, 149996, 38400, 0x74187342
-0, 155996, 38400, 0xbee9656e
-0, 161996, 38400, 0x645c8d1a
-0, 167996, 38400, 0x443dde1e
-0, 173996, 38400, 0x012106fd
-0, 179996, 38400, 0x4bb86b82
-0, 185995, 38400, 0x152473ba
-0, 191995, 38400, 0xa5214ea2
-0, 197995, 38400, 0x9e8c7046
-0, 203995, 38400, 0xdd95a9ba
-0, 209995, 38400, 0x64c5f292
-0, 215995, 38400, 0xdd42a04a
-0, 221994, 38400, 0x6069359e
-0, 227994, 38400, 0x094bf60f
-0, 233994, 38400, 0x584217be
-0, 239994, 38400, 0x4c5ef453
-0, 245994, 38400, 0x7e83eeb7
-0, 251994, 38400, 0xaa57efb3
-0, 257994, 38400, 0x42b0a66f
-0, 263993, 38400, 0x371fdcbf
-0, 269993, 38400, 0xb8f1e1bf
-0, 275993, 38400, 0x45c91fa6
-0, 281993, 38400, 0x7508338e
-0, 287993, 38400, 0xb5dd91ab
-0, 293993, 38400, 0x0204b38f
-0, 299993, 38400, 0x8ae2da6f
-0, 305992, 38400, 0x926ad59f
-0, 311992, 38400, 0xf9c3234e
-0, 317992, 38400, 0xabcb00f6
-0, 323992, 38400, 0x2d1de7bb
-0, 329992, 38400, 0x332d39ce
-0, 335992, 38400, 0xcd767286
-0, 341991, 38400, 0xf3d046ae
-0, 347991, 38400, 0x7ccc8162
-0, 353991, 38400, 0x09f6997e
-0, 359991, 38400, 0x5fcc6536
-0, 365991, 38400, 0x9959a3b6
-0, 371991, 38400, 0x63a5dcd2
-0, 377991, 38400, 0x66deae96
-0, 383990, 38400, 0x6feb0b1d
-0, 389990, 38400, 0x2063c25e
-0, 395990, 38400, 0x617f93de
-0, 401990, 38400, 0x4251c806
-0, 407990, 38400, 0x702eb68e
-0, 413990, 38400, 0xe80b8ea6
-0, 419990, 38400, 0xa51ec1b2
-0, 425989, 38400, 0x8aa8af8a
-0, 431989, 38400, 0x9a260321
-0, 437989, 38400, 0x2c732c22
-0, 443989, 38400, 0x216ed6a2
-0, 449989, 38400, 0x5558326d
-0, 455989, 38400, 0x0cae4cf5
-0, 461988, 38400, 0xf0e02f3d
-0, 467988, 38400, 0xfddd061d
-0, 473988, 38400, 0x4563e9d6
-0, 479988, 38400, 0xc8ac10d1
-0, 485988, 38400, 0x97f8c3fa
-0, 491988, 38400, 0x86190eb1
-0, 497988, 38400, 0xc9022d65
-0, 503987, 38400, 0x345738d5
-0, 509987, 38400, 0x457ae80e
+#tb 0: 13333/200000
+0, 0, 0, 1, 38400, 0x4c3fdc2f
+0, 1, 1, 1, 38400, 0x11c9d0cb
+0, 2, 2, 1, 38400, 0x6c37fd7f
+0, 3, 3, 1, 38400, 0x7e6c9b93
+0, 4, 4, 1, 38400, 0xc9d4c5f7
+0, 5, 5, 1, 38400, 0x5038088a
+0, 6, 6, 1, 38400, 0xa48411b6
+0, 7, 7, 1, 38400, 0xb9b7e97b
+0, 8, 8, 1, 38400, 0xce37e037
+0, 9, 9, 1, 38400, 0x5df528da
+0, 10, 10, 1, 38400, 0xe4e65876
+0, 11, 11, 1, 38400, 0x5bf4a46e
+0, 12, 12, 1, 38400, 0xee478c2a
+0, 13, 13, 1, 38400, 0x51a555c2
+0, 14, 14, 1, 38400, 0x30a4030a
+0, 15, 15, 1, 38400, 0xb13802d6
+0, 16, 16, 1, 38400, 0x45ef5482
+0, 17, 17, 1, 38400, 0x00aef51b
+0, 18, 18, 1, 38400, 0xe8a71d7e
+0, 19, 19, 1, 38400, 0x3d185142
+0, 20, 20, 1, 38400, 0x221f59ea
+0, 21, 21, 1, 38400, 0x1ae13572
+0, 22, 22, 1, 38400, 0xe498450e
+0, 23, 23, 1, 38400, 0xe744747a
+0, 24, 24, 1, 38400, 0x44ee3352
+0, 25, 25, 1, 38400, 0x74187342
+0, 26, 26, 1, 38400, 0xbee9656e
+0, 27, 27, 1, 38400, 0x645c8d1a
+0, 28, 28, 1, 38400, 0x443dde1e
+0, 29, 29, 1, 38400, 0x012106fd
+0, 30, 30, 1, 38400, 0x4bb86b82
+0, 31, 31, 1, 38400, 0x152473ba
+0, 32, 32, 1, 38400, 0xa5214ea2
+0, 33, 33, 1, 38400, 0x9e8c7046
+0, 34, 34, 1, 38400, 0xdd95a9ba
+0, 35, 35, 1, 38400, 0x64c5f292
+0, 36, 36, 1, 38400, 0xdd42a04a
+0, 37, 37, 1, 38400, 0x6069359e
+0, 38, 38, 1, 38400, 0x094bf60f
+0, 39, 39, 1, 38400, 0x584217be
+0, 40, 40, 1, 38400, 0x4c5ef453
+0, 41, 41, 1, 38400, 0x7e83eeb7
+0, 42, 42, 1, 38400, 0xaa57efb3
+0, 43, 43, 1, 38400, 0x42b0a66f
+0, 44, 44, 1, 38400, 0x371fdcbf
+0, 45, 45, 1, 38400, 0xb8f1e1bf
+0, 46, 46, 1, 38400, 0x45c91fa6
+0, 47, 47, 1, 38400, 0x7508338e
+0, 48, 48, 1, 38400, 0xb5dd91ab
+0, 49, 49, 1, 38400, 0x0204b38f
+0, 50, 50, 1, 38400, 0x8ae2da6f
+0, 51, 51, 1, 38400, 0x926ad59f
+0, 52, 52, 1, 38400, 0xf9c3234e
+0, 53, 53, 1, 38400, 0xabcb00f6
+0, 54, 54, 1, 38400, 0x2d1de7bb
+0, 55, 55, 1, 38400, 0x332d39ce
+0, 56, 56, 1, 38400, 0xcd767286
+0, 57, 57, 1, 38400, 0xf3d046ae
+0, 58, 58, 1, 38400, 0x7ccc8162
+0, 59, 59, 1, 38400, 0x09f6997e
+0, 60, 60, 1, 38400, 0x5fcc6536
+0, 61, 61, 1, 38400, 0x9959a3b6
+0, 62, 62, 1, 38400, 0x63a5dcd2
+0, 63, 63, 1, 38400, 0x66deae96
+0, 64, 64, 1, 38400, 0x6feb0b1d
+0, 65, 65, 1, 38400, 0x2063c25e
+0, 66, 66, 1, 38400, 0x617f93de
+0, 67, 67, 1, 38400, 0x4251c806
+0, 68, 68, 1, 38400, 0x702eb68e
+0, 69, 69, 1, 38400, 0xe80b8ea6
+0, 70, 70, 1, 38400, 0xa51ec1b2
+0, 71, 71, 1, 38400, 0x8aa8af8a
+0, 72, 72, 1, 38400, 0x9a260321
+0, 73, 73, 1, 38400, 0x2c732c22
+0, 74, 74, 1, 38400, 0x216ed6a2
+0, 75, 75, 1, 38400, 0x5558326d
+0, 76, 76, 1, 38400, 0x0cae4cf5
+0, 77, 77, 1, 38400, 0xf0e02f3d
+0, 78, 78, 1, 38400, 0xfddd061d
+0, 79, 79, 1, 38400, 0x4563e9d6
+0, 80, 80, 1, 38400, 0xc8ac10d1
+0, 81, 81, 1, 38400, 0x97f8c3fa
+0, 82, 82, 1, 38400, 0x86190eb1
+0, 83, 83, 1, 38400, 0xc9022d65
+0, 84, 84, 1, 38400, 0x345738d5
+0, 85, 85, 1, 38400, 0x457ae80e
diff --git a/gst-libs/ext/libav/tests/ref/fate/wtv-demux b/gst-libs/ext/libav/tests/ref/fate/wtv-demux
index b3744ee..bdd6c20 100644
--- a/gst-libs/ext/libav/tests/ref/fate/wtv-demux
+++ b/gst-libs/ext/libav/tests/ref/fate/wtv-demux
@@ -1,139 +1,141 @@
-1, 0, 576, 0x9b6e1638
-1, 1620, 576, 0x0ca91183
-1, 3780, 576, 0xec6a180f
-1, 5940, 576, 0x478a2b9b
-1, 8100, 576, 0x00fa15b3
-1, 10260, 576, 0xfb551816
-1, 12960, 576, 0x422e12bd
-1, 15120, 576, 0xa7581b29
-1, 17280, 576, 0xd4b31a74
-1, 19440, 576, 0x11521b10
-1, 21600, 576, 0x3dcc1474
-1, 23760, 576, 0x66c31aab
-1, 25920, 576, 0x97f318a8
-1, 28080, 576, 0xd3fb1a30
-1, 30240, 576, 0xd2bd16af
-1, 32400, 576, 0x6c10146a
-1, 34560, 576, 0x10d81468
-1, 36720, 576, 0x3813162d
-1, 38880, 576, 0x89e71d95
-1, 41040, 576, 0xd1c717f9
-1, 43200, 576, 0x1a311e5f
-1, 45360, 576, 0x0ea80e05
-1, 47520, 576, 0x2f1718f2
-1, 49680, 576, 0xffe01e13
-1, 51840, 576, 0xa7b02296
-1, 54000, 576, 0x199f1597
-1, 56160, 576, 0xdea217ba
-1, 58320, 576, 0x8a790f01
-1, 60480, 576, 0x23e80038
-1, 62640, 576, 0x75dc048a
-1, 64800, 576, 0xeb4b0d93
-1, 66960, 576, 0xde1322f5
-1, 69120, 576, 0xc3131f35
-1, 71280, 576, 0x708f1381
-1, 73440, 576, 0x1f00137e
-0, 74578, 41980, 0xd4920915
-1, 75600, 576, 0x05131eb0
-1, 77760, 576, 0x78151c22
-0, 78178, 7228, 0x1b141fa3
-1, 79920, 576, 0x31771239
-0, 81777, 7492, 0x1a47f3e4
-1, 82080, 576, 0x3ce4097c
-1, 84240, 576, 0x180e15f4
-0, 85378, 25068, 0xcb70a744
-1, 86400, 576, 0x30db0604
-1, 88560, 576, 0x9b290284
-0, 88978, 7212, 0x0ab9f558
-1, 90720, 576, 0xcf340753
-0, 92578, 7612, 0xa93054f0
-1, 92880, 576, 0xdaa41457
-1, 95040, 576, 0x34d310a2
-0, 96177, 22868, 0xa77db64a
-1, 97200, 576, 0x58b31010
-1, 99360, 576, 0x19610f54
-0, 99778, 6260, 0x6cf76411
-1, 101520, 576, 0x17762352
-0, 103377, 6156, 0xe168394b
-1, 103680, 576, 0x1fea1448
-1, 105840, 576, 0x55840a01
-0, 106977, 23364, 0x53164f1e
-1, 108000, 576, 0x6c9c24ce
-1, 110160, 576, 0x955f1e97
-0, 110578, 6708, 0x89877269
-1, 112320, 576, 0x2827134f
-0, 114178, 6908, 0x8d62a249
-1, 114480, 576, 0x34a01c29
-1, 116640, 576, 0x7d351e52
-0, 117778, 38156, 0xec41f682
-1, 118800, 576, 0x00c91d9e
-1, 120960, 576, 0x57ea1a97
-0, 121377, 5764, 0xcc04534b
-1, 123120, 576, 0xef3a1c74
-0, 124977, 5388, 0xb8a1c3c5
-1, 125280, 576, 0x11fc217d
-1, 127440, 576, 0x59ce20e5
-0, 128578, 16764, 0x59460d96
-1, 129600, 576, 0xaafc1dbf
-1, 131760, 576, 0xdd941609
-0, 132177, 5548, 0x5c91e93d
-1, 133920, 576, 0x900420b0
-0, 135777, 5652, 0x5e321aed
-1, 136080, 576, 0x5f4f1aa1
-1, 138240, 576, 0x7d7e18de
-0, 139377, 15564, 0xefdf5080
-1, 140400, 576, 0x986c0d9d
-1, 142560, 576, 0xcb4c21c0
-0, 142977, 6492, 0xd1d5c5f8
-1, 144720, 576, 0xbcfb1e8b
-0, 146577, 5604, 0xf9472b44
-1, 146880, 576, 0xcb541b4c
-1, 149040, 576, 0x980426e9
-0, 150177, 17924, 0x45815b7b
-1, 151200, 576, 0x09d00aa0
-1, 153360, 576, 0xad591374
-0, 153778, 5020, 0x3cc5e554
-1, 155520, 576, 0x97bf1461
-0, 157378, 5276, 0xa0554c12
-1, 157680, 576, 0xdc871cc4
-1, 159840, 576, 0x56781896
-0, 160977, 31460, 0x5765eb5f
-1, 162000, 576, 0xc77714e3
-1, 164160, 576, 0x280e18d4
-0, 164577, 4972, 0x91adbab7
-1, 166320, 576, 0xbc0d2302
-0, 168178, 5580, 0xfea707cb
-1, 168480, 576, 0x79191384
-1, 170640, 576, 0x65481c97
-0, 171778, 17412, 0x0afe4d27
-1, 172800, 576, 0xc94d227d
-1, 174960, 576, 0xa68a1f14
-0, 175378, 5236, 0x03f55309
-1, 177120, 576, 0x6af11a5c
-0, 178977, 4924, 0x558e753c
-1, 179280, 576, 0x4d1019ef
-1, 181440, 576, 0x3b1b17b5
-0, 182577, 15396, 0xf145d121
-1, 183600, 576, 0xcdd8159f
-1, 185760, 576, 0x97cd1d06
-0, 186177, 4708, 0x43066a92
-1, 187920, 576, 0x5d1b1123
-0, 189778, 4332, 0x9e22bcba
-1, 190080, 576, 0x888d0cb0
-1, 192240, 576, 0x556e1dad
-0, 193377, 12876, 0x46ff9ef4
-1, 194400, 576, 0xf7af0bce
-1, 196560, 576, 0xb5da160a
-0, 196978, 5940, 0x27cba62e
-1, 198720, 576, 0x4a8d0e98
-0, 200578, 6124, 0x6bab0a6d
-1, 200880, 576, 0x183b1c7e
-1, 203040, 576, 0xc47120e6
-0, 204178, 36428, 0x942f9648
-1, 205200, 576, 0xb1f31346
-0, 207777, 6660, 0x545a0db7
-0, 211377, 6780, 0x2d1d4189
-0, 214978, 16460, 0x7c3b3ca4
-0, 218578, 6724, 0x8538cc6f
-0, 222178, 7068, 0x69574fd0
-0, 225777, 19552, 0xf230e854
+#tb 0: 1/10000000
+#tb 1: 1/10000000
+1, -2, -2, 240000, 576, 0x9b6e1638
+1, 239998, 239998, 240000, 576, 0x0ca91183
+1, 479998, 479998, 240000, 576, 0xec6a180f
+1, 719998, 719998, 240000, 576, 0x478a2b9b
+1, 959998, 959998, 240000, 576, 0x00fa15b3
+1, 1199998, 1199998, 240000, 576, 0xfb551816
+1, 1439998, 1439998, 240000, 576, 0x422e12bd
+1, 1679998, 1679998, 240000, 576, 0xa7581b29
+1, 1919998, 1919998, 240000, 576, 0xd4b31a74
+1, 2159998, 2159998, 240000, 576, 0x11521b10
+1, 2399998, 2399998, 240000, 576, 0x3dcc1474
+1, 2639998, 2639998, 240000, 576, 0x66c31aab
+1, 2879998, 2879998, 240000, 576, 0x97f318a8
+1, 3119998, 3119998, 240000, 576, 0xd3fb1a30
+1, 3359998, 3359998, 240000, 576, 0xd2bd16af
+1, 3599998, 3599998, 240000, 576, 0x6c10146a
+1, 3839998, 3839998, 240000, 576, 0x10d81468
+1, 4079998, 4079998, 240000, 576, 0x3813162d
+1, 4319998, 4319998, 240000, 576, 0x89e71d95
+1, 4559998, 4559998, 240000, 576, 0xd1c717f9
+1, 4799998, 4799998, 240000, 576, 0x1a311e5f
+1, 5039998, 5039998, 240000, 576, 0x0ea80e05
+1, 5279998, 5279998, 240000, 576, 0x2f1718f2
+1, 5519998, 5519998, 240000, 576, 0xffe01e13
+1, 5759998, 5759998, 240000, 576, 0xa7b02296
+1, 5999998, 5999998, 240000, 576, 0x199f1597
+1, 6239998, 6239998, 240000, 576, 0xdea217ba
+1, 6479998, 6479998, 240000, 576, 0x8a790f01
+1, 6719998, 6719998, 240000, 576, 0x23e80038
+1, 6959998, 6959998, 240000, 576, 0x75dc048a
+1, 7199998, 7199998, 240000, 576, 0xeb4b0d93
+1, 7439998, 7439998, 240000, 576, 0xde1322f5
+1, 7679998, 7679998, 240000, 576, 0xc3131f35
+0, 7886331, 9486442, 400000, 41980, 0xd4920915
+1, 7919998, 7919998, 240000, 576, 0x708f1381
+1, 8159998, 8159998, 240000, 576, 0x1f00137e
+1, 8399998, 8399998, 240000, 576, 0x05131eb0
+1, 8639998, 8639998, 240000, 576, 0x78151c22
+0, 8686442, 8686442, 400000, 7228, 0x1b141fa3
+1, 8879998, 8879998, 240000, 576, 0x31771239
+0, 9086331, 9086331, 400000, 7492, 0x1a47f3e4
+1, 9119998, 9119998, 240000, 576, 0x3ce4097c
+1, 9359998, 9359998, 240000, 576, 0x180e15f4
+0, 9486442, 10686331, 400000, 25068, 0xcb70a744
+1, 9599998, 9599998, 240000, 576, 0x30db0604
+1, 9839998, 9839998, 240000, 576, 0x9b290284
+0, 9886442, 9886442, 400000, 7212, 0x0ab9f558
+1, 10079998, 10079998, 240000, 576, 0xcf340753
+0, 10286442, 10286442, 400000, 7612, 0xa93054f0
+1, 10319998, 10319998, 240000, 576, 0xdaa41457
+1, 10559998, 10559998, 240000, 576, 0x34d310a2
+0, 10686331, 11886331, 400000, 22868, 0xa77db64a
+1, 10799998, 10799998, 240000, 576, 0x58b31010
+1, 11039998, 11039998, 240000, 576, 0x19610f54
+0, 11086442, 11086442, 400000, 6260, 0x6cf76411
+1, 11279998, 11279998, 240000, 576, 0x17762352
+0, 11486331, 11486331, 400000, 6156, 0xe168394b
+1, 11519998, 11519998, 240000, 576, 0x1fea1448
+1, 11759998, 11759998, 240000, 576, 0x55840a01
+0, 11886331, 13086442, 449438, 23364, 0x53164f1e
+1, 11999998, 11999998, 240000, 576, 0x6c9c24ce
+1, 12239998, 12239998, 240000, 576, 0x955f1e97
+0, 12286442, 12286442, 449438, 6708, 0x89877269
+1, 12479998, 12479998, 240000, 576, 0x2827134f
+0, 12686442, 12686442, 449438, 6908, 0x8d62a249
+1, 12719998, 12719998, 240000, 576, 0x34a01c29
+1, 12959998, 12959998, 240000, 576, 0x7d351e52
+0, 13086442, 14286442, 449438, 38156, 0xec41f682
+1, 13199998, 13199998, 240000, 576, 0x00c91d9e
+1, 13439998, 13439998, 240000, 576, 0x57ea1a97
+0, 13486331, 13486331, 449438, 5764, 0xcc04534b
+1, 13679998, 13679998, 240000, 576, 0xef3a1c74
+0, 13886331, 13886331, 449438, 5388, 0xb8a1c3c5
+1, 13919998, 13919998, 240000, 576, 0x11fc217d
+1, 14159998, 14159998, 240000, 576, 0x59ce20e5
+0, 14286442, 15486331, 449438, 16764, 0x59460d96
+1, 14399998, 14399998, 240000, 576, 0xaafc1dbf
+1, 14639998, 14639998, 240000, 576, 0xdd941609
+0, 14686331, 14686331, 449438, 5548, 0x5c91e93d
+1, 14879998, 14879998, 240000, 576, 0x900420b0
+0, 15086331, 15086331, 449438, 5652, 0x5e321aed
+1, 15119998, 15119998, 240000, 576, 0x5f4f1aa1
+1, 15359998, 15359998, 240000, 576, 0x7d7e18de
+0, 15486331, 16686331, 449438, 15564, 0xefdf5080
+1, 15599998, 15599998, 240000, 576, 0x986c0d9d
+1, 15839998, 15839998, 240000, 576, 0xcb4c21c0
+0, 15886331, 15886331, 449438, 6492, 0xd1d5c5f8
+1, 16079998, 16079998, 240000, 576, 0xbcfb1e8b
+0, 16286331, 16286331, 449438, 5604, 0xf9472b44
+1, 16319998, 16319998, 240000, 576, 0xcb541b4c
+1, 16559998, 16559998, 240000, 576, 0x980426e9
+0, 16686331, 17886331, 449438, 17924, 0x45815b7b
+1, 16799998, 16799998, 240000, 576, 0x09d00aa0
+1, 17039998, 17039998, 240000, 576, 0xad591374
+0, 17086442, 17086442, 449438, 5020, 0x3cc5e554
+1, 17279998, 17279998, 240000, 576, 0x97bf1461
+0, 17486442, 17486442, 449438, 5276, 0xa0554c12
+1, 17519998, 17519998, 240000, 576, 0xdc871cc4
+1, 17759998, 17759998, 240000, 576, 0x56781896
+0, 17886331, 19086442, 449438, 31460, 0x5765eb5f
+1, 17999998, 17999998, 240000, 576, 0xc77714e3
+1, 18239998, 18239998, 240000, 576, 0x280e18d4
+0, 18286331, 18286331, 449438, 4972, 0x91adbab7
+1, 18479998, 18479998, 240000, 576, 0xbc0d2302
+0, 18686442, 18686442, 449438, 5580, 0xfea707cb
+1, 18719998, 18719998, 240000, 576, 0x79191384
+1, 18959998, 18959998, 240000, 576, 0x65481c97
+0, 19086442, 20286331, 449438, 17412, 0x0afe4d27
+1, 19199998, 19199998, 240000, 576, 0xc94d227d
+1, 19439998, 19439998, 240000, 576, 0xa68a1f14
+0, 19486442, 19486442, 449438, 5236, 0x03f55309
+1, 19679998, 19679998, 240000, 576, 0x6af11a5c
+0, 19886331, 19886331, 449438, 4924, 0x558e753c
+1, 19919998, 19919998, 240000, 576, 0x4d1019ef
+1, 20159998, 20159998, 240000, 576, 0x3b1b17b5
+0, 20286331, 21486331, 449438, 15396, 0xf145d121
+1, 20399998, 20399998, 240000, 576, 0xcdd8159f
+1, 20639998, 20639998, 240000, 576, 0x97cd1d06
+0, 20686331, 20686331, 449438, 4708, 0x43066a92
+1, 20879998, 20879998, 240000, 576, 0x5d1b1123
+0, 21086442, 21086442, 449438, 4332, 0x9e22bcba
+1, 21119998, 21119998, 240000, 576, 0x888d0cb0
+1, 21359998, 21359998, 240000, 576, 0x556e1dad
+0, 21486331, 22686442, 449438, 12876, 0x46ff9ef4
+1, 21599998, 21599998, 240000, 576, 0xf7af0bce
+1, 21839998, 21839998, 240000, 576, 0xb5da160a
+0, 21886442, 21886442, 449438, 5940, 0x27cba62e
+1, 22079998, 22079998, 240000, 576, 0x4a8d0e98
+0, 22286442, 22286442, 449438, 6124, 0x6bab0a6d
+1, 22319998, 22319998, 240000, 576, 0x183b1c7e
+1, 22559998, 22559998, 240000, 576, 0xc47120e6
+0, 22686442, 23886442, 449438, 36428, 0x942f9648
+1, 22799998, 22799998, 240000, 576, 0xb1f31346
+0, 23086331, 23086331, 449438, 6660, 0x545a0db7
+0, 23486331, 23486331, 449438, 6780, 0x2d1d4189
+0, 23886442, 25086331, 449438, 16460, 0x7c3b3ca4
+0, 24286442, 24286442, 449438, 6724, 0x8538cc6f
+0, 24686442, 24686442, 449438, 7068, 0x69574fd0
+0, 25086331, 26286331, 449438, 19552, 0xf230e854
diff --git a/gst-libs/ext/libav/tests/ref/fate/xmv-demux b/gst-libs/ext/libav/tests/ref/fate/xmv-demux
index 887b855..20c6ac1 100644
--- a/gst-libs/ext/libav/tests/ref/fate/xmv-demux
+++ b/gst-libs/ext/libav/tests/ref/fate/xmv-demux
@@ -1,181 +1,183 @@
-0, 0, 1508, 0xefceba48
-1, 0, 5976, 0xfa2c2db9
-1, 10841, 5976, 0x256b935c
-1, 21682, 5976, 0xa78a9563
-1, 32522, 5976, 0x4ea056f4
-1, 43363, 5976, 0xda772d8d
-1, 54204, 5976, 0xafacf7c9
-0, 57600, 108, 0x06713c96
-0, 61200, 952, 0xd306df7e
-0, 64800, 2312, 0xaf316585
-1, 65045, 5976, 0xdeb003f4
-0, 68400, 3872, 0xfc1c527c
-0, 72000, 20, 0xaffc0edd
-0, 75600, 6600, 0xe1b66c7f
-1, 75886, 2016, 0xa7380d36
-0, 79200, 6868, 0xd5b3f631
-1, 79543, 2016, 0xbc090bac
-0, 82800, 8420, 0xf70ee33b
-1, 83200, 2016, 0x6f8c164c
-0, 86400, 13144, 0x9a54ef39
-1, 86857, 2016, 0x13b80e28
-0, 90000, 6340, 0xe55bf555
-1, 90514, 2016, 0xd40ff863
-0, 93600, 3736, 0x0b23f89f
-1, 94171, 2016, 0x4d530ed7
-0, 97200, 2624, 0x79e2e451
-1, 97829, 2160, 0x0fbc37eb
-0, 100800, 1860, 0x63886f11
-1, 101747, 13824, 0x82fb2602
-0, 104400, 1244, 0x74594601
-0, 108000, 564, 0xf4561dfb
-0, 111600, 80, 0xbf8e2e30
-0, 115200, 20, 0xa0990c29
-1, 126824, 13824, 0x08771caf
-1, 151902, 13824, 0xdf7d4a65
-1, 176980, 13896, 0x24bf3f47
-1, 202188, 3600, 0x9ad26b9f
-1, 208718, 3600, 0x8c666fd6
-1, 215249, 3600, 0x305c6ca1
-1, 221780, 3600, 0x48b04e1e
-0, 223200, 104, 0x12413980
-0, 226800, 796, 0x2e698ed3
-1, 228310, 3600, 0x8c915935
-0, 230400, 1808, 0x8b3e6e5e
-0, 234000, 4712, 0xdbd51737
-1, 234841, 3600, 0xa8f45e01
-0, 237600, 5548, 0xee9c831c
-0, 241200, 6152, 0x9c18ccc1
-1, 241371, 3816, 0xc64cc5ed
-0, 244800, 6452, 0x7860462a
-1, 248294, 1944, 0x0ac2e3f1
-0, 248400, 6676, 0xe1b1c9e4
-1, 251820, 1944, 0x2197dccd
-0, 252000, 10904, 0x0bded7b7
-1, 255347, 1944, 0x0c02e77f
-0, 255600, 12844, 0xe6d16cff
-1, 258873, 1944, 0x675ee06a
-0, 259200, 10920, 0xe114c46b
-1, 262400, 2160, 0x0d803a8b
-0, 262800, 5952, 0xb7464634
-1, 266318, 6696, 0xa7a0dfea
-0, 266400, 4732, 0x2fa2e36d
-0, 270000, 2592, 0xf54ddd57
-0, 273600, 1516, 0x4a1cd4d5
-0, 277200, 864, 0x49889afc
-1, 278465, 6696, 0x59aa3145
-0, 280800, 468, 0x3932e6a4
-0, 284400, 116, 0x2b8341e6
-0, 288000, 16, 0x6a3109cf
-1, 290612, 6696, 0x69be4d78
-1, 302759, 6696, 0x64064c67
-1, 314906, 6696, 0xc8536f98
-1, 327053, 6696, 0xc0ce5199
-1, 339200, 6768, 0x3b275c58
-1, 351478, 8856, 0x90e5b37c
-0, 360000, 1508, 0xefceba48
-1, 367543, 8856, 0x86b33366
-1, 383608, 8856, 0x19e18797
-1, 399673, 8856, 0x0a0c7fbd
-1, 415739, 8928, 0x4a9b2d42
-0, 417600, 100, 0x45023894
-0, 421200, 948, 0xa65ed345
-0, 424800, 2808, 0xd7285746
-0, 428400, 5372, 0x05794175
-1, 431935, 1512, 0xed8b3f4b
-0, 432000, 11596, 0x8636eca7
-1, 434678, 1512, 0xa27d3891
-0, 435600, 11524, 0xe1f39be3
-1, 437420, 1512, 0xb0f13eb6
-0, 439200, 23392, 0xab053f05
-1, 440163, 1656, 0xe5a98324
-0, 442800, 4560, 0x03197d07
-1, 443167, 2232, 0x15445433
-0, 446400, 4440, 0x1cc361a2
-1, 447216, 2232, 0x5cb348a9
-0, 450000, 23688, 0x16030634
-1, 451265, 2232, 0xf10347da
-0, 453600, 16132, 0xf0eca799
-1, 455314, 2448, 0x3e16a175
-0, 457200, 29896, 0x0c0988ea
-1, 459755, 2520, 0x17e3ca2b
-0, 460800, 19956, 0x0093aa0b
-1, 464327, 1944, 0x35c2de84
-0, 464400, 16392, 0x8829a9ca
-1, 467853, 1944, 0x55b4db40
-0, 468000, 16772, 0x9a4a546d
-1, 471380, 2088, 0xdaae14b2
-0, 471600, 8920, 0xcd8ca203
-1, 475167, 1944, 0x92ccd37f
-0, 475200, 9632, 0x53c1d37b
-1, 478694, 1944, 0x70efede1
-0, 478800, 8976, 0xfe4da2cc
-1, 482220, 1944, 0x7601d304
-0, 482400, 6680, 0x35348fe0
-1, 485747, 1944, 0x3922ebc2
-0, 486000, 9228, 0xcbf62b0c
-1, 489273, 2160, 0xde462f2e
-0, 489600, 5108, 0xd1d88511
-1, 493192, 1872, 0x467ac1d2
-0, 493200, 10016, 0xaff4b2b2
-1, 496588, 1872, 0xa1e4cd43
-0, 496800, 7468, 0x23e81ab8
-1, 499984, 1872, 0x1dceccc6
-0, 500400, 4172, 0x253cd05b
-1, 503380, 1872, 0x2bbad2a5
-0, 504000, 8188, 0x7ede743f
-1, 506776, 1872, 0xc603d44d
-0, 507600, 2884, 0x2dec55a3
-1, 510171, 1872, 0x1b4cc261
-0, 511200, 3900, 0xd0666a18
-1, 513567, 1872, 0x10edd6cf
-0, 514800, 2996, 0x9cc99b8c
-1, 516963, 2376, 0xecdb9d61
-0, 518400, 2156, 0xae612776
-1, 521273, 2592, 0x5559eced
-0, 522000, 3988, 0x0d2c9992
-0, 525600, 1512, 0x6281fc00
-1, 525976, 2592, 0x8848dfc7
-0, 529200, 6544, 0xb75c2562
-1, 530678, 2592, 0x4ca2d7da
-0, 532800, 4108, 0xfb21efc9
-1, 535380, 2592, 0x285fd7e6
-0, 536400, 1096, 0x85922a37
-0, 540000, 9740, 0xe57d7647
-1, 540082, 2592, 0x2717e404
-0, 543600, 416, 0x61c2ea02
-1, 544784, 2592, 0xf106111a
-0, 547200, 336, 0x1dc5ac1c
-1, 549486, 2592, 0xd7d01119
-0, 550800, 204, 0x16f57017
-1, 554188, 2592, 0x550cfeda
-0, 554400, 112, 0x78374234
-0, 558000, 40, 0x6cb21985
-1, 558890, 2592, 0x47ad00c4
-1, 563592, 2592, 0x39bbf306
-1, 568294, 3240, 0x69addfce
-1, 574171, 21384, 0x254f63e0
-1, 612963, 21456, 0x2f7a9859
-0, 615600, 14420, 0x53324ca4
-0, 619200, 40, 0x10971420
-1, 651886, 37512, 0x6e962928
-1, 719935, 2736, 0x1dc91c69
-0, 720000, 24904, 0x15574f7e
-1, 724898, 2736, 0x023434fd
-1, 729861, 2736, 0x906f1541
-0, 734400, 1908, 0xccb2dd3c
-1, 734824, 2736, 0x85a31102
-0, 738000, 4676, 0xbfa42b7e
-1, 739788, 3024, 0x9296a5f3
-0, 741600, 3600, 0x87c9dc58
-0, 745200, 8184, 0x504a8e65
-1, 745273, 1944, 0x7bf4dedc
-0, 748800, 9636, 0x2efb3006
-1, 748800, 1944, 0x4196c404
-1, 752327, 1944, 0xcda97c7a
-0, 752400, 9580, 0x0fb6f4e8
-1, 755853, 1944, 0x5f4922b2
-0, 756000, 7840, 0xe996f564
-1, 759380, 2088, 0x37dfc157
-0, 759600, 4208, 0xe9c2fba2
-0, 763200, 556, 0x3f1e077c
+#tb 0: 1/1000
+#tb 1: 16/11025
+0, 0, 0, 0, 1508, 0xefceba48
+1, 0, 0, 83, 5976, 0xfa2c2db9
+1, 83, 83, 83, 5976, 0x256b935c
+1, 166, 166, 83, 5976, 0xa78a9563
+1, 249, 249, 83, 5976, 0x4ea056f4
+1, 332, 332, 83, 5976, 0xda772d8d
+1, 415, 415, 83, 5976, 0xafacf7c9
+0, 640, 640, 0, 108, 0x06713c96
+0, 680, 680, 0, 952, 0xd306df7e
+0, 720, 720, 0, 2312, 0xaf316585
+1, 498, 498, 83, 5976, 0xdeb003f4
+0, 760, 760, 0, 3872, 0xfc1c527c
+0, 800, 800, 0, 20, 0xaffc0edd
+0, 840, 840, 0, 6600, 0xe1b66c7f
+1, 581, 581, 28, 2016, 0xa7380d36
+0, 880, 880, 0, 6868, 0xd5b3f631
+1, 609, 609, 28, 2016, 0xbc090bac
+0, 920, 920, 0, 8420, 0xf70ee33b
+1, 637, 637, 28, 2016, 0x6f8c164c
+0, 960, 960, 0, 13144, 0x9a54ef39
+1, 665, 665, 28, 2016, 0x13b80e28
+0, 1000, 1000, 0, 6340, 0xe55bf555
+1, 693, 693, 28, 2016, 0xd40ff863
+0, 1040, 1040, 0, 3736, 0x0b23f89f
+1, 721, 721, 28, 2016, 0x4d530ed7
+0, 1080, 1080, 0, 2624, 0x79e2e451
+1, 749, 749, 30, 2160, 0x0fbc37eb
+0, 1120, 1120, 0, 1860, 0x63886f11
+1, 779, 779, 192, 13824, 0x82fb2602
+0, 1160, 1160, 0, 1244, 0x74594601
+0, 1200, 1200, 0, 564, 0xf4561dfb
+0, 1240, 1240, 0, 80, 0xbf8e2e30
+0, 1280, 1280, 0, 20, 0xa0990c29
+1, 971, 971, 192, 13824, 0x08771caf
+1, 1163, 1163, 192, 13824, 0xdf7d4a65
+1, 1355, 1355, 193, 13896, 0x24bf3f47
+1, 1548, 1548, 50, 3600, 0x9ad26b9f
+1, 1598, 1598, 50, 3600, 0x8c666fd6
+1, 1648, 1648, 50, 3600, 0x305c6ca1
+1, 1698, 1698, 50, 3600, 0x48b04e1e
+0, 2480, 2480, 0, 104, 0x12413980
+0, 2520, 2520, 0, 796, 0x2e698ed3
+1, 1748, 1748, 50, 3600, 0x8c915935
+0, 2560, 2560, 0, 1808, 0x8b3e6e5e
+0, 2600, 2600, 0, 4712, 0xdbd51737
+1, 1798, 1798, 50, 3600, 0xa8f45e01
+0, 2640, 2640, 0, 5548, 0xee9c831c
+0, 2680, 2680, 0, 6152, 0x9c18ccc1
+1, 1848, 1848, 53, 3816, 0xc64cc5ed
+0, 2720, 2720, 0, 6452, 0x7860462a
+1, 1901, 1901, 27, 1944, 0x0ac2e3f1
+0, 2760, 2760, 0, 6676, 0xe1b1c9e4
+1, 1928, 1928, 27, 1944, 0x2197dccd
+0, 2800, 2800, 0, 10904, 0x0bded7b7
+1, 1955, 1955, 27, 1944, 0x0c02e77f
+0, 2840, 2840, 0, 12844, 0xe6d16cff
+1, 1982, 1982, 27, 1944, 0x675ee06a
+0, 2880, 2880, 0, 10920, 0xe114c46b
+1, 2009, 2009, 30, 2160, 0x0d803a8b
+0, 2920, 2920, 0, 5952, 0xb7464634
+1, 2039, 2039, 93, 6696, 0xa7a0dfea
+0, 2960, 2960, 0, 4732, 0x2fa2e36d
+0, 3000, 3000, 0, 2592, 0xf54ddd57
+0, 3040, 3040, 0, 1516, 0x4a1cd4d5
+0, 3080, 3080, 0, 864, 0x49889afc
+1, 2132, 2132, 93, 6696, 0x59aa3145
+0, 3120, 3120, 0, 468, 0x3932e6a4
+0, 3160, 3160, 0, 116, 0x2b8341e6
+0, 3200, 3200, 0, 16, 0x6a3109cf
+1, 2225, 2225, 93, 6696, 0x69be4d78
+1, 2318, 2318, 93, 6696, 0x64064c67
+1, 2411, 2411, 93, 6696, 0xc8536f98
+1, 2504, 2504, 93, 6696, 0xc0ce5199
+1, 2597, 2597, 94, 6768, 0x3b275c58
+1, 2691, 2691, 123, 8856, 0x90e5b37c
+0, 4000, 4000, 0, 1508, 0xefceba48
+1, 2814, 2814, 123, 8856, 0x86b33366
+1, 2937, 2937, 123, 8856, 0x19e18797
+1, 3060, 3060, 123, 8856, 0x0a0c7fbd
+1, 3183, 3183, 124, 8928, 0x4a9b2d42
+0, 4640, 4640, 0, 100, 0x45023894
+0, 4680, 4680, 0, 948, 0xa65ed345
+0, 4720, 4720, 108, 2808, 0xd7285746
+0, 4760, 4760, 108, 5372, 0x05794175
+1, 3307, 3307, 21, 1512, 0xed8b3f4b
+0, 4800, 4800, 108, 11596, 0x8636eca7
+1, 3328, 3328, 21, 1512, 0xa27d3891
+0, 4840, 4840, 108, 11524, 0xe1f39be3
+1, 3349, 3349, 21, 1512, 0xb0f13eb6
+0, 4880, 4880, 108, 23392, 0xab053f05
+1, 3370, 3370, 23, 1656, 0xe5a98324
+0, 4920, 4920, 108, 4560, 0x03197d07
+1, 3393, 3393, 31, 2232, 0x15445433
+0, 4960, 4960, 108, 4440, 0x1cc361a2
+1, 3424, 3424, 31, 2232, 0x5cb348a9
+0, 5000, 5000, 108, 23688, 0x16030634
+1, 3455, 3455, 31, 2232, 0xf10347da
+0, 5040, 5040, 108, 16132, 0xf0eca799
+1, 3486, 3486, 34, 2448, 0x3e16a175
+0, 5080, 5080, 108, 29896, 0x0c0988ea
+1, 3520, 3520, 35, 2520, 0x17e3ca2b
+0, 5120, 5120, 108, 19956, 0x0093aa0b
+1, 3555, 3555, 27, 1944, 0x35c2de84
+0, 5160, 5160, 108, 16392, 0x8829a9ca
+1, 3582, 3582, 27, 1944, 0x55b4db40
+0, 5200, 5200, 108, 16772, 0x9a4a546d
+1, 3609, 3609, 29, 2088, 0xdaae14b2
+0, 5240, 5240, 108, 8920, 0xcd8ca203
+1, 3638, 3638, 27, 1944, 0x92ccd37f
+0, 5280, 5280, 108, 9632, 0x53c1d37b
+1, 3665, 3665, 27, 1944, 0x70efede1
+0, 5320, 5320, 108, 8976, 0xfe4da2cc
+1, 3692, 3692, 27, 1944, 0x7601d304
+0, 5360, 5360, 108, 6680, 0x35348fe0
+1, 3719, 3719, 27, 1944, 0x3922ebc2
+0, 5400, 5400, 108, 9228, 0xcbf62b0c
+1, 3746, 3746, 30, 2160, 0xde462f2e
+0, 5440, 5440, 108, 5108, 0xd1d88511
+1, 3776, 3776, 26, 1872, 0x467ac1d2
+0, 5480, 5480, 108, 10016, 0xaff4b2b2
+1, 3802, 3802, 26, 1872, 0xa1e4cd43
+0, 5520, 5520, 108, 7468, 0x23e81ab8
+1, 3828, 3828, 26, 1872, 0x1dceccc6
+0, 5560, 5560, 108, 4172, 0x253cd05b
+1, 3854, 3854, 26, 1872, 0x2bbad2a5
+0, 5600, 5600, 108, 8188, 0x7ede743f
+1, 3880, 3880, 26, 1872, 0xc603d44d
+0, 5640, 5640, 108, 2884, 0x2dec55a3
+1, 3906, 3906, 26, 1872, 0x1b4cc261
+0, 5680, 5680, 108, 3900, 0xd0666a18
+1, 3932, 3932, 26, 1872, 0x10edd6cf
+0, 5720, 5720, 108, 2996, 0x9cc99b8c
+1, 3958, 3958, 33, 2376, 0xecdb9d61
+0, 5760, 5760, 108, 2156, 0xae612776
+1, 3991, 3991, 36, 2592, 0x5559eced
+0, 5800, 5800, 108, 3988, 0x0d2c9992
+0, 5840, 5840, 108, 1512, 0x6281fc00
+1, 4027, 4027, 36, 2592, 0x8848dfc7
+0, 5880, 5880, 108, 6544, 0xb75c2562
+1, 4063, 4063, 36, 2592, 0x4ca2d7da
+0, 5920, 5920, 108, 4108, 0xfb21efc9
+1, 4099, 4099, 36, 2592, 0x285fd7e6
+0, 5960, 5960, 108, 1096, 0x85922a37
+0, 6000, 6000, 108, 9740, 0xe57d7647
+1, 4135, 4135, 36, 2592, 0x2717e404
+0, 6040, 6040, 108, 416, 0x61c2ea02
+1, 4171, 4171, 36, 2592, 0xf106111a
+0, 6080, 6080, 108, 336, 0x1dc5ac1c
+1, 4207, 4207, 36, 2592, 0xd7d01119
+0, 6120, 6120, 108, 204, 0x16f57017
+1, 4243, 4243, 36, 2592, 0x550cfeda
+0, 6160, 6160, 108, 112, 0x78374234
+0, 6200, 6200, 108, 40, 0x6cb21985
+1, 4279, 4279, 36, 2592, 0x47ad00c4
+1, 4315, 4315, 36, 2592, 0x39bbf306
+1, 4351, 4351, 45, 3240, 0x69addfce
+1, 4396, 4396, 297, 21384, 0x254f63e0
+1, 4693, 4693, 298, 21456, 0x2f7a9859
+0, 6840, 6840, 108, 14420, 0x53324ca4
+0, 6880, 6880, 108, 40, 0x10971420
+1, 4991, 4991, 521, 37512, 0x6e962928
+1, 5512, 5512, 38, 2736, 0x1dc91c69
+0, 8000, 8000, 108, 24904, 0x15574f7e
+1, 5550, 5550, 38, 2736, 0x023434fd
+1, 5588, 5588, 38, 2736, 0x906f1541
+0, 8160, 8160, 108, 1908, 0xccb2dd3c
+1, 5626, 5626, 38, 2736, 0x85a31102
+0, 8200, 8200, 108, 4676, 0xbfa42b7e
+1, 5664, 5664, 42, 3024, 0x9296a5f3
+0, 8240, 8240, 108, 3600, 0x87c9dc58
+0, 8280, 8280, 108, 8184, 0x504a8e65
+1, 5706, 5706, 27, 1944, 0x7bf4dedc
+0, 8320, 8320, 108, 9636, 0x2efb3006
+1, 5733, 5733, 27, 1944, 0x4196c404
+1, 5760, 5760, 27, 1944, 0xcda97c7a
+0, 8360, 8360, 108, 9580, 0x0fb6f4e8
+1, 5787, 5787, 27, 1944, 0x5f4922b2
+0, 8400, 8400, 108, 7840, 0xe996f564
+1, 5814, 5814, 29, 2088, 0x37dfc157
+0, 8440, 8440, 108, 4208, 0xe9c2fba2
+0, 8480, 8480, 108, 556, 0x3f1e077c
diff --git a/gst-libs/ext/libav/tests/ref/fate/xtea b/gst-libs/ext/libav/tests/ref/fate/xtea
new file mode 100644
index 0000000..fed0b4d
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/xtea
@@ -0,0 +1 @@
+Test encryption/decryption success.
diff --git a/gst-libs/ext/libav/tests/ref/fate/xxan-wc4 b/gst-libs/ext/libav/tests/ref/fate/xxan-wc4
index 7fede0a..88dcc98 100644
--- a/gst-libs/ext/libav/tests/ref/fate/xxan-wc4
+++ b/gst-libs/ext/libav/tests/ref/fate/xxan-wc4
@@ -1,21 +1,22 @@
-0, 0, 79360, 0x3b0a7d1b
-0, 6000, 79360, 0x740842c3
-0, 12000, 79360, 0x85160167
-0, 18000, 79360, 0xaf510e92
-0, 24000, 79360, 0x8e290bec
-0, 30000, 79360, 0x51e981b0
-0, 36000, 79360, 0x16e52c60
-0, 42000, 79360, 0x66e1e60a
-0, 48000, 79360, 0x40fa58f6
-0, 54000, 79360, 0x00388edd
-0, 60000, 79360, 0xc74f95bf
-0, 66000, 79360, 0xf446a3fd
-0, 72000, 79360, 0x27b5eb60
-0, 78000, 79360, 0xea9266a2
-0, 84000, 79360, 0x7b6a7907
-0, 90000, 79360, 0x2be7d946
-0, 96000, 79360, 0x61881ee4
-0, 102000, 79360, 0x9214bd4f
-0, 108000, 79360, 0xeb294afe
-0, 114000, 79360, 0xc861ad55
-0, 120000, 79360, 0x3d3b6220
+#tb 0: 1/15
+0, 0, 0, 1, 79360, 0x8537821b
+0, 1, 1, 1, 79360, 0x110c4343
+0, 2, 2, 1, 79360, 0xa85105bb
+0, 3, 3, 1, 79360, 0x87431836
+0, 4, 4, 1, 79360, 0x5c701720
+0, 5, 5, 1, 79360, 0x20308ce4
+0, 6, 6, 1, 79360, 0xe51d3794
+0, 7, 7, 1, 79360, 0x80e6f1e0
+0, 8, 8, 1, 79360, 0x5aff64cc
+0, 9, 9, 1, 79360, 0x1a3d9ab3
+0, 10, 10, 1, 79360, 0xe154a195
+0, 11, 11, 1, 79360, 0x608dafdc
+0, 12, 12, 1, 79360, 0x93edf73f
+0, 13, 13, 1, 79360, 0x56d97281
+0, 14, 14, 1, 79360, 0xe7a284e6
+0, 15, 15, 1, 79360, 0xd4e5e513
+0, 16, 16, 1, 79360, 0x0a952ab1
+0, 17, 17, 1, 79360, 0x3b21c91c
+0, 18, 18, 1, 79360, 0x943656cb
+0, 19, 19, 1, 79360, 0xffbdb94b
+0, 20, 20, 1, 79360, 0x74976e16
diff --git a/gst-libs/ext/libav/tests/ref/fate/yop b/gst-libs/ext/libav/tests/ref/fate/yop
index 782fd47..57f565d 100644
--- a/gst-libs/ext/libav/tests/ref/fate/yop
+++ b/gst-libs/ext/libav/tests/ref/fate/yop
@@ -1,7 +1,7 @@
-0, 0, 302760, 0x78939253
-0, 7500, 302760, 0x534f5253
-0, 15000, 302760, 0xe991aa82
-0, 22500, 302760, 0xc34b20bd
-0, 30000, 302760, 0x461d29a1
-0, 37500, 302760, 0x45abca02
-0, 45000, 302760, 0xb05448b9
+#tb 0: 1/12
+0, 0, 0, 1, 302760, 0x78939253
+0, 1, 1, 1, 302760, 0x534f5253
+0, 2, 2, 1, 302760, 0xe991aa82
+0, 3, 3, 1, 302760, 0xc34b20bd
+0, 4, 4, 1, 302760, 0x461d29a1
+0, 5, 5, 1, 302760, 0x45abca02
diff --git a/gst-libs/ext/libav/tests/ref/fate/zerocodec b/gst-libs/ext/libav/tests/ref/fate/zerocodec
new file mode 100644
index 0000000..2d368c3
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/fate/zerocodec
@@ -0,0 +1,39 @@
+#tb 0: 417083/10000000
+0, 0, 0, 1, 1843200, 0x04154bd5
+0, 1, 1, 1, 1843200, 0x3a872d04
+0, 2, 2, 1, 1843200, 0x3b1304a0
+0, 3, 3, 1, 1843200, 0x7474f383
+0, 4, 4, 1, 1843200, 0xce7d1331
+0, 5, 5, 1, 1843200, 0x3cdf496b
+0, 6, 6, 1, 1843200, 0xe9096da2
+0, 7, 7, 1, 1843200, 0x30be7925
+0, 8, 8, 1, 1843200, 0x600b820d
+0, 9, 9, 1, 1843200, 0xe7bb8df1
+0, 10, 10, 1, 1843200, 0x62848e08
+0, 11, 11, 1, 1843200, 0x9a71a7d5
+0, 12, 12, 1, 1843200, 0x743a9f10
+0, 13, 13, 1, 1843200, 0x62b0b185
+0, 14, 14, 1, 1843200, 0xd94eac47
+0, 15, 15, 1, 1843200, 0xa1007b1b
+0, 16, 16, 1, 1843200, 0x11d72cd6
+0, 17, 17, 1, 1843200, 0x141aee09
+0, 18, 18, 1, 1843200, 0x9a90c9d4
+0, 19, 19, 1, 1843200, 0x6bd5cd4c
+0, 20, 20, 1, 1843200, 0xdf2ec1cb
+0, 21, 21, 1, 1843200, 0xeecbcb6c
+0, 22, 22, 1, 1843200, 0x9ecace2f
+0, 23, 23, 1, 1843200, 0x7b59c318
+0, 24, 24, 1, 1843200, 0x050baf2d
+0, 25, 25, 1, 1843200, 0xada36a49
+0, 26, 26, 1, 1843200, 0x4f4d684f
+0, 27, 27, 1, 1843200, 0x9ddc8f33
+0, 28, 28, 1, 1843200, 0x914d9c7e
+0, 29, 29, 1, 1843200, 0x0dc3cab8
+0, 30, 30, 1, 1843200, 0x98f8d766
+0, 31, 31, 1, 1843200, 0x872e3c7b
+0, 32, 32, 1, 1843200, 0xdf7b3cea
+0, 33, 33, 1, 1843200, 0xf7864e53
+0, 34, 34, 1, 1843200, 0x13315ba8
+0, 35, 35, 1, 1843200, 0xc4586114
+0, 36, 36, 1, 1843200, 0x57a96275
+0, 37, 37, 1, 1843200, 0x6e756704
diff --git a/gst-libs/ext/libav/tests/ref/fate/zlib b/gst-libs/ext/libav/tests/ref/fate/zlib
index ba6221f..4ff76ff 100644
--- a/gst-libs/ext/libav/tests/ref/fate/zlib
+++ b/gst-libs/ext/libav/tests/ref/fate/zlib
@@ -1 +1,2 @@
-0, 0, 253440, 0x94af61e5
+#tb 0: 100/2997
+0, 0, 0, 1, 253440, 0x94af61e5
diff --git a/gst-libs/ext/libav/tests/ref/fate/zmbv-15bit b/gst-libs/ext/libav/tests/ref/fate/zmbv-15bit
index 527c1e6..f054a9d 100644
--- a/gst-libs/ext/libav/tests/ref/fate/zmbv-15bit
+++ b/gst-libs/ext/libav/tests/ref/fate/zmbv-15bit
@@ -1,159 +1,160 @@
-0, 0, 192000, 0xe1d317d6
-0, 14193, 192000, 0xe100109d
-0, 28385, 192000, 0xecc69c65
-0, 42578, 192000, 0x68f06324
-0, 56770, 192000, 0x68f06324
-0, 70963, 192000, 0x68f06324
-0, 85155, 192000, 0x68f06324
-0, 99348, 192000, 0x68f06324
-0, 113540, 192000, 0x68f06324
-0, 127733, 192000, 0x68f06324
-0, 141925, 192000, 0x68f06324
-0, 156118, 192000, 0x68f06324
-0, 170310, 192000, 0x68f06324
-0, 184503, 192000, 0x68f06324
-0, 198695, 192000, 0x68f06324
-0, 212888, 192000, 0x68f06324
-0, 227080, 192000, 0x68f06324
-0, 241273, 192000, 0x4c03d2e3
-0, 255466, 192000, 0x4c03d2e3
-0, 269658, 192000, 0x4c03d2e3
-0, 283851, 192000, 0x4c03d2e3
-0, 298043, 192000, 0xb562cf68
-0, 312236, 192000, 0xb562cf68
-0, 326428, 192000, 0xb562cf68
-0, 340621, 192000, 0xb562cf68
-0, 354813, 192000, 0xb562cf68
-0, 369006, 192000, 0x0e5e03c7
-0, 383198, 192000, 0x0e5e03c7
-0, 397391, 192000, 0x0e5e03c7
-0, 411583, 192000, 0x0e5e03c7
-0, 425776, 192000, 0xeb2e0f67
-0, 439968, 192000, 0xeb2e0f67
-0, 454161, 192000, 0xeb2e0f67
-0, 468353, 192000, 0xeb2e0f67
-0, 482546, 192000, 0xeb2e0f67
-0, 496739, 192000, 0xdce603c7
-0, 510931, 192000, 0xdce603c7
-0, 525124, 192000, 0xdce603c7
-0, 539316, 192000, 0xdce603c7
-0, 553509, 192000, 0xa8e7db08
-0, 567701, 192000, 0xa8e7db08
-0, 581894, 192000, 0xa8e7db08
-0, 596086, 192000, 0xa8e7db08
-0, 610279, 192000, 0xa8e7db08
-0, 624471, 192000, 0x322a1b07
-0, 638664, 192000, 0x322a1b07
-0, 652856, 192000, 0x322a1b07
-0, 667049, 192000, 0x322a1b07
-0, 681241, 192000, 0x743206af
-0, 695434, 192000, 0x743206af
-0, 709627, 192000, 0x743206af
-0, 723819, 192000, 0x743206af
-0, 738012, 192000, 0x743206af
-0, 752204, 192000, 0x50195ddf
-0, 766397, 192000, 0x50195ddf
-0, 780589, 192000, 0x50195ddf
-0, 794782, 192000, 0x50195ddf
-0, 808974, 192000, 0xd31620d7
-0, 823167, 192000, 0xd31620d7
-0, 837359, 192000, 0xd31620d7
-0, 851552, 192000, 0xd31620d7
-0, 865744, 192000, 0xd31620d7
-0, 879937, 192000, 0x3af023bf
-0, 894129, 192000, 0x3af023bf
-0, 908322, 192000, 0x3af023bf
-0, 922514, 192000, 0x3af023bf
-0, 936707, 192000, 0x561a124f
-0, 950900, 192000, 0x561a124f
-0, 965092, 192000, 0x561a124f
-0, 979285, 192000, 0x561a124f
-0, 993477, 192000, 0x561a124f
-0, 1007670, 192000, 0x99210c7f
-0, 1021862, 192000, 0x99210c7f
-0, 1036055, 192000, 0x99210c7f
-0, 1050247, 192000, 0x99210c7f
-0, 1064440, 192000, 0xc77b03c7
-0, 1078632, 192000, 0xc77b03c7
-0, 1092825, 192000, 0xc77b03c7
-0, 1107017, 192000, 0xc77b03c7
-0, 1121210, 192000, 0xc77b03c7
-0, 1135402, 192000, 0x83ea7550
-0, 1149595, 192000, 0xec285270
-0, 1163787, 192000, 0x0e075558
-0, 1177980, 192000, 0x880c2108
-0, 1192173, 192000, 0x40c523f0
-0, 1206365, 192000, 0x01378f78
-0, 1220558, 192000, 0x42045558
-0, 1234750, 192000, 0xde8f3278
-0, 1248943, 192000, 0xa58c0110
-0, 1263135, 192000, 0x335ea9d1
-0, 1277328, 192000, 0x7e94bb41
-0, 1291520, 192000, 0x9cc5d569
-0, 1305713, 192000, 0xe942e109
-0, 1319905, 192000, 0x4cb83848
-0, 1334098, 192000, 0x6986fe19
-0, 1348290, 192000, 0xbb8c23f0
-0, 1362483, 192000, 0x296766c8
-0, 1376675, 192000, 0xb4230cb0
-0, 1390868, 192000, 0x2c2f1850
-0, 1405060, 192000, 0x93c70110
-0, 1419253, 192000, 0xb830a9d1
-0, 1433446, 192000, 0xbed48fa9
-0, 1447638, 192000, 0xc087bb41
-0, 1461831, 192000, 0x792de6d9
-0, 1476023, 192000, 0x1edaf849
-0, 1490216, 192000, 0x6564bb41
-0, 1504408, 192000, 0x9153d569
-0, 1518601, 192000, 0xe73ff561
-0, 1532793, 192000, 0xfa3be3f1
-0, 1546986, 192000, 0x8008fe19
-0, 1561178, 192000, 0xd2561b38
-0, 1575371, 192000, 0xae3c26d8
-0, 1589563, 192000, 0xb0114f88
-0, 1603756, 192000, 0x117e1e20
-0, 1617948, 192000, 0x482d1280
-0, 1632141, 192000, 0x425106e0
-0, 1646334, 192000, 0x0e6b0cb0
-0, 1660526, 192000, 0x95dc2ca8
-0, 1674719, 192000, 0x52097b20
-0, 1688911, 192000, 0x41a84f88
-0, 1703104, 192000, 0xb78d7268
-0, 1717296, 192000, 0x2cd366c8
-0, 1731489, 192000, 0xbf39e109
-0, 1745681, 192000, 0xecbaeca9
-0, 1759874, 192000, 0x3254eca9
-0, 1774066, 192000, 0x3fc903f8
-0, 1788259, 192000, 0x0bbc5e10
-0, 1802451, 192000, 0xe9103560
-0, 1816644, 192000, 0xbd5d2f90
-0, 1830836, 192000, 0x7ace2ca8
-0, 1845029, 192000, 0x7354c6e1
-0, 1859221, 192000, 0x72e0d569
-0, 1873414, 192000, 0xa4ade3f1
-0, 1887607, 192000, 0xf2f8cf99
-0, 1901799, 192000, 0x2b7ee6d9
-0, 1915992, 192000, 0x548d1b38
-0, 1930184, 192000, 0xa1551b38
-0, 1944377, 192000, 0xfb3e3560
-0, 1958569, 192000, 0x3aaaccb1
-0, 1972762, 192000, 0xa85ee109
-0, 1986954, 192000, 0xc1bff849
-0, 2001147, 192000, 0xa62bef91
-0, 2015339, 192000, 0xddf40cb0
-0, 2029532, 192000, 0x15bb3e18
-0, 2043724, 192000, 0x92fd5558
-0, 2057917, 192000, 0x2d365270
-0, 2072109, 192000, 0xb5f343e8
-0, 2086302, 192000, 0x93042108
-0, 2100494, 192000, 0x96d59830
-0, 2114687, 192000, 0x1f69ddf0
-0, 2128880, 192000, 0x8eb0124f
-0, 2143072, 192000, 0xae727dd7
-0, 2157265, 192000, 0xb8a63aff
-0, 2171457, 192000, 0xfae83de7
-0, 2185650, 192000, 0x2f034987
-0, 2199842, 192000, 0xa99e1537
-0, 2214035, 192000, 0x0ad70c7f
-0, 2228227, 192000, 0x74b3e990
-0, 2242420, 192000, 0x1bf0d250
+#tb 0: 250000/1585341
+0, 0, 0, 1, 192000, 0xe1d317d6
+0, 1, 1, 1, 192000, 0xe100109d
+0, 2, 2, 1, 192000, 0xecc69c65
+0, 3, 3, 1, 192000, 0x68f06324
+0, 4, 4, 1, 192000, 0x68f06324
+0, 5, 5, 1, 192000, 0x68f06324
+0, 6, 6, 1, 192000, 0x68f06324
+0, 7, 7, 1, 192000, 0x68f06324
+0, 8, 8, 1, 192000, 0x68f06324
+0, 9, 9, 1, 192000, 0x68f06324
+0, 10, 10, 1, 192000, 0x68f06324
+0, 11, 11, 1, 192000, 0x68f06324
+0, 12, 12, 1, 192000, 0x68f06324
+0, 13, 13, 1, 192000, 0x68f06324
+0, 14, 14, 1, 192000, 0x68f06324
+0, 15, 15, 1, 192000, 0x68f06324
+0, 16, 16, 1, 192000, 0x68f06324
+0, 17, 17, 1, 192000, 0x4c03d2e3
+0, 18, 18, 1, 192000, 0x4c03d2e3
+0, 19, 19, 1, 192000, 0x4c03d2e3
+0, 20, 20, 1, 192000, 0x4c03d2e3
+0, 21, 21, 1, 192000, 0xb562cf68
+0, 22, 22, 1, 192000, 0xb562cf68
+0, 23, 23, 1, 192000, 0xb562cf68
+0, 24, 24, 1, 192000, 0xb562cf68
+0, 25, 25, 1, 192000, 0xb562cf68
+0, 26, 26, 1, 192000, 0x0e5e03c7
+0, 27, 27, 1, 192000, 0x0e5e03c7
+0, 28, 28, 1, 192000, 0x0e5e03c7
+0, 29, 29, 1, 192000, 0x0e5e03c7
+0, 30, 30, 1, 192000, 0xeb2e0f67
+0, 31, 31, 1, 192000, 0xeb2e0f67
+0, 32, 32, 1, 192000, 0xeb2e0f67
+0, 33, 33, 1, 192000, 0xeb2e0f67
+0, 34, 34, 1, 192000, 0xeb2e0f67
+0, 35, 35, 1, 192000, 0xdce603c7
+0, 36, 36, 1, 192000, 0xdce603c7
+0, 37, 37, 1, 192000, 0xdce603c7
+0, 38, 38, 1, 192000, 0xdce603c7
+0, 39, 39, 1, 192000, 0xa8e7db08
+0, 40, 40, 1, 192000, 0xa8e7db08
+0, 41, 41, 1, 192000, 0xa8e7db08
+0, 42, 42, 1, 192000, 0xa8e7db08
+0, 43, 43, 1, 192000, 0xa8e7db08
+0, 44, 44, 1, 192000, 0x322a1b07
+0, 45, 45, 1, 192000, 0x322a1b07
+0, 46, 46, 1, 192000, 0x322a1b07
+0, 47, 47, 1, 192000, 0x322a1b07
+0, 48, 48, 1, 192000, 0x743206af
+0, 49, 49, 1, 192000, 0x743206af
+0, 50, 50, 1, 192000, 0x743206af
+0, 51, 51, 1, 192000, 0x743206af
+0, 52, 52, 1, 192000, 0x743206af
+0, 53, 53, 1, 192000, 0x50195ddf
+0, 54, 54, 1, 192000, 0x50195ddf
+0, 55, 55, 1, 192000, 0x50195ddf
+0, 56, 56, 1, 192000, 0x50195ddf
+0, 57, 57, 1, 192000, 0xd31620d7
+0, 58, 58, 1, 192000, 0xd31620d7
+0, 59, 59, 1, 192000, 0xd31620d7
+0, 60, 60, 1, 192000, 0xd31620d7
+0, 61, 61, 1, 192000, 0xd31620d7
+0, 62, 62, 1, 192000, 0x3af023bf
+0, 63, 63, 1, 192000, 0x3af023bf
+0, 64, 64, 1, 192000, 0x3af023bf
+0, 65, 65, 1, 192000, 0x3af023bf
+0, 66, 66, 1, 192000, 0x561a124f
+0, 67, 67, 1, 192000, 0x561a124f
+0, 68, 68, 1, 192000, 0x561a124f
+0, 69, 69, 1, 192000, 0x561a124f
+0, 70, 70, 1, 192000, 0x561a124f
+0, 71, 71, 1, 192000, 0x99210c7f
+0, 72, 72, 1, 192000, 0x99210c7f
+0, 73, 73, 1, 192000, 0x99210c7f
+0, 74, 74, 1, 192000, 0x99210c7f
+0, 75, 75, 1, 192000, 0xc77b03c7
+0, 76, 76, 1, 192000, 0xc77b03c7
+0, 77, 77, 1, 192000, 0xc77b03c7
+0, 78, 78, 1, 192000, 0xc77b03c7
+0, 79, 79, 1, 192000, 0xc77b03c7
+0, 80, 80, 1, 192000, 0x83ea7550
+0, 81, 81, 1, 192000, 0xec285270
+0, 82, 82, 1, 192000, 0x0e075558
+0, 83, 83, 1, 192000, 0x880c2108
+0, 84, 84, 1, 192000, 0x40c523f0
+0, 85, 85, 1, 192000, 0x01378f78
+0, 86, 86, 1, 192000, 0x42045558
+0, 87, 87, 1, 192000, 0xde8f3278
+0, 88, 88, 1, 192000, 0xa58c0110
+0, 89, 89, 1, 192000, 0x335ea9d1
+0, 90, 90, 1, 192000, 0x7e94bb41
+0, 91, 91, 1, 192000, 0x9cc5d569
+0, 92, 92, 1, 192000, 0xe942e109
+0, 93, 93, 1, 192000, 0x4cb83848
+0, 94, 94, 1, 192000, 0x6986fe19
+0, 95, 95, 1, 192000, 0xbb8c23f0
+0, 96, 96, 1, 192000, 0x296766c8
+0, 97, 97, 1, 192000, 0xb4230cb0
+0, 98, 98, 1, 192000, 0x2c2f1850
+0, 99, 99, 1, 192000, 0x93c70110
+0, 100, 100, 1, 192000, 0xb830a9d1
+0, 101, 101, 1, 192000, 0xbed48fa9
+0, 102, 102, 1, 192000, 0xc087bb41
+0, 103, 103, 1, 192000, 0x792de6d9
+0, 104, 104, 1, 192000, 0x1edaf849
+0, 105, 105, 1, 192000, 0x6564bb41
+0, 106, 106, 1, 192000, 0x9153d569
+0, 107, 107, 1, 192000, 0xe73ff561
+0, 108, 108, 1, 192000, 0xfa3be3f1
+0, 109, 109, 1, 192000, 0x8008fe19
+0, 110, 110, 1, 192000, 0xd2561b38
+0, 111, 111, 1, 192000, 0xae3c26d8
+0, 112, 112, 1, 192000, 0xb0114f88
+0, 113, 113, 1, 192000, 0x117e1e20
+0, 114, 114, 1, 192000, 0x482d1280
+0, 115, 115, 1, 192000, 0x425106e0
+0, 116, 116, 1, 192000, 0x0e6b0cb0
+0, 117, 117, 1, 192000, 0x95dc2ca8
+0, 118, 118, 1, 192000, 0x52097b20
+0, 119, 119, 1, 192000, 0x41a84f88
+0, 120, 120, 1, 192000, 0xb78d7268
+0, 121, 121, 1, 192000, 0x2cd366c8
+0, 122, 122, 1, 192000, 0xbf39e109
+0, 123, 123, 1, 192000, 0xecbaeca9
+0, 124, 124, 1, 192000, 0x3254eca9
+0, 125, 125, 1, 192000, 0x3fc903f8
+0, 126, 126, 1, 192000, 0x0bbc5e10
+0, 127, 127, 1, 192000, 0xe9103560
+0, 128, 128, 1, 192000, 0xbd5d2f90
+0, 129, 129, 1, 192000, 0x7ace2ca8
+0, 130, 130, 1, 192000, 0x7354c6e1
+0, 131, 131, 1, 192000, 0x72e0d569
+0, 132, 132, 1, 192000, 0xa4ade3f1
+0, 133, 133, 1, 192000, 0xf2f8cf99
+0, 134, 134, 1, 192000, 0x2b7ee6d9
+0, 135, 135, 1, 192000, 0x548d1b38
+0, 136, 136, 1, 192000, 0xa1551b38
+0, 137, 137, 1, 192000, 0xfb3e3560
+0, 138, 138, 1, 192000, 0x3aaaccb1
+0, 139, 139, 1, 192000, 0xa85ee109
+0, 140, 140, 1, 192000, 0xc1bff849
+0, 141, 141, 1, 192000, 0xa62bef91
+0, 142, 142, 1, 192000, 0xddf40cb0
+0, 143, 143, 1, 192000, 0x15bb3e18
+0, 144, 144, 1, 192000, 0x92fd5558
+0, 145, 145, 1, 192000, 0x2d365270
+0, 146, 146, 1, 192000, 0xb5f343e8
+0, 147, 147, 1, 192000, 0x93042108
+0, 148, 148, 1, 192000, 0x96d59830
+0, 149, 149, 1, 192000, 0x1f69ddf0
+0, 150, 150, 1, 192000, 0x8eb0124f
+0, 151, 151, 1, 192000, 0xae727dd7
+0, 152, 152, 1, 192000, 0xb8a63aff
+0, 153, 153, 1, 192000, 0xfae83de7
+0, 154, 154, 1, 192000, 0x2f034987
+0, 155, 155, 1, 192000, 0xa99e1537
+0, 156, 156, 1, 192000, 0x0ad70c7f
+0, 157, 157, 1, 192000, 0x74b3e990
+0, 158, 158, 1, 192000, 0x1bf0d250
diff --git a/gst-libs/ext/libav/tests/ref/fate/zmbv-16bit b/gst-libs/ext/libav/tests/ref/fate/zmbv-16bit
index ef37d44..b0c3df5 100644
--- a/gst-libs/ext/libav/tests/ref/fate/zmbv-16bit
+++ b/gst-libs/ext/libav/tests/ref/fate/zmbv-16bit
@@ -1,159 +1,160 @@
-0, 0, 192000, 0x11e62dbe
-0, 14193, 192000, 0x31698b8f
-0, 28385, 192000, 0x31698b8f
-0, 42578, 192000, 0x31698b8f
-0, 56770, 192000, 0x31698b8f
-0, 70963, 192000, 0x31698b8f
-0, 85155, 192000, 0x31698b8f
-0, 99348, 192000, 0x31698b8f
-0, 113540, 192000, 0x31698b8f
-0, 127733, 192000, 0x31698b8f
-0, 141925, 192000, 0x31698b8f
-0, 156118, 192000, 0x31698b8f
-0, 170310, 192000, 0x31698b8f
-0, 184503, 192000, 0x4ca609ea
-0, 198695, 192000, 0x4ca609ea
-0, 212888, 192000, 0x4ca609ea
-0, 227080, 192000, 0x4ca609ea
-0, 241273, 192000, 0x33dd0a8b
-0, 255466, 192000, 0x33dd0a8b
-0, 269658, 192000, 0x33dd0a8b
-0, 283851, 192000, 0x33dd0a8b
-0, 298043, 192000, 0x33dd0a8b
-0, 312236, 192000, 0x08e2420f
-0, 326428, 192000, 0x08e2420f
-0, 340621, 192000, 0x08e2420f
-0, 354813, 192000, 0x08e2420f
-0, 369006, 192000, 0x7b7b50ab
-0, 383198, 192000, 0x7b7b50ab
-0, 397391, 192000, 0x7b7b50ab
-0, 411583, 192000, 0x7b7b50ab
-0, 425776, 192000, 0x7b7b50ab
-0, 439968, 192000, 0x128744fb
-0, 454161, 192000, 0x128744fb
-0, 468353, 192000, 0x128744fb
-0, 482546, 192000, 0x128744fb
-0, 496739, 192000, 0x8643163b
-0, 510931, 192000, 0x8643163b
-0, 525124, 192000, 0x8643163b
-0, 539316, 192000, 0x8643163b
-0, 553509, 192000, 0x8643163b
-0, 567701, 192000, 0x4f7c596f
-0, 581894, 192000, 0x4f7c596f
-0, 596086, 192000, 0x4f7c596f
-0, 610279, 192000, 0x4f7c596f
-0, 624471, 192000, 0xa275420f
-0, 638664, 192000, 0xa275420f
-0, 652856, 192000, 0xa275420f
-0, 667049, 192000, 0xa275420f
-0, 681241, 192000, 0xa275420f
-0, 695434, 192000, 0x2e4796cb
-0, 709627, 192000, 0x2e4796cb
-0, 723819, 192000, 0x2e4796cb
-0, 738012, 192000, 0x2e4796cb
-0, 752204, 192000, 0xebd45683
-0, 766397, 192000, 0xebd45683
-0, 780589, 192000, 0xebd45683
-0, 794782, 192000, 0xebd45683
-0, 808974, 192000, 0xebd45683
-0, 823167, 192000, 0x0bf6596f
-0, 837359, 192000, 0x0bf6596f
-0, 851552, 192000, 0x0bf6596f
-0, 865744, 192000, 0x0bf6596f
-0, 879937, 192000, 0xb7af47e7
-0, 894129, 192000, 0xb7af47e7
-0, 908322, 192000, 0xb7af47e7
-0, 922514, 192000, 0xb7af47e7
-0, 936707, 192000, 0xb7af47e7
-0, 950900, 192000, 0x8bc344fb
-0, 965092, 192000, 0x8bc344fb
-0, 979285, 192000, 0x8bc344fb
-0, 993477, 192000, 0x8bc344fb
-0, 1007670, 192000, 0x8bc344fb
-0, 1021862, 192000, 0x02a23f23
-0, 1036055, 192000, 0x02a23f23
-0, 1050247, 192000, 0x02a23f23
-0, 1064440, 192000, 0x02a23f23
-0, 1078632, 192000, 0x17be3087
-0, 1092825, 192000, 0x52c7b2d4
-0, 1107017, 192000, 0xa05e9888
-0, 1121210, 192000, 0x4d6a6cb4
-0, 1135402, 192000, 0x3e2189ec
-0, 1149595, 192000, 0xfbe3ca34
-0, 1163787, 192000, 0xa9cd8fc4
-0, 1177980, 192000, 0x986e6cb4
-0, 1192173, 192000, 0x42373b08
-0, 1206365, 192000, 0xab96e351
-0, 1220558, 192000, 0x28ccf4d9
-0, 1234750, 192000, 0xc19e0f34
-0, 1248943, 192000, 0xd8da1ae4
-0, 1263135, 192000, 0xd015728c
-0, 1277328, 192000, 0x550623a8
-0, 1291520, 192000, 0x3c5c5268
-0, 1305713, 192000, 0x3eae8128
-0, 1319905, 192000, 0x3c51381c
-0, 1334098, 192000, 0x745046b8
-0, 1348290, 192000, 0xa8bd43cc
-0, 1362483, 192000, 0xde8fe351
-0, 1376675, 192000, 0x3d5cc905
-0, 1390868, 192000, 0xcf8df4d9
-0, 1405060, 192000, 0x698b20bc
-0, 1419253, 192000, 0x159d3244
-0, 1433446, 192000, 0xba1af4d9
-0, 1447638, 192000, 0x033a0f34
-0, 1461831, 192000, 0x72612f58
-0, 1476023, 192000, 0x11e11dd0
-0, 1490216, 192000, 0x4fc04f7c
-0, 1504408, 192000, 0x37779888
-0, 1518601, 192000, 0xabfc5e18
-0, 1532793, 192000, 0x0ad97e3c
-0, 1546986, 192000, 0xddf492b0
-0, 1561178, 192000, 0x198b23a8
-0, 1575371, 192000, 0x6b491220
-0, 1589563, 192000, 0x632417f8
-0, 1603756, 192000, 0x0dc5381c
-0, 1617948, 192000, 0x6d548700
-0, 1632141, 192000, 0xae0c5b2c
-0, 1646334, 192000, 0x23427e3c
-0, 1660526, 192000, 0x5def728c
-0, 1674719, 192000, 0xec831ae4
-0, 1688911, 192000, 0x00000000
-0, 1703104, 192000, 0x00000000
-0, 1717296, 192000, 0x00000000
-0, 1731489, 192000, 0x00000000
-0, 1745681, 192000, 0x00000000
-0, 1759874, 192000, 0x00000000
-0, 1774066, 192000, 0x00000000
-0, 1788259, 192000, 0x00000000
-0, 1802451, 192000, 0x00000000
-0, 1816644, 192000, 0xd6050414
-0, 1830836, 192000, 0xf9f90594
-0, 1845029, 192000, 0xa6220704
-0, 1859221, 192000, 0x54570858
-0, 1873414, 192000, 0xd81109ac
-0, 1887607, 192000, 0xc0540afc
-0, 1901799, 192000, 0x83ee0c20
-0, 1915992, 192000, 0x2a810d3c
-0, 1930184, 192000, 0xb3a71844
-0, 1944377, 192000, 0xd4ff1c7c
-0, 1958569, 192000, 0x92b21fdc
-0, 1972762, 192000, 0x03912364
-0, 1986954, 192000, 0x65c9262c
-0, 2001147, 192000, 0xf2e5290c
-0, 2015339, 192000, 0xc8cc2b4c
-0, 2029532, 192000, 0x272a2f1c
-0, 2043724, 192000, 0xa672313c
-0, 2057917, 192000, 0xab01331c
-0, 2072109, 192000, 0x92643458
-0, 2086302, 192000, 0x9a943548
-0, 2100494, 192000, 0x3eb735ac
-0, 2114687, 192000, 0x3eb735ac
-0, 2128880, 192000, 0x3eb735ac
-0, 2143072, 192000, 0x3eb735ac
-0, 2157265, 192000, 0x3eb735ac
-0, 2171457, 192000, 0x3eb735ac
-0, 2185650, 192000, 0x3eb735ac
-0, 2199842, 192000, 0x3eb735ac
-0, 2214035, 192000, 0x3eb735ac
-0, 2228227, 192000, 0x3eb735ac
-0, 2242420, 192000, 0x3eb735ac
+#tb 0: 250000/1585341
+0, 0, 0, 1, 192000, 0x11e62dbe
+0, 1, 1, 1, 192000, 0x31698b8f
+0, 2, 2, 1, 192000, 0x31698b8f
+0, 3, 3, 1, 192000, 0x31698b8f
+0, 4, 4, 1, 192000, 0x31698b8f
+0, 5, 5, 1, 192000, 0x31698b8f
+0, 6, 6, 1, 192000, 0x31698b8f
+0, 7, 7, 1, 192000, 0x31698b8f
+0, 8, 8, 1, 192000, 0x31698b8f
+0, 9, 9, 1, 192000, 0x31698b8f
+0, 10, 10, 1, 192000, 0x31698b8f
+0, 11, 11, 1, 192000, 0x31698b8f
+0, 12, 12, 1, 192000, 0x31698b8f
+0, 13, 13, 1, 192000, 0x4ca609ea
+0, 14, 14, 1, 192000, 0x4ca609ea
+0, 15, 15, 1, 192000, 0x4ca609ea
+0, 16, 16, 1, 192000, 0x4ca609ea
+0, 17, 17, 1, 192000, 0x33dd0a8b
+0, 18, 18, 1, 192000, 0x33dd0a8b
+0, 19, 19, 1, 192000, 0x33dd0a8b
+0, 20, 20, 1, 192000, 0x33dd0a8b
+0, 21, 21, 1, 192000, 0x33dd0a8b
+0, 22, 22, 1, 192000, 0x08e2420f
+0, 23, 23, 1, 192000, 0x08e2420f
+0, 24, 24, 1, 192000, 0x08e2420f
+0, 25, 25, 1, 192000, 0x08e2420f
+0, 26, 26, 1, 192000, 0x7b7b50ab
+0, 27, 27, 1, 192000, 0x7b7b50ab
+0, 28, 28, 1, 192000, 0x7b7b50ab
+0, 29, 29, 1, 192000, 0x7b7b50ab
+0, 30, 30, 1, 192000, 0x7b7b50ab
+0, 31, 31, 1, 192000, 0x128744fb
+0, 32, 32, 1, 192000, 0x128744fb
+0, 33, 33, 1, 192000, 0x128744fb
+0, 34, 34, 1, 192000, 0x128744fb
+0, 35, 35, 1, 192000, 0x8643163b
+0, 36, 36, 1, 192000, 0x8643163b
+0, 37, 37, 1, 192000, 0x8643163b
+0, 38, 38, 1, 192000, 0x8643163b
+0, 39, 39, 1, 192000, 0x8643163b
+0, 40, 40, 1, 192000, 0x4f7c596f
+0, 41, 41, 1, 192000, 0x4f7c596f
+0, 42, 42, 1, 192000, 0x4f7c596f
+0, 43, 43, 1, 192000, 0x4f7c596f
+0, 44, 44, 1, 192000, 0xa275420f
+0, 45, 45, 1, 192000, 0xa275420f
+0, 46, 46, 1, 192000, 0xa275420f
+0, 47, 47, 1, 192000, 0xa275420f
+0, 48, 48, 1, 192000, 0xa275420f
+0, 49, 49, 1, 192000, 0x2e4796cb
+0, 50, 50, 1, 192000, 0x2e4796cb
+0, 51, 51, 1, 192000, 0x2e4796cb
+0, 52, 52, 1, 192000, 0x2e4796cb
+0, 53, 53, 1, 192000, 0xebd45683
+0, 54, 54, 1, 192000, 0xebd45683
+0, 55, 55, 1, 192000, 0xebd45683
+0, 56, 56, 1, 192000, 0xebd45683
+0, 57, 57, 1, 192000, 0xebd45683
+0, 58, 58, 1, 192000, 0x0bf6596f
+0, 59, 59, 1, 192000, 0x0bf6596f
+0, 60, 60, 1, 192000, 0x0bf6596f
+0, 61, 61, 1, 192000, 0x0bf6596f
+0, 62, 62, 1, 192000, 0xb7af47e7
+0, 63, 63, 1, 192000, 0xb7af47e7
+0, 64, 64, 1, 192000, 0xb7af47e7
+0, 65, 65, 1, 192000, 0xb7af47e7
+0, 66, 66, 1, 192000, 0xb7af47e7
+0, 67, 67, 1, 192000, 0x8bc344fb
+0, 68, 68, 1, 192000, 0x8bc344fb
+0, 69, 69, 1, 192000, 0x8bc344fb
+0, 70, 70, 1, 192000, 0x8bc344fb
+0, 71, 71, 1, 192000, 0x8bc344fb
+0, 72, 72, 1, 192000, 0x02a23f23
+0, 73, 73, 1, 192000, 0x02a23f23
+0, 74, 74, 1, 192000, 0x02a23f23
+0, 75, 75, 1, 192000, 0x02a23f23
+0, 76, 76, 1, 192000, 0x17be3087
+0, 77, 77, 1, 192000, 0x52c7b2d4
+0, 78, 78, 1, 192000, 0xa05e9888
+0, 79, 79, 1, 192000, 0x4d6a6cb4
+0, 80, 80, 1, 192000, 0x3e2189ec
+0, 81, 81, 1, 192000, 0xfbe3ca34
+0, 82, 82, 1, 192000, 0xa9cd8fc4
+0, 83, 83, 1, 192000, 0x986e6cb4
+0, 84, 84, 1, 192000, 0x42373b08
+0, 85, 85, 1, 192000, 0xab96e351
+0, 86, 86, 1, 192000, 0x28ccf4d9
+0, 87, 87, 1, 192000, 0xc19e0f34
+0, 88, 88, 1, 192000, 0xd8da1ae4
+0, 89, 89, 1, 192000, 0xd015728c
+0, 90, 90, 1, 192000, 0x550623a8
+0, 91, 91, 1, 192000, 0x3c5c5268
+0, 92, 92, 1, 192000, 0x3eae8128
+0, 93, 93, 1, 192000, 0x3c51381c
+0, 94, 94, 1, 192000, 0x745046b8
+0, 95, 95, 1, 192000, 0xa8bd43cc
+0, 96, 96, 1, 192000, 0xde8fe351
+0, 97, 97, 1, 192000, 0x3d5cc905
+0, 98, 98, 1, 192000, 0xcf8df4d9
+0, 99, 99, 1, 192000, 0x698b20bc
+0, 100, 100, 1, 192000, 0x159d3244
+0, 101, 101, 1, 192000, 0xba1af4d9
+0, 102, 102, 1, 192000, 0x033a0f34
+0, 103, 103, 1, 192000, 0x72612f58
+0, 104, 104, 1, 192000, 0x11e11dd0
+0, 105, 105, 1, 192000, 0x4fc04f7c
+0, 106, 106, 1, 192000, 0x37779888
+0, 107, 107, 1, 192000, 0xabfc5e18
+0, 108, 108, 1, 192000, 0x0ad97e3c
+0, 109, 109, 1, 192000, 0xddf492b0
+0, 110, 110, 1, 192000, 0x198b23a8
+0, 111, 111, 1, 192000, 0x6b491220
+0, 112, 112, 1, 192000, 0x632417f8
+0, 113, 113, 1, 192000, 0x0dc5381c
+0, 114, 114, 1, 192000, 0x6d548700
+0, 115, 115, 1, 192000, 0xae0c5b2c
+0, 116, 116, 1, 192000, 0x23427e3c
+0, 117, 117, 1, 192000, 0x5def728c
+0, 118, 118, 1, 192000, 0xec831ae4
+0, 119, 119, 1, 192000, 0x00000000
+0, 120, 120, 1, 192000, 0x00000000
+0, 121, 121, 1, 192000, 0x00000000
+0, 122, 122, 1, 192000, 0x00000000
+0, 123, 123, 1, 192000, 0x00000000
+0, 124, 124, 1, 192000, 0x00000000
+0, 125, 125, 1, 192000, 0x00000000
+0, 126, 126, 1, 192000, 0x00000000
+0, 127, 127, 1, 192000, 0x00000000
+0, 128, 128, 1, 192000, 0xd6050414
+0, 129, 129, 1, 192000, 0xf9f90594
+0, 130, 130, 1, 192000, 0xa6220704
+0, 131, 131, 1, 192000, 0x54570858
+0, 132, 132, 1, 192000, 0xd81109ac
+0, 133, 133, 1, 192000, 0xc0540afc
+0, 134, 134, 1, 192000, 0x83ee0c20
+0, 135, 135, 1, 192000, 0x2a810d3c
+0, 136, 136, 1, 192000, 0xb3a71844
+0, 137, 137, 1, 192000, 0xd4ff1c7c
+0, 138, 138, 1, 192000, 0x92b21fdc
+0, 139, 139, 1, 192000, 0x03912364
+0, 140, 140, 1, 192000, 0x65c9262c
+0, 141, 141, 1, 192000, 0xf2e5290c
+0, 142, 142, 1, 192000, 0xc8cc2b4c
+0, 143, 143, 1, 192000, 0x272a2f1c
+0, 144, 144, 1, 192000, 0xa672313c
+0, 145, 145, 1, 192000, 0xab01331c
+0, 146, 146, 1, 192000, 0x92643458
+0, 147, 147, 1, 192000, 0x9a943548
+0, 148, 148, 1, 192000, 0x3eb735ac
+0, 149, 149, 1, 192000, 0x3eb735ac
+0, 150, 150, 1, 192000, 0x3eb735ac
+0, 151, 151, 1, 192000, 0x3eb735ac
+0, 152, 152, 1, 192000, 0x3eb735ac
+0, 153, 153, 1, 192000, 0x3eb735ac
+0, 154, 154, 1, 192000, 0x3eb735ac
+0, 155, 155, 1, 192000, 0x3eb735ac
+0, 156, 156, 1, 192000, 0x3eb735ac
+0, 157, 157, 1, 192000, 0x3eb735ac
+0, 158, 158, 1, 192000, 0x3eb735ac
diff --git a/gst-libs/ext/libav/tests/ref/fate/zmbv-32bit b/gst-libs/ext/libav/tests/ref/fate/zmbv-32bit
index 4b961cc..e1df123 100644
--- a/gst-libs/ext/libav/tests/ref/fate/zmbv-32bit
+++ b/gst-libs/ext/libav/tests/ref/fate/zmbv-32bit
@@ -1,159 +1,160 @@
-0, 0, 192000, 0x3ac10e8e
-0, 14193, 192000, 0xb772ee57
-0, 28385, 192000, 0x9b6e648a
-0, 42578, 192000, 0x3d9c33e3
-0, 56770, 192000, 0x006db76d
-0, 70963, 192000, 0x006db76d
-0, 85155, 192000, 0x006db76d
-0, 99348, 192000, 0x006db76d
-0, 113540, 192000, 0x006db76d
-0, 127733, 192000, 0x006db76d
-0, 141925, 192000, 0x006db76d
-0, 156118, 192000, 0x006db76d
-0, 170310, 192000, 0x006db76d
-0, 184503, 192000, 0x006db76d
-0, 198695, 192000, 0x006db76d
-0, 212888, 192000, 0x7b9b28fb
-0, 227080, 192000, 0x7b9b28fb
-0, 241273, 192000, 0x7b9b28fb
-0, 255466, 192000, 0x7b9b28fb
-0, 269658, 192000, 0x7b9b28fb
-0, 283851, 192000, 0x7b9b28fb
-0, 298043, 192000, 0x67be3519
-0, 312236, 192000, 0x67be3519
-0, 326428, 192000, 0x67be3519
-0, 340621, 192000, 0x67be3519
-0, 354813, 192000, 0x67be3519
-0, 369006, 192000, 0x2ece70dd
-0, 383198, 192000, 0x2ece70dd
-0, 397391, 192000, 0x2ece70dd
-0, 411583, 192000, 0x2ece70dd
-0, 425776, 192000, 0x2ece70dd
-0, 439968, 192000, 0x2ece70dd
-0, 454161, 192000, 0xd3a382cb
-0, 468353, 192000, 0xd3a382cb
-0, 482546, 192000, 0xd3a382cb
-0, 496739, 192000, 0xd3a382cb
-0, 510931, 192000, 0xd3a382cb
-0, 525124, 192000, 0xd3a382cb
-0, 539316, 192000, 0x2d3d7fce
-0, 553509, 192000, 0x2d3d7fce
-0, 567701, 192000, 0x2d3d7fce
-0, 581894, 192000, 0x2d3d7fce
-0, 596086, 192000, 0x2d3d7fce
-0, 610279, 192000, 0x36fd52fb
-0, 624471, 192000, 0x36fd52fb
-0, 638664, 192000, 0x36fd52fb
-0, 652856, 192000, 0x36fd52fb
-0, 667049, 192000, 0x36fd52fb
-0, 681241, 192000, 0x36fd52fb
-0, 695434, 192000, 0xa38e9ab3
-0, 709627, 192000, 0x57095eef
-0, 723819, 192000, 0x5c4f4d01
-0, 738012, 192000, 0xac20321c
-0, 752204, 192000, 0x7e370e40
-0, 766397, 192000, 0xe9d92925
-0, 780589, 192000, 0xfef4d26d
-0, 794782, 192000, 0x77a4ab94
-0, 808974, 192000, 0x802fb18e
-0, 823167, 192000, 0xce968db2
-0, 837359, 192000, 0x21e6ab94
-0, 851552, 192000, 0x309d45fa
-0, 865744, 192000, 0x5d193709
-0, 879937, 192000, 0x72190d33
-0, 894129, 192000, 0xdaed162a
-0, 908322, 192000, 0x2fcaf23f
-0, 922514, 192000, 0x8986d45d
-0, 936707, 192000, 0xcf7de34e
-0, 950900, 192000, 0x22390d33
-0, 965092, 192000, 0x4b29132d
-0, 979285, 192000, 0xbffe1f21
-0, 993477, 192000, 0xa4eee34e
-0, 1007670, 192000, 0xe85ae64b
-0, 1021862, 192000, 0xb7bef23f
-0, 1036055, 192000, 0x05ab1927
-0, 1050247, 192000, 0x915f6cd3
-0, 1064440, 192000, 0x524d69d6
-0, 1078632, 192000, 0x62da78c7
-0, 1092825, 192000, 0xbf6f84bb
-0, 1107017, 192000, 0xbe9f6cd3
-0, 1121210, 192000, 0x80d0132d
-0, 1135402, 192000, 0x0789251b
-0, 1149595, 192000, 0xba1a1f21
-0, 1163787, 192000, 0x542b42fd
-0, 1177980, 192000, 0x0ff951ee
-0, 1192173, 192000, 0x785048f7
-0, 1206365, 192000, 0x5a50251b
-0, 1220558, 192000, 0xd5d73a06
-0, 1234750, 192000, 0x7a3a54eb
-0, 1248943, 192000, 0x1e2b5de2
-0, 1263135, 192000, 0xeac542fd
-0, 1277328, 192000, 0x897a1f21
-0, 1291520, 192000, 0x61602b15
-0, 1305713, 192000, 0xb12f221e
-0, 1319905, 192000, 0x08541f21
-0, 1334098, 192000, 0xeebd251b
-0, 1348290, 192000, 0xc1132e12
-0, 1362483, 192000, 0x99642818
-0, 1376675, 192000, 0x9b8e162a
-0, 1390868, 192000, 0x21b81f21
-0, 1405060, 192000, 0x1abd1030
-0, 1419253, 192000, 0x0d613d03
-0, 1433446, 192000, 0xcb32132d
-0, 1447638, 192000, 0xc680162a
-0, 1461831, 192000, 0x8dea2818
-0, 1476023, 192000, 0x3c4e1927
-0, 1490216, 192000, 0xed733709
-0, 1504408, 192000, 0xf4051c24
-0, 1518601, 192000, 0xb8eb221e
-0, 1532793, 192000, 0x1a412818
-0, 1546986, 192000, 0x6ee6162a
-0, 1561178, 192000, 0xe1a248f7
-0, 1575371, 192000, 0xc2c2221e
-0, 1589563, 192000, 0x7fdf1f21
-0, 1603756, 192000, 0x85bc251b
-0, 1617948, 192000, 0xe77c251b
-0, 1632141, 192000, 0x8789340c
-0, 1646334, 192000, 0xb6014000
-0, 1660526, 192000, 0xaa9542fd
-0, 1674719, 192000, 0x36ce54eb
-0, 1688911, 192000, 0xd1324ef1
-0, 1703104, 192000, 0x0ade60df
-0, 1717296, 192000, 0xfac56cd3
-0, 1731489, 192000, 0x00000000
-0, 1745681, 192000, 0x00000000
-0, 1759874, 192000, 0xc61c026a
-0, 1774066, 192000, 0x60810842
-0, 1788259, 192000, 0x65081393
-0, 1802451, 192000, 0xc806209f
-0, 1816644, 192000, 0x53aa32cb
-0, 1830836, 192000, 0x176546ef
-0, 1845029, 192000, 0x4e095d0e
-0, 1859221, 192000, 0xf74b7774
-0, 1873414, 192000, 0x32809306
-0, 1887607, 192000, 0x5219ae81
-0, 1901799, 192000, 0x3badcc40
-0, 1915992, 192000, 0x1387ea5d
-0, 1930184, 192000, 0xe0c606f0
-0, 1944377, 192000, 0x106f2197
-0, 1958569, 192000, 0xfe2139cf
-0, 1972762, 192000, 0x907d4f0a
-0, 1986954, 192000, 0x04415dad
-0, 2001147, 192000, 0xe0b864b6
-0, 2015339, 192000, 0xcb2a64b8
-0, 2029532, 192000, 0xcb2a64b8
-0, 2043724, 192000, 0xcb2a64b8
-0, 2057917, 192000, 0xcb2a64b8
-0, 2072109, 192000, 0xcb2a64b8
-0, 2086302, 192000, 0xcb2a64b8
-0, 2100494, 192000, 0xcb2a64b8
-0, 2114687, 192000, 0xcb2a64b8
-0, 2128880, 192000, 0xcb2a64b8
-0, 2143072, 192000, 0xcb2a64b8
-0, 2157265, 192000, 0xcb2a64b8
-0, 2171457, 192000, 0xcb2a64b8
-0, 2185650, 192000, 0xcb2a64b8
-0, 2199842, 192000, 0xcb2a64b8
-0, 2214035, 192000, 0xcb2a64b8
-0, 2228227, 192000, 0xcb2a64b8
-0, 2242420, 192000, 0xcb2a64b8
+#tb 0: 250000/1585341
+0, 0, 0, 1, 192000, 0x3ac10e8e
+0, 1, 1, 1, 192000, 0xb772ee57
+0, 2, 2, 1, 192000, 0x9b6e648a
+0, 3, 3, 1, 192000, 0x3d9c33e3
+0, 4, 4, 1, 192000, 0x006db76d
+0, 5, 5, 1, 192000, 0x006db76d
+0, 6, 6, 1, 192000, 0x006db76d
+0, 7, 7, 1, 192000, 0x006db76d
+0, 8, 8, 1, 192000, 0x006db76d
+0, 9, 9, 1, 192000, 0x006db76d
+0, 10, 10, 1, 192000, 0x006db76d
+0, 11, 11, 1, 192000, 0x006db76d
+0, 12, 12, 1, 192000, 0x006db76d
+0, 13, 13, 1, 192000, 0x006db76d
+0, 14, 14, 1, 192000, 0x006db76d
+0, 15, 15, 1, 192000, 0x7b9b28fb
+0, 16, 16, 1, 192000, 0x7b9b28fb
+0, 17, 17, 1, 192000, 0x7b9b28fb
+0, 18, 18, 1, 192000, 0x7b9b28fb
+0, 19, 19, 1, 192000, 0x7b9b28fb
+0, 20, 20, 1, 192000, 0x7b9b28fb
+0, 21, 21, 1, 192000, 0x67be3519
+0, 22, 22, 1, 192000, 0x67be3519
+0, 23, 23, 1, 192000, 0x67be3519
+0, 24, 24, 1, 192000, 0x67be3519
+0, 25, 25, 1, 192000, 0x67be3519
+0, 26, 26, 1, 192000, 0x2ece70dd
+0, 27, 27, 1, 192000, 0x2ece70dd
+0, 28, 28, 1, 192000, 0x2ece70dd
+0, 29, 29, 1, 192000, 0x2ece70dd
+0, 30, 30, 1, 192000, 0x2ece70dd
+0, 31, 31, 1, 192000, 0x2ece70dd
+0, 32, 32, 1, 192000, 0xd3a382cb
+0, 33, 33, 1, 192000, 0xd3a382cb
+0, 34, 34, 1, 192000, 0xd3a382cb
+0, 35, 35, 1, 192000, 0xd3a382cb
+0, 36, 36, 1, 192000, 0xd3a382cb
+0, 37, 37, 1, 192000, 0xd3a382cb
+0, 38, 38, 1, 192000, 0x2d3d7fce
+0, 39, 39, 1, 192000, 0x2d3d7fce
+0, 40, 40, 1, 192000, 0x2d3d7fce
+0, 41, 41, 1, 192000, 0x2d3d7fce
+0, 42, 42, 1, 192000, 0x2d3d7fce
+0, 43, 43, 1, 192000, 0x36fd52fb
+0, 44, 44, 1, 192000, 0x36fd52fb
+0, 45, 45, 1, 192000, 0x36fd52fb
+0, 46, 46, 1, 192000, 0x36fd52fb
+0, 47, 47, 1, 192000, 0x36fd52fb
+0, 48, 48, 1, 192000, 0x36fd52fb
+0, 49, 49, 1, 192000, 0xa38e9ab3
+0, 50, 50, 1, 192000, 0x57095eef
+0, 51, 51, 1, 192000, 0x5c4f4d01
+0, 52, 52, 1, 192000, 0xac20321c
+0, 53, 53, 1, 192000, 0x7e370e40
+0, 54, 54, 1, 192000, 0xe9d92925
+0, 55, 55, 1, 192000, 0xfef4d26d
+0, 56, 56, 1, 192000, 0x77a4ab94
+0, 57, 57, 1, 192000, 0x802fb18e
+0, 58, 58, 1, 192000, 0xce968db2
+0, 59, 59, 1, 192000, 0x21e6ab94
+0, 60, 60, 1, 192000, 0x309d45fa
+0, 61, 61, 1, 192000, 0x5d193709
+0, 62, 62, 1, 192000, 0x72190d33
+0, 63, 63, 1, 192000, 0xdaed162a
+0, 64, 64, 1, 192000, 0x2fcaf23f
+0, 65, 65, 1, 192000, 0x8986d45d
+0, 66, 66, 1, 192000, 0xcf7de34e
+0, 67, 67, 1, 192000, 0x22390d33
+0, 68, 68, 1, 192000, 0x4b29132d
+0, 69, 69, 1, 192000, 0xbffe1f21
+0, 70, 70, 1, 192000, 0xa4eee34e
+0, 71, 71, 1, 192000, 0xe85ae64b
+0, 72, 72, 1, 192000, 0xb7bef23f
+0, 73, 73, 1, 192000, 0x05ab1927
+0, 74, 74, 1, 192000, 0x915f6cd3
+0, 75, 75, 1, 192000, 0x524d69d6
+0, 76, 76, 1, 192000, 0x62da78c7
+0, 77, 77, 1, 192000, 0xbf6f84bb
+0, 78, 78, 1, 192000, 0xbe9f6cd3
+0, 79, 79, 1, 192000, 0x80d0132d
+0, 80, 80, 1, 192000, 0x0789251b
+0, 81, 81, 1, 192000, 0xba1a1f21
+0, 82, 82, 1, 192000, 0x542b42fd
+0, 83, 83, 1, 192000, 0x0ff951ee
+0, 84, 84, 1, 192000, 0x785048f7
+0, 85, 85, 1, 192000, 0x5a50251b
+0, 86, 86, 1, 192000, 0xd5d73a06
+0, 87, 87, 1, 192000, 0x7a3a54eb
+0, 88, 88, 1, 192000, 0x1e2b5de2
+0, 89, 89, 1, 192000, 0xeac542fd
+0, 90, 90, 1, 192000, 0x897a1f21
+0, 91, 91, 1, 192000, 0x61602b15
+0, 92, 92, 1, 192000, 0xb12f221e
+0, 93, 93, 1, 192000, 0x08541f21
+0, 94, 94, 1, 192000, 0xeebd251b
+0, 95, 95, 1, 192000, 0xc1132e12
+0, 96, 96, 1, 192000, 0x99642818
+0, 97, 97, 1, 192000, 0x9b8e162a
+0, 98, 98, 1, 192000, 0x21b81f21
+0, 99, 99, 1, 192000, 0x1abd1030
+0, 100, 100, 1, 192000, 0x0d613d03
+0, 101, 101, 1, 192000, 0xcb32132d
+0, 102, 102, 1, 192000, 0xc680162a
+0, 103, 103, 1, 192000, 0x8dea2818
+0, 104, 104, 1, 192000, 0x3c4e1927
+0, 105, 105, 1, 192000, 0xed733709
+0, 106, 106, 1, 192000, 0xf4051c24
+0, 107, 107, 1, 192000, 0xb8eb221e
+0, 108, 108, 1, 192000, 0x1a412818
+0, 109, 109, 1, 192000, 0x6ee6162a
+0, 110, 110, 1, 192000, 0xe1a248f7
+0, 111, 111, 1, 192000, 0xc2c2221e
+0, 112, 112, 1, 192000, 0x7fdf1f21
+0, 113, 113, 1, 192000, 0x85bc251b
+0, 114, 114, 1, 192000, 0xe77c251b
+0, 115, 115, 1, 192000, 0x8789340c
+0, 116, 116, 1, 192000, 0xb6014000
+0, 117, 117, 1, 192000, 0xaa9542fd
+0, 118, 118, 1, 192000, 0x36ce54eb
+0, 119, 119, 1, 192000, 0xd1324ef1
+0, 120, 120, 1, 192000, 0x0ade60df
+0, 121, 121, 1, 192000, 0xfac56cd3
+0, 122, 122, 1, 192000, 0x00000000
+0, 123, 123, 1, 192000, 0x00000000
+0, 124, 124, 1, 192000, 0xc61c026a
+0, 125, 125, 1, 192000, 0x60810842
+0, 126, 126, 1, 192000, 0x65081393
+0, 127, 127, 1, 192000, 0xc806209f
+0, 128, 128, 1, 192000, 0x53aa32cb
+0, 129, 129, 1, 192000, 0x176546ef
+0, 130, 130, 1, 192000, 0x4e095d0e
+0, 131, 131, 1, 192000, 0xf74b7774
+0, 132, 132, 1, 192000, 0x32809306
+0, 133, 133, 1, 192000, 0x5219ae81
+0, 134, 134, 1, 192000, 0x3badcc40
+0, 135, 135, 1, 192000, 0x1387ea5d
+0, 136, 136, 1, 192000, 0xe0c606f0
+0, 137, 137, 1, 192000, 0x106f2197
+0, 138, 138, 1, 192000, 0xfe2139cf
+0, 139, 139, 1, 192000, 0x907d4f0a
+0, 140, 140, 1, 192000, 0x04415dad
+0, 141, 141, 1, 192000, 0xe0b864b6
+0, 142, 142, 1, 192000, 0xcb2a64b8
+0, 143, 143, 1, 192000, 0xcb2a64b8
+0, 144, 144, 1, 192000, 0xcb2a64b8
+0, 145, 145, 1, 192000, 0xcb2a64b8
+0, 146, 146, 1, 192000, 0xcb2a64b8
+0, 147, 147, 1, 192000, 0xcb2a64b8
+0, 148, 148, 1, 192000, 0xcb2a64b8
+0, 149, 149, 1, 192000, 0xcb2a64b8
+0, 150, 150, 1, 192000, 0xcb2a64b8
+0, 151, 151, 1, 192000, 0xcb2a64b8
+0, 152, 152, 1, 192000, 0xcb2a64b8
+0, 153, 153, 1, 192000, 0xcb2a64b8
+0, 154, 154, 1, 192000, 0xcb2a64b8
+0, 155, 155, 1, 192000, 0xcb2a64b8
+0, 156, 156, 1, 192000, 0xcb2a64b8
+0, 157, 157, 1, 192000, 0xcb2a64b8
+0, 158, 158, 1, 192000, 0xcb2a64b8
diff --git a/gst-libs/ext/libav/tests/ref/fate/zmbv-8bit b/gst-libs/ext/libav/tests/ref/fate/zmbv-8bit
index 258147f..64dacae 100644
--- a/gst-libs/ext/libav/tests/ref/fate/zmbv-8bit
+++ b/gst-libs/ext/libav/tests/ref/fate/zmbv-8bit
@@ -1,275 +1,276 @@
-0, 0, 192000, 0x5234b617
-0, 1284, 192000, 0x5234b617
-0, 2568, 192000, 0x5234b617
-0, 3852, 192000, 0x5234b617
-0, 5137, 192000, 0x5234b617
-0, 6421, 192000, 0x5234b617
-0, 7705, 192000, 0x5234b617
-0, 8989, 192000, 0x5234b617
-0, 10273, 192000, 0x5234b617
-0, 11557, 192000, 0x5234b617
-0, 12841, 192000, 0x5234b617
-0, 14125, 192000, 0x5234b617
-0, 15410, 192000, 0x5234b617
-0, 16694, 192000, 0x5234b617
-0, 17978, 192000, 0x5234b617
-0, 19262, 192000, 0x5234b617
-0, 20546, 192000, 0x5234b617
-0, 21830, 192000, 0x5234b617
-0, 23114, 192000, 0x5234b617
-0, 24398, 192000, 0x5234b617
-0, 25683, 192000, 0x5234b617
-0, 26967, 192000, 0x5234b617
-0, 28251, 192000, 0x5234b617
-0, 29535, 192000, 0x5234b617
-0, 30819, 192000, 0x5234b617
-0, 32103, 192000, 0x5234b617
-0, 33387, 192000, 0x5234b617
-0, 34672, 192000, 0x5234b617
-0, 35956, 192000, 0x5234b617
-0, 37240, 192000, 0x5234b617
-0, 38524, 192000, 0x5234b617
-0, 39808, 192000, 0x5234b617
-0, 41092, 192000, 0x5234b617
-0, 42376, 192000, 0x5234b617
-0, 43660, 192000, 0x5234b617
-0, 44945, 192000, 0x5234b617
-0, 46229, 192000, 0x5234b617
-0, 47513, 192000, 0x5234b617
-0, 48797, 192000, 0x5234b617
-0, 50081, 192000, 0x5234b617
-0, 51365, 192000, 0x5234b617
-0, 52649, 192000, 0x5234b617
-0, 53934, 192000, 0x5234b617
-0, 55218, 192000, 0x5234b617
-0, 56502, 192000, 0x5234b617
-0, 57786, 192000, 0x5234b617
-0, 59070, 192000, 0x5234b617
-0, 60354, 192000, 0x5234b617
-0, 61638, 192000, 0x5234b617
-0, 62922, 192000, 0x5234b617
-0, 64207, 192000, 0x5234b617
-0, 65491, 192000, 0x5234b617
-0, 66775, 192000, 0x5234b617
-0, 68059, 192000, 0x5234b617
-0, 69343, 192000, 0x5234b617
-0, 70627, 192000, 0x5234b617
-0, 71911, 192000, 0x5234b617
-0, 73195, 192000, 0x5234b617
-0, 74480, 192000, 0x5234b617
-0, 75764, 192000, 0x5234b617
-0, 77048, 192000, 0x5234b617
-0, 78332, 192000, 0x5234b617
-0, 79616, 192000, 0x5234b617
-0, 80900, 192000, 0x5234b617
-0, 82184, 192000, 0x5234b617
-0, 83469, 192000, 0x5234b617
-0, 84753, 192000, 0x5234b617
-0, 86037, 192000, 0x5234b617
-0, 87321, 192000, 0x5234b617
-0, 88605, 192000, 0x5234b617
-0, 89889, 192000, 0x5234b617
-0, 91173, 192000, 0x5234b617
-0, 92457, 192000, 0x5234b617
-0, 93742, 192000, 0x5234b617
-0, 95026, 192000, 0x5234b617
-0, 96310, 192000, 0x5234b617
-0, 97594, 192000, 0x5234b617
-0, 98878, 192000, 0x5234b617
-0, 100162, 192000, 0x5234b617
-0, 101446, 192000, 0x5234b617
-0, 102730, 192000, 0x5234b617
-0, 104015, 192000, 0x5234b617
-0, 105299, 192000, 0x5234b617
-0, 106583, 192000, 0x5234b617
-0, 107867, 192000, 0x5234b617
-0, 109151, 192000, 0x5234b617
-0, 110435, 192000, 0x0c148693
-0, 111719, 192000, 0x973f438b
-0, 113004, 192000, 0x602a279b
-0, 114288, 192000, 0x739c7527
-0, 115572, 192000, 0x4ef4b477
-0, 116856, 192000, 0x8fffec23
-0, 118140, 192000, 0xe192c706
-0, 119424, 192000, 0xf38000e5
-0, 120708, 192000, 0x628b9051
-0, 121992, 192000, 0xd7c162c0
-0, 123277, 192000, 0xd4b85307
-0, 124561, 192000, 0x377cf8cf
-0, 125845, 192000, 0xf1ffdff2
-0, 127129, 192000, 0x95a0ab01
-0, 128413, 192000, 0xeb69c7f0
-0, 129697, 192000, 0xfbd0af52
-0, 130981, 192000, 0x32da6d10
-0, 132266, 192000, 0xca8e7836
-0, 133550, 192000, 0x404cefe9
-0, 134834, 192000, 0x0433e9c8
-0, 136118, 192000, 0xd6e09ecf
-0, 137402, 192000, 0xc9a822b5
-0, 138686, 192000, 0x032f2398
-0, 139970, 192000, 0x9e0305bf
-0, 141254, 192000, 0x9d66c993
-0, 142539, 192000, 0xe126b022
-0, 143823, 192000, 0xb59d2829
-0, 145107, 192000, 0x967ad5b1
-0, 146391, 192000, 0xb76ad1dc
-0, 147675, 192000, 0xc901e6e3
-0, 148959, 192000, 0xd22bc862
-0, 150243, 192000, 0xe7547295
-0, 151527, 192000, 0x179a8d78
-0, 152812, 192000, 0x87a4310f
-0, 154096, 192000, 0x4e24d3b3
-0, 155380, 192000, 0xb1b8e58a
-0, 156664, 192000, 0x0ae55330
-0, 157948, 192000, 0xdb3288ab
-0, 159232, 192000, 0x31867a92
-0, 160516, 192000, 0x2a44a0a5
-0, 161801, 192000, 0x29c062f4
-0, 163085, 192000, 0xf4df3a2b
-0, 164369, 192000, 0x8e424f86
-0, 165653, 192000, 0x25b901f9
-0, 166937, 192000, 0x77af6cad
-0, 168221, 192000, 0x0b82d562
-0, 169505, 192000, 0x4322dc3e
-0, 170789, 192000, 0x4322dc3e
-0, 172074, 192000, 0x4322dc3e
-0, 173358, 192000, 0x2c51f91e
-0, 174642, 192000, 0x2c51f91e
-0, 175926, 192000, 0x2c51f91e
-0, 177210, 192000, 0x2c51f91e
-0, 178494, 192000, 0x197128e5
-0, 179778, 192000, 0x197128e5
-0, 181062, 192000, 0x197128e5
-0, 182347, 192000, 0xb67867c5
-0, 183631, 192000, 0xb67867c5
-0, 184915, 192000, 0xb67867c5
-0, 186199, 192000, 0xb67867c5
-0, 187483, 192000, 0x62fcac19
-0, 188767, 192000, 0x62fcac19
-0, 190051, 192000, 0x62fcac19
-0, 191336, 192000, 0xe4f4f281
-0, 192620, 192000, 0xe4f4f281
-0, 193904, 192000, 0xe4f4f281
-0, 195188, 192000, 0xe4f4f281
-0, 196472, 192000, 0x060c3190
-0, 197756, 192000, 0x060c3190
-0, 199040, 192000, 0x060c3190
-0, 200324, 192000, 0xe5c05bb4
-0, 201609, 192000, 0xe5c05bb4
-0, 202893, 192000, 0xe5c05bb4
-0, 204177, 192000, 0xe5c05bb4
-0, 205461, 192000, 0xd4b187fc
-0, 206745, 192000, 0xd4b187fc
-0, 208029, 192000, 0xd4b187fc
-0, 209313, 192000, 0x9a549a6c
-0, 210597, 192000, 0x9a549a6c
-0, 211882, 192000, 0x9a549a6c
-0, 213166, 192000, 0x9a549a6c
-0, 214450, 192000, 0xd491bd50
-0, 215734, 192000, 0xd491bd50
-0, 217018, 192000, 0xd491bd50
-0, 218302, 192000, 0xfdfad4a8
-0, 219586, 192000, 0xfdfad4a8
-0, 220871, 192000, 0xfdfad4a8
-0, 222155, 192000, 0xfdfad4a8
-0, 223439, 192000, 0x363ef77c
-0, 224723, 192000, 0x363ef77c
-0, 226007, 192000, 0x363ef77c
-0, 227291, 192000, 0x80c016f7
-0, 228575, 192000, 0x80c016f7
-0, 229859, 192000, 0x80c016f7
-0, 231144, 192000, 0x80c016f7
-0, 232428, 192000, 0x65852e7f
-0, 233712, 192000, 0x65852e7f
-0, 234996, 192000, 0x65852e7f
-0, 236280, 192000, 0xcb13542b
-0, 237564, 192000, 0xcb13542b
-0, 238848, 192000, 0xcb13542b
-0, 240133, 192000, 0xcb13542b
-0, 241417, 192000, 0xb7a5664f
-0, 242701, 192000, 0xb7a5664f
-0, 243985, 192000, 0xb7a5664f
-0, 245269, 192000, 0x8a128fd7
-0, 246553, 192000, 0x8a128fd7
-0, 247837, 192000, 0x8a128fd7
-0, 249121, 192000, 0x8a128fd7
-0, 250406, 192000, 0x9674b39b
-0, 251690, 192000, 0x9674b39b
-0, 252974, 192000, 0x9674b39b
-0, 254258, 192000, 0x2940e3b3
-0, 255542, 192000, 0x2940e3b3
-0, 256826, 192000, 0x2940e3b3
-0, 258110, 192000, 0x2940e3b3
-0, 259394, 192000, 0x0440e56b
-0, 260679, 192000, 0x0440e56b
-0, 261963, 192000, 0x0440e56b
-0, 263247, 192000, 0xefa3d16b
-0, 264531, 192000, 0xefa3d16b
-0, 265815, 192000, 0xefa3d16b
-0, 267099, 192000, 0xefa3d16b
-0, 268383, 192000, 0x6569b257
-0, 269668, 192000, 0x6569b257
-0, 270952, 192000, 0x6569b257
-0, 272236, 192000, 0x089985d7
-0, 273520, 192000, 0x089985d7
-0, 274804, 192000, 0x089985d7
-0, 276088, 192000, 0x089985d7
-0, 277372, 192000, 0x87e160af
-0, 278656, 192000, 0x87e160af
-0, 279941, 192000, 0x87e160af
-0, 281225, 192000, 0x117433bb
-0, 282509, 192000, 0x117433bb
-0, 283793, 192000, 0x117433bb
-0, 285077, 192000, 0x117433bb
-0, 286361, 192000, 0xd9e0f8bc
-0, 287645, 192000, 0xd9e0f8bc
-0, 288929, 192000, 0xd9e0f8bc
-0, 290214, 192000, 0x653cac38
-0, 291498, 192000, 0x653cac38
-0, 292782, 192000, 0x653cac38
-0, 294066, 192000, 0x653cac38
-0, 295350, 192000, 0x9070526c
-0, 296634, 192000, 0x9070526c
-0, 297918, 192000, 0x9070526c
-0, 299203, 192000, 0x15e6e9c9
-0, 300487, 192000, 0x15e6e9c9
-0, 301771, 192000, 0x15e6e9c9
-0, 303055, 192000, 0x15e6e9c9
-0, 304339, 192000, 0x610eab25
-0, 305623, 192000, 0x610eab25
-0, 306907, 192000, 0x610eab25
-0, 308191, 192000, 0xde2a829d
-0, 309476, 192000, 0xde2a829d
-0, 310760, 192000, 0xde2a829d
-0, 312044, 192000, 0xde2a829d
-0, 313328, 192000, 0x2014becd
-0, 314612, 192000, 0x2014becd
-0, 315896, 192000, 0x2014becd
-0, 317180, 192000, 0x551e0f98
-0, 318465, 192000, 0x551e0f98
-0, 319749, 192000, 0x551e0f98
-0, 321033, 192000, 0x551e0f98
-0, 322317, 192000, 0x4aaa6bec
-0, 323601, 192000, 0x4aaa6bec
-0, 324885, 192000, 0x4aaa6bec
-0, 326169, 192000, 0x4053d278
-0, 327453, 192000, 0x4053d278
-0, 328738, 192000, 0x4053d278
-0, 330022, 192000, 0x4053d278
-0, 331306, 192000, 0xa0e645db
-0, 332590, 192000, 0xa0e645db
-0, 333874, 192000, 0xa0e645db
-0, 335158, 192000, 0x3f1fc327
-0, 336442, 192000, 0x3f1fc327
-0, 337726, 192000, 0x3f1fc327
-0, 339011, 192000, 0x3f1fc327
-0, 340295, 192000, 0xa4ca2a9a
-0, 341579, 192000, 0xa4ca2a9a
-0, 342863, 192000, 0xa4ca2a9a
-0, 344147, 192000, 0xf1b2b22e
-0, 345431, 192000, 0xf1b2b22e
-0, 346715, 192000, 0xf1b2b22e
-0, 348000, 192000, 0xf1b2b22e
-0, 349284, 192000, 0xd08e49d1
-0, 350568, 192000, 0xd08e49d1
-0, 351852, 192000, 0xd08e49d1
+#tb 0: 1000000/70086303
+0, 0, 0, 1, 192000, 0x5234b617
+0, 1, 1, 1, 192000, 0x5234b617
+0, 2, 2, 1, 192000, 0x5234b617
+0, 3, 3, 1, 192000, 0x5234b617
+0, 4, 4, 1, 192000, 0x5234b617
+0, 5, 5, 1, 192000, 0x5234b617
+0, 6, 6, 1, 192000, 0x5234b617
+0, 7, 7, 1, 192000, 0x5234b617
+0, 8, 8, 1, 192000, 0x5234b617
+0, 9, 9, 1, 192000, 0x5234b617
+0, 10, 10, 1, 192000, 0x5234b617
+0, 11, 11, 1, 192000, 0x5234b617
+0, 12, 12, 1, 192000, 0x5234b617
+0, 13, 13, 1, 192000, 0x5234b617
+0, 14, 14, 1, 192000, 0x5234b617
+0, 15, 15, 1, 192000, 0x5234b617
+0, 16, 16, 1, 192000, 0x5234b617
+0, 17, 17, 1, 192000, 0x5234b617
+0, 18, 18, 1, 192000, 0x5234b617
+0, 19, 19, 1, 192000, 0x5234b617
+0, 20, 20, 1, 192000, 0x5234b617
+0, 21, 21, 1, 192000, 0x5234b617
+0, 22, 22, 1, 192000, 0x5234b617
+0, 23, 23, 1, 192000, 0x5234b617
+0, 24, 24, 1, 192000, 0x5234b617
+0, 25, 25, 1, 192000, 0x5234b617
+0, 26, 26, 1, 192000, 0x5234b617
+0, 27, 27, 1, 192000, 0x5234b617
+0, 28, 28, 1, 192000, 0x5234b617
+0, 29, 29, 1, 192000, 0x5234b617
+0, 30, 30, 1, 192000, 0x5234b617
+0, 31, 31, 1, 192000, 0x5234b617
+0, 32, 32, 1, 192000, 0x5234b617
+0, 33, 33, 1, 192000, 0x5234b617
+0, 34, 34, 1, 192000, 0x5234b617
+0, 35, 35, 1, 192000, 0x5234b617
+0, 36, 36, 1, 192000, 0x5234b617
+0, 37, 37, 1, 192000, 0x5234b617
+0, 38, 38, 1, 192000, 0x5234b617
+0, 39, 39, 1, 192000, 0x5234b617
+0, 40, 40, 1, 192000, 0x5234b617
+0, 41, 41, 1, 192000, 0x5234b617
+0, 42, 42, 1, 192000, 0x5234b617
+0, 43, 43, 1, 192000, 0x5234b617
+0, 44, 44, 1, 192000, 0x5234b617
+0, 45, 45, 1, 192000, 0x5234b617
+0, 46, 46, 1, 192000, 0x5234b617
+0, 47, 47, 1, 192000, 0x5234b617
+0, 48, 48, 1, 192000, 0x5234b617
+0, 49, 49, 1, 192000, 0x5234b617
+0, 50, 50, 1, 192000, 0x5234b617
+0, 51, 51, 1, 192000, 0x5234b617
+0, 52, 52, 1, 192000, 0x5234b617
+0, 53, 53, 1, 192000, 0x5234b617
+0, 54, 54, 1, 192000, 0x5234b617
+0, 55, 55, 1, 192000, 0x5234b617
+0, 56, 56, 1, 192000, 0x5234b617
+0, 57, 57, 1, 192000, 0x5234b617
+0, 58, 58, 1, 192000, 0x5234b617
+0, 59, 59, 1, 192000, 0x5234b617
+0, 60, 60, 1, 192000, 0x5234b617
+0, 61, 61, 1, 192000, 0x5234b617
+0, 62, 62, 1, 192000, 0x5234b617
+0, 63, 63, 1, 192000, 0x5234b617
+0, 64, 64, 1, 192000, 0x5234b617
+0, 65, 65, 1, 192000, 0x5234b617
+0, 66, 66, 1, 192000, 0x5234b617
+0, 67, 67, 1, 192000, 0x5234b617
+0, 68, 68, 1, 192000, 0x5234b617
+0, 69, 69, 1, 192000, 0x5234b617
+0, 70, 70, 1, 192000, 0x5234b617
+0, 71, 71, 1, 192000, 0x5234b617
+0, 72, 72, 1, 192000, 0x5234b617
+0, 73, 73, 1, 192000, 0x5234b617
+0, 74, 74, 1, 192000, 0x5234b617
+0, 75, 75, 1, 192000, 0x5234b617
+0, 76, 76, 1, 192000, 0x5234b617
+0, 77, 77, 1, 192000, 0x5234b617
+0, 78, 78, 1, 192000, 0x5234b617
+0, 79, 79, 1, 192000, 0x5234b617
+0, 80, 80, 1, 192000, 0x5234b617
+0, 81, 81, 1, 192000, 0x5234b617
+0, 82, 82, 1, 192000, 0x5234b617
+0, 83, 83, 1, 192000, 0x5234b617
+0, 84, 84, 1, 192000, 0x5234b617
+0, 85, 85, 1, 192000, 0x5234b617
+0, 86, 86, 1, 192000, 0x0c148693
+0, 87, 87, 1, 192000, 0x973f438b
+0, 88, 88, 1, 192000, 0x602a279b
+0, 89, 89, 1, 192000, 0x739c7527
+0, 90, 90, 1, 192000, 0x4ef4b477
+0, 91, 91, 1, 192000, 0x8fffec23
+0, 92, 92, 1, 192000, 0xe192c706
+0, 93, 93, 1, 192000, 0xf38000e5
+0, 94, 94, 1, 192000, 0x628b9051
+0, 95, 95, 1, 192000, 0xd7c162c0
+0, 96, 96, 1, 192000, 0xd4b85307
+0, 97, 97, 1, 192000, 0x377cf8cf
+0, 98, 98, 1, 192000, 0xf1ffdff2
+0, 99, 99, 1, 192000, 0x95a0ab01
+0, 100, 100, 1, 192000, 0xeb69c7f0
+0, 101, 101, 1, 192000, 0xfbd0af52
+0, 102, 102, 1, 192000, 0x32da6d10
+0, 103, 103, 1, 192000, 0xca8e7836
+0, 104, 104, 1, 192000, 0x404cefe9
+0, 105, 105, 1, 192000, 0x0433e9c8
+0, 106, 106, 1, 192000, 0xd6e09ecf
+0, 107, 107, 1, 192000, 0xc9a822b5
+0, 108, 108, 1, 192000, 0x032f2398
+0, 109, 109, 1, 192000, 0x9e0305bf
+0, 110, 110, 1, 192000, 0x9d66c993
+0, 111, 111, 1, 192000, 0xe126b022
+0, 112, 112, 1, 192000, 0xb59d2829
+0, 113, 113, 1, 192000, 0x967ad5b1
+0, 114, 114, 1, 192000, 0xb76ad1dc
+0, 115, 115, 1, 192000, 0xc901e6e3
+0, 116, 116, 1, 192000, 0xd22bc862
+0, 117, 117, 1, 192000, 0xe7547295
+0, 118, 118, 1, 192000, 0x179a8d78
+0, 119, 119, 1, 192000, 0x87a4310f
+0, 120, 120, 1, 192000, 0x4e24d3b3
+0, 121, 121, 1, 192000, 0xb1b8e58a
+0, 122, 122, 1, 192000, 0x0ae55330
+0, 123, 123, 1, 192000, 0xdb3288ab
+0, 124, 124, 1, 192000, 0x31867a92
+0, 125, 125, 1, 192000, 0x2a44a0a5
+0, 126, 126, 1, 192000, 0x29c062f4
+0, 127, 127, 1, 192000, 0xf4df3a2b
+0, 128, 128, 1, 192000, 0x8e424f86
+0, 129, 129, 1, 192000, 0x25b901f9
+0, 130, 130, 1, 192000, 0x77af6cad
+0, 131, 131, 1, 192000, 0x0b82d562
+0, 132, 132, 1, 192000, 0x4322dc3e
+0, 133, 133, 1, 192000, 0x4322dc3e
+0, 134, 134, 1, 192000, 0x4322dc3e
+0, 135, 135, 1, 192000, 0x2c51f91e
+0, 136, 136, 1, 192000, 0x2c51f91e
+0, 137, 137, 1, 192000, 0x2c51f91e
+0, 138, 138, 1, 192000, 0x2c51f91e
+0, 139, 139, 1, 192000, 0x197128e5
+0, 140, 140, 1, 192000, 0x197128e5
+0, 141, 141, 1, 192000, 0x197128e5
+0, 142, 142, 1, 192000, 0xb67867c5
+0, 143, 143, 1, 192000, 0xb67867c5
+0, 144, 144, 1, 192000, 0xb67867c5
+0, 145, 145, 1, 192000, 0xb67867c5
+0, 146, 146, 1, 192000, 0x62fcac19
+0, 147, 147, 1, 192000, 0x62fcac19
+0, 148, 148, 1, 192000, 0x62fcac19
+0, 149, 149, 1, 192000, 0xe4f4f281
+0, 150, 150, 1, 192000, 0xe4f4f281
+0, 151, 151, 1, 192000, 0xe4f4f281
+0, 152, 152, 1, 192000, 0xe4f4f281
+0, 153, 153, 1, 192000, 0x060c3190
+0, 154, 154, 1, 192000, 0x060c3190
+0, 155, 155, 1, 192000, 0x060c3190
+0, 156, 156, 1, 192000, 0xe5c05bb4
+0, 157, 157, 1, 192000, 0xe5c05bb4
+0, 158, 158, 1, 192000, 0xe5c05bb4
+0, 159, 159, 1, 192000, 0xe5c05bb4
+0, 160, 160, 1, 192000, 0xd4b187fc
+0, 161, 161, 1, 192000, 0xd4b187fc
+0, 162, 162, 1, 192000, 0xd4b187fc
+0, 163, 163, 1, 192000, 0x9a549a6c
+0, 164, 164, 1, 192000, 0x9a549a6c
+0, 165, 165, 1, 192000, 0x9a549a6c
+0, 166, 166, 1, 192000, 0x9a549a6c
+0, 167, 167, 1, 192000, 0xd491bd50
+0, 168, 168, 1, 192000, 0xd491bd50
+0, 169, 169, 1, 192000, 0xd491bd50
+0, 170, 170, 1, 192000, 0xfdfad4a8
+0, 171, 171, 1, 192000, 0xfdfad4a8
+0, 172, 172, 1, 192000, 0xfdfad4a8
+0, 173, 173, 1, 192000, 0xfdfad4a8
+0, 174, 174, 1, 192000, 0x363ef77c
+0, 175, 175, 1, 192000, 0x363ef77c
+0, 176, 176, 1, 192000, 0x363ef77c
+0, 177, 177, 1, 192000, 0x80c016f7
+0, 178, 178, 1, 192000, 0x80c016f7
+0, 179, 179, 1, 192000, 0x80c016f7
+0, 180, 180, 1, 192000, 0x80c016f7
+0, 181, 181, 1, 192000, 0x65852e7f
+0, 182, 182, 1, 192000, 0x65852e7f
+0, 183, 183, 1, 192000, 0x65852e7f
+0, 184, 184, 1, 192000, 0xcb13542b
+0, 185, 185, 1, 192000, 0xcb13542b
+0, 186, 186, 1, 192000, 0xcb13542b
+0, 187, 187, 1, 192000, 0xcb13542b
+0, 188, 188, 1, 192000, 0xb7a5664f
+0, 189, 189, 1, 192000, 0xb7a5664f
+0, 190, 190, 1, 192000, 0xb7a5664f
+0, 191, 191, 1, 192000, 0x8a128fd7
+0, 192, 192, 1, 192000, 0x8a128fd7
+0, 193, 193, 1, 192000, 0x8a128fd7
+0, 194, 194, 1, 192000, 0x8a128fd7
+0, 195, 195, 1, 192000, 0x9674b39b
+0, 196, 196, 1, 192000, 0x9674b39b
+0, 197, 197, 1, 192000, 0x9674b39b
+0, 198, 198, 1, 192000, 0x2940e3b3
+0, 199, 199, 1, 192000, 0x2940e3b3
+0, 200, 200, 1, 192000, 0x2940e3b3
+0, 201, 201, 1, 192000, 0x2940e3b3
+0, 202, 202, 1, 192000, 0x0440e56b
+0, 203, 203, 1, 192000, 0x0440e56b
+0, 204, 204, 1, 192000, 0x0440e56b
+0, 205, 205, 1, 192000, 0xefa3d16b
+0, 206, 206, 1, 192000, 0xefa3d16b
+0, 207, 207, 1, 192000, 0xefa3d16b
+0, 208, 208, 1, 192000, 0xefa3d16b
+0, 209, 209, 1, 192000, 0x6569b257
+0, 210, 210, 1, 192000, 0x6569b257
+0, 211, 211, 1, 192000, 0x6569b257
+0, 212, 212, 1, 192000, 0x089985d7
+0, 213, 213, 1, 192000, 0x089985d7
+0, 214, 214, 1, 192000, 0x089985d7
+0, 215, 215, 1, 192000, 0x089985d7
+0, 216, 216, 1, 192000, 0x87e160af
+0, 217, 217, 1, 192000, 0x87e160af
+0, 218, 218, 1, 192000, 0x87e160af
+0, 219, 219, 1, 192000, 0x117433bb
+0, 220, 220, 1, 192000, 0x117433bb
+0, 221, 221, 1, 192000, 0x117433bb
+0, 222, 222, 1, 192000, 0x117433bb
+0, 223, 223, 1, 192000, 0xd9e0f8bc
+0, 224, 224, 1, 192000, 0xd9e0f8bc
+0, 225, 225, 1, 192000, 0xd9e0f8bc
+0, 226, 226, 1, 192000, 0x653cac38
+0, 227, 227, 1, 192000, 0x653cac38
+0, 228, 228, 1, 192000, 0x653cac38
+0, 229, 229, 1, 192000, 0x653cac38
+0, 230, 230, 1, 192000, 0x9070526c
+0, 231, 231, 1, 192000, 0x9070526c
+0, 232, 232, 1, 192000, 0x9070526c
+0, 233, 233, 1, 192000, 0x15e6e9c9
+0, 234, 234, 1, 192000, 0x15e6e9c9
+0, 235, 235, 1, 192000, 0x15e6e9c9
+0, 236, 236, 1, 192000, 0x15e6e9c9
+0, 237, 237, 1, 192000, 0x610eab25
+0, 238, 238, 1, 192000, 0x610eab25
+0, 239, 239, 1, 192000, 0x610eab25
+0, 240, 240, 1, 192000, 0xde2a829d
+0, 241, 241, 1, 192000, 0xde2a829d
+0, 242, 242, 1, 192000, 0xde2a829d
+0, 243, 243, 1, 192000, 0xde2a829d
+0, 244, 244, 1, 192000, 0x2014becd
+0, 245, 245, 1, 192000, 0x2014becd
+0, 246, 246, 1, 192000, 0x2014becd
+0, 247, 247, 1, 192000, 0x551e0f98
+0, 248, 248, 1, 192000, 0x551e0f98
+0, 249, 249, 1, 192000, 0x551e0f98
+0, 250, 250, 1, 192000, 0x551e0f98
+0, 251, 251, 1, 192000, 0x4aaa6bec
+0, 252, 252, 1, 192000, 0x4aaa6bec
+0, 253, 253, 1, 192000, 0x4aaa6bec
+0, 254, 254, 1, 192000, 0x4053d278
+0, 255, 255, 1, 192000, 0x4053d278
+0, 256, 256, 1, 192000, 0x4053d278
+0, 257, 257, 1, 192000, 0x4053d278
+0, 258, 258, 1, 192000, 0xa0e645db
+0, 259, 259, 1, 192000, 0xa0e645db
+0, 260, 260, 1, 192000, 0xa0e645db
+0, 261, 261, 1, 192000, 0x3f1fc327
+0, 262, 262, 1, 192000, 0x3f1fc327
+0, 263, 263, 1, 192000, 0x3f1fc327
+0, 264, 264, 1, 192000, 0x3f1fc327
+0, 265, 265, 1, 192000, 0xa4ca2a9a
+0, 266, 266, 1, 192000, 0xa4ca2a9a
+0, 267, 267, 1, 192000, 0xa4ca2a9a
+0, 268, 268, 1, 192000, 0xf1b2b22e
+0, 269, 269, 1, 192000, 0xf1b2b22e
+0, 270, 270, 1, 192000, 0xf1b2b22e
+0, 271, 271, 1, 192000, 0xf1b2b22e
+0, 272, 272, 1, 192000, 0xd08e49d1
+0, 273, 273, 1, 192000, 0xd08e49d1
+0, 274, 274, 1, 192000, 0xd08e49d1
diff --git a/gst-libs/ext/libav/tests/ref/lavf/asf b/gst-libs/ext/libav/tests/ref/lavf/asf
index 533a3c3..0137925 100644
--- a/gst-libs/ext/libav/tests/ref/lavf/asf
+++ b/gst-libs/ext/libav/tests/ref/lavf/asf
@@ -1,3 +1,3 @@
-c544bb40c2f4c09d44318db5228ee499 *./tests/data/lavf/lavf.asf
+528d3cbe33288ad983a8ff5b66738976 *./tests/data/lavf/lavf.asf
333375 ./tests/data/lavf/lavf.asf
-./tests/data/lavf/lavf.asf CRC=0x9f5ab3e6
+./tests/data/lavf/lavf.asf CRC=0xba1f5213
diff --git a/gst-libs/ext/libav/tests/ref/lavf/avi b/gst-libs/ext/libav/tests/ref/lavf/avi
index cf47755..50646aa 100644
--- a/gst-libs/ext/libav/tests/ref/lavf/avi
+++ b/gst-libs/ext/libav/tests/ref/lavf/avi
@@ -1,3 +1,3 @@
-7e5e4db8c04f0acd16cff6b30e60d0e5 *./tests/data/lavf/lavf.avi
-331032 ./tests/data/lavf/lavf.avi
-./tests/data/lavf/lavf.avi CRC=0x2a83e6b0
+e6319b86a4422a8317124fc4cc693f8c *./tests/data/lavf/lavf.avi
+330786 ./tests/data/lavf/lavf.avi
+./tests/data/lavf/lavf.avi CRC=0xa79b84dd
diff --git a/gst-libs/ext/libav/tests/ref/lavf/dpx b/gst-libs/ext/libav/tests/ref/lavf/dpx
new file mode 100644
index 0000000..a852ae0
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/lavf/dpx
@@ -0,0 +1,3 @@
+808ea110635774252439722a48329d61 *./tests/data/images/dpx/02.dpx
+./tests/data/images/dpx/%02d.dpx CRC=0x6da01946
+305792 ./tests/data/images/dpx/02.dpx
diff --git a/gst-libs/ext/libav/tests/ref/lavf/dv_fmt b/gst-libs/ext/libav/tests/ref/lavf/dv_fmt
index 7406dff..c2b7335 100644
--- a/gst-libs/ext/libav/tests/ref/lavf/dv_fmt
+++ b/gst-libs/ext/libav/tests/ref/lavf/dv_fmt
@@ -1,3 +1,3 @@
-522e5e5a46b99f8ad8aabdaf3d2f1869 *./tests/data/lavf/lavf.dv
+eb51fbb48af28584ea5515f9f2400fcd *./tests/data/lavf/lavf.dv
3600000 ./tests/data/lavf/lavf.dv
-./tests/data/lavf/lavf.dv CRC=0x02c0af30
+./tests/data/lavf/lavf.dv CRC=0x0e868a82
diff --git a/gst-libs/ext/libav/tests/ref/lavf/ffm b/gst-libs/ext/libav/tests/ref/lavf/ffm
index cdfec4d..8921544 100644
--- a/gst-libs/ext/libav/tests/ref/lavf/ffm
+++ b/gst-libs/ext/libav/tests/ref/lavf/ffm
@@ -1,3 +1,3 @@
-bf46c0b53fc318d0a60fa9bf446b2e4f *./tests/data/lavf/lavf.ffm
+c5dcf5950031020864db57bbde0064df *./tests/data/lavf/lavf.ffm
376832 ./tests/data/lavf/lavf.ffm
-./tests/data/lavf/lavf.ffm CRC=0xf361ed74
+./tests/data/lavf/lavf.ffm CRC=0x38388ba1
diff --git a/gst-libs/ext/libav/tests/ref/lavf/gxf b/gst-libs/ext/libav/tests/ref/lavf/gxf
index 6b39c2f..0d28ac5 100644
--- a/gst-libs/ext/libav/tests/ref/lavf/gxf
+++ b/gst-libs/ext/libav/tests/ref/lavf/gxf
@@ -1,3 +1,3 @@
-346d38d330ab5cb0caa6b5537167bc0d *./tests/data/lavf/lavf.gxf
+32e34e23f3740e27e5bcf1621a698aad *./tests/data/lavf/lavf.gxf
796392 ./tests/data/lavf/lavf.gxf
-./tests/data/lavf/lavf.gxf CRC=0x345f86eb
+./tests/data/lavf/lavf.gxf CRC=0x4f52fc7f
diff --git a/gst-libs/ext/libav/tests/ref/lavf/mkv b/gst-libs/ext/libav/tests/ref/lavf/mkv
index 05eb67d..5ea3638 100644
--- a/gst-libs/ext/libav/tests/ref/lavf/mkv
+++ b/gst-libs/ext/libav/tests/ref/lavf/mkv
@@ -1,3 +1,3 @@
-a36c2d9378b9870880556ced1cb89ecf *./tests/data/lavf/lavf.mkv
- 320478 ./tests/data/lavf/lavf.mkv
-./tests/data/lavf/lavf.mkv CRC=0x2a83e6b0
+2c6fbc2c818c849e77702141294d775d *./tests/data/lavf/lavf.mkv
+320262 ./tests/data/lavf/lavf.mkv
+./tests/data/lavf/lavf.mkv CRC=0xd86284dd
diff --git a/gst-libs/ext/libav/tests/ref/lavf/mov b/gst-libs/ext/libav/tests/ref/lavf/mov
index a4ae2d5..2db01d4 100644
--- a/gst-libs/ext/libav/tests/ref/lavf/mov
+++ b/gst-libs/ext/libav/tests/ref/lavf/mov
@@ -1,3 +1,3 @@
-6c5472152b46e070ae6da359838e1f86 *./tests/data/lavf/lavf.mov
-357717 ./tests/data/lavf/lavf.mov
+a5c982910b1a1547db68ffa35cc2a05a *./tests/data/lavf/lavf.mov
+357741 ./tests/data/lavf/lavf.mov
./tests/data/lavf/lavf.mov CRC=0x2f6a9b26
diff --git a/gst-libs/ext/libav/tests/ref/lavf/mpg b/gst-libs/ext/libav/tests/ref/lavf/mpg
index b81cb8a..e76f747 100644
--- a/gst-libs/ext/libav/tests/ref/lavf/mpg
+++ b/gst-libs/ext/libav/tests/ref/lavf/mpg
@@ -1,3 +1,3 @@
-dd60652c2193670abffb8c2a123a820e *./tests/data/lavf/lavf.mpg
+af32acbc73ee486b05a37d53e516d5e7 *./tests/data/lavf/lavf.mpg
372736 ./tests/data/lavf/lavf.mpg
-./tests/data/lavf/lavf.mpg CRC=0xf361ed74
+./tests/data/lavf/lavf.mpg CRC=0x38388ba1
diff --git a/gst-libs/ext/libav/tests/ref/lavf/mxf b/gst-libs/ext/libav/tests/ref/lavf/mxf
index b5aea3c..c69e278 100644
--- a/gst-libs/ext/libav/tests/ref/lavf/mxf
+++ b/gst-libs/ext/libav/tests/ref/lavf/mxf
@@ -1,3 +1,3 @@
-6e9bd63c5cadd7550ad313553ebf665f *./tests/data/lavf/lavf.mxf
+21d359aecf0453a5910d2c1a9ec906b2 *./tests/data/lavf/lavf.mxf
525881 ./tests/data/lavf/lavf.mxf
-./tests/data/lavf/lavf.mxf CRC=0x4ace0849
+./tests/data/lavf/lavf.mxf CRC=0x773f059a
diff --git a/gst-libs/ext/libav/tests/ref/lavf/mxf_d10 b/gst-libs/ext/libav/tests/ref/lavf/mxf_d10
index f59a99e..98569c4 100644
--- a/gst-libs/ext/libav/tests/ref/lavf/mxf_d10
+++ b/gst-libs/ext/libav/tests/ref/lavf/mxf_d10
@@ -1,3 +1,3 @@
-e7168856f2b54c6272685967e707fb21 *./tests/data/lavf/lavf.mxf_d10
+b66087558cd1ff8e64290ffd856c88bc *./tests/data/lavf/lavf.mxf_d10
5330989 ./tests/data/lavf/lavf.mxf_d10
-./tests/data/lavf/lavf.mxf_d10 CRC=0xc3f4f92e
+./tests/data/lavf/lavf.mxf_d10 CRC=0x4474d480
diff --git a/gst-libs/ext/libav/tests/ref/lavf/nut b/gst-libs/ext/libav/tests/ref/lavf/nut
index 461b185..e658434 100644
--- a/gst-libs/ext/libav/tests/ref/lavf/nut
+++ b/gst-libs/ext/libav/tests/ref/lavf/nut
@@ -1,3 +1,3 @@
-16b9d2cf8effb7dae316c6b9248a49b7 *./tests/data/lavf/lavf.nut
-319888 ./tests/data/lavf/lavf.nut
-./tests/data/lavf/lavf.nut CRC=0x2a83e6b0
+7e44a8ed5ff2fe5442f758d48fe1b496 *./tests/data/lavf/lavf.nut
+319680 ./tests/data/lavf/lavf.nut
+./tests/data/lavf/lavf.nut CRC=0xa79b84dd
diff --git a/gst-libs/ext/libav/tests/ref/lavf/ogg b/gst-libs/ext/libav/tests/ref/lavf/ogg
index b90bb70..7bc66a3 100644
--- a/gst-libs/ext/libav/tests/ref/lavf/ogg
+++ b/gst-libs/ext/libav/tests/ref/lavf/ogg
@@ -1,3 +1,3 @@
-b55661ae1a65f99af249d8efc7619a03 *./tests/data/lavf/lavf.ogg
-13819 ./tests/data/lavf/lavf.ogg
-./tests/data/lavf/lavf.ogg CRC=0xf1ae5536
+37147a98d9a484208389efa6a1f8796f *./tests/data/lavf/lavf.ogg
+13966 ./tests/data/lavf/lavf.ogg
+./tests/data/lavf/lavf.ogg CRC=0x37a143ea
diff --git a/gst-libs/ext/libav/tests/ref/lavf/pam b/gst-libs/ext/libav/tests/ref/lavf/pam
new file mode 100644
index 0000000..e53132a
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/lavf/pam
@@ -0,0 +1,3 @@
+0dce5565222cf0f8b309467f279aecd2 *./tests/data/images/pam/02.pam
+./tests/data/images/pam/%02d.pam CRC=0x6da01946
+304191 ./tests/data/images/pam/02.pam
diff --git a/gst-libs/ext/libav/tests/ref/lavf/rm b/gst-libs/ext/libav/tests/ref/lavf/rm
index eae422a..188d15d 100644
--- a/gst-libs/ext/libav/tests/ref/lavf/rm
+++ b/gst-libs/ext/libav/tests/ref/lavf/rm
@@ -1,2 +1,2 @@
-2e3d6b1944c6cd2cf14e13055aecf82a *./tests/data/lavf/lavf.rm
-346706 ./tests/data/lavf/lavf.rm
+c002d460bc77043ced69fd00f4ae7968 *./tests/data/lavf/lavf.rm
+346414 ./tests/data/lavf/lavf.rm
diff --git a/gst-libs/ext/libav/tests/ref/lavf/rso b/gst-libs/ext/libav/tests/ref/lavf/rso
new file mode 100644
index 0000000..648c248
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/lavf/rso
@@ -0,0 +1,3 @@
+f41fd78f7df981802e7caeb23648b8c0 *./tests/data/lavf/lavf.rso
+45064 ./tests/data/lavf/lavf.rso
+./tests/data/lavf/lavf.rso CRC=0x74b2b546
diff --git a/gst-libs/ext/libav/tests/ref/lavf/sox b/gst-libs/ext/libav/tests/ref/lavf/sox
new file mode 100644
index 0000000..0026480
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/lavf/sox
@@ -0,0 +1,3 @@
+e6f278256f145b69ed06f35b8d3585c1 *./tests/data/lavf/lavf.sox
+180256 ./tests/data/lavf/lavf.sox
+./tests/data/lavf/lavf.sox CRC=0xf1ae5536
diff --git a/gst-libs/ext/libav/tests/ref/lavf/sunrast b/gst-libs/ext/libav/tests/ref/lavf/sunrast
new file mode 100644
index 0000000..4db0505
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/lavf/sunrast
@@ -0,0 +1,3 @@
+07518bcb0841bc677ce6aea8464ea240 *./tests/data/images/sun/02.sun
+./tests/data/images/sun/%02d.sun CRC=0xe6c71946
+304123 ./tests/data/images/sun/02.sun
diff --git a/gst-libs/ext/libav/tests/ref/lavf/ts b/gst-libs/ext/libav/tests/ref/lavf/ts
index ebe6a77..333149e 100644
--- a/gst-libs/ext/libav/tests/ref/lavf/ts
+++ b/gst-libs/ext/libav/tests/ref/lavf/ts
@@ -1,3 +1,3 @@
-293142d7286db15e5f4d7d1ca0d9c97c *./tests/data/lavf/lavf.ts
-406644 ./tests/data/lavf/lavf.ts
-./tests/data/lavf/lavf.ts CRC=0x133216c1
+ec8df9c78de8f7f20a3eb1ce8f863c02 *./tests/data/lavf/lavf.ts
+406456 ./tests/data/lavf/lavf.ts
+./tests/data/lavf/lavf.ts CRC=0x0fdeb4df
diff --git a/gst-libs/ext/libav/tests/ref/lavf/voc b/gst-libs/ext/libav/tests/ref/lavf/voc
index 25e8b44..ea903b6 100644
--- a/gst-libs/ext/libav/tests/ref/lavf/voc
+++ b/gst-libs/ext/libav/tests/ref/lavf/voc
@@ -1,3 +1,3 @@
-b0bc287ce4e3eef7c1012610dd7ff6d0 *./tests/data/lavf/lavf.voc
-32768 ./tests/data/lavf/lavf.voc
-./tests/data/lavf/lavf.voc CRC=0xa2d77c12
+5c4ee01048e7a8a138a97e80cf7a1924 *./tests/data/lavf/lavf.voc
+45261 ./tests/data/lavf/lavf.voc
+./tests/data/lavf/lavf.voc CRC=0x74b2b546
diff --git a/gst-libs/ext/libav/tests/ref/lavf/voc_s16 b/gst-libs/ext/libav/tests/ref/lavf/voc_s16
index 425d965..d53c950 100644
--- a/gst-libs/ext/libav/tests/ref/lavf/voc_s16
+++ b/gst-libs/ext/libav/tests/ref/lavf/voc_s16
@@ -1,3 +1,3 @@
-b20728bf036d2e23508869acbad4e576 *./tests/data/lavf/lavf.s16.voc
-163840 ./tests/data/lavf/lavf.s16.voc
-./tests/data/lavf/lavf.s16.voc CRC=0xfa9b6c39
+8ed10b311e49b4d4b18679b126492159 *./tests/data/lavf/lavf.s16.voc
+180437 ./tests/data/lavf/lavf.s16.voc
+./tests/data/lavf/lavf.s16.voc CRC=0x7bd585ff
diff --git a/gst-libs/ext/libav/tests/ref/lavf/xwd b/gst-libs/ext/libav/tests/ref/lavf/xwd
new file mode 100644
index 0000000..41846c7
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/lavf/xwd
@@ -0,0 +1,3 @@
+50baa5560b7d1aa3188b19c1162bf7dc *./tests/data/images/xwd/02.xwd
+./tests/data/images/xwd/%02d.xwd CRC=0x6da01946
+304239 ./tests/data/images/xwd/02.xwd
diff --git a/gst-libs/ext/libav/tests/ref/lavfi/crop_scale_vflip b/gst-libs/ext/libav/tests/ref/lavfi/crop_scale_vflip
index 07c729a..29574f7 100644
--- a/gst-libs/ext/libav/tests/ref/lavfi/crop_scale_vflip
+++ b/gst-libs/ext/libav/tests/ref/lavfi/crop_scale_vflip
@@ -1 +1 @@
-crop_scale_vflip e88a4dfb960d0bb28ee875567bedde5d
+crop_scale_vflip 3e2c7694d37733ca52e1723d5262af36
diff --git a/gst-libs/ext/libav/tests/ref/lavfi/pixdesc b/gst-libs/ext/libav/tests/ref/lavfi/pixdesc
index 5dfa270..d1ccbbc 100644
--- a/gst-libs/ext/libav/tests/ref/lavfi/pixdesc
+++ b/gst-libs/ext/libav/tests/ref/lavfi/pixdesc
@@ -57,6 +57,26 @@ yuv444p16le 20f86bc2f68d2b3f1f2b48b97b2189f4
yuv444p9be 6ab31f4c12b533ce318ecdff83cdd054
yuv444p9le f0606604a5c08becab6ba500124c4b7c
yuva420p a29884f3f3dfe1e00b961bc17bef3d47
+yuva420p10be 145366ff1632de3e300d947f49844284
+yuva420p10le d797038552d7f698e4d1db4dfa18ceb0
+yuva420p16be 25a335f66a0670911ced818aa42fb670
+yuva420p16le 97bf252e6c030f0f0412d3826c2ea259
+yuva420p9be 06b764d85bd3c22e9b7ca4babed84d4f
+yuva420p9le 1f01cdd4fc46f98d4c11b2947307a0e3
+yuva422p 92b6815f465297284cdb843711682cee
+yuva422p10be fb240ff9ac49b45b1b3d40df2c89e39d
+yuva422p10le f767ede9ba1d427faadc963cf41d2412
+yuva422p16be ef442b11b26e5e61f3c958fa309576dd
+yuva422p16le 5789009759d7a44dacc6da2194e402b1
+yuva422p9be e0d2f45f7f5541eee988137c7ebb3495
+yuva422p9le a4ec81f328efd3856dec430fb27f2f56
+yuva444p c523716e4900cfe515eaab1d7124fdd9
+yuva444p10be f5791a75fdb86da0c243511ef9ab8fbd
+yuva444p10le 578e88dfbe4ab07f280fcc7554f3a5c4
+yuva444p16be ee7b9dd854e36b165d5b7cffb646ba6c
+yuva444p16le ec93b2907923d5655e9fb085479260ef
+yuva444p9be 03414257d78e72c28d03e3c247319b7c
+yuva444p9le e421d753257e36a79c2c0ec1607ac9e6
yuvj420p 32eec78ba51857b16ce9b813a49b7189
yuvj422p 0dfa0ed434f73be51428758c69e082cb
yuvj440p 657501a28004e27a592757a7509f5189
diff --git a/gst-libs/ext/libav/tests/ref/lavfi/pixfmts_copy b/gst-libs/ext/libav/tests/ref/lavfi/pixfmts_copy
index 5dfa270..d1ccbbc 100644
--- a/gst-libs/ext/libav/tests/ref/lavfi/pixfmts_copy
+++ b/gst-libs/ext/libav/tests/ref/lavfi/pixfmts_copy
@@ -57,6 +57,26 @@ yuv444p16le 20f86bc2f68d2b3f1f2b48b97b2189f4
yuv444p9be 6ab31f4c12b533ce318ecdff83cdd054
yuv444p9le f0606604a5c08becab6ba500124c4b7c
yuva420p a29884f3f3dfe1e00b961bc17bef3d47
+yuva420p10be 145366ff1632de3e300d947f49844284
+yuva420p10le d797038552d7f698e4d1db4dfa18ceb0
+yuva420p16be 25a335f66a0670911ced818aa42fb670
+yuva420p16le 97bf252e6c030f0f0412d3826c2ea259
+yuva420p9be 06b764d85bd3c22e9b7ca4babed84d4f
+yuva420p9le 1f01cdd4fc46f98d4c11b2947307a0e3
+yuva422p 92b6815f465297284cdb843711682cee
+yuva422p10be fb240ff9ac49b45b1b3d40df2c89e39d
+yuva422p10le f767ede9ba1d427faadc963cf41d2412
+yuva422p16be ef442b11b26e5e61f3c958fa309576dd
+yuva422p16le 5789009759d7a44dacc6da2194e402b1
+yuva422p9be e0d2f45f7f5541eee988137c7ebb3495
+yuva422p9le a4ec81f328efd3856dec430fb27f2f56
+yuva444p c523716e4900cfe515eaab1d7124fdd9
+yuva444p10be f5791a75fdb86da0c243511ef9ab8fbd
+yuva444p10le 578e88dfbe4ab07f280fcc7554f3a5c4
+yuva444p16be ee7b9dd854e36b165d5b7cffb646ba6c
+yuva444p16le ec93b2907923d5655e9fb085479260ef
+yuva444p9be 03414257d78e72c28d03e3c247319b7c
+yuva444p9le e421d753257e36a79c2c0ec1607ac9e6
yuvj420p 32eec78ba51857b16ce9b813a49b7189
yuvj422p 0dfa0ed434f73be51428758c69e082cb
yuvj440p 657501a28004e27a592757a7509f5189
diff --git a/gst-libs/ext/libav/tests/ref/lavfi/pixfmts_null b/gst-libs/ext/libav/tests/ref/lavfi/pixfmts_null
index 5dfa270..d1ccbbc 100644
--- a/gst-libs/ext/libav/tests/ref/lavfi/pixfmts_null
+++ b/gst-libs/ext/libav/tests/ref/lavfi/pixfmts_null
@@ -57,6 +57,26 @@ yuv444p16le 20f86bc2f68d2b3f1f2b48b97b2189f4
yuv444p9be 6ab31f4c12b533ce318ecdff83cdd054
yuv444p9le f0606604a5c08becab6ba500124c4b7c
yuva420p a29884f3f3dfe1e00b961bc17bef3d47
+yuva420p10be 145366ff1632de3e300d947f49844284
+yuva420p10le d797038552d7f698e4d1db4dfa18ceb0
+yuva420p16be 25a335f66a0670911ced818aa42fb670
+yuva420p16le 97bf252e6c030f0f0412d3826c2ea259
+yuva420p9be 06b764d85bd3c22e9b7ca4babed84d4f
+yuva420p9le 1f01cdd4fc46f98d4c11b2947307a0e3
+yuva422p 92b6815f465297284cdb843711682cee
+yuva422p10be fb240ff9ac49b45b1b3d40df2c89e39d
+yuva422p10le f767ede9ba1d427faadc963cf41d2412
+yuva422p16be ef442b11b26e5e61f3c958fa309576dd
+yuva422p16le 5789009759d7a44dacc6da2194e402b1
+yuva422p9be e0d2f45f7f5541eee988137c7ebb3495
+yuva422p9le a4ec81f328efd3856dec430fb27f2f56
+yuva444p c523716e4900cfe515eaab1d7124fdd9
+yuva444p10be f5791a75fdb86da0c243511ef9ab8fbd
+yuva444p10le 578e88dfbe4ab07f280fcc7554f3a5c4
+yuva444p16be ee7b9dd854e36b165d5b7cffb646ba6c
+yuva444p16le ec93b2907923d5655e9fb085479260ef
+yuva444p9be 03414257d78e72c28d03e3c247319b7c
+yuva444p9le e421d753257e36a79c2c0ec1607ac9e6
yuvj420p 32eec78ba51857b16ce9b813a49b7189
yuvj422p 0dfa0ed434f73be51428758c69e082cb
yuvj440p 657501a28004e27a592757a7509f5189
diff --git a/gst-libs/ext/libav/tests/ref/lavfi/pixfmts_scale b/gst-libs/ext/libav/tests/ref/lavfi/pixfmts_scale
index 4a5bf67..e53580c 100644
--- a/gst-libs/ext/libav/tests/ref/lavfi/pixfmts_scale
+++ b/gst-libs/ext/libav/tests/ref/lavfi/pixfmts_scale
@@ -57,6 +57,26 @@ yuv444p16le a0c5d3c7bf3f181db503cf8e450d1335
yuv444p9be 9ac2643ce7f7e5c4e17c8c9fd8494d4a
yuv444p9le 896a1cc9cccca1ba410dd53942d33cc4
yuva420p 8673a9131fb47de69788863f93a50eb7
+yuva420p10be d92a95061809f251175f5d5e3074930e
+yuva420p10le bad90ba2d4c260e379a7aa6dc7760853
+yuva420p16be a61d8ddb646e2d26020fc7ed2a48c1a9
+yuva420p16le 90ef774f86ad3177ec57eca8744b4e09
+yuva420p9be f7655546446bfdc875243d7cdeb13b30
+yuva420p9le ada2b719827059d70ebc57e2a3f9da92
+yuva422p 3c76ebeca0a7d3aa5f8e31ef80a86ffe
+yuva422p10be 01dd539e4a62762a3c97e965c76bb6f7
+yuva422p10le 76355d9d8fdcd085a24d48832b72e40b
+yuva422p16be c21afa31ac18bd92e8e596b81552b52b
+yuva422p16le 0bc3720dba6076dcce3b74b1d3c6c4b7
+yuva422p9be a60ac5b8026e9621724c033fbf79dbda
+yuva422p9le c3eda8831e9b9c94a3eb487d33114103
+yuva444p 3268c6abe5e3cdbd16552a1eddced816
+yuva444p10be 856b37c1ee53459f46b9359d329ac9b5
+yuva444p10le 22790592361c007406d4ca9a9e0954a5
+yuva444p16be ed5b07fe4d5b1137604568786777af1d
+yuva444p16le 3a3df23feb60d8832b566fd9765983d0
+yuva444p9be 4fc479c5b1044ad37b4e6fc6488b4f7f
+yuva444p9le c41849b0134670d6f6253c337defbb04
yuvj420p 30427bd6caf5bda93a173dbebe759e09
yuvj422p fc8288f64fd149573f73cf8da05d8e6d
yuvj440p 508ac7a9ddeb6d1794a1100ba7a1664c
diff --git a/gst-libs/ext/libav/tests/ref/lavfi/pixfmts_vflip b/gst-libs/ext/libav/tests/ref/lavfi/pixfmts_vflip
index f21927b..9fd8bf6 100644
--- a/gst-libs/ext/libav/tests/ref/lavfi/pixfmts_vflip
+++ b/gst-libs/ext/libav/tests/ref/lavfi/pixfmts_vflip
@@ -57,6 +57,26 @@ yuv444p16le 8e83323cf102d6c823a03ae8a7b7e033
yuv444p9be 6ac92b7dc9ab2fc59bee99204886899a
yuv444p9le 85aef13a654953d3455d89770b0d74bd
yuva420p c705d1cf061d8c6580ac690b55f92276
+yuva420p10be baa5e3b0ff6d0ebbb0958560cd763c6e
+yuva420p10le a36dc59ad55b406e5fee475236e9753c
+yuva420p16be bf3b134eb70878df9afba61d03e930b8
+yuva420p16le 105d375154329a381aa58379a0a6ec46
+yuva420p9be 8273d591e055f48990c29dd905a6cdfd
+yuva420p9le 95ced0bb07e422d98db61a35cdb3fb8f
+yuva422p 6aed0ea657ed51cc047a4fbdd981aec8
+yuva422p10be d69a3404984c5fd30c0fc548532bcb6b
+yuva422p10le a40c8e6f50e12d94bf7484107ec98559
+yuva422p16be 39552c259ca242f2417e913ffc602fde
+yuva422p16le 16faa558a34291ca32f6d94dce211ee2
+yuva422p9be a951eafb62c092c63f7566b6803f60df
+yuva422p9le 00b39cfca78666e057ee527f5e174a04
+yuva444p da5d64f2b2bd2013c186456f595fad65
+yuva444p10be 00e74a9c0c7818a9bbd9fee95b961ee8
+yuva444p10le cbe30f44b63cf7ed27fc2dde40315b5e
+yuva444p16be 7e9b799b057e1446dabbf0f738480cfb
+yuva444p16le 556d58b91a617fe4a83af99a4aea1c2e
+yuva444p9be b5a31de4fac408eeecaf3aff11f40e55
+yuva444p9le 67467f1e1d9edbd59d3984ebbfe24be6
yuvj420p 41fd02b204da0ab62452cd14b595e2e4
yuvj422p 7f6ca9bc1812cde02036d7d29a7cce43
yuvj440p 25711c3c0fd15ec19c59a10784fcfb96
diff --git a/gst-libs/ext/libav/tests/ref/seek/ac3_rm b/gst-libs/ext/libav/tests/ref/seek/ac3_rm
deleted file mode 100644
index b38758b..0000000
--- a/gst-libs/ext/libav/tests/ref/seek/ac3_rm
+++ /dev/null
@@ -1,44 +0,0 @@
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 271 size: 556
-ret: 0 st:-1 flags:0 ts:-1.000000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 271 size: 556
-ret:-1 st:-1 flags:1 ts: 1.894167
-ret:-1 st: 0 flags:0 ts: 0.788000
-ret: 0 st: 0 flags:1 ts:-0.317000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 271 size: 556
-ret:-1 st:-1 flags:0 ts: 2.576668
-ret:-1 st:-1 flags:1 ts: 1.470835
-ret:-1 st: 0 flags:0 ts: 0.365000
-ret: 0 st: 0 flags:1 ts:-0.741000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 271 size: 556
-ret:-1 st:-1 flags:0 ts: 2.153336
-ret:-1 st:-1 flags:1 ts: 1.047503
-ret: 0 st: 0 flags:0 ts:-0.058000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 271 size: 556
-ret:-1 st: 0 flags:1 ts: 2.836000
-ret: 0 st:-1 flags:0 ts: 1.730004
-ret: 0 st: 0 flags:1 dts:8589.800000 pts:8589.800000 pos: 65950 size: 32801
-ret: 0 st:-1 flags:1 ts: 0.624171
-ret: 0 st: 0 flags:1 dts: 0.256000 pts: 0.256000 pos: 65337 size: 400
-ret: 0 st: 0 flags:0 ts:-0.482000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 271 size: 556
-ret:-1 st: 0 flags:1 ts: 2.413000
-ret: 0 st:-1 flags:0 ts: 1.306672
-ret: 0 st: 0 flags:1 dts:8589.800000 pts:8589.800000 pos: 65950 size: 32801
-ret: 0 st:-1 flags:1 ts: 0.200839
-ret: 0 st: 0 flags:1 dts: 0.034000 pts: 0.034000 pos: 839 size: 558
-ret: 0 st: 0 flags:0 ts:-0.905000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 271 size: 556
-ret: 0 st: 0 flags:1 ts: 1.989000
-ret: 0 st: 0 flags:1 dts: 0.256000 pts: 0.256000 pos: 65337 size: 400
-ret: 0 st:-1 flags:0 ts: 0.883340
-ret: 0 st: 0 flags:1 dts: 3.378000 pts: 3.378000 pos: 55491 size: 558
-ret: 0 st:-1 flags:1 ts:-0.222493
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 271 size: 556
-ret: 0 st: 0 flags:0 ts: 2.672000
-ret: 0 st: 0 flags:1 dts: 3.378000 pts: 3.378000 pos: 55491 size: 558
-ret: 0 st: 0 flags:1 ts: 1.566000
-ret: 0 st: 0 flags:1 dts: 0.256000 pts: 0.256000 pos: 65337 size: 400
-ret: 0 st:-1 flags:0 ts: 0.460008
-ret: 0 st: 0 flags:1 dts: 3.378000 pts: 3.378000 pos: 55491 size: 558
-ret: 0 st:-1 flags:1 ts:-0.645825
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 271 size: 556
diff --git a/gst-libs/ext/libav/tests/ref/seek/acodec-adpcm-ima_qt b/gst-libs/ext/libav/tests/ref/seek/acodec-adpcm-ima_qt
new file mode 100644
index 0000000..bdaf1f0
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/seek/acodec-adpcm-ima_qt
@@ -0,0 +1,53 @@
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 72 size: 68
+ret: 0 st:-1 flags:0 ts:-1.000000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 72 size: 68
+ret: 0 st:-1 flags:1 ts: 1.894167
+ret: 0 st: 0 flags:1 dts: 1.893878 pts: 1.893878 pos: 88812 size: 68
+ret: 0 st: 0 flags:0 ts: 0.788345
+ret: 0 st: 0 flags:1 dts: 0.789478 pts: 0.789478 pos: 37064 size: 68
+ret: 0 st: 0 flags:1 ts:-0.317506
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 72 size: 68
+ret: 0 st:-1 flags:0 ts: 2.576668
+ret: 0 st: 0 flags:1 dts: 2.577438 pts: 2.577438 pos: 120840 size: 68
+ret: 0 st:-1 flags:1 ts: 1.470835
+ret: 0 st: 0 flags:1 dts: 1.470113 pts: 1.470113 pos: 68956 size: 68
+ret: 0 st: 0 flags:0 ts: 0.365011
+ret: 0 st: 0 flags:1 dts: 0.365714 pts: 0.365714 pos: 17208 size: 68
+ret: 0 st: 0 flags:1 ts:-0.740839
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 72 size: 68
+ret: 0 st:-1 flags:0 ts: 2.153336
+ret: 0 st: 0 flags:1 dts: 2.153673 pts: 2.153673 pos: 100984 size: 68
+ret: 0 st:-1 flags:1 ts: 1.047503
+ret: 0 st: 0 flags:1 dts: 1.046349 pts: 1.046349 pos: 49100 size: 68
+ret: 0 st: 0 flags:0 ts:-0.058322
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 72 size: 68
+ret: 0 st: 0 flags:1 ts: 2.835828
+ret: 0 st: 0 flags:1 dts: 2.835760 pts: 2.835760 pos: 132944 size: 68
+ret: 0 st:-1 flags:0 ts: 1.730004
+ret: 0 st: 0 flags:1 dts: 1.731338 pts: 1.731338 pos: 81196 size: 68
+ret: 0 st:-1 flags:1 ts: 0.624171
+ret: 0 st: 0 flags:1 dts: 0.624036 pts: 0.624036 pos: 29312 size: 68
+ret: 0 st: 0 flags:0 ts:-0.481655
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 72 size: 68
+ret: 0 st: 0 flags:1 ts: 2.412494
+ret: 0 st: 0 flags:1 dts: 2.411995 pts: 2.411995 pos: 113088 size: 68
+ret: 0 st:-1 flags:0 ts: 1.306672
+ret: 0 st: 0 flags:1 dts: 1.307574 pts: 1.307574 pos: 61340 size: 68
+ret: 0 st:-1 flags:1 ts: 0.200839
+ret: 0 st: 0 flags:1 dts: 0.200272 pts: 0.200272 pos: 9456 size: 68
+ret: 0 st: 0 flags:0 ts:-0.904989
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 72 size: 68
+ret: 0 st: 0 flags:1 ts: 1.989184
+ret: 0 st: 0 flags:1 dts: 1.988209 pts: 1.988209 pos: 93232 size: 68
+ret: 0 st:-1 flags:0 ts: 0.883340
+ret: 0 st: 0 flags:1 dts: 0.883810 pts: 0.883810 pos: 41484 size: 68
+ret: 0 st:-1 flags:1 ts:-0.222493
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 72 size: 68
+ret: 0 st: 0 flags:0 ts: 2.671678
+ret: 0 st: 0 flags:1 dts: 2.671769 pts: 2.671769 pos: 125260 size: 68
+ret: 0 st: 0 flags:1 ts: 1.565850
+ret: 0 st: 0 flags:1 dts: 1.564444 pts: 1.564444 pos: 73376 size: 68
+ret: 0 st:-1 flags:0 ts: 0.460008
+ret: 0 st: 0 flags:1 dts: 0.460045 pts: 0.460045 pos: 21628 size: 68
+ret: 0 st:-1 flags:1 ts:-0.645825
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 72 size: 68
diff --git a/gst-libs/ext/libav/tests/ref/seek/adpcm_ima_wav b/gst-libs/ext/libav/tests/ref/seek/acodec-adpcm-ima_wav
index b6517c5..b6517c5 100644
--- a/gst-libs/ext/libav/tests/ref/seek/adpcm_ima_wav
+++ b/gst-libs/ext/libav/tests/ref/seek/acodec-adpcm-ima_wav
diff --git a/gst-libs/ext/libav/tests/ref/seek/adpcm_ms_wav b/gst-libs/ext/libav/tests/ref/seek/acodec-adpcm-ms
index 579be7f..579be7f 100644
--- a/gst-libs/ext/libav/tests/ref/seek/adpcm_ms_wav
+++ b/gst-libs/ext/libav/tests/ref/seek/acodec-adpcm-ms
diff --git a/gst-libs/ext/libav/tests/ref/seek/adpcm_swf_flv b/gst-libs/ext/libav/tests/ref/seek/acodec-adpcm-swf
index 2f90913..2f90913 100644
--- a/gst-libs/ext/libav/tests/ref/seek/adpcm_swf_flv
+++ b/gst-libs/ext/libav/tests/ref/seek/acodec-adpcm-swf
diff --git a/gst-libs/ext/libav/tests/ref/seek/adpcm_yam_wav b/gst-libs/ext/libav/tests/ref/seek/acodec-adpcm-yamaha
index 5cbfaed..5cbfaed 100644
--- a/gst-libs/ext/libav/tests/ref/seek/adpcm_yam_wav
+++ b/gst-libs/ext/libav/tests/ref/seek/acodec-adpcm-yamaha
diff --git a/gst-libs/ext/libav/tests/ref/seek/acodec-alac b/gst-libs/ext/libav/tests/ref/seek/acodec-alac
new file mode 100644
index 0000000..a281d2e
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/seek/acodec-alac
@@ -0,0 +1,53 @@
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 36 size: 3236
+ret: 0 st:-1 flags:0 ts:-1.000000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 36 size: 3236
+ret: 0 st:-1 flags:1 ts: 1.894167
+ret: 0 st: 0 flags:1 dts: 1.857596 pts: 1.857596 pos: 73647 size: 4961
+ret: 0 st: 0 flags:0 ts: 0.788345
+ret: 0 st: 0 flags:1 dts: 0.835918 pts: 0.835918 pos: 29032 size: 3194
+ret: 0 st: 0 flags:1 ts:-0.317506
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 36 size: 3236
+ret: 0 st:-1 flags:0 ts: 2.576668
+ret: 0 st: 0 flags:1 dts: 2.600635 pts: 2.600635 pos: 137553 size: 12843
+ret: 0 st:-1 flags:1 ts: 1.470835
+ret: 0 st: 0 flags:1 dts: 1.393197 pts: 1.393197 pos: 50155 size: 4414
+ret: 0 st: 0 flags:0 ts: 0.365011
+ret: 0 st: 0 flags:1 dts: 0.371519 pts: 0.371519 pos: 12942 size: 3209
+ret: 0 st: 0 flags:1 ts:-0.740839
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 36 size: 3236
+ret: 0 st:-1 flags:0 ts: 2.153336
+ret: 0 st: 0 flags:1 dts: 2.229116 pts: 2.229116 pos: 100931 size: 7896
+ret: 0 st:-1 flags:1 ts: 1.047503
+ret: 0 st: 0 flags:1 dts: 1.021678 pts: 1.021678 pos: 35314 size: 3031
+ret: 0 st: 0 flags:0 ts:-0.058322
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 36 size: 3236
+ret: 0 st: 0 flags:1 ts: 2.835828
+ret: 0 st: 0 flags:1 dts: 2.786395 pts: 2.786395 pos: 163176 size: 12765
+ret: 0 st:-1 flags:0 ts: 1.730004
+ret: 0 st: 0 flags:1 dts: 1.764717 pts: 1.764717 pos: 68676 size: 4971
+ret: 0 st:-1 flags:1 ts: 0.624171
+ret: 0 st: 0 flags:1 dts: 0.557279 pts: 0.557279 pos: 19337 size: 3234
+ret: 0 st: 0 flags:0 ts:-0.481655
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 36 size: 3236
+ret: 0 st: 0 flags:1 ts: 2.412494
+ret: 0 st: 0 flags:1 dts: 2.321995 pts: 2.321995 pos: 108827 size: 7886
+ret: 0 st:-1 flags:0 ts: 1.306672
+ret: 0 st: 0 flags:1 dts: 1.393197 pts: 1.393197 pos: 50155 size: 4414
+ret: 0 st:-1 flags:1 ts: 0.200839
+ret: 0 st: 0 flags:1 dts: 0.185760 pts: 0.185760 pos: 6466 size: 3245
+ret: 0 st: 0 flags:0 ts:-0.904989
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 36 size: 3236
+ret: 0 st: 0 flags:1 ts: 1.989184
+ret: 0 st: 0 flags:1 dts: 1.950476 pts: 1.950476 pos: 78608 size: 6514
+ret: 0 st:-1 flags:0 ts: 0.883340
+ret: 0 st: 0 flags:1 dts: 0.928798 pts: 0.928798 pos: 32226 size: 3088
+ret: 0 st:-1 flags:1 ts:-0.222493
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 36 size: 3236
+ret: 0 st: 0 flags:0 ts: 2.671678
+ret: 0 st: 0 flags:1 dts: 2.693515 pts: 2.693515 pos: 150396 size: 12780
+ret: 0 st: 0 flags:1 ts: 1.565850
+ret: 0 st: 0 flags:1 dts: 1.486077 pts: 1.486077 pos: 54569 size: 4554
+ret: 0 st:-1 flags:0 ts: 0.460008
+ret: 0 st: 0 flags:1 dts: 0.464399 pts: 0.464399 pos: 16151 size: 3186
+ret: 0 st:-1 flags:1 ts:-0.645825
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 36 size: 3236
diff --git a/gst-libs/ext/libav/tests/ref/seek/flac_flac b/gst-libs/ext/libav/tests/ref/seek/acodec-flac
index 15ab0d2..15ab0d2 100644
--- a/gst-libs/ext/libav/tests/ref/seek/flac_flac
+++ b/gst-libs/ext/libav/tests/ref/seek/acodec-flac
diff --git a/gst-libs/ext/libav/tests/ref/seek/acodec-mp2 b/gst-libs/ext/libav/tests/ref/seek/acodec-mp2
new file mode 100644
index 0000000..8de3676
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/seek/acodec-mp2
@@ -0,0 +1,49 @@
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 0 size: 417
+ret: 0 st:-1 flags:0 ts:-1.000000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 0 size: 417
+ret: 0 st:-1 flags:1 ts: 1.894167
+ret: 0 st: 0 flags:1 dts: 1.880816 pts: 1.880816 pos: 30093 size: 418
+ret: 0 st: 0 flags:0 ts: 0.788334
+ret: 0 st: 0 flags:1 dts: 0.809796 pts: 0.809796 pos: 12956 size: 418
+ret:-1 st: 0 flags:1 ts:-0.317499
+ret: 0 st:-1 flags:0 ts: 2.576668
+ret: 0 st: 0 flags:1 dts: 2.586122 pts: 2.586122 pos: 41377 size: 418
+ret: 0 st:-1 flags:1 ts: 1.470835
+ret: 0 st: 0 flags:1 dts: 1.462857 pts: 1.462857 pos: 23405 size: 418
+ret: 0 st: 0 flags:0 ts: 0.365002
+ret: 0 st: 0 flags:1 dts: 0.365714 pts: 0.365714 pos: 5851 size: 418
+ret:-1 st: 0 flags:1 ts:-0.740831
+ret: 0 st:-1 flags:0 ts: 2.153336
+ret: 0 st: 0 flags:1 dts: 2.168163 pts: 2.168163 pos: 34690 size: 418
+ret: 0 st:-1 flags:1 ts: 1.047503
+ret: 0 st: 0 flags:1 dts: 1.044898 pts: 1.044898 pos: 16718 size: 418
+ret: 0 st: 0 flags:0 ts:-0.058330
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 0 size: 417
+ret: 0 st: 0 flags:1 ts: 2.835837
+ret: 0 st: 0 flags:1 dts: 2.821224 pts: 2.821224 pos: 45139 size: 418
+ret: 0 st:-1 flags:0 ts: 1.730004
+ret: 0 st: 0 flags:1 dts: 1.750204 pts: 1.750204 pos: 28003 size: 418
+ret: 0 st:-1 flags:1 ts: 0.624171
+ret: 0 st: 0 flags:1 dts: 0.600816 pts: 0.600816 pos: 9613 size: 418
+ret: 0 st: 0 flags:0 ts:-0.481662
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 0 size: 417
+ret: 0 st: 0 flags:1 ts: 2.412505
+ret: 0 st: 0 flags:1 dts: 2.403265 pts: 2.403265 pos: 38452 size: 418
+ret: 0 st:-1 flags:0 ts: 1.306672
+ret: 0 st: 0 flags:1 dts: 1.332245 pts: 1.332245 pos: 21315 size: 418
+ret: 0 st:-1 flags:1 ts: 0.200839
+ret: 0 st: 0 flags:1 dts: 0.182857 pts: 0.182857 pos: 2925 size: 418
+ret: 0 st: 0 flags:0 ts:-0.904994
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 0 size: 417
+ret: 0 st: 0 flags:1 ts: 1.989173
+ret: 0 st: 0 flags:1 dts: 1.985306 pts: 1.985306 pos: 31764 size: 418
+ret: 0 st:-1 flags:0 ts: 0.883340
+ret: 0 st: 0 flags:1 dts: 0.888163 pts: 0.888163 pos: 14210 size: 418
+ret:-1 st:-1 flags:1 ts:-0.222493
+ret: 0 st: 0 flags:0 ts: 2.671674
+ret: 0 st: 0 flags:1 dts: 2.690612 pts: 2.690612 pos: 43049 size: 418
+ret: 0 st: 0 flags:1 ts: 1.565841
+ret: 0 st: 0 flags:1 dts: 1.541224 pts: 1.541224 pos: 24659 size: 418
+ret: 0 st:-1 flags:0 ts: 0.460008
+ret: 0 st: 0 flags:1 dts: 0.470204 pts: 0.470204 pos: 7523 size: 418
+ret:-1 st:-1 flags:1 ts:-0.645825
diff --git a/gst-libs/ext/libav/tests/ref/seek/acodec-pcm-alaw b/gst-libs/ext/libav/tests/ref/seek/acodec-pcm-alaw
new file mode 100644
index 0000000..e5466bd
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/seek/acodec-pcm-alaw
@@ -0,0 +1,53 @@
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 58 size: 4096
+ret: 0 st:-1 flags:0 ts:-1.000000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 58 size: 4096
+ret: 0 st:-1 flags:1 ts: 1.894167
+ret: 0 st: 0 flags:1 dts: 1.894172 pts: 1.894172 pos: 167124 size: 4096
+ret: 0 st: 0 flags:0 ts: 0.788345
+ret: 0 st: 0 flags:1 dts: 0.788345 pts: 0.788345 pos: 69590 size: 4096
+ret: 0 st: 0 flags:1 ts:-0.317506
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 58 size: 4096
+ret: 0 st:-1 flags:0 ts: 2.576668
+ret: 0 st: 0 flags:1 dts: 2.576667 pts: 2.576667 pos: 227320 size: 4096
+ret: 0 st:-1 flags:1 ts: 1.470835
+ret: 0 st: 0 flags:1 dts: 1.470839 pts: 1.470839 pos: 129786 size: 4096
+ret: 0 st: 0 flags:0 ts: 0.365011
+ret: 0 st: 0 flags:1 dts: 0.365011 pts: 0.365011 pos: 32252 size: 4096
+ret: 0 st: 0 flags:1 ts:-0.740839
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 58 size: 4096
+ret: 0 st:-1 flags:0 ts: 2.153336
+ret: 0 st: 0 flags:1 dts: 2.153333 pts: 2.153333 pos: 189982 size: 4096
+ret: 0 st:-1 flags:1 ts: 1.047503
+ret: 0 st: 0 flags:1 dts: 1.047506 pts: 1.047506 pos: 92448 size: 4096
+ret: 0 st: 0 flags:0 ts:-0.058322
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 58 size: 4096
+ret: 0 st: 0 flags:1 ts: 2.835828
+ret: 0 st: 0 flags:1 dts: 2.835828 pts: 2.835828 pos: 250178 size: 4096
+ret: 0 st:-1 flags:0 ts: 1.730004
+ret: 0 st: 0 flags:1 dts: 1.730000 pts: 1.730000 pos: 152644 size: 4096
+ret: 0 st:-1 flags:1 ts: 0.624171
+ret: 0 st: 0 flags:1 dts: 0.624172 pts: 0.624172 pos: 55110 size: 4096
+ret: 0 st: 0 flags:0 ts:-0.481655
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 58 size: 4096
+ret: 0 st: 0 flags:1 ts: 2.412494
+ret: 0 st: 0 flags:1 dts: 2.412494 pts: 2.412494 pos: 212840 size: 4096
+ret: 0 st:-1 flags:0 ts: 1.306672
+ret: 0 st: 0 flags:1 dts: 1.306667 pts: 1.306667 pos: 115306 size: 4096
+ret: 0 st:-1 flags:1 ts: 0.200839
+ret: 0 st: 0 flags:1 dts: 0.200839 pts: 0.200839 pos: 17772 size: 4096
+ret: 0 st: 0 flags:0 ts:-0.904989
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 58 size: 4096
+ret: 0 st: 0 flags:1 ts: 1.989184
+ret: 0 st: 0 flags:1 dts: 1.989184 pts: 1.989184 pos: 175504 size: 4096
+ret: 0 st:-1 flags:0 ts: 0.883340
+ret: 0 st: 0 flags:1 dts: 0.883333 pts: 0.883333 pos: 77968 size: 4096
+ret: 0 st:-1 flags:1 ts:-0.222493
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 58 size: 4096
+ret: 0 st: 0 flags:0 ts: 2.671678
+ret: 0 st: 0 flags:1 dts: 2.671678 pts: 2.671678 pos: 235700 size: 4096
+ret: 0 st: 0 flags:1 ts: 1.565850
+ret: 0 st: 0 flags:1 dts: 1.565850 pts: 1.565850 pos: 138166 size: 4096
+ret: 0 st:-1 flags:0 ts: 0.460008
+ret: 0 st: 0 flags:1 dts: 0.460000 pts: 0.460000 pos: 40630 size: 4096
+ret: 0 st:-1 flags:1 ts:-0.645825
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 58 size: 4096
diff --git a/gst-libs/ext/libav/tests/ref/seek/pcm_f32be_au b/gst-libs/ext/libav/tests/ref/seek/acodec-pcm-f32be
index 886356a..886356a 100644
--- a/gst-libs/ext/libav/tests/ref/seek/pcm_f32be_au
+++ b/gst-libs/ext/libav/tests/ref/seek/acodec-pcm-f32be
diff --git a/gst-libs/ext/libav/tests/ref/seek/pcm_f32le_wav b/gst-libs/ext/libav/tests/ref/seek/acodec-pcm-f32le
index 335a8a0..335a8a0 100644
--- a/gst-libs/ext/libav/tests/ref/seek/pcm_f32le_wav
+++ b/gst-libs/ext/libav/tests/ref/seek/acodec-pcm-f32le
diff --git a/gst-libs/ext/libav/tests/ref/seek/pcm_f64be_au b/gst-libs/ext/libav/tests/ref/seek/acodec-pcm-f64be
index 9be3b4e..9be3b4e 100644
--- a/gst-libs/ext/libav/tests/ref/seek/pcm_f64be_au
+++ b/gst-libs/ext/libav/tests/ref/seek/acodec-pcm-f64be
diff --git a/gst-libs/ext/libav/tests/ref/seek/pcm_f64le_wav b/gst-libs/ext/libav/tests/ref/seek/acodec-pcm-f64le
index 41eeda0..41eeda0 100644
--- a/gst-libs/ext/libav/tests/ref/seek/pcm_f64le_wav
+++ b/gst-libs/ext/libav/tests/ref/seek/acodec-pcm-f64le
diff --git a/gst-libs/ext/libav/tests/ref/seek/acodec-pcm-mulaw b/gst-libs/ext/libav/tests/ref/seek/acodec-pcm-mulaw
new file mode 100644
index 0000000..e5466bd
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/seek/acodec-pcm-mulaw
@@ -0,0 +1,53 @@
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 58 size: 4096
+ret: 0 st:-1 flags:0 ts:-1.000000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 58 size: 4096
+ret: 0 st:-1 flags:1 ts: 1.894167
+ret: 0 st: 0 flags:1 dts: 1.894172 pts: 1.894172 pos: 167124 size: 4096
+ret: 0 st: 0 flags:0 ts: 0.788345
+ret: 0 st: 0 flags:1 dts: 0.788345 pts: 0.788345 pos: 69590 size: 4096
+ret: 0 st: 0 flags:1 ts:-0.317506
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 58 size: 4096
+ret: 0 st:-1 flags:0 ts: 2.576668
+ret: 0 st: 0 flags:1 dts: 2.576667 pts: 2.576667 pos: 227320 size: 4096
+ret: 0 st:-1 flags:1 ts: 1.470835
+ret: 0 st: 0 flags:1 dts: 1.470839 pts: 1.470839 pos: 129786 size: 4096
+ret: 0 st: 0 flags:0 ts: 0.365011
+ret: 0 st: 0 flags:1 dts: 0.365011 pts: 0.365011 pos: 32252 size: 4096
+ret: 0 st: 0 flags:1 ts:-0.740839
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 58 size: 4096
+ret: 0 st:-1 flags:0 ts: 2.153336
+ret: 0 st: 0 flags:1 dts: 2.153333 pts: 2.153333 pos: 189982 size: 4096
+ret: 0 st:-1 flags:1 ts: 1.047503
+ret: 0 st: 0 flags:1 dts: 1.047506 pts: 1.047506 pos: 92448 size: 4096
+ret: 0 st: 0 flags:0 ts:-0.058322
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 58 size: 4096
+ret: 0 st: 0 flags:1 ts: 2.835828
+ret: 0 st: 0 flags:1 dts: 2.835828 pts: 2.835828 pos: 250178 size: 4096
+ret: 0 st:-1 flags:0 ts: 1.730004
+ret: 0 st: 0 flags:1 dts: 1.730000 pts: 1.730000 pos: 152644 size: 4096
+ret: 0 st:-1 flags:1 ts: 0.624171
+ret: 0 st: 0 flags:1 dts: 0.624172 pts: 0.624172 pos: 55110 size: 4096
+ret: 0 st: 0 flags:0 ts:-0.481655
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 58 size: 4096
+ret: 0 st: 0 flags:1 ts: 2.412494
+ret: 0 st: 0 flags:1 dts: 2.412494 pts: 2.412494 pos: 212840 size: 4096
+ret: 0 st:-1 flags:0 ts: 1.306672
+ret: 0 st: 0 flags:1 dts: 1.306667 pts: 1.306667 pos: 115306 size: 4096
+ret: 0 st:-1 flags:1 ts: 0.200839
+ret: 0 st: 0 flags:1 dts: 0.200839 pts: 0.200839 pos: 17772 size: 4096
+ret: 0 st: 0 flags:0 ts:-0.904989
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 58 size: 4096
+ret: 0 st: 0 flags:1 ts: 1.989184
+ret: 0 st: 0 flags:1 dts: 1.989184 pts: 1.989184 pos: 175504 size: 4096
+ret: 0 st:-1 flags:0 ts: 0.883340
+ret: 0 st: 0 flags:1 dts: 0.883333 pts: 0.883333 pos: 77968 size: 4096
+ret: 0 st:-1 flags:1 ts:-0.222493
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 58 size: 4096
+ret: 0 st: 0 flags:0 ts: 2.671678
+ret: 0 st: 0 flags:1 dts: 2.671678 pts: 2.671678 pos: 235700 size: 4096
+ret: 0 st: 0 flags:1 ts: 1.565850
+ret: 0 st: 0 flags:1 dts: 1.565850 pts: 1.565850 pos: 138166 size: 4096
+ret: 0 st:-1 flags:0 ts: 0.460008
+ret: 0 st: 0 flags:1 dts: 0.460000 pts: 0.460000 pos: 40630 size: 4096
+ret: 0 st:-1 flags:1 ts:-0.645825
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 58 size: 4096
diff --git a/gst-libs/ext/libav/tests/ref/seek/pcm_s16be_mov b/gst-libs/ext/libav/tests/ref/seek/acodec-pcm-s16be
index f6a6be4..f6a6be4 100644
--- a/gst-libs/ext/libav/tests/ref/seek/pcm_s16be_mov
+++ b/gst-libs/ext/libav/tests/ref/seek/acodec-pcm-s16be
diff --git a/gst-libs/ext/libav/tests/ref/seek/pcm_s16le_wav b/gst-libs/ext/libav/tests/ref/seek/acodec-pcm-s16le
index 4f1ffc5..4f1ffc5 100644
--- a/gst-libs/ext/libav/tests/ref/seek/pcm_s16le_wav
+++ b/gst-libs/ext/libav/tests/ref/seek/acodec-pcm-s16le
diff --git a/gst-libs/ext/libav/tests/ref/seek/pcm_s24be_mov b/gst-libs/ext/libav/tests/ref/seek/acodec-pcm-s24be
index ef22082..ef22082 100644
--- a/gst-libs/ext/libav/tests/ref/seek/pcm_s24be_mov
+++ b/gst-libs/ext/libav/tests/ref/seek/acodec-pcm-s24be
diff --git a/gst-libs/ext/libav/tests/ref/seek/pcm_s24le_wav b/gst-libs/ext/libav/tests/ref/seek/acodec-pcm-s24le
index c6a37f8..c6a37f8 100644
--- a/gst-libs/ext/libav/tests/ref/seek/pcm_s24le_wav
+++ b/gst-libs/ext/libav/tests/ref/seek/acodec-pcm-s24le
diff --git a/gst-libs/ext/libav/tests/ref/seek/pcm_s32be_mov b/gst-libs/ext/libav/tests/ref/seek/acodec-pcm-s32be
index 6aed744..6aed744 100644
--- a/gst-libs/ext/libav/tests/ref/seek/pcm_s32be_mov
+++ b/gst-libs/ext/libav/tests/ref/seek/acodec-pcm-s32be
diff --git a/gst-libs/ext/libav/tests/ref/seek/pcm_s32le_wav b/gst-libs/ext/libav/tests/ref/seek/acodec-pcm-s32le
index df85b2d..df85b2d 100644
--- a/gst-libs/ext/libav/tests/ref/seek/pcm_s32le_wav
+++ b/gst-libs/ext/libav/tests/ref/seek/acodec-pcm-s32le
diff --git a/gst-libs/ext/libav/tests/ref/seek/pcm_s8_mov b/gst-libs/ext/libav/tests/ref/seek/acodec-pcm-s8
index b119e2e..b119e2e 100644
--- a/gst-libs/ext/libav/tests/ref/seek/pcm_s8_mov
+++ b/gst-libs/ext/libav/tests/ref/seek/acodec-pcm-s8
diff --git a/gst-libs/ext/libav/tests/ref/seek/pcm_u8_wav b/gst-libs/ext/libav/tests/ref/seek/acodec-pcm-u8
index 8348916..8348916 100644
--- a/gst-libs/ext/libav/tests/ref/seek/pcm_u8_wav
+++ b/gst-libs/ext/libav/tests/ref/seek/acodec-pcm-u8
diff --git a/gst-libs/ext/libav/tests/ref/seek/adpcm_qt_aiff b/gst-libs/ext/libav/tests/ref/seek/adpcm_qt_aiff
deleted file mode 100644
index b395fc9..0000000
--- a/gst-libs/ext/libav/tests/ref/seek/adpcm_qt_aiff
+++ /dev/null
@@ -1,53 +0,0 @@
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 72 size: 68
-ret: 0 st:-1 flags:0 ts:-1.000000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 72 size: 68
-ret: 0 st:-1 flags:1 ts: 1.894167
-ret: 0 st: 0 flags:1 dts: 1.894059 pts: 1.894059 pos: 88812 size: 68
-ret: 0 st: 0 flags:0 ts: 0.788345
-ret: 0 st: 0 flags:1 dts: 0.789546 pts: 0.789546 pos: 37064 size: 68
-ret: 0 st: 0 flags:1 ts:-0.317506
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 72 size: 68
-ret: 0 st:-1 flags:0 ts: 2.576668
-ret: 0 st: 0 flags:1 dts: 2.577642 pts: 2.577642 pos: 120840 size: 68
-ret: 0 st:-1 flags:1 ts: 1.470835
-ret: 0 st: 0 flags:1 dts: 1.470249 pts: 1.470249 pos: 68956 size: 68
-ret: 0 st: 0 flags:0 ts: 0.365011
-ret: 0 st: 0 flags:1 dts: 0.365737 pts: 0.365737 pos: 17208 size: 68
-ret: 0 st: 0 flags:1 ts:-0.740839
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 72 size: 68
-ret: 0 st:-1 flags:0 ts: 2.153336
-ret: 0 st: 0 flags:1 dts: 2.153855 pts: 2.153855 pos: 100984 size: 68
-ret: 0 st:-1 flags:1 ts: 1.047503
-ret: 0 st: 0 flags:1 dts: 1.046440 pts: 1.046440 pos: 49100 size: 68
-ret: 0 st: 0 flags:0 ts:-0.058322
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 72 size: 68
-ret: 0 st: 0 flags:1 ts: 2.835828
-ret: 0 st: 0 flags:1 dts: 2.834535 pts: 2.834535 pos: 132876 size: 68
-ret: 0 st:-1 flags:0 ts: 1.730004
-ret: 0 st: 0 flags:1 dts: 1.730045 pts: 1.730045 pos: 81128 size: 68
-ret: 0 st:-1 flags:1 ts: 0.624171
-ret: 0 st: 0 flags:1 dts: 0.624082 pts: 0.624082 pos: 29312 size: 68
-ret: 0 st: 0 flags:0 ts:-0.481655
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 72 size: 68
-ret: 0 st: 0 flags:1 ts: 2.412494
-ret: 0 st: 0 flags:1 dts: 2.412200 pts: 2.412200 pos: 113088 size: 68
-ret: 0 st:-1 flags:0 ts: 1.306672
-ret: 0 st: 0 flags:1 dts: 1.307687 pts: 1.307687 pos: 61340 size: 68
-ret: 0 st:-1 flags:1 ts: 0.200839
-ret: 0 st: 0 flags:1 dts: 0.200295 pts: 0.200295 pos: 9456 size: 68
-ret: 0 st: 0 flags:0 ts:-0.904989
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 72 size: 68
-ret: 0 st: 0 flags:1 ts: 1.989184
-ret: 0 st: 0 flags:1 dts: 1.988390 pts: 1.988390 pos: 93232 size: 68
-ret: 0 st:-1 flags:0 ts: 0.883340
-ret: 0 st: 0 flags:1 dts: 0.883900 pts: 0.883900 pos: 41484 size: 68
-ret: 0 st:-1 flags:1 ts:-0.222493
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 72 size: 68
-ret: 0 st: 0 flags:0 ts: 2.671678
-ret: 0 st: 0 flags:1 dts: 2.671995 pts: 2.671995 pos: 125260 size: 68
-ret: 0 st: 0 flags:1 ts: 1.565850
-ret: 0 st: 0 flags:1 dts: 1.564580 pts: 1.564580 pos: 73376 size: 68
-ret: 0 st:-1 flags:0 ts: 0.460008
-ret: 0 st: 0 flags:1 dts: 0.460091 pts: 0.460091 pos: 21628 size: 68
-ret: 0 st:-1 flags:1 ts:-0.645825
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 72 size: 68
diff --git a/gst-libs/ext/libav/tests/ref/seek/alac_m4a b/gst-libs/ext/libav/tests/ref/seek/alac_m4a
deleted file mode 100644
index 892cfb5..0000000
--- a/gst-libs/ext/libav/tests/ref/seek/alac_m4a
+++ /dev/null
@@ -1,53 +0,0 @@
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 40 size: 3240
-ret: 0 st:-1 flags:0 ts:-1.000000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 40 size: 3240
-ret: 0 st:-1 flags:1 ts: 1.894167
-ret: 0 st: 0 flags:1 dts: 1.857596 pts: 1.857596 pos: 73731 size: 4965
-ret: 0 st: 0 flags:0 ts: 0.788345
-ret: 0 st: 0 flags:1 dts: 0.835918 pts: 0.835918 pos: 29072 size: 3198
-ret: 0 st: 0 flags:1 ts:-0.317506
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 40 size: 3240
-ret: 0 st:-1 flags:0 ts: 2.576668
-ret: 0 st: 0 flags:1 dts: 2.600635 pts: 2.600635 pos: 137669 size: 12847
-ret: 0 st:-1 flags:1 ts: 1.470835
-ret: 0 st: 0 flags:1 dts: 1.393197 pts: 1.393197 pos: 50219 size: 4418
-ret: 0 st: 0 flags:0 ts: 0.365011
-ret: 0 st: 0 flags:1 dts: 0.371519 pts: 0.371519 pos: 12962 size: 3213
-ret: 0 st: 0 flags:1 ts:-0.740839
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 40 size: 3240
-ret: 0 st:-1 flags:0 ts: 2.153336
-ret: 0 st: 0 flags:1 dts: 2.229116 pts: 2.229116 pos: 101031 size: 7900
-ret: 0 st:-1 flags:1 ts: 1.047503
-ret: 0 st: 0 flags:1 dts: 1.021678 pts: 1.021678 pos: 35362 size: 3035
-ret: 0 st: 0 flags:0 ts:-0.058322
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 40 size: 3240
-ret: 0 st: 0 flags:1 ts: 2.835828
-ret: 0 st: 0 flags:1 dts: 2.786395 pts: 2.786395 pos: 163300 size: 12769
-ret: 0 st:-1 flags:0 ts: 1.730004
-ret: 0 st: 0 flags:1 dts: 1.764717 pts: 1.764717 pos: 68756 size: 4975
-ret: 0 st:-1 flags:1 ts: 0.624171
-ret: 0 st: 0 flags:1 dts: 0.557279 pts: 0.557279 pos: 19365 size: 3238
-ret: 0 st: 0 flags:0 ts:-0.481655
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 40 size: 3240
-ret: 0 st: 0 flags:1 ts: 2.412494
-ret: 0 st: 0 flags:1 dts: 2.321995 pts: 2.321995 pos: 108931 size: 7890
-ret: 0 st:-1 flags:0 ts: 1.306672
-ret: 0 st: 0 flags:1 dts: 1.393197 pts: 1.393197 pos: 50219 size: 4418
-ret: 0 st:-1 flags:1 ts: 0.200839
-ret: 0 st: 0 flags:1 dts: 0.185760 pts: 0.185760 pos: 6478 size: 3249
-ret: 0 st: 0 flags:0 ts:-0.904989
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 40 size: 3240
-ret: 0 st: 0 flags:1 ts: 1.989184
-ret: 0 st: 0 flags:1 dts: 1.950476 pts: 1.950476 pos: 78696 size: 6518
-ret: 0 st:-1 flags:0 ts: 0.883340
-ret: 0 st: 0 flags:1 dts: 0.928798 pts: 0.928798 pos: 32270 size: 3092
-ret: 0 st:-1 flags:1 ts:-0.222493
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 40 size: 3240
-ret: 0 st: 0 flags:0 ts: 2.671678
-ret: 0 st: 0 flags:1 dts: 2.693515 pts: 2.693515 pos: 150516 size: 12784
-ret: 0 st: 0 flags:1 ts: 1.565850
-ret: 0 st: 0 flags:1 dts: 1.486077 pts: 1.486077 pos: 54637 size: 4558
-ret: 0 st:-1 flags:0 ts: 0.460008
-ret: 0 st: 0 flags:1 dts: 0.464399 pts: 0.464399 pos: 16175 size: 3190
-ret: 0 st:-1 flags:1 ts:-0.645825
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 40 size: 3240
diff --git a/gst-libs/ext/libav/tests/ref/seek/asv1_avi b/gst-libs/ext/libav/tests/ref/seek/asv1_avi
deleted file mode 100644
index eb6abc2..0000000
--- a/gst-libs/ext/libav/tests/ref/seek/asv1_avi
+++ /dev/null
@@ -1,46 +0,0 @@
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5668 size: 14316
-ret: 0 st:-1 flags:0 ts:-1.000000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5668 size: 14316
-ret: 0 st:-1 flags:1 ts: 1.894167
-ret: 0 st: 0 flags:1 dts: 1.880000 pts: 1.880000 pos: 776852 size: 18256
-ret: 0 st: 0 flags:0 ts: 0.800000
-ret: 0 st: 0 flags:1 dts: 0.800000 pts: 0.800000 pos: 305364 size: 16180
-ret:-1 st: 0 flags:1 ts:-0.320000
-ret:-1 st:-1 flags:0 ts: 2.576668
-ret: 0 st:-1 flags:1 ts: 1.470835
-ret: 0 st: 0 flags:1 dts: 1.480000 pts: 1.480000 pos: 595460 size: 17980
-ret: 0 st: 0 flags:0 ts: 0.360000
-ret: 0 st: 0 flags:1 dts: 0.360000 pts: 0.360000 pos: 135528 size: 14868
-ret:-1 st: 0 flags:1 ts:-0.760000
-ret:-1 st:-1 flags:0 ts: 2.153336
-ret: 0 st:-1 flags:1 ts: 1.047503
-ret: 0 st: 0 flags:1 dts: 1.040000 pts: 1.040000 pos: 404112 size: 16856
-ret: 0 st: 0 flags:0 ts:-0.040000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5668 size: 14316
-ret: 0 st: 0 flags:1 ts: 2.840000
-ret: 0 st: 0 flags:1 dts: 1.960000 pts: 1.960000 pos: 813408 size: 18296
-ret: 0 st:-1 flags:0 ts: 1.730004
-ret: 0 st: 0 flags:1 dts: 1.720000 pts: 1.720000 pos: 704148 size: 18140
-ret: 0 st:-1 flags:1 ts: 0.624171
-ret: 0 st: 0 flags:1 dts: 0.640000 pts: 0.640000 pos: 241776 size: 15736
-ret: 0 st: 0 flags:0 ts:-0.480000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5668 size: 14316
-ret: 0 st: 0 flags:1 ts: 2.400000
-ret: 0 st: 0 flags:1 dts: 1.960000 pts: 1.960000 pos: 813408 size: 18296
-ret: 0 st:-1 flags:0 ts: 1.306672
-ret: 0 st: 0 flags:1 dts: 1.320000 pts: 1.320000 pos: 524500 size: 17548
-ret: 0 st:-1 flags:1 ts: 0.200839
-ret: 0 st: 0 flags:1 dts: 0.200000 pts: 0.200000 pos: 77032 size: 14496
-ret: 0 st: 0 flags:0 ts:-0.920000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5668 size: 14316
-ret: 0 st: 0 flags:1 ts: 2.000000
-ret: 0 st: 0 flags:1 dts: 1.960000 pts: 1.960000 pos: 813408 size: 18296
-ret: 0 st:-1 flags:0 ts: 0.883340
-ret: 0 st: 0 flags:1 dts: 0.880000 pts: 0.880000 pos: 337820 size: 16388
-ret:-1 st:-1 flags:1 ts:-0.222493
-ret:-1 st: 0 flags:0 ts: 2.680000
-ret: 0 st: 0 flags:1 ts: 1.560000
-ret: 0 st: 0 flags:1 dts: 1.560000 pts: 1.560000 pos: 631596 size: 18188
-ret: 0 st:-1 flags:0 ts: 0.460008
-ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 180224 size: 15168
-ret:-1 st:-1 flags:1 ts:-0.645825
diff --git a/gst-libs/ext/libav/tests/ref/seek/asv2_avi b/gst-libs/ext/libav/tests/ref/seek/asv2_avi
deleted file mode 100644
index f7b7f69..0000000
--- a/gst-libs/ext/libav/tests/ref/seek/asv2_avi
+++ /dev/null
@@ -1,46 +0,0 @@
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5668 size: 13732
-ret: 0 st:-1 flags:0 ts:-1.000000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5668 size: 13732
-ret: 0 st:-1 flags:1 ts: 1.894167
-ret: 0 st: 0 flags:1 dts: 1.880000 pts: 1.880000 pos: 736164 size: 17340
-ret: 0 st: 0 flags:0 ts: 0.800000
-ret: 0 st: 0 flags:1 dts: 0.800000 pts: 0.800000 pos: 289720 size: 15300
-ret:-1 st: 0 flags:1 ts:-0.320000
-ret:-1 st:-1 flags:0 ts: 2.576668
-ret: 0 st:-1 flags:1 ts: 1.470835
-ret: 0 st: 0 flags:1 dts: 1.480000 pts: 1.480000 pos: 564152 size: 17016
-ret: 0 st: 0 flags:0 ts: 0.360000
-ret: 0 st: 0 flags:1 dts: 0.360000 pts: 0.360000 pos: 128576 size: 14052
-ret:-1 st: 0 flags:1 ts:-0.760000
-ret:-1 st:-1 flags:0 ts: 2.153336
-ret: 0 st:-1 flags:1 ts: 1.047503
-ret: 0 st: 0 flags:1 dts: 1.040000 pts: 1.040000 pos: 383256 size: 15896
-ret: 0 st: 0 flags:0 ts:-0.040000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5668 size: 13732
-ret: 0 st: 0 flags:1 ts: 2.840000
-ret: 0 st: 0 flags:1 dts: 1.960000 pts: 1.960000 pos: 770864 size: 17400
-ret: 0 st:-1 flags:0 ts: 1.730004
-ret: 0 st: 0 flags:1 dts: 1.720000 pts: 1.720000 pos: 667028 size: 17172
-ret: 0 st:-1 flags:1 ts: 0.624171
-ret: 0 st: 0 flags:1 dts: 0.640000 pts: 0.640000 pos: 229400 size: 14956
-ret: 0 st: 0 flags:0 ts:-0.480000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5668 size: 13732
-ret: 0 st: 0 flags:1 ts: 2.400000
-ret: 0 st: 0 flags:1 dts: 1.960000 pts: 1.960000 pos: 770864 size: 17400
-ret: 0 st:-1 flags:0 ts: 1.306672
-ret: 0 st: 0 flags:1 dts: 1.320000 pts: 1.320000 pos: 496944 size: 16564
-ret: 0 st:-1 flags:1 ts: 0.200839
-ret: 0 st: 0 flags:1 dts: 0.200000 pts: 0.200000 pos: 73188 size: 13664
-ret: 0 st: 0 flags:0 ts:-0.920000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5668 size: 13732
-ret: 0 st: 0 flags:1 ts: 2.000000
-ret: 0 st: 0 flags:1 dts: 1.960000 pts: 1.960000 pos: 770864 size: 17400
-ret: 0 st:-1 flags:0 ts: 0.883340
-ret: 0 st: 0 flags:1 dts: 0.880000 pts: 0.880000 pos: 320456 size: 15592
-ret:-1 st:-1 flags:1 ts:-0.222493
-ret:-1 st: 0 flags:0 ts: 2.680000
-ret: 0 st: 0 flags:1 ts: 1.560000
-ret: 0 st: 0 flags:1 dts: 1.560000 pts: 1.560000 pos: 598300 size: 17180
-ret: 0 st:-1 flags:0 ts: 0.460008
-ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 171024 size: 14392
-ret:-1 st:-1 flags:1 ts:-0.645825
diff --git a/gst-libs/ext/libav/tests/ref/seek/dnxhd_720p_dnxhd b/gst-libs/ext/libav/tests/ref/seek/dnxhd_720p_dnxhd
deleted file mode 100644
index b57f07d..0000000
--- a/gst-libs/ext/libav/tests/ref/seek/dnxhd_720p_dnxhd
+++ /dev/null
@@ -1,40 +0,0 @@
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 0 size:458752
-ret: 0 st:-1 flags:0 ts:-1.000000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 0 size:458752
-ret: 0 st:-1 flags:1 ts: 1.894167
-ret: 0 st: 0 flags:1 dts: 0.160000 pts: 0.160000 pos:1835008 size:458752
-ret:-1 st: 0 flags:0 ts: 0.788334
-ret:-1 st: 0 flags:1 ts:-0.317499
-ret:-1 st:-1 flags:0 ts: 2.576668
-ret: 0 st:-1 flags:1 ts: 1.470835
-ret: 0 st: 0 flags:1 dts: 0.160000 pts: 0.160000 pos:1835008 size:458752
-ret:-1 st: 0 flags:0 ts: 0.365002
-ret:-1 st: 0 flags:1 ts:-0.740831
-ret:-1 st:-1 flags:0 ts: 2.153336
-ret: 0 st:-1 flags:1 ts: 1.047503
-ret: 0 st: 0 flags:1 dts: 0.160000 pts: 0.160000 pos:1835008 size:458752
-ret: 0 st: 0 flags:0 ts:-0.058330
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 0 size:458752
-ret: 0 st: 0 flags:1 ts: 2.835837
-ret: 0 st: 0 flags:1 dts: 0.160000 pts: 0.160000 pos:1835008 size:458752
-ret:-1 st:-1 flags:0 ts: 1.730004
-ret: 0 st:-1 flags:1 ts: 0.624171
-ret: 0 st: 0 flags:1 dts: 0.160000 pts: 0.160000 pos:1835008 size:458752
-ret: 0 st: 0 flags:0 ts:-0.481662
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 0 size:458752
-ret: 0 st: 0 flags:1 ts: 2.412505
-ret: 0 st: 0 flags:1 dts: 0.160000 pts: 0.160000 pos:1835008 size:458752
-ret:-1 st:-1 flags:0 ts: 1.306672
-ret: 0 st:-1 flags:1 ts: 0.200839
-ret: 0 st: 0 flags:1 dts: 0.160000 pts: 0.160000 pos:1835008 size:458752
-ret: 0 st: 0 flags:0 ts:-0.904994
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 0 size:458752
-ret: 0 st: 0 flags:1 ts: 1.989173
-ret: 0 st: 0 flags:1 dts: 0.160000 pts: 0.160000 pos:1835008 size:458752
-ret:-1 st:-1 flags:0 ts: 0.883340
-ret:-1 st:-1 flags:1 ts:-0.222493
-ret:-1 st: 0 flags:0 ts: 2.671674
-ret: 0 st: 0 flags:1 ts: 1.565841
-ret: 0 st: 0 flags:1 dts: 0.160000 pts: 0.160000 pos:1835008 size:458752
-ret:-1 st:-1 flags:0 ts: 0.460008
-ret:-1 st:-1 flags:1 ts:-0.645825
diff --git a/gst-libs/ext/libav/tests/ref/seek/dnxhd_720p_rd_dnxhd b/gst-libs/ext/libav/tests/ref/seek/dnxhd_720p_rd_dnxhd
deleted file mode 100644
index b57f07d..0000000
--- a/gst-libs/ext/libav/tests/ref/seek/dnxhd_720p_rd_dnxhd
+++ /dev/null
@@ -1,40 +0,0 @@
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 0 size:458752
-ret: 0 st:-1 flags:0 ts:-1.000000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 0 size:458752
-ret: 0 st:-1 flags:1 ts: 1.894167
-ret: 0 st: 0 flags:1 dts: 0.160000 pts: 0.160000 pos:1835008 size:458752
-ret:-1 st: 0 flags:0 ts: 0.788334
-ret:-1 st: 0 flags:1 ts:-0.317499
-ret:-1 st:-1 flags:0 ts: 2.576668
-ret: 0 st:-1 flags:1 ts: 1.470835
-ret: 0 st: 0 flags:1 dts: 0.160000 pts: 0.160000 pos:1835008 size:458752
-ret:-1 st: 0 flags:0 ts: 0.365002
-ret:-1 st: 0 flags:1 ts:-0.740831
-ret:-1 st:-1 flags:0 ts: 2.153336
-ret: 0 st:-1 flags:1 ts: 1.047503
-ret: 0 st: 0 flags:1 dts: 0.160000 pts: 0.160000 pos:1835008 size:458752
-ret: 0 st: 0 flags:0 ts:-0.058330
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 0 size:458752
-ret: 0 st: 0 flags:1 ts: 2.835837
-ret: 0 st: 0 flags:1 dts: 0.160000 pts: 0.160000 pos:1835008 size:458752
-ret:-1 st:-1 flags:0 ts: 1.730004
-ret: 0 st:-1 flags:1 ts: 0.624171
-ret: 0 st: 0 flags:1 dts: 0.160000 pts: 0.160000 pos:1835008 size:458752
-ret: 0 st: 0 flags:0 ts:-0.481662
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 0 size:458752
-ret: 0 st: 0 flags:1 ts: 2.412505
-ret: 0 st: 0 flags:1 dts: 0.160000 pts: 0.160000 pos:1835008 size:458752
-ret:-1 st:-1 flags:0 ts: 1.306672
-ret: 0 st:-1 flags:1 ts: 0.200839
-ret: 0 st: 0 flags:1 dts: 0.160000 pts: 0.160000 pos:1835008 size:458752
-ret: 0 st: 0 flags:0 ts:-0.904994
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 0 size:458752
-ret: 0 st: 0 flags:1 ts: 1.989173
-ret: 0 st: 0 flags:1 dts: 0.160000 pts: 0.160000 pos:1835008 size:458752
-ret:-1 st:-1 flags:0 ts: 0.883340
-ret:-1 st:-1 flags:1 ts:-0.222493
-ret:-1 st: 0 flags:0 ts: 2.671674
-ret: 0 st: 0 flags:1 ts: 1.565841
-ret: 0 st: 0 flags:1 dts: 0.160000 pts: 0.160000 pos:1835008 size:458752
-ret:-1 st:-1 flags:0 ts: 0.460008
-ret:-1 st:-1 flags:1 ts:-0.645825
diff --git a/gst-libs/ext/libav/tests/ref/seek/error_mpeg4_adv_avi b/gst-libs/ext/libav/tests/ref/seek/error_mpeg4_adv_avi
deleted file mode 100644
index 3c6fa21..0000000
--- a/gst-libs/ext/libav/tests/ref/seek/error_mpeg4_adv_avi
+++ /dev/null
@@ -1,46 +0,0 @@
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5660 size: 9564
-ret: 0 st:-1 flags:0 ts:-1.000000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5660 size: 9564
-ret: 0 st:-1 flags:1 ts: 1.894167
-ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 113142 size: 12795
-ret: 0 st: 0 flags:0 ts: 0.800000
-ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 71660 size: 11680
-ret:-1 st: 0 flags:1 ts:-0.320000
-ret:-1 st:-1 flags:0 ts: 2.576668
-ret: 0 st:-1 flags:1 ts: 1.470835
-ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 113142 size: 12795
-ret: 0 st: 0 flags:0 ts: 0.360000
-ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 36782 size: 10310
-ret:-1 st: 0 flags:1 ts:-0.760000
-ret:-1 st:-1 flags:0 ts: 2.153336
-ret: 0 st:-1 flags:1 ts: 1.047503
-ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 71660 size: 11680
-ret: 0 st: 0 flags:0 ts:-0.040000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5660 size: 9564
-ret: 0 st: 0 flags:1 ts: 2.840000
-ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 159370 size: 13895
-ret: 0 st:-1 flags:0 ts: 1.730004
-ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 159370 size: 13895
-ret: 0 st:-1 flags:1 ts: 0.624171
-ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 36782 size: 10310
-ret: 0 st: 0 flags:0 ts:-0.480000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5660 size: 9564
-ret: 0 st: 0 flags:1 ts: 2.400000
-ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 159370 size: 13895
-ret: 0 st:-1 flags:0 ts: 1.306672
-ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 113142 size: 12795
-ret: 0 st:-1 flags:1 ts: 0.200839
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5660 size: 9564
-ret: 0 st: 0 flags:0 ts:-0.920000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5660 size: 9564
-ret: 0 st: 0 flags:1 ts: 2.000000
-ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 159370 size: 13895
-ret: 0 st:-1 flags:0 ts: 0.883340
-ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 71660 size: 11680
-ret:-1 st:-1 flags:1 ts:-0.222493
-ret:-1 st: 0 flags:0 ts: 2.680000
-ret: 0 st: 0 flags:1 ts: 1.560000
-ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 113142 size: 12795
-ret: 0 st:-1 flags:0 ts: 0.460008
-ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 36782 size: 10310
-ret:-1 st:-1 flags:1 ts:-0.645825
diff --git a/gst-libs/ext/libav/tests/ref/seek/ffv1_avi b/gst-libs/ext/libav/tests/ref/seek/ffv1_avi
deleted file mode 100644
index 04edb8d..0000000
--- a/gst-libs/ext/libav/tests/ref/seek/ffv1_avi
+++ /dev/null
@@ -1,46 +0,0 @@
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5660 size: 70200
-ret: 0 st:-1 flags:0 ts:-1.000000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5660 size: 70200
-ret: 0 st:-1 flags:1 ts: 1.894167
-ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos:2485810 size: 74128
-ret: 0 st: 0 flags:0 ts: 0.800000
-ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos:1622716 size: 71128
-ret:-1 st: 0 flags:1 ts:-0.320000
-ret:-1 st:-1 flags:0 ts: 2.576668
-ret: 0 st:-1 flags:1 ts: 1.470835
-ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos:2485810 size: 74128
-ret: 0 st: 0 flags:0 ts: 0.360000
-ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 796840 size: 67971
-ret:-1 st: 0 flags:1 ts:-0.760000
-ret:-1 st:-1 flags:0 ts: 2.153336
-ret: 0 st:-1 flags:1 ts: 1.047503
-ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos:1622716 size: 71128
-ret: 0 st: 0 flags:0 ts:-0.040000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5660 size: 70200
-ret: 0 st: 0 flags:1 ts: 2.840000
-ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos:3374440 size: 75606
-ret: 0 st:-1 flags:0 ts: 1.730004
-ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos:3374440 size: 75606
-ret: 0 st:-1 flags:1 ts: 0.624171
-ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 796840 size: 67971
-ret: 0 st: 0 flags:0 ts:-0.480000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5660 size: 70200
-ret: 0 st: 0 flags:1 ts: 2.400000
-ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos:3374440 size: 75606
-ret: 0 st:-1 flags:0 ts: 1.306672
-ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos:2485810 size: 74128
-ret: 0 st:-1 flags:1 ts: 0.200839
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5660 size: 70200
-ret: 0 st: 0 flags:0 ts:-0.920000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5660 size: 70200
-ret: 0 st: 0 flags:1 ts: 2.000000
-ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos:3374440 size: 75606
-ret: 0 st:-1 flags:0 ts: 0.883340
-ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos:1622716 size: 71128
-ret:-1 st:-1 flags:1 ts:-0.222493
-ret:-1 st: 0 flags:0 ts: 2.680000
-ret: 0 st: 0 flags:1 ts: 1.560000
-ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos:2485810 size: 74128
-ret: 0 st:-1 flags:0 ts: 0.460008
-ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 796840 size: 67971
-ret:-1 st:-1 flags:1 ts:-0.645825
diff --git a/gst-libs/ext/libav/tests/ref/seek/g726_wav b/gst-libs/ext/libav/tests/ref/seek/g726_wav
deleted file mode 100644
index 0e145a2..0000000
--- a/gst-libs/ext/libav/tests/ref/seek/g726_wav
+++ /dev/null
@@ -1,53 +0,0 @@
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 58 size: 4096
-ret: 0 st:-1 flags:0 ts:-1.000000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 58 size: 4096
-ret: 0 st:-1 flags:1 ts: 1.894167
-ret: 0 st: 0 flags:1 dts: 1.894000 pts: 1.894000 pos: 7634 size: 4096
-ret: 0 st: 0 flags:0 ts: 0.788375
-ret: 0 st: 0 flags:1 dts: 0.788500 pts: 0.788500 pos: 3212 size: 4096
-ret: 0 st: 0 flags:1 ts:-0.317500
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 58 size: 4096
-ret: 0 st:-1 flags:0 ts: 2.576668
-ret: 0 st: 0 flags:1 dts: 2.576750 pts: 2.576750 pos: 10365 size: 4096
-ret: 0 st:-1 flags:1 ts: 1.470835
-ret: 0 st: 0 flags:1 dts: 1.470750 pts: 1.470750 pos: 5941 size: 4096
-ret: 0 st: 0 flags:0 ts: 0.365000
-ret: 0 st: 0 flags:1 dts: 0.365000 pts: 0.365000 pos: 1518 size: 4096
-ret: 0 st: 0 flags:1 ts:-0.740875
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 58 size: 4096
-ret: 0 st:-1 flags:0 ts: 2.153336
-ret: 0 st: 0 flags:1 dts: 2.153500 pts: 2.153500 pos: 8672 size: 4096
-ret: 0 st:-1 flags:1 ts: 1.047503
-ret: 0 st: 0 flags:1 dts: 1.047500 pts: 1.047500 pos: 4248 size: 4096
-ret: 0 st: 0 flags:0 ts:-0.058375
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 58 size: 4096
-ret: 0 st: 0 flags:1 ts: 2.835875
-ret: 0 st: 0 flags:1 dts: 2.835750 pts: 2.835750 pos: 11401 size: 4096
-ret: 0 st:-1 flags:0 ts: 1.730004
-ret: 0 st: 0 flags:1 dts: 1.730000 pts: 1.730000 pos: 6978 size: 4096
-ret: 0 st:-1 flags:1 ts: 0.624171
-ret: 0 st: 0 flags:1 dts: 0.624000 pts: 0.624000 pos: 2554 size: 4096
-ret: 0 st: 0 flags:0 ts:-0.481625
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 58 size: 4096
-ret: 0 st: 0 flags:1 ts: 2.412500
-ret: 0 st: 0 flags:1 dts: 2.412500 pts: 2.412500 pos: 9708 size: 4096
-ret: 0 st:-1 flags:0 ts: 1.306672
-ret: 0 st: 0 flags:1 dts: 1.306750 pts: 1.306750 pos: 5285 size: 4096
-ret: 0 st:-1 flags:1 ts: 0.200839
-ret: 0 st: 0 flags:1 dts: 0.200750 pts: 0.200750 pos: 861 size: 4096
-ret: 0 st: 0 flags:0 ts:-0.905000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 58 size: 4096
-ret: 0 st: 0 flags:1 ts: 1.989125
-ret: 0 st: 0 flags:1 dts: 1.989000 pts: 1.989000 pos: 8014 size: 4096
-ret: 0 st:-1 flags:0 ts: 0.883340
-ret: 0 st: 0 flags:1 dts: 0.883500 pts: 0.883500 pos: 3592 size: 4096
-ret: 0 st:-1 flags:1 ts:-0.222493
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 58 size: 4096
-ret: 0 st: 0 flags:0 ts: 2.671625
-ret: 0 st: 0 flags:1 dts: 2.671750 pts: 2.671750 pos: 10745 size: 4096
-ret: 0 st: 0 flags:1 ts: 1.565875
-ret: 0 st: 0 flags:1 dts: 1.565750 pts: 1.565750 pos: 6321 size: 4096
-ret: 0 st:-1 flags:0 ts: 0.460008
-ret: 0 st: 0 flags:1 dts: 0.460000 pts: 0.460000 pos: 1898 size: 4096
-ret: 0 st:-1 flags:1 ts:-0.645825
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 58 size: 4096
diff --git a/gst-libs/ext/libav/tests/ref/seek/h261_avi b/gst-libs/ext/libav/tests/ref/seek/h261_avi
deleted file mode 100644
index d31364f..0000000
--- a/gst-libs/ext/libav/tests/ref/seek/h261_avi
+++ /dev/null
@@ -1,46 +0,0 @@
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5660 size: 9645
-ret: 0 st:-1 flags:0 ts:-1.000000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5660 size: 9645
-ret: 0 st:-1 flags:1 ts: 1.894167
-ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 126514 size: 11377
-ret: 0 st: 0 flags:0 ts: 0.800000
-ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 82072 size: 10322
-ret:-1 st: 0 flags:1 ts:-0.320000
-ret:-1 st:-1 flags:0 ts: 2.576668
-ret: 0 st:-1 flags:1 ts: 1.470835
-ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 126514 size: 11377
-ret: 0 st: 0 flags:0 ts: 0.360000
-ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 44678 size: 9404
-ret:-1 st: 0 flags:1 ts:-0.760000
-ret:-1 st:-1 flags:0 ts: 2.153336
-ret: 0 st:-1 flags:1 ts: 1.047503
-ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 82072 size: 10322
-ret: 0 st: 0 flags:0 ts:-0.040000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5660 size: 9645
-ret: 0 st: 0 flags:1 ts: 2.840000
-ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 175882 size: 11707
-ret: 0 st:-1 flags:0 ts: 1.730004
-ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 175882 size: 11707
-ret: 0 st:-1 flags:1 ts: 0.624171
-ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 44678 size: 9404
-ret: 0 st: 0 flags:0 ts:-0.480000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5660 size: 9645
-ret: 0 st: 0 flags:1 ts: 2.400000
-ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 175882 size: 11707
-ret: 0 st:-1 flags:0 ts: 1.306672
-ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 126514 size: 11377
-ret: 0 st:-1 flags:1 ts: 0.200839
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5660 size: 9645
-ret: 0 st: 0 flags:0 ts:-0.920000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5660 size: 9645
-ret: 0 st: 0 flags:1 ts: 2.000000
-ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 175882 size: 11707
-ret: 0 st:-1 flags:0 ts: 0.883340
-ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 82072 size: 10322
-ret:-1 st:-1 flags:1 ts:-0.222493
-ret:-1 st: 0 flags:0 ts: 2.680000
-ret: 0 st: 0 flags:1 ts: 1.560000
-ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 126514 size: 11377
-ret: 0 st:-1 flags:0 ts: 0.460008
-ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 44678 size: 9404
-ret:-1 st:-1 flags:1 ts:-0.645825
diff --git a/gst-libs/ext/libav/tests/ref/seek/h263_avi b/gst-libs/ext/libav/tests/ref/seek/h263_avi
deleted file mode 100644
index 8b1795c..0000000
--- a/gst-libs/ext/libav/tests/ref/seek/h263_avi
+++ /dev/null
@@ -1,46 +0,0 @@
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5660 size: 10381
-ret: 0 st:-1 flags:0 ts:-1.000000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5660 size: 10381
-ret: 0 st:-1 flags:1 ts: 1.894167
-ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 103714 size: 12296
-ret: 0 st: 0 flags:0 ts: 0.800000
-ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 66804 size: 11128
-ret:-1 st: 0 flags:1 ts:-0.320000
-ret:-1 st:-1 flags:0 ts: 2.576668
-ret: 0 st:-1 flags:1 ts: 1.470835
-ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 103714 size: 12296
-ret: 0 st: 0 flags:0 ts: 0.360000
-ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 36450 size: 10090
-ret:-1 st: 0 flags:1 ts:-0.760000
-ret:-1 st:-1 flags:0 ts: 2.153336
-ret: 0 st:-1 flags:1 ts: 1.047503
-ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 66804 size: 11128
-ret: 0 st: 0 flags:0 ts:-0.040000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5660 size: 10381
-ret: 0 st: 0 flags:1 ts: 2.840000
-ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 144558 size: 12731
-ret: 0 st:-1 flags:0 ts: 1.730004
-ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 144558 size: 12731
-ret: 0 st:-1 flags:1 ts: 0.624171
-ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 36450 size: 10090
-ret: 0 st: 0 flags:0 ts:-0.480000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5660 size: 10381
-ret: 0 st: 0 flags:1 ts: 2.400000
-ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 144558 size: 12731
-ret: 0 st:-1 flags:0 ts: 1.306672
-ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 103714 size: 12296
-ret: 0 st:-1 flags:1 ts: 0.200839
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5660 size: 10381
-ret: 0 st: 0 flags:0 ts:-0.920000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5660 size: 10381
-ret: 0 st: 0 flags:1 ts: 2.000000
-ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 144558 size: 12731
-ret: 0 st:-1 flags:0 ts: 0.883340
-ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 66804 size: 11128
-ret:-1 st:-1 flags:1 ts:-0.222493
-ret:-1 st: 0 flags:0 ts: 2.680000
-ret: 0 st: 0 flags:1 ts: 1.560000
-ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 103714 size: 12296
-ret: 0 st:-1 flags:0 ts: 0.460008
-ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 36450 size: 10090
-ret:-1 st:-1 flags:1 ts:-0.645825
diff --git a/gst-libs/ext/libav/tests/ref/seek/h263p_avi b/gst-libs/ext/libav/tests/ref/seek/h263p_avi
deleted file mode 100644
index 51e6952..0000000
--- a/gst-libs/ext/libav/tests/ref/seek/h263p_avi
+++ /dev/null
@@ -1,46 +0,0 @@
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5660 size: 36208
-ret: 0 st:-1 flags:0 ts:-1.000000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5660 size: 36208
-ret: 0 st:-1 flags:1 ts: 1.894167
-ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 569938 size: 45151
-ret: 0 st: 0 flags:0 ts: 0.800000
-ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 355988 size: 40907
-ret:-1 st: 0 flags:1 ts:-0.320000
-ret:-1 st:-1 flags:0 ts: 2.576668
-ret: 0 st:-1 flags:1 ts: 1.470835
-ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 569938 size: 45151
-ret: 0 st: 0 flags:0 ts: 0.360000
-ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 171054 size: 36515
-ret:-1 st: 0 flags:1 ts:-0.760000
-ret:-1 st:-1 flags:0 ts: 2.153336
-ret: 0 st:-1 flags:1 ts: 1.047503
-ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 355988 size: 40907
-ret: 0 st: 0 flags:0 ts:-0.040000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5660 size: 36208
-ret: 0 st: 0 flags:1 ts: 2.840000
-ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 804378 size: 46411
-ret: 0 st:-1 flags:0 ts: 1.730004
-ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 804378 size: 46411
-ret: 0 st:-1 flags:1 ts: 0.624171
-ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 171054 size: 36515
-ret: 0 st: 0 flags:0 ts:-0.480000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5660 size: 36208
-ret: 0 st: 0 flags:1 ts: 2.400000
-ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 804378 size: 46411
-ret: 0 st:-1 flags:0 ts: 1.306672
-ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 569938 size: 45151
-ret: 0 st:-1 flags:1 ts: 0.200839
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5660 size: 36208
-ret: 0 st: 0 flags:0 ts:-0.920000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5660 size: 36208
-ret: 0 st: 0 flags:1 ts: 2.000000
-ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 804378 size: 46411
-ret: 0 st:-1 flags:0 ts: 0.883340
-ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 355988 size: 40907
-ret:-1 st:-1 flags:1 ts:-0.222493
-ret:-1 st: 0 flags:0 ts: 2.680000
-ret: 0 st: 0 flags:1 ts: 1.560000
-ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 569938 size: 45151
-ret: 0 st:-1 flags:0 ts: 0.460008
-ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 171054 size: 36515
-ret:-1 st:-1 flags:1 ts:-0.645825
diff --git a/gst-libs/ext/libav/tests/ref/seek/huffyuv_avi b/gst-libs/ext/libav/tests/ref/seek/huffyuv_avi
deleted file mode 100644
index 8e3cbc1..0000000
--- a/gst-libs/ext/libav/tests/ref/seek/huffyuv_avi
+++ /dev/null
@@ -1,46 +0,0 @@
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5736 size:129760
-ret: 0 st:-1 flags:0 ts:-1.000000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5736 size:129760
-ret: 0 st:-1 flags:1 ts: 1.894167
-ret: 0 st: 0 flags:1 dts: 1.880000 pts: 1.880000 pos:6069184 size:128520
-ret: 0 st: 0 flags:0 ts: 0.800000
-ret: 0 st: 0 flags:1 dts: 0.800000 pts: 0.800000 pos:2579624 size:129192
-ret:-1 st: 0 flags:1 ts:-0.320000
-ret:-1 st:-1 flags:0 ts: 2.576668
-ret: 0 st:-1 flags:1 ts: 1.470835
-ret: 0 st: 0 flags:1 dts: 1.480000 pts: 1.480000 pos:4778240 size:129424
-ret: 0 st: 0 flags:0 ts: 0.360000
-ret: 0 st: 0 flags:1 dts: 0.360000 pts: 0.360000 pos:1160260 size:128504
-ret:-1 st: 0 flags:1 ts:-0.760000
-ret:-1 st:-1 flags:0 ts: 2.153336
-ret: 0 st:-1 flags:1 ts: 1.047503
-ret: 0 st: 0 flags:1 dts: 1.040000 pts: 1.040000 pos:3355296 size:129424
-ret: 0 st: 0 flags:0 ts:-0.040000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5736 size:129760
-ret: 0 st: 0 flags:1 ts: 2.840000
-ret: 0 st: 0 flags:1 dts: 1.960000 pts: 1.960000 pos:6326136 size:128288
-ret: 0 st:-1 flags:0 ts: 1.730004
-ret: 0 st: 0 flags:1 dts: 1.720000 pts: 1.720000 pos:5554008 size:129016
-ret: 0 st:-1 flags:1 ts: 0.624171
-ret: 0 st: 0 flags:1 dts: 0.640000 pts: 0.640000 pos:2062504 size:129204
-ret: 0 st: 0 flags:0 ts:-0.480000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5736 size:129760
-ret: 0 st: 0 flags:1 ts: 2.400000
-ret: 0 st: 0 flags:1 dts: 1.960000 pts: 1.960000 pos:6326136 size:128288
-ret: 0 st:-1 flags:0 ts: 1.306672
-ret: 0 st: 0 flags:1 dts: 1.320000 pts: 1.320000 pos:4260872 size:129280
-ret: 0 st:-1 flags:1 ts: 0.200839
-ret: 0 st: 0 flags:1 dts: 0.200000 pts: 0.200000 pos: 646920 size:128204
-ret: 0 st: 0 flags:0 ts:-0.920000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5736 size:129760
-ret: 0 st: 0 flags:1 ts: 2.000000
-ret: 0 st: 0 flags:1 dts: 1.960000 pts: 1.960000 pos:6326136 size:128288
-ret: 0 st:-1 flags:0 ts: 0.883340
-ret: 0 st: 0 flags:1 dts: 0.880000 pts: 0.880000 pos:2838080 size:129268
-ret:-1 st:-1 flags:1 ts:-0.222493
-ret:-1 st: 0 flags:0 ts: 2.680000
-ret: 0 st: 0 flags:1 ts: 1.560000
-ret: 0 st: 0 flags:1 dts: 1.560000 pts: 1.560000 pos:5037036 size:129284
-ret: 0 st:-1 flags:0 ts: 0.460008
-ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos:1546184 size:128860
-ret:-1 st:-1 flags:1 ts:-0.645825
diff --git a/gst-libs/ext/libav/tests/ref/seek/jpegls_avi b/gst-libs/ext/libav/tests/ref/seek/jpegls_avi
deleted file mode 100644
index b95ec5a..0000000
--- a/gst-libs/ext/libav/tests/ref/seek/jpegls_avi
+++ /dev/null
@@ -1,46 +0,0 @@
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5660 size:164074
-ret: 0 st:-1 flags:0 ts:-1.000000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5660 size:164074
-ret: 0 st:-1 flags:1 ts: 1.894167
-ret: 0 st: 0 flags:1 dts: 1.880000 pts: 1.880000 pos:7804130 size:176295
-ret: 0 st: 0 flags:0 ts: 0.800000
-ret: 0 st: 0 flags:1 dts: 0.800000 pts: 0.800000 pos:3172792 size:164643
-ret:-1 st: 0 flags:1 ts:-0.320000
-ret:-1 st:-1 flags:0 ts: 2.576668
-ret: 0 st:-1 flags:1 ts: 1.470835
-ret: 0 st: 0 flags:1 dts: 1.480000 pts: 1.480000 pos:6052986 size:174097
-ret: 0 st: 0 flags:0 ts: 0.360000
-ret: 0 st: 0 flags:1 dts: 0.360000 pts: 0.360000 pos:1402356 size:157283
-ret:-1 st: 0 flags:1 ts:-0.760000
-ret:-1 st:-1 flags:0 ts: 2.153336
-ret: 0 st:-1 flags:1 ts: 1.047503
-ret: 0 st: 0 flags:1 dts: 1.040000 pts: 1.040000 pos:4170260 size:168401
-ret: 0 st: 0 flags:0 ts:-0.040000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5660 size:164074
-ret: 0 st: 0 flags:1 ts: 2.840000
-ret: 0 st: 0 flags:1 dts: 1.960000 pts: 1.960000 pos:8157028 size:176793
-ret: 0 st:-1 flags:0 ts: 1.730004
-ret: 0 st: 0 flags:1 dts: 1.720000 pts: 1.720000 pos:7101766 size:175326
-ret: 0 st:-1 flags:1 ts: 0.624171
-ret: 0 st: 0 flags:1 dts: 0.640000 pts: 0.640000 pos:2519272 size:162522
-ret: 0 st: 0 flags:0 ts:-0.480000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5660 size:164074
-ret: 0 st: 0 flags:1 ts: 2.400000
-ret: 0 st: 0 flags:1 dts: 1.960000 pts: 1.960000 pos:8157028 size:176793
-ret: 0 st:-1 flags:0 ts: 1.306672
-ret: 0 st: 0 flags:1 dts: 1.320000 pts: 1.320000 pos:5360830 size:172183
-ret: 0 st:-1 flags:1 ts: 0.200839
-ret: 0 st: 0 flags:1 dts: 0.200000 pts: 0.200000 pos: 779846 size:154579
-ret: 0 st: 0 flags:0 ts:-0.920000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5660 size:164074
-ret: 0 st: 0 flags:1 ts: 2.000000
-ret: 0 st: 0 flags:1 dts: 1.960000 pts: 1.960000 pos:8157028 size:176793
-ret: 0 st:-1 flags:0 ts: 0.883340
-ret: 0 st: 0 flags:1 dts: 0.880000 pts: 0.880000 pos:3502840 size:166017
-ret:-1 st:-1 flags:1 ts:-0.222493
-ret:-1 st: 0 flags:0 ts: 2.680000
-ret: 0 st: 0 flags:1 ts: 1.560000
-ret: 0 st: 0 flags:1 dts: 1.560000 pts: 1.560000 pos:6401464 size:174815
-ret: 0 st:-1 flags:0 ts: 0.460008
-ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos:1876428 size:159659
-ret:-1 st:-1 flags:1 ts:-0.645825
diff --git a/gst-libs/ext/libav/tests/ref/seek/lavf_aif b/gst-libs/ext/libav/tests/ref/seek/lavf-aiff
index 784b144..784b144 100644
--- a/gst-libs/ext/libav/tests/ref/seek/lavf_aif
+++ b/gst-libs/ext/libav/tests/ref/seek/lavf-aiff
diff --git a/gst-libs/ext/libav/tests/ref/seek/lavf_al b/gst-libs/ext/libav/tests/ref/seek/lavf-alaw
index 84661ec..84661ec 100644
--- a/gst-libs/ext/libav/tests/ref/seek/lavf_al
+++ b/gst-libs/ext/libav/tests/ref/seek/lavf-alaw
diff --git a/gst-libs/ext/libav/tests/ref/seek/lavf-asf b/gst-libs/ext/libav/tests/ref/seek/lavf-asf
new file mode 100644
index 0000000..e1d6d32
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/seek/lavf-asf
@@ -0,0 +1,53 @@
+ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 575 size: 208
+ret: 0 st:-1 flags:0 ts:-1.000000
+ret: 0 st: 1 flags:1 dts: 0.459000 pts: 0.459000 pos: 147775 size: 209
+ret: 0 st:-1 flags:1 ts: 1.894167
+ret: 0 st: 1 flags:1 dts: 0.930000 pts: 0.930000 pos: 301375 size: 209
+ret: 0 st: 0 flags:0 ts: 0.788000
+ret: 0 st: 1 flags:1 dts: 0.930000 pts: 0.930000 pos: 301375 size: 209
+ret: 0 st: 0 flags:1 ts:-0.317000
+ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 575 size: 208
+ret: 0 st: 1 flags:0 ts: 2.577000
+ret: 0 st: 1 flags:1 dts: 0.982000 pts: 0.982000 pos: 330175 size: 209
+ret: 0 st: 1 flags:1 ts: 1.471000
+ret: 0 st: 1 flags:1 dts: 0.982000 pts: 0.982000 pos: 330175 size: 209
+ret: 0 st:-1 flags:0 ts: 0.365002
+ret: 0 st: 1 flags:1 dts: 0.459000 pts: 0.459000 pos: 147775 size: 209
+ret: 0 st:-1 flags:1 ts:-0.740831
+ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 575 size: 208
+ret: 0 st: 0 flags:0 ts: 2.153000
+ret: 0 st: 1 flags:1 dts: 0.930000 pts: 0.930000 pos: 301375 size: 209
+ret: 0 st: 0 flags:1 ts: 1.048000
+ret: 0 st: 1 flags:1 dts: 0.930000 pts: 0.930000 pos: 301375 size: 209
+ret: 0 st: 1 flags:0 ts:-0.058000
+ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 575 size: 208
+ret: 0 st: 1 flags:1 ts: 2.836000
+ret: 0 st: 1 flags:1 dts: 0.982000 pts: 0.982000 pos: 330175 size: 209
+ret: 0 st:-1 flags:0 ts: 1.730004
+ret: 0 st: 1 flags:1 dts: 0.930000 pts: 0.930000 pos: 301375 size: 209
+ret: 0 st:-1 flags:1 ts: 0.624171
+ret: 0 st: 1 flags:1 dts: 0.459000 pts: 0.459000 pos: 147775 size: 209
+ret: 0 st: 0 flags:0 ts:-0.482000
+ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 575 size: 208
+ret: 0 st: 0 flags:1 ts: 2.413000
+ret: 0 st: 1 flags:1 dts: 0.930000 pts: 0.930000 pos: 301375 size: 209
+ret: 0 st: 1 flags:0 ts: 1.307000
+ret: 0 st: 1 flags:1 dts: 0.982000 pts: 0.982000 pos: 330175 size: 209
+ret: 0 st: 1 flags:1 ts: 0.201000
+ret: 0 st: 1 flags:1 dts: 0.198000 pts: 0.198000 pos: 74175 size: 209
+ret: 0 st:-1 flags:0 ts:-0.904994
+ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 575 size: 208
+ret: 0 st:-1 flags:1 ts: 1.989173
+ret: 0 st: 1 flags:1 dts: 0.930000 pts: 0.930000 pos: 301375 size: 209
+ret: 0 st: 0 flags:0 ts: 0.883000
+ret: 0 st: 1 flags:1 dts: 0.930000 pts: 0.930000 pos: 301375 size: 209
+ret: 0 st: 0 flags:1 ts:-0.222000
+ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 575 size: 208
+ret: 0 st: 1 flags:0 ts: 2.672000
+ret: 0 st: 1 flags:1 dts: 0.982000 pts: 0.982000 pos: 330175 size: 209
+ret: 0 st: 1 flags:1 ts: 1.566000
+ret: 0 st: 1 flags:1 dts: 0.982000 pts: 0.982000 pos: 330175 size: 209
+ret: 0 st:-1 flags:0 ts: 0.460008
+ret: 0 st: 1 flags:1 dts: 0.459000 pts: 0.459000 pos: 147775 size: 209
+ret: 0 st:-1 flags:1 ts:-0.645825
+ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 575 size: 208
diff --git a/gst-libs/ext/libav/tests/ref/seek/lavf_au b/gst-libs/ext/libav/tests/ref/seek/lavf-au
index a2c57eb..a2c57eb 100644
--- a/gst-libs/ext/libav/tests/ref/seek/lavf_au
+++ b/gst-libs/ext/libav/tests/ref/seek/lavf-au
diff --git a/gst-libs/ext/libav/tests/ref/seek/lavf-avi b/gst-libs/ext/libav/tests/ref/seek/lavf-avi
new file mode 100644
index 0000000..0cabe12
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/seek/lavf-avi
@@ -0,0 +1,44 @@
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 9896 size: 27867
+ret: 0 st:-1 flags:0 ts:-1.000000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 9896 size: 27867
+ret: 0 st:-1 flags:1 ts: 1.894167
+ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 301454 size: 27864
+ret: 0 st: 0 flags:0 ts: 0.800000
+ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 301454 size: 27864
+ret:-1 st: 0 flags:1 ts:-0.320000
+ret:-1 st: 1 flags:0 ts: 2.586122
+ret: 0 st: 1 flags:1 ts: 1.462857
+ret: 0 st: 1 flags:1 dts: 0.992653 pts: 0.992653 pos: 329544 size: 209
+ret: 0 st:-1 flags:0 ts: 0.365002
+ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 156154 size: 27955
+ret:-1 st:-1 flags:1 ts:-0.740831
+ret:-1 st: 0 flags:0 ts: 2.160000
+ret: 0 st: 0 flags:1 ts: 1.040000
+ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 301454 size: 27864
+ret: 0 st: 1 flags:0 ts:-0.052245
+ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 37772 size: 208
+ret: 0 st: 1 flags:1 ts: 2.847347
+ret: 0 st: 1 flags:1 dts: 0.992653 pts: 0.992653 pos: 329544 size: 209
+ret:-1 st:-1 flags:0 ts: 1.730004
+ret: 0 st:-1 flags:1 ts: 0.624171
+ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 156154 size: 27955
+ret: 0 st: 0 flags:0 ts:-0.480000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 9896 size: 27867
+ret: 0 st: 0 flags:1 ts: 2.400000
+ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 301454 size: 27864
+ret:-1 st: 1 flags:0 ts: 1.306122
+ret: 0 st: 1 flags:1 ts: 0.208980
+ret: 0 st: 1 flags:1 dts: 0.208980 pts: 0.208980 pos: 92788 size: 209
+ret: 0 st:-1 flags:0 ts:-0.904994
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 9896 size: 27867
+ret: 0 st:-1 flags:1 ts: 1.989173
+ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 301454 size: 27864
+ret: 0 st: 0 flags:0 ts: 0.880000
+ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 301454 size: 27864
+ret:-1 st: 0 flags:1 ts:-0.240000
+ret:-1 st: 1 flags:0 ts: 2.664490
+ret: 0 st: 1 flags:1 ts: 1.567347
+ret: 0 st: 1 flags:1 dts: 0.992653 pts: 0.992653 pos: 329544 size: 209
+ret: 0 st:-1 flags:0 ts: 0.460008
+ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 156154 size: 27955
+ret:-1 st:-1 flags:1 ts:-0.645825
diff --git a/gst-libs/ext/libav/tests/ref/seek/image_bmp b/gst-libs/ext/libav/tests/ref/seek/lavf-bmp
index d60729b..d60729b 100644
--- a/gst-libs/ext/libav/tests/ref/seek/image_bmp
+++ b/gst-libs/ext/libav/tests/ref/seek/lavf-bmp
diff --git a/gst-libs/ext/libav/tests/ref/seek/lavf_dv b/gst-libs/ext/libav/tests/ref/seek/lavf-dv_fmt
index 3c49749..3c49749 100644
--- a/gst-libs/ext/libav/tests/ref/seek/lavf_dv
+++ b/gst-libs/ext/libav/tests/ref/seek/lavf-dv_fmt
diff --git a/gst-libs/ext/libav/tests/ref/seek/lavf-ffm b/gst-libs/ext/libav/tests/ref/seek/lavf-ffm
new file mode 100644
index 0000000..2597220
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/seek/lavf-ffm
@@ -0,0 +1,53 @@
+ret: 0 st: 0 flags:1 dts:-0.040000 pts: 0.000000 pos: 8192 size: 24664
+ret: 0 st:-1 flags:0 ts:-1.000000
+ret: 0 st: 0 flags:1 dts:-0.040000 pts: 0.000000 pos: 8192 size: 24664
+ret: 0 st:-1 flags:1 ts: 1.894167
+ret: 0 st: 1 flags:1 dts: 0.929501 pts: 0.929501 pos: 376832 size: 209
+ret: 0 st: 0 flags:0 ts: 0.788334
+ret: 0 st: 1 flags:1 dts: 0.772766 pts: 0.772766 pos: 315392 size: 209
+ret: 0 st: 0 flags:1 ts:-0.317499
+ret: 0 st: 0 flags:1 dts:-0.040000 pts: 0.000000 pos: 8192 size: 24664
+ret: 0 st: 1 flags:0 ts: 2.576668
+ret: 0 st: 1 flags:1 dts: 0.929501 pts: 0.929501 pos: 376832 size: 209
+ret: 0 st: 1 flags:1 ts: 1.470835
+ret: 0 st: 1 flags:1 dts: 0.929501 pts: 0.929501 pos: 376832 size: 209
+ret: 0 st:-1 flags:0 ts: 0.365002
+ret: 0 st: 1 flags:1 dts: 0.328685 pts: 0.328685 pos: 155648 size: 209
+ret: 0 st:-1 flags:1 ts:-0.740831
+ret: 0 st: 0 flags:1 dts:-0.040000 pts: 0.000000 pos: 8192 size: 24664
+ret: 0 st: 0 flags:0 ts: 2.153336
+ret: 0 st: 1 flags:1 dts: 0.929501 pts: 0.929501 pos: 376832 size: 209
+ret: 0 st: 0 flags:1 ts: 1.047503
+ret: 0 st: 1 flags:1 dts: 0.929501 pts: 0.929501 pos: 376832 size: 209
+ret: 0 st: 1 flags:0 ts:-0.058330
+ret: 0 st: 0 flags:1 dts:-0.040000 pts: 0.000000 pos: 8192 size: 24664
+ret: 0 st: 1 flags:1 ts: 2.835837
+ret: 0 st: 1 flags:1 dts: 0.929501 pts: 0.929501 pos: 376832 size: 209
+ret: 0 st:-1 flags:0 ts: 1.730004
+ret: 0 st: 1 flags:1 dts: 0.929501 pts: 0.929501 pos: 376832 size: 209
+ret: 0 st:-1 flags:1 ts: 0.624171
+ret: 0 st: 1 flags:1 dts: 0.642154 pts: 0.642154 pos: 274432 size: 209
+ret: 0 st: 0 flags:0 ts:-0.481662
+ret: 0 st: 0 flags:1 dts:-0.040000 pts: 0.000000 pos: 8192 size: 24664
+ret: 0 st: 0 flags:1 ts: 2.412505
+ret: 0 st: 1 flags:1 dts: 0.929501 pts: 0.929501 pos: 376832 size: 209
+ret: 0 st: 1 flags:0 ts: 1.306672
+ret: 0 st: 1 flags:1 dts: 0.929501 pts: 0.929501 pos: 376832 size: 209
+ret: 0 st: 1 flags:1 ts: 0.200839
+ret: 0 st: 1 flags:1 dts: 0.224195 pts: 0.224195 pos: 114688 size: 209
+ret: 0 st:-1 flags:0 ts:-0.904994
+ret: 0 st: 0 flags:1 dts:-0.040000 pts: 0.000000 pos: 8192 size: 24664
+ret: 0 st:-1 flags:1 ts: 1.989173
+ret: 0 st: 1 flags:1 dts: 0.929501 pts: 0.929501 pos: 376832 size: 209
+ret: 0 st: 0 flags:0 ts: 0.883340
+ret: 0 st: 1 flags:1 dts: 0.877256 pts: 0.877256 pos: 339968 size: 209
+ret: 0 st: 0 flags:1 ts:-0.222493
+ret: 0 st: 0 flags:1 dts:-0.040000 pts: 0.000000 pos: 8192 size: 24664
+ret: 0 st: 1 flags:0 ts: 2.671674
+ret: 0 st: 1 flags:1 dts: 0.929501 pts: 0.929501 pos: 376832 size: 209
+ret: 0 st: 1 flags:1 ts: 1.565841
+ret: 0 st: 1 flags:1 dts: 0.929501 pts: 0.929501 pos: 376832 size: 209
+ret: 0 st:-1 flags:0 ts: 0.460008
+ret: 0 st: 1 flags:1 dts: 0.459297 pts: 0.459297 pos: 204800 size: 209
+ret: 0 st:-1 flags:1 ts:-0.645825
+ret: 0 st: 0 flags:1 dts:-0.040000 pts: 0.000000 pos: 8192 size: 24664
diff --git a/gst-libs/ext/libav/tests/ref/seek/lavf_flv b/gst-libs/ext/libav/tests/ref/seek/lavf-flv_fmt
index 2e7a0bc..2e7a0bc 100644
--- a/gst-libs/ext/libav/tests/ref/seek/lavf_flv
+++ b/gst-libs/ext/libav/tests/ref/seek/lavf-flv_fmt
diff --git a/gst-libs/ext/libav/tests/ref/seek/lavf_gif b/gst-libs/ext/libav/tests/ref/seek/lavf-gif
index 883f187..883f187 100644
--- a/gst-libs/ext/libav/tests/ref/seek/lavf_gif
+++ b/gst-libs/ext/libav/tests/ref/seek/lavf-gif
diff --git a/gst-libs/ext/libav/tests/ref/seek/lavf_gxf b/gst-libs/ext/libav/tests/ref/seek/lavf-gxf
index bc7ff3b..bc7ff3b 100644
--- a/gst-libs/ext/libav/tests/ref/seek/lavf_gxf
+++ b/gst-libs/ext/libav/tests/ref/seek/lavf-gxf
diff --git a/gst-libs/ext/libav/tests/ref/seek/image_jpg b/gst-libs/ext/libav/tests/ref/seek/lavf-jpg
index 88964ca..88964ca 100644
--- a/gst-libs/ext/libav/tests/ref/seek/image_jpg
+++ b/gst-libs/ext/libav/tests/ref/seek/lavf-jpg
diff --git a/gst-libs/ext/libav/tests/ref/seek/lavf-mkv b/gst-libs/ext/libav/tests/ref/seek/lavf-mkv
new file mode 100644
index 0000000..e51e9c9
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/seek/lavf-mkv
@@ -0,0 +1,53 @@
+ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 512 size: 208
+ret: 0 st:-1 flags:0 ts:-1.000000
+ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 512 size: 208
+ret: 0 st:-1 flags:1 ts: 1.894167
+ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 292150 size: 27834
+ret: 0 st: 0 flags:0 ts: 0.788000
+ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 292150 size: 27834
+ret: 0 st: 0 flags:1 ts:-0.317000
+ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 512 size: 208
+ret: 0 st: 1 flags:0 ts: 2.577000
+ret:-EOF
+ret: 0 st: 1 flags:1 ts: 1.471000
+ret: 0 st: 1 flags:1 dts: 0.982000 pts: 0.982000 pos: 319991 size: 209
+ret: 0 st:-1 flags:0 ts: 0.365002
+ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 146703 size: 27925
+ret: 0 st:-1 flags:1 ts:-0.740831
+ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 512 size: 208
+ret: 0 st: 0 flags:0 ts: 2.153000
+ret:-EOF
+ret: 0 st: 0 flags:1 ts: 1.048000
+ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 292150 size: 27834
+ret: 0 st: 1 flags:0 ts:-0.058000
+ret: 0 st: 1 flags:1 dts: 0.015000 pts: 0.015000 pos: 512 size: 208
+ret: 0 st: 1 flags:1 ts: 2.836000
+ret: 0 st: 1 flags:1 dts: 0.982000 pts: 0.982000 pos: 319991 size: 209
+ret: 0 st:-1 flags:0 ts: 1.730004
+ret:-EOF
+ret: 0 st:-1 flags:1 ts: 0.624171
+ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 146703 size: 27925
+ret: 0 st: 0 flags:0 ts:-0.482000
+ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 512 size: 208
+ret: 0 st: 0 flags:1 ts: 2.413000
+ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 292150 size: 27834
+ret: 0 st: 1 flags:0 ts: 1.307000
+ret:-EOF
+ret: 0 st: 1 flags:1 ts: 0.201000
+ret: 0 st: 1 flags:1 dts: 0.015000 pts: 0.015000 pos: 512 size: 208
+ret: 0 st:-1 flags:0 ts:-0.904994
+ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 512 size: 208
+ret: 0 st:-1 flags:1 ts: 1.989173
+ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 292150 size: 27834
+ret: 0 st: 0 flags:0 ts: 0.883000
+ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 292150 size: 27834
+ret: 0 st: 0 flags:1 ts:-0.222000
+ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 512 size: 208
+ret: 0 st: 1 flags:0 ts: 2.672000
+ret:-EOF
+ret: 0 st: 1 flags:1 ts: 1.566000
+ret: 0 st: 1 flags:1 dts: 0.982000 pts: 0.982000 pos: 319991 size: 209
+ret: 0 st:-1 flags:0 ts: 0.460008
+ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 146703 size: 27925
+ret: 0 st:-1 flags:1 ts:-0.645825
+ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 512 size: 208
diff --git a/gst-libs/ext/libav/tests/ref/seek/lavf_mmf b/gst-libs/ext/libav/tests/ref/seek/lavf-mmf
index 196d263..196d263 100644
--- a/gst-libs/ext/libav/tests/ref/seek/lavf_mmf
+++ b/gst-libs/ext/libav/tests/ref/seek/lavf-mmf
diff --git a/gst-libs/ext/libav/tests/ref/seek/lavf_mov b/gst-libs/ext/libav/tests/ref/seek/lavf-mov
index 0091915..0091915 100644
--- a/gst-libs/ext/libav/tests/ref/seek/lavf_mov
+++ b/gst-libs/ext/libav/tests/ref/seek/lavf-mov
diff --git a/gst-libs/ext/libav/tests/ref/seek/lavf-mpg b/gst-libs/ext/libav/tests/ref/seek/lavf-mpg
new file mode 100644
index 0000000..0f0d720
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/seek/lavf-mpg
@@ -0,0 +1,53 @@
+ret: 0 st: 1 flags:1 dts: 0.989089 pts: 0.989089 pos: 2048 size: 208
+ret: 0 st:-1 flags:0 ts:-1.000000
+ret: 0 st: 1 flags:1 dts: 0.989089 pts: 0.989089 pos: 2048 size: 208
+ret: 0 st:-1 flags:1 ts: 1.894167
+ret: 0 st: 0 flags:0 dts: 1.880000 pts: 1.920000 pos: 327680 size: 12894
+ret: 0 st: 0 flags:0 ts: 0.788333
+ret: 0 st: 1 flags:1 dts: 0.989089 pts: 0.989089 pos: 2048 size: 208
+ret: 0 st: 0 flags:1 ts:-0.317500
+ret: 0 st: 1 flags:1 dts: 0.989089 pts: 0.989089 pos: 2048 size: 208
+ret: 0 st: 1 flags:0 ts: 2.576667
+ret: 0 st: 1 flags:1 dts: 1.772767 pts: 1.772767 pos: 368652 size: 379
+ret: 0 st: 1 flags:1 ts: 1.470833
+ret: 0 st: 1 flags:1 dts: 1.250322 pts: 1.250322 pos: 145408 size: 261
+ret: 0 st:-1 flags:0 ts: 0.365002
+ret: 0 st: 1 flags:1 dts: 0.989089 pts: 0.989089 pos: 2048 size: 208
+ret: 0 st:-1 flags:1 ts:-0.740831
+ret: 0 st: 1 flags:1 dts: 0.989089 pts: 0.989089 pos: 2048 size: 208
+ret: 0 st: 0 flags:0 ts: 2.153333
+ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.960000 pos: 339968 size: 681
+ret: 0 st: 0 flags:1 ts: 1.047500
+ret: 0 st: 0 flags:0 dts: 1.040000 pts: 1.080000 pos: 40960 size: 16073
+ret: 0 st: 1 flags:0 ts:-0.058333
+ret: 0 st: 1 flags:1 dts: 0.989089 pts: 0.989089 pos: 2048 size: 208
+ret: 0 st: 1 flags:1 ts: 2.835833
+ret: 0 st: 1 flags:1 dts: 1.772767 pts: 1.772767 pos: 368652 size: 379
+ret: 0 st:-1 flags:0 ts: 1.730004
+ret: 0 st: 0 flags:0 dts: 1.760000 pts: 1.800000 pos: 292864 size: 13170
+ret: 0 st:-1 flags:1 ts: 0.624171
+ret: 0 st: 1 flags:1 dts: 0.989089 pts: 0.989089 pos: 2048 size: 208
+ret: 0 st: 0 flags:0 ts:-0.481667
+ret: 0 st: 1 flags:1 dts: 0.989089 pts: 0.989089 pos: 2048 size: 208
+ret: 0 st: 0 flags:1 ts: 2.412500
+ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.960000 pos: 339968 size: 681
+ret: 0 st: 1 flags:0 ts: 1.306667
+ret: 0 st: 1 flags:1 dts: 1.511544 pts: 1.511544 pos: 342028 size: 314
+ret: 0 st: 1 flags:1 ts: 0.200844
+ret: 0 st: 1 flags:1 dts: 0.989089 pts: 0.989089 pos: 2048 size: 208
+ret: 0 st:-1 flags:0 ts:-0.904994
+ret: 0 st: 1 flags:1 dts: 0.989089 pts: 0.989089 pos: 2048 size: 208
+ret: 0 st:-1 flags:1 ts: 1.989173
+ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.960000 pos: 339968 size: 681
+ret: 0 st: 0 flags:0 ts: 0.883344
+ret: 0 st: 1 flags:1 dts: 0.989089 pts: 0.989089 pos: 2048 size: 208
+ret: 0 st: 0 flags:1 ts:-0.222489
+ret: 0 st: 1 flags:1 dts: 0.989089 pts: 0.989089 pos: 2048 size: 208
+ret: 0 st: 1 flags:0 ts: 2.671678
+ret: 0 st: 1 flags:1 dts: 1.772767 pts: 1.772767 pos: 368652 size: 379
+ret: 0 st: 1 flags:1 ts: 1.565844
+ret: 0 st: 1 flags:1 dts: 1.511544 pts: 1.511544 pos: 342028 size: 314
+ret: 0 st:-1 flags:0 ts: 0.460008
+ret: 0 st: 1 flags:1 dts: 0.989089 pts: 0.989089 pos: 2048 size: 208
+ret: 0 st:-1 flags:1 ts:-0.645825
+ret: 0 st: 1 flags:1 dts: 0.989089 pts: 0.989089 pos: 2048 size: 208
diff --git a/gst-libs/ext/libav/tests/ref/seek/lavf_ul b/gst-libs/ext/libav/tests/ref/seek/lavf-mulaw
index 84661ec..84661ec 100644
--- a/gst-libs/ext/libav/tests/ref/seek/lavf_ul
+++ b/gst-libs/ext/libav/tests/ref/seek/lavf-mulaw
diff --git a/gst-libs/ext/libav/tests/ref/seek/lavf-mxf b/gst-libs/ext/libav/tests/ref/seek/lavf-mxf
new file mode 100644
index 0000000..cc634a8
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/seek/lavf-mxf
@@ -0,0 +1,48 @@
+ret: 0 st: 0 flags:1 dts:-0.040000 pts: 0.000000 pos: 6144 size: 24801
+ret: 0 st:-1 flags:0 ts:-1.000000
+ret: 0 st: 0 flags:1 dts:-0.040000 pts: 0.000000 pos: 6144 size: 24801
+ret: 0 st:-1 flags:1 ts: 1.894167
+ret: 0 st: 0 flags:1 dts: 0.840000 pts: 0.960000 pos: 460800 size: 24712
+ret: 0 st: 0 flags:0 ts: 0.800000
+ret: 0 st: 0 flags:1 dts: 0.840000 pts: 0.960000 pos: 460800 size: 24712
+ret: 0 st: 0 flags:1 ts:-0.320000
+ret: 0 st: 0 flags:1 dts:-0.040000 pts: 0.000000 pos: 6144 size: 24801
+ret:-1 st: 1 flags:0 ts: 2.560000
+ret: 0 st: 1 flags:1 ts: 1.480000
+ret: 0 st: 0 flags:1 dts: 0.840000 pts: 0.960000 pos: 460800 size: 24712
+ret: 0 st:-1 flags:0 ts: 0.365002
+ret: 0 st: 0 flags:1 dts: 0.360000 pts: 0.480000 pos: 211968 size: 24787
+ret: 0 st:-1 flags:1 ts:-0.740831
+ret: 0 st: 0 flags:1 dts:-0.040000 pts: 0.000000 pos: 6144 size: 24801
+ret:-1 st: 0 flags:0 ts: 2.160000
+ret: 0 st: 0 flags:1 ts: 1.040000
+ret: 0 st: 0 flags:1 dts: 0.840000 pts: 0.960000 pos: 460800 size: 24712
+ret: 0 st: 1 flags:0 ts:-0.040000
+ret: 0 st: 0 flags:1 dts:-0.040000 pts: 0.000000 pos: 6144 size: 24801
+ret: 0 st: 1 flags:1 ts: 2.840000
+ret: 0 st: 0 flags:1 dts: 0.840000 pts: 0.960000 pos: 460800 size: 24712
+ret:-1 st:-1 flags:0 ts: 1.730004
+ret: 0 st:-1 flags:1 ts: 0.624171
+ret: 0 st: 0 flags:1 dts: 0.360000 pts: 0.480000 pos: 211968 size: 24787
+ret: 0 st: 0 flags:0 ts:-0.480000
+ret: 0 st: 0 flags:1 dts:-0.040000 pts: 0.000000 pos: 6144 size: 24801
+ret: 0 st: 0 flags:1 ts: 2.400000
+ret: 0 st: 0 flags:1 dts: 0.840000 pts: 0.960000 pos: 460800 size: 24712
+ret:-1 st: 1 flags:0 ts: 1.320000
+ret: 0 st: 1 flags:1 ts: 0.200000
+ret: 0 st: 0 flags:1 dts:-0.040000 pts: 0.000000 pos: 6144 size: 24801
+ret: 0 st:-1 flags:0 ts:-0.904994
+ret: 0 st: 0 flags:1 dts:-0.040000 pts: 0.000000 pos: 6144 size: 24801
+ret: 0 st:-1 flags:1 ts: 1.989173
+ret: 0 st: 0 flags:1 dts: 0.840000 pts: 0.960000 pos: 460800 size: 24712
+ret: 0 st: 0 flags:0 ts: 0.880000
+ret: 0 st: 0 flags:1 dts: 0.840000 pts: 0.960000 pos: 460800 size: 24712
+ret: 0 st: 0 flags:1 ts:-0.240000
+ret: 0 st: 0 flags:1 dts:-0.040000 pts: 0.000000 pos: 6144 size: 24801
+ret:-1 st: 1 flags:0 ts: 2.680000
+ret: 0 st: 1 flags:1 ts: 1.560000
+ret: 0 st: 0 flags:1 dts: 0.840000 pts: 0.960000 pos: 460800 size: 24712
+ret: 0 st:-1 flags:0 ts: 0.460008
+ret: 0 st: 0 flags:1 dts: 0.840000 pts: 0.960000 pos: 460800 size: 24712
+ret: 0 st:-1 flags:1 ts:-0.645825
+ret: 0 st: 0 flags:1 dts:-0.040000 pts: 0.000000 pos: 6144 size: 24801
diff --git a/gst-libs/ext/libav/tests/ref/seek/lavf-mxf_d10 b/gst-libs/ext/libav/tests/ref/seek/lavf-mxf_d10
new file mode 100644
index 0000000..4cfe595
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/seek/lavf-mxf_d10
@@ -0,0 +1,53 @@
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 6144 size:150000
+ret: 0 st:-1 flags:0 ts:-1.000000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 6144 size:150000
+ret: 0 st:-1 flags:1 ts: 1.894167
+ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos:5117952 size:150000
+ret: 0 st: 0 flags:0 ts: 0.800000
+ret: 0 st: 0 flags:1 dts: 0.800000 pts: 0.800000 pos:4265984 size:150000
+ret: 0 st: 0 flags:1 ts:-0.320000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 6144 size:150000
+ret: 0 st: 1 flags:0 ts: 2.560000
+ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos:5117952 size:150000
+ret: 0 st: 1 flags:1 ts: 1.480000
+ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos:5117952 size:150000
+ret: 0 st:-1 flags:0 ts: 0.365002
+ret: 0 st: 0 flags:1 dts: 0.360000 pts: 0.360000 pos:1923072 size:150000
+ret: 0 st:-1 flags:1 ts:-0.740831
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 6144 size:150000
+ret: 0 st: 0 flags:0 ts: 2.160000
+ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos:5117952 size:150000
+ret: 0 st: 0 flags:1 ts: 1.040000
+ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos:5117952 size:150000
+ret: 0 st: 1 flags:0 ts:-0.040000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 6144 size:150000
+ret: 0 st: 1 flags:1 ts: 2.840000
+ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos:5117952 size:150000
+ret: 0 st:-1 flags:0 ts: 1.730004
+ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos:5117952 size:150000
+ret: 0 st:-1 flags:1 ts: 0.624171
+ret: 0 st: 0 flags:1 dts: 0.640000 pts: 0.640000 pos:3414016 size:150000
+ret: 0 st: 0 flags:0 ts:-0.480000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 6144 size:150000
+ret: 0 st: 0 flags:1 ts: 2.400000
+ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos:5117952 size:150000
+ret: 0 st: 1 flags:0 ts: 1.320000
+ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos:5117952 size:150000
+ret: 0 st: 1 flags:1 ts: 0.200000
+ret: 0 st: 0 flags:1 dts: 0.200000 pts: 0.200000 pos:1071104 size:150000
+ret: 0 st:-1 flags:0 ts:-0.904994
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 6144 size:150000
+ret: 0 st:-1 flags:1 ts: 1.989173
+ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos:5117952 size:150000
+ret: 0 st: 0 flags:0 ts: 0.880000
+ret: 0 st: 0 flags:1 dts: 0.880000 pts: 0.880000 pos:4691968 size:150000
+ret: 0 st: 0 flags:1 ts:-0.240000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 6144 size:150000
+ret: 0 st: 1 flags:0 ts: 2.680000
+ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos:5117952 size:150000
+ret: 0 st: 1 flags:1 ts: 1.560000
+ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos:5117952 size:150000
+ret: 0 st:-1 flags:0 ts: 0.460008
+ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos:2562048 size:150000
+ret: 0 st:-1 flags:1 ts:-0.645825
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 6144 size:150000
diff --git a/gst-libs/ext/libav/tests/ref/seek/lavf_nut b/gst-libs/ext/libav/tests/ref/seek/lavf-nut
index fc3ef63..fc3ef63 100644
--- a/gst-libs/ext/libav/tests/ref/seek/lavf_nut
+++ b/gst-libs/ext/libav/tests/ref/seek/lavf-nut
diff --git a/gst-libs/ext/libav/tests/ref/seek/lavf_ogg b/gst-libs/ext/libav/tests/ref/seek/lavf-ogg
index ea8eb8b..ea8eb8b 100644
--- a/gst-libs/ext/libav/tests/ref/seek/lavf_ogg
+++ b/gst-libs/ext/libav/tests/ref/seek/lavf-ogg
diff --git a/gst-libs/ext/libav/tests/ref/seek/pbmpipe_pbm b/gst-libs/ext/libav/tests/ref/seek/lavf-pbmpipe
index 2858934..2858934 100644
--- a/gst-libs/ext/libav/tests/ref/seek/pbmpipe_pbm
+++ b/gst-libs/ext/libav/tests/ref/seek/lavf-pbmpipe
diff --git a/gst-libs/ext/libav/tests/ref/seek/image_pcx b/gst-libs/ext/libav/tests/ref/seek/lavf-pcx
index 418674f..418674f 100644
--- a/gst-libs/ext/libav/tests/ref/seek/image_pcx
+++ b/gst-libs/ext/libav/tests/ref/seek/lavf-pcx
diff --git a/gst-libs/ext/libav/tests/ref/seek/image_pgm b/gst-libs/ext/libav/tests/ref/seek/lavf-pgm
index 2836367..2836367 100644
--- a/gst-libs/ext/libav/tests/ref/seek/image_pgm
+++ b/gst-libs/ext/libav/tests/ref/seek/lavf-pgm
diff --git a/gst-libs/ext/libav/tests/ref/seek/pgmpipe_pgm b/gst-libs/ext/libav/tests/ref/seek/lavf-pgmpipe
index 8ba5180..8ba5180 100644
--- a/gst-libs/ext/libav/tests/ref/seek/pgmpipe_pgm
+++ b/gst-libs/ext/libav/tests/ref/seek/lavf-pgmpipe
diff --git a/gst-libs/ext/libav/tests/ref/seek/image_ppm b/gst-libs/ext/libav/tests/ref/seek/lavf-ppm
index 6376b5e..6376b5e 100644
--- a/gst-libs/ext/libav/tests/ref/seek/image_ppm
+++ b/gst-libs/ext/libav/tests/ref/seek/lavf-ppm
diff --git a/gst-libs/ext/libav/tests/ref/seek/ppmpipe_ppm b/gst-libs/ext/libav/tests/ref/seek/lavf-ppmpipe
index 46c535a..46c535a 100644
--- a/gst-libs/ext/libav/tests/ref/seek/ppmpipe_ppm
+++ b/gst-libs/ext/libav/tests/ref/seek/lavf-ppmpipe
diff --git a/gst-libs/ext/libav/tests/ref/seek/lavf-rm b/gst-libs/ext/libav/tests/ref/seek/lavf-rm
new file mode 100644
index 0000000..adce9e0
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/seek/lavf-rm
@@ -0,0 +1,53 @@
+ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 387 size: 278
+ret: 0 st:-1 flags:0 ts:-1.000000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 688 size: 31082
+ret: 0 st:-1 flags:1 ts: 1.894167
+ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 314982 size: 31143
+ret: 0 st: 0 flags:0 ts: 0.788000
+ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 314982 size: 31143
+ret: 0 st: 0 flags:1 ts:-0.317000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 688 size: 31082
+ret: 0 st: 1 flags:0 ts: 2.577000
+ret: 0 st: 1 flags:1 dts: 0.975000 pts: 0.975000 pos: 346128 size: 278
+ret: 0 st: 1 flags:1 ts: 1.471000
+ret: 0 st: 1 flags:1 dts: 0.975000 pts: 0.975000 pos: 346128 size: 278
+ret: 0 st:-1 flags:0 ts: 0.365002
+ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 158515 size: 31134
+ret: 0 st:-1 flags:1 ts:-0.740831
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 688 size: 31082
+ret: 0 st: 0 flags:0 ts: 2.153000
+ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 314982 size: 31143
+ret: 0 st: 0 flags:1 ts: 1.048000
+ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 314982 size: 31143
+ret: 0 st: 1 flags:0 ts:-0.058000
+ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 387 size: 278
+ret: 0 st: 1 flags:1 ts: 2.836000
+ret: 0 st: 1 flags:1 dts: 0.975000 pts: 0.975000 pos: 346128 size: 278
+ret: 0 st:-1 flags:0 ts: 1.730004
+ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 314982 size: 31143
+ret: 0 st:-1 flags:1 ts: 0.624171
+ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 158515 size: 31134
+ret: 0 st: 0 flags:0 ts:-0.482000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 688 size: 31082
+ret: 0 st: 0 flags:1 ts: 2.413000
+ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 314982 size: 31143
+ret: 0 st: 1 flags:0 ts: 1.307000
+ret: 0 st: 1 flags:1 dts: 0.975000 pts: 0.975000 pos: 346128 size: 278
+ret: 0 st: 1 flags:1 ts: 0.201000
+ret: 0 st: 1 flags:1 dts: 0.174000 pts: 0.174000 pos: 78969 size: 278
+ret: 0 st:-1 flags:0 ts:-0.904994
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 688 size: 31082
+ret: 0 st:-1 flags:1 ts: 1.989173
+ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 314982 size: 31143
+ret: 0 st: 0 flags:0 ts: 0.883000
+ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 314982 size: 31143
+ret: 0 st: 0 flags:1 ts:-0.222000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 688 size: 31082
+ret: 0 st: 1 flags:0 ts: 2.672000
+ret: 0 st: 1 flags:1 dts: 0.975000 pts: 0.975000 pos: 346128 size: 278
+ret: 0 st: 1 flags:1 ts: 1.566000
+ret: 0 st: 1 flags:1 dts: 0.975000 pts: 0.975000 pos: 346128 size: 278
+ret: 0 st:-1 flags:0 ts: 0.460008
+ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 158515 size: 31134
+ret: 0 st:-1 flags:1 ts:-0.645825
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 688 size: 31082
diff --git a/gst-libs/ext/libav/tests/ref/seek/image_sgi b/gst-libs/ext/libav/tests/ref/seek/lavf-sgi
index b2f605a..b2f605a 100644
--- a/gst-libs/ext/libav/tests/ref/seek/image_sgi
+++ b/gst-libs/ext/libav/tests/ref/seek/lavf-sgi
diff --git a/gst-libs/ext/libav/tests/ref/seek/lavf_swf b/gst-libs/ext/libav/tests/ref/seek/lavf-swf
index 52cd1e2..52cd1e2 100644
--- a/gst-libs/ext/libav/tests/ref/seek/lavf_swf
+++ b/gst-libs/ext/libav/tests/ref/seek/lavf-swf
diff --git a/gst-libs/ext/libav/tests/ref/seek/image_tga b/gst-libs/ext/libav/tests/ref/seek/lavf-tga
index 8f90753..8f90753 100644
--- a/gst-libs/ext/libav/tests/ref/seek/image_tga
+++ b/gst-libs/ext/libav/tests/ref/seek/lavf-tga
diff --git a/gst-libs/ext/libav/tests/ref/seek/image_tiff b/gst-libs/ext/libav/tests/ref/seek/lavf-tiff
index 1b49f2f..1b49f2f 100644
--- a/gst-libs/ext/libav/tests/ref/seek/image_tiff
+++ b/gst-libs/ext/libav/tests/ref/seek/lavf-tiff
diff --git a/gst-libs/ext/libav/tests/ref/seek/lavf-ts b/gst-libs/ext/libav/tests/ref/seek/lavf-ts
new file mode 100644
index 0000000..81093b7
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/seek/lavf-ts
@@ -0,0 +1,53 @@
+ret: 0 st: 0 flags:1 dts: 1.360000 pts: 1.400000 pos: 564 size: 24801
+ret: 0 st:-1 flags:0 ts:-1.000000
+ret: 0 st: 0 flags:0 dts: 1.440000 pts: 1.480000 pos: 44932 size: 14502
+ret: 0 st:-1 flags:1 ts: 1.894167
+ret: 0 st: 1 flags:1 dts: 2.120522 pts: 2.120522 pos: 403636 size: 209
+ret: 0 st: 0 flags:0 ts: 0.788333
+ret: 0 st: 0 flags:0 dts: 1.520000 pts: 1.560000 pos: 74260 size: 13388
+ret: 0 st: 0 flags:1 ts:-0.317500
+ret: 0 st: 0 flags:1 dts: 1.360000 pts: 1.400000 pos: 564 size: 24801
+ret: 0 st: 1 flags:0 ts: 2.576667
+ret: 0 st: 1 flags:1 dts: 2.120522 pts: 2.120522 pos: 403636 size: 209
+ret: 0 st: 1 flags:1 ts: 1.470833
+ret: 0 st: 0 flags:0 dts: 2.160000 pts: 2.200000 pos: 325240 size: 12679
+ret: 0 st:-1 flags:0 ts: 0.365002
+ret: 0 st: 0 flags:0 dts: 1.440000 pts: 1.480000 pos: 44932 size: 14502
+ret: 0 st:-1 flags:1 ts:-0.740831
+ret: 0 st: 0 flags:1 dts: 1.360000 pts: 1.400000 pos: 564 size: 24801
+ret: 0 st: 0 flags:0 ts: 2.153333
+ret: 0 st: 1 flags:1 dts: 2.120522 pts: 2.120522 pos: 403636 size: 209
+ret: 0 st: 0 flags:1 ts: 1.047500
+ret: 0 st: 0 flags:0 dts: 1.680000 pts: 1.720000 pos: 130096 size: 14133
+ret: 0 st: 1 flags:0 ts:-0.058333
+ret: 0 st: 0 flags:0 dts: 1.440000 pts: 1.480000 pos: 44932 size: 14502
+ret: 0 st: 1 flags:1 ts: 2.835833
+ret: 0 st: 1 flags:1 dts: 2.120522 pts: 2.120522 pos: 403636 size: 209
+ret: 0 st:-1 flags:0 ts: 1.730004
+ret: 0 st: 1 flags:1 dts: 2.120522 pts: 2.120522 pos: 403636 size: 209
+ret: 0 st:-1 flags:1 ts: 0.624171
+ret: 0 st: 0 flags:1 dts: 1.360000 pts: 1.400000 pos: 564 size: 24801
+ret: 0 st: 0 flags:0 ts:-0.481667
+ret: 0 st: 0 flags:0 dts: 1.440000 pts: 1.480000 pos: 44932 size: 14502
+ret: 0 st: 0 flags:1 ts: 2.412500
+ret: 0 st: 1 flags:1 dts: 2.120522 pts: 2.120522 pos: 403636 size: 209
+ret: 0 st: 1 flags:0 ts: 1.306667
+ret: 0 st: 0 flags:0 dts: 2.080000 pts: 2.120000 pos: 294032 size: 13839
+ret: 0 st: 1 flags:1 ts: 0.200844
+ret: 0 st: 0 flags:1 dts: 1.360000 pts: 1.400000 pos: 564 size: 24801
+ret: 0 st:-1 flags:0 ts:-0.904994
+ret: 0 st: 0 flags:0 dts: 1.440000 pts: 1.480000 pos: 44932 size: 14502
+ret: 0 st:-1 flags:1 ts: 1.989173
+ret: 0 st: 1 flags:1 dts: 2.120522 pts: 2.120522 pos: 403636 size: 209
+ret: 0 st: 0 flags:0 ts: 0.883344
+ret: 0 st: 0 flags:0 dts: 1.600000 pts: 1.640000 pos: 102836 size: 12781
+ret: 0 st: 0 flags:1 ts:-0.222489
+ret: 0 st: 0 flags:1 dts: 1.360000 pts: 1.400000 pos: 564 size: 24801
+ret: 0 st: 1 flags:0 ts: 2.671678
+ret: 0 st: 1 flags:1 dts: 2.120522 pts: 2.120522 pos: 403636 size: 209
+ret: 0 st: 1 flags:1 ts: 1.565844
+ret: 0 st: 0 flags:0 dts: 2.240000 pts: 2.280000 pos: 350996 size: 11307
+ret: 0 st:-1 flags:0 ts: 0.460008
+ret: 0 st: 0 flags:0 dts: 1.440000 pts: 1.480000 pos: 44932 size: 14502
+ret: 0 st:-1 flags:1 ts:-0.645825
+ret: 0 st: 0 flags:1 dts: 1.360000 pts: 1.400000 pos: 564 size: 24801
diff --git a/gst-libs/ext/libav/tests/ref/seek/lavf-voc b/gst-libs/ext/libav/tests/ref/seek/lavf-voc
new file mode 100644
index 0000000..387aef6
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/seek/lavf-voc
@@ -0,0 +1,27 @@
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 32 size: 1024
+ret:-1 st:-1 flags:0 ts:-1.000000
+ret:-1 st:-1 flags:1 ts: 1.894167
+ret:-1 st: 0 flags:0 ts: 0.788335
+ret:-1 st: 0 flags:1 ts:-0.317508
+ret:-1 st:-1 flags:0 ts: 2.576668
+ret:-1 st:-1 flags:1 ts: 1.470835
+ret:-1 st: 0 flags:0 ts: 0.365006
+ret:-1 st: 0 flags:1 ts:-0.740837
+ret:-1 st:-1 flags:0 ts: 2.153336
+ret:-1 st:-1 flags:1 ts: 1.047503
+ret:-1 st: 0 flags:0 ts:-0.058323
+ret:-1 st: 0 flags:1 ts: 2.835834
+ret:-1 st:-1 flags:0 ts: 1.730004
+ret:-1 st:-1 flags:1 ts: 0.624171
+ret:-1 st: 0 flags:0 ts:-0.481652
+ret:-1 st: 0 flags:1 ts: 2.412505
+ret:-1 st:-1 flags:0 ts: 1.306672
+ret:-1 st:-1 flags:1 ts: 0.200839
+ret:-1 st: 0 flags:0 ts:-0.905003
+ret:-1 st: 0 flags:1 ts: 1.989176
+ret:-1 st:-1 flags:0 ts: 0.883340
+ret:-1 st:-1 flags:1 ts:-0.222493
+ret:-1 st: 0 flags:0 ts: 2.671668
+ret:-1 st: 0 flags:1 ts: 1.565847
+ret:-1 st:-1 flags:0 ts: 0.460008
+ret:-1 st:-1 flags:1 ts:-0.645825
diff --git a/gst-libs/ext/libav/tests/ref/seek/lavf_wav b/gst-libs/ext/libav/tests/ref/seek/lavf-wav
index 1a9cfc5..1a9cfc5 100644
--- a/gst-libs/ext/libav/tests/ref/seek/lavf_wav
+++ b/gst-libs/ext/libav/tests/ref/seek/lavf-wav
diff --git a/gst-libs/ext/libav/tests/ref/seek/lavf_y4m b/gst-libs/ext/libav/tests/ref/seek/lavf-yuv4mpeg
index 81c1de9..81c1de9 100644
--- a/gst-libs/ext/libav/tests/ref/seek/lavf_y4m
+++ b/gst-libs/ext/libav/tests/ref/seek/lavf-yuv4mpeg
diff --git a/gst-libs/ext/libav/tests/ref/seek/lavf_asf b/gst-libs/ext/libav/tests/ref/seek/lavf_asf
deleted file mode 100644
index 72c0f56..0000000
--- a/gst-libs/ext/libav/tests/ref/seek/lavf_asf
+++ /dev/null
@@ -1,47 +0,0 @@
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 575 size: 28487
-ret: 0 st:-1 flags:0 ts:-1.000000
-ret: 0 st: 1 flags:1 dts: 0.444000 pts: 0.444000 pos: 147775 size: 209
-ret: 0 st:-1 flags:1 ts: 1.894167
-ret: 0 st: 1 flags:1 dts: 0.940000 pts: 0.940000 pos: 301375 size: 209
-ret: 0 st: 0 flags:0 ts: 0.788000
-ret: 0 st: 1 flags:1 dts: 0.940000 pts: 0.940000 pos: 301375 size: 209
-ret: 0 st: 0 flags:1 ts:-0.317000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 575 size: 28487
-ret:-1 st: 1 flags:0 ts: 2.577000
-ret:-1 st: 1 flags:1 ts: 1.471000
-ret: 0 st:-1 flags:0 ts: 0.365002
-ret: 0 st: 1 flags:1 dts: 0.444000 pts: 0.444000 pos: 147775 size: 209
-ret: 0 st:-1 flags:1 ts:-0.740831
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 575 size: 28487
-ret: 0 st: 0 flags:0 ts: 2.153000
-ret: 0 st: 1 flags:1 dts: 0.940000 pts: 0.940000 pos: 301375 size: 209
-ret: 0 st: 0 flags:1 ts: 1.048000
-ret: 0 st: 1 flags:1 dts: 0.940000 pts: 0.940000 pos: 301375 size: 209
-ret: 0 st: 1 flags:0 ts:-0.058000
-ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 29375 size: 208
-ret:-1 st: 1 flags:1 ts: 2.836000
-ret: 0 st:-1 flags:0 ts: 1.730004
-ret: 0 st: 1 flags:1 dts: 0.940000 pts: 0.940000 pos: 301375 size: 209
-ret: 0 st:-1 flags:1 ts: 0.624171
-ret: 0 st: 1 flags:1 dts: 0.444000 pts: 0.444000 pos: 147775 size: 209
-ret: 0 st: 0 flags:0 ts:-0.482000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 575 size: 28487
-ret: 0 st: 0 flags:1 ts: 2.413000
-ret: 0 st: 1 flags:1 dts: 0.940000 pts: 0.940000 pos: 301375 size: 209
-ret:-1 st: 1 flags:0 ts: 1.307000
-ret: 0 st: 1 flags:1 ts: 0.201000
-ret: 0 st: 1 flags:1 dts: 0.183000 pts: 0.183000 pos: 70975 size: 209
-ret: 0 st:-1 flags:0 ts:-0.904994
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 575 size: 28487
-ret: 0 st:-1 flags:1 ts: 1.989173
-ret: 0 st: 1 flags:1 dts: 0.940000 pts: 0.940000 pos: 301375 size: 209
-ret: 0 st: 0 flags:0 ts: 0.883000
-ret: 0 st: 1 flags:1 dts: 0.940000 pts: 0.940000 pos: 301375 size: 209
-ret: 0 st: 0 flags:1 ts:-0.222000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 575 size: 28487
-ret:-1 st: 1 flags:0 ts: 2.672000
-ret:-1 st: 1 flags:1 ts: 1.566000
-ret: 0 st:-1 flags:0 ts: 0.460008
-ret: 0 st: 1 flags:1 dts: 0.444000 pts: 0.444000 pos: 147775 size: 209
-ret: 0 st:-1 flags:1 ts:-0.645825
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 575 size: 28487
diff --git a/gst-libs/ext/libav/tests/ref/seek/lavf_avi b/gst-libs/ext/libav/tests/ref/seek/lavf_avi
deleted file mode 100644
index 964f0b8..0000000
--- a/gst-libs/ext/libav/tests/ref/seek/lavf_avi
+++ /dev/null
@@ -1,44 +0,0 @@
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 9908 size: 27867
-ret: 0 st:-1 flags:0 ts:-1.000000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 9908 size: 27867
-ret: 0 st:-1 flags:1 ts: 1.894167
-ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 301466 size: 27864
-ret: 0 st: 0 flags:0 ts: 0.800000
-ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 301466 size: 27864
-ret:-1 st: 0 flags:1 ts:-0.320000
-ret:-1 st: 1 flags:0 ts: 2.586122
-ret: 0 st: 1 flags:1 ts: 1.462857
-ret: 0 st: 1 flags:1 dts: 1.018776 pts: 1.018776 pos: 329774 size: 209
-ret: 0 st:-1 flags:0 ts: 0.365002
-ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 156166 size: 27955
-ret:-1 st:-1 flags:1 ts:-0.740831
-ret:-1 st: 0 flags:0 ts: 2.160000
-ret: 0 st: 0 flags:1 ts: 1.040000
-ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 301466 size: 27864
-ret: 0 st: 1 flags:0 ts:-0.052245
-ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 37784 size: 208
-ret: 0 st: 1 flags:1 ts: 2.847347
-ret: 0 st: 1 flags:1 dts: 1.018776 pts: 1.018776 pos: 329774 size: 209
-ret:-1 st:-1 flags:0 ts: 1.730004
-ret: 0 st:-1 flags:1 ts: 0.624171
-ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 156166 size: 27955
-ret: 0 st: 0 flags:0 ts:-0.480000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 9908 size: 27867
-ret: 0 st: 0 flags:1 ts: 2.400000
-ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 301466 size: 27864
-ret:-1 st: 1 flags:0 ts: 1.306122
-ret: 0 st: 1 flags:1 ts: 0.208980
-ret: 0 st: 1 flags:1 dts: 0.208980 pts: 0.208980 pos: 92800 size: 209
-ret: 0 st:-1 flags:0 ts:-0.904994
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 9908 size: 27867
-ret: 0 st:-1 flags:1 ts: 1.989173
-ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 301466 size: 27864
-ret: 0 st: 0 flags:0 ts: 0.880000
-ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 301466 size: 27864
-ret:-1 st: 0 flags:1 ts:-0.240000
-ret:-1 st: 1 flags:0 ts: 2.664490
-ret: 0 st: 1 flags:1 ts: 1.567347
-ret: 0 st: 1 flags:1 dts: 1.018776 pts: 1.018776 pos: 329774 size: 209
-ret: 0 st:-1 flags:0 ts: 0.460008
-ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 156166 size: 27955
-ret:-1 st:-1 flags:1 ts:-0.645825
diff --git a/gst-libs/ext/libav/tests/ref/seek/lavf_ffm b/gst-libs/ext/libav/tests/ref/seek/lavf_ffm
deleted file mode 100644
index 46cf764..0000000
--- a/gst-libs/ext/libav/tests/ref/seek/lavf_ffm
+++ /dev/null
@@ -1,53 +0,0 @@
-ret: 0 st: 0 flags:1 dts:-0.040000 pts: 0.000000 pos: 8192 size: 24664
-ret: 0 st:-1 flags:0 ts:-1.000000
-ret: 0 st: 0 flags:1 dts:-0.040000 pts: 0.000000 pos: 8192 size: 24664
-ret: 0 st:-1 flags:1 ts: 1.894167
-ret: 0 st: 1 flags:1 dts: 0.940408 pts: 0.940408 pos: 376832 size: 209
-ret: 0 st: 0 flags:0 ts: 0.788334
-ret: 0 st: 1 flags:1 dts: 0.783673 pts: 0.783673 pos: 315392 size: 209
-ret: 0 st: 0 flags:1 ts:-0.317499
-ret: 0 st: 0 flags:1 dts:-0.040000 pts: 0.000000 pos: 8192 size: 24664
-ret: 0 st: 1 flags:0 ts: 2.576668
-ret: 0 st: 1 flags:1 dts: 0.940408 pts: 0.940408 pos: 376832 size: 209
-ret: 0 st: 1 flags:1 ts: 1.470835
-ret: 0 st: 1 flags:1 dts: 0.940408 pts: 0.940408 pos: 376832 size: 209
-ret: 0 st:-1 flags:0 ts: 0.365002
-ret: 0 st: 1 flags:1 dts: 0.339592 pts: 0.339592 pos: 155648 size: 209
-ret: 0 st:-1 flags:1 ts:-0.740831
-ret: 0 st: 0 flags:1 dts:-0.040000 pts: 0.000000 pos: 8192 size: 24664
-ret: 0 st: 0 flags:0 ts: 2.153336
-ret: 0 st: 1 flags:1 dts: 0.940408 pts: 0.940408 pos: 376832 size: 209
-ret: 0 st: 0 flags:1 ts: 1.047503
-ret: 0 st: 1 flags:1 dts: 0.940408 pts: 0.940408 pos: 376832 size: 209
-ret: 0 st: 1 flags:0 ts:-0.058330
-ret: 0 st: 0 flags:1 dts:-0.040000 pts: 0.000000 pos: 8192 size: 24664
-ret: 0 st: 1 flags:1 ts: 2.835837
-ret: 0 st: 1 flags:1 dts: 0.940408 pts: 0.940408 pos: 376832 size: 209
-ret: 0 st:-1 flags:0 ts: 1.730004
-ret: 0 st: 1 flags:1 dts: 0.940408 pts: 0.940408 pos: 376832 size: 209
-ret: 0 st:-1 flags:1 ts: 0.624171
-ret: 0 st: 1 flags:1 dts: 0.653061 pts: 0.653061 pos: 274432 size: 209
-ret: 0 st: 0 flags:0 ts:-0.481662
-ret: 0 st: 0 flags:1 dts:-0.040000 pts: 0.000000 pos: 8192 size: 24664
-ret: 0 st: 0 flags:1 ts: 2.412505
-ret: 0 st: 1 flags:1 dts: 0.940408 pts: 0.940408 pos: 376832 size: 209
-ret: 0 st: 1 flags:0 ts: 1.306672
-ret: 0 st: 1 flags:1 dts: 0.940408 pts: 0.940408 pos: 376832 size: 209
-ret: 0 st: 1 flags:1 ts: 0.200839
-ret: 0 st: 1 flags:1 dts: 0.208980 pts: 0.208980 pos: 114688 size: 209
-ret: 0 st:-1 flags:0 ts:-0.904994
-ret: 0 st: 0 flags:1 dts:-0.040000 pts: 0.000000 pos: 8192 size: 24664
-ret: 0 st:-1 flags:1 ts: 1.989173
-ret: 0 st: 1 flags:1 dts: 0.940408 pts: 0.940408 pos: 376832 size: 209
-ret: 0 st: 0 flags:0 ts: 0.883340
-ret: 0 st: 0 flags:0 dts: 0.880000 pts: 0.920000 pos: 339968 size: 12307
-ret: 0 st: 0 flags:1 ts:-0.222493
-ret: 0 st: 0 flags:1 dts:-0.040000 pts: 0.000000 pos: 8192 size: 24664
-ret: 0 st: 1 flags:0 ts: 2.671674
-ret: 0 st: 1 flags:1 dts: 0.940408 pts: 0.940408 pos: 376832 size: 209
-ret: 0 st: 1 flags:1 ts: 1.565841
-ret: 0 st: 1 flags:1 dts: 0.940408 pts: 0.940408 pos: 376832 size: 209
-ret: 0 st:-1 flags:0 ts: 0.460008
-ret: 0 st: 1 flags:1 dts: 0.444082 pts: 0.444082 pos: 204800 size: 209
-ret: 0 st:-1 flags:1 ts:-0.645825
-ret: 0 st: 0 flags:1 dts:-0.040000 pts: 0.000000 pos: 8192 size: 24664
diff --git a/gst-libs/ext/libav/tests/ref/seek/lavf_mkv b/gst-libs/ext/libav/tests/ref/seek/lavf_mkv
deleted file mode 100644
index 9f447b3..0000000
--- a/gst-libs/ext/libav/tests/ref/seek/lavf_mkv
+++ /dev/null
@@ -1,53 +0,0 @@
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 513 size: 27837
-ret: 0 st:-1 flags:0 ts:-1.000000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 513 size: 27837
-ret: 0 st:-1 flags:1 ts: 1.894167
-ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 291934 size: 27834
-ret: 0 st: 0 flags:0 ts: 0.788000
-ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 291934 size: 27834
-ret: 0 st: 0 flags:1 ts:-0.317000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 513 size: 27837
-ret: 0 st: 1 flags:0 ts: 2.577000
-ret:-EOF
-ret: 0 st: 1 flags:1 ts: 1.471000
-ret: 0 st: 1 flags:1 dts: 1.019000 pts: 1.019000 pos: 320207 size: 209
-ret: 0 st:-1 flags:0 ts: 0.365002
-ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 146703 size: 27925
-ret: 0 st:-1 flags:1 ts:-0.740831
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 513 size: 27837
-ret: 0 st: 0 flags:0 ts: 2.153000
-ret:-EOF
-ret: 0 st: 0 flags:1 ts: 1.048000
-ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 291934 size: 27834
-ret: 0 st: 1 flags:0 ts:-0.058000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 513 size: 27837
-ret: 0 st: 1 flags:1 ts: 2.836000
-ret: 0 st: 1 flags:1 dts: 1.019000 pts: 1.019000 pos: 320207 size: 209
-ret: 0 st:-1 flags:0 ts: 1.730004
-ret:-EOF
-ret: 0 st:-1 flags:1 ts: 0.624171
-ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 146703 size: 27925
-ret: 0 st: 0 flags:0 ts:-0.482000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 513 size: 27837
-ret: 0 st: 0 flags:1 ts: 2.413000
-ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 291934 size: 27834
-ret: 0 st: 1 flags:0 ts: 1.307000
-ret:-EOF
-ret: 0 st: 1 flags:1 ts: 0.201000
-ret: 0 st: 1 flags:1 dts: 0.183000 pts: 0.183000 pos: 72083 size: 209
-ret: 0 st:-1 flags:0 ts:-0.904994
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 513 size: 27837
-ret: 0 st:-1 flags:1 ts: 1.989173
-ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 291934 size: 27834
-ret: 0 st: 0 flags:0 ts: 0.883000
-ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 291934 size: 27834
-ret: 0 st: 0 flags:1 ts:-0.222000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 513 size: 27837
-ret: 0 st: 1 flags:0 ts: 2.672000
-ret:-EOF
-ret: 0 st: 1 flags:1 ts: 1.566000
-ret: 0 st: 1 flags:1 dts: 1.019000 pts: 1.019000 pos: 320207 size: 209
-ret: 0 st:-1 flags:0 ts: 0.460008
-ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 146703 size: 27925
-ret: 0 st:-1 flags:1 ts:-0.645825
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 513 size: 27837
diff --git a/gst-libs/ext/libav/tests/ref/seek/lavf_mpg b/gst-libs/ext/libav/tests/ref/seek/lavf_mpg
deleted file mode 100644
index dc51195..0000000
--- a/gst-libs/ext/libav/tests/ref/seek/lavf_mpg
+++ /dev/null
@@ -1,53 +0,0 @@
-ret: 0 st: 1 flags:1 dts: 1.000000 pts: 1.000000 pos: 2048 size: 208
-ret: 0 st:-1 flags:0 ts:-1.000000
-ret: 0 st: 1 flags:1 dts: 1.000000 pts: 1.000000 pos: 2048 size: 208
-ret: 0 st:-1 flags:1 ts: 1.894167
-ret: 0 st: 0 flags:0 dts: 1.880000 pts: 1.920000 pos: 327680 size: 12894
-ret: 0 st: 0 flags:0 ts: 0.788333
-ret: 0 st: 1 flags:1 dts: 1.000000 pts: 1.000000 pos: 2048 size: 208
-ret: 0 st: 0 flags:1 ts:-0.317500
-ret: 0 st: 1 flags:1 dts: 1.000000 pts: 1.000000 pos: 2048 size: 208
-ret: 0 st: 1 flags:0 ts: 2.576667
-ret: 0 st: 1 flags:1 dts: 2.018778 pts: 2.018778 pos: 370700 size: 235
-ret: 0 st: 1 flags:1 ts: 1.470833
-ret: 0 st: 1 flags:1 dts: 1.261222 pts: 1.261222 pos: 145408 size: 261
-ret: 0 st:-1 flags:0 ts: 0.365002
-ret: 0 st: 1 flags:1 dts: 1.000000 pts: 1.000000 pos: 2048 size: 208
-ret: 0 st:-1 flags:1 ts:-0.740831
-ret: 0 st: 1 flags:1 dts: 1.000000 pts: 1.000000 pos: 2048 size: 208
-ret: 0 st: 0 flags:0 ts: 2.153333
-ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.960000 pos: 339968 size: 681
-ret: 0 st: 0 flags:1 ts: 1.047500
-ret: 0 st: 0 flags:0 dts: 1.040000 pts: 1.080000 pos: 40960 size: 16073
-ret: 0 st: 1 flags:0 ts:-0.058333
-ret: 0 st: 1 flags:1 dts: 1.000000 pts: 1.000000 pos: 2048 size: 208
-ret: 0 st: 1 flags:1 ts: 2.835833
-ret: 0 st: 1 flags:1 dts: 2.018778 pts: 2.018778 pos: 370700 size: 235
-ret: 0 st:-1 flags:0 ts: 1.730004
-ret: 0 st: 0 flags:0 dts: 1.760000 pts: 1.800000 pos: 292864 size: 13170
-ret: 0 st:-1 flags:1 ts: 0.624171
-ret: 0 st: 1 flags:1 dts: 1.000000 pts: 1.000000 pos: 2048 size: 208
-ret: 0 st: 0 flags:0 ts:-0.481667
-ret: 0 st: 1 flags:1 dts: 1.000000 pts: 1.000000 pos: 2048 size: 208
-ret: 0 st: 0 flags:1 ts: 2.412500
-ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.960000 pos: 339968 size: 681
-ret: 0 st: 1 flags:0 ts: 1.306667
-ret: 0 st: 1 flags:1 dts: 1.522444 pts: 1.522444 pos: 342028 size: 314
-ret: 0 st: 1 flags:1 ts: 0.200844
-ret: 0 st: 1 flags:1 dts: 1.000000 pts: 1.000000 pos: 2048 size: 208
-ret: 0 st:-1 flags:0 ts:-0.904994
-ret: 0 st: 1 flags:1 dts: 1.000000 pts: 1.000000 pos: 2048 size: 208
-ret: 0 st:-1 flags:1 ts: 1.989173
-ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.960000 pos: 339968 size: 681
-ret: 0 st: 0 flags:0 ts: 0.883344
-ret: 0 st: 1 flags:1 dts: 1.000000 pts: 1.000000 pos: 2048 size: 208
-ret: 0 st: 0 flags:1 ts:-0.222489
-ret: 0 st: 1 flags:1 dts: 1.000000 pts: 1.000000 pos: 2048 size: 208
-ret: 0 st: 1 flags:0 ts: 2.671678
-ret: 0 st: 1 flags:1 dts: 2.018778 pts: 2.018778 pos: 370700 size: 235
-ret: 0 st: 1 flags:1 ts: 1.565844
-ret: 0 st: 1 flags:1 dts: 1.522444 pts: 1.522444 pos: 342028 size: 314
-ret: 0 st:-1 flags:0 ts: 0.460008
-ret: 0 st: 1 flags:1 dts: 1.000000 pts: 1.000000 pos: 2048 size: 208
-ret: 0 st:-1 flags:1 ts:-0.645825
-ret: 0 st: 1 flags:1 dts: 1.000000 pts: 1.000000 pos: 2048 size: 208
diff --git a/gst-libs/ext/libav/tests/ref/seek/lavf_mxf b/gst-libs/ext/libav/tests/ref/seek/lavf_mxf
deleted file mode 100644
index 4c1aecc..0000000
--- a/gst-libs/ext/libav/tests/ref/seek/lavf_mxf
+++ /dev/null
@@ -1,53 +0,0 @@
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 6144 size: 24801
-ret: 0 st:-1 flags:0 ts:-1.000000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 6144 size: 24801
-ret: 0 st:-1 flags:1 ts: 1.894167
-ret:-1
-ret: 0 st: 0 flags:0 ts: 0.800000
-ret:-1
-ret: 0 st: 0 flags:1 ts:-0.320000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 6144 size: 24801
-ret: 0 st: 1 flags:0 ts: 2.560000
-ret:-1
-ret: 0 st: 1 flags:1 ts: 1.480000
-ret:-1
-ret: 0 st:-1 flags:0 ts: 0.365002
-ret: 0 st: 0 flags:1 dts: 0.360000 pts: NOPTS pos: 6144 size: 24801
-ret: 0 st:-1 flags:1 ts:-0.740831
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 6144 size: 24801
-ret: 0 st: 0 flags:0 ts: 2.160000
-ret:-1
-ret: 0 st: 0 flags:1 ts: 1.040000
-ret:-1
-ret: 0 st: 1 flags:0 ts:-0.040000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 6144 size: 24801
-ret: 0 st: 1 flags:1 ts: 2.840000
-ret:-1
-ret: 0 st:-1 flags:0 ts: 1.730004
-ret:-1
-ret: 0 st:-1 flags:1 ts: 0.624171
-ret:-1
-ret: 0 st: 0 flags:0 ts:-0.480000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 6144 size: 24801
-ret: 0 st: 0 flags:1 ts: 2.400000
-ret:-1
-ret: 0 st: 1 flags:0 ts: 1.320000
-ret:-1
-ret: 0 st: 1 flags:1 ts: 0.200000
-ret: 0 st: 0 flags:1 dts: 0.200000 pts: NOPTS pos: 6144 size: 24801
-ret: 0 st:-1 flags:0 ts:-0.904994
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 6144 size: 24801
-ret: 0 st:-1 flags:1 ts: 1.989173
-ret:-1
-ret: 0 st: 0 flags:0 ts: 0.880000
-ret:-1
-ret: 0 st: 0 flags:1 ts:-0.240000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 6144 size: 24801
-ret: 0 st: 1 flags:0 ts: 2.680000
-ret:-1
-ret: 0 st: 1 flags:1 ts: 1.560000
-ret:-1
-ret: 0 st:-1 flags:0 ts: 0.460008
-ret: 0 st: 0 flags:1 dts: 0.480000 pts: NOPTS pos: 6144 size: 24801
-ret: 0 st:-1 flags:1 ts:-0.645825
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 6144 size: 24801
diff --git a/gst-libs/ext/libav/tests/ref/seek/lavf_mxf_d10 b/gst-libs/ext/libav/tests/ref/seek/lavf_mxf_d10
deleted file mode 100644
index c05870f..0000000
--- a/gst-libs/ext/libav/tests/ref/seek/lavf_mxf_d10
+++ /dev/null
@@ -1,53 +0,0 @@
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 6144 size:150000
-ret: 0 st:-1 flags:0 ts:-1.000000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 6144 size:150000
-ret: 0 st:-1 flags:1 ts: 1.894167
-ret:-1
-ret: 0 st: 0 flags:0 ts: 0.800000
-ret:-1
-ret: 0 st: 0 flags:1 ts:-0.320000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 6144 size:150000
-ret: 0 st: 1 flags:0 ts: 2.560000
-ret:-1
-ret: 0 st: 1 flags:1 ts: 1.480000
-ret:-1
-ret: 0 st:-1 flags:0 ts: 0.365002
-ret: 0 st: 0 flags:1 dts: 0.360000 pts: 0.360000 pos: 6144 size:150000
-ret: 0 st:-1 flags:1 ts:-0.740831
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 6144 size:150000
-ret: 0 st: 0 flags:0 ts: 2.160000
-ret:-1
-ret: 0 st: 0 flags:1 ts: 1.040000
-ret:-1
-ret: 0 st: 1 flags:0 ts:-0.040000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 6144 size:150000
-ret: 0 st: 1 flags:1 ts: 2.840000
-ret:-1
-ret: 0 st:-1 flags:0 ts: 1.730004
-ret:-1
-ret: 0 st:-1 flags:1 ts: 0.624171
-ret:-1
-ret: 0 st: 0 flags:0 ts:-0.480000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 6144 size:150000
-ret: 0 st: 0 flags:1 ts: 2.400000
-ret:-1
-ret: 0 st: 1 flags:0 ts: 1.320000
-ret:-1
-ret: 0 st: 1 flags:1 ts: 0.200000
-ret: 0 st: 0 flags:1 dts: 0.200000 pts: 0.200000 pos: 6144 size:150000
-ret: 0 st:-1 flags:0 ts:-0.904994
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 6144 size:150000
-ret: 0 st:-1 flags:1 ts: 1.989173
-ret:-1
-ret: 0 st: 0 flags:0 ts: 0.880000
-ret:-1
-ret: 0 st: 0 flags:1 ts:-0.240000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 6144 size:150000
-ret: 0 st: 1 flags:0 ts: 2.680000
-ret:-1
-ret: 0 st: 1 flags:1 ts: 1.560000
-ret:-1
-ret: 0 st:-1 flags:0 ts: 0.460008
-ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 6144 size:150000
-ret: 0 st:-1 flags:1 ts:-0.645825
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 6144 size:150000
diff --git a/gst-libs/ext/libav/tests/ref/seek/lavf_rm b/gst-libs/ext/libav/tests/ref/seek/lavf_rm
deleted file mode 100644
index 188367b..0000000
--- a/gst-libs/ext/libav/tests/ref/seek/lavf_rm
+++ /dev/null
@@ -1,47 +0,0 @@
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 398 size: 31082
-ret: 0 st:-1 flags:0 ts:-1.000000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 398 size: 31082
-ret: 0 st:-1 flags:1 ts: 1.894167
-ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 314982 size: 31143
-ret: 0 st: 0 flags:0 ts: 0.788000
-ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 314982 size: 31143
-ret: 0 st: 0 flags:1 ts:-0.317000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 398 size: 31082
-ret:-1 st: 1 flags:0 ts: 2.577000
-ret:-1 st: 1 flags:1 ts: 1.471000
-ret: 0 st:-1 flags:0 ts: 0.365002
-ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 158515 size: 31134
-ret: 0 st:-1 flags:1 ts:-0.740831
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 398 size: 31082
-ret: 0 st: 0 flags:0 ts: 2.153000
-ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 314982 size: 31143
-ret: 0 st: 0 flags:1 ts: 1.048000
-ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 314982 size: 31143
-ret: 0 st: 1 flags:0 ts:-0.058000
-ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 31483 size: 278
-ret:-1 st: 1 flags:1 ts: 2.836000
-ret: 0 st:-1 flags:0 ts: 1.730004
-ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 314982 size: 31143
-ret: 0 st:-1 flags:1 ts: 0.624171
-ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 158515 size: 31134
-ret: 0 st: 0 flags:0 ts:-0.482000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 398 size: 31082
-ret: 0 st: 0 flags:1 ts: 2.413000
-ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 314982 size: 31143
-ret:-1 st: 1 flags:0 ts: 1.307000
-ret: 0 st: 1 flags:1 ts: 0.201000
-ret: 0 st: 1 flags:1 dts: 0.174000 pts: 0.174000 pos: 78969 size: 278
-ret: 0 st:-1 flags:0 ts:-0.904994
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 398 size: 31082
-ret: 0 st:-1 flags:1 ts: 1.989173
-ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 314982 size: 31143
-ret: 0 st: 0 flags:0 ts: 0.883000
-ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 314982 size: 31143
-ret: 0 st: 0 flags:1 ts:-0.222000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 398 size: 31082
-ret:-1 st: 1 flags:0 ts: 2.672000
-ret:-1 st: 1 flags:1 ts: 1.566000
-ret: 0 st:-1 flags:0 ts: 0.460008
-ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 158515 size: 31134
-ret: 0 st:-1 flags:1 ts:-0.645825
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 398 size: 31082
diff --git a/gst-libs/ext/libav/tests/ref/seek/lavf_ts b/gst-libs/ext/libav/tests/ref/seek/lavf_ts
deleted file mode 100644
index 9ed59ef..0000000
--- a/gst-libs/ext/libav/tests/ref/seek/lavf_ts
+++ /dev/null
@@ -1,53 +0,0 @@
-ret: 0 st: 0 flags:1 dts: 1.360000 pts: 1.400000 pos: 564 size: 24801
-ret: 0 st:-1 flags:0 ts:-1.000000
-ret: 0 st: 0 flags:0 dts: 1.440000 pts: 1.480000 pos: 44932 size: 14502
-ret: 0 st:-1 flags:1 ts: 1.894167
-ret: 0 st: 1 flags:1 dts: 2.131433 pts: 2.131433 pos: 403636 size: 209
-ret: 0 st: 0 flags:0 ts: 0.788333
-ret: 0 st: 0 flags:0 dts: 1.520000 pts: 1.560000 pos: 74260 size: 13388
-ret: 0 st: 0 flags:1 ts:-0.317500
-ret: 0 st: 0 flags:1 dts: 1.360000 pts: 1.400000 pos: 564 size: 24801
-ret: 0 st: 1 flags:0 ts: 2.576667
-ret: 0 st: 1 flags:1 dts: 2.131433 pts: 2.131433 pos: 403636 size: 209
-ret: 0 st: 1 flags:1 ts: 1.470833
-ret: 0 st: 0 flags:0 dts: 2.160000 pts: 2.200000 pos: 325240 size: 12679
-ret: 0 st:-1 flags:0 ts: 0.365002
-ret: 0 st: 0 flags:0 dts: 1.440000 pts: 1.480000 pos: 44932 size: 14502
-ret: 0 st:-1 flags:1 ts:-0.740831
-ret: 0 st: 0 flags:1 dts: 1.360000 pts: 1.400000 pos: 564 size: 24801
-ret: 0 st: 0 flags:0 ts: 2.153333
-ret: 0 st: 1 flags:1 dts: 2.131433 pts: 2.131433 pos: 403636 size: 209
-ret: 0 st: 0 flags:1 ts: 1.047500
-ret: 0 st: 0 flags:0 dts: 1.680000 pts: 1.720000 pos: 130096 size: 14133
-ret: 0 st: 1 flags:0 ts:-0.058333
-ret: 0 st: 0 flags:0 dts: 1.440000 pts: 1.480000 pos: 44932 size: 14502
-ret: 0 st: 1 flags:1 ts: 2.835833
-ret: 0 st: 1 flags:1 dts: 2.131433 pts: 2.131433 pos: 403636 size: 209
-ret: 0 st:-1 flags:0 ts: 1.730004
-ret: 0 st: 1 flags:1 dts: 2.131433 pts: 2.131433 pos: 403636 size: 209
-ret: 0 st:-1 flags:1 ts: 0.624171
-ret: 0 st: 0 flags:1 dts: 1.360000 pts: 1.400000 pos: 564 size: 24801
-ret: 0 st: 0 flags:0 ts:-0.481667
-ret: 0 st: 0 flags:0 dts: 1.440000 pts: 1.480000 pos: 44932 size: 14502
-ret: 0 st: 0 flags:1 ts: 2.412500
-ret: 0 st: 1 flags:1 dts: 2.131433 pts: 2.131433 pos: 403636 size: 209
-ret: 0 st: 1 flags:0 ts: 1.306667
-ret: 0 st: 0 flags:0 dts: 2.080000 pts: 2.120000 pos: 294032 size: 13839
-ret: 0 st: 1 flags:1 ts: 0.200844
-ret: 0 st: 0 flags:1 dts: 1.360000 pts: 1.400000 pos: 564 size: 24801
-ret: 0 st:-1 flags:0 ts:-0.904994
-ret: 0 st: 0 flags:0 dts: 1.440000 pts: 1.480000 pos: 44932 size: 14502
-ret: 0 st:-1 flags:1 ts: 1.989173
-ret: 0 st: 1 flags:1 dts: 2.131433 pts: 2.131433 pos: 403636 size: 209
-ret: 0 st: 0 flags:0 ts: 0.883344
-ret: 0 st: 0 flags:0 dts: 1.600000 pts: 1.640000 pos: 102836 size: 12781
-ret: 0 st: 0 flags:1 ts:-0.222489
-ret: 0 st: 0 flags:1 dts: 1.360000 pts: 1.400000 pos: 564 size: 24801
-ret: 0 st: 1 flags:0 ts: 2.671678
-ret: 0 st: 1 flags:1 dts: 2.131433 pts: 2.131433 pos: 403636 size: 209
-ret: 0 st: 1 flags:1 ts: 1.565844
-ret: 0 st: 0 flags:0 dts: 2.240000 pts: 2.280000 pos: 350996 size: 11307
-ret: 0 st:-1 flags:0 ts: 0.460008
-ret: 0 st: 0 flags:0 dts: 1.440000 pts: 1.480000 pos: 44932 size: 14502
-ret: 0 st:-1 flags:1 ts:-0.645825
-ret: 0 st: 0 flags:1 dts: 1.360000 pts: 1.400000 pos: 564 size: 24801
diff --git a/gst-libs/ext/libav/tests/ref/seek/lavf_voc b/gst-libs/ext/libav/tests/ref/seek/lavf_voc
deleted file mode 100644
index 5670d1a..0000000
--- a/gst-libs/ext/libav/tests/ref/seek/lavf_voc
+++ /dev/null
@@ -1,27 +0,0 @@
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 32 size: 1024
-ret:-1 st:-1 flags:0 ts:-1.000000
-ret:-1 st:-1 flags:1 ts: 1.894167
-ret:-1 st: 0 flags:0 ts: 0.788333
-ret:-1 st: 0 flags:1 ts:-0.317500
-ret:-1 st:-1 flags:0 ts: 2.576668
-ret:-1 st:-1 flags:1 ts: 1.470835
-ret:-1 st: 0 flags:0 ts: 0.365000
-ret:-1 st: 0 flags:1 ts:-0.740833
-ret:-1 st:-1 flags:0 ts: 2.153336
-ret:-1 st:-1 flags:1 ts: 1.047503
-ret:-1 st: 0 flags:0 ts:-0.058333
-ret:-1 st: 0 flags:1 ts: 2.835833
-ret:-1 st:-1 flags:0 ts: 1.730004
-ret:-1 st:-1 flags:1 ts: 0.624171
-ret:-1 st: 0 flags:0 ts:-0.481667
-ret:-1 st: 0 flags:1 ts: 2.412500
-ret:-1 st:-1 flags:0 ts: 1.306672
-ret:-1 st:-1 flags:1 ts: 0.200839
-ret:-1 st: 0 flags:0 ts:-0.904989
-ret:-1 st: 0 flags:1 ts: 1.989178
-ret:-1 st:-1 flags:0 ts: 0.883340
-ret:-1 st:-1 flags:1 ts:-0.222493
-ret:-1 st: 0 flags:0 ts: 2.671678
-ret:-1 st: 0 flags:1 ts: 1.565844
-ret:-1 st:-1 flags:0 ts: 0.460008
-ret:-1 st:-1 flags:1 ts:-0.645825
diff --git a/gst-libs/ext/libav/tests/ref/seek/ljpeg_avi b/gst-libs/ext/libav/tests/ref/seek/ljpeg_avi
deleted file mode 100644
index 76442fe..0000000
--- a/gst-libs/ext/libav/tests/ref/seek/ljpeg_avi
+++ /dev/null
@@ -1,46 +0,0 @@
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5660 size: 96069
-ret: 0 st:-1 flags:0 ts:-1.000000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5660 size: 96069
-ret: 0 st:-1 flags:1 ts: 1.894167
-ret: 0 st: 0 flags:1 dts: 1.880000 pts: 1.880000 pos:4481876 size: 94870
-ret: 0 st: 0 flags:0 ts: 0.800000
-ret: 0 st: 0 flags:1 dts: 0.800000 pts: 0.800000 pos:1902330 size: 95465
-ret:-1 st: 0 flags:1 ts:-0.320000
-ret:-1 st:-1 flags:0 ts: 2.576668
-ret: 0 st:-1 flags:1 ts: 1.470835
-ret: 0 st: 0 flags:1 dts: 1.480000 pts: 1.480000 pos:3527736 size: 95724
-ret: 0 st: 0 flags:0 ts: 0.360000
-ret: 0 st: 0 flags:1 dts: 0.360000 pts: 0.360000 pos: 854956 size: 94635
-ret:-1 st: 0 flags:1 ts:-0.760000
-ret:-1 st:-1 flags:0 ts: 2.153336
-ret: 0 st:-1 flags:1 ts: 1.047503
-ret: 0 st: 0 flags:1 dts: 1.040000 pts: 1.040000 pos:2475578 size: 95649
-ret: 0 st: 0 flags:0 ts:-0.040000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5660 size: 96069
-ret: 0 st: 0 flags:1 ts: 2.840000
-ret: 0 st: 0 flags:1 dts: 1.960000 pts: 1.960000 pos:4671510 size: 94595
-ret: 0 st:-1 flags:0 ts: 1.730004
-ret: 0 st: 0 flags:1 dts: 1.720000 pts: 1.720000 pos:4101350 size: 95353
-ret: 0 st:-1 flags:1 ts: 0.624171
-ret: 0 st: 0 flags:1 dts: 0.640000 pts: 0.640000 pos:1520296 size: 95410
-ret: 0 st: 0 flags:0 ts:-0.480000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5660 size: 96069
-ret: 0 st: 0 flags:1 ts: 2.400000
-ret: 0 st: 0 flags:1 dts: 1.960000 pts: 1.960000 pos:4671510 size: 94595
-ret: 0 st:-1 flags:0 ts: 1.306672
-ret: 0 st: 0 flags:1 dts: 1.320000 pts: 1.320000 pos:3145126 size: 95587
-ret: 0 st:-1 flags:1 ts: 0.200839
-ret: 0 st: 0 flags:1 dts: 0.200000 pts: 0.200000 pos: 477238 size: 94261
-ret: 0 st: 0 flags:0 ts:-0.920000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5660 size: 96069
-ret: 0 st: 0 flags:1 ts: 2.000000
-ret: 0 st: 0 flags:1 dts: 1.960000 pts: 1.960000 pos:4671510 size: 94595
-ret: 0 st:-1 flags:0 ts: 0.883340
-ret: 0 st: 0 flags:1 dts: 0.880000 pts: 0.880000 pos:2093314 size: 95528
-ret:-1 st:-1 flags:1 ts:-0.222493
-ret:-1 st: 0 flags:0 ts: 2.680000
-ret: 0 st: 0 flags:1 ts: 1.560000
-ret: 0 st: 0 flags:1 dts: 1.560000 pts: 1.560000 pos:3719138 size: 95615
-ret: 0 st:-1 flags:0 ts: 0.460008
-ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos:1139250 size: 95032
-ret:-1 st:-1 flags:1 ts:-0.645825
diff --git a/gst-libs/ext/libav/tests/ref/seek/mjpeg_avi b/gst-libs/ext/libav/tests/ref/seek/mjpeg_avi
deleted file mode 100644
index b0f975b..0000000
--- a/gst-libs/ext/libav/tests/ref/seek/mjpeg_avi
+++ /dev/null
@@ -1,46 +0,0 @@
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5660 size: 12096
-ret: 0 st:-1 flags:0 ts:-1.000000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5660 size: 12096
-ret: 0 st:-1 flags:1 ts: 1.894167
-ret: 0 st: 0 flags:1 dts: 1.880000 pts: 1.880000 pos: 627866 size: 14811
-ret: 0 st: 0 flags:0 ts: 0.800000
-ret: 0 st: 0 flags:1 dts: 0.800000 pts: 0.800000 pos: 247500 size: 12959
-ret:-1 st: 0 flags:1 ts:-0.320000
-ret:-1 st:-1 flags:0 ts: 2.576668
-ret: 0 st:-1 flags:1 ts: 1.470835
-ret: 0 st: 0 flags:1 dts: 1.480000 pts: 1.480000 pos: 480770 size: 14528
-ret: 0 st: 0 flags:0 ts: 0.360000
-ret: 0 st: 0 flags:1 dts: 0.360000 pts: 0.360000 pos: 111012 size: 11927
-ret:-1 st: 0 flags:1 ts:-0.760000
-ret:-1 st:-1 flags:0 ts: 2.153336
-ret: 0 st:-1 flags:1 ts: 1.047503
-ret: 0 st: 0 flags:1 dts: 1.040000 pts: 1.040000 pos: 326684 size: 13489
-ret: 0 st: 0 flags:0 ts:-0.040000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5660 size: 12096
-ret: 0 st: 0 flags:1 ts: 2.840000
-ret: 0 st: 0 flags:1 dts: 1.960000 pts: 1.960000 pos: 657534 size: 14881
-ret: 0 st:-1 flags:0 ts: 1.730004
-ret: 0 st: 0 flags:1 dts: 1.720000 pts: 1.720000 pos: 568664 size: 14746
-ret: 0 st:-1 flags:1 ts: 0.624171
-ret: 0 st: 0 flags:1 dts: 0.640000 pts: 0.640000 pos: 196428 size: 12719
-ret: 0 st: 0 flags:0 ts:-0.480000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5660 size: 12096
-ret: 0 st: 0 flags:1 ts: 2.400000
-ret: 0 st: 0 flags:1 dts: 1.960000 pts: 1.960000 pos: 657534 size: 14881
-ret: 0 st:-1 flags:0 ts: 1.306672
-ret: 0 st: 0 flags:1 dts: 1.320000 pts: 1.320000 pos: 423494 size: 14119
-ret: 0 st:-1 flags:1 ts: 0.200839
-ret: 0 st: 0 flags:1 dts: 0.200000 pts: 0.200000 pos: 63872 size: 11714
-ret: 0 st: 0 flags:0 ts:-0.920000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5660 size: 12096
-ret: 0 st: 0 flags:1 ts: 2.000000
-ret: 0 st: 0 flags:1 dts: 1.960000 pts: 1.960000 pos: 657534 size: 14881
-ret: 0 st:-1 flags:0 ts: 0.883340
-ret: 0 st: 0 flags:1 dts: 0.880000 pts: 0.880000 pos: 273520 size: 13131
-ret:-1 st:-1 flags:1 ts:-0.222493
-ret:-1 st: 0 flags:0 ts: 2.680000
-ret: 0 st: 0 flags:1 ts: 1.560000
-ret: 0 st: 0 flags:1 dts: 1.560000 pts: 1.560000 pos: 509938 size: 14597
-ret: 0 st:-1 flags:0 ts: 0.460008
-ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 146970 size: 12168
-ret:-1 st:-1 flags:1 ts:-0.645825
diff --git a/gst-libs/ext/libav/tests/ref/seek/mp2_mp2 b/gst-libs/ext/libav/tests/ref/seek/mp2_mp2
deleted file mode 100644
index 6166cb3..0000000
--- a/gst-libs/ext/libav/tests/ref/seek/mp2_mp2
+++ /dev/null
@@ -1,53 +0,0 @@
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 0 size: 417
-ret: 0 st:-1 flags:0 ts:-1.000000
-ret: 0 st: 0 flags:1 dts: 0.026122 pts: 0.026122 pos: 417 size: 418
-ret: 0 st:-1 flags:1 ts: 1.894167
-ret: 0 st: 0 flags:1 dts: 1.880816 pts: 1.880816 pos: 30093 size: 418
-ret: 0 st: 0 flags:0 ts: 0.788334
-ret: 0 st: 0 flags:1 dts: 0.809796 pts: 0.809796 pos: 12956 size: 418
-ret: 0 st: 0 flags:1 ts:-0.317499
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 0 size: 417
-ret: 0 st:-1 flags:0 ts: 2.576668
-ret: 0 st: 0 flags:1 dts: 2.586122 pts: 2.586122 pos: 41377 size: 418
-ret: 0 st:-1 flags:1 ts: 1.470835
-ret: 0 st: 0 flags:1 dts: 1.462857 pts: 1.462857 pos: 23405 size: 418
-ret: 0 st: 0 flags:0 ts: 0.365002
-ret: 0 st: 0 flags:1 dts: 0.365714 pts: 0.365714 pos: 5851 size: 418
-ret: 0 st: 0 flags:1 ts:-0.740831
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 0 size: 417
-ret: 0 st:-1 flags:0 ts: 2.153336
-ret: 0 st: 0 flags:1 dts: 2.168163 pts: 2.168163 pos: 34690 size: 418
-ret: 0 st:-1 flags:1 ts: 1.047503
-ret: 0 st: 0 flags:1 dts: 1.044898 pts: 1.044898 pos: 16718 size: 418
-ret: 0 st: 0 flags:0 ts:-0.058330
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 0 size: 417
-ret: 0 st: 0 flags:1 ts: 2.835837
-ret: 0 st: 0 flags:1 dts: 2.821224 pts: 2.821224 pos: 45139 size: 418
-ret: 0 st:-1 flags:0 ts: 1.730004
-ret: 0 st: 0 flags:1 dts: 1.750204 pts: 1.750204 pos: 28003 size: 418
-ret: 0 st:-1 flags:1 ts: 0.624171
-ret: 0 st: 0 flags:1 dts: 0.600816 pts: 0.600816 pos: 9613 size: 418
-ret: 0 st: 0 flags:0 ts:-0.481662
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 0 size: 417
-ret: 0 st: 0 flags:1 ts: 2.412505
-ret: 0 st: 0 flags:1 dts: 2.403265 pts: 2.403265 pos: 38452 size: 418
-ret: 0 st:-1 flags:0 ts: 1.306672
-ret: 0 st: 0 flags:1 dts: 1.332245 pts: 1.332245 pos: 21315 size: 418
-ret: 0 st:-1 flags:1 ts: 0.200839
-ret: 0 st: 0 flags:1 dts: 0.182857 pts: 0.182857 pos: 2925 size: 418
-ret: 0 st: 0 flags:0 ts:-0.904994
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 0 size: 417
-ret: 0 st: 0 flags:1 ts: 1.989173
-ret: 0 st: 0 flags:1 dts: 1.985306 pts: 1.985306 pos: 31764 size: 418
-ret: 0 st:-1 flags:0 ts: 0.883340
-ret: 0 st: 0 flags:1 dts: 0.888163 pts: 0.888163 pos: 14210 size: 418
-ret: 0 st:-1 flags:1 ts:-0.222493
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 0 size: 417
-ret: 0 st: 0 flags:0 ts: 2.671674
-ret: 0 st: 0 flags:1 dts: 2.690612 pts: 2.690612 pos: 43049 size: 418
-ret: 0 st: 0 flags:1 ts: 1.565841
-ret: 0 st: 0 flags:1 dts: 1.541224 pts: 1.541224 pos: 24659 size: 418
-ret: 0 st:-1 flags:0 ts: 0.460008
-ret: 0 st: 0 flags:1 dts: 0.470204 pts: 0.470204 pos: 7523 size: 418
-ret: 0 st:-1 flags:1 ts:-0.645825
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 0 size: 417
diff --git a/gst-libs/ext/libav/tests/ref/seek/mpeg1_mpg b/gst-libs/ext/libav/tests/ref/seek/mpeg1_mpg
deleted file mode 100644
index 54f0b16..0000000
--- a/gst-libs/ext/libav/tests/ref/seek/mpeg1_mpg
+++ /dev/null
@@ -1,46 +0,0 @@
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 0 size: 9779
-ret: 0 st:-1 flags:0 ts:-1.000000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 0 size: 9779
-ret: 0 st:-1 flags:1 ts: 1.894167
-ret: 0 st: 0 flags:1 dts: 1.440000 pts: NOPTS pos: 124245 size: 11796
-ret: 0 st: 0 flags:0 ts: 0.788334
-ret: 0 st: 0 flags:1 dts: 0.960000 pts: NOPTS pos: 76694 size: 10792
-ret:-1 st: 0 flags:1 ts:-0.317499
-ret:-1 st:-1 flags:0 ts: 2.576668
-ret: 0 st:-1 flags:1 ts: 1.470835
-ret: 0 st: 0 flags:1 dts: 1.440000 pts: NOPTS pos: 124245 size: 11796
-ret: 0 st: 0 flags:0 ts: 0.365002
-ret: 0 st: 0 flags:1 dts: 0.480000 pts: NOPTS pos: 37721 size: 9873
-ret:-1 st: 0 flags:1 ts:-0.740831
-ret:-1 st:-1 flags:0 ts: 2.153336
-ret: 0 st:-1 flags:1 ts: 1.047503
-ret: 0 st: 0 flags:1 dts: 0.960000 pts: NOPTS pos: 76694 size: 10792
-ret: 0 st: 0 flags:0 ts:-0.058330
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 0 size: 9779
-ret: 0 st: 0 flags:1 ts: 2.835837
-ret: 0 st: 0 flags:1 dts: 1.920000 pts: NOPTS pos: 177089 size: 12057
-ret: 0 st:-1 flags:0 ts: 1.730004
-ret: 0 st: 0 flags:1 dts: 1.920000 pts: NOPTS pos: 177089 size: 12057
-ret: 0 st:-1 flags:1 ts: 0.624171
-ret: 0 st: 0 flags:1 dts: 0.480000 pts: NOPTS pos: 37721 size: 9873
-ret: 0 st: 0 flags:0 ts:-0.481662
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 0 size: 9779
-ret: 0 st: 0 flags:1 ts: 2.412505
-ret: 0 st: 0 flags:1 dts: 1.920000 pts: NOPTS pos: 177089 size: 12057
-ret: 0 st:-1 flags:0 ts: 1.306672
-ret: 0 st: 0 flags:1 dts: 1.440000 pts: NOPTS pos: 124245 size: 11796
-ret: 0 st:-1 flags:1 ts: 0.200839
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 0 size: 9779
-ret: 0 st: 0 flags:0 ts:-0.904994
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 0 size: 9779
-ret: 0 st: 0 flags:1 ts: 1.989173
-ret: 0 st: 0 flags:1 dts: 1.920000 pts: NOPTS pos: 177089 size: 12057
-ret: 0 st:-1 flags:0 ts: 0.883340
-ret: 0 st: 0 flags:1 dts: 0.960000 pts: NOPTS pos: 76694 size: 10792
-ret:-1 st:-1 flags:1 ts:-0.222493
-ret:-1 st: 0 flags:0 ts: 2.671674
-ret: 0 st: 0 flags:1 ts: 1.565841
-ret: 0 st: 0 flags:1 dts: 1.440000 pts: NOPTS pos: 124245 size: 11796
-ret: 0 st:-1 flags:0 ts: 0.460008
-ret: 0 st: 0 flags:1 dts: 0.480000 pts: NOPTS pos: 37721 size: 9873
-ret:-1 st:-1 flags:1 ts:-0.645825
diff --git a/gst-libs/ext/libav/tests/ref/seek/mpeg1b_mpg b/gst-libs/ext/libav/tests/ref/seek/mpeg1b_mpg
deleted file mode 100644
index 4c83997..0000000
--- a/gst-libs/ext/libav/tests/ref/seek/mpeg1b_mpg
+++ /dev/null
@@ -1,46 +0,0 @@
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 0 size: 11817
-ret: 0 st:-1 flags:0 ts:-1.000000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 0 size: 11817
-ret: 0 st:-1 flags:1 ts: 1.894167
-ret: 0 st: 0 flags:1 dts: 1.800000 pts: NOPTS pos: 194420 size: 14837
-ret: 0 st: 0 flags:0 ts: 0.788334
-ret: 0 st: 0 flags:1 dts: 0.840000 pts: NOPTS pos: 80757 size: 13267
-ret:-1 st: 0 flags:1 ts:-0.317499
-ret:-1 st:-1 flags:0 ts: 2.576668
-ret: 0 st:-1 flags:1 ts: 1.470835
-ret: 0 st: 0 flags:1 dts: 1.320000 pts: NOPTS pos: 133899 size: 14470
-ret: 0 st: 0 flags:0 ts: 0.365002
-ret: 0 st: 0 flags:1 dts: 0.840000 pts: NOPTS pos: 80757 size: 13267
-ret:-1 st: 0 flags:1 ts:-0.740831
-ret:-1 st:-1 flags:0 ts: 2.153336
-ret: 0 st:-1 flags:1 ts: 1.047503
-ret: 0 st: 0 flags:1 dts: 0.840000 pts: NOPTS pos: 80757 size: 13267
-ret: 0 st: 0 flags:0 ts:-0.058330
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 0 size: 11817
-ret: 0 st: 0 flags:1 ts: 2.835837
-ret: 0 st: 0 flags:1 dts: 1.800000 pts: NOPTS pos: 194420 size: 14837
-ret: 0 st:-1 flags:0 ts: 1.730004
-ret: 0 st: 0 flags:1 dts: 1.800000 pts: NOPTS pos: 194420 size: 14837
-ret: 0 st:-1 flags:1 ts: 0.624171
-ret: 0 st: 0 flags:1 dts: 0.360000 pts: NOPTS pos: 34797 size: 12009
-ret: 0 st: 0 flags:0 ts:-0.481662
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 0 size: 11817
-ret: 0 st: 0 flags:1 ts: 2.412505
-ret: 0 st: 0 flags:1 dts: 1.800000 pts: NOPTS pos: 194420 size: 14837
-ret: 0 st:-1 flags:0 ts: 1.306672
-ret: 0 st: 0 flags:1 dts: 1.320000 pts: NOPTS pos: 133899 size: 14470
-ret: 0 st:-1 flags:1 ts: 0.200839
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 0 size: 11817
-ret: 0 st: 0 flags:0 ts:-0.904994
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 0 size: 11817
-ret: 0 st: 0 flags:1 ts: 1.989173
-ret: 0 st: 0 flags:1 dts: 1.800000 pts: NOPTS pos: 194420 size: 14837
-ret: 0 st:-1 flags:0 ts: 0.883340
-ret: 0 st: 0 flags:1 dts: 1.320000 pts: NOPTS pos: 133899 size: 14470
-ret:-1 st:-1 flags:1 ts:-0.222493
-ret:-1 st: 0 flags:0 ts: 2.671674
-ret: 0 st: 0 flags:1 ts: 1.565841
-ret: 0 st: 0 flags:1 dts: 1.320000 pts: NOPTS pos: 133899 size: 14470
-ret: 0 st:-1 flags:0 ts: 0.460008
-ret: 0 st: 0 flags:1 dts: 0.840000 pts: NOPTS pos: 80757 size: 13267
-ret:-1 st:-1 flags:1 ts:-0.645825
diff --git a/gst-libs/ext/libav/tests/ref/seek/mpeg2_422_mpg b/gst-libs/ext/libav/tests/ref/seek/mpeg2_422_mpg
deleted file mode 100644
index 3b4e1e7..0000000
--- a/gst-libs/ext/libav/tests/ref/seek/mpeg2_422_mpg
+++ /dev/null
@@ -1,46 +0,0 @@
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 0 size: 17497
-ret: 0 st:-1 flags:0 ts:-1.000000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 0 size: 17497
-ret: 0 st:-1 flags:1 ts: 1.894167
-ret: 0 st: 0 flags:1 dts: 1.840000 pts: NOPTS pos: 325162 size: 19936
-ret: 0 st: 0 flags:0 ts: 0.788334
-ret: 0 st: 0 flags:1 dts: 0.880000 pts: NOPTS pos: 200736 size: 22575
-ret:-1 st: 0 flags:1 ts:-0.317499
-ret:-1 st:-1 flags:0 ts: 2.576668
-ret: 0 st:-1 flags:1 ts: 1.470835
-ret: 0 st: 0 flags:1 dts: 1.360000 pts: NOPTS pos: 265477 size: 21329
-ret: 0 st: 0 flags:0 ts: 0.365002
-ret: 0 st: 0 flags:1 dts: 0.400000 pts: NOPTS pos: 104454 size: 28984
-ret:-1 st: 0 flags:1 ts:-0.740831
-ret:-1 st:-1 flags:0 ts: 2.153336
-ret: 0 st:-1 flags:1 ts: 1.047503
-ret: 0 st: 0 flags:1 dts: 0.880000 pts: NOPTS pos: 200736 size: 22575
-ret: 0 st: 0 flags:0 ts:-0.058330
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 0 size: 17497
-ret: 0 st: 0 flags:1 ts: 2.835837
-ret: 0 st: 0 flags:1 dts: 1.840000 pts: NOPTS pos: 325162 size: 19936
-ret: 0 st:-1 flags:0 ts: 1.730004
-ret: 0 st: 0 flags:1 dts: 1.840000 pts: NOPTS pos: 325162 size: 19936
-ret: 0 st:-1 flags:1 ts: 0.624171
-ret: 0 st: 0 flags:1 dts: 0.400000 pts: NOPTS pos: 104454 size: 28984
-ret: 0 st: 0 flags:0 ts:-0.481662
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 0 size: 17497
-ret: 0 st: 0 flags:1 ts: 2.412505
-ret: 0 st: 0 flags:1 dts: 1.840000 pts: NOPTS pos: 325162 size: 19936
-ret: 0 st:-1 flags:0 ts: 1.306672
-ret: 0 st: 0 flags:1 dts: 1.360000 pts: NOPTS pos: 265477 size: 21329
-ret: 0 st:-1 flags:1 ts: 0.200839
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 0 size: 17497
-ret: 0 st: 0 flags:0 ts:-0.904994
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 0 size: 17497
-ret: 0 st: 0 flags:1 ts: 1.989173
-ret: 0 st: 0 flags:1 dts: 1.840000 pts: NOPTS pos: 325162 size: 19936
-ret: 0 st:-1 flags:0 ts: 0.883340
-ret: 0 st: 0 flags:1 dts: 1.360000 pts: NOPTS pos: 265477 size: 21329
-ret:-1 st:-1 flags:1 ts:-0.222493
-ret:-1 st: 0 flags:0 ts: 2.671674
-ret: 0 st: 0 flags:1 ts: 1.565841
-ret: 0 st: 0 flags:1 dts: 1.360000 pts: NOPTS pos: 265477 size: 21329
-ret: 0 st:-1 flags:0 ts: 0.460008
-ret: 0 st: 0 flags:1 dts: 0.880000 pts: NOPTS pos: 200736 size: 22575
-ret:-1 st:-1 flags:1 ts:-0.645825
diff --git a/gst-libs/ext/libav/tests/ref/seek/mpeg2_idct_int_mpg b/gst-libs/ext/libav/tests/ref/seek/mpeg2_idct_int_mpg
deleted file mode 100644
index b096f6f..0000000
--- a/gst-libs/ext/libav/tests/ref/seek/mpeg2_idct_int_mpg
+++ /dev/null
@@ -1,46 +0,0 @@
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 0 size: 9911
-ret: 0 st:-1 flags:0 ts:-1.000000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 0 size: 9911
-ret: 0 st:-1 flags:1 ts: 1.894167
-ret: 0 st: 0 flags:1 dts: 1.440000 pts: NOPTS pos: 127925 size: 11918
-ret: 0 st: 0 flags:0 ts: 0.788334
-ret: 0 st: 0 flags:1 dts: 0.960000 pts: NOPTS pos: 79103 size: 10909
-ret:-1 st: 0 flags:1 ts:-0.317499
-ret:-1 st:-1 flags:0 ts: 2.576668
-ret: 0 st:-1 flags:1 ts: 1.470835
-ret: 0 st: 0 flags:1 dts: 1.440000 pts: NOPTS pos: 127925 size: 11918
-ret: 0 st: 0 flags:0 ts: 0.365002
-ret: 0 st: 0 flags:1 dts: 0.480000 pts: NOPTS pos: 38992 size: 9985
-ret:-1 st: 0 flags:1 ts:-0.740831
-ret:-1 st:-1 flags:0 ts: 2.153336
-ret: 0 st:-1 flags:1 ts: 1.047503
-ret: 0 st: 0 flags:1 dts: 0.960000 pts: NOPTS pos: 79103 size: 10909
-ret: 0 st: 0 flags:0 ts:-0.058330
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 0 size: 9911
-ret: 0 st: 0 flags:1 ts: 2.835837
-ret: 0 st: 0 flags:1 dts: 1.920000 pts: NOPTS pos: 182138 size: 12183
-ret: 0 st:-1 flags:0 ts: 1.730004
-ret: 0 st: 0 flags:1 dts: 1.920000 pts: NOPTS pos: 182138 size: 12183
-ret: 0 st:-1 flags:1 ts: 0.624171
-ret: 0 st: 0 flags:1 dts: 0.480000 pts: NOPTS pos: 38992 size: 9985
-ret: 0 st: 0 flags:0 ts:-0.481662
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 0 size: 9911
-ret: 0 st: 0 flags:1 ts: 2.412505
-ret: 0 st: 0 flags:1 dts: 1.920000 pts: NOPTS pos: 182138 size: 12183
-ret: 0 st:-1 flags:0 ts: 1.306672
-ret: 0 st: 0 flags:1 dts: 1.440000 pts: NOPTS pos: 127925 size: 11918
-ret: 0 st:-1 flags:1 ts: 0.200839
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 0 size: 9911
-ret: 0 st: 0 flags:0 ts:-0.904994
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 0 size: 9911
-ret: 0 st: 0 flags:1 ts: 1.989173
-ret: 0 st: 0 flags:1 dts: 1.920000 pts: NOPTS pos: 182138 size: 12183
-ret: 0 st:-1 flags:0 ts: 0.883340
-ret: 0 st: 0 flags:1 dts: 0.960000 pts: NOPTS pos: 79103 size: 10909
-ret:-1 st:-1 flags:1 ts:-0.222493
-ret:-1 st: 0 flags:0 ts: 2.671674
-ret: 0 st: 0 flags:1 ts: 1.565841
-ret: 0 st: 0 flags:1 dts: 1.440000 pts: NOPTS pos: 127925 size: 11918
-ret: 0 st:-1 flags:0 ts: 0.460008
-ret: 0 st: 0 flags:1 dts: 0.480000 pts: NOPTS pos: 38992 size: 9985
-ret:-1 st:-1 flags:1 ts:-0.645825
diff --git a/gst-libs/ext/libav/tests/ref/seek/mpeg2i_mpg b/gst-libs/ext/libav/tests/ref/seek/mpeg2i_mpg
deleted file mode 100644
index 0708cfd..0000000
--- a/gst-libs/ext/libav/tests/ref/seek/mpeg2i_mpg
+++ /dev/null
@@ -1,46 +0,0 @@
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 0 size: 9961
-ret: 0 st:-1 flags:0 ts:-1.000000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 0 size: 9961
-ret: 0 st:-1 flags:1 ts: 1.894167
-ret: 0 st: 0 flags:1 dts: 1.440000 pts: NOPTS pos: 132607 size: 11970
-ret: 0 st: 0 flags:0 ts: 0.788334
-ret: 0 st: 0 flags:1 dts: 0.960000 pts: NOPTS pos: 82152 size: 10965
-ret:-1 st: 0 flags:1 ts:-0.317499
-ret:-1 st:-1 flags:0 ts: 2.576668
-ret: 0 st:-1 flags:1 ts: 1.470835
-ret: 0 st: 0 flags:1 dts: 1.440000 pts: NOPTS pos: 132607 size: 11970
-ret: 0 st: 0 flags:0 ts: 0.365002
-ret: 0 st: 0 flags:1 dts: 0.480000 pts: NOPTS pos: 40546 size: 10045
-ret:-1 st: 0 flags:1 ts:-0.740831
-ret:-1 st:-1 flags:0 ts: 2.153336
-ret: 0 st:-1 flags:1 ts: 1.047503
-ret: 0 st: 0 flags:1 dts: 0.960000 pts: NOPTS pos: 82152 size: 10965
-ret: 0 st: 0 flags:0 ts:-0.058330
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 0 size: 9961
-ret: 0 st: 0 flags:1 ts: 2.835837
-ret: 0 st: 0 flags:1 dts: 1.920000 pts: NOPTS pos: 188429 size: 12232
-ret: 0 st:-1 flags:0 ts: 1.730004
-ret: 0 st: 0 flags:1 dts: 1.920000 pts: NOPTS pos: 188429 size: 12232
-ret: 0 st:-1 flags:1 ts: 0.624171
-ret: 0 st: 0 flags:1 dts: 0.480000 pts: NOPTS pos: 40546 size: 10045
-ret: 0 st: 0 flags:0 ts:-0.481662
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 0 size: 9961
-ret: 0 st: 0 flags:1 ts: 2.412505
-ret: 0 st: 0 flags:1 dts: 1.920000 pts: NOPTS pos: 188429 size: 12232
-ret: 0 st:-1 flags:0 ts: 1.306672
-ret: 0 st: 0 flags:1 dts: 1.440000 pts: NOPTS pos: 132607 size: 11970
-ret: 0 st:-1 flags:1 ts: 0.200839
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 0 size: 9961
-ret: 0 st: 0 flags:0 ts:-0.904994
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 0 size: 9961
-ret: 0 st: 0 flags:1 ts: 1.989173
-ret: 0 st: 0 flags:1 dts: 1.920000 pts: NOPTS pos: 188429 size: 12232
-ret: 0 st:-1 flags:0 ts: 0.883340
-ret: 0 st: 0 flags:1 dts: 0.960000 pts: NOPTS pos: 82152 size: 10965
-ret:-1 st:-1 flags:1 ts:-0.222493
-ret:-1 st: 0 flags:0 ts: 2.671674
-ret: 0 st: 0 flags:1 ts: 1.565841
-ret: 0 st: 0 flags:1 dts: 1.440000 pts: NOPTS pos: 132607 size: 11970
-ret: 0 st:-1 flags:0 ts: 0.460008
-ret: 0 st: 0 flags:1 dts: 0.480000 pts: NOPTS pos: 40546 size: 10045
-ret:-1 st:-1 flags:1 ts:-0.645825
diff --git a/gst-libs/ext/libav/tests/ref/seek/mpeg2ivlc_qprd_mpg b/gst-libs/ext/libav/tests/ref/seek/mpeg2ivlc_qprd_mpg
deleted file mode 100644
index 330dc16..0000000
--- a/gst-libs/ext/libav/tests/ref/seek/mpeg2ivlc_qprd_mpg
+++ /dev/null
@@ -1,46 +0,0 @@
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 0 size: 16239
-ret: 0 st:-1 flags:0 ts:-1.000000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 0 size: 16239
-ret: 0 st:-1 flags:1 ts: 1.894167
-ret: 0 st: 0 flags:1 dts: 1.840000 pts: NOPTS pos: 227500 size: 12725
-ret: 0 st: 0 flags:0 ts: 0.788334
-ret: 0 st: 0 flags:1 dts: 0.880000 pts: NOPTS pos: 164167 size: 13921
-ret:-1 st: 0 flags:1 ts:-0.317499
-ret:-1 st:-1 flags:0 ts: 2.576668
-ret: 0 st:-1 flags:1 ts: 1.470835
-ret: 0 st: 0 flags:1 dts: 1.360000 pts: NOPTS pos: 196681 size: 13159
-ret: 0 st: 0 flags:0 ts: 0.365002
-ret: 0 st: 0 flags:1 dts: 0.400000 pts: NOPTS pos: 98748 size: 29165
-ret:-1 st: 0 flags:1 ts:-0.740831
-ret:-1 st:-1 flags:0 ts: 2.153336
-ret: 0 st:-1 flags:1 ts: 1.047503
-ret: 0 st: 0 flags:1 dts: 0.880000 pts: NOPTS pos: 164167 size: 13921
-ret: 0 st: 0 flags:0 ts:-0.058330
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 0 size: 16239
-ret: 0 st: 0 flags:1 ts: 2.835837
-ret: 0 st: 0 flags:1 dts: 1.840000 pts: NOPTS pos: 227500 size: 12725
-ret: 0 st:-1 flags:0 ts: 1.730004
-ret: 0 st: 0 flags:1 dts: 1.840000 pts: NOPTS pos: 227500 size: 12725
-ret: 0 st:-1 flags:1 ts: 0.624171
-ret: 0 st: 0 flags:1 dts: 0.400000 pts: NOPTS pos: 98748 size: 29165
-ret: 0 st: 0 flags:0 ts:-0.481662
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 0 size: 16239
-ret: 0 st: 0 flags:1 ts: 2.412505
-ret: 0 st: 0 flags:1 dts: 1.840000 pts: NOPTS pos: 227500 size: 12725
-ret: 0 st:-1 flags:0 ts: 1.306672
-ret: 0 st: 0 flags:1 dts: 1.360000 pts: NOPTS pos: 196681 size: 13159
-ret: 0 st:-1 flags:1 ts: 0.200839
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 0 size: 16239
-ret: 0 st: 0 flags:0 ts:-0.904994
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 0 size: 16239
-ret: 0 st: 0 flags:1 ts: 1.989173
-ret: 0 st: 0 flags:1 dts: 1.840000 pts: NOPTS pos: 227500 size: 12725
-ret: 0 st:-1 flags:0 ts: 0.883340
-ret: 0 st: 0 flags:1 dts: 1.360000 pts: NOPTS pos: 196681 size: 13159
-ret:-1 st:-1 flags:1 ts:-0.222493
-ret:-1 st: 0 flags:0 ts: 2.671674
-ret: 0 st: 0 flags:1 ts: 1.565841
-ret: 0 st: 0 flags:1 dts: 1.360000 pts: NOPTS pos: 196681 size: 13159
-ret: 0 st:-1 flags:0 ts: 0.460008
-ret: 0 st: 0 flags:1 dts: 0.880000 pts: NOPTS pos: 164167 size: 13921
-ret:-1 st:-1 flags:1 ts:-0.645825
diff --git a/gst-libs/ext/libav/tests/ref/seek/mpeg2thread_mpg b/gst-libs/ext/libav/tests/ref/seek/mpeg2thread_mpg
deleted file mode 100644
index 24ee04f..0000000
--- a/gst-libs/ext/libav/tests/ref/seek/mpeg2thread_mpg
+++ /dev/null
@@ -1,46 +0,0 @@
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 0 size: 9961
-ret: 0 st:-1 flags:0 ts:-1.000000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 0 size: 9961
-ret: 0 st:-1 flags:1 ts: 1.894167
-ret: 0 st: 0 flags:1 dts: 1.840000 pts: NOPTS pos: 158225 size: 12232
-ret: 0 st: 0 flags:0 ts: 0.788334
-ret: 0 st: 0 flags:1 dts: 0.880000 pts: NOPTS pos: 67790 size: 10965
-ret:-1 st: 0 flags:1 ts:-0.317499
-ret:-1 st:-1 flags:0 ts: 2.576668
-ret: 0 st:-1 flags:1 ts: 1.470835
-ret: 0 st: 0 flags:1 dts: 1.360000 pts: NOPTS pos: 110330 size: 11970
-ret: 0 st: 0 flags:0 ts: 0.365002
-ret: 0 st: 0 flags:1 dts: 0.400000 pts: NOPTS pos: 30747 size: 10045
-ret:-1 st: 0 flags:1 ts:-0.740831
-ret:-1 st:-1 flags:0 ts: 2.153336
-ret: 0 st:-1 flags:1 ts: 1.047503
-ret: 0 st: 0 flags:1 dts: 0.880000 pts: NOPTS pos: 67790 size: 10965
-ret: 0 st: 0 flags:0 ts:-0.058330
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 0 size: 9961
-ret: 0 st: 0 flags:1 ts: 2.835837
-ret: 0 st: 0 flags:1 dts: 1.840000 pts: NOPTS pos: 158225 size: 12232
-ret: 0 st:-1 flags:0 ts: 1.730004
-ret: 0 st: 0 flags:1 dts: 1.840000 pts: NOPTS pos: 158225 size: 12232
-ret: 0 st:-1 flags:1 ts: 0.624171
-ret: 0 st: 0 flags:1 dts: 0.400000 pts: NOPTS pos: 30747 size: 10045
-ret: 0 st: 0 flags:0 ts:-0.481662
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 0 size: 9961
-ret: 0 st: 0 flags:1 ts: 2.412505
-ret: 0 st: 0 flags:1 dts: 1.840000 pts: NOPTS pos: 158225 size: 12232
-ret: 0 st:-1 flags:0 ts: 1.306672
-ret: 0 st: 0 flags:1 dts: 1.360000 pts: NOPTS pos: 110330 size: 11970
-ret: 0 st:-1 flags:1 ts: 0.200839
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 0 size: 9961
-ret: 0 st: 0 flags:0 ts:-0.904994
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 0 size: 9961
-ret: 0 st: 0 flags:1 ts: 1.989173
-ret: 0 st: 0 flags:1 dts: 1.840000 pts: NOPTS pos: 158225 size: 12232
-ret: 0 st:-1 flags:0 ts: 0.883340
-ret: 0 st: 0 flags:1 dts: 1.360000 pts: NOPTS pos: 110330 size: 11970
-ret:-1 st:-1 flags:1 ts:-0.222493
-ret:-1 st: 0 flags:0 ts: 2.671674
-ret: 0 st: 0 flags:1 ts: 1.565841
-ret: 0 st: 0 flags:1 dts: 1.360000 pts: NOPTS pos: 110330 size: 11970
-ret: 0 st:-1 flags:0 ts: 0.460008
-ret: 0 st: 0 flags:1 dts: 0.880000 pts: NOPTS pos: 67790 size: 10965
-ret:-1 st:-1 flags:1 ts:-0.645825
diff --git a/gst-libs/ext/libav/tests/ref/seek/mpeg2threadivlc_mpg b/gst-libs/ext/libav/tests/ref/seek/mpeg2threadivlc_mpg
deleted file mode 100644
index c2f9895..0000000
--- a/gst-libs/ext/libav/tests/ref/seek/mpeg2threadivlc_mpg
+++ /dev/null
@@ -1,46 +0,0 @@
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 0 size: 9954
-ret: 0 st:-1 flags:0 ts:-1.000000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 0 size: 9954
-ret: 0 st:-1 flags:1 ts: 1.894167
-ret: 0 st: 0 flags:1 dts: 1.840000 pts: NOPTS pos: 157678 size: 11930
-ret: 0 st: 0 flags:0 ts: 0.788334
-ret: 0 st: 0 flags:1 dts: 0.880000 pts: NOPTS pos: 67723 size: 10791
-ret:-1 st: 0 flags:1 ts:-0.317499
-ret:-1 st:-1 flags:0 ts: 2.576668
-ret: 0 st:-1 flags:1 ts: 1.470835
-ret: 0 st: 0 flags:1 dts: 1.360000 pts: NOPTS pos: 110080 size: 11697
-ret: 0 st: 0 flags:0 ts: 0.365002
-ret: 0 st: 0 flags:1 dts: 0.400000 pts: NOPTS pos: 30744 size: 9980
-ret:-1 st: 0 flags:1 ts:-0.740831
-ret:-1 st:-1 flags:0 ts: 2.153336
-ret: 0 st:-1 flags:1 ts: 1.047503
-ret: 0 st: 0 flags:1 dts: 0.880000 pts: NOPTS pos: 67723 size: 10791
-ret: 0 st: 0 flags:0 ts:-0.058330
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 0 size: 9954
-ret: 0 st: 0 flags:1 ts: 2.835837
-ret: 0 st: 0 flags:1 dts: 1.840000 pts: NOPTS pos: 157678 size: 11930
-ret: 0 st:-1 flags:0 ts: 1.730004
-ret: 0 st: 0 flags:1 dts: 1.840000 pts: NOPTS pos: 157678 size: 11930
-ret: 0 st:-1 flags:1 ts: 0.624171
-ret: 0 st: 0 flags:1 dts: 0.400000 pts: NOPTS pos: 30744 size: 9980
-ret: 0 st: 0 flags:0 ts:-0.481662
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 0 size: 9954
-ret: 0 st: 0 flags:1 ts: 2.412505
-ret: 0 st: 0 flags:1 dts: 1.840000 pts: NOPTS pos: 157678 size: 11930
-ret: 0 st:-1 flags:0 ts: 1.306672
-ret: 0 st: 0 flags:1 dts: 1.360000 pts: NOPTS pos: 110080 size: 11697
-ret: 0 st:-1 flags:1 ts: 0.200839
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 0 size: 9954
-ret: 0 st: 0 flags:0 ts:-0.904994
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 0 size: 9954
-ret: 0 st: 0 flags:1 ts: 1.989173
-ret: 0 st: 0 flags:1 dts: 1.840000 pts: NOPTS pos: 157678 size: 11930
-ret: 0 st:-1 flags:0 ts: 0.883340
-ret: 0 st: 0 flags:1 dts: 1.360000 pts: NOPTS pos: 110080 size: 11697
-ret:-1 st:-1 flags:1 ts:-0.222493
-ret:-1 st: 0 flags:0 ts: 2.671674
-ret: 0 st: 0 flags:1 ts: 1.565841
-ret: 0 st: 0 flags:1 dts: 1.360000 pts: NOPTS pos: 110080 size: 11697
-ret: 0 st:-1 flags:0 ts: 0.460008
-ret: 0 st: 0 flags:1 dts: 0.880000 pts: NOPTS pos: 67723 size: 10791
-ret:-1 st:-1 flags:1 ts:-0.645825
diff --git a/gst-libs/ext/libav/tests/ref/seek/mpeg4_Q_avi b/gst-libs/ext/libav/tests/ref/seek/mpeg4_Q_avi
deleted file mode 100644
index 1bb1504..0000000
--- a/gst-libs/ext/libav/tests/ref/seek/mpeg4_Q_avi
+++ /dev/null
@@ -1,46 +0,0 @@
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 5660 size: 11942
-ret: 0 st:-1 flags:0 ts:-1.000000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 5660 size: 11942
-ret: 0 st:-1 flags:1 ts: 1.894167
-ret: 0 st: 0 flags:1 dts: 1.840000 pts: NOPTS pos: 141530 size: 15562
-ret: 0 st: 0 flags:0 ts: 0.800000
-ret: 0 st: 0 flags:1 dts: 0.880000 pts: NOPTS pos: 64116 size: 13382
-ret:-1 st: 0 flags:1 ts:-0.320000
-ret:-1 st:-1 flags:0 ts: 2.576668
-ret: 0 st:-1 flags:1 ts: 1.470835
-ret: 0 st: 0 flags:1 dts: 1.360000 pts: NOPTS pos: 100368 size: 15057
-ret: 0 st: 0 flags:0 ts: 0.360000
-ret: 0 st: 0 flags:1 dts: 0.400000 pts: NOPTS pos: 32818 size: 11813
-ret:-1 st: 0 flags:1 ts:-0.760000
-ret:-1 st:-1 flags:0 ts: 2.153336
-ret: 0 st:-1 flags:1 ts: 1.047503
-ret: 0 st: 0 flags:1 dts: 0.880000 pts: NOPTS pos: 64116 size: 13382
-ret: 0 st: 0 flags:0 ts:-0.040000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 5660 size: 11942
-ret: 0 st: 0 flags:1 ts: 2.840000
-ret: 0 st: 0 flags:1 dts: 1.840000 pts: NOPTS pos: 141530 size: 15562
-ret: 0 st:-1 flags:0 ts: 1.730004
-ret: 0 st: 0 flags:1 dts: 1.840000 pts: NOPTS pos: 141530 size: 15562
-ret: 0 st:-1 flags:1 ts: 0.624171
-ret: 0 st: 0 flags:1 dts: 0.400000 pts: NOPTS pos: 32818 size: 11813
-ret: 0 st: 0 flags:0 ts:-0.480000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 5660 size: 11942
-ret: 0 st: 0 flags:1 ts: 2.400000
-ret: 0 st: 0 flags:1 dts: 1.840000 pts: NOPTS pos: 141530 size: 15562
-ret: 0 st:-1 flags:0 ts: 1.306672
-ret: 0 st: 0 flags:1 dts: 1.360000 pts: NOPTS pos: 100368 size: 15057
-ret: 0 st:-1 flags:1 ts: 0.200839
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 5660 size: 11942
-ret: 0 st: 0 flags:0 ts:-0.920000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 5660 size: 11942
-ret: 0 st: 0 flags:1 ts: 2.000000
-ret: 0 st: 0 flags:1 dts: 1.840000 pts: NOPTS pos: 141530 size: 15562
-ret: 0 st:-1 flags:0 ts: 0.883340
-ret: 0 st: 0 flags:1 dts: 0.880000 pts: NOPTS pos: 64116 size: 13382
-ret:-1 st:-1 flags:1 ts:-0.222493
-ret:-1 st: 0 flags:0 ts: 2.680000
-ret: 0 st: 0 flags:1 ts: 1.560000
-ret: 0 st: 0 flags:1 dts: 1.360000 pts: NOPTS pos: 100368 size: 15057
-ret: 0 st:-1 flags:0 ts: 0.460008
-ret: 0 st: 0 flags:1 dts: 0.880000 pts: NOPTS pos: 64116 size: 13382
-ret:-1 st:-1 flags:1 ts:-0.645825
diff --git a/gst-libs/ext/libav/tests/ref/seek/mpeg4_adap_avi b/gst-libs/ext/libav/tests/ref/seek/mpeg4_adap_avi
deleted file mode 100644
index 8397b41..0000000
--- a/gst-libs/ext/libav/tests/ref/seek/mpeg4_adap_avi
+++ /dev/null
@@ -1,46 +0,0 @@
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 5660 size: 6855
-ret: 0 st:-1 flags:0 ts:-1.000000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 5660 size: 6855
-ret: 0 st:-1 flags:1 ts: 1.894167
-ret: 0 st: 0 flags:1 dts: 1.840000 pts: NOPTS pos: 174456 size: 16883
-ret: 0 st: 0 flags:0 ts: 0.800000
-ret: 0 st: 0 flags:1 dts: 0.880000 pts: NOPTS pos: 98228 size: 17063
-ret:-1 st: 0 flags:1 ts:-0.320000
-ret:-1 st:-1 flags:0 ts: 2.576668
-ret: 0 st:-1 flags:1 ts: 1.470835
-ret: 0 st: 0 flags:1 dts: 1.360000 pts: NOPTS pos: 135598 size: 17525
-ret: 0 st: 0 flags:0 ts: 0.360000
-ret: 0 st: 0 flags:1 dts: 0.400000 pts: NOPTS pos: 59454 size: 17261
-ret:-1 st: 0 flags:1 ts:-0.760000
-ret:-1 st:-1 flags:0 ts: 2.153336
-ret: 0 st:-1 flags:1 ts: 1.047503
-ret: 0 st: 0 flags:1 dts: 0.880000 pts: NOPTS pos: 98228 size: 17063
-ret: 0 st: 0 flags:0 ts:-0.040000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 5660 size: 6855
-ret: 0 st: 0 flags:1 ts: 2.840000
-ret: 0 st: 0 flags:1 dts: 1.840000 pts: NOPTS pos: 174456 size: 16883
-ret: 0 st:-1 flags:0 ts: 1.730004
-ret: 0 st: 0 flags:1 dts: 1.840000 pts: NOPTS pos: 174456 size: 16883
-ret: 0 st:-1 flags:1 ts: 0.624171
-ret: 0 st: 0 flags:1 dts: 0.400000 pts: NOPTS pos: 59454 size: 17261
-ret: 0 st: 0 flags:0 ts:-0.480000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 5660 size: 6855
-ret: 0 st: 0 flags:1 ts: 2.400000
-ret: 0 st: 0 flags:1 dts: 1.840000 pts: NOPTS pos: 174456 size: 16883
-ret: 0 st:-1 flags:0 ts: 1.306672
-ret: 0 st: 0 flags:1 dts: 1.360000 pts: NOPTS pos: 135598 size: 17525
-ret: 0 st:-1 flags:1 ts: 0.200839
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 5660 size: 6855
-ret: 0 st: 0 flags:0 ts:-0.920000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 5660 size: 6855
-ret: 0 st: 0 flags:1 ts: 2.000000
-ret: 0 st: 0 flags:1 dts: 1.840000 pts: NOPTS pos: 174456 size: 16883
-ret: 0 st:-1 flags:0 ts: 0.883340
-ret: 0 st: 0 flags:1 dts: 0.880000 pts: NOPTS pos: 98228 size: 17063
-ret:-1 st:-1 flags:1 ts:-0.222493
-ret:-1 st: 0 flags:0 ts: 2.680000
-ret: 0 st: 0 flags:1 ts: 1.560000
-ret: 0 st: 0 flags:1 dts: 1.360000 pts: NOPTS pos: 135598 size: 17525
-ret: 0 st:-1 flags:0 ts: 0.460008
-ret: 0 st: 0 flags:1 dts: 0.880000 pts: NOPTS pos: 98228 size: 17063
-ret:-1 st:-1 flags:1 ts:-0.645825
diff --git a/gst-libs/ext/libav/tests/ref/seek/mpeg4_adv_avi b/gst-libs/ext/libav/tests/ref/seek/mpeg4_adv_avi
deleted file mode 100644
index 2e66b77..0000000
--- a/gst-libs/ext/libav/tests/ref/seek/mpeg4_adv_avi
+++ /dev/null
@@ -1,46 +0,0 @@
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5660 size: 8653
-ret: 0 st:-1 flags:0 ts:-1.000000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5660 size: 8653
-ret: 0 st:-1 flags:1 ts: 1.894167
-ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 91730 size: 11013
-ret: 0 st: 0 flags:0 ts: 0.800000
-ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 59504 size: 9815
-ret:-1 st: 0 flags:1 ts:-0.320000
-ret:-1 st:-1 flags:0 ts: 2.576668
-ret: 0 st:-1 flags:1 ts: 1.470835
-ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 91730 size: 11013
-ret: 0 st: 0 flags:0 ts: 0.360000
-ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 31944 size: 8753
-ret:-1 st: 0 flags:1 ts:-0.760000
-ret:-1 st:-1 flags:0 ts: 2.153336
-ret: 0 st:-1 flags:1 ts: 1.047503
-ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 59504 size: 9815
-ret: 0 st: 0 flags:0 ts:-0.040000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5660 size: 8653
-ret: 0 st: 0 flags:1 ts: 2.840000
-ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 127624 size: 11279
-ret: 0 st:-1 flags:0 ts: 1.730004
-ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 127624 size: 11279
-ret: 0 st:-1 flags:1 ts: 0.624171
-ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 31944 size: 8753
-ret: 0 st: 0 flags:0 ts:-0.480000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5660 size: 8653
-ret: 0 st: 0 flags:1 ts: 2.400000
-ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 127624 size: 11279
-ret: 0 st:-1 flags:0 ts: 1.306672
-ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 91730 size: 11013
-ret: 0 st:-1 flags:1 ts: 0.200839
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5660 size: 8653
-ret: 0 st: 0 flags:0 ts:-0.920000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5660 size: 8653
-ret: 0 st: 0 flags:1 ts: 2.000000
-ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 127624 size: 11279
-ret: 0 st:-1 flags:0 ts: 0.883340
-ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 59504 size: 9815
-ret:-1 st:-1 flags:1 ts:-0.222493
-ret:-1 st: 0 flags:0 ts: 2.680000
-ret: 0 st: 0 flags:1 ts: 1.560000
-ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 91730 size: 11013
-ret: 0 st:-1 flags:0 ts: 0.460008
-ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 31944 size: 8753
-ret:-1 st:-1 flags:1 ts:-0.645825
diff --git a/gst-libs/ext/libav/tests/ref/seek/mpeg4_nr_avi b/gst-libs/ext/libav/tests/ref/seek/mpeg4_nr_avi
deleted file mode 100644
index c9af36f..0000000
--- a/gst-libs/ext/libav/tests/ref/seek/mpeg4_nr_avi
+++ /dev/null
@@ -1,46 +0,0 @@
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5660 size: 10673
-ret: 0 st:-1 flags:0 ts:-1.000000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5660 size: 10673
-ret: 0 st:-1 flags:1 ts: 1.894167
-ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 100640 size: 12464
-ret: 0 st: 0 flags:0 ts: 0.800000
-ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 65480 size: 11181
-ret:-1 st: 0 flags:1 ts:-0.320000
-ret:-1 st:-1 flags:0 ts: 2.576668
-ret: 0 st:-1 flags:1 ts: 1.470835
-ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 100640 size: 12464
-ret: 0 st: 0 flags:0 ts: 0.360000
-ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 35312 size: 9987
-ret:-1 st: 0 flags:1 ts:-0.760000
-ret:-1 st:-1 flags:0 ts: 2.153336
-ret: 0 st:-1 flags:1 ts: 1.047503
-ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 65480 size: 11181
-ret: 0 st: 0 flags:0 ts:-0.040000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5660 size: 10673
-ret: 0 st: 0 flags:1 ts: 2.840000
-ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 139424 size: 12911
-ret: 0 st:-1 flags:0 ts: 1.730004
-ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 139424 size: 12911
-ret: 0 st:-1 flags:1 ts: 0.624171
-ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 35312 size: 9987
-ret: 0 st: 0 flags:0 ts:-0.480000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5660 size: 10673
-ret: 0 st: 0 flags:1 ts: 2.400000
-ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 139424 size: 12911
-ret: 0 st:-1 flags:0 ts: 1.306672
-ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 100640 size: 12464
-ret: 0 st:-1 flags:1 ts: 0.200839
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5660 size: 10673
-ret: 0 st: 0 flags:0 ts:-0.920000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5660 size: 10673
-ret: 0 st: 0 flags:1 ts: 2.000000
-ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 139424 size: 12911
-ret: 0 st:-1 flags:0 ts: 0.883340
-ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 65480 size: 11181
-ret:-1 st:-1 flags:1 ts:-0.222493
-ret:-1 st: 0 flags:0 ts: 2.680000
-ret: 0 st: 0 flags:1 ts: 1.560000
-ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 100640 size: 12464
-ret: 0 st:-1 flags:0 ts: 0.460008
-ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 35312 size: 9987
-ret:-1 st:-1 flags:1 ts:-0.645825
diff --git a/gst-libs/ext/libav/tests/ref/seek/mpeg4_qprd_avi b/gst-libs/ext/libav/tests/ref/seek/mpeg4_qprd_avi
deleted file mode 100644
index 70374df..0000000
--- a/gst-libs/ext/libav/tests/ref/seek/mpeg4_qprd_avi
+++ /dev/null
@@ -1,46 +0,0 @@
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 5660 size: 14873
-ret: 0 st:-1 flags:0 ts:-1.000000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 5660 size: 14873
-ret: 0 st:-1 flags:1 ts: 1.894167
-ret: 0 st: 0 flags:1 dts: 1.840000 pts: NOPTS pos: 211032 size: 14638
-ret: 0 st: 0 flags:0 ts: 0.800000
-ret: 0 st: 0 flags:1 dts: 0.880000 pts: NOPTS pos: 150666 size: 14502
-ret:-1 st: 0 flags:1 ts:-0.320000
-ret:-1 st:-1 flags:0 ts: 2.576668
-ret: 0 st:-1 flags:1 ts: 1.470835
-ret: 0 st: 0 flags:1 dts: 1.360000 pts: NOPTS pos: 180782 size: 14371
-ret: 0 st: 0 flags:0 ts: 0.360000
-ret: 0 st: 0 flags:1 dts: 0.400000 pts: NOPTS pos: 93036 size: 29366
-ret:-1 st: 0 flags:1 ts:-0.760000
-ret:-1 st:-1 flags:0 ts: 2.153336
-ret: 0 st:-1 flags:1 ts: 1.047503
-ret: 0 st: 0 flags:1 dts: 0.880000 pts: NOPTS pos: 150666 size: 14502
-ret: 0 st: 0 flags:0 ts:-0.040000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 5660 size: 14873
-ret: 0 st: 0 flags:1 ts: 2.840000
-ret: 0 st: 0 flags:1 dts: 1.840000 pts: NOPTS pos: 211032 size: 14638
-ret: 0 st:-1 flags:0 ts: 1.730004
-ret: 0 st: 0 flags:1 dts: 1.840000 pts: NOPTS pos: 211032 size: 14638
-ret: 0 st:-1 flags:1 ts: 0.624171
-ret: 0 st: 0 flags:1 dts: 0.400000 pts: NOPTS pos: 93036 size: 29366
-ret: 0 st: 0 flags:0 ts:-0.480000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 5660 size: 14873
-ret: 0 st: 0 flags:1 ts: 2.400000
-ret: 0 st: 0 flags:1 dts: 1.840000 pts: NOPTS pos: 211032 size: 14638
-ret: 0 st:-1 flags:0 ts: 1.306672
-ret: 0 st: 0 flags:1 dts: 1.360000 pts: NOPTS pos: 180782 size: 14371
-ret: 0 st:-1 flags:1 ts: 0.200839
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 5660 size: 14873
-ret: 0 st: 0 flags:0 ts:-0.920000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 5660 size: 14873
-ret: 0 st: 0 flags:1 ts: 2.000000
-ret: 0 st: 0 flags:1 dts: 1.840000 pts: NOPTS pos: 211032 size: 14638
-ret: 0 st:-1 flags:0 ts: 0.883340
-ret: 0 st: 0 flags:1 dts: 0.880000 pts: NOPTS pos: 150666 size: 14502
-ret:-1 st:-1 flags:1 ts:-0.222493
-ret:-1 st: 0 flags:0 ts: 2.680000
-ret: 0 st: 0 flags:1 ts: 1.560000
-ret: 0 st: 0 flags:1 dts: 1.360000 pts: NOPTS pos: 180782 size: 14371
-ret: 0 st:-1 flags:0 ts: 0.460008
-ret: 0 st: 0 flags:1 dts: 0.880000 pts: NOPTS pos: 150666 size: 14502
-ret:-1 st:-1 flags:1 ts:-0.645825
diff --git a/gst-libs/ext/libav/tests/ref/seek/mpeg4_rc_avi b/gst-libs/ext/libav/tests/ref/seek/mpeg4_rc_avi
deleted file mode 100644
index dc703d7..0000000
--- a/gst-libs/ext/libav/tests/ref/seek/mpeg4_rc_avi
+++ /dev/null
@@ -1,46 +0,0 @@
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 5660 size: 15766
-ret: 0 st:-1 flags:0 ts:-1.000000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 5660 size: 15766
-ret: 0 st:-1 flags:1 ts: 1.894167
-ret: 0 st: 0 flags:1 dts: 1.840000 pts: NOPTS pos: 207968 size: 13826
-ret: 0 st: 0 flags:0 ts: 0.800000
-ret: 0 st: 0 flags:1 dts: 0.880000 pts: NOPTS pos: 153812 size: 13382
-ret:-1 st: 0 flags:1 ts:-0.320000
-ret:-1 st:-1 flags:0 ts: 2.576668
-ret: 0 st:-1 flags:1 ts: 1.470835
-ret: 0 st: 0 flags:1 dts: 1.360000 pts: NOPTS pos: 180960 size: 13326
-ret: 0 st: 0 flags:0 ts: 0.360000
-ret: 0 st: 0 flags:1 dts: 0.400000 pts: NOPTS pos: 94594 size: 32807
-ret:-1 st: 0 flags:1 ts:-0.760000
-ret:-1 st:-1 flags:0 ts: 2.153336
-ret: 0 st:-1 flags:1 ts: 1.047503
-ret: 0 st: 0 flags:1 dts: 0.880000 pts: NOPTS pos: 153812 size: 13382
-ret: 0 st: 0 flags:0 ts:-0.040000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 5660 size: 15766
-ret: 0 st: 0 flags:1 ts: 2.840000
-ret: 0 st: 0 flags:1 dts: 1.840000 pts: NOPTS pos: 207968 size: 13826
-ret: 0 st:-1 flags:0 ts: 1.730004
-ret: 0 st: 0 flags:1 dts: 1.840000 pts: NOPTS pos: 207968 size: 13826
-ret: 0 st:-1 flags:1 ts: 0.624171
-ret: 0 st: 0 flags:1 dts: 0.400000 pts: NOPTS pos: 94594 size: 32807
-ret: 0 st: 0 flags:0 ts:-0.480000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 5660 size: 15766
-ret: 0 st: 0 flags:1 ts: 2.400000
-ret: 0 st: 0 flags:1 dts: 1.840000 pts: NOPTS pos: 207968 size: 13826
-ret: 0 st:-1 flags:0 ts: 1.306672
-ret: 0 st: 0 flags:1 dts: 1.360000 pts: NOPTS pos: 180960 size: 13326
-ret: 0 st:-1 flags:1 ts: 0.200839
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 5660 size: 15766
-ret: 0 st: 0 flags:0 ts:-0.920000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 5660 size: 15766
-ret: 0 st: 0 flags:1 ts: 2.000000
-ret: 0 st: 0 flags:1 dts: 1.840000 pts: NOPTS pos: 207968 size: 13826
-ret: 0 st:-1 flags:0 ts: 0.883340
-ret: 0 st: 0 flags:1 dts: 0.880000 pts: NOPTS pos: 153812 size: 13382
-ret:-1 st:-1 flags:1 ts:-0.222493
-ret:-1 st: 0 flags:0 ts: 2.680000
-ret: 0 st: 0 flags:1 ts: 1.560000
-ret: 0 st: 0 flags:1 dts: 1.360000 pts: NOPTS pos: 180960 size: 13326
-ret: 0 st:-1 flags:0 ts: 0.460008
-ret: 0 st: 0 flags:1 dts: 0.880000 pts: NOPTS pos: 153812 size: 13382
-ret:-1 st:-1 flags:1 ts:-0.645825
diff --git a/gst-libs/ext/libav/tests/ref/seek/mpeg4_thread_avi b/gst-libs/ext/libav/tests/ref/seek/mpeg4_thread_avi
deleted file mode 100644
index 8c97827..0000000
--- a/gst-libs/ext/libav/tests/ref/seek/mpeg4_thread_avi
+++ /dev/null
@@ -1,46 +0,0 @@
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 5660 size: 14874
-ret: 0 st:-1 flags:0 ts:-1.000000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 5660 size: 14874
-ret: 0 st:-1 flags:1 ts: 1.894167
-ret: 0 st: 0 flags:1 dts: 1.840000 pts: NOPTS pos: 228222 size: 16324
-ret: 0 st: 0 flags:0 ts: 0.800000
-ret: 0 st: 0 flags:1 dts: 0.880000 pts: NOPTS pos: 162162 size: 16475
-ret:-1 st: 0 flags:1 ts:-0.320000
-ret:-1 st:-1 flags:0 ts: 2.576668
-ret: 0 st:-1 flags:1 ts: 1.470835
-ret: 0 st: 0 flags:1 dts: 1.360000 pts: NOPTS pos: 195332 size: 16136
-ret: 0 st: 0 flags:0 ts: 0.360000
-ret: 0 st: 0 flags:1 dts: 0.400000 pts: NOPTS pos: 97844 size: 33332
-ret:-1 st: 0 flags:1 ts:-0.760000
-ret:-1 st:-1 flags:0 ts: 2.153336
-ret: 0 st:-1 flags:1 ts: 1.047503
-ret: 0 st: 0 flags:1 dts: 0.880000 pts: NOPTS pos: 162162 size: 16475
-ret: 0 st: 0 flags:0 ts:-0.040000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 5660 size: 14874
-ret: 0 st: 0 flags:1 ts: 2.840000
-ret: 0 st: 0 flags:1 dts: 1.840000 pts: NOPTS pos: 228222 size: 16324
-ret: 0 st:-1 flags:0 ts: 1.730004
-ret: 0 st: 0 flags:1 dts: 1.840000 pts: NOPTS pos: 228222 size: 16324
-ret: 0 st:-1 flags:1 ts: 0.624171
-ret: 0 st: 0 flags:1 dts: 0.400000 pts: NOPTS pos: 97844 size: 33332
-ret: 0 st: 0 flags:0 ts:-0.480000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 5660 size: 14874
-ret: 0 st: 0 flags:1 ts: 2.400000
-ret: 0 st: 0 flags:1 dts: 1.840000 pts: NOPTS pos: 228222 size: 16324
-ret: 0 st:-1 flags:0 ts: 1.306672
-ret: 0 st: 0 flags:1 dts: 1.360000 pts: NOPTS pos: 195332 size: 16136
-ret: 0 st:-1 flags:1 ts: 0.200839
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 5660 size: 14874
-ret: 0 st: 0 flags:0 ts:-0.920000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 5660 size: 14874
-ret: 0 st: 0 flags:1 ts: 2.000000
-ret: 0 st: 0 flags:1 dts: 1.840000 pts: NOPTS pos: 228222 size: 16324
-ret: 0 st:-1 flags:0 ts: 0.883340
-ret: 0 st: 0 flags:1 dts: 0.880000 pts: NOPTS pos: 162162 size: 16475
-ret:-1 st:-1 flags:1 ts:-0.222493
-ret:-1 st: 0 flags:0 ts: 2.680000
-ret: 0 st: 0 flags:1 ts: 1.560000
-ret: 0 st: 0 flags:1 dts: 1.360000 pts: NOPTS pos: 195332 size: 16136
-ret: 0 st:-1 flags:0 ts: 0.460008
-ret: 0 st: 0 flags:1 dts: 0.880000 pts: NOPTS pos: 162162 size: 16475
-ret:-1 st:-1 flags:1 ts:-0.645825
diff --git a/gst-libs/ext/libav/tests/ref/seek/msmpeg4_avi b/gst-libs/ext/libav/tests/ref/seek/msmpeg4_avi
deleted file mode 100644
index fafd442..0000000
--- a/gst-libs/ext/libav/tests/ref/seek/msmpeg4_avi
+++ /dev/null
@@ -1,46 +0,0 @@
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5660 size: 8637
-ret: 0 st:-1 flags:0 ts:-1.000000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5660 size: 8637
-ret: 0 st:-1 flags:1 ts: 1.894167
-ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 82520 size: 10783
-ret: 0 st: 0 flags:0 ts: 0.800000
-ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 53858 size: 9624
-ret:-1 st: 0 flags:1 ts:-0.320000
-ret:-1 st:-1 flags:0 ts: 2.576668
-ret: 0 st:-1 flags:1 ts: 1.470835
-ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 82520 size: 10783
-ret: 0 st: 0 flags:0 ts: 0.360000
-ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 29400 size: 8502
-ret:-1 st: 0 flags:1 ts:-0.760000
-ret:-1 st:-1 flags:0 ts: 2.153336
-ret: 0 st:-1 flags:1 ts: 1.047503
-ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 53858 size: 9624
-ret: 0 st: 0 flags:0 ts:-0.040000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5660 size: 8637
-ret: 0 st: 0 flags:1 ts: 2.840000
-ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 114276 size: 11180
-ret: 0 st:-1 flags:0 ts: 1.730004
-ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 114276 size: 11180
-ret: 0 st:-1 flags:1 ts: 0.624171
-ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 29400 size: 8502
-ret: 0 st: 0 flags:0 ts:-0.480000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5660 size: 8637
-ret: 0 st: 0 flags:1 ts: 2.400000
-ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 114276 size: 11180
-ret: 0 st:-1 flags:0 ts: 1.306672
-ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 82520 size: 10783
-ret: 0 st:-1 flags:1 ts: 0.200839
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5660 size: 8637
-ret: 0 st: 0 flags:0 ts:-0.920000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5660 size: 8637
-ret: 0 st: 0 flags:1 ts: 2.000000
-ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 114276 size: 11180
-ret: 0 st:-1 flags:0 ts: 0.883340
-ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 53858 size: 9624
-ret:-1 st:-1 flags:1 ts:-0.222493
-ret:-1 st: 0 flags:0 ts: 2.680000
-ret: 0 st: 0 flags:1 ts: 1.560000
-ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 82520 size: 10783
-ret: 0 st:-1 flags:0 ts: 0.460008
-ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 29400 size: 8502
-ret:-1 st:-1 flags:1 ts:-0.645825
diff --git a/gst-libs/ext/libav/tests/ref/seek/msmpeg4v2_avi b/gst-libs/ext/libav/tests/ref/seek/msmpeg4v2_avi
deleted file mode 100644
index 566ade0..0000000
--- a/gst-libs/ext/libav/tests/ref/seek/msmpeg4v2_avi
+++ /dev/null
@@ -1,46 +0,0 @@
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5660 size: 9003
-ret: 0 st:-1 flags:0 ts:-1.000000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5660 size: 9003
-ret: 0 st:-1 flags:1 ts: 1.894167
-ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 83882 size: 11165
-ret: 0 st: 0 flags:0 ts: 0.800000
-ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 54790 size: 10010
-ret:-1 st: 0 flags:1 ts:-0.320000
-ret:-1 st:-1 flags:0 ts: 2.576668
-ret: 0 st:-1 flags:1 ts: 1.470835
-ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 83882 size: 11165
-ret: 0 st: 0 flags:0 ts: 0.360000
-ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 29782 size: 8869
-ret:-1 st: 0 flags:1 ts:-0.760000
-ret:-1 st:-1 flags:0 ts: 2.153336
-ret: 0 st:-1 flags:1 ts: 1.047503
-ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 54790 size: 10010
-ret: 0 st: 0 flags:0 ts:-0.040000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5660 size: 9003
-ret: 0 st: 0 flags:1 ts: 2.840000
-ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 116112 size: 11578
-ret: 0 st:-1 flags:0 ts: 1.730004
-ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 116112 size: 11578
-ret: 0 st:-1 flags:1 ts: 0.624171
-ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 29782 size: 8869
-ret: 0 st: 0 flags:0 ts:-0.480000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5660 size: 9003
-ret: 0 st: 0 flags:1 ts: 2.400000
-ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 116112 size: 11578
-ret: 0 st:-1 flags:0 ts: 1.306672
-ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 83882 size: 11165
-ret: 0 st:-1 flags:1 ts: 0.200839
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5660 size: 9003
-ret: 0 st: 0 flags:0 ts:-0.920000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5660 size: 9003
-ret: 0 st: 0 flags:1 ts: 2.000000
-ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 116112 size: 11578
-ret: 0 st:-1 flags:0 ts: 0.883340
-ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 54790 size: 10010
-ret:-1 st:-1 flags:1 ts:-0.222493
-ret:-1 st: 0 flags:0 ts: 2.680000
-ret: 0 st: 0 flags:1 ts: 1.560000
-ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 83882 size: 11165
-ret: 0 st:-1 flags:0 ts: 0.460008
-ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 29782 size: 8869
-ret:-1 st:-1 flags:1 ts:-0.645825
diff --git a/gst-libs/ext/libav/tests/ref/seek/pcm_alaw_wav b/gst-libs/ext/libav/tests/ref/seek/pcm_alaw_wav
deleted file mode 100644
index 22d95bf..0000000
--- a/gst-libs/ext/libav/tests/ref/seek/pcm_alaw_wav
+++ /dev/null
@@ -1,53 +0,0 @@
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 58 size: 4096
-ret: 0 st:-1 flags:0 ts:-1.000000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 58 size: 4096
-ret: 0 st:-1 flags:1 ts: 1.894167
-ret: 0 st: 0 flags:1 dts: 1.894127 pts: 1.894127 pos: 30364 size: 4096
-ret: 0 st: 0 flags:0 ts: 0.788345
-ret: 0 st: 0 flags:1 dts: 0.788367 pts: 0.788367 pos: 12672 size: 4096
-ret: 0 st: 0 flags:1 ts:-0.317506
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 58 size: 4096
-ret: 0 st:-1 flags:0 ts: 2.576668
-ret: 0 st: 0 flags:1 dts: 2.576757 pts: 2.576757 pos: 41286 size: 4096
-ret: 0 st:-1 flags:1 ts: 1.470835
-ret: 0 st: 0 flags:1 dts: 1.470748 pts: 1.470748 pos: 23590 size: 4096
-ret: 0 st: 0 flags:0 ts: 0.365011
-ret: 0 st: 0 flags:1 dts: 0.365125 pts: 0.365125 pos: 5900 size: 4096
-ret: 0 st: 0 flags:1 ts:-0.740839
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 58 size: 4096
-ret: 0 st:-1 flags:0 ts: 2.153336
-ret: 0 st: 0 flags:1 dts: 2.153379 pts: 2.153379 pos: 34512 size: 4096
-ret: 0 st:-1 flags:1 ts: 1.047503
-ret: 0 st: 0 flags:1 dts: 1.047506 pts: 1.047506 pos: 16818 size: 4096
-ret: 0 st: 0 flags:0 ts:-0.058322
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 58 size: 4096
-ret: 0 st: 0 flags:1 ts: 2.835828
-ret: 0 st: 0 flags:1 dts: 2.835760 pts: 2.835760 pos: 45430 size: 4096
-ret: 0 st:-1 flags:0 ts: 1.730004
-ret: 0 st: 0 flags:1 dts: 1.730000 pts: 1.730000 pos: 27738 size: 4096
-ret: 0 st:-1 flags:1 ts: 0.624171
-ret: 0 st: 0 flags:1 dts: 0.624127 pts: 0.624127 pos: 10044 size: 4096
-ret: 0 st: 0 flags:0 ts:-0.481655
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 58 size: 4096
-ret: 0 st: 0 flags:1 ts: 2.412494
-ret: 0 st: 0 flags:1 dts: 2.412381 pts: 2.412381 pos: 38656 size: 4096
-ret: 0 st:-1 flags:0 ts: 1.306672
-ret: 0 st: 0 flags:1 dts: 1.306757 pts: 1.306757 pos: 20966 size: 4096
-ret: 0 st:-1 flags:1 ts: 0.200839
-ret: 0 st: 0 flags:1 dts: 0.200748 pts: 0.200748 pos: 3270 size: 4096
-ret: 0 st: 0 flags:0 ts:-0.904989
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 58 size: 4096
-ret: 0 st: 0 flags:1 ts: 1.989184
-ret: 0 st: 0 flags:1 dts: 1.989116 pts: 1.989116 pos: 31884 size: 4096
-ret: 0 st:-1 flags:0 ts: 0.883340
-ret: 0 st: 0 flags:1 dts: 0.883379 pts: 0.883379 pos: 14192 size: 4096
-ret: 0 st:-1 flags:1 ts:-0.222493
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 58 size: 4096
-ret: 0 st: 0 flags:0 ts: 2.671678
-ret: 0 st: 0 flags:1 dts: 2.671746 pts: 2.671746 pos: 42806 size: 4096
-ret: 0 st: 0 flags:1 ts: 1.565850
-ret: 0 st: 0 flags:1 dts: 1.565760 pts: 1.565760 pos: 25110 size: 4096
-ret: 0 st:-1 flags:0 ts: 0.460008
-ret: 0 st: 0 flags:1 dts: 0.460000 pts: 0.460000 pos: 7418 size: 4096
-ret: 0 st:-1 flags:1 ts:-0.645825
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 58 size: 4096
diff --git a/gst-libs/ext/libav/tests/ref/seek/pcm_mulaw_wav b/gst-libs/ext/libav/tests/ref/seek/pcm_mulaw_wav
deleted file mode 100644
index 22d95bf..0000000
--- a/gst-libs/ext/libav/tests/ref/seek/pcm_mulaw_wav
+++ /dev/null
@@ -1,53 +0,0 @@
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 58 size: 4096
-ret: 0 st:-1 flags:0 ts:-1.000000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 58 size: 4096
-ret: 0 st:-1 flags:1 ts: 1.894167
-ret: 0 st: 0 flags:1 dts: 1.894127 pts: 1.894127 pos: 30364 size: 4096
-ret: 0 st: 0 flags:0 ts: 0.788345
-ret: 0 st: 0 flags:1 dts: 0.788367 pts: 0.788367 pos: 12672 size: 4096
-ret: 0 st: 0 flags:1 ts:-0.317506
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 58 size: 4096
-ret: 0 st:-1 flags:0 ts: 2.576668
-ret: 0 st: 0 flags:1 dts: 2.576757 pts: 2.576757 pos: 41286 size: 4096
-ret: 0 st:-1 flags:1 ts: 1.470835
-ret: 0 st: 0 flags:1 dts: 1.470748 pts: 1.470748 pos: 23590 size: 4096
-ret: 0 st: 0 flags:0 ts: 0.365011
-ret: 0 st: 0 flags:1 dts: 0.365125 pts: 0.365125 pos: 5900 size: 4096
-ret: 0 st: 0 flags:1 ts:-0.740839
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 58 size: 4096
-ret: 0 st:-1 flags:0 ts: 2.153336
-ret: 0 st: 0 flags:1 dts: 2.153379 pts: 2.153379 pos: 34512 size: 4096
-ret: 0 st:-1 flags:1 ts: 1.047503
-ret: 0 st: 0 flags:1 dts: 1.047506 pts: 1.047506 pos: 16818 size: 4096
-ret: 0 st: 0 flags:0 ts:-0.058322
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 58 size: 4096
-ret: 0 st: 0 flags:1 ts: 2.835828
-ret: 0 st: 0 flags:1 dts: 2.835760 pts: 2.835760 pos: 45430 size: 4096
-ret: 0 st:-1 flags:0 ts: 1.730004
-ret: 0 st: 0 flags:1 dts: 1.730000 pts: 1.730000 pos: 27738 size: 4096
-ret: 0 st:-1 flags:1 ts: 0.624171
-ret: 0 st: 0 flags:1 dts: 0.624127 pts: 0.624127 pos: 10044 size: 4096
-ret: 0 st: 0 flags:0 ts:-0.481655
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 58 size: 4096
-ret: 0 st: 0 flags:1 ts: 2.412494
-ret: 0 st: 0 flags:1 dts: 2.412381 pts: 2.412381 pos: 38656 size: 4096
-ret: 0 st:-1 flags:0 ts: 1.306672
-ret: 0 st: 0 flags:1 dts: 1.306757 pts: 1.306757 pos: 20966 size: 4096
-ret: 0 st:-1 flags:1 ts: 0.200839
-ret: 0 st: 0 flags:1 dts: 0.200748 pts: 0.200748 pos: 3270 size: 4096
-ret: 0 st: 0 flags:0 ts:-0.904989
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 58 size: 4096
-ret: 0 st: 0 flags:1 ts: 1.989184
-ret: 0 st: 0 flags:1 dts: 1.989116 pts: 1.989116 pos: 31884 size: 4096
-ret: 0 st:-1 flags:0 ts: 0.883340
-ret: 0 st: 0 flags:1 dts: 0.883379 pts: 0.883379 pos: 14192 size: 4096
-ret: 0 st:-1 flags:1 ts:-0.222493
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 58 size: 4096
-ret: 0 st: 0 flags:0 ts: 2.671678
-ret: 0 st: 0 flags:1 dts: 2.671746 pts: 2.671746 pos: 42806 size: 4096
-ret: 0 st: 0 flags:1 ts: 1.565850
-ret: 0 st: 0 flags:1 dts: 1.565760 pts: 1.565760 pos: 25110 size: 4096
-ret: 0 st:-1 flags:0 ts: 0.460008
-ret: 0 st: 0 flags:1 dts: 0.460000 pts: 0.460000 pos: 7418 size: 4096
-ret: 0 st:-1 flags:1 ts:-0.645825
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 58 size: 4096
diff --git a/gst-libs/ext/libav/tests/ref/seek/pcm_s24daud_302 b/gst-libs/ext/libav/tests/ref/seek/pcm_s24daud_302
deleted file mode 100644
index 5c9b6d9..0000000
--- a/gst-libs/ext/libav/tests/ref/seek/pcm_s24daud_302
+++ /dev/null
@@ -1,27 +0,0 @@
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 4 size: 39816
-ret:-1 st:-1 flags:0 ts:-1.000000
-ret:-1 st:-1 flags:1 ts: 1.894167
-ret:-1 st: 0 flags:0 ts: 0.788333
-ret:-1 st: 0 flags:1 ts:-0.317500
-ret:-1 st:-1 flags:0 ts: 2.576668
-ret:-1 st:-1 flags:1 ts: 1.470835
-ret:-1 st: 0 flags:0 ts: 0.365000
-ret:-1 st: 0 flags:1 ts:-0.740833
-ret:-1 st:-1 flags:0 ts: 2.153336
-ret:-1 st:-1 flags:1 ts: 1.047503
-ret:-1 st: 0 flags:0 ts:-0.058333
-ret:-1 st: 0 flags:1 ts: 2.835833
-ret:-1 st:-1 flags:0 ts: 1.730004
-ret:-1 st:-1 flags:1 ts: 0.624171
-ret:-1 st: 0 flags:0 ts:-0.481667
-ret:-1 st: 0 flags:1 ts: 2.412500
-ret:-1 st:-1 flags:0 ts: 1.306672
-ret:-1 st:-1 flags:1 ts: 0.200839
-ret:-1 st: 0 flags:0 ts:-0.904989
-ret:-1 st: 0 flags:1 ts: 1.989178
-ret:-1 st:-1 flags:0 ts: 0.883340
-ret:-1 st:-1 flags:1 ts:-0.222493
-ret:-1 st: 0 flags:0 ts: 2.671678
-ret:-1 st: 0 flags:1 ts: 1.565844
-ret:-1 st:-1 flags:0 ts: 0.460008
-ret:-1 st:-1 flags:1 ts:-0.645825
diff --git a/gst-libs/ext/libav/tests/ref/seek/rgb_avi b/gst-libs/ext/libav/tests/ref/seek/rgb_avi
deleted file mode 100644
index 888032b..0000000
--- a/gst-libs/ext/libav/tests/ref/seek/rgb_avi
+++ /dev/null
@@ -1,46 +0,0 @@
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5660 size:304128
-ret: 0 st:-1 flags:0 ts:-1.000000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5660 size:304128
-ret: 0 st:-1 flags:1 ts: 1.894167
-ret: 0 st: 0 flags:1 dts: 1.880000 pts: 1.880000 pos:14300052 size:304128
-ret: 0 st: 0 flags:0 ts: 0.800000
-ret: 0 st: 0 flags:1 dts: 0.800000 pts: 0.800000 pos:6088380 size:304128
-ret:-1 st: 0 flags:1 ts:-0.320000
-ret:-1 st:-1 flags:0 ts: 2.576668
-ret: 0 st:-1 flags:1 ts: 1.470835
-ret: 0 st: 0 flags:1 dts: 1.480000 pts: 1.480000 pos:11258692 size:304128
-ret: 0 st: 0 flags:0 ts: 0.360000
-ret: 0 st: 0 flags:1 dts: 0.360000 pts: 0.360000 pos:2742884 size:304128
-ret:-1 st: 0 flags:1 ts:-0.760000
-ret:-1 st:-1 flags:0 ts: 2.153336
-ret: 0 st:-1 flags:1 ts: 1.047503
-ret: 0 st: 0 flags:1 dts: 1.040000 pts: 1.040000 pos:7913196 size:304128
-ret: 0 st: 0 flags:0 ts:-0.040000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5660 size:304128
-ret: 0 st: 0 flags:1 ts: 2.840000
-ret: 0 st: 0 flags:1 dts: 1.960000 pts: 1.960000 pos:14908324 size:304128
-ret: 0 st:-1 flags:0 ts: 1.730004
-ret: 0 st: 0 flags:1 dts: 1.720000 pts: 1.720000 pos:13083508 size:304128
-ret: 0 st:-1 flags:1 ts: 0.624171
-ret: 0 st: 0 flags:1 dts: 0.640000 pts: 0.640000 pos:4871836 size:304128
-ret: 0 st: 0 flags:0 ts:-0.480000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5660 size:304128
-ret: 0 st: 0 flags:1 ts: 2.400000
-ret: 0 st: 0 flags:1 dts: 1.960000 pts: 1.960000 pos:14908324 size:304128
-ret: 0 st:-1 flags:0 ts: 1.306672
-ret: 0 st: 0 flags:1 dts: 1.320000 pts: 1.320000 pos:10042148 size:304128
-ret: 0 st:-1 flags:1 ts: 0.200839
-ret: 0 st: 0 flags:1 dts: 0.200000 pts: 0.200000 pos:1526340 size:304128
-ret: 0 st: 0 flags:0 ts:-0.920000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5660 size:304128
-ret: 0 st: 0 flags:1 ts: 2.000000
-ret: 0 st: 0 flags:1 dts: 1.960000 pts: 1.960000 pos:14908324 size:304128
-ret: 0 st:-1 flags:0 ts: 0.883340
-ret: 0 st: 0 flags:1 dts: 0.880000 pts: 0.880000 pos:6696652 size:304128
-ret:-1 st:-1 flags:1 ts:-0.222493
-ret:-1 st: 0 flags:0 ts: 2.680000
-ret: 0 st: 0 flags:1 ts: 1.560000
-ret: 0 st: 0 flags:1 dts: 1.560000 pts: 1.560000 pos:11866964 size:304128
-ret: 0 st:-1 flags:0 ts: 0.460008
-ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos:3655292 size:304128
-ret:-1 st:-1 flags:1 ts:-0.645825
diff --git a/gst-libs/ext/libav/tests/ref/seek/snow53_avi b/gst-libs/ext/libav/tests/ref/seek/snow53_avi
deleted file mode 100644
index 5eb0ba0..0000000
--- a/gst-libs/ext/libav/tests/ref/seek/snow53_avi
+++ /dev/null
@@ -1,46 +0,0 @@
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5660 size: 72476
-ret: 0 st:-1 flags:0 ts:-1.000000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5660 size: 72476
-ret: 0 st:-1 flags:1 ts: 1.894167
-ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos:1902800 size: 78837
-ret: 0 st: 0 flags:0 ts: 0.800000
-ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos:1239102 size: 74994
-ret:-1 st: 0 flags:1 ts:-0.320000
-ret:-1 st:-1 flags:0 ts: 2.576668
-ret: 0 st:-1 flags:1 ts: 1.470835
-ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos:1902800 size: 78837
-ret: 0 st: 0 flags:0 ts: 0.360000
-ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 605640 size: 71059
-ret:-1 st: 0 flags:1 ts:-0.760000
-ret:-1 st:-1 flags:0 ts: 2.153336
-ret: 0 st:-1 flags:1 ts: 1.047503
-ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos:1239102 size: 74994
-ret: 0 st: 0 flags:0 ts:-0.040000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5660 size: 72476
-ret: 0 st: 0 flags:1 ts: 2.840000
-ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos:2585626 size: 79731
-ret: 0 st:-1 flags:0 ts: 1.730004
-ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos:2585626 size: 79731
-ret: 0 st:-1 flags:1 ts: 0.624171
-ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 605640 size: 71059
-ret: 0 st: 0 flags:0 ts:-0.480000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5660 size: 72476
-ret: 0 st: 0 flags:1 ts: 2.400000
-ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos:2585626 size: 79731
-ret: 0 st:-1 flags:0 ts: 1.306672
-ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos:1902800 size: 78837
-ret: 0 st:-1 flags:1 ts: 0.200839
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5660 size: 72476
-ret: 0 st: 0 flags:0 ts:-0.920000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5660 size: 72476
-ret: 0 st: 0 flags:1 ts: 2.000000
-ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos:2585626 size: 79731
-ret: 0 st:-1 flags:0 ts: 0.883340
-ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos:1239102 size: 74994
-ret:-1 st:-1 flags:1 ts:-0.222493
-ret:-1 st: 0 flags:0 ts: 2.680000
-ret: 0 st: 0 flags:1 ts: 1.560000
-ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos:1902800 size: 78837
-ret: 0 st:-1 flags:0 ts: 0.460008
-ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 605640 size: 71059
-ret:-1 st:-1 flags:1 ts:-0.645825
diff --git a/gst-libs/ext/libav/tests/ref/seek/snow_avi b/gst-libs/ext/libav/tests/ref/seek/snow_avi
deleted file mode 100644
index 39f8ac8..0000000
--- a/gst-libs/ext/libav/tests/ref/seek/snow_avi
+++ /dev/null
@@ -1,46 +0,0 @@
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5660 size: 3035
-ret: 0 st:-1 flags:0 ts:-1.000000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5660 size: 3035
-ret: 0 st:-1 flags:1 ts: 1.894167
-ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 39726 size: 3640
-ret: 0 st: 0 flags:0 ts: 0.800000
-ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 27446 size: 3494
-ret:-1 st: 0 flags:1 ts:-0.320000
-ret:-1 st:-1 flags:0 ts: 2.576668
-ret: 0 st:-1 flags:1 ts: 1.470835
-ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 39726 size: 3640
-ret: 0 st: 0 flags:0 ts: 0.360000
-ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 16136 size: 3244
-ret:-1 st: 0 flags:1 ts:-0.760000
-ret:-1 st:-1 flags:0 ts: 2.153336
-ret: 0 st:-1 flags:1 ts: 1.047503
-ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 27446 size: 3494
-ret: 0 st: 0 flags:0 ts:-0.040000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5660 size: 3035
-ret: 0 st: 0 flags:1 ts: 2.840000
-ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 52616 size: 3582
-ret: 0 st:-1 flags:0 ts: 1.730004
-ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 52616 size: 3582
-ret: 0 st:-1 flags:1 ts: 0.624171
-ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 16136 size: 3244
-ret: 0 st: 0 flags:0 ts:-0.480000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5660 size: 3035
-ret: 0 st: 0 flags:1 ts: 2.400000
-ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 52616 size: 3582
-ret: 0 st:-1 flags:0 ts: 1.306672
-ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 39726 size: 3640
-ret: 0 st:-1 flags:1 ts: 0.200839
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5660 size: 3035
-ret: 0 st: 0 flags:0 ts:-0.920000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5660 size: 3035
-ret: 0 st: 0 flags:1 ts: 2.000000
-ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 52616 size: 3582
-ret: 0 st:-1 flags:0 ts: 0.883340
-ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 27446 size: 3494
-ret:-1 st:-1 flags:1 ts:-0.222493
-ret:-1 st: 0 flags:0 ts: 2.680000
-ret: 0 st: 0 flags:1 ts: 1.560000
-ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 39726 size: 3640
-ret: 0 st:-1 flags:0 ts: 0.460008
-ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 16136 size: 3244
-ret:-1 st:-1 flags:1 ts:-0.645825
diff --git a/gst-libs/ext/libav/tests/ref/seek/vsynth2-asv1 b/gst-libs/ext/libav/tests/ref/seek/vsynth2-asv1
new file mode 100644
index 0000000..5873bb1
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/seek/vsynth2-asv1
@@ -0,0 +1,46 @@
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5656 size: 14316
+ret: 0 st:-1 flags:0 ts:-1.000000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5656 size: 14316
+ret: 0 st:-1 flags:1 ts: 1.894167
+ret: 0 st: 0 flags:1 dts: 1.880000 pts: 1.880000 pos: 776840 size: 18256
+ret: 0 st: 0 flags:0 ts: 0.800000
+ret: 0 st: 0 flags:1 dts: 0.800000 pts: 0.800000 pos: 305352 size: 16180
+ret:-1 st: 0 flags:1 ts:-0.320000
+ret:-1 st:-1 flags:0 ts: 2.576668
+ret: 0 st:-1 flags:1 ts: 1.470835
+ret: 0 st: 0 flags:1 dts: 1.480000 pts: 1.480000 pos: 595448 size: 17980
+ret: 0 st: 0 flags:0 ts: 0.360000
+ret: 0 st: 0 flags:1 dts: 0.360000 pts: 0.360000 pos: 135516 size: 14868
+ret:-1 st: 0 flags:1 ts:-0.760000
+ret:-1 st:-1 flags:0 ts: 2.153336
+ret: 0 st:-1 flags:1 ts: 1.047503
+ret: 0 st: 0 flags:1 dts: 1.040000 pts: 1.040000 pos: 404100 size: 16856
+ret: 0 st: 0 flags:0 ts:-0.040000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5656 size: 14316
+ret: 0 st: 0 flags:1 ts: 2.840000
+ret: 0 st: 0 flags:1 dts: 1.960000 pts: 1.960000 pos: 813396 size: 18296
+ret: 0 st:-1 flags:0 ts: 1.730004
+ret: 0 st: 0 flags:1 dts: 1.720000 pts: 1.720000 pos: 704136 size: 18140
+ret: 0 st:-1 flags:1 ts: 0.624171
+ret: 0 st: 0 flags:1 dts: 0.640000 pts: 0.640000 pos: 241764 size: 15736
+ret: 0 st: 0 flags:0 ts:-0.480000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5656 size: 14316
+ret: 0 st: 0 flags:1 ts: 2.400000
+ret: 0 st: 0 flags:1 dts: 1.960000 pts: 1.960000 pos: 813396 size: 18296
+ret: 0 st:-1 flags:0 ts: 1.306672
+ret: 0 st: 0 flags:1 dts: 1.320000 pts: 1.320000 pos: 524488 size: 17548
+ret: 0 st:-1 flags:1 ts: 0.200839
+ret: 0 st: 0 flags:1 dts: 0.200000 pts: 0.200000 pos: 77020 size: 14496
+ret: 0 st: 0 flags:0 ts:-0.920000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5656 size: 14316
+ret: 0 st: 0 flags:1 ts: 2.000000
+ret: 0 st: 0 flags:1 dts: 1.960000 pts: 1.960000 pos: 813396 size: 18296
+ret: 0 st:-1 flags:0 ts: 0.883340
+ret: 0 st: 0 flags:1 dts: 0.880000 pts: 0.880000 pos: 337808 size: 16388
+ret:-1 st:-1 flags:1 ts:-0.222493
+ret:-1 st: 0 flags:0 ts: 2.680000
+ret: 0 st: 0 flags:1 ts: 1.560000
+ret: 0 st: 0 flags:1 dts: 1.560000 pts: 1.560000 pos: 631584 size: 18188
+ret: 0 st:-1 flags:0 ts: 0.460008
+ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 180212 size: 15168
+ret:-1 st:-1 flags:1 ts:-0.645825
diff --git a/gst-libs/ext/libav/tests/ref/seek/vsynth2-asv2 b/gst-libs/ext/libav/tests/ref/seek/vsynth2-asv2
new file mode 100644
index 0000000..7d37b7a
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/seek/vsynth2-asv2
@@ -0,0 +1,46 @@
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5656 size: 13732
+ret: 0 st:-1 flags:0 ts:-1.000000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5656 size: 13732
+ret: 0 st:-1 flags:1 ts: 1.894167
+ret: 0 st: 0 flags:1 dts: 1.880000 pts: 1.880000 pos: 736152 size: 17340
+ret: 0 st: 0 flags:0 ts: 0.800000
+ret: 0 st: 0 flags:1 dts: 0.800000 pts: 0.800000 pos: 289708 size: 15300
+ret:-1 st: 0 flags:1 ts:-0.320000
+ret:-1 st:-1 flags:0 ts: 2.576668
+ret: 0 st:-1 flags:1 ts: 1.470835
+ret: 0 st: 0 flags:1 dts: 1.480000 pts: 1.480000 pos: 564140 size: 17016
+ret: 0 st: 0 flags:0 ts: 0.360000
+ret: 0 st: 0 flags:1 dts: 0.360000 pts: 0.360000 pos: 128564 size: 14052
+ret:-1 st: 0 flags:1 ts:-0.760000
+ret:-1 st:-1 flags:0 ts: 2.153336
+ret: 0 st:-1 flags:1 ts: 1.047503
+ret: 0 st: 0 flags:1 dts: 1.040000 pts: 1.040000 pos: 383244 size: 15896
+ret: 0 st: 0 flags:0 ts:-0.040000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5656 size: 13732
+ret: 0 st: 0 flags:1 ts: 2.840000
+ret: 0 st: 0 flags:1 dts: 1.960000 pts: 1.960000 pos: 770852 size: 17400
+ret: 0 st:-1 flags:0 ts: 1.730004
+ret: 0 st: 0 flags:1 dts: 1.720000 pts: 1.720000 pos: 667016 size: 17172
+ret: 0 st:-1 flags:1 ts: 0.624171
+ret: 0 st: 0 flags:1 dts: 0.640000 pts: 0.640000 pos: 229388 size: 14956
+ret: 0 st: 0 flags:0 ts:-0.480000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5656 size: 13732
+ret: 0 st: 0 flags:1 ts: 2.400000
+ret: 0 st: 0 flags:1 dts: 1.960000 pts: 1.960000 pos: 770852 size: 17400
+ret: 0 st:-1 flags:0 ts: 1.306672
+ret: 0 st: 0 flags:1 dts: 1.320000 pts: 1.320000 pos: 496932 size: 16564
+ret: 0 st:-1 flags:1 ts: 0.200839
+ret: 0 st: 0 flags:1 dts: 0.200000 pts: 0.200000 pos: 73176 size: 13664
+ret: 0 st: 0 flags:0 ts:-0.920000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5656 size: 13732
+ret: 0 st: 0 flags:1 ts: 2.000000
+ret: 0 st: 0 flags:1 dts: 1.960000 pts: 1.960000 pos: 770852 size: 17400
+ret: 0 st:-1 flags:0 ts: 0.883340
+ret: 0 st: 0 flags:1 dts: 0.880000 pts: 0.880000 pos: 320444 size: 15592
+ret:-1 st:-1 flags:1 ts:-0.222493
+ret:-1 st: 0 flags:0 ts: 2.680000
+ret: 0 st: 0 flags:1 ts: 1.560000
+ret: 0 st: 0 flags:1 dts: 1.560000 pts: 1.560000 pos: 598288 size: 17180
+ret: 0 st:-1 flags:0 ts: 0.460008
+ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 171012 size: 14392
+ret:-1 st:-1 flags:1 ts:-0.645825
diff --git a/gst-libs/ext/libav/tests/ref/seek/dnxhd_1080i_mov b/gst-libs/ext/libav/tests/ref/seek/vsynth2-dnxhd-1080i
index 6c41d67..6c41d67 100644
--- a/gst-libs/ext/libav/tests/ref/seek/dnxhd_1080i_mov
+++ b/gst-libs/ext/libav/tests/ref/seek/vsynth2-dnxhd-1080i
diff --git a/gst-libs/ext/libav/tests/ref/seek/vsynth2-dnxhd-720p b/gst-libs/ext/libav/tests/ref/seek/vsynth2-dnxhd-720p
new file mode 100644
index 0000000..b6398b6
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/seek/vsynth2-dnxhd-720p
@@ -0,0 +1,40 @@
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 0 size:458752
+ret: 0 st:-1 flags:0 ts:-1.000000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 0 size:458752
+ret: 0 st:-1 flags:1 ts: 1.894167
+ret: 0 st: 0 flags:1 dts: 0.160000 pts: 0.160000 pos:1835008 size:458752
+ret:-1 st: 0 flags:0 ts: 0.800000
+ret:-1 st: 0 flags:1 ts:-0.320000
+ret:-1 st:-1 flags:0 ts: 2.576668
+ret: 0 st:-1 flags:1 ts: 1.470835
+ret: 0 st: 0 flags:1 dts: 0.160000 pts: 0.160000 pos:1835008 size:458752
+ret:-1 st: 0 flags:0 ts: 0.360000
+ret:-1 st: 0 flags:1 ts:-0.760000
+ret:-1 st:-1 flags:0 ts: 2.153336
+ret: 0 st:-1 flags:1 ts: 1.047503
+ret: 0 st: 0 flags:1 dts: 0.160000 pts: 0.160000 pos:1835008 size:458752
+ret: 0 st: 0 flags:0 ts:-0.040000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 0 size:458752
+ret: 0 st: 0 flags:1 ts: 2.840000
+ret: 0 st: 0 flags:1 dts: 0.160000 pts: 0.160000 pos:1835008 size:458752
+ret:-1 st:-1 flags:0 ts: 1.730004
+ret: 0 st:-1 flags:1 ts: 0.624171
+ret: 0 st: 0 flags:1 dts: 0.160000 pts: 0.160000 pos:1835008 size:458752
+ret: 0 st: 0 flags:0 ts:-0.480000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 0 size:458752
+ret: 0 st: 0 flags:1 ts: 2.400000
+ret: 0 st: 0 flags:1 dts: 0.160000 pts: 0.160000 pos:1835008 size:458752
+ret:-1 st:-1 flags:0 ts: 1.306672
+ret: 0 st:-1 flags:1 ts: 0.200839
+ret: 0 st: 0 flags:1 dts: 0.160000 pts: 0.160000 pos:1835008 size:458752
+ret: 0 st: 0 flags:0 ts:-0.920000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 0 size:458752
+ret: 0 st: 0 flags:1 ts: 2.000000
+ret: 0 st: 0 flags:1 dts: 0.160000 pts: 0.160000 pos:1835008 size:458752
+ret:-1 st:-1 flags:0 ts: 0.883340
+ret:-1 st:-1 flags:1 ts:-0.222493
+ret:-1 st: 0 flags:0 ts: 2.680000
+ret: 0 st: 0 flags:1 ts: 1.560000
+ret: 0 st: 0 flags:1 dts: 0.160000 pts: 0.160000 pos:1835008 size:458752
+ret:-1 st:-1 flags:0 ts: 0.460008
+ret:-1 st:-1 flags:1 ts:-0.645825
diff --git a/gst-libs/ext/libav/tests/ref/seek/vsynth2-dnxhd-720p-rd b/gst-libs/ext/libav/tests/ref/seek/vsynth2-dnxhd-720p-rd
new file mode 100644
index 0000000..b6398b6
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/seek/vsynth2-dnxhd-720p-rd
@@ -0,0 +1,40 @@
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 0 size:458752
+ret: 0 st:-1 flags:0 ts:-1.000000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 0 size:458752
+ret: 0 st:-1 flags:1 ts: 1.894167
+ret: 0 st: 0 flags:1 dts: 0.160000 pts: 0.160000 pos:1835008 size:458752
+ret:-1 st: 0 flags:0 ts: 0.800000
+ret:-1 st: 0 flags:1 ts:-0.320000
+ret:-1 st:-1 flags:0 ts: 2.576668
+ret: 0 st:-1 flags:1 ts: 1.470835
+ret: 0 st: 0 flags:1 dts: 0.160000 pts: 0.160000 pos:1835008 size:458752
+ret:-1 st: 0 flags:0 ts: 0.360000
+ret:-1 st: 0 flags:1 ts:-0.760000
+ret:-1 st:-1 flags:0 ts: 2.153336
+ret: 0 st:-1 flags:1 ts: 1.047503
+ret: 0 st: 0 flags:1 dts: 0.160000 pts: 0.160000 pos:1835008 size:458752
+ret: 0 st: 0 flags:0 ts:-0.040000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 0 size:458752
+ret: 0 st: 0 flags:1 ts: 2.840000
+ret: 0 st: 0 flags:1 dts: 0.160000 pts: 0.160000 pos:1835008 size:458752
+ret:-1 st:-1 flags:0 ts: 1.730004
+ret: 0 st:-1 flags:1 ts: 0.624171
+ret: 0 st: 0 flags:1 dts: 0.160000 pts: 0.160000 pos:1835008 size:458752
+ret: 0 st: 0 flags:0 ts:-0.480000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 0 size:458752
+ret: 0 st: 0 flags:1 ts: 2.400000
+ret: 0 st: 0 flags:1 dts: 0.160000 pts: 0.160000 pos:1835008 size:458752
+ret:-1 st:-1 flags:0 ts: 1.306672
+ret: 0 st:-1 flags:1 ts: 0.200839
+ret: 0 st: 0 flags:1 dts: 0.160000 pts: 0.160000 pos:1835008 size:458752
+ret: 0 st: 0 flags:0 ts:-0.920000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 0 size:458752
+ret: 0 st: 0 flags:1 ts: 2.000000
+ret: 0 st: 0 flags:1 dts: 0.160000 pts: 0.160000 pos:1835008 size:458752
+ret:-1 st:-1 flags:0 ts: 0.883340
+ret:-1 st:-1 flags:1 ts:-0.222493
+ret:-1 st: 0 flags:0 ts: 2.680000
+ret: 0 st: 0 flags:1 ts: 1.560000
+ret: 0 st: 0 flags:1 dts: 0.160000 pts: 0.160000 pos:1835008 size:458752
+ret:-1 st:-1 flags:0 ts: 0.460008
+ret:-1 st:-1 flags:1 ts:-0.645825
diff --git a/gst-libs/ext/libav/tests/ref/seek/dv411_dv b/gst-libs/ext/libav/tests/ref/seek/vsynth2-dv
index baaeefb..baaeefb 100644
--- a/gst-libs/ext/libav/tests/ref/seek/dv411_dv
+++ b/gst-libs/ext/libav/tests/ref/seek/vsynth2-dv
diff --git a/gst-libs/ext/libav/tests/ref/seek/dv_dv b/gst-libs/ext/libav/tests/ref/seek/vsynth2-dv-411
index baaeefb..baaeefb 100644
--- a/gst-libs/ext/libav/tests/ref/seek/dv_dv
+++ b/gst-libs/ext/libav/tests/ref/seek/vsynth2-dv-411
diff --git a/gst-libs/ext/libav/tests/ref/seek/dv50_dv b/gst-libs/ext/libav/tests/ref/seek/vsynth2-dv-50
index 1f07e5b..1f07e5b 100644
--- a/gst-libs/ext/libav/tests/ref/seek/dv50_dv
+++ b/gst-libs/ext/libav/tests/ref/seek/vsynth2-dv-50
diff --git a/gst-libs/ext/libav/tests/ref/seek/vsynth2-ffv1 b/gst-libs/ext/libav/tests/ref/seek/vsynth2-ffv1
new file mode 100644
index 0000000..a1272f8
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/seek/vsynth2-ffv1
@@ -0,0 +1,46 @@
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5648 size: 70200
+ret: 0 st:-1 flags:0 ts:-1.000000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5648 size: 70200
+ret: 0 st:-1 flags:1 ts: 1.894167
+ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos:2485798 size: 74128
+ret: 0 st: 0 flags:0 ts: 0.800000
+ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos:1622704 size: 71128
+ret:-1 st: 0 flags:1 ts:-0.320000
+ret:-1 st:-1 flags:0 ts: 2.576668
+ret: 0 st:-1 flags:1 ts: 1.470835
+ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos:2485798 size: 74128
+ret: 0 st: 0 flags:0 ts: 0.360000
+ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 796828 size: 67971
+ret:-1 st: 0 flags:1 ts:-0.760000
+ret:-1 st:-1 flags:0 ts: 2.153336
+ret: 0 st:-1 flags:1 ts: 1.047503
+ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos:1622704 size: 71128
+ret: 0 st: 0 flags:0 ts:-0.040000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5648 size: 70200
+ret: 0 st: 0 flags:1 ts: 2.840000
+ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos:3374428 size: 75606
+ret: 0 st:-1 flags:0 ts: 1.730004
+ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos:3374428 size: 75606
+ret: 0 st:-1 flags:1 ts: 0.624171
+ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 796828 size: 67971
+ret: 0 st: 0 flags:0 ts:-0.480000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5648 size: 70200
+ret: 0 st: 0 flags:1 ts: 2.400000
+ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos:3374428 size: 75606
+ret: 0 st:-1 flags:0 ts: 1.306672
+ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos:2485798 size: 74128
+ret: 0 st:-1 flags:1 ts: 0.200839
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5648 size: 70200
+ret: 0 st: 0 flags:0 ts:-0.920000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5648 size: 70200
+ret: 0 st: 0 flags:1 ts: 2.000000
+ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos:3374428 size: 75606
+ret: 0 st:-1 flags:0 ts: 0.883340
+ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos:1622704 size: 71128
+ret:-1 st:-1 flags:1 ts:-0.222493
+ret:-1 st: 0 flags:0 ts: 2.680000
+ret: 0 st: 0 flags:1 ts: 1.560000
+ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos:2485798 size: 74128
+ret: 0 st:-1 flags:0 ts: 0.460008
+ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 796828 size: 67971
+ret:-1 st:-1 flags:1 ts:-0.645825
diff --git a/gst-libs/ext/libav/tests/ref/seek/flashsv_flv b/gst-libs/ext/libav/tests/ref/seek/vsynth2-flashsv
index 8bfb2fc..8bfb2fc 100644
--- a/gst-libs/ext/libav/tests/ref/seek/flashsv_flv
+++ b/gst-libs/ext/libav/tests/ref/seek/vsynth2-flashsv
diff --git a/gst-libs/ext/libav/tests/ref/seek/flv_flv b/gst-libs/ext/libav/tests/ref/seek/vsynth2-flv
index 6952a4e..6952a4e 100644
--- a/gst-libs/ext/libav/tests/ref/seek/flv_flv
+++ b/gst-libs/ext/libav/tests/ref/seek/vsynth2-flv
diff --git a/gst-libs/ext/libav/tests/ref/seek/vsynth2-h261 b/gst-libs/ext/libav/tests/ref/seek/vsynth2-h261
new file mode 100644
index 0000000..1789adc
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/seek/vsynth2-h261
@@ -0,0 +1,46 @@
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5648 size: 9645
+ret: 0 st:-1 flags:0 ts:-1.000000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5648 size: 9645
+ret: 0 st:-1 flags:1 ts: 1.894167
+ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 126502 size: 11377
+ret: 0 st: 0 flags:0 ts: 0.800000
+ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 82060 size: 10322
+ret:-1 st: 0 flags:1 ts:-0.320000
+ret:-1 st:-1 flags:0 ts: 2.576668
+ret: 0 st:-1 flags:1 ts: 1.470835
+ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 126502 size: 11377
+ret: 0 st: 0 flags:0 ts: 0.360000
+ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 44666 size: 9404
+ret:-1 st: 0 flags:1 ts:-0.760000
+ret:-1 st:-1 flags:0 ts: 2.153336
+ret: 0 st:-1 flags:1 ts: 1.047503
+ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 82060 size: 10322
+ret: 0 st: 0 flags:0 ts:-0.040000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5648 size: 9645
+ret: 0 st: 0 flags:1 ts: 2.840000
+ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 175870 size: 11707
+ret: 0 st:-1 flags:0 ts: 1.730004
+ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 175870 size: 11707
+ret: 0 st:-1 flags:1 ts: 0.624171
+ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 44666 size: 9404
+ret: 0 st: 0 flags:0 ts:-0.480000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5648 size: 9645
+ret: 0 st: 0 flags:1 ts: 2.400000
+ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 175870 size: 11707
+ret: 0 st:-1 flags:0 ts: 1.306672
+ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 126502 size: 11377
+ret: 0 st:-1 flags:1 ts: 0.200839
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5648 size: 9645
+ret: 0 st: 0 flags:0 ts:-0.920000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5648 size: 9645
+ret: 0 st: 0 flags:1 ts: 2.000000
+ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 175870 size: 11707
+ret: 0 st:-1 flags:0 ts: 0.883340
+ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 82060 size: 10322
+ret:-1 st:-1 flags:1 ts:-0.222493
+ret:-1 st: 0 flags:0 ts: 2.680000
+ret: 0 st: 0 flags:1 ts: 1.560000
+ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 126502 size: 11377
+ret: 0 st:-1 flags:0 ts: 0.460008
+ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 44666 size: 9404
+ret:-1 st:-1 flags:1 ts:-0.645825
diff --git a/gst-libs/ext/libav/tests/ref/seek/vsynth2-h263 b/gst-libs/ext/libav/tests/ref/seek/vsynth2-h263
new file mode 100644
index 0000000..b92074f
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/seek/vsynth2-h263
@@ -0,0 +1,46 @@
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5648 size: 10381
+ret: 0 st:-1 flags:0 ts:-1.000000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5648 size: 10381
+ret: 0 st:-1 flags:1 ts: 1.894167
+ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 103702 size: 12296
+ret: 0 st: 0 flags:0 ts: 0.800000
+ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 66792 size: 11128
+ret:-1 st: 0 flags:1 ts:-0.320000
+ret:-1 st:-1 flags:0 ts: 2.576668
+ret: 0 st:-1 flags:1 ts: 1.470835
+ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 103702 size: 12296
+ret: 0 st: 0 flags:0 ts: 0.360000
+ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 36438 size: 10090
+ret:-1 st: 0 flags:1 ts:-0.760000
+ret:-1 st:-1 flags:0 ts: 2.153336
+ret: 0 st:-1 flags:1 ts: 1.047503
+ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 66792 size: 11128
+ret: 0 st: 0 flags:0 ts:-0.040000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5648 size: 10381
+ret: 0 st: 0 flags:1 ts: 2.840000
+ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 144546 size: 12731
+ret: 0 st:-1 flags:0 ts: 1.730004
+ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 144546 size: 12731
+ret: 0 st:-1 flags:1 ts: 0.624171
+ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 36438 size: 10090
+ret: 0 st: 0 flags:0 ts:-0.480000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5648 size: 10381
+ret: 0 st: 0 flags:1 ts: 2.400000
+ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 144546 size: 12731
+ret: 0 st:-1 flags:0 ts: 1.306672
+ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 103702 size: 12296
+ret: 0 st:-1 flags:1 ts: 0.200839
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5648 size: 10381
+ret: 0 st: 0 flags:0 ts:-0.920000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5648 size: 10381
+ret: 0 st: 0 flags:1 ts: 2.000000
+ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 144546 size: 12731
+ret: 0 st:-1 flags:0 ts: 0.883340
+ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 66792 size: 11128
+ret:-1 st:-1 flags:1 ts:-0.222493
+ret:-1 st: 0 flags:0 ts: 2.680000
+ret: 0 st: 0 flags:1 ts: 1.560000
+ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 103702 size: 12296
+ret: 0 st:-1 flags:0 ts: 0.460008
+ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 36438 size: 10090
+ret:-1 st:-1 flags:1 ts:-0.645825
diff --git a/gst-libs/ext/libav/tests/ref/seek/vsynth2-h263p b/gst-libs/ext/libav/tests/ref/seek/vsynth2-h263p
new file mode 100644
index 0000000..9d842a6
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/seek/vsynth2-h263p
@@ -0,0 +1,46 @@
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5648 size: 36208
+ret: 0 st:-1 flags:0 ts:-1.000000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5648 size: 36208
+ret: 0 st:-1 flags:1 ts: 1.894167
+ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 569926 size: 45151
+ret: 0 st: 0 flags:0 ts: 0.800000
+ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 355976 size: 40907
+ret:-1 st: 0 flags:1 ts:-0.320000
+ret:-1 st:-1 flags:0 ts: 2.576668
+ret: 0 st:-1 flags:1 ts: 1.470835
+ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 569926 size: 45151
+ret: 0 st: 0 flags:0 ts: 0.360000
+ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 171042 size: 36515
+ret:-1 st: 0 flags:1 ts:-0.760000
+ret:-1 st:-1 flags:0 ts: 2.153336
+ret: 0 st:-1 flags:1 ts: 1.047503
+ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 355976 size: 40907
+ret: 0 st: 0 flags:0 ts:-0.040000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5648 size: 36208
+ret: 0 st: 0 flags:1 ts: 2.840000
+ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 804366 size: 46411
+ret: 0 st:-1 flags:0 ts: 1.730004
+ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 804366 size: 46411
+ret: 0 st:-1 flags:1 ts: 0.624171
+ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 171042 size: 36515
+ret: 0 st: 0 flags:0 ts:-0.480000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5648 size: 36208
+ret: 0 st: 0 flags:1 ts: 2.400000
+ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 804366 size: 46411
+ret: 0 st:-1 flags:0 ts: 1.306672
+ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 569926 size: 45151
+ret: 0 st:-1 flags:1 ts: 0.200839
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5648 size: 36208
+ret: 0 st: 0 flags:0 ts:-0.920000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5648 size: 36208
+ret: 0 st: 0 flags:1 ts: 2.000000
+ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 804366 size: 46411
+ret: 0 st:-1 flags:0 ts: 0.883340
+ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 355976 size: 40907
+ret:-1 st:-1 flags:1 ts:-0.222493
+ret:-1 st: 0 flags:0 ts: 2.680000
+ret: 0 st: 0 flags:1 ts: 1.560000
+ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 569926 size: 45151
+ret: 0 st:-1 flags:0 ts: 0.460008
+ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 171042 size: 36515
+ret:-1 st:-1 flags:1 ts:-0.645825
diff --git a/gst-libs/ext/libav/tests/ref/seek/vsynth2-huffyuv b/gst-libs/ext/libav/tests/ref/seek/vsynth2-huffyuv
new file mode 100644
index 0000000..69a37f5
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/seek/vsynth2-huffyuv
@@ -0,0 +1,46 @@
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5724 size:129760
+ret: 0 st:-1 flags:0 ts:-1.000000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5724 size:129760
+ret: 0 st:-1 flags:1 ts: 1.894167
+ret: 0 st: 0 flags:1 dts: 1.880000 pts: 1.880000 pos:6069172 size:128520
+ret: 0 st: 0 flags:0 ts: 0.800000
+ret: 0 st: 0 flags:1 dts: 0.800000 pts: 0.800000 pos:2579612 size:129192
+ret:-1 st: 0 flags:1 ts:-0.320000
+ret:-1 st:-1 flags:0 ts: 2.576668
+ret: 0 st:-1 flags:1 ts: 1.470835
+ret: 0 st: 0 flags:1 dts: 1.480000 pts: 1.480000 pos:4778228 size:129424
+ret: 0 st: 0 flags:0 ts: 0.360000
+ret: 0 st: 0 flags:1 dts: 0.360000 pts: 0.360000 pos:1160248 size:128504
+ret:-1 st: 0 flags:1 ts:-0.760000
+ret:-1 st:-1 flags:0 ts: 2.153336
+ret: 0 st:-1 flags:1 ts: 1.047503
+ret: 0 st: 0 flags:1 dts: 1.040000 pts: 1.040000 pos:3355284 size:129424
+ret: 0 st: 0 flags:0 ts:-0.040000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5724 size:129760
+ret: 0 st: 0 flags:1 ts: 2.840000
+ret: 0 st: 0 flags:1 dts: 1.960000 pts: 1.960000 pos:6326124 size:128288
+ret: 0 st:-1 flags:0 ts: 1.730004
+ret: 0 st: 0 flags:1 dts: 1.720000 pts: 1.720000 pos:5553996 size:129016
+ret: 0 st:-1 flags:1 ts: 0.624171
+ret: 0 st: 0 flags:1 dts: 0.640000 pts: 0.640000 pos:2062492 size:129204
+ret: 0 st: 0 flags:0 ts:-0.480000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5724 size:129760
+ret: 0 st: 0 flags:1 ts: 2.400000
+ret: 0 st: 0 flags:1 dts: 1.960000 pts: 1.960000 pos:6326124 size:128288
+ret: 0 st:-1 flags:0 ts: 1.306672
+ret: 0 st: 0 flags:1 dts: 1.320000 pts: 1.320000 pos:4260860 size:129280
+ret: 0 st:-1 flags:1 ts: 0.200839
+ret: 0 st: 0 flags:1 dts: 0.200000 pts: 0.200000 pos: 646908 size:128204
+ret: 0 st: 0 flags:0 ts:-0.920000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5724 size:129760
+ret: 0 st: 0 flags:1 ts: 2.000000
+ret: 0 st: 0 flags:1 dts: 1.960000 pts: 1.960000 pos:6326124 size:128288
+ret: 0 st:-1 flags:0 ts: 0.883340
+ret: 0 st: 0 flags:1 dts: 0.880000 pts: 0.880000 pos:2838068 size:129268
+ret:-1 st:-1 flags:1 ts:-0.222493
+ret:-1 st: 0 flags:0 ts: 2.680000
+ret: 0 st: 0 flags:1 ts: 1.560000
+ret: 0 st: 0 flags:1 dts: 1.560000 pts: 1.560000 pos:5037024 size:129284
+ret: 0 st:-1 flags:0 ts: 0.460008
+ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos:1546172 size:128860
+ret:-1 st:-1 flags:1 ts:-0.645825
diff --git a/gst-libs/ext/libav/tests/ref/seek/vsynth2-jpegls b/gst-libs/ext/libav/tests/ref/seek/vsynth2-jpegls
new file mode 100644
index 0000000..3c0da21
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/seek/vsynth2-jpegls
@@ -0,0 +1,46 @@
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5648 size:164074
+ret: 0 st:-1 flags:0 ts:-1.000000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5648 size:164074
+ret: 0 st:-1 flags:1 ts: 1.894167
+ret: 0 st: 0 flags:1 dts: 1.880000 pts: 1.880000 pos:7804118 size:176295
+ret: 0 st: 0 flags:0 ts: 0.800000
+ret: 0 st: 0 flags:1 dts: 0.800000 pts: 0.800000 pos:3172780 size:164643
+ret:-1 st: 0 flags:1 ts:-0.320000
+ret:-1 st:-1 flags:0 ts: 2.576668
+ret: 0 st:-1 flags:1 ts: 1.470835
+ret: 0 st: 0 flags:1 dts: 1.480000 pts: 1.480000 pos:6052974 size:174097
+ret: 0 st: 0 flags:0 ts: 0.360000
+ret: 0 st: 0 flags:1 dts: 0.360000 pts: 0.360000 pos:1402344 size:157283
+ret:-1 st: 0 flags:1 ts:-0.760000
+ret:-1 st:-1 flags:0 ts: 2.153336
+ret: 0 st:-1 flags:1 ts: 1.047503
+ret: 0 st: 0 flags:1 dts: 1.040000 pts: 1.040000 pos:4170248 size:168401
+ret: 0 st: 0 flags:0 ts:-0.040000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5648 size:164074
+ret: 0 st: 0 flags:1 ts: 2.840000
+ret: 0 st: 0 flags:1 dts: 1.960000 pts: 1.960000 pos:8157016 size:176793
+ret: 0 st:-1 flags:0 ts: 1.730004
+ret: 0 st: 0 flags:1 dts: 1.720000 pts: 1.720000 pos:7101754 size:175326
+ret: 0 st:-1 flags:1 ts: 0.624171
+ret: 0 st: 0 flags:1 dts: 0.640000 pts: 0.640000 pos:2519260 size:162522
+ret: 0 st: 0 flags:0 ts:-0.480000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5648 size:164074
+ret: 0 st: 0 flags:1 ts: 2.400000
+ret: 0 st: 0 flags:1 dts: 1.960000 pts: 1.960000 pos:8157016 size:176793
+ret: 0 st:-1 flags:0 ts: 1.306672
+ret: 0 st: 0 flags:1 dts: 1.320000 pts: 1.320000 pos:5360818 size:172183
+ret: 0 st:-1 flags:1 ts: 0.200839
+ret: 0 st: 0 flags:1 dts: 0.200000 pts: 0.200000 pos: 779834 size:154579
+ret: 0 st: 0 flags:0 ts:-0.920000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5648 size:164074
+ret: 0 st: 0 flags:1 ts: 2.000000
+ret: 0 st: 0 flags:1 dts: 1.960000 pts: 1.960000 pos:8157016 size:176793
+ret: 0 st:-1 flags:0 ts: 0.883340
+ret: 0 st: 0 flags:1 dts: 0.880000 pts: 0.880000 pos:3502828 size:166017
+ret:-1 st:-1 flags:1 ts:-0.222493
+ret:-1 st: 0 flags:0 ts: 2.680000
+ret: 0 st: 0 flags:1 ts: 1.560000
+ret: 0 st: 0 flags:1 dts: 1.560000 pts: 1.560000 pos:6401452 size:174815
+ret: 0 st:-1 flags:0 ts: 0.460008
+ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos:1876416 size:159659
+ret:-1 st:-1 flags:1 ts:-0.645825
diff --git a/gst-libs/ext/libav/tests/ref/seek/vsynth2-ljpeg b/gst-libs/ext/libav/tests/ref/seek/vsynth2-ljpeg
new file mode 100644
index 0000000..92264c9
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/seek/vsynth2-ljpeg
@@ -0,0 +1,46 @@
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5648 size: 96069
+ret: 0 st:-1 flags:0 ts:-1.000000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5648 size: 96069
+ret: 0 st:-1 flags:1 ts: 1.894167
+ret: 0 st: 0 flags:1 dts: 1.880000 pts: 1.880000 pos:4481864 size: 94870
+ret: 0 st: 0 flags:0 ts: 0.800000
+ret: 0 st: 0 flags:1 dts: 0.800000 pts: 0.800000 pos:1902318 size: 95465
+ret:-1 st: 0 flags:1 ts:-0.320000
+ret:-1 st:-1 flags:0 ts: 2.576668
+ret: 0 st:-1 flags:1 ts: 1.470835
+ret: 0 st: 0 flags:1 dts: 1.480000 pts: 1.480000 pos:3527724 size: 95724
+ret: 0 st: 0 flags:0 ts: 0.360000
+ret: 0 st: 0 flags:1 dts: 0.360000 pts: 0.360000 pos: 854944 size: 94635
+ret:-1 st: 0 flags:1 ts:-0.760000
+ret:-1 st:-1 flags:0 ts: 2.153336
+ret: 0 st:-1 flags:1 ts: 1.047503
+ret: 0 st: 0 flags:1 dts: 1.040000 pts: 1.040000 pos:2475566 size: 95649
+ret: 0 st: 0 flags:0 ts:-0.040000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5648 size: 96069
+ret: 0 st: 0 flags:1 ts: 2.840000
+ret: 0 st: 0 flags:1 dts: 1.960000 pts: 1.960000 pos:4671498 size: 94595
+ret: 0 st:-1 flags:0 ts: 1.730004
+ret: 0 st: 0 flags:1 dts: 1.720000 pts: 1.720000 pos:4101338 size: 95353
+ret: 0 st:-1 flags:1 ts: 0.624171
+ret: 0 st: 0 flags:1 dts: 0.640000 pts: 0.640000 pos:1520284 size: 95410
+ret: 0 st: 0 flags:0 ts:-0.480000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5648 size: 96069
+ret: 0 st: 0 flags:1 ts: 2.400000
+ret: 0 st: 0 flags:1 dts: 1.960000 pts: 1.960000 pos:4671498 size: 94595
+ret: 0 st:-1 flags:0 ts: 1.306672
+ret: 0 st: 0 flags:1 dts: 1.320000 pts: 1.320000 pos:3145114 size: 95587
+ret: 0 st:-1 flags:1 ts: 0.200839
+ret: 0 st: 0 flags:1 dts: 0.200000 pts: 0.200000 pos: 477226 size: 94261
+ret: 0 st: 0 flags:0 ts:-0.920000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5648 size: 96069
+ret: 0 st: 0 flags:1 ts: 2.000000
+ret: 0 st: 0 flags:1 dts: 1.960000 pts: 1.960000 pos:4671498 size: 94595
+ret: 0 st:-1 flags:0 ts: 0.883340
+ret: 0 st: 0 flags:1 dts: 0.880000 pts: 0.880000 pos:2093302 size: 95528
+ret:-1 st:-1 flags:1 ts:-0.222493
+ret:-1 st: 0 flags:0 ts: 2.680000
+ret: 0 st: 0 flags:1 ts: 1.560000
+ret: 0 st: 0 flags:1 dts: 1.560000 pts: 1.560000 pos:3719126 size: 95615
+ret: 0 st:-1 flags:0 ts: 0.460008
+ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos:1139238 size: 95032
+ret:-1 st:-1 flags:1 ts:-0.645825
diff --git a/gst-libs/ext/libav/tests/ref/seek/vsynth2-mjpeg b/gst-libs/ext/libav/tests/ref/seek/vsynth2-mjpeg
new file mode 100644
index 0000000..59db09a
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/seek/vsynth2-mjpeg
@@ -0,0 +1,46 @@
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5648 size: 12096
+ret: 0 st:-1 flags:0 ts:-1.000000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5648 size: 12096
+ret: 0 st:-1 flags:1 ts: 1.894167
+ret: 0 st: 0 flags:1 dts: 1.880000 pts: 1.880000 pos: 627854 size: 14811
+ret: 0 st: 0 flags:0 ts: 0.800000
+ret: 0 st: 0 flags:1 dts: 0.800000 pts: 0.800000 pos: 247488 size: 12959
+ret:-1 st: 0 flags:1 ts:-0.320000
+ret:-1 st:-1 flags:0 ts: 2.576668
+ret: 0 st:-1 flags:1 ts: 1.470835
+ret: 0 st: 0 flags:1 dts: 1.480000 pts: 1.480000 pos: 480758 size: 14528
+ret: 0 st: 0 flags:0 ts: 0.360000
+ret: 0 st: 0 flags:1 dts: 0.360000 pts: 0.360000 pos: 111000 size: 11927
+ret:-1 st: 0 flags:1 ts:-0.760000
+ret:-1 st:-1 flags:0 ts: 2.153336
+ret: 0 st:-1 flags:1 ts: 1.047503
+ret: 0 st: 0 flags:1 dts: 1.040000 pts: 1.040000 pos: 326672 size: 13489
+ret: 0 st: 0 flags:0 ts:-0.040000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5648 size: 12096
+ret: 0 st: 0 flags:1 ts: 2.840000
+ret: 0 st: 0 flags:1 dts: 1.960000 pts: 1.960000 pos: 657522 size: 14881
+ret: 0 st:-1 flags:0 ts: 1.730004
+ret: 0 st: 0 flags:1 dts: 1.720000 pts: 1.720000 pos: 568652 size: 14746
+ret: 0 st:-1 flags:1 ts: 0.624171
+ret: 0 st: 0 flags:1 dts: 0.640000 pts: 0.640000 pos: 196416 size: 12719
+ret: 0 st: 0 flags:0 ts:-0.480000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5648 size: 12096
+ret: 0 st: 0 flags:1 ts: 2.400000
+ret: 0 st: 0 flags:1 dts: 1.960000 pts: 1.960000 pos: 657522 size: 14881
+ret: 0 st:-1 flags:0 ts: 1.306672
+ret: 0 st: 0 flags:1 dts: 1.320000 pts: 1.320000 pos: 423482 size: 14119
+ret: 0 st:-1 flags:1 ts: 0.200839
+ret: 0 st: 0 flags:1 dts: 0.200000 pts: 0.200000 pos: 63860 size: 11714
+ret: 0 st: 0 flags:0 ts:-0.920000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5648 size: 12096
+ret: 0 st: 0 flags:1 ts: 2.000000
+ret: 0 st: 0 flags:1 dts: 1.960000 pts: 1.960000 pos: 657522 size: 14881
+ret: 0 st:-1 flags:0 ts: 0.883340
+ret: 0 st: 0 flags:1 dts: 0.880000 pts: 0.880000 pos: 273508 size: 13131
+ret:-1 st:-1 flags:1 ts:-0.222493
+ret:-1 st: 0 flags:0 ts: 2.680000
+ret: 0 st: 0 flags:1 ts: 1.560000
+ret: 0 st: 0 flags:1 dts: 1.560000 pts: 1.560000 pos: 509926 size: 14597
+ret: 0 st:-1 flags:0 ts: 0.460008
+ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 146958 size: 12168
+ret:-1 st:-1 flags:1 ts:-0.645825
diff --git a/gst-libs/ext/libav/tests/ref/seek/vsynth2-mpeg1 b/gst-libs/ext/libav/tests/ref/seek/vsynth2-mpeg1
new file mode 100644
index 0000000..a85055a
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/seek/vsynth2-mpeg1
@@ -0,0 +1,46 @@
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 0 size: 9779
+ret: 0 st:-1 flags:0 ts:-1.000000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 0 size: 9779
+ret: 0 st:-1 flags:1 ts: 1.894167
+ret: 0 st: 0 flags:1 dts: 1.440000 pts: NOPTS pos: 124245 size: 11796
+ret: 0 st: 0 flags:0 ts: 0.800000
+ret: 0 st: 0 flags:1 dts: 0.960000 pts: NOPTS pos: 76694 size: 10792
+ret:-1 st: 0 flags:1 ts:-0.320000
+ret:-1 st:-1 flags:0 ts: 2.576668
+ret: 0 st:-1 flags:1 ts: 1.470835
+ret: 0 st: 0 flags:1 dts: 1.440000 pts: NOPTS pos: 124245 size: 11796
+ret: 0 st: 0 flags:0 ts: 0.360000
+ret: 0 st: 0 flags:1 dts: 0.480000 pts: NOPTS pos: 37721 size: 9873
+ret:-1 st: 0 flags:1 ts:-0.760000
+ret:-1 st:-1 flags:0 ts: 2.153336
+ret: 0 st:-1 flags:1 ts: 1.047503
+ret: 0 st: 0 flags:1 dts: 0.960000 pts: NOPTS pos: 76694 size: 10792
+ret: 0 st: 0 flags:0 ts:-0.040000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 0 size: 9779
+ret: 0 st: 0 flags:1 ts: 2.840000
+ret: 0 st: 0 flags:1 dts: 1.920000 pts: NOPTS pos: 177089 size: 12057
+ret: 0 st:-1 flags:0 ts: 1.730004
+ret: 0 st: 0 flags:1 dts: 1.920000 pts: NOPTS pos: 177089 size: 12057
+ret: 0 st:-1 flags:1 ts: 0.624171
+ret: 0 st: 0 flags:1 dts: 0.480000 pts: NOPTS pos: 37721 size: 9873
+ret: 0 st: 0 flags:0 ts:-0.480000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 0 size: 9779
+ret: 0 st: 0 flags:1 ts: 2.400000
+ret: 0 st: 0 flags:1 dts: 1.920000 pts: NOPTS pos: 177089 size: 12057
+ret: 0 st:-1 flags:0 ts: 1.306672
+ret: 0 st: 0 flags:1 dts: 1.440000 pts: NOPTS pos: 124245 size: 11796
+ret: 0 st:-1 flags:1 ts: 0.200839
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 0 size: 9779
+ret: 0 st: 0 flags:0 ts:-0.920000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 0 size: 9779
+ret: 0 st: 0 flags:1 ts: 2.000000
+ret: 0 st: 0 flags:1 dts: 1.920000 pts: NOPTS pos: 177089 size: 12057
+ret: 0 st:-1 flags:0 ts: 0.883340
+ret: 0 st: 0 flags:1 dts: 0.960000 pts: NOPTS pos: 76694 size: 10792
+ret:-1 st:-1 flags:1 ts:-0.222493
+ret:-1 st: 0 flags:0 ts: 2.680000
+ret: 0 st: 0 flags:1 ts: 1.560000
+ret: 0 st: 0 flags:1 dts: 1.440000 pts: NOPTS pos: 124245 size: 11796
+ret: 0 st:-1 flags:0 ts: 0.460008
+ret: 0 st: 0 flags:1 dts: 0.480000 pts: NOPTS pos: 37721 size: 9873
+ret:-1 st:-1 flags:1 ts:-0.645825
diff --git a/gst-libs/ext/libav/tests/ref/seek/vsynth2-mpeg1b b/gst-libs/ext/libav/tests/ref/seek/vsynth2-mpeg1b
new file mode 100644
index 0000000..3b0b084
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/seek/vsynth2-mpeg1b
@@ -0,0 +1,46 @@
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 0 size: 11817
+ret: 0 st:-1 flags:0 ts:-1.000000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 0 size: 11817
+ret: 0 st:-1 flags:1 ts: 1.894167
+ret: 0 st: 0 flags:1 dts: 1.800000 pts: NOPTS pos: 194420 size: 14837
+ret: 0 st: 0 flags:0 ts: 0.800000
+ret: 0 st: 0 flags:1 dts: 0.840000 pts: NOPTS pos: 80757 size: 13267
+ret:-1 st: 0 flags:1 ts:-0.320000
+ret:-1 st:-1 flags:0 ts: 2.576668
+ret: 0 st:-1 flags:1 ts: 1.470835
+ret: 0 st: 0 flags:1 dts: 1.320000 pts: NOPTS pos: 133899 size: 14470
+ret: 0 st: 0 flags:0 ts: 0.360000
+ret: 0 st: 0 flags:1 dts: 0.360000 pts: NOPTS pos: 34797 size: 12009
+ret:-1 st: 0 flags:1 ts:-0.760000
+ret:-1 st:-1 flags:0 ts: 2.153336
+ret: 0 st:-1 flags:1 ts: 1.047503
+ret: 0 st: 0 flags:1 dts: 0.840000 pts: NOPTS pos: 80757 size: 13267
+ret: 0 st: 0 flags:0 ts:-0.040000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 0 size: 11817
+ret: 0 st: 0 flags:1 ts: 2.840000
+ret: 0 st: 0 flags:1 dts: 1.800000 pts: NOPTS pos: 194420 size: 14837
+ret: 0 st:-1 flags:0 ts: 1.730004
+ret: 0 st: 0 flags:1 dts: 1.800000 pts: NOPTS pos: 194420 size: 14837
+ret: 0 st:-1 flags:1 ts: 0.624171
+ret: 0 st: 0 flags:1 dts: 0.360000 pts: NOPTS pos: 34797 size: 12009
+ret: 0 st: 0 flags:0 ts:-0.480000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 0 size: 11817
+ret: 0 st: 0 flags:1 ts: 2.400000
+ret: 0 st: 0 flags:1 dts: 1.800000 pts: NOPTS pos: 194420 size: 14837
+ret: 0 st:-1 flags:0 ts: 1.306672
+ret: 0 st: 0 flags:1 dts: 1.320000 pts: NOPTS pos: 133899 size: 14470
+ret: 0 st:-1 flags:1 ts: 0.200839
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 0 size: 11817
+ret: 0 st: 0 flags:0 ts:-0.920000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 0 size: 11817
+ret: 0 st: 0 flags:1 ts: 2.000000
+ret: 0 st: 0 flags:1 dts: 1.800000 pts: NOPTS pos: 194420 size: 14837
+ret: 0 st:-1 flags:0 ts: 0.883340
+ret: 0 st: 0 flags:1 dts: 1.320000 pts: NOPTS pos: 133899 size: 14470
+ret:-1 st:-1 flags:1 ts:-0.222493
+ret:-1 st: 0 flags:0 ts: 2.680000
+ret: 0 st: 0 flags:1 ts: 1.560000
+ret: 0 st: 0 flags:1 dts: 1.320000 pts: NOPTS pos: 133899 size: 14470
+ret: 0 st:-1 flags:0 ts: 0.460008
+ret: 0 st: 0 flags:1 dts: 0.840000 pts: NOPTS pos: 80757 size: 13267
+ret:-1 st:-1 flags:1 ts:-0.645825
diff --git a/gst-libs/ext/libav/tests/ref/seek/vsynth2-mpeg2-422 b/gst-libs/ext/libav/tests/ref/seek/vsynth2-mpeg2-422
new file mode 100644
index 0000000..d06b7cb
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/seek/vsynth2-mpeg2-422
@@ -0,0 +1,46 @@
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 0 size: 17497
+ret: 0 st:-1 flags:0 ts:-1.000000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 0 size: 17497
+ret: 0 st:-1 flags:1 ts: 1.894167
+ret: 0 st: 0 flags:1 dts: 1.840000 pts: NOPTS pos: 325162 size: 19936
+ret: 0 st: 0 flags:0 ts: 0.800000
+ret: 0 st: 0 flags:1 dts: 0.880000 pts: NOPTS pos: 200736 size: 22575
+ret:-1 st: 0 flags:1 ts:-0.320000
+ret:-1 st:-1 flags:0 ts: 2.576668
+ret: 0 st:-1 flags:1 ts: 1.470835
+ret: 0 st: 0 flags:1 dts: 1.360000 pts: NOPTS pos: 265477 size: 21329
+ret: 0 st: 0 flags:0 ts: 0.360000
+ret: 0 st: 0 flags:1 dts: 0.400000 pts: NOPTS pos: 104454 size: 28984
+ret:-1 st: 0 flags:1 ts:-0.760000
+ret:-1 st:-1 flags:0 ts: 2.153336
+ret: 0 st:-1 flags:1 ts: 1.047503
+ret: 0 st: 0 flags:1 dts: 0.880000 pts: NOPTS pos: 200736 size: 22575
+ret: 0 st: 0 flags:0 ts:-0.040000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 0 size: 17497
+ret: 0 st: 0 flags:1 ts: 2.840000
+ret: 0 st: 0 flags:1 dts: 1.840000 pts: NOPTS pos: 325162 size: 19936
+ret: 0 st:-1 flags:0 ts: 1.730004
+ret: 0 st: 0 flags:1 dts: 1.840000 pts: NOPTS pos: 325162 size: 19936
+ret: 0 st:-1 flags:1 ts: 0.624171
+ret: 0 st: 0 flags:1 dts: 0.400000 pts: NOPTS pos: 104454 size: 28984
+ret: 0 st: 0 flags:0 ts:-0.480000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 0 size: 17497
+ret: 0 st: 0 flags:1 ts: 2.400000
+ret: 0 st: 0 flags:1 dts: 1.840000 pts: NOPTS pos: 325162 size: 19936
+ret: 0 st:-1 flags:0 ts: 1.306672
+ret: 0 st: 0 flags:1 dts: 1.360000 pts: NOPTS pos: 265477 size: 21329
+ret: 0 st:-1 flags:1 ts: 0.200839
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 0 size: 17497
+ret: 0 st: 0 flags:0 ts:-0.920000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 0 size: 17497
+ret: 0 st: 0 flags:1 ts: 2.000000
+ret: 0 st: 0 flags:1 dts: 1.840000 pts: NOPTS pos: 325162 size: 19936
+ret: 0 st:-1 flags:0 ts: 0.883340
+ret: 0 st: 0 flags:1 dts: 0.880000 pts: NOPTS pos: 200736 size: 22575
+ret:-1 st:-1 flags:1 ts:-0.222493
+ret:-1 st: 0 flags:0 ts: 2.680000
+ret: 0 st: 0 flags:1 ts: 1.560000
+ret: 0 st: 0 flags:1 dts: 1.360000 pts: NOPTS pos: 265477 size: 21329
+ret: 0 st:-1 flags:0 ts: 0.460008
+ret: 0 st: 0 flags:1 dts: 0.880000 pts: NOPTS pos: 200736 size: 22575
+ret:-1 st:-1 flags:1 ts:-0.645825
diff --git a/gst-libs/ext/libav/tests/ref/seek/vsynth2-mpeg2-idct-int b/gst-libs/ext/libav/tests/ref/seek/vsynth2-mpeg2-idct-int
new file mode 100644
index 0000000..698cedf
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/seek/vsynth2-mpeg2-idct-int
@@ -0,0 +1,46 @@
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 0 size: 9911
+ret: 0 st:-1 flags:0 ts:-1.000000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 0 size: 9911
+ret: 0 st:-1 flags:1 ts: 1.894167
+ret: 0 st: 0 flags:1 dts: 1.440000 pts: NOPTS pos: 127925 size: 11918
+ret: 0 st: 0 flags:0 ts: 0.800000
+ret: 0 st: 0 flags:1 dts: 0.960000 pts: NOPTS pos: 79103 size: 10909
+ret:-1 st: 0 flags:1 ts:-0.320000
+ret:-1 st:-1 flags:0 ts: 2.576668
+ret: 0 st:-1 flags:1 ts: 1.470835
+ret: 0 st: 0 flags:1 dts: 1.440000 pts: NOPTS pos: 127925 size: 11918
+ret: 0 st: 0 flags:0 ts: 0.360000
+ret: 0 st: 0 flags:1 dts: 0.480000 pts: NOPTS pos: 38992 size: 9985
+ret:-1 st: 0 flags:1 ts:-0.760000
+ret:-1 st:-1 flags:0 ts: 2.153336
+ret: 0 st:-1 flags:1 ts: 1.047503
+ret: 0 st: 0 flags:1 dts: 0.960000 pts: NOPTS pos: 79103 size: 10909
+ret: 0 st: 0 flags:0 ts:-0.040000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 0 size: 9911
+ret: 0 st: 0 flags:1 ts: 2.840000
+ret: 0 st: 0 flags:1 dts: 1.920000 pts: NOPTS pos: 182138 size: 12183
+ret: 0 st:-1 flags:0 ts: 1.730004
+ret: 0 st: 0 flags:1 dts: 1.920000 pts: NOPTS pos: 182138 size: 12183
+ret: 0 st:-1 flags:1 ts: 0.624171
+ret: 0 st: 0 flags:1 dts: 0.480000 pts: NOPTS pos: 38992 size: 9985
+ret: 0 st: 0 flags:0 ts:-0.480000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 0 size: 9911
+ret: 0 st: 0 flags:1 ts: 2.400000
+ret: 0 st: 0 flags:1 dts: 1.920000 pts: NOPTS pos: 182138 size: 12183
+ret: 0 st:-1 flags:0 ts: 1.306672
+ret: 0 st: 0 flags:1 dts: 1.440000 pts: NOPTS pos: 127925 size: 11918
+ret: 0 st:-1 flags:1 ts: 0.200839
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 0 size: 9911
+ret: 0 st: 0 flags:0 ts:-0.920000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 0 size: 9911
+ret: 0 st: 0 flags:1 ts: 2.000000
+ret: 0 st: 0 flags:1 dts: 1.920000 pts: NOPTS pos: 182138 size: 12183
+ret: 0 st:-1 flags:0 ts: 0.883340
+ret: 0 st: 0 flags:1 dts: 0.960000 pts: NOPTS pos: 79103 size: 10909
+ret:-1 st:-1 flags:1 ts:-0.222493
+ret:-1 st: 0 flags:0 ts: 2.680000
+ret: 0 st: 0 flags:1 ts: 1.560000
+ret: 0 st: 0 flags:1 dts: 1.440000 pts: NOPTS pos: 127925 size: 11918
+ret: 0 st:-1 flags:0 ts: 0.460008
+ret: 0 st: 0 flags:1 dts: 0.480000 pts: NOPTS pos: 38992 size: 9985
+ret:-1 st:-1 flags:1 ts:-0.645825
diff --git a/gst-libs/ext/libav/tests/ref/seek/vsynth2-mpeg2-ilace b/gst-libs/ext/libav/tests/ref/seek/vsynth2-mpeg2-ilace
new file mode 100644
index 0000000..a2427f3
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/seek/vsynth2-mpeg2-ilace
@@ -0,0 +1,46 @@
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 0 size: 9961
+ret: 0 st:-1 flags:0 ts:-1.000000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 0 size: 9961
+ret: 0 st:-1 flags:1 ts: 1.894167
+ret: 0 st: 0 flags:1 dts: 1.440000 pts: NOPTS pos: 132607 size: 11970
+ret: 0 st: 0 flags:0 ts: 0.800000
+ret: 0 st: 0 flags:1 dts: 0.960000 pts: NOPTS pos: 82152 size: 10965
+ret:-1 st: 0 flags:1 ts:-0.320000
+ret:-1 st:-1 flags:0 ts: 2.576668
+ret: 0 st:-1 flags:1 ts: 1.470835
+ret: 0 st: 0 flags:1 dts: 1.440000 pts: NOPTS pos: 132607 size: 11970
+ret: 0 st: 0 flags:0 ts: 0.360000
+ret: 0 st: 0 flags:1 dts: 0.480000 pts: NOPTS pos: 40546 size: 10045
+ret:-1 st: 0 flags:1 ts:-0.760000
+ret:-1 st:-1 flags:0 ts: 2.153336
+ret: 0 st:-1 flags:1 ts: 1.047503
+ret: 0 st: 0 flags:1 dts: 0.960000 pts: NOPTS pos: 82152 size: 10965
+ret: 0 st: 0 flags:0 ts:-0.040000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 0 size: 9961
+ret: 0 st: 0 flags:1 ts: 2.840000
+ret: 0 st: 0 flags:1 dts: 1.920000 pts: NOPTS pos: 188429 size: 12232
+ret: 0 st:-1 flags:0 ts: 1.730004
+ret: 0 st: 0 flags:1 dts: 1.920000 pts: NOPTS pos: 188429 size: 12232
+ret: 0 st:-1 flags:1 ts: 0.624171
+ret: 0 st: 0 flags:1 dts: 0.480000 pts: NOPTS pos: 40546 size: 10045
+ret: 0 st: 0 flags:0 ts:-0.480000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 0 size: 9961
+ret: 0 st: 0 flags:1 ts: 2.400000
+ret: 0 st: 0 flags:1 dts: 1.920000 pts: NOPTS pos: 188429 size: 12232
+ret: 0 st:-1 flags:0 ts: 1.306672
+ret: 0 st: 0 flags:1 dts: 1.440000 pts: NOPTS pos: 132607 size: 11970
+ret: 0 st:-1 flags:1 ts: 0.200839
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 0 size: 9961
+ret: 0 st: 0 flags:0 ts:-0.920000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 0 size: 9961
+ret: 0 st: 0 flags:1 ts: 2.000000
+ret: 0 st: 0 flags:1 dts: 1.920000 pts: NOPTS pos: 188429 size: 12232
+ret: 0 st:-1 flags:0 ts: 0.883340
+ret: 0 st: 0 flags:1 dts: 0.960000 pts: NOPTS pos: 82152 size: 10965
+ret:-1 st:-1 flags:1 ts:-0.222493
+ret:-1 st: 0 flags:0 ts: 2.680000
+ret: 0 st: 0 flags:1 ts: 1.560000
+ret: 0 st: 0 flags:1 dts: 1.440000 pts: NOPTS pos: 132607 size: 11970
+ret: 0 st:-1 flags:0 ts: 0.460008
+ret: 0 st: 0 flags:1 dts: 0.480000 pts: NOPTS pos: 40546 size: 10045
+ret:-1 st:-1 flags:1 ts:-0.645825
diff --git a/gst-libs/ext/libav/tests/ref/seek/vsynth2-mpeg2-ivlc-qprd b/gst-libs/ext/libav/tests/ref/seek/vsynth2-mpeg2-ivlc-qprd
new file mode 100644
index 0000000..9a623c2
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/seek/vsynth2-mpeg2-ivlc-qprd
@@ -0,0 +1,46 @@
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 0 size: 16239
+ret: 0 st:-1 flags:0 ts:-1.000000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 0 size: 16239
+ret: 0 st:-1 flags:1 ts: 1.894167
+ret: 0 st: 0 flags:1 dts: 1.840000 pts: NOPTS pos: 227500 size: 12725
+ret: 0 st: 0 flags:0 ts: 0.800000
+ret: 0 st: 0 flags:1 dts: 0.880000 pts: NOPTS pos: 164167 size: 13921
+ret:-1 st: 0 flags:1 ts:-0.320000
+ret:-1 st:-1 flags:0 ts: 2.576668
+ret: 0 st:-1 flags:1 ts: 1.470835
+ret: 0 st: 0 flags:1 dts: 1.360000 pts: NOPTS pos: 196681 size: 13159
+ret: 0 st: 0 flags:0 ts: 0.360000
+ret: 0 st: 0 flags:1 dts: 0.400000 pts: NOPTS pos: 98748 size: 29165
+ret:-1 st: 0 flags:1 ts:-0.760000
+ret:-1 st:-1 flags:0 ts: 2.153336
+ret: 0 st:-1 flags:1 ts: 1.047503
+ret: 0 st: 0 flags:1 dts: 0.880000 pts: NOPTS pos: 164167 size: 13921
+ret: 0 st: 0 flags:0 ts:-0.040000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 0 size: 16239
+ret: 0 st: 0 flags:1 ts: 2.840000
+ret: 0 st: 0 flags:1 dts: 1.840000 pts: NOPTS pos: 227500 size: 12725
+ret: 0 st:-1 flags:0 ts: 1.730004
+ret: 0 st: 0 flags:1 dts: 1.840000 pts: NOPTS pos: 227500 size: 12725
+ret: 0 st:-1 flags:1 ts: 0.624171
+ret: 0 st: 0 flags:1 dts: 0.400000 pts: NOPTS pos: 98748 size: 29165
+ret: 0 st: 0 flags:0 ts:-0.480000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 0 size: 16239
+ret: 0 st: 0 flags:1 ts: 2.400000
+ret: 0 st: 0 flags:1 dts: 1.840000 pts: NOPTS pos: 227500 size: 12725
+ret: 0 st:-1 flags:0 ts: 1.306672
+ret: 0 st: 0 flags:1 dts: 1.360000 pts: NOPTS pos: 196681 size: 13159
+ret: 0 st:-1 flags:1 ts: 0.200839
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 0 size: 16239
+ret: 0 st: 0 flags:0 ts:-0.920000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 0 size: 16239
+ret: 0 st: 0 flags:1 ts: 2.000000
+ret: 0 st: 0 flags:1 dts: 1.840000 pts: NOPTS pos: 227500 size: 12725
+ret: 0 st:-1 flags:0 ts: 0.883340
+ret: 0 st: 0 flags:1 dts: 0.880000 pts: NOPTS pos: 164167 size: 13921
+ret:-1 st:-1 flags:1 ts:-0.222493
+ret:-1 st: 0 flags:0 ts: 2.680000
+ret: 0 st: 0 flags:1 ts: 1.560000
+ret: 0 st: 0 flags:1 dts: 1.360000 pts: NOPTS pos: 196681 size: 13159
+ret: 0 st:-1 flags:0 ts: 0.460008
+ret: 0 st: 0 flags:1 dts: 0.880000 pts: NOPTS pos: 164167 size: 13921
+ret:-1 st:-1 flags:1 ts:-0.645825
diff --git a/gst-libs/ext/libav/tests/ref/seek/vsynth2-mpeg2-thread b/gst-libs/ext/libav/tests/ref/seek/vsynth2-mpeg2-thread
new file mode 100644
index 0000000..d8c9e28
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/seek/vsynth2-mpeg2-thread
@@ -0,0 +1,46 @@
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 0 size: 9961
+ret: 0 st:-1 flags:0 ts:-1.000000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 0 size: 9961
+ret: 0 st:-1 flags:1 ts: 1.894167
+ret: 0 st: 0 flags:1 dts: 1.840000 pts: NOPTS pos: 158225 size: 12232
+ret: 0 st: 0 flags:0 ts: 0.800000
+ret: 0 st: 0 flags:1 dts: 0.880000 pts: NOPTS pos: 67790 size: 10965
+ret:-1 st: 0 flags:1 ts:-0.320000
+ret:-1 st:-1 flags:0 ts: 2.576668
+ret: 0 st:-1 flags:1 ts: 1.470835
+ret: 0 st: 0 flags:1 dts: 1.360000 pts: NOPTS pos: 110330 size: 11970
+ret: 0 st: 0 flags:0 ts: 0.360000
+ret: 0 st: 0 flags:1 dts: 0.400000 pts: NOPTS pos: 30747 size: 10045
+ret:-1 st: 0 flags:1 ts:-0.760000
+ret:-1 st:-1 flags:0 ts: 2.153336
+ret: 0 st:-1 flags:1 ts: 1.047503
+ret: 0 st: 0 flags:1 dts: 0.880000 pts: NOPTS pos: 67790 size: 10965
+ret: 0 st: 0 flags:0 ts:-0.040000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 0 size: 9961
+ret: 0 st: 0 flags:1 ts: 2.840000
+ret: 0 st: 0 flags:1 dts: 1.840000 pts: NOPTS pos: 158225 size: 12232
+ret: 0 st:-1 flags:0 ts: 1.730004
+ret: 0 st: 0 flags:1 dts: 1.840000 pts: NOPTS pos: 158225 size: 12232
+ret: 0 st:-1 flags:1 ts: 0.624171
+ret: 0 st: 0 flags:1 dts: 0.400000 pts: NOPTS pos: 30747 size: 10045
+ret: 0 st: 0 flags:0 ts:-0.480000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 0 size: 9961
+ret: 0 st: 0 flags:1 ts: 2.400000
+ret: 0 st: 0 flags:1 dts: 1.840000 pts: NOPTS pos: 158225 size: 12232
+ret: 0 st:-1 flags:0 ts: 1.306672
+ret: 0 st: 0 flags:1 dts: 1.360000 pts: NOPTS pos: 110330 size: 11970
+ret: 0 st:-1 flags:1 ts: 0.200839
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 0 size: 9961
+ret: 0 st: 0 flags:0 ts:-0.920000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 0 size: 9961
+ret: 0 st: 0 flags:1 ts: 2.000000
+ret: 0 st: 0 flags:1 dts: 1.840000 pts: NOPTS pos: 158225 size: 12232
+ret: 0 st:-1 flags:0 ts: 0.883340
+ret: 0 st: 0 flags:1 dts: 0.880000 pts: NOPTS pos: 67790 size: 10965
+ret:-1 st:-1 flags:1 ts:-0.222493
+ret:-1 st: 0 flags:0 ts: 2.680000
+ret: 0 st: 0 flags:1 ts: 1.560000
+ret: 0 st: 0 flags:1 dts: 1.360000 pts: NOPTS pos: 110330 size: 11970
+ret: 0 st:-1 flags:0 ts: 0.460008
+ret: 0 st: 0 flags:1 dts: 0.880000 pts: NOPTS pos: 67790 size: 10965
+ret:-1 st:-1 flags:1 ts:-0.645825
diff --git a/gst-libs/ext/libav/tests/ref/seek/vsynth2-mpeg2-thread-ivlc b/gst-libs/ext/libav/tests/ref/seek/vsynth2-mpeg2-thread-ivlc
new file mode 100644
index 0000000..f1909b6
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/seek/vsynth2-mpeg2-thread-ivlc
@@ -0,0 +1,46 @@
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 0 size: 9954
+ret: 0 st:-1 flags:0 ts:-1.000000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 0 size: 9954
+ret: 0 st:-1 flags:1 ts: 1.894167
+ret: 0 st: 0 flags:1 dts: 1.840000 pts: NOPTS pos: 157678 size: 11930
+ret: 0 st: 0 flags:0 ts: 0.800000
+ret: 0 st: 0 flags:1 dts: 0.880000 pts: NOPTS pos: 67723 size: 10791
+ret:-1 st: 0 flags:1 ts:-0.320000
+ret:-1 st:-1 flags:0 ts: 2.576668
+ret: 0 st:-1 flags:1 ts: 1.470835
+ret: 0 st: 0 flags:1 dts: 1.360000 pts: NOPTS pos: 110080 size: 11697
+ret: 0 st: 0 flags:0 ts: 0.360000
+ret: 0 st: 0 flags:1 dts: 0.400000 pts: NOPTS pos: 30744 size: 9980
+ret:-1 st: 0 flags:1 ts:-0.760000
+ret:-1 st:-1 flags:0 ts: 2.153336
+ret: 0 st:-1 flags:1 ts: 1.047503
+ret: 0 st: 0 flags:1 dts: 0.880000 pts: NOPTS pos: 67723 size: 10791
+ret: 0 st: 0 flags:0 ts:-0.040000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 0 size: 9954
+ret: 0 st: 0 flags:1 ts: 2.840000
+ret: 0 st: 0 flags:1 dts: 1.840000 pts: NOPTS pos: 157678 size: 11930
+ret: 0 st:-1 flags:0 ts: 1.730004
+ret: 0 st: 0 flags:1 dts: 1.840000 pts: NOPTS pos: 157678 size: 11930
+ret: 0 st:-1 flags:1 ts: 0.624171
+ret: 0 st: 0 flags:1 dts: 0.400000 pts: NOPTS pos: 30744 size: 9980
+ret: 0 st: 0 flags:0 ts:-0.480000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 0 size: 9954
+ret: 0 st: 0 flags:1 ts: 2.400000
+ret: 0 st: 0 flags:1 dts: 1.840000 pts: NOPTS pos: 157678 size: 11930
+ret: 0 st:-1 flags:0 ts: 1.306672
+ret: 0 st: 0 flags:1 dts: 1.360000 pts: NOPTS pos: 110080 size: 11697
+ret: 0 st:-1 flags:1 ts: 0.200839
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 0 size: 9954
+ret: 0 st: 0 flags:0 ts:-0.920000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 0 size: 9954
+ret: 0 st: 0 flags:1 ts: 2.000000
+ret: 0 st: 0 flags:1 dts: 1.840000 pts: NOPTS pos: 157678 size: 11930
+ret: 0 st:-1 flags:0 ts: 0.883340
+ret: 0 st: 0 flags:1 dts: 0.880000 pts: NOPTS pos: 67723 size: 10791
+ret:-1 st:-1 flags:1 ts:-0.222493
+ret:-1 st: 0 flags:0 ts: 2.680000
+ret: 0 st: 0 flags:1 ts: 1.560000
+ret: 0 st: 0 flags:1 dts: 1.360000 pts: NOPTS pos: 110080 size: 11697
+ret: 0 st:-1 flags:0 ts: 0.460008
+ret: 0 st: 0 flags:1 dts: 0.880000 pts: NOPTS pos: 67723 size: 10791
+ret:-1 st:-1 flags:1 ts:-0.645825
diff --git a/gst-libs/ext/libav/tests/ref/seek/odivx_mp4 b/gst-libs/ext/libav/tests/ref/seek/vsynth2-mpeg4
index 0600ed0..0600ed0 100644
--- a/gst-libs/ext/libav/tests/ref/seek/odivx_mp4
+++ b/gst-libs/ext/libav/tests/ref/seek/vsynth2-mpeg4
diff --git a/gst-libs/ext/libav/tests/ref/seek/vsynth2-mpeg4-adap b/gst-libs/ext/libav/tests/ref/seek/vsynth2-mpeg4-adap
new file mode 100644
index 0000000..87b80cc
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/seek/vsynth2-mpeg4-adap
@@ -0,0 +1,46 @@
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 5648 size: 6855
+ret: 0 st:-1 flags:0 ts:-1.000000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 5648 size: 6855
+ret: 0 st:-1 flags:1 ts: 1.894167
+ret: 0 st: 0 flags:1 dts: 1.840000 pts: NOPTS pos: 174444 size: 16883
+ret: 0 st: 0 flags:0 ts: 0.800000
+ret: 0 st: 0 flags:1 dts: 0.880000 pts: NOPTS pos: 98216 size: 17063
+ret:-1 st: 0 flags:1 ts:-0.320000
+ret:-1 st:-1 flags:0 ts: 2.576668
+ret: 0 st:-1 flags:1 ts: 1.470835
+ret: 0 st: 0 flags:1 dts: 1.360000 pts: NOPTS pos: 135586 size: 17525
+ret: 0 st: 0 flags:0 ts: 0.360000
+ret: 0 st: 0 flags:1 dts: 0.400000 pts: NOPTS pos: 59442 size: 17261
+ret:-1 st: 0 flags:1 ts:-0.760000
+ret:-1 st:-1 flags:0 ts: 2.153336
+ret: 0 st:-1 flags:1 ts: 1.047503
+ret: 0 st: 0 flags:1 dts: 0.880000 pts: NOPTS pos: 98216 size: 17063
+ret: 0 st: 0 flags:0 ts:-0.040000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 5648 size: 6855
+ret: 0 st: 0 flags:1 ts: 2.840000
+ret: 0 st: 0 flags:1 dts: 1.840000 pts: NOPTS pos: 174444 size: 16883
+ret: 0 st:-1 flags:0 ts: 1.730004
+ret: 0 st: 0 flags:1 dts: 1.840000 pts: NOPTS pos: 174444 size: 16883
+ret: 0 st:-1 flags:1 ts: 0.624171
+ret: 0 st: 0 flags:1 dts: 0.400000 pts: NOPTS pos: 59442 size: 17261
+ret: 0 st: 0 flags:0 ts:-0.480000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 5648 size: 6855
+ret: 0 st: 0 flags:1 ts: 2.400000
+ret: 0 st: 0 flags:1 dts: 1.840000 pts: NOPTS pos: 174444 size: 16883
+ret: 0 st:-1 flags:0 ts: 1.306672
+ret: 0 st: 0 flags:1 dts: 1.360000 pts: NOPTS pos: 135586 size: 17525
+ret: 0 st:-1 flags:1 ts: 0.200839
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 5648 size: 6855
+ret: 0 st: 0 flags:0 ts:-0.920000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 5648 size: 6855
+ret: 0 st: 0 flags:1 ts: 2.000000
+ret: 0 st: 0 flags:1 dts: 1.840000 pts: NOPTS pos: 174444 size: 16883
+ret: 0 st:-1 flags:0 ts: 0.883340
+ret: 0 st: 0 flags:1 dts: 0.880000 pts: NOPTS pos: 98216 size: 17063
+ret:-1 st:-1 flags:1 ts:-0.222493
+ret:-1 st: 0 flags:0 ts: 2.680000
+ret: 0 st: 0 flags:1 ts: 1.560000
+ret: 0 st: 0 flags:1 dts: 1.360000 pts: NOPTS pos: 135586 size: 17525
+ret: 0 st:-1 flags:0 ts: 0.460008
+ret: 0 st: 0 flags:1 dts: 0.880000 pts: NOPTS pos: 98216 size: 17063
+ret:-1 st:-1 flags:1 ts:-0.645825
diff --git a/gst-libs/ext/libav/tests/ref/seek/vsynth2-mpeg4-adv b/gst-libs/ext/libav/tests/ref/seek/vsynth2-mpeg4-adv
new file mode 100644
index 0000000..6765864
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/seek/vsynth2-mpeg4-adv
@@ -0,0 +1,46 @@
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5648 size: 8653
+ret: 0 st:-1 flags:0 ts:-1.000000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5648 size: 8653
+ret: 0 st:-1 flags:1 ts: 1.894167
+ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 91718 size: 11013
+ret: 0 st: 0 flags:0 ts: 0.800000
+ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 59492 size: 9815
+ret:-1 st: 0 flags:1 ts:-0.320000
+ret:-1 st:-1 flags:0 ts: 2.576668
+ret: 0 st:-1 flags:1 ts: 1.470835
+ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 91718 size: 11013
+ret: 0 st: 0 flags:0 ts: 0.360000
+ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 31932 size: 8753
+ret:-1 st: 0 flags:1 ts:-0.760000
+ret:-1 st:-1 flags:0 ts: 2.153336
+ret: 0 st:-1 flags:1 ts: 1.047503
+ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 59492 size: 9815
+ret: 0 st: 0 flags:0 ts:-0.040000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5648 size: 8653
+ret: 0 st: 0 flags:1 ts: 2.840000
+ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 127612 size: 11279
+ret: 0 st:-1 flags:0 ts: 1.730004
+ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 127612 size: 11279
+ret: 0 st:-1 flags:1 ts: 0.624171
+ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 31932 size: 8753
+ret: 0 st: 0 flags:0 ts:-0.480000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5648 size: 8653
+ret: 0 st: 0 flags:1 ts: 2.400000
+ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 127612 size: 11279
+ret: 0 st:-1 flags:0 ts: 1.306672
+ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 91718 size: 11013
+ret: 0 st:-1 flags:1 ts: 0.200839
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5648 size: 8653
+ret: 0 st: 0 flags:0 ts:-0.920000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5648 size: 8653
+ret: 0 st: 0 flags:1 ts: 2.000000
+ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 127612 size: 11279
+ret: 0 st:-1 flags:0 ts: 0.883340
+ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 59492 size: 9815
+ret:-1 st:-1 flags:1 ts:-0.222493
+ret:-1 st: 0 flags:0 ts: 2.680000
+ret: 0 st: 0 flags:1 ts: 1.560000
+ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 91718 size: 11013
+ret: 0 st:-1 flags:0 ts: 0.460008
+ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 31932 size: 8753
+ret:-1 st:-1 flags:1 ts:-0.645825
diff --git a/gst-libs/ext/libav/tests/ref/seek/vsynth2-mpeg4-error b/gst-libs/ext/libav/tests/ref/seek/vsynth2-mpeg4-error
new file mode 100644
index 0000000..322bcab
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/seek/vsynth2-mpeg4-error
@@ -0,0 +1,46 @@
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5648 size: 9564
+ret: 0 st:-1 flags:0 ts:-1.000000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5648 size: 9564
+ret: 0 st:-1 flags:1 ts: 1.894167
+ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 113130 size: 12795
+ret: 0 st: 0 flags:0 ts: 0.800000
+ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 71648 size: 11680
+ret:-1 st: 0 flags:1 ts:-0.320000
+ret:-1 st:-1 flags:0 ts: 2.576668
+ret: 0 st:-1 flags:1 ts: 1.470835
+ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 113130 size: 12795
+ret: 0 st: 0 flags:0 ts: 0.360000
+ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 36770 size: 10310
+ret:-1 st: 0 flags:1 ts:-0.760000
+ret:-1 st:-1 flags:0 ts: 2.153336
+ret: 0 st:-1 flags:1 ts: 1.047503
+ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 71648 size: 11680
+ret: 0 st: 0 flags:0 ts:-0.040000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5648 size: 9564
+ret: 0 st: 0 flags:1 ts: 2.840000
+ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 159358 size: 13895
+ret: 0 st:-1 flags:0 ts: 1.730004
+ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 159358 size: 13895
+ret: 0 st:-1 flags:1 ts: 0.624171
+ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 36770 size: 10310
+ret: 0 st: 0 flags:0 ts:-0.480000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5648 size: 9564
+ret: 0 st: 0 flags:1 ts: 2.400000
+ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 159358 size: 13895
+ret: 0 st:-1 flags:0 ts: 1.306672
+ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 113130 size: 12795
+ret: 0 st:-1 flags:1 ts: 0.200839
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5648 size: 9564
+ret: 0 st: 0 flags:0 ts:-0.920000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5648 size: 9564
+ret: 0 st: 0 flags:1 ts: 2.000000
+ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 159358 size: 13895
+ret: 0 st:-1 flags:0 ts: 0.883340
+ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 71648 size: 11680
+ret:-1 st:-1 flags:1 ts:-0.222493
+ret:-1 st: 0 flags:0 ts: 2.680000
+ret: 0 st: 0 flags:1 ts: 1.560000
+ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 113130 size: 12795
+ret: 0 st:-1 flags:0 ts: 0.460008
+ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 36770 size: 10310
+ret:-1 st:-1 flags:1 ts:-0.645825
diff --git a/gst-libs/ext/libav/tests/ref/seek/vsynth2-mpeg4-nr b/gst-libs/ext/libav/tests/ref/seek/vsynth2-mpeg4-nr
new file mode 100644
index 0000000..5273ae1
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/seek/vsynth2-mpeg4-nr
@@ -0,0 +1,46 @@
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5648 size: 10673
+ret: 0 st:-1 flags:0 ts:-1.000000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5648 size: 10673
+ret: 0 st:-1 flags:1 ts: 1.894167
+ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 100628 size: 12464
+ret: 0 st: 0 flags:0 ts: 0.800000
+ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 65468 size: 11181
+ret:-1 st: 0 flags:1 ts:-0.320000
+ret:-1 st:-1 flags:0 ts: 2.576668
+ret: 0 st:-1 flags:1 ts: 1.470835
+ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 100628 size: 12464
+ret: 0 st: 0 flags:0 ts: 0.360000
+ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 35300 size: 9987
+ret:-1 st: 0 flags:1 ts:-0.760000
+ret:-1 st:-1 flags:0 ts: 2.153336
+ret: 0 st:-1 flags:1 ts: 1.047503
+ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 65468 size: 11181
+ret: 0 st: 0 flags:0 ts:-0.040000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5648 size: 10673
+ret: 0 st: 0 flags:1 ts: 2.840000
+ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 139412 size: 12911
+ret: 0 st:-1 flags:0 ts: 1.730004
+ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 139412 size: 12911
+ret: 0 st:-1 flags:1 ts: 0.624171
+ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 35300 size: 9987
+ret: 0 st: 0 flags:0 ts:-0.480000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5648 size: 10673
+ret: 0 st: 0 flags:1 ts: 2.400000
+ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 139412 size: 12911
+ret: 0 st:-1 flags:0 ts: 1.306672
+ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 100628 size: 12464
+ret: 0 st:-1 flags:1 ts: 0.200839
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5648 size: 10673
+ret: 0 st: 0 flags:0 ts:-0.920000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5648 size: 10673
+ret: 0 st: 0 flags:1 ts: 2.000000
+ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 139412 size: 12911
+ret: 0 st:-1 flags:0 ts: 0.883340
+ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 65468 size: 11181
+ret:-1 st:-1 flags:1 ts:-0.222493
+ret:-1 st: 0 flags:0 ts: 2.680000
+ret: 0 st: 0 flags:1 ts: 1.560000
+ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 100628 size: 12464
+ret: 0 st:-1 flags:0 ts: 0.460008
+ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 35300 size: 9987
+ret:-1 st:-1 flags:1 ts:-0.645825
diff --git a/gst-libs/ext/libav/tests/ref/seek/vsynth2-mpeg4-qpel b/gst-libs/ext/libav/tests/ref/seek/vsynth2-mpeg4-qpel
new file mode 100644
index 0000000..195fb30
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/seek/vsynth2-mpeg4-qpel
@@ -0,0 +1,46 @@
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 5648 size: 11942
+ret: 0 st:-1 flags:0 ts:-1.000000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 5648 size: 11942
+ret: 0 st:-1 flags:1 ts: 1.894167
+ret: 0 st: 0 flags:1 dts: 1.840000 pts: NOPTS pos: 141518 size: 15562
+ret: 0 st: 0 flags:0 ts: 0.800000
+ret: 0 st: 0 flags:1 dts: 0.880000 pts: NOPTS pos: 64104 size: 13382
+ret:-1 st: 0 flags:1 ts:-0.320000
+ret:-1 st:-1 flags:0 ts: 2.576668
+ret: 0 st:-1 flags:1 ts: 1.470835
+ret: 0 st: 0 flags:1 dts: 1.360000 pts: NOPTS pos: 100356 size: 15057
+ret: 0 st: 0 flags:0 ts: 0.360000
+ret: 0 st: 0 flags:1 dts: 0.400000 pts: NOPTS pos: 32806 size: 11813
+ret:-1 st: 0 flags:1 ts:-0.760000
+ret:-1 st:-1 flags:0 ts: 2.153336
+ret: 0 st:-1 flags:1 ts: 1.047503
+ret: 0 st: 0 flags:1 dts: 0.880000 pts: NOPTS pos: 64104 size: 13382
+ret: 0 st: 0 flags:0 ts:-0.040000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 5648 size: 11942
+ret: 0 st: 0 flags:1 ts: 2.840000
+ret: 0 st: 0 flags:1 dts: 1.840000 pts: NOPTS pos: 141518 size: 15562
+ret: 0 st:-1 flags:0 ts: 1.730004
+ret: 0 st: 0 flags:1 dts: 1.840000 pts: NOPTS pos: 141518 size: 15562
+ret: 0 st:-1 flags:1 ts: 0.624171
+ret: 0 st: 0 flags:1 dts: 0.400000 pts: NOPTS pos: 32806 size: 11813
+ret: 0 st: 0 flags:0 ts:-0.480000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 5648 size: 11942
+ret: 0 st: 0 flags:1 ts: 2.400000
+ret: 0 st: 0 flags:1 dts: 1.840000 pts: NOPTS pos: 141518 size: 15562
+ret: 0 st:-1 flags:0 ts: 1.306672
+ret: 0 st: 0 flags:1 dts: 1.360000 pts: NOPTS pos: 100356 size: 15057
+ret: 0 st:-1 flags:1 ts: 0.200839
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 5648 size: 11942
+ret: 0 st: 0 flags:0 ts:-0.920000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 5648 size: 11942
+ret: 0 st: 0 flags:1 ts: 2.000000
+ret: 0 st: 0 flags:1 dts: 1.840000 pts: NOPTS pos: 141518 size: 15562
+ret: 0 st:-1 flags:0 ts: 0.883340
+ret: 0 st: 0 flags:1 dts: 0.880000 pts: NOPTS pos: 64104 size: 13382
+ret:-1 st:-1 flags:1 ts:-0.222493
+ret:-1 st: 0 flags:0 ts: 2.680000
+ret: 0 st: 0 flags:1 ts: 1.560000
+ret: 0 st: 0 flags:1 dts: 1.360000 pts: NOPTS pos: 100356 size: 15057
+ret: 0 st:-1 flags:0 ts: 0.460008
+ret: 0 st: 0 flags:1 dts: 0.880000 pts: NOPTS pos: 64104 size: 13382
+ret:-1 st:-1 flags:1 ts:-0.645825
diff --git a/gst-libs/ext/libav/tests/ref/seek/vsynth2-mpeg4-qprd b/gst-libs/ext/libav/tests/ref/seek/vsynth2-mpeg4-qprd
new file mode 100644
index 0000000..4c3c7f5
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/seek/vsynth2-mpeg4-qprd
@@ -0,0 +1,46 @@
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 5648 size: 14873
+ret: 0 st:-1 flags:0 ts:-1.000000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 5648 size: 14873
+ret: 0 st:-1 flags:1 ts: 1.894167
+ret: 0 st: 0 flags:1 dts: 1.840000 pts: NOPTS pos: 211020 size: 14638
+ret: 0 st: 0 flags:0 ts: 0.800000
+ret: 0 st: 0 flags:1 dts: 0.880000 pts: NOPTS pos: 150654 size: 14502
+ret:-1 st: 0 flags:1 ts:-0.320000
+ret:-1 st:-1 flags:0 ts: 2.576668
+ret: 0 st:-1 flags:1 ts: 1.470835
+ret: 0 st: 0 flags:1 dts: 1.360000 pts: NOPTS pos: 180770 size: 14371
+ret: 0 st: 0 flags:0 ts: 0.360000
+ret: 0 st: 0 flags:1 dts: 0.400000 pts: NOPTS pos: 93024 size: 29366
+ret:-1 st: 0 flags:1 ts:-0.760000
+ret:-1 st:-1 flags:0 ts: 2.153336
+ret: 0 st:-1 flags:1 ts: 1.047503
+ret: 0 st: 0 flags:1 dts: 0.880000 pts: NOPTS pos: 150654 size: 14502
+ret: 0 st: 0 flags:0 ts:-0.040000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 5648 size: 14873
+ret: 0 st: 0 flags:1 ts: 2.840000
+ret: 0 st: 0 flags:1 dts: 1.840000 pts: NOPTS pos: 211020 size: 14638
+ret: 0 st:-1 flags:0 ts: 1.730004
+ret: 0 st: 0 flags:1 dts: 1.840000 pts: NOPTS pos: 211020 size: 14638
+ret: 0 st:-1 flags:1 ts: 0.624171
+ret: 0 st: 0 flags:1 dts: 0.400000 pts: NOPTS pos: 93024 size: 29366
+ret: 0 st: 0 flags:0 ts:-0.480000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 5648 size: 14873
+ret: 0 st: 0 flags:1 ts: 2.400000
+ret: 0 st: 0 flags:1 dts: 1.840000 pts: NOPTS pos: 211020 size: 14638
+ret: 0 st:-1 flags:0 ts: 1.306672
+ret: 0 st: 0 flags:1 dts: 1.360000 pts: NOPTS pos: 180770 size: 14371
+ret: 0 st:-1 flags:1 ts: 0.200839
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 5648 size: 14873
+ret: 0 st: 0 flags:0 ts:-0.920000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 5648 size: 14873
+ret: 0 st: 0 flags:1 ts: 2.000000
+ret: 0 st: 0 flags:1 dts: 1.840000 pts: NOPTS pos: 211020 size: 14638
+ret: 0 st:-1 flags:0 ts: 0.883340
+ret: 0 st: 0 flags:1 dts: 0.880000 pts: NOPTS pos: 150654 size: 14502
+ret:-1 st:-1 flags:1 ts:-0.222493
+ret:-1 st: 0 flags:0 ts: 2.680000
+ret: 0 st: 0 flags:1 ts: 1.560000
+ret: 0 st: 0 flags:1 dts: 1.360000 pts: NOPTS pos: 180770 size: 14371
+ret: 0 st:-1 flags:0 ts: 0.460008
+ret: 0 st: 0 flags:1 dts: 0.880000 pts: NOPTS pos: 150654 size: 14502
+ret:-1 st:-1 flags:1 ts:-0.645825
diff --git a/gst-libs/ext/libav/tests/ref/seek/vsynth2-mpeg4-rc b/gst-libs/ext/libav/tests/ref/seek/vsynth2-mpeg4-rc
new file mode 100644
index 0000000..5c96c78
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/seek/vsynth2-mpeg4-rc
@@ -0,0 +1,46 @@
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 5648 size: 15766
+ret: 0 st:-1 flags:0 ts:-1.000000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 5648 size: 15766
+ret: 0 st:-1 flags:1 ts: 1.894167
+ret: 0 st: 0 flags:1 dts: 1.840000 pts: NOPTS pos: 207956 size: 13826
+ret: 0 st: 0 flags:0 ts: 0.800000
+ret: 0 st: 0 flags:1 dts: 0.880000 pts: NOPTS pos: 153800 size: 13382
+ret:-1 st: 0 flags:1 ts:-0.320000
+ret:-1 st:-1 flags:0 ts: 2.576668
+ret: 0 st:-1 flags:1 ts: 1.470835
+ret: 0 st: 0 flags:1 dts: 1.360000 pts: NOPTS pos: 180948 size: 13326
+ret: 0 st: 0 flags:0 ts: 0.360000
+ret: 0 st: 0 flags:1 dts: 0.400000 pts: NOPTS pos: 94582 size: 32807
+ret:-1 st: 0 flags:1 ts:-0.760000
+ret:-1 st:-1 flags:0 ts: 2.153336
+ret: 0 st:-1 flags:1 ts: 1.047503
+ret: 0 st: 0 flags:1 dts: 0.880000 pts: NOPTS pos: 153800 size: 13382
+ret: 0 st: 0 flags:0 ts:-0.040000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 5648 size: 15766
+ret: 0 st: 0 flags:1 ts: 2.840000
+ret: 0 st: 0 flags:1 dts: 1.840000 pts: NOPTS pos: 207956 size: 13826
+ret: 0 st:-1 flags:0 ts: 1.730004
+ret: 0 st: 0 flags:1 dts: 1.840000 pts: NOPTS pos: 207956 size: 13826
+ret: 0 st:-1 flags:1 ts: 0.624171
+ret: 0 st: 0 flags:1 dts: 0.400000 pts: NOPTS pos: 94582 size: 32807
+ret: 0 st: 0 flags:0 ts:-0.480000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 5648 size: 15766
+ret: 0 st: 0 flags:1 ts: 2.400000
+ret: 0 st: 0 flags:1 dts: 1.840000 pts: NOPTS pos: 207956 size: 13826
+ret: 0 st:-1 flags:0 ts: 1.306672
+ret: 0 st: 0 flags:1 dts: 1.360000 pts: NOPTS pos: 180948 size: 13326
+ret: 0 st:-1 flags:1 ts: 0.200839
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 5648 size: 15766
+ret: 0 st: 0 flags:0 ts:-0.920000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 5648 size: 15766
+ret: 0 st: 0 flags:1 ts: 2.000000
+ret: 0 st: 0 flags:1 dts: 1.840000 pts: NOPTS pos: 207956 size: 13826
+ret: 0 st:-1 flags:0 ts: 0.883340
+ret: 0 st: 0 flags:1 dts: 0.880000 pts: NOPTS pos: 153800 size: 13382
+ret:-1 st:-1 flags:1 ts:-0.222493
+ret:-1 st: 0 flags:0 ts: 2.680000
+ret: 0 st: 0 flags:1 ts: 1.560000
+ret: 0 st: 0 flags:1 dts: 1.360000 pts: NOPTS pos: 180948 size: 13326
+ret: 0 st:-1 flags:0 ts: 0.460008
+ret: 0 st: 0 flags:1 dts: 0.880000 pts: NOPTS pos: 153800 size: 13382
+ret:-1 st:-1 flags:1 ts:-0.645825
diff --git a/gst-libs/ext/libav/tests/ref/seek/vsynth2-mpeg4-thread b/gst-libs/ext/libav/tests/ref/seek/vsynth2-mpeg4-thread
new file mode 100644
index 0000000..8c4f663
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/seek/vsynth2-mpeg4-thread
@@ -0,0 +1,46 @@
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 5648 size: 14874
+ret: 0 st:-1 flags:0 ts:-1.000000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 5648 size: 14874
+ret: 0 st:-1 flags:1 ts: 1.894167
+ret: 0 st: 0 flags:1 dts: 1.840000 pts: NOPTS pos: 228210 size: 16324
+ret: 0 st: 0 flags:0 ts: 0.800000
+ret: 0 st: 0 flags:1 dts: 0.880000 pts: NOPTS pos: 162150 size: 16475
+ret:-1 st: 0 flags:1 ts:-0.320000
+ret:-1 st:-1 flags:0 ts: 2.576668
+ret: 0 st:-1 flags:1 ts: 1.470835
+ret: 0 st: 0 flags:1 dts: 1.360000 pts: NOPTS pos: 195320 size: 16136
+ret: 0 st: 0 flags:0 ts: 0.360000
+ret: 0 st: 0 flags:1 dts: 0.400000 pts: NOPTS pos: 97832 size: 33332
+ret:-1 st: 0 flags:1 ts:-0.760000
+ret:-1 st:-1 flags:0 ts: 2.153336
+ret: 0 st:-1 flags:1 ts: 1.047503
+ret: 0 st: 0 flags:1 dts: 0.880000 pts: NOPTS pos: 162150 size: 16475
+ret: 0 st: 0 flags:0 ts:-0.040000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 5648 size: 14874
+ret: 0 st: 0 flags:1 ts: 2.840000
+ret: 0 st: 0 flags:1 dts: 1.840000 pts: NOPTS pos: 228210 size: 16324
+ret: 0 st:-1 flags:0 ts: 1.730004
+ret: 0 st: 0 flags:1 dts: 1.840000 pts: NOPTS pos: 228210 size: 16324
+ret: 0 st:-1 flags:1 ts: 0.624171
+ret: 0 st: 0 flags:1 dts: 0.400000 pts: NOPTS pos: 97832 size: 33332
+ret: 0 st: 0 flags:0 ts:-0.480000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 5648 size: 14874
+ret: 0 st: 0 flags:1 ts: 2.400000
+ret: 0 st: 0 flags:1 dts: 1.840000 pts: NOPTS pos: 228210 size: 16324
+ret: 0 st:-1 flags:0 ts: 1.306672
+ret: 0 st: 0 flags:1 dts: 1.360000 pts: NOPTS pos: 195320 size: 16136
+ret: 0 st:-1 flags:1 ts: 0.200839
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 5648 size: 14874
+ret: 0 st: 0 flags:0 ts:-0.920000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: NOPTS pos: 5648 size: 14874
+ret: 0 st: 0 flags:1 ts: 2.000000
+ret: 0 st: 0 flags:1 dts: 1.840000 pts: NOPTS pos: 228210 size: 16324
+ret: 0 st:-1 flags:0 ts: 0.883340
+ret: 0 st: 0 flags:1 dts: 0.880000 pts: NOPTS pos: 162150 size: 16475
+ret:-1 st:-1 flags:1 ts:-0.222493
+ret:-1 st: 0 flags:0 ts: 2.680000
+ret: 0 st: 0 flags:1 ts: 1.560000
+ret: 0 st: 0 flags:1 dts: 1.360000 pts: NOPTS pos: 195320 size: 16136
+ret: 0 st:-1 flags:0 ts: 0.460008
+ret: 0 st: 0 flags:1 dts: 0.880000 pts: NOPTS pos: 162150 size: 16475
+ret:-1 st:-1 flags:1 ts:-0.645825
diff --git a/gst-libs/ext/libav/tests/ref/seek/vsynth2-msmpeg4 b/gst-libs/ext/libav/tests/ref/seek/vsynth2-msmpeg4
new file mode 100644
index 0000000..323f96a
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/seek/vsynth2-msmpeg4
@@ -0,0 +1,46 @@
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5648 size: 8637
+ret: 0 st:-1 flags:0 ts:-1.000000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5648 size: 8637
+ret: 0 st:-1 flags:1 ts: 1.894167
+ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 82508 size: 10783
+ret: 0 st: 0 flags:0 ts: 0.800000
+ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 53846 size: 9624
+ret:-1 st: 0 flags:1 ts:-0.320000
+ret:-1 st:-1 flags:0 ts: 2.576668
+ret: 0 st:-1 flags:1 ts: 1.470835
+ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 82508 size: 10783
+ret: 0 st: 0 flags:0 ts: 0.360000
+ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 29388 size: 8502
+ret:-1 st: 0 flags:1 ts:-0.760000
+ret:-1 st:-1 flags:0 ts: 2.153336
+ret: 0 st:-1 flags:1 ts: 1.047503
+ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 53846 size: 9624
+ret: 0 st: 0 flags:0 ts:-0.040000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5648 size: 8637
+ret: 0 st: 0 flags:1 ts: 2.840000
+ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 114264 size: 11180
+ret: 0 st:-1 flags:0 ts: 1.730004
+ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 114264 size: 11180
+ret: 0 st:-1 flags:1 ts: 0.624171
+ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 29388 size: 8502
+ret: 0 st: 0 flags:0 ts:-0.480000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5648 size: 8637
+ret: 0 st: 0 flags:1 ts: 2.400000
+ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 114264 size: 11180
+ret: 0 st:-1 flags:0 ts: 1.306672
+ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 82508 size: 10783
+ret: 0 st:-1 flags:1 ts: 0.200839
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5648 size: 8637
+ret: 0 st: 0 flags:0 ts:-0.920000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5648 size: 8637
+ret: 0 st: 0 flags:1 ts: 2.000000
+ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 114264 size: 11180
+ret: 0 st:-1 flags:0 ts: 0.883340
+ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 53846 size: 9624
+ret:-1 st:-1 flags:1 ts:-0.222493
+ret:-1 st: 0 flags:0 ts: 2.680000
+ret: 0 st: 0 flags:1 ts: 1.560000
+ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 82508 size: 10783
+ret: 0 st:-1 flags:0 ts: 0.460008
+ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 29388 size: 8502
+ret:-1 st:-1 flags:1 ts:-0.645825
diff --git a/gst-libs/ext/libav/tests/ref/seek/vsynth2-msmpeg4v2 b/gst-libs/ext/libav/tests/ref/seek/vsynth2-msmpeg4v2
new file mode 100644
index 0000000..177898e
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/seek/vsynth2-msmpeg4v2
@@ -0,0 +1,46 @@
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5648 size: 9003
+ret: 0 st:-1 flags:0 ts:-1.000000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5648 size: 9003
+ret: 0 st:-1 flags:1 ts: 1.894167
+ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 83870 size: 11165
+ret: 0 st: 0 flags:0 ts: 0.800000
+ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 54778 size: 10010
+ret:-1 st: 0 flags:1 ts:-0.320000
+ret:-1 st:-1 flags:0 ts: 2.576668
+ret: 0 st:-1 flags:1 ts: 1.470835
+ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 83870 size: 11165
+ret: 0 st: 0 flags:0 ts: 0.360000
+ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 29770 size: 8869
+ret:-1 st: 0 flags:1 ts:-0.760000
+ret:-1 st:-1 flags:0 ts: 2.153336
+ret: 0 st:-1 flags:1 ts: 1.047503
+ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 54778 size: 10010
+ret: 0 st: 0 flags:0 ts:-0.040000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5648 size: 9003
+ret: 0 st: 0 flags:1 ts: 2.840000
+ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 116100 size: 11578
+ret: 0 st:-1 flags:0 ts: 1.730004
+ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 116100 size: 11578
+ret: 0 st:-1 flags:1 ts: 0.624171
+ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 29770 size: 8869
+ret: 0 st: 0 flags:0 ts:-0.480000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5648 size: 9003
+ret: 0 st: 0 flags:1 ts: 2.400000
+ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 116100 size: 11578
+ret: 0 st:-1 flags:0 ts: 1.306672
+ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 83870 size: 11165
+ret: 0 st:-1 flags:1 ts: 0.200839
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5648 size: 9003
+ret: 0 st: 0 flags:0 ts:-0.920000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5648 size: 9003
+ret: 0 st: 0 flags:1 ts: 2.000000
+ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 116100 size: 11578
+ret: 0 st:-1 flags:0 ts: 0.883340
+ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 54778 size: 10010
+ret:-1 st:-1 flags:1 ts:-0.222493
+ret:-1 st: 0 flags:0 ts: 2.680000
+ret: 0 st: 0 flags:1 ts: 1.560000
+ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 83870 size: 11165
+ret: 0 st:-1 flags:0 ts: 0.460008
+ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 29770 size: 8869
+ret:-1 st:-1 flags:1 ts:-0.645825
diff --git a/gst-libs/ext/libav/tests/ref/seek/vsynth2-rgb b/gst-libs/ext/libav/tests/ref/seek/vsynth2-rgb
new file mode 100644
index 0000000..91f7260
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/seek/vsynth2-rgb
@@ -0,0 +1,46 @@
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5648 size:304128
+ret: 0 st:-1 flags:0 ts:-1.000000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5648 size:304128
+ret: 0 st:-1 flags:1 ts: 1.894167
+ret: 0 st: 0 flags:1 dts: 1.880000 pts: 1.880000 pos:14300040 size:304128
+ret: 0 st: 0 flags:0 ts: 0.800000
+ret: 0 st: 0 flags:1 dts: 0.800000 pts: 0.800000 pos:6088368 size:304128
+ret:-1 st: 0 flags:1 ts:-0.320000
+ret:-1 st:-1 flags:0 ts: 2.576668
+ret: 0 st:-1 flags:1 ts: 1.470835
+ret: 0 st: 0 flags:1 dts: 1.480000 pts: 1.480000 pos:11258680 size:304128
+ret: 0 st: 0 flags:0 ts: 0.360000
+ret: 0 st: 0 flags:1 dts: 0.360000 pts: 0.360000 pos:2742872 size:304128
+ret:-1 st: 0 flags:1 ts:-0.760000
+ret:-1 st:-1 flags:0 ts: 2.153336
+ret: 0 st:-1 flags:1 ts: 1.047503
+ret: 0 st: 0 flags:1 dts: 1.040000 pts: 1.040000 pos:7913184 size:304128
+ret: 0 st: 0 flags:0 ts:-0.040000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5648 size:304128
+ret: 0 st: 0 flags:1 ts: 2.840000
+ret: 0 st: 0 flags:1 dts: 1.960000 pts: 1.960000 pos:14908312 size:304128
+ret: 0 st:-1 flags:0 ts: 1.730004
+ret: 0 st: 0 flags:1 dts: 1.720000 pts: 1.720000 pos:13083496 size:304128
+ret: 0 st:-1 flags:1 ts: 0.624171
+ret: 0 st: 0 flags:1 dts: 0.640000 pts: 0.640000 pos:4871824 size:304128
+ret: 0 st: 0 flags:0 ts:-0.480000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5648 size:304128
+ret: 0 st: 0 flags:1 ts: 2.400000
+ret: 0 st: 0 flags:1 dts: 1.960000 pts: 1.960000 pos:14908312 size:304128
+ret: 0 st:-1 flags:0 ts: 1.306672
+ret: 0 st: 0 flags:1 dts: 1.320000 pts: 1.320000 pos:10042136 size:304128
+ret: 0 st:-1 flags:1 ts: 0.200839
+ret: 0 st: 0 flags:1 dts: 0.200000 pts: 0.200000 pos:1526328 size:304128
+ret: 0 st: 0 flags:0 ts:-0.920000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5648 size:304128
+ret: 0 st: 0 flags:1 ts: 2.000000
+ret: 0 st: 0 flags:1 dts: 1.960000 pts: 1.960000 pos:14908312 size:304128
+ret: 0 st:-1 flags:0 ts: 0.883340
+ret: 0 st: 0 flags:1 dts: 0.880000 pts: 0.880000 pos:6696640 size:304128
+ret:-1 st:-1 flags:1 ts:-0.222493
+ret:-1 st: 0 flags:0 ts: 2.680000
+ret: 0 st: 0 flags:1 ts: 1.560000
+ret: 0 st: 0 flags:1 dts: 1.560000 pts: 1.560000 pos:11866952 size:304128
+ret: 0 st:-1 flags:0 ts: 0.460008
+ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos:3655280 size:304128
+ret:-1 st:-1 flags:1 ts:-0.645825
diff --git a/gst-libs/ext/libav/tests/ref/seek/roqav_roq b/gst-libs/ext/libav/tests/ref/seek/vsynth2-roqvideo
index d003a37..d003a37 100644
--- a/gst-libs/ext/libav/tests/ref/seek/roqav_roq
+++ b/gst-libs/ext/libav/tests/ref/seek/vsynth2-roqvideo
diff --git a/gst-libs/ext/libav/tests/ref/seek/rv10_rm b/gst-libs/ext/libav/tests/ref/seek/vsynth2-rv10
index 123b03c..123b03c 100644
--- a/gst-libs/ext/libav/tests/ref/seek/rv10_rm
+++ b/gst-libs/ext/libav/tests/ref/seek/vsynth2-rv10
diff --git a/gst-libs/ext/libav/tests/ref/seek/rv20_rm b/gst-libs/ext/libav/tests/ref/seek/vsynth2-rv20
index f2b24e3..f2b24e3 100644
--- a/gst-libs/ext/libav/tests/ref/seek/rv20_rm
+++ b/gst-libs/ext/libav/tests/ref/seek/vsynth2-rv20
diff --git a/gst-libs/ext/libav/tests/ref/seek/vsynth2-snow b/gst-libs/ext/libav/tests/ref/seek/vsynth2-snow
new file mode 100644
index 0000000..d8f5aae
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/seek/vsynth2-snow
@@ -0,0 +1,46 @@
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5648 size: 3035
+ret: 0 st:-1 flags:0 ts:-1.000000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5648 size: 3035
+ret: 0 st:-1 flags:1 ts: 1.894167
+ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 39714 size: 3640
+ret: 0 st: 0 flags:0 ts: 0.800000
+ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 27434 size: 3494
+ret:-1 st: 0 flags:1 ts:-0.320000
+ret:-1 st:-1 flags:0 ts: 2.576668
+ret: 0 st:-1 flags:1 ts: 1.470835
+ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 39714 size: 3640
+ret: 0 st: 0 flags:0 ts: 0.360000
+ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 16124 size: 3244
+ret:-1 st: 0 flags:1 ts:-0.760000
+ret:-1 st:-1 flags:0 ts: 2.153336
+ret: 0 st:-1 flags:1 ts: 1.047503
+ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 27434 size: 3494
+ret: 0 st: 0 flags:0 ts:-0.040000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5648 size: 3035
+ret: 0 st: 0 flags:1 ts: 2.840000
+ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 52604 size: 3582
+ret: 0 st:-1 flags:0 ts: 1.730004
+ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 52604 size: 3582
+ret: 0 st:-1 flags:1 ts: 0.624171
+ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 16124 size: 3244
+ret: 0 st: 0 flags:0 ts:-0.480000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5648 size: 3035
+ret: 0 st: 0 flags:1 ts: 2.400000
+ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 52604 size: 3582
+ret: 0 st:-1 flags:0 ts: 1.306672
+ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 39714 size: 3640
+ret: 0 st:-1 flags:1 ts: 0.200839
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5648 size: 3035
+ret: 0 st: 0 flags:0 ts:-0.920000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5648 size: 3035
+ret: 0 st: 0 flags:1 ts: 2.000000
+ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 52604 size: 3582
+ret: 0 st:-1 flags:0 ts: 0.883340
+ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 27434 size: 3494
+ret:-1 st:-1 flags:1 ts:-0.222493
+ret:-1 st: 0 flags:0 ts: 2.680000
+ret: 0 st: 0 flags:1 ts: 1.560000
+ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 39714 size: 3640
+ret: 0 st:-1 flags:0 ts: 0.460008
+ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 16124 size: 3244
+ret:-1 st:-1 flags:1 ts:-0.645825
diff --git a/gst-libs/ext/libav/tests/ref/seek/vsynth2-snow-ll b/gst-libs/ext/libav/tests/ref/seek/vsynth2-snow-ll
new file mode 100644
index 0000000..95a4a79
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/seek/vsynth2-snow-ll
@@ -0,0 +1,46 @@
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5648 size: 72476
+ret: 0 st:-1 flags:0 ts:-1.000000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5648 size: 72476
+ret: 0 st:-1 flags:1 ts: 1.894167
+ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos:1902788 size: 78837
+ret: 0 st: 0 flags:0 ts: 0.800000
+ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos:1239090 size: 74994
+ret:-1 st: 0 flags:1 ts:-0.320000
+ret:-1 st:-1 flags:0 ts: 2.576668
+ret: 0 st:-1 flags:1 ts: 1.470835
+ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos:1902788 size: 78837
+ret: 0 st: 0 flags:0 ts: 0.360000
+ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 605628 size: 71059
+ret:-1 st: 0 flags:1 ts:-0.760000
+ret:-1 st:-1 flags:0 ts: 2.153336
+ret: 0 st:-1 flags:1 ts: 1.047503
+ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos:1239090 size: 74994
+ret: 0 st: 0 flags:0 ts:-0.040000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5648 size: 72476
+ret: 0 st: 0 flags:1 ts: 2.840000
+ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos:2585614 size: 79731
+ret: 0 st:-1 flags:0 ts: 1.730004
+ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos:2585614 size: 79731
+ret: 0 st:-1 flags:1 ts: 0.624171
+ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 605628 size: 71059
+ret: 0 st: 0 flags:0 ts:-0.480000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5648 size: 72476
+ret: 0 st: 0 flags:1 ts: 2.400000
+ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos:2585614 size: 79731
+ret: 0 st:-1 flags:0 ts: 1.306672
+ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos:1902788 size: 78837
+ret: 0 st:-1 flags:1 ts: 0.200839
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5648 size: 72476
+ret: 0 st: 0 flags:0 ts:-0.920000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5648 size: 72476
+ret: 0 st: 0 flags:1 ts: 2.000000
+ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos:2585614 size: 79731
+ret: 0 st:-1 flags:0 ts: 0.883340
+ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos:1239090 size: 74994
+ret:-1 st:-1 flags:1 ts:-0.222493
+ret:-1 st: 0 flags:0 ts: 2.680000
+ret: 0 st: 0 flags:1 ts: 1.560000
+ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos:1902788 size: 78837
+ret: 0 st:-1 flags:0 ts: 0.460008
+ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 605628 size: 71059
+ret:-1 st:-1 flags:1 ts:-0.645825
diff --git a/gst-libs/ext/libav/tests/ref/seek/svq1_mov b/gst-libs/ext/libav/tests/ref/seek/vsynth2-svq1
index 17bb99e..17bb99e 100644
--- a/gst-libs/ext/libav/tests/ref/seek/svq1_mov
+++ b/gst-libs/ext/libav/tests/ref/seek/vsynth2-svq1
diff --git a/gst-libs/ext/libav/tests/ref/seek/vsynth2-wmv1 b/gst-libs/ext/libav/tests/ref/seek/vsynth2-wmv1
new file mode 100644
index 0000000..85465b3
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/seek/vsynth2-wmv1
@@ -0,0 +1,46 @@
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5648 size: 8990
+ret: 0 st:-1 flags:0 ts:-1.000000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5648 size: 8990
+ret: 0 st:-1 flags:1 ts: 1.894167
+ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 83742 size: 11099
+ret: 0 st: 0 flags:0 ts: 0.800000
+ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 54758 size: 9931
+ret:-1 st: 0 flags:1 ts:-0.320000
+ret:-1 st:-1 flags:0 ts: 2.576668
+ret: 0 st:-1 flags:1 ts: 1.470835
+ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 83742 size: 11099
+ret: 0 st: 0 flags:0 ts: 0.360000
+ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 29794 size: 8796
+ret:-1 st: 0 flags:1 ts:-0.760000
+ret:-1 st:-1 flags:0 ts: 2.153336
+ret: 0 st:-1 flags:1 ts: 1.047503
+ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 54758 size: 9931
+ret: 0 st: 0 flags:0 ts:-0.040000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5648 size: 8990
+ret: 0 st: 0 flags:1 ts: 2.840000
+ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 115812 size: 11487
+ret: 0 st:-1 flags:0 ts: 1.730004
+ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 115812 size: 11487
+ret: 0 st:-1 flags:1 ts: 0.624171
+ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 29794 size: 8796
+ret: 0 st: 0 flags:0 ts:-0.480000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5648 size: 8990
+ret: 0 st: 0 flags:1 ts: 2.400000
+ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 115812 size: 11487
+ret: 0 st:-1 flags:0 ts: 1.306672
+ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 83742 size: 11099
+ret: 0 st:-1 flags:1 ts: 0.200839
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5648 size: 8990
+ret: 0 st: 0 flags:0 ts:-0.920000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5648 size: 8990
+ret: 0 st: 0 flags:1 ts: 2.000000
+ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 115812 size: 11487
+ret: 0 st:-1 flags:0 ts: 0.883340
+ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 54758 size: 9931
+ret:-1 st:-1 flags:1 ts:-0.222493
+ret:-1 st: 0 flags:0 ts: 2.680000
+ret: 0 st: 0 flags:1 ts: 1.560000
+ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 83742 size: 11099
+ret: 0 st:-1 flags:0 ts: 0.460008
+ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 29794 size: 8796
+ret:-1 st:-1 flags:1 ts:-0.645825
diff --git a/gst-libs/ext/libav/tests/ref/seek/vsynth2-wmv2 b/gst-libs/ext/libav/tests/ref/seek/vsynth2-wmv2
new file mode 100644
index 0000000..8ed257e
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/seek/vsynth2-wmv2
@@ -0,0 +1,46 @@
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5652 size: 8917
+ret: 0 st:-1 flags:0 ts:-1.000000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5652 size: 8917
+ret: 0 st:-1 flags:1 ts: 1.894167
+ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 83790 size: 11170
+ret: 0 st: 0 flags:0 ts: 0.800000
+ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 54572 size: 9989
+ret:-1 st: 0 flags:1 ts:-0.320000
+ret:-1 st:-1 flags:0 ts: 2.576668
+ret: 0 st:-1 flags:1 ts: 1.470835
+ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 83790 size: 11170
+ret: 0 st: 0 flags:0 ts: 0.360000
+ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 29632 size: 8839
+ret:-1 st: 0 flags:1 ts:-0.760000
+ret:-1 st:-1 flags:0 ts: 2.153336
+ret: 0 st:-1 flags:1 ts: 1.047503
+ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 54572 size: 9989
+ret: 0 st: 0 flags:0 ts:-0.040000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5652 size: 8917
+ret: 0 st: 0 flags:1 ts: 2.840000
+ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 116058 size: 11554
+ret: 0 st:-1 flags:0 ts: 1.730004
+ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 116058 size: 11554
+ret: 0 st:-1 flags:1 ts: 0.624171
+ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 29632 size: 8839
+ret: 0 st: 0 flags:0 ts:-0.480000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5652 size: 8917
+ret: 0 st: 0 flags:1 ts: 2.400000
+ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 116058 size: 11554
+ret: 0 st:-1 flags:0 ts: 1.306672
+ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 83790 size: 11170
+ret: 0 st:-1 flags:1 ts: 0.200839
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5652 size: 8917
+ret: 0 st: 0 flags:0 ts:-0.920000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5652 size: 8917
+ret: 0 st: 0 flags:1 ts: 2.000000
+ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 116058 size: 11554
+ret: 0 st:-1 flags:0 ts: 0.883340
+ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 54572 size: 9989
+ret:-1 st:-1 flags:1 ts:-0.222493
+ret:-1 st: 0 flags:0 ts: 2.680000
+ret: 0 st: 0 flags:1 ts: 1.560000
+ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 83790 size: 11170
+ret: 0 st:-1 flags:0 ts: 0.460008
+ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 29632 size: 8839
+ret:-1 st:-1 flags:1 ts:-0.645825
diff --git a/gst-libs/ext/libav/tests/ref/seek/vsynth2-yuv b/gst-libs/ext/libav/tests/ref/seek/vsynth2-yuv
new file mode 100644
index 0000000..d440761
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/seek/vsynth2-yuv
@@ -0,0 +1,46 @@
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5648 size:152064
+ret: 0 st:-1 flags:0 ts:-1.000000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5648 size:152064
+ret: 0 st:-1 flags:1 ts: 1.894167
+ret: 0 st: 0 flags:1 dts: 1.880000 pts: 1.880000 pos:7153032 size:152064
+ret: 0 st: 0 flags:0 ts: 0.800000
+ret: 0 st: 0 flags:1 dts: 0.800000 pts: 0.800000 pos:3047088 size:152064
+ret:-1 st: 0 flags:1 ts:-0.320000
+ret:-1 st:-1 flags:0 ts: 2.576668
+ret: 0 st:-1 flags:1 ts: 1.470835
+ret: 0 st: 0 flags:1 dts: 1.480000 pts: 1.480000 pos:5632312 size:152064
+ret: 0 st: 0 flags:0 ts: 0.360000
+ret: 0 st: 0 flags:1 dts: 0.360000 pts: 0.360000 pos:1374296 size:152064
+ret:-1 st: 0 flags:1 ts:-0.760000
+ret:-1 st:-1 flags:0 ts: 2.153336
+ret: 0 st:-1 flags:1 ts: 1.047503
+ret: 0 st: 0 flags:1 dts: 1.040000 pts: 1.040000 pos:3959520 size:152064
+ret: 0 st: 0 flags:0 ts:-0.040000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5648 size:152064
+ret: 0 st: 0 flags:1 ts: 2.840000
+ret: 0 st: 0 flags:1 dts: 1.960000 pts: 1.960000 pos:7457176 size:152064
+ret: 0 st:-1 flags:0 ts: 1.730004
+ret: 0 st: 0 flags:1 dts: 1.720000 pts: 1.720000 pos:6544744 size:152064
+ret: 0 st:-1 flags:1 ts: 0.624171
+ret: 0 st: 0 flags:1 dts: 0.640000 pts: 0.640000 pos:2438800 size:152064
+ret: 0 st: 0 flags:0 ts:-0.480000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5648 size:152064
+ret: 0 st: 0 flags:1 ts: 2.400000
+ret: 0 st: 0 flags:1 dts: 1.960000 pts: 1.960000 pos:7457176 size:152064
+ret: 0 st:-1 flags:0 ts: 1.306672
+ret: 0 st: 0 flags:1 dts: 1.320000 pts: 1.320000 pos:5024024 size:152064
+ret: 0 st:-1 flags:1 ts: 0.200839
+ret: 0 st: 0 flags:1 dts: 0.200000 pts: 0.200000 pos: 766008 size:152064
+ret: 0 st: 0 flags:0 ts:-0.920000
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5648 size:152064
+ret: 0 st: 0 flags:1 ts: 2.000000
+ret: 0 st: 0 flags:1 dts: 1.960000 pts: 1.960000 pos:7457176 size:152064
+ret: 0 st:-1 flags:0 ts: 0.883340
+ret: 0 st: 0 flags:1 dts: 0.880000 pts: 0.880000 pos:3351232 size:152064
+ret:-1 st:-1 flags:1 ts:-0.222493
+ret:-1 st: 0 flags:0 ts: 2.680000
+ret: 0 st: 0 flags:1 ts: 1.560000
+ret: 0 st: 0 flags:1 dts: 1.560000 pts: 1.560000 pos:5936456 size:152064
+ret: 0 st:-1 flags:0 ts: 0.460008
+ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos:1830512 size:152064
+ret:-1 st:-1 flags:1 ts:-0.645825
diff --git a/gst-libs/ext/libav/tests/ref/seek/wmav1_asf b/gst-libs/ext/libav/tests/ref/seek/wmav1_asf
deleted file mode 100644
index 47c5b46..0000000
--- a/gst-libs/ext/libav/tests/ref/seek/wmav1_asf
+++ /dev/null
@@ -1,53 +0,0 @@
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 404 size: 743
-ret: 0 st:-1 flags:0 ts:-1.000000
-ret: 0 st: 0 flags:1 dts: 0.186000 pts: 0.186000 pos: 3604 size: 743
-ret: 0 st:-1 flags:1 ts: 1.894167
-ret: 0 st: 0 flags:1 dts: 1.858000 pts: 1.858000 pos: 32404 size: 743
-ret: 0 st: 0 flags:0 ts: 0.788000
-ret: 0 st: 0 flags:1 dts: 0.929000 pts: 0.929000 pos: 16404 size: 743
-ret: 0 st: 0 flags:1 ts:-0.317000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 404 size: 743
-ret: 0 st:-1 flags:0 ts: 2.576668
-ret: 0 st: 0 flags:1 dts: 2.601000 pts: 2.601000 pos: 45204 size: 743
-ret: 0 st:-1 flags:1 ts: 1.470835
-ret: 0 st: 0 flags:1 dts: 1.300000 pts: 1.300000 pos: 22804 size: 743
-ret: 0 st: 0 flags:0 ts: 0.365000
-ret: 0 st: 0 flags:1 dts: 0.372000 pts: 0.372000 pos: 6804 size: 743
-ret: 0 st: 0 flags:1 ts:-0.741000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 404 size: 743
-ret: 0 st:-1 flags:0 ts: 2.153336
-ret: 0 st: 0 flags:1 dts: 2.229000 pts: 2.229000 pos: 38804 size: 743
-ret: 0 st:-1 flags:1 ts: 1.047503
-ret: 0 st: 0 flags:1 dts: 0.929000 pts: 0.929000 pos: 16404 size: 743
-ret: 0 st: 0 flags:0 ts:-0.058000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 404 size: 743
-ret: 0 st: 0 flags:1 ts: 2.836000
-ret: 0 st: 0 flags:1 dts: 2.786000 pts: 2.786000 pos: 48404 size: 743
-ret: 0 st:-1 flags:0 ts: 1.730004
-ret: 0 st: 0 flags:1 dts: 1.858000 pts: 1.858000 pos: 32404 size: 743
-ret: 0 st:-1 flags:1 ts: 0.624171
-ret: 0 st: 0 flags:1 dts: 0.557000 pts: 0.557000 pos: 10004 size: 743
-ret: 0 st: 0 flags:0 ts:-0.482000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 404 size: 743
-ret: 0 st: 0 flags:1 ts: 2.413000
-ret: 0 st: 0 flags:1 dts: 2.229000 pts: 2.229000 pos: 38804 size: 743
-ret: 0 st:-1 flags:0 ts: 1.306672
-ret: 0 st: 0 flags:1 dts: 1.486000 pts: 1.486000 pos: 26004 size: 743
-ret: 0 st:-1 flags:1 ts: 0.200839
-ret: 0 st: 0 flags:1 dts: 0.186000 pts: 0.186000 pos: 3604 size: 743
-ret: 0 st: 0 flags:0 ts:-0.905000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 404 size: 743
-ret: 0 st: 0 flags:1 ts: 1.989000
-ret: 0 st: 0 flags:1 dts: 1.858000 pts: 1.858000 pos: 32404 size: 743
-ret: 0 st:-1 flags:0 ts: 0.883340
-ret: 0 st: 0 flags:1 dts: 0.929000 pts: 0.929000 pos: 16404 size: 743
-ret: 0 st:-1 flags:1 ts:-0.222493
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 404 size: 743
-ret: 0 st: 0 flags:0 ts: 2.672000
-ret: 0 st: 0 flags:1 dts: 2.786000 pts: 2.786000 pos: 48404 size: 743
-ret: 0 st: 0 flags:1 ts: 1.566000
-ret: 0 st: 0 flags:1 dts: 1.486000 pts: 1.486000 pos: 26004 size: 743
-ret: 0 st:-1 flags:0 ts: 0.460008
-ret: 0 st: 0 flags:1 dts: 0.557000 pts: 0.557000 pos: 10004 size: 743
-ret: 0 st:-1 flags:1 ts:-0.645825
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 404 size: 743
diff --git a/gst-libs/ext/libav/tests/ref/seek/wmav2_asf b/gst-libs/ext/libav/tests/ref/seek/wmav2_asf
deleted file mode 100644
index 7c58da2..0000000
--- a/gst-libs/ext/libav/tests/ref/seek/wmav2_asf
+++ /dev/null
@@ -1,53 +0,0 @@
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 444 size: 743
-ret: 0 st:-1 flags:0 ts:-1.000000
-ret: 0 st: 0 flags:1 dts: 0.186000 pts: 0.186000 pos: 3644 size: 743
-ret: 0 st:-1 flags:1 ts: 1.894167
-ret: 0 st: 0 flags:1 dts: 1.858000 pts: 1.858000 pos: 32444 size: 743
-ret: 0 st: 0 flags:0 ts: 0.788000
-ret: 0 st: 0 flags:1 dts: 0.929000 pts: 0.929000 pos: 16444 size: 743
-ret: 0 st: 0 flags:1 ts:-0.317000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 444 size: 743
-ret: 0 st:-1 flags:0 ts: 2.576668
-ret: 0 st: 0 flags:1 dts: 2.601000 pts: 2.601000 pos: 45244 size: 743
-ret: 0 st:-1 flags:1 ts: 1.470835
-ret: 0 st: 0 flags:1 dts: 1.300000 pts: 1.300000 pos: 22844 size: 743
-ret: 0 st: 0 flags:0 ts: 0.365000
-ret: 0 st: 0 flags:1 dts: 0.372000 pts: 0.372000 pos: 6844 size: 743
-ret: 0 st: 0 flags:1 ts:-0.741000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 444 size: 743
-ret: 0 st:-1 flags:0 ts: 2.153336
-ret: 0 st: 0 flags:1 dts: 2.229000 pts: 2.229000 pos: 38844 size: 743
-ret: 0 st:-1 flags:1 ts: 1.047503
-ret: 0 st: 0 flags:1 dts: 0.929000 pts: 0.929000 pos: 16444 size: 743
-ret: 0 st: 0 flags:0 ts:-0.058000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 444 size: 743
-ret: 0 st: 0 flags:1 ts: 2.836000
-ret: 0 st: 0 flags:1 dts: 2.786000 pts: 2.786000 pos: 48444 size: 743
-ret: 0 st:-1 flags:0 ts: 1.730004
-ret: 0 st: 0 flags:1 dts: 1.858000 pts: 1.858000 pos: 32444 size: 743
-ret: 0 st:-1 flags:1 ts: 0.624171
-ret: 0 st: 0 flags:1 dts: 0.557000 pts: 0.557000 pos: 10044 size: 743
-ret: 0 st: 0 flags:0 ts:-0.482000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 444 size: 743
-ret: 0 st: 0 flags:1 ts: 2.413000
-ret: 0 st: 0 flags:1 dts: 2.229000 pts: 2.229000 pos: 38844 size: 743
-ret: 0 st:-1 flags:0 ts: 1.306672
-ret: 0 st: 0 flags:1 dts: 1.486000 pts: 1.486000 pos: 26044 size: 743
-ret: 0 st:-1 flags:1 ts: 0.200839
-ret: 0 st: 0 flags:1 dts: 0.186000 pts: 0.186000 pos: 3644 size: 743
-ret: 0 st: 0 flags:0 ts:-0.905000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 444 size: 743
-ret: 0 st: 0 flags:1 ts: 1.989000
-ret: 0 st: 0 flags:1 dts: 1.858000 pts: 1.858000 pos: 32444 size: 743
-ret: 0 st:-1 flags:0 ts: 0.883340
-ret: 0 st: 0 flags:1 dts: 0.929000 pts: 0.929000 pos: 16444 size: 743
-ret: 0 st:-1 flags:1 ts:-0.222493
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 444 size: 743
-ret: 0 st: 0 flags:0 ts: 2.672000
-ret: 0 st: 0 flags:1 dts: 2.786000 pts: 2.786000 pos: 48444 size: 743
-ret: 0 st: 0 flags:1 ts: 1.566000
-ret: 0 st: 0 flags:1 dts: 1.486000 pts: 1.486000 pos: 26044 size: 743
-ret: 0 st:-1 flags:0 ts: 0.460008
-ret: 0 st: 0 flags:1 dts: 0.557000 pts: 0.557000 pos: 10044 size: 743
-ret: 0 st:-1 flags:1 ts:-0.645825
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 444 size: 743
diff --git a/gst-libs/ext/libav/tests/ref/seek/wmv1_avi b/gst-libs/ext/libav/tests/ref/seek/wmv1_avi
deleted file mode 100644
index 8739c96..0000000
--- a/gst-libs/ext/libav/tests/ref/seek/wmv1_avi
+++ /dev/null
@@ -1,46 +0,0 @@
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5660 size: 8990
-ret: 0 st:-1 flags:0 ts:-1.000000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5660 size: 8990
-ret: 0 st:-1 flags:1 ts: 1.894167
-ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 83754 size: 11099
-ret: 0 st: 0 flags:0 ts: 0.800000
-ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 54770 size: 9931
-ret:-1 st: 0 flags:1 ts:-0.320000
-ret:-1 st:-1 flags:0 ts: 2.576668
-ret: 0 st:-1 flags:1 ts: 1.470835
-ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 83754 size: 11099
-ret: 0 st: 0 flags:0 ts: 0.360000
-ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 29806 size: 8796
-ret:-1 st: 0 flags:1 ts:-0.760000
-ret:-1 st:-1 flags:0 ts: 2.153336
-ret: 0 st:-1 flags:1 ts: 1.047503
-ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 54770 size: 9931
-ret: 0 st: 0 flags:0 ts:-0.040000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5660 size: 8990
-ret: 0 st: 0 flags:1 ts: 2.840000
-ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 115824 size: 11487
-ret: 0 st:-1 flags:0 ts: 1.730004
-ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 115824 size: 11487
-ret: 0 st:-1 flags:1 ts: 0.624171
-ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 29806 size: 8796
-ret: 0 st: 0 flags:0 ts:-0.480000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5660 size: 8990
-ret: 0 st: 0 flags:1 ts: 2.400000
-ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 115824 size: 11487
-ret: 0 st:-1 flags:0 ts: 1.306672
-ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 83754 size: 11099
-ret: 0 st:-1 flags:1 ts: 0.200839
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5660 size: 8990
-ret: 0 st: 0 flags:0 ts:-0.920000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5660 size: 8990
-ret: 0 st: 0 flags:1 ts: 2.000000
-ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 115824 size: 11487
-ret: 0 st:-1 flags:0 ts: 0.883340
-ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 54770 size: 9931
-ret:-1 st:-1 flags:1 ts:-0.222493
-ret:-1 st: 0 flags:0 ts: 2.680000
-ret: 0 st: 0 flags:1 ts: 1.560000
-ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 83754 size: 11099
-ret: 0 st:-1 flags:0 ts: 0.460008
-ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 29806 size: 8796
-ret:-1 st:-1 flags:1 ts:-0.645825
diff --git a/gst-libs/ext/libav/tests/ref/seek/wmv2_avi b/gst-libs/ext/libav/tests/ref/seek/wmv2_avi
deleted file mode 100644
index ca01a39..0000000
--- a/gst-libs/ext/libav/tests/ref/seek/wmv2_avi
+++ /dev/null
@@ -1,46 +0,0 @@
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5664 size: 8917
-ret: 0 st:-1 flags:0 ts:-1.000000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5664 size: 8917
-ret: 0 st:-1 flags:1 ts: 1.894167
-ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 83802 size: 11170
-ret: 0 st: 0 flags:0 ts: 0.800000
-ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 54584 size: 9989
-ret:-1 st: 0 flags:1 ts:-0.320000
-ret:-1 st:-1 flags:0 ts: 2.576668
-ret: 0 st:-1 flags:1 ts: 1.470835
-ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 83802 size: 11170
-ret: 0 st: 0 flags:0 ts: 0.360000
-ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 29644 size: 8839
-ret:-1 st: 0 flags:1 ts:-0.760000
-ret:-1 st:-1 flags:0 ts: 2.153336
-ret: 0 st:-1 flags:1 ts: 1.047503
-ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 54584 size: 9989
-ret: 0 st: 0 flags:0 ts:-0.040000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5664 size: 8917
-ret: 0 st: 0 flags:1 ts: 2.840000
-ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 116070 size: 11554
-ret: 0 st:-1 flags:0 ts: 1.730004
-ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 116070 size: 11554
-ret: 0 st:-1 flags:1 ts: 0.624171
-ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 29644 size: 8839
-ret: 0 st: 0 flags:0 ts:-0.480000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5664 size: 8917
-ret: 0 st: 0 flags:1 ts: 2.400000
-ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 116070 size: 11554
-ret: 0 st:-1 flags:0 ts: 1.306672
-ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 83802 size: 11170
-ret: 0 st:-1 flags:1 ts: 0.200839
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5664 size: 8917
-ret: 0 st: 0 flags:0 ts:-0.920000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5664 size: 8917
-ret: 0 st: 0 flags:1 ts: 2.000000
-ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 116070 size: 11554
-ret: 0 st:-1 flags:0 ts: 0.883340
-ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 54584 size: 9989
-ret:-1 st:-1 flags:1 ts:-0.222493
-ret:-1 st: 0 flags:0 ts: 2.680000
-ret: 0 st: 0 flags:1 ts: 1.560000
-ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 83802 size: 11170
-ret: 0 st:-1 flags:0 ts: 0.460008
-ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 29644 size: 8839
-ret:-1 st:-1 flags:1 ts:-0.645825
diff --git a/gst-libs/ext/libav/tests/ref/seek/yuv_avi b/gst-libs/ext/libav/tests/ref/seek/yuv_avi
deleted file mode 100644
index 49c514e..0000000
--- a/gst-libs/ext/libav/tests/ref/seek/yuv_avi
+++ /dev/null
@@ -1,46 +0,0 @@
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5660 size:152064
-ret: 0 st:-1 flags:0 ts:-1.000000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5660 size:152064
-ret: 0 st:-1 flags:1 ts: 1.894167
-ret: 0 st: 0 flags:1 dts: 1.880000 pts: 1.880000 pos:7153044 size:152064
-ret: 0 st: 0 flags:0 ts: 0.800000
-ret: 0 st: 0 flags:1 dts: 0.800000 pts: 0.800000 pos:3047100 size:152064
-ret:-1 st: 0 flags:1 ts:-0.320000
-ret:-1 st:-1 flags:0 ts: 2.576668
-ret: 0 st:-1 flags:1 ts: 1.470835
-ret: 0 st: 0 flags:1 dts: 1.480000 pts: 1.480000 pos:5632324 size:152064
-ret: 0 st: 0 flags:0 ts: 0.360000
-ret: 0 st: 0 flags:1 dts: 0.360000 pts: 0.360000 pos:1374308 size:152064
-ret:-1 st: 0 flags:1 ts:-0.760000
-ret:-1 st:-1 flags:0 ts: 2.153336
-ret: 0 st:-1 flags:1 ts: 1.047503
-ret: 0 st: 0 flags:1 dts: 1.040000 pts: 1.040000 pos:3959532 size:152064
-ret: 0 st: 0 flags:0 ts:-0.040000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5660 size:152064
-ret: 0 st: 0 flags:1 ts: 2.840000
-ret: 0 st: 0 flags:1 dts: 1.960000 pts: 1.960000 pos:7457188 size:152064
-ret: 0 st:-1 flags:0 ts: 1.730004
-ret: 0 st: 0 flags:1 dts: 1.720000 pts: 1.720000 pos:6544756 size:152064
-ret: 0 st:-1 flags:1 ts: 0.624171
-ret: 0 st: 0 flags:1 dts: 0.640000 pts: 0.640000 pos:2438812 size:152064
-ret: 0 st: 0 flags:0 ts:-0.480000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5660 size:152064
-ret: 0 st: 0 flags:1 ts: 2.400000
-ret: 0 st: 0 flags:1 dts: 1.960000 pts: 1.960000 pos:7457188 size:152064
-ret: 0 st:-1 flags:0 ts: 1.306672
-ret: 0 st: 0 flags:1 dts: 1.320000 pts: 1.320000 pos:5024036 size:152064
-ret: 0 st:-1 flags:1 ts: 0.200839
-ret: 0 st: 0 flags:1 dts: 0.200000 pts: 0.200000 pos: 766020 size:152064
-ret: 0 st: 0 flags:0 ts:-0.920000
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5660 size:152064
-ret: 0 st: 0 flags:1 ts: 2.000000
-ret: 0 st: 0 flags:1 dts: 1.960000 pts: 1.960000 pos:7457188 size:152064
-ret: 0 st:-1 flags:0 ts: 0.883340
-ret: 0 st: 0 flags:1 dts: 0.880000 pts: 0.880000 pos:3351244 size:152064
-ret:-1 st:-1 flags:1 ts:-0.222493
-ret:-1 st: 0 flags:0 ts: 2.680000
-ret: 0 st: 0 flags:1 ts: 1.560000
-ret: 0 st: 0 flags:1 dts: 1.560000 pts: 1.560000 pos:5936468 size:152064
-ret: 0 st:-1 flags:0 ts: 0.460008
-ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos:1830524 size:152064
-ret:-1 st:-1 flags:1 ts:-0.645825
diff --git a/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-asv1 b/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-asv1
new file mode 100644
index 0000000..e640f1c
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-asv1
@@ -0,0 +1,4 @@
+41b011551d23ddadaab1083cb2106d9f *tests/data/fate/vsynth1-asv1.avi
+1489644 tests/data/fate/vsynth1-asv1.avi
+2dfc5dfc2c1cbbc2543257cd3d2df6af *tests/data/fate/vsynth1-asv1.out.rawvideo
+stddev: 20.00 PSNR: 22.11 MAXDIFF: 158 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-asv2 b/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-asv2
new file mode 100644
index 0000000..6282ad4
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-asv2
@@ -0,0 +1,4 @@
+a0773690d0e772ff832adea1e8c16773 *tests/data/fate/vsynth1-asv2.avi
+1456044 tests/data/fate/vsynth1-asv2.avi
+d451be09793cd0f35b6d91fc36e2571a *tests/data/fate/vsynth1-asv2.out.rawvideo
+stddev: 18.82 PSNR: 22.63 MAXDIFF: 131 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-cljr b/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-cljr
new file mode 100644
index 0000000..cdd6ca2
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-cljr
@@ -0,0 +1,4 @@
+41fc45d5e8bca3cf2be35457b188cdb3 *tests/data/fate/vsynth1-cljr.avi
+5075648 tests/data/fate/vsynth1-cljr.avi
+72e01607bae16527bc6389cf6db00b5f *tests/data/fate/vsynth1-cljr.out.rawvideo
+stddev: 6.95 PSNR: 31.28 MAXDIFF: 86 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-dnxhd-1080i b/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-dnxhd-1080i
new file mode 100644
index 0000000..3a990c5
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-dnxhd-1080i
@@ -0,0 +1,4 @@
+2412f206f5efcbbcc3f2bba0c86b73d4 *tests/data/fate/vsynth1-dnxhd-1080i.mov
+3031875 tests/data/fate/vsynth1-dnxhd-1080i.mov
+34076f61254997c8157eafed1c916472 *tests/data/fate/vsynth1-dnxhd-1080i.out.rawvideo
+stddev: 6.29 PSNR: 32.15 MAXDIFF: 64 bytes: 7603200/ 760320
diff --git a/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-dnxhd-720p b/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-dnxhd-720p
new file mode 100644
index 0000000..94c28ed
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-dnxhd-720p
@@ -0,0 +1,4 @@
+81f5be451dc18cf8a1d333c7885de60b *tests/data/fate/vsynth1-dnxhd-720p.dnxhd
+2293760 tests/data/fate/vsynth1-dnxhd-720p.dnxhd
+94b21e5e68ccf9471eff74afd0ebe319 *tests/data/fate/vsynth1-dnxhd-720p.out.rawvideo
+stddev: 6.32 PSNR: 32.11 MAXDIFF: 183 bytes: 7603200/ 760320
diff --git a/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-dnxhd-720p-10bit b/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-dnxhd-720p-10bit
new file mode 100644
index 0000000..a667b9d
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-dnxhd-720p-10bit
@@ -0,0 +1,4 @@
+b5e24a055af02edec8674333260214fd *tests/data/fate/vsynth1-dnxhd-720p-10bit.dnxhd
+2293760 tests/data/fate/vsynth1-dnxhd-720p-10bit.dnxhd
+4466ff3d73d01bbe75ea25001d379b63 *tests/data/fate/vsynth1-dnxhd-720p-10bit.out.rawvideo
+stddev: 6.27 PSNR: 32.18 MAXDIFF: 64 bytes: 7603200/ 760320
diff --git a/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-dnxhd-720p-rd b/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-dnxhd-720p-rd
new file mode 100644
index 0000000..1de576a
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-dnxhd-720p-rd
@@ -0,0 +1,4 @@
+1dc6e95925c4f3a230848ec17c02abed *tests/data/fate/vsynth1-dnxhd-720p-rd.dnxhd
+2293760 tests/data/fate/vsynth1-dnxhd-720p-rd.dnxhd
+02972d2aec120ec1577ec9053d68ae0f *tests/data/fate/vsynth1-dnxhd-720p-rd.out.rawvideo
+stddev: 6.26 PSNR: 32.19 MAXDIFF: 65 bytes: 7603200/ 760320
diff --git a/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-dv b/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-dv
new file mode 100644
index 0000000..f5a37ad
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-dv
@@ -0,0 +1,4 @@
+27ade3031b17214cf81c19cbf70f37d7 *tests/data/fate/vsynth1-dv.dv
+7200000 tests/data/fate/vsynth1-dv.dv
+02ac7cdeab91d4d5621e7ce96dddc498 *tests/data/fate/vsynth1-dv.out.rawvideo
+stddev: 6.90 PSNR: 31.34 MAXDIFF: 76 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-dv-411 b/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-dv-411
new file mode 100644
index 0000000..a1f07da
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-dv-411
@@ -0,0 +1,4 @@
+bd67f2431db160d4bb6dcd791cea6efd *tests/data/fate/vsynth1-dv-411.dv
+7200000 tests/data/fate/vsynth1-dv-411.dv
+53946d51762b7826773e681fb02f377b *tests/data/fate/vsynth1-dv-411.out.rawvideo
+stddev: 9.45 PSNR: 28.62 MAXDIFF: 84 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-dv-50 b/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-dv-50
new file mode 100644
index 0000000..18ee398
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-dv-50
@@ -0,0 +1,4 @@
+26dba84f0ea895b914ef5b333d8394ac *tests/data/fate/vsynth1-dv-50.dv
+14400000 tests/data/fate/vsynth1-dv-50.dv
+a2ff093e93ffed10f730fa21df02fc50 *tests/data/fate/vsynth1-dv-50.out.rawvideo
+stddev: 1.72 PSNR: 43.38 MAXDIFF: 29 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-ffv1 b/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-ffv1
new file mode 100644
index 0000000..99787ed
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-ffv1
@@ -0,0 +1,4 @@
+91c237f18bc19975077c85175daed734 *tests/data/fate/vsynth1-ffv1.avi
+2655364 tests/data/fate/vsynth1-ffv1.avi
+c5ccac874dbf808e9088bc3107860042 *tests/data/fate/vsynth1-ffv1.out.rawvideo
+stddev: 0.00 PSNR:999.99 MAXDIFF: 0 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-ffvhuff b/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-ffvhuff
new file mode 100644
index 0000000..cf86f57
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-ffvhuff
@@ -0,0 +1,4 @@
+2279cfd5efce9dc3435b814f1f95dcbc *tests/data/fate/vsynth1-ffvhuff.avi
+5987196 tests/data/fate/vsynth1-ffvhuff.avi
+c5ccac874dbf808e9088bc3107860042 *tests/data/fate/vsynth1-ffvhuff.out.rawvideo
+stddev: 0.00 PSNR:999.99 MAXDIFF: 0 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-flashsv b/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-flashsv
new file mode 100644
index 0000000..b934d8d
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-flashsv
@@ -0,0 +1,4 @@
+97894502b4cb57aca1105b6333f72dae *tests/data/fate/vsynth1-flashsv.flv
+14681925 tests/data/fate/vsynth1-flashsv.flv
+947cb24ec45a453348ae6fe3fa278071 *tests/data/fate/vsynth1-flashsv.out.rawvideo
+stddev: 2.85 PSNR: 39.03 MAXDIFF: 49 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-flv b/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-flv
new file mode 100644
index 0000000..4b57bdf
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-flv
@@ -0,0 +1,4 @@
+d6a80659cedee7698aefe9c4a8285fa4 *tests/data/fate/vsynth1-flv.flv
+636269 tests/data/fate/vsynth1-flv.flv
+5ab46d8dd01dbb1d63df2a84858a4b05 *tests/data/fate/vsynth1-flv.out.rawvideo
+stddev: 8.02 PSNR: 30.04 MAXDIFF: 105 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-h261 b/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-h261
new file mode 100644
index 0000000..b350e6f
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-h261
@@ -0,0 +1,4 @@
+d3397557ad8a02d28cb5feeb0b51e5c8 *tests/data/fate/vsynth1-h261.avi
+707576 tests/data/fate/vsynth1-h261.avi
+716e83cb51afb1246bfaa80967df48ea *tests/data/fate/vsynth1-h261.out.rawvideo
+stddev: 9.11 PSNR: 28.93 MAXDIFF: 113 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-h263 b/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-h263
new file mode 100644
index 0000000..d5916fa
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-h263
@@ -0,0 +1,4 @@
+130ae384b6f12fd7d18979aa5371523a *tests/data/fate/vsynth1-h263.avi
+659674 tests/data/fate/vsynth1-h263.avi
+1a1ba9a3a63ec1a1a9585fded0a7c954 *tests/data/fate/vsynth1-h263.out.rawvideo
+stddev: 8.03 PSNR: 30.03 MAXDIFF: 103 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-h263-obmc b/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-h263-obmc
new file mode 100644
index 0000000..ca3d4bf
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-h263-obmc
@@ -0,0 +1,4 @@
+4e7faa9203abf55a492802d30a8d80ea *tests/data/fate/vsynth1-h263-obmc.avi
+657354 tests/data/fate/vsynth1-h263-obmc.avi
+eba1d733a0c4b71322a78f718f312599 *tests/data/fate/vsynth1-h263-obmc.out.rawvideo
+stddev: 8.16 PSNR: 29.89 MAXDIFF: 113 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-h263p b/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-h263p
new file mode 100644
index 0000000..9e1765f
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-h263p
@@ -0,0 +1,4 @@
+b34c1a52bb504e702485d8d268dd1068 *tests/data/fate/vsynth1-h263p.avi
+2328336 tests/data/fate/vsynth1-h263p.avi
+9554cda00c3487ab3ffda2c3ea22fa2f *tests/data/fate/vsynth1-h263p.out.rawvideo
+stddev: 2.06 PSNR: 41.83 MAXDIFF: 20 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-huffyuv b/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-huffyuv
new file mode 100644
index 0000000..246da19
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-huffyuv
@@ -0,0 +1,4 @@
+cd93849c8e9846490d8f950f1b2319d5 *tests/data/fate/vsynth1-huffyuv.avi
+7933788 tests/data/fate/vsynth1-huffyuv.avi
+c5ccac874dbf808e9088bc3107860042 *tests/data/fate/vsynth1-huffyuv.out.rawvideo
+stddev: 0.00 PSNR:999.99 MAXDIFF: 0 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-jpegls b/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-jpegls
new file mode 100644
index 0000000..b54bd5d
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-jpegls
@@ -0,0 +1,4 @@
+f8acf917e24ea6c9200f2cdf99744ca9 *tests/data/fate/vsynth1-jpegls.avi
+9089800 tests/data/fate/vsynth1-jpegls.avi
+947cb24ec45a453348ae6fe3fa278071 *tests/data/fate/vsynth1-jpegls.out.rawvideo
+stddev: 2.85 PSNR: 39.03 MAXDIFF: 49 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-ljpeg b/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-ljpeg
new file mode 100644
index 0000000..e229db5
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-ljpeg
@@ -0,0 +1,4 @@
+2b1a2d5ad7f357df955d8548320d13f7 *tests/data/fate/vsynth1-ljpeg.avi
+6312924 tests/data/fate/vsynth1-ljpeg.avi
+c5ccac874dbf808e9088bc3107860042 *tests/data/fate/vsynth1-ljpeg.out.rawvideo
+stddev: 0.00 PSNR:999.99 MAXDIFF: 0 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-mjpeg b/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-mjpeg
new file mode 100644
index 0000000..3c6fb4b
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-mjpeg
@@ -0,0 +1,4 @@
+b3ff9a5a9699ceddfee9abbf1b06bb00 *tests/data/fate/vsynth1-mjpeg.avi
+1516128 tests/data/fate/vsynth1-mjpeg.avi
+c6ae81b5b896e4d05ff584311aebdb18 *tests/data/fate/vsynth1-mjpeg.out.rawvideo
+stddev: 7.87 PSNR: 30.21 MAXDIFF: 63 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-mpeg1 b/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-mpeg1
new file mode 100644
index 0000000..5f3d703
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-mpeg1
@@ -0,0 +1,4 @@
+1428744c6d5835f27506e69be4f837f4 *tests/data/fate/vsynth1-mpeg1.mpeg1video
+712006 tests/data/fate/vsynth1-mpeg1.mpeg1video
+58f0c332bf689117b57fa629a2bc0d2b *tests/data/fate/vsynth1-mpeg1.out.rawvideo
+stddev: 7.62 PSNR: 30.48 MAXDIFF: 84 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-mpeg1b b/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-mpeg1b
new file mode 100644
index 0000000..ddd9bef
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-mpeg1b
@@ -0,0 +1,4 @@
+777639666b449ab0a7ef260511e40532 *tests/data/fate/vsynth1-mpeg1b.mpeg1video
+1030337 tests/data/fate/vsynth1-mpeg1b.mpeg1video
+91a7fce732b34748e7bf753ebabe2483 *tests/data/fate/vsynth1-mpeg1b.out.rawvideo
+stddev: 6.30 PSNR: 32.13 MAXDIFF: 75 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-mpeg2 b/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-mpeg2
new file mode 100644
index 0000000..1ee3674
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-mpeg2
@@ -0,0 +1,4 @@
+fbddea2368cd2028fc8db4dfd4682e94 *tests/data/fate/vsynth1-mpeg2.mpeg2video
+728044 tests/data/fate/vsynth1-mpeg2.mpeg2video
+b41ca49c1a02e66ce64d262e2cdaec15 *tests/data/fate/vsynth1-mpeg2.out.rawvideo
+stddev: 7.65 PSNR: 30.45 MAXDIFF: 84 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-mpeg2-422 b/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-mpeg2-422
new file mode 100644
index 0000000..5948446
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-mpeg2-422
@@ -0,0 +1,4 @@
+af0cb75451aaa807beb5102707a98823 *tests/data/fate/vsynth1-mpeg2-422.mpeg2video
+728200 tests/data/fate/vsynth1-mpeg2-422.mpeg2video
+eb7fe83ce09af2d79ec16577c9d44e3c *tests/data/fate/vsynth1-mpeg2-422.out.rawvideo
+stddev: 10.29 PSNR: 27.88 MAXDIFF: 168 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-mpeg2-idct-int b/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-mpeg2-idct-int
new file mode 100644
index 0000000..dd72d71
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-mpeg2-idct-int
@@ -0,0 +1,4 @@
+4c067397b504d65532d7779cd36f3f88 *tests/data/fate/vsynth1-mpeg2-idct-int.mpeg2video
+725668 tests/data/fate/vsynth1-mpeg2-idct-int.mpeg2video
+8130f71a467315c9e7bd1a25a01dbb23 *tests/data/fate/vsynth1-mpeg2-idct-int.out.rawvideo
+stddev: 7.65 PSNR: 30.45 MAXDIFF: 80 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-mpeg2-ilace b/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-mpeg2-ilace
new file mode 100644
index 0000000..be08c31
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-mpeg2-ilace
@@ -0,0 +1,4 @@
+ec3f6713c88a2b41f6c369fd64341077 *tests/data/fate/vsynth1-mpeg2-ilace.mpeg2video
+737473 tests/data/fate/vsynth1-mpeg2-ilace.mpeg2video
+97615390fdd69abfcbc7e02df863a7d2 *tests/data/fate/vsynth1-mpeg2-ilace.out.rawvideo
+stddev: 7.67 PSNR: 30.43 MAXDIFF: 84 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-mpeg2-ivlc-qprd b/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-mpeg2-ivlc-qprd
new file mode 100644
index 0000000..5ef30cd
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-mpeg2-ivlc-qprd
@@ -0,0 +1,4 @@
+8f6b20714918e6443e0c03716ed06f0d *tests/data/fate/vsynth1-mpeg2-ivlc-qprd.mpeg2video
+783552 tests/data/fate/vsynth1-mpeg2-ivlc-qprd.mpeg2video
+98eb9da15f880978e7f2ee1e7ce476ef *tests/data/fate/vsynth1-mpeg2-ivlc-qprd.out.rawvideo
+stddev: 10.07 PSNR: 28.06 MAXDIFF: 165 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-mpeg2-thread b/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-mpeg2-thread
new file mode 100644
index 0000000..55a4fab
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-mpeg2-thread
@@ -0,0 +1,4 @@
+ecd183706688bd977c9994c3d1b23d61 *tests/data/fate/vsynth1-mpeg2-thread.mpeg2video
+801313 tests/data/fate/vsynth1-mpeg2-thread.mpeg2video
+d1658911ca83f5616c1d32abc40750de *tests/data/fate/vsynth1-mpeg2-thread.out.rawvideo
+stddev: 7.63 PSNR: 30.48 MAXDIFF: 110 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-mpeg2-thread-ivlc b/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-mpeg2-thread-ivlc
new file mode 100644
index 0000000..7d04052
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-mpeg2-thread-ivlc
@@ -0,0 +1,4 @@
+23d600b026222253c2340e23300a4c02 *tests/data/fate/vsynth1-mpeg2-thread-ivlc.mpeg2video
+791773 tests/data/fate/vsynth1-mpeg2-thread-ivlc.mpeg2video
+d1658911ca83f5616c1d32abc40750de *tests/data/fate/vsynth1-mpeg2-thread-ivlc.out.rawvideo
+stddev: 7.63 PSNR: 30.48 MAXDIFF: 110 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-mpeg4 b/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-mpeg4
new file mode 100644
index 0000000..9a917d0
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-mpeg4
@@ -0,0 +1,4 @@
+59a9e2eed314abface66aaf1b45eb8f2 *tests/data/fate/vsynth1-mpeg4.mp4
+540180 tests/data/fate/vsynth1-mpeg4.mp4
+8828a375448dc5c2215163ba70656f89 *tests/data/fate/vsynth1-mpeg4.out.rawvideo
+stddev: 7.97 PSNR: 30.10 MAXDIFF: 105 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-mpeg4-adap b/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-mpeg4-adap
new file mode 100644
index 0000000..840eb47
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-mpeg4-adap
@@ -0,0 +1,4 @@
+eb70136b050f0b216febe57e7766b6a8 *tests/data/fate/vsynth1-mpeg4-adap.avi
+403444 tests/data/fate/vsynth1-mpeg4-adap.avi
+fa2049396479b5f170aa764fed5b2a31 *tests/data/fate/vsynth1-mpeg4-adap.out.rawvideo
+stddev: 14.05 PSNR: 25.17 MAXDIFF: 184 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-mpeg4-adv b/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-mpeg4-adv
new file mode 100644
index 0000000..8ca1f2f
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-mpeg4-adv
@@ -0,0 +1,4 @@
+c67ccefff2a038c1a149eceef8b08d1e *tests/data/fate/vsynth1-mpeg4-adv.avi
+589704 tests/data/fate/vsynth1-mpeg4-adv.avi
+f8b226876b1b2c0b98fd6928fd9adbd8 *tests/data/fate/vsynth1-mpeg4-adv.out.rawvideo
+stddev: 6.98 PSNR: 31.25 MAXDIFF: 84 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-mpeg4-error b/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-mpeg4-error
new file mode 100644
index 0000000..9180911
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-mpeg4-error
@@ -0,0 +1,4 @@
+63fdc6877c299fe94a061e276ca77bad *tests/data/fate/vsynth1-mpeg4-error.avi
+756824 tests/data/fate/vsynth1-mpeg4-error.avi
+79e94ba32b37759397362cbcb479d4d3 *tests/data/fate/vsynth1-mpeg4-error.out.rawvideo
+stddev: 18.36 PSNR: 22.85 MAXDIFF: 243 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-mpeg4-nr b/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-mpeg4-nr
new file mode 100644
index 0000000..28f8c6a
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-mpeg4-nr
@@ -0,0 +1,4 @@
+d9eabca19ca600f18539b35a94663603 *tests/data/fate/vsynth1-mpeg4-nr.avi
+675626 tests/data/fate/vsynth1-mpeg4-nr.avi
+d2b89d5958fb7331f6c9e5b7ecaaa5b6 *tests/data/fate/vsynth1-mpeg4-nr.out.rawvideo
+stddev: 6.99 PSNR: 31.23 MAXDIFF: 86 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-mpeg4-qpel b/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-mpeg4-qpel
new file mode 100644
index 0000000..1ff1dce
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-mpeg4-qpel
@@ -0,0 +1,4 @@
+c02be5680307d8f97a2f442d27f48f3c *tests/data/fate/vsynth1-mpeg4-qpel.avi
+860666 tests/data/fate/vsynth1-mpeg4-qpel.avi
+756928496245ecc701f79eebeec8e5e6 *tests/data/fate/vsynth1-mpeg4-qpel.out.rawvideo
+stddev: 5.63 PSNR: 33.12 MAXDIFF: 70 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-mpeg4-qprd b/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-mpeg4-qprd
new file mode 100644
index 0000000..0b2892d
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-mpeg4-qprd
@@ -0,0 +1,4 @@
+5a95ba2c240fcb28963fe90fba4ce52b *tests/data/fate/vsynth1-mpeg4-qprd.avi
+710932 tests/data/fate/vsynth1-mpeg4-qprd.avi
+e65f4c7f343fe2bad1cac44b7da5f7c4 *tests/data/fate/vsynth1-mpeg4-qprd.out.rawvideo
+stddev: 9.79 PSNR: 28.31 MAXDIFF: 176 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-mpeg4-rc b/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-mpeg4-rc
new file mode 100644
index 0000000..0c2abf3
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-mpeg4-rc
@@ -0,0 +1,4 @@
+49ac6ed095ea2dccf53737e6beab7ad7 *tests/data/fate/vsynth1-mpeg4-rc.avi
+830148 tests/data/fate/vsynth1-mpeg4-rc.avi
+4d95e340db9bc57a559162c039f3784e *tests/data/fate/vsynth1-mpeg4-rc.out.rawvideo
+stddev: 10.24 PSNR: 27.92 MAXDIFF: 196 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-mpeg4-thread b/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-mpeg4-thread
new file mode 100644
index 0000000..b0bf7d8
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-mpeg4-thread
@@ -0,0 +1,4 @@
+c081bc20f1eb048626ea783d8b08a531 *tests/data/fate/vsynth1-mpeg4-thread.avi
+774748 tests/data/fate/vsynth1-mpeg4-thread.avi
+64b96cddf5301990e118978b3a3bcd0d *tests/data/fate/vsynth1-mpeg4-thread.out.rawvideo
+stddev: 10.13 PSNR: 28.02 MAXDIFF: 183 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-msmpeg4 b/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-msmpeg4
new file mode 100644
index 0000000..cd1b6db
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-msmpeg4
@@ -0,0 +1,4 @@
+c1d04df31764c0ca281dc6fe023287fb *tests/data/fate/vsynth1-msmpeg4.avi
+624706 tests/data/fate/vsynth1-msmpeg4.avi
+5ca72c39e3fc5df8e62f223c869589f5 *tests/data/fate/vsynth1-msmpeg4.out.rawvideo
+stddev: 7.98 PSNR: 30.09 MAXDIFF: 104 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-msmpeg4v2 b/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-msmpeg4v2
new file mode 100644
index 0000000..fb9862c
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-msmpeg4v2
@@ -0,0 +1,4 @@
+48c76c638b43ee53bde9c58185b25e80 *tests/data/fate/vsynth1-msmpeg4v2.avi
+623776 tests/data/fate/vsynth1-msmpeg4v2.avi
+c6ff1041a0ef62c2a2e5ef519e5e94c4 *tests/data/fate/vsynth1-msmpeg4v2.out.rawvideo
+stddev: 7.97 PSNR: 30.10 MAXDIFF: 105 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-prores b/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-prores
new file mode 100644
index 0000000..ac30a6a
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-prores
@@ -0,0 +1,4 @@
+2566517b15c62887bd94daaab1b1a85b *tests/data/fate/vsynth1-prores.mov
+3859037 tests/data/fate/vsynth1-prores.mov
+0a4153637d0cc0a88a8bcbf04cfaf8c6 *tests/data/fate/vsynth1-prores.out.rawvideo
+stddev: 3.17 PSNR: 38.09 MAXDIFF: 39 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-qtrle b/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-qtrle
new file mode 100644
index 0000000..c9c8ccf
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-qtrle
@@ -0,0 +1,4 @@
+7d75328a17e04796a39fe9be3a322946 *tests/data/fate/vsynth1-qtrle.mov
+15263232 tests/data/fate/vsynth1-qtrle.mov
+243325fb2cae1a9245efd49aff936327 *tests/data/fate/vsynth1-qtrle.out.rawvideo
+stddev: 3.42 PSNR: 37.43 MAXDIFF: 48 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-rgb b/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-rgb
new file mode 100644
index 0000000..f72b737
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-rgb
@@ -0,0 +1,4 @@
+d78bcd5828862c3342388ec8a2c34fef *tests/data/fate/vsynth1-rgb.avi
+15213248 tests/data/fate/vsynth1-rgb.avi
+243325fb2cae1a9245efd49aff936327 *tests/data/fate/vsynth1-rgb.out.rawvideo
+stddev: 3.42 PSNR: 37.43 MAXDIFF: 48 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-roqvideo b/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-roqvideo
new file mode 100644
index 0000000..5adba69
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-roqvideo
@@ -0,0 +1,4 @@
+cf8b7b0e539bab3169c234ca63d71dd8 *tests/data/fate/vsynth1-roqvideo.roq
+101671 tests/data/fate/vsynth1-roqvideo.roq
+0ad983c291b1ed373645c5b12a108c61 *tests/data/fate/vsynth1-roqvideo.out.rawvideo
+stddev: 7.74 PSNR: 30.35 MAXDIFF: 89 bytes: 7603200/ 760320
diff --git a/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-rv10 b/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-rv10
new file mode 100644
index 0000000..234015f
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-rv10
@@ -0,0 +1,4 @@
+4d7e82de72a83905cf84b8abc3e70b8f *tests/data/fate/vsynth1-rv10.rm
+653905 tests/data/fate/vsynth1-rv10.rm
+1a1ba9a3a63ec1a1a9585fded0a7c954 *tests/data/fate/vsynth1-rv10.out.rawvideo
+stddev: 8.03 PSNR: 30.03 MAXDIFF: 103 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-rv20 b/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-rv20
new file mode 100644
index 0000000..abcc4a1
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-rv20
@@ -0,0 +1,4 @@
+81868601e602eee5b6d80f5ece4aaa98 *tests/data/fate/vsynth1-rv20.rm
+646016 tests/data/fate/vsynth1-rv20.rm
+b45fdb0201b06f7649f44050e262c54c *tests/data/fate/vsynth1-rv20.out.rawvideo
+stddev: 8.26 PSNR: 29.79 MAXDIFF: 103 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-snow b/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-snow
new file mode 100644
index 0000000..701b5cc
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-snow
@@ -0,0 +1,4 @@
+44fed844eb715fba0cc2433e7d7713bb *tests/data/fate/vsynth1-snow.avi
+136076 tests/data/fate/vsynth1-snow.avi
+91021b7d6d7908648fe78cc1975af8c4 *tests/data/fate/vsynth1-snow.out.rawvideo
+stddev: 22.77 PSNR: 20.98 MAXDIFF: 172 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-snow-hpel b/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-snow-hpel
new file mode 100644
index 0000000..c22ad0a
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-snow-hpel
@@ -0,0 +1,4 @@
+f60c8cb8f41b66bc38df87e9bdb84b34 *tests/data/fate/vsynth1-snow-hpel.avi
+138700 tests/data/fate/vsynth1-snow-hpel.avi
+d6845c8f1310e041afdcebc6bbfc449b *tests/data/fate/vsynth1-snow-hpel.out.rawvideo
+stddev: 22.74 PSNR: 20.99 MAXDIFF: 171 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-snow-ll b/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-snow-ll
new file mode 100644
index 0000000..1636af5
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-snow-ll
@@ -0,0 +1,4 @@
+bdc7a025cd306f3da0d377b06bbe909b *tests/data/fate/vsynth1-snow-ll.avi
+3419968 tests/data/fate/vsynth1-snow-ll.avi
+c5ccac874dbf808e9088bc3107860042 *tests/data/fate/vsynth1-snow-ll.out.rawvideo
+stddev: 0.00 PSNR:999.99 MAXDIFF: 0 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-svq1 b/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-svq1
new file mode 100644
index 0000000..0f8a6b2
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-svq1
@@ -0,0 +1,4 @@
+5c9d8734693f3cab57f61e76b5b6da7d *tests/data/fate/vsynth1-svq1.mov
+1334367 tests/data/fate/vsynth1-svq1.mov
+9cc35c54b2c77d36bd7e308b393c1f81 *tests/data/fate/vsynth1-svq1.out.rawvideo
+stddev: 9.58 PSNR: 28.50 MAXDIFF: 210 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-v210 b/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-v210
new file mode 100644
index 0000000..defd2f6
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-v210
@@ -0,0 +1,4 @@
+054d7e903fb4d9e68700c56b93d45916 *tests/data/fate/vsynth1-v210.avi
+14752448 tests/data/fate/vsynth1-v210.avi
+50973792d3f1abe04a51ee0121f077f2 *tests/data/fate/vsynth1-v210.out.rawvideo
+stddev: 1.85 PSNR: 42.78 MAXDIFF: 29 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-wmv1 b/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-wmv1
new file mode 100644
index 0000000..78bd0f0
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-wmv1
@@ -0,0 +1,4 @@
+5f896b2c7d6a0906f5252a5088fbc64a *tests/data/fate/vsynth1-wmv1.avi
+626896 tests/data/fate/vsynth1-wmv1.avi
+5182edba5b5e0354b39ce4f3604b62da *tests/data/fate/vsynth1-wmv1.out.rawvideo
+stddev: 7.97 PSNR: 30.09 MAXDIFF: 110 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-wmv2 b/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-wmv2
new file mode 100644
index 0000000..82efc62
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-wmv2
@@ -0,0 +1,4 @@
+fc0796c6c49a18034cef008d61c0d964 *tests/data/fate/vsynth1-wmv2.avi
+659840 tests/data/fate/vsynth1-wmv2.avi
+5182edba5b5e0354b39ce4f3604b62da *tests/data/fate/vsynth1-wmv2.out.rawvideo
+stddev: 7.97 PSNR: 30.09 MAXDIFF: 110 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-yuv b/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-yuv
new file mode 100644
index 0000000..3db5ab0
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/vsynth/vsynth1-yuv
@@ -0,0 +1,4 @@
+a9c708ba20f5c562fb1c89f6aa841c8c *tests/data/fate/vsynth1-yuv.avi
+7610048 tests/data/fate/vsynth1-yuv.avi
+c5ccac874dbf808e9088bc3107860042 *tests/data/fate/vsynth1-yuv.out.rawvideo
+stddev: 0.00 PSNR:999.99 MAXDIFF: 0 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-asv1 b/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-asv1
new file mode 100644
index 0000000..282435b
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-asv1
@@ -0,0 +1,4 @@
+ae8d79e0e421138a9a67a148a42c26c5 *tests/data/fate/vsynth2-asv1.avi
+832500 tests/data/fate/vsynth2-asv1.avi
+c96ff7fd17c52f99ddb7922a4cb9168f *tests/data/fate/vsynth2-asv1.out.rawvideo
+stddev: 10.47 PSNR: 27.73 MAXDIFF: 98 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-asv2 b/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-asv2
new file mode 100644
index 0000000..8942862
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-asv2
@@ -0,0 +1,4 @@
+ccf6762758395eee9a29ef7a4ef3cd58 *tests/data/fate/vsynth2-asv2.avi
+789060 tests/data/fate/vsynth2-asv2.avi
+74a78015b64b2cf8cb9da2e44f508a69 *tests/data/fate/vsynth2-asv2.out.rawvideo
+stddev: 10.28 PSNR: 27.89 MAXDIFF: 95 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-cljr b/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-cljr
new file mode 100644
index 0000000..39c74c3
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-cljr
@@ -0,0 +1,4 @@
+5745ff1d80a6f454ae448dcf0bce50e0 *tests/data/fate/vsynth2-cljr.avi
+5075648 tests/data/fate/vsynth2-cljr.avi
+cfe7802bf34aafed7df5dcaa5126ef23 *tests/data/fate/vsynth2-cljr.out.rawvideo
+stddev: 3.69 PSNR: 36.78 MAXDIFF: 22 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-dnxhd-1080i b/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-dnxhd-1080i
new file mode 100644
index 0000000..27c79a5
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-dnxhd-1080i
@@ -0,0 +1,4 @@
+65ca6385b565b6ea9a2e28150eef1d46 *tests/data/fate/vsynth2-dnxhd-1080i.mov
+3031875 tests/data/fate/vsynth2-dnxhd-1080i.mov
+42262a2325441b38b3b3c8a42d888e7d *tests/data/fate/vsynth2-dnxhd-1080i.out.rawvideo
+stddev: 1.31 PSNR: 45.77 MAXDIFF: 23 bytes: 7603200/ 760320
diff --git a/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-dnxhd-720p b/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-dnxhd-720p
new file mode 100644
index 0000000..afc6fde
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-dnxhd-720p
@@ -0,0 +1,4 @@
+58e07cc6ae0a2d36787044d0e82708a6 *tests/data/fate/vsynth2-dnxhd-720p.dnxhd
+2293760 tests/data/fate/vsynth2-dnxhd-720p.dnxhd
+ab601eaafef74d80d3d20b780dddd836 *tests/data/fate/vsynth2-dnxhd-720p.out.rawvideo
+stddev: 1.36 PSNR: 45.45 MAXDIFF: 127 bytes: 7603200/ 760320
diff --git a/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-dnxhd-720p-10bit b/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-dnxhd-720p-10bit
new file mode 100644
index 0000000..f087c13
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-dnxhd-720p-10bit
@@ -0,0 +1,4 @@
+4b57da2c0c1280469ff3579f7151c227 *tests/data/fate/vsynth2-dnxhd-720p-10bit.dnxhd
+2293760 tests/data/fate/vsynth2-dnxhd-720p-10bit.dnxhd
+31a6aa8b8702e85fa3b48e73f035c4e4 *tests/data/fate/vsynth2-dnxhd-720p-10bit.out.rawvideo
+stddev: 1.35 PSNR: 45.46 MAXDIFF: 23 bytes: 7603200/ 760320
diff --git a/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-dnxhd-720p-rd b/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-dnxhd-720p-rd
new file mode 100644
index 0000000..c1b8f96
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-dnxhd-720p-rd
@@ -0,0 +1,4 @@
+092ffb7b8cf3c11556bb05dbb8b476ac *tests/data/fate/vsynth2-dnxhd-720p-rd.dnxhd
+2293760 tests/data/fate/vsynth2-dnxhd-720p-rd.dnxhd
+33547ca318acff9448cba719cb99296d *tests/data/fate/vsynth2-dnxhd-720p-rd.out.rawvideo
+stddev: 1.32 PSNR: 45.66 MAXDIFF: 22 bytes: 7603200/ 760320
diff --git a/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-dv b/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-dv
new file mode 100644
index 0000000..2aac5ff
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-dv
@@ -0,0 +1,4 @@
+bfa766f89bfeabc0ae1044f3954bed52 *tests/data/fate/vsynth2-dv.dv
+7200000 tests/data/fate/vsynth2-dv.dv
+7ec62bd3350a6848364669e6e1e4b9cc *tests/data/fate/vsynth2-dv.out.rawvideo
+stddev: 1.71 PSNR: 43.47 MAXDIFF: 33 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-dv-411 b/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-dv-411
new file mode 100644
index 0000000..00ecace
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-dv-411
@@ -0,0 +1,4 @@
+00a9d8683ac6826af41bcf7223fb0389 *tests/data/fate/vsynth2-dv-411.dv
+7200000 tests/data/fate/vsynth2-dv-411.dv
+3cd4b85065d67bfb7fbab3bea4039711 *tests/data/fate/vsynth2-dv-411.out.rawvideo
+stddev: 2.89 PSNR: 38.91 MAXDIFF: 45 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-dv-50 b/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-dv-50
new file mode 100644
index 0000000..e7e5dc1
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-dv-50
@@ -0,0 +1,4 @@
+61e31c79e8949b25c849753a0785b0d7 *tests/data/fate/vsynth2-dv-50.dv
+14400000 tests/data/fate/vsynth2-dv-50.dv
+af3f2dd5ab62c1a1d98b07d4aeb6852f *tests/data/fate/vsynth2-dv-50.out.rawvideo
+stddev: 0.82 PSNR: 49.82 MAXDIFF: 12 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-ffv1 b/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-ffv1
new file mode 100644
index 0000000..888e843
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-ffv1
@@ -0,0 +1,4 @@
+3a757276e299bf88c30e06dfb53f1c99 *tests/data/fate/vsynth2-ffv1.avi
+3525792 tests/data/fate/vsynth2-ffv1.avi
+dde5895817ad9d219f79a52d0bdfb001 *tests/data/fate/vsynth2-ffv1.out.rawvideo
+stddev: 0.00 PSNR:999.99 MAXDIFF: 0 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-ffvhuff b/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-ffvhuff
new file mode 100644
index 0000000..8daed2b
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-ffvhuff
@@ -0,0 +1,4 @@
+f6a213ef136012a3d189d09468d80dd3 *tests/data/fate/vsynth2-ffvhuff.avi
+4988044 tests/data/fate/vsynth2-ffvhuff.avi
+dde5895817ad9d219f79a52d0bdfb001 *tests/data/fate/vsynth2-ffvhuff.out.rawvideo
+stddev: 0.00 PSNR:999.99 MAXDIFF: 0 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-flashsv b/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-flashsv
new file mode 100644
index 0000000..cbe79e6
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-flashsv
@@ -0,0 +1,4 @@
+0667077971e0cb63b5f49c580006e90e *tests/data/fate/vsynth2-flashsv.flv
+12368953 tests/data/fate/vsynth2-flashsv.flv
+592b3321994e26a990deb3a0a1415de9 *tests/data/fate/vsynth2-flashsv.out.rawvideo
+stddev: 0.65 PSNR: 51.84 MAXDIFF: 14 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-flv b/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-flv
new file mode 100644
index 0000000..6864a1b
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-flv
@@ -0,0 +1,4 @@
+2edc92093d36506bcc0a5c0e17e86113 *tests/data/fate/vsynth2-flv.flv
+131360 tests/data/fate/vsynth2-flv.flv
+8999c8264fb0941561f64c4a736e9d88 *tests/data/fate/vsynth2-flv.out.rawvideo
+stddev: 5.33 PSNR: 33.59 MAXDIFF: 80 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-h261 b/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-h261
new file mode 100644
index 0000000..71ea191
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-h261
@@ -0,0 +1,4 @@
+921e06dffd04667d336449c7cd1c6589 *tests/data/fate/vsynth2-h261.avi
+191074 tests/data/fate/vsynth2-h261.avi
+db7ceff174823b98834faa2320ca89ac *tests/data/fate/vsynth2-h261.out.rawvideo
+stddev: 6.37 PSNR: 32.03 MAXDIFF: 77 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-h263 b/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-h263
new file mode 100644
index 0000000..b2ce370
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-h263
@@ -0,0 +1,4 @@
+329c0318b8727d66946ec729c6e960fc *tests/data/fate/vsynth2-h263.avi
+160094 tests/data/fate/vsynth2-h263.avi
+61213b91b359697ebcefb9e0a53ac54a *tests/data/fate/vsynth2-h263.out.rawvideo
+stddev: 5.43 PSNR: 33.42 MAXDIFF: 77 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-h263-obmc b/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-h263-obmc
new file mode 100644
index 0000000..67fd2fd
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-h263-obmc
@@ -0,0 +1,4 @@
+3abbe86e18ef9d407cc3817dd31ebeba *tests/data/fate/vsynth2-h263-obmc.avi
+154716 tests/data/fate/vsynth2-h263-obmc.avi
+6f326547cf1cbd95a8c0a5ddce9eb71a *tests/data/fate/vsynth2-h263-obmc.out.rawvideo
+stddev: 5.39 PSNR: 33.49 MAXDIFF: 82 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-h263p b/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-h263p
new file mode 100644
index 0000000..826dcd1
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-h263p
@@ -0,0 +1,4 @@
+865ca965ab4fdfe225db7de3d23b4ad8 *tests/data/fate/vsynth2-h263p.avi
+868006 tests/data/fate/vsynth2-h263p.avi
+4b0ee791f280029dc03c528f76f195d4 *tests/data/fate/vsynth2-h263p.out.rawvideo
+stddev: 1.91 PSNR: 42.50 MAXDIFF: 19 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-huffyuv b/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-huffyuv
new file mode 100644
index 0000000..7d062dd
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-huffyuv
@@ -0,0 +1,4 @@
+30d509aca4a7298cf7667581a5e37671 *tests/data/fate/vsynth2-huffyuv.avi
+6455220 tests/data/fate/vsynth2-huffyuv.avi
+dde5895817ad9d219f79a52d0bdfb001 *tests/data/fate/vsynth2-huffyuv.out.rawvideo
+stddev: 0.00 PSNR:999.99 MAXDIFF: 0 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-jpegls b/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-jpegls
new file mode 100644
index 0000000..75ad403
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-jpegls
@@ -0,0 +1,4 @@
+f34315ed0e30cf4d94dd21ff1d4cea1b *tests/data/fate/vsynth2-jpegls.avi
+8334618 tests/data/fate/vsynth2-jpegls.avi
+592b3321994e26a990deb3a0a1415de9 *tests/data/fate/vsynth2-jpegls.out.rawvideo
+stddev: 0.65 PSNR: 51.84 MAXDIFF: 14 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-ljpeg b/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-ljpeg
new file mode 100644
index 0000000..fa2f978
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-ljpeg
@@ -0,0 +1,4 @@
+db9fd56e154b1056c9443a82a96db6f5 *tests/data/fate/vsynth2-ljpeg.avi
+4766902 tests/data/fate/vsynth2-ljpeg.avi
+dde5895817ad9d219f79a52d0bdfb001 *tests/data/fate/vsynth2-ljpeg.out.rawvideo
+stddev: 0.00 PSNR:999.99 MAXDIFF: 0 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-mjpeg b/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-mjpeg
new file mode 100644
index 0000000..981d01b
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-mjpeg
@@ -0,0 +1,4 @@
+ba05f4fad7f34a96c77964e8cdf9d5c0 *tests/data/fate/vsynth2-mjpeg.avi
+673212 tests/data/fate/vsynth2-mjpeg.avi
+a96a4e15ffcb13e44360df642d049496 *tests/data/fate/vsynth2-mjpeg.out.rawvideo
+stddev: 4.32 PSNR: 35.40 MAXDIFF: 49 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-mpeg1 b/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-mpeg1
new file mode 100644
index 0000000..a975973
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-mpeg1
@@ -0,0 +1,4 @@
+73ca6f1deab02d1d67a0e8495c026a9e *tests/data/fate/vsynth2-mpeg1.mpeg1video
+192783 tests/data/fate/vsynth2-mpeg1.mpeg1video
+56147e94b12f08df7213e610e177823d *tests/data/fate/vsynth2-mpeg1.out.rawvideo
+stddev: 4.95 PSNR: 34.22 MAXDIFF: 57 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-mpeg1b b/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-mpeg1b
new file mode 100644
index 0000000..4b92ac5
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-mpeg1b
@@ -0,0 +1,4 @@
+e026a2fef80c9679776d2b5c8be09338 *tests/data/fate/vsynth2-mpeg1b.mpeg1video
+225198 tests/data/fate/vsynth2-mpeg1b.mpeg1video
+1150495f4bd487486ee53326c42d0bb8 *tests/data/fate/vsynth2-mpeg1b.out.rawvideo
+stddev: 4.10 PSNR: 35.86 MAXDIFF: 59 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-mpeg2 b/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-mpeg2
new file mode 100644
index 0000000..a2a2ca6
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-mpeg2
@@ -0,0 +1,4 @@
+2d55ce623a7be4e8136f80266e487678 *tests/data/fate/vsynth2-mpeg2.mpeg2video
+198667 tests/data/fate/vsynth2-mpeg2.mpeg2video
+b7cae8a1f751b821cddcbe4d5dbc518c *tests/data/fate/vsynth2-mpeg2.out.rawvideo
+stddev: 4.96 PSNR: 34.20 MAXDIFF: 59 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-mpeg2-422 b/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-mpeg2-422
new file mode 100644
index 0000000..2405cf0
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-mpeg2-422
@@ -0,0 +1,4 @@
+2c8e33c2d2efab86fc16a195f6877682 *tests/data/fate/vsynth2-mpeg2-422.mpeg2video
+356124 tests/data/fate/vsynth2-mpeg2-422.mpeg2video
+df6e54e2d8a4feb8382029286857ca6d *tests/data/fate/vsynth2-mpeg2-422.out.rawvideo
+stddev: 3.16 PSNR: 38.13 MAXDIFF: 49 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-mpeg2-idct-int b/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-mpeg2-idct-int
new file mode 100644
index 0000000..83874b1
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-mpeg2-idct-int
@@ -0,0 +1,4 @@
+f979bcca866e6e4cad5dc6cb06e56cfb *tests/data/fate/vsynth2-mpeg2-idct-int.mpeg2video
+198041 tests/data/fate/vsynth2-mpeg2-idct-int.mpeg2video
+92794e70e4a19a494f10efe353d9895d *tests/data/fate/vsynth2-mpeg2-idct-int.out.rawvideo
+stddev: 4.97 PSNR: 34.19 MAXDIFF: 58 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-mpeg2-ilace b/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-mpeg2-ilace
new file mode 100644
index 0000000..e488bc5
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-mpeg2-ilace
@@ -0,0 +1,4 @@
+f90197a8b6e62ae25f82625337f27240 *tests/data/fate/vsynth2-mpeg2-ilace.mpeg2video
+204579 tests/data/fate/vsynth2-mpeg2-ilace.mpeg2video
+ea5057b60146c06d40449cdfc686bf13 *tests/data/fate/vsynth2-mpeg2-ilace.out.rawvideo
+stddev: 4.98 PSNR: 34.18 MAXDIFF: 65 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-mpeg2-ivlc-qprd b/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-mpeg2-ivlc-qprd
new file mode 100644
index 0000000..30e129b
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-mpeg2-ivlc-qprd
@@ -0,0 +1,4 @@
+1ba5efeb53fab7b4b71edc96d86f6c91 *tests/data/fate/vsynth2-mpeg2-ivlc-qprd.mpeg2video
+244694 tests/data/fate/vsynth2-mpeg2-ivlc-qprd.mpeg2video
+b26e21599dee48a174bdbc40b2817e55 *tests/data/fate/vsynth2-mpeg2-ivlc-qprd.out.rawvideo
+stddev: 4.15 PSNR: 35.76 MAXDIFF: 74 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-mpeg2-thread b/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-mpeg2-thread
new file mode 100644
index 0000000..f43cdbc
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-mpeg2-thread
@@ -0,0 +1,4 @@
+889c754a42d7689b228853e1ece6d345 *tests/data/fate/vsynth2-mpeg2-thread.mpeg2video
+179650 tests/data/fate/vsynth2-mpeg2-thread.mpeg2video
+8c6a7ed2eb73bd18fd2bb9829464100d *tests/data/fate/vsynth2-mpeg2-thread.out.rawvideo
+stddev: 4.72 PSNR: 34.65 MAXDIFF: 72 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-mpeg2-thread-ivlc b/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-mpeg2-thread-ivlc
new file mode 100644
index 0000000..2c42a21
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-mpeg2-thread-ivlc
@@ -0,0 +1,4 @@
+10b900e32809758857c596d56746e00e *tests/data/fate/vsynth2-mpeg2-thread-ivlc.mpeg2video
+178801 tests/data/fate/vsynth2-mpeg2-thread-ivlc.mpeg2video
+8c6a7ed2eb73bd18fd2bb9829464100d *tests/data/fate/vsynth2-mpeg2-thread-ivlc.out.rawvideo
+stddev: 4.72 PSNR: 34.65 MAXDIFF: 72 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-mpeg4 b/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-mpeg4
new file mode 100644
index 0000000..4d96557
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-mpeg4
@@ -0,0 +1,4 @@
+8c9afbf564008a8ce6719cc3546deae1 *tests/data/fate/vsynth2-mpeg4.mp4
+119833 tests/data/fate/vsynth2-mpeg4.mp4
+90a3577850239083a9042bef33c50e85 *tests/data/fate/vsynth2-mpeg4.out.rawvideo
+stddev: 5.34 PSNR: 33.57 MAXDIFF: 83 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-mpeg4-adap b/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-mpeg4-adap
new file mode 100644
index 0000000..fb4c206
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-mpeg4-adap
@@ -0,0 +1,4 @@
+76c8962b06b7a0d748bd7eb3f6fc0e18 *tests/data/fate/vsynth2-mpeg4-adap.avi
+198498 tests/data/fate/vsynth2-mpeg4-adap.avi
+4affb83f6adc94f31024b4f9e0168945 *tests/data/fate/vsynth2-mpeg4-adap.out.rawvideo
+stddev: 3.75 PSNR: 36.65 MAXDIFF: 71 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-mpeg4-adv b/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-mpeg4-adv
new file mode 100644
index 0000000..b3bf264
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-mpeg4-adv
@@ -0,0 +1,4 @@
+1875ae5a45936c08778c4430a22e87eb *tests/data/fate/vsynth2-mpeg4-adv.avi
+141534 tests/data/fate/vsynth2-mpeg4-adv.avi
+3f3a21e9db85a9c0f7022f557a5374c1 *tests/data/fate/vsynth2-mpeg4-adv.out.rawvideo
+stddev: 4.94 PSNR: 34.25 MAXDIFF: 69 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-mpeg4-error b/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-mpeg4-error
new file mode 100644
index 0000000..35dd03d
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-mpeg4-error
@@ -0,0 +1,4 @@
+d3025e5f784efeb2ab9b84f8924eda19 *tests/data/fate/vsynth2-mpeg4-error.avi
+176576 tests/data/fate/vsynth2-mpeg4-error.avi
+96baa9e4c24c837a3ba5abd8dd2cdd30 *tests/data/fate/vsynth2-mpeg4-error.out.rawvideo
+stddev: 8.98 PSNR: 29.06 MAXDIFF: 184 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-mpeg4-nr b/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-mpeg4-nr
new file mode 100644
index 0000000..7fdce67
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-mpeg4-nr
@@ -0,0 +1,4 @@
+75725f3c2a08efa145a2692a20373a21 *tests/data/fate/vsynth2-mpeg4-nr.avi
+155032 tests/data/fate/vsynth2-mpeg4-nr.avi
+f7fc191308679f709405e62271f5c65f *tests/data/fate/vsynth2-mpeg4-nr.out.rawvideo
+stddev: 4.73 PSNR: 34.63 MAXDIFF: 64 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-mpeg4-qpel b/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-mpeg4-qpel
new file mode 100644
index 0000000..cab264a
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-mpeg4-qpel
@@ -0,0 +1,4 @@
+c45101c6c3b681f5d420a938c0689a37 *tests/data/fate/vsynth2-mpeg4-qpel.avi
+163676 tests/data/fate/vsynth2-mpeg4-qpel.avi
+26dc7c78955fa678fbf150e236eb5627 *tests/data/fate/vsynth2-mpeg4-qpel.out.rawvideo
+stddev: 3.97 PSNR: 36.14 MAXDIFF: 54 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-mpeg4-qprd b/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-mpeg4-qprd
new file mode 100644
index 0000000..1779dd7
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-mpeg4-qprd
@@ -0,0 +1,4 @@
+81afd85c3ab00b685588e1b61cc3e4b3 *tests/data/fate/vsynth2-mpeg4-qprd.avi
+231446 tests/data/fate/vsynth2-mpeg4-qprd.avi
+de8a883865e2dff7a51f66da6c48df48 *tests/data/fate/vsynth2-mpeg4-qprd.out.rawvideo
+stddev: 3.71 PSNR: 36.72 MAXDIFF: 61 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-mpeg4-rc b/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-mpeg4-rc
new file mode 100644
index 0000000..74e7962
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-mpeg4-rc
@@ -0,0 +1,4 @@
+e3621649079539ec118e8581c54bc2ef *tests/data/fate/vsynth2-mpeg4-rc.avi
+226320 tests/data/fate/vsynth2-mpeg4-rc.avi
+2b34e606af895b62a250de98749a19b0 *tests/data/fate/vsynth2-mpeg4-rc.out.rawvideo
+stddev: 4.23 PSNR: 35.60 MAXDIFF: 85 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-mpeg4-thread b/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-mpeg4-thread
new file mode 100644
index 0000000..61478a0
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-mpeg4-thread
@@ -0,0 +1,4 @@
+69b716c9f99c5acb86a744521c32cf72 *tests/data/fate/vsynth2-mpeg4-thread.avi
+250128 tests/data/fate/vsynth2-mpeg4-thread.avi
+5355deb8c7609a3f1ff2173aab1dee70 *tests/data/fate/vsynth2-mpeg4-thread.out.rawvideo
+stddev: 3.69 PSNR: 36.78 MAXDIFF: 65 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-msmpeg4 b/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-msmpeg4
new file mode 100644
index 0000000..a7cc94e
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-msmpeg4
@@ -0,0 +1,4 @@
+f602d25096c83f166bdab01fa07a34c1 *tests/data/fate/vsynth2-msmpeg4.avi
+127668 tests/data/fate/vsynth2-msmpeg4.avi
+0e1c6e25c71c6a8fa8e506e3d97ca4c9 *tests/data/fate/vsynth2-msmpeg4.out.rawvideo
+stddev: 5.33 PSNR: 33.59 MAXDIFF: 78 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-msmpeg4v2 b/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-msmpeg4v2
new file mode 100644
index 0000000..542dfe5
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-msmpeg4v2
@@ -0,0 +1,4 @@
+43d6ca9b63993b4603d4f08fa6aaeab3 *tests/data/fate/vsynth2-msmpeg4v2.avi
+129906 tests/data/fate/vsynth2-msmpeg4v2.avi
+8920194f8bf8f9cdd6c65b3df9e1a292 *tests/data/fate/vsynth2-msmpeg4v2.out.rawvideo
+stddev: 5.33 PSNR: 33.59 MAXDIFF: 80 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-prores b/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-prores
new file mode 100644
index 0000000..9a834ed
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-prores
@@ -0,0 +1,4 @@
+28755ce05e812adbb8b7c180318ffba8 *tests/data/fate/vsynth2-prores.mov
+3884722 tests/data/fate/vsynth2-prores.mov
+ca2f6c1162635dedfa468c90f1fdc0ef *tests/data/fate/vsynth2-prores.out.rawvideo
+stddev: 0.92 PSNR: 48.77 MAXDIFF: 10 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-qtrle b/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-qtrle
new file mode 100644
index 0000000..ceee854
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-qtrle
@@ -0,0 +1,4 @@
+4805f35ca6e03b9279cc18f3f7356366 *tests/data/fate/vsynth2-qtrle.mov
+14798419 tests/data/fate/vsynth2-qtrle.mov
+b2418e0e3a9a8619b31219cbcf24dc82 *tests/data/fate/vsynth2-qtrle.out.rawvideo
+stddev: 1.26 PSNR: 46.06 MAXDIFF: 13 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-rgb b/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-rgb
new file mode 100644
index 0000000..5c9a98e
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-rgb
@@ -0,0 +1,4 @@
+01199075994e44f282fbb6a8e3ccc668 *tests/data/fate/vsynth2-rgb.avi
+15213248 tests/data/fate/vsynth2-rgb.avi
+b2418e0e3a9a8619b31219cbcf24dc82 *tests/data/fate/vsynth2-rgb.out.rawvideo
+stddev: 1.26 PSNR: 46.06 MAXDIFF: 13 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-roqvideo b/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-roqvideo
new file mode 100644
index 0000000..d4c075a
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-roqvideo
@@ -0,0 +1,4 @@
+b46f899b2363065c60f3782ba1f8b7bd *tests/data/fate/vsynth2-roqvideo.roq
+92786 tests/data/fate/vsynth2-roqvideo.roq
+e69fca960dd0911e9b8d589c13e11dc1 *tests/data/fate/vsynth2-roqvideo.out.rawvideo
+stddev: 3.81 PSNR: 36.49 MAXDIFF: 54 bytes: 7603200/ 760320
diff --git a/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-rv10 b/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-rv10
new file mode 100644
index 0000000..7afe4fc
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-rv10
@@ -0,0 +1,4 @@
+b1467b0e8d8cad730e36d1e8ab49d573 *tests/data/fate/vsynth2-rv10.rm
+154310 tests/data/fate/vsynth2-rv10.rm
+61213b91b359697ebcefb9e0a53ac54a *tests/data/fate/vsynth2-rv10.out.rawvideo
+stddev: 5.43 PSNR: 33.42 MAXDIFF: 77 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-rv20 b/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-rv20
new file mode 100644
index 0000000..a3440fa
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-rv20
@@ -0,0 +1,4 @@
+96acb098850b9bf309f89e48b08fe96f *tests/data/fate/vsynth2-rv20.rm
+153302 tests/data/fate/vsynth2-rv20.rm
+46f314e70d9bac2e7d82cfc230534977 *tests/data/fate/vsynth2-rv20.out.rawvideo
+stddev: 5.48 PSNR: 33.35 MAXDIFF: 81 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-snow b/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-snow
new file mode 100644
index 0000000..12f3811
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-snow
@@ -0,0 +1,4 @@
+4b6236e23ae4a52655f2c24c5a09380a *tests/data/fate/vsynth2-snow.avi
+57688 tests/data/fate/vsynth2-snow.avi
+8890189af71a0dd3447c4e8424c9a76b *tests/data/fate/vsynth2-snow.out.rawvideo
+stddev: 10.47 PSNR: 27.72 MAXDIFF: 119 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-snow-hpel b/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-snow-hpel
new file mode 100644
index 0000000..955f1bf
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-snow-hpel
@@ -0,0 +1,4 @@
+9872032345c33cf8e8fc26ab655be3d3 *tests/data/fate/vsynth2-snow-hpel.avi
+61760 tests/data/fate/vsynth2-snow-hpel.avi
+8680d40905f423999d65b996c4dcb984 *tests/data/fate/vsynth2-snow-hpel.out.rawvideo
+stddev: 10.45 PSNR: 27.74 MAXDIFF: 123 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-snow-ll b/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-snow-ll
new file mode 100644
index 0000000..9a72549
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-snow-ll
@@ -0,0 +1,4 @@
+30b40e0bf64f92b23d6f94056c0c6da5 *tests/data/fate/vsynth2-snow-ll.avi
+2721746 tests/data/fate/vsynth2-snow-ll.avi
+dde5895817ad9d219f79a52d0bdfb001 *tests/data/fate/vsynth2-snow-ll.out.rawvideo
+stddev: 0.00 PSNR:999.99 MAXDIFF: 0 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-svq1 b/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-svq1
new file mode 100644
index 0000000..251f72d
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-svq1
@@ -0,0 +1,4 @@
+138ad38281570f1a3b68d63ed896435d *tests/data/fate/vsynth2-svq1.mov
+766851 tests/data/fate/vsynth2-svq1.mov
+aa03471dac3f49455a33a2b19fda1098 *tests/data/fate/vsynth2-svq1.out.rawvideo
+stddev: 3.23 PSNR: 37.93 MAXDIFF: 61 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-v210 b/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-v210
new file mode 100644
index 0000000..eb80b34
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-v210
@@ -0,0 +1,4 @@
+ddc80f41b9e92c26adbe09567a4c7a1d *tests/data/fate/vsynth2-v210.avi
+14752448 tests/data/fate/vsynth2-v210.avi
+a627fb50c8276200fd71383977d87ca3 *tests/data/fate/vsynth2-v210.out.rawvideo
+stddev: 0.34 PSNR: 57.43 MAXDIFF: 6 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-wmv1 b/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-wmv1
new file mode 100644
index 0000000..188b518
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-wmv1
@@ -0,0 +1,4 @@
+73f3b72208ed1e61be60f1412dbf35e2 *tests/data/fate/vsynth2-wmv1.avi
+129518 tests/data/fate/vsynth2-wmv1.avi
+81eee429b665254d19a06607463c0b5e *tests/data/fate/vsynth2-wmv1.out.rawvideo
+stddev: 5.33 PSNR: 33.60 MAXDIFF: 77 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-wmv2 b/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-wmv2
new file mode 100644
index 0000000..043dac9
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-wmv2
@@ -0,0 +1,4 @@
+0760abea07c386ab956fa1bb8b14c599 *tests/data/fate/vsynth2-wmv2.avi
+129848 tests/data/fate/vsynth2-wmv2.avi
+81eee429b665254d19a06607463c0b5e *tests/data/fate/vsynth2-wmv2.out.rawvideo
+stddev: 5.33 PSNR: 33.60 MAXDIFF: 77 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-yuv b/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-yuv
new file mode 100644
index 0000000..d79e986
--- /dev/null
+++ b/gst-libs/ext/libav/tests/ref/vsynth/vsynth2-yuv
@@ -0,0 +1,4 @@
+d08219372af7a764c1afbc99a1002fe0 *tests/data/fate/vsynth2-yuv.avi
+7610048 tests/data/fate/vsynth2-yuv.avi
+dde5895817ad9d219f79a52d0bdfb001 *tests/data/fate/vsynth2-yuv.out.rawvideo
+stddev: 0.00 PSNR:999.99 MAXDIFF: 0 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth1/asv1 b/gst-libs/ext/libav/tests/ref/vsynth1/asv1
deleted file mode 100644
index 10c1b03..0000000
--- a/gst-libs/ext/libav/tests/ref/vsynth1/asv1
+++ /dev/null
@@ -1,4 +0,0 @@
-b4ce4698764ef2328346badb7227ecbe *./tests/data/vsynth1/asv1.avi
-1489656 ./tests/data/vsynth1/asv1.avi
-2dfc5dfc2c1cbbc2543257cd3d2df6af *./tests/data/asv1.vsynth1.out.yuv
-stddev: 20.00 PSNR: 22.11 MAXDIFF: 158 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth1/asv2 b/gst-libs/ext/libav/tests/ref/vsynth1/asv2
deleted file mode 100644
index 14b0d1c..0000000
--- a/gst-libs/ext/libav/tests/ref/vsynth1/asv2
+++ /dev/null
@@ -1,4 +0,0 @@
-dfba6eaf58e515e324c2b370bfcd9158 *./tests/data/vsynth1/asv2.avi
-1456056 ./tests/data/vsynth1/asv2.avi
-d451be09793cd0f35b6d91fc36e2571a *./tests/data/asv2.vsynth1.out.yuv
-stddev: 18.82 PSNR: 22.63 MAXDIFF: 131 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth1/cljr b/gst-libs/ext/libav/tests/ref/vsynth1/cljr
deleted file mode 100644
index 9865726..0000000
--- a/gst-libs/ext/libav/tests/ref/vsynth1/cljr
+++ /dev/null
@@ -1,4 +0,0 @@
-d149cadc43100d8e98ff04e57fdaa31f *./tests/data/vsynth1/cljr.avi
- 5075660 ./tests/data/vsynth1/cljr.avi
-4debaab994c2c7273bebaa0c5733017b *./tests/data/cljr.vsynth1.out.yuv
-stddev: 30.75 PSNR: 18.37 MAXDIFF: 225 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth1/dnxhd_1080i b/gst-libs/ext/libav/tests/ref/vsynth1/dnxhd_1080i
deleted file mode 100644
index e989eae..0000000
--- a/gst-libs/ext/libav/tests/ref/vsynth1/dnxhd_1080i
+++ /dev/null
@@ -1,4 +0,0 @@
-3cfbe36a7dd5b48859b8a569d626ef77 *./tests/data/vsynth1/dnxhd-1080i.mov
-3031875 ./tests/data/vsynth1/dnxhd-1080i.mov
-0c651e840f860592f0d5b66030d9fa32 *./tests/data/dnxhd_1080i.vsynth1.out.yuv
-stddev: 6.29 PSNR: 32.15 MAXDIFF: 64 bytes: 760320/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth1/dnxhd_720p b/gst-libs/ext/libav/tests/ref/vsynth1/dnxhd_720p
deleted file mode 100644
index 263843d..0000000
--- a/gst-libs/ext/libav/tests/ref/vsynth1/dnxhd_720p
+++ /dev/null
@@ -1,4 +0,0 @@
-81f5be451dc18cf8a1d333c7885de60b *./tests/data/vsynth1/dnxhd-720p.dnxhd
-2293760 ./tests/data/vsynth1/dnxhd-720p.dnxhd
-94b21e5e68ccf9471eff74afd0ebe319 *./tests/data/dnxhd_720p.vsynth1.out.yuv
-stddev: 6.32 PSNR: 32.11 MAXDIFF: 183 bytes: 760320/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth1/dnxhd_720p_10bit b/gst-libs/ext/libav/tests/ref/vsynth1/dnxhd_720p_10bit
deleted file mode 100644
index ad97b66..0000000
--- a/gst-libs/ext/libav/tests/ref/vsynth1/dnxhd_720p_10bit
+++ /dev/null
@@ -1,4 +0,0 @@
-b5e24a055af02edec8674333260214fd *./tests/data/vsynth1/dnxhd-720p-10bit.dnxhd
- 2293760 ./tests/data/vsynth1/dnxhd-720p-10bit.dnxhd
-4466ff3d73d01bbe75ea25001d379b63 *./tests/data/dnxhd_720p_10bit.vsynth1.out.yuv
-stddev: 6.27 PSNR: 32.18 MAXDIFF: 64 bytes: 760320/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth1/dnxhd_720p_rd b/gst-libs/ext/libav/tests/ref/vsynth1/dnxhd_720p_rd
deleted file mode 100644
index e77c725..0000000
--- a/gst-libs/ext/libav/tests/ref/vsynth1/dnxhd_720p_rd
+++ /dev/null
@@ -1,4 +0,0 @@
-1dc6e95925c4f3a230848ec17c02abed *./tests/data/vsynth1/dnxhd-720p-rd.dnxhd
-2293760 ./tests/data/vsynth1/dnxhd-720p-rd.dnxhd
-02972d2aec120ec1577ec9053d68ae0f *./tests/data/dnxhd_720p_rd.vsynth1.out.yuv
-stddev: 6.26 PSNR: 32.19 MAXDIFF: 65 bytes: 760320/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth1/dv b/gst-libs/ext/libav/tests/ref/vsynth1/dv
deleted file mode 100644
index c309bb2..0000000
--- a/gst-libs/ext/libav/tests/ref/vsynth1/dv
+++ /dev/null
@@ -1,4 +0,0 @@
-27ade3031b17214cf81c19cbf70f37d7 *./tests/data/vsynth1/dv.dv
-7200000 ./tests/data/vsynth1/dv.dv
-02ac7cdeab91d4d5621e7ce96dddc498 *./tests/data/dv.vsynth1.out.yuv
-stddev: 6.90 PSNR: 31.34 MAXDIFF: 76 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth1/dv50 b/gst-libs/ext/libav/tests/ref/vsynth1/dv50
deleted file mode 100644
index 9ae3385..0000000
--- a/gst-libs/ext/libav/tests/ref/vsynth1/dv50
+++ /dev/null
@@ -1,4 +0,0 @@
-26dba84f0ea895b914ef5b333d8394ac *./tests/data/vsynth1/dv50.dv
-14400000 ./tests/data/vsynth1/dv50.dv
-a2ff093e93ffed10f730fa21df02fc50 *./tests/data/dv50.vsynth1.out.yuv
-stddev: 1.72 PSNR: 43.38 MAXDIFF: 29 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth1/dv_411 b/gst-libs/ext/libav/tests/ref/vsynth1/dv_411
deleted file mode 100644
index 841c3fd..0000000
--- a/gst-libs/ext/libav/tests/ref/vsynth1/dv_411
+++ /dev/null
@@ -1,4 +0,0 @@
-bd67f2431db160d4bb6dcd791cea6efd *./tests/data/vsynth1/dv411.dv
-7200000 ./tests/data/vsynth1/dv411.dv
-b6640a3a572353f51284acb746eb00c4 *./tests/data/dv_411.vsynth1.out.yuv
-stddev: 30.76 PSNR: 18.37 MAXDIFF: 205 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth1/error b/gst-libs/ext/libav/tests/ref/vsynth1/error
deleted file mode 100644
index bc24d5b..0000000
--- a/gst-libs/ext/libav/tests/ref/vsynth1/error
+++ /dev/null
@@ -1,4 +0,0 @@
-7416dfd319f04044d4575dc9d1b406e1 *./tests/data/vsynth1/error-mpeg4-adv.avi
- 756836 ./tests/data/vsynth1/error-mpeg4-adv.avi
-79e94ba32b37759397362cbcb479d4d3 *./tests/data/error.vsynth1.out.yuv
-stddev: 18.36 PSNR: 22.85 MAXDIFF: 243 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth1/ffv1 b/gst-libs/ext/libav/tests/ref/vsynth1/ffv1
deleted file mode 100644
index bf90915..0000000
--- a/gst-libs/ext/libav/tests/ref/vsynth1/ffv1
+++ /dev/null
@@ -1,4 +0,0 @@
-67ddc7edde5cca49290245d881787890 *./tests/data/vsynth1/ffv1.avi
-2655376 ./tests/data/vsynth1/ffv1.avi
-c5ccac874dbf808e9088bc3107860042 *./tests/data/ffv1.vsynth1.out.yuv
-stddev: 0.00 PSNR:999.99 MAXDIFF: 0 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth1/flashsv b/gst-libs/ext/libav/tests/ref/vsynth1/flashsv
deleted file mode 100644
index 7920193..0000000
--- a/gst-libs/ext/libav/tests/ref/vsynth1/flashsv
+++ /dev/null
@@ -1,4 +0,0 @@
-97894502b4cb57aca1105b6333f72dae *./tests/data/vsynth1/flashsv.flv
-14681925 ./tests/data/vsynth1/flashsv.flv
-947cb24ec45a453348ae6fe3fa278071 *./tests/data/flashsv.vsynth1.out.yuv
-stddev: 2.85 PSNR: 39.03 MAXDIFF: 49 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth1/flv b/gst-libs/ext/libav/tests/ref/vsynth1/flv
deleted file mode 100644
index 17f5656..0000000
--- a/gst-libs/ext/libav/tests/ref/vsynth1/flv
+++ /dev/null
@@ -1,4 +0,0 @@
-d6a80659cedee7698aefe9c4a8285fa4 *./tests/data/vsynth1/flv.flv
-636269 ./tests/data/vsynth1/flv.flv
-5ab46d8dd01dbb1d63df2a84858a4b05 *./tests/data/flv.vsynth1.out.yuv
-stddev: 8.02 PSNR: 30.04 MAXDIFF: 105 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth1/h261 b/gst-libs/ext/libav/tests/ref/vsynth1/h261
deleted file mode 100644
index 36d04f1..0000000
--- a/gst-libs/ext/libav/tests/ref/vsynth1/h261
+++ /dev/null
@@ -1,4 +0,0 @@
-d155470b713aeebacb85980b0d5f2ce3 *./tests/data/vsynth1/h261.avi
-707588 ./tests/data/vsynth1/h261.avi
-716e83cb51afb1246bfaa80967df48ea *./tests/data/h261.vsynth1.out.yuv
-stddev: 9.11 PSNR: 28.93 MAXDIFF: 113 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth1/h263 b/gst-libs/ext/libav/tests/ref/vsynth1/h263
deleted file mode 100644
index 6351adc..0000000
--- a/gst-libs/ext/libav/tests/ref/vsynth1/h263
+++ /dev/null
@@ -1,4 +0,0 @@
-fb4dc9b9eac2628c56cb82cf332e1f58 *./tests/data/vsynth1/h263.avi
-659686 ./tests/data/vsynth1/h263.avi
-1a1ba9a3a63ec1a1a9585fded0a7c954 *./tests/data/h263.vsynth1.out.yuv
-stddev: 8.03 PSNR: 30.03 MAXDIFF: 103 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth1/h263p b/gst-libs/ext/libav/tests/ref/vsynth1/h263p
deleted file mode 100644
index 93df549..0000000
--- a/gst-libs/ext/libav/tests/ref/vsynth1/h263p
+++ /dev/null
@@ -1,4 +0,0 @@
-bbcadeceba295e1dad148aea1e57c370 *./tests/data/vsynth1/h263p.avi
-2328348 ./tests/data/vsynth1/h263p.avi
-9554cda00c3487ab3ffda2c3ea22fa2f *./tests/data/h263p.vsynth1.out.yuv
-stddev: 2.06 PSNR: 41.83 MAXDIFF: 20 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth1/huffyuv b/gst-libs/ext/libav/tests/ref/vsynth1/huffyuv
deleted file mode 100644
index fefc84a..0000000
--- a/gst-libs/ext/libav/tests/ref/vsynth1/huffyuv
+++ /dev/null
@@ -1,4 +0,0 @@
-ace2536fa169d835d0fb332abde28d51 *./tests/data/vsynth1/huffyuv.avi
-7933800 ./tests/data/vsynth1/huffyuv.avi
-c5ccac874dbf808e9088bc3107860042 *./tests/data/huffyuv.vsynth1.out.yuv
-stddev: 0.00 PSNR:999.99 MAXDIFF: 0 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth1/jpegls b/gst-libs/ext/libav/tests/ref/vsynth1/jpegls
deleted file mode 100644
index 636f7fc..0000000
--- a/gst-libs/ext/libav/tests/ref/vsynth1/jpegls
+++ /dev/null
@@ -1,4 +0,0 @@
-519e26bb1ac0f3db8f90b36537f2f760 *./tests/data/vsynth1/jpegls.avi
-9089812 ./tests/data/vsynth1/jpegls.avi
-947cb24ec45a453348ae6fe3fa278071 *./tests/data/jpegls.vsynth1.out.yuv
-stddev: 2.85 PSNR: 39.03 MAXDIFF: 49 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth1/ljpeg b/gst-libs/ext/libav/tests/ref/vsynth1/ljpeg
deleted file mode 100644
index 01d59e7..0000000
--- a/gst-libs/ext/libav/tests/ref/vsynth1/ljpeg
+++ /dev/null
@@ -1,4 +0,0 @@
-9092f306f165b98ab0bb4f576f198ad5 *./tests/data/vsynth1/ljpeg.avi
-6312936 ./tests/data/vsynth1/ljpeg.avi
-c5ccac874dbf808e9088bc3107860042 *./tests/data/ljpeg.vsynth1.out.yuv
-stddev: 0.00 PSNR:999.99 MAXDIFF: 0 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth1/mjpeg b/gst-libs/ext/libav/tests/ref/vsynth1/mjpeg
deleted file mode 100644
index 63a0ff0..0000000
--- a/gst-libs/ext/libav/tests/ref/vsynth1/mjpeg
+++ /dev/null
@@ -1,4 +0,0 @@
-8bbf9513b1822945539f27a6eff3c7fa *./tests/data/vsynth1/mjpeg.avi
-1516140 ./tests/data/vsynth1/mjpeg.avi
-c6ae81b5b896e4d05ff584311aebdb18 *./tests/data/mjpeg.vsynth1.out.yuv
-stddev: 7.87 PSNR: 30.21 MAXDIFF: 63 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth1/mpeg b/gst-libs/ext/libav/tests/ref/vsynth1/mpeg
deleted file mode 100644
index 7ae92f1..0000000
--- a/gst-libs/ext/libav/tests/ref/vsynth1/mpeg
+++ /dev/null
@@ -1,4 +0,0 @@
-1428744c6d5835f27506e69be4f837f4 *./tests/data/vsynth1/mpeg1.mpg
-712006 ./tests/data/vsynth1/mpeg1.mpg
-58f0c332bf689117b57fa629a2bc0d2b *./tests/data/mpeg.vsynth1.out.yuv
-stddev: 7.62 PSNR: 30.48 MAXDIFF: 84 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth1/mpeg1b b/gst-libs/ext/libav/tests/ref/vsynth1/mpeg1b
deleted file mode 100644
index 897a0ce..0000000
--- a/gst-libs/ext/libav/tests/ref/vsynth1/mpeg1b
+++ /dev/null
@@ -1,4 +0,0 @@
-777639666b449ab0a7ef260511e40532 *./tests/data/vsynth1/mpeg1b.mpg
-1030337 ./tests/data/vsynth1/mpeg1b.mpg
-91a7fce732b34748e7bf753ebabe2483 *./tests/data/mpeg1b.vsynth1.out.yuv
-stddev: 6.30 PSNR: 32.13 MAXDIFF: 75 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth1/mpeg2 b/gst-libs/ext/libav/tests/ref/vsynth1/mpeg2
deleted file mode 100644
index 0df3b7f..0000000
--- a/gst-libs/ext/libav/tests/ref/vsynth1/mpeg2
+++ /dev/null
@@ -1,4 +0,0 @@
-fbddea2368cd2028fc8db4dfd4682e94 *./tests/data/vsynth1/mpeg2.mpg
-728044 ./tests/data/vsynth1/mpeg2.mpg
-b41ca49c1a02e66ce64d262e2cdaec15 *./tests/data/mpeg2.vsynth1.out.yuv
-stddev: 7.65 PSNR: 30.45 MAXDIFF: 84 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth1/mpeg2_422 b/gst-libs/ext/libav/tests/ref/vsynth1/mpeg2_422
deleted file mode 100644
index beef80b..0000000
--- a/gst-libs/ext/libav/tests/ref/vsynth1/mpeg2_422
+++ /dev/null
@@ -1,4 +0,0 @@
-af0cb75451aaa807beb5102707a98823 *./tests/data/vsynth1/mpeg2_422.mpg
-728200 ./tests/data/vsynth1/mpeg2_422.mpg
-29b518282493203e83b27a939795dc3a *./tests/data/mpeg2_422.vsynth1.out.yuv
-stddev: 63.33 PSNR: 12.10 MAXDIFF: 242 bytes: 10137600/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth1/mpeg2_idct_int b/gst-libs/ext/libav/tests/ref/vsynth1/mpeg2_idct_int
deleted file mode 100644
index be73750..0000000
--- a/gst-libs/ext/libav/tests/ref/vsynth1/mpeg2_idct_int
+++ /dev/null
@@ -1,4 +0,0 @@
-4c067397b504d65532d7779cd36f3f88 *./tests/data/vsynth1/mpeg2_idct_int.mpg
-725668 ./tests/data/vsynth1/mpeg2_idct_int.mpg
-9f7b065f98d57cdecf90e6f7a2524eb5 *./tests/data/mpeg2_idct_int.vsynth1.out.yuv
-stddev: 7.65 PSNR: 30.45 MAXDIFF: 81 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth1/mpeg2_ilace b/gst-libs/ext/libav/tests/ref/vsynth1/mpeg2_ilace
deleted file mode 100644
index e05951f..0000000
--- a/gst-libs/ext/libav/tests/ref/vsynth1/mpeg2_ilace
+++ /dev/null
@@ -1,4 +0,0 @@
-ec3f6713c88a2b41f6c369fd64341077 *./tests/data/vsynth1/mpeg2i.mpg
-737473 ./tests/data/vsynth1/mpeg2i.mpg
-97615390fdd69abfcbc7e02df863a7d2 *./tests/data/mpeg2_ilace.vsynth1.out.yuv
-stddev: 7.67 PSNR: 30.43 MAXDIFF: 84 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth1/mpeg2_ivlc_qprd b/gst-libs/ext/libav/tests/ref/vsynth1/mpeg2_ivlc_qprd
deleted file mode 100644
index c8a6694..0000000
--- a/gst-libs/ext/libav/tests/ref/vsynth1/mpeg2_ivlc_qprd
+++ /dev/null
@@ -1,4 +0,0 @@
-8f6b20714918e6443e0c03716ed06f0d *./tests/data/vsynth1/mpeg2ivlc-qprd.mpg
-783552 ./tests/data/vsynth1/mpeg2ivlc-qprd.mpg
-98eb9da15f880978e7f2ee1e7ce476ef *./tests/data/mpeg2_ivlc_qprd.vsynth1.out.yuv
-stddev: 10.07 PSNR: 28.06 MAXDIFF: 165 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth1/mpeg2thread b/gst-libs/ext/libav/tests/ref/vsynth1/mpeg2thread
deleted file mode 100644
index a44c00d..0000000
--- a/gst-libs/ext/libav/tests/ref/vsynth1/mpeg2thread
+++ /dev/null
@@ -1,4 +0,0 @@
-ecd183706688bd977c9994c3d1b23d61 *./tests/data/vsynth1/mpeg2thread.mpg
-801313 ./tests/data/vsynth1/mpeg2thread.mpg
-d1658911ca83f5616c1d32abc40750de *./tests/data/mpeg2thread.vsynth1.out.yuv
-stddev: 7.63 PSNR: 30.48 MAXDIFF: 110 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth1/mpeg2thread_ilace b/gst-libs/ext/libav/tests/ref/vsynth1/mpeg2thread_ilace
deleted file mode 100644
index 0667b68..0000000
--- a/gst-libs/ext/libav/tests/ref/vsynth1/mpeg2thread_ilace
+++ /dev/null
@@ -1,4 +0,0 @@
-23d600b026222253c2340e23300a4c02 *./tests/data/vsynth1/mpeg2threadivlc.mpg
-791773 ./tests/data/vsynth1/mpeg2threadivlc.mpg
-d1658911ca83f5616c1d32abc40750de *./tests/data/mpeg2thread_ilace.vsynth1.out.yuv
-stddev: 7.63 PSNR: 30.48 MAXDIFF: 110 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth1/mpeg4 b/gst-libs/ext/libav/tests/ref/vsynth1/mpeg4
deleted file mode 100644
index b318e6f..0000000
--- a/gst-libs/ext/libav/tests/ref/vsynth1/mpeg4
+++ /dev/null
@@ -1,4 +0,0 @@
-59a9e2eed314abface66aaf1b45eb8f2 *./tests/data/vsynth1/odivx.mp4
-540180 ./tests/data/vsynth1/odivx.mp4
-8828a375448dc5c2215163ba70656f89 *./tests/data/mpeg4.vsynth1.out.yuv
-stddev: 7.97 PSNR: 30.10 MAXDIFF: 105 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth1/mpeg4_adap b/gst-libs/ext/libav/tests/ref/vsynth1/mpeg4_adap
deleted file mode 100644
index 7513a22..0000000
--- a/gst-libs/ext/libav/tests/ref/vsynth1/mpeg4_adap
+++ /dev/null
@@ -1,4 +0,0 @@
-2d870c0da9ab2231ab5fc06981e70399 *./tests/data/vsynth1/mpeg4-adap.avi
-403456 ./tests/data/vsynth1/mpeg4-adap.avi
-fa2049396479b5f170aa764fed5b2a31 *./tests/data/mpeg4_adap.vsynth1.out.yuv
-stddev: 14.05 PSNR: 25.17 MAXDIFF: 184 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth1/mpeg4_qpel b/gst-libs/ext/libav/tests/ref/vsynth1/mpeg4_qpel
deleted file mode 100644
index 51547d8..0000000
--- a/gst-libs/ext/libav/tests/ref/vsynth1/mpeg4_qpel
+++ /dev/null
@@ -1,4 +0,0 @@
-3bf17c3d04f52988386ce106a2a58976 *./tests/data/vsynth1/mpeg4-Q.avi
-860678 ./tests/data/vsynth1/mpeg4-Q.avi
-756928496245ecc701f79eebeec8e5e6 *./tests/data/mpeg4_qpel.vsynth1.out.yuv
-stddev: 5.63 PSNR: 33.12 MAXDIFF: 70 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth1/mpeg4_qprd b/gst-libs/ext/libav/tests/ref/vsynth1/mpeg4_qprd
deleted file mode 100644
index aa3b506..0000000
--- a/gst-libs/ext/libav/tests/ref/vsynth1/mpeg4_qprd
+++ /dev/null
@@ -1,4 +0,0 @@
-d6b7e724a6ad66ab5e4c5a499218b40d *./tests/data/vsynth1/mpeg4-qprd.avi
-710944 ./tests/data/vsynth1/mpeg4-qprd.avi
-e65f4c7f343fe2bad1cac44b7da5f7c4 *./tests/data/mpeg4_qprd.vsynth1.out.yuv
-stddev: 9.79 PSNR: 28.31 MAXDIFF: 176 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth1/mpeg4adv b/gst-libs/ext/libav/tests/ref/vsynth1/mpeg4adv
deleted file mode 100644
index 374f0b2..0000000
--- a/gst-libs/ext/libav/tests/ref/vsynth1/mpeg4adv
+++ /dev/null
@@ -1,4 +0,0 @@
-7d8eb01fd68d83d62a98585757704d47 *./tests/data/vsynth1/mpeg4-adv.avi
-589716 ./tests/data/vsynth1/mpeg4-adv.avi
-f8b226876b1b2c0b98fd6928fd9adbd8 *./tests/data/mpeg4adv.vsynth1.out.yuv
-stddev: 6.98 PSNR: 31.25 MAXDIFF: 84 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth1/mpeg4nr b/gst-libs/ext/libav/tests/ref/vsynth1/mpeg4nr
deleted file mode 100644
index c821490..0000000
--- a/gst-libs/ext/libav/tests/ref/vsynth1/mpeg4nr
+++ /dev/null
@@ -1,4 +0,0 @@
-c02f54157ba08ca12ad979c6308212ad *./tests/data/vsynth1/mpeg4-nr.avi
-675638 ./tests/data/vsynth1/mpeg4-nr.avi
-d2b89d5958fb7331f6c9e5b7ecaaa5b6 *./tests/data/mpeg4nr.vsynth1.out.yuv
-stddev: 6.99 PSNR: 31.23 MAXDIFF: 86 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth1/mpeg4thread b/gst-libs/ext/libav/tests/ref/vsynth1/mpeg4thread
deleted file mode 100644
index d04f436..0000000
--- a/gst-libs/ext/libav/tests/ref/vsynth1/mpeg4thread
+++ /dev/null
@@ -1,4 +0,0 @@
-4f4ea04faad7212374919aa1ec7ff994 *./tests/data/vsynth1/mpeg4-thread.avi
-774760 ./tests/data/vsynth1/mpeg4-thread.avi
-64b96cddf5301990e118978b3a3bcd0d *./tests/data/mpeg4thread.vsynth1.out.yuv
-stddev: 10.13 PSNR: 28.02 MAXDIFF: 183 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth1/msmpeg4 b/gst-libs/ext/libav/tests/ref/vsynth1/msmpeg4
deleted file mode 100644
index d94d3f0..0000000
--- a/gst-libs/ext/libav/tests/ref/vsynth1/msmpeg4
+++ /dev/null
@@ -1,4 +0,0 @@
-4b08952b0afceb17ee3db31b67f6b778 *./tests/data/vsynth1/msmpeg4.avi
-624718 ./tests/data/vsynth1/msmpeg4.avi
-5ca72c39e3fc5df8e62f223c869589f5 *./tests/data/msmpeg4.vsynth1.out.yuv
-stddev: 7.98 PSNR: 30.09 MAXDIFF: 104 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth1/msmpeg4v2 b/gst-libs/ext/libav/tests/ref/vsynth1/msmpeg4v2
deleted file mode 100644
index dde152d..0000000
--- a/gst-libs/ext/libav/tests/ref/vsynth1/msmpeg4v2
+++ /dev/null
@@ -1,4 +0,0 @@
-88957e35efcc718bce0307627ad3298d *./tests/data/vsynth1/msmpeg4v2.avi
-623788 ./tests/data/vsynth1/msmpeg4v2.avi
-c6ff1041a0ef62c2a2e5ef519e5e94c4 *./tests/data/msmpeg4v2.vsynth1.out.yuv
-stddev: 7.97 PSNR: 30.10 MAXDIFF: 105 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth1/qtrle b/gst-libs/ext/libav/tests/ref/vsynth1/qtrle
deleted file mode 100644
index 002ee49..0000000
--- a/gst-libs/ext/libav/tests/ref/vsynth1/qtrle
+++ /dev/null
@@ -1,4 +0,0 @@
-7d75328a17e04796a39fe9be3a322946 *./tests/data/vsynth1/qtrle.mov
-15263232 ./tests/data/vsynth1/qtrle.mov
-243325fb2cae1a9245efd49aff936327 *./tests/data/qtrle.vsynth1.out.yuv
-stddev: 3.42 PSNR: 37.43 MAXDIFF: 48 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth1/rc b/gst-libs/ext/libav/tests/ref/vsynth1/rc
deleted file mode 100644
index be50952..0000000
--- a/gst-libs/ext/libav/tests/ref/vsynth1/rc
+++ /dev/null
@@ -1,4 +0,0 @@
-1c6dadf75f60f4ba59a0fe0b6eaedf57 *./tests/data/vsynth1/mpeg4-rc.avi
-830160 ./tests/data/vsynth1/mpeg4-rc.avi
-4d95e340db9bc57a559162c039f3784e *./tests/data/rc.vsynth1.out.yuv
-stddev: 10.24 PSNR: 27.92 MAXDIFF: 196 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth1/rgb b/gst-libs/ext/libav/tests/ref/vsynth1/rgb
deleted file mode 100644
index 10a0a13..0000000
--- a/gst-libs/ext/libav/tests/ref/vsynth1/rgb
+++ /dev/null
@@ -1,4 +0,0 @@
-05f0719cb52486d9a4beb9cfae3f2571 *./tests/data/vsynth1/rgb.avi
-15213260 ./tests/data/vsynth1/rgb.avi
-243325fb2cae1a9245efd49aff936327 *./tests/data/rgb.vsynth1.out.yuv
-stddev: 3.42 PSNR: 37.43 MAXDIFF: 48 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth1/roq b/gst-libs/ext/libav/tests/ref/vsynth1/roq
deleted file mode 100644
index 42456e4..0000000
--- a/gst-libs/ext/libav/tests/ref/vsynth1/roq
+++ /dev/null
@@ -1,4 +0,0 @@
-cf8b7b0e539bab3169c234ca63d71dd8 *./tests/data/vsynth1/roqav.roq
-101671 ./tests/data/vsynth1/roqav.roq
-0ad983c291b1ed373645c5b12a108c61 *./tests/data/roq.vsynth1.out.yuv
-stddev: 7.74 PSNR: 30.35 MAXDIFF: 89 bytes: 760320/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth1/rv10 b/gst-libs/ext/libav/tests/ref/vsynth1/rv10
deleted file mode 100644
index 9e0ceec..0000000
--- a/gst-libs/ext/libav/tests/ref/vsynth1/rv10
+++ /dev/null
@@ -1,4 +0,0 @@
-4d7e82de72a83905cf84b8abc3e70b8f *./tests/data/vsynth1/rv10.rm
-653905 ./tests/data/vsynth1/rv10.rm
-1a1ba9a3a63ec1a1a9585fded0a7c954 *./tests/data/rv10.vsynth1.out.yuv
-stddev: 8.03 PSNR: 30.03 MAXDIFF: 103 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth1/rv20 b/gst-libs/ext/libav/tests/ref/vsynth1/rv20
deleted file mode 100644
index d3b8814..0000000
--- a/gst-libs/ext/libav/tests/ref/vsynth1/rv20
+++ /dev/null
@@ -1,4 +0,0 @@
-81868601e602eee5b6d80f5ece4aaa98 *./tests/data/vsynth1/rv20.rm
-646016 ./tests/data/vsynth1/rv20.rm
-b45fdb0201b06f7649f44050e262c54c *./tests/data/rv20.vsynth1.out.yuv
-stddev: 8.26 PSNR: 29.79 MAXDIFF: 103 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth1/snow b/gst-libs/ext/libav/tests/ref/vsynth1/snow
deleted file mode 100644
index ac34760..0000000
--- a/gst-libs/ext/libav/tests/ref/vsynth1/snow
+++ /dev/null
@@ -1,4 +0,0 @@
-d593b3c1a9729ce6dd1721f58fa93712 *./tests/data/vsynth1/snow.avi
-136088 ./tests/data/vsynth1/snow.avi
-91021b7d6d7908648fe78cc1975af8c4 *./tests/data/snow.vsynth1.out.yuv
-stddev: 22.77 PSNR: 20.98 MAXDIFF: 172 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth1/snowll b/gst-libs/ext/libav/tests/ref/vsynth1/snowll
deleted file mode 100644
index 427e52d..0000000
--- a/gst-libs/ext/libav/tests/ref/vsynth1/snowll
+++ /dev/null
@@ -1,4 +0,0 @@
-6d29e8c06a645cdee45073c4f3d0004e *./tests/data/vsynth1/snow53.avi
-3419980 ./tests/data/vsynth1/snow53.avi
-c5ccac874dbf808e9088bc3107860042 *./tests/data/snowll.vsynth1.out.yuv
-stddev: 0.00 PSNR:999.99 MAXDIFF: 0 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth1/svq1 b/gst-libs/ext/libav/tests/ref/vsynth1/svq1
deleted file mode 100644
index 3137e3b..0000000
--- a/gst-libs/ext/libav/tests/ref/vsynth1/svq1
+++ /dev/null
@@ -1,4 +0,0 @@
-5c9d8734693f3cab57f61e76b5b6da7d *./tests/data/vsynth1/svq1.mov
-1334367 ./tests/data/vsynth1/svq1.mov
-9cc35c54b2c77d36bd7e308b393c1f81 *./tests/data/svq1.vsynth1.out.yuv
-stddev: 9.58 PSNR: 28.50 MAXDIFF: 210 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth1/v210 b/gst-libs/ext/libav/tests/ref/vsynth1/v210
deleted file mode 100644
index bb84c3e..0000000
--- a/gst-libs/ext/libav/tests/ref/vsynth1/v210
+++ /dev/null
@@ -1,4 +0,0 @@
-dd6c870a2a52c9e75ce61c3670e710e7 *./tests/data/vsynth1/v210.avi
-14752460 ./tests/data/vsynth1/v210.avi
-50973792d3f1abe04a51ee0121f077f2 *./tests/data/v210.vsynth1.out.yuv
-stddev: 1.85 PSNR: 42.78 MAXDIFF: 29 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth1/vref b/gst-libs/ext/libav/tests/ref/vsynth1/vref
deleted file mode 100644
index 2defdac..0000000
--- a/gst-libs/ext/libav/tests/ref/vsynth1/vref
+++ /dev/null
@@ -1,2 +0,0 @@
-c5ccac874dbf808e9088bc3107860042 *./tests/data/vsynth1.ref.yuv
-7603200 ./tests/data/vsynth1.ref.yuv
diff --git a/gst-libs/ext/libav/tests/ref/vsynth1/wmv1 b/gst-libs/ext/libav/tests/ref/vsynth1/wmv1
deleted file mode 100644
index 8c32ea8..0000000
--- a/gst-libs/ext/libav/tests/ref/vsynth1/wmv1
+++ /dev/null
@@ -1,4 +0,0 @@
-4f3461315776e5118866fa3819cff9b6 *./tests/data/vsynth1/wmv1.avi
-626908 ./tests/data/vsynth1/wmv1.avi
-5182edba5b5e0354b39ce4f3604b62da *./tests/data/wmv1.vsynth1.out.yuv
-stddev: 7.97 PSNR: 30.09 MAXDIFF: 110 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth1/wmv2 b/gst-libs/ext/libav/tests/ref/vsynth1/wmv2
deleted file mode 100644
index 8e1e88d..0000000
--- a/gst-libs/ext/libav/tests/ref/vsynth1/wmv2
+++ /dev/null
@@ -1,4 +0,0 @@
-13efda9d3811345aadc0632fc9a9332b *./tests/data/vsynth1/wmv2.avi
-659852 ./tests/data/vsynth1/wmv2.avi
-5182edba5b5e0354b39ce4f3604b62da *./tests/data/wmv2.vsynth1.out.yuv
-stddev: 7.97 PSNR: 30.09 MAXDIFF: 110 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth1/yuv b/gst-libs/ext/libav/tests/ref/vsynth1/yuv
deleted file mode 100644
index b98dda5..0000000
--- a/gst-libs/ext/libav/tests/ref/vsynth1/yuv
+++ /dev/null
@@ -1,4 +0,0 @@
-aa6b9e862aebcf8902a6d770e7729d59 *./tests/data/vsynth1/yuv.avi
-7610060 ./tests/data/vsynth1/yuv.avi
-c5ccac874dbf808e9088bc3107860042 *./tests/data/yuv.vsynth1.out.yuv
-stddev: 0.00 PSNR:999.99 MAXDIFF: 0 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth2/asv1 b/gst-libs/ext/libav/tests/ref/vsynth2/asv1
deleted file mode 100644
index 1d0385c..0000000
--- a/gst-libs/ext/libav/tests/ref/vsynth2/asv1
+++ /dev/null
@@ -1,4 +0,0 @@
-4eb34d2de25f67a2706456e999338fe9 *./tests/data/vsynth2/asv1.avi
-832512 ./tests/data/vsynth2/asv1.avi
-c96ff7fd17c52f99ddb7922a4cb9168f *./tests/data/asv1.vsynth2.out.yuv
-stddev: 10.47 PSNR: 27.73 MAXDIFF: 98 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth2/asv2 b/gst-libs/ext/libav/tests/ref/vsynth2/asv2
deleted file mode 100644
index 21ce40a..0000000
--- a/gst-libs/ext/libav/tests/ref/vsynth2/asv2
+++ /dev/null
@@ -1,4 +0,0 @@
-9649a4b68fb1107bad13e8a7574cc72d *./tests/data/vsynth2/asv2.avi
-789072 ./tests/data/vsynth2/asv2.avi
-74a78015b64b2cf8cb9da2e44f508a69 *./tests/data/asv2.vsynth2.out.yuv
-stddev: 10.28 PSNR: 27.89 MAXDIFF: 95 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth2/cljr b/gst-libs/ext/libav/tests/ref/vsynth2/cljr
deleted file mode 100644
index 6f8670c..0000000
--- a/gst-libs/ext/libav/tests/ref/vsynth2/cljr
+++ /dev/null
@@ -1,4 +0,0 @@
-86250984790dd745a932f36cf229cef7 *./tests/data/vsynth2/cljr.avi
- 5075660 ./tests/data/vsynth2/cljr.avi
-3a70ba2a535ef9c7fc6478b27a2cb58a *./tests/data/cljr.vsynth2.out.yuv
-stddev: 10.48 PSNR: 27.72 MAXDIFF: 64 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth2/dnxhd_1080i b/gst-libs/ext/libav/tests/ref/vsynth2/dnxhd_1080i
deleted file mode 100644
index b9a6fac..0000000
--- a/gst-libs/ext/libav/tests/ref/vsynth2/dnxhd_1080i
+++ /dev/null
@@ -1,4 +0,0 @@
-19a91b7da35cecf41e5e3cb322485627 *./tests/data/vsynth2/dnxhd-1080i.mov
-3031875 ./tests/data/vsynth2/dnxhd-1080i.mov
-3c559af629ae0a8fb1a9a0e4b4da7733 *./tests/data/dnxhd_1080i.vsynth2.out.yuv
-stddev: 1.31 PSNR: 45.77 MAXDIFF: 23 bytes: 760320/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth2/dnxhd_720p b/gst-libs/ext/libav/tests/ref/vsynth2/dnxhd_720p
deleted file mode 100644
index eab04c6..0000000
--- a/gst-libs/ext/libav/tests/ref/vsynth2/dnxhd_720p
+++ /dev/null
@@ -1,4 +0,0 @@
-58e07cc6ae0a2d36787044d0e82708a6 *./tests/data/vsynth2/dnxhd-720p.dnxhd
-2293760 ./tests/data/vsynth2/dnxhd-720p.dnxhd
-ab601eaafef74d80d3d20b780dddd836 *./tests/data/dnxhd_720p.vsynth2.out.yuv
-stddev: 1.36 PSNR: 45.45 MAXDIFF: 127 bytes: 760320/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth2/dnxhd_720p_10bit b/gst-libs/ext/libav/tests/ref/vsynth2/dnxhd_720p_10bit
deleted file mode 100644
index 60c0d84..0000000
--- a/gst-libs/ext/libav/tests/ref/vsynth2/dnxhd_720p_10bit
+++ /dev/null
@@ -1,4 +0,0 @@
-4b57da2c0c1280469ff3579f7151c227 *./tests/data/vsynth2/dnxhd-720p-10bit.dnxhd
- 2293760 ./tests/data/vsynth2/dnxhd-720p-10bit.dnxhd
-31a6aa8b8702e85fa3b48e73f035c4e4 *./tests/data/dnxhd_720p_10bit.vsynth2.out.yuv
-stddev: 1.35 PSNR: 45.46 MAXDIFF: 23 bytes: 760320/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth2/dnxhd_720p_rd b/gst-libs/ext/libav/tests/ref/vsynth2/dnxhd_720p_rd
deleted file mode 100644
index 2d5c4d5..0000000
--- a/gst-libs/ext/libav/tests/ref/vsynth2/dnxhd_720p_rd
+++ /dev/null
@@ -1,4 +0,0 @@
-092ffb7b8cf3c11556bb05dbb8b476ac *./tests/data/vsynth2/dnxhd-720p-rd.dnxhd
-2293760 ./tests/data/vsynth2/dnxhd-720p-rd.dnxhd
-33547ca318acff9448cba719cb99296d *./tests/data/dnxhd_720p_rd.vsynth2.out.yuv
-stddev: 1.32 PSNR: 45.66 MAXDIFF: 22 bytes: 760320/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth2/dv b/gst-libs/ext/libav/tests/ref/vsynth2/dv
deleted file mode 100644
index 6c010b9..0000000
--- a/gst-libs/ext/libav/tests/ref/vsynth2/dv
+++ /dev/null
@@ -1,4 +0,0 @@
-bfa766f89bfeabc0ae1044f3954bed52 *./tests/data/vsynth2/dv.dv
-7200000 ./tests/data/vsynth2/dv.dv
-7ec62bd3350a6848364669e6e1e4b9cc *./tests/data/dv.vsynth2.out.yuv
-stddev: 1.71 PSNR: 43.47 MAXDIFF: 33 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth2/dv50 b/gst-libs/ext/libav/tests/ref/vsynth2/dv50
deleted file mode 100644
index 7e0083b..0000000
--- a/gst-libs/ext/libav/tests/ref/vsynth2/dv50
+++ /dev/null
@@ -1,4 +0,0 @@
-61e31c79e8949b25c849753a0785b0d7 *./tests/data/vsynth2/dv50.dv
-14400000 ./tests/data/vsynth2/dv50.dv
-af3f2dd5ab62c1a1d98b07d4aeb6852f *./tests/data/dv50.vsynth2.out.yuv
-stddev: 0.82 PSNR: 49.82 MAXDIFF: 12 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth2/dv_411 b/gst-libs/ext/libav/tests/ref/vsynth2/dv_411
deleted file mode 100644
index 2340ef0..0000000
--- a/gst-libs/ext/libav/tests/ref/vsynth2/dv_411
+++ /dev/null
@@ -1,4 +0,0 @@
-00a9d8683ac6826af41bcf7223fb0389 *./tests/data/vsynth2/dv411.dv
-7200000 ./tests/data/vsynth2/dv411.dv
-7f9fa421028aabb11eaf4c6513a5a843 *./tests/data/dv_411.vsynth2.out.yuv
-stddev: 10.09 PSNR: 28.05 MAXDIFF: 60 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth2/error b/gst-libs/ext/libav/tests/ref/vsynth2/error
deleted file mode 100644
index 424c549..0000000
--- a/gst-libs/ext/libav/tests/ref/vsynth2/error
+++ /dev/null
@@ -1,4 +0,0 @@
-90e65096aa9ebafa3fe3f44a5a47cdc4 *./tests/data/vsynth2/error-mpeg4-adv.avi
- 176588 ./tests/data/vsynth2/error-mpeg4-adv.avi
-96baa9e4c24c837a3ba5abd8dd2cdd30 *./tests/data/error.vsynth2.out.yuv
-stddev: 8.98 PSNR: 29.06 MAXDIFF: 184 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth2/ffv1 b/gst-libs/ext/libav/tests/ref/vsynth2/ffv1
deleted file mode 100644
index d251af5..0000000
--- a/gst-libs/ext/libav/tests/ref/vsynth2/ffv1
+++ /dev/null
@@ -1,4 +0,0 @@
-d72b0960e162d4998b9acbabb07e99ab *./tests/data/vsynth2/ffv1.avi
-3525804 ./tests/data/vsynth2/ffv1.avi
-dde5895817ad9d219f79a52d0bdfb001 *./tests/data/ffv1.vsynth2.out.yuv
-stddev: 0.00 PSNR:999.99 MAXDIFF: 0 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth2/flashsv b/gst-libs/ext/libav/tests/ref/vsynth2/flashsv
deleted file mode 100644
index bfbb9e1..0000000
--- a/gst-libs/ext/libav/tests/ref/vsynth2/flashsv
+++ /dev/null
@@ -1,4 +0,0 @@
-0667077971e0cb63b5f49c580006e90e *./tests/data/vsynth2/flashsv.flv
-12368953 ./tests/data/vsynth2/flashsv.flv
-592b3321994e26a990deb3a0a1415de9 *./tests/data/flashsv.vsynth2.out.yuv
-stddev: 0.65 PSNR: 51.84 MAXDIFF: 14 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth2/flv b/gst-libs/ext/libav/tests/ref/vsynth2/flv
deleted file mode 100644
index 716177f..0000000
--- a/gst-libs/ext/libav/tests/ref/vsynth2/flv
+++ /dev/null
@@ -1,4 +0,0 @@
-2edc92093d36506bcc0a5c0e17e86113 *./tests/data/vsynth2/flv.flv
-131360 ./tests/data/vsynth2/flv.flv
-8999c8264fb0941561f64c4a736e9d88 *./tests/data/flv.vsynth2.out.yuv
-stddev: 5.33 PSNR: 33.59 MAXDIFF: 80 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth2/h261 b/gst-libs/ext/libav/tests/ref/vsynth2/h261
deleted file mode 100644
index 07c29ab..0000000
--- a/gst-libs/ext/libav/tests/ref/vsynth2/h261
+++ /dev/null
@@ -1,4 +0,0 @@
-dfd005d4c9030a0dc889c828a6408b9c *./tests/data/vsynth2/h261.avi
-191086 ./tests/data/vsynth2/h261.avi
-db7ceff174823b98834faa2320ca89ac *./tests/data/h261.vsynth2.out.yuv
-stddev: 6.37 PSNR: 32.03 MAXDIFF: 77 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth2/h263 b/gst-libs/ext/libav/tests/ref/vsynth2/h263
deleted file mode 100644
index 7e3fd33..0000000
--- a/gst-libs/ext/libav/tests/ref/vsynth2/h263
+++ /dev/null
@@ -1,4 +0,0 @@
-9a368687ab34c48079f11a202839a6bc *./tests/data/vsynth2/h263.avi
-160106 ./tests/data/vsynth2/h263.avi
-61213b91b359697ebcefb9e0a53ac54a *./tests/data/h263.vsynth2.out.yuv
-stddev: 5.43 PSNR: 33.42 MAXDIFF: 77 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth2/h263p b/gst-libs/ext/libav/tests/ref/vsynth2/h263p
deleted file mode 100644
index 314726f..0000000
--- a/gst-libs/ext/libav/tests/ref/vsynth2/h263p
+++ /dev/null
@@ -1,4 +0,0 @@
-c7644d40e9f40bbd98e5a978f9f94bb4 *./tests/data/vsynth2/h263p.avi
-868018 ./tests/data/vsynth2/h263p.avi
-4b0ee791f280029dc03c528f76f195d4 *./tests/data/h263p.vsynth2.out.yuv
-stddev: 1.91 PSNR: 42.50 MAXDIFF: 19 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth2/huffyuv b/gst-libs/ext/libav/tests/ref/vsynth2/huffyuv
deleted file mode 100644
index 740862a..0000000
--- a/gst-libs/ext/libav/tests/ref/vsynth2/huffyuv
+++ /dev/null
@@ -1,4 +0,0 @@
-56cd44907a48990e06bd065e189ff461 *./tests/data/vsynth2/huffyuv.avi
-6455232 ./tests/data/vsynth2/huffyuv.avi
-dde5895817ad9d219f79a52d0bdfb001 *./tests/data/huffyuv.vsynth2.out.yuv
-stddev: 0.00 PSNR:999.99 MAXDIFF: 0 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth2/jpegls b/gst-libs/ext/libav/tests/ref/vsynth2/jpegls
deleted file mode 100644
index e7fa2df..0000000
--- a/gst-libs/ext/libav/tests/ref/vsynth2/jpegls
+++ /dev/null
@@ -1,4 +0,0 @@
-4fc53937f048c900ae6d50fda9dba206 *./tests/data/vsynth2/jpegls.avi
-8334630 ./tests/data/vsynth2/jpegls.avi
-592b3321994e26a990deb3a0a1415de9 *./tests/data/jpegls.vsynth2.out.yuv
-stddev: 0.65 PSNR: 51.84 MAXDIFF: 14 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth2/ljpeg b/gst-libs/ext/libav/tests/ref/vsynth2/ljpeg
deleted file mode 100644
index 54c1d86..0000000
--- a/gst-libs/ext/libav/tests/ref/vsynth2/ljpeg
+++ /dev/null
@@ -1,4 +0,0 @@
-554a4a6a5a9058c588f8bf2de405bc70 *./tests/data/vsynth2/ljpeg.avi
-4766914 ./tests/data/vsynth2/ljpeg.avi
-dde5895817ad9d219f79a52d0bdfb001 *./tests/data/ljpeg.vsynth2.out.yuv
-stddev: 0.00 PSNR:999.99 MAXDIFF: 0 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth2/mjpeg b/gst-libs/ext/libav/tests/ref/vsynth2/mjpeg
deleted file mode 100644
index adee328..0000000
--- a/gst-libs/ext/libav/tests/ref/vsynth2/mjpeg
+++ /dev/null
@@ -1,4 +0,0 @@
-89df32b46c977fb4cb140ec6c489dd76 *./tests/data/vsynth2/mjpeg.avi
-673224 ./tests/data/vsynth2/mjpeg.avi
-a96a4e15ffcb13e44360df642d049496 *./tests/data/mjpeg.vsynth2.out.yuv
-stddev: 4.32 PSNR: 35.40 MAXDIFF: 49 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth2/mpeg b/gst-libs/ext/libav/tests/ref/vsynth2/mpeg
deleted file mode 100644
index 5a051c8..0000000
--- a/gst-libs/ext/libav/tests/ref/vsynth2/mpeg
+++ /dev/null
@@ -1,4 +0,0 @@
-73ca6f1deab02d1d67a0e8495c026a9e *./tests/data/vsynth2/mpeg1.mpg
-192783 ./tests/data/vsynth2/mpeg1.mpg
-56147e94b12f08df7213e610e177823d *./tests/data/mpeg.vsynth2.out.yuv
-stddev: 4.95 PSNR: 34.22 MAXDIFF: 57 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth2/mpeg1b b/gst-libs/ext/libav/tests/ref/vsynth2/mpeg1b
deleted file mode 100644
index f51aa3f..0000000
--- a/gst-libs/ext/libav/tests/ref/vsynth2/mpeg1b
+++ /dev/null
@@ -1,4 +0,0 @@
-e026a2fef80c9679776d2b5c8be09338 *./tests/data/vsynth2/mpeg1b.mpg
-225198 ./tests/data/vsynth2/mpeg1b.mpg
-1150495f4bd487486ee53326c42d0bb8 *./tests/data/mpeg1b.vsynth2.out.yuv
-stddev: 4.10 PSNR: 35.86 MAXDIFF: 59 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth2/mpeg2 b/gst-libs/ext/libav/tests/ref/vsynth2/mpeg2
deleted file mode 100644
index 5232eea..0000000
--- a/gst-libs/ext/libav/tests/ref/vsynth2/mpeg2
+++ /dev/null
@@ -1,4 +0,0 @@
-2d55ce623a7be4e8136f80266e487678 *./tests/data/vsynth2/mpeg2.mpg
-198667 ./tests/data/vsynth2/mpeg2.mpg
-b7cae8a1f751b821cddcbe4d5dbc518c *./tests/data/mpeg2.vsynth2.out.yuv
-stddev: 4.96 PSNR: 34.20 MAXDIFF: 59 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth2/mpeg2_422 b/gst-libs/ext/libav/tests/ref/vsynth2/mpeg2_422
deleted file mode 100644
index c4e28dd..0000000
--- a/gst-libs/ext/libav/tests/ref/vsynth2/mpeg2_422
+++ /dev/null
@@ -1,4 +0,0 @@
-2c8e33c2d2efab86fc16a195f6877682 *./tests/data/vsynth2/mpeg2_422.mpg
-356124 ./tests/data/vsynth2/mpeg2_422.mpg
-de44597c6c470f3e7019b31245a3ff69 *./tests/data/mpeg2_422.vsynth2.out.yuv
-stddev: 54.55 PSNR: 13.39 MAXDIFF: 201 bytes: 10137600/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth2/mpeg2_idct_int b/gst-libs/ext/libav/tests/ref/vsynth2/mpeg2_idct_int
deleted file mode 100644
index 9900497..0000000
--- a/gst-libs/ext/libav/tests/ref/vsynth2/mpeg2_idct_int
+++ /dev/null
@@ -1,4 +0,0 @@
-f979bcca866e6e4cad5dc6cb06e56cfb *./tests/data/vsynth2/mpeg2_idct_int.mpg
-198041 ./tests/data/vsynth2/mpeg2_idct_int.mpg
-f6d9bf24ff8676a7f6076c05cd2c81a3 *./tests/data/mpeg2_idct_int.vsynth2.out.yuv
-stddev: 4.97 PSNR: 34.19 MAXDIFF: 58 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth2/mpeg2_ilace b/gst-libs/ext/libav/tests/ref/vsynth2/mpeg2_ilace
deleted file mode 100644
index 99d80a4..0000000
--- a/gst-libs/ext/libav/tests/ref/vsynth2/mpeg2_ilace
+++ /dev/null
@@ -1,4 +0,0 @@
-f90197a8b6e62ae25f82625337f27240 *./tests/data/vsynth2/mpeg2i.mpg
-204579 ./tests/data/vsynth2/mpeg2i.mpg
-ea5057b60146c06d40449cdfc686bf13 *./tests/data/mpeg2_ilace.vsynth2.out.yuv
-stddev: 4.98 PSNR: 34.18 MAXDIFF: 65 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth2/mpeg2_ivlc_qprd b/gst-libs/ext/libav/tests/ref/vsynth2/mpeg2_ivlc_qprd
deleted file mode 100644
index d8aa1ab..0000000
--- a/gst-libs/ext/libav/tests/ref/vsynth2/mpeg2_ivlc_qprd
+++ /dev/null
@@ -1,4 +0,0 @@
-1ba5efeb53fab7b4b71edc96d86f6c91 *./tests/data/vsynth2/mpeg2ivlc-qprd.mpg
-244694 ./tests/data/vsynth2/mpeg2ivlc-qprd.mpg
-b26e21599dee48a174bdbc40b2817e55 *./tests/data/mpeg2_ivlc_qprd.vsynth2.out.yuv
-stddev: 4.15 PSNR: 35.76 MAXDIFF: 74 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth2/mpeg2thread b/gst-libs/ext/libav/tests/ref/vsynth2/mpeg2thread
deleted file mode 100644
index 7d7ed21..0000000
--- a/gst-libs/ext/libav/tests/ref/vsynth2/mpeg2thread
+++ /dev/null
@@ -1,4 +0,0 @@
-889c754a42d7689b228853e1ece6d345 *./tests/data/vsynth2/mpeg2thread.mpg
-179650 ./tests/data/vsynth2/mpeg2thread.mpg
-8c6a7ed2eb73bd18fd2bb9829464100d *./tests/data/mpeg2thread.vsynth2.out.yuv
-stddev: 4.72 PSNR: 34.65 MAXDIFF: 72 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth2/mpeg2thread_ilace b/gst-libs/ext/libav/tests/ref/vsynth2/mpeg2thread_ilace
deleted file mode 100644
index 1320db9..0000000
--- a/gst-libs/ext/libav/tests/ref/vsynth2/mpeg2thread_ilace
+++ /dev/null
@@ -1,4 +0,0 @@
-10b900e32809758857c596d56746e00e *./tests/data/vsynth2/mpeg2threadivlc.mpg
-178801 ./tests/data/vsynth2/mpeg2threadivlc.mpg
-8c6a7ed2eb73bd18fd2bb9829464100d *./tests/data/mpeg2thread_ilace.vsynth2.out.yuv
-stddev: 4.72 PSNR: 34.65 MAXDIFF: 72 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth2/mpeg4 b/gst-libs/ext/libav/tests/ref/vsynth2/mpeg4
deleted file mode 100644
index 8ccab86..0000000
--- a/gst-libs/ext/libav/tests/ref/vsynth2/mpeg4
+++ /dev/null
@@ -1,4 +0,0 @@
-8c9afbf564008a8ce6719cc3546deae1 *./tests/data/vsynth2/odivx.mp4
-119833 ./tests/data/vsynth2/odivx.mp4
-90a3577850239083a9042bef33c50e85 *./tests/data/mpeg4.vsynth2.out.yuv
-stddev: 5.34 PSNR: 33.57 MAXDIFF: 83 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth2/mpeg4_adap b/gst-libs/ext/libav/tests/ref/vsynth2/mpeg4_adap
deleted file mode 100644
index b7a07de..0000000
--- a/gst-libs/ext/libav/tests/ref/vsynth2/mpeg4_adap
+++ /dev/null
@@ -1,4 +0,0 @@
-547e1849dcf910935ff6383ca49e5706 *./tests/data/vsynth2/mpeg4-adap.avi
-198510 ./tests/data/vsynth2/mpeg4-adap.avi
-4affb83f6adc94f31024b4f9e0168945 *./tests/data/mpeg4_adap.vsynth2.out.yuv
-stddev: 3.75 PSNR: 36.65 MAXDIFF: 71 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth2/mpeg4_qpel b/gst-libs/ext/libav/tests/ref/vsynth2/mpeg4_qpel
deleted file mode 100644
index d1f4515..0000000
--- a/gst-libs/ext/libav/tests/ref/vsynth2/mpeg4_qpel
+++ /dev/null
@@ -1,4 +0,0 @@
-7680d2e7d34399dfdfb8a49cf1e10239 *./tests/data/vsynth2/mpeg4-Q.avi
-163688 ./tests/data/vsynth2/mpeg4-Q.avi
-26dc7c78955fa678fbf150e236eb5627 *./tests/data/mpeg4_qpel.vsynth2.out.yuv
-stddev: 3.97 PSNR: 36.14 MAXDIFF: 54 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth2/mpeg4_qprd b/gst-libs/ext/libav/tests/ref/vsynth2/mpeg4_qprd
deleted file mode 100644
index 17eec96..0000000
--- a/gst-libs/ext/libav/tests/ref/vsynth2/mpeg4_qprd
+++ /dev/null
@@ -1,4 +0,0 @@
-fd5ab0f55dbc959316e32923e86290df *./tests/data/vsynth2/mpeg4-qprd.avi
-231458 ./tests/data/vsynth2/mpeg4-qprd.avi
-de8a883865e2dff7a51f66da6c48df48 *./tests/data/mpeg4_qprd.vsynth2.out.yuv
-stddev: 3.71 PSNR: 36.72 MAXDIFF: 61 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth2/mpeg4adv b/gst-libs/ext/libav/tests/ref/vsynth2/mpeg4adv
deleted file mode 100644
index b47cbf1..0000000
--- a/gst-libs/ext/libav/tests/ref/vsynth2/mpeg4adv
+++ /dev/null
@@ -1,4 +0,0 @@
-dee7be19486a76d96c88d18eefba8f86 *./tests/data/vsynth2/mpeg4-adv.avi
-141546 ./tests/data/vsynth2/mpeg4-adv.avi
-3f3a21e9db85a9c0f7022f557a5374c1 *./tests/data/mpeg4adv.vsynth2.out.yuv
-stddev: 4.94 PSNR: 34.25 MAXDIFF: 69 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth2/mpeg4nr b/gst-libs/ext/libav/tests/ref/vsynth2/mpeg4nr
deleted file mode 100644
index ec36d27..0000000
--- a/gst-libs/ext/libav/tests/ref/vsynth2/mpeg4nr
+++ /dev/null
@@ -1,4 +0,0 @@
-c41187c99588fb7229ad330b2f80d28b *./tests/data/vsynth2/mpeg4-nr.avi
-155044 ./tests/data/vsynth2/mpeg4-nr.avi
-f7fc191308679f709405e62271f5c65f *./tests/data/mpeg4nr.vsynth2.out.yuv
-stddev: 4.73 PSNR: 34.63 MAXDIFF: 64 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth2/mpeg4thread b/gst-libs/ext/libav/tests/ref/vsynth2/mpeg4thread
deleted file mode 100644
index 63f355b..0000000
--- a/gst-libs/ext/libav/tests/ref/vsynth2/mpeg4thread
+++ /dev/null
@@ -1,4 +0,0 @@
-ba30d10ff70d46e7c5b7fa859ea1faa4 *./tests/data/vsynth2/mpeg4-thread.avi
-250140 ./tests/data/vsynth2/mpeg4-thread.avi
-5355deb8c7609a3f1ff2173aab1dee70 *./tests/data/mpeg4thread.vsynth2.out.yuv
-stddev: 3.69 PSNR: 36.78 MAXDIFF: 65 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth2/msmpeg4 b/gst-libs/ext/libav/tests/ref/vsynth2/msmpeg4
deleted file mode 100644
index 7620273..0000000
--- a/gst-libs/ext/libav/tests/ref/vsynth2/msmpeg4
+++ /dev/null
@@ -1,4 +0,0 @@
-26dee25a62a66daba4f38ac6bd8f4677 *./tests/data/vsynth2/msmpeg4.avi
-127680 ./tests/data/vsynth2/msmpeg4.avi
-0e1c6e25c71c6a8fa8e506e3d97ca4c9 *./tests/data/msmpeg4.vsynth2.out.yuv
-stddev: 5.33 PSNR: 33.59 MAXDIFF: 78 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth2/msmpeg4v2 b/gst-libs/ext/libav/tests/ref/vsynth2/msmpeg4v2
deleted file mode 100644
index 9fe913d..0000000
--- a/gst-libs/ext/libav/tests/ref/vsynth2/msmpeg4v2
+++ /dev/null
@@ -1,4 +0,0 @@
-c09815e40a9d260628e1ebad8b2b3774 *./tests/data/vsynth2/msmpeg4v2.avi
-129918 ./tests/data/vsynth2/msmpeg4v2.avi
-8920194f8bf8f9cdd6c65b3df9e1a292 *./tests/data/msmpeg4v2.vsynth2.out.yuv
-stddev: 5.33 PSNR: 33.59 MAXDIFF: 80 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth2/qtrle b/gst-libs/ext/libav/tests/ref/vsynth2/qtrle
deleted file mode 100644
index 5dd0425..0000000
--- a/gst-libs/ext/libav/tests/ref/vsynth2/qtrle
+++ /dev/null
@@ -1,4 +0,0 @@
-4805f35ca6e03b9279cc18f3f7356366 *./tests/data/vsynth2/qtrle.mov
-14798419 ./tests/data/vsynth2/qtrle.mov
-b2418e0e3a9a8619b31219cbcf24dc82 *./tests/data/qtrle.vsynth2.out.yuv
-stddev: 1.26 PSNR: 46.06 MAXDIFF: 13 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth2/rc b/gst-libs/ext/libav/tests/ref/vsynth2/rc
deleted file mode 100644
index 14d9a6c..0000000
--- a/gst-libs/ext/libav/tests/ref/vsynth2/rc
+++ /dev/null
@@ -1,4 +0,0 @@
-c25ede9e268b834a09a63f5136cd1b95 *./tests/data/vsynth2/mpeg4-rc.avi
-226332 ./tests/data/vsynth2/mpeg4-rc.avi
-2b34e606af895b62a250de98749a19b0 *./tests/data/rc.vsynth2.out.yuv
-stddev: 4.23 PSNR: 35.60 MAXDIFF: 85 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth2/rgb b/gst-libs/ext/libav/tests/ref/vsynth2/rgb
deleted file mode 100644
index ea83470..0000000
--- a/gst-libs/ext/libav/tests/ref/vsynth2/rgb
+++ /dev/null
@@ -1,4 +0,0 @@
-f2e9c419023c743bf99aa5b2e55ad233 *./tests/data/vsynth2/rgb.avi
-15213260 ./tests/data/vsynth2/rgb.avi
-b2418e0e3a9a8619b31219cbcf24dc82 *./tests/data/rgb.vsynth2.out.yuv
-stddev: 1.26 PSNR: 46.06 MAXDIFF: 13 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth2/roq b/gst-libs/ext/libav/tests/ref/vsynth2/roq
deleted file mode 100644
index a9650de..0000000
--- a/gst-libs/ext/libav/tests/ref/vsynth2/roq
+++ /dev/null
@@ -1,4 +0,0 @@
-b46f899b2363065c60f3782ba1f8b7bd *./tests/data/vsynth2/roqav.roq
-92786 ./tests/data/vsynth2/roqav.roq
-e69fca960dd0911e9b8d589c13e11dc1 *./tests/data/roq.vsynth2.out.yuv
-stddev: 3.81 PSNR: 36.49 MAXDIFF: 54 bytes: 760320/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth2/rv10 b/gst-libs/ext/libav/tests/ref/vsynth2/rv10
deleted file mode 100644
index 75b9265..0000000
--- a/gst-libs/ext/libav/tests/ref/vsynth2/rv10
+++ /dev/null
@@ -1,4 +0,0 @@
-b1467b0e8d8cad730e36d1e8ab49d573 *./tests/data/vsynth2/rv10.rm
-154310 ./tests/data/vsynth2/rv10.rm
-61213b91b359697ebcefb9e0a53ac54a *./tests/data/rv10.vsynth2.out.yuv
-stddev: 5.43 PSNR: 33.42 MAXDIFF: 77 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth2/rv20 b/gst-libs/ext/libav/tests/ref/vsynth2/rv20
deleted file mode 100644
index 903881f..0000000
--- a/gst-libs/ext/libav/tests/ref/vsynth2/rv20
+++ /dev/null
@@ -1,4 +0,0 @@
-96acb098850b9bf309f89e48b08fe96f *./tests/data/vsynth2/rv20.rm
-153302 ./tests/data/vsynth2/rv20.rm
-46f314e70d9bac2e7d82cfc230534977 *./tests/data/rv20.vsynth2.out.yuv
-stddev: 5.48 PSNR: 33.35 MAXDIFF: 81 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth2/snow b/gst-libs/ext/libav/tests/ref/vsynth2/snow
deleted file mode 100644
index 922110b..0000000
--- a/gst-libs/ext/libav/tests/ref/vsynth2/snow
+++ /dev/null
@@ -1,4 +0,0 @@
-af651d8ef0a66257ac8b2ef8b229f27b *./tests/data/vsynth2/snow.avi
-57700 ./tests/data/vsynth2/snow.avi
-8890189af71a0dd3447c4e8424c9a76b *./tests/data/snow.vsynth2.out.yuv
-stddev: 10.47 PSNR: 27.72 MAXDIFF: 119 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth2/snowll b/gst-libs/ext/libav/tests/ref/vsynth2/snowll
deleted file mode 100644
index 0eb4945..0000000
--- a/gst-libs/ext/libav/tests/ref/vsynth2/snowll
+++ /dev/null
@@ -1,4 +0,0 @@
-a8fccf278bbb17d37a756ecf11672b09 *./tests/data/vsynth2/snow53.avi
-2721758 ./tests/data/vsynth2/snow53.avi
-dde5895817ad9d219f79a52d0bdfb001 *./tests/data/snowll.vsynth2.out.yuv
-stddev: 0.00 PSNR:999.99 MAXDIFF: 0 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth2/svq1 b/gst-libs/ext/libav/tests/ref/vsynth2/svq1
deleted file mode 100644
index 8adca64..0000000
--- a/gst-libs/ext/libav/tests/ref/vsynth2/svq1
+++ /dev/null
@@ -1,4 +0,0 @@
-138ad38281570f1a3b68d63ed896435d *./tests/data/vsynth2/svq1.mov
-766851 ./tests/data/vsynth2/svq1.mov
-aa03471dac3f49455a33a2b19fda1098 *./tests/data/svq1.vsynth2.out.yuv
-stddev: 3.23 PSNR: 37.93 MAXDIFF: 61 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth2/v210 b/gst-libs/ext/libav/tests/ref/vsynth2/v210
deleted file mode 100644
index 31160bd..0000000
--- a/gst-libs/ext/libav/tests/ref/vsynth2/v210
+++ /dev/null
@@ -1,4 +0,0 @@
-db0579bd46e1ba133ff86c0f7cdd761f *./tests/data/vsynth2/v210.avi
-14752460 ./tests/data/vsynth2/v210.avi
-a627fb50c8276200fd71383977d87ca3 *./tests/data/v210.vsynth2.out.yuv
-stddev: 0.34 PSNR: 57.43 MAXDIFF: 6 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth2/vref b/gst-libs/ext/libav/tests/ref/vsynth2/vref
deleted file mode 100644
index 8f83b6c..0000000
--- a/gst-libs/ext/libav/tests/ref/vsynth2/vref
+++ /dev/null
@@ -1,2 +0,0 @@
-dde5895817ad9d219f79a52d0bdfb001 *./tests/data/vsynth2.ref.yuv
-7603200 ./tests/data/vsynth2.ref.yuv
diff --git a/gst-libs/ext/libav/tests/ref/vsynth2/wmv1 b/gst-libs/ext/libav/tests/ref/vsynth2/wmv1
deleted file mode 100644
index 12c3f57..0000000
--- a/gst-libs/ext/libav/tests/ref/vsynth2/wmv1
+++ /dev/null
@@ -1,4 +0,0 @@
-1011e26e7d351c96d7bbfe106d831b69 *./tests/data/vsynth2/wmv1.avi
-129530 ./tests/data/vsynth2/wmv1.avi
-81eee429b665254d19a06607463c0b5e *./tests/data/wmv1.vsynth2.out.yuv
-stddev: 5.33 PSNR: 33.60 MAXDIFF: 77 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth2/wmv2 b/gst-libs/ext/libav/tests/ref/vsynth2/wmv2
deleted file mode 100644
index 27fcd12..0000000
--- a/gst-libs/ext/libav/tests/ref/vsynth2/wmv2
+++ /dev/null
@@ -1,4 +0,0 @@
-1f6598e9776ed00aebdc44cc8d48cb7c *./tests/data/vsynth2/wmv2.avi
-129860 ./tests/data/vsynth2/wmv2.avi
-81eee429b665254d19a06607463c0b5e *./tests/data/wmv2.vsynth2.out.yuv
-stddev: 5.33 PSNR: 33.60 MAXDIFF: 77 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/ref/vsynth2/yuv b/gst-libs/ext/libav/tests/ref/vsynth2/yuv
deleted file mode 100644
index 6593ce9..0000000
--- a/gst-libs/ext/libav/tests/ref/vsynth2/yuv
+++ /dev/null
@@ -1,4 +0,0 @@
-30a400773ab26f2c83e469198b156f1d *./tests/data/vsynth2/yuv.avi
-7610060 ./tests/data/vsynth2/yuv.avi
-dde5895817ad9d219f79a52d0bdfb001 *./tests/data/yuv.vsynth2.out.yuv
-stddev: 0.00 PSNR:999.99 MAXDIFF: 0 bytes: 7603200/ 7603200
diff --git a/gst-libs/ext/libav/tests/regression-funcs.sh b/gst-libs/ext/libav/tests/regression-funcs.sh
index 6d23fa3..ce5aee8 100755
--- a/gst-libs/ext/libav/tests/regression-funcs.sh
+++ b/gst-libs/ext/libav/tests/regression-funcs.sh
@@ -10,6 +10,7 @@ raw_src_dir=$3
target_exec=$4
target_path=$5
threads=${6:-1}
+cpuflags=${8:-all}
datadir="./tests/data"
target_datadir="${target_path}/${datadir}"
@@ -19,17 +20,13 @@ outfile="$datadir/$test_ref/"
# various files
avconv="$target_exec ${target_path}/avconv"
-tiny_psnr="tests/tiny_psnr"
raw_src="${target_path}/$raw_src_dir/%02d.pgm"
raw_dst="$datadir/$this.out.yuv"
-raw_ref="$datadir/$test_ref.ref.yuv"
pcm_src="$target_datadir/asynth1.sw"
-pcm_dst="$datadir/$this.out.wav"
-pcm_ref="$datadir/$test_ref.ref.wav"
crcfile="$datadir/$this.crc"
target_crcfile="$target_datadir/$this.crc"
-cleanfiles="$raw_dst $pcm_dst $crcfile"
+cleanfiles="$raw_dst $crcfile"
trap 'rm -f -- $cleanfiles' EXIT
mkdir -p "$datadir"
@@ -43,7 +40,7 @@ echov(){
. $(dirname $0)/md5.sh
-AVCONV_OPTS="-nostats -y"
+AVCONV_OPTS="-nostats -y -cpuflags $cpuflags"
COMMON_OPTS="-flags +bitexact -idct simple -sws_flags +accurate_rnd+bitexact"
DEC_OPTS="$COMMON_OPTS -threads $threads"
ENC_OPTS="$COMMON_OPTS -threads 1 -dct fastint"
@@ -61,28 +58,7 @@ do_avconv()
set -- $* ${target_path}/$f
run_avconv $*
do_md5sum $f
- if [ $f = $raw_dst ] ; then
- $tiny_psnr $f $raw_ref
- elif [ $f = $pcm_dst ] ; then
- $tiny_psnr $f $pcm_ref 2
- else
- wc -c $f
- fi
-}
-
-do_avconv_nomd5()
-{
- f="$1"
- shift
- set -- $* ${target_path}/$f
- run_avconv $*
- if [ $f = $raw_dst ] ; then
- $tiny_psnr $f $raw_ref
- elif [ $f = $pcm_dst ] ; then
- $tiny_psnr $f $pcm_ref 2
- else
- wc -c $f
- fi
+ echo $(wc -c $f)
}
do_avconv_crc()
@@ -92,25 +68,3 @@ do_avconv_crc()
run_avconv $* -f crc "$target_crcfile"
echo "$f $(cat $crcfile)"
}
-
-do_video_decoding()
-{
- do_avconv $raw_dst $DEC_OPTS $1 -i $target_path/$file -f rawvideo $ENC_OPTS -vsync 0 $2
-}
-
-do_video_encoding()
-{
- file=${outfile}$1
- do_avconv $file $DEC_OPTS -f image2 -vcodec pgmyuv -i $raw_src $ENC_OPTS $2
-}
-
-do_audio_encoding()
-{
- file=${outfile}$1
- do_avconv $file $DEC_OPTS -ac 2 -ar 44100 -f s16le -i $pcm_src -ab 128k $ENC_OPTS $2
-}
-
-do_audio_decoding()
-{
- do_avconv $pcm_dst $DEC_OPTS -i $target_path/$file -sample_fmt s16 -f wav
-}
diff --git a/gst-libs/ext/libav/tests/rotozoom.c b/gst-libs/ext/libav/tests/rotozoom.c
index 9ce45cd..69c88c2 100644
--- a/gst-libs/ext/libav/tests/rotozoom.c
+++ b/gst-libs/ext/libav/tests/rotozoom.c
@@ -24,6 +24,8 @@
#include <stdio.h>
#include <inttypes.h>
+#include "utils.c"
+
#define FIXP (1 << 16)
#define MY_PI 205887 // (M_PI * FIX)
@@ -53,136 +55,12 @@ static int64_t int_sin(int64_t a)
return a - int_pow(a, 3) / 6 + int_pow(a, 5) / 120 - int_pow(a, 7) / 5040;
}
-#define SCALEBITS 8
-#define ONE_HALF (1 << (SCALEBITS - 1))
-#define FIX(x) ((int) ((x) * (1L << SCALEBITS) + 0.5))
-
-static void rgb24_to_yuv420p(unsigned char *lum, unsigned char *cb,
- unsigned char *cr, unsigned char *src,
- int width, int height)
-{
- int wrap, wrap3, x, y;
- int r, g, b, r1, g1, b1;
- unsigned char *p;
-
- wrap = width;
- wrap3 = width * 3;
- p = src;
- for (y = 0; y < height; y += 2) {
- for (x = 0; x < width; x += 2) {
- r = p[0];
- g = p[1];
- b = p[2];
- r1 = r;
- g1 = g;
- b1 = b;
- lum[0] = (FIX(0.29900) * r + FIX(0.58700) * g +
- FIX(0.11400) * b + ONE_HALF) >> SCALEBITS;
- r = p[3];
- g = p[4];
- b = p[5];
- r1 += r;
- g1 += g;
- b1 += b;
- lum[1] = (FIX(0.29900) * r + FIX(0.58700) * g +
- FIX(0.11400) * b + ONE_HALF) >> SCALEBITS;
- p += wrap3;
- lum += wrap;
-
- r = p[0];
- g = p[1];
- b = p[2];
- r1 += r;
- g1 += g;
- b1 += b;
- lum[0] = (FIX(0.29900) * r + FIX(0.58700) * g +
- FIX(0.11400) * b + ONE_HALF) >> SCALEBITS;
- r = p[3];
- g = p[4];
- b = p[5];
- r1 += r;
- g1 += g;
- b1 += b;
- lum[1] = (FIX(0.29900) * r + FIX(0.58700) * g +
- FIX(0.11400) * b + ONE_HALF) >> SCALEBITS;
-
- cb[0] = ((- FIX(0.16874) * r1 - FIX(0.33126) * g1 +
- FIX(0.50000) * b1 + 4 * ONE_HALF - 1) >> (SCALEBITS + 2)) + 128;
- cr[0] = ((FIX(0.50000) * r1 - FIX(0.41869) * g1 -
- FIX(0.08131) * b1 + 4 * ONE_HALF - 1) >> (SCALEBITS + 2)) + 128;
-
- cb++;
- cr++;
- p += -wrap3 + 2 * 3;
- lum += -wrap + 2;
- }
- p += wrap3;
- lum += wrap;
- }
-}
+static unsigned char tab_r[256 * 256];
+static unsigned char tab_g[256 * 256];
+static unsigned char tab_b[256 * 256];
-/* cif format */
-#define DEFAULT_WIDTH 352
-#define DEFAULT_HEIGHT 288
-#define DEFAULT_NB_PICT 50
-
-static void pgmyuv_save(const char *filename, int w, int h,
- unsigned char *rgb_tab)
-{
- FILE *f;
- int i, h2, w2;
- unsigned char *cb, *cr;
- unsigned char *lum_tab, *cb_tab, *cr_tab;
-
- lum_tab = malloc(w * h);
- cb_tab = malloc(w * h / 4);
- cr_tab = malloc(w * h / 4);
-
- rgb24_to_yuv420p(lum_tab, cb_tab, cr_tab, rgb_tab, w, h);
-
- f = fopen(filename, "wb");
- fprintf(f, "P5\n%d %d\n%d\n", w, h * 3 / 2, 255);
- fwrite(lum_tab, 1, w * h, f);
- h2 = h / 2;
- w2 = w / 2;
- cb = cb_tab;
- cr = cr_tab;
- for (i = 0; i < h2; i++) {
- fwrite(cb, 1, w2, f);
- fwrite(cr, 1, w2, f);
- cb += w2;
- cr += w2;
- }
- fclose(f);
-
- free(lum_tab);
- free(cb_tab);
- free(cr_tab);
-}
-
-unsigned char *rgb_tab;
-int width, height, wrap;
-
-static void put_pixel(int x, int y, int r, int g, int b)
-{
- unsigned char *p;
-
- if (x < 0 || x >= width ||
- y < 0 || y >= height)
- return;
-
- p = rgb_tab + y * wrap + x * 3;
- p[0] = r;
- p[1] = g;
- p[2] = b;
-}
-
-unsigned char tab_r[256 * 256];
-unsigned char tab_g[256 * 256];
-unsigned char tab_b[256 * 256];
-
-int h_cos[360];
-int h_sin[360];
+static int h_cos[360];
+static int h_sin[360];
static int ipol(uint8_t *src, int x, int y)
{
@@ -280,13 +158,17 @@ int main(int argc, char **argv)
{
int w, h, i;
char buf[1024];
+ int isdir = 0;
if (argc != 3) {
- printf("usage: %s directory/ image.pnm\n"
+ printf("usage: %s image.pnm file|dir\n"
"generate a test video stream\n", argv[0]);
return 1;
}
+ if (!freopen(argv[2], "wb", stdout))
+ isdir = 1;
+
w = DEFAULT_WIDTH;
h = DEFAULT_HEIGHT;
@@ -295,13 +177,17 @@ int main(int argc, char **argv)
width = w;
height = h;
- if (init_demo(argv[2]))
+ if (init_demo(argv[1]))
return 1;
for (i = 0; i < DEFAULT_NB_PICT; i++) {
- snprintf(buf, sizeof(buf), "%s%02d.pgm", argv[1], i);
gen_image(i, w, h);
- pgmyuv_save(buf, w, h, rgb_tab);
+ if (isdir) {
+ snprintf(buf, sizeof(buf), "%s%02d.pgm", argv[2], i);
+ pgmyuv_save(buf, w, h, rgb_tab);
+ } else {
+ pgmyuv_save(NULL, w, h, rgb_tab);
+ }
}
free(rgb_tab);
diff --git a/gst-libs/ext/libav/tests/tiny_psnr.c b/gst-libs/ext/libav/tests/tiny_psnr.c
index 1583f2c..b1bcc16 100644
--- a/gst-libs/ext/libav/tests/tiny_psnr.c
+++ b/gst-libs/ext/libav/tests/tiny_psnr.c
@@ -24,6 +24,8 @@
#include <inttypes.h>
#include <assert.h>
+#include "libavutil/intfloat.h"
+
#define FFMIN(a, b) ((a) > (b) ? (b) : (a))
#define F 100
#define SIZE 2048
@@ -88,6 +90,23 @@ static uint64_t int_sqrt(uint64_t a)
return ret;
}
+static int16_t get_s16l(uint8_t *p)
+{
+ union {
+ uint16_t u;
+ int16_t s;
+ } v;
+ v.u = p[0] | p[1] << 8;
+ return v.s;
+}
+
+static float get_f32l(uint8_t *p)
+{
+ union av_intfloat32 v;
+ v.i = p[0] | p[1] << 8 | p[2] << 16 | p[3] << 24;
+ return v.f;
+}
+
int main(int argc, char *argv[])
{
int i, j;
@@ -96,8 +115,8 @@ int main(int argc, char *argv[])
FILE *f[2];
uint8_t buf[2][SIZE];
uint64_t psnr;
- int len = argc < 4 ? 1 : atoi(argv[3]);
- int64_t max = (1 << (8 * len)) - 1;
+ int len = 1;
+ int64_t max;
int shift = argc < 5 ? 0 : atoi(argv[4]);
int skip_bytes = argc < 6 ? 0 : atoi(argv[5]);
int size0 = 0;
@@ -110,6 +129,25 @@ int main(int argc, char *argv[])
return 1;
}
+ if (argc > 3) {
+ if (!strcmp(argv[3], "u8")) {
+ len = 1;
+ } else if (!strcmp(argv[3], "s16")) {
+ len = 2;
+ } else if (!strcmp(argv[3], "f32")) {
+ len = 4;
+ } else {
+ char *end;
+ len = strtol(argv[3], &end, 0);
+ if (*end || len < 1 || len > 2) {
+ fprintf(stderr, "Unsupported sample format: %s\n", argv[3]);
+ return 1;
+ }
+ }
+ }
+
+ max = (1LL << (8 * len)) - 1;
+
f[0] = fopen(argv[1], "rb");
f[1] = fopen(argv[2], "rb");
if (!f[0] || !f[1]) {
@@ -145,13 +183,19 @@ int main(int argc, char *argv[])
int s0 = fread(buf[0], 1, SIZE, f[0]);
int s1 = fread(buf[1], 1, SIZE, f[1]);
- for (j = 0; j < FFMIN(s0, s1); j++) {
+ for (j = 0; j < FFMIN(s0, s1); j += len) {
int64_t a = buf[0][j];
int64_t b = buf[1][j];
int dist;
if (len == 2) {
- a = (int16_t)(a | (buf[0][++j] << 8));
- b = (int16_t)(b | (buf[1][ j] << 8));
+ a = get_s16l(buf[0] + j);
+ b = get_s16l(buf[1] + j);
+ } else if (len == 4) {
+ a = get_f32l(buf[0] + j) * (1 << 24);
+ b = get_f32l(buf[1] + j) * (1 << 24);
+ } else {
+ a = buf[0][j];
+ b = buf[1][j];
}
sse += (a - b) * (a - b);
dist = abs(a - b);
diff --git a/gst-libs/ext/libav/tests/utils.c b/gst-libs/ext/libav/tests/utils.c
new file mode 100644
index 0000000..2fdc491
--- /dev/null
+++ b/gst-libs/ext/libav/tests/utils.c
@@ -0,0 +1,170 @@
+/*
+ * 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
+ */
+
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#define SCALEBITS 8
+#define ONE_HALF (1 << (SCALEBITS - 1))
+#define FIX(x) ((int) ((x) * (1L << SCALEBITS) + 0.5))
+
+#define err_if(expr) do { \
+ if (expr) { \
+ fprintf(stderr, "%s\n", strerror(errno)); \
+ exit(1); \
+ } \
+} while (0)
+
+static void rgb24_to_yuv420p(unsigned char *lum, unsigned char *cb,
+ unsigned char *cr, unsigned char *src,
+ int width, int height)
+{
+ int wrap, wrap3, x, y;
+ int r, g, b, r1, g1, b1;
+ unsigned char *p;
+
+ wrap = width;
+ wrap3 = width * 3;
+ p = src;
+ for (y = 0; y < height; y += 2) {
+ for (x = 0; x < width; x += 2) {
+ r = p[0];
+ g = p[1];
+ b = p[2];
+ r1 = r;
+ g1 = g;
+ b1 = b;
+ lum[0] = (FIX(0.29900) * r + FIX(0.58700) * g +
+ FIX(0.11400) * b + ONE_HALF) >> SCALEBITS;
+ r = p[3];
+ g = p[4];
+ b = p[5];
+ r1 += r;
+ g1 += g;
+ b1 += b;
+ lum[1] = (FIX(0.29900) * r + FIX(0.58700) * g +
+ FIX(0.11400) * b + ONE_HALF) >> SCALEBITS;
+ p += wrap3;
+ lum += wrap;
+
+ r = p[0];
+ g = p[1];
+ b = p[2];
+ r1 += r;
+ g1 += g;
+ b1 += b;
+ lum[0] = (FIX(0.29900) * r + FIX(0.58700) * g +
+ FIX(0.11400) * b + ONE_HALF) >> SCALEBITS;
+ r = p[3];
+ g = p[4];
+ b = p[5];
+ r1 += r;
+ g1 += g;
+ b1 += b;
+ lum[1] = (FIX(0.29900) * r + FIX(0.58700) * g +
+ FIX(0.11400) * b + ONE_HALF) >> SCALEBITS;
+
+ cb[0] = ((- FIX(0.16874) * r1 - FIX(0.33126) * g1 +
+ FIX(0.50000) * b1 + 4 * ONE_HALF - 1) >> (SCALEBITS + 2)) + 128;
+ cr[0] = ((FIX(0.50000) * r1 - FIX(0.41869) * g1 -
+ FIX(0.08131) * b1 + 4 * ONE_HALF - 1) >> (SCALEBITS + 2)) + 128;
+
+ cb++;
+ cr++;
+ p += -wrap3 + 2 * 3;
+ lum += -wrap + 2;
+ }
+ p += wrap3;
+ lum += wrap;
+ }
+}
+
+/* cif format */
+#define DEFAULT_WIDTH 352
+#define DEFAULT_HEIGHT 288
+#define DEFAULT_NB_PICT 50
+
+static void pgmyuv_save(const char *filename, int w, int h,
+ unsigned char *rgb_tab)
+{
+ FILE *f;
+ int i, h2, w2;
+ unsigned char *cb, *cr;
+ unsigned char *lum_tab, *cb_tab, *cr_tab;
+
+ lum_tab = malloc(w * h);
+ cb_tab = malloc(w * h / 4);
+ cr_tab = malloc(w * h / 4);
+
+ rgb24_to_yuv420p(lum_tab, cb_tab, cr_tab, rgb_tab, w, h);
+
+ if (filename) {
+ f = fopen(filename, "wb");
+ fprintf(f, "P5\n%d %d\n%d\n", w, h * 3 / 2, 255);
+ } else {
+ f = stdout;
+ }
+
+ err_if(fwrite(lum_tab, 1, w * h, f) != w * h);
+ h2 = h / 2;
+ w2 = w / 2;
+ cb = cb_tab;
+ cr = cr_tab;
+
+ if (filename) {
+ for (i = 0; i < h2; i++) {
+ err_if(fwrite(cb, 1, w2, f) != w2);
+ err_if(fwrite(cr, 1, w2, f) != w2);
+ cb += w2;
+ cr += w2;
+ }
+ fclose(f);
+ } else {
+ for (i = 0; i < h2; i++) {
+ err_if(fwrite(cb, 1, w2, f) != w2);
+ cb += w2;
+ }
+ for (i = 0; i < h2; i++) {
+ err_if(fwrite(cr, 1, w2, f) != w2);
+ cr += w2;
+ }
+ }
+
+ free(lum_tab);
+ free(cb_tab);
+ free(cr_tab);
+}
+
+static unsigned char *rgb_tab;
+static int width, height, wrap;
+
+static void put_pixel(int x, int y, int r, int g, int b)
+{
+ unsigned char *p;
+
+ if (x < 0 || x >= width ||
+ y < 0 || y >= height)
+ return;
+
+ p = rgb_tab + y * wrap + x * 3;
+ p[0] = r;
+ p[1] = g;
+ p[2] = b;
+}
diff --git a/gst-libs/ext/libav/tests/videogen.c b/gst-libs/ext/libav/tests/videogen.c
index 1aad700..0b7f67e 100644
--- a/gst-libs/ext/libav/tests/videogen.c
+++ b/gst-libs/ext/libav/tests/videogen.c
@@ -25,134 +25,7 @@
#include <stdint.h>
#include <stdio.h>
-#define SCALEBITS 8
-#define ONE_HALF (1 << (SCALEBITS - 1))
-#define FIX(x) ((int) ((x) * (1L << SCALEBITS) + 0.5))
-
-static void rgb24_to_yuv420p(uint8_t *lum, uint8_t *cb, uint8_t *cr,
- uint8_t *src, int width, int height)
-{
- int wrap, wrap3, x, y;
- int r, g, b, r1, g1, b1;
- uint8_t *p;
-
- wrap = width;
- wrap3 = width * 3;
- p = src;
- for (y = 0; y < height; y += 2) {
- for (x = 0; x < width; x += 2) {
- r = p[0];
- g = p[1];
- b = p[2];
- r1 = r;
- g1 = g;
- b1 = b;
- lum[0] = (FIX(0.29900) * r + FIX(0.58700) * g +
- FIX(0.11400) * b + ONE_HALF) >> SCALEBITS;
- r = p[3];
- g = p[4];
- b = p[5];
- r1 += r;
- g1 += g;
- b1 += b;
- lum[1] = (FIX(0.29900) * r + FIX(0.58700) * g +
- FIX(0.11400) * b + ONE_HALF) >> SCALEBITS;
- p += wrap3;
- lum += wrap;
-
- r = p[0];
- g = p[1];
- b = p[2];
- r1 += r;
- g1 += g;
- b1 += b;
- lum[0] = (FIX(0.29900) * r + FIX(0.58700) * g +
- FIX(0.11400) * b + ONE_HALF) >> SCALEBITS;
- r = p[3];
- g = p[4];
- b = p[5];
- r1 += r;
- g1 += g;
- b1 += b;
- lum[1] = (FIX(0.29900) * r + FIX(0.58700) * g +
- FIX(0.11400) * b + ONE_HALF) >> SCALEBITS;
-
- cb[0] = 128 + ((- FIX(0.16874) * r1 -
- FIX(0.33126) * g1 +
- FIX(0.50000) * b1 +
- 4 * ONE_HALF - 1)
- >> (SCALEBITS + 2));
- cr[0] = 128 + ((FIX(0.50000) * r1 -
- FIX(0.41869) * g1 -
- FIX(0.08131) * b1 +
- 4 * ONE_HALF - 1)
- >> (SCALEBITS + 2));
-
- cb++;
- cr++;
- p += -wrap3 + 2 * 3;
- lum += -wrap + 2;
- }
- p += wrap3;
- lum += wrap;
- }
-}
-
-/* cif format */
-#define DEFAULT_WIDTH 352
-#define DEFAULT_HEIGHT 288
-#define DEFAULT_NB_PICT 50 /* 2 seconds */
-
-static void pgmyuv_save(const char *filename, int w, int h,
- unsigned char *rgb_tab)
-{
- FILE *f;
- int i, h2, w2;
- unsigned char *cb, *cr;
- unsigned char *lum_tab, *cb_tab, *cr_tab;
-
- lum_tab = malloc(w * h);
- cb_tab = malloc((w * h) / 4);
- cr_tab = malloc((w * h) / 4);
-
- rgb24_to_yuv420p(lum_tab, cb_tab, cr_tab, rgb_tab, w, h);
-
- f = fopen(filename, "wb");
- fprintf(f, "P5\n%d %d\n%d\n", w, (h * 3) / 2, 255);
- fwrite(lum_tab, 1, w * h, f);
- h2 = h / 2;
- w2 = w / 2;
- cb = cb_tab;
- cr = cr_tab;
- for (i = 0; i < h2; i++) {
- fwrite(cb, 1, w2, f);
- fwrite(cr, 1, w2, f);
- cb += w2;
- cr += w2;
- }
- fclose(f);
-
- free(lum_tab);
- free(cb_tab);
- free(cr_tab);
-}
-
-unsigned char *rgb_tab;
-int width, height, wrap;
-
-static void put_pixel(int x, int y, int r, int g, int b)
-{
- unsigned char *p;
-
- if (x < 0 || x >= width ||
- y < 0 || y >= height)
- return;
-
- p = rgb_tab + y * wrap + x * 3;
- p[0] = r;
- p[1] = g;
- p[2] = b;
-}
+#include "utils.c"
static unsigned int myrnd(unsigned int *seed_ptr, int n)
{
@@ -200,9 +73,9 @@ typedef struct VObj {
int r, g, b;
} VObj;
-VObj objs[NB_OBJS];
+static VObj objs[NB_OBJS];
-unsigned int seed = 1;
+static unsigned int seed = 1;
static void gen_image(int num, int w, int h)
{
@@ -272,13 +145,17 @@ int main(int argc, char **argv)
{
int w, h, i;
char buf[1024];
+ int isdir = 0;
if (argc != 2) {
- printf("usage: %s file\n"
+ printf("usage: %s file|dir\n"
"generate a test video stream\n", argv[0]);
exit(1);
}
+ if (!freopen(argv[1], "wb", stdout))
+ isdir = 1;
+
w = DEFAULT_WIDTH;
h = DEFAULT_HEIGHT;
@@ -288,9 +165,13 @@ int main(int argc, char **argv)
height = h;
for (i = 0; i < DEFAULT_NB_PICT; i++) {
- snprintf(buf, sizeof(buf), "%s%02d.pgm", argv[1], i);
gen_image(i, w, h);
- pgmyuv_save(buf, w, h, rgb_tab);
+ if (isdir) {
+ snprintf(buf, sizeof(buf), "%s%02d.pgm", argv[1], i);
+ pgmyuv_save(buf, w, h, rgb_tab);
+ } else {
+ pgmyuv_save(NULL, w, h, rgb_tab);
+ }
}
free(rgb_tab);
diff --git a/gst-libs/ext/libav/tools/aviocat.c b/gst-libs/ext/libav/tools/aviocat.c
index 92483c3..52a96bd 100644
--- a/gst-libs/ext/libav/tools/aviocat.c
+++ b/gst-libs/ext/libav/tools/aviocat.c
@@ -20,7 +20,8 @@
#include <stdio.h>
#include <stdlib.h>
-#include <unistd.h>
+
+#include "libavutil/time.h"
#include "libavformat/avformat.h"
static int usage(const char *argv0, int ret)
@@ -80,13 +81,14 @@ int main(int argc, char **argv)
stream_pos += n;
if (bps) {
avio_flush(output);
- while ((av_gettime() - start_time)*bps/AV_TIME_BASE < stream_pos)
- usleep(50*1000);
+ while ((av_gettime() - start_time) * bps / AV_TIME_BASE < stream_pos)
+ av_usleep(50 * 1000);
}
}
avio_flush(output);
avio_close(output);
+
fail:
avio_close(input);
avformat_network_deinit();
diff --git a/gst-libs/ext/libav/tools/cws2fws.c b/gst-libs/ext/libav/tools/cws2fws.c
index 35fce35..74588c1 100644
--- a/gst-libs/ext/libav/tools/cws2fws.c
+++ b/gst-libs/ext/libav/tools/cws2fws.c
@@ -6,11 +6,17 @@
* This utility converts compressed Macromedia Flash files to uncompressed ones.
*/
+#include "config.h"
#include <sys/stat.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
+#if HAVE_UNISTD_H
#include <unistd.h>
+#endif
+#if HAVE_IO_H
+#include <io.h>
+#endif
#include <zlib.h>
#ifdef DEBUG
@@ -26,46 +32,42 @@ int main(int argc, char *argv[])
z_stream zstream;
struct stat statbuf;
- if (argc < 3)
- {
+ if (argc < 3) {
printf("Usage: %s <infile.swf> <outfile.swf>\n", argv[0]);
return 1;
}
fd_in = open(argv[1], O_RDONLY);
- if (fd_in < 0)
- {
+ if (fd_in < 0) {
perror("Error opening input file");
return 1;
}
- fd_out = open(argv[2], O_WRONLY|O_CREAT, 00644);
- if (fd_out < 0)
- {
+ fd_out = open(argv[2], O_WRONLY | O_CREAT, 00644);
+ if (fd_out < 0) {
perror("Error opening output file");
close(fd_in);
return 1;
}
- if (read(fd_in, &buf_in, 8) != 8)
- {
+ if (read(fd_in, &buf_in, 8) != 8) {
printf("Header error\n");
close(fd_in);
close(fd_out);
return 1;
}
- if (buf_in[0] != 'C' || buf_in[1] != 'W' || buf_in[2] != 'S')
- {
+ if (buf_in[0] != 'C' || buf_in[1] != 'W' || buf_in[2] != 'S') {
printf("Not a compressed flash file\n");
return 1;
}
fstat(fd_in, &statbuf);
- comp_len = statbuf.st_size;
+ comp_len = statbuf.st_size;
uncomp_len = buf_in[4] | (buf_in[5] << 8) | (buf_in[6] << 16) | (buf_in[7] << 24);
- printf("Compressed size: %d Uncompressed size: %d\n", comp_len-4, uncomp_len-4);
+ printf("Compressed size: %d Uncompressed size: %d\n",
+ comp_len - 4, uncomp_len - 4);
// write out modified header
buf_in[0] = 'F';
@@ -75,36 +77,35 @@ int main(int argc, char *argv[])
}
zstream.zalloc = NULL;
- zstream.zfree = NULL;
+ zstream.zfree = NULL;
zstream.opaque = NULL;
inflateInit(&zstream);
- for (i = 0; i < comp_len-8;)
- {
+ for (i = 0; i < comp_len - 8;) {
int ret, len = read(fd_in, &buf_in, 1024);
dbgprintf("read %d bytes\n", len);
last_out = zstream.total_out;
- zstream.next_in = &buf_in[0];
- zstream.avail_in = len;
- zstream.next_out = &buf_out[0];
+ zstream.next_in = &buf_in[0];
+ zstream.avail_in = len;
+ zstream.next_out = &buf_out[0];
zstream.avail_out = 65536;
ret = inflate(&zstream, Z_SYNC_FLUSH);
- if (ret != Z_STREAM_END && ret != Z_OK)
- {
+ if (ret != Z_STREAM_END && ret != Z_OK) {
printf("Error while decompressing: %d\n", ret);
inflateEnd(&zstream);
return 1;
}
dbgprintf("a_in: %d t_in: %lu a_out: %d t_out: %lu -- %lu out\n",
- zstream.avail_in, zstream.total_in, zstream.avail_out, zstream.total_out,
- zstream.total_out-last_out);
+ zstream.avail_in, zstream.total_in, zstream.avail_out,
+ zstream.total_out, zstream.total_out - last_out);
- if (write(fd_out, &buf_out, zstream.total_out - last_out) < zstream.total_out - last_out) {
+ if (write(fd_out, &buf_out, zstream.total_out - last_out) <
+ zstream.total_out - last_out) {
perror("Error writing output file");
return 1;
}
@@ -115,15 +116,14 @@ int main(int argc, char *argv[])
break;
}
- if (zstream.total_out != uncomp_len-8)
- {
+ if (zstream.total_out != uncomp_len - 8) {
printf("Size mismatch (%lu != %d), updating header...\n",
- zstream.total_out, uncomp_len-8);
+ zstream.total_out, uncomp_len - 8);
- buf_in[0] = (zstream.total_out+8) & 0xff;
- buf_in[1] = ((zstream.total_out+8) >> 8) & 0xff;
- buf_in[2] = ((zstream.total_out+8) >> 16) & 0xff;
- buf_in[3] = ((zstream.total_out+8) >> 24) & 0xff;
+ buf_in[0] = (zstream.total_out + 8) & 0xff;
+ buf_in[1] = ((zstream.total_out + 8) >> 8) & 0xff;
+ buf_in[2] = ((zstream.total_out + 8) >> 16) & 0xff;
+ buf_in[3] = ((zstream.total_out + 8) >> 24) & 0xff;
lseek(fd_out, 4, SEEK_SET);
if (write(fd_out, &buf_in, 4) < 4) {
diff --git a/gst-libs/ext/libav/tools/graph2dot.c b/gst-libs/ext/libav/tools/graph2dot.c
index 5ec6e20..c0142cc 100644
--- a/gst-libs/ext/libav/tools/graph2dot.c
+++ b/gst-libs/ext/libav/tools/graph2dot.c
@@ -18,13 +18,22 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "config.h"
+#if HAVE_UNISTD_H
#include <unistd.h> /* getopt */
+#endif
+#include <stdio.h>
+#include <string.h>
-#undef HAVE_AV_CONFIG_H
+#include "libavutil/mem.h"
#include "libavutil/pixdesc.h"
#include "libavutil/audioconvert.h"
#include "libavfilter/avfiltergraph.h"
+#if !HAVE_GETOPT
+#include "compat/getopt.c"
+#endif
+
static void usage(void)
{
printf("Convert a libavfilter graph to a dot file\n");
@@ -63,19 +72,25 @@ static void print_digraph(FILE *outfile, AVFilterGraph *graph)
char dst_filter_ctx_label[128];
const AVFilterContext *dst_filter_ctx = link->dst;
- snprintf(dst_filter_ctx_label, sizeof(dst_filter_ctx_label), "%s (%s)",
+ snprintf(dst_filter_ctx_label, sizeof(dst_filter_ctx_label),
+ "%s (%s)",
dst_filter_ctx->name,
dst_filter_ctx->filter->name);
- fprintf(outfile, "\"%s\" -> \"%s\"", filter_ctx_label, dst_filter_ctx_label);
+ fprintf(outfile, "\"%s\" -> \"%s\"",
+ filter_ctx_label, dst_filter_ctx_label);
if (link->type == AVMEDIA_TYPE_VIDEO) {
- fprintf(outfile, " [ label= \"fmt:%s w:%d h:%d tb:%d/%d\" ]",
- av_pix_fmt_descriptors[link->format].name,
- link->w, link->h, link->time_base.num, link->time_base.den);
+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(link->format);
+ fprintf(outfile,
+ " [ label= \"fmt:%s w:%d h:%d tb:%d/%d\" ]",
+ desc->name, link->w, link->h, link->time_base.num,
+ link->time_base.den);
} else if (link->type == AVMEDIA_TYPE_AUDIO) {
char buf[255];
- av_get_channel_layout_string(buf, sizeof(buf), -1, link->channel_layout);
- fprintf(outfile, " [ label= \"fmt:%s sr:%"PRId64" cl:%s\" ]",
+ av_get_channel_layout_string(buf, sizeof(buf), -1,
+ link->channel_layout);
+ fprintf(outfile,
+ " [ label= \"fmt:%s sr:%d cl:%s\" ]",
av_get_sample_fmt_name(link->format),
link->sample_rate, buf);
}
@@ -89,17 +104,17 @@ static void print_digraph(FILE *outfile, AVFilterGraph *graph)
int main(int argc, char **argv)
{
const char *outfilename = NULL;
- const char *infilename = NULL;
- FILE *outfile = NULL;
- FILE *infile = NULL;
- char *graph_string = NULL;
+ const char *infilename = NULL;
+ FILE *outfile = NULL;
+ FILE *infile = NULL;
+ char *graph_string = NULL;
AVFilterGraph *graph = av_mallocz(sizeof(AVFilterGraph));
char c;
av_log_set_level(AV_LOG_DEBUG);
while ((c = getopt(argc, argv, "hi:o:")) != -1) {
- switch(c) {
+ switch (c) {
case 'h':
usage();
return 0;
@@ -118,7 +133,8 @@ int main(int argc, char **argv)
infilename = "/dev/stdin";
infile = fopen(infilename, "r");
if (!infile) {
- fprintf(stderr, "Impossible to open input file '%s': %s\n", infilename, strerror(errno));
+ fprintf(stderr, "Impossible to open input file '%s': %s\n",
+ infilename, strerror(errno));
return 1;
}
@@ -126,7 +142,8 @@ int main(int argc, char **argv)
outfilename = "/dev/stdout";
outfile = fopen(outfilename, "w");
if (!outfile) {
- fprintf(stderr, "Impossible to open output file '%s': %s\n", outfilename, strerror(errno));
+ fprintf(stderr, "Impossible to open output file '%s': %s\n",
+ outfilename, strerror(errno));
return 1;
}
@@ -141,7 +158,7 @@ int main(int argc, char **argv)
struct line *new_line = av_malloc(sizeof(struct line));
count += strlen(last_line->data);
last_line->next = new_line;
- last_line = new_line;
+ last_line = new_line;
}
last_line->next = NULL;
diff --git a/gst-libs/ext/libav/tools/ismindex.c b/gst-libs/ext/libav/tools/ismindex.c
new file mode 100644
index 0000000..bf8c69d
--- /dev/null
+++ b/gst-libs/ext/libav/tools/ismindex.c
@@ -0,0 +1,554 @@
+/*
+ * Copyright (c) 2012 Martin Storsjo
+ *
+ * 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
+ */
+
+/*
+ * To create a simple file for smooth streaming:
+ * avconv <normal input/transcoding options> -movflags frag_keyframe foo.ismv
+ * ismindex -n foo foo.ismv
+ * This step creates foo.ism and foo.ismc that is required by IIS for
+ * serving it.
+ *
+ * To pre-split files for serving as static files by a web server without
+ * any extra server support, create the ismv file as above, and split it:
+ * ismindex -split foo.ismv
+ * This step creates a file Manifest and directories QualityLevel(...),
+ * that can be read directly by a smooth streaming player.
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include <sys/stat.h>
+#ifdef _WIN32
+#include <direct.h>
+#define mkdir(a, b) _mkdir(a)
+#endif
+
+#include "libavformat/avformat.h"
+#include "libavutil/intreadwrite.h"
+#include "libavutil/mathematics.h"
+
+static int usage(const char *argv0, int ret)
+{
+ fprintf(stderr, "%s [-split] [-n basename] file1 [file2] ...\n", argv0);
+ return ret;
+}
+
+struct MoofOffset {
+ int64_t time;
+ int64_t offset;
+ int duration;
+};
+
+struct VideoFile {
+ const char *name;
+ int64_t duration;
+ int bitrate;
+ int track_id;
+ int is_audio, is_video;
+ int width, height;
+ int chunks;
+ int sample_rate, channels;
+ uint8_t *codec_private;
+ int codec_private_size;
+ struct MoofOffset *offsets;
+ int timescale;
+ const char *fourcc;
+ int blocksize;
+ int tag;
+};
+
+struct VideoFiles {
+ int nb_files;
+ int64_t duration;
+ struct VideoFile **files;
+ int video_file, audio_file;
+ int nb_video_files, nb_audio_files;
+};
+
+static int copy_tag(AVIOContext *in, AVIOContext *out, int32_t tag_name)
+{
+ int32_t size, tag;
+
+ size = avio_rb32(in);
+ tag = avio_rb32(in);
+ avio_wb32(out, size);
+ avio_wb32(out, tag);
+ if (tag != tag_name)
+ return -1;
+ size -= 8;
+ while (size > 0) {
+ char buf[1024];
+ int len = FFMIN(sizeof(buf), size);
+ if (avio_read(in, buf, len) != len)
+ break;
+ avio_write(out, buf, len);
+ size -= len;
+ }
+ return 0;
+}
+
+static int write_fragment(const char *filename, AVIOContext *in)
+{
+ AVIOContext *out = NULL;
+ int ret;
+
+ if ((ret = avio_open2(&out, filename, AVIO_FLAG_WRITE, NULL, NULL)) < 0)
+ return ret;
+ copy_tag(in, out, MKBETAG('m', 'o', 'o', 'f'));
+ copy_tag(in, out, MKBETAG('m', 'd', 'a', 't'));
+
+ avio_flush(out);
+ avio_close(out);
+
+ return ret;
+}
+
+static int write_fragments(struct VideoFiles *files, int start_index,
+ AVIOContext *in)
+{
+ char dirname[100], filename[500];
+ int i, j;
+
+ for (i = start_index; i < files->nb_files; i++) {
+ struct VideoFile *vf = files->files[i];
+ const char *type = vf->is_video ? "video" : "audio";
+ snprintf(dirname, sizeof(dirname), "QualityLevels(%d)", vf->bitrate);
+ mkdir(dirname, 0777);
+ for (j = 0; j < vf->chunks; j++) {
+ snprintf(filename, sizeof(filename), "%s/Fragments(%s=%"PRId64")",
+ dirname, type, vf->offsets[j].time);
+ avio_seek(in, vf->offsets[j].offset, SEEK_SET);
+ write_fragment(filename, in);
+ }
+ }
+ return 0;
+}
+
+static int read_tfra(struct VideoFiles *files, int start_index, AVIOContext *f)
+{
+ int ret = AVERROR_EOF, track_id;
+ int version, fieldlength, i, j;
+ int64_t pos = avio_tell(f);
+ uint32_t size = avio_rb32(f);
+ struct VideoFile *vf = NULL;
+
+ if (avio_rb32(f) != MKBETAG('t', 'f', 'r', 'a'))
+ goto fail;
+ version = avio_r8(f);
+ avio_rb24(f);
+ track_id = avio_rb32(f); /* track id */
+ for (i = start_index; i < files->nb_files && !vf; i++)
+ if (files->files[i]->track_id == track_id)
+ vf = files->files[i];
+ if (!vf) {
+ /* Ok, continue parsing the next atom */
+ ret = 0;
+ goto fail;
+ }
+ fieldlength = avio_rb32(f);
+ vf->chunks = avio_rb32(f);
+ vf->offsets = av_mallocz(sizeof(*vf->offsets) * vf->chunks);
+ if (!vf->offsets) {
+ ret = AVERROR(ENOMEM);
+ goto fail;
+ }
+ for (i = 0; i < vf->chunks; i++) {
+ if (version == 1) {
+ vf->offsets[i].time = avio_rb64(f);
+ vf->offsets[i].offset = avio_rb64(f);
+ } else {
+ vf->offsets[i].time = avio_rb32(f);
+ vf->offsets[i].offset = avio_rb32(f);
+ }
+ for (j = 0; j < ((fieldlength >> 4) & 3) + 1; j++)
+ avio_r8(f);
+ for (j = 0; j < ((fieldlength >> 2) & 3) + 1; j++)
+ avio_r8(f);
+ for (j = 0; j < ((fieldlength >> 0) & 3) + 1; j++)
+ avio_r8(f);
+ if (i > 0)
+ vf->offsets[i - 1].duration = vf->offsets[i].time -
+ vf->offsets[i - 1].time;
+ }
+ if (vf->chunks > 0)
+ vf->offsets[vf->chunks - 1].duration = vf->duration -
+ vf->offsets[vf->chunks - 1].time;
+ ret = 0;
+
+fail:
+ avio_seek(f, pos + size, SEEK_SET);
+ return ret;
+}
+
+static int read_mfra(struct VideoFiles *files, int start_index,
+ const char *file, int split)
+{
+ int err = 0;
+ AVIOContext *f = NULL;
+ int32_t mfra_size;
+
+ if ((err = avio_open2(&f, file, AVIO_FLAG_READ, NULL, NULL)) < 0)
+ goto fail;
+ avio_seek(f, avio_size(f) - 4, SEEK_SET);
+ mfra_size = avio_rb32(f);
+ avio_seek(f, -mfra_size, SEEK_CUR);
+ if (avio_rb32(f) != mfra_size) {
+ err = AVERROR_INVALIDDATA;
+ goto fail;
+ }
+ if (avio_rb32(f) != MKBETAG('m', 'f', 'r', 'a')) {
+ err = AVERROR_INVALIDDATA;
+ goto fail;
+ }
+ while (!read_tfra(files, start_index, f)) {
+ /* Empty */
+ }
+
+ if (split)
+ write_fragments(files, start_index, f);
+
+fail:
+ if (f)
+ avio_close(f);
+ if (err)
+ fprintf(stderr, "Unable to read the MFRA atom in %s\n", file);
+ return err;
+}
+
+static int get_private_data(struct VideoFile *vf, AVCodecContext *codec)
+{
+ vf->codec_private_size = codec->extradata_size;
+ vf->codec_private = av_mallocz(codec->extradata_size);
+ if (!vf->codec_private)
+ return AVERROR(ENOMEM);
+ memcpy(vf->codec_private, codec->extradata, codec->extradata_size);
+ return 0;
+}
+
+static int get_video_private_data(struct VideoFile *vf, AVCodecContext *codec)
+{
+ AVIOContext *io = NULL;
+ uint16_t sps_size, pps_size;
+ int err = AVERROR(EINVAL);
+
+ if (codec->codec_id == AV_CODEC_ID_VC1)
+ return get_private_data(vf, codec);
+
+ avio_open_dyn_buf(&io);
+ if (codec->extradata_size < 11 || codec->extradata[0] != 1)
+ goto fail;
+ sps_size = AV_RB16(&codec->extradata[6]);
+ if (11 + sps_size > codec->extradata_size)
+ goto fail;
+ avio_wb32(io, 0x00000001);
+ avio_write(io, &codec->extradata[8], sps_size);
+ pps_size = AV_RB16(&codec->extradata[9 + sps_size]);
+ if (11 + sps_size + pps_size > codec->extradata_size)
+ goto fail;
+ avio_wb32(io, 0x00000001);
+ avio_write(io, &codec->extradata[11 + sps_size], pps_size);
+ err = 0;
+
+fail:
+ vf->codec_private_size = avio_close_dyn_buf(io, &vf->codec_private);
+ return err;
+}
+
+static int handle_file(struct VideoFiles *files, const char *file, int split)
+{
+ AVFormatContext *ctx = NULL;
+ int err = 0, i, orig_files = files->nb_files;
+ char errbuf[50], *ptr;
+ struct VideoFile *vf;
+
+ err = avformat_open_input(&ctx, file, NULL, NULL);
+ if (err < 0) {
+ av_strerror(err, errbuf, sizeof(errbuf));
+ fprintf(stderr, "Unable to open %s: %s\n", file, errbuf);
+ return 1;
+ }
+
+ err = avformat_find_stream_info(ctx, NULL);
+ if (err < 0) {
+ av_strerror(err, errbuf, sizeof(errbuf));
+ fprintf(stderr, "Unable to identify %s: %s\n", file, errbuf);
+ goto fail;
+ }
+
+ if (ctx->nb_streams < 1) {
+ fprintf(stderr, "No streams found in %s\n", file);
+ goto fail;
+ }
+ if (!files->duration)
+ files->duration = ctx->duration;
+
+ for (i = 0; i < ctx->nb_streams; i++) {
+ AVStream *st = ctx->streams[i];
+ vf = av_mallocz(sizeof(*vf));
+ files->files = av_realloc(files->files,
+ sizeof(*files->files) * (files->nb_files + 1));
+ files->files[files->nb_files] = vf;
+
+ vf->name = file;
+ if ((ptr = strrchr(file, '/')) != NULL)
+ vf->name = ptr + 1;
+
+ vf->bitrate = st->codec->bit_rate;
+ vf->track_id = st->id;
+ vf->timescale = st->time_base.den;
+ vf->duration = av_rescale_rnd(ctx->duration, vf->timescale,
+ AV_TIME_BASE, AV_ROUND_UP);
+ vf->is_audio = st->codec->codec_type == AVMEDIA_TYPE_AUDIO;
+ vf->is_video = st->codec->codec_type == AVMEDIA_TYPE_VIDEO;
+
+ if (!vf->is_audio && !vf->is_video) {
+ fprintf(stderr,
+ "Track %d in %s is neither video nor audio, skipping\n",
+ vf->track_id, file);
+ av_freep(&files->files[files->nb_files]);
+ continue;
+ }
+
+ if (vf->is_audio) {
+ if (files->audio_file < 0)
+ files->audio_file = files->nb_files;
+ files->nb_audio_files++;
+ vf->channels = st->codec->channels;
+ vf->sample_rate = st->codec->sample_rate;
+ if (st->codec->codec_id == AV_CODEC_ID_AAC) {
+ vf->fourcc = "AACL";
+ vf->tag = 255;
+ vf->blocksize = 4;
+ } else if (st->codec->codec_id == AV_CODEC_ID_WMAPRO) {
+ vf->fourcc = "WMAP";
+ vf->tag = st->codec->codec_tag;
+ vf->blocksize = st->codec->block_align;
+ }
+ get_private_data(vf, st->codec);
+ }
+ if (vf->is_video) {
+ if (files->video_file < 0)
+ files->video_file = files->nb_files;
+ files->nb_video_files++;
+ vf->width = st->codec->width;
+ vf->height = st->codec->height;
+ if (st->codec->codec_id == AV_CODEC_ID_H264)
+ vf->fourcc = "H264";
+ else if (st->codec->codec_id == AV_CODEC_ID_VC1)
+ vf->fourcc = "WVC1";
+ get_video_private_data(vf, st->codec);
+ }
+
+ files->nb_files++;
+ }
+
+ avformat_close_input(&ctx);
+
+ err = read_mfra(files, orig_files, file, split);
+
+fail:
+ if (ctx)
+ avformat_close_input(&ctx);
+ return err;
+}
+
+static void output_server_manifest(struct VideoFiles *files,
+ const char *basename)
+{
+ char filename[1000];
+ FILE *out;
+ int i;
+
+ snprintf(filename, sizeof(filename), "%s.ism", basename);
+ out = fopen(filename, "w");
+ if (!out) {
+ perror(filename);
+ return;
+ }
+ fprintf(out, "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n");
+ fprintf(out, "<smil xmlns=\"http://www.w3.org/2001/SMIL20/Language\">\n");
+ fprintf(out, "\t<head>\n");
+ fprintf(out, "\t\t<meta name=\"clientManifestRelativePath\" "
+ "content=\"%s.ismc\" />\n", basename);
+ fprintf(out, "\t</head>\n");
+ fprintf(out, "\t<body>\n");
+ fprintf(out, "\t\t<switch>\n");
+ for (i = 0; i < files->nb_files; i++) {
+ struct VideoFile *vf = files->files[i];
+ const char *type = vf->is_video ? "video" : "audio";
+ fprintf(out, "\t\t\t<%s src=\"%s\" systemBitrate=\"%d\">\n",
+ type, vf->name, vf->bitrate);
+ fprintf(out, "\t\t\t\t<param name=\"trackID\" value=\"%d\" "
+ "valueType=\"data\" />\n", vf->track_id);
+ fprintf(out, "\t\t\t</%s>\n", type);
+ }
+ fprintf(out, "\t\t</switch>\n");
+ fprintf(out, "\t</body>\n");
+ fprintf(out, "</smil>\n");
+ fclose(out);
+}
+
+static void output_client_manifest(struct VideoFiles *files,
+ const char *basename, int split)
+{
+ char filename[1000];
+ FILE *out;
+ int i, j;
+
+ if (split)
+ snprintf(filename, sizeof(filename), "Manifest");
+ else
+ snprintf(filename, sizeof(filename), "%s.ismc", basename);
+ out = fopen(filename, "w");
+ if (!out) {
+ perror(filename);
+ return;
+ }
+ fprintf(out, "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n");
+ fprintf(out, "<SmoothStreamingMedia MajorVersion=\"2\" MinorVersion=\"0\" "
+ "Duration=\"%"PRId64 "\">\n", files->duration * 10);
+ if (files->video_file >= 0) {
+ struct VideoFile *vf = files->files[files->video_file];
+ struct VideoFile *first_vf = vf;
+ int index = 0;
+ fprintf(out,
+ "\t<StreamIndex Type=\"video\" QualityLevels=\"%d\" "
+ "Chunks=\"%d\" "
+ "Url=\"QualityLevels({bitrate})/Fragments(video={start time})\">\n",
+ files->nb_video_files, vf->chunks);
+ for (i = 0; i < files->nb_files; i++) {
+ vf = files->files[i];
+ if (!vf->is_video)
+ continue;
+ fprintf(out,
+ "\t\t<QualityLevel Index=\"%d\" Bitrate=\"%d\" "
+ "FourCC=\"%s\" MaxWidth=\"%d\" MaxHeight=\"%d\" "
+ "CodecPrivateData=\"",
+ index, vf->bitrate, vf->fourcc, vf->width, vf->height);
+ for (j = 0; j < vf->codec_private_size; j++)
+ fprintf(out, "%02X", vf->codec_private[j]);
+ fprintf(out, "\" />\n");
+ index++;
+ if (vf->chunks != first_vf->chunks)
+ fprintf(stderr, "Mismatched number of video chunks in %s and %s\n",
+ vf->name, first_vf->name);
+ }
+ vf = first_vf;
+ for (i = 0; i < vf->chunks; i++) {
+ for (j = files->video_file + 1; j < files->nb_files; j++) {
+ if (files->files[j]->is_video &&
+ vf->offsets[i].duration != files->files[j]->offsets[i].duration)
+ fprintf(stderr, "Mismatched duration of video chunk %d in %s and %s\n",
+ i, vf->name, files->files[j]->name);
+ }
+ fprintf(out, "\t\t<c n=\"%d\" d=\"%d\" />\n", i,
+ vf->offsets[i].duration);
+ }
+ fprintf(out, "\t</StreamIndex>\n");
+ }
+ if (files->audio_file >= 0) {
+ struct VideoFile *vf = files->files[files->audio_file];
+ struct VideoFile *first_vf = vf;
+ int index = 0;
+ fprintf(out,
+ "\t<StreamIndex Type=\"audio\" QualityLevels=\"%d\" "
+ "Chunks=\"%d\" "
+ "Url=\"QualityLevels({bitrate})/Fragments(audio={start time})\">\n",
+ files->nb_audio_files, vf->chunks);
+ for (i = 0; i < files->nb_files; i++) {
+ vf = files->files[i];
+ if (!vf->is_audio)
+ continue;
+ fprintf(out,
+ "\t\t<QualityLevel Index=\"%d\" Bitrate=\"%d\" "
+ "FourCC=\"%s\" SamplingRate=\"%d\" Channels=\"%d\" "
+ "BitsPerSample=\"16\" PacketSize=\"%d\" "
+ "AudioTag=\"%d\" CodecPrivateData=\"",
+ index, vf->bitrate, vf->fourcc, vf->sample_rate,
+ vf->channels, vf->blocksize, vf->tag);
+ for (j = 0; j < vf->codec_private_size; j++)
+ fprintf(out, "%02X", vf->codec_private[j]);
+ fprintf(out, "\" />\n");
+ index++;
+ if (vf->chunks != first_vf->chunks)
+ fprintf(stderr, "Mismatched number of audio chunks in %s and %s\n",
+ vf->name, first_vf->name);
+ }
+ vf = first_vf;
+ for (i = 0; i < vf->chunks; i++) {
+ for (j = files->audio_file + 1; j < files->nb_files; j++) {
+ if (files->files[j]->is_audio &&
+ vf->offsets[i].duration != files->files[j]->offsets[i].duration)
+ fprintf(stderr, "Mismatched duration of audio chunk %d in %s and %s\n",
+ i, vf->name, files->files[j]->name);
+ }
+ fprintf(out, "\t\t<c n=\"%d\" d=\"%d\" />\n",
+ i, vf->offsets[i].duration);
+ }
+ fprintf(out, "\t</StreamIndex>\n");
+ }
+ fprintf(out, "</SmoothStreamingMedia>\n");
+ fclose(out);
+}
+
+static void clean_files(struct VideoFiles *files)
+{
+ int i;
+ for (i = 0; i < files->nb_files; i++) {
+ av_freep(&files->files[i]->codec_private);
+ av_freep(&files->files[i]->offsets);
+ av_freep(&files->files[i]);
+ }
+ av_freep(&files->files);
+ files->nb_files = 0;
+}
+
+int main(int argc, char **argv)
+{
+ const char *basename = NULL;
+ int split = 0, i;
+ struct VideoFiles vf = { 0, .video_file = -1, .audio_file = -1 };
+
+ av_register_all();
+
+ for (i = 1; i < argc; i++) {
+ if (!strcmp(argv[i], "-n")) {
+ basename = argv[i + 1];
+ i++;
+ } else if (!strcmp(argv[i], "-split")) {
+ split = 1;
+ } else if (argv[i][0] == '-') {
+ return usage(argv[0], 1);
+ } else {
+ if (handle_file(&vf, argv[i], split))
+ return 1;
+ }
+ }
+ if (!vf.nb_files || (!basename && !split))
+ return usage(argv[0], 1);
+
+ if (!split)
+ output_server_manifest(&vf, basename);
+ output_client_manifest(&vf, basename, split);
+
+ clean_files(&vf);
+
+ return 0;
+}
diff --git a/gst-libs/ext/libav/tools/lavfi-showfiltfmts.c b/gst-libs/ext/libav/tools/lavfi-showfiltfmts.c
deleted file mode 100644
index 30d4725..0000000
--- a/gst-libs/ext/libav/tools/lavfi-showfiltfmts.c
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Copyright (c) 2009 Stefano Sabatini
- *
- * 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
- */
-
-#include "libavformat/avformat.h"
-#include "libavutil/pixdesc.h"
-#include "libavfilter/avfilter.h"
-
-int main(int argc, char **argv)
-{
- AVFilter *filter;
- AVFilterContext *filter_ctx;
- const char *filter_name;
- const char *filter_args = NULL;
- int i, j;
-
- av_log_set_level(AV_LOG_DEBUG);
-
- if (!argv[1]) {
- fprintf(stderr, "Missing filter name as argument\n");
- return 1;
- }
-
- filter_name = argv[1];
- if (argv[2])
- filter_args = argv[2];
-
- avfilter_register_all();
-
- /* get a corresponding filter and open it */
- if (!(filter = avfilter_get_by_name(filter_name))) {
- fprintf(stderr, "Unrecognized filter with name '%s'\n", filter_name);
- return 1;
- }
-
- if (avfilter_open(&filter_ctx, filter, NULL) < 0) {
- fprintf(stderr, "Inpossible to open filter with name '%s'\n", filter_name);
- return 1;
- }
- if (avfilter_init_filter(filter_ctx, filter_args, NULL) < 0) {
- fprintf(stderr, "Impossible to init filter '%s' with arguments '%s'\n", filter_name, filter_args);
- return 1;
- }
-
- /* create a link for each of the input pads */
- for (i = 0; i < filter_ctx->input_count; i++) {
- AVFilterLink *link = av_mallocz(sizeof(AVFilterLink));
- link->type = filter_ctx->filter->inputs[i].type;
- filter_ctx->inputs[i] = link;
- }
- for (i = 0; i < filter_ctx->output_count; i++) {
- AVFilterLink *link = av_mallocz(sizeof(AVFilterLink));
- link->type = filter_ctx->filter->outputs[i].type;
- filter_ctx->outputs[i] = link;
- }
-
- if (filter->query_formats)
- filter->query_formats(filter_ctx);
- else
- avfilter_default_query_formats(filter_ctx);
-
- /* print the supported formats in input */
- for (i = 0; i < filter_ctx->input_count; i++) {
- AVFilterFormats *fmts = filter_ctx->inputs[i]->out_formats;
- for (j = 0; j < fmts->format_count; j++)
- printf("INPUT[%d] %s: %s\n",
- i, filter_ctx->filter->inputs[i].name,
- av_pix_fmt_descriptors[fmts->formats[j]].name);
- }
-
- /* print the supported formats in output */
- for (i = 0; i < filter_ctx->output_count; i++) {
- AVFilterFormats *fmts = filter_ctx->outputs[i]->in_formats;
- for (j = 0; j < fmts->format_count; j++)
- printf("OUTPUT[%d] %s: %s\n",
- i, filter_ctx->filter->outputs[i].name,
- av_pix_fmt_descriptors[fmts->formats[j]].name);
- }
-
- avfilter_free(filter_ctx);
- fflush(stdout);
- return 0;
-}
diff --git a/gst-libs/ext/libav/tools/patcheck b/gst-libs/ext/libav/tools/patcheck
index 94e1232..d22cf3c 100755
--- a/gst-libs/ext/libav/tools/patcheck
+++ b/gst-libs/ext/libav/tools/patcheck
@@ -19,7 +19,7 @@ echo This tool is intended to help a human check/review patches it is very far f
echo being free of false positives and negatives, its output are just hints of what
echo may or may not be bad. When you use it and it misses something or detects
echo something wrong, fix it and send a patch to the libav-devel mailing list.
-echo License:GPL Autor: Michael Niedermayer
+echo License:GPL Author: Michael Niedermayer
ERE_PRITYP='(unsigned *|)(char|short|long|int|long *int|short *int|void|float|double|(u|)int(8|16|32|64)_t)'
ERE_TYPES='(const|static|av_cold|inline| *)*('$ERE_PRITYP'|[a-zA-Z][a-zA-Z0-9_]*)[* ]{1,}[a-zA-Z][a-zA-Z0-9_]*'
@@ -67,7 +67,7 @@ $EGREP $OPT '^\+ *(const *|)static' $*| $EGREP --color=always '[^=]= *(0|NULL)[^
cat $TMP
hiegrep '# *ifdef * (HAVE|CONFIG)_' 'ifdefs that should be #if' $*
-hiegrep '\b(awnser|cant|dont|wont|usefull|successfull|occured|teh|alot|wether|skiped|heigth|informations|colums|loosy|loosing|seperate|preceed|upto|paket|posible)\b' 'common typos' $*
+hiegrep '\b(awnser|cant|dont|wont|usefull|successfull|occured|teh|alot|wether|skiped|heigth|informations|colums|loosy|loosing|seperate|preceed|upto|paket|posible|unkown|inpossible|dimention|acheive)\b' 'common typos' $*
hiegrep 'av_log\( *NULL' 'Missing context in av_log' $*
hiegrep '[^sn]printf' 'Please use av_log' $*
@@ -158,7 +158,7 @@ cat $* | tr '\n' '@' | $EGREP --color=always -o '[^a-zA-Z0-9_]([a-zA-Z0-9_]*) *=
cat $TMP | tr '@' '\n'
-# doesnt work
+# does not work
#cat $* | tr '\n' '@' | $EGREP -o '[^a-zA-Z_0-9]([a-zA-Z][a-zA-Z_0-9]*) *=[^=].*\1' | $EGREP -o '[^a-zA-Z_0-9]([a-zA-Z][a-zA-Z_0-9]*) *=[^=].*\1 *=[^=]' >$TMP && printf "\nPossibly written 2x before read\n"
#cat $TMP | tr '@' '\n'
diff --git a/gst-libs/ext/libav/tools/pktdumper.c b/gst-libs/ext/libav/tools/pktdumper.c
index e9e5acf..98b9327 100644
--- a/gst-libs/ext/libav/tools/pktdumper.c
+++ b/gst-libs/ext/libav/tools/pktdumper.c
@@ -18,17 +18,26 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "config.h"
#include <limits.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#if HAVE_UNISTD_H
#include <unistd.h>
-#include "libavformat/avformat.h"
+#endif
+#if HAVE_IO_H
+#include <io.h>
+#endif
+
+#define FILENAME_BUF_SIZE 4096
-#define PKTFILESUFF "_%08"PRId64"_%02d_%010"PRId64"_%06d_%c.bin"
+#include "libavutil/avstring.h"
+#include "libavutil/time.h"
+#include "libavformat/avformat.h"
-#undef strcat
+#define PKTFILESUFF "_%08" PRId64 "_%02d_%010" PRId64 "_%06d_%c.bin"
static int usage(int ret)
{
@@ -42,14 +51,14 @@ static int usage(int ret)
int main(int argc, char **argv)
{
- char fntemplate[PATH_MAX];
- char pktfilename[PATH_MAX];
+ char fntemplate[FILENAME_BUF_SIZE];
+ char pktfilename[FILENAME_BUF_SIZE];
AVFormatContext *fctx = NULL;
AVPacket pkt;
- int64_t pktnum = 0;
+ int64_t pktnum = 0;
int64_t maxpkts = 0;
- int donotquit = 0;
- int nowrite = 0;
+ int donotquit = 0;
+ int nowrite = 0;
int err;
if ((argc > 1) && !strncmp(argv[1], "-", 1)) {
@@ -64,16 +73,16 @@ int main(int argc, char **argv)
return usage(1);
if (argc > 2)
maxpkts = atoi(argv[2]);
- strncpy(fntemplate, argv[1], PATH_MAX-1);
+ av_strlcpy(fntemplate, argv[1], sizeof(fntemplate));
if (strrchr(argv[1], '/'))
- strncpy(fntemplate, strrchr(argv[1], '/')+1, PATH_MAX-1);
+ av_strlcpy(fntemplate, strrchr(argv[1], '/') + 1, sizeof(fntemplate));
if (strrchr(fntemplate, '.'))
*strrchr(fntemplate, '.') = '\0';
if (strchr(fntemplate, '%')) {
fprintf(stderr, "can't use filenames containing '%%'\n");
return usage(1);
}
- if (strlen(fntemplate) + sizeof(PKTFILESUFF) >= PATH_MAX-1) {
+ if (strlen(fntemplate) + sizeof(PKTFILESUFF) >= sizeof(fntemplate) - 1) {
fprintf(stderr, "filename too long\n");
return usage(1);
}
@@ -99,11 +108,13 @@ int main(int argc, char **argv)
while ((err = av_read_frame(fctx, &pkt)) >= 0) {
int fd;
- snprintf(pktfilename, PATH_MAX-1, fntemplate, pktnum, pkt.stream_index, pkt.pts, pkt.size, (pkt.flags & AV_PKT_FLAG_KEY)?'K':'_');
- printf(PKTFILESUFF"\n", pktnum, pkt.stream_index, pkt.pts, pkt.size, (pkt.flags & AV_PKT_FLAG_KEY)?'K':'_');
- //printf("open(\"%s\")\n", pktfilename);
+ snprintf(pktfilename, sizeof(pktfilename), fntemplate, pktnum,
+ pkt.stream_index, pkt.pts, pkt.size,
+ (pkt.flags & AV_PKT_FLAG_KEY) ? 'K' : '_');
+ printf(PKTFILESUFF "\n", pktnum, pkt.stream_index, pkt.pts, pkt.size,
+ (pkt.flags & AV_PKT_FLAG_KEY) ? 'K' : '_');
if (!nowrite) {
- fd = open(pktfilename, O_WRONLY|O_CREAT, 0644);
+ fd = open(pktfilename, O_WRONLY | O_CREAT, 0644);
err = write(fd, pkt.data, pkt.size);
if (err < 0) {
fprintf(stderr, "write: error %d\n", err);
@@ -120,7 +131,7 @@ int main(int argc, char **argv)
avformat_close_input(&fctx);
while (donotquit)
- sleep(60);
+ av_usleep(60 * 1000000);
return 0;
}
diff --git a/gst-libs/ext/libav/tools/probetest.c b/gst-libs/ext/libav/tools/probetest.c
index 7f8d54e..678f4dd 100644
--- a/gst-libs/ext/libav/tools/probetest.c
+++ b/gst-libs/ext/libav/tools/probetest.c
@@ -39,7 +39,8 @@ static void probe(AVProbeData *pd, int type, int p, int size)
int score = fmt->read_probe(pd);
if (score > score_array[i] && score > AVPROBE_SCORE_MAX / 4) {
score_array[i] = score;
- fprintf(stderr, "Failure of %s probing code with score=%d type=%d p=%X size=%d\n",
+ fprintf(stderr,
+ "Failure of %s probing code with score=%d type=%d p=%X size=%d\n",
fmt->name, score, type, p, size);
failures++;
}
@@ -75,9 +76,8 @@ int main(void)
init_put_bits(&pb, pd.buf, size);
switch (type) {
case 0:
- for (i = 0; i < size * 8; i++) {
+ for (i = 0; i < size * 8; i++)
put_bits(&pb, 1, (av_lfg_get(&state) & 0xFFFFFFFF) > p << 20);
- }
break;
case 1:
for (i = 0; i < size * 8; i++) {
@@ -89,10 +89,10 @@ int main(void)
break;
case 2:
for (i = 0; i < size * 8; i++) {
- unsigned int p2 = (p >> (hist*3)) & 7;
+ unsigned int p2 = (p >> (hist * 3)) & 7;
unsigned int v = (av_lfg_get(&state) & 0xFFFFFFFF) > p2 << 29;
put_bits(&pb, 1, v);
- hist = (2*hist + v) & 3;
+ hist = (2 * hist + v) & 3;
}
break;
case 3:
@@ -100,12 +100,18 @@ int main(void)
int c = 0;
while (p & 63) {
c = (av_lfg_get(&state) & 0xFFFFFFFF) >> 24;
- if (c >= 'a' && c <= 'z' && (p & 1)) break;
- else if(c >= 'A' && c <= 'Z' && (p & 2)) break;
- else if(c >= '0' && c <= '9' && (p & 4)) break;
- else if(c == ' ' && (p & 8)) break;
- else if(c == 0 && (p & 16)) break;
- else if(c == 1 && (p & 32)) break;
+ if (c >= 'a' && c <= 'z' && (p & 1))
+ break;
+ else if (c >= 'A' && c <= 'Z' && (p & 2))
+ break;
+ else if (c >= '0' && c <= '9' && (p & 4))
+ break;
+ else if (c == ' ' && (p & 8))
+ break;
+ else if (c == 0 && (p & 16))
+ break;
+ else if (c == 1 && (p & 32))
+ break;
}
pd.buf[i] = c;
}
diff --git a/gst-libs/ext/libav/tools/qt-faststart.c b/gst-libs/ext/libav/tools/qt-faststart.c
index 71fe845..f33d6fa 100644
--- a/gst-libs/ext/libav/tools/qt-faststart.c
+++ b/gst-libs/ext/libav/tools/qt-faststart.c
@@ -32,6 +32,9 @@
#ifdef __MINGW32__
#define fseeko(x, y, z) fseeko64(x, y, z)
#define ftello(x) ftello64(x)
+#elif defined(_WIN32)
+#define fseeko(x, y, z) _fseeki64(x, y, z)
+#define ftello(x) _ftelli64(x)
#endif
#define BE_16(x) ((((uint8_t*)(x))[0] << 8) | ((uint8_t*)(x))[1])
@@ -138,7 +141,6 @@ int main(int argc, char *argv[])
}
start_offset = ftello(infile);
} else {
-
/* 64-bit special case */
if (atom_size == 1) {
if (fread(atom_bytes, ATOM_PREAMBLE_SIZE, 1, infile) != 1) {
diff --git a/gst-libs/ext/libav/tools/trasher.c b/gst-libs/ext/libav/tools/trasher.c
index e099aa3..35625e9 100644
--- a/gst-libs/ext/libav/tools/trasher.c
+++ b/gst-libs/ext/libav/tools/trasher.c
@@ -21,49 +21,54 @@
#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
+#include <errno.h>
+#include <string.h>
static uint32_t state;
-static uint32_t ran(void){
- return state= state*1664525+1013904223;
+static uint32_t ran(void)
+{
+ return state = state * 1664525 + 1013904223;
}
-int main(int argc, char** argv)
+int main(int argc, char **argv)
{
FILE *f;
int count, maxburst, length;
- if (argc < 5){
+ if (argc < 5) {
printf("USAGE: trasher <filename> <count> <maxburst> <seed>\n");
return 1;
}
- f= fopen(argv[1], "rb+");
- if (!f){
+ f = fopen(argv[1], "rb+");
+ if (!f) {
perror(argv[1]);
return 2;
}
- count= atoi(argv[2]);
- maxburst= atoi(argv[3]);
- state= atoi(argv[4]);
+ count = atoi(argv[2]);
+ maxburst = atoi(argv[3]);
+ state = atoi(argv[4]);
fseek(f, 0, SEEK_END);
- length= ftell(f);
+ length = ftell(f);
fseek(f, 0, SEEK_SET);
- while(count--){
- int burst= 1 + ran() * (uint64_t) (abs(maxburst)-1) / UINT32_MAX;
- int pos= ran() * (uint64_t) length / UINT32_MAX;
+ while (count--) {
+ int burst = 1 + ran() * (uint64_t) (abs(maxburst) - 1) / UINT32_MAX;
+ int pos = ran() * (uint64_t) length / UINT32_MAX;
fseek(f, pos, SEEK_SET);
- if(maxburst<0) burst= -maxburst;
+ if (maxburst < 0)
+ burst = -maxburst;
- if(pos + burst > length)
+ if (pos + burst > length)
continue;
- while(burst--){
- int val= ran() * 256ULL / UINT32_MAX;
+ while (burst--) {
+ int val = ran() * 256ULL / UINT32_MAX;
- if(maxburst<0) val=0;
+ if (maxburst < 0)
+ val = 0;
fwrite(&val, 1, 1, f);
}
diff --git a/install-sh b/install-sh
index a9244eb..377bb86 100755
--- a/install-sh
+++ b/install-sh
@@ -1,7 +1,7 @@
#!/bin/sh
# install - install a program, script, or datafile
-scriptversion=2011-01-19.21; # UTC
+scriptversion=2011-11-20.07; # UTC
# This originates from X11R5 (mit/util/scripts/install.sh), which was
# later released in X11R6 (xc/config/util/install.sh) with the
@@ -35,7 +35,7 @@ scriptversion=2011-01-19.21; # UTC
# FSF changes to this file are in the public domain.
#
# Calling this script install-sh is preferred over install.sh, to prevent
-# `make' implicit rules from creating a file called install from it
+# 'make' implicit rules from creating a file called install from it
# when there is no Makefile.
#
# This script is compatible with the BSD install script, but was written
@@ -156,7 +156,7 @@ while test $# -ne 0; do
-s) stripcmd=$stripprog;;
-t) dst_arg=$2
- # Protect names problematic for `test' and other utilities.
+ # Protect names problematic for 'test' and other utilities.
case $dst_arg in
-* | [=\(\)!]) dst_arg=./$dst_arg;;
esac
@@ -190,7 +190,7 @@ if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
fi
shift # arg
dst_arg=$arg
- # Protect names problematic for `test' and other utilities.
+ # Protect names problematic for 'test' and other utilities.
case $dst_arg in
-* | [=\(\)!]) dst_arg=./$dst_arg;;
esac
@@ -202,7 +202,7 @@ if test $# -eq 0; then
echo "$0: no input file specified." >&2
exit 1
fi
- # It's OK to call `install-sh -d' without argument.
+ # It's OK to call 'install-sh -d' without argument.
# This can happen when creating conditional directories.
exit 0
fi
@@ -240,7 +240,7 @@ fi
for src
do
- # Protect names problematic for `test' and other utilities.
+ # Protect names problematic for 'test' and other utilities.
case $src in
-* | [=\(\)!]) src=./$src;;
esac
@@ -354,7 +354,7 @@ do
if test -z "$dir_arg" || {
# Check for POSIX incompatibilities with -m.
# HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
- # other-writeable bit of parent directory when it shouldn't.
+ # other-writable bit of parent directory when it shouldn't.
# FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
ls_ld_tmpdir=`ls -ld "$tmpdir"`
case $ls_ld_tmpdir in
diff --git a/ltmain.sh b/ltmain.sh
index 499e473..68c6d96 100644
--- a/ltmain.sh
+++ b/ltmain.sh
@@ -70,7 +70,7 @@
# compiler: $LTCC
# compiler flags: $LTCFLAGS
# linker: $LD (gnu? $with_gnu_ld)
-# $progname: (GNU libtool) 2.4.2 Debian-2.4.2-1.2
+# $progname: (GNU libtool) 2.4.2 Debian-2.4.2-1.3
# automake: $automake_version
# autoconf: $autoconf_version
#
@@ -80,7 +80,7 @@
PROGRAM=libtool
PACKAGE=libtool
-VERSION="2.4.2 Debian-2.4.2-1.2"
+VERSION="2.4.2 Debian-2.4.2-1.3"
TIMESTAMP=""
package_revision=1.3337
diff --git a/missing b/missing
index 86a8fc3..cdea514 100755
--- a/missing
+++ b/missing
@@ -1,11 +1,10 @@
#! /bin/sh
-# Common stub for a few missing GNU programs while installing.
+# Common wrapper for a few potentially missing GNU programs.
-scriptversion=2012-01-06.13; # UTC
+scriptversion=2012-06-26.16; # UTC
-# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006,
-# 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
-# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
+# Copyright (C) 1996-2013 Free Software Foundation, Inc.
+# Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -26,68 +25,40 @@ scriptversion=2012-01-06.13; # UTC
# the same distribution terms that you use for the rest of that program.
if test $# -eq 0; then
- echo 1>&2 "Try \`$0 --help' for more information"
+ echo 1>&2 "Try '$0 --help' for more information"
exit 1
fi
-run=:
-sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p'
-sed_minuso='s/.* -o \([^ ]*\).*/\1/p'
-
-# In the cases where this matters, `missing' is being run in the
-# srcdir already.
-if test -f configure.ac; then
- configure_ac=configure.ac
-else
- configure_ac=configure.in
-fi
+case $1 in
-msg="missing on your system"
+ --is-lightweight)
+ # Used by our autoconf macros to check whether the available missing
+ # script is modern enough.
+ exit 0
+ ;;
-case $1 in
---run)
- # Try to run requested program, and just exit if it succeeds.
- run=
- shift
- "$@" && exit 0
- # Exit code 63 means version mismatch. This often happens
- # when the user try to use an ancient version of a tool on
- # a file that requires a minimum version. In this case we
- # we should proceed has if the program had been absent, or
- # if --run hadn't been passed.
- if test $? = 63; then
- run=:
- msg="probably too old"
- fi
- ;;
+ --run)
+ # Back-compat with the calling convention used by older automake.
+ shift
+ ;;
-h|--h|--he|--hel|--help)
echo "\
$0 [OPTION]... PROGRAM [ARGUMENT]...
-Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
-error status if there is no known handling for PROGRAM.
+Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due
+to PROGRAM being missing or too old.
Options:
-h, --help display this help and exit
-v, --version output version information and exit
- --run try to run the given command, and emulate it if it fails
Supported PROGRAM values:
- aclocal touch file \`aclocal.m4'
- autoconf touch file \`configure'
- autoheader touch file \`config.h.in'
- autom4te touch the output file, or create a stub one
- automake touch all \`Makefile.in' files
- bison create \`y.tab.[ch]', if possible, from existing .[ch]
- flex create \`lex.yy.c', if possible, from existing .c
- help2man touch the output file
- lex create \`lex.yy.c', if possible, from existing .c
- makeinfo touch the output file
- yacc create \`y.tab.[ch]', if possible, from existing .[ch]
+ aclocal autoconf autoheader autom4te automake makeinfo
+ bison yacc flex lex help2man
-Version suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and
-\`g' are ignored when checking the name.
+Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and
+'g' are ignored when checking the name.
Send bug reports to <bug-automake@gnu.org>."
exit $?
@@ -99,228 +70,141 @@ Send bug reports to <bug-automake@gnu.org>."
;;
-*)
- echo 1>&2 "$0: Unknown \`$1' option"
- echo 1>&2 "Try \`$0 --help' for more information"
+ echo 1>&2 "$0: unknown '$1' option"
+ echo 1>&2 "Try '$0 --help' for more information"
exit 1
;;
esac
-# normalize program name to check for.
-program=`echo "$1" | sed '
- s/^gnu-//; t
- s/^gnu//; t
- s/^g//; t'`
-
-# Now exit if we have it, but it failed. Also exit now if we
-# don't have it and --version was passed (most likely to detect
-# the program). This is about non-GNU programs, so use $1 not
-# $program.
-case $1 in
- lex*|yacc*)
- # Not GNU programs, they don't have --version.
- ;;
-
- *)
- if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
- # We have it, but it failed.
- exit 1
- elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
- # Could not run --version or --help. This is probably someone
- # running `$TOOL --version' or `$TOOL --help' to check whether
- # $TOOL exists and not knowing $TOOL uses missing.
- exit 1
- fi
- ;;
-esac
-
-# If it does not exist, or fails to run (possibly an outdated version),
-# try to emulate it.
-case $program in
- aclocal*)
- echo 1>&2 "\
-WARNING: \`$1' is $msg. You should only need it if
- you modified \`acinclude.m4' or \`${configure_ac}'. You might want
- to install the \`Automake' and \`Perl' packages. Grab them from
- any GNU archive site."
- touch aclocal.m4
- ;;
-
- autoconf*)
- echo 1>&2 "\
-WARNING: \`$1' is $msg. You should only need it if
- you modified \`${configure_ac}'. You might want to install the
- \`Autoconf' and \`GNU m4' packages. Grab them from any GNU
- archive site."
- touch configure
- ;;
-
- autoheader*)
- echo 1>&2 "\
-WARNING: \`$1' is $msg. You should only need it if
- you modified \`acconfig.h' or \`${configure_ac}'. You might want
- to install the \`Autoconf' and \`GNU m4' packages. Grab them
- from any GNU archive site."
- files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
- test -z "$files" && files="config.h"
- touch_files=
- for f in $files; do
- case $f in
- *:*) touch_files="$touch_files "`echo "$f" |
- sed -e 's/^[^:]*://' -e 's/:.*//'`;;
- *) touch_files="$touch_files $f.in";;
- esac
- done
- touch $touch_files
- ;;
-
- automake*)
- echo 1>&2 "\
-WARNING: \`$1' is $msg. You should only need it if
- you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
- You might want to install the \`Automake' and \`Perl' packages.
- Grab them from any GNU archive site."
- find . -type f -name Makefile.am -print |
- sed 's/\.am$/.in/' |
- while read f; do touch "$f"; done
- ;;
-
- autom4te*)
- echo 1>&2 "\
-WARNING: \`$1' is needed, but is $msg.
- You might have modified some files without having the
- proper tools for further handling them.
- You can get \`$1' as part of \`Autoconf' from any GNU
- archive site."
-
- file=`echo "$*" | sed -n "$sed_output"`
- test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
- if test -f "$file"; then
- touch $file
- else
- test -z "$file" || exec >$file
- echo "#! /bin/sh"
- echo "# Created by GNU Automake missing as a replacement of"
- echo "# $ $@"
- echo "exit 0"
- chmod +x $file
- exit 1
- fi
- ;;
-
- bison*|yacc*)
- echo 1>&2 "\
-WARNING: \`$1' $msg. You should only need it if
- you modified a \`.y' file. You may need the \`Bison' package
- in order for those modifications to take effect. You can get
- \`Bison' from any GNU archive site."
- rm -f y.tab.c y.tab.h
- if test $# -ne 1; then
- eval LASTARG=\${$#}
- case $LASTARG in
- *.y)
- SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
- if test -f "$SRCFILE"; then
- cp "$SRCFILE" y.tab.c
- fi
- SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
- if test -f "$SRCFILE"; then
- cp "$SRCFILE" y.tab.h
- fi
- ;;
- esac
- fi
- if test ! -f y.tab.h; then
- echo >y.tab.h
- fi
- if test ! -f y.tab.c; then
- echo 'main() { return 0; }' >y.tab.c
- fi
- ;;
-
- lex*|flex*)
- echo 1>&2 "\
-WARNING: \`$1' is $msg. You should only need it if
- you modified a \`.l' file. You may need the \`Flex' package
- in order for those modifications to take effect. You can get
- \`Flex' from any GNU archive site."
- rm -f lex.yy.c
- if test $# -ne 1; then
- eval LASTARG=\${$#}
- case $LASTARG in
- *.l)
- SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
- if test -f "$SRCFILE"; then
- cp "$SRCFILE" lex.yy.c
- fi
- ;;
- esac
- fi
- if test ! -f lex.yy.c; then
- echo 'main() { return 0; }' >lex.yy.c
- fi
- ;;
-
- help2man*)
- echo 1>&2 "\
-WARNING: \`$1' is $msg. You should only need it if
- you modified a dependency of a manual page. You may need the
- \`Help2man' package in order for those modifications to take
- effect. You can get \`Help2man' from any GNU archive site."
-
- file=`echo "$*" | sed -n "$sed_output"`
- test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
- if test -f "$file"; then
- touch $file
- else
- test -z "$file" || exec >$file
- echo ".ab help2man is required to generate this page"
- exit $?
- fi
- ;;
-
- makeinfo*)
- echo 1>&2 "\
-WARNING: \`$1' is $msg. You should only need it if
- you modified a \`.texi' or \`.texinfo' file, or any other file
- indirectly affecting the aspect of the manual. The spurious
- call might also be the consequence of using a buggy \`make' (AIX,
- DU, IRIX). You might want to install the \`Texinfo' package or
- the \`GNU make' package. Grab either from any GNU archive site."
- # The file to touch is that specified with -o ...
- file=`echo "$*" | sed -n "$sed_output"`
- test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
- if test -z "$file"; then
- # ... or it is the one specified with @setfilename ...
- infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
- file=`sed -n '
- /^@setfilename/{
- s/.* \([^ ]*\) *$/\1/
- p
- q
- }' $infile`
- # ... or it is derived from the source name (dir/f.texi becomes f.info)
- test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
- fi
- # If the file does not exist, the user really needs makeinfo;
- # let's fail without touching anything.
- test -f $file || exit 1
- touch $file
- ;;
+# Run the given program, remember its exit status.
+"$@"; st=$?
+
+# If it succeeded, we are done.
+test $st -eq 0 && exit 0
+
+# Also exit now if we it failed (or wasn't found), and '--version' was
+# passed; such an option is passed most likely to detect whether the
+# program is present and works.
+case $2 in --version|--help) exit $st;; esac
+
+# Exit code 63 means version mismatch. This often happens when the user
+# tries to use an ancient version of a tool on a file that requires a
+# minimum version.
+if test $st -eq 63; then
+ msg="probably too old"
+elif test $st -eq 127; then
+ # Program was missing.
+ msg="missing on your system"
+else
+ # Program was found and executed, but failed. Give up.
+ exit $st
+fi
- *)
- echo 1>&2 "\
-WARNING: \`$1' is needed, and is $msg.
- You might have modified some files without having the
- proper tools for further handling them. Check the \`README' file,
- it often tells you about the needed prerequisites for installing
- this package. You may also peek at any GNU archive site, in case
- some other package would contain this missing \`$1' program."
- exit 1
+perl_URL=http://www.perl.org/
+flex_URL=http://flex.sourceforge.net/
+gnu_software_URL=http://www.gnu.org/software
+
+program_details ()
+{
+ case $1 in
+ aclocal|automake)
+ echo "The '$1' program is part of the GNU Automake package:"
+ echo "<$gnu_software_URL/automake>"
+ echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:"
+ echo "<$gnu_software_URL/autoconf>"
+ echo "<$gnu_software_URL/m4/>"
+ echo "<$perl_URL>"
+ ;;
+ autoconf|autom4te|autoheader)
+ echo "The '$1' program is part of the GNU Autoconf package:"
+ echo "<$gnu_software_URL/autoconf/>"
+ echo "It also requires GNU m4 and Perl in order to run:"
+ echo "<$gnu_software_URL/m4/>"
+ echo "<$perl_URL>"
+ ;;
+ esac
+}
+
+give_advice ()
+{
+ # Normalize program name to check for.
+ normalized_program=`echo "$1" | sed '
+ s/^gnu-//; t
+ s/^gnu//; t
+ s/^g//; t'`
+
+ printf '%s\n' "'$1' is $msg."
+
+ configure_deps="'configure.ac' or m4 files included by 'configure.ac'"
+ case $normalized_program in
+ autoconf*)
+ echo "You should only need it if you modified 'configure.ac',"
+ echo "or m4 files included by it."
+ program_details 'autoconf'
+ ;;
+ autoheader*)
+ echo "You should only need it if you modified 'acconfig.h' or"
+ echo "$configure_deps."
+ program_details 'autoheader'
+ ;;
+ automake*)
+ echo "You should only need it if you modified 'Makefile.am' or"
+ echo "$configure_deps."
+ program_details 'automake'
+ ;;
+ aclocal*)
+ echo "You should only need it if you modified 'acinclude.m4' or"
+ echo "$configure_deps."
+ program_details 'aclocal'
+ ;;
+ autom4te*)
+ echo "You might have modified some maintainer files that require"
+ echo "the 'automa4te' program to be rebuilt."
+ program_details 'autom4te'
+ ;;
+ bison*|yacc*)
+ echo "You should only need it if you modified a '.y' file."
+ echo "You may want to install the GNU Bison package:"
+ echo "<$gnu_software_URL/bison/>"
+ ;;
+ lex*|flex*)
+ echo "You should only need it if you modified a '.l' file."
+ echo "You may want to install the Fast Lexical Analyzer package:"
+ echo "<$flex_URL>"
+ ;;
+ help2man*)
+ echo "You should only need it if you modified a dependency" \
+ "of a man page."
+ echo "You may want to install the GNU Help2man package:"
+ echo "<$gnu_software_URL/help2man/>"
;;
-esac
-
-exit 0
+ makeinfo*)
+ echo "You should only need it if you modified a '.texi' file, or"
+ echo "any other file indirectly affecting the aspect of the manual."
+ echo "You might want to install the Texinfo package:"
+ echo "<$gnu_software_URL/texinfo/>"
+ echo "The spurious makeinfo call might also be the consequence of"
+ echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might"
+ echo "want to install GNU make:"
+ echo "<$gnu_software_URL/make/>"
+ ;;
+ *)
+ echo "You might have modified some files without having the proper"
+ echo "tools for further handling them. Check the 'README' file, it"
+ echo "often tells you about the needed prerequisites for installing"
+ echo "this package. You may also peek at any GNU archive site, in"
+ echo "case some other package contains this missing '$1' program."
+ ;;
+ esac
+}
+
+give_advice "$1" | sed -e '1s/^/WARNING: /' \
+ -e '2,$s/^/ /' >&2
+
+# Propagate the correct exit status (expected to be 127 for a program
+# not found, 63 for a program that failed due to version mismatch).
+exit $st
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
diff --git a/pkgconfig/Makefile.am b/pkgconfig/Makefile.am
new file mode 100644
index 0000000..fc94f03
--- /dev/null
+++ b/pkgconfig/Makefile.am
@@ -0,0 +1,31 @@
+### all of the standard pc files we need to generate
+pcverfiles = \
+ gstreamer-plugins-libav-@GST_API_VERSION@.pc
+pcverfiles_uninstalled = \
+ gstreamer-plugins-libav-@GST_API_VERSION@-uninstalled.pc
+
+### all-local: $(pcverfiles) $(pcverfiles_uninstalled)
+all-local: $(pcverfiles_uninstalled)
+
+cp_verbose = $(cp_verbose_$(V))
+cp_verbose_ = $(cp_verbose_$(AM_DEFAULT_VERBOSITY))
+cp_verbose_0 = @echo " CP $@";
+
+### how to generate versioned .pc files from .pc files in this dir
+%-@GST_API_VERSION@.pc: %.pc
+ $(cp_verbose)cp $< $@
+%-@GST_API_VERSION@-uninstalled.pc: %-uninstalled.pc
+ $(cp_verbose)cp $< $@
+
+# do not install for now
+# pkgconfigdir = $(libdir)/pkgconfig
+# pkgconfig_DATA = $(pcverfiles)
+
+CLEANFILES = $(pcverfiles) $(pcverfiles_uninstalled)
+# pcinfiles = \
+# gstreamer-plugins-libav.pc.in gstreamer-plugins-libav-uninstalled.pc.in
+pcinfiles = \
+ gstreamer-plugins-libav-uninstalled.pc.in
+
+DISTCLEANFILES = $(pcinfiles:.in=)
+EXTRA_DIST = $(pcinfiles)
diff --git a/pkgconfig/Makefile.in b/pkgconfig/Makefile.in
new file mode 100644
index 0000000..218cd04
--- /dev/null
+++ b/pkgconfig/Makefile.in
@@ -0,0 +1,580 @@
+# Makefile.in generated by automake 1.13.3 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994-2013 Free Software Foundation, Inc.
+
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+VPATH = @srcdir@
+am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
+am__make_running_with_option = \
+ case $${target_option-} in \
+ ?) ;; \
+ *) echo "am__make_running_with_option: internal error: invalid" \
+ "target option '$${target_option-}' specified" >&2; \
+ exit 1;; \
+ esac; \
+ has_opt=no; \
+ sane_makeflags=$$MAKEFLAGS; \
+ if $(am__is_gnu_make); then \
+ sane_makeflags=$$MFLAGS; \
+ else \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ bs=\\; \
+ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
+ esac; \
+ fi; \
+ skip_next=no; \
+ strip_trailopt () \
+ { \
+ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+ }; \
+ for flg in $$sane_makeflags; do \
+ test $$skip_next = yes && { skip_next=no; continue; }; \
+ case $$flg in \
+ *=*|--*) continue;; \
+ -*I) strip_trailopt 'I'; skip_next=yes;; \
+ -*I?*) strip_trailopt 'I';; \
+ -*O) strip_trailopt 'O'; skip_next=yes;; \
+ -*O?*) strip_trailopt 'O';; \
+ -*l) strip_trailopt 'l'; skip_next=yes;; \
+ -*l?*) strip_trailopt 'l';; \
+ -[dEDm]) skip_next=yes;; \
+ -[JT]) skip_next=yes;; \
+ esac; \
+ case $$flg in \
+ *$$target_option*) has_opt=yes; break;; \
+ esac; \
+ done; \
+ test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+subdir = pkgconfig
+DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
+ $(srcdir)/gstreamer-plugins-libav-uninstalled.pc.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/common/m4/as-ac-expand.m4 \
+ $(top_srcdir)/common/m4/as-auto-alt.m4 \
+ $(top_srcdir)/common/m4/as-compiler-flag.m4 \
+ $(top_srcdir)/common/m4/as-docbook.m4 \
+ $(top_srcdir)/common/m4/as-libtool.m4 \
+ $(top_srcdir)/common/m4/as-python.m4 \
+ $(top_srcdir)/common/m4/as-version.m4 \
+ $(top_srcdir)/common/m4/gst-arch.m4 \
+ $(top_srcdir)/common/m4/gst-args.m4 \
+ $(top_srcdir)/common/m4/gst-check.m4 \
+ $(top_srcdir)/common/m4/gst-doc.m4 \
+ $(top_srcdir)/common/m4/gst-error.m4 \
+ $(top_srcdir)/common/m4/gst-feature.m4 \
+ $(top_srcdir)/common/m4/gst-platform.m4 \
+ $(top_srcdir)/common/m4/gst-plugin-docs.m4 \
+ $(top_srcdir)/common/m4/gst-plugindir.m4 \
+ $(top_srcdir)/common/m4/gst.m4 \
+ $(top_srcdir)/common/m4/gtk-doc.m4 \
+ $(top_srcdir)/common/m4/orc.m4 $(top_srcdir)/common/m4/pkg.m4 \
+ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES = gstreamer-plugins-libav-uninstalled.pc
+CONFIG_CLEAN_VPATH_FILES =
+AM_V_P = $(am__v_P_@AM_V@)
+am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
+am__v_P_0 = false
+am__v_P_1 = :
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
+am__v_GEN_0 = @echo " GEN " $@;
+am__v_GEN_1 =
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
+am__v_at_0 = @
+am__v_at_1 =
+SOURCES =
+DIST_SOURCES =
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@
+AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CAT_ENTRY_END = @CAT_ENTRY_END@
+CAT_ENTRY_START = @CAT_ENTRY_START@
+CC = @CC@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LDFLAGS = @DARWIN_LDFLAGS@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DEPRECATED_CFLAGS = @DEPRECATED_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DOCBOOK_ROOT = @DOCBOOK_ROOT@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+ERROR_CFLAGS = @ERROR_CFLAGS@
+EXEEXT = @EXEEXT@
+FFLAGS = @FFLAGS@
+FGREP = @FGREP@
+GCOV = @GCOV@
+GCOV_CFLAGS = @GCOV_CFLAGS@
+GCOV_LIBS = @GCOV_LIBS@
+GREP = @GREP@
+GSTPB_PLUGINS_DIR = @GSTPB_PLUGINS_DIR@
+GST_AGE = @GST_AGE@
+GST_ALL_LDFLAGS = @GST_ALL_LDFLAGS@
+GST_API_VERSION = @GST_API_VERSION@
+GST_BASE_CFLAGS = @GST_BASE_CFLAGS@
+GST_BASE_LIBS = @GST_BASE_LIBS@
+GST_CFLAGS = @GST_CFLAGS@
+GST_CHECK_CFLAGS = @GST_CHECK_CFLAGS@
+GST_CHECK_LIBS = @GST_CHECK_LIBS@
+GST_CURRENT = @GST_CURRENT@
+GST_LEVEL_DEFAULT = @GST_LEVEL_DEFAULT@
+GST_LIBS = @GST_LIBS@
+GST_LIBVERSION = @GST_LIBVERSION@
+GST_LT_LDFLAGS = @GST_LT_LDFLAGS@
+GST_OPTION_CFLAGS = @GST_OPTION_CFLAGS@
+GST_PACKAGE_NAME = @GST_PACKAGE_NAME@
+GST_PACKAGE_ORIGIN = @GST_PACKAGE_ORIGIN@
+GST_PLUGINS_BASE_CFLAGS = @GST_PLUGINS_BASE_CFLAGS@
+GST_PLUGINS_BASE_DIR = @GST_PLUGINS_BASE_DIR@
+GST_PLUGINS_BASE_LIBS = @GST_PLUGINS_BASE_LIBS@
+GST_PLUGINS_DIR = @GST_PLUGINS_DIR@
+GST_PLUGIN_LDFLAGS = @GST_PLUGIN_LDFLAGS@
+GST_PLUGIN_LIBTOOLFLAGS = @GST_PLUGIN_LIBTOOLFLAGS@
+GST_REVISION = @GST_REVISION@
+GST_TOOLS_DIR = @GST_TOOLS_DIR@
+GTKDOC_CHECK = @GTKDOC_CHECK@
+GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@
+GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@
+GTKDOC_MKPDF = @GTKDOC_MKPDF@
+GTKDOC_REBASE = @GTKDOC_REBASE@
+HAVE_BZ2 = @HAVE_BZ2@
+HAVE_DOCBOOK2PS = @HAVE_DOCBOOK2PS@
+HAVE_DVIPS = @HAVE_DVIPS@
+HAVE_EPSTOPDF = @HAVE_EPSTOPDF@
+HAVE_JADETEX = @HAVE_JADETEX@
+HAVE_PNGTOPNM = @HAVE_PNGTOPNM@
+HAVE_PNMTOPS = @HAVE_PNMTOPS@
+HAVE_PS2PDF = @HAVE_PS2PDF@
+HAVE_XMLLINT = @HAVE_XMLLINT@
+HAVE_XSLTPROC = @HAVE_XSLTPROC@
+HTML_DIR = @HTML_DIR@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBAV_CFLAGS = @LIBAV_CFLAGS@
+LIBAV_CO_DIR = @LIBAV_CO_DIR@
+LIBAV_DEPS = @LIBAV_DEPS@
+LIBAV_EXTERNALS_REVISION = @LIBAV_EXTERNALS_REVISION@
+LIBAV_LIBS = @LIBAV_LIBS@
+LIBAV_REVISION = @LIBAV_REVISION@
+LIBAV_SUBDIRS = @LIBAV_SUBDIRS@
+LIBAV_SVN = @LIBAV_SVN@
+LIBM = @LIBM@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MKDIR_P = @MKDIR_P@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+ORCC = @ORCC@
+ORCC_FLAGS = @ORCC_FLAGS@
+ORC_CFLAGS = @ORC_CFLAGS@
+ORC_LIBS = @ORC_LIBS@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PACKAGE_VERSION_MAJOR = @PACKAGE_VERSION_MAJOR@
+PACKAGE_VERSION_MICRO = @PACKAGE_VERSION_MICRO@
+PACKAGE_VERSION_MINOR = @PACKAGE_VERSION_MINOR@
+PACKAGE_VERSION_NANO = @PACKAGE_VERSION_NANO@
+PACKAGE_VERSION_RELEASE = @PACKAGE_VERSION_RELEASE@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+PLUGINDIR = @PLUGINDIR@
+PROFILE_CFLAGS = @PROFILE_CFLAGS@
+PYTHON = @PYTHON@
+PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
+PYTHON_PLATFORM = @PYTHON_PLATFORM@
+PYTHON_PREFIX = @PYTHON_PREFIX@
+PYTHON_VERSION = @PYTHON_VERSION@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+SWSCALE_CFLAGS = @SWSCALE_CFLAGS@
+SWSCALE_DEPS = @SWSCALE_DEPS@
+SWSCALE_LIBS = @SWSCALE_LIBS@
+VALGRIND_CFLAGS = @VALGRIND_CFLAGS@
+VALGRIND_LIBS = @VALGRIND_LIBS@
+VALGRIND_PATH = @VALGRIND_PATH@
+VERSION = @VERSION@
+WARNING_CFLAGS = @WARNING_CFLAGS@
+WIN32_LIBS = @WIN32_LIBS@
+XML_CATALOG = @XML_CATALOG@
+XSLTPROC = @XSLTPROC@
+XSLTPROC_FLAGS = @XSLTPROC_FLAGS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+pkgpyexecdir = @pkgpyexecdir@
+pkgpythondir = @pkgpythondir@
+plugindir = @plugindir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+pyexecdir = @pyexecdir@
+pythondir = @pythondir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+
+### all of the standard pc files we need to generate
+pcverfiles = \
+ gstreamer-plugins-libav-@GST_API_VERSION@.pc
+
+pcverfiles_uninstalled = \
+ gstreamer-plugins-libav-@GST_API_VERSION@-uninstalled.pc
+
+cp_verbose = $(cp_verbose_$(V))
+cp_verbose_ = $(cp_verbose_$(AM_DEFAULT_VERBOSITY))
+cp_verbose_0 = @echo " CP $@";
+
+# do not install for now
+# pkgconfigdir = $(libdir)/pkgconfig
+# pkgconfig_DATA = $(pcverfiles)
+CLEANFILES = $(pcverfiles) $(pcverfiles_uninstalled)
+# pcinfiles = \
+# gstreamer-plugins-libav.pc.in gstreamer-plugins-libav-uninstalled.pc.in
+pcinfiles = \
+ gstreamer-plugins-libav-uninstalled.pc.in
+
+DISTCLEANFILES = $(pcinfiles:.in=)
+EXTRA_DIST = $(pcinfiles)
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu pkgconfig/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --gnu pkgconfig/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+gstreamer-plugins-libav-uninstalled.pc: $(top_builddir)/config.status $(srcdir)/gstreamer-plugins-libav-uninstalled.pc.in
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+tags TAGS:
+
+ctags CTAGS:
+
+cscope cscopelist:
+
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile all-local
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
+mostlyclean-generic:
+
+clean-generic:
+ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+ -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: install-am install-strip
+
+.PHONY: all all-am all-local check check-am clean clean-generic \
+ clean-libtool cscopelist-am ctags-am distclean \
+ distclean-generic distclean-libtool distdir dvi dvi-am html \
+ html-am info info-am install install-am install-data \
+ install-data-am install-dvi install-dvi-am install-exec \
+ install-exec-am install-html install-html-am install-info \
+ install-info-am install-man install-pdf install-pdf-am \
+ install-ps install-ps-am install-strip installcheck \
+ installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-generic \
+ mostlyclean-libtool pdf pdf-am ps ps-am tags-am uninstall \
+ uninstall-am
+
+
+### all-local: $(pcverfiles) $(pcverfiles_uninstalled)
+all-local: $(pcverfiles_uninstalled)
+
+### how to generate versioned .pc files from .pc files in this dir
+%-@GST_API_VERSION@.pc: %.pc
+ $(cp_verbose)cp $< $@
+%-@GST_API_VERSION@-uninstalled.pc: %-uninstalled.pc
+ $(cp_verbose)cp $< $@
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/pkgconfig/gstreamer-plugins-libav-uninstalled.pc.in b/pkgconfig/gstreamer-plugins-libav-uninstalled.pc.in
new file mode 100644
index 0000000..6e02192
--- /dev/null
+++ b/pkgconfig/gstreamer-plugins-libav-uninstalled.pc.in
@@ -0,0 +1,13 @@
+prefix=
+exec_prefix=
+libdir=@abs_top_builddir@/gst-libs/gst
+includedir=@abs_top_builddir@/gst-libs
+pluginsdir=@abs_top_builddir@
+
+Name: GStreamer Libav Plugins, Uninstalled
+Description: Streaming media framework, libav plugins, uninstalled
+Version: @VERSION@
+Requires: gstreamer-@GST_API_VERSION@ gstreamer-plugins-base-@GST_API_VERSION@
+
+Libs:
+Cflags:
diff --git a/test-driver b/test-driver
new file mode 100755
index 0000000..32bf39e
--- /dev/null
+++ b/test-driver
@@ -0,0 +1,127 @@
+#! /bin/sh
+# test-driver - basic testsuite driver script.
+
+scriptversion=2012-06-27.10; # UTC
+
+# Copyright (C) 2011-2013 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program 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 General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# This file is maintained in Automake, please report
+# bugs to <bug-automake@gnu.org> or send patches to
+# <automake-patches@gnu.org>.
+
+# Make unconditional expansion of undefined variables an error. This
+# helps a lot in preventing typo-related bugs.
+set -u
+
+usage_error ()
+{
+ echo "$0: $*" >&2
+ print_usage >&2
+ exit 2
+}
+
+print_usage ()
+{
+ cat <<END
+Usage:
+ test-driver --test-name=NAME --log-file=PATH --trs-file=PATH
+ [--expect-failure={yes|no}] [--color-tests={yes|no}]
+ [--enable-hard-errors={yes|no}] [--] TEST-SCRIPT
+The '--test-name', '--log-file' and '--trs-file' options are mandatory.
+END
+}
+
+# TODO: better error handling in option parsing (in particular, ensure
+# TODO: $log_file, $trs_file and $test_name are defined).
+test_name= # Used for reporting.
+log_file= # Where to save the output of the test script.
+trs_file= # Where to save the metadata of the test run.
+expect_failure=no
+color_tests=no
+enable_hard_errors=yes
+while test $# -gt 0; do
+ case $1 in
+ --help) print_usage; exit $?;;
+ --version) echo "test-driver $scriptversion"; exit $?;;
+ --test-name) test_name=$2; shift;;
+ --log-file) log_file=$2; shift;;
+ --trs-file) trs_file=$2; shift;;
+ --color-tests) color_tests=$2; shift;;
+ --expect-failure) expect_failure=$2; shift;;
+ --enable-hard-errors) enable_hard_errors=$2; shift;;
+ --) shift; break;;
+ -*) usage_error "invalid option: '$1'";;
+ esac
+ shift
+done
+
+if test $color_tests = yes; then
+ # Keep this in sync with 'lib/am/check.am:$(am__tty_colors)'.
+ red='' # Red.
+ grn='' # Green.
+ lgn='' # Light green.
+ blu='' # Blue.
+ mgn='' # Magenta.
+ std='' # No color.
+else
+ red= grn= lgn= blu= mgn= std=
+fi
+
+do_exit='rm -f $log_file $trs_file; (exit $st); exit $st'
+trap "st=129; $do_exit" 1
+trap "st=130; $do_exit" 2
+trap "st=141; $do_exit" 13
+trap "st=143; $do_exit" 15
+
+# Test script is run here.
+"$@" >$log_file 2>&1
+estatus=$?
+if test $enable_hard_errors = no && test $estatus -eq 99; then
+ estatus=1
+fi
+
+case $estatus:$expect_failure in
+ 0:yes) col=$red res=XPASS recheck=yes gcopy=yes;;
+ 0:*) col=$grn res=PASS recheck=no gcopy=no;;
+ 77:*) col=$blu res=SKIP recheck=no gcopy=yes;;
+ 99:*) col=$mgn res=ERROR recheck=yes gcopy=yes;;
+ *:yes) col=$lgn res=XFAIL recheck=no gcopy=yes;;
+ *:*) col=$red res=FAIL recheck=yes gcopy=yes;;
+esac
+
+# Report outcome to console.
+echo "${col}${res}${std}: $test_name"
+
+# Register the test result, and other relevant metadata.
+echo ":test-result: $res" > $trs_file
+echo ":global-test-result: $res" >> $trs_file
+echo ":recheck: $recheck" >> $trs_file
+echo ":copy-in-global-log: $gcopy" >> $trs_file
+
+# Local Variables:
+# mode: shell-script
+# sh-indentation: 2
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-time-zone: "UTC"
+# time-stamp-end: "; # UTC"
+# End:
diff --git a/tests/Makefile.in b/tests/Makefile.in
index 20ddfa7..f3928ed 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -1,9 +1,8 @@
-# Makefile.in generated by automake 1.11.6 from Makefile.am.
+# Makefile.in generated by automake 1.13.3 from Makefile.am.
# @configure_input@
-# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-# Foundation, Inc.
+# Copyright (C) 1994-2013 Free Software Foundation, Inc.
+
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -15,23 +14,51 @@
@SET_MAKE@
VPATH = @srcdir@
-am__make_dryrun = \
- { \
- am__dry=no; \
+am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
+am__make_running_with_option = \
+ case $${target_option-} in \
+ ?) ;; \
+ *) echo "am__make_running_with_option: internal error: invalid" \
+ "target option '$${target_option-}' specified" >&2; \
+ exit 1;; \
+ esac; \
+ has_opt=no; \
+ sane_makeflags=$$MAKEFLAGS; \
+ if $(am__is_gnu_make); then \
+ sane_makeflags=$$MFLAGS; \
+ else \
case $$MAKEFLAGS in \
*\\[\ \ ]*) \
- echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
- | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
- *) \
- for am__flg in $$MAKEFLAGS; do \
- case $$am__flg in \
- *=*|--*) ;; \
- *n*) am__dry=yes; break;; \
- esac; \
- done;; \
+ bs=\\; \
+ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
+ esac; \
+ fi; \
+ skip_next=no; \
+ strip_trailopt () \
+ { \
+ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+ }; \
+ for flg in $$sane_makeflags; do \
+ test $$skip_next = yes && { skip_next=no; continue; }; \
+ case $$flg in \
+ *=*|--*) continue;; \
+ -*I) strip_trailopt 'I'; skip_next=yes;; \
+ -*I?*) strip_trailopt 'I';; \
+ -*O) strip_trailopt 'O'; skip_next=yes;; \
+ -*O?*) strip_trailopt 'O';; \
+ -*l) strip_trailopt 'l'; skip_next=yes;; \
+ -*l?*) strip_trailopt 'l';; \
+ -[dEDm]) skip_next=yes;; \
+ -[JT]) skip_next=yes;; \
+ esac; \
+ case $$flg in \
+ *$$target_option*) has_opt=yes; break;; \
esac; \
- test $$am__dry = yes; \
- }
+ done; \
+ test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
@@ -52,7 +79,7 @@ build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
subdir = tests
-DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/common/m4/as-ac-expand.m4 \
$(top_srcdir)/common/m4/as-auto-alt.m4 \
@@ -82,21 +109,28 @@ mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
+AM_V_P = $(am__v_P_@AM_V@)
+am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
+am__v_P_0 = false
+am__v_P_1 = :
AM_V_GEN = $(am__v_GEN_@AM_V@)
am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
-am__v_GEN_0 = @echo " GEN " $@;
+am__v_GEN_0 = @echo " GEN " $@;
+am__v_GEN_1 =
AM_V_at = $(am__v_at_@AM_V@)
am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
am__v_at_0 = @
+am__v_at_1 =
SOURCES =
DIST_SOURCES =
-RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
- html-recursive info-recursive install-data-recursive \
- install-dvi-recursive install-exec-recursive \
- install-html-recursive install-info-recursive \
- install-pdf-recursive install-ps-recursive install-recursive \
- installcheck-recursive installdirs-recursive pdf-recursive \
- ps-recursive uninstall-recursive
+RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \
+ ctags-recursive dvi-recursive html-recursive info-recursive \
+ install-data-recursive install-dvi-recursive \
+ install-exec-recursive install-html-recursive \
+ install-info-recursive install-pdf-recursive \
+ install-ps-recursive install-recursive installcheck-recursive \
+ installdirs-recursive pdf-recursive ps-recursive \
+ tags-recursive uninstall-recursive
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
@@ -104,9 +138,29 @@ am__can_run_installinfo = \
esac
RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
distclean-recursive maintainer-clean-recursive
-AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
- $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
+am__recursive_targets = \
+ $(RECURSIVE_TARGETS) \
+ $(RECURSIVE_CLEAN_TARGETS) \
+ $(am__extra_recursive_targets)
+AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \
distdir
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
+# Read a list of newline-separated strings from the standard input,
+# and print each of them once, without duplicates. Input order is
+# *not* preserved.
+am__uniquify_input = $(AWK) '\
+ BEGIN { nonempty = 0; } \
+ { items[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in items) print i; }; } \
+'
+# Make sure the list of sources is unique. This is necessary because,
+# e.g., the same source file might be shared among _SOURCES variables
+# for different programs/libraries.
+am__define_uniq_tagged_files = \
+ list='$(am__tagged_files)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | $(am__uniquify_input)`
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
@@ -148,10 +202,12 @@ AWK = @AWK@
CAT_ENTRY_END = @CAT_ENTRY_END@
CAT_ENTRY_START = @CAT_ENTRY_START@
CC = @CC@
+CCASFLAGS = @CCASFLAGS@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
+CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DARWIN_LDFLAGS = @DARWIN_LDFLAGS@
DEFS = @DEFS@
@@ -167,7 +223,11 @@ ECHO_T = @ECHO_T@
EGREP = @EGREP@
ERROR_CFLAGS = @ERROR_CFLAGS@
EXEEXT = @EXEEXT@
+FFLAGS = @FFLAGS@
FGREP = @FGREP@
+GCOV = @GCOV@
+GCOV_CFLAGS = @GCOV_CFLAGS@
+GCOV_LIBS = @GCOV_LIBS@
GREP = @GREP@
GSTPB_PLUGINS_DIR = @GSTPB_PLUGINS_DIR@
GST_AGE = @GST_AGE@
@@ -200,16 +260,15 @@ GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@
GTKDOC_MKPDF = @GTKDOC_MKPDF@
GTKDOC_REBASE = @GTKDOC_REBASE@
HAVE_BZ2 = @HAVE_BZ2@
-HAVE_DOCBOOK2HTML = @HAVE_DOCBOOK2HTML@
HAVE_DOCBOOK2PS = @HAVE_DOCBOOK2PS@
HAVE_DVIPS = @HAVE_DVIPS@
HAVE_EPSTOPDF = @HAVE_EPSTOPDF@
-HAVE_FIG2DEV = @HAVE_FIG2DEV@
HAVE_JADETEX = @HAVE_JADETEX@
HAVE_PNGTOPNM = @HAVE_PNGTOPNM@
HAVE_PNMTOPS = @HAVE_PNMTOPS@
HAVE_PS2PDF = @HAVE_PS2PDF@
HAVE_XMLLINT = @HAVE_XMLLINT@
+HAVE_XSLTPROC = @HAVE_XSLTPROC@
HTML_DIR = @HTML_DIR@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
@@ -391,22 +450,25 @@ clean-libtool:
-rm -rf .libs _libs
# This directory's subdirectories are mostly independent; you can cd
-# into them and run `make' without going through this Makefile.
-# To change the values of `make' variables: instead of editing Makefiles,
-# (1) if the variable is set in `config.status', edit `config.status'
-# (which will cause the Makefiles to be regenerated when you run `make');
-# (2) otherwise, pass the desired values on the `make' command line.
-$(RECURSIVE_TARGETS):
- @fail= failcom='exit 1'; \
- for f in x $$MAKEFLAGS; do \
- case $$f in \
- *=* | --[!k]*);; \
- *k*) failcom='fail=yes';; \
- esac; \
- done; \
+# into them and run 'make' without going through this Makefile.
+# To change the values of 'make' variables: instead of editing Makefiles,
+# (1) if the variable is set in 'config.status', edit 'config.status'
+# (which will cause the Makefiles to be regenerated when you run 'make');
+# (2) otherwise, pass the desired values on the 'make' command line.
+$(am__recursive_targets):
+ @fail=; \
+ if $(am__make_keepgoing); then \
+ failcom='fail=yes'; \
+ else \
+ failcom='exit 1'; \
+ fi; \
dot_seen=no; \
target=`echo $@ | sed s/-recursive//`; \
- list='$(SUBDIRS)'; for subdir in $$list; do \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ for subdir in $$list; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
dot_seen=yes; \
@@ -421,57 +483,12 @@ $(RECURSIVE_TARGETS):
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
fi; test -z "$$fail"
-$(RECURSIVE_CLEAN_TARGETS):
- @fail= failcom='exit 1'; \
- for f in x $$MAKEFLAGS; do \
- case $$f in \
- *=* | --[!k]*);; \
- *k*) failcom='fail=yes';; \
- esac; \
- done; \
- dot_seen=no; \
- case "$@" in \
- distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
- *) list='$(SUBDIRS)' ;; \
- esac; \
- rev=''; for subdir in $$list; do \
- if test "$$subdir" = "."; then :; else \
- rev="$$subdir $$rev"; \
- fi; \
- done; \
- rev="$$rev ."; \
- target=`echo $@ | sed s/-recursive//`; \
- for subdir in $$rev; do \
- echo "Making $$target in $$subdir"; \
- if test "$$subdir" = "."; then \
- local_target="$$target-am"; \
- else \
- local_target="$$target"; \
- fi; \
- ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
- || eval $$failcom; \
- done && test -z "$$fail"
-tags-recursive:
- list='$(SUBDIRS)'; for subdir in $$list; do \
- test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
- done
-ctags-recursive:
- list='$(SUBDIRS)'; for subdir in $$list; do \
- test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
- done
+ID: $(am__tagged_files)
+ $(am__define_uniq_tagged_files); mkid -fID $$unique
+tags: tags-recursive
+TAGS: tags
-ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
- list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
- unique=`for i in $$list; do \
- if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
- done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
- mkid -fID $$unique
-tags: TAGS
-
-TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
- $(TAGS_FILES) $(LISP)
+tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
set x; \
here=`pwd`; \
if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
@@ -487,12 +504,7 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
fi; \
done; \
- list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
- unique=`for i in $$list; do \
- if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
- done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
+ $(am__define_uniq_tagged_files); \
shift; \
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
@@ -504,15 +516,11 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$$unique; \
fi; \
fi
-ctags: CTAGS
-CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
- $(TAGS_FILES) $(LISP)
- list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
- unique=`for i in $$list; do \
- if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
- done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
+ctags: ctags-recursive
+
+CTAGS: ctags
+ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+ $(am__define_uniq_tagged_files); \
test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$unique
@@ -521,6 +529,21 @@ GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& $(am__cd) $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here"
+cscopelist: cscopelist-recursive
+
+cscopelist-am: $(am__tagged_files)
+ list='$(am__tagged_files)'; \
+ case "$(srcdir)" in \
+ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+ *) sdir=$(subdir)/$(srcdir) ;; \
+ esac; \
+ for i in $$list; do \
+ if test -f "$$i"; then \
+ echo "$(subdir)/$$i"; \
+ else \
+ echo "$$sdir/$$i"; \
+ fi; \
+ done >> $(top_builddir)/cscope.files
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
@@ -681,22 +704,20 @@ ps-am:
uninstall-am:
-.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \
- install-am install-strip tags-recursive
-
-.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
- all all-am check check-am clean clean-generic clean-libtool \
- ctags ctags-recursive distclean distclean-generic \
- distclean-libtool distclean-tags distdir dvi dvi-am html \
- html-am info info-am install install-am install-data \
- install-data-am install-dvi install-dvi-am install-exec \
- install-exec-am install-html install-html-am install-info \
- install-info-am install-man install-pdf install-pdf-am \
- install-ps install-ps-am install-strip installcheck \
- installcheck-am installdirs installdirs-am maintainer-clean \
- maintainer-clean-generic mostlyclean mostlyclean-generic \
- mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \
- uninstall uninstall-am
+.MAKE: $(am__recursive_targets) install-am install-strip
+
+.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \
+ check-am clean clean-generic clean-libtool cscopelist-am ctags \
+ ctags-am distclean distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ installdirs-am maintainer-clean maintainer-clean-generic \
+ mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \
+ ps ps-am tags tags-am uninstall uninstall-am
# Tell versions [3.59,3.63) of GNU make to not export all variables.
diff --git a/tests/check/Makefile.am b/tests/check/Makefile.am
index 67fb318..41e7d4a 100644
--- a/tests/check/Makefile.am
+++ b/tests/check/Makefile.am
@@ -4,12 +4,12 @@ CHECK_REGISTRY = $(top_builddir)/tests/check/test-registry.xml
TEST_FILES_DIRECTORY = $(top_srcdir)/tests/files
REGISTRY_ENVIRONMENT = \
- GST_REGISTRY=$(CHECK_REGISTRY)
+ GST_REGISTRY_1_0=$(CHECK_REGISTRY)
TESTS_ENVIRONMENT = \
$(REGISTRY_ENVIRONMENT) \
- GST_PLUGIN_SYSTEM_PATH= \
- GST_PLUGIN_PATH=$(top_builddir)/gst:$(top_builddir)/ext:$(top_builddir)/../gst-plugins-good/gst:$(GSTPB_PLUGINS_DIR):$(GST_PLUGINS_DIR)
+ GST_PLUGIN_SYSTEM_PATH_1_0= \
+ GST_PLUGIN_PATH_1_0=$(top_builddir)/gst:$(top_builddir)/ext:$(top_builddir)/../gst-plugins-good/gst:$(GSTPB_PLUGINS_DIR):$(GST_PLUGINS_DIR)
# ths core dumps of some machines have PIDs appended
CLEANFILES = core.* test-registry.xml
diff --git a/tests/check/Makefile.in b/tests/check/Makefile.in
index e3f346c..f6ca898 100644
--- a/tests/check/Makefile.in
+++ b/tests/check/Makefile.in
@@ -1,9 +1,8 @@
-# Makefile.in generated by automake 1.11.6 from Makefile.am.
+# Makefile.in generated by automake 1.13.3 from Makefile.am.
# @configure_input@
-# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-# Foundation, Inc.
+# Copyright (C) 1994-2013 Free Software Foundation, Inc.
+
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -16,23 +15,51 @@
@SET_MAKE@
VPATH = @srcdir@
-am__make_dryrun = \
- { \
- am__dry=no; \
+am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
+am__make_running_with_option = \
+ case $${target_option-} in \
+ ?) ;; \
+ *) echo "am__make_running_with_option: internal error: invalid" \
+ "target option '$${target_option-}' specified" >&2; \
+ exit 1;; \
+ esac; \
+ has_opt=no; \
+ sane_makeflags=$$MAKEFLAGS; \
+ if $(am__is_gnu_make); then \
+ sane_makeflags=$$MFLAGS; \
+ else \
case $$MAKEFLAGS in \
*\\[\ \ ]*) \
- echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
- | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
- *) \
- for am__flg in $$MAKEFLAGS; do \
- case $$am__flg in \
- *=*|--*) ;; \
- *n*) am__dry=yes; break;; \
- esac; \
- done;; \
+ bs=\\; \
+ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
esac; \
- test $$am__dry = yes; \
- }
+ fi; \
+ skip_next=no; \
+ strip_trailopt () \
+ { \
+ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+ }; \
+ for flg in $$sane_makeflags; do \
+ test $$skip_next = yes && { skip_next=no; continue; }; \
+ case $$flg in \
+ *=*|--*) continue;; \
+ -*I) strip_trailopt 'I'; skip_next=yes;; \
+ -*I?*) strip_trailopt 'I';; \
+ -*O) strip_trailopt 'O'; skip_next=yes;; \
+ -*O?*) strip_trailopt 'O';; \
+ -*l) strip_trailopt 'l'; skip_next=yes;; \
+ -*l?*) strip_trailopt 'l';; \
+ -[dEDm]) skip_next=yes;; \
+ -[JT]) skip_next=yes;; \
+ esac; \
+ case $$flg in \
+ *$$target_option*) has_opt=yes; break;; \
+ esac; \
+ done; \
+ test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
@@ -52,8 +79,9 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
-DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
- $(top_srcdir)/common/check.mak
+DIST_COMMON = $(top_srcdir)/common/check.mak $(srcdir)/Makefile.in \
+ $(srcdir)/Makefile.am $(top_srcdir)/depcomp \
+ $(top_srcdir)/test-driver
check_PROGRAMS = generic/plugin-test$(EXEEXT) \
generic/libavcodec-locking$(EXEEXT) \
elements/avdec_adpcm$(EXEEXT) elements/avdemux_ape$(EXEEXT)
@@ -97,6 +125,7 @@ elements_avdec_adpcm_DEPENDENCIES = $(am__DEPENDENCIES_1)
AM_V_lt = $(am__v_lt_@AM_V@)
am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
am__v_lt_0 = --silent
+am__v_lt_1 =
am__dirstamp = $(am__leading_dot)dirstamp
elements_avdemux_ape_SOURCES = elements/avdemux_ape.c
elements_avdemux_ape_OBJECTS = avdemux_ape.$(OBJEXT)
@@ -110,6 +139,18 @@ generic_plugin_test_SOURCES = generic/plugin-test.c
generic_plugin_test_OBJECTS = plugin-test.$(OBJEXT)
generic_plugin_test_LDADD = $(LDADD)
generic_plugin_test_DEPENDENCIES = $(am__DEPENDENCIES_1)
+AM_V_P = $(am__v_P_@AM_V@)
+am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
+am__v_P_0 = false
+am__v_P_1 = :
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
+am__v_GEN_0 = @echo " GEN " $@;
+am__v_GEN_1 =
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
+am__v_at_0 = @
+am__v_at_1 =
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
@@ -122,20 +163,16 @@ LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(AM_CFLAGS) $(CFLAGS)
AM_V_CC = $(am__v_CC_@AM_V@)
am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
-am__v_CC_0 = @echo " CC " $@;
-AM_V_at = $(am__v_at_@AM_V@)
-am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
-am__v_at_0 = @
+am__v_CC_0 = @echo " CC " $@;
+am__v_CC_1 =
CCLD = $(CC)
LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
AM_V_CCLD = $(am__v_CCLD_@AM_V@)
am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
-am__v_CCLD_0 = @echo " CCLD " $@;
-AM_V_GEN = $(am__v_GEN_@AM_V@)
-am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
-am__v_GEN_0 = @echo " GEN " $@;
+am__v_CCLD_0 = @echo " CCLD " $@;
+am__v_CCLD_1 =
SOURCES = elements/avdec_adpcm.c elements/avdemux_ape.c \
generic/libavcodec-locking.c generic/plugin-test.c
DIST_SOURCES = elements/avdec_adpcm.c elements/avdemux_ape.c \
@@ -145,10 +182,229 @@ am__can_run_installinfo = \
n|no|NO) false;; \
*) (install-info --version) >/dev/null 2>&1;; \
esac
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
+# Read a list of newline-separated strings from the standard input,
+# and print each of them once, without duplicates. Input order is
+# *not* preserved.
+am__uniquify_input = $(AWK) '\
+ BEGIN { nonempty = 0; } \
+ { items[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in items) print i; }; } \
+'
+# Make sure the list of sources is unique. This is necessary because,
+# e.g., the same source file might be shared among _SOURCES variables
+# for different programs/libraries.
+am__define_uniq_tagged_files = \
+ list='$(am__tagged_files)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | $(am__uniquify_input)`
ETAGS = etags
CTAGS = ctags
-am__tty_colors = \
-red=; grn=; lgn=; blu=; std=
+am__tty_colors_dummy = \
+ mgn= red= grn= lgn= blu= brg= std=; \
+ am__color_tests=no
+am__tty_colors = { \
+ $(am__tty_colors_dummy); \
+ if test "X$(AM_COLOR_TESTS)" = Xno; then \
+ am__color_tests=no; \
+ elif test "X$(AM_COLOR_TESTS)" = Xalways; then \
+ am__color_tests=yes; \
+ elif test "X$$TERM" != Xdumb && { test -t 1; } 2>/dev/null; then \
+ am__color_tests=yes; \
+ fi; \
+ if test $$am__color_tests = yes; then \
+ red=''; \
+ grn=''; \
+ lgn=''; \
+ blu=''; \
+ mgn=''; \
+ brg=''; \
+ std=''; \
+ fi; \
+}
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+ if (++n[$$2] == $(am__install_max)) \
+ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+ END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+ test -z "$$files" \
+ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+ $(am__cd) "$$dir" && rm -f $$files; }; \
+ }
+am__recheck_rx = ^[ ]*:recheck:[ ]*
+am__global_test_result_rx = ^[ ]*:global-test-result:[ ]*
+am__copy_in_global_log_rx = ^[ ]*:copy-in-global-log:[ ]*
+# A command that, given a newline-separated list of test names on the
+# standard input, print the name of the tests that are to be re-run
+# upon "make recheck".
+am__list_recheck_tests = $(AWK) '{ \
+ recheck = 1; \
+ while ((rc = (getline line < ($$0 ".trs"))) != 0) \
+ { \
+ if (rc < 0) \
+ { \
+ if ((getline line2 < ($$0 ".log")) < 0) \
+ recheck = 0; \
+ break; \
+ } \
+ else if (line ~ /$(am__recheck_rx)[nN][Oo]/) \
+ { \
+ recheck = 0; \
+ break; \
+ } \
+ else if (line ~ /$(am__recheck_rx)[yY][eE][sS]/) \
+ { \
+ break; \
+ } \
+ }; \
+ if (recheck) \
+ print $$0; \
+ close ($$0 ".trs"); \
+ close ($$0 ".log"); \
+}'
+# A command that, given a newline-separated list of test names on the
+# standard input, create the global log from their .trs and .log files.
+am__create_global_log = $(AWK) ' \
+function fatal(msg) \
+{ \
+ print "fatal: making $@: " msg | "cat >&2"; \
+ exit 1; \
+} \
+function rst_section(header) \
+{ \
+ print header; \
+ len = length(header); \
+ for (i = 1; i <= len; i = i + 1) \
+ printf "="; \
+ printf "\n\n"; \
+} \
+{ \
+ copy_in_global_log = 1; \
+ global_test_result = "RUN"; \
+ while ((rc = (getline line < ($$0 ".trs"))) != 0) \
+ { \
+ if (rc < 0) \
+ fatal("failed to read from " $$0 ".trs"); \
+ if (line ~ /$(am__global_test_result_rx)/) \
+ { \
+ sub("$(am__global_test_result_rx)", "", line); \
+ sub("[ ]*$$", "", line); \
+ global_test_result = line; \
+ } \
+ else if (line ~ /$(am__copy_in_global_log_rx)[nN][oO]/) \
+ copy_in_global_log = 0; \
+ }; \
+ if (copy_in_global_log) \
+ { \
+ rst_section(global_test_result ": " $$0); \
+ while ((rc = (getline line < ($$0 ".log"))) != 0) \
+ { \
+ if (rc < 0) \
+ fatal("failed to read from " $$0 ".log"); \
+ print line; \
+ }; \
+ printf "\n"; \
+ }; \
+ close ($$0 ".trs"); \
+ close ($$0 ".log"); \
+}'
+# Restructured Text title.
+am__rst_title = { sed 's/.*/ & /;h;s/./=/g;p;x;s/ *$$//;p;g' && echo; }
+# Solaris 10 'make', and several other traditional 'make' implementations,
+# pass "-e" to $(SHELL), and POSIX 2008 even requires this. Work around it
+# by disabling -e (using the XSI extension "set +e") if it's set.
+am__sh_e_setup = case $$- in *e*) set +e;; esac
+# Default flags passed to test drivers.
+am__common_driver_flags = \
+ --color-tests "$$am__color_tests" \
+ --enable-hard-errors "$$am__enable_hard_errors" \
+ --expect-failure "$$am__expect_failure"
+# To be inserted before the command running the test. Creates the
+# directory for the log if needed. Stores in $dir the directory
+# containing $f, in $tst the test, in $log the log. Executes the
+# developer- defined test setup AM_TESTS_ENVIRONMENT (if any), and
+# passes TESTS_ENVIRONMENT. Set up options for the wrapper that
+# will run the test scripts (or their associated LOG_COMPILER, if
+# thy have one).
+am__check_pre = \
+$(am__sh_e_setup); \
+$(am__vpath_adj_setup) $(am__vpath_adj) \
+$(am__tty_colors); \
+srcdir=$(srcdir); export srcdir; \
+case "$@" in \
+ */*) am__odir=`echo "./$@" | sed 's|/[^/]*$$||'`;; \
+ *) am__odir=.;; \
+esac; \
+test "x$$am__odir" = x"." || test -d "$$am__odir" \
+ || $(MKDIR_P) "$$am__odir" || exit $$?; \
+if test -f "./$$f"; then dir=./; \
+elif test -f "$$f"; then dir=; \
+else dir="$(srcdir)/"; fi; \
+tst=$$dir$$f; log='$@'; \
+if test -n '$(DISABLE_HARD_ERRORS)'; then \
+ am__enable_hard_errors=no; \
+else \
+ am__enable_hard_errors=yes; \
+fi; \
+case " $(XFAIL_TESTS) " in \
+ *[\ \ ]$$f[\ \ ]* | *[\ \ ]$$dir$$f[\ \ ]*) \
+ am__expect_failure=yes;; \
+ *) \
+ am__expect_failure=no;; \
+esac; \
+$(AM_TESTS_ENVIRONMENT) $(TESTS_ENVIRONMENT)
+# A shell command to get the names of the tests scripts with any registered
+# extension removed (i.e., equivalently, the names of the test logs, with
+# the '.log' extension removed). The result is saved in the shell variable
+# '$bases'. This honors runtime overriding of TESTS and TEST_LOGS. Sadly,
+# we cannot use something simpler, involving e.g., "$(TEST_LOGS:.log=)",
+# since that might cause problem with VPATH rewrites for suffix-less tests.
+# See also 'test-harness-vpath-rewrite.sh' and 'test-trs-basic.sh'.
+am__set_TESTS_bases = \
+ bases='$(TEST_LOGS)'; \
+ bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \
+ bases=`echo $$bases`
+RECHECK_LOGS = $(TEST_LOGS)
+AM_RECURSIVE_TARGETS = check recheck
+TEST_SUITE_LOG = test-suite.log
+TEST_EXTENSIONS = @EXEEXT@ .test
+LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver
+LOG_COMPILE = $(LOG_COMPILER) $(AM_LOG_FLAGS) $(LOG_FLAGS)
+am__set_b = \
+ case '$@' in \
+ */*) \
+ case '$*' in \
+ */*) b='$*';; \
+ *) b=`echo '$@' | sed 's/\.log$$//'`; \
+ esac;; \
+ *) \
+ b='$*';; \
+ esac
+am__test_logs1 = $(TESTS:=.log)
+am__test_logs2 = $(am__test_logs1:@EXEEXT@.log=.log)
+TEST_LOGS = $(am__test_logs2:.test.log=.log)
+TEST_LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver
+TEST_LOG_COMPILE = $(TEST_LOG_COMPILER) $(AM_TEST_LOG_FLAGS) \
+ $(TEST_LOG_FLAGS)
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@
@@ -163,10 +419,12 @@ AWK = @AWK@
CAT_ENTRY_END = @CAT_ENTRY_END@
CAT_ENTRY_START = @CAT_ENTRY_START@
CC = @CC@
+CCASFLAGS = @CCASFLAGS@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
+CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DARWIN_LDFLAGS = @DARWIN_LDFLAGS@
DEFS = @DEFS@
@@ -182,7 +440,11 @@ ECHO_T = @ECHO_T@
EGREP = @EGREP@
ERROR_CFLAGS = @ERROR_CFLAGS@
EXEEXT = @EXEEXT@
+FFLAGS = @FFLAGS@
FGREP = @FGREP@
+GCOV = @GCOV@
+GCOV_CFLAGS = @GCOV_CFLAGS@
+GCOV_LIBS = @GCOV_LIBS@
GREP = @GREP@
GSTPB_PLUGINS_DIR = @GSTPB_PLUGINS_DIR@
GST_AGE = @GST_AGE@
@@ -215,16 +477,15 @@ GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@
GTKDOC_MKPDF = @GTKDOC_MKPDF@
GTKDOC_REBASE = @GTKDOC_REBASE@
HAVE_BZ2 = @HAVE_BZ2@
-HAVE_DOCBOOK2HTML = @HAVE_DOCBOOK2HTML@
HAVE_DOCBOOK2PS = @HAVE_DOCBOOK2PS@
HAVE_DVIPS = @HAVE_DVIPS@
HAVE_EPSTOPDF = @HAVE_EPSTOPDF@
-HAVE_FIG2DEV = @HAVE_FIG2DEV@
HAVE_JADETEX = @HAVE_JADETEX@
HAVE_PNGTOPNM = @HAVE_PNGTOPNM@
HAVE_PNMTOPS = @HAVE_PNMTOPS@
HAVE_PS2PDF = @HAVE_PS2PDF@
HAVE_XMLLINT = @HAVE_XMLLINT@
+HAVE_XSLTPROC = @HAVE_XSLTPROC@
HTML_DIR = @HTML_DIR@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
@@ -361,19 +622,18 @@ target_vendor = @target_vendor@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
-LOOPS = 10
# inspect every plugin feature
GST_INSPECT = $(GST_TOOLS_DIR)/gst-inspect-$(GST_API_VERSION)
CHECK_REGISTRY = $(top_builddir)/tests/check/test-registry.xml
TEST_FILES_DIRECTORY = $(top_srcdir)/tests/files
REGISTRY_ENVIRONMENT = \
- GST_REGISTRY=$(CHECK_REGISTRY)
+ GST_REGISTRY_1_0=$(CHECK_REGISTRY)
TESTS_ENVIRONMENT = \
$(REGISTRY_ENVIRONMENT) \
- GST_PLUGIN_SYSTEM_PATH= \
- GST_PLUGIN_PATH=$(top_builddir)/gst:$(top_builddir)/ext:$(top_builddir)/../gst-plugins-good/gst:$(GSTPB_PLUGINS_DIR):$(GST_PLUGINS_DIR)
+ GST_PLUGIN_SYSTEM_PATH_1_0= \
+ GST_PLUGIN_PATH_1_0=$(top_builddir)/gst:$(top_builddir)/ext:$(top_builddir)/../gst-plugins-good/gst:$(GSTPB_PLUGINS_DIR):$(GST_PLUGINS_DIR)
# ths core dumps of some machines have PIDs appended
@@ -396,7 +656,7 @@ EXTRA_DIST = gst-libav.supp
all: all-am
.SUFFIXES:
-.SUFFIXES: .c .lo .o .obj
+.SUFFIXES: .c .lo .log .o .obj .test .test$(EXEEXT) .trs
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/common/check.mak $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
@@ -449,18 +709,22 @@ clean-noinstPROGRAMS:
elements/$(am__dirstamp):
@$(MKDIR_P) elements
@: > elements/$(am__dirstamp)
+
elements/avdec_adpcm$(EXEEXT): $(elements_avdec_adpcm_OBJECTS) $(elements_avdec_adpcm_DEPENDENCIES) $(EXTRA_elements_avdec_adpcm_DEPENDENCIES) elements/$(am__dirstamp)
@rm -f elements/avdec_adpcm$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(elements_avdec_adpcm_OBJECTS) $(elements_avdec_adpcm_LDADD) $(LIBS)
+
elements/avdemux_ape$(EXEEXT): $(elements_avdemux_ape_OBJECTS) $(elements_avdemux_ape_DEPENDENCIES) $(EXTRA_elements_avdemux_ape_DEPENDENCIES) elements/$(am__dirstamp)
@rm -f elements/avdemux_ape$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(elements_avdemux_ape_OBJECTS) $(elements_avdemux_ape_LDADD) $(LIBS)
generic/$(am__dirstamp):
@$(MKDIR_P) generic
@: > generic/$(am__dirstamp)
+
generic/libavcodec-locking$(EXEEXT): $(generic_libavcodec_locking_OBJECTS) $(generic_libavcodec_locking_DEPENDENCIES) $(EXTRA_generic_libavcodec_locking_DEPENDENCIES) generic/$(am__dirstamp)
@rm -f generic/libavcodec-locking$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(generic_libavcodec_locking_OBJECTS) $(generic_libavcodec_locking_LDADD) $(LIBS)
+
generic/plugin-test$(EXEEXT): $(generic_plugin_test_OBJECTS) $(generic_plugin_test_DEPENDENCIES) $(EXTRA_generic_plugin_test_DEPENDENCIES) generic/$(am__dirstamp)
@rm -f generic/plugin-test$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(generic_plugin_test_OBJECTS) $(generic_plugin_test_LDADD) $(LIBS)
@@ -561,26 +825,15 @@ clean-libtool:
-rm -rf elements/.libs elements/_libs
-rm -rf generic/.libs generic/_libs
-ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
- list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
- unique=`for i in $$list; do \
- if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
- done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
- mkid -fID $$unique
-tags: TAGS
-
-TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
- $(TAGS_FILES) $(LISP)
+ID: $(am__tagged_files)
+ $(am__define_uniq_tagged_files); mkid -fID $$unique
+tags: tags-am
+TAGS: tags
+
+tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
set x; \
here=`pwd`; \
- list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
- unique=`for i in $$list; do \
- if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
- done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
+ $(am__define_uniq_tagged_files); \
shift; \
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
@@ -592,15 +845,11 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$$unique; \
fi; \
fi
-ctags: CTAGS
-CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
- $(TAGS_FILES) $(LISP)
- list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
- unique=`for i in $$list; do \
- if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
- done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
+ctags: ctags-am
+
+CTAGS: ctags
+ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+ $(am__define_uniq_tagged_files); \
test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$unique
@@ -609,102 +858,208 @@ GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& $(am__cd) $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here"
+cscopelist: cscopelist-am
+
+cscopelist-am: $(am__tagged_files)
+ list='$(am__tagged_files)'; \
+ case "$(srcdir)" in \
+ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+ *) sdir=$(subdir)/$(srcdir) ;; \
+ esac; \
+ for i in $$list; do \
+ if test -f "$$i"; then \
+ echo "$(subdir)/$$i"; \
+ else \
+ echo "$$sdir/$$i"; \
+ fi; \
+ done >> $(top_builddir)/cscope.files
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
-check-TESTS: $(TESTS)
- @failed=0; all=0; xfail=0; xpass=0; skip=0; \
- srcdir=$(srcdir); export srcdir; \
- list=' $(TESTS) '; \
- $(am__tty_colors); \
- if test -n "$$list"; then \
- for tst in $$list; do \
- if test -f ./$$tst; then dir=./; \
- elif test -f $$tst; then dir=; \
- else dir="$(srcdir)/"; fi; \
- if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \
- all=`expr $$all + 1`; \
- case " $(XFAIL_TESTS) " in \
- *[\ \ ]$$tst[\ \ ]*) \
- xpass=`expr $$xpass + 1`; \
- failed=`expr $$failed + 1`; \
- col=$$red; res=XPASS; \
- ;; \
- *) \
- col=$$grn; res=PASS; \
- ;; \
- esac; \
- elif test $$? -ne 77; then \
- all=`expr $$all + 1`; \
- case " $(XFAIL_TESTS) " in \
- *[\ \ ]$$tst[\ \ ]*) \
- xfail=`expr $$xfail + 1`; \
- col=$$lgn; res=XFAIL; \
- ;; \
- *) \
- failed=`expr $$failed + 1`; \
- col=$$red; res=FAIL; \
- ;; \
- esac; \
- else \
- skip=`expr $$skip + 1`; \
- col=$$blu; res=SKIP; \
- fi; \
- echo "$${col}$$res$${std}: $$tst"; \
- done; \
- if test "$$all" -eq 1; then \
- tests="test"; \
- All=""; \
- else \
- tests="tests"; \
- All="All "; \
+# Recover from deleted '.trs' file; this should ensure that
+# "rm -f foo.log; make foo.trs" re-run 'foo.test', and re-create
+# both 'foo.log' and 'foo.trs'. Break the recipe in two subshells
+# to avoid problems with "make -n".
+.log.trs:
+ rm -f $< $@
+ $(MAKE) $(AM_MAKEFLAGS) $<
+
+# Leading 'am--fnord' is there to ensure the list of targets does not
+# expand to empty, as could happen e.g. with make check TESTS=''.
+am--fnord $(TEST_LOGS) $(TEST_LOGS:.log=.trs): $(am__force_recheck)
+am--force-recheck:
+ @:
+
+$(TEST_SUITE_LOG): $(TEST_LOGS)
+ @$(am__set_TESTS_bases); \
+ am__f_ok () { test -f "$$1" && test -r "$$1"; }; \
+ redo_bases=`for i in $$bases; do \
+ am__f_ok $$i.trs && am__f_ok $$i.log || echo $$i; \
+ done`; \
+ if test -n "$$redo_bases"; then \
+ redo_logs=`for i in $$redo_bases; do echo $$i.log; done`; \
+ redo_results=`for i in $$redo_bases; do echo $$i.trs; done`; \
+ if $(am__make_dryrun); then :; else \
+ rm -f $$redo_logs && rm -f $$redo_results || exit 1; \
fi; \
- if test "$$failed" -eq 0; then \
- if test "$$xfail" -eq 0; then \
- banner="$$All$$all $$tests passed"; \
- else \
- if test "$$xfail" -eq 1; then failures=failure; else failures=failures; fi; \
- banner="$$All$$all $$tests behaved as expected ($$xfail expected $$failures)"; \
- fi; \
- else \
- if test "$$xpass" -eq 0; then \
- banner="$$failed of $$all $$tests failed"; \
+ fi; \
+ if test -n "$$am__remaking_logs"; then \
+ echo "fatal: making $(TEST_SUITE_LOG): possible infinite" \
+ "recursion detected" >&2; \
+ else \
+ am__remaking_logs=yes $(MAKE) $(AM_MAKEFLAGS) $$redo_logs; \
+ fi; \
+ if $(am__make_dryrun); then :; else \
+ st=0; \
+ errmsg="fatal: making $(TEST_SUITE_LOG): failed to create"; \
+ for i in $$redo_bases; do \
+ test -f $$i.trs && test -r $$i.trs \
+ || { echo "$$errmsg $$i.trs" >&2; st=1; }; \
+ test -f $$i.log && test -r $$i.log \
+ || { echo "$$errmsg $$i.log" >&2; st=1; }; \
+ done; \
+ test $$st -eq 0 || exit 1; \
+ fi
+ @$(am__sh_e_setup); $(am__tty_colors); $(am__set_TESTS_bases); \
+ ws='[ ]'; \
+ results=`for b in $$bases; do echo $$b.trs; done`; \
+ test -n "$$results" || results=/dev/null; \
+ all=` grep "^$$ws*:test-result:" $$results | wc -l`; \
+ pass=` grep "^$$ws*:test-result:$$ws*PASS" $$results | wc -l`; \
+ fail=` grep "^$$ws*:test-result:$$ws*FAIL" $$results | wc -l`; \
+ skip=` grep "^$$ws*:test-result:$$ws*SKIP" $$results | wc -l`; \
+ xfail=`grep "^$$ws*:test-result:$$ws*XFAIL" $$results | wc -l`; \
+ xpass=`grep "^$$ws*:test-result:$$ws*XPASS" $$results | wc -l`; \
+ error=`grep "^$$ws*:test-result:$$ws*ERROR" $$results | wc -l`; \
+ if test `expr $$fail + $$xpass + $$error` -eq 0; then \
+ success=true; \
+ else \
+ success=false; \
+ fi; \
+ br='==================='; br=$$br$$br$$br$$br; \
+ result_count () \
+ { \
+ if test x"$$1" = x"--maybe-color"; then \
+ maybe_colorize=yes; \
+ elif test x"$$1" = x"--no-color"; then \
+ maybe_colorize=no; \
else \
- if test "$$xpass" -eq 1; then passes=pass; else passes=passes; fi; \
- banner="$$failed of $$all $$tests did not behave as expected ($$xpass unexpected $$passes)"; \
+ echo "$@: invalid 'result_count' usage" >&2; exit 4; \
fi; \
- fi; \
- dashes="$$banner"; \
- skipped=""; \
- if test "$$skip" -ne 0; then \
- if test "$$skip" -eq 1; then \
- skipped="($$skip test was not run)"; \
+ shift; \
+ desc=$$1 count=$$2; \
+ if test $$maybe_colorize = yes && test $$count -gt 0; then \
+ color_start=$$3 color_end=$$std; \
else \
- skipped="($$skip tests were not run)"; \
+ color_start= color_end=; \
fi; \
- test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \
- dashes="$$skipped"; \
- fi; \
- report=""; \
- if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \
- report="Please report to $(PACKAGE_BUGREPORT)"; \
- test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \
- dashes="$$report"; \
- fi; \
- dashes=`echo "$$dashes" | sed s/./=/g`; \
- if test "$$failed" -eq 0; then \
- col="$$grn"; \
- else \
- col="$$red"; \
- fi; \
- echo "$${col}$$dashes$${std}"; \
- echo "$${col}$$banner$${std}"; \
- test -z "$$skipped" || echo "$${col}$$skipped$${std}"; \
- test -z "$$report" || echo "$${col}$$report$${std}"; \
- echo "$${col}$$dashes$${std}"; \
- test "$$failed" -eq 0; \
- else :; fi
+ echo "$${color_start}# $$desc $$count$${color_end}"; \
+ }; \
+ create_testsuite_report () \
+ { \
+ result_count $$1 "TOTAL:" $$all "$$brg"; \
+ result_count $$1 "PASS: " $$pass "$$grn"; \
+ result_count $$1 "SKIP: " $$skip "$$blu"; \
+ result_count $$1 "XFAIL:" $$xfail "$$lgn"; \
+ result_count $$1 "FAIL: " $$fail "$$red"; \
+ result_count $$1 "XPASS:" $$xpass "$$red"; \
+ result_count $$1 "ERROR:" $$error "$$mgn"; \
+ }; \
+ { \
+ echo "$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)" | \
+ $(am__rst_title); \
+ create_testsuite_report --no-color; \
+ echo; \
+ echo ".. contents:: :depth: 2"; \
+ echo; \
+ for b in $$bases; do echo $$b; done \
+ | $(am__create_global_log); \
+ } >$(TEST_SUITE_LOG).tmp || exit 1; \
+ mv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG); \
+ if $$success; then \
+ col="$$grn"; \
+ else \
+ col="$$red"; \
+ test x"$$VERBOSE" = x || cat $(TEST_SUITE_LOG); \
+ fi; \
+ echo "$${col}$$br$${std}"; \
+ echo "$${col}Testsuite summary for $(PACKAGE_STRING)$${std}"; \
+ echo "$${col}$$br$${std}"; \
+ create_testsuite_report --maybe-color; \
+ echo "$$col$$br$$std"; \
+ if $$success; then :; else \
+ echo "$${col}See $(subdir)/$(TEST_SUITE_LOG)$${std}"; \
+ if test -n "$(PACKAGE_BUGREPORT)"; then \
+ echo "$${col}Please report to $(PACKAGE_BUGREPORT)$${std}"; \
+ fi; \
+ echo "$$col$$br$$std"; \
+ fi; \
+ $$success || exit 1
+
+check-TESTS:
+ @list='$(RECHECK_LOGS)'; test -z "$$list" || rm -f $$list
+ @list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list
+ @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG)
+ @set +e; $(am__set_TESTS_bases); \
+ log_list=`for i in $$bases; do echo $$i.log; done`; \
+ trs_list=`for i in $$bases; do echo $$i.trs; done`; \
+ log_list=`echo $$log_list`; trs_list=`echo $$trs_list`; \
+ $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$log_list"; \
+ exit $$?;
+recheck: all $(check_PROGRAMS)
+ @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG)
+ @set +e; $(am__set_TESTS_bases); \
+ bases=`for i in $$bases; do echo $$i; done \
+ | $(am__list_recheck_tests)` || exit 1; \
+ log_list=`for i in $$bases; do echo $$i.log; done`; \
+ log_list=`echo $$log_list`; \
+ $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) \
+ am__force_recheck=am--force-recheck \
+ TEST_LOGS="$$log_list"; \
+ exit $$?
+generic/plugin-test.log: generic/plugin-test$(EXEEXT)
+ @p='generic/plugin-test$(EXEEXT)'; \
+ b='generic/plugin-test'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+generic/libavcodec-locking.log: generic/libavcodec-locking$(EXEEXT)
+ @p='generic/libavcodec-locking$(EXEEXT)'; \
+ b='generic/libavcodec-locking'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+elements/avdec_adpcm.log: elements/avdec_adpcm$(EXEEXT)
+ @p='elements/avdec_adpcm$(EXEEXT)'; \
+ b='elements/avdec_adpcm'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+elements/avdemux_ape.log: elements/avdemux_ape$(EXEEXT)
+ @p='elements/avdemux_ape$(EXEEXT)'; \
+ b='elements/avdemux_ape'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+.test.log:
+ @p='$<'; \
+ $(am__set_b); \
+ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+@am__EXEEXT_TRUE@.test$(EXEEXT).log:
+@am__EXEEXT_TRUE@ @p='$<'; \
+@am__EXEEXT_TRUE@ $(am__set_b); \
+@am__EXEEXT_TRUE@ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \
+@am__EXEEXT_TRUE@ --log-file $$b.log --trs-file $$b.trs \
+@am__EXEEXT_TRUE@ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \
+@am__EXEEXT_TRUE@ "$$tst" $(AM_TESTS_FD_REDIRECT)
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
@@ -762,6 +1117,9 @@ install-strip:
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
fi
mostlyclean-generic:
+ -test -z "$(TEST_LOGS)" || rm -f $(TEST_LOGS)
+ -test -z "$(TEST_LOGS:.log=.trs)" || rm -f $(TEST_LOGS:.log=.trs)
+ -test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG)
clean-generic:
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
@@ -848,19 +1206,20 @@ uninstall-am:
.MAKE: check-am install-am install-strip
-.PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \
+.PHONY: CTAGS GTAGS TAGS all all-am check check-TESTS check-am clean \
clean-checkPROGRAMS clean-generic clean-libtool clean-local \
- clean-noinstPROGRAMS ctags distclean distclean-compile \
- distclean-generic distclean-libtool distclean-tags distdir dvi \
- dvi-am html html-am info info-am install install-am \
- install-data install-data-am install-dvi install-dvi-am \
- install-exec install-exec-am install-html install-html-am \
- install-info install-info-am install-man install-pdf \
- install-pdf-am install-ps install-ps-am install-strip \
- installcheck installcheck-am installdirs maintainer-clean \
- maintainer-clean-generic mostlyclean mostlyclean-compile \
- mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
- tags uninstall uninstall-am
+ clean-noinstPROGRAMS cscopelist-am ctags ctags-am distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+ pdf pdf-am ps ps-am recheck tags tags-am uninstall \
+ uninstall-am
# keep target around, since it's referenced in the modules' Makefiles
@@ -873,6 +1232,8 @@ clean-local-check:
@HAVE_VALGRIND_FALSE@check-valgrind:
@HAVE_VALGRIND_FALSE@ @true
+LOOPS ?= 10
+
# run any given test by running make test.check
# if the test fails, run it again at at least debug level 2
%.check: %
@@ -934,6 +1295,17 @@ clean-local-check:
--gen-suppressions=all \
./$* 2>&1 | tee suppressions.log
+# valgrind torture any given test
+%.valgrind-torture: %
+ @for i in `seq 1 $(LOOPS)`; do \
+ $(MAKE) $*.valgrind || \
+ (echo "Failure after $$i runs"; exit 1) || \
+ exit 1; \
+ done
+ @banner="All $(LOOPS) loops passed"; \
+ dashes=`echo "$$banner" | sed s/./=/g`; \
+ echo $$dashes; echo $$banner; echo $$dashes
+
# valgrind any given test until failure by running make test.valgrind-forever
%.valgrind-forever: %
@while $(MAKE) $*.valgrind; do \
@@ -946,9 +1318,31 @@ clean-local-check:
$(LIBTOOL) --mode=execute \
gdb $*
+%.lcov-reset:
+ $(MAKE) $*.lcov-run
+ $(MAKE) $*.lcov-report
+
+%.lcov: %
+ $(MAKE) $*.lcov-reset
+
+@GST_GCOV_ENABLED_TRUE@%.lcov-clean:
+@GST_GCOV_ENABLED_TRUE@ $(MAKE) -C $(top_builddir) lcov-clean
+
+@GST_GCOV_ENABLED_TRUE@%.lcov-run:
+@GST_GCOV_ENABLED_TRUE@ $(MAKE) $*.lcov-clean
+@GST_GCOV_ENABLED_TRUE@ $(MAKE) $*.check
+
+@GST_GCOV_ENABLED_TRUE@%.lcov-report:
+@GST_GCOV_ENABLED_TRUE@ $(MAKE) -C $(top_builddir) lcov-report
+@GST_GCOV_ENABLED_FALSE@%.lcov-run:
+@GST_GCOV_ENABLED_FALSE@ echo "Need to reconfigure with --enable-gcov"
+
+@GST_GCOV_ENABLED_FALSE@%.lcov-report:
+@GST_GCOV_ENABLED_FALSE@ echo "Need to reconfigure with --enable-gcov"
+
# torture tests
torture: $(TESTS)
- -rm test-registry.xml
+ -rm test-registry.*
@echo "Torturing tests ..."
@for i in `seq 1 $(LOOPS)`; do \
$(MAKE) check || \
@@ -961,7 +1355,7 @@ torture: $(TESTS)
# forever tests
forever: $(TESTS)
- -rm test-registry.xml
+ -rm test-registry.*
@echo "Forever tests ..."
@while true; do \
$(MAKE) check || \
@@ -987,6 +1381,29 @@ valgrind: $(TESTS)
false; \
fi
+# valgrind all tests until failure
+valgrind-forever: $(TESTS)
+ -rm test-registry.*
+ @echo "Forever valgrinding tests ..."
+ @while true; do \
+ $(MAKE) valgrind || \
+ (echo "Failure"; exit 1) || \
+ exit 1; \
+ done
+
+# valgrind torture all tests
+valgrind-torture: $(TESTS)
+ -rm test-registry.*
+ @echo "Torturing and valgrinding tests ..."
+ @for i in `seq 1 $(LOOPS)`; do \
+ $(MAKE) valgrind || \
+ (echo "Failure after $$i runs"; exit 1) || \
+ exit 1; \
+ done
+ @banner="All $(LOOPS) loops passed"; \
+ dashes=`echo "$$banner" | sed s/./=/g`; \
+ echo $$dashes; echo $$banner; echo $$dashes
+
# valgrind all tests and generate suppressions
valgrind.gen-suppressions: $(TESTS)
@echo "Valgrinding tests ..."
@@ -1023,10 +1440,13 @@ help:
@echo "make (dir)/(test).gdb -- start up gdb for the given test"
@echo
@echo "make valgrind -- valgrind all tests"
+ @echo "make valgrind-forever -- valgrind all tests forever"
+ @echo "make valgrind-torture -- valgrind all tests $(LOOPS) times"
@echo "make valgrind.gen-suppressions -- generate suppressions for all tests"
@echo " and save to suppressions.log"
@echo "make (dir)/(test).valgrind -- valgrind the given test"
@echo "make (dir)/(test).valgrind-forever -- valgrind the given test forever"
+ @echo "make (dir)/(test).valgrind-torture -- valgrind the given test $(LOOPS) times"
@echo "make (dir)/(test).valgrind.gen-suppressions -- generate suppressions"
@echo " and save to suppressions.log"
@echo "make inspect -- inspect all plugin features"
diff --git a/tests/check/elements/avdec_adpcm.c b/tests/check/elements/avdec_adpcm.c
index 8cf9f6f..2bc745d 100644
--- a/tests/check/elements/avdec_adpcm.c
+++ b/tests/check/elements/avdec_adpcm.c
@@ -14,8 +14,8 @@
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
*/
#include <gst/check/gstcheck.h>
diff --git a/tests/check/elements/avdemux_ape.c b/tests/check/elements/avdemux_ape.c
index ddc2f88..4362201 100644
--- a/tests/check/elements/avdemux_ape.c
+++ b/tests/check/elements/avdemux_ape.c
@@ -14,8 +14,8 @@
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
*/
#include <gst/check/gstcheck.h>
diff --git a/tests/check/generic/libavcodec-locking.c b/tests/check/generic/libavcodec-locking.c
index 453d6a0..5990941 100644
--- a/tests/check/generic/libavcodec-locking.c
+++ b/tests/check/generic/libavcodec-locking.c
@@ -16,8 +16,8 @@
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
*/
diff --git a/tests/check/generic/plugin-test.c b/tests/check/generic/plugin-test.c
index d661fce..e1bfdef 100644
--- a/tests/check/generic/plugin-test.c
+++ b/tests/check/generic/plugin-test.c
@@ -16,8 +16,8 @@
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
*/
diff --git a/tests/files/Makefile.in b/tests/files/Makefile.in
index 770272b..5493e7c 100644
--- a/tests/files/Makefile.in
+++ b/tests/files/Makefile.in
@@ -1,9 +1,8 @@
-# Makefile.in generated by automake 1.11.6 from Makefile.am.
+# Makefile.in generated by automake 1.13.3 from Makefile.am.
# @configure_input@
-# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-# Foundation, Inc.
+# Copyright (C) 1994-2013 Free Software Foundation, Inc.
+
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -15,23 +14,51 @@
@SET_MAKE@
VPATH = @srcdir@
-am__make_dryrun = \
- { \
- am__dry=no; \
+am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
+am__make_running_with_option = \
+ case $${target_option-} in \
+ ?) ;; \
+ *) echo "am__make_running_with_option: internal error: invalid" \
+ "target option '$${target_option-}' specified" >&2; \
+ exit 1;; \
+ esac; \
+ has_opt=no; \
+ sane_makeflags=$$MAKEFLAGS; \
+ if $(am__is_gnu_make); then \
+ sane_makeflags=$$MFLAGS; \
+ else \
case $$MAKEFLAGS in \
*\\[\ \ ]*) \
- echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
- | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
- *) \
- for am__flg in $$MAKEFLAGS; do \
- case $$am__flg in \
- *=*|--*) ;; \
- *n*) am__dry=yes; break;; \
- esac; \
- done;; \
+ bs=\\; \
+ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
+ esac; \
+ fi; \
+ skip_next=no; \
+ strip_trailopt () \
+ { \
+ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+ }; \
+ for flg in $$sane_makeflags; do \
+ test $$skip_next = yes && { skip_next=no; continue; }; \
+ case $$flg in \
+ *=*|--*) continue;; \
+ -*I) strip_trailopt 'I'; skip_next=yes;; \
+ -*I?*) strip_trailopt 'I';; \
+ -*O) strip_trailopt 'O'; skip_next=yes;; \
+ -*O?*) strip_trailopt 'O';; \
+ -*l) strip_trailopt 'l'; skip_next=yes;; \
+ -*l?*) strip_trailopt 'l';; \
+ -[dEDm]) skip_next=yes;; \
+ -[JT]) skip_next=yes;; \
+ esac; \
+ case $$flg in \
+ *$$target_option*) has_opt=yes; break;; \
esac; \
- test $$am__dry = yes; \
- }
+ done; \
+ test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
@@ -52,7 +79,7 @@ build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
subdir = tests/files
-DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/common/m4/as-ac-expand.m4 \
$(top_srcdir)/common/m4/as-auto-alt.m4 \
@@ -82,12 +109,18 @@ mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
+AM_V_P = $(am__v_P_@AM_V@)
+am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
+am__v_P_0 = false
+am__v_P_1 = :
AM_V_GEN = $(am__v_GEN_@AM_V@)
am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
-am__v_GEN_0 = @echo " GEN " $@;
+am__v_GEN_0 = @echo " GEN " $@;
+am__v_GEN_1 =
AM_V_at = $(am__v_at_@AM_V@)
am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
am__v_at_0 = @
+am__v_at_1 =
SOURCES =
DIST_SOURCES =
am__can_run_installinfo = \
@@ -95,6 +128,7 @@ am__can_run_installinfo = \
n|no|NO) false;; \
*) (install-info --version) >/dev/null 2>&1;; \
esac
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@
@@ -109,10 +143,12 @@ AWK = @AWK@
CAT_ENTRY_END = @CAT_ENTRY_END@
CAT_ENTRY_START = @CAT_ENTRY_START@
CC = @CC@
+CCASFLAGS = @CCASFLAGS@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
+CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DARWIN_LDFLAGS = @DARWIN_LDFLAGS@
DEFS = @DEFS@
@@ -128,7 +164,11 @@ ECHO_T = @ECHO_T@
EGREP = @EGREP@
ERROR_CFLAGS = @ERROR_CFLAGS@
EXEEXT = @EXEEXT@
+FFLAGS = @FFLAGS@
FGREP = @FGREP@
+GCOV = @GCOV@
+GCOV_CFLAGS = @GCOV_CFLAGS@
+GCOV_LIBS = @GCOV_LIBS@
GREP = @GREP@
GSTPB_PLUGINS_DIR = @GSTPB_PLUGINS_DIR@
GST_AGE = @GST_AGE@
@@ -161,16 +201,15 @@ GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@
GTKDOC_MKPDF = @GTKDOC_MKPDF@
GTKDOC_REBASE = @GTKDOC_REBASE@
HAVE_BZ2 = @HAVE_BZ2@
-HAVE_DOCBOOK2HTML = @HAVE_DOCBOOK2HTML@
HAVE_DOCBOOK2PS = @HAVE_DOCBOOK2PS@
HAVE_DVIPS = @HAVE_DVIPS@
HAVE_EPSTOPDF = @HAVE_EPSTOPDF@
-HAVE_FIG2DEV = @HAVE_FIG2DEV@
HAVE_JADETEX = @HAVE_JADETEX@
HAVE_PNGTOPNM = @HAVE_PNGTOPNM@
HAVE_PNMTOPS = @HAVE_PNMTOPS@
HAVE_PS2PDF = @HAVE_PS2PDF@
HAVE_XMLLINT = @HAVE_XMLLINT@
+HAVE_XSLTPROC = @HAVE_XSLTPROC@
HTML_DIR = @HTML_DIR@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
@@ -350,11 +389,11 @@ mostlyclean-libtool:
clean-libtool:
-rm -rf .libs _libs
-tags: TAGS
-TAGS:
+tags TAGS:
+
+ctags CTAGS:
-ctags: CTAGS
-CTAGS:
+cscope cscopelist:
distdir: $(DISTFILES)
@@ -490,15 +529,16 @@ uninstall-am:
.MAKE: install-am install-strip
.PHONY: all all-am check check-am clean clean-generic clean-libtool \
- distclean distclean-generic distclean-libtool distdir dvi \
- dvi-am html html-am info info-am install install-am \
- install-data install-data-am install-dvi install-dvi-am \
- install-exec install-exec-am install-html install-html-am \
- install-info install-info-am install-man install-pdf \
- install-pdf-am install-ps install-ps-am install-strip \
- installcheck installcheck-am installdirs maintainer-clean \
- maintainer-clean-generic mostlyclean mostlyclean-generic \
- mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am
+ cscopelist-am ctags-am distclean distclean-generic \
+ distclean-libtool distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags-am uninstall uninstall-am
# Tell versions [3.59,3.63) of GNU make to not export all variables.